import{_ as g}from"./Ba76BwjT.js";import{_ as v}from"./Djeg5oYd.js";import{u as y}from"./DuJ0NDcC.js";import{e as k,j as b,v as w,c as a,a as s,b as i,w as q,f as r,t as C,F as B,r as I,i as u,E,o as e,H as N,_ as Q}from"./DpdQcRr7.js";import"./D1zzHZdQ.js";import"./BcpEzrWT.js";const F={class:"unit-page"},L={class:"page-header"},R={class:"container"},T={class:"header-content"},V={class:"container"},j={key:0,class:"box has-text-centered py-6"},A={key:1,class:"box has-text-centered py-6"},D={class:"has-text-danger"},G={key:2,class:"box has-text-centered py-6"},H={key:3,class:"quests-grid"},J=k({__name:"index",setup(M){const l=u([]),d=u(!1),c=u(null),p=async()=>{var n;d.value=!0,c.value=null;try{const t=await y("/api/user/quests",{method:"GET",params:{offset:0,limit:100}});t&&(l.value=t.items.filter(o=>o.unit==="C"))}catch(t){c.value=((n=t.data)==null?void 0:n.detail)||"予期せぬエラーが発生しました"}finally{d.value=!1}};b(()=>p());const h=w(),m=n=>h.push(`/user/quests/${n}`);return(n,t)=>{const o=E("Icon"),f=g,x=v;return e(),a("div",F,[s("div",L,[s("div",R,[s("div",T,[i(f,{to:"/user/quests",class:"back-link"},{default:q(()=>[i(o,{icon:"mdi:arrow-left",width:24,height:24})]),_:1}),t[0]||(t[0]=s("span",{class:"unit-badge"},"C",-1)),t[1]||(t[1]=s("div",{class:"header-text"},[s("h1",{class:"title is-2 mb-2"},"プログラミング・ラボ"),s("p",{class:"subtitle is-5"},"Java基礎文法をミニゲーム形式で学ぶ")],-1))])])]),s("div",V,[r(d)?(e(),a("div",j,[i(o,{icon:"mdi:loading",width:64,height:64,class:"has-text-primary rotating"}),t[2]||(t[2]=s("p",{class:"has-text-grey mt-3"},"クエストを読み込み中...",-1))])):r(c)?(e(),a("div",A,[i(o,{icon:"mdi:alert-circle",width:64,height:64,class:"has-text-danger mb-3"}),s("p",D,C(r(c)),1)])):r(l).length===0?(e(),a("div",G,[i(o,{icon:"mdi:alert-circle-outline",width:64,height:64,class:"has-text-grey-light mb-3"}),t[3]||(t[3]=s("p",{class:"has-text-grey"},"このユニットにはまだクエストがありません",-1))])):(e(),a("div",H,[(e(!0),a(B,null,I(r(l),_=>(e(),N(x,{key:_.id,quest:_,onClick:m},null,8,["quest"]))),128))]))])])}}}),U=Q(J,[["__scopeId","data-v-daf86659"]]);export{U as default};
