1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/browser-4TgWC70o.js","assets/_commonjsHelpers-_d1bhYXs.js"])))=>i.map(i=>d[i]); 2import{r as w,C as Ie,m as b,E as i,k as a,X as Q,F as W,l as u,Y as r,L as N,av as ce,N as G,O as K,aw as me,ao as Qt,c as M,w as Me,q as A,y as F,j,a2 as Dt,t as te,a0 as ae,v as C,x as fe,ax as Jt,i as ct,S as Te,D as ie,W as Nn,ay as Xt,ab as ut,M as Zt,a1 as Pe,T as vt,ad as $t,Q as Ze,R as Ae,az as Ln,ae as lt,aj as Bn,a6 as zn,au as Gn,G as Ot,I as jn,J as qn,K as Fe,a8 as Rt,p as Ft}from"./vuetify-CkRlhSTd.js";import{w as en,u as tn,a as Hn,b as Wn,c as dt,p as Kn,h as Ut,_ as Yn,d as Qn,e as Jn,r as nn,S as pt,A as on,f as Xn,B as Zn,g as $n,i as eo,j as to,k as no,l as oo,s as st}from"./useDownload-BZwzWvkY.js";import{a as Le,_ as ye,r as ao,i as an,j as lo,k as so,l as io,m as ro,n as co,o as uo,p as fo,U as mo,e as vo,P as po,q as ho,u as go,b as yo}from"./index-CJfJ07H0.js";import{d as bo,i as ko,e as wo,f as So,h as _o,j as Co,k as Eo,l as Vo,m as xo,n as Ao,o as To,p as Po,q as Io,r as Mt,u as Do}from"./buildService-DDppbctK.js";import{a as ht,h as Ue,g as qe,t as He,b as Oo,p as ft,f as gt,s as Qe,c as Ro,r as yt,d as Nt,e as Fo,A as ln,i as $e,j as Uo,k as Mo,l as No}from"./useAgeTimings-uykiRw58.js";import{A as Lo}from"./AgeChips-DiEeGQWy.js";import{u as Bo,t as zo}from"./useTimeSince-BkSEspr8.js";import{i as Go,d as jo,a as qo}from"./contributorService-DWK21t8c.js";import{u as Ho}from"./useCopyToClipboard-BQdg6RbG.js";import"./firebase-DN9Njj_A.js";import"./_commonjsHelpers-_d1bhYXs.js";import"./configDefaultProvider-dhjSwhib.js";const Wo="Please verify your email address to use this feature.",
2Ko="Please choose a display name first.";function et(){const t=Le();function n(){var o;return t.state.profileIncomplete?(t.dispatch("showSnackbar",{text:Ko,type:"warning"}),t.commit("setAuthDialog",{visible:!0,mode:"complete-profile"}),!1):(o=t.state.user)!=null&&o.emailVerified?!0:(t.dispatch("showSnackbar",{text:Wo,type:"warning"}),!1)}return{assertVerified:n}}const Yo={name:"Favorites",props:["buildId","modelValue"],emits:["favoriteRemoved","favoriteAdded"],setup(t,n){var f;const o=w((f=t.modelValue)==null?void 0:f.uid),e=Le(),{assertVerified:p}=et(),v=w(!1);return Ie(async()=>{const m=t.modelValue;o.value=m==null?void 0:m.id,v.value=m.favorites.includes(t.buildId)}),{props:t,isFavorite:v,addToFavorites:async()=>{if(!p())return;const m=30;var d=0;d=(await an(o.value)).favorites.length,d>=m?await e.dispatch("showSnackbar",{text:"Oh, no! Villagers can only gather up to 30 favorites at a time. Please, remove some of your old favorites, first.",type:"error"}):(ko(t.buildId),lo(o.value,t.buildId),v.value=!v.value,e.commit("setMyFavoritesList",null),n.emit("favoriteAdded"))},removeFromFavorites:async()=>{bo(t.buildId),ao(o.value,t.buildId),v.value=!v.value,e.commit("setMyFavoritesList",null),n.emit("favoriteRemoved")}}}};function Qo(t,n,o,e,p,v){return u(),b(W,null,[i(Q,{location:"top"},{activator:a(({props:l})=>[ce(i(G,K({onClick:e.addToFavorites},l,{color:"accent",variant:"text",icon:"mdi-heart-outline"}),null,16,["onClick"]),[[me,!e.isFavorite]])]),default:a(()=>[r("span",{style:N({color:t.$vuetify.theme.current.colors.primary})},"Add to Favorites",4)]),_:1}),i(Q,{location:"top"},{activator:a(({props:l})=>[ce(i(G,K({onClick:e.removeFromFavorites},l,{color:"accent",variant:"text",icon:"mdi-heart"}),null,16,["onClick"]),[[me,e.isFavorite]])]),default:a(()=>[r("span",{style:N({color:t.$vuetify.theme.current.colors.primary})},"Remove from Favorites",4)]),_:1})],64)}const Jo=ye(Yo,[["render",Qo]]),J={},Ee=typeof globalThis>"u"?window:globalThis,T={status:"created"},Y={};J.debug=t=>{be=typeof t=="function"?t:()=>{}};let be=()=>{};J.detect=()=>sn();const sn=()=>{const t={};["speechSynthesis","speechSynthesisUtterance","speechSynthesisVoice","speechSynthesisEvent","speechSynthesisErrorEvent"].forEach(o=>{t[o]=oa(o)}),t.onvoiceschanged=Je(t.speechSynthesis,"onvoiceschanged");const n=Je(t.speechSynthesisUtterance,"prototype");return kt.forEach(o=>{const e=`on${o}`;t[e]=n&&Je(t.speechSynthesisUtterance.prototype,e)}),Y.isAndroid=Xo(),Y.isFirefox=$o()||Zo(),Y.isSafari=ea(),be(`is android: ${!!Y.isAndroid}`),be(`is firefox: ${!!Y.isFirefox}`),be(`is safari: ${!!Y.isSafari}`),t},Je=(t={},n)=>Object.hasOwnProperty.call(t,n)||n in t||!!t[n],bt=()=>(Ee.navigator||{}).userAgent||"",Xo=()=>/android/i.test(bt()),Zo=()=>/kaios/i.test(bt()),$o=()=>typeof Ee.InstallTrigger<"u"?!0:/firefox/i.test(bt()),ea=()=>typeof Ee.GestureEvent<"u",ta=["webKit","moz","ms","o"],na=t=>`${t.charAt(0).toUpperCase()}${t.slice(1)}`,oa=t=>{const n=na(t),o=ta.map(p=>`${p}${n}`),e=[t,n].concat(o).find(aa);return Ee[e]},aa=t=>Ee[t];J.status=()=>({...T});J.filterVoices=({name:t,language:n,localService:o,voiceURI:e})=>{const p=T.voices||[],v=typeof t<"u",l=typeof e<"u",c=typeof o<"u",f=typeof n<"u",m=f&&n.split(/[-_]+/g)[0].toLocaleLowerCase();return p.filter(d=>{if(v&&d.name.includes(t)||l&&d.voiceURI.includes(e)||c&&d.localService===o)return!0;if(f){const k=d.lang&&d.lang.toLocaleLowerCase();return k&&(k===m||k.indexOf(`${m}-`)>-1||k.indexOf(`${m}_`)>-1)}return!1})};const re=t=>{be(t),T.status=t};J.init=function({maxTimeout:t=5e3,interval:n=250,quiet:o,maxLengthExceeded:e}={}){return new Promise((p,v)=>{if(T.initialized)return p(!1);J.reset(),re("init: start");let l,c,f=!1;T.maxLengthExceeded=e||"warn";const m=V=>(re(`init: failed (${V})`),clearInterval(l),T.initialized=!1,o?p(!1):v(new Error(`EasySpeech: ${V}`))),d=()=>{if(!f)return re("init: complete"),f=!0,T.initialized=!0,clearInterval(l),E.onvoiceschanged=null,c&&E.removeEventListener("voiceschanged",c),p(!0)},k=sn();if(!(!!k.speechSynthesis&&!!k.speechSynthesisUtterance))return m("browser misses features");
2Object.keys(k).forEach(V=>{T[V]=k[V]});const{speechSynthesis:E}=T,I=()=>{const V=E.getVoices()||[];if(V.length>0){if(T.voices=V,re(`voices loaded: ${V.length}`),T.defaultVoice=V.find(D=>D.default),!T.defaultVoice){const D=(Ee.navigator||{}).language||"",q=J.filterVoices({language:D});q.length>0&&(T.defaultVoice=q[0])}return T.defaultVoice||(T.defaultVoice=V[0]),!0}return!1};if(re("init: voices"),I())return d();const h=()=>{re("init: voices (timer)");let V=0;l=setInterval(()=>{if(I())return d();if(V>t)return m("browser has no voices (timeout)");V+=n},n)};k.onvoiceschanged?(re("init: voices (onvoiceschanged)"),E.onvoiceschanged=()=>I()?d():h(),setTimeout(()=>I()?d():m("browser has no voices (timeout)"),t)):(Je(E,"addEventListener")&&(re("init: voices (addEventListener)"),c=()=>{if(I())return d()},E.addEventListener("voiceschanged",c)),h())})};const De=({force:t}={})=>{if(!t&&!T.initialized)throw new Error("EasySpeech: not initialized. Run EasySpeech.init() first")};J.voices=()=>(De(),T.voices);J.on=t=>(De(),kt.forEach(n=>{const o=t[n];Ce.handler(o)&&(T.handlers[n]=o)}),{...T.handlers});const kt=["boundary","end","error","mark","pause","resume","start"],Ce={isNumber:t=>typeof t=="number"&&!Number.isNaN(t),pitch:t=>Ce.isNumber(t)&&t>=0&&t<=2,volume:t=>Ce.isNumber(t)&&t>=0&&t<=1,rate:t=>Ce.isNumber(t)&&t>=.1&&t<=10,text:t=>typeof t=="string",handler:t=>typeof t=="function",voice:t=>t&&t.lang&&t.name&&t.voiceURI};J.defaults=t=>(De(),t&&(T.defaults=T.defaults||{},["voice","pitch","rate","volume"].forEach(n=>{const o=t[n],e=Ce[n];e(o)&&(T.defaults[n]=o)})),{...T.defaults});const la=t=>{var n,o;return t||((n=T.defaults)==null?void 0:n.voice)||T.defaultVoice||((o=T.voices)==null?void 0:o[0])},sa=t=>{const n=T.speechSynthesisUtterance;return new n(t)};J.speak=({text:t,voice:n,pitch:o,rate:e,volume:p,force:v,infiniteResume:l,noStop:c,...f})=>{if(De({force:v}),!Ce.text(t))throw new Error("EasySpeech: at least some valid text is required to speak");if(new TextEncoder().encode(t).length>4096){const d="EasySpeech: text exceeds max length of 4096 bytes, which will not work with some voices.";switch(T.maxLengthExceeded){case"none":break;case"error":throw new Error(d);case"warn":default:console.warn(d)}}const m=d=>{var E;const[k,S]=Object.entries(d)[0];return Ce[k](S)?S:(E=T.defaults)==null?void 0:E[k]};return new Promise((d,k)=>{re("init speak");const S=sa(t),E=la(n);E&&(S.voice=E,S.lang=E.lang,S.voiceURI=E.voiceURI),S.text=t,S.pitch=m({pitch:o}),S.rate=m({rate:e}),S.volume=m({volume:p});const I=S.voice&&S.voice.name&&S.voice.name.toLocaleLowerCase().includes("(natural)");ia(S,{isMsNatural:I}),kt.forEach(h=>{var D;const V=f[h];Ce.handler(V)&&S.addEventListener(h,V),(D=T.handlers)!=null&&D[h]&&S.addEventListener(h,T.handlers[h])}),S.addEventListener("start",()=>{Y.paused=!1,Y.speaking=!0;const h=!I&&!Y.isFirefox&&!Y.isSafari&&Y.isAndroid!==!0;(typeof l=="boolean"?l:h)&&rn(S)}),S.addEventListener("end",h=>{re("speak complete"),Y.paused=!1,Y.speaking=!1,clearTimeout(Ne),d(h)}),S.addEventListener("error",(h={})=>{re(`speak failed: ${h.message}`),Y.paused=!1,Y.speaking=!1,clearTimeout(Ne),k(h)}),clearTimeout(Ne),c!==!0&&T.speechSynthesis.cancel(),setTimeout(()=>T.speechSynthesis.speak(S),10)})};const ia=({voice:t,pitch:n,rate:o,volume:e},{isMsNatural:p=!1}={})=>{be(`utterance: voice=${t==null?void 0:t.name} volume=${e} rate=${o} pitch=${n} isMsNatural=${p}`)};let Ne;function rn(t){if(!t&&Ne)return be("force-clear timeout"),Ee.clearTimeout(Ne);const{paused:n,speaking:o}=T.speechSynthesis,e=o||Y.speaking,p=n||Y.paused;be(`resumeInfinity isSpeaking=${e} isPaused=${p}`),e&&!p&&(T.speechSynthesis.pause(),T.speechSynthesis.resume()),Ne=Ee.setTimeout(function(){rn(t)},5e3)}J.cancel=()=>{De(),re("cancelling"),T.speechSynthesis.cancel(),Y.paused=!1,Y.speaking=!1};J.resume=()=>{De(),re("resuming"),Y.paused=!1,Y.speaking=!0,T.speechSynthesis.resume()};J.pause=()=>{if(De(),re("pausing"),Y.isAndroid)return be("patch pause on Android with cancel"),T.speechSynthesis.cancel();T.speechSynthesis.pause(),Y.paused=!0,Y.speaking=!1};J.reset=()=>{Object.assign(T,{status:"reset",initialized:!1,speechSynthesis:null,speechSynthesisUtterance:null,speechSynthesisVoice:null,speechSynthesisEvent:null,speechSynthesisErrorEvent:null,voices:null,defaultVoice:null,defaults:{pitch:1,rate:1,volume:1,voice:null},handlers:{}})};const Lt={Barracks:"Barracks",Streltsy:"Streltsy",Runestones:"Runestones","Wynguard Footmen":"Wynguard Footmen","Wynguard Raiders":"Wynguard Raiders","Ranged Specialists":"Ranged Specialists","Palatine Cataphracts":"Palatine Cataphracts",Limitanei:"Limitanei",Militia:"Militia","Szlachta Cavalry":"Szlachta Cavalry",Samurai:"Samurai","Kanabo Samurai":"Kanabo Samurai","Mounted Samurai":"Mounted Samurai","Naginata Samurai":"Naginata Samurai","Yumi Ashigaru":"Yumi Ashigaru","Tanegashima Ashigaru":"Tanegas
2hima Ashigaru","Handcannon Ashigaru":"Handcannon Ashigaru","Onna-Bugeisha":"Onna-Bugeisha","Onna-Musha":"Onna-Musha",Shinobi:"Shinobi",Yari:"Yari",Daimyo:"Daimyo",Yatai:"Yatai",Matsuri:"Matsuri",Ozutsu:"Ozutsu","Zhuge Nu":"Zhuge Nu","Huihui Pao":"Huihui Pao",Mangudai:"Mangudai","Khaganate Elite Mangudai":"Khaganate Elite Mangudai",Riddari:"Riddari","Hippodrome Riddari":"Hippodrome Riddari",Sofa:"Sofa",Shaman:"Shamans","Man-at-Arms":"Men-at-Arms","Gilded Man-at-Arms":"Gilded Men-at-Arms","Jeanne d'Arc - Woman-at-Arms":"Jeanne d'Arc - Women-at-Arms","Nest of Bees":"Nests of Bees","Clocktower Nest of Bees":"Clocktower Nests of Bees","Khaganate Nest of Bees":"Khaganate Nests of Bees","Tower of the Sultan":"Towers of the Sultan","Lord of Lancaster":"Lords of Lancaster",Condottiero:"Condottieri"},ra=/<img[\w\W]*?>/g,ca=/src\s*=\s*"([^"]*)"/,ua=/<br\s*\/?>/i,da=/(\d+)\s*x?\s*$/,fa=/[.!?:,;]$/;let Bt=null;function ma(t){return Bt??(Bt=so()),Bt.getIconFromImgPath(t)}function va(t){return(t.type==="unit"||t.type==="building")&&t.class!=="landmark"}function pa(t){return Object.hasOwn(Lt,t)?Lt[t]:/man$/.test(t)?t.replace(/man$/,"men"):/[^aeiou]y$/i.test(t)?t.replace(/y$/i,"ies"):/(s|x|z|ch|sh)$/i.test(t)?t+"es":t+"s"}function ha(t,n){var v;const o=t.title??"";if(!o)return"";const e=(v=n.match(da))==null?void 0:v[1];return e!==void 0&&Number(e)!==1&&va(t)?pa(o):o}function ga(t){return t=t.replaceAll("<-"," See to the left. "),t=t.replaceAll("->"," ,then "),t=t.replaceAll("&"," and "),t=t.replaceAll("<-"," See to the left. "),t=t.replaceAll("->"," See to the right. "),t=t.replaceAll(">"," on "),t=t.replaceAll(">"," on "),t=t.replaceAll(" "," "),t=t.replaceAll(""",'"'),t=t.replaceAll("'","'"),t=t.replaceAll("'","'"),t=t.replaceAll("<",""),t}function ya(t){var n;return((n=t.match(ca))==null?void 0:n[1])??""}function ba(t,n){var p;t=t.replace(/^\s*(?:>|>)\s*/,"");let o="",e=0;for(const v of t.matchAll(ra)){o+=t.slice(e,v.index),e=v.index+v[0].length;const l=ya(v[0]),c=ma(l);if(!c){(p=n.onUnresolvedIcon)==null||p.call(n,l);continue}o+=` ${ha(c,o)} `}return o+=t.slice(e),o=ga(o),o.replace(/\s+/g," ").replace(/\s+([.,!?;:])/g,"$1").trim()}function ka(t){let n="";for(const o of t){if(!n){n=o;continue}n+=fa.test(n)?" ":". ",n+=o}return n}function wa(t,n={}){const o=en(String(t??""));if(!o)return"";const e=o.split(ua).map(p=>ba(p,n)).filter(Boolean);return ka(e)}const cn="en-GB",un=.8,dn=1,fn=1;let mt=!1,Xe=null;function zt(t){Xe=t}async function Sa(){if(mt=await _a(),!mt)return;const t=Ca();J.defaults({voice:t??void 0,pitch:dn,rate:un,volume:fn})}async function _a(){try{return await J.init({maxTimeout:5e3,interval:250}),!0}catch(t){return console.warn("[voice-over] no voice list from this browser; speaking with its default voice instead.",(t==null?void 0:t.message)??t),!1}}function Ca(){const t=n=>J.filterVoices({voiceURI:n})[0];return t("Andrew")||t("Google UK English Male")||t("Mark")||t("moz-tts:android:en_GB")||J.filterVoices({name:"Englisch Vereinigtes Königreich"})[0]||J.filterVoices({language:cn})[0]||null}async function Gt(t,n=!0){const o=Va(t,n);if(o.trim()){if(mt)try{J.speak({text:o,boundary:()=>{},error:mn}).catch(()=>{});return}catch(e){console.warn("[voice-over] EasySpeech refused the utterance:",(e==null?void 0:e.message)??e)}Ea(o)}}function Ea(t){const n=window.speechSynthesis;if(!n||typeof window.SpeechSynthesisUtterance!="function")return;const o=new window.SpeechSynthesisUtterance(t);o.lang=cn,o.pitch=dn,o.rate=un,o.volume=fn,o.addEventListener("error",mn),n.speak(o)}function mn(t){const n=t==null?void 0:t.error;!n||n==="interrupted"||n==="canceled"||(console.warn(`[voice-over] the browser would not speak: ${n}`),Xe==null||Xe(n))}function ge(){var t;try{J.cancel()}catch{}(t=window.speechSynthesis)==null||t.cancel()}function Va(t,n=!0){const o=(t==null?void 0:t.description)??(t==null?void 0:t.gameplan)??"";var e=wa(o);return n&&ht(t)>0&&(e+="! - ! - ! You should have ",e+=Ue(t.builders)?t.builders+" building. ":"",e+=Ue(t.food)?t.food+" on food. ":"",e+=Ue(t.wood)?t.wood+" on wood. ":"",e+=Ue(t.gold)?t.gold+" on gold. ":"",e+=Ue(t.stone)?t.stone+" on stone. ":""),e}const jt=10,qt=[{key:"builders",icon:"/assets/resources/repair.webp",label:"Builders"},{key:"food",icon:"/assets/resources/food.webp",label:"Food"},{key:"wood",icon:"/assets/resources/wood.webp",label:"Wood"},{key:"gold",icon:"/assets/resources/gold.webp",label:"Gold"},{key:"stone",icon:"/assets/resources/stone.webp",label:"Stone"}],xa={name:"FocusMode",props:["build","popOut"],emits:["closeDialog","poppedOut","popOutFailed"],setup(t,n){const o=w(null),e=w(0),p=tn(),v=w([]),l=w(null),c=w(null),f=w(null),m=w([]),d=w(null),k=w(!0),S=w(!1),E=w(!1),I=w(!1),h=w([]),V=w([]),D=w([]),q=w([]),Z=w(null),pe=w(null),U=w(0),O=w(0),le=w(null),se=w(null),oe=w(0),{request:$,release:ke}=Hn(),Ve=Le(),Oe=w(null);let we=window,xe=null;const{supported:Be,active:Re,open:g,close:y}=Wn({rootRef:Oe,onKeyup:s=>z(s),onEnter:Cn,onLeave:En});function x(s){var ee;if(!((ee=t.build.steps[0])!=null&&ee.type))m.value=JSON.parse(JSON.stringify(t.build.steps));else{m.value=JSON.parse(JSON.stringify(gt(t.build.steps,s))),Jn(m.value);const L=Qe(t.build.steps,s);t.build.steps.forEach((B,X)=>{if(!Ut(B.gameplan))return;const ue=(X+1<L.length?L[X+1]:m.value.length)-1,ne=m.value[ue];if(!ne)return;const de=en(B.gameplan);ne.description=ne.description?ne.description+" <br><br> "+de:de})}h.value=Ro(m.value);const _=yt(m.value);V.value=_.map(L=>L.provenance!=="stated"),v.value=yn(t.build.steps,m.value.length,s),D.value=bn(t.build.steps,m.value.length,s),q.value=kn(t.build.steps,m.value.length,s),E.value=!!h.value,E.value&&m.value.forEach((L,B)=>{L.time=qe(Nt(h.value[B].startTime))});const P=nn(m.value);m.value=m.value.filter((L,B)=>!P[B]),V.value=V.value.filter((L,B)=>!P[B]),v.value=v.value.filter((L,B)=>!P[B]);const R=new Set;v.value.forEach(L=>{L&&(L.first=!R.has(L.key),R.add(L.key))}),D.value=D.value.filter((L,B)=>!P[B]),q.value=q.value.filter((L,B)=>!P[B]),h.value&&(h.value=h.value.filter((L,B)=>!P[B]))}Ie(async()=>
2{if(x(p.paths.value),o.value=m.value[e.value],Z.value=new Date,Z.value.setSeconds(0),Z.value.setMinutes(0),Z.value.setHours(0),pe.value=qe(Z.value),nt(),t.popOut&&await Et(),!Re.value)try{await $("screen")}catch{}let s=!1;zt(()=>{s||(s=!0,Ve.dispatch("showSnackbar",{text:"Your browser would not play the voice-over. Try Chrome, or install the site as an app.",type:"info"}))}),await Sa(),k.value&&(ge(),E.value||Se())}),Qt(()=>{Ge(),ge(),zt(null),ke().catch(()=>{})}),dt(document,"keyup",s=>z(s));function z(s){switch(o.value=m.value[e.value],s.key){case"ArrowLeft":xt();break;case"ArrowRight":at();break;case" ":Vt();break}}const H=M(()=>{var _;const s=(_=v.value)==null?void 0:_[e.value];return!(s!=null&&s.first)&&f.value!==(s==null?void 0:s.key)||p.pathFor(s.key)!=null?null:{...s,reopened:f.value===s.key}}),ve=M(()=>{var P,R;const s=(P=v.value)==null?void 0:P[e.value];if(!s||H.value)return null;const _=p.pathFor(s.key)??0;return{key:s.key,index:_,paths:s.paths,title:(R=s.paths[_])==null?void 0:R.title}});function Ke(){const s=ve.value;s&&(f.value=s.key,p.clear(s.key),Se())}Me([H,d],()=>{const s=H.value;if(!s||s.reopened||d.value==null){c.value=null,l.value=null;return}c.value==null&&(c.value=Sn(),l.value=Math.max(0,c.value-ze()))},{immediate:!0}),Me(e,s=>{const _=new Map;v.value.forEach((P,R)=>{P&&!_.has(P.key)&&_.set(P.key,R)});for(const[P,R]of _)s<R&&p.pathFor(P)!=null&&p.clear(P)});function Se(){if(k.value){if(H.value){pn(H.value);return}Gt(o.value,S.value)}}function pn(s){if(!k.value||!s)return;const _=(s.paths??[]).map(P=>P.title).filter(Boolean);ge(),Gt({description:`Which way? ${_.join(", or ")}`},!1)}const hn=s=>Kn(s);function wt(s,_){l.value=null,c.value=null,f.value===s&&(f.value=null),p.select(s,_),x(p.paths.value),gn(),ge(),Se()}function gn(){const s=h.value;if(!(s!=null&&s.length)){e.value=Math.min(e.value,m.value.length-1),o.value=m.value[e.value];return}const _=ze();let P=0;for(let R=0;R<s.length&&!(s[R].startTime>_);R++)P=R;e.value=P,o.value=m.value[P]}function yn(s,_,P){var L;const R=new Array(_).fill(null);if(!Array.isArray(s)||!((L=s[0])!=null&&L.type))return R;const ee=Qe(s,P);return s.forEach((B,X)=>{let ue=ee[X];((B==null?void 0:B.steps)??[]).forEach((ne,de)=>{var Tt,Pt,It;if((ne==null?void 0:ne.kind)!=="alternatives"){ne!=null&&ne.kind||ue++;return}const je=Fo(X,de),he=P==null?void 0:P[je],Mn=Number.isInteger(he)&&((Tt=ne.paths)!=null&&Tt[he])?he:0,At=(((It=(Pt=ne.paths)==null?void 0:Pt[Mn])==null?void 0:It.steps)??[]).filter(_e=>!(_e!=null&&_e.kind)).length;for(let _e=0;_e<At;_e++)R[ue+_e]={key:je,paths:ne.paths??[],first:_e===0};ue+=At})}),R}function bn(s,_,P){var L;const R=new Array(_).fill(null);if(!Array.isArray(s)||!((L=s[0])!=null&&L.type))return R;const ee=Qe(s,P);return s.forEach((B,X)=>{const ue=ee[X],ne=X+1<ee.length?ee[X+1]:_;if((B==null?void 0:B.type)==="ageUp"&&ne>ue){const de=s.slice(X+1).find(he=>(he==null?void 0:he.type)==="age"&&he.age>1),je=ln.find(he=>he.age===(de==null?void 0:de.age));je&&(R[ue]=je.short)}}),R}function kn(s,_,P){var B;const R=new Array(_).fill(null);if(!Array.isArray(s)||!((B=s[0])!=null&&B.type))return R;const ee=Qe(s,P);let L=null;return s.forEach((X,ue)=>{((X==null?void 0:X.type)==="age"&&X.age>=1||(X==null?void 0:X.type)==="ageUp"&&L==null&&X.age>=1)&&(L=X.age);const ne=ue+1<ee.length?ee[ue+1]:_;for(let de=ee[ue];de<ne;de++)R[de]=L}),R}function wn(){const s=H.value;!s||c.value==null||ze()>=c.value&&wt(s.key,0)}function Sn(){var R;const s=h.value,_=ze(),P=(R=s==null?void 0:s[e.value+1])==null?void 0:R.startTime;return Math.min(P??_+jt,_+jt)}function St(s){return s?s.getMinutes()*60+s.getSeconds():0}function _t(s){U.value=s,O.value=Date.now()}function ze(){return U.value+(Date.now()-O.value)/1e3}function _n(){for(Z.value=Nt(Math.floor(ze())),pe.value=qe(Z.value),tt(),wn();e.value<m.value.length-1;){const s=He(m.value[e.value+1].time);if(!s||Z.value<s)break;at(!1)}}function Ye(){Ge(),xe=we,d.value=we.setInterval(()=>{_n()},1e3)}function Ct(s){const _=d.value!=null;we=s,_&&Ye()}function Cn(s){Ct(s),ke().catch(()=>{})}function En(){Ct(window),$("screen").catch(()=>{})}async function Et(){if(!(!Be||Re.value))try{await g(),n.emit("poppedOut")}catch{n.emit("popOutFailed")}}Me(()=>t.popOut,(s,_)=>{s>(_??0)&&Et()});async function Vn(){try{await g()}catch{n.emit("popOutFailed")}}function tt(){var s=m.value[e.value+1];s?(le.value=Z.value-He(o.value.time),se.value=He(s.time)-He(o.value.time),oe.value=le.value/se.value*100):oe.value=100}function nt(){var s;Z.value=He((s=o.value)==null?void 0:s.time),pe.value=qe(Z.value),_t(St(Z.value))}function Ge(){if(d.value!=null&&xe)try{xe.clearInterval(d.value)}catch{}d.value=null,xe=null}function Vt(){I.value=!I.value,d.value?(ge(),Ge()):I.value&&(_t(St(Z.value)),Ye(),k.value&&(ge(),Se()))}function xn(){k.value=!k.value,k.value?E.value||Se():ge()}function An(){S.value=!S.value,k.value&&(ge(),Se())}const Tn=M(()=>!!V.value[e.value]),Pn=M(()=>Oo(q.value[e.value]));function In(){return(e.value+1)/m.value.length*100}function ot(s){const _=m.value[s];return _?_.gameplan?m.value[s-1]??null:_:null}const Dn=M(()=>{const s=ot(e.value);return qt.filter(_=>Ue(s==null?void 0:s[_.key])).map(_=>({..._,value:s[_.key]}))}),On=M(()=>
2{if(!E.value)return null;const s=e.value+1,_=m.value[s];return _?{time:_.time,token:Rn(s)}:null});function Rn(s){const _=D.value[s];if(_)return{ageUp:!0,text:_};const P=ot(e.value),R=ot(s);if(!P||!R)return null;let ee=null;for(const L of qt){const B=ft(R[L.key])-ft(P[L.key]);B!==0&&(!ee||Math.abs(B)>Math.abs(ee.delta))&&(ee={delta:B,column:L})}return ee?{ageUp:!1,icon:ee.column.icon,text:`${ee.delta>0?"+":""}${ee.delta}`}:null}function at(s=!0){e.value=Math.min(++e.value,m.value.length-1),o.value=m.value[e.value],Ge(),s&&nt(),tt(),I.value&&Ye(),k.value&&(ge(),Se())}function xt(s=!0){e.value=Math.max(--e.value,0),o.value=m.value[e.value],Ge(),s&&nt(),tt(),I.value&&Ye(),k.value&&(ge(),Se())}function Fn(){Re.value&&y(),n.emit("closeDialog")}function Un(){var s,_,P,R;return(s=o.value)!=null&&s.description?(_=o.value)==null?void 0:_.description:(P=o.value)!=null&&P.gameplan?(R=o.value)==null?void 0:R.gameplan:""}return{hasVisibleContent:Ut,steps:m,focusRoot:Oe,getProgress:In,totalElapsedTimeFormattedString:pe,currentStepDerived:Tn,currentAge:Pn,currentStep:o,pendingPick:H,activePathBar:ve,reopenPick:Ke,pickSeconds:l,pickDeadline:c,choosePath:wt,conditionOfPath:hn,currentStepProgress:oe,getFormattedTime:qe,handleNextStep:at,handlePreviousStep:xt,handleTogglePlayback:Vt,handleToggleAudio:xn,handleToggleVillagerAnnouncements:An,handlePopOut:Vn,closePiP:y,pipSupported:Be,pipActive:Re,timer:d,audio:k,announceVillagers:S,autoplaySupported:E,currentStepIndex:e,handleClose:Fn,aggregateVillagers:ht,getContent:Un,dockCells:Dn,nextPreview:On}}},Aa={ref:"focusRoot",class:"fm-root"},Ta={class:"fm-shell"},Pa={class:"fm-header"},Ia={class:"fm-title"},Da={class:"fm-counter"},Oa={class:"fm-bars"},Ra={class:"fm-step"},Fa={key:0,class:"fm-step-content fm-step-content--pick"},Ua={class:"fm-pick"},Ma={class:"fm-pick-ask"},Na={class:"fm-pick-options"},La=["onClick"],Ba={class:"fm-pick-title"},za=["innerHTML"],Ga={key:1,class:"fm-step-content"},ja={key:0,class:"fm-notes"},qa=["innerHTML"],Ha={key:2,class:"fm-preview"},Wa={key:0,class:"fm-preview-token"},Ka=["src"],Ya={key:0,class:"fm-path-bar"},Qa={class:"fm-path-bar-title"},Ja={class:"fm-dock"},Xa={class:"fm-resources"},Za={class:"fm-res-line"},$a={key:0,class:"fm-res fm-res--age"},el=["src","alt"],tl={class:"fm-res"},nl={class:"fm-res-line fm-res-line--eco"},ol={class:"fm-res"},al={class:"fm-res-value"},ll=["src","alt"],sl=["innerHTML"],il={class:"fm-transport"};function rl(t,n,o,e,p,v){var l;return u(),b("div",Aa,[r("div",Ta,[r("div",Pa,[i(Q,{location:"bottom",attach:e.focusRoot},{activator:a(({props:c})=>[e.pipSupported&&!e.pipActive?(u(),j(G,K({key:0},c,{class:"fm-ctl-btn fm-ctl-btn--small",color:"accent",variant:"text",icon:"mdi-picture-in-picture-bottom-right","aria-label":"Open in a floating window",onClick:e.handlePopOut}),null,16,["onClick"])):A("",!0)]),default:a(()=>[r("span",{style:N({color:t.$vuetify.theme.current.colors.primary})},"Open Focus Mode in a floating window",4)]),_:1},8,["attach"]),r("div",Ia,F(o.build.title),1),r("div",Da,F(e.currentStepIndex+1)+"/"+F(e.steps.length),1),i(Q,{location:"bottom",attach:e.focusRoot},{activator:a(({props:c})=>[i(G,K(c,{class:"fm-ctl-btn fm-ctl-btn--small",color:"accent",variant:"text",icon:"mdi-close","aria-label":"Close Focus Mode and return to the build",onClick:e.handleClose}),null,16,["onClick"])]),default:a(()=>[r("span",{style:N({color:t.$vuetify.theme.current.colors.primary})},"Close Focus Mode and return to the build",4)]),_:1},8,["attach"])]),r("div",Oa,[i(Dt,{class:"fm-bar",color:"primary",height:"3","model-value":e.getProgress()},null,8,["model-value"]),e.autoplaySupported?(u(),j(Dt,{key:0,class:"fm-bar fm-bar--dim",color:"primary",height:"3","model-value":e.currentStepProgress},null,8,["model-value"])):A("",!0)]),ce((u(),b("div",Ra,[e.pendingPick?(u(),b("div",Fa,[r("div",Ua,[r("div",Ma,[i(te,{size:"18",class:"fm-pick-mark"},{default:a(()=>n[3]||(n[3]=[C("mdi-call-split")])),_:1}),n[4]||(n[4]=r("span",{class:"fm-pick-ask-text"},"Which way?",-1))]),e.pickSeconds?(u(),b("div",{class:"fm-pick-timer",key:e.pickDeadline,style:N({"--pick-secs":e.pickSeconds+"s"})},n[5]||(n[5]=[r("i",null,null,-1)]),4)):A("",!0),r("div",Na,[(u(!0),b(W,null,ae(e.pendingPick.paths,(c,f)=>(u(),b("button",{key:"pick"+f,class:"fm-pick-option",onClick:m=>e.choosePath(e.pendingPick.key,f)},[r("span",Ba,F(c.title),1),e.conditionOfPath(c)?(u(),b("span",{key:0,class:"fm-pick-cond",innerHTML:e.conditionOfPath(c)},null,8,za)):A("",!0)],8,La))),128))])])])):(u(),b("div",Ga,[e.hasVisibleContent((l=e.currentStep)==null?void 0:l.gameplan)?(u(),b("div",ja,[n[7]||(n[7]=C(" Notes ")),i(te,{color:"accent",class:"fm-notes-icon"},{default:a(()=>n[6]||(n[6]=[C("mdi-information-outline")])),_:1})])):A("",!0),r("span",{innerHTML:e.getContent()},null,8,qa)])),e.nextPreview&&!e.pendingPick?(u(),b("div",Ha,[r("span",null,"next "+F(e.nextPreview.time),1),e.nextPreview.token?(u(),b("span",Wa,[e.nextPreview.token.ageUp?(u(),b(W,{key:0},[C("â")],64)):e.nextPreview.token.icon?(u(),b("img",{key:1,class:"fm-preview-icon",src:e.nextPreview.token.icon,alt:""},null,8,Ka)):A("",!0),C(" "+F(e.nextPreview.token.text),1)])):A("",!0)])):A("",!0)])),[[Jt,{left
2:()=>e.handleNextStep(),right:()=>e.handlePreviousStep()}]]),e.activePathBar?(u(),b("div",Ya,[i(te,{size:"13",class:"fm-path-bar-mark"},{default:a(()=>n[8]||(n[8]=[C("mdi-call-split")])),_:1}),r("span",Qa,F(e.activePathBar.title),1),e.activePathBar.paths.length>1?(u(),b("button",{key:0,class:"fm-path-bar-switch",onClick:n[0]||(n[0]=c=>e.reopenPick())}," change ")):A("",!0)])):A("",!0),r("div",Ja,[r("div",Xa,[r("div",Za,[e.currentAge?(u(),b("div",$a,[r("img",{class:"fm-res-icon",src:e.currentAge.crest,alt:e.currentAge.name},null,8,el)])):A("",!0),r("div",tl,[n[9]||(n[9]=r("img",{class:"fm-res-icon",src:Yn,alt:"Elapsed time"},null,-1)),r("span",{class:fe(["fm-res-value fm-res-value--time",{"fm-time--derived":e.currentStepDerived}])},F(e.currentStepDerived?"~":"")+F(e.totalElapsedTimeFormattedString),3)])]),r("div",nl,[r("div",ol,[n[10]||(n[10]=r("img",{class:"fm-res-icon",src:Qn,alt:"Villagers"},null,-1)),r("span",al,F(e.currentStep?e.aggregateVillagers(e.currentStep):""),1)]),(u(!0),b(W,null,ae(e.dockCells,c=>(u(),b("div",{class:"fm-res fm-res--extra",key:c.key},[r("img",{class:"fm-res-icon",src:c.icon,alt:c.label},null,8,ll),r("span",{class:"fm-res-value",innerHTML:c.value},null,8,sl)]))),128))])]),r("div",il,[i(Q,{location:"top",attach:e.focusRoot},{activator:a(({props:c})=>[i(G,K(c,{class:"fm-ctl-btn fm-ghost",color:"accent",variant:"text",icon:"mdi-chevron-left","aria-label":"Previous step",onClick:n[1]||(n[1]=f=>e.handlePreviousStep())}),null,16)]),default:a(()=>[r("span",{style:N({color:t.$vuetify.theme.current.colors.primary})},"Previous Build Order Step (ARROW LEFT)",4)]),_:1},8,["attach"]),i(Q,{location:"top",attach:e.focusRoot},{activator:a(({props:c})=>[i(G,K(c,{class:"fm-ctl-btn fm-ghost",color:"accent",variant:"text",icon:e.audio?"mdi-volume-medium":"mdi-volume-off","aria-label":"Toggle voice over sound",onClick:e.handleToggleAudio}),null,16,["icon","onClick"])]),default:a(()=>[r("span",{style:N({color:t.$vuetify.theme.current.colors.primary})},"Toggle voice over sound",4)]),_:1},8,["attach"]),i(Q,{location:"top",attach:e.focusRoot},{activator:a(({props:c})=>[e.autoplaySupported?(u(),j(G,K({key:0},c,{class:"fm-ctl-btn fm-play",color:"primary",variant:"flat",icon:e.timer?"mdi-pause":"mdi-play","aria-label":"Toggle auto-playback",onClick:e.handleTogglePlayback}),null,16,["icon","onClick"])):A("",!0)]),default:a(()=>[r("span",{style:N({color:t.$vuetify.theme.current.colors.primary})},"Toggle auto-playback",4)]),_:1},8,["attach"]),i(Q,{location:"top",attach:e.focusRoot},{activator:a(({props:c})=>[e.audio?(u(),j(G,K({key:0},c,{class:"fm-ctl-btn fm-ghost",color:"accent",variant:"text",icon:e.announceVillagers?"mdi-account-check":"mdi-account-off-outline","aria-label":"Toggle villager distribution announcements",onClick:e.handleToggleVillagerAnnouncements}),null,16,["icon","onClick"])):A("",!0)]),default:a(()=>[r("span",{style:N({color:t.$vuetify.theme.current.colors.primary})},"Toggle villager distribution announcements",4)]),_:1},8,["attach"]),i(Q,{location:"top",attach:e.focusRoot},{activator:a(({props:c})=>[i(G,K(c,{class:"fm-ctl-btn fm-ghost",color:"accent",variant:"text",icon:"mdi-chevron-right","aria-label":"Next step",onClick:n[2]||(n[2]=f=>e.handleNextStep())}),null,16)]),default:a(()=>[r("span",{style:N({color:t.$vuetify.theme.current.colors.primary})},"Next Build Order Step (ARROW RIGHT)",4)]),_:1},8,["attach"])])])])],512)}const cl=ye(xa,[["render",rl],["__scopeId","data-v-12f877a0"]]),ul={name:"Favorites",props:["buildId","modelValue"],emits:["voteUpAdded","voteUpRemoved"],setup(t,n){var S;const o=w(!1),e=w(!1),p=w((S=t.modelValue)==null?void 0:S.uid),{assertVerified:v}=et();Ie(async()=>{var I,h,V,D;const E=t.modelValue;p.value=E==null?void 0:E.id,(I=E.upvotes)!=null&&I.includes(t.buildId)&&(o.value=(h=E.upvotes)==null?void 0:h.includes(t.buildId)),(V=E.downvotes)!=null&&V.includes(t.buildId)&&(e.value=(D=E.downvotes)==null?void 0:D.includes(t.buildId))});const l=async()=>{v()&&(So(t.buildId),ro(p.value,t.buildId),o.value=!o.value,n.emit("voteUpAdded"),k())},c=async()=>{d()},f=async()=>{v()&&(wo(t.buildId),io(p.value,t.buildId),e.value=!e.value,d())},m=async()=>{k()},d=()=>{o.value&&(Co(t.buildId),uo(p.value,t.buildId),o.value=!o.value,n.emit("voteUpRemoved"))},k=()=>{e.value&&(_o(t.buildId),co(p.value,t.buildId),e.value=!e.value)};return{props:t,downVote:e,upVote:o,handleAddVoteUp:l,handleRemoveVoteUp:c,handleAddVoteDown:f,handleRemoveVoteDown:m}}};function dl(t,n,o,e,p,v){return u(),b(W,null,[i(Q,{location:"top"},{activator:a(({props:l})=>[ce(i(G,K({onClick:e.handleAddVoteUp},l,{color:"accent",variant:"text",icon:"mdi-thumb-up-outline"}),null,16,["onClick"]),[[me,!e.upVote]])]),default:a(()=>[r("span",{style:N({color:t.$vuetify.theme.current.colors.primary})},"I like! This is a good one!",4)]),_:1}),i(Q,{location:"top"},{activator:a(({props:l})=>[ce(i(G,K({class:"ml-0",onClick:e.handleRemoveVoteUp},l,{color:"accent",variant:"text",icon:"mdi-thumb-up"}),null,16,["onClick"]),[[me,e.upVote]])]),default:a(()=>[r("span",{style:N({color:t.$vuetify.theme.current.colors.primary})},"Remove your like",4)]),_:1}),i(Q,{location:"top"},{activator:a(({props:l})=>[ce(i(G,K({onClick:e.handleAddVoteDown},l,{color:"accent",variant:"text",icon:"mdi-thumb-down-outline"}),null,16,["onClick"]),[[me,!e.downVote]])]),default:a(()=>[r("span",{style:N({color:t.$vuetify.theme.current.colors.primary})},"Downvote! Villagers need to improve this build!",4)]),_:1}),i(Q,{location:"top"},{activator:a(({props:l})=>[ce(i(G,K({onClick:e.handleRemoveVoteDown},l,{color:"accent",variant:"text",icon:"mdi-thumb-down"}),null,16,["onClick"]),[[me,e.downVote]])]),default:a(()=>[r("span",{style:N({color:t.$vuetify.theme.current.colors.primary})},"I changed my mind. This build is pretty neat!",4)]),_:1})],64)}const fl=ye(ul,[["render",dl]]),We=[{key:"builders",label:"Builders",icon:"/assets/resources/repair.webp"},{key:"food",label:"Food",icon:"/assets/resources/food.webp"},{key:"wood",label:"Wood",icon:"/assets/resources/wood.webp"},{key:"gold",label:"Gold",icon:"/assets/resources/gold.webp"},{key:"stone",label:"Stone",icon:"/assets/resources/stone.webp"}],Ht=16,it=[4,8,16],ml=6,Wt=120,vl=.5,pl={name:"EcoLines",props:{series:{type:Object,required:!0},scaleSeconds:{type:Number,required:!0},ages:{type:Array,default:()=>[]}},setup(t){const n=(g,y)=>Math.min(y,Math.max(0,g)),o=M(()=>t.series.points.reduce((g,y)=>We.reduce((x,z)=>
2Math.max(x,y[z.key]),g),0)),e=M(()=>{const g=Math.max(Ht,o.value);return it.find(y=>Math.ceil(g/y)<=ml)||it[it.length-1]}),p=M(()=>Math.max(Ht,Math.ceil(o.value/e.value)*e.value)),v=M(()=>{const g=[];for(let y=e.value;y<=p.value;y+=e.value)g.push({value:y,offset:`${y/p.value*100}%`});return g}),l=g=>`${n(g/t.scaleSeconds*100,100)}%`,c=g=>n(g/t.scaleSeconds*1e3,1e3),f=g=>100-n(g/p.value*100,100),m=(g,y)=>g.map(x=>`${c(x.seconds)},${f(x[y])}`).join(" "),d=M(()=>{const g=t.series.points;if(g.length<2)return[];const y=[];let x=0,z=!(g[0].stated&&g[1].stated);for(let H=1;H<g.length-1;H++){const ve=!(g[H].stated&&g[H+1].stated);ve!==z&&(y.push({from:x,to:H,projected:z}),x=H,z=ve)}return y.push({from:x,to:g.length-1,projected:z}),y}),k=w(null),S=w(null),E=M(()=>k.value||S.value),I=g=>{S.value=S.value===g?null:g};let h=null;const V=g=>{if(clearTimeout(h),k.value){k.value=g;return}h=setTimeout(()=>k.value=g,Wt)},D=()=>{clearTimeout(h),h=setTimeout(()=>k.value=null,Wt)};Qt(()=>clearTimeout(h));const q=M(()=>We.flatMap(g=>d.value.map((y,x)=>({key:`${g.key}-${x}`,resource:g.key,points:m(t.series.points.slice(y.from,y.to+1),g.key),projected:y.projected})))),Z=M(()=>E.value?[...q.value.filter(g=>g.resource!==E.value),...q.value.filter(g=>g.resource===E.value)]:q.value),pe=M(()=>{const g=t.series.points[t.series.points.length-1];return g?We.map(y=>({resource:y.key,left:l(g.seconds),bottom:`${n(g[y.key]/p.value*100,100)}%`})):[]}),U=M(()=>{const{lastStatedSeconds:g}=t.series;return g==null?"":t.ages.some(x=>x.seconds>g)?`No villagers assigned after ${$e(g)}`:""}),O=ct(pt,null),le=w(null),se=w(null),oe=()=>{var g;return se.value=((g=le.value)==null?void 0:g.getBoundingClientRect())??null};Ie(oe),dt(window,"resize",oe),dt(window,"scroll",()=>$.value&&oe(),{passive:!0});const $=w(null),ke=g=>{const y=t.series.points;let x=null,z=1/0;for(const H of y){const ve=Math.abs(H.seconds-g);ve<=z&&(x=H,z=ve)}return x},Ve=g=>{var ve,Ke;if((ve=se.value)!=null&&ve.width||oe(),!((Ke=se.value)!=null&&Ke.width))return;const y=t.series.points;if(y.length<2)return;const z=(g.clientX-se.value.left)/se.value.width*t.scaleSeconds;if(z<y[0].seconds||z>y[y.length-1].seconds){Oe();return}const H=ke(z);!H||H===$.value||($.value=H,O==null||O.setFromPlot(H))},Oe=()=>{$.value&&($.value=null,O==null||O.clear("plot"))},we=M(()=>O?O.moment.value:$.value?{seconds:$.value.seconds,stated:$.value.stated,point:$.value}:null),xe=M(()=>{var y;const g=(y=we.value)==null?void 0:y.point;return g?We.map(x=>
2({resource:x.key,left:l(g.seconds),bottom:`${n(g[x.key]/p.value*100,100)}%`})):[]}),Be=M(()=>{var g;return(((g=we.value)==null?void 0:g.seconds)??0)/t.scaleSeconds<vl?"end":"start"});return{RESOURCES:We,gridlines:v,lines:Z,endCaps:pe,tailNote:U,percent:l,active:E,enter:V,leave:D,togglePin:I,formatAgeTime:$e,plotEl:le,shown:we,snapDots:xe,readoutSide:Be,track:Ve,untrack:Oe,jumpToStep:()=>{$.value&&(O==null||O.requestScroll($.value.stepIndex))}}}},hl={class:"eco","aria-hidden":"true"},gl={class:"eco-svg",viewBox:"0 0 1000 100",preserveAspectRatio:"none"},yl=["points"],bl=["points","onMouseenter"],kl={class:"ecort-time"},wl=["src"],Sl={class:"ecort-value"},_l={class:"eco-legend d-flex align-center flex-wrap ga-4 mt-2"},Cl=["onMouseenter","onClick"],El={class:"text-caption text-medium-emphasis"},Vl={key:0,class:"text-caption text-medium-emphasis ml-auto"};function xl(t,n,o,e,p,v){return u(),b("div",hl,[r("div",{ref:"plotEl",class:"eco-plot",onPointermove:n[1]||(n[1]=l=>e.track(l)),onPointerleave:n[2]||(n[2]=l=>e.untrack()),onClick:n[3]||(n[3]=l=>e.jumpToStep())},[(u(!0),b(W,null,ae(e.gridlines,l=>(u(),b("span",{key:"grid-"+l.value,class:"eco-grid",style:N({bottom:l.offset})},null,4))),128)),(u(!0),b(W,null,ae(e.gridlines,l=>(u(),b("span",{key:"label-"+l.value,class:"eco-grid-label",style:N({bottom:l.offset})},F(l.value),5))),128)),(u(!0),b(W,null,ae(o.ages,l=>(u(),b("span",{key:"guide-"+l.age,class:"eco-guide",style:N({left:e.percent(l.seconds)})},null,4))),128)),(u(),b("svg",gl,[(u(!0),b(W,null,ae(e.lines,l=>(u(),b("polyline",{key:l.key,class:fe(["eco-line","eco-line--"+l.resource,{"eco-line--projected":l.projected,"eco-line--active":e.active===l.resource,"eco-line--dim":e.active&&e.active!==l.resource}]),points:l.points,"vector-effect":"non-scaling-stroke"},null,10,yl))),128)),(u(!0),b(W,null,ae(e.lines,l=>(u(),b("polyline",{key:"hit-"+l.key,class:"eco-hit",points:l.points,"vector-effect":"non-scaling-stroke",onMouseenter:c=>e.enter(l.resource),onMouseleave:n[0]||(n[0]=c=>e.leave())},null,40,bl))),128))])),(u(!0),b(W,null,ae(e.endCaps,l=>(u(),b("span",{key:"cap-"+l.resource,class:fe(["eco-cap","eco-cap--"+l.resource,{"eco-cap--dim":e.active&&e.active!==l.resource}]),style:N({left:l.left,bottom:l.bottom})},null,6))),128)),e.shown?(u(),b(W,{key:0},[r("span",{class:"eco-rule",style:N({left:e.percent(e.shown.seconds)})},null,4),(u(!0),b(W,null,ae(e.snapDots,l=>(u(),b("span",{key:"snap-"+l.resource,class:fe(["eco-snap","eco-snap--"+l.resource,{"eco-snap--dim":e.active&&e.active!==l.resource}]),style:N({left:l.left,bottom:l.bottom})},null,6))),128)),e.shown.point?(u(),b("div",{key:0,class:fe(["eco-readout","eco-readout--"+e.readoutSide]),style:N({left:e.percent(e.shown.seconds)}),"aria-hidden":"true"},[r("div",kl,F(e.shown.stated?"":"~")+F(e.formatAgeTime(e.shown.seconds)),1),(u(!0),b(W,null,ae(e.RESOURCES,l=>(u(),b("div",{key:"read-"+l.key,class:fe(["ecort-row",{"ecort-row--dim":e.active&&e.active!==l.key}])},[r("span",{class:fe(["eco-swatch","eco-swatch--"+l.key])},null,2),r("img",{src:l.icon,alt:"",class:"ecort-icon"},null,8,wl),r("b",Sl,F(e.shown.point[l.key]),1)],2))),128))],6)):A("",!0)],64)):A("",!0)],544),r("div",_l,[(u(!0),b(W,null,ae(e.RESOURCES,l=>(u(),b("span",{key:l.key,class:fe(["eco-legend-item d-flex align-center ga-1",{"eco-legend-item--dim":e.active&&e.active!==l.key}]),onMouseenter:c=>e.enter(l.key),onMouseleave:n[4]||(n[4]=c=>e.leave()),onClick:c=>e.togglePin(l.key)},[r("span",{class:fe(["eco-swatch","eco-swatch--"+l.key])},null,2),r("span",El,F(l.label),1)],42,Cl))),128)),e.tailNote?(u(),b("span",Vl,F(e.tailNote),1)):A("",!0)])])}const Al=ye(pl,[["render",xl],["__scopeId","data-v-a1ede8fc"]]),Kt=["builders","food","wood","gold","stone"],Tl=.5,Pl=4,Il=120;function Dl(t){return t.some((n,o)=>o>0&&t[o-1].seconds-n.seconds>=Il)}function Ol(t,n){var o;try{if(!Array.isArray(t)||!t.length||!((o=t[0])!=null&&o.type))return null;const e=gt(t,n);if(!e.length)return null;const p=yt(e),v=nn(e),l=[];let c=0,f=0;e.forEach((d,k)=>{if(v[k])return;f++;const S={builders:0,food:0,wood:0,gold:0,stone:0};let E=!1;for(const h of Kt){const V=d==null?void 0:d[h];V==null||String(V).trim()===""||(S[h]=ft(String(V)),E=!0)}if(!E||!Kt.some(h=>S[h]>0))return;c++;const I=p[k];!I||I.seconds==null||l.push({seconds:I.seconds,stated:I.provenance==="stated",stepIndex:k,...S})});const m=f?c/f:0;return m<Tl||l.length<Pl||Dl(l)?null:(l.sort((d,k)=>d.seconds-k.seconds),{points:l,coverage:m,lastStatedSeconds:l[l.length-1].seconds})}catch(e){return console.error("useEcoSeries.getEcoSeries failed:",e.message),null}}const Yt=360,rt=[120,240],Rl=6,vn="aoe4-guides-eco-open";function Fl(){try{return localStorage.getItem(vn)==="true"}catch{return!1}}function Ul(t){try{localStorage.setItem(vn,t?"true":"false")}catch{}}const Ml={name:"AgeTimeline",components:{AgeChips:Lo,EcoLines:Al},props:{steps:{type:Array,default:()=>[]}},setup(t){const n=ct(pt,null),o=M(()=>{var U;return((U=n==null?void 0:n.moment.value)==null?void 0:U.seconds)??null}),e=ct(on,null),p=M(()=>(e==null?void 0:e.paths.value)??void 0),v=M(()=>Uo(t.steps,p.value)),l=M(()=>{const U=gt(t.steps,p.value),O=yt(U),le=U.reduce((oe,$,ke)=>{var Ve;return ht($)?Math.max(oe,((Ve=O[ke])==null?void 0:Ve.seconds)??0):oe},0),se=v.value.reduce((oe,$)=>Math.max(oe,$.seconds),0);return Math.max(le,se)}),c=M(()=>{const U=Math.max(Yt,l.value);return rt.find(O=>Math.ceil(U/O)<=Rl)||rt[rt.length-1]}),f=M(()=>Math.max(Yt,Math.ceil(l.value/c.value)*c.value)),m=U=>Math.min(100,Math.max(0,U)),d=U=>`${m(U/f.value*100)}%`,k=M(()=>Mo(v.value,f.value)),S=M(()=>{const U=[];for(let O=0;O<=f.value;O+=c.value)U.push($e(O));return U}),E=M(()=>Ol(t.steps,p.value)),I=w(Fl()),h=()=>{I.value=!I.value,Ul(I.value)},V=U=>ln.find(O=>O.age===U);return{ages:v,segments:k,axis:S,scaleSeconds:f,percent:d,formatAgeTime:$e,crestFor:U=>{var O;return(O=V(U))==null?void 0:O.crest},labelFor:U=>No(V(U.age),U),nameFor:U=>{var O;return(O=V(U))==null?void 0:O.name},footnoteFor:U=>{var le;const O=[U.provenance,(le=U.clickUp)==null?void 0:le.provenance];return O.includes("extrapolated")?"~ projected past the last stated t
2ime":O.includes("interpolated")?"~ estimated between stated times":"~ approximate, as the author wrote it"},eco:E,ecoOpen:I,toggleEco:h,highlightSeconds:o}}},Nl={class:"build-card-section-header d-flex align-center px-4 ga-2"},Ll={class:"px-4 pb-4 d-md-none"},Bl={class:"px-4 pb-4 d-none d-md-block"},zl={class:"age-scan"},Gl={class:"age-track"},jl={class:"age-ticks"},ql={class:"agett-title font-weight-bold"},Hl={key:0,class:"agett-pop"},Wl={key:0,class:"agett-pop"},Kl={key:2,class:"agett-note text-caption"},Yl=["src"],Ql={key:0,class:"age-vils"},Jl={class:"age-sr"},Xl={class:"age-axis"},Zl={class:"d-flex align-center w-100 ga-2"};function $l(t,n,o,e,p,v){const l=ie("AgeChips"),c=ie("EcoLines");return e.ages.length?(u(),j(Te,{key:0,flat:"",rounded:"lg",class:"mt-4"},{default:a(()=>[r("div",Nl,[i(te,{color:"accent",size:"small"},{default:a(()=>n[0]||(n[0]=[C("mdi-timer-sand")])),_:1}),n[1]||(n[1]=r("span",{class:"text-caption text-uppercase font-weight-bold"},"Timeline",-1))]),r("div",Ll,[i(l,{timings:e.ages,size:"small"},null,8,["timings"])]),r("div",Bl,[r("div",zl,[r("div",Gl,[(u(!0),b(W,null,ae(e.segments,f=>(u(),b("span",{key:f.key,class:fe(["age-seg",f.key]),style:N({width:f.width+"%"})},null,6))),128))]),r("div",jl,[(u(!0),b(W,null,ae(e.ages,f=>(u(),j(Q,{key:f.age,location:"top"},{activator:a(({props:m})=>[r("div",K({ref_for:!0},m,{class:"age-tick",style:{left:e.percent(f.seconds)}}),[r("img",{src:e.crestFor(f.age),alt:"",class:"age-crest"},null,8,Yl),r("div",{class:fe(["age-time",{"age-time--derived":f.derived}])},F(f.derived?"~":"")+F(e.formatAgeTime(f.seconds)),3),f.villagers?(u(),b("div",Ql,F(f.villagers)+" vils",1)):A("",!0),r("span",Jl,F(e.labelFor(f)),1)],16)]),default:a(()=>{var m;return[r("div",{class:"agett",style:N({color:t.$vuetify.theme.current.colors.primary})},[r("div",ql,F(e.nameFor(f.age)),1),f.clickUp?(u(),b(W,{key:0},[n[2]||(n[2]=r("span",null,"Clicked up",-1)),r("b",null,[C(F(f.clickUp.derived?"~":"")+F(e.formatAgeTime(f.clickUp.seconds)),1),f.clickUpVillagers?(u(),b("span",Hl," · "+F(f.clickUpVillagers)+" vils",1)):A("",!0)])],64)):A("",!0),n[4]||(n[4]=r("span",null,"Reached",-1)),r("b",null,[C(F(f.derived?"~":"")+F(e.formatAgeTime(f.seconds)),1),f.villagers?(u(),b("span",Wl," · "+F(f.villagers)+" vils",1)):A("",!0)]),f.clickUp?(u(),b(W,{key:1},[n[3]||(n[3]=r("span",null,"Age-up took",-1)),r("b",null,F(e.formatAgeTime(f.clickUp.duration)),1)],64)):A("",!0),f.derived||(m=f.clickUp)!=null&&m.derived?(u(),b("div",Kl,F(e.footnoteFor(f)),1)):A("",!0)],4)]}),_:2},1024))),128))]),e.highlightSeconds!=null?(u(),b("span",{key:0,class:"age-rule",style:N({left:e.percent(e.highlightSeconds)})},null,4)):A("",!0)]),r("div",Xl,[(u(!0),b(W,null,ae(e.axis,f=>(u(),b("span",{key:f},F(f),1))),128))]),e.eco?(u(),b(W,{key:0},[i(G,{variant:"text",block:"",height:"38",class:"eco-row px-0 mt-2","aria-expanded":e.ecoOpen?"true":"false",onClick:e.toggleEco},{default:a(()=>[r("span",Zl,[i(te,{size:"small"},{default:a(()=>n[5]||(n[5]=[C("mdi-chart-line")])),_:1}),n[7]||(n[7]=r("span",{class:"text-caption font-weight-medium"},"Economy",-1)),n[8]||(n[8]=r("span",{class:"text-caption text-medium-emphasis text-lowercase"}," villagers per resource ",-1)),i(Nn),i(te,{size:"small",class:fe(["eco-chevron",{"eco-chevron--open":e.ecoOpen}])},{default:a(()=>n[6]||(n[6]=[C(" mdi-chevron-down ")])),_:1},8,["class"])])]),_:1},8,["aria-expanded","onClick"]),i(Xt,null,{default:a(()=>[e.ecoOpen?(u(),j(c,{key:0,series:e.eco,"scale-seconds":e.scaleSeconds,ages:e.ages},null,8,["series","scale-seconds","ages"])):A("",!0)]),_:1})],64)):A("",!0)])]),_:1})):A("",!0)}const es=ye(Ml,[["render",$l],["__scopeId","data-v-9ea97903"]]),{getAll:ts,getQuery:ns,add:os,del:as}=fo("comments");async function ls(t,n){return os(t,n)}async function ss(t){return as(t)}async function is(t){var n=Eo("buildId",t);n=n.concat(Vo(null,"timeCreated","asc"));const o=ns(n);return ts(o)}const rs={name:"Comment",components:{UserAvatar:mo},props:["comment"],emits:["commentRemoved"],setup(t,n){const o=Le(),e=M(()=>o.state.user),p=t.comment.id,v=t.comment.text,l=t.comment.timeCreated,c=t.comment.author,f=t.comment.authorId,m=w(!1),{timeSince:d,isNew:k}=Bo(),S=w(null);Ie(async()=>{f&&(S.value=await o.dispatch("getCachedUserProfile",f).catch(()=>null))});const E=M(()=>{var V;return((V=S.value)==null?void 0:V.avatar)??null}),{src:I}=vo(E);return{toDateSafe:zo,comment:v,timeCreated:l,author:c,authorId:f,dialog:m,timeSince:d,isNew:k,handleDelete:async()=>{m.value=!1,await ss(p),await xo(t.comment.buildId),n.emit("commentRemoved")},user:e,avatarSrc:I}}};function cs(t,n,o,e,p,v){const l=ie("UserAvatar");return u(),b(W,null,[i(ut,{modelValue:e.dialog,"onUpdate:modelValue":n[0]||(n[0]=c=>e.dialog=c),width:"auto"},{default:a(()=>[i(Te,{rounded:"lg",class:"text-center",flat:""},{default:a(()=>[i(vt,null,{default:a(()=>n[2]||(n[2]=[C("Delete Comment")])),_:1}),i(Pe,null,{default:a(()=>n[3]||(n[3]=[C(" Do you really want to delete this comment?"),r("br",null,null,-1),C(" The action cannot be undone. ")])),_:1}),i($t,null,{default:a(()=>[i(G,{color:"error",block:"",onClick:e.handleDelete},{default:a(()=>n[4]||(n[4]=[C("Delete")])),_:1},8,["onClick"])]),_:1})]),_:1})]),_:1},8,["modelValue"]),i(Zt),i(Pe,{style:{"white-space":"pre-line"}},{default:a(()=>[i(Ze,{class:"my-2","no-gutters":"",align:"center"},{default:a(()=>[i(Ae,{cols:"auto"},{default:a(()=>[i(l,{class:"mr-4",src:e.avatarSrc,name:e.author},null,8,["src","name"])]),_:1}),i(Ae,{cols:"*"},{default:a(()=>[C(F(e.comment),1)]),_:1}),i(Ae,{cols:"auto"},{default:a(()=>{var c;return[e.authorId==((c=e.user)==null?void 0:c.uid)?(u(),j(G,{key:0,color:"accent",variant:"text",block:"",icon:"mdi-delete",onClick:n[1]||(n[1]=f=>e.dialog=!0)})):A("",!0)]}),_:1})]),_:1}),i(Ze,{"no-gutters":"",justify:"end"},{default:a(()=>[i(Ae,{cols:"auto"},{default:a(()=>[e.timeCreated&&e.author?(u(),j(Ln,{key:0},{default:a(()=>[e.isNew(e.toDateSafe(e.timeCreated))?(u(),j(lt,{key:0,class:"mr-2",label:"",color:"accent",size:"small"},{default:a(()=>[i(te,{start:"",icon:"mdi-alert-decagram"}),n[5]||(n[5]=C("NEW"))]),_:1})):A("",!0),i(lt,{class:"mr-2",label:"",size:"small"},{default:a(()=>[i(te,{start:"",icon:"mdi-account-edit"}),C(F(e.author),1)]),_:1}),i(lt,{label:"",size:"small"},{default:a(()=>[i(te,{start:"",icon:"mdi-clock-edit-outline"}),C(F(e.timeSince(e.toDateSafe(e.timeCreated))),1)]),_:1})]),_:1})):A("",!0)]),_:1})]),_:1})]),_:1})],64)}const us=ye(rs,[["render",cs]]),ds={name:"Discussion",components:{Comment:us},props:["buildId"],setup(t){var f,m;const n=Le(),o=M(()=>n.state.user),{assertVerified:e}=et(),p=w(null),v=w({text:"",buildId:t.buildId,authorId:(f=o.value)==null?void 0:f.uid,author:(m=o.value)==null?void 0:m.displayName});Ie(async()=>
2{l()});const l=async()=>{p.value=await is(t.buildId)};return{comments:p,user:o,post:async()=>{var d;e()&&(d=v.value.text)!=null&&d.trim()&&(v.value.text.length>500||(await ls(v.value),await Ao(t.buildId),v.value.text=null,l()))},init:l,newComment:v}}},fs={class:"build-card-section-header d-flex align-center px-4 ga-2"};function ms(t,n,o,e,p,v){const l=ie("Comment");return u(),j(Te,{rounded:"lg",flat:""},{default:a(()=>[r("div",fs,[i(te,{size:"16",color:"accent"},{default:a(()=>n[1]||(n[1]=[C("mdi-comment-outline")])),_:1}),n[2]||(n[2]=r("span",{class:"text-caption text-uppercase font-weight-bold"},"Comments",-1))]),i(Ze,{"no-gutters":"",align:"center",class:"ma-4"},{default:a(()=>[e.user?A("",!0):(u(),j(Ae,{key:0,align:"center",class:"pa-2 ma-2"},{default:a(()=>[r("div",null,[n[4]||(n[4]=r("span",null,"Would you like to leave messages for other villagers?",-1)),i(G,{class:"pb-1",color:"primary",style:{"background-color":"transparent"},variant:"plain",to:"/register"},{default:a(()=>n[3]||(n[3]=[C(" Register now! ")])),_:1})])]),_:1})),e.user?(u(),j(Ae,{key:1},{default:a(()=>[i(Bn,{label:"Write a comment",modelValue:e.newComment.text,"onUpdate:modelValue":n[0]||(n[0]=c=>e.newComment.text=c),value:e.newComment.text,rows:"2","auto-grow":"",clearable:"",maxlength:"500",counter:"500"},null,8,["modelValue","value"])]),_:1})):A("",!0),e.user?(u(),j(Ae,{key:2,cols:"auto"},{default:a(()=>[i(Q,{location:"top"},{activator:a(({props:c})=>[i(G,K(c,{color:"accent",variant:"text",class:"ml-4 mb-5",icon:"mdi-send",onClick:e.post}),null,16,["onClick"])]),default:a(()=>[r("span",{style:N({color:t.$vuetify.theme.current.colors.primary})},"Post Comment",4)]),_:1})]),_:1})):A("",!0)]),_:1}),(u(!0),b(W,null,ae(e.comments,c=>(u(),b("div",{key:c.id},[i(l,{onCommentRemoved:e.init,comment:c},null,8,["onCommentRemoved","comment"])]))),128))]),_:1})}const vs=ye(ds,[["render",ms],["__scopeId","data-v-131c01c4"]]),ps={name:"BuildNotFound",setup(){}};function hs(t,n,o,e,p,v){return u(),j(zn,{rounded:"lg",outlined:"",color:"accent",class:"pa-1"},{default:a(()=>[i(Te,{flat:"",rounded:"lg"},{default:a(()=>[i(vt,null,{default:a(()=>n[0]||(n[0]=[C("Build Order Not Found")])),_:1}),i(Pe,null,{default:a(()=>n[1]||(n[1]=[C("The requested build order was not found."),r("br",null,null,-1),C(" Please make sure the build order exists or create a new Age of Empires 4 build order.")])),_:1}),i(Ze,{class:"ma-2","no-gutters":"",justify:"center"},{default:a(()=>[i(G,{color:"primary",style:{"background-color":"transparent"},variant:"text",to:"/"},{default:a(()=>n[2]||(n[2]=[C(" Home ")])),_:1}),i(G,{color:"primary",style:{"background-color":"transparent"},variant:"text",to:"/builds/new"},{default:a(()=>n[3]||(n[3]=[C(" Create New Build Order ")])),_:1})]),_:1})]),_:1})]),_:1})}const gs=ye(ps,[["render",hs]]),ys="#294790",bs="#FFFFFF",ks={name:"BuildShareDialog",components:{PickerDialog:po},props:{build:{type:Object,required:!0},modelValue:{type:Boolean,required:!0}},emits:["update:modelValue"],setup(t){const n=M(()=>`${window.location.origin}/builds/${t.build.id}`),o=M(()=>`${n.value}?focus=true`),e=w("pending"),p=w(null),v=w(null);async function l(){if(v.value!==o.value){e.value="pending";try{const d=(await ho(async()=>{const{default:k}=await import("./browser-4TgWC70o.js").then(S=>S.b);return{default:k}},__vite__mapDeps([0,1]))).default;p.value=await d.toDataURL(o.value,{width:220,margin:4,color:{dark:ys,light:bs}}),v.value=o.value,e.value="ready"}catch{e.value="failed"}}}Me(()=>t.modelValue,d=>{d&&l()},{immediate:!0});const{share:c,isSupported:f}=Xn();return{qrState:e,qrDataUrl:p,shareIsSupported:f,handleShare:async()=>{try{await c({title:t.build.title,url:n.value})}catch{}}}}},ws={class:"qr-surface mx-auto d-flex align-center justify-center"},Ss=["src","alt"],_s={key:2,class:"text-caption text-medium-emphasis text-center px-4"};function Cs(t,n,o,e,p,v){const l=ie("PickerDialog");return u(),j(l,{"model-value":o.modelValue,title:"Share Build Order","title-icon":"mdi-share-variant","max-width":"380","onUpdate:modelValue":n[0]||(n[0]=c=>t.$emit("update:modelValue",c))},{default:a(()=>[i(Pe,{class:"px-6 pt-2 pb-5"},{default:a(()=>[r("div",ws,[e.qrState==="pending"?(u(),j(Gn,{key:0,indeterminate:"",size:"32",color:"grey-darken-1"})):e.qrState==="ready"?(u(),b("img",{key:1,src:e.qrDataUrl,alt:`QR code opening ${o.build.title} in focus mode`,class:"qr-image"},null,8,Ss)):(u(),b("span",_s," QR code unavailable "))]),n[2]||(n[2]=r("p",{class:"text-caption text-medium-emphasis text-center mt-3 mb-0"}," Scan to open on your phone in focus mode ",-1)),e.shareIsSupported?(u(),j(G,{key:0,color:"primary",variant:"flat","prepend-icon":"mdi-export-variant",block:"",class:"mt-4",onClick:e.handleShare},{default:a(()=>n[1]||(n[1]=[C(" Share link ")])),_:1},8,["onClick"])):A("",!0)]),_:1})]),_:1},8,["model-value"])}const Es=ye(ks,[["render",Cs],["__scopeId","data-v-f59e6c63"]]),Vs={name:"BuildDetails",components:{Favorite:Jo,Vote:fl,Discussion:vs,BuildOrderEditor:$n,AgeTimeline:es,FocusMode:cl,BuildNotFound:gs,BuildHeader:Zn,BuildShareDialog:Es},props:["id"],setup(t){const n=eo();Ft(pt,n);const o=tn();Ft(on,o),o.onSwitch(()=>{n.clear("plot"),n.clear("table")});const e=w(null),p=to(e),v=Le(),l=yo(),c=go(),{assertVerified:f}
2=et(),m=M(()=>v.state.user),d=w(null),k=w(!1),S=w(!1),E=w(!1),{convert:I}=no(),{copyToClipboard:h,copyToClipboardSupported:V}=Ho(),{download:D}=oo(),q=w(null),Z=w(!0),pe=w(!1),U=w(!1),O=w(!0),le=w(null),se=w(0),oe=y=>{if(y==="phone"){E.value=!0,st("phone");return}se.value=y==="floating"?se.value+1:0,S.value=!0,y==="here"&&st("here")},$=()=>{st("floating")},ke=()=>{v.dispatch("showSnackbar",{text:"Your browser blocked the floating window. Playing here instead.",type:"info"})};return Me(()=>c.fullPath,()=>{var y,x;(x=(y=le.value)==null?void 0:y.closePiP)==null||x.call(y),S.value=!1}),Me(S,y=>{var x,z;y||(z=(x=le.value)==null?void 0:x.closePiP)==null||z.call(x)}),Ie(async()=>{const y=t.id in v.state.cache.builds?v.state.cache.builds[t.id]:null,[x,z]=await Promise.all([y?Promise.resolve(y):To(t.id),m.value?an(m.value.uid):Promise.resolve(null)]);x&&(m.value&&(q.value=z),d.value=x,document.title=d.value.title+" - "+document.title,Po(t.id),Go(d.value.authorUid)),c.query&&(pe.value=c.query.focus),U.value=await V(),Z.value=!1}),{build:d,props:t,user:m,userData:q,loading:Z,swipe:async y=>{switch(y){case"Up":v.commit("setShowBottomNavigation",!1);break;case"Down":v.commit("setShowBottomNavigation",!0);break}},focusMode:pe,timelineEl:e,timelineVisible:p,deleteDialog:k,focusDialog:S,shareDialog:E,focusModeRef:le,popOutRequest:se,handlePlay:oe,handlePoppedOut:$,handlePopOutFailed:ke,descriptionExpanded:O,handlePublish:async()=>{d.value.isDraft=!1,await Do(t.id,d.value,!0),Mt.value||(v.dispatch("showSnackbar",{text:"Draft published successfully!",type:"success"}),l.replace("/builds/"+t.id))},handleDelete:async()=>{var y;if(await Io(t.id),!Mt.value){v.dispatch("showSnackbar",{text:"Build order deleted!",type:"success"}),jo(d.value.authorUid),qo(d.value.authorUid,d.value.views+1),v.commit("setRecentBuildsList",null),v.commit("removeBuild",t.id);const x=["/builds","/mybuilds","/favorites","/dashboard"],z=(y=window.history.state)==null?void 0:y.back,H=typeof z=="string"&&x.includes(z.split("?")[0]);l.replace(H?z:"/")}k.value=!1},handleRemix:async()=>{var x;if(f()){var y={author:"",authorUid:"",remixOf:((x=m.value)==null?void 0:x.uid)===d.value.authorUid?null:{id:d.value.id,title:d.value.title,author:d.value.author??"",authorUid:d.value.authorUid??""},description:d.value.description,title:d.value.title+" (remix)",sortTitle:"",steps:d.value.steps,video:d.value.video,civ:d.value.civ,map:d.value.map||"",season:d.value.season,strategy:d.value.strategy,isDraft:!1,views:0,likes:0,score:0,comments:0,scoreAllTime:0,timeCreated:null,timeUpdated:null};v.commit("setTemplate",y),l.push({name:"BuildNew"})}},handleCopyOverlayFormat:async()=>{const y=I(d.value,o.paths.value),x=JSON.stringify(y,null,3),z=await h(x);v.dispatch("showSnackbar",{text:z?"Build order copied to clipboard!":"Could not copy to clipboard. Try the download option instead.",type:z?"success":"error"})},handleDownloadOverlayFormat:()=>{const y=I(d.value,o.paths.value),x=JSON.stringify(y,null,3);D(x,d.value.title)},handleOpenInOverlayTool:y=>{y.stopPropagation();const z=`https://rts-overlay.github.io/?gameId=aoe4&buildOrderId=aoe4guides|${d.value.id}`;window.open(z,"_blank").focus()},clipboardIsSupported:U}}},xs={class:"d-none d-md-flex align-center"},As={class:"d-flex align-center ga-1 ml-4"},Ts={key:0,class:"d-flex d-md-none align-center"},Ps={class:"d-md-none"},Is={class:"d-none d-md-flex build-card-section-header align-center px-4 ga-2"},Ds={ref:"timelineEl"},Os={class:"build-card-section-header d-flex align-center px-4 ga-2"},Rs={class:"px-4 pb-4"},Fs={style:{"border-radius":"8px",overflow:"hidden","aspect-ratio":"16/9"}},Us=["src"],Ms={class:"mt-4"};function Ns(t,n,o,e,p,v){const l=ie("FocusMode"),c=ie("BuildNotFound"),f=ie("BuildShareDialog"),m=ie("Vote"),d=ie("Favorite"),k=ie("BuildHeader"),S=ie("AgeTimeline"),E=ie("BuildOrderEditor"),I=ie("Discussion");return u(),b(W,null,[i(ut,{modelValue:e.focusDialog,"onUpdate:modelValue":n[1]||(n[1]=h=>e.focusDialog=h),fullscreen:"","content-class":"focus-dialog",transition:"dialog-bottom-transition"},{default:a(()=>[i(l,{ref:"focusModeRef",onCloseDialog:n[0]||(n[0]=h=>e.focusDialog=!1),onPoppedOut:e.handlePoppedOut,onPopOutFailed:e.handlePopOutFailed,popOut:e.popOutRequest,build:e.build},null,8,["onPoppedOut","onPopOutFailed","popOut","build"])]),_:1},8,["modelValue"]),!e.loading&&!e.build?(u(),j(Ot,{key:0,align:"center"},{default:a(()=>[i(c)]),_:1})):A("",!0),e.build?ce((u(),j(Ot,{key:1},{default:a(()=>[i(ut,{modelValue:e.deleteDialog,"onUpdate:modelValue":n[2]||(n[2]=h=>e.deleteDialog=h),width:"auto"},{default:a(()=>[i(Te,{rounded:"lg",flat:"",class:"text-center primary"},{default:a(()=>[i(vt,null,{default:a(()=>n[15]||(n[15]=[C("Delete Build")])),_:1}),i(Pe,null,{default:a(()=>n[16]||(n[16]=[C(" Do you really want to delete this build?"),r("br",null,null,-1),C(" The action cannot be undone. ")])),_:1}),i($t,null,{default:a(()=>[i(G,{type:"button",color:"error",block:"",onClick:e.handleDelete},{default:a(()=>n[17]||(n[17]=[C("Delete")])),_:1},8,["onClick"])]),_:1})]),_:1})]),_:1},8,["modelValue"]),i(f,{modelValue:e.shareDialog,"onUpdate:modelValue":n[3]||(n[3]=h=>e.shareDialog=h),build:e.build},null,8,["modelValue","build"]),i(k,{build:e.build,readonly:!0},{actions:a(()=>[r("div",xs,[e.userData?(u(),j(m,{key:0,modelValue:e.userData,"onUpdate:modelValue":n[4]||(n[4]=h=>e.userData=h),buildId:e.build.id,onVoteUpAdded:n[5]||(n[5]=()=>{e.build.upvotes++}),onVoteUpRemoved:n[6]||(n[6]=()=>{e.build.upvotes--})},null,8,["modelValue","buildId"])):A("",!0),e.userData?(u(),j(d,{key:1,modelValue:e.userData,"onUpdate:modelValue":n[7]||(n[7]=h=>e.userData=h),buildId:e.build.id},null,8,["modelValue","buildId"])):A("",!0)]),i(jn,null,{activator:a(({props:h})=>[i(G,K({icon:"mdi-dots-vertical",color:"accent",variant:"text"},h),null,16)]),default:a(({isActive:h})=>[i(qn,null,{default:a(()=>{var V;return[i(Q,null,{activator:a(({props:D})=>{var q;return[ce(i(Fe,K({to:{name:"BuildEdit",params:{id:o.id}}},D),{default:a(()=>[i(te,{color:"accent",class:"mr-4"},{default:a(()=>n[18]||(n[18]=[C("mdi-pencil")])),_:1}),n[19]||(n[19]=C(" Edit "))]),_:2},1040,["to"]),[[me,((q=e.user)==null?void 0:q.uid)===e.build.authorUid]])]}),default:a(()=>[r("span",{style:N({color:t.$vuetify.theme.current.colors.primary})},"Change the steps, timings or details of this build order",4)]),_:1}),i(Q,null,{activator:a(({props:D})=>[ce(i(Fe,K(D,{onClick:e.handlePublish}),{default:a(()=>[i(te,{color:"accent",class:"mr-4"},{default:a(()=>n[20]||(n[20]=[C("mdi-publish")])),_:1}),n[21]||(n[21]=C(" Publish "))]),_:2},1040,["onClick"]),[[me,e.user&&e.build.isDraft]])]),default:a(()=>[r("span",{style:N({color:t.$vuetify.theme.current.colors.primary})},"Make this draft public so other players can find it",4)]),_:1}),i(Q,null,{activator:a(({props:D})=>[ce(i(Fe,K(D,{onClick:e.handleRemix}),{default:a(()=>[i(te,{color:"accent",class:"mr-4"},{default:a(()=>n[22]||(n[22]=[C("mdi-shuffle-variant")])),_:1}),n[23]||(n[23]=C(" Remix "))]),_:2}
2,1040,["onClick"]),[[me,e.user]])]),default:a(()=>[r("span",{style:N({color:t.$vuetify.theme.current.colors.primary})},"Start your own build order from a copy of this one",4)]),_:1}),i(Q,null,{activator:a(({props:D})=>[i(Fe,K(D,{onClick:n[8]||(n[8]=q=>e.shareDialog=!0)}),{default:a(()=>[i(te,{color:"accent",class:"mr-4"},{default:a(()=>n[24]||(n[24]=[C("mdi-share-variant")])),_:1}),n[25]||(n[25]=C(" Share "))]),_:2},1040)]),default:a(()=>[r("span",{style:N({color:t.$vuetify.theme.current.colors.primary})},"Get a link or QR code to this build order",4)]),_:1}),i(Fe,{onClick:e.handleOpenInOverlayTool},{append:a(()=>[r("div",As,[e.clipboardIsSupported?(u(),j(Q,{key:0},{activator:a(({props:D})=>[i(G,K(D,{icon:"mdi-content-copy",variant:"text",size:"small",color:"accent","aria-label":"Copy build order for the overlay tool",onClick:Rt(q=>{h.value=!1,e.handleCopyOverlayFormat()},["stop"])}),null,16,["onClick"])]),default:a(()=>[r("span",{style:N({color:t.$vuetify.theme.current.colors.primary})},"Copy this build order to clipboard for the overlay tool",4)]),_:2},1024)):A("",!0),i(Q,null,{activator:a(({props:D})=>[i(G,K(D,{icon:"mdi-download",variant:"text",size:"small",color:"accent","aria-label":"Download build order for the overlay tool",onClick:Rt(q=>{h.value=!1,e.handleDownloadOverlayFormat()},["stop"])}),null,16,["onClick"])]),default:a(()=>[r("span",{style:N({color:t.$vuetify.theme.current.colors.primary})},"Download this build order as a file for the overlay tool",4)]),_:2},1024)])]),default:a(()=>[i(Q,null,{activator:a(({props:D})=>[r("span",K({class:"d-flex align-center"},D),[i(te,{color:"accent",class:"mr-4"},{default:a(()=>n[26]||(n[26]=[C("mdi-button-cursor")])),_:1}),n[27]||(n[27]=C(" Open in RTS Overlay "))],16)]),default:a(()=>[r("span",{style:N({color:t.$vuetify.theme.current.colors.primary})},"Open this build order in the RTS Overlay web app, in a new tab",4)]),_:1})]),_:2},1032,["onClick"]),ce(i(Zt,null,null,512),[[me,((V=e.user)==null?void 0:V.uid)===e.build.authorUid]]),i(Q,null,{activator:a(({props:D})=>{var q;return[ce(i(Fe,K(D,{onClick:n[9]||(n[9]=Z=>e.deleteDialog=!0)}),{default:a(()=>[i(te,{color:"error",class:"mr-4"},{default:a(()=>n[28]||(n[28]=[C("mdi-delete")])),_:1}),n[29]||(n[29]=r("span",{style:{color:"rgb(var(--v-theme-error))"}},"Delete",-1))]),_:2},1040),[[me,((q=e.user)==null?void 0:q.uid)===e.build.authorUid]])]}),default:a(()=>[r("span",{style:N({color:t.$vuetify.theme.current.colors.primary})},"Remove this build order - This cannot be undone",4)]),_:1})]}),_:2},1024)]),_:1})]),"mobile-actions":a(()=>[e.userData?(u(),b("div",Ts,[i(m,{modelValue:e.userData,"onUpdate:modelValue":n[10]||(n[10]=h=>e.userData=h),buildId:e.build.id,onVoteUpAdded:n[11]||(n[11]=()=>{e.build.upvotes++}),onVoteUpRemoved:n[12]||(n[12]=()=>{e.build.upvotes--})},null,8,["modelValue","buildId"]),i(d,{modelValue:e.userData,"onUpdate:modelValue":n[13]||(n[13]=h=>e.userData=h),buildId:e.build.id},null,8,["modelValue","buildId"])])):A("",!0)]),_:1},8,["build"]),e.build.description?(u(),j(Te,{key:0,flat:"",rounded:"lg",class:"mt-4"},{default:a(()=>[r("div",{class:"d-md-none build-card-section-header d-flex align-center px-4 ga-2",style:{cursor:"pointer"},onClick:n[14]||(n[14]=h=>e.descriptionExpanded=!e.descriptionExpanded)},[i(te,{size:"16",color:"accent"},{default:a(()=>n[30]||(n[30]=[C("mdi-text-box-outline")])),_:1}),n[31]||(n[31]=r("span",{class:"text-caption text-uppercase font-weight-bold flex-grow-1"},"Description",-1)),i(te,{size:"16",icon:e.descriptionExpanded?"mdi-chevron-up":"mdi-chevron-down"},null,8,["icon"])]),i(Xt,null,{default:a(()=>[ce(r("div",Ps,[i(Pe,{style:{"white-space":"pre-line"}},{default:a(()=>[C(F(e.build.description),1)]),_:1})],512),[[me,e.descriptionExpanded]])]),_:1}),r("div",Is,[i(te,{size:"16",color:"accent"},{default:a(()=>n[32]||(n[32]=[C("mdi-text-box-outline")])),_:1}),n[33]||(n[33]=r("span",{class:"text-caption text-uppercase font-weight-bold"},"Description",-1))]),i(Pe,{class:"d-none d-md-block",style:{"white-space":"pre-line"}},{default:a(()=>[C(F(e.build.description),1)]),_:1})]),_:1})):A("",!0),r("div",Ds,[i(S,{steps:e.build.steps},null,8,["steps"])],512),i(E,{steps:e.build.steps,readonly:!0,civ:e.build.civ,focus:e.focusMode,"link-enabled":e.timelineVisible,onActivateFocusMode:e.handlePlay},null,8,["steps","civ","focus","link-enabled","onActivateFocusMode"]),e.build.video?(u(),j(Te,{key:1,flat:"",rounded:"lg",class:"mt-4"},{default:a(()=>[r("div",Os,[i(te,{size:"16",color:"accent"},{default:a(()=>n[34]||(n[34]=[C("mdi-youtube")])),_:1}),n[35]||(n[35]=r("span",{class:"text-caption text-uppercase font-weight-bold"},"Video",-1))]),r("div",Rs,[r("div",Fs,[r("iframe",{width:"100%",height:"100%",src:e.build.video,frameborder:"0",allowfullscreen:""},null,8,Us)])])]),_:1})):A("",!0),r("div",Ms,[i(I,{buildId:e.build.id},null,8,["buildId"])])]),_:1})),[[Jt,{up:()=>e.swipe("Up"),down:()=>e.swipe("Down")}]]):A("",!0)],64)}const Xs=ye(Vs,[["render",Ns],["__scopeId","data-v-ec3d338b"]]);export{Xs as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.