aotds-docks/docs/_app/pages/index.svelte-67efb01c.js
2021-06-13 13:04:00 -04:00

2 lines
85 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

var t=Object.defineProperty,e=Object.defineProperties,s=Object.getOwnPropertyDescriptors,n=Object.getOwnPropertySymbols,a=Object.prototype.hasOwnProperty,r=Object.prototype.propertyIsEnumerable,c=(e,s,n)=>s in e?t(e,s,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[s]=n,l=(t,e)=>{for(var s in e||(e={}))a.call(e,s)&&c(t,s,e[s]);if(n)for(var s of n(e))r.call(e,s)&&c(t,s,e[s]);return t},o=(t,n)=>e(t,s(n));import{S as i,i as $,s as u,e as h,t as p,k as f,c as m,a as d,g,d as v,n as y,b,f as w,F as x,G as E,H as I,I as k,J as D,K as P,L as M,M as T,N,O,_ as V,P as A,Q as S,R as q,T as C,h as L,U as F,V as U,W as j,X as z,j as B,m as H,o as G,v as R,r as W,w as Y,Y as J,Z as X,$ as Z,a0 as K,a1 as Q,a2 as tt,l as et,D as st,B as nt,a3 as at,u as rt,E as ct,p as lt,q as ot,a4 as it,A as $t,a5 as ut,a6 as ht,a7 as pt,a8 as ft,a9 as mt,aa as dt,ab as gt,ac as vt,ad as yt,ae as _t,x as bt}from"../chunks/vendor-dc8940a4.js";import wt,{Updux as xt}from"updux";import Et from"@yanick/updeep";function It(t){let e,s,n,a,r,c,l,o,i;return{c(){e=h("header"),s=h("h1"),n=p("The Docks"),a=f(),r=h("h2"),c=p("a "),l=h("a"),o=p("Full Thrust"),i=p(" ship builder"),this.h()},l(t){e=m(t,"HEADER",{class:!0});var $=d(e);s=m($,"H1",{class:!0});var u=d(s);n=g(u,"The Docks"),u.forEach(v),a=y($),r=m($,"H2",{class:!0});var h=d(r);c=g(h,"a "),l=m(h,"A",{href:!0});var p=d(l);o=g(p,"Full Thrust"),p.forEach(v),i=g(h," ship builder"),h.forEach(v),$.forEach(v),this.h()},h(){b(s,"class","svelte-1me5k9w"),b(l,"href","https://shop.groundzerogames.co.uk/rules.html"),b(r,"class","svelte-1me5k9w"),b(e,"class","svelte-1me5k9w")},m(t,$){w(t,e,$),x(e,s),x(s,n),x(e,a),x(e,r),x(r,c),x(r,l),x(l,o),x(r,i)},p:E,i:E,o:E,d(t){t&&v(e)}}}class kt extends i{constructor(t){super(),$(this,t,null,It,u,{})}}const Dt=(t={})=>[T(["cost","mass"],t),...Object.values(t||{}).filter((t=>"object"==typeof t)).map((t=>Dt(t)))];function Pt(t){console.log(t);let e=t,{general:s}=e,c=((t,e)=>{var s={};for(var c in t)a.call(t,c)&&e.indexOf(c)<0&&(s[c]=t[c]);if(null!=t&&n)for(var c of n(t))e.indexOf(c)<0&&r.call(t,c)&&(s[c]=t[c]);return s})(e,["general"]);const i=I(Dt,k,D(P("cost")))(o(l({},c),{cost:s.mass,mass:0}));return{mass:M("mass",i),cost:M("cost",i)}}const Mt=t=>Math.ceil(Math.round(10*t)/10);const Tt=N("set_ftl",O()),Nt=N("set_ftl_reqs",O()),Ot=new wt({initial:{mass:0,cost:0,type:"none"}});Ot.addMutation(Tt,(t=>Et.update({type:t}))),Ot.addMutation(Nt,(t=>Et.update(t)));var Vt=Ot.asDux;const At=N("set_engine",O()),St=N("set_drive_reqs",O()),qt=new wt({initial:{mass:1,cost:2,rating:1}});qt.addMutation(At,(t=>Et.update(t))),qt.addMutation(St,(t=>Et.update(t)));var Ct=qt.asDux;function Lt(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,Ft(e)?s+=2:s+=e.length-1);4==t&&(s=8,Ft(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 Ft=t=>4===t.length&&!t.some((t=>1===t.length));const Ut=N("add_weapon",O()),jt=N("remove_weapon",O()),zt=(Bt=t=>Et(Lt(t)),t=>Bt(t)(t));var Bt;const Ht=new xt({initial:[]}),Gt={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"]}};Ht.addMutation(Ut,(t=>e=>{const s=1+Math.max(0,...e.map((({id:t})=>t)));return[...e,o(l({},zt(Gt[t])),{id:s})]})),Ht.addMutation(jt,(t=>e=>e.filter((e=>e.id!==t))));const Rt=N("set_weapon",O());Ht.addMutation(Rt,(t=>Et.map(Et.if(_.matches({id:t.id}),(e=>zt(Et(t,e)))))));var Wt=Ht.asDux;const Yt=new xt({initial:{rating:0,cost:0,mass:0}});Yt.addMutation(N("set_adfc",O()),(t=>Et.update({rating:t,mass:2*t,cost:8*t})));var Jt=new xt({initial:{firecons:{nbr:0,cost:0,mass:0}},subduxes:{weapons:Wt,adfc:Yt.asDux}}).asDux;const Xt=[{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 Zt(t=0,e=!1){return console.log({carrier:e}),Xt.filter((t=>e==!!t.carrier)).filter((e=>e.mass[0]<=t)).filter((e=>e.mass[1]>=t))}const Kt=new xt({initial:{standard:0,advanced:0,cost:0,mass:0}}),Qt=N("set_screens",O());Kt.addMutation(Qt,(t=>Et.update(t)));const te=N("set_screens_reqs",O());Kt.addMutation(te,(t=>Et.update(t)));var ee=Kt.asDux;const se=new xt({initial:[]}),ne=N("set_armour_nbr_layers",O());se.addMutation(ne,(t=>e=>(e.length>t&&(e=e.slice(0,t)),e.length<t&&(e=[e,V.times(t-e.length,(()=>[]))].flat()),e=Et.map(((t,e)=>l({layer:e+1,rating:0,cost:0,mass:0},t)),e)))),se.addMutation(N("set_armour_layer",O()),(({layer:t,rating:e})=>Et.map(Et.if(V.matches({layer:t}),Et({rating:e,cost:2*t*e,mass:2*e})))));var ae=se.asDux;var re=new xt({initial:{mass:0,cost:0,hull:{rating:1,advanced:!1,cost:2,mass:1}},subduxes:{screens:ee,armour:ae}}).asDux;const ce=new xt({initial:{space:0,cost:0,mass:0}}),le=N("set_cargo",O());ce.addMutation(le,(t=>()=>({space:t,cost:0,mass:t})));var oe=ce.asDux;const ie=new xt({initial:{type:"none",cost:0,mass:0}}),$e=N("set_streamlining",O());ie.addMutation($e,(t=>Et.update({type:t})));const ue=N("set_streamlining_cost_mass",O());ie.addMutation(ue,(t=>Et.update(t)));var he=ie.asDux,pe=[{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 fe=new xt({initial:{bays:0,cost:0,mass:0,squadrons:[]}}),me=N("set_squadron",O());fe.addMutation(me,(({id:t,type:e})=>Et.update({squadrons:Et.map(Et.if(V.matches({id:t}),Et({type:e,cost:6*V.find(pe,{type:e}).cost,mass:6})))})));const de=N("set_carrier_bays",O());fe.addMutation(de,(t=>e=>((e=Et.update({bays:t,mass:9*t,cost:27*t})(e)).squadrons.length>t&&(e=Et.update({squadrons:e=>e.slice(0,t)},e)),e.squadrons.length<t&&(e=Et.update({squadrons:s=>[...s,...V.times(t-e.squadrons.length,(t=>({id:1+t+e.squadrons.length,cost:6*pe[0].cost,mass:6,type:pe[0].type})))]},e)),e)));var ge=fe.asDux;const ve=N("set_ship_mass",O()),ye=N("set_name",O()),_e=N("set_ship_reqs",O()),be=N("set_hull",O()),we=N("set_ship_type",O()),xe=N("reset"),Ee={general:{ship_class:"",name:"",ship_type:"",mass:10,used_mass:0,cost:10}};console.log(xt);const Ie=new xt({subduxes:{ftl:Vt,engine:Ct,weaponry:Jt,structure:re,cargo:oe,streamlining:he,carrier:ge},initial:Ee});Ie.addMutation(xe,(()=>()=>Ee)),Ie.addMutation(be,(({rating:t})=>e=>Et.updateIn("structure.hull",{cost:2*t,rating:t,mass:t})(e))),Ie.addMutation(ve,(t=>Et.updateIn("general",{mass:t}))),Ie.addMutation(ye,(t=>Et.updateIn("general",{name:t}))),Ie.addMutation(N("set_ship_class",O()),(t=>Et.updateIn("general",{ship_class:t}))),Ie.addMutation(_e,(({cost:t,mass:e})=>Et.updateIn("general",{cost:t,used_mass:e}))),Ie.addSubscription((t=>A(Pt,(e=>t.dispatch(_e(e)))))),Ie.addSubscription((t=>A((t=>t.general.mass),(t=>t.streamlining.type),((e,s)=>{const n=Mt(e*("none"===s?0:"partial"===s?5:10)/100),a=2*n;t.dispatch(Ie.actions.set_streamlining_cost_mass({cost:a,mass:n}))})))),Ie.addSubscription((t=>A((t=>t.general.mass),(t=>t.general.ship_type),(t=>t.carrier.bays),((e,s,n)=>{console.log({bays:n});const a=Zt(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)))})))),Ie.addMutation(we,(t=>Et.updateIn("general.ship_type",t))),Ie.addSubscription((t=>A([t=>t.general.mass,t=>t.ftl.type],((e,s)=>t.dispatch(Vt.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))))))),Ie.addSubscription((t=>A((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,Mt(.05*e)),r=n*Math.max(4,Mt(.075*e));t.dispatch(Ie.actions.set_screens_reqs({mass:a+r,cost:3*a+4*r}))})))),Ie.addSubscription((t=>A([t=>t.general.mass,t=>t.engine.rating,t=>t.engine.advanced],((e,s,n)=>t.dispatch(Ie.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 ke=N("set_firecons",O());Ie.addMutation(ke,(t=>Et.updateIn("weaponry.firecons",l({nbr:t},(t=>({cost:4*t,mass:t}))(t)))));var De=Ie.asDux;let Pe=C;Pe=window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__;function Me(t){let e,s,n,a,r,c;return{c(){e=h("aside"),s=h("pre"),n=h("code"),a=p(t[0]),this.h()},l(r){e=m(r,"ASIDE",{class:!0});var c=d(e);s=m(c,"PRE",{class:!0});var l=d(s);n=m(l,"CODE",{});var o=d(n);a=g(o,t[0]),o.forEach(v),l.forEach(v),c.forEach(v),this.h()},h(){b(s,"class","svelte-2g9858"),b(e,"class","svelte-2g9858")},m(t,r){w(t,e,r),x(e,s),x(s,n),x(n,a),c=!0},p(t,[e]){(!c||1&e)&&L(a,t[0])},i(t){c||(F((()=>{r||(r=U(e,j,{},!0)),r.run(1)})),c=!0)},o(t){r||(r=U(e,j,{},!1)),r.run(0),c=!1},d(t){t&&v(e),t&&r&&r.end()}}}function Te(t,e,s){let n,{ship:a={}}=e;return z(),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 Ne extends i{constructor(t){super(),$(this,t,Te,Me,u,{ship:1})}}function Oe(t){let e,s;return{c(){e=h("div"),s=p(t[0]),this.h()},l(n){e=m(n,"DIV",{class:!0});var a=d(e);s=g(a,t[0]),a.forEach(v),this.h()},h(){b(e,"class","svelte-1oeefsn")},m(t,n){w(t,e,n),x(e,s)},p(t,[e]){1&e&&L(s,t[0])},i:E,o:E,d(t){t&&v(e)}}}function Ve(t,e,s){let{cost:n=0}=e;return t.$$set=t=>{"cost"in t&&s(0,n=t.cost)},[n]}class Ae extends i{constructor(t){super(),$(this,t,Ve,Oe,u,{cost:0})}}function Se(t){let e,s;return{c(){e=h("div"),s=p(t[0]),this.h()},l(n){e=m(n,"DIV",{class:!0});var a=d(e);s=g(a,t[0]),a.forEach(v),this.h()},h(){b(e,"class","svelte-wps6ap")},m(t,n){w(t,e,n),x(e,s)},p(t,[e]){1&e&&L(s,t[0])},i:E,o:E,d(t){t&&v(e)}}}function qe(t,e,s){let{mass:n=0}=e;return t.$$set=t=>{"mass"in t&&s(0,n=t.mass)},[n]}class Ce extends i{constructor(t){super(),$(this,t,qe,Se,u,{mass:0})}}function Le(t){let e,s,n,a,r,c,l,o,i,$,u,_,E,I,k;return _=new Ae({props:{cost:t[2]}}),I=new Ce({props:{mass:t[3]}}),{c(){e=h("h1"),s=p("ship name: "),n=h("div"),a=f(),r=h("div"),c=h("h2"),l=p(t[0]),o=p("-class, "),i=p(t[1]),$=f(),u=h("div"),B(_.$$.fragment),E=p("\n  \n "),B(I.$$.fragment),this.h()},l(h){e=m(h,"H1",{class:!0});var p=d(e);s=g(p,"ship name: "),n=m(p,"DIV",{class:!0}),d(n).forEach(v),p.forEach(v),a=y(h),r=m(h,"DIV",{class:!0});var f=d(r);c=m(f,"H2",{class:!0});var b=d(c);l=g(b,t[0]),o=g(b,"-class, "),i=g(b,t[1]),b.forEach(v),$=y(f),u=m(f,"DIV",{class:!0});var w=d(u);H(_.$$.fragment,w),E=g(w,"\n  \n "),H(I.$$.fragment,w),w.forEach(v),f.forEach(v),this.h()},h(){b(n,"class","fill svelte-bo35k"),b(e,"class","svelte-bo35k"),b(c,"class","svelte-bo35k"),b(u,"class","reqs svelte-bo35k"),b(r,"class","details svelte-bo35k")},m(t,h){w(t,e,h),x(e,s),x(e,n),w(t,a,h),w(t,r,h),x(r,c),x(c,l),x(c,o),x(c,i),x(r,$),x(r,u),G(_,u,null),x(u,E),G(I,u,null),k=!0},p(t,[e]){(!k||1&e)&&L(l,t[0]),(!k||2&e)&&L(i,t[1]);const s={};4&e&&(s.cost=t[2]),_.$set(s);const n={};8&e&&(n.mass=t[3]),I.$set(n)},i(t){k||(R(_.$$.fragment,t),R(I.$$.fragment,t),k=!0)},o(t){W(_.$$.fragment,t),W(I.$$.fragment,t),k=!1},d(t){t&&v(e),t&&v(a),t&&v(r),Y(_),Y(I)}}}function Fe(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 Ue extends i{constructor(t){super(),$(this,t,Fe,Le,u,{ship_class:0,ship_type:1,cost:2,mass:3})}}function je(t){let e,s;return{c(){e=h("img"),this.h()},l(t){e=m(t,"IMG",{class:!0,src:!0,alt:!0}),this.h()},h(){b(e,"class","ftl svelte-w7le23"),e.src!==(s="icons/ftl-drive.svg")&&b(e,"src","icons/ftl-drive.svg"),b(e,"alt","ftl drive")},m(t,s){w(t,e,s)},d(t){t&&v(e)}}}function ze(t){let e,s;return{c(){e=h("div"),s=p(t[1]),this.h()},l(n){e=m(n,"DIV",{class:!0});var a=d(e);s=g(a,t[1]),a.forEach(v),this.h()},h(){b(e,"class","thrust svelte-w7le23")},m(t,n){w(t,e,n),x(e,s)},p(t,e){2&e&&L(s,t[1])},d(t){t&&v(e)}}}function Be(t){let e,s,n,a,r,c="none"!==t[0]&&je(),l=t[1]>0&&ze(t);return{c(){e=h("div"),c&&c.c(),s=f(),l&&l.c(),n=f(),a=h("img"),this.h()},l(t){e=m(t,"DIV",{class:!0});var r=d(e);c&&c.l(r),s=y(r),l&&l.l(r),n=y(r),a=m(r,"IMG",{class:!0,src:!0,alt:!0}),r.forEach(v),this.h()},h(){b(a,"class","internal svelte-w7le23"),a.src!==(r="icons/internal-systems.svg")&&b(a,"src","icons/internal-systems.svg"),b(a,"alt","internal systems"),b(e,"class","main_systems svelte-w7le23")},m(t,r){w(t,e,r),c&&c.m(e,null),x(e,s),l&&l.m(e,null),x(e,n),x(e,a)},p(t,[a]){"none"!==t[0]?c||(c=je(),c.c(),c.m(e,s)):c&&(c.d(1),c=null),t[1]>0?l?l.p(t,a):(l=ze(t),l.c(),l.m(e,n)):l&&(l.d(1),l=null)},i:E,o:E,d(t){t&&v(e),c&&c.d(),l&&l.d()}}}function He(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 Ge extends i{constructor(t){super(),$(this,t,He,Be,u,{ftl:0,engine:1})}}function Re(t,e,s){const n=t.slice();return n[7]=e[s],n[9]=s,n}function We(t,e,s){const n=t.slice();return n[10]=e[s],n[12]=s,n}function Ye(t){let e,s;return{c(){e=h("img"),this.h()},l(t){e=m(t,"IMG",{src:!0,alt:!0,class:!0}),this.h()},h(){e.src!==(s="icons/crew-star.svg")&&b(e,"src","icons/crew-star.svg"),b(e,"alt","crew loss threshold"),b(e,"class","svelte-qekx9g")},m(t,s){w(t,e,s)},d(t){t&&v(e)}}}function Je(t,e){let s,n=e[10]&&Ye();return{key:t,first:null,c(){s=h("div"),n&&n.c(),this.h()},l(t){s=m(t,"DIV",{class:!0});var e=d(s);n&&n.l(e),e.forEach(v),this.h()},h(){b(s,"class","cell svelte-qekx9g"),this.first=s},m(t,e){w(t,s,e),n&&n.m(s,null)},p(t,a){(e=t)[10]?n||(n=Ye(),n.c(),n.m(s,null)):n&&(n.d(1),n=null)},d(t){t&&v(s),n&&n.d()}}}function Xe(t,e){let s,n,a=[],r=new Map,c=e[7];const l=t=>t[12];for(let o=0;o<c.length;o+=1){let t=We(e,c,o),s=l(t);r.set(s,a[o]=Je(s,t))}return{key:t,first:null,c(){s=h("div");for(let t=0;t<a.length;t+=1)a[t].c();n=f(),this.h()},l(t){s=m(t,"DIV",{class:!0});var e=d(s);for(let s=0;s<a.length;s+=1)a[s].l(e);n=y(e),e.forEach(v),this.h()},h(){b(s,"class","row svelte-qekx9g"),this.first=s},m(t,e){w(t,s,e);for(let n=0;n<a.length;n+=1)a[n].m(s,null);x(s,n)},p(t,o){e=t,1&o&&(c=e[7],a=J(a,o,l,1,e,c,r,s,X,Je,n,We))},d(t){t&&v(s);for(let e=0;e<a.length;e+=1)a[e].d()}}}function Ze(t){let e,s=[],n=new Map,a=t[0];const r=t=>t[9];for(let c=0;c<a.length;c+=1){let e=Re(t,a,c),l=r(e);n.set(l,s[c]=Xe(l,e))}return{c(){e=h("div");for(let t=0;t<s.length;t+=1)s[t].c()},l(t){e=m(t,"DIV",{});var n=d(e);for(let e=0;e<s.length;e+=1)s[e].l(n);n.forEach(v)},m(t,n){w(t,e,n);for(let a=0;a<s.length;a+=1)s[a].m(e,null)},p(t,[c]){1&c&&(a=t[0],s=J(s,c,r,1,t,a,n,e,X,Xe,null,Re))},i:E,o:E,d(t){t&&v(e);for(let e=0;e<s.length;e+=1)s[e].d()}}}function Ke(t,e){if(e<=1)return[t];let s=t.length/e;return t.length%e&&s++,[t.slice(0,s),...Ke(t.slice(s),e-1)]}function Qe(t,e,s){let n,a,r,{ship_mass:c=0}=e,{rating:l=0}=e,{advanced:o=!1}=e,i=[];return t.$$set=t=>{"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=Mt(c/20)),96&t.$$.dirty&&s(5,a=Ke(a,r).map((t=>(t[t.length-1]=!0,t))).flat()),48&t.$$.dirty&&s(0,i=Ke(a,n))},[i,c,l,o,n,a,r]}class ts extends i{constructor(t){super(),$(this,t,Qe,Ze,u,{ship_mass:1,rating:2,advanced:3})}}function es(t,e,s){const n=t.slice();return n[1]=e[s],n}function ss(t,e,s){const n=t.slice();return n[4]=e[s],n}function ns(t,e){let s;return{key:t,first:null,c(){s=h("div"),this.h()},l(t){s=m(t,"DIV",{class:!0}),d(s).forEach(v),this.h()},h(){b(s,"class","cell svelte-15e5q3d"),this.first=s},m(t,e){w(t,s,e)},p(t,e){},d(t){t&&v(s)}}}function as(t,e){let s,n,a=[],r=new Map,c=V.range(e[1].rating);const l=t=>t[4];for(let o=0;o<c.length;o+=1){let t=ss(e,c,o),s=l(t);r.set(s,a[o]=ns(s))}return{key:t,first:null,c(){s=h("div");for(let t=0;t<a.length;t+=1)a[t].c();n=f(),this.h()},l(t){s=m(t,"DIV",{class:!0});var e=d(s);for(let s=0;s<a.length;s+=1)a[s].l(e);n=y(e),e.forEach(v),this.h()},h(){b(s,"class","layer"),this.first=s},m(t,e){w(t,s,e);for(let n=0;n<a.length;n+=1)a[n].m(s,null);x(s,n)},p(t,o){e=t,1&o&&(c=V.range(e[1].rating),a=J(a,o,l,0,e,c,r,s,X,ns,n,ss))},d(t){t&&v(s);for(let e=0;e<a.length;e+=1)a[e].d()}}}function rs(t){let e,s=[],n=new Map,a=t[0];const r=t=>t[1];for(let c=0;c<a.length;c+=1){let e=es(t,a,c),l=r(e);n.set(l,s[c]=as(l,e))}return{c(){e=h("div");for(let t=0;t<s.length;t+=1)s[t].c();this.h()},l(t){e=m(t,"DIV",{class:!0});var n=d(e);for(let e=0;e<s.length;e+=1)s[e].l(n);n.forEach(v),this.h()},h(){b(e,"class","layers svelte-15e5q3d")},m(t,n){w(t,e,n);for(let a=0;a<s.length;a+=1)s[a].m(e,null)},p(t,[c]){1&c&&(a=t[0],s=J(s,c,r,1,t,a,n,e,X,as,null,es))},i:E,o:E,d(t){t&&v(e);for(let e=0;e<s.length;e+=1)s[e].d()}}}function cs(t,e,s){let{armour:n=[]}=e;return t.$$set=t=>{"armour"in t&&s(0,n=t.armour)},t.$$.update=()=>{1&t.$$.dirty&&console.log(n)},[n]}class ls extends i{constructor(t){super(),$(this,t,cs,rs,u,{armour:0})}}function os(t){let e,s,n,a,r;return s=new ls({props:{armour:t[0].armour}}),a=new ts({props:{rating:t[0].hull.rating,advanced:t[0].hull.advanced,ship_mass:t[1]}}),{c(){e=h("div"),B(s.$$.fragment),n=f(),B(a.$$.fragment)},l(t){e=m(t,"DIV",{});var r=d(e);H(s.$$.fragment,r),n=y(r),H(a.$$.fragment,r),r.forEach(v)},m(t,c){w(t,e,c),G(s,e,null),x(e,n),G(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||(R(s.$$.fragment,t),R(a.$$.fragment,t),r=!0)},o(t){W(s.$$.fragment,t),W(a.$$.fragment,t),r=!1},d(t){t&&v(e),Y(s),Y(a)}}}function is(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 $s extends i{constructor(t){super(),$(this,t,is,os,u,{structure:0,ship_mass:1})}}function us(t){let e,s,n,a;return{c(){e=Z("g"),s=Z("path"),this.h()},l(t){e=m(t,"g",{transform:!0},1);var n=d(e);s=m(n,"path",{d:!0,class:!0},1),d(s).forEach(v),n.forEach(v),this.h()},h(){b(s,"d",t[1]),b(s,"class","svelte-7q6uh5"),K(s,"active",t[0]),b(e,"transform",t[2])},m(r,c){w(r,e,c),x(e,s),n||(a=Q(s,"click",t[7]),n=!0)},p(t,[n]){2&n&&b(s,"d",t[1]),1&n&&K(s,"active",t[0]),4&n&&b(e,"transform",t[2])},i:E,o:E,d(t){t&&v(e),n=!1,a()}}}function hs(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){tt(t,e)}]}class ps extends i{constructor(t){super(),$(this,t,hs,us,u,{arc:3,radius:4,active:0})}}function fs(t,e,s){const n=t.slice();return n[8]=e[s],n}function ms(t,e){let s,n,a;return n=new ps({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=et(),B(n.$$.fragment),this.h()},l(t){s=et(),H(n.$$.fragment,t),this.h()},h(){this.first=s},m(t,e){w(t,s,e),G(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||(R(n.$$.fragment,t),a=!0)},o(t){W(n.$$.fragment,t),a=!1},d(t){t&&v(s),Y(n,t)}}}function ds(t){let e,s,n,a,r,c,l=[],o=new Map,i=t[2];const $=t=>t[8];for(let p=0;p<i.length;p+=1){let e=fs(t,i,p),s=$(e);o.set(s,l[p]=ms(s,e))}const u=t[5].default,h=st(u,t,t[4],null);return{c(){e=Z("svg");for(let t=0;t<l.length;t+=1)l[t].c();s=Z("circle"),h&&h.c(),this.h()},l(t){e=m(t,"svg",{width:!0,height:!0},1);var n=d(e);for(let e=0;e<l.length;e+=1)l[e].l(n);s=m(n,"circle",{cx:!0,cy:!0,r:!0,class:!0},1),d(s).forEach(v),h&&h.l(n),n.forEach(v),this.h()},h(){b(s,"cx","50%"),b(s,"cy","50%"),b(s,"r",n=t[1]/3),b(s,"class","svelte-qqgo8u"),b(e,"width",a=t[1]+"px"),b(e,"height",r=t[1]+"px")},m(t,n){w(t,e,n);for(let s=0;s<l.length;s+=1)l[s].m(e,null);x(e,s),h&&h.m(e,null),c=!0},p(t,[p]){15&p&&(i=t[2],nt(),l=J(l,p,$,1,t,i,o,e,at,ms,s,fs),rt()),(!c||2&p&&n!==(n=t[1]/3))&&b(s,"r",n),h&&h.p&&(!c||16&p)&&ct(h,u,t,t[4],p,null,null),(!c||2&p&&a!==(a=t[1]+"px"))&&b(e,"width",a),(!c||2&p&&r!==(r=t[1]+"px"))&&b(e,"height",r)},i(t){if(!c){for(let t=0;t<i.length;t+=1)R(l[t]);R(h,t),c=!0}},o(t){for(let e=0;e<l.length;e+=1)W(l[e]);W(h,t),c=!1},d(t){t&&v(e);for(let e=0;e<l.length;e+=1)l[e].d();h&&h.d(t)}}}function gs(t,e,s){let{$$slots:n={},$$scope:a}=e;let{selected:r=[]}=e,{size:c=60}=e;const l=z(),o=t=>l("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 vs extends i{constructor(t){super(),$(this,t,gs,ds,u,{selected:0,size:1})}}function ys(t){let e,s;return{c(){e=Z("text"),s=p(t[0]),this.h()},l(n){e=m(n,"text",{x:!0,y:!0,class:!0},1);var a=d(e);s=g(a,t[0]),a.forEach(v),this.h()},h(){b(e,"x","50%"),b(e,"y","50%"),b(e,"class","svelte-1u8rlr5")},m(t,n){w(t,e,n),x(e,s)},p(t,e){1&e&&L(s,t[0])},d(t){t&&v(e)}}}function _s(t){let e,s,n;return s=new vs({props:{selected:t[1],size:"40",$$slots:{default:[ys]},$$scope:{ctx:t}}}),{c(){e=h("div"),B(s.$$.fragment),this.h()},l(t){e=m(t,"DIV",{class:!0});var n=d(e);H(s.$$.fragment,n),n.forEach(v),this.h()},h(){b(e,"class","svelte-1u8rlr5")},m(t,a){w(t,e,a),G(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||(R(s.$$.fragment,t),n=!0)},o(t){W(s.$$.fragment,t),n=!1},d(t){t&&v(e),Y(s)}}}function bs(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 ws extends i{constructor(t){super(),$(this,t,bs,_s,u,{weapon_class:0,arcs:1})}}function xs(t,e,s){const n=t.slice();return n[2]=e[s],n}function Es(t){let e,s;const n=[t[2]];let a={};for(let r=0;r<n.length;r+=1)a=$t(a,n[r]);return e=new ws({props:a}),{c(){B(e.$$.fragment)},l(t){H(e.$$.fragment,t)},m(t,n){G(e,t,n),s=!0},p(t,s){const a=1&s?lt(n,[ot(t[2])]):{};e.$set(a)},i(t){s||(R(e.$$.fragment,t),s=!0)},o(t){W(e.$$.fragment,t),s=!1},d(t){Y(e,t)}}}function Is(t){let e,s,n,a=t[0],r=[];for(let l=0;l<a.length;l+=1)r[l]=Es(xs(t,a,l));const c=t=>W(r[t],1,1,(()=>{r[t]=null}));return{c(){e=h("div"),s=h("div");for(let t=0;t<r.length;t+=1)r[t].c();this.h()},l(t){e=m(t,"DIV",{class:!0});var n=d(e);s=m(n,"DIV",{class:!0});var a=d(s);for(let e=0;e<r.length;e+=1)r[e].l(a);a.forEach(v),n.forEach(v),this.h()},h(){b(s,"class","beams svelte-18nuiwu"),b(e,"class","weapons svelte-18nuiwu")},m(t,a){w(t,e,a),x(e,s);for(let e=0;e<r.length;e+=1)r[e].m(s,null);n=!0},p(t,[e]){if(1&e){let n;for(a=t[0],n=0;n<a.length;n+=1){const c=xs(t,a,n);r[n]?(r[n].p(c,e),R(r[n],1)):(r[n]=Es(c),r[n].c(),R(r[n],1),r[n].m(s,null))}for(nt(),n=a.length;n<r.length;n+=1)c(n);rt()}},i(t){if(!n){for(let t=0;t<a.length;t+=1)R(r[t]);n=!0}},o(t){r=r.filter(Boolean);for(let e=0;e<r.length;e+=1)W(r[e]);n=!1},d(t){t&&v(e),it(r,t)}}}function ks(t,e,s){let{weapons:n=[]}=e,a=[];return t.$$set=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 Ds extends i{constructor(t){super(),$(this,t,ks,Is,u,{weapons:1})}}function Ps(t,e,s){const n=t.slice();return n[1]=e[s],n}function Ms(t){let e,s;return{c(){e=h("img"),this.h()},l(t){e=m(t,"IMG",{class:!0,src:!0,alt:!0}),this.h()},h(){b(e,"class","firecon svelte-10x4b15"),e.src!==(s="icons/firecon.svg")&&b(e,"src","icons/firecon.svg"),b(e,"alt","firecon")},m(t,s){w(t,e,s)},d(t){t&&v(e)}}}function Ts(t){let e,s=_.range(t[0]),n=[];for(let a=0;a<s.length;a+=1)n[a]=Ms(Ps(t,s,a));return{c(){e=h("div");for(let t=0;t<n.length;t+=1)n[t].c();this.h()},l(t){e=m(t,"DIV",{class:!0});var s=d(e);for(let e=0;e<n.length;e+=1)n[e].l(s);s.forEach(v),this.h()},h(){b(e,"class","svelte-10x4b15")},m(t,s){w(t,e,s);for(let a=0;a<n.length;a+=1)n[a].m(e,null)},p(t,[a]){if(1&a){const a=s.length;let r;for(s=_.range(t[0]),r=a;r<s.length;r+=1)Ps(t,s,r),n[r]||(n[r]=Ms(),n[r].c(),n[r].m(e,null));for(r=s.length;r<a;r+=1)n[r].d(1);n.length=s.length}},i:E,o:E,d(t){t&&v(e),it(n,t)}}}function Ns(t,e,s){let{firecons:n=0}=e;return t.$$set=t=>{"firecons"in t&&s(0,n=t.firecons)},[n]}class Os extends i{constructor(t){super(),$(this,t,Ns,Ts,u,{firecons:0})}}function Vs(t,e,s){const n=t.slice();return n[2]=e[s],n}function As(t,e,s){const n=t.slice();return n[2]=e[s],n}function Ss(t){let e,s;return{c(){e=h("img"),this.h()},l(t){e=m(t,"IMG",{src:!0,alt:!0,class:!0}),this.h()},h(){e.src!==(s="icons/screen.svg")&&b(e,"src","icons/screen.svg"),b(e,"alt","screen"),b(e,"class","svelte-kh7po5")},m(t,s){w(t,e,s)},d(t){t&&v(e)}}}function qs(t){let e,s;return{c(){e=h("img"),this.h()},l(t){e=m(t,"IMG",{src:!0,alt:!0,class:!0}),this.h()},h(){e.src!==(s="icons/screen-advanced.svg")&&b(e,"src","icons/screen-advanced.svg"),b(e,"alt","advanced screen"),b(e,"class","svelte-kh7po5")},m(t,s){w(t,e,s)},d(t){t&&v(e)}}}function Cs(t){let e,s,n=V.range(t[0]),a=[];for(let l=0;l<n.length;l+=1)a[l]=Ss(As(t,n,l));let r=V.range(t[1]),c=[];for(let l=0;l<r.length;l+=1)c[l]=qs(Vs(t,r,l));return{c(){e=h("div");for(let t=0;t<a.length;t+=1)a[t].c();s=f();for(let t=0;t<c.length;t+=1)c[t].c();this.h()},l(t){e=m(t,"DIV",{class:!0});var n=d(e);for(let e=0;e<a.length;e+=1)a[e].l(n);s=y(n);for(let e=0;e<c.length;e+=1)c[e].l(n);n.forEach(v),this.h()},h(){b(e,"class","svelte-kh7po5")},m(t,n){w(t,e,n);for(let s=0;s<a.length;s+=1)a[s].m(e,null);x(e,s);for(let s=0;s<c.length;s+=1)c[s].m(e,null)},p(t,[l]){if(1&l){const r=n.length;let c;for(n=V.range(t[0]),c=r;c<n.length;c+=1)As(t,n,c),a[c]||(a[c]=Ss(),a[c].c(),a[c].m(e,s));for(c=n.length;c<r;c+=1)a[c].d(1);a.length=n.length}if(2&l){const s=r.length;let n;for(r=V.range(t[1]),n=s;n<r.length;n+=1)Vs(t,r,n),c[n]||(c[n]=qs(),c[n].c(),c[n].m(e,null));for(n=r.length;n<s;n+=1)c[n].d(1);c.length=r.length}},i:E,o:E,d(t){t&&v(e),it(a,t),it(c,t)}}}function Ls(t,e,s){let{standard:n=0}=e,{advanced:a=0}=e;return t.$$set=t=>{"standard"in t&&s(0,n=t.standard),"advanced"in t&&s(1,a=t.advanced)},[n,a]}class Fs extends i{constructor(t){super(),$(this,t,Ls,Cs,u,{standard:0,advanced:1})}}function Us(t){let e,s,n,a,r;s=new Os({props:{firecons:t[0]}});const c=[t[1]];let l={};for(let o=0;o<c.length;o+=1)l=$t(l,c[o]);return a=new Fs({props:l}),{c(){e=h("div"),B(s.$$.fragment),n=f(),B(a.$$.fragment),this.h()},l(t){e=m(t,"DIV",{class:!0});var r=d(e);H(s.$$.fragment,r),n=y(r),H(a.$$.fragment,r),r.forEach(v),this.h()},h(){b(e,"class","svelte-ytgy37")},m(t,c){w(t,e,c),G(s,e,null),x(e,n),G(a,e,null),r=!0},p(t,[e]){const n={};1&e&&(n.firecons=t[0]),s.$set(n);const r=2&e?lt(c,[ot(t[1])]):{};a.$set(r)},i(t){r||(R(s.$$.fragment,t),R(a.$$.fragment,t),r=!0)},o(t){W(s.$$.fragment,t),W(a.$$.fragment,t),r=!1},d(t){t&&v(e),Y(s),Y(a)}}}function js(t,e,s){let{firecons:n=0}=e,{screens:a={}}=e;return t.$$set=t=>{"firecons"in t&&s(0,n=t.firecons),"screens"in t&&s(1,a=t.screens)},[n,a]}class zs extends i{constructor(t){super(),$(this,t,js,Us,u,{firecons:0,screens:1})}}function Bs(t){let e,s,n,a,r,c,l,o,i,$,u,p,g;const _=[t[0].general];let E={};for(let h=0;h<_.length;h+=1)E=$t(E,_[h]);return s=new Ue({props:E}),a=new Ds({props:{weapons:t[0].weaponry.weapons}}),l=new $s({props:{structure:t[0].structure,ship_mass:t[0].general.mass}}),i=new zs({props:{firecons:t[0].weaponry.firecons.nbr,screens:t[0].structure.screens}}),u=new Ge({props:{ftl:t[0].ftl.type,engine:t[0].engine.rating}}),{c(){e=h("aside"),B(s.$$.fragment),n=f(),B(a.$$.fragment),r=f(),c=h("div"),B(l.$$.fragment),o=f(),B(i.$$.fragment),$=f(),B(u.$$.fragment),this.h()},l(t){e=m(t,"ASIDE",{class:!0});var h=d(e);H(s.$$.fragment,h),n=y(h),H(a.$$.fragment,h),r=y(h),c=m(h,"DIV",{class:!0});var p=d(c);H(l.$$.fragment,p),o=y(p),H(i.$$.fragment,p),p.forEach(v),$=y(h),H(u.$$.fragment,h),h.forEach(v),this.h()},h(){b(c,"class","section-2 svelte-5wh1p"),b(e,"class","ship-sheet svelte-5wh1p")},m(t,h){w(t,e,h),G(s,e,null),x(e,n),G(a,e,null),x(e,r),x(e,c),G(l,c,null),x(c,o),G(i,c,null),x(e,$),G(u,e,null),g=!0},p(t,[e]){const n=1&e?lt(_,[ot(t[0].general)]):{};s.$set(n);const r={};1&e&&(r.weapons=t[0].weaponry.weapons),a.$set(r);const c={};1&e&&(c.structure=t[0].structure),1&e&&(c.ship_mass=t[0].general.mass),l.$set(c);const o={};1&e&&(o.firecons=t[0].weaponry.firecons.nbr),1&e&&(o.screens=t[0].structure.screens),i.$set(o);const $={};1&e&&($.ftl=t[0].ftl.type),1&e&&($.engine=t[0].engine.rating),u.$set($)},i(t){g||(R(s.$$.fragment,t),R(a.$$.fragment,t),R(l.$$.fragment,t),R(i.$$.fragment,t),R(u.$$.fragment,t),F((()=>{p||(p=U(e,j,{},!0)),p.run(1)})),g=!0)},o(t){W(s.$$.fragment,t),W(a.$$.fragment,t),W(l.$$.fragment,t),W(i.$$.fragment,t),W(u.$$.fragment,t),p||(p=U(e,j,{},!1)),p.run(0),g=!1},d(t){t&&v(e),Y(s),Y(a),Y(l),Y(i),Y(u),t&&p&&p.end()}}}function Hs(t,e,s){let{ship:n}=e;return t.$$set=t=>{"ship"in t&&s(0,n=t.ship)},[n]}class Gs extends i{constructor(t){super(),$(this,t,Hs,Bs,u,{ship:0})}}function Rs(t){let e,s;return{c(){e=h("label"),s=p(t[0]),this.h()},l(n){e=m(n,"LABEL",{class:!0});var a=d(e);s=g(a,t[0]),a.forEach(v),this.h()},h(){b(e,"class","svelte-1urp5hr")},m(t,n){w(t,e,n),x(e,s)},p(t,e){1&e&&L(s,t[0])},d(t){t&&v(e)}}}function Ws(t){let e,s,n,a=t[0]&&Rs(t);const r=t[4].default,c=st(r,t,t[3],null),l=c||function(t){let e,s,n;return{c(){e=h("input"),this.h()},l(t){e=m(t,"INPUT",{type:!0,placeholder:!0,value:!0}),this.h()},h(){b(e,"type","text"),b(e,"placeholder",t[2]),e.value=t[1]},m(a,r){w(a,e,r),s||(n=Q(e,"change",t[5]),s=!0)},p(t,s){4&s&&b(e,"placeholder",t[2]),2&s&&e.value!==t[1]&&(e.value=t[1])},d(t){t&&v(e),s=!1,n()}}}(t);return{c(){e=h("div"),a&&a.c(),s=f(),l&&l.c(),this.h()},l(t){e=m(t,"DIV",{class:!0});var n=d(e);a&&a.l(n),s=y(n),l&&l.l(n),n.forEach(v),this.h()},h(){b(e,"class","svelte-1urp5hr")},m(t,r){w(t,e,r),a&&a.m(e,null),x(e,s),l&&l.m(e,null),n=!0},p(t,[o]){t[0]?a?a.p(t,o):(a=Rs(t),a.c(),a.m(e,s)):a&&(a.d(1),a=null),c?c.p&&(!n||8&o)&&ct(c,r,t,t[3],o,null,null):l&&l.p&&6&o&&l.p(t,o)},i(t){n||(R(l,t),n=!0)},o(t){W(l,t),n=!1},d(t){t&&v(e),a&&a.d(),l&&l.d(t)}}}function Ys(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){tt(t,e)}]}class Js extends i{constructor(t){super(),$(this,t,Ys,Ws,u,{label:0,value:1,placeholder:2})}}function Xs(t,e,s){const n=t.slice();return n[7]=e[s],n}function Zs(t,e){let s,n,a,r=e[7]+"";return{key:t,first:null,c(){s=h("option"),n=p(r),this.h()},l(t){s=m(t,"OPTION",{value:!0});var e=d(s);n=g(e,r),e.forEach(v),this.h()},h(){s.__value=a=e[7],s.value=s.__value,this.first=s},m(t,e){w(t,s,e),x(s,n)},p(t,c){e=t,8&c&&r!==(r=e[7]+"")&&L(n,r),8&c&&a!==(a=e[7])&&(s.__value=a,s.value=s.__value)},d(t){t&&v(s)}}}function Ks(t){let e,s,n,a=[],r=new Map,c=t[3];const l=t=>t[7];for(let o=0;o<c.length;o+=1){let e=Xs(t,c,o),s=l(e);r.set(s,a[o]=Zs(s,e))}return{c(){e=h("select");for(let t=0;t<a.length;t+=1)a[t].c()},l(t){e=m(t,"SELECT",{value:!0});var s=d(e);for(let e=0;e<a.length;e+=1)a[e].l(s);s.forEach(v)},m(r,c){w(r,e,c);for(let t=0;t<a.length;t+=1)a[t].m(e,null);pt(e,t[2]),s||(n=Q(e,"change",t[5]),s=!0)},p(t,s){8&s&&(c=t[3],a=J(a,s,l,1,t,c,r,e,X,Zs,null,Xs)),12&s&&pt(e,t[2])},d(t){t&&v(e);for(let e=0;e<a.length;e+=1)a[e].d();s=!1,n()}}}function Qs(t){let e,s,n,a,r;return s=new Js({props:{label:"ship class",value:t[1].ship_class}}),s.$on("change",t[4]),a=new Js({props:{label:"ship type",$$slots:{default:[Ks]},$$scope:{ctx:t}}}),{c(){e=h("div"),B(s.$$.fragment),n=f(),B(a.$$.fragment),this.h()},l(t){e=m(t,"DIV",{class:!0});var r=d(e);H(s.$$.fragment,r),n=y(r),H(a.$$.fragment,r),r.forEach(v),this.h()},h(){b(e,"class","svelte-fc2507")},m(t,c){w(t,e,c),G(s,e,null),x(e,n),G(a,e,null),r=!0},p(t,[e]){const n={};2&e&&(n.value=t[1].ship_class),s.$set(n);const r={};1036&e&&(r.$$scope={dirty:e,ctx:t}),a.$set(r)},i(t){r||(R(s.$$.fragment,t),R(a.$$.fragment,t),r=!0)},o(t){W(s.$$.fragment,t),W(a.$$.fragment,t),r=!1},d(t){t&&v(e),Y(s),Y(a)}}}function tn(t,e,s){let n,a=E,r=()=>(a(),a=ht(l,(t=>s(6,n=t))),l);t.$$.on_destroy.push((()=>a()));let c,{ship:l=ut("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=Zt(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 en extends i{constructor(t){super(),$(this,t,tn,Qs,u,{ship:0})}}function sn(t){let e,s,n=-t[1]+"";return{c(){e=p("excessive mass: "),s=p(n)},l(t){e=g(t,"excessive mass: "),s=g(t,n)},m(t,n){w(t,e,n),w(t,s,n)},p(t,e){2&e&&n!==(n=-t[1]+"")&&L(s,n)},d(t){t&&v(e),t&&v(s)}}}function nn(t){let e,s;return{c(){e=p("mass unused: "),s=p(t[1])},l(n){e=g(n,"mass unused: "),s=g(n,t[1])},m(t,n){w(t,e,n),w(t,s,n)},p(t,e){2&e&&L(s,t[1])},d(t){t&&v(e),t&&v(s)}}}function an(t){let e,s,n,a,r,c,l,o;function i(t,e){return t[3]?nn:sn}let $=i(t),u=$(t);return{c(){e=h("input"),n=f(),a=h("span"),r=f(),c=h("div"),u.c(),this.h()},l(t){e=m(t,"INPUT",{value:!0,type:!0,min:!0,max:!0,class:!0}),n=y(t),a=m(t,"SPAN",{class:!0}),d(a).forEach(v),r=y(t),c=m(t,"DIV",{class:!0});var s=d(c);u.l(s),s.forEach(v),this.h()},h(){e.value=s=t[2].general.mass,b(e,"type","number"),b(e,"min","10"),b(e,"max","300"),b(e,"class","svelte-15yh1sv"),b(a,"class","mass_symbol svelte-15yh1sv"),b(c,"class","note svelte-15yh1sv"),K(c,"warning",!t[3])},m(s,i){w(s,e,i),w(s,n,i),w(s,a,i),w(s,r,i),w(s,c,i),u.m(c,null),l||(o=Q(e,"change",t[4]),l=!0)},p(t,n){4&n&&s!==(s=t[2].general.mass)&&(e.value=s),$===($=i(t))&&u?u.p(t,n):(u.d(1),u=$(t),u&&(u.c(),u.m(c,null))),8&n&&K(c,"warning",!t[3])},d(t){t&&v(e),t&&v(n),t&&v(a),t&&v(r),t&&v(c),u.d(),l=!1,o()}}}function rn(t){let e,s,n=t[2].general.cost+"";return{c(){e=h("span"),s=p(n),this.h()},l(t){e=m(t,"SPAN",{class:!0});var a=d(e);s=g(a,n),a.forEach(v),this.h()},h(){b(e,"class","cost svelte-15yh1sv")},m(t,n){w(t,e,n),x(e,s)},p(t,e){4&e&&n!==(n=t[2].general.cost+"")&&L(s,n)},d(t){t&&v(e)}}}function cn(t){let e,s,n,a,r,c;return s=new Js({props:{label:"ship tonnage",$$slots:{default:[an]},$$scope:{ctx:t}}}),r=new Js({props:{label:"cost",$$slots:{default:[rn]},$$scope:{ctx:t}}}),{c(){e=h("div"),B(s.$$.fragment),n=f(),a=h("div"),B(r.$$.fragment),this.h()},l(t){e=m(t,"DIV",{class:!0});var c=d(e);H(s.$$.fragment,c),c.forEach(v),n=y(t),a=m(t,"DIV",{class:!0});var l=d(a);H(r.$$.fragment,l),l.forEach(v),this.h()},h(){b(e,"class","mass svelte-15yh1sv"),b(a,"class","cost svelte-15yh1sv")},m(t,l){w(t,e,l),G(s,e,null),w(t,n,l),w(t,a,l),G(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||(R(s.$$.fragment,t),R(r.$$.fragment,t),c=!0)},o(t){W(s.$$.fragment,t),W(r.$$.fragment,t),c=!1},d(t){t&&v(e),Y(s),t&&v(n),t&&v(a),Y(r)}}}function ln(t,e,s){let n,a=E,r=()=>(a(),a=ht(c,(t=>s(2,n=t))),c);t.$$.on_destroy.push((()=>a()));let{ship:c=ut("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 on extends i{constructor(t){super(),$(this,t,ln,cn,u,{ship:0})}}function $n(t){let e,s,n,a;return e=new en({}),n=new on({}),{c(){B(e.$$.fragment),s=f(),B(n.$$.fragment)},l(t){H(e.$$.fragment,t),s=y(t),H(n.$$.fragment,t)},m(t,r){G(e,t,r),w(t,s,r),G(n,t,r),a=!0},p:E,i(t){a||(R(e.$$.fragment,t),R(n.$$.fragment,t),a=!0)},o(t){W(e.$$.fragment,t),W(n.$$.fragment,t),a=!1},d(t){Y(e,t),t&&v(s),Y(n,t)}}}class un extends i{constructor(t){super(),$(this,t,null,$n,u,{})}}function hn(t){let e,s,n,a,r,c,l,o,i,$,u,_,I,k,D,P,M,T,N,O,V,A,S,q,C,L,j,z,B,H,G,R,W;return{c(){e=h("aside"),s=h("div"),n=h("input"),a=f(),r=h("h3"),c=p("welcome to the docks"),l=f(),o=h("p"),i=p("This app is a ship builder for the game\n "),$=h("a"),u=p("Full Thrust"),_=p("\n ."),I=f(),k=h("p"),D=p("The app, beside any exception mentioned here, is trying to follow the\n "),P=h("a"),M=p("Cross Dimensions rules"),T=p("\n as closely as possible."),N=f(),O=h("p"),V=p("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=f(),S=h("p"),q=p("Written by\n "),C=h("a"),L=p("Yanick Champoux"),j=p("\n . Code available on\n "),z=h("a"),B=p("Github"),this.h()},l(t){e=m(t,"ASIDE",{class:!0});var h=d(e);s=m(h,"DIV",{class:!0});var p=d(s);n=m(p,"INPUT",{type:!0,class:!0,value:!0}),p.forEach(v),a=y(h),r=m(h,"H3",{class:!0});var f=d(r);c=g(f,"welcome to the docks"),f.forEach(v),l=y(h),o=m(h,"P",{});var b=d(o);i=g(b,"This app is a ship builder for the game\n "),$=m(b,"A",{href:!0});var w=d($);u=g(w,"Full Thrust"),w.forEach(v),_=g(b,"\n ."),b.forEach(v),I=y(h),k=m(h,"P",{});var x=d(k);D=g(x,"The app, beside any exception mentioned here, is trying to follow the\n "),P=m(x,"A",{href:!0});var E=d(P);M=g(E,"Cross Dimensions rules"),E.forEach(v),T=g(x,"\n as closely as possible."),x.forEach(v),N=y(h),O=m(h,"P",{});var F=d(O);V=g(F,"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."),F.forEach(v),A=y(h),S=m(h,"P",{});var U=d(S);q=g(U,"Written by\n "),C=m(U,"A",{href:!0});var H=d(C);L=g(H,"Yanick Champoux"),H.forEach(v),j=g(U,"\n . Code available on\n "),z=m(U,"A",{href:!0});var G=d(z);B=g(G,"Github"),G.forEach(v),U.forEach(v),h.forEach(v),this.h()},h(){b(n,"type","button"),b(n,"class","button small red"),n.value="close",b(s,"class","svelte-16mfw8u"),b(r,"class","svelte-16mfw8u"),b($,"href","https://shop.groundzerogames.co.uk/rules.html"),b(P,"href","http://members.ozemail.com.au/~laranzu/fullthrust/rules/"),b(C,"href","https://twitter.com/yenzie"),b(z,"href","https://github.com/yanick/aotds-shipyard"),b(e,"class","svelte-16mfw8u")},m(h,p){w(h,e,p),x(e,s),x(s,n),x(e,a),x(e,r),x(r,c),x(e,l),x(e,o),x(o,i),x(o,$),x($,u),x(o,_),x(e,I),x(e,k),x(k,D),x(k,P),x(P,M),x(k,T),x(e,N),x(e,O),x(O,V),x(e,A),x(e,S),x(S,q),x(S,C),x(C,L),x(S,j),x(S,z),x(z,B),G=!0,R||(W=Q(n,"click",t[0]),R=!0)},p:E,i(t){G||(F((()=>{H||(H=U(e,ft,{x:-800,opacity:1},!0)),H.run(1)})),G=!0)},o(t){H||(H=U(e,ft,{x:-800,opacity:1},!1)),H.run(0),G=!1},d(t){t&&v(e),t&&H&&H.end(),R=!1,W()}}}function pn(t){const e=z();return[()=>e("close")]}class fn extends i{constructor(t){super(),$(this,t,pn,hn,u,{})}}function mn(t){let e,s,n,a,r,c,l,o;const i=t[5].default,$=st(i,t,t[4],null);return{c(){e=h("div"),$&&$.c(),s=f(),n=h("div"),a=p(t[0]),r=f(),c=h("div"),l=p(t[1]),this.h()},l(o){e=m(o,"DIV",{class:!0});var i=d(e);$&&$.l(i),i.forEach(v),s=y(o),n=m(o,"DIV",{class:!0});var u=d(n);a=g(u,t[0]),u.forEach(v),r=y(o),c=m(o,"DIV",{class:!0});var h=d(c);l=g(h,t[1]),h.forEach(v),this.h()},h(){b(e,"class","svelte-14c1p7f"),b(n,"class","mass svelte-14c1p7f"),b(c,"class","cost svelte-14c1p7f")},m(i,u){w(i,e,u),$&&$.m(e,null),w(i,s,u),w(i,n,u),x(n,a),t[6](n),w(i,r,u),w(i,c,u),x(c,l),t[7](c),o=!0},p(t,[e]){$&&$.p&&(!o||16&e)&&ct($,i,t,t[4],e,null,null),(!o||1&e)&&L(a,t[0]),(!o||2&e)&&L(l,t[1])},i(t){o||(R($,t),o=!0)},o(t){W($,t),o=!1},d(a){a&&v(e),$&&$.d(a),a&&v(s),a&&v(n),t[6](null),a&&v(r),a&&v(c),t[7](null)}}}function dn(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){mt[t?"unshift":"push"]((()=>{n=t,s(2,n)}))},function(t){mt[t?"unshift":"push"]((()=>{a=t,s(3,a)}))}]}class gn extends i{constructor(t){super(),$(this,t,dn,mn,u,{mass:0,cost:1})}}function vn(t){let e,s,n,a,r,c,l;const o=t[2].default,i=st(o,t,t[1],null);return{c(){e=h("div"),s=h("h2"),n=p(t[0]),a=f(),r=h("hr"),c=f(),i&&i.c(),this.h()},l(l){e=m(l,"DIV",{class:!0});var o=d(e);s=m(o,"H2",{});var $=d(s);n=g($,t[0]),$.forEach(v),a=y(o),r=m(o,"HR",{class:!0}),o.forEach(v),c=y(l),i&&i.l(l),this.h()},h(){b(r,"class","svelte-12m93xd"),b(e,"class","svelte-12m93xd")},m(t,o){w(t,e,o),x(e,s),x(s,n),x(e,a),x(e,r),w(t,c,o),i&&i.m(t,o),l=!0},p(t,[e]){(!l||1&e)&&L(n,t[0]),i&&i.p&&(!l||2&e)&&ct(i,o,t,t[1],e,null,null)},i(t){l||(R(i,t),l=!0)},o(t){W(i,t),l=!1},d(t){t&&v(e),t&&v(c),i&&i.d(t)}}}function yn(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 _n extends i{constructor(t){super(),$(this,t,yn,vn,u,{label:0})}}function bn(t){let e,s,n;return{c(){e=h("input"),this.h()},l(t){e=m(t,"INPUT",{type:!0,min:!0,class:!0}),this.h()},h(){b(e,"type","number"),b(e,"min","0"),b(e,"class","svelte-11x6jvv")},m(a,r){w(a,e,r),gt(e,t[0]),s||(n=Q(e,"input",t[4]),s=!0)},p(t,s){1&s&&dt(e.value)!==t[0]&&gt(e,t[0])},d(t){t&&v(e),s=!1,n()}}}function wn(t){let e,s,n;return{c(){e=h("input"),this.h()},l(t){e=m(t,"INPUT",{type:!0,min:!0,class:!0}),this.h()},h(){b(e,"type","number"),b(e,"min","0"),b(e,"class","svelte-11x6jvv")},m(a,r){w(a,e,r),gt(e,t[1]),s||(n=Q(e,"input",t[5]),s=!0)},p(t,s){2&s&&dt(e.value)!==t[1]&&gt(e,t[1])},d(t){t&&v(e),s=!1,n()}}}function xn(t){let e,s,n,a,r;return s=new Js({props:{label:"screens",$$slots:{default:[bn]},$$scope:{ctx:t}}}),a=new Js({props:{label:"advanced screens",$$slots:{default:[wn]},$$scope:{ctx:t}}}),{c(){e=h("div"),B(s.$$.fragment),n=f(),B(a.$$.fragment),this.h()},l(t){e=m(t,"DIV",{class:!0});var r=d(e);H(s.$$.fragment,r),n=y(r),H(a.$$.fragment,r),r.forEach(v),this.h()},h(){b(e,"class","svelte-11x6jvv")},m(t,c){w(t,e,c),G(s,e,null),x(e,n),G(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||(R(s.$$.fragment,t),R(a.$$.fragment,t),r=!0)},o(t){W(s.$$.fragment,t),W(a.$$.fragment,t),r=!1},d(t){t&&v(e),Y(s),Y(a)}}}function En(t){let e,s;return e=new gn({props:{cost:t[2],mass:t[3],$$slots:{default:[xn]},$$scope:{ctx:t}}}),{c(){B(e.$$.fragment)},l(t){H(e.$$.fragment,t)},m(t,n){G(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||(R(e.$$.fragment,t),s=!0)},o(t){W(e.$$.fragment,t),s=!1},d(t){Y(e,t)}}}function In(t,e,s){let{cost:n=0}=e,{mass:a=0}=e,{standard:r=0}=e,{advanced:c=0}=e;const l=z();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=dt(this.value),s(0,r)},function(){c=dt(this.value),s(1,c)}]}class kn extends i{constructor(t){super(),$(this,t,In,En,u,{cost:2,mass:3,standard:0,advanced:1})}}function Dn(t){let e,s,n;return{c(){e=h("input"),this.h()},l(t){e=m(t,"INPUT",{type:!0,min:!0,class:!0}),this.h()},h(){b(e,"type","number"),b(e,"min","0"),b(e,"class","svelte-qworsx")},m(a,r){w(a,e,r),gt(e,t[0]),s||(n=Q(e,"input",t[2]),s=!0)},p(t,s){1&s&&dt(e.value)!==t[0]&&gt(e,t[0])},d(t){t&&v(e),s=!1,n()}}}function Pn(t){let e,s;return e=new Js({props:{label:`layer ${t[1]}`,$$slots:{default:[Dn]},$$scope:{ctx:t}}}),{c(){B(e.$$.fragment)},l(t){H(e.$$.fragment,t)},m(t,n){G(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||(R(e.$$.fragment,t),s=!0)},o(t){W(e.$$.fragment,t),s=!1},d(t){Y(e,t)}}}function Mn(t,e,s){let{layer:n=1}=e,{rating:a=0}=e;const r=z();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",ae.actions.set_armour_layer({layer:n,rating:a}))},[a,n,function(){a=dt(this.value),s(0,a)}]}class Tn extends i{constructor(t){super(),$(this,t,Mn,Pn,u,{layer:1,rating:0})}}function Nn(t,e,s){const n=t.slice();return n[7]=e[s],n}function On(t){let e,s,n;return{c(){e=h("input"),this.h()},l(t){e=m(t,"INPUT",{type:!0,min:!0,class:!0}),this.h()},h(){b(e,"type","number"),b(e,"min","0"),b(e,"class","svelte-1bx91qz")},m(a,r){w(a,e,r),gt(e,t[3]),s||(n=Q(e,"input",t[4]),s=!0)},p(t,s){8&s&&dt(e.value)!==t[3]&&gt(e,t[3])},d(t){t&&v(e),s=!1,n()}}}function Vn(t,e){let s,n,a;const r=[e[7]];let c={};for(let l=0;l<r.length;l+=1)c=$t(c,r[l]);return n=new Tn({props:c}),n.$on("ship_change",e[5]),{key:t,first:null,c(){s=et(),B(n.$$.fragment),this.h()},l(t){s=et(),H(n.$$.fragment,t),this.h()},h(){this.first=s},m(t,e){w(t,s,e),G(n,t,e),a=!0},p(t,s){e=t;const a=4&s?lt(r,[ot(e[7])]):{};n.$set(a)},i(t){a||(R(n.$$.fragment,t),a=!0)},o(t){W(n.$$.fragment,t),a=!1},d(t){t&&v(s),Y(n,t)}}}function An(t){let e,s,n,a,r,c,l=[],o=new Map;n=new Js({props:{label:"armour layers",$$slots:{default:[On]},$$scope:{ctx:t}}});let i=t[2];const $=t=>t[7].layer;for(let u=0;u<i.length;u+=1){let e=Nn(t,i,u),s=$(e);o.set(s,l[u]=Vn(s,e))}return{c(){e=h("div"),s=h("div"),B(n.$$.fragment),a=f(),r=h("div");for(let t=0;t<l.length;t+=1)l[t].c();this.h()},l(t){e=m(t,"DIV",{});var c=d(e);s=m(c,"DIV",{class:!0});var o=d(s);H(n.$$.fragment,o),o.forEach(v),a=y(c),r=m(c,"DIV",{class:!0});var i=d(r);for(let e=0;e<l.length;e+=1)l[e].l(i);i.forEach(v),c.forEach(v),this.h()},h(){b(s,"class","nbr_layers"),b(r,"class","layers svelte-1bx91qz")},m(t,o){w(t,e,o),x(e,s),G(n,s,null),x(e,a),x(e,r);for(let e=0;e<l.length;e+=1)l[e].m(r,null);c=!0},p(t,e){const s={};1032&e&&(s.$$scope={dirty:e,ctx:t}),n.$set(s),4&e&&(i=t[2],nt(),l=J(l,e,$,1,t,i,o,r,at,Vn,null,Nn),rt())},i(t){if(!c){R(n.$$.fragment,t);for(let t=0;t<i.length;t+=1)R(l[t]);c=!0}},o(t){W(n.$$.fragment,t);for(let e=0;e<l.length;e+=1)W(l[e]);c=!1},d(t){t&&v(e),Y(n);for(let e=0;e<l.length;e+=1)l[e].d()}}}function Sn(t){let e,s;return e=new gn({props:{cost:t[0],mass:t[1],$$slots:{default:[An]},$$scope:{ctx:t}}}),{c(){B(e.$$.fragment)},l(t){H(e.$$.fragment,t)},m(t,n){G(e,t,n),s=!0},p(t,[s]){const n={};1&s&&(n.cost=t[0]),2&s&&(n.mass=t[1]),1036&s&&(n.$$scope={dirty:s,ctx:t}),e.$set(n)},i(t){s||(R(e.$$.fragment,t),s=!0)},o(t){W(e.$$.fragment,t),s=!1},d(t){Y(e,t)}}}function qn(t,e,s){let{armour:n=[]}=e,{cost:a=0}=e,{mass:r=0}=e,c=n.length;const l=z();return t.$$set=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=V.sum(V.map(n,"cost"))),4&t.$$.dirty&&s(1,r=V.sum(V.map(n,"mass"))),8&t.$$.dirty&&l("ship_change",ae.actions.set_armour_nbr_layers(c))},[a,r,n,c,function(){c=dt(this.value),s(3,c)},function(e){tt(t,e)}]}class Cn extends i{constructor(t){super(),$(this,t,qn,Sn,u,{armour:2,cost:0,mass:1})}}function Ln(t){let e,s,n;return{c(){e=h("input"),this.h()},l(t){e=m(t,"INPUT",{type:!0,min:!0,class:!0}),this.h()},h(){b(e,"type","number"),b(e,"min","0"),b(e,"class","svelte-qworsx")},m(a,r){w(a,e,r),gt(e,t[0]),s||(n=Q(e,"input",t[3]),s=!0)},p(t,s){1&s&&dt(e.value)!==t[0]&&gt(e,t[0])},d(t){t&&v(e),s=!1,n()}}}function Fn(t){let e,s;return e=new Js({props:{label:"cargo",$$slots:{default:[Ln]},$$scope:{ctx:t}}}),{c(){B(e.$$.fragment)},l(t){H(e.$$.fragment,t)},m(t,n){G(e,t,n),s=!0},p(t,s){const n={};65&s&&(n.$$scope={dirty:s,ctx:t}),e.$set(n)},i(t){s||(R(e.$$.fragment,t),s=!0)},o(t){W(e.$$.fragment,t),s=!1},d(t){Y(e,t)}}}function Un(t){let e,s;return e=new gn({props:{cost:t[1],mass:t[2],$$slots:{default:[Fn]},$$scope:{ctx:t}}}),{c(){B(e.$$.fragment)},l(t){H(e.$$.fragment,t)},m(t,n){G(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||(R(e.$$.fragment,t),s=!0)},o(t){W(e.$$.fragment,t),s=!1},d(t){Y(e,t)}}}function jn(t,e,s){ut("ship");let{space:n=0}=e,{cost:a=0}=e,{mass:r=0}=e;const c=z();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",oe.actions.set_cargo(n))},[n,a,r,function(){n=dt(this.value),s(0,n)}]}class zn extends i{constructor(t){super(),$(this,t,jn,Un,u,{space:0,cost:1,mass:2})}}function Bn(t){let e,s,n,a,r,c,l,o,i,$,u,_,E,I;return{c(){e=h("div"),s=h("label"),n=h("input"),a=p("\n none"),r=f(),c=h("label"),l=h("input"),o=p("\n partial"),i=f(),$=h("label"),u=h("input"),_=p("\n full"),this.h()},l(t){e=m(t,"DIV",{class:!0});var h=d(e);s=m(h,"LABEL",{class:!0});var p=d(s);n=m(p,"INPUT",{type:!0,value:!0}),a=g(p,"\n none"),p.forEach(v),r=y(h),c=m(h,"LABEL",{class:!0});var f=d(c);l=m(f,"INPUT",{type:!0,value:!0}),o=g(f,"\n partial"),f.forEach(v),i=y(h),$=m(h,"LABEL",{class:!0});var b=d($);u=m(b,"INPUT",{type:!0,value:!0}),_=g(b,"\n full"),b.forEach(v),h.forEach(v),this.h()},h(){b(n,"type","radio"),n.__value="none",n.value=n.__value,t[5][0].push(n),b(s,"class","svelte-6w28yb"),b(l,"type","radio"),l.__value="partial",l.value=l.__value,t[5][0].push(l),b(c,"class","svelte-6w28yb"),b(u,"type","radio"),u.__value="full",u.value=u.__value,t[5][0].push(u),b($,"class","svelte-6w28yb"),b(e,"class","svelte-6w28yb")},m(h,p){w(h,e,p),x(e,s),x(s,n),n.checked=n.__value===t[0],x(s,a),x(e,r),x(e,c),x(c,l),l.checked=l.__value===t[0],x(c,o),x(e,i),x(e,$),x($,u),u.checked=u.__value===t[0],x($,_),E||(I=[Q(n,"change",t[4]),Q(l,"change",t[6]),Q(u,"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&&(u.checked=u.__value===t[0])},d(s){s&&v(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(u),1),E=!1,vt(I)}}}function Hn(t){let e,s;return e=new Js({props:{label:"streamlining",$$slots:{default:[Bn]},$$scope:{ctx:t}}}),{c(){B(e.$$.fragment)},l(t){H(e.$$.fragment,t)},m(t,n){G(e,t,n),s=!0},p(t,s){const n={};257&s&&(n.$$scope={dirty:s,ctx:t}),e.$set(n)},i(t){s||(R(e.$$.fragment,t),s=!0)},o(t){W(e.$$.fragment,t),s=!1},d(t){Y(e,t)}}}function Gn(t){let e,s;return e=new gn({props:{cost:t[1],mass:t[2],$$slots:{default:[Hn]},$$scope:{ctx:t}}}),{c(){B(e.$$.fragment)},l(t){H(e.$$.fragment,t)},m(t,n){G(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||(R(e.$$.fragment,t),s=!0)},o(t){W(e.$$.fragment,t),s=!1},d(t){Y(e,t)}}}function Rn(t,e,s){let{type:n="none"}=e,{cost:a=0}=e,{mass:r=0}=e,{ship_change:c=ut("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(he.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 Wn extends i{constructor(t){super(),$(this,t,Rn,Gn,u,{type:0,cost:1,mass:2,ship_change:3})}}function Yn(t){let e,s,n;return{c(){e=h("input"),this.h()},l(t){e=m(t,"INPUT",{type:!0,min:!0,max:!0,class:!0}),this.h()},h(){b(e,"type","number"),b(e,"min",t[7]),b(e,"max",t[8]),b(e,"class","svelte-x10nn1")},m(a,r){w(a,e,r),gt(e,t[0]),s||(n=Q(e,"input",t[10]),s=!0)},p(t,s){128&s&&b(e,"min",t[7]),256&s&&b(e,"max",t[8]),1&s&&dt(e.value)!==t[0]&&gt(e,t[0])},d(t){t&&v(e),s=!1,n()}}}function Jn(t){let e,s;return e=new Js({props:{label:"integrity",$$slots:{default:[Yn]},$$scope:{ctx:t}}}),{c(){B(e.$$.fragment)},l(t){H(e.$$.fragment,t)},m(t,n){G(e,t,n),s=!0},p(t,s){const n={};33153&s&&(n.$$scope={dirty:s,ctx:t}),e.$set(n)},i(t){s||(R(e.$$.fragment,t),s=!0)},o(t){W(e.$$.fragment,t),s=!1},d(t){Y(e,t)}}}function Xn(t){let e,s,n,a,r,c,l,o,i,$;e=new gn({props:{cost:t[1],mass:t[2],$$slots:{default:[Jn]},$$scope:{ctx:t}}});const u=[t[3]];let h={};for(let f=0;f<u.length;f+=1)h=$t(h,u[f]);n=new kn({props:h}),n.$on("set_screens",t[11]),r=new Cn({props:{armour:t[4]}}),r.$on("ship_change",t[12]);const p=[t[5]];let m={};for(let f=0;f<p.length;f+=1)m=$t(m,p[f]);l=new zn({props:m}),l.$on("set_cargo",t[13]);const d=[t[6]];let g={};for(let f=0;f<d.length;f+=1)g=$t(g,d[f]);return i=new Wn({props:g}),{c(){B(e.$$.fragment),s=f(),B(n.$$.fragment),a=f(),B(r.$$.fragment),c=f(),B(l.$$.fragment),o=f(),B(i.$$.fragment)},l(t){H(e.$$.fragment,t),s=y(t),H(n.$$.fragment,t),a=y(t),H(r.$$.fragment,t),c=y(t),H(l.$$.fragment,t),o=y(t),H(i.$$.fragment,t)},m(t,u){G(e,t,u),w(t,s,u),G(n,t,u),w(t,a,u),G(r,t,u),w(t,c,u),G(l,t,u),w(t,o,u),G(i,t,u),$=!0},p(t,s){const a={};2&s&&(a.cost=t[1]),4&s&&(a.mass=t[2]),33153&s&&(a.$$scope={dirty:s,ctx:t}),e.$set(a);const c=8&s?lt(u,[ot(t[3])]):{};n.$set(c);const o={};16&s&&(o.armour=t[4]),r.$set(o);const $=32&s?lt(p,[ot(t[5])]):{};l.$set($);const h=64&s?lt(d,[ot(t[6])]):{};i.$set(h)},i(t){$||(R(e.$$.fragment,t),R(n.$$.fragment,t),R(r.$$.fragment,t),R(l.$$.fragment,t),R(i.$$.fragment,t),$=!0)},o(t){W(e.$$.fragment,t),W(n.$$.fragment,t),W(r.$$.fragment,t),W(l.$$.fragment,t),W(i.$$.fragment,t),$=!1},d(t){Y(e,t),t&&v(s),Y(n,t),t&&v(a),Y(r,t),t&&v(c),Y(l,t),t&&v(o),Y(i,t)}}}function Zn(t){let e,s;return e=new _n({props:{label:"hull",$$slots:{default:[Xn]},$$scope:{ctx:t}}}),{c(){B(e.$$.fragment)},l(t){H(e.$$.fragment,t)},m(t,n){G(e,t,n),s=!0},p(t,[s]){const n={};33279&s&&(n.$$scope={dirty:s,ctx:t}),e.$set(n)},i(t){s||(R(e.$$.fragment,t),s=!0)},o(t){W(e.$$.fragment,t),s=!1},d(t){Y(e,t)}}}function Kn(t,e,s){let n,a,{cost:r}=e,{mass:c}=e,{ship_mass:l}=e,{rating:o}=e,{screens:i}=e,{armour:$=[]}=e,{cargo:u={}}=e,{streamlining:h={}}=e;const p=z();return t.$$set=t=>{"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=dt(this.value),s(0,o)},function(e){tt(t,e)},function(e){tt(t,e)},function(e){tt(t,e)}]}class Qn extends i{constructor(t){super(),$(this,t,Kn,Zn,u,{cost:1,mass:2,ship_mass:9,rating:0,screens:3,armour:4,cargo:5,streamlining:6})}}function ta(t){let e,s,n;return{c(){e=h("input"),this.h()},l(t){e=m(t,"INPUT",{type:!0,class:!0}),this.h()},h(){b(e,"type","number"),b(e,"class","short")},m(a,r){w(a,e,r),gt(e,t[0]),s||(n=Q(e,"input",t[3]),s=!0)},p(t,s){1&s&&dt(e.value)!==t[0]&&gt(e,t[0])},d(t){t&&v(e),s=!1,n()}}}function ea(t){let e,s;return e=new Js({props:{label:"firecons",$$slots:{default:[ta]},$$scope:{ctx:t}}}),{c(){B(e.$$.fragment)},l(t){H(e.$$.fragment,t)},m(t,n){G(e,t,n),s=!0},p(t,s){const n={};33&s&&(n.$$scope={dirty:s,ctx:t}),e.$set(n)},i(t){s||(R(e.$$.fragment,t),s=!0)},o(t){W(e.$$.fragment,t),s=!1},d(t){Y(e,t)}}}function sa(t){let e,s;return e=new gn({props:{cost:t[1],mass:t[2],$$slots:{default:[ea]},$$scope:{ctx:t}}}),{c(){B(e.$$.fragment)},l(t){H(e.$$.fragment,t)},m(t,n){G(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||(R(e.$$.fragment,t),s=!0)},o(t){W(e.$$.fragment,t),s=!1},d(t){Y(e,t)}}}function na(t,e,s){let{nbr:n}=e,{cost:a}=e,{mass:r=0}=e;const c=z();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=dt(this.value),s(0,n)}]}class aa extends i{constructor(t){super(),$(this,t,na,sa,u,{nbr:0,cost:1,mass:2})}}function ra(t,e,s){const n=t.slice();return n[8]=e[s],n}function ca(t,e){let s,n,a,r,c,l,o,i=e[8]+"";return{key:t,first:null,c(){s=h("label"),n=h("input"),a=f(),r=p(i),c=f(),this.h()},l(t){s=m(t,"LABEL",{class:!0});var e=d(s);n=m(e,"INPUT",{type:!0,value:!0}),a=y(e),r=g(e,i),c=y(e),e.forEach(v),this.h()},h(){b(n,"type","radio"),n.__value=e[8],n.value=n.__value,e[6][0].push(n),b(s,"class","svelte-1ozsoxu"),this.first=s},m(t,i){w(t,s,i),x(s,n),n.checked=n.__value===e[0],x(s,a),x(s,r),x(s,c),l||(o=[Q(n,"change",e[5]),Q(n,"change",e[3])],l=!0)},p(t,s){e=t,1&s&&(n.checked=n.__value===e[0])},d(t){t&&v(s),e[6][0].splice(e[6][0].indexOf(n),1),l=!1,vt(o)}}}function la(t){let e,s=[],n=new Map,a=t[4];const r=t=>t[8];for(let c=0;c<a.length;c+=1){let e=ra(t,a,c),l=r(e);n.set(l,s[c]=ca(l,e))}return{c(){for(let t=0;t<s.length;t+=1)s[t].c();e=et()},l(t){for(let e=0;e<s.length;e+=1)s[e].l(t);e=et()},m(t,n){for(let e=0;e<s.length;e+=1)s[e].m(t,n);w(t,e,n)},p(t,c){25&c&&(a=t[4],s=J(s,c,r,1,t,a,n,e.parentNode,X,ca,e,ra))},d(t){for(let e=0;e<s.length;e+=1)s[e].d(t);t&&v(e)}}}function oa(t){let e,s;return e=new Js({props:{label:"FTL drive",$$slots:{default:[la]},$$scope:{ctx:t}}}),{c(){B(e.$$.fragment)},l(t){H(e.$$.fragment,t)},m(t,n){G(e,t,n),s=!0},p(t,s){const n={};2049&s&&(n.$$scope={dirty:s,ctx:t}),e.$set(n)},i(t){s||(R(e.$$.fragment,t),s=!0)},o(t){W(e.$$.fragment,t),s=!1},d(t){Y(e,t)}}}function ia(t){let e,s;return e=new gn({props:{mass:t[2],cost:t[1],$$slots:{default:[oa]},$$scope:{ctx:t}}}),{c(){B(e.$$.fragment)},l(t){H(e.$$.fragment,t)},m(t,n){G(e,t,n),s=!0},p(t,[s]){const n={};4&s&&(n.mass=t[2]),2&s&&(n.cost=t[1]),2049&s&&(n.$$scope={dirty:s,ctx:t}),e.$set(n)},i(t){s||(R(e.$$.fragment,t),s=!0)},o(t){W(e.$$.fragment,t),s=!1},d(t){Y(e,t)}}}function $a(t,e,s){let{type:n="none"}=e,{cost:a=0}=e,{mass:r=0}=e;const c=z();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)},[n,a,r,()=>c("change_ftl",n),["none","standard","advanced"],function(){n=this.__value,s(0,n)},[[]]]}class ua extends i{constructor(t){super(),$(this,t,$a,ia,u,{type:0,cost:1,mass:2})}}function ha(t){let e,s,n;return{c(){e=h("input"),this.h()},l(t){e=m(t,"INPUT",{type:!0,min:!0,max:!0,step:!0,class:!0}),this.h()},h(){b(e,"type","number"),b(e,"min","0"),b(e,"max","20"),b(e,"step","1"),b(e,"class","svelte-3grq2v")},m(a,r){w(a,e,r),gt(e,t[1]),s||(n=Q(e,"input",t[4]),s=!0)},p(t,s){2&s&&dt(e.value)!==t[1]&&gt(e,t[1])},d(t){t&&v(e),s=!1,n()}}}function pa(t){let e,s,n,a,r,c,l,o,i;return s=new Js({props:{label:"thrust rating",$$slots:{default:[ha]},$$scope:{ctx:t}}}),{c(){e=h("div"),B(s.$$.fragment),n=f(),a=h("label"),r=h("input"),c=p(" advanced"),this.h()},l(t){e=m(t,"DIV",{class:!0});var l=d(e);H(s.$$.fragment,l),n=y(l),a=m(l,"LABEL",{class:!0});var o=d(a);r=m(o,"INPUT",{type:!0}),c=g(o," advanced"),o.forEach(v),l.forEach(v),this.h()},h(){b(r,"type","checkbox"),b(a,"class","svelte-3grq2v"),b(e,"class","svelte-3grq2v")},m($,u){w($,e,u),G(s,e,null),x(e,n),x(e,a),x(a,r),r.checked=t[0],x(a,c),l=!0,o||(i=Q(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||(R(s.$$.fragment,t),l=!0)},o(t){W(s.$$.fragment,t),l=!1},d(t){t&&v(e),Y(s),o=!1,i()}}}function fa(t){let e,s;return e=new gn({props:{cost:t[2],mass:t[3],$$slots:{default:[pa]},$$scope:{ctx:t}}}),{c(){B(e.$$.fragment)},l(t){H(e.$$.fragment,t)},m(t,n){G(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||(R(e.$$.fragment,t),s=!0)},o(t){W(e.$$.fragment,t),s=!1},d(t){Y(e,t)}}}function ma(t,e,s){let{cost:n}=e,{mass:a}=e,{advanced:r=!1}=e,{rating:c=0}=e;const l=z();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=dt(this.value),s(1,c)},function(){r=this.checked,s(0,r)}]}class da extends i{constructor(t){super(),$(this,t,ma,fa,u,{cost:2,mass:3,advanced:0,rating:1})}}function ga(t){let e,s,n,a;const r=[t[1]];let c={};for(let i=0;i<r.length;i+=1)c=$t(c,r[i]);e=new da({props:c}),e.$on("change_engine",t[2]);const l=[t[0]];let o={};for(let i=0;i<l.length;i+=1)o=$t(o,l[i]);return n=new ua({props:o}),n.$on("change_ftl",t[3]),{c(){B(e.$$.fragment),s=f(),B(n.$$.fragment)},l(t){H(e.$$.fragment,t),s=y(t),H(n.$$.fragment,t)},m(t,r){G(e,t,r),w(t,s,r),G(n,t,r),a=!0},p(t,s){const a=2&s?lt(r,[ot(t[1])]):{};e.$set(a);const c=1&s?lt(l,[ot(t[0])]):{};n.$set(c)},i(t){a||(R(e.$$.fragment,t),R(n.$$.fragment,t),a=!0)},o(t){W(e.$$.fragment,t),W(n.$$.fragment,t),a=!1},d(t){Y(e,t),t&&v(s),Y(n,t)}}}function va(t){let e,s;return e=new _n({props:{label:"propulsion",$$slots:{default:[ga]},$$scope:{ctx:t}}}),{c(){B(e.$$.fragment)},l(t){H(e.$$.fragment,t)},m(t,n){G(e,t,n),s=!0},p(t,[s]){const n={};19&s&&(n.$$scope={dirty:s,ctx:t}),e.$set(n)},i(t){s||(R(e.$$.fragment,t),s=!0)},o(t){W(e.$$.fragment,t),s=!1},d(t){Y(e,t)}}}function ya(t,e,s){let{ftl:n={}}=e,{engine:a={}}=e;return t.$$set=t=>{"ftl"in t&&s(0,n=t.ftl),"engine"in t&&s(1,a=t.engine)},[n,a,function(e){tt(t,e)},function(e){tt(t,e)}]}class _a extends i{constructor(t){super(),$(this,t,ya,va,u,{ftl:0,engine:1})}}function ba(t,e,s){const n=t.slice();return n[2]=e[s],n}function wa(t){let e,s,n,a,r,c,l,o,i,$,u;return{c(){e=h("select"),s=h("option"),n=p("1"),a=h("option"),r=p("2"),c=h("option"),l=p("3"),o=h("option"),i=p("4"),this.h()},l(t){e=m(t,"SELECT",{});var $=d(e);s=m($,"OPTION",{value:!0});var u=d(s);n=g(u,"1"),u.forEach(v),a=m($,"OPTION",{value:!0});var h=d(a);r=g(h,"2"),h.forEach(v),c=m($,"OPTION",{value:!0});var p=d(c);l=g(p,"3"),p.forEach(v),o=m($,"OPTION",{value:!0});var f=d(o);i=g(f,"4"),f.forEach(v),$.forEach(v),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]&&F((()=>t[10].call(e)))},m(h,p){w(h,e,p),x(e,s),x(s,n),x(e,a),x(a,r),x(e,c),x(c,l),x(e,o),x(o,i),pt(e,t[0]),$||(u=Q(e,"change",t[10]),$=!0)},p(t,s){1&s&&pt(e,t[0])},d(t){t&&v(e),$=!1,u()}}}function xa(t,e){let s,n,a,r=e[2]+"";return{key:t,first:null,c(){s=h("option"),n=p(r),this.h()},l(t){s=m(t,"OPTION",{value:!0});var e=d(s);n=g(e,r),e.forEach(v),this.h()},h(){s.__value=a=e[2],s.value=s.__value,this.first=s},m(t,e){w(t,s,e),x(s,n)},p(t,c){e=t,1&c&&r!==(r=e[2]+"")&&L(n,r),1&c&&a!==(a=e[2])&&(s.__value=a,s.value=s.__value)},d(t){t&&v(s)}}}function Ea(t){let e,s,n,a=[],r=new Map,c=t[3][t[0]]||[];const l=t=>t[2];for(let o=0;o<c.length;o+=1){let e=ba(t,c,o),s=l(e);r.set(s,a[o]=xa(s,e))}return{c(){e=h("select");for(let t=0;t<a.length;t+=1)a[t].c();this.h()},l(t){e=m(t,"SELECT",{});var s=d(e);for(let e=0;e<a.length;e+=1)a[e].l(s);s.forEach(v),this.h()},h(){void 0===t[2]&&F((()=>t[11].call(e)))},m(r,c){w(r,e,c);for(let t=0;t<a.length;t+=1)a[t].m(e,null);pt(e,t[2]),s||(n=Q(e,"change",t[11]),s=!0)},p(t,s){9&s&&(c=t[3][t[0]]||[],a=J(a,s,l,1,t,c,r,e,X,xa,null,ba)),13&s&&pt(e,t[2])},d(t){t&&v(e);for(let e=0;e<a.length;e+=1)a[e].d();s=!1,n()}}}function Ia(t){let e,s,n,a,r,c,l,o,i;return a=new Js({props:{label:"beam class",$$slots:{default:[wa]},$$scope:{ctx:t}}}),c=new Js({props:{label:"arcs",$$slots:{default:[Ea]},$$scope:{ctx:t}}}),o=new vs({props:{selected:t[1]}}),o.$on("click_arc",t[12]),{c(){e=h("label"),s=p("beam"),n=f(),B(a.$$.fragment),r=f(),B(c.$$.fragment),l=f(),B(o.$$.fragment)},l(t){e=m(t,"LABEL",{});var i=d(e);s=g(i,"beam"),i.forEach(v),n=y(t),H(a.$$.fragment,t),r=y(t),H(c.$$.fragment,t),l=y(t),H(o.$$.fragment,t)},m(t,$){w(t,e,$),x(e,s),w(t,n,$),G(a,t,$),w(t,r,$),G(c,t,$),w(t,l,$),G(o,t,$),i=!0},p(t,[e]){const s={};131073&e&&(s.$$scope={dirty:e,ctx:t}),a.$set(s);const n={};131077&e&&(n.$$scope={dirty:e,ctx:t}),c.$set(n);const r={};2&e&&(r.selected=t[1]),o.$set(r)},i(t){i||(R(a.$$.fragment,t),R(c.$$.fragment,t),R(o.$$.fragment,t),i=!0)},o(t){W(a.$$.fragment,t),W(c.$$.fragment,t),W(o.$$.fragment,t),i=!1},d(t){t&&v(e),t&&v(n),Y(a,t),t&&v(r),Y(c,t),t&&v(l),Y(o,t)}}}function ka(t,e,s){const n=["FS","F","FP","AP","A","AS"];let{weapon_type:a}=e,{id:r}=e,{weapon_class:c=1}=e,{arcs:l=["F"]}=e,{ship_change:o=ut("ship_change")||(()=>{})}=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=[];V.range($).forEach((t=>{a.push(n[e]),e=(e+1)%n.length})),s(1,l=a)};let h=1,p="";const f=z();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=[];V.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=yt(this),s(0,c)},function(){$=yt(this),s(2,$),s(3,i),s(0,c),s(3,i),s(0,c)},({detail:t})=>u(t)]}class Da extends i{constructor(t){super(),$(this,t,ka,Ia,u,{weapon_type:5,id:6,weapon_class:0,arcs:1,ship_change:7})}}function Pa(t){let e,s,n,a,r;return a=new vs({props:{selected:t[0]}}),a.$on("click_arc",t[4]),{c(){e=h("label"),s=p("submunition pack"),n=f(),B(a.$$.fragment)},l(t){e=m(t,"LABEL",{});var r=d(e);s=g(r,"submunition pack"),r.forEach(v),n=y(t),H(a.$$.fragment,t)},m(t,c){w(t,e,c),x(e,s),w(t,n,c),G(a,t,c),r=!0},p(t,[e]){const s={};1&e&&(s.selected=t[0]),a.$set(s)},i(t){r||(R(a.$$.fragment,t),r=!0)},o(t){W(a.$$.fragment,t),r=!1},d(t){t&&v(e),t&&v(n),Y(a,t)}}}function Ma(t,e,s){let{arcs:n=["F"]}=e,{ship_change:a=ut("ship_change")||(()=>{})}=e;const r=t=>{n[0]!==t&&s(0,n=[t])},c=z();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 Ta extends i{constructor(t){super(),$(this,t,Ma,Pa,u,{arcs:0,ship_change:2})}}function Na(t){let e,s;return{c(){e=h("label"),s=p("point defence system")},l(t){e=m(t,"LABEL",{});var n=d(e);s=g(n,"point defence system"),n.forEach(v)},m(t,n){w(t,e,n),x(e,s)},p:E,i:E,o:E,d(t){t&&v(e)}}}class Oa extends i{constructor(t){super(),$(this,t,null,Na,u,{})}}function Va(t){let e,s;return{c(){e=h("label"),s=p("scattergun")},l(t){e=m(t,"LABEL",{});var n=d(e);s=g(n,"scattergun"),n.forEach(v)},m(t,n){w(t,e,n),x(e,s)},p:E,i:E,o:E,d(t){t&&v(e)}}}class Aa extends i{constructor(t){super(),$(this,t,null,Va,u,{})}}function Sa(t){let e,s,n,a,r;return a=new vs({props:{selected:t[0]}}),a.$on("click_arc",t[4]),{c(){e=h("label"),s=p("needle weapon"),n=f(),B(a.$$.fragment)},l(t){e=m(t,"LABEL",{});var r=d(e);s=g(r,"needle weapon"),r.forEach(v),n=y(t),H(a.$$.fragment,t)},m(t,c){w(t,e,c),x(e,s),w(t,n,c),G(a,t,c),r=!0},p(t,[e]){const s={};1&e&&(s.selected=t[0]),a.$set(s)},i(t){r||(R(a.$$.fragment,t),r=!0)},o(t){W(a.$$.fragment,t),r=!1},d(t){t&&v(e),t&&v(n),Y(a,t)}}}function qa(t,e,s){let{arcs:n=["F"]}=e,{ship_change:a=ut("ship_change")||(()=>{})}=e;const r=t=>{n[0]!==t&&s(0,n=[t])},c=z();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 Ca extends i{constructor(t){super(),$(this,t,qa,Sa,u,{arcs:0,ship_change:2})}}function La(t){let e,s,n,a,r,c,l;const o=[t[0]];var i=t[3][t[4]];function $(t){let e={};for(let s=0;s<o.length;s+=1)e=$t(e,o[s]);return{props:e}}return i&&(a=new i($()),a.$on("change",t[6])),{c(){e=h("div"),s=h("input"),n=f(),a&&B(a.$$.fragment),this.h()},l(t){e=m(t,"DIV",{class:!0});var r=d(e);s=m(r,"INPUT",{type:!0,class:!0,value:!0}),n=y(r),a&&H(a.$$.fragment,r),r.forEach(v),this.h()},h(){b(s,"type","button"),b(s,"class","button small red remove"),s.value="remove",b(e,"class","weapon_row svelte-1vypk50")},m(o,i){w(o,e,i),x(e,s),x(e,n),a&&G(a,e,null),r=!0,c||(l=Q(s,"click",t[5]),c=!0)},p(t,s){const n=1&s?lt(o,[ot(t[0])]):{};if(i!==(i=t[3][t[4]])){if(a){nt();const t=a;W(t.$$.fragment,1,0,(()=>{Y(t,1)})),rt()}i?(a=new i($()),a.$on("change",t[6]),B(a.$$.fragment),R(a.$$.fragment,1),G(a,e,null)):a=null}else i&&a.$set(n)},i(t){r||(a&&R(a.$$.fragment,t),r=!0)},o(t){a&&W(a.$$.fragment,t),r=!1},d(t){t&&v(e),a&&Y(a),c=!1,l()}}}function Fa(t){let e,s;return e=new gn({props:{cost:t[1],mass:t[2],$$slots:{default:[La]},$$scope:{ctx:t}}}),{c(){B(e.$$.fragment)},l(t){H(e.$$.fragment,t)},m(t,n){G(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||(R(e.$$.fragment,t),s=!0)},o(t){W(e.$$.fragment,t),s=!1},d(t){Y(e,t)}}}function Ua(t,e,s){const n={beam:Da,submunition:Ta,pds:Oa,scattergun:Aa,needle:Ca};let{weapon:a={}}=e,{id:r}=e,{cost:c}=e,{mass:o}=e,{ship_change:i=ut("ship_change")||(()=>{})}=e,$=a.weapon_type;return t.$$set=t=>{"weapon"in t&&s(0,a=t.weapon),"id"in t&&s(7,r=t.id),"cost"in t&&s(1,c=t.cost),"mass"in t&&s(2,o=t.mass),"ship_change"in t&&s(8,i=t.ship_change)},[a,c,o,n,$,()=>i(De.actions.remove_weapon(r)),({detail:t})=>{i(De.actions.set_weapon(l({id:r,weapon_type:$},t)))},r,i]}class ja extends i{constructor(t){super(),$(this,t,Ua,Fa,u,{weapon:0,id:7,cost:1,mass:2,ship_change:8})}}function za(t,e,s){const n=t.slice();return n[0]=e[s],n}function Ba(t,e){let s,n,a=e[0]+"";return{key:t,first:null,c(){s=h("option"),n=p(a),this.h()},l(t){s=m(t,"OPTION",{value:!0});var e=d(s);n=g(e,a),e.forEach(v),this.h()},h(){s.__value=e[0],s.value=s.__value,this.first=s},m(t,e){w(t,s,e),x(s,n)},p(t,s){e=t},d(t){t&&v(s)}}}function Ha(t){let e,s,n,a=[],r=new Map,c=t[4];const l=t=>t[0];for(let o=0;o<c.length;o+=1){let e=za(t,c,o),s=l(e);r.set(s,a[o]=Ba(s,e))}return{c(){e=h("select");for(let t=0;t<a.length;t+=1)a[t].c();this.h()},l(t){e=m(t,"SELECT",{});var s=d(e);for(let e=0;e<a.length;e+=1)a[e].l(s);s.forEach(v),this.h()},h(){void 0===t[0]&&F((()=>t[7].call(e)))},m(r,c){w(r,e,c);for(let t=0;t<a.length;t+=1)a[t].m(e,null);pt(e,t[0]),s||(n=Q(e,"change",t[7]),s=!0)},p(t,s){16&s&&(c=t[4],a=J(a,s,l,1,t,c,r,e,X,Ba,null,za)),17&s&&pt(e,t[0])},d(t){t&&v(e);for(let e=0;e<a.length;e+=1)a[e].d();s=!1,n()}}}function Ga(t){let e,s;return e=new Js({props:{label:`squadron ${t[1]}`,$$slots:{default:[Ha]},$$scope:{ctx:t}}}),{c(){B(e.$$.fragment)},l(t){H(e.$$.fragment,t)},m(t,n){G(e,t,n),s=!0},p(t,s){const n={};2&s&&(n.label=`squadron ${t[1]}`),1025&s&&(n.$$scope={dirty:s,ctx:t}),e.$set(n)},i(t){s||(R(e.$$.fragment,t),s=!0)},o(t){W(e.$$.fragment,t),s=!1},d(t){Y(e,t)}}}function Ra(t){let e,s;return e=new gn({props:{cost:t[2],mass:t[3],$$slots:{default:[Ga]},$$scope:{ctx:t}}}),{c(){B(e.$$.fragment)},l(t){H(e.$$.fragment,t)},m(t,n){G(e,t,n),s=!0},p(t,[s]){const n={};4&s&&(n.cost=t[2]),8&s&&(n.mass=t[3]),1027&s&&(n.$$scope={dirty:s,ctx:t}),e.$set(n)},i(t){s||(R(e.$$.fragment,t),s=!0)},o(t){W(e.$$.fragment,t),s=!1},d(t){Y(e,t)}}}function Wa(t,e,s){const n=pe.map((({type:t})=>t));let{id:a=1}=e,{type:r="standard"}=e,{ftl:c=!1}=e,{cost:l=0}=e,{mass:o=0}=e,{ship_change:i=ut("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(ge.actions.set_squadron({id:a,type:r}))},[r,a,l,o,n,c,i,function(){r=yt(this),s(0,r),s(4,n)}]}class Ya extends i{constructor(t){super(),$(this,t,Wa,Ra,u,{id:1,type:0,ftl:5,cost:2,mass:3,ship_change:6})}}function Ja(t,e,s){const n=t.slice();return n[6]=e[s],n}function Xa(t){let e,s,n;return{c(){e=h("input"),this.h()},l(t){e=m(t,"INPUT",{type:!0,min:!0}),this.h()},h(){b(e,"type","number"),b(e,"min","0")},m(a,r){w(a,e,r),gt(e,t[0]),s||(n=Q(e,"input",t[5]),s=!0)},p(t,s){1&s&&dt(e.value)!==t[0]&&gt(e,t[0])},d(t){t&&v(e),s=!1,n()}}}function Za(t){let e,s;return e=new Js({props:{label:"bays",$$slots:{default:[Xa]},$$scope:{ctx:t}}}),{c(){B(e.$$.fragment)},l(t){H(e.$$.fragment,t)},m(t,n){G(e,t,n),s=!0},p(t,s){const n={};513&s&&(n.$$scope={dirty:s,ctx:t}),e.$set(n)},i(t){s||(R(e.$$.fragment,t),s=!0)},o(t){W(e.$$.fragment,t),s=!1},d(t){Y(e,t)}}}function Ka(t,e){let s,n,a;const r=[e[6]];let c={};for(let l=0;l<r.length;l+=1)c=$t(c,r[l]);return n=new Ya({props:c}),{key:t,first:null,c(){s=et(),B(n.$$.fragment),this.h()},l(t){s=et(),H(n.$$.fragment,t),this.h()},h(){this.first=s},m(t,e){w(t,s,e),G(n,t,e),a=!0},p(t,s){e=t;const a=2&s?lt(r,[ot(e[6])]):{};n.$set(a)},i(t){a||(R(n.$$.fragment,t),a=!0)},o(t){W(n.$$.fragment,t),a=!1},d(t){t&&v(s),Y(n,t)}}}function Qa(t){let e,s,n,a,r=[],c=new Map;e=new gn({props:{cost:t[2],mass:t[3],$$slots:{default:[Za]},$$scope:{ctx:t}}});let l=t[1];const o=t=>t[6].id;for(let i=0;i<l.length;i+=1){let e=Ja(t,l,i),s=o(e);c.set(s,r[i]=Ka(s,e))}return{c(){B(e.$$.fragment),s=f();for(let t=0;t<r.length;t+=1)r[t].c();n=et()},l(t){H(e.$$.fragment,t),s=y(t);for(let e=0;e<r.length;e+=1)r[e].l(t);n=et()},m(t,c){G(e,t,c),w(t,s,c);for(let e=0;e<r.length;e+=1)r[e].m(t,c);w(t,n,c),a=!0},p(t,s){const a={};4&s&&(a.cost=t[2]),8&s&&(a.mass=t[3]),513&s&&(a.$$scope={dirty:s,ctx:t}),e.$set(a),2&s&&(l=t[1],nt(),r=J(r,s,o,1,t,l,c,n.parentNode,at,Ka,n,Ja),rt())},i(t){if(!a){R(e.$$.fragment,t);for(let t=0;t<l.length;t+=1)R(r[t]);a=!0}},o(t){W(e.$$.fragment,t);for(let e=0;e<r.length;e+=1)W(r[e]);a=!1},d(t){Y(e,t),t&&v(s);for(let e=0;e<r.length;e+=1)r[e].d(t);t&&v(n)}}}function tr(t){let e,s;return e=new _n({props:{label:"carrier",$$slots:{default:[Qa]},$$scope:{ctx:t}}}),{c(){B(e.$$.fragment)},l(t){H(e.$$.fragment,t)},m(t,n){G(e,t,n),s=!0},p(t,[s]){const n={};527&s&&(n.$$scope={dirty:s,ctx:t}),e.$set(n)},i(t){s||(R(e.$$.fragment,t),s=!0)},o(t){W(e.$$.fragment,t),s=!1},d(t){Y(e,t)}}}function er(t,e,s){let{bays:n=0}=e,{squadrons:a=[]}=e,{cost:r=0}=e,{mass:c=0}=e,{ship_change:l=ut("ship_change")||(()=>{})}=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(ge.actions.set_carrier_bays(n))},[n,a,r,c,l,function(){n=dt(this.value),s(0,n)}]}class sr extends i{constructor(t){super(),$(this,t,er,tr,u,{bays:0,squadrons:1,cost:2,mass:3,ship_change:4})}}function nr(t){let e,s,n;return{c(){e=h("input"),this.h()},l(t){e=m(t,"INPUT",{type:!0,class:!0}),this.h()},h(){b(e,"type","number"),b(e,"class","short")},m(a,r){w(a,e,r),gt(e,t[0]),s||(n=Q(e,"input",t[4]),s=!0)},p(t,s){1&s&&dt(e.value)!==t[0]&&gt(e,t[0])},d(t){t&&v(e),s=!1,n()}}}function ar(t){let e,s;return e=new Js({props:{label:"ADFC",$$slots:{default:[nr]},$$scope:{ctx:t}}}),{c(){B(e.$$.fragment)},l(t){H(e.$$.fragment,t)},m(t,n){G(e,t,n),s=!0},p(t,s){const n={};33&s&&(n.$$scope={dirty:s,ctx:t}),e.$set(n)},i(t){s||(R(e.$$.fragment,t),s=!0)},o(t){W(e.$$.fragment,t),s=!1},d(t){Y(e,t)}}}function rr(t){let e,s;return e=new gn({props:{cost:t[1],mass:t[2],$$slots:{default:[ar]},$$scope:{ctx:t}}}),{c(){B(e.$$.fragment)},l(t){H(e.$$.fragment,t)},m(t,n){G(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||(R(e.$$.fragment,t),s=!0)},o(t){W(e.$$.fragment,t),s=!1},d(t){Y(e,t)}}}function cr(t,e,s){let{rating:n=0}=e,{cost:a=0}=e,{mass:r=0}=e,{ship_change:c=ut("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(De.actions.set_adfc(n))},[n,a,r,c,function(){n=dt(this.value),s(0,n)}]}class lr extends i{constructor(t){super(),$(this,t,cr,rr,u,{rating:0,cost:1,mass:2,ship_change:3})}}function or(t){let e,s,n,a,r,c,l,o,i,$,u,_,E,I,k;return{c(){e=h("select"),s=h("option"),n=p("beam"),a=h("option"),r=p("submunition pack"),c=h("option"),l=p("point defence system"),o=h("option"),i=p("scattergun"),$=h("option"),u=p("needle weapon"),_=f(),E=h("input"),this.h()},l(t){e=m(t,"SELECT",{});var h=d(e);s=m(h,"OPTION",{value:!0});var p=d(s);n=g(p,"beam"),p.forEach(v),a=m(h,"OPTION",{value:!0});var f=d(a);r=g(f,"submunition pack"),f.forEach(v),c=m(h,"OPTION",{value:!0});var b=d(c);l=g(b,"point defence system"),b.forEach(v),o=m(h,"OPTION",{value:!0});var w=d(o);i=g(w,"scattergun"),w.forEach(v),$=m(h,"OPTION",{value:!0});var x=d($);u=g(x,"needle weapon"),x.forEach(v),h.forEach(v),_=y(t),E=m(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,$.__value="needle",$.value=$.__value,void 0===t[0]&&F((()=>t[3].call(e))),b(E,"type","button"),E.value="add weapon",b(E,"class","button small blue")},m(h,p){w(h,e,p),x(e,s),x(s,n),x(e,a),x(a,r),x(e,c),x(c,l),x(e,o),x(o,i),x(e,$),x($,u),pt(e,t[0]),w(h,_,p),w(h,E,p),I||(k=[Q(e,"change",t[3]),Q(E,"click",t[1])],I=!0)},p(t,s){1&s&&pt(e,t[0])},d(t){t&&v(e),t&&v(_),t&&v(E),I=!1,vt(k)}}}function ir(t){let e,s;return e=new Js({props:{label:"weapon type",$$slots:{default:[or]},$$scope:{ctx:t}}}),{c(){B(e.$$.fragment)},l(t){H(e.$$.fragment,t)},m(t,n){G(e,t,n),s=!0},p(t,[s]){const n={};17&s&&(n.$$scope={dirty:s,ctx:t}),e.$set(n)},i(t){s||(R(e.$$.fragment,t),s=!0)},o(t){W(e.$$.fragment,t),s=!1},d(t){Y(e,t)}}}function $r(t,e,s){let{weapon_type:n="beam"}=e,{ship_change:a=ut("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(De.actions.add_weapon(n)),a,function(){n=yt(this),s(0,n)}]}class ur extends i{constructor(t){super(),$(this,t,$r,ir,u,{weapon_type:0,ship_change:2})}}function hr(t,e,s){const n=t.slice();return n[23]=e[s],n}function pr(t){let e,s;return e=new fn({props:{show:t[2]}}),e.$on("close",t[12]),{c(){B(e.$$.fragment)},l(t){H(e.$$.fragment,t)},m(t,n){G(e,t,n),s=!0},p(t,s){const n={};4&s&&(n.show=t[2]),e.$set(n)},i(t){s||(R(e.$$.fragment,t),s=!0)},o(t){W(e.$$.fragment,t),s=!1},d(t){Y(e,t)}}}function fr(t){let e,s,n,a,r,c,l,o,i,$,u,_,E,I,k,D,P,M,T;s=new un({}),a=new _a({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 h=0;h<N.length;h+=1)O=$t(O,N[h]);c=new Qn({props:O}),c.$on("change_hull",t[7]),c.$on("set_screens",t[10]),c.$on("set_cargo",t[11]),c.$on("ship_change",t[11]),o=new _n({props:{label:"weaponry",$$slots:{default:[vr]},$$scope:{ctx:t}}});const V=[t[1].carrier];let A={};for(let h=0;h<V.length;h+=1)A=$t(A,V[h]);return $=new sr({props:A}),{c(){e=h("main"),B(s.$$.fragment),n=f(),B(a.$$.fragment),r=f(),B(c.$$.fragment),l=f(),B(o.$$.fragment),i=f(),B($.$$.fragment),u=f(),_=h("footer"),E=p("Written by "),I=h("a"),k=p("Yanick Champoux"),D=p(".\n Code available on "),P=h("a"),M=p("Github"),this.h()},l(t){e=m(t,"MAIN",{class:!0});var h=d(e);H(s.$$.fragment,h),n=y(h),H(a.$$.fragment,h),r=y(h),H(c.$$.fragment,h),l=y(h),H(o.$$.fragment,h),i=y(h),H($.$$.fragment,h),h.forEach(v),u=y(t),_=m(t,"FOOTER",{class:!0});var p=d(_);E=g(p,"Written by "),I=m(p,"A",{href:!0});var f=d(I);k=g(f,"Yanick Champoux"),f.forEach(v),D=g(p,".\n Code available on "),P=m(p,"A",{href:!0});var b=d(P);M=g(b,"Github"),b.forEach(v),p.forEach(v),this.h()},h(){b(e,"class","svelte-4zjur4"),b(I,"href","https://twitter.com/yenzie"),b(P,"href","https://github.com/yanick/aotds-shipyard"),b(_,"class","svelte-4zjur4")},m(t,h){w(t,e,h),G(s,e,null),x(e,n),G(a,e,null),x(e,r),G(c,e,null),x(e,l),G(o,e,null),x(e,i),G($,e,null),w(t,u,h),w(t,_,h),x(_,E),x(_,I),x(I,k),x(_,D),x(_,P),x(P,M),T=!0},p(t,e){const s={};2&e&&(s.ftl=t[1].ftl),2&e&&(s.engine=t[1].engine),a.$set(s);const n=2&e?lt(N,[{ship_mass:t[1].general.mass},ot(t[1].structure.hull),{screens:t[1].structure.screens},{armour:t[1].structure.armour},{cargo:t[1].cargo},{streamlining:t[1].streamlining}]):{};c.$set(n);const r={};67108867&e&&(r.$$scope={dirty:e,ctx:t}),o.$set(r);const l=2&e?lt(V,[ot(t[1].carrier)]):{};$.$set(l)},i(t){T||(R(s.$$.fragment,t),R(a.$$.fragment,t),R(c.$$.fragment,t),R(o.$$.fragment,t),R($.$$.fragment,t),T=!0)},o(t){W(s.$$.fragment,t),W(a.$$.fragment,t),W(c.$$.fragment,t),W(o.$$.fragment,t),W($.$$.fragment,t),T=!1},d(t){t&&v(e),Y(s),Y(a),Y(c),Y(o),Y($),t&&v(u),t&&v(_)}}}function mr(t){let e,s;return e=new Gs({props:{ship:t[1]}}),{c(){B(e.$$.fragment)},l(t){H(e.$$.fragment,t)},m(t,n){G(e,t,n),s=!0},p(t,s){const n={};2&s&&(n.ship=t[1]),e.$set(n)},i(t){s||(R(e.$$.fragment,t),s=!0)},o(t){W(e.$$.fragment,t),s=!1},d(t){Y(e,t)}}}function dr(t){let e,s;return e=new Ne({props:{ship:t[1]}}),e.$on("close",t[17]),{c(){B(e.$$.fragment)},l(t){H(e.$$.fragment,t)},m(t,n){G(e,t,n),s=!0},p(t,s){const n={};2&s&&(n.ship=t[1]),e.$set(n)},i(t){s||(R(e.$$.fragment,t),s=!0)},o(t){W(e.$$.fragment,t),s=!1},d(t){Y(e,t)}}}function gr(t,e){let s,n,a;return n=new ja({props:{weapon:e[23],id:e[23].id,cost:e[23].cost,mass:e[23].mass}}),{key:t,first:null,c(){s=et(),B(n.$$.fragment),this.h()},l(t){s=et(),H(n.$$.fragment,t),this.h()},h(){this.first=s},m(t,e){w(t,s,e),G(n,t,e),a=!0},p(t,s){e=t;const a={};1&s&&(a.weapon=e[23]),1&s&&(a.id=e[23].id),1&s&&(a.cost=e[23].cost),1&s&&(a.mass=e[23].mass),n.$set(a)},i(t){a||(R(n.$$.fragment,t),a=!0)},o(t){W(n.$$.fragment,t),a=!1},d(t){t&&v(s),Y(n,t)}}}function vr(t){let e,s,n,a,r,c,l,o,i=[],$=new Map;const u=[t[1].weaponry.firecons];let h={};for(let f=0;f<u.length;f+=1)h=$t(h,u[f]);e=new aa({props:h}),e.$on("change_firecons",t[8]);const p=[t[1].weaponry.adfc];let m={};for(let f=0;f<p.length;f+=1)m=$t(m,p[f]);n=new lr({props:m}),r=new ur({});let d=t[0];const g=t=>t[23].id;for(let f=0;f<d.length;f+=1){let e=hr(t,d,f),s=g(e);$.set(s,i[f]=gr(s,e))}return{c(){B(e.$$.fragment),s=f(),B(n.$$.fragment),a=f(),B(r.$$.fragment),c=f();for(let t=0;t<i.length;t+=1)i[t].c();l=et()},l(t){H(e.$$.fragment,t),s=y(t),H(n.$$.fragment,t),a=y(t),H(r.$$.fragment,t),c=y(t);for(let e=0;e<i.length;e+=1)i[e].l(t);l=et()},m(t,$){G(e,t,$),w(t,s,$),G(n,t,$),w(t,a,$),G(r,t,$),w(t,c,$);for(let e=0;e<i.length;e+=1)i[e].m(t,$);w(t,l,$),o=!0},p(t,s){const a=2&s?lt(u,[ot(t[1].weaponry.firecons)]):{};e.$set(a);const r=2&s?lt(p,[ot(t[1].weaponry.adfc)]):{};n.$set(r),1&s&&(d=t[0],nt(),i=J(i,s,g,1,t,d,$,l.parentNode,at,gr,l,hr),rt())},i(t){if(!o){R(e.$$.fragment,t),R(n.$$.fragment,t),R(r.$$.fragment,t);for(let t=0;t<d.length;t+=1)R(i[t]);o=!0}},o(t){W(e.$$.fragment,t),W(n.$$.fragment,t),W(r.$$.fragment,t);for(let e=0;e<i.length;e+=1)W(i[e]);o=!1},d(t){Y(e,t),t&&v(s),Y(n,t),t&&v(a),Y(r,t),t&&v(c);for(let e=0;e<i.length;e+=1)i[e].d(t);t&&v(l)}}}function yr(t){let e,s,n,a,r,c,l,o,i,$,u,p,g,_,E,I,k,D,P,M,T,N,O;e=new kt({});let V=t[2]&&pr(t);const A=[dr,mr,fr],S=[];function q(t,e){return"json"===t[3]?0:"print"===t[3]?1:2}return D=q(t),P=S[D]=A[D](t),{c(){B(e.$$.fragment),s=f(),n=h("nav"),a=h("input"),r=f(),c=h("div"),l=f(),o=h("input"),i=f(),$=h("ul"),u=h("input"),p=f(),g=h("input"),_=f(),E=h("input"),I=f(),V&&V.c(),k=f(),P.c(),M=et(),this.h()},l(t){H(e.$$.fragment,t),s=y(t),n=m(t,"NAV",{class:!0});var h=d(n);a=m(h,"INPUT",{class:!0,type:!0,value:!0}),r=y(h),c=m(h,"DIV",{class:!0}),d(c).forEach(v),l=y(h),o=m(h,"INPUT",{type:!0,class:!0,value:!0}),i=y(h),$=m(h,"UL",{class:!0});var f=d($);u=m(f,"INPUT",{type:!0,class:!0,value:!0}),p=y(f),g=m(f,"INPUT",{type:!0,class:!0,value:!0}),_=y(f),E=m(f,"INPUT",{type:!0,class:!0,value:!0}),f.forEach(v),h.forEach(v),I=y(t),V&&V.l(t),k=y(t),P.l(t),M=et(),this.h()},h(){b(a,"class","reset button small red svelte-4zjur4"),b(a,"type","button"),a.value="reset",b(c,"class","spacer svelte-4zjur4"),b(o,"type","button"),b(o,"class","button small notes svelte-4zjur4"),o.value="notes",b(u,"type","button"),b(u,"class","button small green"),u.value="editor",b(g,"type","button"),b(g,"class","button small green"),g.value="json",b(E,"type","button"),b(E,"class","button small green"),E.value="print",b($,"class","button-group"),b(n,"class","svelte-4zjur4")},m(h,f){G(e,h,f),w(h,s,f),w(h,n,f),x(n,a),x(n,r),x(n,c),x(n,l),x(n,o),x(n,i),x(n,$),x($,u),x($,p),x($,g),x($,_),x($,E),w(h,I,f),V&&V.m(h,f),w(h,k,f),S[D].m(h,f),w(h,M,f),T=!0,N||(O=[Q(a,"click",t[9]),Q(o,"click",t[12]),Q(u,"click",t[14]),Q(g,"click",t[15]),Q(E,"click",t[16])],N=!0)},p(t,[e]){t[2]?V?(V.p(t,e),4&e&&R(V,1)):(V=pr(t),V.c(),R(V,1),V.m(k.parentNode,k)):V&&(nt(),W(V,1,1,(()=>{V=null})),rt());let s=D;D=q(t),D===s?S[D].p(t,e):(nt(),W(S[s],1,1,(()=>{S[s]=null})),rt(),P=S[D],P?P.p(t,e):(P=S[D]=A[D](t),P.c()),R(P,1),P.m(M.parentNode,M))},i(t){T||(R(e.$$.fragment,t),R(V),R(P),T=!0)},o(t){W(e.$$.fragment,t),W(V),W(P),T=!1},d(t){Y(e,t),t&&v(s),t&&v(n),t&&v(I),V&&V.d(t),t&&v(k),S[D].d(t),t&&v(M),N=!1,vt(O)}}}function _r(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=De.createStore(t,(t=>Pe(S(t))));let s;return e.dispatch(e.actions.set_ship_reqs(Pt(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:q(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))),bt("ship",a),n.general.name;let r=[];const c=a.dispatch.reset;bt("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 br extends i{constructor(t){super(),$(this,t,_r,yr,u,{})}}function wr(t){let e,s;return e=new br({}),{c(){B(e.$$.fragment)},l(t){H(e.$$.fragment,t)},m(t,n){G(e,t,n),s=!0},p:E,i(t){s||(R(e.$$.fragment,t),s=!0)},o(t){W(e.$$.fragment,t),s=!1},d(t){Y(e,t)}}}export default class extends i{constructor(t){super(),$(this,t,null,wr,u,{})}}