(()=>{"use strict";var t={};// The module cache
var e={};// The require function
function n(i){// Check if module is in cache
var r=e[i];if(r!==undefined){return r.exports}// Create a new module (and put it into the cache)
var o=e[i]={exports:{}};// Execute the module function
t[i](o,o.exports,n);// Return the exports of the module
return o.exports}// webpack/runtime/rspack_version
(()=>{n.rv=()=>"1.6.5"})();// webpack/runtime/rspack_unique_id
(()=>{n.ruid="bundler=rspack@1.6.5"})();// CONCATENATED MODULE: ./node_modules/.pnpm/@swc+helpers@0.5.17/node_modules/@swc/helpers/esm/_async_to_generator.js
function i(t,e,n,i,r,o,s){try{var a=t[o](s);var u=a.value}catch(t){n(t);return}if(a.done)e(u);else Promise.resolve(u).then(i,r)}function r(t){return function(){var e=this,n=arguments;return new Promise(function(r,o){var s=t.apply(e,n);function a(t){i(s,r,o,a,u,"next",t)}function u(t){i(s,r,o,a,u,"throw",t)}a(undefined)})}};// CONCATENATED MODULE: external "wp.i18n"
const o=wp.i18n;// CONCATENATED MODULE: ./addons/tutor-assignments/assets/src/js/dashboard-assignments.ts
var s=()=>{var{query:t,toast:e,modal:n}=window.TutorCore;var{wpPost:i}=window.TutorCore.api;var{convertToErrorMessage:s}=window.TutorCore.error;return{query:t,deleteMutation:null,init(){this.deleteMutation=this.query.useMutation(this.deleteAssignment,{onSuccess:t=>{var i;n.closeModal("tutor-assignment-delete-modal");e.success((t===null||t===void 0?void 0:(i=t.data)===null||i===void 0?void 0:i.message)||(0,o.__)("Assignment deleted successfully!","tutor-pro"));window.location.reload()},onError:t=>{e.error(s(t))}})},deleteAssignment(t){return i("delete_tutor_course_assignment_submission",{assignment_id:t})},handleDeleteAssignment(t){return r(function*(){var e;yield(e=this.deleteMutation)===null||e===void 0?void 0:e.mutate(t)}).call(this)}}};/**
 * Assignment Review Page Component
 */var a=t=>{var{query:e,toast:n}=window.TutorCore;var{wpPost:i}=window.TutorCore.api;var{convertToErrorMessage:s}=window.TutorCore.error;return{query:e,evaluationMutation:null,init(){this.evaluationMutation=this.query.useMutation(this.evaluateAssignment,{onSuccess:t=>{n.success(t.message||t.data||(0,o.__)("Assignment evaluated","tutor-pro"))},onError:t=>{n.error(s(t))}})},evaluateAssignment(t){return r(function*(){return i("tutor_evaluate_assignment_submission",t)})()},handleFormSubmit(e){return r(function*(){var n;var i={assignment_submitted_id:t.assignment_submitted_id,assignment_post_id:t.assignment_id,"evaluate_assignment[assignment_mark]":e.assignment_mark,"evaluate_assignment[instructor_note]":e.instructor_note,tutor_action:"tutor_evaluate_assignment_submission"};yield(n=this.evaluationMutation)===null||n===void 0?void 0:n.mutate(i)}).call(this)}}};var u=()=>{window.TutorComponentRegistry.registerAll({components:[{name:"assignments",component:s},{name:"assignmentReview",component:a}]});window.TutorComponentRegistry.initWithAlpine(window.Alpine)};document.addEventListener("alpine:init",u)})();