aotds-docks/docs/_app/pages/index.svelte-71d76324.js
2021-06-13 13:15:45 -04:00

2 lines
96 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 u,s as $,e as h,t as f,k as p,c as d,a as m,g,d as v,n as y,b,f as _,F as w,G as x,H as E,I,J as O,K as k,L as D,M,N as A,O as P,P as T,Q as C,R as S,T as N,U as j,V,W as q,X as L,Y as F,Z as B,_ as U,$ as H,a0 as z,a1 as G,a2 as R,a3 as W,a4 as Y,a5 as J,a6 as Z,a7 as X,a8 as K,a9 as Q,h as tt,aa as et,ab as st,ac as nt,ad as at,j as rt,m as ct,o as lt,v as ot,r as it,w as ut,ae as $t,af as ht,ag as ft,ah as pt,ai as dt,l as mt,D as gt,B as vt,aj as yt,u as bt,E as _t,p as wt,q as xt,ak as Et,A as It,al as Ot,am as kt,an as Dt,ao as Mt,ap as At,aq as Pt,ar as Tt,as as Ct,at as St,au as Nt,x as jt,av as Vt}from"../chunks/vendor-d7482fce.js";import{b as qt}from"../chunks/paths-45dac81d.js";function Lt(t){let e,s,n,a,r,c,l,o,i;return{c(){e=h("header"),s=h("h1"),n=f("The Docks"),a=p(),r=h("h2"),c=f("a "),l=h("a"),o=f("Full Thrust"),i=f(" ship builder"),this.h()},l(t){e=d(t,"HEADER",{class:!0});var u=m(e);s=d(u,"H1",{class:!0});var $=m(s);n=g($,"The Docks"),$.forEach(v),a=y(u),r=d(u,"H2",{class:!0});var h=m(r);c=g(h,"a "),l=d(h,"A",{href:!0});var f=m(l);o=g(f,"Full Thrust"),f.forEach(v),i=g(h," ship builder"),h.forEach(v),u.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,u){_(t,e,u),w(e,s),w(s,n),w(e,a),w(e,r),w(r,c),w(r,l),w(l,o),w(r,i)},p:x,i:x,o:x,d(t){t&&v(e)}}}class Ft extends i{constructor(t){super(),u(this,t,null,Lt,$,{})}}function Bt(t){let e,s,n,a,r;return{c(){e=h("a"),s=E("svg"),n=E("path"),a=E("path"),r=E("path"),this.h()},l(t){e=d(t,"A",{href:!0,class:!0,"aria-label":!0});var c=m(e);s=d(c,"svg",{width:!0,height:!0,viewBox:!0,style:!0,"aria-hidden":!0},1);var l=m(s);n=d(l,"path",{d:!0},1),m(n).forEach(v),a=d(l,"path",{d:!0,fill:!0,style:!0,class:!0},1),m(a).forEach(v),r=d(l,"path",{d:!0,fill:!0,class:!0},1),m(r).forEach(v),l.forEach(v),c.forEach(v),this.h()},h(){b(n,"d","M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"),b(a,"d","M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2"),b(a,"fill","currentColor"),I(a,"transform-origin","130px 106px"),b(a,"class","octo-arm"),b(r,"d","M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z"),b(r,"fill","currentColor"),b(r,"class","octo-body"),b(s,"width","80"),b(s,"height","80"),b(s,"viewBox","0 0 250 250"),I(s,"fill","#151513"),I(s,"color","#fff"),I(s,"position","absolute"),I(s,"top","0"),I(s,"border","0"),I(s,"right","0"),b(s,"aria-hidden","true"),b(e,"href",Ut),b(e,"class","github-corner"),b(e,"aria-label","View source on GitHub")},m(t,c){_(t,e,c),w(e,s),w(s,n),w(s,a),w(s,r)},p:x,i:x,o:x,d(t){t&&v(e)}}}const Ut="https://github.com/aotds/aotds-docks";class Ht extends i{constructor(t){super(),u(this,t,null,Bt,$,{})}}const zt=(t={})=>[P(["cost","mass"],t),...Object.values(t||{}).filter((t=>"object"==typeof t)).map((t=>zt(t)))];function Gt(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=O(zt,k,D(M("cost")))(o(l({},c),{cost:s.mass,mass:0}));return{mass:A("mass",i),cost:A("cost",i)}}const Rt=t=>Math.ceil(Math.round(10*t)/10);function Wt(t){var e=t;return function(){return e}}function Yt(t){return Array.isArray(t)?t:T((""+t).split("."),(function(t){return!t}))}var Jt=C.placeholder;function Zt(t,e){return void 0===e&&(e=t.length),C(t,e)}var Xt=Zt((function(t,e,s){for(var n=Yt(t),a=s,r=0;r<n.length;r+=1){if(void 0===a)return!1;a=a[n[r]]}return"function"==typeof e?e(a):e===a}));function Kt(t,e){return void 0===e&&(e=t.length),Zt((function(){for(var e=[],s=0;s<arguments.length;s++)e[s]=arguments[s];return t.apply(void 0,e)}),e)}var Qt=function(){return(Qt=Object.assign||function(t){for(var e,s=1,n=arguments.length;s<n;s++)for(var a in e=arguments[s])Object.prototype.hasOwnProperty.call(e,a)&&(t[a]=e[a]);return t}).apply(this,arguments)},te=function(){for(var t=0,e=0,s=arguments.length;e<s;e++)t+=arguments[e].length;var n=Array(t),a=0;for(e=0;e<s;e++)for(var r=arguments[e],c=0,l=r.length;c<l;c++,a++)n[a]=r[c];return n},ee={__omitted:!0},se=Wt(ee);function ne(t){return!Object.keys(t).length}function ae(t,e){return function(t,e,s){return Object.keys(t).reduce((function(s,n){return e(s,t[n],n)}),s)}(t,(function(t,s,n){var a=s;return Array.isArray(s)||null===s||"object"!=typeof s?"function"==typeof s&&(a=s(e[n])):a=ce(s,e[n]),e[n]!==a&&(t[n]=a),t}),{})}function re(t,e){var s=te(e);return Object.keys(t).forEach((function(e){s[e]=t[e]})),s}function ce(t,e){for(var s=[],n=2;n<arguments.length;n++)s[n-2]=arguments[n];if("function"==typeof t)return t.apply(void 0,te([e],s));if(!S(t))return t;var a=null==e?{}:e,r=ae(t,a);return ne(r)?a:Array.isArray(a)?re(r,a).filter((function(t){return t!==ee})):N(Qt(Qt({},a),r),(function(t){return t===ee}))}var le=Kt(ce,2);var oe=Kt((function(t,e,s,n){var a="function"==typeof t?t(n):"boolean"==typeof t?t:j(n,t);return le(a?e:s,n)})),ie=Zt((function(t,e,s){return oe(t,e,(function(t){return t}),s)}));var ue=Kt((function(t,e){var s="function"==typeof t?t:le(t),n=(Array.isArray(e)?q:L)(e,s);return function(t,e){var s=!0;return V(e,(function(e,n){if(e!==t[n])return s=!1,!1})),s}(e,n)?e:n}));var $e=Kt((function(t,e){return F(e,t)}));var he=Kt((function(t,e){return N(e,t)}));var fe=Kt((function(t,e){var s=T(e,t);return e.length===s.length?e:s}));function pe(t,e){var s;return"*"===e?function(e){var s;return Object.prototype.hasOwnProperty.call(e,"*")?le(((s={})["*"]=t,s),e):ue(t,e)}:((s={})[e]=t,s)}var de=Zt((function(t,e,s){var n=Yt(t).reduceRight(pe,e);return le(n,s)}));var me=Zt((function(t,e,s){return le(e,void 0===s?t:s)}));var ge=Kt((function(t,e,s,n){"function"!=typeof e&&(e=le(e)),"function"!=typeof s&&(s=le(s));var a=!1,r=ue(ie(t,(function(t){return a=!0,e(t)})),n);return a?r:s(n)}));var ve=Kt((function(t,e,s){return ge(t,e,(function(t){return t}),s)})),ye={constant:Wt,is:Xt,map:ue,omit:$e,omitBy:he,ifElse:oe,if:ie,update:le,updateIn:de,withDefault:me,reject:fe,omitted:se,_:Jt,mapWhen:ve,mapWhenElse:ge},be=le;Object.assign(be,ye);const _e=t=>0==t.length?()=>t=>t:t.reduce(((t,e)=>(s=null,n)=>a=>e(s,n)(t(s,n)(a))));function we(t={},e={},s=[]){const n=Object.entries(e).map((([t,e])=>(s,n)=>be.updateIn(t,e(n)))),a=s.map((t=>(e,s)=>t(s))),r=_e([...n,...a]);let c={};return Object.entries(t).forEach((([t,e])=>{const[s,n]=Array.isArray(e)?e:[e,!1];c[t]=n?s:_e([r,s])})),c["*"]||(c["*"]=r),c}const xe=()=>t=>e=>t(e);function Ee(t=[],e=[],s={}){let n=[...e,...Object.entries(s).map((([t,e])=>function(t,e){return s=>e(Object.assign(Object.assign({},s),{getState:()=>B.get(t,s.getState())}))}(t,e)))],a=!1,r=t.flatMap((t=>t!==xe?t:(a=!0,n)));return a||(r=[...r,...n]),(t=>e=>s=>t.reduceRight(((t,s)=>s(e)(t)),s))(r)}function Ie(t,e){return s=>n=>{void 0===n&&(n=t);const a=e[s.type]||e["*"];return a?a(s.payload,s)(n):n}}function Oe([t,e]){return e?Object.entries(B.mapValues((e=>s=>e(s[t])))(e)):[]}class ke{constructor(t={}){var e,s,n,a,r,c,l,o;this.localSelectors={},this.localEffects=[],this.localActions={},this.localMutations={},this.localSubscriptions=[],this.localInitial=null!==(e=t.initial)&&void 0!==e?e:{},this.localSelectors=null!==(s=t.selectors)&&void 0!==s?s:{},this.coduxes=null!==(n=t.coduxes)&&void 0!==n?n:[],this.subduxes=null!==(a=t.subduxes)&&void 0!==a?a:{},Object.entries(null!==(r=t.actions)&&void 0!==r?r:{}).forEach((t=>this.addAction(...t))),this.coduxes.forEach((t=>Object.entries(t.actions).forEach((t=>this.addAction(...t))))),Object.values(this.subduxes).forEach((t=>{Object.entries(t.actions).forEach((t=>{this.addAction(...t)}))})),t.subscriptions&&t.subscriptions.forEach((t=>this.addSubscription(t))),this.groomMutations=null!==(c=t.groomMutations)&&void 0!==c?c:t=>t;let i=null!==(l=t.effects)&&void 0!==l?l:[];Array.isArray(i)||(i=Object.entries(i)),i.forEach((t=>this.addEffect(...t)));let u=null!==(o=t.mutations)&&void 0!==o?o:[];Array.isArray(u)||(u=B.toPairs(u)),u.forEach((t=>this.addMutation(...t)))}get initial(){return function(t,e=[],s={}){return B.isPlainObject(t)?B.flow([be(B.omit(["*"],s)),e.map((t=>be(t))),be(t)].flat())({}):t}(this.localInitial,this.coduxes.map((({initial:t})=>t)),B.mapValues("initial",this.subduxes))}get middleware(){const t=this.selectors,e=this.actions;return Ee(this.localEffects.map((s=>((t,e,s)=>{let[n,a,r]=t;if(a===xe)return xe;r&&(a=a());const c=t=>a(Object.assign(Object.assign({},t),{actions:e,selectors:s}));return"*"===n?c:t=>e=>s=>s.type!==n?e(s):c(t)(e)(s)})(s,e,t))),this.coduxes.map(B.get("middleware")),B.mapValues("middleware",this.subduxes))}get actions(){return this.localActions}get upreducer(){return Ie(this.initial,this.mutations)}get reducer(){return(t,e)=>this.upreducer(e)(t)}get mutations(){return we(this.localMutations,B.mapValues("upreducer",this.subduxes),B.map("upreducer",this.coduxes))}get subduxUpreducer(){return Ie(this.initial,we({},this.subduxes))}createStore(...t){const e=function(t,e,s={}){return function(n,a){let r=a?a(e):U(e);const c=H(t,n,r);return c.actions=s,c}}(this.reducer,this.middleware,this.actions)(...t);return function(t,e=[]){e.forEach((e=>{const s=e(t);let n=t.subscribe((()=>{const e=t.getState();return s(e,n)}))}))}(e,this.subscriptions),e}get subscriptions(){return[this.localSubscriptions,Object.entries(this.subduxes).map((([t,e])=>e.subscriptions.map((e=>function(t,e){return s=>{const n=e(s);return(e,s)=>n(B.get(t,e),s)}}(t,e)))))].flat(1/0).map((t=>function(t){return e=>{const s=t(e);let n;return(t,e)=>{if(t!==n)return n=t,s(t,e)}}}(t)))}get asDux(){return{createStore:this.createStore.bind(this),upreducer:this.upreducer,subduxes:this.subduxes,coduxes:this.coduxes,middleware:this.middleware,actions:this.actions,reducer:this.reducer,mutations:this.mutations,initial:this.initial,selectors:this.selectors,subscriptions:this.subscriptions}}addMutation(t,e,s){const n=this.addAction(t);this.localMutations[n.type]=[this.groomMutations(e),s]}addEffect(t,e,s=!1){const n=this.addAction(t);this.localEffects.push([n.type,e,s])}addAction(t,e){var s;let n,a;"string"==typeof t?(n=t,a=e?e.type?e:z(n,((...t)=>({payload:e(...t)}))):null!==(s=this.localActions[n])&&void 0!==s?s:z(n,G())):(n=t.type,a=t);const r=this.localActions[n];if(!r)return this.localActions[n]=a;if(r!==a&&"*"!==r.type)throw new Error(`action ${n} already exists`);return r}get _middlewareEntries(){const t=t=>B.groupBy((([,,t])=>["^","$"].includes(t)?t:"middle"),t),e=B.flow([B.toPairs,B.map((([t,e])=>e._middlewareEntries.map((([e,s,...n])=>[e,[t,...s],...n])))),B.flatten,t])(this.subduxes),s=t(this.localEffects.map((t=>[this,[],...t])));return B.flatten([s["^"],e["^"],s.middle,e.middle,e.$,s.$].filter((t=>t)))}addSelector(t,e){this.localSelectors[t]=e}get selectors(){return function(t={},e=[],s={}){return Object.fromEntries([Object.entries(s).flatMap(Oe),Object.entries(e),Object.entries(t)].flat())}(this.localSelectors,B.map("selectors",this.coduxes),B.mapValues("selectors",this.subduxes))}addSubscription(t){this.localSubscriptions=[...this.localSubscriptions,t]}}const De=R("set_ftl",W()),Me=R("set_ftl_reqs",W());console.log(ke);const Ae=new ke({initial:{mass:0,cost:0,type:"none"}});Ae.addMutation(De,(t=>be.update({type:t}))),Ae.addMutation(Me,(t=>be.update(t)));var Pe=Ae.asDux;const Te=R("set_engine",W()),Ce=R("set_drive_reqs",W()),Se=new ke({initial:{mass:1,cost:2,rating:1}});Se.addMutation(Te,(t=>be.update(t))),Se.addMutation(Ce,(t=>be.update(t)));var Ne=Se.asDux;function je(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,Ve(e)?s+=2:s+=e.length-1);4==t&&(s=8,Ve(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 Ve=t=>4===t.length&&!t.some((t=>1===t.length));const qe=R("add_weapon",W()),Le=R("remove_weapon",W()),Fe=(Be=t=>be(je(t)),t=>Be(t)(t));var Be;const Ue=new ke({initial:[]}),He={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"]}};Ue.addMutation(qe,(t=>e=>{const s=1+Math.max(0,...e.map((({id:t})=>t)));return[...e,o(l({},Fe(He[t])),{id:s})]})),Ue.addMutation(Le,(t=>e=>e.filter((e=>e.id!==t))));const ze=R("set_weapon",W());Ue.addMutation(ze,(t=>be.map(be.if(Y({id:t.id}),(e=>Fe(be(t,e)))))));var Ge=Ue.asDux;const Re=new ke({initial:{rating:0,cost:0,mass:0}});Re.addMutation(R("set_adfc",W()),(t=>be.update({rating:t,mass:2*t,cost:8*t})));var We=new ke({initial:{firecons:{nbr:0,cost:0,mass:0}},subduxes:{weapons:Ge,adfc:Re.asDux}}).asDux;const Ye=[{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 Je(t=0,e=!1){return console.log({carrier:e}),Ye.filter((t=>e==!!t.carrier)).filter((e=>e.mass[0]<=t)).filter((e=>e.mass[1]>=t))}const Ze=new ke({initial:{standard:0,advanced:0,cost:0,mass:0}}),Xe=R("set_screens",W());Ze.addMutation(Xe,(t=>be.update(t)));const Ke=R("set_screens_reqs",W());Ze.addMutation(Ke,(t=>be.update(t)));var Qe=Ze.asDux;const ts=new ke({initial:[]}),es=R("set_armour_nbr_layers",W());ts.addMutation(es,(t=>e=>(e.length>t&&(e=e.slice(0,t)),e.length<t&&(e=[e,J.times(t-e.length,(()=>[]))].flat()),e=be.map(((t,e)=>l({layer:e+1,rating:0,cost:0,mass:0},t)),e)))),ts.addMutation(R("set_armour_layer",W()),(({layer:t,rating:e})=>be.map(be.if(J.matches({layer:t}),be({rating:e,cost:2*t*e,mass:2*e})))));var ss=ts.asDux;var ns=new ke({initial:{mass:0,cost:0,hull:{rating:1,advanced:!1,cost:2,mass:1}},subduxes:{screens:Qe,armour:ss}}).asDux;const as=new ke({initial:{space:0,cost:0,mass:0}}),rs=R("set_cargo",W());as.addMutation(rs,(t=>()=>({space:t,cost:0,mass:t})));var cs=as.asDux;const ls=new ke({initial:{type:"none",cost:0,mass:0}}),os=R("set_streamlining",W());ls.addMutation(os,(t=>be.update({type:t})));const is=R("set_streamlining_cost_mass",W());ls.addMutation(is,(t=>be.update(t)));var us=ls.asDux,$s=[{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 hs=new ke({initial:{bays:0,cost:0,mass:0,squadrons:[]}}),fs=R("set_squadron",W());hs.addMutation(fs,(({id:t,type:e})=>be.update({squadrons:be.map(be.if(J.matches({id:t}),be({type:e,cost:6*J.find($s,{type:e}).cost,mass:6})))})));const ps=R("set_carrier_bays",W());hs.addMutation(ps,(t=>e=>((e=be.update({bays:t,mass:9*t,cost:27*t})(e)).squadrons.length>t&&(e=be.update({squadrons:e=>e.slice(0,t)},e)),e.squadrons.length<t&&(e=be.update({squadrons:s=>[...s,...J.times(t-e.squadrons.length,(t=>({id:1+t+e.squadrons.length,cost:6*$s[0].cost,mass:6,type:$s[0].type})))]},e)),e)));var ds=hs.asDux;const ms=R("set_ship_mass",W()),gs=R("set_name",W()),vs=R("set_ship_reqs",W()),ys=R("set_hull",W()),bs=R("set_ship_type",W()),_s=R("reset"),ws={general:{ship_class:"",name:"",ship_type:"",mass:10,used_mass:0,cost:10}};console.log(ke);const xs=new ke({subduxes:{ftl:Pe,engine:Ne,weaponry:We,structure:ns,cargo:cs,streamlining:us,carrier:ds},initial:ws});xs.addMutation(_s,(()=>()=>ws)),xs.addMutation(ys,(({rating:t})=>e=>be.updateIn("structure.hull",{cost:2*t,rating:t,mass:t})(e))),xs.addMutation(ms,(t=>be.updateIn("general",{mass:t}))),xs.addMutation(gs,(t=>be.updateIn("general",{name:t}))),xs.addMutation(R("set_ship_class",W()),(t=>be.updateIn("general",{ship_class:t}))),xs.addMutation(vs,(({cost:t,mass:e})=>be.updateIn("general",{cost:t,used_mass:e}))),xs.addSubscription((t=>Z(Gt,(e=>t.dispatch(vs(e)))))),xs.addSubscription((t=>Z((t=>t.general.mass),(t=>t.streamlining.type),((e,s)=>{const n=Rt(e*("none"===s?0:"partial"===s?5:10)/100),a=2*n;t.dispatch(xs.actions.set_streamlining_cost_mass({cost:a,mass:n}))})))),xs.addSubscription((t=>Z((t=>t.general.mass),(t=>t.general.ship_type),(t=>t.carrier.bays),((e,s,n)=>{console.log({bays:n});const a=Je(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)))})))),xs.addMutation(bs,(t=>be.updateIn("general.ship_type",t))),xs.addSubscription((t=>Z([t=>t.general.mass,t=>t.ftl.type],((e,s)=>t.dispatch(Pe.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))))))),xs.addSubscription((t=>Z((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,Rt(.05*e)),r=n*Math.max(4,Rt(.075*e));t.dispatch(xs.actions.set_screens_reqs({mass:a+r,cost:3*a+4*r}))})))),xs.addSubscription((t=>Z([t=>t.general.mass,t=>t.engine.rating,t=>t.engine.advanced],((e,s,n)=>t.dispatch(xs.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 Es=R("set_firecons",W());xs.addMutation(Es,(t=>be.updateIn("weaponry.firecons",l({nbr:t},(t=>({cost:4*t,mass:t}))(t)))));var Is=xs.asDux;xs.actions;let Os=Q;Os=window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__;function ks(t){let e,s,n,a,r,c;return{c(){e=h("aside"),s=h("pre"),n=h("code"),a=f(t[0]),this.h()},l(r){e=d(r,"ASIDE",{class:!0});var c=m(e);s=d(c,"PRE",{class:!0});var l=m(s);n=d(l,"CODE",{});var o=m(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){_(t,e,r),w(e,s),w(s,n),w(n,a),c=!0},p(t,[e]){(!c||1&e)&&tt(a,t[0])},i(t){c||(et((()=>{r||(r=st(e,nt,{},!0)),r.run(1)})),c=!0)},o(t){r||(r=st(e,nt,{},!1)),r.run(0),c=!1},d(t){t&&v(e),t&&r&&r.end()}}}function Ds(t,e,s){let n,{ship:a={}}=e;return at(),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 Ms extends i{constructor(t){super(),u(this,t,Ds,ks,$,{ship:1})}}function As(t){let e,s;return{c(){e=h("div"),s=f(t[0]),this.h()},l(n){e=d(n,"DIV",{class:!0});var a=m(e);s=g(a,t[0]),a.forEach(v),this.h()},h(){b(e,"class","svelte-1oeefsn")},m(t,n){_(t,e,n),w(e,s)},p(t,[e]){1&e&&tt(s,t[0])},i:x,o:x,d(t){t&&v(e)}}}function Ps(t,e,s){let{cost:n=0}=e;return t.$$set=t=>{"cost"in t&&s(0,n=t.cost)},[n]}class Ts extends i{constructor(t){super(),u(this,t,Ps,As,$,{cost:0})}}function Cs(t){let e,s;return{c(){e=h("div"),s=f(t[0]),this.h()},l(n){e=d(n,"DIV",{class:!0});var a=m(e);s=g(a,t[0]),a.forEach(v),this.h()},h(){b(e,"class","svelte-ylboiy")},m(t,n){_(t,e,n),w(e,s)},p(t,[e]){1&e&&tt(s,t[0])},i:x,o:x,d(t){t&&v(e)}}}function Ss(t,e,s){let{mass:n=0}=e;return t.$$set=t=>{"mass"in t&&s(0,n=t.mass)},[n]}class Ns extends i{constructor(t){super(),u(this,t,Ss,Cs,$,{mass:0})}}function js(t){let e,s,n,a,r,c,l,o,i,u,$,x,E,I,O;return x=new Ts({props:{cost:t[2]}}),I=new Ns({props:{mass:t[3]}}),{c(){e=h("h1"),s=f("ship name: "),n=h("div"),a=p(),r=h("div"),c=h("h2"),l=f(t[0]),o=f("-class, "),i=f(t[1]),u=p(),$=h("div"),rt(x.$$.fragment),E=f("\n  \n "),rt(I.$$.fragment),this.h()},l(h){e=d(h,"H1",{class:!0});var f=m(e);s=g(f,"ship name: "),n=d(f,"DIV",{class:!0}),m(n).forEach(v),f.forEach(v),a=y(h),r=d(h,"DIV",{class:!0});var p=m(r);c=d(p,"H2",{class:!0});var b=m(c);l=g(b,t[0]),o=g(b,"-class, "),i=g(b,t[1]),b.forEach(v),u=y(p),$=d(p,"DIV",{class:!0});var _=m($);ct(x.$$.fragment,_),E=g(_,"\n  \n "),ct(I.$$.fragment,_),_.forEach(v),p.forEach(v),this.h()},h(){b(n,"class","fill svelte-bo35k"),b(e,"class","svelte-bo35k"),b(c,"class","svelte-bo35k"),b($,"class","reqs svelte-bo35k"),b(r,"class","details svelte-bo35k")},m(t,h){_(t,e,h),w(e,s),w(e,n),_(t,a,h),_(t,r,h),w(r,c),w(c,l),w(c,o),w(c,i),w(r,u),w(r,$),lt(x,$,null),w($,E),lt(I,$,null),O=!0},p(t,[e]){(!O||1&e)&&tt(l,t[0]),(!O||2&e)&&tt(i,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){O||(ot(x.$$.fragment,t),ot(I.$$.fragment,t),O=!0)},o(t){it(x.$$.fragment,t),it(I.$$.fragment,t),O=!1},d(t){t&&v(e),t&&v(a),t&&v(r),ut(x),ut(I)}}}function Vs(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 qs extends i{constructor(t){super(),u(this,t,Vs,js,$,{ship_class:0,ship_type:1,cost:2,mass:3})}}function Ls(t){let e,s;return{c(){e=h("img"),this.h()},l(t){e=d(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){_(t,e,s)},d(t){t&&v(e)}}}function Fs(t){let e,s;return{c(){e=h("div"),s=f(t[1]),this.h()},l(n){e=d(n,"DIV",{class:!0});var a=m(e);s=g(a,t[1]),a.forEach(v),this.h()},h(){b(e,"class","thrust svelte-w7le23")},m(t,n){_(t,e,n),w(e,s)},p(t,e){2&e&&tt(s,t[1])},d(t){t&&v(e)}}}function Bs(t){let e,s,n,a,r,c="none"!==t[0]&&Ls(),l=t[1]>0&&Fs(t);return{c(){e=h("div"),c&&c.c(),s=p(),l&&l.c(),n=p(),a=h("img"),this.h()},l(t){e=d(t,"DIV",{class:!0});var r=m(e);c&&c.l(r),s=y(r),l&&l.l(r),n=y(r),a=d(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){_(t,e,r),c&&c.m(e,null),w(e,s),l&&l.m(e,null),w(e,n),w(e,a)},p(t,[a]){"none"!==t[0]?c||(c=Ls(),c.c(),c.m(e,s)):c&&(c.d(1),c=null),t[1]>0?l?l.p(t,a):(l=Fs(t),l.c(),l.m(e,n)):l&&(l.d(1),l=null)},i:x,o:x,d(t){t&&v(e),c&&c.d(),l&&l.d()}}}function Us(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 Hs extends i{constructor(t){super(),u(this,t,Us,Bs,$,{ftl:0,engine:1})}}function zs(t,e,s){const n=t.slice();return n[7]=e[s],n[9]=s,n}function Gs(t,e,s){const n=t.slice();return n[10]=e[s],n[12]=s,n}function Rs(t){let e,s;return{c(){e=h("img"),this.h()},l(t){e=d(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){_(t,e,s)},d(t){t&&v(e)}}}function Ws(t,e){let s,n=e[10]&&Rs();return{key:t,first:null,c(){s=h("div"),n&&n.c(),this.h()},l(t){s=d(t,"DIV",{class:!0});var e=m(s);n&&n.l(e),e.forEach(v),this.h()},h(){b(s,"class","cell svelte-qekx9g"),this.first=s},m(t,e){_(t,s,e),n&&n.m(s,null)},p(t,a){(e=t)[10]?n||(n=Rs(),n.c(),n.m(s,null)):n&&(n.d(1),n=null)},d(t){t&&v(s),n&&n.d()}}}function Ys(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=Gs(e,c,o),s=l(t);r.set(s,a[o]=Ws(s,t))}return{key:t,first:null,c(){s=h("div");for(let t=0;t<a.length;t+=1)a[t].c();n=p(),this.h()},l(t){s=d(t,"DIV",{class:!0});var e=m(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){_(t,s,e);for(let n=0;n<a.length;n+=1)a[n].m(s,null);w(s,n)},p(t,o){e=t,1&o&&(c=e[7],a=$t(a,o,l,1,e,c,r,s,ht,Ws,n,Gs))},d(t){t&&v(s);for(let e=0;e<a.length;e+=1)a[e].d()}}}function Js(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=zs(t,a,c),l=r(e);n.set(l,s[c]=Ys(l,e))}return{c(){e=h("div");for(let t=0;t<s.length;t+=1)s[t].c()},l(t){e=d(t,"DIV",{});var n=m(e);for(let e=0;e<s.length;e+=1)s[e].l(n);n.forEach(v)},m(t,n){_(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=$t(s,c,r,1,t,a,n,e,ht,Ys,null,zs))},i:x,o:x,d(t){t&&v(e);for(let e=0;e<s.length;e+=1)s[e].d()}}}function Zs(t,e){if(e<=1)return[t];let s=t.length/e;return t.length%e&&s++,[t.slice(0,s),...Zs(t.slice(s),e-1)]}function Xs(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=Rt(c/20)),96&t.$$.dirty&&s(5,a=Zs(a,r).map((t=>(t[t.length-1]=!0,t))).flat()),48&t.$$.dirty&&s(0,i=Zs(a,n))},[i,c,l,o,n,a,r]}class Ks extends i{constructor(t){super(),u(this,t,Xs,Js,$,{ship_mass:1,rating:2,advanced:3})}}function Qs(t,e,s){const n=t.slice();return n[1]=e[s],n}function tn(t,e,s){const n=t.slice();return n[4]=e[s],n}function en(t,e){let s;return{key:t,first:null,c(){s=h("div"),this.h()},l(t){s=d(t,"DIV",{class:!0}),m(s).forEach(v),this.h()},h(){b(s,"class","cell svelte-15e5q3d"),this.first=s},m(t,e){_(t,s,e)},p(t,e){},d(t){t&&v(s)}}}function sn(t,e){let s,n,a=[],r=new Map,c=J.range(e[1].rating);const l=t=>t[4];for(let o=0;o<c.length;o+=1){let t=tn(e,c,o),s=l(t);r.set(s,a[o]=en(s))}return{key:t,first:null,c(){s=h("div");for(let t=0;t<a.length;t+=1)a[t].c();n=p(),this.h()},l(t){s=d(t,"DIV",{class:!0});var e=m(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){_(t,s,e);for(let n=0;n<a.length;n+=1)a[n].m(s,null);w(s,n)},p(t,o){e=t,1&o&&(c=J.range(e[1].rating),a=$t(a,o,l,0,e,c,r,s,ht,en,n,tn))},d(t){t&&v(s);for(let e=0;e<a.length;e+=1)a[e].d()}}}function nn(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=Qs(t,a,c),l=r(e);n.set(l,s[c]=sn(l,e))}return{c(){e=h("div");for(let t=0;t<s.length;t+=1)s[t].c();this.h()},l(t){e=d(t,"DIV",{class:!0});var n=m(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){_(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=$t(s,c,r,1,t,a,n,e,ht,sn,null,Qs))},i:x,o:x,d(t){t&&v(e);for(let e=0;e<s.length;e+=1)s[e].d()}}}function an(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 rn extends i{constructor(t){super(),u(this,t,an,nn,$,{armour:0})}}function cn(t){let e,s,n,a,r;return s=new rn({props:{armour:t[0].armour}}),a=new Ks({props:{rating:t[0].hull.rating,advanced:t[0].hull.advanced,ship_mass:t[1]}}),{c(){e=h("div"),rt(s.$$.fragment),n=p(),rt(a.$$.fragment)},l(t){e=d(t,"DIV",{});var r=m(e);ct(s.$$.fragment,r),n=y(r),ct(a.$$.fragment,r),r.forEach(v)},m(t,c){_(t,e,c),lt(s,e,null),w(e,n),lt(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||(ot(s.$$.fragment,t),ot(a.$$.fragment,t),r=!0)},o(t){it(s.$$.fragment,t),it(a.$$.fragment,t),r=!1},d(t){t&&v(e),ut(s),ut(a)}}}function ln(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 on extends i{constructor(t){super(),u(this,t,ln,cn,$,{structure:0,ship_mass:1})}}function un(t){let e,s,n,a;return{c(){e=E("g"),s=E("path"),this.h()},l(t){e=d(t,"g",{transform:!0},1);var n=m(e);s=d(n,"path",{d:!0,class:!0},1),m(s).forEach(v),n.forEach(v),this.h()},h(){b(s,"d",t[1]),b(s,"class","svelte-7q6uh5"),ft(s,"active",t[0]),b(e,"transform",t[2])},m(r,c){_(r,e,c),w(e,s),n||(a=pt(s,"click",t[7]),n=!0)},p(t,[n]){2&n&&b(s,"d",t[1]),1&n&&ft(s,"active",t[0]),4&n&&b(e,"transform",t[2])},i:x,o:x,d(t){t&&v(e),n=!1,a()}}}function $n(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,u;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,u=`rotate(${c[n]},${a},${a})`)},[r,i,u,n,a,l,o,function(e){dt(t,e)}]}class hn extends i{constructor(t){super(),u(this,t,$n,un,$,{arc:3,radius:4,active:0})}}function fn(t,e,s){const n=t.slice();return n[8]=e[s],n}function pn(t,e){let s,n,a;return n=new hn({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=mt(),rt(n.$$.fragment),this.h()},l(t){s=mt(),ct(n.$$.fragment,t),this.h()},h(){this.first=s},m(t,e){_(t,s,e),lt(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||(ot(n.$$.fragment,t),a=!0)},o(t){it(n.$$.fragment,t),a=!1},d(t){t&&v(s),ut(n,t)}}}function dn(t){let e,s,n,a,r,c,l=[],o=new Map,i=t[2];const u=t=>t[8];for(let f=0;f<i.length;f+=1){let e=fn(t,i,f),s=u(e);o.set(s,l[f]=pn(s,e))}const $=t[5].default,h=gt($,t,t[4],null);return{c(){e=E("svg");for(let t=0;t<l.length;t+=1)l[t].c();s=E("circle"),h&&h.c(),this.h()},l(t){e=d(t,"svg",{width:!0,height:!0},1);var n=m(e);for(let e=0;e<l.length;e+=1)l[e].l(n);s=d(n,"circle",{cx:!0,cy:!0,r:!0,class:!0},1),m(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){_(t,e,n);for(let s=0;s<l.length;s+=1)l[s].m(e,null);w(e,s),h&&h.m(e,null),c=!0},p(t,[f]){15&f&&(i=t[2],vt(),l=$t(l,f,u,1,t,i,o,e,yt,pn,s,fn),bt()),(!c||2&f&&n!==(n=t[1]/3))&&b(s,"r",n),h&&h.p&&(!c||16&f)&&_t(h,$,t,t[4],f,null,null),(!c||2&f&&a!==(a=t[1]+"px"))&&b(e,"width",a),(!c||2&f&&r!==(r=t[1]+"px"))&&b(e,"height",r)},i(t){if(!c){for(let t=0;t<i.length;t+=1)ot(l[t]);ot(h,t),c=!0}},o(t){for(let e=0;e<l.length;e+=1)it(l[e]);it(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 mn(t,e,s){let{$$slots:n={},$$scope:a}=e;let{selected:r=[]}=e,{size:c=60}=e;const l=at(),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 gn extends i{constructor(t){super(),u(this,t,mn,dn,$,{selected:0,size:1})}}function vn(t){let e,s;return{c(){e=E("text"),s=f(t[0]),this.h()},l(n){e=d(n,"text",{x:!0,y:!0,class:!0},1);var a=m(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){_(t,e,n),w(e,s)},p(t,e){1&e&&tt(s,t[0])},d(t){t&&v(e)}}}function yn(t){let e,s,n;return s=new gn({props:{selected:t[1],size:"40",$$slots:{default:[vn]},$$scope:{ctx:t}}}),{c(){e=h("div"),rt(s.$$.fragment),this.h()},l(t){e=d(t,"DIV",{class:!0});var n=m(e);ct(s.$$.fragment,n),n.forEach(v),this.h()},h(){b(e,"class","svelte-1u8rlr5")},m(t,a){_(t,e,a),lt(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||(ot(s.$$.fragment,t),n=!0)},o(t){it(s.$$.fragment,t),n=!1},d(t){t&&v(e),ut(s)}}}function bn(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 _n extends i{constructor(t){super(),u(this,t,bn,yn,$,{weapon_class:0,arcs:1})}}function wn(t,e,s){const n=t.slice();return n[2]=e[s],n}function xn(t){let e,s;const n=[t[2]];let a={};for(let r=0;r<n.length;r+=1)a=It(a,n[r]);return e=new _n({props:a}),{c(){rt(e.$$.fragment)},l(t){ct(e.$$.fragment,t)},m(t,n){lt(e,t,n),s=!0},p(t,s){const a=1&s?wt(n,[xt(t[2])]):{};e.$set(a)},i(t){s||(ot(e.$$.fragment,t),s=!0)},o(t){it(e.$$.fragment,t),s=!1},d(t){ut(e,t)}}}function En(t){let e,s,n,a=t[0],r=[];for(let l=0;l<a.length;l+=1)r[l]=xn(wn(t,a,l));const c=t=>it(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=d(t,"DIV",{class:!0});var n=m(e);s=d(n,"DIV",{class:!0});var a=m(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){_(t,e,a),w(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=wn(t,a,n);r[n]?(r[n].p(c,e),ot(r[n],1)):(r[n]=xn(c),r[n].c(),ot(r[n],1),r[n].m(s,null))}for(vt(),n=a.length;n<r.length;n+=1)c(n);bt()}},i(t){if(!n){for(let t=0;t<a.length;t+=1)ot(r[t]);n=!0}},o(t){r=r.filter(Boolean);for(let e=0;e<r.length;e+=1)it(r[e]);n=!1},d(t){t&&v(e),Et(r,t)}}}function In(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 On extends i{constructor(t){super(),u(this,t,In,En,$,{weapons:1})}}function kn(t,e,s){const n=t.slice();return n[1]=e[s],n}function Dn(t){let e,s;return{c(){e=h("img"),this.h()},l(t){e=d(t,"IMG",{class:!0,src:!0,alt:!0}),this.h()},h(){b(e,"class","firecon svelte-d2fjdl"),e.src!==(s="icons/firecon.svg")&&b(e,"src","icons/firecon.svg"),b(e,"alt","firecon")},m(t,s){_(t,e,s)},d(t){t&&v(e)}}}function Mn(t){let e,s=J.range(t[0]),n=[];for(let a=0;a<s.length;a+=1)n[a]=Dn(kn(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=d(t,"DIV",{class:!0});var s=m(e);for(let e=0;e<n.length;e+=1)n[e].l(s);s.forEach(v),this.h()},h(){b(e,"class","svelte-d2fjdl")},m(t,s){_(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=J.range(t[0]),r=a;r<s.length;r+=1)kn(t,s,r),n[r]||(n[r]=Dn(),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:x,o:x,d(t){t&&v(e),Et(n,t)}}}function An(t,e,s){let{firecons:n=0}=e;return t.$$set=t=>{"firecons"in t&&s(0,n=t.firecons)},[n]}class Pn extends i{constructor(t){super(),u(this,t,An,Mn,$,{firecons:0})}}function Tn(t,e,s){const n=t.slice();return n[2]=e[s],n}function Cn(t,e,s){const n=t.slice();return n[2]=e[s],n}function Sn(t){let e,s;return{c(){e=h("img"),this.h()},l(t){e=d(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){_(t,e,s)},d(t){t&&v(e)}}}function Nn(t){let e,s;return{c(){e=h("img"),this.h()},l(t){e=d(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){_(t,e,s)},d(t){t&&v(e)}}}function jn(t){let e,s,n=J.range(t[0]),a=[];for(let l=0;l<n.length;l+=1)a[l]=Sn(Cn(t,n,l));let r=J.range(t[1]),c=[];for(let l=0;l<r.length;l+=1)c[l]=Nn(Tn(t,r,l));return{c(){e=h("div");for(let t=0;t<a.length;t+=1)a[t].c();s=p();for(let t=0;t<c.length;t+=1)c[t].c();this.h()},l(t){e=d(t,"DIV",{class:!0});var n=m(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){_(t,e,n);for(let s=0;s<a.length;s+=1)a[s].m(e,null);w(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=J.range(t[0]),c=r;c<n.length;c+=1)Cn(t,n,c),a[c]||(a[c]=Sn(),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=J.range(t[1]),n=s;n<r.length;n+=1)Tn(t,r,n),c[n]||(c[n]=Nn(),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:x,o:x,d(t){t&&v(e),Et(a,t),Et(c,t)}}}function Vn(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 qn extends i{constructor(t){super(),u(this,t,Vn,jn,$,{standard:0,advanced:1})}}function Ln(t){let e,s,n,a,r;s=new Pn({props:{firecons:t[0]}});const c=[t[1]];let l={};for(let o=0;o<c.length;o+=1)l=It(l,c[o]);return a=new qn({props:l}),{c(){e=h("div"),rt(s.$$.fragment),n=p(),rt(a.$$.fragment),this.h()},l(t){e=d(t,"DIV",{class:!0});var r=m(e);ct(s.$$.fragment,r),n=y(r),ct(a.$$.fragment,r),r.forEach(v),this.h()},h(){b(e,"class","svelte-ytgy37")},m(t,c){_(t,e,c),lt(s,e,null),w(e,n),lt(a,e,null),r=!0},p(t,[e]){const n={};1&e&&(n.firecons=t[0]),s.$set(n);const r=2&e?wt(c,[xt(t[1])]):{};a.$set(r)},i(t){r||(ot(s.$$.fragment,t),ot(a.$$.fragment,t),r=!0)},o(t){it(s.$$.fragment,t),it(a.$$.fragment,t),r=!1},d(t){t&&v(e),ut(s),ut(a)}}}function Fn(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 Bn extends i{constructor(t){super(),u(this,t,Fn,Ln,$,{firecons:0,screens:1})}}function Un(t){let e,s,n,a,r,c,l,o,i,u,$,f,g;const x=[t[0].general];let E={};for(let h=0;h<x.length;h+=1)E=It(E,x[h]);return s=new qs({props:E}),a=new On({props:{weapons:t[0].weaponry.weapons}}),l=new on({props:{structure:t[0].structure,ship_mass:t[0].general.mass}}),i=new Bn({props:{firecons:t[0].weaponry.firecons.nbr,screens:t[0].structure.screens}}),$=new Hs({props:{ftl:t[0].ftl.type,engine:t[0].engine.rating}}),{c(){e=h("aside"),rt(s.$$.fragment),n=p(),rt(a.$$.fragment),r=p(),c=h("div"),rt(l.$$.fragment),o=p(),rt(i.$$.fragment),u=p(),rt($.$$.fragment),this.h()},l(t){e=d(t,"ASIDE",{class:!0});var h=m(e);ct(s.$$.fragment,h),n=y(h),ct(a.$$.fragment,h),r=y(h),c=d(h,"DIV",{class:!0});var f=m(c);ct(l.$$.fragment,f),o=y(f),ct(i.$$.fragment,f),f.forEach(v),u=y(h),ct($.$$.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){_(t,e,h),lt(s,e,null),w(e,n),lt(a,e,null),w(e,r),w(e,c),lt(l,c,null),w(c,o),lt(i,c,null),w(e,u),lt($,e,null),g=!0},p(t,[e]){const n=1&e?wt(x,[xt(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 u={};1&e&&(u.ftl=t[0].ftl.type),1&e&&(u.engine=t[0].engine.rating),$.$set(u)},i(t){g||(ot(s.$$.fragment,t),ot(a.$$.fragment,t),ot(l.$$.fragment,t),ot(i.$$.fragment,t),ot($.$$.fragment,t),et((()=>{f||(f=st(e,nt,{},!0)),f.run(1)})),g=!0)},o(t){it(s.$$.fragment,t),it(a.$$.fragment,t),it(l.$$.fragment,t),it(i.$$.fragment,t),it($.$$.fragment,t),f||(f=st(e,nt,{},!1)),f.run(0),g=!1},d(t){t&&v(e),ut(s),ut(a),ut(l),ut(i),ut($),t&&f&&f.end()}}}function Hn(t,e,s){let{ship:n}=e;return t.$$set=t=>{"ship"in t&&s(0,n=t.ship)},[n]}class zn extends i{constructor(t){super(),u(this,t,Hn,Un,$,{ship:0})}}function Gn(t){let e,s;return{c(){e=h("label"),s=f(t[0]),this.h()},l(n){e=d(n,"LABEL",{class:!0});var a=m(e);s=g(a,t[0]),a.forEach(v),this.h()},h(){b(e,"class","svelte-1urp5hr")},m(t,n){_(t,e,n),w(e,s)},p(t,e){1&e&&tt(s,t[0])},d(t){t&&v(e)}}}function Rn(t){let e,s,n,a=t[0]&&Gn(t);const r=t[4].default,c=gt(r,t,t[3],null),l=c||function(t){let e,s,n;return{c(){e=h("input"),this.h()},l(t){e=d(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){_(a,e,r),s||(n=pt(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=p(),l&&l.c(),this.h()},l(t){e=d(t,"DIV",{class:!0});var n=m(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){_(t,e,r),a&&a.m(e,null),w(e,s),l&&l.m(e,null),n=!0},p(t,[o]){t[0]?a?a.p(t,o):(a=Gn(t),a.c(),a.m(e,s)):a&&(a.d(1),a=null),c?c.p&&(!n||8&o)&&_t(c,r,t,t[3],o,null,null):l&&l.p&&6&o&&l.p(t,o)},i(t){n||(ot(l,t),n=!0)},o(t){it(l,t),n=!1},d(t){t&&v(e),a&&a.d(),l&&l.d(t)}}}function Wn(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){dt(t,e)}]}class Yn extends i{constructor(t){super(),u(this,t,Wn,Rn,$,{label:0,value:1,placeholder:2})}}function Jn(t,e,s){const n=t.slice();return n[7]=e[s],n}function Zn(t,e){let s,n,a,r=e[7]+"";return{key:t,first:null,c(){s=h("option"),n=f(r),this.h()},l(t){s=d(t,"OPTION",{value:!0});var e=m(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){_(t,s,e),w(s,n)},p(t,c){e=t,8&c&&r!==(r=e[7]+"")&&tt(n,r),8&c&&a!==(a=e[7])&&(s.__value=a,s.value=s.__value)},d(t){t&&v(s)}}}function Xn(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=Jn(t,c,o),s=l(e);r.set(s,a[o]=Zn(s,e))}return{c(){e=h("select");for(let t=0;t<a.length;t+=1)a[t].c()},l(t){e=d(t,"SELECT",{value:!0});var s=m(e);for(let e=0;e<a.length;e+=1)a[e].l(s);s.forEach(v)},m(r,c){_(r,e,c);for(let t=0;t<a.length;t+=1)a[t].m(e,null);Dt(e,t[2]),s||(n=pt(e,"change",t[5]),s=!0)},p(t,s){8&s&&(c=t[3],a=$t(a,s,l,1,t,c,r,e,ht,Zn,null,Jn)),12&s&&Dt(e,t[2])},d(t){t&&v(e);for(let e=0;e<a.length;e+=1)a[e].d();s=!1,n()}}}function Kn(t){let e,s,n,a,r;return s=new Yn({props:{label:"ship class",value:t[1].ship_class}}),s.$on("change",t[4]),a=new Yn({props:{label:"ship type",$$slots:{default:[Xn]},$$scope:{ctx:t}}}),{c(){e=h("div"),rt(s.$$.fragment),n=p(),rt(a.$$.fragment),this.h()},l(t){e=d(t,"DIV",{class:!0});var r=m(e);ct(s.$$.fragment,r),n=y(r),ct(a.$$.fragment,r),r.forEach(v),this.h()},h(){b(e,"class","svelte-fc2507")},m(t,c){_(t,e,c),lt(s,e,null),w(e,n),lt(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||(ot(s.$$.fragment,t),ot(a.$$.fragment,t),r=!0)},o(t){it(s.$$.fragment,t),it(a.$$.fragment,t),r=!1},d(t){t&&v(e),ut(s),ut(a)}}}function Qn(t,e,s){let n,a=x,r=()=>(a(),a=kt(l,(t=>s(6,n=t))),l);t.$$.on_destroy.push((()=>a()));let c,{ship:l=Ot("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=Je(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 ta extends i{constructor(t){super(),u(this,t,Qn,Kn,$,{ship:0})}}function ea(t){let e,s,n=-t[1]+"";return{c(){e=f("excessive mass: "),s=f(n)},l(t){e=g(t,"excessive mass: "),s=g(t,n)},m(t,n){_(t,e,n),_(t,s,n)},p(t,e){2&e&&n!==(n=-t[1]+"")&&tt(s,n)},d(t){t&&v(e),t&&v(s)}}}function sa(t){let e,s;return{c(){e=f("mass unused: "),s=f(t[1])},l(n){e=g(n,"mass unused: "),s=g(n,t[1])},m(t,n){_(t,e,n),_(t,s,n)},p(t,e){2&e&&tt(s,t[1])},d(t){t&&v(e),t&&v(s)}}}function na(t){let e,s,n,a,r,c,l,o;function i(t,e){return t[3]?sa:ea}let u=i(t),$=u(t);return{c(){e=h("input"),n=p(),a=h("span"),r=p(),c=h("div"),$.c(),this.h()},l(t){e=d(t,"INPUT",{value:!0,type:!0,min:!0,max:!0,class:!0}),n=y(t),a=d(t,"SPAN",{class:!0}),m(a).forEach(v),r=y(t),c=d(t,"DIV",{class:!0});var s=m(c);$.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-1lxxcoi"),b(a,"class","mass_symbol svelte-1lxxcoi"),b(c,"class","note svelte-1lxxcoi"),ft(c,"warning",!t[3])},m(s,i){_(s,e,i),_(s,n,i),_(s,a,i),_(s,r,i),_(s,c,i),$.m(c,null),l||(o=pt(e,"change",t[4]),l=!0)},p(t,n){4&n&&s!==(s=t[2].general.mass)&&(e.value=s),u===(u=i(t))&&$?$.p(t,n):($.d(1),$=u(t),$&&($.c(),$.m(c,null))),8&n&&ft(c,"warning",!t[3])},d(t){t&&v(e),t&&v(n),t&&v(a),t&&v(r),t&&v(c),$.d(),l=!1,o()}}}function aa(t){let e,s,n=t[2].general.cost+"";return{c(){e=h("span"),s=f(n),this.h()},l(t){e=d(t,"SPAN",{class:!0});var a=m(e);s=g(a,n),a.forEach(v),this.h()},h(){b(e,"class","cost svelte-1lxxcoi")},m(t,n){_(t,e,n),w(e,s)},p(t,e){4&e&&n!==(n=t[2].general.cost+"")&&tt(s,n)},d(t){t&&v(e)}}}function ra(t){let e,s,n,a,r,c;return s=new Yn({props:{label:"ship tonnage",$$slots:{default:[na]},$$scope:{ctx:t}}}),r=new Yn({props:{label:"cost",$$slots:{default:[aa]},$$scope:{ctx:t}}}),{c(){e=h("div"),rt(s.$$.fragment),n=p(),a=h("div"),rt(r.$$.fragment),this.h()},l(t){e=d(t,"DIV",{class:!0});var c=m(e);ct(s.$$.fragment,c),c.forEach(v),n=y(t),a=d(t,"DIV",{class:!0});var l=m(a);ct(r.$$.fragment,l),l.forEach(v),this.h()},h(){b(e,"class","mass svelte-1lxxcoi"),b(a,"class","cost svelte-1lxxcoi")},m(t,l){_(t,e,l),lt(s,e,null),_(t,n,l),_(t,a,l),lt(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||(ot(s.$$.fragment,t),ot(r.$$.fragment,t),c=!0)},o(t){it(s.$$.fragment,t),it(r.$$.fragment,t),c=!1},d(t){t&&v(e),ut(s),t&&v(n),t&&v(a),ut(r)}}}function ca(t,e,s){let n,a=x,r=()=>(a(),a=kt(c,(t=>s(2,n=t))),c);t.$$.on_destroy.push((()=>a()));let{ship:c=Ot("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 la extends i{constructor(t){super(),u(this,t,ca,ra,$,{ship:0})}}function oa(t){let e,s,n,a;return e=new ta({}),n=new la({}),{c(){rt(e.$$.fragment),s=p(),rt(n.$$.fragment)},l(t){ct(e.$$.fragment,t),s=y(t),ct(n.$$.fragment,t)},m(t,r){lt(e,t,r),_(t,s,r),lt(n,t,r),a=!0},p:x,i(t){a||(ot(e.$$.fragment,t),ot(n.$$.fragment,t),a=!0)},o(t){it(e.$$.fragment,t),it(n.$$.fragment,t),a=!1},d(t){ut(e,t),t&&v(s),ut(n,t)}}}class ia extends i{constructor(t){super(),u(this,t,null,oa,$,{})}}function ua(t){let e,s,n,a,r,c,l,o,i,u,$,E,I,O,k,D,M,A,P,T,C,S,N,j,V,q,L,F,B,U,H,z,G;return{c(){e=h("aside"),s=h("div"),n=h("input"),a=p(),r=h("h3"),c=f("welcome to the docks"),l=p(),o=h("p"),i=f("This app is a ship builder for the game\n "),u=h("a"),$=f("Full Thrust"),E=f("\n ."),I=p(),O=h("p"),k=f("The app, beside any exception mentioned here, is trying to follow the\n "),D=h("a"),M=f("Cross Dimensions rules"),A=f("\n as closely as possible."),P=p(),T=h("p"),C=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."),S=p(),N=h("p"),j=f("Written by\n "),V=h("a"),q=f("Yanick Champoux"),L=f("\n . Code available on\n "),F=h("a"),B=f("Github"),this.h()},l(t){e=d(t,"ASIDE",{class:!0});var h=m(e);s=d(h,"DIV",{class:!0});var f=m(s);n=d(f,"INPUT",{type:!0,class:!0,value:!0}),f.forEach(v),a=y(h),r=d(h,"H3",{class:!0});var p=m(r);c=g(p,"welcome to the docks"),p.forEach(v),l=y(h),o=d(h,"P",{});var b=m(o);i=g(b,"This app is a ship builder for the game\n "),u=d(b,"A",{href:!0});var _=m(u);$=g(_,"Full Thrust"),_.forEach(v),E=g(b,"\n ."),b.forEach(v),I=y(h),O=d(h,"P",{});var w=m(O);k=g(w,"The app, beside any exception mentioned here, is trying to follow the\n "),D=d(w,"A",{href:!0});var x=m(D);M=g(x,"Cross Dimensions rules"),x.forEach(v),A=g(w,"\n as closely as possible."),w.forEach(v),P=y(h),T=d(h,"P",{});var U=m(T);C=g(U,"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."),U.forEach(v),S=y(h),N=d(h,"P",{});var H=m(N);j=g(H,"Written by\n "),V=d(H,"A",{href:!0});var z=m(V);q=g(z,"Yanick Champoux"),z.forEach(v),L=g(H,"\n . Code available on\n "),F=d(H,"A",{href:!0});var G=m(F);B=g(G,"Github"),G.forEach(v),H.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(u,"href","https://shop.groundzerogames.co.uk/rules.html"),b(D,"href","http://members.ozemail.com.au/~laranzu/fullthrust/rules/"),b(V,"href","https://twitter.com/yenzie"),b(F,"href","https://github.com/yanick/aotds-shipyard"),b(e,"class","svelte-16mfw8u")},m(h,f){_(h,e,f),w(e,s),w(s,n),w(e,a),w(e,r),w(r,c),w(e,l),w(e,o),w(o,i),w(o,u),w(u,$),w(o,E),w(e,I),w(e,O),w(O,k),w(O,D),w(D,M),w(O,A),w(e,P),w(e,T),w(T,C),w(e,S),w(e,N),w(N,j),w(N,V),w(V,q),w(N,L),w(N,F),w(F,B),H=!0,z||(G=pt(n,"click",t[0]),z=!0)},p:x,i(t){H||(et((()=>{U||(U=st(e,Mt,{x:-800,opacity:1},!0)),U.run(1)})),H=!0)},o(t){U||(U=st(e,Mt,{x:-800,opacity:1},!1)),U.run(0),H=!1},d(t){t&&v(e),t&&U&&U.end(),z=!1,G()}}}function $a(t){const e=at();return[()=>e("close")]}class ha extends i{constructor(t){super(),u(this,t,$a,ua,$,{})}}function fa(t){let e,s,n,a,r,c,l,o;const i=t[5].default,u=gt(i,t,t[4],null);return{c(){e=h("div"),u&&u.c(),s=p(),n=h("div"),a=f(t[0]),r=p(),c=h("div"),l=f(t[1]),this.h()},l(o){e=d(o,"DIV",{class:!0});var i=m(e);u&&u.l(i),i.forEach(v),s=y(o),n=d(o,"DIV",{class:!0});var $=m(n);a=g($,t[0]),$.forEach(v),r=y(o),c=d(o,"DIV",{class:!0});var h=m(c);l=g(h,t[1]),h.forEach(v),this.h()},h(){b(e,"class","svelte-cpog4c"),b(n,"class","mass svelte-cpog4c"),b(c,"class","cost svelte-cpog4c")},m(i,$){_(i,e,$),u&&u.m(e,null),_(i,s,$),_(i,n,$),w(n,a),t[6](n),_(i,r,$),_(i,c,$),w(c,l),t[7](c),o=!0},p(t,[e]){u&&u.p&&(!o||16&e)&&_t(u,i,t,t[4],e,null,null),(!o||1&e)&&tt(a,t[0]),(!o||2&e)&&tt(l,t[1])},i(t){o||(ot(u,t),o=!0)},o(t){it(u,t),o=!1},d(a){a&&v(e),u&&u.d(a),a&&v(s),a&&v(n),t[6](null),a&&v(r),a&&v(c),t[7](null)}}}function pa(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){At[t?"unshift":"push"]((()=>{n=t,s(2,n)}))},function(t){At[t?"unshift":"push"]((()=>{a=t,s(3,a)}))}]}class da extends i{constructor(t){super(),u(this,t,pa,fa,$,{mass:0,cost:1})}}function ma(t){let e,s,n,a,r,c,l;const o=t[2].default,i=gt(o,t,t[1],null);return{c(){e=h("div"),s=h("h2"),n=f(t[0]),a=p(),r=h("hr"),c=p(),i&&i.c(),this.h()},l(l){e=d(l,"DIV",{class:!0});var o=m(e);s=d(o,"H2",{class:!0});var u=m(s);n=g(u,t[0]),u.forEach(v),a=y(o),r=d(o,"HR",{class:!0}),o.forEach(v),c=y(l),i&&i.l(l),this.h()},h(){b(s,"class","svelte-h4qygo"),b(r,"class","svelte-h4qygo"),b(e,"class","svelte-h4qygo")},m(t,o){_(t,e,o),w(e,s),w(s,n),w(e,a),w(e,r),_(t,c,o),i&&i.m(t,o),l=!0},p(t,[e]){(!l||1&e)&&tt(n,t[0]),i&&i.p&&(!l||2&e)&&_t(i,o,t,t[1],e,null,null)},i(t){l||(ot(i,t),l=!0)},o(t){it(i,t),l=!1},d(t){t&&v(e),t&&v(c),i&&i.d(t)}}}function ga(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 va extends i{constructor(t){super(),u(this,t,ga,ma,$,{label:0})}}function ya(t){let e,s,n;return{c(){e=h("input"),this.h()},l(t){e=d(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){_(a,e,r),Tt(e,t[0]),s||(n=pt(e,"input",t[4]),s=!0)},p(t,s){1&s&&Pt(e.value)!==t[0]&&Tt(e,t[0])},d(t){t&&v(e),s=!1,n()}}}function ba(t){let e,s,n;return{c(){e=h("input"),this.h()},l(t){e=d(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){_(a,e,r),Tt(e,t[1]),s||(n=pt(e,"input",t[5]),s=!0)},p(t,s){2&s&&Pt(e.value)!==t[1]&&Tt(e,t[1])},d(t){t&&v(e),s=!1,n()}}}function _a(t){let e,s,n,a,r;return s=new Yn({props:{label:"screens",$$slots:{default:[ya]},$$scope:{ctx:t}}}),a=new Yn({props:{label:"advanced screens",$$slots:{default:[ba]},$$scope:{ctx:t}}}),{c(){e=h("div"),rt(s.$$.fragment),n=p(),rt(a.$$.fragment),this.h()},l(t){e=d(t,"DIV",{class:!0});var r=m(e);ct(s.$$.fragment,r),n=y(r),ct(a.$$.fragment,r),r.forEach(v),this.h()},h(){b(e,"class","svelte-11x6jvv")},m(t,c){_(t,e,c),lt(s,e,null),w(e,n),lt(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||(ot(s.$$.fragment,t),ot(a.$$.fragment,t),r=!0)},o(t){it(s.$$.fragment,t),it(a.$$.fragment,t),r=!1},d(t){t&&v(e),ut(s),ut(a)}}}function wa(t){let e,s;return e=new da({props:{cost:t[2],mass:t[3],$$slots:{default:[_a]},$$scope:{ctx:t}}}),{c(){rt(e.$$.fragment)},l(t){ct(e.$$.fragment,t)},m(t,n){lt(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||(ot(e.$$.fragment,t),s=!0)},o(t){it(e.$$.fragment,t),s=!1},d(t){ut(e,t)}}}function xa(t,e,s){let{cost:n=0}=e,{mass:a=0}=e,{standard:r=0}=e,{advanced:c=0}=e;const l=at();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=Pt(this.value),s(0,r)},function(){c=Pt(this.value),s(1,c)}]}class Ea extends i{constructor(t){super(),u(this,t,xa,wa,$,{cost:2,mass:3,standard:0,advanced:1})}}function Ia(t){let e,s,n;return{c(){e=h("input"),this.h()},l(t){e=d(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){_(a,e,r),Tt(e,t[0]),s||(n=pt(e,"input",t[2]),s=!0)},p(t,s){1&s&&Pt(e.value)!==t[0]&&Tt(e,t[0])},d(t){t&&v(e),s=!1,n()}}}function Oa(t){let e,s;return e=new Yn({props:{label:`layer ${t[1]}`,$$slots:{default:[Ia]},$$scope:{ctx:t}}}),{c(){rt(e.$$.fragment)},l(t){ct(e.$$.fragment,t)},m(t,n){lt(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||(ot(e.$$.fragment,t),s=!0)},o(t){it(e.$$.fragment,t),s=!1},d(t){ut(e,t)}}}function ka(t,e,s){let{layer:n=1}=e,{rating:a=0}=e;const r=Ot("ship");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&&(null==r||r.dispatch_action("set_armour_layer",{layer:n,rating:a}))},[a,n,function(){a=Pt(this.value),s(0,a)}]}class Da extends i{constructor(t){super(),u(this,t,ka,Oa,$,{layer:1,rating:0})}}function Ma(t,e,s){const n=t.slice();return n[7]=e[s],n}function Aa(t){let e,s,n;return{c(){e=h("input"),this.h()},l(t){e=d(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){_(a,e,r),Tt(e,t[3]),s||(n=pt(e,"input",t[4]),s=!0)},p(t,s){8&s&&Pt(e.value)!==t[3]&&Tt(e,t[3])},d(t){t&&v(e),s=!1,n()}}}function Pa(t,e){let s,n,a;const r=[e[7]];let c={};for(let l=0;l<r.length;l+=1)c=It(c,r[l]);return n=new Da({props:c}),n.$on("ship_change",e[5]),{key:t,first:null,c(){s=mt(),rt(n.$$.fragment),this.h()},l(t){s=mt(),ct(n.$$.fragment,t),this.h()},h(){this.first=s},m(t,e){_(t,s,e),lt(n,t,e),a=!0},p(t,s){e=t;const a=4&s?wt(r,[xt(e[7])]):{};n.$set(a)},i(t){a||(ot(n.$$.fragment,t),a=!0)},o(t){it(n.$$.fragment,t),a=!1},d(t){t&&v(s),ut(n,t)}}}function Ta(t){let e,s,n,a,r,c,l=[],o=new Map;n=new Yn({props:{label:"armour layers",$$slots:{default:[Aa]},$$scope:{ctx:t}}});let i=t[2];const u=t=>t[7].layer;for(let $=0;$<i.length;$+=1){let e=Ma(t,i,$),s=u(e);o.set(s,l[$]=Pa(s,e))}return{c(){e=h("div"),s=h("div"),rt(n.$$.fragment),a=p(),r=h("div");for(let t=0;t<l.length;t+=1)l[t].c();this.h()},l(t){e=d(t,"DIV",{});var c=m(e);s=d(c,"DIV",{class:!0});var o=m(s);ct(n.$$.fragment,o),o.forEach(v),a=y(c),r=d(c,"DIV",{class:!0});var i=m(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){_(t,e,o),w(e,s),lt(n,s,null),w(e,a),w(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],vt(),l=$t(l,e,u,1,t,i,o,r,yt,Pa,null,Ma),bt())},i(t){if(!c){ot(n.$$.fragment,t);for(let t=0;t<i.length;t+=1)ot(l[t]);c=!0}},o(t){it(n.$$.fragment,t);for(let e=0;e<l.length;e+=1)it(l[e]);c=!1},d(t){t&&v(e),ut(n);for(let e=0;e<l.length;e+=1)l[e].d()}}}function Ca(t){let e,s;return e=new da({props:{cost:t[0],mass:t[1],$$slots:{default:[Ta]},$$scope:{ctx:t}}}),{c(){rt(e.$$.fragment)},l(t){ct(e.$$.fragment,t)},m(t,n){lt(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||(ot(e.$$.fragment,t),s=!0)},o(t){it(e.$$.fragment,t),s=!1},d(t){ut(e,t)}}}function Sa(t,e,s){let{armour:n=[]}=e,{cost:a=0}=e,{mass:r=0}=e,c=n.length;const l=at();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=J.sum(J.map(n,"cost"))),4&t.$$.dirty&&s(1,r=J.sum(J.map(n,"mass"))),8&t.$$.dirty&&l("ship_change",ss.actions.set_armour_nbr_layers(c))},[a,r,n,c,function(){c=Pt(this.value),s(3,c)},function(e){dt(t,e)}]}class Na extends i{constructor(t){super(),u(this,t,Sa,Ca,$,{armour:2,cost:0,mass:1})}}function ja(t){let e,s,n;return{c(){e=h("input"),this.h()},l(t){e=d(t,"INPUT",{type:!0,min:!0,class:!0}),this.h()},h(){b(e,"type","number"),b(e,"min","0"),b(e,"class","svelte-1060pqd")},m(a,r){_(a,e,r),Tt(e,t[0]),s||(n=pt(e,"input",t[4]),s=!0)},p(t,s){1&s&&Pt(e.value)!==t[0]&&Tt(e,t[0])},d(t){t&&v(e),s=!1,n()}}}function Va(t){let e,s;return e=new Yn({props:{label:"cargo",$$slots:{default:[ja]},$$scope:{ctx:t}}}),{c(){rt(e.$$.fragment)},l(t){ct(e.$$.fragment,t)},m(t,n){lt(e,t,n),s=!0},p(t,s){const n={};33&s&&(n.$$scope={dirty:s,ctx:t}),e.$set(n)},i(t){s||(ot(e.$$.fragment,t),s=!0)},o(t){it(e.$$.fragment,t),s=!1},d(t){ut(e,t)}}}function qa(t){let e,s;return e=new da({props:{cost:t[1],mass:t[2],$$slots:{default:[Va]},$$scope:{ctx:t}}}),{c(){rt(e.$$.fragment)},l(t){ct(e.$$.fragment,t)},m(t,n){lt(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||(ot(e.$$.fragment,t),s=!0)},o(t){it(e.$$.fragment,t),s=!1},d(t){ut(e,t)}}}function La(t,e,s){let{ship:n=Ot("ship")}=e,{space:a=0}=e,{cost:r=0}=e,{mass:c=0}=e;return t.$$set=t=>{"ship"in t&&s(3,n=t.ship),"space"in t&&s(0,a=t.space),"cost"in t&&s(1,r=t.cost),"mass"in t&&s(2,c=t.mass)},t.$$.update=()=>{9&t.$$.dirty&&(null==n||n.dispatch_action("set_cargo",a))},[a,r,c,n,function(){a=Pt(this.value),s(0,a)}]}class Fa extends i{constructor(t){super(),u(this,t,La,qa,$,{ship:3,space:0,cost:1,mass:2})}}function Ba(t){let e,s,n,a,r,c,l,o,i,u,$,x,E,I;return{c(){e=h("div"),s=h("label"),n=h("input"),a=f("\n none"),r=p(),c=h("label"),l=h("input"),o=f("\n partial"),i=p(),u=h("label"),$=h("input"),x=f("\n full"),this.h()},l(t){e=d(t,"DIV",{class:!0});var h=m(e);s=d(h,"LABEL",{class:!0});var f=m(s);n=d(f,"INPUT",{type:!0,value:!0}),a=g(f,"\n none"),f.forEach(v),r=y(h),c=d(h,"LABEL",{class:!0});var p=m(c);l=d(p,"INPUT",{type:!0,value:!0}),o=g(p,"\n partial"),p.forEach(v),i=y(h),u=d(h,"LABEL",{class:!0});var b=m(u);$=d(b,"INPUT",{type:!0,value:!0}),x=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($,"type","radio"),$.__value="full",$.value=$.__value,t[5][0].push($),b(u,"class","svelte-6w28yb"),b(e,"class","svelte-6w28yb")},m(h,f){_(h,e,f),w(e,s),w(s,n),n.checked=n.__value===t[0],w(s,a),w(e,r),w(e,c),w(c,l),l.checked=l.__value===t[0],w(c,o),w(e,i),w(e,u),w(u,$),$.checked=$.__value===t[0],w(u,x),E||(I=[pt(n,"change",t[4]),pt(l,"change",t[6]),pt($,"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&&($.checked=$.__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($),1),E=!1,Ct(I)}}}function Ua(t){let e,s;return e=new Yn({props:{label:"streamlining",$$slots:{default:[Ba]},$$scope:{ctx:t}}}),{c(){rt(e.$$.fragment)},l(t){ct(e.$$.fragment,t)},m(t,n){lt(e,t,n),s=!0},p(t,s){const n={};257&s&&(n.$$scope={dirty:s,ctx:t}),e.$set(n)},i(t){s||(ot(e.$$.fragment,t),s=!0)},o(t){it(e.$$.fragment,t),s=!1},d(t){ut(e,t)}}}function Ha(t){let e,s;return e=new da({props:{cost:t[1],mass:t[2],$$slots:{default:[Ua]},$$scope:{ctx:t}}}),{c(){rt(e.$$.fragment)},l(t){ct(e.$$.fragment,t)},m(t,n){lt(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||(ot(e.$$.fragment,t),s=!0)},o(t){it(e.$$.fragment,t),s=!1},d(t){ut(e,t)}}}function za(t,e,s){let{type:n="none"}=e,{cost:a=0}=e,{mass:r=0}=e,{ship:c=Ot("ship")}=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"in t&&s(3,c=t.ship)},t.$$.update=()=>{9&t.$$.dirty&&(null==c||c.dispatch_action("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 Ga extends i{constructor(t){super(),u(this,t,za,Ha,$,{type:0,cost:1,mass:2,ship:3})}}function Ra(t){let e,s,n;return{c(){e=h("input"),this.h()},l(t){e=d(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){_(a,e,r),Tt(e,t[0]),s||(n=pt(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&&Pt(e.value)!==t[0]&&Tt(e,t[0])},d(t){t&&v(e),s=!1,n()}}}function Wa(t){let e,s;return e=new Yn({props:{label:"integrity",$$slots:{default:[Ra]},$$scope:{ctx:t}}}),{c(){rt(e.$$.fragment)},l(t){ct(e.$$.fragment,t)},m(t,n){lt(e,t,n),s=!0},p(t,s){const n={};33153&s&&(n.$$scope={dirty:s,ctx:t}),e.$set(n)},i(t){s||(ot(e.$$.fragment,t),s=!0)},o(t){it(e.$$.fragment,t),s=!1},d(t){ut(e,t)}}}function Ya(t){let e,s,n,a,r,c,l,o,i,u;e=new da({props:{cost:t[1],mass:t[2],$$slots:{default:[Wa]},$$scope:{ctx:t}}});const $=[t[3]];let h={};for(let p=0;p<$.length;p+=1)h=It(h,$[p]);n=new Ea({props:h}),n.$on("set_screens",t[11]),r=new Na({props:{armour:t[4]}}),r.$on("ship_change",t[12]);const f=[t[5]];let d={};for(let p=0;p<f.length;p+=1)d=It(d,f[p]);l=new Fa({props:d}),l.$on("set_cargo",t[13]);const m=[t[6]];let g={};for(let p=0;p<m.length;p+=1)g=It(g,m[p]);return i=new Ga({props:g}),{c(){rt(e.$$.fragment),s=p(),rt(n.$$.fragment),a=p(),rt(r.$$.fragment),c=p(),rt(l.$$.fragment),o=p(),rt(i.$$.fragment)},l(t){ct(e.$$.fragment,t),s=y(t),ct(n.$$.fragment,t),a=y(t),ct(r.$$.fragment,t),c=y(t),ct(l.$$.fragment,t),o=y(t),ct(i.$$.fragment,t)},m(t,$){lt(e,t,$),_(t,s,$),lt(n,t,$),_(t,a,$),lt(r,t,$),_(t,c,$),lt(l,t,$),_(t,o,$),lt(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?wt($,[xt(t[3])]):{};n.$set(c);const o={};16&s&&(o.armour=t[4]),r.$set(o);const u=32&s?wt(f,[xt(t[5])]):{};l.$set(u);const h=64&s?wt(m,[xt(t[6])]):{};i.$set(h)},i(t){u||(ot(e.$$.fragment,t),ot(n.$$.fragment,t),ot(r.$$.fragment,t),ot(l.$$.fragment,t),ot(i.$$.fragment,t),u=!0)},o(t){it(e.$$.fragment,t),it(n.$$.fragment,t),it(r.$$.fragment,t),it(l.$$.fragment,t),it(i.$$.fragment,t),u=!1},d(t){ut(e,t),t&&v(s),ut(n,t),t&&v(a),ut(r,t),t&&v(c),ut(l,t),t&&v(o),ut(i,t)}}}function Ja(t){let e,s;return e=new va({props:{label:"hull",$$slots:{default:[Ya]},$$scope:{ctx:t}}}),{c(){rt(e.$$.fragment)},l(t){ct(e.$$.fragment,t)},m(t,n){lt(e,t,n),s=!0},p(t,[s]){const n={};33279&s&&(n.$$scope={dirty:s,ctx:t}),e.$set(n)},i(t){s||(ot(e.$$.fragment,t),s=!0)},o(t){it(e.$$.fragment,t),s=!1},d(t){ut(e,t)}}}function Za(t,e,s){let n,a,{cost:r}=e,{mass:c}=e,{ship_mass:l}=e,{rating:o}=e,{screens:i}=e,{armour:u=[]}=e,{cargo:$={}}=e,{streamlining:h={}}=e;const f=at();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,u=t.armour),"cargo"in t&&s(5,$=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&&f("change_hull",{rating:o})},[o,r,c,i,u,$,h,n,a,l,function(){o=Pt(this.value),s(0,o)},function(e){dt(t,e)},function(e){dt(t,e)},function(e){dt(t,e)}]}class Xa extends i{constructor(t){super(),u(this,t,Za,Ja,$,{cost:1,mass:2,ship_mass:9,rating:0,screens:3,armour:4,cargo:5,streamlining:6})}}function Ka(t){let e,s,n;return{c(){e=h("input"),this.h()},l(t){e=d(t,"INPUT",{type:!0,class:!0}),this.h()},h(){b(e,"type","number"),b(e,"class","short")},m(a,r){_(a,e,r),Tt(e,t[0]),s||(n=pt(e,"input",t[3]),s=!0)},p(t,s){1&s&&Pt(e.value)!==t[0]&&Tt(e,t[0])},d(t){t&&v(e),s=!1,n()}}}function Qa(t){let e,s;return e=new Yn({props:{label:"firecons",$$slots:{default:[Ka]},$$scope:{ctx:t}}}),{c(){rt(e.$$.fragment)},l(t){ct(e.$$.fragment,t)},m(t,n){lt(e,t,n),s=!0},p(t,s){const n={};33&s&&(n.$$scope={dirty:s,ctx:t}),e.$set(n)},i(t){s||(ot(e.$$.fragment,t),s=!0)},o(t){it(e.$$.fragment,t),s=!1},d(t){ut(e,t)}}}function tr(t){let e,s;return e=new da({props:{cost:t[1],mass:t[2],$$slots:{default:[Qa]},$$scope:{ctx:t}}}),{c(){rt(e.$$.fragment)},l(t){ct(e.$$.fragment,t)},m(t,n){lt(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||(ot(e.$$.fragment,t),s=!0)},o(t){it(e.$$.fragment,t),s=!1},d(t){ut(e,t)}}}function er(t,e,s){let{nbr:n}=e,{cost:a}=e,{mass:r=0}=e;const c=at();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=Pt(this.value),s(0,n)}]}class sr extends i{constructor(t){super(),u(this,t,er,tr,$,{nbr:0,cost:1,mass:2})}}function nr(t,e,s){const n=t.slice();return n[8]=e[s],n}function ar(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=p(),r=f(i),c=p(),this.h()},l(t){s=d(t,"LABEL",{class:!0});var e=m(s);n=d(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){_(t,s,i),w(s,n),n.checked=n.__value===e[0],w(s,a),w(s,r),w(s,c),l||(o=[pt(n,"change",e[5]),pt(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,Ct(o)}}}function rr(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=nr(t,a,c),l=r(e);n.set(l,s[c]=ar(l,e))}return{c(){for(let t=0;t<s.length;t+=1)s[t].c();e=mt()},l(t){for(let e=0;e<s.length;e+=1)s[e].l(t);e=mt()},m(t,n){for(let e=0;e<s.length;e+=1)s[e].m(t,n);_(t,e,n)},p(t,c){25&c&&(a=t[4],s=$t(s,c,r,1,t,a,n,e.parentNode,ht,ar,e,nr))},d(t){for(let e=0;e<s.length;e+=1)s[e].d(t);t&&v(e)}}}function cr(t){let e,s;return e=new Yn({props:{label:"FTL drive",$$slots:{default:[rr]},$$scope:{ctx:t}}}),{c(){rt(e.$$.fragment)},l(t){ct(e.$$.fragment,t)},m(t,n){lt(e,t,n),s=!0},p(t,s){const n={};2049&s&&(n.$$scope={dirty:s,ctx:t}),e.$set(n)},i(t){s||(ot(e.$$.fragment,t),s=!0)},o(t){it(e.$$.fragment,t),s=!1},d(t){ut(e,t)}}}function lr(t){let e,s;return e=new da({props:{mass:t[2],cost:t[1],$$slots:{default:[cr]},$$scope:{ctx:t}}}),{c(){rt(e.$$.fragment)},l(t){ct(e.$$.fragment,t)},m(t,n){lt(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||(ot(e.$$.fragment,t),s=!0)},o(t){it(e.$$.fragment,t),s=!1},d(t){ut(e,t)}}}function or(t,e,s){let{type:n="none"}=e,{cost:a=0}=e,{mass:r=0}=e;const c=at();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 ir extends i{constructor(t){super(),u(this,t,or,lr,$,{type:0,cost:1,mass:2})}}function ur(t){let e,s,n;return{c(){e=h("input"),this.h()},l(t){e=d(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){_(a,e,r),Tt(e,t[1]),s||(n=pt(e,"input",t[4]),s=!0)},p(t,s){2&s&&Pt(e.value)!==t[1]&&Tt(e,t[1])},d(t){t&&v(e),s=!1,n()}}}function $r(t){let e,s,n,a,r,c,l,o,i;return s=new Yn({props:{label:"thrust rating",$$slots:{default:[ur]},$$scope:{ctx:t}}}),{c(){e=h("div"),rt(s.$$.fragment),n=p(),a=h("label"),r=h("input"),c=f(" advanced"),this.h()},l(t){e=d(t,"DIV",{class:!0});var l=m(e);ct(s.$$.fragment,l),n=y(l),a=d(l,"LABEL",{class:!0});var o=m(a);r=d(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,$){_(u,e,$),lt(s,e,null),w(e,n),w(e,a),w(a,r),r.checked=t[0],w(a,c),l=!0,o||(i=pt(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||(ot(s.$$.fragment,t),l=!0)},o(t){it(s.$$.fragment,t),l=!1},d(t){t&&v(e),ut(s),o=!1,i()}}}function hr(t){let e,s;return e=new da({props:{cost:t[2],mass:t[3],$$slots:{default:[$r]},$$scope:{ctx:t}}}),{c(){rt(e.$$.fragment)},l(t){ct(e.$$.fragment,t)},m(t,n){lt(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||(ot(e.$$.fragment,t),s=!0)},o(t){it(e.$$.fragment,t),s=!1},d(t){ut(e,t)}}}function fr(t,e,s){let{cost:n}=e,{mass:a}=e,{advanced:r=!1}=e,{rating:c=0}=e;const l=at();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=Pt(this.value),s(1,c)},function(){r=this.checked,s(0,r)}]}class pr extends i{constructor(t){super(),u(this,t,fr,hr,$,{cost:2,mass:3,advanced:0,rating:1})}}function dr(t){let e,s,n,a;const r=[t[1]];let c={};for(let i=0;i<r.length;i+=1)c=It(c,r[i]);e=new pr({props:c}),e.$on("change_engine",t[2]);const l=[t[0]];let o={};for(let i=0;i<l.length;i+=1)o=It(o,l[i]);return n=new ir({props:o}),n.$on("change_ftl",t[3]),{c(){rt(e.$$.fragment),s=p(),rt(n.$$.fragment)},l(t){ct(e.$$.fragment,t),s=y(t),ct(n.$$.fragment,t)},m(t,r){lt(e,t,r),_(t,s,r),lt(n,t,r),a=!0},p(t,s){const a=2&s?wt(r,[xt(t[1])]):{};e.$set(a);const c=1&s?wt(l,[xt(t[0])]):{};n.$set(c)},i(t){a||(ot(e.$$.fragment,t),ot(n.$$.fragment,t),a=!0)},o(t){it(e.$$.fragment,t),it(n.$$.fragment,t),a=!1},d(t){ut(e,t),t&&v(s),ut(n,t)}}}function mr(t){let e,s;return e=new va({props:{label:"propulsion",$$slots:{default:[dr]},$$scope:{ctx:t}}}),{c(){rt(e.$$.fragment)},l(t){ct(e.$$.fragment,t)},m(t,n){lt(e,t,n),s=!0},p(t,[s]){const n={};19&s&&(n.$$scope={dirty:s,ctx:t}),e.$set(n)},i(t){s||(ot(e.$$.fragment,t),s=!0)},o(t){it(e.$$.fragment,t),s=!1},d(t){ut(e,t)}}}function gr(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){dt(t,e)},function(e){dt(t,e)}]}class vr extends i{constructor(t){super(),u(this,t,gr,mr,$,{ftl:0,engine:1})}}function yr(t,e,s){const n=t.slice();return n[2]=e[s],n}function br(t){let e,s,n,a,r,c,l,o,i,u,$;return{c(){e=h("select"),s=h("option"),n=f("1"),a=h("option"),r=f("2"),c=h("option"),l=f("3"),o=h("option"),i=f("4"),this.h()},l(t){e=d(t,"SELECT",{});var u=m(e);s=d(u,"OPTION",{value:!0});var $=m(s);n=g($,"1"),$.forEach(v),a=d(u,"OPTION",{value:!0});var h=m(a);r=g(h,"2"),h.forEach(v),c=d(u,"OPTION",{value:!0});var f=m(c);l=g(f,"3"),f.forEach(v),o=d(u,"OPTION",{value:!0});var p=m(o);i=g(p,"4"),p.forEach(v),u.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]&&et((()=>t[8].call(e)))},m(h,f){_(h,e,f),w(e,s),w(s,n),w(e,a),w(a,r),w(e,c),w(c,l),w(e,o),w(o,i),Dt(e,t[0]),u||($=pt(e,"change",t[8]),u=!0)},p(t,s){1&s&&Dt(e,t[0])},d(t){t&&v(e),u=!1,$()}}}function _r(t,e){let s,n,a,r=e[2]+"";return{key:t,first:null,c(){s=h("option"),n=f(r),this.h()},l(t){s=d(t,"OPTION",{value:!0});var e=m(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){_(t,s,e),w(s,n)},p(t,c){e=t,1&c&&r!==(r=e[2]+"")&&tt(n,r),1&c&&a!==(a=e[2])&&(s.__value=a,s.value=s.__value)},d(t){t&&v(s)}}}function wr(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=yr(t,c,o),s=l(e);r.set(s,a[o]=_r(s,e))}return{c(){e=h("select");for(let t=0;t<a.length;t+=1)a[t].c();this.h()},l(t){e=d(t,"SELECT",{});var s=m(e);for(let e=0;e<a.length;e+=1)a[e].l(s);s.forEach(v),this.h()},h(){void 0===t[2]&&et((()=>t[9].call(e)))},m(r,c){_(r,e,c);for(let t=0;t<a.length;t+=1)a[t].m(e,null);Dt(e,t[2]),s||(n=pt(e,"change",t[9]),s=!0)},p(t,s){9&s&&(c=t[3][t[0]]||[],a=$t(a,s,l,1,t,c,r,e,ht,_r,null,yr)),13&s&&Dt(e,t[2])},d(t){t&&v(e);for(let e=0;e<a.length;e+=1)a[e].d();s=!1,n()}}}function xr(t){let e,s,n,a,r,c,l,o,i;return a=new Yn({props:{label:"beam class",$$slots:{default:[br]},$$scope:{ctx:t}}}),c=new Yn({props:{label:"arcs",$$slots:{default:[wr]},$$scope:{ctx:t}}}),o=new gn({props:{selected:t[1]}}),o.$on("click_arc",t[10]),{c(){e=h("label"),s=f("beam"),n=p(),rt(a.$$.fragment),r=p(),rt(c.$$.fragment),l=p(),rt(o.$$.fragment)},l(t){e=d(t,"LABEL",{});var i=m(e);s=g(i,"beam"),i.forEach(v),n=y(t),ct(a.$$.fragment,t),r=y(t),ct(c.$$.fragment,t),l=y(t),ct(o.$$.fragment,t)},m(t,u){_(t,e,u),w(e,s),_(t,n,u),lt(a,t,u),_(t,r,u),lt(c,t,u),_(t,l,u),lt(o,t,u),i=!0},p(t,[e]){const s={};32769&e&&(s.$$scope={dirty:e,ctx:t}),a.$set(s);const n={};32773&e&&(n.$$scope={dirty:e,ctx:t}),c.$set(n);const r={};2&e&&(r.selected=t[1]),o.$set(r)},i(t){i||(ot(a.$$.fragment,t),ot(c.$$.fragment,t),ot(o.$$.fragment,t),i=!0)},o(t){it(a.$$.fragment,t),it(c.$$.fragment,t),it(o.$$.fragment,t),i=!1},d(t){t&&v(e),t&&v(n),ut(a,t),t&&v(r),ut(c,t),t&&v(l),ut(o,t)}}}function Er(t,e,s){const n=["FS","F","FP","AP","A","AS"];let{weapon_class:a=1}=e,{arcs:r=["F"]}=e,{id:c}=e,l={1:[6],2:[3,6],3:[1,2,3,4,5,6,"broadside"],4:[1,2,3,4,5,6,"broadside"]},o=6;const i=t=>{if("broadside"===o)return;let e=n.findIndex((e=>e===t));const a=[];J.range(o).forEach((t=>{a.push(n[e]),e=(e+1)%n.length})),s(1,r=a)};let u=1,$="";const h=at();return t.$$set=t=>{"weapon_class"in t&&s(0,a=t.weapon_class),"arcs"in t&&s(1,r=t.arcs),"id"in t&&s(5,c=t.id)},t.$$.update=()=>{if(1&t.$$.dirty&&s(2,o=l[a][0]),6&t.$$.dirty&&r.length!==o)if("broadside"===o)s(1,r=n.filter((t=>1===t.length)));else{let t=n.findIndex((t=>r[0]));-1===t&&(t=0);const e=[];J.range(o).forEach((s=>{e.push(n[t]),t=(t+1)%n.length})),s(1,r=e)}6&t.$$.dirty&&console.log({arcs:r,nbr_arcs:o}),1&t.$$.dirty&&a&&s(6,u=1),2&t.$$.dirty&&s(7,$=r.join(":")),129&t.$$.dirty&&h("change",{weapon_class:a,arcs:$.split(":")})},[a,r,o,l,i,c,u,$,function(){a=St(this),s(0,a)},function(){o=St(this),s(2,o),s(3,l),s(0,a),s(3,l),s(0,a)},({detail:t})=>i(t)]}class Ir extends i{constructor(t){super(),u(this,t,Er,xr,$,{weapon_class:0,arcs:1,id:5})}}function Or(t){let e,s,n,a,r;return a=new gn({props:{selected:t[0]}}),a.$on("click_arc",t[4]),{c(){e=h("label"),s=f("submunition pack"),n=p(),rt(a.$$.fragment)},l(t){e=d(t,"LABEL",{});var r=m(e);s=g(r,"submunition pack"),r.forEach(v),n=y(t),ct(a.$$.fragment,t)},m(t,c){_(t,e,c),w(e,s),_(t,n,c),lt(a,t,c),r=!0},p(t,[e]){const s={};1&e&&(s.selected=t[0]),a.$set(s)},i(t){r||(ot(a.$$.fragment,t),r=!0)},o(t){it(a.$$.fragment,t),r=!1},d(t){t&&v(e),t&&v(n),ut(a,t)}}}function kr(t,e,s){let{arcs:n=["F"]}=e,{ship_change:a=Ot("ship_change")||(()=>{})}=e;const r=t=>{n[0]!==t&&s(0,n=[t])},c=at();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 Dr extends i{constructor(t){super(),u(this,t,kr,Or,$,{arcs:0,ship_change:2})}}function Mr(t){let e,s;return{c(){e=h("label"),s=f("point defence system")},l(t){e=d(t,"LABEL",{});var n=m(e);s=g(n,"point defence system"),n.forEach(v)},m(t,n){_(t,e,n),w(e,s)},p:x,i:x,o:x,d(t){t&&v(e)}}}class Ar extends i{constructor(t){super(),u(this,t,null,Mr,$,{})}}function Pr(t){let e,s;return{c(){e=h("label"),s=f("scattergun")},l(t){e=d(t,"LABEL",{});var n=m(e);s=g(n,"scattergun"),n.forEach(v)},m(t,n){_(t,e,n),w(e,s)},p:x,i:x,o:x,d(t){t&&v(e)}}}class Tr extends i{constructor(t){super(),u(this,t,null,Pr,$,{})}}function Cr(t){let e,s,n,a,r;return a=new gn({props:{selected:t[0]}}),a.$on("click_arc",t[4]),{c(){e=h("label"),s=f("needle weapon"),n=p(),rt(a.$$.fragment)},l(t){e=d(t,"LABEL",{});var r=m(e);s=g(r,"needle weapon"),r.forEach(v),n=y(t),ct(a.$$.fragment,t)},m(t,c){_(t,e,c),w(e,s),_(t,n,c),lt(a,t,c),r=!0},p(t,[e]){const s={};1&e&&(s.selected=t[0]),a.$set(s)},i(t){r||(ot(a.$$.fragment,t),r=!0)},o(t){it(a.$$.fragment,t),r=!1},d(t){t&&v(e),t&&v(n),ut(a,t)}}}function Sr(t,e,s){let{arcs:n=["F"]}=e,{ship_change:a=Ot("ship_change")||(()=>{})}=e;const r=t=>{n[0]!==t&&s(0,n=[t])},c=at();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 Nr extends i{constructor(t){super(),u(this,t,Sr,Cr,$,{arcs:0,ship_change:2})}}function jr(t){let e,s,n,a,r,c,l;const o=[t[0]];var i=t[3][t[4]];function u(t){let e={};for(let s=0;s<o.length;s+=1)e=It(e,o[s]);return{props:e}}return i&&(a=new i(u()),a.$on("change",t[6])),{c(){e=h("div"),s=h("input"),n=p(),a&&rt(a.$$.fragment),this.h()},l(t){e=d(t,"DIV",{class:!0});var r=m(e);s=d(r,"INPUT",{type:!0,class:!0,value:!0}),n=y(r),a&&ct(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-4pz13w")},m(o,i){_(o,e,i),w(e,s),w(e,n),a&&lt(a,e,null),r=!0,c||(l=pt(s,"click",t[5]),c=!0)},p(t,s){const n=1&s?wt(o,[xt(t[0])]):{};if(i!==(i=t[3][t[4]])){if(a){vt();const t=a;it(t.$$.fragment,1,0,(()=>{ut(t,1)})),bt()}i?(a=new i(u()),a.$on("change",t[6]),rt(a.$$.fragment),ot(a.$$.fragment,1),lt(a,e,null)):a=null}else i&&a.$set(n)},i(t){r||(a&&ot(a.$$.fragment,t),r=!0)},o(t){a&&it(a.$$.fragment,t),r=!1},d(t){t&&v(e),a&&ut(a),c=!1,l()}}}function Vr(t){let e,s;return e=new da({props:{cost:t[1],mass:t[2],$$slots:{default:[jr]},$$scope:{ctx:t}}}),{c(){rt(e.$$.fragment)},l(t){ct(e.$$.fragment,t)},m(t,n){lt(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||(ot(e.$$.fragment,t),s=!0)},o(t){it(e.$$.fragment,t),s=!1},d(t){ut(e,t)}}}function qr(t,e,s){const n={beam:Ir,submunition:Dr,pds:Ar,scattergun:Tr,needle:Nr};let{weapon:a={}}=e,{id:r}=e,{cost:c}=e,{mass:o}=e,{ship:i=Ot("ship")}=e,u=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"in t&&s(8,i=t.ship)},[a,c,o,n,u,()=>null==i?void 0:i.dispatch_action("remove_weapon",r),({detail:t})=>{null==i||i.dispatch_action("set_weapon",l({id:r,weapon_type:u},t))},r,i]}class Lr extends i{constructor(t){super(),u(this,t,qr,Vr,$,{weapon:0,id:7,cost:1,mass:2,ship:8})}}function Fr(t,e,s){const n=t.slice();return n[0]=e[s],n}function Br(t,e){let s,n,a=e[0]+"";return{key:t,first:null,c(){s=h("option"),n=f(a),this.h()},l(t){s=d(t,"OPTION",{value:!0});var e=m(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){_(t,s,e),w(s,n)},p(t,s){e=t},d(t){t&&v(s)}}}function Ur(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=Fr(t,c,o),s=l(e);r.set(s,a[o]=Br(s,e))}return{c(){e=h("select");for(let t=0;t<a.length;t+=1)a[t].c();this.h()},l(t){e=d(t,"SELECT",{});var s=m(e);for(let e=0;e<a.length;e+=1)a[e].l(s);s.forEach(v),this.h()},h(){void 0===t[0]&&et((()=>t[7].call(e)))},m(r,c){_(r,e,c);for(let t=0;t<a.length;t+=1)a[t].m(e,null);Dt(e,t[0]),s||(n=pt(e,"change",t[7]),s=!0)},p(t,s){16&s&&(c=t[4],a=$t(a,s,l,1,t,c,r,e,ht,Br,null,Fr)),17&s&&Dt(e,t[0])},d(t){t&&v(e);for(let e=0;e<a.length;e+=1)a[e].d();s=!1,n()}}}function Hr(t){let e,s;return e=new Yn({props:{label:`squadron ${t[1]}`,$$slots:{default:[Ur]},$$scope:{ctx:t}}}),{c(){rt(e.$$.fragment)},l(t){ct(e.$$.fragment,t)},m(t,n){lt(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||(ot(e.$$.fragment,t),s=!0)},o(t){it(e.$$.fragment,t),s=!1},d(t){ut(e,t)}}}function zr(t){let e,s;return e=new da({props:{cost:t[2],mass:t[3],$$slots:{default:[Hr]},$$scope:{ctx:t}}}),{c(){rt(e.$$.fragment)},l(t){ct(e.$$.fragment,t)},m(t,n){lt(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||(ot(e.$$.fragment,t),s=!0)},o(t){it(e.$$.fragment,t),s=!1},d(t){ut(e,t)}}}function Gr(t,e,s){const n=$s.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:i=Ot("ship")}=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"in t&&s(6,i=t.ship)},t.$$.update=()=>{67&t.$$.dirty&&(null==i||i.dispatch_action("set_squadron",{id:a,type:r}))},[r,a,l,o,n,c,i,function(){r=St(this),s(0,r),s(4,n)}]}class Rr extends i{constructor(t){super(),u(this,t,Gr,zr,$,{id:1,type:0,ftl:5,cost:2,mass:3,ship:6})}}function Wr(t,e,s){const n=t.slice();return n[6]=e[s],n}function Yr(t){let e,s,n;return{c(){e=h("input"),this.h()},l(t){e=d(t,"INPUT",{type:!0,min:!0}),this.h()},h(){b(e,"type","number"),b(e,"min","0")},m(a,r){_(a,e,r),Tt(e,t[0]),s||(n=pt(e,"input",t[5]),s=!0)},p(t,s){1&s&&Pt(e.value)!==t[0]&&Tt(e,t[0])},d(t){t&&v(e),s=!1,n()}}}function Jr(t){let e,s;return e=new Yn({props:{label:"bays",$$slots:{default:[Yr]},$$scope:{ctx:t}}}),{c(){rt(e.$$.fragment)},l(t){ct(e.$$.fragment,t)},m(t,n){lt(e,t,n),s=!0},p(t,s){const n={};513&s&&(n.$$scope={dirty:s,ctx:t}),e.$set(n)},i(t){s||(ot(e.$$.fragment,t),s=!0)},o(t){it(e.$$.fragment,t),s=!1},d(t){ut(e,t)}}}function Zr(t,e){let s,n,a;const r=[e[6]];let c={};for(let l=0;l<r.length;l+=1)c=It(c,r[l]);return n=new Rr({props:c}),{key:t,first:null,c(){s=mt(),rt(n.$$.fragment),this.h()},l(t){s=mt(),ct(n.$$.fragment,t),this.h()},h(){this.first=s},m(t,e){_(t,s,e),lt(n,t,e),a=!0},p(t,s){e=t;const a=2&s?wt(r,[xt(e[6])]):{};n.$set(a)},i(t){a||(ot(n.$$.fragment,t),a=!0)},o(t){it(n.$$.fragment,t),a=!1},d(t){t&&v(s),ut(n,t)}}}function Xr(t){let e,s,n,a,r=[],c=new Map;e=new da({props:{cost:t[2],mass:t[3],$$slots:{default:[Jr]},$$scope:{ctx:t}}});let l=t[1];const o=t=>t[6].id;for(let i=0;i<l.length;i+=1){let e=Wr(t,l,i),s=o(e);c.set(s,r[i]=Zr(s,e))}return{c(){rt(e.$$.fragment),s=p();for(let t=0;t<r.length;t+=1)r[t].c();n=mt()},l(t){ct(e.$$.fragment,t),s=y(t);for(let e=0;e<r.length;e+=1)r[e].l(t);n=mt()},m(t,c){lt(e,t,c),_(t,s,c);for(let e=0;e<r.length;e+=1)r[e].m(t,c);_(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],vt(),r=$t(r,s,o,1,t,l,c,n.parentNode,yt,Zr,n,Wr),bt())},i(t){if(!a){ot(e.$$.fragment,t);for(let t=0;t<l.length;t+=1)ot(r[t]);a=!0}},o(t){it(e.$$.fragment,t);for(let e=0;e<r.length;e+=1)it(r[e]);a=!1},d(t){ut(e,t),t&&v(s);for(let e=0;e<r.length;e+=1)r[e].d(t);t&&v(n)}}}function Kr(t){let e,s;return e=new va({props:{label:"carrier",$$slots:{default:[Xr]},$$scope:{ctx:t}}}),{c(){rt(e.$$.fragment)},l(t){ct(e.$$.fragment,t)},m(t,n){lt(e,t,n),s=!0},p(t,[s]){const n={};527&s&&(n.$$scope={dirty:s,ctx:t}),e.$set(n)},i(t){s||(ot(e.$$.fragment,t),s=!0)},o(t){it(e.$$.fragment,t),s=!1},d(t){ut(e,t)}}}function Qr(t,e,s){let{bays:n=0}=e,{squadrons:a=[]}=e,{cost:r=0}=e,{mass:c=0}=e,{ship:l=Ot("ship")}=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"in t&&s(4,l=t.ship)},t.$$.update=()=>{17&t.$$.dirty&&(null==l||l.dispatch_action("set_carrier_bays",n))},[n,a,r,c,l,function(){n=Pt(this.value),s(0,n)}]}class tc extends i{constructor(t){super(),u(this,t,Qr,Kr,$,{bays:0,squadrons:1,cost:2,mass:3,ship:4})}}function ec(t){let e,s,n;return{c(){e=h("input"),this.h()},l(t){e=d(t,"INPUT",{type:!0,class:!0}),this.h()},h(){b(e,"type","number"),b(e,"class","short")},m(a,r){_(a,e,r),Tt(e,t[0]),s||(n=pt(e,"input",t[4]),s=!0)},p(t,s){1&s&&Pt(e.value)!==t[0]&&Tt(e,t[0])},d(t){t&&v(e),s=!1,n()}}}function sc(t){let e,s;return e=new Yn({props:{label:"ADFC",$$slots:{default:[ec]},$$scope:{ctx:t}}}),{c(){rt(e.$$.fragment)},l(t){ct(e.$$.fragment,t)},m(t,n){lt(e,t,n),s=!0},p(t,s){const n={};33&s&&(n.$$scope={dirty:s,ctx:t}),e.$set(n)},i(t){s||(ot(e.$$.fragment,t),s=!0)},o(t){it(e.$$.fragment,t),s=!1},d(t){ut(e,t)}}}function nc(t){let e,s;return e=new da({props:{cost:t[1],mass:t[2],$$slots:{default:[sc]},$$scope:{ctx:t}}}),{c(){rt(e.$$.fragment)},l(t){ct(e.$$.fragment,t)},m(t,n){lt(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||(ot(e.$$.fragment,t),s=!0)},o(t){it(e.$$.fragment,t),s=!1},d(t){ut(e,t)}}}function ac(t,e,s){let{rating:n=0}=e,{cost:a=0}=e,{mass:r=0}=e,{ship:c=Ot("ship")}=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"in t&&s(3,c=t.ship)},t.$$.update=()=>{9&t.$$.dirty&&(null==c||c.dispatch_action("set_adfc",n))},[n,a,r,c,function(){n=Pt(this.value),s(0,n)}]}class rc extends i{constructor(t){super(),u(this,t,ac,nc,$,{rating:0,cost:1,mass:2,ship:3})}}function cc(t){let e,s,n,a,r,c,l,o,i,u,$,x,E,I,O;return{c(){e=h("select"),s=h("option"),n=f("beam"),a=h("option"),r=f("submunition pack"),c=h("option"),l=f("point defence system"),o=h("option"),i=f("scattergun"),u=h("option"),$=f("needle weapon"),x=p(),E=h("input"),this.h()},l(t){e=d(t,"SELECT",{});var h=m(e);s=d(h,"OPTION",{value:!0});var f=m(s);n=g(f,"beam"),f.forEach(v),a=d(h,"OPTION",{value:!0});var p=m(a);r=g(p,"submunition pack"),p.forEach(v),c=d(h,"OPTION",{value:!0});var b=m(c);l=g(b,"point defence system"),b.forEach(v),o=d(h,"OPTION",{value:!0});var _=m(o);i=g(_,"scattergun"),_.forEach(v),u=d(h,"OPTION",{value:!0});var w=m(u);$=g(w,"needle weapon"),w.forEach(v),h.forEach(v),x=y(t),E=d(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,u.__value="needle",u.value=u.__value,void 0===t[0]&&et((()=>t[3].call(e))),b(E,"type","button"),E.value="add weapon",b(E,"class","button small blue")},m(h,f){_(h,e,f),w(e,s),w(s,n),w(e,a),w(a,r),w(e,c),w(c,l),w(e,o),w(o,i),w(e,u),w(u,$),Dt(e,t[0]),_(h,x,f),_(h,E,f),I||(O=[pt(e,"change",t[3]),pt(E,"click",t[1])],I=!0)},p(t,s){1&s&&Dt(e,t[0])},d(t){t&&v(e),t&&v(x),t&&v(E),I=!1,Ct(O)}}}function lc(t){let e,s;return e=new Yn({props:{label:"weapon type",$$slots:{default:[cc]},$$scope:{ctx:t}}}),{c(){rt(e.$$.fragment)},l(t){ct(e.$$.fragment,t)},m(t,n){lt(e,t,n),s=!0},p(t,[s]){const n={};17&s&&(n.$$scope={dirty:s,ctx:t}),e.$set(n)},i(t){s||(ot(e.$$.fragment,t),s=!0)},o(t){it(e.$$.fragment,t),s=!1},d(t){ut(e,t)}}}function oc(t,e,s){let{weapon_type:n="beam"}=e,{ship:a=Ot("ship")}=e;return t.$$set=t=>{"weapon_type"in t&&s(0,n=t.weapon_type),"ship"in t&&s(2,a=t.ship)},[n,()=>null==a?void 0:a.dispatch_action("add_weapon",n),a,function(){n=St(this),s(0,n)}]}class ic extends i{constructor(t){super(),u(this,t,oc,lc,$,{weapon_type:0,ship:2})}}function uc(t,e,s){const n=t.slice();return n[23]=e[s],n}function $c(t){let e,s;return e=new ha({props:{show:t[2]}}),e.$on("close",t[12]),{c(){rt(e.$$.fragment)},l(t){ct(e.$$.fragment,t)},m(t,n){lt(e,t,n),s=!0},p(t,s){const n={};4&s&&(n.show=t[2]),e.$set(n)},i(t){s||(ot(e.$$.fragment,t),s=!0)},o(t){it(e.$$.fragment,t),s=!1},d(t){ut(e,t)}}}function hc(t){let e,s,n,a,r,c,l,o,i,u,$,x,E,I,O,k,D,M,A;s=new ia({}),a=new vr({props:{ftl:t[1].ftl,engine:t[1].engine}}),a.$on("change_ftl",t[5]),a.$on("change_engine",t[6]);const P=[{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 T={};for(let h=0;h<P.length;h+=1)T=It(T,P[h]);c=new Xa({props:T}),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 va({props:{label:"weaponry",$$slots:{default:[mc]},$$scope:{ctx:t}}});const C=[t[1].carrier];let S={};for(let h=0;h<C.length;h+=1)S=It(S,C[h]);return u=new tc({props:S}),{c(){e=h("main"),rt(s.$$.fragment),n=p(),rt(a.$$.fragment),r=p(),rt(c.$$.fragment),l=p(),rt(o.$$.fragment),i=p(),rt(u.$$.fragment),$=p(),x=h("footer"),E=f("Written by "),I=h("a"),O=f("Yanick Champoux"),k=f(". Code\n available on\n "),D=h("a"),M=f("Github"),this.h()},l(t){e=d(t,"MAIN",{class:!0});var h=m(e);ct(s.$$.fragment,h),n=y(h),ct(a.$$.fragment,h),r=y(h),ct(c.$$.fragment,h),l=y(h),ct(o.$$.fragment,h),i=y(h),ct(u.$$.fragment,h),h.forEach(v),$=y(t),x=d(t,"FOOTER",{class:!0});var f=m(x);E=g(f,"Written by "),I=d(f,"A",{href:!0});var p=m(I);O=g(p,"Yanick Champoux"),p.forEach(v),k=g(f,". Code\n available on\n "),D=d(f,"A",{href:!0});var b=m(D);M=g(b,"Github"),b.forEach(v),f.forEach(v),this.h()},h(){b(e,"class","svelte-1pbmoo4"),b(I,"href","https://twitter.com/yenzie"),b(D,"href","https://github.com/yanick/aotds-shipyard"),b(x,"class","svelte-1pbmoo4")},m(t,h){_(t,e,h),lt(s,e,null),w(e,n),lt(a,e,null),w(e,r),lt(c,e,null),w(e,l),lt(o,e,null),w(e,i),lt(u,e,null),_(t,$,h),_(t,x,h),w(x,E),w(x,I),w(I,O),w(x,k),w(x,D),w(D,M),A=!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?wt(P,[{ship_mass:t[1].general.mass},xt(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?wt(C,[xt(t[1].carrier)]):{};u.$set(l)},i(t){A||(ot(s.$$.fragment,t),ot(a.$$.fragment,t),ot(c.$$.fragment,t),ot(o.$$.fragment,t),ot(u.$$.fragment,t),A=!0)},o(t){it(s.$$.fragment,t),it(a.$$.fragment,t),it(c.$$.fragment,t),it(o.$$.fragment,t),it(u.$$.fragment,t),A=!1},d(t){t&&v(e),ut(s),ut(a),ut(c),ut(o),ut(u),t&&v($),t&&v(x)}}}function fc(t){let e,s;return e=new zn({props:{ship:t[1]}}),{c(){rt(e.$$.fragment)},l(t){ct(e.$$.fragment,t)},m(t,n){lt(e,t,n),s=!0},p(t,s){const n={};2&s&&(n.ship=t[1]),e.$set(n)},i(t){s||(ot(e.$$.fragment,t),s=!0)},o(t){it(e.$$.fragment,t),s=!1},d(t){ut(e,t)}}}function pc(t){let e,s;return e=new Ms({props:{ship:t[1]}}),e.$on("close",t[17]),{c(){rt(e.$$.fragment)},l(t){ct(e.$$.fragment,t)},m(t,n){lt(e,t,n),s=!0},p(t,s){const n={};2&s&&(n.ship=t[1]),e.$set(n)},i(t){s||(ot(e.$$.fragment,t),s=!0)},o(t){it(e.$$.fragment,t),s=!1},d(t){ut(e,t)}}}function dc(t,e){let s,n,a;return n=new Lr({props:{weapon:e[23],id:e[23].id,cost:e[23].cost,mass:e[23].mass}}),{key:t,first:null,c(){s=mt(),rt(n.$$.fragment),this.h()},l(t){s=mt(),ct(n.$$.fragment,t),this.h()},h(){this.first=s},m(t,e){_(t,s,e),lt(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||(ot(n.$$.fragment,t),a=!0)},o(t){it(n.$$.fragment,t),a=!1},d(t){t&&v(s),ut(n,t)}}}function mc(t){let e,s,n,a,r,c,l,o,i=[],u=new Map;const $=[t[1].weaponry.firecons];let h={};for(let p=0;p<$.length;p+=1)h=It(h,$[p]);e=new sr({props:h}),e.$on("change_firecons",t[8]);const f=[t[1].weaponry.adfc];let d={};for(let p=0;p<f.length;p+=1)d=It(d,f[p]);n=new rc({props:d}),r=new ic({});let m=t[0];const g=t=>t[23].id;for(let p=0;p<m.length;p+=1){let e=uc(t,m,p),s=g(e);u.set(s,i[p]=dc(s,e))}return{c(){rt(e.$$.fragment),s=p(),rt(n.$$.fragment),a=p(),rt(r.$$.fragment),c=p();for(let t=0;t<i.length;t+=1)i[t].c();l=mt()},l(t){ct(e.$$.fragment,t),s=y(t),ct(n.$$.fragment,t),a=y(t),ct(r.$$.fragment,t),c=y(t);for(let e=0;e<i.length;e+=1)i[e].l(t);l=mt()},m(t,u){lt(e,t,u),_(t,s,u),lt(n,t,u),_(t,a,u),lt(r,t,u),_(t,c,u);for(let e=0;e<i.length;e+=1)i[e].m(t,u);_(t,l,u),o=!0},p(t,s){const a=2&s?wt($,[xt(t[1].weaponry.firecons)]):{};e.$set(a);const r=2&s?wt(f,[xt(t[1].weaponry.adfc)]):{};n.$set(r),1&s&&(m=t[0],vt(),i=$t(i,s,g,1,t,m,u,l.parentNode,yt,dc,l,uc),bt())},i(t){if(!o){ot(e.$$.fragment,t),ot(n.$$.fragment,t),ot(r.$$.fragment,t);for(let t=0;t<m.length;t+=1)ot(i[t]);o=!0}},o(t){it(e.$$.fragment,t),it(n.$$.fragment,t),it(r.$$.fragment,t);for(let e=0;e<i.length;e+=1)it(i[e]);o=!1},d(t){ut(e,t),t&&v(s),ut(n,t),t&&v(a),ut(r,t),t&&v(c);for(let e=0;e<i.length;e+=1)i[e].d(t);t&&v(l)}}}function gc(t){let e,s,n,a,r,c,l,o,i,u,$,x,E,I,O,k,D,M,A,P,T,C,S,N,j,V,q,L,F,B,U,H,z;e=new Ht({}),n=new Ft({});let G=t[2]&&$c(t);const R=[pc,fc,hc],W=[];function Y(t,e){return"json"===t[3]?0:"print"===t[3]?1:2}return L=Y(t),F=W[L]=R[L](t),{c(){rt(e.$$.fragment),s=p(),rt(n.$$.fragment),a=p(),r=h("nav"),c=h("button"),l=f("reset"),o=p(),i=h("div"),u=p(),$=h("button"),x=f("about"),E=p(),I=h("div"),O=h("p"),k=h("button"),D=f("editor"),M=p(),A=h("p"),P=h("button"),T=f("json"),C=p(),S=h("p"),N=h("button"),j=f("print"),V=p(),G&&G.c(),q=p(),F.c(),B=mt(),this.h()},l(t){ct(e.$$.fragment,t),s=y(t),ct(n.$$.fragment,t),a=y(t),r=d(t,"NAV",{class:!0});var h=m(r);c=d(h,"BUTTON",{class:!0,type:!0});var f=m(c);l=g(f,"reset"),f.forEach(v),o=y(h),i=d(h,"DIV",{class:!0}),m(i).forEach(v),u=y(h),$=d(h,"BUTTON",{class:!0});var p=m($);x=g(p,"about"),p.forEach(v),E=y(h),I=d(h,"DIV",{class:!0});var b=m(I);O=d(b,"P",{class:!0});var _=m(O);k=d(_,"BUTTON",{class:!0});var w=m(k);D=g(w,"editor"),w.forEach(v),_.forEach(v),M=y(b),A=d(b,"P",{class:!0});var L=m(A);P=d(L,"BUTTON",{class:!0});var U=m(P);T=g(U,"json"),U.forEach(v),L.forEach(v),C=y(b),S=d(b,"P",{class:!0});var H=m(S);N=d(H,"BUTTON",{class:!0});var z=m(N);j=g(z,"print"),z.forEach(v),H.forEach(v),b.forEach(v),h.forEach(v),V=y(t),G&&G.l(t),q=y(t),F.l(t),B=mt(),this.h()},h(){b(c,"class","button is-danger"),b(c,"type","button"),b(i,"class","spacer svelte-1pbmoo4"),b($,"class","button is-info about svelte-1pbmoo4"),b(k,"class","button"),b(O,"class","control"),b(P,"class","button"),b(A,"class","control"),b(N,"class","button"),b(S,"class","control"),b(I,"class","field has-addons"),b(r,"class","svelte-1pbmoo4")},m(h,f){lt(e,h,f),_(h,s,f),lt(n,h,f),_(h,a,f),_(h,r,f),w(r,c),w(c,l),w(r,o),w(r,i),w(r,u),w(r,$),w($,x),w(r,E),w(r,I),w(I,O),w(O,k),w(k,D),w(I,M),w(I,A),w(A,P),w(P,T),w(I,C),w(I,S),w(S,N),w(N,j),_(h,V,f),G&&G.m(h,f),_(h,q,f),W[L].m(h,f),_(h,B,f),U=!0,H||(z=[pt(c,"click",t[9]),pt($,"click",t[12]),pt(k,"click",t[14]),pt(P,"click",t[15]),pt(N,"click",t[16])],H=!0)},p(t,[e]){t[2]?G?(G.p(t,e),4&e&&ot(G,1)):(G=$c(t),G.c(),ot(G,1),G.m(q.parentNode,q)):G&&(vt(),it(G,1,1,(()=>{G=null})),bt());let s=L;L=Y(t),L===s?W[L].p(t,e):(vt(),it(W[s],1,1,(()=>{W[s]=null})),bt(),F=W[L],F?F.p(t,e):(F=W[L]=R[L](t),F.c()),ot(F,1),F.m(B.parentNode,B))},i(t){U||(ot(e.$$.fragment,t),ot(n.$$.fragment,t),ot(G),ot(F),U=!0)},o(t){it(e.$$.fragment,t),it(n.$$.fragment,t),it(G),it(F),U=!1},d(t){ut(e,t),t&&v(s),ut(n,t),t&&v(a),t&&v(r),t&&v(V),G&&G.d(t),t&&v(q),W[L].d(t),t&&v(B),H=!1,Ct(z)}}}function vc(t,e,s){let n;const a=(()=>{let t;t=window.localStorage.getItem("aotds-shipyard"),t=t?JSON.parse(t):void 0;const e=Is.createStore(t,(t=>Os(X(t))));let s;return e.dispatch(e.actions.set_ship_reqs(Gt(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,window.localStorage.setItem("aotds-shipyard",JSON.stringify(t)))})),{subscribe:K(e.getState(),(t=>e.subscribe((()=>{t(e.getState())})))).subscribe,dispatch:e.dispatch,actions:e.actions,selectors:e.selectors,dispatch_action:(t,s)=>e.dispatch[t](s)}})();Nt(t,a,(t=>s(1,n=t))),jt("ship",a),n.general.name;let r=[];const c=a.dispatch.reset;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 yc extends i{constructor(t){super(),u(this,t,vc,gc,$,{})}}function bc(t,e,s){const n=t.slice();return n[1]=e[s],n}function _c(t,e){let s;return{key:t,first:null,c(){s=h("link"),this.h()},l(t){s=d(t,"LINK",{rel:!0,href:!0}),this.h()},h(){b(s,"rel","stylesheet"),b(s,"href",e[1]),this.first=s},m(t,e){_(t,s,e)},p(t,s){e=t},d(t){t&&v(s)}}}function wc(t){let e,s,n,a,r=[],c=new Map;e=new yc({});let l=t[0];const o=t=>t[1];for(let i=0;i<l.length;i+=1){let e=bc(t,l,i),s=o(e);c.set(s,r[i]=_c(s,e))}return{c(){rt(e.$$.fragment),s=p();for(let t=0;t<r.length;t+=1)r[t].c();n=mt()},l(t){ct(e.$$.fragment,t),s=y(t);const a=Vt('[data-svelte="svelte-83r3ry"]',document.head);for(let e=0;e<r.length;e+=1)r[e].l(a);n=mt(),a.forEach(v)},m(t,c){lt(e,t,c),_(t,s,c);for(let e=0;e<r.length;e+=1)r[e].m(document.head,null);w(document.head,n),a=!0},p(t,[e]){1&e&&(l=t[0],r=$t(r,e,o,1,t,l,c,n.parentNode,ht,_c,n,bc))},i(t){a||(ot(e.$$.fragment,t),a=!0)},o(t){it(e.$$.fragment,t),a=!1},d(t){ut(e,t),t&&v(s);for(let e=0;e<r.length;e+=1)r[e].d();v(n)}}}function xc(t){return[["/bulma/bulma.css","/fonts/faktos.css","/fonts/dosis/dosis.css","/global.css"].map((t=>qt+t))]}export default class extends i{constructor(t){super(),u(this,t,xc,wc,$,{})}}