azot 0.6.0 → 0.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- "use strict";var rt=Object.create;var ce=Object.defineProperty;var ot=Object.getOwnPropertyDescriptor;var st=Object.getOwnPropertyNames;var at=Object.getPrototypeOf,ct=Object.prototype.hasOwnProperty;var lt=(o,r,t,e)=>{if(r&&typeof r=="object"||typeof r=="function")for(let n of st(r))!ct.call(o,n)&&n!==t&&ce(o,n,{get:()=>r[n],enumerable:!(e=ot(r,n))||e.enumerable});return o};var ut=(o,r,t)=>(t=o!=null?rt(at(o)):{},lt(r||!o||!o.__esModule?ce(t,"default",{value:o,enumerable:!0}):t,o));var Ze=require("util");var I=require("fs/promises"),W=require("path");var J=ut(require("protobufjs/minimal.js"),1),f=J.default||J,u=f.Reader,d=f.Writer,a=f.util,c=f.roots.default||(f.roots.default={}),Y=c.LicenseType=(()=>{let o={},r=Object.create(o);return r[o[1]="STREAMING"]=1,r[o[2]="OFFLINE"]=2,r[o[3]="AUTOMATIC"]=3,r})(),Dt=c.PlatformVerificationStatus=(()=>{let o={},r=Object.create(o);return r[o[0]="PLATFORM_UNVERIFIED"]=0,r[o[1]="PLATFORM_TAMPERED"]=1,r[o[2]="PLATFORM_SOFTWARE_VERIFIED"]=2,r[o[3]="PLATFORM_HARDWARE_VERIFIED"]=3,r[o[4]="PLATFORM_NO_VERIFICATION"]=4,r[o[5]="PLATFORM_SECURE_STORAGE_SOFTWARE_VERIFIED"]=5,r})(),Pt=c.LicenseIdentification=(()=>{function o(r){if(r)for(var t=Object.keys(r),e=0;e<t.length;++e)r[t[e]]!=null&&(this[t[e]]=r[t[e]])}return o.prototype.requestId=a.newBuffer([]),o.prototype.sessionId=a.newBuffer([]),o.prototype.purchaseId=a.newBuffer([]),o.prototype.type=1,o.prototype.version=0,o.prototype.providerSessionToken=a.newBuffer([]),o.create=function(t){return new o(t)},o.encode=function(t,e){return e||(e=d.create()),t.requestId!=null&&Object.hasOwnProperty.call(t,"requestId")&&e.uint32(10).bytes(t.requestId),t.sessionId!=null&&Object.hasOwnProperty.call(t,"sessionId")&&e.uint32(18).bytes(t.sessionId),t.purchaseId!=null&&Object.hasOwnProperty.call(t,"purchaseId")&&e.uint32(26).bytes(t.purchaseId),t.type!=null&&Object.hasOwnProperty.call(t,"type")&&e.uint32(32).int32(t.type),t.version!=null&&Object.hasOwnProperty.call(t,"version")&&e.uint32(40).int32(t.version),t.providerSessionToken!=null&&Object.hasOwnProperty.call(t,"providerSessionToken")&&e.uint32(50).bytes(t.providerSessionToken),e},o.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},o.decode=function(t,e){t instanceof u||(t=u.create(t));for(var n=e===void 0?t.len:t.pos+e,i=new c.LicenseIdentification;t.pos<n;){var s=t.uint32();switch(s>>>3){case 1:{i.requestId=t.bytes();break}case 2:{i.sessionId=t.bytes();break}case 3:{i.purchaseId=t.bytes();break}case 4:{i.type=t.int32();break}case 5:{i.version=t.int32();break}case 6:{i.providerSessionToken=t.bytes();break}default:t.skipType(s&7);break}}return i},o.decodeDelimited=function(t){return t instanceof u||(t=new u(t)),this.decode(t,t.uint32())},o.fromObject=function(t){if(t instanceof c.LicenseIdentification)return t;var e=new c.LicenseIdentification;switch(t.requestId!=null&&(typeof t.requestId=="string"?a.base64.decode(t.requestId,e.requestId=a.newBuffer(a.base64.length(t.requestId)),0):t.requestId.length>=0&&(e.requestId=t.requestId)),t.sessionId!=null&&(typeof t.sessionId=="string"?a.base64.decode(t.sessionId,e.sessionId=a.newBuffer(a.base64.length(t.sessionId)),0):t.sessionId.length>=0&&(e.sessionId=t.sessionId)),t.purchaseId!=null&&(typeof t.purchaseId=="string"?a.base64.decode(t.purchaseId,e.purchaseId=a.newBuffer(a.base64.length(t.purchaseId)),0):t.purchaseId.length>=0&&(e.purchaseId=t.purchaseId)),t.type){default:if(typeof t.type=="number"){e.type=t.type;break}break;case"STREAMING":case 1:e.type=1;break;case"OFFLINE":case 2:e.type=2;break;case"AUTOMATIC":case 3:e.type=3;break}return t.version!=null&&(e.version=t.version|0),t.providerSessionToken!=null&&(typeof t.providerSessionToken=="string"?a.base64.decode(t.providerSessionToken,e.providerSessionToken=a.newBuffer(a.base64.length(t.providerSessionToken)),0):t.providerSessionToken.length>=0&&(e.providerSessionToken=t.providerSessionToken)),e},o.toObject=function(t,e){e||(e={});var n={};return e.defaults&&(e.bytes===String?n.requestId="":(n.requestId=[],e.bytes!==Array&&(n.requestId=a.newBuffer(n.requestId))),e.bytes===String?n.sessionId="":(n.sessionId=[],e.bytes!==Array&&(n.sessionId=a.newBuffer(n.sessionId))),e.bytes===String?n.purchaseId="":(n.purchaseId=[],e.bytes!==Array&&(n.purchaseId=a.newBuffer(n.purchaseId))),n.type=e.enums===String?"STREAMING":1,n.version=0,e.bytes===String?n.providerSessionToken="":(n.providerSessionToken=[],e.bytes!==Array&&(n.providerSessionToken=a.newBuffer(n.providerSessionToken)))),t.requestId!=null&&t.hasOwnProperty("requestId")&&(n.requestId=e.bytes===String?a.base64.encode(t.requestId,0,t.requestId.length):e.bytes===Array?Array.prototype.slice.call(t.requestId):t.requestId),t.sessionId!=null&&t.hasOwnProperty("sessionId")&&(n.sessionId=e.bytes===String?a.base64.encode(t.sessionId,0,t.sessionId.length):e.bytes===Array?Array.prototype.slice.call(t.sessionId):t.sessionId),t.purchaseId!=null&&t.hasOwnProperty("purchaseId")&&(n.purchaseId=e.bytes===String?a.base64.encode(t.purchaseId,0,t.purchaseId.length):e.bytes===Array?Array.prototype.slice.call(t.purchaseId):t.purchaseId),t.type!=null&&t.hasOwnProperty("type")&&(n.type=e.enums===String?c.LicenseType[t.type]===void 0?t.type:c.LicenseType[t.type]:t.type),t.version!=null&&t.hasOwnProperty("version")&&(n.version=t.version),t.providerSessionToken!=null&&t.hasOwnProperty("providerSessionToken")&&(n.providerSessionToken=e.bytes===String?a.base64.encode(t.providerSessionToken,0,t.providerSessionToken.length):e.bytes===Array?Array.prototype.slice.call(t.providerSessionToken):t.providerSessionToken),n},o.prototype.toJSON=function(){return this.constructor.toObject(this,f.util.toJSONOptions)},o.getTypeUrl=function(t){return t===void 0&&(t="type.googleapis.com"),t+"/LicenseIdentification"},o})(),U=c.License=(()=>{function o(r){if(this.key=[],this.groupIds=[],r)for(var t=Object.keys(r),e=0;e<t.length;++e)r[t[e]]!=null&&(this[t[e]]=r[t[e]])}return o.prototype.id=null,o.prototype.policy=null,o.prototype.key=a.emptyArray,o.prototype.licenseStartTime=a.Long?a.Long.fromBits(0,0,!1):0,o.prototype.remoteAttestationVerified=!1,o.prototype.providerClientToken=a.newBuffer([]),o.prototype.protectionScheme=0,o.prototype.srmRequirement=a.newBuffer([]),o.prototype.srmUpdate=a.newBuffer([]),o.prototype.platformVerificationStatus=4,o.prototype.groupIds=a.emptyArray,o.create=function(t){return new o(t)},o.encode=function(t,e){if(e||(e=d.create()),t.id!=null&&Object.hasOwnProperty.call(t,"id")&&c.LicenseIdentification.encode(t.id,e.uint32(10).fork()).ldelim(),t.policy!=null&&Object.hasOwnProperty.call(t,"policy")&&c.License.Policy.encode(t.policy,e.uint32(18).fork()).ldelim(),t.key!=null&&t.key.length)for(var n=0;n<t.key.length;++n)c.License.KeyContainer.encode(t.key[n],e.uint32(26).fork()).ldelim();if(t.licenseStartTime!=null&&Object.hasOwnProperty.call(t,"licenseStartTime")&&e.uint32(32).int64(t.licenseStartTime),t.remoteAttestationVerified!=null&&Object.hasOwnProperty.call(t,"remoteAttestationVerified")&&e.uint32(40).bool(t.remoteAttestationVerified),t.providerClientToken!=null&&Object.hasOwnProperty.call(t,"providerClientToken")&&e.uint32(50).bytes(t.providerClientToken),t.protectionScheme!=null&&Object.hasOwnProperty.call(t,"protectionScheme")&&e.uint32(56).uint32(t.protectionScheme),t.srmRequirement!=null&&Object.hasOwnProperty.call(t,"srmRequirement")&&e.uint32(66).bytes(t.srmRequirement),t.srmUpdate!=null&&Object.hasOwnProperty.call(t,"srmUpdate")&&e.uint32(74).bytes(t.srmUpdate),t.platformVerificationStatus!=null&&Object.hasOwnProperty.call(t,"platformVerificationStatus")&&e.uint32(80).int32(t.platformVerificationStatus),t.groupIds!=null&&t.groupIds.length)for(var n=0;n<t.groupIds.length;++n)e.uint32(90).bytes(t.groupIds[n]);return e},o.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},o.decode=function(t,e){t instanceof u||(t=u.create(t));for(var n=e===void 0?t.len:t.pos+e,i=new c.License;t.pos<n;){var s=t.uint32();switch(s>>>3){case 1:{i.id=c.LicenseIdentification.decode(t,t.uint32());break}case 2:{i.policy=c.License.Policy.decode(t,t.uint32());break}case 3:{i.key&&i.key.length||(i.key=[]),i.key.push(c.License.KeyContainer.decode(t,t.uint32()));break}case 4:{i.licenseStartTime=t.int64();break}case 5:{i.remoteAttestationVerified=t.bool();break}case 6:{i.providerClientToken=t.bytes();break}case 7:{i.protectionScheme=t.uint32();break}case 8:{i.srmRequirement=t.bytes();break}case 9:{i.srmUpdate=t.bytes();break}case 10:{i.platformVerificationStatus=t.int32();break}case 11:{i.groupIds&&i.groupIds.length||(i.groupIds=[]),i.groupIds.push(t.bytes());break}default:t.skipType(s&7);break}}return i},o.decodeDelimited=function(t){return t instanceof u||(t=new u(t)),this.decode(t,t.uint32())},o.fromObject=function(t){if(t instanceof c.License)return t;var e=new c.License;if(t.id!=null){if(typeof t.id!="object")throw TypeError(".License.id: object expected");e.id=c.LicenseIdentification.fromObject(t.id)}if(t.policy!=null){if(typeof t.policy!="object")throw TypeError(".License.policy: object expected");e.policy=c.License.Policy.fromObject(t.policy)}if(t.key){if(!Array.isArray(t.key))throw TypeError(".License.key: array expected");e.key=[];for(var n=0;n<t.key.length;++n){if(typeof t.key[n]!="object")throw TypeError(".License.key: object expected");e.key[n]=c.License.KeyContainer.fromObject(t.key[n])}}switch(t.licenseStartTime!=null&&(a.Long?(e.licenseStartTime=a.Long.fromValue(t.licenseStartTime)).unsigned=!1:typeof t.licenseStartTime=="string"?e.licenseStartTime=parseInt(t.licenseStartTime,10):typeof t.licenseStartTime=="number"?e.licenseStartTime=t.licenseStartTime:typeof t.licenseStartTime=="object"&&(e.licenseStartTime=new a.LongBits(t.licenseStartTime.low>>>0,t.licenseStartTime.high>>>0).toNumber())),t.remoteAttestationVerified!=null&&(e.remoteAttestationVerified=!!t.remoteAttestationVerified),t.providerClientToken!=null&&(typeof t.providerClientToken=="string"?a.base64.decode(t.providerClientToken,e.providerClientToken=a.newBuffer(a.base64.length(t.providerClientToken)),0):t.providerClientToken.length>=0&&(e.providerClientToken=t.providerClientToken)),t.protectionScheme!=null&&(e.protectionScheme=t.protectionScheme>>>0),t.srmRequirement!=null&&(typeof t.srmRequirement=="string"?a.base64.decode(t.srmRequirement,e.srmRequirement=a.newBuffer(a.base64.length(t.srmRequirement)),0):t.srmRequirement.length>=0&&(e.srmRequirement=t.srmRequirement)),t.srmUpdate!=null&&(typeof t.srmUpdate=="string"?a.base64.decode(t.srmUpdate,e.srmUpdate=a.newBuffer(a.base64.length(t.srmUpdate)),0):t.srmUpdate.length>=0&&(e.srmUpdate=t.srmUpdate)),t.platformVerificationStatus){case"PLATFORM_UNVERIFIED":case 0:e.platformVerificationStatus=0;break;case"PLATFORM_TAMPERED":case 1:e.platformVerificationStatus=1;break;case"PLATFORM_SOFTWARE_VERIFIED":case 2:e.platformVerificationStatus=2;break;case"PLATFORM_HARDWARE_VERIFIED":case 3:e.platformVerificationStatus=3;break;default:if(typeof t.platformVerificationStatus=="number"){e.platformVerificationStatus=t.platformVerificationStatus;break}break;case"PLATFORM_NO_VERIFICATION":case 4:e.platformVerificationStatus=4;break;case"PLATFORM_SECURE_STORAGE_SOFTWARE_VERIFIED":case 5:e.platformVerificationStatus=5;break}if(t.groupIds){if(!Array.isArray(t.groupIds))throw TypeError(".License.groupIds: array expected");e.groupIds=[];for(var n=0;n<t.groupIds.length;++n)typeof t.groupIds[n]=="string"?a.base64.decode(t.groupIds[n],e.groupIds[n]=a.newBuffer(a.base64.length(t.groupIds[n])),0):t.groupIds[n].length>=0&&(e.groupIds[n]=t.groupIds[n])}return e},o.toObject=function(t,e){e||(e={});var n={};if((e.arrays||e.defaults)&&(n.key=[],n.groupIds=[]),e.defaults){if(n.id=null,n.policy=null,a.Long){var i=new a.Long(0,0,!1);n.licenseStartTime=e.longs===String?i.toString():e.longs===Number?i.toNumber():i}else n.licenseStartTime=e.longs===String?"0":0;n.remoteAttestationVerified=!1,e.bytes===String?n.providerClientToken="":(n.providerClientToken=[],e.bytes!==Array&&(n.providerClientToken=a.newBuffer(n.providerClientToken))),n.protectionScheme=0,e.bytes===String?n.srmRequirement="":(n.srmRequirement=[],e.bytes!==Array&&(n.srmRequirement=a.newBuffer(n.srmRequirement))),e.bytes===String?n.srmUpdate="":(n.srmUpdate=[],e.bytes!==Array&&(n.srmUpdate=a.newBuffer(n.srmUpdate))),n.platformVerificationStatus=e.enums===String?"PLATFORM_NO_VERIFICATION":4}if(t.id!=null&&t.hasOwnProperty("id")&&(n.id=c.LicenseIdentification.toObject(t.id,e)),t.policy!=null&&t.hasOwnProperty("policy")&&(n.policy=c.License.Policy.toObject(t.policy,e)),t.key&&t.key.length){n.key=[];for(var s=0;s<t.key.length;++s)n.key[s]=c.License.KeyContainer.toObject(t.key[s],e)}if(t.licenseStartTime!=null&&t.hasOwnProperty("licenseStartTime")&&(typeof t.licenseStartTime=="number"?n.licenseStartTime=e.longs===String?String(t.licenseStartTime):t.licenseStartTime:n.licenseStartTime=e.longs===String?a.Long.prototype.toString.call(t.licenseStartTime):e.longs===Number?new a.LongBits(t.licenseStartTime.low>>>0,t.licenseStartTime.high>>>0).toNumber():t.licenseStartTime),t.remoteAttestationVerified!=null&&t.hasOwnProperty("remoteAttestationVerified")&&(n.remoteAttestationVerified=t.remoteAttestationVerified),t.providerClientToken!=null&&t.hasOwnProperty("providerClientToken")&&(n.providerClientToken=e.bytes===String?a.base64.encode(t.providerClientToken,0,t.providerClientToken.length):e.bytes===Array?Array.prototype.slice.call(t.providerClientToken):t.providerClientToken),t.protectionScheme!=null&&t.hasOwnProperty("protectionScheme")&&(n.protectionScheme=t.protectionScheme),t.srmRequirement!=null&&t.hasOwnProperty("srmRequirement")&&(n.srmRequirement=e.bytes===String?a.base64.encode(t.srmRequirement,0,t.srmRequirement.length):e.bytes===Array?Array.prototype.slice.call(t.srmRequirement):t.srmRequirement),t.srmUpdate!=null&&t.hasOwnProperty("srmUpdate")&&(n.srmUpdate=e.bytes===String?a.base64.encode(t.srmUpdate,0,t.srmUpdate.length):e.bytes===Array?Array.prototype.slice.call(t.srmUpdate):t.srmUpdate),t.platformVerificationStatus!=null&&t.hasOwnProperty("platformVerificationStatus")&&(n.platformVerificationStatus=e.enums===String?c.PlatformVerificationStatus[t.platformVerificationStatus]===void 0?t.platformVerificationStatus:c.PlatformVerificationStatus[t.platformVerificationStatus]:t.platformVerificationStatus),t.groupIds&&t.groupIds.length){n.groupIds=[];for(var s=0;s<t.groupIds.length;++s)n.groupIds[s]=e.bytes===String?a.base64.encode(t.groupIds[s],0,t.groupIds[s].length):e.bytes===Array?Array.prototype.slice.call(t.groupIds[s]):t.groupIds[s]}return n},o.prototype.toJSON=function(){return this.constructor.toObject(this,f.util.toJSONOptions)},o.getTypeUrl=function(t){return t===void 0&&(t="type.googleapis.com"),t+"/License"},o.Policy=function(){function r(t){if(t)for(var e=Object.keys(t),n=0;n<e.length;++n)t[e[n]]!=null&&(this[e[n]]=t[e[n]])}return r.prototype.canPlay=!1,r.prototype.canPersist=!1,r.prototype.canRenew=!1,r.prototype.rentalDurationSeconds=a.Long?a.Long.fromBits(0,0,!1):0,r.prototype.playbackDurationSeconds=a.Long?a.Long.fromBits(0,0,!1):0,r.prototype.licenseDurationSeconds=a.Long?a.Long.fromBits(0,0,!1):0,r.prototype.renewalRecoveryDurationSeconds=a.Long?a.Long.fromBits(0,0,!1):0,r.prototype.renewalServerUrl="",r.prototype.renewalDelaySeconds=a.Long?a.Long.fromBits(0,0,!1):0,r.prototype.renewalRetryIntervalSeconds=a.Long?a.Long.fromBits(0,0,!1):0,r.prototype.renewWithUsage=!1,r.prototype.alwaysIncludeClientId=!1,r.prototype.playStartGracePeriodSeconds=a.Long?a.Long.fromBits(0,0,!1):0,r.prototype.softEnforcePlaybackDuration=!1,r.prototype.softEnforceRentalDuration=!0,r.create=function(e){return new r(e)},r.encode=function(e,n){return n||(n=d.create()),e.canPlay!=null&&Object.hasOwnProperty.call(e,"canPlay")&&n.uint32(8).bool(e.canPlay),e.canPersist!=null&&Object.hasOwnProperty.call(e,"canPersist")&&n.uint32(16).bool(e.canPersist),e.canRenew!=null&&Object.hasOwnProperty.call(e,"canRenew")&&n.uint32(24).bool(e.canRenew),e.rentalDurationSeconds!=null&&Object.hasOwnProperty.call(e,"rentalDurationSeconds")&&n.uint32(32).int64(e.rentalDurationSeconds),e.playbackDurationSeconds!=null&&Object.hasOwnProperty.call(e,"playbackDurationSeconds")&&n.uint32(40).int64(e.playbackDurationSeconds),e.licenseDurationSeconds!=null&&Object.hasOwnProperty.call(e,"licenseDurationSeconds")&&n.uint32(48).int64(e.licenseDurationSeconds),e.renewalRecoveryDurationSeconds!=null&&Object.hasOwnProperty.call(e,"renewalRecoveryDurationSeconds")&&n.uint32(56).int64(e.renewalRecoveryDurationSeconds),e.renewalServerUrl!=null&&Object.hasOwnProperty.call(e,"renewalServerUrl")&&n.uint32(66).string(e.renewalServerUrl),e.renewalDelaySeconds!=null&&Object.hasOwnProperty.call(e,"renewalDelaySeconds")&&n.uint32(72).int64(e.renewalDelaySeconds),e.renewalRetryIntervalSeconds!=null&&Object.hasOwnProperty.call(e,"renewalRetryIntervalSeconds")&&n.uint32(80).int64(e.renewalRetryIntervalSeconds),e.renewWithUsage!=null&&Object.hasOwnProperty.call(e,"renewWithUsage")&&n.uint32(88).bool(e.renewWithUsage),e.alwaysIncludeClientId!=null&&Object.hasOwnProperty.call(e,"alwaysIncludeClientId")&&n.uint32(96).bool(e.alwaysIncludeClientId),e.playStartGracePeriodSeconds!=null&&Object.hasOwnProperty.call(e,"playStartGracePeriodSeconds")&&n.uint32(104).int64(e.playStartGracePeriodSeconds),e.softEnforcePlaybackDuration!=null&&Object.hasOwnProperty.call(e,"softEnforcePlaybackDuration")&&n.uint32(112).bool(e.softEnforcePlaybackDuration),e.softEnforceRentalDuration!=null&&Object.hasOwnProperty.call(e,"softEnforceRentalDuration")&&n.uint32(120).bool(e.softEnforceRentalDuration),n},r.encodeDelimited=function(e,n){return this.encode(e,n).ldelim()},r.decode=function(e,n){e instanceof u||(e=u.create(e));for(var i=n===void 0?e.len:e.pos+n,s=new c.License.Policy;e.pos<i;){var l=e.uint32();switch(l>>>3){case 1:{s.canPlay=e.bool();break}case 2:{s.canPersist=e.bool();break}case 3:{s.canRenew=e.bool();break}case 4:{s.rentalDurationSeconds=e.int64();break}case 5:{s.playbackDurationSeconds=e.int64();break}case 6:{s.licenseDurationSeconds=e.int64();break}case 7:{s.renewalRecoveryDurationSeconds=e.int64();break}case 8:{s.renewalServerUrl=e.string();break}case 9:{s.renewalDelaySeconds=e.int64();break}case 10:{s.renewalRetryIntervalSeconds=e.int64();break}case 11:{s.renewWithUsage=e.bool();break}case 12:{s.alwaysIncludeClientId=e.bool();break}case 13:{s.playStartGracePeriodSeconds=e.int64();break}case 14:{s.softEnforcePlaybackDuration=e.bool();break}case 15:{s.softEnforceRentalDuration=e.bool();break}default:e.skipType(l&7);break}}return s},r.decodeDelimited=function(e){return e instanceof u||(e=new u(e)),this.decode(e,e.uint32())},r.fromObject=function(e){if(e instanceof c.License.Policy)return e;var n=new c.License.Policy;return e.canPlay!=null&&(n.canPlay=!!e.canPlay),e.canPersist!=null&&(n.canPersist=!!e.canPersist),e.canRenew!=null&&(n.canRenew=!!e.canRenew),e.rentalDurationSeconds!=null&&(a.Long?(n.rentalDurationSeconds=a.Long.fromValue(e.rentalDurationSeconds)).unsigned=!1:typeof e.rentalDurationSeconds=="string"?n.rentalDurationSeconds=parseInt(e.rentalDurationSeconds,10):typeof e.rentalDurationSeconds=="number"?n.rentalDurationSeconds=e.rentalDurationSeconds:typeof e.rentalDurationSeconds=="object"&&(n.rentalDurationSeconds=new a.LongBits(e.rentalDurationSeconds.low>>>0,e.rentalDurationSeconds.high>>>0).toNumber())),e.playbackDurationSeconds!=null&&(a.Long?(n.playbackDurationSeconds=a.Long.fromValue(e.playbackDurationSeconds)).unsigned=!1:typeof e.playbackDurationSeconds=="string"?n.playbackDurationSeconds=parseInt(e.playbackDurationSeconds,10):typeof e.playbackDurationSeconds=="number"?n.playbackDurationSeconds=e.playbackDurationSeconds:typeof e.playbackDurationSeconds=="object"&&(n.playbackDurationSeconds=new a.LongBits(e.playbackDurationSeconds.low>>>0,e.playbackDurationSeconds.high>>>0).toNumber())),e.licenseDurationSeconds!=null&&(a.Long?(n.licenseDurationSeconds=a.Long.fromValue(e.licenseDurationSeconds)).unsigned=!1:typeof e.licenseDurationSeconds=="string"?n.licenseDurationSeconds=parseInt(e.licenseDurationSeconds,10):typeof e.licenseDurationSeconds=="number"?n.licenseDurationSeconds=e.licenseDurationSeconds:typeof e.licenseDurationSeconds=="object"&&(n.licenseDurationSeconds=new a.LongBits(e.licenseDurationSeconds.low>>>0,e.licenseDurationSeconds.high>>>0).toNumber())),e.renewalRecoveryDurationSeconds!=null&&(a.Long?(n.renewalRecoveryDurationSeconds=a.Long.fromValue(e.renewalRecoveryDurationSeconds)).unsigned=!1:typeof e.renewalRecoveryDurationSeconds=="string"?n.renewalRecoveryDurationSeconds=parseInt(e.renewalRecoveryDurationSeconds,10):typeof e.renewalRecoveryDurationSeconds=="number"?n.renewalRecoveryDurationSeconds=e.renewalRecoveryDurationSeconds:typeof e.renewalRecoveryDurationSeconds=="object"&&(n.renewalRecoveryDurationSeconds=new a.LongBits(e.renewalRecoveryDurationSeconds.low>>>0,e.renewalRecoveryDurationSeconds.high>>>0).toNumber())),e.renewalServerUrl!=null&&(n.renewalServerUrl=String(e.renewalServerUrl)),e.renewalDelaySeconds!=null&&(a.Long?(n.renewalDelaySeconds=a.Long.fromValue(e.renewalDelaySeconds)).unsigned=!1:typeof e.renewalDelaySeconds=="string"?n.renewalDelaySeconds=parseInt(e.renewalDelaySeconds,10):typeof e.renewalDelaySeconds=="number"?n.renewalDelaySeconds=e.renewalDelaySeconds:typeof e.renewalDelaySeconds=="object"&&(n.renewalDelaySeconds=new a.LongBits(e.renewalDelaySeconds.low>>>0,e.renewalDelaySeconds.high>>>0).toNumber())),e.renewalRetryIntervalSeconds!=null&&(a.Long?(n.renewalRetryIntervalSeconds=a.Long.fromValue(e.renewalRetryIntervalSeconds)).unsigned=!1:typeof e.renewalRetryIntervalSeconds=="string"?n.renewalRetryIntervalSeconds=parseInt(e.renewalRetryIntervalSeconds,10):typeof e.renewalRetryIntervalSeconds=="number"?n.renewalRetryIntervalSeconds=e.renewalRetryIntervalSeconds:typeof e.renewalRetryIntervalSeconds=="object"&&(n.renewalRetryIntervalSeconds=new a.LongBits(e.renewalRetryIntervalSeconds.low>>>0,e.renewalRetryIntervalSeconds.high>>>0).toNumber())),e.renewWithUsage!=null&&(n.renewWithUsage=!!e.renewWithUsage),e.alwaysIncludeClientId!=null&&(n.alwaysIncludeClientId=!!e.alwaysIncludeClientId),e.playStartGracePeriodSeconds!=null&&(a.Long?(n.playStartGracePeriodSeconds=a.Long.fromValue(e.playStartGracePeriodSeconds)).unsigned=!1:typeof e.playStartGracePeriodSeconds=="string"?n.playStartGracePeriodSeconds=parseInt(e.playStartGracePeriodSeconds,10):typeof e.playStartGracePeriodSeconds=="number"?n.playStartGracePeriodSeconds=e.playStartGracePeriodSeconds:typeof e.playStartGracePeriodSeconds=="object"&&(n.playStartGracePeriodSeconds=new a.LongBits(e.playStartGracePeriodSeconds.low>>>0,e.playStartGracePeriodSeconds.high>>>0).toNumber())),e.softEnforcePlaybackDuration!=null&&(n.softEnforcePlaybackDuration=!!e.softEnforcePlaybackDuration),e.softEnforceRentalDuration!=null&&(n.softEnforceRentalDuration=!!e.softEnforceRentalDuration),n},r.toObject=function(e,n){n||(n={});var i={};if(n.defaults){if(i.canPlay=!1,i.canPersist=!1,i.canRenew=!1,a.Long){var s=new a.Long(0,0,!1);i.rentalDurationSeconds=n.longs===String?s.toString():n.longs===Number?s.toNumber():s}else i.rentalDurationSeconds=n.longs===String?"0":0;if(a.Long){var s=new a.Long(0,0,!1);i.playbackDurationSeconds=n.longs===String?s.toString():n.longs===Number?s.toNumber():s}else i.playbackDurationSeconds=n.longs===String?"0":0;if(a.Long){var s=new a.Long(0,0,!1);i.licenseDurationSeconds=n.longs===String?s.toString():n.longs===Number?s.toNumber():s}else i.licenseDurationSeconds=n.longs===String?"0":0;if(a.Long){var s=new a.Long(0,0,!1);i.renewalRecoveryDurationSeconds=n.longs===String?s.toString():n.longs===Number?s.toNumber():s}else i.renewalRecoveryDurationSeconds=n.longs===String?"0":0;if(i.renewalServerUrl="",a.Long){var s=new a.Long(0,0,!1);i.renewalDelaySeconds=n.longs===String?s.toString():n.longs===Number?s.toNumber():s}else i.renewalDelaySeconds=n.longs===String?"0":0;if(a.Long){var s=new a.Long(0,0,!1);i.renewalRetryIntervalSeconds=n.longs===String?s.toString():n.longs===Number?s.toNumber():s}else i.renewalRetryIntervalSeconds=n.longs===String?"0":0;if(i.renewWithUsage=!1,i.alwaysIncludeClientId=!1,a.Long){var s=new a.Long(0,0,!1);i.playStartGracePeriodSeconds=n.longs===String?s.toString():n.longs===Number?s.toNumber():s}else i.playStartGracePeriodSeconds=n.longs===String?"0":0;i.softEnforcePlaybackDuration=!1,i.softEnforceRentalDuration=!0}return e.canPlay!=null&&e.hasOwnProperty("canPlay")&&(i.canPlay=e.canPlay),e.canPersist!=null&&e.hasOwnProperty("canPersist")&&(i.canPersist=e.canPersist),e.canRenew!=null&&e.hasOwnProperty("canRenew")&&(i.canRenew=e.canRenew),e.rentalDurationSeconds!=null&&e.hasOwnProperty("rentalDurationSeconds")&&(typeof e.rentalDurationSeconds=="number"?i.rentalDurationSeconds=n.longs===String?String(e.rentalDurationSeconds):e.rentalDurationSeconds:i.rentalDurationSeconds=n.longs===String?a.Long.prototype.toString.call(e.rentalDurationSeconds):n.longs===Number?new a.LongBits(e.rentalDurationSeconds.low>>>0,e.rentalDurationSeconds.high>>>0).toNumber():e.rentalDurationSeconds),e.playbackDurationSeconds!=null&&e.hasOwnProperty("playbackDurationSeconds")&&(typeof e.playbackDurationSeconds=="number"?i.playbackDurationSeconds=n.longs===String?String(e.playbackDurationSeconds):e.playbackDurationSeconds:i.playbackDurationSeconds=n.longs===String?a.Long.prototype.toString.call(e.playbackDurationSeconds):n.longs===Number?new a.LongBits(e.playbackDurationSeconds.low>>>0,e.playbackDurationSeconds.high>>>0).toNumber():e.playbackDurationSeconds),e.licenseDurationSeconds!=null&&e.hasOwnProperty("licenseDurationSeconds")&&(typeof e.licenseDurationSeconds=="number"?i.licenseDurationSeconds=n.longs===String?String(e.licenseDurationSeconds):e.licenseDurationSeconds:i.licenseDurationSeconds=n.longs===String?a.Long.prototype.toString.call(e.licenseDurationSeconds):n.longs===Number?new a.LongBits(e.licenseDurationSeconds.low>>>0,e.licenseDurationSeconds.high>>>0).toNumber():e.licenseDurationSeconds),e.renewalRecoveryDurationSeconds!=null&&e.hasOwnProperty("renewalRecoveryDurationSeconds")&&(typeof e.renewalRecoveryDurationSeconds=="number"?i.renewalRecoveryDurationSeconds=n.longs===String?String(e.renewalRecoveryDurationSeconds):e.renewalRecoveryDurationSeconds:i.renewalRecoveryDurationSeconds=n.longs===String?a.Long.prototype.toString.call(e.renewalRecoveryDurationSeconds):n.longs===Number?new a.LongBits(e.renewalRecoveryDurationSeconds.low>>>0,e.renewalRecoveryDurationSeconds.high>>>0).toNumber():e.renewalRecoveryDurationSeconds),e.renewalServerUrl!=null&&e.hasOwnProperty("renewalServerUrl")&&(i.renewalServerUrl=e.renewalServerUrl),e.renewalDelaySeconds!=null&&e.hasOwnProperty("renewalDelaySeconds")&&(typeof e.renewalDelaySeconds=="number"?i.renewalDelaySeconds=n.longs===String?String(e.renewalDelaySeconds):e.renewalDelaySeconds:i.renewalDelaySeconds=n.longs===String?a.Long.prototype.toString.call(e.renewalDelaySeconds):n.longs===Number?new a.LongBits(e.renewalDelaySeconds.low>>>0,e.renewalDelaySeconds.high>>>0).toNumber():e.renewalDelaySeconds),e.renewalRetryIntervalSeconds!=null&&e.hasOwnProperty("renewalRetryIntervalSeconds")&&(typeof e.renewalRetryIntervalSeconds=="number"?i.renewalRetryIntervalSeconds=n.longs===String?String(e.renewalRetryIntervalSeconds):e.renewalRetryIntervalSeconds:i.renewalRetryIntervalSeconds=n.longs===String?a.Long.prototype.toString.call(e.renewalRetryIntervalSeconds):n.longs===Number?new a.LongBits(e.renewalRetryIntervalSeconds.low>>>0,e.renewalRetryIntervalSeconds.high>>>0).toNumber():e.renewalRetryIntervalSeconds),e.renewWithUsage!=null&&e.hasOwnProperty("renewWithUsage")&&(i.renewWithUsage=e.renewWithUsage),e.alwaysIncludeClientId!=null&&e.hasOwnProperty("alwaysIncludeClientId")&&(i.alwaysIncludeClientId=e.alwaysIncludeClientId),e.playStartGracePeriodSeconds!=null&&e.hasOwnProperty("playStartGracePeriodSeconds")&&(typeof e.playStartGracePeriodSeconds=="number"?i.playStartGracePeriodSeconds=n.longs===String?String(e.playStartGracePeriodSeconds):e.playStartGracePeriodSeconds:i.playStartGracePeriodSeconds=n.longs===String?a.Long.prototype.toString.call(e.playStartGracePeriodSeconds):n.longs===Number?new a.LongBits(e.playStartGracePeriodSeconds.low>>>0,e.playStartGracePeriodSeconds.high>>>0).toNumber():e.playStartGracePeriodSeconds),e.softEnforcePlaybackDuration!=null&&e.hasOwnProperty("softEnforcePlaybackDuration")&&(i.softEnforcePlaybackDuration=e.softEnforcePlaybackDuration),e.softEnforceRentalDuration!=null&&e.hasOwnProperty("softEnforceRentalDuration")&&(i.softEnforceRentalDuration=e.softEnforceRentalDuration),i},r.prototype.toJSON=function(){return this.constructor.toObject(this,f.util.toJSONOptions)},r.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/License.Policy"},r}(),o.KeyContainer=function(){function r(t){if(this.videoResolutionConstraints=[],t)for(var e=Object.keys(t),n=0;n<e.length;++n)t[e[n]]!=null&&(this[e[n]]=t[e[n]])}return r.prototype.id=a.newBuffer([]),r.prototype.iv=a.newBuffer([]),r.prototype.key=a.newBuffer([]),r.prototype.type=1,r.prototype.level=1,r.prototype.requiredProtection=null,r.prototype.requestedProtection=null,r.prototype.keyControl=null,r.prototype.operatorSessionKeyPermissions=null,r.prototype.videoResolutionConstraints=a.emptyArray,r.prototype.antiRollbackUsageTable=!1,r.prototype.trackLabel="",r.create=function(e){return new r(e)},r.encode=function(e,n){if(n||(n=d.create()),e.id!=null&&Object.hasOwnProperty.call(e,"id")&&n.uint32(10).bytes(e.id),e.iv!=null&&Object.hasOwnProperty.call(e,"iv")&&n.uint32(18).bytes(e.iv),e.key!=null&&Object.hasOwnProperty.call(e,"key")&&n.uint32(26).bytes(e.key),e.type!=null&&Object.hasOwnProperty.call(e,"type")&&n.uint32(32).int32(e.type),e.level!=null&&Object.hasOwnProperty.call(e,"level")&&n.uint32(40).int32(e.level),e.requiredProtection!=null&&Object.hasOwnProperty.call(e,"requiredProtection")&&c.License.KeyContainer.OutputProtection.encode(e.requiredProtection,n.uint32(50).fork()).ldelim(),e.requestedProtection!=null&&Object.hasOwnProperty.call(e,"requestedProtection")&&c.License.KeyContainer.OutputProtection.encode(e.requestedProtection,n.uint32(58).fork()).ldelim(),e.keyControl!=null&&Object.hasOwnProperty.call(e,"keyControl")&&c.License.KeyContainer.KeyControl.encode(e.keyControl,n.uint32(66).fork()).ldelim(),e.operatorSessionKeyPermissions!=null&&Object.hasOwnProperty.call(e,"operatorSessionKeyPermissions")&&c.License.KeyContainer.OperatorSessionKeyPermissions.encode(e.operatorSessionKeyPermissions,n.uint32(74).fork()).ldelim(),e.videoResolutionConstraints!=null&&e.videoResolutionConstraints.length)for(var i=0;i<e.videoResolutionConstraints.length;++i)c.License.KeyContainer.VideoResolutionConstraint.encode(e.videoResolutionConstraints[i],n.uint32(82).fork()).ldelim();return e.antiRollbackUsageTable!=null&&Object.hasOwnProperty.call(e,"antiRollbackUsageTable")&&n.uint32(88).bool(e.antiRollbackUsageTable),e.trackLabel!=null&&Object.hasOwnProperty.call(e,"trackLabel")&&n.uint32(98).string(e.trackLabel),n},r.encodeDelimited=function(e,n){return this.encode(e,n).ldelim()},r.decode=function(e,n){e instanceof u||(e=u.create(e));for(var i=n===void 0?e.len:e.pos+n,s=new c.License.KeyContainer;e.pos<i;){var l=e.uint32();switch(l>>>3){case 1:{s.id=e.bytes();break}case 2:{s.iv=e.bytes();break}case 3:{s.key=e.bytes();break}case 4:{s.type=e.int32();break}case 5:{s.level=e.int32();break}case 6:{s.requiredProtection=c.License.KeyContainer.OutputProtection.decode(e,e.uint32());break}case 7:{s.requestedProtection=c.License.KeyContainer.OutputProtection.decode(e,e.uint32());break}case 8:{s.keyControl=c.License.KeyContainer.KeyControl.decode(e,e.uint32());break}case 9:{s.operatorSessionKeyPermissions=c.License.KeyContainer.OperatorSessionKeyPermissions.decode(e,e.uint32());break}case 10:{s.videoResolutionConstraints&&s.videoResolutionConstraints.length||(s.videoResolutionConstraints=[]),s.videoResolutionConstraints.push(c.License.KeyContainer.VideoResolutionConstraint.decode(e,e.uint32()));break}case 11:{s.antiRollbackUsageTable=e.bool();break}case 12:{s.trackLabel=e.string();break}default:e.skipType(l&7);break}}return s},r.decodeDelimited=function(e){return e instanceof u||(e=new u(e)),this.decode(e,e.uint32())},r.fromObject=function(e){if(e instanceof c.License.KeyContainer)return e;var n=new c.License.KeyContainer;switch(e.id!=null&&(typeof e.id=="string"?a.base64.decode(e.id,n.id=a.newBuffer(a.base64.length(e.id)),0):e.id.length>=0&&(n.id=e.id)),e.iv!=null&&(typeof e.iv=="string"?a.base64.decode(e.iv,n.iv=a.newBuffer(a.base64.length(e.iv)),0):e.iv.length>=0&&(n.iv=e.iv)),e.key!=null&&(typeof e.key=="string"?a.base64.decode(e.key,n.key=a.newBuffer(a.base64.length(e.key)),0):e.key.length>=0&&(n.key=e.key)),e.type){default:if(typeof e.type=="number"){n.type=e.type;break}break;case"SIGNING":case 1:n.type=1;break;case"CONTENT":case 2:n.type=2;break;case"KEY_CONTROL":case 3:n.type=3;break;case"OPERATOR_SESSION":case 4:n.type=4;break;case"ENTITLEMENT":case 5:n.type=5;break;case"OEM_CONTENT":case 6:n.type=6;break}switch(e.level){default:if(typeof e.level=="number"){n.level=e.level;break}break;case"SW_SECURE_CRYPTO":case 1:n.level=1;break;case"SW_SECURE_DECODE":case 2:n.level=2;break;case"HW_SECURE_CRYPTO":case 3:n.level=3;break;case"HW_SECURE_DECODE":case 4:n.level=4;break;case"HW_SECURE_ALL":case 5:n.level=5;break}if(e.requiredProtection!=null){if(typeof e.requiredProtection!="object")throw TypeError(".License.KeyContainer.requiredProtection: object expected");n.requiredProtection=c.License.KeyContainer.OutputProtection.fromObject(e.requiredProtection)}if(e.requestedProtection!=null){if(typeof e.requestedProtection!="object")throw TypeError(".License.KeyContainer.requestedProtection: object expected");n.requestedProtection=c.License.KeyContainer.OutputProtection.fromObject(e.requestedProtection)}if(e.keyControl!=null){if(typeof e.keyControl!="object")throw TypeError(".License.KeyContainer.keyControl: object expected");n.keyControl=c.License.KeyContainer.KeyControl.fromObject(e.keyControl)}if(e.operatorSessionKeyPermissions!=null){if(typeof e.operatorSessionKeyPermissions!="object")throw TypeError(".License.KeyContainer.operatorSessionKeyPermissions: object expected");n.operatorSessionKeyPermissions=c.License.KeyContainer.OperatorSessionKeyPermissions.fromObject(e.operatorSessionKeyPermissions)}if(e.videoResolutionConstraints){if(!Array.isArray(e.videoResolutionConstraints))throw TypeError(".License.KeyContainer.videoResolutionConstraints: array expected");n.videoResolutionConstraints=[];for(var i=0;i<e.videoResolutionConstraints.length;++i){if(typeof e.videoResolutionConstraints[i]!="object")throw TypeError(".License.KeyContainer.videoResolutionConstraints: object expected");n.videoResolutionConstraints[i]=c.License.KeyContainer.VideoResolutionConstraint.fromObject(e.videoResolutionConstraints[i])}}return e.antiRollbackUsageTable!=null&&(n.antiRollbackUsageTable=!!e.antiRollbackUsageTable),e.trackLabel!=null&&(n.trackLabel=String(e.trackLabel)),n},r.toObject=function(e,n){n||(n={});var i={};if((n.arrays||n.defaults)&&(i.videoResolutionConstraints=[]),n.defaults&&(n.bytes===String?i.id="":(i.id=[],n.bytes!==Array&&(i.id=a.newBuffer(i.id))),n.bytes===String?i.iv="":(i.iv=[],n.bytes!==Array&&(i.iv=a.newBuffer(i.iv))),n.bytes===String?i.key="":(i.key=[],n.bytes!==Array&&(i.key=a.newBuffer(i.key))),i.type=n.enums===String?"SIGNING":1,i.level=n.enums===String?"SW_SECURE_CRYPTO":1,i.requiredProtection=null,i.requestedProtection=null,i.keyControl=null,i.operatorSessionKeyPermissions=null,i.antiRollbackUsageTable=!1,i.trackLabel=""),e.id!=null&&e.hasOwnProperty("id")&&(i.id=n.bytes===String?a.base64.encode(e.id,0,e.id.length):n.bytes===Array?Array.prototype.slice.call(e.id):e.id),e.iv!=null&&e.hasOwnProperty("iv")&&(i.iv=n.bytes===String?a.base64.encode(e.iv,0,e.iv.length):n.bytes===Array?Array.prototype.slice.call(e.iv):e.iv),e.key!=null&&e.hasOwnProperty("key")&&(i.key=n.bytes===String?a.base64.encode(e.key,0,e.key.length):n.bytes===Array?Array.prototype.slice.call(e.key):e.key),e.type!=null&&e.hasOwnProperty("type")&&(i.type=n.enums===String?c.License.KeyContainer.KeyType[e.type]===void 0?e.type:c.License.KeyContainer.KeyType[e.type]:e.type),e.level!=null&&e.hasOwnProperty("level")&&(i.level=n.enums===String?c.License.KeyContainer.SecurityLevel[e.level]===void 0?e.level:c.License.KeyContainer.SecurityLevel[e.level]:e.level),e.requiredProtection!=null&&e.hasOwnProperty("requiredProtection")&&(i.requiredProtection=c.License.KeyContainer.OutputProtection.toObject(e.requiredProtection,n)),e.requestedProtection!=null&&e.hasOwnProperty("requestedProtection")&&(i.requestedProtection=c.License.KeyContainer.OutputProtection.toObject(e.requestedProtection,n)),e.keyControl!=null&&e.hasOwnProperty("keyControl")&&(i.keyControl=c.License.KeyContainer.KeyControl.toObject(e.keyControl,n)),e.operatorSessionKeyPermissions!=null&&e.hasOwnProperty("operatorSessionKeyPermissions")&&(i.operatorSessionKeyPermissions=c.License.KeyContainer.OperatorSessionKeyPermissions.toObject(e.operatorSessionKeyPermissions,n)),e.videoResolutionConstraints&&e.videoResolutionConstraints.length){i.videoResolutionConstraints=[];for(var s=0;s<e.videoResolutionConstraints.length;++s)i.videoResolutionConstraints[s]=c.License.KeyContainer.VideoResolutionConstraint.toObject(e.videoResolutionConstraints[s],n)}return e.antiRollbackUsageTable!=null&&e.hasOwnProperty("antiRollbackUsageTable")&&(i.antiRollbackUsageTable=e.antiRollbackUsageTable),e.trackLabel!=null&&e.hasOwnProperty("trackLabel")&&(i.trackLabel=e.trackLabel),i},r.prototype.toJSON=function(){return this.constructor.toObject(this,f.util.toJSONOptions)},r.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/License.KeyContainer"},r.KeyType=function(){let t={},e=Object.create(t);return e[t[1]="SIGNING"]=1,e[t[2]="CONTENT"]=2,e[t[3]="KEY_CONTROL"]=3,e[t[4]="OPERATOR_SESSION"]=4,e[t[5]="ENTITLEMENT"]=5,e[t[6]="OEM_CONTENT"]=6,e}(),r.SecurityLevel=function(){let t={},e=Object.create(t);return e[t[1]="SW_SECURE_CRYPTO"]=1,e[t[2]="SW_SECURE_DECODE"]=2,e[t[3]="HW_SECURE_CRYPTO"]=3,e[t[4]="HW_SECURE_DECODE"]=4,e[t[5]="HW_SECURE_ALL"]=5,e}(),r.KeyControl=function(){function t(e){if(e)for(var n=Object.keys(e),i=0;i<n.length;++i)e[n[i]]!=null&&(this[n[i]]=e[n[i]])}return t.prototype.keyControlBlock=a.newBuffer([]),t.prototype.iv=a.newBuffer([]),t.create=function(n){return new t(n)},t.encode=function(n,i){return i||(i=d.create()),n.keyControlBlock!=null&&Object.hasOwnProperty.call(n,"keyControlBlock")&&i.uint32(10).bytes(n.keyControlBlock),n.iv!=null&&Object.hasOwnProperty.call(n,"iv")&&i.uint32(18).bytes(n.iv),i},t.encodeDelimited=function(n,i){return this.encode(n,i).ldelim()},t.decode=function(n,i){n instanceof u||(n=u.create(n));for(var s=i===void 0?n.len:n.pos+i,l=new c.License.KeyContainer.KeyControl;n.pos<s;){var y=n.uint32();switch(y>>>3){case 1:{l.keyControlBlock=n.bytes();break}case 2:{l.iv=n.bytes();break}default:n.skipType(y&7);break}}return l},t.decodeDelimited=function(n){return n instanceof u||(n=new u(n)),this.decode(n,n.uint32())},t.fromObject=function(n){if(n instanceof c.License.KeyContainer.KeyControl)return n;var i=new c.License.KeyContainer.KeyControl;return n.keyControlBlock!=null&&(typeof n.keyControlBlock=="string"?a.base64.decode(n.keyControlBlock,i.keyControlBlock=a.newBuffer(a.base64.length(n.keyControlBlock)),0):n.keyControlBlock.length>=0&&(i.keyControlBlock=n.keyControlBlock)),n.iv!=null&&(typeof n.iv=="string"?a.base64.decode(n.iv,i.iv=a.newBuffer(a.base64.length(n.iv)),0):n.iv.length>=0&&(i.iv=n.iv)),i},t.toObject=function(n,i){i||(i={});var s={};return i.defaults&&(i.bytes===String?s.keyControlBlock="":(s.keyControlBlock=[],i.bytes!==Array&&(s.keyControlBlock=a.newBuffer(s.keyControlBlock))),i.bytes===String?s.iv="":(s.iv=[],i.bytes!==Array&&(s.iv=a.newBuffer(s.iv)))),n.keyControlBlock!=null&&n.hasOwnProperty("keyControlBlock")&&(s.keyControlBlock=i.bytes===String?a.base64.encode(n.keyControlBlock,0,n.keyControlBlock.length):i.bytes===Array?Array.prototype.slice.call(n.keyControlBlock):n.keyControlBlock),n.iv!=null&&n.hasOwnProperty("iv")&&(s.iv=i.bytes===String?a.base64.encode(n.iv,0,n.iv.length):i.bytes===Array?Array.prototype.slice.call(n.iv):n.iv),s},t.prototype.toJSON=function(){return this.constructor.toObject(this,f.util.toJSONOptions)},t.getTypeUrl=function(n){return n===void 0&&(n="type.googleapis.com"),n+"/License.KeyContainer.KeyControl"},t}(),r.OutputProtection=function(){function t(e){if(e)for(var n=Object.keys(e),i=0;i<n.length;++i)e[n[i]]!=null&&(this[n[i]]=e[n[i]])}return t.prototype.hdcp=0,t.prototype.cgmsFlags=42,t.prototype.hdcpSrmRule=0,t.prototype.disableAnalogOutput=!1,t.prototype.disableDigitalOutput=!1,t.create=function(n){return new t(n)},t.encode=function(n,i){return i||(i=d.create()),n.hdcp!=null&&Object.hasOwnProperty.call(n,"hdcp")&&i.uint32(8).int32(n.hdcp),n.cgmsFlags!=null&&Object.hasOwnProperty.call(n,"cgmsFlags")&&i.uint32(16).int32(n.cgmsFlags),n.hdcpSrmRule!=null&&Object.hasOwnProperty.call(n,"hdcpSrmRule")&&i.uint32(24).int32(n.hdcpSrmRule),n.disableAnalogOutput!=null&&Object.hasOwnProperty.call(n,"disableAnalogOutput")&&i.uint32(32).bool(n.disableAnalogOutput),n.disableDigitalOutput!=null&&Object.hasOwnProperty.call(n,"disableDigitalOutput")&&i.uint32(40).bool(n.disableDigitalOutput),i},t.encodeDelimited=function(n,i){return this.encode(n,i).ldelim()},t.decode=function(n,i){n instanceof u||(n=u.create(n));for(var s=i===void 0?n.len:n.pos+i,l=new c.License.KeyContainer.OutputProtection;n.pos<s;){var y=n.uint32();switch(y>>>3){case 1:{l.hdcp=n.int32();break}case 2:{l.cgmsFlags=n.int32();break}case 3:{l.hdcpSrmRule=n.int32();break}case 4:{l.disableAnalogOutput=n.bool();break}case 5:{l.disableDigitalOutput=n.bool();break}default:n.skipType(y&7);break}}return l},t.decodeDelimited=function(n){return n instanceof u||(n=new u(n)),this.decode(n,n.uint32())},t.fromObject=function(n){if(n instanceof c.License.KeyContainer.OutputProtection)return n;var i=new c.License.KeyContainer.OutputProtection;switch(n.hdcp){default:if(typeof n.hdcp=="number"){i.hdcp=n.hdcp;break}break;case"HDCP_NONE":case 0:i.hdcp=0;break;case"HDCP_V1":case 1:i.hdcp=1;break;case"HDCP_V2":case 2:i.hdcp=2;break;case"HDCP_V2_1":case 3:i.hdcp=3;break;case"HDCP_V2_2":case 4:i.hdcp=4;break;case"HDCP_V2_3":case 5:i.hdcp=5;break;case"HDCP_NO_DIGITAL_OUTPUT":case 255:i.hdcp=255;break}switch(n.cgmsFlags){default:if(typeof n.cgmsFlags=="number"){i.cgmsFlags=n.cgmsFlags;break}break;case"CGMS_NONE":case 42:i.cgmsFlags=42;break;case"COPY_FREE":case 0:i.cgmsFlags=0;break;case"COPY_ONCE":case 2:i.cgmsFlags=2;break;case"COPY_NEVER":case 3:i.cgmsFlags=3;break}switch(n.hdcpSrmRule){default:if(typeof n.hdcpSrmRule=="number"){i.hdcpSrmRule=n.hdcpSrmRule;break}break;case"HDCP_SRM_RULE_NONE":case 0:i.hdcpSrmRule=0;break;case"CURRENT_SRM":case 1:i.hdcpSrmRule=1;break}return n.disableAnalogOutput!=null&&(i.disableAnalogOutput=!!n.disableAnalogOutput),n.disableDigitalOutput!=null&&(i.disableDigitalOutput=!!n.disableDigitalOutput),i},t.toObject=function(n,i){i||(i={});var s={};return i.defaults&&(s.hdcp=i.enums===String?"HDCP_NONE":0,s.cgmsFlags=i.enums===String?"CGMS_NONE":42,s.hdcpSrmRule=i.enums===String?"HDCP_SRM_RULE_NONE":0,s.disableAnalogOutput=!1,s.disableDigitalOutput=!1),n.hdcp!=null&&n.hasOwnProperty("hdcp")&&(s.hdcp=i.enums===String?c.License.KeyContainer.OutputProtection.HDCP[n.hdcp]===void 0?n.hdcp:c.License.KeyContainer.OutputProtection.HDCP[n.hdcp]:n.hdcp),n.cgmsFlags!=null&&n.hasOwnProperty("cgmsFlags")&&(s.cgmsFlags=i.enums===String?c.License.KeyContainer.OutputProtection.CGMS[n.cgmsFlags]===void 0?n.cgmsFlags:c.License.KeyContainer.OutputProtection.CGMS[n.cgmsFlags]:n.cgmsFlags),n.hdcpSrmRule!=null&&n.hasOwnProperty("hdcpSrmRule")&&(s.hdcpSrmRule=i.enums===String?c.License.KeyContainer.OutputProtection.HdcpSrmRule[n.hdcpSrmRule]===void 0?n.hdcpSrmRule:c.License.KeyContainer.OutputProtection.HdcpSrmRule[n.hdcpSrmRule]:n.hdcpSrmRule),n.disableAnalogOutput!=null&&n.hasOwnProperty("disableAnalogOutput")&&(s.disableAnalogOutput=n.disableAnalogOutput),n.disableDigitalOutput!=null&&n.hasOwnProperty("disableDigitalOutput")&&(s.disableDigitalOutput=n.disableDigitalOutput),s},t.prototype.toJSON=function(){return this.constructor.toObject(this,f.util.toJSONOptions)},t.getTypeUrl=function(n){return n===void 0&&(n="type.googleapis.com"),n+"/License.KeyContainer.OutputProtection"},t.HDCP=function(){let e={},n=Object.create(e);return n[e[0]="HDCP_NONE"]=0,n[e[1]="HDCP_V1"]=1,n[e[2]="HDCP_V2"]=2,n[e[3]="HDCP_V2_1"]=3,n[e[4]="HDCP_V2_2"]=4,n[e[5]="HDCP_V2_3"]=5,n[e[255]="HDCP_NO_DIGITAL_OUTPUT"]=255,n}(),t.CGMS=function(){let e={},n=Object.create(e);return n[e[42]="CGMS_NONE"]=42,n[e[0]="COPY_FREE"]=0,n[e[2]="COPY_ONCE"]=2,n[e[3]="COPY_NEVER"]=3,n}(),t.HdcpSrmRule=function(){let e={},n=Object.create(e);return n[e[0]="HDCP_SRM_RULE_NONE"]=0,n[e[1]="CURRENT_SRM"]=1,n}(),t}(),r.VideoResolutionConstraint=function(){function t(e){if(e)for(var n=Object.keys(e),i=0;i<n.length;++i)e[n[i]]!=null&&(this[n[i]]=e[n[i]])}return t.prototype.minResolutionPixels=0,t.prototype.maxResolutionPixels=0,t.prototype.requiredProtection=null,t.create=function(n){return new t(n)},t.encode=function(n,i){return i||(i=d.create()),n.minResolutionPixels!=null&&Object.hasOwnProperty.call(n,"minResolutionPixels")&&i.uint32(8).uint32(n.minResolutionPixels),n.maxResolutionPixels!=null&&Object.hasOwnProperty.call(n,"maxResolutionPixels")&&i.uint32(16).uint32(n.maxResolutionPixels),n.requiredProtection!=null&&Object.hasOwnProperty.call(n,"requiredProtection")&&c.License.KeyContainer.OutputProtection.encode(n.requiredProtection,i.uint32(26).fork()).ldelim(),i},t.encodeDelimited=function(n,i){return this.encode(n,i).ldelim()},t.decode=function(n,i){n instanceof u||(n=u.create(n));for(var s=i===void 0?n.len:n.pos+i,l=new c.License.KeyContainer.VideoResolutionConstraint;n.pos<s;){var y=n.uint32();switch(y>>>3){case 1:{l.minResolutionPixels=n.uint32();break}case 2:{l.maxResolutionPixels=n.uint32();break}case 3:{l.requiredProtection=c.License.KeyContainer.OutputProtection.decode(n,n.uint32());break}default:n.skipType(y&7);break}}return l},t.decodeDelimited=function(n){return n instanceof u||(n=new u(n)),this.decode(n,n.uint32())},t.fromObject=function(n){if(n instanceof c.License.KeyContainer.VideoResolutionConstraint)return n;var i=new c.License.KeyContainer.VideoResolutionConstraint;if(n.minResolutionPixels!=null&&(i.minResolutionPixels=n.minResolutionPixels>>>0),n.maxResolutionPixels!=null&&(i.maxResolutionPixels=n.maxResolutionPixels>>>0),n.requiredProtection!=null){if(typeof n.requiredProtection!="object")throw TypeError(".License.KeyContainer.VideoResolutionConstraint.requiredProtection: object expected");i.requiredProtection=c.License.KeyContainer.OutputProtection.fromObject(n.requiredProtection)}return i},t.toObject=function(n,i){i||(i={});var s={};return i.defaults&&(s.minResolutionPixels=0,s.maxResolutionPixels=0,s.requiredProtection=null),n.minResolutionPixels!=null&&n.hasOwnProperty("minResolutionPixels")&&(s.minResolutionPixels=n.minResolutionPixels),n.maxResolutionPixels!=null&&n.hasOwnProperty("maxResolutionPixels")&&(s.maxResolutionPixels=n.maxResolutionPixels),n.requiredProtection!=null&&n.hasOwnProperty("requiredProtection")&&(s.requiredProtection=c.License.KeyContainer.OutputProtection.toObject(n.requiredProtection,i)),s},t.prototype.toJSON=function(){return this.constructor.toObject(this,f.util.toJSONOptions)},t.getTypeUrl=function(n){return n===void 0&&(n="type.googleapis.com"),n+"/License.KeyContainer.VideoResolutionConstraint"},t}(),r.OperatorSessionKeyPermissions=function(){function t(e){if(e)for(var n=Object.keys(e),i=0;i<n.length;++i)e[n[i]]!=null&&(this[n[i]]=e[n[i]])}return t.prototype.allowEncrypt=!1,t.prototype.allowDecrypt=!1,t.prototype.allowSign=!1,t.prototype.allowSignatureVerify=!1,t.create=function(n){return new t(n)},t.encode=function(n,i){return i||(i=d.create()),n.allowEncrypt!=null&&Object.hasOwnProperty.call(n,"allowEncrypt")&&i.uint32(8).bool(n.allowEncrypt),n.allowDecrypt!=null&&Object.hasOwnProperty.call(n,"allowDecrypt")&&i.uint32(16).bool(n.allowDecrypt),n.allowSign!=null&&Object.hasOwnProperty.call(n,"allowSign")&&i.uint32(24).bool(n.allowSign),n.allowSignatureVerify!=null&&Object.hasOwnProperty.call(n,"allowSignatureVerify")&&i.uint32(32).bool(n.allowSignatureVerify),i},t.encodeDelimited=function(n,i){return this.encode(n,i).ldelim()},t.decode=function(n,i){n instanceof u||(n=u.create(n));for(var s=i===void 0?n.len:n.pos+i,l=new c.License.KeyContainer.OperatorSessionKeyPermissions;n.pos<s;){var y=n.uint32();switch(y>>>3){case 1:{l.allowEncrypt=n.bool();break}case 2:{l.allowDecrypt=n.bool();break}case 3:{l.allowSign=n.bool();break}case 4:{l.allowSignatureVerify=n.bool();break}default:n.skipType(y&7);break}}return l},t.decodeDelimited=function(n){return n instanceof u||(n=new u(n)),this.decode(n,n.uint32())},t.fromObject=function(n){if(n instanceof c.License.KeyContainer.OperatorSessionKeyPermissions)return n;var i=new c.License.KeyContainer.OperatorSessionKeyPermissions;return n.allowEncrypt!=null&&(i.allowEncrypt=!!n.allowEncrypt),n.allowDecrypt!=null&&(i.allowDecrypt=!!n.allowDecrypt),n.allowSign!=null&&(i.allowSign=!!n.allowSign),n.allowSignatureVerify!=null&&(i.allowSignatureVerify=!!n.allowSignatureVerify),i},t.toObject=function(n,i){i||(i={});var s={};return i.defaults&&(s.allowEncrypt=!1,s.allowDecrypt=!1,s.allowSign=!1,s.allowSignatureVerify=!1),n.allowEncrypt!=null&&n.hasOwnProperty("allowEncrypt")&&(s.allowEncrypt=n.allowEncrypt),n.allowDecrypt!=null&&n.hasOwnProperty("allowDecrypt")&&(s.allowDecrypt=n.allowDecrypt),n.allowSign!=null&&n.hasOwnProperty("allowSign")&&(s.allowSign=n.allowSign),n.allowSignatureVerify!=null&&n.hasOwnProperty("allowSignatureVerify")&&(s.allowSignatureVerify=n.allowSignatureVerify),s},t.prototype.toJSON=function(){return this.constructor.toObject(this,f.util.toJSONOptions)},t.getTypeUrl=function(n){return n===void 0&&(n="type.googleapis.com"),n+"/License.KeyContainer.OperatorSessionKeyPermissions"},t}(),r}(),o})(),le=c.ProtocolVersion=(()=>{let o={},r=Object.create(o);return r[o[20]="VERSION_2_0"]=20,r[o[21]="VERSION_2_1"]=21,r[o[22]="VERSION_2_2"]=22,r})(),_=c.LicenseRequest=(()=>{function o(r){if(r)for(var t=Object.keys(r),e=0;e<t.length;++e)r[t[e]]!=null&&(this[t[e]]=r[t[e]])}return o.prototype.clientId=null,o.prototype.contentId=null,o.prototype.type=1,o.prototype.requestTime=a.Long?a.Long.fromBits(0,0,!1):0,o.prototype.keyControlNonceDeprecated=a.newBuffer([]),o.prototype.protocolVersion=20,o.prototype.keyControlNonce=0,o.prototype.encryptedClientId=null,o.create=function(t){return new o(t)},o.encode=function(t,e){return e||(e=d.create()),t.clientId!=null&&Object.hasOwnProperty.call(t,"clientId")&&c.ClientIdentification.encode(t.clientId,e.uint32(10).fork()).ldelim(),t.contentId!=null&&Object.hasOwnProperty.call(t,"contentId")&&c.LicenseRequest.ContentIdentification.encode(t.contentId,e.uint32(18).fork()).ldelim(),t.type!=null&&Object.hasOwnProperty.call(t,"type")&&e.uint32(24).int32(t.type),t.requestTime!=null&&Object.hasOwnProperty.call(t,"requestTime")&&e.uint32(32).int64(t.requestTime),t.keyControlNonceDeprecated!=null&&Object.hasOwnProperty.call(t,"keyControlNonceDeprecated")&&e.uint32(42).bytes(t.keyControlNonceDeprecated),t.protocolVersion!=null&&Object.hasOwnProperty.call(t,"protocolVersion")&&e.uint32(48).int32(t.protocolVersion),t.keyControlNonce!=null&&Object.hasOwnProperty.call(t,"keyControlNonce")&&e.uint32(56).uint32(t.keyControlNonce),t.encryptedClientId!=null&&Object.hasOwnProperty.call(t,"encryptedClientId")&&c.EncryptedClientIdentification.encode(t.encryptedClientId,e.uint32(66).fork()).ldelim(),e},o.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},o.decode=function(t,e){t instanceof u||(t=u.create(t));for(var n=e===void 0?t.len:t.pos+e,i=new c.LicenseRequest;t.pos<n;){var s=t.uint32();switch(s>>>3){case 1:{i.clientId=c.ClientIdentification.decode(t,t.uint32());break}case 2:{i.contentId=c.LicenseRequest.ContentIdentification.decode(t,t.uint32());break}case 3:{i.type=t.int32();break}case 4:{i.requestTime=t.int64();break}case 5:{i.keyControlNonceDeprecated=t.bytes();break}case 6:{i.protocolVersion=t.int32();break}case 7:{i.keyControlNonce=t.uint32();break}case 8:{i.encryptedClientId=c.EncryptedClientIdentification.decode(t,t.uint32());break}default:t.skipType(s&7);break}}return i},o.decodeDelimited=function(t){return t instanceof u||(t=new u(t)),this.decode(t,t.uint32())},o.fromObject=function(t){if(t instanceof c.LicenseRequest)return t;var e=new c.LicenseRequest;if(t.clientId!=null){if(typeof t.clientId!="object")throw TypeError(".LicenseRequest.clientId: object expected");e.clientId=c.ClientIdentification.fromObject(t.clientId)}if(t.contentId!=null){if(typeof t.contentId!="object")throw TypeError(".LicenseRequest.contentId: object expected");e.contentId=c.LicenseRequest.ContentIdentification.fromObject(t.contentId)}switch(t.type){default:if(typeof t.type=="number"){e.type=t.type;break}break;case"NEW":case 1:e.type=1;break;case"RENEWAL":case 2:e.type=2;break;case"RELEASE":case 3:e.type=3;break}switch(t.requestTime!=null&&(a.Long?(e.requestTime=a.Long.fromValue(t.requestTime)).unsigned=!1:typeof t.requestTime=="string"?e.requestTime=parseInt(t.requestTime,10):typeof t.requestTime=="number"?e.requestTime=t.requestTime:typeof t.requestTime=="object"&&(e.requestTime=new a.LongBits(t.requestTime.low>>>0,t.requestTime.high>>>0).toNumber())),t.keyControlNonceDeprecated!=null&&(typeof t.keyControlNonceDeprecated=="string"?a.base64.decode(t.keyControlNonceDeprecated,e.keyControlNonceDeprecated=a.newBuffer(a.base64.length(t.keyControlNonceDeprecated)),0):t.keyControlNonceDeprecated.length>=0&&(e.keyControlNonceDeprecated=t.keyControlNonceDeprecated)),t.protocolVersion){default:if(typeof t.protocolVersion=="number"){e.protocolVersion=t.protocolVersion;break}break;case"VERSION_2_0":case 20:e.protocolVersion=20;break;case"VERSION_2_1":case 21:e.protocolVersion=21;break;case"VERSION_2_2":case 22:e.protocolVersion=22;break}if(t.keyControlNonce!=null&&(e.keyControlNonce=t.keyControlNonce>>>0),t.encryptedClientId!=null){if(typeof t.encryptedClientId!="object")throw TypeError(".LicenseRequest.encryptedClientId: object expected");e.encryptedClientId=c.EncryptedClientIdentification.fromObject(t.encryptedClientId)}return e},o.toObject=function(t,e){e||(e={});var n={};if(e.defaults){if(n.clientId=null,n.contentId=null,n.type=e.enums===String?"NEW":1,a.Long){var i=new a.Long(0,0,!1);n.requestTime=e.longs===String?i.toString():e.longs===Number?i.toNumber():i}else n.requestTime=e.longs===String?"0":0;e.bytes===String?n.keyControlNonceDeprecated="":(n.keyControlNonceDeprecated=[],e.bytes!==Array&&(n.keyControlNonceDeprecated=a.newBuffer(n.keyControlNonceDeprecated))),n.protocolVersion=e.enums===String?"VERSION_2_0":20,n.keyControlNonce=0,n.encryptedClientId=null}return t.clientId!=null&&t.hasOwnProperty("clientId")&&(n.clientId=c.ClientIdentification.toObject(t.clientId,e)),t.contentId!=null&&t.hasOwnProperty("contentId")&&(n.contentId=c.LicenseRequest.ContentIdentification.toObject(t.contentId,e)),t.type!=null&&t.hasOwnProperty("type")&&(n.type=e.enums===String?c.LicenseRequest.RequestType[t.type]===void 0?t.type:c.LicenseRequest.RequestType[t.type]:t.type),t.requestTime!=null&&t.hasOwnProperty("requestTime")&&(typeof t.requestTime=="number"?n.requestTime=e.longs===String?String(t.requestTime):t.requestTime:n.requestTime=e.longs===String?a.Long.prototype.toString.call(t.requestTime):e.longs===Number?new a.LongBits(t.requestTime.low>>>0,t.requestTime.high>>>0).toNumber():t.requestTime),t.keyControlNonceDeprecated!=null&&t.hasOwnProperty("keyControlNonceDeprecated")&&(n.keyControlNonceDeprecated=e.bytes===String?a.base64.encode(t.keyControlNonceDeprecated,0,t.keyControlNonceDeprecated.length):e.bytes===Array?Array.prototype.slice.call(t.keyControlNonceDeprecated):t.keyControlNonceDeprecated),t.protocolVersion!=null&&t.hasOwnProperty("protocolVersion")&&(n.protocolVersion=e.enums===String?c.ProtocolVersion[t.protocolVersion]===void 0?t.protocolVersion:c.ProtocolVersion[t.protocolVersion]:t.protocolVersion),t.keyControlNonce!=null&&t.hasOwnProperty("keyControlNonce")&&(n.keyControlNonce=t.keyControlNonce),t.encryptedClientId!=null&&t.hasOwnProperty("encryptedClientId")&&(n.encryptedClientId=c.EncryptedClientIdentification.toObject(t.encryptedClientId,e)),n},o.prototype.toJSON=function(){return this.constructor.toObject(this,f.util.toJSONOptions)},o.getTypeUrl=function(t){return t===void 0&&(t="type.googleapis.com"),t+"/LicenseRequest"},o.ContentIdentification=function(){function r(e){if(e)for(var n=Object.keys(e),i=0;i<n.length;++i)e[n[i]]!=null&&(this[n[i]]=e[n[i]])}r.prototype.widevinePsshData=null,r.prototype.webmKeyId=null,r.prototype.existingLicense=null,r.prototype.initData=null;let t;return Object.defineProperty(r.prototype,"contentIdVariant",{get:a.oneOfGetter(t=["widevinePsshData","webmKeyId","existingLicense","initData"]),set:a.oneOfSetter(t)}),r.create=function(n){return new r(n)},r.encode=function(n,i){return i||(i=d.create()),n.widevinePsshData!=null&&Object.hasOwnProperty.call(n,"widevinePsshData")&&c.LicenseRequest.ContentIdentification.WidevinePsshData.encode(n.widevinePsshData,i.uint32(10).fork()).ldelim(),n.webmKeyId!=null&&Object.hasOwnProperty.call(n,"webmKeyId")&&c.LicenseRequest.ContentIdentification.WebmKeyId.encode(n.webmKeyId,i.uint32(18).fork()).ldelim(),n.existingLicense!=null&&Object.hasOwnProperty.call(n,"existingLicense")&&c.LicenseRequest.ContentIdentification.ExistingLicense.encode(n.existingLicense,i.uint32(26).fork()).ldelim(),n.initData!=null&&Object.hasOwnProperty.call(n,"initData")&&c.LicenseRequest.ContentIdentification.InitData.encode(n.initData,i.uint32(34).fork()).ldelim(),i},r.encodeDelimited=function(n,i){return this.encode(n,i).ldelim()},r.decode=function(n,i){n instanceof u||(n=u.create(n));for(var s=i===void 0?n.len:n.pos+i,l=new c.LicenseRequest.ContentIdentification;n.pos<s;){var y=n.uint32();switch(y>>>3){case 1:{l.widevinePsshData=c.LicenseRequest.ContentIdentification.WidevinePsshData.decode(n,n.uint32());break}case 2:{l.webmKeyId=c.LicenseRequest.ContentIdentification.WebmKeyId.decode(n,n.uint32());break}case 3:{l.existingLicense=c.LicenseRequest.ContentIdentification.ExistingLicense.decode(n,n.uint32());break}case 4:{l.initData=c.LicenseRequest.ContentIdentification.InitData.decode(n,n.uint32());break}default:n.skipType(y&7);break}}return l},r.decodeDelimited=function(n){return n instanceof u||(n=new u(n)),this.decode(n,n.uint32())},r.fromObject=function(n){if(n instanceof c.LicenseRequest.ContentIdentification)return n;var i=new c.LicenseRequest.ContentIdentification;if(n.widevinePsshData!=null){if(typeof n.widevinePsshData!="object")throw TypeError(".LicenseRequest.ContentIdentification.widevinePsshData: object expected");i.widevinePsshData=c.LicenseRequest.ContentIdentification.WidevinePsshData.fromObject(n.widevinePsshData)}if(n.webmKeyId!=null){if(typeof n.webmKeyId!="object")throw TypeError(".LicenseRequest.ContentIdentification.webmKeyId: object expected");i.webmKeyId=c.LicenseRequest.ContentIdentification.WebmKeyId.fromObject(n.webmKeyId)}if(n.existingLicense!=null){if(typeof n.existingLicense!="object")throw TypeError(".LicenseRequest.ContentIdentification.existingLicense: object expected");i.existingLicense=c.LicenseRequest.ContentIdentification.ExistingLicense.fromObject(n.existingLicense)}if(n.initData!=null){if(typeof n.initData!="object")throw TypeError(".LicenseRequest.ContentIdentification.initData: object expected");i.initData=c.LicenseRequest.ContentIdentification.InitData.fromObject(n.initData)}return i},r.toObject=function(n,i){i||(i={});var s={};return n.widevinePsshData!=null&&n.hasOwnProperty("widevinePsshData")&&(s.widevinePsshData=c.LicenseRequest.ContentIdentification.WidevinePsshData.toObject(n.widevinePsshData,i),i.oneofs&&(s.contentIdVariant="widevinePsshData")),n.webmKeyId!=null&&n.hasOwnProperty("webmKeyId")&&(s.webmKeyId=c.LicenseRequest.ContentIdentification.WebmKeyId.toObject(n.webmKeyId,i),i.oneofs&&(s.contentIdVariant="webmKeyId")),n.existingLicense!=null&&n.hasOwnProperty("existingLicense")&&(s.existingLicense=c.LicenseRequest.ContentIdentification.ExistingLicense.toObject(n.existingLicense,i),i.oneofs&&(s.contentIdVariant="existingLicense")),n.initData!=null&&n.hasOwnProperty("initData")&&(s.initData=c.LicenseRequest.ContentIdentification.InitData.toObject(n.initData,i),i.oneofs&&(s.contentIdVariant="initData")),s},r.prototype.toJSON=function(){return this.constructor.toObject(this,f.util.toJSONOptions)},r.getTypeUrl=function(n){return n===void 0&&(n="type.googleapis.com"),n+"/LicenseRequest.ContentIdentification"},r.WidevinePsshData=function(){function e(n){if(this.psshData=[],n)for(var i=Object.keys(n),s=0;s<i.length;++s)n[i[s]]!=null&&(this[i[s]]=n[i[s]])}return e.prototype.psshData=a.emptyArray,e.prototype.licenseType=1,e.prototype.requestId=a.newBuffer([]),e.create=function(i){return new e(i)},e.encode=function(i,s){if(s||(s=d.create()),i.psshData!=null&&i.psshData.length)for(var l=0;l<i.psshData.length;++l)s.uint32(10).bytes(i.psshData[l]);return i.licenseType!=null&&Object.hasOwnProperty.call(i,"licenseType")&&s.uint32(16).int32(i.licenseType),i.requestId!=null&&Object.hasOwnProperty.call(i,"requestId")&&s.uint32(26).bytes(i.requestId),s},e.encodeDelimited=function(i,s){return this.encode(i,s).ldelim()},e.decode=function(i,s){i instanceof u||(i=u.create(i));for(var l=s===void 0?i.len:i.pos+s,y=new c.LicenseRequest.ContentIdentification.WidevinePsshData;i.pos<l;){var p=i.uint32();switch(p>>>3){case 1:{y.psshData&&y.psshData.length||(y.psshData=[]),y.psshData.push(i.bytes());break}case 2:{y.licenseType=i.int32();break}case 3:{y.requestId=i.bytes();break}default:i.skipType(p&7);break}}return y},e.decodeDelimited=function(i){return i instanceof u||(i=new u(i)),this.decode(i,i.uint32())},e.fromObject=function(i){if(i instanceof c.LicenseRequest.ContentIdentification.WidevinePsshData)return i;var s=new c.LicenseRequest.ContentIdentification.WidevinePsshData;if(i.psshData){if(!Array.isArray(i.psshData))throw TypeError(".LicenseRequest.ContentIdentification.WidevinePsshData.psshData: array expected");s.psshData=[];for(var l=0;l<i.psshData.length;++l)typeof i.psshData[l]=="string"?a.base64.decode(i.psshData[l],s.psshData[l]=a.newBuffer(a.base64.length(i.psshData[l])),0):i.psshData[l].length>=0&&(s.psshData[l]=i.psshData[l])}switch(i.licenseType){default:if(typeof i.licenseType=="number"){s.licenseType=i.licenseType;break}break;case"STREAMING":case 1:s.licenseType=1;break;case"OFFLINE":case 2:s.licenseType=2;break;case"AUTOMATIC":case 3:s.licenseType=3;break}return i.requestId!=null&&(typeof i.requestId=="string"?a.base64.decode(i.requestId,s.requestId=a.newBuffer(a.base64.length(i.requestId)),0):i.requestId.length>=0&&(s.requestId=i.requestId)),s},e.toObject=function(i,s){s||(s={});var l={};if((s.arrays||s.defaults)&&(l.psshData=[]),s.defaults&&(l.licenseType=s.enums===String?"STREAMING":1,s.bytes===String?l.requestId="":(l.requestId=[],s.bytes!==Array&&(l.requestId=a.newBuffer(l.requestId)))),i.psshData&&i.psshData.length){l.psshData=[];for(var y=0;y<i.psshData.length;++y)l.psshData[y]=s.bytes===String?a.base64.encode(i.psshData[y],0,i.psshData[y].length):s.bytes===Array?Array.prototype.slice.call(i.psshData[y]):i.psshData[y]}return i.licenseType!=null&&i.hasOwnProperty("licenseType")&&(l.licenseType=s.enums===String?c.LicenseType[i.licenseType]===void 0?i.licenseType:c.LicenseType[i.licenseType]:i.licenseType),i.requestId!=null&&i.hasOwnProperty("requestId")&&(l.requestId=s.bytes===String?a.base64.encode(i.requestId,0,i.requestId.length):s.bytes===Array?Array.prototype.slice.call(i.requestId):i.requestId),l},e.prototype.toJSON=function(){return this.constructor.toObject(this,f.util.toJSONOptions)},e.getTypeUrl=function(i){return i===void 0&&(i="type.googleapis.com"),i+"/LicenseRequest.ContentIdentification.WidevinePsshData"},e}(),r.WebmKeyId=function(){function e(n){if(n)for(var i=Object.keys(n),s=0;s<i.length;++s)n[i[s]]!=null&&(this[i[s]]=n[i[s]])}return e.prototype.header=a.newBuffer([]),e.prototype.licenseType=1,e.prototype.requestId=a.newBuffer([]),e.create=function(i){return new e(i)},e.encode=function(i,s){return s||(s=d.create()),i.header!=null&&Object.hasOwnProperty.call(i,"header")&&s.uint32(10).bytes(i.header),i.licenseType!=null&&Object.hasOwnProperty.call(i,"licenseType")&&s.uint32(16).int32(i.licenseType),i.requestId!=null&&Object.hasOwnProperty.call(i,"requestId")&&s.uint32(26).bytes(i.requestId),s},e.encodeDelimited=function(i,s){return this.encode(i,s).ldelim()},e.decode=function(i,s){i instanceof u||(i=u.create(i));for(var l=s===void 0?i.len:i.pos+s,y=new c.LicenseRequest.ContentIdentification.WebmKeyId;i.pos<l;){var p=i.uint32();switch(p>>>3){case 1:{y.header=i.bytes();break}case 2:{y.licenseType=i.int32();break}case 3:{y.requestId=i.bytes();break}default:i.skipType(p&7);break}}return y},e.decodeDelimited=function(i){return i instanceof u||(i=new u(i)),this.decode(i,i.uint32())},e.fromObject=function(i){if(i instanceof c.LicenseRequest.ContentIdentification.WebmKeyId)return i;var s=new c.LicenseRequest.ContentIdentification.WebmKeyId;switch(i.header!=null&&(typeof i.header=="string"?a.base64.decode(i.header,s.header=a.newBuffer(a.base64.length(i.header)),0):i.header.length>=0&&(s.header=i.header)),i.licenseType){default:if(typeof i.licenseType=="number"){s.licenseType=i.licenseType;break}break;case"STREAMING":case 1:s.licenseType=1;break;case"OFFLINE":case 2:s.licenseType=2;break;case"AUTOMATIC":case 3:s.licenseType=3;break}return i.requestId!=null&&(typeof i.requestId=="string"?a.base64.decode(i.requestId,s.requestId=a.newBuffer(a.base64.length(i.requestId)),0):i.requestId.length>=0&&(s.requestId=i.requestId)),s},e.toObject=function(i,s){s||(s={});var l={};return s.defaults&&(s.bytes===String?l.header="":(l.header=[],s.bytes!==Array&&(l.header=a.newBuffer(l.header))),l.licenseType=s.enums===String?"STREAMING":1,s.bytes===String?l.requestId="":(l.requestId=[],s.bytes!==Array&&(l.requestId=a.newBuffer(l.requestId)))),i.header!=null&&i.hasOwnProperty("header")&&(l.header=s.bytes===String?a.base64.encode(i.header,0,i.header.length):s.bytes===Array?Array.prototype.slice.call(i.header):i.header),i.licenseType!=null&&i.hasOwnProperty("licenseType")&&(l.licenseType=s.enums===String?c.LicenseType[i.licenseType]===void 0?i.licenseType:c.LicenseType[i.licenseType]:i.licenseType),i.requestId!=null&&i.hasOwnProperty("requestId")&&(l.requestId=s.bytes===String?a.base64.encode(i.requestId,0,i.requestId.length):s.bytes===Array?Array.prototype.slice.call(i.requestId):i.requestId),l},e.prototype.toJSON=function(){return this.constructor.toObject(this,f.util.toJSONOptions)},e.getTypeUrl=function(i){return i===void 0&&(i="type.googleapis.com"),i+"/LicenseRequest.ContentIdentification.WebmKeyId"},e}(),r.ExistingLicense=function(){function e(n){if(n)for(var i=Object.keys(n),s=0;s<i.length;++s)n[i[s]]!=null&&(this[i[s]]=n[i[s]])}return e.prototype.licenseId=null,e.prototype.secondsSinceStarted=a.Long?a.Long.fromBits(0,0,!1):0,e.prototype.secondsSinceLastPlayed=a.Long?a.Long.fromBits(0,0,!1):0,e.prototype.sessionUsageTableEntry=a.newBuffer([]),e.create=function(i){return new e(i)},e.encode=function(i,s){return s||(s=d.create()),i.licenseId!=null&&Object.hasOwnProperty.call(i,"licenseId")&&c.LicenseIdentification.encode(i.licenseId,s.uint32(10).fork()).ldelim(),i.secondsSinceStarted!=null&&Object.hasOwnProperty.call(i,"secondsSinceStarted")&&s.uint32(16).int64(i.secondsSinceStarted),i.secondsSinceLastPlayed!=null&&Object.hasOwnProperty.call(i,"secondsSinceLastPlayed")&&s.uint32(24).int64(i.secondsSinceLastPlayed),i.sessionUsageTableEntry!=null&&Object.hasOwnProperty.call(i,"sessionUsageTableEntry")&&s.uint32(34).bytes(i.sessionUsageTableEntry),s},e.encodeDelimited=function(i,s){return this.encode(i,s).ldelim()},e.decode=function(i,s){i instanceof u||(i=u.create(i));for(var l=s===void 0?i.len:i.pos+s,y=new c.LicenseRequest.ContentIdentification.ExistingLicense;i.pos<l;){var p=i.uint32();switch(p>>>3){case 1:{y.licenseId=c.LicenseIdentification.decode(i,i.uint32());break}case 2:{y.secondsSinceStarted=i.int64();break}case 3:{y.secondsSinceLastPlayed=i.int64();break}case 4:{y.sessionUsageTableEntry=i.bytes();break}default:i.skipType(p&7);break}}return y},e.decodeDelimited=function(i){return i instanceof u||(i=new u(i)),this.decode(i,i.uint32())},e.fromObject=function(i){if(i instanceof c.LicenseRequest.ContentIdentification.ExistingLicense)return i;var s=new c.LicenseRequest.ContentIdentification.ExistingLicense;if(i.licenseId!=null){if(typeof i.licenseId!="object")throw TypeError(".LicenseRequest.ContentIdentification.ExistingLicense.licenseId: object expected");s.licenseId=c.LicenseIdentification.fromObject(i.licenseId)}return i.secondsSinceStarted!=null&&(a.Long?(s.secondsSinceStarted=a.Long.fromValue(i.secondsSinceStarted)).unsigned=!1:typeof i.secondsSinceStarted=="string"?s.secondsSinceStarted=parseInt(i.secondsSinceStarted,10):typeof i.secondsSinceStarted=="number"?s.secondsSinceStarted=i.secondsSinceStarted:typeof i.secondsSinceStarted=="object"&&(s.secondsSinceStarted=new a.LongBits(i.secondsSinceStarted.low>>>0,i.secondsSinceStarted.high>>>0).toNumber())),i.secondsSinceLastPlayed!=null&&(a.Long?(s.secondsSinceLastPlayed=a.Long.fromValue(i.secondsSinceLastPlayed)).unsigned=!1:typeof i.secondsSinceLastPlayed=="string"?s.secondsSinceLastPlayed=parseInt(i.secondsSinceLastPlayed,10):typeof i.secondsSinceLastPlayed=="number"?s.secondsSinceLastPlayed=i.secondsSinceLastPlayed:typeof i.secondsSinceLastPlayed=="object"&&(s.secondsSinceLastPlayed=new a.LongBits(i.secondsSinceLastPlayed.low>>>0,i.secondsSinceLastPlayed.high>>>0).toNumber())),i.sessionUsageTableEntry!=null&&(typeof i.sessionUsageTableEntry=="string"?a.base64.decode(i.sessionUsageTableEntry,s.sessionUsageTableEntry=a.newBuffer(a.base64.length(i.sessionUsageTableEntry)),0):i.sessionUsageTableEntry.length>=0&&(s.sessionUsageTableEntry=i.sessionUsageTableEntry)),s},e.toObject=function(i,s){s||(s={});var l={};if(s.defaults){if(l.licenseId=null,a.Long){var y=new a.Long(0,0,!1);l.secondsSinceStarted=s.longs===String?y.toString():s.longs===Number?y.toNumber():y}else l.secondsSinceStarted=s.longs===String?"0":0;if(a.Long){var y=new a.Long(0,0,!1);l.secondsSinceLastPlayed=s.longs===String?y.toString():s.longs===Number?y.toNumber():y}else l.secondsSinceLastPlayed=s.longs===String?"0":0;s.bytes===String?l.sessionUsageTableEntry="":(l.sessionUsageTableEntry=[],s.bytes!==Array&&(l.sessionUsageTableEntry=a.newBuffer(l.sessionUsageTableEntry)))}return i.licenseId!=null&&i.hasOwnProperty("licenseId")&&(l.licenseId=c.LicenseIdentification.toObject(i.licenseId,s)),i.secondsSinceStarted!=null&&i.hasOwnProperty("secondsSinceStarted")&&(typeof i.secondsSinceStarted=="number"?l.secondsSinceStarted=s.longs===String?String(i.secondsSinceStarted):i.secondsSinceStarted:l.secondsSinceStarted=s.longs===String?a.Long.prototype.toString.call(i.secondsSinceStarted):s.longs===Number?new a.LongBits(i.secondsSinceStarted.low>>>0,i.secondsSinceStarted.high>>>0).toNumber():i.secondsSinceStarted),i.secondsSinceLastPlayed!=null&&i.hasOwnProperty("secondsSinceLastPlayed")&&(typeof i.secondsSinceLastPlayed=="number"?l.secondsSinceLastPlayed=s.longs===String?String(i.secondsSinceLastPlayed):i.secondsSinceLastPlayed:l.secondsSinceLastPlayed=s.longs===String?a.Long.prototype.toString.call(i.secondsSinceLastPlayed):s.longs===Number?new a.LongBits(i.secondsSinceLastPlayed.low>>>0,i.secondsSinceLastPlayed.high>>>0).toNumber():i.secondsSinceLastPlayed),i.sessionUsageTableEntry!=null&&i.hasOwnProperty("sessionUsageTableEntry")&&(l.sessionUsageTableEntry=s.bytes===String?a.base64.encode(i.sessionUsageTableEntry,0,i.sessionUsageTableEntry.length):s.bytes===Array?Array.prototype.slice.call(i.sessionUsageTableEntry):i.sessionUsageTableEntry),l},e.prototype.toJSON=function(){return this.constructor.toObject(this,f.util.toJSONOptions)},e.getTypeUrl=function(i){return i===void 0&&(i="type.googleapis.com"),i+"/LicenseRequest.ContentIdentification.ExistingLicense"},e}(),r.InitData=function(){function e(n){if(n)for(var i=Object.keys(n),s=0;s<i.length;++s)n[i[s]]!=null&&(this[i[s]]=n[i[s]])}return e.prototype.initDataType=1,e.prototype.initData=a.newBuffer([]),e.prototype.licenseType=1,e.prototype.requestId=a.newBuffer([]),e.create=function(i){return new e(i)},e.encode=function(i,s){return s||(s=d.create()),i.initDataType!=null&&Object.hasOwnProperty.call(i,"initDataType")&&s.uint32(8).int32(i.initDataType),i.initData!=null&&Object.hasOwnProperty.call(i,"initData")&&s.uint32(18).bytes(i.initData),i.licenseType!=null&&Object.hasOwnProperty.call(i,"licenseType")&&s.uint32(24).int32(i.licenseType),i.requestId!=null&&Object.hasOwnProperty.call(i,"requestId")&&s.uint32(34).bytes(i.requestId),s},e.encodeDelimited=function(i,s){return this.encode(i,s).ldelim()},e.decode=function(i,s){i instanceof u||(i=u.create(i));for(var l=s===void 0?i.len:i.pos+s,y=new c.LicenseRequest.ContentIdentification.InitData;i.pos<l;){var p=i.uint32();switch(p>>>3){case 1:{y.initDataType=i.int32();break}case 2:{y.initData=i.bytes();break}case 3:{y.licenseType=i.int32();break}case 4:{y.requestId=i.bytes();break}default:i.skipType(p&7);break}}return y},e.decodeDelimited=function(i){return i instanceof u||(i=new u(i)),this.decode(i,i.uint32())},e.fromObject=function(i){if(i instanceof c.LicenseRequest.ContentIdentification.InitData)return i;var s=new c.LicenseRequest.ContentIdentification.InitData;switch(i.initDataType){default:if(typeof i.initDataType=="number"){s.initDataType=i.initDataType;break}break;case"CENC":case 1:s.initDataType=1;break;case"WEBM":case 2:s.initDataType=2;break}switch(i.initData!=null&&(typeof i.initData=="string"?a.base64.decode(i.initData,s.initData=a.newBuffer(a.base64.length(i.initData)),0):i.initData.length>=0&&(s.initData=i.initData)),i.licenseType){default:if(typeof i.licenseType=="number"){s.licenseType=i.licenseType;break}break;case"STREAMING":case 1:s.licenseType=1;break;case"OFFLINE":case 2:s.licenseType=2;break;case"AUTOMATIC":case 3:s.licenseType=3;break}return i.requestId!=null&&(typeof i.requestId=="string"?a.base64.decode(i.requestId,s.requestId=a.newBuffer(a.base64.length(i.requestId)),0):i.requestId.length>=0&&(s.requestId=i.requestId)),s},e.toObject=function(i,s){s||(s={});var l={};return s.defaults&&(l.initDataType=s.enums===String?"CENC":1,s.bytes===String?l.initData="":(l.initData=[],s.bytes!==Array&&(l.initData=a.newBuffer(l.initData))),l.licenseType=s.enums===String?"STREAMING":1,s.bytes===String?l.requestId="":(l.requestId=[],s.bytes!==Array&&(l.requestId=a.newBuffer(l.requestId)))),i.initDataType!=null&&i.hasOwnProperty("initDataType")&&(l.initDataType=s.enums===String?c.LicenseRequest.ContentIdentification.InitData.InitDataType[i.initDataType]===void 0?i.initDataType:c.LicenseRequest.ContentIdentification.InitData.InitDataType[i.initDataType]:i.initDataType),i.initData!=null&&i.hasOwnProperty("initData")&&(l.initData=s.bytes===String?a.base64.encode(i.initData,0,i.initData.length):s.bytes===Array?Array.prototype.slice.call(i.initData):i.initData),i.licenseType!=null&&i.hasOwnProperty("licenseType")&&(l.licenseType=s.enums===String?c.LicenseType[i.licenseType]===void 0?i.licenseType:c.LicenseType[i.licenseType]:i.licenseType),i.requestId!=null&&i.hasOwnProperty("requestId")&&(l.requestId=s.bytes===String?a.base64.encode(i.requestId,0,i.requestId.length):s.bytes===Array?Array.prototype.slice.call(i.requestId):i.requestId),l},e.prototype.toJSON=function(){return this.constructor.toObject(this,f.util.toJSONOptions)},e.getTypeUrl=function(i){return i===void 0&&(i="type.googleapis.com"),i+"/LicenseRequest.ContentIdentification.InitData"},e.InitDataType=function(){let n={},i=Object.create(n);return i[n[1]="CENC"]=1,i[n[2]="WEBM"]=2,i}(),e}(),r}(),o.RequestType=function(){let r={},t=Object.create(r);return t[r[1]="NEW"]=1,t[r[2]="RENEWAL"]=2,t[r[3]="RELEASE"]=3,t}(),o})(),Et=c.MetricData=(()=>{function o(r){if(this.metricData=[],r)for(var t=Object.keys(r),e=0;e<t.length;++e)r[t[e]]!=null&&(this[t[e]]=r[t[e]])}return o.prototype.stageName="",o.prototype.metricData=a.emptyArray,o.create=function(t){return new o(t)},o.encode=function(t,e){if(e||(e=d.create()),t.stageName!=null&&Object.hasOwnProperty.call(t,"stageName")&&e.uint32(10).string(t.stageName),t.metricData!=null&&t.metricData.length)for(var n=0;n<t.metricData.length;++n)c.MetricData.TypeValue.encode(t.metricData[n],e.uint32(18).fork()).ldelim();return e},o.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},o.decode=function(t,e){t instanceof u||(t=u.create(t));for(var n=e===void 0?t.len:t.pos+e,i=new c.MetricData;t.pos<n;){var s=t.uint32();switch(s>>>3){case 1:{i.stageName=t.string();break}case 2:{i.metricData&&i.metricData.length||(i.metricData=[]),i.metricData.push(c.MetricData.TypeValue.decode(t,t.uint32()));break}default:t.skipType(s&7);break}}return i},o.decodeDelimited=function(t){return t instanceof u||(t=new u(t)),this.decode(t,t.uint32())},o.fromObject=function(t){if(t instanceof c.MetricData)return t;var e=new c.MetricData;if(t.stageName!=null&&(e.stageName=String(t.stageName)),t.metricData){if(!Array.isArray(t.metricData))throw TypeError(".MetricData.metricData: array expected");e.metricData=[];for(var n=0;n<t.metricData.length;++n){if(typeof t.metricData[n]!="object")throw TypeError(".MetricData.metricData: object expected");e.metricData[n]=c.MetricData.TypeValue.fromObject(t.metricData[n])}}return e},o.toObject=function(t,e){e||(e={});var n={};if((e.arrays||e.defaults)&&(n.metricData=[]),e.defaults&&(n.stageName=""),t.stageName!=null&&t.hasOwnProperty("stageName")&&(n.stageName=t.stageName),t.metricData&&t.metricData.length){n.metricData=[];for(var i=0;i<t.metricData.length;++i)n.metricData[i]=c.MetricData.TypeValue.toObject(t.metricData[i],e)}return n},o.prototype.toJSON=function(){return this.constructor.toObject(this,f.util.toJSONOptions)},o.getTypeUrl=function(t){return t===void 0&&(t="type.googleapis.com"),t+"/MetricData"},o.MetricType=function(){let r={},t=Object.create(r);return t[r[1]="LATENCY"]=1,t[r[2]="TIMESTAMP"]=2,t}(),o.TypeValue=function(){function r(t){if(t)for(var e=Object.keys(t),n=0;n<e.length;++n)t[e[n]]!=null&&(this[e[n]]=t[e[n]])}return r.prototype.type=1,r.prototype.value=a.Long?a.Long.fromBits(0,0,!1):0,r.create=function(e){return new r(e)},r.encode=function(e,n){return n||(n=d.create()),e.type!=null&&Object.hasOwnProperty.call(e,"type")&&n.uint32(8).int32(e.type),e.value!=null&&Object.hasOwnProperty.call(e,"value")&&n.uint32(16).int64(e.value),n},r.encodeDelimited=function(e,n){return this.encode(e,n).ldelim()},r.decode=function(e,n){e instanceof u||(e=u.create(e));for(var i=n===void 0?e.len:e.pos+n,s=new c.MetricData.TypeValue;e.pos<i;){var l=e.uint32();switch(l>>>3){case 1:{s.type=e.int32();break}case 2:{s.value=e.int64();break}default:e.skipType(l&7);break}}return s},r.decodeDelimited=function(e){return e instanceof u||(e=new u(e)),this.decode(e,e.uint32())},r.fromObject=function(e){if(e instanceof c.MetricData.TypeValue)return e;var n=new c.MetricData.TypeValue;switch(e.type){default:if(typeof e.type=="number"){n.type=e.type;break}break;case"LATENCY":case 1:n.type=1;break;case"TIMESTAMP":case 2:n.type=2;break}return e.value!=null&&(a.Long?(n.value=a.Long.fromValue(e.value)).unsigned=!1:typeof e.value=="string"?n.value=parseInt(e.value,10):typeof e.value=="number"?n.value=e.value:typeof e.value=="object"&&(n.value=new a.LongBits(e.value.low>>>0,e.value.high>>>0).toNumber())),n},r.toObject=function(e,n){n||(n={});var i={};if(n.defaults)if(i.type=n.enums===String?"LATENCY":1,a.Long){var s=new a.Long(0,0,!1);i.value=n.longs===String?s.toString():n.longs===Number?s.toNumber():s}else i.value=n.longs===String?"0":0;return e.type!=null&&e.hasOwnProperty("type")&&(i.type=n.enums===String?c.MetricData.MetricType[e.type]===void 0?e.type:c.MetricData.MetricType[e.type]:e.type),e.value!=null&&e.hasOwnProperty("value")&&(typeof e.value=="number"?i.value=n.longs===String?String(e.value):e.value:i.value=n.longs===String?a.Long.prototype.toString.call(e.value):n.longs===Number?new a.LongBits(e.value.low>>>0,e.value.high>>>0).toNumber():e.value),i},r.prototype.toJSON=function(){return this.constructor.toObject(this,f.util.toJSONOptions)},r.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/MetricData.TypeValue"},r}(),o})(),At=c.VersionInfo=(()=>{function o(r){if(r)for(var t=Object.keys(r),e=0;e<t.length;++e)r[t[e]]!=null&&(this[t[e]]=r[t[e]])}return o.prototype.licenseSdkVersion="",o.prototype.licenseServiceVersion="",o.create=function(t){return new o(t)},o.encode=function(t,e){return e||(e=d.create()),t.licenseSdkVersion!=null&&Object.hasOwnProperty.call(t,"licenseSdkVersion")&&e.uint32(10).string(t.licenseSdkVersion),t.licenseServiceVersion!=null&&Object.hasOwnProperty.call(t,"licenseServiceVersion")&&e.uint32(18).string(t.licenseServiceVersion),e},o.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},o.decode=function(t,e){t instanceof u||(t=u.create(t));for(var n=e===void 0?t.len:t.pos+e,i=new c.VersionInfo;t.pos<n;){var s=t.uint32();switch(s>>>3){case 1:{i.licenseSdkVersion=t.string();break}case 2:{i.licenseServiceVersion=t.string();break}default:t.skipType(s&7);break}}return i},o.decodeDelimited=function(t){return t instanceof u||(t=new u(t)),this.decode(t,t.uint32())},o.fromObject=function(t){if(t instanceof c.VersionInfo)return t;var e=new c.VersionInfo;return t.licenseSdkVersion!=null&&(e.licenseSdkVersion=String(t.licenseSdkVersion)),t.licenseServiceVersion!=null&&(e.licenseServiceVersion=String(t.licenseServiceVersion)),e},o.toObject=function(t,e){e||(e={});var n={};return e.defaults&&(n.licenseSdkVersion="",n.licenseServiceVersion=""),t.licenseSdkVersion!=null&&t.hasOwnProperty("licenseSdkVersion")&&(n.licenseSdkVersion=t.licenseSdkVersion),t.licenseServiceVersion!=null&&t.hasOwnProperty("licenseServiceVersion")&&(n.licenseServiceVersion=t.licenseServiceVersion),n},o.prototype.toJSON=function(){return this.constructor.toObject(this,f.util.toJSONOptions)},o.getTypeUrl=function(t){return t===void 0&&(t="type.googleapis.com"),t+"/VersionInfo"},o})(),O=c.SignedMessage=(()=>{function o(r){if(this.metricData=[],r)for(var t=Object.keys(r),e=0;e<t.length;++e)r[t[e]]!=null&&(this[t[e]]=r[t[e]])}return o.prototype.type=1,o.prototype.msg=a.newBuffer([]),o.prototype.signature=a.newBuffer([]),o.prototype.sessionKey=a.newBuffer([]),o.prototype.remoteAttestation=a.newBuffer([]),o.prototype.metricData=a.emptyArray,o.prototype.serviceVersionInfo=null,o.prototype.sessionKeyType=1,o.prototype.oemcryptoCoreMessage=a.newBuffer([]),o.create=function(t){return new o(t)},o.encode=function(t,e){if(e||(e=d.create()),t.type!=null&&Object.hasOwnProperty.call(t,"type")&&e.uint32(8).int32(t.type),t.msg!=null&&Object.hasOwnProperty.call(t,"msg")&&e.uint32(18).bytes(t.msg),t.signature!=null&&Object.hasOwnProperty.call(t,"signature")&&e.uint32(26).bytes(t.signature),t.sessionKey!=null&&Object.hasOwnProperty.call(t,"sessionKey")&&e.uint32(34).bytes(t.sessionKey),t.remoteAttestation!=null&&Object.hasOwnProperty.call(t,"remoteAttestation")&&e.uint32(42).bytes(t.remoteAttestation),t.metricData!=null&&t.metricData.length)for(var n=0;n<t.metricData.length;++n)c.MetricData.encode(t.metricData[n],e.uint32(50).fork()).ldelim();return t.serviceVersionInfo!=null&&Object.hasOwnProperty.call(t,"serviceVersionInfo")&&c.VersionInfo.encode(t.serviceVersionInfo,e.uint32(58).fork()).ldelim(),t.sessionKeyType!=null&&Object.hasOwnProperty.call(t,"sessionKeyType")&&e.uint32(64).int32(t.sessionKeyType),t.oemcryptoCoreMessage!=null&&Object.hasOwnProperty.call(t,"oemcryptoCoreMessage")&&e.uint32(74).bytes(t.oemcryptoCoreMessage),e},o.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},o.decode=function(t,e){t instanceof u||(t=u.create(t));for(var n=e===void 0?t.len:t.pos+e,i=new c.SignedMessage;t.pos<n;){var s=t.uint32();switch(s>>>3){case 1:{i.type=t.int32();break}case 2:{i.msg=t.bytes();break}case 3:{i.signature=t.bytes();break}case 4:{i.sessionKey=t.bytes();break}case 5:{i.remoteAttestation=t.bytes();break}case 6:{i.metricData&&i.metricData.length||(i.metricData=[]),i.metricData.push(c.MetricData.decode(t,t.uint32()));break}case 7:{i.serviceVersionInfo=c.VersionInfo.decode(t,t.uint32());break}case 8:{i.sessionKeyType=t.int32();break}case 9:{i.oemcryptoCoreMessage=t.bytes();break}default:t.skipType(s&7);break}}return i},o.decodeDelimited=function(t){return t instanceof u||(t=new u(t)),this.decode(t,t.uint32())},o.fromObject=function(t){if(t instanceof c.SignedMessage)return t;var e=new c.SignedMessage;switch(t.type){default:if(typeof t.type=="number"){e.type=t.type;break}break;case"LICENSE_REQUEST":case 1:e.type=1;break;case"LICENSE":case 2:e.type=2;break;case"ERROR_RESPONSE":case 3:e.type=3;break;case"SERVICE_CERTIFICATE_REQUEST":case 4:e.type=4;break;case"SERVICE_CERTIFICATE":case 5:e.type=5;break;case"SUB_LICENSE":case 6:e.type=6;break;case"CAS_LICENSE_REQUEST":case 7:e.type=7;break;case"CAS_LICENSE":case 8:e.type=8;break;case"EXTERNAL_LICENSE_REQUEST":case 9:e.type=9;break;case"EXTERNAL_LICENSE":case 10:e.type=10;break}if(t.msg!=null&&(typeof t.msg=="string"?a.base64.decode(t.msg,e.msg=a.newBuffer(a.base64.length(t.msg)),0):t.msg.length>=0&&(e.msg=t.msg)),t.signature!=null&&(typeof t.signature=="string"?a.base64.decode(t.signature,e.signature=a.newBuffer(a.base64.length(t.signature)),0):t.signature.length>=0&&(e.signature=t.signature)),t.sessionKey!=null&&(typeof t.sessionKey=="string"?a.base64.decode(t.sessionKey,e.sessionKey=a.newBuffer(a.base64.length(t.sessionKey)),0):t.sessionKey.length>=0&&(e.sessionKey=t.sessionKey)),t.remoteAttestation!=null&&(typeof t.remoteAttestation=="string"?a.base64.decode(t.remoteAttestation,e.remoteAttestation=a.newBuffer(a.base64.length(t.remoteAttestation)),0):t.remoteAttestation.length>=0&&(e.remoteAttestation=t.remoteAttestation)),t.metricData){if(!Array.isArray(t.metricData))throw TypeError(".SignedMessage.metricData: array expected");e.metricData=[];for(var n=0;n<t.metricData.length;++n){if(typeof t.metricData[n]!="object")throw TypeError(".SignedMessage.metricData: object expected");e.metricData[n]=c.MetricData.fromObject(t.metricData[n])}}if(t.serviceVersionInfo!=null){if(typeof t.serviceVersionInfo!="object")throw TypeError(".SignedMessage.serviceVersionInfo: object expected");e.serviceVersionInfo=c.VersionInfo.fromObject(t.serviceVersionInfo)}switch(t.sessionKeyType){case"UNDEFINED":case 0:e.sessionKeyType=0;break;default:if(typeof t.sessionKeyType=="number"){e.sessionKeyType=t.sessionKeyType;break}break;case"WRAPPED_AES_KEY":case 1:e.sessionKeyType=1;break;case"EPHERMERAL_ECC_PUBLIC_KEY":case 2:e.sessionKeyType=2;break}return t.oemcryptoCoreMessage!=null&&(typeof t.oemcryptoCoreMessage=="string"?a.base64.decode(t.oemcryptoCoreMessage,e.oemcryptoCoreMessage=a.newBuffer(a.base64.length(t.oemcryptoCoreMessage)),0):t.oemcryptoCoreMessage.length>=0&&(e.oemcryptoCoreMessage=t.oemcryptoCoreMessage)),e},o.toObject=function(t,e){e||(e={});var n={};if((e.arrays||e.defaults)&&(n.metricData=[]),e.defaults&&(n.type=e.enums===String?"LICENSE_REQUEST":1,e.bytes===String?n.msg="":(n.msg=[],e.bytes!==Array&&(n.msg=a.newBuffer(n.msg))),e.bytes===String?n.signature="":(n.signature=[],e.bytes!==Array&&(n.signature=a.newBuffer(n.signature))),e.bytes===String?n.sessionKey="":(n.sessionKey=[],e.bytes!==Array&&(n.sessionKey=a.newBuffer(n.sessionKey))),e.bytes===String?n.remoteAttestation="":(n.remoteAttestation=[],e.bytes!==Array&&(n.remoteAttestation=a.newBuffer(n.remoteAttestation))),n.serviceVersionInfo=null,n.sessionKeyType=e.enums===String?"WRAPPED_AES_KEY":1,e.bytes===String?n.oemcryptoCoreMessage="":(n.oemcryptoCoreMessage=[],e.bytes!==Array&&(n.oemcryptoCoreMessage=a.newBuffer(n.oemcryptoCoreMessage)))),t.type!=null&&t.hasOwnProperty("type")&&(n.type=e.enums===String?c.SignedMessage.MessageType[t.type]===void 0?t.type:c.SignedMessage.MessageType[t.type]:t.type),t.msg!=null&&t.hasOwnProperty("msg")&&(n.msg=e.bytes===String?a.base64.encode(t.msg,0,t.msg.length):e.bytes===Array?Array.prototype.slice.call(t.msg):t.msg),t.signature!=null&&t.hasOwnProperty("signature")&&(n.signature=e.bytes===String?a.base64.encode(t.signature,0,t.signature.length):e.bytes===Array?Array.prototype.slice.call(t.signature):t.signature),t.sessionKey!=null&&t.hasOwnProperty("sessionKey")&&(n.sessionKey=e.bytes===String?a.base64.encode(t.sessionKey,0,t.sessionKey.length):e.bytes===Array?Array.prototype.slice.call(t.sessionKey):t.sessionKey),t.remoteAttestation!=null&&t.hasOwnProperty("remoteAttestation")&&(n.remoteAttestation=e.bytes===String?a.base64.encode(t.remoteAttestation,0,t.remoteAttestation.length):e.bytes===Array?Array.prototype.slice.call(t.remoteAttestation):t.remoteAttestation),t.metricData&&t.metricData.length){n.metricData=[];for(var i=0;i<t.metricData.length;++i)n.metricData[i]=c.MetricData.toObject(t.metricData[i],e)}return t.serviceVersionInfo!=null&&t.hasOwnProperty("serviceVersionInfo")&&(n.serviceVersionInfo=c.VersionInfo.toObject(t.serviceVersionInfo,e)),t.sessionKeyType!=null&&t.hasOwnProperty("sessionKeyType")&&(n.sessionKeyType=e.enums===String?c.SignedMessage.SessionKeyType[t.sessionKeyType]===void 0?t.sessionKeyType:c.SignedMessage.SessionKeyType[t.sessionKeyType]:t.sessionKeyType),t.oemcryptoCoreMessage!=null&&t.hasOwnProperty("oemcryptoCoreMessage")&&(n.oemcryptoCoreMessage=e.bytes===String?a.base64.encode(t.oemcryptoCoreMessage,0,t.oemcryptoCoreMessage.length):e.bytes===Array?Array.prototype.slice.call(t.oemcryptoCoreMessage):t.oemcryptoCoreMessage),n},o.prototype.toJSON=function(){return this.constructor.toObject(this,f.util.toJSONOptions)},o.getTypeUrl=function(t){return t===void 0&&(t="type.googleapis.com"),t+"/SignedMessage"},o.MessageType=function(){let r={},t=Object.create(r);return t[r[1]="LICENSE_REQUEST"]=1,t[r[2]="LICENSE"]=2,t[r[3]="ERROR_RESPONSE"]=3,t[r[4]="SERVICE_CERTIFICATE_REQUEST"]=4,t[r[5]="SERVICE_CERTIFICATE"]=5,t[r[6]="SUB_LICENSE"]=6,t[r[7]="CAS_LICENSE_REQUEST"]=7,t[r[8]="CAS_LICENSE"]=8,t[r[9]="EXTERNAL_LICENSE_REQUEST"]=9,t[r[10]="EXTERNAL_LICENSE"]=10,t}(),o.SessionKeyType=function(){let r={},t=Object.create(r);return t[r[0]="UNDEFINED"]=0,t[r[1]="WRAPPED_AES_KEY"]=1,t[r[2]="EPHERMERAL_ECC_PUBLIC_KEY"]=2,t}(),o})(),Rt=c.HashAlgorithmProto=(()=>{let o={},r=Object.create(o);return r[o[0]="HASH_ALGORITHM_UNSPECIFIED"]=0,r[o[1]="HASH_ALGORITHM_SHA_1"]=1,r[o[2]="HASH_ALGORITHM_SHA_256"]=2,r[o[3]="HASH_ALGORITHM_SHA_384"]=3,r})(),j=c.ClientIdentification=(()=>{function o(r){if(this.clientInfo=[],this.deviceCredentials=[],r)for(var t=Object.keys(r),e=0;e<t.length;++e)r[t[e]]!=null&&(this[t[e]]=r[t[e]])}return o.prototype.type=0,o.prototype.token=a.newBuffer([]),o.prototype.clientInfo=a.emptyArray,o.prototype.providerClientToken=a.newBuffer([]),o.prototype.licenseCounter=0,o.prototype.clientCapabilities=null,o.prototype.vmpData=a.newBuffer([]),o.prototype.deviceCredentials=a.emptyArray,o.create=function(t){return new o(t)},o.encode=function(t,e){if(e||(e=d.create()),t.type!=null&&Object.hasOwnProperty.call(t,"type")&&e.uint32(8).int32(t.type),t.token!=null&&Object.hasOwnProperty.call(t,"token")&&e.uint32(18).bytes(t.token),t.clientInfo!=null&&t.clientInfo.length)for(var n=0;n<t.clientInfo.length;++n)c.ClientIdentification.NameValue.encode(t.clientInfo[n],e.uint32(26).fork()).ldelim();if(t.providerClientToken!=null&&Object.hasOwnProperty.call(t,"providerClientToken")&&e.uint32(34).bytes(t.providerClientToken),t.licenseCounter!=null&&Object.hasOwnProperty.call(t,"licenseCounter")&&e.uint32(40).uint32(t.licenseCounter),t.clientCapabilities!=null&&Object.hasOwnProperty.call(t,"clientCapabilities")&&c.ClientIdentification.ClientCapabilities.encode(t.clientCapabilities,e.uint32(50).fork()).ldelim(),t.vmpData!=null&&Object.hasOwnProperty.call(t,"vmpData")&&e.uint32(58).bytes(t.vmpData),t.deviceCredentials!=null&&t.deviceCredentials.length)for(var n=0;n<t.deviceCredentials.length;++n)c.ClientIdentification.ClientCredentials.encode(t.deviceCredentials[n],e.uint32(66).fork()).ldelim();return e},o.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},o.decode=function(t,e){t instanceof u||(t=u.create(t));for(var n=e===void 0?t.len:t.pos+e,i=new c.ClientIdentification;t.pos<n;){var s=t.uint32();switch(s>>>3){case 1:{i.type=t.int32();break}case 2:{i.token=t.bytes();break}case 3:{i.clientInfo&&i.clientInfo.length||(i.clientInfo=[]),i.clientInfo.push(c.ClientIdentification.NameValue.decode(t,t.uint32()));break}case 4:{i.providerClientToken=t.bytes();break}case 5:{i.licenseCounter=t.uint32();break}case 6:{i.clientCapabilities=c.ClientIdentification.ClientCapabilities.decode(t,t.uint32());break}case 7:{i.vmpData=t.bytes();break}case 8:{i.deviceCredentials&&i.deviceCredentials.length||(i.deviceCredentials=[]),i.deviceCredentials.push(c.ClientIdentification.ClientCredentials.decode(t,t.uint32()));break}default:t.skipType(s&7);break}}return i},o.decodeDelimited=function(t){return t instanceof u||(t=new u(t)),this.decode(t,t.uint32())},o.fromObject=function(t){if(t instanceof c.ClientIdentification)return t;var e=new c.ClientIdentification;switch(t.type){default:if(typeof t.type=="number"){e.type=t.type;break}break;case"KEYBOX":case 0:e.type=0;break;case"DRM_DEVICE_CERTIFICATE":case 1:e.type=1;break;case"REMOTE_ATTESTATION_CERTIFICATE":case 2:e.type=2;break;case"OEM_DEVICE_CERTIFICATE":case 3:e.type=3;break}if(t.token!=null&&(typeof t.token=="string"?a.base64.decode(t.token,e.token=a.newBuffer(a.base64.length(t.token)),0):t.token.length>=0&&(e.token=t.token)),t.clientInfo){if(!Array.isArray(t.clientInfo))throw TypeError(".ClientIdentification.clientInfo: array expected");e.clientInfo=[];for(var n=0;n<t.clientInfo.length;++n){if(typeof t.clientInfo[n]!="object")throw TypeError(".ClientIdentification.clientInfo: object expected");e.clientInfo[n]=c.ClientIdentification.NameValue.fromObject(t.clientInfo[n])}}if(t.providerClientToken!=null&&(typeof t.providerClientToken=="string"?a.base64.decode(t.providerClientToken,e.providerClientToken=a.newBuffer(a.base64.length(t.providerClientToken)),0):t.providerClientToken.length>=0&&(e.providerClientToken=t.providerClientToken)),t.licenseCounter!=null&&(e.licenseCounter=t.licenseCounter>>>0),t.clientCapabilities!=null){if(typeof t.clientCapabilities!="object")throw TypeError(".ClientIdentification.clientCapabilities: object expected");e.clientCapabilities=c.ClientIdentification.ClientCapabilities.fromObject(t.clientCapabilities)}if(t.vmpData!=null&&(typeof t.vmpData=="string"?a.base64.decode(t.vmpData,e.vmpData=a.newBuffer(a.base64.length(t.vmpData)),0):t.vmpData.length>=0&&(e.vmpData=t.vmpData)),t.deviceCredentials){if(!Array.isArray(t.deviceCredentials))throw TypeError(".ClientIdentification.deviceCredentials: array expected");e.deviceCredentials=[];for(var n=0;n<t.deviceCredentials.length;++n){if(typeof t.deviceCredentials[n]!="object")throw TypeError(".ClientIdentification.deviceCredentials: object expected");e.deviceCredentials[n]=c.ClientIdentification.ClientCredentials.fromObject(t.deviceCredentials[n])}}return e},o.toObject=function(t,e){e||(e={});var n={};if((e.arrays||e.defaults)&&(n.clientInfo=[],n.deviceCredentials=[]),e.defaults&&(n.type=e.enums===String?"KEYBOX":0,e.bytes===String?n.token="":(n.token=[],e.bytes!==Array&&(n.token=a.newBuffer(n.token))),e.bytes===String?n.providerClientToken="":(n.providerClientToken=[],e.bytes!==Array&&(n.providerClientToken=a.newBuffer(n.providerClientToken))),n.licenseCounter=0,n.clientCapabilities=null,e.bytes===String?n.vmpData="":(n.vmpData=[],e.bytes!==Array&&(n.vmpData=a.newBuffer(n.vmpData)))),t.type!=null&&t.hasOwnProperty("type")&&(n.type=e.enums===String?c.ClientIdentification.TokenType[t.type]===void 0?t.type:c.ClientIdentification.TokenType[t.type]:t.type),t.token!=null&&t.hasOwnProperty("token")&&(n.token=e.bytes===String?a.base64.encode(t.token,0,t.token.length):e.bytes===Array?Array.prototype.slice.call(t.token):t.token),t.clientInfo&&t.clientInfo.length){n.clientInfo=[];for(var i=0;i<t.clientInfo.length;++i)n.clientInfo[i]=c.ClientIdentification.NameValue.toObject(t.clientInfo[i],e)}if(t.providerClientToken!=null&&t.hasOwnProperty("providerClientToken")&&(n.providerClientToken=e.bytes===String?a.base64.encode(t.providerClientToken,0,t.providerClientToken.length):e.bytes===Array?Array.prototype.slice.call(t.providerClientToken):t.providerClientToken),t.licenseCounter!=null&&t.hasOwnProperty("licenseCounter")&&(n.licenseCounter=t.licenseCounter),t.clientCapabilities!=null&&t.hasOwnProperty("clientCapabilities")&&(n.clientCapabilities=c.ClientIdentification.ClientCapabilities.toObject(t.clientCapabilities,e)),t.vmpData!=null&&t.hasOwnProperty("vmpData")&&(n.vmpData=e.bytes===String?a.base64.encode(t.vmpData,0,t.vmpData.length):e.bytes===Array?Array.prototype.slice.call(t.vmpData):t.vmpData),t.deviceCredentials&&t.deviceCredentials.length){n.deviceCredentials=[];for(var i=0;i<t.deviceCredentials.length;++i)n.deviceCredentials[i]=c.ClientIdentification.ClientCredentials.toObject(t.deviceCredentials[i],e)}return n},o.prototype.toJSON=function(){return this.constructor.toObject(this,f.util.toJSONOptions)},o.getTypeUrl=function(t){return t===void 0&&(t="type.googleapis.com"),t+"/ClientIdentification"},o.TokenType=function(){let r={},t=Object.create(r);return t[r[0]="KEYBOX"]=0,t[r[1]="DRM_DEVICE_CERTIFICATE"]=1,t[r[2]="REMOTE_ATTESTATION_CERTIFICATE"]=2,t[r[3]="OEM_DEVICE_CERTIFICATE"]=3,t}(),o.NameValue=function(){function r(t){if(t)for(var e=Object.keys(t),n=0;n<e.length;++n)t[e[n]]!=null&&(this[e[n]]=t[e[n]])}return r.prototype.name="",r.prototype.value="",r.create=function(e){return new r(e)},r.encode=function(e,n){return n||(n=d.create()),e.name!=null&&Object.hasOwnProperty.call(e,"name")&&n.uint32(10).string(e.name),e.value!=null&&Object.hasOwnProperty.call(e,"value")&&n.uint32(18).string(e.value),n},r.encodeDelimited=function(e,n){return this.encode(e,n).ldelim()},r.decode=function(e,n){e instanceof u||(e=u.create(e));for(var i=n===void 0?e.len:e.pos+n,s=new c.ClientIdentification.NameValue;e.pos<i;){var l=e.uint32();switch(l>>>3){case 1:{s.name=e.string();break}case 2:{s.value=e.string();break}default:e.skipType(l&7);break}}return s},r.decodeDelimited=function(e){return e instanceof u||(e=new u(e)),this.decode(e,e.uint32())},r.fromObject=function(e){if(e instanceof c.ClientIdentification.NameValue)return e;var n=new c.ClientIdentification.NameValue;return e.name!=null&&(n.name=String(e.name)),e.value!=null&&(n.value=String(e.value)),n},r.toObject=function(e,n){n||(n={});var i={};return n.defaults&&(i.name="",i.value=""),e.name!=null&&e.hasOwnProperty("name")&&(i.name=e.name),e.value!=null&&e.hasOwnProperty("value")&&(i.value=e.value),i},r.prototype.toJSON=function(){return this.constructor.toObject(this,f.util.toJSONOptions)},r.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/ClientIdentification.NameValue"},r}(),o.ClientCapabilities=function(){function r(t){if(this.supportedCertificateKeyType=[],t)for(var e=Object.keys(t),n=0;n<e.length;++n)t[e[n]]!=null&&(this[e[n]]=t[e[n]])}return r.prototype.clientToken=!1,r.prototype.sessionToken=!1,r.prototype.videoResolutionConstraints=!1,r.prototype.maxHdcpVersion=0,r.prototype.oemCryptoApiVersion=0,r.prototype.antiRollbackUsageTable=!1,r.prototype.srmVersion=0,r.prototype.canUpdateSrm=!1,r.prototype.supportedCertificateKeyType=a.emptyArray,r.prototype.analogOutputCapabilities=0,r.prototype.canDisableAnalogOutput=!1,r.prototype.resourceRatingTier=0,r.create=function(e){return new r(e)},r.encode=function(e,n){if(n||(n=d.create()),e.clientToken!=null&&Object.hasOwnProperty.call(e,"clientToken")&&n.uint32(8).bool(e.clientToken),e.sessionToken!=null&&Object.hasOwnProperty.call(e,"sessionToken")&&n.uint32(16).bool(e.sessionToken),e.videoResolutionConstraints!=null&&Object.hasOwnProperty.call(e,"videoResolutionConstraints")&&n.uint32(24).bool(e.videoResolutionConstraints),e.maxHdcpVersion!=null&&Object.hasOwnProperty.call(e,"maxHdcpVersion")&&n.uint32(32).int32(e.maxHdcpVersion),e.oemCryptoApiVersion!=null&&Object.hasOwnProperty.call(e,"oemCryptoApiVersion")&&n.uint32(40).uint32(e.oemCryptoApiVersion),e.antiRollbackUsageTable!=null&&Object.hasOwnProperty.call(e,"antiRollbackUsageTable")&&n.uint32(48).bool(e.antiRollbackUsageTable),e.srmVersion!=null&&Object.hasOwnProperty.call(e,"srmVersion")&&n.uint32(56).uint32(e.srmVersion),e.canUpdateSrm!=null&&Object.hasOwnProperty.call(e,"canUpdateSrm")&&n.uint32(64).bool(e.canUpdateSrm),e.supportedCertificateKeyType!=null&&e.supportedCertificateKeyType.length)for(var i=0;i<e.supportedCertificateKeyType.length;++i)n.uint32(72).int32(e.supportedCertificateKeyType[i]);return e.analogOutputCapabilities!=null&&Object.hasOwnProperty.call(e,"analogOutputCapabilities")&&n.uint32(80).int32(e.analogOutputCapabilities),e.canDisableAnalogOutput!=null&&Object.hasOwnProperty.call(e,"canDisableAnalogOutput")&&n.uint32(88).bool(e.canDisableAnalogOutput),e.resourceRatingTier!=null&&Object.hasOwnProperty.call(e,"resourceRatingTier")&&n.uint32(96).uint32(e.resourceRatingTier),n},r.encodeDelimited=function(e,n){return this.encode(e,n).ldelim()},r.decode=function(e,n){e instanceof u||(e=u.create(e));for(var i=n===void 0?e.len:e.pos+n,s=new c.ClientIdentification.ClientCapabilities;e.pos<i;){var l=e.uint32();switch(l>>>3){case 1:{s.clientToken=e.bool();break}case 2:{s.sessionToken=e.bool();break}case 3:{s.videoResolutionConstraints=e.bool();break}case 4:{s.maxHdcpVersion=e.int32();break}case 5:{s.oemCryptoApiVersion=e.uint32();break}case 6:{s.antiRollbackUsageTable=e.bool();break}case 7:{s.srmVersion=e.uint32();break}case 8:{s.canUpdateSrm=e.bool();break}case 9:{if(s.supportedCertificateKeyType&&s.supportedCertificateKeyType.length||(s.supportedCertificateKeyType=[]),(l&7)===2)for(var y=e.uint32()+e.pos;e.pos<y;)s.supportedCertificateKeyType.push(e.int32());else s.supportedCertificateKeyType.push(e.int32());break}case 10:{s.analogOutputCapabilities=e.int32();break}case 11:{s.canDisableAnalogOutput=e.bool();break}case 12:{s.resourceRatingTier=e.uint32();break}default:e.skipType(l&7);break}}return s},r.decodeDelimited=function(e){return e instanceof u||(e=new u(e)),this.decode(e,e.uint32())},r.fromObject=function(e){if(e instanceof c.ClientIdentification.ClientCapabilities)return e;var n=new c.ClientIdentification.ClientCapabilities;switch(e.clientToken!=null&&(n.clientToken=!!e.clientToken),e.sessionToken!=null&&(n.sessionToken=!!e.sessionToken),e.videoResolutionConstraints!=null&&(n.videoResolutionConstraints=!!e.videoResolutionConstraints),e.maxHdcpVersion){default:if(typeof e.maxHdcpVersion=="number"){n.maxHdcpVersion=e.maxHdcpVersion;break}break;case"HDCP_NONE":case 0:n.maxHdcpVersion=0;break;case"HDCP_V1":case 1:n.maxHdcpVersion=1;break;case"HDCP_V2":case 2:n.maxHdcpVersion=2;break;case"HDCP_V2_1":case 3:n.maxHdcpVersion=3;break;case"HDCP_V2_2":case 4:n.maxHdcpVersion=4;break;case"HDCP_V2_3":case 5:n.maxHdcpVersion=5;break;case"HDCP_NO_DIGITAL_OUTPUT":case 255:n.maxHdcpVersion=255;break}if(e.oemCryptoApiVersion!=null&&(n.oemCryptoApiVersion=e.oemCryptoApiVersion>>>0),e.antiRollbackUsageTable!=null&&(n.antiRollbackUsageTable=!!e.antiRollbackUsageTable),e.srmVersion!=null&&(n.srmVersion=e.srmVersion>>>0),e.canUpdateSrm!=null&&(n.canUpdateSrm=!!e.canUpdateSrm),e.supportedCertificateKeyType){if(!Array.isArray(e.supportedCertificateKeyType))throw TypeError(".ClientIdentification.ClientCapabilities.supportedCertificateKeyType: array expected");n.supportedCertificateKeyType=[];for(var i=0;i<e.supportedCertificateKeyType.length;++i)switch(e.supportedCertificateKeyType[i]){default:if(typeof e.supportedCertificateKeyType[i]=="number"){n.supportedCertificateKeyType[i]=e.supportedCertificateKeyType[i];break}case"RSA_2048":case 0:n.supportedCertificateKeyType[i]=0;break;case"RSA_3072":case 1:n.supportedCertificateKeyType[i]=1;break;case"ECC_SECP256R1":case 2:n.supportedCertificateKeyType[i]=2;break;case"ECC_SECP384R1":case 3:n.supportedCertificateKeyType[i]=3;break;case"ECC_SECP521R1":case 4:n.supportedCertificateKeyType[i]=4;break}}switch(e.analogOutputCapabilities){default:if(typeof e.analogOutputCapabilities=="number"){n.analogOutputCapabilities=e.analogOutputCapabilities;break}break;case"ANALOG_OUTPUT_UNKNOWN":case 0:n.analogOutputCapabilities=0;break;case"ANALOG_OUTPUT_NONE":case 1:n.analogOutputCapabilities=1;break;case"ANALOG_OUTPUT_SUPPORTED":case 2:n.analogOutputCapabilities=2;break;case"ANALOG_OUTPUT_SUPPORTS_CGMS_A":case 3:n.analogOutputCapabilities=3;break}return e.canDisableAnalogOutput!=null&&(n.canDisableAnalogOutput=!!e.canDisableAnalogOutput),e.resourceRatingTier!=null&&(n.resourceRatingTier=e.resourceRatingTier>>>0),n},r.toObject=function(e,n){n||(n={});var i={};if((n.arrays||n.defaults)&&(i.supportedCertificateKeyType=[]),n.defaults&&(i.clientToken=!1,i.sessionToken=!1,i.videoResolutionConstraints=!1,i.maxHdcpVersion=n.enums===String?"HDCP_NONE":0,i.oemCryptoApiVersion=0,i.antiRollbackUsageTable=!1,i.srmVersion=0,i.canUpdateSrm=!1,i.analogOutputCapabilities=n.enums===String?"ANALOG_OUTPUT_UNKNOWN":0,i.canDisableAnalogOutput=!1,i.resourceRatingTier=0),e.clientToken!=null&&e.hasOwnProperty("clientToken")&&(i.clientToken=e.clientToken),e.sessionToken!=null&&e.hasOwnProperty("sessionToken")&&(i.sessionToken=e.sessionToken),e.videoResolutionConstraints!=null&&e.hasOwnProperty("videoResolutionConstraints")&&(i.videoResolutionConstraints=e.videoResolutionConstraints),e.maxHdcpVersion!=null&&e.hasOwnProperty("maxHdcpVersion")&&(i.maxHdcpVersion=n.enums===String?c.ClientIdentification.ClientCapabilities.HdcpVersion[e.maxHdcpVersion]===void 0?e.maxHdcpVersion:c.ClientIdentification.ClientCapabilities.HdcpVersion[e.maxHdcpVersion]:e.maxHdcpVersion),e.oemCryptoApiVersion!=null&&e.hasOwnProperty("oemCryptoApiVersion")&&(i.oemCryptoApiVersion=e.oemCryptoApiVersion),e.antiRollbackUsageTable!=null&&e.hasOwnProperty("antiRollbackUsageTable")&&(i.antiRollbackUsageTable=e.antiRollbackUsageTable),e.srmVersion!=null&&e.hasOwnProperty("srmVersion")&&(i.srmVersion=e.srmVersion),e.canUpdateSrm!=null&&e.hasOwnProperty("canUpdateSrm")&&(i.canUpdateSrm=e.canUpdateSrm),e.supportedCertificateKeyType&&e.supportedCertificateKeyType.length){i.supportedCertificateKeyType=[];for(var s=0;s<e.supportedCertificateKeyType.length;++s)i.supportedCertificateKeyType[s]=n.enums===String?c.ClientIdentification.ClientCapabilities.CertificateKeyType[e.supportedCertificateKeyType[s]]===void 0?e.supportedCertificateKeyType[s]:c.ClientIdentification.ClientCapabilities.CertificateKeyType[e.supportedCertificateKeyType[s]]:e.supportedCertificateKeyType[s]}return e.analogOutputCapabilities!=null&&e.hasOwnProperty("analogOutputCapabilities")&&(i.analogOutputCapabilities=n.enums===String?c.ClientIdentification.ClientCapabilities.AnalogOutputCapabilities[e.analogOutputCapabilities]===void 0?e.analogOutputCapabilities:c.ClientIdentification.ClientCapabilities.AnalogOutputCapabilities[e.analogOutputCapabilities]:e.analogOutputCapabilities),e.canDisableAnalogOutput!=null&&e.hasOwnProperty("canDisableAnalogOutput")&&(i.canDisableAnalogOutput=e.canDisableAnalogOutput),e.resourceRatingTier!=null&&e.hasOwnProperty("resourceRatingTier")&&(i.resourceRatingTier=e.resourceRatingTier),i},r.prototype.toJSON=function(){return this.constructor.toObject(this,f.util.toJSONOptions)},r.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/ClientIdentification.ClientCapabilities"},r.HdcpVersion=function(){let t={},e=Object.create(t);return e[t[0]="HDCP_NONE"]=0,e[t[1]="HDCP_V1"]=1,e[t[2]="HDCP_V2"]=2,e[t[3]="HDCP_V2_1"]=3,e[t[4]="HDCP_V2_2"]=4,e[t[5]="HDCP_V2_3"]=5,e[t[255]="HDCP_NO_DIGITAL_OUTPUT"]=255,e}(),r.CertificateKeyType=function(){let t={},e=Object.create(t);return e[t[0]="RSA_2048"]=0,e[t[1]="RSA_3072"]=1,e[t[2]="ECC_SECP256R1"]=2,e[t[3]="ECC_SECP384R1"]=3,e[t[4]="ECC_SECP521R1"]=4,e}(),r.AnalogOutputCapabilities=function(){let t={},e=Object.create(t);return e[t[0]="ANALOG_OUTPUT_UNKNOWN"]=0,e[t[1]="ANALOG_OUTPUT_NONE"]=1,e[t[2]="ANALOG_OUTPUT_SUPPORTED"]=2,e[t[3]="ANALOG_OUTPUT_SUPPORTS_CGMS_A"]=3,e}(),r}(),o.ClientCredentials=function(){function r(t){if(t)for(var e=Object.keys(t),n=0;n<e.length;++n)t[e[n]]!=null&&(this[e[n]]=t[e[n]])}return r.prototype.type=0,r.prototype.token=a.newBuffer([]),r.create=function(e){return new r(e)},r.encode=function(e,n){return n||(n=d.create()),e.type!=null&&Object.hasOwnProperty.call(e,"type")&&n.uint32(8).int32(e.type),e.token!=null&&Object.hasOwnProperty.call(e,"token")&&n.uint32(18).bytes(e.token),n},r.encodeDelimited=function(e,n){return this.encode(e,n).ldelim()},r.decode=function(e,n){e instanceof u||(e=u.create(e));for(var i=n===void 0?e.len:e.pos+n,s=new c.ClientIdentification.ClientCredentials;e.pos<i;){var l=e.uint32();switch(l>>>3){case 1:{s.type=e.int32();break}case 2:{s.token=e.bytes();break}default:e.skipType(l&7);break}}return s},r.decodeDelimited=function(e){return e instanceof u||(e=new u(e)),this.decode(e,e.uint32())},r.fromObject=function(e){if(e instanceof c.ClientIdentification.ClientCredentials)return e;var n=new c.ClientIdentification.ClientCredentials;switch(e.type){default:if(typeof e.type=="number"){n.type=e.type;break}break;case"KEYBOX":case 0:n.type=0;break;case"DRM_DEVICE_CERTIFICATE":case 1:n.type=1;break;case"REMOTE_ATTESTATION_CERTIFICATE":case 2:n.type=2;break;case"OEM_DEVICE_CERTIFICATE":case 3:n.type=3;break}return e.token!=null&&(typeof e.token=="string"?a.base64.decode(e.token,n.token=a.newBuffer(a.base64.length(e.token)),0):e.token.length>=0&&(n.token=e.token)),n},r.toObject=function(e,n){n||(n={});var i={};return n.defaults&&(i.type=n.enums===String?"KEYBOX":0,n.bytes===String?i.token="":(i.token=[],n.bytes!==Array&&(i.token=a.newBuffer(i.token)))),e.type!=null&&e.hasOwnProperty("type")&&(i.type=n.enums===String?c.ClientIdentification.TokenType[e.type]===void 0?e.type:c.ClientIdentification.TokenType[e.type]:e.type),e.token!=null&&e.hasOwnProperty("token")&&(i.token=n.bytes===String?a.base64.encode(e.token,0,e.token.length):n.bytes===Array?Array.prototype.slice.call(e.token):e.token),i},r.prototype.toJSON=function(){return this.constructor.toObject(this,f.util.toJSONOptions)},r.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/ClientIdentification.ClientCredentials"},r}(),o})(),ue=c.EncryptedClientIdentification=(()=>{function o(r){if(r)for(var t=Object.keys(r),e=0;e<t.length;++e)r[t[e]]!=null&&(this[t[e]]=r[t[e]])}return o.prototype.providerId="",o.prototype.serviceCertificateSerialNumber=a.newBuffer([]),o.prototype.encryptedClientId=a.newBuffer([]),o.prototype.encryptedClientIdIv=a.newBuffer([]),o.prototype.encryptedPrivacyKey=a.newBuffer([]),o.create=function(t){return new o(t)},o.encode=function(t,e){return e||(e=d.create()),t.providerId!=null&&Object.hasOwnProperty.call(t,"providerId")&&e.uint32(10).string(t.providerId),t.serviceCertificateSerialNumber!=null&&Object.hasOwnProperty.call(t,"serviceCertificateSerialNumber")&&e.uint32(18).bytes(t.serviceCertificateSerialNumber),t.encryptedClientId!=null&&Object.hasOwnProperty.call(t,"encryptedClientId")&&e.uint32(26).bytes(t.encryptedClientId),t.encryptedClientIdIv!=null&&Object.hasOwnProperty.call(t,"encryptedClientIdIv")&&e.uint32(34).bytes(t.encryptedClientIdIv),t.encryptedPrivacyKey!=null&&Object.hasOwnProperty.call(t,"encryptedPrivacyKey")&&e.uint32(42).bytes(t.encryptedPrivacyKey),e},o.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},o.decode=function(t,e){t instanceof u||(t=u.create(t));for(var n=e===void 0?t.len:t.pos+e,i=new c.EncryptedClientIdentification;t.pos<n;){var s=t.uint32();switch(s>>>3){case 1:{i.providerId=t.string();break}case 2:{i.serviceCertificateSerialNumber=t.bytes();break}case 3:{i.encryptedClientId=t.bytes();break}case 4:{i.encryptedClientIdIv=t.bytes();break}case 5:{i.encryptedPrivacyKey=t.bytes();break}default:t.skipType(s&7);break}}return i},o.decodeDelimited=function(t){return t instanceof u||(t=new u(t)),this.decode(t,t.uint32())},o.fromObject=function(t){if(t instanceof c.EncryptedClientIdentification)return t;var e=new c.EncryptedClientIdentification;return t.providerId!=null&&(e.providerId=String(t.providerId)),t.serviceCertificateSerialNumber!=null&&(typeof t.serviceCertificateSerialNumber=="string"?a.base64.decode(t.serviceCertificateSerialNumber,e.serviceCertificateSerialNumber=a.newBuffer(a.base64.length(t.serviceCertificateSerialNumber)),0):t.serviceCertificateSerialNumber.length>=0&&(e.serviceCertificateSerialNumber=t.serviceCertificateSerialNumber)),t.encryptedClientId!=null&&(typeof t.encryptedClientId=="string"?a.base64.decode(t.encryptedClientId,e.encryptedClientId=a.newBuffer(a.base64.length(t.encryptedClientId)),0):t.encryptedClientId.length>=0&&(e.encryptedClientId=t.encryptedClientId)),t.encryptedClientIdIv!=null&&(typeof t.encryptedClientIdIv=="string"?a.base64.decode(t.encryptedClientIdIv,e.encryptedClientIdIv=a.newBuffer(a.base64.length(t.encryptedClientIdIv)),0):t.encryptedClientIdIv.length>=0&&(e.encryptedClientIdIv=t.encryptedClientIdIv)),t.encryptedPrivacyKey!=null&&(typeof t.encryptedPrivacyKey=="string"?a.base64.decode(t.encryptedPrivacyKey,e.encryptedPrivacyKey=a.newBuffer(a.base64.length(t.encryptedPrivacyKey)),0):t.encryptedPrivacyKey.length>=0&&(e.encryptedPrivacyKey=t.encryptedPrivacyKey)),e},o.toObject=function(t,e){e||(e={});var n={};return e.defaults&&(n.providerId="",e.bytes===String?n.serviceCertificateSerialNumber="":(n.serviceCertificateSerialNumber=[],e.bytes!==Array&&(n.serviceCertificateSerialNumber=a.newBuffer(n.serviceCertificateSerialNumber))),e.bytes===String?n.encryptedClientId="":(n.encryptedClientId=[],e.bytes!==Array&&(n.encryptedClientId=a.newBuffer(n.encryptedClientId))),e.bytes===String?n.encryptedClientIdIv="":(n.encryptedClientIdIv=[],e.bytes!==Array&&(n.encryptedClientIdIv=a.newBuffer(n.encryptedClientIdIv))),e.bytes===String?n.encryptedPrivacyKey="":(n.encryptedPrivacyKey=[],e.bytes!==Array&&(n.encryptedPrivacyKey=a.newBuffer(n.encryptedPrivacyKey)))),t.providerId!=null&&t.hasOwnProperty("providerId")&&(n.providerId=t.providerId),t.serviceCertificateSerialNumber!=null&&t.hasOwnProperty("serviceCertificateSerialNumber")&&(n.serviceCertificateSerialNumber=e.bytes===String?a.base64.encode(t.serviceCertificateSerialNumber,0,t.serviceCertificateSerialNumber.length):e.bytes===Array?Array.prototype.slice.call(t.serviceCertificateSerialNumber):t.serviceCertificateSerialNumber),t.encryptedClientId!=null&&t.hasOwnProperty("encryptedClientId")&&(n.encryptedClientId=e.bytes===String?a.base64.encode(t.encryptedClientId,0,t.encryptedClientId.length):e.bytes===Array?Array.prototype.slice.call(t.encryptedClientId):t.encryptedClientId),t.encryptedClientIdIv!=null&&t.hasOwnProperty("encryptedClientIdIv")&&(n.encryptedClientIdIv=e.bytes===String?a.base64.encode(t.encryptedClientIdIv,0,t.encryptedClientIdIv.length):e.bytes===Array?Array.prototype.slice.call(t.encryptedClientIdIv):t.encryptedClientIdIv),t.encryptedPrivacyKey!=null&&t.hasOwnProperty("encryptedPrivacyKey")&&(n.encryptedPrivacyKey=e.bytes===String?a.base64.encode(t.encryptedPrivacyKey,0,t.encryptedPrivacyKey.length):e.bytes===Array?Array.prototype.slice.call(t.encryptedPrivacyKey):t.encryptedPrivacyKey),n},o.prototype.toJSON=function(){return this.constructor.toObject(this,f.util.toJSONOptions)},o.getTypeUrl=function(t){return t===void 0&&(t="type.googleapis.com"),t+"/EncryptedClientIdentification"},o})(),mt=c.LicenseError=(()=>{function o(r){if(r)for(var t=Object.keys(r),e=0;e<t.length;++e)r[t[e]]!=null&&(this[t[e]]=r[t[e]])}return o.prototype.errorCode=1,o.create=function(t){return new o(t)},o.encode=function(t,e){return e||(e=d.create()),t.errorCode!=null&&Object.hasOwnProperty.call(t,"errorCode")&&e.uint32(8).int32(t.errorCode),e},o.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},o.decode=function(t,e){t instanceof u||(t=u.create(t));for(var n=e===void 0?t.len:t.pos+e,i=new c.LicenseError;t.pos<n;){var s=t.uint32();switch(s>>>3){case 1:{i.errorCode=t.int32();break}default:t.skipType(s&7);break}}return i},o.decodeDelimited=function(t){return t instanceof u||(t=new u(t)),this.decode(t,t.uint32())},o.fromObject=function(t){if(t instanceof c.LicenseError)return t;var e=new c.LicenseError;switch(t.errorCode){default:if(typeof t.errorCode=="number"){e.errorCode=t.errorCode;break}break;case"INVALID_DEVICE_CERTIFICATE":case 1:e.errorCode=1;break;case"REVOKED_DEVICE_CERTIFICATE":case 2:e.errorCode=2;break;case"SERVICE_UNAVAILABLE":case 3:e.errorCode=3;break}return e},o.toObject=function(t,e){e||(e={});var n={};return e.defaults&&(n.errorCode=e.enums===String?"INVALID_DEVICE_CERTIFICATE":1),t.errorCode!=null&&t.hasOwnProperty("errorCode")&&(n.errorCode=e.enums===String?c.LicenseError.Error[t.errorCode]===void 0?t.errorCode:c.LicenseError.Error[t.errorCode]:t.errorCode),n},o.prototype.toJSON=function(){return this.constructor.toObject(this,f.util.toJSONOptions)},o.getTypeUrl=function(t){return t===void 0&&(t="type.googleapis.com"),t+"/LicenseError"},o.Error=function(){let r={},t=Object.create(r);return t[r[1]="INVALID_DEVICE_CERTIFICATE"]=1,t[r[2]="REVOKED_DEVICE_CERTIFICATE"]=2,t[r[3]="SERVICE_UNAVAILABLE"]=3,t}(),o})(),E=c.DrmCertificate=(()=>{function o(r){if(this.serviceTypes=[],r)for(var t=Object.keys(r),e=0;e<t.length;++e)r[t[e]]!=null&&(this[t[e]]=r[t[e]])}return o.prototype.type=0,o.prototype.serialNumber=a.newBuffer([]),o.prototype.creationTimeSeconds=0,o.prototype.expirationTimeSeconds=0,o.prototype.publicKey=a.newBuffer([]),o.prototype.systemId=0,o.prototype.testDeviceDeprecated=!1,o.prototype.providerId="",o.prototype.serviceTypes=a.emptyArray,o.prototype.algorithm=1,o.prototype.rotId=a.newBuffer([]),o.prototype.encryptionKey=null,o.create=function(t){return new o(t)},o.encode=function(t,e){if(e||(e=d.create()),t.type!=null&&Object.hasOwnProperty.call(t,"type")&&e.uint32(8).int32(t.type),t.serialNumber!=null&&Object.hasOwnProperty.call(t,"serialNumber")&&e.uint32(18).bytes(t.serialNumber),t.creationTimeSeconds!=null&&Object.hasOwnProperty.call(t,"creationTimeSeconds")&&e.uint32(24).uint32(t.creationTimeSeconds),t.publicKey!=null&&Object.hasOwnProperty.call(t,"publicKey")&&e.uint32(34).bytes(t.publicKey),t.systemId!=null&&Object.hasOwnProperty.call(t,"systemId")&&e.uint32(40).uint32(t.systemId),t.testDeviceDeprecated!=null&&Object.hasOwnProperty.call(t,"testDeviceDeprecated")&&e.uint32(48).bool(t.testDeviceDeprecated),t.providerId!=null&&Object.hasOwnProperty.call(t,"providerId")&&e.uint32(58).string(t.providerId),t.serviceTypes!=null&&t.serviceTypes.length)for(var n=0;n<t.serviceTypes.length;++n)e.uint32(64).int32(t.serviceTypes[n]);return t.algorithm!=null&&Object.hasOwnProperty.call(t,"algorithm")&&e.uint32(72).int32(t.algorithm),t.rotId!=null&&Object.hasOwnProperty.call(t,"rotId")&&e.uint32(82).bytes(t.rotId),t.encryptionKey!=null&&Object.hasOwnProperty.call(t,"encryptionKey")&&c.DrmCertificate.EncryptionKey.encode(t.encryptionKey,e.uint32(90).fork()).ldelim(),t.expirationTimeSeconds!=null&&Object.hasOwnProperty.call(t,"expirationTimeSeconds")&&e.uint32(96).uint32(t.expirationTimeSeconds),e},o.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},o.decode=function(t,e){t instanceof u||(t=u.create(t));for(var n=e===void 0?t.len:t.pos+e,i=new c.DrmCertificate;t.pos<n;){var s=t.uint32();switch(s>>>3){case 1:{i.type=t.int32();break}case 2:{i.serialNumber=t.bytes();break}case 3:{i.creationTimeSeconds=t.uint32();break}case 12:{i.expirationTimeSeconds=t.uint32();break}case 4:{i.publicKey=t.bytes();break}case 5:{i.systemId=t.uint32();break}case 6:{i.testDeviceDeprecated=t.bool();break}case 7:{i.providerId=t.string();break}case 8:{if(i.serviceTypes&&i.serviceTypes.length||(i.serviceTypes=[]),(s&7)===2)for(var l=t.uint32()+t.pos;t.pos<l;)i.serviceTypes.push(t.int32());else i.serviceTypes.push(t.int32());break}case 9:{i.algorithm=t.int32();break}case 10:{i.rotId=t.bytes();break}case 11:{i.encryptionKey=c.DrmCertificate.EncryptionKey.decode(t,t.uint32());break}default:t.skipType(s&7);break}}return i},o.decodeDelimited=function(t){return t instanceof u||(t=new u(t)),this.decode(t,t.uint32())},o.fromObject=function(t){if(t instanceof c.DrmCertificate)return t;var e=new c.DrmCertificate;switch(t.type){default:if(typeof t.type=="number"){e.type=t.type;break}break;case"ROOT":case 0:e.type=0;break;case"DEVICE_MODEL":case 1:e.type=1;break;case"DEVICE":case 2:e.type=2;break;case"SERVICE":case 3:e.type=3;break;case"PROVISIONER":case 4:e.type=4;break}if(t.serialNumber!=null&&(typeof t.serialNumber=="string"?a.base64.decode(t.serialNumber,e.serialNumber=a.newBuffer(a.base64.length(t.serialNumber)),0):t.serialNumber.length>=0&&(e.serialNumber=t.serialNumber)),t.creationTimeSeconds!=null&&(e.creationTimeSeconds=t.creationTimeSeconds>>>0),t.expirationTimeSeconds!=null&&(e.expirationTimeSeconds=t.expirationTimeSeconds>>>0),t.publicKey!=null&&(typeof t.publicKey=="string"?a.base64.decode(t.publicKey,e.publicKey=a.newBuffer(a.base64.length(t.publicKey)),0):t.publicKey.length>=0&&(e.publicKey=t.publicKey)),t.systemId!=null&&(e.systemId=t.systemId>>>0),t.testDeviceDeprecated!=null&&(e.testDeviceDeprecated=!!t.testDeviceDeprecated),t.providerId!=null&&(e.providerId=String(t.providerId)),t.serviceTypes){if(!Array.isArray(t.serviceTypes))throw TypeError(".DrmCertificate.serviceTypes: array expected");e.serviceTypes=[];for(var n=0;n<t.serviceTypes.length;++n)switch(t.serviceTypes[n]){default:if(typeof t.serviceTypes[n]=="number"){e.serviceTypes[n]=t.serviceTypes[n];break}case"UNKNOWN_SERVICE_TYPE":case 0:e.serviceTypes[n]=0;break;case"LICENSE_SERVER_SDK":case 1:e.serviceTypes[n]=1;break;case"LICENSE_SERVER_PROXY_SDK":case 2:e.serviceTypes[n]=2;break;case"PROVISIONING_SDK":case 3:e.serviceTypes[n]=3;break;case"CAS_PROXY_SDK":case 4:e.serviceTypes[n]=4;break}}switch(t.algorithm){case"UNKNOWN_ALGORITHM":case 0:e.algorithm=0;break;default:if(typeof t.algorithm=="number"){e.algorithm=t.algorithm;break}break;case"RSA":case 1:e.algorithm=1;break;case"ECC_SECP256R1":case 2:e.algorithm=2;break;case"ECC_SECP384R1":case 3:e.algorithm=3;break;case"ECC_SECP521R1":case 4:e.algorithm=4;break}if(t.rotId!=null&&(typeof t.rotId=="string"?a.base64.decode(t.rotId,e.rotId=a.newBuffer(a.base64.length(t.rotId)),0):t.rotId.length>=0&&(e.rotId=t.rotId)),t.encryptionKey!=null){if(typeof t.encryptionKey!="object")throw TypeError(".DrmCertificate.encryptionKey: object expected");e.encryptionKey=c.DrmCertificate.EncryptionKey.fromObject(t.encryptionKey)}return e},o.toObject=function(t,e){e||(e={});var n={};if((e.arrays||e.defaults)&&(n.serviceTypes=[]),e.defaults&&(n.type=e.enums===String?"ROOT":0,e.bytes===String?n.serialNumber="":(n.serialNumber=[],e.bytes!==Array&&(n.serialNumber=a.newBuffer(n.serialNumber))),n.creationTimeSeconds=0,e.bytes===String?n.publicKey="":(n.publicKey=[],e.bytes!==Array&&(n.publicKey=a.newBuffer(n.publicKey))),n.systemId=0,n.testDeviceDeprecated=!1,n.providerId="",n.algorithm=e.enums===String?"RSA":1,e.bytes===String?n.rotId="":(n.rotId=[],e.bytes!==Array&&(n.rotId=a.newBuffer(n.rotId))),n.encryptionKey=null,n.expirationTimeSeconds=0),t.type!=null&&t.hasOwnProperty("type")&&(n.type=e.enums===String?c.DrmCertificate.Type[t.type]===void 0?t.type:c.DrmCertificate.Type[t.type]:t.type),t.serialNumber!=null&&t.hasOwnProperty("serialNumber")&&(n.serialNumber=e.bytes===String?a.base64.encode(t.serialNumber,0,t.serialNumber.length):e.bytes===Array?Array.prototype.slice.call(t.serialNumber):t.serialNumber),t.creationTimeSeconds!=null&&t.hasOwnProperty("creationTimeSeconds")&&(n.creationTimeSeconds=t.creationTimeSeconds),t.publicKey!=null&&t.hasOwnProperty("publicKey")&&(n.publicKey=e.bytes===String?a.base64.encode(t.publicKey,0,t.publicKey.length):e.bytes===Array?Array.prototype.slice.call(t.publicKey):t.publicKey),t.systemId!=null&&t.hasOwnProperty("systemId")&&(n.systemId=t.systemId),t.testDeviceDeprecated!=null&&t.hasOwnProperty("testDeviceDeprecated")&&(n.testDeviceDeprecated=t.testDeviceDeprecated),t.providerId!=null&&t.hasOwnProperty("providerId")&&(n.providerId=t.providerId),t.serviceTypes&&t.serviceTypes.length){n.serviceTypes=[];for(var i=0;i<t.serviceTypes.length;++i)n.serviceTypes[i]=e.enums===String?c.DrmCertificate.ServiceType[t.serviceTypes[i]]===void 0?t.serviceTypes[i]:c.DrmCertificate.ServiceType[t.serviceTypes[i]]:t.serviceTypes[i]}return t.algorithm!=null&&t.hasOwnProperty("algorithm")&&(n.algorithm=e.enums===String?c.DrmCertificate.Algorithm[t.algorithm]===void 0?t.algorithm:c.DrmCertificate.Algorithm[t.algorithm]:t.algorithm),t.rotId!=null&&t.hasOwnProperty("rotId")&&(n.rotId=e.bytes===String?a.base64.encode(t.rotId,0,t.rotId.length):e.bytes===Array?Array.prototype.slice.call(t.rotId):t.rotId),t.encryptionKey!=null&&t.hasOwnProperty("encryptionKey")&&(n.encryptionKey=c.DrmCertificate.EncryptionKey.toObject(t.encryptionKey,e)),t.expirationTimeSeconds!=null&&t.hasOwnProperty("expirationTimeSeconds")&&(n.expirationTimeSeconds=t.expirationTimeSeconds),n},o.prototype.toJSON=function(){return this.constructor.toObject(this,f.util.toJSONOptions)},o.getTypeUrl=function(t){return t===void 0&&(t="type.googleapis.com"),t+"/DrmCertificate"},o.Type=function(){let r={},t=Object.create(r);return t[r[0]="ROOT"]=0,t[r[1]="DEVICE_MODEL"]=1,t[r[2]="DEVICE"]=2,t[r[3]="SERVICE"]=3,t[r[4]="PROVISIONER"]=4,t}(),o.ServiceType=function(){let r={},t=Object.create(r);return t[r[0]="UNKNOWN_SERVICE_TYPE"]=0,t[r[1]="LICENSE_SERVER_SDK"]=1,t[r[2]="LICENSE_SERVER_PROXY_SDK"]=2,t[r[3]="PROVISIONING_SDK"]=3,t[r[4]="CAS_PROXY_SDK"]=4,t}(),o.Algorithm=function(){let r={},t=Object.create(r);return t[r[0]="UNKNOWN_ALGORITHM"]=0,t[r[1]="RSA"]=1,t[r[2]="ECC_SECP256R1"]=2,t[r[3]="ECC_SECP384R1"]=3,t[r[4]="ECC_SECP521R1"]=4,t}(),o.EncryptionKey=function(){function r(t){if(t)for(var e=Object.keys(t),n=0;n<e.length;++n)t[e[n]]!=null&&(this[e[n]]=t[e[n]])}return r.prototype.publicKey=a.newBuffer([]),r.prototype.algorithm=1,r.create=function(e){return new r(e)},r.encode=function(e,n){return n||(n=d.create()),e.publicKey!=null&&Object.hasOwnProperty.call(e,"publicKey")&&n.uint32(10).bytes(e.publicKey),e.algorithm!=null&&Object.hasOwnProperty.call(e,"algorithm")&&n.uint32(16).int32(e.algorithm),n},r.encodeDelimited=function(e,n){return this.encode(e,n).ldelim()},r.decode=function(e,n){e instanceof u||(e=u.create(e));for(var i=n===void 0?e.len:e.pos+n,s=new c.DrmCertificate.EncryptionKey;e.pos<i;){var l=e.uint32();switch(l>>>3){case 1:{s.publicKey=e.bytes();break}case 2:{s.algorithm=e.int32();break}default:e.skipType(l&7);break}}return s},r.decodeDelimited=function(e){return e instanceof u||(e=new u(e)),this.decode(e,e.uint32())},r.fromObject=function(e){if(e instanceof c.DrmCertificate.EncryptionKey)return e;var n=new c.DrmCertificate.EncryptionKey;switch(e.publicKey!=null&&(typeof e.publicKey=="string"?a.base64.decode(e.publicKey,n.publicKey=a.newBuffer(a.base64.length(e.publicKey)),0):e.publicKey.length>=0&&(n.publicKey=e.publicKey)),e.algorithm){case"UNKNOWN_ALGORITHM":case 0:n.algorithm=0;break;default:if(typeof e.algorithm=="number"){n.algorithm=e.algorithm;break}break;case"RSA":case 1:n.algorithm=1;break;case"ECC_SECP256R1":case 2:n.algorithm=2;break;case"ECC_SECP384R1":case 3:n.algorithm=3;break;case"ECC_SECP521R1":case 4:n.algorithm=4;break}return n},r.toObject=function(e,n){n||(n={});var i={};return n.defaults&&(n.bytes===String?i.publicKey="":(i.publicKey=[],n.bytes!==Array&&(i.publicKey=a.newBuffer(i.publicKey))),i.algorithm=n.enums===String?"RSA":1),e.publicKey!=null&&e.hasOwnProperty("publicKey")&&(i.publicKey=n.bytes===String?a.base64.encode(e.publicKey,0,e.publicKey.length):n.bytes===Array?Array.prototype.slice.call(e.publicKey):e.publicKey),e.algorithm!=null&&e.hasOwnProperty("algorithm")&&(i.algorithm=n.enums===String?c.DrmCertificate.Algorithm[e.algorithm]===void 0?e.algorithm:c.DrmCertificate.Algorithm[e.algorithm]:e.algorithm),i},r.prototype.toJSON=function(){return this.constructor.toObject(this,f.util.toJSONOptions)},r.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/DrmCertificate.EncryptionKey"},r}(),o})(),A=c.SignedDrmCertificate=(()=>{function o(r){if(r)for(var t=Object.keys(r),e=0;e<t.length;++e)r[t[e]]!=null&&(this[t[e]]=r[t[e]])}return o.prototype.drmCertificate=a.newBuffer([]),o.prototype.signature=a.newBuffer([]),o.prototype.signer=null,o.prototype.hashAlgorithm=0,o.create=function(t){return new o(t)},o.encode=function(t,e){return e||(e=d.create()),t.drmCertificate!=null&&Object.hasOwnProperty.call(t,"drmCertificate")&&e.uint32(10).bytes(t.drmCertificate),t.signature!=null&&Object.hasOwnProperty.call(t,"signature")&&e.uint32(18).bytes(t.signature),t.signer!=null&&Object.hasOwnProperty.call(t,"signer")&&c.SignedDrmCertificate.encode(t.signer,e.uint32(26).fork()).ldelim(),t.hashAlgorithm!=null&&Object.hasOwnProperty.call(t,"hashAlgorithm")&&e.uint32(32).int32(t.hashAlgorithm),e},o.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},o.decode=function(t,e){t instanceof u||(t=u.create(t));for(var n=e===void 0?t.len:t.pos+e,i=new c.SignedDrmCertificate;t.pos<n;){var s=t.uint32();switch(s>>>3){case 1:{i.drmCertificate=t.bytes();break}case 2:{i.signature=t.bytes();break}case 3:{i.signer=c.SignedDrmCertificate.decode(t,t.uint32());break}case 4:{i.hashAlgorithm=t.int32();break}default:t.skipType(s&7);break}}return i},o.decodeDelimited=function(t){return t instanceof u||(t=new u(t)),this.decode(t,t.uint32())},o.fromObject=function(t){if(t instanceof c.SignedDrmCertificate)return t;var e=new c.SignedDrmCertificate;if(t.drmCertificate!=null&&(typeof t.drmCertificate=="string"?a.base64.decode(t.drmCertificate,e.drmCertificate=a.newBuffer(a.base64.length(t.drmCertificate)),0):t.drmCertificate.length>=0&&(e.drmCertificate=t.drmCertificate)),t.signature!=null&&(typeof t.signature=="string"?a.base64.decode(t.signature,e.signature=a.newBuffer(a.base64.length(t.signature)),0):t.signature.length>=0&&(e.signature=t.signature)),t.signer!=null){if(typeof t.signer!="object")throw TypeError(".SignedDrmCertificate.signer: object expected");e.signer=c.SignedDrmCertificate.fromObject(t.signer)}switch(t.hashAlgorithm){default:if(typeof t.hashAlgorithm=="number"){e.hashAlgorithm=t.hashAlgorithm;break}break;case"HASH_ALGORITHM_UNSPECIFIED":case 0:e.hashAlgorithm=0;break;case"HASH_ALGORITHM_SHA_1":case 1:e.hashAlgorithm=1;break;case"HASH_ALGORITHM_SHA_256":case 2:e.hashAlgorithm=2;break;case"HASH_ALGORITHM_SHA_384":case 3:e.hashAlgorithm=3;break}return e},o.toObject=function(t,e){e||(e={});var n={};return e.defaults&&(e.bytes===String?n.drmCertificate="":(n.drmCertificate=[],e.bytes!==Array&&(n.drmCertificate=a.newBuffer(n.drmCertificate))),e.bytes===String?n.signature="":(n.signature=[],e.bytes!==Array&&(n.signature=a.newBuffer(n.signature))),n.signer=null,n.hashAlgorithm=e.enums===String?"HASH_ALGORITHM_UNSPECIFIED":0),t.drmCertificate!=null&&t.hasOwnProperty("drmCertificate")&&(n.drmCertificate=e.bytes===String?a.base64.encode(t.drmCertificate,0,t.drmCertificate.length):e.bytes===Array?Array.prototype.slice.call(t.drmCertificate):t.drmCertificate),t.signature!=null&&t.hasOwnProperty("signature")&&(n.signature=e.bytes===String?a.base64.encode(t.signature,0,t.signature.length):e.bytes===Array?Array.prototype.slice.call(t.signature):t.signature),t.signer!=null&&t.hasOwnProperty("signer")&&(n.signer=c.SignedDrmCertificate.toObject(t.signer,e)),t.hashAlgorithm!=null&&t.hasOwnProperty("hashAlgorithm")&&(n.hashAlgorithm=e.enums===String?c.HashAlgorithmProto[t.hashAlgorithm]===void 0?t.hashAlgorithm:c.HashAlgorithmProto[t.hashAlgorithm]:t.hashAlgorithm),n},o.prototype.toJSON=function(){return this.constructor.toObject(this,f.util.toJSONOptions)},o.getTypeUrl=function(t){return t===void 0&&(t="type.googleapis.com"),t+"/SignedDrmCertificate"},o})(),z=c.WidevinePsshData=(()=>{function o(r){if(this.keyIds=[],this.groupIds=[],this.entitledKeys=[],r)for(var t=Object.keys(r),e=0;e<t.length;++e)r[t[e]]!=null&&(this[t[e]]=r[t[e]])}return o.prototype.keyIds=a.emptyArray,o.prototype.contentId=a.newBuffer([]),o.prototype.cryptoPeriodIndex=0,o.prototype.protectionScheme=0,o.prototype.cryptoPeriodSeconds=0,o.prototype.type=0,o.prototype.keySequence=0,o.prototype.groupIds=a.emptyArray,o.prototype.entitledKeys=a.emptyArray,o.prototype.videoFeature="",o.prototype.algorithm=0,o.prototype.provider="",o.prototype.trackType="",o.prototype.policy="",o.prototype.groupedLicense=a.newBuffer([]),o.create=function(t){return new o(t)},o.encode=function(t,e){if(e||(e=d.create()),t.algorithm!=null&&Object.hasOwnProperty.call(t,"algorithm")&&e.uint32(8).int32(t.algorithm),t.keyIds!=null&&t.keyIds.length)for(var n=0;n<t.keyIds.length;++n)e.uint32(18).bytes(t.keyIds[n]);if(t.provider!=null&&Object.hasOwnProperty.call(t,"provider")&&e.uint32(26).string(t.provider),t.contentId!=null&&Object.hasOwnProperty.call(t,"contentId")&&e.uint32(34).bytes(t.contentId),t.trackType!=null&&Object.hasOwnProperty.call(t,"trackType")&&e.uint32(42).string(t.trackType),t.policy!=null&&Object.hasOwnProperty.call(t,"policy")&&e.uint32(50).string(t.policy),t.cryptoPeriodIndex!=null&&Object.hasOwnProperty.call(t,"cryptoPeriodIndex")&&e.uint32(56).uint32(t.cryptoPeriodIndex),t.groupedLicense!=null&&Object.hasOwnProperty.call(t,"groupedLicense")&&e.uint32(66).bytes(t.groupedLicense),t.protectionScheme!=null&&Object.hasOwnProperty.call(t,"protectionScheme")&&e.uint32(72).uint32(t.protectionScheme),t.cryptoPeriodSeconds!=null&&Object.hasOwnProperty.call(t,"cryptoPeriodSeconds")&&e.uint32(80).uint32(t.cryptoPeriodSeconds),t.type!=null&&Object.hasOwnProperty.call(t,"type")&&e.uint32(88).int32(t.type),t.keySequence!=null&&Object.hasOwnProperty.call(t,"keySequence")&&e.uint32(96).uint32(t.keySequence),t.groupIds!=null&&t.groupIds.length)for(var n=0;n<t.groupIds.length;++n)e.uint32(106).bytes(t.groupIds[n]);if(t.entitledKeys!=null&&t.entitledKeys.length)for(var n=0;n<t.entitledKeys.length;++n)c.WidevinePsshData.EntitledKey.encode(t.entitledKeys[n],e.uint32(114).fork()).ldelim();return t.videoFeature!=null&&Object.hasOwnProperty.call(t,"videoFeature")&&e.uint32(122).string(t.videoFeature),e},o.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},o.decode=function(t,e){t instanceof u||(t=u.create(t));for(var n=e===void 0?t.len:t.pos+e,i=new c.WidevinePsshData;t.pos<n;){var s=t.uint32();switch(s>>>3){case 2:{i.keyIds&&i.keyIds.length||(i.keyIds=[]),i.keyIds.push(t.bytes());break}case 4:{i.contentId=t.bytes();break}case 7:{i.cryptoPeriodIndex=t.uint32();break}case 9:{i.protectionScheme=t.uint32();break}case 10:{i.cryptoPeriodSeconds=t.uint32();break}case 11:{i.type=t.int32();break}case 12:{i.keySequence=t.uint32();break}case 13:{i.groupIds&&i.groupIds.length||(i.groupIds=[]),i.groupIds.push(t.bytes());break}case 14:{i.entitledKeys&&i.entitledKeys.length||(i.entitledKeys=[]),i.entitledKeys.push(c.WidevinePsshData.EntitledKey.decode(t,t.uint32()));break}case 15:{i.videoFeature=t.string();break}case 1:{i.algorithm=t.int32();break}case 3:{i.provider=t.string();break}case 5:{i.trackType=t.string();break}case 6:{i.policy=t.string();break}case 8:{i.groupedLicense=t.bytes();break}default:t.skipType(s&7);break}}return i},o.decodeDelimited=function(t){return t instanceof u||(t=new u(t)),this.decode(t,t.uint32())},o.fromObject=function(t){if(t instanceof c.WidevinePsshData)return t;var e=new c.WidevinePsshData;if(t.keyIds){if(!Array.isArray(t.keyIds))throw TypeError(".WidevinePsshData.keyIds: array expected");e.keyIds=[];for(var n=0;n<t.keyIds.length;++n)typeof t.keyIds[n]=="string"?a.base64.decode(t.keyIds[n],e.keyIds[n]=a.newBuffer(a.base64.length(t.keyIds[n])),0):t.keyIds[n].length>=0&&(e.keyIds[n]=t.keyIds[n])}switch(t.contentId!=null&&(typeof t.contentId=="string"?a.base64.decode(t.contentId,e.contentId=a.newBuffer(a.base64.length(t.contentId)),0):t.contentId.length>=0&&(e.contentId=t.contentId)),t.cryptoPeriodIndex!=null&&(e.cryptoPeriodIndex=t.cryptoPeriodIndex>>>0),t.protectionScheme!=null&&(e.protectionScheme=t.protectionScheme>>>0),t.cryptoPeriodSeconds!=null&&(e.cryptoPeriodSeconds=t.cryptoPeriodSeconds>>>0),t.type){default:if(typeof t.type=="number"){e.type=t.type;break}break;case"SINGLE":case 0:e.type=0;break;case"ENTITLEMENT":case 1:e.type=1;break;case"ENTITLED_KEY":case 2:e.type=2;break}if(t.keySequence!=null&&(e.keySequence=t.keySequence>>>0),t.groupIds){if(!Array.isArray(t.groupIds))throw TypeError(".WidevinePsshData.groupIds: array expected");e.groupIds=[];for(var n=0;n<t.groupIds.length;++n)typeof t.groupIds[n]=="string"?a.base64.decode(t.groupIds[n],e.groupIds[n]=a.newBuffer(a.base64.length(t.groupIds[n])),0):t.groupIds[n].length>=0&&(e.groupIds[n]=t.groupIds[n])}if(t.entitledKeys){if(!Array.isArray(t.entitledKeys))throw TypeError(".WidevinePsshData.entitledKeys: array expected");e.entitledKeys=[];for(var n=0;n<t.entitledKeys.length;++n){if(typeof t.entitledKeys[n]!="object")throw TypeError(".WidevinePsshData.entitledKeys: object expected");e.entitledKeys[n]=c.WidevinePsshData.EntitledKey.fromObject(t.entitledKeys[n])}}switch(t.videoFeature!=null&&(e.videoFeature=String(t.videoFeature)),t.algorithm){default:if(typeof t.algorithm=="number"){e.algorithm=t.algorithm;break}break;case"UNENCRYPTED":case 0:e.algorithm=0;break;case"AESCTR":case 1:e.algorithm=1;break}return t.provider!=null&&(e.provider=String(t.provider)),t.trackType!=null&&(e.trackType=String(t.trackType)),t.policy!=null&&(e.policy=String(t.policy)),t.groupedLicense!=null&&(typeof t.groupedLicense=="string"?a.base64.decode(t.groupedLicense,e.groupedLicense=a.newBuffer(a.base64.length(t.groupedLicense)),0):t.groupedLicense.length>=0&&(e.groupedLicense=t.groupedLicense)),e},o.toObject=function(t,e){e||(e={});var n={};if((e.arrays||e.defaults)&&(n.keyIds=[],n.groupIds=[],n.entitledKeys=[]),e.defaults&&(n.algorithm=e.enums===String?"UNENCRYPTED":0,n.provider="",e.bytes===String?n.contentId="":(n.contentId=[],e.bytes!==Array&&(n.contentId=a.newBuffer(n.contentId))),n.trackType="",n.policy="",n.cryptoPeriodIndex=0,e.bytes===String?n.groupedLicense="":(n.groupedLicense=[],e.bytes!==Array&&(n.groupedLicense=a.newBuffer(n.groupedLicense))),n.protectionScheme=0,n.cryptoPeriodSeconds=0,n.type=e.enums===String?"SINGLE":0,n.keySequence=0,n.videoFeature=""),t.algorithm!=null&&t.hasOwnProperty("algorithm")&&(n.algorithm=e.enums===String?c.WidevinePsshData.Algorithm[t.algorithm]===void 0?t.algorithm:c.WidevinePsshData.Algorithm[t.algorithm]:t.algorithm),t.keyIds&&t.keyIds.length){n.keyIds=[];for(var i=0;i<t.keyIds.length;++i)n.keyIds[i]=e.bytes===String?a.base64.encode(t.keyIds[i],0,t.keyIds[i].length):e.bytes===Array?Array.prototype.slice.call(t.keyIds[i]):t.keyIds[i]}if(t.provider!=null&&t.hasOwnProperty("provider")&&(n.provider=t.provider),t.contentId!=null&&t.hasOwnProperty("contentId")&&(n.contentId=e.bytes===String?a.base64.encode(t.contentId,0,t.contentId.length):e.bytes===Array?Array.prototype.slice.call(t.contentId):t.contentId),t.trackType!=null&&t.hasOwnProperty("trackType")&&(n.trackType=t.trackType),t.policy!=null&&t.hasOwnProperty("policy")&&(n.policy=t.policy),t.cryptoPeriodIndex!=null&&t.hasOwnProperty("cryptoPeriodIndex")&&(n.cryptoPeriodIndex=t.cryptoPeriodIndex),t.groupedLicense!=null&&t.hasOwnProperty("groupedLicense")&&(n.groupedLicense=e.bytes===String?a.base64.encode(t.groupedLicense,0,t.groupedLicense.length):e.bytes===Array?Array.prototype.slice.call(t.groupedLicense):t.groupedLicense),t.protectionScheme!=null&&t.hasOwnProperty("protectionScheme")&&(n.protectionScheme=t.protectionScheme),t.cryptoPeriodSeconds!=null&&t.hasOwnProperty("cryptoPeriodSeconds")&&(n.cryptoPeriodSeconds=t.cryptoPeriodSeconds),t.type!=null&&t.hasOwnProperty("type")&&(n.type=e.enums===String?c.WidevinePsshData.Type[t.type]===void 0?t.type:c.WidevinePsshData.Type[t.type]:t.type),t.keySequence!=null&&t.hasOwnProperty("keySequence")&&(n.keySequence=t.keySequence),t.groupIds&&t.groupIds.length){n.groupIds=[];for(var i=0;i<t.groupIds.length;++i)n.groupIds[i]=e.bytes===String?a.base64.encode(t.groupIds[i],0,t.groupIds[i].length):e.bytes===Array?Array.prototype.slice.call(t.groupIds[i]):t.groupIds[i]}if(t.entitledKeys&&t.entitledKeys.length){n.entitledKeys=[];for(var i=0;i<t.entitledKeys.length;++i)n.entitledKeys[i]=c.WidevinePsshData.EntitledKey.toObject(t.entitledKeys[i],e)}return t.videoFeature!=null&&t.hasOwnProperty("videoFeature")&&(n.videoFeature=t.videoFeature),n},o.prototype.toJSON=function(){return this.constructor.toObject(this,f.util.toJSONOptions)},o.getTypeUrl=function(t){return t===void 0&&(t="type.googleapis.com"),t+"/WidevinePsshData"},o.Type=function(){let r={},t=Object.create(r);return t[r[0]="SINGLE"]=0,t[r[1]="ENTITLEMENT"]=1,t[r[2]="ENTITLED_KEY"]=2,t}(),o.EntitledKey=function(){function r(t){if(t)for(var e=Object.keys(t),n=0;n<e.length;++n)t[e[n]]!=null&&(this[e[n]]=t[e[n]])}return r.prototype.entitlementKeyId=a.newBuffer([]),r.prototype.keyId=a.newBuffer([]),r.prototype.key=a.newBuffer([]),r.prototype.iv=a.newBuffer([]),r.prototype.entitlementKeySizeBytes=32,r.create=function(e){return new r(e)},r.encode=function(e,n){return n||(n=d.create()),e.entitlementKeyId!=null&&Object.hasOwnProperty.call(e,"entitlementKeyId")&&n.uint32(10).bytes(e.entitlementKeyId),e.keyId!=null&&Object.hasOwnProperty.call(e,"keyId")&&n.uint32(18).bytes(e.keyId),e.key!=null&&Object.hasOwnProperty.call(e,"key")&&n.uint32(26).bytes(e.key),e.iv!=null&&Object.hasOwnProperty.call(e,"iv")&&n.uint32(34).bytes(e.iv),e.entitlementKeySizeBytes!=null&&Object.hasOwnProperty.call(e,"entitlementKeySizeBytes")&&n.uint32(40).uint32(e.entitlementKeySizeBytes),n},r.encodeDelimited=function(e,n){return this.encode(e,n).ldelim()},r.decode=function(e,n){e instanceof u||(e=u.create(e));for(var i=n===void 0?e.len:e.pos+n,s=new c.WidevinePsshData.EntitledKey;e.pos<i;){var l=e.uint32();switch(l>>>3){case 1:{s.entitlementKeyId=e.bytes();break}case 2:{s.keyId=e.bytes();break}case 3:{s.key=e.bytes();break}case 4:{s.iv=e.bytes();break}case 5:{s.entitlementKeySizeBytes=e.uint32();break}default:e.skipType(l&7);break}}return s},r.decodeDelimited=function(e){return e instanceof u||(e=new u(e)),this.decode(e,e.uint32())},r.fromObject=function(e){if(e instanceof c.WidevinePsshData.EntitledKey)return e;var n=new c.WidevinePsshData.EntitledKey;return e.entitlementKeyId!=null&&(typeof e.entitlementKeyId=="string"?a.base64.decode(e.entitlementKeyId,n.entitlementKeyId=a.newBuffer(a.base64.length(e.entitlementKeyId)),0):e.entitlementKeyId.length>=0&&(n.entitlementKeyId=e.entitlementKeyId)),e.keyId!=null&&(typeof e.keyId=="string"?a.base64.decode(e.keyId,n.keyId=a.newBuffer(a.base64.length(e.keyId)),0):e.keyId.length>=0&&(n.keyId=e.keyId)),e.key!=null&&(typeof e.key=="string"?a.base64.decode(e.key,n.key=a.newBuffer(a.base64.length(e.key)),0):e.key.length>=0&&(n.key=e.key)),e.iv!=null&&(typeof e.iv=="string"?a.base64.decode(e.iv,n.iv=a.newBuffer(a.base64.length(e.iv)),0):e.iv.length>=0&&(n.iv=e.iv)),e.entitlementKeySizeBytes!=null&&(n.entitlementKeySizeBytes=e.entitlementKeySizeBytes>>>0),n},r.toObject=function(e,n){n||(n={});var i={};return n.defaults&&(n.bytes===String?i.entitlementKeyId="":(i.entitlementKeyId=[],n.bytes!==Array&&(i.entitlementKeyId=a.newBuffer(i.entitlementKeyId))),n.bytes===String?i.keyId="":(i.keyId=[],n.bytes!==Array&&(i.keyId=a.newBuffer(i.keyId))),n.bytes===String?i.key="":(i.key=[],n.bytes!==Array&&(i.key=a.newBuffer(i.key))),n.bytes===String?i.iv="":(i.iv=[],n.bytes!==Array&&(i.iv=a.newBuffer(i.iv))),i.entitlementKeySizeBytes=32),e.entitlementKeyId!=null&&e.hasOwnProperty("entitlementKeyId")&&(i.entitlementKeyId=n.bytes===String?a.base64.encode(e.entitlementKeyId,0,e.entitlementKeyId.length):n.bytes===Array?Array.prototype.slice.call(e.entitlementKeyId):e.entitlementKeyId),e.keyId!=null&&e.hasOwnProperty("keyId")&&(i.keyId=n.bytes===String?a.base64.encode(e.keyId,0,e.keyId.length):n.bytes===Array?Array.prototype.slice.call(e.keyId):e.keyId),e.key!=null&&e.hasOwnProperty("key")&&(i.key=n.bytes===String?a.base64.encode(e.key,0,e.key.length):n.bytes===Array?Array.prototype.slice.call(e.key):e.key),e.iv!=null&&e.hasOwnProperty("iv")&&(i.iv=n.bytes===String?a.base64.encode(e.iv,0,e.iv.length):n.bytes===Array?Array.prototype.slice.call(e.iv):e.iv),e.entitlementKeySizeBytes!=null&&e.hasOwnProperty("entitlementKeySizeBytes")&&(i.entitlementKeySizeBytes=e.entitlementKeySizeBytes),i},r.prototype.toJSON=function(){return this.constructor.toObject(this,f.util.toJSONOptions)},r.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/WidevinePsshData.EntitledKey"},r}(),o.Algorithm=function(){let r={},t=Object.create(r);return t[r[0]="UNENCRYPTED"]=0,t[r[1]="AESCTR"]=1,t}(),o})(),$=c.FileHashes=(()=>{function o(r){if(this.signatures=[],r)for(var t=Object.keys(r),e=0;e<t.length;++e)r[t[e]]!=null&&(this[t[e]]=r[t[e]])}return o.prototype.signer=a.newBuffer([]),o.prototype.signatures=a.emptyArray,o.create=function(t){return new o(t)},o.encode=function(t,e){if(e||(e=d.create()),t.signer!=null&&Object.hasOwnProperty.call(t,"signer")&&e.uint32(10).bytes(t.signer),t.signatures!=null&&t.signatures.length)for(var n=0;n<t.signatures.length;++n)c.FileHashes.Signature.encode(t.signatures[n],e.uint32(18).fork()).ldelim();return e},o.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},o.decode=function(t,e){t instanceof u||(t=u.create(t));for(var n=e===void 0?t.len:t.pos+e,i=new c.FileHashes;t.pos<n;){var s=t.uint32();switch(s>>>3){case 1:{i.signer=t.bytes();break}case 2:{i.signatures&&i.signatures.length||(i.signatures=[]),i.signatures.push(c.FileHashes.Signature.decode(t,t.uint32()));break}default:t.skipType(s&7);break}}return i},o.decodeDelimited=function(t){return t instanceof u||(t=new u(t)),this.decode(t,t.uint32())},o.fromObject=function(t){if(t instanceof c.FileHashes)return t;var e=new c.FileHashes;if(t.signer!=null&&(typeof t.signer=="string"?a.base64.decode(t.signer,e.signer=a.newBuffer(a.base64.length(t.signer)),0):t.signer.length>=0&&(e.signer=t.signer)),t.signatures){if(!Array.isArray(t.signatures))throw TypeError(".FileHashes.signatures: array expected");e.signatures=[];for(var n=0;n<t.signatures.length;++n){if(typeof t.signatures[n]!="object")throw TypeError(".FileHashes.signatures: object expected");e.signatures[n]=c.FileHashes.Signature.fromObject(t.signatures[n])}}return e},o.toObject=function(t,e){e||(e={});var n={};if((e.arrays||e.defaults)&&(n.signatures=[]),e.defaults&&(e.bytes===String?n.signer="":(n.signer=[],e.bytes!==Array&&(n.signer=a.newBuffer(n.signer)))),t.signer!=null&&t.hasOwnProperty("signer")&&(n.signer=e.bytes===String?a.base64.encode(t.signer,0,t.signer.length):e.bytes===Array?Array.prototype.slice.call(t.signer):t.signer),t.signatures&&t.signatures.length){n.signatures=[];for(var i=0;i<t.signatures.length;++i)n.signatures[i]=c.FileHashes.Signature.toObject(t.signatures[i],e)}return n},o.prototype.toJSON=function(){return this.constructor.toObject(this,f.util.toJSONOptions)},o.getTypeUrl=function(t){return t===void 0&&(t="type.googleapis.com"),t+"/FileHashes"},o.Signature=function(){function r(t){if(t)for(var e=Object.keys(t),n=0;n<e.length;++n)t[e[n]]!=null&&(this[e[n]]=t[e[n]])}return r.prototype.filename="",r.prototype.testSigning=!1,r.prototype.SHA512Hash=a.newBuffer([]),r.prototype.mainExe=!1,r.prototype.signature=a.newBuffer([]),r.create=function(e){return new r(e)},r.encode=function(e,n){return n||(n=d.create()),e.filename!=null&&Object.hasOwnProperty.call(e,"filename")&&n.uint32(10).string(e.filename),e.testSigning!=null&&Object.hasOwnProperty.call(e,"testSigning")&&n.uint32(16).bool(e.testSigning),e.SHA512Hash!=null&&Object.hasOwnProperty.call(e,"SHA512Hash")&&n.uint32(26).bytes(e.SHA512Hash),e.mainExe!=null&&Object.hasOwnProperty.call(e,"mainExe")&&n.uint32(32).bool(e.mainExe),e.signature!=null&&Object.hasOwnProperty.call(e,"signature")&&n.uint32(42).bytes(e.signature),n},r.encodeDelimited=function(e,n){return this.encode(e,n).ldelim()},r.decode=function(e,n){e instanceof u||(e=u.create(e));for(var i=n===void 0?e.len:e.pos+n,s=new c.FileHashes.Signature;e.pos<i;){var l=e.uint32();switch(l>>>3){case 1:{s.filename=e.string();break}case 2:{s.testSigning=e.bool();break}case 3:{s.SHA512Hash=e.bytes();break}case 4:{s.mainExe=e.bool();break}case 5:{s.signature=e.bytes();break}default:e.skipType(l&7);break}}return s},r.decodeDelimited=function(e){return e instanceof u||(e=new u(e)),this.decode(e,e.uint32())},r.fromObject=function(e){if(e instanceof c.FileHashes.Signature)return e;var n=new c.FileHashes.Signature;return e.filename!=null&&(n.filename=String(e.filename)),e.testSigning!=null&&(n.testSigning=!!e.testSigning),e.SHA512Hash!=null&&(typeof e.SHA512Hash=="string"?a.base64.decode(e.SHA512Hash,n.SHA512Hash=a.newBuffer(a.base64.length(e.SHA512Hash)),0):e.SHA512Hash.length>=0&&(n.SHA512Hash=e.SHA512Hash)),e.mainExe!=null&&(n.mainExe=!!e.mainExe),e.signature!=null&&(typeof e.signature=="string"?a.base64.decode(e.signature,n.signature=a.newBuffer(a.base64.length(e.signature)),0):e.signature.length>=0&&(n.signature=e.signature)),n},r.toObject=function(e,n){n||(n={});var i={};return n.defaults&&(i.filename="",i.testSigning=!1,n.bytes===String?i.SHA512Hash="":(i.SHA512Hash=[],n.bytes!==Array&&(i.SHA512Hash=a.newBuffer(i.SHA512Hash))),i.mainExe=!1,n.bytes===String?i.signature="":(i.signature=[],n.bytes!==Array&&(i.signature=a.newBuffer(i.signature)))),e.filename!=null&&e.hasOwnProperty("filename")&&(i.filename=e.filename),e.testSigning!=null&&e.hasOwnProperty("testSigning")&&(i.testSigning=e.testSigning),e.SHA512Hash!=null&&e.hasOwnProperty("SHA512Hash")&&(i.SHA512Hash=n.bytes===String?a.base64.encode(e.SHA512Hash,0,e.SHA512Hash.length):n.bytes===Array?Array.prototype.slice.call(e.SHA512Hash):e.SHA512Hash),e.mainExe!=null&&e.hasOwnProperty("mainExe")&&(i.mainExe=e.mainExe),e.signature!=null&&e.hasOwnProperty("signature")&&(i.signature=n.bytes===String?a.base64.encode(e.signature,0,e.signature.length):n.bytes===Array?Array.prototype.slice.call(e.signature):e.signature),i},r.prototype.toJSON=function(){return this.constructor.toObject(this,f.util.toJSONOptions)},r.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/FileHashes.Signature"},r}(),o})(),Lt=c.RemoteAttestation=(()=>{function o(r){if(r)for(var t=Object.keys(r),e=0;e<t.length;++e)r[t[e]]!=null&&(this[t[e]]=r[t[e]])}return o.prototype.certificate=null,o.prototype.salt=a.newBuffer([]),o.prototype.signature=a.newBuffer([]),o.create=function(t){return new o(t)},o.encode=function(t,e){return e||(e=d.create()),t.certificate!=null&&Object.hasOwnProperty.call(t,"certificate")&&c.EncryptedClientIdentification.encode(t.certificate,e.uint32(10).fork()).ldelim(),t.salt!=null&&Object.hasOwnProperty.call(t,"salt")&&e.uint32(18).bytes(t.salt),t.signature!=null&&Object.hasOwnProperty.call(t,"signature")&&e.uint32(26).bytes(t.signature),e},o.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},o.decode=function(t,e){t instanceof u||(t=u.create(t));for(var n=e===void 0?t.len:t.pos+e,i=new c.RemoteAttestation;t.pos<n;){var s=t.uint32();switch(s>>>3){case 1:{i.certificate=c.EncryptedClientIdentification.decode(t,t.uint32());break}case 2:{i.salt=t.bytes();break}case 3:{i.signature=t.bytes();break}default:t.skipType(s&7);break}}return i},o.decodeDelimited=function(t){return t instanceof u||(t=new u(t)),this.decode(t,t.uint32())},o.fromObject=function(t){if(t instanceof c.RemoteAttestation)return t;var e=new c.RemoteAttestation;if(t.certificate!=null){if(typeof t.certificate!="object")throw TypeError(".RemoteAttestation.certificate: object expected");e.certificate=c.EncryptedClientIdentification.fromObject(t.certificate)}return t.salt!=null&&(typeof t.salt=="string"?a.base64.decode(t.salt,e.salt=a.newBuffer(a.base64.length(t.salt)),0):t.salt.length>=0&&(e.salt=t.salt)),t.signature!=null&&(typeof t.signature=="string"?a.base64.decode(t.signature,e.signature=a.newBuffer(a.base64.length(t.signature)),0):t.signature.length>=0&&(e.signature=t.signature)),e},o.toObject=function(t,e){e||(e={});var n={};return e.defaults&&(n.certificate=null,e.bytes===String?n.salt="":(n.salt=[],e.bytes!==Array&&(n.salt=a.newBuffer(n.salt))),e.bytes===String?n.signature="":(n.signature=[],e.bytes!==Array&&(n.signature=a.newBuffer(n.signature)))),t.certificate!=null&&t.hasOwnProperty("certificate")&&(n.certificate=c.EncryptedClientIdentification.toObject(t.certificate,e)),t.salt!=null&&t.hasOwnProperty("salt")&&(n.salt=e.bytes===String?a.base64.encode(t.salt,0,t.salt.length):e.bytes===Array?Array.prototype.slice.call(t.salt):t.salt),t.signature!=null&&t.hasOwnProperty("signature")&&(n.signature=e.bytes===String?a.base64.encode(t.signature,0,t.signature.length):e.bytes===Array?Array.prototype.slice.call(t.signature):t.signature),n},o.prototype.toJSON=function(){return this.constructor.toObject(this,f.util.toJSONOptions)},o.getTypeUrl=function(t){return t===void 0&&(t="type.googleapis.com"),t+"/RemoteAttestation"},o})();var T=require("jsrsasign");var X=o=>new TextEncoder().encode(o),pe=o=>new TextDecoder().decode(o),w=o=>({toBase64:()=>btoa(X(o).reduce((r,t)=>r+String.fromCharCode(t),"")),toHex:()=>Array.from(X(o)).map(r=>r.toString(16).padStart(2,"0")).join(""),toBuffer:()=>X(o)});var ye=o=>Uint8Array.from(atob(o),r=>r.charCodeAt(0)),h=o=>({toBuffer:()=>ye(o),toText:()=>pe(ye(o))}),g=o=>({toBase64:()=>{let r=Array.from(o,t=>String.fromCodePoint(t)).join("");return btoa(r)},toHex:()=>Array.from(o).map(r=>r.toString(16).padStart(2,"0")).join(""),toText:()=>pe(o),toBinary:()=>{let r="",t=o.length;for(let e=0;e<t;e++)r+=String.fromCharCode(o[e]);return r}});var fe=o=>{let r=T.KEYUTIL.getKey(o);return T.KEYUTIL.getPEM(r,"PKCS8PRV")},de=o=>{let r=T.KEYUTIL.getKey(o);return T.KEYUTIL.getPEM(r,"PKCS1PRV")},ge=o=>{let r=g(o).toHex(),t=T.KEYUTIL.parsePublicRawRSAKeyHex(r),e=T.KEYUTIL.getKey(t),n=T.KEYUTIL.getPEM(e),l=n.substring("-----BEGIN PUBLIC KEY-----".length,n.length-"-----END PUBLIC KEY-----".length-2);return h(l).toBuffer()},be=async o=>crypto.subtle.importKey("spki",o,{name:"RSA-OAEP",hash:"SHA-1"},!0,["encrypt"]),he=async o=>crypto.subtle.importKey("spki",o,{name:"RSA-PSS",hash:"SHA-1"},!0,["verify"]),Se=(o=16)=>{let r=[],t=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"];for(let e=0;e<o;e++)r.push(t[Math.floor(Math.random()*16)]);return r.join("").toUpperCase()},x=(o=16)=>new Uint8Array(crypto.getRandomValues(new Uint8Array(o)));var Oe=async(o=128)=>crypto.subtle.generateKey({name:"AES-CBC",length:o},!0,["encrypt"]),Ce=async o=>crypto.subtle.importKey("raw",o,"AES-CBC",!1,["encrypt"]),Ie=async o=>crypto.subtle.importKey("raw",o,{name:"AES-CBC"},!1,["decrypt"]),q=async(o,r,t)=>{let e=await crypto.subtle.encrypt({name:"AES-CBC",iv:t},r,o);return new Uint8Array(e)},ve=async(o,r,t)=>{let e=await crypto.subtle.decrypt({name:"AES-CBC",iv:t},r,o);return new Uint8Array(e)},ke=async(o,r)=>{let t=await crypto.subtle.encrypt({name:"RSA-OAEP"},r,o);return new Uint8Array(t)},we=o=>crypto.subtle.exportKey("raw",o).then(r=>new Uint8Array(r));var Te=async(o,r)=>{let t=await crypto.subtle.importKey("raw",o,{name:"HMAC",hash:"SHA-256"},!0,["sign","verify"]),e=await crypto.subtle.sign("HMAC",t,r);return new Uint8Array(e)};var M=class o{id;value;type;level;trackLabel;permissions;constructor(r,t,e="CONTENT",n,i,s=[]){this.id=r,this.value=t,this.type=e,this.level=n,this.trackLabel=i,this.permissions=s}toString(){let r="Key: ";return this.id&&(r+=`${this.id}`),this.value&&(r+=`:${this.value}`),this.type&&(r+=` \u2219 Type: ${this.type}`),this.level&&(r+=` \u2219 Level: ${this.level}`),this.trackLabel&&(r+=` \u2219 Label: ${this.trackLabel}`),r}static async fromContainer(r,t){if(!r.key||!r.iv)throw new Error("Key not found");let e=await Ie(t),n=await ve(r.key,e,r.iv),i=r.id?g(r.id).toHex():"UNKNOWN",s=g(n).toHex(),l=U.KeyContainer.KeyType[r.type];return new o(i,s,l,String(r.level),r.trackLabel,r.operatorSessionKeyPermissions)}};var De=new Uint8Array([237,239,139,169,121,214,74,206,163,200,39,220,213,29,33,237]);function yt(o,r){return o.length===r.length&&o.every((t,e)=>t===r[e])}function pt(...o){let r=o.reduce((n,i)=>n+i.length,0),t=new Uint8Array(r),e=0;for(let n of o)t.set(n,e),e+=n.length;return t}var ft=o=>{let r=typeof o=="string"?h(o).toBuffer():o,t=r.subarray(12,28);if(yt(t,De))return typeof o=="string"?o:g(o).toBase64();let n=new Uint8Array([0,0,0,32+r.length]),i=new TextEncoder().encode("pssh"),s=new Uint8Array([0,0,0,0]),l=new Uint8Array([0,0,0,r.length]),y=pt(n,i,s,De,l,r);return g(y).toBase64()},dt=o=>{try{let r=typeof o=="string"?h(o).toBuffer().subarray(32):o.subarray(32);return z.decode(r)}catch{throw new Error("Unable to parse, unsupported init data format")}},Pe=o=>{let r=ft(o),t=dt(r);return{data:t,toBuffer:()=>z.encode(t).finish()}};var P=(...o)=>{let r=o.reduce((n,i)=>n+i.length,0),t=new Uint8Array(r),e=0;for(let n of o)t.set(n,e),e+=n.length;return t};var Q=o=>{let r=new Uint8Array(o.length),t=o.length-1;for(let e=0;e<t;e++)r[e]=o[e]<<1,o[e+1]&128&&(r[e]|=1);return r[t]=o[t]<<1,r};var R=(o,r)=>{let t=new Uint8Array(o.length);for(let e=0;e<o.length;e++)t[e]=o[e]^r[e];return t},gt=o=>{let r=new Uint8Array(o.length/2);for(let t=0;t<o.length;t+=2)r[t/2]=parseInt(o.substr(t,2),16);return r},Re=new Uint8Array(16),Ee=new Uint8Array(gt("00000000000000000000000000000087")),m=16,bt=async o=>{let r=await Z(o,Re),t=Q(r);r[0]&128&&(t=R(t,Ee));let e=Q(t);return t[0]&128&&(e=R(e,Ee)),{subkey1:t,subkey2:e}},Ae=(o,r)=>{let t=r*m,e=t+m;return o.slice(t,e)},ht=(o,r)=>{let t=new Uint8Array(m),e=r*m,n=o.length;return t.set(o.slice(e,n),0),t[n-e]=128,t},Z=async(o,r)=>(await q(r,o,Re)).slice(0,16),me=async(o,r)=>{if(!{16:"aes-128-cbc",24:"aes-192-cbc",32:"aes-256-cbc"}[o.length])throw new Error("Keys must be 128, 192, or 256 bits in length.");let e=await Ce(o),n=await bt(e),i=Math.ceil(r.length/m),s,l;i===0?(i=1,s=!1):s=r.length%m===0;let y=i-1;s?l=R(Ae(r,y),n.subkey1):l=R(ht(r,y),n.subkey2);let p=new Uint8Array(16),S;for(let C=0;C<y;C++)S=R(p,Ae(r,C)),p=await Z(e,S);return S=R(l,p),Z(e,S)};var Le=o=>{let r=new TextEncoder,t=(n,i=4)=>{let s=new Uint8Array(i);return s[i-2]=n>>8&255,s[i-1]=n&255,s},e=(n,i,s)=>P(r.encode(n+"\0"),i,t(s));return{enc:e("ENCRYPTION",o,16*8),auth:e("AUTHENTICATION",o,32*8*2)}},Ke=async(o,r,t)=>{let e=async(l,y,p)=>{let S=P(new Uint8Array([p]),y);return await me(l,S)},n=await e(t,o,1),i=P(await e(t,r,1),await e(t,r,2)),s=P(await e(t,r,3),await e(t,r,4));return{encKey:n,macKeyServer:i,macKeyClient:s}};var N=class extends Event{messageType;message;constructor(r,t){super("message"),this.messageType=r,this.message=t}},je=o=>{try{return O.decode(o).type}catch(r){console.error("Failed to parse message as SignedMessage",r)}};var St=()=>{let o=`
2
+ "use strict";var rt=Object.create;var ce=Object.defineProperty;var ot=Object.getOwnPropertyDescriptor;var st=Object.getOwnPropertyNames;var at=Object.getPrototypeOf,ct=Object.prototype.hasOwnProperty;var lt=(o,r,t,e)=>{if(r&&typeof r=="object"||typeof r=="function")for(let n of st(r))!ct.call(o,n)&&n!==t&&ce(o,n,{get:()=>r[n],enumerable:!(e=ot(r,n))||e.enumerable});return o};var ut=(o,r,t)=>(t=o!=null?rt(at(o)):{},lt(r||!o||!o.__esModule?ce(t,"default",{value:o,enumerable:!0}):t,o));var Ze=require("util");var I=require("fs/promises"),W=require("path");var J=ut(require("protobufjs/minimal.js"),1),p=J.default||J,u=p.Reader,d=p.Writer,a=p.util,c=p.roots.default||(p.roots.default={}),Y=c.LicenseType=(()=>{let o={},r=Object.create(o);return r[o[1]="STREAMING"]=1,r[o[2]="OFFLINE"]=2,r[o[3]="AUTOMATIC"]=3,r})(),Dt=c.PlatformVerificationStatus=(()=>{let o={},r=Object.create(o);return r[o[0]="PLATFORM_UNVERIFIED"]=0,r[o[1]="PLATFORM_TAMPERED"]=1,r[o[2]="PLATFORM_SOFTWARE_VERIFIED"]=2,r[o[3]="PLATFORM_HARDWARE_VERIFIED"]=3,r[o[4]="PLATFORM_NO_VERIFICATION"]=4,r[o[5]="PLATFORM_SECURE_STORAGE_SOFTWARE_VERIFIED"]=5,r})(),Pt=c.LicenseIdentification=(()=>{function o(r){if(r)for(var t=Object.keys(r),e=0;e<t.length;++e)r[t[e]]!=null&&(this[t[e]]=r[t[e]])}return o.prototype.requestId=a.newBuffer([]),o.prototype.sessionId=a.newBuffer([]),o.prototype.purchaseId=a.newBuffer([]),o.prototype.type=1,o.prototype.version=0,o.prototype.providerSessionToken=a.newBuffer([]),o.create=function(t){return new o(t)},o.encode=function(t,e){return e||(e=d.create()),t.requestId!=null&&Object.hasOwnProperty.call(t,"requestId")&&e.uint32(10).bytes(t.requestId),t.sessionId!=null&&Object.hasOwnProperty.call(t,"sessionId")&&e.uint32(18).bytes(t.sessionId),t.purchaseId!=null&&Object.hasOwnProperty.call(t,"purchaseId")&&e.uint32(26).bytes(t.purchaseId),t.type!=null&&Object.hasOwnProperty.call(t,"type")&&e.uint32(32).int32(t.type),t.version!=null&&Object.hasOwnProperty.call(t,"version")&&e.uint32(40).int32(t.version),t.providerSessionToken!=null&&Object.hasOwnProperty.call(t,"providerSessionToken")&&e.uint32(50).bytes(t.providerSessionToken),e},o.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},o.decode=function(t,e){t instanceof u||(t=u.create(t));for(var n=e===void 0?t.len:t.pos+e,i=new c.LicenseIdentification;t.pos<n;){var s=t.uint32();switch(s>>>3){case 1:{i.requestId=t.bytes();break}case 2:{i.sessionId=t.bytes();break}case 3:{i.purchaseId=t.bytes();break}case 4:{i.type=t.int32();break}case 5:{i.version=t.int32();break}case 6:{i.providerSessionToken=t.bytes();break}default:t.skipType(s&7);break}}return i},o.decodeDelimited=function(t){return t instanceof u||(t=new u(t)),this.decode(t,t.uint32())},o.fromObject=function(t){if(t instanceof c.LicenseIdentification)return t;var e=new c.LicenseIdentification;switch(t.requestId!=null&&(typeof t.requestId=="string"?a.base64.decode(t.requestId,e.requestId=a.newBuffer(a.base64.length(t.requestId)),0):t.requestId.length>=0&&(e.requestId=t.requestId)),t.sessionId!=null&&(typeof t.sessionId=="string"?a.base64.decode(t.sessionId,e.sessionId=a.newBuffer(a.base64.length(t.sessionId)),0):t.sessionId.length>=0&&(e.sessionId=t.sessionId)),t.purchaseId!=null&&(typeof t.purchaseId=="string"?a.base64.decode(t.purchaseId,e.purchaseId=a.newBuffer(a.base64.length(t.purchaseId)),0):t.purchaseId.length>=0&&(e.purchaseId=t.purchaseId)),t.type){default:if(typeof t.type=="number"){e.type=t.type;break}break;case"STREAMING":case 1:e.type=1;break;case"OFFLINE":case 2:e.type=2;break;case"AUTOMATIC":case 3:e.type=3;break}return t.version!=null&&(e.version=t.version|0),t.providerSessionToken!=null&&(typeof t.providerSessionToken=="string"?a.base64.decode(t.providerSessionToken,e.providerSessionToken=a.newBuffer(a.base64.length(t.providerSessionToken)),0):t.providerSessionToken.length>=0&&(e.providerSessionToken=t.providerSessionToken)),e},o.toObject=function(t,e){e||(e={});var n={};return e.defaults&&(e.bytes===String?n.requestId="":(n.requestId=[],e.bytes!==Array&&(n.requestId=a.newBuffer(n.requestId))),e.bytes===String?n.sessionId="":(n.sessionId=[],e.bytes!==Array&&(n.sessionId=a.newBuffer(n.sessionId))),e.bytes===String?n.purchaseId="":(n.purchaseId=[],e.bytes!==Array&&(n.purchaseId=a.newBuffer(n.purchaseId))),n.type=e.enums===String?"STREAMING":1,n.version=0,e.bytes===String?n.providerSessionToken="":(n.providerSessionToken=[],e.bytes!==Array&&(n.providerSessionToken=a.newBuffer(n.providerSessionToken)))),t.requestId!=null&&t.hasOwnProperty("requestId")&&(n.requestId=e.bytes===String?a.base64.encode(t.requestId,0,t.requestId.length):e.bytes===Array?Array.prototype.slice.call(t.requestId):t.requestId),t.sessionId!=null&&t.hasOwnProperty("sessionId")&&(n.sessionId=e.bytes===String?a.base64.encode(t.sessionId,0,t.sessionId.length):e.bytes===Array?Array.prototype.slice.call(t.sessionId):t.sessionId),t.purchaseId!=null&&t.hasOwnProperty("purchaseId")&&(n.purchaseId=e.bytes===String?a.base64.encode(t.purchaseId,0,t.purchaseId.length):e.bytes===Array?Array.prototype.slice.call(t.purchaseId):t.purchaseId),t.type!=null&&t.hasOwnProperty("type")&&(n.type=e.enums===String?c.LicenseType[t.type]===void 0?t.type:c.LicenseType[t.type]:t.type),t.version!=null&&t.hasOwnProperty("version")&&(n.version=t.version),t.providerSessionToken!=null&&t.hasOwnProperty("providerSessionToken")&&(n.providerSessionToken=e.bytes===String?a.base64.encode(t.providerSessionToken,0,t.providerSessionToken.length):e.bytes===Array?Array.prototype.slice.call(t.providerSessionToken):t.providerSessionToken),n},o.prototype.toJSON=function(){return this.constructor.toObject(this,p.util.toJSONOptions)},o.getTypeUrl=function(t){return t===void 0&&(t="type.googleapis.com"),t+"/LicenseIdentification"},o})(),U=c.License=(()=>{function o(r){if(this.key=[],this.groupIds=[],r)for(var t=Object.keys(r),e=0;e<t.length;++e)r[t[e]]!=null&&(this[t[e]]=r[t[e]])}return o.prototype.id=null,o.prototype.policy=null,o.prototype.key=a.emptyArray,o.prototype.licenseStartTime=a.Long?a.Long.fromBits(0,0,!1):0,o.prototype.remoteAttestationVerified=!1,o.prototype.providerClientToken=a.newBuffer([]),o.prototype.protectionScheme=0,o.prototype.srmRequirement=a.newBuffer([]),o.prototype.srmUpdate=a.newBuffer([]),o.prototype.platformVerificationStatus=4,o.prototype.groupIds=a.emptyArray,o.create=function(t){return new o(t)},o.encode=function(t,e){if(e||(e=d.create()),t.id!=null&&Object.hasOwnProperty.call(t,"id")&&c.LicenseIdentification.encode(t.id,e.uint32(10).fork()).ldelim(),t.policy!=null&&Object.hasOwnProperty.call(t,"policy")&&c.License.Policy.encode(t.policy,e.uint32(18).fork()).ldelim(),t.key!=null&&t.key.length)for(var n=0;n<t.key.length;++n)c.License.KeyContainer.encode(t.key[n],e.uint32(26).fork()).ldelim();if(t.licenseStartTime!=null&&Object.hasOwnProperty.call(t,"licenseStartTime")&&e.uint32(32).int64(t.licenseStartTime),t.remoteAttestationVerified!=null&&Object.hasOwnProperty.call(t,"remoteAttestationVerified")&&e.uint32(40).bool(t.remoteAttestationVerified),t.providerClientToken!=null&&Object.hasOwnProperty.call(t,"providerClientToken")&&e.uint32(50).bytes(t.providerClientToken),t.protectionScheme!=null&&Object.hasOwnProperty.call(t,"protectionScheme")&&e.uint32(56).uint32(t.protectionScheme),t.srmRequirement!=null&&Object.hasOwnProperty.call(t,"srmRequirement")&&e.uint32(66).bytes(t.srmRequirement),t.srmUpdate!=null&&Object.hasOwnProperty.call(t,"srmUpdate")&&e.uint32(74).bytes(t.srmUpdate),t.platformVerificationStatus!=null&&Object.hasOwnProperty.call(t,"platformVerificationStatus")&&e.uint32(80).int32(t.platformVerificationStatus),t.groupIds!=null&&t.groupIds.length)for(var n=0;n<t.groupIds.length;++n)e.uint32(90).bytes(t.groupIds[n]);return e},o.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},o.decode=function(t,e){t instanceof u||(t=u.create(t));for(var n=e===void 0?t.len:t.pos+e,i=new c.License;t.pos<n;){var s=t.uint32();switch(s>>>3){case 1:{i.id=c.LicenseIdentification.decode(t,t.uint32());break}case 2:{i.policy=c.License.Policy.decode(t,t.uint32());break}case 3:{i.key&&i.key.length||(i.key=[]),i.key.push(c.License.KeyContainer.decode(t,t.uint32()));break}case 4:{i.licenseStartTime=t.int64();break}case 5:{i.remoteAttestationVerified=t.bool();break}case 6:{i.providerClientToken=t.bytes();break}case 7:{i.protectionScheme=t.uint32();break}case 8:{i.srmRequirement=t.bytes();break}case 9:{i.srmUpdate=t.bytes();break}case 10:{i.platformVerificationStatus=t.int32();break}case 11:{i.groupIds&&i.groupIds.length||(i.groupIds=[]),i.groupIds.push(t.bytes());break}default:t.skipType(s&7);break}}return i},o.decodeDelimited=function(t){return t instanceof u||(t=new u(t)),this.decode(t,t.uint32())},o.fromObject=function(t){if(t instanceof c.License)return t;var e=new c.License;if(t.id!=null){if(typeof t.id!="object")throw TypeError(".License.id: object expected");e.id=c.LicenseIdentification.fromObject(t.id)}if(t.policy!=null){if(typeof t.policy!="object")throw TypeError(".License.policy: object expected");e.policy=c.License.Policy.fromObject(t.policy)}if(t.key){if(!Array.isArray(t.key))throw TypeError(".License.key: array expected");e.key=[];for(var n=0;n<t.key.length;++n){if(typeof t.key[n]!="object")throw TypeError(".License.key: object expected");e.key[n]=c.License.KeyContainer.fromObject(t.key[n])}}switch(t.licenseStartTime!=null&&(a.Long?(e.licenseStartTime=a.Long.fromValue(t.licenseStartTime)).unsigned=!1:typeof t.licenseStartTime=="string"?e.licenseStartTime=parseInt(t.licenseStartTime,10):typeof t.licenseStartTime=="number"?e.licenseStartTime=t.licenseStartTime:typeof t.licenseStartTime=="object"&&(e.licenseStartTime=new a.LongBits(t.licenseStartTime.low>>>0,t.licenseStartTime.high>>>0).toNumber())),t.remoteAttestationVerified!=null&&(e.remoteAttestationVerified=!!t.remoteAttestationVerified),t.providerClientToken!=null&&(typeof t.providerClientToken=="string"?a.base64.decode(t.providerClientToken,e.providerClientToken=a.newBuffer(a.base64.length(t.providerClientToken)),0):t.providerClientToken.length>=0&&(e.providerClientToken=t.providerClientToken)),t.protectionScheme!=null&&(e.protectionScheme=t.protectionScheme>>>0),t.srmRequirement!=null&&(typeof t.srmRequirement=="string"?a.base64.decode(t.srmRequirement,e.srmRequirement=a.newBuffer(a.base64.length(t.srmRequirement)),0):t.srmRequirement.length>=0&&(e.srmRequirement=t.srmRequirement)),t.srmUpdate!=null&&(typeof t.srmUpdate=="string"?a.base64.decode(t.srmUpdate,e.srmUpdate=a.newBuffer(a.base64.length(t.srmUpdate)),0):t.srmUpdate.length>=0&&(e.srmUpdate=t.srmUpdate)),t.platformVerificationStatus){case"PLATFORM_UNVERIFIED":case 0:e.platformVerificationStatus=0;break;case"PLATFORM_TAMPERED":case 1:e.platformVerificationStatus=1;break;case"PLATFORM_SOFTWARE_VERIFIED":case 2:e.platformVerificationStatus=2;break;case"PLATFORM_HARDWARE_VERIFIED":case 3:e.platformVerificationStatus=3;break;default:if(typeof t.platformVerificationStatus=="number"){e.platformVerificationStatus=t.platformVerificationStatus;break}break;case"PLATFORM_NO_VERIFICATION":case 4:e.platformVerificationStatus=4;break;case"PLATFORM_SECURE_STORAGE_SOFTWARE_VERIFIED":case 5:e.platformVerificationStatus=5;break}if(t.groupIds){if(!Array.isArray(t.groupIds))throw TypeError(".License.groupIds: array expected");e.groupIds=[];for(var n=0;n<t.groupIds.length;++n)typeof t.groupIds[n]=="string"?a.base64.decode(t.groupIds[n],e.groupIds[n]=a.newBuffer(a.base64.length(t.groupIds[n])),0):t.groupIds[n].length>=0&&(e.groupIds[n]=t.groupIds[n])}return e},o.toObject=function(t,e){e||(e={});var n={};if((e.arrays||e.defaults)&&(n.key=[],n.groupIds=[]),e.defaults){if(n.id=null,n.policy=null,a.Long){var i=new a.Long(0,0,!1);n.licenseStartTime=e.longs===String?i.toString():e.longs===Number?i.toNumber():i}else n.licenseStartTime=e.longs===String?"0":0;n.remoteAttestationVerified=!1,e.bytes===String?n.providerClientToken="":(n.providerClientToken=[],e.bytes!==Array&&(n.providerClientToken=a.newBuffer(n.providerClientToken))),n.protectionScheme=0,e.bytes===String?n.srmRequirement="":(n.srmRequirement=[],e.bytes!==Array&&(n.srmRequirement=a.newBuffer(n.srmRequirement))),e.bytes===String?n.srmUpdate="":(n.srmUpdate=[],e.bytes!==Array&&(n.srmUpdate=a.newBuffer(n.srmUpdate))),n.platformVerificationStatus=e.enums===String?"PLATFORM_NO_VERIFICATION":4}if(t.id!=null&&t.hasOwnProperty("id")&&(n.id=c.LicenseIdentification.toObject(t.id,e)),t.policy!=null&&t.hasOwnProperty("policy")&&(n.policy=c.License.Policy.toObject(t.policy,e)),t.key&&t.key.length){n.key=[];for(var s=0;s<t.key.length;++s)n.key[s]=c.License.KeyContainer.toObject(t.key[s],e)}if(t.licenseStartTime!=null&&t.hasOwnProperty("licenseStartTime")&&(typeof t.licenseStartTime=="number"?n.licenseStartTime=e.longs===String?String(t.licenseStartTime):t.licenseStartTime:n.licenseStartTime=e.longs===String?a.Long.prototype.toString.call(t.licenseStartTime):e.longs===Number?new a.LongBits(t.licenseStartTime.low>>>0,t.licenseStartTime.high>>>0).toNumber():t.licenseStartTime),t.remoteAttestationVerified!=null&&t.hasOwnProperty("remoteAttestationVerified")&&(n.remoteAttestationVerified=t.remoteAttestationVerified),t.providerClientToken!=null&&t.hasOwnProperty("providerClientToken")&&(n.providerClientToken=e.bytes===String?a.base64.encode(t.providerClientToken,0,t.providerClientToken.length):e.bytes===Array?Array.prototype.slice.call(t.providerClientToken):t.providerClientToken),t.protectionScheme!=null&&t.hasOwnProperty("protectionScheme")&&(n.protectionScheme=t.protectionScheme),t.srmRequirement!=null&&t.hasOwnProperty("srmRequirement")&&(n.srmRequirement=e.bytes===String?a.base64.encode(t.srmRequirement,0,t.srmRequirement.length):e.bytes===Array?Array.prototype.slice.call(t.srmRequirement):t.srmRequirement),t.srmUpdate!=null&&t.hasOwnProperty("srmUpdate")&&(n.srmUpdate=e.bytes===String?a.base64.encode(t.srmUpdate,0,t.srmUpdate.length):e.bytes===Array?Array.prototype.slice.call(t.srmUpdate):t.srmUpdate),t.platformVerificationStatus!=null&&t.hasOwnProperty("platformVerificationStatus")&&(n.platformVerificationStatus=e.enums===String?c.PlatformVerificationStatus[t.platformVerificationStatus]===void 0?t.platformVerificationStatus:c.PlatformVerificationStatus[t.platformVerificationStatus]:t.platformVerificationStatus),t.groupIds&&t.groupIds.length){n.groupIds=[];for(var s=0;s<t.groupIds.length;++s)n.groupIds[s]=e.bytes===String?a.base64.encode(t.groupIds[s],0,t.groupIds[s].length):e.bytes===Array?Array.prototype.slice.call(t.groupIds[s]):t.groupIds[s]}return n},o.prototype.toJSON=function(){return this.constructor.toObject(this,p.util.toJSONOptions)},o.getTypeUrl=function(t){return t===void 0&&(t="type.googleapis.com"),t+"/License"},o.Policy=function(){function r(t){if(t)for(var e=Object.keys(t),n=0;n<e.length;++n)t[e[n]]!=null&&(this[e[n]]=t[e[n]])}return r.prototype.canPlay=!1,r.prototype.canPersist=!1,r.prototype.canRenew=!1,r.prototype.rentalDurationSeconds=a.Long?a.Long.fromBits(0,0,!1):0,r.prototype.playbackDurationSeconds=a.Long?a.Long.fromBits(0,0,!1):0,r.prototype.licenseDurationSeconds=a.Long?a.Long.fromBits(0,0,!1):0,r.prototype.renewalRecoveryDurationSeconds=a.Long?a.Long.fromBits(0,0,!1):0,r.prototype.renewalServerUrl="",r.prototype.renewalDelaySeconds=a.Long?a.Long.fromBits(0,0,!1):0,r.prototype.renewalRetryIntervalSeconds=a.Long?a.Long.fromBits(0,0,!1):0,r.prototype.renewWithUsage=!1,r.prototype.alwaysIncludeClientId=!1,r.prototype.playStartGracePeriodSeconds=a.Long?a.Long.fromBits(0,0,!1):0,r.prototype.softEnforcePlaybackDuration=!1,r.prototype.softEnforceRentalDuration=!0,r.create=function(e){return new r(e)},r.encode=function(e,n){return n||(n=d.create()),e.canPlay!=null&&Object.hasOwnProperty.call(e,"canPlay")&&n.uint32(8).bool(e.canPlay),e.canPersist!=null&&Object.hasOwnProperty.call(e,"canPersist")&&n.uint32(16).bool(e.canPersist),e.canRenew!=null&&Object.hasOwnProperty.call(e,"canRenew")&&n.uint32(24).bool(e.canRenew),e.rentalDurationSeconds!=null&&Object.hasOwnProperty.call(e,"rentalDurationSeconds")&&n.uint32(32).int64(e.rentalDurationSeconds),e.playbackDurationSeconds!=null&&Object.hasOwnProperty.call(e,"playbackDurationSeconds")&&n.uint32(40).int64(e.playbackDurationSeconds),e.licenseDurationSeconds!=null&&Object.hasOwnProperty.call(e,"licenseDurationSeconds")&&n.uint32(48).int64(e.licenseDurationSeconds),e.renewalRecoveryDurationSeconds!=null&&Object.hasOwnProperty.call(e,"renewalRecoveryDurationSeconds")&&n.uint32(56).int64(e.renewalRecoveryDurationSeconds),e.renewalServerUrl!=null&&Object.hasOwnProperty.call(e,"renewalServerUrl")&&n.uint32(66).string(e.renewalServerUrl),e.renewalDelaySeconds!=null&&Object.hasOwnProperty.call(e,"renewalDelaySeconds")&&n.uint32(72).int64(e.renewalDelaySeconds),e.renewalRetryIntervalSeconds!=null&&Object.hasOwnProperty.call(e,"renewalRetryIntervalSeconds")&&n.uint32(80).int64(e.renewalRetryIntervalSeconds),e.renewWithUsage!=null&&Object.hasOwnProperty.call(e,"renewWithUsage")&&n.uint32(88).bool(e.renewWithUsage),e.alwaysIncludeClientId!=null&&Object.hasOwnProperty.call(e,"alwaysIncludeClientId")&&n.uint32(96).bool(e.alwaysIncludeClientId),e.playStartGracePeriodSeconds!=null&&Object.hasOwnProperty.call(e,"playStartGracePeriodSeconds")&&n.uint32(104).int64(e.playStartGracePeriodSeconds),e.softEnforcePlaybackDuration!=null&&Object.hasOwnProperty.call(e,"softEnforcePlaybackDuration")&&n.uint32(112).bool(e.softEnforcePlaybackDuration),e.softEnforceRentalDuration!=null&&Object.hasOwnProperty.call(e,"softEnforceRentalDuration")&&n.uint32(120).bool(e.softEnforceRentalDuration),n},r.encodeDelimited=function(e,n){return this.encode(e,n).ldelim()},r.decode=function(e,n){e instanceof u||(e=u.create(e));for(var i=n===void 0?e.len:e.pos+n,s=new c.License.Policy;e.pos<i;){var l=e.uint32();switch(l>>>3){case 1:{s.canPlay=e.bool();break}case 2:{s.canPersist=e.bool();break}case 3:{s.canRenew=e.bool();break}case 4:{s.rentalDurationSeconds=e.int64();break}case 5:{s.playbackDurationSeconds=e.int64();break}case 6:{s.licenseDurationSeconds=e.int64();break}case 7:{s.renewalRecoveryDurationSeconds=e.int64();break}case 8:{s.renewalServerUrl=e.string();break}case 9:{s.renewalDelaySeconds=e.int64();break}case 10:{s.renewalRetryIntervalSeconds=e.int64();break}case 11:{s.renewWithUsage=e.bool();break}case 12:{s.alwaysIncludeClientId=e.bool();break}case 13:{s.playStartGracePeriodSeconds=e.int64();break}case 14:{s.softEnforcePlaybackDuration=e.bool();break}case 15:{s.softEnforceRentalDuration=e.bool();break}default:e.skipType(l&7);break}}return s},r.decodeDelimited=function(e){return e instanceof u||(e=new u(e)),this.decode(e,e.uint32())},r.fromObject=function(e){if(e instanceof c.License.Policy)return e;var n=new c.License.Policy;return e.canPlay!=null&&(n.canPlay=!!e.canPlay),e.canPersist!=null&&(n.canPersist=!!e.canPersist),e.canRenew!=null&&(n.canRenew=!!e.canRenew),e.rentalDurationSeconds!=null&&(a.Long?(n.rentalDurationSeconds=a.Long.fromValue(e.rentalDurationSeconds)).unsigned=!1:typeof e.rentalDurationSeconds=="string"?n.rentalDurationSeconds=parseInt(e.rentalDurationSeconds,10):typeof e.rentalDurationSeconds=="number"?n.rentalDurationSeconds=e.rentalDurationSeconds:typeof e.rentalDurationSeconds=="object"&&(n.rentalDurationSeconds=new a.LongBits(e.rentalDurationSeconds.low>>>0,e.rentalDurationSeconds.high>>>0).toNumber())),e.playbackDurationSeconds!=null&&(a.Long?(n.playbackDurationSeconds=a.Long.fromValue(e.playbackDurationSeconds)).unsigned=!1:typeof e.playbackDurationSeconds=="string"?n.playbackDurationSeconds=parseInt(e.playbackDurationSeconds,10):typeof e.playbackDurationSeconds=="number"?n.playbackDurationSeconds=e.playbackDurationSeconds:typeof e.playbackDurationSeconds=="object"&&(n.playbackDurationSeconds=new a.LongBits(e.playbackDurationSeconds.low>>>0,e.playbackDurationSeconds.high>>>0).toNumber())),e.licenseDurationSeconds!=null&&(a.Long?(n.licenseDurationSeconds=a.Long.fromValue(e.licenseDurationSeconds)).unsigned=!1:typeof e.licenseDurationSeconds=="string"?n.licenseDurationSeconds=parseInt(e.licenseDurationSeconds,10):typeof e.licenseDurationSeconds=="number"?n.licenseDurationSeconds=e.licenseDurationSeconds:typeof e.licenseDurationSeconds=="object"&&(n.licenseDurationSeconds=new a.LongBits(e.licenseDurationSeconds.low>>>0,e.licenseDurationSeconds.high>>>0).toNumber())),e.renewalRecoveryDurationSeconds!=null&&(a.Long?(n.renewalRecoveryDurationSeconds=a.Long.fromValue(e.renewalRecoveryDurationSeconds)).unsigned=!1:typeof e.renewalRecoveryDurationSeconds=="string"?n.renewalRecoveryDurationSeconds=parseInt(e.renewalRecoveryDurationSeconds,10):typeof e.renewalRecoveryDurationSeconds=="number"?n.renewalRecoveryDurationSeconds=e.renewalRecoveryDurationSeconds:typeof e.renewalRecoveryDurationSeconds=="object"&&(n.renewalRecoveryDurationSeconds=new a.LongBits(e.renewalRecoveryDurationSeconds.low>>>0,e.renewalRecoveryDurationSeconds.high>>>0).toNumber())),e.renewalServerUrl!=null&&(n.renewalServerUrl=String(e.renewalServerUrl)),e.renewalDelaySeconds!=null&&(a.Long?(n.renewalDelaySeconds=a.Long.fromValue(e.renewalDelaySeconds)).unsigned=!1:typeof e.renewalDelaySeconds=="string"?n.renewalDelaySeconds=parseInt(e.renewalDelaySeconds,10):typeof e.renewalDelaySeconds=="number"?n.renewalDelaySeconds=e.renewalDelaySeconds:typeof e.renewalDelaySeconds=="object"&&(n.renewalDelaySeconds=new a.LongBits(e.renewalDelaySeconds.low>>>0,e.renewalDelaySeconds.high>>>0).toNumber())),e.renewalRetryIntervalSeconds!=null&&(a.Long?(n.renewalRetryIntervalSeconds=a.Long.fromValue(e.renewalRetryIntervalSeconds)).unsigned=!1:typeof e.renewalRetryIntervalSeconds=="string"?n.renewalRetryIntervalSeconds=parseInt(e.renewalRetryIntervalSeconds,10):typeof e.renewalRetryIntervalSeconds=="number"?n.renewalRetryIntervalSeconds=e.renewalRetryIntervalSeconds:typeof e.renewalRetryIntervalSeconds=="object"&&(n.renewalRetryIntervalSeconds=new a.LongBits(e.renewalRetryIntervalSeconds.low>>>0,e.renewalRetryIntervalSeconds.high>>>0).toNumber())),e.renewWithUsage!=null&&(n.renewWithUsage=!!e.renewWithUsage),e.alwaysIncludeClientId!=null&&(n.alwaysIncludeClientId=!!e.alwaysIncludeClientId),e.playStartGracePeriodSeconds!=null&&(a.Long?(n.playStartGracePeriodSeconds=a.Long.fromValue(e.playStartGracePeriodSeconds)).unsigned=!1:typeof e.playStartGracePeriodSeconds=="string"?n.playStartGracePeriodSeconds=parseInt(e.playStartGracePeriodSeconds,10):typeof e.playStartGracePeriodSeconds=="number"?n.playStartGracePeriodSeconds=e.playStartGracePeriodSeconds:typeof e.playStartGracePeriodSeconds=="object"&&(n.playStartGracePeriodSeconds=new a.LongBits(e.playStartGracePeriodSeconds.low>>>0,e.playStartGracePeriodSeconds.high>>>0).toNumber())),e.softEnforcePlaybackDuration!=null&&(n.softEnforcePlaybackDuration=!!e.softEnforcePlaybackDuration),e.softEnforceRentalDuration!=null&&(n.softEnforceRentalDuration=!!e.softEnforceRentalDuration),n},r.toObject=function(e,n){n||(n={});var i={};if(n.defaults){if(i.canPlay=!1,i.canPersist=!1,i.canRenew=!1,a.Long){var s=new a.Long(0,0,!1);i.rentalDurationSeconds=n.longs===String?s.toString():n.longs===Number?s.toNumber():s}else i.rentalDurationSeconds=n.longs===String?"0":0;if(a.Long){var s=new a.Long(0,0,!1);i.playbackDurationSeconds=n.longs===String?s.toString():n.longs===Number?s.toNumber():s}else i.playbackDurationSeconds=n.longs===String?"0":0;if(a.Long){var s=new a.Long(0,0,!1);i.licenseDurationSeconds=n.longs===String?s.toString():n.longs===Number?s.toNumber():s}else i.licenseDurationSeconds=n.longs===String?"0":0;if(a.Long){var s=new a.Long(0,0,!1);i.renewalRecoveryDurationSeconds=n.longs===String?s.toString():n.longs===Number?s.toNumber():s}else i.renewalRecoveryDurationSeconds=n.longs===String?"0":0;if(i.renewalServerUrl="",a.Long){var s=new a.Long(0,0,!1);i.renewalDelaySeconds=n.longs===String?s.toString():n.longs===Number?s.toNumber():s}else i.renewalDelaySeconds=n.longs===String?"0":0;if(a.Long){var s=new a.Long(0,0,!1);i.renewalRetryIntervalSeconds=n.longs===String?s.toString():n.longs===Number?s.toNumber():s}else i.renewalRetryIntervalSeconds=n.longs===String?"0":0;if(i.renewWithUsage=!1,i.alwaysIncludeClientId=!1,a.Long){var s=new a.Long(0,0,!1);i.playStartGracePeriodSeconds=n.longs===String?s.toString():n.longs===Number?s.toNumber():s}else i.playStartGracePeriodSeconds=n.longs===String?"0":0;i.softEnforcePlaybackDuration=!1,i.softEnforceRentalDuration=!0}return e.canPlay!=null&&e.hasOwnProperty("canPlay")&&(i.canPlay=e.canPlay),e.canPersist!=null&&e.hasOwnProperty("canPersist")&&(i.canPersist=e.canPersist),e.canRenew!=null&&e.hasOwnProperty("canRenew")&&(i.canRenew=e.canRenew),e.rentalDurationSeconds!=null&&e.hasOwnProperty("rentalDurationSeconds")&&(typeof e.rentalDurationSeconds=="number"?i.rentalDurationSeconds=n.longs===String?String(e.rentalDurationSeconds):e.rentalDurationSeconds:i.rentalDurationSeconds=n.longs===String?a.Long.prototype.toString.call(e.rentalDurationSeconds):n.longs===Number?new a.LongBits(e.rentalDurationSeconds.low>>>0,e.rentalDurationSeconds.high>>>0).toNumber():e.rentalDurationSeconds),e.playbackDurationSeconds!=null&&e.hasOwnProperty("playbackDurationSeconds")&&(typeof e.playbackDurationSeconds=="number"?i.playbackDurationSeconds=n.longs===String?String(e.playbackDurationSeconds):e.playbackDurationSeconds:i.playbackDurationSeconds=n.longs===String?a.Long.prototype.toString.call(e.playbackDurationSeconds):n.longs===Number?new a.LongBits(e.playbackDurationSeconds.low>>>0,e.playbackDurationSeconds.high>>>0).toNumber():e.playbackDurationSeconds),e.licenseDurationSeconds!=null&&e.hasOwnProperty("licenseDurationSeconds")&&(typeof e.licenseDurationSeconds=="number"?i.licenseDurationSeconds=n.longs===String?String(e.licenseDurationSeconds):e.licenseDurationSeconds:i.licenseDurationSeconds=n.longs===String?a.Long.prototype.toString.call(e.licenseDurationSeconds):n.longs===Number?new a.LongBits(e.licenseDurationSeconds.low>>>0,e.licenseDurationSeconds.high>>>0).toNumber():e.licenseDurationSeconds),e.renewalRecoveryDurationSeconds!=null&&e.hasOwnProperty("renewalRecoveryDurationSeconds")&&(typeof e.renewalRecoveryDurationSeconds=="number"?i.renewalRecoveryDurationSeconds=n.longs===String?String(e.renewalRecoveryDurationSeconds):e.renewalRecoveryDurationSeconds:i.renewalRecoveryDurationSeconds=n.longs===String?a.Long.prototype.toString.call(e.renewalRecoveryDurationSeconds):n.longs===Number?new a.LongBits(e.renewalRecoveryDurationSeconds.low>>>0,e.renewalRecoveryDurationSeconds.high>>>0).toNumber():e.renewalRecoveryDurationSeconds),e.renewalServerUrl!=null&&e.hasOwnProperty("renewalServerUrl")&&(i.renewalServerUrl=e.renewalServerUrl),e.renewalDelaySeconds!=null&&e.hasOwnProperty("renewalDelaySeconds")&&(typeof e.renewalDelaySeconds=="number"?i.renewalDelaySeconds=n.longs===String?String(e.renewalDelaySeconds):e.renewalDelaySeconds:i.renewalDelaySeconds=n.longs===String?a.Long.prototype.toString.call(e.renewalDelaySeconds):n.longs===Number?new a.LongBits(e.renewalDelaySeconds.low>>>0,e.renewalDelaySeconds.high>>>0).toNumber():e.renewalDelaySeconds),e.renewalRetryIntervalSeconds!=null&&e.hasOwnProperty("renewalRetryIntervalSeconds")&&(typeof e.renewalRetryIntervalSeconds=="number"?i.renewalRetryIntervalSeconds=n.longs===String?String(e.renewalRetryIntervalSeconds):e.renewalRetryIntervalSeconds:i.renewalRetryIntervalSeconds=n.longs===String?a.Long.prototype.toString.call(e.renewalRetryIntervalSeconds):n.longs===Number?new a.LongBits(e.renewalRetryIntervalSeconds.low>>>0,e.renewalRetryIntervalSeconds.high>>>0).toNumber():e.renewalRetryIntervalSeconds),e.renewWithUsage!=null&&e.hasOwnProperty("renewWithUsage")&&(i.renewWithUsage=e.renewWithUsage),e.alwaysIncludeClientId!=null&&e.hasOwnProperty("alwaysIncludeClientId")&&(i.alwaysIncludeClientId=e.alwaysIncludeClientId),e.playStartGracePeriodSeconds!=null&&e.hasOwnProperty("playStartGracePeriodSeconds")&&(typeof e.playStartGracePeriodSeconds=="number"?i.playStartGracePeriodSeconds=n.longs===String?String(e.playStartGracePeriodSeconds):e.playStartGracePeriodSeconds:i.playStartGracePeriodSeconds=n.longs===String?a.Long.prototype.toString.call(e.playStartGracePeriodSeconds):n.longs===Number?new a.LongBits(e.playStartGracePeriodSeconds.low>>>0,e.playStartGracePeriodSeconds.high>>>0).toNumber():e.playStartGracePeriodSeconds),e.softEnforcePlaybackDuration!=null&&e.hasOwnProperty("softEnforcePlaybackDuration")&&(i.softEnforcePlaybackDuration=e.softEnforcePlaybackDuration),e.softEnforceRentalDuration!=null&&e.hasOwnProperty("softEnforceRentalDuration")&&(i.softEnforceRentalDuration=e.softEnforceRentalDuration),i},r.prototype.toJSON=function(){return this.constructor.toObject(this,p.util.toJSONOptions)},r.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/License.Policy"},r}(),o.KeyContainer=function(){function r(t){if(this.videoResolutionConstraints=[],t)for(var e=Object.keys(t),n=0;n<e.length;++n)t[e[n]]!=null&&(this[e[n]]=t[e[n]])}return r.prototype.id=a.newBuffer([]),r.prototype.iv=a.newBuffer([]),r.prototype.key=a.newBuffer([]),r.prototype.type=1,r.prototype.level=1,r.prototype.requiredProtection=null,r.prototype.requestedProtection=null,r.prototype.keyControl=null,r.prototype.operatorSessionKeyPermissions=null,r.prototype.videoResolutionConstraints=a.emptyArray,r.prototype.antiRollbackUsageTable=!1,r.prototype.trackLabel="",r.create=function(e){return new r(e)},r.encode=function(e,n){if(n||(n=d.create()),e.id!=null&&Object.hasOwnProperty.call(e,"id")&&n.uint32(10).bytes(e.id),e.iv!=null&&Object.hasOwnProperty.call(e,"iv")&&n.uint32(18).bytes(e.iv),e.key!=null&&Object.hasOwnProperty.call(e,"key")&&n.uint32(26).bytes(e.key),e.type!=null&&Object.hasOwnProperty.call(e,"type")&&n.uint32(32).int32(e.type),e.level!=null&&Object.hasOwnProperty.call(e,"level")&&n.uint32(40).int32(e.level),e.requiredProtection!=null&&Object.hasOwnProperty.call(e,"requiredProtection")&&c.License.KeyContainer.OutputProtection.encode(e.requiredProtection,n.uint32(50).fork()).ldelim(),e.requestedProtection!=null&&Object.hasOwnProperty.call(e,"requestedProtection")&&c.License.KeyContainer.OutputProtection.encode(e.requestedProtection,n.uint32(58).fork()).ldelim(),e.keyControl!=null&&Object.hasOwnProperty.call(e,"keyControl")&&c.License.KeyContainer.KeyControl.encode(e.keyControl,n.uint32(66).fork()).ldelim(),e.operatorSessionKeyPermissions!=null&&Object.hasOwnProperty.call(e,"operatorSessionKeyPermissions")&&c.License.KeyContainer.OperatorSessionKeyPermissions.encode(e.operatorSessionKeyPermissions,n.uint32(74).fork()).ldelim(),e.videoResolutionConstraints!=null&&e.videoResolutionConstraints.length)for(var i=0;i<e.videoResolutionConstraints.length;++i)c.License.KeyContainer.VideoResolutionConstraint.encode(e.videoResolutionConstraints[i],n.uint32(82).fork()).ldelim();return e.antiRollbackUsageTable!=null&&Object.hasOwnProperty.call(e,"antiRollbackUsageTable")&&n.uint32(88).bool(e.antiRollbackUsageTable),e.trackLabel!=null&&Object.hasOwnProperty.call(e,"trackLabel")&&n.uint32(98).string(e.trackLabel),n},r.encodeDelimited=function(e,n){return this.encode(e,n).ldelim()},r.decode=function(e,n){e instanceof u||(e=u.create(e));for(var i=n===void 0?e.len:e.pos+n,s=new c.License.KeyContainer;e.pos<i;){var l=e.uint32();switch(l>>>3){case 1:{s.id=e.bytes();break}case 2:{s.iv=e.bytes();break}case 3:{s.key=e.bytes();break}case 4:{s.type=e.int32();break}case 5:{s.level=e.int32();break}case 6:{s.requiredProtection=c.License.KeyContainer.OutputProtection.decode(e,e.uint32());break}case 7:{s.requestedProtection=c.License.KeyContainer.OutputProtection.decode(e,e.uint32());break}case 8:{s.keyControl=c.License.KeyContainer.KeyControl.decode(e,e.uint32());break}case 9:{s.operatorSessionKeyPermissions=c.License.KeyContainer.OperatorSessionKeyPermissions.decode(e,e.uint32());break}case 10:{s.videoResolutionConstraints&&s.videoResolutionConstraints.length||(s.videoResolutionConstraints=[]),s.videoResolutionConstraints.push(c.License.KeyContainer.VideoResolutionConstraint.decode(e,e.uint32()));break}case 11:{s.antiRollbackUsageTable=e.bool();break}case 12:{s.trackLabel=e.string();break}default:e.skipType(l&7);break}}return s},r.decodeDelimited=function(e){return e instanceof u||(e=new u(e)),this.decode(e,e.uint32())},r.fromObject=function(e){if(e instanceof c.License.KeyContainer)return e;var n=new c.License.KeyContainer;switch(e.id!=null&&(typeof e.id=="string"?a.base64.decode(e.id,n.id=a.newBuffer(a.base64.length(e.id)),0):e.id.length>=0&&(n.id=e.id)),e.iv!=null&&(typeof e.iv=="string"?a.base64.decode(e.iv,n.iv=a.newBuffer(a.base64.length(e.iv)),0):e.iv.length>=0&&(n.iv=e.iv)),e.key!=null&&(typeof e.key=="string"?a.base64.decode(e.key,n.key=a.newBuffer(a.base64.length(e.key)),0):e.key.length>=0&&(n.key=e.key)),e.type){default:if(typeof e.type=="number"){n.type=e.type;break}break;case"SIGNING":case 1:n.type=1;break;case"CONTENT":case 2:n.type=2;break;case"KEY_CONTROL":case 3:n.type=3;break;case"OPERATOR_SESSION":case 4:n.type=4;break;case"ENTITLEMENT":case 5:n.type=5;break;case"OEM_CONTENT":case 6:n.type=6;break}switch(e.level){default:if(typeof e.level=="number"){n.level=e.level;break}break;case"SW_SECURE_CRYPTO":case 1:n.level=1;break;case"SW_SECURE_DECODE":case 2:n.level=2;break;case"HW_SECURE_CRYPTO":case 3:n.level=3;break;case"HW_SECURE_DECODE":case 4:n.level=4;break;case"HW_SECURE_ALL":case 5:n.level=5;break}if(e.requiredProtection!=null){if(typeof e.requiredProtection!="object")throw TypeError(".License.KeyContainer.requiredProtection: object expected");n.requiredProtection=c.License.KeyContainer.OutputProtection.fromObject(e.requiredProtection)}if(e.requestedProtection!=null){if(typeof e.requestedProtection!="object")throw TypeError(".License.KeyContainer.requestedProtection: object expected");n.requestedProtection=c.License.KeyContainer.OutputProtection.fromObject(e.requestedProtection)}if(e.keyControl!=null){if(typeof e.keyControl!="object")throw TypeError(".License.KeyContainer.keyControl: object expected");n.keyControl=c.License.KeyContainer.KeyControl.fromObject(e.keyControl)}if(e.operatorSessionKeyPermissions!=null){if(typeof e.operatorSessionKeyPermissions!="object")throw TypeError(".License.KeyContainer.operatorSessionKeyPermissions: object expected");n.operatorSessionKeyPermissions=c.License.KeyContainer.OperatorSessionKeyPermissions.fromObject(e.operatorSessionKeyPermissions)}if(e.videoResolutionConstraints){if(!Array.isArray(e.videoResolutionConstraints))throw TypeError(".License.KeyContainer.videoResolutionConstraints: array expected");n.videoResolutionConstraints=[];for(var i=0;i<e.videoResolutionConstraints.length;++i){if(typeof e.videoResolutionConstraints[i]!="object")throw TypeError(".License.KeyContainer.videoResolutionConstraints: object expected");n.videoResolutionConstraints[i]=c.License.KeyContainer.VideoResolutionConstraint.fromObject(e.videoResolutionConstraints[i])}}return e.antiRollbackUsageTable!=null&&(n.antiRollbackUsageTable=!!e.antiRollbackUsageTable),e.trackLabel!=null&&(n.trackLabel=String(e.trackLabel)),n},r.toObject=function(e,n){n||(n={});var i={};if((n.arrays||n.defaults)&&(i.videoResolutionConstraints=[]),n.defaults&&(n.bytes===String?i.id="":(i.id=[],n.bytes!==Array&&(i.id=a.newBuffer(i.id))),n.bytes===String?i.iv="":(i.iv=[],n.bytes!==Array&&(i.iv=a.newBuffer(i.iv))),n.bytes===String?i.key="":(i.key=[],n.bytes!==Array&&(i.key=a.newBuffer(i.key))),i.type=n.enums===String?"SIGNING":1,i.level=n.enums===String?"SW_SECURE_CRYPTO":1,i.requiredProtection=null,i.requestedProtection=null,i.keyControl=null,i.operatorSessionKeyPermissions=null,i.antiRollbackUsageTable=!1,i.trackLabel=""),e.id!=null&&e.hasOwnProperty("id")&&(i.id=n.bytes===String?a.base64.encode(e.id,0,e.id.length):n.bytes===Array?Array.prototype.slice.call(e.id):e.id),e.iv!=null&&e.hasOwnProperty("iv")&&(i.iv=n.bytes===String?a.base64.encode(e.iv,0,e.iv.length):n.bytes===Array?Array.prototype.slice.call(e.iv):e.iv),e.key!=null&&e.hasOwnProperty("key")&&(i.key=n.bytes===String?a.base64.encode(e.key,0,e.key.length):n.bytes===Array?Array.prototype.slice.call(e.key):e.key),e.type!=null&&e.hasOwnProperty("type")&&(i.type=n.enums===String?c.License.KeyContainer.KeyType[e.type]===void 0?e.type:c.License.KeyContainer.KeyType[e.type]:e.type),e.level!=null&&e.hasOwnProperty("level")&&(i.level=n.enums===String?c.License.KeyContainer.SecurityLevel[e.level]===void 0?e.level:c.License.KeyContainer.SecurityLevel[e.level]:e.level),e.requiredProtection!=null&&e.hasOwnProperty("requiredProtection")&&(i.requiredProtection=c.License.KeyContainer.OutputProtection.toObject(e.requiredProtection,n)),e.requestedProtection!=null&&e.hasOwnProperty("requestedProtection")&&(i.requestedProtection=c.License.KeyContainer.OutputProtection.toObject(e.requestedProtection,n)),e.keyControl!=null&&e.hasOwnProperty("keyControl")&&(i.keyControl=c.License.KeyContainer.KeyControl.toObject(e.keyControl,n)),e.operatorSessionKeyPermissions!=null&&e.hasOwnProperty("operatorSessionKeyPermissions")&&(i.operatorSessionKeyPermissions=c.License.KeyContainer.OperatorSessionKeyPermissions.toObject(e.operatorSessionKeyPermissions,n)),e.videoResolutionConstraints&&e.videoResolutionConstraints.length){i.videoResolutionConstraints=[];for(var s=0;s<e.videoResolutionConstraints.length;++s)i.videoResolutionConstraints[s]=c.License.KeyContainer.VideoResolutionConstraint.toObject(e.videoResolutionConstraints[s],n)}return e.antiRollbackUsageTable!=null&&e.hasOwnProperty("antiRollbackUsageTable")&&(i.antiRollbackUsageTable=e.antiRollbackUsageTable),e.trackLabel!=null&&e.hasOwnProperty("trackLabel")&&(i.trackLabel=e.trackLabel),i},r.prototype.toJSON=function(){return this.constructor.toObject(this,p.util.toJSONOptions)},r.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/License.KeyContainer"},r.KeyType=function(){let t={},e=Object.create(t);return e[t[1]="SIGNING"]=1,e[t[2]="CONTENT"]=2,e[t[3]="KEY_CONTROL"]=3,e[t[4]="OPERATOR_SESSION"]=4,e[t[5]="ENTITLEMENT"]=5,e[t[6]="OEM_CONTENT"]=6,e}(),r.SecurityLevel=function(){let t={},e=Object.create(t);return e[t[1]="SW_SECURE_CRYPTO"]=1,e[t[2]="SW_SECURE_DECODE"]=2,e[t[3]="HW_SECURE_CRYPTO"]=3,e[t[4]="HW_SECURE_DECODE"]=4,e[t[5]="HW_SECURE_ALL"]=5,e}(),r.KeyControl=function(){function t(e){if(e)for(var n=Object.keys(e),i=0;i<n.length;++i)e[n[i]]!=null&&(this[n[i]]=e[n[i]])}return t.prototype.keyControlBlock=a.newBuffer([]),t.prototype.iv=a.newBuffer([]),t.create=function(n){return new t(n)},t.encode=function(n,i){return i||(i=d.create()),n.keyControlBlock!=null&&Object.hasOwnProperty.call(n,"keyControlBlock")&&i.uint32(10).bytes(n.keyControlBlock),n.iv!=null&&Object.hasOwnProperty.call(n,"iv")&&i.uint32(18).bytes(n.iv),i},t.encodeDelimited=function(n,i){return this.encode(n,i).ldelim()},t.decode=function(n,i){n instanceof u||(n=u.create(n));for(var s=i===void 0?n.len:n.pos+i,l=new c.License.KeyContainer.KeyControl;n.pos<s;){var y=n.uint32();switch(y>>>3){case 1:{l.keyControlBlock=n.bytes();break}case 2:{l.iv=n.bytes();break}default:n.skipType(y&7);break}}return l},t.decodeDelimited=function(n){return n instanceof u||(n=new u(n)),this.decode(n,n.uint32())},t.fromObject=function(n){if(n instanceof c.License.KeyContainer.KeyControl)return n;var i=new c.License.KeyContainer.KeyControl;return n.keyControlBlock!=null&&(typeof n.keyControlBlock=="string"?a.base64.decode(n.keyControlBlock,i.keyControlBlock=a.newBuffer(a.base64.length(n.keyControlBlock)),0):n.keyControlBlock.length>=0&&(i.keyControlBlock=n.keyControlBlock)),n.iv!=null&&(typeof n.iv=="string"?a.base64.decode(n.iv,i.iv=a.newBuffer(a.base64.length(n.iv)),0):n.iv.length>=0&&(i.iv=n.iv)),i},t.toObject=function(n,i){i||(i={});var s={};return i.defaults&&(i.bytes===String?s.keyControlBlock="":(s.keyControlBlock=[],i.bytes!==Array&&(s.keyControlBlock=a.newBuffer(s.keyControlBlock))),i.bytes===String?s.iv="":(s.iv=[],i.bytes!==Array&&(s.iv=a.newBuffer(s.iv)))),n.keyControlBlock!=null&&n.hasOwnProperty("keyControlBlock")&&(s.keyControlBlock=i.bytes===String?a.base64.encode(n.keyControlBlock,0,n.keyControlBlock.length):i.bytes===Array?Array.prototype.slice.call(n.keyControlBlock):n.keyControlBlock),n.iv!=null&&n.hasOwnProperty("iv")&&(s.iv=i.bytes===String?a.base64.encode(n.iv,0,n.iv.length):i.bytes===Array?Array.prototype.slice.call(n.iv):n.iv),s},t.prototype.toJSON=function(){return this.constructor.toObject(this,p.util.toJSONOptions)},t.getTypeUrl=function(n){return n===void 0&&(n="type.googleapis.com"),n+"/License.KeyContainer.KeyControl"},t}(),r.OutputProtection=function(){function t(e){if(e)for(var n=Object.keys(e),i=0;i<n.length;++i)e[n[i]]!=null&&(this[n[i]]=e[n[i]])}return t.prototype.hdcp=0,t.prototype.cgmsFlags=42,t.prototype.hdcpSrmRule=0,t.prototype.disableAnalogOutput=!1,t.prototype.disableDigitalOutput=!1,t.create=function(n){return new t(n)},t.encode=function(n,i){return i||(i=d.create()),n.hdcp!=null&&Object.hasOwnProperty.call(n,"hdcp")&&i.uint32(8).int32(n.hdcp),n.cgmsFlags!=null&&Object.hasOwnProperty.call(n,"cgmsFlags")&&i.uint32(16).int32(n.cgmsFlags),n.hdcpSrmRule!=null&&Object.hasOwnProperty.call(n,"hdcpSrmRule")&&i.uint32(24).int32(n.hdcpSrmRule),n.disableAnalogOutput!=null&&Object.hasOwnProperty.call(n,"disableAnalogOutput")&&i.uint32(32).bool(n.disableAnalogOutput),n.disableDigitalOutput!=null&&Object.hasOwnProperty.call(n,"disableDigitalOutput")&&i.uint32(40).bool(n.disableDigitalOutput),i},t.encodeDelimited=function(n,i){return this.encode(n,i).ldelim()},t.decode=function(n,i){n instanceof u||(n=u.create(n));for(var s=i===void 0?n.len:n.pos+i,l=new c.License.KeyContainer.OutputProtection;n.pos<s;){var y=n.uint32();switch(y>>>3){case 1:{l.hdcp=n.int32();break}case 2:{l.cgmsFlags=n.int32();break}case 3:{l.hdcpSrmRule=n.int32();break}case 4:{l.disableAnalogOutput=n.bool();break}case 5:{l.disableDigitalOutput=n.bool();break}default:n.skipType(y&7);break}}return l},t.decodeDelimited=function(n){return n instanceof u||(n=new u(n)),this.decode(n,n.uint32())},t.fromObject=function(n){if(n instanceof c.License.KeyContainer.OutputProtection)return n;var i=new c.License.KeyContainer.OutputProtection;switch(n.hdcp){default:if(typeof n.hdcp=="number"){i.hdcp=n.hdcp;break}break;case"HDCP_NONE":case 0:i.hdcp=0;break;case"HDCP_V1":case 1:i.hdcp=1;break;case"HDCP_V2":case 2:i.hdcp=2;break;case"HDCP_V2_1":case 3:i.hdcp=3;break;case"HDCP_V2_2":case 4:i.hdcp=4;break;case"HDCP_V2_3":case 5:i.hdcp=5;break;case"HDCP_NO_DIGITAL_OUTPUT":case 255:i.hdcp=255;break}switch(n.cgmsFlags){default:if(typeof n.cgmsFlags=="number"){i.cgmsFlags=n.cgmsFlags;break}break;case"CGMS_NONE":case 42:i.cgmsFlags=42;break;case"COPY_FREE":case 0:i.cgmsFlags=0;break;case"COPY_ONCE":case 2:i.cgmsFlags=2;break;case"COPY_NEVER":case 3:i.cgmsFlags=3;break}switch(n.hdcpSrmRule){default:if(typeof n.hdcpSrmRule=="number"){i.hdcpSrmRule=n.hdcpSrmRule;break}break;case"HDCP_SRM_RULE_NONE":case 0:i.hdcpSrmRule=0;break;case"CURRENT_SRM":case 1:i.hdcpSrmRule=1;break}return n.disableAnalogOutput!=null&&(i.disableAnalogOutput=!!n.disableAnalogOutput),n.disableDigitalOutput!=null&&(i.disableDigitalOutput=!!n.disableDigitalOutput),i},t.toObject=function(n,i){i||(i={});var s={};return i.defaults&&(s.hdcp=i.enums===String?"HDCP_NONE":0,s.cgmsFlags=i.enums===String?"CGMS_NONE":42,s.hdcpSrmRule=i.enums===String?"HDCP_SRM_RULE_NONE":0,s.disableAnalogOutput=!1,s.disableDigitalOutput=!1),n.hdcp!=null&&n.hasOwnProperty("hdcp")&&(s.hdcp=i.enums===String?c.License.KeyContainer.OutputProtection.HDCP[n.hdcp]===void 0?n.hdcp:c.License.KeyContainer.OutputProtection.HDCP[n.hdcp]:n.hdcp),n.cgmsFlags!=null&&n.hasOwnProperty("cgmsFlags")&&(s.cgmsFlags=i.enums===String?c.License.KeyContainer.OutputProtection.CGMS[n.cgmsFlags]===void 0?n.cgmsFlags:c.License.KeyContainer.OutputProtection.CGMS[n.cgmsFlags]:n.cgmsFlags),n.hdcpSrmRule!=null&&n.hasOwnProperty("hdcpSrmRule")&&(s.hdcpSrmRule=i.enums===String?c.License.KeyContainer.OutputProtection.HdcpSrmRule[n.hdcpSrmRule]===void 0?n.hdcpSrmRule:c.License.KeyContainer.OutputProtection.HdcpSrmRule[n.hdcpSrmRule]:n.hdcpSrmRule),n.disableAnalogOutput!=null&&n.hasOwnProperty("disableAnalogOutput")&&(s.disableAnalogOutput=n.disableAnalogOutput),n.disableDigitalOutput!=null&&n.hasOwnProperty("disableDigitalOutput")&&(s.disableDigitalOutput=n.disableDigitalOutput),s},t.prototype.toJSON=function(){return this.constructor.toObject(this,p.util.toJSONOptions)},t.getTypeUrl=function(n){return n===void 0&&(n="type.googleapis.com"),n+"/License.KeyContainer.OutputProtection"},t.HDCP=function(){let e={},n=Object.create(e);return n[e[0]="HDCP_NONE"]=0,n[e[1]="HDCP_V1"]=1,n[e[2]="HDCP_V2"]=2,n[e[3]="HDCP_V2_1"]=3,n[e[4]="HDCP_V2_2"]=4,n[e[5]="HDCP_V2_3"]=5,n[e[255]="HDCP_NO_DIGITAL_OUTPUT"]=255,n}(),t.CGMS=function(){let e={},n=Object.create(e);return n[e[42]="CGMS_NONE"]=42,n[e[0]="COPY_FREE"]=0,n[e[2]="COPY_ONCE"]=2,n[e[3]="COPY_NEVER"]=3,n}(),t.HdcpSrmRule=function(){let e={},n=Object.create(e);return n[e[0]="HDCP_SRM_RULE_NONE"]=0,n[e[1]="CURRENT_SRM"]=1,n}(),t}(),r.VideoResolutionConstraint=function(){function t(e){if(e)for(var n=Object.keys(e),i=0;i<n.length;++i)e[n[i]]!=null&&(this[n[i]]=e[n[i]])}return t.prototype.minResolutionPixels=0,t.prototype.maxResolutionPixels=0,t.prototype.requiredProtection=null,t.create=function(n){return new t(n)},t.encode=function(n,i){return i||(i=d.create()),n.minResolutionPixels!=null&&Object.hasOwnProperty.call(n,"minResolutionPixels")&&i.uint32(8).uint32(n.minResolutionPixels),n.maxResolutionPixels!=null&&Object.hasOwnProperty.call(n,"maxResolutionPixels")&&i.uint32(16).uint32(n.maxResolutionPixels),n.requiredProtection!=null&&Object.hasOwnProperty.call(n,"requiredProtection")&&c.License.KeyContainer.OutputProtection.encode(n.requiredProtection,i.uint32(26).fork()).ldelim(),i},t.encodeDelimited=function(n,i){return this.encode(n,i).ldelim()},t.decode=function(n,i){n instanceof u||(n=u.create(n));for(var s=i===void 0?n.len:n.pos+i,l=new c.License.KeyContainer.VideoResolutionConstraint;n.pos<s;){var y=n.uint32();switch(y>>>3){case 1:{l.minResolutionPixels=n.uint32();break}case 2:{l.maxResolutionPixels=n.uint32();break}case 3:{l.requiredProtection=c.License.KeyContainer.OutputProtection.decode(n,n.uint32());break}default:n.skipType(y&7);break}}return l},t.decodeDelimited=function(n){return n instanceof u||(n=new u(n)),this.decode(n,n.uint32())},t.fromObject=function(n){if(n instanceof c.License.KeyContainer.VideoResolutionConstraint)return n;var i=new c.License.KeyContainer.VideoResolutionConstraint;if(n.minResolutionPixels!=null&&(i.minResolutionPixels=n.minResolutionPixels>>>0),n.maxResolutionPixels!=null&&(i.maxResolutionPixels=n.maxResolutionPixels>>>0),n.requiredProtection!=null){if(typeof n.requiredProtection!="object")throw TypeError(".License.KeyContainer.VideoResolutionConstraint.requiredProtection: object expected");i.requiredProtection=c.License.KeyContainer.OutputProtection.fromObject(n.requiredProtection)}return i},t.toObject=function(n,i){i||(i={});var s={};return i.defaults&&(s.minResolutionPixels=0,s.maxResolutionPixels=0,s.requiredProtection=null),n.minResolutionPixels!=null&&n.hasOwnProperty("minResolutionPixels")&&(s.minResolutionPixels=n.minResolutionPixels),n.maxResolutionPixels!=null&&n.hasOwnProperty("maxResolutionPixels")&&(s.maxResolutionPixels=n.maxResolutionPixels),n.requiredProtection!=null&&n.hasOwnProperty("requiredProtection")&&(s.requiredProtection=c.License.KeyContainer.OutputProtection.toObject(n.requiredProtection,i)),s},t.prototype.toJSON=function(){return this.constructor.toObject(this,p.util.toJSONOptions)},t.getTypeUrl=function(n){return n===void 0&&(n="type.googleapis.com"),n+"/License.KeyContainer.VideoResolutionConstraint"},t}(),r.OperatorSessionKeyPermissions=function(){function t(e){if(e)for(var n=Object.keys(e),i=0;i<n.length;++i)e[n[i]]!=null&&(this[n[i]]=e[n[i]])}return t.prototype.allowEncrypt=!1,t.prototype.allowDecrypt=!1,t.prototype.allowSign=!1,t.prototype.allowSignatureVerify=!1,t.create=function(n){return new t(n)},t.encode=function(n,i){return i||(i=d.create()),n.allowEncrypt!=null&&Object.hasOwnProperty.call(n,"allowEncrypt")&&i.uint32(8).bool(n.allowEncrypt),n.allowDecrypt!=null&&Object.hasOwnProperty.call(n,"allowDecrypt")&&i.uint32(16).bool(n.allowDecrypt),n.allowSign!=null&&Object.hasOwnProperty.call(n,"allowSign")&&i.uint32(24).bool(n.allowSign),n.allowSignatureVerify!=null&&Object.hasOwnProperty.call(n,"allowSignatureVerify")&&i.uint32(32).bool(n.allowSignatureVerify),i},t.encodeDelimited=function(n,i){return this.encode(n,i).ldelim()},t.decode=function(n,i){n instanceof u||(n=u.create(n));for(var s=i===void 0?n.len:n.pos+i,l=new c.License.KeyContainer.OperatorSessionKeyPermissions;n.pos<s;){var y=n.uint32();switch(y>>>3){case 1:{l.allowEncrypt=n.bool();break}case 2:{l.allowDecrypt=n.bool();break}case 3:{l.allowSign=n.bool();break}case 4:{l.allowSignatureVerify=n.bool();break}default:n.skipType(y&7);break}}return l},t.decodeDelimited=function(n){return n instanceof u||(n=new u(n)),this.decode(n,n.uint32())},t.fromObject=function(n){if(n instanceof c.License.KeyContainer.OperatorSessionKeyPermissions)return n;var i=new c.License.KeyContainer.OperatorSessionKeyPermissions;return n.allowEncrypt!=null&&(i.allowEncrypt=!!n.allowEncrypt),n.allowDecrypt!=null&&(i.allowDecrypt=!!n.allowDecrypt),n.allowSign!=null&&(i.allowSign=!!n.allowSign),n.allowSignatureVerify!=null&&(i.allowSignatureVerify=!!n.allowSignatureVerify),i},t.toObject=function(n,i){i||(i={});var s={};return i.defaults&&(s.allowEncrypt=!1,s.allowDecrypt=!1,s.allowSign=!1,s.allowSignatureVerify=!1),n.allowEncrypt!=null&&n.hasOwnProperty("allowEncrypt")&&(s.allowEncrypt=n.allowEncrypt),n.allowDecrypt!=null&&n.hasOwnProperty("allowDecrypt")&&(s.allowDecrypt=n.allowDecrypt),n.allowSign!=null&&n.hasOwnProperty("allowSign")&&(s.allowSign=n.allowSign),n.allowSignatureVerify!=null&&n.hasOwnProperty("allowSignatureVerify")&&(s.allowSignatureVerify=n.allowSignatureVerify),s},t.prototype.toJSON=function(){return this.constructor.toObject(this,p.util.toJSONOptions)},t.getTypeUrl=function(n){return n===void 0&&(n="type.googleapis.com"),n+"/License.KeyContainer.OperatorSessionKeyPermissions"},t}(),r}(),o})(),le=c.ProtocolVersion=(()=>{let o={},r=Object.create(o);return r[o[20]="VERSION_2_0"]=20,r[o[21]="VERSION_2_1"]=21,r[o[22]="VERSION_2_2"]=22,r})(),_=c.LicenseRequest=(()=>{function o(r){if(r)for(var t=Object.keys(r),e=0;e<t.length;++e)r[t[e]]!=null&&(this[t[e]]=r[t[e]])}return o.prototype.clientId=null,o.prototype.contentId=null,o.prototype.type=1,o.prototype.requestTime=a.Long?a.Long.fromBits(0,0,!1):0,o.prototype.keyControlNonceDeprecated=a.newBuffer([]),o.prototype.protocolVersion=20,o.prototype.keyControlNonce=0,o.prototype.encryptedClientId=null,o.create=function(t){return new o(t)},o.encode=function(t,e){return e||(e=d.create()),t.clientId!=null&&Object.hasOwnProperty.call(t,"clientId")&&c.ClientIdentification.encode(t.clientId,e.uint32(10).fork()).ldelim(),t.contentId!=null&&Object.hasOwnProperty.call(t,"contentId")&&c.LicenseRequest.ContentIdentification.encode(t.contentId,e.uint32(18).fork()).ldelim(),t.type!=null&&Object.hasOwnProperty.call(t,"type")&&e.uint32(24).int32(t.type),t.requestTime!=null&&Object.hasOwnProperty.call(t,"requestTime")&&e.uint32(32).int64(t.requestTime),t.keyControlNonceDeprecated!=null&&Object.hasOwnProperty.call(t,"keyControlNonceDeprecated")&&e.uint32(42).bytes(t.keyControlNonceDeprecated),t.protocolVersion!=null&&Object.hasOwnProperty.call(t,"protocolVersion")&&e.uint32(48).int32(t.protocolVersion),t.keyControlNonce!=null&&Object.hasOwnProperty.call(t,"keyControlNonce")&&e.uint32(56).uint32(t.keyControlNonce),t.encryptedClientId!=null&&Object.hasOwnProperty.call(t,"encryptedClientId")&&c.EncryptedClientIdentification.encode(t.encryptedClientId,e.uint32(66).fork()).ldelim(),e},o.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},o.decode=function(t,e){t instanceof u||(t=u.create(t));for(var n=e===void 0?t.len:t.pos+e,i=new c.LicenseRequest;t.pos<n;){var s=t.uint32();switch(s>>>3){case 1:{i.clientId=c.ClientIdentification.decode(t,t.uint32());break}case 2:{i.contentId=c.LicenseRequest.ContentIdentification.decode(t,t.uint32());break}case 3:{i.type=t.int32();break}case 4:{i.requestTime=t.int64();break}case 5:{i.keyControlNonceDeprecated=t.bytes();break}case 6:{i.protocolVersion=t.int32();break}case 7:{i.keyControlNonce=t.uint32();break}case 8:{i.encryptedClientId=c.EncryptedClientIdentification.decode(t,t.uint32());break}default:t.skipType(s&7);break}}return i},o.decodeDelimited=function(t){return t instanceof u||(t=new u(t)),this.decode(t,t.uint32())},o.fromObject=function(t){if(t instanceof c.LicenseRequest)return t;var e=new c.LicenseRequest;if(t.clientId!=null){if(typeof t.clientId!="object")throw TypeError(".LicenseRequest.clientId: object expected");e.clientId=c.ClientIdentification.fromObject(t.clientId)}if(t.contentId!=null){if(typeof t.contentId!="object")throw TypeError(".LicenseRequest.contentId: object expected");e.contentId=c.LicenseRequest.ContentIdentification.fromObject(t.contentId)}switch(t.type){default:if(typeof t.type=="number"){e.type=t.type;break}break;case"NEW":case 1:e.type=1;break;case"RENEWAL":case 2:e.type=2;break;case"RELEASE":case 3:e.type=3;break}switch(t.requestTime!=null&&(a.Long?(e.requestTime=a.Long.fromValue(t.requestTime)).unsigned=!1:typeof t.requestTime=="string"?e.requestTime=parseInt(t.requestTime,10):typeof t.requestTime=="number"?e.requestTime=t.requestTime:typeof t.requestTime=="object"&&(e.requestTime=new a.LongBits(t.requestTime.low>>>0,t.requestTime.high>>>0).toNumber())),t.keyControlNonceDeprecated!=null&&(typeof t.keyControlNonceDeprecated=="string"?a.base64.decode(t.keyControlNonceDeprecated,e.keyControlNonceDeprecated=a.newBuffer(a.base64.length(t.keyControlNonceDeprecated)),0):t.keyControlNonceDeprecated.length>=0&&(e.keyControlNonceDeprecated=t.keyControlNonceDeprecated)),t.protocolVersion){default:if(typeof t.protocolVersion=="number"){e.protocolVersion=t.protocolVersion;break}break;case"VERSION_2_0":case 20:e.protocolVersion=20;break;case"VERSION_2_1":case 21:e.protocolVersion=21;break;case"VERSION_2_2":case 22:e.protocolVersion=22;break}if(t.keyControlNonce!=null&&(e.keyControlNonce=t.keyControlNonce>>>0),t.encryptedClientId!=null){if(typeof t.encryptedClientId!="object")throw TypeError(".LicenseRequest.encryptedClientId: object expected");e.encryptedClientId=c.EncryptedClientIdentification.fromObject(t.encryptedClientId)}return e},o.toObject=function(t,e){e||(e={});var n={};if(e.defaults){if(n.clientId=null,n.contentId=null,n.type=e.enums===String?"NEW":1,a.Long){var i=new a.Long(0,0,!1);n.requestTime=e.longs===String?i.toString():e.longs===Number?i.toNumber():i}else n.requestTime=e.longs===String?"0":0;e.bytes===String?n.keyControlNonceDeprecated="":(n.keyControlNonceDeprecated=[],e.bytes!==Array&&(n.keyControlNonceDeprecated=a.newBuffer(n.keyControlNonceDeprecated))),n.protocolVersion=e.enums===String?"VERSION_2_0":20,n.keyControlNonce=0,n.encryptedClientId=null}return t.clientId!=null&&t.hasOwnProperty("clientId")&&(n.clientId=c.ClientIdentification.toObject(t.clientId,e)),t.contentId!=null&&t.hasOwnProperty("contentId")&&(n.contentId=c.LicenseRequest.ContentIdentification.toObject(t.contentId,e)),t.type!=null&&t.hasOwnProperty("type")&&(n.type=e.enums===String?c.LicenseRequest.RequestType[t.type]===void 0?t.type:c.LicenseRequest.RequestType[t.type]:t.type),t.requestTime!=null&&t.hasOwnProperty("requestTime")&&(typeof t.requestTime=="number"?n.requestTime=e.longs===String?String(t.requestTime):t.requestTime:n.requestTime=e.longs===String?a.Long.prototype.toString.call(t.requestTime):e.longs===Number?new a.LongBits(t.requestTime.low>>>0,t.requestTime.high>>>0).toNumber():t.requestTime),t.keyControlNonceDeprecated!=null&&t.hasOwnProperty("keyControlNonceDeprecated")&&(n.keyControlNonceDeprecated=e.bytes===String?a.base64.encode(t.keyControlNonceDeprecated,0,t.keyControlNonceDeprecated.length):e.bytes===Array?Array.prototype.slice.call(t.keyControlNonceDeprecated):t.keyControlNonceDeprecated),t.protocolVersion!=null&&t.hasOwnProperty("protocolVersion")&&(n.protocolVersion=e.enums===String?c.ProtocolVersion[t.protocolVersion]===void 0?t.protocolVersion:c.ProtocolVersion[t.protocolVersion]:t.protocolVersion),t.keyControlNonce!=null&&t.hasOwnProperty("keyControlNonce")&&(n.keyControlNonce=t.keyControlNonce),t.encryptedClientId!=null&&t.hasOwnProperty("encryptedClientId")&&(n.encryptedClientId=c.EncryptedClientIdentification.toObject(t.encryptedClientId,e)),n},o.prototype.toJSON=function(){return this.constructor.toObject(this,p.util.toJSONOptions)},o.getTypeUrl=function(t){return t===void 0&&(t="type.googleapis.com"),t+"/LicenseRequest"},o.ContentIdentification=function(){function r(e){if(e)for(var n=Object.keys(e),i=0;i<n.length;++i)e[n[i]]!=null&&(this[n[i]]=e[n[i]])}r.prototype.widevinePsshData=null,r.prototype.webmKeyId=null,r.prototype.existingLicense=null,r.prototype.initData=null;let t;return Object.defineProperty(r.prototype,"contentIdVariant",{get:a.oneOfGetter(t=["widevinePsshData","webmKeyId","existingLicense","initData"]),set:a.oneOfSetter(t)}),r.create=function(n){return new r(n)},r.encode=function(n,i){return i||(i=d.create()),n.widevinePsshData!=null&&Object.hasOwnProperty.call(n,"widevinePsshData")&&c.LicenseRequest.ContentIdentification.WidevinePsshData.encode(n.widevinePsshData,i.uint32(10).fork()).ldelim(),n.webmKeyId!=null&&Object.hasOwnProperty.call(n,"webmKeyId")&&c.LicenseRequest.ContentIdentification.WebmKeyId.encode(n.webmKeyId,i.uint32(18).fork()).ldelim(),n.existingLicense!=null&&Object.hasOwnProperty.call(n,"existingLicense")&&c.LicenseRequest.ContentIdentification.ExistingLicense.encode(n.existingLicense,i.uint32(26).fork()).ldelim(),n.initData!=null&&Object.hasOwnProperty.call(n,"initData")&&c.LicenseRequest.ContentIdentification.InitData.encode(n.initData,i.uint32(34).fork()).ldelim(),i},r.encodeDelimited=function(n,i){return this.encode(n,i).ldelim()},r.decode=function(n,i){n instanceof u||(n=u.create(n));for(var s=i===void 0?n.len:n.pos+i,l=new c.LicenseRequest.ContentIdentification;n.pos<s;){var y=n.uint32();switch(y>>>3){case 1:{l.widevinePsshData=c.LicenseRequest.ContentIdentification.WidevinePsshData.decode(n,n.uint32());break}case 2:{l.webmKeyId=c.LicenseRequest.ContentIdentification.WebmKeyId.decode(n,n.uint32());break}case 3:{l.existingLicense=c.LicenseRequest.ContentIdentification.ExistingLicense.decode(n,n.uint32());break}case 4:{l.initData=c.LicenseRequest.ContentIdentification.InitData.decode(n,n.uint32());break}default:n.skipType(y&7);break}}return l},r.decodeDelimited=function(n){return n instanceof u||(n=new u(n)),this.decode(n,n.uint32())},r.fromObject=function(n){if(n instanceof c.LicenseRequest.ContentIdentification)return n;var i=new c.LicenseRequest.ContentIdentification;if(n.widevinePsshData!=null){if(typeof n.widevinePsshData!="object")throw TypeError(".LicenseRequest.ContentIdentification.widevinePsshData: object expected");i.widevinePsshData=c.LicenseRequest.ContentIdentification.WidevinePsshData.fromObject(n.widevinePsshData)}if(n.webmKeyId!=null){if(typeof n.webmKeyId!="object")throw TypeError(".LicenseRequest.ContentIdentification.webmKeyId: object expected");i.webmKeyId=c.LicenseRequest.ContentIdentification.WebmKeyId.fromObject(n.webmKeyId)}if(n.existingLicense!=null){if(typeof n.existingLicense!="object")throw TypeError(".LicenseRequest.ContentIdentification.existingLicense: object expected");i.existingLicense=c.LicenseRequest.ContentIdentification.ExistingLicense.fromObject(n.existingLicense)}if(n.initData!=null){if(typeof n.initData!="object")throw TypeError(".LicenseRequest.ContentIdentification.initData: object expected");i.initData=c.LicenseRequest.ContentIdentification.InitData.fromObject(n.initData)}return i},r.toObject=function(n,i){i||(i={});var s={};return n.widevinePsshData!=null&&n.hasOwnProperty("widevinePsshData")&&(s.widevinePsshData=c.LicenseRequest.ContentIdentification.WidevinePsshData.toObject(n.widevinePsshData,i),i.oneofs&&(s.contentIdVariant="widevinePsshData")),n.webmKeyId!=null&&n.hasOwnProperty("webmKeyId")&&(s.webmKeyId=c.LicenseRequest.ContentIdentification.WebmKeyId.toObject(n.webmKeyId,i),i.oneofs&&(s.contentIdVariant="webmKeyId")),n.existingLicense!=null&&n.hasOwnProperty("existingLicense")&&(s.existingLicense=c.LicenseRequest.ContentIdentification.ExistingLicense.toObject(n.existingLicense,i),i.oneofs&&(s.contentIdVariant="existingLicense")),n.initData!=null&&n.hasOwnProperty("initData")&&(s.initData=c.LicenseRequest.ContentIdentification.InitData.toObject(n.initData,i),i.oneofs&&(s.contentIdVariant="initData")),s},r.prototype.toJSON=function(){return this.constructor.toObject(this,p.util.toJSONOptions)},r.getTypeUrl=function(n){return n===void 0&&(n="type.googleapis.com"),n+"/LicenseRequest.ContentIdentification"},r.WidevinePsshData=function(){function e(n){if(this.psshData=[],n)for(var i=Object.keys(n),s=0;s<i.length;++s)n[i[s]]!=null&&(this[i[s]]=n[i[s]])}return e.prototype.psshData=a.emptyArray,e.prototype.licenseType=1,e.prototype.requestId=a.newBuffer([]),e.create=function(i){return new e(i)},e.encode=function(i,s){if(s||(s=d.create()),i.psshData!=null&&i.psshData.length)for(var l=0;l<i.psshData.length;++l)s.uint32(10).bytes(i.psshData[l]);return i.licenseType!=null&&Object.hasOwnProperty.call(i,"licenseType")&&s.uint32(16).int32(i.licenseType),i.requestId!=null&&Object.hasOwnProperty.call(i,"requestId")&&s.uint32(26).bytes(i.requestId),s},e.encodeDelimited=function(i,s){return this.encode(i,s).ldelim()},e.decode=function(i,s){i instanceof u||(i=u.create(i));for(var l=s===void 0?i.len:i.pos+s,y=new c.LicenseRequest.ContentIdentification.WidevinePsshData;i.pos<l;){var f=i.uint32();switch(f>>>3){case 1:{y.psshData&&y.psshData.length||(y.psshData=[]),y.psshData.push(i.bytes());break}case 2:{y.licenseType=i.int32();break}case 3:{y.requestId=i.bytes();break}default:i.skipType(f&7);break}}return y},e.decodeDelimited=function(i){return i instanceof u||(i=new u(i)),this.decode(i,i.uint32())},e.fromObject=function(i){if(i instanceof c.LicenseRequest.ContentIdentification.WidevinePsshData)return i;var s=new c.LicenseRequest.ContentIdentification.WidevinePsshData;if(i.psshData){if(!Array.isArray(i.psshData))throw TypeError(".LicenseRequest.ContentIdentification.WidevinePsshData.psshData: array expected");s.psshData=[];for(var l=0;l<i.psshData.length;++l)typeof i.psshData[l]=="string"?a.base64.decode(i.psshData[l],s.psshData[l]=a.newBuffer(a.base64.length(i.psshData[l])),0):i.psshData[l].length>=0&&(s.psshData[l]=i.psshData[l])}switch(i.licenseType){default:if(typeof i.licenseType=="number"){s.licenseType=i.licenseType;break}break;case"STREAMING":case 1:s.licenseType=1;break;case"OFFLINE":case 2:s.licenseType=2;break;case"AUTOMATIC":case 3:s.licenseType=3;break}return i.requestId!=null&&(typeof i.requestId=="string"?a.base64.decode(i.requestId,s.requestId=a.newBuffer(a.base64.length(i.requestId)),0):i.requestId.length>=0&&(s.requestId=i.requestId)),s},e.toObject=function(i,s){s||(s={});var l={};if((s.arrays||s.defaults)&&(l.psshData=[]),s.defaults&&(l.licenseType=s.enums===String?"STREAMING":1,s.bytes===String?l.requestId="":(l.requestId=[],s.bytes!==Array&&(l.requestId=a.newBuffer(l.requestId)))),i.psshData&&i.psshData.length){l.psshData=[];for(var y=0;y<i.psshData.length;++y)l.psshData[y]=s.bytes===String?a.base64.encode(i.psshData[y],0,i.psshData[y].length):s.bytes===Array?Array.prototype.slice.call(i.psshData[y]):i.psshData[y]}return i.licenseType!=null&&i.hasOwnProperty("licenseType")&&(l.licenseType=s.enums===String?c.LicenseType[i.licenseType]===void 0?i.licenseType:c.LicenseType[i.licenseType]:i.licenseType),i.requestId!=null&&i.hasOwnProperty("requestId")&&(l.requestId=s.bytes===String?a.base64.encode(i.requestId,0,i.requestId.length):s.bytes===Array?Array.prototype.slice.call(i.requestId):i.requestId),l},e.prototype.toJSON=function(){return this.constructor.toObject(this,p.util.toJSONOptions)},e.getTypeUrl=function(i){return i===void 0&&(i="type.googleapis.com"),i+"/LicenseRequest.ContentIdentification.WidevinePsshData"},e}(),r.WebmKeyId=function(){function e(n){if(n)for(var i=Object.keys(n),s=0;s<i.length;++s)n[i[s]]!=null&&(this[i[s]]=n[i[s]])}return e.prototype.header=a.newBuffer([]),e.prototype.licenseType=1,e.prototype.requestId=a.newBuffer([]),e.create=function(i){return new e(i)},e.encode=function(i,s){return s||(s=d.create()),i.header!=null&&Object.hasOwnProperty.call(i,"header")&&s.uint32(10).bytes(i.header),i.licenseType!=null&&Object.hasOwnProperty.call(i,"licenseType")&&s.uint32(16).int32(i.licenseType),i.requestId!=null&&Object.hasOwnProperty.call(i,"requestId")&&s.uint32(26).bytes(i.requestId),s},e.encodeDelimited=function(i,s){return this.encode(i,s).ldelim()},e.decode=function(i,s){i instanceof u||(i=u.create(i));for(var l=s===void 0?i.len:i.pos+s,y=new c.LicenseRequest.ContentIdentification.WebmKeyId;i.pos<l;){var f=i.uint32();switch(f>>>3){case 1:{y.header=i.bytes();break}case 2:{y.licenseType=i.int32();break}case 3:{y.requestId=i.bytes();break}default:i.skipType(f&7);break}}return y},e.decodeDelimited=function(i){return i instanceof u||(i=new u(i)),this.decode(i,i.uint32())},e.fromObject=function(i){if(i instanceof c.LicenseRequest.ContentIdentification.WebmKeyId)return i;var s=new c.LicenseRequest.ContentIdentification.WebmKeyId;switch(i.header!=null&&(typeof i.header=="string"?a.base64.decode(i.header,s.header=a.newBuffer(a.base64.length(i.header)),0):i.header.length>=0&&(s.header=i.header)),i.licenseType){default:if(typeof i.licenseType=="number"){s.licenseType=i.licenseType;break}break;case"STREAMING":case 1:s.licenseType=1;break;case"OFFLINE":case 2:s.licenseType=2;break;case"AUTOMATIC":case 3:s.licenseType=3;break}return i.requestId!=null&&(typeof i.requestId=="string"?a.base64.decode(i.requestId,s.requestId=a.newBuffer(a.base64.length(i.requestId)),0):i.requestId.length>=0&&(s.requestId=i.requestId)),s},e.toObject=function(i,s){s||(s={});var l={};return s.defaults&&(s.bytes===String?l.header="":(l.header=[],s.bytes!==Array&&(l.header=a.newBuffer(l.header))),l.licenseType=s.enums===String?"STREAMING":1,s.bytes===String?l.requestId="":(l.requestId=[],s.bytes!==Array&&(l.requestId=a.newBuffer(l.requestId)))),i.header!=null&&i.hasOwnProperty("header")&&(l.header=s.bytes===String?a.base64.encode(i.header,0,i.header.length):s.bytes===Array?Array.prototype.slice.call(i.header):i.header),i.licenseType!=null&&i.hasOwnProperty("licenseType")&&(l.licenseType=s.enums===String?c.LicenseType[i.licenseType]===void 0?i.licenseType:c.LicenseType[i.licenseType]:i.licenseType),i.requestId!=null&&i.hasOwnProperty("requestId")&&(l.requestId=s.bytes===String?a.base64.encode(i.requestId,0,i.requestId.length):s.bytes===Array?Array.prototype.slice.call(i.requestId):i.requestId),l},e.prototype.toJSON=function(){return this.constructor.toObject(this,p.util.toJSONOptions)},e.getTypeUrl=function(i){return i===void 0&&(i="type.googleapis.com"),i+"/LicenseRequest.ContentIdentification.WebmKeyId"},e}(),r.ExistingLicense=function(){function e(n){if(n)for(var i=Object.keys(n),s=0;s<i.length;++s)n[i[s]]!=null&&(this[i[s]]=n[i[s]])}return e.prototype.licenseId=null,e.prototype.secondsSinceStarted=a.Long?a.Long.fromBits(0,0,!1):0,e.prototype.secondsSinceLastPlayed=a.Long?a.Long.fromBits(0,0,!1):0,e.prototype.sessionUsageTableEntry=a.newBuffer([]),e.create=function(i){return new e(i)},e.encode=function(i,s){return s||(s=d.create()),i.licenseId!=null&&Object.hasOwnProperty.call(i,"licenseId")&&c.LicenseIdentification.encode(i.licenseId,s.uint32(10).fork()).ldelim(),i.secondsSinceStarted!=null&&Object.hasOwnProperty.call(i,"secondsSinceStarted")&&s.uint32(16).int64(i.secondsSinceStarted),i.secondsSinceLastPlayed!=null&&Object.hasOwnProperty.call(i,"secondsSinceLastPlayed")&&s.uint32(24).int64(i.secondsSinceLastPlayed),i.sessionUsageTableEntry!=null&&Object.hasOwnProperty.call(i,"sessionUsageTableEntry")&&s.uint32(34).bytes(i.sessionUsageTableEntry),s},e.encodeDelimited=function(i,s){return this.encode(i,s).ldelim()},e.decode=function(i,s){i instanceof u||(i=u.create(i));for(var l=s===void 0?i.len:i.pos+s,y=new c.LicenseRequest.ContentIdentification.ExistingLicense;i.pos<l;){var f=i.uint32();switch(f>>>3){case 1:{y.licenseId=c.LicenseIdentification.decode(i,i.uint32());break}case 2:{y.secondsSinceStarted=i.int64();break}case 3:{y.secondsSinceLastPlayed=i.int64();break}case 4:{y.sessionUsageTableEntry=i.bytes();break}default:i.skipType(f&7);break}}return y},e.decodeDelimited=function(i){return i instanceof u||(i=new u(i)),this.decode(i,i.uint32())},e.fromObject=function(i){if(i instanceof c.LicenseRequest.ContentIdentification.ExistingLicense)return i;var s=new c.LicenseRequest.ContentIdentification.ExistingLicense;if(i.licenseId!=null){if(typeof i.licenseId!="object")throw TypeError(".LicenseRequest.ContentIdentification.ExistingLicense.licenseId: object expected");s.licenseId=c.LicenseIdentification.fromObject(i.licenseId)}return i.secondsSinceStarted!=null&&(a.Long?(s.secondsSinceStarted=a.Long.fromValue(i.secondsSinceStarted)).unsigned=!1:typeof i.secondsSinceStarted=="string"?s.secondsSinceStarted=parseInt(i.secondsSinceStarted,10):typeof i.secondsSinceStarted=="number"?s.secondsSinceStarted=i.secondsSinceStarted:typeof i.secondsSinceStarted=="object"&&(s.secondsSinceStarted=new a.LongBits(i.secondsSinceStarted.low>>>0,i.secondsSinceStarted.high>>>0).toNumber())),i.secondsSinceLastPlayed!=null&&(a.Long?(s.secondsSinceLastPlayed=a.Long.fromValue(i.secondsSinceLastPlayed)).unsigned=!1:typeof i.secondsSinceLastPlayed=="string"?s.secondsSinceLastPlayed=parseInt(i.secondsSinceLastPlayed,10):typeof i.secondsSinceLastPlayed=="number"?s.secondsSinceLastPlayed=i.secondsSinceLastPlayed:typeof i.secondsSinceLastPlayed=="object"&&(s.secondsSinceLastPlayed=new a.LongBits(i.secondsSinceLastPlayed.low>>>0,i.secondsSinceLastPlayed.high>>>0).toNumber())),i.sessionUsageTableEntry!=null&&(typeof i.sessionUsageTableEntry=="string"?a.base64.decode(i.sessionUsageTableEntry,s.sessionUsageTableEntry=a.newBuffer(a.base64.length(i.sessionUsageTableEntry)),0):i.sessionUsageTableEntry.length>=0&&(s.sessionUsageTableEntry=i.sessionUsageTableEntry)),s},e.toObject=function(i,s){s||(s={});var l={};if(s.defaults){if(l.licenseId=null,a.Long){var y=new a.Long(0,0,!1);l.secondsSinceStarted=s.longs===String?y.toString():s.longs===Number?y.toNumber():y}else l.secondsSinceStarted=s.longs===String?"0":0;if(a.Long){var y=new a.Long(0,0,!1);l.secondsSinceLastPlayed=s.longs===String?y.toString():s.longs===Number?y.toNumber():y}else l.secondsSinceLastPlayed=s.longs===String?"0":0;s.bytes===String?l.sessionUsageTableEntry="":(l.sessionUsageTableEntry=[],s.bytes!==Array&&(l.sessionUsageTableEntry=a.newBuffer(l.sessionUsageTableEntry)))}return i.licenseId!=null&&i.hasOwnProperty("licenseId")&&(l.licenseId=c.LicenseIdentification.toObject(i.licenseId,s)),i.secondsSinceStarted!=null&&i.hasOwnProperty("secondsSinceStarted")&&(typeof i.secondsSinceStarted=="number"?l.secondsSinceStarted=s.longs===String?String(i.secondsSinceStarted):i.secondsSinceStarted:l.secondsSinceStarted=s.longs===String?a.Long.prototype.toString.call(i.secondsSinceStarted):s.longs===Number?new a.LongBits(i.secondsSinceStarted.low>>>0,i.secondsSinceStarted.high>>>0).toNumber():i.secondsSinceStarted),i.secondsSinceLastPlayed!=null&&i.hasOwnProperty("secondsSinceLastPlayed")&&(typeof i.secondsSinceLastPlayed=="number"?l.secondsSinceLastPlayed=s.longs===String?String(i.secondsSinceLastPlayed):i.secondsSinceLastPlayed:l.secondsSinceLastPlayed=s.longs===String?a.Long.prototype.toString.call(i.secondsSinceLastPlayed):s.longs===Number?new a.LongBits(i.secondsSinceLastPlayed.low>>>0,i.secondsSinceLastPlayed.high>>>0).toNumber():i.secondsSinceLastPlayed),i.sessionUsageTableEntry!=null&&i.hasOwnProperty("sessionUsageTableEntry")&&(l.sessionUsageTableEntry=s.bytes===String?a.base64.encode(i.sessionUsageTableEntry,0,i.sessionUsageTableEntry.length):s.bytes===Array?Array.prototype.slice.call(i.sessionUsageTableEntry):i.sessionUsageTableEntry),l},e.prototype.toJSON=function(){return this.constructor.toObject(this,p.util.toJSONOptions)},e.getTypeUrl=function(i){return i===void 0&&(i="type.googleapis.com"),i+"/LicenseRequest.ContentIdentification.ExistingLicense"},e}(),r.InitData=function(){function e(n){if(n)for(var i=Object.keys(n),s=0;s<i.length;++s)n[i[s]]!=null&&(this[i[s]]=n[i[s]])}return e.prototype.initDataType=1,e.prototype.initData=a.newBuffer([]),e.prototype.licenseType=1,e.prototype.requestId=a.newBuffer([]),e.create=function(i){return new e(i)},e.encode=function(i,s){return s||(s=d.create()),i.initDataType!=null&&Object.hasOwnProperty.call(i,"initDataType")&&s.uint32(8).int32(i.initDataType),i.initData!=null&&Object.hasOwnProperty.call(i,"initData")&&s.uint32(18).bytes(i.initData),i.licenseType!=null&&Object.hasOwnProperty.call(i,"licenseType")&&s.uint32(24).int32(i.licenseType),i.requestId!=null&&Object.hasOwnProperty.call(i,"requestId")&&s.uint32(34).bytes(i.requestId),s},e.encodeDelimited=function(i,s){return this.encode(i,s).ldelim()},e.decode=function(i,s){i instanceof u||(i=u.create(i));for(var l=s===void 0?i.len:i.pos+s,y=new c.LicenseRequest.ContentIdentification.InitData;i.pos<l;){var f=i.uint32();switch(f>>>3){case 1:{y.initDataType=i.int32();break}case 2:{y.initData=i.bytes();break}case 3:{y.licenseType=i.int32();break}case 4:{y.requestId=i.bytes();break}default:i.skipType(f&7);break}}return y},e.decodeDelimited=function(i){return i instanceof u||(i=new u(i)),this.decode(i,i.uint32())},e.fromObject=function(i){if(i instanceof c.LicenseRequest.ContentIdentification.InitData)return i;var s=new c.LicenseRequest.ContentIdentification.InitData;switch(i.initDataType){default:if(typeof i.initDataType=="number"){s.initDataType=i.initDataType;break}break;case"CENC":case 1:s.initDataType=1;break;case"WEBM":case 2:s.initDataType=2;break}switch(i.initData!=null&&(typeof i.initData=="string"?a.base64.decode(i.initData,s.initData=a.newBuffer(a.base64.length(i.initData)),0):i.initData.length>=0&&(s.initData=i.initData)),i.licenseType){default:if(typeof i.licenseType=="number"){s.licenseType=i.licenseType;break}break;case"STREAMING":case 1:s.licenseType=1;break;case"OFFLINE":case 2:s.licenseType=2;break;case"AUTOMATIC":case 3:s.licenseType=3;break}return i.requestId!=null&&(typeof i.requestId=="string"?a.base64.decode(i.requestId,s.requestId=a.newBuffer(a.base64.length(i.requestId)),0):i.requestId.length>=0&&(s.requestId=i.requestId)),s},e.toObject=function(i,s){s||(s={});var l={};return s.defaults&&(l.initDataType=s.enums===String?"CENC":1,s.bytes===String?l.initData="":(l.initData=[],s.bytes!==Array&&(l.initData=a.newBuffer(l.initData))),l.licenseType=s.enums===String?"STREAMING":1,s.bytes===String?l.requestId="":(l.requestId=[],s.bytes!==Array&&(l.requestId=a.newBuffer(l.requestId)))),i.initDataType!=null&&i.hasOwnProperty("initDataType")&&(l.initDataType=s.enums===String?c.LicenseRequest.ContentIdentification.InitData.InitDataType[i.initDataType]===void 0?i.initDataType:c.LicenseRequest.ContentIdentification.InitData.InitDataType[i.initDataType]:i.initDataType),i.initData!=null&&i.hasOwnProperty("initData")&&(l.initData=s.bytes===String?a.base64.encode(i.initData,0,i.initData.length):s.bytes===Array?Array.prototype.slice.call(i.initData):i.initData),i.licenseType!=null&&i.hasOwnProperty("licenseType")&&(l.licenseType=s.enums===String?c.LicenseType[i.licenseType]===void 0?i.licenseType:c.LicenseType[i.licenseType]:i.licenseType),i.requestId!=null&&i.hasOwnProperty("requestId")&&(l.requestId=s.bytes===String?a.base64.encode(i.requestId,0,i.requestId.length):s.bytes===Array?Array.prototype.slice.call(i.requestId):i.requestId),l},e.prototype.toJSON=function(){return this.constructor.toObject(this,p.util.toJSONOptions)},e.getTypeUrl=function(i){return i===void 0&&(i="type.googleapis.com"),i+"/LicenseRequest.ContentIdentification.InitData"},e.InitDataType=function(){let n={},i=Object.create(n);return i[n[1]="CENC"]=1,i[n[2]="WEBM"]=2,i}(),e}(),r}(),o.RequestType=function(){let r={},t=Object.create(r);return t[r[1]="NEW"]=1,t[r[2]="RENEWAL"]=2,t[r[3]="RELEASE"]=3,t}(),o})(),Et=c.MetricData=(()=>{function o(r){if(this.metricData=[],r)for(var t=Object.keys(r),e=0;e<t.length;++e)r[t[e]]!=null&&(this[t[e]]=r[t[e]])}return o.prototype.stageName="",o.prototype.metricData=a.emptyArray,o.create=function(t){return new o(t)},o.encode=function(t,e){if(e||(e=d.create()),t.stageName!=null&&Object.hasOwnProperty.call(t,"stageName")&&e.uint32(10).string(t.stageName),t.metricData!=null&&t.metricData.length)for(var n=0;n<t.metricData.length;++n)c.MetricData.TypeValue.encode(t.metricData[n],e.uint32(18).fork()).ldelim();return e},o.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},o.decode=function(t,e){t instanceof u||(t=u.create(t));for(var n=e===void 0?t.len:t.pos+e,i=new c.MetricData;t.pos<n;){var s=t.uint32();switch(s>>>3){case 1:{i.stageName=t.string();break}case 2:{i.metricData&&i.metricData.length||(i.metricData=[]),i.metricData.push(c.MetricData.TypeValue.decode(t,t.uint32()));break}default:t.skipType(s&7);break}}return i},o.decodeDelimited=function(t){return t instanceof u||(t=new u(t)),this.decode(t,t.uint32())},o.fromObject=function(t){if(t instanceof c.MetricData)return t;var e=new c.MetricData;if(t.stageName!=null&&(e.stageName=String(t.stageName)),t.metricData){if(!Array.isArray(t.metricData))throw TypeError(".MetricData.metricData: array expected");e.metricData=[];for(var n=0;n<t.metricData.length;++n){if(typeof t.metricData[n]!="object")throw TypeError(".MetricData.metricData: object expected");e.metricData[n]=c.MetricData.TypeValue.fromObject(t.metricData[n])}}return e},o.toObject=function(t,e){e||(e={});var n={};if((e.arrays||e.defaults)&&(n.metricData=[]),e.defaults&&(n.stageName=""),t.stageName!=null&&t.hasOwnProperty("stageName")&&(n.stageName=t.stageName),t.metricData&&t.metricData.length){n.metricData=[];for(var i=0;i<t.metricData.length;++i)n.metricData[i]=c.MetricData.TypeValue.toObject(t.metricData[i],e)}return n},o.prototype.toJSON=function(){return this.constructor.toObject(this,p.util.toJSONOptions)},o.getTypeUrl=function(t){return t===void 0&&(t="type.googleapis.com"),t+"/MetricData"},o.MetricType=function(){let r={},t=Object.create(r);return t[r[1]="LATENCY"]=1,t[r[2]="TIMESTAMP"]=2,t}(),o.TypeValue=function(){function r(t){if(t)for(var e=Object.keys(t),n=0;n<e.length;++n)t[e[n]]!=null&&(this[e[n]]=t[e[n]])}return r.prototype.type=1,r.prototype.value=a.Long?a.Long.fromBits(0,0,!1):0,r.create=function(e){return new r(e)},r.encode=function(e,n){return n||(n=d.create()),e.type!=null&&Object.hasOwnProperty.call(e,"type")&&n.uint32(8).int32(e.type),e.value!=null&&Object.hasOwnProperty.call(e,"value")&&n.uint32(16).int64(e.value),n},r.encodeDelimited=function(e,n){return this.encode(e,n).ldelim()},r.decode=function(e,n){e instanceof u||(e=u.create(e));for(var i=n===void 0?e.len:e.pos+n,s=new c.MetricData.TypeValue;e.pos<i;){var l=e.uint32();switch(l>>>3){case 1:{s.type=e.int32();break}case 2:{s.value=e.int64();break}default:e.skipType(l&7);break}}return s},r.decodeDelimited=function(e){return e instanceof u||(e=new u(e)),this.decode(e,e.uint32())},r.fromObject=function(e){if(e instanceof c.MetricData.TypeValue)return e;var n=new c.MetricData.TypeValue;switch(e.type){default:if(typeof e.type=="number"){n.type=e.type;break}break;case"LATENCY":case 1:n.type=1;break;case"TIMESTAMP":case 2:n.type=2;break}return e.value!=null&&(a.Long?(n.value=a.Long.fromValue(e.value)).unsigned=!1:typeof e.value=="string"?n.value=parseInt(e.value,10):typeof e.value=="number"?n.value=e.value:typeof e.value=="object"&&(n.value=new a.LongBits(e.value.low>>>0,e.value.high>>>0).toNumber())),n},r.toObject=function(e,n){n||(n={});var i={};if(n.defaults)if(i.type=n.enums===String?"LATENCY":1,a.Long){var s=new a.Long(0,0,!1);i.value=n.longs===String?s.toString():n.longs===Number?s.toNumber():s}else i.value=n.longs===String?"0":0;return e.type!=null&&e.hasOwnProperty("type")&&(i.type=n.enums===String?c.MetricData.MetricType[e.type]===void 0?e.type:c.MetricData.MetricType[e.type]:e.type),e.value!=null&&e.hasOwnProperty("value")&&(typeof e.value=="number"?i.value=n.longs===String?String(e.value):e.value:i.value=n.longs===String?a.Long.prototype.toString.call(e.value):n.longs===Number?new a.LongBits(e.value.low>>>0,e.value.high>>>0).toNumber():e.value),i},r.prototype.toJSON=function(){return this.constructor.toObject(this,p.util.toJSONOptions)},r.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/MetricData.TypeValue"},r}(),o})(),At=c.VersionInfo=(()=>{function o(r){if(r)for(var t=Object.keys(r),e=0;e<t.length;++e)r[t[e]]!=null&&(this[t[e]]=r[t[e]])}return o.prototype.licenseSdkVersion="",o.prototype.licenseServiceVersion="",o.create=function(t){return new o(t)},o.encode=function(t,e){return e||(e=d.create()),t.licenseSdkVersion!=null&&Object.hasOwnProperty.call(t,"licenseSdkVersion")&&e.uint32(10).string(t.licenseSdkVersion),t.licenseServiceVersion!=null&&Object.hasOwnProperty.call(t,"licenseServiceVersion")&&e.uint32(18).string(t.licenseServiceVersion),e},o.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},o.decode=function(t,e){t instanceof u||(t=u.create(t));for(var n=e===void 0?t.len:t.pos+e,i=new c.VersionInfo;t.pos<n;){var s=t.uint32();switch(s>>>3){case 1:{i.licenseSdkVersion=t.string();break}case 2:{i.licenseServiceVersion=t.string();break}default:t.skipType(s&7);break}}return i},o.decodeDelimited=function(t){return t instanceof u||(t=new u(t)),this.decode(t,t.uint32())},o.fromObject=function(t){if(t instanceof c.VersionInfo)return t;var e=new c.VersionInfo;return t.licenseSdkVersion!=null&&(e.licenseSdkVersion=String(t.licenseSdkVersion)),t.licenseServiceVersion!=null&&(e.licenseServiceVersion=String(t.licenseServiceVersion)),e},o.toObject=function(t,e){e||(e={});var n={};return e.defaults&&(n.licenseSdkVersion="",n.licenseServiceVersion=""),t.licenseSdkVersion!=null&&t.hasOwnProperty("licenseSdkVersion")&&(n.licenseSdkVersion=t.licenseSdkVersion),t.licenseServiceVersion!=null&&t.hasOwnProperty("licenseServiceVersion")&&(n.licenseServiceVersion=t.licenseServiceVersion),n},o.prototype.toJSON=function(){return this.constructor.toObject(this,p.util.toJSONOptions)},o.getTypeUrl=function(t){return t===void 0&&(t="type.googleapis.com"),t+"/VersionInfo"},o})(),O=c.SignedMessage=(()=>{function o(r){if(this.metricData=[],r)for(var t=Object.keys(r),e=0;e<t.length;++e)r[t[e]]!=null&&(this[t[e]]=r[t[e]])}return o.prototype.type=1,o.prototype.msg=a.newBuffer([]),o.prototype.signature=a.newBuffer([]),o.prototype.sessionKey=a.newBuffer([]),o.prototype.remoteAttestation=a.newBuffer([]),o.prototype.metricData=a.emptyArray,o.prototype.serviceVersionInfo=null,o.prototype.sessionKeyType=1,o.prototype.oemcryptoCoreMessage=a.newBuffer([]),o.create=function(t){return new o(t)},o.encode=function(t,e){if(e||(e=d.create()),t.type!=null&&Object.hasOwnProperty.call(t,"type")&&e.uint32(8).int32(t.type),t.msg!=null&&Object.hasOwnProperty.call(t,"msg")&&e.uint32(18).bytes(t.msg),t.signature!=null&&Object.hasOwnProperty.call(t,"signature")&&e.uint32(26).bytes(t.signature),t.sessionKey!=null&&Object.hasOwnProperty.call(t,"sessionKey")&&e.uint32(34).bytes(t.sessionKey),t.remoteAttestation!=null&&Object.hasOwnProperty.call(t,"remoteAttestation")&&e.uint32(42).bytes(t.remoteAttestation),t.metricData!=null&&t.metricData.length)for(var n=0;n<t.metricData.length;++n)c.MetricData.encode(t.metricData[n],e.uint32(50).fork()).ldelim();return t.serviceVersionInfo!=null&&Object.hasOwnProperty.call(t,"serviceVersionInfo")&&c.VersionInfo.encode(t.serviceVersionInfo,e.uint32(58).fork()).ldelim(),t.sessionKeyType!=null&&Object.hasOwnProperty.call(t,"sessionKeyType")&&e.uint32(64).int32(t.sessionKeyType),t.oemcryptoCoreMessage!=null&&Object.hasOwnProperty.call(t,"oemcryptoCoreMessage")&&e.uint32(74).bytes(t.oemcryptoCoreMessage),e},o.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},o.decode=function(t,e){t instanceof u||(t=u.create(t));for(var n=e===void 0?t.len:t.pos+e,i=new c.SignedMessage;t.pos<n;){var s=t.uint32();switch(s>>>3){case 1:{i.type=t.int32();break}case 2:{i.msg=t.bytes();break}case 3:{i.signature=t.bytes();break}case 4:{i.sessionKey=t.bytes();break}case 5:{i.remoteAttestation=t.bytes();break}case 6:{i.metricData&&i.metricData.length||(i.metricData=[]),i.metricData.push(c.MetricData.decode(t,t.uint32()));break}case 7:{i.serviceVersionInfo=c.VersionInfo.decode(t,t.uint32());break}case 8:{i.sessionKeyType=t.int32();break}case 9:{i.oemcryptoCoreMessage=t.bytes();break}default:t.skipType(s&7);break}}return i},o.decodeDelimited=function(t){return t instanceof u||(t=new u(t)),this.decode(t,t.uint32())},o.fromObject=function(t){if(t instanceof c.SignedMessage)return t;var e=new c.SignedMessage;switch(t.type){default:if(typeof t.type=="number"){e.type=t.type;break}break;case"LICENSE_REQUEST":case 1:e.type=1;break;case"LICENSE":case 2:e.type=2;break;case"ERROR_RESPONSE":case 3:e.type=3;break;case"SERVICE_CERTIFICATE_REQUEST":case 4:e.type=4;break;case"SERVICE_CERTIFICATE":case 5:e.type=5;break;case"SUB_LICENSE":case 6:e.type=6;break;case"CAS_LICENSE_REQUEST":case 7:e.type=7;break;case"CAS_LICENSE":case 8:e.type=8;break;case"EXTERNAL_LICENSE_REQUEST":case 9:e.type=9;break;case"EXTERNAL_LICENSE":case 10:e.type=10;break}if(t.msg!=null&&(typeof t.msg=="string"?a.base64.decode(t.msg,e.msg=a.newBuffer(a.base64.length(t.msg)),0):t.msg.length>=0&&(e.msg=t.msg)),t.signature!=null&&(typeof t.signature=="string"?a.base64.decode(t.signature,e.signature=a.newBuffer(a.base64.length(t.signature)),0):t.signature.length>=0&&(e.signature=t.signature)),t.sessionKey!=null&&(typeof t.sessionKey=="string"?a.base64.decode(t.sessionKey,e.sessionKey=a.newBuffer(a.base64.length(t.sessionKey)),0):t.sessionKey.length>=0&&(e.sessionKey=t.sessionKey)),t.remoteAttestation!=null&&(typeof t.remoteAttestation=="string"?a.base64.decode(t.remoteAttestation,e.remoteAttestation=a.newBuffer(a.base64.length(t.remoteAttestation)),0):t.remoteAttestation.length>=0&&(e.remoteAttestation=t.remoteAttestation)),t.metricData){if(!Array.isArray(t.metricData))throw TypeError(".SignedMessage.metricData: array expected");e.metricData=[];for(var n=0;n<t.metricData.length;++n){if(typeof t.metricData[n]!="object")throw TypeError(".SignedMessage.metricData: object expected");e.metricData[n]=c.MetricData.fromObject(t.metricData[n])}}if(t.serviceVersionInfo!=null){if(typeof t.serviceVersionInfo!="object")throw TypeError(".SignedMessage.serviceVersionInfo: object expected");e.serviceVersionInfo=c.VersionInfo.fromObject(t.serviceVersionInfo)}switch(t.sessionKeyType){case"UNDEFINED":case 0:e.sessionKeyType=0;break;default:if(typeof t.sessionKeyType=="number"){e.sessionKeyType=t.sessionKeyType;break}break;case"WRAPPED_AES_KEY":case 1:e.sessionKeyType=1;break;case"EPHERMERAL_ECC_PUBLIC_KEY":case 2:e.sessionKeyType=2;break}return t.oemcryptoCoreMessage!=null&&(typeof t.oemcryptoCoreMessage=="string"?a.base64.decode(t.oemcryptoCoreMessage,e.oemcryptoCoreMessage=a.newBuffer(a.base64.length(t.oemcryptoCoreMessage)),0):t.oemcryptoCoreMessage.length>=0&&(e.oemcryptoCoreMessage=t.oemcryptoCoreMessage)),e},o.toObject=function(t,e){e||(e={});var n={};if((e.arrays||e.defaults)&&(n.metricData=[]),e.defaults&&(n.type=e.enums===String?"LICENSE_REQUEST":1,e.bytes===String?n.msg="":(n.msg=[],e.bytes!==Array&&(n.msg=a.newBuffer(n.msg))),e.bytes===String?n.signature="":(n.signature=[],e.bytes!==Array&&(n.signature=a.newBuffer(n.signature))),e.bytes===String?n.sessionKey="":(n.sessionKey=[],e.bytes!==Array&&(n.sessionKey=a.newBuffer(n.sessionKey))),e.bytes===String?n.remoteAttestation="":(n.remoteAttestation=[],e.bytes!==Array&&(n.remoteAttestation=a.newBuffer(n.remoteAttestation))),n.serviceVersionInfo=null,n.sessionKeyType=e.enums===String?"WRAPPED_AES_KEY":1,e.bytes===String?n.oemcryptoCoreMessage="":(n.oemcryptoCoreMessage=[],e.bytes!==Array&&(n.oemcryptoCoreMessage=a.newBuffer(n.oemcryptoCoreMessage)))),t.type!=null&&t.hasOwnProperty("type")&&(n.type=e.enums===String?c.SignedMessage.MessageType[t.type]===void 0?t.type:c.SignedMessage.MessageType[t.type]:t.type),t.msg!=null&&t.hasOwnProperty("msg")&&(n.msg=e.bytes===String?a.base64.encode(t.msg,0,t.msg.length):e.bytes===Array?Array.prototype.slice.call(t.msg):t.msg),t.signature!=null&&t.hasOwnProperty("signature")&&(n.signature=e.bytes===String?a.base64.encode(t.signature,0,t.signature.length):e.bytes===Array?Array.prototype.slice.call(t.signature):t.signature),t.sessionKey!=null&&t.hasOwnProperty("sessionKey")&&(n.sessionKey=e.bytes===String?a.base64.encode(t.sessionKey,0,t.sessionKey.length):e.bytes===Array?Array.prototype.slice.call(t.sessionKey):t.sessionKey),t.remoteAttestation!=null&&t.hasOwnProperty("remoteAttestation")&&(n.remoteAttestation=e.bytes===String?a.base64.encode(t.remoteAttestation,0,t.remoteAttestation.length):e.bytes===Array?Array.prototype.slice.call(t.remoteAttestation):t.remoteAttestation),t.metricData&&t.metricData.length){n.metricData=[];for(var i=0;i<t.metricData.length;++i)n.metricData[i]=c.MetricData.toObject(t.metricData[i],e)}return t.serviceVersionInfo!=null&&t.hasOwnProperty("serviceVersionInfo")&&(n.serviceVersionInfo=c.VersionInfo.toObject(t.serviceVersionInfo,e)),t.sessionKeyType!=null&&t.hasOwnProperty("sessionKeyType")&&(n.sessionKeyType=e.enums===String?c.SignedMessage.SessionKeyType[t.sessionKeyType]===void 0?t.sessionKeyType:c.SignedMessage.SessionKeyType[t.sessionKeyType]:t.sessionKeyType),t.oemcryptoCoreMessage!=null&&t.hasOwnProperty("oemcryptoCoreMessage")&&(n.oemcryptoCoreMessage=e.bytes===String?a.base64.encode(t.oemcryptoCoreMessage,0,t.oemcryptoCoreMessage.length):e.bytes===Array?Array.prototype.slice.call(t.oemcryptoCoreMessage):t.oemcryptoCoreMessage),n},o.prototype.toJSON=function(){return this.constructor.toObject(this,p.util.toJSONOptions)},o.getTypeUrl=function(t){return t===void 0&&(t="type.googleapis.com"),t+"/SignedMessage"},o.MessageType=function(){let r={},t=Object.create(r);return t[r[1]="LICENSE_REQUEST"]=1,t[r[2]="LICENSE"]=2,t[r[3]="ERROR_RESPONSE"]=3,t[r[4]="SERVICE_CERTIFICATE_REQUEST"]=4,t[r[5]="SERVICE_CERTIFICATE"]=5,t[r[6]="SUB_LICENSE"]=6,t[r[7]="CAS_LICENSE_REQUEST"]=7,t[r[8]="CAS_LICENSE"]=8,t[r[9]="EXTERNAL_LICENSE_REQUEST"]=9,t[r[10]="EXTERNAL_LICENSE"]=10,t}(),o.SessionKeyType=function(){let r={},t=Object.create(r);return t[r[0]="UNDEFINED"]=0,t[r[1]="WRAPPED_AES_KEY"]=1,t[r[2]="EPHERMERAL_ECC_PUBLIC_KEY"]=2,t}(),o})(),Rt=c.HashAlgorithmProto=(()=>{let o={},r=Object.create(o);return r[o[0]="HASH_ALGORITHM_UNSPECIFIED"]=0,r[o[1]="HASH_ALGORITHM_SHA_1"]=1,r[o[2]="HASH_ALGORITHM_SHA_256"]=2,r[o[3]="HASH_ALGORITHM_SHA_384"]=3,r})(),j=c.ClientIdentification=(()=>{function o(r){if(this.clientInfo=[],this.deviceCredentials=[],r)for(var t=Object.keys(r),e=0;e<t.length;++e)r[t[e]]!=null&&(this[t[e]]=r[t[e]])}return o.prototype.type=0,o.prototype.token=a.newBuffer([]),o.prototype.clientInfo=a.emptyArray,o.prototype.providerClientToken=a.newBuffer([]),o.prototype.licenseCounter=0,o.prototype.clientCapabilities=null,o.prototype.vmpData=a.newBuffer([]),o.prototype.deviceCredentials=a.emptyArray,o.create=function(t){return new o(t)},o.encode=function(t,e){if(e||(e=d.create()),t.type!=null&&Object.hasOwnProperty.call(t,"type")&&e.uint32(8).int32(t.type),t.token!=null&&Object.hasOwnProperty.call(t,"token")&&e.uint32(18).bytes(t.token),t.clientInfo!=null&&t.clientInfo.length)for(var n=0;n<t.clientInfo.length;++n)c.ClientIdentification.NameValue.encode(t.clientInfo[n],e.uint32(26).fork()).ldelim();if(t.providerClientToken!=null&&Object.hasOwnProperty.call(t,"providerClientToken")&&e.uint32(34).bytes(t.providerClientToken),t.licenseCounter!=null&&Object.hasOwnProperty.call(t,"licenseCounter")&&e.uint32(40).uint32(t.licenseCounter),t.clientCapabilities!=null&&Object.hasOwnProperty.call(t,"clientCapabilities")&&c.ClientIdentification.ClientCapabilities.encode(t.clientCapabilities,e.uint32(50).fork()).ldelim(),t.vmpData!=null&&Object.hasOwnProperty.call(t,"vmpData")&&e.uint32(58).bytes(t.vmpData),t.deviceCredentials!=null&&t.deviceCredentials.length)for(var n=0;n<t.deviceCredentials.length;++n)c.ClientIdentification.ClientCredentials.encode(t.deviceCredentials[n],e.uint32(66).fork()).ldelim();return e},o.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},o.decode=function(t,e){t instanceof u||(t=u.create(t));for(var n=e===void 0?t.len:t.pos+e,i=new c.ClientIdentification;t.pos<n;){var s=t.uint32();switch(s>>>3){case 1:{i.type=t.int32();break}case 2:{i.token=t.bytes();break}case 3:{i.clientInfo&&i.clientInfo.length||(i.clientInfo=[]),i.clientInfo.push(c.ClientIdentification.NameValue.decode(t,t.uint32()));break}case 4:{i.providerClientToken=t.bytes();break}case 5:{i.licenseCounter=t.uint32();break}case 6:{i.clientCapabilities=c.ClientIdentification.ClientCapabilities.decode(t,t.uint32());break}case 7:{i.vmpData=t.bytes();break}case 8:{i.deviceCredentials&&i.deviceCredentials.length||(i.deviceCredentials=[]),i.deviceCredentials.push(c.ClientIdentification.ClientCredentials.decode(t,t.uint32()));break}default:t.skipType(s&7);break}}return i},o.decodeDelimited=function(t){return t instanceof u||(t=new u(t)),this.decode(t,t.uint32())},o.fromObject=function(t){if(t instanceof c.ClientIdentification)return t;var e=new c.ClientIdentification;switch(t.type){default:if(typeof t.type=="number"){e.type=t.type;break}break;case"KEYBOX":case 0:e.type=0;break;case"DRM_DEVICE_CERTIFICATE":case 1:e.type=1;break;case"REMOTE_ATTESTATION_CERTIFICATE":case 2:e.type=2;break;case"OEM_DEVICE_CERTIFICATE":case 3:e.type=3;break}if(t.token!=null&&(typeof t.token=="string"?a.base64.decode(t.token,e.token=a.newBuffer(a.base64.length(t.token)),0):t.token.length>=0&&(e.token=t.token)),t.clientInfo){if(!Array.isArray(t.clientInfo))throw TypeError(".ClientIdentification.clientInfo: array expected");e.clientInfo=[];for(var n=0;n<t.clientInfo.length;++n){if(typeof t.clientInfo[n]!="object")throw TypeError(".ClientIdentification.clientInfo: object expected");e.clientInfo[n]=c.ClientIdentification.NameValue.fromObject(t.clientInfo[n])}}if(t.providerClientToken!=null&&(typeof t.providerClientToken=="string"?a.base64.decode(t.providerClientToken,e.providerClientToken=a.newBuffer(a.base64.length(t.providerClientToken)),0):t.providerClientToken.length>=0&&(e.providerClientToken=t.providerClientToken)),t.licenseCounter!=null&&(e.licenseCounter=t.licenseCounter>>>0),t.clientCapabilities!=null){if(typeof t.clientCapabilities!="object")throw TypeError(".ClientIdentification.clientCapabilities: object expected");e.clientCapabilities=c.ClientIdentification.ClientCapabilities.fromObject(t.clientCapabilities)}if(t.vmpData!=null&&(typeof t.vmpData=="string"?a.base64.decode(t.vmpData,e.vmpData=a.newBuffer(a.base64.length(t.vmpData)),0):t.vmpData.length>=0&&(e.vmpData=t.vmpData)),t.deviceCredentials){if(!Array.isArray(t.deviceCredentials))throw TypeError(".ClientIdentification.deviceCredentials: array expected");e.deviceCredentials=[];for(var n=0;n<t.deviceCredentials.length;++n){if(typeof t.deviceCredentials[n]!="object")throw TypeError(".ClientIdentification.deviceCredentials: object expected");e.deviceCredentials[n]=c.ClientIdentification.ClientCredentials.fromObject(t.deviceCredentials[n])}}return e},o.toObject=function(t,e){e||(e={});var n={};if((e.arrays||e.defaults)&&(n.clientInfo=[],n.deviceCredentials=[]),e.defaults&&(n.type=e.enums===String?"KEYBOX":0,e.bytes===String?n.token="":(n.token=[],e.bytes!==Array&&(n.token=a.newBuffer(n.token))),e.bytes===String?n.providerClientToken="":(n.providerClientToken=[],e.bytes!==Array&&(n.providerClientToken=a.newBuffer(n.providerClientToken))),n.licenseCounter=0,n.clientCapabilities=null,e.bytes===String?n.vmpData="":(n.vmpData=[],e.bytes!==Array&&(n.vmpData=a.newBuffer(n.vmpData)))),t.type!=null&&t.hasOwnProperty("type")&&(n.type=e.enums===String?c.ClientIdentification.TokenType[t.type]===void 0?t.type:c.ClientIdentification.TokenType[t.type]:t.type),t.token!=null&&t.hasOwnProperty("token")&&(n.token=e.bytes===String?a.base64.encode(t.token,0,t.token.length):e.bytes===Array?Array.prototype.slice.call(t.token):t.token),t.clientInfo&&t.clientInfo.length){n.clientInfo=[];for(var i=0;i<t.clientInfo.length;++i)n.clientInfo[i]=c.ClientIdentification.NameValue.toObject(t.clientInfo[i],e)}if(t.providerClientToken!=null&&t.hasOwnProperty("providerClientToken")&&(n.providerClientToken=e.bytes===String?a.base64.encode(t.providerClientToken,0,t.providerClientToken.length):e.bytes===Array?Array.prototype.slice.call(t.providerClientToken):t.providerClientToken),t.licenseCounter!=null&&t.hasOwnProperty("licenseCounter")&&(n.licenseCounter=t.licenseCounter),t.clientCapabilities!=null&&t.hasOwnProperty("clientCapabilities")&&(n.clientCapabilities=c.ClientIdentification.ClientCapabilities.toObject(t.clientCapabilities,e)),t.vmpData!=null&&t.hasOwnProperty("vmpData")&&(n.vmpData=e.bytes===String?a.base64.encode(t.vmpData,0,t.vmpData.length):e.bytes===Array?Array.prototype.slice.call(t.vmpData):t.vmpData),t.deviceCredentials&&t.deviceCredentials.length){n.deviceCredentials=[];for(var i=0;i<t.deviceCredentials.length;++i)n.deviceCredentials[i]=c.ClientIdentification.ClientCredentials.toObject(t.deviceCredentials[i],e)}return n},o.prototype.toJSON=function(){return this.constructor.toObject(this,p.util.toJSONOptions)},o.getTypeUrl=function(t){return t===void 0&&(t="type.googleapis.com"),t+"/ClientIdentification"},o.TokenType=function(){let r={},t=Object.create(r);return t[r[0]="KEYBOX"]=0,t[r[1]="DRM_DEVICE_CERTIFICATE"]=1,t[r[2]="REMOTE_ATTESTATION_CERTIFICATE"]=2,t[r[3]="OEM_DEVICE_CERTIFICATE"]=3,t}(),o.NameValue=function(){function r(t){if(t)for(var e=Object.keys(t),n=0;n<e.length;++n)t[e[n]]!=null&&(this[e[n]]=t[e[n]])}return r.prototype.name="",r.prototype.value="",r.create=function(e){return new r(e)},r.encode=function(e,n){return n||(n=d.create()),e.name!=null&&Object.hasOwnProperty.call(e,"name")&&n.uint32(10).string(e.name),e.value!=null&&Object.hasOwnProperty.call(e,"value")&&n.uint32(18).string(e.value),n},r.encodeDelimited=function(e,n){return this.encode(e,n).ldelim()},r.decode=function(e,n){e instanceof u||(e=u.create(e));for(var i=n===void 0?e.len:e.pos+n,s=new c.ClientIdentification.NameValue;e.pos<i;){var l=e.uint32();switch(l>>>3){case 1:{s.name=e.string();break}case 2:{s.value=e.string();break}default:e.skipType(l&7);break}}return s},r.decodeDelimited=function(e){return e instanceof u||(e=new u(e)),this.decode(e,e.uint32())},r.fromObject=function(e){if(e instanceof c.ClientIdentification.NameValue)return e;var n=new c.ClientIdentification.NameValue;return e.name!=null&&(n.name=String(e.name)),e.value!=null&&(n.value=String(e.value)),n},r.toObject=function(e,n){n||(n={});var i={};return n.defaults&&(i.name="",i.value=""),e.name!=null&&e.hasOwnProperty("name")&&(i.name=e.name),e.value!=null&&e.hasOwnProperty("value")&&(i.value=e.value),i},r.prototype.toJSON=function(){return this.constructor.toObject(this,p.util.toJSONOptions)},r.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/ClientIdentification.NameValue"},r}(),o.ClientCapabilities=function(){function r(t){if(this.supportedCertificateKeyType=[],t)for(var e=Object.keys(t),n=0;n<e.length;++n)t[e[n]]!=null&&(this[e[n]]=t[e[n]])}return r.prototype.clientToken=!1,r.prototype.sessionToken=!1,r.prototype.videoResolutionConstraints=!1,r.prototype.maxHdcpVersion=0,r.prototype.oemCryptoApiVersion=0,r.prototype.antiRollbackUsageTable=!1,r.prototype.srmVersion=0,r.prototype.canUpdateSrm=!1,r.prototype.supportedCertificateKeyType=a.emptyArray,r.prototype.analogOutputCapabilities=0,r.prototype.canDisableAnalogOutput=!1,r.prototype.resourceRatingTier=0,r.create=function(e){return new r(e)},r.encode=function(e,n){if(n||(n=d.create()),e.clientToken!=null&&Object.hasOwnProperty.call(e,"clientToken")&&n.uint32(8).bool(e.clientToken),e.sessionToken!=null&&Object.hasOwnProperty.call(e,"sessionToken")&&n.uint32(16).bool(e.sessionToken),e.videoResolutionConstraints!=null&&Object.hasOwnProperty.call(e,"videoResolutionConstraints")&&n.uint32(24).bool(e.videoResolutionConstraints),e.maxHdcpVersion!=null&&Object.hasOwnProperty.call(e,"maxHdcpVersion")&&n.uint32(32).int32(e.maxHdcpVersion),e.oemCryptoApiVersion!=null&&Object.hasOwnProperty.call(e,"oemCryptoApiVersion")&&n.uint32(40).uint32(e.oemCryptoApiVersion),e.antiRollbackUsageTable!=null&&Object.hasOwnProperty.call(e,"antiRollbackUsageTable")&&n.uint32(48).bool(e.antiRollbackUsageTable),e.srmVersion!=null&&Object.hasOwnProperty.call(e,"srmVersion")&&n.uint32(56).uint32(e.srmVersion),e.canUpdateSrm!=null&&Object.hasOwnProperty.call(e,"canUpdateSrm")&&n.uint32(64).bool(e.canUpdateSrm),e.supportedCertificateKeyType!=null&&e.supportedCertificateKeyType.length)for(var i=0;i<e.supportedCertificateKeyType.length;++i)n.uint32(72).int32(e.supportedCertificateKeyType[i]);return e.analogOutputCapabilities!=null&&Object.hasOwnProperty.call(e,"analogOutputCapabilities")&&n.uint32(80).int32(e.analogOutputCapabilities),e.canDisableAnalogOutput!=null&&Object.hasOwnProperty.call(e,"canDisableAnalogOutput")&&n.uint32(88).bool(e.canDisableAnalogOutput),e.resourceRatingTier!=null&&Object.hasOwnProperty.call(e,"resourceRatingTier")&&n.uint32(96).uint32(e.resourceRatingTier),n},r.encodeDelimited=function(e,n){return this.encode(e,n).ldelim()},r.decode=function(e,n){e instanceof u||(e=u.create(e));for(var i=n===void 0?e.len:e.pos+n,s=new c.ClientIdentification.ClientCapabilities;e.pos<i;){var l=e.uint32();switch(l>>>3){case 1:{s.clientToken=e.bool();break}case 2:{s.sessionToken=e.bool();break}case 3:{s.videoResolutionConstraints=e.bool();break}case 4:{s.maxHdcpVersion=e.int32();break}case 5:{s.oemCryptoApiVersion=e.uint32();break}case 6:{s.antiRollbackUsageTable=e.bool();break}case 7:{s.srmVersion=e.uint32();break}case 8:{s.canUpdateSrm=e.bool();break}case 9:{if(s.supportedCertificateKeyType&&s.supportedCertificateKeyType.length||(s.supportedCertificateKeyType=[]),(l&7)===2)for(var y=e.uint32()+e.pos;e.pos<y;)s.supportedCertificateKeyType.push(e.int32());else s.supportedCertificateKeyType.push(e.int32());break}case 10:{s.analogOutputCapabilities=e.int32();break}case 11:{s.canDisableAnalogOutput=e.bool();break}case 12:{s.resourceRatingTier=e.uint32();break}default:e.skipType(l&7);break}}return s},r.decodeDelimited=function(e){return e instanceof u||(e=new u(e)),this.decode(e,e.uint32())},r.fromObject=function(e){if(e instanceof c.ClientIdentification.ClientCapabilities)return e;var n=new c.ClientIdentification.ClientCapabilities;switch(e.clientToken!=null&&(n.clientToken=!!e.clientToken),e.sessionToken!=null&&(n.sessionToken=!!e.sessionToken),e.videoResolutionConstraints!=null&&(n.videoResolutionConstraints=!!e.videoResolutionConstraints),e.maxHdcpVersion){default:if(typeof e.maxHdcpVersion=="number"){n.maxHdcpVersion=e.maxHdcpVersion;break}break;case"HDCP_NONE":case 0:n.maxHdcpVersion=0;break;case"HDCP_V1":case 1:n.maxHdcpVersion=1;break;case"HDCP_V2":case 2:n.maxHdcpVersion=2;break;case"HDCP_V2_1":case 3:n.maxHdcpVersion=3;break;case"HDCP_V2_2":case 4:n.maxHdcpVersion=4;break;case"HDCP_V2_3":case 5:n.maxHdcpVersion=5;break;case"HDCP_NO_DIGITAL_OUTPUT":case 255:n.maxHdcpVersion=255;break}if(e.oemCryptoApiVersion!=null&&(n.oemCryptoApiVersion=e.oemCryptoApiVersion>>>0),e.antiRollbackUsageTable!=null&&(n.antiRollbackUsageTable=!!e.antiRollbackUsageTable),e.srmVersion!=null&&(n.srmVersion=e.srmVersion>>>0),e.canUpdateSrm!=null&&(n.canUpdateSrm=!!e.canUpdateSrm),e.supportedCertificateKeyType){if(!Array.isArray(e.supportedCertificateKeyType))throw TypeError(".ClientIdentification.ClientCapabilities.supportedCertificateKeyType: array expected");n.supportedCertificateKeyType=[];for(var i=0;i<e.supportedCertificateKeyType.length;++i)switch(e.supportedCertificateKeyType[i]){default:if(typeof e.supportedCertificateKeyType[i]=="number"){n.supportedCertificateKeyType[i]=e.supportedCertificateKeyType[i];break}case"RSA_2048":case 0:n.supportedCertificateKeyType[i]=0;break;case"RSA_3072":case 1:n.supportedCertificateKeyType[i]=1;break;case"ECC_SECP256R1":case 2:n.supportedCertificateKeyType[i]=2;break;case"ECC_SECP384R1":case 3:n.supportedCertificateKeyType[i]=3;break;case"ECC_SECP521R1":case 4:n.supportedCertificateKeyType[i]=4;break}}switch(e.analogOutputCapabilities){default:if(typeof e.analogOutputCapabilities=="number"){n.analogOutputCapabilities=e.analogOutputCapabilities;break}break;case"ANALOG_OUTPUT_UNKNOWN":case 0:n.analogOutputCapabilities=0;break;case"ANALOG_OUTPUT_NONE":case 1:n.analogOutputCapabilities=1;break;case"ANALOG_OUTPUT_SUPPORTED":case 2:n.analogOutputCapabilities=2;break;case"ANALOG_OUTPUT_SUPPORTS_CGMS_A":case 3:n.analogOutputCapabilities=3;break}return e.canDisableAnalogOutput!=null&&(n.canDisableAnalogOutput=!!e.canDisableAnalogOutput),e.resourceRatingTier!=null&&(n.resourceRatingTier=e.resourceRatingTier>>>0),n},r.toObject=function(e,n){n||(n={});var i={};if((n.arrays||n.defaults)&&(i.supportedCertificateKeyType=[]),n.defaults&&(i.clientToken=!1,i.sessionToken=!1,i.videoResolutionConstraints=!1,i.maxHdcpVersion=n.enums===String?"HDCP_NONE":0,i.oemCryptoApiVersion=0,i.antiRollbackUsageTable=!1,i.srmVersion=0,i.canUpdateSrm=!1,i.analogOutputCapabilities=n.enums===String?"ANALOG_OUTPUT_UNKNOWN":0,i.canDisableAnalogOutput=!1,i.resourceRatingTier=0),e.clientToken!=null&&e.hasOwnProperty("clientToken")&&(i.clientToken=e.clientToken),e.sessionToken!=null&&e.hasOwnProperty("sessionToken")&&(i.sessionToken=e.sessionToken),e.videoResolutionConstraints!=null&&e.hasOwnProperty("videoResolutionConstraints")&&(i.videoResolutionConstraints=e.videoResolutionConstraints),e.maxHdcpVersion!=null&&e.hasOwnProperty("maxHdcpVersion")&&(i.maxHdcpVersion=n.enums===String?c.ClientIdentification.ClientCapabilities.HdcpVersion[e.maxHdcpVersion]===void 0?e.maxHdcpVersion:c.ClientIdentification.ClientCapabilities.HdcpVersion[e.maxHdcpVersion]:e.maxHdcpVersion),e.oemCryptoApiVersion!=null&&e.hasOwnProperty("oemCryptoApiVersion")&&(i.oemCryptoApiVersion=e.oemCryptoApiVersion),e.antiRollbackUsageTable!=null&&e.hasOwnProperty("antiRollbackUsageTable")&&(i.antiRollbackUsageTable=e.antiRollbackUsageTable),e.srmVersion!=null&&e.hasOwnProperty("srmVersion")&&(i.srmVersion=e.srmVersion),e.canUpdateSrm!=null&&e.hasOwnProperty("canUpdateSrm")&&(i.canUpdateSrm=e.canUpdateSrm),e.supportedCertificateKeyType&&e.supportedCertificateKeyType.length){i.supportedCertificateKeyType=[];for(var s=0;s<e.supportedCertificateKeyType.length;++s)i.supportedCertificateKeyType[s]=n.enums===String?c.ClientIdentification.ClientCapabilities.CertificateKeyType[e.supportedCertificateKeyType[s]]===void 0?e.supportedCertificateKeyType[s]:c.ClientIdentification.ClientCapabilities.CertificateKeyType[e.supportedCertificateKeyType[s]]:e.supportedCertificateKeyType[s]}return e.analogOutputCapabilities!=null&&e.hasOwnProperty("analogOutputCapabilities")&&(i.analogOutputCapabilities=n.enums===String?c.ClientIdentification.ClientCapabilities.AnalogOutputCapabilities[e.analogOutputCapabilities]===void 0?e.analogOutputCapabilities:c.ClientIdentification.ClientCapabilities.AnalogOutputCapabilities[e.analogOutputCapabilities]:e.analogOutputCapabilities),e.canDisableAnalogOutput!=null&&e.hasOwnProperty("canDisableAnalogOutput")&&(i.canDisableAnalogOutput=e.canDisableAnalogOutput),e.resourceRatingTier!=null&&e.hasOwnProperty("resourceRatingTier")&&(i.resourceRatingTier=e.resourceRatingTier),i},r.prototype.toJSON=function(){return this.constructor.toObject(this,p.util.toJSONOptions)},r.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/ClientIdentification.ClientCapabilities"},r.HdcpVersion=function(){let t={},e=Object.create(t);return e[t[0]="HDCP_NONE"]=0,e[t[1]="HDCP_V1"]=1,e[t[2]="HDCP_V2"]=2,e[t[3]="HDCP_V2_1"]=3,e[t[4]="HDCP_V2_2"]=4,e[t[5]="HDCP_V2_3"]=5,e[t[255]="HDCP_NO_DIGITAL_OUTPUT"]=255,e}(),r.CertificateKeyType=function(){let t={},e=Object.create(t);return e[t[0]="RSA_2048"]=0,e[t[1]="RSA_3072"]=1,e[t[2]="ECC_SECP256R1"]=2,e[t[3]="ECC_SECP384R1"]=3,e[t[4]="ECC_SECP521R1"]=4,e}(),r.AnalogOutputCapabilities=function(){let t={},e=Object.create(t);return e[t[0]="ANALOG_OUTPUT_UNKNOWN"]=0,e[t[1]="ANALOG_OUTPUT_NONE"]=1,e[t[2]="ANALOG_OUTPUT_SUPPORTED"]=2,e[t[3]="ANALOG_OUTPUT_SUPPORTS_CGMS_A"]=3,e}(),r}(),o.ClientCredentials=function(){function r(t){if(t)for(var e=Object.keys(t),n=0;n<e.length;++n)t[e[n]]!=null&&(this[e[n]]=t[e[n]])}return r.prototype.type=0,r.prototype.token=a.newBuffer([]),r.create=function(e){return new r(e)},r.encode=function(e,n){return n||(n=d.create()),e.type!=null&&Object.hasOwnProperty.call(e,"type")&&n.uint32(8).int32(e.type),e.token!=null&&Object.hasOwnProperty.call(e,"token")&&n.uint32(18).bytes(e.token),n},r.encodeDelimited=function(e,n){return this.encode(e,n).ldelim()},r.decode=function(e,n){e instanceof u||(e=u.create(e));for(var i=n===void 0?e.len:e.pos+n,s=new c.ClientIdentification.ClientCredentials;e.pos<i;){var l=e.uint32();switch(l>>>3){case 1:{s.type=e.int32();break}case 2:{s.token=e.bytes();break}default:e.skipType(l&7);break}}return s},r.decodeDelimited=function(e){return e instanceof u||(e=new u(e)),this.decode(e,e.uint32())},r.fromObject=function(e){if(e instanceof c.ClientIdentification.ClientCredentials)return e;var n=new c.ClientIdentification.ClientCredentials;switch(e.type){default:if(typeof e.type=="number"){n.type=e.type;break}break;case"KEYBOX":case 0:n.type=0;break;case"DRM_DEVICE_CERTIFICATE":case 1:n.type=1;break;case"REMOTE_ATTESTATION_CERTIFICATE":case 2:n.type=2;break;case"OEM_DEVICE_CERTIFICATE":case 3:n.type=3;break}return e.token!=null&&(typeof e.token=="string"?a.base64.decode(e.token,n.token=a.newBuffer(a.base64.length(e.token)),0):e.token.length>=0&&(n.token=e.token)),n},r.toObject=function(e,n){n||(n={});var i={};return n.defaults&&(i.type=n.enums===String?"KEYBOX":0,n.bytes===String?i.token="":(i.token=[],n.bytes!==Array&&(i.token=a.newBuffer(i.token)))),e.type!=null&&e.hasOwnProperty("type")&&(i.type=n.enums===String?c.ClientIdentification.TokenType[e.type]===void 0?e.type:c.ClientIdentification.TokenType[e.type]:e.type),e.token!=null&&e.hasOwnProperty("token")&&(i.token=n.bytes===String?a.base64.encode(e.token,0,e.token.length):n.bytes===Array?Array.prototype.slice.call(e.token):e.token),i},r.prototype.toJSON=function(){return this.constructor.toObject(this,p.util.toJSONOptions)},r.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/ClientIdentification.ClientCredentials"},r}(),o})(),ue=c.EncryptedClientIdentification=(()=>{function o(r){if(r)for(var t=Object.keys(r),e=0;e<t.length;++e)r[t[e]]!=null&&(this[t[e]]=r[t[e]])}return o.prototype.providerId="",o.prototype.serviceCertificateSerialNumber=a.newBuffer([]),o.prototype.encryptedClientId=a.newBuffer([]),o.prototype.encryptedClientIdIv=a.newBuffer([]),o.prototype.encryptedPrivacyKey=a.newBuffer([]),o.create=function(t){return new o(t)},o.encode=function(t,e){return e||(e=d.create()),t.providerId!=null&&Object.hasOwnProperty.call(t,"providerId")&&e.uint32(10).string(t.providerId),t.serviceCertificateSerialNumber!=null&&Object.hasOwnProperty.call(t,"serviceCertificateSerialNumber")&&e.uint32(18).bytes(t.serviceCertificateSerialNumber),t.encryptedClientId!=null&&Object.hasOwnProperty.call(t,"encryptedClientId")&&e.uint32(26).bytes(t.encryptedClientId),t.encryptedClientIdIv!=null&&Object.hasOwnProperty.call(t,"encryptedClientIdIv")&&e.uint32(34).bytes(t.encryptedClientIdIv),t.encryptedPrivacyKey!=null&&Object.hasOwnProperty.call(t,"encryptedPrivacyKey")&&e.uint32(42).bytes(t.encryptedPrivacyKey),e},o.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},o.decode=function(t,e){t instanceof u||(t=u.create(t));for(var n=e===void 0?t.len:t.pos+e,i=new c.EncryptedClientIdentification;t.pos<n;){var s=t.uint32();switch(s>>>3){case 1:{i.providerId=t.string();break}case 2:{i.serviceCertificateSerialNumber=t.bytes();break}case 3:{i.encryptedClientId=t.bytes();break}case 4:{i.encryptedClientIdIv=t.bytes();break}case 5:{i.encryptedPrivacyKey=t.bytes();break}default:t.skipType(s&7);break}}return i},o.decodeDelimited=function(t){return t instanceof u||(t=new u(t)),this.decode(t,t.uint32())},o.fromObject=function(t){if(t instanceof c.EncryptedClientIdentification)return t;var e=new c.EncryptedClientIdentification;return t.providerId!=null&&(e.providerId=String(t.providerId)),t.serviceCertificateSerialNumber!=null&&(typeof t.serviceCertificateSerialNumber=="string"?a.base64.decode(t.serviceCertificateSerialNumber,e.serviceCertificateSerialNumber=a.newBuffer(a.base64.length(t.serviceCertificateSerialNumber)),0):t.serviceCertificateSerialNumber.length>=0&&(e.serviceCertificateSerialNumber=t.serviceCertificateSerialNumber)),t.encryptedClientId!=null&&(typeof t.encryptedClientId=="string"?a.base64.decode(t.encryptedClientId,e.encryptedClientId=a.newBuffer(a.base64.length(t.encryptedClientId)),0):t.encryptedClientId.length>=0&&(e.encryptedClientId=t.encryptedClientId)),t.encryptedClientIdIv!=null&&(typeof t.encryptedClientIdIv=="string"?a.base64.decode(t.encryptedClientIdIv,e.encryptedClientIdIv=a.newBuffer(a.base64.length(t.encryptedClientIdIv)),0):t.encryptedClientIdIv.length>=0&&(e.encryptedClientIdIv=t.encryptedClientIdIv)),t.encryptedPrivacyKey!=null&&(typeof t.encryptedPrivacyKey=="string"?a.base64.decode(t.encryptedPrivacyKey,e.encryptedPrivacyKey=a.newBuffer(a.base64.length(t.encryptedPrivacyKey)),0):t.encryptedPrivacyKey.length>=0&&(e.encryptedPrivacyKey=t.encryptedPrivacyKey)),e},o.toObject=function(t,e){e||(e={});var n={};return e.defaults&&(n.providerId="",e.bytes===String?n.serviceCertificateSerialNumber="":(n.serviceCertificateSerialNumber=[],e.bytes!==Array&&(n.serviceCertificateSerialNumber=a.newBuffer(n.serviceCertificateSerialNumber))),e.bytes===String?n.encryptedClientId="":(n.encryptedClientId=[],e.bytes!==Array&&(n.encryptedClientId=a.newBuffer(n.encryptedClientId))),e.bytes===String?n.encryptedClientIdIv="":(n.encryptedClientIdIv=[],e.bytes!==Array&&(n.encryptedClientIdIv=a.newBuffer(n.encryptedClientIdIv))),e.bytes===String?n.encryptedPrivacyKey="":(n.encryptedPrivacyKey=[],e.bytes!==Array&&(n.encryptedPrivacyKey=a.newBuffer(n.encryptedPrivacyKey)))),t.providerId!=null&&t.hasOwnProperty("providerId")&&(n.providerId=t.providerId),t.serviceCertificateSerialNumber!=null&&t.hasOwnProperty("serviceCertificateSerialNumber")&&(n.serviceCertificateSerialNumber=e.bytes===String?a.base64.encode(t.serviceCertificateSerialNumber,0,t.serviceCertificateSerialNumber.length):e.bytes===Array?Array.prototype.slice.call(t.serviceCertificateSerialNumber):t.serviceCertificateSerialNumber),t.encryptedClientId!=null&&t.hasOwnProperty("encryptedClientId")&&(n.encryptedClientId=e.bytes===String?a.base64.encode(t.encryptedClientId,0,t.encryptedClientId.length):e.bytes===Array?Array.prototype.slice.call(t.encryptedClientId):t.encryptedClientId),t.encryptedClientIdIv!=null&&t.hasOwnProperty("encryptedClientIdIv")&&(n.encryptedClientIdIv=e.bytes===String?a.base64.encode(t.encryptedClientIdIv,0,t.encryptedClientIdIv.length):e.bytes===Array?Array.prototype.slice.call(t.encryptedClientIdIv):t.encryptedClientIdIv),t.encryptedPrivacyKey!=null&&t.hasOwnProperty("encryptedPrivacyKey")&&(n.encryptedPrivacyKey=e.bytes===String?a.base64.encode(t.encryptedPrivacyKey,0,t.encryptedPrivacyKey.length):e.bytes===Array?Array.prototype.slice.call(t.encryptedPrivacyKey):t.encryptedPrivacyKey),n},o.prototype.toJSON=function(){return this.constructor.toObject(this,p.util.toJSONOptions)},o.getTypeUrl=function(t){return t===void 0&&(t="type.googleapis.com"),t+"/EncryptedClientIdentification"},o})(),mt=c.LicenseError=(()=>{function o(r){if(r)for(var t=Object.keys(r),e=0;e<t.length;++e)r[t[e]]!=null&&(this[t[e]]=r[t[e]])}return o.prototype.errorCode=1,o.create=function(t){return new o(t)},o.encode=function(t,e){return e||(e=d.create()),t.errorCode!=null&&Object.hasOwnProperty.call(t,"errorCode")&&e.uint32(8).int32(t.errorCode),e},o.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},o.decode=function(t,e){t instanceof u||(t=u.create(t));for(var n=e===void 0?t.len:t.pos+e,i=new c.LicenseError;t.pos<n;){var s=t.uint32();switch(s>>>3){case 1:{i.errorCode=t.int32();break}default:t.skipType(s&7);break}}return i},o.decodeDelimited=function(t){return t instanceof u||(t=new u(t)),this.decode(t,t.uint32())},o.fromObject=function(t){if(t instanceof c.LicenseError)return t;var e=new c.LicenseError;switch(t.errorCode){default:if(typeof t.errorCode=="number"){e.errorCode=t.errorCode;break}break;case"INVALID_DEVICE_CERTIFICATE":case 1:e.errorCode=1;break;case"REVOKED_DEVICE_CERTIFICATE":case 2:e.errorCode=2;break;case"SERVICE_UNAVAILABLE":case 3:e.errorCode=3;break}return e},o.toObject=function(t,e){e||(e={});var n={};return e.defaults&&(n.errorCode=e.enums===String?"INVALID_DEVICE_CERTIFICATE":1),t.errorCode!=null&&t.hasOwnProperty("errorCode")&&(n.errorCode=e.enums===String?c.LicenseError.Error[t.errorCode]===void 0?t.errorCode:c.LicenseError.Error[t.errorCode]:t.errorCode),n},o.prototype.toJSON=function(){return this.constructor.toObject(this,p.util.toJSONOptions)},o.getTypeUrl=function(t){return t===void 0&&(t="type.googleapis.com"),t+"/LicenseError"},o.Error=function(){let r={},t=Object.create(r);return t[r[1]="INVALID_DEVICE_CERTIFICATE"]=1,t[r[2]="REVOKED_DEVICE_CERTIFICATE"]=2,t[r[3]="SERVICE_UNAVAILABLE"]=3,t}(),o})(),E=c.DrmCertificate=(()=>{function o(r){if(this.serviceTypes=[],r)for(var t=Object.keys(r),e=0;e<t.length;++e)r[t[e]]!=null&&(this[t[e]]=r[t[e]])}return o.prototype.type=0,o.prototype.serialNumber=a.newBuffer([]),o.prototype.creationTimeSeconds=0,o.prototype.expirationTimeSeconds=0,o.prototype.publicKey=a.newBuffer([]),o.prototype.systemId=0,o.prototype.testDeviceDeprecated=!1,o.prototype.providerId="",o.prototype.serviceTypes=a.emptyArray,o.prototype.algorithm=1,o.prototype.rotId=a.newBuffer([]),o.prototype.encryptionKey=null,o.create=function(t){return new o(t)},o.encode=function(t,e){if(e||(e=d.create()),t.type!=null&&Object.hasOwnProperty.call(t,"type")&&e.uint32(8).int32(t.type),t.serialNumber!=null&&Object.hasOwnProperty.call(t,"serialNumber")&&e.uint32(18).bytes(t.serialNumber),t.creationTimeSeconds!=null&&Object.hasOwnProperty.call(t,"creationTimeSeconds")&&e.uint32(24).uint32(t.creationTimeSeconds),t.publicKey!=null&&Object.hasOwnProperty.call(t,"publicKey")&&e.uint32(34).bytes(t.publicKey),t.systemId!=null&&Object.hasOwnProperty.call(t,"systemId")&&e.uint32(40).uint32(t.systemId),t.testDeviceDeprecated!=null&&Object.hasOwnProperty.call(t,"testDeviceDeprecated")&&e.uint32(48).bool(t.testDeviceDeprecated),t.providerId!=null&&Object.hasOwnProperty.call(t,"providerId")&&e.uint32(58).string(t.providerId),t.serviceTypes!=null&&t.serviceTypes.length)for(var n=0;n<t.serviceTypes.length;++n)e.uint32(64).int32(t.serviceTypes[n]);return t.algorithm!=null&&Object.hasOwnProperty.call(t,"algorithm")&&e.uint32(72).int32(t.algorithm),t.rotId!=null&&Object.hasOwnProperty.call(t,"rotId")&&e.uint32(82).bytes(t.rotId),t.encryptionKey!=null&&Object.hasOwnProperty.call(t,"encryptionKey")&&c.DrmCertificate.EncryptionKey.encode(t.encryptionKey,e.uint32(90).fork()).ldelim(),t.expirationTimeSeconds!=null&&Object.hasOwnProperty.call(t,"expirationTimeSeconds")&&e.uint32(96).uint32(t.expirationTimeSeconds),e},o.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},o.decode=function(t,e){t instanceof u||(t=u.create(t));for(var n=e===void 0?t.len:t.pos+e,i=new c.DrmCertificate;t.pos<n;){var s=t.uint32();switch(s>>>3){case 1:{i.type=t.int32();break}case 2:{i.serialNumber=t.bytes();break}case 3:{i.creationTimeSeconds=t.uint32();break}case 12:{i.expirationTimeSeconds=t.uint32();break}case 4:{i.publicKey=t.bytes();break}case 5:{i.systemId=t.uint32();break}case 6:{i.testDeviceDeprecated=t.bool();break}case 7:{i.providerId=t.string();break}case 8:{if(i.serviceTypes&&i.serviceTypes.length||(i.serviceTypes=[]),(s&7)===2)for(var l=t.uint32()+t.pos;t.pos<l;)i.serviceTypes.push(t.int32());else i.serviceTypes.push(t.int32());break}case 9:{i.algorithm=t.int32();break}case 10:{i.rotId=t.bytes();break}case 11:{i.encryptionKey=c.DrmCertificate.EncryptionKey.decode(t,t.uint32());break}default:t.skipType(s&7);break}}return i},o.decodeDelimited=function(t){return t instanceof u||(t=new u(t)),this.decode(t,t.uint32())},o.fromObject=function(t){if(t instanceof c.DrmCertificate)return t;var e=new c.DrmCertificate;switch(t.type){default:if(typeof t.type=="number"){e.type=t.type;break}break;case"ROOT":case 0:e.type=0;break;case"DEVICE_MODEL":case 1:e.type=1;break;case"DEVICE":case 2:e.type=2;break;case"SERVICE":case 3:e.type=3;break;case"PROVISIONER":case 4:e.type=4;break}if(t.serialNumber!=null&&(typeof t.serialNumber=="string"?a.base64.decode(t.serialNumber,e.serialNumber=a.newBuffer(a.base64.length(t.serialNumber)),0):t.serialNumber.length>=0&&(e.serialNumber=t.serialNumber)),t.creationTimeSeconds!=null&&(e.creationTimeSeconds=t.creationTimeSeconds>>>0),t.expirationTimeSeconds!=null&&(e.expirationTimeSeconds=t.expirationTimeSeconds>>>0),t.publicKey!=null&&(typeof t.publicKey=="string"?a.base64.decode(t.publicKey,e.publicKey=a.newBuffer(a.base64.length(t.publicKey)),0):t.publicKey.length>=0&&(e.publicKey=t.publicKey)),t.systemId!=null&&(e.systemId=t.systemId>>>0),t.testDeviceDeprecated!=null&&(e.testDeviceDeprecated=!!t.testDeviceDeprecated),t.providerId!=null&&(e.providerId=String(t.providerId)),t.serviceTypes){if(!Array.isArray(t.serviceTypes))throw TypeError(".DrmCertificate.serviceTypes: array expected");e.serviceTypes=[];for(var n=0;n<t.serviceTypes.length;++n)switch(t.serviceTypes[n]){default:if(typeof t.serviceTypes[n]=="number"){e.serviceTypes[n]=t.serviceTypes[n];break}case"UNKNOWN_SERVICE_TYPE":case 0:e.serviceTypes[n]=0;break;case"LICENSE_SERVER_SDK":case 1:e.serviceTypes[n]=1;break;case"LICENSE_SERVER_PROXY_SDK":case 2:e.serviceTypes[n]=2;break;case"PROVISIONING_SDK":case 3:e.serviceTypes[n]=3;break;case"CAS_PROXY_SDK":case 4:e.serviceTypes[n]=4;break}}switch(t.algorithm){case"UNKNOWN_ALGORITHM":case 0:e.algorithm=0;break;default:if(typeof t.algorithm=="number"){e.algorithm=t.algorithm;break}break;case"RSA":case 1:e.algorithm=1;break;case"ECC_SECP256R1":case 2:e.algorithm=2;break;case"ECC_SECP384R1":case 3:e.algorithm=3;break;case"ECC_SECP521R1":case 4:e.algorithm=4;break}if(t.rotId!=null&&(typeof t.rotId=="string"?a.base64.decode(t.rotId,e.rotId=a.newBuffer(a.base64.length(t.rotId)),0):t.rotId.length>=0&&(e.rotId=t.rotId)),t.encryptionKey!=null){if(typeof t.encryptionKey!="object")throw TypeError(".DrmCertificate.encryptionKey: object expected");e.encryptionKey=c.DrmCertificate.EncryptionKey.fromObject(t.encryptionKey)}return e},o.toObject=function(t,e){e||(e={});var n={};if((e.arrays||e.defaults)&&(n.serviceTypes=[]),e.defaults&&(n.type=e.enums===String?"ROOT":0,e.bytes===String?n.serialNumber="":(n.serialNumber=[],e.bytes!==Array&&(n.serialNumber=a.newBuffer(n.serialNumber))),n.creationTimeSeconds=0,e.bytes===String?n.publicKey="":(n.publicKey=[],e.bytes!==Array&&(n.publicKey=a.newBuffer(n.publicKey))),n.systemId=0,n.testDeviceDeprecated=!1,n.providerId="",n.algorithm=e.enums===String?"RSA":1,e.bytes===String?n.rotId="":(n.rotId=[],e.bytes!==Array&&(n.rotId=a.newBuffer(n.rotId))),n.encryptionKey=null,n.expirationTimeSeconds=0),t.type!=null&&t.hasOwnProperty("type")&&(n.type=e.enums===String?c.DrmCertificate.Type[t.type]===void 0?t.type:c.DrmCertificate.Type[t.type]:t.type),t.serialNumber!=null&&t.hasOwnProperty("serialNumber")&&(n.serialNumber=e.bytes===String?a.base64.encode(t.serialNumber,0,t.serialNumber.length):e.bytes===Array?Array.prototype.slice.call(t.serialNumber):t.serialNumber),t.creationTimeSeconds!=null&&t.hasOwnProperty("creationTimeSeconds")&&(n.creationTimeSeconds=t.creationTimeSeconds),t.publicKey!=null&&t.hasOwnProperty("publicKey")&&(n.publicKey=e.bytes===String?a.base64.encode(t.publicKey,0,t.publicKey.length):e.bytes===Array?Array.prototype.slice.call(t.publicKey):t.publicKey),t.systemId!=null&&t.hasOwnProperty("systemId")&&(n.systemId=t.systemId),t.testDeviceDeprecated!=null&&t.hasOwnProperty("testDeviceDeprecated")&&(n.testDeviceDeprecated=t.testDeviceDeprecated),t.providerId!=null&&t.hasOwnProperty("providerId")&&(n.providerId=t.providerId),t.serviceTypes&&t.serviceTypes.length){n.serviceTypes=[];for(var i=0;i<t.serviceTypes.length;++i)n.serviceTypes[i]=e.enums===String?c.DrmCertificate.ServiceType[t.serviceTypes[i]]===void 0?t.serviceTypes[i]:c.DrmCertificate.ServiceType[t.serviceTypes[i]]:t.serviceTypes[i]}return t.algorithm!=null&&t.hasOwnProperty("algorithm")&&(n.algorithm=e.enums===String?c.DrmCertificate.Algorithm[t.algorithm]===void 0?t.algorithm:c.DrmCertificate.Algorithm[t.algorithm]:t.algorithm),t.rotId!=null&&t.hasOwnProperty("rotId")&&(n.rotId=e.bytes===String?a.base64.encode(t.rotId,0,t.rotId.length):e.bytes===Array?Array.prototype.slice.call(t.rotId):t.rotId),t.encryptionKey!=null&&t.hasOwnProperty("encryptionKey")&&(n.encryptionKey=c.DrmCertificate.EncryptionKey.toObject(t.encryptionKey,e)),t.expirationTimeSeconds!=null&&t.hasOwnProperty("expirationTimeSeconds")&&(n.expirationTimeSeconds=t.expirationTimeSeconds),n},o.prototype.toJSON=function(){return this.constructor.toObject(this,p.util.toJSONOptions)},o.getTypeUrl=function(t){return t===void 0&&(t="type.googleapis.com"),t+"/DrmCertificate"},o.Type=function(){let r={},t=Object.create(r);return t[r[0]="ROOT"]=0,t[r[1]="DEVICE_MODEL"]=1,t[r[2]="DEVICE"]=2,t[r[3]="SERVICE"]=3,t[r[4]="PROVISIONER"]=4,t}(),o.ServiceType=function(){let r={},t=Object.create(r);return t[r[0]="UNKNOWN_SERVICE_TYPE"]=0,t[r[1]="LICENSE_SERVER_SDK"]=1,t[r[2]="LICENSE_SERVER_PROXY_SDK"]=2,t[r[3]="PROVISIONING_SDK"]=3,t[r[4]="CAS_PROXY_SDK"]=4,t}(),o.Algorithm=function(){let r={},t=Object.create(r);return t[r[0]="UNKNOWN_ALGORITHM"]=0,t[r[1]="RSA"]=1,t[r[2]="ECC_SECP256R1"]=2,t[r[3]="ECC_SECP384R1"]=3,t[r[4]="ECC_SECP521R1"]=4,t}(),o.EncryptionKey=function(){function r(t){if(t)for(var e=Object.keys(t),n=0;n<e.length;++n)t[e[n]]!=null&&(this[e[n]]=t[e[n]])}return r.prototype.publicKey=a.newBuffer([]),r.prototype.algorithm=1,r.create=function(e){return new r(e)},r.encode=function(e,n){return n||(n=d.create()),e.publicKey!=null&&Object.hasOwnProperty.call(e,"publicKey")&&n.uint32(10).bytes(e.publicKey),e.algorithm!=null&&Object.hasOwnProperty.call(e,"algorithm")&&n.uint32(16).int32(e.algorithm),n},r.encodeDelimited=function(e,n){return this.encode(e,n).ldelim()},r.decode=function(e,n){e instanceof u||(e=u.create(e));for(var i=n===void 0?e.len:e.pos+n,s=new c.DrmCertificate.EncryptionKey;e.pos<i;){var l=e.uint32();switch(l>>>3){case 1:{s.publicKey=e.bytes();break}case 2:{s.algorithm=e.int32();break}default:e.skipType(l&7);break}}return s},r.decodeDelimited=function(e){return e instanceof u||(e=new u(e)),this.decode(e,e.uint32())},r.fromObject=function(e){if(e instanceof c.DrmCertificate.EncryptionKey)return e;var n=new c.DrmCertificate.EncryptionKey;switch(e.publicKey!=null&&(typeof e.publicKey=="string"?a.base64.decode(e.publicKey,n.publicKey=a.newBuffer(a.base64.length(e.publicKey)),0):e.publicKey.length>=0&&(n.publicKey=e.publicKey)),e.algorithm){case"UNKNOWN_ALGORITHM":case 0:n.algorithm=0;break;default:if(typeof e.algorithm=="number"){n.algorithm=e.algorithm;break}break;case"RSA":case 1:n.algorithm=1;break;case"ECC_SECP256R1":case 2:n.algorithm=2;break;case"ECC_SECP384R1":case 3:n.algorithm=3;break;case"ECC_SECP521R1":case 4:n.algorithm=4;break}return n},r.toObject=function(e,n){n||(n={});var i={};return n.defaults&&(n.bytes===String?i.publicKey="":(i.publicKey=[],n.bytes!==Array&&(i.publicKey=a.newBuffer(i.publicKey))),i.algorithm=n.enums===String?"RSA":1),e.publicKey!=null&&e.hasOwnProperty("publicKey")&&(i.publicKey=n.bytes===String?a.base64.encode(e.publicKey,0,e.publicKey.length):n.bytes===Array?Array.prototype.slice.call(e.publicKey):e.publicKey),e.algorithm!=null&&e.hasOwnProperty("algorithm")&&(i.algorithm=n.enums===String?c.DrmCertificate.Algorithm[e.algorithm]===void 0?e.algorithm:c.DrmCertificate.Algorithm[e.algorithm]:e.algorithm),i},r.prototype.toJSON=function(){return this.constructor.toObject(this,p.util.toJSONOptions)},r.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/DrmCertificate.EncryptionKey"},r}(),o})(),A=c.SignedDrmCertificate=(()=>{function o(r){if(r)for(var t=Object.keys(r),e=0;e<t.length;++e)r[t[e]]!=null&&(this[t[e]]=r[t[e]])}return o.prototype.drmCertificate=a.newBuffer([]),o.prototype.signature=a.newBuffer([]),o.prototype.signer=null,o.prototype.hashAlgorithm=0,o.create=function(t){return new o(t)},o.encode=function(t,e){return e||(e=d.create()),t.drmCertificate!=null&&Object.hasOwnProperty.call(t,"drmCertificate")&&e.uint32(10).bytes(t.drmCertificate),t.signature!=null&&Object.hasOwnProperty.call(t,"signature")&&e.uint32(18).bytes(t.signature),t.signer!=null&&Object.hasOwnProperty.call(t,"signer")&&c.SignedDrmCertificate.encode(t.signer,e.uint32(26).fork()).ldelim(),t.hashAlgorithm!=null&&Object.hasOwnProperty.call(t,"hashAlgorithm")&&e.uint32(32).int32(t.hashAlgorithm),e},o.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},o.decode=function(t,e){t instanceof u||(t=u.create(t));for(var n=e===void 0?t.len:t.pos+e,i=new c.SignedDrmCertificate;t.pos<n;){var s=t.uint32();switch(s>>>3){case 1:{i.drmCertificate=t.bytes();break}case 2:{i.signature=t.bytes();break}case 3:{i.signer=c.SignedDrmCertificate.decode(t,t.uint32());break}case 4:{i.hashAlgorithm=t.int32();break}default:t.skipType(s&7);break}}return i},o.decodeDelimited=function(t){return t instanceof u||(t=new u(t)),this.decode(t,t.uint32())},o.fromObject=function(t){if(t instanceof c.SignedDrmCertificate)return t;var e=new c.SignedDrmCertificate;if(t.drmCertificate!=null&&(typeof t.drmCertificate=="string"?a.base64.decode(t.drmCertificate,e.drmCertificate=a.newBuffer(a.base64.length(t.drmCertificate)),0):t.drmCertificate.length>=0&&(e.drmCertificate=t.drmCertificate)),t.signature!=null&&(typeof t.signature=="string"?a.base64.decode(t.signature,e.signature=a.newBuffer(a.base64.length(t.signature)),0):t.signature.length>=0&&(e.signature=t.signature)),t.signer!=null){if(typeof t.signer!="object")throw TypeError(".SignedDrmCertificate.signer: object expected");e.signer=c.SignedDrmCertificate.fromObject(t.signer)}switch(t.hashAlgorithm){default:if(typeof t.hashAlgorithm=="number"){e.hashAlgorithm=t.hashAlgorithm;break}break;case"HASH_ALGORITHM_UNSPECIFIED":case 0:e.hashAlgorithm=0;break;case"HASH_ALGORITHM_SHA_1":case 1:e.hashAlgorithm=1;break;case"HASH_ALGORITHM_SHA_256":case 2:e.hashAlgorithm=2;break;case"HASH_ALGORITHM_SHA_384":case 3:e.hashAlgorithm=3;break}return e},o.toObject=function(t,e){e||(e={});var n={};return e.defaults&&(e.bytes===String?n.drmCertificate="":(n.drmCertificate=[],e.bytes!==Array&&(n.drmCertificate=a.newBuffer(n.drmCertificate))),e.bytes===String?n.signature="":(n.signature=[],e.bytes!==Array&&(n.signature=a.newBuffer(n.signature))),n.signer=null,n.hashAlgorithm=e.enums===String?"HASH_ALGORITHM_UNSPECIFIED":0),t.drmCertificate!=null&&t.hasOwnProperty("drmCertificate")&&(n.drmCertificate=e.bytes===String?a.base64.encode(t.drmCertificate,0,t.drmCertificate.length):e.bytes===Array?Array.prototype.slice.call(t.drmCertificate):t.drmCertificate),t.signature!=null&&t.hasOwnProperty("signature")&&(n.signature=e.bytes===String?a.base64.encode(t.signature,0,t.signature.length):e.bytes===Array?Array.prototype.slice.call(t.signature):t.signature),t.signer!=null&&t.hasOwnProperty("signer")&&(n.signer=c.SignedDrmCertificate.toObject(t.signer,e)),t.hashAlgorithm!=null&&t.hasOwnProperty("hashAlgorithm")&&(n.hashAlgorithm=e.enums===String?c.HashAlgorithmProto[t.hashAlgorithm]===void 0?t.hashAlgorithm:c.HashAlgorithmProto[t.hashAlgorithm]:t.hashAlgorithm),n},o.prototype.toJSON=function(){return this.constructor.toObject(this,p.util.toJSONOptions)},o.getTypeUrl=function(t){return t===void 0&&(t="type.googleapis.com"),t+"/SignedDrmCertificate"},o})(),z=c.WidevinePsshData=(()=>{function o(r){if(this.keyIds=[],this.groupIds=[],this.entitledKeys=[],r)for(var t=Object.keys(r),e=0;e<t.length;++e)r[t[e]]!=null&&(this[t[e]]=r[t[e]])}return o.prototype.keyIds=a.emptyArray,o.prototype.contentId=a.newBuffer([]),o.prototype.cryptoPeriodIndex=0,o.prototype.protectionScheme=0,o.prototype.cryptoPeriodSeconds=0,o.prototype.type=0,o.prototype.keySequence=0,o.prototype.groupIds=a.emptyArray,o.prototype.entitledKeys=a.emptyArray,o.prototype.videoFeature="",o.prototype.algorithm=0,o.prototype.provider="",o.prototype.trackType="",o.prototype.policy="",o.prototype.groupedLicense=a.newBuffer([]),o.create=function(t){return new o(t)},o.encode=function(t,e){if(e||(e=d.create()),t.algorithm!=null&&Object.hasOwnProperty.call(t,"algorithm")&&e.uint32(8).int32(t.algorithm),t.keyIds!=null&&t.keyIds.length)for(var n=0;n<t.keyIds.length;++n)e.uint32(18).bytes(t.keyIds[n]);if(t.provider!=null&&Object.hasOwnProperty.call(t,"provider")&&e.uint32(26).string(t.provider),t.contentId!=null&&Object.hasOwnProperty.call(t,"contentId")&&e.uint32(34).bytes(t.contentId),t.trackType!=null&&Object.hasOwnProperty.call(t,"trackType")&&e.uint32(42).string(t.trackType),t.policy!=null&&Object.hasOwnProperty.call(t,"policy")&&e.uint32(50).string(t.policy),t.cryptoPeriodIndex!=null&&Object.hasOwnProperty.call(t,"cryptoPeriodIndex")&&e.uint32(56).uint32(t.cryptoPeriodIndex),t.groupedLicense!=null&&Object.hasOwnProperty.call(t,"groupedLicense")&&e.uint32(66).bytes(t.groupedLicense),t.protectionScheme!=null&&Object.hasOwnProperty.call(t,"protectionScheme")&&e.uint32(72).uint32(t.protectionScheme),t.cryptoPeriodSeconds!=null&&Object.hasOwnProperty.call(t,"cryptoPeriodSeconds")&&e.uint32(80).uint32(t.cryptoPeriodSeconds),t.type!=null&&Object.hasOwnProperty.call(t,"type")&&e.uint32(88).int32(t.type),t.keySequence!=null&&Object.hasOwnProperty.call(t,"keySequence")&&e.uint32(96).uint32(t.keySequence),t.groupIds!=null&&t.groupIds.length)for(var n=0;n<t.groupIds.length;++n)e.uint32(106).bytes(t.groupIds[n]);if(t.entitledKeys!=null&&t.entitledKeys.length)for(var n=0;n<t.entitledKeys.length;++n)c.WidevinePsshData.EntitledKey.encode(t.entitledKeys[n],e.uint32(114).fork()).ldelim();return t.videoFeature!=null&&Object.hasOwnProperty.call(t,"videoFeature")&&e.uint32(122).string(t.videoFeature),e},o.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},o.decode=function(t,e){t instanceof u||(t=u.create(t));for(var n=e===void 0?t.len:t.pos+e,i=new c.WidevinePsshData;t.pos<n;){var s=t.uint32();switch(s>>>3){case 2:{i.keyIds&&i.keyIds.length||(i.keyIds=[]),i.keyIds.push(t.bytes());break}case 4:{i.contentId=t.bytes();break}case 7:{i.cryptoPeriodIndex=t.uint32();break}case 9:{i.protectionScheme=t.uint32();break}case 10:{i.cryptoPeriodSeconds=t.uint32();break}case 11:{i.type=t.int32();break}case 12:{i.keySequence=t.uint32();break}case 13:{i.groupIds&&i.groupIds.length||(i.groupIds=[]),i.groupIds.push(t.bytes());break}case 14:{i.entitledKeys&&i.entitledKeys.length||(i.entitledKeys=[]),i.entitledKeys.push(c.WidevinePsshData.EntitledKey.decode(t,t.uint32()));break}case 15:{i.videoFeature=t.string();break}case 1:{i.algorithm=t.int32();break}case 3:{i.provider=t.string();break}case 5:{i.trackType=t.string();break}case 6:{i.policy=t.string();break}case 8:{i.groupedLicense=t.bytes();break}default:t.skipType(s&7);break}}return i},o.decodeDelimited=function(t){return t instanceof u||(t=new u(t)),this.decode(t,t.uint32())},o.fromObject=function(t){if(t instanceof c.WidevinePsshData)return t;var e=new c.WidevinePsshData;if(t.keyIds){if(!Array.isArray(t.keyIds))throw TypeError(".WidevinePsshData.keyIds: array expected");e.keyIds=[];for(var n=0;n<t.keyIds.length;++n)typeof t.keyIds[n]=="string"?a.base64.decode(t.keyIds[n],e.keyIds[n]=a.newBuffer(a.base64.length(t.keyIds[n])),0):t.keyIds[n].length>=0&&(e.keyIds[n]=t.keyIds[n])}switch(t.contentId!=null&&(typeof t.contentId=="string"?a.base64.decode(t.contentId,e.contentId=a.newBuffer(a.base64.length(t.contentId)),0):t.contentId.length>=0&&(e.contentId=t.contentId)),t.cryptoPeriodIndex!=null&&(e.cryptoPeriodIndex=t.cryptoPeriodIndex>>>0),t.protectionScheme!=null&&(e.protectionScheme=t.protectionScheme>>>0),t.cryptoPeriodSeconds!=null&&(e.cryptoPeriodSeconds=t.cryptoPeriodSeconds>>>0),t.type){default:if(typeof t.type=="number"){e.type=t.type;break}break;case"SINGLE":case 0:e.type=0;break;case"ENTITLEMENT":case 1:e.type=1;break;case"ENTITLED_KEY":case 2:e.type=2;break}if(t.keySequence!=null&&(e.keySequence=t.keySequence>>>0),t.groupIds){if(!Array.isArray(t.groupIds))throw TypeError(".WidevinePsshData.groupIds: array expected");e.groupIds=[];for(var n=0;n<t.groupIds.length;++n)typeof t.groupIds[n]=="string"?a.base64.decode(t.groupIds[n],e.groupIds[n]=a.newBuffer(a.base64.length(t.groupIds[n])),0):t.groupIds[n].length>=0&&(e.groupIds[n]=t.groupIds[n])}if(t.entitledKeys){if(!Array.isArray(t.entitledKeys))throw TypeError(".WidevinePsshData.entitledKeys: array expected");e.entitledKeys=[];for(var n=0;n<t.entitledKeys.length;++n){if(typeof t.entitledKeys[n]!="object")throw TypeError(".WidevinePsshData.entitledKeys: object expected");e.entitledKeys[n]=c.WidevinePsshData.EntitledKey.fromObject(t.entitledKeys[n])}}switch(t.videoFeature!=null&&(e.videoFeature=String(t.videoFeature)),t.algorithm){default:if(typeof t.algorithm=="number"){e.algorithm=t.algorithm;break}break;case"UNENCRYPTED":case 0:e.algorithm=0;break;case"AESCTR":case 1:e.algorithm=1;break}return t.provider!=null&&(e.provider=String(t.provider)),t.trackType!=null&&(e.trackType=String(t.trackType)),t.policy!=null&&(e.policy=String(t.policy)),t.groupedLicense!=null&&(typeof t.groupedLicense=="string"?a.base64.decode(t.groupedLicense,e.groupedLicense=a.newBuffer(a.base64.length(t.groupedLicense)),0):t.groupedLicense.length>=0&&(e.groupedLicense=t.groupedLicense)),e},o.toObject=function(t,e){e||(e={});var n={};if((e.arrays||e.defaults)&&(n.keyIds=[],n.groupIds=[],n.entitledKeys=[]),e.defaults&&(n.algorithm=e.enums===String?"UNENCRYPTED":0,n.provider="",e.bytes===String?n.contentId="":(n.contentId=[],e.bytes!==Array&&(n.contentId=a.newBuffer(n.contentId))),n.trackType="",n.policy="",n.cryptoPeriodIndex=0,e.bytes===String?n.groupedLicense="":(n.groupedLicense=[],e.bytes!==Array&&(n.groupedLicense=a.newBuffer(n.groupedLicense))),n.protectionScheme=0,n.cryptoPeriodSeconds=0,n.type=e.enums===String?"SINGLE":0,n.keySequence=0,n.videoFeature=""),t.algorithm!=null&&t.hasOwnProperty("algorithm")&&(n.algorithm=e.enums===String?c.WidevinePsshData.Algorithm[t.algorithm]===void 0?t.algorithm:c.WidevinePsshData.Algorithm[t.algorithm]:t.algorithm),t.keyIds&&t.keyIds.length){n.keyIds=[];for(var i=0;i<t.keyIds.length;++i)n.keyIds[i]=e.bytes===String?a.base64.encode(t.keyIds[i],0,t.keyIds[i].length):e.bytes===Array?Array.prototype.slice.call(t.keyIds[i]):t.keyIds[i]}if(t.provider!=null&&t.hasOwnProperty("provider")&&(n.provider=t.provider),t.contentId!=null&&t.hasOwnProperty("contentId")&&(n.contentId=e.bytes===String?a.base64.encode(t.contentId,0,t.contentId.length):e.bytes===Array?Array.prototype.slice.call(t.contentId):t.contentId),t.trackType!=null&&t.hasOwnProperty("trackType")&&(n.trackType=t.trackType),t.policy!=null&&t.hasOwnProperty("policy")&&(n.policy=t.policy),t.cryptoPeriodIndex!=null&&t.hasOwnProperty("cryptoPeriodIndex")&&(n.cryptoPeriodIndex=t.cryptoPeriodIndex),t.groupedLicense!=null&&t.hasOwnProperty("groupedLicense")&&(n.groupedLicense=e.bytes===String?a.base64.encode(t.groupedLicense,0,t.groupedLicense.length):e.bytes===Array?Array.prototype.slice.call(t.groupedLicense):t.groupedLicense),t.protectionScheme!=null&&t.hasOwnProperty("protectionScheme")&&(n.protectionScheme=t.protectionScheme),t.cryptoPeriodSeconds!=null&&t.hasOwnProperty("cryptoPeriodSeconds")&&(n.cryptoPeriodSeconds=t.cryptoPeriodSeconds),t.type!=null&&t.hasOwnProperty("type")&&(n.type=e.enums===String?c.WidevinePsshData.Type[t.type]===void 0?t.type:c.WidevinePsshData.Type[t.type]:t.type),t.keySequence!=null&&t.hasOwnProperty("keySequence")&&(n.keySequence=t.keySequence),t.groupIds&&t.groupIds.length){n.groupIds=[];for(var i=0;i<t.groupIds.length;++i)n.groupIds[i]=e.bytes===String?a.base64.encode(t.groupIds[i],0,t.groupIds[i].length):e.bytes===Array?Array.prototype.slice.call(t.groupIds[i]):t.groupIds[i]}if(t.entitledKeys&&t.entitledKeys.length){n.entitledKeys=[];for(var i=0;i<t.entitledKeys.length;++i)n.entitledKeys[i]=c.WidevinePsshData.EntitledKey.toObject(t.entitledKeys[i],e)}return t.videoFeature!=null&&t.hasOwnProperty("videoFeature")&&(n.videoFeature=t.videoFeature),n},o.prototype.toJSON=function(){return this.constructor.toObject(this,p.util.toJSONOptions)},o.getTypeUrl=function(t){return t===void 0&&(t="type.googleapis.com"),t+"/WidevinePsshData"},o.Type=function(){let r={},t=Object.create(r);return t[r[0]="SINGLE"]=0,t[r[1]="ENTITLEMENT"]=1,t[r[2]="ENTITLED_KEY"]=2,t}(),o.EntitledKey=function(){function r(t){if(t)for(var e=Object.keys(t),n=0;n<e.length;++n)t[e[n]]!=null&&(this[e[n]]=t[e[n]])}return r.prototype.entitlementKeyId=a.newBuffer([]),r.prototype.keyId=a.newBuffer([]),r.prototype.key=a.newBuffer([]),r.prototype.iv=a.newBuffer([]),r.prototype.entitlementKeySizeBytes=32,r.create=function(e){return new r(e)},r.encode=function(e,n){return n||(n=d.create()),e.entitlementKeyId!=null&&Object.hasOwnProperty.call(e,"entitlementKeyId")&&n.uint32(10).bytes(e.entitlementKeyId),e.keyId!=null&&Object.hasOwnProperty.call(e,"keyId")&&n.uint32(18).bytes(e.keyId),e.key!=null&&Object.hasOwnProperty.call(e,"key")&&n.uint32(26).bytes(e.key),e.iv!=null&&Object.hasOwnProperty.call(e,"iv")&&n.uint32(34).bytes(e.iv),e.entitlementKeySizeBytes!=null&&Object.hasOwnProperty.call(e,"entitlementKeySizeBytes")&&n.uint32(40).uint32(e.entitlementKeySizeBytes),n},r.encodeDelimited=function(e,n){return this.encode(e,n).ldelim()},r.decode=function(e,n){e instanceof u||(e=u.create(e));for(var i=n===void 0?e.len:e.pos+n,s=new c.WidevinePsshData.EntitledKey;e.pos<i;){var l=e.uint32();switch(l>>>3){case 1:{s.entitlementKeyId=e.bytes();break}case 2:{s.keyId=e.bytes();break}case 3:{s.key=e.bytes();break}case 4:{s.iv=e.bytes();break}case 5:{s.entitlementKeySizeBytes=e.uint32();break}default:e.skipType(l&7);break}}return s},r.decodeDelimited=function(e){return e instanceof u||(e=new u(e)),this.decode(e,e.uint32())},r.fromObject=function(e){if(e instanceof c.WidevinePsshData.EntitledKey)return e;var n=new c.WidevinePsshData.EntitledKey;return e.entitlementKeyId!=null&&(typeof e.entitlementKeyId=="string"?a.base64.decode(e.entitlementKeyId,n.entitlementKeyId=a.newBuffer(a.base64.length(e.entitlementKeyId)),0):e.entitlementKeyId.length>=0&&(n.entitlementKeyId=e.entitlementKeyId)),e.keyId!=null&&(typeof e.keyId=="string"?a.base64.decode(e.keyId,n.keyId=a.newBuffer(a.base64.length(e.keyId)),0):e.keyId.length>=0&&(n.keyId=e.keyId)),e.key!=null&&(typeof e.key=="string"?a.base64.decode(e.key,n.key=a.newBuffer(a.base64.length(e.key)),0):e.key.length>=0&&(n.key=e.key)),e.iv!=null&&(typeof e.iv=="string"?a.base64.decode(e.iv,n.iv=a.newBuffer(a.base64.length(e.iv)),0):e.iv.length>=0&&(n.iv=e.iv)),e.entitlementKeySizeBytes!=null&&(n.entitlementKeySizeBytes=e.entitlementKeySizeBytes>>>0),n},r.toObject=function(e,n){n||(n={});var i={};return n.defaults&&(n.bytes===String?i.entitlementKeyId="":(i.entitlementKeyId=[],n.bytes!==Array&&(i.entitlementKeyId=a.newBuffer(i.entitlementKeyId))),n.bytes===String?i.keyId="":(i.keyId=[],n.bytes!==Array&&(i.keyId=a.newBuffer(i.keyId))),n.bytes===String?i.key="":(i.key=[],n.bytes!==Array&&(i.key=a.newBuffer(i.key))),n.bytes===String?i.iv="":(i.iv=[],n.bytes!==Array&&(i.iv=a.newBuffer(i.iv))),i.entitlementKeySizeBytes=32),e.entitlementKeyId!=null&&e.hasOwnProperty("entitlementKeyId")&&(i.entitlementKeyId=n.bytes===String?a.base64.encode(e.entitlementKeyId,0,e.entitlementKeyId.length):n.bytes===Array?Array.prototype.slice.call(e.entitlementKeyId):e.entitlementKeyId),e.keyId!=null&&e.hasOwnProperty("keyId")&&(i.keyId=n.bytes===String?a.base64.encode(e.keyId,0,e.keyId.length):n.bytes===Array?Array.prototype.slice.call(e.keyId):e.keyId),e.key!=null&&e.hasOwnProperty("key")&&(i.key=n.bytes===String?a.base64.encode(e.key,0,e.key.length):n.bytes===Array?Array.prototype.slice.call(e.key):e.key),e.iv!=null&&e.hasOwnProperty("iv")&&(i.iv=n.bytes===String?a.base64.encode(e.iv,0,e.iv.length):n.bytes===Array?Array.prototype.slice.call(e.iv):e.iv),e.entitlementKeySizeBytes!=null&&e.hasOwnProperty("entitlementKeySizeBytes")&&(i.entitlementKeySizeBytes=e.entitlementKeySizeBytes),i},r.prototype.toJSON=function(){return this.constructor.toObject(this,p.util.toJSONOptions)},r.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/WidevinePsshData.EntitledKey"},r}(),o.Algorithm=function(){let r={},t=Object.create(r);return t[r[0]="UNENCRYPTED"]=0,t[r[1]="AESCTR"]=1,t}(),o})(),$=c.FileHashes=(()=>{function o(r){if(this.signatures=[],r)for(var t=Object.keys(r),e=0;e<t.length;++e)r[t[e]]!=null&&(this[t[e]]=r[t[e]])}return o.prototype.signer=a.newBuffer([]),o.prototype.signatures=a.emptyArray,o.create=function(t){return new o(t)},o.encode=function(t,e){if(e||(e=d.create()),t.signer!=null&&Object.hasOwnProperty.call(t,"signer")&&e.uint32(10).bytes(t.signer),t.signatures!=null&&t.signatures.length)for(var n=0;n<t.signatures.length;++n)c.FileHashes.Signature.encode(t.signatures[n],e.uint32(18).fork()).ldelim();return e},o.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},o.decode=function(t,e){t instanceof u||(t=u.create(t));for(var n=e===void 0?t.len:t.pos+e,i=new c.FileHashes;t.pos<n;){var s=t.uint32();switch(s>>>3){case 1:{i.signer=t.bytes();break}case 2:{i.signatures&&i.signatures.length||(i.signatures=[]),i.signatures.push(c.FileHashes.Signature.decode(t,t.uint32()));break}default:t.skipType(s&7);break}}return i},o.decodeDelimited=function(t){return t instanceof u||(t=new u(t)),this.decode(t,t.uint32())},o.fromObject=function(t){if(t instanceof c.FileHashes)return t;var e=new c.FileHashes;if(t.signer!=null&&(typeof t.signer=="string"?a.base64.decode(t.signer,e.signer=a.newBuffer(a.base64.length(t.signer)),0):t.signer.length>=0&&(e.signer=t.signer)),t.signatures){if(!Array.isArray(t.signatures))throw TypeError(".FileHashes.signatures: array expected");e.signatures=[];for(var n=0;n<t.signatures.length;++n){if(typeof t.signatures[n]!="object")throw TypeError(".FileHashes.signatures: object expected");e.signatures[n]=c.FileHashes.Signature.fromObject(t.signatures[n])}}return e},o.toObject=function(t,e){e||(e={});var n={};if((e.arrays||e.defaults)&&(n.signatures=[]),e.defaults&&(e.bytes===String?n.signer="":(n.signer=[],e.bytes!==Array&&(n.signer=a.newBuffer(n.signer)))),t.signer!=null&&t.hasOwnProperty("signer")&&(n.signer=e.bytes===String?a.base64.encode(t.signer,0,t.signer.length):e.bytes===Array?Array.prototype.slice.call(t.signer):t.signer),t.signatures&&t.signatures.length){n.signatures=[];for(var i=0;i<t.signatures.length;++i)n.signatures[i]=c.FileHashes.Signature.toObject(t.signatures[i],e)}return n},o.prototype.toJSON=function(){return this.constructor.toObject(this,p.util.toJSONOptions)},o.getTypeUrl=function(t){return t===void 0&&(t="type.googleapis.com"),t+"/FileHashes"},o.Signature=function(){function r(t){if(t)for(var e=Object.keys(t),n=0;n<e.length;++n)t[e[n]]!=null&&(this[e[n]]=t[e[n]])}return r.prototype.filename="",r.prototype.testSigning=!1,r.prototype.SHA512Hash=a.newBuffer([]),r.prototype.mainExe=!1,r.prototype.signature=a.newBuffer([]),r.create=function(e){return new r(e)},r.encode=function(e,n){return n||(n=d.create()),e.filename!=null&&Object.hasOwnProperty.call(e,"filename")&&n.uint32(10).string(e.filename),e.testSigning!=null&&Object.hasOwnProperty.call(e,"testSigning")&&n.uint32(16).bool(e.testSigning),e.SHA512Hash!=null&&Object.hasOwnProperty.call(e,"SHA512Hash")&&n.uint32(26).bytes(e.SHA512Hash),e.mainExe!=null&&Object.hasOwnProperty.call(e,"mainExe")&&n.uint32(32).bool(e.mainExe),e.signature!=null&&Object.hasOwnProperty.call(e,"signature")&&n.uint32(42).bytes(e.signature),n},r.encodeDelimited=function(e,n){return this.encode(e,n).ldelim()},r.decode=function(e,n){e instanceof u||(e=u.create(e));for(var i=n===void 0?e.len:e.pos+n,s=new c.FileHashes.Signature;e.pos<i;){var l=e.uint32();switch(l>>>3){case 1:{s.filename=e.string();break}case 2:{s.testSigning=e.bool();break}case 3:{s.SHA512Hash=e.bytes();break}case 4:{s.mainExe=e.bool();break}case 5:{s.signature=e.bytes();break}default:e.skipType(l&7);break}}return s},r.decodeDelimited=function(e){return e instanceof u||(e=new u(e)),this.decode(e,e.uint32())},r.fromObject=function(e){if(e instanceof c.FileHashes.Signature)return e;var n=new c.FileHashes.Signature;return e.filename!=null&&(n.filename=String(e.filename)),e.testSigning!=null&&(n.testSigning=!!e.testSigning),e.SHA512Hash!=null&&(typeof e.SHA512Hash=="string"?a.base64.decode(e.SHA512Hash,n.SHA512Hash=a.newBuffer(a.base64.length(e.SHA512Hash)),0):e.SHA512Hash.length>=0&&(n.SHA512Hash=e.SHA512Hash)),e.mainExe!=null&&(n.mainExe=!!e.mainExe),e.signature!=null&&(typeof e.signature=="string"?a.base64.decode(e.signature,n.signature=a.newBuffer(a.base64.length(e.signature)),0):e.signature.length>=0&&(n.signature=e.signature)),n},r.toObject=function(e,n){n||(n={});var i={};return n.defaults&&(i.filename="",i.testSigning=!1,n.bytes===String?i.SHA512Hash="":(i.SHA512Hash=[],n.bytes!==Array&&(i.SHA512Hash=a.newBuffer(i.SHA512Hash))),i.mainExe=!1,n.bytes===String?i.signature="":(i.signature=[],n.bytes!==Array&&(i.signature=a.newBuffer(i.signature)))),e.filename!=null&&e.hasOwnProperty("filename")&&(i.filename=e.filename),e.testSigning!=null&&e.hasOwnProperty("testSigning")&&(i.testSigning=e.testSigning),e.SHA512Hash!=null&&e.hasOwnProperty("SHA512Hash")&&(i.SHA512Hash=n.bytes===String?a.base64.encode(e.SHA512Hash,0,e.SHA512Hash.length):n.bytes===Array?Array.prototype.slice.call(e.SHA512Hash):e.SHA512Hash),e.mainExe!=null&&e.hasOwnProperty("mainExe")&&(i.mainExe=e.mainExe),e.signature!=null&&e.hasOwnProperty("signature")&&(i.signature=n.bytes===String?a.base64.encode(e.signature,0,e.signature.length):n.bytes===Array?Array.prototype.slice.call(e.signature):e.signature),i},r.prototype.toJSON=function(){return this.constructor.toObject(this,p.util.toJSONOptions)},r.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/FileHashes.Signature"},r}(),o})(),Lt=c.RemoteAttestation=(()=>{function o(r){if(r)for(var t=Object.keys(r),e=0;e<t.length;++e)r[t[e]]!=null&&(this[t[e]]=r[t[e]])}return o.prototype.certificate=null,o.prototype.salt=a.newBuffer([]),o.prototype.signature=a.newBuffer([]),o.create=function(t){return new o(t)},o.encode=function(t,e){return e||(e=d.create()),t.certificate!=null&&Object.hasOwnProperty.call(t,"certificate")&&c.EncryptedClientIdentification.encode(t.certificate,e.uint32(10).fork()).ldelim(),t.salt!=null&&Object.hasOwnProperty.call(t,"salt")&&e.uint32(18).bytes(t.salt),t.signature!=null&&Object.hasOwnProperty.call(t,"signature")&&e.uint32(26).bytes(t.signature),e},o.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},o.decode=function(t,e){t instanceof u||(t=u.create(t));for(var n=e===void 0?t.len:t.pos+e,i=new c.RemoteAttestation;t.pos<n;){var s=t.uint32();switch(s>>>3){case 1:{i.certificate=c.EncryptedClientIdentification.decode(t,t.uint32());break}case 2:{i.salt=t.bytes();break}case 3:{i.signature=t.bytes();break}default:t.skipType(s&7);break}}return i},o.decodeDelimited=function(t){return t instanceof u||(t=new u(t)),this.decode(t,t.uint32())},o.fromObject=function(t){if(t instanceof c.RemoteAttestation)return t;var e=new c.RemoteAttestation;if(t.certificate!=null){if(typeof t.certificate!="object")throw TypeError(".RemoteAttestation.certificate: object expected");e.certificate=c.EncryptedClientIdentification.fromObject(t.certificate)}return t.salt!=null&&(typeof t.salt=="string"?a.base64.decode(t.salt,e.salt=a.newBuffer(a.base64.length(t.salt)),0):t.salt.length>=0&&(e.salt=t.salt)),t.signature!=null&&(typeof t.signature=="string"?a.base64.decode(t.signature,e.signature=a.newBuffer(a.base64.length(t.signature)),0):t.signature.length>=0&&(e.signature=t.signature)),e},o.toObject=function(t,e){e||(e={});var n={};return e.defaults&&(n.certificate=null,e.bytes===String?n.salt="":(n.salt=[],e.bytes!==Array&&(n.salt=a.newBuffer(n.salt))),e.bytes===String?n.signature="":(n.signature=[],e.bytes!==Array&&(n.signature=a.newBuffer(n.signature)))),t.certificate!=null&&t.hasOwnProperty("certificate")&&(n.certificate=c.EncryptedClientIdentification.toObject(t.certificate,e)),t.salt!=null&&t.hasOwnProperty("salt")&&(n.salt=e.bytes===String?a.base64.encode(t.salt,0,t.salt.length):e.bytes===Array?Array.prototype.slice.call(t.salt):t.salt),t.signature!=null&&t.hasOwnProperty("signature")&&(n.signature=e.bytes===String?a.base64.encode(t.signature,0,t.signature.length):e.bytes===Array?Array.prototype.slice.call(t.signature):t.signature),n},o.prototype.toJSON=function(){return this.constructor.toObject(this,p.util.toJSONOptions)},o.getTypeUrl=function(t){return t===void 0&&(t="type.googleapis.com"),t+"/RemoteAttestation"},o})();var T=require("jsrsasign");var X=o=>new TextEncoder().encode(o),fe=o=>new TextDecoder().decode(o),w=o=>({toBase64:()=>btoa(X(o).reduce((r,t)=>r+String.fromCharCode(t),"")),toHex:()=>Array.from(X(o)).map(r=>r.toString(16).padStart(2,"0")).join(""),toBuffer:()=>X(o)});var ye=o=>Uint8Array.from(atob(o),r=>r.charCodeAt(0)),h=o=>({toBuffer:()=>ye(o),toText:()=>fe(ye(o)),toHex:()=>g(h(o).toBuffer()).toHex()}),g=o=>({toBase64:()=>{let r=Array.from(o,t=>String.fromCodePoint(t)).join("");return btoa(r)},toHex:()=>Array.from(o).map(r=>r.toString(16).padStart(2,"0")).join(""),toText:()=>fe(o),toBinary:()=>{let r="",t=o.length;for(let e=0;e<t;e++)r+=String.fromCharCode(o[e]);return r}});var pe=o=>{let r=T.KEYUTIL.getKey(o);return T.KEYUTIL.getPEM(r,"PKCS8PRV")},de=o=>{let r=T.KEYUTIL.getKey(o);return T.KEYUTIL.getPEM(r,"PKCS1PRV")},ge=o=>{let r=g(o).toHex(),t=T.KEYUTIL.parsePublicRawRSAKeyHex(r),e=T.KEYUTIL.getKey(t),n=T.KEYUTIL.getPEM(e),l=n.substring("-----BEGIN PUBLIC KEY-----".length,n.length-"-----END PUBLIC KEY-----".length-2);return h(l).toBuffer()},be=async o=>crypto.subtle.importKey("spki",o,{name:"RSA-OAEP",hash:"SHA-1"},!0,["encrypt"]),he=async o=>crypto.subtle.importKey("spki",o,{name:"RSA-PSS",hash:"SHA-1"},!0,["verify"]),Se=(o=16)=>{let r=[],t=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"];for(let e=0;e<o;e++)r.push(t[Math.floor(Math.random()*16)]);return r.join("").toUpperCase()},x=(o=16)=>new Uint8Array(crypto.getRandomValues(new Uint8Array(o)));var Oe=async(o=128)=>crypto.subtle.generateKey({name:"AES-CBC",length:o},!0,["encrypt"]),Ce=async o=>crypto.subtle.importKey("raw",o,"AES-CBC",!1,["encrypt"]),Ie=async o=>crypto.subtle.importKey("raw",o,{name:"AES-CBC"},!1,["decrypt"]),q=async(o,r,t)=>{let e=await crypto.subtle.encrypt({name:"AES-CBC",iv:t},r,o);return new Uint8Array(e)},ve=async(o,r,t)=>{let e=await crypto.subtle.decrypt({name:"AES-CBC",iv:t},r,o);return new Uint8Array(e)},ke=async(o,r)=>{let t=await crypto.subtle.encrypt({name:"RSA-OAEP"},r,o);return new Uint8Array(t)},we=o=>crypto.subtle.exportKey("raw",o).then(r=>new Uint8Array(r));var Te=async(o,r)=>{let t=await crypto.subtle.importKey("raw",o,{name:"HMAC",hash:"SHA-256"},!0,["sign","verify"]),e=await crypto.subtle.sign("HMAC",t,r);return new Uint8Array(e)};var M=class o{id;value;type;level;trackLabel;permissions;constructor(r,t,e="CONTENT",n,i,s=[]){this.id=r,this.value=t,this.type=e,this.level=n,this.trackLabel=i,this.permissions=s}toString(){let r="Key: ";return this.id&&(r+=`${this.id}`),this.value&&(r+=`:${this.value}`),this.type&&(r+=` \u2219 Type: ${this.type}`),this.level&&(r+=` \u2219 Level: ${this.level}`),this.trackLabel&&(r+=` \u2219 Label: ${this.trackLabel}`),r}static async fromContainer(r,t){if(!r.key||!r.iv)throw new Error("Key not found");let e=await Ie(t),n=await ve(r.key,e,r.iv),i=r.id?g(r.id).toHex():"UNKNOWN",s=g(n).toHex(),l=U.KeyContainer.KeyType[r.type];return new o(i,s,l,String(r.level),r.trackLabel,r.operatorSessionKeyPermissions)}};var De=new Uint8Array([237,239,139,169,121,214,74,206,163,200,39,220,213,29,33,237]);function yt(o,r){return o.length===r.length&&o.every((t,e)=>t===r[e])}function ft(...o){let r=o.reduce((n,i)=>n+i.length,0),t=new Uint8Array(r),e=0;for(let n of o)t.set(n,e),e+=n.length;return t}var pt=o=>{let r=typeof o=="string"?h(o).toBuffer():o,t=r.subarray(12,28);if(yt(t,De))return typeof o=="string"?o:g(o).toBase64();let n=new Uint8Array([0,0,0,32+r.length]),i=new TextEncoder().encode("pssh"),s=new Uint8Array([0,0,0,0]),l=new Uint8Array([0,0,0,r.length]),y=ft(n,i,s,De,l,r);return g(y).toBase64()},dt=o=>{try{let r=typeof o=="string"?h(o).toBuffer().subarray(32):o.subarray(32);return z.decode(r)}catch{throw new Error("Unable to parse, unsupported init data format")}},Pe=o=>{let r=pt(o),t=dt(r);return{data:t,toBuffer:()=>z.encode(t).finish()}};var P=(...o)=>{let r=o.reduce((n,i)=>n+i.length,0),t=new Uint8Array(r),e=0;for(let n of o)t.set(n,e),e+=n.length;return t};var Q=o=>{let r=new Uint8Array(o.length),t=o.length-1;for(let e=0;e<t;e++)r[e]=o[e]<<1,o[e+1]&128&&(r[e]|=1);return r[t]=o[t]<<1,r};var R=(o,r)=>{let t=new Uint8Array(o.length);for(let e=0;e<o.length;e++)t[e]=o[e]^r[e];return t},gt=o=>{let r=new Uint8Array(o.length/2);for(let t=0;t<o.length;t+=2)r[t/2]=parseInt(o.substr(t,2),16);return r},Re=new Uint8Array(16),Ee=new Uint8Array(gt("00000000000000000000000000000087")),m=16,bt=async o=>{let r=await Z(o,Re),t=Q(r);r[0]&128&&(t=R(t,Ee));let e=Q(t);return t[0]&128&&(e=R(e,Ee)),{subkey1:t,subkey2:e}},Ae=(o,r)=>{let t=r*m,e=t+m;return o.slice(t,e)},ht=(o,r)=>{let t=new Uint8Array(m),e=r*m,n=o.length;return t.set(o.slice(e,n),0),t[n-e]=128,t},Z=async(o,r)=>(await q(r,o,Re)).slice(0,16),me=async(o,r)=>{if(!{16:"aes-128-cbc",24:"aes-192-cbc",32:"aes-256-cbc"}[o.length])throw new Error("Keys must be 128, 192, or 256 bits in length.");let e=await Ce(o),n=await bt(e),i=Math.ceil(r.length/m),s,l;i===0?(i=1,s=!1):s=r.length%m===0;let y=i-1;s?l=R(Ae(r,y),n.subkey1):l=R(ht(r,y),n.subkey2);let f=new Uint8Array(16),S;for(let C=0;C<y;C++)S=R(f,Ae(r,C)),f=await Z(e,S);return S=R(l,f),Z(e,S)};var Le=o=>{let r=new TextEncoder,t=(n,i=4)=>{let s=new Uint8Array(i);return s[i-2]=n>>8&255,s[i-1]=n&255,s},e=(n,i,s)=>P(r.encode(n+"\0"),i,t(s));return{enc:e("ENCRYPTION",o,16*8),auth:e("AUTHENTICATION",o,32*8*2)}},Ke=async(o,r,t)=>{let e=async(l,y,f)=>{let S=P(new Uint8Array([f]),y);return await me(l,S)},n=await e(t,o,1),i=P(await e(t,r,1),await e(t,r,2)),s=P(await e(t,r,3),await e(t,r,4));return{encKey:n,macKeyServer:i,macKeyClient:s}};var N=class extends Event{messageType;message;constructor(r,t){super("message"),this.messageType=r,this.message=t}},je=o=>{try{return O.decode(o).type}catch(r){console.error("Failed to parse message as SignedMessage",r)}};var St=()=>{let o=`
3
3
  CpwDCAASAQAY3ZSIiwUijgMwggGKAoIBgQC0/jnDZZAD2zwRlwnoaM3yw16b8udNI7EQ24dl39z7nzWgVwNTTPZtNX2meNuzNtI/nECplSZy
4
4
  f7i+Zt/FIZh4FRZoXS9GDkPLioQ5q/uwNYAivjQji6tTW3LsS7VIaVM+R1/9Cf2ndhOPD5LWTN+udqm62SIQqZ1xRdbX4RklhZxTmpfrhNfM
5
5
  qIiCIHAmIP1+QFAn4iWTb7w+cqD6wb0ptE2CXMG0y5xyfrDpihc+GWP8/YJIK7eyM7l97Eu6iR8nuJuISISqGJIOZfXIbBH/azbkdDTKjDOx
@@ -11,18 +11,18 @@
11
11
  RXPia1BSV0z7kmxmdYrWDRuu8+yvUSIDXQouY5OcCwEgqKmELhfKrnPsIht5rvagcizfB0fbiIYwFHghESKIrNdUdPnzJsKlVshWTwApHQh7
12
12
  evuVicPumFSePGuUBRMS9nG5qxPDDJtGCHs9Mmpoyh6ckGLF7RC5HxclzpC5bc3ERvWjYhN0AqdipPpV2d7PouaAdFUGSdUCDA==`.split(`
13
13
  `).map(e=>e.trim()).join(`
14
- `),r=A.decode(h(o).toBuffer()),t=E.decode(r.drmCertificate);return{signedDrmCertificateBase64:o,signedDrmCertificate:r,drmCertificate:t}},ee=async(o,r)=>{let t=ge(o);return r==="verify"?he(t):be(t)},Ne=async o=>{let r=St().drmCertificate.publicKey,t=o.signature,e=o.drmCertificate,n=await ee(r,"verify");return await crypto.subtle.verify({name:"RSA-PSS",saltLength:20},n,t,e)},Be=async o=>{let r=ArrayBuffer.isView(o)?o:h(o).toBuffer(),t,e;try{e=O.decode(r)}finally{}if(e?.type)try{t=A.decode(e.msg)}catch{throw new Error("Failed to parse service certificate")}else try{t=A.decode(r)}catch{throw new Error("Failed to parse service certificate")}let n=E.decode(t.drmCertificate);return{signedDrmCertificate:t,drmCertificate:n}};var Ot=o=>{switch(o){case"chrome":return g(x()).toBase64();case"android":default:return Se()+"01"+"00000000000000"}},Ct=new Uint8Array([8,4]),L=class extends EventTarget{sessionId;keyStatuses;keys;expiration;closed;onmessage;onkeyschange;onkeystatuseschange;sessionType;privacyMode=!1;#e;#t;#r;#o;#s=!1;#n;#i;constructor(r="temporary",t){super(),this.sessionId=Ot("android"),this.keyStatuses=new Map,this.keys=new Map,this.expiration=NaN,this.closed=new Promise(e=>{this.addEventListener("closed",()=>e("closed-by-application"))}),this.onmessage=null,this.onkeyschange=null,this.onkeystatuseschange=null,this.sessionType=r,this.#e=t,this.#i=new Map,this.#t=console}setLogger(r){this.#t=r}async generateRequest(r,t){if(this.privacyMode&&!this.#s){this.dispatchEvent(new N("individualization-request",Ct)),this.#s=!0,this.#r=t,this.#o=r;return}let e=Pe(t),n=await this.#a(e),i=await this.#c(n.bytes,O.MessageType.LICENSE_REQUEST);this.#i.set(g(n.requestId).toText(),Le(n.bytes)),this.dispatchEvent(new N("license-request",i.bytes))}async waitForLicenseRequest(){return new Promise(r=>{this.addEventListener("message",t=>{let e=t;e.messageType==="license-request"&&r(new Uint8Array(e.message))},!1)})}async#a(r){let t=ArrayBuffer.isView(this.sessionId)?this.sessionId:w(this.sessionId).toBuffer(),e=_.create({clientId:this.#n?void 0:this.#e.id,encryptedClientId:this.#n?await this.#e.encryptId(this.#n):void 0,contentId:{widevinePsshData:{psshData:[r.toBuffer()],licenseType:this.sessionType==="persistent-license"?Y.OFFLINE:Y.STREAMING,requestId:t}},type:_.RequestType.NEW,requestTime:Math.round(Date.now()/1e3),protocolVersion:le.VERSION_2_1}),n=_.encode(e).finish();return{requestId:t,entity:e,bytes:n}}async#c(r,t){let e=O.create({type:t,msg:r,signature:await this.#e.signWithKey(r)}),n=O.encode(e).finish();return{entity:e,bytes:n}}load(){return Promise.resolve(!0)}async update(r){let t=je(r),e=t?O.MessageType[t]:"?";if(t===O.MessageType.SERVICE_CERTIFICATE){if(await this.#l(r),!this.#r||!this.#o)return;this.generateRequest(this.#o,this.#r);return}let n=null;try{n=O.decode(r)}catch{this.#t.error("Unable to parse license - check protobufs"),this.#t.debug(g(r).toText());return}let i=U.decode(n.msg),s=g(i.id.requestId).toText(),l=this.#i.get(s);if(!l)throw new Error(`Failed to find context to decrypt keys, requestId: ${s}`);let y=await this.#e.decryptWithKey(n.sessionKey),p=await Ke(l.enc,l.auth,y),{success:S,signature:C}=await this.#u(n,p.macKeyServer);if(!S)throw this.#t.debug(`Calculated signature: ${C.calculated}`),this.#t.debug(`Actual signature: ${C.actual}`),new Error("Signature mismatch on license message, rejecting license");for(let k of i.key){if(!k.key||!k.iv)continue;let V=await M.fromContainer(k,p.encKey);V.id&&this.#y(V)}this.dispatchEvent(new Event("keyschange")),this.dispatchEvent(new Event("keystatuseschange")),this.#i.delete(s),this.keys.size&&await this.close()}async#l(r){let{signedDrmCertificate:t,drmCertificate:e}=await Be(r);if(!Ne(t))throw new Error("Certificate invalid: signature mismatch");return this.#n=t,e.providerId}async#u(r,t){let e=g(r.signature).toHex(),n=[r.msg];r.oemcryptoCoreMessage?.length&&n.unshift(r.oemcryptoCoreMessage);let i=await Te(t,P(...n)),s=g(i).toHex();return{success:e===s,signature:{actual:e,calculated:s}}}#y(r){this.keys.set(r.id,r),this.keyStatuses.set(w(`${r.id}:${r.value}`).toBuffer(),"usable")}close(){return this.dispatchEvent(new Event("closed")),Promise.resolve()}remove(){return Promise.resolve()}};var Ve=(o,r)=>{if(!r)return o;let t=ArrayBuffer.isView(o)?g(o).toBase64():o;return r.replace("{{challenge}}",t)},Ue=(o,r=console)=>{if(o[0]===123){let t=null;try{t=JSON.parse(g(o).toText())}catch(e){r.error("Can't parse license response as JSON"),r.debug(e.message),r.debug(`Base64 response data: ${g(o).toBase64()}`)}if(!t)return o;try{let e="CAIS",n=e+g(o).toText().split(`"${e}`)[1].split('"')[0];return h(n).toBuffer()}catch{r.error("Can't recognize license response"),r.error(`Response: ${JSON.stringify(t)}`)}}return o};var qe=2,F=w("WVD").toBuffer(),ne={chrome:1,android:2},It=(o,r)=>o.length===r.length&&o.every((t,e)=>t===r[e]),te=(o,r)=>o[r],_e=(o,r)=>o[r]<<8|o[r+1],H=o=>{let r=new Uint8Array(1);return r[0]=o,r},xe=o=>{let r=new Uint8Array(2);return r[0]=o>>8&255,r[1]=o&255,r},Me=o=>{let r=0,t=o.subarray(r,r+3);if(r+=3,!It(t,F))throw new Error("Invalid WVD file: Wrong magic number");let e=te(o,r);if(r+=1,e!==qe)throw new Error(`Unsupported WVD version: ${e}`);let n=te(o,r);r+=1;let i=te(o,r);r+=1,r+=1;let s=_e(o,r);r+=2;let l=o.subarray(r,r+s);r+=s;let y=_e(o,r);r+=2;let p=o.subarray(r,r+y);return{version:e,deviceType:n,securityLevel:i,privateKey:l,clientId:p}},He=o=>{let{deviceType:r,securityLevel:t,privateKey:e,clientId:n}=o,i=e.length,s=n.length,l=new Uint8Array(F.length+1+1+1+1+2+i+2+s),y=0;return l.set(F,y),y+=F.length,l.set(H(qe),y),y+=1,l.set(H(r),y),y+=1,l.set(H(t),y),y+=1,l.set(H(0),y),y+=1,l.set(xe(i),y),y+=2,l.set(e,y),y+=i,l.set(xe(s),y),y+=2,l.set(n,y),l};var ie={android:"android",chrome:"chrome"},Fe=new Map([[ne.android,ie.android],[ne.chrome,ie.chrome]]),K=class o{id;type;securityLevel;signedDrmCertificate;drmCertificate;systemId;vmp;info;#e;static async fromPacked(r,t="WVDv2"){if(t!=="WVDv2")throw new Error("Only WVDv2 is supported");let e=Me(r),n=`-----BEGIN RSA PRIVATE KEY-----
14
+ `),r=A.decode(h(o).toBuffer()),t=E.decode(r.drmCertificate);return{signedDrmCertificateBase64:o,signedDrmCertificate:r,drmCertificate:t}},ee=async(o,r)=>{let t=ge(o);return r==="verify"?he(t):be(t)},Ne=async o=>{let r=St().drmCertificate.publicKey,t=o.signature,e=o.drmCertificate,n=await ee(r,"verify");return await crypto.subtle.verify({name:"RSA-PSS",saltLength:20},n,t,e)},Be=async o=>{let r=ArrayBuffer.isView(o)?o:h(o).toBuffer(),t,e;try{e=O.decode(r)}finally{}if(e?.type)try{t=A.decode(e.msg)}catch{throw new Error("Failed to parse service certificate")}else try{t=A.decode(r)}catch{throw new Error("Failed to parse service certificate")}let n=E.decode(t.drmCertificate);return{signedDrmCertificate:t,drmCertificate:n}};var Ot=o=>{switch(o){case"chrome":return g(x()).toBase64();case"android":default:return Se()+"01"+"00000000000000"}},Ct=new Uint8Array([8,4]),L=class extends EventTarget{sessionId;keyStatuses;keys;expiration;closed;onmessage;onkeyschange;onkeystatuseschange;sessionType;privacyMode=!1;#e;#t;#r;#o;#s=!1;#n;#i;constructor(r="temporary",t){super(),this.sessionId=Ot("android"),this.keyStatuses=new Map,this.keys=new Map,this.expiration=NaN,this.closed=new Promise(e=>{this.addEventListener("closed",()=>e("closed-by-application"))}),this.onmessage=null,this.onkeyschange=null,this.onkeystatuseschange=null,this.sessionType=r,this.#e=t,this.#i=new Map,this.#t=console}setLogger(r){this.#t=r}async generateRequest(r,t){if(this.privacyMode&&!this.#s){this.dispatchEvent(new N("individualization-request",Ct)),this.#s=!0,this.#r=t,this.#o=r;return}let e=Pe(t),n=await this.#a(e),i=await this.#c(n.bytes,O.MessageType.LICENSE_REQUEST);this.#i.set(g(n.requestId).toText(),Le(n.bytes)),this.dispatchEvent(new N("license-request",i.bytes))}async waitForLicenseRequest(){return new Promise(r=>{this.addEventListener("message",t=>{let e=t;e.messageType==="license-request"&&r(new Uint8Array(e.message))},!1)})}async#a(r){let t=ArrayBuffer.isView(this.sessionId)?this.sessionId:w(this.sessionId).toBuffer(),e=_.create({clientId:this.#n?void 0:this.#e.id,encryptedClientId:this.#n?await this.#e.encryptId(this.#n):void 0,contentId:{widevinePsshData:{psshData:[r.toBuffer()],licenseType:this.sessionType==="persistent-license"?Y.OFFLINE:Y.STREAMING,requestId:t}},type:_.RequestType.NEW,requestTime:Math.round(Date.now()/1e3),protocolVersion:le.VERSION_2_1}),n=_.encode(e).finish();return{requestId:t,entity:e,bytes:n}}async#c(r,t){let e=O.create({type:t,msg:r,signature:await this.#e.signWithKey(r)}),n=O.encode(e).finish();return{entity:e,bytes:n}}load(){return Promise.resolve(!0)}async update(r){let t=je(r),e=t?O.MessageType[t]:"?";if(t===O.MessageType.SERVICE_CERTIFICATE){if(await this.#l(r),!this.#r||!this.#o)return;this.generateRequest(this.#o,this.#r);return}let n=null;try{n=O.decode(r)}catch{this.#t.error("Unable to parse license - check protobufs"),this.#t.debug(g(r).toText());return}let i=U.decode(n.msg),s=g(i.id.requestId).toText(),l=this.#i.get(s);if(!l)throw new Error(`Failed to find context to decrypt keys, requestId: ${s}`);let y=await this.#e.decryptWithKey(n.sessionKey),f=await Ke(l.enc,l.auth,y),{success:S,signature:C}=await this.#u(n,f.macKeyServer);if(!S)throw this.#t.debug(`Calculated signature: ${C.calculated}`),this.#t.debug(`Actual signature: ${C.actual}`),new Error("Signature mismatch on license message, rejecting license");for(let k of i.key){if(!k.key||!k.iv)continue;let V=await M.fromContainer(k,f.encKey);V.id&&this.#y(V)}this.dispatchEvent(new Event("keyschange")),this.dispatchEvent(new Event("keystatuseschange")),this.#i.delete(s),this.keys.size&&await this.close()}async#l(r){let{signedDrmCertificate:t,drmCertificate:e}=await Be(r);if(!Ne(t))throw new Error("Certificate invalid: signature mismatch");return this.#n=t,e.providerId}async#u(r,t){let e=g(r.signature).toHex(),n=[r.msg];r.oemcryptoCoreMessage?.length&&n.unshift(r.oemcryptoCoreMessage);let i=await Te(t,P(...n)),s=g(i).toHex();return{success:e===s,signature:{actual:e,calculated:s}}}#y(r){this.keys.set(r.id,r),this.keyStatuses.set(w(`${r.id}:${r.value}`).toBuffer(),"usable")}close(){return this.dispatchEvent(new Event("closed")),Promise.resolve()}remove(){return Promise.resolve()}};var Ve=(o,r)=>{if(!r)return o;let t=ArrayBuffer.isView(o)?g(o).toBase64():o;return r.replace("{{challenge}}",t)},Ue=(o,r=console)=>{if(o[0]===123){let t=null;try{t=JSON.parse(g(o).toText())}catch(e){r.error("Can't parse license response as JSON"),r.debug(e.message),r.debug(`Base64 response data: ${g(o).toBase64()}`)}if(!t)return o;try{let e="CAIS",n=e+g(o).toText().split(`"${e}`)[1].split('"')[0];return h(n).toBuffer()}catch{r.error("Can't recognize license response"),r.error(`Response: ${JSON.stringify(t)}`)}}return o};var qe=2,F=w("WVD").toBuffer(),ne={chrome:1,android:2},It=(o,r)=>o.length===r.length&&o.every((t,e)=>t===r[e]),te=(o,r)=>o[r],_e=(o,r)=>o[r]<<8|o[r+1],H=o=>{let r=new Uint8Array(1);return r[0]=o,r},xe=o=>{let r=new Uint8Array(2);return r[0]=o>>8&255,r[1]=o&255,r},Me=o=>{let r=0,t=o.subarray(r,r+3);if(r+=3,!It(t,F))throw new Error("Invalid WVD file: Wrong magic number");let e=te(o,r);if(r+=1,e!==qe)throw new Error(`Unsupported WVD version: ${e}`);let n=te(o,r);r+=1;let i=te(o,r);r+=1,r+=1;let s=_e(o,r);r+=2;let l=o.subarray(r,r+s);r+=s;let y=_e(o,r);r+=2;let f=o.subarray(r,r+y);return{version:e,deviceType:n,securityLevel:i,privateKey:l,clientId:f}},He=o=>{let{deviceType:r,securityLevel:t,privateKey:e,clientId:n}=o,i=e.length,s=n.length,l=new Uint8Array(F.length+1+1+1+1+2+i+2+s),y=0;return l.set(F,y),y+=F.length,l.set(H(qe),y),y+=1,l.set(H(r),y),y+=1,l.set(H(t),y),y+=1,l.set(H(0),y),y+=1,l.set(xe(i),y),y+=2,l.set(e,y),y+=i,l.set(xe(s),y),y+=2,l.set(n,y),l};var ie={android:"android",chrome:"chrome"},Fe=new Map([[ne.android,ie.android],[ne.chrome,ie.chrome]]),K=class o{id;type;securityLevel;signedDrmCertificate;drmCertificate;systemId;vmp;info;#e;static async fromPacked(r,t="WVDv2"){if(t!=="WVDv2")throw new Error("Only WVDv2 is supported");let e=Me(r),n=`-----BEGIN RSA PRIVATE KEY-----
15
15
  ${g(e.privateKey).toBase64()}
16
16
  -----END RSA PRIVATE KEY-----`,i=w(n).toBuffer(),s=Fe.get(e.deviceType),l=e.securityLevel,y=new o(e.clientId,s,l);return await y.importKey(i),y}static async fromUnpacked(r,t,e){let n=new o(r);return e&&(n.vmp=$.decode(e),n.id.vmpData=e),await n.importKey(t),n}get key(){if(!this.#e)throw new Error("Import key before using it");return this.#e}constructor(r,t=ie.android,e=3){this.id=j.decode(r),this.signedDrmCertificate=A.decode(this.id.token),this.drmCertificate=E.decode(this.signedDrmCertificate.drmCertificate),this.systemId=this.drmCertificate.systemId,this.vmp=this.id.vmpData?$.decode(this.id.vmpData):null,this.type=t,this.securityLevel=e;let n=this.id.clientInfo;this.info=new Map(n.map(i=>[i.name,i.value]))}async unpack(){let r=j.encode(this.id).finish(),t=await this.exportKey();return[r,t]}async pack(r="WVDv2"){if(r!=="WVDv2")throw new Error("Only WVDv2 is supported");let t=j.encode(this.id).finish(),e=await this.exportKey(),n=g(e).toText().split(`
17
17
  `).map(y=>y.trim()).slice(1,-1).join(`
18
- `),i=h(n).toBuffer(),[s]=Fe.entries().find(([,y])=>y===this.type);return He({clientId:t,deviceType:s,securityLevel:this.securityLevel,privateKey:i})}async importKey(r){let t=g(r).toText(),n=fe(t).split(`
18
+ `),i=h(n).toBuffer(),[s]=Fe.entries().find(([,y])=>y===this.type);return He({clientId:t,deviceType:s,securityLevel:this.securityLevel,privateKey:i})}async importKey(r){let t=g(r).toText(),n=pe(t).split(`
19
19
  `).slice(1,-2).join(`
20
20
  `),i=h(n).toBuffer(),s=await crypto.subtle.importKey("pkcs8",i,{name:"RSA-OAEP",hash:"SHA-1"},!0,["decrypt"]),l=await crypto.subtle.importKey("pkcs8",i,{name:"RSA-PSS",hash:"SHA-1"},!0,["sign"]);return this.#e={forDecrypt:s,forSign:l},this.#e}async exportKey(){let r=this.key.forSign,t=await crypto.subtle.exportKey("pkcs8",r),e=new Uint8Array(t),l=`-----BEGIN PRIVATE KEY-----
21
21
  ${g(e).toBase64()}
22
- ----------END PRIVATE KEY----------`,y=de(l).trim();return w(y).toBuffer()}async decryptWithKey(r){let t=await crypto.subtle.decrypt({name:"RSA-OAEP"},this.key.forDecrypt,r);return new Uint8Array(t)}async signWithKey(r){let t=await crypto.subtle.sign({name:"RSA-PSS",saltLength:20},this.key.forSign,r);return new Uint8Array(t)}async encryptId(r){if(!r.drmCertificate)throw Error("Service certificate not found");let t=E.decode(r.drmCertificate),e=j.encode(this.id).finish(),n=await Oe(),i=x(16),s=await q(e,n,i),l=await ee(t.publicKey,"encrypt"),y=await we(n),p=await ke(y,l);return ue.create({providerId:t.providerId,serviceCertificateSerialNumber:t.serialNumber,encryptedClientIdIv:i,encryptedPrivacyKey:p,encryptedClientId:s})}toString(){return`${this.systemId} L${this.securityLevel}`}requestMediaKeySystemAccess(r,t){if(r!=="com.widevine.alpha")throw new Error("Unsupported media key system");return{keySystem:r,createMediaKeys:async()=>{let e={serverCertificate:null};return{createSession:n=>new L(n,this),setServerCertificate:async n=>(e.serverCertificate=n,!0),getStatusForPolicy:async()=>"usable"}},getConfiguration:()=>t[0]}}};var We=async o=>{let{pssh:r,client:t}=o,e="cenc",n=h(r).toBuffer(),i=new L("temporary",t);return i.privacyMode=!!o.individualizationServer,o.logger&&i.setLogger(o.logger),i.addEventListener("message",async l=>{let y=l.messageType,p=l.message,C=y==="individualization-request"&&o.individualizationServer||o.server,{requestFilter:k,requestTemplate:V,responseFilter:et}=o,tt=k?.(p)||Ve(p,V),ae=await(await(o.fetch||fetch)(C,{method:"POST",headers:o.headers,body:tt})).arrayBuffer().then(it=>new Uint8Array(it)),nt=et?.(ae)||Ue(ae,o.logger);i.update(nt)},!1),await new Promise(l=>{i.addEventListener("keystatuseschange",l,!1),i.generateRequest(e,n)}),Array.from(i.keys.values())};var D=async o=>{let t=(await(0,I.stat)(o)).isDirectory();if(t){let e=t?await(0,I.readdir)(o):[],n=e.find(p=>p.includes("client_id")),i=e.find(p=>p.includes("private_key")),s=e.find(p=>p.endsWith("wvd")),l=!!(n&&i),y=!!s;if(l){let p=(0,W.join)(o,n),S=(0,W.join)(o,i),C=await(0,I.readFile)(p),k=await(0,I.readFile)(S);return K.fromUnpacked(C,k)}else if(y){let p=(0,W.join)(o,s),S=await(0,I.readFile)(p);return await K.fromPacked(S)}else console.log(`Unable to find client files in ${o}`),process.exit(1)}else if(o.endsWith(".wvd")){let e=await(0,I.readFile)(o);return K.fromPacked(e)}else console.log(`Unable to find client files in ${o}`),process.exit(1)},b=(o,r=2,t=30)=>`${" ".repeat(r)}${o.padEnd(t)}`;var Ge=()=>{console.log(`azot client: Widevine client utilities
22
+ ----------END PRIVATE KEY----------`,y=de(l).trim();return w(y).toBuffer()}async decryptWithKey(r){let t=await crypto.subtle.decrypt({name:"RSA-OAEP"},this.key.forDecrypt,r);return new Uint8Array(t)}async signWithKey(r){let t=await crypto.subtle.sign({name:"RSA-PSS",saltLength:20},this.key.forSign,r);return new Uint8Array(t)}async encryptId(r){if(!r.drmCertificate)throw Error("Service certificate not found");let t=E.decode(r.drmCertificate),e=j.encode(this.id).finish(),n=await Oe(),i=x(16),s=await q(e,n,i),l=await ee(t.publicKey,"encrypt"),y=await we(n),f=await ke(y,l);return ue.create({providerId:t.providerId,serviceCertificateSerialNumber:t.serialNumber,encryptedClientIdIv:i,encryptedPrivacyKey:f,encryptedClientId:s})}toString(){return`${this.systemId} L${this.securityLevel}`}requestMediaKeySystemAccess(r,t){if(r!=="com.widevine.alpha")throw new Error("Unsupported media key system");return{keySystem:r,createMediaKeys:async()=>{let e={serverCertificate:null};return{createSession:n=>new L(n,this),setServerCertificate:async n=>(e.serverCertificate=n,!0),getStatusForPolicy:async()=>"usable"}},getConfiguration:()=>t[0]}}};var We=async o=>{let{pssh:r,client:t}=o,e="cenc",n=h(r).toBuffer(),i=new L("temporary",t);return i.privacyMode=!!o.individualizationServer,o.logger&&i.setLogger(o.logger),i.addEventListener("message",async l=>{let y=l.messageType,f=l.message,C=y==="individualization-request"&&o.individualizationServer||o.server,{requestFilter:k,requestTemplate:V,responseFilter:et}=o,tt=k?.(f)||Ve(f,V),ae=await(await(o.fetch||fetch)(C,{method:"POST",headers:o.headers,body:tt})).arrayBuffer().then(it=>new Uint8Array(it)),nt=et?.(ae)||Ue(ae,o.logger);i.update(nt)},!1),await new Promise(l=>{i.addEventListener("keystatuseschange",l,!1),i.generateRequest(e,n)}),Array.from(i.keys.values())};var D=async o=>{let t=(await(0,I.stat)(o)).isDirectory();if(t){let e=t?await(0,I.readdir)(o):[],n=e.find(f=>f.includes("client_id")),i=e.find(f=>f.includes("private_key")),s=e.find(f=>f.endsWith("wvd")),l=!!(n&&i),y=!!s;if(l){let f=(0,W.join)(o,n),S=(0,W.join)(o,i),C=await(0,I.readFile)(f),k=await(0,I.readFile)(S);return K.fromUnpacked(C,k)}else if(y){let f=(0,W.join)(o,s),S=await(0,I.readFile)(f);return await K.fromPacked(S)}else console.log(`Unable to find client files in ${o}`),process.exit(1)}else if(o.endsWith(".wvd")){let e=await(0,I.readFile)(o);return K.fromPacked(e)}else console.log(`Unable to find client files in ${o}`),process.exit(1)},b=(o,r=2,t=30)=>`${" ".repeat(r)}${o.padEnd(t)}`;var Ge=()=>{console.log(`azot client: Widevine client utilities
23
23
  `),console.log(`Usage: azot client <subcommand> [...flags]
24
24
  `),console.log("Commands:"),console.log(b("info <input>")+"print info about client that is on <input> path (*.wvd filepath or directory with id and private key)"),console.log(b("pack <input> <output>")+"pack client id and private key from <input> directory into single *.wvd file with <output> path"),console.log(b("unpack <input> <output>")+"unpack *.wvd from <input> path to separate client id and private key placed in <output> directory"),console.log(""),console.log("Flags:"),console.log(b("-h, --help")+"Display this menu and exit")};var Je=async o=>{let r=await D(o);for(let[t,e]of r.info.entries())console.log(`${t}: ${e}`)};var Ye=require("fs/promises"),ze=require("path");var $e=async(o=process.cwd(),r)=>{let t=await D(o),e=await t.pack(),n=`${t.info.get("company_name")}_${t.info.get("model_name")}`,i=r||(0,ze.join)(process.cwd(),`${n}.wvd`);await(0,Ye.writeFile)(i,e),console.log(`Client packed: ${i}`)};var re=require("fs/promises"),oe=require("path");var Xe=async(o=process.cwd(),r)=>{let t=await D(o),[e,n]=await t.unpack(),i=(0,oe.join)(r||process.cwd(),"device_client_id_blob"),s=(0,oe.join)(r||process.cwd(),"device_private_key");await(0,re.writeFile)(i,e),await(0,re.writeFile)(s,n),console.log(`Client unpacked: ${i}, ${s}`)};var B={info:Je,pack:$e,unpack:Xe,help:Ge};var Qe=()=>{console.log(`azot license: Make license request
25
25
  `),console.log(`Usage: azot license <url> [...flags]
26
- `),console.log("Commands:"),console.log(b("<url>")+"URL of license server (e.g. https://cwip-shaka-proxy.appspot.com/no_auth)"),console.log(""),console.log("Flags:"),console.log(b("-H, --header")+'headers to send with license request, compatible with curl (e.g. -H "Authorization: Bearer ...")'),console.log(b("-p, --pssh")+"widevine PSSH data in Base64"),console.log(b("-c, --client")+"path to client (directory with id and private key or path to *.wvd file)"),console.log(b("-e, --encrypt")+"enable client encryption with service certificate, disabled by default"),console.log(b("-h, --help")+"display this menu and exit")};var G=async o=>{let r=Object.fromEntries(o.headers?.map(e=>e.split(":").map(n=>n.trim()))||[]);console.log({headers:r});let t=await We({server:o.url,pssh:o.pssh,client:await D(o.clientPath||process.cwd()),headers:r});for(let e of t)console.log(`${e.id}:${e.value}`);return t};G.help=Qe;var se={name:"azot",version:"0.6.0",description:"Research & pentesting toolkit for Google's Widevine DRM",type:"module",files:["dist","scripts"],bin:{azot:"dist/cli.js"},scripts:{prepublishOnly:"npm run build:lib",dev:"wxt","dev:firefox":"wxt -b firefox",build:"npm run build:lib && npm run build:chrome","build:lib":"tsup --entry.lib src/lib/main.ts --entry.cli src/cli/main.ts --format cjs,esm --dts --clean --minify --minify-identifiers","build:chrome":"wxt build","build:firefox":"wxt build -b firefox",zip:"wxt zip","zip:firefox":"wxt zip -b firefox",compile:"tsc --noEmit",postinstall:"node scripts/postinstall.js",test:"vitest"},repository:{type:"git",url:"https://github.com/vitalygashkov/azot"},keywords:["widevine","drm","google","pssh","eme","encrypted-media-extensions","media"],author:"Vitaly Gashkov <vitalygashkov@vk.com>",license:"AGPL-3.0",readmeFilename:"README.md",bugs:{url:"https://github.com/vitalygashkov/azot/issues",email:"vitalygashkov@vk.com"},funding:[{type:"individual",url:"https://boosty.to/vitalygashkov"},{type:"patreon",url:"https://www.patreon.com/vitalygashkov"}],exports:{".":{require:{types:"./dist/lib.d.cts",default:"./dist/lib.cjs"},import:{types:"./dist/lib.d.ts",default:"./dist/lib.js"}}},engines:{node:"20 || 21 || 22 || 23"},dependencies:{"@solidjs/router":"^0.14.10",jsrsasign:"^11.1.0",protobufjs:"^7.4.0","solid-icons":"^1.1.0","solid-js":"^1.9.1"},devDependencies:{"@eslint/js":"^9.12.0","@types/jsrsasign":"^10.5.14","@types/node":"^22.7.5","@wxt-dev/module-solid":"^1.1.2",autoprefixer:"^10.4.17",clsx:"^2.1.1",eslint:"^9.12.0","eslint-config-prettier":"^9.1.0","eslint-plugin-prettier":"^5.2.1",globals:"^15.11.0",postcss:"^8.4.33","tailwind-merge":"^2.5.4",tailwindcss:"^3.4.1",tsup:"^8.3.0",typescript:"^5.6.2","typescript-eslint":"^8.9.0","vite-plugin-arraybuffer":"^0.0.8",vitest:"^2.1.3",wxt:"^0.19.11"}};var v=(0,Ze.parseArgs)({args:process.argv.slice(2),options:{pssh:{type:"string",short:"p"},client:{type:"string",short:"c"},encrypt:{type:"boolean",short:"e",default:!1},header:{type:"string",short:"H",multiple:!0},help:{type:"boolean",short:"h"},version:{type:"boolean",short:"v"},debug:{type:"boolean",short:"d"}},strict:!1,allowPositionals:!0}),kt=()=>{console.log(`Azot is a research & pentesting toolkit for Google's Widevine DRM. (${se.version})
26
+ `),console.log("Commands:"),console.log(b("<url>")+"URL of license server (e.g. https://cwip-shaka-proxy.appspot.com/no_auth)"),console.log(""),console.log("Flags:"),console.log(b("-H, --header")+'headers to send with license request, compatible with curl (e.g. -H "Authorization: Bearer ...")'),console.log(b("-p, --pssh")+"widevine PSSH data in Base64"),console.log(b("-c, --client")+"path to client (directory with id and private key or path to *.wvd file)"),console.log(b("-e, --encrypt")+"enable client encryption with service certificate, disabled by default"),console.log(b("-h, --help")+"display this menu and exit")};var G=async o=>{let r=Object.fromEntries(o.headers?.map(e=>e.split(":").map(n=>n.trim()))||[]);console.log({headers:r});let t=await We({server:o.url,pssh:o.pssh,client:await D(o.clientPath||process.cwd()),headers:r});for(let e of t)console.log(`${e.id}:${e.value}`);return t};G.help=Qe;var se={name:"azot",version:"0.6.1",description:"Research & pentesting toolkit for Google's Widevine DRM",type:"module",files:["dist","scripts"],bin:{azot:"dist/cli.js"},scripts:{prepublishOnly:"npm run build:lib",dev:"wxt","dev:firefox":"wxt -b firefox",build:"npm run build:lib && npm run build:chrome","build:lib":"tsup --entry.lib src/lib/main.ts --entry.cli src/cli/main.ts --format cjs,esm --dts --clean --minify --minify-identifiers","build:chrome":"wxt build","build:firefox":"wxt build -b firefox",zip:"wxt zip","zip:firefox":"wxt zip -b firefox",compile:"tsc --noEmit",postinstall:"node scripts/postinstall.js",test:"vitest"},repository:{type:"git",url:"https://github.com/vitalygashkov/azot"},keywords:["widevine","drm","google","pssh","eme","encrypted-media-extensions","media"],author:"Vitaly Gashkov <vitalygashkov@vk.com>",license:"AGPL-3.0",readmeFilename:"README.md",bugs:{url:"https://github.com/vitalygashkov/azot/issues",email:"vitalygashkov@vk.com"},funding:[{type:"individual",url:"https://boosty.to/vitalygashkov"},{type:"patreon",url:"https://www.patreon.com/vitalygashkov"}],exports:{".":{require:{types:"./dist/lib.d.cts",default:"./dist/lib.cjs"},import:{types:"./dist/lib.d.ts",default:"./dist/lib.js"}}},engines:{node:"20 || 21 || 22 || 23"},dependencies:{"@solidjs/router":"^0.14.10",jsrsasign:"^11.1.0",protobufjs:"^7.4.0","solid-icons":"^1.1.0","solid-js":"^1.9.1"},devDependencies:{"@eslint/js":"^9.12.0","@types/jsrsasign":"^10.5.14","@types/node":"^22.7.5","@wxt-dev/module-solid":"^1.1.2",autoprefixer:"^10.4.17",clsx:"^2.1.1",eslint:"^9.12.0","eslint-config-prettier":"^9.1.0","eslint-plugin-prettier":"^5.2.1",globals:"^15.11.0",postcss:"^8.4.33","tailwind-merge":"^2.5.4",tailwindcss:"^3.4.1",tsup:"^8.3.0",typescript:"^5.6.2","typescript-eslint":"^8.9.0","vite-plugin-arraybuffer":"^0.0.8",vitest:"^2.1.3",wxt:"^0.19.11"}};var v=(0,Ze.parseArgs)({args:process.argv.slice(2),options:{pssh:{type:"string",short:"p"},client:{type:"string",short:"c"},encrypt:{type:"boolean",short:"e",default:!1},header:{type:"string",short:"H",multiple:!0},help:{type:"boolean",short:"h"},version:{type:"boolean",short:"v"},debug:{type:"boolean",short:"d"}},strict:!1,allowPositionals:!0}),kt=()=>{console.log(`Azot is a research & pentesting toolkit for Google's Widevine DRM. (${se.version})
27
27
  `),console.log(`Usage: azot <command> [...flags]
28
28
  `),console.log("Commands:"),console.log(b("license <url>")+"Make a license request"),console.log(b("client <subcommand>")+"Additional Widevine client utilities"),console.log(""),console.log("Flags:"),console.log(b("-d, --debug")+"Enable debug level logging"),console.log(b("-v, --version")+"Print version and exit"),console.log(b("-h, --help")+"Display this menu and exit"),console.log(""),console.log("(more flags in azot license --help and azot client --help)")};(async()=>{v.values.version&&(console.log(se.version),process.exit(0));let[o,...r]=v.positionals;switch(o){case"client":{let t=r.shift(),[e,n]=r;switch(t){case"pack":B.pack(e,n);break;case"unpack":B.unpack(e,n);break;case"info":B.info(e);break;default:v.values.help?(B.help(),process.exit(0)):(console.log("Client subcommand required: pack, unpack, info"),process.exit(1))}break}case"license":{v.values.help&&(G.help(),process.exit(0));let t=r.shift();if(!t)throw new Error("License URL required");let e=v.values.pssh;if(!e)throw new Error("PSSH required");let n=v.values.client,i=v.values.encrypt,s=v.values.header;await G({url:t,pssh:e,clientPath:n,encrypt:i,headers:s});break}case"pssh":break;case"serve":break;case"test":break;default:v.values.help?(kt(),process.exit(0)):(console.log("Command not found"),process.exit(1))}})();