(window.webpackJsonp=window.webpackJsonp||[]).push([[7],{188:function(e,t,n){"use strict";n.r(t),n.d(t,"frontMatter",(function(){return d})),n.d(t,"metadata",(function(){return f})),n.d(t,"rightToc",(function(){return b})),n.d(t,"default",(function(){return v}));var r=n(2),o=n(9),a=n(0),i=n.n(a),u=n(196),c=(n(25),n(20),n(19),n(90),n(197)),l={"RaOIu-i1Qo":{id:"RaOIu-i1Qo",x:-282.375,y:-77.6640625,type:"number",width:140,connections:{inputs:{},outputs:{number:[]}},inputData:{number:{number:0}}},"GGx-8iFtPP":{id:"GGx-8iFtPP",x:-65.3828125,y:-109.6640625,type:"addNumbers",width:140,connections:{inputs:{},outputs:{}},inputData:{num1:{number:0},num2:{number:0}}},Esjqq_aoSE:{id:"Esjqq_aoSE",x:152.625,y:-84.6640625,type:"string",width:140,connections:{inputs:{},outputs:{}},inputData:{string:{string:""}}}},s=(new c.c).addPortType({type:"number",name:"number",label:"Number",color:c.a.red,controls:[c.b.number({name:"number",label:"Number"})]}).addPortType({type:"string",name:"string",label:"Text",color:c.a.green,controls:[c.b.text({name:"string",label:"Text"})]}).addNodeType({type:"string",label:"Text",initialWidth:140,inputs:function(e){return[e.string()]},outputs:function(e){return[e.string()]}}).addNodeType({type:"number",label:"Number",initialWidth:140,inputs:function(e){return[e.number()]},outputs:function(e){return[e.number()]}}).addNodeType({type:"addNumbers",label:"Add Numbers",initialWidth:140,inputs:function(e){return[e.number({name:"num1"}),e.number({name:"num2"})]},outputs:function(e){return[e.number()]}}),p=function(){return i.a.createElement("div",{style:{width:"100%",height:400,color:"#000"}},i.a.createElement("style",{type:"text/css"},'\n [data-flume-node-type="addNumbers"] {\n background: linear-gradient(to top, #4e2020 0%, #20204e 100%);\n border: 1px solid rgba(255,255,255,.5);\n color: #fff;\n }\n [data-flume-node-type="addNumbers"] [data-flume-component="node-header"] {\n background: none;\n }\n '),i.a.createElement(c.d,{defaultNodes:Object.values(l),portTypes:s.portTypes,nodeTypes:s.nodeTypes,debug:!0}))},d={title:"Theming"},f={id:"theming",isDocsHomePage:!1,title:"Theming",description:"All required styles are automatically included with the NodeEditor, but each Flume component has a data attribute that you can target using normal css.",source:"@site/docs/theming.mdx",permalink:"/docs/theming",editUrl:"https://github.com/chrisjpatty/flume/edit/master/docs/docs/theming.mdx",sidebar:"someSidebar",previous:{title:"Comments",permalink:"/docs/comments"},next:{title:"NodeEditor",permalink:"/docs/NodeEditor"}},b=[{value:"Example",id:"example",children:[]},{value:"Reference",id:"reference",children:[]},{value:"Theming based on node type",id:"theming-based-on-node-type",children:[]}],m={rightToc:b};function v(e){var t=e.components,n=Object(o.a)(e,["components"]);return Object(u.b)("wrapper",Object(r.a)({},m,n,{components:t,mdxType:"MDXLayout"}),Object(u.b)("p",null,"All required styles are automatically included with the ",Object(u.b)("inlineCode",{parentName:"p"},"NodeEditor"),", but each Flume component has a data attribute that you can target using normal css."),Object(u.b)("h2",{id:"example"},"Example"),Object(u.b)("p",null,"For example, you can change the background color of the nodes with the following CSS:"),Object(u.b)("pre",null,Object(u.b)("code",Object(r.a)({parentName:"pre"},{className:"language-css"}),'[data-flume-component="node"]{\n background: #ffffff;\n}\n')),Object(u.b)("h2",{id:"reference"},"Reference"),Object(u.b)("p",null,"The following is a comprehensive list of all available data attributes. Each component name is prefixed with ",Object(u.b)("inlineCode",{parentName:"p"},"data-flume-component"),"."),Object(u.b)("ul",null,Object(u.b)("li",{parentName:"ul"},Object(u.b)("inlineCode",{parentName:"li"},"stage")),Object(u.b)("li",{parentName:"ul"},Object(u.b)("inlineCode",{parentName:"li"},"node")),Object(u.b)("li",{parentName:"ul"},Object(u.b)("inlineCode",{parentName:"li"},"node-header")),Object(u.b)("li",{parentName:"ul"},Object(u.b)("inlineCode",{parentName:"li"},"connection-svg")),Object(u.b)("li",{parentName:"ul"},Object(u.b)("inlineCode",{parentName:"li"},"connection-path")),Object(u.b)("li",{parentName:"ul"},Object(u.b)("inlineCode",{parentName:"li"},"ports")),Object(u.b)("li",{parentName:"ul"},Object(u.b)("inlineCode",{parentName:"li"},"ports-inputs")),Object(u.b)("li",{parentName:"ul"},Object(u.b)("inlineCode",{parentName:"li"},"ports-outputs-")),Object(u.b)("li",{parentName:"ul"},Object(u.b)("inlineCode",{parentName:"li"},"port-input")),Object(u.b)("li",{parentName:"ul"},Object(u.b)("inlineCode",{parentName:"li"},"port-output")),Object(u.b)("li",{parentName:"ul"},Object(u.b)("inlineCode",{parentName:"li"},"port-label")),Object(u.b)("li",{parentName:"ul"},Object(u.b)("inlineCode",{parentName:"li"},"port-handle")),Object(u.b)("li",{parentName:"ul"},Object(u.b)("inlineCode",{parentName:"li"},"comment")),Object(u.b)("li",{parentName:"ul"},Object(u.b)("inlineCode",{parentName:"li"},"comment-textarea")),Object(u.b)("li",{parentName:"ul"},Object(u.b)("inlineCode",{parentName:"li"},"comment-text")),Object(u.b)("li",{parentName:"ul"},Object(u.b)("inlineCode",{parentName:"li"},"comment-resize-handle")),Object(u.b)("li",{parentName:"ul"},Object(u.b)("inlineCode",{parentName:"li"},"control")),Object(u.b)("li",{parentName:"ul"},Object(u.b)("inlineCode",{parentName:"li"},"control-label")),Object(u.b)("li",{parentName:"ul"},Object(u.b)("inlineCode",{parentName:"li"},"select")),Object(u.b)("li",{parentName:"ul"},Object(u.b)("inlineCode",{parentName:"li"},"select-label")),Object(u.b)("li",{parentName:"ul"},Object(u.b)("inlineCode",{parentName:"li"},"select-desc")),Object(u.b)("li",{parentName:"ul"},Object(u.b)("inlineCode",{parentName:"li"},"text-input")),Object(u.b)("li",{parentName:"ul"},Object(u.b)("inlineCode",{parentName:"li"},"text-input-number")),Object(u.b)("li",{parentName:"ul"},Object(u.b)("inlineCode",{parentName:"li"},"text-input-textarea")),Object(u.b)("li",{parentName:"ul"},Object(u.b)("inlineCode",{parentName:"li"},"checkbox")),Object(u.b)("li",{parentName:"ul"},Object(u.b)("inlineCode",{parentName:"li"},"checkbox-label")),Object(u.b)("li",{parentName:"ul"},Object(u.b)("inlineCode",{parentName:"li"},"color-picker")),Object(u.b)("li",{parentName:"ul"},Object(u.b)("inlineCode",{parentName:"li"},"color-button")),Object(u.b)("li",{parentName:"ul"},Object(u.b)("inlineCode",{parentName:"li"},"toast")),Object(u.b)("li",{parentName:"ul"},Object(u.b)("inlineCode",{parentName:"li"},"toast-title")),Object(u.b)("li",{parentName:"ul"},Object(u.b)("inlineCode",{parentName:"li"},"toast-message")),Object(u.b)("li",{parentName:"ul"},Object(u.b)("inlineCode",{parentName:"li"},"toast-close")),Object(u.b)("li",{parentName:"ul"},Object(u.b)("inlineCode",{parentName:"li"},"ctx-menu")),Object(u.b)("li",{parentName:"ul"},Object(u.b)("inlineCode",{parentName:"li"},"ctx-menu-header")),Object(u.b)("li",{parentName:"ul"},Object(u.b)("inlineCode",{parentName:"li"},"ctx-menu-title")),Object(u.b)("li",{parentName:"ul"},Object(u.b)("inlineCode",{parentName:"li"},"ctx-menu-input")),Object(u.b)("li",{parentName:"ul"},Object(u.b)("inlineCode",{parentName:"li"},"ctx-menu-list")),Object(u.b)("li",{parentName:"ul"},Object(u.b)("inlineCode",{parentName:"li"},"ctx-menu-empty")),Object(u.b)("li",{parentName:"ul"},Object(u.b)("inlineCode",{parentName:"li"},"ctx-menu-option"))),Object(u.b)("h2",{id:"theming-based-on-node-type"},"Theming based on node type"),Object(u.b)("p",null,"In some cases you may want to style some nodes based on their type. There are a few dynamic data attributes you can use for this."),Object(u.b)("ul",null,Object(u.b)("li",{parentName:"ul"},Object(u.b)("inlineCode",{parentName:"li"},"data-flume-node-type=[nodeType]")," "),Object(u.b)("li",{parentName:"ul"},Object(u.b)("inlineCode",{parentName:"li"},"data-flume-component-is-root=[boolean]")),Object(u.b)("li",{parentName:"ul"},Object(u.b)("inlineCode",{parentName:"li"},"data-port-color=[color]")),Object(u.b)("li",{parentName:"ul"},Object(u.b)("inlineCode",{parentName:"li"},"data-port-name=[portName]")),Object(u.b)("li",{parentName:"ul"},"`data-port-type=","[portType]")),Object(u.b)("p",null,"For example, to target a node with type ",Object(u.b)("inlineCode",{parentName:"p"},"addNumbers")," you could add this to your CSS:"),Object(u.b)("pre",null,Object(u.b)("code",Object(r.a)({parentName:"pre"},{className:"language-css"}),'[data-flume-node-type="addNumbers"] {\n background: linear-gradient(to top, #4e2020 0%, #20204e 100%);\n border: 1px solid rgba(255,255,255,.5);\n color: #fff;\n}\n[data-flume-node-type="addNumbers"] [data-flume-component="node-header"] {\n background: none;\n}\n')),Object(u.b)(p,{mdxType:"DynamicThemingExample"}))}v.isMDXComponent=!0},196:function(e,t,n){"use strict";n.d(t,"a",(function(){return p})),n.d(t,"b",(function(){return b}));var r=n(0),o=n.n(r);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function u(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var l=o.a.createContext({}),s=function(e){var t=o.a.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):u(u({},t),e)),n},p=function(e){var t=s(e.components);return o.a.createElement(l.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return o.a.createElement(o.a.Fragment,{},t)}},f=o.a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,a=e.originalType,i=e.parentName,l=c(e,["components","mdxType","originalType","parentName"]),p=s(n),f=r,b=p["".concat(i,".").concat(f)]||p[f]||d[f]||a;return n?o.a.createElement(b,u(u({ref:t},l),{},{components:n})):o.a.createElement(b,u({ref:t},l))}));function b(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var a=n.length,i=new Array(a);i[0]=f;var u={};for(var c in t)hasOwnProperty.call(t,c)&&(u[c]=t[c]);u.originalType=e,u.mdxType="string"==typeof e?e:r,i[1]=u;for(var l=2;le.length)&&(t=e.length);for(var n=0,r=new Array(t);n=t?e:t)),e},V=/\s/;var H=function(e){for(var t=e.length;t--&&V.test(e.charAt(t)););return t},Y=/^\s+/;var X=function(e){return e?e.slice(0,H(e)+1).replace(Y,""):e};var K=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)},U="object"==typeof f&&f&&f.Object===Object&&f,J=U,Q="object"==typeof self&&self&&self.Object===Object&&self,G=J||Q||Function("return this")(),$=G.Symbol,Z=$,ee=Object.prototype,te=ee.hasOwnProperty,ne=ee.toString,re=Z?Z.toStringTag:void 0;var oe=function(e){var t=te.call(e,re),n=e[re];try{e[re]=void 0;var r=!0}catch(a){}var o=ne.call(e);return r&&(t?e[re]=n:delete e[re]),o},ae=Object.prototype.toString;var ie=oe,ue=function(e){return ae.call(e)},ce=$?$.toStringTag:void 0;var le=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":ce&&ce in Object(e)?ie(e):ue(e)};var se=function(e){return null!=e&&"object"==typeof e},pe=le,de=se;var fe=function(e){return"symbol"==typeof e||de(e)&&"[object Symbol]"==pe(e)},be=X,me=K,ve=fe,ye=/^[-+]0x[0-9a-f]+$/i,he=/^0b[01]+$/i,_e=/^0o[0-7]+$/i,ge=parseInt;var xe=F,Oe=function(e){if("number"==typeof e)return e;if(ve(e))return NaN;if(me(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=me(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=be(e);var n=he.test(e);return n||_e.test(e)?ge(e.slice(2),n?2:8):ye.test(e)?NaN:+e};var Ee=function(e,t,n){return void 0===n&&(n=t,t=void 0),void 0!==n&&(n=(n=Oe(n))==n?n:0),void 0!==t&&(t=(t=Oe(t))==t?t:0),xe(Oe(e),t,n)},we=function(e){void 0===e&&(e=21);for(var t="",n=e;n--;)t+="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict"[64*Math.random()|0];return t},je=function(e){var t=e.x,n=e.y,r=e.options,a=void 0===r?[]:r,i=e.onRequestClose,u=e.onOptionSelected,c=e.label,l=e.hideHeader,s=e.hideFilter,p=e.emptyText,f=o.a.useRef(null),b=o.a.useRef(null),m=o.a.useRef(null),v=d(o.a.useState(""),2),y=v[0],h=v[1],_=d(o.a.useState(0),2),g=_[0],x=_[1],O=d(o.a.useState(0),2),E=O[0],w=O[1],j=o.a.useRef(we(10)),N=function(e){u(e),i()},T=o.a.useCallback((function(e){f.current&&!f.current.contains(e.target)&&(i(),document.removeEventListener("click",T,{capture:!0}),document.removeEventListener("contextmenu",T,{capture:!0}))}),[f,i]),C=o.a.useCallback((function(e){27===e.keyCode&&(i(),document.removeEventListener("keydown",C,{capture:!0}))}),[i]);o.a.useEffect((function(){var e,t,n;return m.current&&m.current.focus(),x(null!==(e=null===(t=f.current)||void 0===t||null===(n=t.getBoundingClientRect())||void 0===n?void 0:n.width)&&void 0!==e?e:0),document.addEventListener("keydown",C,{capture:!0}),document.addEventListener("click",T,{capture:!0}),document.addEventListener("contextmenu",T,{capture:!0}),function(){document.removeEventListener("click",T,{capture:!0}),document.removeEventListener("contextmenu",T,{capture:!0}),document.removeEventListener("keydown",C,{capture:!0})}}),[T,C]);var P=o.a.useMemo((function(){if(!y)return a;var e=y.toLowerCase();return a.filter((function(t){return t.label.toLowerCase().includes(e)}))}),[y,a]);return o.a.useEffect((function(){var e;(s||l)&&(null===(e=f.current)||void 0===e||e.focus())}),[s,l]),o.a.useEffect((function(){var e=document.getElementById("".concat(j.current,"-").concat(E));if(e){var t,n=null===(t=b.current)||void 0===t?void 0:t.getBoundingClientRect(),r=e.getBoundingClientRect();n&&(r.y+r.height>n.y+n.height||r.y0&&w((function(e){return(e||0)-1}))),40===e.which&&(e.preventDefault(),null===E?w(0):E=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var Le=["children","stageState","stageRect","onDragDelayStart","onDragStart","onDrag","onDragEnd","onMouseDown","onTouchStart","disabled","delay","innerRef"];function ze(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}var Be=function(e){var t=e.children,n=e.stageState,r=e.stageRect,a=e.onDragDelayStart,i=e.onDragStart,u=e.onDrag,c=e.onDragEnd,s=e.onMouseDown,p=e.onTouchStart,d=e.disabled,f=e.delay,b=void 0===f?6:f,m=e.innerRef,v=Me(e,Le),y=o.a.useRef(null),h=o.a.useRef(),_=o.a.useRef(null),g=function(e){return 1/n.scale*e},x=function(e){var t,o,a,i,u,c,l,s,p,d,f,b,m=null!==(t=null===(o=h.current)||void 0===o?void 0:o.x)&&void 0!==t?t:0,v=null!==(a=null===(i=h.current)||void 0===i?void 0:i.y)&&void 0!==a?a:0;return{x:g(e.clientX-(r&&null!==(u=null===(c=r.current)||void 0===c?void 0:c.left)&&void 0!==u?u:0)-m-(r&&null!==(l=null===(s=r.current)||void 0===s?void 0:s.width)&&void 0!==l?l:0)/2)+g(n.translate.x),y:g(e.clientY-(r&&null!==(p=null===(d=r.current)||void 0===d?void 0:d.top)&&void 0!==p?p:0)-v-(r&&null!==(f=null===(b=r.current)||void 0===b?void 0:b.height)&&void 0!==f?f:0)/2)+g(n.translate.y)}},O=function(e){var t=x(e);u&&u(t,e)},E=function e(t){var n=x(t);c&&c(t,n),window.removeEventListener("mouseup",e),window.removeEventListener("mousemove",O)},w=function(e){if(y.current){var t,n;if("ontouchstart"in window&&e.touches){var r=e.touches[0];t=r.clientX,n=r.clientY}else{var o=e;e.preventDefault(),t=o.clientX,n=o.clientY}var a=Math.abs(y.current.x-t),u=Math.abs(y.current.y-n);Math.round(Math.sqrt(Math.pow(a,2)+Math.pow(u,2)))>=b&&(!function(e){if(i&&i(e),_.current&&y.current){var t=_.current.getBoundingClientRect();h.current={x:y.current.x-t.left,y:y.current.y-t.top},window.addEventListener("mouseup",E),window.addEventListener("mousemove",O)}}(e),j())}},j=function e(){document.removeEventListener("mouseup",e),document.removeEventListener("mousemove",w),y.current=null},N=function(e){var t,n;if(a&&a(e),e.stopPropagation(),"ontouchstart"in window&&e.touches){var r=e.touches[0];t=r.clientX,n=r.clientY}else{e.preventDefault();var o=e;t=o.clientX,n=o.clientY}y.current={x:t,y:n},document.addEventListener("mouseup",j),document.addEventListener("mousemove",w)};return o.a.createElement("div",function(e){for(var t=1;t-1},Yt=function(e,t){var n=this.__data__,r=Wt(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this};function Xt(e){var t=-1,n=null==e?0:e.length;for(this.clear();++tu))return!1;var l=a.get(e),s=a.get(t);if(l&&s)return l==t&&s==e;var p=-1,d=!0,f=2&n?new Qn:void 0;for(a.set(e,t),a.set(t,e);++p-1&&e%1==0&&e-1&&e%1==0&&e<=9007199254740991},Sr=le,Dr=Pr,kr=se,Ir={};Ir["[object Float32Array]"]=Ir["[object Float64Array]"]=Ir["[object Int8Array]"]=Ir["[object Int16Array]"]=Ir["[object Int32Array]"]=Ir["[object Uint8Array]"]=Ir["[object Uint8ClampedArray]"]=Ir["[object Uint16Array]"]=Ir["[object Uint32Array]"]=!0,Ir["[object Arguments]"]=Ir["[object Array]"]=Ir["[object ArrayBuffer]"]=Ir["[object Boolean]"]=Ir["[object DataView]"]=Ir["[object Date]"]=Ir["[object Error]"]=Ir["[object Function]"]=Ir["[object Map]"]=Ir["[object Number]"]=Ir["[object Object]"]=Ir["[object RegExp]"]=Ir["[object Set]"]=Ir["[object String]"]=Ir["[object WeakMap]"]=!1;var Ar=function(e){return kr(e)&&Dr(e.length)&&!!Ir[Sr(e)]};var Rr=function(e){return function(t){return e(t)}},Mr={exports:{}};!function(e,t){var n=U,r=t&&!t.nodeType&&t,o=r&&e&&!e.nodeType&&e,a=o&&o.exports===r&&n.process,i=function(){try{var e=o&&o.require&&o.require("util").types;return e||a&&a.binding&&a.binding("util")}catch(t){}}();e.exports=i}(Mr,Mr.exports);var Lr=Ar,zr=Rr,Br=Mr.exports,Wr=Br&&Br.isTypedArray,qr=Wr?zr(Wr):Lr,Fr=vr,Vr=wr,Hr=qe,Yr=jr.exports,Xr=Cr,Kr=qr,Ur=Object.prototype.hasOwnProperty;var Jr=function(e,t){var n=Hr(e),r=!n&&Vr(e),o=!n&&!r&&Yr(e),a=!n&&!r&&!o&&Kr(e),i=n||r||o||a,u=i?Fr(e.length,String):[],c=u.length;for(var l in e)!t&&!Ur.call(e,l)||i&&("length"==l||o&&("offset"==l||"parent"==l)||a&&("buffer"==l||"byteLength"==l||"byteOffset"==l)||Xr(l,c))||u.push(l);return u},Qr=Object.prototype;var Gr=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||Qr)};var $r=function(e,t){return function(n){return e(t(n))}}(Object.keys,Object),Zr=Gr,eo=$r,to=Object.prototype.hasOwnProperty;var no=Qe,ro=Pr;var oo=function(e){return null!=e&&ro(e.length)&&!no(e)},ao=Jr,io=function(e){if(!Zr(e))return eo(e);var t=[];for(var n in Object(e))to.call(e,n)&&"constructor"!=n&&t.push(n);return t},uo=oo;var co=function(e){return uo(e)?ao(e):io(e)},lo=sr,so=mr,po=co;var fo=function(e){return lo(e,po,so)},bo=Object.prototype.hasOwnProperty;var mo=function(e,t,n,r,o,a){var i=1&n,u=fo(e),c=u.length;if(c!=fo(t).length&&!i)return!1;for(var l=c;l--;){var s=u[l];if(!(i?s in t:bo.call(t,s)))return!1}var p=a.get(e),d=a.get(t);if(p&&d)return p==t&&d==e;var f=!0;a.set(e,t),a.set(t,e);for(var b=i;++lt||a&&i&&c&&!u&&!l||r&&i&&c||!n&&c||!o)return 1;if(!r&&!a&&!l&&e=u?c:c*("desc"==n[r]?-1:1)}return e.index-t.index},Wa=ba,qa=qe;var Fa=function(e,t,n){t=t.length?Ia(t,(function(e){return qa(e)?function(t){return Aa(t,1===e.length?e[0]:e)}:e})):[Wa];var r=-1;t=Ia(t,za(Ra));var o=Ma(e,(function(e,n,o){return{criteria:Ia(t,(function(t){return t(e)})),index:++r,value:e}}));return La(o,(function(e,t){return Ba(e,t,n)}))},Va=qe;var Ha=function(e,t,n,r){return null==e?[]:(Va(t)||(t=null==t?[]:[t]),Va(n=r?void 0:n)||(n=null==n?[]:[n]),Fa(e,t,n))},Ya="__node_editor_stage__";function Xa(e){return(Xa="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Ka(e){return function(e){if(Array.isArray(e))return s(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||p(e)||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.")}()}var Ua="Connection_svg__-fKLY";_(".Connection_svg__-fKLY{\n position: absolute;\n left: 0px;\n top: 0px;\n pointer-events: none;\n z-index: 0;\n overflow: visible !important;\n}\n");var Ja=Math.PI,Qa=2*Ja,Ga=Qa-1e-6;function $a(){this._x0=this._y0=this._x1=this._y1=null,this._=""}function Za(){return new $a}function ei(e){return function(){return e}}function ti(e){this._context=e}function ni(e){return new ti(e)}function ri(e){return e[0]}function oi(e){return e[1]}function ai(e,t,n){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+n)/6)}function ii(e){this._context=e}function ui(e){return new ii(e)}$a.prototype=Za.prototype={constructor:$a,moveTo:function(e,t){this._+="M"+(this._x0=this._x1=+e)+","+(this._y0=this._y1=+t)},closePath:function(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")},lineTo:function(e,t){this._+="L"+(this._x1=+e)+","+(this._y1=+t)},quadraticCurveTo:function(e,t,n,r){this._+="Q"+ +e+","+ +t+","+(this._x1=+n)+","+(this._y1=+r)},bezierCurveTo:function(e,t,n,r,o,a){this._+="C"+ +e+","+ +t+","+ +n+","+ +r+","+(this._x1=+o)+","+(this._y1=+a)},arcTo:function(e,t,n,r,o){e=+e,t=+t,n=+n,r=+r,o=+o;var a=this._x1,i=this._y1,u=n-e,c=r-t,l=a-e,s=i-t,p=l*l+s*s;if(o<0)throw new Error("negative radius: "+o);if(null===this._x1)this._+="M"+(this._x1=e)+","+(this._y1=t);else if(p>1e-6)if(Math.abs(s*u-c*l)>1e-6&&o){var d=n-a,f=r-i,b=u*u+c*c,m=d*d+f*f,v=Math.sqrt(b),y=Math.sqrt(p),h=o*Math.tan((Ja-Math.acos((b+p-m)/(2*v*y)))/2),_=h/y,g=h/v;Math.abs(_-1)>1e-6&&(this._+="L"+(e+_*l)+","+(t+_*s)),this._+="A"+o+","+o+",0,0,"+ +(s*d>l*f)+","+(this._x1=e+g*u)+","+(this._y1=t+g*c)}else this._+="L"+(this._x1=e)+","+(this._y1=t);else;},arc:function(e,t,n,r,o,a){e=+e,t=+t,a=!!a;var i=(n=+n)*Math.cos(r),u=n*Math.sin(r),c=e+i,l=t+u,s=1^a,p=a?r-o:o-r;if(n<0)throw new Error("negative radius: "+n);null===this._x1?this._+="M"+c+","+l:(Math.abs(this._x1-c)>1e-6||Math.abs(this._y1-l)>1e-6)&&(this._+="L"+c+","+l),n&&(p<0&&(p=p%Qa+Qa),p>Ga?this._+="A"+n+","+n+",0,1,"+s+","+(e-i)+","+(t-u)+"A"+n+","+n+",0,1,"+s+","+(this._x1=c)+","+(this._y1=l):p>1e-6&&(this._+="A"+n+","+n+",0,"+ +(p>=Ja)+","+s+","+(this._x1=e+n*Math.cos(o))+","+(this._y1=t+n*Math.sin(o))))},rect:function(e,t,n,r){this._+="M"+(this._x0=this._x1=+e)+","+(this._y0=this._y1=+t)+"h"+ +n+"v"+ +r+"h"+-n+"Z"},toString:function(){return this._}},ti.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t)}}},ii.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:ai(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:ai(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};var ci,li=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"input";return document.querySelector('[data-node-id="'.concat(e,'"] [data-port-name="').concat(t,'"][data-port-transput-type="').concat(n,'"]'))},si=function(e,t,n,r){var o=null!=n?n:"input";if(r&&r.current){var a=e+t+o,i=r.current.ports[a];if(i)return i.getBoundingClientRect();var u=li(e,t,o);return u&&(r.current.ports[a]=u),u&&u.getBoundingClientRect()}var c=li(e,t,o);return c&&c.getBoundingClientRect()},pi=function(e,t){var n=(t.x-e.x)/3,r=[];if(t.x>e.x-6)r=[[e.x,e.y],[e.x+n,e.y],[e.x+2*n,t.y],[t.x,t.y]];else{var o=Math.abs(t.y-e.y)/3;r=t.y>e.y?[[e.x,e.y],[e.x+50,e.y],[e.x+50,e.y+o],[t.x-50,t.y-o],[t.x-50,t.y],[t.x,t.y]]:[[e.x,e.y],[e.x+50,e.y],[e.x+50,e.y-o],[t.x-50,t.y+o],[t.x-50,t.y],[t.x,t.y]]}var a=function(){var e=ri,t=oi,n=ei(!0),r=null,o=ni,a=null;function i(i){var u,c,l,s=i.length,p=!1;for(null==r&&(a=o(l=Za())),u=0;u<=s;++u)!(u0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0;switch(t.type){case ci.ADD_TOAST:return[{id:we(5),title:t.title,message:t.message,type:t.toastType||"info",duration:t.duration||1e4,height:0,exiting:!1}].concat(Ka(e));case ci.SET_HEIGHT:var n=e.findIndex((function(e){return e.id===t.id}));return-1===n?e:[].concat(Ka(e.slice(0,n)),[mi(mi({},e[n]),{},{height:t.height})],Ka(e.slice(n+1)));case ci.SET_EXITING:var r=e.findIndex((function(e){return e.id===t.id}));return-1===r?e:[].concat(Ka(e.slice(0,r)),[mi(mi({},e[r]),{},{exiting:!0})],Ka(e.slice(r+1)));case ci.REMOVE_TOAST:var o=e.findIndex((function(e){return e.id===t.id}));return-1===o?e:[].concat(Ka(e.slice(0,o)),Ka(e.slice(o+1)));default:return e}},hi=["id","defaultNode"];function _i(e){var t=function(e,t){if("object"!==Xa(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==Xa(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===Xa(t)?t:String(t)}function gi(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function xi(e){for(var t=1;t0;){var o=n.pop();if(null==o)return;var a=e[o];if(r.includes(a))return!0;if(r.push(a),null!=a.connections){var i=a.connections.outputs;for(var u in i){var c=i[u];n=n.concat(c.map((function(e){return e.nodeId})).filter((function(e,t,n){return n.indexOf(e)==t})))}}}return!1}(f,p.nodeId)?"prevent"===u?(null==r||r({type:ci.ADD_TOAST,title:"Unable to connect",message:"Connecting these nodes would result in an infinite loop.",toastType:"warning",duration:5e3}),e):(null==r||r({type:ci.ADD_TOAST,title:"Circular Connection Detected",message:"Connecting these nodes has created an infinite loop.",toastType:"warning",duration:5e3}),f):f;case vi.REMOVE_CONNECTION:var b,m=t.input,v=t.output,y=v.nodeId+v.portName+m.nodeId+m.portName;return null==i||(null===(b=i.current)||void 0===b||delete b.connections[y]),di({id:y}),Ei(e,m,v);case vi.DESTROY_TRANSPUT:var h,_=t.transput,g=t.transputType,x=_.nodeId+_.portName+g;null==i||(null===(h=i.current)||void 0===h||delete h.ports[x]);var O="input"===g?"inputs":"outputs",E=e[_.nodeId].connections[O][_.portName];return E&&E.length?E.reduce((function(e,t){var n,r=d("input"===g?[_,t]:[t,_],2),o=r[0],a=r[1],u=a.nodeId+a.portName+o.nodeId+o.portName;return null==i||(null===(n=i.current)||void 0===n||delete n.connections[u]),di({id:u}),Ei(e,o,a)}),e):e;case vi.ADD_NODE:var w=t.x,j=t.y,N=t.nodeType,T=t.id,C=t.defaultNode,P=T||we(10),S={id:P,x:w,y:j,type:N,width:o[N].initialWidth||200,connections:{inputs:{},outputs:{}},inputData:{}};return S.inputData=Ci({node:S,nodeType:o[N],portTypes:a,context:c}),C&&(S.defaultNode=!0),o[N].root&&(S.root=!0),xi(xi({},e),{},l({},P,S));case vi.REMOVE_NODE:var D=t.nodeId;return Ni(e,D);case vi.HYDRATE_DEFAULT_NODES:var k=xi({},e);for(var I in k)if(k[I].defaultNode){var A=we(10),R=k[I];R.id,R.defaultNode;var M=Me(R,hi);k[A]=xi(xi({},M),{},{id:A}),delete k[I]}return k;case vi.SET_PORT_DATA:var L=t.nodeId,z=t.portName,B=t.controlName,W=t.data,q=t.setValue,F=xi(xi({},e[L].inputData),{},l({},z,xi(xi({},e[L].inputData[z]),{},l({},B,W))));return q&&(F=q(F,e[L].inputData)),xi(xi({},e),{},l({},L,xi(xi({},e[L]),{},{inputData:F})));case vi.SET_NODE_COORDINATES:var V=t.x,H=t.y,Y=t.nodeId;return xi(xi({},e),{},l({},Y,xi(xi({},e[Y]),{},{x:V,y:H})));default:return e}},Si=["isNew"];function Di(e){var t=function(e,t){if("object"!==Xa(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==Xa(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===Xa(t)?t:String(t)}function ki(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Ii(e){for(var t=1;t0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;switch(t.type){case Oi.ADD_COMMENT:var n={id:we(10),text:"",x:t.x,y:t.y,width:200,height:30,color:"blue",isNew:!0};return Ii(Ii({},e),{},l({},n.id,n));case Oi.REMOVE_COMMENT_NEW:var r=e[t.id];r.isNew;var o=Me(r,Si);return Ii(Ii({},e),{},l({},t.id,o));case Oi.SET_COMMENT_COORDINATES:return Ri(e,t.id,{x:t.x,y:t.y});case Oi.SET_COMMENT_DIMENSIONS:return Ri(e,t.id,{width:t.width,height:t.height});case Oi.SET_COMMENT_TEXT:return Ri(e,t.id,{text:t.text});case Oi.SET_COMMENT_COLOR:return Ri(e,t.id,{color:t.color});case Oi.DELETE_COMMENT:var a=t.id;e[a];var i=Me(e,[a].map(Di));return i;default:return e}};function Li(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function zi(e){for(var t=1;t50?e.label.slice(0,50)+"...":e.label})}),[n,u]);return o.a.createElement(o.a.Fragment,null,l&&"string"!=typeof u?u.length?o.a.createElement("div",{className:cu},u.map((function(e,t){var r=(n.find((function(t){return t.value===e}))||{}).label||"";return o.a.createElement(bu,{onRequestDelete:function(){return e=t,void i([].concat(Ka(u.slice(0,e)),Ka(u.slice(e+1))));var e},key:e},r)}))):null:u?o.a.createElement(fu,{wrapperRef:y,option:_,onClick:h}):null,(l||!u)&&o.a.createElement("div",{className:au,ref:y,onClick:h},a),p&&o.a.createElement(A,null,o.a.createElement(je,{x:m.x,y:m.y,emptyText:"There are no options",options:l?n.filter((function(e){return!u.includes(e.value)})):n,onOptionSelected:function(e){l&&Array.isArray(u)?i([].concat(Ka(u),[e.value])):i(e.value)},onRequestClose:function(){f(!1)}})))},fu=function(e){var t=e.option,n=(t=void 0===t?{label:"",description:"",value:""}:t).label,r=t.description,a=e.wrapperRef,i=e.onClick;return o.a.createElement("div",{className:lu,onClick:i,ref:a,"data-flume-component":"select"},o.a.createElement("label",{"data-flume-component":"select-label"},n),r?o.a.createElement("p",{"data-flume-component":"select-desc"},r):null)},bu=function(e){var t=e.children,n=e.onRequestDelete;return o.a.createElement("div",{className:iu},t,o.a.createElement("button",{className:uu,onMouseDown:function(e){e.stopPropagation()},onClick:n},"\u2715"))};function mu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function vu(e){for(var t=1;t=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}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 a,i=!0,u=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return i=e.done,e},e:function(e){u=!0,a=e},f:function(){try{i||null==n.return||n.return()}finally{if(u)throw a}}}}function Eu(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;Object.entries(e).forEach((function(e){var n=d(e,2),r=n[0];n[1].forEach((function(e){var n,o,i,u,c,s,p,d,f,b,m,v,h,_,x,O,E,w,j,N,T,C,P,S,D,k=si(a,r,t?"output":"input",y),I=si(e.nodeId,e.portName,t?"input":"output",y),A=(null!==(n=null==I?void 0:I.width)&&void 0!==n?n:0)/2;S=t?a+r+e.nodeId+e.portName:e.nodeId+e.portName+a+r;var R=null==y||null===(o=y.current)||void 0===o?void 0:o.connections[S];R?D=R:(D=document.querySelector('[data-connection-id="'.concat(S,'"]')))&&y&&y.current&&(y.current.connections[S]=D);var L={x:M((null!==(i=null==I?void 0:I.x)&&void 0!==i?i:0)-(null!==(u=null===(c=l.current)||void 0===c?void 0:c.x)&&void 0!==u?u:0)+A-(null!==(s=null===(p=l.current)||void 0===p?void 0:p.width)&&void 0!==s?s:0)/2)+M(g.translate.x),y:M((null!==(d=null==I?void 0:I.y)&&void 0!==d?d:0)-(null!==(f=null===(b=l.current)||void 0===b?void 0:b.y)&&void 0!==f?f:0)-(null!==(m=null===(v=l.current)||void 0===v?void 0:v.height)&&void 0!==m?m:0)/2+A)+M(g.translate.y)},z={x:M((null!==(h=null==k?void 0:k.x)&&void 0!==h?h:0)-(null!==(_=null===(x=l.current)||void 0===x?void 0:x.x)&&void 0!==_?_:0)-(null!==(O=null===(E=l.current)||void 0===E?void 0:E.width)&&void 0!==O?O:0)/2)+M(g.translate.x),y:M((null!==(w=null==k?void 0:k.y)&&void 0!==w?w:0)-(null!==(j=null===(N=l.current)||void 0===N?void 0:N.y)&&void 0!==j?j:0)-(null!==(T=null===(C=l.current)||void 0===C?void 0:C.height)&&void 0!==T?T:0)/2+A)+M(g.translate.y)};null===(P=D)||void 0===P||P.setAttribute("d",pi(t?z:L,t?L:z))}))}))},z=function(){s&&(L(s.inputs),L(s.outputs,!0))},B=function(e){return e.preventDefault(),e.stopPropagation(),R({x:e.clientX,y:e.clientY}),D(!0),!1},W=function(){D(!1)},q=function(){null==_||_({type:vi.REMOVE_NODE,nodeId:a})};return o.a.createElement(Be,{className:qi,style:{width:i,transform:"translate(".concat(u,"px, ").concat(c,"px)")},onDragStart:function(){m()},onDrag:function(e){var t=e.x,n=e.y;C.current&&(C.current.style.transform="translate(".concat(t,"px,").concat(n,"px)"),z())},onDragEnd:function(e,t){null==_||_(Du(Du({type:vi.SET_NODE_COORDINATES},t),{},{nodeId:a}))},innerRef:C,"data-node-id":a,"data-flume-component":"node","data-flume-node-type":x.type,"data-flume-component-is-root":!!b,onContextMenu:B,stageState:g,stageRect:l},v?v(Iu,x,{openMenu:B,closeMenu:W,deleteNode:q}):o.a.createElement(Iu,null,O),o.a.createElement(ju,{nodeId:a,inputs:j,outputs:T,connections:s,updateNodeConnections:z,inputData:f}),S?o.a.createElement(A,null,o.a.createElement(je,{x:I.x,y:I.y,options:Ka(!1!==E?[{label:"Delete Node",value:"deleteNode",description:"Deletes a node and all of its connections."}]:[]),onRequestClose:W,onOptionSelected:function(e){switch(e.value){case"deleteNode":q();break;default:return}},hideFilter:!0,label:"Node Options",emptyText:"This node has no options."})):null)},Iu=function(e){var t=e.children,n=e.className,r=void 0===n?"":n,a=Me(e,Pu);return o.a.createElement("h2",Du(Du({},a),{},{className:Fi+(r?" ".concat(r):""),"data-flume-component":"node-header"}),t)},Au="Comment_wrapper__1Pnbd",Ru="Comment_text__Ie2nX",Mu="Comment_resizeThumb__20KWn",Lu="Comment_textarea__2Rze3";_('.Comment_wrapper__1Pnbd {\n position: absolute;\n left: 0px;\n top: 0px;\n padding: 5px;\n background: rgba(147, 154, 158, 0.7);\n border-radius: 5px;\n border-bottom-right-radius: 2px;\n box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.2);\n min-width: 80px;\n font-size: 14px;\n display: flex;\n text-shadow: 0px 1px rgba(255,255,255,.1);\n border: 1px solid rgba(168, 176, 181, 0.7);\n user-select: none;\n}\n .Comment_wrapper__1Pnbd[data-color="red"]{\n background: rgba(213, 84, 103, 0.65);\n border-color: rgba(227, 85, 119, 0.65);\n }\n .Comment_wrapper__1Pnbd[data-color="purple"]{\n background: rgba(153, 83, 196, 0.65);\n border-color: rgba(156, 85, 227, 0.65);\n }\n .Comment_wrapper__1Pnbd[data-color="blue"]{\n background: rgba(76, 142, 203, 0.65);\n border-color: rgba(85, 159, 227, 0.65);\n }\n .Comment_wrapper__1Pnbd[data-color="green"]{\n background: rgba(70, 200, 130, 0.65);\n border-color: rgba(85, 227, 150, 0.65);\n }\n .Comment_wrapper__1Pnbd[data-color="yellow"]{\n background: rgba(200, 167, 63, 0.65);\n border-color: rgba(227, 213, 85, 0.65);\n }\n .Comment_wrapper__1Pnbd[data-color="orange"]{\n background: rgba(215, 123, 64, 0.65);\n border-color: rgba(227, 149, 85, 0.65);\n }\n .Comment_wrapper__1Pnbd[data-color="pink"]{\n background: rgba(255, 102, 208, 0.65);\n border-color: rgba(242, 131, 228, 0.65);\n }\n.Comment_text__Ie2nX{\n width: 100%;\n height: 100%;\n overflow: auto;\n white-space: pre-wrap;\n cursor: default;\n}\n.Comment_resizeThumb__20KWn {\n width: 10px;\n height: 10px;\n border-radius: 4px 0px 4px 0px;\n position: absolute;\n right: 0px;\n bottom: 0px;\n overflow: hidden;\n cursor: nwse-resize;\n}\n.Comment_resizeThumb__20KWn::before,\n .Comment_resizeThumb__20KWn::after {\n content: "";\n position: absolute;\n right: 0px;\n top: 0px;\n width: 250%;\n height: 0px;\n border-top: 1px solid rgba(0, 0, 0, 0.7);\n border-bottom: 2px solid rgba(255, 255, 255, 0.7);\n transform-origin: center right;\n transform: rotate(-45deg) scale(0.5);\n }\n.Comment_resizeThumb__20KWn::after {\n transform: rotate(-45deg) translateY(3px) scale(0.5);\n }\n.Comment_textarea__2Rze3 {\n resize: none;\n width: calc(100% + 2px);\n height: calc(100% + 2px);\n border-radius: 3px;\n background: rgba(255,255,255,.1);\n border: none;\n outline: none;\n margin: -2px;\n margin-top: -1px;\n padding-top: 0px;\n font-size: 14px;\n}\n.Comment_textarea__2Rze3::placeholder{\n color: rgba(0,0,0,.5);\n }\n');var zu="ColorPicker_wrapper__1M1j2",Bu="ColorPicker_colorButtonWrapper__1ijdj",Wu="ColorPicker_colorButton__1Qcuq";function qu(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Fu(e,t){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{};return{type:t.type,name:n.name||t.name,label:n.label||t.label,noControls:!!Ku(n.noControls,!1),color:n.color||t.color,hidePort:!!Ku(n.hidePort,t.hidePort),controls:null!==(e=Ku(n.controls,t.controls))&&void 0!==e?e:[]}},e}),{})},$u=function(){function e(t){qu(this,e),t?(this.nodeTypes=Xu({},t.nodeTypes),this.portTypes=Xu({},t.portTypes)):(this.nodeTypes={},this.portTypes={})}return Vu(e,[{key:"addRootNodeType",value:function(e){return this.addNodeType(Xu(Xu({},e),{},{root:!0,addable:!1,deletable:!1})),this}},{key:"addNodeType",value:function(e){if("object"!==Xa(e)&&null!==e)throw new Error("You must provide a configuration object when calling addNodeType.");if("string"!=typeof e.type)throw new Error('Required key, "type" must be a string when calling addNodeType.');if(void 0!==e.initialWidth&&"number"!=typeof e.initialWidth)throw new Error('Optional key, "initialWidth" must be a number when calling addNodeType.');if(void 0!==this.nodeTypes[e.type])throw new Error('A node with type "'.concat(e.type,'" has already been declared.'));var t={type:e.type,label:Ku(e.label,""),description:Ku(e.description,""),addable:Ku(e.addable,!0),deletable:Ku(e.deletable,!0)};if(e.initialWidth&&(t.initialWidth=e.initialWidth),void 0!==e.sortIndex&&(t.sortIndex=e.sortIndex),"function"==typeof e.inputs){var n=e.inputs(Gu(this.portTypes));if(!Array.isArray(n)&&"function"!=typeof e.inputs)throw new Error('When providing a function to the "inputs" key, you must return either an array or a function.');t.inputs=n}else if(void 0===e.inputs)t.inputs=[];else{if(!Array.isArray(e.inputs))throw new Error('Optional key, "inputs" must be an array.');t.inputs=e.inputs}if("function"==typeof e.outputs){var r=e.outputs(Gu(this.portTypes));if(!Array.isArray(r)&&"function"!=typeof e.outputs)throw new Error('When providing a function to the "outputs" key, you must return either an array or a function.');t.outputs=r}else if(void 0===e.outputs)t.outputs=[];else{if(void 0!==e.outputs&&!Array.isArray(e.outputs))throw new Error('Optional key, "outputs" must be an array.');t.outputs=e.outputs}if(void 0!==e.root){if("boolean"!=typeof e.root)throw new Error('Optional key, "root" must be a boolean.');t.root=e.root}return this.nodeTypes[e.type]=t,this}},{key:"removeNodeType",value:function(e){if(this.nodeTypes[e]){var t=this.nodeTypes;t[e];var n=Me(t,[e].map(Hu));this.nodeTypes=n}else console.error('Non-existent node type "'.concat(e,'" cannot be removed.'));return this}},{key:"addPortType",value:function(e){if("object"!==Xa(e)&&null!==e)throw new Error("You must provide a configuration object when calling addPortType");if("string"!=typeof e.type)throw new Error('Required key, "type" must be a string when calling addPortType.');if(void 0!==this.portTypes[e.type])throw new Error('A port with type "'.concat(e.type,'" has already been declared.'));if("string"!=typeof e.name)throw new Error('Required key, "name" must be a string when calling addPortType.');var t={type:e.type,name:e.name,label:Ku(e.label,""),color:Ku(e.color,Qu.grey),hidePort:Ku(e.hidePort,!1)};if(void 0===e.acceptTypes)t.acceptTypes=[e.type];else{if(!Array.isArray(e.acceptTypes))throw new Error('Optional key, "acceptTypes" must be an array.');t.acceptTypes=e.acceptTypes}if(void 0===e.controls)t.controls=[];else{if(!Array.isArray(e.controls))throw new Error('Optional key, "controls" must be an array.');t.controls=e.controls}return this.portTypes[e.type]=t,this}},{key:"removePortType",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.skipDynamicNodesCheck,r=void 0!==n&&n;if(this.portTypes[e]){if(!r){var o=Object.values(this.nodeTypes).filter((function(e){return"function"==typeof e.inputs||"function"==typeof e.outputs}));o.length&&console.warn("We've detected that one or more of your nodes is using dynamic inputs/outputs. This is a potentially dangerous operation as we are unable to detect if this portType is being used in one of those nodes. You can quiet this message by passing { skipDynamicNodesCheck: true } in as the second argument.")}var a=Object.values(this.nodeTypes).filter((function(t){return Array.isArray(t.inputs)&&t.inputs.find((function(t){return t.type===e}))||Array.isArray(t.outputs)&&t.outputs.find((function(t){return t.type===e}))}));if(a.length)throw new Error('Cannot delete port type "'.concat(e,'" without first deleting all node types using these ports: [').concat(a.map((function(e){return"".concat(e.type)})).join(", "),"]"));var i=this.portTypes;i[e];var u=Me(i,[e].map(Hu));this.portTypes=u}else console.error('Non-existent port type "'.concat(e,'" cannot be removed.'));return this}}]),e}(),Zu=function(e){var t=e.x,n=e.y,r=e.onColorPicked,a=e.onRequestClose,i=o.a.useRef(null),u=o.a.useCallback((function(e){i.current&&!i.current.contains(e.target)&&(a(),document.removeEventListener("click",u),document.removeEventListener("contextmenu",u))}),[i,a]),c=o.a.useCallback((function(e){"Escape"===e.key&&(a(),document.removeEventListener("keydown",c))}),[a]);return o.a.useEffect((function(){return setTimeout((function(){document.addEventListener("keydown",c),document.addEventListener("click",u),document.addEventListener("contextmenu",u)})),function(){document.removeEventListener("click",u),document.removeEventListener("contextmenu",u),document.removeEventListener("keydown",c)}}),[u,c]),o.a.createElement("div",{"data-flume-component":"color-picker",ref:i,className:zu,style:{left:t,top:n}},Object.values(Qu).map((function(e){var t=e;return o.a.createElement(ec,{onSelected:function(){r(t),a()},color:t,key:t})})))},ec=function(e){var t=e.color,n=e.onSelected;return o.a.createElement("div",{className:Bu},o.a.createElement("button",{"data-flume-component":"color-button",className:Wu,onClick:n,"data-color":t,"aria-label":t}))},tc=function(e){var t=e.dispatch,n=e.id,r=e.x,a=e.y,i=e.width,u=e.height,c=e.color,l=e.text,s=e.stageRect,p=e.onDragStart,f=e.isNew,b=o.a.useContext(ke),m=o.a.useRef(null),v=o.a.useRef(null),y=d(o.a.useState(!1),2),h=y[0],_=y[1],g=d(o.a.useState(!1),2),x=g[0],O=g[1],E=d(o.a.useState(!1),2),w=E[0],j=E[1],N=d(o.a.useState({x:0,y:0}),2),T=N[0],C=N[1],P=d(o.a.useState({x:0,y:0}),2),S=P[0],D=P[1],k=function(){_(!0)},I=o.a.useCallback((function(){return O(!1)}),[]);return o.a.useEffect((function(){f&&(_(!0),t({type:Oi.REMOVE_COMMENT_NEW,id:n}))}),[f,t,n]),o.a.createElement(Be,{innerRef:m,className:Au,style:{transform:"translate(".concat(r,"px,").concat(a,"px)"),width:i,height:u,zIndex:h?999:""},stageState:b,stageRect:s,onDragStart:function(e){p()},onDrag:function(e){var t=e.x,n=e.y;m.current&&(m.current.style.transform="translate(".concat(t,"px,").concat(n,"px)"))},onDragEnd:function(e,r){var o=r.x,a=r.y;t({type:Oi.SET_COMMENT_COORDINATES,id:n,x:o,y:a})},onContextMenu:function(e){return e.preventDefault(),e.stopPropagation(),C({x:e.clientX,y:e.clientY}),j(!0),!1},onDoubleClick:k,onWheel:function(e){return e.stopPropagation()},"data-color":c,"data-flume-component":"comment"},h?o.a.createElement("textarea",{"data-flume-component":"comment-textarea",className:Lu,onChange:function(e){t({type:Oi.SET_COMMENT_TEXT,id:n,text:e.target.value})},onMouseDown:function(e){return e.stopPropagation()},onBlur:function(){_(!1)},placeholder:"Text of the comment...",autoFocus:!0,value:l,ref:v}):o.a.createElement("div",{"data-flume-component":"comment-text","data-comment":!0,className:Ru},l),o.a.createElement(Be,{className:Mu,stageState:b,stageRect:s,onDrag:function(e){var t=Ee(e.x-r+10,80,1e4),n=Ee(e.y-a+10,30,1e4);m.current&&(m.current.style.width="".concat(t,"px"),m.current.style.height="".concat(n,"px"))},onDragEnd:function(e,o){var i=Ee(o.x-r+10,80,1e4),u=Ee(o.y-a+10,30,1e4);t({type:Oi.SET_COMMENT_DIMENSIONS,id:n,width:i,height:u})},"data-flume-component":"comment-resize-handle"}),w?o.a.createElement(A,null,o.a.createElement(je,{hideFilter:!0,label:"Comment Options",x:T.x,y:T.y,options:[{value:"edit",label:"Edit Comment",description:"Edit the text of the comment"},{value:"color",label:"Change Color",description:"Change the color of the comment"},{value:"delete",label:"Delete Comment",description:"Delete the comment"}],onRequestClose:function(){return j(!1)},onOptionSelected:function(e){switch(e.value){case"edit":k();break;case"color":D(T),O(!0);break;case"delete":t({type:Oi.DELETE_COMMENT,id:n})}}})):null,x?o.a.createElement(A,null,o.a.createElement(Zu,{x:S.x,y:S.y,onRequestClose:I,onColorPicked:function(e){t({type:Oi.SET_COMMENT_COLOR,id:n,color:e})}})):null)},nc="Toaster_toaster__1eC3T",rc="Toaster_toast__3YHVS",oc="Toaster_title__4InNr",ac="Toaster_timer__3dGzF",ic="Toaster_exitButton__1S_Ks";function uc(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function cc(e){for(var t=1;t0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=arguments.length>2?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0,o=arguments.length>4?arguments[4]:void 0,a=Ti(e,n,r,o);return xi(xi({},a),t.reduce((function(t,a,i){return!Object.values(e).find((function(e){return e.type===a.type}))&&(t=Pi(t,{type:vi.ADD_NODE,id:"default-".concat(i),defaultNode:!0,x:a.x||0,y:a.y||0,nodeType:a.type},{nodeTypes:n,portTypes:r,context:o})),t}),{}))}(i,f,c,s,y)})),2),K=X[0],U=X[1],J=d(o.a.useReducer(Mi,a||{}),2),Q=J[0],G=J[1];o.a.useEffect((function(){U({type:vi.HYDRATE_DEFAULT_NODES})}),[]);var $=d(o.a.useState(!0),2),Z=$[0],ee=$[1],te=d(o.a.useReducer(Bi,{scale:"number"==typeof x?Ee(x,.1,7):1,translate:{x:0,y:0}}),2),ne=te[0],re=te[1],oe=o.a.useCallback((function(){fi(K,ne,L)}),[K,L,ne]),ae=o.a.useCallback((function(){var e;B.current=null===(e=document.getElementById("".concat(Ya).concat(L)))||void 0===e?void 0:e.getBoundingClientRect()}),[L]);o.a.useLayoutEffect((function(){Z&&(oe(),ee(!1))}),[Z,oe]);var ie=o.a.useCallback((function(){ee(!0)}),[]);o.a.useImperativeHandle(t,(function(){return{getNodes:function(){return K},getComments:function(){return Q}}}));var ue=_u(K);o.a.useEffect((function(){ue&&_&&K!==ue&&_(K)}),[K,ue,_]);var ce=_u(Q);return o.a.useEffect((function(){ce&&g&&Q!==ce&&g(Q)}),[Q,ce,g]),o.a.useEffect((function(){q&&(Y(q),F(void 0))}),[q]),o.a.createElement(Ce.Provider,{value:s},o.a.createElement(Te.Provider,{value:c},o.a.createElement(Pe.Provider,{value:U},o.a.createElement(Se.Provider,{value:ie},o.a.createElement(De.Provider,{value:y},o.a.createElement(ke.Provider,{value:ne},o.a.createElement(Ie.Provider,{value:z},o.a.createElement(Re.Provider,{value:L},o.a.createElement(Ae.Provider,{value:ae},o.a.createElement(Wi,{editorId:L,scale:ne.scale,translate:ne.translate,spaceToPan:E,disablePan:D,disableZoom:P,dispatchStageState:re,dispatchComments:G,disableComments:T||j,disableFocusCapture:I,stageRef:B,numNodes:Object.keys(K).length,outerStageChildren:o.a.createElement(o.a.Fragment,null,M&&o.a.createElement("div",{className:bc.debugWrapper},o.a.createElement("button",{className:bc.debugButton,onClick:function(){return console.log(K)}},"Log Nodes"),o.a.createElement("button",{className:bc.debugButton,onClick:function(){return console.log(JSON.stringify(K))}},"Export Nodes"),o.a.createElement("button",{className:bc.debugButton,onClick:function(){return console.log(Q)}},"Log Comments")),o.a.createElement(lc,{toasts:H,dispatchToasts:Y}))},!j&&Object.values(Q).map((function(e){return o.a.createElement(tc,vc(vc({},e),{},{stageRect:B,dispatch:G,onDragStart:ae,key:e.id}))})),Object.values(K).map((function(e){return o.a.createElement(ku,vc(vc({},e),{},{stageRect:B,onDragStart:ae,renderNodeHeader:R,key:e.id}))})),o.a.createElement(dc,{editorId:L}),o.a.createElement("div",{className:bc.dragWrapper,id:"".concat("__node_editor_drag_connection__").concat(L)})))))))))))}));function _c(e,t){return(_c=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function gc(e,t){if(t&&("object"===Xa(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function xc(e){return(xc=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Oc(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function Ec(e,t,n){return(Ec=Oc()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&_c(o,n.prototype),o}).apply(null,arguments)}function wc(e){var t="function"==typeof Map?new Map:void 0;return(wc=function(e){if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;var n;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return Ec(e,arguments,xc(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),_c(r,e)})(e)}function jc(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Nc(e){for(var t=1;t=0&&o.loops>o.maxLoops)throw new Cc("Max loop count exceeded.",Cc.maxLoopsExceeded);o.loops++})),l(this,"getRootNode",(function(e){var t=Object.values(e).filter((function(e){return e.root}));if(t.length>1)throw new Error("The root engine must not be called with more than one root node.");return t[0]})),l(this,"reduceRootInputs",(function(e,t){return Object.entries(e).reduce((function(e,n){var r=d(n,2),o=r[0],a=r[1],i=t(o,a);return e[i.name]=i.value,e}),{})})),l(this,"resolveInputValues",(function(e,t,n,r){var a=t.inputs;return"function"==typeof a&&(a=a(e.inputData,e.connections,r)),a.reduce((function(t,a){var i=e.connections.inputs[a.name]||[];return i.length>0?t[a.name]=o.getValueOfConnection(i[0],n,r):t[a.name]=o.resolveInputControls(a.type,e.inputData[a.name]||{},r),t}),{})})),l(this,"getValueOfConnection",(function(e,t,n){o.checkLoops();var r=t[e.nodeId],a=o.config.nodeTypes[r.type],i=o.resolveInputValues(r,a,t,n);return o.fireNodeFunction(r,i,a,n)[e.portName]})),this.config=t,this.fireNodeFunction=r,this.resolveInputControls=n,this.loops=0,this.maxLoops=1e3}return Vu(e,[{key:"resolveRootNode",value:function(e,t){var n=this,r=null!=t?t:{},o=r.rootNodeId?e[r.rootNodeId]:this.getRootNode(e);if(o){var a=this.config.nodeTypes[o.type].inputs;"function"==typeof a&&(a=a(o.inputData,o.connections,r.context));var i=a.reduce((function(e,t){return e[t.name]=n.resolveInputControls(t.type,o.inputData[t.name]||{},r.context),e}),{}),u=this.reduceRootInputs(o.connections.inputs,(function(t,o){var a;n.resetLoops(r.maxLoops);try{a=n.getValueOfConnection(o[0],e,r.context)}catch(u){var i=u;i.code===Cc.maxLoopsExceeded?console.error("".concat(i.message," Circular nodes detected in ").concat(t," port.")):console.error(u)}finally{return{name:t,value:a}}}));return r.onlyResolveConnected?u:Nc(Nc({},i),u)}return console.error("A root node was not found. The Root Engine requires that exactly one node be marked as the root node."),{}}}]),e}();function Sc(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Dc(e){for(var t=1;t