@xcpcio/board-app 0.43.0 → 0.44.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/dist/404.html +1 -1
  2. package/dist/assets/Board-4e99f3b0.js +3 -0
  3. package/dist/assets/{Board-78c68c35.css → Board-916a327e.css} +1 -1
  4. package/dist/assets/DataSourceInput.vue_vue_type_script_setup_true_lang-6f721c51.js +1 -0
  5. package/dist/assets/{TheInput.vue_vue_type_script_setup_true_lang-9cd306c7.js → TheInput.vue_vue_type_script_setup_true_lang-2baa4cb9.js} +1 -1
  6. package/dist/assets/_...all_-43e0e546.js +1 -0
  7. package/dist/assets/_name_-0c7a5e9a.js +1 -0
  8. package/dist/assets/{about-8408eddf.js → about-8e75730a.js} +1 -1
  9. package/dist/assets/board-1c696495.js +1 -0
  10. package/dist/assets/{board-layout-db1006f7.js → board-layout-a459854f.js} +1 -1
  11. package/dist/assets/{headless-4685ba2c.js → headless-a892fa96.js} +1 -1
  12. package/dist/assets/{home-649aa1f3.js → home-7372e007.js} +1 -1
  13. package/dist/assets/{index-a4eda403.js → index-07dee158.js} +66 -66
  14. package/dist/assets/index-514de2ad.js +1 -0
  15. package/dist/assets/index-cdc3411c.js +1 -0
  16. package/dist/assets/{index-layout-f67288b7.js → index-layout-d26ccb52.js} +1 -1
  17. package/dist/assets/query-059e99b1.js +1 -0
  18. package/dist/assets/{test-838ba8f2.js → test-2e2b5680.js} +1 -1
  19. package/dist/assets/{user-f204821f.js → user-6d6fe1a1.js} +1 -1
  20. package/dist/assets/{virtual_pwa-register-53ed75bd.js → virtual_pwa-register-7a6bd0e7.js} +1 -1
  21. package/dist/index.html +1 -1
  22. package/dist/sw.js +1 -1
  23. package/package.json +3 -3
  24. package/src/auto-imports.d.ts +3 -0
  25. package/src/components/board/Board.vue +10 -0
  26. package/src/components/board/OptionsModal.vue +9 -2
  27. package/src/composables/query.ts +8 -0
  28. package/dist/assets/Board-5ab7c967.js +0 -3
  29. package/dist/assets/DataSourceInput.vue_vue_type_script_setup_true_lang-ae8a0f7c.js +0 -1
  30. package/dist/assets/_...all_-b536c4f8.js +0 -1
  31. package/dist/assets/_name_-73ea91e2.js +0 -1
  32. package/dist/assets/board-d5243ade.js +0 -1
  33. package/dist/assets/index-41b501c0.js +0 -1
  34. package/dist/assets/index-4339f7e3.js +0 -1
  35. package/dist/assets/useQueryBoardData-93b68e58.js +0 -1
@@ -1 +0,0 @@
1
- import{_}from"./TheInput.vue_vue_type_script_setup_true_lang-9cd306c7.js";import{J as p,g as f,u as h,i as g,K as S,G as b,l as o,o as v,c as y,d as t,b as x,H as U,I as V,t as u,m as w}from"./index-a4eda403.js";function I(){return p("data-source","",{transform:String})}const R={key:0,class:"flex flex-col items-center"},k={"w-128":""},D=t("div",{"py-2":""},null,-1),K=["disabled"],l="Data Source URL",T=f({__name:"DataSourceInput",setup(B){const{t:r}=h(),a=I(),e=g(a.value),c=S(),d=b();function s(){d.push(`${c.fullPath}/?data-source=${e.value.trim()}`)}return(C,n)=>{const i=_;return o(a).length===0?(v(),y("div",R,[t("div",k,[x(i,{modelValue:o(e),"onUpdate:modelValue":n[0]||(n[0]=m=>U(e)?e.value=m:null),"w-full":"",placeholder:l,autocomplete:"false",onKeydown:V(s,["enter"])},null,8,["modelValue","onKeydown"]),t("label",{class:"hidden",for:"input"},u(l))]),D,t("div",null,[t("button",{"m-3":"","text-sm":"",btn:"",disabled:o(e).length===0,onClick:s},u(o(r)("button.go")),9,K)])])):w("",!0)}}});export{T as _,I as g};
@@ -1 +0,0 @@
1
- import{_ as v}from"./Board-5ab7c967.js";import{g as p,G as h,u as l,r as y,o as c,c as a,d as r,t as i,l as n,b as _,N as B,O as m,K as N,q as u}from"./index-a4eda403.js";import"./TheInput.vue_vue_type_script_setup_true_lang-9cd306c7.js";import"./useQueryBoardData-93b68e58.js";const g=p({__name:"GoBack",setup(d){const s=h(),{t}=l();return(f,o)=>{const e=y("RouterLink");return c(),a("div",null,[r("div",{class:"m-3 text-sm btn",onClick:o[0]||(o[0]=k=>n(s).back())},i(n(t)("button.back")),1),_(e,{class:"m-3 text-sm btn",to:"/"},{default:B(()=>[m(i(n(t)("button.home")),1)]),_:1})])}}}),C={key:0,class:"flex flex-col items-center"},R=r("div",{"text-4xl":""},[r("div",{"i-carbon-warning":""})],-1),G={key:1},T=p({__name:"[...all]",setup(d){const{t:s}=l(),t=N(),o=!["camp","icpc","ccpc","provincial-contest"].some(e=>t.fullPath.startsWith(`/${e}`));return(e,k)=>{const x=g,b=v;return o?(c(),a("div",C,[R,m(" "+i(n(s)("not-found"))+" ",1),_(x)])):(c(),a("div",G,[_(b)]))}}});typeof u=="function"&&u(T);export{T as default};
@@ -1 +0,0 @@
1
- import{g as d,G as _,u as f,aR as k,r as x,o as a,c as r,d as e,t as n,l as t,F as h,D as b,b as y,N,O as v,m as C}from"./index-a4eda403.js";import{u as g}from"./user-f204821f.js";const w={"w-full":"",flex:"","flex-col":"","justify-center":"","items-center":""},R=e("div",{"text-4xl":""},[e("div",{"i-carbon-pedestrian":"","inline-block":""})],-1),V={"text-sm":"","opacity-75":""},B={key:0,"mt-4":"","text-sm":""},L={"opacity-75":""},S=d({__name:"[name]",props:{name:null},setup(u){const c=u,m=_(),i=g(),{t:o}=f();return k(()=>{i.setNewName(c.name)}),(D,l)=>{const p=x("RouterLink");return a(),r("div",w,[R,e("p",null,n(t(o)("intro.hi",{name:c.name})),1),e("p",V,[e("em",null,n(t(o)("intro.dynamic-route")),1)]),t(i).otherNames.length?(a(),r("p",B,[e("span",L,n(t(o)("intro.aka"))+":",1),e("ul",null,[(a(!0),r(h,null,b(t(i).otherNames,s=>(a(),r("li",{key:s},[y(p,{to:`/hi/${s}`,replace:""},{default:N(()=>[v(n(s),1)]),_:2},1032,["to"])]))),128))])])):C("",!0),e("div",null,[e("button",{m:"3 t6","text-sm":"",btn:"",onClick:l[0]||(l[0]=s=>t(m).back())},n(t(o)("button.back")),1)])])}}});export{S as default};
@@ -1 +0,0 @@
1
- import{_ as p}from"./Board-5ab7c967.js";import{g as l,_ as d}from"./DataSourceInput.vue_vue_type_script_setup_true_lang-ae8a0f7c.js";import{g as f,o as t,c as n,b as a,l as r,m as i,F as g,a as B,E as k,q as c}from"./index-a4eda403.js";import"./TheInput.vue_vue_type_script_setup_true_lang-9cd306c7.js";import"./useQueryBoardData-93b68e58.js";const h={key:0},x=f({__name:"CustomBoard",setup(_){const o=l();return(e,b)=>{const m=d,u=p;return t(),n(g,null,[a(m),r(o).length>0?(t(),n("div",h,[a(u,{"data-source-url":r(o)},null,8,["data-source-url"])])):i("",!0)],64)}}}),s={};function C(_,o){const e=x;return t(),k(e)}typeof c=="function"&&c(s);const N=B(s,[["render",C]]);export{N as default};
@@ -1 +0,0 @@
1
- import{g as w,s as h,i,v as L,o,c as t,l as e,n as V,d as s,x as D,t as v,m as y,h as F,B as C,u as R,w as A,j as O,y as q,z as M,A as Q,k as X,F as I,D as G,E as H,R as J,b as B,a as K,q as S}from"./index-a4eda403.js";import{u as P}from"./useQueryBoardData-93b68e58.js";import{g as W,_ as Y}from"./DataSourceInput.vue_vue_type_script_setup_true_lang-ae8a0f7c.js";import"./TheInput.vue_vue_type_script_setup_true_lang-9cd306c7.js";const Z={flex:"","flex-1":"","flex-col":"","justify-center":"","items-start":""},ee={class:"resolver-team-name",truncate:"","overflow-hidden":""},oe=s("div",{flex:"","flex-row":"","text-sm":"","items-start":"","gap-x-2":""},null,-1),te={"w-32":"",flex:"","flex-shrink-0":"","flex-row":"","justify-start":"","items-center":""},se=w({__name:"BalloonBlock",props:{index:{},balloon:{}},setup(m){const n=m,u=h(()=>n.index),a=h(()=>n.balloon),l=i(null),r=L(l);function x(c){return[c.location,c.organization,c.name].filter(k=>k).join(" - ")}const f=h(()=>a.value.problem.balloonColor);return(c,p)=>(o(),t("div",{ref_key:"el",ref:l,"h-24":""},[e(r)?(o(),t("div",{key:0,"h-24":"",flex:"","flex-row":"","gap-x-4":"","font-mono":"","text-4xl":"",class:V([e(u)%2===0?"bg-resolver-bg-zero":"bg-resolver-bg-one"])},[s("div",{"w-20":"",flex:"","flex-shrink-0":"","justify-center":"","items-center":"",style:D({backgroundColor:e(f).background_color})},[s("div",{style:D({color:e(f).color})},v(e(a).problem.label),5)],4),s("div",Z,[s("div",ee,v(x(e(a).team)),1),oe]),s("div",te,v(e(a).submission.timestampToMinute),1)],2)):y("",!0)],512))}}),ne={class:"bg-[#323443]","text-gray-200":""},ae={key:0},le={flex:"","flex-col":"","justify-center":"","items-center":"","w-screen":"","h-screen":"","text-xl":"",italic:""},re={key:0},ce={key:1},ie={flex:"","flex-col":"","justify-between":""},ue=w({__name:"Balloon",props:{dataSourceUrl:null},setup(m){const n=m,u=F(C),{t:a}=R(),l=i(!1),r=i({}),x=i([]),f=i([]),c=i({}),p=i(new Date);function k(){const d=new J(r.value,x.value,f.value);d.buildBalloons(),c.value=d}const{data:_,isError:N,error:T}=P(n.dataSourceUrl,p);A(_,async()=>{var d,g,b;_.value===null||_.value===void 0||(r.value=O((d=_.value)==null?void 0:d.contest),u.value=`${r.value.name} | ${C}`,x.value=q((g=_.value)==null?void 0:g.teams),f.value=M((b=_.value)==null?void 0:b.submissions),k(),l.value=!0)});const U=h(()=>c.value.balloons.sort(Q.compare).reverse().slice(0,256)),z=setInterval(()=>{p.value=new Date},1e3);return X(()=>{clearInterval(z)}),(d,g)=>{const b=se;return o(),t("div",ne,[e(l)?(o(),t("div",ce,[s("div",ie,[(o(!0),t(I,null,G(e(U),($,E)=>(o(),H(b,{key:$.key,index:E,balloon:$},null,8,["index","balloon"]))),128))])])):(o(),t("div",ae,[s("div",le,[s("div",null,v(e(a)("common.loading"))+"... ",1),e(N)?(o(),t("div",re,v(e(T)),1)):y("",!0)])]))])}}}),_e={key:0},de={"mt-20":""},me={key:1},fe=w({__name:"CustomBalloon",setup(m){const n=W();return(u,a)=>{const l=Y,r=ue;return o(),t(I,null,[e(n).length===0?(o(),t("div",_e,[s("div",de,[B(l)])])):y("",!0),e(n).length>0?(o(),t("div",me,[B(r,{"data-source-url":e(n)},null,8,["data-source-url"])])):y("",!0)],64)}}}),j={};function ve(m,n){const u=fe;return o(),t("div",null,[B(u)])}typeof S=="function"&&S(j);const ye=K(j,[["render",ve]]);export{ye as default};
@@ -1 +0,0 @@
1
- import{g as x,u as D,h as N,C as g,i as d,w as $,j as U,k as T,o,c as s,l as t,d as c,t as r,m,n as h,p as b,a as y,b as p,F as E,q as C}from"./index-a4eda403.js";import{u as B}from"./useQueryBoardData-93b68e58.js";import{g as F,_ as j}from"./DataSourceInput.vue_vue_type_script_setup_true_lang-ae8a0f7c.js";import"./TheInput.vue_vue_type_script_setup_true_lang-9cd306c7.js";const V={class:"background","text-gray-200":"","w-screen":"","h-screen":""},L={key:0},O={flex:"","flex-col":"","justify-center":"","items-center":"","w-screen":"","h-screen":"","text-xl":"",italic:""},P={key:0},q={key:1},z={flex:"","flex-col":"","items-center":"","justify-center":"","font-mono":""},G={key:0},Q={key:1},W=x({__name:"Countdown",props:{dataSourceUrl:null},setup(l){const a=l,{t:_}=D(),v=N(g),e=d(new Date),n=d({}),f=d(!1),{data:i,isError:w,error:k}=B(a.dataSourceUrl,e);$(i,async()=>{var u;i.value===null||i.value===void 0||(n.value=U((u=i.value)==null?void 0:u.contest),v.value=`${n.value.name} | ${g}`,f.value=!0)});const I=setInterval(()=>{e.value=new Date},1e3);return T(()=>{clearInterval(I)}),(u,R)=>(o(),s("div",V,[t(f)?(o(),s("div",q,[c("div",z,[c("div",{"mt-20":"","text-6xl":"",class:h([t(n).getContestState(t(e)).toString()])},r(t(n).getContestState(t(e))),3),c("div",{"mt-20":"",class:h(["text-[320px]",[t(n).getContestState(t(e)).toString()]])},[t(n).getContestState(t(e))===t(b).PENDING?(o(),s("div",G,r(t(n).getContestPendingTime(t(e))),1)):(o(),s("div",Q,r(t(n).getContestElapsedTime(t(e))),1))],2)])])):(o(),s("div",L,[c("div",O,[c("div",null,r(t(_)("common.loading"))+"... ",1),t(w)?(o(),s("div",P,r(t(k)),1)):m("",!0)])]))]))}});const X=y(W,[["__scopeId","data-v-03b5a196"]]),A={key:0},H={"mt-20":""},J={key:1},K=x({__name:"CustomCountdown",setup(l){const a=F();return(_,v)=>{const e=j,n=X;return o(),s(E,null,[t(a).length===0?(o(),s("div",A,[c("div",H,[p(e)])])):m("",!0),t(a).length>0?(o(),s("div",J,[p(n,{"data-source-url":t(a)},null,8,["data-source-url"])])):m("",!0)],64)}}}),S={};function M(l,a){const _=K;return o(),s("div",null,[p(_)])}typeof C=="function"&&C(S);const nt=y(S,[["render",M]]);export{nt as default};
@@ -1 +0,0 @@
1
- import{at as q,au as S,av as K,aw as U,ax as D,ay as B,az as W,aA as N,aB as A,aC as V,aD as z,aE as H,aF as $,aG as G,s as P,aH as J,w as b,aI as x,aJ as Y,aK as _,aL as X,aM as Z,l as C,aN as ee,aO as te}from"./index-a4eda403.js";class se extends q{constructor(e,t){super(),this.client=e,this.options=t,this.trackedProps=new Set,this.selectError=null,this.bindMethods(),this.setOptions(t)}bindMethods(){this.remove=this.remove.bind(this),this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.currentQuery.addObserver(this),k(this.currentQuery,this.options)&&this.executeFetch(),this.updateTimers())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return E(this.currentQuery,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return E(this.currentQuery,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.clearStaleTimeout(),this.clearRefetchInterval(),this.currentQuery.removeObserver(this)}setOptions(e,t){const s=this.options,n=this.currentQuery;if(this.options=this.client.defaultQueryOptions(e),S(s,this.options)||this.client.getQueryCache().notify({type:"observerOptionsUpdated",query:this.currentQuery,observer:this}),typeof this.options.enabled<"u"&&typeof this.options.enabled!="boolean")throw new Error("Expected enabled to be a boolean");this.options.queryKey||(this.options.queryKey=s.queryKey),this.updateQuery();const i=this.hasListeners();i&&L(this.currentQuery,n,this.options,s)&&this.executeFetch(),this.updateResult(t),i&&(this.currentQuery!==n||this.options.enabled!==s.enabled||this.options.staleTime!==s.staleTime)&&this.updateStaleTimeout();const u=this.computeRefetchInterval();i&&(this.currentQuery!==n||this.options.enabled!==s.enabled||u!==this.currentRefetchInterval)&&this.updateRefetchInterval(u)}getOptimisticResult(e){const t=this.client.getQueryCache().build(this.client,e),s=this.createResult(t,e);return ie(this,s,e)&&(this.currentResult=s,this.currentResultOptions=this.options,this.currentResultState=this.currentQuery.state),s}getCurrentResult(){return this.currentResult}trackResult(e){const t={};return Object.keys(e).forEach(s=>{Object.defineProperty(t,s,{configurable:!1,enumerable:!0,get:()=>(this.trackedProps.add(s),e[s])})}),t}getCurrentQuery(){return this.currentQuery}remove(){this.client.getQueryCache().remove(this.currentQuery)}refetch({refetchPage:e,...t}={}){return this.fetch({...t,meta:{refetchPage:e}})}fetchOptimistic(e){const t=this.client.defaultQueryOptions(e),s=this.client.getQueryCache().build(this.client,t);return s.isFetchingOptimistic=!0,s.fetch().then(()=>this.createResult(s,t))}fetch(e){var t;return this.executeFetch({...e,cancelRefetch:(t=e.cancelRefetch)!=null?t:!0}).then(()=>(this.updateResult(),this.currentResult))}executeFetch(e){this.updateQuery();let t=this.currentQuery.fetch(this.options,e);return e!=null&&e.throwOnError||(t=t.catch(K)),t}updateStaleTimeout(){if(this.clearStaleTimeout(),U||this.currentResult.isStale||!D(this.options.staleTime))return;const t=B(this.currentResult.dataUpdatedAt,this.options.staleTime)+1;this.staleTimeoutId=setTimeout(()=>{this.currentResult.isStale||this.updateResult()},t)}computeRefetchInterval(){var e;return typeof this.options.refetchInterval=="function"?this.options.refetchInterval(this.currentResult.data,this.currentQuery):(e=this.options.refetchInterval)!=null?e:!1}updateRefetchInterval(e){this.clearRefetchInterval(),this.currentRefetchInterval=e,!(U||this.options.enabled===!1||!D(this.currentRefetchInterval)||this.currentRefetchInterval===0)&&(this.refetchIntervalId=setInterval(()=>{(this.options.refetchIntervalInBackground||W.isFocused())&&this.executeFetch()},this.currentRefetchInterval))}updateTimers(){this.updateStaleTimeout(),this.updateRefetchInterval(this.computeRefetchInterval())}clearStaleTimeout(){this.staleTimeoutId&&(clearTimeout(this.staleTimeoutId),this.staleTimeoutId=void 0)}clearRefetchInterval(){this.refetchIntervalId&&(clearInterval(this.refetchIntervalId),this.refetchIntervalId=void 0)}createResult(e,t){const s=this.currentQuery,n=this.options,i=this.currentResult,u=this.currentResultState,a=this.currentResultOptions,l=e!==s,h=l?e.state:this.currentQueryInitialState,c=l?this.currentResult:this.previousQueryResult,{state:o}=e;let{dataUpdatedAt:d,error:R,errorUpdatedAt:m,fetchStatus:v,status:f}=o,w=!1,F=!1,y;if(t._optimisticResults){const p=this.hasListeners(),O=!p&&k(e,t),j=p&&L(e,s,t,n);(O||j)&&(v=N(e.options.networkMode)?"fetching":"paused",d||(f="loading")),t._optimisticResults==="isRestoring"&&(v="idle")}if(t.keepPreviousData&&!o.dataUpdatedAt&&c!=null&&c.isSuccess&&f!=="error")y=c.data,d=c.dataUpdatedAt,f=c.status,w=!0;else if(t.select&&typeof o.data<"u")if(i&&o.data===(u==null?void 0:u.data)&&t.select===this.selectFn)y=this.selectResult;else try{this.selectFn=t.select,y=t.select(o.data),y=A(i==null?void 0:i.data,y,t),this.selectResult=y,this.selectError=null}catch(p){this.selectError=p}else y=o.data;if(typeof t.placeholderData<"u"&&typeof y>"u"&&f==="loading"){let p;if(i!=null&&i.isPlaceholderData&&t.placeholderData===(a==null?void 0:a.placeholderData))p=i.data;else if(p=typeof t.placeholderData=="function"?t.placeholderData():t.placeholderData,t.select&&typeof p<"u")try{p=t.select(p),this.selectError=null}catch(O){this.selectError=O}typeof p<"u"&&(f="success",y=A(i==null?void 0:i.data,p,t),F=!0)}this.selectError&&(R=this.selectError,y=this.selectResult,m=Date.now(),f="error");const Q=v==="fetching",g=f==="loading",I=f==="error";return{status:f,fetchStatus:v,isLoading:g,isSuccess:f==="success",isError:I,isInitialLoading:g&&Q,data:y,dataUpdatedAt:d,error:R,errorUpdatedAt:m,failureCount:o.fetchFailureCount,failureReason:o.fetchFailureReason,errorUpdateCount:o.errorUpdateCount,isFetched:o.dataUpdateCount>0||o.errorUpdateCount>0,isFetchedAfterMount:o.dataUpdateCount>h.dataUpdateCount||o.errorUpdateCount>h.errorUpdateCount,isFetching:Q,isRefetching:Q&&!g,isLoadingError:I&&o.dataUpdatedAt===0,isPaused:v==="paused",isPlaceholderData:F,isPreviousData:w,isRefetchError:I&&o.dataUpdatedAt!==0,isStale:T(e,t),refetch:this.refetch,remove:this.remove}}updateResult(e){const t=this.currentResult,s=this.createResult(this.currentQuery,this.options);if(this.currentResultState=this.currentQuery.state,this.currentResultOptions=this.options,S(s,t))return;this.currentResult=s;const n={cache:!0},i=()=>{if(!t)return!0;const{notifyOnChangeProps:u}=this.options,a=typeof u=="function"?u():u;if(a==="all"||!a&&!this.trackedProps.size)return!0;const l=new Set(a??this.trackedProps);return this.options.useErrorBoundary&&l.add("error"),Object.keys(this.currentResult).some(h=>{const c=h;return this.currentResult[c]!==t[c]&&l.has(c)})};(e==null?void 0:e.listeners)!==!1&&i()&&(n.listeners=!0),this.notify({...n,...e})}updateQuery(){const e=this.client.getQueryCache().build(this.client,this.options);if(e===this.currentQuery)return;const t=this.currentQuery;this.currentQuery=e,this.currentQueryInitialState=e.state,this.previousQueryResult=this.currentResult,this.hasListeners()&&(t==null||t.removeObserver(this),e.addObserver(this))}onQueryUpdate(e){const t={};e.type==="success"?t.onSuccess=!e.manual:e.type==="error"&&!V(e.error)&&(t.onError=!0),this.updateResult(t),this.hasListeners()&&this.updateTimers()}notify(e){z.batch(()=>{if(e.onSuccess){var t,s,n,i;(t=(s=this.options).onSuccess)==null||t.call(s,this.currentResult.data),(n=(i=this.options).onSettled)==null||n.call(i,this.currentResult.data,null)}else if(e.onError){var u,a,l,h;(u=(a=this.options).onError)==null||u.call(a,this.currentResult.error),(l=(h=this.options).onSettled)==null||l.call(h,void 0,this.currentResult.error)}e.listeners&&this.listeners.forEach(({listener:c})=>{c(this.currentResult)}),e.cache&&this.client.getQueryCache().notify({query:this.currentQuery,type:"observerResultsUpdated"})})}}function re(r,e){return e.enabled!==!1&&!r.state.dataUpdatedAt&&!(r.state.status==="error"&&e.retryOnMount===!1)}function k(r,e){return re(r,e)||r.state.dataUpdatedAt>0&&E(r,e,e.refetchOnMount)}function E(r,e,t){if(e.enabled!==!1){const s=typeof t=="function"?t(r):t;return s==="always"||s!==!1&&T(r,e)}return!1}function L(r,e,t,s){return t.enabled!==!1&&(r!==e||s.enabled===!1)&&(!t.suspense||r.state.status!=="error")&&T(r,t)}function T(r,e){return r.isStaleByTime(e.staleTime)}function ie(r,e,t){return t.keepPreviousData?!1:t.placeholderData!==void 0?e.isPlaceholderData:!S(r.getCurrentResult(),e)}function ne(r=""){var e;if(!((e=H())==null?void 0:e.proxy))throw new Error("vue-query hooks can only be used inside setup() function.");const s=G(r),n=$(s);if(!n)throw new Error("No 'queryClient' found in Vue context, use 'VueQueryPlugin' to properly initialize the library.");return n}function ue(r,e,t={},s={}){var n;const i=P(()=>ae(e,t,s)),u=(n=i.value.queryClient)!=null?n:ne(i.value.queryClientKey),a=P(()=>{const d=u.defaultQueryOptions(i.value);return d._optimisticResults=u.isRestoring.value?"isRestoring":"optimistic",d}),l=new r(u,a.value),h=J(l.getCurrentResult());let c=()=>{};b(u.isRestoring,d=>{d||(c(),c=l.subscribe(R=>{x(h,R)}))},{immediate:!0}),b(a,()=>{l.setOptions(a.value),x(h,l.getCurrentResult())}),Y(()=>{c()});const o=()=>new Promise((d,R)=>{let m=()=>{};const v=()=>{if(a.value.enabled!==!1){const f=l.getOptimisticResult(a.value);f.isStale?(m(),l.fetchOptimistic(a.value).then(d,R)):(m(),d(f))}};v(),m=b(a,v,{deep:!0})});return b(()=>h.error,d=>{if(h.isError&&!h.isFetching&&_(a.value.useErrorBoundary,[d,l.getCurrentQuery()]))throw d}),{...X(Z(h)),suspense:o}}function ae(r,e={},t={}){const s=C(r),n=C(e),i=C(t);let u=s;return ee(s)?typeof n=="function"?u={...i,queryKey:s,queryFn:n}:u={...n,queryKey:s}:u=s,te(u)}function ce(r,e,t){const s=ue(se,r,e,t);return{...s,refetch:s.refetch.value,remove:s.remove.value}}const le=3,M=30*1e3;async function oe(r,e){const t=r.startsWith("/")?r.slice(1):r;let s=`${window.DATA_HOST}${t}`;r.startsWith("http")&&(s=r),s.endsWith("/")&&(s=s.slice(0,-1));const n=await fetch(`${s}/config.json?t=${e??0}`),i=await fetch(`${s}/team.json?t=${e??0}`),u=await fetch(`${s}/run.json?t=${e??0}`),{status:a,statusText:l}=n;if(a>=300||a<200)throw new Error(`fetch data failed. [status=${a}] [statusText=${l}]`);return Promise.all([n.json(),i.json(),u.json()]).then(c=>({contest:c[0],teams:c[1],submissions:c[2]}))}function fe(r,e){return ce({queryKey:[r,e.value.getTime()],queryFn:()=>oe(r,e.value.getTime()),retry:le,staleTime:M,refetchInterval:M})}export{fe as u};