var t=Object.defineProperty,e=Object.prototype.hasOwnProperty,s=Object.getOwnPropertySymbols,n=Object.prototype.propertyIsEnumerable,a=(e,s,n)=>s in e?t(e,s,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[s]=n,r=(t,r)=>{for(var c in r||(r={}))e.call(r,c)&&a(t,c,r[c]);if(s)for(var c of s(r))n.call(r,c)&&a(t,c,r[c]);return t};import{S as c,i as l,s as o,e as i,t as $,k as u,c as h,a as p,g as f,d as m,n as d,b as g,f as v,F as y,G as b,H as w,I as x,J as E,K as I,L as k,M as D,N as M,U as P,_ as T,O as N,P as O,Q as V,R as A,T as S,V as q,h as C,W as L,X as F,Y as U,Z as j,j as z,m as B,o as H,v as G,r as R,w as W,$ as Y,a0 as J,a1 as X,a2 as Z,a3 as K,a4 as Q,l as tt,D as et,B as st,a5 as nt,u as at,E as rt,p as ct,q as lt,a6 as ot,A as it,a7 as $t,a8 as ut,a9 as ht,aa as pt,ab as ft,ac as mt,ad as dt,ae as gt,af as vt,ag as _t,x as yt}from"../chunks/vendor-7705c5be.js";function bt(t){let e,s,n,a,r,c,l,o,_;return{c(){e=i("header"),s=i("h1"),n=$("The Docks"),a=u(),r=i("h2"),c=$("a "),l=i("a"),o=$("Full Thrust"),_=$(" ship builder"),this.h()},l(t){e=h(t,"HEADER",{class:!0});var i=p(e);s=h(i,"H1",{class:!0});var $=p(s);n=f($,"The Docks"),$.forEach(m),a=d(i),r=h(i,"H2",{class:!0});var u=p(r);c=f(u,"a "),l=h(u,"A",{href:!0});var g=p(l);o=f(g,"Full Thrust"),g.forEach(m),_=f(u," ship builder"),u.forEach(m),i.forEach(m),this.h()},h(){g(s,"class","svelte-1me5k9w"),g(l,"href","https://shop.groundzerogames.co.uk/rules.html"),g(r,"class","svelte-1me5k9w"),g(e,"class","svelte-1me5k9w")},m(t,i){v(t,e,i),y(e,s),y(s,n),y(e,a),y(e,r),y(r,c),y(r,l),y(l,o),y(r,_)},p:b,i:b,o:b,d(t){t&&m(e)}}}class wt extends c{constructor(t){super(),l(this,t,null,bt,o,{})}}const xt=(t={})=>[D(["cost","mass"],t),...Object.values(t||{}).filter((t=>"object"==typeof t)).map((t=>xt(t)))];function Et(t){console.log(t);let{general:a}=t,c=((t,a)=>{var r={};for(var c in t)e.call(t,c)&&a.indexOf(c)<0&&(r[c]=t[c]);if(null!=t&&s)for(var c of s(t))a.indexOf(c)<0&&n.call(t,c)&&(r[c]=t[c]);return r})(t,["general"]);const l=w(xt,x,E(I("cost")))(r(r({},c),{cost:a.mass,mass:0}));return{mass:k("mass",l),cost:k("cost",l)}}const It=t=>Math.ceil(Math.round(10*t)/10);const kt=M("set_ftl",N()),Dt=M("set_ftl_reqs",N()),Mt=new P.default({initial:{mass:0,cost:0,type:"none"}});Mt.addMutation(kt,(t=>T({type:t}))),Mt.addMutation(Dt,(t=>T(t)));var Pt=Mt.asDux;const Tt=M("set_engine",N()),Nt=M("set_drive_reqs",N()),Ot=new P.default({initial:{mass:1,cost:2,rating:1}});Ot.addMutation(Tt,(t=>T(t))),Ot.addMutation(Nt,(t=>T(t)));var Vt=Ot.asDux;function At(t){return"beam"===t.weapon_type?function({weapon_class:t,arcs:e}){let s;1===t&&(s=1);2==t&&(s=2+(e.length>3?1:0));3==t&&(s=4,St(e)?s+=2:s+=e.length-1);4==t&&(s=8,St(e)?s+=4:s+=2*(e.length-1));return{mass:s,cost:3*s}}(t):"submunition"==t.weapon_type||"pds"===t.weapon_type?{mass:1,cost:3}:"scattergun"===t.weapon_type?{mass:1,cost:4}:"needle"===t.weapon_type?{mass:2,cost:6}:{cost:0,mass:0}}const St=t=>4===t.length&&!t.some((t=>1===t.length));const qt=M("add_weapon",N()),Ct=M("remove_weapon",N()),Lt=(Ft=t=>T(At(t)),t=>Ft(t)(t));var Ft;const Ut=new P.default({initial:[]}),jt={beam:{weapon_type:"beam",weapon_class:1,arcs:["F","A","FS","FP","AS","AP"]},submunition:{weapon_type:"submunition",arcs:["F"]},pds:{weapon_type:"pds"},scattergun:{weapon_type:"scattergun"},needle:{weapon_type:"needle",arcs:["F"]}};Ut.addMutation(qt,(t=>e=>{const s=1+Math.max(0,...e.map((({id:t})=>t)));return[...e,r(r({},Lt(jt[t])),{id:s})]})),Ut.addMutation(Ct,(t=>e=>e.filter((e=>e.id!==t))));const zt=M("set_weapon",N());Ut.addMutation(zt,(t=>T.map(T.if(_.matches({id:t.id}),(e=>Lt(T(t,e)))))));var Bt=Ut.asDux;const Ht=new P.default({initial:{rating:0,cost:0,mass:0}});Ht.addMutation(M("set_adfc",N()),(t=>T({rating:t,mass:2*t,cost:8*t})));var Gt=Ht.asDux;var Rt=new P.default({initial:{firecons:{nbr:0,cost:0,mass:0}},subduxes:{weapons:Bt,adfc:Gt}}).asDux;const Wt=[{name:"Scout",mass:[4,10],abbrev:"SC"},{name:"Courier",mass:[4,10],abbrev:"SC"},{name:"Corvette",mass:[8,16],abbrev:"CT"},{name:"Frigate",mass:[14,28],abbrev:"FF"},{name:"Destroyer",mass:[24,36],abbrev:"DD"},{name:"Heavy Destroyer",mass:[30,40],abbrev:"DH"},{name:"Light Cruiser",mass:[40,60],abbrev:"CL"},{name:"Patrol",mass:[50,70],abbrev:"CE"},{name:"Escort Cruiser",mass:[50,70],abbrev:"CE"},{name:"Heavy Cruiser",mass:[60,90],abbrev:"CA"},{name:"Battlecruiser",mass:[80,110],abbrev:"BC"},{name:"Battleship",mass:[100,140],abbrev:"BB"},{name:"Heavy Battleship",mass:[120,160],abbrev:"BDN"},{name:"Dreadnought",mass:[140,180],abbrev:"DN"},{name:"Superdreadnought",mass:[160,300],abbrev:"SDN"},{name:"Escort Carrier",mass:[60,140],abbrev:"CVE",carrier:!0},{name:"Light Carrier",mass:[120,180],abbrev:"CVL",carrier:!0},{name:"Heavy Carrier",mass:[160,300],abbrev:"CVH",carrier:!0},{name:"Attack Carrier",mass:[150,300],abbrev:"CVA",carrier:!0}];function Yt(t=0,e=!1){return console.log({carrier:e}),Wt.filter((t=>e==!!t.carrier)).filter((e=>e.mass[0]<=t)).filter((e=>e.mass[1]>=t))}const Jt=new P.default({initial:{standard:0,advanced:0,cost:0,mass:0}}),Xt=M("set_screens",N());Jt.addMutation(Xt,(t=>T(t)));const Zt=M("set_screens_reqs",N());Jt.addMutation(Zt,(t=>T(t)));var Kt=Jt.asDux;const Qt=new P.default({initial:[]}),te=M("set_armour_nbr_layers",N());Qt.addMutation(te,(t=>e=>(e.length>t&&(e=e.slice(0,t)),e.length[]))].flat()),e=T.map(((t,e)=>r({layer:e+1,rating:0,cost:0,mass:0},t)),e)))),Qt.addMutation(M("set_armour_layer",N()),(({layer:t,rating:e})=>T.map(T.if(O.matches({layer:t}),T({rating:e,cost:2*t*e,mass:2*e})))));var ee=Qt.asDux;var se=new P.default({initial:{mass:0,cost:0,hull:{rating:1,advanced:!1,cost:2,mass:1}},subduxes:{screens:Kt,armour:ee}}).asDux;const ne=new P.default({initial:{space:0,cost:0,mass:0}}),ae=M("set_cargo",N());ne.addMutation(ae,(t=>()=>({space:t,cost:0,mass:t})));var re=ne.asDux;const ce=new P.default({initial:{type:"none",cost:0,mass:0}}),le=M("set_streamlining",N());ce.addMutation(le,(t=>T({type:t})));const oe=M("set_streamlining_cost_mass",N());ce.addMutation(oe,(t=>T(t)));var ie=ce.asDux,$e=[{type:"standard",cost:3},{type:"fast",cost:4},{type:"heavy",cost:5},{type:"interceptor",cost:3},{type:"attack",cost:4},{type:"long range",cost:4},{type:"torpedo",cost:6}];const ue=new P.default({initial:{bays:0,cost:0,mass:0,squadrons:[]}}),he=M("set_squadron",N());ue.addMutation(he,(({id:t,type:e})=>T({squadrons:T.map(T.if(O.matches({id:t}),T({type:e,cost:6*O.find($e,{type:e}).cost,mass:6})))})));const pe=M("set_carrier_bays",N());ue.addMutation(pe,(t=>e=>((e=T({bays:t,mass:9*t,cost:27*t})(e)).squadrons.length>t&&(e=T({squadrons:e=>e.slice(0,t)},e)),e.squadrons.length[...s,...O.times(t-e.squadrons.length,(t=>({id:1+t+e.squadrons.length,cost:6*$e[0].cost,mass:6,type:$e[0].type})))]},e)),e)));var fe=ue.asDux;const me=M("set_ship_mass",N()),de=M("set_name",N()),ge=M("set_ship_reqs",N()),ve=M("set_hull",N()),_e=M("set_ship_type",N()),ye=M("reset"),be={general:{ship_class:"",name:"",ship_type:"",mass:10,used_mass:0,cost:10}},we=new P.default({subduxes:{ftl:Pt,engine:Vt,weaponry:Rt,structure:se,cargo:re,streamlining:ie,carrier:fe},initial:be});we.addMutation(ye,(()=>()=>be)),we.addMutation(ve,(({rating:t})=>e=>T.updateIn("structure.hull",{cost:2*t,rating:t,mass:t})(e))),we.addMutation(me,(t=>T.updateIn("general",{mass:t}))),we.addMutation(de,(t=>T.updateIn("general",{name:t}))),we.addMutation(M("set_ship_class",N()),(t=>T.updateIn("general",{ship_class:t}))),we.addMutation(ge,(({cost:t,mass:e})=>T.updateIn("general",{cost:t,used_mass:e}))),we.addSubscription((t=>V(Et,(e=>t.dispatch(ge(e)))))),we.addSubscription((t=>V((t=>t.general.mass),(t=>t.streamlining.type),((e,s)=>{const n=It(e*("none"===s?0:"partial"===s?5:10)/100),a=2*n;t.dispatch(we.actions.set_streamlining_cost_mass({cost:a,mass:n}))})))),we.addSubscription((t=>V((t=>t.general.mass),(t=>t.general.ship_type),(t=>t.carrier.bays),((e,s,n)=>{console.log({bays:n});const a=Yt(e,n>0);console.log({candidates:a}),0!==a.length&&(a.find((({name:t})=>t===s))||t.dispatch(t.actions.set_ship_type(a[0].name)))})))),we.addMutation(_e,(t=>T.updateIn("general.ship_type",t))),we.addSubscription((t=>V([t=>t.general.mass,t=>t.ftl.type],((e,s)=>t.dispatch(Pt.actions.set_ftl_reqs(function(t,e){if("none"===t)return{cost:0,mass:0};const s=Math.ceil(e/10);return{mass:s,cost:s*("advanced"===t?3:2)}}(s,e))))))),we.addSubscription((t=>V((t=>t.general.mass),(t=>t.structure.screens.standard),(t=>t.structure.screens.advanced),((e,s,n)=>{console.log({mass:e,standard:s,advanced:n});const a=s*Math.max(3,It(.05*e)),r=n*Math.max(4,It(.075*e));t.dispatch(we.actions.set_screens_reqs({mass:a+r,cost:3*a+4*r}))})))),we.addSubscription((t=>V([t=>t.general.mass,t=>t.engine.rating,t=>t.engine.advanced],((e,s,n)=>t.dispatch(we.actions.set_drive_reqs(function(t,e,s=!1){const n=Math.ceil(.05*e*t);return{mass:n,cost:n*(s?3:2)}}(e,s,n)))))));const xe=M("set_firecons",N());we.addMutation(xe,(t=>T.updateIn("weaponry.firecons",r({nbr:t},(t=>({cost:4*t,mass:t}))(t)))));var Ee=we.asDux;let Ie=q;Ie=window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__;function ke(t){let e,s,n,a,r,c;return{c(){e=i("aside"),s=i("pre"),n=i("code"),a=$(t[0]),this.h()},l(r){e=h(r,"ASIDE",{class:!0});var c=p(e);s=h(c,"PRE",{class:!0});var l=p(s);n=h(l,"CODE",{});var o=p(n);a=f(o,t[0]),o.forEach(m),l.forEach(m),c.forEach(m),this.h()},h(){g(s,"class","svelte-2g9858"),g(e,"class","svelte-2g9858")},m(t,r){v(t,e,r),y(e,s),y(s,n),y(n,a),c=!0},p(t,[e]){(!c||1&e)&&C(a,t[0])},i(t){c||(L((()=>{r||(r=F(e,U,{},!0)),r.run(1)})),c=!0)},o(t){r||(r=F(e,U,{},!1)),r.run(0),c=!1},d(t){t&&m(e),t&&r&&r.end()}}}function De(t,e,s){let n,{ship:a={}}=e;return j(),t.$$set=t=>{"ship"in t&&s(1,a=t.ship)},t.$$.update=()=>{2&t.$$.dirty&&s(0,n=JSON.stringify(a,null,2))},[n,a]}class Me extends c{constructor(t){super(),l(this,t,De,ke,o,{ship:1})}}function Pe(t){let e,s;return{c(){e=i("div"),s=$(t[0]),this.h()},l(n){e=h(n,"DIV",{class:!0});var a=p(e);s=f(a,t[0]),a.forEach(m),this.h()},h(){g(e,"class","svelte-1oeefsn")},m(t,n){v(t,e,n),y(e,s)},p(t,[e]){1&e&&C(s,t[0])},i:b,o:b,d(t){t&&m(e)}}}function Te(t,e,s){let{cost:n=0}=e;return t.$$set=t=>{"cost"in t&&s(0,n=t.cost)},[n]}class Ne extends c{constructor(t){super(),l(this,t,Te,Pe,o,{cost:0})}}function Oe(t){let e,s;return{c(){e=i("div"),s=$(t[0]),this.h()},l(n){e=h(n,"DIV",{class:!0});var a=p(e);s=f(a,t[0]),a.forEach(m),this.h()},h(){g(e,"class","svelte-wps6ap")},m(t,n){v(t,e,n),y(e,s)},p(t,[e]){1&e&&C(s,t[0])},i:b,o:b,d(t){t&&m(e)}}}function Ve(t,e,s){let{mass:n=0}=e;return t.$$set=t=>{"mass"in t&&s(0,n=t.mass)},[n]}class Ae extends c{constructor(t){super(),l(this,t,Ve,Oe,o,{mass:0})}}function Se(t){let e,s,n,a,r,c,l,o,_,b,w,x,E,I,k;return x=new Ne({props:{cost:t[2]}}),I=new Ae({props:{mass:t[3]}}),{c(){e=i("h1"),s=$("ship name: "),n=i("div"),a=u(),r=i("div"),c=i("h2"),l=$(t[0]),o=$("-class, "),_=$(t[1]),b=u(),w=i("div"),z(x.$$.fragment),E=$("\n  \n "),z(I.$$.fragment),this.h()},l(i){e=h(i,"H1",{class:!0});var $=p(e);s=f($,"ship name: "),n=h($,"DIV",{class:!0}),p(n).forEach(m),$.forEach(m),a=d(i),r=h(i,"DIV",{class:!0});var u=p(r);c=h(u,"H2",{class:!0});var g=p(c);l=f(g,t[0]),o=f(g,"-class, "),_=f(g,t[1]),g.forEach(m),b=d(u),w=h(u,"DIV",{class:!0});var v=p(w);B(x.$$.fragment,v),E=f(v,"\n  \n "),B(I.$$.fragment,v),v.forEach(m),u.forEach(m),this.h()},h(){g(n,"class","fill svelte-bo35k"),g(e,"class","svelte-bo35k"),g(c,"class","svelte-bo35k"),g(w,"class","reqs svelte-bo35k"),g(r,"class","details svelte-bo35k")},m(t,i){v(t,e,i),y(e,s),y(e,n),v(t,a,i),v(t,r,i),y(r,c),y(c,l),y(c,o),y(c,_),y(r,b),y(r,w),H(x,w,null),y(w,E),H(I,w,null),k=!0},p(t,[e]){(!k||1&e)&&C(l,t[0]),(!k||2&e)&&C(_,t[1]);const s={};4&e&&(s.cost=t[2]),x.$set(s);const n={};8&e&&(n.mass=t[3]),I.$set(n)},i(t){k||(G(x.$$.fragment,t),G(I.$$.fragment,t),k=!0)},o(t){R(x.$$.fragment,t),R(I.$$.fragment,t),k=!1},d(t){t&&m(e),t&&m(a),t&&m(r),W(x),W(I)}}}function qe(t,e,s){let{ship_class:n}=e,{ship_type:a}=e,{cost:r}=e,{mass:c=0}=e;return t.$$set=t=>{"ship_class"in t&&s(0,n=t.ship_class),"ship_type"in t&&s(1,a=t.ship_type),"cost"in t&&s(2,r=t.cost),"mass"in t&&s(3,c=t.mass)},[n,a,r,c]}class Ce extends c{constructor(t){super(),l(this,t,qe,Se,o,{ship_class:0,ship_type:1,cost:2,mass:3})}}function Le(t){let e,s;return{c(){e=i("img"),this.h()},l(t){e=h(t,"IMG",{class:!0,src:!0,alt:!0}),this.h()},h(){g(e,"class","ftl svelte-w7le23"),e.src!==(s="icons/ftl-drive.svg")&&g(e,"src","icons/ftl-drive.svg"),g(e,"alt","ftl drive")},m(t,s){v(t,e,s)},d(t){t&&m(e)}}}function Fe(t){let e,s;return{c(){e=i("div"),s=$(t[1]),this.h()},l(n){e=h(n,"DIV",{class:!0});var a=p(e);s=f(a,t[1]),a.forEach(m),this.h()},h(){g(e,"class","thrust svelte-w7le23")},m(t,n){v(t,e,n),y(e,s)},p(t,e){2&e&&C(s,t[1])},d(t){t&&m(e)}}}function Ue(t){let e,s,n,a,r,c="none"!==t[0]&&Le(),l=t[1]>0&&Fe(t);return{c(){e=i("div"),c&&c.c(),s=u(),l&&l.c(),n=u(),a=i("img"),this.h()},l(t){e=h(t,"DIV",{class:!0});var r=p(e);c&&c.l(r),s=d(r),l&&l.l(r),n=d(r),a=h(r,"IMG",{class:!0,src:!0,alt:!0}),r.forEach(m),this.h()},h(){g(a,"class","internal svelte-w7le23"),a.src!==(r="icons/internal-systems.svg")&&g(a,"src","icons/internal-systems.svg"),g(a,"alt","internal systems"),g(e,"class","main_systems svelte-w7le23")},m(t,r){v(t,e,r),c&&c.m(e,null),y(e,s),l&&l.m(e,null),y(e,n),y(e,a)},p(t,[a]){"none"!==t[0]?c||(c=Le(),c.c(),c.m(e,s)):c&&(c.d(1),c=null),t[1]>0?l?l.p(t,a):(l=Fe(t),l.c(),l.m(e,n)):l&&(l.d(1),l=null)},i:b,o:b,d(t){t&&m(e),c&&c.d(),l&&l.d()}}}function je(t,e,s){let{ftl:n="none"}=e,{engine:a=0}=e;return t.$$set=t=>{"ftl"in t&&s(0,n=t.ftl),"engine"in t&&s(1,a=t.engine)},[n,a]}class ze extends c{constructor(t){super(),l(this,t,je,Ue,o,{ftl:0,engine:1})}}function Be(t,e,s){const n=t.slice();return n[7]=e[s],n[9]=s,n}function He(t,e,s){const n=t.slice();return n[10]=e[s],n[12]=s,n}function Ge(t){let e,s;return{c(){e=i("img"),this.h()},l(t){e=h(t,"IMG",{src:!0,alt:!0,class:!0}),this.h()},h(){e.src!==(s="icons/crew-star.svg")&&g(e,"src","icons/crew-star.svg"),g(e,"alt","crew loss threshold"),g(e,"class","svelte-qekx9g")},m(t,s){v(t,e,s)},d(t){t&&m(e)}}}function Re(t,e){let s,n=e[10]&&Ge();return{key:t,first:null,c(){s=i("div"),n&&n.c(),this.h()},l(t){s=h(t,"DIV",{class:!0});var e=p(s);n&&n.l(e),e.forEach(m),this.h()},h(){g(s,"class","cell svelte-qekx9g"),this.first=s},m(t,e){v(t,s,e),n&&n.m(s,null)},p(t,a){(e=t)[10]?n||(n=Ge(),n.c(),n.m(s,null)):n&&(n.d(1),n=null)},d(t){t&&m(s),n&&n.d()}}}function We(t,e){let s,n,a=[],r=new Map,c=e[7];const l=t=>t[12];for(let o=0;ot[9];for(let c=0;c{"ship_mass"in t&&s(1,c=t.ship_mass),"rating"in t&&s(2,l=t.rating),"advanced"in t&&s(3,o=t.advanced)},t.$$.update=()=>{8&t.$$.dirty&&s(4,n=o?3:4),4&t.$$.dirty&&s(5,a=Array(l).fill(!1)),2&t.$$.dirty&&s(6,r=It(c/20)),96&t.$$.dirty&&s(5,a=Je(a,r).map((t=>(t[t.length-1]=!0,t))).flat()),48&t.$$.dirty&&s(0,i=Je(a,n))},[i,c,l,o,n,a,r]}class Ze extends c{constructor(t){super(),l(this,t,Xe,Ye,o,{ship_mass:1,rating:2,advanced:3})}}function Ke(t,e,s){const n=t.slice();return n[1]=e[s],n}function Qe(t,e,s){const n=t.slice();return n[4]=e[s],n}function ts(t,e){let s;return{key:t,first:null,c(){s=i("div"),this.h()},l(t){s=h(t,"DIV",{class:!0}),p(s).forEach(m),this.h()},h(){g(s,"class","cell svelte-15e5q3d"),this.first=s},m(t,e){v(t,s,e)},p(t,e){},d(t){t&&m(s)}}}function es(t,e){let s,n,a=[],r=new Map,c=O.range(e[1].rating);const l=t=>t[4];for(let o=0;ot[1];for(let c=0;c{"armour"in t&&s(0,n=t.armour)},t.$$.update=()=>{1&t.$$.dirty&&console.log(n)},[n]}class as extends c{constructor(t){super(),l(this,t,ns,ss,o,{armour:0})}}function rs(t){let e,s,n,a,r;return s=new as({props:{armour:t[0].armour}}),a=new Ze({props:{rating:t[0].hull.rating,advanced:t[0].hull.advanced,ship_mass:t[1]}}),{c(){e=i("div"),z(s.$$.fragment),n=u(),z(a.$$.fragment)},l(t){e=h(t,"DIV",{});var r=p(e);B(s.$$.fragment,r),n=d(r),B(a.$$.fragment,r),r.forEach(m)},m(t,c){v(t,e,c),H(s,e,null),y(e,n),H(a,e,null),r=!0},p(t,[e]){const n={};1&e&&(n.armour=t[0].armour),s.$set(n);const r={};1&e&&(r.rating=t[0].hull.rating),1&e&&(r.advanced=t[0].hull.advanced),2&e&&(r.ship_mass=t[1]),a.$set(r)},i(t){r||(G(s.$$.fragment,t),G(a.$$.fragment,t),r=!0)},o(t){R(s.$$.fragment,t),R(a.$$.fragment,t),r=!1},d(t){t&&m(e),W(s),W(a)}}}function cs(t,e,s){let{structure:n={}}=e,{ship_mass:a=0}=e;return t.$$set=t=>{"structure"in t&&s(0,n=t.structure),"ship_mass"in t&&s(1,a=t.ship_mass)},[n,a]}class ls extends c{constructor(t){super(),l(this,t,cs,rs,o,{structure:0,ship_mass:1})}}function os(t){let e,s,n,a;return{c(){e=X("g"),s=X("path"),this.h()},l(t){e=h(t,"g",{transform:!0},1);var n=p(e);s=h(n,"path",{d:!0,class:!0},1),p(s).forEach(m),n.forEach(m),this.h()},h(){g(s,"d",t[1]),g(s,"class","svelte-7q6uh5"),Z(s,"active",t[0]),g(e,"transform",t[2])},m(r,c){v(r,e,c),y(e,s),n||(a=K(s,"click",t[7]),n=!0)},p(t,[n]){2&n&&g(s,"d",t[1]),1&n&&Z(s,"active",t[0]),4&n&&g(e,"transform",t[2])},i:b,o:b,d(t){t&&m(e),n=!1,a()}}}function is(t,e,s){let{arc:n}=e,{radius:a}=e,{active:r=!1}=e;const c={F:0,FS:300,AS:240,A:180,AP:120,FP:60};let l,o,i,$;return t.$$set=t=>{"arc"in t&&s(3,n=t.arc),"radius"in t&&s(4,a=t.radius),"active"in t&&s(0,r=t.active)},t.$$.update=()=>{16&t.$$.dirty&&s(5,l=Math.round(a*(1-Math.sin(60/180*Math.PI)))),16&t.$$.dirty&&s(6,o=Math.round(a*Math.cos(60/180*Math.PI))),112&t.$$.dirty&&s(1,i=`M ${a},${a} L ${a-o},${l} A ${a},${a} 0 0 1 ${a+o},${l} Z`),24&t.$$.dirty&&s(2,$=`rotate(${c[n]},${a},${a})`)},[r,i,$,n,a,l,o,function(e){Q(t,e)}]}class $s extends c{constructor(t){super(),l(this,t,is,os,o,{arc:3,radius:4,active:0})}}function us(t,e,s){const n=t.slice();return n[8]=e[s],n}function hs(t,e){let s,n,a;return n=new $s({props:{arc:e[8],radius:e[1]/2,active:e[0].includes(e[8])}}),n.$on("click",(function(){return e[6](e[8])})),{key:t,first:null,c(){s=tt(),z(n.$$.fragment),this.h()},l(t){s=tt(),B(n.$$.fragment,t),this.h()},h(){this.first=s},m(t,e){v(t,s,e),H(n,t,e),a=!0},p(t,s){e=t;const a={};2&s&&(a.radius=e[1]/2),1&s&&(a.active=e[0].includes(e[8])),n.$set(a)},i(t){a||(G(n.$$.fragment,t),a=!0)},o(t){R(n.$$.fragment,t),a=!1},d(t){t&&m(s),W(n,t)}}}function ps(t){let e,s,n,a,r,c,l=[],o=new Map,i=t[2];const $=t=>t[8];for(let h=0;hl("click_arc",t);return t.$$set=t=>{"selected"in t&&s(0,r=t.selected),"size"in t&&s(1,c=t.size),"$$scope"in t&&s(4,a=t.$$scope)},[r,c,["FS","F","FP","AP","A","AS"],o,a,n,t=>o(t)]}class ms extends c{constructor(t){super(),l(this,t,fs,ps,o,{selected:0,size:1})}}function ds(t){let e,s;return{c(){e=X("text"),s=$(t[0]),this.h()},l(n){e=h(n,"text",{x:!0,y:!0,class:!0},1);var a=p(e);s=f(a,t[0]),a.forEach(m),this.h()},h(){g(e,"x","50%"),g(e,"y","50%"),g(e,"class","svelte-1u8rlr5")},m(t,n){v(t,e,n),y(e,s)},p(t,e){1&e&&C(s,t[0])},d(t){t&&m(e)}}}function gs(t){let e,s,n;return s=new ms({props:{selected:t[1],size:"40",$$slots:{default:[ds]},$$scope:{ctx:t}}}),{c(){e=i("div"),z(s.$$.fragment),this.h()},l(t){e=h(t,"DIV",{class:!0});var n=p(e);B(s.$$.fragment,n),n.forEach(m),this.h()},h(){g(e,"class","svelte-1u8rlr5")},m(t,a){v(t,e,a),H(s,e,null),n=!0},p(t,[e]){const n={};2&e&&(n.selected=t[1]),5&e&&(n.$$scope={dirty:e,ctx:t}),s.$set(n)},i(t){n||(G(s.$$.fragment,t),n=!0)},o(t){R(s.$$.fragment,t),n=!1},d(t){t&&m(e),W(s)}}}function vs(t,e,s){let{weapon_class:n=1}=e,{arcs:a=[]}=e;return t.$$set=t=>{"weapon_class"in t&&s(0,n=t.weapon_class),"arcs"in t&&s(1,a=t.arcs)},[n,a]}class _s extends c{constructor(t){super(),l(this,t,vs,gs,o,{weapon_class:0,arcs:1})}}function ys(t,e,s){const n=t.slice();return n[2]=e[s],n}function bs(t){let e,s;const n=[t[2]];let a={};for(let r=0;rR(r[t],1,1,(()=>{r[t]=null}));return{c(){e=i("div"),s=i("div");for(let t=0;t{"weapons"in t&&s(1,n=t.weapons)},t.$$.update=()=>{2&t.$$.dirty&&s(0,a=n.filter((({weapon_type:t})=>"beam"===t)))},[a,n]}class Es extends c{constructor(t){super(),l(this,t,xs,ws,o,{weapons:1})}}function Is(t,e,s){const n=t.slice();return n[1]=e[s],n}function ks(t){let e,s;return{c(){e=i("img"),this.h()},l(t){e=h(t,"IMG",{class:!0,src:!0,alt:!0}),this.h()},h(){g(e,"class","firecon svelte-10x4b15"),e.src!==(s="icons/firecon.svg")&&g(e,"src","icons/firecon.svg"),g(e,"alt","firecon")},m(t,s){v(t,e,s)},d(t){t&&m(e)}}}function Ds(t){let e,s=_.range(t[0]),n=[];for(let a=0;a{"firecons"in t&&s(0,n=t.firecons)},[n]}class Ps extends c{constructor(t){super(),l(this,t,Ms,Ds,o,{firecons:0})}}function Ts(t,e,s){const n=t.slice();return n[2]=e[s],n}function Ns(t,e,s){const n=t.slice();return n[2]=e[s],n}function Os(t){let e,s;return{c(){e=i("img"),this.h()},l(t){e=h(t,"IMG",{src:!0,alt:!0,class:!0}),this.h()},h(){e.src!==(s="icons/screen.svg")&&g(e,"src","icons/screen.svg"),g(e,"alt","screen"),g(e,"class","svelte-kh7po5")},m(t,s){v(t,e,s)},d(t){t&&m(e)}}}function Vs(t){let e,s;return{c(){e=i("img"),this.h()},l(t){e=h(t,"IMG",{src:!0,alt:!0,class:!0}),this.h()},h(){e.src!==(s="icons/screen-advanced.svg")&&g(e,"src","icons/screen-advanced.svg"),g(e,"alt","advanced screen"),g(e,"class","svelte-kh7po5")},m(t,s){v(t,e,s)},d(t){t&&m(e)}}}function As(t){let e,s,n=O.range(t[0]),a=[];for(let l=0;l{"standard"in t&&s(0,n=t.standard),"advanced"in t&&s(1,a=t.advanced)},[n,a]}class qs extends c{constructor(t){super(),l(this,t,Ss,As,o,{standard:0,advanced:1})}}function Cs(t){let e,s,n,a,r;s=new Ps({props:{firecons:t[0]}});const c=[t[1]];let l={};for(let o=0;o{"firecons"in t&&s(0,n=t.firecons),"screens"in t&&s(1,a=t.screens)},[n,a]}class Fs extends c{constructor(t){super(),l(this,t,Ls,Cs,o,{firecons:0,screens:1})}}function Us(t){let e,s,n,a,r,c,l,o,$,f,_,b,w;const x=[t[0].general];let E={};for(let i=0;i{b||(b=F(e,U,{},!0)),b.run(1)})),w=!0)},o(t){R(s.$$.fragment,t),R(a.$$.fragment,t),R(l.$$.fragment,t),R($.$$.fragment,t),R(_.$$.fragment,t),b||(b=F(e,U,{},!1)),b.run(0),w=!1},d(t){t&&m(e),W(s),W(a),W(l),W($),W(_),t&&b&&b.end()}}}function js(t,e,s){let{ship:n}=e;return t.$$set=t=>{"ship"in t&&s(0,n=t.ship)},[n]}class zs extends c{constructor(t){super(),l(this,t,js,Us,o,{ship:0})}}function Bs(t){let e,s;return{c(){e=i("label"),s=$(t[0]),this.h()},l(n){e=h(n,"LABEL",{class:!0});var a=p(e);s=f(a,t[0]),a.forEach(m),this.h()},h(){g(e,"class","svelte-1urp5hr")},m(t,n){v(t,e,n),y(e,s)},p(t,e){1&e&&C(s,t[0])},d(t){t&&m(e)}}}function Hs(t){let e,s,n,a=t[0]&&Bs(t);const r=t[4].default,c=et(r,t,t[3],null),l=c||function(t){let e,s,n;return{c(){e=i("input"),this.h()},l(t){e=h(t,"INPUT",{type:!0,placeholder:!0,value:!0}),this.h()},h(){g(e,"type","text"),g(e,"placeholder",t[2]),e.value=t[1]},m(a,r){v(a,e,r),s||(n=K(e,"change",t[5]),s=!0)},p(t,s){4&s&&g(e,"placeholder",t[2]),2&s&&e.value!==t[1]&&(e.value=t[1])},d(t){t&&m(e),s=!1,n()}}}(t);return{c(){e=i("div"),a&&a.c(),s=u(),l&&l.c(),this.h()},l(t){e=h(t,"DIV",{class:!0});var n=p(e);a&&a.l(n),s=d(n),l&&l.l(n),n.forEach(m),this.h()},h(){g(e,"class","svelte-1urp5hr")},m(t,r){v(t,e,r),a&&a.m(e,null),y(e,s),l&&l.m(e,null),n=!0},p(t,[o]){t[0]?a?a.p(t,o):(a=Bs(t),a.c(),a.m(e,s)):a&&(a.d(1),a=null),c?c.p&&(!n||8&o)&&rt(c,r,t,t[3],o,null,null):l&&l.p&&6&o&&l.p(t,o)},i(t){n||(G(l,t),n=!0)},o(t){R(l,t),n=!1},d(t){t&&m(e),a&&a.d(),l&&l.d(t)}}}function Gs(t,e,s){let{$$slots:n={},$$scope:a}=e,{label:r=""}=e,{value:c=""}=e,{placeholder:l}=e;return t.$$set=t=>{"label"in t&&s(0,r=t.label),"value"in t&&s(1,c=t.value),"placeholder"in t&&s(2,l=t.placeholder),"$$scope"in t&&s(3,a=t.$$scope)},[r,c,l,a,n,function(e){Q(t,e)}]}class Rs extends c{constructor(t){super(),l(this,t,Gs,Hs,o,{label:0,value:1,placeholder:2})}}function Ws(t,e,s){const n=t.slice();return n[7]=e[s],n}function Ys(t,e){let s,n,a,r=e[7]+"";return{key:t,first:null,c(){s=i("option"),n=$(r),this.h()},l(t){s=h(t,"OPTION",{value:!0});var e=p(s);n=f(e,r),e.forEach(m),this.h()},h(){s.__value=a=e[7],s.value=s.__value,this.first=s},m(t,e){v(t,s,e),y(s,n)},p(t,c){e=t,8&c&&r!==(r=e[7]+"")&&C(n,r),8&c&&a!==(a=e[7])&&(s.__value=a,s.value=s.__value)},d(t){t&&m(s)}}}function Js(t){let e,s,n,a=[],r=new Map,c=t[3];const l=t=>t[7];for(let o=0;o(a(),a=ut(l,(t=>s(6,n=t))),l);t.$$.on_destroy.push((()=>a()));let c,{ship:l=$t("ship")}=e;r();let o;let i;return t.$$set=t=>{"ship"in t&&r(s(0,l=t.ship))},t.$$.update=()=>{64&t.$$.dirty&&s(1,c=n.general),64&t.$$.dirty&&s(2,o=n.general.ship_type),64&t.$$.dirty&&s(3,i=Yt(n.general.mass,n.carrier.bays>0).map((({name:t})=>t)))},[l,c,o,i,t=>l.dispatch(l.actions.set_ship_class(t.target.value)),({target:{value:t}})=>l.dispatch.set_ship_type(t),n]}class Ks extends c{constructor(t){super(),l(this,t,Zs,Xs,o,{ship:0})}}function Qs(t){let e,s,n=-t[1]+"";return{c(){e=$("excessive mass: "),s=$(n)},l(t){e=f(t,"excessive mass: "),s=f(t,n)},m(t,n){v(t,e,n),v(t,s,n)},p(t,e){2&e&&n!==(n=-t[1]+"")&&C(s,n)},d(t){t&&m(e),t&&m(s)}}}function tn(t){let e,s;return{c(){e=$("mass unused: "),s=$(t[1])},l(n){e=f(n,"mass unused: "),s=f(n,t[1])},m(t,n){v(t,e,n),v(t,s,n)},p(t,e){2&e&&C(s,t[1])},d(t){t&&m(e),t&&m(s)}}}function en(t){let e,s,n,a,r,c,l,o;function $(t,e){return t[3]?tn:Qs}let f=$(t),_=f(t);return{c(){e=i("input"),n=u(),a=i("span"),r=u(),c=i("div"),_.c(),this.h()},l(t){e=h(t,"INPUT",{value:!0,type:!0,min:!0,max:!0,class:!0}),n=d(t),a=h(t,"SPAN",{class:!0}),p(a).forEach(m),r=d(t),c=h(t,"DIV",{class:!0});var s=p(c);_.l(s),s.forEach(m),this.h()},h(){e.value=s=t[2].general.mass,g(e,"type","number"),g(e,"min","10"),g(e,"max","300"),g(e,"class","svelte-15yh1sv"),g(a,"class","mass_symbol svelte-15yh1sv"),g(c,"class","note svelte-15yh1sv"),Z(c,"warning",!t[3])},m(s,i){v(s,e,i),v(s,n,i),v(s,a,i),v(s,r,i),v(s,c,i),_.m(c,null),l||(o=K(e,"change",t[4]),l=!0)},p(t,n){4&n&&s!==(s=t[2].general.mass)&&(e.value=s),f===(f=$(t))&&_?_.p(t,n):(_.d(1),_=f(t),_&&(_.c(),_.m(c,null))),8&n&&Z(c,"warning",!t[3])},d(t){t&&m(e),t&&m(n),t&&m(a),t&&m(r),t&&m(c),_.d(),l=!1,o()}}}function sn(t){let e,s,n=t[2].general.cost+"";return{c(){e=i("span"),s=$(n),this.h()},l(t){e=h(t,"SPAN",{class:!0});var a=p(e);s=f(a,n),a.forEach(m),this.h()},h(){g(e,"class","cost svelte-15yh1sv")},m(t,n){v(t,e,n),y(e,s)},p(t,e){4&e&&n!==(n=t[2].general.cost+"")&&C(s,n)},d(t){t&&m(e)}}}function nn(t){let e,s,n,a,r,c;return s=new Rs({props:{label:"ship tonnage",$$slots:{default:[en]},$$scope:{ctx:t}}}),r=new Rs({props:{label:"cost",$$slots:{default:[sn]},$$scope:{ctx:t}}}),{c(){e=i("div"),z(s.$$.fragment),n=u(),a=i("div"),z(r.$$.fragment),this.h()},l(t){e=h(t,"DIV",{class:!0});var c=p(e);B(s.$$.fragment,c),c.forEach(m),n=d(t),a=h(t,"DIV",{class:!0});var l=p(a);B(r.$$.fragment,l),l.forEach(m),this.h()},h(){g(e,"class","mass svelte-15yh1sv"),g(a,"class","cost svelte-15yh1sv")},m(t,l){v(t,e,l),H(s,e,null),v(t,n,l),v(t,a,l),H(r,a,null),c=!0},p(t,[e]){const n={};46&e&&(n.$$scope={dirty:e,ctx:t}),s.$set(n);const a={};36&e&&(a.$$scope={dirty:e,ctx:t}),r.$set(a)},i(t){c||(G(s.$$.fragment,t),G(r.$$.fragment,t),c=!0)},o(t){R(s.$$.fragment,t),R(r.$$.fragment,t),c=!1},d(t){t&&m(e),W(s),t&&m(n),t&&m(a),W(r)}}}function an(t,e,s){let n,a=b,r=()=>(a(),a=ut(c,(t=>s(2,n=t))),c);t.$$.on_destroy.push((()=>a()));let{ship:c=$t("ship")}=e;r();let l,o=!0;return t.$$set=t=>{"ship"in t&&r(s(0,c=t.ship))},t.$$.update=()=>{4&t.$$.dirty&&s(1,l=n.general.mass-n.general.used_mass),2&t.$$.dirty&&s(3,o=l>=0)},[c,l,n,o,({target:{value:t}})=>c.dispatch(c.actions.set_ship_mass(parseInt(t)))]}class rn extends c{constructor(t){super(),l(this,t,an,nn,o,{ship:0})}}function cn(t){let e,s,n,a;return e=new Ks({}),n=new rn({}),{c(){z(e.$$.fragment),s=u(),z(n.$$.fragment)},l(t){B(e.$$.fragment,t),s=d(t),B(n.$$.fragment,t)},m(t,r){H(e,t,r),v(t,s,r),H(n,t,r),a=!0},p:b,i(t){a||(G(e.$$.fragment,t),G(n.$$.fragment,t),a=!0)},o(t){R(e.$$.fragment,t),R(n.$$.fragment,t),a=!1},d(t){W(e,t),t&&m(s),W(n,t)}}}class ln extends c{constructor(t){super(),l(this,t,null,cn,o,{})}}function on(t){let e,s,n,a,r,c,l,o,_,w,x,E,I,k,D,M,P,T,N,O,V,A,S,q,C,U,j,z,B,H,G,R,W;return{c(){e=i("aside"),s=i("div"),n=i("input"),a=u(),r=i("h3"),c=$("welcome to the docks"),l=u(),o=i("p"),_=$("This app is a ship builder for the game\n "),w=i("a"),x=$("Full Thrust"),E=$("\n ."),I=u(),k=i("p"),D=$("The app, beside any exception mentioned here, is trying to follow the\n "),M=i("a"),P=$("Cross Dimensions rules"),T=$("\n as closely as possible."),N=u(),O=i("p"),V=$("The app is mostly developed for Firefox. I also check as much as I\n can that I don't mess things too badly on Chrome. For the other\n browsers... caveat emptor."),A=u(),S=i("p"),q=$("Written by\n "),C=i("a"),U=$("Yanick Champoux"),j=$("\n . Code available on\n "),z=i("a"),B=$("Github"),this.h()},l(t){e=h(t,"ASIDE",{class:!0});var i=p(e);s=h(i,"DIV",{class:!0});var $=p(s);n=h($,"INPUT",{type:!0,class:!0,value:!0}),$.forEach(m),a=d(i),r=h(i,"H3",{class:!0});var u=p(r);c=f(u,"welcome to the docks"),u.forEach(m),l=d(i),o=h(i,"P",{});var g=p(o);_=f(g,"This app is a ship builder for the game\n "),w=h(g,"A",{href:!0});var v=p(w);x=f(v,"Full Thrust"),v.forEach(m),E=f(g,"\n ."),g.forEach(m),I=d(i),k=h(i,"P",{});var y=p(k);D=f(y,"The app, beside any exception mentioned here, is trying to follow the\n "),M=h(y,"A",{href:!0});var b=p(M);P=f(b,"Cross Dimensions rules"),b.forEach(m),T=f(y,"\n as closely as possible."),y.forEach(m),N=d(i),O=h(i,"P",{});var L=p(O);V=f(L,"The app is mostly developed for Firefox. I also check as much as I\n can that I don't mess things too badly on Chrome. For the other\n browsers... caveat emptor."),L.forEach(m),A=d(i),S=h(i,"P",{});var F=p(S);q=f(F,"Written by\n "),C=h(F,"A",{href:!0});var H=p(C);U=f(H,"Yanick Champoux"),H.forEach(m),j=f(F,"\n . Code available on\n "),z=h(F,"A",{href:!0});var G=p(z);B=f(G,"Github"),G.forEach(m),F.forEach(m),i.forEach(m),this.h()},h(){g(n,"type","button"),g(n,"class","button small red"),n.value="close",g(s,"class","svelte-16mfw8u"),g(r,"class","svelte-16mfw8u"),g(w,"href","https://shop.groundzerogames.co.uk/rules.html"),g(M,"href","http://members.ozemail.com.au/~laranzu/fullthrust/rules/"),g(C,"href","https://twitter.com/yenzie"),g(z,"href","https://github.com/yanick/aotds-shipyard"),g(e,"class","svelte-16mfw8u")},m(i,$){v(i,e,$),y(e,s),y(s,n),y(e,a),y(e,r),y(r,c),y(e,l),y(e,o),y(o,_),y(o,w),y(w,x),y(o,E),y(e,I),y(e,k),y(k,D),y(k,M),y(M,P),y(k,T),y(e,N),y(e,O),y(O,V),y(e,A),y(e,S),y(S,q),y(S,C),y(C,U),y(S,j),y(S,z),y(z,B),G=!0,R||(W=K(n,"click",t[0]),R=!0)},p:b,i(t){G||(L((()=>{H||(H=F(e,pt,{x:-800,opacity:1},!0)),H.run(1)})),G=!0)},o(t){H||(H=F(e,pt,{x:-800,opacity:1},!1)),H.run(0),G=!1},d(t){t&&m(e),t&&H&&H.end(),R=!1,W()}}}function $n(t){const e=j();return[()=>e("close")]}class un extends c{constructor(t){super(),l(this,t,$n,on,o,{})}}function hn(t){let e,s,n,a,r,c,l,o;const _=t[5].default,b=et(_,t,t[4],null);return{c(){e=i("div"),b&&b.c(),s=u(),n=i("div"),a=$(t[0]),r=u(),c=i("div"),l=$(t[1]),this.h()},l(o){e=h(o,"DIV",{class:!0});var i=p(e);b&&b.l(i),i.forEach(m),s=d(o),n=h(o,"DIV",{class:!0});var $=p(n);a=f($,t[0]),$.forEach(m),r=d(o),c=h(o,"DIV",{class:!0});var u=p(c);l=f(u,t[1]),u.forEach(m),this.h()},h(){g(e,"class","svelte-14c1p7f"),g(n,"class","mass svelte-14c1p7f"),g(c,"class","cost svelte-14c1p7f")},m(i,$){v(i,e,$),b&&b.m(e,null),v(i,s,$),v(i,n,$),y(n,a),t[6](n),v(i,r,$),v(i,c,$),y(c,l),t[7](c),o=!0},p(t,[e]){b&&b.p&&(!o||16&e)&&rt(b,_,t,t[4],e,null,null),(!o||1&e)&&C(a,t[0]),(!o||2&e)&&C(l,t[1])},i(t){o||(G(b,t),o=!0)},o(t){R(b,t),o=!1},d(a){a&&m(e),b&&b.d(a),a&&m(s),a&&m(n),t[6](null),a&&m(r),a&&m(c),t[7](null)}}}function pn(t,e,s){let n,a,{$$slots:r={},$$scope:c}=e,{mass:l}=e,{cost:o}=e;const i=async t=>{t&&(t.classList.remove("updated"),t.offsetWidth,t.classList.add("updated"))};return t.$$set=t=>{"mass"in t&&s(0,l=t.mass),"cost"in t&&s(1,o=t.cost),"$$scope"in t&&s(4,c=t.$$scope)},t.$$.update=()=>{5&t.$$.dirty&&i(n),10&t.$$.dirty&&i(a)},[l,o,n,a,c,r,function(t){ft[t?"unshift":"push"]((()=>{n=t,s(2,n)}))},function(t){ft[t?"unshift":"push"]((()=>{a=t,s(3,a)}))}]}class fn extends c{constructor(t){super(),l(this,t,pn,hn,o,{mass:0,cost:1})}}function mn(t){let e,s,n,a,r,c,l;const o=t[2].default,_=et(o,t,t[1],null);return{c(){e=i("div"),s=i("h2"),n=$(t[0]),a=u(),r=i("hr"),c=u(),_&&_.c(),this.h()},l(l){e=h(l,"DIV",{class:!0});var o=p(e);s=h(o,"H2",{});var i=p(s);n=f(i,t[0]),i.forEach(m),a=d(o),r=h(o,"HR",{class:!0}),o.forEach(m),c=d(l),_&&_.l(l),this.h()},h(){g(r,"class","svelte-12m93xd"),g(e,"class","svelte-12m93xd")},m(t,o){v(t,e,o),y(e,s),y(s,n),y(e,a),y(e,r),v(t,c,o),_&&_.m(t,o),l=!0},p(t,[e]){(!l||1&e)&&C(n,t[0]),_&&_.p&&(!l||2&e)&&rt(_,o,t,t[1],e,null,null)},i(t){l||(G(_,t),l=!0)},o(t){R(_,t),l=!1},d(t){t&&m(e),t&&m(c),_&&_.d(t)}}}function dn(t,e,s){let{$$slots:n={},$$scope:a}=e,{label:r}=e;return t.$$set=t=>{"label"in t&&s(0,r=t.label),"$$scope"in t&&s(1,a=t.$$scope)},[r,a,n]}class gn extends c{constructor(t){super(),l(this,t,dn,mn,o,{label:0})}}function vn(t){let e,s,n;return{c(){e=i("input"),this.h()},l(t){e=h(t,"INPUT",{type:!0,min:!0,class:!0}),this.h()},h(){g(e,"type","number"),g(e,"min","0"),g(e,"class","svelte-11x6jvv")},m(a,r){v(a,e,r),dt(e,t[0]),s||(n=K(e,"input",t[4]),s=!0)},p(t,s){1&s&&mt(e.value)!==t[0]&&dt(e,t[0])},d(t){t&&m(e),s=!1,n()}}}function _n(t){let e,s,n;return{c(){e=i("input"),this.h()},l(t){e=h(t,"INPUT",{type:!0,min:!0,class:!0}),this.h()},h(){g(e,"type","number"),g(e,"min","0"),g(e,"class","svelte-11x6jvv")},m(a,r){v(a,e,r),dt(e,t[1]),s||(n=K(e,"input",t[5]),s=!0)},p(t,s){2&s&&mt(e.value)!==t[1]&&dt(e,t[1])},d(t){t&&m(e),s=!1,n()}}}function yn(t){let e,s,n,a,r;return s=new Rs({props:{label:"screens",$$slots:{default:[vn]},$$scope:{ctx:t}}}),a=new Rs({props:{label:"advanced screens",$$slots:{default:[_n]},$$scope:{ctx:t}}}),{c(){e=i("div"),z(s.$$.fragment),n=u(),z(a.$$.fragment),this.h()},l(t){e=h(t,"DIV",{class:!0});var r=p(e);B(s.$$.fragment,r),n=d(r),B(a.$$.fragment,r),r.forEach(m),this.h()},h(){g(e,"class","svelte-11x6jvv")},m(t,c){v(t,e,c),H(s,e,null),y(e,n),H(a,e,null),r=!0},p(t,e){const n={};513&e&&(n.$$scope={dirty:e,ctx:t}),s.$set(n);const r={};514&e&&(r.$$scope={dirty:e,ctx:t}),a.$set(r)},i(t){r||(G(s.$$.fragment,t),G(a.$$.fragment,t),r=!0)},o(t){R(s.$$.fragment,t),R(a.$$.fragment,t),r=!1},d(t){t&&m(e),W(s),W(a)}}}function bn(t){let e,s;return e=new fn({props:{cost:t[2],mass:t[3],$$slots:{default:[yn]},$$scope:{ctx:t}}}),{c(){z(e.$$.fragment)},l(t){B(e.$$.fragment,t)},m(t,n){H(e,t,n),s=!0},p(t,[s]){const n={};4&s&&(n.cost=t[2]),8&s&&(n.mass=t[3]),515&s&&(n.$$scope={dirty:s,ctx:t}),e.$set(n)},i(t){s||(G(e.$$.fragment,t),s=!0)},o(t){R(e.$$.fragment,t),s=!1},d(t){W(e,t)}}}function wn(t,e,s){let{cost:n=0}=e,{mass:a=0}=e,{standard:r=0}=e,{advanced:c=0}=e;const l=j();return t.$$set=t=>{"cost"in t&&s(2,n=t.cost),"mass"in t&&s(3,a=t.mass),"standard"in t&&s(0,r=t.standard),"advanced"in t&&s(1,c=t.advanced)},t.$$.update=()=>{3&t.$$.dirty&&l("set_screens",{standard:r,advanced:c})},[r,c,n,a,function(){r=mt(this.value),s(0,r)},function(){c=mt(this.value),s(1,c)}]}class xn extends c{constructor(t){super(),l(this,t,wn,bn,o,{cost:2,mass:3,standard:0,advanced:1})}}function En(t){let e,s,n;return{c(){e=i("input"),this.h()},l(t){e=h(t,"INPUT",{type:!0,min:!0,class:!0}),this.h()},h(){g(e,"type","number"),g(e,"min","0"),g(e,"class","svelte-qworsx")},m(a,r){v(a,e,r),dt(e,t[0]),s||(n=K(e,"input",t[2]),s=!0)},p(t,s){1&s&&mt(e.value)!==t[0]&&dt(e,t[0])},d(t){t&&m(e),s=!1,n()}}}function In(t){let e,s;return e=new Rs({props:{label:`layer ${t[1]}`,$$slots:{default:[En]},$$scope:{ctx:t}}}),{c(){z(e.$$.fragment)},l(t){B(e.$$.fragment,t)},m(t,n){H(e,t,n),s=!0},p(t,[s]){const n={};2&s&&(n.label=`layer ${t[1]}`),17&s&&(n.$$scope={dirty:s,ctx:t}),e.$set(n)},i(t){s||(G(e.$$.fragment,t),s=!0)},o(t){R(e.$$.fragment,t),s=!1},d(t){W(e,t)}}}function kn(t,e,s){let{layer:n=1}=e,{rating:a=0}=e;const r=j();return t.$$set=t=>{"layer"in t&&s(1,n=t.layer),"rating"in t&&s(0,a=t.rating)},t.$$.update=()=>{3&t.$$.dirty&&r("ship_change",ee.actions.set_armour_layer({layer:n,rating:a}))},[a,n,function(){a=mt(this.value),s(0,a)}]}class Dn extends c{constructor(t){super(),l(this,t,kn,In,o,{layer:1,rating:0})}}function Mn(t,e,s){const n=t.slice();return n[7]=e[s],n}function Pn(t){let e,s,n;return{c(){e=i("input"),this.h()},l(t){e=h(t,"INPUT",{type:!0,min:!0,class:!0}),this.h()},h(){g(e,"type","number"),g(e,"min","0"),g(e,"class","svelte-1bx91qz")},m(a,r){v(a,e,r),dt(e,t[3]),s||(n=K(e,"input",t[4]),s=!0)},p(t,s){8&s&&mt(e.value)!==t[3]&&dt(e,t[3])},d(t){t&&m(e),s=!1,n()}}}function Tn(t,e){let s,n,a;const r=[e[7]];let c={};for(let l=0;lt[7].layer;for(let i=0;i<$.length;i+=1){let e=Mn(t,$,i),s=f(e);o.set(s,l[i]=Tn(s,e))}return{c(){e=i("div"),s=i("div"),z(n.$$.fragment),a=u(),r=i("div");for(let t=0;t{"armour"in t&&s(2,n=t.armour),"cost"in t&&s(0,a=t.cost),"mass"in t&&s(1,r=t.mass)},t.$$.update=()=>{4&t.$$.dirty&&s(0,a=O.sum(O.map(n,"cost"))),4&t.$$.dirty&&s(1,r=O.sum(O.map(n,"mass"))),8&t.$$.dirty&&l("ship_change",ee.actions.set_armour_nbr_layers(c))},[a,r,n,c,function(){c=mt(this.value),s(3,c)},function(e){Q(t,e)}]}class An extends c{constructor(t){super(),l(this,t,Vn,On,o,{armour:2,cost:0,mass:1})}}function Sn(t){let e,s,n;return{c(){e=i("input"),this.h()},l(t){e=h(t,"INPUT",{type:!0,min:!0,class:!0}),this.h()},h(){g(e,"type","number"),g(e,"min","0"),g(e,"class","svelte-qworsx")},m(a,r){v(a,e,r),dt(e,t[0]),s||(n=K(e,"input",t[3]),s=!0)},p(t,s){1&s&&mt(e.value)!==t[0]&&dt(e,t[0])},d(t){t&&m(e),s=!1,n()}}}function qn(t){let e,s;return e=new Rs({props:{label:"cargo",$$slots:{default:[Sn]},$$scope:{ctx:t}}}),{c(){z(e.$$.fragment)},l(t){B(e.$$.fragment,t)},m(t,n){H(e,t,n),s=!0},p(t,s){const n={};65&s&&(n.$$scope={dirty:s,ctx:t}),e.$set(n)},i(t){s||(G(e.$$.fragment,t),s=!0)},o(t){R(e.$$.fragment,t),s=!1},d(t){W(e,t)}}}function Cn(t){let e,s;return e=new fn({props:{cost:t[1],mass:t[2],$$slots:{default:[qn]},$$scope:{ctx:t}}}),{c(){z(e.$$.fragment)},l(t){B(e.$$.fragment,t)},m(t,n){H(e,t,n),s=!0},p(t,[s]){const n={};2&s&&(n.cost=t[1]),4&s&&(n.mass=t[2]),65&s&&(n.$$scope={dirty:s,ctx:t}),e.$set(n)},i(t){s||(G(e.$$.fragment,t),s=!0)},o(t){R(e.$$.fragment,t),s=!1},d(t){W(e,t)}}}function Ln(t,e,s){$t("ship");let{space:n=0}=e,{cost:a=0}=e,{mass:r=0}=e;const c=j();return t.$$set=t=>{"space"in t&&s(0,n=t.space),"cost"in t&&s(1,a=t.cost),"mass"in t&&s(2,r=t.mass)},t.$$.update=()=>{1&t.$$.dirty&&c("set_cargo",re.actions.set_cargo(n))},[n,a,r,function(){n=mt(this.value),s(0,n)}]}class Fn extends c{constructor(t){super(),l(this,t,Ln,Cn,o,{space:0,cost:1,mass:2})}}function Un(t){let e,s,n,a,r,c,l,o,_,b,w,x,E,I;return{c(){e=i("div"),s=i("label"),n=i("input"),a=$("\n none"),r=u(),c=i("label"),l=i("input"),o=$("\n partial"),_=u(),b=i("label"),w=i("input"),x=$("\n full"),this.h()},l(t){e=h(t,"DIV",{class:!0});var i=p(e);s=h(i,"LABEL",{class:!0});var $=p(s);n=h($,"INPUT",{type:!0,value:!0}),a=f($,"\n none"),$.forEach(m),r=d(i),c=h(i,"LABEL",{class:!0});var u=p(c);l=h(u,"INPUT",{type:!0,value:!0}),o=f(u,"\n partial"),u.forEach(m),_=d(i),b=h(i,"LABEL",{class:!0});var g=p(b);w=h(g,"INPUT",{type:!0,value:!0}),x=f(g,"\n full"),g.forEach(m),i.forEach(m),this.h()},h(){g(n,"type","radio"),n.__value="none",n.value=n.__value,t[5][0].push(n),g(s,"class","svelte-6w28yb"),g(l,"type","radio"),l.__value="partial",l.value=l.__value,t[5][0].push(l),g(c,"class","svelte-6w28yb"),g(w,"type","radio"),w.__value="full",w.value=w.__value,t[5][0].push(w),g(b,"class","svelte-6w28yb"),g(e,"class","svelte-6w28yb")},m(i,$){v(i,e,$),y(e,s),y(s,n),n.checked=n.__value===t[0],y(s,a),y(e,r),y(e,c),y(c,l),l.checked=l.__value===t[0],y(c,o),y(e,_),y(e,b),y(b,w),w.checked=w.__value===t[0],y(b,x),E||(I=[K(n,"change",t[4]),K(l,"change",t[6]),K(w,"change",t[7])],E=!0)},p(t,e){1&e&&(n.checked=n.__value===t[0]),1&e&&(l.checked=l.__value===t[0]),1&e&&(w.checked=w.__value===t[0])},d(s){s&&m(e),t[5][0].splice(t[5][0].indexOf(n),1),t[5][0].splice(t[5][0].indexOf(l),1),t[5][0].splice(t[5][0].indexOf(w),1),E=!1,gt(I)}}}function jn(t){let e,s;return e=new Rs({props:{label:"streamlining",$$slots:{default:[Un]},$$scope:{ctx:t}}}),{c(){z(e.$$.fragment)},l(t){B(e.$$.fragment,t)},m(t,n){H(e,t,n),s=!0},p(t,s){const n={};257&s&&(n.$$scope={dirty:s,ctx:t}),e.$set(n)},i(t){s||(G(e.$$.fragment,t),s=!0)},o(t){R(e.$$.fragment,t),s=!1},d(t){W(e,t)}}}function zn(t){let e,s;return e=new fn({props:{cost:t[1],mass:t[2],$$slots:{default:[jn]},$$scope:{ctx:t}}}),{c(){z(e.$$.fragment)},l(t){B(e.$$.fragment,t)},m(t,n){H(e,t,n),s=!0},p(t,[s]){const n={};2&s&&(n.cost=t[1]),4&s&&(n.mass=t[2]),257&s&&(n.$$scope={dirty:s,ctx:t}),e.$set(n)},i(t){s||(G(e.$$.fragment,t),s=!0)},o(t){R(e.$$.fragment,t),s=!1},d(t){W(e,t)}}}function Bn(t,e,s){let{type:n="none"}=e,{cost:a=0}=e,{mass:r=0}=e,{ship_change:c=$t("ship_change")||(()=>{})}=e;return t.$$set=t=>{"type"in t&&s(0,n=t.type),"cost"in t&&s(1,a=t.cost),"mass"in t&&s(2,r=t.mass),"ship_change"in t&&s(3,c=t.ship_change)},t.$$.update=()=>{9&t.$$.dirty&&c(ie.actions.set_streamlining(n))},[n,a,r,c,function(){n=this.__value,s(0,n)},[[]],function(){n=this.__value,s(0,n)},function(){n=this.__value,s(0,n)}]}class Hn extends c{constructor(t){super(),l(this,t,Bn,zn,o,{type:0,cost:1,mass:2,ship_change:3})}}function Gn(t){let e,s,n;return{c(){e=i("input"),this.h()},l(t){e=h(t,"INPUT",{type:!0,min:!0,max:!0,class:!0}),this.h()},h(){g(e,"type","number"),g(e,"min",t[7]),g(e,"max",t[8]),g(e,"class","svelte-x10nn1")},m(a,r){v(a,e,r),dt(e,t[0]),s||(n=K(e,"input",t[10]),s=!0)},p(t,s){128&s&&g(e,"min",t[7]),256&s&&g(e,"max",t[8]),1&s&&mt(e.value)!==t[0]&&dt(e,t[0])},d(t){t&&m(e),s=!1,n()}}}function Rn(t){let e,s;return e=new Rs({props:{label:"integrity",$$slots:{default:[Gn]},$$scope:{ctx:t}}}),{c(){z(e.$$.fragment)},l(t){B(e.$$.fragment,t)},m(t,n){H(e,t,n),s=!0},p(t,s){const n={};33153&s&&(n.$$scope={dirty:s,ctx:t}),e.$set(n)},i(t){s||(G(e.$$.fragment,t),s=!0)},o(t){R(e.$$.fragment,t),s=!1},d(t){W(e,t)}}}function Wn(t){let e,s,n,a,r,c,l,o,i,$;e=new fn({props:{cost:t[1],mass:t[2],$$slots:{default:[Rn]},$$scope:{ctx:t}}});const h=[t[3]];let p={};for(let u=0;u{"cost"in t&&s(1,r=t.cost),"mass"in t&&s(2,c=t.mass),"ship_mass"in t&&s(9,l=t.ship_mass),"rating"in t&&s(0,o=t.rating),"screens"in t&&s(3,i=t.screens),"armour"in t&&s(4,$=t.armour),"cargo"in t&&s(5,u=t.cargo),"streamlining"in t&&s(6,h=t.streamlining)},t.$$.update=()=>{512&t.$$.dirty&&s(7,n=Math.ceil(l/10)),512&t.$$.dirty&&s(8,a=l),1&t.$$.dirty&&p("change_hull",{rating:o})},[o,r,c,i,$,u,h,n,a,l,function(){o=mt(this.value),s(0,o)},function(e){Q(t,e)},function(e){Q(t,e)},function(e){Q(t,e)}]}class Xn extends c{constructor(t){super(),l(this,t,Jn,Yn,o,{cost:1,mass:2,ship_mass:9,rating:0,screens:3,armour:4,cargo:5,streamlining:6})}}function Zn(t){let e,s,n;return{c(){e=i("input"),this.h()},l(t){e=h(t,"INPUT",{type:!0,class:!0}),this.h()},h(){g(e,"type","number"),g(e,"class","short")},m(a,r){v(a,e,r),dt(e,t[0]),s||(n=K(e,"input",t[3]),s=!0)},p(t,s){1&s&&mt(e.value)!==t[0]&&dt(e,t[0])},d(t){t&&m(e),s=!1,n()}}}function Kn(t){let e,s;return e=new Rs({props:{label:"firecons",$$slots:{default:[Zn]},$$scope:{ctx:t}}}),{c(){z(e.$$.fragment)},l(t){B(e.$$.fragment,t)},m(t,n){H(e,t,n),s=!0},p(t,s){const n={};33&s&&(n.$$scope={dirty:s,ctx:t}),e.$set(n)},i(t){s||(G(e.$$.fragment,t),s=!0)},o(t){R(e.$$.fragment,t),s=!1},d(t){W(e,t)}}}function Qn(t){let e,s;return e=new fn({props:{cost:t[1],mass:t[2],$$slots:{default:[Kn]},$$scope:{ctx:t}}}),{c(){z(e.$$.fragment)},l(t){B(e.$$.fragment,t)},m(t,n){H(e,t,n),s=!0},p(t,[s]){const n={};2&s&&(n.cost=t[1]),4&s&&(n.mass=t[2]),33&s&&(n.$$scope={dirty:s,ctx:t}),e.$set(n)},i(t){s||(G(e.$$.fragment,t),s=!0)},o(t){R(e.$$.fragment,t),s=!1},d(t){W(e,t)}}}function ta(t,e,s){let{nbr:n}=e,{cost:a}=e,{mass:r=0}=e;const c=j();return t.$$set=t=>{"nbr"in t&&s(0,n=t.nbr),"cost"in t&&s(1,a=t.cost),"mass"in t&&s(2,r=t.mass)},t.$$.update=()=>{1&t.$$.dirty&&c("change_firecons",n)},[n,a,r,function(){n=mt(this.value),s(0,n)}]}class ea extends c{constructor(t){super(),l(this,t,ta,Qn,o,{nbr:0,cost:1,mass:2})}}function sa(t,e,s){const n=t.slice();return n[8]=e[s],n}function na(t,e){let s,n,a,r,c,l,o,_=e[8]+"";return{key:t,first:null,c(){s=i("label"),n=i("input"),a=u(),r=$(_),c=u(),this.h()},l(t){s=h(t,"LABEL",{class:!0});var e=p(s);n=h(e,"INPUT",{type:!0,value:!0}),a=d(e),r=f(e,_),c=d(e),e.forEach(m),this.h()},h(){g(n,"type","radio"),n.__value=e[8],n.value=n.__value,e[6][0].push(n),g(s,"class","svelte-1ozsoxu"),this.first=s},m(t,i){v(t,s,i),y(s,n),n.checked=n.__value===e[0],y(s,a),y(s,r),y(s,c),l||(o=[K(n,"change",e[5]),K(n,"change",e[3])],l=!0)},p(t,s){e=t,1&s&&(n.checked=n.__value===e[0])},d(t){t&&m(s),e[6][0].splice(e[6][0].indexOf(n),1),l=!1,gt(o)}}}function aa(t){let e,s=[],n=new Map,a=t[4];const r=t=>t[8];for(let c=0;c{"type"in t&&s(0,n=t.type),"cost"in t&&s(1,a=t.cost),"mass"in t&&s(2,r=t.mass)},[n,a,r,()=>c("change_ftl",n),["none","standard","advanced"],function(){n=this.__value,s(0,n)},[[]]]}class oa extends c{constructor(t){super(),l(this,t,la,ca,o,{type:0,cost:1,mass:2})}}function ia(t){let e,s,n;return{c(){e=i("input"),this.h()},l(t){e=h(t,"INPUT",{type:!0,min:!0,max:!0,step:!0,class:!0}),this.h()},h(){g(e,"type","number"),g(e,"min","0"),g(e,"max","20"),g(e,"step","1"),g(e,"class","svelte-3grq2v")},m(a,r){v(a,e,r),dt(e,t[1]),s||(n=K(e,"input",t[4]),s=!0)},p(t,s){2&s&&mt(e.value)!==t[1]&&dt(e,t[1])},d(t){t&&m(e),s=!1,n()}}}function $a(t){let e,s,n,a,r,c,l,o,_;return s=new Rs({props:{label:"thrust rating",$$slots:{default:[ia]},$$scope:{ctx:t}}}),{c(){e=i("div"),z(s.$$.fragment),n=u(),a=i("label"),r=i("input"),c=$(" advanced"),this.h()},l(t){e=h(t,"DIV",{class:!0});var l=p(e);B(s.$$.fragment,l),n=d(l),a=h(l,"LABEL",{class:!0});var o=p(a);r=h(o,"INPUT",{type:!0}),c=f(o," advanced"),o.forEach(m),l.forEach(m),this.h()},h(){g(r,"type","checkbox"),g(a,"class","svelte-3grq2v"),g(e,"class","svelte-3grq2v")},m(i,$){v(i,e,$),H(s,e,null),y(e,n),y(e,a),y(a,r),r.checked=t[0],y(a,c),l=!0,o||(_=K(r,"change",t[5]),o=!0)},p(t,e){const n={};130&e&&(n.$$scope={dirty:e,ctx:t}),s.$set(n),1&e&&(r.checked=t[0])},i(t){l||(G(s.$$.fragment,t),l=!0)},o(t){R(s.$$.fragment,t),l=!1},d(t){t&&m(e),W(s),o=!1,_()}}}function ua(t){let e,s;return e=new fn({props:{cost:t[2],mass:t[3],$$slots:{default:[$a]},$$scope:{ctx:t}}}),{c(){z(e.$$.fragment)},l(t){B(e.$$.fragment,t)},m(t,n){H(e,t,n),s=!0},p(t,[s]){const n={};4&s&&(n.cost=t[2]),8&s&&(n.mass=t[3]),131&s&&(n.$$scope={dirty:s,ctx:t}),e.$set(n)},i(t){s||(G(e.$$.fragment,t),s=!0)},o(t){R(e.$$.fragment,t),s=!1},d(t){W(e,t)}}}function ha(t,e,s){let{cost:n}=e,{mass:a}=e,{advanced:r=!1}=e,{rating:c=0}=e;const l=j();return console.log(r),t.$$set=t=>{"cost"in t&&s(2,n=t.cost),"mass"in t&&s(3,a=t.mass),"advanced"in t&&s(0,r=t.advanced),"rating"in t&&s(1,c=t.rating)},t.$$.update=()=>{3&t.$$.dirty&&l("change_engine",{rating:c,advanced:r})},[r,c,n,a,function(){c=mt(this.value),s(1,c)},function(){r=this.checked,s(0,r)}]}class pa extends c{constructor(t){super(),l(this,t,ha,ua,o,{cost:2,mass:3,advanced:0,rating:1})}}function fa(t){let e,s,n,a;const r=[t[1]];let c={};for(let i=0;i{"ftl"in t&&s(0,n=t.ftl),"engine"in t&&s(1,a=t.engine)},[n,a,function(e){Q(t,e)},function(e){Q(t,e)}]}class ga extends c{constructor(t){super(),l(this,t,da,ma,o,{ftl:0,engine:1})}}function va(t,e,s){const n=t.slice();return n[2]=e[s],n}function _a(t){let e,s,n,a,r,c,l,o,u,d,g;return{c(){e=i("select"),s=i("option"),n=$("1"),a=i("option"),r=$("2"),c=i("option"),l=$("3"),o=i("option"),u=$("4"),this.h()},l(t){e=h(t,"SELECT",{});var i=p(e);s=h(i,"OPTION",{value:!0});var $=p(s);n=f($,"1"),$.forEach(m),a=h(i,"OPTION",{value:!0});var d=p(a);r=f(d,"2"),d.forEach(m),c=h(i,"OPTION",{value:!0});var g=p(c);l=f(g,"3"),g.forEach(m),o=h(i,"OPTION",{value:!0});var v=p(o);u=f(v,"4"),v.forEach(m),i.forEach(m),this.h()},h(){s.__value="1",s.value=s.__value,a.__value="2",a.value=a.__value,c.__value="3",c.value=c.__value,o.__value="4",o.value=o.__value,void 0===t[0]&&L((()=>t[10].call(e)))},m(i,$){v(i,e,$),y(e,s),y(s,n),y(e,a),y(a,r),y(e,c),y(c,l),y(e,o),y(o,u),ht(e,t[0]),d||(g=K(e,"change",t[10]),d=!0)},p(t,s){1&s&&ht(e,t[0])},d(t){t&&m(e),d=!1,g()}}}function ya(t,e){let s,n,a,r=e[2]+"";return{key:t,first:null,c(){s=i("option"),n=$(r),this.h()},l(t){s=h(t,"OPTION",{value:!0});var e=p(s);n=f(e,r),e.forEach(m),this.h()},h(){s.__value=a=e[2],s.value=s.__value,this.first=s},m(t,e){v(t,s,e),y(s,n)},p(t,c){e=t,1&c&&r!==(r=e[2]+"")&&C(n,r),1&c&&a!==(a=e[2])&&(s.__value=a,s.value=s.__value)},d(t){t&&m(s)}}}function ba(t){let e,s,n,a=[],r=new Map,c=t[3][t[0]]||[];const l=t=>t[2];for(let o=0;ot[11].call(e)))},m(r,c){v(r,e,c);for(let t=0;t{})}=e,i={1:[6],2:[3,6],3:[1,2,3,4,5,6,"broadside"],4:[1,2,3,4,5,6,"broadside"]},$=6;const u=t=>{if("broadside"===$)return;let e=n.findIndex((e=>e===t));const a=[];O.range($).forEach((t=>{a.push(n[e]),e=(e+1)%n.length})),s(1,l=a)};let h=1,p="";const f=j();return t.$$set=t=>{"weapon_type"in t&&s(5,a=t.weapon_type),"id"in t&&s(6,r=t.id),"weapon_class"in t&&s(0,c=t.weapon_class),"arcs"in t&&s(1,l=t.arcs),"ship_change"in t&&s(7,o=t.ship_change)},t.$$.update=()=>{if(1&t.$$.dirty&&s(2,$=i[c][0]),6&t.$$.dirty&&l.length!==$)if("broadside"===$)s(1,l=n.filter((t=>1===t.length)));else{let t=n.findIndex((t=>l[0]));-1===t&&(t=0);const e=[];O.range($).forEach((s=>{e.push(n[t]),t=(t+1)%n.length})),s(1,l=e)}6&t.$$.dirty&&console.log({arcs:l,nbr_arcs:$}),1&t.$$.dirty&&c&&s(8,h=1),2&t.$$.dirty&&s(9,p=l.join(":")),513&t.$$.dirty&&f("change",{weapon_class:c,arcs:p.split(":")})},[c,l,$,i,u,a,r,o,h,p,function(){c=vt(this),s(0,c)},function(){$=vt(this),s(2,$),s(3,i),s(0,c),s(3,i),s(0,c)},({detail:t})=>u(t)]}class Ea extends c{constructor(t){super(),l(this,t,xa,wa,o,{weapon_type:5,id:6,weapon_class:0,arcs:1,ship_change:7})}}function Ia(t){let e,s,n,a,r;return a=new ms({props:{selected:t[0]}}),a.$on("click_arc",t[4]),{c(){e=i("label"),s=$("submunition pack"),n=u(),z(a.$$.fragment)},l(t){e=h(t,"LABEL",{});var r=p(e);s=f(r,"submunition pack"),r.forEach(m),n=d(t),B(a.$$.fragment,t)},m(t,c){v(t,e,c),y(e,s),v(t,n,c),H(a,t,c),r=!0},p(t,[e]){const s={};1&e&&(s.selected=t[0]),a.$set(s)},i(t){r||(G(a.$$.fragment,t),r=!0)},o(t){R(a.$$.fragment,t),r=!1},d(t){t&&m(e),t&&m(n),W(a,t)}}}function ka(t,e,s){let{arcs:n=["F"]}=e,{ship_change:a=$t("ship_change")||(()=>{})}=e;const r=t=>{n[0]!==t&&s(0,n=[t])},c=j();let l;return t.$$set=t=>{"arcs"in t&&s(0,n=t.arcs),"ship_change"in t&&s(2,a=t.ship_change)},t.$$.update=()=>{1&t.$$.dirty&&s(3,l=n.join(":")),8&t.$$.dirty&&c("change",{arcs:l.split(":")})},[n,r,a,l,({detail:t})=>r(t)]}class Da extends c{constructor(t){super(),l(this,t,ka,Ia,o,{arcs:0,ship_change:2})}}function Ma(t){let e,s;return{c(){e=i("label"),s=$("point defence system")},l(t){e=h(t,"LABEL",{});var n=p(e);s=f(n,"point defence system"),n.forEach(m)},m(t,n){v(t,e,n),y(e,s)},p:b,i:b,o:b,d(t){t&&m(e)}}}class Pa extends c{constructor(t){super(),l(this,t,null,Ma,o,{})}}function Ta(t){let e,s;return{c(){e=i("label"),s=$("scattergun")},l(t){e=h(t,"LABEL",{});var n=p(e);s=f(n,"scattergun"),n.forEach(m)},m(t,n){v(t,e,n),y(e,s)},p:b,i:b,o:b,d(t){t&&m(e)}}}class Na extends c{constructor(t){super(),l(this,t,null,Ta,o,{})}}function Oa(t){let e,s,n,a,r;return a=new ms({props:{selected:t[0]}}),a.$on("click_arc",t[4]),{c(){e=i("label"),s=$("needle weapon"),n=u(),z(a.$$.fragment)},l(t){e=h(t,"LABEL",{});var r=p(e);s=f(r,"needle weapon"),r.forEach(m),n=d(t),B(a.$$.fragment,t)},m(t,c){v(t,e,c),y(e,s),v(t,n,c),H(a,t,c),r=!0},p(t,[e]){const s={};1&e&&(s.selected=t[0]),a.$set(s)},i(t){r||(G(a.$$.fragment,t),r=!0)},o(t){R(a.$$.fragment,t),r=!1},d(t){t&&m(e),t&&m(n),W(a,t)}}}function Va(t,e,s){let{arcs:n=["F"]}=e,{ship_change:a=$t("ship_change")||(()=>{})}=e;const r=t=>{n[0]!==t&&s(0,n=[t])},c=j();let l;return t.$$set=t=>{"arcs"in t&&s(0,n=t.arcs),"ship_change"in t&&s(2,a=t.ship_change)},t.$$.update=()=>{1&t.$$.dirty&&s(3,l=n.join(":")),8&t.$$.dirty&&c("change",{arcs:l.split(":")})},[n,r,a,l,({detail:t})=>r(t)]}class Aa extends c{constructor(t){super(),l(this,t,Va,Oa,o,{arcs:0,ship_change:2})}}function Sa(t){let e,s,n,a,r,c,l;const o=[t[0]];var $=t[3][t[4]];function f(t){let e={};for(let s=0;s{W(t,1)})),at()}$?(a=new $(f()),a.$on("change",t[6]),z(a.$$.fragment),G(a.$$.fragment,1),H(a,e,null)):a=null}else $&&a.$set(n)},i(t){r||(a&&G(a.$$.fragment,t),r=!0)},o(t){a&&R(a.$$.fragment,t),r=!1},d(t){t&&m(e),a&&W(a),c=!1,l()}}}function qa(t){let e,s;return e=new fn({props:{cost:t[1],mass:t[2],$$slots:{default:[Sa]},$$scope:{ctx:t}}}),{c(){z(e.$$.fragment)},l(t){B(e.$$.fragment,t)},m(t,n){H(e,t,n),s=!0},p(t,[s]){const n={};2&s&&(n.cost=t[1]),4&s&&(n.mass=t[2]),513&s&&(n.$$scope={dirty:s,ctx:t}),e.$set(n)},i(t){s||(G(e.$$.fragment,t),s=!0)},o(t){R(e.$$.fragment,t),s=!1},d(t){W(e,t)}}}function Ca(t,e,s){const n={beam:Ea,submunition:Da,pds:Pa,scattergun:Na,needle:Aa};let{weapon:a={}}=e,{id:c}=e,{cost:l}=e,{mass:o}=e,{ship_change:i=$t("ship_change")||(()=>{})}=e,$=a.weapon_type;return t.$$set=t=>{"weapon"in t&&s(0,a=t.weapon),"id"in t&&s(7,c=t.id),"cost"in t&&s(1,l=t.cost),"mass"in t&&s(2,o=t.mass),"ship_change"in t&&s(8,i=t.ship_change)},[a,l,o,n,$,()=>i(Ee.actions.remove_weapon(c)),({detail:t})=>{i(Ee.actions.set_weapon(r({id:c,weapon_type:$},t)))},c,i]}class La extends c{constructor(t){super(),l(this,t,Ca,qa,o,{weapon:0,id:7,cost:1,mass:2,ship_change:8})}}function Fa(t,e,s){const n=t.slice();return n[0]=e[s],n}function Ua(t,e){let s,n,a=e[0]+"";return{key:t,first:null,c(){s=i("option"),n=$(a),this.h()},l(t){s=h(t,"OPTION",{value:!0});var e=p(s);n=f(e,a),e.forEach(m),this.h()},h(){s.__value=e[0],s.value=s.__value,this.first=s},m(t,e){v(t,s,e),y(s,n)},p(t,s){e=t},d(t){t&&m(s)}}}function ja(t){let e,s,n,a=[],r=new Map,c=t[4];const l=t=>t[0];for(let o=0;ot[7].call(e)))},m(r,c){v(r,e,c);for(let t=0;tt));let{id:a=1}=e,{type:r="standard"}=e,{ftl:c=!1}=e,{cost:l=0}=e,{mass:o=0}=e,{ship_change:i=$t("ship_change")||(()=>{})}=e;return t.$$set=t=>{"id"in t&&s(1,a=t.id),"type"in t&&s(0,r=t.type),"ftl"in t&&s(5,c=t.ftl),"cost"in t&&s(2,l=t.cost),"mass"in t&&s(3,o=t.mass),"ship_change"in t&&s(6,i=t.ship_change)},t.$$.update=()=>{67&t.$$.dirty&&i(fe.actions.set_squadron({id:a,type:r}))},[r,a,l,o,n,c,i,function(){r=vt(this),s(0,r),s(4,n)}]}class Ga extends c{constructor(t){super(),l(this,t,Ha,Ba,o,{id:1,type:0,ftl:5,cost:2,mass:3,ship_change:6})}}function Ra(t,e,s){const n=t.slice();return n[6]=e[s],n}function Wa(t){let e,s,n;return{c(){e=i("input"),this.h()},l(t){e=h(t,"INPUT",{type:!0,min:!0}),this.h()},h(){g(e,"type","number"),g(e,"min","0")},m(a,r){v(a,e,r),dt(e,t[0]),s||(n=K(e,"input",t[5]),s=!0)},p(t,s){1&s&&mt(e.value)!==t[0]&&dt(e,t[0])},d(t){t&&m(e),s=!1,n()}}}function Ya(t){let e,s;return e=new Rs({props:{label:"bays",$$slots:{default:[Wa]},$$scope:{ctx:t}}}),{c(){z(e.$$.fragment)},l(t){B(e.$$.fragment,t)},m(t,n){H(e,t,n),s=!0},p(t,s){const n={};513&s&&(n.$$scope={dirty:s,ctx:t}),e.$set(n)},i(t){s||(G(e.$$.fragment,t),s=!0)},o(t){R(e.$$.fragment,t),s=!1},d(t){W(e,t)}}}function Ja(t,e){let s,n,a;const r=[e[6]];let c={};for(let l=0;lt[6].id;for(let i=0;i{})}=e;return t.$$set=t=>{"bays"in t&&s(0,n=t.bays),"squadrons"in t&&s(1,a=t.squadrons),"cost"in t&&s(2,r=t.cost),"mass"in t&&s(3,c=t.mass),"ship_change"in t&&s(4,l=t.ship_change)},t.$$.update=()=>{17&t.$$.dirty&&l(fe.actions.set_carrier_bays(n))},[n,a,r,c,l,function(){n=mt(this.value),s(0,n)}]}class Qa extends c{constructor(t){super(),l(this,t,Ka,Za,o,{bays:0,squadrons:1,cost:2,mass:3,ship_change:4})}}function tr(t){let e,s,n;return{c(){e=i("input"),this.h()},l(t){e=h(t,"INPUT",{type:!0,class:!0}),this.h()},h(){g(e,"type","number"),g(e,"class","short")},m(a,r){v(a,e,r),dt(e,t[0]),s||(n=K(e,"input",t[4]),s=!0)},p(t,s){1&s&&mt(e.value)!==t[0]&&dt(e,t[0])},d(t){t&&m(e),s=!1,n()}}}function er(t){let e,s;return e=new Rs({props:{label:"ADFC",$$slots:{default:[tr]},$$scope:{ctx:t}}}),{c(){z(e.$$.fragment)},l(t){B(e.$$.fragment,t)},m(t,n){H(e,t,n),s=!0},p(t,s){const n={};33&s&&(n.$$scope={dirty:s,ctx:t}),e.$set(n)},i(t){s||(G(e.$$.fragment,t),s=!0)},o(t){R(e.$$.fragment,t),s=!1},d(t){W(e,t)}}}function sr(t){let e,s;return e=new fn({props:{cost:t[1],mass:t[2],$$slots:{default:[er]},$$scope:{ctx:t}}}),{c(){z(e.$$.fragment)},l(t){B(e.$$.fragment,t)},m(t,n){H(e,t,n),s=!0},p(t,[s]){const n={};2&s&&(n.cost=t[1]),4&s&&(n.mass=t[2]),33&s&&(n.$$scope={dirty:s,ctx:t}),e.$set(n)},i(t){s||(G(e.$$.fragment,t),s=!0)},o(t){R(e.$$.fragment,t),s=!1},d(t){W(e,t)}}}function nr(t,e,s){let{rating:n=0}=e,{cost:a=0}=e,{mass:r=0}=e,{ship_change:c=$t("ship_change")||(()=>{})}=e;return t.$$set=t=>{"rating"in t&&s(0,n=t.rating),"cost"in t&&s(1,a=t.cost),"mass"in t&&s(2,r=t.mass),"ship_change"in t&&s(3,c=t.ship_change)},t.$$.update=()=>{9&t.$$.dirty&&c(Ee.actions.set_adfc(n))},[n,a,r,c,function(){n=mt(this.value),s(0,n)}]}class ar extends c{constructor(t){super(),l(this,t,nr,sr,o,{rating:0,cost:1,mass:2,ship_change:3})}}function rr(t){let e,s,n,a,r,c,l,o,_,b,w,x,E,I,k;return{c(){e=i("select"),s=i("option"),n=$("beam"),a=i("option"),r=$("submunition pack"),c=i("option"),l=$("point defence system"),o=i("option"),_=$("scattergun"),b=i("option"),w=$("needle weapon"),x=u(),E=i("input"),this.h()},l(t){e=h(t,"SELECT",{});var i=p(e);s=h(i,"OPTION",{value:!0});var $=p(s);n=f($,"beam"),$.forEach(m),a=h(i,"OPTION",{value:!0});var u=p(a);r=f(u,"submunition pack"),u.forEach(m),c=h(i,"OPTION",{value:!0});var g=p(c);l=f(g,"point defence system"),g.forEach(m),o=h(i,"OPTION",{value:!0});var v=p(o);_=f(v,"scattergun"),v.forEach(m),b=h(i,"OPTION",{value:!0});var y=p(b);w=f(y,"needle weapon"),y.forEach(m),i.forEach(m),x=d(t),E=h(t,"INPUT",{type:!0,value:!0,class:!0}),this.h()},h(){s.__value="beam",s.value=s.__value,a.__value="submunition",a.value=a.__value,c.__value="pds",c.value=c.__value,o.__value="scattergun",o.value=o.__value,b.__value="needle",b.value=b.__value,void 0===t[0]&&L((()=>t[3].call(e))),g(E,"type","button"),E.value="add weapon",g(E,"class","button small blue")},m(i,$){v(i,e,$),y(e,s),y(s,n),y(e,a),y(a,r),y(e,c),y(c,l),y(e,o),y(o,_),y(e,b),y(b,w),ht(e,t[0]),v(i,x,$),v(i,E,$),I||(k=[K(e,"change",t[3]),K(E,"click",t[1])],I=!0)},p(t,s){1&s&&ht(e,t[0])},d(t){t&&m(e),t&&m(x),t&&m(E),I=!1,gt(k)}}}function cr(t){let e,s;return e=new Rs({props:{label:"weapon type",$$slots:{default:[rr]},$$scope:{ctx:t}}}),{c(){z(e.$$.fragment)},l(t){B(e.$$.fragment,t)},m(t,n){H(e,t,n),s=!0},p(t,[s]){const n={};17&s&&(n.$$scope={dirty:s,ctx:t}),e.$set(n)},i(t){s||(G(e.$$.fragment,t),s=!0)},o(t){R(e.$$.fragment,t),s=!1},d(t){W(e,t)}}}function lr(t,e,s){let{weapon_type:n="beam"}=e,{ship_change:a=$t("ship_change")||(()=>{})}=e;return t.$$set=t=>{"weapon_type"in t&&s(0,n=t.weapon_type),"ship_change"in t&&s(2,a=t.ship_change)},[n,()=>a(Ee.actions.add_weapon(n)),a,function(){n=vt(this),s(0,n)}]}class or extends c{constructor(t){super(),l(this,t,lr,cr,o,{weapon_type:0,ship_change:2})}}function ir(t,e,s){const n=t.slice();return n[23]=e[s],n}function $r(t){let e,s;return e=new un({props:{show:t[2]}}),e.$on("close",t[12]),{c(){z(e.$$.fragment)},l(t){B(e.$$.fragment,t)},m(t,n){H(e,t,n),s=!0},p(t,s){const n={};4&s&&(n.show=t[2]),e.$set(n)},i(t){s||(G(e.$$.fragment,t),s=!0)},o(t){R(e.$$.fragment,t),s=!1},d(t){W(e,t)}}}function ur(t){let e,s,n,a,r,c,l,o,_,b,w,x,E,I,k,D,M,P,T;s=new ln({}),a=new ga({props:{ftl:t[1].ftl,engine:t[1].engine}}),a.$on("change_ftl",t[5]),a.$on("change_engine",t[6]);const N=[{ship_mass:t[1].general.mass},t[1].structure.hull,{screens:t[1].structure.screens},{armour:t[1].structure.armour},{cargo:t[1].cargo},{streamlining:t[1].streamlining}];let O={};for(let i=0;it[23].id;for(let u=0;u<_.length;u+=1){let e=ir(t,_,u),s=y(e);$.set(s,i[u]=fr(s,e))}return{c(){z(e.$$.fragment),s=u(),z(n.$$.fragment),a=u(),z(r.$$.fragment),c=u();for(let t=0;t{V=null})),at());let s=D;D=q(t),D===s?S[D].p(t,e):(st(),R(S[s],1,1,(()=>{S[s]=null})),at(),M=S[D],M?M.p(t,e):(M=S[D]=A[D](t),M.c()),G(M,1),M.m(P.parentNode,P))},i(t){T||(G(e.$$.fragment,t),G(V),G(M),T=!0)},o(t){R(e.$$.fragment,t),R(V),R(M),T=!1},d(t){W(e,t),t&&m(s),t&&m(n),t&&m(I),V&&V.d(t),t&&m(k),S[D].d(t),t&&m(P),N=!1,gt(O)}}}function gr(t,e,s){let n;const a=(()=>{let t;t=window.localStorage.getItem("aotds-shipyard"),t=t?JSON.parse(t):void 0,console.log(t);const e=Ee.createStore(t,(t=>Ie(A(t))));let s;return e.dispatch(e.actions.set_ship_reqs(Et(e.getState()))),Object.entries(e.actions).forEach((([t,s])=>{e.dispatch[t]=t=>e.dispatch(s(t))})),e.subscribe((()=>{let t=e.getState();s!==t&&(s=t,console.log(t),window.localStorage.setItem("aotds-shipyard",JSON.stringify(t)))})),{subscribe:S(e.getState(),(t=>e.subscribe((()=>{t(e.getState())})))).subscribe,dispatch:e.dispatch,actions:e.actions,selectors:e.selectors}})();_t(t,a,(t=>s(1,n=t))),yt("ship",a),n.general.name;let r=[];const c=a.dispatch.reset;yt("ship_change",a.dispatch);let l=!1;let o=null;const i=t=>s(3,o=t);return t.$$.update=()=>{2&t.$$.dirty&&s(0,r=n.weaponry.weapons),1&t.$$.dirty&&console.log(r)},[r,n,l,o,a,({detail:t})=>a.dispatch.set_ftl(t),({detail:t})=>a.dispatch.set_engine(t),({detail:t})=>a.dispatch.set_hull(t),({detail:t})=>a.dispatch.set_firecons(t),c,({detail:t})=>a.dispatch.set_screens(t),({detail:t})=>a.dispatch(t),()=>s(2,l=!l),i,()=>i(null),()=>i("json"),()=>i("print"),()=>i(null)]}class vr extends c{constructor(t){super(),l(this,t,gr,dr,o,{})}}function _r(t){let e,s;return e=new vr({}),{c(){z(e.$$.fragment)},l(t){B(e.$$.fragment,t)},m(t,n){H(e,t,n),s=!0},p:b,i(t){s||(G(e.$$.fragment,t),s=!0)},o(t){R(e.$$.fragment,t),s=!1},d(t){W(e,t)}}}export default class extends c{constructor(t){super(),l(this,t,null,_r,o,{})}}