/*!
 * traviso.js - v0.1.5
 * Copyright (c) 2021, Hakan Karlidag - @axaq
 * www.travisojs.com
 *
 * Compiled: Thu, 15 Jul 2021 13:16:01 UTC
 *
 * traviso.js is licensed under the MIT License.
 * http://www.opensource.org/licenses/mit-license
 */
var TRAVISO=function(t,e){"use strict";var i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])})(t,e)};function n(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var o=function(){return(o=Object.assign||function(t){for(var e,i=1,n=arguments.length;i<n;i++)for(var o in e=arguments[i])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)},r=function(t){return null!=t},a=function(t,e,i,n,o,r){if(void 0===r&&(r=!1),r){if(t<e)return n;if(t>i)return o}return n+(o-n)*(t-e)/(i-e)},s=function(t){var e=Math.sqrt(t.x*t.x+t.y*t.y);return{x:t.x/e,y:t.y/e}},h=function(t,e){var i,n,o=t.y,r=t.x,a=e.length,s=!1;for(i=0,n=a-1;i<a;n=i++)e[i][1]>o!=e[n][1]>o&&r<(e[n][0]-e[i][0])*(o-e[i][1])/(e[n][1]-e[i][1])+e[i][0]&&(s=!s);return s},l=function(t,e){return Math.sqrt((e.x-t.x)*(e.x-t.x)+(e.y-t.y)*(e.y-t.y))},c={O:0,S:1,SW:2,W:3,NW:4,N:5,NE:6,E:7,SE:8},g=["idle","idle_s","idle_sw","idle_w","idle_nw","idle_n","idle_ne","idle_e","idle_se","move_s","move_sw","move_w","move_nw","move_n","move_ne","move_e","move_se"],p={ASTAR_ORTHOGONAL:0,ASTAR_DIAGONAL:1},u=!0;function f(t){u&&self.console.log("TRAVISO: "+t)}function d(t){return void 0===t&&(t=!0),u=t}var _=function(t,i,n){var o=t.mapData.objects[i];if(o){var r=null,a=o.textureNames[n];if(a&&a.length>0){r=[];for(var s=0;s<a.length;s++)r[r.length]=e.Texture.from(a[s])}else f("No textures defined for object type: "+i+" and visualId: "+n);return r}throw new Error("TRAVISO: No info defined for object type: "+i)},m=function(t){function i(i,n,o){void 0===o&&(o=.5);var r=t.call(this)||this;r.onContainerAnimComplete_delayed_binded=r.onContainerAnimComplete_delayed.bind(r),r.onContainerAnimComplete_binded=r.onContainerAnimComplete.bind(r),r._engine=i,r.type=n;var a=function(t,e){var i=t.mapData.objects[e];if(i){var n={};for(var o in i.textureNames)Object.prototype.hasOwnProperty.call(i.textureNames,o)&&(n[o]=_(t,e,o));return{m:i.m,i:i.i,f:i.f,nt:i.nt,t:n,io:i.io,s:i.s,rowSpan:i.rowSpan,columnSpan:i.columnSpan}}throw new Error("TRAVISO: No info defined for object type: "+e)}(r._engine,r.type);r.isMovableTo=a.m,r.isInteractive=a.i,r.interactive=r.interactiveChildren=!1,r.isFloorObject=a.f,r.noTransparency=a.nt,r.rowSpan=a.rowSpan,r.columnSpan=a.columnSpan;var s=r.rowSpan/(r.columnSpan+r.rowSpan);return r._textures=a.t,r._interactionOffsets=a.io,r.currentInteractionOffset=r._interactionOffsets.idle,r._container=new e.AnimatedSprite(r._textures.idle),r._container.interactive=r._container.interactiveChildren=!1,r._container.anchor.x=s,r._container.anchor.y=1,r.addChild(r._container),r.animSpeed=o,r._container.gotoAndStop(0),r}return n(i,t),Object.defineProperty(i.prototype,"animSpeed",{get:function(){return this._container.animationSpeed},set:function(t){this._container.animationSpeed=r(t)&&t>0?t:.5},enumerable:!1,configurable:!0}),i.prototype.changeVisualToDirection=function(t,e,i,n,o,r){if(void 0===e&&(e=!1),void 0===i&&(i=!1),void 0===n&&(n=!1),void 0===o&&(o=null),void 0===r&&(r=null),this.changeVisual(e?g[t+8]:function(t){return g[t]}(t),i,n,o,r))this.currentDirection=t;else{if(!this.changeVisual("idle",i,n,o,r))throw new Error("no 'idle' visual defined as backup for object type "+this.type);this.currentDirection=c.O}},i.prototype.changeVisual=function(t,e,i,n,o){return void 0===e&&(e=!1),void 0===i&&(i=!1),void 0===n&&(n=null),void 0===o&&(o=null),!!this._textures[t]&&(this.currentInteractionOffset=this._interactionOffsets[t],this._container.textures!==this._textures[t]||i?(this._container.textures=this._textures[t],!e&&this._textures[t].length>1?(this._container.loop=!i,i&&n&&(this.onContainerAnimCompleteCallback=n,this._container.onComplete=this.onContainerAnimComplete_binded),r(o)&&o>0&&(this.animSpeed=o),this._container.gotoAndPlay(0)):this._container.gotoAndStop(0),this._engine.objectUpdateCallback&&this._engine.objectUpdateCallback(this),!0):(this._container.loop=!i,r(o)&&o>0&&(this.animSpeed=o),!0))},i.prototype.onContainerAnimComplete=function(){setTimeout(this.onContainerAnimComplete_delayed_binded,100)},i.prototype.onContainerAnimComplete_delayed=function(){this.onContainerAnimCompleteCallback(this),this.onContainerAnimCompleteCallback=null},i.prototype.destroy=function(){this._container&&(this._engine=null,this._textures=null,this._container.onComplete=null,this._container=null)},i}(e.Container),b=function(t){function i(i,n){var o=t.call(this)||this;o._isHighlighted=!1,o.onHighlightTweenEnd_binded=o.onHighlightTweenEnd.bind(o),o._engine=i,o.type=n;var r=o._engine.tileHalfHeight,a=o._engine.tileHalfWidth;o.vertices=[[-a,0],[0,-r],[a,0],[0,r]];var s=function(t,i){var n=t.mapData.tiles[i];if(n)return{m:n.movable,t:n.path?[e.Texture.from(n.path)]:[]};if(t.mapData.singleGroundImage)return{m:parseInt(i)>0,t:[]};throw new Error("TRAVISO: No info defined for tile type: "+i)}(o._engine,o.type);if(o.isMovableTo=s.m,s.t.length>0&&(o._tileGraphics=new e.AnimatedSprite(s.t),o._tileGraphics.anchor.x=.5,o._tileGraphics.anchor.y=.5,o.addChild(o._tileGraphics),o._tileGraphics.gotoAndStop(parseInt(o.type))),o._engine.mapData.tileHighlightImage)o._highlightedOverlay=new e.Sprite(e.Texture.from(o._engine.mapData.tileHighlightImage.path)),o._highlightedOverlay.anchor.x=.5,o._highlightedOverlay.anchor.y=.5,o.addChild(o._highlightedOverlay);else{o._highlightedOverlay=new e.Graphics,o._highlightedOverlay.clear(),o._highlightedOverlay.lineStyle(o._engine.tileHighlightStrokeAlpha<=0?0:2,o._engine.tileHighlightStrokeColor,o._engine.tileHighlightStrokeAlpha),o._highlightedOverlay.beginFill(o._engine.tileHighlightFillColor,o._engine.tileHighlightFillAlpha),o._highlightedOverlay.moveTo(o.vertices[0][0],o.vertices[0][1]);for(var h=1;h<o.vertices.length;h++)o._highlightedOverlay.lineTo(o.vertices[h][0],o.vertices[h][1]);o._highlightedOverlay.lineTo(o.vertices[0][0],o.vertices[0][1]),o._highlightedOverlay.endFill(),o.addChild(o._highlightedOverlay)}return o._highlightedOverlay.scale.x=o._highlightedOverlay.scale.y=.1,o._highlightedOverlay.visible=!1,o}return n(i,t),i.prototype.setHighlighted=function(t,e){if(void 0===e&&(e=!1),this._isHighlighted!==t){if(e)return this._highlightedOverlay.scale.x=this._highlightedOverlay.scale.y=t?1:.1,this._highlightedOverlay.visible=t,void(this._isHighlighted=t);t&&(this._highlightedOverlay.visible=t),this._isHighlighted=t;var i=t?1:.1;this._highlightedOverlay.scale.x===i?this._highlightedOverlay.visible=t:(this._highlightedOverlay.scale.x=this._highlightedOverlay.scale.y=t?.1:1,this._engine.moveEngine.addTween(this._highlightedOverlay.scale,.5,{x:i,y:i},0,"linear",!0,this.onHighlightTweenEnd_binded))}},i.prototype.onHighlightTweenEnd=function(){this._highlightedOverlay.visible=this._isHighlighted},i.prototype.destroy=function(){this._engine&&(this._engine&&this._engine.moveEngine&&this._engine.moveEngine.killTweensOf(this._highlightedOverlay.scale),this._engine=null,this._highlightedOverlay=null,this._tileGraphics=null)},i}(e.Container),v=function(t,e,i,n){return i*t/n+e},y=function(t,e,i,n){return i*(t/=n)*t+e},T=function(t,e,i,n){return-i*(t/=n)*(t-2)+e},C=function(t,e,i,n){return(t/=n/2)<1?i/2*t*t+e:-i/2*(--t*(t-2)-1)+e},O=function(){function t(t,i){void 0===i&&(i=3),this._activeForMovables=!1,this._activeForTweens=!1,this._processFrame=!0,this._movables=[],this._tweenTargets=[],this._fps=60,this._engine=t,this._defaultSpeed=i,this._processFunc=this.run.bind(this),this._ticker=new e.Ticker,this._ticker.add(this._processFunc),this._ticker.start()}return t.prototype.addTween=function(t,e,i,n,o,r,a){void 0===n&&(n=0),void 0===o&&(o="linear"),void 0===r&&(r=!1),void 0===a&&(a=null);var s,h=null;for(var l in i)t[l]!==i[l]&&(h||(h={}),h[l]={b:t[l],c:i[l]-t[l]});if(h){var c={target:t,duration:e,delay:Number(n)||0,easingFunc:(s=o,"easeInOut"===s||"easeInOutQuad"===s||"Quad.easeInOut"===s?C:"easeIn"===s||"easeInQuad"===s||"Quad.easeIn"===s?y:"easeOut"===s||"easeOutQuad"===s||"Quad.easeOut"===s?T:v),overwrite:r||!1,onComplete:a||null,totalFrames:e*this._fps,currentFrame:0,vars:h};if(this._tweenTargets.indexOf(t)>=0){var g=t.tweens;if(g||(g=[]),c.overwrite){for(var p=0;p<g.length;p++)g[p]=null;g=[]}g[g.length]=c,t.tweens=g}else t.tweens=[c],this._tweenTargets[this._tweenTargets.length]=t;this._tweenTargets.length>0&&!this._activeForTweens&&(this._activeForTweens=!0)}},t.prototype.removeTween=function(t,e){var i=!1;if(t&&e){var n=this._tweenTargets.indexOf(t);if(!(n>=0))throw new Error("No tween target defined for this object");if(!(this._tweenTargets[n].tweens&&this._tweenTargets[n].tweens.length>0))throw new Error("No tween defined for this object");var o=this._tweenTargets[n].tweens,r=o.indexOf(e);if(!(r>=0))throw new Error("No tween defined for this object");e.onComplete=null,e.easingFunc=null,e.target=null,o.splice(r,1),0===o.length&&(this._tweenTargets.splice(n,1),i=!0),0===this._tweenTargets.length&&(this._activeForTweens=!1)}return i},t.prototype.killTweensOf=function(t){var e=!1,i=this._tweenTargets.indexOf(t);if(i>=0){if(this._tweenTargets[i].tweens&&this._tweenTargets[i].tweens.length>0){for(var n=this._tweenTargets[i].tweens,o=0;o<n.length;o++)n[o].onComplete=null,n[o].easingFunc=null,n[o].target=null,n[o]=null;this._tweenTargets[i].tweens=null}this._tweenTargets.splice(i,1),e=!0}return 0===this._tweenTargets.length&&(this._activeForTweens=!1),e},t.prototype.removeAllTweens=function(){var t,e,i;this._activeForTweens=!1;var n=this._tweenTargets.length;for(e=0;e<n;e++){for(t=this._tweenTargets[e].tweens,i=0;i<t.length;i++)t[i].onComplete=null,t[i].easingFunc=null,t[i].target=null,t[i]=null;this._tweenTargets[e].tweens=null,this._tweenTargets[e]=null}this._tweenTargets=[]},t.prototype.addMovable=function(t){this._movables.indexOf(t)>=0||(this._movables[this._movables.length]=t,this._movables.length>0&&!this._activeForMovables&&(this._activeForMovables=!0))},t.prototype.removeMovable=function(t){var e=this._movables.indexOf(t);return-1!==e&&(t.speedUnit={x:0,y:0},this._movables.splice(e,1)),0===this._movables.length&&(this._activeForMovables=!1),-1!==e},t.prototype.removeAllMovables=function(){this._activeForMovables=!1;for(var t=this._movables.length,e=0;e<t;e++)this._movables[e]=null;this._movables=[]},t.prototype.addNewPathToObject=function(t,e,i){t.currentPath&&t.currentTarget&&(e[e.length]=t.currentPath[t.currentPathStep]),t.currentPath=e,t.currentPathStep=t.currentPath.length-1,t.speedMagnitude=i||t.speedMagnitude||this._defaultSpeed},t.prototype.prepareForMove=function(t,e,i){void 0===i&&(i=null),t.currentPath=e,t.currentPathStep=t.currentPath.length-1,t.speedMagnitude=i||t.speedMagnitude||this._defaultSpeed},t.prototype.setMoveParameters=function(t,e){var i=this._engine.getTilePosXFor(e.r,e.c),n=this._engine.getTilePosYFor(e.r,e.c)+this._engine.tileHalfHeight;t.speedUnit=s({x:i-t.position.x,y:n-t.position.y}),t.currentTarget={x:i,y:n},t.currentReachThresh=Math.ceil(Math.sqrt(t.speedUnit.x*t.speedUnit.x+t.speedUnit.y*t.speedUnit.y)*t.speedMagnitude)},t.prototype.run=function(){if(this._processFrame){var t=void 0,e=void 0,i=void 0;if(this._activeForMovables){t=this._movables.length;for(i=0;i<t;i++)(e=this._movables[i]).prevPosition={x:e.position.x,y:e.position.y},e.currentTarget&&l(e.position,e.currentTarget)<=e.currentReachThresh?(e.position.x=e.currentTarget.x,e.position.y=e.currentTarget.y,this._engine.onObjMoveStepEnd(e),i--,t--):(e.position.x+=e.speedMagnitude*e.speedUnit.x,e.position.y+=e.speedMagnitude*e.speedUnit.y,this._engine.checkForTileChange(e),this._engine.checkForFollowCharacter(e))}if(this._activeForTweens){t=this._tweenTargets.length;var n=void 0,o=void 0,r=void 0,a=void 0,s=void 0;for(i=0;i<t;i++)for(r=(o=this._tweenTargets[i]).tweens,a=0;a<r.length;a++){for(var h in(n=r[a]).currentFrame++,s=n.vars)o[h]=n.easingFunc(n.currentFrame,s[h].b,s[h].c,n.totalFrames);n.currentFrame>=n.totalFrames&&(n.onComplete&&n.onComplete(),this.removeTween(o,n)&&(i--,t--),a--)}}}},t.prototype.destroy=function(){f("MoveEngine destroy"),this._processFrame=!1,this._ticker&&this._ticker.stop(),this.removeAllMovables(),this.removeAllTweens(),this._movables=null,this._tweenTargets=null,this._engine=null,this._ticker=null},t}(),w=function(){function t(t,e,i){this.x=t,this.y=e,this.weight=i,this.mapPos={c:t,r:e}}return t.prototype.toString=function(){return"["+String(this.x)+" "+String(this.y)+"]"},t.prototype.getCost=function(t){return t&&t.x!==this.x&&t.y!==this.y?1.41421*this.weight:this.weight},t.prototype.isWall=function(){return 0===this.weight},t}(),S=function(){function t(t){this.content=[],this.scoreFunction=t}return t.prototype.push=function(t){this.content.push(t),this.sinkDown(this.content.length-1)},t.prototype.pop=function(){var t=this.content[0],e=this.content.pop();return this.content.length>0&&(this.content[0]=e,this.bubbleUp(0)),t},t.prototype.size=function(){return this.content.length},t.prototype.rescoreElement=function(t){this.sinkDown(this.content.indexOf(t))},t.prototype.sinkDown=function(t){for(var e=this.content[t];t>0;){var i=(t+1>>1)-1,n=this.content[i];if(!(this.scoreFunction(e)<this.scoreFunction(n)))break;this.content[i]=e,this.content[t]=n,t=i}},t.prototype.bubbleUp=function(t){for(var e=this.content.length,i=this.content[t],n=this.scoreFunction(i),o=!0;o;){var r=t+1<<1,a=r-1,s=null,h=void 0;if(a<e){var l=this.content[a];(h=this.scoreFunction(l))<n&&(s=a)}if(r<e){var c=this.content[r];this.scoreFunction(c)<(null===s?n:h)&&(s=r)}if(null===s){o=!1;break}this.content[t]=this.content[s],this.content[s]=i,t=s}},t}(),j=function(){function t(e,i,n){void 0===n&&(n={}),this.nodes=[],this.diagonal=!!n.diagonal,this.heuristic=this.diagonal?t.HEURISTICS.diagonal:t.HEURISTICS.manhattan,this.closest=!!n.closest,this.grid=[];var o,r=0,a=0;for(r=0;r<e;r++)for(this.grid[r]=[],a=0;a<i;a++)o=new w(r,a,1),this.grid[r][a]=o,this.nodes.push(o);this.init()}return t.prototype.init=function(){this.dirtyNodes=[];for(var t=0;t<this.nodes.length;t++)this.cleanNode(this.nodes[t])},t.prototype.markDirty=function(t){this.dirtyNodes.push(t)},t.prototype.neighbors=function(t){var e=[],i=t.x,n=t.y,o=this.grid;return o[i-1]&&o[i-1][n]&&e.push(o[i-1][n]),o[i+1]&&o[i+1][n]&&e.push(o[i+1][n]),o[i]&&o[i][n-1]&&e.push(o[i][n-1]),o[i]&&o[i][n+1]&&e.push(o[i][n+1]),this.diagonal&&(o[i-1]&&o[i-1][n-1]&&e.push(o[i-1][n-1]),o[i+1]&&o[i+1][n-1]&&e.push(o[i+1][n-1]),o[i-1]&&o[i-1][n+1]&&e.push(o[i-1][n+1]),o[i+1]&&o[i+1][n+1]&&e.push(o[i+1][n+1])),e},t.prototype.toString=function(){var t,e,i,n,o,r,a=[],s=this.grid;for(i=0,n=s.length;i<n;i++){for(t=[],o=0,r=(e=s[i]).length;o<r;o++)t.push(e[o].weight);a.push(t.join(" "))}return a.join("\n")},t.prototype.solve=function(t,e,i,n){var o=this.grid[t][e],r=this.grid[i][n],a=this.search(o,r,{heuristic:this.heuristic,closest:this.closest});return a&&a.length>0?a:null},t.prototype.getAdjacentOpenCells=function(t,e,i,n){var o,r,a=[];for(o=e;o>e-n;o--)for(r=t;r<t+i;r++)a=a.concat(this.neighbors(this.grid[r][o]));return a},t.prototype.pathTo=function(t){for(var e=t,i=[];e.parent;)i.push(e),e=e.parent;return i},t.prototype.getHeap=function(){return new S((function(t){return t.f}))},t.prototype.search=function(e,i,n){void 0===n&&(n={}),this.init();var o=n.heuristic||t.HEURISTICS.manhattan,r=n.closest||!1,a=this.getHeap(),s=e;for(e.h=o(e,i),a.push(e);a.size()>0;){var h=a.pop();if(h===i)return this.pathTo(h);h.closed=!0;for(var l=this.neighbors(h),c=0,g=l.length;c<g;++c){var p=l[c];if(!p.closed&&!p.isWall()){var u=h.g+p.getCost(h),f=p.visited;(!f||u<p.g)&&(p.visited=!0,p.parent=h,p.h=p.h||o(p,i),p.g=u,p.f=p.g+p.h,this.markDirty(p),r&&(p.h<s.h||p.h===s.h&&p.g<s.g)&&(s=p),f?a.rescoreElement(p):a.push(p))}}}return r?this.pathTo(s):[]},t.prototype.cleanNode=function(t){t.f=0,t.g=0,t.h=0,t.visited=!1,t.closed=!1,t.parent=null},t.prototype.isCellFilled=function(t,e){return 0===this.grid[t][e].weight},t.prototype.setCell=function(t,e,i){this.grid[t][e].staticWeight=this.grid[t][e].weight=i},t.prototype.setDynamicCell=function(t,e,i){0!==this.grid[t][e].staticWeight&&(this.grid[t][e].weight=i)},t.prototype.destroy=function(){this.grid=null,this.nodes=null,this.dirtyNodes=null,this.heuristic=null},t.HEURISTICS={manhattan:function(t,e){return Math.abs(e.x-t.x)+Math.abs(e.y-t.y)},diagonal:function(t,e){var i=Math.sqrt(2),n=Math.abs(e.x-t.x),o=Math.abs(e.y-t.y);return 1*(n+o)+(i-2)*Math.min(n,o)}},t}(),P=function(t){function i(e){var n=t.call(this)||this;return n._posFrame={x:0,y:0,w:800,h:600},n._dragging=!1,n.onMouseUp_binded=n.onMouseUp.bind(n),n.onMouseDown_binded=n.onMouseDown.bind(n),n.onMouseMove_binded=n.onMouseMove.bind(n),n._config=e,n._config.followCharacter=!r(n._config.followCharacter)||n._config.followCharacter,n._config.changeTransparencies=!r(n._config.changeTransparencies)||n._config.changeTransparencies,n._config.highlightPath=!r(n._config.highlightPath)||n._config.highlightPath,n._config.highlightTargetTile=!r(n._config.highlightTargetTile)||n._config.highlightTargetTile,n._config.tileHighlightAnimated=!r(n._config.tileHighlightAnimated)||n._config.tileHighlightAnimated,n._config.tileHighlightFillColor=r(n._config.tileHighlightFillColor)?n._config.tileHighlightFillColor:8443903,n._config.tileHighlightFillAlpha=r(n._config.tileHighlightFillAlpha)?n._config.tileHighlightFillAlpha:.5,n._config.tileHighlightStrokeColor=r(n._config.tileHighlightStrokeColor)?n._config.tileHighlightStrokeColor:16777215,n._config.tileHighlightStrokeAlpha=r(n._config.tileHighlightStrokeAlpha)?n._config.tileHighlightStrokeAlpha:1,n._config.dontAutoMoveToTile=!!r(n._config.dontAutoMoveToTile)&&n._config.dontAutoMoveToTile,n._config.checkPathOnEachTile=!r(n._config.checkPathOnEachTile)||n._config.checkPathOnEachTile,n._config.mapDraggable=!r(n._config.mapDraggable)||n._config.mapDraggable,n._config.isoAngle=r(n._config.isoAngle)?n._config.isoAngle:i.DEFAULT_ISO_ANGLE,n._config.tileHeight=r(n._config.tileHeight)?n._config.tileHeight:i.DEFAULT_TILE_H,n.setZoomParameters(n._config.minScale,n._config.maxScale,n._config.numberOfZoomLevels,n._config.initialZoomLevel,n._config.instantCameraZoom),n.tileHalfHeight=n._config.tileHeight/2,n.tileHalfWidth=n.tileHalfHeight*Math.tan((90-n._config.isoAngle)*Math.PI/180),n.loadAssetsAndData(),n}return n(i,t),i.prototype.loadAssetsAndData=function(){if(!this._config.mapDataPath)throw new Error("TRAVISO: No JSON-file path defined for map data. Please check your configuration object that you pass to the 'getEngineInstance' method.");if("json"!==this._config.mapDataPath.split(".").pop())throw new Error("TRAVISO: Invalid map-data file path. This file has to be a json file.");var t=new e.Loader;t.add("mapData",this._config.mapDataPath),this._config.assetsToLoad&&this._config.assetsToLoad.length>0&&t.add(this._config.assetsToLoad),t.load(this.assetsAndDataLoaded.bind(this))},i.prototype.assetsAndDataLoaded=function(t){var e,i,n,o=t.resources.mapData.data;r(o.initialControllableLocation)?r(o.initialControllableLocation.columnIndex)&&r(o.initialControllableLocation.rowIndex)||(f("Map-data file warning: 'initialControllableLocation' exists but it is not defined properly."),o.initialControllableLocation=null):f("Map-data file warning: No 'initialControllableLocation' defined. Ignore this warning if you are adding it later manually."),o.tileHighlightImage&&!o.tileHighlightImage.path&&(f("Map-data file warning: 'tileHighlightImage' exists but its 'path' is not defined properly."),o.tileHighlightImage=null),o.singleGroundImage&&!o.singleGroundImage.path&&(f("Map-data file warning: 'singleGroundImage' exists but its 'path' is not defined properly."),o.singleGroundImage=null);var a,s,h,l,c,g,p,u,d=o.groundMap;for(o.groundMapData=[],e=0;e<d.length;e++){for(i=(n=String(d[e].row).replace(/\s/g,"").split(",")).length;i--;)n[i]=n[i]||"0";o.groundMapData[e]=n}for(d=o.objectsMap,o.objectsMapData=[],e=0;e<d.length;e++){for(i=(n=String(d[e].row).replace(/\s/g,"").split(",")).length;i--;)n[i]=n[i]||"0";o.objectsMapData[e]=n}for(s in r(o.tiles)||(f("Map-data file warning: No 'tiles' defined."),o.tiles={}),r(o.objects)||(f("Map-data file warning: No 'objects' defined."),o.objects={}),o.objects){if(a=o.objects[s],!r(a.visuals))throw new Error("TRAVISO: No visuals defined in data-file for object type: "+s);for(l in a.id=s,r(a.rowSpan)||(a.rowSpan=1),r(a.columnSpan)||(a.columnSpan=1),g={},c={},a.visuals)if(h=a.visuals[l],r(h.ipor)&&r(h.ipoc)&&(c[l]={c:Number(h.ipoc),r:Number(h.ipor)}),h.frames&&h.frames.length>0)for(g[l]=[],p=0;p<h.frames.length;p++)g[l][p]=h.frames[p].path;else{if(!h.path||!h.extension||!h.numberOfFrames||h.numberOfFrames<1)throw new Error("TRAVISO: Invalid or missing visual attributes detected in data-file for visual with id: "+l);if(g[l]=[],1===h.numberOfFrames)g[l][0]=h.path+"."+h.extension;else for(u=0,p=h.startIndex;p<h.numberOfFrames;p++)g[l][u++]=h.path+String(p)+"."+h.extension}a.textureNames=g,a.io=c,a.f=!!a.floor,a.nt=!!a.noTransparency,a.m=!!a.movable,a.i=!!a.interactive}delete o.objectsMap,delete o.groundMap,this.mapData=o,this.onAllAssetsLoaded()},i.prototype.onAllAssetsLoaded=function(){f("All assets loaded"),this.moveEngine=new O(this),this._currentScale=1,this._currentZoom=0,this._posFrame=this._config.initialPositionFrame||{x:0,y:0,w:800,h:600},this._externalCenter={x:this._posFrame.w>>1,y:this._posFrame.h>>1},this.createMap(),this.repositionContent(this._config.initialPositionFrame),this.enableInteraction(),this._config.engineInstanceReadyCallback&&this._config.engineInstanceReadyCallback(this)},i.prototype.createMap=function(){this._config.backgroundColor&&(this._bg=new e.Graphics,this.addChild(this._bg)),this._config.useMask&&(this._mapMask=new e.Graphics,this.addChild(this._mapMask)),this._mapContainer=new e.Container,this.addChild(this._mapContainer),this._groundContainer=new e.Container,this._mapContainer.addChild(this._groundContainer),this._objContainer=new e.Container,this._mapContainer.addChild(this._objContainer);var t,i,n,o,r=this.mapData.groundMapData,a=this.mapData.objectsMapData,s=this.mapData.initialControllableLocation;for(this._mapSizeR=r.length,this._mapSizeC=r[0].length,this.mapData.singleGroundImage&&(t=new e.Sprite(e.Texture.from(this.mapData.singleGroundImage.path)),this._groundContainer.addChild(t),t.scale.set(this.mapData.singleGroundImage.scale||1)),this._tileArray=[],this._objArray=[],i=0;i<this._mapSizeR;i++)for(this._tileArray[i]=[],this._objArray[i]=[],n=0;n<this._mapSizeC;n++)this._tileArray[i][n]=null,this._objArray[i][n]=null;for(this._pathFinding=new j(this._mapSizeC,this._mapSizeR,{diagonal:this._config.pathFindingType===p.ASTAR_DIAGONAL,closest:this._config.pathFindingClosest}),i=0;i<this._mapSizeR;i++)for(n=this._mapSizeC-1;n>=0;n--)this._tileArray[i][n]=null,r[i][n]&&"0"!==r[i][n]?((o=new b(this,r[i][n])).position.x=this.getTilePosXFor(i,n),o.position.y=this.getTilePosYFor(i,n),o.mapPos={c:n,r:i},this._tileArray[i][n]=o,this._groundContainer.addChild(o),o.isMovableTo||this._pathFinding.setCell(n,i,0)):this._pathFinding.setCell(n,i,0);var h,l=!1;for(i=0;i<this._mapSizeR;i++)for(n=this._mapSizeC-1;n>=0;n--)this._objArray[i][n]=null,a[i][n]&&"0"!==a[i][n]&&((h=new m(this,a[i][n])).position.x=this.getTilePosXFor(i,n),h.position.y=this.getTilePosYFor(i,n)+this.tileHalfHeight,h.mapPos={c:n,r:i},!l&&h.isFloorObject&&(l=!0),this._objContainer.addChild(h),this.addObjRefToLocation(h,h.mapPos),s&&s.columnIndex===n&&s.rowIndex===i&&(this._currentControllable=h));if(l){var c=void 0,g=void 0;for(i=0;i<this._mapSizeR;i++)for(n=this._mapSizeC-1;n>=0;n--)if(c=this._objArray[i][n])for(g=0;g<c.length;g++)c[g].isFloorObject||this._objContainer.addChild(c[g])}this._mapVertices=[[this.getTilePosXFor(0,0)-this.tileHalfWidth,this.getTilePosYFor(0,0)],[this.getTilePosXFor(0,this._mapSizeC-1),this.getTilePosYFor(0,this._mapSizeC-1)-this.tileHalfHeight],[this.getTilePosXFor(this._mapSizeR-1,this._mapSizeC-1)+this.tileHalfWidth,this.getTilePosYFor(this._mapSizeR-1,this._mapSizeC-1)],[this.getTilePosXFor(this._mapSizeR-1,0),this.getTilePosYFor(this._mapSizeR-1,0)+this.tileHalfHeight]],this._mapVisualWidthReal=this.getTilePosXFor(this._mapSizeR-1,this._mapSizeC-1)-this.getTilePosXFor(0,0),this._mapVisualHeightReal=this.getTilePosYFor(this._mapSizeR-1,0)-this.getTilePosYFor(0,this._mapSizeC-1),t&&(t.position.x=this._mapVertices[0][0]+this.tileHalfWidth+(this._mapVisualWidthReal-t.width)/2,t.position.y=this._mapVertices[1][1]+this.tileHalfHeight+(this._mapVisualHeightReal-t.height)/2),this.zoomTo(this._config.initialZoomLevel,!0),this._config.followCharacter&&s?this.centralizeToLocation(s.columnIndex,s.rowIndex,!0):this.centralizeToCurrentExternalCenter(!0)},i.prototype.getTilePosXFor=function(t,e){return e*this.tileHalfWidth+t*this.tileHalfWidth},i.prototype.getTilePosYFor=function(t,e){return t*this.tileHalfHeight-e*this.tileHalfHeight},i.prototype.showHideObjectLayer=function(t){void 0===t&&(t=!1),this._objContainer.visible=t},i.prototype.showHideGroundLayer=function(t){void 0===t&&(t=!1),this._groundContainer.visible=t},i.prototype.getTileAtRowAndColumn=function(t,e){return this._tileArray[t][e]},i.prototype.getObjectsAtRowAndColumn=function(t,e){return this._objArray[t][e]},i.prototype.getObjectsAtLocation=function(t){return this._objArray[t.r][t.c]},i.prototype.createAndAddObjectToLocation=function(t,e){return this.addObjectToLocation(new m(this,t),e)},i.prototype.addObjectToLocation=function(t,e){return t.position.x=this.getTilePosXFor(e.r,e.c),t.position.y=this.getTilePosYFor(e.r,e.c)+this.tileHalfHeight,t.mapPos={c:e.c,r:e.r},this._objContainer.addChild(t),this.addObjRefToLocation(t,t.mapPos),this.arrangeDepthsFromLocation(t.isFloorObject?{c:this._mapSizeC-1,r:0}:t.mapPos),t},i.prototype.addCustomObjectToLocation=function(t,e){return t.isMovableTo=!r(t.isMovableTo)||t.isMovableTo,t.columnSpan=t.columnSpan||1,t.rowSpan=t.rowSpan||1,this.addObjectToLocation(t,e)},i.prototype.removeObjectFromLocation=function(t,e){e=e||t.mapPos,this._objContainer.removeChild(t),this.removeObjRefFromLocation(t,e)},i.prototype.focusMapToObject=function(t){this.focusMapToLocation(t.mapPos.c+(t.columnSpan-1)/2,t.mapPos.r-(t.rowSpan-1)/2,0)},i.prototype.focusMapToLocation=function(t,e,i){this.zoomTo(i,!1),this.centralizeToLocation(t,e,this._config.instantCameraRelocation)},i.prototype.centralizeToObject=function(t){this.centralizeToLocation(t.mapPos.c,t.mapPos.r,this._config.instantCameraRelocation)},i.prototype.centralizeToLocation=function(t,e,i){this._currentFocusLocation={c:t,r:e};var n=this._externalCenter.x+(this._mapVisualWidthScaled>>1)-this.getTilePosXFor(e,t)*this._currentScale,o=this._externalCenter.y-this.getTilePosYFor(e,t)*this._currentScale;this.centralizeToPoint(n,o,i)},i.prototype.centralizeToCurrentFocusLocation=function(t){this.centralizeToLocation(this._currentFocusLocation.c,this._currentFocusLocation.r,t)},i.prototype.centralizeToCurrentExternalCenter=function(t){this._externalCenter&&(this._currentFocusLocation={c:this._mapSizeC>>1,r:this._mapSizeR>>1},this.centralizeToPoint(this._externalCenter.x,this._externalCenter.y,t))},i.prototype.centralizeToPoint=function(t,e,i){this._tileArray&&(t-=this._mapVisualWidthScaled>>1,r(i)&&i||!r(i)&&this._config.instantCameraRelocation?(this._mapContainer.position.x=t,this._mapContainer.position.y=e):this.moveEngine.addTween(this._mapContainer.position,.5,{x:t,y:e},0,"easeInOut",!0))},i.prototype.setZoomParameters=function(t,e,i,n,o){void 0===t&&(t=.5),void 0===e&&(e=1.5),void 0===i&&(i=5),void 0===n&&(n=0),void 0===o&&(o=!1),this._config.minScale=t,this._config.maxScale=e,this._config.minZoom=-1,this._config.maxZoom=1,this._config.zoomIncrement=r(i)?i<=1?0:2/(i-1):.5,this._config.initialZoomLevel=n,this._config.instantCameraZoom=o},i.prototype.setScale=function(t,e){t<this._config.minScale?t=this._config.minScale:t>this._config.maxScale&&(t=this._config.maxScale),this._currentScale=t,this._mapVisualWidthScaled=this._mapVisualWidthReal*this._currentScale,r(e)&&e||!r(e)&&this._config.instantCameraZoom?this._mapContainer.scale.set(this._currentScale):this.moveEngine.addTween(this._mapContainer.scale,.5,{x:this._currentScale,y:this._currentScale},0,"easeInOut",!0)},i.prototype.zoomTo=function(t,e){var i=a(t=t||0,this._config.minZoom,this._config.maxZoom,this._config.minScale,this._config.maxScale,!0);i=Math.round(10*i)/10,this._currentZoom=a(i,this._config.minScale,this._config.maxScale,this._config.minZoom,this._config.maxZoom,!0),this._externalCenter=this._externalCenter?this._externalCenter:{x:this._mapVisualWidthScaled>>1,y:0};var n=this._mapContainer.position.x+(this._mapVisualWidthScaled>>1)-this._externalCenter.x,o=this._mapContainer.position.y-this._externalCenter.y,s=this._currentScale;this.setScale(i,e);var h=this._currentScale/s;this.centralizeToPoint(this._externalCenter.x+n*h,this._externalCenter.y+o*h,r(e)&&e||!r(e)&&this._config.instantCameraZoom)},i.prototype.zoomOut=function(t){this.zoomTo(this._currentZoom-this._config.zoomIncrement,t)},i.prototype.zoomIn=function(t){this.zoomTo(this._currentZoom+this._config.zoomIncrement,t)},i.prototype.getCurrentControllable=function(){return this._currentControllable},i.prototype.setCurrentControllable=function(t){this._currentControllable=t},i.prototype.addObjRefToLocation=function(t,e){var i,n;for(i=e.c;i<e.c+t.columnSpan;i++)for(n=e.r;n>e.r-t.rowSpan;n--)this.addObjRefToSingleLocation(t,{c:i,r:n})},i.prototype.addObjRefToSingleLocation=function(t,e){this._objArray[e.r][e.c]||(this._objArray[e.r][e.c]=[]),this._objArray[e.r][e.c].indexOf(t)<0&&this._objArray[e.r][e.c].push(t),t.isMovableTo||this._pathFinding.setDynamicCell(e.c,e.r,0)},i.prototype.removeObjRefFromLocation=function(t,e){var i,n;for(i=e.c;i<e.c+t.columnSpan;i++)for(n=e.r;n>e.r-t.rowSpan;n--)this.removeObjRefFromSingleLocation(t,{c:i,r:n})},i.prototype.removeObjRefFromSingleLocation=function(t,e){if(this._objArray[e.r][e.c]){var i=this._objArray[e.r][e.c].indexOf(t);if(i>-1&&this._objArray[e.r][e.c].splice(i,1),0===this._objArray[e.r][e.c].length)this._pathFinding.setDynamicCell(e.c,e.r,1),this._objArray[e.r][e.c]=null;else for(var n=this._objArray[e.r][e.c],o=n.length,r=0;r<o;r++){if(!n[r].isMovableTo){this._pathFinding.setDynamicCell(e.c,e.r,0);break}r===o-1&&this._pathFinding.setDynamicCell(e.c,e.r,1)}}},i.prototype.changeObjAlphasInLocation=function(t,e){var i=this._objArray[e.r][e.c];if(i)for(var n=i.length,o=0;o<n;o++)i[o].isFloorObject||i[o].noTransparency||(i[o].alpha=t)},i.prototype.arrangeObjLocation=function(t,e){this.removeObjRefFromLocation(t,t.mapPos),this.addObjRefToLocation(t,e),t.mapPos={c:e.c,r:e.r}},i.prototype.arrangeObjTransparencies=function(t,e,i){this._config.changeTransparencies&&(this._currentControllable===t&&(e.c>0&&this.changeObjAlphasInLocation(1,{c:e.c-1,r:e.r}),e.c>0&&e.r<this._mapSizeR-1&&this.changeObjAlphasInLocation(1,{c:e.c-1,r:e.r+1}),e.r<this._mapSizeR-1&&this.changeObjAlphasInLocation(1,{c:e.c,r:e.r+1}),i.c>0&&this.changeObjAlphasInLocation(.7,{c:i.c-1,r:i.r}),i.c>0&&i.r<this._mapSizeR-1&&this.changeObjAlphasInLocation(.7,{c:i.c-1,r:i.r+1}),i.r<this._mapSizeR-1&&this.changeObjAlphasInLocation(.7,{c:i.c,r:i.r+1})),t.alpha=1)},i.prototype.arrangeDepthsFromLocation=function(t){var e,i,n,o;for(i=t.r;i<this._mapSizeR;i++)for(n=t.c;n>=0;n--)if(e=this._objArray[i][n])for(o=0;o<e.length;o++)e[o].isFloorObject||this._objContainer.addChild(e[o])},i.prototype.arrangePathHighlight=function(t,e){var i,n;if(t)for(i=0;i<t.length;i++)n=t[i],e&&-1!==e.indexOf(n)||this._tileArray[n.mapPos.r][n.mapPos.c].setHighlighted(!1,!this._config.tileHighlightAnimated);if(e)for(i=0;i<e.length;i++)n=e[i],t&&-1!==t.indexOf(n)||this._tileArray[n.mapPos.r][n.mapPos.c].setHighlighted(!0,!this._config.tileHighlightAnimated)},i.prototype.stopObject=function(t){t.currentPath=null,t.currentTarget=null,t.currentTargetTile=null,this.moveEngine.removeMovable(t)},i.prototype.moveObjThrough=function(t,e,i){if(void 0===i&&(i=null),this._config.instantObjectRelocation){var n=this._tileArray[e[0].mapPos.r][e[0].mapPos.c];t.position.x=n.position.x,t.position.y=n.position.y+this.tileHalfHeight,this.arrangeObjTransparencies(t,t.mapPos,n.mapPos),this.arrangeObjLocation(t,n.mapPos),this.arrangeDepthsFromLocation(n.mapPos)}else this._config.highlightPath&&this._currentControllable===t&&this.arrangePathHighlight(t.currentPath,e),t.currentTarget&&this.stopObject(t),this.moveEngine.prepareForMove(t,e,i),t.currentTargetTile=t.currentPath[t.currentPathStep],this.onObjMoveStepBegin(t,t.currentPath[t.currentPathStep].mapPos)},i.prototype.onObjMoveStepBegin=function(t,e){var i,n,o,r,a;return t.currentDirection=(i=t.mapPos.r,n=t.mapPos.c,o=e.r,r=e.c,a=c.S,i===o?a=n===r?c.O:n<r?c.NE:c.SW:i<o?a=n===r?c.SE:n<r?c.E:c.S:i>o&&(a=n===r?c.NW:n<r?c.N:c.W),a),t.changeVisualToDirection(t.currentDirection,!0),this._pathFinding.isCellFilled(e.c,e.r)?(this.moveEngine.removeMovable(t),this.checkAndMoveObjectToLocation(t,t.currentPath[0].mapPos),!1):(this.moveEngine.setMoveParameters(t,e),this.moveEngine.addMovable(t),!0)},i.prototype.onObjMoveStepEnd=function(t){t.currentPathStep--,t.currentTarget=null,t.currentTargetTile=null;var e=0>t.currentPathStep;(this.moveEngine.removeMovable(t),e?t.changeVisualToDirection(t.currentDirection,!1):this._config.checkPathOnEachTile?this.checkAndMoveObjectToLocation(t,t.currentPath[0].mapPos):(t.currentPath.splice(t.currentPath.length-1,1),this.moveObjThrough(t,t.currentPath)),this._currentControllable===t)&&this._tileArray[t.mapPos.r][t.mapPos.c].setHighlighted(!1,!this._config.tileHighlightAnimated);e&&this._config.objectReachedDestinationCallback&&this._config.objectReachedDestinationCallback(t)},i.prototype.checkForFollowCharacter=function(t){if(this._config.followCharacter&&this._currentControllable===t){this._currentFocusLocation={c:t.mapPos.c,r:t.mapPos.r};var e=this._externalCenter.x-t.position.x*this._currentScale,i=this._externalCenter.y-t.position.y*this._currentScale;this.moveEngine.addTween(this._mapContainer.position,.1,{x:e,y:i},0,"easeOut",!0)}},i.prototype.checkForTileChange=function(t){this._config.objectUpdateCallback&&this._config.objectUpdateCallback(t);for(var e={x:t.position.x,y:t.position.y-this.tileHalfHeight},i=this._tileArray[t.currentTargetTile.mapPos.r][t.currentTargetTile.mapPos.c],n=[],o=0;o<i.vertices.length;o++)n[o]=[i.vertices[o][0]+i.position.x,i.vertices[o][1]+i.position.y];if((t.currentTargetTile.mapPos.r!==t.mapPos.r||t.currentTargetTile.mapPos.c!==t.mapPos.c)&&h(e,n)){this.arrangeObjTransparencies(t,t.mapPos,t.currentTargetTile.mapPos),this.arrangeObjLocation(t,t.currentTargetTile.mapPos),this.arrangeDepthsFromLocation(t.mapPos);var r=this.getObjectsAtLocation(t.currentTargetTile.mapPos);r&&r.length>1&&this._config.otherObjectsOnTheNextTileCallback&&this._config.otherObjectsOnTheNextTileCallback(t,r)}},i.prototype.getPath=function(t,e){if(this._pathFinding)return this._pathFinding.solve(t.c,t.r,e.c,e.r);throw new Error("Path finding hasn't been initialized yet!")},i.prototype.checkAndMoveObjectToTile=function(t,e,i){return void 0===i&&(i=null),!!e.isMovableTo&&this.checkAndMoveObjectToLocation(t,e.mapPos,i)},i.prototype.checkAndMoveObjectToLocation=function(t,e,i){void 0===i&&(i=null);var n=this.getPath(t.mapPos,e);return!!n&&(this.moveObjThrough(t,n,i),n.length>0)},i.prototype.moveCurrentControllableToLocation=function(t,e){if(void 0===e&&(e=null),!this._currentControllable)throw new Error("TRAVISO: _currentControllable is not defined!");return this.checkAndMoveObjectToLocation(this._currentControllable,t,e)},i.prototype.moveCurrentControllableToObj=function(t,e){if(void 0===e&&(e=null),!this._currentControllable)throw new Error("TRAVISO: _currentControllable is not defined!");if(t.currentInteractionOffset){var i={c:t.mapPos.c+t.currentInteractionOffset.c,r:t.mapPos.r+t.currentInteractionOffset.r};if(this.checkAndMoveObjectToLocation(this._currentControllable,i,e))return!0}for(var n,o,r,a,s=this._pathFinding.getAdjacentOpenCells(t.mapPos.c,t.mapPos.r,t.columnSpan,t.rowSpan),h=3e3,l=0;l<s.length;l++)if(n=this._tileArray[s[l].mapPos.r][s[l].mapPos.c]){if(n.mapPos.c===this._currentControllable.mapPos.c&&n.mapPos.r===this._currentControllable.mapPos.r)return this.arrangePathHighlight(this._currentControllable.currentPath,null),this.stopObject(this._currentControllable),a=this._config.instantObjectRelocation,this._config.instantObjectRelocation=!0,this.moveObjThrough(this._currentControllable,[new w(n.mapPos.c,n.mapPos.r,1)]),this._config.instantObjectRelocation=a,this._currentControllable.changeVisualToDirection(this._currentControllable.currentDirection,!1),this._config.objectReachedDestinationCallback&&this._config.objectReachedDestinationCallback(this._currentControllable),!0;(o=this.getPath(this._currentControllable.mapPos,n.mapPos))&&o.length<h&&(h=o.length,r=o)}return!!r&&(this.moveObjThrough(this._currentControllable,r,e),!0)},i.prototype.getTileFromLocalPos=function(t){var e=null;if(h(t,this._mapVertices)){var i=this.tileHalfWidth/2,n=void 0,o=void 0,r=void 0,a=void 0,s=3e3;for(o=0;o<this._mapSizeR;o++)for(r=0;r<this._mapSizeC&&!((n=this._tileArray[o][r])&&(a=l(t,n.position))<s&&(s=a,e=n,a<i));r++);}return e},i.prototype.checkForTileClick=function(t){var e=this._mapContainer.toLocal(t.global),i=this.getTileFromLocalPos(e);if(i){var n=this._objArray[i.mapPos.r][i.mapPos.c];if(n)for(var o=0;o<n.length;o++){if(n[o].isInteractive){this._config.objectSelectCallback&&this._config.objectSelectCallback(n[o]);break}if(n[o].isMovableTo&&(this._config.dontAutoMoveToTile||!this._currentControllable||this.checkAndMoveObjectToTile(this._currentControllable,i))){this._config.highlightTargetTile&&i.setHighlighted(!0,!this._config.tileHighlightAnimated),this._config.tileSelectCallback&&this._config.tileSelectCallback(i.mapPos.r,i.mapPos.c);break}}else(this._config.dontAutoMoveToTile||!this._currentControllable||this.checkAndMoveObjectToTile(this._currentControllable,i))&&(this._config.highlightTargetTile&&i.setHighlighted(!0,!this._config.tileHighlightAnimated),this._config.tileSelectCallback&&this._config.tileSelectCallback(i.mapPos.r,i.mapPos.c))}},i.prototype.enableInteraction=function(){this.on("pointerdown",this.onMouseDown_binded).on("pointerup",this.onMouseUp_binded).on("pointerupoutside",this.onMouseUp_binded).on("pointermove",this.onMouseMove_binded),this.interactive=!0},i.prototype.disableInteraction=function(){this.off("pointerdown",this.onMouseDown_binded).off("pointerup",this.onMouseUp_binded).off("pointerupoutside",this.onMouseUp_binded).off("pointermove",this.onMouseMove_binded),this.interactive=!0,this._dragging=!1},i.prototype.isInteractionInMask=function(t){return!this._config.useMask||!(t.x<this._posFrame.x||t.y<this._posFrame.y||t.x>this._posFrame.x+this._posFrame.w||t.y>this._posFrame.y+this._posFrame.h)},i.prototype.onMouseDown=function(t){var e=t.data.global;!this._dragging&&this.isInteractionInMask(e)&&(this._dragging=!0,this._dragInitStartingX=this._dragPrevStartingX=e.x,this._dragInitStartingY=this._dragPrevStartingY=e.y)},i.prototype.onMouseMove=function(t){if(this._dragging&&this._config.mapDraggable){var e=t.data.global;this._mapContainer.position.x+=e.x-this._dragPrevStartingX,this._mapContainer.position.y+=e.y-this._dragPrevStartingY,this._dragPrevStartingX=e.x,this._dragPrevStartingY=e.y}},i.prototype.onMouseUp=function(t){if(this._dragging){this._dragging=!1;var e=t.data.global.x-this._dragInitStartingX,i=t.data.global.y-this._dragInitStartingY;Math.abs(e)<5&&Math.abs(i)<5&&this.checkForTileClick(t.data)}},i.prototype.repositionContent=function(t){void 0===t&&(t=null),f("EngineView repositionContent"),t=t||this._posFrame||{x:0,y:0,w:800,h:600},this.position.x=t.x,this.position.y=t.y,this._externalCenter={x:t.w>>1,y:t.h>>1},this.centralizeToCurrentFocusLocation(!0),this._bg&&(this._bg.clear(),this._bg.beginFill(this._config.backgroundColor,1),this._bg.drawRect(0,0,t.w,t.h),this._bg.endFill()),this._mapMask&&this._mapContainer&&(this._mapMask.clear(),this._mapMask.beginFill(0),this._mapMask.drawRect(0,0,t.w,t.h),this._mapMask.endFill(),this._mapContainer.mask=this._mapMask),this._posFrame=t},i.prototype.destroy=function(){var t,e,i,n;for(f("EngineView destroy"),this.disableInteraction(),this.moveEngine.destroy(),this.moveEngine=null,e=0;e<this._mapSizeR;e++)for(i=this._mapSizeC-1;i>=0;i--){if((t=this._tileArray[e][i])&&t.destroy(),this._tileArray[e][i]=null,t=this._objArray[e][i])for(n=0;n<t.length;n++)t[n]&&t[n].destroy(),t[n]=null;this._objArray[e][i]=null}t=null,this._pathFinding.destroy(),this._pathFinding=null,this._currentControllable=null,this._tileArray=null,this._objArray=null,this._bg=null,this._groundContainer=null,this._objContainer=null,this._mapContainer&&(this._mapContainer.mask=null,this.removeChild(this._mapContainer),this._mapContainer=null),this._mapMask&&(this.removeChild(this._mapMask),this._mapMask=null),this._config=null,this.mapData.groundMapData=null,this.mapData.objectsMapData=null,this.mapData.objects=null,this.mapData.tiles=null,this.mapData=null},Object.defineProperty(i.prototype,"instantCameraZoom",{get:function(){return this._config.instantCameraZoom},set:function(t){this._config.instantCameraZoom=t},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"followCharacter",{get:function(){return this._config.followCharacter},set:function(t){this._config.followCharacter=t},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"instantCameraRelocation",{get:function(){return this._config.instantCameraRelocation},set:function(t){this._config.instantCameraRelocation=t},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"instantObjectRelocation",{get:function(){return this._config.instantObjectRelocation},set:function(t){this._config.instantObjectRelocation=t},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"changeTransparencies",{get:function(){return this._config.changeTransparencies},set:function(t){this._config.changeTransparencies=t},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"highlightPath",{get:function(){return this._config.highlightPath},set:function(t){this._config.highlightPath=t},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"highlightTargetTile",{get:function(){return this._config.highlightTargetTile},set:function(t){this._config.highlightTargetTile=t},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"tileHighlightAnimated",{get:function(){return this._config.tileHighlightAnimated},set:function(t){this._config.tileHighlightAnimated=t},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"dontAutoMoveToTile",{get:function(){return this._config.dontAutoMoveToTile},set:function(t){this._config.dontAutoMoveToTile=t},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"checkPathOnEachTile",{get:function(){return this._config.checkPathOnEachTile},set:function(t){this._config.checkPathOnEachTile=t},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"mapDraggable",{get:function(){return this._config.mapDraggable},set:function(t){this._config.mapDraggable=t},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"engineInstanceReadyCallback",{get:function(){return this._config.engineInstanceReadyCallback},set:function(t){this._config.engineInstanceReadyCallback=t},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"tileSelectCallback",{get:function(){return this._config.tileSelectCallback},set:function(t){this._config.tileSelectCallback=t},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"objectSelectCallback",{get:function(){return this._config.objectSelectCallback},set:function(t){this._config.objectSelectCallback=t},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"objectReachedDestinationCallback",{get:function(){return this._config.objectReachedDestinationCallback},set:function(t){this._config.objectReachedDestinationCallback=t},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"otherObjectsOnTheNextTileCallback",{get:function(){return this._config.otherObjectsOnTheNextTileCallback},set:function(t){this._config.otherObjectsOnTheNextTileCallback=t},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"objectUpdateCallback",{get:function(){return this._config.objectUpdateCallback},set:function(t){this._config.objectUpdateCallback=t},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"tileHighlightStrokeAlpha",{get:function(){return this._config.tileHighlightStrokeAlpha},set:function(t){this._config.tileHighlightStrokeAlpha=t},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"tileHighlightStrokeColor",{get:function(){return this._config.tileHighlightStrokeColor},set:function(t){this._config.tileHighlightStrokeColor=t},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"tileHighlightFillAlpha",{get:function(){return this._config.tileHighlightFillAlpha},set:function(t){this._config.tileHighlightFillAlpha=t},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"tileHighlightFillColor",{get:function(){return this._config.tileHighlightFillColor},set:function(t){this._config.tileHighlightFillColor=t},enumerable:!1,configurable:!0}),i.DEFAULT_TILE_H=74,i.DEFAULT_ISO_ANGLE=30,i}(e.Container),A=!1;var x="0.1.5",F={logEnabled:!1},M=!1,k=function(t){t&&((F=o(o({},F),t)).logEnabled=d(t.logEnabled)),M||(M=!0,function(){var t;if(!A){if(navigator.userAgent.toLowerCase().indexOf("chrome")>-1){var e=["\n %c %c %c Traviso.js - 0.1.5  %c  %c  http://www.travisojs.com/  %c  \n\n","background: #18bc9c; padding:5px 0;","background: #18bc9c; padding:5px 0;","color: #18bc9c; background: #030307; padding:5px 0;","background: #18bc9c; padding:5px 0;","background: #5ad2ba; padding:5px 0;","background: #18bc9c; padding:5px 0;"];(t=self.console).log.apply(t,e)}else self.console&&self.console.log("Traviso.js 0.1.5 - http://www.travisojs.com/");A=!0}}(),f("Traviso initiated. (Version: 0.1.5)"))};return t.DIRECTIONS=c,t.EngineView=P,t.ObjectView=m,t.PF_ALGORITHMS=p,t.TileView=b,t.VERSION=x,t.dotProduct=function(t,e){return t.x*e.x+t.y*e.y},t.enableDisableLogging=d,t.existy=r,t.getDist=l,t.getEngineInstance=function(t,e){return void 0===e&&(e=null),k(e),new P(t)},t.getUnit=s,t.isInPolygon=h,t.mathMap=a,t.skipHello=function(){A=!0},t.trace=f,Object.defineProperty(t,"__esModule",{value:!0}),t}({},PIXI);
//# sourceMappingURL=traviso.min.js.map
