"use strict";Object.defineProperty(exports,"__esModule",{value:true});var _typeof=typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol==="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};var _extends=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r){if(Object.prototype.hasOwnProperty.call(r,n)){e[n]=r[n]}}}return e};var _createClass=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||false;n.configurable=true;if("value"in n)n.writable=true;Object.defineProperty(e,n.key,n)}}return function(t,r,n){if(r)e(t.prototype,r);if(n)e(t,n);return t}}();var _MapElementType2=require("$:/plugins/felixhayashi/tiddlymap/js/MapElementType");var _MapElementType3=_interopRequireDefault(_MapElementType2);var _utils=require("$:/plugins/felixhayashi/tiddlymap/js/utils");var _utils2=_interopRequireDefault(_utils);var _environment=require("$:/plugins/felixhayashi/tiddlymap/js/lib/environment");var env=_interopRequireWildcard(_environment);function _interopRequireWildcard(e){if(e&&e.__esModule){return e}else{var t={};if(e!=null){for(var r in e){if(Object.prototype.hasOwnProperty.call(e,r))t[r]=e[r]}}t.default=e;return t}}function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _classCallCheck(e,t){if(!(e instanceof t)){throw new TypeError("Cannot call a class as a function")}}function _possibleConstructorReturn(e,t){if(!e){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return t&&(typeof t==="object"||typeof t==="function")?t:e}function _inherits(e,t){if(typeof t!=="function"&&t!==null){throw new TypeError("Super expression must either be null or a function, not "+typeof t)}e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:false,writable:true,configurable:true}});if(t)Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t}/* @preserve TW-Guard */
/*\

title: $:/plugins/felixhayashi/tiddlymap/js/EdgeType
type: application/javascript
module-type: library

@preserve

\*/
/* @preserve TW-Guard */var EdgeType=function(e){_inherits(t,e);function t(e,r){_classCallCheck(this,t);var n=t.getIdParts(e),o=n.marker,a=n.namespace,i=n.name;e=t.getId(o,a,i);var l=_possibleConstructorReturn(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,env.path.edgeTypes,t.fieldMeta,r));l.id=e;l.marker=o;l.name=i;l.namespace=a;var u=(l.style||{}).arrows;if(u){l.invertedArrow=isArrowEnabled(u,"from");l.toArrow=isArrowEnabled(u,"to")||isArrowEnabled(u,"middle");l.biArrow=l.invertedArrow===l.toArrow;if(l.biArrow){l.toArrow=true;l.invertedArrow=true}}else{l.toArrow=true}Object.freeze(l);return l}_createClass(t,[{key:"getLabel",value:function e(){return this.label||this.name}}],[{key:"getIdParts",value:function e(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:"";t=_utils2.default.getWithoutPrefix(t,env.path.edgeTypes+"/");var r=t.match(edgeTypeRegex)||[];return{marker:r[1]||"",namespace:r[3]&&r[2]||"",name:r[3]||r[2]||""}}},{key:"getId",value:function e(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:"";var r=arguments.length>1&&arguments[1]!==undefined?arguments[1]:"";var n=arguments[2];return n?t+(r&&r+":")+n:"tmap:unknown"}}]);return t}(_MapElementType3.default);EdgeType.getInstance=function(e){return e instanceof EdgeType?e:new EdgeType(e)};EdgeType.fieldMeta=_extends({},_MapElementType3.default.fieldMeta,{label:{},"show-label":{}});var isArrowEnabled=function e(t,r){var n=t[r];if(n==null&&r==="to"){return true}return(typeof n==="undefined"?"undefined":_typeof(n))==="object"?n.enabled!==false:n===true};var edgeTypeRegex=new RegExp("^(_?)([^:_][^:]*):?([^:]*)");exports.default=EdgeType;
//# sourceMappingURL=./maps/felixhayashi/tiddlymap/js/graph/EdgeType.js.map
