text: parcelRequire=function(e,r,t,n){var i,o="function"==typeof parcelRequire&&parcelRequire,u="function"==typeof require&&require;function f(t,n){if(!r[t]){if(!e[t]){var i="function"==typeof parcelRequire&&parcelRequire;if(!n&&i)return i(t,!0);if(o)return o(t,!0);if(u&&"string"==typeof t)return u(t);var c=new Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}p.resolve=function(r){return e[t][1][r]||r},p.cache={};var l=r[t]=new f.Module(t);e[t][0].call(l.exports,p,l,l.exports,this)}return r[t].exports;function p(e){return f(p.resolve(e))}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.exports={}},f.modules=e,f.cache=r,f.parent=o,f.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]};for(var c=0;c<t.length;c++)try{f(t[c])}catch(e){i||(i=e)}if(t.length){var l=f(t[t.length-1]);"object"==typeof exports&&"undefined"!=typeof module?module.exports=l:"function"==typeof define&&define.amd?define(function(){return l}):n&&(this[n]=l)}if(parcelRequire=f,i)throw i;return f}({"QCba":[function(require,module,exports) {
  var e=4,t=4,r=document.getElementById("editor"),n=document.getElementById("render");r.width=e*t*3,r.height=e*t*3,n.width=e*t*3,n.height=e*t*3;var o=r.getContext("2d"),i=n.getContext("2d"),l=!1;function a(){return new Array(e).fill(0).map(function(t,r){return new Array(e).fill(0)})}function f(){return new Array(3).fill(0).map(function(e,t){return new Array(3).fill(0).map(function(e,t){return a()})})}var d=f();function h(e,t){var r=e,n=t;return 1==arguments.length&&(r=0,n=e),r=Math.ceil(r),n=Math.floor(n),Math.floor(Math.random()*(n-r))+r}function u(){return[h(3),h(3),h(e),h(e)]}function c(e,t){var r=e.slice(0,-1),n=e[e.length-1];console.log(t),r.reduce(function(e,t){return e[t]},d)[n]=t}function g(e){return e.reduce(function(e,t){return e[t]},d)}function v(r){i.fill();for(var n=0;n<3;n++)for(var l=0;l<3;l++)for(var a=0;a<e;a++)for(var f=0;f<e;f++){var d=g([n,l,a,f]);o.fillStyle=1==d?"#000":"#fff0",i.fillStyle=1==d?"#000":"#fff0";var h=(n*e+a)*t,u=(l*e+f)*t;o.fillRect(h+1,u+1,t-1,t-1),i.fillRect(h,u,t,t)}}console.log(d),c([0,0,0,0]),c([2,2,0,0]),c(u()),c(u()),c(u()),c(u()),c(u()),c(u()),c(u()),c(u()),c(u()),c(u()),c(u());for(var s=0;s<3;s++){o.strokeStyle="#999",o.lineWidth=.5;var m=s*r.width/3;o.beginPath(),o.moveTo(m,0),o.lineTo(m,r.height),o.stroke(),o.beginPath(),o.moveTo(0,m),o.lineTo(r.height,m),o.stroke()}for(s=0;s<3*e;s++){o.strokeStyle="#ccc";m=s*r.width/(3*e);o.beginPath(),o.moveTo(m,0),o.lineTo(m,r.height),o.stroke(),o.beginPath(),o.moveTo(0,m),o.lineTo(r.height,m),o.stroke()}function y(){var r=n.toDataURL(),o=document.getElementById("target");o.style.borderImage='url("'+r+'")',o.style.borderImageSlice=e*t+" ",o.style.borderImageWidth=e*t+"px",o.style.borderImageRepeat="repeat",o.style.borderWidth=e*t+"px",o.style.borderStyle="solid"}v(d),y();var w=function(n,o){if(l){var i=r.getBoundingClientRect(),a=i.left,f=i.top,h=i.width,u=i.height,s=n.clientX-a,m=n.clientY-f,w=s/h*r.width,b=m/u*r.height,p=Math.floor(w/t),M=Math.floor(b/t),T=[Math.floor(p/e),Math.floor(M/e),p%e,M%e],E=g(T)||0;console.log(E),o||(E=0),c(T,1-E),v(d),y()}};r.addEventListener("mousedown",function(e){l=!0,w(e,!0)}),r.addEventListener("mousemove",w),r.addEventListener("mouseup",function(){l=!1}),r.addEventListener("mouseleave",function(){l=!1});
  },{}]},{},["QCba"], null)
  //# sourceMappingURL=/border/border.42f86dbc.js.map