!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],e):e((t=t||self)["ReactFlow Plugins"]={},t.React)}(this,(function(t,e){"use strict";var n,r="default"in e?e.default:e;function i(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function o(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function a(t){for(var e=1;e=0||(i[n]=t[n]);return i}(t,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}function s(t){return function(t){if(Array.isArray(t)){for(var e=0,n=new Array(t.length);e=0;e--){var n=t[e][f];n.modified||(Array.isArray(n.base)?R(n)&&P(n):z(n)&&P(n))}}function z(t){for(var e=t.base,n=t.draft,r=Object.keys(n),i=r.length-1;i>=0;i--){var o=r[i],a=e[o];if(void 0===a&&!w(e,o))return!0;var u=n[o],s=u&&u[f];if(s?s.base!==a:!b(u,a))return!0}return r.length!==Object.keys(e).length}function R(t){var e=t.draft;if(e.length!==t.base.length)return!0;var n=Object.getOwnPropertyDescriptor(e,e.length-1);return!(!n||n.get)}var C=Object.freeze({willFinalize:function(t,e,n){t.drafts.forEach((function(t){t[f].finalizing=!0})),n?h(e)&&e[f].scope===t&&M(t.drafts):(t.patches&&function t(e){if(!e||"object"!=typeof e)return;var n=e[f];if(!n)return;var r=n.base;var i=n.draft;var o=n.assigned;if(Array.isArray(e)){if(R(n)){if(P(n),o.length=!0,i.lengthl&&a[f-1]===u[f+c-1];)--f;for(var h=l;h=f;--v){var g=e.concat([v]);n[y+v-f]={op:"add",path:g,value:u[v]},d&&r.push({op:"remove",path:g})}d||r.push({op:"replace",path:e.concat(["length"]),value:a.length})}(t,e,n,r):function(t,e,n,r){var i=t.base,o=t.copy;g(t.assigned,(function(t,a){var u=i[t],s=o[t],c=a?t in i?"replace":"add":"remove";if(u!==s||"replace"!==c){var l=e.concat(t);n.push("remove"===c?{op:c,path:l}:{op:c,path:l,value:s}),r.push("add"===c?{op:"remove",path:l}:"remove"===c?{op:"add",path:l,value:u}:{op:"replace",path:l,value:u})}}))}(t,e,n,r)}function H(t,e){for(var n=0;n0;)r[i]=arguments[i+1];return a.produce(t,(function(t){return e.call.apply(e,[n,t].concat(r))}))}}if("function"!=typeof e)throw new Error("The first or second argument to `produce` must be a function");if(void 0!==n&&"function"!=typeof n)throw new Error("The third argument to `produce` must be a function or undefined");if(p(t)){var u=_.enter(),s=this.createProxy(t),l=!0;try{r=e(s),l=!1}finally{l?u.revoke():u.leave()}return r instanceof Promise?r.then((function(t){return u.usePatches(n),i.processResult(t,u)}),(function(t){throw u.revoke(),t})):(u.usePatches(n),this.processResult(r,u))}return void 0===(r=e(t))?t:r!==c?r:void 0},U.prototype.createDraft=function(t){if(!p(t))throw new Error("First argument to `createDraft` must be a plain object, an array, or an immerable object");var e=_.enter(),n=this.createProxy(t);return n[f].isManual=!0,e.leave(),n},U.prototype.finishDraft=function(t,e){var n=t&&t[f];if(!n||!n.isManual)throw new Error("First argument to `finishDraft` must be a draft returned by `createDraft`");if(n.finalized)throw new Error("The given draft is already finalized");var r=n.scope;return r.usePatches(e),this.processResult(void 0,r)},U.prototype.setAutoFreeze=function(t){this.autoFreeze=t},U.prototype.setUseProxies=function(t){this.useProxies=t,d(this,t?L:C)},U.prototype.applyPatches=function(t,e){return h(t)?H(t,e):this.produce(t,(function(t){return H(t,e)}))},U.prototype.processResult=function(t,e){var n=e.drafts[0],r=void 0!==t&&t!==n;if(this.willFinalize(e,t,r),r){if(n[f].modified)throw e.revoke(),new Error("An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.");p(t)&&(t=this.finalize(t,null,e)),e.patches&&(e.patches.push({op:"replace",path:[],value:t}),e.inversePatches.push({op:"replace",path:[],value:n[f].base}))}else t=this.finalize(n,[],e);return e.revoke(),e.patches&&e.patchListener(e.patches,e.inversePatches),t!==c?t:void 0},U.prototype.finalize=function(t,e,n){var r=this,i=t[f];if(!i)return Object.isFrozen(t)?t:this.finalizeTree(t,null,n);if(i.scope!==n)return t;if(!i.modified)return i.base;if(!i.finalized){if(i.finalized=!0,this.finalizeTree(i.draft,e,n),this.onDelete)if(this.useProxies){var o=i.assigned;for(var a in o)o[a]||this.onDelete(i,a)}else{var u=i.base,s=i.copy;g(u,(function(t){w(s,t)||r.onDelete(i,t)}))}this.onCopy&&this.onCopy(i),this.autoFreeze&&n.canAutoFreeze&&Object.freeze(i.copy),e&&n.patches&&F(i,e,n.patches,n.inversePatches)}return i.copy},U.prototype.finalizeTree=function(t,e,n){var r=this,i=t[f];i&&(this.useProxies||(i.copy=v(i.draft,!0)),t=i.copy);var o=!!e&&!!n.patches,a=function(u,s,c){if(s===c)throw Error("Immer forbids circular references");var l=!!i&&c===t;if(h(s)){var f=l&&o&&!i.assigned[u]?e.concat(u):null;if(h(s=r.finalize(s,f,n))&&(n.canAutoFreeze=!1),Array.isArray(c)||m(c,u)?c[u]=s:Object.defineProperty(c,u,{value:s}),l&&s===i.base[u])return}else{if(l&&b(s,i.base[u]))return;p(s)&&!Object.isFrozen(s)&&g(s,a)}l&&r.onAssign&&r.onAssign(i,u,s)};return g(t,a),t};var $=new U,K=$.setAutoFreeze.bind($),Z=($.setUseProxies.bind($),$.applyPatches.bind($),$.createDraft.bind($)),W=$.finishDraft.bind($);var J=function(t){var e,n=t.Symbol;return"function"==typeof n?n.observable?e=n.observable:(e=n("observable"),n.observable=e):e="@@observable",e}("undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof module?module:Function("return this")()),G=function(){return Math.random().toString(36).substring(7).split("").join(".")},Q={INIT:"@@redux/INIT"+G(),REPLACE:"@@redux/REPLACE"+G(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+G()}};function tt(t,e,n){var r;if("function"==typeof e&&"function"==typeof n||"function"==typeof n&&"function"==typeof arguments[3])throw new Error("It looks like you are passing several store enhancers to createStore(). This is not supported. Instead, compose them together to a single function.");if("function"==typeof e&&void 0===n&&(n=e,e=void 0),void 0!==n){if("function"!=typeof n)throw new Error("Expected the enhancer to be a function.");return n(tt)(t,e)}if("function"!=typeof t)throw new Error("Expected the reducer to be a function.");var i=t,o=e,a=[],u=a,s=!1;function c(){u===a&&(u=a.slice())}function l(){if(s)throw new Error("You may not call store.getState() while the reducer is executing. The reducer has already received the state as an argument. Pass it down from the top reducer instead of reading it from the store.");return o}function f(t){if("function"!=typeof t)throw new Error("Expected the listener to be a function.");if(s)throw new Error("You may not call store.subscribe() while the reducer is executing. If you would like to be notified after the store has been updated, subscribe from a component and invoke store.getState() in the callback to access the latest state. See https://redux.js.org/api-reference/store#subscribe(listener) for more details.");var e=!0;return c(),u.push(t),function(){if(e){if(s)throw new Error("You may not unsubscribe from a store listener while the reducer is executing. See https://redux.js.org/api-reference/store#subscribe(listener) for more details.");e=!1,c();var n=u.indexOf(t);u.splice(n,1)}}}function h(t){if(!function(t){if("object"!=typeof t||null===t)return!1;for(var e=t;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e}(t))throw new Error("Actions must be plain objects. Use custom middleware for async actions.");if(void 0===t.type)throw new Error('Actions may not have an undefined "type" property. Have you misspelled a constant?');if(s)throw new Error("Reducers may not dispatch actions.");try{s=!0,o=i(o,t)}finally{s=!1}for(var e=a=u,n=0;n=0?(this.lastItem=this.list[e],this.list[e].val):void 0},ct.prototype.set=function(t,e){var n;return this.lastItem&&this.isEqual(this.lastItem.key,t)?(this.lastItem.val=e,this):(n=this.indexOf(t))>=0?(this.lastItem=this.list[n],this.list[n].val=e,this):(this.lastItem={key:t,val:e},this.list.push(this.lastItem),this.size++,this)},ct.prototype.delete=function(t){var e;if(this.lastItem&&this.isEqual(this.lastItem.key,t)&&(this.lastItem=void 0),(e=this.indexOf(t))>=0)return this.size--,this.list.splice(e,1)[0]},ct.prototype.has=function(t){var e;return!(!this.lastItem||!this.isEqual(this.lastItem.key,t))||(e=this.indexOf(t))>=0&&(this.lastItem=this.list[e],!0)},ct.prototype.forEach=function(t,e){var n;for(n=0;n0&&(l[c]={cacheItem:s,arg:arguments[c]},f?pt(n,l):n.push(l),n.length>t&&dt(n.shift())),i.wasMemoized=f,i.numArgs=c+1,a};return i.limit=t,i.wasMemoized=!1,i.cache=e,i.lru=n,i}};function pt(t,e){var n,r,i,o,a,u=t.length,s=e.length;for(r=0;r=0&&(!(e=(i=t[n]).cacheItem.get(i.arg))||!e.size);n--)i.cacheItem.delete(i.arg)}var yt=e.createContext(),vt="undefined"!=typeof window?e.useLayoutEffect:e.useEffect;var gt,mt=(gt=yt,function(t){var n=e.useContext(gt),r=e.useRef(t),i=e.useRef(),o=e.useRef(!0),a=e.useRef(),u=e.useReducer((function(t){return t+1}),0)[1];if(a.current||r.current!==t||void 0===i.current)try{i.current=t(n.getState())}catch(t){var s="An error occurred trying to map state in a useStoreState hook: "+t.message+".";throw a.current&&(s+="\nThis error may be related to the following error:\n"+a.current.stack+"\n\nOriginal stack trace:"),new Error(s)}return vt((function(){r.current=t,a.current=void 0})),vt((function(){var t=function(){try{var t=r.current(n.getState());if(t===i.current)return;i.current=t}catch(t){a.current=t}o.current&&u({})},e=n.subscribe(t);return t(),function(){o.current=!1,e()}}),[]),i.current});function wt(){return(wt=Object.assign||function(t){for(var e=1;e0?function(t,e){return d.reduce((function(t,n){var r=n.parentPath,i=n.key,o=n.reducer;return u(r,t,(function(t){return t[i]=o(t[i],e),t}))}),t)}(n,e):n;return t!==r&&p.forEach((function(t){var e=t.parentPath;(0,t.createComputedProperty)(Pt(e,r))})),r}))}}K(!1);var Mt=function(t,e){return t(e={exports:{}},e.exports),e.exports}((function(t){ /*! Copyright (c) 2017 Jed Watson. Licensed under the MIT License (MIT), see http://jedwatson.github.io/classnames */ !function(){var e={}.hasOwnProperty;function n(){for(var t=[],r=0;r=0&&(n=t.slice(r+1),t=t.slice(0,r)),t&&!e.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:n}}))}function Tt(t,e){for(var n,r=0,i=t.length;r0)for(var n,r,i=new Array(n),o=0;o=0&&"xmlns"!==(e=t.slice(0,n))&&(t=t.slice(n+1)),Vt.hasOwnProperty(e)?{space:Vt[e],local:t}:t}function Lt(t){return function(){var e=this.ownerDocument,n=this.namespaceURI;return n===qt&&e.documentElement.namespaceURI===qt?e.createElement(t):e.createElementNS(n,t)}}function Ft(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function Ht(t){var e=Yt(t);return(e.local?Ft:Lt)(e)}function Bt(){}function Ut(t){return null==t?Bt:function(){return this.querySelector(t)}}function $t(){return[]}function Kt(t){return null==t?$t:function(){return this.querySelectorAll(t)}}function Zt(t){return function(){return this.matches(t)}}function Wt(t){return new Array(t.length)}function Jt(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}Jt.prototype={constructor:Jt,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,e){return this._parent.insertBefore(t,e)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}};var Gt="$";function Qt(t,e,n,r,i,o){for(var a,u=0,s=e.length,c=o.length;ue?1:t>=e?0:NaN}function ne(t){return function(){this.removeAttribute(t)}}function re(t){return function(){this.removeAttributeNS(t.space,t.local)}}function ie(t,e){return function(){this.setAttribute(t,e)}}function oe(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function ae(t,e){return function(){var n=e.apply(this,arguments);null==n?this.removeAttribute(t):this.setAttribute(t,n)}}function ue(t,e){return function(){var n=e.apply(this,arguments);null==n?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,n)}}function se(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function ce(t){return function(){this.style.removeProperty(t)}}function le(t,e,n){return function(){this.style.setProperty(t,e,n)}}function fe(t,e,n){return function(){var r=e.apply(this,arguments);null==r?this.style.removeProperty(t):this.style.setProperty(t,r,n)}}function he(t,e){return t.style.getPropertyValue(e)||se(t).getComputedStyle(t,null).getPropertyValue(e)}function pe(t){return function(){delete this[t]}}function de(t,e){return function(){this[t]=e}}function ye(t,e){return function(){var n=e.apply(this,arguments);null==n?delete this[t]:this[t]=n}}function ve(t){return t.trim().split(/^|\s+/)}function ge(t){return t.classList||new me(t)}function me(t){this._node=t,this._names=ve(t.getAttribute("class")||"")}function we(t,e){for(var n=ge(t),r=-1,i=e.length;++r=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};var De={};"undefined"!=typeof document&&("onmouseenter"in document.documentElement||(De={mouseenter:"mouseover",mouseleave:"mouseout"}));function Te(t,e,n){return t=Xe(t,e,n),function(e){var n=e.relatedTarget;n&&(n===this||8&n.compareDocumentPosition(this))||t.call(this,e)}}function Xe(t,e,n){return function(r){try{t.call(this,this.__data__,e,n)}finally{}}}function qe(t){return function(){var e=this.__on;if(e){for(var n,r=0,i=-1,o=e.length;r=_&&(_=b+1);!(w=g[_])&&++_=0;)(r=i[o])&&(a&&4^r.compareDocumentPosition(a)&&a.parentNode.insertBefore(r,a),a=r);return this},sort:function(t){function e(e,n){return e&&n?t(e.__data__,n.__data__):!e-!n}t||(t=ee);for(var n=this._groups,r=n.length,i=new Array(r),o=0;o1?this.each((null==e?ce:"function"==typeof e?fe:le)(t,e,null==n?"":n)):he(this.node(),t)},property:function(t,e){return arguments.length>1?this.each((null==e?pe:"function"==typeof e?ye:de)(t,e)):this.node()[t]},classed:function(t,e){var n=ve(t+"");if(arguments.length<2){for(var r=ge(this.node()),i=-1,o=n.length;++i=0&&(e=t.slice(n+1),t=t.slice(0,n)),{type:t,name:e}}))}(t+""),a=o.length;if(!(arguments.length<2)){for(u=e?Ve:qe,null==n&&(n=!1),r=0;r>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):8===n?new dn(e>>24&255,e>>16&255,e>>8&255,(255&e)/255):4===n?new dn(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|240&e,((15&e)<<4|15&e)/255):null):(e=tn.exec(t))?new dn(e[1],e[2],e[3],1):(e=en.exec(t))?new dn(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=nn.exec(t))?hn(e[1],e[2],e[3],e[4]):(e=rn.exec(t))?hn(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=on.exec(t))?mn(e[1],e[2]/100,e[3]/100,1):(e=an.exec(t))?mn(e[1],e[2]/100,e[3]/100,e[4]):un.hasOwnProperty(t)?fn(un[t]):"transparent"===t?new dn(NaN,NaN,NaN,0):null}function fn(t){return new dn(t>>16&255,t>>8&255,255&t,1)}function hn(t,e,n,r){return r<=0&&(t=e=n=NaN),new dn(t,e,n,r)}function pn(t,e,n,r){return 1===arguments.length?((i=t)instanceof Ze||(i=ln(i)),i?new dn((i=i.rgb()).r,i.g,i.b,i.opacity):new dn):new dn(t,e,n,null==r?1:r);var i}function dn(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}function yn(){return"#"+gn(this.r)+gn(this.g)+gn(this.b)}function vn(){var t=this.opacity;return(1===(t=isNaN(t)?1:Math.max(0,Math.min(1,t)))?"rgb(":"rgba(")+Math.max(0,Math.min(255,Math.round(this.r)||0))+", "+Math.max(0,Math.min(255,Math.round(this.g)||0))+", "+Math.max(0,Math.min(255,Math.round(this.b)||0))+(1===t?")":", "+t+")")}function gn(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function mn(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new bn(t,e,n,r)}function wn(t){if(t instanceof bn)return new bn(t.h,t.s,t.l,t.opacity);if(t instanceof Ze||(t=ln(t)),!t)return new bn;if(t instanceof bn)return t;var e=(t=t.rgb()).r/255,n=t.g/255,r=t.b/255,i=Math.min(e,n,r),o=Math.max(e,n,r),a=NaN,u=o-i,s=(o+i)/2;return u?(a=e===o?(n-r)/u+6*(n0&&s<1?0:a,new bn(a,u,s,t.opacity)}function bn(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}function _n(t,e,n){return 255*(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)}function xn(t){return function(){return t}}function En(t){return 1==(t=+t)?On:function(e,n){return n-e?function(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(r){return Math.pow(t+r*e,n)}}(e,n,t):xn(isNaN(e)?n:e)}}function On(t,e){var n=e-t;return n?function(t,e){return function(n){return t+n*e}}(t,n):xn(isNaN(t)?e:t)}$e(Ze,ln,{copy:function(t){return Object.assign(new this.constructor,this,t)},displayable:function(){return this.rgb().displayable()},hex:sn,formatHex:sn,formatHsl:function(){return wn(this).formatHsl()},formatRgb:cn,toString:cn}),$e(dn,pn,Ke(Ze,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new dn(this.r*t,this.g*t,this.b*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new dn(this.r*t,this.g*t,this.b*t,this.opacity)},rgb:function(){return this},displayable:function(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:yn,formatHex:yn,formatRgb:vn,toString:vn})),$e(bn,(function(t,e,n,r){return 1===arguments.length?wn(t):new bn(t,e,n,null==r?1:r)}),Ke(Ze,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new bn(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new bn(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=this.h%360+360*(this.h<0),e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*e,i=2*n-r;return new dn(_n(t>=240?t-240:t+120,i,r),_n(t,i,r),_n(t<120?t+240:t-120,i,r),this.opacity)},displayable:function(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl:function(){var t=this.opacity;return(1===(t=isNaN(t)?1:Math.max(0,Math.min(1,t)))?"hsl(":"hsla(")+(this.h||0)+", "+100*(this.s||0)+"%, "+100*(this.l||0)+"%"+(1===t?")":", "+t+")")}}));var An=function t(e){var n=En(e);function r(t,e){var r=n((t=pn(t)).r,(e=pn(e)).r),i=n(t.g,e.g),o=n(t.b,e.b),a=On(t.opacity,e.opacity);return function(e){return t.r=r(e),t.g=i(e),t.b=o(e),t.opacity=a(e),t+""}}return r.gamma=t,r}(1);function Sn(t,e){return e-=t=+t,function(n){return t+e*n}}var kn=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Pn=new RegExp(kn.source,"g");function jn(t,e){var n,r,i,o=kn.lastIndex=Pn.lastIndex=0,a=-1,u=[],s=[];for(t+="",e+="";(n=kn.exec(t))&&(r=Pn.exec(e));)(i=r.index)>o&&(i=e.slice(o,i),u[a]?u[a]+=i:u[++a]=i),(n=n[0])===(r=r[0])?u[a]?u[a]+=r:u[++a]=r:(u[++a]=null,s.push({i:a,x:Sn(n,r)})),o=Pn.lastIndex;return o180?e+=360:e-t>180&&(t+=360),o.push({i:n.push(i(n)+"rotate(",null,r)-2,x:Sn(t,e)})):e&&n.push(i(n)+"rotate("+e+r)}(o.rotate,a.rotate,u,s),function(t,e,n,o){t!==e?o.push({i:n.push(i(n)+"skewX(",null,r)-2,x:Sn(t,e)}):e&&n.push(i(n)+"skewX("+e+r)}(o.skewX,a.skewX,u,s),function(t,e,n,r,o,a){if(t!==n||e!==r){var u=o.push(i(o)+"scale(",null,",",null,")");a.push({i:u-4,x:Sn(t,n)},{i:u-2,x:Sn(e,r)})}else 1===n&&1===r||o.push(i(o)+"scale("+n+","+r+")")}(o.scaleX,o.scaleY,a.scaleX,a.scaleY,u,s),o=a=null,function(t){for(var e,n=-1,r=s.length;++n=0&&e._call.call(null,t),e=e._next;--Ln}()}finally{Ln=0,function(){var t,e,n=Xn,r=1/0;for(;n;)n._call?(r>n._time&&(r=n._time),t=n,n=n._next):(e=n._next,n._next=null,n=t?t._next=e:Xn=e);qn=t,rr(r)}(),$n=0}}function nr(){var t=Zn.now(),e=t-Un;e>Bn&&(Kn-=e,Un=t)}function rr(t){Ln||(Fn&&(Fn=clearTimeout(Fn)),t-$n>24?(t<1/0&&(Fn=setTimeout(er,t-Zn.now()-Kn)),Hn&&(Hn=clearInterval(Hn))):(Hn||(Un=Zn.now(),Hn=setInterval(nr,Bn)),Ln=1,Wn(er)))}function ir(t,e,n){var r=new Qn;return e=null==e?0:+e,r.restart((function(n){r.stop(),t(n+e)}),e,n),r}Qn.prototype=tr.prototype={constructor:Qn,restart:function(t,e,n){if("function"!=typeof t)throw new TypeError("callback is not a function");n=(null==n?Jn():+n)+(null==e?0:+e),this._next||qn===this||(qn?qn._next=this:Xn=this,qn=this),this._call=t,this._time=n,rr()},stop:function(){this._call&&(this._call=null,this._time=1/0,rr())}};var or=Rt("start","end","cancel","interrupt"),ar=[],ur=0,sr=1,cr=2,lr=3,fr=4,hr=5,pr=6;function dr(t,e,n,r,i,o){var a=t.__transition;if(a){if(n in a)return}else t.__transition={};!function(t,e,n){var r,i=t.__transition;function o(s){var c,l,f,h;if(n.state!==sr)return u();for(c in i)if((h=i[c]).name===n.name){if(h.state===lr)return ir(o);h.state===fr?(h.state=pr,h.timer.stop(),h.on.call("interrupt",t,t.__data__,h.index,h.group),delete i[c]):+cur)throw new Error("too late; already scheduled");return n}function vr(t,e){var n=gr(t,e);if(n.state>lr)throw new Error("too late; already running");return n}function gr(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error("transition not found");return n}function mr(t,e){var n,r;return function(){var i=vr(this,t),o=i.tween;if(o!==n)for(var a=0,u=(r=n=o).length;a=0&&(t=t.slice(0,e)),!t||"start"===t}))}(e)?yr:vr;return function(){var a=o(this,t),u=a.on;u!==r&&(i=(r=u).copy()).on(e,n),a.on=i}}(n,t,e))},attr:function(t,e){var n=Yt(t),r="transform"===n?Yn:_r;return this.attrTween(t,"function"==typeof e?(n.local?kr:Sr)(n,r,br(this,"attr."+t,e)):null==e?(n.local?Er:xr)(n):(n.local?Ar:Or)(n,r,e))},attrTween:function(t,e){var n="attr."+t;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(null==e)return this.tween(n,null);if("function"!=typeof e)throw new Error;var r=Yt(t);return this.tween(n,(r.local?Pr:jr)(r,e))},style:function(t,e,n){var r="transform"==(t+="")?Vn:_r;return null==e?this.styleTween(t,function(t,e){var n,r,i;return function(){var o=he(this,t),a=(this.style.removeProperty(t),he(this,t));return o===a?null:o===n&&a===r?i:i=e(n=o,r=a)}}(t,r)).on("end.style."+t,Cr(t)):"function"==typeof e?this.styleTween(t,function(t,e,n){var r,i,o;return function(){var a=he(this,t),u=n(this),s=u+"";return null==u&&(this.style.removeProperty(t),s=u=he(this,t)),a===s?null:a===r&&s===i?o:(i=s,o=e(r=a,u))}}(t,r,br(this,"style."+t,e))).each(function(t,e){var n,r,i,o,a="style."+e,u="end."+a;return function(){var s=vr(this,t),c=s.on,l=null==s.value[a]?o||(o=Cr(e)):void 0;c===n&&i===l||(r=(n=c).copy()).on(u,i=l),s.on=r}}(this._id,t)):this.styleTween(t,function(t,e,n){var r,i,o=n+"";return function(){var a=he(this,t);return a===o?null:a===r?i:i=e(r=a,n)}}(t,r,e),n).on("end.style."+t,null)},styleTween:function(t,e,n){var r="style."+(t+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(null==e)return this.tween(r,null);if("function"!=typeof e)throw new Error;return this.tween(r,function(t,e,n){var r,i;function o(){var o=e.apply(this,arguments);return o!==i&&(r=(i=o)&&function(t,e,n){return function(r){this.style.setProperty(t,e(r),n)}}(t,o,n)),r}return o._value=e,o}(t,e,null==n?"":n))},text:function(t){return this.tween("text","function"==typeof t?function(t){return function(){var e=t(this);this.textContent=null==e?"":e}}(br(this,"text",t)):function(t){return function(){this.textContent=t}}(null==t?"":t+""))},remove:function(){return this.on("end.remove",function(t){return function(){var e=this.parentNode;for(var n in this.__transition)if(+n!==t)return;e&&e.removeChild(this)}}(this._id))},tween:function(t,e){var n=this._id;if(t+="",arguments.length<2){for(var r,i=gr(this.node(),n).tween,o=0,a=i.length;ocr&&n.state0){var r=O.internals.actionCreatorDict[e.type];O.internals.listenerActionMap[e.type].forEach((function(t){t({type:r?r.type:e.type,payload:e.payload,error:e.error,result:e.result})}))}return n}}}]);v&&S.push((function(){return function(){return function(t){null!=t&&E.push(t)}}}));var k=r||(o&&"undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__({name:m}):it),P=tt(O.internals.reducer,O.internals.defaultState,k.apply(void 0,[ot.apply(void 0,S)].concat(c)));P.subscribe((function(){O.internals.computedState.isInReducer=!1})),O.dispatch=P.dispatch,O.getState=P.getState;var j=function(){Object.keys(P.dispatch).forEach((function(t){delete P.dispatch[t]})),Object.keys(O.internals.actionCreators).forEach((function(t){P.dispatch[t]=O.internals.actionCreators[t]}))};j();var N=function(t){var e=P.getState();t&&delete e[t],A(P.getState()),P.replaceReducer(O.internals.reducer),O.internals.actionCreatorDict["@action.easyPeasyReplaceState"](O.internals.defaultState),j()};return Object.assign(P,{addModel:function(t,e){x[t]&&"production"!==process.env.NODE_ENV&&(console.warn('easy-peasy: The store model already contains a model definition for "'+t+'"'),P.removeModel(t)),x[t]=e,N()},clearMockedActions:function(){E=[]},getActions:function(){return O.internals.actionCreators},getListeners:function(){return O.internals.listenerActionCreators},getMockedActions:function(){return[].concat(E)},reconfigure:function(t){x=_(t),N()},removeModel:function(t){x[t]?(delete x[t],N(t)):"production"!==process.env.NODE_ENV&&console.warn('easy-peasy: The store model does not contain a model definition for "'+t+'"')}})}(a({width:0,height:0,transform:[0,0,1],nodes:[],edges:[],selectedElements:[],selectedNodesBbox:{x:0,y:0,width:0,height:0},d3Zoom:null,d3Selection:null,d3Initialised:!1,nodesSelectionActive:!1,selectionActive:!1,selection:{},connectionSourceId:null,connectionPosition:{x:0,y:0},onConnect:function(){}},Br)),$r=function(t){var e=t.reduce((function(t,e){var n=e.__rg.position,r=n.x+e.__rg.width,i=n.y+e.__rg.height;return n.xt.maxX&&(t.maxX=r),n.yt.maxY&&(t.maxY=i),t}),{minX:Number.MAX_VALUE,minY:Number.MAX_VALUE,maxX:0,maxY:0});return{x:e.minX,y:e.minY,width:e.maxX-e.minX,height:e.maxY-e.minY}},Kr=function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[0,0,1],r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];return t.filter((function(t){var i=(e.x-n[0])*(1/n[2]),o=(e.y-n[1])*(1/n[2]),a=e.width*(1/n[2]),u=e.height*(1/n[2]),s=t.__rg,c=s.position,l=s.width,f=s.height,h=r?-l:l,p=r?0:f,d=r?l:0,y=r?f:0;return c.x+d>i&&c.x+ho&&c.y+p0&&void 0!==arguments[0]?arguments[0]:{},e=t.padding,n=void 0===e?0:e,r=Ur.getState(),i=$r(r.nodes),o=Math.max(i.width,i.height),a=Math.min(r.width,r.height)/(o+o*n),u=i.x+i.width/2,s=i.y+i.height/2,c=[r.width/2-u*a,r.height/2-s*a],l=Fr.translate(c[0],c[1]).scale(a);r.d3Selection.call(r.d3Zoom.transform,l)},Jr=function(){var t=Ur.getState();t.d3Zoom.scaleTo(t.d3Selection,t.transform[2]+.2)},Gr=function(){var t=Ur.getState();t.d3Zoom.scaleTo(t.d3Selection,t.transform[2]-.2)},Qr={position:"absolute",zIndex:5,bottom:10,right:10,width:200},ti={position:"absolute",zIndex:5,bottom:10,left:10};t.Controls=function(t){var e=t.style,n=t.className,i=Mt("react-flow__controls",n);return r.createElement("div",{className:i,style:a({},ti,{},e)},r.createElement("div",{className:"react-flow__controls-button react-flow__controls-zoomin",onClick:Jr},r.createElement("img",{src:''})),r.createElement("div",{className:"react-flow__controls-button react-flow__controls-zoomout",onClick:Gr},r.createElement("img",{src:''})),r.createElement("div",{className:"react-flow__controls-button react-flow__controls-fitview",onClick:Wr},r.createElement("img",{src:''})))},t.MiniMap=function(t){var n=t.style,i=void 0===n?{}:n,o=t.className,u=t.bgColor,s=void 0===u?"#f8f8f8":u,c=t.nodeColor,l=void 0===c?"#ddd":c,f=e.useRef(null),h=mt((function(t){return{width:t.width,height:t.height,nodes:t.nodes,transform:t.transform}})),p=Mt("react-flow__minimap",o),d=h.nodes.map((function(t){return t.__rg.position})),y=i.width||Qr.width,v=h.height/(h.width||1)*y,g={x:0,y:0,width:h.width,height:h.height},m=y/h.width,w=function(t){return!!(t&&t.constructor&&t.call&&t.apply)}(l)?l:function(){return l};return e.useEffect((function(){if(f){var t=f.current.getContext("2d"),e=Kr(h.nodes,g,h.transform,!0);t.fillStyle=s,t.fillRect(0,0,y,v),e.forEach((function(e){var n=e.__rg.position,r=h.transform[0],i=h.transform[1],o=n.x*h.transform[2]+r,a=n.y*h.transform[2]+i;t.fillStyle=w(e),t.fillRect(o*m,a*m,e.__rg.width*m*h.transform[2],e.__rg.height*m*h.transform[2])}))}}),[d,h.transform,v]),r.createElement("canvas",{style:a({},Qr,{},i,{height:v}),width:y,height:v,className:p,ref:f})},Object.defineProperty(t,"__esModule",{value:!0})})); //# sourceMappingURL=index.js.map