(()=>{"use strict";var t={};/************************************************************************/// The module cache
var e={};// The require function
function r(n){// Check if module is in cache
var o=e[n];if(o!==undefined){return o.exports}// Create a new module (and put it into the cache)
var a=e[n]={exports:{}};// Execute the module function
t[n](a,a.exports,r);// Return the exports of the module
return a.exports}/************************************************************************/// webpack/runtime/rspack_version
(()=>{r.rv=()=>"1.5.7"})();// webpack/runtime/rspack_unique_id
(()=>{r.ruid="bundler=rspack@1.5.7"})();/************************************************************************/;// CONCATENATED MODULE: ./node_modules/@swc/helpers/esm/_async_to_generator.js
function n(t,e,r,n,o,a,u){try{var d=t[a](u);var c=d.value}catch(t){r(t);return}if(d.done)e(c);else Promise.resolve(c).then(n,o)}function o(t){return function(){var e=this,r=arguments;return new Promise(function(o,a){var u=t.apply(e,r);function d(t){n(u,o,a,d,c,"next",t)}function c(t){n(u,o,a,d,c,"throw",t)}d(undefined)})}};// CONCATENATED MODULE: ./assets/lib/tutor-formdata.js
/**
 * Creates FormData object from array of data objects
 * @deprecated This function is deprecated and will be removed in a future version
 * @param {Array} data - Array of objects to convert to FormData
 * @returns {FormData} FormData object with nonce data included
 */function a(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];var e=new FormData;t.forEach(t=>{for(var[r,n]of Object.entries(t)){e.set(r,n)}});e.set(window.tutor_get_nonce_data(true).key,window.tutor_get_nonce_data(true).value);return e}/* ESM default export */const u=a;// CONCATENATED MODULE: ./assets/react/lib/ajax-handler.js
function d(t){return o(function*(){try{var e=yield fetch(window._tutorobject.ajaxurl,{method:"POST",body:t});return e}catch(t){tutor_toast(__("Operation failed","tutor-pro"),t,"error")}})()};// CONCATENATED MODULE: ./addons/enrollments/assets/react/admin.js
document.addEventListener("DOMContentLoaded",function(){var{__}=wp.i18n;var t=__("Something went wrong!","tutor-pro");/**
     * Open enrollment extend modal
     * 
     * @since v.3.3.0
     */var e=document.querySelectorAll(".tutor-extend-enrollment");e.forEach(t=>{t.addEventListener("click",function(){var e=document.querySelector("#tutor-enrollment-extend-modal");var r=e.querySelector(".tutor-extend-modal-course");var n=e.querySelector(".tutor-extend-modal-user");var o=e.querySelector(".tutor-extend-modal-enroll-expire");var a=JSON.parse(t.getAttribute("data-modal-data"));r.innerHTML='\n                <div class="tutor-extend-modal-course-thumb">\n                    <img src="'.concat(a.course_thumb,'" />\n                </div>\n                <div class="tutor-extend-modal-course-title">\n                    <a href="').concat(a.course_url,'" target="_blank">\n                        ').concat(a.course_title,"\n                    </a>\n                </div>\n            ");n.innerHTML='\n                <div class="tutor-d-flex align-items-center tutor-gap-1">\n                    <img class="tutor-avatar tutor-avatar-sm" src="'.concat(a.user_avatar,'" alt="').concat(a.user_name,'" />\n                    <div>\n                        <div class="tutor-fs-6 tutor-fw-medium tutor-color-black">').concat(a.user_name,'</div>\n                        <div class="tutor-color-subdued tutor-fs-7">').concat(a.user_email,"</div>\n                    </div>\n                </div>    \n            ");o.innerHTML='\n                <input type="hidden" name="enrollment_id" value="'.concat(a.enrol_id,'" />\n                <div class="tutor-color-secondary tutor-mb-4">\n                    ').concat(a.is_expired?__("Enrollment Expired On","tutor-pro"):__("Enrollment Expires On","tutor-pro"),'\n                </div>\n                <div class="tutor-color-danger tutor-mb-12">').concat(a.expiry_date_readable,'</div>\n                <label class="tutor-color-secondary tutor-mb-4 tutor-d-block">\n                    ').concat(__("Extend Until","tutor-pro"),'\n                </label>\n                <div class="tutor-v2-date-picker" data-prevent_redirect="1" data-input_name="enroll_extend_date" data-input_value="').concat(a.expiry_date,'" data-disable_past_date="1"></div>\n            ');window.dispatchEvent(new Event("tutor_content_changed_event"));e.classList.add("tutor-is-active");document.querySelector("body").classList.add("tutor-modal-open")})});/**
     * Handle enrollment extend submit
     *
     * @since v.3.3.0
     */var r=document.querySelector("#tutor-enrollment-extend-submit-btn");r===null||r===void 0?void 0:r.addEventListener("click",function(){return o(function*(){r.classList.add("is-loading");var e=document.querySelector("#tutor-enrollment-extend-modal");var n=e.querySelector("input[name='enroll_extend_date']").value;var o=e.querySelector("input[name='enrollment_id']").value;var a=u([{action:"tutor_pro_enrollment_extend"},{enrollment_id:o},{extend_date:n}]);try{var c=yield d(a);var{status_code:i,message:l}=yield c.json();if(i===200){tutor_toast(__("Success","tutor-pro"),l,"success");window.location.reload()}else{tutor_toast(__("Failed","tutor-pro"),l,"error")}}catch(e){tutor_toast(__("Operation failed","tutor-pro"),t,"error")}finally{r.classList.remove("is-loading")}})()})})})();