"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[62104],{72028:function(t,e,n){n.r(e),n.d(e,{default:function(){return h}});var r,o=n(11444),i=n(47602),a=n(5898),c=n(38490),l=n(95569),s=n(15995),u=n(27678),f=(r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},r(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),p=new Set([o.D.Episode]),y=function(t){function e(){var e=t.apply(this,function(t,e,n){if(n||2===arguments.length)for(var r,o=0,i=e.length;o<i;o++)!r&&o in e||(r||(r=Array.prototype.slice.call(e,0,o)),r[o]=e[o]);return t.concat(r||Array.prototype.slice.call(e))}([],function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,o,i=n.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(t){o={error:t}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a}(arguments),!1))||this;return e.name="Still Watching",e.id=u.ID,e.priority=10,e.playedItems=new Set,e}return f(e,t),e.prototype.resetSession=function(){this.sessionStartTime=new Date,this.playedItems.clear()},e.prototype.intercept=function(t){return e=this,n=arguments,o=function(t){var e,n,r,o,s,f,y=this,h=t.isFirstItem,d=t.item;return function(t,e){var n,r,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=c(0),a.throw=c(1),a.return=c(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function c(c){return function(l){return function(c){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,c[0]&&(i=0)),i;)try{if(n=1,r&&(o=2&c[0]?r.return:c[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,c[1])).done)return o;switch(r=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return i.label++,{value:c[1],done:!1};case 5:i.label++,r=c[1],c=[0];continue;case 7:c=i.ops.pop(),i.trys.pop();continue;default:if(!((o=(o=i.trys).length>0&&o[o.length-1])||6!==c[0]&&2!==c[0])){i=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){i.label=c[1];break}if(6===c[0]&&i.label<o[1]){i.label=o[1],o=c;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(c);break}o[2]&&i.ops.pop(),i.trys.pop();continue}c=e.call(t,i)}catch(t){c=[6,t],r=0}finally{n=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,l])}}}(this,(function(t){return h&&this.resetSession(),e=l.currentSettings.stillWatchingPrompt(),console.debug("[StillWatchingPlugin] User setting: ".concat(e,"; Session start: ").concat(this.sessionStartTime,"; Idle time: ").concat(c.default.idleTime()/1e3,"s; Played items: ").concat(this.playedItems.size)),e===u.StillWatchingOptions.Disabled?[2]:d.Id&&d.Type&&p.has(d.Type)?(n=u.StillWatchingConfiguration[e],r=n.count,o=n.duration,s=d.Id,f=c.default.idleTime(),(this.sessionStartTime?Date.now()-this.sessionStartTime.getTime():0)>=o&&(f>=o||this.playedItems.size>=r)?[2,(0,i.A)({text:a.Ay.translate("ConfirmStillWatching"),cancelText:a.Ay.translate("StopWatching"),confirmText:a.Ay.translate("ContinueWatching")}).then((function(){y.resetSession(),y.playedItems.add(s)}))]:(this.playedItems.add(s),[2])):[2]}))},new((r=void 0)||(r=Promise))((function(t,i){function a(t){try{l(o.next(t))}catch(t){i(t)}}function c(t){try{l(o.throw(t))}catch(t){i(t)}}function l(e){var n;e.done?t(e.value):(n=e.value,n instanceof r?n:new r((function(t){t(n)}))).then(a,c)}l((o=o.apply(e,n||[])).next())}));var e,n,r,o},e}((function(){this.type=s.Q.PreplayIntercept})),h=y}}]);