Files
machartaa_admin_dist/dist/assets/index-77900d5b.js
T
2026-07-13 14:17:44 +03:30

15 lines
43 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import{_ as dt}from"./BasicMainCard-ca45dc8f.js";import{_ as Ee}from"./BasicModal.vue_vue_type_style_index_0_lang-d3e2b6d9.js";import{_ as pt,a as mt,u as Le}from"./useBaseTable-2c12f999.js";import{_ as vt}from"./BasicInput.vue_vue_type_style_index_0_lang-f566c603.js";import{_ as ft}from"./BasicTextArea.vue_vue_type_style_index_0_lang-a40a66e5.js";import{_ as Oe}from"./button.vue_vue_type_style_index_0_lang-0f677bfc.js";import{G as D,_ as ht,d as Ne,g as E,h as gt,E as bt,o as k,i as ze,w,a as e,b as c,e as F,c as $,j as B,t as N,k as M,F as ke,n as qe,D as T,p as je,A as yt,v as xt,H as Me,y as xe,M as wt,N as kt,bC as qt,I as we}from"./index-25cd5b63.js";import{f as De,b as St,c as $t,d as Ut,e as At,t as Ct,M as He,g as It}from"./supabaseTableQuery-95762ff3.js";import{e as H,a as We,g as oe}from"./convert-2ad76038.js";import{t as ve}from"./useDataTime-2e34f996.js";import{S as Je}from"./index-517534fa.js";import{_ as Rt}from"./index-b0588d09.js";import{I as G}from"./Icon-01a88edc.js";import{a as Be}from"./index-f3a3c466.js";import{M as Pt}from"./index-b02fc407.js";import{a as Te}from"./updateLocale-0fa6d737.js";import{T as pe}from"./isSymbol-77c00ba0.js";import{U as me}from"./index-fa98773a.js";import{_ as Lt}from"./_plugin-vue_export-helper-8d8742f4.js";import"./index-07c1e11d.js";import"./index-215d9d0e.js";import"./Col-cf6eff58.js";import"./styleChecker-8ac93962.js";import"./isPlainObject-8b65ef77.js";import"./vnode-f0cfc776.js";import"./useState-d0b157bd.js";import"./FormItemContext-98c099ed.js";import"./lodash-6b23de74.js";import"./index-27d91bcb.js";import"./css-19df7134.js";import"./DialogWrap-5bf5c8bc.js";import"./pickAttrs-e75df291.js";import"./index-e45ca121.js";import"./toArray-0e67c9de.js";import"./usePrice-bc935b83.js";import"./useRefs-50f31a64.js";import"./_flatRest-93154856.js";import"./index-a77b6e96.js";function Mt(n){if(Array.isArray(n))return n.map(String).filter(Boolean);if(typeof n=="string")try{const l=JSON.parse(n);if(Array.isArray(l))return l.map(String).filter(Boolean)}catch{return n.trim()?[n]:[]}return[]}function Dt(n){return{...n,duration_minutes:Math.round((Number(n.duration_seconds)||60)/60),kodoblu_voice_url:H(n.kodoblu_voice_url)||"",audio_section_url:H(n.audio_section_url)||"",step_images:Mt(n.step_images).map(l=>H(l)||l)}}function Ve(n,l,p){var v,u,f;return{challenge_id:n,step_order:p,description:l.description||"",duration_seconds:Math.max(1,Math.round(Number(l.duration_minutes)*60)),aparat_embed_code:((v=l.aparat_embed_code)==null?void 0:v.trim())||null,kodoblu_voice_url:H((u=l.kodoblu_voice_url)==null?void 0:u.trim())||null,step_images:(l.step_images||[]).map(P=>H(P)||P).filter(Boolean),is_final_step:!!l.is_final_step,enable_feedback_text:!!l.enable_feedback_text,require_feedback_text:!!l.require_feedback_text,enable_photo_upload:!!(l.enable_photo_upload||l.requires_photo_upload),require_photo_upload:!!(l.require_photo_upload||l.requires_photo_upload),enable_voice_upload:!!l.enable_voice_upload,require_voice_upload:!!l.require_voice_upload,enable_mcq:!!l.enable_mcq,require_mcq:!!l.require_mcq,mcq_question:l.mcq_question||null,mcq_options:(l.mcq_options||[]).filter(P=>P.trim()),mcq_correct_index:l.enable_mcq?Number(l.mcq_correct_index??0):null,enable_audio_section:!!l.enable_audio_section,audio_section_url:H((f=l.audio_section_url)==null?void 0:f.trim())||null,punishment_description:l.punishment_description||"",requires_photo_upload:!!(l.enable_photo_upload||l.requires_photo_upload),updated_at:new Date().toISOString()}}function Bt(n,l){return l.map((p,v)=>Ve(n,p,v+1))}async function Tt(n){const{data:l,error:p}=await D.from("step_challenges").select("*").eq("id",n).single();if(p)throw p;const{data:v,error:u}=await D.from("step_challenge_steps").select("*").eq("challenge_id",n).order("step_order",{ascending:!0});if(u)throw u;return{...l,steps:(v||[]).map(f=>Dt(f))}}async function Ft(n,l){const{data:p,error:v}=await D.from("step_challenges").insert([{title:n.title,character_image_url:n.character_image_url,show:n.show??!1,access_type:n.access_type??"free",sort_order:n.sort_order??0,completion_points:Number(n.completion_points)||50,owner_id:l||null}]).select().single();if(v)throw v;const u=Bt(p.id,n.steps),{error:f}=await D.from("step_challenge_steps").insert(u);if(f)throw f;return p}async function Et(n,l){const{error:p}=await D.from("step_challenges").update({title:l.title,character_image_url:l.character_image_url,show:l.show??!1,access_type:l.access_type??"free",sort_order:l.sort_order??0,completion_points:Number(l.completion_points)||50,updated_at:new Date().toISOString()}).eq("id",n);if(p)throw p;const{data:v,error:u}=await D.from("step_challenge_steps").select("id").eq("challenge_id",n);if(u)throw u;const f=new Set((v||[]).map(x=>x.id)),P=l.steps.map(x=>x.id).filter(x=>typeof x=="number"&&f.has(x)),U=[...f].filter(x=>!P.includes(x));if(U.length){const{error:x}=await D.from("user_step_challenge_steps").delete().in("step_id",U);if(x)throw x;const{error:_}=await D.from("step_challenge_steps").delete().in("id",U);if(_)throw _}for(const x of P){const{error:_}=await D.from("step_challenge_steps").update({step_order:-x,updated_at:new Date().toISOString()}).eq("id",x);if(_)throw _}for(let x=0;x<l.steps.length;x++){const _=l.steps[x],d=Ve(n,_,x+1);if(_.id&&f.has(_.id)){const{error:A}=await D.from("step_challenge_steps").update(d).eq("id",_.id);if(A)throw A;continue}const{error:C}=await D.from("step_challenge_steps").insert(d);if(C)throw C}return{id:n}}async function Ot(n){const{error:l}=await D.from("step_challenges").delete().eq("id",n);if(l)throw l}async function Nt(n,l){const{data:p,error:v}=await D.from("step_challenges").update({...l,updated_at:new Date().toISOString()}).eq("id",n).select();if(v)throw v;return p}async function zt(n){const{TableEngineRequest:l}=await ht(()=>import("./buildSupabaseQuery-5c162ca9.js"),["assets/buildSupabaseQuery-5c162ca9.js","assets/index-25cd5b63.js","assets/index-2b0c085a.css","assets/supabaseTableQuery-95762ff3.js"]),p={...n};!p.sort&&!p.order&&(p.order="-id");const v=await l(p,"step_challenges");try{if(Array.isArray(v==null?void 0:v.rows)){const u=v.rows,f=u.map(C=>C.id).filter(Boolean);let P={};if(f.length>0){const{data:C}=await D.from("step_challenge_steps").select("id, challenge_id, step_order, duration_seconds").in("challenge_id",f);P=(C||[]).reduce((A,j)=>(A[j.challenge_id]||(A[j.challenge_id]=[]),A[j.challenge_id].push(j),A),{})}const U=p.page||1,x=p.limit||20,_=(U-1)*x,d=u.map((C,A)=>{const j=P[C.id]||[],Y=j.reduce((te,se)=>te+Math.round((se.duration_seconds||0)/60),0);return{...C,index:_+A,steps_count:j.length,total_minutes:Y}});return{...v,rows:d}}}catch(u){console.log("[getStepChallengesTable] normalize error:",u)}return v}const jt=new Set(["status","current_step_order","started_at","completed_at","created_at","challenge_id"]);async function Fe(n){const l=n.trim();if(!l)return[];const{data:p,error:v}=await D.from("step_challenges").select("id").ilike("title",Ct(l)).limit(He);if(v)throw v;return(p||[]).map(u=>u.id)}function Ht(n,l,p){const v=It(["status"],n,l).split(","),u=[...new Set(p)].slice(0,He);return u.length&&v.push(`challenge_id.in.(${u.join(",")})`),v.join(",")}async function Wt(n){const{limit:l=20,page:p=1,search:v,filters:u}=n;let f=D.from("user_step_challenges").select("*, step_challenges(title), users(name, phone, first_name, last_name)",{count:"exact"});if(v!=null&&v.trim()){const[_,d]=await Promise.all([De(D,v),Fe(v)]);f=f.or(Ht(v,_,d))}if(u!=null&&u.length){for(const _ of u)if(!(_.hidden||!_.field)){if(_.field==="challenge_title"){if(["eq","has","like"].includes(_.op)){const d=await Fe(String(_.value));d.length?f=f.in("challenge_id",d):f=f.eq("challenge_id",-1)}continue}if(_.field==="user_name"||_.field==="user_phone"){if(["eq","has","like"].includes(_.op)){const d=await De(D,String(_.value));d.length?f=f.in("user_id",d):f=f.eq("user_id","00000000-0000-0000-0000-000000000000")}continue}jt.has(_.field)&&(f=St(f,_))}}f=$t(f,n,"-created_at",["created_at","status","current_step_order"]),f=Ut(f,p,l);const{data:P,error:U,count:x}=await f;if(U)throw U;return At(P,x,n,_=>{const d=Array.isArray(_.users)?_.users[0]:_.users,C=Array.isArray(_.step_challenges)?_.step_challenges[0]:_.step_challenges;let A="نامشخص";return d!=null&&d.name?A=d.name:d!=null&&d.first_name||d!=null&&d.last_name?A=`${d.first_name||""} ${d.last_name||""}`.trim():d!=null&&d.phone&&(A=d.phone),{..._,challenge_title:(C==null?void 0:C.title)||"",user_name:A,user_phone:(d==null?void 0:d.phone)||""}})}async function Jt(n){const{data:l,error:p}=await D.from("user_step_challenges").select("*, step_challenges(title), users(name, phone, first_name, last_name)").eq("id",n).single();if(p)throw p;const{data:v,error:u}=await D.from("user_step_challenge_steps").select(`
*,
step_challenge_steps (
step_order,
description,
is_final_step,
enable_mcq,
mcq_question,
mcq_options,
enable_feedback_text,
enable_photo_upload,
enable_voice_upload
)
`).eq("user_challenge_id",n).order("id",{ascending:!0});if(u)throw u;const f=(v||[]).map(x=>{const _=Array.isArray(x.step_challenge_steps)?x.step_challenge_steps[0]:x.step_challenge_steps;let d=[];const C=_==null?void 0:_.mcq_options;if(Array.isArray(C))d=C.map(String);else if(typeof C=="string")try{const A=JSON.parse(C);Array.isArray(A)&&(d=A.map(String))}catch{d=[]}return{...x,step_challenge_steps:_?{..._,mcq_options:d}:null}});f.sort((x,_)=>{var A,j;const d=((A=x.step_challenge_steps)==null?void 0:A.step_order)??999,C=((j=_.step_challenge_steps)==null?void 0:j.step_order)??999;return d-C});const P=Array.isArray(l.step_challenges)?l.step_challenges[0]:l.step_challenges,U=Array.isArray(l.users)?l.users[0]:l.users;return{...l,challenge_title:(P==null?void 0:P.title)||"",user_name:(U==null?void 0:U.name)||[U==null?void 0:U.first_name,U==null?void 0:U.last_name].filter(Boolean).join(" ")||(U==null?void 0:U.phone)||"نامشخص",user_phone:(U==null?void 0:U.phone)||"",steps_progress:f}}async function Vt(){const{data:n,error:l}=await D.from("step_challenge_config").select("*").eq("id",1).maybeSingle();if(l)throw l;return n||{id:1,rules_aparat_embed_code:null}}async function Kt(n){const{data:l,error:p}=await D.from("step_challenge_config").upsert({id:1,rules_aparat_embed_code:n.rules_aparat_embed_code||null,updated_at:new Date().toISOString()}).select().single();if(p)throw p;return l}const Xt=[{title:"ردیف",dataIndex:"id",key:"id",filterable:!1,width:70,align:"center",customRender:n=>n.record.index+1},{title:"عنوان",dataIndex:"title",key:"title"},{title:"مراحل",dataIndex:"steps_count",key:"steps_count",customRender:n=>{const l=n.record.steps_count||0,p=n.record.total_minutes||0;return l?`${l} مرحله / ${p} دقیقه`:"-"}},{title:"نمایش",dataIndex:"show",key:"show",customRender:n=>n.record.show?"فعال":"مخفی"},{title:"نوع",dataIndex:"access_type",key:"access_type",width:100,align:"center",customRender:n=>n.record.access_type==="subscription"?"اشتراکی":"رایگان"},{title:"ترتیب",dataIndex:"sort_order",key:"sort_order",width:80,align:"center"},{title:"زمان ایجاد",dataIndex:"created_at",key:"created_at",customRender:n=>ve(n.record.created_at)},{title:"عملیات",dataIndex:"action",key:"action",slot:"action",filterable:!1,align:"center"}],Gt={in_progress:"در حال انجام",completed:"تکمیل شده",abandoned:"رها شده"},Qt=[{title:"ردیف",dataIndex:"id",key:"id",filterable:!1,width:70,align:"center",customRender:n=>n.record.index+1},{title:"چالش",dataIndex:"challenge_title",key:"challenge_title",filterField:"challenge_title"},{title:"کاربر",dataIndex:"user_name",key:"user_name",filterField:"user_name"},{title:"موبایل",dataIndex:"user_phone",key:"user_phone",filterField:"user_phone"},{title:"وضعیت",dataIndex:"status",key:"status",customRender:n=>Gt[n.record.status]||n.record.status},{title:"مرحله فعلی",dataIndex:"current_step_order",key:"current_step_order",align:"center"},{title:"شروع",dataIndex:"started_at",key:"started_at",customRender:n=>ve(n.record.started_at)},{title:"پایان",dataIndex:"completed_at",key:"completed_at",customRender:n=>n.record.completed_at?ve(n.record.completed_at):"-"},{title:"عملیات",dataIndex:"action",key:"action",slot:"action",filterable:!1,align:"center",width:90}],Yt={key:0,class:"py-16 flex justify-center"},Zt={key:1,class:"space-y-4 max-h-[70vh] overflow-y-auto pr-1"},es={class:"grid grid-cols-1 sm:grid-cols-2 gap-3 text-sm"},ts=e("span",{class:"text-gray-500"},"چالش:",-1),ss={class:"font-600"},as=e("span",{class:"text-gray-500"},"کاربر:",-1),os={class:"font-600"},ls=e("span",{class:"text-gray-500"},"موبایل:",-1),ns={class:"font-600"},is=e("span",{class:"text-gray-500"},"وضعیت:",-1),rs={class:"font-600"},cs=e("span",{class:"text-gray-500"},"شروع:",-1),us={class:"font-600"},_s=e("span",{class:"text-gray-500"},"پایان:",-1),ds={class:"font-600"},ps={key:0},ms=e("span",{class:"text-gray-500"},"امتیاز:",-1),vs={class:"font-600"},fs={key:0,class:"rounded-xl border border-gray-200 bg-gray-50 p-3"},hs=e("div",{class:"text-sm font-700 mb-1"},"بازخورد پایان چالش",-1),gs={class:"text-sm whitespace-pre-wrap leading-7"},bs={key:1,class:"text-center text-gray-500 py-8"},ys={class:"flex flex-wrap items-center justify-between gap-2"},xs={class:"font-700 text-[#120d31]"},ws={key:0,class:"text-sm text-gray-600 leading-7"},ks={key:1,class:"rounded-lg bg-blue-50 p-3"},qs=e("div",{class:"text-xs font-700 text-gray-600 mb-1"},"بازخورد متنی",-1),Ss={class:"text-sm whitespace-pre-wrap leading-7"},$s={key:2,class:"space-y-2"},Us=e("div",{class:"text-xs font-700 text-gray-600"},"عکس ارسالی",-1),As={key:3,class:"space-y-2"},Cs=e("div",{class:"text-xs font-700 text-gray-600"},"ویس ارسالی",-1),Is=["src"],Rs={key:4,class:"rounded-lg bg-amber-50 p-3"},Ps=e("div",{class:"text-xs font-700 text-gray-600 mb-1"},"پاسخ چندگزینه‌ای",-1),Ls={key:0,class:"text-sm text-gray-600 mb-1"},Ms={class:"text-sm font-600"},Ds={key:5,class:"text-xs text-gray-400"},Bs={class:"flex justify-end"},Ts=Ne({__name:"StepChallengeProgressDetailModal",props:{visible:{type:Boolean},userChallengeId:{}},emits:["update:visible"],setup(n,{emit:l}){const p=n,v=E(!1),u=E(null),f=gt({get:()=>p.visible,set:m=>l("update:visible",m)}),P={in_progress:"در حال انجام",completed:"تکمیل شده",abandoned:"رها شده"},U={pending:"شروع نشده",running:"در حال انجام",completed:"انجام شده",failed:"ناموفق"};function x(m){return m?ve(m):"—"}function _(m){return P[m||""]||m||"—"}function d(m){return U[m||""]||m||"—"}function C(m){return m==="completed"?"bg-green-50 border-green-200 text-green-800":m==="running"?"bg-yellow-50 border-yellow-200 text-yellow-800":m==="failed"?"bg-red-50 border-red-200 text-red-800":"bg-gray-50 border-gray-200 text-gray-600"}function A(m){return m?m.match(/\.(mp3|wav|ogg|m4a|aac|webm)$/i)?We(m):oe(m):""}function j(m){const R=m.step_challenge_steps;return R!=null&&R.is_final_step?"ماموریت پایانی":R!=null&&R.step_order?`مرحله ${R.step_order}`:`مرحله ${m.id}`}function Y(m){var J;const R=m.mcq_answer,W=((J=m.step_challenge_steps)==null?void 0:J.mcq_options)||[];return typeof R=="number"&&W[R]?W[R]:typeof R=="number"?`گزینه ${R+1}`:"—"}function te(m){var R;return!!((R=m.feedback_text)!=null&&R.trim()||m.photo_url||m.voice_url||m.mcq_answer!==null&&m.mcq_answer!==void 0)}async function se(){if(p.userChallengeId){v.value=!0,u.value=null;try{u.value=await Jt(p.userChallengeId)}catch(m){T.error((m==null?void 0:m.message)||"خطا در بارگذاری جزئیات"),l("update:visible",!1)}finally{v.value=!1}}}function K(){l("update:visible",!1)}return bt(()=>[p.visible,p.userChallengeId],([m,R])=>{m&&R&&se(),m||(u.value=null)}),(m,R)=>{const W=Oe,J=Ee;return k(),ze(J,{visible:f.value,"onUpdate:visible":R[0]||(R[0]=O=>f.value=O),title:"جزئیات ارسال‌های کاربر",width:"88%","custom-footer":!0,onCancel:K},{footer:w(()=>[e("div",Bs,[c(W,{onClick:K},{default:w(()=>[F("بستن")]),_:1})])]),default:w(()=>{var O;return[v.value?(k(),$("div",Yt,[c(B(Je),{size:"large"})])):u.value?(k(),$("div",Zt,[e("div",es,[e("div",null,[ts,F(),e("span",ss,N(u.value.challenge_title),1)]),e("div",null,[as,F(),e("span",os,N(u.value.user_name),1)]),e("div",null,[ls,F(),e("span",ns,N(u.value.user_phone||"—"),1)]),e("div",null,[is,F(),e("span",rs,N(_(u.value.status)),1)]),e("div",null,[cs,F(),e("span",us,N(x(u.value.started_at)),1)]),e("div",null,[_s,F(),e("span",ds,N(u.value.completed_at?x(u.value.completed_at):"—"),1)]),u.value.points_awarded?(k(),$("div",ps,[ms,F(),e("span",vs,N(u.value.points_awarded),1)])):M("",!0)]),u.value.completion_feedback?(k(),$("div",fs,[hs,e("div",gs,N(u.value.completion_feedback),1)])):M("",!0),(O=u.value.steps_progress)!=null&&O.length?M("",!0):(k(),$("div",bs," هنوز ارسالی برای این چالش ثبت نشده است. ")),(k(!0),$(ke,null,qe(u.value.steps_progress,(I,le)=>{var q,ne,ie;return k(),$("div",{key:I.id,class:"rounded-xl border border-gray-200 p-4 space-y-3"},[e("div",ys,[e("div",xs,N(j(I)),1),e("span",{class:je(["text-xs font-600 px-2 py-1 rounded-full border",C(I.status)])},N(d(I.status)),3)]),(q=I.step_challenge_steps)!=null&&q.description?(k(),$("div",ws,N(I.step_challenge_steps.description),1)):M("",!0),(ne=I.feedback_text)!=null&&ne.trim()?(k(),$("div",ks,[qs,e("div",Ss,N(I.feedback_text),1)])):M("",!0),I.photo_url?(k(),$("div",$s,[Us,c(B(Rt),{src:A(I.photo_url),preview:{mask:"پیش نمایش"},class:"!max-w-xs rounded-xl border border-gray-200 overflow-hidden"},null,8,["src"])])):M("",!0),I.voice_url?(k(),$("div",As,[Cs,e("audio",{src:A(I.voice_url),controls:"",preload:"metadata",class:"w-full max-w-md"},null,8,Is)])):M("",!0),I.mcq_answer!==null&&I.mcq_answer!==void 0?(k(),$("div",Rs,[Ps,(ie=I.step_challenge_steps)!=null&&ie.mcq_question?(k(),$("div",Ls,N(I.step_challenge_steps.mcq_question),1)):M("",!0),e("div",Ms,N(Y(I)),1)])):M("",!0),te(I)?M("",!0):(k(),$("div",Ds," ارسالی برای این مرحله ثبت نشده است. "))])}),128))])):M("",!0)]}),_:1},8,["visible"])}}}),g=n=>(wt("data-v-eb109272"),n=n(),kt(),n),Fs={class:"flex justify-between items-center mb-4"},Es=g(()=>e("h2",null,"چالش‌های مرحله‌ای",-1)),Os={class:"gap-2 flex justify-center"},Ns=g(()=>e("span",null,"حذف",-1)),zs=g(()=>e("span",null,"ویرایش",-1)),js=g(()=>e("div",{class:"mb-4"},[e("h2",null,"پیشرفت کاربران در چالش‌ها")],-1)),Hs=g(()=>e("span",null,"مشاهده ارسال‌ها",-1)),Ws={class:"max-w-2xl space-y-4"},Js=g(()=>e("h2",{class:"text-lg font-semibold"},"قوانین چالش‌های کدوبلو",-1)),Vs=g(()=>e("p",{class:"text-sm text-gray-600"}," ویدیوی embed آپارات که در مودال «قوانین چالش کدوبلو» به کاربر نمایش داده می‌شود. ",-1)),Ks=g(()=>e("div",{class:"mb-1 text-sm text-gray-600"},"کد embed ویدیو قوانین",-1)),Xs={class:"space-y-4 relative"},Gs={key:0,class:"absolute inset-0 bg-white/60 z-10 flex items-center justify-center"},Qs=g(()=>e("div",{class:"mb-1 text-sm text-gray-600"},"عنوان چالش",-1)),Ys={class:"grid grid-cols-1 sm:grid-cols-3 gap-4"},Zs=g(()=>e("div",{class:"mb-1 text-sm text-gray-600"},"ترتیب نمایش",-1)),ea=g(()=>e("div",{class:"mb-1 text-sm text-gray-600"},"وضعیت نمایش",-1)),ta={class:"flex items-center gap-2 mt-2"},sa={class:"text-sm text-gray-600"},aa=g(()=>e("div",{class:"mb-1 text-sm text-gray-600"},"نوع دسترسی",-1)),oa=g(()=>e("div",{class:"mb-1 text-sm text-gray-600"},"امتیاز اولین تکمیل",-1)),la={class:"flex justify-center pb-2"},na=g(()=>e("div",{class:"mb-1 text-sm text-gray-600"},"عکس کاراکتر (کارت لیست)",-1)),ia={key:0},ra=g(()=>e("div",null,"آپلود تصویر",-1)),ca={key:0,class:"mt-1"},ua={class:"h-2 rounded bg-gray-200 overflow-hidden"},_a=g(()=>e("div",{class:"section-divider"},null,-1)),da={class:"pt-2"},pa=g(()=>e("div",{class:"mb-2 text-sm text-gray-600 font-semibold"},"مراحل چالش",-1)),ma={class:"space-y-4"},va={class:"flex items-center justify-between gap-3"},fa={class:"font-semibold text-gray-700"},ha={key:0,class:"text-emerald-600 text-sm font-normal mr-1"},ga={class:"flex items-center gap-2"},ba=g(()=>e("span",{class:"text-sm text-gray-600"},"ماموریت پایانی",-1)),ya=g(()=>e("div",{class:"mb-1 text-xs text-gray-500"},"توضیحات مرحله (اختیاری)",-1)),xa={class:"grid grid-cols-2 gap-3"},wa=g(()=>e("div",{class:"mb-1 text-xs text-gray-500"},"زمان لازم (دقیقه)",-1)),ka=g(()=>e("div",{class:"mb-1 text-xs text-gray-500"},"کد embed ویدیو آپارات (اختیاری)",-1)),qa={class:"space-y-2"},Sa=g(()=>e("div",{class:"mb-1 text-xs text-gray-500"},"وویس کدوبلو (اختیاری)",-1)),$a={key:0,class:"mt-1"},Ua={class:"h-2 rounded bg-gray-200 overflow-hidden"},Aa={key:1,class:"step-audio-preview"},Ca={class:"flex items-center justify-between mb-2"},Ia=g(()=>e("div",{class:"step-audio-preview__label mb-0"},"پیش‌نمایش وویس کدوبلو",-1)),Ra=["src"],Pa=g(()=>e("div",{class:"mb-1 text-xs text-gray-500"},"عکس‌های مرحله (اختیاری)",-1)),La={key:0},Ma=g(()=>e("div",{class:"text-xs"},"آپلود عکس",-1)),Da=g(()=>e("div",{class:"section-divider"},null,-1)),Ba={class:"step-form-box__inner"},Ta=g(()=>e("div",{class:"text-xs font-semibold text-gray-600 mb-3"},"آیتم‌های بعد از «بزن بریم»",-1)),Fa={class:"grid grid-cols-1 sm:grid-cols-2 gap-3"},Ea={class:"flex items-center gap-2"},Oa=g(()=>e("span",{class:"text-sm"},"فیلد بازخورد",-1)),Na={class:"flex items-center gap-2"},za=g(()=>e("span",{class:"text-sm"},"بازخورد اجباری",-1)),ja={class:"flex items-center gap-2"},Ha=g(()=>e("span",{class:"text-sm"},"بارگذاری عکس",-1)),Wa={class:"flex items-center gap-2"},Ja=g(()=>e("span",{class:"text-sm"},"عکس اجباری",-1)),Va={class:"flex items-center gap-2"},Ka=g(()=>e("span",{class:"text-sm"},"ضبط و ارسال ویس",-1)),Xa={class:"flex items-center gap-2"},Ga=g(()=>e("span",{class:"text-sm"},"ویس اجباری",-1)),Qa={class:"flex items-center gap-2"},Ya=g(()=>e("span",{class:"text-sm"},"سوال چندگزینه‌ای",-1)),Za={class:"flex items-center gap-2"},eo=g(()=>e("span",{class:"text-sm"},"پاسخ MCQ اجباری",-1)),to={class:"flex items-center gap-2"},so=g(()=>e("span",{class:"text-sm"},"بخش صوت",-1)),ao={key:0,class:"space-y-2 border rounded-lg p-3"},oo=["name","checked","onChange"],lo=g(()=>e("span",{class:"text-xs"},"صحیح",-1)),no={key:1,class:"space-y-2"},io=g(()=>e("div",{class:"mb-1 text-xs text-gray-500"},"فایل بخش صوت",-1)),ro={key:0,class:"mt-1"},co={class:"h-2 rounded bg-gray-200 overflow-hidden"},uo={key:1,class:"step-audio-preview"},_o={class:"flex items-center justify-between mb-2"},po=g(()=>e("div",{class:"step-audio-preview__label mb-0"},"پیش‌نمایش بخش صوت",-1)),mo=["src"],vo={class:"flex justify-end pt-1"},fo=g(()=>e("span",{class:"text-[#DC2626]"},"حذف مرحله",-1)),ho=g(()=>e("span",{class:"text-gray-500"},"+ افزودن مرحله",-1)),go=Ne({__name:"index",setup(n){const l=Be,p=Be.TabPane,v=Te,u=Te.Option,f=E("challenges"),P=E(!1),U=E(!1),x=E(null),_=E(!1),d=E(null),C=E(!1),A=E({rules_aparat_embed_code:""}),[j,Y]=Le(),[te]=Le(),se=yt(),K=E([]),m=E({}),R=E({}),W=E({}),J=E({}),O=E(0),I=E(0),le=()=>({description:"",duration_minutes:5,aparat_embed_code:"",kodoblu_voice_url:"",step_images:[],is_final_step:!1,enable_feedback_text:!1,require_feedback_text:!1,enable_photo_upload:!1,require_photo_upload:!1,enable_voice_upload:!1,require_voice_upload:!1,enable_mcq:!1,require_mcq:!1,mcq_question:"",mcq_options:["",""],mcq_correct_index:0,enable_audio_section:!1,audio_section_url:"",punishment_description:"",requires_photo_upload:!1}),q=E({title:"",character_image_url:null,show:!1,access_type:"free",sort_order:0,completion_points:50,steps:[le()]}),ne={columns:Xt,api:zt,defaultPageLimit:20},ie={columns:Qt,api:Wt,defaultPageLimit:20};function fe(a){return{width:`${Math.max(0,Math.min(100,a))}%`}}function he(){return qt()||localStorage.getItem("tamin_token")||localStorage.getItem("token")||""}function ge(a){var o,h,b,y;const s=a.full_src||a.url||a.src||a.path||((o=a.data)==null?void 0:o.full_src)||((h=a.data)==null?void 0:h.url)||((b=a.data)==null?void 0:b.src)||((y=a.data)==null?void 0:y.path)||"";return H(String(s||""))}function re(a,s,o){const h=[...q.value.steps];h[a]={...h[a],[s]:o},q.value.steps=h}function V(a,s){return`${a}:${s}`}function be(a,s){return m.value[V(a,s)]||[]}function ee(a,s){return R.value[V(a,s)]||0}function ce(a,s,o){R.value[V(a,s)]=o}function ue(a){return a?a.startsWith("http://")||a.startsWith("https://")?a:We(a):""}function Ke(a,s){return W.value[V(a,s)]||""}function Z(a,s){const o=V(a,s),h=W.value[o];h&&(URL.revokeObjectURL(h),delete W.value[o])}function Xe(){Object.values(W.value).forEach(a=>URL.revokeObjectURL(a)),W.value={}}function ae(a,s,o){const h=Ke(a,s);if(h)return h;if(o!=null&&o.trim())return ue(o);const b=be(a,s)[0];return(b==null?void 0:b.url)||""}function Se(a,s,o){return!!ae(a,s,o)}function Ge(){Xe(),m.value={},R.value={}}function Qe(){J.value={}}function ye(a){return J.value[a]||[]}function $e(){const a={};q.value.steps.forEach((s,o)=>{const h=(s.step_images||[]).filter(Boolean);h.length&&(a[o]=h.map((b,y)=>({uid:`step-image-${o}-${y}`,name:`image-${y+1}.jpg`,status:"done",url:oe(b),response:{path:H(b)||b}})))}),J.value=a}function Ue(){const a={};q.value.steps.forEach((s,o)=>{s.audio_section_url&&(a[V(o,"audio_section_url")]=[{uid:`audio-section-${o}`,name:"audio-section.mp3",status:"done",url:ue(s.audio_section_url)}]),s.kodoblu_voice_url&&(a[V(o,"kodoblu_voice_url")]=[{uid:`kodoblu-voice-${o}`,name:"kodoblu-voice.mp3",status:"done",url:ue(s.kodoblu_voice_url)}])}),m.value=a}function _e(a,s){Z(a,s),re(a,s,""),m.value[V(a,s)]=[]}function Ye(a,s){var b,y;const o=H(((b=s.response)==null?void 0:b.path)||s.url||""),h=((y=q.value.steps[a])==null?void 0:y.step_images)||[];re(a,"step_images",h.filter(L=>H(L)!==o)),J.value[a]=(J.value[a]||[]).filter(L=>L.uid!==s.uid)}function Ae(){q.value={title:"",character_image_url:null,show:!1,access_type:"free",sort_order:0,completion_points:50,steps:[le()]},K.value=[],Ge(),Qe()}function Ze(){_.value=!1,d.value=null,Ae(),P.value=!0}function Ce(){P.value=!1,Ae()}function et(){q.value.steps.push(le())}function tt(a){q.value.steps.length<=1||(Z(a,"kodoblu_voice_url"),Z(a,"audio_section_url"),q.value.steps.splice(a,1),Ue(),$e())}function st(a){x.value=a.id,U.value=!0}function Ie(a){return a.type.startsWith("image/")?a.size/1024/1024<5?!0:(T.error("حجم تصویر باید کمتر از 5MB باشد!"),!1):(T.error("فقط فایل‌های تصویری قابل آپلود هستند!"),!1)}async function at(a){const{file:s,onSuccess:o,onError:h,onProgress:b}=a,y=new FormData;y.append("file",s);const L=`${we}/upload/machartaa-img`;I.value=0,O.value++,await new Promise((Q,X)=>{const t=new XMLHttpRequest;t.open("POST",L),t.setRequestHeader("Authorization",`Bearer ${he()}`),t.upload.onprogress=r=>{if(r.lengthComputable){const i=Math.round(r.loaded/r.total*100);I.value=i,b==null||b({percent:i})}},t.onload=()=>{if(I.value=100,t.status>=200&&t.status<300)try{const r=JSON.parse(t.responseText||"{}"),i=ge(r);if(!i)throw new Error("مسیر فایل از سرور دریافت نشد");const S=oe(i);q.value.character_image_url=i,K.value=S?[{uid:`${Date.now()}`,name:"image.jpg",status:"done",url:S,response:{path:i}}]:[],o==null||o(r,t),T.success("تصویر با موفقیت آپلود شد!"),Q()}catch(r){h==null||h(r,t),X(r)}else{const r=new Error("خطا در آپلود تصویر");h==null||h(r,t),X(r)}},t.onerror=()=>{h==null||h(new Error("خطا در آپلود تصویر!"),t),X(new Error("خطا در آپلود تصویر!"))},t.onloadend=()=>{O.value=Math.max(0,O.value-1),I.value=0},t.send(y)})}async function ot(a,s){const{file:o,onSuccess:h,onError:b,onProgress:y}=a,L=new FormData;L.append("file",o);const Q=`${we}/upload/machartaa-img`;O.value++,await new Promise((X,t)=>{const r=new XMLHttpRequest;r.open("POST",Q),r.setRequestHeader("Authorization",`Bearer ${he()}`),r.upload.onprogress=i=>{i.lengthComputable&&(y==null||y({percent:Math.round(i.loaded/i.total*100)}))},r.onload=()=>{var i;if(r.status>=200&&r.status<300)try{const S=JSON.parse(r.responseText||"{}"),z=ge(S);if(!z)throw new Error("مسیر تصویر از سرور دریافت نشد");const de=[...((i=q.value.steps[s])==null?void 0:i.step_images)||[],z];re(s,"step_images",de);const _t={uid:`${Date.now()}-${s}`,name:o.name||"image.jpg",status:"done",url:oe(z),response:{path:z}};J.value[s]=[...ye(s),_t],h==null||h(S,r),T.success("عکس مرحله با موفقیت آپلود شد!"),X()}catch(S){b==null||b(S,r),t(S)}else{const S=new Error("خطا در آپلود عکس مرحله");b==null||b(S,r),t(S)}},r.onerror=()=>{b==null||b(new Error("خطا در آپلود عکس مرحله!"),r),t(new Error("خطا در آپلود عکس مرحله!"))},r.onloadend=()=>{O.value=Math.max(0,O.value-1)},r.send(L)})}function Re(a){return a.type.startsWith("audio/")?a.size/1024/1024<60?!0:(T.error("حجم فایل صوتی باید کمتر از 60MB باشد!"),!1):(T.error("فقط فایل‌های صوتی قابل آپلود هستند!"),!1)}async function Pe(a,s,o){const{file:h,onSuccess:b,onError:y,onProgress:L}=a,Q=new FormData;Q.append("file",h);const X=`${we}/upload/machartaa-audio`;Z(s,o),W.value[V(s,o)]=URL.createObjectURL(h),ce(s,o,0),O.value++,await new Promise((t,r)=>{const i=new XMLHttpRequest;i.open("POST",X),i.setRequestHeader("Authorization",`Bearer ${he()}`),i.timeout=15*60*1e3,i.upload.onprogress=S=>{if(S.lengthComputable){const z=Math.round(S.loaded/S.total*100);ce(s,o,z),L==null||L({percent:z})}},i.onload=()=>{if(ce(s,o,100),i.status>=200&&i.status<300)try{const S=JSON.parse(i.responseText||"{}"),z=ge(S);if(!z)throw new Error("مسیر فایل صوتی از سرور دریافت نشد");Z(s,o),re(s,o,z);const de=ue(z);m.value[V(s,o)]=de?[{uid:`${Date.now()}`,name:h.name||"audio.mp3",status:"done",url:de,response:{path:z}}]:[],b==null||b(S,i),T.success("فایل صوتی با موفقیت آپلود شد!"),t()}catch(S){y==null||y(S,i),r(S)}else{Z(s,o);const S=new Error("خطا در آپلود فایل صوتی");y==null||y(S,i),r(S)}},i.onerror=()=>{Z(s,o),y==null||y(new Error("خطا در آپلود فایل صوتی!"),i),r(new Error("خطا در آپلود فایل صوتی!"))},i.onloadend=()=>{O.value=Math.max(0,O.value-1),ce(s,o,0)},i.send(Q)})}async function lt(a){try{const s=await Tt(a.id);_.value=!0,d.value=a.id,q.value={title:s.title,character_image_url:H(s.character_image_url),show:!!s.show,access_type:s.access_type==="subscription"?"subscription":"free",sort_order:s.sort_order||0,completion_points:s.completion_points??50,steps:(s.steps||[]).map(o=>({id:o.id,description:o.description||"",duration_minutes:o.duration_minutes||Math.round((o.duration_seconds||60)/60),aparat_embed_code:o.aparat_embed_code||"",kodoblu_voice_url:o.kodoblu_voice_url||"",step_images:Array.isArray(o.step_images)?[...o.step_images]:[],is_final_step:!!o.is_final_step,enable_feedback_text:!!o.enable_feedback_text,require_feedback_text:!!o.require_feedback_text,enable_photo_upload:!!(o.enable_photo_upload||o.requires_photo_upload),require_photo_upload:!!(o.require_photo_upload||o.requires_photo_upload),enable_voice_upload:!!o.enable_voice_upload,require_voice_upload:!!o.require_voice_upload,enable_mcq:!!o.enable_mcq,require_mcq:!!o.require_mcq,mcq_question:o.mcq_question||"",mcq_options:Array.isArray(o.mcq_options)&&o.mcq_options.length?[...o.mcq_options]:["",""],mcq_correct_index:Number(o.mcq_correct_index??0),enable_audio_section:!!o.enable_audio_section,audio_section_url:o.audio_section_url||"",punishment_description:o.punishment_description||"",requires_photo_upload:!!(o.enable_photo_upload||o.requires_photo_upload)}))},s.character_image_url&&(K.value=[{uid:`${Date.now()}`,name:"image.jpg",status:"done",url:oe(s.character_image_url)}]),Ue(),$e(),P.value=!0}catch(s){T.error(s.message||"خطا در بارگذاری چالش")}}async function nt(a){Pt.confirm({title:"حذف چالش",content:"آیا از حذف این چالش مطمئن هستید؟",okText:"بله",cancelText:"خیر",onOk:async()=>{await Ot(a.id),T.success("چالش حذف شد"),Y()}})}async function it(a){await Nt(a.id,{show:!a.show}),T.success(a.show?"چالش مخفی شد":"چالش نمایش داده می‌شود"),Y()}async function rt(){var a;C.value=!0;try{await Kt({rules_aparat_embed_code:((a=A.value.rules_aparat_embed_code)==null?void 0:a.trim())||null}),T.success("تنظیمات ذخیره شد")}catch(s){T.error(s.message||"خطا در ذخیره تنظیمات")}finally{C.value=!1}}async function ct(){try{const a=await Vt();A.value.rules_aparat_embed_code=(a==null?void 0:a.rules_aparat_embed_code)||""}catch(a){T.error(a.message||"خطا در بارگذاری تنظیمات")}}xt(ct);async function ut(){var a;if(!q.value.title.trim()){T.error("عنوان چالش الزامی است");return}if(O.value>0){T.warning("لطفاً تا پایان آپلود فایل‌ها صبر کنید");return}try{const s={...q.value,sort_order:Number(q.value.sort_order)||0,completion_points:Number(q.value.completion_points)||50,steps:q.value.steps.map(o=>{var h,b;return{...o,kodoblu_voice_url:H((h=o.kodoblu_voice_url)==null?void 0:h.trim())||"",audio_section_url:H((b=o.audio_section_url)==null?void 0:b.trim())||"",step_images:(o.step_images||[]).map(y=>H(y)||y).filter(Boolean)}})};_.value&&d.value?(await Et(d.value,s),T.success("چالش ویرایش شد")):(await Ft(s,(a=se.userInfo)==null?void 0:a.id),T.success("چالش اضافه شد")),Ce(),Y()}catch(s){T.error(s.message||"خطا در ذخیره چالش")}}return(a,s)=>{const o=Oe,h=pt,b=ft,y=vt,L=mt,Q=Ee,X=dt;return k(),$("div",null,[c(X,null,{default:w(()=>[c(B(l),{activeKey:f.value,"onUpdate:activeKey":s[1]||(s[1]=t=>f.value=t)},{default:w(()=>[c(B(p),{key:"challenges",tab:"مدیریت چالش‌ها"},{default:w(()=>[e("div",Fs,[Es,c(o,{type:"primary",onClick:Ze},{default:w(()=>[F("افزودن چالش")]),_:1})]),c(h,Me(ne,{ref:"table",onRegister:B(j)}),{action:w(({record:t})=>[e("div",Os,[c(B(pe),{class:"cursor-pointer"},{title:w(()=>[e("span",null,N(t.show?"مخفی کردن":"نمایش"),1)]),default:w(()=>[c(G,{icon:t.show?"vuesax-linear:eye-slash":"vuesax-linear:eye",color:t.show?"#F59E0B":"#16A34A",onClick:r=>it(t)},null,8,["icon","color","onClick"])]),_:2},1024),c(B(pe),{class:"cursor-pointer"},{title:w(()=>[Ns]),default:w(()=>[c(G,{icon:"vuesax-linear:trash",color:"#DC2626",onClick:r=>nt(t)},null,8,["onClick"])]),_:2},1024),c(B(pe),{class:"cursor-pointer"},{title:w(()=>[zs]),default:w(()=>[c(G,{icon:"vuesax-linear:edit",color:"#1D4ED8",onClick:r=>lt(t)},null,8,["onClick"])]),_:2},1024)])]),_:1},16,["onRegister"])]),_:1}),c(B(p),{key:"progress",tab:"پیشرفت کاربران"},{default:w(()=>[js,c(h,Me(ie,{onRegister:B(te)}),{action:w(({record:t})=>[c(B(pe),{class:"cursor-pointer"},{title:w(()=>[Hs]),default:w(()=>[c(G,{icon:"vuesax-linear:eye",color:"#1D4ED8",onClick:r=>st(t)},null,8,["onClick"])]),_:2},1024)]),_:1},16,["onRegister"])]),_:1}),c(B(p),{key:"settings",tab:"تنظیمات صفحه"},{default:w(()=>[e("div",Ws,[Js,Vs,e("div",null,[Ks,c(b,{value:A.value.rules_aparat_embed_code,"onUpdate:value":s[0]||(s[0]=t=>A.value.rules_aparat_embed_code=t),placeholder:"کد embed از آپارات",rows:4},null,8,["value"])]),c(o,{type:"primary",loading:C.value,onClick:rt},{default:w(()=>[F(" ذخیره تنظیمات ")]),_:1},8,["loading"])])]),_:1})]),_:1},8,["activeKey"]),c(Q,{visible:P.value,"onUpdate:visible":s[8]||(s[8]=t=>P.value=t),title:_.value?"ویرایش چالش":"افزودن چالش",onOk:ut,onCancel:Ce,width:"85%",confirmLoading:O.value>0},{default:w(()=>[e("div",Xs,[O.value>0?(k(),$("div",Gs,[c(B(Je),{size:"large"})])):M("",!0),e("div",null,[Qs,c(y,{value:q.value.title,"onUpdate:value":s[2]||(s[2]=t=>q.value.title=t),placeholder:"عنوان چالش"},null,8,["value"])]),e("div",Ys,[e("div",null,[Zs,c(y,{value:q.value.sort_order,"onUpdate:value":s[3]||(s[3]=t=>q.value.sort_order=t),type:"number",placeholder:"0"},null,8,["value"])]),e("div",null,[ea,e("div",ta,[c(L,{value:q.value.show,"onUpdate:value":s[4]||(s[4]=t=>q.value.show=t)},null,8,["value"]),e("span",sa,N(q.value.show?"نمایش":"مخفی"),1)])]),e("div",null,[aa,c(B(v),{value:q.value.access_type,"onUpdate:value":s[5]||(s[5]=t=>q.value.access_type=t),class:"w-full"},{default:w(()=>[c(B(u),{value:"free"},{default:w(()=>[F("رایگان (همه کاربران)")]),_:1}),c(B(u),{value:"subscription"},{default:w(()=>[F("اشتراکی (فقط اشتراک فعال)")]),_:1})]),_:1},8,["value"])]),e("div",null,[oa,c(y,{value:q.value.completion_points,"onUpdate:value":s[6]||(s[6]=t=>q.value.completion_points=t),type:"number",min:"0",placeholder:"50"},null,8,["value"])])]),e("div",la,[e("div",null,[na,c(B(me),{"file-list":K.value,"onUpdate:fileList":s[7]||(s[7]=t=>K.value=t),"before-upload":Ie,"custom-request":at,accept:"image/*","max-count":1,"list-type":"picture-card"},{default:w(()=>[K.value.length<1?(k(),$("div",ia,[c(G,{icon:"vuesax-linear:image",class:"text-2xl mb-2"}),ra])):M("",!0)]),_:1},8,["file-list"]),I.value>0&&I.value<100?(k(),$("div",ca,[e("div",ua,[e("div",{class:"h-2 bg-blue-500 transition-all",style:xe(fe(I.value))},null,4)])])):M("",!0)])]),_a,e("div",da,[pa,e("div",ma,[(k(!0),$(ke,null,qe(q.value.steps,(t,r)=>(k(),$("div",{key:r,class:je(["step-form-box",{"step-form-box--final":t.is_final_step}])},[e("div",va,[e("div",fa,[F(" مرحله "+N(r+1)+" ",1),t.is_final_step?(k(),$("span",ha,"(ماموریت پایانی)")):M("",!0)]),e("div",ga,[c(L,{value:t.is_final_step,"onUpdate:value":i=>t.is_final_step=i},null,8,["value","onUpdate:value"]),ba])]),e("div",null,[ya,c(b,{value:t.description,"onUpdate:value":i=>t.description=i,placeholder:"توضیحات مرحله",rows:2},null,8,["value","onUpdate:value"])]),e("div",xa,[e("div",null,[wa,c(y,{value:t.duration_minutes,"onUpdate:value":i=>t.duration_minutes=i,type:"number",min:"1",placeholder:"5"},null,8,["value","onUpdate:value"])])]),e("div",null,[ka,c(b,{value:t.aparat_embed_code,"onUpdate:value":i=>t.aparat_embed_code=i,placeholder:"کد embed",rows:2},null,8,["value","onUpdate:value"])]),e("div",qa,[Sa,c(B(me),{"file-list":be(r,"kodoblu_voice_url"),"before-upload":Re,"custom-request":i=>Pe(i,r,"kodoblu_voice_url"),accept:"audio/*","max-count":1,"show-upload-list":!1,onRemove:()=>_e(r,"kodoblu_voice_url")},{default:w(()=>[c(o,{type:"dashed"},{default:w(()=>[c(G,{icon:"vuesax-linear:voice-cricle",class:"ml-1"}),F(" آپلود وویس کدوبلو ")]),_:1})]),_:2},1032,["file-list","custom-request","onRemove"]),ee(r,"kodoblu_voice_url")>0&&ee(r,"kodoblu_voice_url")<100?(k(),$("div",$a,[e("div",Ua,[e("div",{class:"h-2 bg-blue-500 transition-all",style:xe(fe(ee(r,"kodoblu_voice_url")))},null,4)])])):M("",!0),Se(r,"kodoblu_voice_url",t.kodoblu_voice_url)?(k(),$("div",Aa,[e("div",Ca,[Ia,c(o,{type:"text",danger:"",size:"small",onClick:i=>_e(r,"kodoblu_voice_url")},{default:w(()=>[F(" حذف فایل ")]),_:2},1032,["onClick"])]),(k(),$("audio",{key:ae(r,"kodoblu_voice_url",t.kodoblu_voice_url),src:ae(r,"kodoblu_voice_url",t.kodoblu_voice_url),controls:"",preload:"metadata",class:"w-full"},null,8,Ra))])):M("",!0),c(y,{value:t.kodoblu_voice_url,"onUpdate:value":i=>t.kodoblu_voice_url=i,placeholder:"مسیر وویس کدوبلو (پس از آپلود)"},null,8,["value","onUpdate:value"])]),e("div",null,[Pa,c(B(me),{"file-list":ye(r),"list-type":"picture-card","before-upload":Ie,"custom-request":i=>ot(i,r),accept:"image/*",onRemove:i=>Ye(r,i)},{default:w(()=>[ye(r).length<8?(k(),$("div",La,[c(G,{icon:"vuesax-linear:image",class:"text-xl mb-1"}),Ma])):M("",!0)]),_:2},1032,["file-list","custom-request","onRemove"])]),Da,e("div",Ba,[Ta,e("div",Fa,[e("label",Ea,[c(L,{value:t.enable_feedback_text,"onUpdate:value":i=>t.enable_feedback_text=i},null,8,["value","onUpdate:value"]),Oa]),e("label",Na,[c(L,{value:t.require_feedback_text,"onUpdate:value":i=>t.require_feedback_text=i,disabled:!t.enable_feedback_text},null,8,["value","onUpdate:value","disabled"]),za]),e("label",ja,[c(L,{value:t.enable_photo_upload,"onUpdate:value":i=>t.enable_photo_upload=i},null,8,["value","onUpdate:value"]),Ha]),e("label",Wa,[c(L,{value:t.require_photo_upload,"onUpdate:value":i=>t.require_photo_upload=i,disabled:!t.enable_photo_upload},null,8,["value","onUpdate:value","disabled"]),Ja]),e("label",Va,[c(L,{value:t.enable_voice_upload,"onUpdate:value":i=>t.enable_voice_upload=i},null,8,["value","onUpdate:value"]),Ka]),e("label",Xa,[c(L,{value:t.require_voice_upload,"onUpdate:value":i=>t.require_voice_upload=i,disabled:!t.enable_voice_upload},null,8,["value","onUpdate:value","disabled"]),Ga]),e("label",Qa,[c(L,{value:t.enable_mcq,"onUpdate:value":i=>t.enable_mcq=i},null,8,["value","onUpdate:value"]),Ya]),e("label",Za,[c(L,{value:t.require_mcq,"onUpdate:value":i=>t.require_mcq=i,disabled:!t.enable_mcq},null,8,["value","onUpdate:value","disabled"]),eo]),e("label",to,[c(L,{value:t.enable_audio_section,"onUpdate:value":i=>t.enable_audio_section=i},null,8,["value","onUpdate:value"]),so])]),t.enable_mcq?(k(),$("div",ao,[c(y,{value:t.mcq_question,"onUpdate:value":i=>t.mcq_question=i,placeholder:"متن سوال"},null,8,["value","onUpdate:value"]),(k(!0),$(ke,null,qe(t.mcq_options,(i,S)=>(k(),$("div",{key:S,class:"flex gap-2 items-center"},[c(y,{value:t.mcq_options[S],"onUpdate:value":z=>t.mcq_options[S]=z,placeholder:`گزینه ${S+1}`,class:"flex-1"},null,8,["value","onUpdate:value","placeholder"]),e("input",{type:"radio",name:`mcq-${r}`,checked:t.mcq_correct_index===S,onChange:z=>t.mcq_correct_index=S},null,40,oo),lo,t.mcq_options.length>2?(k(),ze(o,{key:0,danger:"",onClick:z=>t.mcq_options.splice(S,1)},{default:w(()=>[F("×")]),_:2},1032,["onClick"])):M("",!0)]))),128)),c(o,{type:"dashed",onClick:i=>t.mcq_options.push("")},{default:w(()=>[F("+ گزینه")]),_:2},1032,["onClick"])])):M("",!0),t.enable_audio_section?(k(),$("div",no,[io,c(B(me),{"file-list":be(r,"audio_section_url"),"before-upload":Re,"custom-request":i=>Pe(i,r,"audio_section_url"),accept:"audio/*","max-count":1,"show-upload-list":!1,onRemove:()=>_e(r,"audio_section_url")},{default:w(()=>[c(o,{type:"dashed"},{default:w(()=>[c(G,{icon:"vuesax-linear:voice-cricle",class:"ml-1"}),F(" آپلود فایل صوتی ")]),_:1})]),_:2},1032,["file-list","custom-request","onRemove"]),ee(r,"audio_section_url")>0&&ee(r,"audio_section_url")<100?(k(),$("div",ro,[e("div",co,[e("div",{class:"h-2 bg-blue-500 transition-all",style:xe(fe(ee(r,"audio_section_url")))},null,4)])])):M("",!0),Se(r,"audio_section_url",t.audio_section_url)?(k(),$("div",uo,[e("div",_o,[po,c(o,{type:"text",danger:"",size:"small",onClick:i=>_e(r,"audio_section_url")},{default:w(()=>[F(" حذف فایل ")]),_:2},1032,["onClick"])]),(k(),$("audio",{key:ae(r,"audio_section_url",t.audio_section_url),src:ae(r,"audio_section_url",t.audio_section_url),controls:"",preload:"metadata",class:"w-full"},null,8,mo))])):M("",!0),c(y,{value:t.audio_section_url,"onUpdate:value":i=>t.audio_section_url=i,placeholder:"مسیر فایل صوتی (پس از آپلود)"},null,8,["value","onUpdate:value"])])):M("",!0)]),e("div",vo,[c(o,{type:"text",danger:"",onClick:i=>tt(r),disabled:q.value.steps.length<=1},{default:w(()=>[c(G,{icon:"vuesax-linear:trash",color:"#DC2626"}),fo]),_:2},1032,["onClick","disabled"])])],2))),128)),c(o,{type:"dashed",onClick:et,class:"w-full"},{default:w(()=>[ho]),_:1})])])])]),_:1},8,["visible","title","confirmLoading"]),c(Ts,{visible:U.value,"onUpdate:visible":s[9]||(s[9]=t=>U.value=t),"user-challenge-id":x.value},null,8,["visible","user-challenge-id"])]),_:1})])}}});const al=Lt(go,[["__scopeId","data-v-eb109272"]]);export{al as default};