var dk=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var Dde=dk((an,Nt)=>{(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const o of i)if(o.type==="childList")for(const a of o.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&r(a)}).observe(document,{childList:!0,subtree:!0});function n(i){const o={};return i.integrity&&(o.integrity=i.integrity),i.referrerPolicy&&(o.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?o.credentials="include":i.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(i){if(i.ep)return;i.ep=!0;const o=n(i);fetch(i.href,o)}})();var yi=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function pn(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var mT={exports:{}},Uf={},vT={exports:{}},ge={};/** * @license React * react.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var tc=Symbol.for("react.element"),fk=Symbol.for("react.portal"),pk=Symbol.for("react.fragment"),hk=Symbol.for("react.strict_mode"),gk=Symbol.for("react.profiler"),mk=Symbol.for("react.provider"),vk=Symbol.for("react.context"),yk=Symbol.for("react.forward_ref"),bk=Symbol.for("react.suspense"),wk=Symbol.for("react.memo"),Ek=Symbol.for("react.lazy"),Ew=Symbol.iterator;function xk(e){return e===null||typeof e!="object"?null:(e=Ew&&e[Ew]||e["@@iterator"],typeof e=="function"?e:null)}var yT={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},bT=Object.assign,wT={};function Ds(e,t,n){this.props=e,this.context=t,this.refs=wT,this.updater=n||yT}Ds.prototype.isReactComponent={};Ds.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};Ds.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function ET(){}ET.prototype=Ds.prototype;function xy(e,t,n){this.props=e,this.context=t,this.refs=wT,this.updater=n||yT}var Sy=xy.prototype=new ET;Sy.constructor=xy;bT(Sy,Ds.prototype);Sy.isPureReactComponent=!0;var xw=Array.isArray,xT=Object.prototype.hasOwnProperty,Cy={current:null},ST={key:!0,ref:!0,__self:!0,__source:!0};function CT(e,t,n){var r,i={},o=null,a=null;if(t!=null)for(r in t.ref!==void 0&&(a=t.ref),t.key!==void 0&&(o=""+t.key),t)xT.call(t,r)&&!ST.hasOwnProperty(r)&&(i[r]=t[r]);var s=arguments.length-2;if(s===1)i.children=n;else if(1>>1,fe=M[de];if(0>>1;dei(Ye,re))Zei(Mt,Ye)?(M[de]=Mt,M[Ze]=re,de=Ze):(M[de]=Ye,M[je]=re,de=je);else if(Zei(Mt,re))M[de]=Mt,M[Ze]=re,de=Ze;else break e}}return J}function i(M,J){var re=M.sortIndex-J.sortIndex;return re!==0?re:M.id-J.id}if(typeof performance=="object"&&typeof performance.now=="function"){var o=performance;e.unstable_now=function(){return o.now()}}else{var a=Date,s=a.now();e.unstable_now=function(){return a.now()-s}}var l=[],u=[],c=1,d=null,f=3,p=!1,y=!1,g=!1,w=typeof setTimeout=="function"?setTimeout:null,h=typeof clearTimeout=="function"?clearTimeout:null,v=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function m(M){for(var J=n(u);J!==null;){if(J.callback===null)r(u);else if(J.startTime<=M)r(u),J.sortIndex=J.expirationTime,t(l,J);else break;J=n(u)}}function b(M){if(g=!1,m(M),!y)if(n(l)!==null)y=!0,se(x);else{var J=n(u);J!==null&&be(b,J.startTime-M)}}function x(M,J){y=!1,g&&(g=!1,h(O),O=-1),p=!0;var re=f;try{for(m(J),d=n(l);d!==null&&(!(d.expirationTime>J)||M&&!D());){var de=d.callback;if(typeof de=="function"){d.callback=null,f=d.priorityLevel;var fe=de(d.expirationTime<=J);J=e.unstable_now(),typeof fe=="function"?d.callback=fe:d===n(l)&&r(l),m(J)}else r(l);d=n(l)}if(d!==null)var Ve=!0;else{var je=n(u);je!==null&&be(b,je.startTime-J),Ve=!1}return Ve}finally{d=null,f=re,p=!1}}var C=!1,P=null,O=-1,N=5,k=-1;function D(){return!(e.unstable_now()-kM||125de?(M.sortIndex=re,t(u,M),n(l)===null&&M===n(u)&&(g?(h(O),O=-1):g=!0,be(b,re-de))):(M.sortIndex=fe,t(l,M),y||p||(y=!0,se(x))),M},e.unstable_shouldYield=D,e.unstable_wrapCallback=function(M){var J=f;return function(){var re=f;f=J;try{return M.apply(this,arguments)}finally{f=re}}}})(_T);AT.exports=_T;var kk=AT.exports;/** * @license React * react-dom.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var IT=R,ln=kk;function j(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Am=Object.prototype.hasOwnProperty,$k=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,Cw={},Tw={};function Dk(e){return Am.call(Tw,e)?!0:Am.call(Cw,e)?!1:$k.test(e)?Tw[e]=!0:(Cw[e]=!0,!1)}function Mk(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function Lk(e,t,n,r){if(t===null||typeof t>"u"||Mk(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function Dt(e,t,n,r,i,o,a){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=o,this.removeEmptyString=a}var mt={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){mt[e]=new Dt(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];mt[t]=new Dt(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){mt[e]=new Dt(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){mt[e]=new Dt(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){mt[e]=new Dt(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){mt[e]=new Dt(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){mt[e]=new Dt(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){mt[e]=new Dt(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){mt[e]=new Dt(e,5,!1,e.toLowerCase(),null,!1,!1)});var Py=/[\-:]([a-z])/g;function Oy(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(Py,Oy);mt[t]=new Dt(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(Py,Oy);mt[t]=new Dt(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(Py,Oy);mt[t]=new Dt(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){mt[e]=new Dt(e,1,!1,e.toLowerCase(),null,!1,!1)});mt.xlinkHref=new Dt("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){mt[e]=new Dt(e,1,!1,e.toLowerCase(),null,!0,!0)});function Ay(e,t,n,r){var i=mt.hasOwnProperty(t)?mt[t]:null;(i!==null?i.type!==0:r||!(2s||i[a]!==o[s]){var l=` `+i[a].replace(" at new "," at ");return e.displayName&&l.includes("")&&(l=l.replace("",e.displayName)),l}while(1<=a&&0<=s);break}}}finally{Dh=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?$l(e):""}function Fk(e){switch(e.tag){case 5:return $l(e.type);case 16:return $l("Lazy");case 13:return $l("Suspense");case 19:return $l("SuspenseList");case 0:case 2:case 15:return e=Mh(e.type,!1),e;case 11:return e=Mh(e.type.render,!1),e;case 1:return e=Mh(e.type,!0),e;default:return""}}function Rm(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case Pa:return"Fragment";case Ta:return"Portal";case _m:return"Profiler";case _y:return"StrictMode";case Im:return"Suspense";case Nm:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case kT:return(e.displayName||"Context")+".Consumer";case RT:return(e._context.displayName||"Context")+".Provider";case Iy:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Ny:return t=e.displayName||null,t!==null?t:Rm(e.type)||"Memo";case hi:t=e._payload,e=e._init;try{return Rm(e(t))}catch{}}return null}function Hk(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Rm(t);case 8:return t===_y?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function Ii(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function DT(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function jk(e){var t=DT(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var i=n.get,o=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(a){r=""+a,o.call(this,a)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(a){r=""+a},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Yc(e){e._valueTracker||(e._valueTracker=jk(e))}function MT(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=DT(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function Qd(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function km(e,t){var n=t.checked;return ze({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function Ow(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=Ii(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function LT(e,t){t=t.checked,t!=null&&Ay(e,"checked",t,!1)}function $m(e,t){LT(e,t);var n=Ii(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?Dm(e,t.type,n):t.hasOwnProperty("defaultValue")&&Dm(e,t.type,Ii(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Aw(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function Dm(e,t,n){(t!=="number"||Qd(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var Dl=Array.isArray;function ja(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i"+t.valueOf().toString()+"",t=Qc.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function uu(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Ul={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},Gk=["Webkit","ms","Moz","O"];Object.keys(Ul).forEach(function(e){Gk.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Ul[t]=Ul[e]})});function GT(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Ul.hasOwnProperty(e)&&Ul[e]?(""+t).trim():t+"px"}function BT(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,i=GT(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,i):e[n]=i}}var Bk=ze({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Fm(e,t){if(t){if(Bk[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(j(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(j(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(j(61))}if(t.style!=null&&typeof t.style!="object")throw Error(j(62))}}function Hm(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var jm=null;function Ry(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Gm=null,Ga=null,Ba=null;function Nw(e){if(e=ic(e)){if(typeof Gm!="function")throw Error(j(280));var t=e.stateNode;t&&(t=Yf(t),Gm(e.stateNode,e.type,t))}}function zT(e){Ga?Ba?Ba.push(e):Ba=[e]:Ga=e}function UT(){if(Ga){var e=Ga,t=Ba;if(Ba=Ga=null,Nw(e),t)for(e=0;e>>=0,e===0?32:31-(Zk(e)/e$|0)|0}var Xc=64,Jc=4194304;function Ml(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function ef(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,i=e.suspendedLanes,o=e.pingedLanes,a=n&268435455;if(a!==0){var s=a&~i;s!==0?r=Ml(s):(o&=a,o!==0&&(r=Ml(o)))}else a=n&~i,a!==0?r=Ml(a):o!==0&&(r=Ml(o));if(r===0)return 0;if(t!==0&&t!==r&&!(t&i)&&(i=r&-r,o=t&-t,i>=o||i===16&&(o&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function nc(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Yn(t),e[t]=n}function i$(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0=Vl),jw=String.fromCharCode(32),Gw=!1;function cP(e,t){switch(e){case"keyup":return R$.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function dP(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Oa=!1;function $$(e,t){switch(e){case"compositionend":return dP(t);case"keypress":return t.which!==32?null:(Gw=!0,jw);case"textInput":return e=t.data,e===jw&&Gw?null:e;default:return null}}function D$(e,t){if(Oa)return e==="compositionend"||!jy&&cP(e,t)?(e=lP(),Rd=Ly=bi=null,Oa=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=Ww(n)}}function gP(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?gP(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function mP(){for(var e=window,t=Qd();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Qd(e.document)}return t}function Gy(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function U$(e){var t=mP(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&gP(n.ownerDocument.documentElement,n)){if(r!==null&&Gy(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var i=n.textContent.length,o=Math.min(r.start,i);r=r.end===void 0?o:Math.min(r.end,i),!e.extend&&o>r&&(i=r,r=o,o=i),i=Vw(n,o);var a=Vw(n,r);i&&a&&(e.rangeCount!==1||e.anchorNode!==i.node||e.anchorOffset!==i.offset||e.focusNode!==a.node||e.focusOffset!==a.offset)&&(t=t.createRange(),t.setStart(i.node,i.offset),e.removeAllRanges(),o>r?(e.addRange(t),e.extend(a.node,a.offset)):(t.setEnd(a.node,a.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,Aa=null,Km=null,ql=null,qm=!1;function Kw(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;qm||Aa==null||Aa!==Qd(r)||(r=Aa,"selectionStart"in r&&Gy(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),ql&&gu(ql,r)||(ql=r,r=rf(Km,"onSelect"),0Na||(e.current=ev[Na],ev[Na]=null,Na--)}function Ne(e,t){Na++,ev[Na]=e.current,e.current=t}var Ni={},Pt=Vi(Ni),Bt=Vi(!1),Eo=Ni;function es(e,t){var n=e.type.contextTypes;if(!n)return Ni;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var i={},o;for(o in n)i[o]=t[o];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=i),i}function zt(e){return e=e.childContextTypes,e!=null}function af(){Le(Bt),Le(Pt)}function e1(e,t,n){if(Pt.current!==Ni)throw Error(j(168));Ne(Pt,t),Ne(Bt,n)}function TP(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var i in r)if(!(i in t))throw Error(j(108,Hk(e)||"Unknown",i));return ze({},n,r)}function sf(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Ni,Eo=Pt.current,Ne(Pt,e),Ne(Bt,Bt.current),!0}function t1(e,t,n){var r=e.stateNode;if(!r)throw Error(j(169));n?(e=TP(e,t,Eo),r.__reactInternalMemoizedMergedChildContext=e,Le(Bt),Le(Pt),Ne(Pt,e)):Le(Bt),Ne(Bt,n)}var Hr=null,Qf=!1,Qh=!1;function PP(e){Hr===null?Hr=[e]:Hr.push(e)}function nD(e){Qf=!0,PP(e)}function Ki(){if(!Qh&&Hr!==null){Qh=!0;var e=0,t=Ee;try{var n=Hr;for(Ee=1;e>=a,i-=a,Gr=1<<32-Yn(t)+i|n<O?(N=P,P=null):N=P.sibling;var k=f(h,P,m[O],b);if(k===null){P===null&&(P=N);break}e&&P&&k.alternate===null&&t(h,P),v=o(k,v,O),C===null?x=k:C.sibling=k,C=k,P=N}if(O===m.length)return n(h,P),He&&ao(h,O),x;if(P===null){for(;OO?(N=P,P=null):N=P.sibling;var D=f(h,P,k.value,b);if(D===null){P===null&&(P=N);break}e&&P&&D.alternate===null&&t(h,P),v=o(D,v,O),C===null?x=D:C.sibling=D,C=D,P=N}if(k.done)return n(h,P),He&&ao(h,O),x;if(P===null){for(;!k.done;O++,k=m.next())k=d(h,k.value,b),k!==null&&(v=o(k,v,O),C===null?x=k:C.sibling=k,C=k);return He&&ao(h,O),x}for(P=r(h,P);!k.done;O++,k=m.next())k=p(P,h,O,k.value,b),k!==null&&(e&&k.alternate!==null&&P.delete(k.key===null?O:k.key),v=o(k,v,O),C===null?x=k:C.sibling=k,C=k);return e&&P.forEach(function(L){return t(h,L)}),He&&ao(h,O),x}function w(h,v,m,b){if(typeof m=="object"&&m!==null&&m.type===Pa&&m.key===null&&(m=m.props.children),typeof m=="object"&&m!==null){switch(m.$$typeof){case qc:e:{for(var x=m.key,C=v;C!==null;){if(C.key===x){if(x=m.type,x===Pa){if(C.tag===7){n(h,C.sibling),v=i(C,m.props.children),v.return=h,h=v;break e}}else if(C.elementType===x||typeof x=="object"&&x!==null&&x.$$typeof===hi&&l1(x)===C.type){n(h,C.sibling),v=i(C,m.props),v.ref=yl(h,C,m),v.return=h,h=v;break e}n(h,C);break}else t(h,C);C=C.sibling}m.type===Pa?(v=vo(m.props.children,h.mode,b,m.key),v.return=h,h=v):(b=jd(m.type,m.key,m.props,null,h.mode,b),b.ref=yl(h,v,m),b.return=h,h=b)}return a(h);case Ta:e:{for(C=m.key;v!==null;){if(v.key===C)if(v.tag===4&&v.stateNode.containerInfo===m.containerInfo&&v.stateNode.implementation===m.implementation){n(h,v.sibling),v=i(v,m.children||[]),v.return=h,h=v;break e}else{n(h,v);break}else t(h,v);v=v.sibling}v=ig(m,h.mode,b),v.return=h,h=v}return a(h);case hi:return C=m._init,w(h,v,C(m._payload),b)}if(Dl(m))return y(h,v,m,b);if(pl(m))return g(h,v,m,b);od(h,m)}return typeof m=="string"&&m!==""||typeof m=="number"?(m=""+m,v!==null&&v.tag===6?(n(h,v.sibling),v=i(v,m),v.return=h,h=v):(n(h,v),v=rg(m,h.mode,b),v.return=h,h=v),a(h)):n(h,v)}return w}var ns=$P(!0),DP=$P(!1),oc={},gr=Vi(oc),bu=Vi(oc),wu=Vi(oc);function ho(e){if(e===oc)throw Error(j(174));return e}function Qy(e,t){switch(Ne(wu,t),Ne(bu,e),Ne(gr,oc),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:Lm(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=Lm(t,e)}Le(gr),Ne(gr,t)}function rs(){Le(gr),Le(bu),Le(wu)}function MP(e){ho(wu.current);var t=ho(gr.current),n=Lm(t,e.type);t!==n&&(Ne(bu,e),Ne(gr,n))}function Xy(e){bu.current===e&&(Le(gr),Le(bu))}var Ge=Vi(0);function pf(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.data==="$!"))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var Xh=[];function Jy(){for(var e=0;en?n:4,e(!0);var r=Jh.transition;Jh.transition={};try{e(!1),t()}finally{Ee=n,Jh.transition=r}}function JP(){return kn().memoizedState}function aD(e,t,n){var r=Ai(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},ZP(e))eO(t,n);else if(n=IP(e,t,n,r),n!==null){var i=Rt();Qn(n,e,r,i),tO(n,t,r)}}function sD(e,t,n){var r=Ai(e),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(ZP(e))eO(t,i);else{var o=e.alternate;if(e.lanes===0&&(o===null||o.lanes===0)&&(o=t.lastRenderedReducer,o!==null))try{var a=t.lastRenderedState,s=o(a,n);if(i.hasEagerState=!0,i.eagerState=s,Xn(s,a)){var l=t.interleaved;l===null?(i.next=i,qy(t)):(i.next=l.next,l.next=i),t.interleaved=i;return}}catch{}finally{}n=IP(e,t,i,r),n!==null&&(i=Rt(),Qn(n,e,r,i),tO(n,t,r))}}function ZP(e){var t=e.alternate;return e===Be||t!==null&&t===Be}function eO(e,t){Yl=hf=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function tO(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,$y(e,n)}}var gf={readContext:Rn,useCallback:yt,useContext:yt,useEffect:yt,useImperativeHandle:yt,useInsertionEffect:yt,useLayoutEffect:yt,useMemo:yt,useReducer:yt,useRef:yt,useState:yt,useDebugValue:yt,useDeferredValue:yt,useTransition:yt,useMutableSource:yt,useSyncExternalStore:yt,useId:yt,unstable_isNewReconciler:!1},lD={readContext:Rn,useCallback:function(e,t){return sr().memoizedState=[e,t===void 0?null:t],e},useContext:Rn,useEffect:c1,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Md(4194308,4,KP.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Md(4194308,4,e,t)},useInsertionEffect:function(e,t){return Md(4,2,e,t)},useMemo:function(e,t){var n=sr();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=sr();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=aD.bind(null,Be,e),[r.memoizedState,e]},useRef:function(e){var t=sr();return e={current:e},t.memoizedState=e},useState:u1,useDebugValue:r0,useDeferredValue:function(e){return sr().memoizedState=e},useTransition:function(){var e=u1(!1),t=e[0];return e=oD.bind(null,e[1]),sr().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=Be,i=sr();if(He){if(n===void 0)throw Error(j(407));n=n()}else{if(n=t(),st===null)throw Error(j(349));So&30||HP(r,t,n)}i.memoizedState=n;var o={value:n,getSnapshot:t};return i.queue=o,c1(GP.bind(null,r,o,e),[e]),r.flags|=2048,Su(9,jP.bind(null,r,o,n,t),void 0,null),n},useId:function(){var e=sr(),t=st.identifierPrefix;if(He){var n=Br,r=Gr;n=(r&~(1<<32-Yn(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=Eu++,0<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=a.createElement(n,{is:r.is}):(e=a.createElement(n),n==="select"&&(a=e,r.multiple?a.multiple=!0:r.size&&(a.size=r.size))):e=a.createElementNS(e,n),e[ur]=t,e[yu]=r,cO(e,t,!1,!1),t.stateNode=e;e:{switch(a=Hm(n,r),n){case"dialog":$e("cancel",e),$e("close",e),i=r;break;case"iframe":case"object":case"embed":$e("load",e),i=r;break;case"video":case"audio":for(i=0;ios&&(t.flags|=128,r=!0,bl(o,!1),t.lanes=4194304)}else{if(!r)if(e=pf(a),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),bl(o,!0),o.tail===null&&o.tailMode==="hidden"&&!a.alternate&&!He)return bt(t),null}else 2*Ke()-o.renderingStartTime>os&&n!==1073741824&&(t.flags|=128,r=!0,bl(o,!1),t.lanes=4194304);o.isBackwards?(a.sibling=t.child,t.child=a):(n=o.last,n!==null?n.sibling=a:t.child=a,o.last=a)}return o.tail!==null?(t=o.tail,o.rendering=t,o.tail=t.sibling,o.renderingStartTime=Ke(),t.sibling=null,n=Ge.current,Ne(Ge,r?n&1|2:n&1),t):(bt(t),null);case 22:case 23:return u0(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?nn&1073741824&&(bt(t),t.subtreeFlags&6&&(t.flags|=8192)):bt(t),null;case 24:return null;case 25:return null}throw Error(j(156,t.tag))}function mD(e,t){switch(zy(t),t.tag){case 1:return zt(t.type)&&af(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return rs(),Le(Bt),Le(Pt),Jy(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Xy(t),null;case 13:if(Le(Ge),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(j(340));ts()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Le(Ge),null;case 4:return rs(),null;case 10:return Ky(t.type._context),null;case 22:case 23:return u0(),null;case 24:return null;default:return null}}var sd=!1,xt=!1,vD=typeof WeakSet=="function"?WeakSet:Set,X=null;function Da(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){Ue(e,t,r)}else n.current=null}function fv(e,t,n){try{n()}catch(r){Ue(e,t,r)}}var b1=!1;function yD(e,t){if(Ym=tf,e=mP(),Gy(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var i=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break e}var a=0,s=-1,l=-1,u=0,c=0,d=e,f=null;t:for(;;){for(var p;d!==n||i!==0&&d.nodeType!==3||(s=a+i),d!==o||r!==0&&d.nodeType!==3||(l=a+r),d.nodeType===3&&(a+=d.nodeValue.length),(p=d.firstChild)!==null;)f=d,d=p;for(;;){if(d===e)break t;if(f===n&&++u===i&&(s=a),f===o&&++c===r&&(l=a),(p=d.nextSibling)!==null)break;d=f,f=d.parentNode}d=p}n=s===-1||l===-1?null:{start:s,end:l}}else n=null}n=n||{start:0,end:0}}else n=null;for(Qm={focusedElem:e,selectionRange:n},tf=!1,X=t;X!==null;)if(t=X,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,X=e;else for(;X!==null;){t=X;try{var y=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(y!==null){var g=y.memoizedProps,w=y.memoizedState,h=t.stateNode,v=h.getSnapshotBeforeUpdate(t.elementType===t.type?g:zn(t.type,g),w);h.__reactInternalSnapshotBeforeUpdate=v}break;case 3:var m=t.stateNode.containerInfo;m.nodeType===1?m.textContent="":m.nodeType===9&&m.documentElement&&m.removeChild(m.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(j(163))}}catch(b){Ue(t,t.return,b)}if(e=t.sibling,e!==null){e.return=t.return,X=e;break}X=t.return}return y=b1,b1=!1,y}function Ql(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var i=r=r.next;do{if((i.tag&e)===e){var o=i.destroy;i.destroy=void 0,o!==void 0&&fv(t,n,o)}i=i.next}while(i!==r)}}function Zf(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function pv(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function pO(e){var t=e.alternate;t!==null&&(e.alternate=null,pO(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[ur],delete t[yu],delete t[Zm],delete t[eD],delete t[tD])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function hO(e){return e.tag===5||e.tag===3||e.tag===4}function w1(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||hO(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function hv(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=of));else if(r!==4&&(e=e.child,e!==null))for(hv(e,t,n),e=e.sibling;e!==null;)hv(e,t,n),e=e.sibling}function gv(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(gv(e,t,n),e=e.sibling;e!==null;)gv(e,t,n),e=e.sibling}var ct=null,Un=!1;function ui(e,t,n){for(n=n.child;n!==null;)gO(e,t,n),n=n.sibling}function gO(e,t,n){if(hr&&typeof hr.onCommitFiberUnmount=="function")try{hr.onCommitFiberUnmount(Wf,n)}catch{}switch(n.tag){case 5:xt||Da(n,t);case 6:var r=ct,i=Un;ct=null,ui(e,t,n),ct=r,Un=i,ct!==null&&(Un?(e=ct,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):ct.removeChild(n.stateNode));break;case 18:ct!==null&&(Un?(e=ct,n=n.stateNode,e.nodeType===8?Yh(e.parentNode,n):e.nodeType===1&&Yh(e,n),pu(e)):Yh(ct,n.stateNode));break;case 4:r=ct,i=Un,ct=n.stateNode.containerInfo,Un=!0,ui(e,t,n),ct=r,Un=i;break;case 0:case 11:case 14:case 15:if(!xt&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var o=i,a=o.destroy;o=o.tag,a!==void 0&&(o&2||o&4)&&fv(n,t,a),i=i.next}while(i!==r)}ui(e,t,n);break;case 1:if(!xt&&(Da(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(s){Ue(n,t,s)}ui(e,t,n);break;case 21:ui(e,t,n);break;case 22:n.mode&1?(xt=(r=xt)||n.memoizedState!==null,ui(e,t,n),xt=r):ui(e,t,n);break;default:ui(e,t,n)}}function E1(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new vD),t.forEach(function(r){var i=OD.bind(null,e,r);n.has(r)||(n.add(r),r.then(i,i))})}}function jn(e,t){var n=t.deletions;if(n!==null)for(var r=0;ri&&(i=a),r&=~o}if(r=i,r=Ke()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*wD(r/1960))-r,10e?16:e,wi===null)var r=!1;else{if(e=wi,wi=null,yf=0,ve&6)throw Error(j(331));var i=ve;for(ve|=4,X=e.current;X!==null;){var o=X,a=o.child;if(X.flags&16){var s=o.deletions;if(s!==null){for(var l=0;lKe()-s0?mo(e,0):a0|=n),Ut(e,t)}function SO(e,t){t===0&&(e.mode&1?(t=Jc,Jc<<=1,!(Jc&130023424)&&(Jc=4194304)):t=1);var n=Rt();e=Kr(e,t),e!==null&&(nc(e,t,n),Ut(e,n))}function PD(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),SO(e,n)}function OD(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,i=e.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(j(314))}r!==null&&r.delete(t),SO(e,n)}var CO;CO=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Bt.current)Gt=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return Gt=!1,hD(e,t,n);Gt=!!(e.flags&131072)}else Gt=!1,He&&t.flags&1048576&&OP(t,uf,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Ld(e,t),e=t.pendingProps;var i=es(t,Pt.current);Ua(t,n),i=e0(null,t,r,e,i,n);var o=t0();return t.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,zt(r)?(o=!0,sf(t)):o=!1,t.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,Yy(t),i.updater=Xf,t.stateNode=i,i._reactInternals=t,ov(t,r,e,n),t=lv(null,t,r,!0,o,n)):(t.tag=0,He&&o&&By(t),_t(null,t,i,n),t=t.child),t;case 16:r=t.elementType;e:{switch(Ld(e,t),e=t.pendingProps,i=r._init,r=i(r._payload),t.type=r,i=t.tag=_D(r),e=zn(r,e),i){case 0:t=sv(null,t,r,e,n);break e;case 1:t=m1(null,t,r,e,n);break e;case 11:t=h1(null,t,r,e,n);break e;case 14:t=g1(null,t,r,zn(r.type,e),n);break e}throw Error(j(306,r,""))}return t;case 0:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:zn(r,i),sv(e,t,r,i,n);case 1:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:zn(r,i),m1(e,t,r,i,n);case 3:e:{if(sO(t),e===null)throw Error(j(387));r=t.pendingProps,o=t.memoizedState,i=o.element,NP(e,t),ff(t,r,null,n);var a=t.memoizedState;if(r=a.element,o.isDehydrated)if(o={element:r,isDehydrated:!1,cache:a.cache,pendingSuspenseBoundaries:a.pendingSuspenseBoundaries,transitions:a.transitions},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){i=is(Error(j(423)),t),t=v1(e,t,r,n,i);break e}else if(r!==i){i=is(Error(j(424)),t),t=v1(e,t,r,n,i);break e}else for(on=Ti(t.stateNode.containerInfo.firstChild),sn=t,He=!0,Wn=null,n=DP(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(ts(),r===i){t=qr(e,t,n);break e}_t(e,t,r,n)}t=t.child}return t;case 5:return MP(t),e===null&&nv(t),r=t.type,i=t.pendingProps,o=e!==null?e.memoizedProps:null,a=i.children,Xm(r,i)?a=null:o!==null&&Xm(r,o)&&(t.flags|=32),aO(e,t),_t(e,t,a,n),t.child;case 6:return e===null&&nv(t),null;case 13:return lO(e,t,n);case 4:return Qy(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=ns(t,null,r,n):_t(e,t,r,n),t.child;case 11:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:zn(r,i),h1(e,t,r,i,n);case 7:return _t(e,t,t.pendingProps,n),t.child;case 8:return _t(e,t,t.pendingProps.children,n),t.child;case 12:return _t(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,i=t.pendingProps,o=t.memoizedProps,a=i.value,Ne(cf,r._currentValue),r._currentValue=a,o!==null)if(Xn(o.value,a)){if(o.children===i.children&&!Bt.current){t=qr(e,t,n);break e}}else for(o=t.child,o!==null&&(o.return=t);o!==null;){var s=o.dependencies;if(s!==null){a=o.child;for(var l=s.firstContext;l!==null;){if(l.context===r){if(o.tag===1){l=zr(-1,n&-n),l.tag=2;var u=o.updateQueue;if(u!==null){u=u.shared;var c=u.pending;c===null?l.next=l:(l.next=c.next,c.next=l),u.pending=l}}o.lanes|=n,l=o.alternate,l!==null&&(l.lanes|=n),rv(o.return,n,t),s.lanes|=n;break}l=l.next}}else if(o.tag===10)a=o.type===t.type?null:o.child;else if(o.tag===18){if(a=o.return,a===null)throw Error(j(341));a.lanes|=n,s=a.alternate,s!==null&&(s.lanes|=n),rv(a,n,t),a=o.sibling}else a=o.child;if(a!==null)a.return=o;else for(a=o;a!==null;){if(a===t){a=null;break}if(o=a.sibling,o!==null){o.return=a.return,a=o;break}a=a.return}o=a}_t(e,t,i.children,n),t=t.child}return t;case 9:return i=t.type,r=t.pendingProps.children,Ua(t,n),i=Rn(i),r=r(i),t.flags|=1,_t(e,t,r,n),t.child;case 14:return r=t.type,i=zn(r,t.pendingProps),i=zn(r.type,i),g1(e,t,r,i,n);case 15:return iO(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:zn(r,i),Ld(e,t),t.tag=1,zt(r)?(e=!0,sf(t)):e=!1,Ua(t,n),kP(t,r,i),ov(t,r,i,n),lv(null,t,r,!0,e,n);case 19:return uO(e,t,n);case 22:return oO(e,t,n)}throw Error(j(156,t.tag))};function TO(e,t){return XT(e,t)}function AD(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function On(e,t,n,r){return new AD(e,t,n,r)}function d0(e){return e=e.prototype,!(!e||!e.isReactComponent)}function _D(e){if(typeof e=="function")return d0(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Iy)return 11;if(e===Ny)return 14}return 2}function _i(e,t){var n=e.alternate;return n===null?(n=On(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function jd(e,t,n,r,i,o){var a=2;if(r=e,typeof e=="function")d0(e)&&(a=1);else if(typeof e=="string")a=5;else e:switch(e){case Pa:return vo(n.children,i,o,t);case _y:a=8,i|=8;break;case _m:return e=On(12,n,t,i|2),e.elementType=_m,e.lanes=o,e;case Im:return e=On(13,n,t,i),e.elementType=Im,e.lanes=o,e;case Nm:return e=On(19,n,t,i),e.elementType=Nm,e.lanes=o,e;case $T:return tp(n,i,o,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case RT:a=10;break e;case kT:a=9;break e;case Iy:a=11;break e;case Ny:a=14;break e;case hi:a=16,r=null;break e}throw Error(j(130,e==null?e:typeof e,""))}return t=On(a,n,t,i),t.elementType=e,t.type=r,t.lanes=o,t}function vo(e,t,n,r){return e=On(7,e,r,t),e.lanes=n,e}function tp(e,t,n,r){return e=On(22,e,r,t),e.elementType=$T,e.lanes=n,e.stateNode={isHidden:!1},e}function rg(e,t,n){return e=On(6,e,null,t),e.lanes=n,e}function ig(e,t,n){return t=On(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function ID(e,t,n,r,i){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Fh(0),this.expirationTimes=Fh(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Fh(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function f0(e,t,n,r,i,o,a,s,l){return e=new ID(e,t,n,s,l),t===1?(t=1,o===!0&&(t|=8)):t=0,o=On(3,null,null,t),e.current=o,o.stateNode=e,o.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Yy(o),e}function ND(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(_O)}catch(e){console.error(e)}}_O(),OT.exports=hn;var as=OT.exports,IO,_1=as;IO=_1.createRoot,_1.hydrateRoot;function NO(e){var t=function(r){var i=r.dispatch,o=r.getState;return function(a){return function(s){return typeof s=="function"?s(i,o,e):a(s)}}};return t}var RO=NO();RO.withExtraArgument=NO;const MD=RO;var kO={exports:{}},$O={};/** * @license React * use-sync-external-store-shim.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var ss=R;function LD(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var FD=typeof Object.is=="function"?Object.is:LD,HD=ss.useState,jD=ss.useEffect,GD=ss.useLayoutEffect,BD=ss.useDebugValue;function zD(e,t){var n=t(),r=HD({inst:{value:n,getSnapshot:t}}),i=r[0].inst,o=r[1];return GD(function(){i.value=n,i.getSnapshot=t,og(i)&&o({inst:i})},[e,n,t]),jD(function(){return og(i)&&o({inst:i}),e(function(){og(i)&&o({inst:i})})},[e]),BD(n),n}function og(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!FD(e,n)}catch{return!0}}function UD(e,t){return t()}var WD=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?UD:zD;$O.useSyncExternalStore=ss.useSyncExternalStore!==void 0?ss.useSyncExternalStore:WD;kO.exports=$O;var DO=kO.exports,VD={};/** * @license React * use-sync-external-store-shim/with-selector.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var ap=R,KD=DO;function qD(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var YD=typeof Object.is=="function"?Object.is:qD,QD=KD.useSyncExternalStore,XD=ap.useRef,JD=ap.useEffect,ZD=ap.useMemo,eM=ap.useDebugValue;VD.useSyncExternalStoreWithSelector=function(e,t,n,r,i){var o=XD(null);if(o.current===null){var a={hasValue:!1,value:null};o.current=a}else a=o.current;o=ZD(function(){function l(p){if(!u){if(u=!0,c=p,p=r(p),i!==void 0&&a.hasValue){var y=a.value;if(i(y,p))return d=y}return d=p}if(y=d,YD(c,p))return y;var g=r(p);return i!==void 0&&i(y,g)?y:(c=p,d=g)}var u=!1,c,d,f=n===void 0?null:n;return[function(){return l(t())},f===null?void 0:function(){return l(f())}]},[t,n,r,i]);var s=QD(e,o[0],o[1]);return JD(function(){a.hasValue=!0,a.value=s},[s]),eM(s),s};function tM(e){e()}let MO=tM;const nM=e=>MO=e,rM=()=>MO,LO=R.createContext(null),iM=()=>{throw new Error("uSES not initialized!")};function I(){return I=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&(n[i]=e[i]);return n}var FO={exports:{}},Se={};/** @license React v16.13.1 * react-is.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var lt=typeof Symbol=="function"&&Symbol.for,m0=lt?Symbol.for("react.element"):60103,v0=lt?Symbol.for("react.portal"):60106,lp=lt?Symbol.for("react.fragment"):60107,up=lt?Symbol.for("react.strict_mode"):60108,cp=lt?Symbol.for("react.profiler"):60114,dp=lt?Symbol.for("react.provider"):60109,fp=lt?Symbol.for("react.context"):60110,y0=lt?Symbol.for("react.async_mode"):60111,pp=lt?Symbol.for("react.concurrent_mode"):60111,hp=lt?Symbol.for("react.forward_ref"):60112,gp=lt?Symbol.for("react.suspense"):60113,oM=lt?Symbol.for("react.suspense_list"):60120,mp=lt?Symbol.for("react.memo"):60115,vp=lt?Symbol.for("react.lazy"):60116,aM=lt?Symbol.for("react.block"):60121,sM=lt?Symbol.for("react.fundamental"):60117,lM=lt?Symbol.for("react.responder"):60118,uM=lt?Symbol.for("react.scope"):60119;function mn(e){if(typeof e=="object"&&e!==null){var t=e.$$typeof;switch(t){case m0:switch(e=e.type,e){case y0:case pp:case lp:case cp:case up:case gp:return e;default:switch(e=e&&e.$$typeof,e){case fp:case hp:case vp:case mp:case dp:return e;default:return t}}case v0:return t}}}function HO(e){return mn(e)===pp}Se.AsyncMode=y0;Se.ConcurrentMode=pp;Se.ContextConsumer=fp;Se.ContextProvider=dp;Se.Element=m0;Se.ForwardRef=hp;Se.Fragment=lp;Se.Lazy=vp;Se.Memo=mp;Se.Portal=v0;Se.Profiler=cp;Se.StrictMode=up;Se.Suspense=gp;Se.isAsyncMode=function(e){return HO(e)||mn(e)===y0};Se.isConcurrentMode=HO;Se.isContextConsumer=function(e){return mn(e)===fp};Se.isContextProvider=function(e){return mn(e)===dp};Se.isElement=function(e){return typeof e=="object"&&e!==null&&e.$$typeof===m0};Se.isForwardRef=function(e){return mn(e)===hp};Se.isFragment=function(e){return mn(e)===lp};Se.isLazy=function(e){return mn(e)===vp};Se.isMemo=function(e){return mn(e)===mp};Se.isPortal=function(e){return mn(e)===v0};Se.isProfiler=function(e){return mn(e)===cp};Se.isStrictMode=function(e){return mn(e)===up};Se.isSuspense=function(e){return mn(e)===gp};Se.isValidElementType=function(e){return typeof e=="string"||typeof e=="function"||e===lp||e===pp||e===cp||e===up||e===gp||e===oM||typeof e=="object"&&e!==null&&(e.$$typeof===vp||e.$$typeof===mp||e.$$typeof===dp||e.$$typeof===fp||e.$$typeof===hp||e.$$typeof===sM||e.$$typeof===lM||e.$$typeof===uM||e.$$typeof===aM)};Se.typeOf=mn;FO.exports=Se;var cM=FO.exports,b0=cM,dM={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},fM={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},pM={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},jO={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},w0={};w0[b0.ForwardRef]=pM;w0[b0.Memo]=jO;function I1(e){return b0.isMemo(e)?jO:w0[e.$$typeof]||dM}var hM=Object.defineProperty,gM=Object.getOwnPropertyNames,N1=Object.getOwnPropertySymbols,mM=Object.getOwnPropertyDescriptor,vM=Object.getPrototypeOf,R1=Object.prototype;function GO(e,t,n){if(typeof t!="string"){if(R1){var r=vM(t);r&&r!==R1&&GO(e,r,n)}var i=gM(t);N1&&(i=i.concat(N1(t)));for(var o=I1(e),a=I1(t),s=0;st(i(...o)))}return n}function wv(e){return function(n){const r=e(n);function i(){return r}return i.dependsOnOwnProps=!1,i}}function $1(e){return e.dependsOnOwnProps?!!e.dependsOnOwnProps:e.length!==1}function UO(e,t){return function(r,{displayName:i}){const o=function(s,l){return o.dependsOnOwnProps?o.mapToProps(s,l):o.mapToProps(s,void 0)};return o.dependsOnOwnProps=!0,o.mapToProps=function(s,l){o.mapToProps=e,o.dependsOnOwnProps=$1(e);let u=o(s,l);return typeof u=="function"&&(o.mapToProps=u,o.dependsOnOwnProps=$1(u),u=o(s,l)),u},o}}function S0(e,t){return(n,r)=>{throw new Error(`Invalid value of type ${typeof e} for ${t} argument when connecting component ${r.wrappedComponentName}.`)}}function PM(e){return e&&typeof e=="object"?wv(t=>TM(e,t)):e?typeof e=="function"?UO(e):S0(e,"mapDispatchToProps"):wv(t=>({dispatch:t}))}function OM(e){return e?typeof e=="function"?UO(e):S0(e,"mapStateToProps"):wv(()=>({}))}function AM(e,t,n){return I({},n,e,t)}function _M(e){return function(n,{displayName:r,areMergedPropsEqual:i}){let o=!1,a;return function(l,u,c){const d=e(l,u,c);return o?i(d,a)||(a=d):(o=!0,a=d),a}}}function IM(e){return e?typeof e=="function"?_M(e):S0(e,"mergeProps"):()=>AM}function NM(){const e=rM();let t=null,n=null;return{clear(){t=null,n=null},notify(){e(()=>{let r=t;for(;r;)r.callback(),r=r.next})},get(){let r=[],i=t;for(;i;)r.push(i),i=i.next;return r},subscribe(r){let i=!0,o=n={callback:r,next:null,prev:n};return o.prev?o.prev.next=o:t=o,function(){!i||t===null||(i=!1,o.next?o.next.prev=o.prev:n=o.prev,o.prev?o.prev.next=o.next:t=o.next)}}}}const D1={notify(){},get:()=>[]};function WO(e,t){let n,r=D1;function i(d){return l(),r.subscribe(d)}function o(){r.notify()}function a(){c.onStateChange&&c.onStateChange()}function s(){return!!n}function l(){n||(n=t?t.addNestedSub(a):e.subscribe(a),r=NM())}function u(){n&&(n(),n=void 0,r.clear(),r=D1)}const c={addNestedSub:i,notifyNestedSubs:o,handleChangeWrapper:a,isSubscribed:s,trySubscribe:l,tryUnsubscribe:u,getListeners:()=>r};return c}const RM=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",Ef=RM?R.useLayoutEffect:R.useEffect;function M1(e,t){return e===t?e!==0||t!==0||1/e===1/t:e!==e&&t!==t}function ag(e,t){if(M1(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let i=0;i{VO=e},DM=[null,null];function MM(e,t,n){Ef(()=>e(...t),n)}function LM(e,t,n,r,i,o){e.current=r,n.current=!1,i.current&&(i.current=null,o())}function FM(e,t,n,r,i,o,a,s,l,u,c){if(!e)return()=>{};let d=!1,f=null;const p=()=>{if(d||!s.current)return;const g=t.getState();let w,h;try{w=r(g,i.current)}catch(v){h=v,f=v}h||(f=null),w===o.current?a.current||u():(o.current=w,l.current=w,a.current=!0,c())};return n.onStateChange=p,n.trySubscribe(),p(),()=>{if(d=!0,n.tryUnsubscribe(),n.onStateChange=null,f)throw f}}function HM(e,t){return e===t}function Xt(e,t,n,{pure:r,areStatesEqual:i=HM,areOwnPropsEqual:o=ag,areStatePropsEqual:a=ag,areMergedPropsEqual:s=ag,forwardRef:l=!1,context:u=LO}={}){const c=u,d=OM(e),f=PM(t),p=IM(n),y=!!e;return w=>{const h=w.displayName||w.name||"Component",v=`Connect(${h})`,m={shouldHandleStateChanges:y,displayName:v,wrappedComponentName:h,WrappedComponent:w,initMapStateToProps:d,initMapDispatchToProps:f,initMergeProps:p,areStatesEqual:i,areStatePropsEqual:a,areOwnPropsEqual:o,areMergedPropsEqual:s};function b(P){const[O,N,k]=R.useMemo(()=>{const{reactReduxForwardedRef:Lt}=P,nr=sp(P,kM);return[P.context,Lt,nr]},[P]),D=R.useMemo(()=>O&&O.Consumer&&EM.isContextConsumer(E.createElement(O.Consumer,null))?O:c,[O,c]),L=R.useContext(D),B=!!P.store&&!!P.store.getState&&!!P.store.dispatch,q=!!L&&!!L.store,Q=B?P.store:L.store,se=q?L.getServerState:Q.getState,be=R.useMemo(()=>CM(Q.dispatch,m),[Q]),[M,J]=R.useMemo(()=>{if(!y)return DM;const Lt=WO(Q,B?void 0:L.subscription),nr=Lt.notifyNestedSubs.bind(Lt);return[Lt,nr]},[Q,B,L]),re=R.useMemo(()=>B?L:I({},L,{subscription:M}),[B,L,M]),de=R.useRef(),fe=R.useRef(k),Ve=R.useRef(),je=R.useRef(!1);R.useRef(!1);const Ye=R.useRef(!1),Ze=R.useRef();Ef(()=>(Ye.current=!0,()=>{Ye.current=!1}),[]);const Mt=R.useMemo(()=>()=>Ve.current&&k===fe.current?Ve.current:be(Q.getState(),k),[Q,k]),Hn=R.useMemo(()=>nr=>M?FM(y,Q,M,be,fe,de,je,Ye,Ve,J,nr):()=>{},[M]);MM(LM,[fe,de,je,k,Ve,J]);let tr;try{tr=VO(Hn,Mt,se?()=>be(se(),k):Mt)}catch(Lt){throw Ze.current&&(Lt.message+=` The error may be correlated with this previous error: ${Ze.current.stack} `),Lt}Ef(()=>{Ze.current=void 0,Ve.current=void 0,de.current=tr});const eo=R.useMemo(()=>E.createElement(w,I({},tr,{ref:N})),[N,w,tr]);return R.useMemo(()=>y?E.createElement(D.Provider,{value:re},eo):eo,[D,eo,re])}const C=E.memo(b);if(C.WrappedComponent=w,C.displayName=b.displayName=v,l){const O=E.forwardRef(function(k,D){return E.createElement(C,I({},k,{reactReduxForwardedRef:D}))});return O.displayName=v,O.WrappedComponent=w,k1(O,w)}return k1(C,w)}}function jM({store:e,context:t,children:n,serverState:r}){const i=R.useMemo(()=>{const s=WO(e);return{store:e,subscription:s,getServerState:r?()=>r:void 0}},[e,r]),o=R.useMemo(()=>e.getState(),[e]);Ef(()=>{const{subscription:s}=i;return s.onStateChange=s.notifyNestedSubs,s.trySubscribe(),o!==e.getState()&&s.notifyNestedSubs(),()=>{s.tryUnsubscribe(),s.onStateChange=void 0}},[i,o]);const a=t||LO;return E.createElement(a.Provider,{value:i},n)}$M(DO.useSyncExternalStore);nM(as.unstable_batchedUpdates);function ls(e){return ls=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ls(e)}function GM(e,t){if(ls(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(ls(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function KO(e){var t=GM(e,"string");return ls(t)==="symbol"?t:String(t)}function BM(e,t,n){return t=KO(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function L1(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function F1(e){for(var t=1;t"u"&&(n=t,t=void 0),typeof n<"u"){if(typeof n!="function")throw new Error(wt(1));return n(qO)(e,t)}if(typeof e!="function")throw new Error(wt(2));var i=e,o=t,a=[],s=a,l=!1;function u(){s===a&&(s=a.slice())}function c(){if(l)throw new Error(wt(3));return o}function d(g){if(typeof g!="function")throw new Error(wt(4));if(l)throw new Error(wt(5));var w=!0;return u(),s.push(g),function(){if(w){if(l)throw new Error(wt(6));w=!1,u();var v=s.indexOf(g);s.splice(v,1),a=null}}}function f(g){if(!zM(g))throw new Error(wt(7));if(typeof g.type>"u")throw new Error(wt(8));if(l)throw new Error(wt(9));try{l=!0,o=i(o,g)}finally{l=!1}for(var w=a=s,h=0;h"u")throw new Error(wt(12));if(typeof n(void 0,{type:xf.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(wt(13))})}function YO(e){for(var t=Object.keys(e),n={},r=0;r"u")throw u&&u.type,new Error(wt(14));d[p]=w,c=c||w!==g}return c=c||o.length!==Object.keys(l).length,c?d:l}}function WM(){for(var e=arguments.length,t=new Array(e),n=0;n{const t=e.reduce((r,i)=>r+i.x,0),n=e.reduce((r,i)=>r+i.y,0);return new Y(t/e.length,n/e.length)},QO=e=>({type:"GETTING_DIAGRAM_NAME_SUCCEEDED",diagramName:e}),KM=e=>({type:"RENAME_DIAGRAM",diagramName:e}),XO=50,qM=200,JO=10,YM=20,j1=50,Lr="#000000",La="#ffffff",QM="#58c8e3",XM="#9bafda",JM="#CE0D0E",ZM="#808080",Fo="#B3D7FF",qi="#2284D0";var Cf="NOT_FOUND";function eL(e){var t;return{get:function(r){return t&&e(t.key,r)?t.value:Cf},put:function(r,i){t={key:r,value:i}},getEntries:function(){return t?[t]:[]},clear:function(){t=void 0}}}function tL(e,t){var n=[];function r(s){var l=n.findIndex(function(c){return t(s,c.key)});if(l>-1){var u=n[l];return l>0&&(n.splice(l,1),n.unshift(u)),u.value}return Cf}function i(s,l){r(s)===Cf&&(n.unshift({key:s,value:l}),n.length>e&&n.pop())}function o(){return n}function a(){n=[]}return{get:r,put:i,getEntries:o,clear:a}}var nL=function(t,n){return t===n};function rL(e){return function(n,r){if(n===null||r===null||n.length!==r.length)return!1;for(var i=n.length,o=0;o1?t-1:0),r=1;re.style||{},lL=(e,t,n)=>t.style&&t.style.hasOwnProperty(e)?t.style[e]:n[e],wr=(e,t)=>ac(sL,n=>O0(t,lL(t,e,n))),C0=[{fontFamily:"Nunito Sans"},{fontFamily:"Nunito"},{fontFamily:"Fira Code"},{fontFamily:"Bentham"},{fontFamily:"Kalam"},{fontFamily:"Caveat"}],El=(e,t)=>!!t("node-icon-image")||!!t("relationship-icon-image"),cd=e=>e.caption&&e.caption.length>0,lg=e=>e.labels&&e.labels.length>0,G1=e=>e.type&&e.type.length>0,xl=e=>e.properties&&Object.keys(e.properties).length>0,B1={Node:{relevantToNode:()=>!0},NodeWithBorder:{relevantToNode:(e,t)=>t("border-width")>0},NodeWithInsideDetail:{relevantToNode:(e,t)=>El(e,t)&&t("icon-position")==="inside"||cd(e)&&t("caption-position")==="inside"||lg(e)&&t("label-position")==="inside"||xl(e)&&t("property-position")==="inside"},NodeWithOutsideDetail:{relevantToNode:(e,t)=>El(e,t)&&t("icon-position")==="outside"||cd(e)&&t("caption-position")==="outside"||lg(e)&&t("label-position")==="outside"||xl(e)&&t("property-position")==="outside"},NodeWithIcon:{relevantToNode:El},NodeOrRelationshipWithIcon:{relevantToNode:El,relevantToRelationship:El},NodeWithCaption:{relevantToNode:cd},NodeWithCaptionOutside:{relevantToNode:(e,t)=>cd(e)&&t("caption-position")==="outside"},NodeWithLabel:{relevantToNode:lg},Relationship:{relevantToRelationship:()=>!0},RelationshipWithDetail:{relevantToRelationship:e=>G1(e)||xl(e)},RelationshipWithType:{relevantToRelationship:G1},NodeOrRelationshipWithProperty:{relevantToNode:xl,relevantToRelationship:xl}},uL=(e,t,n)=>{const r=[];return e.forEach(i=>{const o=a=>wr(i,a)(n);for(const[a,s]of Object.entries(B1))s.relevantToNode&&s.relevantToNode(i,o)&&r.push(a)}),t.forEach(i=>{const o=a=>wr(i,a)(n);for(const[a,s]of Object.entries(B1))s.relevantToRelationship&&s.relevantToRelationship(i,o)&&r.push(a)}),r},Fs=[{name:"General",entityTypes:["node","relationship"],attributes:[{key:"font-family",appliesTo:"Everything",type:"font-family",defaultValue:"sans-serif"},{key:"background-color",appliesTo:"Everything",type:"color",defaultValue:La},{key:"background-image",appliesTo:"Everything",type:"image",defaultValue:""},{key:"background-size",appliesTo:"Everything",type:"percentage",defaultValue:"100%"}]},{name:"Nodes",entityTypes:["node"],attributes:[{key:"node-color",appliesTo:"Node",type:"color",defaultValue:La},{key:"border-width",appliesTo:"Node",type:"line-width",defaultValue:4},{key:"border-color",appliesTo:"NodeWithBorder",type:"color",defaultValue:Lr},{key:"radius",appliesTo:"Node",type:"radius",defaultValue:XO},{key:"node-padding",appliesTo:"NodeWithInsideDetail",type:"spacing",defaultValue:5},{key:"node-margin",appliesTo:"NodeWithOutsideDetail",type:"spacing",defaultValue:2},{key:"outside-position",appliesTo:"NodeWithOutsideDetail",type:"outside-position",defaultValue:"auto"},{key:"node-icon-image",appliesTo:"Node",type:"image",defaultValue:""},{key:"node-background-image",appliesTo:"Node",type:"image",defaultValue:""}]},{name:"Icons",entityTypes:["node"],attributes:[{key:"icon-position",appliesTo:"NodeWithIcon",type:"inside-outside",defaultValue:"inside"},{key:"icon-size",appliesTo:"NodeOrRelationshipWithIcon",type:"radius",defaultValue:64}]},{name:"Node Captions",entityTypes:["node"],attributes:[{key:"caption-position",appliesTo:"NodeWithCaption",type:"inside-outside",defaultValue:"inside"},{key:"caption-max-width",appliesTo:"NodeWithCaptionOutside",type:"radius",defaultValue:200},{key:"caption-color",appliesTo:"NodeWithCaption",type:"color",defaultValue:Lr},{key:"caption-font-size",appliesTo:"NodeWithCaption",type:"font-size",defaultValue:j1},{key:"caption-font-weight",appliesTo:"NodeWithCaption",type:"font-weight",defaultValue:"normal"}]},{name:"Node Labels",entityTypes:["node"],attributes:[{key:"label-position",appliesTo:"NodeWithLabel",type:"inside-outside",defaultValue:"inside"},{key:"label-display",appliesTo:"NodeWithLabel",type:"label-display",defaultValue:"pill"},{key:"label-color",appliesTo:"NodeWithLabel",type:"color",defaultValue:Lr},{key:"label-background-color",appliesTo:"NodeWithLabel",type:"color",defaultValue:La},{key:"label-border-color",appliesTo:"NodeWithLabel",type:"color",defaultValue:Lr},{key:"label-border-width",appliesTo:"NodeWithLabel",type:"line-width",defaultValue:4},{key:"label-font-size",appliesTo:"NodeWithLabel",type:"font-size",defaultValue:j1*(4/5)},{key:"label-padding",appliesTo:"NodeWithLabel",type:"spacing",defaultValue:5},{key:"label-margin",appliesTo:"NodeWithLabel",type:"spacing",defaultValue:4}]},{name:"Arrows",entityTypes:["relationship"],attributes:[{key:"directionality",appliesTo:"Relationship",type:"directionality",defaultValue:"directed"},{key:"detail-position",appliesTo:"RelationshipWithDetail",type:"detail-position",defaultValue:"inline"},{key:"detail-orientation",appliesTo:"RelationshipWithDetail",type:"orientation",defaultValue:"parallel"},{key:"arrow-width",appliesTo:"Relationship",type:"line-width",defaultValue:5},{key:"arrow-color",appliesTo:"Relationship",type:"color",defaultValue:Lr},{key:"margin-start",appliesTo:"Relationship",type:"spacing",defaultValue:5},{key:"margin-end",appliesTo:"Relationship",type:"spacing",defaultValue:5},{key:"margin-peer",appliesTo:"Relationship",type:"spacing",defaultValue:20},{key:"attachment-start",appliesTo:"Relationship",type:"attachment",defaultValue:"normal"},{key:"attachment-end",appliesTo:"Relationship",type:"attachment",defaultValue:"normal"},{key:"relationship-icon-image",appliesTo:"Relationship",type:"image",defaultValue:""}]},{name:"Relationship Types",entityTypes:["relationship"],attributes:[{key:"type-color",appliesTo:"RelationshipWithType",type:"color",defaultValue:Lr},{key:"type-background-color",appliesTo:"RelationshipWithType",type:"color",defaultValue:La},{key:"type-border-color",appliesTo:"RelationshipWithType",type:"color",defaultValue:Lr},{key:"type-border-width",appliesTo:"RelationshipWithType",type:"line-width",defaultValue:0},{key:"type-font-size",appliesTo:"RelationshipWithType",type:"font-size",defaultValue:16},{key:"type-padding",appliesTo:"RelationshipWithType",type:"spacing",defaultValue:5}]},{name:"Properties",entityTypes:["node","relationship"],attributes:[{key:"property-position",appliesTo:"NodeOrRelationshipWithProperty",type:"inside-outside",defaultValue:"outside"},{key:"property-alignment",appliesTo:"NodeOrRelationshipWithProperty",type:"property-alignment",defaultValue:"colon"},{key:"property-color",appliesTo:"NodeOrRelationshipWithProperty",type:"color",defaultValue:Lr},{key:"property-font-size",appliesTo:"NodeOrRelationshipWithProperty",type:"font-size",defaultValue:16},{key:"property-font-weight",appliesTo:"NodeOrRelationshipWithProperty",type:"font-weight",defaultValue:"normal"}]}],Tf=Object.fromEntries(Fs.flatMap(e=>e.attributes).map(e=>[e.key,e])),T0=Fs.filter(e=>e.entityTypes.includes("node")).flatMap(e=>e.attributes).map(e=>e.key),P0=Fs.filter(e=>e.entityTypes.includes("relationship")).flatMap(e=>e.attributes).map(e=>e.key),cL=Fs.flatMap(e=>e.attributes).filter(e=>e.type==="image").map(e=>e.key),ZO={radius:{editor:"slider",min:1,max:1e3,step:5},"line-width":{editor:"slider",min:0,max:25,step:1},spacing:{editor:"slider",min:0,max:50,step:1},"font-size":{editor:"slider",min:5,max:100,step:1},color:{editor:"colorPicker"},"font-family":{editor:"dropdown",options:["sans-serif",...C0.map(e=>e.fontFamily)]},"font-weight":{editor:"dropdown",options:["normal","bold"]},directionality:{editor:"dropdown",options:["directed","undirected"]},"outside-position":{editor:"dropdown",options:["auto","top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"]},"inside-outside":{editor:"dropdown",options:["inside","outside"]},"detail-position":{editor:"dropdown",options:["inline","above","below"]},orientation:{editor:"dropdown",options:["parallel","perpendicular","horizontal"]},"property-alignment":{editor:"dropdown",options:["colon","center"]},"label-display":{editor:"dropdown",options:["pill","bare"]},attachment:{editor:"dropdown",options:["normal","top","right","bottom","left"]},image:{editor:"imageUrl"},percentage:{editor:"percentageSlider",min:5,max:1e3,step:5}},eA=e=>{const t={};return Object.keys(Tf).forEach(n=>{e.hasOwnProperty(n)?t[n]=e[n]:t[n]=Tf[n].defaultValue}),t},O0=(e,t)=>{const n=Tf[e],r=ZO[n.type];switch(r.editor){case"slider":case"percentageSlider":if(!isNaN(t))return tr.max?r.max:t;break;case"colorPicker":if(/^#[0-9A-F]{6}$/i.test(t))return t;break;case"dropdown":if(r.options.includes(t))return t;break;case"imageUrl":return t}return n.defaultValue},A0=(e,t)=>({...e,position:t}),tA=(e,t)=>A0(e,e.position.translate(t)),ug=(e,t)=>{const n=e.labels.includes(t)?e.labels:[...e.labels,t];return{...e,labels:n}},dL=(e,t,n)=>{const r=[...e.labels],i=r.indexOf(t);return i>-1&&(r[i]=n),{...e,labels:r}},fL=(e,t)=>{const n=[...e.labels],r=n.indexOf(t);return r>-1&&n.splice(r,1),{...e,labels:n}},pL=(e,t)=>({...e,caption:t}),nA=e=>e.hasOwnProperty("caption")&&e.hasOwnProperty("position"),hL=(e,t)=>({id:e.id,type:t,style:e.style,properties:e.properties,fromId:e.fromId,toId:e.toId}),cg=e=>e===""?"_RELATED":e.replace(/_/g,"__"),gL=e=>({id:e.id,type:e.type,style:e.style,properties:e.properties,toId:e.fromId,fromId:e.toId}),mL=e=>e.hasOwnProperty("type")&&e.hasOwnProperty("fromId")&&e.hasOwnProperty("toId"),vL=(e,t)=>{if(e.fromId===t)return e.toId;if(e.toId===t)return e.fromId},yL=e=>{const t={};let n=!0;return e.forEach(r=>{r.properties&&(Object.keys(r.properties).forEach(i=>{const o=t[i];o?o.status==="CONSISTENT"&&o.value!==r.properties[i]&&(t[i]={status:"INCONSISTENT"}):n?t[i]={status:"CONSISTENT",value:r.properties[i]}:t[i]={status:"PARTIAL"}}),Object.keys(t).forEach(i=>{r.properties.hasOwnProperty(i)||(t[i]={status:"PARTIAL"})}),n=!1)}),t},bL=(e,t)=>{const n=[],r=new Map,i=new Set;return e.forEach(o=>{Object.entries(o.properties).forEach(([a,s])=>{i.add(a);let l=r.get(a);l||r.set(a,l=[]);const u=l.find(c=>c.value===s);u?u.nodeCount++:l.push({value:s,inSelection:!0,nodeCount:1})})}),t.nodes.forEach(o=>{Object.entries(o.properties).forEach(([a,s])=>{if(a&&!i.has(a)){const l=n.find(u=>u.key===a);l?l.nodeCount++:n.push({key:a,nodeCount:1})}if(s){let l=r.get(a);l||r.set(a,l=[]);const u=l.find(c=>c.value===s);u?u.inSelection||u.nodeCount++:l.push({value:s,inSelection:!1,nodeCount:1})}})}),{keys:n,values:r}},z1=(e,t)=>{if(nA(e))return T0.includes(t);if(mL(e))return P0.includes(t)},wL=e=>{const t={};let n={node:!0,relationship:!0};return e.forEach(r=>{const i=nA(r)?"node":"relationship";r.style&&Object.keys(r.style).forEach(o=>{if(z1(r,o)){const a=t[o];a?a.status==="CONSISTENT"&&a.value!==r.style[o]&&(t[o]={status:"INCONSISTENT"}):n[i]?t[o]={status:"CONSISTENT",value:r.style[o]}:t[o]={status:"PARTIAL"}}}),Object.keys(t).forEach(o=>{z1(r,o)&&!r.style.hasOwnProperty(o)&&(t[o]={status:"PARTIAL"})}),n[i]=!1}),t},Dr=e=>e===""?"_EMPTY_KEY":e.replace(/_/g,"__"),fi=e=>"_style-"+e,U1=(e,t,n)=>{const r={};return Object.keys(e.properties).forEach(i=>{i===t?r[n]=e.properties[t]:r[i]=e.properties[i]}),{...e,properties:r}},dd=(e,t,n)=>{const r={...e.properties};return r[t]=n,{...e,properties:r}},W1=(e,t,n)=>{const r={...e};return r.style||(r.style={}),r.style[t]=n,Object.defineProperty(r,t,{get:function(){return this.style[t]}}),r},V1=(e,t)=>{const n={};return Object.keys(e.properties).forEach(r=>{r!==t&&(n[r]=e.properties[r])}),{...e,properties:n}},K1=(e,t)=>{const n={...e.style};return delete n[t],{...e,style:n}},q1=e=>Object.keys(e.properties).map(t=>`${t} ${e.properties[t]}`);function pt(e,t){return e===t}function Po(e){return"n"+(parseInt(e.substring(1))+1)}function Yr(e,t="n"){const n=e.map(r=>r.id).filter(r=>new RegExp(`^${t}[0-9]+$`).test(r)).map(r=>parseInt(r.substring(1))).sort((r,i)=>r-i);return t+(n.length>0?n.pop()+1:0)}const Ev=()=>({nodes:[{id:Yr([]),position:new Y(0,0),caption:"",style:{},labels:[],properties:{}}],relationships:[],style:eA({})}),EL=e=>e.nodes.reduce((t,n)=>(t[n.id]=n,t),{}),xL=e=>{const t=[];return e.nodes.forEach(r=>{t.push(r.caption),t.push(...q1(r))}),e.relationships.forEach(r=>{t.push(r.type),t.push(...q1(r))}),t.join(` `).substr(0,128e3)},ia=(e,t)=>{for(const n of t)e.add(n.codePointAt(0))},SL=e=>{const t=new Set;return e.nodes.forEach(n=>{ia(t,n.caption);for(const[r,i]of Object.entries(n.properties))ia(t,r),ia(t,i)}),e.relationships.forEach(n=>{ia(t,n.type);for(const[r,i]of Object.entries(n.properties))ia(t,r),ia(t,i)}),t},rA=(e,t)=>t.relationships.filter(n=>e.id===n.fromId||e.id===n.toId).filter(n=>n.fromId!==n.toId).map(n=>{const r=vL(n,e.id);return t.nodes.find(o=>o.id===r).position}),CL=(e,t)=>TL(e.nodes,t.nodes)||e.relationships!==t.relationships||e.style!==t.style,TL=(e,t)=>e.length!==t.length?!0:e.some((n,r)=>{const i=t[r];return n.id!==i.id||n.caption!==i.caption||n.style!==i.style||n.labels!==i.labels||n.properties!==i.properties}),xv=e=>Math.abs(Math.PI/2-Math.abs(e.angle))<.01,Y1=(e,t)=>({possible:!0,intersection:new Y(e.center.x,Math.tan(t.angle)*(e.center.x-t.center.x)+t.center.y)}),iA=(e,t)=>Math.abs((e.angle-t.angle)%Math.PI)<.01,PL=(e,t)=>{if(iA(e,t))return{possible:!1};if(xv(e))return Y1(e,t);if(xv(t))return Y1(t,e);const n=Math.tan(e.angle),r=Math.tan(t.angle),i=(n*e.center.x-r*t.center.x-(e.center.y-t.center.y))/(n-r);return{possible:!0,intersection:new Y(i,n*(i-e.center.x)+e.center.y)}},Sl=e=>e*e,OL=(e,t,n)=>{const r=Math.abs(t.center.x-e.center.x);if(r>t.radius)return{possible:!1};{const i=Math.sqrt(t.radius*t.radius-r*r),o=t.center.y{if(xv(e))return OL(e,t,n);const r=Math.tan(e.angle),i=e.center.y-r*e.center.x,o=1+Sl(r),a=-t.center.x*2+r*(i-t.center.y)*2,s=Sl(t.center.x)+Sl(i-t.center.y)-Sl(t.radius),l=Sl(a)-4*o*s;if(l>=0){const u=[(-a+Math.sqrt(l))/(2*o),(-a-Math.sqrt(l))/(2*o)].map(f=>new Y(f,r*f+i)),c=u.map(f=>f.vectorFrom(n).distance());return{possible:!0,intersection:c[0]{const r=e.center.vectorFrom(t.center),i=r.distance();if(i>Math.abs(e.radius-t.radius)&&if.vectorFrom(n).distance());return{possible:!0,intersection:c[0]{if(t.length<2)return[];const n=[],r=t.sort((s,l)=>Math.abs(e-s)-Math.abs(e-l))[0],i=t.sort((s,l)=>s-l),o=i.indexOf(r),a=Math.sign(r-e);if(o>0&&a<0||o0){const s=i[o+a],l=r-s,u=r+l;n.push({candidate:u,error:Math.abs(u-e)})}if(o>0&&a>0||o{const n=Math.abs(e-t);return Math.min(n,Math.PI*2-n)},IL=(e,t)=>{if(t.length<2)return[];const n=[],r=t.sort((y,g)=>Q1(e,y)-Q1(e,g))[0],i=t.sort((y,g)=>y-g),o=i.indexOf(r),a=Math.sign(r-e),s=y=>y<0?y+i.length:y>i.length-1?y-i.length:y,l=i[s(o+a)],u=r-l,c=r+u;n.push({candidate:c,error:Math.abs(c-e)});const d=i[s(o-a)],f=r-d,p=r-f/2;return n.push({candidate:p,error:Math.abs(p-e)}),n},_0=(e,t)=>e.error-t.error;class Qr{constructor(t=[],n,r){this.guidelines=t,this.naturalPosition=n,this.naturalRadius=r}}class Vn{constructor(t,n,r){this.center=t,this.angle=n,this.error=this.calculateError(r)}get type(){return"LINE"}calculateError(t){let n=t.translate(this.center.vectorFromOrigin().invert()).rotate(-this.angle);return Math.abs(n.y)}snap(t){return this.point(this.scalar(t))}scalar(t){return t.translate(this.center.vectorFromOrigin().invert()).rotate(-this.angle).x}point(t){return new Y(t,0).rotate(this.angle).translate(this.center.vectorFromOrigin())}combine(t,n){switch(t.type){case"LINE":return PL(this,t);case"CIRCLE":return oA(this,t,n);default:throw Error("unknown Guide type: "+t.type)}}intervalGuide(t,n){const r=t.filter(o=>this.calculateError(o.position)<.01).map(o=>this.scalar(o.position)),i=_L(this.scalar(n),r);if(i.sort(_0),i.length>0){const o=i[0];return new Vn(this.point(o.candidate),this.angle+Math.PI/2,n)}return null}}class aA{constructor(t,n,r){this.center=t,this.radius=n,this.error=this.calculateError(r)}get type(){return"CIRCLE"}calculateError(t){const n=t.vectorFrom(this.center);return Math.abs(n.distance()-this.radius)}snap(t){let n=t.vectorFrom(this.center);return this.center.translate(n.scale(this.radius/n.distance()))}scalar(t){return t.vectorFrom(this.center).angle()}combine(t,n){switch(t.type){case"LINE":return oA(t,this,n);case"CIRCLE":return AL(this,t,n);default:throw Error("unknown Guide type: "+t.type)}}intervalGuide(t,n){const r=t.filter(o=>this.calculateError(o.position)<.01).map(o=>this.scalar(o.position)),i=IL(this.scalar(n),r);if(i.sort(_0),i.length>0){const o=i[0];return new Vn(this.center,o.candidate,n)}return null}}const Tu=20,ci=Tu*2,Sv=Math.PI/4,NL=(e,t,n,r)=>{const i=[];return e.relationships.forEach(a=>{pt(a.fromId,t)&&!r.includes(a.toId)?i.push(e.nodes.find(s=>pt(s.id,a.toId))):pt(a.toId,t)&&!r.includes(a.fromId)&&i.push(e.nodes.find(s=>pt(s.id,a.fromId)))}),sA(e,i,a=>!pt(a,t)&&!r.includes(a),n)},sA=(e,t,n,r)=>{const i=h=>!!t.find(v=>v.id===h);let o=r,a=[];const s={},l=(h,v)=>{const m={neighbour:e.nodes.find(x=>pt(x.id,h)),nonNeighbour:e.nodes.find(x=>pt(x.id,v))},b=s[m.neighbour.id]||[];b.push(m),s[m.neighbour.id]=b};e.relationships.forEach(h=>{i(h.fromId)&&n(h.toId)&&l(h.fromId,h.toId),n(h.fromId)&&i(h.toId)&&l(h.toId,h.fromId)});const u=[6,4,3].map(h=>Math.PI/h).flatMap(h=>[-1,-.5,0,.5].map(v=>v*Math.PI+h));for(const h of t){const v=[];for(const m of s[h.id]||[]){const b=m.nonNeighbour.position.vectorFrom(m.neighbour.position),x=b.distance();v.includes(O=>Math.abs(O-x)<.01)||v.push(x);const P=new Vn(h.position,b.angle(),r);P.error{const b=new Vn(h.position,m,r),x=r.vectorFrom(h.position);b.error0&&a.push(P);const O=h.position.translate(b.scale(.5)),N=new Vn(O,b.rotate(Math.PI/2).angle(),r);N.error{n(h.id)&&(Math.abs(r.x-h.position.x)n(h.id)),p=[];for(const h of a){const v=h.intervalGuide(f,r);v&&v.error0;){const h=y.shift();h.error0;){const h=y.shift(),v=g[0].combine(h,r);v.possible&&v.intersection.vectorFrom(r).distance()h.type==="LINE");for(const h of a)!g.includes(h)&&h.calculateError(o)<.01&&(h.type==="LINE"?w.every(v=>!iA(v,h))&&(w.push(h),g.push(h)):g.push(h));return{snapped:g.length>0,guidelines:g,snappedPosition:o}},RL=(e,t,n=1)=>{if(e.length===0)return null;const r=u=>u.position.scale(n),i=u=>wr(u,"radius")(t)*n,o=Math.min(...e.map(u=>r(u).x-i(u))),a=Math.max(...e.map(u=>r(u).x+i(u))),s=Math.min(...e.map(u=>r(u).y-i(u))),l=Math.max(...e.map(u=>r(u).y+i(u)));return{left:o,right:a,top:s,bottom:l}},I0=(e,t,n,r,i,o)=>{let a=n-e,s=r-t,l=a*a+s*s,u=((i-e)*a+(o-t)*s)/l;u>1?u=1:u<0&&(u=0);let c=e+u*a,d=t+u*s,f=c-i,p=d-o;return Math.sqrt(f*f+p*p)};var kL=function(){},$L=kL(),Ho=function(e){return e!==$L&&e!==null},DL=Ho,ML=Array.prototype.forEach,LL=Object.create,FL=function(e,t){var n;for(n in e)t[n]=e[n]},lA=function(e){var t=LL(null);return ML.call(arguments,function(n){DL(n)&&FL(Object(n),t)}),t},HL=function(){var e=Math.sign;return typeof e!="function"?!1:e(10)===1&&e(-20)===-1},dg,X1;function jL(){return X1||(X1=1,dg=function(e){return e=Number(e),isNaN(e)||e===0?e:e>0?1:-1}),dg}var GL=HL()?Math.sign:jL(),BL=GL,zL=Math.abs,UL=Math.floor,WL=function(e){return isNaN(e)?0:(e=Number(e),e===0||!isFinite(e)?e:BL(e)*UL(zL(e)))},VL=WL,KL=Math.max,jo=function(e){return KL(0,VL(e))},qL=jo,uA=function(e,t,n){var r;return isNaN(e)?(r=t,r>=0?n&&r?r-1:r:1):e===!1?!1:qL(e)},Yi=function(e){if(typeof e!="function")throw new TypeError(e+" is not a function");return e},fg,J1;function Hs(){if(J1)return fg;J1=1;var e=Ho;return fg=function(t){if(!e(t))throw new TypeError("Cannot use null or undefined");return t},fg}var YL=Yi,QL=Hs(),XL=Function.prototype.bind,Z1=Function.prototype.call,JL=Object.keys,ZL=Object.prototype.propertyIsEnumerable,eF=function(e,t){return function(n,r){var i,o=arguments[2],a=arguments[3];return n=Object(QL(n)),YL(r),i=JL(n),a&&i.sort(typeof a=="function"?XL.call(a,n):void 0),typeof e!="function"&&(e=i[e]),Z1.call(e,i,function(s,l){return ZL.call(n,s)?Z1.call(r,o,n[s],s,n,l):t})}},Ap=eF("forEach"),Go={},cA={exports:{}},tF=function(){var e=Object.assign,t;return typeof e!="function"?!1:(t={foo:"raz"},e(t,{bar:"dwa"},{trzy:"trzy"}),t.foo+t.bar+t.trzy==="razdwatrzy")},pg,eE;function nF(){return eE||(eE=1,pg=function(){try{return Object.keys("primitive"),!0}catch{return!1}}),pg}var hg,tE;function rF(){if(tE)return hg;tE=1;var e=Ho,t=Object.keys;return hg=function(n){return t(e(n)?Object(n):n)},hg}var gg,nE;function iF(){return nE||(nE=1,gg=nF()()?Object.keys:rF()),gg}var mg,rE;function oF(){if(rE)return mg;rE=1;var e=iF(),t=Hs(),n=Math.max;return mg=function(r,i){var o,a,s=n(arguments.length,2),l;for(r=Object(t(r)),l=function(u){try{r[u]=i[u]}catch(c){o||(o=c)}},a=1;a-1},wg}var CF=xF()?String.prototype.contains:SF(),Gd=mA,cE=EF,vA=dA,yA=lA,Zl=CF,TF=gA.exports=function(e,t){var n,r,i,o,a;return arguments.length<2||typeof e!="string"?(o=t,t=e,e=null):o=arguments[2],Gd(e)?(n=Zl.call(e,"c"),r=Zl.call(e,"e"),i=Zl.call(e,"w")):(n=i=!0,r=!1),a={value:t,configurable:n,enumerable:r,writable:i},o?vA(yA(o),a):a};TF.gs=function(e,t,n){var r,i,o,a;return typeof e!="string"?(o=n,n=t,t=e,e=null):o=arguments[3],Gd(t)?cE(t)?Gd(n)?cE(n)||(o=n,n=void 0):n=void 0:(o=t,t=n=void 0):t=void 0,Gd(e)?(r=Zl.call(e,"c"),i=Zl.call(e,"e")):(r=!0,i=!1),a={get:t,set:n,configurable:r,enumerable:i},o?vA(yA(o),a):a};var Bo=gA.exports,Tv={exports:{}};(function(e,t){var n=Bo,r=Yi,i=Function.prototype.apply,o=Function.prototype.call,a=Object.create,s=Object.defineProperty,l=Object.defineProperties,u=Object.prototype.hasOwnProperty,c={configurable:!0,enumerable:!1,writable:!0},d,f,p,y,g,w,h;d=function(v,m){var b;return r(m),u.call(this,"__ee__")?b=this.__ee__:(b=c.value=a(null),s(this,"__ee__",c),c.value=null),b[v]?typeof b[v]=="object"?b[v].push(m):b[v]=[b[v],m]:b[v]=m,this},f=function(v,m){var b,x;return r(m),x=this,d.call(this,v,b=function(){p.call(x,v,b),i.call(m,this,arguments)}),b.__eeOnceListener__=m,this},p=function(v,m){var b,x,C,P;if(r(m),!u.call(this,"__ee__"))return this;if(b=this.__ee__,!b[v])return this;if(x=b[v],typeof x=="object")for(P=0;C=x[P];++P)(C===m||C.__eeOnceListener__===m)&&(x.length===2?b[v]=x[P?0:1]:x.splice(P,1));else(x===m||x.__eeOnceListener__===m)&&delete b[v];return this},y=function(v){var m,b,x,C,P;if(u.call(this,"__ee__")&&(C=this.__ee__[v],!!C))if(typeof C=="object"){for(b=arguments.length,P=new Array(b-1),m=1;m=55296&&b<=56319&&(O+=f[++w])),O=p?u.call(p,y,O,h):O,g?(c.value=O,d(v,h,c)):v[h]=O,++h;m=h}}if(m===void 0)for(m=r(f.length),g&&(v=new g(m)),w=0;w=0?c=a(c):c=t(this.length)-a(o(c)),l=c;l"}},tm}var nm,YE;function w3(){if(YE)return nm;YE=1;var e=b3(),t=/[\n\r\u2028\u2029]/g;return nm=function(n){var r=e(n);return r.length>100&&(r=r.slice(0,99)+"…"),r=r.replace(t,function(i){return JSON.stringify(i).slice(1,-1)}),r},nm}var gd={exports:{}},QE;function CA(){if(QE)return gd.exports;QE=1,gd.exports=e,gd.exports.default=e;function e(t){return!!t&&(typeof t=="object"||typeof t=="function")&&typeof t.then=="function"}return gd.exports}var XE;function E3(){if(XE)return zE;XE=1;var e=xA(),t=m3(),n=y3(),r=w3(),i=CA(),o=k0(),a=Object.create,s=t("then","then:finally","done","done:finally");return Go.promise=function(l,u){var c=a(null),d=a(null),f=a(null);if(l===!0)l=null;else if(l=n(l),!s[l])throw new TypeError("'"+r(l)+"' is not valid promise mode");u.on("set",function(p,y,g){var w=!1;if(!i(g)){d[p]=g,u.emit("setasync",p,1);return}c[p]=1,f[p]=g;var h=function(x){var C=c[p];if(w)throw new Error(`Memoizee error: Detected unordered then|done & finally resolution, which in turn makes proper detection of success/failure impossible (when in 'done:finally' mode) Consider to rely on 'then' or 'done' mode instead.`);C&&(delete c[p],d[p]=x,u.emit("setasync",p,C))},v=function(){w=!0,c[p]&&(delete c[p],delete f[p],u.delete(p))},m=l;if(m||(m="then"),m==="then"){var b=function(){o(v)};g=g.then(function(x){o(h.bind(this,x))},b),typeof g.finally=="function"&&g.finally(b)}else if(m==="done"){if(typeof g.done!="function")throw new Error("Memoizee error: Retrieved promise does not implement 'done' in 'done' mode");g.done(h,v)}else if(m==="done:finally"){if(typeof g.done!="function")throw new Error("Memoizee error: Retrieved promise does not implement 'done' in 'done:finally' mode");if(typeof g.finally!="function")throw new Error("Memoizee error: Retrieved promise does not implement 'finally' in 'done:finally' mode");g.done(h),g.finally(v)}}),u.on("get",function(p,y,g){var w;if(c[p]){++c[p];return}w=f[p];var h=function(){u.emit("getasync",p,y,g)};i(w)?typeof w.done=="function"?w.done(h):w.then(function(){o(h)}):h()}),u.on("delete",function(p){if(delete f[p],c[p]){delete c[p];return}if(hasOwnProperty.call(d,p)){var y=d[p];delete d[p],u.emit("deleteasync",p,[y])}}),u.on("clear",function(){var p=d;d=a(null),c=a(null),f=a(null),u.emit("clearasync",e(p,function(y){return[y]}))})},zE}var JE={},ZE;function x3(){if(ZE)return JE;ZE=1;var e=Yi,t=Ap,n=Go,r=Function.prototype.apply;return n.dispose=function(i,o,a){var s;if(e(i),a.async&&n.async||a.promise&&n.promise){o.on("deleteasync",s=function(l,u){r.call(i,null,u)}),o.on("clearasync",function(l){t(l,function(u,c){s(c,u)})});return}o.on("delete",s=function(l,u){i(u)}),o.on("clear",function(l){t(l,function(u,c){s(c,u)})})},JE}var ex={},rm,tx;function S3(){return tx||(tx=1,rm=2147483647),rm}var im,nx;function C3(){if(nx)return im;nx=1;var e=jo,t=S3();return im=function(n){if(n=e(n),n>t)throw new TypeError(n+" exceeds maximum possible timeout");return n},im}var rx;function T3(){if(rx)return ex;rx=1;var e=N0(),t=Ap,n=k0(),r=CA(),i=C3(),o=Go,a=Function.prototype,s=Math.max,l=Math.min,u=Object.create;return o.maxAge=function(c,d,f){var p,y,g,w;c=i(c),c&&(p=u(null),y=f.async&&o.async||f.promise&&o.promise?"async":"",d.on("set"+y,function(h){p[h]=setTimeout(function(){d.delete(h)},c),typeof p[h].unref=="function"&&p[h].unref(),w&&(w[h]&&w[h]!=="nextTick"&&clearTimeout(w[h]),w[h]=setTimeout(function(){delete w[h]},g),typeof w[h].unref=="function"&&w[h].unref())}),d.on("delete"+y,function(h){clearTimeout(p[h]),delete p[h],w&&(w[h]!=="nextTick"&&clearTimeout(w[h]),delete w[h])}),f.preFetch&&(f.preFetch===!0||isNaN(f.preFetch)?g=.333:g=s(l(Number(f.preFetch),1),0),g&&(w={},g=(1-g)*c,d.on("get"+y,function(h,v,m){w[h]||(w[h]="nextTick",n(function(){var b;w[h]==="nextTick"&&(delete w[h],d.delete(h),f.async&&(v=e(v),v.push(a)),b=d.memoized.apply(m,v),f.promise&&r(b)&&(typeof b.done=="function"?b.done(a,a):b.then(a,a)))}))}))),d.on("clear"+y,function(){t(p,function(h){clearTimeout(h)}),p={},w&&(t(w,function(h){h!=="nextTick"&&clearTimeout(h)}),w={})}))},ex}var ix={},om,ox;function P3(){if(ox)return om;ox=1;var e=jo,t=Object.create,n=Object.prototype.hasOwnProperty;return om=function(r){var i=0,o=1,a=t(null),s=t(null),l=0,u;return r=e(r),{hit:function(c){var d=s[c],f=++l;if(a[f]=c,s[c]=f,!d)return++i,i<=r?void 0:(c=a[o],u(c),c);if(delete a[d],o===d)for(;!n.call(a,++o););},delete:u=function(c){var d=s[c];if(d&&(delete a[d],delete s[c],--i,o===d)){if(!i){l=0,o=1;return}for(;!n.call(a,++o););}},clear:function(){i=0,o=1,a=t(null),s=t(null),l=0}}},om}var ax;function O3(){if(ax)return ix;ax=1;var e=jo,t=P3(),n=Go;return n.max=function(r,i,o){var a,s,l;r=e(r),r&&(s=t(r),a=o.async&&n.async||o.promise&&n.promise?"async":"",i.on("set"+a,l=function(u){u=s.hit(u),u!==void 0&&i.delete(u)}),i.on("get"+a,l),i.on("delete"+a,s.delete),i.on("clear"+a,s.clear))},ix}var sx={},lx;function A3(){if(lx)return sx;lx=1;var e=Bo,t=Go,n=Object.create,r=Object.defineProperties;return t.refCounter=function(i,o,a){var s,l;s=n(null),l=a.async&&t.async||a.promise&&t.promise?"async":"",o.on("set"+l,function(u,c){s[u]=c||1}),o.on("get"+l,function(u){++s[u]}),o.on("delete"+l,function(u){delete s[u]}),o.on("clear"+l,function(){s={}}),r(o.memoized,{deleteRef:e(function(){var u=o.get(arguments);return u===null||!s[u]?null:--s[u]?!1:(o.delete(u),!0)}),getRefCount:e(function(){var u=o.get(arguments);return u===null||!s[u]?0:s[u]})})},sx}var _3=lA,I3=uA,N3=a3,R3=function(e){var t=_3(arguments[1]),n;return t.normalizer||(n=t.length=I3(t.length,e.length,t.async),n!==0&&(t.primitive?n===!1?t.normalizer=s3():n>1&&(t.normalizer=l3()(n)):n===!1?t.normalizer=f3()():n===1?t.normalizer=p3()():t.normalizer=h3()(n))),t.async&&g3(),t.promise&&E3(),t.dispose&&x3(),t.maxAge&&T3(),t.max&&O3(),t.refCounter&&A3(),N3(e,t)};const TA=pn(R3);class nt{constructor(t,n,r,i){this.left=t,this.right=n,this.top=r,this.bottom=i}get width(){return this.right-this.left}get height(){return this.bottom-this.top}corners(){return[new Y(this.left,this.top),new Y(this.right,this.top),new Y(this.left,this.bottom),new Y(this.right,this.bottom)]}combine(t){return new nt(Math.min(this.left,t.left),Math.max(this.right,t.right),Math.min(this.top,t.top),Math.max(this.bottom,t.bottom))}scale(t){return new nt(this.left*t,this.right*t,this.top*t,this.bottom*t)}translate(t){return new nt(this.left+t.dx,this.right+t.dx,this.top+t.dy,this.bottom+t.dy)}contains(t){return t.x>=this.left&&t.x<=this.right&&t.y>=this.top&&t.y<=this.bottom}containsBoundingBox(t){return this.left<=t.left&&this.right>=t.right&&this.top<=t.top&&this.bottom>=t.bottom}}const js=e=>e.reduce((t,n)=>t?t.combine(n):n,null),ux=e=>{const t=e.map(r=>r.x),n=e.map(r=>r.y);return new nt(Math.min(...t),Math.max(...t),Math.min(...n),Math.max(...n))},Wt=(e,t)=>{const n=t("background-color");return k3(e,n)},k3=(()=>TA((t,n)=>{const r=md(t),i=r.distance(md(La)),o=r.minus(md(La)),a=md(n),s=a.plus(o).normalise(),l=a.plus(o.scale(.5)).normalise();return(Math.abs(i-s.distance(a))new Fa($3(e)),$3=e=>[1,3,5].map(t=>Number.parseInt(e.substring(t,t+2),16));class Fa{constructor(t){this.components=t}minus(t){return new Fa(this.components.map((n,r)=>n-t.components[r]))}plus(t){return new Fa(this.components.map((n,r)=>n+t.components[r]))}distance(t){return this.components.map((n,r)=>Math.abs(n-t.components[r])).reduce((n,r)=>n+r,0)}scale(t){return new Fa(this.components.map(n=>n*t))}normalise(){return new Fa(this.components.map(t=>{let n=Math.floor(t);for(;n<0;)n+=256;for(;n>255;)n-=256;return n}))}toString(){return"#"+this.components.map(t=>{const n=Math.abs(t).toString(16);return n.length>1?n:"0"+n}).join("")}}class PA{constructor(t,n,r,i){this.text=t,this.backgroundColor=r("label-background-color"),this.strokeColor=r("label-border-color"),this.fontColor=r("label-color"),this.selectionColor=Wt(this.editing?qi:Fo,r),this.borderWidth=r("label-border-width"),this.display=r("label-display");const o=r("label-padding");this.font={fontWeight:"normal",fontSize:r("label-font-size"),fontFamily:r("font-family")},i.font=this.font,this.textWidth=i.measureText(t).width,this.height=this.font.fontSize+o*2+this.borderWidth,this.radius=this.display==="pill"?this.height/2:0,this.width=this.textWidth+this.radius*2,this.editing=n}draw(t){t.save(),t.fillStyle=this.backgroundColor,t.strokeStyle=this.strokeColor,t.lineWidth=this.borderWidth,this.display==="pill"&&t.rect(0,0,this.width,this.height,this.radius,!0,this.borderWidth>0),this.editing||(t.font=this.font,t.textBaseline="middle",t.fillStyle=this.fontColor,t.fillText(this.text,this.radius,this.height/2)),t.restore()}drawSelectionIndicator(t){t.save(),t.strokeStyle=this.selectionColor,t.lineWidth=10,t.lineJoin="round",t.rect(-this.borderWidth/2,-this.borderWidth/2,this.width+this.borderWidth,this.height+this.borderWidth,this.radius+this.borderWidth/2,!1,!0),t.restore()}contains(t){const n=new nt(this.radius,this.width,0,this.height),r=new Y(this.radius,this.radius),i=new Y(this.radius+this.width,this.radius);return n.contains(t)||r.vectorFrom(t).distance()new PA(s,r,i,o)),this.margin=i("label-margin"),t.length>0){const s=this.pills[0].height+this.margin+this.pills[0].borderWidth;this.pillPositions=this.pills.map((l,u)=>{const c=l.width+l.borderWidth,d=(()=>{switch(n.horizontal){case"start":return 0;case"center":return-c/2;case"end":return-c}})();return new oe(d,u*s)})}this.width=Math.max(...this.pills.map(s=>s.width+s.borderWidth));const a=this.pills.length-1;this.height=this.pillPositions[a].dy+this.pills[a].height+this.pills[a].borderWidth}get type(){return"LABELS"}get isEmpty(){return this.pills.length===0}draw(t){for(let n=0;nt.boundingBox().translate(this.pillPositions[n])))}distanceFrom(t){return this.pills.some((n,r)=>{const i=t.translate(this.pillPositions[r].invert());return n.contains(i)})?0:1/0}}function M3(e,t,n,r){e.save(),e.setLineDash([5,10]),e.strokeStyle=r,e.beginPath(),e.arc(t.x,t.y,n,0,2*Math.PI,!1),e.closePath(),e.stroke(),e.restore()}function Pv(e,t,n,r,i,o){const a=t.x,s=t.y;e.beginPath(),e.fillStyle=o,e.moveTo(a+i,s),e.arcTo(a+n,s,a+n,s+r,i),e.arcTo(a+n,s+r,a,s+r,i),e.arcTo(a,s+r,a,s,i),e.arcTo(a,s,a+n,s,i),e.fill(),e.closePath()}function am(e,t,n,r){e.save(),e.beginPath(),e.setLineDash([5,10]),e.strokeStyle=r,e.moveTo(t.x,t.y),e.lineTo(n.x,n.y),e.closePath(),e.stroke(),e.restore()}const go=(e,t,n,r)=>{e.textAlign=r,e.fillText(t,n.x,n.y)},L3=(e,t,n,r)=>{t.length<3||(e.fillStyle=n||"none",e.beginPath(),e.moveTo(t[0].x,t[0].y),t.forEach(i=>{e.lineTo(i.x,i.y),r&&e.stroke()}),e.closePath(),n&&e.fill())},OA=(e,t,n)=>{const r=e.split(" "),i=[],o=()=>({index:i.length});let a=o();const s=()=>{a.hasOwnProperty("text")&&i.push(a)},l=g=>a.text?a.text+" "+g:g;for(;r.length>0;)a.text&&n(l(r[0]))>t?(s(),a=o()):a.text=l(r.shift());r.length===0&&s();const u={lines:i},c=g=>t-n(g.text),d=g=>Math.max(...g.lines.map(c)),f=g=>{const h=g.lines.sort((m,b)=>c(b)-c(m))[0],v=g.lines.filter(m=>m.index===h.index-1)[0];if(v){const m=v.text.split(" "),b=m[m.length-1],x={...v,text:m.slice(0,-1).join(" ")},C={...h,text:b+" "+h.text};if(c(C)>0)return{...g,lines:g.lines.map(P=>P.index===x.index?x:P.index===C.index?C:P)}}},y=(()=>{const g=[];let w=u;for(;w;)g.push(w),w=f(w);return g})().slice(0).sort((g,w)=>d(g)-d(w))[0];return{actualWidth:Math.max(...y.lines.map(g=>n(g.text))),margin:n(" "),lines:y.lines.sort((g,w)=>g.index-w.index).map(g=>g.text)}};class F3{constructor(t,n,r,i){this.editing=n,this.font={fontWeight:r("caption-font-weight"),fontSize:r("caption-font-size"),fontFamily:r("font-family")},i.font=this.font,this.fontColor=r("caption-color"),this.orientation={horizontal:"center",vertical:"center"},this.lineHeight=this.font.fontSize*1.2;const o=a=>i.measureText(a).width;this.layout=OA(t,r("caption-max-width"),o),this.width=this.layout.actualWidth,this.height=this.layout.lines.length*this.lineHeight}get type(){return"CAPTION"}draw(t){if(this.editing)return;t.save(),t.fillStyle=this.fontColor,t.font=this.font,t.textBaseline="middle";const n=this.layout.lines;for(let r=0;re.hasOwnProperty(t),j3=e=>e&&e.status==="LOADED",$0=(e,t)=>e[t]||{status:"UNKNOWN",errorMessage:"Image not cached",image:document.createElement("img"),width:0,height:0},G3=(e,t,n)=>{let r;const i=document.createElement("img");return i.setAttribute("crossorigin","anonymous"),i.onload=()=>{t({status:"LOADED",image:i,dataUrl:r,width:i.naturalWidth,height:i.naturalHeight})},i.onerror=()=>{n({status:"ERROR",errorMessage:"Image failed to load",image:document.createElement("img"),width:0,height:0})},fetch(e).then(o=>{if(!o.ok)throw Error(o.statusText);return o.blob()}).then(o=>{const a=new FileReader;a.readAsDataURL(o),a.onloadend=function(){r=a.result,i.src=r}}).catch(o=>{n({status:"ERROR",errorMessage:o,image:i,width:0,height:0})}),{status:"LOADING",image:i,width:0,height:0}};class B3{constructor(t,n,r,i,o){this.position=t,this.internalRadius=n,this.editing=r,this.backgroundColor=i("node-color"),this.borderWidth=i("border-width"),this.borderColor=i("border-color"),this.selectionColor=Wt(this.editing?qi:Fo,i);const a=i("node-background-image");a&&(this.imageInfo=$0(o,a))}draw(t){t.save(),t.fillStyle=this.backgroundColor,t.strokeStyle=this.borderColor,t.lineWidth=this.borderWidth,t.circle(this.position.x,this.position.y,this.internalRadius+this.borderWidth/2,!0,this.borderWidth>0),this.imageInfo&&t.imageInCircle(this.imageInfo,this.position.x,this.position.y,this.internalRadius),t.restore()}drawSelectionIndicator(t){t.save();const n=10;t.strokeStyle=this.selectionColor,t.lineWidth=n,t.circle(this.position.x,this.position.y,this.internalRadius+this.borderWidth,!1,!0),t.restore()}}class AA{constructor(t,n,r,i){this.editing=n,this.font={fontWeight:r("property-font-weight"),fontSize:r("property-font-size"),fontFamily:r("font-family")},i.font=this.font,this.fontColor=r("property-color"),this.selectionColor=Wt(this.editing?qi:Fo,r),this.lineHeight=this.font.fontSize*1.2,this.alignment=r("property-alignment"),this.properties=Object.keys(t).map(a=>({key:a,value:t[a]})),this.spaceWidth=i.measureText(" ").width,this.colonWidth=i.measureText(":").width;const o=a=>this.properties.length===0?0:Math.max(...this.properties.map(s=>i.measureText(a(s)).width));switch(this.editing?"colon":this.alignment){case"colon":this.keysWidth=o(a=>a.key)+this.spaceWidth,this.valuesWidth=o(a=>a.value)+this.spaceWidth,this.boxWidth=this.keysWidth+this.colonWidth+this.spaceWidth+this.valuesWidth;break;case"center":this.boxWidth=o(a=>a.key+": "+a.value);break}this.boxHeight=this.lineHeight*this.properties.length}get isEmpty(){return this.properties.length===0}draw(t){t.save(),t.font=this.font,t.fillStyle=this.fontColor,t.textBaseline="middle",this.properties.forEach((n,r)=>{const i=(r+.5)*this.lineHeight;if(this.editing)go(t,":",new Y(this.keysWidth+this.colonWidth,i),"end");else switch(this.alignment){case"colon":go(t,n.key+":",new Y(this.keysWidth+this.colonWidth,i),"end"),go(t,n.value,new Y(this.keysWidth+this.colonWidth+this.spaceWidth,i),"start");break;case"center":go(t,n.key+": "+n.value,new Y(this.boxWidth/2,i),"center");break}}),t.restore()}drawBackground(t){const n=this.boundingBox();t.fillStyle="white",t.rect(n.left,n.top,n.width,n.height,0,!0,!1)}drawSelectionIndicator(t){const r=this.boundingBox();t.save(),t.strokeStyle=this.selectionColor,t.lineWidth=10,t.lineJoin="round",t.rect(r.left,r.top,r.width,r.height,0,!1,!0),t.restore()}boundingBox(){return new nt(0,this.boxWidth,0,this.boxHeight)}}class _A{constructor(t,n,r,i,o){this.propertiesBox=new AA(t,r,i,o),this.width=this.propertiesBox.boxWidth,this.height=this.propertiesBox.boxHeight;const a=(()=>{switch(n.horizontal){case"start":return 0;case"center":return-this.width/2;case"end":return-this.width}})();this.boxPosition=new Y(a,0)}get type(){return"PROPERTIES"}get isEmpty(){return this.propertiesBox.isEmpty}draw(t){this.isEmpty||(t.save(),t.translate(...this.boxPosition.xy),this.propertiesBox.drawBackground(t),this.propertiesBox.draw(t),t.restore())}drawSelectionIndicator(t){t.save(),t.translate(...this.boxPosition.xy),this.propertiesBox.drawSelectionIndicator(t),t.restore()}boundingBox(){return this.propertiesBox.boundingBox().translate(this.boxPosition.vectorFromOrigin())}distanceFrom(t){return this.boundingBox().contains(t)?0:1/0}}class IA{constructor(t,n,r,i,o){this.caption=t,this.orientation=n,this.editing=r,this.font={fontWeight:i("caption-font-weight"),fontSize:i("caption-font-size"),fontFamily:i("font-family")},o.font=this.font,this.fontColor=i("caption-color"),this.selectionColor=Wt(this.editing?qi:Fo,i),this.lineHeight=this.font.fontSize*1.2;const a=l=>o.measureText(l).width;this.layout=OA(t,i("caption-max-width"),a),this.width=this.layout.actualWidth,this.height=this.layout.lines.length*this.lineHeight;const s=(()=>{switch(n.horizontal){case"start":return 0;case"center":return-this.width/2;case"end":return-this.width}})();this.boxPosition=new Y(s,0)}get type(){return"CAPTION"}draw(t){if(this.editing)return;t.save(),t.fillStyle=this.fontColor,t.font=this.font,t.textBaseline="middle";const n=this.layout.lines;for(let r=0;r{if(e(t))return t;let r=t,i=n,o=!1;for(;(r-i)/i>.01;){const a=i+(r-i)/2;o=e(a),o?i=a:r=a}return o||e(i),i};class W3{constructor(t,n,r,i){this.pills=t.map(a=>new PA(a,n,r,i)),this.margin=r("label-margin");let o=0;this.pillPositions=[];for(let a=0;aMath.max(a,s.width),0),this.height=this.pills.reduce((a,s)=>a+s.height,0)+this.margin*(this.pills.length-1)}get type(){return"LABELS"}get isEmpty(){return this.pills.length===0}draw(t){for(let n=0;nt.boundingBox().translate(this.pillPositions[n])))}distanceFrom(t){return this.pills.some((n,r)=>{const i=t.translate(this.pillPositions[r].invert());return n.contains(i)})?0:1/0}}const V3=(e,t,n,r)=>{const i=m=>m*m,o=m=>{const b=new Array(m);for(let x=0;x{const x=(b-(m-1)/2)*r,C=x-r/2,P=x+r/2,O=Math.sqrt(i(t)-i(C)),N=Math.sqrt(i(t)-i(P)),k=Math.min(O,N)*2;return{top:C,mid:x,width:k}},s=Math.floor(t*2/r),l=(m,b)=>{const x=e.split(/\s+/),C=[];let P=b;const O=()=>({index:P,extent:a(m,P)});let N=O();const k=()=>{N.hasOwnProperty("text")&&C.push(N)},D=L=>N.text?N.text+" "+L:L;for(;x.length>0;)if(n(D(x[0]))>N.extent.width){if(k(),P++,P>=m)break;N=O()}else N.text=D(x.shift());return x.length===0&&k(),{availableLines:m,startingLine:b,lines:C,emptyLinesBelow:m-(C.length>0?C[C.length-1].index:b)-1,wordsRemaining:x.length}},u=o(Math.ceil(s/2)).map(m=>l(s,m)),c=o(Math.ceil((s-1)/2)).map(m=>l(s-1,m)),d=u.concat(c),f=(m,b)=>{const x=Math.min(...m.map(b));return m.filter(C=>b(C)===x)},p=(()=>{const m=f(d,C=>C.wordsRemaining),b=f(m,C=>C.lines.length);return f(b,C=>Math.abs(C.startingLine-C.emptyLinesBelow))[0]})(),y=m=>m.extent.width-n(m.text),g=m=>Math.max(...m.lines.map(y)),w=m=>{const x=m.lines.sort((P,O)=>y(O)-y(P))[0],C=m.lines.filter(P=>P.index===x.index-1)[0];if(C){const P=C.text.split(" "),O=P[P.length-1],N={...C,text:P.slice(0,-1).join(" ")},k={...x,text:O+" "+x.text};if(y(k)>0)return{...m,lines:m.lines.map(D=>D.index===N.index?N:D.index===k.index?k:D)}}},v=(()=>{const m=[];let b=p;for(;b;)m.push(b),b=w(b);return m})().slice(0).sort((m,b)=>g(m)-g(b))[0]||{lines:[],wordsRemaining:1/0};return{top:Math.min(...v.lines.map(m=>m.extent.top)),lines:v.lines.sort((m,b)=>m.index-b.index).map(m=>m.text),allTextFits:v.wordsRemaining===0}};class NA{constructor(t,n,r,i,o){this.caption=t,this.radius=n,this.editing=r,this.font={fontWeight:i("caption-font-weight"),fontSize:i("caption-font-size"),fontFamily:i("font-family")},o.font=this.font,this.fontColor=i("caption-color"),this.orientation={horizontal:"center",vertical:"center"},this.lineHeight=this.font.fontSize*1.2;const a=s=>o.measureText(s).width;this.layout=V3(this.caption,Math.max(1,this.radius),a,this.lineHeight)}get type(){return"CAPTION"}draw(t){if(!this.editing){t.save(),t.font=this.font,t.fillStyle=this.fontColor,t.textBaseline="middle";for(let n=0;nthis.imageInfo.height?"width":"height";this.width=o==="width"?i:i*this.imageInfo.width/this.imageInfo.height,this.height=o==="height"?i:i*this.imageInfo.height/this.imageInfo.width}}draw(t,n,r){j3(this.imageInfo)&&t.image(this.imageInfo,n,r,this.width,this.height)}};class K3{constructor(t,n,r,i){this.editing=n,this.orientation={horizontal:"center",vertical:"center"},this.icon=new RA(t,r,i),this.width=this.icon.width,this.height=this.icon.height}get type(){return"ICON"}draw(t){if(this.editing)return;const n=-this.width/2,r=0;this.icon.draw(t,n,r)}get contentsFit(){return!0}boundingBox(){return new nt(-this.width/2,this.width/2,0,this.height)}distanceFrom(t){return t.vectorFromOrigin().distance()}}class kA{constructor(t,n,r,i,o){this.orientation=n,this.editing=r,this.icon=new RA(t,i,o),this.width=this.icon.width,this.height=this.icon.height;const a=(()=>{switch(n.horizontal){case"start":return 0;case"center":return-this.width/2;case"end":return-this.width}})();this.boxPosition=new Y(a,0),this.selectionColor=Wt(this.editing?qi:Fo,i)}get type(){return"ICON"}draw(t){this.editing||this.icon.draw(t,this.boxPosition.x,this.boxPosition.y)}drawSelectionIndicator(t){const r=this.boundingBox();t.save(),t.strokeStyle=this.selectionColor,t.lineWidth=10,t.lineJoin="round",t.rect(r.left,r.top,r.width,r.height,0,!1,!0),t.restore()}get contentsFit(){return!0}boundingBox(){const t=this.boxPosition.x,n=this.boxPosition.y;return new nt(t,t+this.width,n,n+this.height)}distanceFrom(t){return this.boundingBox().contains(t)?0:1/0}}const q3=(e,t)=>e.map(n=>({angle:n,separation:Y3(n,t)})).sort((n,r)=>r.separation-n.separation)[0].angle,Y3=(e,t)=>Math.min(...t.map(n=>Math.min(Math.abs(n.angle-e),Math.abs(n.angle-(e-Math.PI*2)),Math.abs(n.angle-(e+Math.PI*2))))),Pu=[{name:"top-left",angle:-3*Math.PI/4,vertical:"top",horizontal:"end"},{name:"top",angle:-Math.PI/2,vertical:"top",horizontal:"center"},{name:"top-right",angle:-Math.PI/4,vertical:"top",horizontal:"start"},{name:"right",angle:0,vertical:"center",horizontal:"start"},{name:"bottom-right",angle:Math.PI/4,vertical:"bottom",horizontal:"start"},{name:"bottom",angle:Math.PI/2,vertical:"bottom",horizontal:"center"},{name:"bottom-left",angle:3*Math.PI/4,vertical:"bottom",horizontal:"end"},{name:"left",angle:Math.PI,vertical:"center",horizontal:"end"}],Q3=Pu.map(e=>e.angle),X3=e=>Pu.find(t=>t.name===e)||Pu[0],J3=e=>Pu.find(t=>t.angle===e)||Pu[0],Z3=e=>{switch(e){case"center":return"center";case"end":return"right";default:return"left"}};class Va{constructor(){this.offsetComponents=[]}push(t){let n=0;if(!this.isEmpty()){const r=this.bottomComponent(),i=a=>a.margin||0,o=Math.max(i(r.component),i(t));n=r.top+r.component.height+o}this.offsetComponents.push({component:t,top:n})}isEmpty(t){return(t?this.offsetComponents.filter(t):this.offsetComponents).length===0}bottomComponent(){return this.offsetComponents[this.offsetComponents.length-1]}totalHeight(){if(this.isEmpty())return 0;const t=this.bottomComponent();return t.top+t.component.height}maxWidth(){return Math.max(...this.offsetComponents.map(t=>t.component.width))}maxRadius(t){return this.offsetComponents.reduce((n,r)=>{const i=r.component,o=new oe(i.width/2,t),a=new oe(i.width/2,t+i.height);return Math.max(n,o.distance(),a.distance())},0)}everythingFits(t,n){return this.maxRadius(t)<=n}scaleToFit(t,n){const r=this.maxRadius(t);return n/r}boundingBox(){return js(this.offsetComponents.map(t=>t.component.boundingBox().translate(new oe(0,t.top))))}distanceFrom(t){return Math.min(...this.offsetComponents.map(n=>{const r=t.translate(new oe(0,-n.top));return n.component.distanceFrom(r)}))}draw(t){this.offsetComponents.forEach(n=>{t.save(),t.translate(0,n.top),n.component.draw(t),t.restore()})}drawSelectionIndicator(t){this.offsetComponents.forEach(n=>{t.save(),t.translate(0,n.top),n.component.drawSelectionIndicator(t),t.restore()})}}class e4{constructor(t,n,r,i,o,a){this.node=t,this.selected=r,this.editing=i;const s=x=>wr(t,x)(n);this.internalRadius=s("radius"),this.radius=this.internalRadius+s("border-width"),this.outsideComponentRadius=this.radius+s("node-margin"),this.fitRadius=this.internalRadius-s("node-padding"),this.background=new B3(t.position,this.internalRadius,i,s,a);const l=rA(t,n).map(x=>({angle:x.vectorFrom(t.position).angle()}));this.internalVerticalOffset=0,this.internalScaleFactor=void 0,this.insideComponents=new Va,this.outsideComponents=new Va;const u=s("caption-position"),c=s("label-position"),d=s("property-position"),f=s("node-icon-image"),p=s("icon-position"),y=!!f,g=!!t.caption,w=t.labels.length>0,h=Object.keys(t.properties).length>0,v=s("outside-position");switch(v){case"auto":this.outsideOrientation=J3(q3(Q3,l));break;default:this.outsideOrientation=X3(v)}if(y)switch(p){case"inside":this.insideComponents.push(this.icon=new K3("node-icon-image",i,s,a));break;default:this.outsideComponents.push(this.icon=new kA("node-icon-image",this.outsideOrientation,i,s,a))}const m=t.caption||"";if(g)switch(u){case"inside":w&&c==="inside"||h&&d==="inside"||y&&p==="inside"?this.insideComponents.push(this.caption=new F3(m,i,s,o)):(this.internalScaleFactor=U3(x=>(this.caption=new NA(m,this.fitRadius/x,i,s,o),this.caption.contentsFit),1,1e-6),this.insideComponents.push(this.caption));break;default:this.outsideComponents.push(this.caption=new IA(m,this.outsideOrientation,i,s,o));break}if(w)switch(c){case"inside":this.insideComponents.push(this.labels=new W3(t.labels,i,s,o));break;default:this.outsideComponents.push(this.labels=new D3(t.labels,this.outsideOrientation,i,s,o))}if(h)switch(d){case"inside":this.insideComponents.push(this.properties=new z3(t.properties,i,s,o));break;default:this.outsideComponents.push(this.properties=new _A(t.properties,this.outsideOrientation,i,s,o))}this.internalScaleFactor===void 0&&(this.internalVerticalOffset=-this.insideComponents.totalHeight()/2,this.internalScaleFactor=this.insideComponents.everythingFits(this.internalVerticalOffset,this.fitRadius)?1:this.insideComponents.scaleToFit(this.internalVerticalOffset,this.fitRadius));const b=(()=>{const x=this.outsideComponents.totalHeight();switch(this.outsideOrientation.vertical){case"top":return-x;case"center":return-x/2;case"bottom":return 0}})();this.outsideOffset=new oe(1,0).rotate(this.outsideOrientation.angle).scale(this.outsideComponentRadius).plus(new oe(0,b))}get id(){return this.node.id}get position(){return this.node.position}get status(){return this.node.status}get superNodeId(){return this.node.superNodeId}get type(){return this.node.type}get initialPositions(){return this.node.initialPositions}draw(t){this.status!=="combined"&&(t.save("node"),this.selected&&(this.background.drawSelectionIndicator(t),t.save(),t.translate(...this.position.xy),t.translate(...this.outsideOffset.dxdy),this.outsideComponents.drawSelectionIndicator(t),t.restore()),this.background.draw(t),t.save(),t.translate(...this.position.xy),t.save(),t.scale(this.internalScaleFactor),t.translate(0,this.internalVerticalOffset),this.insideComponents.draw(t),t.restore(),t.save(),t.translate(...this.outsideOffset.dxdy),this.outsideComponents.draw(t),t.restore(),t.restore(),t.restore())}boundingBox(){let t=new nt(this.position.x-this.radius,this.position.x+this.radius,this.position.y-this.radius,this.position.y+this.radius);return this.outsideComponents.isEmpty()?t:t.combine(this.outsideComponents.boundingBox().translate(this.position.vectorFromOrigin()).translate(this.outsideOffset))}distanceFrom(t){const r=t.translate(this.position.vectorFromOrigin().invert()).translate(this.outsideOffset.invert());return Math.min(this.position.vectorFrom(t).distance(),this.outsideComponents.distanceFrom(r))}}class $A{constructor(t,n,r,i,o,a){this.relationship=t,this.id=t.id,this.from=n,this.to=r,this.startAttachment=i,this.endAttachment=o,this.type=t.type,this.selected=a}}class t4{constructor(t,n,r){this.graph=t,this.nodes=n,this.relationshipBundles=r}get style(){return this.graph.style}entityAtPoint(t){const n=this.nodeAtPoint(t);if(n)return{...n,entityType:"node"};const r=this.nodeRingAtPoint(t);if(r)return{...r,entityType:"nodeRing"};const i=this.relationshipAtPoint(t);return i?{...i,entityType:"relationship"}:null}nodeAtPoint(t){return this.closestNode(t,(n,r)=>r{const i=n.radius;return r>i&&rt.contains(i.position)).map(i=>({...i,entityType:"node"})),r=this.relationshipBundles.flatMap(i=>i.routedRelationships).filter(i=>t.contains(i.arrow.midPoint())).map(i=>i.resolvedRelationship).map(i=>({...i,entityType:"relationship"}));return[...n,...r]}closestNode(t,n){let r=Number.POSITIVE_INFINITY,i=null;return this.graph.nodes.filter(o=>o.status!=="combined").forEach(o=>{const a=this.nodes[o.id],s=a.distanceFrom(t);sr<=YM)}closestRelationship(t,n){let r=Number.POSITIVE_INFINITY,i=null;return this.relationshipBundles.forEach(o=>{o.routedRelationships.forEach(a=>{const s=a.distanceFrom(t);si.draw(t)),Object.values(this.nodes).forEach(i=>{i.draw(t)}),t.restore()}boundingBox(){const t=Object.values(this.nodes).map(r=>r.boundingBox()),n=Object.values(this.relationshipBundles).map(r=>r.boundingBox());return js([...t,...n])}}const dt=e=>e.entities.filter(t=>t.entityType==="node").map(t=>t.id),n4=e=>{const t={};return e.entities.filter(n=>n.entityType==="node").forEach(n=>{t[n.id]=!0}),t},tn=(e,t)=>e.entities.some(n=>n.entityType==="node"&&n.id===t),r4=(e,t)=>e.editing&&e.editing.entityType==="node"&&e.editing.id===t,zo=(e,t)=>e.nodes.filter(n=>t.entities.some(r=>r.entityType==="node"&&r.id===n.id)),xn=e=>e.entities.filter(t=>t.entityType==="relationship").map(t=>t.id),i4=e=>{const t={};return e.entities.filter(n=>n.entityType==="relationship").forEach(n=>{t[n.id]=!0}),t},pi=(e,t)=>e.entities.some(n=>n.entityType==="relationship"&&n.id===t),o4=(e,t)=>e.editing&&e.editing.entityType==="relationship"&&e.editing.id===t,sc=(e,t)=>e.relationships.filter(n=>t.entities.some(r=>r.entityType==="relationship"&&r.id===n.id)),Et=20,oa=2,vd=(e,t,n)=>{switch(e){case"min":return t;case"max":return n;default:return(t+n)/2}},cx=(e,t,n)=>e>=t&&e<=n;class a4{constructor(t,n,r,i){const o=dt(n);if(r.dragType==="NONE"&&o.length>1){const a=js(o.map(d=>t.nodes[d].boundingBox())),s=["x","y"],l={};s.forEach(d=>{const f=o.map(w=>t.nodes[w].position[d]),p=Math.min(...f);Math.max(...f)-p>1?l[d]=["min","mid","max"]:l[d]=["mid"]});const u=d=>i.transform(d),c=[];l.x.forEach(d=>{l.y.forEach(f=>{(d!=="mid"||f!=="mid")&&c.push({x:d,y:f})})}),this.handles=c.map(d=>{const f=u(new Y(vd(d.x,a.left,a.right),vd(d.y,a.top,a.bottom))),p=f.translate(new oe(vd(d.x,-Et,0),vd(d.y,-Et,0)));return{corner:d,anchor:f,topLeft:p}}),this.color=Wt(qi,d=>t.style[d])}else this.handles=[]}draw(t){this.handles.forEach(n=>{Pv(t,n.topLeft,Et,Et,3,this.color),Pv(t,n.topLeft.translate(new oe(n.corner.x==="min"?Et/2:oa,n.corner.y==="min"?Et/2:oa)),n.corner.x==="mid"?Et-oa*2:Et/2-oa,n.corner.y==="mid"?Et-oa*2:Et/2-oa,2,"white")})}handleAtPoint(t){return this.handles.find(n=>cx(t.x,n.topLeft.x,n.topLeft.x+Et)&&cx(t.y,n.topLeft.y,n.topLeft.y+Et))}}class s4{constructor(t,n,r,i){t.ide?e.attachment.name:"normal",l4=e=>{const t={};return e.forEach(n=>{const r=new s4(n.from,n.to,n.startAttachment,n.endAttachment);(t[r.key()]||(t[r.key()]=[])).push(n)}),Object.values(t)};function Er(e,t,n,r,i,o){e.polygon([{x:n-t,y:0},{x:-t,y:r/2},{x:0,y:0},{x:-t,y:-r/2}],i,o)}class u4{constructor(t,n,r,i,o,a,s,l,u){const c=n.vectorFrom(t);this.centreDistance=c.distance(),this.displacement=s,this.startCentre=t,this.endCentre=n,this.startRadius=r,this.endRadius=i,this.angle=c.angle(),this.midShaft=this.centreDistance/2,this.arcRadius=l,this.dimensions=u,this.startAttach=new Y(r,0).rotate(o),this.endDeflection=a,this.endAttach=new Y(-i,0).rotate(-a).translate(new oe(this.centreDistance,0)),this.startControl=this.startAttach.x*s/this.startAttach.y,this.endControl=this.centreDistance-(this.centreDistance-this.endAttach.x)*s/this.endAttach.y,this.endShaft=new Y(-(i+u.headHeight-u.chinHeight),0).rotate(-a).translate(new oe(this.centreDistance,0));const d=l-l*Math.cos(Math.abs(a));this.drawArcs=this.midShaft-this.startControl>this.arcRadius*Math.tan(Math.abs(o)/2)&&this.endControl-this.midShaft>this.arcRadius*Math.tan(Math.abs(a)/2)&&(s<0?this.endShaft.y-d>s:this.endShaft.y+di.rotate(this.angle).translate(this.startCentre.vectorFromOrigin()));return I0(n.x,n.y,r.x,r.y,t.x,t.y)}draw(t){t.save(),t.translate(this.startCentre.x,this.startCentre.y),t.rotate(this.angle),t.beginPath(),this.path(t),t.lineWidth=this.dimensions.arrowWidth,t.strokeStyle=this.dimensions.arrowColor,t.stroke(),this.dimensions.hasArrowHead&&(t.translate(this.centreDistance,0),t.rotate(-this.endDeflection),t.translate(-this.endRadius,0),t.fillStyle=this.dimensions.arrowColor,Er(t,this.dimensions.headHeight,this.dimensions.chinHeight,this.dimensions.headWidth,!0,!1),t.fill()),t.restore()}drawSelectionIndicator(t){t.save(),t.translate(this.startCentre.x,this.startCentre.y),t.rotate(this.angle),t.beginPath(),this.path(t),t.lineWidth=this.dimensions.arrowWidth+10,t.lineCap="round",t.strokeStyle=this.dimensions.selectionColor,t.stroke(),this.dimensions.hasArrowHead&&(t.translate(this.centreDistance,0),t.rotate(-this.endDeflection),t.translate(-this.endRadius,0),t.lineWidth=10,t.lineJoin="round",Er(t,this.dimensions.headHeight,this.dimensions.chinHeight,this.dimensions.headWidth,!1,!0),t.stroke()),t.restore()}path(t){t.moveTo(this.startAttach.x,this.startAttach.y),t.arcTo(this.startControl,this.displacement,this.midShaft,this.displacement,this.arcRadius),t.arcTo(this.endControl,this.displacement,this.endShaft.x,this.endShaft.y,this.arcRadius),t.lineTo(this.endShaft.x,this.endShaft.y)}midPoint(){return new Y((this.centreDistance+this.startRadius-this.endRadius)/2,this.displacement).rotate(this.angle).translate(this.startCentre.vectorFromOrigin())}shaftAngle(){return this.angle}get arrowKind(){return"straight"}}const DA=e=>cr(e+Math.PI/2),cr=e=>{let t=e;for(;t<-Math.PI;)t+=2*Math.PI;for(;t>Math.PI;)t-=2*Math.PI;return t};class MA{constructor(t,n,r,i,o){const a=n.vectorFrom(t),s=i.vectorFrom(r),l=(s.distance()-o.headHeight+o.chinHeight)/s.distance();this.startCentre=t,this.angle=a.angle(),this.dimensions=o,this.startAttach=r,this.endAttach=i,this.endShaft=r.translate(s.scale(l))}distanceFrom(t){const[n,r]=[this.startAttach,this.endAttach].map(i=>i.rotate(this.angle).translate(this.startCentre.vectorFromOrigin()));return I0(n.x,n.y,r.x,r.y,t.x,t.y)}draw(t){t.save(),t.translate(this.startCentre.x,this.startCentre.y),t.rotate(this.angle),t.beginPath(),t.moveTo(this.startAttach.x,this.startAttach.y),t.lineTo(this.endShaft.x,this.endShaft.y),t.lineWidth=this.dimensions.arrowWidth,t.strokeStyle=this.dimensions.arrowColor,t.stroke(),this.dimensions.hasArrowHead&&(t.translate(this.endAttach.x,this.endAttach.y),t.rotate(this.endAttach.vectorFrom(this.startAttach).angle()),t.fillStyle=this.dimensions.arrowColor,Er(t,this.dimensions.headHeight,this.dimensions.chinHeight,this.dimensions.headWidth,!0,!1),t.fill()),t.restore()}drawSelectionIndicator(t){t.save(),t.translate(this.startCentre.x,this.startCentre.y),t.rotate(this.angle),t.beginPath(),t.moveTo(this.startAttach.x,this.startAttach.y),t.lineTo(this.endShaft.x,this.endShaft.y),t.lineWidth=this.dimensions.arrowWidth+10,t.lineCap="round",t.strokeStyle=this.dimensions.selectionColor,t.stroke(),this.dimensions.hasArrowHead&&(t.translate(this.endAttach.x,this.endAttach.y),t.rotate(this.endAttach.vectorFrom(this.startAttach).angle()),t.lineWidth=10,t.lineJoin="round",Er(t,this.dimensions.headHeight,this.dimensions.chinHeight,this.dimensions.headWidth,!1,!0),t.stroke()),t.restore()}midPoint(){return this.startAttach.translate(this.endShaft.vectorFrom(this.startAttach).scale(.5)).rotate(this.angle).translate(this.startCentre.vectorFromOrigin())}shaftAngle(){return cr(this.angle+this.endAttach.vectorFrom(this.startAttach).angle())}get arrowKind(){return"straight"}}const LA=(e,t,n,r,i)=>{const o=t.vectorFrom(e),a=new Y(n,0),s=new Y(o.distance()-r,0);return new MA(e,t,a,s,i)};class FA{constructor(t,n,r,i,o){this.text=t,this.editing=r,this.padding=i("type-padding"),this.borderWidth=i("type-border-width"),this.fontColor=i("type-color"),this.borderColor=i("type-border-color"),this.backgroundColor=i("type-background-color"),this.selectionColor=Wt(this.editing?qi:Fo,i),this.font={fontWeight:"normal",fontSize:i("type-font-size"),fontFamily:i("font-family")},o.font=this.font;const a=o.measureText(t).width;this.width=a+(this.padding+this.borderWidth)*2,this.height=this.font.fontSize+(this.padding+this.borderWidth)*2;const s=(()=>{switch(n.horizontal){case"start":return 0;case"center":return-this.width/2;case"end":return-this.width}})();this.boxPosition=new Y(s,0)}get type(){return"TYPE"}draw(t){this.text&&(t.save(),t.translate(...this.boxPosition.xy),t.fillStyle=this.backgroundColor,t.strokeStyle=this.borderColor,t.lineWidth=this.borderWidth,t.rect(this.borderWidth/2,this.borderWidth/2,this.width-this.borderWidth,this.height-this.borderWidth,this.padding,!0,this.borderWidth>0),this.editing||(t.textBaseline="middle",t.textAlign="left",t.font=this.font,t.fillStyle=this.fontColor,t.fillText(this.text,this.borderWidth+this.padding,this.height/2)),t.restore())}drawSelectionIndicator(t){this.text&&(t.save(),t.translate(...this.boxPosition.xy),t.strokeStyle=this.selectionColor,t.lineWidth=10,t.rect(this.borderWidth/2,this.borderWidth/2,this.width-this.borderWidth,this.height-this.borderWidth,this.padding,!1,!0),t.restore())}boundingBox(){const t=this.boxPosition.x,n=this.boxPosition.y;return new nt(t,t+this.width,n,n+this.height)}distanceFrom(t){return this.boundingBox().contains(t)?0:1/0}}const c4=(e,t)=>{const n=d4(e,t);return n>=Math.PI/2||n<=-Math.PI/2?n+Math.PI:n},d4=(e,t)=>{switch(e){case"parallel":return t;case"perpendicular":return DA(t);default:return 0}},f4=(e,t,n)=>{if(t==="inline")return{horizontal:"center",vertical:"center"};const r=t==="above",i=n<0?n+Math.PI:n,o=iMath.PI-a,l=e==="perpendicular"||Math.abs(Math.PI/2-i)wr(t.relationship,v)(n),l=s("detail-orientation"),u=s("detail-position");this.componentRotation=c4(l,r.shaftAngle());const c=f4(l,u,r.shaftAngle());this.components=new Va;const f=!!s("relationship-icon-image"),p=!!t.type,y=Object.keys(t.relationship.properties).length>0;f&&this.components.push(this.icon=new kA("relationship-icon-image",c,i,s,a)),p&&this.components.push(this.type=new FA(t.type,c,i,s,o)),y&&this.components.push(this.properties=new _A(t.relationship.properties,c,i,s,o));const g=this.components.maxWidth(),w=this.components.totalHeight(),h=r.dimensions.arrowWidth;switch(l){case"horizontal":const v=r.shaftAngle();this.componentOffset=h4(g,w,h,c,v);break;case"parallel":this.componentOffset=g4(w,h,u);break;case"perpendicular":this.componentOffset=m4(w,h,c);break}}get id(){return this.resolvedRelationship.id}boundingBox(){const t=this.arrow.midPoint();if(this.components.isEmpty())return ux([t]);const r=this.components.boundingBox().corners().map(i=>i.translate(this.componentOffset).rotate(this.componentRotation).translate(t.vectorFromOrigin()));return ux([t,...r])}distanceFrom(t){const r=t.translate(this.arrow.midPoint().vectorFromOrigin().invert()).rotate(-this.componentRotation).translate(this.componentOffset.invert());return Math.min(this.arrow.distanceFrom(t),this.components.distanceFrom(r))}draw(t){this.resolvedRelationship.from.status==="combined"&&this.resolvedRelationship.to.status==="combined"&&this.resolvedRelationship.from.superNodeId===this.resolvedRelationship.to.superNodeId||(t.save("relationship"),this.resolvedRelationship.selected&&(this.arrow.drawSelectionIndicator(t),t.save(),t.translate(...this.arrow.midPoint().xy),t.rotate(this.componentRotation),t.translate(...this.componentOffset.dxdy),this.components.drawSelectionIndicator(t),t.restore()),this.arrow.draw(t),t.save(),t.translate(...this.arrow.midPoint().xy),t.rotate(this.componentRotation),t.translate(...this.componentOffset.dxdy),this.components.draw(t),t.restore(),t.restore())}}const h4=(e,t,n,r,i)=>{if(r.horizontal==="center"&&r.vertical==="center")return new oe(0,-t/2);const o=i<0?i+Math.PI:i,a=n*Math.sin(o),s=n*Math.abs(Math.cos(o));let l,u;l=(()=>{switch(r.horizontal){case"start":return a;case"center":return e/2;default:return-a}})(),u=(()=>{switch(r.vertical){case"top":return s;case"center":return-(t+s);default:return-(t+s)}})();const c=((r.horizontal==="end"?1:-1)*e*Math.cos(i)+(r.vertical==="top"?-1:1)*t*Math.sin(i))/2;return new oe(l,u).plus(new oe(c,0).rotate(i))},g4=(e,t,n)=>{const r=(()=>{switch(n){case"above":return-(e+t);case"inline":return-e/2;case"below":return t}})();return new oe(0,r)},m4=(e,t,n)=>{const r=(()=>{switch(n.horizontal){case"start":return t;case"end":return-t;default:return 0}})();return new oe(r,-e/2)};class HA{constructor(t,n,r,i,o,a,s){this.nodeCentre=t,this.nodeRadius=n,this.angle=r,this.length=o,this.arcRadius=a,this.dimensions=s,this.displacement=i/2,this.deflection=this.displacement*.6/n,this.startAttach=new Y(n,0).rotate(-this.deflection),this.endShaft=new Y(n+s.headHeight-s.chinHeight,0).rotate(this.deflection),this.control=this.startAttach.x*this.displacement/-this.startAttach.y}distanceFrom(t){const n=t.translate(this.nodeCentre.vectorFromOrigin().invert()).rotate(-this.angle),r=new nt(this.nodeRadius,this.length-this.displacement,-(this.displacement+this.dimensions.arrowWidth/2),this.displacement+this.dimensions.arrowWidth/2),i=new Y(this.length-this.displacement,0);return r.contains(n)||i.vectorFrom(n).distance(){if(e.length===0)return{gap:2*Math.PI,start:0};const t=e.slice(0).sort((i,o)=>i-o);let n=0,r;for(let i=0;in&&(n=a-o,r=o)}return{gap:n,start:r}};class Ou{constructor(t,n,r,i){this.waypoints=[],this.start=t,this.position=t,this.startDirection=n,this.direction=n,this.end=r,this.endDirection=i}forwardToWaypoint(t,n,r){this.position=this.position.translate(new oe(t,0).rotate(this.direction)),this.direction=cr(this.direction+n),this.waypoints.push({point:this.position,distance:t,turn:n,radius:r})}get endRelative(){return this.end.translate(this.position.vectorFromOrigin().invert()).rotate(-this.direction)}get endDirectionRelative(){return cr(this.endDirection-this.direction)}get rightAngleTowardsEnd(){return this.endRelative.y<0?-Math.PI/2:Math.PI/2}segment(t){const n=t===0?this.start:this.waypoints[t-1].point,r=t=0;n--){const r=this.waypoints[n];t.forwardToWaypoint(r.point.vectorFrom(t.position).distance(),-r.turn,r.radius)}return t}draw(t){t.moveTo(...this.start.xy);let n=this.start;for(let r=0;r{if(e.length===0&&t.length===0)return 0;if(e.length===0)return-Math.sign(t[0].turn);if(t.length===0)return Math.sign(e[0].turn);const n=e[0],r=t[0];return n.turn!==r.turn?Math.sign(n.turn-r.turn):Math.abs(n.distance-r.distance)>1e-4?Math.sin(e[0].turn)*Math.sign(r.distance-n.distance):jA(e.slice(1),t.slice(1))};class GA{constructor(t,n,r,i,o,a,s){this.dimensions=s;const l=o&&o.attachment.name!=="normal"?"start":"end",u=l==="start"?o:a,c=40+u.radiusOrdinal*10,d=l==="start"?t:n,f=l==="end"?t:n,p=l==="start"?r:i+s.headHeight-s.chinHeight,y=l==="start"?r+o.minNormalDistance:i+Math.max(a.minNormalDistance,s.headHeight-s.chinHeight),g=l==="end"?r:i+s.headHeight-s.chinHeight,w=u.attachment.angle,h=(u.ordinal-(u.total-1)/2)*10,v=d.translate(new oe(p,h).rotate(w)),m=d.translate(new oe(y,h).rotate(w)),b=f.translate(m.vectorFromOrigin().invert()).rotate(-w),x=new Y(0,b.y<0?-c:c),C=b.vectorFrom(x),O=Math.asin(c/C.distance())+Math.abs(C.angle()),N=c*Math.tan(O/2),D=v.translate(new oe(N,0).rotate(w)).vectorFrom(f).angle(),L=f.translate(new oe(g,0).rotate(D)),B=new Ou(v,w,L,cr(D+Math.PI));B.forwardToWaypoint(N+y-p,Math.sign(B.endDirectionRelative)*O,c);const q=B.segment(1);this.midShaft=q.from.translate(q.to.vectorFrom(q.from).scale(.5)),this.midShaftAngle=q.from.vectorFrom(q.to).angle(),l==="start"&&(this.midShaftAngle=cr(this.midShaftAngle+Math.PI)),this.path=l==="start"?B:B.inverse()}distanceFrom(t){return this.path.distanceFrom(t)}draw(t){t.save(),t.beginPath(),this.path.draw(t),t.lineWidth=this.dimensions.arrowWidth,t.strokeStyle=this.dimensions.arrowColor,t.stroke(),this.dimensions.hasArrowHead&&(t.translate(...this.path.end.xy),t.rotate(this.path.endDirection),t.translate(this.dimensions.headHeight-this.dimensions.chinHeight,0),t.fillStyle=this.dimensions.arrowColor,Er(t,this.dimensions.headHeight,this.dimensions.chinHeight,this.dimensions.headWidth,!0,!1),t.fill()),t.restore()}drawSelectionIndicator(t){t.save(),t.beginPath(),this.path.draw(t),t.lineWidth=this.dimensions.arrowWidth+10,t.lineCap="round",t.strokeStyle=this.dimensions.selectionColor,t.stroke(),this.dimensions.hasArrowHead&&(t.translate(...this.path.end.xy),t.rotate(this.path.endDirection),t.translate(this.dimensions.headHeight-this.dimensions.chinHeight,0),t.lineWidth=10,t.lineJoin="round",Er(t,this.dimensions.headHeight,this.dimensions.chinHeight,this.dimensions.headWidth,!1,!0),t.stroke()),t.restore()}midPoint(){return this.midShaft}shaftAngle(){return this.midShaftAngle}get arrowKind(){return"straight"}}class BA{constructor(t,n,r,i,o,a,s){this.dimensions=s;const l=o.total>a.total?fx(o):fx(a),u=o.attachment.angle,c=a.attachment.angle,d=(o.ordinal-(o.total-1)/2)*10,f=(a.ordinal-(a.total-1)/2)*10,p=i+this.dimensions.headHeight-this.dimensions.chinHeight,y=t.translate(new oe(r,d).rotate(u)),g=n.translate(new oe(i,f).rotate(c));this.endShaft=n.translate(new oe(p,f).rotate(c));const w=l+o.minNormalDistance,h=l+a.minNormalDistance-(this.dimensions.headHeight-this.dimensions.chinHeight),v=o.total>a.total;this.shaft=new Ou(y,u,this.endShaft,cr(c+Math.PI));let m;switch(Math.abs(Math.round(this.shaft.endDirectionRelative*180/Math.PI))){case 0:if(this.shaft.endRelative.x>0)if(this.shaft.endRelative.y===0)m=0;else{const C=this.shaft.endRelative.x0?(this.shaft.endDirectionRelative*this.shaft.endRelative.y<0&&(this.shaft.forwardToWaypoint(this.shaft.endRelative.x-i-l,this.shaft.rightAngleTowardsEnd,l),this.shaft.forwardToWaypoint(this.shaft.endRelative.x+l,this.shaft.rightAngleTowardsEnd,l)),this.shaft.forwardToWaypoint(this.shaft.endRelative.x,this.shaft.rightAngleTowardsEnd,l),m=0):(m=Math.abs(this.shaft.endRelative.x)>Math.abs(this.shaft.endRelative.y)?1:2,this.shaft.forwardToWaypoint(Math.max(w,l*2+this.shaft.endRelative.x),this.shaft.rightAngleTowardsEnd,l),this.shaft.forwardToWaypoint(Math.max(this.shaft.endRelative.x+l,l*2),this.shaft.rightAngleTowardsEnd,l),this.shaft.forwardToWaypoint(this.shaft.endRelative.x,this.shaft.rightAngleTowardsEnd,l));break;default:if(Math.abs(this.shaft.endRelative.y)>l*2){const C=Math.max(l,this.shaft.endRelative.x+l);this.shaft.forwardToWaypoint(C,this.shaft.rightAngleTowardsEnd,l),this.shaft.forwardToWaypoint(this.shaft.endRelative.x,this.shaft.rightAngleTowardsEnd,l),m=1}else this.shaft.forwardToWaypoint(l,this.shaft.rightAngleTowardsEnd,l),this.shaft.forwardToWaypoint(l+r,this.shaft.rightAngleTowardsEnd,l),this.shaft.forwardToWaypoint(this.shaft.endRelative.x-l,this.shaft.rightAngleTowardsEnd,l),this.shaft.forwardToWaypoint(this.shaft.endRelative.x,this.shaft.rightAngleTowardsEnd,l),m=3}this.path=this.shaft.changeEnd(g);const x=this.shaft.segment(m);this.midShaft=x.from.translate(x.to.vectorFrom(x.from).scale(.5)),this.midShaftAngle=x.from.vectorFrom(x.to).angle()}distanceFrom(t){return this.path.distanceFrom(t)}draw(t){t.save(),t.beginPath(),this.shaft.draw(t),t.lineWidth=this.dimensions.arrowWidth,t.strokeStyle=this.dimensions.arrowColor,t.stroke(),this.dimensions.hasArrowHead&&(t.translate(...this.endShaft.xy),t.rotate(this.shaft.endDirection),t.translate(this.dimensions.headHeight-this.dimensions.chinHeight,0),t.fillStyle=this.dimensions.arrowColor,Er(t,this.dimensions.headHeight,this.dimensions.chinHeight,this.dimensions.headWidth,!0,!1),t.fill()),t.restore()}drawSelectionIndicator(t){t.save(),t.beginPath(),this.shaft.draw(t),t.lineWidth=this.dimensions.arrowWidth+10,t.lineCap="round",t.strokeStyle=this.dimensions.selectionColor,t.stroke(),this.dimensions.hasArrowHead&&(t.translate(...this.endShaft.xy),t.rotate(this.shaft.endDirection),t.translate(this.dimensions.headHeight-this.dimensions.chinHeight,0),t.lineWidth=10,t.lineJoin="round",Er(t,this.dimensions.headHeight,this.dimensions.chinHeight,this.dimensions.headWidth,!1,!0),t.stroke()),t.restore()}midPoint(){return this.midShaft}shaftAngle(){return this.midShaftAngle}get arrowKind(){return"straight"}}const fx=e=>40+e.radiusOrdinal*10,Ov=(e,t,n)=>{const r=w=>wr(e.relationship,w)(t),i=e.from.radius+r("margin-start"),o=e.to.radius+r("margin-end"),a=r("arrow-width"),s=r("arrow-color"),l=Wt(Fo,r);let u=!1,c=0,d=0,f=0;r("directionality")==="directed"&&(u=!0,c=a+6*Math.sqrt(a),d=c*1.5,f=d/10);const y=r("margin-peer"),g=e.from===n;return{startRadius:i,endRadius:o,arrowWidth:a,arrowColor:s,selectionColor:l,hasArrowHead:u,headWidth:c,headHeight:d,chinHeight:f,separation:y,leftToRight:g}};class y4{constructor(t,n,r,i,o){const a=[],s=t[0].from,l=t[0].to,u=t.map(g=>Ov(g,n,s)),c=Math.max(...u.map(g=>g.leftToRight?g.startRadius:g.endRadius)),d=Math.max(...u.map(g=>g.leftToRight?g.endRadius:g.startRadius)),f=Math.max(...u.map(g=>g.leftToRight?0:g.headHeight)),p=Math.max(...u.map(g=>g.leftToRight?g.headHeight:0)),y=Math.max(...u.map(g=>g.separation));if(t[0].startAttachment||t[0].endAttachment)if(t[0].startAttachment&&t[0].endAttachment){console.log("recti");for(let g=0;gm.vectorFrom(g.position).angle()),h=v4(w),v=h.gap/(t.length+Math.sign(w.length));for(let m=0;mh&&(v=h*c/(y*(t.length-1))),(c+f)*Math.sin(v*-g/c)>-g&&(v=Math.asin(g/(c+f))*c/g);let m=.6;y*(t.length-1)*m/d>h&&(m=h*d/(y*(t.length-1))),(d+p)*Math.sin(m*-g/d)>-g&&(m=Math.asin(g/(d+p))*d/g);let b=!0;for(let x=0;xt.boundingBox()))}draw(t){this.routedRelationships.forEach(n=>{n.draw(t)})}}class D0{constructor(t){this.ctx=t}save(){this.ctx.save()}restore(){this.ctx.restore()}translate(t,n){this.ctx.translate(t,n)}scale(t){this.ctx.scale(t,t)}rotate(t){this.ctx.rotate(t)}beginPath(){this.ctx.beginPath()}closePath(){this.ctx.closePath()}moveTo(t,n){this.ctx.moveTo(t,n)}lineTo(t,n){this.ctx.lineTo(t,n)}arcTo(t,n,r,i,o){this.ctx.arcTo(t,n,r,i,o)}arc(t,n,r,i,o,a){this.ctx.arc(t,n,r,i,o,a)}circle(t,n,r,i,o){this.ctx.beginPath(),this.ctx.arc(t,n,r,0,Math.PI*2,!1),this.ctx.closePath(),i&&this.ctx.fill(),o&&this.ctx.stroke()}rect(t,n,r,i,o,a,s){this.ctx.beginPath(),this.ctx.moveTo(t,n+o),this.ctx.arc(t+o,n+o,o,-Math.PI,-Math.PI/2),this.ctx.lineTo(t+r-o,n),this.ctx.arc(t+r-o,n+o,o,-Math.PI/2,0),this.ctx.lineTo(t+r,n+i-o),this.ctx.arc(t+r-o,n+i-o,o,0,Math.PI/2),this.ctx.lineTo(t+o,n+i),this.ctx.arc(t+o,n+i-o,o,Math.PI/2,Math.PI),this.ctx.closePath(),a&&this.ctx.fill(),s&&this.ctx.stroke()}image(t,n,r,i,o){try{this.ctx.drawImage(t.image,n,r,i,o)}catch(a){console.error(a)}}imageInCircle(t,n,r,i){const o=t.width/t.height,{width:a,height:s}=t.width>t.height?{width:2*i*o,height:2*i}:{width:2*i,height:2*i/o};this.ctx.save();try{this.ctx.beginPath(),this.ctx.arc(n,r,i,0,Math.PI*2),this.ctx.clip(),this.ctx.drawImage(t.image,n-a/2,r-s/2,a,s)}catch(l){console.error(l)}finally{this.ctx.restore()}}polyLine(t){if(this.ctx.beginPath(),t.length>0){const n=t[0];this.ctx.moveTo(n.x,n.y)}for(let n=1;n0){const i=t[0];this.ctx.moveTo(i.x,i.y)}for(let i=1;i{const n={},r=(s,l)=>{const u=n[s]||(n[s]={});u[l]=(u[l]||0)+1};e.relationships.forEach(s=>{const l=u=>wr(s,u)(e);r(s.fromId,l("attachment-start")),r(s.toId,l("attachment-end"))});const i=(s,l)=>{const u=n[s][l];return{attachment:w4(l),ordinal:(u-1)/2,radiusOrdinal:0,minNormalDistance:0,total:u}},o=e.relationships.map(s=>{const l=p=>wr(s,p)(e),u=i(s.fromId,l("attachment-start")),c=i(s.toId,l("attachment-end")),d=new $A(s,t[s.fromId],t[s.toId],u,c,!1,e);let f;if(u.attachment.name!=="normal"||c.attachment.name!=="normal")if(u.attachment.name!=="normal"&&c.attachment.name!=="normal"){const p=Ov(d,e,d.from);f=new BA(d.from.position,d.to.position,p.startRadius,p.endRadius,d.startAttachment,d.endAttachment,p)}else{const p=Ov(d,e,d.from);f=new GA(d.from.position,d.to.position,p.startRadius,p.endRadius,d.startAttachment,d.endAttachment,p)}return{resolvedRelationship:d,arrow:f}}),a={start:{},end:{}};return e.nodes.forEach(s=>{const l=o.filter(u=>s.id===u.resolvedRelationship.from.id||s.id===u.resolvedRelationship.to.id);zA.forEach(u=>{const d=l.filter(p=>{const y=p.resolvedRelationship.startAttachment,g=p.resolvedRelationship.endAttachment;return y.attachment===u&&s.id===p.resolvedRelationship.from.id||g.attachment===u&&s.id===p.resolvedRelationship.to.id}).map(p=>{const y=p.resolvedRelationship.from.id===s.id&&p.resolvedRelationship.startAttachment.attachment===u?"start":"end";let g,w=0;if(p.arrow){if(y==="end"){const h=p.arrow.dimensions;w=h.headHeight-h.chinHeight}p.arrow.path&&p.arrow.path.waypoints&&(y==="start"?g=p.arrow.path:g=p.arrow.path.inverse())}return{relationship:p.resolvedRelationship.relationship,direction:y,path:g,headSpace:w}}),f=Math.max(...d.map(p=>p.headSpace));d.sort((p,y)=>p.path&&y.path?jA(p.path.waypoints,y.path.waypoints):0),d.forEach((p,y)=>{a[p.direction][p.relationship.id]={attachment:u,ordinal:y,radiusOrdinal:E4(p.path,y,d.length),minNormalDistance:f,total:d.length}})})}),a},w4=e=>zA.find(t=>t.name===e)||{name:"normal"},E4=(e,t,n)=>{if(e)switch(e.polarity){case-1:return t;case 1:return n-t-1;default:return Math.max(t,n-t-1)}return 0};class x4{constructor(t,n){const r=t["background-image"];if(r){const i=parseFloat(t["background-size"])/100;this.imageInfo=$0(n,r),this.width=this.imageInfo.width*i,this.height=this.imageInfo.height*i}}draw(t,n){if(this.imageInfo){t.save();const r=n.viewTransformation;t.translate(r.offset.dx,r.offset.dy),t.scale(r.scale),t.image(this.imageInfo,-this.width/2,-this.height/2,this.width,this.height),t.restore()}}}const M0=e=>e.selection,S4=e=>e.mouse,C4=e=>e.viewTransformation,UA=e=>e.cachedImages,Re=e=>e.graph.present||e.graph,WA=e=>{const{layers:t}=e.applicationLayout||{};return t&&t.length>0?t.reduce((n,r)=>r.selector?r.selector({graph:n,[r.name]:e[r.name]}):n,Re(e)):Re(e)},Ka=(()=>{const e=window.document.createElement("canvas");return new D0(e.getContext("2d"))})(),T4=(()=>TA((t,n,r,i)=>new e4(t,n,tn(r,t.id),r4(r,t.id),Ka,i),{max:1e4}))(),Ot=ac([WA,M0,UA],(e,t,n)=>{const r=e.nodes.reduce((s,l)=>(s[l.id]=T4(l,e,t,n),s),{}),i=b4(e,r),o=e.relationships.map(s=>new $A(s,r[s.fromId],r[s.toId],i.start[s.id],i.end[s.id],pi(t,s.id),e)),a=l4(o).map(s=>new y4(s,e,t,Ka,n));return new t4(e,r,a,Ka)}),VA=ac([WA,UA],(e,t)=>new x4(e.style,t)),KA=ac([Ot,M0,S4,C4],(e,t,n,r)=>new a4(e,t,n,r)),Av=ac([Ot,M0],(e,t)=>{const n=[];return dt(t).forEach(r=>{const i=e.nodes[r];n.push({nodeId:i.id,position:i.position,radius:i.radius})}),n}),qA=e=>({type:"ACTIVATE_EDITING",editing:e}),P4=()=>function(e,t){const n=t().selection;n.editing===void 0&&n.entities.length>0&&e(qA(n.entities[n.entities.length-1]))},O4=()=>({type:"DEACTIVATE_EDITING"}),Ur=(e,t)=>({type:"TOGGLE_SELECTION",entities:e.map(n=>({entityType:n.entityType,id:n.id})),mode:t}),A4=()=>function(e,t){const n=Re(t());e(Ur([...n.nodes.map(r=>({id:r.id,entityType:"node"})),...n.relationships.map(r=>({id:r.id,entityType:"relationship"}))],"replace"))},_4=()=>({type:"CLEAR_SELECTION"}),I4=(e,t)=>function(n,r){const i=r(),o=Re(i),a=r().selection,s=dt(a),l=s[s.length-1];if(l){const u=o.nodes.find(d=>d.id===l),c=N4(u,o.nodes,e);c&&(t.shiftKey===!0?tn(a,c.id)?n(Ur([{...u,entityType:"node"}],"xor")):n(Ur([{...c,entityType:"node"}],"or")):n(Ur([{...c,entityType:"node"}],"replace")))}},N4=(e,t,n)=>{const i={LEFT:-Math.PI,UP:-Math.PI/2,RIGHT:0,DOWN:Math.PI/2}[n];return t.filter(o=>o.id!==e.id).map(o=>({node:o,vector:o.position.vectorFrom(e.position)})).filter(o=>{const a=o.vector.angle();return a>i-Math.PI/4&&ai+Math.PI*7/4&&ao.vector.distance()-a.vector.distance()).map(o=>o.node)[0]},eu=(e,t,n)=>({type:"ADJUST_VIEWPORT",scale:e,panX:t,panY:n}),px=(e,t,n)=>{const r=e.closestNode(n,(i,o)=>!pt(i.id,t)&&o({type:"ACTIVATE_RING",sourceNodeId:e,nodeType:t}),k4=()=>({type:"DEACTIVATE_RING"}),$4=(e,t)=>function(n,r){const i=r(),o=i.selection,a=dt(o),s=a.includes(e)?a.filter(p=>p!==e):[],l=Ot(i);let u=l.graph.style.radius;const c=l.graph,d=c.nodes.find(p=>pt(p.id,e)),f=px(l,null,t);if(f.snapped){const p=s.map(g=>{const h=c.nodes.find(v=>pt(v.id,g)).position.vectorFrom(d.position);return px(l,null,t.translate(h))}),y=[f.snappedNodeId,...p.every(g=>g.snapped)?p.map(g=>g.snappedNodeId):p.map(()=>f.snappedNodeId)];n(D4(e,s,y,f.snappedPosition,t))}else{const p=sA(c,[d],()=>!0,t);p.snapped?n(hx(e,s,p.snappedPosition,new Qr(p.guidelines,t,u),t)):n(hx(e,s,t,new Qr,t))}},hx=(e,t,n,r,i)=>({type:"RING_DRAGGED",sourceNodeId:e,secondarySourceNodeIds:t,targetNodeIds:[],position:n,guides:r,newMousePosition:i}),D4=(e,t,n,r,i)=>({type:"RING_DRAGGED",sourceNodeId:e,secondarySourceNodeIds:t,targetNodeIds:n,position:r,guides:new Qr,newMousePosition:i}),M4=(e,t)=>({type:"SET_MARQUEE",marquee:{from:e,to:t},newMousePosition:t}),L4=()=>function(e,t){const n=t(),r=n.gestures.selectionMarquee;if(r){const i=Ot(n),o=F4(r),a=i.entitiesInBoundingBox(o);a.length>0&&e(Ur(a,"or"))}},F4=({from:e,to:t})=>new nt(Math.min(e.x,t.x),Math.max(e.x,t.x),Math.min(e.y,t.y),Math.max(e.y,t.y)),YA=(e,t)=>e.applicationLayout.layers.reduce((n,r)=>{const i=r.eventHandlers[t];return i?n.concat([i]):n},[]),H4=40,QA=30,XA=425,It=50,Ip=e=>{const{windowSize:t,inspectorVisible:n}=e;return{width:t.width-(n?XA:0),height:t.height-H4-QA-2}},j4=e=>({width:e.width-It*2,height:e.height-It*2}),Np=(e,t)=>e.viewTransformation.inverse(t),G4=(e,t,n)=>function(r,i){const o=i(),a=Ot(o).boundingBox(),s=o.viewTransformation.scale,l=j4(Ip(o.applicationLayout));if(n){const u=Np(o,e),c=l.width/a.width,d=l.height/a.height,f=Math.min(1,c,d),p=Math.max(s*(100-t.dy)/100,f),y=e.vectorFrom(u.scale(p)),g=gx(a,p,y,l),h=p<=d&&p<=c&&t.dy>0?B4(f,g,a,l):g;r(eu(p,h.dx,h.dy))}else{const u=o.viewTransformation.offset.plus(t.scale(s).invert()),c=gx(a,s,u,l);r(eu(s,c.dx,c.dy))}},B4=(e,t,n,r)=>{const i=[{component:"dx",min:"left",max:"right",extent:"width"},{component:"dy",min:"top",max:"bottom",extent:"height"}],[o,a]=i.map(s=>{const l=t[s.component],c=It+r[s.extent]/2-(n[s.max]+n[s.min])*e/2-l;return Math.abs(c)>1?l+c*.1:l});return new oe(o,a)},gx=(e,t,n,r)=>{const i=new oe(n.dx,n.dy),o=[{component:"dx",min:"left",max:"right",extent:"width"},{component:"dy",min:"top",max:"bottom",extent:"height"}],a=(s,l)=>s?!l:l;return o.forEach(s=>{const l=e[s.extent]*t>r[s.extent],u=e[s.min]*t+n[s.component];a(l,uIt+r[s.extent])&&(i[s.component]=It+r[s.extent]-e[s.max]*t)}),i},z4=e=>function(t,n){const r=n(),i=Ot(r),o=Np(r,e),a=i.entityAtPoint(o);a&&t(qA(a))},U4=(e,t)=>function(n,r){const i=r(),o=Ot(i),a=KA(i),s=Np(i,e),l=a.handleAtPoint(e);if(l)n(W4(l.corner,e,Av(i)));else{const u=o.entityAtPoint(s);if(u)switch(u.entityType){case"node":n(Ur([u],t?"xor":"at-least")),n(K4(u,e,s));break;case"relationship":n(Ur([u],t?"xor":"at-least"));break;case"nodeRing":n(q4(u,e));break}else t||n(_4()),n(Y4(e,s))}},W4=(e,t,n)=>({type:"MOUSE_DOWN_ON_HANDLE",corner:e,canvasPosition:t,nodePositions:n}),V4=e=>({type:"LOCK_HANDLE_DRAG_MODE",dragType:e}),K4=(e,t,n)=>({type:"MOUSE_DOWN_ON_NODE",node:e,position:t,graphPosition:n}),q4=(e,t)=>({type:"MOUSE_DOWN_ON_NODE_RING",node:e,position:t}),Y4=(e,t)=>({type:"MOUSE_DOWN_ON_CANVAS",canvasPosition:e,graphPosition:t}),mx=(e,t)=>t.vectorFrom(e).distance()>=3,Q4=e=>function(t,n){const r=n(),i=Ot(r),o=Np(r,e),a=r.gestures.dragToCreate,s=r.mouse,l=s.mousePosition;if(!YA(r,"mouseMove").reduce((d,f)=>f({mouse:s,dispatch:t})||d,!1))switch(s.dragType){case"NONE":const d=i.entityAtPoint(o);d&&d.entityType==="nodeRing"?(a.sourceNodeId===null||a.sourceNodeId&&d.id!==a.sourceNodeId)&&t(R4(d.id,d.type)):a.sourceNodeId!==null&&t(k4());break;case"HANDLE":case"HANDLE_ROTATE":case"HANDLE_SCALE":(s.dragged||mx(l,e))&&t(t5({dragType:s.dragType,corner:s.corner,initialNodePositions:s.initialNodePositions,initialMousePosition:s.initialMousePosition,newMousePosition:e}));break;case"NODE":(s.dragged||mx(l,e))&&t(ZA({nodeId:s.node.id,oldMousePosition:l,newMousePosition:e}));break;case"NODE_RING":t($4(s.node.id,o));break;case"CANVAS":case"MARQUEE":t(M4(s.mouseDownPosition,o));break}},X4=()=>function(e,t){const n=t(),r=n.mouse,i=Re(n);if(!YA(n,"mouseUp").reduce((s,l)=>l({state:n,dispatch:e})||s,!1))switch(r.dragType){case"MARQUEE":e(L4());break;case"HANDLE":e(yx(Av(n)));break;case"NODE":e(yx(Av(n)));break;case"NODE_RING":const s=n.gestures.dragToCreate;if(s.sourceNodeId){if(s.targetNodeIds.length>0)e(e5([s.sourceNodeId,...s.secondarySourceNodeIds],s.targetNodeIds));else if(s.newNodePosition){const l=i.nodes.find(c=>c.id===s.sourceNodeId).position,u=s.newNodePosition.vectorFrom(l);e(Z4([s.sourceNodeId,...s.secondarySourceNodeIds],u))}}break}e(JA())},JA=()=>({type:"END_DRAG"});class vx{constructor(t){this.handlePosition=t}get type(){return"HANDLE"}}const J4=()=>(e,t)=>{let n=new Y(0,0);const r=Re(t());if(r.nodes.length>0){const i=["x","y"].map(o=>{const a=r.nodes.map(c=>c.position[o]),s=Math.min(...a),l=Math.max(...a),u=l-s;return{dimension:o,min:s,max:l,spread:u}}).sort((o,a)=>a.spread-o.spread);n[i[0].dimension]=i[0].min,n[i[1].dimension]=i[1].max+qM+XO*2}e({category:"GRAPH",type:"CREATE_NODE",newNodeId:Yr(Re(t()).nodes),newNodePosition:n,caption:"",style:{}})},Z4=(e,t)=>(n,r)=>{const i=Re(r()),o=[],a=[];let s=Yr(i.relationships),l=Yr(i.nodes);const u=[];e.forEach(c=>{o.push(s),a.push(l),s=Po(s),l=Po(l);const d=i.nodes.find(f=>f.id===c).position;u.push(d.translate(t))}),n({category:"GRAPH",type:"CREATE_NODES_AND_RELATIONSHIPS",sourceNodeIds:e,newRelationshipIds:o,targetNodeIds:a,targetNodePositions:u,caption:"",style:{}})},e5=(e,t)=>(n,r)=>{const i=Re(r()),o=[];let a=Yr(i.relationships);e.forEach(()=>{o.push(a),a=Po(a)}),n({category:"GRAPH",type:"CONNECT_NODES",sourceNodeIds:e,newRelationshipIds:o,targetNodeIds:t})},t5=({dragType:e,corner:t,initialNodePositions:n,initialMousePosition:r,newMousePosition:i})=>{function o(s,l,u,c){const d=Math.max(...n.map(m=>m.radius))*2,f=["x","y"],p={},y=(m,b,x,C)=>{switch(m){case"min":return b;case"max":return x;default:return C}};f.forEach(m=>{const b=n.map(N=>N.position[m]),x=Math.min(...b),C=Math.max(...b),P=C-x;let O=y(t[m],P-s["d"+m],P+s["d"+m],P);O<0&&(O<-d?O+=d:O=0),p[m]={min:x,max:C,oldSpread:P,newSpread:O}});const g=[-1,1];if(t.x!=="mid"&&t.y!=="mid"){let m=Math.max(...f.map(x=>{const C=p[x];return C.newSpread/C.oldSpread})),b=Math.min(...f.map(x=>p[x].oldSpread));g.forEach(x=>{Math.abs(m-x)*b{const C=p[x];C.newSpread=C.oldSpread*m})}else f.forEach(m=>{const b=p[m];let x=b.newSpread/b.oldSpread;g.forEach(C=>{Math.abs(x-C)*b.oldSpread{const x=m[b],C=p[b];switch(t[b]){case"min":return C.max-(C.max-x)*C.newSpread/C.oldSpread;case"max":return C.min+(x-C.min)*C.newSpread/C.oldSpread;default:return x}},h=n.map(m=>({nodeId:m.nodeId,position:new Y(w(m.position,"x"),w(m.position,"y"))})),v=[];v.push(new vx(l.inverse(i))),f.forEach(m=>{if(t[m]!=="mid"){const b=p[m],x={};x.type=m==="x"?"VERTICAL":"HORIZONTAL",x[m]=t[m]==="min"?b.max:b.min,v.push(x)}}),u(_v(r,i||c.mousePosition,h,new Qr(v)))}function a(s,l,u){const c=Sf(n.map(x=>x.position)),d=s.inverse(r).vectorFrom(c),f=d.distance(),p=[];p.push(new aA(c,f,i));const y=d.angle();let g=s.inverse(i).vectorFrom(c).angle(),w=g-y;const h=Math.round(w/Sv)*Sv;Math.abs(w-h)({nodeId:x.nodeId,position:c.translate(x.position.vectorFrom(c).rotate(w))})),b=new Qr(p);l(_v(r,i||u.mousePosition,m,b))}return function(s,l){const{viewTransformation:u,mouse:c}=l(),d=i.vectorFrom(r).scale(1/u.scale);let f=e;if(f==="HANDLE"){const p=Sf(n.map(g=>g.position)),y=u.inverse(r).vectorFrom(p);Math.abs(y.unit().dot(d.unit()))<.5?f="HANDLE_ROTATE":f="HANDLE_SCALE",d.distance()>20&&s(V4(f))}switch(f){case"HANDLE_ROTATE":a(u,s,c);break;case"HANDLE_SCALE":o(d,u,s,c);break}}},ZA=({nodeId:e,oldMousePosition:t,newMousePosition:n,forcedNodePosition:r})=>function(i,o){const a=o(),{viewTransformation:s,mouse:l}=a,u=Ot(a),c=u.graph,d=u.nodes[e];let f;const p=dt(a.selection).filter(b=>b!==e),y=c.nodes.find(b=>pt(b.id,e));if(r)f=r;else{const b=n.vectorFrom(t).scale(1/s.scale);f=(o().guides.naturalPosition||y.position).translate(b)}let g=NL(c,e,f,p),w=new Qr,h=f;g.snapped&&(w=new Qr(g.guidelines,f,d.radius),h=g.snappedPosition);const v=h.vectorFrom(y.position),m=[{nodeId:e,position:h}];p.forEach(b=>{m.push({nodeId:b,position:c.nodes.find(x=>pt(x.id,b)).position.translate(v)})}),i(_v(t,n||l.mousePosition,m,w))},_v=(e,t,n,r,i)=>({category:"GRAPH",type:"MOVE_NODES",oldMousePosition:e,newMousePosition:t,nodePositions:n,guides:r,autoGenerated:i}),yx=e=>({category:"GRAPH",type:"MOVE_NODES_END_DRAG",nodePositions:e}),Rp=(e,t)=>({category:"GRAPH",type:"SET_NODE_CAPTION",selection:e,caption:t}),e_=(e,t)=>({category:"GRAPH",type:"ADD_LABEL",selection:e,label:t}),n5=e=>({category:"GRAPH",type:"ADD_LABELS",nodeLabels:e}),t_=(e,t,n)=>({category:"GRAPH",type:"RENAME_LABEL",selection:e,oldLabel:t,newLabel:n}),n_=(e,t)=>({category:"GRAPH",type:"REMOVE_LABEL",selection:e,label:t}),r5=(e,t)=>function(n,r){const i=r(),o=Re(i),a=zo(o,e).reduce((s,l)=>{const u=l.properties[t];let c=s.find(d=>d.propertyValue===u);return c?(c.purgedNodeIds.push(l.id),c.positions.push(l.position)):(c={propertyValue:u,survivingNodeId:l.id,purgedNodeIds:[],positions:[l.position]},s.push(c)),s},[]);for(const s of a)s.position=Sf(s.positions);n({category:"GRAPH",type:"MERGE_NODES",mergeSpecs:a})},i5=e=>function(t,n){const r=n(),i=Re(r),o=zo(i,e);if(o.length<1)return;const a={survivingNodeId:o[0].id,purgedNodeIds:o.slice(1).map(s=>s.id),position:Sf(o.map(s=>s.position))};t({category:"GRAPH",type:"MERGE_NODES",mergeSpecs:[a]})},r_=(e,t,n)=>({category:"GRAPH",type:"RENAME_PROPERTY",selection:e,oldPropertyKey:t,newPropertyKey:n}),i_=(e,t,n)=>({category:"GRAPH",type:"SET_PROPERTY",selection:e,key:t,value:n}),o5=(e,t)=>({category:"GRAPH",type:"SET_PROPERTY_VALUES",key:e,nodePropertyValues:t}),Iv=(e,t,n)=>({category:"GRAPH",type:"SET_ARROWS_PROPERTY",selection:e,key:t,value:n}),a5=(e,t)=>({category:"GRAPH",type:"REMOVE_PROPERTY",selection:e,key:t}),s5=(e,t)=>({category:"GRAPH",type:"REMOVE_ARROWS_PROPERTY",selection:e,key:t}),Nv=(e,t)=>({category:"GRAPH",type:"SET_GRAPH_STYLE",key:e,value:t}),l5=e=>({category:"GRAPH",type:"SET_GRAPH_STYLES",style:e}),o_=(e,t)=>({category:"GRAPH",type:"SET_RELATIONSHIP_TYPE",selection:e,relationshipType:t}),u5=(e,t)=>({category:"GRAPH",type:"DUPLICATE_NODES_AND_RELATIONSHIPS",nodeIdMap:e,relationshipIdMap:t}),c5=(e,t)=>({category:"GRAPH",type:"DELETE_NODES_AND_RELATIONSHIPS",nodeIdMap:e,relationshipIdMap:t}),a_=()=>function(e,t){const n=t().selection,r=Re(t()).relationships,i=n4(n),o=i4(n);r.forEach(a=>{!o[a.id]&&(i[a.fromId]||i[a.toId])&&(o[a.id]=!0)}),e(c5(i,o))},d5=(e,t,n)=>{const r=RL(t,e,1),i=new oe(r.right-r.left,r.bottom-r.top);if(n.lastDuplicateAction){const o=n.lastDuplicateAction,a=Object.keys(o.nodeIdMap)[0];if(a){const s=o.nodeIdMap[a].oldNodeId,l=e.nodes.find(c=>pt(c.id,s)),u=e.nodes.find(c=>pt(c.id,a));if(l&&u){const c=u.position.vectorFrom(l.position);if(c.dx>i.dx||c.dy>i.dy)return c}}}return i},f5=e=>{if(e.lastDuplicateAction){const t=e.lastDuplicateAction,n={};for(const[r,i]of Object.entries(t.nodeIdMap))n[i.oldNodeId]=r;return n}return{}},s_=()=>function(e,t){const n=t(),r=n.selection,i=Re(n),o=n.actionMemos,a=zo(i,r),s={},l={},u={};if(a.length>0){const p=d5(i,a,o);let y=Yr(i.nodes);a.forEach(g=>{s[y]={oldNodeId:g.id,position:g.position.translate(p)},l[g.id]=y,y=Po(y)}),i.relationships.forEach(g=>{(tn(r,g.fromId)||tn(r,g.toId))&&(u[g.id]=!0)})}xn(r).forEach(p=>{u[p]=!0});const c=f5(o),d={};let f=Yr(i.relationships);Object.keys(u).forEach(p=>{const y=i.relationships.find(g=>pt(p,g.id));d[f]={oldRelationshipId:p,relationshipType:y.type,fromId:l[y.fromId]||c[y.fromId]||y.fromId,toId:l[y.toId]||c[y.toId]||y.toId},f=Po(f)}),e(u5(s,d))},p5=e=>({category:"GRAPH",type:"REVERSE_RELATIONSHIPS",selection:e}),h5=e=>function(t,n){const r=n(),i=Re(r),o=sc(i,e).map(a=>{const s=i.nodes.find(l=>l.id===a.toId);return{addPropertiesNodeId:a.fromId,labels:s.labels,properties:s.properties,removeNodeId:a.toId}});t({category:"GRAPH",type:"INLINE_RELATIONSHIPS",relationshipSpecs:o})},l_=e=>function(t,n){const r=n(),i=Re(r),a=Ot(r).boundingBox()||new nt(0,0,0,0),s=new oe(a.right+i.style.radius*1.5,a.top+i.style.radius),l=[],u=[],c={};let d=Yr(i.nodes);e.nodes.forEach(p=>{c[p.id]=d;const y={...p,id:d};l.push(tA(y,s)),d=Po(d)});let f=Yr(i.relationships);e.relationships.forEach(p=>{const y={...p,id:f,fromId:c[p.fromId],toId:c[p.toId]};u.push(y),f=Po(f)}),t({category:"GRAPH",type:"IMPORT_NODES_AND_RELATIONSHIPS",nodes:l,relationships:u})},g5=()=>function(e,t){const n=t(),r=n.selection,i=Re(n),o=zo(i,r),a=Object.fromEntries(o.map(s=>[s.id,s.caption]));e(n5(a)),e(Rp(r,""))},m5=()=>function(e,t){const n=t(),r=n.selection,i=Re(n),o=zo(i,r),a=Object.fromEntries(o.map(s=>[s.id,s.caption]));e(o5("",a)),e(Rp(r,""))},v5=e=>{const t=e.map(r=>r.labels).reduce((r,i)=>[...new Set(r.concat(i))],[]),n={};return t.forEach(r=>{n[r]={status:e.every(i=>i.labels.includes(r))?"CONSISTENT":"PARTIAL"}}),n},y5=(e,t)=>{const n=[],r=new Set;return e.forEach(i=>{i.labels&&i.labels.forEach(o=>r.add(o))}),t.nodes.forEach(i=>{i.labels.forEach(o=>{if(o&&!r.has(o)){const a=n.find(s=>s.label===o);a?a.nodeCount++:n.push({label:o,nodeCount:1})}})}),n},yd=e=>e===""?"_EMPTY_LABEL":e.replace(/_/g,"__"),b5=(e,t)=>{switch(e.type){case"CREATE_NODE":{const n={};return e.style&&Object.keys(e.style).forEach(r=>{n[fi(r)]=e.style[r]}),r=>r.run("CREATE (n:Diagram0 {_id: $id, _x: $x, _y: $y, _caption: $caption}) SET n += $style",{id:e.newNodeId,x:e.newNodePosition.x,y:e.newNodePosition.y,caption:e.caption,style:n})}case"CREATE_NODE_AND_RELATIONSHIP":{const n={};return e.style&&Object.keys(e.style).forEach(r=>{n[fi(r)]=e.style[r]}),r=>r.run("MATCH (n:Diagram0 {_id: $sourceNodeId}) CREATE (n)-[:_RELATED {_id: $newRelationshipId}]->(t:Diagram0 {_id: $targetNodeId, _x: $x, _y: $y, _caption: $caption}) SET t += $style",{sourceNodeId:e.sourceNodeId,newRelationshipId:e.newRelationshipId,targetNodeId:e.targetNodeId,x:e.targetNodePosition.x,y:e.targetNodePosition.y,caption:e.caption,style:n})}case"CONNECT_NODES":return n=>n.run("MATCH (source:Diagram0 {_id: $sourceNodeId}), (target:Diagram0 {_id: $targetNodeId}) CREATE (source)-[:_RELATED {_id: $newRelationshipId}]->(target)",{sourceNodeId:e.sourceNodeId,newRelationshipId:e.newRelationshipId,targetNodeId:e.targetNodeId});case"SET_NODE_CAPTION":return n=>n.run("MATCH (n:Diagram0) WHERE n._id IN $ids SET n._caption = $caption",{ids:dt(e.selection),caption:e.caption});case"ADD_LABEL":return n=>n.run("MATCH (n:Diagram0) WHERE n._id IN $ids SET n:`"+yd(e.label)+"`",{ids:dt(e.selection)});case"RENAME_LABEL":return n=>n.run("MATCH (n:Diagram0) WHERE n._id IN $ids SET n:`"+yd(e.newLabel)+"`REMOVE n:`"+yd(e.oldLabel)+"`",{ids:dt(e.selection)});case"REMOVE_LABEL":return n=>n.run("MATCH (n:Diagram0) WHERE n._id IN $ids REMOVE n:`"+yd(e.label)+"`",{ids:dt(e.selection)});case"RENAME_PROPERTY":return n=>(n.run("MATCH (n:Diagram0) WHERE n._id IN $ids SET n.`"+Dr(e.newPropertyKey)+"` = n.`"+Dr(e.oldPropertyKey)+"` REMOVE n.`"+Dr(e.oldPropertyKey)+"`",{ids:dt(e.selection)}),n.run("MATCH (:Diagram0)-[r]->(:Diagram0) WHERE r._id IN $ids SET r.`"+Dr(e.newPropertyKey)+"` = r.`"+Dr(e.oldPropertyKey)+"` REMOVE r.`"+Dr(e.oldPropertyKey)+"`",{ids:xn(e.selection)}));case"SET_PROPERTY":{const n={};return n[Dr(e.key)]=e.value,r=>(r.run("MATCH (n:Diagram0) WHERE n._id IN $ids SET n += $properties",{ids:dt(e.selection),properties:n}),r.run("MATCH (:Diagram0)-[r]->(:Diagram0) WHERE r._id IN $ids SET r += $properties",{ids:xn(e.selection),properties:n}))}case"SET_ARROWS_PROPERTY":{const r={[fi(e.key)]:e.value},i=[];return T0.includes(e.key)&&i.push({cypher:"MATCH (n:Diagram0) WHERE n._id IN $ids SET n += $properties",params:{ids:dt(e.selection),properties:r}}),P0.includes(e.key)&&i.push({cypher:"MATCH (:Diagram0)-[r]->(:Diagram0) WHERE r._id IN $ids SET r += $properties",params:{ids:xn(e.selection),properties:r}}),o=>{const a=i.map(s=>o.run(s.cypher,s.params));return Promise.all(a)}}case"REMOVE_ARROWS_PROPERTY":return n=>(n.run("MATCH (n:Diagram0) WHERE n._id IN $ids REMOVE n.`"+fi(e.key)+"`",{ids:dt(e.selection)}),n.run("MATCH (:Diagram0)-[r]->(:Diagram0) WHERE r._id IN $ids REMOVE r.`"+fi(e.key)+"`",{ids:xn(e.selection)}));case"REMOVE_PROPERTY":return n=>(n.run("MATCH (n:Diagram0) WHERE n._id IN $ids REMOVE n.`"+Dr(e.key)+"`",{ids:dt(e.selection)}),n.run("MATCH (:Diagram0)-[r]->(:Diagram0) WHERE r._id IN $ids REMOVE r.`"+Dr(e.key)+"`",{ids:xn(e.selection)}));case"SET_GRAPH_STYLE":{const r={[fi(e.key)]:e.value};return i=>i.run("MERGE (n:Diagram) WITH n SET n += $properties",{properties:r})}case"SET_GRAPH_STYLES":{const n={};for(const[r,i]of Object.entries(e.style)){const o=fi(r);n[o]=i}return r=>r.run("MERGE (n:Diagram) WITH n SET n += $properties",{properties:n})}case"MOVE_NODES_END_DRAG":return e.nodePositions.length!==0?n=>{let r=n;return e.nodePositions.forEach(({nodeId:i,position:o})=>{r=n.run("MATCH (n:Diagram0 {_id: $id}) SET n._x = $x, n._y = $y",{id:i,x:o.x,y:o.y})}),r}:()=>Promise.resolve("Nothing to do");case"SET_RELATIONSHIP_TYPE":{const n=cg(e.relationshipType);return r=>{let i=r;return xn(e.selection).forEach(o=>{i=r.run(`MATCH (n)-[r]->(m) WHERE r._id = $id CREATE (n)-[r2:\`${n}\`]->(m) SET r2 = r WITH r DELETE r`,{id:o})}),i}}case"DUPLICATE_NODES_AND_RELATIONSHIPS":return n=>{let r=n;return Object.keys(e.nodeIdMap).forEach(i=>{const o=e.nodeIdMap[i];r=n.run(`MATCH (old:Diagram0 {_id: $oldNodeId}) WITH old CREATE (new:Diagram0) SET new = old SET new._id = $newNodeId SET new._x = $x, new._y = $y`,{oldNodeId:o.oldNodeId,newNodeId:i,x:o.position.x,y:o.position.y})}),Object.keys(e.relationshipIdMap).forEach(i=>{const o=e.relationshipIdMap[i],a=cg(o.relationshipType);r=n.run(`MATCH ()-[old]->() WHERE old._id = $oldRelationshipId WITH old MATCH (source:Diagram0 {_id: $sourceId}), (target:Diagram0 {_id: $targetId}) CREATE (source)-[new:\`${a}\`]->(target) SET new = old SET new._id = $newRelationshipId`,{oldRelationshipId:o.oldRelationshipId,newRelationshipId:i,sourceId:o.fromId,targetId:o.toId,newType:a})}),r};case"DELETE_NODES_AND_RELATIONSHIPS":{const n=Object.keys(e.nodeIdMap),r=Object.keys(e.relationshipIdMap);return i=>{let o=i;return r.length>0&&(o=i.run(`match(d:Diagram0)-[r]-() where r._id in $ids delete r`,{ids:r})),n.length>0&&(o=i.run(`match(d:Diagram0) where d._id in $ids detach delete d`,{ids:n})),o}}case"REVERSE_RELATIONSHIPS":return n=>{let r=n;return xn(e.selection).forEach(i=>{const o=t.relationships.find(s=>s.id===i),a=cg(o.type);r=n.run(`MATCH (s1)-[old]->(s2) WHERE old._id = $id CREATE (s2)-[new:\`${a}\`]->(s1) SET new = old DELETE old`,{id:i})}),r};default:return()=>Promise.resolve("Nothing to do")}},w5=(e,t)=>{const n=Re(t),r=[b5(e,n)],i=t.applicationLayout.layers;i&&i.length>0&&i.forEach(o=>{o.persist&&o.storageActionHandler&&o.storageActionHandler.neo4j&&r.push(o.storageActionHandler.neo4j(e))})};var qt={},Oo={};Object.defineProperty(Oo,"__esModule",{value:!0});Oo.ActionCreators=Oo.ActionTypes=void 0;var lo={UNDO:"@@redux-undo/UNDO",REDO:"@@redux-undo/REDO",JUMP_TO_FUTURE:"@@redux-undo/JUMP_TO_FUTURE",JUMP_TO_PAST:"@@redux-undo/JUMP_TO_PAST",JUMP:"@@redux-undo/JUMP",CLEAR_HISTORY:"@@redux-undo/CLEAR_HISTORY"};Oo.ActionTypes=lo;var E5={undo:function(){return{type:lo.UNDO}},redo:function(){return{type:lo.REDO}},jumpToFuture:function(t){return{type:lo.JUMP_TO_FUTURE,index:t}},jumpToPast:function(t){return{type:lo.JUMP_TO_PAST,index:t}},jump:function(t){return{type:lo.JUMP,index:t}},clearHistory:function(){return{type:lo.CLEAR_HISTORY}}};Oo.ActionCreators=E5;var Tr={};Object.defineProperty(Tr,"__esModule",{value:!0});Tr.parseActions=kp;Tr.isHistory=x5;Tr.includeAction=S5;Tr.excludeAction=C5;Tr.combineFilters=T5;Tr.groupByActionTypes=P5;Tr.newHistory=O5;function kp(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];return Array.isArray(e)?e:typeof e=="string"?[e]:t}function x5(e){return typeof e.present<"u"&&typeof e.future<"u"&&typeof e.past<"u"&&Array.isArray(e.future)&&Array.isArray(e.past)}function S5(e){var t=kp(e);return function(n){return t.indexOf(n.type)>=0}}function C5(e){var t=kp(e);return function(n){return t.indexOf(n.type)<0}}function T5(){for(var e=arguments.length,t=new Array(e),n=0;n=0?n.type:null}}function O5(e,t,n){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;return{past:e,present:t,future:n,group:r,_latestUnfiltered:t,index:e.length,limit:e.length+n.length+1}}var u_={},Gs={};Object.defineProperty(Gs,"__esModule",{value:!0});Gs.set=M5;Gs.start=k5;Gs.end=$5;Gs.log=D5;function ar(e){return I5(e)||_5(e)||A5()}function A5(){throw new TypeError("Invalid attempt to spread non-iterable instance")}function _5(e){if(Symbol.iterator in Object(e)||Object.prototype.toString.call(e)==="[object Arguments]")return Array.from(e)}function I5(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t=x.future.length)return x;var P=x.past,O=x.future,N=x._latestUnfiltered,k=[].concat(c(P),[N],c(O.slice(0,C))),D=O[C],L=O.slice(C+1);return(0,i.newHistory)(k,D,L)}function h(x,C){if(C<0||C>=x.past.length)return x;var P=x.past,O=x.future,N=x._latestUnfiltered,k=P.slice(0,C),D=[].concat(c(P.slice(C+1)),[N],c(O)),L=P[C];return(0,i.newHistory)(k,L,D)}function v(x,C){return C>0?w(x,C-1):C<0?h(x,x.past.length+C):x}function m(x,C){return C.indexOf(x)>-1?x:!x}function b(x){var C=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};n.set(C.debug);var P=l({limit:void 0,filter:function(){return!0},groupBy:function(){return null},undoType:r.ActionTypes.UNDO,redoType:r.ActionTypes.REDO,jumpToPastType:r.ActionTypes.JUMP_TO_PAST,jumpToFutureType:r.ActionTypes.JUMP_TO_FUTURE,jumpType:r.ActionTypes.JUMP,neverSkipReducer:!1,ignoreInitialState:!1,syncFilter:!1},C,{initTypes:(0,i.parseActions)(C.initTypes,["@@redux-undo/INIT"]),clearHistoryType:(0,i.parseActions)(C.clearHistoryType,[r.ActionTypes.CLEAR_HISTORY])}),O=P.neverSkipReducer?function(k,D){for(var L=arguments.length,B=new Array(L>2?L-2:0),q=2;q0&&arguments[0]!==void 0?arguments[0]:N,D=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};n.start(D,k);for(var L=k,B=arguments.length,q=new Array(B>2?B-2:0),Q=2;Q(t,n)=>{switch(n().storage.mode){case"GOOGLE_DRIVE":t({type:"SAVE_AS_GOOGLE_DRIVE_DIAGRAM",diagramName:e});break;case"LOCAL_STORAGE":t({type:"SAVE_AS_LOCAL_STORAGE_DIAGRAM",diagramName:e});break}};function d_(e){switch(e.mode){case"GOOGLE_DRIVE":return f_(e.fileId);case"LOCAL_STORAGE":return L0(e.fileId);default:return{}}}function f_(e){return{type:"GET_FILE_FROM_GOOGLE_DRIVE",fileId:e}}function L0(e){return{type:"GET_FILE_FROM_LOCAL_STORAGE",fileId:e}}function j5(){return{type:"POST_CURRENT_DIAGRAM_AS_NEW_FILE_ON_GOOGLE_DRIVE"}}function G5(e){return{type:"POSTED_FILE_ON_GOOGLE_DRIVE",fileId:e}}function B5(){return{type:"POSTED_FILE_TO_LOCAL_STORAGE"}}const z5=e=>({type:"GOOGLE_DRIVE_SIGN_IN_STATUS",signedIn:e}),U5=()=>(e,t)=>{const n=t(),{storage:r,recentStorage:i}=n,o=i.filter(a=>a.mode==="LOCAL_STORAGE");r.status==="PICKING_FROM_GOOGLE_DRIVE"?e(F0()):o.length>0?e(d_(o[0])):e(c_())},W5=e=>({type:"PICK_DIAGRAM",mode:e}),F0=()=>({type:"PICK_DIAGRAM_CANCEL"});function p_(){return{type:"GETTING_GRAPH"}}function h_(e){return function(t){t({category:"GRAPH",type:"GETTING_GRAPH_SUCCEEDED",storedGraph:e}),t(qt.ActionCreators.clearHistory())}}function V5(){return{type:"PUT_GRAPH"}}function K5(){return{type:"POSTING_GRAPH"}}function bx(){return{type:"PUTTING_GRAPH"}}function wx(){return{type:"PUTTING_GRAPH_SUCCEEDED"}}function q5(e){return function(t){t(p_());const n=()=>Ex(e).then(i=>{const o=Bs(JSON.parse(i));t(h_(o.graph))});(()=>Ex(e,!0).then(i=>{const o=JSON.parse(i).name;t(QO(o))}))(),n()}}const Ex=(e,t=!1)=>new Promise((n,r)=>{const i=`https://www.googleapis.com/drive/v3/files/${e}?supportsAllDrives=true${t?"":"&alt=media"}`,o=window.gapi.auth.getToken().access_token,a=new XMLHttpRequest;a.open("GET",i),a.setRequestHeader("Authorization","Bearer "+o),a.onload=()=>n(a.responseText),a.onerror=s=>r(s),a.send()}),Bs=e=>{let t,n=[];e?e.graph?(t=e.graph,n=e.gangs||[]):t=e:t=Ev();const r=t.nodes.map(o=>({id:o.id,position:new Y(o.position.x,o.position.y),caption:o.caption,labels:o.labels||[],properties:o.properties||{},style:o.style||{}})),i=t.relationships.filter(o=>r.some(a=>a.id===o.fromId)&&r.some(a=>a.id===o.toId)).map(o=>({id:o.id,fromId:o.fromId,toId:o.toId,type:o.type||"",properties:o.properties||{},style:o.style||{}}));return n.forEach(o=>{o.position=new Y(o.position.x,o.position.y),o.initialPosition=new Y(o.initialPosition.x,o.initialPosition.y),o.members.forEach(a=>{a.position=new Y(a.position.x,a.position.y)})}),{graph:{nodes:r,relationships:i,style:eA(t.style)},gangs:n}},g_="neo4j-arrows-app.helpDismissed",m_="neo4j-arrows-app.recentlyAccessedDiagrams",v_="neo4j-arrows-app.favoriteExportTab",Y5="neo4j-arrows-app.appData",Q5=()=>Dp(g_,!0),X5=()=>!!lc(g_),Dp=(e,t)=>{localStorage.setItem(e,JSON.stringify(t))},lc=e=>{const t=localStorage.getItem(e);return JSON.parse(t)},J5=()=>lc(Y5),Z5=e=>function(t){t(p_());const n=lc("GRAPH|"+e),r=Bs(n);n.diagramName&&t(QO(n.diagramName)),t(h_(r.graph))},tu=(e,t)=>{Dp("GRAPH|"+e,t)},y_=()=>lc(m_),e8=e=>{Dp(m_,e)},t8=()=>lc(v_),n8=e=>{Dp(v_,e)};function r8(e=i8(),t){if(t.type==="UPDATE_RECENT_STORAGE"){const{mode:n,fileId:r,diagramName:i,timestamp:o}=t;return[{mode:n,fileId:r,diagramName:i,timestamp:o},...e.filter(a=>!(a.mode===n&&a.fileId===r))]}return e}const i8=()=>y_()||[],Mp=()=>{const e=new Uint8Array(15);return window.crypto.getRandomValues(e),btoa(String.fromCodePoint(...e)).substring(0,20).replace(/\+/g,"-").replace(/\//g,"_")},o8=/^#\/import\/json=(.*)/,a8=/^#\/local$/,s8=/^#\/local\/id=(.*)/,l8=/^#\/googledrive\/ids=(.*)/,u8=e=>t=>n=>{const r=e.getState().storage,i=t(n),o=e.getState().storage;if(r!==o&&o.status==="READY")switch(o.mode){case"GOOGLE_DRIVE":o.fileId&&(window.location.hash=`#/googledrive/ids=${o.fileId}`);break;case"DATABASE":window.location.hash="#/neo4j";break;case"LOCAL_STORAGE":window.location.hash=`#/local/id=${o.fileId}`;break}return i},Pf="Untitled graph",c8=(e=Pf,t)=>{switch(t.type){case"NEW_GOOGLE_DRIVE_DIAGRAM":case"NEW_LOCAL_STORAGE_DIAGRAM":return Pf;case"SAVE_AS_GOOGLE_DRIVE_DIAGRAM":case"SAVE_AS_LOCAL_STORAGE_DIAGRAM":case"GETTING_DIAGRAM_NAME_SUCCEEDED":case"RENAME_DIAGRAM":return t.diagramName;default:return e}},b_="3.7.5",d8=b_,f8=typeof atob=="function",p8=typeof btoa=="function",zs=typeof Buffer=="function",xx=typeof TextDecoder=="function"?new TextDecoder:void 0,Sx=typeof TextEncoder=="function"?new TextEncoder:void 0,h8="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",Fl=Array.prototype.slice.call(h8),bd=(e=>{let t={};return e.forEach((n,r)=>t[n]=r),t})(Fl),g8=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,ft=String.fromCharCode.bind(String),Cx=typeof Uint8Array.from=="function"?Uint8Array.from.bind(Uint8Array):e=>new Uint8Array(Array.prototype.slice.call(e,0)),w_=e=>e.replace(/=/g,"").replace(/[+\/]/g,t=>t=="+"?"-":"_"),E_=e=>e.replace(/[^A-Za-z0-9\+\/]/g,""),x_=e=>{let t,n,r,i,o="";const a=e.length%3;for(let s=0;s255||(r=e.charCodeAt(s++))>255||(i=e.charCodeAt(s++))>255)throw new TypeError("invalid character found");t=n<<16|r<<8|i,o+=Fl[t>>18&63]+Fl[t>>12&63]+Fl[t>>6&63]+Fl[t&63]}return a?o.slice(0,a-3)+"===".substring(a):o},H0=p8?e=>btoa(e):zs?e=>Buffer.from(e,"binary").toString("base64"):x_,$v=zs?e=>Buffer.from(e).toString("base64"):e=>{let n=[];for(let r=0,i=e.length;rt?w_($v(e)):$v(e),m8=e=>{if(e.length<2){var t=e.charCodeAt(0);return t<128?e:t<2048?ft(192|t>>>6)+ft(128|t&63):ft(224|t>>>12&15)+ft(128|t>>>6&63)+ft(128|t&63)}else{var t=65536+(e.charCodeAt(0)-55296)*1024+(e.charCodeAt(1)-56320);return ft(240|t>>>18&7)+ft(128|t>>>12&63)+ft(128|t>>>6&63)+ft(128|t&63)}},v8=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,S_=e=>e.replace(v8,m8),Tx=zs?e=>Buffer.from(e,"utf8").toString("base64"):Sx?e=>$v(Sx.encode(e)):e=>H0(S_(e)),qa=(e,t=!1)=>t?w_(Tx(e)):Tx(e),Px=e=>qa(e,!0),y8=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,b8=e=>{switch(e.length){case 4:var t=(7&e.charCodeAt(0))<<18|(63&e.charCodeAt(1))<<12|(63&e.charCodeAt(2))<<6|63&e.charCodeAt(3),n=t-65536;return ft((n>>>10)+55296)+ft((n&1023)+56320);case 3:return ft((15&e.charCodeAt(0))<<12|(63&e.charCodeAt(1))<<6|63&e.charCodeAt(2));default:return ft((31&e.charCodeAt(0))<<6|63&e.charCodeAt(1))}},C_=e=>e.replace(y8,b8),T_=e=>{if(e=e.replace(/\s+/g,""),!g8.test(e))throw new TypeError("malformed base64.");e+="==".slice(2-(e.length&3));let t,n="",r,i;for(let o=0;o>16&255):i===64?ft(t>>16&255,t>>8&255):ft(t>>16&255,t>>8&255,t&255);return n},j0=f8?e=>atob(E_(e)):zs?e=>Buffer.from(e,"base64").toString("binary"):T_,P_=zs?e=>Cx(Buffer.from(e,"base64")):e=>Cx(j0(e).split("").map(t=>t.charCodeAt(0))),O_=e=>P_(A_(e)),w8=zs?e=>Buffer.from(e,"base64").toString("utf8"):xx?e=>xx.decode(P_(e)):e=>C_(j0(e)),A_=e=>E_(e.replace(/[-_]/g,t=>t=="-"?"+":"/")),Dv=e=>w8(A_(e)),E8=e=>{if(typeof e!="string")return!1;const t=e.replace(/\s+/g,"").replace(/={0,2}$/,"");return!/[^\s0-9a-zA-Z\+/]/.test(t)||!/[^\s0-9a-zA-Z\-_]/.test(t)},__=e=>({value:e,enumerable:!1,writable:!0,configurable:!0}),I_=function(){const e=(t,n)=>Object.defineProperty(String.prototype,t,__(n));e("fromBase64",function(){return Dv(this)}),e("toBase64",function(t){return qa(this,t)}),e("toBase64URI",function(){return qa(this,!0)}),e("toBase64URL",function(){return qa(this,!0)}),e("toUint8Array",function(){return O_(this)})},N_=function(){const e=(t,n)=>Object.defineProperty(Uint8Array.prototype,t,__(n));e("toBase64",function(t){return Bd(this,t)}),e("toBase64URI",function(){return Bd(this,!0)}),e("toBase64URL",function(){return Bd(this,!0)})},x8=()=>{I_(),N_()},Us={version:b_,VERSION:d8,atob:j0,atobPolyfill:T_,btoa:H0,btoaPolyfill:x_,fromBase64:Dv,toBase64:qa,encode:qa,encodeURI:Px,encodeURL:Px,utob:S_,btou:C_,decode:Dv,isValid:E8,fromUint8Array:Bd,toUint8Array:O_,extendString:I_,extendUint8Array:N_,extendBuiltins:x8};function S8(e=C8(),t){switch(t.type){case"POST_CURRENT_DIAGRAM_AS_NEW_FILE_ON_GOOGLE_DRIVE":case"SAVE_AS_GOOGLE_DRIVE_DIAGRAM":case"NEW_GOOGLE_DRIVE_DIAGRAM":return{mode:"GOOGLE_DRIVE",status:"POST",fileId:null};case"SAVE_AS_LOCAL_STORAGE_DIAGRAM":case"NEW_LOCAL_STORAGE_DIAGRAM":return{mode:"LOCAL_STORAGE",status:"POST",fileId:Mp()};case"PICK_DIAGRAM":switch(t.mode){case"GOOGLE_DRIVE":return{...e,status:"PICKING_FROM_GOOGLE_DRIVE"};case"LOCAL_STORAGE":return{...e,status:"PICKING_FROM_LOCAL_STORAGE"};default:return e}case"PICK_DIAGRAM_CANCEL":return{...e,status:"READY"};case"GET_FILE_FROM_GOOGLE_DRIVE":return{mode:"GOOGLE_DRIVE",status:"GET",fileId:t.fileId};case"GET_FILE_FROM_LOCAL_STORAGE":return{mode:"LOCAL_STORAGE",status:"GET",fileId:t.fileId};case"GETTING_GRAPH":return{...e,status:"GETTING"};case"GETTING_GRAPH_SUCCEEDED":return{...e,status:"READY"};case"POSTED_FILE_ON_GOOGLE_DRIVE":return{...e,status:"READY",fileId:t.fileId};case"POSTED_FILE_TO_LOCAL_STORAGE":return{...e,status:"READY"};case"PUT_GRAPH":return{...e,status:"PUT"};case"POSTING_GRAPH":return{...e,status:"POSTING"};case"PUTTING_GRAPH":return{...e,status:"PUTTING"};case"PUTTING_GRAPH_SUCCEEDED":return{...e,status:"READY"};case"PUTTING_GRAPH_FAILED":return{...e,status:"FAILED"};default:return e}}const C8=()=>{const e=window.location.hash,t=o8.exec(e),n=a8.exec(e),r=s8.exec(e),i=l8.exec(e);if(t){const o=t[1];try{const a=JSON.parse(Us.decode(o));return Ox(a)}catch(a){return console.log(a),sm()}}else if(n){const o=J5();return o?Ox(o):sm()}else{if(r)return{mode:"LOCAL_STORAGE",status:"GET",fileId:r[1]};if(i&&i.length>1){const o=i[1].split(",");if(o.length>0)return{mode:"GOOGLE_DRIVE",status:"GET",fileId:o[0]}}else{const o=y_()||[];if(o.length>0){const a=o[0];return{mode:a.mode,status:"GET",fileId:a.fileId}}else return sm()}}},sm=()=>({mode:"LOCAL_STORAGE",status:"POST",fileId:Mp()}),T8=e=>{if(e.origin!=="http://localhost:8000")return{type:"IGNORE"};console.log("Message!",e.data);const t=JSON.parse(e.data),n=Bs(t).graph,r=t.diagramName||Pf,i=Mp();return tu(i,{graph:n,diagramName:r}),L0(i)},Ox=e=>{const t=Bs(e).graph,n=e.diagramName||Pf,r=Mp();return tu(r,{graph:t,diagramName:n}),{mode:"LOCAL_STORAGE",status:"GET",fileId:r}},P8=(e=Ev(),t)=>{switch(t.type){case"NEW_GOOGLE_DRIVE_DIAGRAM":case"NEW_LOCAL_STORAGE_DIAGRAM":return Ev();case"CREATE_NODE":{const i=e.nodes.slice();return i.push({id:t.newNodeId,position:t.newNodePosition,caption:t.caption,style:t.style,labels:[],properties:{}}),{style:e.style,nodes:i,relationships:e.relationships}}case"CREATE_NODES_AND_RELATIONSHIPS":{const i=[...e.nodes,...t.targetNodeIds.map((a,s)=>({id:a,position:t.targetNodePositions[s],caption:t.caption,style:t.style,labels:[],properties:{}}))],o=[...e.relationships,...t.newRelationshipIds.map((a,s)=>({id:a,type:"",style:{},properties:{},fromId:t.sourceNodeIds[s],toId:t.targetNodeIds[s]}))];return{style:e.style,nodes:i,relationships:o}}case"CONNECT_NODES":{const i=[...e.relationships,...t.newRelationshipIds.map((o,a)=>({id:o,type:"",style:{},properties:{},fromId:t.sourceNodeIds[a],toId:t.targetNodeIds[a]}))];return{style:e.style,nodes:e.nodes,relationships:i}}case"SET_NODE_CAPTION":return{style:e.style,nodes:e.nodes.map(i=>tn(t.selection,i.id)?pL(i,t.caption):i),relationships:e.relationships};case"ADD_LABEL":return{style:e.style,nodes:e.nodes.map(i=>tn(t.selection,i.id)?ug(i,t.label):i),relationships:e.relationships};case"ADD_LABELS":return{style:e.style,nodes:e.nodes.map(i=>t.nodeLabels.hasOwnProperty(i.id)?ug(i,t.nodeLabels[i.id]):i),relationships:e.relationships};case"RENAME_LABEL":return{style:e.style,nodes:e.nodes.map(i=>tn(t.selection,i.id)?dL(i,t.oldLabel,t.newLabel):i),relationships:e.relationships};case"REMOVE_LABEL":return{style:e.style,nodes:e.nodes.map(i=>tn(t.selection,i.id)?fL(i,t.label):i),relationships:e.relationships};case"MERGE_NODES":{const i=new Map;for(const a of t.mergeSpecs)for(const s of a.purgedNodeIds)i.set(s,a.survivingNodeId);const o=a=>i.has(a)?i.get(a):a;return{style:e.style,nodes:e.nodes.filter(a=>!t.mergeSpecs.some(s=>s.purgedNodeIds.includes(a.id))).map(a=>{const s=t.mergeSpecs.find(l=>l.survivingNodeId===a.id);if(s){let l=a.properties;for(const u of s.purgedNodeIds){const c=e.nodes.find(d=>d.id===u);l={...l,...c.properties}}return{...a,properties:l,position:s.position}}else return a}),relationships:e.relationships.map(a=>({...a,fromId:o(a.fromId),toId:o(a.toId)}))}}case"RENAME_PROPERTY":return{style:e.style,nodes:e.nodes.map(i=>tn(t.selection,i.id)?U1(i,t.oldPropertyKey,t.newPropertyKey):i),relationships:e.relationships.map(i=>pi(t.selection,i.id)?U1(i,t.oldPropertyKey,t.newPropertyKey):i)};case"SET_PROPERTY":return{style:e.style,nodes:e.nodes.map(i=>tn(t.selection,i.id)?dd(i,t.key,t.value):i),relationships:e.relationships.map(i=>pi(t.selection,i.id)?dd(i,t.key,t.value):i)};case"SET_PROPERTY_VALUES":return{style:e.style,nodes:e.nodes.map(i=>t.nodePropertyValues.hasOwnProperty(i.id)?dd(i,t.key,t.nodePropertyValues[i.id]):i),relationships:e.relationships};case"SET_ARROWS_PROPERTY":return{style:e.style,nodes:e.nodes.map(i=>T0.includes(t.key)&&tn(t.selection,i.id)?W1(i,t.key,t.value):i),relationships:e.relationships.map(i=>P0.includes(t.key)&&pi(t.selection,i.id)?W1(i,t.key,t.value):i)};case"REMOVE_PROPERTY":return{style:e.style,nodes:e.nodes.map(i=>tn(t.selection,i.id)?V1(i,t.key):i),relationships:e.relationships.map(i=>pi(t.selection,i.id)?V1(i,t.key):i)};case"REMOVE_ARROWS_PROPERTY":return{style:e.style,nodes:e.nodes.map(i=>tn(t.selection,i.id)?K1(i,t.key):i),relationships:e.relationships.map(i=>pi(t.selection,i.id)?K1(i,t.key):i)};case"SET_GRAPH_STYLE":{const i={...e.style};return i[t.key]=t.value,{style:i,nodes:e.nodes,relationships:e.relationships}}case"SET_GRAPH_STYLES":{const i={...e.style};for(const[o,a]of Object.entries(t.style))i[o]=a;return{style:i,nodes:e.nodes,relationships:e.relationships}}case"MOVE_NODES":case"MOVE_NODES_END_DRAG":const n={};let r=!0;return e.nodes.forEach(i=>{n[i.id]=i}),t.nodePositions.forEach(i=>{if(n[i.nodeId]){const o=n[i.nodeId];r&=o.position.isEqual(i.position),n[i.nodeId]=A0(o,i.position)}}),r?e:{style:e.style,nodes:Object.values(n),relationships:e.relationships};case"SET_RELATIONSHIP_TYPE":return{style:e.style,nodes:e.nodes,relationships:e.relationships.map(i=>pi(t.selection,i.id)?hL(i,t.relationshipType):i)};case"DUPLICATE_NODES_AND_RELATIONSHIPS":{const i=e.nodes.slice();Object.keys(t.nodeIdMap).forEach(a=>{const s=t.nodeIdMap[a],l=e.nodes.find(c=>pt(c.id,s.oldNodeId)),u={id:a,position:s.position,caption:l.caption,style:{...l.style},labels:[...l.labels],properties:{...l.properties}};i.push(u)});const o=e.relationships.slice();return Object.keys(t.relationshipIdMap).forEach(a=>{const s=t.relationshipIdMap[a],l=e.relationships.find(c=>pt(c.id,s.oldRelationshipId)),u={id:a,type:l.type,fromId:s.fromId,toId:s.toId,style:{...l.style},properties:{...l.properties}};o.push(u)}),{style:e.style,nodes:i,relationships:o}}case"IMPORT_NODES_AND_RELATIONSHIPS":{const i=[...e.nodes,...t.nodes],o=[...e.relationships,...t.relationships];return{style:e.style,nodes:i,relationships:o}}case"DELETE_NODES_AND_RELATIONSHIPS":return{style:e.style,nodes:e.nodes.filter(i=>!t.nodeIdMap[i.id]),relationships:e.relationships.filter(i=>!t.relationshipIdMap[i.id])};case"REVERSE_RELATIONSHIPS":return{...e,relationships:e.relationships.map(i=>pi(t.selection,i.id)?gL(i):i)};case"INLINE_RELATIONSHIPS":return{...e,nodes:e.nodes.filter(i=>!t.relationshipSpecs.some(o=>o.removeNodeId===i.id)).map(i=>{const o=t.relationshipSpecs.find(a=>a.addPropertiesNodeId===i.id);if(o){let a=i;for(const s of o.labels)a=ug(a,s);for(const[s,l]of Object.entries(o.properties))a=dd(a,s,l);return a}else return i}),relationships:e.relationships.filter(i=>!t.relationshipSpecs.some(o=>o.removeNodeId===i.fromId||o.removeNodeId===i.toId))};case"GETTING_GRAPH_SUCCEEDED":return t.storedGraph;default:return e}},O8=L5(P8,{filter:e=>e.category==="GRAPH",groupBy:qt.groupByActionTypes("MOVE_NODES")}),A8=(e,t)=>t.every(n=>e.some(r=>nu(r,n))),nu=(e,t)=>e.entityType===t.entityType&&e.id===t.id,Ax=(e,t,n)=>{if(n==="at-least"&&A8(e,t))return e;switch(n){case"xor":return e.filter(r=>!t.some(i=>nu(r,i))).concat(t.filter(r=>!e.some(i=>nu(i,r))));case"or":return e.concat(t.filter(r=>!e.some(i=>nu(i,r))));case"replace":case"at-least":return t}};function _8(e={editing:void 0,entities:[]},t){switch(t.type){case"ACTIVATE_EDITING":return{editing:t.editing,entities:Ax(e.entities,[t.editing],"at-least")};case"DEACTIVATE_EDITING":return{editing:void 0,entities:e.entities};case"TOGGLE_SELECTION":const n=Ax(e.entities,t.entities,t.mode);let r;return e.editing&&n.some(i=>nu(i,e.editing))&&(r=e.editing),{editing:r,entities:n};case"CLEAR_SELECTION":case"DELETE_NODES_AND_RELATIONSHIPS":case qt.ActionTypes.UNDO:case qt.ActionTypes.REDO:return{editing:void 0,entities:[]};case"CREATE_NODE":return{editing:void 0,entities:[{entityType:"node",id:t.newNodeId}]};case"CREATE_NODES_AND_RELATIONSHIPS":return{editing:void 0,entities:t.targetNodeIds.map(i=>({entityType:"node",id:i}))};case"CONNECT_NODES":return{editing:void 0,entities:t.newRelationshipIds.map(i=>({entityType:"relationship",id:i}))};case"DUPLICATE_NODES_AND_RELATIONSHIPS":return{editing:void 0,entities:[...Object.keys(t.nodeIdMap).map(i=>({entityType:"node",id:i})),...Object.keys(t.relationshipIdMap).map(i=>({entityType:"relationship",id:i}))]};case"MERGE_NODES":return{editing:void 0,entities:t.mergeSpecs.map(i=>({entityType:"node",id:i.survivingNodeId}))};case"INLINE_RELATIONSHIPS":return{editing:void 0,entities:t.relationshipSpecs.map(i=>({entityType:"node",id:i.addPropertiesNodeId}))};case"IMPORT_NODES_AND_RELATIONSHIPS":return{editing:void 0,entities:[...t.nodes.map(i=>({entityType:"node",id:i.id})),...t.relationships.map(i=>({entityType:"relationship",id:i.id}))]};default:return e}}const I8=(e={dragType:"NONE"},t)=>{switch(t.type){case"MOUSE_DOWN_ON_HANDLE":return{dragType:"HANDLE",corner:t.corner,mousePosition:t.canvasPosition,initialMousePosition:t.canvasPosition,initialNodePositions:t.nodePositions};case"LOCK_HANDLE_DRAG_MODE":return{...e,dragType:t.dragType};case"MOUSE_DOWN_ON_NODE":{const r=t.node.position.vectorFrom(t.graphPosition);return{dragType:"NODE",node:t.node,mousePosition:t.position,mouseToNodeVector:r}}case"MOUSE_DOWN_ON_NODE_RING":return{dragType:"NODE_RING",node:t.node,mousePosition:t.position};case"MOUSE_DOWN_ON_CANVAS":return{dragType:"CANVAS",dragged:!1,mousePosition:t.canvasPosition,mouseDownPosition:t.graphPosition};case"MOVE_NODES":const n=t.newMousePosition||e.mousePosition;return{...e,dragged:!0,mousePosition:n};case"RING_DRAGGED":return{...e,dragged:!0,mousePosition:t.newMousePosition};case"SET_MARQUEE":return{...e,dragType:"MARQUEE",dragged:!0,mousePosition:t.newMousePosition};case"END_DRAG":return{dragType:"NONE"};default:return e}};function N8(e=new Qr,t){switch(t.type){case"MOVE_NODES":case"RING_DRAGGED":return t.guides;case"END_DRAG":return new Qr;default:return e}}class Of{constructor(t,n){this.width=t,this.height=n}relative(t,n){return new Of(this.width+t,this.height+n)}}const R8=(e={windowSize:new Of(window.innerWidth,window.innerHeight),inspectorVisible:!0,styleMode:"theme",betaFeaturesEnabled:!1,layers:[]},t)=>{switch(t.type){case"WINDOW_RESIZED":return{...e,windowSize:new Of(t.width,t.height)};case"TOGGLE_INSPECTOR":return{...e,inspectorVisible:!e.inspectorVisible};case"STYLE_THEME":return{...e,styleMode:"theme"};case"STYLE_CUSTOMIZE":return{...e,styleMode:"customize"};case"SET_BETA_FEATURES_ENABLED":return{...e,layers:[],betaFeaturesEnabled:t.enabled};case"SET_PERSIST_CLUSTERS":const n=e.layers.find(r=>r.name==="gangs");if(n&&n.persist!==t.enabled){const r=e.layers.filter(i=>i.name!=="gangs");return{...e,layers:r.concat([{...n,persist:t.enabled}])}}else return e;default:return e}};class mr{constructor(t=1,n=new oe(0,0)){this.scale=t,this.offset=n}zoom(t){return new mr(t,this.offset)}scroll(t){return new mr(this.scale,this.offset.plus(t))}transform(t){return t.scale(this.scale).translate(this.offset)}inverse(t){return t.translate(this.offset.invert()).scale(1/this.scale)}adjust(t,n,r){return new mr(t,new oe(n,r))}asCSSTransform(){return`${this.offset.asCSSTransform()} scale(${this.scale})`}}const k8=(e=new mr,t)=>{switch(t.type){case"SCROLL":return e.scroll(t.vector);case"ADJUST_VIEWPORT":return e.adjust(t.scale,t.panX,t.panY);default:return e}};function $8(e={sourceNodeId:null,secondarySourceNodeIds:[],targetNodeIds:[],newNodePosition:null},t){switch(t.type){case"ACTIVATE_RING":return{sourceNodeId:t.sourceNodeId,secondarySourceNodeIds:[],nodeType:t.nodeType,targetNodeIds:[],newNodePosition:null};case"RING_DRAGGED":return{sourceNodeId:t.sourceNodeId,secondarySourceNodeIds:t.secondarySourceNodeIds,targetNodeIds:t.targetNodeIds,newNodePosition:t.position};case"DEACTIVATE_RING":case"END_DRAG":return{sourceNodeId:null,secondarySourceNodeIds:[],targetNodeIds:[],newNodePosition:null};default:return e}}function D8(e=null,t){switch(t.type){case"SET_MARQUEE":return t.marquee;case"END_DRAG":return null;default:return e}}const M8=YO({dragToCreate:$8,selectionMarquee:D8});function L8(e={},t){switch(t.type){case"DUPLICATE_NODES_AND_RELATIONSHIPS":return{...e,lastDuplicateAction:t};default:return e}}function F8(e={showExportDialog:!1,showSaveAsDialog:!1,showImportDialog:!1,showHelpDialog:!X5()},t){switch(t.type){case"SHOW_EXPORT_DIALOG":return{...e,showExportDialog:!0};case"HIDE_EXPORT_DIALOG":return{...e,showExportDialog:!1};case"SHOW_SAVE_AS_DIALOG":return{...e,showSaveAsDialog:!0};case"HIDE_SAVE_AS_DIALOG":return{...e,showSaveAsDialog:!1};case"SHOW_IMPORT_DIALOG":return{...e,showImportDialog:!0};case"HIDE_IMPORT_DIALOG":return{...e,showImportDialog:!1};case"SHOW_HELP_DIALOG":return{...e,showHelpDialog:!0};case"HIDE_HELP_DIALOG":return{...e,showHelpDialog:!1};default:return e}}const H8=[],j8=(e=H8,t)=>{switch(t.type){case"CREATE_CLUSTER":return e.concat([{id:t.nodeId,position:t.position,caption:t.caption,style:t.style,properties:{},type:t.nodeType,members:t.members,initialPosition:t.initialPosition}]);case"LOAD_CLUSTERS":return t.clusters.map(r=>({id:r.id,position:r.position,caption:r.caption,properties:{},type:r.type||r,members:r.members,initialPosition:r.initialPosition,style:r.style||{radius:50,"node-color":"#FFF","border-width":"2","caption-color":"#000"}}));case"REMOVE_CLUSTER":return e.filter(r=>r.id!==t.nodeId);case"MOVE_NODES":const n={};return e.forEach(r=>{n[r.id]=r}),t.nodePositions.forEach(r=>{n[r.nodeId]&&(n[r.nodeId]=A0(n[r.nodeId],r.position))}),[...Object.values(n)];default:return e}},_x={"storage.GOOGLE_DRIVE":!0,"storage.LOCAL_STORAGE":!0,"storage.DATABASE":!1},G8=(e=_x,t)=>_x,B8=(e={},t)=>{switch(t.type){case"GOOGLE_DRIVE_SIGN_IN_STATUS":return{apiInitialized:!0,signedIn:t.signedIn};default:return e}};function z8(e={},t){return t.type==="IMAGE_EVENT"?{...e,[t.imageUrl]:t.cachedImage}:e}const U8=YO({recentStorage:r8,storage:S8,diagramName:c8,graph:O8,selection:_8,mouse:I8,gestures:M8,guides:N8,applicationLayout:R8,viewTransformation:k8,actionMemos:L8,applicationDialogs:F8,gangs:j8,features:G8,googleDrive:B8,cachedImages:z8}),W8=!!(window.location.hostname==="localhost"||window.location.hostname==="[::1]"||window.location.hostname.match(/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/));function V8(){if("serviceWorker"in navigator){if(new URL({}.PUBLIC_URL,window.location).origin!==window.location.origin)return;window.addEventListener("load",()=>{const t=`${{}.PUBLIC_URL}/service-worker.js`;W8?K8(t):R_(t)})}}function R_(e){navigator.serviceWorker.register(e).then(t=>{t.onupdatefound=()=>{const n=t.installing;n.onstatechange=()=>{n.state==="installed"&&(navigator.serviceWorker.controller?console.log("New content is available; please refresh."):console.log("Content is cached for offline use."))}}}).catch(t=>{console.error("Error during service worker registration:",t)})}function K8(e){fetch(e).then(t=>{t.status===404||t.headers.get("content-type").indexOf("javascript")===-1?navigator.serviceWorker.ready.then(n=>{n.unregister().then(()=>{window.location.reload()})}):R_(e)}).catch(()=>{console.log("No internet connection found. App is running in offline mode.")})}const q8=["NEW_GOOGLE_DRIVE_DIAGRAM","NEW_LOCAL_STORAGE_DIAGRAM","CREATE_NODE","MOVE_NODES","MOVE_NODES_END_DRAG","GETTING_GRAPH_SUCCEEDED","DUPLICATE_NODES_AND_RELATIONSHIPS","DELETE_NODES_AND_RELATIONSHIPS","WINDOW_RESIZED","TOGGLE_INSPECTOR","IMPORT_NODES_AND_RELATIONSHIPS"],Y8=(e,t,n,r)=>{const o=e.nodes[r.nodePositions[0].nodeId].boundingBox().scale(n.scale).translate(n.offset);return!new nt(It,t.width-It,It,t.height-It).containsBoundingBox(o)},Ix=(e,t)=>{const n=e.boundingBox();if(n){let r=n.right-n.left,i=n.bottom-n.top,o=new Y((n.right+n.left)/2,(n.bottom+n.top)/2);const a=t.width-It*2,s=t.height-It*2,l=new Y(It+a/2,It+s/2);let u=Math.min(1,Math.min(s/i,a/r));return u!==1&&(o=new Y(u*(n.right+n.left)/2,u*(n.bottom+n.top)/2)),{scale:u,translateVector:l.vectorFrom(o)}}else return{}},Q8=e=>t=>n=>{const r=t(n);if(!n.autoGenerated&&q8.includes(n.type)){const i=e.getState(),{applicationLayout:o,viewTransformation:a,mouse:s}=i,l=Ip(o),u=Ot(i);if(n.type==="MOVE_NODES"){if(Y8(u,l,a,n)){let{scale:d,translateVector:f}=Ix(u,l);if(e.dispatch(eu(d,f.dx,f.dy)),s.mouseToNodeVector){const g=new mr(d,new oe(f.dx,f.dy)).inverse(n.newMousePosition||s.mousePosition).translate(s.mouseToNodeVector.scale(a.scale));g.vectorFrom(n.nodePositions[0].position).distance()>1&&window.requestAnimationFrame(()=>e.dispatch(ZA({nodeId:n.nodePositions[0].nodeId,oldMousePosition:n.oldMousePosition,newMousePosition:null,forcedNodePosition:g})))}}}else{let{scale:c,translateVector:d}=Ix(u,l);if(c)if(n.type==="MOVE_NODES_END_DRAG"){if(c>a.scale){let f=0,p=1e3,y=60;const g=new mr(c,new oe(d.dx,d.dy)),{scaleTable:w,panningTable:h}=X8(a,g,p/y),v=()=>{setTimeout(()=>{const m=w[f],b=h[f];e.dispatch(eu(m,b.dx,b.dy)),f++,f{let r=e.scale;const o=(t.scale-r)/n;let a={dx:e.offset.dx,dy:e.offset.dy};const s={dx:(t.offset.dx-a.dx)/n,dy:(t.offset.dy-a.dy)/n},l=[],u=[];let c=0;for(;c{const o={graph:e,cachedImages:t,selection:{entities:[]}},a=Ot(o),s=VA(o),l=a.boundingBox()||{left:0,top:0,right:100,bottom:100},u=window.document.createElement("canvas"),c=Math.ceil(n*l.width),d=Math.ceil(n*l.height);if(c*d>r)throw new Error("Too Big to render safely.");const f=new mr(n,new oe(-n*l.left,-n*l.top));u.width=c,u.height=d;const p=u.getContext("2d"),y=new D0(p);return i||(p.fillStyle=a.style["background-color"],p.fillRect(0,0,c,d)),s.draw(y,{viewTransformation:f}),a.draw(y,{viewTransformation:f}),{width:c,height:d,dataUrl:u.toDataURL()}},Z8=(e,t)=>{const i=Ot({graph:e,cachedImages:t,selection:{entities:[]}}).boundingBox()||{left:0,top:0,right:100,bottom:100},o=1600,a=o*o,s=i.width*i.height,l=Math.sqrt(a/s);return k_(e,t,l,1/0,!1)},G0=["https://www.googleapis.com/discovery/v1/apis/drive/v3/rest"],B0="https://www.googleapis.com/auth/drive.file https://www.googleapis.com/auth/drive.install",e6=e=>{const t=()=>{window.gapi.client.init({apiKey:Ei.apiKey,clientId:Ei.clientId,discoveryDocs:G0,scope:B0}).then(()=>{window.gapi.auth2.getAuthInstance().isSignedIn.listen(n),n(window.gapi.auth2.getAuthInstance().isSignedIn.get())})},n=r=>{e.dispatch(z5(r))};window.gapi&&window.gapi.load("client:auth2:picker:drive-share",t)},t6=(e,t)=>{window.gapi.client.drive.files.update({fileId:e,resource:{name:t}}).then(function(n){console.log("Response",n)},function(n){console.error("Execute error",n)})},n6=e=>e.substring(22).replace(/\+/g,"-").replace(/\//g,"_"),Nx=(e,t,n,r,i)=>{const o="-------314159265358979323846",a=`\r --`+o+`\r `,s=`\r --`+o+"--",l="application/vnd.neo4j.arrows+json",u={name:`${r}`,mimeType:l,contentHints:{thumbnail:{image:n6(Z8(e,t).dataUrl),mimeType:"image/png"},indexableText:xL(e)}},c=a+`Content-Type: application/json; charset=UTF-8\r \r `+JSON.stringify(u)+a+"Content-Type: "+l+`\r \r `+JSON.stringify({graph:e})+s;window.gapi.client.request({path:`/upload/drive/v3/files${n?"/"+n:""}`,method:n?"PATCH":"POST",params:{uploadType:"multipart",supportsAllDrives:!0},headers:{"Content-Type":'multipart/related; boundary="'+o+'"'},body:c}).execute(f=>{f.error?console.log(f):i(f.id)})},Mv=[],r6=1e3,i6=500;let Rx;const kx=(e,t)=>{clearTimeout(Rx),Rx=setTimeout(e,t)},o6=[qt.ActionCreators.undo().type,qt.ActionCreators.redo().type],a6=e=>t=>n=>{const r=d=>({...d,graph:Re(d)}),i=r(e.getState()),o=t(n),a=r(e.getState()),s=a.storage,l=a.graph,u=a.cachedImages,c=a.diagramName;if(n.type==="RENAME_DIAGRAM")switch(s.mode){case"GOOGLE_DRIVE":t6(s.fileId,n.diagramName);break;case"LOCAL_STORAGE":tu(s.fileId,{graph:l,diagramName:c});break}if(s.mode==="GOOGLE_DRIVE"&&a.googleDrive.signedIn)switch(s.status){case"GET":{const d=s.fileId;e.dispatch(q5(d));break}case"POST":{e.dispatch(K5());const d=f=>{e.dispatch(G5(f))};Nx(l,u,null,a.diagramName,d);break}}if(s.mode==="LOCAL_STORAGE")switch(s.status){case"GET":{const d=s.fileId;e.dispatch(Z5(d));break}case"POST":{const d=s.fileId;tu(d,{graph:l,diagramName:c}),e.dispatch(B5());break}}if(n.category==="GRAPH"||o6.includes(n.type))switch(s.mode){case"LOCAL_STORAGE":(i.graph!==a.graph||i.gangs!==a.gangs)&&(i.storage.status!=="PUTTING"&&e.dispatch(bx()),kx(()=>{tu(s.fileId,{graph:l,diagramName:c}),e.dispatch(wx())},i6));break;case"GOOGLE_DRIVE":(i.graph!==a.graph||i.gangs!==a.gangs)&&(i.storage.status!=="PUT"&&e.dispatch(V5()),kx(()=>{e.dispatch(bx()),Nx(l,u,s.fileId,a.diagramName,d=>{d!==s.fileId&&console.warn("Unexpected change of fileId from %o to %o",s.fileId,d),e.dispatch(wx())})},r6));break;case"DATABASE":n.category==="GRAPH"&&(Mv.push(n),s6(a));break}return o},s6=e=>{const t=()=>{if(Mv.length>0){const n=Mv.shift();w5(n,e).then(()=>{t()}).catch(r=>console.log(r))}};t()},$_=(e,t)=>({type:"WINDOW_RESIZED",width:e,height:t}),l6=()=>({type:"TOGGLE_INSPECTOR"}),u6=()=>({type:"STYLE_THEME"}),c6=()=>({type:"STYLE_CUSTOMIZE"}),D_=(e,t,n)=>({type:"UPDATE_RECENT_STORAGE",mode:e,fileId:t,diagramName:n,timestamp:Date.now()}),d6=e=>t=>n=>{const i=e.getState().storage,o=t(n),a=e.getState(),s=a.storage;return i!==s&&s.status==="READY"&&e.dispatch(D_(s.mode,s.fileId,a.diagramName)),n.type==="UPDATE_RECENT_STORAGE"&&e8(a.recentStorage),o},f6=e=>{const{storage:t,diagramName:n}=e;return D_(t.mode,t.fileId,n)},lm=(e,t)=>({type:"IMAGE_EVENT",imageUrl:e,cachedImage:t}),p6=e=>t=>n=>{const r=t(n);if(n.category==="GRAPH"){const i=e.getState(),o=Re(i),a=i.cachedImages,s=h6(o);for(const l of s)if(!H3(a,l)){const u=G3(l,c=>{e.dispatch(lm(l,c))},c=>{e.dispatch(lm(l,c))});e.dispatch(lm(l,u))}}return r},h6=e=>{const t=new Set;um(t,e.style);for(const n of e.nodes)um(t,n.style);for(const n of e.relationships)um(t,n.style);return t},um=(e,t)=>{for(const[n,r]of Object.entries(t))cL.includes(n)&&r&&e.add(r)};class g6{constructor(t,n){this.visualGraph=t,this.gestures=n;const r=i=>t.style[i];this.marqueeColor=Wt(Lr,r),this.newEntityColor=Wt(QM,r),this.ringReadyColor=Wt(XM,r)}draw(t,n){const{visualGraph:r,gestures:i}=this,{dragToCreate:o,selectionMarquee:a}=i,s=n.viewTransformation,l=d=>s.transform(d),u=(d,f)=>[d,{x:f.x,y:d.y},f,{x:d.x,y:f.y},d];if(a&&r.graph.nodes.length>0){const d={from:l(a.from),to:l(a.to)},f=u(d.from,d.to);t.save(),t.strokeStyle=this.marqueeColor,L3(t,f,!1,!0),t.restore()}const c=(d,f,p)=>{const y=r.nodes[d];let g=r.graph.style.radius;if(y){const w=y.radius,h=w+JO,v=y.position,m=r.nodes[f];if(m&&(g=m.radius),p){const b=p.vectorFrom(v);let x=v;if(b.distance(){const p=r.nodes[o.sourceNodeId],g=r.nodes[d].position.vectorFrom(p.position),w=o.targetNodeIds[f+1];if(w){const h=r.nodes[w];c(d,o.targetNodeIds[f+1],h.position)}else c(d,null,o.newNodePosition.translate(g))}),t.restore())}}class m6{constructor(t,n){this.guides=n;const r=i=>t.style[i];this.lineColor=Wt(JM,r),this.handleColor=Wt(qi,r),this.actualPositionColor=Wt(ZM,r)}draw(t,n){const r=o=>n.viewTransformation.transform(o),i=n.viewTransformation.scale;this.guides.guidelines.forEach(o=>{switch(o.type){case"HORIZONTAL":const a=r(new Y(0,o.y)).y;am(t,new Y(0,a),new Y(n.canvasSize.width,a),this.lineColor);break;case"VERTICAL":const s=r(new Y(o.x,0)).x;am(t,new Y(s,0),new Y(s,n.canvasSize.height),this.lineColor);break;case"LINE":const l=r(o.center),u=n.canvasSize.width+n.canvasSize.height,c=new oe(u,0).rotate(o.angle);am(t,l.translate(c.invert()),l.translate(c),this.lineColor);break;case"CIRCLE":M3(t,r(o.center),o.radius*i,this.lineColor);break;case"HANDLE":const d=new oe(-Et/2,-Et/2),f=r(o.handlePosition).translate(d);Pv(t,f,Et,Et,3,this.handleColor);break;default:console.warn("Don't know how to render guideline of type: ",o.type)}})}drawActualPosition(t,n){if(this.guides.naturalPosition){const i=(o=>n.viewTransformation.transform(o))(this.guides.naturalPosition);t.fillStyle=this.actualPositionColor,t.circle(i.x,i.y,this.guides.naturalRadius*n.viewTransformation.scale,!0,!1)}}}const di=(()=>{let e=[];return{register:(t,n)=>e.push({name:t,draw:n}),clear:()=>{e=[]},renderAll:(t,n)=>{e.forEach(r=>r.draw(t,n))}}})(),v6=({visuals:e,canvas:t,displayOptions:n})=>{const{visualGraph:r,backgroundImage:i,gestures:o,guides:a,handles:s}=e,l=t.getContext("2d");l.clearRect(0,0,n.canvasSize.width,n.canvasSize.height);const u=new g6(r,o),c=new m6(r,a);di.clear(),di.register("BACKGROUND IMAGE",i.draw.bind(i)),di.register("GUIDES ACTUAL POSITION",c.drawActualPosition.bind(c)),di.register("GESTURES",u.draw.bind(u)),di.register("GRAPH",r.draw.bind(r)),di.register("HANDLES",s.draw.bind(s)),di.register("GUIDES SNAP LINES",c.draw.bind(c)),di.renderAll(new D0(l),n)};var Af={exports:{}};Af.exports;(function(e,t){var n=200,r="Expected a function",i="__lodash_hash_undefined__",o=1,a=2,s=1/0,l=9007199254740991,u=17976931348623157e292,c=0/0,d="[object Arguments]",f="[object Array]",p="[object Boolean]",y="[object Date]",g="[object Error]",w="[object Function]",h="[object GeneratorFunction]",v="[object Map]",m="[object Number]",b="[object Object]",x="[object Promise]",C="[object RegExp]",P="[object Set]",O="[object String]",N="[object Symbol]",k="[object WeakMap]",D="[object ArrayBuffer]",L="[object DataView]",B="[object Float32Array]",q="[object Float64Array]",Q="[object Int8Array]",se="[object Int16Array]",be="[object Int32Array]",M="[object Uint8Array]",J="[object Uint8ClampedArray]",re="[object Uint16Array]",de="[object Uint32Array]",fe=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Ve=/^\w*$/,je=/^\./,Ye=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Ze=/[\\^$.*+?()[\]{}|]/g,Mt=/^\s+|\s+$/g,Hn=/\\(\\)?/g,tr=/^[-+]0x[0-9a-f]+$/i,eo=/^0b[01]+$/i,Xo=/^\[object .+?Constructor\]$/,Lt=/^0o[0-7]+$/i,nr=/^(?:0|[1-9]\d*)$/,Oe={};Oe[B]=Oe[q]=Oe[Q]=Oe[se]=Oe[be]=Oe[M]=Oe[J]=Oe[re]=Oe[de]=!0,Oe[d]=Oe[f]=Oe[D]=Oe[p]=Oe[L]=Oe[y]=Oe[g]=Oe[w]=Oe[v]=Oe[m]=Oe[b]=Oe[C]=Oe[P]=Oe[O]=Oe[k]=!1;var Eh=parseInt,ll=typeof yi=="object"&&yi&&yi.Object===Object&&yi,_c=typeof self=="object"&&self&&self.Object===Object&&self,rr=ll||_c||Function("return this")(),Ic=t&&!t.nodeType&&t,ir=Ic&&!0&&e&&!e.nodeType&&e,Jo=ir&&ir.exports===Ic,ul=Jo&&ll.process,cl=function(){try{return ul&&ul.binding("util")}catch{}}(),Zo=cl&&cl.isTypedArray;function Nc(S,A){for(var $=-1,G=S?S.length:0;++$-1}function b2(S,A){var $=this.__data__,G=Fc($,S);return G<0?$.push([S,A]):$[G][1]=A,this}Nr.prototype.clear=g2,Nr.prototype.delete=m2,Nr.prototype.get=v2,Nr.prototype.has=y2,Nr.prototype.set=b2;function Rr(S){var A=-1,$=S?S.length:0;for(this.clear();++A<$;){var G=S[A];this.set(G[0],G[1])}}function w2(){this.__data__={hash:new to,map:new(dl||Nr),string:new to}}function E2(S){return Hc(this,S).delete(S)}function x2(S){return Hc(this,S).get(S)}function S2(S){return Hc(this,S).has(S)}function C2(S,A){return Hc(this,S).set(S,A),this}Rr.prototype.clear=w2,Rr.prototype.delete=E2,Rr.prototype.get=x2,Rr.prototype.has=S2,Rr.prototype.set=C2;function Lc(S){var A=-1,$=S?S.length:0;for(this.__data__=new Rr;++A<$;)this.add(S[A])}function T2(S){return this.__data__.set(S,i),this}function P2(S){return this.__data__.has(S)}Lc.prototype.add=Lc.prototype.push=T2,Lc.prototype.has=P2;function kr(S){this.__data__=new Nr(S)}function O2(){this.__data__=new Nr}function A2(S){return this.__data__.delete(S)}function _2(S){return this.__data__.get(S)}function I2(S){return this.__data__.has(S)}function N2(S,A){var $=this.__data__;if($ instanceof Nr){var G=$.__data__;if(!dl||G.length-1?ae[te?A[we]:we]:void 0}}function pw(S,A,$,G,ae,te){var we=ae&a,_e=S.length,Qe=A.length;if(_e!=Qe&&!(we&&Qe>_e))return!1;var rt=te.get(S);if(rt&&te.get(A))return rt==A;var At=-1,Ft=!0,it=ae&o?new Lc:void 0;for(te.set(S,A),te.set(A,S);++At<_e;){var wn=S[At],En=A[At];if(G)var li=we?G(En,wn,At,A,S,te):G(wn,En,At,S,A,te);if(li!==void 0){if(li)continue;Ft=!1;break}if(it){if(!Nc(A,function($r,io){if(!it.has(io)&&(wn===$r||$(wn,$r,G,ae,te)))return it.add(io)})){Ft=!1;break}}else if(!(wn===En||$(wn,En,G,ae,te))){Ft=!1;break}}return te.delete(S),te.delete(A),Ft}function W2(S,A,$,G,ae,te,we){switch($){case L:if(S.byteLength!=A.byteLength||S.byteOffset!=A.byteOffset)return!1;S=S.buffer,A=A.buffer;case D:return!(S.byteLength!=A.byteLength||!G(new lw(S),new lw(A)));case p:case y:case m:return vw(+S,+A);case g:return S.name==A.name&&S.message==A.message;case C:case O:return S==A+"";case v:var _e=YR;case P:var Qe=te&a;if(_e||(_e=XR),S.size!=A.size&&!Qe)return!1;var rt=we.get(S);if(rt)return rt==A;te|=o,we.set(S,A);var At=pw(_e(S),_e(A),G,ae,te,we);return we.delete(S),At;case N:if(Ah)return Ah.call(S)==Ah.call(A)}return!1}function V2(S,A,$,G,ae,te){var we=ae&a,_e=Uc(S),Qe=_e.length,rt=Uc(A),At=rt.length;if(Qe!=At&&!we)return!1;for(var Ft=Qe;Ft--;){var it=_e[Ft];if(!(we?it in A:Ir.call(A,it)))return!1}var wn=te.get(S);if(wn&&te.get(A))return wn==A;var En=!0;te.set(S,A),te.set(A,S);for(var li=we;++Ft-1&&S%1==0&&S-1&&S%1==0&&S<=l}function na(S){var A=typeof S;return!!S&&(A=="object"||A=="function")}function Bc(S){return!!S&&typeof S=="object"}function zc(S){return typeof S=="symbol"||Bc(S)&&ea.call(S)==N}var nk=Zo?KR(Zo):F2;function rk(S){if(!S)return S===0?S:0;if(S=ok(S),S===s||S===-s){var A=S<0?-1:1;return A*u}return S===S?S:0}function ik(S){var A=rk(S),$=A%1;return A===A?$?A-$:A:0}function ok(S){if(typeof S=="number")return S;if(zc(S))return c;if(na(S)){var A=typeof S.valueOf=="function"?S.valueOf():S;S=na(A)?A+"":A}if(typeof S!="string")return S===0?S:+S;S=S.replace(Mt,"");var $=eo.test(S);return $||Lt.test(S)?Eh(S.slice(2),$?2:8):tr.test(S)?c:+S}function ak(S){return S==null?"":z2(S)}function sk(S,A,$){var G=S==null?void 0:cw(S,A);return G===void 0?$:G}function lk(S,A){return S!=null&&q2(S,A,$2)}function Uc(S){return Nh(S)?R2(S):H2(S)}function uk(S){return S}function ck(S){return jc(S)?kc(Gc(S)):B2(S)}e.exports=ek})(Af,Af.exports);var y6=Af.exports;const $x=pn(y6);function Lv(e,t){return Lv=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,i){return r.__proto__=i,r},Lv(e,t)}function ke(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,Lv(e,t)}var M_={};Object.defineProperty(M_,"__esModule",{value:!0});M_.createChangeEmitter=function(){var t=[],n=t;function r(){n===t&&(n=t.slice())}function i(a){if(typeof a!="function")throw new Error("Expected listener to be a function.");var s=!0;return r(),n.push(a),function(){if(s){s=!1,r();var l=n.indexOf(a);n.splice(l,1)}}}function o(){t=n;for(var a=t,s=0;s$x(W_,({bindings:o})=>$x(o,a=>(i===a.code||a.codeRange&&i>=a.codeRange.min&&i<=a.codeRange.max)&&(a.altKey==="optional"||e===!!a.altKey)&&(a.ctrlKey==="optional"||t===!!a.ctrlKey||!Ya&&t===!!a.metaKey)&&(a.metaKey==="optional"||n===!!a.metaKey||!Ya&&t===!!a.metaKey)&&(a.shiftKey==="optional"||r===!!a.shiftKey))),_6={registerAction:(e,t)=>W_[e]={bindings:U_[e],handler:t},fireAction:(e,...t)=>{const n=A6(e);return n&&n.handler({altKey:e.altKey,ctrlKey:e.ctrlKey,metaKey:e.metaKey,shiftKey:e.shiftKey},...t),!!n}},wd=e=>{const t=U_[e][0];let n="";const r=i=>n+=n.length>0?" "+i:i;return t.shiftKey&&r("⇧"),t.metaKey&&r(Ya?"⌘":"Ctrl"),t.altKey&&r(Ya?"⌥":"Alt"),t.ctrlKey&&r(Ya?"^":"?"),n+=" "+String.fromCharCode(t.code),n},cm=({target:{tagName:e}})=>e==="INPUT"||e==="TEXTAREA"||e==="SELECT",V_=x6(_6);class I6{constructor(t){this.canvas=t,this.canvas.addEventListener("wheel",this.handleWheel.bind(this)),this.canvas.addEventListener("dblclick",this.handleDoubleClick.bind(this)),this.canvas.addEventListener("mousemove",this.handleMouseMove.bind(this)),this.canvas.addEventListener("mousedown",this.handleMouseDown.bind(this)),this.canvas.addEventListener("mouseup",this.handleMouseUp.bind(this)),this.canvas.addEventListener("mouseleave",this.handleMouseLeave.bind(this))}setDispatch(t){this.dispatch=t}handleWheel(t){this.dispatch(G4(this.canvasPosition(t),new oe(t.deltaX,t.deltaY),t.ctrlKey)),t.preventDefault()}handleDoubleClick(t){this.dispatch(z4(this.canvasPosition(t))),t.preventDefault()}handleMouseMove(t){t.button===0&&(this.dispatch(Q4(this.canvasPosition(t))),t.preventDefault())}handleMouseDown(t){t.button===0&&(this.dispatch(U4(this.canvasPosition(t),Ya?t.metaKey:t.ctrlKey)),t.preventDefault())}handleMouseUp(t){t.button===0&&(this.dispatch(X4(this.canvasPosition(t))),t.preventDefault())}handleMouseLeave(t){this.dispatch(JA()),t.preventDefault()}canvasPosition(t){let n=this.canvas.getBoundingClientRect();return new Y(t.clientX-n.left,t.clientY-n.top)}}class N6 extends R.Component{constructor(t){super(t),this.state={},this.textArea=E.createRef()}componentDidMount(){this.textArea.current.select()}shouldComponentUpdate(t,n,r){return t.visualNode!==this.props.visualNode}componentDidUpdate(){const t=this.textArea.current;document.activeElement===t&&(t.selectionStart=this.state.selectionStart,t.selectionEnd=this.state.selectionStart)}handleChange=t=>{const n=o=>o.replace(/\s+/g," "),r=n(t.target.value.substring(0,t.target.selectionStart)).length,i=n(t.target.value);this.setState({selectionStart:r}),this.props.onSetNodeCaption(i)};render(){const t=this.props.component,n=t.boundingBox(),r=t.layout.lines,i=10,o=t.orientation.horizontal;return T("textarea",{ref:this.textArea,value:r.join(` `),onKeyDown:this.props.onKeyDown,onChange:this.handleChange,style:{position:"absolute",padding:0,left:n.left-(o==="start"?0:i),top:n.top,width:n.width+i+(o==="center"?i:0),height:n.height+i,resize:"none",outline:"none",border:"none",background:"transparent",textAlign:Z3(o),...t.font,lineHeight:1.2}})}}class R6 extends R.PureComponent{constructor(t){super(t),this.input=E.createRef()}componentDidMount(){this.input.current.select()}handleChange=t=>{const n=t.target.value;this.props.onSetRelationshipType(n)};render(){const t=this.props.component,n=t.text,r=10,i=t.width;return T("input",{ref:this.input,value:n,onKeyDown:this.props.onKeyDown,onChange:this.handleChange,style:{position:"absolute",padding:0,left:t.boxPosition.x+t.borderWidth+t.padding,top:t.boxPosition.y,width:i+r,height:t.font.fontSize*1.2,resize:"none",outline:"none",border:"none",background:"transparent",textAlign:"left",...t.font,lineHeight:1.2}})}}class k6 extends R.Component{handleChange=t=>{this.props.onSetPropertyKey(t.target.value)};render(){return T("input",{value:this.props.text,onKeyDown:this.props.onKeyDown,onChange:this.handleChange,style:{position:"absolute",padding:0,left:this.props.left-10,top:this.props.top,width:this.props.width+10,height:this.props.font.fontSize*1.2,outline:"none",border:"none",background:"transparent",textAlign:"right",...this.props.font,lineHeight:1.2}})}}class $6 extends R.Component{handleChange=t=>{this.props.onSetPropertyValue(t.target.value)};render(){return T("input",{value:this.props.text,onKeyDown:this.props.onKeyDown,onChange:this.handleChange,style:{position:"absolute",padding:0,left:this.props.left,top:this.props.top,width:this.props.width+10,height:this.props.font.fontSize*1.2,outline:"none",border:"none",background:"transparent",textAlign:"left",...this.props.font,lineHeight:1.2}})}}class D6 extends R.Component{constructor(t){super(t)}shouldComponentUpdate(t,n,r){return t.visualNode!==this.props.visualNode}render(){const t=this.props.visualNode.properties,n=t.boxPosition,r=t.propertiesBox,{selection:i,onSetPropertyKey:o,onSetPropertyValue:a}=this.props;return t.propertiesBox.properties.map((s,l)=>[T(k6,{text:s.key,left:n.x,top:n.y+l*r.lineHeight,width:r.keysWidth,font:r.font,onSetPropertyKey:u=>o(i,s.key,u),onKeyDown:this.props.onKeyDown},"key-"+l),T($6,{text:s.value,left:n.x+r.keysWidth+r.colonWidth+r.spaceWidth,top:n.y+l*r.lineHeight,width:r.valuesWidth,font:r.font,onSetPropertyValue:u=>a(i,s.key,u),onKeyDown:this.props.onKeyDown},"value-"+l)])}}class M6 extends R.Component{constructor(t){super(t)}shouldComponentUpdate(t,n,r){return t.visualNode!==this.props.visualNode}render(){const t=this.props.visualNode.labels,{selection:n,onRenameLabel:r}=this.props,i=10;return t.pills.map((o,a)=>{const s=t.pillPositions[a],l=o.font.fontSize*1.2;return T("input",{value:o.text,onKeyDown:this.props.onKeyDown,onChange:u=>r(n,o.text,u.target.value),style:{position:"absolute",padding:0,left:s.dx+o.radius,top:s.dy+(o.height-l)/2,width:o.width+i,height:l,resize:"none",outline:"none",border:"none",background:"transparent",textAlign:"left",...o.font,lineHeight:1.2}},"pill-"+a)})}}const L6=["CAPTION","LABELS","TYPE","PROPERTIES"],Tl=e=>L6.indexOf(e.component.type)!==-1;class F6 extends R.Component{constructor(t){super(t)}entityEditor(t){switch(t.entityType){case"node":const n=this.props.visualGraph.nodes[t.id];let r=n.insideComponents,i=n.outsideComponents;if(r.isEmpty(Tl)&&i.isEmpty(Tl)){const a=l=>wr(n.node,l)(this.props.visualGraph.graph);switch(a("caption-position")){case"inside":const l=new NA("",n.radius,"true",a,Ka);r=new Va,r.push(l);break;default:const u=new IA("",n.outsideOrientation,!0,a,Ka);i=new Va,i.push(u);break}}return F("div",{style:{transform:n.position.vectorFromOrigin().asCSSTransform()},children:[r.offsetComponents.filter(Tl).map(a=>T("div",{style:{transform:[`scale(${n.internalScaleFactor})`,`translate(0, ${n.internalVerticalOffset+a.top}px)`].join(" ")},children:this.componentEditor(n,a.component)},a.component.type)),i.offsetComponents.filter(Tl).map(a=>T("div",{style:{transform:n.outsideOffset.plus(new oe(0,a.top)).asCSSTransform()},children:this.componentEditor(n,a.component)},a.component.type))]});case"relationship":let o=null;if(this.props.visualGraph.relationshipBundles.forEach(a=>{a.routedRelationships.forEach(s=>{s.id===t.id&&(o=s)})}),o){let a=o.components;if(a.isEmpty(Tl)){const s=u=>wr(o.resolvedRelationship.relationship,u)(this.props.visualGraph.graph),l=new FA("",{horizontal:"center",vertical:"center"},!0,s,Ka);a=new Va,a.push(l)}return a.offsetComponents.map(s=>T("div",{style:{transform:[o.arrow.midPoint().vectorFromOrigin().asCSSTransform(),`rotate(${o.componentRotation}rad)`,o.componentOffset.plus(new oe(0,s.top)).asCSSTransform()].join(" ")},children:this.componentEditor(o,s.component)},s.component.type))}break}return null}componentEditor(t,n){switch(n.type){case"CAPTION":return T(N6,{visualNode:t,component:n,onSetNodeCaption:r=>this.props.onSetNodeCaption(this.props.selection,r),onKeyDown:this.handleKeyDown},"caption-"+t.id);case"LABELS":return T(M6,{visualNode:t,selection:this.props.selection,onAddLabel:this.props.onAddLabel,onRenameLabel:this.props.onRenameLabel,onKeyDown:this.handleKeyDown},"labels-"+t.id);case"TYPE":return T(R6,{visualRelationship:t,component:n,onSetRelationshipType:r=>this.props.onSetRelationshipType(this.props.selection,r),onKeyDown:this.handleKeyDown});case"PROPERTIES":return T(D6,{visualNode:t,selection:this.props.selection,onSetPropertyKey:this.props.onSetPropertyKey,onSetPropertyValue:this.props.onSetPropertyValue,onKeyDown:this.handleKeyDown},"properties-"+t.id)}}render(){const t=this.props.selection.editing;return t?T("div",{style:{transform:this.props.viewTransformation.asCSSTransform(),position:"absolute",left:0,top:0},children:this.entityEditor(t)}):null}handleKeyDown=t=>{(t.key==="Escape"||t.key==="Enter"&&t.metaKey)&&this.props.onExit()}}const H6=e=>({visualGraph:Ot(e),selection:e.selection,viewTransformation:e.viewTransformation}),j6=e=>({onExit:()=>{e(O4())},onAddLabel:(t,n)=>{e(e_(t,n))},onRenameLabel:(t,n,r)=>{e(t_(t,n,r))},onRemoveLabel:(t,n)=>{e(n_(t,n))},onSetNodeCaption:(t,n)=>{e(Rp(t,n))},onSetRelationshipType:(t,n)=>{e(o_(t,n))},onSetPropertyKey:(t,n,r)=>{e(r_(t,n,r))},onSetPropertyValue:(t,n,r)=>{e(i_(t,n,r))}}),G6=Xt(H6,j6)(F6);class B6 extends R.Component{constructor(t){super(t),t.registerAction(U0,()=>t.duplicateSelection()),t.registerAction(F_,()=>t.deleteSelection()),t.registerAction(z0,()=>t.selectAll()),t.registerAction(H_,n=>t.jumpToNextNode("LEFT",n)),t.registerAction(j_,n=>t.jumpToNextNode("UP",n)),t.registerAction(G_,n=>t.jumpToNextNode("RIGHT",n)),t.registerAction(B_,n=>t.jumpToNextNode("DOWN",n)),t.registerAction(z_,()=>t.tryActivateEditing()),this.registerOptionalActions(t)}registerOptionalActions(t){const n=["GOOGLE_DRIVE","LOCAL_STORAGE"].includes(t.storage.mode);t.registerAction(W0,(()=>n&&t.undo()).bind(this)),t.registerAction(V0,(()=>n&&t.redo()).bind(this))}componentWillReceiveProps(t,n){t.storage.mode!==this.props.storage.mode&&this.registerOptionalActions(t)}componentDidMount(){this.touchHandler=new I6(this.canvas),this.fitCanvasSize(this.canvas,this.props.canvasSize.width,this.props.canvasSize.height),this.drawVisuals()}componentDidUpdate(){this.fitCanvasSize(this.canvas,this.props.canvasSize.width,this.props.canvasSize.height),this.drawVisuals()}render(){return F("div",{style:{transform:"translate(0, 0)"},children:[T("canvas",{style:{display:"block",backgroundColor:this.props.visualGraph.style["background-color"]},ref:t=>this.canvas=t}),T(G6,{})]})}fitCanvasSize(t,n,r){t.width=n,t.height=r,t.style.width=n+"px",t.style.height=r+"px";const i=t.getContext("2d"),o=window.devicePixelRatio||1,a=i.webkitBackingStorePixelRatio||i.mozBackingStorePixelRatio||i.msBackingStorePixelRatio||i.oBackingStorePixelRatio||i.backingStorePixelRatio||1,s=o/a;return o!==a&&(t.width=n*s,t.height=r*s,t.style.width=n+"px",t.style.height=r+"px",i.scale(s,s)),s}drawVisuals(){const{visualGraph:t,backgroundImage:n,selection:r,gestures:i,guides:o,handles:a,toolboxes:s,viewTransformation:l,canvasSize:u}=this.props;v6({visuals:{visualGraph:t,backgroundImage:n,selection:r,gestures:i,guides:o,handles:a,toolboxes:s},canvas:this.canvas,displayOptions:{canvasSize:u,viewTransformation:l}}),this.touchHandler.setDispatch(this.props.dispatch)}}const z6=e=>({visualGraph:Ot(e),backgroundImage:VA(e),selection:e.selection,gestures:e.gestures,guides:e.guides,handles:KA(e),canvasSize:Ip(e.applicationLayout),viewTransformation:e.viewTransformation,storage:e.storage}),U6=e=>({duplicateSelection:()=>e(s_()),deleteSelection:()=>e(a_()),selectAll:()=>e(A4()),jumpToNextNode:(t,n)=>e(I4(t,n)),undo:()=>e(qt.ActionCreators.undo()),redo:()=>e(qt.ActionCreators.redo()),tryActivateEditing:()=>e(P4()),dispatch:e}),W6=L_(Xt(z6,U6),V_)(B6);var K_={exports:{}},Te={};/** @license React v16.13.1 * react-is.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var ut=typeof Symbol=="function"&&Symbol.for,K0=ut?Symbol.for("react.element"):60103,q0=ut?Symbol.for("react.portal"):60106,Lp=ut?Symbol.for("react.fragment"):60107,Fp=ut?Symbol.for("react.strict_mode"):60108,Hp=ut?Symbol.for("react.profiler"):60114,jp=ut?Symbol.for("react.provider"):60109,Gp=ut?Symbol.for("react.context"):60110,Y0=ut?Symbol.for("react.async_mode"):60111,Bp=ut?Symbol.for("react.concurrent_mode"):60111,zp=ut?Symbol.for("react.forward_ref"):60112,Up=ut?Symbol.for("react.suspense"):60113,V6=ut?Symbol.for("react.suspense_list"):60120,Wp=ut?Symbol.for("react.memo"):60115,Vp=ut?Symbol.for("react.lazy"):60116,K6=ut?Symbol.for("react.block"):60121,q6=ut?Symbol.for("react.fundamental"):60117,Y6=ut?Symbol.for("react.responder"):60118,Q6=ut?Symbol.for("react.scope"):60119;function vn(e){if(typeof e=="object"&&e!==null){var t=e.$$typeof;switch(t){case K0:switch(e=e.type,e){case Y0:case Bp:case Lp:case Hp:case Fp:case Up:return e;default:switch(e=e&&e.$$typeof,e){case Gp:case zp:case Vp:case Wp:case jp:return e;default:return t}}case q0:return t}}}function q_(e){return vn(e)===Bp}Te.AsyncMode=Y0;Te.ConcurrentMode=Bp;Te.ContextConsumer=Gp;Te.ContextProvider=jp;Te.Element=K0;Te.ForwardRef=zp;Te.Fragment=Lp;Te.Lazy=Vp;Te.Memo=Wp;Te.Portal=q0;Te.Profiler=Hp;Te.StrictMode=Fp;Te.Suspense=Up;Te.isAsyncMode=function(e){return q_(e)||vn(e)===Y0};Te.isConcurrentMode=q_;Te.isContextConsumer=function(e){return vn(e)===Gp};Te.isContextProvider=function(e){return vn(e)===jp};Te.isElement=function(e){return typeof e=="object"&&e!==null&&e.$$typeof===K0};Te.isForwardRef=function(e){return vn(e)===zp};Te.isFragment=function(e){return vn(e)===Lp};Te.isLazy=function(e){return vn(e)===Vp};Te.isMemo=function(e){return vn(e)===Wp};Te.isPortal=function(e){return vn(e)===q0};Te.isProfiler=function(e){return vn(e)===Hp};Te.isStrictMode=function(e){return vn(e)===Fp};Te.isSuspense=function(e){return vn(e)===Up};Te.isValidElementType=function(e){return typeof e=="string"||typeof e=="function"||e===Lp||e===Bp||e===Hp||e===Fp||e===Up||e===V6||typeof e=="object"&&e!==null&&(e.$$typeof===Vp||e.$$typeof===Wp||e.$$typeof===jp||e.$$typeof===Gp||e.$$typeof===zp||e.$$typeof===q6||e.$$typeof===Y6||e.$$typeof===Q6||e.$$typeof===K6)};Te.typeOf=vn;K_.exports=Te;var X6=K_.exports,dr=function(t,n){if(typeof t=="function"){t(n);return}t!==null&&typeof t=="object"&&(t.current=n)},Fv=function(t){return t!==null&&typeof t=="object"&&t.hasOwnProperty("current")},J6=function(e){ke(t,e);function t(){for(var r,i=arguments.length,o=new Array(i),a=0;a0?R.cloneElement(o,i):o;return R.createElement(a,{innerRef:r},s)},tH=Array.isArray;const We=tH;var nH=typeof global=="object"&&global&&global.Object===Object&&global;const Y_=nH;var rH=typeof self=="object"&&self&&self.Object===Object&&self,iH=Y_||rH||Function("return this")();const Jn=iH;var oH=Jn.Symbol;const xr=oH;var Q_=Object.prototype,aH=Q_.hasOwnProperty,sH=Q_.toString,Pl=xr?xr.toStringTag:void 0;function lH(e){var t=aH.call(e,Pl),n=e[Pl];try{e[Pl]=void 0;var r=!0}catch{}var i=sH.call(e);return r&&(t?e[Pl]=n:delete e[Pl]),i}var uH=Object.prototype,cH=uH.toString;function dH(e){return cH.call(e)}var fH="[object Null]",pH="[object Undefined]",Dx=xr?xr.toStringTag:void 0;function Pr(e){return e==null?e===void 0?pH:fH:Dx&&Dx in Object(e)?lH(e):dH(e)}function $n(e){return e!=null&&typeof e=="object"}var hH="[object Symbol]";function Kp(e){return typeof e=="symbol"||$n(e)&&Pr(e)==hH}var gH=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,mH=/^\w*$/;function Q0(e,t){if(We(e))return!1;var n=typeof e;return n=="number"||n=="symbol"||n=="boolean"||e==null||Kp(e)?!0:mH.test(e)||!gH.test(e)||t!=null&&e in Object(t)}function Yt(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var vH="[object AsyncFunction]",yH="[object Function]",bH="[object GeneratorFunction]",wH="[object Proxy]";function Ao(e){if(!Yt(e))return!1;var t=Pr(e);return t==yH||t==bH||t==vH||t==wH}var EH=Jn["__core-js_shared__"];const dm=EH;var Mx=function(){var e=/[^.]+$/.exec(dm&&dm.keys&&dm.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function xH(e){return!!Mx&&Mx in e}var SH=Function.prototype,CH=SH.toString;function Uo(e){if(e!=null){try{return CH.call(e)}catch{}try{return e+""}catch{}}return""}var TH=/[\\^$.*+?()[\]{}|]/g,PH=/^\[object .+?Constructor\]$/,OH=Function.prototype,AH=Object.prototype,_H=OH.toString,IH=AH.hasOwnProperty,NH=RegExp("^"+_H.call(IH).replace(TH,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function RH(e){if(!Yt(e)||xH(e))return!1;var t=Ao(e)?NH:PH;return t.test(Uo(e))}function kH(e,t){return e?.[t]}function Wo(e,t){var n=kH(e,t);return RH(n)?n:void 0}var $H=Wo(Object,"create");const Au=$H;function DH(){this.__data__=Au?Au(null):{},this.size=0}function MH(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var LH="__lodash_hash_undefined__",FH=Object.prototype,HH=FH.hasOwnProperty;function jH(e){var t=this.__data__;if(Au){var n=t[e];return n===LH?void 0:n}return HH.call(t,e)?t[e]:void 0}var GH=Object.prototype,BH=GH.hasOwnProperty;function zH(e){var t=this.__data__;return Au?t[e]!==void 0:BH.call(t,e)}var UH="__lodash_hash_undefined__";function WH(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=Au&&t===void 0?UH:t,this}function _o(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t-1}function JH(e,t){var n=this.__data__,r=qp(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}function ii(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t-1&&e%1==0&&e-1&&e%1==0&&e<=wj}var Ej=1/0;function Ws(e){if(typeof e=="string"||Kp(e))return e;var t=e+"";return t=="0"&&1/e==-Ej?"-0":t}function xj(e,t,n){t=dc(t,e);for(var r=-1,i=t.length,o=!1;++ri?0:i+t),n=n>i?i:n,n<0&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var o=Array(i);++r0){if(++t>=_j)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}var kj=Rj(Aj);const nI=kj;function pc(e,t){return nI(eI(e,t,fc),e+"")}var $j=pc(Tj);const V=$j;var rI={exports:{}},Dj="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",Mj=Dj,Lj=Mj;function iI(){}function oI(){}oI.resetWarningCache=iI;var Fj=function(){function e(r,i,o,a,s,l){if(l!==Lj){var u=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw u.name="Invariant Violation",u}}e.isRequired=e;function t(){return e}var n={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:oI,resetWarningCache:iI};return n.PropTypes=n,n};rI.exports=Fj();var aI=rI.exports;const H=pn(aI);function Hj(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function cs(e){return e===void 0}var jj=/\s/;function Gj(e){for(var t=e.length;t--&&jj.test(e.charAt(t)););return t}var Bj=/^\s+/;function zj(e){return e&&e.slice(0,Gj(e)+1).replace(Bj,"")}var Gx=0/0,Uj=/^[-+]0x[0-9a-f]+$/i,Wj=/^0b[01]+$/i,Vj=/^0o[0-7]+$/i,Kj=parseInt;function If(e){if(typeof e=="number")return e;if(Kp(e))return Gx;if(Yt(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=Yt(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=zj(e);var n=Wj.test(e);return n||Vj.test(e)?Kj(e.slice(2),n?2:8):Uj.test(e)?Gx:+e}var Bx=1/0,qj=17976931348623157e292;function Hv(e){if(!e)return e===0?e:0;if(e=If(e),e===Bx||e===-Bx){var t=e<0?-1:1;return t*qj}return e===e?e:0}function Z0(e){var t=Hv(e),n=t%1;return t===t?n?t-n:t:0}function sI(e,t){for(var n=-1,r=e==null?0:e.length,i=0,o=[];++ns))return!1;var u=o.get(e),c=o.get(t);if(u&&c)return u==t&&c==e;var d=-1,f=!0,p=n&QG?new ds:void 0;for(o.set(e,t),o.set(t,e);++d-1}function TI(e,t,n){for(var r=-1,i=e==null?0:e.length;++r-1?i[o?t[a]:a]:void 0}}var iz=Math.max;function zv(e,t,n){var r=e==null?0:e.length;if(!r)return-1;var i=n==null?0:Z0(n);return i<0&&(i=iz(r+i,0)),xI(e,Vo(t),i)}var oz=rz(zv);const OI=oz;function az(e,t){var n;return Ks(e,function(r,i,o){return n=t(r,i,o),!n}),!!n}function rb(e,t,n){if(!Yt(n))return!1;var r=typeof t;return(r=="number"?Or(n)&&Jp(t,n.length):r=="string"&&t in n)?uc(n[t],e):!1}function iu(e,t,n){var r=We(e)?gI:az;return n&&rb(e,t,n)&&(t=void 0),r(e,Vo(t))}var sz=function(t,n){return iu(R.Children.toArray(t),{type:n})},ee=function(t){return t==null||Array.isArray(t)&&t.length===0},lz={1:"one",2:"two",3:"three",4:"four",5:"five",6:"six",7:"seven",8:"eight",9:"nine",10:"ten",11:"eleven",12:"twelve",13:"thirteen",14:"fourteen",15:"fifteen",16:"sixteen"};function oS(e){var t=typeof e;return t==="string"||t==="number"?lz[e]||e:""}var _=function(t,n){return t&&n},Tt=function(t,n){return t&&t!==!0&&t+" "+n},Ae=function(t,n){return t&&(t===!0?n:t+" "+n)},kf=function(t,n){return!t||t===!0?null:t.replace("large screen","large-screen").replace(/ vertically/g,"-vertically").split(" ").map(function(r){return r.replace("-"," ")+" "+n}).join(" ")},yn=function(t){return t==="justified"?"justified":Tt(t,"aligned")},Qi=function(t){return Tt(t,"aligned")},St=function(t,n,r){if(n===void 0&&(n=""),r===void 0&&(r=!1),r&&t==="equal")return"equal width";var i=typeof t;return(i==="string"||i==="number")&&n?oS(t)+" "+n:oS(t)},uz=200;function AI(e,t,n,r){var i=-1,o=CI,a=!0,s=e.length,l=[],u=t.length;if(!s)return l;n&&(t=Xp(t,cI(n))),r?(o=TI,a=!1):t.length>=uz&&(o=tb,a=!1,t=new ds(t));e:for(;++i0&&n(s)?t>1?rh(s,t-1,n,r,i):vI(i,s):r||(i[i.length]=s)}return i}var dz=pc(function(e,t){return Nu(e)?AI(e,rh(t,1,Nu,!0)):[]});const sS=dz;function fz(e,t,n){var r=e.length;return n=n===void 0?r:n,!t&&n>=r?e:J0(e,t,n)}function pz(e){return e.split("")}var hz="\\ud800-\\udfff",gz="\\u0300-\\u036f",mz="\\ufe20-\\ufe2f",vz="\\u20d0-\\u20ff",yz=gz+mz+vz,bz="\\ufe0e\\ufe0f",wz="\\u200d",Ez=RegExp("["+wz+hz+yz+bz+"]");function ib(e){return Ez.test(e)}var _I="\\ud800-\\udfff",xz="\\u0300-\\u036f",Sz="\\ufe20-\\ufe2f",Cz="\\u20d0-\\u20ff",Tz=xz+Sz+Cz,Pz="\\ufe0e\\ufe0f",Oz="["+_I+"]",Uv="["+Tz+"]",Wv="\\ud83c[\\udffb-\\udfff]",Az="(?:"+Uv+"|"+Wv+")",II="[^"+_I+"]",NI="(?:\\ud83c[\\udde6-\\uddff]){2}",RI="[\\ud800-\\udbff][\\udc00-\\udfff]",_z="\\u200d",kI=Az+"?",$I="["+Pz+"]?",Iz="(?:"+_z+"(?:"+[II,NI,RI].join("|")+")"+$I+kI+")*",Nz=$I+kI+Iz,Rz="(?:"+[II+Uv+"?",Uv,NI,RI,Oz].join("|")+")",kz=RegExp(Wv+"(?="+Wv+")|"+Rz+Nz,"g");function $z(e){return e.match(kz)||[]}function Dz(e){return ib(e)?$z(e):pz(e)}function ob(e,t,n){t=="__proto__"&&_f?_f(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}var Mz=Object.prototype,Lz=Mz.hasOwnProperty;function DI(e,t,n){var r=e[t];(!(Lz.call(e,t)&&uc(r,n))||n===void 0&&!(t in e))&&ob(e,t,n)}function MI(e,t,n,r){if(!Yt(e))return e;t=dc(t,e);for(var i=-1,o=t.length,a=o-1,s=e;s!=null&&++i=0;i-=1)this.handlers[i].called||(this.handlers[i].called=!0,this.handlers[i](t));for(var o=r;o>=0;o-=1)this.handlers[o].called=!1}else(0,this.handlers[r])(t)}},{key:"hasHandlers",value:function(){return this.handlers.length>0}},{key:"removeHandlers",value:function(t){for(var n=[],r=this.handlers.length,i=0;i0;var n=this.handlerSets.get(t);return!!n&&n.hasHandlers()}},{key:"removeHandlers",value:function(t,n){var r=cS(this.handlerSets);if(!r.has(t))return new e(this.poolName,r);var i=r.get(t).removeHandlers(n);return i.hasHandlers()?r.set(t,i):r.delete(t),new e(this.poolName,r)}}]),e}();An(Vv,"createByType",function(e,t,n){var r=new Map;return r.set(t,new zI(n)),new Vv(e,r)});var nU=function(){function e(t){var n=this;hc(this,e),An(this,"handlers",new Map),An(this,"pools",new Map),An(this,"target",void 0),An(this,"createEmitter",function(r){return function(i){n.pools.forEach(function(o){o.dispatchEvent(r,i)})}}),this.target=t}return gc(e,[{key:"addHandlers",value:function(t,n,r){if(this.pools.has(t)){var i=this.pools.get(t);this.pools.set(t,i.addHandlers(n,r))}else this.pools.set(t,Vv.createByType(t,n,r));this.handlers.has(n)||this.addTargetHandler(n)}},{key:"hasHandlers",value:function(){return this.handlers.size>0}},{key:"removeHandlers",value:function(t,n,r){if(this.pools.has(t)){var i=this.pools.get(t).removeHandlers(n,r);i.hasHandlers()?this.pools.set(t,i):this.pools.delete(t);var o=!1;this.pools.forEach(function(a){return o=o||a.hasHandlers(n)}),o||this.removeTargetHandler(n)}}},{key:"addTargetHandler",value:function(t){var n=this.createEmitter(t);this.handlers.set(t,n),this.target.addEventListener(t,n,!0)}},{key:"removeTargetHandler",value:function(t){this.handlers.has(t)&&(this.target.removeEventListener(t,this.handlers.get(t),!0),this.handlers.delete(t))}}]),e}(),rU=function(){function e(){var t=this;hc(this,e),An(this,"targets",new Map),An(this,"getTarget",function(n){var r=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1],i=fS(n);if(t.targets.has(i))return t.targets.get(i);if(!r)return null;var o=new nU(i);return t.targets.set(i,o),o}),An(this,"removeTarget",function(n){t.targets.delete(fS(n))})}return gc(e,[{key:"sub",value:function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(lS.canUseDOM){var i=r.target,o=i===void 0?document:i,a=r.pool,s=a===void 0?"default":a;this.getTarget(o).addHandlers(s,t,dS(n))}}},{key:"unsub",value:function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(lS.canUseDOM){var i=r.target,o=i===void 0?document:i,a=r.pool,s=a===void 0?"default":a,l=this.getTarget(o,!1);l&&(l.removeHandlers(s,t,dS(n)),l.hasHandlers()||this.removeTarget(o))}}}]),e}(),Kv=new rU,hm=function(e){function t(){return hc(this,t),eU(this,GI(t).apply(this,arguments))}return Jz(t,Xz.PureComponent),gc(t,[{key:"componentDidMount",value:function(){this.subscribe(this.props)}},{key:"componentDidUpdate",value:function(n){this.unsubscribe(n),this.subscribe(this.props)}},{key:"componentWillUnmount",value:function(){this.unsubscribe(this.props)}},{key:"subscribe",value:function(n){var r=n.name,i=n.on,o=n.pool,a=n.target;Kv.sub(r,i,{pool:o,target:a})}},{key:"unsubscribe",value:function(n){var r=n.name,i=n.on,o=n.pool,a=n.target;Kv.unsub(r,i,{pool:o,target:a})}},{key:"render",value:function(){return null}}]),t}();An(hm,"defaultProps",{pool:"default",target:"document"}),hm.propTypes={},$f.instance=Kv,$f.default=hm;var lb;lb=$f;sb.exports=lb.default;var jl=sb.exports.instance=lb.instance,iU=sb.exports;const jr=pn(iU);function UI(){}var oU=1/0,aU=Qa&&1/nb(new Qa([,-0]))[1]==oU?function(e){return new Qa(e)}:UI;const sU=aU;var lU=200;function WI(e,t,n){var r=-1,i=CI,o=e.length,a=!0,s=[],l=s;if(n)a=!1,i=TI;else if(o>=lU){var u=t?null:sU(e);if(u)return nb(u);a=!1,i=tb,l=new ds}else l=t?[]:s;e:for(;++r-1:!!i&&SI(e,t,n)>-1}var KI=["selected","defaultValue","defaultChecked","accept","autoCapitalize","autoComplete","autoCorrect","autoFocus","checked","disabled","enterKeyHint","form","id","inputMode","lang","list","max","maxLength","min","minLength","multiple","name","pattern","placeholder","readOnly","required","step","title","type","value"],xU=["onKeyDown","onKeyPress","onKeyUp","onFocus","onBlur","onChange","onInput","onClick","onContextMenu","onDrag","onDragEnd","onDragEnter","onDragExit","onDragLeave","onDragOver","onDragStart","onDrop","onMouseDown","onMouseEnter","onMouseLeave","onMouseMove","onMouseOut","onMouseOver","onMouseUp","onSelect","onTouchCancel","onTouchEnd","onTouchMove","onTouchStart"],SU=[].concat(KI,xU),CU=["alt","height","src","srcSet","width","loading"],cb=function(t,n){n===void 0&&(n={});var r=n,i=r.htmlProps,o=i===void 0?SU:i,a=r.includeAria,s=a===void 0?!0:a,l={},u={};return PI(t,function(c,d){var f=s&&(/^aria-.*$/.test(d)||d==="role"),p=fr(o,d)||f?l:u;p[d]=c}),[l,u]},TU=typeof document=="object"&&document!==null,PU=typeof window=="object"&&window!==null&&window.self===window,OU=function e(){return he(e.override)?TU&&PU:e.override};const yo=OU;var AU=Math.max,_U=Math.min;function IU(e,t,n){return e>=_U(t,n)&&e0&&i.indexOf(n)===r})):[]}function HU(e,t){return[t.filter(function(n){return e.indexOf(n)===-1}),e.filter(function(n){return t.indexOf(n)===-1})]}var mS=new Map,gm=function(t,n){var r=FU(n),i=HU(mS.get(t)||[],r),o=i[0],a=i[1];t&&(o.forEach(function(s){return t.classList.add(s)}),a.forEach(function(s){return t.classList.remove(s)})),mS.set(t,r)},jU=function(){var t=this;this.add=function(n,r){if(t.nodes.has(n)){var i=t.nodes.get(n);i.add(r);return}var o=new Set;o.add(r),t.nodes.set(n,o)},this.del=function(n,r){if(t.nodes.has(n)){var i=t.nodes.get(n);if(i.size===1){t.nodes.delete(n);return}i.delete(r)}},this.emit=function(n,r){r(n,t.nodes.get(n))},this.nodes=new Map},Ol=new jU;function GU(e,t){var n=E.useRef(),r=E.useRef(!1);gS(function(){if(n.current=t,r.current){var i=Fv(e)?e.current:e;Ol.emit(i,gm)}r.current=!0},[t]),gS(function(){var i=Fv(e)?e.current:e;return Ol.add(i,n),Ol.emit(i,gm),function(){Ol.del(i,n),Ol.emit(i,gm)}},[e])}var BU=pc(function(e,t){return Nu(e)?AI(e,t):[]});const zU=BU;function fs(e){var t=e.children,n=e.className,r=e.content,i=e.size,o=W(i,"icons",n),a=U(fs,e),s=K(fs,e);return E.createElement(s,I({},a,{className:o}),ee(t)?r:t)}fs.handledProps=["as","children","className","content","size"];fs.propTypes={};fs.defaultProps={as:"i"};var Io=function(e){ke(t,e);function t(){for(var r,i=arguments.length,o=new Array(i),a=0;a"],191:["/","?"],192:["`","~"],219:["[","{"],220:["\\","|"],221:["]","}"],222:["'",'"'],224:"Meta",225:"AltGraph",246:"Attn",247:"CrSel",248:"ExSel",249:"EraseEof",250:"Play",251:"ZoomOut"};for(var xd=0;xd<24;xd+=1)Df[112+xd]="F"+(xd+1);for(var mm=0;mm<26;mm+=1){var vm=mm+65;Df[vm]=[String.fromCharCode(vm+32),String.fromCharCode(vm)]}var z={codes:Df,getCode:function(t){return vS(t)?t.keyCode||t.which||this[t.key]:this[t]},getKey:function(t){var n=vS(t);if(n&&t.key)return t.key;var r=Df[n?t.keyCode||t.which:t];return Array.isArray(r)&&(n?r=r[t.shiftKey?1:0]:r=r[0]),r},Cancel:3,Help:6,Backspace:8,Tab:9,Clear:12,Enter:13,Shift:16,Control:17,Alt:18,Pause:19,CapsLock:20,Escape:27,Convert:28,NonConvert:29,Accept:30,ModeChange:31," ":32,PageUp:33,PageDown:34,End:35,Home:36,ArrowLeft:37,ArrowUp:38,ArrowRight:39,ArrowDown:40,Select:41,Print:42,Execute:43,PrintScreen:44,Insert:45,Delete:46,0:48,")":48,1:49,"!":49,2:50,"@":50,3:51,"#":51,4:52,$:52,5:53,"%":53,6:54,"^":54,7:55,"&":55,8:56,"*":56,9:57,"(":57,a:65,A:65,b:66,B:66,c:67,C:67,d:68,D:68,e:69,E:69,f:70,F:70,g:71,G:71,h:72,H:72,i:73,I:73,j:74,J:74,k:75,K:75,l:76,L:76,m:77,M:77,n:78,N:78,o:79,O:79,p:80,P:80,q:81,Q:81,r:82,R:82,s:83,S:83,t:84,T:84,u:85,U:85,v:86,V:86,w:87,W:87,x:88,X:88,y:89,Y:89,z:90,Z:90,OS:91,ContextMenu:93,F1:112,F2:113,F3:114,F4:115,F5:116,F6:117,F7:118,F8:119,F9:120,F10:121,F11:122,F12:123,F13:124,F14:125,F15:126,F16:127,F17:128,F18:129,F19:130,F20:131,F21:132,F22:133,F23:134,F24:135,NumLock:144,ScrollLock:145,VolumeMute:181,VolumeDown:182,VolumeUp:183,";":186,":":186,"=":187,"+":187,",":188,"<":188,"-":189,_:189,".":190,">":190,"/":191,"?":191,"`":192,"~":192,"[":219,"{":219,"\\":220,"|":220,"]":221,"}":221,"'":222,'"':222,Meta:224,AltGraph:225,Attn:246,CrSel:247,ExSel:248,EraseEof:249,Play:250,ZoomOut:251};z.Spacebar=z[" "];z.Digit0=z[0];z.Digit1=z[1];z.Digit2=z[2];z.Digit3=z[3];z.Digit4=z[4];z.Digit5=z[5];z.Digit6=z[6];z.Digit7=z[7];z.Digit8=z[8];z.Digit9=z[9];z.Tilde=z["~"];z.GraveAccent=z["`"];z.ExclamationPoint=z["!"];z.AtSign=z["@"];z.PoundSign=z["#"];z.PercentSign=z["%"];z.Caret=z["^"];z.Ampersand=z["&"];z.PlusSign=z["+"];z.MinusSign=z["-"];z.EqualsSign=z["="];z.DivisionSign=z["/"];z.MultiplicationSign=z["*"];z.Comma=z[","];z.Decimal=z["."];z.Colon=z[":"];z.Semicolon=z[";"];z.Pipe=z["|"];z.BackSlash=z["\\"];z.QuestionMark=z["?"];z.SingleQuote=z["'"];z.DoubleQuote=z['"'];z.LeftCurlyBrace=z["{"];z.RightCurlyBrace=z["}"];z.LeftParenthesis=z["("];z.RightParenthesis=z[")"];z.LeftAngleBracket=z["<"];z.RightAngleBracket=z[">"];z.LeftSquareBracket=z["["];z.RightSquareBracket=z["]"];var UU=z;const ot=pn(UU);var db=function(e){ke(t,e);function t(){for(var r,i=arguments.length,o=new Array(i),a=0;a1?d-1:0),p=1;p1?p-1:0),g=1;g1?d-1:0),p=1;p1?f-1:0),y=1;y1?f-1:0),y=1;y=u}),u>=d.length-1&&(p=f[f.length-1]);else{var g=zv(d,["value",c]);p=fr(f,g)?g:void 0}return(!p||p<0)&&(p=f[0]),p}var PS=function(t,n){return he(t)?n:t},OS=function(t){return t&&t.map(function(n){return ab(n,["key","value"])})};function wN(e){var t=e.flag,n=e.image,r=e.text;return Ao(r)?r:{content:E.createElement(E.Fragment,null,mN.create(t),kt.create(n),r)}}var vt=function(e){ke(t,e);function t(){for(var r,i=arguments.length,o=new Array(i),a=0;a=u||u===1){r.open(s);return}V(r.searchRef.current,"focus")},r.handleIconClick=function(s){var l=r.props.clearable,u=r.hasValue();V(r.props,"onClick",s,r.props),s.stopPropagation(),l&&u?r.clearValue(s):r.toggle(s)},r.handleItemClick=function(s,l){var u=r.props,c=u.multiple,d=u.search,f=r.state.value,p=l.value;if(s.stopPropagation(),(c||l.disabled)&&s.nativeEvent.stopImmediatePropagation(),!l.disabled){var y=l["data-additional"],g=c?CS(r.state.value,[p]):p,w=c?!!sS(g,f).length:g!==f;w&&(r.setState({value:g}),r.handleChange(s,g)),r.clearSearchQuery(),V(d?r.searchRef.current:r.ref.current,"focus"),r.closeOnChange(s),y&&V(r.props,"onAddItem",s,I({},r.props,{value:p}))}},r.handleFocus=function(s){var l=r.state.focus;l||(V(r.props,"onFocus",s,r.props),r.setState({focus:!0}))},r.handleBlur=function(s){var l=Kn(s,"currentTarget");if(!(l&&l.contains(document.activeElement))){var u=r.props,c=u.closeOnBlur,d=u.multiple,f=u.selectOnBlur;r.isMouseDown||(V(r.props,"onBlur",s,r.props),f&&!d&&(r.makeSelectedItemActive(s,r.state.selectedIndex),c&&r.close()),r.setState({focus:!1}),r.clearSearchQuery())}},r.handleSearchChange=function(s,l){var u=l.value;s.stopPropagation();var c=r.props.minCharacters,d=r.state.open,f=u;if(V(r.props,"onSearchChange",s,I({},r.props,{searchQuery:f})),r.setState({searchQuery:f,selectedIndex:0}),!d&&f.length>=c){r.open();return}d&&c!==1&&f.lengthc||f<0)?f=l:f>c?f=0:f<0&&(f=c),u[f].disabled?r.getSelectedIndexAfterMove(s,f):f}},r.handleIconOverrides=function(s){var l=r.props.clearable,u=W(l&&r.hasValue()&&"clear",s.className);return{className:u,onClick:function(d){V(s,"onClick",d,s),r.handleIconClick(d)}}},r.clearValue=function(s){var l=r.props.multiple,u=l?[]:"";r.setState({value:u}),r.handleChange(s,u)},r.computeSearchInputTabIndex=function(){var s=r.props,l=s.disabled,u=s.tabIndex;return he(u)?l?-1:0:u},r.computeSearchInputWidth=function(){var s=r.state.searchQuery;if(r.sizerRef.current&&s){r.sizerRef.current.style.display="inline",r.sizerRef.current.textContent=s;var l=Math.ceil(r.sizerRef.current.getBoundingClientRect().width);return r.sizerRef.current.style.removeProperty("display"),l}},r.computeTabIndex=function(){var s=r.props,l=s.disabled,u=s.search,c=s.tabIndex;if(!u)return l?-1:he(c)?0:c},r.handleSearchInputOverrides=function(s){return{onChange:function(u,c){V(s,"onChange",u,c),r.handleSearchChange(u,c)}}},r.hasValue=function(){var s=r.props.multiple,l=r.state.value;return s?!Hl(l):!he(l)&&l!==""},r.scrollSelectedItemIntoView=function(){if(r.ref.current){var s=r.ref.current.querySelector(".menu.visible");if(s){var l=s.querySelector(".item.selected");if(l){var u=l.offsetTops.scrollTop+s.clientHeight;u?s.scrollTop=l.offsetTop:c&&(s.scrollTop=l.offsetTop+l.clientHeight-s.clientHeight)}}}},r.setOpenDirection=function(){if(r.ref.current){var s=r.ref.current.querySelector(".menu.visible");if(s){var l=r.ref.current.getBoundingClientRect(),u=s.clientHeight,c=document.documentElement.clientHeight-l.top-l.height-u,d=l.top-u,f=c<0&&d>c;!f!=!r.state.upward&&r.setState({upward:f})}}},r.open=function(s,l){s===void 0&&(s=null),l===void 0&&(l=!0);var u=r.props,c=u.disabled,d=u.search;c||(d&&V(r.searchRef.current,"focus"),V(r.props,"onOpen",s,r.props),l&&r.setState({open:!0}),r.scrollSelectedItemIntoView())},r.close=function(s,l){l===void 0&&(l=r.handleClose),r.state.open&&(V(r.props,"onClose",s,r.props),r.setState({open:!1},l))},r.handleClose=function(){var s=document.activeElement===r.searchRef.current;!s&&r.ref.current&&r.ref.current.blur();var l=document.activeElement===r.ref.current,u=s||l;r.setState({focus:u})},r.toggle=function(s){return r.state.open?r.close(s):r.open(s)},r.renderText=function(){var s=r.props,l=s.multiple,u=s.placeholder,c=s.search,d=s.text,f=r.state,p=f.searchQuery,y=f.selectedIndex,g=f.value,w=f.open,h=r.hasValue(),v=W(u&&!h&&"default","text",c&&p&&"filtered"),m=u,b;return d?m=d:w&&!l?b=r.getSelectedItem(y):h&&(b=r.getItemByValue(g)),Fi.create(b?wN(b):m,{defaultProps:{className:v}})},r.renderSearchInput=function(){var s=r.props,l=s.search,u=s.searchInput,c=r.state.searchQuery;return l&&E.createElement(un,{innerRef:r.searchRef},yN.create(u,{defaultProps:{style:{width:r.computeSearchInputWidth()},tabIndex:r.computeSearchInputTabIndex(),value:c},overrideProps:r.handleSearchInputOverrides}))},r.renderSearchSizer=function(){var s=r.props,l=s.search,u=s.multiple;return l&&u&&E.createElement("span",{className:"sizer",ref:r.sizerRef})},r.renderLabels=function(){var s=r.props,l=s.multiple,u=s.renderLabel,c=r.state,d=c.selectedLabel,f=c.value;if(!(!l||Hl(f))){var p=qe(f,r.getItemByValue);return qe(UW(p),function(y,g){var w={active:y.value===d,as:"a",key:PS(y.key,y.value),onClick:r.handleLabelClick,onRemove:r.handleLabelRemove,value:y.value};return Je.create(u(y,g,w),{defaultProps:w})})}},r.renderOptions=function(){var s=r.props,l=s.lazyLoad,u=s.multiple,c=s.search,d=s.noResultsMessage,f=r.state,p=f.open,y=f.selectedIndex,g=f.value;if(l&&!p)return null;var w=Ha({value:r.state.value,options:r.props.options,searchQuery:r.state.searchQuery,additionLabel:r.props.additionLabel,additionPosition:r.props.additionPosition,allowAdditions:r.props.allowAdditions,deburr:r.props.deburr,multiple:r.props.multiple,search:r.props.search});if(d!==null&&c&&Hl(w))return E.createElement("div",{className:"message"},d);var h=u?function(v){return fr(g,v)}:function(v){return v===g};return qe(w,function(v,m){return vN.create(I({active:h(v.value),selected:y===m},v,{key:PS(v.key,v.value),style:I({},v.style,{pointerEvents:"all"})}),{generateKey:!1,overrideProps:function(x){return{onClick:function(P,O){x.onClick==null||x.onClick(P,O),r.handleItemClick(P,O)}}}})})},r.renderMenu=function(){var s=r.props,l=s.children,u=s.direction,c=s.header,d=r.state.open,f=r.getDropdownMenuAriaOptions();if(!ee(l)){var p=R.Children.only(l),y=W(u,_(d,"visible"),p.props.className);return R.cloneElement(p,I({className:y},f))}return E.createElement(ms,I({},f,{direction:u,open:d}),Li.create(c,{autoGenerateKey:!1}),r.renderOptions())},r}var n=t.prototype;return n.getInitialAutoControlledState=function(){return{focus:!1,searchQuery:""}},t.getAutoControlledStateFromProps=function(i,o,a){var s={__options:i.options,__value:o.value},l=!ou(a.__value,o.value)||!kU(OS(i.options),OS(a.__options));return l&&(s.selectedIndex=TS({additionLabel:i.additionLabel,additionPosition:i.additionPosition,allowAdditions:i.allowAdditions,deburr:i.deburr,multiple:i.multiple,search:i.search,selectedIndex:o.selectedIndex,value:o.value,options:i.options,searchQuery:o.searchQuery})),s},n.componentDidMount=function(){var i=this.state.open;i&&this.open(null,!1)},n.shouldComponentUpdate=function(i,o){return!ou(i,this.props)||!ou(o,this.state)},n.componentDidUpdate=function(i,o){var a=this.props,s=a.closeOnBlur,l=a.minCharacters,u=a.openOnFocus,c=a.search;if(!o.focus&&this.state.focus){if(!this.isMouseDown){var d=!c||c&&l===1&&!this.state.open;u&&d&&this.open()}}else o.focus&&!this.state.focus&&!this.isMouseDown&&s&&this.close();!o.open&&this.state.open?(this.setOpenDirection(),this.scrollSelectedItemIntoView()):o.open&&this.state.open,o.selectedIndex!==this.state.selectedIndex&&this.scrollSelectedItemIntoView()},n.getDropdownMenuAriaOptions=function(){var i=this.props,o=i.search,a=i.multiple,s={};return o&&(s["aria-multiselectable"]=a,s.role="listbox"),s},n.render=function(){var i=this.props,o=i.basic,a=i.button,s=i.className,l=i.compact,u=i.disabled,c=i.error,d=i.fluid,f=i.floating,p=i.icon,y=i.inline,g=i.item,w=i.labeled,h=i.loading,v=i.multiple,m=i.pointing,b=i.search,x=i.selection,C=i.scrolling,P=i.simple,O=i.trigger,N=this.state,k=N.focus,D=N.open,L=N.upward,B=W("ui",_(D,"active visible"),_(u,"disabled"),_(c,"error"),_(h,"loading"),_(o,"basic"),_(a,"button"),_(l,"compact"),_(d,"fluid"),_(f,"floating"),_(y,"inline"),_(w,"labeled"),_(g,"item"),_(v,"multiple"),_(b,"search"),_(x,"selection"),_(P,"simple"),_(C,"scrolling"),_(L,"upward"),Ae(m,"pointing"),"dropdown",s),q=U(t,this.props),Q=K(t,this.props),se=this.getDropdownAriaOptions(Q,this.props);return E.createElement(un,{innerRef:this.ref},E.createElement(Q,I({},q,se,{className:B,onBlur:this.handleBlur,onClick:this.handleClick,onKeyDown:this.handleKeyDown,onMouseDown:this.handleMouseDown,onFocus:this.handleFocus,onChange:this.handleChange,tabIndex:this.computeTabIndex()}),this.renderLabels(),this.renderSearchInput(),this.renderSearchSizer(),O||this.renderText(),xe.create(p,{overrideProps:this.handleIconOverrides,autoGenerateKey:!1}),this.renderMenu(),D&&E.createElement(jr,{name:"keydown",on:this.closeOnEscape}),D&&E.createElement(jr,{name:"click",on:this.closeOnDocumentClick}),k&&E.createElement(jr,{name:"keydown",on:this.removeItemOnBackspace})))},t}(qs);vt.handledProps=["additionLabel","additionPosition","allowAdditions","as","basic","button","children","className","clearable","closeOnBlur","closeOnChange","closeOnEscape","compact","deburr","defaultOpen","defaultSearchQuery","defaultSelectedLabel","defaultUpward","defaultValue","direction","disabled","error","floating","fluid","header","icon","inline","item","labeled","lazyLoad","loading","minCharacters","multiple","noResultsMessage","onAddItem","onBlur","onChange","onClick","onClose","onFocus","onLabelClick","onMouseDown","onOpen","onSearchChange","open","openOnFocus","options","placeholder","pointing","renderLabel","scrolling","search","searchInput","searchQuery","selectOnBlur","selectOnNavigation","selectedLabel","selection","simple","tabIndex","text","trigger","upward","value","wrapSelection"];vt.propTypes={};vt.defaultProps={additionLabel:"Add ",additionPosition:"top",closeOnBlur:!0,closeOnEscape:!0,deburr:!1,icon:"dropdown",minCharacters:1,noResultsMessage:"No results found.",openOnFocus:!0,renderLabel:wN,searchInput:"text",selectOnBlur:!0,selectOnNavigation:!0,wrapSelection:!0};vt.autoControlledProps=["open","searchQuery","selectedLabel","value","upward"];vt.Divider=Gu;vt.Header=Li;vt.Item=vN;vt.Menu=ms;vt.SearchInput=yN;vt.Text=Fi;function Ko(e){return E.createElement(vt,I({},e,{selection:!0}))}Ko.handledProps=["options"];Ko.propTypes={};Ko.Divider=vt.Divider;Ko.Header=vt.Header;Ko.Item=vt.Item;Ko.Menu=vt.Menu;var oh=function(e){ke(t,e);function t(){for(var r,i=arguments.length,o=new Array(i),a=0;a1?u-1:0),d=1;d1?n-1:0),i=1;i"u")return!1;var t=dn(e).ShadowRoot;return e instanceof t||e instanceof ShadowRoot}function L9(e){var t=e.state;Object.keys(t.elements).forEach(function(n){var r=t.styles[n]||{},i=t.attributes[n]||{},o=t.elements[n];!Nn(o)||!Cr(o)||(Object.assign(o.style,r),Object.keys(i).forEach(function(a){var s=i[a];s===!1?o.removeAttribute(a):o.setAttribute(a,s===!0?"":s)}))})}function F9(e){var t=e.state,n={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(t.elements.popper.style,n.popper),t.styles=n,t.elements.arrow&&Object.assign(t.elements.arrow.style,n.arrow),function(){Object.keys(t.elements).forEach(function(r){var i=t.elements[r],o=t.attributes[r]||{},a=Object.keys(t.styles.hasOwnProperty(r)?t.styles[r]:n[r]),s=a.reduce(function(l,u){return l[u]="",l},{});!Nn(i)||!Cr(i)||(Object.assign(i.style,s),Object.keys(o).forEach(function(l){i.removeAttribute(l)}))})}}const H9={name:"applyStyles",enabled:!0,phase:"write",fn:L9,effect:F9,requires:["computeStyles"]};function br(e){return e.split("-")[0]}var wo=Math.max,Mf=Math.min,_s=Math.round;function Jv(){var e=navigator.userAgentData;return e!=null&&e.brands&&Array.isArray(e.brands)?e.brands.map(function(t){return t.brand+"/"+t.version}).join(" "):navigator.userAgent}function CN(){return!/^((?!chrome|android).)*safari/i.test(Jv())}function Is(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!1);var r=e.getBoundingClientRect(),i=1,o=1;t&&Nn(e)&&(i=e.offsetWidth>0&&_s(r.width)/e.offsetWidth||1,o=e.offsetHeight>0&&_s(r.height)/e.offsetHeight||1);var a=$o(e)?dn(e):window,s=a.visualViewport,l=!CN()&&n,u=(r.left+(l&&s?s.offsetLeft:0))/i,c=(r.top+(l&&s?s.offsetTop:0))/o,d=r.width/i,f=r.height/o;return{width:d,height:f,top:c,right:u+d,bottom:c+f,left:u,x:u,y:c}}function gb(e){var t=Is(e),n=e.offsetWidth,r=e.offsetHeight;return Math.abs(t.width-n)<=1&&(n=t.width),Math.abs(t.height-r)<=1&&(r=t.height),{x:e.offsetLeft,y:e.offsetTop,width:n,height:r}}function TN(e,t){var n=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(n&&hb(n)){var r=t;do{if(r&&e.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function ti(e){return dn(e).getComputedStyle(e)}function j9(e){return["table","td","th"].indexOf(Cr(e))>=0}function Ji(e){return(($o(e)?e.ownerDocument:e.document)||window.document).documentElement}function ah(e){return Cr(e)==="html"?e:e.assignedSlot||e.parentNode||(hb(e)?e.host:null)||Ji(e)}function NS(e){return!Nn(e)||ti(e).position==="fixed"?null:e.offsetParent}function G9(e){var t=/firefox/i.test(Jv()),n=/Trident/i.test(Jv());if(n&&Nn(e)){var r=ti(e);if(r.position==="fixed")return null}var i=ah(e);for(hb(i)&&(i=i.host);Nn(i)&&["html","body"].indexOf(Cr(i))<0;){var o=ti(i);if(o.transform!=="none"||o.perspective!=="none"||o.contain==="paint"||["transform","perspective"].indexOf(o.willChange)!==-1||t&&o.willChange==="filter"||t&&o.filter&&o.filter!=="none")return i;i=i.parentNode}return null}function bc(e){for(var t=dn(e),n=NS(e);n&&j9(n)&&ti(n).position==="static";)n=NS(n);return n&&(Cr(n)==="html"||Cr(n)==="body"&&ti(n).position==="static")?t:n||G9(e)||t}function mb(e){return["top","bottom"].indexOf(e)>=0?"x":"y"}function au(e,t,n){return wo(e,Mf(t,n))}function B9(e,t,n){var r=au(e,t,n);return r>n?n:r}function PN(){return{top:0,right:0,bottom:0,left:0}}function ON(e){return Object.assign({},PN(),e)}function AN(e,t){return t.reduce(function(n,r){return n[r]=e,n},{})}var z9=function(t,n){return t=typeof t=="function"?t(Object.assign({},n.rects,{placement:n.placement})):t,ON(typeof t!="number"?t:AN(t,yc))};function U9(e){var t,n=e.state,r=e.name,i=e.options,o=n.elements.arrow,a=n.modifiersData.popperOffsets,s=br(n.placement),l=mb(s),u=[Kt,Ln].indexOf(s)>=0,c=u?"height":"width";if(!(!o||!a)){var d=z9(i.padding,n),f=gb(o),p=l==="y"?Vt:Kt,y=l==="y"?Mn:Ln,g=n.rects.reference[c]+n.rects.reference[l]-a[l]-n.rects.popper[c],w=a[l]-n.rects.reference[l],h=bc(o),v=h?l==="y"?h.clientHeight||0:h.clientWidth||0:0,m=g/2-w/2,b=d[p],x=v-f[c]-d[y],C=v/2-f[c]/2+m,P=au(b,C,x),O=l;n.modifiersData[r]=(t={},t[O]=P,t.centerOffset=P-C,t)}}function W9(e){var t=e.state,n=e.options,r=n.element,i=r===void 0?"[data-popper-arrow]":r;i!=null&&(typeof i=="string"&&(i=t.elements.popper.querySelector(i),!i)||TN(t.elements.popper,i)&&(t.elements.arrow=i))}const V9={name:"arrow",enabled:!0,phase:"main",fn:U9,effect:W9,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function Ns(e){return e.split("-")[1]}var K9={top:"auto",right:"auto",bottom:"auto",left:"auto"};function q9(e,t){var n=e.x,r=e.y,i=t.devicePixelRatio||1;return{x:_s(n*i)/i||0,y:_s(r*i)/i||0}}function RS(e){var t,n=e.popper,r=e.popperRect,i=e.placement,o=e.variation,a=e.offsets,s=e.position,l=e.gpuAcceleration,u=e.adaptive,c=e.roundOffsets,d=e.isFixed,f=a.x,p=f===void 0?0:f,y=a.y,g=y===void 0?0:y,w=typeof c=="function"?c({x:p,y:g}):{x:p,y:g};p=w.x,g=w.y;var h=a.hasOwnProperty("x"),v=a.hasOwnProperty("y"),m=Kt,b=Vt,x=window;if(u){var C=bc(n),P="clientHeight",O="clientWidth";if(C===dn(n)&&(C=Ji(n),ti(C).position!=="static"&&s==="absolute"&&(P="scrollHeight",O="scrollWidth")),C=C,i===Vt||(i===Kt||i===Ln)&&o===Ku){b=Mn;var N=d&&C===x&&x.visualViewport?x.visualViewport.height:C[P];g-=N-r.height,g*=l?1:-1}if(i===Kt||(i===Vt||i===Mn)&&o===Ku){m=Ln;var k=d&&C===x&&x.visualViewport?x.visualViewport.width:C[O];p-=k-r.width,p*=l?1:-1}}var D=Object.assign({position:s},u&&K9),L=c===!0?q9({x:p,y:g},dn(n)):{x:p,y:g};if(p=L.x,g=L.y,l){var B;return Object.assign({},D,(B={},B[b]=v?"0":"",B[m]=h?"0":"",B.transform=(x.devicePixelRatio||1)<=1?"translate("+p+"px, "+g+"px)":"translate3d("+p+"px, "+g+"px, 0)",B))}return Object.assign({},D,(t={},t[b]=v?g+"px":"",t[m]=h?p+"px":"",t.transform="",t))}function Y9(e){var t=e.state,n=e.options,r=n.gpuAcceleration,i=r===void 0?!0:r,o=n.adaptive,a=o===void 0?!0:o,s=n.roundOffsets,l=s===void 0?!0:s,u={placement:br(t.placement),variation:Ns(t.placement),popper:t.elements.popper,popperRect:t.rects.popper,gpuAcceleration:i,isFixed:t.options.strategy==="fixed"};t.modifiersData.popperOffsets!=null&&(t.styles.popper=Object.assign({},t.styles.popper,RS(Object.assign({},u,{offsets:t.modifiersData.popperOffsets,position:t.options.strategy,adaptive:a,roundOffsets:l})))),t.modifiersData.arrow!=null&&(t.styles.arrow=Object.assign({},t.styles.arrow,RS(Object.assign({},u,{offsets:t.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:l})))),t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-placement":t.placement})}const Q9={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:Y9,data:{}};var Sd={passive:!0};function X9(e){var t=e.state,n=e.instance,r=e.options,i=r.scroll,o=i===void 0?!0:i,a=r.resize,s=a===void 0?!0:a,l=dn(t.elements.popper),u=[].concat(t.scrollParents.reference,t.scrollParents.popper);return o&&u.forEach(function(c){c.addEventListener("scroll",n.update,Sd)}),s&&l.addEventListener("resize",n.update,Sd),function(){o&&u.forEach(function(c){c.removeEventListener("scroll",n.update,Sd)}),s&&l.removeEventListener("resize",n.update,Sd)}}const J9={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:X9,data:{}};var Z9={left:"right",right:"left",bottom:"top",top:"bottom"};function zd(e){return e.replace(/left|right|bottom|top/g,function(t){return Z9[t]})}var eV={start:"end",end:"start"};function kS(e){return e.replace(/start|end/g,function(t){return eV[t]})}function vb(e){var t=dn(e),n=t.pageXOffset,r=t.pageYOffset;return{scrollLeft:n,scrollTop:r}}function yb(e){return Is(Ji(e)).left+vb(e).scrollLeft}function tV(e,t){var n=dn(e),r=Ji(e),i=n.visualViewport,o=r.clientWidth,a=r.clientHeight,s=0,l=0;if(i){o=i.width,a=i.height;var u=CN();(u||!u&&t==="fixed")&&(s=i.offsetLeft,l=i.offsetTop)}return{width:o,height:a,x:s+yb(e),y:l}}function nV(e){var t,n=Ji(e),r=vb(e),i=(t=e.ownerDocument)==null?void 0:t.body,o=wo(n.scrollWidth,n.clientWidth,i?i.scrollWidth:0,i?i.clientWidth:0),a=wo(n.scrollHeight,n.clientHeight,i?i.scrollHeight:0,i?i.clientHeight:0),s=-r.scrollLeft+yb(e),l=-r.scrollTop;return ti(i||n).direction==="rtl"&&(s+=wo(n.clientWidth,i?i.clientWidth:0)-o),{width:o,height:a,x:s,y:l}}function bb(e){var t=ti(e),n=t.overflow,r=t.overflowX,i=t.overflowY;return/auto|scroll|overlay|hidden/.test(n+i+r)}function _N(e){return["html","body","#document"].indexOf(Cr(e))>=0?e.ownerDocument.body:Nn(e)&&bb(e)?e:_N(ah(e))}function su(e,t){var n;t===void 0&&(t=[]);var r=_N(e),i=r===((n=e.ownerDocument)==null?void 0:n.body),o=dn(r),a=i?[o].concat(o.visualViewport||[],bb(r)?r:[]):r,s=t.concat(a);return i?s:s.concat(su(ah(a)))}function Zv(e){return Object.assign({},e,{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height})}function rV(e,t){var n=Is(e,!1,t==="fixed");return n.top=n.top+e.clientTop,n.left=n.left+e.clientLeft,n.bottom=n.top+e.clientHeight,n.right=n.left+e.clientWidth,n.width=e.clientWidth,n.height=e.clientHeight,n.x=n.left,n.y=n.top,n}function $S(e,t,n){return t===xN?Zv(tV(e,n)):$o(t)?rV(t,n):Zv(nV(Ji(e)))}function iV(e){var t=su(ah(e)),n=["absolute","fixed"].indexOf(ti(e).position)>=0,r=n&&Nn(e)?bc(e):e;return $o(r)?t.filter(function(i){return $o(i)&&TN(i,r)&&Cr(i)!=="body"}):[]}function oV(e,t,n,r){var i=t==="clippingParents"?iV(e):[].concat(t),o=[].concat(i,[n]),a=o[0],s=o.reduce(function(l,u){var c=$S(e,u,r);return l.top=wo(c.top,l.top),l.right=Mf(c.right,l.right),l.bottom=Mf(c.bottom,l.bottom),l.left=wo(c.left,l.left),l},$S(e,a,r));return s.width=s.right-s.left,s.height=s.bottom-s.top,s.x=s.left,s.y=s.top,s}function IN(e){var t=e.reference,n=e.element,r=e.placement,i=r?br(r):null,o=r?Ns(r):null,a=t.x+t.width/2-n.width/2,s=t.y+t.height/2-n.height/2,l;switch(i){case Vt:l={x:a,y:t.y-n.height};break;case Mn:l={x:a,y:t.y+t.height};break;case Ln:l={x:t.x+t.width,y:s};break;case Kt:l={x:t.x-n.width,y:s};break;default:l={x:t.x,y:t.y}}var u=i?mb(i):null;if(u!=null){var c=u==="y"?"height":"width";switch(o){case As:l[u]=l[u]-(t[c]/2-n[c]/2);break;case Ku:l[u]=l[u]+(t[c]/2-n[c]/2);break}}return l}function qu(e,t){t===void 0&&(t={});var n=t,r=n.placement,i=r===void 0?e.placement:r,o=n.strategy,a=o===void 0?e.strategy:o,s=n.boundary,l=s===void 0?T9:s,u=n.rootBoundary,c=u===void 0?xN:u,d=n.elementContext,f=d===void 0?Al:d,p=n.altBoundary,y=p===void 0?!1:p,g=n.padding,w=g===void 0?0:g,h=ON(typeof w!="number"?w:AN(w,yc)),v=f===Al?P9:Al,m=e.rects.popper,b=e.elements[y?v:f],x=oV($o(b)?b:b.contextElement||Ji(e.elements.popper),l,c,a),C=Is(e.elements.reference),P=IN({reference:C,element:m,strategy:"absolute",placement:i}),O=Zv(Object.assign({},m,P)),N=f===Al?O:C,k={top:x.top-N.top+h.top,bottom:N.bottom-x.bottom+h.bottom,left:x.left-N.left+h.left,right:N.right-x.right+h.right},D=e.modifiersData.offset;if(f===Al&&D){var L=D[i];Object.keys(k).forEach(function(B){var q=[Ln,Mn].indexOf(B)>=0?1:-1,Q=[Vt,Mn].indexOf(B)>=0?"y":"x";k[B]+=L[Q]*q})}return k}function aV(e,t){t===void 0&&(t={});var n=t,r=n.placement,i=n.boundary,o=n.rootBoundary,a=n.padding,s=n.flipVariations,l=n.allowedAutoPlacements,u=l===void 0?SN:l,c=Ns(r),d=c?s?IS:IS.filter(function(y){return Ns(y)===c}):yc,f=d.filter(function(y){return u.indexOf(y)>=0});f.length===0&&(f=d);var p=f.reduce(function(y,g){return y[g]=qu(e,{placement:g,boundary:i,rootBoundary:o,padding:a})[br(g)],y},{});return Object.keys(p).sort(function(y,g){return p[y]-p[g]})}function sV(e){if(br(e)===pb)return[];var t=zd(e);return[kS(e),t,kS(t)]}function lV(e){var t=e.state,n=e.options,r=e.name;if(!t.modifiersData[r]._skip){for(var i=n.mainAxis,o=i===void 0?!0:i,a=n.altAxis,s=a===void 0?!0:a,l=n.fallbackPlacements,u=n.padding,c=n.boundary,d=n.rootBoundary,f=n.altBoundary,p=n.flipVariations,y=p===void 0?!0:p,g=n.allowedAutoPlacements,w=t.options.placement,h=br(w),v=h===w,m=l||(v||!y?[zd(w)]:sV(w)),b=[w].concat(m).reduce(function(je,Ye){return je.concat(br(Ye)===pb?aV(t,{placement:Ye,boundary:c,rootBoundary:d,padding:u,flipVariations:y,allowedAutoPlacements:g}):Ye)},[]),x=t.rects.reference,C=t.rects.popper,P=new Map,O=!0,N=b[0],k=0;k=0,Q=q?"width":"height",se=qu(t,{placement:D,boundary:c,rootBoundary:d,altBoundary:f,padding:u}),be=q?B?Ln:Kt:B?Mn:Vt;x[Q]>C[Q]&&(be=zd(be));var M=zd(be),J=[];if(o&&J.push(se[L]<=0),s&&J.push(se[be]<=0,se[M]<=0),J.every(function(je){return je})){N=D,O=!1;break}P.set(D,J)}if(O)for(var re=y?3:1,de=function(Ye){var Ze=b.find(function(Mt){var Hn=P.get(Mt);if(Hn)return Hn.slice(0,Ye).every(function(tr){return tr})});if(Ze)return N=Ze,"break"},fe=re;fe>0;fe--){var Ve=de(fe);if(Ve==="break")break}t.placement!==N&&(t.modifiersData[r]._skip=!0,t.placement=N,t.reset=!0)}}const uV={name:"flip",enabled:!0,phase:"main",fn:lV,requiresIfExists:["offset"],data:{_skip:!1}};function DS(e,t,n){return n===void 0&&(n={x:0,y:0}),{top:e.top-t.height-n.y,right:e.right-t.width+n.x,bottom:e.bottom-t.height+n.y,left:e.left-t.width-n.x}}function MS(e){return[Vt,Ln,Mn,Kt].some(function(t){return e[t]>=0})}function cV(e){var t=e.state,n=e.name,r=t.rects.reference,i=t.rects.popper,o=t.modifiersData.preventOverflow,a=qu(t,{elementContext:"reference"}),s=qu(t,{altBoundary:!0}),l=DS(a,r),u=DS(s,i,o),c=MS(l),d=MS(u);t.modifiersData[n]={referenceClippingOffsets:l,popperEscapeOffsets:u,isReferenceHidden:c,hasPopperEscaped:d},t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-reference-hidden":c,"data-popper-escaped":d})}const dV={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:cV};function fV(e,t,n){var r=br(e),i=[Kt,Vt].indexOf(r)>=0?-1:1,o=typeof n=="function"?n(Object.assign({},t,{placement:e})):n,a=o[0],s=o[1];return a=a||0,s=(s||0)*i,[Kt,Ln].indexOf(r)>=0?{x:s,y:a}:{x:a,y:s}}function pV(e){var t=e.state,n=e.options,r=e.name,i=n.offset,o=i===void 0?[0,0]:i,a=SN.reduce(function(c,d){return c[d]=fV(d,t.rects,o),c},{}),s=a[t.placement],l=s.x,u=s.y;t.modifiersData.popperOffsets!=null&&(t.modifiersData.popperOffsets.x+=l,t.modifiersData.popperOffsets.y+=u),t.modifiersData[r]=a}const hV={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:pV};function gV(e){var t=e.state,n=e.name;t.modifiersData[n]=IN({reference:t.rects.reference,element:t.rects.popper,strategy:"absolute",placement:t.placement})}const mV={name:"popperOffsets",enabled:!0,phase:"read",fn:gV,data:{}};function vV(e){return e==="x"?"y":"x"}function yV(e){var t=e.state,n=e.options,r=e.name,i=n.mainAxis,o=i===void 0?!0:i,a=n.altAxis,s=a===void 0?!1:a,l=n.boundary,u=n.rootBoundary,c=n.altBoundary,d=n.padding,f=n.tether,p=f===void 0?!0:f,y=n.tetherOffset,g=y===void 0?0:y,w=qu(t,{boundary:l,rootBoundary:u,padding:d,altBoundary:c}),h=br(t.placement),v=Ns(t.placement),m=!v,b=mb(h),x=vV(b),C=t.modifiersData.popperOffsets,P=t.rects.reference,O=t.rects.popper,N=typeof g=="function"?g(Object.assign({},t.rects,{placement:t.placement})):g,k=typeof N=="number"?{mainAxis:N,altAxis:N}:Object.assign({mainAxis:0,altAxis:0},N),D=t.modifiersData.offset?t.modifiersData.offset[t.placement]:null,L={x:0,y:0};if(C){if(o){var B,q=b==="y"?Vt:Kt,Q=b==="y"?Mn:Ln,se=b==="y"?"height":"width",be=C[b],M=be+w[q],J=be-w[Q],re=p?-O[se]/2:0,de=v===As?P[se]:O[se],fe=v===As?-O[se]:-P[se],Ve=t.elements.arrow,je=p&&Ve?gb(Ve):{width:0,height:0},Ye=t.modifiersData["arrow#persistent"]?t.modifiersData["arrow#persistent"].padding:PN(),Ze=Ye[q],Mt=Ye[Q],Hn=au(0,P[se],je[se]),tr=m?P[se]/2-re-Hn-Ze-k.mainAxis:de-Hn-Ze-k.mainAxis,eo=m?-P[se]/2+re+Hn+Mt+k.mainAxis:fe+Hn+Mt+k.mainAxis,Xo=t.elements.arrow&&bc(t.elements.arrow),Lt=Xo?b==="y"?Xo.clientTop||0:Xo.clientLeft||0:0,nr=(B=D?.[b])!=null?B:0,Oe=be+tr-nr-Lt,Eh=be+eo-nr,ll=au(p?Mf(M,Oe):M,be,p?wo(J,Eh):J);C[b]=ll,L[b]=ll-be}if(s){var _c,rr=b==="x"?Vt:Kt,Ic=b==="x"?Mn:Ln,ir=C[x],Jo=x==="y"?"height":"width",ul=ir+w[rr],cl=ir-w[Ic],Zo=[Vt,Kt].indexOf(h)!==-1,Nc=(_c=D?.[x])!=null?_c:0,Rc=Zo?ul:ir-P[Jo]-O[Jo]-Nc+k.altAxis,kc=Zo?ir+P[Jo]+O[Jo]-Nc-k.altAxis:cl,$c=p&&Zo?B9(Rc,ir,kc):au(p?Rc:ul,ir,p?kc:cl);C[x]=$c,L[x]=$c-ir}t.modifiersData[r]=L}}const bV={name:"preventOverflow",enabled:!0,phase:"main",fn:yV,requiresIfExists:["offset"]};function wV(e){return{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}}function EV(e){return e===dn(e)||!Nn(e)?vb(e):wV(e)}function xV(e){var t=e.getBoundingClientRect(),n=_s(t.width)/e.offsetWidth||1,r=_s(t.height)/e.offsetHeight||1;return n!==1||r!==1}function SV(e,t,n){n===void 0&&(n=!1);var r=Nn(t),i=Nn(t)&&xV(t),o=Ji(t),a=Is(e,i,n),s={scrollLeft:0,scrollTop:0},l={x:0,y:0};return(r||!r&&!n)&&((Cr(t)!=="body"||bb(o))&&(s=EV(t)),Nn(t)?(l=Is(t,!0),l.x+=t.clientLeft,l.y+=t.clientTop):o&&(l.x=yb(o))),{x:a.left+s.scrollLeft-l.x,y:a.top+s.scrollTop-l.y,width:a.width,height:a.height}}function CV(e){var t=new Map,n=new Set,r=[];e.forEach(function(o){t.set(o.name,o)});function i(o){n.add(o.name);var a=[].concat(o.requires||[],o.requiresIfExists||[]);a.forEach(function(s){if(!n.has(s)){var l=t.get(s);l&&i(l)}}),r.push(o)}return e.forEach(function(o){n.has(o.name)||i(o)}),r}function TV(e){var t=CV(e);return M9.reduce(function(n,r){return n.concat(t.filter(function(i){return i.phase===r}))},[])}function PV(e){var t;return function(){return t||(t=new Promise(function(n){Promise.resolve().then(function(){t=void 0,n(e())})})),t}}function OV(e){var t=e.reduce(function(n,r){var i=n[r.name];return n[r.name]=i?Object.assign({},i,r,{options:Object.assign({},i.options,r.options),data:Object.assign({},i.data,r.data)}):r,n},{});return Object.keys(t).map(function(n){return t[n]})}var LS={placement:"bottom",modifiers:[],strategy:"absolute"};function FS(){for(var e=arguments.length,t=new Array(e),n=0;n{this.setState({editable:!0})};onChange=t=>{this.setState({diagramName:t.target.value})};onCancel=()=>{this.setState({editable:!1})};onKeyPress=t=>{t.key==="Enter"&&this.commit()};commit=()=>{this.setState({editable:!1}),this.props.setDiagramName(this.state.diagramName)};render(){return F(E.Fragment,{children:[T(lr.Item,{onClick:this.onClick,children:T(f7,{title:this.props.diagramName+" - Arrows",children:T("span",{style:{fontWeight:"bold"},children:this.props.diagramName})})}),F(Pe,{open:this.state.editable,size:"mini",onClose:this.onCancel,children:[T(Pe.Header,{children:"Diagram Name"}),T(Pe.Content,{children:T(Qt,{fluid:!0,value:this.state.diagramName,onChange:this.onChange,onKeyPress:this.onKeyPress})}),F(Pe.Actions,{children:[T(ce,{onClick:this.onCancel,content:"Cancel"}),T(ce,{type:"submit",onClick:this.commit,positive:!0,content:"Save"})]})]})]})}}const h7="/assets/arrows_logo-e3e232de.svg";class g7{constructor(t){this.createShareClient(t)}openDialog(){this.shareClient.showSettingsDialog()}createShareClient(t){const n=r=>{const i=new window.gapi.drive.share.ShareClient;i.setOAuthToken(r),i.setItemIds([t.fileId]),this.shareClient=i};window.gapi.auth2.getAuthInstance()&&window.gapi.auth2.getAuthInstance().isSignedIn.get()?n(window.gapi.auth.getToken().access_token):window.gapi.client.init({apiKey:Ei.apiKey,clientId:Ei.clientId,discoveryDocs:G0,scope:B0}).then(()=>{window.gapi.auth2.getAuthInstance().isSignedIn.get()||window.gapi.auth2.getAuthInstance().signIn(),n(window.gapi.auth.getToken().access_token)})}}const ey={LOCAL_STORAGE:"Web Browser storage",GOOGLE_DRIVE:"Google Drive"},m7=e=>{const t=ey[e.storage.mode];if(t){const n={READY:`Saved to ${t}`,GET:`Loading from ${t}`,GETTING:`Loading from ${t}`,POSTING:`Saving to ${t}...`,PUT:"Unsaved changes",PUTTING:`Saving to ${t}...`,FAILED:`Failed to save to ${t}, see Javascript console for details.`};return T("span",{children:n[e.storage.status]||""})}else return null},Cd=e=>{switch(e){case"DATABASE":return"database";case"GOOGLE_DRIVE":return"google drive";case"LOCAL_STORAGE":return"window maximize outline";default:return"square outline"}};class v7 extends R.PureComponent{constructor(t){super(t)}render(){const t=o=>{new g7(o).openDialog()},n=["GOOGLE_DRIVE","LOCAL_STORAGE"].map(o=>F("div",{role:"option",className:"item",onClick:()=>this.props.onNewDiagram(o),children:[T("i",{"aria-hidden":"true",className:"icon "+Cd(o)}),T("span",{children:ey[o]})]},o)),r=this.props.recentStorage.slice(1,11).map((o,a)=>F("div",{role:"option",className:"item",onClick:()=>this.props.openRecentFile(o),style:{maxWidth:"20em",overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis"},children:[T("i",{"aria-hidden":"true",className:"icon "+Cd(o.mode)}),T("span",{className:"text",children:o.diagramName})]},"recentlyAccessFiles"+a)),i=["GOOGLE_DRIVE","LOCAL_STORAGE"].map(o=>F("div",{role:"option",className:"item",onClick:()=>this.props.pickFileToOpen(o),children:[T("i",{"aria-hidden":"true",className:"icon "+Cd(o)}),T("span",{children:ey[o]})]},o));return F(lr,{attached:"top",style:{borderRadius:0},borderless:!0,children:[F("div",{role:"listbox","aria-expanded":"true",className:"ui item simple dropdown",tabIndex:"0",children:[T("i",{className:"icon",style:{height:"1.5em"},children:T("img",{src:h7,style:{height:"1.5em"},alt:"Arrows.app logo"})}),F("div",{className:"menu transition visible",children:[F("div",{role:"option",className:"item",children:[T("i",{"aria-hidden":"true",className:"dropdown icon"}),T("span",{className:"text",children:"New"}),F("div",{className:"menu transition",children:[T("div",{className:"header",children:"Store in"}),n]})]}),F("div",{role:"option",className:"item",children:[T("i",{"aria-hidden":"true",className:"dropdown icon"}),T("span",{className:"text",children:"Open"}),F("div",{className:"menu transition",children:[T("div",{className:"header",children:"Recently accessed"}),r,T("div",{className:"divider"}),T("div",{className:"header",children:"Browse"}),i]})]}),T("div",{role:"option",className:"item",onClick:this.props.onSaveAsClick,children:"Save As…"}),T("div",{className:"divider"}),T("div",{role:"option",className:"item",onClick:this.props.onImportClick,children:"Import"}),T("div",{className:"divider"}),T("div",{role:"option",className:"item",onClick:this.props.onHelpClick,children:"Help"})]})]}),T(p7,{diagramName:this.props.diagramName,setDiagramName:this.props.setDiagramName}),T(lr.Item,{children:F(ki,{children:[T(ce,{icon:"undo",disabled:this.props.undoRedoDisabled.undo,onClick:this.props.undo}),T(ce,{icon:"redo",disabled:this.props.undoRedoDisabled.redo,onClick:this.props.redo})]})}),F(lr.Item,{style:{opacity:.6},children:[T(xe,{name:Cd(this.props.storage.mode)}),m7(this.props)]}),F(lr.Menu,{position:"right",children:[T(lr.Item,{children:T(ce,{onClick:this.props.onExportClick,icon:"download",basic:!0,color:"black",content:"Download / Export"})}),this.props.storage.mode==="GOOGLE_DRIVE"?T(lr.Item,{children:T(ce,{onClick:()=>t(this.props.storage),icon:"users",color:"orange",content:"Share"})}):T(lr.Item,{children:T(ce,{onClick:this.props.storeInGoogleDrive,icon:"google drive",color:"orange",content:"Save to Google Drive"})}),T(lr.Item,{title:"Open/Close Inspector",onClick:this.props.showInspector,children:T(xe,{name:"sidebar"})})]})]})}}const y7=()=>({type:"SHOW_EXPORT_DIALOG"}),b7=()=>({type:"HIDE_EXPORT_DIALOG"}),w7=()=>({type:"SHOW_SAVE_AS_DIALOG"}),GS=()=>({type:"HIDE_SAVE_AS_DIALOG"}),E7=()=>({type:"SHOW_IMPORT_DIALOG"}),$N=()=>({type:"HIDE_IMPORT_DIALOG"}),DN=()=>({type:"SHOW_HELP_DIALOG"}),x7=()=>({type:"HIDE_HELP_DIALOG"}),S7=e=>({recentStorage:e.recentStorage,diagramName:e.diagramName,undoRedoDisabled:{undo:e.graph.past.length<1,redo:e.graph.future.length<1},storage:e.storage}),C7=e=>({onNewDiagram:t=>{switch(t){case"GOOGLE_DRIVE":e(F5());break;case"LOCAL_STORAGE":e(c_());break}},pickFileToOpen:t=>{e(W5(t))},openRecentFile:t=>{e(d_(t))},setDiagramName:t=>{e(KM(t))},undo:()=>e(qt.ActionCreators.undo()),redo:()=>e(qt.ActionCreators.redo()),showInspector:()=>{e(l6())},onExportClick:()=>{e(y7())},storeInGoogleDrive:()=>{e(j5())},onSaveAsClick:()=>{e(w7())},onImportClick:()=>{e(E7())},onHelpClick:()=>{e(DN())}}),T7=Xt(S7,C7)(v7),BS=e=>e.reduce((t,n)=>t.length===0?[n]:t[0]===n?t:[void 0],[])[0],MN=(e,t,n,r)=>{const i=[],o=(a,s,l)=>{const u=a.length,c=()=>{const d=a.map(f=>({id:f,entityType:s}));n(d)};switch(u){case 0:break;default:i.push(F(Je,{as:"a",size:"large",color:r,onClick:c,children:[T(xe,{name:l}),s+"s:",T(Je.Detail,{children:u})]},s));break}};return o(e,"node","circle"),o(t,"relationship","long arrow alternate right"),T(ue.Field,{children:i})};class P7 extends R.Component{constructor(t){super(t),this.state={mouseOver:!1}}onMouseEnter=()=>{this.setState({mouseOver:!0})};onMouseLeave=()=>{this.setState({mouseOver:!1})};componentDidMount(){(!this.props.propertyKey||this.props.propertyKey.length===0)&&this.keyInput&&this.keyInput.focus(),this.props.setFocusHandler(()=>this.valueInput&&this.valueInput.focus())}render=()=>{const{propertyKey:t,propertySummary:n,onMergeOnValues:r,onKeyChange:i,valueFieldValue:o,valueFieldPlaceHolder:a,onValueChange:s,onDeleteProperty:l,onNext:u,keyDisabled:c,valueDisabled:d}=this.props,f=(O,N)=>{N.key==="Enter"&&(N.preventDefault(),O==="key"?this.valueInput&&this.valueInput.focus():u())},p=O=>{O.key==="Enter"&&O.metaKey&&O.target.blur()},y=n.keys.map(O=>F(ie.Row,{textAlign:"right",children:[T(ie.Cell,{children:T(Je,{children:O.nodeCount})}),T(ie.Cell,{children:T(ce,{basic:!0,color:"black",size:"tiny",onClick:()=>i(O.key),children:O.key})})]},"suggest_"+O.key)),g=T(ue,{children:F(ue.Field,{children:[T("label",{children:"other property keys"}),T(ie,{basic:"very",compact:"very",children:T(ie.Body,{children:y})})]})}),w=n.values.get(t).filter(O=>O.value!==o),h=w.some(O=>O.nodeCount>1),v=w.filter(O=>O.inSelection),m=w.filter(O=>!O.inSelection),b=O=>F(ie.Row,{textAlign:"left",children:[T(ie.Cell,{children:T(ce,{basic:!0,color:"black",size:"tiny",onClick:()=>s(O.value),children:O.value})}),T(ie.Cell,{children:T(Je,{children:O.nodeCount})})]},"suggest_"+O.value),x=F(ue,{children:[h?T(ue.Field,{children:T(ce,{onClick:r,basic:!0,color:"black",size:"tiny",icon:"crosshairs",content:"Merge on values",type:"button"},"mergeOnValues")}):null,v.length>0?F(ue.Field,{children:[T("label",{children:"in selection"}),T(ie,{basic:"very",compact:"very",children:T(ie.Body,{children:v.map(b)})})]}):null,m.length>0?F(ue.Field,{children:[T("label",{children:"other values"}),T(ie,{basic:"very",compact:"very",children:T(ie.Body,{children:m.map(b)})})]}):null]}),C=T(Qt,{value:t,onChange:O=>i(O.target.value),transparent:!0,className:"property-key",ref:O=>this.keyInput=O,onKeyPress:O=>f("key",O),onKeyDown:p,disabled:c}),P=T(Qt,{value:o,placeholder:a,onChange:O=>s(O.target.value),ref:O=>this.valueInput=O,onKeyPress:O=>f("value",O),onKeyDown:p,transparent:!0,disabled:d});return F(ie.Row,{onMouseEnter:this.onMouseEnter,onMouseLeave:this.onMouseLeave,children:[T(ie.Cell,{width:3,collapsing:!0,children:F(ue.Field,{children:[T(fn,{trigger:C,content:g,on:"focus",...n.keys.length>0?{}:{open:!1},position:"bottom right",flowing:!0}),":"]})}),T(ie.Cell,{width:3,children:T(ue.Field,{children:T(fn,{trigger:P,content:x,on:"focus",...w.length>0?{}:{open:!1},position:"bottom left",flowing:!0})})}),T(ie.Cell,{width:1,children:T(xe,{style:{visibility:this.state.mouseOver&&!d?"visible":"hidden"},name:"trash alternate outline",onClick:l})})]})}}const O7=e=>Object.keys(e).map(t=>({key:t,value:e[t]}));class Eb extends R.Component{constructor(t){super(t),this.focusHandlers=[],this.state={local:!1,properties:null,error:null,lastValidKey:null,invalidIndex:null}}static propertyInput(t){switch(t.status){case"CONSISTENT":return{valueFieldValue:t.value,valueFieldPlaceHolder:null};case"INCONSISTENT":return{valueFieldValue:"",valueFieldPlaceHolder:""};default:return{valueFieldValue:"",valueFieldPlaceHolder:""}}}render(){const{properties:t,propertySummary:n,onMergeOnValues:r,onSavePropertyKey:i,onSavePropertyValue:o,onDeleteProperty:a}=this.props,{properties:s,local:l,error:u,lastValidKey:c,invalidIndex:d}=this.state;let f;l?f=s:f=O7(t);const p=()=>{o("","")},y=h=>{h===f.length?p():this.focusHandlers[h]()},g=(h,v,m)=>{l?f.find(b=>b.key===v)||(i(c,v),this.setState({local:!1,error:null,properties:null,lastValidKey:null,invalidIndex:null})):f.find(b=>b.key===v)?(f.find(b=>b.key===h).key=v,this.setState({local:!0,error:"Duplicate properties found. Please rename the property.",properties:f,lastValidKey:h,invalidIndex:m})):i(h,v)},w=f.map((h,v)=>{const{valueFieldValue:m,valueFieldPlaceHolder:b}=Eb.propertyInput(h.value);return T(P7,{propertyKey:h.key,propertySummary:n,onMergeOnValues:()=>r(h.key),onKeyChange:x=>g(h.key,x,v),onValueChange:x=>o(h.key,x),onDeleteProperty:()=>a(h.key),valueFieldValue:m,valueFieldPlaceHolder:b,setFocusHandler:x=>this.focusHandlers[v]=x,onNext:()=>y(v+1),keyDisabled:u&&d!==v,valueDisabled:u},"row-"+v)});return F(ue.Field,{children:[T("label",{children:"Properties"}),T(ie,{compact:!0,collapsing:!0,style:{marginTop:0},children:T(ie.Body,{children:w})}),u?T(ht,{negative:!0,children:u}):null,T(ce,{onClick:p,basic:!0,color:"black",floated:"right",size:"tiny",icon:"plus",content:"Property",type:"button",disabled:u},"addProperty")]},"propertiesTable")}}var Pn={},Ec={},A7=typeof yi=="object"&&yi&&yi.Object===Object&&yi,LN=A7,_7=LN,I7=typeof self=="object"&&self&&self.Object===Object&&self,N7=_7||I7||Function("return this")(),_r=N7,R7=_r,k7=R7.Symbol,xc=k7,zS=xc,FN=Object.prototype,$7=FN.hasOwnProperty,D7=FN.toString,_l=zS?zS.toStringTag:void 0;function M7(e){var t=$7.call(e,_l),n=e[_l];try{e[_l]=void 0;var r=!0}catch{}var i=D7.call(e);return r&&(t?e[_l]=n:delete e[_l]),i}var L7=M7,F7=Object.prototype,H7=F7.toString;function j7(e){return H7.call(e)}var G7=j7,US=xc,B7=L7,z7=G7,U7="[object Null]",W7="[object Undefined]",WS=US?US.toStringTag:void 0;function V7(e){return e==null?e===void 0?W7:U7:WS&&WS in Object(e)?B7(e):z7(e)}var qo=V7,K7=Array.isArray,Zn=K7;function q7(e){return e!=null&&typeof e=="object"}var ai=q7,Y7=qo,Q7=Zn,X7=ai,J7="[object String]";function Z7(e){return typeof e=="string"||!Q7(e)&&X7(e)&&Y7(e)==J7}var eK=Z7;function tK(e){return function(t,n,r){for(var i=-1,o=Object(t),a=r(t),s=a.length;s--;){var l=a[e?s:++i];if(n(o[l],l,o)===!1)break}return t}}var nK=tK,rK=nK,iK=rK(),oK=iK;function aK(e,t){for(var n=-1,r=Array(e);++n-1&&e%1==0&&e-1&&e%1==0&&e<=xK}var Sb=SK,CK=qo,TK=Sb,PK=ai,OK="[object Arguments]",AK="[object Array]",_K="[object Boolean]",IK="[object Date]",NK="[object Error]",RK="[object Function]",kK="[object Map]",$K="[object Number]",DK="[object Object]",MK="[object RegExp]",LK="[object Set]",FK="[object String]",HK="[object WeakMap]",jK="[object ArrayBuffer]",GK="[object DataView]",BK="[object Float32Array]",zK="[object Float64Array]",UK="[object Int8Array]",WK="[object Int16Array]",VK="[object Int32Array]",KK="[object Uint8Array]",qK="[object Uint8ClampedArray]",YK="[object Uint16Array]",QK="[object Uint32Array]",Me={};Me[BK]=Me[zK]=Me[UK]=Me[WK]=Me[VK]=Me[KK]=Me[qK]=Me[YK]=Me[QK]=!0;Me[OK]=Me[AK]=Me[jK]=Me[_K]=Me[GK]=Me[IK]=Me[NK]=Me[RK]=Me[kK]=Me[$K]=Me[DK]=Me[MK]=Me[LK]=Me[FK]=Me[HK]=!1;function XK(e){return PK(e)&&TK(e.length)&&!!Me[CK(e)]}var JK=XK;function ZK(e){return function(t){return e(t)}}var Cb=ZK,Ff={exports:{}};Ff.exports;(function(e,t){var n=LN,r=t&&!t.nodeType&&t,i=r&&!0&&e&&!e.nodeType&&e,o=i&&i.exports===r,a=o&&n.process,s=function(){try{var l=i&&i.require&&i.require("util").types;return l||a&&a.binding&&a.binding("util")}catch{}}();e.exports=s})(Ff,Ff.exports);var Tb=Ff.exports,eq=JK,tq=Cb,KS=Tb,qS=KS&&KS.isTypedArray,nq=qS?tq(qS):eq,BN=nq,rq=sK,iq=jN,oq=Zn,aq=xb,sq=GN,lq=BN,uq=Object.prototype,cq=uq.hasOwnProperty;function dq(e,t){var n=oq(e),r=!n&&iq(e),i=!n&&!r&&aq(e),o=!n&&!r&&!i&&lq(e),a=n||r||i||o,s=a?rq(e.length,String):[],l=s.length;for(var u in e)(t||cq.call(e,u))&&!(a&&(u=="length"||i&&(u=="offset"||u=="parent")||o&&(u=="buffer"||u=="byteLength"||u=="byteOffset")||sq(u,l)))&&s.push(u);return s}var zN=dq,fq=Object.prototype;function pq(e){var t=e&&e.constructor,n=typeof t=="function"&&t.prototype||fq;return e===n}var Pb=pq;function hq(e,t){return function(n){return e(t(n))}}var UN=hq,gq=UN,mq=gq(Object.keys,Object),vq=mq,yq=Pb,bq=vq,wq=Object.prototype,Eq=wq.hasOwnProperty;function xq(e){if(!yq(e))return bq(e);var t=[];for(var n in Object(e))Eq.call(e,n)&&n!="constructor"&&t.push(n);return t}var Sq=xq;function Cq(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var Zs=Cq,Tq=qo,Pq=Zs,Oq="[object AsyncFunction]",Aq="[object Function]",_q="[object GeneratorFunction]",Iq="[object Proxy]";function Nq(e){if(!Pq(e))return!1;var t=Tq(e);return t==Aq||t==_q||t==Oq||t==Iq}var WN=Nq,Rq=WN,kq=Sb;function $q(e){return e!=null&&kq(e.length)&&!Rq(e)}var sh=$q,Dq=zN,Mq=Sq,Lq=sh;function Fq(e){return Lq(e)?Dq(e):Mq(e)}var Sc=Fq,Hq=oK,jq=Sc;function Gq(e,t){return e&&Hq(e,t,jq)}var VN=Gq;function Bq(e){return e}var KN=Bq,zq=KN;function Uq(e){return typeof e=="function"?e:zq}var Wq=Uq,Vq=VN,Kq=Wq;function qq(e,t){return e&&Vq(e,Kq(t))}var Ob=qq,Yq=UN,Qq=Yq(Object.getPrototypeOf,Object),Ab=Qq,Xq=qo,Jq=Ab,Zq=ai,eY="[object Object]",tY=Function.prototype,nY=Object.prototype,qN=tY.toString,rY=nY.hasOwnProperty,iY=qN.call(Object);function oY(e){if(!Zq(e)||Xq(e)!=eY)return!1;var t=Jq(e);if(t===null)return!0;var n=rY.call(t,"constructor")&&t.constructor;return typeof n=="function"&&n instanceof n&&qN.call(n)==iY}var aY=oY;function sY(e,t){for(var n=-1,r=e==null?0:e.length,i=Array(r);++n-1}var SY=xY,CY=lh;function TY(e,t){var n=this.__data__,r=CY(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}var PY=TY,OY=uY,AY=vY,_Y=wY,IY=SY,NY=PY;function el(e){var t=-1,n=e==null?0:e.length;for(this.clear();++ts))return!1;var u=o.get(e),c=o.get(t);if(u&&c)return u==t&&c==e;var d=-1,f=!0,p=n&zX?new HX:void 0;for(o.set(e,t),o.set(t,e);++d0&&arguments[0]!==void 0?arguments[0]:[],n=[];return(0,kte.default)(t,function(r){Array.isArray(r)?e(r).map(function(i){return n.push(i)}):(0,Nte.default)(r)?(0,_te.default)(r,function(i,o){i===!0&&n.push(o),n.push(o+"-"+i)}):(0,Ote.default)(r)&&n.push(r)}),n};Ec.default=$te;var Cc={};function Dte(e,t){for(var n=-1,r=e==null?0:e.length;++n1&&arguments[1]!==void 0?arguments[1]:[],r=t.default&&(0,toe.default)(t.default)||{};return n.map(function(i){var o=t[i];return o&&(0,Zie.default)(o,function(a,s){r[s]||(r[s]={}),r[s]=noe({},r[s],o[s])}),i}),r};Cc.default=roe;var Tc={};Object.defineProperty(Tc,"__esModule",{value:!0});Tc.autoprefix=void 0;var ioe=Ob,AC=aoe(ioe),ooe=Object.assign||function(e){for(var t=1;t1&&arguments[1]!==void 0?arguments[1]:"span";return function(r){poe(i,r);function i(){var o,a,s,l;foe(this,i);for(var u=arguments.length,c=Array(u),d=0;d1&&arguments[1]!==void 0?arguments[1]:"span";return function(r){boe(i,r);function i(){var o,a,s,l;yoe(this,i);for(var u=arguments.length,c=Array(u),d=0;d1&&arguments[1]!==void 0?arguments[1]:!0;r[a]=s};return t===0&&i("first-child"),t===n-1&&i("last-child"),(t===0||t%2===0)&&i("even"),Math.abs(t%2)===1&&i("odd"),i("nth-child",t),r};Hb.default=Eoe;Object.defineProperty(Pn,"__esModule",{value:!0});Pn.ReactCSS=Pn.loop=Pn.handleActive=jb=Pn.handleHover=Pn.hover=void 0;var xoe=Ec,Soe=ol(xoe),Coe=Cc,Toe=ol(Coe),Poe=Tc,Ooe=ol(Poe),Aoe=Pc,bR=ol(Aoe),_oe=Oc,Ioe=ol(_oe),Noe=Hb,Roe=ol(Noe);function ol(e){return e&&e.__esModule?e:{default:e}}Pn.hover=bR.default;var jb=Pn.handleHover=bR.default;Pn.handleActive=Ioe.default;Pn.loop=Roe.default;var koe=Pn.ReactCSS=function(t){for(var n=arguments.length,r=Array(n>1?n-1:0),i=1;is?f=1:f=Math.round(d*100/s)/100,n.a!==f)return{h:n.h,s:n.s,l:n.l,a:f,source:"rgb"}}else{var p=void 0;if(c<0?p=0:c>a?p=1:p=Math.round(c*100/a)/100,i!==p)return{h:n.h,s:n.s,l:n.l,a:p,source:"rgb"}}return null},Sm={},Doe=function(t,n,r,i){if(typeof document>"u"&&!i)return null;var o=i?new i:document.createElement("canvas");o.width=r*2,o.height=r*2;var a=o.getContext("2d");return a?(a.fillStyle=t,a.fillRect(0,0,o.width,o.height),a.fillStyle=n,a.fillRect(0,0,r,r),a.translate(r,r),a.fillRect(0,0,r,r),o.toDataURL()):null},Moe=function(t,n,r,i){var o=t+"-"+n+"-"+r+(i?"-server":"");if(Sm[o])return Sm[o];var a=Doe(t,n,r,i);return Sm[o]=a,a},NC=Object.assign||function(e){for(var t=1;t-1},Qoe=function(t){return Number(String(t).replace(/%/g,""))},Xoe=1,me=function(e){Woe(t,e);function t(n){zoe(this,t);var r=Uoe(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return r.handleBlur=function(){r.state.blurValue&&r.setState({value:r.state.blurValue,blurValue:null})},r.handleChange=function(i){r.setUpdatedValue(i.target.value,i)},r.handleKeyDown=function(i){var o=Qoe(i.target.value);if(!isNaN(o)&&Yoe(i.keyCode)){var a=r.getArrowOffset(),s=i.keyCode===wR?o+a:o-a;r.setUpdatedValue(s,i)}},r.handleDrag=function(i){if(r.props.dragLabel){var o=Math.round(r.props.value+i.movementX);o>=0&&o<=r.props.dragMax&&r.props.onChange&&r.props.onChange(r.getValueObjectWithLabel(o),i)}},r.handleMouseDown=function(i){r.props.dragLabel&&(i.preventDefault(),r.handleDrag(i),window.addEventListener("mousemove",r.handleDrag),window.addEventListener("mouseup",r.handleMouseUp))},r.handleMouseUp=function(){r.unbindEventListeners()},r.unbindEventListeners=function(){window.removeEventListener("mousemove",r.handleDrag),window.removeEventListener("mouseup",r.handleMouseUp)},r.state={value:String(n.value).toUpperCase(),blurValue:String(n.value).toUpperCase()},r.inputId="rc-editable-input-"+Xoe++,r}return Goe(t,[{key:"componentDidUpdate",value:function(r,i){this.props.value!==this.state.value&&(r.value!==this.props.value||i.value!==this.state.value)&&(this.input===document.activeElement?this.setState({blurValue:String(this.props.value).toUpperCase()}):this.setState({value:String(this.props.value).toUpperCase(),blurValue:!this.state.blurValue&&String(this.props.value).toUpperCase()}))}},{key:"componentWillUnmount",value:function(){this.unbindEventListeners()}},{key:"getValueObjectWithLabel",value:function(r){return Boe({},this.props.label,r)}},{key:"getArrowOffset",value:function(){return this.props.arrowOffset||Voe}},{key:"setUpdatedValue",value:function(r,i){var o=this.props.label?this.getValueObjectWithLabel(r):r;this.props.onChange&&this.props.onChange(o,i),this.setState({value:r})}},{key:"render",value:function(){var r=this,i=le({default:{wrap:{position:"relative"}},"user-override":{wrap:this.props.style&&this.props.style.wrap?this.props.style.wrap:{},input:this.props.style&&this.props.style.input?this.props.style.input:{},label:this.props.style&&this.props.style.label?this.props.style.label:{}},"dragLabel-true":{label:{cursor:"ew-resize"}}},{"user-override":!0},this.props);return E.createElement("div",{style:i.wrap},E.createElement("input",{id:this.inputId,style:i.input,ref:function(a){return r.input=a},value:this.state.value,onKeyDown:this.handleKeyDown,onChange:this.handleChange,onBlur:this.handleBlur,placeholder:this.props.placeholder,spellCheck:"false"}),this.props.label&&!this.props.hideLabel?E.createElement("label",{htmlFor:this.inputId,style:i.label,onMouseDown:this.handleMouseDown},this.props.label):null)}}]),t}(R.PureComponent||R.Component),Joe=function(t,n,r,i){var o=i.clientWidth,a=i.clientHeight,s=typeof t.pageX=="number"?t.pageX:t.touches[0].pageX,l=typeof t.pageY=="number"?t.pageY:t.touches[0].pageY,u=s-(i.getBoundingClientRect().left+window.pageXOffset),c=l-(i.getBoundingClientRect().top+window.pageYOffset);if(n==="vertical"){var d=void 0;if(c<0)d=359;else if(c>a)d=0;else{var f=-(c*100/a)+100;d=360*f/100}if(r.h!==d)return{h:d,s:r.s,l:r.l,a:r.a,source:"hsl"}}else{var p=void 0;if(u<0)p=0;else if(u>o)p=359;else{var y=u*100/o;p=360*y/100}if(r.h!==p)return{h:p,s:r.s,l:r.l,a:r.a,source:"hsl"}}return null},Zoe=function(){function e(t,n){for(var r=0;r1?n[i-1]:void 0,a=i>2?n[2]:void 0;for(o=e.length>3&&typeof o=="function"?(i--,o):void 0,a&&rb(n[0],n[1],a)&&(o=i<3?void 0:o,i=1),t=Object(t);++r=t||P<0||d&&O>=o}function h(){var C=Cm();if(w(C))return v(C);s=setTimeout(h,g(C))}function v(C){return s=void 0,f&&r?p(C):(r=i=void 0,a)}function m(){s!==void 0&&clearTimeout(s),u=0,r=l=i=s=void 0}function b(){return s===void 0?a:v(Cm())}function x(){var C=Cm(),P=w(C);if(r=arguments,i=this,l=C,P){if(s===void 0)return y(l);if(d)return clearTimeout(s),s=setTimeout(h,t),p(l)}return s===void 0&&(s=setTimeout(h,t)),a}return x.cancel=m,x.flush=b,x}var mae="Expected a function";function vae(e,t,n){var r=!0,i=!0;if(typeof e!="function")throw new TypeError(mae);return Yt(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),SR(e,t,{leading:r,maxWait:t,trailing:i})}var yae=function(t,n,r){var i=r.getBoundingClientRect(),o=i.width,a=i.height,s=typeof t.pageX=="number"?t.pageX:t.touches[0].pageX,l=typeof t.pageY=="number"?t.pageY:t.touches[0].pageY,u=s-(r.getBoundingClientRect().left+window.pageXOffset),c=l-(r.getBoundingClientRect().top+window.pageYOffset);u<0?u=0:u>o&&(u=o),c<0?c=0:c>a&&(c=a);var d=u/o,f=1-c/a;return{h:n.h,s:d,v:f,a:n.a,source:"hsv"}},bae=function(){function e(t,n){for(var r=0;r=0,o=!n&&i&&(t==="hex"||t==="hex6"||t==="hex3"||t==="hex4"||t==="hex8"||t==="name");return o?t==="name"&&this._a===0?this.toName():this.toRgbString():(t==="rgb"&&(r=this.toRgbString()),t==="prgb"&&(r=this.toPercentageRgbString()),(t==="hex"||t==="hex6")&&(r=this.toHexString()),t==="hex3"&&(r=this.toHexString(!0)),t==="hex4"&&(r=this.toHex8String(!0)),t==="hex8"&&(r=this.toHex8String()),t==="name"&&(r=this.toName()),t==="hsl"&&(r=this.toHslString()),t==="hsv"&&(r=this.toHsvString()),r||this.toHexString())},clone:function(){return ne(this.toString())},_applyModification:function(t,n){var r=t.apply(null,[this].concat([].slice.call(n)));return this._r=r._r,this._g=r._g,this._b=r._b,this.setAlpha(r._a),this},lighten:function(){return this._applyModification(kae,arguments)},brighten:function(){return this._applyModification($ae,arguments)},darken:function(){return this._applyModification(Dae,arguments)},desaturate:function(){return this._applyModification(Iae,arguments)},saturate:function(){return this._applyModification(Nae,arguments)},greyscale:function(){return this._applyModification(Rae,arguments)},spin:function(){return this._applyModification(Mae,arguments)},_applyCombination:function(t,n){return t.apply(null,[this].concat([].slice.call(n)))},analogous:function(){return this._applyCombination(Hae,arguments)},complement:function(){return this._applyCombination(Lae,arguments)},monochromatic:function(){return this._applyCombination(jae,arguments)},splitcomplement:function(){return this._applyCombination(Fae,arguments)},triad:function(){return this._applyCombination(GC,[3])},tetrad:function(){return this._applyCombination(GC,[4])}};ne.fromRatio=function(e,t){if(Gf(e)=="object"){var n={};for(var r in e)e.hasOwnProperty(r)&&(r==="a"?n[r]=e[r]:n[r]=Gl(e[r]));e=n}return ne(e,t)};function Tae(e){var t={r:0,g:0,b:0},n=1,r=null,i=null,o=null,a=!1,s=!1;return typeof e=="string"&&(e=Wae(e)),Gf(e)=="object"&&(Mr(e.r)&&Mr(e.g)&&Mr(e.b)?(t=Pae(e.r,e.g,e.b),a=!0,s=String(e.r).substr(-1)==="%"?"prgb":"rgb"):Mr(e.h)&&Mr(e.s)&&Mr(e.v)?(r=Gl(e.s),i=Gl(e.v),t=Aae(e.h,r,i),a=!0,s="hsv"):Mr(e.h)&&Mr(e.s)&&Mr(e.l)&&(r=Gl(e.s),o=Gl(e.l),t=Oae(e.h,r,o),a=!0,s="hsl"),e.hasOwnProperty("a")&&(n=e.a)),n=CR(n),{ok:a,format:e.format||s,r:Math.min(255,Math.max(t.r,0)),g:Math.min(255,Math.max(t.g,0)),b:Math.min(255,Math.max(t.b,0)),a:n}}function Pae(e,t,n){return{r:Fe(e,255)*255,g:Fe(t,255)*255,b:Fe(n,255)*255}}function LC(e,t,n){e=Fe(e,255),t=Fe(t,255),n=Fe(n,255);var r=Math.max(e,t,n),i=Math.min(e,t,n),o,a,s=(r+i)/2;if(r==i)o=a=0;else{var l=r-i;switch(a=s>.5?l/(2-r-i):l/(r+i),r){case e:o=(t-n)/l+(t1&&(d-=1),d<1/6?u+(c-u)*6*d:d<1/2?c:d<2/3?u+(c-u)*(2/3-d)*6:u}if(t===0)r=i=o=n;else{var s=n<.5?n*(1+t):n+t-n*t,l=2*n-s;r=a(l,s,e+1/3),i=a(l,s,e),o=a(l,s,e-1/3)}return{r:r*255,g:i*255,b:o*255}}function FC(e,t,n){e=Fe(e,255),t=Fe(t,255),n=Fe(n,255);var r=Math.max(e,t,n),i=Math.min(e,t,n),o,a,s=r,l=r-i;if(a=r===0?0:l/r,r==i)o=0;else{switch(r){case e:o=(t-n)/l+(t>1)+720)%360;--t;)r.h=(r.h+i)%360,o.push(ne(r));return o}function jae(e,t){t=t||6;for(var n=ne(e).toHsv(),r=n.h,i=n.s,o=n.v,a=[],s=1/t;t--;)a.push(ne({h:r,s:i,v:o})),o=(o+s)%1;return a}ne.mix=function(e,t,n){n=n===0?0:n||50;var r=ne(e).toRgb(),i=ne(t).toRgb(),o=n/100,a={r:(i.r-r.r)*o+r.r,g:(i.g-r.g)*o+r.g,b:(i.b-r.b)*o+r.b,a:(i.a-r.a)*o+r.a};return ne(a)};ne.readability=function(e,t){var n=ne(e),r=ne(t);return(Math.max(n.getLuminance(),r.getLuminance())+.05)/(Math.min(n.getLuminance(),r.getLuminance())+.05)};ne.isReadable=function(e,t,n){var r=ne.readability(e,t),i,o;switch(o=!1,i=Vae(n),i.level+i.size){case"AAsmall":case"AAAlarge":o=r>=4.5;break;case"AAlarge":o=r>=3;break;case"AAAsmall":o=r>=7;break}return o};ne.mostReadable=function(e,t,n){var r=null,i=0,o,a,s,l;n=n||{},a=n.includeFallbackColors,s=n.level,l=n.size;for(var u=0;ui&&(i=o,r=ne(t[u]));return ne.isReadable(e,r,{level:s,size:l})||!a?r:(n.includeFallbackColors=!1,ne.mostReadable(e,["#fff","#000"],n))};var ly=ne.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},Gae=ne.hexNames=Bae(ly);function Bae(e){var t={};for(var n in e)e.hasOwnProperty(n)&&(t[e[n]]=n);return t}function CR(e){return e=parseFloat(e),(isNaN(e)||e<0||e>1)&&(e=1),e}function Fe(e,t){zae(e)&&(e="100%");var n=Uae(e);return e=Math.min(t,Math.max(0,parseFloat(e))),n&&(e=parseInt(e*t,10)/100),Math.abs(e-t)<1e-6?1:e%t/parseFloat(t)}function vh(e){return Math.min(1,Math.max(0,e))}function en(e){return parseInt(e,16)}function zae(e){return typeof e=="string"&&e.indexOf(".")!=-1&&parseFloat(e)===1}function Uae(e){return typeof e=="string"&&e.indexOf("%")!=-1}function qn(e){return e.length==1?"0"+e:""+e}function Gl(e){return e<=1&&(e=e*100+"%"),e}function TR(e){return Math.round(parseFloat(e)*255).toString(16)}function BC(e){return en(e)/255}var Bn=function(){var e="[-\\+]?\\d+%?",t="[-\\+]?\\d*\\.\\d+%?",n="(?:"+t+")|(?:"+e+")",r="[\\s|\\(]+("+n+")[,|\\s]+("+n+")[,|\\s]+("+n+")\\s*\\)?",i="[\\s|\\(]+("+n+")[,|\\s]+("+n+")[,|\\s]+("+n+")[,|\\s]+("+n+")\\s*\\)?";return{CSS_UNIT:new RegExp(n),rgb:new RegExp("rgb"+r),rgba:new RegExp("rgba"+i),hsl:new RegExp("hsl"+r),hsla:new RegExp("hsla"+i),hsv:new RegExp("hsv"+r),hsva:new RegExp("hsva"+i),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}}();function Mr(e){return!!Bn.CSS_UNIT.exec(e)}function Wae(e){e=e.replace(Sae,"").replace(Cae,"").toLowerCase();var t=!1;if(ly[e])e=ly[e],t=!0;else if(e=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var n;return(n=Bn.rgb.exec(e))?{r:n[1],g:n[2],b:n[3]}:(n=Bn.rgba.exec(e))?{r:n[1],g:n[2],b:n[3],a:n[4]}:(n=Bn.hsl.exec(e))?{h:n[1],s:n[2],l:n[3]}:(n=Bn.hsla.exec(e))?{h:n[1],s:n[2],l:n[3],a:n[4]}:(n=Bn.hsv.exec(e))?{h:n[1],s:n[2],v:n[3]}:(n=Bn.hsva.exec(e))?{h:n[1],s:n[2],v:n[3],a:n[4]}:(n=Bn.hex8.exec(e))?{r:en(n[1]),g:en(n[2]),b:en(n[3]),a:BC(n[4]),format:t?"name":"hex8"}:(n=Bn.hex6.exec(e))?{r:en(n[1]),g:en(n[2]),b:en(n[3]),format:t?"name":"hex"}:(n=Bn.hex4.exec(e))?{r:en(n[1]+""+n[1]),g:en(n[2]+""+n[2]),b:en(n[3]+""+n[3]),a:BC(n[4]+""+n[4]),format:t?"name":"hex8"}:(n=Bn.hex3.exec(e))?{r:en(n[1]+""+n[1]),g:en(n[2]+""+n[2]),b:en(n[3]+""+n[3]),format:t?"name":"hex"}:!1}function Vae(e){var t,n;return e=e||{level:"AA",size:"small"},t=(e.level||"AA").toUpperCase(),n=(e.size||"small").toLowerCase(),t!=="AA"&&t!=="AAA"&&(t="AA"),n!=="small"&&n!=="large"&&(n="small"),{level:t,size:n}}var zC=function(t){var n=["r","g","b","a","h","s","l","v"],r=0,i=0;return PI(n,function(o){if(t[o]&&(r+=1,isNaN(t[o])||(i+=1),o==="s"||o==="l")){var a=/^\d+%$/;a.test(t[o])&&(i+=1)}}),r===i?t:!1},Bl=function(t,n){var r=t.hex?ne(t.hex):ne(t),i=r.toHsl(),o=r.toHsv(),a=r.toRgb(),s=r.toHex();i.s===0&&(i.h=n||0,o.h=n||0);var l=s==="000000"&&a.a===0;return{hsl:i,hex:l?"transparent":"#"+s,rgb:a,hsv:o,oldHue:t.h||n||i.h,source:t.source}},Zi=function(t){if(t==="transparent")return!0;var n=String(t).charAt(0)==="#"?1:0;return t.length!==4+n&&t.length<7+n&&ne(t).isValid()},Bb=function(t){if(!t)return"#fff";var n=Bl(t);if(n.hex==="transparent")return"rgba(0,0,0,0.4)";var r=(n.rgb.r*299+n.rgb.g*587+n.rgb.b*114)/1e3;return r>=128?"#000":"#fff"},Tm=function(t,n){var r=t.replace("°","");return ne(n+" ("+r+")")._ok},Il=Object.assign||function(e){for(var t=1;t1&&arguments[1]!==void 0?arguments[1]:"span";return function(r){ese(i,r);function i(){var o,a,s,l;Zae(this,i);for(var u=arguments.length,c=Array(u),d=0;d=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}var Pd=24,dse=AR.default=function(e){var t=e.fill,n=t===void 0?"currentColor":t,r=e.width,i=r===void 0?Pd:r,o=e.height,a=o===void 0?Pd:o,s=e.style,l=s===void 0?{}:s,u=cse(e,["fill","width","height","style"]);return KC.default.createElement("svg",VC({viewBox:"0 0 "+Pd+" "+Pd,style:VC({fill:n,width:i,height:a},l)},u),KC.default.createElement("path",{d:"M12,18.17L8.83,15L7.42,16.41L12,21L16.59,16.41L15.17,15M12,5.83L15.17,9L16.58,7.59L12,3L7.41,7.59L8.83,9L12,5.83Z"}))},fse=function(){function e(t,n){for(var r=0;r1&&(i.a=1),r.props.onChange({h:r.props.hsl.h,s:r.props.hsl.s,l:r.props.hsl.l,a:Math.round(i.a*100)/100,source:"rgb"},o)):(i.h||i.s||i.l)&&(typeof i.s=="string"&&i.s.includes("%")&&(i.s=i.s.replace("%","")),typeof i.l=="string"&&i.l.includes("%")&&(i.l=i.l.replace("%","")),i.s==1?i.s=.01:i.l==1&&(i.l=.01),r.props.onChange({h:i.h||r.props.hsl.h,s:Number(cs(i.s)?r.props.hsl.s:i.s),l:Number(cs(i.l)?r.props.hsl.l:i.l),source:"hsl"},o))},r.showHighlight=function(i){i.currentTarget.style.background="#eee"},r.hideHighlight=function(i){i.currentTarget.style.background="transparent"},n.hsl.a!==1&&n.view==="hex"?r.state={view:"rgb"}:r.state={view:n.view},r}return fse(t,[{key:"render",value:function(){var r=this,i=le({default:{wrap:{paddingTop:"16px",display:"flex"},fields:{flex:"1",display:"flex",marginLeft:"-6px"},field:{paddingLeft:"6px",width:"100%"},alpha:{paddingLeft:"6px",width:"100%"},toggle:{width:"32px",textAlign:"right",position:"relative"},icon:{marginRight:"-4px",marginTop:"12px",cursor:"pointer",position:"relative"},iconHighlight:{position:"absolute",width:"24px",height:"28px",background:"#eee",borderRadius:"4px",top:"10px",left:"12px",display:"none"},input:{fontSize:"11px",color:"#333",width:"100%",borderRadius:"2px",border:"none",boxShadow:"inset 0 0 0 1px #dadada",height:"21px",textAlign:"center"},label:{textTransform:"uppercase",fontSize:"11px",lineHeight:"11px",color:"#969696",textAlign:"center",display:"block",marginTop:"12px"},svg:{fill:"#333",width:"24px",height:"24px",border:"1px transparent solid",borderRadius:"5px"}},disableAlpha:{alpha:{display:"none"}}},this.props,this.state),o=void 0;return this.state.view==="hex"?o=E.createElement("div",{style:i.fields,className:"flexbox-fix"},E.createElement("div",{style:i.field},E.createElement(me,{style:{input:i.input,label:i.label},label:"hex",value:this.props.hex,onChange:this.handleChange}))):this.state.view==="rgb"?o=E.createElement("div",{style:i.fields,className:"flexbox-fix"},E.createElement("div",{style:i.field},E.createElement(me,{style:{input:i.input,label:i.label},label:"r",value:this.props.rgb.r,onChange:this.handleChange})),E.createElement("div",{style:i.field},E.createElement(me,{style:{input:i.input,label:i.label},label:"g",value:this.props.rgb.g,onChange:this.handleChange})),E.createElement("div",{style:i.field},E.createElement(me,{style:{input:i.input,label:i.label},label:"b",value:this.props.rgb.b,onChange:this.handleChange})),E.createElement("div",{style:i.alpha},E.createElement(me,{style:{input:i.input,label:i.label},label:"a",value:this.props.rgb.a,arrowOffset:.01,onChange:this.handleChange}))):this.state.view==="hsl"&&(o=E.createElement("div",{style:i.fields,className:"flexbox-fix"},E.createElement("div",{style:i.field},E.createElement(me,{style:{input:i.input,label:i.label},label:"h",value:Math.round(this.props.hsl.h),onChange:this.handleChange})),E.createElement("div",{style:i.field},E.createElement(me,{style:{input:i.input,label:i.label},label:"s",value:Math.round(this.props.hsl.s*100)+"%",onChange:this.handleChange})),E.createElement("div",{style:i.field},E.createElement(me,{style:{input:i.input,label:i.label},label:"l",value:Math.round(this.props.hsl.l*100)+"%",onChange:this.handleChange})),E.createElement("div",{style:i.alpha},E.createElement(me,{style:{input:i.input,label:i.label},label:"a",value:this.props.hsl.a,arrowOffset:.01,onChange:this.handleChange})))),E.createElement("div",{style:i.wrap,className:"flexbox-fix"},o,E.createElement("div",{style:i.toggle},E.createElement("div",{style:i.icon,onClick:this.toggleViews,ref:function(s){return r.icon=s}},E.createElement(dse,{style:i.svg,onMouseOver:this.showHighlight,onMouseEnter:this.showHighlight,onMouseOut:this.hideHighlight}))))}}],[{key:"getDerivedStateFromProps",value:function(r,i){return r.hsl.a!==1&&i.view==="hex"?{view:"rgb"}:null}}]),t}(E.Component);_R.defaultProps={view:"hex"};var qC=function(){var t=le({default:{picker:{width:"12px",height:"12px",borderRadius:"6px",transform:"translate(-6px, -1px)",backgroundColor:"rgb(248, 248, 248)",boxShadow:"0 1px 4px 0 rgba(0, 0, 0, 0.37)"}}});return E.createElement("div",{style:t.picker})},mse=function(){var t=le({default:{picker:{width:"12px",height:"12px",borderRadius:"6px",boxShadow:"inset 0 0 0 1px #fff",transform:"translate(-6px, -6px)"}}});return E.createElement("div",{style:t.picker})},Wb=function(t){var n=t.width,r=t.onChange,i=t.disableAlpha,o=t.rgb,a=t.hsl,s=t.hsv,l=t.hex,u=t.renderers,c=t.styles,d=c===void 0?{}:c,f=t.className,p=f===void 0?"":f,y=t.defaultView,g=le(Jt({default:{picker:{width:n,background:"#fff",borderRadius:"2px",boxShadow:"0 0 2px rgba(0,0,0,.3), 0 4px 8px rgba(0,0,0,.3)",boxSizing:"initial",fontFamily:"Menlo"},saturation:{width:"100%",paddingBottom:"55%",position:"relative",borderRadius:"2px 2px 0 0",overflow:"hidden"},Saturation:{radius:"2px 2px 0 0"},body:{padding:"16px 16px 12px"},controls:{display:"flex"},color:{width:"32px"},swatch:{marginTop:"6px",width:"16px",height:"16px",borderRadius:"8px",position:"relative",overflow:"hidden"},active:{absolute:"0px 0px 0px 0px",borderRadius:"8px",boxShadow:"inset 0 0 0 1px rgba(0,0,0,.1)",background:"rgba("+o.r+", "+o.g+", "+o.b+", "+o.a+")",zIndex:"2"},toggles:{flex:"1"},hue:{height:"10px",position:"relative",marginBottom:"8px"},Hue:{radius:"2px"},alpha:{height:"10px",position:"relative"},Alpha:{radius:"2px"}},disableAlpha:{color:{width:"22px"},alpha:{display:"none"},hue:{marginBottom:"0px"},swatch:{width:"10px",height:"10px",marginTop:"0px"}}},d),{disableAlpha:i});return E.createElement("div",{style:g.picker,className:"chrome-picker "+p},E.createElement("div",{style:g.saturation},E.createElement(mh,{style:g.Saturation,hsl:a,hsv:s,pointer:mse,onChange:r})),E.createElement("div",{style:g.body},E.createElement("div",{style:g.controls,className:"flexbox-fix"},E.createElement("div",{style:g.color},E.createElement("div",{style:g.swatch},E.createElement("div",{style:g.active}),E.createElement(al,{renderers:u}))),E.createElement("div",{style:g.toggles},E.createElement("div",{style:g.hue},E.createElement(sl,{style:g.Hue,hsl:a,pointer:qC,onChange:r})),E.createElement("div",{style:g.alpha},E.createElement(Gb,{style:g.Alpha,rgb:o,hsl:a,pointer:qC,renderers:u,onChange:r})))),E.createElement(_R,{rgb:o,hsl:a,hex:l,view:y,onChange:r,disableAlpha:i})))};Wb.propTypes={width:H.oneOfType([H.string,H.number]),disableAlpha:H.bool,styles:H.object,defaultView:H.oneOf(["hex","rgb","hsl"])};Wb.defaultProps={width:225,disableAlpha:!1,styles:{}};Zt(Wb);var vse=function(t){var n=t.color,r=t.onClick,i=r===void 0?function(){}:r,o=t.onSwatchHover,a=t.active,s=le({default:{color:{background:n,width:"15px",height:"15px",float:"left",marginRight:"5px",marginBottom:"5px",position:"relative",cursor:"pointer"},dot:{absolute:"5px 5px 5px 5px",background:Bb(n),borderRadius:"50%",opacity:"0"}},active:{dot:{opacity:"1"}},"color-#FFFFFF":{color:{boxShadow:"inset 0 0 0 1px #ddd"},dot:{background:"#000"}},transparent:{dot:{background:"#000"}}},{active:a,"color-#FFFFFF":n==="#FFFFFF",transparent:n==="transparent"});return E.createElement(Qo,{style:s.color,color:n,onClick:i,onHover:o,focusStyle:{boxShadow:"0 0 4px "+n}},E.createElement("div",{style:s.dot}))},yse=function(t){var n=t.hex,r=t.rgb,i=t.onChange,o=le({default:{fields:{display:"flex",paddingBottom:"6px",paddingRight:"5px",position:"relative"},active:{position:"absolute",top:"6px",left:"5px",height:"9px",width:"9px",background:n},HEXwrap:{flex:"6",position:"relative"},HEXinput:{width:"80%",padding:"0px",paddingLeft:"20%",border:"none",outline:"none",background:"none",fontSize:"12px",color:"#333",height:"16px"},HEXlabel:{display:"none"},RGBwrap:{flex:"3",position:"relative"},RGBinput:{width:"70%",padding:"0px",paddingLeft:"30%",border:"none",outline:"none",background:"none",fontSize:"12px",color:"#333",height:"16px"},RGBlabel:{position:"absolute",top:"3px",left:"0px",lineHeight:"16px",textTransform:"uppercase",fontSize:"12px",color:"#999"}}}),a=function(l,u){l.r||l.g||l.b?i({r:l.r||r.r,g:l.g||r.g,b:l.b||r.b,source:"rgb"},u):i({hex:l.hex,source:"hex"},u)};return E.createElement("div",{style:o.fields,className:"flexbox-fix"},E.createElement("div",{style:o.active}),E.createElement(me,{style:{wrap:o.HEXwrap,input:o.HEXinput,label:o.HEXlabel},label:"hex",value:n,onChange:a}),E.createElement(me,{style:{wrap:o.RGBwrap,input:o.RGBinput,label:o.RGBlabel},label:"r",value:r.r,onChange:a}),E.createElement(me,{style:{wrap:o.RGBwrap,input:o.RGBinput,label:o.RGBlabel},label:"g",value:r.g,onChange:a}),E.createElement(me,{style:{wrap:o.RGBwrap,input:o.RGBinput,label:o.RGBlabel},label:"b",value:r.b,onChange:a}))},Vb=function(t){var n=t.onChange,r=t.onSwatchHover,i=t.colors,o=t.hex,a=t.rgb,s=t.styles,l=s===void 0?{}:s,u=t.className,c=u===void 0?"":u,d=le(Jt({default:{Compact:{background:"#f6f6f6",radius:"4px"},compact:{paddingTop:"5px",paddingLeft:"5px",boxSizing:"initial",width:"240px"},clear:{clear:"both"}}},l)),f=function(y,g){y.hex?Zi(y.hex)&&n({hex:y.hex,source:"hex"},g):n(y,g)};return E.createElement(Ac,{style:d.Compact,styles:l},E.createElement("div",{style:d.compact,className:"compact-picker "+c},E.createElement("div",null,qe(i,function(p){return E.createElement(vse,{key:p,color:p,active:p.toLowerCase()===o,onClick:f,onSwatchHover:r})}),E.createElement("div",{style:d.clear})),E.createElement(yse,{hex:o,rgb:a,onChange:f})))};Vb.propTypes={colors:H.arrayOf(H.string),styles:H.object};Vb.defaultProps={colors:["#4D4D4D","#999999","#FFFFFF","#F44E3B","#FE9200","#FCDC00","#DBDF00","#A4DD00","#68CCCA","#73D8FF","#AEA1FF","#FDA1FF","#333333","#808080","#cccccc","#D33115","#E27300","#FCC400","#B0BC00","#68BC00","#16A5A5","#009CE0","#7B64FF","#FA28FF","#000000","#666666","#B3B3B3","#9F0500","#C45100","#FB9E00","#808900","#194D33","#0C797D","#0062B1","#653294","#AB149E"],styles:{}};const bse=Zt(Vb);var wse=function(t){var n=t.hover,r=t.color,i=t.onClick,o=t.onSwatchHover,a={position:"relative",zIndex:"2",outline:"2px solid #fff",boxShadow:"0 0 5px 2px rgba(0,0,0,0.25)"},s=le({default:{swatch:{width:"25px",height:"25px",fontSize:"0"}},hover:{swatch:a}},{hover:n});return E.createElement("div",{style:s.swatch},E.createElement(Qo,{color:r,onClick:i,onHover:o,focusStyle:a}))};const Ese=jb(wse);var Kb=function(t){var n=t.width,r=t.colors,i=t.onChange,o=t.onSwatchHover,a=t.triangle,s=t.styles,l=s===void 0?{}:s,u=t.className,c=u===void 0?"":u,d=le(Jt({default:{card:{width:n,background:"#fff",border:"1px solid rgba(0,0,0,0.2)",boxShadow:"0 3px 12px rgba(0,0,0,0.15)",borderRadius:"4px",position:"relative",padding:"5px",display:"flex",flexWrap:"wrap"},triangle:{position:"absolute",border:"7px solid transparent",borderBottomColor:"#fff"},triangleShadow:{position:"absolute",border:"8px solid transparent",borderBottomColor:"rgba(0,0,0,0.15)"}},"hide-triangle":{triangle:{display:"none"},triangleShadow:{display:"none"}},"top-left-triangle":{triangle:{top:"-14px",left:"10px"},triangleShadow:{top:"-16px",left:"9px"}},"top-right-triangle":{triangle:{top:"-14px",right:"10px"},triangleShadow:{top:"-16px",right:"9px"}},"bottom-left-triangle":{triangle:{top:"35px",left:"10px",transform:"rotate(180deg)"},triangleShadow:{top:"37px",left:"9px",transform:"rotate(180deg)"}},"bottom-right-triangle":{triangle:{top:"35px",right:"10px",transform:"rotate(180deg)"},triangleShadow:{top:"37px",right:"9px",transform:"rotate(180deg)"}}},l),{"hide-triangle":a==="hide","top-left-triangle":a==="top-left","top-right-triangle":a==="top-right","bottom-left-triangle":a==="bottom-left","bottom-right-triangle":a==="bottom-right"}),f=function(y,g){return i({hex:y,source:"hex"},g)};return E.createElement("div",{style:d.card,className:"github-picker "+c},E.createElement("div",{style:d.triangleShadow}),E.createElement("div",{style:d.triangle}),qe(r,function(p){return E.createElement(Ese,{color:p,key:p,onClick:f,onSwatchHover:o})}))};Kb.propTypes={width:H.oneOfType([H.string,H.number]),colors:H.arrayOf(H.string),triangle:H.oneOf(["hide","top-left","top-right","bottom-left","bottom-right"]),styles:H.object};Kb.defaultProps={width:200,colors:["#B80000","#DB3E00","#FCCB00","#008B02","#006B76","#1273DE","#004DCF","#5300EB","#EB9694","#FAD0C3","#FEF3BD","#C1E1C5","#BEDADC","#C4DEF6","#BED3F3","#D4C4FB"],triangle:"top-left",styles:{}};Zt(Kb);var xse=function(t){var n=t.direction,r=le({default:{picker:{width:"18px",height:"18px",borderRadius:"50%",transform:"translate(-9px, -1px)",backgroundColor:"rgb(248, 248, 248)",boxShadow:"0 1px 4px 0 rgba(0, 0, 0, 0.37)"}},vertical:{picker:{transform:"translate(-3px, -9px)"}}},{vertical:n==="vertical"});return E.createElement("div",{style:r.picker})},Sse=Object.assign||function(e){for(var t=1;t.5});return E.createElement("div",{style:r.picker})},Ose=function(){var t=le({default:{triangle:{width:0,height:0,borderStyle:"solid",borderWidth:"4px 0 4px 6px",borderColor:"transparent transparent transparent #fff",position:"absolute",top:"1px",left:"1px"},triangleBorder:{width:0,height:0,borderStyle:"solid",borderWidth:"5px 0 5px 8px",borderColor:"transparent transparent transparent #555"},left:{Extend:"triangleBorder",transform:"translate(-13px, -4px)"},leftInside:{Extend:"triangle",transform:"translate(-8px, -5px)"},right:{Extend:"triangleBorder",transform:"translate(20px, -14px) rotate(180deg)"},rightInside:{Extend:"triangle",transform:"translate(-8px, -5px)"}}});return E.createElement("div",{style:t.pointer},E.createElement("div",{style:t.left},E.createElement("div",{style:t.leftInside})),E.createElement("div",{style:t.right},E.createElement("div",{style:t.rightInside})))},YC=function(t){var n=t.onClick,r=t.label,i=t.children,o=t.active,a=le({default:{button:{backgroundImage:"linear-gradient(-180deg, #FFFFFF 0%, #E6E6E6 100%)",border:"1px solid #878787",borderRadius:"2px",height:"20px",boxShadow:"0 1px 0 0 #EAEAEA",fontSize:"14px",color:"#000",lineHeight:"20px",textAlign:"center",marginBottom:"10px",cursor:"pointer"}},active:{button:{boxShadow:"0 0 0 1px #878787"}}},{active:o});return E.createElement("div",{style:a.button,onClick:n},r||i)},Ase=function(t){var n=t.rgb,r=t.currentColor,i=le({default:{swatches:{border:"1px solid #B3B3B3",borderBottom:"1px solid #F0F0F0",marginBottom:"2px",marginTop:"1px"},new:{height:"34px",background:"rgb("+n.r+","+n.g+", "+n.b+")",boxShadow:"inset 1px 0 0 #000, inset -1px 0 0 #000, inset 0 1px 0 #000"},current:{height:"34px",background:r,boxShadow:"inset 1px 0 0 #000, inset -1px 0 0 #000, inset 0 -1px 0 #000"},label:{fontSize:"14px",color:"#000",textAlign:"center"}}});return E.createElement("div",null,E.createElement("div",{style:i.label},"new"),E.createElement("div",{style:i.swatches},E.createElement("div",{style:i.new}),E.createElement("div",{style:i.current})),E.createElement("div",{style:i.label},"current"))},_se=function(){function e(t,n){for(var r=0;r100&&(c.a=100),c.a/=100,n({h:i.h,s:i.s,l:i.l,a:c.a,source:"rgb"},d))};return E.createElement("div",{style:s.fields,className:"flexbox-fix"},E.createElement("div",{style:s.double},E.createElement(me,{style:{input:s.input,label:s.label},label:"hex",value:o.replace("#",""),onChange:l})),E.createElement("div",{style:s.single},E.createElement(me,{style:{input:s.input,label:s.label},label:"r",value:r.r,onChange:l,dragLabel:"true",dragMax:"255"})),E.createElement("div",{style:s.single},E.createElement(me,{style:{input:s.input,label:s.label},label:"g",value:r.g,onChange:l,dragLabel:"true",dragMax:"255"})),E.createElement("div",{style:s.single},E.createElement(me,{style:{input:s.input,label:s.label},label:"b",value:r.b,onChange:l,dragLabel:"true",dragMax:"255"})),E.createElement("div",{style:s.alpha},E.createElement(me,{style:{input:s.input,label:s.label},label:"a",value:Math.round(r.a*100),onChange:l,dragLabel:"true",dragMax:"100"})))},$se=Object.assign||function(e){for(var t=1;t=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}var Od=24,Gse=NR.default=function(e){var t=e.fill,n=t===void 0?"currentColor":t,r=e.width,i=r===void 0?Od:r,o=e.height,a=o===void 0?Od:o,s=e.style,l=s===void 0?{}:s,u=jse(e,["fill","width","height","style"]);return XC.default.createElement("svg",QC({viewBox:"0 0 "+Od+" "+Od,style:QC({fill:n,width:i,height:a},l)},u),XC.default.createElement("path",{d:"M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"}))},Bse=function(t){var n=t.color,r=t.onClick,i=r===void 0?function(){}:r,o=t.onSwatchHover,a=t.first,s=t.last,l=t.active,u=le({default:{color:{width:"40px",height:"24px",cursor:"pointer",background:n,marginBottom:"1px"},check:{color:Bb(n),marginLeft:"8px",display:"none"}},first:{color:{overflow:"hidden",borderRadius:"2px 2px 0 0"}},last:{color:{overflow:"hidden",borderRadius:"0 0 2px 2px"}},active:{check:{display:"block"}},"color-#FFFFFF":{color:{boxShadow:"inset 0 0 0 1px #ddd"},check:{color:"#333"}},transparent:{check:{color:"#333"}}},{first:a,last:s,active:l,"color-#FFFFFF":n==="#FFFFFF",transparent:n==="transparent"});return E.createElement(Qo,{color:n,style:u.color,onClick:i,onHover:o,focusStyle:{boxShadow:"0 0 4px "+n}},E.createElement("div",{style:u.check},E.createElement(Gse,null)))},zse=function(t){var n=t.onClick,r=t.onSwatchHover,i=t.group,o=t.active,a=le({default:{group:{paddingBottom:"10px",width:"40px",float:"left",marginRight:"10px"}}});return E.createElement("div",{style:a.group},qe(i,function(s,l){return E.createElement(Bse,{key:s,color:s,active:s.toLowerCase()===o,first:l===0,last:l===i.length-1,onClick:n,onSwatchHover:r})}))},Jb=function(t){var n=t.width,r=t.height,i=t.onChange,o=t.onSwatchHover,a=t.colors,s=t.hex,l=t.styles,u=l===void 0?{}:l,c=t.className,d=c===void 0?"":c,f=le(Jt({default:{picker:{width:n,height:r},overflow:{height:r,overflowY:"scroll"},body:{padding:"16px 0 6px 16px"},clear:{clear:"both"}}},u)),p=function(g,w){return i({hex:g,source:"hex"},w)};return E.createElement("div",{style:f.picker,className:"swatches-picker "+d},E.createElement(Ac,null,E.createElement("div",{style:f.overflow},E.createElement("div",{style:f.body},qe(a,function(y){return E.createElement(zse,{key:y.toString(),group:y,active:s,onClick:p,onSwatchHover:o})}),E.createElement("div",{style:f.clear})))))};Jb.propTypes={width:H.oneOfType([H.string,H.number]),height:H.oneOfType([H.string,H.number]),colors:H.arrayOf(H.arrayOf(H.string)),styles:H.object};Jb.defaultProps={width:320,height:240,colors:[[la[900],la[700],la[500],la[300],la[100]],[ua[900],ua[700],ua[500],ua[300],ua[100]],[ca[900],ca[700],ca[500],ca[300],ca[100]],[da[900],da[700],da[500],da[300],da[100]],[fa[900],fa[700],fa[500],fa[300],fa[100]],[pa[900],pa[700],pa[500],pa[300],pa[100]],[ha[900],ha[700],ha[500],ha[300],ha[100]],[ga[900],ga[700],ga[500],ga[300],ga[100]],[ma[900],ma[700],ma[500],ma[300],ma[100]],["#194D33",zl[700],zl[500],zl[300],zl[100]],[va[900],va[700],va[500],va[300],va[100]],[ya[900],ya[700],ya[500],ya[300],ya[100]],[ba[900],ba[700],ba[500],ba[300],ba[100]],[wa[900],wa[700],wa[500],wa[300],wa[100]],[Ea[900],Ea[700],Ea[500],Ea[300],Ea[100]],[xa[900],xa[700],xa[500],xa[300],xa[100]],[Sa[900],Sa[700],Sa[500],Sa[300],Sa[100]],[Ca[900],Ca[700],Ca[500],Ca[300],Ca[100]],["#000000","#525252","#969696","#D9D9D9","#FFFFFF"]],styles:{}};Zt(Jb);var Zb=function(t){var n=t.onChange,r=t.onSwatchHover,i=t.hex,o=t.colors,a=t.width,s=t.triangle,l=t.styles,u=l===void 0?{}:l,c=t.className,d=c===void 0?"":c,f=le(Jt({default:{card:{width:a,background:"#fff",border:"0 solid rgba(0,0,0,0.25)",boxShadow:"0 1px 4px rgba(0,0,0,0.25)",borderRadius:"4px",position:"relative"},body:{padding:"15px 9px 9px 15px"},label:{fontSize:"18px",color:"#fff"},triangle:{width:"0px",height:"0px",borderStyle:"solid",borderWidth:"0 9px 10px 9px",borderColor:"transparent transparent #fff transparent",position:"absolute"},triangleShadow:{width:"0px",height:"0px",borderStyle:"solid",borderWidth:"0 9px 10px 9px",borderColor:"transparent transparent rgba(0,0,0,.1) transparent",position:"absolute"},hash:{background:"#F0F0F0",height:"30px",width:"30px",borderRadius:"4px 0 0 4px",float:"left",color:"#98A1A4",display:"flex",alignItems:"center",justifyContent:"center"},input:{width:"100px",fontSize:"14px",color:"#666",border:"0px",outline:"none",height:"28px",boxShadow:"inset 0 0 0 1px #F0F0F0",boxSizing:"content-box",borderRadius:"0 4px 4px 0",float:"left",paddingLeft:"8px"},swatch:{width:"30px",height:"30px",float:"left",borderRadius:"4px",margin:"0 6px 6px 0"},clear:{clear:"both"}},"hide-triangle":{triangle:{display:"none"},triangleShadow:{display:"none"}},"top-left-triangle":{triangle:{top:"-10px",left:"12px"},triangleShadow:{top:"-11px",left:"12px"}},"top-right-triangle":{triangle:{top:"-10px",right:"12px"},triangleShadow:{top:"-11px",right:"12px"}}},u),{"hide-triangle":s==="hide","top-left-triangle":s==="top-left","top-right-triangle":s==="top-right"}),p=function(g,w){Zi(g)&&n({hex:g,source:"hex"},w)};return E.createElement("div",{style:f.card,className:"twitter-picker "+d},E.createElement("div",{style:f.triangleShadow}),E.createElement("div",{style:f.triangle}),E.createElement("div",{style:f.body},qe(o,function(y,g){return E.createElement(Qo,{key:g,color:y,hex:y,style:f.swatch,onClick:p,onHover:r,focusStyle:{boxShadow:"0 0 4px "+y}})}),E.createElement("div",{style:f.hash},"#"),E.createElement(me,{label:null,style:{input:f.input},value:i.replace("#",""),onChange:p}),E.createElement("div",{style:f.clear})))};Zb.propTypes={width:H.oneOfType([H.string,H.number]),triangle:H.oneOf(["hide","top-left","top-right"]),colors:H.arrayOf(H.string),styles:H.object};Zb.defaultProps={width:276,colors:["#FF6900","#FCB900","#7BDCB5","#00D084","#8ED1FC","#0693E3","#ABB8C3","#EB144C","#F78DA7","#9900EF"],triangle:"top-left",styles:{}};Zt(Zb);var ew=function(t){var n=le({default:{picker:{width:"20px",height:"20px",borderRadius:"22px",border:"2px #fff solid",transform:"translate(-12px, -13px)",background:"hsl("+Math.round(t.hsl.h)+", "+Math.round(t.hsl.s*100)+"%, "+Math.round(t.hsl.l*100)+"%)"}}});return E.createElement("div",{style:n.picker})};ew.propTypes={hsl:H.shape({h:H.number,s:H.number,l:H.number,a:H.number})};ew.defaultProps={hsl:{a:1,h:249.94,l:.2,s:.5}};var tw=function(t){var n=le({default:{picker:{width:"20px",height:"20px",borderRadius:"22px",transform:"translate(-10px, -7px)",background:"hsl("+Math.round(t.hsl.h)+", 100%, 50%)",border:"2px white solid"}}});return E.createElement("div",{style:n.picker})};tw.propTypes={hsl:H.shape({h:H.number,s:H.number,l:H.number,a:H.number})};tw.defaultProps={hsl:{a:1,h:249.94,l:.2,s:.5}};var Use=function(t){var n=t.onChange,r=t.rgb,i=t.hsl,o=t.hex,a=t.hsv,s=function(p,y){if(p.hex)Zi(p.hex)&&n({hex:p.hex,source:"hex"},y);else if(p.rgb){var g=p.rgb.split(",");Tm(p.rgb,"rgb")&&n({r:g[0],g:g[1],b:g[2],a:1,source:"rgb"},y)}else if(p.hsv){var w=p.hsv.split(",");Tm(p.hsv,"hsv")&&(w[2]=w[2].replace("%",""),w[1]=w[1].replace("%",""),w[0]=w[0].replace("°",""),w[1]==1?w[1]=.01:w[2]==1&&(w[2]=.01),n({h:Number(w[0]),s:Number(w[1]),v:Number(w[2]),source:"hsv"},y))}else if(p.hsl){var h=p.hsl.split(",");Tm(p.hsl,"hsl")&&(h[2]=h[2].replace("%",""),h[1]=h[1].replace("%",""),h[0]=h[0].replace("°",""),d[1]==1?d[1]=.01:d[2]==1&&(d[2]=.01),n({h:Number(h[0]),s:Number(h[1]),v:Number(h[2]),source:"hsl"},y))}},l=le({default:{wrap:{display:"flex",height:"100px",marginTop:"4px"},fields:{width:"100%"},column:{paddingTop:"10px",display:"flex",justifyContent:"space-between"},double:{padding:"0px 4.4px",boxSizing:"border-box"},input:{width:"100%",height:"38px",boxSizing:"border-box",padding:"4px 10% 3px",textAlign:"center",border:"1px solid #dadce0",fontSize:"11px",textTransform:"lowercase",borderRadius:"5px",outline:"none",fontFamily:"Roboto,Arial,sans-serif"},input2:{height:"38px",width:"100%",border:"1px solid #dadce0",boxSizing:"border-box",fontSize:"11px",textTransform:"lowercase",borderRadius:"5px",outline:"none",paddingLeft:"10px",fontFamily:"Roboto,Arial,sans-serif"},label:{textAlign:"center",fontSize:"12px",background:"#fff",position:"absolute",textTransform:"uppercase",color:"#3c4043",width:"35px",top:"-6px",left:"0",right:"0",marginLeft:"auto",marginRight:"auto",fontFamily:"Roboto,Arial,sans-serif"},label2:{left:"10px",textAlign:"center",fontSize:"12px",background:"#fff",position:"absolute",textTransform:"uppercase",color:"#3c4043",width:"32px",top:"-6px",fontFamily:"Roboto,Arial,sans-serif"},single:{flexGrow:"1",margin:"0px 4.4px"}}}),u=r.r+", "+r.g+", "+r.b,c=Math.round(i.h)+"°, "+Math.round(i.s*100)+"%, "+Math.round(i.l*100)+"%",d=Math.round(a.h)+"°, "+Math.round(a.s*100)+"%, "+Math.round(a.v*100)+"%";return E.createElement("div",{style:l.wrap,className:"flexbox-fix"},E.createElement("div",{style:l.fields},E.createElement("div",{style:l.double},E.createElement(me,{style:{input:l.input,label:l.label},label:"hex",value:o,onChange:s})),E.createElement("div",{style:l.column},E.createElement("div",{style:l.single},E.createElement(me,{style:{input:l.input2,label:l.label2},label:"rgb",value:u,onChange:s})),E.createElement("div",{style:l.single},E.createElement(me,{style:{input:l.input2,label:l.label2},label:"hsv",value:d,onChange:s})),E.createElement("div",{style:l.single},E.createElement(me,{style:{input:l.input2,label:l.label2},label:"hsl",value:c,onChange:s})))))},nw=function(t){var n=t.width,r=t.onChange,i=t.rgb,o=t.hsl,a=t.hsv,s=t.hex,l=t.header,u=t.styles,c=u===void 0?{}:u,d=t.className,f=d===void 0?"":d,p=le(Jt({default:{picker:{width:n,background:"#fff",border:"1px solid #dfe1e5",boxSizing:"initial",display:"flex",flexWrap:"wrap",borderRadius:"8px 8px 0px 0px"},head:{height:"57px",width:"100%",paddingTop:"16px",paddingBottom:"16px",paddingLeft:"16px",fontSize:"20px",boxSizing:"border-box",fontFamily:"Roboto-Regular,HelveticaNeue,Arial,sans-serif"},saturation:{width:"70%",padding:"0px",position:"relative",overflow:"hidden"},swatch:{width:"30%",height:"228px",padding:"0px",background:"rgba("+i.r+", "+i.g+", "+i.b+", 1)",position:"relative",overflow:"hidden"},body:{margin:"auto",width:"95%"},controls:{display:"flex",boxSizing:"border-box",height:"52px",paddingTop:"22px"},color:{width:"32px"},hue:{height:"8px",position:"relative",margin:"0px 16px 0px 16px",width:"100%"},Hue:{radius:"2px"}}},c));return E.createElement("div",{style:p.picker,className:"google-picker "+f},E.createElement("div",{style:p.head},l),E.createElement("div",{style:p.swatch}),E.createElement("div",{style:p.saturation},E.createElement(mh,{hsl:o,hsv:a,pointer:ew,onChange:r})),E.createElement("div",{style:p.body},E.createElement("div",{style:p.controls,className:"flexbox-fix"},E.createElement("div",{style:p.hue},E.createElement(sl,{style:p.Hue,hsl:o,radius:"4px",pointer:tw,onChange:r}))),E.createElement(Use,{rgb:i,hsl:o,hex:s,hsv:a,onChange:r})))};nw.propTypes={width:H.oneOfType([H.string,H.number]),styles:H.object,header:H.string};nw.defaultProps={width:652,styles:{},header:"Color picker"};Zt(nw);class Wse extends R.Component{componentDidMount(){this.props.setFocusHandler(()=>this.inputElement&&this.inputElement.focus())}render(){const{value:t,placeholder:n,onChange:r,onKeyPress:i}=this.props,o=u=>{u.key==="Enter"&&u.metaKey&&u.target.blur()},a=t.length>0?t:"rgba(0,0,0,0)",s=T("div",{children:T(Qt,{size:"small",value:t,placeholder:n,style:{width:"8em",borderLeft:"17px solid "+a,paddingLeft:"5px"},transparent:!0,onKeyPress:i,onKeyDown:o,ref:u=>this.inputElement=u,onChange:u=>r(u.target.value)})}),l=T(bse,{color:t,onChangeComplete:u=>{r(u.hex)}});return T(ue.Field,{children:T(fn,{trigger:s,content:l,on:"click",position:"bottom center"})})}}class Vse extends R.Component{constructor(t){super(t),this.state={numericValue:t.value,stringValue:t.value+""}}componentDidMount(){this.props.setFocusHandler(()=>this.inputElement&&this.inputElement.focus())}static getDerivedStateFromProps(t,n){return n.numericValue!==t.value?{numericValue:t.value,stringValue:t.value+""}:n}onChange(t){const n=Number(t);O0(this.props.styleKey,n)===n?(this.setState({numericValue:n,stringValue:t}),this.props.onChange(n)):this.setState({stringValue:t})}render(){const{placeholder:t,min:n,max:r,step:i,onKeyPress:o}=this.props,a=d=>{d.key==="Enter"&&d.metaKey&&d.target.blur()},s=d=>Math.round(100*(Math.log(d+1)-Math.log(n+1))/(Math.log(r+1)-Math.log(n+1))),l=d=>{const f=Math.exp(d*(Math.log(r+1)-Math.log(n+1))/100+Math.log(n+1))-1;return f>i?Math.round(f/i)*i:Math.round(f)},u=T(Qt,{size:"small",value:this.state.stringValue,placeholder:t,transparent:!0,style:{width:"8em"},onKeyPress:o,onKeyDown:a,ref:d=>this.inputElement=d,onChange:d=>this.onChange(d.target.value)}),c=T("input",{type:"range",min:0,max:100,step:1,value:s(this.state.numericValue),style:{width:"10em"},onChange:d=>this.onChange(l(Number(d.target.value)))});return T(ue.Field,{children:T(fn,{trigger:u,content:c,on:"click",position:"bottom center"})})}}class Kse extends R.Component{render(){const{value:t,placeholder:n,options:r,onChange:i}=this.props,o=r.map(s=>({text:s,value:s})),a=T("span",{children:n||t});return T(ue.Field,{children:T(vt,{trigger:a,options:o,defaultValue:t,onChange:(s,{value:l})=>i(l)})})}}const uy=async(e,t)=>{if(e.lengthnew Promise((t,n)=>{const r=document.createElement("img");r.onload=()=>{t(r)},r.onerror=()=>{n("Failed to load image")},r.src=e}),Yse=(e,t)=>{const n=document.createElement("canvas");return n.width=Math.max(1,e.naturalWidth*t),n.height=Math.max(1,e.naturalHeight*t),n.getContext("2d").drawImage(e,0,0,n.width,n.height),n.toDataURL()},Qse=e=>function(t,n){let r;const i=kR.find(o=>o.recognise(t));if(i)try{r=i.parse(t,n)}catch(o){return{errorMessage:o.toString()}}else return{errorMessage:"No format found"};return e(l_(r)),e($N()),{}},RR=(e,t,n)=>{const r="text/plain";if(e.types.includes(r)){const i=e.getData(r),o=kR.find(a=>a.recognise(i));if(o)try{switch(o.outputType){case"graph":const a=o.parse(i,t);n.onGraph&&n.onGraph(a);break;case"svg":const s=o.parse(i);n.onSvgImageUrl&&n.onSvgImageUrl(s);break}}catch(a){console.error(a)}}else if(e.types.includes("Files")){const i=new FileReader;i.readAsDataURL(e.files[0]),i.onloadend=function(){const o=i.result;n.onPngImageUrl&&n.onPngImageUrl(o)}}},Xse=e=>function(t,n){const r=n(),i=$R(r),o=r.selection,a=e.clipboardData;RR(a,i,{onGraph:s=>{t(l_(s))},onPngImageUrl:s=>{o.entities.length>0?uy(s,1024*10).then(l=>{t(Iv(o,"node-background-image",l))}):uy(s,1024*100).then(l=>{t(Nv("background-image",l))})},onSvgImageUrl:s=>{o.entities.length>0?t(Iv(o,"node-icon-image",s)):t(Nv("background-image",s))}})},kR=[{recognise:e=>new RegExp("^{.*}$","s").test(e.trim()),outputType:"graph",parse:e=>{const t=JSON.parse(e),n=Bs(t),{nodes:r,relationships:i}=n.graph,o=Math.min(...r.map(u=>u.position.x)),a=Math.min(...r.map(u=>u.position.y)),s=new oe(-o,-a);return{nodes:r.map(u=>tA(u,s)),relationships:i}}},{recognise:e=>new DOMParser().parseFromString(e.trim(),"image/svg+xml").documentElement.tagName==="svg",outputType:"svg",parse:e=>"data:image/svg+xml;base64,"+Us.encode(e.trim())},{recognise:e=>e&&e.length<1e4,outputType:"graph",parse:(e,t)=>{const n=e.split(` `).filter(i=>i&&i.trim().length>0);return{nodes:n.flatMap((i,o)=>i.split(" ").map((s,l)=>({id:"n"+n.length*l+o,position:new Y(t*l,t*o),caption:s,style:{},labels:[],properties:{}}))),relationships:[]}}}],$R=e=>Re(e).style.radius*2.5;class Jse extends R.Component{componentDidMount(){this.props.setFocusHandler(()=>this.inputElement&&this.inputElement.focus())}render(){const{placeholder:t,onKeyPress:n,onChange:r}=this.props,i=d=>{d.key==="Enter"&&d.metaKey&&d.target.blur()},o=d=>{d.clipboardData.setData("text/plain",this.props.value),d.preventDefault()},a=d=>{const f=d.clipboardData;RR(f,0,{onPngImageUrl:p=>{uy(p,1024*10).then(y=>{r(y)})},onSvgImageUrl:p=>{r(p),d.preventDefault()}})},s=this.props.cachedImages[this.props.value];let l=this.props.value;l&&l.length>1e3&&(l=l.substring(0,1e3)+"…");const u=T(Qt,{size:"small",value:l,placeholder:t,transparent:!0,style:{width:"8em"},onKeyPress:n,onKeyDown:i,ref:d=>this.inputElement=d,onChange:d=>r(d.target.value),onCopy:o,onPaste:a}),c=s?F("p",{children:["Status: ",(s||{}).status]}):F("p",{children:["Paste a bitmap image from the clipboard, or type in the URL of an image (PNG or SVG).",T("br",{}),T("code",{children:"https:"})," or ",T("code",{children:"data:"})," URL schemes are supported. If the URL is hosted on the web, it needs to served with permissive CORS headers - generally it's easier to paste an image instead!"]});return T(ue.Field,{children:T(fn,{trigger:u,content:c,on:"click",position:"bottom center"})})}}class Zse extends R.Component{constructor(t){super(t),this.state={numericValue:parseFloat(t.value),stringValue:t.value}}componentDidMount(){this.props.setFocusHandler(()=>this.inputElement&&this.inputElement.focus())}static getDerivedStateFromProps(t,n){return n.numericValue+"%"!==t.value?{numericValue:parseFloat(t.value),stringValue:t.value}:n}onChange(t){const n=parseFloat(t);O0(this.props.styleKey,n)===n?(this.setState({numericValue:n,stringValue:t}),this.props.onChange(t)):this.setState({stringValue:t})}render(){const{placeholder:t,min:n,max:r,step:i,onKeyPress:o}=this.props,a=d=>{d.key==="Enter"&&d.metaKey&&d.target.blur()},s=d=>Math.round(100*(Math.log(d+1)-Math.log(n+1))/(Math.log(r+1)-Math.log(n+1))),l=d=>{const f=Math.exp(d*(Math.log(r+1)-Math.log(n+1))/100+Math.log(n+1))-1;return f>i?Math.round(f/i)*i:Math.round(f)},u=T(Qt,{size:"small",value:this.state.stringValue,placeholder:t,transparent:!0,style:{width:"8em"},onKeyPress:o,onKeyDown:a,ref:d=>this.inputElement=d,onChange:d=>this.onChange(d.target.value)}),c=T("input",{type:"range",min:0,max:100,step:1,value:s(this.state.numericValue),style:{width:"10em"},onChange:d=>this.onChange(l(d.target.value)+"%")});return T(ue.Field,{children:T(fn,{trigger:u,content:c,on:"click",position:"bottom center"})})}}const ele=(e,t,n,r,i,o,a)=>{const s=Tf[e],l=ZO[s.type];switch(l.editor){case"slider":return T(Vse,{styleKey:e,value:t,min:l.min,max:l.max,step:l.step,placeholder:n,onChange:i,onKeyPress:o,setFocusHandler:a});case"percentageSlider":return T(Zse,{styleKey:e,value:t,min:l.min,max:l.max,step:l.step,placeholder:n,onChange:i,onKeyPress:o,setFocusHandler:a});case"colorPicker":return T(Wse,{value:t,placeholder:n,onChange:i,onKeyPress:o,setFocusHandler:a});case"dropdown":return T(Kse,{value:t,placeholder:n,options:l.options,onChange:i});case"imageUrl":return T(Jse,{value:t,placeholder:n,cachedImages:r,onChange:i,onKeyPress:o,setFocusHandler:a});default:return T(Qt,{fluid:!0,value:t,placeholder:n,onChange:u=>i(u.target.value),onKeyPress:o})}};class tle extends R.Component{constructor(t){super(t),this.state={mouseOver:!1}}onMouseEnter=()=>{this.setState({mouseOver:!0})};onMouseLeave=()=>{this.setState({mouseOver:!1})};render=()=>{const{styleKey:t,styleValue:n,styleValuePlaceholder:r,specialised:i,cachedImages:o,onValueChange:a,onDeleteStyle:s,onNext:l,setFocusHandler:u}=this.props,c=d=>{d.key==="Enter"&&l()};return F(ie.Row,{onMouseEnter:this.onMouseEnter,onMouseLeave:this.onMouseLeave,positive:i,children:[T(ie.Cell,{width:3,collapsing:!0,style:{padding:0},children:F("div",{style:{textAlign:"right"},children:[t,":"]})}),T(ie.Cell,{width:3,children:ele(t,n,r,o,a,c,u)}),T(ie.Cell,{width:1,children:T(xe,{style:{visibility:i?"visible":"hidden"},name:"undo",onClick:s})})]})}}class yh extends R.Component{constructor(t){super(t),this.focusHandlers=[]}static styleInput(t,n,r,i){if(n)switch(r[t].status){case"CONSISTENT":return{styleValue:r[t].value,styleValuePlaceholder:null};default:return{styleValue:"",styleValuePlaceholder:""}}else return{styleValue:i[t],styleValuePlaceholder:null}}render(){const{title:t,style:n,graphStyle:r,possibleStyleAttributes:i,onSaveStyle:o,onDeleteStyle:a}=this.props,s=Object.keys(n),l=[],u=c=>{c{const f=n.hasOwnProperty(c),{styleValue:p,styleValuePlaceholder:y}=yh.styleInput(c,f,n,r);l.push(T(tle,{styleKey:c,specialised:f,styleValue:p,styleValuePlaceholder:y,cachedImages:this.props.cachedImages,onValueChange:g=>o(c,g),onDeleteStyle:()=>a(c),setFocusHandler:g=>this.focusHandlers[d]=g,onNext:()=>u(d+1)},c))}),F(ue.Field,{children:[T("label",{children:t}),T(ie,{compact:!0,collapsing:!0,style:{marginTop:0},children:T(ie.Body,{children:l})})]},"styleTable")}}const nle=e=>{const t=T(ce,{floated:"right",size:"small",icon:"exchange",content:"Reverse",onClick:()=>e.onReverseRelationships(e.selection)}),n=T(ce,{floated:"right",size:"small",icon:"crosshairs",content:"Merge",onClick:()=>e.onMergeNodes(e.selection)}),r=T(ce,{floated:"right",size:"small",icon:"columns",content:"Inline",onClick:()=>e.onInlineRelationships(e.selection)}),i=[T(ce,{floated:"right",size:"small",icon:"trash alternate outline",content:"Delete",onClick:e.onDelete}),T(ce,{floated:"right",size:"small",icon:"clone outline",content:"Duplicate",onClick:e.onDuplicate})],o=xn(e.selection).length>0,a=rle(e.graph,e.selection),s=ile(e.graph,e.selection);return F(ue.Field,{children:[i,o?t:null,a?n:null,s?r:null]})},rle=(e,t)=>dt(t).length>1&&xn(t).length===0,ile=(e,t)=>{if(xn(t).length<1||dt(t).length>0)return!1;const n=new Set,r=new Set;for(const o of sc(e,t))n.add(o.fromId),r.add(o.toId);if(new Set([...n].filter(o=>r.has(o))).size>0)return!1;for(const o of r){const a=e.nodes.find(s=>s.id===o);if(a.labels.length===0&&Object.entries(a.properties).length===0)return!1}return!0};class ole extends R.Component{constructor(t){super(t),this.state={mouseOver:!1}}onMouseEnter=()=>{this.setState({mouseOver:!0})};onMouseLeave=()=>{this.setState({mouseOver:!1})};render=()=>{const{label:t,labelSummary:n,status:r,onAddLabel:i,onRenameLabel:o,onRemoveLabel:a}=this.props;let s=null;r==="PARTIAL"&&(s=T(ue.Field,{children:T(Qt,{size:"small",value:"",placeholder:"",transparent:!0})}));const l=d=>F(ie.Row,{textAlign:"left",children:[T(ie.Cell,{children:T(ce,{basic:!0,color:"black",size:"tiny",onClick:()=>o(d.label),children:d.label})}),T(ie.Cell,{children:T(Je,{children:d.nodeCount})})]},"suggest_"+d.value),u=F(ue,{children:[r==="PARTIAL"?T(ue.Field,{children:T(ce,{onClick:i,basic:!0,color:"black",size:"tiny",content:"Add to all selected nodes",type:"button"},"addLabel")}):null,n.length>0?F(ue.Field,{children:[T("label",{children:"other labels"}),T(ie,{basic:"very",compact:"very",children:T(ie.Body,{children:n.map(l)})})]}):null]}),c=T(Qt,{value:t,onChange:d=>o(d.target.value),transparent:!0});return F(ie.Row,{onMouseEnter:this.onMouseEnter,onMouseLeave:this.onMouseLeave,children:[T(ie.Cell,{width:3,collapsing:!0,children:T(ue.Field,{children:T(fn,{trigger:c,content:u,on:"focus",...n.length>0||r==="PARTIAL"?{}:{open:!1},position:"bottom left",flowing:!0})})}),T(ie.Cell,{width:3,children:s}),T(ie.Cell,{width:1,children:T(xe,{style:{visibility:this.state.mouseOver?"visible":"hidden"},name:"trash alternate outline",onClick:a})})]})}}class ale extends R.Component{render(){const{labels:t,onAddLabel:n,onRenameLabel:r,onRemoveLabel:i,labelSummary:o}=this.props,a=()=>{n("")},s=Object.keys(t).map((l,u)=>T(ole,{label:l,labelSummary:o,status:t[l].status,onAddLabel:()=>n(l),onRenameLabel:c=>r(l,c),onRemoveLabel:()=>i(l)},"row-"+u));return F(ue.Field,{children:[T("label",{children:"Labels"}),T(ie,{compact:!0,collapsing:!0,style:{marginTop:0},children:T(ie.Body,{children:s})}),T(ce,{onClick:a,basic:!0,color:"black",floated:"right",size:"tiny",icon:"plus",content:"Label",type:"button"},"addLabel")]},"labels")}}class sle extends R.Component{render(){const{value:t,onSaveCaption:n,onConvertCaptionsToLabels:r,onConvertCaptionsToPropertyValues:i}=this.props,o=t||"",a=t===void 0?"":null,s=c=>{(c.key==="Escape"||c.key==="Enter"&&c.metaKey)&&this.captionInput.inputRef&&this.captionInput.inputRef.blur()},l=T(Qt,{value:o,onFocus:this.moveCursorToEnd,onChange:c=>n(c.target.value),placeholder:a,ref:c=>this.captionInput=c,onKeyDown:s.bind(this)}),u=F(ue,{children:[T(ue.Field,{children:T(ce,{onClick:r,basic:!0,color:"black",size:"tiny",content:"Use as labels",type:"button"},"convertCaptionsToLabels")}),T(ue.Field,{children:T(ce,{onClick:i,basic:!0,color:"black",size:"tiny",content:"Use as properties",type:"button"},"convertCaptionsToProperties")})]});return F(ue.Field,{children:[T("label",{children:"Caption"}),T(fn,{trigger:l,content:u,on:"click",...t||t===void 0?{}:{open:!1},position:"bottom left"})]},"_caption")}}class lle extends R.Component{constructor(t){super(t)}shouldComponentUpdate(t,n,r){return t.inspectorVisible&&(CL(this.props.graph,t.graph)||this.props.selection!==t.selection||this.props.cachedImages!==t.cachedImages)}moveCursorToEnd(t){const n=t.target.value;t.target.value="",t.target.value=n,t.target.select()}componentDidUpdate(t){this.props.inspectorVisible&&!t.inspectorVisible&&this.captionInput&&this.captionInput.focus()}render(){const{selection:t,graph:n,onSaveCaption:r,onSaveType:i,onDuplicate:o,onDelete:a}=this.props,{reverseRelationships:s,inlineRelationships:l,mergeNodes:u,selectedNodes:c,onSelect:d}=this.props,{onConvertCaptionsToLabels:f,onConvertCaptionsToPropertyValues:p}=this.props,{onAddLabel:y,onRenameLabel:g,onRemoveLabel:w}=this.props,{onSaveArrowsPropertyValue:h,onDeleteArrowsProperty:v}=this.props,{onMergeOnValues:m,onSavePropertyKey:b,onSavePropertyValue:x,onDeleteProperty:C}=this.props,P=[],O=sc(n,t),N=[...c,...O],k={nodes:c.length>0,relationships:O.length>0};if(P.push(T(Gi,{horizontal:!0,clearing:!0,style:{paddingTop:50},children:"Data"},"DataDivider")),k.nodes&&!k.relationships){const B=BS(c.map(q=>q.caption));P.push(T(sle,{value:B,onSaveCaption:q=>r(t,q),onConvertCaptionsToLabels:f,onConvertCaptionsToPropertyValues:p},"caption"))}if(k.nodes){const B=v5(c),q=y5(N,n);P.push(T(ale,{labels:B,labelSummary:q,onAddLabel:Q=>y(t,Q),onRenameLabel:(Q,se)=>g(t,Q,se),onRemoveLabel:Q=>w(t,Q)},"labels"))}if(k.relationships&&!k.nodes){const B=BS(O.map(q=>q.type));P.push(F(ue.Field,{children:[T("label",{children:"Type"}),T(Qt,{value:B||"",onChange:q=>i(t,q.target.value),placeholder:B===void 0?"":null})]},"_type"))}if(k.relationships||k.nodes){const B=yL(N),q=bL(N,n);P.push(T(Eb,{properties:B,propertySummary:q,onMergeOnValues:Q=>m(t,Q),onSavePropertyKey:(Q,se)=>b(t,Q,se),onSavePropertyValue:(Q,se)=>x(t,Q,se),onDeleteProperty:Q=>C(t,Q)},`properties-${N.map(Q=>Q.id).join(",")}`))}P.push(T(Gi,{horizontal:!0,clearing:!0,style:{paddingTop:50},children:"Style"},"StyleDivider")),P.push(T("div",{style:{clear:"both",textAlign:"center"},children:T(ki,{children:T(ce,{secondary:!0,children:"Customize"})})}));const D=uL(c,O,n);for(const B of Fs){const q=B.attributes.filter(Q=>D.includes(Q.appliesTo)).map(Q=>Q.key);q.length>0&&P.push(T(yh,{title:B.name,style:wL(N),graphStyle:n.style,possibleStyleAttributes:q,cachedImages:this.props.cachedImages,onSaveStyle:(Q,se)=>h(t,Q,se),onDeleteStyle:Q=>v(t,Q)},B.name+"Style"))}const L=T("button",{type:"submit",disabled:!0,style:{display:"none"},"aria-hidden":"true"});return T(E.Fragment,{children:T(cn,{basic:!0,style:{margin:0},children:F(ue,{style:{textAlign:"left"},children:[L,F(ue.Field,{children:[T("label",{children:"Selection:"}),MN(dt(t),xn(t),d,"blue")]},"_selected"),T(nle,{graph:n,selection:t,onReverseRelationships:s,onInlineRelationships:B=>l(B),onMergeNodes:u,onDuplicate:o,onDelete:a}),P]})})})}}const DR=({graph:e,gangs:t,selection:n,applicationLayout:r})=>{const i=zo(e,n);if(r.layers&&r.layers.length>0){const o=r.layers.reduce((a,s)=>s.selectorForInspection?a.concat(s.selectorForInspection({graph:e,gangs:t,selection:n})):a,[]);return i.concat(o)}else return i},ule=e=>{const t=Re(e);return{graph:t,cachedImages:e.cachedImages,selection:e.selection,selectedNodes:DR({...e,graph:t}),inspectorVisible:e.applicationLayout.inspectorVisible}},cle=e=>({onAddLabel:(t,n)=>{e(e_(t,n))},onRenameLabel:(t,n,r)=>{e(t_(t,n,r))},onRemoveLabel:(t,n)=>{e(n_(t,n))},onSaveCaption:(t,n)=>{e(Rp(t,n))},onConvertCaptionsToLabels:()=>{e(g5())},onConvertCaptionsToPropertyValues:()=>{e(m5())},onSaveType:(t,n)=>{e(o_(t,n))},onMergeOnValues:(t,n)=>{e(r5(t,n))},onSavePropertyKey:(t,n,r)=>{e(r_(t,n,r))},onSavePropertyValue:(t,n,r)=>{e(i_(t,n,r))},onSaveArrowsPropertyValue:(t,n,r)=>{e(Iv(t,n,r))},onDeleteProperty:(t,n)=>{e(a5(t,n))},onDeleteArrowsProperty:(t,n)=>{e(s5(t,n))},onDuplicate:()=>{e(s_())},onDelete:()=>{e(a_())},reverseRelationships:t=>{e(p5(t))},mergeNodes:t=>{e(i5(t))},inlineRelationships:t=>{e(h5(t))},onSelect:t=>{e(Ur(t,"replace"))}}),dle=Xt(ule,cle)(lle);class fle extends R.Component{constructor(t){super(t)}render(){const t=T(ce,{primary:!0,floated:"right",size:"small",icon:"circle",content:"Add Node",onClick:this.props.onPlusNodeClick});return T(ue.Field,{children:t})}}class ple extends R.Component{render(){const{graph:t,onSaveGraphStyle:n}=this.props,r=[];for(const o of Fs)r.push(T(yh,{title:o.name,style:{},graphStyle:t.style,possibleStyleAttributes:o.attributes.map(a=>a.key),cachedImages:this.props.cachedImages,onSaveStyle:(a,s)=>n(a,s)},o.name+"Style"));const i=T("button",{type:"submit",disabled:!0,style:{display:"none"},"aria-hidden":"true"});return F(E.Fragment,{children:[i,r]})}}const hle=[{name:"Chunky",description:"For simple, bold diagrams.",graph:{nodes:[{id:"n0",position:{x:-52,y:0},caption:"a",style:{},labels:[],properties:{}},{id:"n1",position:{x:309.5734899055742,y:0},caption:"b",style:{},labels:[],properties:{}}],relationships:[{id:"n0",type:"KNOWS",style:{},properties:{},fromId:"n0",toId:"n1"}],style:{"font-family":"sans-serif","background-color":"#ffffff","node-color":"#ffffff","border-width":4,"border-color":"#000000",radius:50,"node-padding":5,"outside-position":"auto","node-icon-image":"","node-background-image":"","icon-position":"inside","icon-size":64,"caption-position":"inside","caption-max-width":200,"caption-color":"#000000","caption-font-size":50,"caption-font-weight":"normal","label-position":"inside","label-display":"pill","label-color":"#000000","label-background-color":"#ffffff","label-border-color":"#000000","label-border-width":4,"label-font-size":40,"label-padding":5,"label-margin":4,directionality:"directed","detail-position":"inline","detail-orientation":"parallel","arrow-width":5,"arrow-color":"#000000","margin-start":5,"margin-end":5,"margin-peer":20,"attachment-start":"normal","attachment-end":"normal","relationship-icon-image":"","type-color":"#000000","type-background-color":"#ffffff","type-border-color":"#000000","type-border-width":0,"type-font-size":16,"type-padding":5,"property-position":"outside","property-color":"#000000","property-font-size":16,"property-font-weight":"normal"}}},{name:"Dark Code",description:"Light-on-dark contrast similar to an IDE",graph:{style:{"font-family":"Fira Code","background-color":"#2B2B2B","node-color":"#2B2B2B","border-width":2,"border-color":"#A6B7C8",radius:90,"node-padding":5,"node-margin":2,"outside-position":"auto","node-icon-image":"","node-background-image":"","icon-position":"inside","icon-size":64,"caption-position":"inside","caption-max-width":200,"caption-color":"#A6B7C8","caption-font-size":18,"caption-font-weight":"normal","label-position":"inside","label-display":"bare","label-color":"#A6B7C8","label-background-color":"#ffffff","label-border-color":"#000000","label-border-width":4,"label-font-size":18,"label-padding":5,"label-margin":4,directionality:"directed","detail-position":"inline","detail-orientation":"parallel","arrow-width":2,"arrow-color":"#A6B7C8","margin-start":0,"margin-end":0,"margin-peer":20,"attachment-start":"normal","attachment-end":"normal","relationship-icon-image":"","type-color":"#A6B7C8","type-background-color":"#2B2B2B","type-border-color":"#000000","type-border-width":0,"type-font-size":18,"type-padding":5,"property-position":"inside","property-alignment":"colon","property-color":"#A6B7C8","property-font-size":18,"property-font-weight":"normal"},nodes:[{id:"n0",position:{x:11.499999999999986,y:-74.54584527220625},caption:"",labels:["Product"],properties:{SKU:"750045",unit:"100"},style:{}},{id:"n1",position:{x:381.4169054441258,y:-74.54584527220625},caption:"",labels:["Category"],properties:{stock:"true"},style:{}}],relationships:[{id:"n0",type:"CATEGORY",style:{},properties:{},fromId:"n0",toId:"n1"}]}},{name:"Bloom",description:"Theme based on Neo4j Bloom.",graph:{style:{"font-family":"Nunito Sans","background-color":"#F2F2F2","node-color":"#4C8EDA","border-width":0,"border-color":"#000000",radius:75,"node-padding":5,"outside-position":"auto","node-icon-image":"","node-background-image":"","icon-position":"inside","icon-size":64,"caption-position":"inside","caption-max-width":200,"caption-color":"#ffffff","caption-font-size":20,"caption-font-weight":"normal","label-position":"inside","label-display":"bare","label-color":"#ffffff","label-background-color":"#848484","label-border-color":"#848484","label-border-width":3,"label-font-size":20,"label-padding":5,"label-margin":4,directionality:"directed","detail-position":"above","detail-orientation":"parallel","arrow-width":3,"arrow-color":"#848484","margin-start":5,"margin-end":5,"margin-peer":20,"attachment-start":"normal","attachment-end":"normal","relationship-icon-image":"","type-color":"#848484","type-background-color":"#F2F2F2","type-border-color":"#848484","type-border-width":0,"type-font-size":21,"type-padding":5,"property-position":"outside","property-color":"#848484","property-font-size":20,"property-font-weight":"normal"},nodes:[{id:"n0",position:{x:-108,y:0},caption:"Liv Tyler",style:{"node-color":"#F79767"},labels:[],properties:{}},{id:"n1",position:{x:309.5734899055742,y:0},caption:"That thing you do",style:{},labels:[],properties:{}}],relationships:[{id:"n0",type:"ACTED IN",style:{},properties:{},fromId:"n0",toId:"n1"}]}},{name:"Browser",description:"Theme based on Neo4j Browser",graph:{style:{"font-family":"sans-serif","background-color":"#FAFCFF","node-color":"#4C8EDA","border-width":2,"border-color":"#2870c2",radius:25,"node-padding":5,"outside-position":"auto","node-icon-image":"","node-background-image":"","icon-position":"inside","icon-size":64,"caption-position":"inside","caption-max-width":200,"caption-color":"#ffffff","caption-font-size":10,"caption-font-weight":"normal","label-position":"outside","label-display":"bare","label-color":"#ffffff","label-background-color":"#4C8EDA","label-border-color":"#4C8EDA","label-border-width":0,"label-font-size":10,"label-padding":2,"label-margin":2,directionality:"directed","detail-position":"inline","detail-orientation":"parallel","arrow-width":1,"arrow-color":"#A5ABB6","margin-start":0,"margin-end":0,"margin-peer":20,"attachment-start":"normal","attachment-end":"normal","relationship-icon-image":"","type-color":"#000000","type-background-color":"#ffffff","type-border-color":"#000000","type-border-width":0,"type-font-size":10,"type-padding":2,"property-position":"outside","property-color":"#000000","property-font-size":10,"property-font-weight":"normal"},nodes:[{id:"n0",position:{x:3.8854047888817544,y:0},caption:"Tom Hanks",style:{"node-color":"#F79767","border-color":"#f36924"},labels:[],properties:{}},{id:"n1",position:{x:144.87486013982567,y:0},caption:"The Da Vinci Code",style:{},labels:["Movie"],properties:{released:"2006",tagline:"Break The Codes",title:"The Da Vinci Code"}}],relationships:[{id:"n0",type:"ACTED_IN",style:{},properties:{},fromId:"n0",toId:"n1"}]}},{name:"Iconic",description:"Minimal undirected graphs suitable for very small pictures",graph:{style:{"font-family":"sans-serif","background-color":"#ffffff","node-color":"#ffffff","border-width":2,"border-color":"#000000",radius:10,"node-padding":5,"outside-position":"auto","node-icon-image":"","node-background-image":"","icon-position":"inside","icon-size":64,"caption-position":"outside","caption-max-width":200,"caption-color":"#000000","caption-font-size":10,"caption-font-weight":"normal","label-position":"outside","label-display":"pill","label-color":"#000000","label-background-color":"#ffffff","label-border-color":"#000000","label-border-width":2,"label-font-size":10,"label-padding":1,"label-margin":4,directionality:"undirected","detail-position":"inline","detail-orientation":"parallel","arrow-width":2,"arrow-color":"#000000","margin-start":0,"margin-end":0,"margin-peer":20,"attachment-start":"normal","attachment-end":"normal","relationship-icon-image":"","type-color":"#000000","type-background-color":"#ffffff","type-border-color":"#000000","type-border-width":0,"type-font-size":10,"type-padding":5,"property-position":"outside","property-color":"#000000","property-font-size":10,"property-font-weight":"normal"},nodes:[{id:"n0",position:{x:-16.5,y:0},caption:"",style:{"node-color":"#7b64ff"},labels:[],properties:{}},{id:"n1",position:{x:-39.78102752569192,y:40.6310118348138},caption:"",style:{},labels:[],properties:{}},{id:"n2",position:{x:6.781027525691918,y:40.6310118348138},caption:"",style:{},labels:[],properties:{}},{id:"n3",position:{x:-39.78102752569192,y:-40.631011834813805},caption:"",style:{"node-color":"#fcdc00"},labels:[],properties:{}},{id:"n4",position:{x:-63.32825392188784,y:0},caption:"",style:{},labels:[],properties:{}},{id:"n5",position:{x:30.328253921887843,y:0},caption:"",style:{},labels:[],properties:{}},{id:"n6",position:{x:6.781027525691918,y:-40.631011834813805},caption:"",style:{},labels:[],properties:{}},{id:"n7",position:{x:53.609281447579775,y:40.6310118348138},caption:"",style:{"node-color":"#c45100"},labels:[],properties:{}}],relationships:[{id:"n0",type:"",style:{},properties:{},fromId:"n0",toId:"n1"},{id:"n1",type:"",style:{},properties:{},fromId:"n0",toId:"n2"},{id:"n2",type:"",style:{},properties:{},fromId:"n1",toId:"n2"},{id:"n3",type:"",style:{},properties:{},fromId:"n0",toId:"n3"},{id:"n4",type:"",style:{},properties:{},fromId:"n0",toId:"n4"},{id:"n5",type:"",style:{},properties:{},fromId:"n0",toId:"n5"},{id:"n6",type:"",style:{},properties:{},fromId:"n0",toId:"n6"},{id:"n7",type:"",style:{},properties:{},fromId:"n5",toId:"n7"},{id:"n8",type:"",style:{},properties:{},fromId:"n4",toId:"n1"}]}}];class MR{constructor(t,n){this.rootElement=Ht("svg",{width:t,height:n,viewBox:[0,0,t,n].join(" ")}),this.stack=[{container:this.rootElement,attributes:{},transforms:[]}];const r=Ht("defs",{},this.globalStyle);this.rootElement.appendChild(r),this.globalStyle=Ht("style",{type:"text/css"}),r.appendChild(this.globalStyle),this.pushChild(r);const i=window.document.createElement("canvas");this.measureTextContext=i.getContext("2d"),this.beginPath()}current(){return this.stack[0]}filteredAttributes(t){const n={},r=this.current();if(r.container.childNodes.length===0)return{};for(const[i,o]of Object.entries(r.attributes))t.includes(i)&&(n[i]=o);return n}save(t){const n=this.current();n.container.childNodes.length===0&&JC(n);const r=Ht("g");t&&r.setAttribute("class",t),n.container.appendChild(r),this.stack.unshift({container:r,attributes:{...n.attributes},transforms:[...n.transforms]})}restore(){const t=this.stack.shift();t.container.childNodes.length===0&&this.current().container.removeChild(t.container)}pushChild(t){const n=this.current();n.container.childNodes.length===0&&JC(n),n.transforms.length>0&&t.setAttribute("transform",n.transforms.join(" ")),n.container.appendChild(t)}translate(t,n){this.current().transforms.push(`translate(${t} ${n})`)}scale(t){this.current().transforms.push(`scale(${t})`)}rotate(t){this.current().transforms.push(`rotate(${t*180/Math.PI})`)}beginPath(){this.currentPath=[],this.currentPoint=new Y(0,0)}closePath(){}moveTo(t,n){this.currentPath.push(["M",t,n].join(" ")),this.currentPoint=new Y(t,n)}lineTo(t,n){this.currentPath.push(["L",t,n].join(" ")),this.currentPoint=new Y(t,n)}arcTo(t,n,r,i,o){const a=new Y(t,n),s=a.vectorFrom(this.currentPoint),l=new Y(r,i),u=l.vectorFrom(a),c=s.angle()-u.angle(),d=o*Math.abs(Math.tan(c/2)),f=a.translate(s.scale(-d/s.distance())),p=a.translate(u.scale(d/u.distance()));this.currentPath.push(["L",...f.xy].join(" ")),this.currentPath.push(["A",o,o,0,0,c>0?0:1,...p.xy].join(" ")),this.currentPath.push(["L",...l.xy].join(" ")),this.currentPoint=l}arc(t,n,r,i,o,a){}circle(t,n,r,i,o){const a=Ht("circle",{cx:t,cy:n,r,...this.filteredAttributes(["fill","stroke","stroke-width"])});i||a.setAttribute("fill","none"),o||a.setAttribute("stroke","none"),this.pushChild(a)}rect(t,n,r,i,o,a,s){const l=Ht("rect",{x:t,y:n,width:r,height:i,rx:o,ry:o,...this.filteredAttributes(["fill","stroke"])});this.pushChild(l),a||l.setAttribute("fill","none"),s||l.setAttribute("stroke","none")}image(t,n,r,i,o){this.pushChild(Ht("image",{href:t.dataUrl,x:n,y:r,width:i,height:o}))}imageInCircle(t,n,r,i){const o=t.width/t.height,{width:a,height:s}=t.width>t.height?{width:2*i*o,height:2*i}:{width:2*i,height:2*i/o},l=Ht("clipPath",{id:"myClip",clipPathUnits:"objectBoundingBox"}),u=Ht("circle",{cx:.5,cy:.5,r:.5});l.appendChild(u),this.pushChild(l),this.pushChild(Ht("image",{href:t.dataUrl,x:n-a/2,y:r-s/2,width:a,height:s,"clip-path":"url(#myClip)"}))}polyLine(t){this.pushChild(Ht("polyline",{points:t.map(n=>`${n.x},${n.y}`).join(" "),fill:"none",...this.filteredAttributes(["stroke","stroke-width"])}))}polygon(t,n,r){const i=Ht("polygon",{points:t.map(o=>`${o.x},${o.y}`).join(" "),...this.filteredAttributes(["fill","stroke"])});this.pushChild(i),n||i.setAttribute("fill","none"),r||i.setAttribute("stroke","none")}stroke(){this.currentPath&&this.pushChild(Ht("path",{d:this.currentPath.join(" "),...this.filteredAttributes(["fill","stroke","stroke-width"])}))}fill(){}fillText(t,n,r){const i=this.measureText("o"),o=(i.actualBoundingBoxAscent+i.actualBoundingBoxDescent)/2,a=Ht("text",{"xml:space":"preserve",x:n,y:this.current().textBaseline==="middle"?r+o:r,stroke:"none",...this.filteredAttributes(["font-family","font-size","font-weight","text-anchor","fill"])});a.appendChild(document.createTextNode(t)),this.pushChild(a)}measureText(t){return this.measureTextContext.measureText(t)}setLineDash(t){}appendCssText(t){this.globalStyle.appendChild(document.createTextNode(t+` `))}set fillStyle(t){this.current().attributes.fill=t}set strokeStyle(t){this.current().attributes.stroke=t}set lineWidth(t){this.current().attributes["stroke-width"]=t}set lineJoin(t){}set font(t){this.current().attributes["font-family"]=t.fontFamily,this.current().attributes["font-size"]=t.fontSize,this.current().attributes["font-weight"]=t.fontWeight,this.measureTextContext.font=`${t.fontWeight} ${t.fontSize}px ${t.fontFamily}`}set textBaseline(t){this.current().textBaseline=t}set textAlign(t){this.current().attributes["text-anchor"]=t==="center"?"middle":t}}const Ht=(e,t={})=>{const n=document.createElementNS("http://www.w3.org/2000/svg",e);for(const[r,i]of Object.entries(t))n.setAttribute(r,i);return n},JC=e=>{if(e.transforms.length>0&&(e.container.setAttribute("transform",e.transforms.join(" ")),e.transforms=[]),Object.keys(e.attributes).length>0){for(const[t,n]of Object.entries(e.attributes))e.container.setAttribute(t,n);e.attributes={}}};var LR={};Object.defineProperty(LR,"__esModule",{value:!0});var gle=function(){function e(){}return e.parse=function(t){for(var n=new Set,r=0,i=t;rC0.some(n=>n.fontFamily===e)?fetch(FR(e)).then(n=>n.text()).then(n=>{const r=document.implementation.createHTMLDocument(),i=document.createElement("style");i.textContent=n,r.body.appendChild(i);const o=[];for(const a of i.sheet.cssRules){const s=mle.parse(a.style["unicode-range"].split(", "));Array.from(t).some(u=>s.includes(u))&&o.push(a)}return Promise.all(o.map(a=>yle(a)))}).catch(n=>(console.log(n),[])):Promise.resolve([]),yle=e=>new Promise((t,n)=>{const r=e.style.src,i=r.match('url\\("([^"]*)"')[1];i&&i.startsWith("https://")?fetch(i).then(o=>o.blob()).then(o=>{const a=new FileReader;a.addEventListener("load",function(){const s=a.result;t(e.cssText.replace(i,s))}),a.readAsDataURL(o)}).catch(n):n(`Invalid URL ${i} extracted from ${r}`)}),ble=()=>{for(const e of C0){const t=document.createElement("link");t.rel="stylesheet",t.href=FR(e.fontFamily),document.head.appendChild(t)}},FR=e=>"https://fonts.googleapis.com/css2?family="+encodeURIComponent(e)+"&display=swap",wle=(e,t)=>{const{visualGraph:n,boundingBox:r}=HR(e,t),i=Math.ceil(r.width),o=Math.ceil(r.height),a=new MR(i,o);return n.draw(a,{viewTransformation:new mr(1,new oe(-r.left,-r.top))}),a.rootElement},Ele=(e,t)=>new Promise((n,r)=>{const{visualGraph:i,boundingBox:o}=HR(e,t),a=Math.ceil(o.width),s=Math.ceil(o.height),l=new MR(a,s);i.draw(l,{viewTransformation:new mr(1,new oe(-o.left,-o.top))});const u=SL(e),c=e.style["font-family"];vle(c,u).then(d=>{for(const p of d)l.appendCssText(p);const f=new XMLSerializer().serializeToString(l.rootElement);n({width:a,height:s,dataUrl:"data:image/svg+xml;base64,"+Us.encode(f)})})}),HR=(e,t)=>{const r=Ot({graph:e,cachedImages:t,selection:{entities:[]}}),i=r.boundingBox()||{left:0,top:0,right:100,bottom:100};return{visualGraph:r,boundingBox:i}};var xle=globalThis&&globalThis.__read||function(e,t){var n=typeof Symbol=="function"&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),i,o=[],a;try{for(;(t===void 0||t-- >0)&&!(i=r.next()).done;)o.push(i.value)}catch(s){a={error:s}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(a)throw a.error}}return o},Sle=function(e){var t=e.split(/ ?; ?/);return t.reduce(function(n,r){var i=xle(r.split(/ ?: ?/),2),o=i[0],a=i[1];return o&&a&&(n[o.replace(/-(\w)/g,function(s,l){return l.toUpperCase()})]=Number.isNaN(Number(a))?a:Number(a)),n},{})};function Cle(e){e===void 0&&(e=6);for(var t="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",n="",r=e;r>0;--r)n+=t[Math.round(Math.random()*(t.length-1))];return n}var Tle=["br","col","colgroup","dl","hr","iframe","img","input","link","menuitem","meta","ol","param","select","table","tbody","tfoot","thead","tr","ul","wbr"],ZC={"accept-charset":"acceptCharset",acceptcharset:"acceptCharset",accesskey:"accessKey",allowfullscreen:"allowFullScreen",autocapitalize:"autoCapitalize",autocomplete:"autoComplete",autocorrect:"autoCorrect",autofocus:"autoFocus",autoplay:"autoPlay",autosave:"autoSave",cellpadding:"cellPadding",cellspacing:"cellSpacing",charset:"charSet",class:"className",classid:"classID",classname:"className",colspan:"colSpan",contenteditable:"contentEditable",contextmenu:"contextMenu",controlslist:"controlsList",crossorigin:"crossOrigin",dangerouslysetinnerhtml:"dangerouslySetInnerHTML",datetime:"dateTime",defaultchecked:"defaultChecked",defaultvalue:"defaultValue",enctype:"encType",for:"htmlFor",formmethod:"formMethod",formaction:"formAction",formenctype:"formEncType",formnovalidate:"formNoValidate",formtarget:"formTarget",frameborder:"frameBorder",hreflang:"hrefLang",htmlfor:"htmlFor",httpequiv:"httpEquiv","http-equiv":"httpEquiv",icon:"icon",innerhtml:"innerHTML",inputmode:"inputMode",itemid:"itemID",itemprop:"itemProp",itemref:"itemRef",itemscope:"itemScope",itemtype:"itemType",keyparams:"keyParams",keytype:"keyType",marginwidth:"marginWidth",marginheight:"marginHeight",maxlength:"maxLength",mediagroup:"mediaGroup",minlength:"minLength",nomodule:"noModule",novalidate:"noValidate",playsinline:"playsInline",radiogroup:"radioGroup",readonly:"readOnly",referrerpolicy:"referrerPolicy",rowspan:"rowSpan",spellcheck:"spellCheck",srcdoc:"srcDoc",srclang:"srcLang",srcset:"srcSet",tabindex:"tabIndex",typemustmatch:"typeMustMatch",usemap:"useMap",accentheight:"accentHeight","accent-height":"accentHeight",alignmentbaseline:"alignmentBaseline","alignment-baseline":"alignmentBaseline",allowreorder:"allowReorder",arabicform:"arabicForm","arabic-form":"arabicForm",attributename:"attributeName",attributetype:"attributeType",autoreverse:"autoReverse",basefrequency:"baseFrequency",baselineshift:"baselineShift","baseline-shift":"baselineShift",baseprofile:"baseProfile",calcmode:"calcMode",capheight:"capHeight","cap-height":"capHeight",clippath:"clipPath","clip-path":"clipPath",clippathunits:"clipPathUnits",cliprule:"clipRule","clip-rule":"clipRule",colorinterpolation:"colorInterpolation","color-interpolation":"colorInterpolation",colorinterpolationfilters:"colorInterpolationFilters","color-interpolation-filters":"colorInterpolationFilters",colorprofile:"colorProfile","color-profile":"colorProfile",colorrendering:"colorRendering","color-rendering":"colorRendering",contentscripttype:"contentScriptType",contentstyletype:"contentStyleType",diffuseconstant:"diffuseConstant",dominantbaseline:"dominantBaseline","dominant-baseline":"dominantBaseline",edgemode:"edgeMode",enablebackground:"enableBackground","enable-background":"enableBackground",externalresourcesrequired:"externalResourcesRequired",fillopacity:"fillOpacity","fill-opacity":"fillOpacity",fillrule:"fillRule","fill-rule":"fillRule",filterres:"filterRes",filterunits:"filterUnits",floodopacity:"floodOpacity","flood-opacity":"floodOpacity",floodcolor:"floodColor","flood-color":"floodColor",fontfamily:"fontFamily","font-family":"fontFamily",fontsize:"fontSize","font-size":"fontSize",fontsizeadjust:"fontSizeAdjust","font-size-adjust":"fontSizeAdjust",fontstretch:"fontStretch","font-stretch":"fontStretch",fontstyle:"fontStyle","font-style":"fontStyle",fontvariant:"fontVariant","font-variant":"fontVariant",fontweight:"fontWeight","font-weight":"fontWeight",glyphname:"glyphName","glyph-name":"glyphName",glyphorientationhorizontal:"glyphOrientationHorizontal","glyph-orientation-horizontal":"glyphOrientationHorizontal",glyphorientationvertical:"glyphOrientationVertical","glyph-orientation-vertical":"glyphOrientationVertical",glyphref:"glyphRef",gradienttransform:"gradientTransform",gradientunits:"gradientUnits",horizadvx:"horizAdvX","horiz-adv-x":"horizAdvX",horizoriginx:"horizOriginX","horiz-origin-x":"horizOriginX",imagerendering:"imageRendering","image-rendering":"imageRendering",kernelmatrix:"kernelMatrix",kernelunitlength:"kernelUnitLength",keypoints:"keyPoints",keysplines:"keySplines",keytimes:"keyTimes",lengthadjust:"lengthAdjust",letterspacing:"letterSpacing","letter-spacing":"letterSpacing",lightingcolor:"lightingColor","lighting-color":"lightingColor",limitingconeangle:"limitingConeAngle",markerend:"markerEnd","marker-end":"markerEnd",markerheight:"markerHeight",markermid:"markerMid","marker-mid":"markerMid",markerstart:"markerStart","marker-start":"markerStart",markerunits:"markerUnits",markerwidth:"markerWidth",maskcontentunits:"maskContentUnits",maskunits:"maskUnits",numoctaves:"numOctaves",overlineposition:"overlinePosition","overline-position":"overlinePosition",overlinethickness:"overlineThickness","overline-thickness":"overlineThickness",paintorder:"paintOrder","paint-order":"paintOrder","panose-1":"panose1",pathlength:"pathLength",patterncontentunits:"patternContentUnits",patterntransform:"patternTransform",patternunits:"patternUnits",pointerevents:"pointerEvents","pointer-events":"pointerEvents",pointsatx:"pointsAtX",pointsaty:"pointsAtY",pointsatz:"pointsAtZ",preservealpha:"preserveAlpha",preserveaspectratio:"preserveAspectRatio",primitiveunits:"primitiveUnits",refx:"refX",refy:"refY",renderingintent:"renderingIntent","rendering-intent":"renderingIntent",repeatcount:"repeatCount",repeatdur:"repeatDur",requiredextensions:"requiredExtensions",requiredfeatures:"requiredFeatures",shaperendering:"shapeRendering","shape-rendering":"shapeRendering",specularconstant:"specularConstant",specularexponent:"specularExponent",spreadmethod:"spreadMethod",startoffset:"startOffset",stddeviation:"stdDeviation",stitchtiles:"stitchTiles",stopcolor:"stopColor","stop-color":"stopColor",stopopacity:"stopOpacity","stop-opacity":"stopOpacity",strikethroughposition:"strikethroughPosition","strikethrough-position":"strikethroughPosition",strikethroughthickness:"strikethroughThickness","strikethrough-thickness":"strikethroughThickness",strokedasharray:"strokeDasharray","stroke-dasharray":"strokeDasharray",strokedashoffset:"strokeDashoffset","stroke-dashoffset":"strokeDashoffset",strokelinecap:"strokeLinecap","stroke-linecap":"strokeLinecap",strokelinejoin:"strokeLinejoin","stroke-linejoin":"strokeLinejoin",strokemiterlimit:"strokeMiterlimit","stroke-miterlimit":"strokeMiterlimit",strokewidth:"strokeWidth","stroke-width":"strokeWidth",strokeopacity:"strokeOpacity","stroke-opacity":"strokeOpacity",suppresscontenteditablewarning:"suppressContentEditableWarning",suppresshydrationwarning:"suppressHydrationWarning",surfacescale:"surfaceScale",systemlanguage:"systemLanguage",tablevalues:"tableValues",targetx:"targetX",targety:"targetY",textanchor:"textAnchor","text-anchor":"textAnchor",textdecoration:"textDecoration","text-decoration":"textDecoration",textlength:"textLength",textrendering:"textRendering","text-rendering":"textRendering",underlineposition:"underlinePosition","underline-position":"underlinePosition",underlinethickness:"underlineThickness","underline-thickness":"underlineThickness",unicodebidi:"unicodeBidi","unicode-bidi":"unicodeBidi",unicoderange:"unicodeRange","unicode-range":"unicodeRange",unitsperem:"unitsPerEm","units-per-em":"unitsPerEm",unselectable:"unselectable",valphabetic:"vAlphabetic","v-alphabetic":"vAlphabetic",vectoreffect:"vectorEffect","vector-effect":"vectorEffect",vertadvy:"vertAdvY","vert-adv-y":"vertAdvY",vertoriginx:"vertOriginX","vert-origin-x":"vertOriginX",vertoriginy:"vertOriginY","vert-origin-y":"vertOriginY",vhanging:"vHanging","v-hanging":"vHanging",videographic:"vIdeographic","v-ideographic":"vIdeographic",viewbox:"viewBox",viewtarget:"viewTarget",vmathematical:"vMathematical","v-mathematical":"vMathematical",wordspacing:"wordSpacing","word-spacing":"wordSpacing",writingmode:"writingMode","writing-mode":"writingMode",xchannelselector:"xChannelSelector",xheight:"xHeight","x-height":"xHeight",xlinkactuate:"xlinkActuate","xlink:actuate":"xlinkActuate",xlinkarcrole:"xlinkArcrole","xlink:arcrole":"xlinkArcrole",xlinkhref:"xlinkHref","xlink:href":"xlinkHref",xlinkrole:"xlinkRole","xlink:role":"xlinkRole",xlinkshow:"xlinkShow","xlink:show":"xlinkShow",xlinktitle:"xlinkTitle","xlink:title":"xlinkTitle",xlinktype:"xlinkType","xlink:type":"xlinkType",xmlbase:"xmlBase","xml:base":"xmlBase",xmllang:"xmlLang","xml:lang":"xmlLang","xml:space":"xmlSpace",xmlnsxlink:"xmlnsXlink","xmlns:xlink":"xmlnsXlink",xmlspace:"xmlSpace",ychannelselector:"yChannelSelector",zoomandpan:"zoomAndPan",onblur:"onBlur",onchange:"onChange",onclick:"onClick",oncontextmenu:"onContextMenu",ondoubleclick:"onDoubleClick",ondrag:"onDrag",ondragend:"onDragEnd",ondragenter:"onDragEnter",ondragexit:"onDragExit",ondragleave:"onDragLeave",ondragover:"onDragOver",ondragstart:"onDragStart",ondrop:"onDrop",onerror:"onError",onfocus:"onFocus",oninput:"onInput",oninvalid:"onInvalid",onkeydown:"onKeyDown",onkeypress:"onKeyPress",onkeyup:"onKeyUp",onload:"onLoad",onmousedown:"onMouseDown",onmouseenter:"onMouseEnter",onmouseleave:"onMouseLeave",onmousemove:"onMouseMove",onmouseout:"onMouseOut",onmouseover:"onMouseOver",onmouseup:"onMouseUp",onscroll:"onScroll",onsubmit:"onSubmit",ontouchcancel:"onTouchCancel",ontouchend:"onTouchEnd",ontouchmove:"onTouchMove",ontouchstart:"onTouchStart",onwheel:"onWheel"},Bf=globalThis&&globalThis.__assign||function(){return Bf=Object.assign||function(e){for(var t,n=1,r=arguments.length;n0)&&!(i=r.next()).done;)o.push(i.value)}catch(s){a={error:s}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(a)throw a.error}}return o},GR=globalThis&&globalThis.__spreadArray||function(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,o;r *":i,a=t.type,s=a===void 0?"text/html":a;try{var l=new DOMParser,u=l.parseFromString(e,s),c=u.querySelector(o);if(!(c instanceof Node))throw new TypeError("Error parsing input");return r?c:rw(c,t)}catch{}return null}function Ile(e,t){return t===void 0&&(t={}),typeof e=="string"?_le(e,t):e instanceof Node?rw(e,t):null}class Nle extends R.Component{shouldComponentUpdate(t,n,r){return!1}render(){const t=hle.map(n=>{const r=Bs(n.graph).graph,i=wle(r);return i.style.width="100%",i.style.position="relative",i.style.top="50%",i.style.transform="translateY(-50%)",F("div",{style:{paddingBottom:"10px"},children:[T("div",{style:{height:230,padding:10,border:"1px solid #1B1C1D",borderRadius:"4px",overflow:"hidden",cursor:"pointer",backgroundColor:n.graph.style["background-color"]},onClick:()=>this.props.onApplyTheme(n.graph.style),children:Ile(i)}),T("div",{style:{fontSize:"13px",fontWeight:"bold"},children:n.name})]},n.name)});return T(E.Fragment,{children:t})}}class Rle extends R.Component{render(){const{graph:t,onSaveGraphStyle:n,cachedImages:r,onApplyTheme:i,styleMode:o,onSelect:a}=this.props,s=o==="customize"?T(ple,{graph:t,onSaveGraphStyle:n,cachedImages:r}):T(Nle,{onApplyTheme:i});return T(E.Fragment,{children:T(cn,{basic:!0,style:{margin:0},children:F(ue,{style:{textAlign:"left"},children:[F(ue.Field,{children:[T("label",{children:t.nodes.length+t.relationships.length>0?"Graph:":"Empty graph"}),MN(t.nodes.map(l=>l.id),t.relationships.map(l=>l.id),a,null)]},"_selected"),T(fle,{onPlusNodeClick:this.props.onPlusNodeClick}),T(Gi,{horizontal:!0,clearing:!0,style:{paddingTop:50},children:"Style"},"StyleDivider"),T("div",{style:{clear:"both",textAlign:"center",paddingBottom:20},children:F(ki,{children:[T(ce,{onClick:this.props.onStyleTheme,active:o==="theme",secondary:o==="theme",children:"Theme"}),T(ce,{onClick:this.props.onStyleCustomize,active:o==="customize",secondary:o==="customize",children:"Customize"})]})}),s]})})})}}const kle=e=>({graph:Re(e),cachedImages:e.cachedImages,selection:e.selection,styleMode:e.applicationLayout.styleMode}),$le=e=>({onSelect:t=>{e(Ur(t,"replace"))},onSaveGraphStyle:(t,n)=>{e(Nv(t,n))},onPlusNodeClick:()=>{e(J4())},onStyleTheme:()=>{e(u6())},onStyleCustomize:()=>{e(c6())},onApplyTheme:t=>{e(l5(t))}}),Dle=Xt(kle,$le)(Rle),Mle=e=>{const t=e.selection,n=Re(e);return{showSelectionInspector:DR({...e,graph:n}).length>0||sc(n,t).length>0}};class Lle extends R.Component{render(){return this.props.showSelectionInspector?T(dle,{}):T(Dle,{})}}const Fle=Xt(Mle,null)(Lle);class Hle extends R.Component{render(){try{const{width:t,height:n,dataUrl:r}=k_(this.props.graph,this.props.cachedImages,this.props.pixelRatio,this.props.pixelRatio===1?1/0:16e6,this.props.transparentBackground);return F(cn,{style:{maxHeight:200,overflow:"hidden"},children:[F(Je,{attached:"top",children:["@",this.props.pixelRatio,"x ",t," × ",n,F("a",{href:r,download:this.props.diagramName+".png",children:[T(xe,{name:"download"}),"Download"]})]}),T("div",{style:{display:"inline-block",backgroundImage:"linear-gradient(45deg, #efefef 25%, transparent 25%), linear-gradient(-45deg, #efefef 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #efefef 75%), linear-gradient(-45deg, transparent 75%, #efefef 75%)",backgroundSize:"20px 20px",backgroundPosition:"0 0, 0 10px, 10px -10px, -10px 0px"},children:T(kt,{src:r})})]})}catch(t){return console.log(t),null}}}class jle extends R.Component{constructor(t){super(t),this.state={transparentBackground:!0}}toggleTransparent=()=>{this.setState({transparentBackground:!this.state.transparentBackground})};render(){return F(E.Fragment,{children:[F(ht,{info:!0,icon:!0,children:[T(xe,{name:"info"}),F("div",{children:[T("p",{children:'Below are a few PNGs at different "pixel ratios". Choose your preferred resolution and then get hold of the image by:'}),F("ul",{children:[T("li",{children:'Clicking on the "Download" link to download a file to your computer, or'}),T("li",{children:'Right-clicking on the image and choosing "Copy Image", or'}),T("li",{children:"Dragging the image to another browser tab or to another application."})]})]})]}),T(Xi,{label:"Transparent background",checked:this.state.transparentBackground,onChange:this.toggleTransparent}),[1,2,4].map(t=>T(Hle,{graph:this.props.graph,cachedImages:this.props.cachedImages,diagramName:this.props.diagramName,pixelRatio:t,transparentBackground:this.state.transparentBackground},t))]})}}const Gle=new RegExp("^[A-Za-z][A-Za-z_]*$"),zf=e=>Gle.test(e)?e:"`"+e+"`",eT=e=>typeof e=="number"||!isNaN(e)&&!isNaN(parseFloat(e))?e:'"'+e+'"',tT=(e,t)=>[e,t].filter(n=>n).join(" "),nT=(e,t)=>{const n=Object.entries(e.properties).map(([o,a])=>`${zf(o)}: ${eT(a)}`),r=Object.entries(e.style).map(([o,a])=>`${zf(fi(o))}: ${eT(a)}`),i=t?n.concat(r):n;return i.length>0?"{"+i.join(", ")+"}":null},Ble=(e,t,n)=>{const r={};e.nodes.forEach(p=>{p.caption&&(r[p.caption]?r[p.caption].push(p):r[p.caption]=[p])});const i={};e.nodes.forEach(p=>{p.caption&&r[p.caption].length===1?i[p.id]=zf(p.caption):i[p.id]=p.id});const o=EL(e),a=[];e.relationships.forEach(p=>{let y=v=>p.fromId===v.id,g=v=>p.toId===v.id;const w=v=>y(v)||g(v),h=a.find(v=>w(v[0])||w(v[v.length-1]));if(h)if(w(h[h.length-1])){const v=h[h.length-1],[m,b]=y(v)?[o[p.toId],"forward"]:[o[p.fromId],"reverse"];h.push({relationship:p,direction:b}),h.push(m)}else{const v=h[0],[m,b]=g(v)?[o[p.fromId],"forward"]:[o[p.toId],"reverse"];h.unshift({relationship:p,direction:b}),h.unshift(m)}else a.push([o[p.fromId],{relationship:p,direction:"forward"},o[p.toId]])});const s=a.reduce((p,y)=>{for(let g=0;g{s.hasOwnProperty(p.id)||(a.push([p]),s[p.id]=1)}),Object.entries(s).forEach(([p,y])=>{y===1&&(i[p]="")});const l={},u=t==="MERGE"?"":t+" ",c=t==="MERGE"?"MERGE ":"",d=t==="MERGE"?` `:`, `,f=t==="MATCH"?` RETURN `+a.map((p,y)=>"path"+y).join(", "):"";return u+a.map((p,y)=>{let g=c;t==="MATCH"&&(g+=`path${y} = `);for(let w=0;w`:${zf(x)}`).join(""),b=nT(v,n.includeStyling);l[v.id]?g+=`(${i[v.id]})`:(g+=`(${tT(i[v.id]+m,b)})`,l[v.id]=!0)}else{const v=h.relationship;let m=v.type||"_RELATED";m==="_RELATED"&&t==="MATCH"&&(m=null);const b=nT(v,n.includeStyling),x=m||b?`[${tT(m?":"+m:null,b)}]`:"",C=h.direction==="reverse"?"<-":"-",P=h.direction==="forward"?"->":"-";g+=C+x+P}}return g}).join(d)+f};class zle extends R.Component{constructor(t){super(t),this.state={includeStyling:!1,keyword:"CREATE"}}copyToClipboard=t=>{navigator.clipboard.writeText(t)};runInNeo4jBrowser=t=>{const n="neo4j-desktop://graphapps/neo4j-browser?cmd=edit&arg="+encodeURIComponent(t.replaceAll("&","\\u0026"));window.open(n)};render(){const t={includeStyling:this.state.includeStyling},n=Ble(this.props.graph,this.state.keyword,t),r=["CREATE","MATCH","MERGE"].map(o=>T(ue.Radio,{label:o,value:o,checked:this.state.keyword===o,onClick:(a,{value:s})=>{this.setState({keyword:s})}},o)),i=this.state.keyword==="MERGE"?F(ht,{info:!0,children:["MERGE query behaviour depends on what data is already present in the database. You may need to edit the query to achieve exactly the behaviour you are looking for. Please see ",T("a",{href:"https://neo4j.com/docs/cypher-manual/current/clauses/merge/",target:"_blank",children:"MERGE documentation"})," for guidance."]}):null;return F(ue,{children:[F(ue.Group,{inline:!0,children:[T("label",{children:"Cypher Clause:"}),r]}),i,F(ue.Field,{children:[F(ce,{onClick:()=>this.copyToClipboard(n),primary:!0,icon:!0,labelPosition:"left",children:[T(xe,{name:"clipboard outline"}),"Copy to clipboard"]}),F(ce,{onClick:()=>this.runInNeo4jBrowser(n),primary:!0,icon:!0,labelPosition:"left",children:[T(xe,{name:"terminal"}),"Run in Neo4j Browser"]})]}),T(mc,{style:{height:500,fontSize:"1.5em",fontFamily:"monospace"},value:n})]})}}class Ule extends R.Component{constructor(t){super(t),this.state={width:0,height:0,dataUrl:null}}componentDidMount(){Ele(this.props.graph,this.props.cachedImages).then(t=>{this.setState(t)})}render(){if(this.state.dataUrl){const{width:t,height:n,dataUrl:r}=this.state;return F(cn,{style:{maxHeight:200,overflow:"hidden"},children:[F(Je,{attached:"top",children:[t," × ",n,F("a",{href:r,download:this.props.diagramName+".svg",children:[T(xe,{name:"download"}),"Download"]})]}),T("div",{style:{display:"inline-block",backgroundImage:"linear-gradient(45deg, #efefef 25%, transparent 25%), linear-gradient(-45deg, #efefef 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #efefef 75%), linear-gradient(-45deg, transparent 75%, #efefef 75%)",backgroundSize:"20px 20px",backgroundPosition:"0 0, 0 10px, 10px -10px, -10px 0px"},children:T(kt,{src:r})})]})}else return T(cn,{style:{maxHeight:200,overflow:"hidden"},children:T(Je,{attached:"top",children:"Rendering..."})})}}class Wle extends R.Component{render(){return F(E.Fragment,{children:[F(ht,{info:!0,icon:!0,children:[T(xe,{name:"info"}),T("div",{children:T("p",{children:"Try dragging the image below straight into your favourite vector image editor, for example Sketch. You will find that the graphics elements are fully editable."})})]}),T(Ule,{graph:this.props.graph,cachedImages:this.props.cachedImages,diagramName:this.props.diagramName})]})}}class Vle extends R.Component{constructor(t){super(t)}render(){const t=JSON.stringify(this.props.graph,null,2),n="data:application/json;base64,"+Us.encode(t);return F(ue,{children:[T(ue.Field,{children:F("a",{className:"ui button",href:n,download:this.props.diagramName+".json",children:[T(xe,{name:"download"}),"Download"]})}),T(mc,{style:{height:500,fontFamily:"monospace"},value:t})]})}}function Kle(e,t){if(!!!e)throw new Error(t)}const BR={Name:[],Document:["definitions"],OperationDefinition:["name","variableDefinitions","directives","selectionSet"],VariableDefinition:["variable","type","defaultValue","directives"],Variable:["name"],SelectionSet:["selections"],Field:["alias","name","arguments","directives","selectionSet"],Argument:["name","value"],FragmentSpread:["name","directives"],InlineFragment:["typeCondition","directives","selectionSet"],FragmentDefinition:["name","variableDefinitions","typeCondition","directives","selectionSet"],IntValue:[],FloatValue:[],StringValue:[],BooleanValue:[],NullValue:[],EnumValue:[],ListValue:["values"],ObjectValue:["fields"],ObjectField:["name","value"],Directive:["name","arguments"],NamedType:["name"],ListType:["type"],NonNullType:["type"],SchemaDefinition:["description","directives","operationTypes"],OperationTypeDefinition:["type"],ScalarTypeDefinition:["description","name","directives"],ObjectTypeDefinition:["description","name","interfaces","directives","fields"],FieldDefinition:["description","name","arguments","type","directives"],InputValueDefinition:["description","name","type","defaultValue","directives"],InterfaceTypeDefinition:["description","name","interfaces","directives","fields"],UnionTypeDefinition:["description","name","directives","types"],EnumTypeDefinition:["description","name","directives","values"],EnumValueDefinition:["description","name","directives"],InputObjectTypeDefinition:["description","name","directives","fields"],DirectiveDefinition:["description","name","arguments","locations"],SchemaExtension:["directives","operationTypes"],ScalarTypeExtension:["name","directives"],ObjectTypeExtension:["name","interfaces","directives","fields"],InterfaceTypeExtension:["name","interfaces","directives","fields"],UnionTypeExtension:["name","directives","types"],EnumTypeExtension:["name","directives","values"],InputObjectTypeExtension:["name","directives","fields"]},qle=new Set(Object.keys(BR));function rT(e){const t=e?.kind;return typeof t=="string"&&qle.has(t)}var iT;(function(e){e.QUERY="query",e.MUTATION="mutation",e.SUBSCRIPTION="subscription"})(iT||(iT={}));var cy;(function(e){e.NAME="Name",e.DOCUMENT="Document",e.OPERATION_DEFINITION="OperationDefinition",e.VARIABLE_DEFINITION="VariableDefinition",e.SELECTION_SET="SelectionSet",e.FIELD="Field",e.ARGUMENT="Argument",e.FRAGMENT_SPREAD="FragmentSpread",e.INLINE_FRAGMENT="InlineFragment",e.FRAGMENT_DEFINITION="FragmentDefinition",e.VARIABLE="Variable",e.INT="IntValue",e.FLOAT="FloatValue",e.STRING="StringValue",e.BOOLEAN="BooleanValue",e.NULL="NullValue",e.ENUM="EnumValue",e.LIST="ListValue",e.OBJECT="ObjectValue",e.OBJECT_FIELD="ObjectField",e.DIRECTIVE="Directive",e.NAMED_TYPE="NamedType",e.LIST_TYPE="ListType",e.NON_NULL_TYPE="NonNullType",e.SCHEMA_DEFINITION="SchemaDefinition",e.OPERATION_TYPE_DEFINITION="OperationTypeDefinition",e.SCALAR_TYPE_DEFINITION="ScalarTypeDefinition",e.OBJECT_TYPE_DEFINITION="ObjectTypeDefinition",e.FIELD_DEFINITION="FieldDefinition",e.INPUT_VALUE_DEFINITION="InputValueDefinition",e.INTERFACE_TYPE_DEFINITION="InterfaceTypeDefinition",e.UNION_TYPE_DEFINITION="UnionTypeDefinition",e.ENUM_TYPE_DEFINITION="EnumTypeDefinition",e.ENUM_VALUE_DEFINITION="EnumValueDefinition",e.INPUT_OBJECT_TYPE_DEFINITION="InputObjectTypeDefinition",e.DIRECTIVE_DEFINITION="DirectiveDefinition",e.SCHEMA_EXTENSION="SchemaExtension",e.SCALAR_TYPE_EXTENSION="ScalarTypeExtension",e.OBJECT_TYPE_EXTENSION="ObjectTypeExtension",e.INTERFACE_TYPE_EXTENSION="InterfaceTypeExtension",e.UNION_TYPE_EXTENSION="UnionTypeExtension",e.ENUM_TYPE_EXTENSION="EnumTypeExtension",e.INPUT_OBJECT_TYPE_EXTENSION="InputObjectTypeExtension"})(cy||(cy={}));function oT(e){return e===9||e===32}function Yle(e,t){const n=e.replace(/"""/g,'\\"""'),r=n.split(/\r\n|[\n\r]/g),i=r.length===1,o=r.length>1&&r.slice(1).every(p=>p.length===0||oT(p.charCodeAt(0))),a=n.endsWith('\\"""'),s=e.endsWith('"')&&!a,l=e.endsWith("\\"),u=s||l,c=!(t!=null&&t.minimize)&&(!i||e.length>70||u||o||a);let d="";const f=i&&oT(e.charCodeAt(0));return(c&&!f||o)&&(d+=` `),d+=n,(c||u)&&(d+=` `),'"""'+d+'"""'}const Qle=10,zR=2;function Xle(e){return bh(e,[])}function bh(e,t){switch(typeof e){case"string":return JSON.stringify(e);case"function":return e.name?`[function ${e.name}]`:"[function]";case"object":return Jle(e,t);default:return String(e)}}function Jle(e,t){if(e===null)return"null";if(t.includes(e))return"[Circular]";const n=[...t,e];if(Zle(e)){const r=e.toJSON();if(r!==e)return typeof r=="string"?r:bh(r,n)}else if(Array.isArray(e))return tue(e,n);return eue(e,n)}function Zle(e){return typeof e.toJSON=="function"}function eue(e,t){const n=Object.entries(e);return n.length===0?"{}":t.length>zR?"["+nue(e)+"]":"{ "+n.map(([i,o])=>i+": "+bh(o,t)).join(", ")+" }"}function tue(e,t){if(e.length===0)return"[]";if(t.length>zR)return"[Array]";const n=Math.min(Qle,e.length),r=e.length-n,i=[];for(let o=0;o1&&i.push(`... ${r} more items`),"["+i.join(", ")+"]"}function nue(e){const t=Object.prototype.toString.call(e).replace(/^\[object /,"").replace(/]$/,"");if(t==="Object"&&typeof e.constructor=="function"){const n=e.constructor.name;if(typeof n=="string"&&n!=="")return n}return t}function rue(e){return`"${e.replace(iue,oue)}"`}const iue=/[\x00-\x1f\x22\x5c\x7f-\x9f]/g;function oue(e){return aue[e.charCodeAt(0)]}const aue=["\\u0000","\\u0001","\\u0002","\\u0003","\\u0004","\\u0005","\\u0006","\\u0007","\\b","\\t","\\n","\\u000B","\\f","\\r","\\u000E","\\u000F","\\u0010","\\u0011","\\u0012","\\u0013","\\u0014","\\u0015","\\u0016","\\u0017","\\u0018","\\u0019","\\u001A","\\u001B","\\u001C","\\u001D","\\u001E","\\u001F","","",'\\"',"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","\\\\","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","\\u007F","\\u0080","\\u0081","\\u0082","\\u0083","\\u0084","\\u0085","\\u0086","\\u0087","\\u0088","\\u0089","\\u008A","\\u008B","\\u008C","\\u008D","\\u008E","\\u008F","\\u0090","\\u0091","\\u0092","\\u0093","\\u0094","\\u0095","\\u0096","\\u0097","\\u0098","\\u0099","\\u009A","\\u009B","\\u009C","\\u009D","\\u009E","\\u009F"],sue=Object.freeze({});function lue(e,t,n=BR){const r=new Map;for(const h of Object.values(cy))r.set(h,uue(t,h));let i,o=Array.isArray(e),a=[e],s=-1,l=[],u=e,c,d;const f=[],p=[];do{s++;const h=s===a.length,v=h&&l.length!==0;if(h){if(c=p.length===0?void 0:f[f.length-1],u=d,d=p.pop(),v)if(o){u=u.slice();let b=0;for(const[x,C]of l){const P=x-b;C===null?(u.splice(P,1),b++):u[P]=C}}else{u=Object.defineProperties({},Object.getOwnPropertyDescriptors(u));for(const[b,x]of l)u[b]=x}s=i.index,a=i.keys,l=i.edits,o=i.inArray,i=i.prev}else if(d){if(c=o?s:a[s],u=d[c],u==null)continue;f.push(c)}let m;if(!Array.isArray(u)){var y,g;rT(u)||Kle(!1,`Invalid AST Node: ${Xle(u)}.`);const b=h?(y=r.get(u.kind))===null||y===void 0?void 0:y.leave:(g=r.get(u.kind))===null||g===void 0?void 0:g.enter;if(m=b?.call(t,u,c,d,f,p),m===sue)break;if(m===!1){if(!h){f.pop();continue}}else if(m!==void 0&&(l.push([c,m]),!h))if(rT(m))u=m;else{f.pop();continue}}if(m===void 0&&v&&l.push([c,u]),h)f.pop();else{var w;i={inArray:o,index:s,keys:a,edits:l,prev:i},o=Array.isArray(u),a=o?u:(w=n[u.kind])!==null&&w!==void 0?w:[],s=-1,l=[],d&&p.push(d),d=u}}while(i!==void 0);return l.length!==0?l[l.length-1][1]:e}function uue(e,t){const n=e[t];return typeof n=="object"?n:typeof n=="function"?{enter:n,leave:void 0}:{enter:e.enter,leave:e.leave}}function cue(e){return lue(e,fue)}const due=80,fue={Name:{leave:e=>e.value},Variable:{leave:e=>"$"+e.name},Document:{leave:e=>Z(e.definitions,` `)},OperationDefinition:{leave(e){const t=pe("(",Z(e.variableDefinitions,", "),")"),n=Z([e.operation,Z([e.name,t]),Z(e.directives," ")]," ");return(n==="query"?"":n+" ")+e.selectionSet}},VariableDefinition:{leave:({variable:e,type:t,defaultValue:n,directives:r})=>e+": "+t+pe(" = ",n)+pe(" ",Z(r," "))},SelectionSet:{leave:({selections:e})=>Gn(e)},Field:{leave({alias:e,name:t,arguments:n,directives:r,selectionSet:i}){const o=pe("",e,": ")+t;let a=o+pe("(",Z(n,", "),")");return a.length>due&&(a=o+pe(`( `,Vd(Z(n,` `)),` )`)),Z([a,Z(r," "),i]," ")}},Argument:{leave:({name:e,value:t})=>e+": "+t},FragmentSpread:{leave:({name:e,directives:t})=>"..."+e+pe(" ",Z(t," "))},InlineFragment:{leave:({typeCondition:e,directives:t,selectionSet:n})=>Z(["...",pe("on ",e),Z(t," "),n]," ")},FragmentDefinition:{leave:({name:e,typeCondition:t,variableDefinitions:n,directives:r,selectionSet:i})=>`fragment ${e}${pe("(",Z(n,", "),")")} on ${t} ${pe("",Z(r," ")," ")}`+i},IntValue:{leave:({value:e})=>e},FloatValue:{leave:({value:e})=>e},StringValue:{leave:({value:e,block:t})=>t?Yle(e):rue(e)},BooleanValue:{leave:({value:e})=>e?"true":"false"},NullValue:{leave:()=>"null"},EnumValue:{leave:({value:e})=>e},ListValue:{leave:({values:e})=>"["+Z(e,", ")+"]"},ObjectValue:{leave:({fields:e})=>"{"+Z(e,", ")+"}"},ObjectField:{leave:({name:e,value:t})=>e+": "+t},Directive:{leave:({name:e,arguments:t})=>"@"+e+pe("(",Z(t,", "),")")},NamedType:{leave:({name:e})=>e},ListType:{leave:({type:e})=>"["+e+"]"},NonNullType:{leave:({type:e})=>e+"!"},SchemaDefinition:{leave:({description:e,directives:t,operationTypes:n})=>pe("",e,` `)+Z(["schema",Z(t," "),Gn(n)]," ")},OperationTypeDefinition:{leave:({operation:e,type:t})=>e+": "+t},ScalarTypeDefinition:{leave:({description:e,name:t,directives:n})=>pe("",e,` `)+Z(["scalar",t,Z(n," ")]," ")},ObjectTypeDefinition:{leave:({description:e,name:t,interfaces:n,directives:r,fields:i})=>pe("",e,` `)+Z(["type",t,pe("implements ",Z(n," & ")),Z(r," "),Gn(i)]," ")},FieldDefinition:{leave:({description:e,name:t,arguments:n,type:r,directives:i})=>pe("",e,` `)+t+(aT(n)?pe(`( `,Vd(Z(n,` `)),` )`):pe("(",Z(n,", "),")"))+": "+r+pe(" ",Z(i," "))},InputValueDefinition:{leave:({description:e,name:t,type:n,defaultValue:r,directives:i})=>pe("",e,` `)+Z([t+": "+n,pe("= ",r),Z(i," ")]," ")},InterfaceTypeDefinition:{leave:({description:e,name:t,interfaces:n,directives:r,fields:i})=>pe("",e,` `)+Z(["interface",t,pe("implements ",Z(n," & ")),Z(r," "),Gn(i)]," ")},UnionTypeDefinition:{leave:({description:e,name:t,directives:n,types:r})=>pe("",e,` `)+Z(["union",t,Z(n," "),pe("= ",Z(r," | "))]," ")},EnumTypeDefinition:{leave:({description:e,name:t,directives:n,values:r})=>pe("",e,` `)+Z(["enum",t,Z(n," "),Gn(r)]," ")},EnumValueDefinition:{leave:({description:e,name:t,directives:n})=>pe("",e,` `)+Z([t,Z(n," ")]," ")},InputObjectTypeDefinition:{leave:({description:e,name:t,directives:n,fields:r})=>pe("",e,` `)+Z(["input",t,Z(n," "),Gn(r)]," ")},DirectiveDefinition:{leave:({description:e,name:t,arguments:n,repeatable:r,locations:i})=>pe("",e,` `)+"directive @"+t+(aT(n)?pe(`( `,Vd(Z(n,` `)),` )`):pe("(",Z(n,", "),")"))+(r?" repeatable":"")+" on "+Z(i," | ")},SchemaExtension:{leave:({directives:e,operationTypes:t})=>Z(["extend schema",Z(e," "),Gn(t)]," ")},ScalarTypeExtension:{leave:({name:e,directives:t})=>Z(["extend scalar",e,Z(t," ")]," ")},ObjectTypeExtension:{leave:({name:e,interfaces:t,directives:n,fields:r})=>Z(["extend type",e,pe("implements ",Z(t," & ")),Z(n," "),Gn(r)]," ")},InterfaceTypeExtension:{leave:({name:e,interfaces:t,directives:n,fields:r})=>Z(["extend interface",e,pe("implements ",Z(t," & ")),Z(n," "),Gn(r)]," ")},UnionTypeExtension:{leave:({name:e,directives:t,types:n})=>Z(["extend union",e,Z(t," "),pe("= ",Z(n," | "))]," ")},EnumTypeExtension:{leave:({name:e,directives:t,values:n})=>Z(["extend enum",e,Z(t," "),Gn(n)]," ")},InputObjectTypeExtension:{leave:({name:e,directives:t,fields:n})=>Z(["extend input",e,Z(t," "),Gn(n)]," ")}};function Z(e,t=""){var n;return(n=e?.filter(r=>r).join(t))!==null&&n!==void 0?n:""}function Gn(e){return pe(`{ `,Vd(Z(e,` `)),` }`)}function pe(e,t,n=""){return t!=null&&t!==""?e+t+n:""}function Vd(e){return pe(" ",e.replace(/\n/g,` `))}function aT(e){var t;return(t=e?.some(n=>n.includes(` `)))!==null&&t!==void 0?t:!1}function iw(e){return["ListType","NonNullType"].includes(e.kind)?iw(e.type):e.name.value}function pue(e,t){let n="";for(;e.includes(t+n.toString());)n=Number(n)+1;return t+n.toString()}function UR(e=""){return e.toLowerCase().replace(/[^a-z0-9_]/g,"").split("_").filter(n=>!!n).map(n=>n[0].toUpperCase()+n.slice(1)).join("")}function sT(e=""){const t=UR(e);return t&&t[0].toLowerCase()+t.slice(1)}function Kd(e){let t={kind:"NamedType",name:{kind:"Name",value:e}};const n=e.split(""),r=n[0],i=n[n.length-1];if(r==="["&&i==="]"&&(n.shift(),n.pop(),t={kind:"ListType",type:{kind:"NamedType",name:{kind:"Name",value:n.join("")}}}),i==="!"){const o=n[n.length-2];n.pop(),r==="["&&o==="]"?(n.shift(),n.pop(),t={kind:"NonNullType",type:{kind:"ListType",type:{kind:"NamedType",name:{kind:"Name",value:n.join("")}}}}):t={kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:n.join("")}}}}return t}function lT({rel:e,toNode:t,definition:n,direction:r}){const i=Kd(e.type),o=iw(i);i.kind==="ListType"?i.type.kind==="NonNullType"?i.type.type.name.value=t.label:i.type.name.value=t.label:i.kind==="NonNullType"?i.type.kind==="ListType"?i.type.type.name.value=t.label:i.type.name.value=t.label:i.name.value=t.label;let a=sT(o+"_"+t.label);r==="IN"&&(a=sT(t.label+"_"+o));const s={kind:"FieldDefinition",name:{kind:"Name",value:a},type:i,directives:[]},l={kind:"Directive",name:{kind:"Name",value:"relationship"},arguments:[{kind:"Argument",name:{kind:"Name",value:"type"},value:{kind:"StringValue",value:o}},{kind:"Argument",name:{kind:"Name",value:"direction"},value:{kind:"EnumValue",value:r}}]};e.propertiesReference&&l.arguments.push({kind:"Argument",name:{kind:"Name",value:"properties"},value:{kind:"StringValue",value:e.propertiesReference}}),s.directives.push(l),n.fields.push(s)}function hue(e){let t={kind:"Document",definitions:[]};const n=[],r=e.nodes.map(i=>{const o=(i.labels||[])[0];if(!o)throw new Error("Nodes require a single label for GraphQL export.");if(!Object.keys(i.properties||{}).length)throw new Error("Nodes require at least one property for GraphQL export.");return{label:o,graphID:i.id,properties:i.properties,relationships:[]}});return e.relationships.forEach(i=>{if(i.style&&i.style.directionality==="undirected")throw new Error("Undirected relationships not supported with GraphQL export.");if(!i.type)throw new Error("Relationships without a type are not supported with GraphQL export.");let o;const a=Object.keys(i.properties).length>0;a&&(o=pue(n.map(l=>l.name),UR(iw(Kd(i.type))))),r.find(l=>l.graphID===i.fromId).relationships.push({type:i.type,toGraphID:i.toId,propertiesReference:o}),a&&n.push({name:o,properties:i.properties})}),t.definitions=r.map(i=>({kind:"ObjectTypeDefinition",name:{kind:"Name",value:i.label},fields:Object.entries({...i.properties,__internalID__:i.graphID}).map(([a,s])=>({kind:"FieldDefinition",name:{kind:"Name",value:a},type:Kd(s)}))})).concat(n.map(i=>({kind:"InterfaceTypeDefinition",name:{kind:"Name",value:i.name},fields:Object.entries({...i.properties}).map(([a,s])=>({kind:"FieldDefinition",name:{kind:"Name",value:a},type:Kd(s)}))}))),r.forEach(i=>{const o=t.definitions.find(a=>a.fields.find(s=>s.name.value==="__internalID__"&&s.type.name.value===i.graphID));i.relationships.forEach(a=>{const s=r.find(u=>u.graphID===a.toGraphID),l=t.definitions.find(u=>u.fields.find(c=>c.name.value==="__internalID__"&&c.type.name.value===a.toGraphID));lT({rel:a,toNode:s,definition:o,direction:"OUT"}),lT({rel:a,toNode:i,definition:l,direction:"IN"})})}),t.definitions.forEach(i=>{i.fields=i.fields.filter(o=>o.name.value!=="__internalID__")}),cue(t)}class gue extends R.Component{constructor(t){super(t),this.state={error:null,typeDefs:""},this.exportToGraphQL=this.exportToGraphQL.bind(this)}exportToGraphQL(){try{const t=hue(this.props.graph);this.setState({typeDefs:t})}catch(t){this.setState({error:t})}}componentDidMount(){this.exportToGraphQL()}render(){if(this.state.error)return T(ht,{info:!0,error:!0,children:T(ht.Content,{children:this.state.error.message})});const t="data:text;base64,"+Us.encode(this.state.typeDefs);return F(ue,{children:[F(ht,{info:!0,icon:!0,children:[T(xe,{name:"info"}),F(ht.Content,{children:["This is a GraphQL schema based on the diagram. Use this schema with the"," ",T("a",{href:"https://neo4j.com/docs/graphql-manual/current/",target:"_blank",children:"Neo4j GraphQL Library."})]})]}),T(ue.Field,{children:F("a",{className:"ui button",href:t,download:`${this.props.diagramName}-schema.gql`,children:[T(xe,{name:"download"}),"Download"]})}),T(mc,{style:{height:500,fontFamily:"monospace"},value:this.state.typeDefs})]})}}class mue extends R.Component{constructor(t){super(t)}render(){const{graph:t,diagramName:n}=this.props,r=JSON.stringify({graph:t,diagramName:n}),i=window.location.origin+"/#/import/json="+Us.encode(r);return F("p",{children:["Copy the URL of ",T("a",{href:i,target:"_blank",children:"This Link"})," and paste it somewhere else, as a low-tech sharing mechanism."]})}}class vue extends R.Component{constructor(t){super(t),this.state={activeIndex:t8()||0}}onCancel=()=>{this.props.onCancel()};handleTabChange=(t,{activeIndex:n})=>{this.setState({activeIndex:n}),n8(n)};render(){const t=[{menuItem:"PNG",render:()=>T(oo.Pane,{attached:!1,children:T(jle,{graph:this.props.graph,cachedImages:this.props.cachedImages,diagramName:this.props.diagramName})})},{menuItem:"SVG",render:()=>T(oo.Pane,{attached:!1,children:T(Wle,{graph:this.props.graph,cachedImages:this.props.cachedImages,diagramName:this.props.diagramName})})},{menuItem:"Cypher",render:()=>T(oo.Pane,{attached:!1,children:T(zle,{graph:this.props.graph})})},{menuItem:"JSON",render:()=>T(oo.Pane,{attached:!1,children:T(Vle,{graph:this.props.graph,diagramName:this.props.diagramName})})},{menuItem:"URL",render:()=>T(oo.Pane,{attached:!1,children:T(mue,{graph:this.props.graph,diagramName:this.props.diagramName})})},{menuItem:"GraphQL",render:()=>T(oo.Pane,{attached:!1,children:T(gue,{graph:this.props.graph,diagramName:this.props.diagramName})})}];return F(Pe,{size:"large",centered:!1,open:!0,onClose:this.onCancel,children:[T(Pe.Header,{children:"Export"}),T(Pe.Content,{scrolling:!0,children:T(oo,{menu:{secondary:!0},panes:t,activeIndex:this.state.activeIndex,onTabChange:this.handleTabChange})}),T(Pe.Actions,{children:T(ce,{onClick:this.onCancel,content:"Done"})})]})}}const yue=e=>({graph:Re(e),cachedImages:e.cachedImages,diagramName:e.diagramName}),bue=e=>({onCancel:()=>{e(b7())}}),wue=Xt(yue,bue)(vue);class Eue extends R.Component{onCancel=()=>{this.props.onCancel()};render(){return F(Pe,{size:"small",open:this.props.showModal,onClose:this.onCancel,children:[T(Pe.Header,{children:"Google Drive"}),F(Pe.Content,{children:[T("p",{children:"Arrows.app can store its files in Google Drive, but needs your authorization to do so."}),T("p",{children:"To proceed you will need to have a Google account, and grant two permission scopes to this app:"}),F("ul",{children:[T("li",{children:"drive.file - Per-file access to files created or opened by the app. This means that the app will only be able to access files it created itself, or which you specifically open with the app."}),F("li",{children:['drive.install - Adds "New" and "Open with" menu items to the ',T("a",{href:"https://developers.google.com/drive/api/v3/about-apps",target:"_blank",children:"Google Drive UI"}),"."]})]}),F("p",{children:["Please see the ",T("a",{href:"https://developers.google.com/drive/api/v3/about-auth",target:"_blank",children:"Google documentation"})," if you'd like to learn more about these permissions."]}),T("p",{children:"If you don't wish to grant these permissions, please cancel this message."})]}),F(Pe.Actions,{children:[T(ce,{onClick:this.onCancel,content:"Cancel"}),T(ce,{primary:!0,onClick:this.props.signIn,content:"Authorize"})]})]})}}const xue=e=>({showModal:!e.googleDrive.signedIn&&(e.storage.mode==="GOOGLE_DRIVE"||e.storage.status==="PICKING_FROM_GOOGLE_DRIVE")}),Sue=e=>({signIn:()=>{window.gapi.auth2.getAuthInstance().signIn()},onCancel:()=>{e(U5())}}),Cue=Xt(xue,Sue)(Eue);var Tue=function e(t,n){if(t===n)return!0;if(t&&n&&typeof t=="object"&&typeof n=="object"){if(t.constructor!==n.constructor)return!1;var r,i,o;if(Array.isArray(t)){if(r=t.length,r!=n.length)return!1;for(i=r;i--!==0;)if(!e(t[i],n[i]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if(o=Object.keys(t),r=o.length,r!==Object.keys(n).length)return!1;for(i=r;i--!==0;)if(!Object.prototype.hasOwnProperty.call(n,o[i]))return!1;for(i=r;i--!==0;){var a=o[i];if(!e(t[a],n[a]))return!1}return!0}return t!==t&&n!==n};const Pue=pn(Tue);var dy={exports:{}},WR;/** * @link https://github.com/gajus/sister for the canonical source repository * @license https://github.com/gajus/sister/blob/master/LICENSE BSD 3-Clause */WR=function(){var e={},t={};return e.on=function(n,r){var i={name:n,handler:r};return t[n]=t[n]||[],t[n].unshift(i),i},e.off=function(n){var r=t[n.name].indexOf(n);r!==-1&&t[n.name].splice(r,1)},e.trigger=function(n,r){var i=t[n],o;if(i)for(o=i.length;o--;)i[o].handler(r)},e};var Oue=WR,fy={exports:{}},Aue=function(t,n,r){var i=document.head||document.getElementsByTagName("head")[0],o=document.createElement("script");typeof n=="function"&&(r=n,n={}),n=n||{},r=r||function(){},o.type=n.type||"text/javascript",o.charset=n.charset||"utf8",o.async="async"in n?!!n.async:!0,o.src=t,n.attrs&&_ue(o,n.attrs),n.text&&(o.text=""+n.text);var a="onload"in o?uT:Iue;a(o,r),o.onload||uT(o,r),i.appendChild(o)};function _ue(e,t){for(var n in t)e.setAttribute(n,t[n])}function uT(e,t){e.onload=function(){this.onerror=this.onload=null,t(null,e)},e.onerror=function(){this.onerror=this.onload=null,t(new Error("Failed to load "+this.src),e)}}function Iue(e,t){e.onreadystatechange=function(){this.readyState!="complete"&&this.readyState!="loaded"||(this.onreadystatechange=null,t(null,e))}}(function(e,t){Object.defineProperty(t,"__esModule",{value:!0});var n=Aue,r=i(n);function i(o){return o&&o.__esModule?o:{default:o}}t.default=function(o){var a=new Promise(function(s){if(window.YT&&window.YT.Player&&window.YT.Player instanceof Function){s(window.YT);return}else{var l=window.location.protocol==="http:"?"http:":"https:";(0,r.default)(l+"//www.youtube.com/iframe_api",function(c){c&&o.trigger("error",c)})}var u=window.onYouTubeIframeAPIReady;window.onYouTubeIframeAPIReady=function(){u&&u(),s(window.YT)}});return a},e.exports=t.default})(fy,fy.exports);var Nue=fy.exports,py={exports:{}},hy={exports:{}},gy={exports:{}},Qu=1e3,Xu=Qu*60,Ju=Xu*60,Zu=Ju*24,Rue=Zu*365.25,kue=function(e,t){t=t||{};var n=typeof e;if(n==="string"&&e.length>0)return $ue(e);if(n==="number"&&isNaN(e)===!1)return t.long?Mue(e):Due(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function $ue(e){if(e=String(e),!(e.length>100)){var t=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(e);if(t){var n=parseFloat(t[1]),r=(t[2]||"ms").toLowerCase();switch(r){case"years":case"year":case"yrs":case"yr":case"y":return n*Rue;case"days":case"day":case"d":return n*Zu;case"hours":case"hour":case"hrs":case"hr":case"h":return n*Ju;case"minutes":case"minute":case"mins":case"min":case"m":return n*Xu;case"seconds":case"second":case"secs":case"sec":case"s":return n*Qu;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n;default:return}}}}function Due(e){return e>=Zu?Math.round(e/Zu)+"d":e>=Ju?Math.round(e/Ju)+"h":e>=Xu?Math.round(e/Xu)+"m":e>=Qu?Math.round(e/Qu)+"s":e+"ms"}function Mue(e){return Ad(e,Zu,"day")||Ad(e,Ju,"hour")||Ad(e,Xu,"minute")||Ad(e,Qu,"second")||e+" ms"}function Ad(e,t,n){if(!(e=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}t.formatters.j=function(l){try{return JSON.stringify(l)}catch(u){return"[UnexpectedJSONParseError]: "+u.message}};function r(l){var u=this.useColors;if(l[0]=(u?"%c":"")+this.namespace+(u?" %c":" ")+l[0]+(u?"%c ":" ")+"+"+t.humanize(this.diff),!!u){var c="color: "+this.color;l.splice(1,0,c,"color: inherit");var d=0,f=0;l[0].replace(/%[a-zA-Z%]/g,function(p){p!=="%%"&&(d++,p==="%c"&&(f=d))}),l.splice(f,0,c)}}function i(){return typeof console=="object"&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}function o(l){try{l==null?t.storage.removeItem("debug"):t.storage.debug=l}catch{}}function a(){var l;try{l=t.storage.debug}catch{}return!l&&typeof process<"u"&&"env"in process&&(l={}.DEBUG),l}t.enable(a());function s(){try{return window.localStorage}catch{}}})(hy,hy.exports);var Fue=hy.exports,my={exports:{}};(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=["cueVideoById","loadVideoById","cueVideoByUrl","loadVideoByUrl","playVideo","pauseVideo","stopVideo","getVideoLoadedFraction","cuePlaylist","loadPlaylist","nextVideo","previousVideo","playVideoAt","setShuffle","setLoop","getPlaylist","getPlaylistIndex","setOption","mute","unMute","isMuted","setVolume","getVolume","seekTo","getPlayerState","getPlaybackRate","setPlaybackRate","getAvailablePlaybackRates","getPlaybackQuality","setPlaybackQuality","getAvailableQualityLevels","getCurrentTime","getDuration","removeEventListener","getVideoUrl","getVideoEmbedCode","getOptions","getOption","addEventListener","destroy","setSize","getIframe"],e.exports=t.default})(my,my.exports);var Hue=my.exports,vy={exports:{}};(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=["ready","stateChange","playbackQualityChange","playbackRateChange","error","apiChange","volumeChange"],e.exports=t.default})(vy,vy.exports);var jue=vy.exports,yy={exports:{}},by={exports:{}};(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default={BUFFERING:3,ENDED:0,PAUSED:2,PLAYING:1,UNSTARTED:-1,VIDEO_CUED:5},e.exports=t.default})(by,by.exports);var Gue=by.exports;(function(e,t){Object.defineProperty(t,"__esModule",{value:!0});var n=Gue,r=i(n);function i(o){return o&&o.__esModule?o:{default:o}}t.default={pauseVideo:{acceptableStates:[r.default.ENDED,r.default.PAUSED],stateChangeRequired:!1},playVideo:{acceptableStates:[r.default.ENDED,r.default.PLAYING],stateChangeRequired:!1},seekTo:{acceptableStates:[r.default.ENDED,r.default.PLAYING,r.default.PAUSED],stateChangeRequired:!0,timeout:3e3}},e.exports=t.default})(yy,yy.exports);var Bue=yy.exports;(function(e,t){Object.defineProperty(t,"__esModule",{value:!0});var n=Fue,r=c(n),i=Hue,o=c(i),a=jue,s=c(a),l=Bue,u=c(l);function c(p){return p&&p.__esModule?p:{default:p}}var d=(0,r.default)("youtube-player"),f={};f.proxyEvents=function(p){var y={},g=function(P){var O="on"+P.slice(0,1).toUpperCase()+P.slice(1);y[O]=function(N){d('event "%s"',O,N),p.trigger(P,N)}},w=!0,h=!1,v=void 0;try{for(var m=s.default[Symbol.iterator](),b;!(w=(b=m.next()).done);w=!0){var x=b.value;g(x)}}catch(C){h=!0,v=C}finally{try{!w&&m.return&&m.return()}finally{if(h)throw v}}return y},f.promisifyPlayer=function(p){var y=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,g={},w=function(O){y&&u.default[O]?g[O]=function(){for(var N=arguments.length,k=Array(N),D=0;D1&&arguments[1]!==void 0?arguments[1]:{},p=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,y=(0,i.default)();if(c||(c=(0,a.default)(y)),f.events)throw new Error("Event handlers cannot be overwritten.");if(typeof d=="string"&&!document.getElementById(d))throw new Error('Element "'+d+'" does not exist.');f.events=l.default.proxyEvents(y);var g=new Promise(function(h){if((typeof d>"u"?"undefined":n(d))==="object"&&d.playVideo instanceof Function){var v=d;h(v)}else c.then(function(m){var b=new m.Player(d,f);return y.on("ready",function(){h(b)}),null})}),w=l.default.promisifyPlayer(g,p);return w.on=y.on,w.off=y.off,w},e.exports=t.default})(dy,dy.exports);var Uue=dy.exports;const Wue=pn(Uue);var Vue=Object.defineProperty,Kue=Object.defineProperties,que=Object.getOwnPropertyDescriptors,cT=Object.getOwnPropertySymbols,Yue=Object.prototype.hasOwnProperty,Que=Object.prototype.propertyIsEnumerable,dT=(e,t,n)=>t in e?Vue(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,wy=(e,t)=>{for(var n in t||(t={}))Yue.call(t,n)&&dT(e,n,t[n]);if(cT)for(var n of cT(t))Que.call(t,n)&&dT(e,n,t[n]);return e},Ey=(e,t)=>Kue(e,que(t)),Xue=(e,t,n)=>new Promise((r,i)=>{var o=l=>{try{s(n.next(l))}catch(u){i(u)}},a=l=>{try{s(n.throw(l))}catch(u){i(u)}},s=l=>l.done?r(l.value):Promise.resolve(l.value).then(o,a);s((n=n.apply(e,t)).next())});function Jue(e,t){var n,r;if(e.videoId!==t.videoId)return!0;const i=((n=e.opts)==null?void 0:n.playerVars)||{},o=((r=t.opts)==null?void 0:r.playerVars)||{};return i.start!==o.start||i.end!==o.end}function fT(e={}){return Ey(wy({},e),{height:0,width:0,playerVars:Ey(wy({},e.playerVars),{autoplay:0,start:0,end:0})})}function Zue(e,t){return e.videoId!==t.videoId||!Pue(fT(e.opts),fT(t.opts))}function ece(e,t){var n,r,i,o;return e.id!==t.id||e.className!==t.className||((n=e.opts)==null?void 0:n.width)!==((r=t.opts)==null?void 0:r.width)||((i=e.opts)==null?void 0:i.height)!==((o=t.opts)==null?void 0:o.height)||e.iframeClassName!==t.iframeClassName||e.title!==t.title}var tce={videoId:"",id:"",className:"",iframeClassName:"",style:{},title:"",loading:void 0,opts:{},onReady:()=>{},onError:()=>{},onPlay:()=>{},onPause:()=>{},onEnd:()=>{},onStateChange:()=>{},onPlaybackRateChange:()=>{},onPlaybackQualityChange:()=>{}},nce={videoId:H.string,id:H.string,className:H.string,iframeClassName:H.string,style:H.object,title:H.string,loading:H.oneOf(["lazy","eager"]),opts:H.objectOf(H.any),onReady:H.func,onError:H.func,onPlay:H.func,onPause:H.func,onEnd:H.func,onStateChange:H.func,onPlaybackRateChange:H.func,onPlaybackQualityChange:H.func},qd=class extends E.Component{constructor(e){super(e),this.destroyPlayerPromise=void 0,this.onPlayerReady=t=>{var n,r;return(r=(n=this.props).onReady)==null?void 0:r.call(n,t)},this.onPlayerError=t=>{var n,r;return(r=(n=this.props).onError)==null?void 0:r.call(n,t)},this.onPlayerStateChange=t=>{var n,r,i,o,a,s,l,u;switch((r=(n=this.props).onStateChange)==null||r.call(n,t),t.data){case qd.PlayerState.ENDED:(o=(i=this.props).onEnd)==null||o.call(i,t);break;case qd.PlayerState.PLAYING:(s=(a=this.props).onPlay)==null||s.call(a,t);break;case qd.PlayerState.PAUSED:(u=(l=this.props).onPause)==null||u.call(l,t);break}},this.onPlayerPlaybackRateChange=t=>{var n,r;return(r=(n=this.props).onPlaybackRateChange)==null?void 0:r.call(n,t)},this.onPlayerPlaybackQualityChange=t=>{var n,r;return(r=(n=this.props).onPlaybackQualityChange)==null?void 0:r.call(n,t)},this.destroyPlayer=()=>this.internalPlayer?(this.destroyPlayerPromise=this.internalPlayer.destroy().then(()=>this.destroyPlayerPromise=void 0),this.destroyPlayerPromise):Promise.resolve(),this.createPlayer=()=>{if(typeof document>"u")return;if(this.destroyPlayerPromise){this.destroyPlayerPromise.then(this.createPlayer);return}const t=Ey(wy({},this.props.opts),{videoId:this.props.videoId});this.internalPlayer=Wue(this.container,t),this.internalPlayer.on("ready",this.onPlayerReady),this.internalPlayer.on("error",this.onPlayerError),this.internalPlayer.on("stateChange",this.onPlayerStateChange),this.internalPlayer.on("playbackRateChange",this.onPlayerPlaybackRateChange),this.internalPlayer.on("playbackQualityChange",this.onPlayerPlaybackQualityChange),(this.props.title||this.props.loading)&&this.internalPlayer.getIframe().then(n=>{this.props.title&&n.setAttribute("title",this.props.title),this.props.loading&&n.setAttribute("loading",this.props.loading)})},this.resetPlayer=()=>this.destroyPlayer().then(this.createPlayer),this.updatePlayer=()=>{var t;(t=this.internalPlayer)==null||t.getIframe().then(n=>{this.props.id?n.setAttribute("id",this.props.id):n.removeAttribute("id"),this.props.iframeClassName?n.setAttribute("class",this.props.iframeClassName):n.removeAttribute("class"),this.props.opts&&this.props.opts.width?n.setAttribute("width",this.props.opts.width.toString()):n.removeAttribute("width"),this.props.opts&&this.props.opts.height?n.setAttribute("height",this.props.opts.height.toString()):n.removeAttribute("height"),this.props.title?n.setAttribute("title",this.props.title):n.setAttribute("title","YouTube video player"),this.props.loading?n.setAttribute("loading",this.props.loading):n.removeAttribute("loading")})},this.getInternalPlayer=()=>this.internalPlayer,this.updateVideo=()=>{var t,n,r,i;if(typeof this.props.videoId>"u"||this.props.videoId===null){(t=this.internalPlayer)==null||t.stopVideo();return}let o=!1;const a={videoId:this.props.videoId};if((n=this.props.opts)!=null&&n.playerVars&&(o=this.props.opts.playerVars.autoplay===1,"start"in this.props.opts.playerVars&&(a.startSeconds=this.props.opts.playerVars.start),"end"in this.props.opts.playerVars&&(a.endSeconds=this.props.opts.playerVars.end)),o){(r=this.internalPlayer)==null||r.loadVideoById(a);return}(i=this.internalPlayer)==null||i.cueVideoById(a)},this.refContainer=t=>{this.container=t},this.container=null,this.internalPlayer=null}componentDidMount(){this.createPlayer()}componentDidUpdate(e){return Xue(this,null,function*(){ece(e,this.props)&&this.updatePlayer(),Zue(e,this.props)&&(yield this.resetPlayer()),Jue(e,this.props)&&this.updateVideo()})}componentWillUnmount(){this.destroyPlayer()}render(){return E.createElement("div",{className:this.props.className,style:this.props.style},E.createElement("div",{id:this.props.id,className:this.props.iframeClassName,ref:this.refContainer}))}},wh=qd;wh.propTypes=nce;wh.defaultProps=tce;wh.PlayerState={UNSTARTED:-1,ENDED:0,PLAYING:1,PAUSED:2,BUFFERING:3,CUED:5};var rce=wh;class ice extends R.Component{onCancel=()=>{this.props.onCancel()};render(){const t=[{key:wd(z0),description:"Select All"},{key:"Backspace or Delete",description:"Delete"},{key:"Enter",description:"Edit node/relationship"},{key:"Escape",description:"Stop editing"},{key:wd(U0),description:"Duplicate"},{key:wd(W0),description:"Undo"},{key:wd(V0),description:"Redo"}].map(n=>T(rn,{children:F(rn.Content,{children:[T(rn.Header,{children:n.key}),T(rn.Meta,{children:n.description})]})},n.key));return F(Pe,{size:"small",open:this.props.showModal,onClose:this.onCancel,children:[T(Pe.Header,{children:"Help"}),F(Pe.Content,{scrolling:!0,children:[T(pr,{size:"small",children:"New to arrows.app?"}),F("p",{children:["Learn about arrows.app by visiting ",T("a",{href:"https://neo4j.com/labs/arrows",target:"_blank",children:"Neo4j Labs"}),", or watching this short video:"]}),T(rce,{videoId:"ZHJ-BrKJ8A4",opts:{height:"360",width:"640"}}),T(Gi,{}),T(pr,{size:"small",children:"Keyboard shortcuts"}),T(rn.Group,{itemsPerRow:4,children:t}),T(pr,{size:"small",children:"Feedback"}),F("p",{children:["To share great ideas about improving arrows.app or report problems, please let us know on our ",T("a",{href:"https://feedback.neo4j.com/arrows",target:"_blank",children:"feedback board"}),"."]}),T(pr,{size:"small",children:"Contribute"}),F("p",{children:["Willing to add features or fix problems yourself? Join us at our ",T("a",{href:"https://github.com/neo4j-labs/arrows.app",target:"_blank",children:"GitHub repository"}),"."]})]}),T(Pe.Actions,{children:T(ce,{onClick:this.onCancel,content:"Done"})})]})}}const oce=e=>({showModal:e.applicationDialogs.showHelpDialog}),ace=e=>({onCancel:()=>{Q5(),e(x7())}}),sce=Xt(oce,ace)(ice);class lce extends R.Component{componentDidMount(){this.createPicker()}ensureGapiAndActWithToken(t){const n=()=>{t(window.gapi.auth.getToken().access_token),this.picker.setVisible(!0)};window.gapi.auth2.getAuthInstance()&&window.gapi.auth2.getAuthInstance().isSignedIn.get()?n():window.gapi.client.init({apiKey:Ei.apiKey,clientId:Ei.clientId,discoveryDocs:G0,scope:B0}).then(()=>{window.gapi.auth2.getAuthInstance().isSignedIn.get()?n():window.gapi.auth2.getAuthInstance().signIn().then(()=>{n()})})}createPicker(){const t=n=>{const r=new window.google.picker.DocsView;r.setMimeTypes("application/vnd.neo4j.arrows+json"),r.setMode(window.google.picker.DocsViewMode.LIST),this.picker=new window.google.picker.PickerBuilder().addView(r).hideTitleBar(!0).setOAuthToken(n).setAppId(Ei.appId).setDeveloperKey(Ei.apiKey).setCallback(this.pickerCallback.bind(this)).build()};this.ensureGapiAndActWithToken(t)}pickerCallback({action:t,docs:n}){if(t==="picked"&&n.length>0){const r=n[0].id;this.props.onFilePicked(r)}t==="cancel"&&this.props.onCancelPicker()}render(){return null}}const uce="/assets/Neo4j-logo-white-49b02085.svg",cce=[["Privacy","https://neo4j.com/privacy-policy/"],["Terms","https://neo4j.com/terms"],["Feedback","https://feedback.neo4j.com/arrows"]],dce=e=>{const t=cce.map(n=>{const[r,i]=n;return T("p",{style:{color:"#BCC0C9",fontSize:"11px",lineHeight:"26px",marginLeft:"20px"},children:T("a",{href:i,target:"_blank",children:r})},i)});return F("footer",{style:{width:"100%",height:QA+"px",backgroundColor:"#31333C",padding:"2px 10px",display:"flex",flexDirection:"row"},children:[F("p",{style:{color:"#BCC0C9",fontSize:"11px",lineHeight:"26px"},children:["Arrows.app powered by ",T("a",{href:"https://neo4j.com/labs/arrows",target:"_blank",children:"Neo4j Labs"})]}),T("p",{style:{color:"#BCC0C9",fontSize:"11px",lineHeight:"26px",marginLeft:"20px"},children:T("a",{onClick:e.onHelpClick,children:"Help"})}),t,T("p",{style:{flex:2}}),T("p",{style:{lineHeight:"26px"},children:T("a",{href:"https://neo4j.com?ref=arrows.app",target:"_blank",children:T("img",{src:uce,style:{height:"20px",marginTop:"2px"},alt:"Neo4j logo"})})})]})},fce=()=>({}),pce=e=>({onHelpClick:()=>{e(DN())}}),hce=Xt(fce,pce)(dce);var gce={};function mce(){return gce}function er(e,t){if(t.length1?"s":"")+" required, but only "+t.length+" present")}function Ct(e){er(1,arguments);var t=Object.prototype.toString.call(e);return e instanceof Date||ls(e)==="object"&&t==="[object Date]"?new Date(e.getTime()):typeof e=="number"||t==="[object Number]"?new Date(e):((typeof e=="string"||t==="[object String]")&&typeof console<"u"&&(console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#string-arguments"),console.warn(new Error().stack)),new Date(NaN))}function Yd(e,t){er(2,arguments);var n=Ct(e),r=Ct(t),i=n.getTime()-r.getTime();return i<0?-1:i>0?1:i}function vce(e,t){er(2,arguments);var n=Ct(e),r=Ct(t),i=n.getFullYear()-r.getFullYear(),o=n.getMonth()-r.getMonth();return i*12+o}function yce(e){er(1,arguments);var t=Ct(e);return t.setHours(23,59,59,999),t}function bce(e){er(1,arguments);var t=Ct(e),n=t.getMonth();return t.setFullYear(t.getFullYear(),n+1,0),t.setHours(23,59,59,999),t}function wce(e){er(1,arguments);var t=Ct(e);return yce(t).getTime()===bce(t).getTime()}function Ece(e,t){er(2,arguments);var n=Ct(e),r=Ct(t),i=Yd(n,r),o=Math.abs(vce(n,r)),a;if(o<1)a=0;else{n.getMonth()===1&&n.getDate()>27&&n.setDate(30),n.setMonth(n.getMonth()-i*o);var s=Yd(n,r)===-i;wce(Ct(e))&&o===1&&Yd(e,r)===1&&(s=!1),a=i*(o-Number(s))}return a===0?0:a}function xce(e,t){return er(2,arguments),Ct(e).getTime()-Ct(t).getTime()}var pT={ceil:Math.ceil,round:Math.round,floor:Math.floor,trunc:function(t){return t<0?Math.ceil(t):Math.floor(t)}},Sce="trunc";function Cce(e){return e?pT[e]:pT[Sce]}function Tce(e,t,n){er(2,arguments);var r=xce(e,t)/1e3;return Cce(n?.roundingMethod)(r)}var Pce={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},Oce=function(t,n,r){var i,o=Pce[t];return typeof o=="string"?i=o:n===1?i=o.one:i=o.other.replace("{{count}}",n.toString()),r!=null&&r.addSuffix?r.comparison&&r.comparison>0?"in "+i:i+" ago":i};const Ace=Oce;function Pm(e){return function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=t.width?String(t.width):e.defaultWidth,r=e.formats[n]||e.formats[e.defaultWidth];return r}}var _ce={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},Ice={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},Nce={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},Rce={date:Pm({formats:_ce,defaultWidth:"full"}),time:Pm({formats:Ice,defaultWidth:"full"}),dateTime:Pm({formats:Nce,defaultWidth:"full"})};const kce=Rce;var $ce={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},Dce=function(t,n,r,i){return $ce[t]};const Mce=Dce;function Rl(e){return function(t,n){var r=n!=null&&n.context?String(n.context):"standalone",i;if(r==="formatting"&&e.formattingValues){var o=e.defaultFormattingWidth||e.defaultWidth,a=n!=null&&n.width?String(n.width):o;i=e.formattingValues[a]||e.formattingValues[o]}else{var s=e.defaultWidth,l=n!=null&&n.width?String(n.width):e.defaultWidth;i=e.values[l]||e.values[s]}var u=e.argumentCallback?e.argumentCallback(t):t;return i[u]}}var Lce={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},Fce={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},Hce={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},jce={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},Gce={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},Bce={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},zce=function(t,n){var r=Number(t),i=r%100;if(i>20||i<10)switch(i%10){case 1:return r+"st";case 2:return r+"nd";case 3:return r+"rd"}return r+"th"},Uce={ordinalNumber:zce,era:Rl({values:Lce,defaultWidth:"wide"}),quarter:Rl({values:Fce,defaultWidth:"wide",argumentCallback:function(t){return t-1}}),month:Rl({values:Hce,defaultWidth:"wide"}),day:Rl({values:jce,defaultWidth:"wide"}),dayPeriod:Rl({values:Gce,defaultWidth:"wide",formattingValues:Bce,defaultFormattingWidth:"wide"})};const Wce=Uce;function kl(e){return function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=n.width,i=r&&e.matchPatterns[r]||e.matchPatterns[e.defaultMatchWidth],o=t.match(i);if(!o)return null;var a=o[0],s=r&&e.parsePatterns[r]||e.parsePatterns[e.defaultParseWidth],l=Array.isArray(s)?Kce(s,function(d){return d.test(a)}):Vce(s,function(d){return d.test(a)}),u;u=e.valueCallback?e.valueCallback(l):l,u=n.valueCallback?n.valueCallback(u):u;var c=t.slice(a.length);return{value:u,rest:c}}}function Vce(e,t){for(var n in e)if(e.hasOwnProperty(n)&&t(e[n]))return n}function Kce(e,t){for(var n=0;n1&&arguments[1]!==void 0?arguments[1]:{},r=t.match(e.matchPattern);if(!r)return null;var i=r[0],o=t.match(e.parsePattern);if(!o)return null;var a=e.valueCallback?e.valueCallback(o[0]):o[0];a=n.valueCallback?n.valueCallback(a):a;var s=t.slice(i.length);return{value:a,rest:s}}}var Yce=/^(\d+)(th|st|nd|rd)?/i,Qce=/\d+/i,Xce={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},Jce={any:[/^b/i,/^(a|c)/i]},Zce={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},ede={any:[/1/i,/2/i,/3/i,/4/i]},tde={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},nde={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},rde={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},ide={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},ode={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},ade={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},sde={ordinalNumber:qce({matchPattern:Yce,parsePattern:Qce,valueCallback:function(t){return parseInt(t,10)}}),era:kl({matchPatterns:Xce,defaultMatchWidth:"wide",parsePatterns:Jce,defaultParseWidth:"any"}),quarter:kl({matchPatterns:Zce,defaultMatchWidth:"wide",parsePatterns:ede,defaultParseWidth:"any",valueCallback:function(t){return t+1}}),month:kl({matchPatterns:tde,defaultMatchWidth:"wide",parsePatterns:nde,defaultParseWidth:"any"}),day:kl({matchPatterns:rde,defaultMatchWidth:"wide",parsePatterns:ide,defaultParseWidth:"any"}),dayPeriod:kl({matchPatterns:ode,defaultMatchWidth:"any",parsePatterns:ade,defaultParseWidth:"any"})};const lde=sde;var ude={code:"en-US",formatDistance:Ace,formatLong:kce,formatRelative:Mce,localize:Wce,match:lde,options:{weekStartsOn:0,firstWeekContainsDate:1}};const cde=ude;function VR(e,t){if(e==null)throw new TypeError("assign requires that input parameter not be null or undefined");for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}function dde(e){return VR({},e)}function hT(e){var t=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return t.setUTCFullYear(e.getFullYear()),e.getTime()-t.getTime()}var gT=1440,fde=2520,Om=43200,pde=86400;function hde(e,t,n){var r,i;er(2,arguments);var o=mce(),a=(r=(i=n?.locale)!==null&&i!==void 0?i:o.locale)!==null&&r!==void 0?r:cde;if(!a.formatDistance)throw new RangeError("locale must contain formatDistance property");var s=Yd(e,t);if(isNaN(s))throw new RangeError("Invalid time value");var l=VR(dde(n),{addSuffix:!!n?.addSuffix,comparison:s}),u,c;s>0?(u=Ct(t),c=Ct(e)):(u=Ct(e),c=Ct(t));var d=Tce(c,u),f=(hT(c)-hT(u))/1e3,p=Math.round((d-f)/60),y;if(p<2)return n!=null&&n.includeSeconds?d<5?a.formatDistance("lessThanXSeconds",5,l):d<10?a.formatDistance("lessThanXSeconds",10,l):d<20?a.formatDistance("lessThanXSeconds",20,l):d<40?a.formatDistance("halfAMinute",0,l):d<60?a.formatDistance("lessThanXMinutes",1,l):a.formatDistance("xMinutes",1,l):p===0?a.formatDistance("lessThanXMinutes",1,l):a.formatDistance("xMinutes",p,l);if(p<45)return a.formatDistance("xMinutes",p,l);if(p<90)return a.formatDistance("aboutXHours",1,l);if(p{this.props.onCancel()};onClickRow=t=>{this.setState({fileId:t})};render(){const t=this.props.recentStorage.map(n=>F(ie.Row,{active:this.state.fileId===n.fileId,onClick:()=>this.onClickRow(n.fileId),children:[T(ie.Cell,{children:n.diagramName}),T(ie.Cell,{children:gde(n.timestamp,{addSuffix:!0})})]}));return F(Pe,{size:"medium",centered:!1,open:!0,onClose:this.onCancel,children:[T(Pe.Header,{children:"Open diagram from Web Browser local storage"}),T(Pe.Content,{scrolling:!0,children:F(ie,{selectable:!0,children:[T(ie.Header,{children:F(ie.Row,{children:[T(ie.HeaderCell,{children:"Name"}),T(ie.HeaderCell,{children:"Last accessed"})]})}),T(ie.Body,{children:t})]})}),F(Pe.Actions,{children:[T(ce,{onClick:this.onCancel,content:"Cancel"}),T(ce,{primary:!0,disabled:this.state.fileId===null,onClick:()=>this.props.onPick(this.state.fileId),content:"Open"})]})]})}}const vde=e=>({recentStorage:e.recentStorage.filter(t=>t.mode==="LOCAL_STORAGE")}),yde=e=>({onPick:t=>{e(L0(t))},onCancel:()=>{e(F0())}}),bde=Xt(vde,yde)(mde);class wde extends R.Component{constructor(t){super(t),this.state={diagramName:"Copy of "+this.props.diagramName}}onChange=t=>{this.setState({diagramName:t.target.value})};onKeyPress=t=>{t.key==="Enter"&&this.commit()};commit=()=>{this.props.onCreate(this.state.diagramName)};render(){return F(Pe,{size:"mini",open:!0,onClose:this.props.onCancel,children:[T(Pe.Header,{children:"Save as new diagram…"}),T(Pe.Content,{children:T(Qt,{fluid:!0,value:this.state.diagramName,onChange:this.onChange,onKeyPress:this.onKeyPress})}),F(Pe.Actions,{children:[T(ce,{onClick:this.props.onCancel,content:"Cancel"}),T(ce,{type:"submit",onClick:this.commit,positive:!0,content:"Create"})]})]})}}const Ede=e=>({diagramName:e.diagramName}),xde=e=>({onCreate:t=>{e(GS()),e(H5(t))},onCancel:()=>{e(GS())}}),Sde=Xt(Ede,xde)(wde);class Cde extends R.Component{constructor(t){super(t),this.state={text:"",errorMessage:null}}tryImport=()=>{const t=this.props.tryImport(this.state.text,this.props.separation);t.errorMessage&&this.setState({errorMessage:t.errorMessage})};fileChange=()=>{const t=this.fileInputRef.files;t.length>0&&t[0].text().then(r=>{this.setState({text:r})})};render(){return F(Pe,{size:"large",centered:!1,open:!0,onClose:this.props.onCancel,children:[T(Pe.Header,{children:"Import"}),F(Pe.Content,{scrolling:!0,children:[F(ht,{children:[T("p",{children:"Import using the same JSON structure as you can see in the Export window."}),T("p",{children:"Alternatively, if you don't provide a JSON object, input will be treated as plain text, delimited by tabs and line breaks. For example, copy and paste from a spreadsheet to create one node per cell."}),T("p",{children:"Both of these import formats are also available by simply pasting into the app; you don't need to use this Import window if you already have the data on your clipboard."})]}),F(ue,{children:[F(ue.Field,{children:[T(ce,{content:"Choose File",labelPosition:"left",icon:"file",onClick:()=>this.fileInputRef.click()}),T("input",{ref:t=>this.fileInputRef=t,type:"file",hidden:!0,onChange:this.fileChange})]}),T(mc,{placeholder:"Choose a file, or paste text here...",style:{height:300,fontFamily:"monospace"},onChange:t=>this.setState({text:t.target.value}),value:this.state.text})]}),this.state.errorMessage?F(ht,{negative:!0,children:[T(ht.Header,{children:"Unable to import"}),T("p",{children:this.state.errorMessage})]}):null]}),F(Pe.Actions,{children:[T(ce,{onClick:this.props.onCancel,content:"Cancel"}),T(ce,{primary:!0,disabled:this.state.text.length===0,onClick:this.tryImport,content:"Import"})]})]})}}const Tde=e=>({separation:$R(e)}),Pde=e=>({tryImport:Qse(e),onCancel:()=>{e($N())}}),Ode=Xt(Tde,Pde)(Cde),Ade=()=>function(e,t){const n=t(),r=Re(n),i=zo(r,n.selection),o=sc(r,n.selection),a={nodes:i,relationships:o,style:r.style},s=JSON.stringify(a,null,2);navigator.clipboard.writeText(s).then(function(){console.log("Copied to clipboard successfully!")},function(){console.error("Unable to write to clipboard. :-(")})};class _de extends R.Component{constructor(t){super(t),ble(),window.addEventListener("keydown",this.fireKeyboardShortcutAction.bind(this)),window.addEventListener("copy",this.handleCopy.bind(this)),window.addEventListener("paste",this.handlePaste.bind(this)),window.addEventListener("message",this.handleMessage.bind(this))}render(){const{inspectorVisible:t,showSaveAsDialog:n,showExportDialog:r,showImportDialog:i,pickingFromGoogleDrive:o,pickingFromLocalStorage:a,onCancelPicker:s,loadFromGoogleDrive:l}=this.props,u=n?T(Sde,{}):null,c=r?T(wue,{}):null,d=i?T(Ode,{}):null,f=o?T(lce,{onCancelPicker:s,onFilePicked:l}):null,p=a?T(bde,{}):null,y=t?T("aside",{style:{width:XA,height:this.props.canvasHeight,overflowY:"scroll",borderLeft:"1px solid #D4D4D5"},children:T(Fle,{})}):null;return F("div",{style:{display:"flex",flexDirection:"column",position:"absolute",top:0,right:0,bottom:0,left:0,margin:0},children:[u,c,d,f,p,T(Cue,{}),T(sce,{}),T(T7,{}),F("section",{style:{flex:2,display:"flex",flexDirection:"row"},children:[T(W6,{}),y]}),T(hce,{})]})}fireKeyboardShortcutAction(t){if(cm(t))return;this.props.fireAction(t)&&(t.preventDefault(),t.stopPropagation())}handleCopy(t){cm(t)||this.props.handleCopy(t)}handlePaste(t){cm(t)||this.props.handlePaste(t)}handleMessage(t){this.props.handleImportMessage(t)}componentDidMount(){window.addEventListener("resize",this.props.onWindowResized)}}const Ide=e=>({inspectorVisible:e.applicationLayout.inspectorVisible,canvasHeight:Ip(e.applicationLayout).height,pickingFromGoogleDrive:e.storage.status==="PICKING_FROM_GOOGLE_DRIVE",pickingFromLocalStorage:e.storage.status==="PICKING_FROM_LOCAL_STORAGE",showSaveAsDialog:e.applicationDialogs.showSaveAsDialog,showExportDialog:e.applicationDialogs.showExportDialog,showImportDialog:e.applicationDialogs.showImportDialog}),Nde=e=>({onWindowResized:()=>e($_(window.innerWidth,window.innerHeight)),onCancelPicker:()=>e(F0()),loadFromGoogleDrive:t=>e(f_(t)),handleCopy:()=>e(Ade()),handlePaste:t=>e(Xse(t)),handleImportMessage:t=>e(T8(t))}),Rde=L_(Xt(Ide,Nde),V_)(_de),kde=[d6,a6,u8,Q8,p6],ec=qO(U8,window.__REDUX_DEVTOOLS_EXTENSION__&&window.__REDUX_DEVTOOLS_EXTENSION__(),VM(MD,...kde));e6(ec);ec.dispatch($_(window.innerWidth,window.innerHeight));ec.dispatch(f6(ec.getState()));const $de=IO(document.getElementById("root"));$de.render(F(R.StrictMode,{children:[T(jM,{store:ec,children:T(Rde,{})}),","]}));V8()});export default Dde();