const e=e=>{e.preventDefault()};function s(t){var n=jQuery(".llms-complete-lesson-form"),o=jQuery('.llms-complete-lesson-form button[type="submit"]'),l=jQuery("#llms_start_quiz, #llms-start-assignment");!0===t?(n.off("submit",e),o.removeAttr("disabled"),l.removeClass("llms-av-disabled").off("click",e)):(n.on("submit",e),o.attr("disabled","disabled"),l.addClass("llms-av-disabled").on("click",e))}const t=e=>({ts:e.currentTime,duration:e.duration,url:e.source,provider:e.provider,id:e.config.id}),l=(e,t)=>{llms.tracking.addEvent("video."+e,{meta:t})};function n(e){var t,n=e.find(".llms-av-pv--seconds");setInterval(function(){1==(t=1*n.text()-1)&&n.closest("a")[0].click(),t>=0&&n.text(t)},1e3)}function o(e,t){LLMS.Ajax.call({data:{action:"llms_av_video_ended",id:t.post_id,nonce:t.nonce},beforeSend:function(){LLMS.Spinner.start(e)},error:function(t,n,o){LLMS.Spinner.stop(e),console.error(t.responseText+" ("+o+" "+n+")"),console.log(t)},success:function(t){LLMS.Spinner.stop(e),t?.html&&(e.append(t.html),n(e))}})}const i=e=>{const n=e.detail.plyr;let o=t(n);l("paused",o)},a=e=>{const n=e.detail.plyr;let o=t(n),s=o.ts<1?"started":"played";l(s,o)},c=(e,n,i)=>{const a=e.detail.plyr;let d=t(a);l("ended",d),o(n,i),s(!0)};function d(e){var t={},n=llms?.tracking?.getSettings()||null;n?.av&&(t=n.av),t.require_video_completion&&!t.video_completed&&s(!1);let o=jQuery(".presto-block-video");e.on("pause",i),e.on("playing",a),e.on("ended",e=>c(e,o,t))}export{d as default,c as onEndedVideo,i as onPauseVideo,a as onPlayingVideo};