import{_ as T}from"./Djeg5oYd.js";import{_ as D}from"./Ba76BwjT.js";import{u as V}from"./DuJ0NDcC.js";import{e as E,j as L,v as M,c as i,a as t,b as c,f as d,t as r,F as f,r as x,i as u,E as Q,o as n,d as _,H as R,w as $,h as F,G as S,_ as j}from"./DpdQcRr7.js";import"./D1zzHZdQ.js";import"./BcpEzrWT.js";const G={class:"quests-page"},O={class:"page-header"},H={class:"container"},J={class:"header-content"},P={class:"header-icon"},Y={class:"container"},z={key:0,class:"box has-text-centered py-6"},K={key:1,class:"box has-text-centered py-6"},W={class:"has-text-danger"},X={key:2,class:"units-container"},Z={class:"unit-header"},ss={class:"unit-title-wrapper"},ts={class:"unit-badge"},es={class:"unit-info"},os={class:"unit-title"},ns={class:"unit-description"},is={class:"unit-status"},as={key:0,class:"tag is-success"},cs={key:1,class:"tag is-light"},rs={key:0,class:"unit-content"},ls={key:0,class:"no-quests"},ds={key:1},us={class:"quests-grid"},_s={key:0,class:"show-more"},hs={key:1,class:"locked-panel"},ps={class:"locked-content"},ms={class:"locked-message"},q=3,ks=E({__name:"index",setup(ys){const h=[{key:"A",title:"ワールド・エディター",description:"既存変数の数値を書き換え、世界のルールを変える",requiredUnit:null},{key:"B",title:"アイテム・メーカー",description:"新しい要素をゲームに追加する",requiredUnit:"A"},{key:"C",title:"プログラミング・ラボ",description:"Java基礎文法をミニゲーム形式で学ぶ",requiredUnit:"B"},{key:"D",title:"マジック・コーダー",description:"複数要素が絡み合うシステムを自作",requiredUnit:"C"},{key:"E",title:"Modパック・リリース",description:"jarファイルへの書き出しと配布",requiredUnit:"D"}],w=u(new Set(["A"])),k=u([]),p=u(!1),l=u(null),U=async()=>{var e;p.value=!0,l.value=null;try{const o=await V("/api/user/quests",{method:"GET",params:{offset:0,limit:100}});o&&(k.value=o.items)}catch(s){console.error("Fetch quests error:",s),l.value=((e=s.data)==null?void 0:e.detail)||"予期せぬエラーが発生しました"}finally{p.value=!1}};L(()=>{U()});const m=S(()=>{const e={};for(const s of h)e[s.key]=k.value.filter(o=>o.unit===s.key);return e}),b=e=>(m.value[e]||[]).slice(0,q),y=e=>{const s=m.value[e]||[];return Math.max(0,s.length-q)},v=e=>w.value.has(e),C=e=>{if(!e)return null;const s=h.find(o=>o.key===e);return s?`ユニット${s.key}: ${s.title}`:null},I=M(),B=e=>{I.push(`/user/quests/${e}`)};return(e,s)=>{const o=Q("Icon"),N=T,A=D;return n(),i("div",G,[t("div",O,[t("div",H,[t("div",J,[t("div",P,[c(o,{icon:"mdi:treasure-chest",width:64,height:64})]),s[0]||(s[0]=t("div",{class:"header-text"},[t("h1",{class:"title is-2 mb-2"},"クエスト一覧"),t("p",{class:"subtitle is-5"}," 基礎から応用まで、段階的にMOD開発を学習しましょう ")],-1))])])]),t("div",Y,[d(p)?(n(),i("div",z,[c(o,{icon:"mdi:loading",width:64,height:64,class:"has-text-primary rotating"}),s[1]||(s[1]=t("p",{class:"has-text-grey mt-3"},"クエストを読み込み中...",-1))])):d(l)?(n(),i("div",K,[c(o,{icon:"mdi:alert-circle",width:64,height:64,class:"has-text-danger mb-3"}),t("p",W,r(d(l)),1)])):(n(),i("div",X,[(n(),i(f,null,x(h,a=>t("div",{key:a.key,class:"unit-section"},[t("div",Z,[t("div",ss,[t("span",ts,r(a.key),1),t("div",es,[t("h2",os,r(a.title),1),t("p",ns,r(a.description),1)])]),t("div",is,[v(a.key)?(n(),i("span",as,[c(o,{icon:"mdi:lock-open-variant",class:"mr-1"}),s[2]||(s[2]=_(" アンロック済み ",-1))])):(n(),i("span",cs,[c(o,{icon:"mdi:lock",class:"mr-1"}),s[3]||(s[3]=_(" ロック中 ",-1))]))])]),v(a.key)?(n(),i("div",rs,[d(m)[a.key].length===0?(n(),i("div",ls,[...s[4]||(s[4]=[t("p",{class:"has-text-grey"},"このユニットにはまだクエストがありません",-1)])])):(n(),i("div",ds,[t("div",us,[(n(!0),i(f,null,x(b(a.key),g=>(n(),R(N,{key:g.id,quest:g,onClick:B},null,8,["quest"]))),128))]),y(a.key)>0?(n(),i("div",_s,[c(A,{to:`/user/quests/unit/${a.key}`,class:"button is-light"},{default:$(()=>[c(o,{icon:"mdi:arrow-right",class:"mr-1"}),_(" さらに "+r(y(a.key))+" 件を表示 ",1)]),_:2},1032,["to"])])):F("",!0)]))])):(n(),i("div",hs,[t("div",ps,[c(o,{icon:"mdi:lock",width:48,height:48,class:"locked-icon"}),t("p",ms,[t("strong",null,r(C(a.requiredUnit)),1),s[5]||(s[5]=_("をクリアすると解放されます ",-1))])])]))])),64))]))])])}}}),Us=j(ks,[["__scopeId","data-v-6722a647"]]);export{Us as default};
