text: !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.canvas=e():t.canvas=e()}(window,(function(){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(r,i,function(e){return t[e]}.bind(null,i));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=0)}([function(t,e,n){"use strict";n.r(e),n.d(e,"Canvas",(function(){return f})),n.d(e,"Item",(function(){return v}));var r=Symbol("auto");function i(t,e){var n;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(n=function(t,e){if(!t)return;if("string"==typeof t)return o(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return o(t,e)}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var u,a=!0,f=!1;return{s:function(){n=t[Symbol.iterator]()},n:function(){var t=n.next();return a=t.done,t},e:function(t){f=!0,u=t},f:function(){try{a||null==n.return||n.return()}finally{if(f)throw u}}}}function o(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function u(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var f=function(){function t(e,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{overflow:!1};u(this,t),this._width=e,this._height=n,this._items=[],this._top_z=0,this._options=r}var e,n,o;return e=t,(n=[{key:"remove",value:function(t){for(var e in this._items)if(this._items[e].item===t){this._items.splice(e,1);break}return this}},{key:"resize",value:function(t,e){this._width=t,this._height=e}},{key:"append",value:function(t){var e;t.z===r?(this._top_z++,e=this._top_z):this._top_z=e=t.z,this._items.push({z:e,item:t}),t.canvas=this}},{key:"_sort",value:function(){this._items.sort((function(t,e){return t.z-e.z}))}},{key:"_matrix",value:function(){for(var t=[],e=this._height;e--;)t.push(new Array(this._width));return t}},{key:"_in_bound",value:function(t){return t<this._width||this._options.overflow}},{key:"_draw",value:function(t,e,n,r){if(!(r<0||r>this._height-1&&!this._options.overflow)){var o=n;if(n>0)for(var u=n;u--;)!t[r][u]&&this._in_bound(u)&&(t[r][u]=" ");var a,f=i(e);try{for(f.s();!(a=f.n()).done;){var s=a.value;if(!this._in_bound(o))break;t[r][o++]=s}}catch(t){f.e(t)}finally{f.f()}}}},{key:"toString",value:function(){this._sort();var t,e=this._matrix(),n=i(this._items);try{for(n.s();!(t=n.n()).done;){var r,o=t.value.item,u=o.text.split("\n"),a=o.y,f=i(u);try{for(f.s();!(r=f.n()).done;){var s=r.value;this._draw(e,s,o.x,a++)}}catch(t){f.e(t)}finally{f.f()}}}catch(t){n.e(t)}finally{n.f()}return e.map((function(t){return t.join("")})).join("\n")}},{key:"children",get:function(){return this._items}}])&&a(e.prototype,n),o&&a(e,o),t}();function s(t){return function(t){if(Array.isArray(t))return c(t)}(t)||function(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return c(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return c(t,e)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function c(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function h(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function y(t){return(t=Math.round(t))<0?0:t}var v=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=n.x,o=void 0===i?0:i,u=n.y,a=void 0===u?0:u,f=n.z,s=void 0===f?r:f;h(this,t),this.update(e),this._x=y(o),this._y=y(a),this._z=s}var e,n,i;return e=t,(n=[{key:"clone",value:function(){return new t(this._text,{x:this._x,y:this._y,z:this._z})}},{key:"update",value:function(t){this._text=t;var e=t.split("\n");return this._height=e.length,this._width=Math.max.apply(Math,s(e.map((function(t){return t.length})))),this}},{key:"move",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.x,n=void 0===e?r:e,i=t.y,o=void 0===i?r:i,u=t.z,a=void 0===u?r:u;return n!==r&&(this._x=n),o!==r&&(this._y=o),a!==r&&(this._z=a),this}},{key:"remove",value:function(){this._canvas&&this._canvas.remove_child(this)}},{key:"canvas",set:function(t){this.remove(),this._canvas=t},get:function(){return this._canvas}},{key:"text",get:function(){return this._text}},{key:"x",get:function(){return this._x}},{key:"y",get:function(){return this._y}},{key:"z",get:function(){return this._z}},{key:"rect",get:function(){return{x:this._x,y:this._y,z:this._z,width:this._width,height:this._height}}},{key:"width",get:function(){return this._width}},{key:"height",get:function(){return this._height}}])&&l(e.prototype,n),i&&l(e,i),t}()}])}));
  //# sourceMappingURL=umd.min.js.map