(function(t){function e(e){for(var n,a,s=e[0],c=e[1],l=e[2],u=0,f=[];uDesigner',4),j=Object(n["f"])("h2",null,"Material",-1),g=Object(n["f"])("label",{for:"boardThickness"},"Board thickness",-1),v=Object(n["f"])("label",{for:"boardLength"},"Board length",-1),w=Object(n["f"])("label",{for:"bladeKerf"},"Blade kerf",-1),m=Object(n["f"])("h2",null,"End grain",-1),y=Object(n["f"])("label",{for:"crosscutWidth"},"Crosscut width",-1),k=Object(n["f"])("label",{for:"alternateDirection"},"Alternate direction",-1);Object(n["i"])();var x=b((function(t,e,r,o,i,a){return Object(n["h"])(),Object(n["c"])("div",p,[O,Object(n["f"])("input",{id:"borders",type:"checkbox",checked:a.settings.borders,onChange:e[1]||(e[1]=function(e){return t.$store.commit("updateSettings",{borders:e.target.checked})})},null,40,["checked"]),j,g,Object(n["f"])("input",{id:"boardThickness",type:"number",value:a.settings.boardThickness,onChange:e[2]||(e[2]=function(e){return t.$store.commit("updateSettings",{boardThickness:a.parseFloatDef(e.target.value)})})},null,40,["value"]),v,Object(n["f"])("input",{id:"boardLength",type:"number",value:a.settings.boardLength,onChange:e[3]||(e[3]=function(e){return t.$store.commit("updateSettings",{boardLength:a.parseFloatDef(e.target.value)})})},null,40,["value"]),w,Object(n["f"])("input",{id:"bladeKerf",type:"number",value:a.settings.bladeKerf,onChange:e[4]||(e[4]=function(e){return t.$store.commit("updateSettings",{bladeKerf:a.parseFloatDef(e.target.value)})})},null,40,["value"]),m,y,Object(n["f"])("input",{id:"crosscutWidth",type:"number",value:a.settings.crosscutWidth,onChange:e[5]||(e[5]=function(e){return t.$store.commit("updateSettings",{crosscutWidth:a.parseFloatDef(e.target.value)})})},null,40,["value"]),k,Object(n["f"])("input",{id:"alternateDirection",type:"checkbox",checked:a.settings.alternateDirection,onChange:e[6]||(e[6]=function(e){return t.$store.commit("updateSettings",{alternateDirection:e.target.checked})})},null,40,["checked"])])})),W=(r("2b19"),25.4),L=10,P=1,$={toPixels:function(t,e){return this.toMillimeters(t,e)*P},toMillimeters:function(t,e){switch(e){case"mm":return t;case"cm":return t*L;case"inch":return t*W}return console.error("Invalid units type: "+e),0},fromMillimeters:function(t,e){switch(e){case"mm":return t;case"cm":return t/L;case"inch":return t/W}return console.error("Invalid units type: "+e),0}},C={computed:{settings:function(){return this.$store.state.settings}},methods:{parseFloatDef:function(t){var e=parseFloat(t);return Object.is(e,NaN)?0:e}}};r("e334");C.render=x,C.__scopeId="data-v-660f17f9";var S=C,M=(r("b0c0"),Object(n["s"])("data-v-535527d4"));Object(n["j"])("data-v-535527d4");var B={class:"layers"},D={class:"add"},_=Object(n["f"])("span",{class:"header"}," ",-1),H=Object(n["f"])("span",{class:"header"},"Wood type",-1),T=Object(n["f"])("span",{class:"header"},"Width",-1),E=Object(n["f"])("span",{class:"header"}," ",-1),F={class:"index"},I={class:"remove"};Object(n["i"])();var U=M((function(t,e,r,o,i,a){return Object(n["h"])(),Object(n["c"])("div",B,[Object(n["f"])("div",D,[Object(n["f"])("button",{onClick:e[1]||(e[1]=function(t){return a.addLayer()})},"Add layer")]),_,H,T,E,(Object(n["h"])(!0),Object(n["c"])(n["a"],null,Object(n["l"])(a.layers,(function(t,e){return Object(n["h"])(),Object(n["c"])(n["a"],null,[Object(n["f"])("div",F,Object(n["n"])(e+1),1),Object(n["r"])(Object(n["f"])("select",{"onUpdate:modelValue":function(e){return t.wood=e},class:"wood"},[(Object(n["h"])(!0),Object(n["c"])(n["a"],null,Object(n["l"])(a.wood,(function(t,e){return Object(n["h"])(),Object(n["c"])("option",{value:e},Object(n["n"])(t.name),9,["value"])})),256))],8,["onUpdate:modelValue"]),[[n["o"],t.wood]]),Object(n["f"])("input",{type:"number",class:"width",value:t.width,onInput:function(e){return t.width=a.parseFloatDef(e.target.value)}},null,40,["value","onInput"]),Object(n["f"])("div",I,[Object(n["f"])("button",{onClick:function(t){return a.removeLayer(e)}},"X",8,["onClick"])])],64)})),256))])})),K={computed:{settings:function(){return this.$store.state.settings},wood:function(){return this.$store.state.wood},layers:function(){return this.$store.state.boards[0].layers}},methods:{parseFloatDef:function(t){var e=parseFloat(t);return Object.is(e,NaN)?0:e},addLayer:function(){this.$store.commit("addLayer",0)},removeLayer:function(t){this.$store.commit("removeLayer",{board:0,layer:t})}}};r("23b6");K.render=U,K.__scopeId="data-v-535527d4";var N=K,V=Object(n["s"])("data-v-55181d8c");Object(n["j"])("data-v-55181d8c");var A={class:"wood"},G={class:"add"},J=Object(n["f"])("span",{class:"header"}," ",-1),R=Object(n["f"])("span",{class:"header"},"Name",-1),X=Object(n["f"])("span",{class:"header"},"Colour",-1),Y=Object(n["f"])("span",{class:"header"}," ",-1),q=Object(n["f"])("span",null," ",-1),z={class:"remove"};Object(n["i"])();var Q=V((function(t,e,r,o,i,a){return Object(n["h"])(),Object(n["c"])("div",A,[Object(n["f"])("div",G,[Object(n["f"])("button",{onClick:e[1]||(e[1]=function(t){return a.addWood()})},"Add wood type")]),J,R,X,Y,(Object(n["h"])(!0),Object(n["c"])(n["a"],null,Object(n["l"])(a.wood,(function(t,e){return Object(n["h"])(),Object(n["c"])(n["a"],null,[q,Object(n["r"])(Object(n["f"])("input",{type:"text",class:"name","onUpdate:modelValue":function(e){return t.name=e}},null,8,["onUpdate:modelValue"]),[[n["p"],t.name]]),Object(n["r"])(Object(n["f"])("input",{type:"color",class:"color","onUpdate:modelValue":function(e){return t.color=e}},null,8,["onUpdate:modelValue"]),[[n["p"],t.color]]),Object(n["f"])("div",z,[Object(n["f"])("button",{onClick:function(t){return a.removeWood(e)}},"X",8,["onClick"])])],64)})),256))])})),Z={computed:{settings:function(){return this.$store.state.settings},wood:function(){return this.$store.state.wood}},methods:{addWood:function(){this.$store.commit("addWood")},removeWood:function(t){this.$store.commit("removeWood",t)}}};r("667a");Z.render=Q,Z.__scopeId="data-v-55181d8c";var tt=Z,et={class:"preview"};function rt(t,e,r,o,i,a){return Object(n["h"])(),Object(n["c"])("div",et,[(Object(n["h"])(),Object(n["c"])("svg",{width:a.viewportWidth,height:a.viewportHeight,viewBox:a.viewBox},[(Object(n["h"])(!0),Object(n["c"])(n["a"],null,Object(n["l"])(a.layers,(function(t,e){return Object(n["h"])(),Object(n["c"])("rect",{width:a.toPixels(a.settings.boardLength),height:a.toPixels(t.width),x:"0",y:a.getLayerOffset(e),style:a.getLayerStyle(e)},null,12,["width","height","y"])})),256))],8,["width","height","viewBox"]))])}r("d81d"),r("13d5"),r("a9e3");var nt={props:{scale:Number},computed:{settings:function(){return this.$store.state.settings},wood:function(){return this.$store.state.wood},layers:function(){return this.$store.state.boards[0].layers},boardWidth:function(){return this.toPixels(this.settings.boardLength)},boardHeight:function(){return this.layers.map((function(t){return t.width})).reduce((function(t,e){return t+e}))},viewportWidth:function(){return Math.floor(this.boardWidth*this.scale)},viewportHeight:function(){return Math.floor(this.boardHeight*this.scale)},viewBox:function(){return"0 0 "+this.boardWidth+" "+this.boardHeight}},methods:{toPixels:function(t){return $.toPixels(t,this.settings.units)},getLayerOffset:function(t){if(t<0||t>=this.layers.length)return 0;for(var e=0,r=0;r=this.layers.length)return"fill: fuchsia";var e=this.layers[t].wood;if(null===e)return"";var r=this.settings.borders?"; stroke-width: 1; stroke: black":"";return"fill: "+this.wood[e].color+r}}};nt.render=rt;var ot=nt,it={class:"preview"},at={id:"strip"};function st(t,e,r,o,i,a){return Object(n["h"])(),Object(n["c"])("div",it,[(Object(n["h"])(),Object(n["c"])("svg",{width:a.viewportWidth,height:a.viewportHeight,viewBox:a.viewBox},[Object(n["f"])("defs",null,[Object(n["f"])("g",at,[(Object(n["h"])(!0),Object(n["c"])(n["a"],null,Object(n["l"])(a.layers,(function(t,e){return Object(n["h"])(),Object(n["c"])("rect",{width:a.toPixels(a.settings.boardThickness),height:a.toPixels(t.width),x:"0",y:a.getLayerOffset(e),style:a.getLayerStyle(e)},null,12,["width","height","y"])})),256))])]),(Object(n["h"])(!0),Object(n["c"])(n["a"],null,Object(n["l"])(a.stripsPerBoard,(function(t,e){return Object(n["h"])(),Object(n["c"])("use",{"xlink:href":"#strip",x:e*a.settings.boardThickness,y:"0",transform:a.getLayerTransform(e)},null,8,["x","transform"])})),256))],8,["width","height","viewBox"]))])}var ct={props:{scale:Number},computed:{settings:function(){return this.$store.state.settings},wood:function(){return this.$store.state.wood},layers:function(){return this.$store.state.boards[0].layers},stripsPerBoard:function(){var t=this.settings.crosscutWidth+this.settings.bladeKerf;return 0===t?0:Math.floor((this.settings.boardLength+this.settings.bladeKerf)/t)},boardWidth:function(){var t=this.stripsPerBoard*this.settings.boardThickness;return this.toPixels(t)},boardHeight:function(){return this.layers.map((function(t){return t.width})).reduce((function(t,e){return t+e}))},viewportWidth:function(){return Math.floor(this.boardWidth*this.scale)},viewportHeight:function(){return Math.floor(this.boardHeight*this.scale)},viewBox:function(){return"0 0 "+this.boardWidth+" "+this.boardHeight}},methods:{toPixels:function(t){return $.toPixels(t,this.settings.units)},getLayerOffset:function(t){if(t<0||t>=this.layers.length)return 0;for(var e=0,r=0;r=this.layers.length)return"fill: fuchsia";var e=this.layers[t].wood;if(null===e)return"";var r=this.settings.borders?"; stroke-width: 1; stroke: black":"";return"fill: "+this.wood[e].color+r},getLayerTransform:function(t){return this.settings.alternateDirection&&t%2!=0?"scale(1, -1) translate(0, -"+this.boardHeight+")":""}}};ct.render=st;var lt=ct,dt={name:"App",components:{EndGrainPreview:ot,EdgeGrainPreview:lt,Settings:S,Layers:N,Wood:tt}};r("848a");dt.render=h;var ut=dt,ft=(r("4160"),r("a434"),r("159b"),r("5502")),ht=Object(ft["a"])({state:{settings:{units:"mm",borders:!1,boardThickness:20,boardLength:700,bladeKerf:3.5,crosscutWidth:30,alternateDirection:!0},wood:[{name:"Walnut",color:"#58443f"},{name:"Maple",color:"#f2e0aa"},{name:"Cherry",color:"#bb8359"},{name:"Mahogany",color:"#98473f"},{name:"Yellowheart",color:"#ffff84"},{name:"White oak",color:"#fdf4b9"},{name:"Bubinga",color:"#7e3c34"},{name:"Jatoba",color:"#9b281c"},{name:"Padouk",color:"#933350"}],boards:[{layers:[{wood:0,width:20},{wood:1,width:20},{wood:0,width:20},{wood:1,width:20},{wood:0,width:20},{wood:1,width:20},{wood:0,width:20},{wood:1,width:20},{wood:0,width:20},{wood:1,width:20},{wood:0,width:20},{wood:1,width:20},{wood:0,width:20},{wood:1,width:20}]}]},mutations:{addLayer:function(t,e){e<0||e>=t.boards.length||t.boards[e].layers.push({wood:0,width:$.fromMillimeters(20,t.settings.units)})},removeLayer:function(t,e){e.board<0||e.board>=t.boards.length||e.layer<0||e.layer>=t.boards[e.board].length||t.boards[e.board].layers.splice(e.layer,1)},addWood:function(t){t.wood.push({name:"Wood #"+(t.wood.length+1),color:"#f2e0aa"})},removeWood:function(t,e){e<0||e>=t.wood.length||(t.boards.forEach((function(t){t.layers.forEach((function(t){t.wood===e?t.wood=null:t.wood>e&&t.wood--}))})),t.wood.splice(e,1))},updateSettings:function(t,e){for(var r in e)e.hasOwnProperty(r)&&t.settings.hasOwnProperty(r)&&(t.settings[r]=e[r])}},actions:{}});Object(n["b"])(ut).use(ht).mount("#app")},"667a":function(t,e,r){"use strict";r("6ac4")},"6ac4":function(t,e,r){},"848a":function(t,e,r){"use strict";r("db52")},"9e5f":function(t,e,r){},d747:function(t,e,r){},db52:function(t,e,r){},e334:function(t,e,r){"use strict";r("9e5f")}}); //# sourceMappingURL=app.25927fa2.js.map