"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.TmapEdgeTypeSubscriber=undefined;var _extends=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var i in r){if(Object.prototype.hasOwnProperty.call(r,i)){e[i]=r[i]}}}return e};var _createClass=function(){function e(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||false;i.configurable=true;if("value"in i)i.writable=true;Object.defineProperty(e,i.key,i)}}return function(t,r,i){if(r)e(t.prototype,r);if(i)e(t,i);return t}}();var _utils=require("$:/plugins/felixhayashi/tiddlymap/js/utils");var _utils2=_interopRequireDefault(_utils);var _Edge=require("$:/plugins/felixhayashi/tiddlymap/js/Edge");var _Edge2=_interopRequireDefault(_Edge);var _AbstractEdgeTypeSubscriber=require("$:/plugins/felixhayashi/tiddlymap/js/AbstractEdgeTypeSubscriber");var _AbstractEdgeTypeSubscriber2=_interopRequireDefault(_AbstractEdgeTypeSubscriber);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/modules/edge-type-handler/tmap
type: application/javascript
module-type: tmap.edgetypehandler

@preserve

\*/
/* @preserve TW-Guard */var TmapEdgeTypeSubscriber=function(e){_inherits(t,e);function t(e){var r=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,t);return _possibleConstructorReturn(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,_extends({priority:0},r)))}_createClass(t,[{key:"loadEdges",value:function e(t,r,i){var a=_utils2.default.parseFieldData(t,"tmap.edges");if(!a){return}var n=this.tracker.getTiddlersByIds();var u=t.fields["tmap.id"];var s=_utils2.default.makeHashMap();for(var l in a){var o=a[l];var d=n[o.to];if(d&&(!r||r[d])&&(!i||i[o.type])){s[l]=new _Edge2.default(u,o.to,o.type,l)}}return s}},{key:"insertEdge",value:function e(t,r,i){var a=_utils2.default.parseFieldData(t,"tmap.edges",{});r.id=r.id||_utils2.default.genUUID();a[r.id]={to:r.to,type:i.id};_utils2.default.writeFieldData(t,"tmap.edges",a,$tm.config.sys.jsonIndentation);return r}},{key:"deleteEdge",value:function e(t,r,i){if(!r.id)return;var a=_utils2.default.parseFieldData(t,"tmap.edges",{});delete a[r.id];_utils2.default.writeFieldData(t,"tmap.edges",a,$tm.config.sys.jsonIndentation);return r}},{key:"canHandle",value:function e(t){return true}}]);return t}(_AbstractEdgeTypeSubscriber2.default);exports.TmapEdgeTypeSubscriber=TmapEdgeTypeSubscriber;
//# sourceMappingURL=./maps/felixhayashi/tiddlymap/js/edgeTypeSubscriber/TmapEdgeTypeSubscriber.js.map
