|
|
(self.webpackChunk=self.webpackChunk||[]).push([[45099],{78673:function(t,e,i){"use strict";i.d(e,{Z:function(){return D}});var n=i(50023),o=i(92310),r=i.n(o),s=i(5891),a=i(80962),h=i(29043),l=i(19149),u=i(59301),c=i(35788),d=i(85108),f=["prefixCls","className","checked","defaultChecked","disabled","loadingIcon","checkedChildren","unCheckedChildren","onClick","onChange","onKeyDown"],p=u.forwardRef((function(t,e){var i,n=t.prefixCls,o=void 0===n?"rc-switch":n,p=t.className,g=t.checked,m=t.defaultChecked,y=t.disabled,v=t.loadingIcon,x=t.checkedChildren,b=t.unCheckedChildren,w=t.onClick,k=t.onChange,S=t.onKeyDown,M=(0,l.Z)(t,f),C=(0,c.Z)(!1,{value:g,defaultValue:m}),P=(0,h.Z)(C,2),T=P[0],N=P[1];function L(t,e){var i=T;return y||(N(i=t),null==k||k(i,e)),i}var A=r()(o,p,(i={},(0,a.Z)(i,"".concat(o,"-checked"),T),(0,a.Z)(i,"".concat(o,"-disabled"),y),i));return u.createElement("button",(0,s.Z)({},M,{type:"button",role:"switch","aria-checked":T,disabled:y,className:A,ref:e,onKeyDown:function(t){t.which===d.Z.LEFT?L(!1,t):t.which===d.Z.RIGHT&&L(!0,t),null==S||S(t)},onClick:function(t){var e=L(!T,t);null==w||w(e,t)}}),v,u.createElement("span",{className:"".concat(o,"-inner")},u.createElement("span",{className:"".concat(o,"-inner-checked")},x),u.createElement("span",{className:"".concat(o,"-inner-unchecked")},b)))}));p.displayName="Switch";var g=p,m=i(14088),y=i(36355),v=i(1684),x=i(19716),b=i(64993),w=i(17313),k=i(83116),S=i(37613);const M=t=>{const{componentCls:e,trackHeightSM:i,trackPadding:n,trackMinWidthSM:o,innerMinMarginSM:r,innerMaxMarginSM:s,handleSizeSM:a}=t,h=`${e}-inner`;return{[e]:{[`&${e}-small`]:{minWidth:o,height:i,lineHeight:`${i}px`,[`${e}-inner`]:{paddingInlineStart:s,paddingInlineEnd:r,[`${h}-checked`]:{marginInlineStart:`calc(-100% + ${a+2*n}px - ${2*s}px)`,marginInlineEnd:`calc(100% - ${a+2*n}px + ${2*s}px)`},[`${h}-unchecked`]:{marginTop:-i,marginInlineStart:0,marginInlineEnd:0}},[`${e}-handle`]:{width:a,height:a},[`${e}-loading-icon`]:{top:(a-t.switchLoadingIconSize)/2,fontSize:t.switchLoadingIconSize},[`&${e}-checked`]:{[`${e}-inner`]:{paddingInlineStart:r,paddingInlineEnd:s,[`${h}-checked`]:{marginInlineStart:0,marginInlineEnd:0},[`${h}-unchecked`]:{marginInlineStart:`calc(100% - ${a+2*n}px + ${2*s}px)`,marginInlineEnd:`calc(-100% + ${a+2*n}px - ${2*s}px)`}},[`${e}-handle`]:{insetInlineStart:`calc(100% - ${a+n}px)`}},[`&:not(${e}-disabled):active`]:{[`&:not(${e}-checked) ${h}`]:{[`${h}-unchecked`]:{marginInlineStart:t.marginXXS/2,marginInlineEnd:-t.marginXXS/2}},[`&${e}-checked ${h}`]:{[`${h}-checked`]:{marginInlineStart:-t.marginXXS/2,marginInlineEnd:t.marginXXS/2}}}}}}},C=t=>{const{componentCls:e,handleSize:i}=t;return{[e]:{[`${e}-loading-icon${t.iconCls}`]:{position:"relative",top:(i-t.fontSize)/2,color:t.switchLoadingIconColor,verticalAlign:"top"},[`&${e}-checked ${e}-loading-icon`]:{color:t.switchColor}}}},P=t=>{const{componentCls:e,motion:i,trackPadding:n,handleBg:o,handleShadow:r,handleSize:s}=t,a=`${e}-handle`;return{[e]:{[a]:{position:"absolute",top:n,insetInlineStart:n,width:s,height:s,transition:`all ${t.switchDuration} ease-in-out`,"&::before":{position:"absolute",top:0,insetInlineEnd:0,bottom:0,insetInlineStart:0,backgroundColor:o,borderRadius:s/2,boxShadow:r,transition:`all ${t.switchDuration} ease-in-out`,content:'""'}},[`&${e}-checked ${a}`]:{insetInlineStart:`calc(100% - ${s+n}px)`},[`&:not(${e}-disabled):active`]:i?{[`${a}::before`]:{insetInlineEnd:t.switchHandleActiveInset,insetInlineStart:0},[`&${e}-checked ${a}::before`]:{insetInlineEnd:0,insetInlineStart:t.switchHandleActiveInset}}:{}}}},T=t=>{const{componentCls:e,trackHeight:i,trackPadding:n,innerMinMargin:o,innerMaxMargin:r,handleSize:s}=t,a=`${e}-inner`;return{[e]:{[a]:{display:"block",overflow:"hidden",borderRadius:100,height:"100%",paddingInlineStart:r,paddingInlineEnd:o,transition:`padding-inline-start ${t.switchDuration} ease-in-out, padding-inline-end ${t.switchDuration} ease-in-out`,[`${a}-checked, ${a}-unchecked`]:{display:"block",color:t.colorTextLightSolid,fontSize:t.fontSizeSM,transition:`margin-inline-start ${t.switchDuration} ease-in-out, margin-inline-end ${t.switchDuration} ease-in-out`,pointerEvents:"none"},[`${a}-checked`]:{marginInlineStart:`calc(-100% + ${s+2*n}px - ${2*r}px)`,marginInlineEnd:`calc(100% - ${s+2*n}px + ${2*r}px)`},[`${a}-unchecked`]:{marginTop:-i,marginInlineStart:0,marginInlineEnd:0}},[`&${e}-checked ${a}`]:{paddingInlineStart:o,paddingInlineEnd:r,[`${a}-checked`]:{marginInlineStart:0,marginInlineEnd:0},[`${a}-unchecked`]:{marginInlineStart:`calc(100% - ${s+2*n}px + ${2*r}px)`,marginInlineEnd:`calc(-100% + ${s+2*n}px - ${2*r}px)`}},[`&:not(${e}-disabled):active`]:{[`&:not(${e}-checked) ${a}`]:{[`${a}-unchecked`]:{marginInlineStart:2*n,marginInlineEnd:2*-n}},[`&${e}-checked ${a}`]:{[`${a}-checked`]:{marginInlineStart:2*-n,marginInlineEnd:2*n}}}}}},N=t=>{const{componentCls:e,trackHeight:i,trackMinWidth:n}=t;return{[e]:Object.assign(Object.assign(Object.assign(Object.assign({},(0,w.Wf)(t)),{position:"relative",display:"inline-block",boxSizing:"border-box",minWidth:n,height:i,lineHeight:`${i}px`,verticalAlign:"middle",background:t.colorTextQuaternary,border:"0",borderRadius:100,cursor:"pointer",transition:`all ${t.motionDurationMid}`,userSelect:"none",[`&:hover:not(${e}-disabled)`]:{background:t.colorTextTertiary}}),(0,w.Qy)(t)),{[`&${e}-checked`]:{background:t.switchColor,[`&:hover:not(${e}-disabled)`]:{background:t.colorPrimaryHover}},[`&${e}-loading, &${e}-disabled`]:{cursor:"not-allowed",opacity:t.switchDisabledOpacity,"*":{boxShadow:"none",cursor:"not-allowed"}},[`&${e}-rtl`]:{direction:"rtl"}})}};var L=(0,k.Z)("Switch",(t=>{const e=(0,S.TS)(t,{switchDuration:t.motionDurationMid,switchColor:t.colorPrimary,switchDisabledOpacity:t.opacityLoading,switchLoadingIconSize:.75*t.fontSizeIcon,switchLoadingIconColor:`rgba(0, 0, 0, ${t.opacityLoading})`,switchHandleActiveInset:"-30%"});return[N(e),T(e),P(e),C(e),M(e)]}),(t=>{const{fontSize:e,lineHeight:i,controlHeight:n,colorWhite:o}=t,r=e*i,s=n/2,a=r-4,h=s-4;return{trackHeight:r,trackHeightSM:s,trackMinWidth:2*a+8,trackMinWidthSM:2*h+4,trackPadding:2,handleBg:o,handleSize:a,handleSizeSM:h,handleShadow:`0 2px 4px 0 ${new b.C("#00230b").setAlpha(.2).toRgbString()}`,innerMinMargin:a/2,innerMaxMargin:a+2+4,innerMinMarginSM:h/2,innerMaxMarginSM:h+2+4}})),A=function(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(t);o<n.length;o++)e.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(t,n[o])&&(i[n[o]]=t[n[o]])}return i};const B=u.forwardRef(((t,e)=>{const{prefixCls:i,size:o,disabled:s,loading:a,className:h,rootClassName:l,style:c}=t,d=A(t,["prefixCls","size","disabled","loading","className","rootClassName","style"]),{getPrefixCls:f,direction:p,switch:b}=u.useContext(y.E_),w=u.useContext(v.Z),k=(null!=s?s:w)||a,S=f("switch",i),M=u.createElement("div",{className:`${S}-handle`},a&&u.createElement(n.Z,{className:`${S}-loading-icon`})),[C,P]=L(S),T=(0,x.Z)(o),N=r()(null==b?void 0:b.className,{[`${S}-small`]:"small"===T,[`${S}-loading`]:a,[`${S}-rtl`]:"rtl"===p},h,l,P),B=Object.assign(Object.assign({},null==b?void 0:b.style),c);return C(u.createElement(m.Z,{component:"Switch"},u.createElement(g,Object.assign({},d,{prefixCls:S,className:N,style:B,disabled:k,ref:e,loadingIcon:M}))))}));B.__ANT_SWITCH=!0;var D=B},99498:function(t,e,i){!function(t){function e(t){t.state.placeholder&&(t.state.placeholder.parentNode.removeChild(t.state.placeholder),t.state.placeholder=null)}function i(t){e(t);var i=t.state.placeholder=document.createElement("pre");i.style.cssText="height: 0; overflow: visible",i.style.direction=t.getOption("direction"),i.className="CodeMirror-placeholder CodeMirror-line-like";var n=t.getOption("placeholder");"string"==typeof n&&(n=document.createTextNode(n)),i.appendChild(n),t.display.lineSpace.insertBefore(i,t.display.lineSpace.firstChild)}function n(t){setTimeout((function(){var n=!1,o=t.getInputField();"TEXTAREA"==o.nodeName?n=!o.value:1==t.lineCount()&&(n=!/[^\u200b]/.test(o.querySelector(".CodeMirror-line").textContent)),n?i(t):e(t)}),20)}function o(t){s(t)&&i(t)}function r(t){var n=t.getWrapperElement(),o=s(t);n.className=n.className.replace(" CodeMirror-empty","")+(o?" CodeMirror-empty":""),o?i(t):e(t)}function s(t){return 1===t.lineCount()&&""===t.getLine(0)}t.defineOption("placeholder","",(function(i,s,a){var h=a&&a!=t.Init;if(s&&!h)i.on("blur",o),i.on("change",r),i.on("swapDoc",r),t.on(i.getInputField(),"compositionupdate",i.state.placeholderCompose=function(){n(i)}),r(i);else if(!s&&h){i.off("blur",o),i.off("change",r),i.off("swapDoc",r),t.off(i.getInputField(),"compositionupdate",i.state.placeholderCompose),e(i);var l=i.getWrapperElement();l.className=l.className.replace(" CodeMirror-empty","")}s&&!i.hasFocus()&&o(i)}))}(i(89780))},25717:function(t,e,i){!function(t){var e={pairs:"()[]{}''\"\"",closeBefore:")]}'\":;>",triples:"",explode:"[]{}"},i=t.Pos;function n(t,i){return"pairs"==i&&"string"==typeof t?t:"object"==typeof t&&null!=t[i]?t[i]:e[i]}t.defineOption("autoCloseBrackets",!1,(function(e,i,s){s&&s!=t.Init&&(e.removeKeyMap(o),e.state.closeBrackets=null),i&&(r(n(i,"pairs")),e.state.closeBrackets=i,e.addKeyMap(o))}));var o={Backspace:h,Enter:l};function r(t){for(var e=0;e<t.length;e++){var i=t.charAt(e),n="'"+i+"'";o[n]||(o[n]=s(i))}}function s(t){return function(e){return c(e,t)}}function a(t){var e=t.state.closeBrackets;return!e||e.override?e:t.getModeAt(t.getCursor()).closeBrackets||e}function h(e){var o=a(e);if(!o||e.getOption("disableInput"))return t.Pass;for(var r=n(o,"pairs"),s=e.listSelections(),h=0;h<s.length;h++){if(!s[h].empty())return t.Pass;var l=d(e,s[h].head);if(!l||r.indexOf(l)%2!=0)return t.Pass}for(h=s.length-1;h>=0;h--){var u=s[h].head;e.replaceRange("",i(u.line,u.ch-1),i(u.line,u.ch+1),"+delete")}}function l(e){var i=a(e),o=i&&n(i,"explode");if(!o||e.getOption("disableInput"))return t.Pass;for(var r=e.listSelections(),s=0;s<r.length;s++){if(!r[s].empty())return t.Pass;var h=d(e,r[s].head);if(!h||o.indexOf(h)%2!=0)return t.Pass}e.operation((function(){var t=e.lineSeparator()||"\n";e.replaceSelection(t+t,null),e.execCommand("goCharLeft"),r=e.listSelections();for(var i=0;i<r.length;i++){var n=r[i].head.line;e.indentLine(n,null,!0),e.indentLine(n+1,null,!0)}}))}function u(e){var n=t.cmpPos(e.anchor,e.head)>0;return{anchor:new i(e.anchor.line,e.anchor.ch+(n?-1:1)),head:new i(e.head.line,e.head.ch+(n?1:-1))}}function c(e,o){var r=a(e);if(!r||e.getOption("disableInput"))return t.Pass;var s=n(r,"pairs"),h=s.indexOf(o);if(-1==h)return t.Pass;for(var l,c=n(r,"closeBefore"),d=n(r,"triples"),p=s.charAt(h+1)==o,g=e.listSelections(),m=h%2==0,y=0;y<g.length;y++){var v,x=g[y],b=x.head,w=e.getRange(b,i(b.line,b.ch+1));if(m&&!x.empty())v="surround";else if(!p&&m||w!=o)if(p&&b.ch>1&&d.indexOf(o)>=0&&e.getRange(i(b.line,b.ch-2),b)==o+o){if(b.ch>2&&/\bstring/.test(e.getTokenTypeAt(i(b.line,b.ch-2))))return t.Pass;v="addFour"}else if(p){var k=0==b.ch?" ":e.getRange(i(b.line,b.ch-1),b);if(t.isWordChar(w)||k==o||t.isWordChar(k))return t.Pass;v="both"}else{if(!m||!(0===w.length||/\s/.test(w)||c.indexOf(w)>-1))return t.Pass;v="both"}else v=p&&f(e,b)?"both":d.indexOf(o)>=0&&e.getRange(b,i(b.line,b.ch+3))==o+o+o?"skipThree":"skip";if(l){if(l!=v)return t.Pass}else l=v}var S=h%2?s.charAt(h-1):o,M=h%2?o:s.charAt(h+1);e.operation((function(){if("skip"==l)e.execCommand("goCharRight");else if("skipThree"==l)for(var t=0;t<3;t++)e.execCommand("goCharRight");else if("surround"==l){var i=e.getSelections();for(t=0;t<i.length;t++)i[t]=S+i[t]+M;for(e.replaceSelections(i,"around"),i=e.listSelections().slice(),t=0;t<i.length;t++)i[t]=u(i[t]);e.setSelections(i)}else"both"==l?(e.replaceSelection(S+M,null),e.triggerElectric(S+M),e.execCommand("goCharLeft")):"addFour"==l&&(e.replaceSelection(S+S+S+S,"before"),e.execCommand("goCharRight"))}))}function d(t,e){var n=t.getRange(i(e.line,e.ch-1),i(e.line,e.ch+1));return 2==n.length?n:null}function f(t,e){var n=t.getTokenAt(i(e.line,e.ch+1));return/\bstring/.test(n.type)&&n.start==e.ch&&(0==e.ch||!/\bstring/.test(t.getTokenTypeAt(e)))}r(e.pairs+"`")}(i(89780))},6313:function(t,e,i){!function(t){t.defineOption("autoCloseTags",!1,(function(e,i,o){if(o!=t.Init&&o&&e.removeKeyMap("autoCloseTags"),i){var s={name:"autoCloseTags"};"object"==typeof i&&!1===i.whenClosing||(s["'/'"]=function(t){return r(t)}),"object"==typeof i&&!1===i.whenOpening||(s["'>'"]=function(t){return n(t)}),e.addKeyMap(s)}}));var e=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],i=["applet","blockquote","body","button","div","dl","fieldset","form","frameset","h1","h2","h3","h4","h5","h6","head","html","iframe","layer","legend","object","ol","p","select","table","ul"];function n(n){if(n.getOption("disableInput"))return t.Pass;for(var o=n.listSelections(),r=[],h=n.getOption("autoCloseTags"),l=0;l<o.length;l++){if(!o[l].empty())return t.Pass;var u=o[l].head,c=n.getTokenAt(u),d=t.innerMode(n.getMode(),c.state),f=d.state,p=d.mode.xmlCurrentTag&&d.mode.xmlCurrentTag(f),g=p&&p.name;if(!g)return t.Pass;var m="html"==d.mode.configuration,y="object"==typeof h&&h.dontCloseTags||m&&e,v="object"==typeof h&&h.indentTags||m&&i;c.end>u.ch&&(g=g.slice(0,g.length-c.end+u.ch));var x=g.toLowerCase();if(!g||"string"==c.type&&(c.end!=u.ch||!/[\"\']/.test(c.string.charAt(c.string.length-1))||1==c.string.length)||"tag"==c.type&&p.close||c.string.indexOf("/")==u.ch-c.start-1||y&&s(y,x)>-1||a(n,d.mode.xmlCurrentContext&&d.mode.xmlCurrentContext(f)||[],g,u,!0))return t.Pass;var b="object"==typeof h&&h.emptyTags;if(b&&s(b,g)>-1)r[l]={text:"/>",newPos:t.Pos(u.line,u.ch+2)};else{var w=v&&s(v,x)>-1;r[l]={indent:w,text:">"+(w?"\n\n":"")+"</"+g+">",newPos:w?t.Pos(u.line+1,0):t.Pos(u.line,u.ch+1)}}}var k="object"==typeof h&&h.dontIndentOnAutoClose;for(l=o.length-1;l>=0;l--){var S=r[l];n.replaceRange(S.text,o[l].head,o[l].anchor,"+insert");var M=n.listSelections().slice(0);M[l]={head:S.newPos,anchor:S.newPos},n.setSelections(M),!k&&S.indent&&(n.indentLine(S.newPos.line,null,!0),n.indentLine(S.newPos.line+1,null,!0))}}function o(e,i){for(var n=e.listSelections(),o=[],r=i?"/":"</",s=e.getOption("autoCloseTags"),h="object"==typeof s&&s.dontIndentOnSlash,l=0;l<n.length;l++){if(!n[l].empty())return t.Pass;var u=n[l].head,c=e.getTokenAt(u),d=t.innerMode(e.getMode(),c.state),f=d.state;if(i&&("string"==c.type||"<"!=c.string.charAt(0)||c.start!=u.ch-1))return t.Pass;var p,g="xml"!=d.mode.name&&"htmlmixed"==e.getMode().name;if(g&&"javascript"==d.mode.name)p=r+"script";else if(g&&"css"==d.mode.name)p=r+"style";else{var m=d.mode.xmlCurrentContext&&d.mode.xmlCurrentContext(f);if(!m||m.length&&a(e,m,m[m.length-1],u))return t.Pass;p=r+m[m.length-1]}">"!=e.getLine(u.line).charAt(c.end)&&(p+=">"),o[l]=p}if(e.replaceSelections(o),n=e.listSelections(),!h)for(l=0;l<n.length;l++)(l==n.length-1||n[l].head.line<n[l+1].head.line)&&e.indentLine(n[l].head.line)}function r(e){return e.getOption("disableInput")?t.Pass:o(e,!0)}function s(t,e){if(t.indexOf)return t.indexOf(e);for(var i=0,n=t.length;i<n;++i)if(t[i]==e)return i;return-1}function a(e,i,n,o,r){if(!t.scanForClosingTag)return!1;var s=Math.min(e.lastLine()+1,o.line+500),a=t.scanForClosingTag(e,o,null,s);if(!a||a.tag!=n)return!1;for(var h=r?1:0,l=i.length-1;l>=0&&i[l]==n;l--)++h;for(o=a.to,l=1;l<h;l++){var u=t.scanForClosingTag(e,o,null,s);if(!u||u.tag!=n)return!1;o=u.to}return!0}t.commands.closeTag=function(t){return o(t)}}(i(89780),i(32855))},32855:function(t,e,i){!function(t){"use strict";var e=t.Pos;function i(t,e){return t.line-e.line||t.ch-e.ch}var n="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",o=new RegExp("<(/?)(["+n+"]["+n+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*)","g");function r(t,e,i,n){this.line=e,this.ch=i,this.cm=t,this.text=t.getLine(e),this.min=n?Math.max(n.from,t.firstLine()):t.firstLine(),this.max=n?Math.min(n.to-1,t.lastLine()):t.lastLine()}function s(t,i){var n=t.cm.getTokenTypeAt(e(t.line,i));return n&&/\btag\b/.test(n)}function a(t){if(!(t.line>=t.max))return t.ch=0,t.text=t.cm.getLine(++t.line),!0}function h(t){if(!(t.line<=t.min))return t.text=t.cm.getLine(--t.line),t.ch=t.text.length,!0}function l(t){for(;;){var e=t.text.indexOf(">",t.ch);if(-1==e){if(a(t))continue;return}if(s(t,e+1)){var i=t.text.lastIndexOf("/",e),n=i>-1&&!/\S/.test(t.text.slice(i+1,e));return t.ch=e+1,n?"selfClose":"regular"}t.ch=e+1}}function u(t){for(;;){var e=t.ch?t.text.lastIndexOf("<",t.ch-1):-1;if(-1==e){if(h(t))continue;return}if(s(t,e+1)){o.lastIndex=e,t.ch=e;var i=o.exec(t.text);if(i&&i.index==e)return i}else t.ch=e}}function c(t){for(;;){o.lastIndex=t.ch;var e=o.exec(t.text);if(!e){if(a(t))continue;return}if(s(t,e.index+1))return t.ch=e.index+e[0].length,e;t.ch=e.index+1}}function d(t){for(;;){var e=t.ch?t.text.lastIndexOf(">",t.ch-1):-1;if(-1==e){if(h(t))continue;return}if(s(t,e+1)){var i=t.text.lastIndexOf("/",e),n=i>-1&&!/\S/.test(t.text.slice(i+1,e));return t.ch=e+1,n?"selfClose":"regular"}t.ch=e}}function f(t,i){for(var n=[];;){var o,r=c(t),s=t.line,a=t.ch-(r?r[0].length:0);if(!r||!(o=l(t)))return;if("selfClose"!=o)if(r[1]){for(var h=n.length-1;h>=0;--h)if(n[h]==r[2]){n.length=h;break}if(h<0&&(!i||i==r[2]))return{tag:r[2],from:e(s,a),to:e(t.line,t.ch)}}else n.push(r[2])}}function p(t,i){for(var n=[];;){var o=d(t);if(!o)return;if("selfClose"!=o){var r=t.line,s=t.ch,a=u(t);if(!a)return;if(a[1])n.push(a[2]);else{for(var h=n.length-1;h>=0;--h)if(n[h]==a[2]){n.length=h;break}if(h<0&&(!i||i==a[2]))return{tag:a[2],from:e(t.line,t.ch),to:e(r,s)}}}else u(t)}}t.registerHelper("fold","xml",(function(t,n){for(var o=new r(t,n.line,0);;){var s=c(o);if(!s||o.line!=n.line)return;var a=l(o);if(!a)return;if(!s[1]&&"selfClose"!=a){var h=e(o.line,o.ch),u=f(o,s[2]);return u&&i(u.from,h)>0?{from:h,to:u.from}:null}}})),t.findMatchingTag=function(t,n,o){var s=new r(t,n.line,n.ch,o);if(-1!=s.text.indexOf(">")||-1!=s.text.indexOf("<")){var a=l(s),h=a&&e(s.line,s.ch),c=a&&u(s);if(a&&c&&!(i(s,n)>0)){var d={from:e(s.line,s.ch),to:h,tag:c[2]};return"selfClose"==a?{open:d,close:null,at:"open"}:c[1]?{open:p(s,c[2]),close:d,at:"close"}:{open:d,close:f(s=new r(t,h.line,h.ch,o),c[2]),at:"open"}}}},t.findEnclosingTag=function(t,e,i,n){for(var o=new r(t,e.line,e.ch,i);;){var s=p(o,n);if(!s)break;var a=f(new r(t,e.line,e.ch,i),s.tag);if(a)return{open:s,close:a}}},t.scanForClosingTag=function(t,e,i,n){return f(new r(t,e.line,e.ch,n?{from:0,to:n}:null),i)}}(i(89780))},25419:function(t,e,i){!function(t){"use strict";t.defineMode("markdown",(function(e,i){var n=t.getMode(e,"text/html"),o="null"==n.name;function r(i){if(t.findModeByName){var n=t.findModeByName(i);n&&(i=n.mime||n.mimes[0])}var o=t.getMode(e,i);return"null"==o.name?null:o}void 0===i.highlightFormatting&&(i.highlightFormatting=!1),void 0===i.maxBlockquoteDepth&&(i.maxBlockquoteDepth=0),void 0===i.taskLists&&(i.taskLists=!1),void 0===i.strikethrough&&(i.strikethrough=!1),void 0===i.emoji&&(i.emoji=!1),void 0===i.fencedCodeBlockHighlighting&&(i.fencedCodeBlockHighlighting=!0),void 0===i.fencedCodeBlockDefaultMode&&(i.fencedCodeBlockDefaultMode="text/plain"),void 0===i.xml&&(i.xml=!0),void 0===i.tokenTypeOverrides&&(i.tokenTypeOverrides={});var s={header:"header",code:"comment",quote:"quote",list1:"variable-2",list2:"variable-3",list3:"keyword",hr:"hr",image:"image",imageAltText:"image-alt-text",imageMarker:"image-marker",formatting:"formatting",linkInline:"link",linkEmail:"link",linkText:"link",linkHref:"string",em:"em",strong:"strong",strikethrough:"strikethrough",emoji:"builtin"};for(var a in s)s.hasOwnProperty(a)&&i.tokenTypeOverrides[a]&&(s[a]=i.tokenTypeOverrides[a]);var h=/^([*\-_])(?:\s*\1){2,}\s*$/,l=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,u=/^\[(x| )\](?=\s)/i,c=i.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,d=/^ {0,3}(?:\={1,}|-{2,})\s*$/,f=/^[^#!\[\]*_\\<>` "'(~:]+/,p=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,g=/^\s*\[[^\]]+?\]:.*$/,m=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E42\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDF3C-\uDF3E]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]/,y=" ";function v(t,e,i){return e.f=e.inline=i,i(t,e)}function x(t,e,i){return e.f=e.block=i,i(t,e)}function b(t){return!t||!/\S/.test(t.string)}function w(e){if(e.linkTitle=!1,e.linkHref=!1,e.linkText=!1,e.em=!1,e.strong=!1,e.strikethrough=!1,e.quote=0,e.indentedCode=!1,e.f==S){var i=o;if(!i){var r=t.innerMode(n,e.htmlState);i="xml"==r.mode.name&&null===r.state.tagStart&&!r.state.context&&r.state.tokenize.isInText}i&&(e.f=T,e.block=k,e.htmlState=null)}return e.trailingSpace=0,e.trailingSpaceNewLine=!1,e.prevLine=e.thisLine,e.thisLine={stream:null},null}function k(e,n){var o=e.column()===n.indentation,a=b(n.prevLine.stream),f=n.indentedCode,m=n.prevLine.hr,y=!1!==n.list,x=(n.listStack[n.listStack.length-1]||0)+3;n.indentedCode=!1;var w=n.indentation;if(null===n.indentationDiff&&(n.indentationDiff=n.indentation,y)){for(n.list=null;w<n.listStack[n.listStack.length-1];)n.listStack.pop(),n.listStack.length?n.indentation=n.listStack[n.listStack.length-1]:n.list=!1;!1!==n.list&&(n.indentationDiff=w-n.listStack[n.listStack.length-1])}var k=!(a||m||n.prevLine.header||y&&f||n.prevLine.fencedCodeEnd),S=(!1===n.list||m||a)&&n.indentation<=x&&e.match(h),P=null;if(n.indentationDiff>=4&&(f||n.prevLine.fencedCodeEnd||n.prevLine.header||a))return e.skipToEnd(),n.indentedCode=!0,s.code;if(e.eatSpace())return null;if(o&&n.indentation<=x&&(P=e.match(c))&&P[1].length<=6)return n.quote=0,n.header=P[1].length,n.thisLine.header=!0,i.highlightFormatting&&(n.formatting="header"),n.f=n.inline,C(n);if(n.indentation<=x&&e.eat(">"))return n.quote=o?1:n.quote+1,i.highlightFormatting&&(n.formatting="quote"),e.eatSpace(),C(n);if(!S&&!n.setext&&o&&n.indentation<=x&&(P=e.match(l))){var T=P[1]?"ol":"ul";return n.indentation=w+e.current().length,n.list=!0,n.quote=0,n.listStack.push(n.indentation),n.em=!1,n.strong=!1,n.code=!1,n.strikethrough=!1,i.taskLists&&e.match(u,!1)&&(n.taskList=!0),n.f=n.inline,i.highlightFormatting&&(n.formatting=["list","list-"+T]),C(n)}return o&&n.indentation<=x&&(P=e.match(p,!0))?(n.quote=0,n.fencedEndRE=new RegExp(P[1]+"+ *$"),n.localMode=i.fencedCodeBlockHighlighting&&r(P[2]||i.fencedCodeBlockDefaultMode),n.localMode&&(n.localState=t.startState(n.localMode)),n.f=n.block=M,i.highlightFormatting&&(n.formatting="code-block"),n.code=-1,C(n)):n.setext||!(k&&y||n.quote||!1!==n.list||n.code||S||g.test(e.string))&&(P=e.lookAhead(1))&&(P=P.match(d))?(n.setext?(n.header=n.setext,n.setext=0,e.skipToEnd(),i.highlightFormatting&&(n.formatting="header")):(n.header="="==P[0].charAt(0)?1:2,n.setext=n.header),n.thisLine.header=!0,n.f=n.inline,C(n)):S?(e.skipToEnd(),n.hr=!0,n.thisLine.hr=!0,s.hr):"["===e.peek()?v(e,n,D):v(e,n,n.inline)}function S(e,i){var r=n.token(e,i.htmlState);if(!o){var s=t.innerMode(n,i.htmlState);("xml"==s.mode.name&&null===s.state.tagStart&&!s.state.context&&s.state.tokenize.isInText||i.md_inside&&e.current().indexOf(">")>-1)&&(i.f=T,i.block=k,i.htmlState=null)}return r}function M(t,e){var n,o=e.listStack[e.listStack.length-1]||0,r=e.indentation<o,a=o+3;return e.fencedEndRE&&e.indentation<=a&&(r||t.match(e.fencedEndRE))?(i.highlightFormatting&&(e.formatting="code-block"),r||(n=C(e)),e.localMode=e.localState=null,e.block=k,e.f=T,e.fencedEndRE=null,e.code=0,e.thisLine.fencedCodeEnd=!0,r?x(t,e,e.block):n):e.localMode?e.localMode.token(t,e.localState):(t.skipToEnd(),s.code)}function C(t){var e=[];if(t.formatting){e.push(s.formatting),"string"==typeof t.formatting&&(t.formatting=[t.formatting]);for(var n=0;n<t.formatting.length;n++)e.push(s.formatting+"-"+t.formatting[n]),"header"===t.formatting[n]&&e.push(s.formatting+"-"+t.formatting[n]+"-"+t.header),"quote"===t.formatting[n]&&(!i.maxBlockquoteDepth||i.maxBlockquoteDepth>=t.quote?e.push(s.formatting+"-"+t.formatting[n]+"-"+t.quote):e.push("error"))}if(t.taskOpen)return e.push("meta"),e.length?e.join(" "):null;if(t.taskClosed)return e.push("property"),e.length?e.join(" "):null;if(t.linkHref?e.push(s.linkHref,"url"):(t.strong&&e.push(s.strong),t.em&&e.push(s.em),t.strikethrough&&e.push(s.strikethrough),t.emoji&&e.push(s.emoji),t.linkText&&e.push(s.linkText),t.code&&e.push(s.code),t.image&&e.push(s.image),t.imageAltText&&e.push(s.imageAltText,"link"),t.imageMarker&&e.push(s.imageMarker)),t.header&&e.push(s.header,s.header+"-"+t.header),t.quote&&(e.push(s.quote),!i.maxBlockquoteDepth||i.maxBlockquoteDepth>=t.quote?e.push(s.quote+"-"+t.quote):e.push(s.quote+"-"+i.maxBlockquoteDepth)),!1!==t.list){var o=(t.listStack.length-1)%3;o?1===o?e.push(s.list2):e.push(s.list3):e.push(s.list1)}return t.trailingSpaceNewLine?e.push("trailing-space-new-line"):t.trailingSpace&&e.push("trailing-space-"+(t.trailingSpace%2?"a":"b")),e.length?e.join(" "):null}function P(t,e){if(t.match(f,!0))return C(e)}function T(e,o){var r=o.text(e,o);if(void 0!==r)return r;if(o.list)return o.list=null,C(o);if(o.taskList)return" "===e.match(u,!0)[1]?o.taskOpen=!0:o.taskClosed=!0,i.highlightFormatting&&(o.formatting="task"),o.taskList=!1,C(o);if(o.taskOpen=!1,o.taskClosed=!1,o.header&&e.match(/^#+$/,!0))return i.highlightFormatting&&(o.formatting="header"),C(o);var a=e.next();if(o.linkTitle){o.linkTitle=!1;var h=a;"("===a&&(h=")");var l="^\\s*(?:[^"+(h=(h+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1"))+"\\\\]+|\\\\\\\\|\\\\.)"+h;if(e.match(new RegExp(l),!0))return s.linkHref}if("`"===a){var c=o.formatting;i.highlightFormatting&&(o.formatting="code"),e.eatWhile("`");var d=e.current().length;if(0!=o.code||o.quote&&1!=d){if(d==o.code){var f=C(o);return o.code=0,f}return o.formatting=c,C(o)}return o.code=d,C(o)}if(o.code)return C(o);if("\\"===a&&(e.next(),i.highlightFormatting)){var p=C(o),g=s.formatting+"-escape";return p?p+" "+g:g}if("!"===a&&e.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return o.imageMarker=!0,o.image=!0,i.highlightFormatting&&(o.formatting="image"),C(o);if("["===a&&o.imageMarker&&e.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return o.imageMarker=!1,o.imageAltText=!0,i.highlightFormatting&&(o.formatting="image"),C(o);if("]"===a&&o.imageAltText){i.highlightFormatting&&(o.formatting="image");var p=C(o);return o.imageAltText=!1,o.image=!1,o.inline=o.f=L,p}if("["===a&&!o.image)return o.linkText&&e.match(/^.*?\]/)||(o.linkText=!0,i.highlightFormatting&&(o.formatting="link")),C(o);if("]"===a&&o.linkText){i.highlightFormatting&&(o.formatting="link");var p=C(o);return o.linkText=!1,o.inline=o.f=e.match(/\(.*?\)| ?\[.*?\]/,!1)?L:T,p}if("<"===a&&e.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1))return o.f=o.inline=N,i.highlightFormatting&&(o.formatting="link"),(p=C(o))?p+=" ":p="",p+s.linkInline;if("<"===a&&e.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1))return o.f=o.inline=N,i.highlightFormatting&&(o.formatting="link"),(p=C(o))?p+=" ":p="",p+s.linkEmail;if(i.xml&&"<"===a&&e.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var y=e.string.indexOf(">",e.pos);if(-1!=y){var v=e.string.substring(e.start,y);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(v)&&(o.md_inside=!0)}return e.backUp(1),o.htmlState=t.startState(n),x(e,o,S)}if(i.xml&&"<"===a&&e.match(/^\/\w*?>/))return o.md_inside=!1,"tag";if("*"===a||"_"===a){for(var b=1,w=1==e.pos?" ":e.string.charAt(e.pos-2);b<3&&e.eat(a);)b++;var k=e.peek()||" ",M=!/\s/.test(k)&&(!m.test(k)||/\s/.test(w)||m.test(w)),P=!/\s/.test(w)&&(!m.test(w)||/\s/.test(k)||m.test(k)),A=null,B=null;if(b%2&&(o.em||!M||"*"!==a&&P&&!m.test(w)?o.em!=a||!P||"*"!==a&&M&&!m.test(k)||(A=!1):A=!0),b>1&&(o.strong||!M||"*"!==a&&P&&!m.test(w)?o.strong!=a||!P||"*"!==a&&M&&!m.test(k)||(B=!1):B=!0),null!=B||null!=A)return i.highlightFormatting&&(o.formatting=null==A?"strong":null==B?"em":"strong em"),!0===A&&(o.em=a),!0===B&&(o.strong=a),f=C(o),!1===A&&(o.em=!1),!1===B&&(o.strong=!1),f}else if(" "===a&&(e.eat("*")||e.eat("_"))){if(" "===e.peek())return C(o);e.backUp(1)}if(i.strikethrough)if("~"===a&&e.eatWhile(a)){if(o.strikethrough)return i.highlightFormatting&&(o.formatting="strikethrough"),f=C(o),o.strikethrough=!1,f;if(e.match(/^[^\s]/,!1))return o.strikethrough=!0,i.highlightFormatting&&(o.formatting="strikethrough"),C(o)}else if(" "===a&&e.match(/^~~/,!0)){if(" "===e.peek())return C(o);e.backUp(2)}if(i.emoji&&":"===a&&e.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){o.emoji=!0,i.highlightFormatting&&(o.formatting="emoji");var D=C(o);return o.emoji=!1,D}return" "===a&&(e.match(/^ +$/,!1)?o.trailingSpace++:o.trailingSpace&&(o.trailingSpaceNewLine=!0)),C(o)}function N(t,e){if(">"===t.next()){e.f=e.inline=T,i.highlightFormatting&&(e.formatting="link");var n=C(e);return n?n+=" ":n="",n+s.linkInline}return t.match(/^[^>]+/,!0),s.linkInline}function L(t,e){if(t.eatSpace())return null;var n=t.next();return"("===n||"["===n?(e.f=e.inline=B("("===n?")":"]"),i.highlightFormatting&&(e.formatting="link-string"),e.linkHref=!0,C(e)):"error"}var A={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function B(t){return function(e,n){if(e.next()===t){n.f=n.inline=T,i.highlightFormatting&&(n.formatting="link-string");var o=C(n);return n.linkHref=!1,o}return e.match(A[t]),n.linkHref=!0,C(n)}}function D(t,e){return t.match(/^([^\]\\]|\\.)*\]:/,!1)?(e.f=F,t.next(),i.highlightFormatting&&(e.formatting="link"),e.linkText=!0,C(e)):v(t,e,T)}function F(t,e){if(t.match(/^\]:/,!0)){e.f=e.inline=j,i.highlightFormatting&&(e.formatting="link");var n=C(e);return e.linkText=!1,n}return t.match(/^([^\]\\]|\\.)+/,!0),s.linkText}function j(t,e){return t.eatSpace()?null:(t.match(/^[^\s]+/,!0),void 0===t.peek()?e.linkTitle=!0:t.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/,!0),e.f=e.inline=T,s.linkHref+" url")}var E={startState:function(){return{f:k,prevLine:{stream:null},thisLine:{stream:null},block:k,htmlState:null,indentation:0,inline:T,text:P,formatting:!1,linkText:!1,linkHref:!1,linkTitle:!1,code:0,em:!1,strong:!1,header:0,setext:0,hr:!1,taskList:!1,list:!1,listStack:[],quote:0,trailingSpace:0,trailingSpaceNewLine:!1,strikethrough:!1,emoji:!1,fencedEndRE:null}},copyState:function(e){return{f:e.f,prevLine:e.prevLine,thisLine:e.thisLine,block:e.block,htmlState:e.htmlState&&t.copyState(n,e.htmlState),indentation:e.indentation,localMode:e.localMode,localState:e.localMode?t.copyState(e.localMode,e.localState):null,inline:e.inline,text:e.text,formatting:!1,linkText:e.linkText,linkTitle:e.linkTitle,linkHref:e.linkHref,code:e.code,em:e.em,strong:e.strong,strikethrough:e.strikethrough,emoji:e.emoji,header:e.header,setext:e.setext,hr:e.hr,taskList:e.taskList,list:e.list,listStack:e.listStack.slice(0),quote:e.quote,indentedCode:e.indentedCode,trailingSpace:e.trailingSpace,trailingSpaceNewLine:e.trailingSpaceNewLine,md_inside:e.md_inside,fencedEndRE:e.fencedEndRE}},token:function(t,e){if(e.formatting=!1,t!=e.thisLine.stream){if(e.header=0,e.hr=!1,t.match(/^\s*$/,!0))return w(e),null;if(e.prevLine=e.thisLine,e.thisLine={stream:t},e.taskList=!1,e.trailingSpace=0,e.trailingSpaceNewLine=!1,!e.localState&&(e.f=e.block,e.f!=S)){var i=t.match(/^\s*/,!0)[0].replace(/\t/g,y).length;if(e.indentation=i,e.indentationDiff=null,i>0)return null}}return e.f(t,e)},innerMode:function(t){return t.block==S?{state:t.htmlState,mode:n}:t.localState?{state:t.localState,mode:t.localMode}:{state:t,mode:E}},indent:function(e,i,o){return e.block==S&&n.indent?n.indent(e.htmlState,i,o):e.localState&&e.localMode.indent?e.localMode.indent(e.localState,i,o):t.Pass},blankLine:w,getType:C,blockCommentStart:"\x3c!--",blockCommentEnd:"--\x3e",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return E}),"xml"),t.defineMIME("text/markdown","markdown"),t.defineMIME("text/x-markdown","markdown")}(i(89780),i(15525),i(98101))},98101:function(t,e,i){!function(t){"use strict";t.modeInfo=[{name:"APL",mime:"text/apl",mode:"apl",ext:["dyalog","apl"]},{name:"PGP",mimes:["application/pgp","application/pgp-encrypted","application/pgp-keys","application/pgp-signature"],mode:"asciiarmor",ext:["asc","pgp","sig"]},{name:"ASN.1",mime:"text/x-ttcn-asn",mode:"asn.1",ext:["asn","asn1"]},{name:"Asterisk",mime:"text/x-asterisk",mode:"asterisk",file:/^extensions\.conf$/i},{name:"Brainfuck",mime:"text/x-brainfuck",mode:"brainfuck",ext:["b","bf"]},{name:"C",mime:"text/x-csrc",mode:"clike",ext:["c","h","ino"]},{name:"C++",mime:"text/x-c++src",mode:"clike",ext:["cpp","c++","cc","cxx","hpp","h++","hh","hxx"],alias:["cpp"]},{name:"Cobol",mime:"text/x-cobol",mode:"cobol",ext:["cob","cpy"]},{name:"C#",mime:"text/x-csharp",mode:"clike",ext:["cs"],alias:["csharp","cs"]},{name:"Clojure",mime:"text/x-clojure",mode:"clojure",ext:["clj","cljc","cljx"]},{name:"ClojureScript",mime:"text/x-clojurescript",mode:"clojure",ext:["cljs"]},{name:"Closure Stylesheets (GSS)",mime:"text/x-gss",mode:"css",ext:["gss"]},{name:"CMake",mime:"text/x-cmake",mode:"cmake",ext:["cmake","cmake.in"],file:/^CMakeLists\.txt$/},{name:"CoffeeScript",mimes:["application/vnd.coffeescript","text/coffeescript","text/x-coffeescript"],mode:"coffeescript",ext:["coffee"],alias:["coffee","coffee-script"]},{name:"Common Lisp",mime:"text/x-common-lisp",mode:"commonlisp",ext:["cl","lisp","el"],alias:["lisp"]},{name:"Cypher",mime:"application/x-cypher-query",mode:"cypher",ext:["cyp","cypher"]},{name:"Cython",mime:"text/x-cython",mode:"python",ext:["pyx","pxd","pxi"]},{name:"Crystal",mime:"text/x-crystal",mode:"crystal",ext:["cr"]},{name:"CSS",mime:"text/css",mode:"css",ext:["css"]},{name:"CQL",mime:"text/x-cassandra",mode:"sql",ext:["cql"]},{name:"D",mime:"text/x-d",mode:"d",ext:["d"]},{name:"Dart",mimes:["application/dart","text/x-dart"],mode:"dart",ext:["dart"]},{name:"diff",mime:"text/x-diff",mode:"diff",ext:["diff","patch"]},{name:"Django",mime:"text/x-django",mode:"django"},{name:"Dockerfile",mime:"text/x-dockerfile",mode:"dockerfile",file:/^Dockerfile$/},{name:"DTD",mime:"application/xml-dtd",mode:"dtd",ext:["dtd"]},{name:"Dylan",mime:"text/x-dylan",mode:"dylan",ext:["dylan","dyl","intr"]},{name:"EBNF",mime:"text/x-ebnf",mode:"ebnf"},{name:"ECL",mime:"text/x-ecl",mode:"ecl",ext:["ecl"]},{name:"edn",mime:"application/edn",mode:"clojure",ext:["edn"]},{name:"Eiffel",mime:"text/x-eiffel",mode:"eiffel",ext:["e"]},{name:"Elm",mime:"text/x-elm",mode:"elm",ext:["elm"]},{name:"Embedded Javascript",mime:"application/x-ejs",mode:"htmlembedded",ext:["ejs"]},{name:"Embedded Ruby",mime:"application/x-erb",mode:"htmlembedded",ext:["erb"]},{name:"Erlang",mime:"text/x-erlang",mode:"erlang",ext:["erl"]},{name:"Esper",mime:"text/x-esper",mode:"sql"},{name:"Factor",mime:"text/x-factor",mode:"factor",ext:["factor"]},{name:"FCL",mime:"text/x-fcl",mode:"fcl"},{name:"Forth",mime:"text/x-forth",mode:"forth",ext:["forth","fth","4th"]},{name:"Fortran",mime:"text/x-fortran",mode:"fortran",ext:["f","for","f77","f90","f95"]},{name:"F#",mime:"text/x-fsharp",mode:"mllike",ext:["fs"],alias:["fsharp"]},{name:"Gas",mime:"text/x-gas",mode:"gas",ext:["s"]},{name:"Gherkin",mime:"text/x-feature",mode:"gherkin",ext:["feature"]},{name:"GitHub Flavored Markdown",mime:"text/x-gfm",mode:"gfm",file:/^(readme|contributing|history)\.md$/i},{name:"Go",mime:"text/x-go",mode:"go",ext:["go"]},{name:"Groovy",mime:"text/x-groovy",mode:"groovy",ext:["groovy","gradle"],file:/^Jenkinsfile$/},{name:"HAML",mime:"text/x-haml",mode:"haml",ext:["haml"]},{name:"Haskell",mime:"text/x-haskell",mode:"haskell",ext:["hs"]},{name:"Haskell (Literate)",mime:"text/x-literate-haskell",mode:"haskell-literate",ext:["lhs"]},{name:"Haxe",mime:"text/x-haxe",mode:"haxe",ext:["hx"]},{name:"HXML",mime:"text/x-hxml",mode:"haxe",ext:["hxml"]},{name:"ASP.NET",mime:"application/x-aspx",mode:"htmlembedded",ext:["aspx"],alias:["asp","aspx"]},{name:"HTML",mime:"text/html",mode:"htmlmixed",ext:["html","htm","handlebars","hbs"],alias:["xhtml"]},{name:"HTTP",mime:"message/http",mode:"http"},{name:"IDL",mime:"text/x-idl",mode:"idl",ext:["pro"]},{name:"Pug",mime:"text/x-pug",mode:"pug",ext:["jade","pug"],alias:["jade"]},{name:"Java",mime:"text/x-java",mode:"clike",ext:["java"]},{name:"Java Server Pages",mime:"application/x-jsp",mode:"htmlembedded",ext:["jsp"],alias:["jsp"]},{name:"JavaScript",mimes:["text/javascript","text/ecmascript","application/javascript","application/x-javascript","application/ecmascript"],mode:"javascript",ext:["js"],alias:["ecmascript","js","node"]},{name:"JSON",mimes:["application/json","application/x-json"],mode:"javascript",ext:["json","map"],alias:["json5"]},{name:"JSON-LD",mime:"application/ld+json",mode:"javascript",ext:["jsonld"],alias:["jsonld"]},{name:"JSX",mime:"text/jsx",mode:"jsx",ext:["jsx"]},{name:"Jinja2",mime:"text/jinja2",mode:"jinja2",ext:["j2","jinja","jinja2"]},{name:"Julia",mime:"text/x-julia",mode:"julia",ext:["jl"]},{name:"Kotlin",mime:"text/x-kotlin",mode:"clike",ext:["kt"]},{name:"LESS",mime:"text/x-less",mode:"css",ext:["less"]},{name:"LiveScript",mime:"text/x-livescript",mode:"livescript",ext:["ls"],alias:["ls"]},{name:"Lua",mime:"text/x-lua",mode:"lua",ext:["lua"]},{name:"Markdown",mime:"text/x-markdown",mode:"markdown",ext:["markdown","md","mkd"]},{name:"mIRC",mime:"text/mirc",mode:"mirc"},{name:"MariaDB SQL",mime:"text/x-mariadb",mode:"sql"},{name:"Mathematica",mime:"text/x-mathematica",mode:"mathematica",ext:["m","nb","wl","wls"]},{name:"Modelica",mime:"text/x-modelica",mode:"modelica",ext:["mo"]},{name:"MUMPS",mime:"text/x-mumps",mode:"mumps",ext:["mps"]},{name:"MS SQL",mime:"text/x-mssql",mode:"sql"},{name:"mbox",mime:"application/mbox",mode:"mbox",ext:["mbox"]},{name:"MySQL",mime:"text/x-mysql",mode:"sql"},{name:"Nginx",mime:"text/x-nginx-conf",mode:"nginx",file:/nginx.*\.conf$/i},{name:"NSIS",mime:"text/x-nsis",mode:"nsis",ext:["nsh","nsi"]},{name:"NTriples",mimes:["application/n-triples","application/n-quads","text/n-triples"],mode:"ntriples",ext:["nt","nq"]},{name:"Objective-C",mime:"text/x-objectivec",mode:"clike",ext:["m"],alias:["objective-c","objc"]},{name:"Objective-C++",mime:"text/x-objectivec++",mode:"clike",ext:["mm"],alias:["objective-c++","objc++"]},{name:"OCaml",mime:"text/x-ocaml",mode:"mllike",ext:["ml","mli","mll","mly"]},{name:"Octave",mime:"text/x-octave",mode:"octave",ext:["m"]},{name:"Oz",mime:"text/x-oz",mode:"oz",ext:["oz"]},{name:"Pascal",mime:"text/x-pascal",mode:"pascal",ext:["p","pas"]},{name:"PEG.js",mime:"null",mode:"pegjs",ext:["jsonld"]},{name:"Perl",mime:"text/x-perl",mode:"perl",ext:["pl","pm"]},{name:"PHP",mimes:["text/x-php","application/x-httpd-php","application/x-httpd-php-open"],mode:"php",ext:["php","php3","php4","php5","php7","phtml"]},{name:"Pig",mime:"text/x-pig",mode:"pig",ext:["pig"]},{name:"Plain Text",mime:"text/plain",mode:"null",ext:["txt","text","conf","def","list","log"]},{name:"PLSQL",mime:"text/x-plsql",mode:"sql",ext:["pls"]},{name:"PostgreSQL",mime:"text/x-pgsql",mode:"sql"},{name:"PowerShell",mime:"application/x-powershell",mode:"powershell",ext:["ps1","psd1","psm1"]},{name:"Properties files",mime:"text/x-properties",mode:"properties",ext:["properties","ini","in"],alias:["ini","properties"]},{name:"ProtoBuf",mime:"text/x-protobuf",mode:"protobuf",ext:["proto"]},{name:"Python",mime:"text/x-python",mode:"python",ext:["BUILD","bzl","py","pyw"],file:/^(BUCK|BUILD)$/},{name:"Puppet",mime:"text/x-puppet",mode:"puppet",ext:["pp"]},{name:"Q",mime:"text/x-q",mode:"q",ext:["q"]},{name:"R",mime:"text/x-rsrc",mode:"r",ext:["r","R"],alias:["rscript"]},{name:"reStructuredText",mime:"text/x-rst",mode:"rst",ext:["rst"],alias:["rst"]},{name:"RPM Changes",mime:"text/x-rpm-changes",mode:"rpm"},{name:"RPM Spec",mime:"text/x-rpm-spec",mode:"rpm",ext:["spec"]},{name:"Ruby",mime:"text/x-ruby",mode:"ruby",ext:["rb"],alias:["jruby","macruby","rake","rb","rbx"]},{name:"Rust",mime:"text/x-rustsrc",mode:"rust",ext:["rs"]},{name:"SAS",mime:"text/x-sas",mode:"sas",ext:["sas"]},{name:"Sass",mime:"text/x-sass",mode:"sass",ext:["sass"]},{name:"Scala",mime:"text/x-scala",mode:"clike",ext:["scala"]},{name:"Scheme",mime:"text/x-scheme",mode:"scheme",ext:["scm","ss"]},{name:"SCSS",mime:"text/x-scss",mode:"css",ext:["scss"]},{name:"Shell",mimes:["text/x-sh","application/x-sh"],mode:"shell",ext:["sh","ksh","bash"],alias:["bash","sh","zsh"],file:/^PKGBUILD$/},{name:"Sieve",mime:"application/sieve",mode:"sieve",ext:["siv","sieve"]},{name:"Slim",mimes:["text/x-slim","application/x-slim"],mode:"slim",ext:["slim"]},{name:"Smalltalk",mime:"text/x-stsrc",mode:"smalltalk",ext:["st"]},{name:"Smarty",mime:"text/x-smarty",mode:"smarty",ext:["tpl"]},{name:"Solr",mime:"text/x-solr",mode:"solr"},{name:"SML",mime:"text/x-sml",mode:"mllike",ext:["sml","sig","fun","smackspec"]},{name:"Soy",mime:"text/x-soy",mode:"soy",ext:["soy"],alias:["closure template"]},{name:"SPARQL",mime:"application/sparql-query",mode:"sparql",ext:["rq","sparql"],alias:["sparul"]},{name:"Spreadsheet",mime:"text/x-spreadsheet",mode:"spreadsheet",alias:["excel","formula"]},{name:"SQL",mime:"text/x-sql",mode:"sql",ext:["sql"]},{name:"SQLite",mime:"text/x-sqlite",mode:"sql"},{name:"Squirrel",mime:"text/x-squirrel",mode:"clike",ext:["nut"]},{name:"Stylus",mime:"text/x-styl",mode:"stylus",ext:["styl"]},{name:"Swift",mime:"text/x-swift",mode:"swift",ext:["swift"]},{name:"sTeX",mime:"text/x-stex",mode:"stex"},{name:"LaTeX",mime:"text/x-latex",mode:"stex",ext:["text","ltx","tex"],alias:["tex"]},{name:"SystemVerilog",mime:"text/x-systemverilog",mode:"verilog",ext:["v","sv","svh"]},{name:"Tcl",mime:"text/x-tcl",mode:"tcl",ext:["tcl"]},{name:"Textile",mime:"text/x-textile",mode:"textile",ext:["textile"]},{name:"TiddlyWiki",mime:"text/x-tiddlywiki",mode:"tiddlywiki"},{name:"Tiki wiki",mime:"text/tiki",mode:"tiki"},{name:"TOML",mime:"text/x-toml",mode:"toml",ext:["toml"]},{name:"Tornado",mime:"text/x-tornado",mode:"tornado"},{name:"troff",mime:"text/troff",mode:"troff",ext:["1","2","3","4","5","6","7","8","9"]},{name:"TTCN",mime:"text/x-ttcn",mode:"ttcn",ext:["ttcn","ttcn3","ttcnpp"]},{name:"TTCN_CFG",mime:"text/x-ttcn-cfg",mode:"ttcn-cfg",ext:["cfg"]},{name:"Turtle",mime:"text/turtle",mode:"turtle",ext:["ttl"]},{name:"TypeScript",mime:"application/typescript",mode:"javascript",ext:["ts"],alias:["ts"]},{name:"TypeScript-JSX",mime:"text/typescript-jsx",mode:"jsx",ext:["tsx"],alias:["tsx"]},{name:"Twig",mime:"text/x-twig",mode:"twig"},{name:"Web IDL",mime:"text/x-webidl",mode:"webidl",ext:["webidl"]},{name:"VB.NET",mime:"text/x-vb",mode:"vb",ext:["vb"]},{name:"VBScript",mime:"text/vbscript",mode:"vbscript",ext:["vbs"]},{name:"Velocity",mime:"text/velocity",mode:"velocity",ext:["vtl"]},{name:"Verilog",mime:"text/x-verilog",mode:"verilog",ext:["v"]},{name:"VHDL",mime:"text/x-vhdl",mode:"vhdl",ext:["vhd","vhdl"]},{name:"Vue.js Component",mimes:["script/x-vue","text/x-vue"],mode:"vue",ext:["vue"]},{name:"XML",mimes:["application/xml","text/xml"],mode:"xml",ext:["xml","xsl","xsd","svg"],alias:["rss","wsdl","xsd"]},{name:"XQuery",mime:"application/xquery",mode:"xquery",ext:["xy","xquery"]},{name:"Yacas",mime:"text/x-yacas",mode:"yacas",ext:["ys"]},{name:"YAML",mimes:["text/x-yaml","text/yaml"],mode:"yaml",ext:["yaml","yml"],alias:["yml"]},{name:"Z80",mime:"text/x-z80",mode:"z80",ext:["z80"]},{name:"mscgen",mime:"text/x-mscgen",mode:"mscgen",ext:["mscgen","mscin","msc"]},{name:"xu",mime:"text/x-xu",mode:"mscgen",ext:["xu"]},{name:"msgenny",mime:"text/x-msgenny",mode:"mscgen",ext:["msgenny"]},{name:"WebAssembly",mime:"text/webassembly",mode:"wast",ext:["wat","wast"]}];for(var e=0;e<t.modeInfo.length;e++){var i=t.modeInfo[e];i.mimes&&(i.mime=i.mimes[0])}t.findModeByMIME=function(e){e=e.toLowerCase();for(var i=0;i<t.modeInfo.length;i++){var n=t.modeInfo[i];if(n.mime==e)return n;if(n.mimes)for(var o=0;o<n.mimes.length;o++)if(n.mimes[o]==e)return n}return/\+xml$/.test(e)?t.findModeByMIME("application/xml"):/\+json$/.test(e)?t.findModeByMIME("application/json"):void 0},t.findModeByExtension=function(e){e=e.toLowerCase();for(var i=0;i<t.modeInfo.length;i++){var n=t.modeInfo[i];if(n.ext)for(var o=0;o<n.ext.length;o++)if(n.ext[o]==e)return n}},t.findModeByFileName=function(e){for(var i=0;i<t.modeInfo.length;i++){var n=t.modeInfo[i];if(n.file&&n.file.test(e))return n}var o=e.lastIndexOf("."),r=o>-1&&e.substring(o+1,e.length);if(r)return t.findModeByExtension(r)},t.findModeByName=function(e){e=e.toLowerCase();for(var i=0;i<t.modeInfo.length;i++){var n=t.modeInfo[i];if(n.name.toLowerCase()==e)return n;if(n.alias)for(var o=0;o<n.alias.length;o++)if(n.alias[o].toLowerCase()==e)return n}}}(i(89780))},67549:function(t,e,i){!function(t){"use strict";t.defineMode("stex",(function(t,e){function i(t,e){t.cmdState.push(e)}function n(t){return t.cmdState.length>0?t.cmdState[t.cmdState.length-1]:null}function o(t){var e=t.cmdState.pop();e&&e.closeBracket()}function r(t){for(var e=t.cmdState,i=e.length-1;i>=0;i--){var n=e[i];if("DEFAULT"!=n.name)return n}return{styleIdentifier:function(){return null}}}function s(t,e,i){return function(){this.name=t,this.bracketNo=0,this.style=e,this.styles=i,this.argument=null,this.styleIdentifier=function(){return this.styles[this.bracketNo-1]||null},this.openBracket=function(){return this.bracketNo++,"bracket"},this.closeBracket=function(){}}}var a={};function h(t,e){t.f=e}function l(t,e){var o;if(t.match(/^\\[a-zA-Z@]+/)){var s=t.current().slice(1);return i(e,o=new(o=a.hasOwnProperty(s)?a[s]:a.DEFAULT)),h(e,c),o.style}if(t.match(/^\\[$&%#{}_]/))return"tag";if(t.match(/^\\[,;!\/\\]/))return"tag";if(t.match("\\["))return h(e,(function(t,e){return u(t,e,"\\]")})),"keyword";if(t.match("\\("))return h(e,(function(t,e){return u(t,e,"\\)")})),"keyword";if(t.match("$$"))return h(e,(function(t,e){return u(t,e,"$$")})),"keyword";if(t.match("$"))return h(e,(function(t,e){return u(t,e,"$")})),"keyword";var l=t.next();return"%"==l?(t.skipToEnd(),"comment"):"}"==l||"]"==l?(o=n(e))?(o.closeBracket(l),h(e,c),"bracket"):"error":"{"==l||"["==l?(i(e,o=new(o=a.DEFAULT)),"bracket"):/\d/.test(l)?(t.eatWhile(/[\w.%]/),"atom"):(t.eatWhile(/[\w\-_]/),"begin"==(o=r(e)).name&&(o.argument=t.current()),o.styleIdentifier())}function u(t,e,i){if(t.eatSpace())return null;if(i&&t.match(i))return h(e,l),"keyword";if(t.match(/^\\[a-zA-Z@]+/))return"tag";if(t.match(/^[a-zA-Z]+/))return"variable-2";if(t.match(/^\\[$&%#{}_]/))return"tag";if(t.match(/^\\[,;!\/]/))return"tag";if(t.match(/^[\^_&]/))return"tag";if(t.match(/^[+\-<>|=,\/@!*:;'"`~#?]/))return null;if(t.match(/^(\d+\.\d*|\d*\.\d+|\d+)/))return"number";var n=t.next();return"{"==n||"}"==n||"["==n||"]"==n||"("==n||")"==n?"bracket":"%"==n?(t.skipToEnd(),"comment"):"error"}function c(t,e){var i=t.peek();return"{"==i||"["==i?(n(e).openBracket(i),t.eat(i),h(e,l),"bracket"):/[ \t\r]/.test(i)?(t.eat(i),null):(h(e,l),o(e),l(t,e))}return a.importmodule=s("importmodule","tag",["string","builtin"]),a.documentclass=s("documentclass","tag",["","atom"]),a.usepackage=s("usepackage","tag",["atom"]),a.begin=s("begin","tag",["atom"]),a.end=s("end","tag",["atom"]),a.label=s("label","tag",["atom"]),a.ref=s("ref","tag",["atom"]),a.eqref=s("eqref","tag",["atom"]),a.cite=s("cite","tag",["atom"]),a.bibitem=s("bibitem","tag",["atom"]),a.Bibitem=s("Bibitem","tag",["atom"]),a.RBibitem=s("RBibitem","tag",["atom"]),a.DEFAULT=function(){this.name="DEFAULT",this.style="tag",this.styleIdentifier=this.openBracket=this.closeBracket=function(){}},{startState:function(){return{cmdState:[],f:e.inMathMode?function(t,e){return u(t,e)}:l}},copyState:function(t){return{cmdState:t.cmdState.slice(),f:t.f}},token:function(t,e){return e.f(t,e)},blankLine:function(t){t.f=l,t.cmdState.length=0},lineComment:"%"}})),t.defineMIME("text/x-stex","stex"),t.defineMIME("text/x-latex","stex")}(i(89780))},15525:function(t,e,i){!function(t){"use strict";var e={autoSelfClosers:{area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},implicitlyClosed:{dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},contextGrabbers:{dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}},doNotIndent:{pre:!0},allowUnquoted:!0,allowMissing:!0,caseFold:!0},i={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};t.defineMode("xml",(function(n,o){var r,s,a=n.indentUnit,h={},l=o.htmlMode?e:i;for(var u in l)h[u]=l[u];for(var u in o)h[u]=o[u];function c(t,e){function i(i){return e.tokenize=i,i(t,e)}var n=t.next();return"<"==n?t.eat("!")?t.eat("[")?t.match("CDATA[")?i(p("atom","]]>")):null:t.match("--")?i(p("comment","--\x3e")):t.match("DOCTYPE",!0,!0)?(t.eatWhile(/[\w\._\-]/),i(g(1))):null:t.eat("?")?(t.eatWhile(/[\w\._\-]/),e.tokenize=p("meta","?>"),"meta"):(r=t.eat("/")?"closeTag":"openTag",e.tokenize=d,"tag bracket"):"&"==n?(t.eat("#")?t.eat("x")?t.eatWhile(/[a-fA-F\d]/)&&t.eat(";"):t.eatWhile(/[\d]/)&&t.eat(";"):t.eatWhile(/[\w\.\-:]/)&&t.eat(";"))?"atom":"error":(t.eatWhile(/[^&<]/),null)}function d(t,e){var i=t.next();if(">"==i||"/"==i&&t.eat(">"))return e.tokenize=c,r=">"==i?"endTag":"selfcloseTag","tag bracket";if("="==i)return r="equals",null;if("<"==i){e.tokenize=c,e.state=x,e.tagName=e.tagStart=null;var n=e.tokenize(t,e);return n?n+" tag error":"tag error"}return/[\'\"]/.test(i)?(e.tokenize=f(i),e.stringStartCol=t.column(),e.tokenize(t,e)):(t.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function f(t){var e=function(e,i){for(;!e.eol();)if(e.next()==t){i.tokenize=d;break}return"string"};return e.isInAttribute=!0,e}function p(t,e){return function(i,n){for(;!i.eol();){if(i.match(e)){n.tokenize=c;break}i.next()}return t}}function g(t){return function(e,i){for(var n;null!=(n=e.next());){if("<"==n)return i.tokenize=g(t+1),i.tokenize(e,i);if(">"==n){if(1==t){i.tokenize=c;break}return i.tokenize=g(t-1),i.tokenize(e,i)}}return"meta"}}function m(t,e,i){this.prev=t.context,this.tagName=e,this.indent=t.indented,this.startOfLine=i,(h.doNotIndent.hasOwnProperty(e)||t.context&&t.context.noIndent)&&(this.noIndent=!0)}function y(t){t.context&&(t.context=t.context.prev)}function v(t,e){for(var i;;){if(!t.context)return;if(i=t.context.tagName,!h.contextGrabbers.hasOwnProperty(i)||!h.contextGrabbers[i].hasOwnProperty(e))return;y(t)}}function x(t,e,i){return"openTag"==t?(i.tagStart=e.column(),b):"closeTag"==t?w:x}function b(t,e,i){return"word"==t?(i.tagName=e.current(),s="tag",M):h.allowMissingTagName&&"endTag"==t?(s="tag bracket",M(t,e,i)):(s="error",b)}function w(t,e,i){if("word"==t){var n=e.current();return i.context&&i.context.tagName!=n&&h.implicitlyClosed.hasOwnProperty(i.context.tagName)&&y(i),i.context&&i.context.tagName==n||!1===h.matchClosing?(s="tag",k):(s="tag error",S)}return h.allowMissingTagName&&"endTag"==t?(s="tag bracket",k(t,e,i)):(s="error",S)}function k(t,e,i){return"endTag"!=t?(s="error",k):(y(i),x)}function S(t,e,i){return s="error",k(t,e,i)}function M(t,e,i){if("word"==t)return s="attribute",C;if("endTag"==t||"selfcloseTag"==t){var n=i.tagName,o=i.tagStart;return i.tagName=i.tagStart=null,"selfcloseTag"==t||h.autoSelfClosers.hasOwnProperty(n)?v(i,n):(v(i,n),i.context=new m(i,n,o==i.indented)),x}return s="error",M}function C(t,e,i){return"equals"==t?P:(h.allowMissing||(s="error"),M(t,e,i))}function P(t,e,i){return"string"==t?T:"word"==t&&h.allowUnquoted?(s="string",M):(s="error",M(t,e,i))}function T(t,e,i){return"string"==t?T:M(t,e,i)}return c.isInText=!0,{startState:function(t){var e={tokenize:c,state:x,indented:t||0,tagName:null,tagStart:null,context:null};return null!=t&&(e.baseIndent=t),e},token:function(t,e){if(!e.tagName&&t.sol()&&(e.indented=t.indentation()),t.eatSpace())return null;r=null;var i=e.tokenize(t,e);return(i||r)&&"comment"!=i&&(s=null,e.state=e.state(r||i,t,e),s&&(i="error"==s?i+" error":s)),i},indent:function(e,i,n){var o=e.context;if(e.tokenize.isInAttribute)return e.tagStart==e.indented?e.stringStartCol+1:e.indented+a;if(o&&o.noIndent)return t.Pass;if(e.tokenize!=d&&e.tokenize!=c)return n?n.match(/^(\s*)/)[0].length:0;if(e.tagName)return!1!==h.multilineTagIndentPastTag?e.tagStart+e.tagName.length+2:e.tagStart+a*(h.multilineTagIndentFactor||1);if(h.alignCDATA&&/<!\[CDATA\[/.test(i))return 0;var r=i&&/^<(\/)?([\w_:\.-]*)/.exec(i);if(r&&r[1])for(;o;){if(o.tagName==r[2]){o=o.prev;break}if(!h.implicitlyClosed.hasOwnProperty(o.tagName))break;o=o.prev}else if(r)for(;o;){var s=h.contextGrabbers[o.tagName];if(!s||!s.hasOwnProperty(r[2]))break;o=o.prev}for(;o&&o.prev&&!o.startOfLine;)o=o.prev;return o?o.indent+a:e.baseIndent||0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"\x3c!--",blockCommentEnd:"--\x3e",configuration:h.htmlMode?"html":"xml",helperType:h.htmlMode?"html":"xml",skipAttribute:function(t){t.state==P&&(t.state=M)},xmlCurrentTag:function(t){return t.tagName?{name:t.tagName,close:"closeTag"==t.type}:null},xmlCurrentContext:function(t){for(var e=[],i=t.context;i;i=i.prev)i.tagName&&e.push(i.tagName);return e.reverse()}}})),t.defineMIME("text/xml","xml"),t.defineMIME("application/xml","xml"),t.mimeModes.hasOwnProperty("text/html")||t.defineMIME("text/html",{name:"xml",htmlMode:!0})}(i(89780))},12378:function(t,e,i){"use strict";i.d(e,{$u:function(){return a},BD:function(){return x},E9:function(){return s},FF:function(){return L},FJ:function(){return f},Hn:function(){return d},KX:function(){return p},NB:function(){return C},S0:function(){return m},UL:function(){return h},Vk:function(){return c},Vm:function(){return T},YI:function(){return y},ZA:function(){return o},Zt:function(){return l},al:function(){return S},bn:function(){return k},bx:function(){return b},g2:function(){return v},h1:function(){return g},hD:function(){return N},l4:function(){return r},rU:function(){return P},s_:function(){return w},uz:function(){return M},z6:function(){return u}}),t=i.hmd(t),function(){var e;function n(t){var e=0;return function(){return e<t.length?{done:!1,value:t[e++]}:{done:!0}}}function o(t){var e="undefined"!=typeof Symbol&&Symbol.iterator&&t[Symbol.iterator];return e?e.call(t):{next:n(t)}}function r(t){for(var e,i=[];!(e=t.next()).done;)i.push(e.value);return i}var s,a="function"==typeof Object.create?Object.create:function(t){function e(){}return e.prototype=t,new e};if("function"==typeof Object.setPrototypeOf)s=Object.setPrototypeOf;else{var h;t:{var l={};try{l.__proto__={a:!0},h=l.a;break t}catch(t){}h=!1}s=h?function(t,e){if(t.__proto__=e,t.__proto__!==e)throw new TypeError(t+" is not extensible");return t}:null}var u=s;function c(t,e){if(t.prototype=a(e.prototype),t.prototype.constructor=t,u)u(t,e);else for(var i in e)if("prototype"!=i)if(Object.defineProperties){var n=Object.getOwnPropertyDescriptor(e,i);n&&Object.defineProperty(t,i,n)}else t[i]=e[i];t.QA=e.prototype}var d=void 0!==i.g&&null!=i.g?i.g:self,f="function"==typeof Object.assign?Object.assign:function(t,e){for(var i=1;i<arguments.length;i++){var n=arguments[i];if(n)for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},p="function"==typeof Object.defineProperties?Object.defineProperty:function(t,e,i){t!=Array.prototype&&t!=Object.prototype&&(t[e]=i.value)};function g(t,e){if(e){var i=d;t=t.split(".");for(var n=0;n<t.length-1;n++){var o=t[n];o in i||(i[o]={}),i=i[o]}(e=e(n=i[t=t[t.length-1]]))!=n&&null!=e&&p(i,t,{writable:!0,value:e})}}g("Object.assign",(function(t){return t||f})),g("Array.prototype.fill",(function(t){return t||function(t,e,i){var n=this.length||0;for(0>e&&(e=Math.max(0,n+e)),(null==i||i>n)&&(i=n),0>(i=Number(i))&&(i=Math.max(0,n+i)),e=Number(e||0);e<i;e++)this[e]=t;return this}}));var m="object"==typeof globalThis&&globalThis||"object"==typeof i.g&&i.g.global===i.g&&i.g||"object"==typeof self&&self.self===self&&self||{};function y(){}function v(t,e){var i=-1;return function(){var n=this,o=arguments;-1!==i&&m.clearTimeout(i),i=x((function(){i=-1,t.apply(n,o)}),e)}}function x(t,e){return m.setTimeout(t,e)}function b(t){return m.document.createElement(t)}function w(t){throw Error(t)}function k(t,e){t="The object is frozen, so its properties cannot be set: "+t.toString(),void 0!==e&&(t+=" to value: "+e),w(t)}function S(t,e,i,n){i=null===i?"*":"string"==typeof i?i:"function"==typeof i&&"string"==typeof i.className?i.className:"",void 0!==n&&(i+="."+n),w(i+" is not in the range "+e+": "+t)}function M(t){m.console&&m.console.log(t)}function C(t){return"object"==typeof t&&null!==t}function P(t){return Array.isArray(t)||m.NodeList&&t instanceof m.NodeList||m.HTMLCollection&&t instanceof m.HTMLCollection}function T(t){return Array.prototype.slice.call(t)}function N(t,e,i){Array.isArray(t)?e>=t.length?t.push(i):t.splice(e,0,i):w("Cannot insert an object into an HTMLCollection or NodeList: "+i+" at "+e)}function L(t,e){Array.isArray(t)?e>=t.length?t.pop():t.splice(e,1):w("Cannot remove an object from an HTMLCollection or NodeList at "+e)}function A(){var t=R.pop();return void 0===t?[]:t}function B(t){t.length=0,R.push(t)}function D(t){if("function"==typeof t){if(t.className)return t.className;if(t.name)return t.name;var e=t.toString();if(""!==(e=e.substring(9,e.indexOf("(")).trim()))return t._className=e}else if(C(t)&&t.constructor)return D(t.constructor);return typeof t}function F(t){var e=t;return C(t)&&(t.text?e=t.text:t.name?e=t.name:void 0!==t.key?e=t.key:void 0!==t.id?e=t.id:t.constructor===Object&&(t.Text?e=t.Text:t.Name?e=t.Name:void 0!==t.Key?e=t.Key:void 0!==t.Id?e=t.Id:void 0!==t.ID&&(e=t.ID))),void 0===e?"undefined":null===e?"null":e.toString()}function j(t,e){if(t.hasOwnProperty(e))return!0;for(t=Object.getPrototypeOf(t);t&&t!==Function;){if(t.hasOwnProperty(e))return!0;var i=t.CA;if(i&&i[e])return!0;t=Object.getPrototypeOf(t)}return!1}function E(t,e,i){Object.defineProperty(xi.prototype,t,{get:e,set:i})}function O(t){for(var e=[],i=0;256>i;i++)e["0123456789abcdef".charAt(i>>4)+"0123456789abcdef".charAt(15&i)]=String.fromCharCode(i);t.length%2&&(t="0"+t),i=[];for(var n=0,o=0;o<t.length;o+=2)i[n++]=e[t.substr(o,2)];for(t=""===(t=i.join(""))?"0":t,e=[],i=0;256>i;i++)e[i]=i;for(i=n=0;256>i;i++)n=(n+e[i]+119)%256,o=e[i],e[i]=e[n],e[n]=o;n=i=0;for(var r="",s=0;s<t.length;s++)n=(n+e[i=(i+1)%256])%256,o=e[i],e[i]=e[n],e[n]=o,r+=String.fromCharCode(t.charCodeAt(s)^e[(e[i]+e[n])%256]);return r.indexOf("GoJS 2.1 evaluation")>-1||r.indexOf("© 1998-2021 Northwoods Software")>-1||r.indexOf("Not for distribution or production use")>-1||r.indexOf("gojs.net")>-1?"":r}void 0===m.requestAnimationFrame&&(void 0===m.setImmediate?m.requestAnimationFrame=function(t){m.setTimeout(t,0)}:m.requestAnimationFrame=m.setImmediate);var I=void 0!==m.navigator&&0<m.navigator.userAgent.indexOf("Trident/7"),z=void 0!==m.navigator&&void 0!==m.navigator.platform&&null!==m.navigator.platform.match(/(iPhone|iPod|iPad|Mac)/i),R=[];function V(t,e,i){Q(this),this.j=t,this.xa=e,this.o=i}function G(t,e){return null==e||""===e?null:t[e]}function H(){this.ew=[]}function Y(){}Object.freeze([]),y.className="Util",y.Dx="32ab5ff3b26f42dc0ed90f21472913b5",y.adym="gojs.net",y.vfo="28e645fdb266",y.className="Util",V.prototype.toString=function(){return"EnumValue."+this.xa},d.Object.defineProperties(V.prototype,{classType:{get:function(){return this.j}},name:{get:function(){return this.xa}},value:{get:function(){return this.o}}}),V.className="EnumValue",H.prototype.toString=function(){return this.ew.join("")},H.prototype.add=function(t){""!==t&&this.ew.push(t)},H.className="StringBuilder",Y.className="PropertyCollection";var X={EA:!1,JA:!1,GA:!1,IA:!1,NA:!1,LA:!1,nx:!1,FA:null,trace:function(t){m.console&&m.console.log(t)},HA:function(t,e,i,n){t.strokeStyle="red",t.fillStyle="red",t.font="8px sans-serif",t.beginPath(),t.moveTo(-10,0),t.lineTo(10,0),t.moveTo(0,-10),t.lineTo(0,10),t.stroke(),t.setTransform(1,0,0,1,0,0),t.scale(i,i),t.transform(e.m11,e.m12,e.m21,e.m22,e.dx,e.dy),t.lineWidth=2,t.beginPath(),t.moveTo(n.left,n.top+20),t.lineTo(n.left,n.top),t.lineTo(n.left+20,n.top),t.moveTo(n.right,n.bottom-20),t.lineTo(n.right,n.bottom),t.lineTo(n.right-20,n.bottom),t.stroke(),t.fillText("DB: "+Math.round(n.x)+", "+Math.round(n.y)+", "+Math.round(n.width)+", "+Math.round(n.height),n.left,n.top-5)},DA:function(t){var e,i={};for(e in t){if(i.x=e,"licenseKey"!==i.x){var n=t[i.x];if(void 0!==n.prototype){i.Zl=Object.getOwnPropertyNames(n.prototype);for(var o={Tj:0};o.Tj<i.Zl.length;(o={Tj:o.Tj}).Tj++){var r=Object.getOwnPropertyDescriptor(n.prototype,i.Zl[o.Tj]);void 0!==r.get&&void 0===r.set&&Object.defineProperty(n.prototype,i.Zl[o.Tj],{set:function(t,e){return function(){throw Error("Property "+t.Zl[e.Tj]+" of "+t.x+" is read-only.")}}(i,o)})}}}i={Zl:i.Zl,x:i.x}}}};function U(){}U.prototype.reset=function(){},U.prototype.next=function(){return!1},U.prototype.Ad=function(){return!1},U.prototype.first=function(){return null},U.prototype.any=function(){return!1},U.prototype.all=function(){return!0},U.prototype.each=function(){return this},U.prototype.map=function(){return this},U.prototype.filter=function(){return this},U.prototype.de=function(){},U.prototype.toString=function(){return"EmptyIterator"},d.Object.defineProperties(U.prototype,{iterator:{get:function(){return this}},count:{get:function(){return 0}}}),U.prototype.first=U.prototype.first,U.prototype.hasNext=U.prototype.Ad,U.prototype.next=U.prototype.next,U.prototype.reset=U.prototype.reset;var q;function W(t){this.key=-1,this.value=t}function K(t){this.Bb=t,this.qf=null,t.Sa=null,this.qa=t.Ja,this.Za=-1}function _(t){this.Bb=t,t.Hg=null,this.qa=t.Ja,this.Za=t.s.length}function $(t){Q(this),this._isFrozen=!1,this.s=[],this.Ja=0,this.Hg=this.Sa=null,"string"==typeof t&&w("Error: Since 2.0 List/Map/Set constructors no longer take an argument that enforces type."),void 0!==t&&this.addAll(t)}function J(t){this.eg=t,t.Sa=null,this.qa=t.Ja,this.sa=null}function Z(t){Q(this),this._isFrozen=!1,this.Tb={},this.Sb=0,this.Sa=null,this.Ja=0,this.kf=this.ea=null,"string"==typeof t&&w("Error: Since 2.0 List/Map/Set constructors no longer take an argument that enforces type."),void 0!==t&&this.addAll(t)}function Q(t){t.__gohashid=at++}function tt(t){var e=t.__gohashid;return void 0===e&&(e=at++,t.__gohashid=e),e}function et(t){return t.__gohashid}U.className="EmptyIterator",q=new U,W.prototype.reset=function(){this.key=-1},W.prototype.next=function(){return-1===this.key&&(this.key=0,!0)},W.prototype.Ad=function(){return this.next()},W.prototype.first=function(){return this.key=0,this.value},W.prototype.any=function(t){return this.key=-1,t(this.value)},W.prototype.all=function(t){return this.key=-1,t(this.value)},W.prototype.each=function(t){return this.key=-1,t(this.value),this},W.prototype.map=function(t){return new W(t(this.value))},W.prototype.filter=function(t){return t(this.value)?new W(this.value):q},W.prototype.de=function(){this.value=null},W.prototype.toString=function(){return"SingletonIterator("+this.value+")"},d.Object.defineProperties(W.prototype,{iterator:{get:function(){return this}},count:{get:function(){return 1}}}),W.prototype.first=W.prototype.first,W.prototype.hasNext=W.prototype.Ad,W.prototype.next=W.prototype.next,W.prototype.reset=W.prototype.reset,W.className="SingletonIterator",K.prototype.reset=function(){var t=this.Bb;t.Sa=null,this.qa=t.Ja,this.Za=-1},K.prototype.next=function(){var t=this.Bb;if(t.Ja!==this.qa&&0>this.key)return!1;var e=(t=t.s).length,i=++this.Za,n=this.qf;if(null!==n)for(;i<e;){var o=t[i];if(n(o))return this.key=this.Za=i,this.value=o,!0;i++}else{if(i<e)return this.key=i,this.value=t[i],!0;this.de()}return!1},K.prototype.Ad=function(){return this.next()},K.prototype.first=function(){var t=this.Bb;this.qa=t.Ja,this.Za=0;var e=(t=t.s).length,i=this.qf;if(null!==i){for(var n=0;n<e;){var o=t[n];if(i(o))return this.key=this.Za=n,this.value=o;n++}return null}return 0<e?(t=t[0],this.key=0,this.value=t):null},K.prototype.any=function(t){var e=this.Bb;e.Sa=null,this.Za=-1;for(var i=(e=e.s).length,n=this.qf,o=0;o<i;o++){var r=e[o];if((null===n||n(r))&&t(r))return!0}return!1},K.prototype.all=function(t){var e=this.Bb;e.Sa=null,this.Za=-1;for(var i=(e=e.s).length,n=this.qf,o=0;o<i;o++){var r=e[o];if((null===n||n(r))&&!t(r))return!1}return!0},K.prototype.each=function(t){var e=this.Bb;e.Sa=null,this.Za=-1;for(var i=(e=e.s).length,n=this.qf,o=0;o<i;o++){var r=e[o];(null===n||n(r))&&t(r)}return this},K.prototype.map=function(t){var e=this.Bb;e.Sa=null,this.Za=-1;for(var i=[],n=(e=e.s).length,o=this.qf,r=0;r<n;r++){var s=e[r];(null===o||o(s))&&i.push(t(s))}return(t=new $).s=i,t.xb(),t.iterator},K.prototype.filter=function(t){var e=this.Bb;e.Sa=null,this.Za=-1;for(var i=[],n=(e=e.s).length,o=this.qf,r=0;r<n;r++){var s=e[r];(null===o||o(s))&&t(s)&&i.push(s)}return(t=new $).s=i,t.xb(),t.iterator},K.prototype.de=function(){this.key=-1,this.value=null,this.qa=-1,this.qf=null,this.Bb.Sa=this},K.prototype.toString=function(){return"ListIterator@"+this.Za+"/"+this.Bb.count},d.Object.defineProperties(K.prototype,{iterator:{get:function(){return this}},predicate:{get:function(){return this.qf},set:function(t){this.qf=t}},count:{get:function(){var t=this.qf;if(null!==t){for(var e=0,i=this.Bb.s,n=i.length,o=0;o<n;o++)t(i[o])&&e++;return e}return this.Bb.s.length}}}),K.prototype.first=K.prototype.first,K.prototype.hasNext=K.prototype.Ad,K.prototype.next=K.prototype.next,K.prototype.reset=K.prototype.reset,K.className="ListIterator",_.prototype.reset=function(){var t=this.Bb;t.Hg=null,this.qa=t.Ja,this.Za=t.s.length},_.prototype.next=function(){var t=this.Bb;if(t.Ja!==this.qa&&0>this.key)return!1;var e=--this.Za;return 0<=e?(this.key=e,this.value=t.s[e],!0):(this.de(),!1)},_.prototype.Ad=function(){return this.next()},_.prototype.first=function(){var t=this.Bb;this.qa=t.Ja;var e=t.s;return this.Za=t=e.length-1,0<=t?(e=e[t],this.key=t,this.value=e):null},_.prototype.any=function(t){var e=this.Bb;e.Hg=null;var i=(e=e.s).length;for(this.Za=i,--i;0<=i;i--)if(t(e[i]))return!0;return!1},_.prototype.all=function(t){var e=this.Bb;e.Hg=null;var i=(e=e.s).length;for(this.Za=i,--i;0<=i;i--)if(!t(e[i]))return!1;return!0},_.prototype.each=function(t){var e=this.Bb;e.Hg=null;var i=(e=e.s).length;for(this.Za=i,--i;0<=i;i--)t(e[i]);return this},_.prototype.map=function(t){var e=this.Bb;e.Hg=null;var i=[],n=(e=e.s).length;for(this.Za=n,--n;0<=n;n--)i.push(t(e[n]));return(t=new $).s=i,t.xb(),t.iterator},_.prototype.filter=function(t){var e=this.Bb;e.Hg=null;var i=[],n=(e=e.s).length;for(this.Za=n,--n;0<=n;n--){var o=e[n];t(o)&&i.push(o)}return(t=new $).s=i,t.xb(),t.iterator},_.prototype.de=function(){this.key=-1,this.value=null,this.qa=-1,this.Bb.Hg=this},_.prototype.toString=function(){return"ListIteratorBackwards("+this.Za+"/"+this.Bb.count+")"},d.Object.defineProperties(_.prototype,{iterator:{get:function(){return this}},count:{get:function(){return this.Bb.s.length}}}),_.prototype.first=_.prototype.first,_.prototype.hasNext=_.prototype.Ad,_.prototype.next=_.prototype.next,_.prototype.reset=_.prototype.reset,_.className="ListIteratorBackwards",(e=$.prototype).xb=function(){var t=this.Ja;999999999<++t&&(t=0),this.Ja=t},e.freeze=function(){return this._isFrozen=!0,this},e.ka=function(){return this._isFrozen=!1,this},e.toString=function(){return"List()#"+et(this)},e.add=function(t){return null===t||(this._isFrozen&&k(this,t),this.s.push(t),this.xb()),this},e.push=function(t){this.add(t)},e.addAll=function(t){if(null===t)return this;this._isFrozen&&k(this);var e=this.s;if(P(t))for(var i=t.length,n=0;n<i;n++)e.push(t[n]);else for(t=t.iterator;t.next();)e.push(t.value);return this.xb(),this},e.clear=function(){this._isFrozen&&k(this),this.s.length=0,this.xb()},e.contains=function(t){return null!==t&&-1!==this.s.indexOf(t)},e.has=function(t){return this.contains(t)},e.indexOf=function(t){return null===t?-1:this.s.indexOf(t)},e.M=function(t){var e=this.s;return(0>t||t>=e.length)&&S(t,"0 <= i < length",$,"elt:i"),e[t]},e.get=function(t){return this.M(t)},e.cd=function(t,e){var i=this.s;(0>t||t>=i.length)&&S(t,"0 <= i < length",$,"setElt:i"),this._isFrozen&&k(this,t),i[t]=e},e.set=function(t,e){this.cd(t,e)},e.first=function(){var t=this.s;return 0===t.length?null:t[0]},e.jc=function(){var t=this.s,e=t.length;return 0<e?t[e-1]:null},e.pop=function(){this._isFrozen&&k(this);var t=this.s;return 0<t.length?t.pop():null},$.prototype.any=function(t){for(var e=this.s,i=e.length,n=0;n<i;n++)if(t(e[n]))return!0;return!1},$.prototype.all=function(t){for(var e=this.s,i=e.length,n=0;n<i;n++)if(!t(e[n]))return!1;return!0},$.prototype.each=function(t){for(var e=this.s,i=e.length,n=0;n<i;n++)t(e[n]);return this},$.prototype.map=function(t){for(var e=new $,i=[],n=this.s,o=n.length,r=0;r<o;r++)i.push(t(n[r]));return e.s=i,e.xb(),e},$.prototype.filter=function(t){for(var e=new $,i=[],n=this.s,o=n.length,r=0;r<o;r++){var s=n[r];t(s)&&i.push(s)}return e.s=i,e.xb(),e},(e=$.prototype).Gb=function(t,e){0>t&&S(t,">= 0",$,"insertAt:i"),this._isFrozen&&k(this,t);var i=this.s;t>=i.length?i.push(e):i.splice(t,0,e),this.xb()},e.remove=function(t){if(null===t)return!1;this._isFrozen&&k(this,t);var e=this.s;return-1!==(t=e.indexOf(t))&&(t===e.length-1?e.pop():e.splice(t,1),this.xb(),!0)},e.delete=function(t){return this.remove(t)},e.mb=function(t){var e=this.s;(0>t||t>=e.length)&&S(t,"0 <= i < length",$,"removeAt:i"),this._isFrozen&&k(this,t),t===e.length-1?e.pop():e.splice(t,1),this.xb()},e.removeRange=function(t,e){var i=this.s,n=i.length;if(0>t)t=0;else if(t>=n)return this;if(0>e)return this;if(e>=n&&(e=n-1),t>e)return this;this._isFrozen&&k(this);for(var o=t,r=e+1;r<n;)i[o++]=i[r++];return i.length=n-(e-t+1),this.xb(),this},$.prototype.copy=function(){var t=new $,e=this.s;return 0<e.length&&(t.s=Array.prototype.slice.call(e)),t},(e=$.prototype).Fa=function(){for(var t=this.s,e=this.count,i=Array(e),n=0;n<e;n++)i[n]=t[n];return i},e.Iv=function(){for(var t=new Z,e=this.s,i=this.count,n=0;n<i;n++)t.add(e[n]);return t},e.sort=function(t){return this._isFrozen&&k(this),this.s.sort(t),this.xb(),this},e.zi=function(t,e,i){var n=this.s,o=n.length;void 0===e&&(e=0),void 0===i&&(i=o),this._isFrozen&&k(this);var r=i-e;if(1>=r)return this;if((0>e||e>=o-1)&&S(e,"0 <= from < length",$,"sortRange:from"),2===r)return 0<t(i=n[e],o=n[e+1])&&(n[e]=o,n[e+1]=i,this.xb()),this;if(0===e)if(i>=o)n.sort(t);else for((e=n.slice(0,i)).sort(t),t=0;t<i;t++)n[t]=e[t];else if(i>=o)for((i=n.slice(e)).sort(t),t=e;t<o;t++)n[t]=i[t-e];else for((o=n.slice(e,i)).sort(t),t=e;t<i;t++)n[t]=o[t-e];return this.xb(),this},e.reverse=function(){return this._isFrozen&&k(this),this.s.reverse(),this.xb(),this},d.Object.defineProperties($.prototype,{_dataArray:{get:function(){return this.s}},count:{get:function(){return this.s.length}},size:{get:function(){return this.s.length}},length:{get:function(){return this.s.length}},iterator:{get:function(){if(0>=this.s.length)return q;var t=this.Sa;return null!==t?(t.reset(),t):new K(this)}},iteratorBackwards:{get:function(){if(0>=this.s.length)return q;var t=this.Hg;return null!==t?(t.reset(),t):new _(this)}}}),$.prototype.reverse=$.prototype.reverse,$.prototype.sortRange=$.prototype.zi,$.prototype.sort=$.prototype.sort,$.prototype.toSet=$.prototype.Iv,$.prototype.toArray=$.prototype.Fa,$.prototype.removeRange=$.prototype.removeRange,$.prototype.removeAt=$.prototype.mb,$.prototype.delete=$.prototype.delete,$.prototype.remove=$.prototype.remove,$.prototype.insertAt=$.prototype.Gb,$.prototype.pop=$.prototype.pop,$.prototype.last=$.prototype.jc,$.prototype.first=$.prototype.first,$.prototype.set=$.prototype.set,$.prototype.setElt=$.prototype.cd,$.prototype.get=$.prototype.get,$.prototype.elt=$.prototype.M,$.prototype.indexOf=$.prototype.indexOf,$.prototype.has=$.prototype.has,$.prototype.contains=$.prototype.contains,$.prototype.clear=$.prototype.clear,$.prototype.addAll=$.prototype.addAll,$.prototype.push=$.prototype.push,$.prototype.add=$.prototype.add,$.prototype.thaw=$.prototype.ka,$.prototype.freeze=$.prototype.freeze,$.className="List",J.prototype.reset=function(){var t=this.eg;t.Sa=null,this.qa=t.Ja,this.sa=null},J.prototype.next=function(){var t=this.eg;if(t.Ja!==this.qa&&null===this.key)return!1;var e=this.sa;return null!==(e=null===e?t.ea:e.va)?(this.sa=e,this.value=e.value,this.key=e.key,!0):(this.de(),!1)},J.prototype.Ad=function(){return this.next()},J.prototype.first=function(){var t=this.eg;if(this.qa=t.Ja,null!==(t=t.ea)){this.sa=t;var e=t.value;return this.key=t.key,this.value=e}return null},J.prototype.any=function(t){var e=this.eg;for(this.sa=e.Sa=null,e=e.ea;null!==e;){if(t(e.value))return!0;e=e.va}return!1},J.prototype.all=function(t){var e=this.eg;for(this.sa=e.Sa=null,e=e.ea;null!==e;){if(!t(e.value))return!1;e=e.va}return!0},J.prototype.each=function(t){var e=this.eg;for(this.sa=e.Sa=null,e=e.ea;null!==e;)t(e.value),e=e.va;return this},J.prototype.map=function(t){var e=this.eg;e.Sa=null;var i=new $;for(e=e.ea;null!==e;)i.add(t(e.value)),e=e.va;return i.iterator},J.prototype.filter=function(t){var e=this.eg;e.Sa=null;var i=new $;for(e=e.ea;null!==e;){var n=e.value;t(n)&&i.add(n),e=e.va}return i.iterator},J.prototype.de=function(){this.value=this.key=null,this.qa=-1,this.eg.Sa=this},J.prototype.toString=function(){return null!==this.sa?"SetIterator@"+this.sa.value:"SetIterator"},d.Object.defineProperties(J.prototype,{iterator:{get:function(){return this}},count:{get:function(){return this.eg.Sb}}}),J.prototype.first=J.prototype.first,J.prototype.hasNext=J.prototype.Ad,J.prototype.next=J.prototype.next,J.prototype.reset=J.prototype.reset,J.className="SetIterator",(e=Z.prototype).xb=function(){var t=this.Ja;999999999<++t&&(t=0),this.Ja=t},e.freeze=function(){return this._isFrozen=!0,this},e.ka=function(){return this._isFrozen=!1,this},e.toString=function(){return"Set()#"+et(this)},e.add=function(t){if(null===t)return this;this._isFrozen&&k(this,t);var e=t;return C(t)&&(e=tt(t)),void 0===this.Tb[e]&&(this.Sb++,t=new ct(t,t),this.Tb[e]=t,null===(e=this.kf)?this.ea=t:(t.ll=e,e.va=t),this.kf=t,this.xb()),this},e.addAll=function(t){if(null===t)return this;if(this._isFrozen&&k(this),P(t))for(var e=t.length,i=0;i<e;i++)this.add(t[i]);else for(t=t.iterator;t.next();)this.add(t.value);return this},e.contains=function(t){if(null===t)return!1;var e=t;return(!C(t)||void 0!==(e=et(t)))&&void 0!==this.Tb[e]},e.has=function(t){return this.contains(t)},e.Sy=function(t){if(null===t)return!0;for(t=t.iterator;t.next();)if(!this.contains(t.value))return!1;return!0},e.Ty=function(t){if(null===t)return!0;for(t=t.iterator;t.next();)if(this.contains(t.value))return!0;return!1},e.first=function(){var t=this.ea;return null===t?null:t.value},Z.prototype.any=function(t){for(var e=this.ea;null!==e;){if(t(e.value))return!0;e=e.va}return!1},Z.prototype.all=function(t){for(var e=this.ea;null!==e;){if(!t(e.value))return!1;e=e.va}return!0},Z.prototype.each=function(t){for(var e=this.ea;null!==e;)t(e.value),e=e.va;return this},Z.prototype.map=function(t){for(var e=new Z,i=this.ea;null!==i;)e.add(t(i.value)),i=i.va;return e},Z.prototype.filter=function(t){for(var e=new Z,i=this.ea;null!==i;){var n=i.value;t(n)&&e.add(n),i=i.va}return e},(e=Z.prototype).remove=function(t){if(null===t)return!1;this._isFrozen&&k(this,t);var e=t;if(C(t)&&void 0===(e=et(t)))return!1;if(void 0===(t=this.Tb[e]))return!1;var i=t.va,n=t.ll;return null!==i&&(i.ll=n),null!==n&&(n.va=i),this.ea===t&&(this.ea=i),this.kf===t&&(this.kf=n),delete this.Tb[e],this.Sb--,this.xb(),!0},e.delete=function(t){return this.remove(t)},e.hp=function(t){if(null===t)return this;if(this._isFrozen&&k(this),P(t))for(var e=t.length,i=0;i<e;i++)this.remove(t[i]);else for(t=t.iterator;t.next();)this.remove(t.value);return this},e.pA=function(t){if(null===t||0===this.count)return this;this._isFrozen&&k(this);var e=new Z;e.addAll(t),t=[];for(var i=this.iterator;i.next();){var n=i.value;e.contains(n)||t.push(n)}return this.hp(t),this},e.clear=function(){this._isFrozen&&k(this),this.Tb={},this.Sb=0,null!==this.Sa&&this.Sa.reset(),this.kf=this.ea=null,this.xb()},Z.prototype.copy=function(){var t,e=new Z,i=this.Tb;for(t in i)e.add(i[t].value);return e},Z.prototype.Fa=function(){var t,e=Array(this.Sb),i=this.Tb,n=0;for(t in i)e[n]=i[t].value,n++;return e},Z.prototype.Hv=function(){var t,e=new $,i=this.Tb;for(t in i)e.add(i[t].value);return e},d.Object.defineProperties(Z.prototype,{count:{get:function(){return this.Sb}},size:{get:function(){return this.Sb}},iterator:{get:function(){if(0>=this.Sb)return q;var t=this.Sa;return null!==t?(t.reset(),t):new J(this)}}}),Z.prototype.toList=Z.prototype.Hv,Z.prototype.toArray=Z.prototype.Fa,Z.prototype.clear=Z.prototype.clear,Z.prototype.retainAll=Z.prototype.pA,Z.prototype.removeAll=Z.prototype.hp,Z.prototype.delete=Z.prototype.delete,Z.prototype.remove=Z.prototype.remove,Z.prototype.first=Z.prototype.first,Z.prototype.containsAny=Z.prototype.Ty,Z.prototype.containsAll=Z.prototype.Sy,Z.prototype.has=Z.prototype.has,Z.prototype.contains=Z.prototype.contains,Z.prototype.addAll=Z.prototype.addAll,Z.prototype.add=Z.prototype.add,Z.prototype.thaw=Z.prototype.ka,Z.prototype.freeze=Z.prototype.freeze;var it,nt,ot,rt,st,at=1;function ht(t){this.ma=t,this.qa=t.Ja,this.sa=null}function lt(t){Z.call(this),Q(this),this._isFrozen=!0,this.ma=t}function ut(t){this.ma=t,t.jf=null,this.qa=t.Ja,this.sa=null}function ct(t,e){this.key=t,this.value=e,this.ll=this.va=null}function dt(t){this.ma=t,t.Sa=null,this.qa=t.Ja,this.sa=null}function ft(t){Q(this),this._isFrozen=!1,this.Tb={},this.Sb=0,this.jf=this.Sa=null,this.Ja=0,this.kf=this.ea=null,"string"==typeof t&&w("Error: Since 2.0 List/Map/Set constructors no longer take an argument that enforces type."),void 0!==t&&this.addAll(t)}function pt(t,e){void 0===t?this.y=this.x=0:"number"==typeof t&&"number"==typeof e?(this.x=t,this.y=e):w("Invalid arguments to Point constructor: "+t+", "+e),this._isFrozen=!1}function gt(t){if("string"==typeof t){t=t.split(" ");for(var e=0,i=0;""===t[e];)e++;var n=t[e++];n&&(i=parseFloat(n));for(var o=0;""===t[e];)e++;return(n=t[e++])&&(o=parseFloat(n)),new pt(i,o)}return new pt}function mt(t){return t.x.toString()+" "+t.y.toString()}function yt(t,e){if(0===t)return 0<e?90:0>e?270:0;if(0===e)return 0<t?0:180;if(isNaN(t)||isNaN(e))return 0;var i=180*Math.atan(Math.abs(e/t))/Math.PI;return 0>t?i=0>e?i+180:180-i:0>e&&(i=360-i),i}function vt(t,e){return e.Cd(t),t}function xt(t,e,i,n,o,r){var s=o-i,a=r-n,h=s*s+a*a,l=-(i-=t)*s-(n-=e)*a;return 0>=l||l>=h?(s=o-t,a=r-e,Math.min(i*i+n*n,s*s+a*a)):(t=s*n-a*i)*t/h}function bt(t,e,i,n){return(t=i-t)*t+(e=n-e)*e}function wt(t,e,i,n){return e=n-e,0===(t=i-t)?0<e?90:0>e?270:0:0===e?0<t?0:180:isNaN(t)||isNaN(e)?0:(n=180*Math.atan(Math.abs(e/t))/Math.PI,0>t?n=0>e?n+180:180-n:0>e&&(n=360-n),n)}Z.className="Set",Z.uniqueHash=Q,Z.hashIdUnique=tt,Z.hashId=et,ht.prototype.reset=function(){this.qa=this.ma.Ja,this.sa=null},ht.prototype.next=function(){var t=this.ma;if(t.Ja!==this.qa&&null===this.key)return!1;var e=this.sa;return null!==(e=null===e?t.ea:e.va)?(this.sa=e,this.value=this.key=t=e.key,!0):(this.de(),!1)},ht.prototype.Ad=function(){return this.next()},ht.prototype.first=function(){var t=this.ma;return this.qa=t.Ja,null!==(t=t.ea)?(this.sa=t,this.value=this.key=t=t.key):null},ht.prototype.any=function(t){var e=this.ma;for(this.sa=null,e=e.ea;null!==e;){if(t(e.key))return!0;e=e.va}return!1},ht.prototype.all=function(t){var e=this.ma;for(this.sa=null,e=e.ea;null!==e;){if(!t(e.key))return!1;e=e.va}return!0},ht.prototype.each=function(t){var e=this.ma;for(this.sa=null,e=e.ea;null!==e;)t(e.key),e=e.va;return this},ht.prototype.map=function(t){var e=this.ma;this.sa=null;var i=new $;for(e=e.ea;null!==e;)i.add(t(e.key)),e=e.va;return i.iterator},ht.prototype.filter=function(t){var e=this.ma;this.sa=null;var i=new $;for(e=e.ea;null!==e;){var n=e.key;t(n)&&i.add(n),e=e.va}return i.iterator},ht.prototype.de=function(){this.value=this.key=null,this.qa=-1},ht.prototype.toString=function(){return null!==this.sa?"MapKeySetIterator@"+this.sa.value:"MapKeySetIterator"},d.Object.defineProperties(ht.prototype,{iterator:{get:function(){return this}},count:{get:function(){return this.ma.Sb}}}),ht.prototype.first=ht.prototype.first,ht.prototype.hasNext=ht.prototype.Ad,ht.prototype.next=ht.prototype.next,ht.prototype.reset=ht.prototype.reset,ht.className="MapKeySetIterator",c(lt,Z),(e=lt.prototype).freeze=function(){return this},e.ka=function(){return this},e.toString=function(){return"MapKeySet("+this.ma.toString()+")"},e.add=function(){w("This Set is read-only: "+this.toString())},e.contains=function(t){return this.ma.contains(t)},e.has=function(t){return this.contains(t)},e.remove=function(){w("This Set is read-only: "+this.toString())},e.delete=function(t){return this.remove(t)},e.clear=function(){w("This Set is read-only: "+this.toString())},e.first=function(){var t=this.ma.ea;return null!==t?t.key:null},lt.prototype.any=function(t){for(var e=this.ma.ea;null!==e;){if(t(e.key))return!0;e=e.va}return!1},lt.prototype.all=function(t){for(var e=this.ma.ea;null!==e;){if(!t(e.key))return!1;e=e.va}return!0},lt.prototype.each=function(t){for(var e=this.ma.ea;null!==e;)t(e.key),e=e.va;return this},lt.prototype.map=function(t){for(var e=new Z,i=this.ma.ea;null!==i;)e.add(t(i.key)),i=i.va;return e},lt.prototype.filter=function(t){for(var e=new Z,i=this.ma.ea;null!==i;){var n=i.key;t(n)&&e.add(n),i=i.va}return e},lt.prototype.copy=function(){return new lt(this.ma)},lt.prototype.Iv=function(){var t,e=new Z,i=this.ma.Tb;for(t in i)e.add(i[t].key);return e},lt.prototype.Fa=function(){var t,e=this.ma.Tb,i=Array(this.ma.Sb),n=0;for(t in e)i[n]=e[t].key,n++;return i},lt.prototype.Hv=function(){var t,e=new $,i=this.ma.Tb;for(t in i)e.add(i[t].key);return e},d.Object.defineProperties(lt.prototype,{count:{get:function(){return this.ma.Sb}},size:{get:function(){return this.ma.Sb}},iterator:{get:function(){return 0>=this.ma.Sb?q:new ht(this.ma)}}}),lt.prototype.toList=lt.prototype.Hv,lt.prototype.toArray=lt.prototype.Fa,lt.prototype.toSet=lt.prototype.Iv,lt.prototype.first=lt.prototype.first,lt.prototype.clear=lt.prototype.clear,lt.prototype.delete=lt.prototype.delete,lt.prototype.remove=lt.prototype.remove,lt.prototype.has=lt.prototype.has,lt.prototype.contains=lt.prototype.contains,lt.prototype.add=lt.prototype.add,lt.prototype.thaw=lt.prototype.ka,lt.prototype.freeze=lt.prototype.freeze,lt.className="MapKeySet",ut.prototype.reset=function(){var t=this.ma;t.jf=null,this.qa=t.Ja,this.sa=null},ut.prototype.next=function(){var t=this.ma;if(t.Ja!==this.qa&&null===this.key)return!1;var e=this.sa;return null!==(e=null===e?t.ea:e.va)?(this.sa=e,this.value=e.value,this.key=e.key,!0):(this.de(),!1)},ut.prototype.Ad=function(){return this.next()},ut.prototype.first=function(){var t=this.ma;if(this.qa=t.Ja,null!==(t=t.ea)){this.sa=t;var e=t.value;return this.key=t.key,this.value=e}return null},ut.prototype.any=function(t){var e=this.ma;for(this.sa=e.jf=null,e=e.ea;null!==e;){if(t(e.value))return!0;e=e.va}return!1},ut.prototype.all=function(t){var e=this.ma;for(this.sa=e.jf=null,e=e.ea;null!==e;){if(!t(e.value))return!1;e=e.va}return!0},ut.prototype.each=function(t){var e=this.ma;for(this.sa=e.jf=null,e=e.ea;null!==e;)t(e.value),e=e.va;return this},ut.prototype.map=function(t){var e=this.ma;this.sa=e.jf=null;var i=new $;for(e=e.ea;null!==e;)i.add(t(e.value)),e=e.va;return i.iterator},ut.prototype.filter=function(t){var e=this.ma;this.sa=e.jf=null;var i=new $;for(e=e.ea;null!==e;){var n=e.value;t(n)&&i.add(n),e=e.va}return i.iterator},ut.prototype.de=function(){this.value=this.key=null,this.qa=-1,this.ma.jf=this},ut.prototype.toString=function(){return null!==this.sa?"MapValueSetIterator@"+this.sa.value:"MapValueSetIterator"},d.Object.defineProperties(ut.prototype,{iterator:{get:function(){return this}},count:{get:function(){return this.ma.Sb}}}),ut.prototype.first=ut.prototype.first,ut.prototype.hasNext=ut.prototype.Ad,ut.prototype.next=ut.prototype.next,ut.prototype.reset=ut.prototype.reset,ut.className="MapValueSetIterator",ct.prototype.toString=function(){return"{"+this.key+":"+this.value+"}"},ct.className="KeyValuePair",dt.prototype.reset=function(){var t=this.ma;t.Sa=null,this.qa=t.Ja,this.sa=null},dt.prototype.next=function(){var t=this.ma;if(t.Ja!==this.qa&&null===this.key)return!1;var e=this.sa;return null!==(e=null===e?t.ea:e.va)?(this.sa=e,this.key=e.key,this.value=e.value,!0):(this.de(),!1)},dt.prototype.Ad=function(){return this.next()},dt.prototype.first=function(){var t=this.ma;return this.qa=t.Ja,null!==(t=t.ea)?(this.sa=t,this.key=t.key,this.value=t.value,t):null},dt.prototype.any=function(t){var e=this.ma;for(this.sa=e.Sa=null,e=e.ea;null!==e;){if(t(e))return!0;e=e.va}return!1},dt.prototype.all=function(t){var e=this.ma;for(this.sa=e.Sa=null,e=e.ea;null!==e;){if(!t(e))return!1;e=e.va}return!0},dt.prototype.each=function(t){var e=this.ma;for(this.sa=e.Sa=null,e=e.ea;null!==e;)t(e),e=e.va;return this},dt.prototype.map=function(t){var e=this.ma;this.sa=e.Sa=null;var i=new $;for(e=e.ea;null!==e;)i.add(t(e)),e=e.va;return i.iterator},dt.prototype.filter=function(t){var e=this.ma;this.sa=e.Sa=null;var i=new $;for(e=e.ea;null!==e;)t(e)&&i.add(e),e=e.va;return i.iterator},dt.prototype.de=function(){this.value=this.key=null,this.qa=-1,this.ma.Sa=this},dt.prototype.toString=function(){return null!==this.sa?"MapIterator@"+this.sa:"MapIterator"},d.Object.defineProperties(dt.prototype,{iterator:{get:function(){return this}},count:{get:function(){return this.ma.Sb}}}),dt.prototype.first=dt.prototype.first,dt.prototype.hasNext=dt.prototype.Ad,dt.prototype.next=dt.prototype.next,dt.prototype.reset=dt.prototype.reset,dt.className="MapIterator",(e=ft.prototype).xb=function(){var t=this.Ja;999999999<++t&&(t=0),this.Ja=t},e.freeze=function(){return this._isFrozen=!0,this},e.ka=function(){return this._isFrozen=!1,this},e.toString=function(){return"Map()#"+et(this)},e.add=function(t,e){this._isFrozen&&k(this,t);var i=t;C(t)&&(i=tt(t));var n=this.Tb[i];return void 0===n?(this.Sb++,t=new ct(t,e),this.Tb[i]=t,null===(i=this.kf)?this.ea=t:(t.ll=i,i.va=t),this.kf=t,this.xb()):n.value=e,this},e.set=function(t,e){return this.add(t,e)},e.addAll=function(t){if(null===t)return this;if(P(t))for(var e=t.length,i=0;i<e;i++){var n=t[i];this.add(n.key,n.value)}else if(t instanceof ft)for(t=t.iterator;t.next();)this.add(t.key,t.value);else for(t=t.iterator;t.next();)e=t.value,this.add(e.key,e.value);return this},e.first=function(){return this.ea},ft.prototype.any=function(t){for(var e=this.ea;null!==e;){if(t(e))return!0;e=e.va}return!1},ft.prototype.all=function(t){for(var e=this.ea;null!==e;){if(!t(e))return!1;e=e.va}return!0},ft.prototype.each=function(t){for(var e=this.ea;null!==e;)t(e),e=e.va;return this},ft.prototype.map=function(t){for(var e=new ft,i=this.ea;null!==i;)e.add(i.key,t(i)),i=i.va;return e},ft.prototype.filter=function(t){for(var e=new ft,i=this.ea;null!==i;)t(i)&&e.add(i.key,i.value),i=i.va;return e},(e=ft.prototype).contains=function(t){var e=t;return(!C(t)||void 0!==(e=et(t)))&&void 0!==this.Tb[e]},e.has=function(t){return this.contains(t)},e.I=function(t){var e=t;return C(t)&&void 0===(e=et(t))||void 0===(t=this.Tb[e])?null:t.value},e.get=function(t){return this.I(t)},e.remove=function(t){if(null===t)return!1;this._isFrozen&&k(this,t);var e=t;if(C(t)&&void 0===(e=et(t)))return!1;if(void 0===(t=this.Tb[e]))return!1;var i=t.va,n=t.ll;return null!==i&&(i.ll=n),null!==n&&(n.va=i),this.ea===t&&(this.ea=i),this.kf===t&&(this.kf=n),delete this.Tb[e],this.Sb--,this.xb(),!0},e.delete=function(t){return this.remove(t)},e.clear=function(){this._isFrozen&&k(this),this.Tb={},this.Sb=0,null!==this.Sa&&this.Sa.reset(),null!==this.jf&&this.jf.reset(),this.kf=this.ea=null,this.xb()},ft.prototype.copy=function(){var t,e=new ft,i=this.Tb;for(t in i){var n=i[t];e.add(n.key,n.value)}return e},ft.prototype.Fa=function(){var t,e=this.Tb,i=Array(this.Sb),n=0;for(t in e){var o=e[t];i[n]=new ct(o.key,o.value),n++}return i},ft.prototype.Lf=function(){return new lt(this)},d.Object.defineProperties(ft.prototype,{count:{get:function(){return this.Sb}},size:{get:function(){return this.Sb}},iterator:{get:function(){if(0>=this.count)return q;var t=this.Sa;return null!==t?(t.reset(),t):new dt(this)}},iteratorKeys:{get:function(){return 0>=this.count?q:new ht(this)}},iteratorValues:{get:function(){if(0>=this.count)return q;var t=this.jf;return null!==t?(t.reset(),t):new ut(this)}}}),ft.prototype.toKeySet=ft.prototype.Lf,ft.prototype.toArray=ft.prototype.Fa,ft.prototype.clear=ft.prototype.clear,ft.prototype.delete=ft.prototype.delete,ft.prototype.remove=ft.prototype.remove,ft.prototype.get=ft.prototype.get,ft.prototype.getValue=ft.prototype.I,ft.prototype.has=ft.prototype.has,ft.prototype.contains=ft.prototype.contains,ft.prototype.first=ft.prototype.first,ft.prototype.addAll=ft.prototype.addAll,ft.prototype.set=ft.prototype.set,ft.prototype.add=ft.prototype.add,ft.prototype.thaw=ft.prototype.ka,ft.prototype.freeze=ft.prototype.freeze,ft.className="Map",pt.prototype.assign=function(t){return this.x=t.x,this.y=t.y,this},pt.prototype.h=function(t,e){return this.x=t,this.y=e,this},pt.prototype.sg=function(t,e){return this.x=t,this.y=e,this},pt.prototype.set=function(t){return this.x=t.x,this.y=t.y,this},pt.prototype.copy=function(){var t=new pt;return t.x=this.x,t.y=this.y,t},(e=pt.prototype).ja=function(){return this._isFrozen=!0,Object.freeze(this),this},e.J=function(){return this._isFrozen||Object.isFrozen(this)?this:this.copy().freeze()},e.freeze=function(){return this._isFrozen=!0,this},e.ka=function(){return Object.isFrozen(this)&&w("cannot thaw constant: "+this),this._isFrozen=!1,this},e.toString=function(){return"Point("+this.x+","+this.y+")"},e.D=function(t){return t instanceof pt&&(this.x===t.x&&this.y===t.y)},e.hi=function(t,e){return this.x===t&&this.y===e},e.Xa=function(t){return Ye.B(this.x,t.x)&&Ye.B(this.y,t.y)},e.add=function(t){return this.x+=t.x,this.y+=t.y,this},e.re=function(t){return this.x-=t.x,this.y-=t.y,this},e.offset=function(t,e){return this.x+=t,this.y+=e,this},pt.prototype.rotate=function(t){if(0===t)return this;var e=this.x,i=this.y;if(0===e&&0===i)return this;if(360<=t?t-=360:0>t&&(t+=360),90===t){t=0;var n=1}else 180===t?(t=-1,n=0):270===t?(t=0,n=-1):(n=t*Math.PI/180,t=Math.cos(n),n=Math.sin(n));return this.x=t*e-n*i,this.y=n*e+t*i,this},(e=pt.prototype).scale=function(t,e){return this.x*=t,this.y*=e,this},e.Bf=function(t){var e=t.x-this.x;return e*e+(t=t.y-this.y)*t},e.zd=function(t,e){return(t-=this.x)*t+(e-=this.y)*e},e.normalize=function(){var t=this.x,e=this.y,i=Math.sqrt(t*t+e*e);return 0<i&&(this.x=t/i,this.y=e/i),this},e.ab=function(t){return yt(t.x-this.x,t.y-this.y)},e.direction=function(t,e){return yt(t-this.x,e-this.y)},e.Ry=function(t,e){return Ye.Fl(t.x,t.y,e.x,e.y,this.x,this.y)},e.fA=function(t,e,i,n){return Ye.qh(t,e,i,n,this.x,this.y,this),this},e.gA=function(t,e){return Ye.qh(t.x,t.y,e.x,e.y,this.x,this.y,this),this},e.uA=function(t,e,i,n){return Ye.No(this.x,this.y,t,e,i,n,this),this},e.vA=function(t,e){return Ye.No(this.x,this.y,t.x,t.y,e.width,e.height,this),this},e.xi=function(t,e){return this.x=t.x+e.x*t.width+e.offsetX,this.y=t.y+e.y*t.height+e.offsetY,this},e.yi=function(t,e,i,n,o){return this.x=t+o.x*i+o.offsetX,this.y=e+o.y*n+o.offsetY,this},e.transform=function(t){return t.Ga(this),this},e.w=function(){return isFinite(this.x)&&isFinite(this.y)},pt.alloc=function(){var t=Lt.pop();return void 0===t?new pt:t},pt.allocAt=function(t,e){var i=Lt.pop();return void 0===i?new pt(t,e):(i.x=t,i.y=e,i)},pt.free=function(t){Lt.push(t)},pt.prototype.isReal=pt.prototype.w,pt.prototype.setSpot=pt.prototype.yi,pt.prototype.setRectSpot=pt.prototype.xi,pt.prototype.snapToGridPoint=pt.prototype.vA,pt.prototype.snapToGrid=pt.prototype.uA,pt.prototype.projectOntoLineSegmentPoint=pt.prototype.gA,pt.prototype.projectOntoLineSegment=pt.prototype.fA,pt.intersectingLineSegments=function(t,e,i,n,o,r,s,a){return Ye.Rl(t,e,i,n,o,r,s,a)},pt.prototype.compareWithLineSegmentPoint=pt.prototype.Ry,pt.compareWithLineSegment=function(t,e,i,n,o,r){return Ye.Fl(t,e,i,n,o,r)},pt.prototype.direction=pt.prototype.direction,pt.prototype.directionPoint=pt.prototype.ab,pt.prototype.normalize=pt.prototype.normalize,pt.prototype.distanceSquared=pt.prototype.zd,pt.prototype.distanceSquaredPoint=pt.prototype.Bf,pt.prototype.scale=pt.prototype.scale,pt.prototype.rotate=pt.prototype.rotate,pt.prototype.offset=pt.prototype.offset,pt.prototype.subtract=pt.prototype.re,pt.prototype.add=pt.prototype.add,pt.prototype.equalsApprox=pt.prototype.Xa,pt.prototype.equalTo=pt.prototype.hi,pt.prototype.equals=pt.prototype.D,pt.prototype.set=pt.prototype.set,pt.prototype.setTo=pt.prototype.sg;var kt,St,Mt,Ct,Pt,Tt,Nt,Lt=[];function At(t,e){void 0===t?this.height=this.width=0:"number"==typeof t&&(0<=t||isNaN(t))&&"number"==typeof e&&(0<=e||isNaN(e))?(this.width=t,this.height=e):w("Invalid arguments to Size constructor: "+t+", "+e),this._isFrozen=!1}function Bt(t){if("string"==typeof t){t=t.split(" ");for(var e=0,i=0;""===t[e];)e++;var n=t[e++];n&&(i=parseFloat(n));for(var o=0;""===t[e];)e++;return(n=t[e++])&&(o=parseFloat(n)),new At(i,o)}return new At}function Dt(t){return t.width.toString()+" "+t.height.toString()}pt.className="Point",pt.parse=gt,pt.stringify=mt,pt.distanceLineSegmentSquared=xt,pt.distanceSquared=bt,pt.direction=wt,pt.Origin=it=new pt(0,0).ja(),pt.InfiniteTopLeft=nt=new pt(-1/0,-1/0).ja(),pt.InfiniteBottomRight=ot=new pt(1/0,1/0).ja(),pt.SixPoint=rt=new pt(6,6).ja(),pt.NoPoint=st=new pt(NaN,NaN).ja(),pt.parse=gt,pt.stringify=mt,pt.distanceLineSegmentSquared=xt,pt.distanceSquared=bt,pt.direction=wt,At.prototype.assign=function(t){return this.width=t.width,this.height=t.height,this},At.prototype.h=function(t,e){return this.width=t,this.height=e,this},At.prototype.sg=function(t,e){return this.width=t,this.height=e,this},At.prototype.set=function(t){return this.width=t.width,this.height=t.height,this},At.prototype.copy=function(){var t=new At;return t.width=this.width,t.height=this.height,t},(e=At.prototype).ja=function(){return this._isFrozen=!0,Object.freeze(this),this},e.J=function(){return this._isFrozen||Object.isFrozen(this)?this:this.copy().freeze()},e.freeze=function(){return this._isFrozen=!0,this},e.ka=function(){return Object.isFrozen(this)&&w("cannot thaw constant: "+this),this._isFrozen=!1,this},e.toString=function(){return"Size("+this.width+","+this.height+")"},e.D=function(t){return t instanceof At&&(this.width===t.width&&this.height===t.height)},e.hi=function(t,e){return this.width===t&&this.height===e},e.Xa=function(t){return Ye.B(this.width,t.width)&&Ye.B(this.height,t.height)},e.Bc=function(t,e){return t=this.width+t,this.width=0<=t?t:0,e=this.height+e,this.height=0<=e?e:0,this},e.w=function(){return isFinite(this.width)&&isFinite(this.height)},At.alloc=function(){var t=Ft.pop();return void 0===t?new At:t},At.free=function(t){Ft.push(t)},At.prototype.isReal=At.prototype.w,At.prototype.inflate=At.prototype.Bc,At.prototype.equalsApprox=At.prototype.Xa,At.prototype.equalTo=At.prototype.hi,At.prototype.equals=At.prototype.D,At.prototype.set=At.prototype.set,At.prototype.setTo=At.prototype.sg;var Ft=[];function jt(t,e,i,n){void 0===t?this.height=this.width=this.y=this.x=0:"number"==typeof t&&"number"==typeof e&&"number"==typeof i&&(0<=i||isNaN(i))&&"number"==typeof n&&(0<=n||isNaN(n))?(this.x=t,this.y=e,this.width=i,this.height=n):t instanceof pt?(i=t.x,t=t.y,e instanceof pt?(n=e.x,e=e.y,this.x=Math.min(i,n),this.y=Math.min(t,e),this.width=Math.abs(i-n),this.height=Math.abs(t-e)):e instanceof At?(this.x=i,this.y=t,this.width=e.width,this.height=e.height):w("Incorrect second argument supplied to Rect constructor "+e)):w("Invalid arguments to Rect constructor: "+t+", "+e+", "+i+", "+n),this._isFrozen=!1}function Et(t,e,i){t.width=e,t.height=i}function Ot(t){if("string"==typeof t){t=t.split(" ");for(var e=0,i=0;""===t[e];)e++;var n=t[e++];n&&(i=parseFloat(n));for(var o=0;""===t[e];)e++;(n=t[e++])&&(o=parseFloat(n));for(var r=0;""===t[e];)e++;(n=t[e++])&&(r=parseFloat(n));for(var s=0;""===t[e];)e++;return(n=t[e++])&&(s=parseFloat(n)),new jt(i,o,r,s)}return new jt}function It(t){return t.x.toString()+" "+t.y.toString()+" "+t.width.toString()+" "+t.height.toString()}function zt(t,e){return Ye.$(t.x,e.x)&&Ye.$(t.y,e.y)&&Ye.$(t.width,e.width)&&Ye.$(t.height,e.height)}function Rt(t,e,i,n,o){var r=t.width;return i+o<=-r?(t.x+=r/2,t.width=0):(t.x-=o,t.width+=i+o),e+n<=-(i=t.height)?(t.y+=i/2,t.height=0):(t.y-=e,t.height+=e+n),t}function Vt(t,e,i,n,o){var r=Math.max(t.x,e),s=Math.max(t.y,i);return e=Math.min(t.x+t.width,e+n),i=Math.min(t.y+t.height,i+o),t.x=r,t.y=s,t.width=Math.max(0,e-r),t.height=Math.max(0,i-s),t}function Gt(t,e){var i=t.width,n=t.x,o=e.x-10;return!(n>e.width+10+10+o||o>i+n)&&(i=t.height,t=t.y,n=e.y-10,!(t>e.height+10+10+n||n>i+t))}function Ht(t,e,i,n,o){var r=Math.min(t.x,e),s=Math.min(t.y,i);return e=Math.max(t.x+t.width,e+n),i=Math.max(t.y+t.height,i+o),t.x=r,t.y=s,t.width=e-r,t.height=i-s,t}function Yt(t,e,i,n,o,r,s,a){return void 0===s&&(s=0),void 0===a&&(a=0),t<=o&&o+s<=t+i&&e<=r&&r+a<=e+n}function Xt(t,e,i,n,o,r,s,a){return!(t>s+o||o>i+t)&&!(e>a+r||r>n+e)}At.className="Size",At.parse=Bt,At.stringify=Dt,At.ZeroSize=kt=new At(0,0).ja(),At.OneSize=St=new At(1,1).ja(),At.SixSize=Mt=new At(6,6).ja(),At.EightSize=Ct=new At(8,8).ja(),At.TenSize=Pt=new At(10,10).ja(),At.InfiniteSize=Tt=new At(1/0,1/0).ja(),At.NoSize=Nt=new At(NaN,NaN).ja(),At.parse=Bt,At.stringify=Dt,(e=jt.prototype).assign=function(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this},e.h=function(t,e,i,n){return this.x=t,this.y=e,this.width=i,this.height=n,this},e.sg=function(t,e,i,n){return this.x=t,this.y=e,this.width=i,this.height=n,this},e.set=function(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this},e.dd=function(t){return this.x=t.x,this.y=t.y,this},e.tA=function(t){return this.width=t.width,this.height=t.height,this},jt.prototype.copy=function(){var t=new jt;return t.x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,t},(e=jt.prototype).ja=function(){return this._isFrozen=!0,Object.freeze(this),this},e.J=function(){return this._isFrozen||Object.isFrozen(this)?this:this.copy().freeze()},e.freeze=function(){return this._isFrozen=!0,this},e.ka=function(){return Object.isFrozen(this)&&w("cannot thaw constant: "+this),this._isFrozen=!1,this},e.toString=function(){return"Rect("+this.x+","+this.y+","+this.width+","+this.height+")"},e.D=function(t){return t instanceof jt&&(this.x===t.x&&this.y===t.y&&this.width===t.width&&this.height===t.height)},e.hi=function(t,e,i,n){return this.x===t&&this.y===e&&this.width===i&&this.height===n},e.Xa=function(t){return Ye.B(this.x,t.x)&&Ye.B(this.y,t.y)&&Ye.B(this.width,t.width)&&Ye.B(this.height,t.height)},e.ca=function(t){return this.x<=t.x&&this.x+this.width>=t.x&&this.y<=t.y&&this.y+this.height>=t.y},e.Re=function(t){return this.x<=t.x&&t.x+t.width<=this.x+this.width&&this.y<=t.y&&t.y+t.height<=this.y+this.height},e.contains=function(t,e,i,n){return void 0===i&&(i=0),void 0===n&&(n=0),this.x<=t&&t+i<=this.x+this.width&&this.y<=e&&e+n<=this.y+this.height},e.offset=function(t,e){return this.x+=t,this.y+=e,this},e.Bc=function(t,e){return Rt(this,e,t,e,t)},e.Co=function(t){return Rt(this,t.top,t.right,t.bottom,t.left)},e.Fv=function(t){return Rt(this,-t.top,-t.right,-t.bottom,-t.left)},e.Hz=function(t,e,i,n){return Rt(this,t,e,i,n)},e.Ex=function(t){return Vt(this,t.x,t.y,t.width,t.height)},e.Uu=function(t,e,i,n){return Vt(this,t,e,i,n)},e.Yc=function(t){return this.Vu(t.x,t.y,t.width,t.height)},e.Vu=function(t,e,i,n){var o=this.width,r=this.x;return!(1/0!==o&&1/0!==i&&(o+=r,i+=t,isNaN(i)||isNaN(o)||r>i||t>o))&&(t=this.height,i=this.y,!(1/0!==t&&1/0!==n&&(t+=i,n+=e,isNaN(n)||isNaN(t)||i>n||e>t)))},e.Ye=function(t){return Ht(this,t.x,t.y,0,0)},e.ed=function(t){return Ht(this,t.x,t.y,t.width,t.height)},e.Kv=function(t,e,i,n){return void 0===i&&(i=0),void 0===n&&(n=0),Ht(this,t,e,i,n)},e.yi=function(t,e,i){return this.x=t-i.offsetX-i.x*this.width,this.y=e-i.offsetY-i.y*this.height,this},e.w=function(){return isFinite(this.x)&&isFinite(this.y)&&isFinite(this.width)&&isFinite(this.height)},e.Mz=function(){return 0===this.width&&0===this.height},jt.alloc=function(){var t=Wt.pop();return void 0===t?new jt:t},jt.allocAt=function(t,e,i,n){var o=Wt.pop();return void 0===o?new jt(t,e,i,n):o.h(t,e,i,n)},jt.free=function(t){Wt.push(t)},d.Object.defineProperties(jt.prototype,{left:{get:function(){return this.x},set:function(t){this.x=t}},top:{get:function(){return this.y},set:function(t){this.y=t}},right:{get:function(){return this.x+this.width},set:function(t){this.x+=t-(this.x+this.width)}},bottom:{get:function(){return this.y+this.height},set:function(t){this.y+=t-(this.y+this.height)}},position:{get:function(){return new pt(this.x,this.y)},set:function(t){this.x=t.x,this.y=t.y}},size:{get:function(){return new At(this.width,this.height)},set:function(t){this.width=t.width,this.height=t.height}},center:{get:function(){return new pt(this.x+this.width/2,this.y+this.height/2)},set:function(t){this.x=t.x-this.width/2,this.y=t.y-this.height/2}},centerX:{get:function(){return this.x+this.width/2},set:function(t){this.x=t-this.width/2}},centerY:{get:function(){return this.y+this.height/2},set:function(t){this.y=t-this.height/2}}}),jt.prototype.isEmpty=jt.prototype.Mz,jt.prototype.isReal=jt.prototype.w,jt.intersectsLineSegment=function(t,e,i,n,o,r,s,a){return Ye.Fx(t,e,i,n,o,r,s,a)},jt.prototype.setSpot=jt.prototype.yi,jt.prototype.union=jt.prototype.Kv,jt.prototype.unionRect=jt.prototype.ed,jt.prototype.unionPoint=jt.prototype.Ye,jt.prototype.intersects=jt.prototype.Vu,jt.prototype.intersectsRect=jt.prototype.Yc,jt.prototype.intersect=jt.prototype.Uu,jt.prototype.intersectRect=jt.prototype.Ex,jt.prototype.grow=jt.prototype.Hz,jt.prototype.subtractMargin=jt.prototype.Fv,jt.prototype.addMargin=jt.prototype.Co,jt.prototype.inflate=jt.prototype.Bc,jt.prototype.offset=jt.prototype.offset,jt.prototype.contains=jt.prototype.contains,jt.prototype.containsRect=jt.prototype.Re,jt.prototype.containsPoint=jt.prototype.ca,jt.prototype.equalsApprox=jt.prototype.Xa,jt.prototype.equalTo=jt.prototype.hi,jt.prototype.equals=jt.prototype.D,jt.prototype.setSize=jt.prototype.tA,jt.prototype.setPoint=jt.prototype.dd,jt.prototype.set=jt.prototype.set,jt.prototype.setTo=jt.prototype.sg;var Ut,qt,Wt=[];function Kt(t,e,i,n){void 0===t?this.left=this.bottom=this.right=this.top=0:void 0===e?this.left=this.bottom=this.right=this.top=t:void 0===i?(this.top=t,this.right=e,this.bottom=t,this.left=e):void 0!==n?(this.top=t,this.right=e,this.bottom=i,this.left=n):w("Invalid arguments to Margin constructor: "+t+", "+e+", "+i+", "+n),this._isFrozen=!1}function _t(t){if("string"==typeof t){t=t.split(" ");for(var e=0,i=NaN;""===t[e];)e++;var n=t[e++];if(n&&(i=parseFloat(n)),isNaN(i))return new Kt;for(var o=NaN;""===t[e];)e++;if((n=t[e++])&&(o=parseFloat(n)),isNaN(o))return new Kt(i);for(var r=NaN;""===t[e];)e++;if((n=t[e++])&&(r=parseFloat(n)),isNaN(r))return new Kt(i,o);for(var s=NaN;""===t[e];)e++;return(n=t[e++])&&(s=parseFloat(n)),isNaN(s)?new Kt(i,o):new Kt(i,o,r,s)}return new Kt}function $t(t){return t.top.toString()+" "+t.right.toString()+" "+t.bottom.toString()+" "+t.left.toString()}jt.className="Rect",jt.parse=Ot,jt.stringify=It,jt.contains=Yt,jt.intersects=Xt,jt.ZeroRect=Ut=new jt(0,0,0,0).ja(),jt.NoRect=qt=new jt(NaN,NaN,NaN,NaN).ja(),jt.parse=Ot,jt.stringify=It,jt.contains=Yt,jt.intersects=Xt,Kt.prototype.assign=function(t){return this.top=t.top,this.right=t.right,this.bottom=t.bottom,this.left=t.left,this},Kt.prototype.sg=function(t,e,i,n){return this.top=t,this.right=e,this.bottom=i,this.left=n,this},Kt.prototype.set=function(t){return this.top=t.top,this.right=t.right,this.bottom=t.bottom,this.left=t.left,this},Kt.prototype.copy=function(){var t=new Kt;return t.top=this.top,t.right=this.right,t.bottom=this.bottom,t.left=this.left,t},(e=Kt.prototype).ja=function(){return this._isFrozen=!0,Object.freeze(this),this},e.J=function(){return this._isFrozen||Object.isFrozen(this)?this:this.copy().freeze()},e.freeze=function(){return this._isFrozen=!0,this},e.ka=function(){return Object.isFrozen(this)&&w("cannot thaw constant: "+this),this._isFrozen=!1,this},e.toString=function(){return"Margin("+this.top+","+this.right+","+this.bottom+","+this.left+")"},e.D=function(t){return t instanceof Kt&&(this.top===t.top&&this.right===t.right&&this.bottom===t.bottom&&this.left===t.left)},e.hi=function(t,e,i,n){return this.top===t&&this.right===e&&this.bottom===i&&this.left===n},e.Xa=function(t){return Ye.B(this.top,t.top)&&Ye.B(this.right,t.right)&&Ye.B(this.bottom,t.bottom)&&Ye.B(this.left,t.left)},e.w=function(){return isFinite(this.top)&&isFinite(this.right)&&isFinite(this.bottom)&&isFinite(this.left)},Kt.alloc=function(){var t=Ee.pop();return void 0===t?new Kt:t},Kt.free=function(t){Ee.push(t)},Kt.prototype.isReal=Kt.prototype.w,Kt.prototype.equalsApprox=Kt.prototype.Xa,Kt.prototype.equalTo=Kt.prototype.hi,Kt.prototype.equals=Kt.prototype.D,Kt.prototype.set=Kt.prototype.set,Kt.prototype.setTo=Kt.prototype.sg;var Jt,Zt,Qt,te,ee,ie,ne,oe,re,se,ae,he,le,ue,ce,de,fe,pe,ge,me,ye,ve,xe,be,we,ke,Se,Me,Ce,Pe,Te,Ne,Le,Ae,Be,De,Fe,je,Ee=[];function Oe(t,e,i,n){void 0===t?this.offsetY=this.offsetX=this.y=this.x=0:(void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),this.x=t,this.y=e,this.offsetX=i,this.offsetY=n),this._isFrozen=!1}function Ie(t,e){return t.x=NaN,t.y=NaN,t.offsetX=e,t}function ze(t){if("string"==typeof t){if("None"===(t=t.trim()))return Qt;if("TopLeft"===t)return te;if("Top"===t||"TopCenter"===t||"MiddleTop"===t)return ee;if("TopRight"===t)return ie;if("Left"===t||"LeftCenter"===t||"MiddleLeft"===t)return ne;if("Center"===t)return oe;if("Right"===t||"RightCenter"===t||"MiddleRight"===t)return re;if("BottomLeft"===t)return se;if("Bottom"===t||"BottomCenter"===t||"MiddleBottom"===t)return ae;if("BottomRight"===t)return he;if("TopSide"===t)return le;if("LeftSide"===t)return ue;if("RightSide"===t)return ce;if("BottomSide"===t)return de;if("TopBottomSides"===t)return fe;if("LeftRightSides"===t)return pe;if("TopLeftSides"===t)return ge;if("TopRightSides"===t)return me;if("BottomLeftSides"===t)return ye;if("BottomRightSides"===t)return ve;if("NotTopSide"===t)return xe;if("NotLeftSide"===t)return be;if("NotRightSide"===t)return we;if("NotBottomSide"===t)return ke;if("AllSides"===t)return Se;if("Default"===t)return Me;t=t.split(" ");for(var e=0,i=0;""===t[e];)e++;var n=t[e++];void 0!==n&&0<n.length&&(i=parseFloat(n));for(var o=0;""===t[e];)e++;void 0!==(n=t[e++])&&0<n.length&&(o=parseFloat(n));for(var r=0;""===t[e];)e++;void 0!==(n=t[e++])&&0<n.length&&(r=parseFloat(n));for(var s=0;""===t[e];)e++;return void 0!==(n=t[e++])&&0<n.length&&(s=parseFloat(n)),new Oe(i,o,r,s)}return new Oe}function Re(t){return t.sb()?t.x.toString()+" "+t.y.toString()+" "+t.offsetX.toString()+" "+t.offsetY.toString():t.toString()}Kt.className="Margin",Kt.parse=_t,Kt.stringify=$t,Kt.ZeroMargin=Jt=new Kt(0,0,0,0).ja(),Kt.TwoMargin=Zt=new Kt(2,2,2,2).ja(),Kt.parse=_t,Kt.stringify=$t,Oe.prototype.assign=function(t){return this.x=t.x,this.y=t.y,this.offsetX=t.offsetX,this.offsetY=t.offsetY,this},Oe.prototype.sg=function(t,e,i,n){return this.x=t,this.y=e,this.offsetX=i,this.offsetY=n,this},Oe.prototype.set=function(t){return this.x=t.x,this.y=t.y,this.offsetX=t.offsetX,this.offsetY=t.offsetY,this},Oe.prototype.copy=function(){var t=new Oe;return t.x=this.x,t.y=this.y,t.offsetX=this.offsetX,t.offsetY=this.offsetY,t},(e=Oe.prototype).ja=function(){return this._isFrozen=!0,Object.freeze(this),this},e.J=function(){return this._isFrozen||Object.isFrozen(this)?this:this.copy().freeze()},e.freeze=function(){return this._isFrozen=!0,this},e.ka=function(){return Object.isFrozen(this)&&w("cannot thaw constant: "+this),this._isFrozen=!1,this},e.toString=function(){return this.sb()?0===this.offsetX&&0===this.offsetY?"Spot("+this.x+","+this.y+")":"Spot("+this.x+","+this.y+","+this.offsetX+","+this.offsetY+")":this.D(Qt)?"None":this.D(te)?"TopLeft":this.D(ee)?"Top":this.D(ie)?"TopRight":this.D(ne)?"Left":this.D(oe)?"Center":this.D(re)?"Right":this.D(se)?"BottomLeft":this.D(ae)?"Bottom":this.D(he)?"BottomRight":this.D(le)?"TopSide":this.D(ue)?"LeftSide":this.D(ce)?"RightSide":this.D(de)?"BottomSide":this.D(fe)?"TopBottomSides":this.D(pe)?"LeftRightSides":this.D(ge)?"TopLeftSides":this.D(me)?"TopRightSides":this.D(ye)?"BottomLeftSides":this.D(ve)?"BottomRightSides":this.D(xe)?"NotTopSide":this.D(be)?"NotLeftSide":this.D(we)?"NotRightSide":this.D(ke)?"NotBottomSide":this.D(Se)?"AllSides":this.D(Me)?"Default":"None"},e.D=function(t){return t instanceof Oe&&((this.x===t.x||isNaN(this.x)&&isNaN(t.x))&&(this.y===t.y||isNaN(this.y)&&isNaN(t.y))&&this.offsetX===t.offsetX&&this.offsetY===t.offsetY)},e.gv=function(){return new Oe(.5-(this.x-.5),.5-(this.y-.5),-this.offsetX,-this.offsetY)},e.Hf=function(t){if(!this.$c())return!1;if(!t.$c())if(t.D(Ce))t=ue;else if(t.D(Pe))t=ce;else if(t.D(Te))t=le;else{if(!t.D(Ne))return!1;t=de}return t=t.offsetY,(this.offsetY&t)===t},e.sb=function(){return!isNaN(this.x)&&!isNaN(this.y)},e.Mc=function(){return isNaN(this.x)||isNaN(this.y)},e.$c=function(){return isNaN(this.x)&&isNaN(this.y)&&1===this.offsetX&&0!==this.offsetY},e.ys=function(){return isNaN(this.x)&&isNaN(this.y)&&0===this.offsetX&&0===this.offsetY},e.Xb=function(){return isNaN(this.x)&&isNaN(this.y)&&-1===this.offsetX&&0===this.offsetY},Oe.alloc=function(){var t=Ve.pop();return void 0===t?new Oe:t},Oe.free=function(t){Ve.push(t)},Oe.prototype.isDefault=Oe.prototype.Xb,Oe.prototype.isNone=Oe.prototype.ys,Oe.prototype.isSide=Oe.prototype.$c,Oe.prototype.isNoSpot=Oe.prototype.Mc,Oe.prototype.isSpot=Oe.prototype.sb,Oe.prototype.includesSide=Oe.prototype.Hf,Oe.prototype.opposite=Oe.prototype.gv,Oe.prototype.equals=Oe.prototype.D,Oe.prototype.set=Oe.prototype.set,Oe.prototype.setTo=Oe.prototype.sg;var Ve=[];function Ge(){this.m11=1,this.m21=this.m12=0,this.m22=1,this.dy=this.dx=0}Oe.className="Spot",Oe.parse=ze,Oe.stringify=Re,Oe.None=Qt=Ie(new Oe(0,0,0,0),0).ja(),Oe.Default=Me=Ie(new Oe(0,0,-1,0),-1).ja(),Oe.TopLeft=te=new Oe(0,0,0,0).ja(),Oe.TopCenter=ee=new Oe(.5,0,0,0).ja(),Oe.TopRight=ie=new Oe(1,0,0,0).ja(),Oe.LeftCenter=ne=new Oe(0,.5,0,0).ja(),Oe.Center=oe=new Oe(.5,.5,0,0).ja(),Oe.RightCenter=re=new Oe(1,.5,0,0).ja(),Oe.BottomLeft=se=new Oe(0,1,0,0).ja(),Oe.BottomCenter=ae=new Oe(.5,1,0,0).ja(),Oe.BottomRight=he=new Oe(1,1,0,0).ja(),Oe.MiddleTop=Le=ee,Oe.MiddleLeft=Ae=ne,Oe.MiddleRight=Be=re,Oe.MiddleBottom=De=ae,Oe.Top=Te=ee,Oe.Left=Ce=ne,Oe.Right=Pe=re,Oe.Bottom=Ne=ae,Oe.TopSide=le=Ie(new Oe(0,0,1,1),1).ja(),Oe.LeftSide=ue=Ie(new Oe(0,0,1,2),1).ja(),Oe.RightSide=ce=Ie(new Oe(0,0,1,4),1).ja(),Oe.BottomSide=de=Ie(new Oe(0,0,1,8),1).ja(),Oe.TopBottomSides=fe=Ie(new Oe(0,0,1,9),1).ja(),Oe.LeftRightSides=pe=Ie(new Oe(0,0,1,6),1).ja(),Oe.TopLeftSides=ge=Ie(new Oe(0,0,1,3),1).ja(),Oe.TopRightSides=me=Ie(new Oe(0,0,1,5),1).ja(),Oe.BottomLeftSides=ye=Ie(new Oe(0,0,1,10),1).ja(),Oe.BottomRightSides=ve=Ie(new Oe(0,0,1,12),1).ja(),Oe.NotTopSide=xe=Ie(new Oe(0,0,1,14),1).ja(),Oe.NotLeftSide=be=Ie(new Oe(0,0,1,13),1).ja(),Oe.NotRightSide=we=Ie(new Oe(0,0,1,11),1).ja(),Oe.NotBottomSide=ke=Ie(new Oe(0,0,1,7),1).ja(),Oe.AllSides=Se=Ie(new Oe(0,0,1,15),1).ja(),Fe=new Oe(.156,.156).ja(),je=new Oe(.844,.844).ja(),Oe.parse=ze,Oe.stringify=Re,Ge.prototype.set=function(t){return this.m11=t.m11,this.m12=t.m12,this.m21=t.m21,this.m22=t.m22,this.dx=t.dx,this.dy=t.dy,this},Ge.prototype.setTransform=function(t,e,i,n,o,r){return this.m11=t,this.m12=e,this.m21=i,this.m22=n,this.dx=o,this.dy=r,this},Ge.prototype.copy=function(){var t=new Ge;return t.m11=this.m11,t.m12=this.m12,t.m21=this.m21,t.m22=this.m22,t.dx=this.dx,t.dy=this.dy,t},Ge.prototype.toString=function(){return"Transform("+this.m11+","+this.m12+","+this.m21+","+this.m22+","+this.dx+","+this.dy+")"},Ge.prototype.D=function(t){return this.m11===t.m11&&this.m12===t.m12&&this.m21===t.m21&&this.m22===t.m22&&this.dx===t.dx&&this.dy===t.dy},Ge.prototype.ws=function(){return 0===this.dx&&0===this.dy&&1===this.m11&&0===this.m12&&0===this.m21&&1===this.m22},Ge.prototype.reset=function(){return this.m11=1,this.m21=this.m12=0,this.m22=1,this.dy=this.dx=0,this},Ge.prototype.multiply=function(t){var e=this.m11*t.m11+this.m21*t.m12,i=this.m12*t.m11+this.m22*t.m12,n=this.m11*t.m21+this.m21*t.m22,o=this.m12*t.m21+this.m22*t.m22;return this.dx=this.m11*t.dx+this.m21*t.dy+this.dx,this.dy=this.m12*t.dx+this.m22*t.dy+this.dy,this.m11=e,this.m12=i,this.m21=n,this.m22=o,this},Ge.prototype.bv=function(t){var e=1/(t.m11*t.m22-t.m12*t.m21),i=t.m22*e,n=-t.m12*e,o=-t.m21*e,r=t.m11*e,s=e*(t.m21*t.dy-t.m22*t.dx);return t=e*(t.m12*t.dx-t.m11*t.dy),e=this.m11*i+this.m21*n,i=this.m12*i+this.m22*n,n=this.m11*o+this.m21*r,o=this.m12*o+this.m22*r,this.dx=this.m11*s+this.m21*t+this.dx,this.dy=this.m12*s+this.m22*t+this.dy,this.m11=e,this.m12=i,this.m21=n,this.m22=o,this},Ge.prototype.Vj=function(){var t=1/(this.m11*this.m22-this.m12*this.m21),e=-this.m12*t,i=-this.m21*t,n=this.m11*t,o=t*(this.m21*this.dy-this.m22*this.dx),r=t*(this.m12*this.dx-this.m11*this.dy);return this.m11=this.m22*t,this.m12=e,this.m21=i,this.m22=n,this.dx=o,this.dy=r,this},Ge.prototype.rotate=function(t,e,i){if(360<=t?t-=360:0>t&&(t+=360),0===t)return this;if(this.translate(e,i),90===t){t=0;var n=1}else 180===t?(t=-1,n=0):270===t?(t=0,n=-1):(n=t*Math.PI/180,t=Math.cos(n),n=Math.sin(n));var o=this.m12*t+this.m22*n,r=this.m11*-n+this.m21*t,s=this.m12*-n+this.m22*t;return this.m11=this.m11*t+this.m21*n,this.m12=o,this.m21=r,this.m22=s,this.translate(-e,-i),this},(e=Ge.prototype).translate=function(t,e){return this.dx+=this.m11*t+this.m21*e,this.dy+=this.m12*t+this.m22*e,this},e.scale=function(t,e){return void 0===e&&(e=t),this.m11*=t,this.m12*=t,this.m21*=e,this.m22*=e,this},e.Ga=function(t){var e=t.x,i=t.y;return t.h(e*this.m11+i*this.m21+this.dx,e*this.m12+i*this.m22+this.dy)},e.Cd=function(t){var e=1/(this.m11*this.m22-this.m12*this.m21),i=t.x,n=t.y;return t.h(i*this.m22*e+n*-this.m21*e+e*(this.m21*this.dy-this.m22*this.dx),i*-this.m12*e+n*this.m11*e+e*(this.m12*this.dx-this.m11*this.dy))},e.Eu=function(t){var e=1/(this.m11*this.m22-this.m12*this.m21),i=1.25*t.x,n=1.2*t.y;return t.h(i*this.m22*e+n*-this.m21*e+e*(this.m21*this.dy-this.m22*this.dx),i*-this.m12*e+n*this.m11*e+e*(this.m12*this.dx-this.m11*this.dy))},e.pp=function(t){var e=t.x,i=t.y,n=e+t.width,o=i+t.height,r=this.m11,s=this.m12,a=this.m21,h=this.m22,l=this.dx,u=this.dy,c=e*r+i*a+l,d=e*s+i*h+u,f=n*r+i*a+l,p=n*s+i*h+u;return i=e*r+o*a+l,e=e*s+o*h+u,r=n*r+o*a+l,n=n*s+o*h+u,o=Math.min(c,f),c=Math.max(c,f),f=Math.min(d,p),d=Math.max(d,p),o=Math.min(o,i),c=Math.max(c,i),f=Math.min(f,e),d=Math.max(d,e),o=Math.min(o,r),c=Math.max(c,r),f=Math.min(f,n),d=Math.max(d,n),t.h(o,f,c-o,d-f),t},Ge.alloc=function(){var t=He.pop();return void 0===t?new Ge:t},Ge.free=function(t){He.push(t)},Ge.prototype.transformRect=Ge.prototype.pp,Ge.prototype.transformPoint=Ge.prototype.Ga,Ge.prototype.scale=Ge.prototype.scale,Ge.prototype.translate=Ge.prototype.translate,Ge.prototype.rotate=Ge.prototype.rotate,Ge.prototype.invert=Ge.prototype.Vj,Ge.prototype.multiplyInverted=Ge.prototype.bv,Ge.prototype.multiply=Ge.prototype.multiply,Ge.prototype.reset=Ge.prototype.reset,Ge.prototype.isIdentity=Ge.prototype.ws,Ge.prototype.equals=Ge.prototype.D,Ge.prototype.setTransform=Ge.prototype.setTransform,Ge.prototype.set=Ge.prototype.set;var He=[];Ge.className="Transform",Ge.xF="54a702f3e53909c447824c6706603faf4c";var Ye={AA:"7da71ca0ad381e90",wg:(Math.sqrt(2)-1)/3*4,Uv:null,sqrt:function(t){if(0>=t)return 0;var e=Ye.Uv;if(null===e){e=[];for(var i=0;2e3>=i;i++)e[i]=Math.sqrt(i);Ye.Uv=e}return 1>t?2e3>=(i=1/t)?1/e[0|i]:Math.sqrt(t):2e3>=t?e[0|t]:Math.sqrt(t)},B:function(t,e){return.5>(t-=e)&&-.5<t},$:function(t,e){return 5e-8>(t-=e)&&-5e-8<t},Yb:function(t,e,i,n,o,r,s){if(0>=o&&(o=1e-6),t<i)var a=t,h=i;else a=i,h=t;if(e<n)var l=e,u=n;else l=n,u=e;if(t===i)return l<=s&&s<=u&&t-o<=r&&r<=t+o;if(e===n)return a<=r&&r<=h&&e-o<=s&&s<=e+o;if(h+=o,(a-=o)<=r&&r<=h&&(u+=o,(l-=o)<=s&&s<=u))if(h-a>u-l){if(!(t-i>o||i-t>o))return!0;if((r=(n-e)/(i-t)*(r-t)+e)-o<=s&&s<=r+o)return!0}else{if(!(e-n>o||n-e>o))return!0;if((s=(i-t)/(n-e)*(s-e)+t)-o<=r&&r<=s+o)return!0}return!1},cs:function(t,e,i,n,o,r,s,a,h,l,u,c){if(Ye.Yb(t,e,s,a,c,i,n)&&Ye.Yb(t,e,s,a,c,o,r))return Ye.Yb(t,e,s,a,c,l,u);var d=(t+i)/2,f=(e+n)/2,p=(i+o)/2,g=(n+r)/2,m=((n=(d+p)/2)+(p=(p+(o=(o+s)/2))/2))/2,y=((i=(f+g)/2)+(g=(g+(r=(r+a)/2))/2))/2;return Ye.cs(t,e,d,f,n,i,m,y,h,l,u,c)||Ye.cs(m,y,p,g,o,r,s,a,h,l,u,c)},ax:function(t,e,i,n,o,r,s,a,h){var l=(i+o)/2,u=(n+r)/2;return h.h((((t+i)/2+l)/2+(l+(o+s)/2)/2)/2,(((e+n)/2+u)/2+(u+(r+a)/2)/2)/2),h},My:function(t,e,i,n,o,r,s,a){var h=(i+o)/2,l=(n+r)/2;return wt(((t+i)/2+h)/2,((e+n)/2+l)/2,(h+(o+s)/2)/2,(l+(r+a)/2)/2)},Dl:function(t,e,i,n,o,r,s,a,h,l){if(Ye.Yb(t,e,s,a,h,i,n)&&Ye.Yb(t,e,s,a,h,o,r))Ht(l,t,e,0,0),Ht(l,s,a,0,0);else{var u=(t+i)/2,c=(e+n)/2,d=(i+o)/2,f=(n+r)/2,p=((n=(u+d)/2)+(d=(d+(o=(o+s)/2))/2))/2,g=((i=(c+f)/2)+(f=(f+(r=(r+a)/2))/2))/2;Ye.Dl(t,e,u,c,n,i,p,g,h,l),Ye.Dl(p,g,d,f,o,r,s,a,h,l)}return l},Qe:function(t,e,i,n,o,r,s,a,h,l){if(Ye.Yb(t,e,s,a,h,i,n)&&Ye.Yb(t,e,s,a,h,o,r))0===l.length&&(l.push(t),l.push(e)),l.push(s),l.push(a);else{var u=(t+i)/2,c=(e+n)/2,d=(i+o)/2,f=(n+r)/2,p=((n=(u+d)/2)+(d=(d+(o=(o+s)/2))/2))/2,g=((i=(c+f)/2)+(f=(f+(r=(r+a)/2))/2))/2;Ye.Qe(t,e,u,c,n,i,p,g,h,l),Ye.Qe(p,g,d,f,o,r,s,a,h,l)}return l},jv:function(t,e,i,n,o,r,s,a,h,l){if(Ye.Yb(t,e,o,r,l,i,n))return Ye.Yb(t,e,o,r,l,a,h);var u=(t+i)/2,c=(e+n)/2,d=(u+(i=(i+o)/2))/2,f=(c+(n=(n+r)/2))/2;return Ye.jv(t,e,u,c,d,f,s,a,h,l)||Ye.jv(d,f,i,n,o,r,s,a,h,l)},OA:function(t,e,i,n,o,r,s){return s.h(((t+i)/2+(i+o)/2)/2,((e+n)/2+(n+r)/2)/2),s},iv:function(t,e,i,n,o,r,s,a){if(Ye.Yb(t,e,o,r,s,i,n))Ht(a,t,e,0,0),Ht(a,o,r,0,0);else{var h=(t+i)/2,l=(e+n)/2,u=(h+(i=(i+o)/2))/2,c=(l+(n=(n+r)/2))/2;Ye.iv(t,e,h,l,u,c,s,a),Ye.iv(u,c,i,n,o,r,s,a)}return a},ep:function(t,e,i,n,o,r,s,a){if(Ye.Yb(t,e,o,r,s,i,n))0===a.length&&(a.push(t),a.push(e)),a.push(o),a.push(r);else{var h=(t+i)/2,l=(e+n)/2,u=(h+(i=(i+o)/2))/2,c=(l+(n=(n+r)/2))/2;Ye.ep(t,e,h,l,u,c,s,a),Ye.ep(u,c,i,n,o,r,s,a)}return a},Eo:function(t,e,i,n,o,r,s,a,h,l,u,c,d,f){if(Ye.Yb(t,e,s,a,d,i,n)&&Ye.Yb(t,e,s,a,d,o,r))return!!Ye.Rl(t,e,s,a,h,l,u,c)&&(0!=(d=(t-s)*(l-c)-(e-a)*(h-u))&&(f.h(((t*a-e*s)*(h-u)-(t-s)*(h*c-l*u))/d,((t*a-e*s)*(l-c)-(e-a)*(h*c-l*u))/d),!0));var p=(t+i)/2,g=(e+n)/2,m=(i+o)/2,y=(n+r)/2,v=((n=(p+m)/2)+(m=(m+(o=(o+s)/2))/2))/2,x=((i=(g+y)/2)+(y=(y+(r=(r+a)/2))/2))/2,b=1/0,w=!1,k=0,S=0;return Ye.Eo(t,e,p,g,n,i,v,x,h,l,u,c,d,f)&&((t=(f.x-h)*(f.x-h)+(f.y-l)*(f.y-l))<b&&(b=t,w=!0,k=f.x,S=f.y)),Ye.Eo(v,x,m,y,o,r,s,a,h,l,u,c,d,f)&&(f.x-h)*(f.x-h)+(f.y-l)*(f.y-l)<b&&(w=!0,k=f.x,S=f.y),w&&(f.x=k,f.y=S),w},Fo:function(t,e,i,n,o,r,s,a,h,l,u,c,d){var f=0;if(Ye.Yb(t,e,s,a,d,i,n)&&Ye.Yb(t,e,s,a,d,o,r)){if(0===(d=(t-s)*(l-c)-(e-a)*(h-u)))return f;var p=((t*a-e*s)*(h-u)-(t-s)*(h*c-l*u))/d,g=((t*a-e*s)*(l-c)-(e-a)*(h*c-l*u))/d;if(p>=u)return f;if((h>u?h-u:u-h)<(l>c?l-c:c-l)){if(e<a?(h=e,t=a):(h=a,t=e),g<h||g>t)return f}else if(t<s?(h=t,t=s):h=s,p<h||p>t)return f;0<d?f++:0>d&&f--}else{g=(e+n)/2;var m=(i+o)/2,y=(n+r)/2,v=((n=((p=(t+i)/2)+m)/2)+(m=(m+(o=(o+s)/2))/2))/2,x=((i=(g+y)/2)+(y=(y+(r=(r+a)/2))/2))/2;f+=Ye.Fo(t,e,p,g,n,i,v,x,h,l,u,c,d),f+=Ye.Fo(v,x,m,y,o,r,s,a,h,l,u,c,d)}return f},qh:function(t,e,i,n,o,r,s){return Ye.$(t,i)?(e<n?(i=e,e=n):i=n,r<i?(s.h(t,i),!1):r>e?(s.h(t,e),!1):(s.h(t,r),!0)):Ye.$(e,n)?(t<i?(n=t,t=i):n=i,o<n?(s.h(n,e),!1):o>t?(s.h(t,e),!1):(s.h(o,e),!0)):-5e-6>(o=((t-o)*(t-i)+(e-r)*(e-n))/((i-t)*(i-t)+(n-e)*(n-e)))?(s.h(t,e),!1):1.000005<o?(s.h(i,n),!1):(s.h(t+o*(i-t),e+o*(n-e)),!0)},Ve:function(t,e,i,n,o,r,s,a,h){return Ye.B(t,i)&&Ye.B(e,n)?(h.h(t,e),!1):Ye.$(o,s)?Ye.$(t,i)?(Ye.qh(t,e,i,n,o,r,h),!1):Ye.qh(t,e,i,n,o,(n-e)/(i-t)*(o-t)+e,h):(a=(a-r)/(s-o),Ye.$(t,i)?(i=a*(t-o)+r,e<n?(o=e,e=n):o=n,i<o?(h.h(t,o),!1):i>e?(h.h(t,e),!1):(h.h(t,i),!0)):(s=(n-e)/(i-t),Ye.$(a,s)?(Ye.qh(t,e,i,n,o,r,h),!1):(o=(s*t-a*o+r-e)/(s-a),Ye.$(s,0)?(t<i?(n=t,t=i):n=i,o<n?(h.h(n,e),!1):o>t?(h.h(t,e),!1):(h.h(o,e),!0)):Ye.qh(t,e,i,n,o,s*(o-t)+e,h))))},MA:function(t,e,i,n,o){return Ye.Ve(i.x,i.y,n.x,n.y,t.x,t.y,e.x,e.y,o)},KA:function(t,e,i,n,o,r,s,a,h,l){function u(i,n){var o=(i-t)*(i-t)+(n-e)*(n-e);o<c&&(c=o,h.h(i,n))}var c=1/0;u(h.x,h.y);var d=0,f=0,p=0,g=0;if(o<s?(d=o,f=s):(d=s,f=o),r<a?(p=o,g=s):(p=s,g=o),d=(f-d)/2+l,l=(g-p)/2+l,o=(o+s)/2,r=(r+a)/2,0===d||0===l)return h;if(.5>(i>t?i-t:t-i)){if(0>(d=1-(i-o)*(i-o)/(d*d)))return h;n=-l*(d=Math.sqrt(d))+r,u(i,l*d+r),u(i,n)}else{if(0>(d=(a=2*(i=(n-e)/(i-t))*(e-i*t)/(l*l)-2*i*r/(l*l)-2*o/(d*d))*a-4*(n=1/(d*d)+i*i/(l*l))*(2*i*t*r/(l*l)-2*e*r/(l*l)+r*r/(l*l)+o*o/(d*d)-1+(e-i*t)*(e-i*t)/(l*l))))return h;u(l=(-a+(d=Math.sqrt(d)))/(2*n),i*l-i*t+e),u(d=(-a-d)/(2*n),i*d-i*t+e)}return h},Ff:function(t,e,i,n,o,r,s,a,h){var l=1e21,u=t,c=e;if(Ye.Ve(t,e,t,n,o,r,s,a,h)){var d=(h.x-o)*(h.x-o)+(h.y-r)*(h.y-r);d<l&&(l=d,u=h.x,c=h.y)}return Ye.Ve(i,e,i,n,o,r,s,a,h)&&((d=(h.x-o)*(h.x-o)+(h.y-r)*(h.y-r))<l&&(l=d,u=h.x,c=h.y)),Ye.Ve(t,e,i,e,o,r,s,a,h)&&((e=(h.x-o)*(h.x-o)+(h.y-r)*(h.y-r))<l&&(l=e,u=h.x,c=h.y)),Ye.Ve(t,n,i,n,o,r,s,a,h)&&((t=(h.x-o)*(h.x-o)+(h.y-r)*(h.y-r))<l&&(l=t,u=h.x,c=h.y)),h.h(u,c),1e21>l},us:function(t,e,i){return Ye.Fx(t.x,t.y,t.width,t.height,e.x,e.y,i.x,i.y)},Fx:function(t,e,i,n,o,r,s,a){var h=t+i,l=e+n;return o===s?(r<a?(s=r,r=a):s=a,t<=o&&o<=h&&s<=l&&r>=e):r===a?(o<s?(a=o,o=s):a=s,e<=r&&r<=l&&a<=h&&o>=t):!!(Yt(t,e,i,n,o,r)||Yt(t,e,i,n,s,a)||Ye.Rl(t,e,h,e,o,r,s,a)||Ye.Rl(h,e,h,l,o,r,s,a)||Ye.Rl(h,l,t,l,o,r,s,a)||Ye.Rl(t,l,t,e,o,r,s,a))},Rl:function(t,e,i,n,o,r,s,a){return t===i&&e===n&&o===s&&r===a?t===o&&e===r:0>=Ye.Fl(t,e,i,n,o,r)*Ye.Fl(t,e,i,n,s,a)&&0>=Ye.Fl(o,r,s,a,t,e)*Ye.Fl(o,r,s,a,i,n)},Fl:function(t,e,i,n,o,r){return i-=t,0===(r=(t=o-t)*(n-=e)-(e=r-e)*i)&&(0<(r=t*i+e*n)&&(0>(r=(t-i)*i+(e-n)*n)&&(r=0))),r},bp:function(t){return 0>t&&(t+=360),360<=t&&(t-=360),t},jx:function(t,e,i,n,o,r){var s=Math.PI;r||(n*=s/180,o*=s/180);var a=n>o?-1:1;r=[];var h=s/2,l=n;if(1e-5>(n=Math.min(2*s,Math.abs(o-n))))return h=l+a*Math.min(n,h),a=t+i*Math.cos(l),l=e+i*Math.sin(l),t+=i*Math.cos(h),e+=i*Math.sin(h),i=(a+t)/2,h=(l+e)/2,r.push([a,l,i,h,i,h,t,e]),r;for(;1e-5<n;)o=l+a*Math.min(n,h),r.push(Ye.Vy(i,l,o,t,e)),n-=Math.abs(o-l),l=o;return r},Vy:function(t,e,i,n,o){var r=(i-e)/2,s=t*Math.cos(r),a=t*Math.sin(r),h=-a,l=s*s+h*h,u=l+s*s+h*a;return a=s-(l=4/3*(Math.sqrt(2*l*u)-u)/(s*a-h*s))*h,h=-(s=h+l*s),l=r+e,r=Math.cos(l),l=Math.sin(l),[n+t*Math.cos(e),o+t*Math.sin(e),n+a*r-s*l,o+a*l+s*r,n+a*r-h*l,o+a*l+h*r,n+t*Math.cos(i),o+t*Math.sin(i)]},No:function(t,e,i,n,o,r,s){var a=i=Math.floor((t-i)/o)*o+i;return i+o-t<o/2&&(a=i+o),t=n=Math.floor((e-n)/r)*r+n,n+r-e<r/2&&(t=n+r),s.h(a,t),s},vx:function(t,e){var i,n=Math.max(t,e);t=Math.min(t,e);do{e=n%t,n=i=t,t=e}while(0<e);return i},$y:function(t,e,i,n){var o=0>i,r=0>n;if(t<e)var s=1,a=0;else s=0,a=1;var h=0===s?t:e,l=0===s?i:n;return(0===s?o:r)&&(l=-l),i=0===(s=a)?i:n,(0===s?o:r)&&(i=-i),Ye.az(h,0===s?t:e,l,i,0,0)},az:function(t,e,i,n,o,r){if(0<n)if(0<i){o=t*t,t*=i;var s=e*n,a=-(r=e*e)+s,h=-r+Math.sqrt(t*t+s*s);e=a;for(var l=0;9999999999>l&&((e=.5*(a+h))!==a&&e!==h);++l){var u=t/(e+o),c=s/(e+r);if(0<(u=u*u+c*c-1))a=e;else{if(!(0>u))break;h=e}}i=o*i/(e+o)-i,n=r*n/(e+r)-n,i=Math.sqrt(i*i+n*n)}else i=Math.abs(n-e);else(r=t*i)<(n=t*t-e*e)?(n=r/n,r=e*Math.sqrt(Math.abs(1-n*n)),i=t*n-i,i=Math.sqrt(i*i+r*r)):i=Math.abs(i-t);return i},Ze:new Y,um:new Y,Mf:new Y,Nf:0,vm:100};function Xe(t){Q(this),this.l=2,void 0===t&&(t=Xe.o),this.na=t,this.Ec=this.Dc=this.pd=this.od=0,t===Xe.o?this.ee=new $:(null===Xe.V&&(Xe.V=(new $).freeze()),this.ee=Xe.V),this.aq=this.ee.Ja,this.Ip=(new jt).freeze(),this.ym=this.tk=null,this.zm=NaN,this.fg=te,this.gg=he,this.Rk=this.Sk=NaN,this.Uf=cs}function Ue(t,e){return t.type===Xe.j&&e.type===Xe.o&&!!(1===e.figures.count&&(e=e.figures.M(0),1===e.segments.count&&Ye.B(t.startX,e.startX)&&Ye.B(t.startY,e.startY)&&(e=e.segments.M(0),e.type===ni&&Ye.B(t.endX,e.endX)&&Ye.B(t.endY,e.endY))))}function qe(t,e,i){switch(t.type){case Xe.j:case Xe.u:case Xe.F:i?e.h(t.od,t.pd,0,0):Ht(e,t.od,t.pd,0,0),Ht(e,t.Dc,t.Ec,0,0);break;case Xe.o:var n=t.figures;t=n.s,n=n.length;for(var o=0;o<n;o++){var r=t[o];i&&0===o?e.h(r.startX,r.startY,0,0):Ht(e,r.startX,r.startY,0,0);for(var s=r.segments.s,a=s.length,h=r.startX,l=r.startY,u=0;u<a;u++){var c=s[u];switch(c.type){case ni:case ii:Ht(e,h=c.endX,l=c.endY,0,0);break;case oi:Ye.Dl(h,l,c.point1X,c.point1Y,c.point2X,c.point2Y,c.endX,c.endY,.5,e),h=c.endX,l=c.endY;break;case ri:Ye.iv(h,l,c.point1X,c.point1Y,c.endX,c.endY,.5,e),h=c.endX,l=c.endY;break;case si:case ai:var d=c.type===si?ti(c,r):ei(c,r,h,l),f=d.length;if(0===f){Ht(e,h=c.type===si?c.centerX:c.endX,l=c.type===si?c.centerY:c.endY,0,0);break}c=null;for(var p=0;p<f;p++)c=d[p],Ye.Dl(c[0],c[1],c[2],c[3],c[4],c[5],c[6],c[7],.5,e);null!==c&&(h=c[6],l=c[7]);break;default:w("Unknown Segment type: "+c.type)}}}break;default:w("Unknown Geometry type: "+t.type)}}function We(t,e,i,n,o){var r=e.x;e=e.y;for(var s,a,h,l,u=t.bounds.x-20,c=0,d=t.figures.s,f=d.length,p=0;p<f;p++){var g=d[p],m=!g.isEvenOdd;if(g.isFilled){if(n&&g.ca(r,e,i))return!0;for(var y=g.segments,v=s=g.startX,x=a=g.startY,b=y.s,k=0;k<=y.length;k++){var S=void 0;if(k!==y.length){var M=(S=b[k]).type;t=S.endX,l=S.endY}else M=ni,t=v,l=x;switch(M){case ii:if(v=Ke(r,e,u,e,s,a,v,x),isNaN(v))return!0;c+=v,v=t,x=l;break;case ni:if(s=Ke(r,e,u,e,s,a,t,l),isNaN(s))return!0;c+=s;break;case oi:c+=h=Ye.Fo(s,a,S.point1X,S.point1Y,S.point2X,S.point2Y,t,l,u,e,r,e,.5);break;case ri:c+=h=Ye.Fo(s,a,(s+2*S.point1X)/3,(a+2*S.point1Y)/3,(2*S.point1X+t)/3,(2*S.point1Y+l)/3,t,l,u,e,r,e,.5);break;case si:case ai:var C=(M=S.type===si?ti(S,g):ei(S,g,s,a)).length;if(0===C){if(s=Ke(r,e,u,e,s,a,S.type===si?S.centerX:S.endX,S.type===si?S.centerY:S.endY),isNaN(s))return!0;c+=s;break}S=null;for(var P=0;P<C;P++){if(S=M[P],0===P){if(h=Ke(r,e,u,e,s,a,S[0],S[1]),isNaN(h))return!0;c+=h}c+=h=Ye.Fo(S[0],S[1],S[2],S[3],S[4],S[5],S[6],S[7],u,e,r,e,.5)}null!==S&&(t=S[6],l=S[7]);break;default:w("Unknown Segment type: "+S.type)}s=t,a=l}if(m){if(0!==c)return!0}else if(0!=c%2)return!0;c=0}else if(g.ca(r,e,o?i:i+2))return!0}return!1}function Ke(t,e,i,n,o,r,s,a){if(Ye.Yb(o,r,s,a,.05,t,e))return NaN;var h=(t-i)*(r-a);if(0===h)return 0;var l=((t*n-e*i)*(o-s)-(t-i)*(o*a-r*s))/h;if(e=(t*n-e*i)*(r-a)/h,l>=t)return 0;if((o>s?o-s:s-o)<(r>a?r-a:a-r)){if(r<a){if(e<r||e>a)return 0}else if(e<a||e>r)return 0}else if(o<s){if(l<o||l>s)return 0}else if(l<s||l>o)return 0;return 0<h?1:-1}function _e(t,e,i,n){for(var o=(t=t.figures.s).length,r=0;r<o;r++)if(t[r].ca(e,i,n))return!0;return!1}function $e(t){if(null===t.tk){var e=t.tk=[],i=t.ym=[],n=[],o=[];if(t.type===Xe.j)n.push(t.startX),n.push(t.startY),n.push(t.endX),n.push(t.endY),e.push(n),o.push(Math.sqrt((t.startX-t.endX)*(t.startX-t.endX)+(t.startY-t.endY)*(t.startY-t.endY))),i.push(o);else if(t.type===Xe.u)n.push(t.startX),n.push(t.startY),n.push(t.endX),n.push(t.startY),n.push(t.endX),n.push(t.endY),n.push(t.startX),n.push(t.endY),n.push(t.startX),n.push(t.startY),e.push(n),o.push(Math.abs(t.startX-t.endX)),o.push(Math.abs(t.startY-t.endY)),o.push(Math.abs(t.startX-t.endX)),o.push(Math.abs(t.startY-t.endY)),i.push(o);else if(t.type===Xe.F){var r=new Ze;r.startX=t.endX,r.startY=(t.startY+t.endY)/2;var s=new Qe(si);if(s.startAngle=0,s.sweepAngle=360,s.centerX=(t.startX+t.endX)/2,s.centerY=(t.startY+t.endY)/2,s.radiusX=Math.abs(t.startX-t.endX)/2,s.radiusY=Math.abs(t.startY-t.endY)/2,r.add(s),0===(o=(t=ti(s,r)).length))n.push(s.centerX),n.push(s.centerY);else{s=r.startX,r=r.startY;for(var a=0;a<o;a++){var h=t[a];Ye.Qe(s,r,h[2],h[3],h[4],h[5],h[6],h[7],.5,n),s=h[6],r=h[7]}}e.push(n),i.push(Je(n))}else for(t=t.figures.iterator;t.next();){o=t.value,(n=[]).push(o.startX),n.push(o.startY),a=s=o.startX,h=r=o.startY;for(var l=o.segments.s,u=l.length,c=0;c<u;c++){var d=l[c];switch(d.type){case ii:4<=n.length&&(e.push(n),i.push(Je(n))),(n=[]).push(d.endX),n.push(d.endY),a=s=d.endX,h=r=d.endY;break;case ni:n.push(d.endX),n.push(d.endY),s=d.endX,r=d.endY;break;case oi:Ye.Qe(s,r,d.point1X,d.point1Y,d.point2X,d.point2Y,d.endX,d.endY,.5,n),s=d.endX,r=d.endY;break;case ri:Ye.ep(s,r,d.point1X,d.point1Y,d.endX,d.endY,.5,n),s=d.endX,r=d.endY;break;case si:var f=ti(d,o),p=f.length;if(0===p){n.push(d.centerX),n.push(d.centerY),s=d.centerX,r=d.centerY;break}for(var g=0;g<p;g++){var m=f[g];Ye.Qe(s,r,m[2],m[3],m[4],m[5],m[6],m[7],.5,n),s=m[6],r=m[7]}break;case ai:if(p=(f=ei(d,o,s,r)).length,g=d.endX,m=d.endY,0===p){n.push(g),n.push(m),s=g,r=m;break}for(g=0;g<p;g++)m=f[g],Ye.Qe(s,r,m[2],m[3],m[4],m[5],m[6],m[7],.5,n),s=m[6],r=m[7];break;default:w("Segment not of valid type: "+d.type)}d.isClosed&&(n.push(a),n.push(h))}4<=n.length&&(e.push(n),i.push(Je(n)))}}}function Je(t){for(var e=[],i=0,n=0,o=t.length,r=0;r<o;r+=2){var s=t[r],a=t[r+1];0!==r&&e.push(Math.sqrt(bt(i,n,s,a))),i=s,n=a}return e}function Ze(t,e,i,n,o){Q(this),void 0===i&&(i=!0),void 0===n&&(n=!0),void 0===o&&(o=!1),this.l=2|(i?4:0)|(n?8:0)|(o?16:0),this.od=void 0!==t?t:0,this.pd=void 0!==e?e:0,this.pl=new $,this.sr=this.pl.Ja,this.fw=null}function Qe(t,e,i,n,o,r,s,a){Q(this),void 0===t&&(t=ni),this.na=t,this.l=2,this.Dc=void 0!==e?e:0,this.Ec=void 0!==i?i:0,void 0===n&&(n=0),void 0===o&&(o=0),void 0===r&&(r=0),void 0===s&&(s=0),t===ai?(0>(t=r%360)&&(t+=360),this.Ne=t,this.Vh=0,this.Wh=Math.max(n,0),this.Pg=Math.max(o,0),"boolean"==typeof s?s&&(this.isLargeArc=!0):"number"==typeof s&&s&&(this.isLargeArc=!0),a&&(this.isClockwiseArc=!0)):(this.Ne=n,this.Vh=o,t===si&&(r=Math.max(r,0)),this.Wh=r,"number"==typeof s?(t===si&&(s=Math.max(s,0)),this.Pg=s):this.Pg=0),this.ae=null}function ti(t,e){if(null!==t.ae&&!1===e._isInvalidBounds)return t.ae;var i=t.radiusX,n=t.radiusY;if(void 0===n&&(n=i),0===i||0===n)return t.ae=[],t.ae;e=t.Ne;var o=t.Vh,r=Ye.jx(0,0,i<n?i:n,t.startAngle,t.startAngle+t.sweepAngle,!1);if(i!==n){var s=Ge.alloc();s.reset(),i<n?s.scale(1,n/i):s.scale(i/n,1),Xe.Ha(r,s),Ge.free(s)}for(i=r.length,n=0;n<i;n++)(s=r[n])[0]+=e,s[1]+=o,s[2]+=e,s[3]+=o,s[4]+=e,s[5]+=o,s[6]+=e,s[7]+=o;return t.ae=r,t.ae}function ei(t,e,i,n){function o(t,e,i,n){return(t*n<e*i?-1:1)*Math.acos((t*i+e*n)/(Math.sqrt(t*t+e*e)*Math.sqrt(i*i+n*n)))}if(null!==t.ae&&!1===e._isInvalidBounds)return t.ae;if(0===t.radiusX||0===t.radiusY)return t.ae=[],t.ae;e=t.Wh;var r=t.Pg;0===e&&(e=1e-4),0===r&&(r=1e-4);var s=Math.PI/180*t.Ne,a=t.isLargeArc,h=t.isClockwiseArc,l=t.Dc,u=t.Ec,c=Math.cos(s),d=Math.sin(s),f=c*(i-l)/2+d*(n-u)/2,p=f*f/(e*e)+(s=-d*(i-l)/2+c*(n-u)/2)*s/(r*r);return 1<p&&(e*=Math.sqrt(p),r*=Math.sqrt(p)),p=(a===h?-1:1)*Math.sqrt((e*e*r*r-e*e*s*s-r*r*f*f)/(e*e*s*s+r*r*f*f)),isNaN(p)&&(p=0),a=p*e*s/r,p=p*-r*f/e,isNaN(a)&&(a=0),isNaN(p)&&(p=0),i=(i+l)/2+c*a-d*p,n=(n+u)/2+d*a+c*p,u=o(1,0,(f-a)/e,(s-p)/r),s=o(c=(f-a)/e,l=(s-p)/r,f=(-f-a)/e,a=(-s-p)/r),-1>=(f=(c*f+l*a)/(Math.sqrt(c*c+l*l)*Math.sqrt(f*f+a*a)))?s=Math.PI:1<=f&&(s=0),!h&&0<s&&(s-=2*Math.PI),h&&0>s&&(s+=2*Math.PI),h=e>r?1:e/r,f=e>r?r/e:1,e=Ye.jx(0,0,e>r?e:r,u,u+s,!0),(r=Ge.alloc()).reset(),r.translate(i,n),r.rotate(t.Ne,0,0),r.scale(h,f),Xe.Ha(e,r),Ge.free(r),t.ae=e,t.ae}Ye.za=Ye.AA,Xe.prototype.copy=function(){var t=new Xe;if(t.l=-2&this.l,t.na=this.na,t.od=this.od,t.pd=this.pd,t.Dc=this.Dc,t.Ec=this.Ec,this.na===Xe.o){for(var e=this.ee.s,i=t.ee,n=0;n<e.length;n++)i.add(e[n].copy());t.ee=i}else t.ee=this.ee;return t.aq=this.aq,t.Ip.assign(this.Ip),t.tk=this.tk,t.ym=this.ym,t.zm=this.zm,t.fg=this.fg.J(),t.gg=this.gg.J(),t.Sk=this.Sk,t.Rk=this.Rk,t.Uf=this.Uf,t},Xe.prototype.ja=function(){return this.freeze(),Object.freeze(this),this},Xe.prototype.freeze=function(){if(this._isFrozen=!0,this.type!==Xe.o)return this;var t=this.figures;t.freeze();for(var e=(t=t.s).length,i=0;i<e;i++)t[i].freeze();return this},Xe.prototype.ka=function(){if(Object.isFrozen(this)&&w("cannot thaw constant: "+this),this._isFrozen=!1,this.type!==Xe.o)return this;var t=this.figures;t.ka();for(var e=(t=t.s).length,i=0;i<e;i++)t[i].ka();return this},Xe.prototype.Xa=function(t){if(!(t instanceof Xe))return!1;if(this.type!==t.type)return this.type===Xe.j&&t.type===Xe.o?Ue(this,t):t.type===Xe.j&&this.type===Xe.o&&Ue(t,this);if(this.type===Xe.o){var e=this.figures.s;t=t.figures.s;var i=e.length;if(i!==t.length)return!1;for(var n=0;n<i;n++)if(!e[n].Xa(t[n]))return!1;return!0}return Ye.B(this.startX,t.startX)&&Ye.B(this.startY,t.startY)&&Ye.B(this.endX,t.endX)&&Ye.B(this.endY,t.endY)},Xe.ia=function(t){return t.toString()},Xe.prototype.qb=function(t){t.classType===Xe&&(this.type=t)},Xe.prototype.toString=function(t){switch(void 0===t&&(t=-1),this.type){case Xe.j:return 0>t?"M"+this.startX.toString()+" "+this.startY.toString()+"L"+this.endX.toString()+" "+this.endY.toString():"M"+this.startX.toFixed(t)+" "+this.startY.toFixed(t)+"L"+this.endX.toFixed(t)+" "+this.endY.toFixed(t);case Xe.u:var e=new jt(this.startX,this.startY,0,0);return e.Kv(this.endX,this.endY,0,0),0>t?"M"+e.x.toString()+" "+e.y.toString()+"H"+e.right.toString()+"V"+e.bottom.toString()+"H"+e.left.toString()+"z":"M"+e.x.toFixed(t)+" "+e.y.toFixed(t)+"H"+e.right.toFixed(t)+"V"+e.bottom.toFixed(t)+"H"+e.left.toFixed(t)+"z";case Xe.F:if((e=new jt(this.startX,this.startY,0,0)).Kv(this.endX,this.endY,0,0),0>t)return"M"+(t=e.left.toString()+" "+(e.y+e.height/2).toString())+"A"+(e.width/2).toString()+" "+(e.height/2).toString()+" 0 0 1 "+e.right.toString()+" "+(e.y+e.height/2).toString()+"A"+(e.width/2).toString()+" "+(e.height/2).toString()+" 0 0 1 "+t;var i=e.left.toFixed(t)+" "+(e.y+e.height/2).toFixed(t);return"M"+i+"A"+(e.width/2).toFixed(t)+" "+(e.height/2).toFixed(t)+" 0 0 1 "+e.right.toFixed(t)+" "+(e.y+e.height/2).toFixed(t)+"A"+(e.width/2).toFixed(t)+" "+(e.height/2).toFixed(t)+" 0 0 1 "+i;case Xe.o:e="";for(var n=(i=this.figures.s).length,o=0;o<n;o++){var r=i[o];0<o&&(e+=" x "),r.isFilled&&(e+="F "),e+=r.toString(t)}return e;default:return this.type.toString()}},Xe.nb=function(t){for(var e=(t=t.split(/[Xx]/)).length,i="",n=0;n<e;n++){var o=t[n];i=null!==o.match(/[Ff]/)?0===n?i+o:i+"X"+(" "===o[0]?"":" ")+o:i+(0===n?"":"X ")+"F"+(" "===o[0]?"":" ")+o}return i},Xe.parse=function(t,e){function i(){return g>=b-1||null!==l[g+1].match(w)}function n(){return g++,l[g]}function o(t){var e=parseFloat(n()),i=parseFloat(n());m===m.toLowerCase()&&(e=x.x+e,i=x.y+i),t.h(e,i)}function r(){return o(x),x}function s(){return o(v),v}function a(){var t=y.toLowerCase();return"c"!==t&&"s"!==t&&"q"!==t&&"t"!==t?x:new pt(2*x.x-v.x,2*x.y-v.y)}void 0===e&&(e=!1);var h=/([UuBbMmZzLlHhVvCcSsQqTtAaFfXx])([UuBbMmZzLlHhVvCcSsQqTtAaFfXx])/gm,l=(t=(t=(t=(t=(t=(t=(t=(t=t.replace(/,/gm," ")).replace(h,"$1 $2")).replace(h,"$1 $2")).replace(/([UuBbMmZzLlHhVvCcSsQqTtAaFfXx])([^s])/gm,"$1 $2")).replace(/([^s])([UuBbMmZzLlHhVvCcSsQqTtAaFfXx])/gm,"$1 $2")).replace(/([0-9])([+\-])/gm,"$1 $2")).replace(/[\s\r\t\n]+/gm," ")).replace(/^\s+|\s+$/g,"")).split(" ");for(t=0;t<l.length;t++){var u=l[t];if(null!==u.match(/(\.[0-9]*)(\.)/gm)){h=A();for(var c="",d=!1,f=0;f<u.length;f++){var p=u[f];"."!==p||d?"."===p?(h.push(c),c="."):c+=p:(d=!0,c+=p)}for(h.push(c),l.splice(t,1),u=0;u<h.length;u++)l.splice(t+u,0,h[u]);t+=h.length-1,B(h)}}var g=-1,m="",y="";h=new pt(0,0);var v=new pt(0,0),x=new pt(0,0),b=l.length;t=vu(null),d=c=u=!1,f=!0,p=null;for(var w=/[UuBbMmZzLlHhVvCcSsQqTtAaFfXx]/;!(g>=b-1);)if(y=m,""!==(m=n()))switch(m.toUpperCase()){case"X":f=!0,c=u=!1;break;case"M":for(p=r(),null===t.mc||!0===f?(fu(t,p.x,p.y,u,!c,d),f=!1):t.moveTo(p.x,p.y),h.assign(x);!i();)p=r(),t.lineTo(p.x,p.y);break;case"L":for(;!i();)p=r(),t.lineTo(p.x,p.y);break;case"H":for(;!i();)x=new pt((m===m.toLowerCase()?x.x:0)+parseFloat(n()),x.y),t.lineTo(x.x,x.y);break;case"V":for(;!i();)x=new pt(x.x,(m===m.toLowerCase()?x.y:0)+parseFloat(n())),t.lineTo(x.x,x.y);break;case"C":for(;!i();){o(p=new pt);var k=s(),S=r();gu(t,p.x,p.y,k.x,k.y,S.x,S.y)}break;case"S":for(;!i();)p=a(),k=s(),S=r(),gu(t,p.x,p.y,k.x,k.y,S.x,S.y);break;case"Q":for(;!i();)p=s(),k=r(),mu(t,p.x,p.y,k.x,k.y);break;case"T":for(;!i();)v=p=a(),k=r(),mu(t,p.x,p.y,k.x,k.y);break;case"B":for(;!i();){p=parseFloat(n()),k=parseFloat(n()),S=parseFloat(n());var M=parseFloat(n()),C=parseFloat(n()),P=C,T=!1;i()||(P=parseFloat(n()),i()||(T=0!==parseFloat(n()))),m===m.toLowerCase()&&(S+=x.x,M+=x.y),t.arcTo(p,k,S,M,C,P,T)}break;case"A":for(;!i();)p=Math.abs(parseFloat(n())),k=Math.abs(parseFloat(n())),S=parseFloat(n()),C=M=!1,T=P=0,1===(P=n()).length?(M=!!parseFloat(P),C=!!parseFloat(n()),P=parseFloat(n())):2===P.length?(M=!!parseFloat(P[0]),C=!!parseFloat(P[1]),P=parseFloat(n())):(M=!!parseFloat(P[0]),C=!!parseFloat(P[1]),P=parseFloat(P.slice(2))),T=parseFloat(n()),m===m.toLowerCase()&&(P=x.x+P,T=x.y+T),x.h(P,T),yu(t,p,k,S,M,C,P,T);break;case"Z":pu(t),x.assign(h);break;case"F":for(p="",k=1;l[g+k];)if("0"===l[g+k])d=!0,k++;else if(null!==l[g+k].match(/[Uu]/))k++;else{if(null!==l[g+k].match(w)){p=l[g+k];break}k++}p.match(/[Mm]/)?u=!0:0<t.mc.segments.length&&(t.mc.isFilled=!0);break;case"U":for(p="",k=1;l[g+k];)if(null!==l[g+k].match(/[Ff]/))k++;else{if(null!==l[g+k].match(w)){p=l[g+k];break}k++}p.match(/[Mm]/)?c=!0:t.mc.isShadowed=!1}if(h=t.os,xu=t,e)for(e=h.figures.iterator;e.next();)e.value.isFilled=!0;return h},Xe.Ha=function(t,e){for(var i=t.length,n=pt.alloc(),o=0;o<i;o++){var r=t[o];n.x=r[0],n.y=r[1],e.Ga(n),r[0]=n.x,r[1]=n.y,n.x=r[2],n.y=r[3],e.Ga(n),r[2]=n.x,r[3]=n.y,n.x=r[4],n.y=r[5],e.Ga(n),r[4]=n.x,r[5]=n.y,n.x=r[6],n.y=r[7],e.Ga(n),r[6]=n.x,r[7]=n.y}pt.free(n)},Xe.prototype.Zu=function(){if(this._isInvalidBounds)return!0;if(this.type===Xe.o){if(this.aq!==this.figures.Ja)return!0;for(var t=this.figures.s,e=t.length,i=0;i<e;i++)if(t[i].Zu())return!0}return!1},Xe.prototype.computeBounds=function(){if(this._isInvalidBounds=!1,this.ym=this.tk=null,this.zm=NaN,this.type===Xe.o){this.aq=this.figures.Ja;for(var t=this.figures.s,e=t.length,i=0;i<e;i++){var n=t[i];n._isInvalidBounds=!1;var o=n.segments;n.sr=o.Ja,o=(n=o.s).length;for(var r=0;r<o;r++){var s=n[r];s._isInvalidBounds=!1,s.ae=null}}}(t=this.Ip).ka(),isNaN(this.Sk)||isNaN(this.Rk)?t.h(0,0,0,0):t.h(0,0,this.Sk,this.Rk),qe(this,t,!1),Ht(t,0,0,0,0),t.freeze()},Xe.prototype.ix=function(){var t=new jt;return qe(this,t,!0),t},Xe.prototype.normalize=function(){this._isFrozen&&k(this);var t=this.ix();return this.offset(-t.x,-t.y),new pt(-t.x,-t.y)},Xe.prototype.offset=function(t,e){return this._isFrozen&&k(this),this.transform(1,0,0,1,t,e),this},Xe.prototype.scale=function(t,e){return this._isFrozen&&k(this),this.transform(t,0,0,e,0,0),this},Xe.prototype.rotate=function(t,e,i){this._isFrozen&&k(this),void 0===e&&(e=0),void 0===i&&(i=0);var n=Ge.alloc();return n.reset(),n.rotate(t,e,i),this.transform(n.m11,n.m12,n.m21,n.m22,n.dx,n.dy),Ge.free(n),this},(e=Xe.prototype).transform=function(t,e,i,n,o,r){switch(this.type){case Xe.j:case Xe.u:case Xe.F:var s=this.od,a=this.pd;this.od=s*t+a*i+o,this.pd=s*e+a*n+r,s=this.Dc,a=this.Ec,this.Dc=s*t+a*i+o,this.Ec=s*e+a*n+r;break;case Xe.o:for(var h=this.figures.s,l=h.length,u=0;u<l;u++){var c=h[u];s=c.startX,a=c.startY,c.startX=s*t+a*i+o,c.startY=s*e+a*n+r;for(var d=(c=c.segments.s).length,f=0;f<d;f++){var p=c[f];switch(p.type){case ni:case ii:s=p.endX,a=p.endY,p.endX=s*t+a*i+o,p.endY=s*e+a*n+r;break;case oi:s=p.point1X,a=p.point1Y,p.point1X=s*t+a*i+o,p.point1Y=s*e+a*n+r,s=p.point2X,a=p.point2Y,p.point2X=s*t+a*i+o,p.point2Y=s*e+a*n+r,s=p.endX,a=p.endY,p.endX=s*t+a*i+o,p.endY=s*e+a*n+r;break;case ri:s=p.point1X,a=p.point1Y,p.point1X=s*t+a*i+o,p.point1Y=s*e+a*n+r,s=p.endX,a=p.endY,p.endX=s*t+a*i+o,p.endY=s*e+a*n+r;break;case si:s=p.centerX,a=p.centerY,p.centerX=s*t+a*i+o,p.centerY=s*e+a*n+r,0!==e&&(0>(s=180*Math.atan2(e,t)/Math.PI)&&(s+=360),p.startAngle+=s),0>t&&(p.startAngle=180-p.startAngle,p.sweepAngle=-p.sweepAngle),0>n&&(p.startAngle=-p.startAngle,p.sweepAngle=-p.sweepAngle),p.radiusX*=Math.sqrt(t*t+i*i),void 0!==p.radiusY&&(p.radiusY*=Math.sqrt(e*e+n*n));break;case ai:if(s=p.endX,a=p.endY,p.endX=s*t+a*i+o,p.endY=s*e+a*n+r,0===p.radiusX||0===p.radiusY)break;0!==e&&(0>(s=180*Math.atan2(e,t)/Math.PI)&&(s+=360),p.xAxisRotation+=s),0>t&&(p.xAxisRotation=180-p.xAxisRotation,p.isClockwiseArc=!p.isClockwiseArc),0>n&&(p.xAxisRotation=-p.xAxisRotation,p.isClockwiseArc=!p.isClockwiseArc),p.radiusX*=Math.sqrt(t*t+i*i),p.radiusY*=Math.sqrt(e*e+n*n);break;default:w("Unknown Segment type: "+p.type)}}}}return this._isInvalidBounds=!0,this},e.ca=function(t,e){void 0===e&&(e=0);var i=this.od,n=this.pd,o=this.Dc,r=this.Ec;switch(this.type){case Xe.j:return Ye.Yb(i,n,o,r,e,t.x,t.y);case Xe.u:var s=jt.allocAt(Math.min(i,o)-e,Math.min(n,r)-e,Math.abs(o-i)+2*e,Math.abs(r-n)+2*e);return t=s.ca(t),jt.free(s),t;case Xe.F:s=Math.min(i,o)-e;var a=Math.min(n,r)-e;return i=(Math.abs(o-i)+2*e)/2,e=(Math.abs(r-n)+2*e)/2,0>=i||0>=e?!1:1>=(s=t.x-(s+i))*s/(i*i)+(a=t.y-(a+e))*a/(e*e);case Xe.o:return We(this,t,e,!0,!1);default:return!1}},e.Pu=function(t,e){if(0>t?t=0:1<t&&(t=1),void 0===e&&(e=new pt),this.type===Xe.j)return e.h(this.startX+t*(this.endX-this.startX),this.startY+t*(this.endY-this.startY)),e;for(var i=this.flattenedSegments,n=this.flattenedLengths,o=i.length,r=this.flattenedTotalLength*t,s=0,a=0;a<o;a++){var h=n[a],l=h.length;for(t=0;t<l;t++){var u=h[t];if(s+u>=r)return n=r-s,n=0===u?0:n/u,a=(i=i[a])[2*t],o=i[2*t+1],e.h(a+(i[2*t+2]-a)*n,o+(i[2*t+3]-o)*n),e;s+=u}}return e},e.wx=function(t){if(0>t?t=0:1<t&&(t=1),this.type===Xe.j)return 180*Math.atan2(this.endY-this.startY,this.endX-this.startX)/Math.PI;for(var e=this.flattenedSegments,i=this.flattenedLengths,n=e.length,o=this.flattenedTotalLength*t,r=0,s=0;s<n;s++){var a=i[s],h=a.length;for(t=0;t<h;t++){var l=a[t];if(r+l>=o)return e=(o=e[s])[2*t],i=o[2*t+1],n=o[2*t+2],t=o[2*t+3],1>Math.abs(n-e)&&1>Math.abs(t-i)?0:1>Math.abs(n-e)?0<=t-i?90:270:1>Math.abs(t-i)?0<=n-e?0:180:180*Math.atan2(t-i,n-e)/Math.PI;r+=l}}return NaN},e.Qu=function(t,e){if(0>t?t=0:1<t&&(t=1),void 0===e&&(e=[]),e.length=3,this.type===Xe.j)return e[0]=this.startX+t*(this.endX-this.startX),e[1]=this.startY+t*(this.endY-this.startY),e[2]=180*Math.atan2(this.endY-this.startY,this.endX-this.startX)/Math.PI,e;for(var i=this.flattenedSegments,n=this.flattenedLengths,o=i.length,r=this.flattenedTotalLength*t,s=0,a=0;a<o;a++){var h=n[a],l=h.length;for(t=0;t<l;t++){var u=h[t];if(s+u>=r)return n=r-s,n=0===u?0:n/u,i=(u=i[a])[2*t],a=u[2*t+1],o=u[2*t+2],t=u[2*t+3],e[0]=i+(o-i)*n,e[1]=a+(t-a)*n,e[2]=1>Math.abs(o-i)&&1>Math.abs(t-a)?0:1>Math.abs(o-i)?0<=t-a?90:270:1>Math.abs(t-a)?0<=o-i?0:180:180*Math.atan2(t-a,o-i)/Math.PI,e;s+=u}}return e},e.xx=function(t){if(this.type===Xe.j){var e=this.startX,i=this.startY,n=this.endX,o=this.endY;if(e!==n||i!==o){var r=t.x;if(t=t.y,e===n){if(i<o){var s=i;n=o}else s=o,n=i;return t<=s?s===i?0:1:t>=n?n===i?0:1:Math.abs(t-i)/(n-s)}if(i===o)return e<n?s=e:(s=n,n=e),r<=s?s===e?0:1:r>=n?n===e?0:1:Math.abs(r-e)/(n-s);s=(n-e)*(n-e)+(o-i)*(o-i);var a=pt.alloc();return Ye.qh(e,i,n,o,r,t,a),t=a.x,r=a.y,pt.free(a),Math.sqrt(((t-e)*(t-e)+(r-i)*(r-i))/s)}}else{if(this.type!==Xe.u){e=this.flattenedSegments,i=this.flattenedLengths,r=this.flattenedTotalLength,n=pt.alloc(),o=1/0,a=s=0,y=e.length;for(var h=v=0,l=0;l<y;l++)for(var u=e[l],c=i[l],d=u.length,f=0;f<d;f+=2){var p=u[f],g=u[f+1];if(0!==f){Ye.qh(v,h,p,g,t.x,t.y,n);var m=(n.x-t.x)*(n.x-t.x)+(n.y-t.y)*(n.y-t.y);m<o&&(o=m,s=a,s+=Math.sqrt((n.x-v)*(n.x-v)+(n.y-h)*(n.y-h))),a+=c[(f-2)/2]}v=p,h=g}return pt.free(n),0>(t=s/r)?0:1<t?1:t}s=this.startX,a=this.startY;var y=this.endX;if(o=this.endY,s!==y||a!==o){r=2*(e=y-s)+2*(i=o-a),n=t.x,t=t.y,n=Math.min(Math.max(n,s),y),t=Math.min(Math.max(t,a),o),s=Math.abs(n-s),y=Math.abs(n-y),a=Math.abs(t-a),o=Math.abs(t-o);var v=Math.min(s,y,a,o);if(v===a)return n/r;if(v===y)return(e+t)/r;if(v===o)return(2*e+i-n)/r;if(v===s)return(2*e+2*i-t)/r}}return 0},e.add=function(t){return this.ee.add(t),this},e.pm=function(t,e,i,n,o,r,s,a){return this._isFrozen&&k(this),this.fg=new Oe(t,e,o,r).freeze(),this.gg=new Oe(i,n,s,a).freeze(),this},d.Object.defineProperties(Xe.prototype,{_isFrozen:{get:function(){return 0!=(1&this.l)},set:function(t){this.l=t?1|this.l:-2&this.l}},_isInvalidBounds:{get:function(){return 0!=(2&this.l)},set:function(t){this.l=t?2|this.l:-3&this.l}},flattenedSegments:{get:function(){return $e(this),this.tk}},flattenedLengths:{get:function(){return $e(this),this.ym}},flattenedTotalLength:{get:function(){var t=this.zm;if(isNaN(t)){if(this.type===Xe.j){t=Math.abs(this.endX-this.startX);var e=Math.abs(this.endY-this.startY);t=Math.sqrt(t*t+e*e)}else if(this.type===Xe.u)t=2*Math.abs(this.endX-this.startX)+2*Math.abs(this.endY-this.startY);else for(var i=(e=this.flattenedLengths).length,n=t=0;n<i;n++)for(var o=e[n],r=o.length,s=0;s<r;s++)t+=o[s];this.zm=t}return t}},type:{get:function(){return this.na},set:function(t){this.na!==t&&(this._isFrozen&&k(this,t),this.na=t,t===Xe.o?this.ee=new $:(null===Xe.V&&(Xe.V=(new $).freeze()),this.ee=Xe.V),this._isInvalidBounds=!0)}},startX:{get:function(){return this.od},set:function(t){this.od!==t&&(this._isFrozen&&k(this,t),this.od=t,this._isInvalidBounds=!0)}},startY:{get:function(){return this.pd},set:function(t){this.pd!==t&&(this._isFrozen&&k(this,t),this.pd=t,this._isInvalidBounds=!0)}},endX:{get:function(){return this.Dc},set:function(t){this.Dc!==t&&(this._isFrozen&&k(this,t),this.Dc=t,this._isInvalidBounds=!0)}},endY:{get:function(){return this.Ec},set:function(t){this.Ec!==t&&(this._isFrozen&&k(this,t),this.Ec=t,this._isInvalidBounds=!0)}},figures:{get:function(){return this.ee},set:function(t){this.ee!==t&&(this._isFrozen&&k(this,t),this.ee=t,this._isInvalidBounds=!0)}},spot1:{get:function(){return this.fg},set:function(t){this._isFrozen&&k(this,t),this.fg=t.J()}},spot2:{get:function(){return this.gg},set:function(t){this._isFrozen&&k(this,t),this.gg=t.J()}},defaultStretch:{get:function(){return this.Uf},set:function(t){this._isFrozen&&k(this,t),this.Uf=t}},bounds:{get:function(){return this.Zu()&&this.computeBounds(),this.Ip}}}),Xe.prototype.setSpots=Xe.prototype.pm,Xe.prototype.add=Xe.prototype.add,Xe.prototype.getFractionForPoint=Xe.prototype.xx,Xe.prototype.getPointAndAngleAlongPath=Xe.prototype.Qu,Xe.prototype.getAngleAlongPath=Xe.prototype.wx,Xe.prototype.getPointAlongPath=Xe.prototype.Pu,Xe.prototype.containsPoint=Xe.prototype.ca,Xe.prototype.transform=Xe.prototype.transform,Xe.prototype.rotate=Xe.prototype.rotate,Xe.prototype.scale=Xe.prototype.scale,Xe.prototype.offset=Xe.prototype.offset,Xe.prototype.normalize=Xe.prototype.normalize,Xe.prototype.computeBoundsWithoutOrigin=Xe.prototype.ix,Xe.prototype.equalsApprox=Xe.prototype.Xa,Xe.className="Geometry",Xe.j=new V(Xe,"Line",0),Xe.u=new V(Xe,"Rectangle",1),Xe.F=new V(Xe,"Ellipse",2),Xe.o=new V(Xe,"Path",3),Xe.V=null,Xe.hb="UuBbMmZzLlHhVvCcSsQqTtAaFfXx",Xe.className="Geometry",Xe.stringify=Xe.ia,Xe.fillPath=Xe.nb,Xe.parse=Xe.parse,Xe.Line=Xe.j,Xe.Rectangle=Xe.u,Xe.Ellipse=Xe.F,Xe.Path=Xe.o,Ze.prototype.copy=function(){var t=new Ze;t.l=-2&this.l,t.od=this.od,t.pd=this.pd;for(var e=this.pl.s,i=e.length,n=t.pl,o=0;o<i;o++){var r=e[o].copy();n.add(r)}return t.sr=this.sr,t.fw=this.fw,t},(e=Ze.prototype).Xa=function(t){if(!(t instanceof Ze&&Ye.B(this.startX,t.startX)&&Ye.B(this.startY,t.startY)))return!1;var e=this.segments.s;t=t.segments.s;var i=e.length;if(i!==t.length)return!1;for(var n=0;n<i;n++)if(!e[n].Xa(t[n]))return!1;return!0},e.toString=function(t){void 0===t&&(t=-1);for(var e=0>t?"M"+this.startX.toString()+" "+this.startY.toString():"M"+this.startX.toFixed(t)+" "+this.startY.toFixed(t),i=this.segments.s,n=i.length,o=0;o<n;o++)e+=" "+i[o].toString(t);return e},e.freeze=function(){this._isFrozen=!0;var t=this.segments;t.freeze();var e=t.s;t=t.length;for(var i=0;i<t;i++)e[i].freeze();return this},e.ka=function(){this._isFrozen=!1;var t=this.segments;t.ka();for(var e=(t=t.s).length,i=0;i<e;i++)t[i].ka();return this},e.Zu=function(){if(this._isInvalidBounds)return!0;var t=this.segments;if(this.sr!==t.Ja)return!0;for(var e=(t=t.s).length,i=0;i<e;i++)if(t[i]._isInvalidBounds)return!0;return!1},e.add=function(t){return this.pl.add(t),this},e.ca=function(t,e,i){for(var n=this.startX,o=this.startY,r=n,s=o,a=this.segments.s,h=a.length,l=0;l<h;l++){var u=a[l];switch(u.type){case ii:r=u.endX,s=u.endY,n=u.endX,o=u.endY;break;case ni:if(Ye.Yb(n,o,u.endX,u.endY,i,t,e))return!0;n=u.endX,o=u.endY;break;case oi:if(Ye.cs(n,o,u.point1X,u.point1Y,u.point2X,u.point2Y,u.endX,u.endY,.5,t,e,i))return!0;n=u.endX,o=u.endY;break;case ri:if(Ye.jv(n,o,u.point1X,u.point1Y,u.endX,u.endY,.5,t,e,i))return!0;n=u.endX,o=u.endY;break;case si:case ai:var c=u.type===si?ti(u,this):ei(u,this,n,o),d=c.length,f=u.type===si?u.centerX:u.endX,p=u.type===si?u.centerY:u.endY;if(0===d){if(Ye.Yb(n,o,f,p,i,t,e))return!0;n=f,o=p;break}for(f=null,p=0;p<d;p++)if(f=c[p],0===p&&Ye.Yb(n,o,f[0],f[1],i,t,e)||Ye.cs(f[0],f[1],f[2],f[3],f[4],f[5],f[6],f[7],.5,t,e,i))return!0;null!==f&&(n=f[6],o=f[7]);break;default:w("Unknown Segment type: "+u.type)}if(u.isClosed&&(n!==r||o!==s)&&Ye.Yb(n,o,r,s,i,t,e))return!0}return!1},d.Object.defineProperties(Ze.prototype,{_isFrozen:{get:function(){return 0!=(1&this.l)},set:function(t){this.l=t?1|this.l:-2&this.l}},_isInvalidBounds:{get:function(){return 0!=(2&this.l)},set:function(t){this.l=t?2|this.l:-3&this.l}},isFilled:{get:function(){return 0!=(4&this.l)},set:function(t){this._isFrozen&&k(this,t),this.l=t?4|this.l:-5&this.l}},isShadowed:{get:function(){return 0!=(8&this.l)},set:function(t){this._isFrozen&&k(this,t),this.l=t?8|this.l:-9&this.l}},isEvenOdd:{get:function(){return 0!=(16&this.l)},set:function(t){this._isFrozen&&k(this,t),this.l=t?16|this.l:-17&this.l}},startX:{get:function(){return this.od},set:function(t){this._isFrozen&&k(this,t),this.od=t,this._isInvalidBounds=!0}},startY:{get:function(){return this.pd},set:function(t){this._isFrozen&&k(this,t),this.pd=t,this._isInvalidBounds=!0}},segments:{get:function(){return this.pl},set:function(t){this._isFrozen&&k(this,t),this.pl=t,this._isInvalidBounds=!0}}}),Ze.prototype.add=Ze.prototype.add,Ze.prototype.equalsApprox=Ze.prototype.Xa,Ze.className="PathFigure",Qe.prototype.copy=function(){var t=new Qe;return t.na=this.na,t.l=-2&this.l,t.Dc=this.Dc,t.Ec=this.Ec,t.Ne=this.Ne,t.Vh=this.Vh,t.Wh=this.Wh,t.Pg=this.Pg,t},(e=Qe.prototype).Xa=function(t){if(!(t instanceof Qe)||this.type!==t.type||this.isClosed!==t.isClosed)return!1;switch(this.type){case ii:case ni:return Ye.B(this.endX,t.endX)&&Ye.B(this.endY,t.endY);case oi:return Ye.B(this.endX,t.endX)&&Ye.B(this.endY,t.endY)&&Ye.B(this.point1X,t.point1X)&&Ye.B(this.point1Y,t.point1Y)&&Ye.B(this.point2X,t.point2X)&&Ye.B(this.point2Y,t.point2Y);case ri:return Ye.B(this.endX,t.endX)&&Ye.B(this.endY,t.endY)&&Ye.B(this.point1X,t.point1X)&&Ye.B(this.point1Y,t.point1Y);case si:return Ye.B(this.startAngle,t.startAngle)&&Ye.B(this.sweepAngle,t.sweepAngle)&&Ye.B(this.centerX,t.centerX)&&Ye.B(this.centerY,t.centerY)&&Ye.B(this.radiusX,t.radiusX)&&Ye.B(this.radiusY,t.radiusY);case ai:return this.isClockwiseArc===t.isClockwiseArc&&this.isLargeArc===t.isLargeArc&&Ye.B(this.xAxisRotation,t.xAxisRotation)&&Ye.B(this.endX,t.endX)&&Ye.B(this.endY,t.endY)&&Ye.B(this.radiusX,t.radiusX)&&Ye.B(this.radiusY,t.radiusY);default:return!1}},e.qb=function(t){t.classType===Qe&&(this.type=t)},e.toString=function(t){switch(void 0===t&&(t=-1),this.type){case ii:t=0>t?"M"+this.endX.toString()+" "+this.endY.toString():"M"+this.endX.toFixed(t)+" "+this.endY.toFixed(t);break;case ni:t=0>t?"L"+this.endX.toString()+" "+this.endY.toString():"L"+this.endX.toFixed(t)+" "+this.endY.toFixed(t);break;case oi:t=0>t?"C"+this.point1X.toString()+" "+this.point1Y.toString()+" "+this.point2X.toString()+" "+this.point2Y.toString()+" "+this.endX.toString()+" "+this.endY.toString():"C"+this.point1X.toFixed(t)+" "+this.point1Y.toFixed(t)+" "+this.point2X.toFixed(t)+" "+this.point2Y.toFixed(t)+" "+this.endX.toFixed(t)+" "+this.endY.toFixed(t);break;case ri:t=0>t?"Q"+this.point1X.toString()+" "+this.point1Y.toString()+" "+this.endX.toString()+" "+this.endY.toString():"Q"+this.point1X.toFixed(t)+" "+this.point1Y.toFixed(t)+" "+this.endX.toFixed(t)+" "+this.endY.toFixed(t);break;case si:t=0>t?"B"+this.startAngle.toString()+" "+this.sweepAngle.toString()+" "+this.centerX.toString()+" "+this.centerY.toString()+" "+this.radiusX.toString()+" "+this.radiusY.toString():"B"+this.startAngle.toFixed(t)+" "+this.sweepAngle.toFixed(t)+" "+this.centerX.toFixed(t)+" "+this.centerY.toFixed(t)+" "+this.radiusX.toFixed(t)+" "+this.radiusY.toFixed(t);break;case ai:t=0>t?"A"+this.radiusX.toString()+" "+this.radiusY.toString()+" "+this.xAxisRotation.toString()+" "+(this.isLargeArc?1:0)+" "+(this.isClockwiseArc?1:0)+" "+this.endX.toString()+" "+this.endY.toString():"A"+this.radiusX.toFixed(t)+" "+this.radiusY.toFixed(t)+" "+this.xAxisRotation.toFixed(t)+" "+(this.isLargeArc?1:0)+" "+(this.isClockwiseArc?1:0)+" "+this.endX.toFixed(t)+" "+this.endY.toFixed(t);break;default:t=this.type.toString()}return t+(this.isClosed?"z":"")},e.freeze=function(){return this._isFrozen=!0,this},e.ka=function(){return this._isFrozen=!1,this},e.close=function(){return this.isClosed=!0,this},d.Object.defineProperties(Qe.prototype,{_isFrozen:{get:function(){return 0!=(1&this.l)},set:function(t){this.l=t?1|this.l:-2&this.l}},_isInvalidBounds:{get:function(){return 0!=(2&this.l)},set:function(t){this.l=t?2|this.l:-3&this.l}},isClosed:{get:function(){return 0!=(8&this.l)},set:function(t){this.isClosed!==t&&(this.l=t?8|this.l:-9&this.l,this._isInvalidBounds=!0)}},type:{get:function(){return this.na},set:function(t){this._isFrozen&&k(this,t),this.na=t,this._isInvalidBounds=!0}},endX:{get:function(){return this.Dc},set:function(t){this._isFrozen&&k(this,t),this.Dc=t,this._isInvalidBounds=!0}},endY:{get:function(){return this.Ec},set:function(t){this._isFrozen&&k(this,t),this.Ec=t,this._isInvalidBounds=!0}},point1X:{get:function(){return this.Ne},set:function(t){this._isFrozen&&k(this,t),this.Ne=t,this._isInvalidBounds=!0}},point1Y:{get:function(){return this.Vh},set:function(t){this._isFrozen&&k(this,t),this.Vh=t,this._isInvalidBounds=!0}},point2X:{get:function(){return this.Wh},set:function(t){this._isFrozen&&k(this,t),this.Wh=t,this._isInvalidBounds=!0}},point2Y:{get:function(){return this.Pg},set:function(t){this._isFrozen&&k(this,t),this.Pg=t,this._isInvalidBounds=!0}},centerX:{get:function(){return this.Ne},set:function(t){this._isFrozen&&k(this,t),this.Ne=t,this._isInvalidBounds=!0}},centerY:{get:function(){return this.Vh},set:function(t){this._isFrozen&&k(this,t),this.Vh=t,this._isInvalidBounds=!0}},radiusX:{get:function(){return this.Wh},set:function(t){0>t&&S(t,">= zero",Qe,"radiusX"),this._isFrozen&&k(this,t),this.Wh=t,this._isInvalidBounds=!0}},radiusY:{get:function(){return this.Pg},set:function(t){0>t&&S(t,">= zero",Qe,"radiusY"),this._isFrozen&&k(this,t),this.Pg=t,this._isInvalidBounds=!0}},startAngle:{get:function(){return this.Dc},set:function(t){this._isFrozen&&k(this,t),0>(t%=360)&&(t+=360),this.Dc=t,this._isInvalidBounds=!0}},sweepAngle:{get:function(){return this.Ec},set:function(t){this._isFrozen&&k(this,t),360<t&&(t=360),-360>t&&(t=-360),this.Ec=t,this._isInvalidBounds=!0}},isClockwiseArc:{get:function(){return 0!=(4&this.l)},set:function(t){this._isFrozen&&k(this,t),this.l=t?4|this.l:-5&this.l,this._isInvalidBounds=!0}},isLargeArc:{get:function(){return 0!=(16&this.l)},set:function(t){this._isFrozen&&k(this,t),this.l=t?16|this.l:-17&this.l,this._isInvalidBounds=!0}},xAxisRotation:{get:function(){return this.Ne},set:function(t){this._isFrozen&&k(this,t),0>(t%=360)&&(t+=360),this.Ne=t,this._isInvalidBounds=!0}}}),Qe.prototype.equalsApprox=Qe.prototype.Xa;var ii=new V(Qe,"Move",0),ni=new V(Qe,"Line",1),oi=new V(Qe,"Bezier",2),ri=new V(Qe,"QuadraticBezier",3),si=new V(Qe,"Arc",4),ai=new V(Qe,"SvgArc",4);function hi(){this.H=null,this.xu=new pt(0,0).freeze(),this.mt=new pt(0,0).freeze(),this.Bp=this.Rq=0,this.Cp=1,this.xq="",this.Wr=this.Tp=!1,this.Rp=this.Ep=0,this.xg=this.nq=this.tq=!1,this.Zp=null,this.Rr=0,this.xd=this.Nr=null}function li(){this.H=null,this.xa="",this.ar=this.Lr=null}function ui(){this.Fm=di,this.rf=this.Qq="",this.Ln=this.Mn=this.Rn=this.Sn=this.Qn=this.H=this.cc=null}Qe.className="PathSegment",Qe.Move=ii,Qe.Line=ni,Qe.Bezier=oi,Qe.QuadraticBezier=ri,Qe.Arc=si,Qe.SvgArc=ai,hi.prototype.copy=function(){var t=new hi;return this.clone(t)},hi.prototype.clone=function(t){return t.H=this.H,t.xu.assign(this.viewPoint),t.mt.assign(this.documentPoint),t.Rq=this.Rq,t.Bp=this.Bp,t.Cp=this.Cp,t.xq=this.xq,t.Tp=this.Tp,t.Wr=this.Wr,t.Ep=this.Ep,t.Rp=this.Rp,t.tq=this.tq,t.nq=this.nq,t.xg=this.xg,t.Zp=this.Zp,t.Rr=this.Rr,t.Nr=this.Nr,t.xd=this.xd,t},hi.prototype.toString=function(){var t="^";return 0!==this.modifiers&&(t+="M:"+this.modifiers),0!==this.button&&(t+="B:"+this.button),""!==this.key&&(t+="K:"+this.key),0!==this.clickCount&&(t+="C:"+this.clickCount),0!==this.delta&&(t+="D:"+this.delta),this.handled&&(t+="h"),this.bubbles&&(t+="b"),null!==this.documentPoint&&(t+="@"+this.documentPoint.toString()),t},hi.prototype.So=function(t,e){var i=this.diagram;return null===i||$o(i,t,e),e},hi.prototype.Bz=function(t,e){var i=this.diagram;return null===i||($o(i,t,e),e.assign(i.Ps(e))),e},d.Object.defineProperties(hi.prototype,{diagram:{get:function(){return this.H},set:function(t){this.H=t}},viewPoint:{get:function(){return this.xu},set:function(t){this.xu.assign(t)}},documentPoint:{get:function(){return this.mt},set:function(t){this.mt.assign(t)}},modifiers:{get:function(){return this.Rq},set:function(t){this.Rq=t}},button:{get:function(){return this.Bp},set:function(t){if(this.Bp=t,null===this.event)switch(t){case 0:this.buttons=1;break;case 1:this.buttons=4;break;case 2:this.buttons=2}}},buttons:{get:function(){return this.Cp},set:function(t){this.Cp=t}},key:{get:function(){return this.xq},set:function(t){this.xq=t}},down:{get:function(){return this.Tp},set:function(t){this.Tp=t}},up:{get:function(){return this.Wr},set:function(t){this.Wr=t}},clickCount:{get:function(){return this.Ep},set:function(t){this.Ep=t}},delta:{get:function(){return this.Rp},set:function(t){this.Rp=t}},isMultiTouch:{get:function(){return this.tq},set:function(t){this.tq=t}},handled:{get:function(){return this.nq},set:function(t){this.nq=t}},bubbles:{get:function(){return this.xg},set:function(t){this.xg=t}},event:{get:function(){return this.Zp},set:function(t){this.Zp=t}},isTouchEvent:{get:function(){var t=this.event;return null!==t&&("touch"===t.pointerType||"pen"===t.pointerType)}},timestamp:{get:function(){return this.Rr},set:function(t){this.Rr=t}},targetDiagram:{get:function(){return this.Nr},set:function(t){this.Nr=t}},targetObject:{get:function(){return this.xd},set:function(t){this.xd=t}},control:{get:function(){return 0!=(1&this.modifiers)},set:function(t){this.modifiers=t?1|this.modifiers:-2&this.modifiers}},shift:{get:function(){return 0!=(4&this.modifiers)},set:function(t){this.modifiers=t?4|this.modifiers:-5&this.modifiers}},alt:{get:function(){return 0!=(2&this.modifiers)},set:function(t){this.modifiers=t?2|this.modifiers:-3&this.modifiers}},meta:{get:function(){return 0!=(8&this.modifiers)},set:function(t){this.modifiers=t?8|this.modifiers:-9&this.modifiers}},left:{get:function(){var t=this.event;return null===t||"mousedown"!==t.type&&"mouseup"!==t.type&&"pointerdown"!==t.type&&"pointerup"!==t.type?0!=(1&this.buttons):0===this.button},set:function(t){this.buttons=t?1|this.buttons:-2&this.buttons}},right:{get:function(){var t=this.event;return null===t||"mousedown"!==t.type&&"mouseup"!==t.type&&"pointerdown"!==t.type&&"pointerup"!==t.type?0!=(2&this.buttons):2===this.button},set:function(t){this.buttons=t?2|this.buttons:-3&this.buttons}},middle:{get:function(){var t=this.event;return null===t||"mousedown"!==t.type&&"mouseup"!==t.type&&"pointerdown"!==t.type&&"pointerup"!==t.type?0!=(4&this.buttons):1===this.button},set:function(t){this.buttons=t?4|this.buttons:-5&this.buttons}}}),hi.prototype.getMultiTouchDocumentPoint=hi.prototype.Bz,hi.prototype.getMultiTouchViewPoint=hi.prototype.So,hi.className="InputEvent",li.prototype.copy=function(){var t=new li;return t.H=this.H,t.xa=this.xa,t.Lr=this.Lr,t.ar=this.ar,t},li.prototype.toString=function(){var t="*"+this.name;return null!==this.subject&&(t+=":"+this.subject.toString()),null!==this.parameter&&(t+="("+this.parameter.toString()+")"),t},d.Object.defineProperties(li.prototype,{diagram:{get:function(){return this.H},set:function(t){this.H=t}},name:{get:function(){return this.xa},set:function(t){this.xa=t}},subject:{get:function(){return this.Lr},set:function(t){this.Lr=t}},parameter:{get:function(){return this.ar},set:function(t){this.ar=t}}}),li.className="DiagramEvent",ui.prototype.clear=function(){this.Ln=this.Mn=this.Rn=this.Sn=this.Qn=this.H=this.cc=null},ui.prototype.copy=function(){var t=new ui;t.Fm=this.Fm,t.Qq=this.Qq,t.rf=this.rf,t.cc=this.cc,t.H=this.H,t.Qn=this.Qn;var e=this.Sn;return t.Sn=C(e)&&"function"==typeof e.J?e.J():e,e=this.Rn,t.Rn=C(e)&&"function"==typeof e.J?e.J():e,e=this.Mn,t.Mn=C(e)&&"function"==typeof e.J?e.J():e,e=this.Ln,t.Ln=C(e)&&"function"==typeof e.J?e.J():e,t},ui.prototype.qb=function(t){t.classType===ui&&(this.change=t)},ui.prototype.toString=function(){var t="";return t=this.change===ci?t+"* ":this.change===di?t+(null!==this.model?"!m":"!d"):t+(null!==this.model?"!m":"!d")+this.change,this.propertyName&&"string"==typeof this.propertyName&&(t+=" "+this.propertyName),this.modelChange&&this.modelChange!==this.propertyName&&(t+=" "+this.modelChange),t+=": ",this.change===ci?null!==this.oldValue&&(t+=" "+this.oldValue):(null!==this.object&&(t+=F(this.object)),null!==this.oldValue&&(t+=" old: "+F(this.oldValue)),null!==this.oldParam&&(t+=" "+this.oldParam),null!==this.newValue&&(t+=" new: "+F(this.newValue)),null!==this.newParam&&(t+=" "+this.newParam)),t},ui.prototype.I=function(t){return t?this.oldValue:this.newValue},ui.prototype.Dz=function(t){return t?this.oldParam:this.newParam},ui.prototype.canUndo=function(){return null!==this.model||null!==this.diagram},ui.prototype.undo=function(){this.canUndo()&&(null!==this.model?this.model.changeState(this,!0):null!==this.diagram&&this.diagram.changeState(this,!0))},ui.prototype.canRedo=function(){return null!==this.model||null!==this.diagram},ui.prototype.redo=function(){this.canRedo()&&(null!==this.model?this.model.changeState(this,!1):null!==this.diagram&&this.diagram.changeState(this,!1))},d.Object.defineProperties(ui.prototype,{model:{get:function(){return this.cc},set:function(t){this.cc=t}},diagram:{get:function(){return this.H},set:function(t){this.H=t}},change:{get:function(){return this.Fm},set:function(t){this.Fm=t}},modelChange:{get:function(){return this.Qq},set:function(t){this.Qq=t}},propertyName:{get:function(){return this.rf},set:function(t){this.rf=t}},isTransactionFinished:{get:function(){return this.Fm===ci&&("CommittedTransaction"===this.rf||"FinishedUndo"===this.rf||"FinishedRedo"===this.rf)}},object:{get:function(){return this.Qn},set:function(t){this.Qn=t}},oldValue:{get:function(){return this.Sn},set:function(t){this.Sn=t}},oldParam:{get:function(){return this.Rn},set:function(t){this.Rn=t}},newValue:{get:function(){return this.Mn},set:function(t){this.Mn=t}},newParam:{get:function(){return this.Ln},set:function(t){this.Ln=t}}}),ui.prototype.redo=ui.prototype.redo,ui.prototype.canRedo=ui.prototype.canRedo,ui.prototype.undo=ui.prototype.undo,ui.prototype.canUndo=ui.prototype.canUndo,ui.prototype.getParam=ui.prototype.Dz,ui.prototype.getValue=ui.prototype.I,ui.prototype.clear=ui.prototype.clear;var ci=new V(ui,"Transaction",-1),di=new V(ui,"Property",0),fi=new V(ui,"Insert",1),pi=new V(ui,"Remove",2);function gi(){this.o=(new $).freeze(),this.xa="",this.j=!1}function mi(){this.Pt=new Z,this.Jd=!1,this.u=(new $).freeze(),this.Ce=-1,this.o=999,this.Fe=!1,this.Np=null,this.bi=0,this.j=!1,this.Ie=(new $).freeze(),this.hl=new $,this.tt=!0,this.Dt=this.rq=this.Gt=this.Ft=!1}function yi(t,e,i){if(t.isUndoingRedoing)return!1;t.checksTransactionLevel&&1>t.transactionLevel&&M("Ending transaction without having started a transaction: "+i);var n=1===t.transactionLevel,o=t.currentTransaction;n&&e&&(t.isInternalTransaction||t.Ob("CommittingTransaction",i,o));var r=0;if(0<t.transactionLevel&&(t.bi--,t.isEnabled)){var s=t.Ie.count;0<s&&(""===i&&(i=t.Ie.M(0)),t.Ie.ka(),t.Ie.mb(s-1),t.Ie.freeze()),0<(s=t.hl.count)&&(r=t.hl.M(s-1),t.hl.mb(s-1))}if(n){if(e)t.rq=!1,null===o&&""!==i&&(o=t.currentTransaction),t.isEnabled&&null!==o&&(o.isComplete||(o.isComplete=!0,o.name=i),t.lx(),(e=t.history).ka(),0<=(n=t.maxHistoryLength)&&(0===n?e.clear():e.count>=n&&(null!==(r=e.M(0))&&r.clear(),e.mb(0),t.Ce--)),0===n||0!==e.count&&e.get(e.count-1)===o||(e.add(o),t.Ce++),e.freeze()),t.isInternalTransaction||t.Ob("CommittedTransaction",i,o);else{t.Fe=!0;try{t.isEnabled&&null!==o&&(o.isComplete=!0,o.undo())}finally{t.isInternalTransaction||t.Ob("RolledBackTransaction",i,o),t.Fe=!1}null!==o&&o.clear()}return t.Np=null,t.isPendingClear&&t.clear(),t.isPendingClear=!1,t.isPendingUnmodified=!1,!0}if(t.isEnabled&&!e&&null!==o){for(t=r,o=(i=o.changes).count-1;o>=t;o--)null!==(e=i.M(o))&&e.undo(),i.ka(),i.mb(o);i.freeze()}return!1}function vi(){Q(this),this.H=bo,this.xa="",this.Jd=!0,this.nb=!1,this.wm=null,this.yy=new hi,this.Zr=-1}function xi(){vi.call(this),this.name="ToolManager",this.hb=new $,this.ob=new $,this.Hb=new $,this.F=this.V=850,this.o=new At(2,2).ja(),this.Ha=5e3,this.ia=ki,this.u=Ci,this.Mp=this.j=null,this.zj=-1}function bi(t,e){t.standardMouseOver(),t.isBeyondDragSize()&&t.standardWaitAfter(t.isActive?t.holdDelay:t.hoverDelay,e.lastInput)}ui.className="ChangedEvent",ui.Transaction=ci,ui.Property=di,ui.Insert=fi,ui.Remove=pi,gi.prototype.toString=function(t){var e="Transaction: "+this.name+" "+this.changes.count.toString()+(this.isComplete?"":", incomplete");if(void 0!==t&&0<t){t=this.changes.count;for(var i=0;i<t;i++){var n=this.changes.M(i);null!==n&&(e+="\n "+n.toString())}}return e},gi.prototype.clear=function(){var t=this.changes;t.ka();for(var e=t.count-1;0<=e;e--){var i=t.M(e);null!==i&&i.clear()}t.clear(),t.freeze()},gi.prototype.canUndo=function(){return this.isComplete},gi.prototype.undo=function(){if(this.canUndo())for(var t=this.changes.count-1;0<=t;t--){var e=this.changes.M(t);null!==e&&e.undo()}},gi.prototype.canRedo=function(){return this.isComplete},gi.prototype.redo=function(){if(this.canRedo())for(var t=this.changes.count,e=0;e<t;e++){var i=this.changes.M(e);null!==i&&i.redo()}},gi.prototype.ak=function(){if(this.isComplete){var t=this.changes;t.ka();for(var e=new ft,i=0;i<t.count;i++){var n=t.M(i);if(null!==n&&n.change===di&&n.object){var o=e.get(n.object);o||(o=new ft,e.set(n.object,o));var r=o.get(n.propertyName);null===r?o.set(n.propertyName,-1):(0<r&&t.cd(r,null),o.set(n.propertyName,i))}}for(i=e=0;i<t.count;i++)null!==(n=t.M(i))&&(i>e&&t.cd(e,n),e++);for(;t.length>e;)t.pop();t.freeze()}},d.Object.defineProperties(gi.prototype,{changes:{get:function(){return this.o}},name:{get:function(){return this.xa},set:function(t){this.xa=t}},isComplete:{get:function(){return this.j},set:function(t){this.j=t}}}),gi.prototype.optimize=gi.prototype.ak,gi.prototype.redo=gi.prototype.redo,gi.prototype.canRedo=gi.prototype.canRedo,gi.prototype.undo=gi.prototype.undo,gi.prototype.canUndo=gi.prototype.canUndo,gi.prototype.clear=gi.prototype.clear,gi.className="Transaction",mi.prototype.toString=function(t){var e="UndoManager "+this.historyIndex+"<"+this.history.count+"<="+this.maxHistoryLength;e+="[";for(var i=this.nestedTransactionNames.count,n=0;n<i;n++)0<n&&(e+=" "),e+=this.nestedTransactionNames.M(n);if(e+="]",void 0!==t&&0<t)for(i=this.history.count,n=0;n<i;n++)e+="\n "+this.history.M(n).toString(t-1);return e},mi.prototype.clear=function(){var t=this.history;t.ka();for(var e=t.count-1;0<=e;e--){var i=t.M(e);null!==i&&i.clear()}t.clear(),this.Ce=-1,t.freeze(),this.Fe=!1,this.Np=null,this.bi=0,this.Ie.ka(),this.Ie.clear(),this.Ie.freeze(),this.hl.clear(),this.Dt=this.rq=this.Gt=this.Ft=!1},mi.prototype.copyProperties=function(t){this.isEnabled=t.isEnabled,this.maxHistoryLength=t.maxHistoryLength,this.checksTransactionLevel=t.checksTransactionLevel},(e=mi.prototype).Xw=function(t){this.Pt.add(t)},e.Rx=function(t){this.Pt.remove(t)},e.Ea=function(t){if(void 0===t&&(t=""),null===t&&(t=""),this.isUndoingRedoing)return!1;!0===this.tt&&(this.tt=!1,this.bi++,this.isInternalTransaction||this.Ob("StartingFirstTransaction",t,this.currentTransaction),0<this.bi&&this.bi--),this.isEnabled&&(this.Ie.ka(),this.Ie.add(t),this.Ie.freeze(),null===this.currentTransaction?this.hl.add(0):this.hl.add(this.currentTransaction.changes.count)),this.bi++;var e=1===this.transactionLevel;return e&&(this.isInternalTransaction||this.Ob("StartedTransaction",t,this.currentTransaction)),e},e.eb=function(t){return void 0===t&&(t=""),yi(this,!0,t)},e.Kf=function(){return yi(this,!1,"")},e.lx=function(){if(!this.isUndoingRedoing&&this.canRedo()){var t=this.history;t.ka();for(var e=t.count-1;e>this.historyIndex;e--){var i=t.M(e);null!==i&&i.clear(),t.mb(e),this.rq=!0}t.freeze()}},mi.prototype.canUndo=function(){if(!this.isEnabled||0<this.transactionLevel)return!1;var t=this.transactionToUndo;return!(null===t||!t.canUndo())},mi.prototype.undo=function(){if(this.canUndo()){var t=this.transactionToUndo;try{this.Fe=!0,this.Ob("StartingUndo","Undo",t),this.Ce--,t.undo()}catch(t){M("undo error: "+t.toString())}finally{this.Ob("FinishedUndo","Undo",t),this.Fe=!1}}},mi.prototype.canRedo=function(){if(!this.isEnabled||0<this.transactionLevel)return!1;var t=this.transactionToRedo;return!(null===t||!t.canRedo())},mi.prototype.redo=function(){if(this.canRedo()){var t=this.transactionToRedo;try{this.Fe=!0,this.Ob("StartingRedo","Redo",t),this.Ce++,t.redo()}catch(t){M("redo error: "+t.toString())}finally{this.Ob("FinishedRedo","Redo",t),this.Fe=!1}}},mi.prototype.Ob=function(t,e,i){void 0===i&&(i=null);var n=new ui;for(n.change=ci,n.propertyName=t,n.object=i,n.oldValue=e,t=this.models;t.next();)e=t.value,n.model=e,e.ds(n)},mi.prototype.Tu=function(t){if(this.isEnabled&&!this.isUndoingRedoing&&!this.skipsEvent(t)){var e=this.currentTransaction;null===e&&(this.Np=e=new gi);var i=t.copy();(e=e.changes).ka(),e.add(i),e.freeze(),this.checksTransactionLevel&&0>=this.transactionLevel&&!this.tt&&(null!==(t=t.diagram)&&!1===t.pi||M("Change not within a transaction: "+i.toString()))}},mi.prototype.skipsEvent=function(t){if(null===t||0>t.change.value)return!0;if(null===(t=t.object))return!1;if(void 0!==t.layer){if(null!==(t=t.layer)&&t.isTemporary)return!0}else if(t.isTemporary)return!0;return!1},d.Object.defineProperties(mi.prototype,{models:{get:function(){return this.Pt.iterator}},isEnabled:{get:function(){return this.Jd},set:function(t){this.Jd=t}},transactionToUndo:{get:function(){return 0<=this.historyIndex&&this.historyIndex<=this.history.count-1?this.history.M(this.historyIndex):null}},transactionToRedo:{get:function(){return this.historyIndex<this.history.count-1?this.history.M(this.historyIndex+1):null}},isUndoingRedoing:{get:function(){return this.Fe}},history:{get:function(){return this.u}},maxHistoryLength:{get:function(){return this.o},set:function(t){this.o=t}},historyIndex:{get:function(){return this.Ce}},currentTransaction:{get:function(){return this.Np}},transactionLevel:{get:function(){return this.bi}},isInTransaction:{get:function(){return 0<this.bi}},checksTransactionLevel:{get:function(){return this.j},set:function(t){this.j=t}},nestedTransactionNames:{get:function(){return this.Ie}},isPendingClear:{get:function(){return this.Ft},set:function(t){this.Ft=t}},isPendingUnmodified:{get:function(){return this.Gt},set:function(t){this.Gt=t}},isInternalTransaction:{get:function(){return this.Dt},set:function(t){this.Dt=t}},isJustDiscarded:{get:function(){return this.rq}}}),mi.prototype.handleChanged=mi.prototype.Tu,mi.prototype.redo=mi.prototype.redo,mi.prototype.undo=mi.prototype.undo,mi.prototype.canUndo=mi.prototype.canUndo,mi.prototype.discardHistoryAfterIndex=mi.prototype.lx,mi.prototype.rollbackTransaction=mi.prototype.Kf,mi.prototype.commitTransaction=mi.prototype.eb,mi.prototype.startTransaction=mi.prototype.Ea,mi.prototype.removeModel=mi.prototype.Rx,mi.prototype.addModel=mi.prototype.Xw,mi.prototype.clear=mi.prototype.clear,mi.className="UndoManager",vi.prototype.toString=function(){return""!==this.name?this.name+" Tool":D(this.constructor)},vi.prototype.updateAdornments=function(){},vi.prototype.canStart=function(){return this.isEnabled},vi.prototype.doStart=function(){},vi.prototype.doActivate=function(){this.isActive=!0},vi.prototype.doDeactivate=function(){this.isActive=!1},vi.prototype.doStop=function(){},vi.prototype.doCancel=function(){this.transactionResult=null,this.stopTool()},vi.prototype.stopTool=function(){var t=this.diagram;t.currentTool===this&&(t.currentTool=null,t.currentCursor="")},vi.prototype.doMouseDown=function(){!this.isActive&&this.canStart()&&this.doActivate()},vi.prototype.doMouseMove=function(){},vi.prototype.doMouseUp=function(){this.stopTool()},vi.prototype.doMouseWheel=function(){},vi.prototype.canStartMultiTouch=function(){return!0},vi.prototype.standardPinchZoomStart=function(){var t=this.diagram,e=t.lastInput,i=e.So(0,pt.allocAt(NaN,NaN)),n=e.So(1,pt.allocAt(NaN,NaN));if(i.w()&&n.w()&&(this.doCancel(),t.Ql("hasGestureZoom"))){t.Bw=t.scale;var o=n.x-i.x,r=n.y-i.y;t.Jw=Math.sqrt(o*o+r*r),e.bubbles=!1}pt.free(i),pt.free(n)},vi.prototype.standardPinchZoomMove=function(){var t=this.diagram,e=t.lastInput,i=e.So(0,pt.allocAt(NaN,NaN)),n=e.So(1,pt.allocAt(NaN,NaN));if(i.w()&&n.w()&&(this.doCancel(),t.Ql("hasGestureZoom"))){var o=n.x-i.x,r=n.y-i.y;r=Math.sqrt(o*o+r*r)/t.Jw,o=new pt((Math.min(n.x,i.x)+Math.max(n.x,i.x))/2,(Math.min(n.y,i.y)+Math.max(n.y,i.y))/2),r*=t.Bw;var s=t.commandHandler;if(r!==t.scale&&s.canResetZoom(r)){var a=t.zoomPoint;t.zoomPoint=o,s.resetZoom(r),t.zoomPoint=a}e.bubbles=!1}pt.free(i),pt.free(n)},vi.prototype.doKeyDown=function(){"Esc"===this.diagram.lastInput.key&&this.doCancel()},vi.prototype.doKeyUp=function(){},vi.prototype.Ea=function(t){return void 0===t&&(t=this.name),this.transactionResult=null,this.diagram.Ea(t)},vi.prototype.stopTransaction=function(){var t=this.diagram;return null===this.transactionResult?t.Kf():t.eb(this.transactionResult)},vi.prototype.standardMouseSelect=function(){var t=this.diagram;if(t.allowSelect){var e=t.lastInput,i=t.Ol(e.documentPoint,!1);if(null!==i){if(z?e.meta:e.control){for(t.R("ChangingSelection",t.selection),e=i;null!==e&&!e.canSelect();)e=e.containingGroup;null!==e&&(e.isSelected=!e.isSelected),t.R("ChangedSelection",t.selection)}else if(e.shift){if(!i.isSelected){for(t.R("ChangingSelection",t.selection),e=i;null!==e&&!e.canSelect();)e=e.containingGroup;null!==e&&(e.isSelected=!0),t.R("ChangedSelection",t.selection)}}else if(!i.isSelected){for(e=i;null!==e&&!e.canSelect();)e=e.containingGroup;null!==e&&t.select(e)}}else!e.left||(z?e.meta:e.control)||e.shift||t.clearSelection()}},vi.prototype.standardMouseClick=function(t,e){void 0===t&&(t=null),void 0===e&&(e=function(t){return!t.layer.isTemporary});var i=this.diagram,n=i.lastInput;return t=i.ic(n.documentPoint,t,e),n.targetObject=t,function(t,e,i){if(e.handled=!1,null===t||t.If()){var n=0;e.left?n=1===e.clickCount?1:2===e.clickCount?2:1:e.right&&1===e.clickCount&&(n=3);var o="ObjectSingleClicked";if(null!==t){switch(n){case 1:o="ObjectSingleClicked";break;case 2:o="ObjectDoubleClicked";break;case 3:o="ObjectContextClicked"}0!==n&&i.R(o,t)}else{switch(n){case 1:o="BackgroundSingleClicked";break;case 2:o="BackgroundDoubleClicked";break;case 3:o="BackgroundContextClicked"}0!==n&&i.R(o)}if(null!==t)for(;null!==t;){switch(i=null,n){case 1:i=t.click;break;case 2:i=t.doubleClick?t.doubleClick:t.click;break;case 3:i=t.contextClick}if(null!==i&&(i(e,t),e.handled))break;t=t.panel}else{switch(t=null,n){case 1:t=i.click;break;case 2:t=i.doubleClick?i.doubleClick:i.click;break;case 3:t=i.contextClick}null!==t&&t(e)}}}(t,n,i),n.handled},vi.prototype.standardMouseOver=function(){var t=this.diagram,e=t.lastInput;if(!0!==t.animationManager.zb){var i=t.skipsUndoManager;t.skipsUndoManager=!0;var n=t.viewportBounds.ca(e.documentPoint)?t.ic(e.documentPoint,null,null):null;!e.event||"pointercancel"!==e.event.type&&"pointerout"!==e.event.type||(n=null),e.targetObject=n;var o=!1;if(n!==t.Ck){var r=t.Ck,s=r;for(t.Ck=n,this.doCurrentObjectChanged(r,n),e.handled=!1;null!==r;){var a=r.mouseLeave;if(null!==a){if(n===r)break;if(null!==n&&n.rg(r))break;if(a(e,r,n),o=!0,e.handled)break}r=r.panel}for(r=s,e.handled=!1;null!==n;){if(null!==(s=n.mouseEnter)){if(r===n)break;if(null!==r&&r.rg(n))break;if(s(e,n,r),o=!0,e.handled)break}n=n.panel}n=t.Ck}if(null!==n){for(r=n,s="";null!==r&&""===(s=r.cursor);)r=r.panel;for(t.currentCursor=s,e.handled=!1,r=n;null!==r&&(null===(n=r.mouseOver)||(n(e,r),o=!0,!e.handled));)r=r.panel}else this.doUpdateCursor(null),null!==(n=t.mouseOver)&&(n(e),o=!0);o&&t.$b(),t.skipsUndoManager=i}},vi.prototype.doUpdateCursor=function(){var t=this.diagram;t&&(t.currentCursor="")},vi.prototype.doCurrentObjectChanged=function(){},vi.prototype.standardMouseWheel=function(){var t=this.diagram,e=t.lastInput,i=e.delta;if(0!==i&&t.documentBounds.w()){var n=t.commandHandler,o=t.toolManager.mouseWheelBehavior;if(null!==n&&(o===Si&&!e.shift||o===ki&&e.control))(0<i?n.canIncreaseZoom():n.canDecreaseZoom())&&(o=t.zoomPoint,t.zoomPoint=e.viewPoint,0<i?n.increaseZoom():n.decreaseZoom(),t.zoomPoint=o),e.bubbles=!1;else if(o===Si&&e.shift||o===ki&&!e.control){n=t.position.copy();var r=e.event;o=r.deltaMode;var s=r.deltaX;r=r.deltaY;var a="pixel";if(0===s&&0===r||e.shift)!e.shift&&t.allowVerticalScroll?(i=3*i*t.scrollVerticalLineChange,t.scroll(a,0<i?"up":"down",Math.abs(i))):e.shift&&t.allowHorizontalScroll&&(i=3*i*t.scrollHorizontalLineChange,t.scroll(a,0<i?"left":"right",Math.abs(i)));else{switch(o){case 0:a="pixel";break;case 1:a="line";break;case 2:a="page"}0!==s&&t.allowHorizontalScroll&&(s*=t.scrollHorizontalLineChange/16,t.scroll(a,0<s?"right":"left",Math.abs(s))),0!==r&&t.allowVerticalScroll&&(r*=t.scrollVerticalLineChange/16,t.scroll(a,0<r?"down":"up",Math.abs(r)))}this.doWheelChange(t,n,e)}}},vi.prototype.doWheelChange=function(t,e,i){t.position.D(e)&&0===i.event.wheelDeltaX||(i.bubbles=!1)},vi.prototype.standardWaitAfter=function(t,e){void 0===e&&(e=this.diagram.lastInput),this.cancelWaitAfter();var i=this,n=e.clone(this.yy);this.Zr=x((function(){i.doWaitAfter(n)}),t)},vi.prototype.cancelWaitAfter=function(){-1!==this.Zr&&m.clearTimeout(this.Zr),this.Zr=-1},vi.prototype.doWaitAfter=function(){},vi.prototype.findToolHandleAt=function(t,e){return null===(t=this.diagram.ic(t,(function(t){for(;null!==t&&!(t.panel instanceof Wu);)t=t.panel;return t})))?null:t.part.category===e?t:null},vi.prototype.isBeyondDragSize=function(t,e){var i=this.diagram;void 0===t&&(t=i.firstInput.viewPoint),void 0===e&&(e=i.lastInput.viewPoint);var n=i.toolManager.dragSize,o=n.width;return n=n.height,i.firstInput.isTouchEvent&&(o+=6,n+=6),Math.abs(e.x-t.x)>o||Math.abs(e.y-t.y)>n},d.Object.defineProperties(vi.prototype,{diagram:{get:function(){return this.H},set:function(t){t instanceof No&&(this.H=t)}},name:{get:function(){return this.xa},set:function(t){this.xa=t}},isEnabled:{get:function(){return this.Jd},set:function(t){this.Jd=t}},isActive:{get:function(){return this.nb},set:function(t){this.nb=t}},transactionResult:{get:function(){return this.wm},set:function(t){this.wm=t}}}),vi.prototype.startTransaction=vi.prototype.Ea,vi.className="Tool",c(xi,vi),xi.prototype.initializeStandardTools=function(){},xi.prototype.updateAdornments=function(t){var e=this.currentToolTip;if(e instanceof Wu&&this.Mp===t){var i=e.adornedObject;(null!==t?i.part===t:null===i)?this.showToolTip(e,i):this.hideToolTip()}},xi.prototype.doMouseDown=function(){var t=this.diagram,e=t.lastInput;if(e.isTouchEvent&&this.gestureBehavior===Pi&&(e.bubbles=!1),e.isMultiTouch){if(this.cancelWaitAfter(),this.gestureBehavior===Ti)return void(e.bubbles=!0);if(this.gestureBehavior===Pi)return;if(t.currentTool.canStartMultiTouch())return void t.currentTool.standardPinchZoomStart()}for(var i=this.mouseDownTools.length,n=0;n<i;n++){var o=this.mouseDownTools.M(n);if(o.diagram=this.diagram,o.canStart())return t.doFocus(),t.currentTool=o,void(t.currentTool===o&&(o.isActive||o.doActivate(),o.doMouseDown()))}1===t.lastInput.button&&(this.mouseWheelBehavior===ki?this.mouseWheelBehavior=Si:this.mouseWheelBehavior===Si&&(this.mouseWheelBehavior=ki)),this.doActivate(),this.standardWaitAfter(this.holdDelay,e)},xi.prototype.doMouseMove=function(){var t=this.diagram,e=t.lastInput;if(e.isMultiTouch){if(this.gestureBehavior===Ti)return void(e.bubbles=!0);if(this.gestureBehavior===Pi)return;if(t.currentTool.canStartMultiTouch())return void t.currentTool.standardPinchZoomMove()}if(this.isActive)for(var i=this.mouseMoveTools.length,n=0;n<i;n++){var o=this.mouseMoveTools.M(n);if(o.diagram=this.diagram,o.canStart())return t.doFocus(),t.currentTool=o,void(t.currentTool===o&&(o.isActive||o.doActivate(),o.doMouseMove()))}bi(this,t),null===(t=e.event)||"pointermove"!==t.type&&t.cancelable||(e.bubbles=!0)},xi.prototype.doCurrentObjectChanged=function(t,e){null===(t=this.currentToolTip)||null!==e&&t instanceof Wu&&(e===t||e.rg(t))||this.hideToolTip()},xi.prototype.doWaitAfter=function(t){var e=this.diagram;null!==e.ta&&(this.doMouseHover(),this.isActive||this.doToolTip(),t.isTouchEvent&&!e.lastInput.handled&&((t=t.copy()).button=2,t.buttons=2,e.lastInput=t,e.qu=!0,e.doMouseUp()))},xi.prototype.doMouseHover=function(){var t=this.diagram,e=t.lastInput;null===e.targetObject&&(e.targetObject=t.ic(e.documentPoint,null,null));var i=e.targetObject;if(null!==i)for(e.handled=!1;null!==i&&(null===(t=this.isActive?i.mouseHold:i.mouseHover)||(t(e,i),!e.handled));)i=i.panel;else null!==(i=this.isActive?t.mouseHold:t.mouseHover)&&i(e)},xi.prototype.doToolTip=function(){var t=this.diagram,e=t.lastInput;if(null===e.targetObject&&(e.targetObject=t.ic(e.documentPoint,null,null)),null!==(e=e.targetObject)){if(!((t=this.currentToolTip)instanceof Wu)||e!==t&&!e.rg(t)){for(;null!==e;){if(null!==(t=e.toolTip))return void this.showToolTip(t,e);e=e.panel}this.hideToolTip()}}else null!==(e=t.toolTip)?this.showToolTip(e,null):this.hideToolTip()},xi.prototype.showToolTip=function(t,e){var i=this.diagram;if(t!==this.currentToolTip&&this.hideToolTip(),t instanceof Wu){t.layerName="Tool",t.selectable=!1,t.scale=1/i.scale,t.category="ToolTip",null!==t.placeholder&&(t.placeholder.scale=i.scale);var n=t.diagram;null!==n&&n!==i&&n.remove(t),i.add(t),null!==e?t.adornedObject=e:t.data=i.model,t.Va(),this.positionToolTip(t,e)}else t instanceof xn&&t!==this.currentToolTip&&t.show(e,i,this);if(this.currentToolTip=t,-1!==this.zj&&(m.clearTimeout(this.zj),this.zj=-1),0<(t=this.toolTipDuration)&&1/0!==t){var o=this;this.zj=x((function(){o.hideToolTip()}),t)}},xi.prototype.positionToolTip=function(t){if(null===t.placeholder){var e=this.diagram,i=e.lastInput.documentPoint.copy(),n=t.measuredBounds,o=e.viewportBounds;e.lastInput.isTouchEvent&&(i.x-=n.width),i.x+n.width>o.right&&(i.x-=n.width+5/e.scale),i.x<o.x&&(i.x=o.x),i.y=i.y+20/e.scale+n.height>o.bottom?i.y-(n.height+5/e.scale):i.y+20/e.scale,i.y<o.y&&(i.y=o.y),t.position=i}},xi.prototype.hideToolTip=function(){-1!==this.zj&&(m.clearTimeout(this.zj),this.zj=-1);var t=this.diagram,e=this.currentToolTip;null!==e&&(e instanceof Wu?(t.remove(e),null!==this.Mp&&this.Mp.Jf(e.category),e.data=null,e.adornedObject=null):e instanceof xn&&null!==e.hide&&e.hide(t,this),this.currentToolTip=null)},xi.prototype.doMouseUp=function(){this.cancelWaitAfter();var t=this.diagram;if(this.isActive)for(var e=this.mouseUpTools.length,i=0;i<e;i++){var n=this.mouseUpTools.M(i);if(n.diagram=this.diagram,n.canStart())return t.doFocus(),t.currentTool=n,void(t.currentTool===n&&(n.isActive||n.doActivate(),n.doMouseUp()))}t.doFocus(),this.doDeactivate()},xi.prototype.doMouseWheel=function(){this.standardMouseWheel()},xi.prototype.doKeyDown=function(){var t=this.diagram;null!==t.commandHandler&&t.commandHandler.doKeyDown()},xi.prototype.doKeyUp=function(){var t=this.diagram;null!==t.commandHandler&&t.commandHandler.doKeyUp()},xi.prototype.findTool=function(t){for(var e=this.mouseDownTools.length,i=0;i<e;i++){var n=this.mouseDownTools.M(i);if(n.name===t)return n}for(e=this.mouseMoveTools.length,i=0;i<e;i++)if((n=this.mouseMoveTools.M(i)).name===t)return n;for(e=this.mouseUpTools.length,i=0;i<e;i++)if((n=this.mouseUpTools.M(i)).name===t)return n;return null},xi.prototype.replaceTool=function(t,e){null!==e&&(e.diagram=this.diagram);for(var i=this.mouseDownTools.length,n=0;n<i;n++){var o=this.mouseDownTools.M(n);if(o.name===t)return null!==e?this.mouseDownTools.cd(n,e):this.mouseDownTools.mb(n),o}for(i=this.mouseMoveTools.length,n=0;n<i;n++)if((o=this.mouseMoveTools.M(n)).name===t)return null!==e?this.mouseMoveTools.cd(n,e):this.mouseMoveTools.mb(n),o;for(i=this.mouseUpTools.length,n=0;n<i;n++)if((o=this.mouseUpTools.M(n)).name===t)return null!==e?this.mouseUpTools.cd(n,e):this.mouseUpTools.mb(n),o;return null},xi.prototype.gb=function(t,e,i){null!==e&&(e.name=t,e.diagram=this.diagram),this.findTool(t)?this.replaceTool(t,e):null!==e&&i.add(e)},d.Object.defineProperties(xi.prototype,{mouseWheelBehavior:{get:function(){return this.ia},set:function(t){this.ia=t}},gestureBehavior:{get:function(){return this.u},set:function(t){this.u=t}},currentToolTip:{get:function(){return this.j},set:function(t){this.j=t,this.Mp=null!==t&&t instanceof Wu?t.adornedPart:null}},mouseDownTools:{get:function(){return this.hb}},mouseMoveTools:{get:function(){return this.ob}},mouseUpTools:{get:function(){return this.Hb}},hoverDelay:{get:function(){return this.V},set:function(t){this.V=t}},holdDelay:{get:function(){return this.F},set:function(t){this.F=t}},dragSize:{get:function(){return this.o},set:function(t){this.o=t.J()}},toolTipDuration:{get:function(){return this.Ha},set:function(t){this.Ha=t}}}),xi.prototype.replaceStandardTool=xi.prototype.gb;var wi,ki=new V(xi,"WheelScroll",0),Si=new V(xi,"WheelZoom",1),Mi=new V(xi,"WheelNone",2),Ci=new V(xi,"GestureZoom",3),Pi=new V(xi,"GestureCancel",4),Ti=new V(xi,"GestureNone",5);function Ni(){vi.call(this),this.name="Dragging",this.u=this.Sw=this.ob=!0,this.o=this.Ha=this.V=this.Oe=null,this.Ym=this.Hb=!1,this.tl=new pt(NaN,NaN),this.Fr=new pt,this.hb=!0,this.Ik=100,this.Cg=[],this.te=(new Z).freeze(),this.ia=new Ss,this.Bn=null,this.F="copy",this.Oc="",this.Pc="no-drop"}function Li(t,e){if(t.dragsLink){var i=t.diagram;i.allowRelink&&(i.model.Wj()&&1===e.count&&e.first()instanceof wc?(t.draggedLink=e.first(),t.draggedLink.canRelinkFrom()&&t.draggedLink.canRelinkTo()&&t.draggedLink.Ej(),t.Oe=i.toolManager.findTool("Relinking"),null===t.Oe&&(t.Oe=new on,t.Oe.diagram=i),t.Oe.originalLink=t.draggedLink):(t.draggedLink=null,t.Oe=null))}}function Ai(t){var e=t.diagram,i=e.skipsUndoManager;e.skipsUndoManager=!0,zi(t,e.lastInput,null),e.skipsUndoManager=i,t.Cg.length=0}function Bi(){var t=qi;Fi(t),Oi(t);var e=t.diagram;t.tl.w()&&(e.position=t.tl),e.ug()}function Di(t,e){if(null===t.copiedParts){var i=t.diagram;if((!e||!i.isReadOnly&&!i.isModelReadOnly)&&null!==t.draggedParts){var n=i.undoManager;for(n.isEnabled&&n.isInTransaction?null!==n.currentTransaction&&0<n.currentTransaction.changes.count&&(i.undoManager.Kf(),i.Ea("Drag")):Oi(t),i.skipsUndoManager=!e,i.partManager.addsToTemporaryLayer=!e,t.startPoint=i.firstInput.documentPoint,e=t.copiesEffectiveCollection?t.draggedParts.Lf():i.selection,e=i.Kj(e,i,!0),i=new ft,n=t.draggedParts.iterator;n.next();){var o=n.key;if(o.Zc()&&o.canCopy()){var r=e.I(o);null!==r&&(r.location=o.location,r.Va(),i.add(r,t.Pd(r.location)))}}for(e=e.iterator;e.next();)(n=e.value)instanceof wc&&n.canCopy()&&i.add(n,t.Pd());t.copiedParts=i,Li(t,i.Lf()),null!==t.draggedLink&&(e=(i=t.draggedLink).routeBounds,Mc(i,t.startPoint.x-(e.x+e.width/2),t.startPoint.y-(e.y+e.height/2))),t.doUpdateCursor(null)}}}function Fi(t){var e=t.diagram;if(null!==t.copiedParts){if(e.Is(t.copiedParts.Lf(),!1),t.copiedParts=null,null!==t.draggedParts)for(var i=t.draggedParts.iterator;i.next();)i.key instanceof wc&&(i.value.point=new pt(0,0));t.doUpdateCursor(null)}e.skipsUndoManager=!1,e.partManager.addsToTemporaryLayer=!1,t.startPoint=e.firstInput.documentPoint}function ji(t){if(null!==t.draggedLink){if(t.dragsLink&&null!==t.Oe){var e=t.Oe;e.diagram.remove(e.temporaryFromNode),e.diagram.remove(e.temporaryToNode),t.Oe.originalLink=null}t.draggedLink=null,t.Oe=null}}function Ei(t,e,i){var n=t.diagram,o=t.startPoint,r=pt.alloc();r.assign(n.lastInput.documentPoint),t.moveParts(e,r.re(o),i),pt.free(r),!0===n.Gf("temporaryPixelRatio")&&null===n.Yh&&30<n.$w&&(Fo(n),n.hk())}function Oi(t){if(null!==t.draggedParts){for(var e=t.diagram,i=t.draggedParts.iterator;i.next();){var n=i.key;n.Zc()&&(n.location=i.value.point)}for(i=t.draggedParts.iterator;i.next();)if((n=i.key)instanceof wc&&n.suspendsRouting){var o=i.value.point;t.draggedParts.add(n,t.Pd()),Mc(n,-o.x,-o.y)}e.bd()}}function Ii(t,e){var i=t.diagram;t.dragsLink&&(null!==t.draggedLink&&(t.draggedLink.fromNode=null,t.draggedLink.toNode=null),Gi(t,!1));var n=t.findDragOverObject(e),o=i.lastInput;o.targetObject=n,t.doUpdateCursor(n);var r=i.skipsUndoManager,s=!1;try{if(i.skipsUndoManager=!0,s=zi(t,o,n),!t.isActive&&null===qi)return;var a=null!==n?n.part:null;if(null===a||i.handlesDragDropForTopLevelParts&&a.isTopLevel&&!(a instanceof gc)){var h=i.mouseDragOver;null!==h&&(h(o),s=!0)}if(!t.isActive&&null===qi)return;if(t.doDragOver(e,n),!t.isActive&&null===qi)return}finally{i.skipsUndoManager=r,s&&i.bd()}t.Bn=n,i.isReadOnly||!i.allowMove&&!i.allowCopy||!i.allowHorizontalScroll&&!i.allowVerticalScroll||i.gs(o.viewPoint)}function zi(t,e,i){var n=!1,o=t.Cg.length,r=0<o?t.Cg[0]:null;if(i===r)return!1;e.handled=!1;for(var s=0;s<o;s++){var a=t.Cg[s],h=a.mouseDragLeave;if(null!==h&&(h(e,a,i),n=!0,e.handled))break}if(t.Cg.length=0,!t.isActive&&null===qi||null===i)return n;for(e.handled=!1,o=i;null!==o;)t.Cg.push(o),o=Ri(o);for(o=t.Cg.length,i=0;i<o&&(null===(a=(s=t.Cg[i]).mouseDragEnter)||(a(e,s,r),n=!0,!e.handled));i++);return n}function Ri(t){var e=t.panel;return null!==e?e:t instanceof ku&&!(t instanceof gc)&&(null!==(t=t.containingGroup)&&t.handlesDragDropForMembers)?t:null}function Vi(t,e,i){var n=t.Oe;if(null===n)return null;var o=t.diagram.og(e,n.portGravity,(function(t){return n.findValidLinkablePort(t,i)}));t=pt.alloc();var r=1/0,s=null;for(o=o.iterator;o.next();){var a=o.value;if(null!==a.part){var h=a.ga(oe,t);(h=e.Bf(h))<r&&(s=a,r=h)}}return pt.free(t),s}function Gi(t,e){var i=t.draggedLink;if(null!==i&&!(2>i.pointsCount)){var n=t.diagram;if(!n.isReadOnly){var o=t.Oe;if(null!==o){var r=null,s=null;null===i.fromNode&&(null!==(r=Vi(t,i.i(0),!1))&&(s=r.part));var a=null,h=null;null===i.toNode&&(null!==(a=Vi(t,i.i(i.pointsCount-1),!0))&&(h=a.part)),o.isValidLink(s,r,h,a)?e?(i.defaultFromPoint=i.i(0),i.defaultToPoint=i.i(i.pointsCount-1),i.suspendsRouting=!1,i.fromNode=s,null!==r&&(i.fromPortId=r.portId),i.toNode=h,null!==a&&(i.toPortId=a.portId),i.fromPort!==n.Mx&&n.R("LinkRelinked",i,n.Mx),i.toPort!==n.Nx&&n.R("LinkRelinked",i,n.Nx)):rn(o,s,r,h,a):rn(o,null,null,null,null)}}}}function Hi(t,e){var i=t.diagram;t.dragsLink&&Gi(t,!0),Ai(t);var n=t.findDragOverObject(e),o=i.lastInput;if(o.targetObject=n,null!==n){o.handled=!1;for(var r=n;null!==r;){var s=r.mouseDrop;if(null!==s&&(s(o,r),o.handled))break;Yi(t,o,r),r=Ri(r)}}else null!==(r=i.mouseDrop)&&r(o);if(t.isActive||null!==qi){for(o=(t.copiedParts||t.draggedParts).iterator;o.next();)(r=o.key)instanceof _u&&r.linksConnected.each((function(t){t.suspendsRouting=!1}));if(t.doDropOnto(e,n),t.isActive||null!==qi){for(t=jt.alloc(),e=i.selection.iterator;e.next();)(n=e.value)instanceof _u&&Xi(i,n,t);jt.free(t)}}}function Yi(t,e,i){t=t.diagram,i=i.part,!t.handlesDragDropForTopLevelParts||!i.isTopLevel||i instanceof gc||null!==(i=t.mouseDrop)&&i(e)}function Xi(t,e,i){var n=!1;if(i=e.getAvoidableRect(i),t.viewportBounds.Re(i)&&(n=!0),0!==(t=t.Nu(i,(function(t){return t.part}),(function(t){return t instanceof wc}),!0,(function(t){return t instanceof wc}),n)).count)for(t=t.iterator;t.next();)!(i=t.value).Td(e)&&i.isAvoiding&&i.bb()}function Ui(t,e,i,n){if(null===t.copiedParts){var o=t.diagram;if(!o.isReadOnly&&!o.isModelReadOnly){o.skipsUndoManager=!i,o.partManager.addsToTemporaryLayer=!i,t.startPoint=n.documentPoint,i=o.Kj(e,o,!0);var r=jt.alloc();o=n=1/0;for(var s=-1/0,a=-1/0,h=e.iterator;h.next();){var l=h.value;if(l.isVisible()){var u=l.location;l=u.x,u=u.y,isNaN(l)||isNaN(u)||(l<n&&(n=l),u<o&&(o=u),l>s&&(s=l),u>a&&(a=u))}}for(1/0===n?r.h(0,0,0,0):r.h(n,o,s-n,a-o),n=r.x+r.width/2,o=r.y+r.height/2,jt.free(r),r=t.Fr,s=new ft,a=pt.alloc(),h=e.iterator;h.next();)(l=h.value)instanceof wc&&l.canCopy()&&(null!==(u=i.I(l))&&(u.points=l.points,Mc(u,r.x-n,r.y-o),u.suspendsRouting=!0,s.add(u,t.Pd())));for(e=e.iterator;e.next();)(l=e.value).Zc()&&l.canCopy()&&(null!==(h=i.I(l))&&(l=l.location,a.h(r.x-(n-l.x),r.y-(o-l.y)),h.location=a,h.Va(),s.add(h,t.Pd(a))));pt.free(a),t.copiedParts=s,Li(t,s.Lf()),null!==t.draggedLink&&(e=(i=t.draggedLink).routeBounds,Mc(i,t.startPoint.x-(e.x+e.width/2),t.startPoint.y-(e.y+e.height/2))),t.doUpdateCursor(null)}}}xi.className="ToolManager",xi.WheelScroll=ki,xi.WheelZoom=Si,xi.WheelNone=Mi,xi.GestureZoom=Ci,xi.GestureCancel=Pi,xi.GestureNone=Ti,c(Ni,vi),Ni.prototype.canStart=function(){if(!this.isEnabled)return!1;var t=this.diagram;if(t.isReadOnly&&!t.allowDragOut||!t.allowMove&&!t.allowCopy&&!t.allowDragOut||!t.allowSelect)return!1;var e=t.lastInput;return!(!e.left||t.currentTool!==this&&(!this.isBeyondDragSize()||e.isTouchEvent&&e.timestamp-t.firstInput.timestamp<this.Ik))&&null!==this.findDraggablePart()},Ni.prototype.findDraggablePart=function(){var t=this.diagram;if(null===(t=t.Ol(t.firstInput.documentPoint,!1)))return null;for(;null!==t&&!t.canSelect();)t=t.containingGroup;return null!==t&&(t.canMove()||t.canCopy())?t:null},Ni.prototype.standardMouseSelect=function(){var t=this.diagram;if(t.allowSelect){var e=t.Ol(t.firstInput.documentPoint,!1);if(null!==e){for(;null!==e&&!e.canSelect();)e=e.containingGroup;this.currentPart=e,null===this.currentPart||this.currentPart.isSelected||(t.R("ChangingSelection",t.selection),e=t.lastInput,(z?e.meta:e.control)||e.shift||t.clearSelection(!0),this.currentPart.isSelected=!0,t.R("ChangedSelection",t.selection))}}},Ni.prototype.doActivate=function(){var t=this.diagram;this.Bn=null,null===this.currentPart&&this.standardMouseSelect();var e=this.currentPart;null!==e&&(e.canMove()||e.canCopy())&&(t.Fu(!0),qi=null,this.isActive=!0,this.tl.set(t.position),Li(this,t.selection),this.Cg.length=0,t.animationManager.Cc(),this.draggedParts=this.computeEffectiveCollection(t.selection,this.dragOptions),this.Sw=this.diagram.layout.isRealtime,this.diagram.layout.isRealtime=!1,t.Ns=!0,!0===t.Gf("temporaryPixelRatio")&&30<t.$w&&Fo(t),dr(t,this.draggedParts),this.Ea("Drag"),this.startPoint=t.firstInput.documentPoint,t.isMouseCaptured=!0,t.allowDragOut&&(this.isDragOutStarted=!0,this.Ym=!1,qi=this,Wi=this.diagram,this.doSimulatedDragOut()))},Ni.prototype.computeEffectiveCollection=function(t,e){return this.diagram.commandHandler.computeEffectiveCollection(t,e)},Ni.prototype.Pd=function(t){return void 0===t?new us(it):this.isGridSnapEnabled?new us(new pt(Math.round(1e3*t.x)/1e3,Math.round(1e3*t.y)/1e3)):new us(t.copy())},Ni.prototype.doDeactivate=function(){this.isActive=!1;var t=this.diagram;if(this.diagram.layout.isRealtime=this.Sw,t.Fu(!1),t.ug(),Ai(this),fr(t,this.draggedParts),this.draggedParts=this.currentPart=this.Bn=null,this.Ym=this.isDragOutStarted=!1,0<wi.count){for(var e=wi,i=e.length,n=0;n<i;n++){var o=e.M(n);ji(o),Fi(o),Ai(o),o.diagram.ug()}e.clear()}ji(this),this.tl.h(NaN,NaN),null!==Wi&&(Wi.currentCursor=""),qi=Wi=null,Fi(this),t.isMouseCaptured=!1,t.currentCursor="",t.Ns=!1,this.stopTransaction(),jo(t,!0)},Ni.prototype.stopTransaction=function(){var t=this.diagram,e=vi.prototype.stopTransaction.call(this);return e&&null!==t.undoManager.transactionToUndo&&t.undoManager.transactionToUndo.ak(),e},Ni.prototype.doCancel=function(){Fi(this),Oi(this);var t=this.diagram;this.tl.w()&&(t.position=this.tl),this.stopTool()},Ni.prototype.doKeyDown=function(){var t=this.diagram,e=t.lastInput;this.isActive&&("Esc"===e.key?this.doCancel():e.key!==t.previousInput.key&&this.doMouseMove())},Ni.prototype.doKeyUp=function(){this.isActive&&this.doMouseMove()},Ni.prototype.moveParts=function(t,e,i){void 0===i&&(i=!1);var n=this.diagram;null!==n&&lr(n,t,e,this.dragOptions,i)},Ni.prototype.findDragOverObject=function(t){var e=this;return Xo(this.diagram,t,null,(function(t){return null===t?t=!0:t=!!(null===(t=t.part)||t instanceof Wu||t.layer.isTemporary||e.draggedParts&&e.draggedParts.contains(t)||e.copiedParts&&e.copiedParts.contains(t)),!t}))},Ni.prototype.doUpdateCursor=function(t){var e=this.diagram;null!==t&&this.Bn===t||(!this.diagram.currentTool.isActive||this.mayCopy()?e.currentCursor=this.copyCursor:this.mayMove()?e.currentCursor=this.moveCursor:this.mayDragOut()&&(e.currentCursor=this.nodropCursor))},Ni.prototype.doDragOver=function(){},Ni.prototype.doDropOnto=function(){},Ni.prototype.doMouseMove=function(){if(this.isActive){var t=this.diagram,e=t.lastInput;this.simulatedMouseMove(e.event,e.documentPoint,e.targetDiagram)||null===this.currentPart||null===this.draggedParts||(this.mayCopy()?(Di(this,!1),dr(t,this.copiedParts),Ei(this,this.copiedParts,!1),fr(t,this.copiedParts)):this.mayMove()?(Fi(this),Ei(this,this.draggedParts,!0)):this.mayDragOut()?(Di(this,!1),Ei(this,this.copiedParts,!1)):Fi(this),Ii(this,t.lastInput.documentPoint))}},Ni.prototype.doMouseUp=function(){if(this.isActive){var t=this.diagram,e=t.lastInput;if(!this.simulatedMouseUp(e.event,e.documentPoint,e.targetDiagram)){e=!1;var i=this.mayCopy();if(i&&null!==this.copiedParts?(Fi(this),Di(this,!0),dr(t,this.copiedParts),Ei(this,this.copiedParts,!1),fr(t,this.copiedParts),null!==this.copiedParts&&(t.R("ChangingSelection",t.selection),t.clearSelection(!0),this.copiedParts.iteratorKeys.each((function(t){t.isSelected=!0})))):(e=!0,Fi(this),this.mayMove()&&(Ei(this,this.draggedParts,!0),Ii(this,t.lastInput.documentPoint))),this.Ym=!0,Hi(this,t.lastInput.documentPoint),this.isActive){var n=i?this.copiedParts.Lf():this.draggedParts.Lf();this.copiedParts=null,e&&function(t){if(null!==t.draggedParts)for(var e=t.draggedParts.iterator;e.next();){var i=e.key;i instanceof _u&&(null===(i=i.containingGroup)||null===i.placeholder||t.draggedParts.contains(i)||i.placeholder.v())}}(this),t.Ya(),fr(t,this.draggedParts),this.transactionResult=i?"Copy":"Move",t.R(i?"SelectionCopied":"SelectionMoved",n)}this.stopTool(),i&&t.R("ChangedSelection",t.selection)}}},Ni.prototype.simulatedMouseMove=function(t,e,i){if(null===qi)return!1;var n=qi.diagram;i instanceof No||(i=null);var o=Wi;return i!==o&&(null!==o&&o!==n&&(o.ug(),qi.isDragOutStarted=!1,null!==(o=o.toolManager.findTool("Dragging"))&&o.doSimulatedDragLeave()),Wi=i,null!==i&&i!==n&&(Bi(),null!==(o=i.toolManager.findTool("Dragging"))&&(wi.contains(o)||wi.add(o),o.doSimulatedDragEnter())),this.doUpdateCursor(null)),!(null===i||i===n||!i.allowDrop||i.isReadOnly||!i.allowInsert)&&(null!==(n=i.toolManager.findTool("Dragging"))&&(null!==t&&(void 0!==t.targetTouches&&(0<t.targetTouches.length?t=t.targetTouches[0]:0<t.changedTouches.length&&(t=t.changedTouches[0])),e=i.getMouse(t)),i.lastInput.documentPoint=e,i.lastInput.viewPoint=i.op(e),i.lastInput.down=!1,i.lastInput.up=!1,n.doSimulatedDragOver()),!0)},Ni.prototype.simulatedMouseUp=function(t,e,i){if(null===qi)return!1;var n=Wi,o=qi.diagram;if(null===i)return qi.doCancel(),!0;if(i!==n){var r=n.toolManager.findTool("Dragging");if(null!==n&&n!==o&&null!==r)return n.ug(),qi.isDragOutStarted=!1,r.doSimulatedDragLeave(),!1;Wi=i,null!==(n=i.toolManager.findTool("Dragging"))&&(Bi(),wi.contains(n)||wi.add(n),n.doSimulatedDragEnter())}return i!==this.diagram&&(null!==t?(void 0!==t.targetTouches&&(0<t.targetTouches.length?t=t.targetTouches[0]:0<t.changedTouches.length&&(t=t.changedTouches[0])),e=i.getMouse(t)):null===e&&(e=new pt),i.lastInput.documentPoint=e,i.lastInput.viewPoint=i.op(e),i.lastInput.down=!1,i.lastInput.up=!0,null!==(t=i.toolManager.findTool("Dragging"))&&t.doSimulatedDrop(),null!==(t=qi)&&(i=t.mayCopy(),t.transactionResult=i?"Copy":"Move",t.stopTool()),!0)},Ni.prototype.mayCopy=function(){if(!this.isCopyEnabled)return!1;var t=this.diagram;if(t.isReadOnly||t.isModelReadOnly||!t.allowInsert||!t.allowCopy||(z?!t.lastInput.alt:!t.lastInput.control))return!1;for(t=t.selection.iterator;t.next();)if(t.value.canCopy())return!0;return!(null===this.draggedLink||!this.dragsLink||!this.draggedLink.canCopy())},Ni.prototype.mayDragOut=function(){if(!this.isCopyEnabled)return!1;var t=this.diagram;if(!t.allowDragOut||!t.allowCopy||t.allowMove)return!1;for(t=t.selection.iterator;t.next();)if(t.value.canCopy())return!0;return!(null===this.draggedLink||!this.dragsLink||!this.draggedLink.canCopy())},Ni.prototype.mayMove=function(){var t=this.diagram;if(t.isReadOnly||!t.allowMove)return!1;for(t=t.selection.iterator;t.next();)if(t.value.canMove())return!0;return!(null===this.draggedLink||!this.dragsLink||!this.draggedLink.canMove())},Ni.prototype.computeBorder=function(t,e,i){return this.Ym||null===this.draggedParts||this.draggedParts.contains(t)?null:i.assign(e)},Ni.prototype.Az=function(){return qi},Ni.prototype.mayDragIn=function(){var t=this.diagram;if(!t.allowDrop||t.isReadOnly||t.isModelReadOnly||!t.allowInsert)return!1;return null!==qi&&qi.diagram.model.dataFormat===t.model.dataFormat},Ni.prototype.doSimulatedDragEnter=function(){if(this.mayDragIn()){var t=this.diagram;t.animationManager.Cc(),Zo(t),t.animationManager.Cc(),null!==(t=qi)&&(t.diagram.Ns=!1),this.doUpdateCursor(null)}},Ni.prototype.doSimulatedDragLeave=function(){null!==qi&&qi.doSimulatedDragOut(),this.doCancel()},Ni.prototype.doSimulatedDragOver=function(){var t=this.diagram;t.animationManager.Dm=!0;var e=qi;if(null!==e&&null!==e.draggedParts){if(!this.mayDragIn())return;Ui(this,e.draggedParts.Lf(),!1,t.firstInput),Ei(this,this.copiedParts,!1),Ii(this,t.lastInput.documentPoint)}t.animationManager.Dm=!1},Ni.prototype.doSimulatedDrop=function(){var t=this.diagram,e=qi;if(null!==e){var i=e.diagram;if(e.Ym=!0,Fi(this),!this.mayDragIn())return;t.animationManager.Dm=!0,t.R("ChangingSelection",t.selection),this.Ea("Drop"),Ui(this,e.draggedParts.Lf(),!0,t.lastInput),Ei(this,this.copiedParts,!1);var n=new Z;null!==this.copiedParts&&(t.clearSelection(!0),this.copiedParts.iteratorKeys.each((function(t){t.isSelected=!0,n.add(t)}))),Hi(this,t.lastInput.documentPoint),t.Ya(),null!==this.copiedParts&&(this.transactionResult="ExternalCopy"),this.copiedParts=null,t.doFocus(),t.R("ExternalObjectsDropped",n,i),this.stopTransaction(),t.R("ChangedSelection",t.selection)}t.animationManager.Dm=!1},Ni.prototype.doSimulatedDragOut=function(){var t=this.diagram;t.Ns=!1,this.mayCopy()||this.mayMove()?t.currentCursor="":t.currentCursor=this.nodropCursor,this.Bn=null},Ni.prototype.computeMove=function(t,e,i,n){return null!==(i=this.diagram)?i.computeMove(t,e,this.dragOptions,n):new pt},d.Object.defineProperties(Ni.prototype,{isCopyEnabled:{get:function(){return this.ob},set:function(t){this.ob=t}},copiesEffectiveCollection:{get:function(){return this.u},set:function(t){this.u=t}},dragOptions:{get:function(){return this.ia},set:function(t){this.ia=t}},isGridSnapEnabled:{get:function(){return this.dragOptions.isGridSnapEnabled},set:function(t){this.dragOptions.isGridSnapEnabled=t}},isComplexRoutingRealtime:{get:function(){return this.hb},set:function(t){this.hb=t}},isGridSnapRealtime:{get:function(){return this.dragOptions.isGridSnapRealtime},set:function(t){this.dragOptions.isGridSnapRealtime=t}},gridSnapCellSize:{get:function(){return this.dragOptions.gridSnapCellSize},set:function(t){this.dragOptions.gridSnapCellSize.D(t)||(t=t.J(),this.dragOptions.gridSnapCellSize=t)}},gridSnapCellSpot:{get:function(){return this.dragOptions.gridSnapCellSpot},set:function(t){this.dragOptions.gridSnapCellSpot.D(t)||(t=t.J(),this.dragOptions.gridSnapCellSpot=t)}},gridSnapOrigin:{get:function(){return this.dragOptions.gridSnapOrigin},set:function(t){this.dragOptions.gridSnapOrigin.D(t)||(t=t.J(),this.dragOptions.gridSnapOrigin=t)}},dragsLink:{get:function(){return this.dragOptions.dragsLink},set:function(t){this.dragOptions.dragsLink=t}},dragsTree:{get:function(){return this.dragOptions.dragsTree},set:function(t){this.dragOptions.dragsTree=t}},copyCursor:{get:function(){return this.F},set:function(t){this.F=t}},moveCursor:{get:function(){return this.Oc},set:function(t){this.Oc=t}},nodropCursor:{get:function(){return this.Pc},set:function(t){this.Pc=t}},currentPart:{get:function(){return this.V},set:function(t){this.V=t}},copiedParts:{get:function(){return this.o},set:function(t){this.o=t}},draggedParts:{get:function(){return this.Ha},set:function(t){this.Ha=t}},draggingParts:{get:function(){return null!==this.copiedParts?this.copiedParts.Lf():null!==this.draggedParts?this.draggedParts.Lf():this.te}},draggedLink:{get:function(){return this.diagram.draggedLink},set:function(t){this.diagram.draggedLink=t}},isDragOutStarted:{get:function(){return this.Hb},set:function(t){this.Hb=t}},startPoint:{get:function(){return this.Fr},set:function(t){this.Fr.D(t)||this.Fr.assign(t)}},delay:{get:function(){return this.Ik},set:function(t){this.Ik=t}}}),Ni.prototype.getDraggingSource=Ni.prototype.Az;var qi=null,Wi=null;function Ki(){vi.call(this),this.te=100,this.Ha=!1,this.u="pointer";var t=new wc,e=new pl;e.isPanelMain=!0,e.stroke="blue",t.add(e),(e=new pl).toArrow="Standard",e.fill="blue",e.stroke="blue",t.add(e),t.layerName="Tool",this.Ci=t,t=new _u,(e=new pl).portId="",e.figure="Rectangle",e.fill=null,e.stroke="magenta",e.strokeWidth=2,e.desiredSize=St,t.add(e),t.selectable=!1,t.layerName="Tool",this.Bi=t,this.j=e,t=new _u,(e=new pl).portId="",e.figure="Rectangle",e.fill=null,e.stroke="magenta",e.strokeWidth=2,e.desiredSize=St,t.add(e),t.selectable=!1,t.layerName="Tool",this.Di=t,this.o=e,this.Pc=this.Oc=this.ob=this.hb=this.Hb=null,this.ia=!0,this.hy=new ft,this.Of=this.gj=this.Pf=null}function _i(t,e,i,n){if(e===i)return!0;var o=e.fromNode;return!(null===o||!o.isLinkLabel||(n.add(o),!_i(t,o.labeledLink,i,n)))||!(null===(e=e.toNode)||!e.isLinkLabel||(n.add(e),!_i(t,e.labeledLink,i,n)))}function $i(t,e,i,n,o){if(e===i)return!0;if(null===e||null===i)return!1;for(var r=e.linksConnected;r.next();){var s=r.value;if(s!==n&&(!o||s.isTreeLink)&&s.toNode===e&&((s=s.fromNode)!==e&&$i(t,s,i,n,o)))return!0}return!1}function Ji(t,e,i,n,o){if(i===n)return!0;if(null===i||null===n||e.contains(i))return!1;e.add(i);for(var r=i.linksConnected;r.next();){var s=r.value;if(s!==o&&s.toNode===i&&((s=s.fromNode)!==i&&Ji(t,e,s,n,o)))return!0}return!1}function Zi(t,e,i,n,o){if(i===n)return!0;if(null===i||null===n||e.contains(i))return!1;e.add(i);for(var r=i.linksConnected;r.next();){var s=r.value;if(s!==o){var a=s.fromNode;if(s=s.toNode,(a=a===i?s:a)!==i&&Zi(t,e,a,n,o))return!0}}return!1}function Qi(){Ki.call(this),this.name="Linking",this.V={},this.F=null,this.K=tn,this.Xd=null}Ni.className="DraggingTool",wi=new $,E("draggingTool",(function(){return this.findTool("Dragging")}),(function(t){this.gb("Dragging",t,this.mouseMoveTools)})),xi.prototype.doCancel=function(){null!==qi&&qi.doCancel(),vi.prototype.doCancel.call(this)},c(Ki,vi),Ki.prototype.doStop=function(){this.diagram.ug(),this.originalToPort=this.originalToNode=this.originalFromPort=this.originalFromNode=this.originalLink=null,this.validPortsCache.clear(),this.targetPort=null},Ki.prototype.copyPortProperties=function(t,e,i,n,o){if(null!==t&&null!==e&&null!==i&&null!==n){var r=e.Df(),s=At.alloc();s.width=e.naturalBounds.width*r,s.height=e.naturalBounds.height*r,n.desiredSize=s,At.free(s),o?(n.toSpot=e.toSpot,n.toEndSegmentLength=e.toEndSegmentLength):(n.fromSpot=e.fromSpot,n.fromEndSegmentLength=e.fromEndSegmentLength),i.locationSpot=oe,r=pt.alloc(),i.location=e.ga(oe,r),pt.free(r),n.angle=e.li(),null!==this.portTargeted&&this.portTargeted(t,e,i,n,o)}},Ki.prototype.setNoTargetPortProperties=function(t,e,i){null!==e&&(e.desiredSize=St,e.fromSpot=Qt,e.toSpot=Qt),null!==t&&(t.location=this.diagram.lastInput.documentPoint),null!==this.portTargeted&&this.portTargeted(null,null,t,e,i)},Ki.prototype.doMouseDown=function(){this.isActive&&this.doMouseMove()},Ki.prototype.doMouseMove=function(){if(this.isActive){var t=this.diagram;if(this.targetPort=this.findTargetPort(this.isForwards),null!==this.targetPort&&this.targetPort.part instanceof _u){var e=this.targetPort.part;this.isForwards?this.copyPortProperties(e,this.targetPort,this.temporaryToNode,this.temporaryToPort,!0):this.copyPortProperties(e,this.targetPort,this.temporaryFromNode,this.temporaryFromPort,!1)}else this.isForwards?this.setNoTargetPortProperties(this.temporaryToNode,this.temporaryToPort,!0):this.setNoTargetPortProperties(this.temporaryFromNode,this.temporaryFromPort,!1);(t.allowHorizontalScroll||t.allowVerticalScroll)&&t.gs(t.lastInput.viewPoint)}},Ki.prototype.findValidLinkablePort=function(t,e){if(null===t)return null;var i=t.part;if(!(i instanceof _u))return null;for(;null!==t;){var n=e?t.toLinkable:t.fromLinkable;if(!0===n&&(null!==t.portId||t instanceof _u)&&(e?this.isValidTo(i,t):this.isValidFrom(i,t)))return t;if(!1===n)break;t=t.panel}return null},Ki.prototype.findTargetPort=function(t){var e=this.diagram,i=e.lastInput.documentPoint,n=this.portGravity;0>=n&&(n=.1);var o=this,r=e.og(i,n,(function(e){return o.findValidLinkablePort(e,t)}),null,!0);for(n=1/0,e=null,r=r.iterator;r.next();){var s=r.value,a=s.part;if(a instanceof _u){var h=s.ga(oe,pt.alloc()),l=i.x-h.x,u=i.y-h.y;pt.free(h),(h=l*l+u*u)<n&&(null!==(l=this.validPortsCache.I(s))?l&&(e=s,n=h):t&&this.isValidLink(this.originalFromNode,this.originalFromPort,a,s)||!t&&this.isValidLink(a,s,this.originalToNode,this.originalToPort)?(this.validPortsCache.add(s,!0),e=s,n=h):this.validPortsCache.add(s,!1))}}return null!==e&&((i=e.part)instanceof _u&&(null===i.layer||i.layer.allowLink))?e:null},Ki.prototype.isValidFrom=function(t,e){if(null===t||null===e)return this.isUnconnectedLinkValid;if(this.diagram.currentTool===this&&(null!==t.layer&&!t.layer.allowLink||!0!==e.fromLinkable))return!1;var i=e.fromMaxLinks;if(1/0>i){if(null!==this.originalLink&&t===this.originalFromNode&&e===this.originalFromPort)return!0;if(null===(e=e.portId)&&(e=""),t.Mo(e).count>=i)return!1}return!0},Ki.prototype.isValidTo=function(t,e){if(null===t||null===e)return this.isUnconnectedLinkValid;if(this.diagram.currentTool===this&&(null!==t.layer&&!t.layer.allowLink||!0!==e.toLinkable))return!1;var i=e.toMaxLinks;if(1/0>i){if(null!==this.originalLink&&t===this.originalToNode&&e===this.originalToPort)return!0;if(null===(e=e.portId)&&(e=""),t.Sd(e).count>=i)return!1}return!0},Ki.prototype.isInSameNode=function(t,e){return null!==t&&null!==e&&(t===e||(t=t.part,e=e.part,null!==t&&t===e))},Ki.prototype.isLinked=function(t,e){if(null===t||null===e)return!1;var i=t.part;if(!(i instanceof _u))return!1;null===(t=t.portId)&&(t="");var n=e.part;if(!(n instanceof _u))return!1;for(null===(e=e.portId)&&(e=""),e=n.Sd(e);e.next();)if((n=e.value).fromNode===i&&n.fromPortId===t)return!0;return!1},Ki.prototype.isValidLink=function(t,e,i,n){if(!this.isValidFrom(t,e)||!this.isValidTo(i,n)||!(null===e||null===n||(e.fromLinkableSelfNode&&n.toLinkableSelfNode||!this.isInSameNode(e,n))&&(e.fromLinkableDuplicates&&n.toLinkableDuplicates||!this.isLinked(e,n)))||null!==this.originalLink&&(null!==t&&this.isLabelDependentOnLink(t,this.originalLink)||null!==i&&this.isLabelDependentOnLink(i,this.originalLink))||null!==t&&null!==i&&(null===t.data&&null!==i.data||null!==t.data&&null===i.data)||!this.isValidCycle(t,i,this.originalLink))return!1;if(null!==t){var o=t.linkValidation;if(null!==o&&!o(t,e,i,n,this.originalLink))return!1}return!(null!==i&&null!==(o=i.linkValidation)&&!o(t,e,i,n,this.originalLink))&&(null===(o=this.linkValidation)||o(t,e,i,n,this.originalLink))},Ki.prototype.isLabelDependentOnLink=function(t,e){if(null===t)return!1;var i=t.labeledLink;if(null===i)return!1;if(i===e)return!0;var n=new Z;return n.add(t),_i(this,i,e,n)},Ki.prototype.isValidCycle=function(t,e,i){if(void 0===i&&(i=null),null===t||null===e)return this.isUnconnectedLinkValid;var n=this.diagram.validCycle;if(n!==qr){if(n===$r){if(null!==(n=i||this.temporaryLink)&&!n.isTreeLink)return!0;for(n=e.linksConnected;n.next();){var o=n.value;if(o!==i&&o.isTreeLink&&o.toNode===e)return!1}return!$i(this,t,e,i,!0)}if(n===Jr){if(null!==(n=i||this.temporaryLink)&&!n.isTreeLink)return!0;for(n=t.linksConnected;n.next();)if((o=n.value)!==i&&o.isTreeLink&&o.fromNode===t)return!1;return!$i(this,t,e,i,!0)}if(n===Wr)return t===e?t=!0:((n=new Z).add(e),t=Ji(this,n,t,e,i)),!t;if(n===Kr)return!$i(this,t,e,i,!1);if(n===_r)return t===e?t=!0:((n=new Z).add(e),t=Zi(this,n,t,e,i)),!t}return!0},d.Object.defineProperties(Ki.prototype,{portGravity:{get:function(){return this.te},set:function(t){0<=t&&(this.te=t)}},isUnconnectedLinkValid:{get:function(){return this.Ha},set:function(t){this.Ha=t}},linkingCursor:{get:function(){return this.u},set:function(t){this.u=t}},temporaryLink:{get:function(){return this.Ci},set:function(t){this.Ci=t}},temporaryFromNode:{get:function(){return this.Bi},set:function(t){(this.Bi=t)&&(this.j=t.port)}},temporaryFromPort:{get:function(){return this.j},set:function(t){if(null!==this.j){var e=this.j.panel;if(null!==e){var i=e.O.indexOf(this.j);e.mb(i),e.Gb(i,t)}}this.j=t}},temporaryToNode:{get:function(){return this.Di},set:function(t){(this.Di=t)&&(this.o=t.port)}},temporaryToPort:{get:function(){return this.o},set:function(t){if(null!==this.o){var e=this.o.panel;if(null!==e){var i=e.O.indexOf(this.o);e.mb(i),e.Gb(i,t)}}this.o=t}},originalLink:{get:function(){return this.Hb},set:function(t){this.Hb=t}},originalFromNode:{get:function(){return this.hb},set:function(t){this.hb=t}},originalFromPort:{get:function(){return this.ob},set:function(t){this.ob=t}},originalToNode:{get:function(){return this.Oc},set:function(t){this.Oc=t}},originalToPort:{get:function(){return this.Pc},set:function(t){this.Pc=t}},isForwards:{get:function(){return this.ia},set:function(t){this.ia=t}},validPortsCache:{get:function(){return this.hy}},targetPort:{get:function(){return this.Pf},set:function(t){this.Pf=t}},linkValidation:{get:function(){return this.gj},set:function(t){this.gj=t}},portTargeted:{get:function(){return this.Of},set:function(t){this.Of=t}}}),Ki.className="LinkingBaseTool",c(Qi,Ki),Qi.prototype.canStart=function(){if(!this.isEnabled)return!1;var t=this.diagram;return!(t.isReadOnly||t.isModelReadOnly||!t.allowLink||!t.model.xs()||!t.lastInput.left||t.currentTool!==this&&!this.isBeyondDragSize())&&null!==this.findLinkablePort()},Qi.prototype.findLinkablePort=function(){var t=this.diagram,e=this.startObject;if(null===e&&(e=t.ic(t.firstInput.documentPoint,null,null)),null===e)return null;if(!((t=e.part)instanceof _u))return null;var i=this.direction;if(i===tn||i===en){var n=this.findValidLinkablePort(e,!1);if(null!==n||this.startObject===t&&(n=t.port,this.findValidLinkablePort(n,!1)))return this.isForwards=!0,n}return(i===tn||i===nn)&&(null!==(e=this.findValidLinkablePort(e,!0))||this.startObject===t&&(e=t.port,this.findValidLinkablePort(e,!0)))?(this.isForwards=!1,e):null},Qi.prototype.doActivate=function(){var t=this.diagram,e=this.findLinkablePort();null===e?this.stopTool():(this.Ea(this.name),t.isMouseCaptured=!0,t.currentCursor=this.linkingCursor,this.isForwards?(null!==this.temporaryToNode&&(this.temporaryToNode.location=t.lastInput.documentPoint),this.originalFromPort=e,(e=this.originalFromPort.part)instanceof _u&&(this.originalFromNode=e),this.copyPortProperties(this.originalFromNode,this.originalFromPort,this.temporaryFromNode,this.temporaryFromPort,!1)):(null!==this.temporaryFromNode&&(this.temporaryFromNode.location=t.lastInput.documentPoint),this.originalToPort=e,(e=this.originalToPort.part)instanceof _u&&(this.originalToNode=e),this.copyPortProperties(this.originalToNode,this.originalToPort,this.temporaryToNode,this.temporaryToPort,!0)),t.add(this.temporaryFromNode),this.temporaryFromNode&&this.temporaryFromNode.Va(),t.add(this.temporaryToNode),this.temporaryToNode&&this.temporaryToNode.Va(),null!==this.temporaryLink&&(null!==this.temporaryFromNode&&(this.temporaryLink.fromNode=this.temporaryFromNode),null!==this.temporaryToNode&&(this.temporaryLink.toNode=this.temporaryToNode),this.temporaryLink.isTreeLink=this.isNewTreeLink(),this.temporaryLink.bb(),t.add(this.temporaryLink)),this.isActive=!0)},Qi.prototype.doDeactivate=function(){this.isActive=!1;var t=this.diagram;t.remove(this.temporaryLink),t.remove(this.temporaryFromNode),t.remove(this.temporaryToNode),t.isMouseCaptured=!1,t.currentCursor="",this.stopTransaction()},Qi.prototype.doStop=function(){Ki.prototype.doStop.call(this),this.startObject=null},Qi.prototype.doMouseUp=function(){if(this.isActive){var t=this.diagram,e=this.transactionResult=null,i=null,n=null,o=null,r=null;try{var s=this.targetPort=this.findTargetPort(this.isForwards);if(null!==s){var a=s.part;a instanceof _u&&(this.isForwards?(null!==this.originalFromNode&&(e=this.originalFromNode,i=this.originalFromPort),n=a,o=s):(e=a,i=s,null!==this.originalToNode&&(n=this.originalToNode,o=this.originalToPort)))}else this.isForwards?null!==this.originalFromNode&&this.isUnconnectedLinkValid&&(e=this.originalFromNode,i=this.originalFromPort):null!==this.originalToNode&&this.isUnconnectedLinkValid&&(n=this.originalToNode,o=this.originalToPort);null!==e||null!==n?null!==(r=this.insertLink(e,i,n,o))?(null===s&&(this.isForwards?r.defaultToPoint=t.lastInput.documentPoint:r.defaultFromPoint=t.lastInput.documentPoint),t.allowSelect&&(t.R("ChangingSelection",t.selection),t.clearSelection(!0),r.isSelected=!0),this.transactionResult=this.name,t.R("LinkDrawn",r)):this.doNoLink(e,i,n,o):this.isForwards?this.doNoLink(this.originalFromNode,this.originalFromPort,null,null):this.doNoLink(null,null,this.originalToNode,this.originalToPort)}finally{this.stopTool(),r&&t.allowSelect&&t.R("ChangedSelection",t.selection)}}},Qi.prototype.isNewTreeLink=function(){var t=this.archetypeLinkData;if(null===t)return!0;if(t instanceof wc)return t.isTreeLink;var e=this.diagram;return null===e||(t=e.partManager.getLinkCategoryForData(t),null===(e=e.partManager.findLinkTemplateForCategory(t))||e.isTreeLink)},Qi.prototype.insertLink=function(t,e,i,n){return this.diagram.partManager.insertLink(t,e,i,n)},Qi.prototype.doNoLink=function(){},d.Object.defineProperties(Qi.prototype,{archetypeLinkData:{get:function(){return this.V},set:function(t){this.V=t}},archetypeLabelNodeData:{get:function(){return this.F},set:function(t){this.F=t}},direction:{get:function(){return this.K},set:function(t){this.K=t}},startObject:{get:function(){return this.Xd},set:function(t){this.Xd=t}}});var tn=new V(Qi,"Either",0),en=new V(Qi,"ForwardsOnly",0),nn=new V(Qi,"BackwardsOnly",0);function on(){Ki.call(this),this.name="Relinking";var t=new pl;t.figure="Diamond",t.desiredSize=Ct,t.fill="lightblue",t.stroke="dodgerblue",t.cursor=this.linkingCursor,t.segmentIndex=0,this.V=t,(t=new pl).figure="Diamond",t.desiredSize=Ct,t.fill="lightblue",t.stroke="dodgerblue",t.cursor=this.linkingCursor,t.segmentIndex=-1,this.Xd=t,this.F=null,this.Ew=new jt}function rn(t,e,i,n,o){null!==e?(t.copyPortProperties(e,i,t.temporaryFromNode,t.temporaryFromPort,!1),t.diagram.add(t.temporaryFromNode)):t.diagram.remove(t.temporaryFromNode),null!==n?(t.copyPortProperties(n,o,t.temporaryToNode,t.temporaryToPort,!0),t.diagram.add(t.temporaryToNode)):t.diagram.remove(t.temporaryToNode)}function sn(){vi.call(this),this.name="LinkReshaping";var t=new pl;t.figure="Rectangle",t.desiredSize=Mt,t.fill="lightblue",t.stroke="dodgerblue",this.o=t,(t=new pl).figure="Diamond",t.desiredSize=Ct,t.fill="lightblue",t.stroke="dodgerblue",t.cursor="move",this.u=t,this.F=3,this.Ts=this.j=null,this.Fw=new pt,this.Yq=new $}function an(t,e,i,n,o,r){return r?Math.abs(e.y-i.y)<t.resegmentingDistance&&Math.abs(i.y-n.y)<t.resegmentingDistance&&Math.abs(n.y-o.y)<t.resegmentingDistance:Math.abs(e.x-i.x)<t.resegmentingDistance&&Math.abs(i.x-n.x)<t.resegmentingDistance&&Math.abs(n.x-o.x)<t.resegmentingDistance}Qi.className="LinkingTool",Qi.Either=tn,Qi.ForwardsOnly=en,Qi.BackwardsOnly=nn,c(on,Ki),on.prototype.updateAdornments=function(t){if(null!==t&&t instanceof wc){var e="RelinkFrom",i=null;if(t.isSelected&&!this.diagram.isReadOnly){var n=t.selectionObject;null!==n&&t.canRelinkFrom()&&t.actualBounds.w()&&t.isVisible()&&n.actualBounds.w()&&n.Ed()&&(null===(i=t.Pj(e))&&(i=this.makeAdornment(n,!1),t.bh(e,i)))}null===i&&t.Jf(e),e="RelinkTo",i=null,t.isSelected&&!this.diagram.isReadOnly&&(null!==(n=t.selectionObject)&&t.canRelinkTo()&&t.actualBounds.w()&&t.isVisible()&&n.actualBounds.w()&&n.Ed()&&(null===(i=t.Pj(e))?(i=this.makeAdornment(n,!0),t.bh(e,i)):i.v())),null===i&&t.Jf(e)}},on.prototype.makeAdornment=function(t,e){var i=new Wu;return i.type=Th.Link,null!==(e=e?this.toHandleArchetype:this.fromHandleArchetype)&&i.add(e.copy()),i.adornedObject=t,i},on.prototype.canStart=function(){if(!this.isEnabled)return!1;var t=this.diagram;if(t.isReadOnly||t.isModelReadOnly||!t.allowRelink||!t.model.xs()||!t.lastInput.left)return!1;var e=this.findToolHandleAt(t.firstInput.documentPoint,"RelinkFrom");return null===e&&(e=this.findToolHandleAt(t.firstInput.documentPoint,"RelinkTo")),null!==e},on.prototype.doActivate=function(){var t=this.diagram;if(null===this.originalLink){var e=this.handle;if(null===e&&(null===(e=this.findToolHandleAt(t.firstInput.documentPoint,"RelinkFrom"))&&(e=this.findToolHandleAt(t.firstInput.documentPoint,"RelinkTo"))),null===e)return;var i=e.part;if(!(i instanceof Wu&&i.adornedPart instanceof wc))return;this.handle=e,this.isForwards=null===i||"RelinkTo"===i.category,this.originalLink=i.adornedPart}this.Ea(this.name),t.isMouseCaptured=!0,t.currentCursor=this.linkingCursor,this.originalFromPort=this.originalLink.fromPort,this.originalFromNode=this.originalLink.fromNode,this.originalToPort=this.originalLink.toPort,this.originalToNode=this.originalLink.toNode,this.Ew.set(this.originalLink.actualBounds),null!==this.originalLink&&0<this.originalLink.pointsCount&&(null===this.originalLink.fromNode&&(null!==this.temporaryFromPort&&(this.temporaryFromPort.desiredSize=kt),null!==this.temporaryFromNode&&(this.temporaryFromNode.location=this.originalLink.i(0))),null===this.originalLink.toNode&&(null!==this.temporaryToPort&&(this.temporaryToPort.desiredSize=kt),null!==this.temporaryToNode&&(this.temporaryToNode.location=this.originalLink.i(this.originalLink.pointsCount-1)))),this.copyPortProperties(this.originalFromNode,this.originalFromPort,this.temporaryFromNode,this.temporaryFromPort,!1),this.copyPortProperties(this.originalToNode,this.originalToPort,this.temporaryToNode,this.temporaryToPort,!0),t.add(this.temporaryFromNode),t.add(this.temporaryToNode),null!==this.temporaryLink&&(null!==this.temporaryFromNode&&(this.temporaryLink.fromNode=this.temporaryFromNode),null!==this.temporaryToNode&&(this.temporaryLink.toNode=this.temporaryToNode),this.copyLinkProperties(this.originalLink,this.temporaryLink),this.temporaryLink.bb(),t.add(this.temporaryLink)),this.isActive=!0},on.prototype.copyLinkProperties=function(t,e){if(null!==t&&null!==e){e.adjusting=t.adjusting,e.corner=t.corner;var i=t.curve;i!==Jc&&i!==$c||(i=Kc),e.curve=i,e.curviness=t.curviness,e.isTreeLink=t.isTreeLink,e.points=t.points,e.routing=t.routing,e.smoothness=t.smoothness,e.fromSpot=t.fromSpot,e.fromEndSegmentLength=t.fromEndSegmentLength,e.fromShortLength=t.fromShortLength,e.toSpot=t.toSpot,e.toEndSegmentLength=t.toEndSegmentLength,e.toShortLength=t.toShortLength}},on.prototype.doDeactivate=function(){this.isActive=!1;var t=this.diagram;t.remove(this.temporaryLink),t.remove(this.temporaryFromNode),t.remove(this.temporaryToNode),t.isMouseCaptured=!1,t.currentCursor="",this.stopTransaction()},on.prototype.doStop=function(){Ki.prototype.doStop.call(this),this.handle=null},on.prototype.doMouseUp=function(){if(this.isActive){var t=this.diagram;this.transactionResult=null;var e=this.originalFromNode,i=this.originalFromPort,n=this.originalToNode,o=this.originalToPort,r=this.originalLink;try{if(this.targetPort=this.findTargetPort(this.isForwards),null!==this.targetPort){var s=this.targetPort.part;s instanceof _u&&(this.isForwards?(n=s,o=this.targetPort):(e=s,i=this.targetPort))}else this.isUnconnectedLinkValid?this.isForwards?o=n=null:i=e=null:r=null;null!==r?(this.reconnectLink(r,this.isForwards?n:e,this.isForwards?o:i,this.isForwards),null===this.targetPort&&(this.isForwards?r.defaultToPoint=t.lastInput.documentPoint:r.defaultFromPoint=t.lastInput.documentPoint,r.bb()),this.transactionResult=this.name,t.R("LinkRelinked",r,this.isForwards?this.originalToPort:this.originalFromPort)):this.doNoRelink(this.originalLink,this.isForwards),this.originalLink.Xo(this.Ew)}finally{this.stopTool()}}},on.prototype.reconnectLink=function(t,e,i,n){return i=null!==i&&null!==i.portId?i.portId:"",n?(t.toNode=e,t.toPortId=i):(t.fromNode=e,t.fromPortId=i),!0},on.prototype.doNoRelink=function(){},d.Object.defineProperties(on.prototype,{fromHandleArchetype:{get:function(){return this.V},set:function(t){this.V=t}},toHandleArchetype:{get:function(){return this.Xd},set:function(t){this.Xd=t}},handle:{get:function(){return this.F},set:function(t){if(null!==t&&!(t.part instanceof Wu))throw Error("new handle is not in an Adornment: "+t);this.F=t}}}),on.className="RelinkingTool",E("linkingTool",(function(){return this.findTool("Linking")}),(function(t){this.gb("Linking",t,this.mouseMoveTools)})),E("relinkingTool",(function(){return this.findTool("Relinking")}),(function(t){this.gb("Relinking",t,this.mouseDownTools)})),c(sn,vi),sn.prototype.Ru=function(t){return t&&0!==t.reshapingBehavior.value?t.reshapingBehavior:hn},sn.prototype.om=function(t,e){t.reshapingBehavior=e},sn.prototype.updateAdornments=function(t){if(null!==t&&t instanceof wc){var e=null;if(t.isSelected&&!this.diagram.isReadOnly){var i=t.path;null!==i&&t.canReshape()&&t.actualBounds.w()&&t.isVisible()&&i.actualBounds.w()&&i.Ed()&&(null===(e=t.Pj(this.name))||e.Aw!==t.pointsCount||e.Uw!==t.resegmentable)&&(null!==(e=this.makeAdornment(i))&&(e.Aw=t.pointsCount,e.Uw=t.resegmentable,t.bh(this.name,e)))}null===e&&t.Jf(this.name)}},sn.prototype.makeAdornment=function(t){var e=t.part,i=e.pointsCount,n=e.isOrthogonal,o=null;if(null!==e.points&&1<i){(o=new Wu).type=Th.Link,i=e.firstPickIndex;var r=e.lastPickIndex,s=n?1:0;if(e.resegmentable&&e.computeCurve()!==_c)for(var a=i+s;a<r-s;a++){var h=this.makeResegmentHandle(t,a);null!==h&&(h.segmentIndex=a,h.segmentFraction=.5,h.fromMaxLinks=999,o.add(h))}for(s=i+1;s<r;s++)if(null!==(a=this.makeHandle(t,s))){if(a.segmentIndex=s,s!==i)if(s===i+1&&n){h=e.i(i);var l=e.i(i+1);Ye.B(h.x,l.x)&&Ye.B(h.y,l.y)&&(l=e.i(i-1)),Ye.B(h.x,l.x)?(this.om(a,un),a.cursor="n-resize"):Ye.B(h.y,l.y)&&(this.om(a,ln),a.cursor="w-resize")}else s===r-1&&n?(h=e.i(r-1),l=e.i(r),Ye.B(h.x,l.x)&&Ye.B(h.y,l.y)&&(h=e.i(r+1)),Ye.B(h.x,l.x)?(this.om(a,un),a.cursor="n-resize"):Ye.B(h.y,l.y)&&(this.om(a,ln),a.cursor="w-resize")):s!==r&&(this.om(a,cn),a.cursor="move");o.add(a)}o.adornedObject=t}return o},sn.prototype.makeHandle=function(){var t=this.handleArchetype;return null===t?null:t.copy()},sn.prototype.makeResegmentHandle=function(){var t=this.midHandleArchetype;return null===t?null:t.copy()},sn.prototype.canStart=function(){if(!this.isEnabled)return!1;var t=this.diagram;return!(t.isReadOnly||!t.allowReshape||!t.lastInput.left)&&null!==this.findToolHandleAt(t.firstInput.documentPoint,this.name)},sn.prototype.doActivate=function(){var t=this.diagram;if(null===this.handle&&(this.handle=this.findToolHandleAt(t.firstInput.documentPoint,this.name)),null!==this.handle){var e=this.handle.part.adornedPart;if(e instanceof wc){if(this.Ts=e,t.isMouseCaptured=!0,this.Ea(this.name),e.resegmentable&&999===this.handle.fromMaxLinks){var i=e.points.copy(),n=this.getResegmentingPoint();if(i.Gb(this.handle.segmentIndex+1,n),e.isOrthogonal&&i.Gb(this.handle.segmentIndex+1,n),e.points=i,e.Wb(),e.updateAdornments(),this.handle=this.findToolHandleAt(t.firstInput.documentPoint,this.name),null===this.handle)return void this.doDeactivate()}this.Fw=e.i(this.handle.segmentIndex),this.Yq=e.points.copy(),this.isActive=!0}}},sn.prototype.doDeactivate=function(){this.stopTransaction(),this.Ts=this.handle=null,this.isActive=this.diagram.isMouseCaptured=!1},sn.prototype.stopTransaction=function(){var t=this.diagram,e=vi.prototype.stopTransaction.call(this);return e&&null!==t.undoManager.transactionToUndo&&t.undoManager.transactionToUndo.ak(),e},sn.prototype.doCancel=function(){var t=this.adornedLink;null!==t&&(t.points=this.Yq),this.stopTool()},sn.prototype.getResegmentingPoint=function(){return this.handle.ga(oe)},sn.prototype.doMouseMove=function(){var t=this.diagram;this.isActive&&(t=this.computeReshape(t.lastInput.documentPoint),this.reshape(t))},sn.prototype.doMouseUp=function(){var t=this.diagram;if(this.isActive){var e=this.computeReshape(t.lastInput.documentPoint);if(this.reshape(e),null!==(e=this.adornedLink)&&e.resegmentable){var i=this.handle.segmentIndex,n=e.i(i-1),o=e.i(i),r=e.i(i+1);if(e.isOrthogonal){if(i>e.firstPickIndex+1&&i<e.lastPickIndex-1){var s=e.i(i-2);if(Math.abs(n.x-o.x)<this.resegmentingDistance&&Math.abs(n.y-o.y)<this.resegmentingDistance&&(an(this,s,n,o,r,!0)||an(this,s,n,o,r,!1))){var a=e.points.copy();an(this,s,n,o,r,!0)?(a.cd(i-2,new pt(s.x,(r.y+s.y)/2)),a.cd(i+1,new pt(r.x,(r.y+s.y)/2))):(a.cd(i-2,new pt((r.x+s.x)/2,s.y)),a.cd(i+1,new pt((r.x+s.x)/2,r.y))),a.mb(i),a.mb(i-1),e.points=a,e.Wb()}else s=e.i(i+2),Math.abs(o.x-r.x)<this.resegmentingDistance&&Math.abs(o.y-r.y)<this.resegmentingDistance&&(an(this,n,o,r,s,!0)||an(this,n,o,r,s,!1))&&(a=e.points.copy(),an(this,n,o,r,s,!0)?(a.cd(i-1,new pt(n.x,(n.y+s.y)/2)),a.cd(i+2,new pt(s.x,(n.y+s.y)/2))):(a.cd(i-1,new pt((n.x+s.x)/2,n.y)),a.cd(i+2,new pt((n.x+s.x)/2,s.y))),a.mb(i+1),a.mb(i),e.points=a,e.Wb())}}else s=pt.alloc(),Ye.qh(n.x,n.y,r.x,r.y,o.x,o.y,s)&&s.Bf(o)<this.resegmentingDistance*this.resegmentingDistance&&((n=e.points.copy()).mb(i),e.points=n,e.Wb()),pt.free(s)}t.Ya(),this.transactionResult=this.name,t.R("LinkReshaped",this.adornedLink,this.Yq)}this.stopTool()},sn.prototype.reshape=function(t){var e=this.adornedLink;e.uh();var i=this.handle.segmentIndex,n=this.Ru(this.handle);if(e.isOrthogonal)if(i===e.firstPickIndex+1)i=e.firstPickIndex+1,n===un?(e.L(i,e.i(i-1).x,t.y),e.L(i+1,e.i(i+2).x,t.y)):n===ln&&(e.L(i,t.x,e.i(i-1).y),e.L(i+1,t.x,e.i(i+2).y));else if(i===e.lastPickIndex-1)i=e.lastPickIndex-1,n===un?(e.L(i-1,e.i(i-2).x,t.y),e.L(i,e.i(i+1).x,t.y)):n===ln&&(e.L(i-1,t.x,e.i(i-2).y),e.L(i,t.x,e.i(i+1).y));else{n=i;var o=e.i(n),r=e.i(n-1),s=e.i(n+1);Ye.B(r.x,o.x)&&Ye.B(o.y,s.y)?(Ye.B(r.x,e.i(n-2).x)&&!Ye.B(r.y,e.i(n-2).y)?(e.m(n,t.x,r.y),i++,n++):e.L(n-1,t.x,r.y),Ye.B(s.y,e.i(n+2).y)&&!Ye.B(s.x,e.i(n+2).x)?e.m(n+1,s.x,t.y):e.L(n+1,s.x,t.y)):Ye.B(r.y,o.y)&&Ye.B(o.x,s.x)?(Ye.B(r.y,e.i(n-2).y)&&!Ye.B(r.x,e.i(n-2).x)?(e.m(n,r.x,t.y),i++,n++):e.L(n-1,r.x,t.y),Ye.B(s.x,e.i(n+2).x)&&!Ye.B(s.y,e.i(n+2).y)?e.m(n+1,t.x,s.y):e.L(n+1,t.x,s.y)):Ye.B(r.x,o.x)&&Ye.B(o.x,s.x)?(Ye.B(r.x,e.i(n-2).x)&&!Ye.B(r.y,e.i(n-2).y)?(e.m(n,t.x,r.y),i++,n++):e.L(n-1,t.x,r.y),Ye.B(s.x,e.i(n+2).x)&&!Ye.B(s.y,e.i(n+2).y)?e.m(n+1,t.x,s.y):e.L(n+1,t.x,s.y)):Ye.B(r.y,o.y)&&Ye.B(o.y,s.y)&&(Ye.B(r.y,e.i(n-2).y)&&!Ye.B(r.x,e.i(n-2).x)?(e.m(n,r.x,t.y),i++,n++):e.L(n-1,r.x,t.y),Ye.B(s.y,e.i(n+2).y)&&!Ye.B(s.x,e.i(n+2).x)?e.m(n+1,s.x,t.y):e.L(n+1,s.x,t.y)),e.L(i,t.x,t.y)}else e.L(i,t.x,t.y),n=e.fromNode,o=e.fromPort,null!==n&&(null!==(r=n.findVisibleNode())&&r!==n&&(o=(n=r).port)),1===i&&e.computeSpot(!0,o).Mc()&&(r=o.ga(oe,pt.alloc()),n=e.getLinkPointFromPoint(n,o,r,t,!0,pt.alloc()),e.L(0,n.x,n.y),pt.free(r),pt.free(n)),n=e.toNode,o=e.toPort,null!==n&&(null!==(r=n.findVisibleNode())&&r!==n&&(o=(n=r).port)),i===e.pointsCount-2&&e.computeSpot(!1,o).Mc()&&(i=o.ga(oe,pt.alloc()),t=e.getLinkPointFromPoint(n,o,i,t,!1,pt.alloc()),e.L(e.pointsCount-1,t.x,t.y),pt.free(i),pt.free(t));e.zf()},sn.prototype.computeReshape=function(t){var e=this.adornedLink,i=this.handle.segmentIndex;switch(this.Ru(this.handle)){case cn:return t;case un:return new pt(e.i(i).x,t.y);case ln:return new pt(t.x,e.i(i).y);default:return e.i(i)}},d.Object.defineProperties(sn.prototype,{handleArchetype:{get:function(){return this.o},set:function(t){this.o=t}},midHandleArchetype:{get:function(){return this.u},set:function(t){this.u=t}},handle:{get:function(){return this.j},set:function(t){if(null!==t&&!(t.part instanceof Wu))throw Error("new handle is not in an Adornment: "+t);this.j=t}},adornedLink:{get:function(){return this.Ts}},resegmentingDistance:{get:function(){return this.F},set:function(t){this.F=t}},originalPoint:{get:function(){return this.Fw}},originalPoints:{get:function(){return this.Yq}}}),sn.prototype.setReshapingBehavior=sn.prototype.om,sn.prototype.getReshapingBehavior=sn.prototype.Ru;var hn=new V(sn,"None",0),ln=new V(sn,"Horizontal",1),un=new V(sn,"Vertical",2),cn=new V(sn,"All",3);function dn(){vi.call(this),this.name="Resizing",this.o=new At(1,1).freeze(),this.j=new At(9999,9999).freeze(),this.yg=new At(NaN,NaN).freeze(),this.V=!1,this.ia=!0,this.ue=null;var t=new pl;t.alignmentFocus=oe,t.figure="Rectangle",t.desiredSize=Mt,t.fill="lightblue",t.stroke="dodgerblue",t.strokeWidth=1,t.cursor="pointer",this.F=t,this.u=null,this.Xq=new pt,this.Dw=new At,this.Tn=new pt,this.rt=new At(0,0),this.qt=new At(1/0,1/0),this.pt=new At(1,1)}function fn(){vi.call(this),this.name="Rotating",this.ia=45,this.V=2,this.Tn=new pt,this.ue=null;var t=new pl;t.figure="Ellipse",t.desiredSize=Ct,t.fill="lightblue",t.stroke="dodgerblue",t.strokeWidth=1,t.cursor="pointer",this.o=t,this.j=null,this.Cw=0,this.kr=new pt(NaN,NaN),this.u=0,this.F=50}function pn(){vi.call(this),this.name="ClickSelecting"}function gn(){vi.call(this),this.name="Action",this.pk=null}function mn(){vi.call(this),this.name="ClickCreating",this.Ri=null,this.o=!0,this.j=!1,this.mw=new pt(0,0)}function yn(){vi.call(this),this.name="DragSelecting",this.Ik=175,this.o=!1;var t=new ku;t.layerName="Tool",t.selectable=!1;var e=new pl;e.name="SHAPE",e.figure="Rectangle",e.fill=null,e.stroke="magenta",t.add(e),this.j=t}function vn(){vi.call(this),this.name="Panning",this.Xt=new pt,this.xy=new pt,this.xg=!1;var t=this;this.Kw=function(){var e=t.diagram;null!==e&&e.removeEventListener(m.document,"scroll",t.Kw,!1),t.stopTool()}}function xn(){this.F=this.u=this.j=this.o=null}function bn(t,e,i){this.text=t,this.hx=e,this.visible=i}function wn(){vi.call(this),this.name="ContextMenu",this.o=this.ht=this.j=null,this.yw=new pt,this.jt=null,this.Et=!1;var t=this;this.tu=function(){t.stopTool()}}function kn(t){return t.preventDefault(),!1}function Sn(t){var e=t.diagram;if(t.isActive){var i=t.currentContextMenu;if(null!==i){var n=null;i instanceof xn||null!==(n=e.ic(e.lastInput.documentPoint,null,null))&&n.rg(i)&&t.standardMouseClick(null,null),t.maybeStopTool(n)}}else t.canStart()&&(Mn(t,!0),t.isActive||t.stopTool())}function Mn(t,e,i){if(void 0===i&&(i=null),!t.Et&&(t.Et=!0,e&&t.standardMouseSelect(),e=t.standardMouseClick(),t.Et=!1,!e)){if(t.isActive=!0,e=Cn,null===i&&(i=t.findObjectWithContextMenu()),null!==i){var n=i.contextMenu;null!==n?(t.currentObject=i instanceof Fs?i:null,t.showContextMenu(n,t.currentObject)):null!==e&&t.showContextMenu(e,t.currentObject)}else null!==e&&t.showContextMenu(e,null);t.currentContextMenu instanceof Wu&&!t.currentContextMenu.visible&&t.stopTool()}}sn.className="LinkReshapingTool",sn.None=hn,sn.Horizontal=ln,sn.Vertical=un,sn.All=cn,E("linkReshapingTool",(function(){return this.findTool("LinkReshaping")}),(function(t){this.gb("LinkReshaping",t,this.mouseDownTools)})),c(dn,vi),dn.prototype.updateAdornments=function(t){if(!(null===t||t instanceof wc)){if(t.isSelected&&!this.diagram.isReadOnly){var e=t.resizeObject,i=t.Pj(this.name);if(null!==e&&t.canResize()&&t.actualBounds.w()&&t.isVisible()&&e.actualBounds.w()&&e.Ed()&&(null!==i&&i.adornedObject===e||(i=this.makeAdornment(e)),null!==i))return e=e.li(),Ru(t)&&this.updateResizeHandles(i,e),void t.bh(this.name,i)}t.Jf(this.name)}},dn.prototype.makeAdornment=function(t){var e=t.part.resizeAdornmentTemplate;if(null===e){(e=new Wu).type=Th.Spot,e.locationSpot=oe;var i=new bc;i.isPanelMain=!0,e.add(i),e.add(this.makeHandle(t,te)),e.add(this.makeHandle(t,ie)),e.add(this.makeHandle(t,he)),e.add(this.makeHandle(t,se)),e.add(this.makeHandle(t,Le)),e.add(this.makeHandle(t,Be)),e.add(this.makeHandle(t,De)),e.add(this.makeHandle(t,Ae))}else if(Kh(e),null===(e=e.copy()))return null;return e.adornedObject=t,e},dn.prototype.makeHandle=function(t,e){return null===(t=this.handleArchetype)?null:((t=t.copy()).alignment=e,t)},dn.prototype.updateResizeHandles=function(t,e){if(null!==t)if(!t.alignment.Xb()&&("pointer"===t.cursor||0<t.cursor.indexOf("resize")))t:{var i=t.alignment;if(i.Mc()&&(i=oe),0>=i.x)e=0>=i.y?e+225:1<=i.y?e+135:e+180;else if(1<=i.x)0>=i.y?e+=315:1<=i.y&&(e+=45);else if(0>=i.y)e+=270;else{if(!(1<=i.y))break t;e+=90}0>e?e+=360:360<=e&&(e-=360),t.cursor=22.5>e?"e-resize":67.5>e?"se-resize":112.5>e?"s-resize":157.5>e?"sw-resize":202.5>e?"w-resize":247.5>e?"nw-resize":292.5>e?"n-resize":337.5>e?"ne-resize":"e-resize"}else if(t instanceof Th)for(t=t.elements;t.next();)this.updateResizeHandles(t.value,e)},dn.prototype.canStart=function(){if(!this.isEnabled)return!1;var t=this.diagram;return!(t.isReadOnly||!t.allowResize||!t.lastInput.left)&&null!==this.findToolHandleAt(t.firstInput.documentPoint,this.name)},dn.prototype.doActivate=function(){var t=this.diagram;null===this.handle&&(this.handle=this.findToolHandleAt(t.firstInput.documentPoint,this.name)),null!==this.handle&&(this.adornedObject=this.handle.part.adornedObject,null!==this.adornedObject&&(t.isMouseCaptured=!0,t.animationManager.Cc(),this.Ea(this.name),this.Xq.set(this.adornedObject.ga(this.handle.alignment.gv())),this.Tn.set(this.adornedObject.part.location),this.Dw.set(this.adornedObject.desiredSize),this.pt=this.computeCellSize(),this.rt=this.computeMinSize(),this.qt=this.computeMaxSize(),this.isActive=!0))},dn.prototype.doDeactivate=function(){var t=this.diagram;this.stopTransaction(),this.ue=this.handle=null,this.isActive=t.isMouseCaptured=!1},dn.prototype.stopTransaction=function(){var t=this.diagram,e=vi.prototype.stopTransaction.call(this);return e&&null!==t.undoManager.transactionToUndo&&t.undoManager.transactionToUndo.ak(),e},dn.prototype.doCancel=function(){null!==this.adornedObject&&(this.adornedObject.desiredSize=this.originalDesiredSize,this.adornedObject.part.location=this.originalLocation),this.stopTool()},dn.prototype.doMouseMove=function(){var t=this.diagram;if(this.isActive){var e=this.rt,i=this.qt,n=this.pt,o=this.adornedObject.qs(t.lastInput.documentPoint,pt.alloc()),r=this.computeReshape();e=this.computeResize(o,this.handle.alignment,e,i,n,r),this.resize(e),t.bd(),pt.free(o)}},dn.prototype.doMouseUp=function(){var t=this.diagram;if(this.isActive){var e=this.rt,i=this.qt,n=this.pt,o=this.adornedObject.qs(t.lastInput.documentPoint,pt.alloc()),r=this.computeReshape();e=this.computeResize(o,this.handle.alignment,e,i,n,r),this.resize(e),pt.free(o),t.Ya(),this.transactionResult=this.name,t.R("PartResized",this.adornedObject,this.originalDesiredSize)}this.stopTool()},dn.prototype.resize=function(t){var e=this.diagram,i=this.adornedObject;if(null!==i){if(i.desiredSize=t.size,(t=i.part).Va(),i=i.ga(this.handle.alignment.gv()),t instanceof gc){var n=new $;if(n.add(t),!this.dragsMembers&&null===t.placeholder){var o=new Ss;o.dragsMembers=!1}e.moveParts(n,this.oppositePoint.copy().re(i),!0,o)}else t.location=t.location.copy().re(i).add(this.oppositePoint);e.bd()}},dn.prototype.computeResize=function(t,e,i,n,o,r){e.Mc()&&(e=oe);var s=this.adornedObject.naturalBounds,a=s.x,h=s.y,l=s.x+s.width,u=s.y+s.height,c=1;if(!r){c=s.width;var d=s.height;0>=c&&(c=1),0>=d&&(d=1),c=d/c}return d=pt.alloc(),Ye.No(t.x,t.y,a,h,o.width,o.height,d),t=s.copy(),0>=e.x?0>=e.y?(t.x=Math.max(d.x,l-n.width),t.x=Math.min(t.x,l-i.width),t.width=Math.max(l-t.x,i.width),t.y=Math.max(d.y,u-n.height),t.y=Math.min(t.y,u-i.height),t.height=Math.max(u-t.y,i.height),r||(1<=t.height/t.width?(t.height=Math.max(Math.min(c*t.width,n.height),i.height),t.width=t.height/c):(t.width=Math.max(Math.min(t.height/c,n.width),i.width),t.height=c*t.width),t.x=l-t.width,t.y=u-t.height)):1<=e.y?(t.x=Math.max(d.x,l-n.width),t.x=Math.min(t.x,l-i.width),t.width=Math.max(l-t.x,i.width),t.height=Math.max(Math.min(d.y-h,n.height),i.height),r||(1<=t.height/t.width?(t.height=Math.max(Math.min(c*t.width,n.height),i.height),t.width=t.height/c):(t.width=Math.max(Math.min(t.height/c,n.width),i.width),t.height=c*t.width),t.x=l-t.width)):(t.x=Math.max(d.x,l-n.width),t.x=Math.min(t.x,l-i.width),t.width=l-t.x,r||(t.height=Math.max(Math.min(c*t.width,n.height),i.height),t.width=t.height/c,t.y=h+.5*(u-h-t.height))):1<=e.x?0>=e.y?(t.width=Math.max(Math.min(d.x-a,n.width),i.width),t.y=Math.max(d.y,u-n.height),t.y=Math.min(t.y,u-i.height),t.height=Math.max(u-t.y,i.height),r||(1<=t.height/t.width?(t.height=Math.max(Math.min(c*t.width,n.height),i.height),t.width=t.height/c):(t.width=Math.max(Math.min(t.height/c,n.width),i.width),t.height=c*t.width),t.y=u-t.height)):1<=e.y?(t.width=Math.max(Math.min(d.x-a,n.width),i.width),t.height=Math.max(Math.min(d.y-h,n.height),i.height),r||(1<=t.height/t.width?(t.height=Math.max(Math.min(c*t.width,n.height),i.height),t.width=t.height/c):(t.width=Math.max(Math.min(t.height/c,n.width),i.width),t.height=c*t.width))):(t.width=Math.max(Math.min(d.x-a,n.width),i.width),r||(t.height=Math.max(Math.min(c*t.width,n.height),i.height),t.width=t.height/c,t.y=h+.5*(u-h-t.height))):0>=e.y?(t.y=Math.max(d.y,u-n.height),t.y=Math.min(t.y,u-i.height),t.height=u-t.y,r||(t.width=Math.max(Math.min(t.height/c,n.width),i.width),t.height=c*t.width,t.x=a+.5*(l-a-t.width))):1<=e.y&&(t.height=Math.max(Math.min(d.y-h,n.height),i.height),r||(t.width=Math.max(Math.min(t.height/c,n.width),i.width),t.height=c*t.width,t.x=a+.5*(l-a-t.width))),pt.free(d),t},dn.prototype.computeReshape=function(){var t=ds;return this.adornedObject instanceof pl&&(t=yl(this.adornedObject)),!(t===fs||this.diagram.lastInput.shift)},dn.prototype.computeMinSize=function(){var t=this.adornedObject.minSize.copy(),e=this.minSize;return!isNaN(e.width)&&e.width>t.width&&(t.width=e.width),!isNaN(e.height)&&e.height>t.height&&(t.height=e.height),t},dn.prototype.computeMaxSize=function(){var t=this.adornedObject.maxSize.copy(),e=this.maxSize;return!isNaN(e.width)&&e.width<t.width&&(t.width=e.width),!isNaN(e.height)&&e.height<t.height&&(t.height=e.height),t},dn.prototype.computeCellSize=function(){var t=new At(NaN,NaN),e=this.adornedObject.part;return null!==e&&(e=e.resizeCellSize,!isNaN(e.width)&&0<e.width&&(t.width=e.width),!isNaN(e.height)&&0<e.height&&(t.height=e.height)),e=this.cellSize,isNaN(t.width)&&!isNaN(e.width)&&0<e.width&&(t.width=e.width),isNaN(t.height)&&!isNaN(e.height)&&0<e.height&&(t.height=e.height),e=this.diagram,(isNaN(t.width)||isNaN(t.height))&&e&&(null!==(e=e.grid)&&e.visible&&this.isGridSnapEnabled&&(e=e.gridCellSize,isNaN(t.width)&&!isNaN(e.width)&&0<e.width&&(t.width=e.width),isNaN(t.height)&&!isNaN(e.height)&&0<e.height&&(t.height=e.height))),(isNaN(t.width)||0===t.width||1/0===t.width)&&(t.width=1),(isNaN(t.height)||0===t.height||1/0===t.height)&&(t.height=1),t},d.Object.defineProperties(dn.prototype,{handleArchetype:{get:function(){return this.F},set:function(t){this.F=t}},handle:{get:function(){return this.u},set:function(t){if(null!==t&&!(t.part instanceof Wu))throw Error("new handle is not in an Adornment: "+t);this.u=t}},adornedObject:{get:function(){return this.ue},set:function(t){if(null!==t&&t.part instanceof Wu)throw Error("new handle must not be in an Adornment: "+t);this.ue=t}},minSize:{get:function(){return this.o},set:function(t){if(!this.o.D(t)){var e=t.width;isNaN(e)&&(e=0),t=t.height,isNaN(t)&&(t=0),this.o.h(e,t)}}},maxSize:{get:function(){return this.j},set:function(t){if(!this.j.D(t)){var e=t.width;isNaN(e)&&(e=1/0),t=t.height,isNaN(t)&&(t=1/0),this.j.h(e,t)}}},cellSize:{get:function(){return this.yg},set:function(t){this.yg.D(t)||this.yg.assign(t)}},isGridSnapEnabled:{get:function(){return this.V},set:function(t){this.V=t}},dragsMembers:{get:function(){return this.ia},set:function(t){this.ia=t}},oppositePoint:{get:function(){return this.Xq},set:function(t){this.Xq.D(t)||this.Xq.assign(t)}},originalDesiredSize:{get:function(){return this.Dw}},originalLocation:{get:function(){return this.Tn}}}),dn.className="ResizingTool",E("resizingTool",(function(){return this.findTool("Resizing")}),(function(t){this.gb("Resizing",t,this.mouseDownTools)})),c(fn,vi),fn.prototype.updateAdornments=function(t){if(null!==t){if(t.ph()){var e=t.rotateObject;if(e===t||e===t.path||e.isPanelMain)return}if(t.isSelected&&!this.diagram.isReadOnly&&(null!==(e=t.rotateObject)&&t.canRotate()&&t.actualBounds.w()&&t.isVisible()&&e.actualBounds.w()&&e.Ed())){var i=t.Pj(this.name);if(null!==i&&i.adornedObject===e||(i=this.makeAdornment(e)),null!==i)return i.angle=e.li(),null===i.placeholder&&(i.location=this.computeAdornmentLocation(e)),void t.bh(this.name,i)}t.Jf(this.name)}},fn.prototype.makeAdornment=function(t){var e=t.part.rotateAdornmentTemplate;if(null===e){(e=new Wu).type=Th.Position,e.locationSpot=oe;var i=this.handleArchetype;null!==i&&e.add(i.copy())}else if(Kh(e),null===(e=e.copy()))return null;return e.adornedObject=t,e},fn.prototype.canStart=function(){if(!this.isEnabled)return!1;var t=this.diagram;return!(t.isReadOnly||!t.allowRotate||!t.lastInput.left)&&null!==this.findToolHandleAt(t.firstInput.documentPoint,this.name)},fn.prototype.doActivate=function(){var t=this.diagram;if(null===this.adornedObject){if(null===this.handle&&(this.handle=this.findToolHandleAt(t.firstInput.documentPoint,this.name)),null===this.handle)return;this.adornedObject=this.handle.part.adornedObject}null!==this.adornedObject&&(t.isMouseCaptured=!0,t.delaysLayout=!0,this.Ea(this.name),this.Cw=this.adornedObject.angle,this.kr=this.computeRotationPoint(this.adornedObject),this.Tn=this.adornedObject.part.location.copy(),this.isActive=!0)},fn.prototype.computeRotationPoint=function(t){var e=t.part,i=e.locationObject;return e.rotationSpot.sb()?t.ga(e.rotationSpot):t===e||t===i?i.ga(e.locationSpot):t.ga(oe)},fn.prototype.computeAdornmentLocation=function(t){var e=this.rotationPoint;e.w()||(e=this.computeRotationPoint(t)),e=t.qs(e);var i=this.handleAngle;0>i?i+=360:360<=i&&(i-=360),i=Math.round(45*Math.round(i/45));var n=this.handleDistance;return 0===i?e.x=t.naturalBounds.width+n:45===i?(e.x=t.naturalBounds.width+n,e.y=t.naturalBounds.height+n):90===i?e.y=t.naturalBounds.height+n:135===i?(e.x=-n,e.y=t.naturalBounds.height+n):180===i?e.x=-n:225===i?(e.x=-n,e.y=-n):270===i?e.y=-n:315===i&&(e.x=t.naturalBounds.width+n,e.y=-n),t.ga(e)},fn.prototype.doDeactivate=function(){var t=this.diagram;this.stopTransaction(),this.ue=this.handle=null,this.kr=new pt(NaN,NaN),this.isActive=t.isMouseCaptured=!1},fn.prototype.stopTransaction=function(){var t=this.diagram,e=vi.prototype.stopTransaction.call(this);return e&&null!==t.undoManager.transactionToUndo&&t.undoManager.transactionToUndo.ak(),e},fn.prototype.doCancel=function(){this.diagram.delaysLayout=!1,this.rotate(this.originalAngle),this.stopTool()},fn.prototype.doMouseMove=function(){var t=this.diagram;this.isActive&&(t=this.computeRotate(t.lastInput.documentPoint),this.rotate(t))},fn.prototype.doMouseUp=function(){var t=this.diagram;if(this.isActive){t.delaysLayout=!1;var e=this.computeRotate(t.lastInput.documentPoint);this.rotate(e),t.Ya(),this.transactionResult=this.name,t.R("PartRotated",this.adornedObject,this.originalAngle)}this.stopTool()},fn.prototype.rotate=function(t){var e=this.adornedObject;if(null!==e){e.angle=t,(e=e.part).Va();var i=e.locationObject,n=e.rotateObject;(i===n||i.rg(n))&&(i=this.Tn.copy(),e.location=i.re(this.rotationPoint).rotate(t-this.originalAngle).add(this.rotationPoint)),this.diagram.bd()}},fn.prototype.computeRotate=function(t){t=this.rotationPoint.ab(t)-this.handleAngle;var e=this.adornedObject.panel;null!==e&&(t-=e.li()),360<=t?t-=360:0>t&&(t+=360),e=Math.min(Math.abs(this.snapAngleMultiple),180);var i=Math.min(Math.abs(this.snapAngleEpsilon),e/2);return!this.diagram.lastInput.shift&&0<e&&0<i&&(t%e<i?t=Math.floor(t/e)*e:t%e>e-i&&(t=(Math.floor(t/e)+1)*e)),360<=t?t-=360:0>t&&(t+=360),t},d.Object.defineProperties(fn.prototype,{handleArchetype:{get:function(){return this.o},set:function(t){this.o=t}},handle:{get:function(){return this.j},set:function(t){if(null!==t&&!(t.part instanceof Wu))throw Error("new handle is not in an Adornment: "+t);this.j=t}},adornedObject:{get:function(){return this.ue},set:function(t){if(null!==t&&t.part instanceof Wu)throw Error("new handle must not be in an Adornment: "+t);this.ue=t}},snapAngleMultiple:{get:function(){return this.ia},set:function(t){this.ia=t}},snapAngleEpsilon:{get:function(){return this.V},set:function(t){this.V=t}},originalAngle:{get:function(){return this.Cw}},rotationPoint:{get:function(){return this.kr},set:function(t){this.kr=t.copy()}},handleAngle:{get:function(){return this.u},set:function(t){this.u=t}},handleDistance:{get:function(){return this.F},set:function(t){this.F=t}}}),fn.className="RotatingTool",E("rotatingTool",(function(){return this.findTool("Rotating")}),(function(t){this.gb("Rotating",t,this.mouseDownTools)})),c(pn,vi),pn.prototype.canStart=function(){return!(!this.isEnabled||this.isBeyondDragSize())},pn.prototype.doMouseUp=function(){this.isActive&&(this.standardMouseSelect(),!this.standardMouseClick()&&this.diagram.lastInput.isTouchEvent&&this.diagram.toolManager.doToolTip()),this.stopTool()},pn.className="ClickSelectingTool",c(gn,vi),gn.prototype.canStart=function(){if(!this.isEnabled)return!1;var t=this.diagram,e=t.lastInput,i=t.ic(e.documentPoint,(function(t){for(;null!==t.panel&&!t.isActionable;)t=t.panel;return t}));return null!==i&&(!!i.isActionable&&(this.pk=i,t.Ck=t.ic(e.documentPoint,null,null),!0))},gn.prototype.doMouseDown=function(){if(this.isActive){var t=this.diagram.lastInput,e=this.pk;null!==e&&(t.targetObject=e,null!==e.actionDown&&e.actionDown(t,e))}else this.canStart()&&this.doActivate()},gn.prototype.doMouseMove=function(){if(this.isActive){var t=this.diagram.lastInput,e=this.pk;null!==e&&(t.targetObject=e,null!==e.actionMove&&e.actionMove(t,e))}},gn.prototype.doMouseUp=function(){if(this.isActive){var t=this.diagram.lastInput,e=this.pk;if(null===e)return;t.targetObject=e,null!==e.actionUp&&e.actionUp(t,e),this.standardMouseClick((function(t){for(;null!==t.panel&&(!t.isActionable||t!==e);)t=t.panel;return t}),(function(t){return t===e}))}this.stopTool()},gn.prototype.doCancel=function(){var t=this.diagram.lastInput,e=this.pk;null!==e&&(t.targetObject=e,null!==e.actionCancel&&e.actionCancel(t,e),this.stopTool())},gn.prototype.doStop=function(){this.pk=null},gn.className="ActionTool",c(mn,vi),mn.prototype.canStart=function(){if(!this.isEnabled||null===this.archetypeNodeData)return!1;var t=this.diagram;if(t.isReadOnly||t.isModelReadOnly||!t.allowInsert||!t.lastInput.left||this.isBeyondDragSize())return!1;if(this.isDoubleClick){if(1===t.lastInput.clickCount&&(this.mw=t.lastInput.viewPoint.copy()),2!==t.lastInput.clickCount||this.isBeyondDragSize(this.mw))return!1}else if(1!==t.lastInput.clickCount)return!1;return t.currentTool===this||null===t.Ol(t.lastInput.documentPoint,!0)},mn.prototype.doMouseUp=function(){var t=this.diagram;this.isActive&&this.insertPart(t.lastInput.documentPoint),this.stopTool()},mn.prototype.insertPart=function(t){var e=this.diagram,i=this.archetypeNodeData;if(null===i)return null;var n=null;try{if(e.R("ChangingSelection",e.selection),this.Ea(this.name),i instanceof ku)i.Zc()&&(Kh(i),null!==(n=i.copy())&&e.add(n));else if(null!==i){var o=e.model.copyNodeData(i);C(o)&&(e.model.xf(o),n=e.Lc(o))}if(null!==n){var r=pt.allocAt(t.x,t.y);this.isGridSnapEnabled&&cr(this.diagram,n,t,r),n.location=r,e.allowSelect&&(e.clearSelection(!0),n.isSelected=!0),pt.free(r)}e.Ya(),this.transactionResult=this.name,e.R("PartCreated",n)}finally{this.stopTransaction(),e.R("ChangedSelection",e.selection)}return n},d.Object.defineProperties(mn.prototype,{archetypeNodeData:{get:function(){return this.Ri},set:function(t){this.Ri=t}},isDoubleClick:{get:function(){return this.o},set:function(t){this.o=t}},isGridSnapEnabled:{get:function(){return this.j},set:function(t){this.j=t}}}),mn.className="ClickCreatingTool",c(yn,vi),yn.prototype.canStart=function(){if(!this.isEnabled)return!1;var t=this.diagram;if(!t.allowSelect)return!1;var e=t.lastInput;return!(!e.left||t.currentTool!==this&&(!this.isBeyondDragSize()||e.timestamp-t.firstInput.timestamp<this.delay||null!==t.Ol(e.documentPoint,!0)))},yn.prototype.doActivate=function(){var t=this.diagram;this.isActive=!0,t.isMouseCaptured=!0,t.skipsUndoManager=!0,t.add(this.box),this.doMouseMove()},yn.prototype.doDeactivate=function(){var t=this.diagram;t.ug(),t.remove(this.box),t.skipsUndoManager=!1,this.isActive=t.isMouseCaptured=!1},yn.prototype.doMouseMove=function(){var t=this.diagram;if(this.isActive&&null!==this.box){var e=this.computeBoxBounds(),i=this.box.fb("SHAPE");null===i&&(i=this.box.Pb());var n=At.alloc().h(e.width,e.height);i.desiredSize=n,this.box.mm(e.x,e.y,!1),At.free(n),(t.allowHorizontalScroll||t.allowVerticalScroll)&&t.gs(t.lastInput.viewPoint)}},yn.prototype.doMouseUp=function(){if(this.isActive){var t=this.diagram;t.remove(this.box);try{t.currentCursor="wait",t.R("ChangingSelection",t.selection),this.selectInRect(this.computeBoxBounds()),t.R("ChangedSelection",t.selection)}finally{t.currentCursor=""}}this.stopTool()},yn.prototype.computeBoxBounds=function(){var t=this.diagram;return new jt(t.firstInput.documentPoint,t.lastInput.documentPoint)},yn.prototype.selectInRect=function(t){var e=this.diagram,i=e.lastInput;if(t=e.ux(t,this.isPartialInclusion),z?i.meta:i.control)if(i.shift)for(t=t.iterator;t.next();)(e=t.value).isSelected&&(e.isSelected=!1);else for(t=t.iterator;t.next();)(e=t.value).isSelected=!e.isSelected;else if(i.shift)for(t=t.iterator;t.next();)(e=t.value).isSelected||(e.isSelected=!0);else{for(i=new $,e=e.selection.iterator;e.next();){var n=e.value;t.contains(n)||i.add(n)}for(e=i.iterator;e.next();)e.value.isSelected=!1;for(t=t.iterator;t.next();)(e=t.value).isSelected||(e.isSelected=!0)}},d.Object.defineProperties(yn.prototype,{delay:{get:function(){return this.Ik},set:function(t){this.Ik=t}},isPartialInclusion:{get:function(){return this.o},set:function(t){this.o=t}},box:{get:function(){return this.j},set:function(t){this.j=t}}}),yn.className="DragSelectingTool",c(vn,vi),vn.prototype.canStart=function(){if(!this.isEnabled)return!1;var t=this.diagram;return!(!t.allowHorizontalScroll&&!t.allowVerticalScroll||!t.lastInput.left||t.currentTool!==this&&!this.isBeyondDragSize())},vn.prototype.doActivate=function(){var t=this.diagram;this.xg?(t.lastInput.bubbles=!0,t.addEventListener(m.document,"scroll",this.Kw,!1)):(t.currentCursor="move",t.isMouseCaptured=!0,this.Xt.assign(t.position)),this.isActive=!0},vn.prototype.doDeactivate=function(){var t=this.diagram;t.currentCursor="",this.isActive=t.isMouseCaptured=!1},vn.prototype.doCancel=function(){var t=this.diagram;t.position=this.Xt,t.isMouseCaptured=!1,this.stopTool()},vn.prototype.doMouseMove=function(){this.move()},vn.prototype.doMouseUp=function(){this.move(),this.stopTool()},vn.prototype.move=function(){var t=this.diagram;if(this.isActive&&t)if(this.xg)t.lastInput.bubbles=!0;else{var e=t.position,i=t.firstInput.documentPoint,n=t.lastInput.documentPoint,o=e.x+i.x-n.x;i=e.y+i.y-n.y,t.allowHorizontalScroll||(o=e.x),t.allowVerticalScroll||(i=e.y),t.position=this.xy.h(o,i)}},d.Object.defineProperties(vn.prototype,{bubbles:{get:function(){return this.xg},set:function(t){this.xg=t}},originalPosition:{get:function(){return this.Xt}}}),vn.className="PanningTool",E("clickCreatingTool",(function(){return this.findTool("ClickCreating")}),(function(t){this.gb("ClickCreating",t,this.mouseUpTools)})),E("clickSelectingTool",(function(){return this.findTool("ClickSelecting")}),(function(t){this.gb("ClickSelecting",t,this.mouseUpTools)})),E("panningTool",(function(){return this.findTool("Panning")}),(function(t){this.gb("Panning",t,this.mouseMoveTools)})),E("dragSelectingTool",(function(){return this.findTool("DragSelecting")}),(function(t){this.gb("DragSelecting",t,this.mouseMoveTools)})),E("actionTool",(function(){return this.findTool("Action")}),(function(t){this.gb("Action",t,this.mouseDownTools)})),d.Object.defineProperties(xn.prototype,{mainElement:{get:function(){return this.u},set:function(t){this.u=t}},show:{get:function(){return this.o},set:function(t){this.o!==t&&(this.o=t)}},hide:{get:function(){return this.j},set:function(t){this.j!==t&&(this.j=t)}},valueFunction:{get:function(){return this.F},set:function(t){this.F=t}}}),xn.className="HTMLInfo",bn.className="ContextMenuButtonInfo",c(wn,vi),wn.prototype.canStart=function(){if(!this.isEnabled)return!1;var t=this.diagram;return!(this.isBeyondDragSize()||!t.lastInput.right||1<t.lastInput.clickCount)&&!!(t.lastInput.isTouchEvent&&null!==this.defaultTouchContextMenu||null!==this.findObjectWithContextMenu())},wn.prototype.doStart=function(){this.yw.set(this.diagram.firstInput.documentPoint)},wn.prototype.doStop=function(){this.hideContextMenu(),this.currentObject=null},wn.prototype.findObjectWithContextMenu=function(t){void 0===t&&(t=null);var e=this.diagram,i=e.lastInput,n=null;if(t instanceof No||(n=t instanceof Fs?t:e.ic(i.documentPoint,null,(function(t){return!t.layer.isTemporary}))),null!==n){for(t=n;null!==t;){if(null!==t.contextMenu)return t;t=t.panel}if(e.lastInput.isTouchEvent&&this.defaultTouchContextMenu)return n.part}else if(null!==e.contextMenu)return e;return null},wn.prototype.doActivate=function(){},wn.prototype.doMouseDown=function(){if(vi.prototype.doMouseDown.call(this),this.isActive&&this.currentContextMenu instanceof Wu){var t=this.diagram.toolManager.findTool("Action");null!==t&&t.canStart()&&(t.doActivate(),t.doMouseDown(),t.doDeactivate())}this.diagram.toolManager.mouseDownTools.contains(this)&&Sn(this)},wn.prototype.doMouseUp=function(){if(this.isActive&&this.currentContextMenu instanceof Wu){var t=this.diagram.toolManager.findTool("Action");null!==t&&t.canStart()&&(t.doActivate(),t.doCancel(),t.doDeactivate())}Sn(this)},wn.prototype.maybeStopTool=function(){this.stopTool(),this.canStart()&&(this.diagram.currentTool=this,this.doMouseUp())},wn.prototype.doMouseMove=function(){var t=this.diagram.toolManager.findTool("Action");null!==t&&t.doMouseMove(),this.isActive&&this.diagram.toolManager.doMouseMove()},wn.prototype.showContextMenu=function(t,e){var i=this.diagram;if(t!==this.currentContextMenu&&this.hideContextMenu(),t instanceof Wu){t.layerName="Tool",t.selectable=!1,t.scale=1/i.scale,t.category=this.name,null!==t.placeholder&&(t.placeholder.scale=i.scale);var n=t.diagram;null!==n&&n!==i&&n.remove(t),i.add(t),null!==e?t.adornedObject=e:t.data=i.model,t.Va(),this.positionContextMenu(t,e)}else t instanceof xn&&t.show(e,i,this);this.currentContextMenu=t},wn.prototype.positionContextMenu=function(t){if(null===t.placeholder){var e=this.diagram,i=e.lastInput.documentPoint.copy(),n=t.measuredBounds,o=e.viewportBounds;e.lastInput.isTouchEvent&&(i.x-=n.width),i.x+n.width>o.right&&(i.x-=n.width+5/e.scale),i.x<o.x&&(i.x=o.x),i.y+n.height>o.bottom&&(i.y-=n.height+5/e.scale),i.y<o.y&&(i.y=o.y),t.position=i}},wn.prototype.hideContextMenu=function(){var t=this.diagram,e=this.currentContextMenu;null!==e&&(e instanceof Wu?(t.remove(e),null!==this.ht&&this.ht.Jf(e.category),e.data=null,e.adornedObject=null):e instanceof xn&&(null!==e.hide?e.hide(t,this):null!==e.mainElement&&(e.mainElement.style.display="none")),this.currentContextMenu=null,this.standardMouseOver())},wn.prototype.showDefaultContextMenu=function(){var t=this.diagram;null===this.jt&&(this.jt=function(t){var e=new $;return e.add(new bn("Copy",(function(t){t.commandHandler.copySelection()}),(function(t){return t.commandHandler.canCopySelection()}))),e.add(new bn("Cut",(function(t){t.commandHandler.cutSelection()}),(function(t){return t.commandHandler.canCutSelection()}))),e.add(new bn("Delete",(function(t){t.commandHandler.deleteSelection()}),(function(t){return t.commandHandler.canDeleteSelection()}))),e.add(new bn("Paste",(function(e){e.commandHandler.pasteSelection(t.mouseDownPoint)}),(function(e){return e.commandHandler.canPasteSelection(t.mouseDownPoint)}))),e.add(new bn("Select All",(function(t){t.commandHandler.selectAll()}),(function(t){return t.commandHandler.canSelectAll()}))),e.add(new bn("Undo",(function(t){t.commandHandler.undo()}),(function(t){return t.commandHandler.canUndo()}))),e.add(new bn("Redo",(function(t){t.commandHandler.redo()}),(function(t){return t.commandHandler.canRedo()}))),e.add(new bn("Scroll To Part",(function(t){t.commandHandler.scrollToPart()}),(function(t){return t.commandHandler.canScrollToPart()}))),e.add(new bn("Zoom To Fit",(function(t){t.commandHandler.zoomToFit()}),(function(t){return t.commandHandler.canZoomToFit()}))),e.add(new bn("Reset Zoom",(function(t){t.commandHandler.resetZoom()}),(function(t){return t.commandHandler.canResetZoom()}))),e.add(new bn("Group Selection",(function(t){t.commandHandler.groupSelection()}),(function(t){return t.commandHandler.canGroupSelection()}))),e.add(new bn("Ungroup Selection",(function(t){t.commandHandler.ungroupSelection()}),(function(t){return t.commandHandler.canUngroupSelection()}))),e.add(new bn("Edit Text",(function(t){t.commandHandler.editTextBlock()}),(function(t){return t.commandHandler.canEditTextBlock()}))),e}(this)),Nn.innerHTML="",Tn.addEventListener("pointerdown",this.tu,!1);var e=this,i=b("ul");i.className="goCXul",Nn.appendChild(i),i.innerHTML="";for(var n=this.jt.iterator;n.next();){var o=n.value,r=o.visible;if("function"==typeof o.hx&&("function"!=typeof r||r(t))){(r=b("li")).className="goCXli";var s=b("a");s.className="goCXa",s.href="#",s.ky=o.hx,s.addEventListener("pointerdown",(function(i){return this.ky(t),e.stopTool(),i.preventDefault(),!1}),!1),s.textContent=o.text,r.appendChild(s),i.appendChild(r)}}Nn.style.display="block",Tn.style.display="block"},wn.prototype.hideDefaultContextMenu=function(){if(null!==this.currentContextMenu&&this.currentContextMenu===Cn){Nn.style.display="none",Tn.style.display="none";var t=this.diagram;null!==t&&t.removeEventListener(Tn,"pointerdown",this.tu,!1),this.currentContextMenu=null}},d.Object.defineProperties(wn.prototype,{currentContextMenu:{get:function(){return this.j},set:function(t){this.j=t,this.ht=t instanceof Wu?t.adornedPart:null}},defaultTouchContextMenu:{get:function(){return!1===Pn&&null===Cn&&Vr&&function(t){var e=new xn;e.show=function(t,e,i){i.showDefaultContextMenu()},e.hide=function(t,e){e.hideDefaultContextMenu()},Cn=e,t.tu=function(){t.stopTool()},e=b("div");var i=b("div");e.style.cssText="top: 0px;z-index:10002;position: fixed;display: none;text-align: center;left: 25%;width: 50%;background-color: #F5F5F5;padding: 16px;border: 16px solid #444;border-radius: 10px;margin-top: 10px",i.style.cssText="z-index:10001;position: fixed;display: none;top: 0;left: 0;width: 100%;height: 100%;background-color: black;opacity: 0.8;";var n=b("style");m.document.getElementsByTagName("head")[0].appendChild(n),n.sheet.insertRule(".goCXul { list-style: none; }",0),n.sheet.insertRule(".goCXli {font:700 1.5em Helvetica, Arial, sans-serif;position: relative;min-width: 60px; }",0),n.sheet.insertRule(".goCXa {color: #444;display: inline-block;padding: 4px;text-decoration: none;margin: 2px;border: 1px solid gray;border-radius: 10px; }",0),null!==(n=t.diagram)&&(n.addEventListener(e,"contextmenu",kn,!1),n.addEventListener(e,"selectstart",kn,!1),n.addEventListener(i,"contextmenu",kn,!1)),e.className="goCXforeground",i.className="goCXbackground",m.document.body&&(m.document.body.appendChild(e),m.document.body.appendChild(i)),Nn=e,Tn=i,Pn=!0}(this),Cn},set:function(t){null===t&&(Pn=!0),Cn=t}},currentObject:{get:function(){return this.o},set:function(t){this.o=t}},mouseDownPoint:{get:function(){return this.yw}}});var Cn=null,Pn=!1,Tn=null,Nn=null;function Ln(){vi.call(this),this.name="TextEditing",this.Zh=new Pl,this.ia=null,this.V=On,this.vj=null,this.qa=zn,this.u=1,this.F=!0,this.o=null,this.j=new xn,this.kt=null,function(t,e){if(Vr){var i=b("textarea");t.kt=i,i.addEventListener("input",(function(){if(null!==t.textBlock){var e=t.Lx(this.value);this.style.width=20+e.measuredBounds.width*this.wA+"px",this.rows=e.lineCount}}),!1),i.addEventListener("keydown",(function(e){if(!e.isComposing&&null!==t.textBlock){var i=e.key;"Enter"===i?(!1===t.textBlock.isMultiline&&e.preventDefault(),t.acceptText(jn)):"Tab"===i?(t.acceptText(Fn),e.preventDefault()):"Escape"===i&&(t.doCancel(),null!==t.diagram&&t.diagram.doFocus())}}),!1),i.addEventListener("focus",(function(){if(null!==t.currentTextEditor&&t.state!==zn){var e=t.kt;t.qa===Rn&&(t.qa=Vn),"function"==typeof e.select&&t.selectsTextOnActivate&&(e.select(),e.setSelectionRange(0,9999))}}),!1),i.addEventListener("blur",(function(){if(null!==t.currentTextEditor&&t.state!==zn){var e=t.kt;"function"==typeof e.focus&&e.focus(),"function"==typeof e.select&&t.selectsTextOnActivate&&(e.select(),e.setSelectionRange(0,9999))}}),!1),e.valueFunction=function(){return i.value},e.mainElement=i,e.show=function(t,e,n){if(t instanceof Pl&&n instanceof Ln)if(n.state===Hn)i.style.border="3px solid red",i.focus();else{var o=t.ga(oe),r=e.position,s=e.scale,a=t.Df()*s;a<n.minimumEditorScale&&(a=n.minimumEditorScale);var h=t.naturalBounds.width*a+6,l=t.naturalBounds.height*a+2,u=(o.x-r.x)*s;o=(o.y-r.y)*s,r=t.verticalAlignment,s=(t.lineHeight+t.spacingAbove+t.spacingBelow)*t.lineCount*a,l=r.y*l-r.y*s+r.offsetY-(.5*l-.5*s)-s/2,i.value=t.text,e.div.style.font=t.font,i.style.position="absolute",i.style.zIndex="100",i.style.font="inherit",i.style.fontSize=100*a+"%",i.style.lineHeight="normal",i.style.width=h+"px",i.style.left=(u-h/2|0)-1+"px",i.style.top=(o+l|0)-1+"px",i.style.textAlign=t.textAlign,i.style.margin="0",i.style.padding="1px",i.style.border="0",i.style.outline="none",i.style.whiteSpace="pre-wrap",i.style.overflow="hidden",i.rows=t.lineCount,i.wA=a,i.className="goTXarea",e.div.appendChild(i),i.focus(),n.selectsTextOnActivate&&(i.select(),i.setSelectionRange(0,9999))}},e.hide=function(t){t.div.removeChild(i)}}}(this,this.j)}function An(t){var e=t.textBlock,i=t.diagram,n=t.currentTextEditor;if(null!==e&&null!==n){var o=e.text,r="";null!==n.valueFunction&&(r=n.valueFunction()),t.isValidText(e,o,r)?(t.Ea(t.name),t.qa=Yn,t.transactionResult=t.name,e.text=r,t.doSuccess(o,r),null!==i&&i.R("TextEdited",e,o),t.stopTransaction(),t.stopTool(),null!==i&&i.doFocus()):(t.qa=Hn,t.doError(o,r))}}wn.className="ContextMenuTool",E("contextMenuTool",(function(){return this.findTool("ContextMenu")}),(function(t){this.gb("ContextMenu",t,this.mouseUpTools)})),c(Ln,vi),Ln.prototype.canStart=function(){if(!this.isEnabled)return!1;var t=this.diagram;if(null===t||t.isReadOnly||Xn&&Xn!==this&&(Xn.acceptText(Dn),Xn&&Xn!==this)||!t.lastInput.left||this.isBeyondDragSize())return!1;var e=t.ic(t.lastInput.documentPoint);return!!(null!==e&&e instanceof Pl&&e.editable&&e.part.canEdit())&&!(null===(e=e.part)||this.starting===On&&!e.isSelected||this.starting===In&&2>t.lastInput.clickCount)},Ln.prototype.doStart=function(){Xn=this,null!==this.textBlock&&this.doActivate()},Ln.prototype.doActivate=function(){if(!this.isActive){var t=this.diagram;if(null!==t){var e=this.textBlock;if(null===e&&(e=t.ic(t.lastInput.documentPoint)),null!==e&&e instanceof Pl&&(this.textBlock=e,null!==e.part)){t.animationManager.Cc(),this.isActive=!0,this.qa=Rn;var i=this.defaultTextEditor;null!==e.textEditor&&(i=e.textEditor),this.Zh=this.textBlock.copy();var n=new jt(this.textBlock.ga(te),this.textBlock.ga(he));t.tv(n),i.show(e,t,this),this.currentTextEditor=i}}}},Ln.prototype.doCancel=function(){this.stopTool()},Ln.prototype.doMouseUp=function(){this.canStart()&&this.doActivate()},Ln.prototype.doMouseDown=function(){this.isActive&&this.acceptText(Dn)},Ln.prototype.acceptText=function(t){switch(t){case Dn:this.qa===Yn?this.currentTextEditor instanceof HTMLElement&&this.currentTextEditor.focus():this.qa!==Rn&&this.qa!==Hn&&this.qa!==Vn||(this.qa=Gn,An(this));break;case Bn:case jn:case Fn:jn===t&&!0===this.textBlock.isMultiline||this.qa!==Rn&&this.qa!==Hn&&this.qa!==Vn||(this.qa=Gn,An(this))}},Ln.prototype.doError=function(t,e){var i=this.textBlock;null!==i.errorFunction&&i.errorFunction(this,t,e),(t=this.currentTextEditor)&&t.show(i,this.diagram,this)},Ln.prototype.doSuccess=function(t,e){var i=this.textBlock;null!==i.textEdited&&i.textEdited(i,t,e)},Ln.prototype.doDeactivate=function(){var t=this.diagram;null!==t&&(this.qa=zn,null!==this.currentTextEditor&&this.currentTextEditor.hide(t,this),this.textBlock=null,this.isActive=!1)},Ln.prototype.doStop=function(){Xn=null},Ln.prototype.isValidText=function(t,e,i){var n=this.textValidation;return!(null!==n&&!n(t,e,i))&&!(null!==(n=t.textValidation)&&!n(t,e,i))},Ln.prototype.Lx=function(t){var e=this.Zh;return e.text=t,e.measure(this.textBlock.Ih,1/0),e},d.Object.defineProperties(Ln.prototype,{textBlock:{get:function(){return this.ia},set:function(t){this.ia=t}},currentTextEditor:{get:function(){return this.o},set:function(t){this.o=t}},defaultTextEditor:{get:function(){return this.j},set:function(t){this.j=t}},starting:{get:function(){return this.V},set:function(t){this.V=t}},textValidation:{get:function(){return this.vj},set:function(t){this.vj=t}},minimumEditorScale:{get:function(){return this.u},set:function(t){this.u=t}},selectsTextOnActivate:{get:function(){return this.F},set:function(t){this.F=t}},state:{get:function(){return this.qa},set:function(t){this.qa!==t&&(this.qa=t)}}}),Ln.prototype.measureTemporaryTextBlock=Ln.prototype.Lx;var Bn=new V(Ln,"LostFocus",0),Dn=new V(Ln,"MouseDown",1),Fn=new V(Ln,"Tab",2),jn=new V(Ln,"Enter",3),En=new V(Ln,"SingleClick",0),On=new V(Ln,"SingleClickSelected",1),In=new V(Ln,"DoubleClick",2),zn=new V(Ln,"StateNone",0),Rn=new V(Ln,"StateActive",1),Vn=new V(Ln,"StateEditing",2),Gn=new V(Ln,"StateValidating",3),Hn=new V(Ln,"StateInvalid",4),Yn=new V(Ln,"StateValidated",5),Xn=null;function Un(t){oo||(io(),oo=!0),this.H=bo,this.Ok=this.zb=this.vq=this.bc=!1,this.Qw=!0,this.Pk=ro,this.Dm=!1,this.Gh=this.Jd=!0,this.Dg=600,this.cw=this.Ow=!1,this.Zd=new Z,this.ce=new ho,this.ce.Yd=this,this.Ei=new Z,this.pu=new Z,this.Sr=new Z,this.pr=new Z,t&&Object.assign(this,t)}function qn(t,e){t.Jd&&t.canStart(e)&&(t.Zd.add(e),t.defaultAnimation.isAnimating&&t.Cc(),Qo(t.H),t.zb=!0)}function Wn(t){if(t.Jd&&t.zb){var e=t.ce,i=t.H,n=t.Zd.contains("Model");n&&(t.Ok=!0,t.Pk===ro?(e.isViewportUnconstrained=!0,e.vc.clear(),e.add(i,"position",i.position.copy().offset(0,-200),i.position),e.add(i,"opacity",0,1)):t.Pk===ao&&e.vc.clear(),t.Qw=!(t.Pk!==so||!i.du.D(i.pa)),i.R("InitialAnimationStarting",t)),n&&!t.Gh||0===e.vc.count?(t.Zd.clear(),t.zb=!1,e.vc.clear(),lo(e,i),t.Ok=!1,i.N()):(t.Zd.clear(),i.kg=!1,n=e.vc.get(i),i.autoScale!==Yr&&null!==n&&(delete n.start.scale,delete n.end.scale),m.requestAnimationFrame((function(){!1===t.zb||e.bc||(i.Gf("temporaryPixelRatio")&&Fo(i),Eo(i),t.zb=!1,e.start(),e.bc&&($n(t),i.Ya(),po(e,0),Zo(i,!0),Jn(t),i.R("AnimationStarting",t)))})))}}function Kn(t){return t.Zd.contains("Trigger")&&1===t.Zd.count}function _n(t,e,i,n){t.isTicking||Kn(t)||e instanceof wc&&(null!==e.fromNode||null!==e.toNode)||t.ce.add(e,"position",i,n,!1)}function $n(t){if(!t.vq){var e=t.H;t.Ow=e.skipsUndoManager,t.cw=e.skipsModelSourceBindings,e.skipsUndoManager=!0,e.skipsModelSourceBindings=!0,t.vq=!0}}function Jn(t){var e=t.H;e.skipsUndoManager=t.Ow,e.skipsModelSourceBindings=t.cw,t.vq=!1}function Zn(t,e,i){!t.zb||e.D(i)||Kn(t)||(t.H.pi||(e=i.copy()),uo(t.ce,t.H,"position",e,i))}function Qn(t,e,i){e.fd&&(e.Tg=i,t.pr.add(e))}function to(t,e){for(e=e.findLinksConnected();e.next();){var i=e.value;i.fd&&(i.Tg=i.points.copy(),t.pr.add(i))}}function eo(t,e,i,n,o){null===t&&(t=[0,0,0,0]),null===e&&(e=[0,0,0,0]);var r=t[0],s=t[1],a=t[2];t=t[3];var h=e[0],l=e[1],u=e[2];return e=e[3],0===a||100===a?(r=h,s=l):0!==u&&100!==u||(h=r,l=s),180<Math.abs(h-r)&&(h>r?r+=360:h+=360),"hsla("+(r=o(i,r,h-r,n)%360)+", "+(s=o(i,s,l-s,n))+"%, "+(a=o(i,a,u-a,n))+"%, "+(i=o(i,t,e-t,n))+")"}function io(){function t(t,e,i,n,o,r){t.position=new pt(n(o,e.x,i.x-e.x,r),n(o,e.y,i.y-e.y,r))}var e=new ft;e.add("position:diagram",t),e.add("position",t),e.add("position:part",(function(t,e,i,n,o,r){o<r?t.mm(n(o,e.x,i.x-e.x,r),n(o,e.y,i.y-e.y,r),!1):t.position=new pt(n(o,e.x,i.x-e.x,r),n(o,e.y,i.y-e.y,r))})),e.add("location",(function(t,e,i,n,o,r){o<r?t.mm(n(o,e.x,i.x-e.x,r),n(o,e.y,i.y-e.y,r),!0):t.location=new pt(n(o,e.x,i.x-e.x,r),n(o,e.y,i.y-e.y,r))})),e.add("position:placeholder",(function(t,e,i,n,o,r){o<r?t.mm(n(o,e.x,i.x-e.x,r),n(o,e.y,i.y-e.y,r),!1):t.position=new pt(n(o,e.x,i.x-e.x,r),n(o,e.y,i.y-e.y,r))})),e.add("position:nodeCollapse",(function(t,e,i,n,o,r){var s=t.actualBounds,a=i.actualBounds;i=a.x+a.width/2-s.width/2,s=a.y+a.height/2-s.height/2,o<r?t.mm(n(o,e.x,i-e.x,r),n(o,e.y,s-e.y,r),!1):t.position=new pt(n(o,e.x,i-e.x,r),n(o,e.y,s-e.y,r))})),e.add("desiredSize",(function(t,e,i,n,o,r){t.desiredSize=new jt(n(o,e.width,i.width-e.width,r),n(o,e.height,i.height-e.height,r))})),e.add("width",(function(t,e,i,n,o,r){t.width=n(o,e,i-e,r)})),e.add("height",(function(t,e,i,n,o,r){t.height=n(o,e,i-e,r)})),e.add("fill",(function(t,e,i,n,o,r){t.fill=eo(e,i,o,r,n)})),e.add("stroke",(function(t,e,i,n,o,r){t.stroke=eo(e,i,o,r,n)})),e.add("strokeWidth",(function(t,e,i,n,o,r){t.strokeWidth=n(o,e,i-e,r)})),e.add("strokeDashOffset",(function(t,e,i,n,o,r){t.strokeDashOffset=n(o,e,i-e,r)})),e.add("background",(function(t,e,i,n,o,r){t.background=eo(e,i,o,r,n)})),e.add("areaBackground",(function(t,e,i,n,o,r){t.areaBackground=eo(e,i,o,r,n)})),e.add("opacity",(function(t,e,i,n,o,r){t.opacity=n(o,e,i-e,r)})),e.add("scale",(function(t,e,i,n,o,r){t.scale=n(o,e,i-e,r)})),e.add("angle",(function(t,e,i,n,o,r){t.angle=n(o,e,i-e,r)})),no=e}Ln.className="TextEditingTool",Ln.LostFocus=Bn,Ln.MouseDown=Dn,Ln.Tab=Fn,Ln.Enter=jn,Ln.SingleClick=En,Ln.SingleClickSelected=On,Ln.DoubleClick=In,Ln.StateNone=zn,Ln.StateActive=Rn,Ln.StateEditing=Vn,Ln.StateValidating=Gn,Ln.StateInvalid=Hn,Ln.StateValidated=Yn,E("textEditingTool",(function(){return this.findTool("TextEditing")}),(function(t){this.gb("TextEditing",t,this.mouseUpTools)})),Un.prototype.Xe=function(t){this.H=t},Un.prototype.canStart=function(){return!0},(e=Un.prototype).fv=function(t){return this.ce.fv(t)},e.Xu=function(t){return this.ce.Xu(t)},e.Cc=function(t){var e=this.ce;if(!0===this.zb&&(this.Ok=this.zb=!1,this.Zd.clear(),0<e.vc.count&&this.H.$b()),this.bc){if(e.Ml(!0),e.vc.clear(),lo(e,null),!0===t)for(t=this.Ei.Fa(),e=0;e<t.length;e++)t[e].Ml(!0)}else e.vc.clear(),lo(e,this.H)},e.Ml=function(t){t===this.defaultAnimation&&this.defaultAnimation.vc.clear(),this.Ei.remove(t),0===this.Ei.count&&(this.bc=!1,this.H.$b()),t===this.defaultAnimation&&(this.defaultAnimation.vc.clear(),this.H.R("AnimationFinished",this))},e.Cj=function(t,e){this.zb&&(this.Zd.contains("Expand Tree")||this.Zd.contains("Expand SubGraph"))&&(this.ce.Cj(t,e),to(this,t))},e.Aj=function(t,e){this.zb&&(this.Zd.contains("Collapse Tree")||this.Zd.contains("Collapse SubGraph"))&&(this.ce.Aj(t,e),uo(this.ce,e,"position",e.position,e.position),to(this,t))},d.Object.defineProperties(Un.prototype,{animationReasons:{get:function(){return this.Zd}},isEnabled:{get:function(){return this.Jd},set:function(t){(this.Jd=t)&&this.Ei.each((function(t){t.isAnimating||1/0!==t.runCount||t.start()}))}},duration:{get:function(){return this.Dg},set:function(t){1>t&&S(t,">= 1",Un,"duration"),this.Dg=t}},isAnimating:{get:function(){return this.bc}},isTicking:{get:function(){return this.vq}},isInitial:{get:function(){return this.Gh},set:function(t){this.Gh=t}},defaultAnimation:{get:function(){return this.ce}},activeAnimations:{get:function(){return this.Ei}},initialAnimationStyle:{get:function(){return this.Pk},set:function(t){this.Pk=t}}}),Un.prototype.stopAnimation=Un.prototype.Cc;var no=null,oo=!1,ro=new V(Un,"Default",1),so=new V(Un,"AnimateLocations",2),ao=new V(Un,"None",3);function ho(t){this.vu=this.Nw=this.Yd=this.H=null,this.Xk=this.bc=this.j=!1,this.cn=this.Qd=0,this.Lp=this.ot=go,this.Wk=this.ho=!1,this.cu=1,this.au=0,this.Gd=this.Dg=NaN,this.gw=0,this.dn=null,this.o=it,this.vc=new ft,this.Tt=new ft,this.yl=new Z,this.Ut=new Z,this.dw=Zr,t&&Object.assign(this,t)}function lo(t,e){if(t.Tt.clear(),t.Wk=!1,t.au=0,t.Gd=NaN,0<t.yl.count&&t.yl.clear(),0<t.Ut.count&&t.Ut.clear(),null!==e)for(t=e.links;t.next();)t.value.Tg=null}function uo(t,e,i,n,o,r){var s=t.vc;if(e instanceof No&&"position"===i&&(i="position:diagram"),"fill"!==i&&"stroke"!==i&&"background"!==i&&"areaBackground"!==i||(Ha(n),Ya(),n=[ah.j,ah.u,ah.o,ah.F],Ha(o),Ya(),o=[ah.j,ah.u,ah.o,ah.F]),s.contains(e)){var a=s.I(e),h=a.start,l=a.end;void 0===h[i]&&(h[i]=co(n)),l[i]=co(o)}else l={},(h={})[i]=co(n),l[i]=co(o),a=h.position,e instanceof Fs&&a instanceof pt&&!a.w()&&e.diagram.animationManager.Zd.contains("Expand SubGraph")&&a.assign(l.position),a=new yo(h,l,r),s.add(e,a);(s=h[i])instanceof pt&&!s.w()&&s.assign(t.o),r&&0===i.indexOf("position:")&&e instanceof ku?a.Ku.location=co(e.location):r&&(a.Ku[i]=co(n))}function co(t){return t instanceof pt||t instanceof At?t.copy():t}function fo(t,e){if(!t.Xk||e){var i=t.Yd;if(!1!==t.bc){var n=+new Date,o=n>t.cn?t.Gd:n-t.Qd;e&&((o=t.gw)<t.Gd?(t.Qd=+new Date-o,t.cn=t.Qd+t.Gd):o=t.Gd),$n(i),po(t,o),Zo(t.H,!0),Jn(i),n>t.cn&&(t.ho&&!t.Wk?(t.Qd=+new Date,t.cn=t.Qd+t.Gd,t.Wk=!0):t.Ml(!1))}}}function po(t,e){for(var i=t.Gd,n=t.vc.iterator,o=t.Wk;n.next();){var r=n.key;if(!(r instanceof Fs&&null===r.diagram)){var s=n.value,a=o?s.end:s.start;s=o?s.start:s.end;var h,l=no;for(h in s)"position"===h&&(s["position:placeholder"]||s["position:nodeCollapse"])||null===l.get(h)||l.get(h)(r,a[h],s[h],t.Lp,e,i,t)}}}function go(t,e,i,n){return 1>(t/=n/2)?i/2*t*t+e:-i/2*(--t*(t-2)-1)+e}function mo(t,e,i,n){return t===n?e+i:i*(1-Math.pow(2,-10*t/n))+e}function yo(t,e,i){this.start=t,this.end=e,this.Ku={},this.Hu=i,this.nv=!1}function vo(t,e,i){this.xd=null,this.rf=t,this.so=i||wo,this.uk=null,void 0!==e&&(this.uk=e,void 0===i&&(this.so=ko))}Un.className="AnimationManager",Un.defineAnimationEffect=function(t,e){oo||(io(),oo=!0),no.add(t,e)},Un.Default=ro,Un.AnimateLocations=so,Un.None=ao,ho.prototype.suspend=function(){this.Xk=!0},ho.prototype.advanceTo=function(t,e){e&&(this.Xk=!1),this.ho&&t>=this.Gd&&(this.Wk=!0,t-=this.Gd),this.gw=t,fo(this,!0),$n(this.Yd),Zo(this.H),Jn(this.Yd),this.H.redraw()},(e=ho.prototype).start=function(){if(0===this.vc.count||this.bc)return this;for(var t=this.H,e=this.vc.iterator;e.next();){var i=e.key;null===t&&(i instanceof No?t=i:i instanceof Fs&&(t=i.diagram))}return null===t?this:(this.H=t,this.Yd=t.animationManager,!1===(e=this.Yd).isEnabled||(this.Gd=isNaN(this.Dg)?e.duration:this.Dg,this.Lp=this.ot,e.Ok&&e.Pk===ro&&this===e.defaultAnimation&&(this.Lp=mo,this.Gd=isNaN(this.Dg)?600===e.duration?900:e.duration:this.Dg),this.dw=t.scrollMode,this.isViewportUnconstrained&&(t.sj=Qr),$n(e),this.yl.each((function(e){e.data=null,t.add(e)})),Jn(e),this.bc=!0,this.Qd=+new Date,this.cn=this.Qd+this.Gd,function(t,e){function i(){if(0<o.Sr.count&&(n.addAll(o.Sr),o.Sr.clear(),o.bc=!0),!1!==o.bc&&0!==n.count){o.pu.addAll(n);for(var t=o.pu.iterator;t.next();){var e=t.value;if(!1!==e.bc){t:if(0<e.yl.count)var r=!0;else{for(r=e.vc.iterator;r.next();){var s=r.key;if(s instanceof Fs&&null!==s.diagram||s instanceof No){r=!0;break t}}r=!1}r?fo(e,!1):e.Xk=!0}}o.pu.clear(),!1!==o.bc&&($n(o),Zo(o.H),Jn(o)),m.requestAnimationFrame(i)}}var n=t.Ei,o=t;t.bc?t.Sr.add(e):(t.bc=!0,n.add(e),m.requestAnimationFrame((function(){i()})))}(e,this)),this)},e.Iy=function(t,e){return t.Zc()?(this.yl.add(t),this.H=e,this):this},e.add=function(t,e,i,n,o){if("position"===e&&i.Xa(n))return this;if(null===this.H&&(t instanceof No?this.H=t:t instanceof Fs&&null!==t.diagram&&(this.H=t.diagram)),t instanceof ku){if(!t.isAnimated)return this;"position"===e&&(e="position:part")}return uo(this,t,e,i,n,o),this},e.fv=function(t){return!!this.bc&&(null!==(t=this.vc.I(t))&&t.nv)},e.Xu=function(t){return!!this.bc&&(null!==(t=this.vc.I(t))&&(t.start.position||t.start.location))},e.stop=function(){return this.bc?(this.Ml(!0),this):this},e.Ml=function(t){if(null!==this.vu&&this.vu.jo.remove(this.Nw),this.bc){var e=this.H,i=this.Yd;this.Xk=this.bc=i.Ok=!1,$n(i);for(var n=this.vc,o=this.yl.iterator;o.next();)e.remove(o.value);for(o=this.Ut.iterator;o.next();)o.value.v();o=this.ho,n=n.iterator;for(var r=no;n.next();){var s,a=n.key,h=n.value,l=o?h.end:h.start,u=o?h.start:h.end,c=h.Ku;for(s in u)if(null!==r.get(s)){var d=s;!h.Hu||"position:nodeCollapse"!==d&&"position:placeholder"!==d||(d="position"),r.get(d)(a,l[s],void 0!==c[s]?c[s]:h.Hu?l[s]:u[s],this.Lp,this.Gd,this.Gd,this)}h.Hu&&void 0!==c.location&&a instanceof ku&&(a.location=c.location),h.nv&&a instanceof ku&&a.Zb(!1)}if(e.As.clear(),jo(e,!1),e.Ya(),e.N(),Zo(e,!0),i.defaultAnimation===this){for(s=i.pr.iterator;s.next();)null!==(o=s.value).Tg&&(o.points=o.Tg,o.Tg=null);i.pr.clear()}Zo(e,!0),this.isViewportUnconstrained&&(e.scrollMode=this.dw),Jn(i),this.au++,!t&&this.cu>this.au?(this.Wk=!1,this.start()):(this.dn&&this.dn(this),lo(this,null),i.Ml(this),e.$b())}},e.Cj=function(t,e){var i=e.actualBounds,n=null;if(e instanceof gc&&(n=e.placeholder),null!==n?(i=n.ga(te),n=n.padding,i.x+=n.left,i.y+=n.top,this.add(t,"position",i,t.position,!1)):this.add(t,"position",new pt(i.x+i.width/2,i.y+i.height/2),t.position,!1),this.add(t,"scale",.01,t.scale,!1),t instanceof gc)for(t=t.memberParts;t.next();)(n=t.value)instanceof _u&&this.Cj(n,e)},e.Aj=function(t,e){if(t.isVisible()){var i=null;if(e instanceof gc&&(i=e.placeholder),null!==i){var n=i.ga(te);i=i.padding,n.x+=i.left,n.y+=i.top,this.add(t,"position:placeholder",t.position,n,!0)}else this.add(t,"position:nodeCollapse",t.position,e,!0);if(this.add(t,"scale",t.scale,.01,!0),(n=this.vc).contains(t)&&(n.I(t).nv=!0),t instanceof gc)for(t=t.memberParts;t.next();)(n=t.value)instanceof _u&&this.Aj(n,e)}},e.Ez=function(t){var e=this.Tt.get(t);return null===e&&(e={},this.Tt.add(t,e)),e},d.Object.defineProperties(ho.prototype,{duration:{get:function(){return this.Dg},set:function(t){1>t&&S(t,">= 1",ho,"duration"),this.Dg=t}},reversible:{get:function(){return this.ho},set:function(t){this.ho=t}},runCount:{get:function(){return this.cu},set:function(t){0<t?this.cu=t:w("Animation.runCount value must be a positive integer.")}},finished:{get:function(){return this.dn},set:function(t){this.dn!==t&&(this.dn=t)}},easing:{get:function(){return this.ot},set:function(t){this.ot=t}},isViewportUnconstrained:{get:function(){return this.j},set:function(t){this.j=t}},isAnimating:{get:function(){return this.bc}}}),ho.prototype.getTemporaryState=ho.prototype.Ez,ho.prototype.stop=ho.prototype.stop,ho.prototype.add=ho.prototype.add,ho.prototype.addTemporaryPart=ho.prototype.Iy,ho.className="Animation",ho.EaseLinear=function(t,e,i,n){return i*t/n+e},ho.EaseInOutQuad=go,ho.EaseInQuad=function(t,e,i,n){return i*(t/=n)*t+e},ho.EaseOutQuad=function(t,e,i,n){return-i*(t/=n)*(t-2)+e},ho.EaseInExpo=function(t,e,i,n){return 0===t?e:i*Math.pow(2,10*(t/n-1))+e},ho.EaseOutExpo=mo,yo.className="AnimationState",vo.prototype.copy=function(){var t=new vo(this.rf);t.so=this.so;var e=this.uk;if(null!==e){var i={};void 0!==e.duration&&(i.duration=e.duration),void 0!==e.finished&&(i.finished=e.finished),void 0!==e.easing&&(i.easing=e.easing),t.uk=i}return t},d.Object.defineProperties(vo.prototype,{propertyName:{get:function(){return this.rf},set:function(t){this.rf=t}},animationSettings:{get:function(){return this.uk},set:function(t){this.uk=t}},startCondition:{get:function(){return this.so},set:function(t){this.so=t}}});var xo,bo,wo=new V(vo,"Default",1),ko=new V(vo,"Immediate",2),So=new V(vo,"Bundled",3);function Mo(t){Q(this),this.H=null,this.Pa=new $,this.xa="",this.pb=1,this.o=!1,this.j=this.Uh=this.u=this.Oi=this.Ni=this.Mi=this.Li=this.Ji=this.Ki=this.Ii=this.Qi=this.Hi=this.Pi=this.Gi=this.Fi=!0,this.Zq=[],t&&Object.assign(this,t)}function Co(t,e){var i=1;return 1!==t.pb&&(i=e.globalAlpha,e.globalAlpha=i*t.pb),i}function Po(t,e,i,n,o){if(t.visible&&0!==t.pb&&(o||!t.isTemporary)){var r=(o=t.Pa.s).length;if(0!==r){var s=Co(t,e),a=t.Zq;a.length=0;for(var h=i.scale,l=jt.alloc(),u=0;u<r;u++){var c=o[u];n.contains(c)&&t.Oj(e,c,i,a,h,l,!1)}jt.free(l),e.globalAlpha=s}}}function To(t,e,i){if(e=function(t,e,i){var n=i.zOrder;if(isNaN(n))return e;t=t.Pa;var o=t.count;if(1>=o)return e;if(0>e&&(e=t.indexOf(i)),0>e)return-1;for(var r=e-1,s=NaN;0<=r&&(s=t.M(r).zOrder,isNaN(s));)r--;for(var a=e+1,h=NaN;a<o&&(h=t.M(a).zOrder,isNaN(h));)a++;if(!isNaN(s)&&s>n)for(;;){if(-1===r||s<=n){if(++r===e)break;return t.mb(e),t.Gb(r,i),r}for(s=NaN;0<=--r&&(s=t.M(r).zOrder,isNaN(s)););}else if(!isNaN(h)&&h<n)for(;;){if(a===o||h>=n){if(--a===e)break;return t.mb(e),t.Gb(a,i),a}for(h=NaN;++a<o&&(h=t.M(a).zOrder,isNaN(h)););}return e}(t,e,i),i instanceof gc&&null!==i&&isNaN(i.zOrder)){if(0!==i.memberParts.count){for(var n=-1,o=t.Pa.s,r=o.length,s=0;s<r;s++){var a=o[s];if(a===i&&(e=s,0<=n))break;if(0>n&&a.containingGroup===i&&(n=s,0<=e))break}!(0>n)&&n<e&&((o=t.Pa).mb(e),o.Gb(n,i))}null!==(e=i.containingGroup)&&To(t,-1,e)}null!==i.svg&&i.svg.remove()}function No(t,e){if(as||(function(){if(Vr){var t=m.document.createElement("canvas"),e=t.getContext("2d"),i=O("7ca11abfd022028846");e[i]=O("398c3597c01238");for(var n=["5da73c80a36455d7038e4972187c3cae51fd22",y.Dx+"4ae6247590da4bb21c324ba3a84e385776",Ge.xF+"fb236cdfda5de14c134ba1a95a2d4c7cc6f93c1387",Ye.za],o=1;5>o;o++)e[O("7ca11abfd7330390")](O(n[o-1]),10,15*o);for(e[i]=O("39f046ebb36e4b"),i=1;5>i;i++)e[O("7ca11abfd7330390")](O(n[i-1]),10,15*i);4===n.length&&"5"===n[0][0]&&"7"===n[3][0]||(Ge.prototype.Cd=Ge.prototype.Eu),ss=t}}(),as=!0),Q(this),bo=this,this.vb=!0,this.Ka=null,this.ya=this.Aa=0,this.ta=null,Vr){var i=this,n=function(){i.removeEventListener(m.document,"DOMContentLoaded",n,!1),i.setRTL()};null!==m.document.body?this.setRTL():i.addEventListener(m.document,"DOMContentLoaded",n,!1)}this.ol=null,zr.add("Model",Zd);var o=this;return this.Hb=function(t){var e=o.partManager;if(t.model===e.diagram.model&&e.diagram.aa){e.diagram.aa=!1;try{var i=t.change;""===t.modelChange&&i===di&&e.updateDataBindings(t.object,t.propertyName)}finally{e.diagram.aa=!0}}},this.Oc=function(t){o.partManager.doModelChanged(t)},this.hu=this.ku=null,Lo(this),this.model=Ef(),this.Wg=!0,Oo(this),this.layout=new Bd,this.Wg=!1,this.ck=this.ek=this.fk=this.dk=this.ui=this.aA=this.$j=this.Ov=null,this.hk=function(){},this.preventDefault=null,this.rn=!1,this.Yf=new hs,void 0!==t&&("string"==typeof t||m.Element&&t instanceof Element?Do(this,t):e=t),this.vb=!1,e&&this.nm(e),this}function Lo(t){t.Yd=new Un,t.Yd.Xe(t),t.Db=17,t.Gw=!1,t.tn=!1,t.bu="default",t.Wa=new $,t.pj=new ft,t.nl="default",t.Tx(),t.Sx(),t.pb=1,t.pa=new pt(NaN,NaN).freeze(),t.du=new pt(NaN,NaN),t.Ca=1,t.Pp=1,t.zt=new pt(NaN,NaN).freeze(),t.At=NaN,t.Ot=1e-4,t.Mt=100,t.Ab=new Ge,t.zu=new pt(NaN,NaN).freeze(),t.ut=new jt(NaN,NaN,NaN,NaN).freeze(),t.rj=new Kt(0,0,0,0).freeze(),t.sj=Zr,t.nu=!1,t.Zt=null,t.fu=null,t.yh=Yr,t.zk=Me,t.Fg=Yr,t.pq=Me,t.yt=te,t.Bt=te,t.Fc=!0,t.pn=!1,t.De=new Z,t.Eh=new ft,t.Xm=!0,t.vp=250,t.vk=-1,t.xp=new Kt(16,16,16,16).freeze(),t.kg=!1,t.Jk=!1,t.fn=!0,t.bq=new hi,t.bq.diagram=t,t.Qg=new hi,t.Qg.diagram=t,t.cj=new hi,t.cj.diagram=t,t.zg=null,t.pf=null,t.qu=!1,function(t){function e(t){var e=t.toLowerCase(),o=new $;i.add(t,o),i.add(e,o),n.add(t,t),n.add(e,t)}var i=new ft,n=new ft;e("InitialAnimationStarting"),e("AnimationStarting"),e("AnimationFinished"),e("BackgroundSingleClicked"),e("BackgroundDoubleClicked"),e("BackgroundContextClicked"),e("ClipboardChanged"),e("ClipboardPasted"),e("DocumentBoundsChanged"),e("ExternalObjectsDropped"),e("GainedFocus"),e("InitialLayoutCompleted"),e("LayoutCompleted"),e("LinkDrawn"),e("LinkRelinked"),e("LinkReshaped"),e("LostFocus"),e("Modified"),e("ObjectSingleClicked"),e("ObjectDoubleClicked"),e("ObjectContextClicked"),e("PartCreated"),e("PartResized"),e("PartRotated"),e("SelectionMoved"),e("SelectionCopied"),e("SelectionDeleting"),e("SelectionDeleted"),e("SelectionGrouped"),e("SelectionUngrouped"),e("ChangingSelection"),e("ChangedSelection"),e("SubGraphCollapsed"),e("SubGraphExpanded"),e("TextEdited"),e("TreeCollapsed"),e("TreeExpanded"),e("ViewportBoundsChanged"),e("InvalidateDraw"),t.iw=i,t.hw=n}(t),t.ai=new Z,t.Ht=!0,t.uu=ts,t.pw=!1,t.wu=qr,t.it="auto",t.Op="auto",t.zh=null,t.Fh=null,t.Bh=null,t.Qh=null,t.Oh=null,t.Nh=null,t.Qt=null,t.Lh=null,t.xt=!1,t.Mh=null,t.Ph=null,t.$h=null,t.Ch=null,t.Rt=!1,t.Yt={},t.oj=[null,null],t.Wg=!1,t.Iw=!1,t.ou=!1,t.lt=!1,t.rw=!0,t.ld=!1,t.$i=!1,t.Tw=!0,t.Ce=-2,t.Og=new ft,t.Xn=new $,t.Gg=!1,t.Jd=!0,t.Us=!0,t.Fi=!0,t.Gi=!0,t.Vs=!1,t.Ws=!0,t.Pi=!0,t.Hi=!0,t.Qi=!0,t.Ys=!0,t.Ii=!0,t.Ki=!0,t.Ji=!0,t.Li=!0,t.Mi=!0,t.Ni=!0,t.Oi=!0,t.Zs=!0,t.at=!0,t.qw=!1,t.Vk=!1,t.mn=!0,t.nn=!0,t.Xs=!0,t.$s=!0,t.iu=16,t.mu=16,t.qr=!1,t.gu=!1,t.lu=0,t.ju=0,t.yb=new Kt(5).freeze(),t.Hw=(new Z).freeze(),t.Nt=999999999,t.nw=(new Z).freeze(),t.Zi=!0,t.Ee=!0,t.vd=!0,t.Be=!1,t.gf=!1,t.xh=!0,t.hf=!1,t.sy=new Z,t.ow=new Z,t.Xh=null,t.aw=new At(8,8),t.bw=999,t.Bw=1,t.Jw=0,t.fc={scale:1,position:new pt,bounds:new jt,Py:new At,bA:new At,Oz:!1},t.fc.canvasSize=t.fc.Py,t.fc.newCanvasSize=t.fc.bA,t.fc.isScroll=!1,t.Rw=new jt(NaN,NaN,NaN,NaN).freeze(),t.wo=new At(NaN,NaN).freeze(),t.Sp=new jt(NaN,NaN,NaN,NaN).freeze(),t.It=!1,t.Lg=new ft;var e=new _u,i=new Pl;i.bind(new Hf("text","",F)),e.add(i),t.ny=e,t.Lg.add("",e),e=new _u,(i=new Pl).stroke="brown",i.bind(new Hf("text","",F)),e.add(i),t.Lg.add("Comment",e),(e=new _u).selectable=!1,e.avoidable=!1,(i=new pl).figure="Ellipse",i.fill="black",i.stroke=null,i.desiredSize=new At(3,3).ja(),e.add(i),t.Lg.add("LinkLabel",e),t.Yi=new ft,(e=new gc).selectionObjectName="GROUPPANEL",e.type=Th.Vertical,(i=new Pl).font="bold 12pt sans-serif",i.bind(new Hf("text","",F)),e.add(i),(i=new Th(Th.Auto)).name="GROUPPANEL";var n=new pl;n.figure="Rectangle",n.fill="rgba(128,128,128,0.2)",n.stroke="black",i.add(n),(n=new bc).padding=new Kt(5,5,5,5).ja(),i.add(n),e.add(i),t.ly=e,t.Yi.add("",e),t.Kh=new ft,e=new wc,(i=new pl).isPanelMain=!0,e.add(i),(i=new pl).toArrow="Standard",i.fill="black",i.stroke=null,i.strokeWidth=0,e.add(i),t.my=e,t.Kh.add("",e),e=new wc,(i=new pl).isPanelMain=!0,i.stroke="brown",e.add(i),t.Kh.add("Comment",e),(e=new Wu).type=Th.Auto,(i=new pl).fill=null,i.stroke="dodgerblue",i.strokeWidth=3,e.add(i),(i=new bc).margin=new Kt(1.5,1.5,1.5,1.5).ja(),e.add(i),t.St=e,t.wt=e,(e=new Wu).type=Th.Link,(i=new pl).isPanelMain=!0,i.fill=null,i.stroke="dodgerblue",i.strokeWidth=3,e.add(i),t.Kt=e,t.fe=null,t.mq=!1,t.Ck=null,t.partManager=new Zd,t.toolManager=new xi,t.toolManager.initializeStandardTools(),t.defaultTool=t.toolManager,t.currentTool=t.defaultTool,t.nt=null,t.Wm=new Ss,t.Vt=null,t.Wt=null,t.Mr=!1,t.commandHandler=Bo(),t.eq=null,t.fq=st,t.Pw=!1,t.Mb=1,t.Yh=null,t.Oq=1,t.Sq=0,t.zw=[0,0,0,0,0],t.Tq=0,t.yq=1,t.tw=0,t.uw=new pt,t.zy=500,t.wp=new pt,t.wq=!1}function Ao(t,e){t.animationManager.Cc(!0),t.Hw=(new Z).freeze(),t.nw=(new Z).freeze();var i=t.skipsUndoManager,n=null!==t.cc&&void 0!==t.cc;n&&(t.skipsUndoManager=!0);var o=null;null!==t.fe&&(null!==(o=t.fe.part)&&t.remove(o));var r=[],s=t.Wa.length;if(e){for(e=0;e<s;e++)for(var a=t.Wa.s[e].parts;a.next();){var h=a.value;h!==o&&null===h.data&&r.push(h)}for(e=0;e<r.length;e++)t.remove(r[e])}for(e=0;e<s;e++)t.Wa.s[e].clear();return t.partManager.clear(),t.De.clear(),t.Eh.clear(),t.ai.clear(),t.Ck=null,t.Xn.clear(),ru(),t.Og.clear(),R=[],null!==o&&(t.add(o),t.partManager.parts.remove(o)),n&&(t.skipsUndoManager=i),r}function Bo(){return null}function Do(t,e){if(Vr){if(null!=e||w("Diagram setup requires an argument DIV."),null!==t.Ka&&w("Diagram has already completed setup."),"string"==typeof e?t.Ka=m.document.getElementById(e):e instanceof HTMLDivElement?t.Ka=e:w("No DIV or DIV id supplied: "+e),null===t.Ka&&w("Invalid DIV id; could not get element with id: "+e),void 0!==t.Ka.H&&w("Invalid div id; div already has a Diagram associated with it."),!t.ol&&m.ResizeObserver){var i=v((function(){t.$b()}),250);t.ol=new m.ResizeObserver((function(){i()})),t.ol.observe(t.Ka)}"static"===m.getComputedStyle(t.Ka,null).position&&(t.Ka.style.position="relative");var n="rgba(2"+(e=5)+"5, 255, 255, 0)";e--,t.Ka.style["-webkit-tap-highlight-color"]=n,t.Ka.innerHTML="",t.Ka.H=t,t.Ka.goDiagram=t,t.Ka.go=m.go;var o=new Da(t);if(void 0!==o.style&&(o.style.position="absolute",o.style.top="0px",o.style.left="0px","rtl"===m.getComputedStyle(t.Ka,null).getPropertyValue("direction")&&(t.tn=!0),o.style.zIndex="2",o.style.userSelect="none",o.style.MozUserSelect="none",o.style.touchAction="none",o.style.letterSpacing="normal !important",o.style.wordSpacing="normal !important"),t.ta=o,t.ib=o.context,n=t.ib,t.Mb=t.computePixelRatio(),t.viewSize.w()||(t.Aa=t.Ka.clientWidth||1,t.ya=t.Ka.clientHeight||1),rr(t,t.Aa,t.ya),t.Ka.insertBefore(o.Oa,t.Ka.firstChild),(o=new Da(null)).width=1,o.height=1,t.jw=o,t.oy=o.context,Vr){o=b("div");var r=b("div");o.style.position="absolute",o.style.overflow="auto",o.style.width=t.Aa+"px",o.style.height=t.ya+"px",o.style.zIndex="1",r.style.position="absolute",r.style.width="1px",r.style.height="1px",t.Ka.appendChild(o),o.appendChild(r),o.onscroll=zo,o.addEventListener("pointerdown",Ro),o.H=t,o.uy=!0,o.vy=!0,t.ku=o,t.hu=r}t.hk=v((function(){t.Yh=null,t.N()}),300),t.Ov=v((function(){Eo(t)}),250),t.preventDefault=function(t){return t.preventDefault(),!1},t.$j=function(e){if(t.isEnabled){var i=Uo(t,e,!0);i.bubbles=!0;var n=0,o=0;i.delta=0,void 0!==e.deltaX?(0!==e.deltaX&&(n=0<e.deltaX?1:-1),0!==e.deltaY&&(o=0<e.deltaY?1:-1),i.delta=Math.abs(e.deltaX)>Math.abs(e.deltaY)?-n:-o):void 0!==e.wheelDeltaX?(0!==e.wheelDeltaX&&(n=0<e.wheelDeltaX?-1:1),0!==e.wheelDeltaY&&(o=0<e.wheelDeltaY?-1:1),i.delta=Math.abs(e.wheelDeltaX)>Math.abs(e.wheelDeltaY)?-n:-o):void 0!==e.wheelDelta&&0!==e.wheelDelta&&(i.delta=0<e.wheelDelta?1:-1),t.doMouseWheel(),Ko(i,e)}},t.aA=function(e){t.isEnabled&&(t.Vk=!1,Uo(t,e,!0),(e=t.currentTool).cancelWaitAfter(),e.standardMouseOver())},t.ui=function(e){if(t.isEnabled){t.Vk=!0;var i=t.Yt;void 0===i[e.pointerId]&&(i[e.pointerId]=e);var n=!1;if(null===(i=t.oj)[0]||i[0].pointerId!==e.pointerId&&i[0].pointerType===e.pointerType)if(null!==i[1]&&i[1].pointerId===e.pointerId)i[1]=e,n=!0;else if(null===i[0])i[0]=e;else{if(null!==i[1])return void e.preventDefault();i[1]=e,n=!0}else i[0]=e;(i="touch"===e.pointerType||"pen"===e.pointerType)&&(t.qu=!1,t.wq=!0);var o=n;n=Wo(t,e,!0,!1,!0,o),_o(t,e,n),n.targetDiagram=qo(e,e.target),n.targetObject=null,o||n.clone(t.bq),o=t.uw,i=i?25:10,e.timeStamp-t.tw<t.zy&&!(Math.abs(o.x-e.screenX)>i||Math.abs(o.y-e.screenY)>i)?t.yq++:t.yq=1,n.clickCount=t.yq,t.tw=e.timeStamp,t.uw.sg(e.screenX,e.screenY),t.doMouseDown(),1===e.button?e.preventDefault():Ko(n,e)}},t.dk=function(e){if(t.isEnabled){t.Vk=!0;var i=t.oj;if(null===i[0]||i[0].pointerId!==e.pointerId&&i[0].pointerType===e.pointerType){if(null!==i[1]&&i[1].pointerId===e.pointerId)return void(i[1]=e);if(null!==i[0])return;i[0]=e}else i[0]=e;if(i[0].pointerId===e.pointerId){i=Wo(t,e,!1,!1,!1,null!==i[1]);var n=m.document.elementFromPoint(e.clientX,e.clientY)||null;null!==n&&void 0!==n.shadowRoot&&null!==n.shadowRoot&&(n=n.shadowRoot.elementFromPoint(e.clientX,e.clientY));var o=t,r=e;n&&n.H&&(r=e,o=n.H),i.targetDiagram=o,_o(t,r,i),i.targetObject=null,t.doMouseMove(),Ko(i,e)}}},t.fk=function(e){if(t.isEnabled){t.Vk=!0;var i="touch"===e.pointerType||"pen"===e.pointerType,n=t.Yt;if(i&&t.qu)delete n[e.pointerId],e.preventDefault();else if(null===(n=t.oj)[0]||n[0].pointerId!==e.pointerId&&n[0].pointerType===e.pointerType)null!==n[1]&&n[1].pointerId===e.pointerId&&(n[1]=null);else{n[0]=null,n=Wo(t,e,!1,!0,!0,!1);var o=m.document.elementFromPoint(e.clientX,e.clientY)||null;null!==o&&void 0!==o.shadowRoot&&null!==o.shadowRoot&&(o=o.shadowRoot.elementFromPoint(e.clientX,e.clientY)),null!==o&&o.H instanceof No&&o.H!==t&&_o(o.H,e,n),null===o&&(o=e.target),_o(t,e,n),n.clickCount=t.yq,n.targetDiagram=qo(e,o),n.targetObject=null,t.doMouseUp(),Ko(n,e),i&&(t.wq=!1)}}},t.ek=function(e){if(t.isEnabled){t.Vk=!1;var i=t.Yt;i[e.pointerId]&&delete i[e.pointerId],null!==(i=t.oj)[0]&&i[0].pointerId===e.pointerId&&(i[0]=null),null!==i[1]&&i[1].pointerId===e.pointerId&&(i[1]=null),"touch"!==e.pointerType&&"pen"!==e.pointerType&&((e=t.currentTool).cancelWaitAfter(),e.standardMouseOver())}},t.ck=function(e){var i=t.oj;null!==i[0]&&i[0].pointerId===e.pointerId?(i[0]=null,t.wq=!1):null!==i[1]&&i[1].pointerId===e.pointerId&&(i[1]=null)},t.Vp=n.Z["d"+ws[1]+ws[2]+"wI"+rs.slice(1,5)]["b"+Xf.slice(1,e)](n.Z,ss,e,e),n.Vc(!0),function(t){var e=t.ta.Oa;e instanceof HTMLCanvasElement||(e=t.div),t.addEventListener(e,"pointerdown",t.ui,!1),t.addEventListener(e,"pointermove",t.dk,!1),t.addEventListener(e,"pointerup",t.fk,!1),t.addEventListener(e,"pointerout",t.ek,!1),t.addEventListener(e,"pointercancel",t.ck,!1),t.addEventListener(e,"pointerenter",t.bz,!1),t.addEventListener(e,"pointerleave",t.cz,!1),t.addEventListener(e,"wheel",t.$j,!1),t.addEventListener(e,"keydown",t.Qz,!1),t.addEventListener(e,"keyup",t.Rz,!1),t.addEventListener(e,"blur",t.Ny,!1),t.addEventListener(e,"focus",t.Oy,!1),t.addEventListener(e,"selectstart",(function(t){return t.preventDefault(),!1}),!1),t.addEventListener(e,"contextmenu",(function(t){return t.preventDefault(),!1}),!1),t.addEventListener(m,"resize",t.Ov,!1)}(t),"svg"===t.nl&&(e=t.pj.get("svg"),t.Ka.appendChild(e.Oa),t.ib=e.context)}}function Fo(t){30<t.Sq&&(t.Yh=1)}function jo(t,e){null!==t.Yh&&(t.Yh=null,e&&t.hk(),X&&X.nx||(t.Sq=0,t.zw=[0,0,0,0,0],t.Tq=0))}function Eo(t){if(null!==t.ta){var e=t.Ka;if(null!==e&&0!==e.clientWidth&&0!==e.clientHeight){t.Gw||t.setScrollWidth();var i=t.gf?t.Db:0,n=t.Be?t.Db:0,o=t.Mb;t.Mb=t.computePixelRatio(),t.Mb!==o&&(t.pn=!0,t.$b()),e.clientWidth===t.Aa+i&&e.clientHeight===t.ya+n||(t.Ee=!0,t.Fc=!0,null!==(e=t.layout)&&e.isViewportSized&&t.autoScale===Yr&&(t.Jk=!0,e.C()),t.ld||t.$b())}}}function Oo(t){var e=new Mo;e.name="Background",t.Al(e),(e=new Mo).name="",t.Al(e),(e=new Mo).name="Foreground",t.Al(e),(e=new Mo).name="Adornment",e.isTemporary=!0,e.isInDocumentBounds=!1,t.Al(e),(e=new Mo).name="Tool",e.isTemporary=!0,e.isInDocumentBounds=!0,t.Al(e),(e=new Mo).name="Grid",e.allowSelect=!1,e.pickable=!1,e.isTemporary=!0,e.isInDocumentBounds=!1,t.Ww(e,t.Qj("Background"))}function Io(t){var e=new Th(Th.Grid);e.name="GRID";var i=new pl;return i.figure="LineH",i.stroke="lightgray",i.strokeWidth=.5,i.interval=1,e.add(i),(i=new pl).figure="LineH",i.stroke="gray",i.strokeWidth=.5,i.interval=5,e.add(i),(i=new pl).figure="LineH",i.stroke="gray",i.strokeWidth=1,i.interval=10,e.add(i),(i=new pl).figure="LineV",i.stroke="lightgray",i.strokeWidth=.5,i.interval=1,e.add(i),(i=new pl).figure="LineV",i.stroke="gray",i.strokeWidth=.5,i.interval=5,e.add(i),(i=new pl).figure="LineV",i.stroke="gray",i.strokeWidth=1,i.interval=10,e.add(i),(i=new ku).add(e),i.layerName="Grid",i.zOrder=0,i.isInDocumentBounds=!1,i.isAnimated=!1,i.pickable=!1,i.locationObjectName="GRID",t.add(i),t.partManager.parts.remove(i),e.visible=!1,e}function zo(){this.H.gu?this.H.gu=!1:this.H.isEnabled?this.H.kx(this):sr(this.H)}function Ro(t){this.H.isEnabled?(this.H.lu=t.target.scrollTop,this.H.ju=t.target.scrollLeft):sr(this.H)}function Vo(t,e){if(t.fixedBounds.w())return e.assign(t.fixedBounds),e.Co(t.yb),e;for(var i=!0,n=t.Wa.s,o=n.length,r=0;r<o;r++){var s=n[r];if(s.visible&&s.isInDocumentBounds)for(var a=(s=s.Pa.s).length,h=0;h<a;h++){var l=s[h];l.isInDocumentBounds&&l.isVisible()&&((l=l.actualBounds).w()&&(i?(i=!1,e.assign(l)):e.ed(l)))}}return i&&e.h(0,0,0,0),e.Co(t.yb),e}function Go(t,e){if((e||t.hf)&&!t.vb&&null!==t.ta&&t.documentBounds.w()){if(t.vb=!0,e){var i=t.initialPosition;if(i.w())return t.vb=!1,void(t.position=i);(i=pt.alloc()).xi(t.documentBounds,t.initialDocumentSpot);var n=t.viewportBounds;n=jt.allocAt(0,0,n.width,n.height);var o=pt.alloc();o.xi(n,t.initialViewportSpot),o.h(i.x-o.x,i.y-o.y),t.position=o,jt.free(n),pt.free(o),pt.free(i)}i=t.yh,e&&t.Fg!==Yr&&(i=t.Fg);var r=i!==Yr?Ho(t,i):t.scale;i=t.pa.x,n=t.pa.y,o=t.Aa/r;var s=t.ya/r,a=t.zk,h=t.pq;e&&!a.sb()&&(h.sb()||h.Xb())&&(a=h.Xb()?oe:h),Yo(t,t.documentBounds,o,s,a,e),e=t.scale,t.scale=r,t.vb=!1,r=t.viewportBounds,Ye.B(r.x,i)&&Ye.B(r.y,n)&&Ye.B(r.width,o)&&Ye.B(r.height,s)||t.onViewportBoundsChanged(new jt(i,n,o,s),r,e,!1)}}function Ho(t,e){var i=t.Pp;if(null===t.ta)return i;t.Va();var n=t.documentBounds;if(!n.w())return i;var o=n.width;n=n.height;var r=t.Aa+(t.gf?t.Db:0),s=t.ya+(t.Be?t.Db:0),a=r/o,h=s/n;return e===Xr?((e=Math.min(h,a))>i&&(e=i),e<t.minScale&&(e=t.minScale),e>t.maxScale&&(e=t.maxScale),e):e===Ur?((e=h>a?(s-t.Db)/n:(r-t.Db)/o)>i&&(e=i),e<t.minScale&&(e=t.minScale),e>t.maxScale&&(e=t.maxScale),e):t.scale}function Yo(t,e,i,n,o,r){var s=pt.allocAt(t.pa.x,t.pa.y),a=s.x,h=s.y;if(null!==t.eq){var l=pt.alloc();a=(l=t.eq.ga(te,l)).x-t.fq.x/t.scale,h=l.y-t.fq.y/t.scale,o=Qt,pt.free(l)}(r||t.scrollMode===Zr)&&(o.sb()&&(i>e.width&&(a=e.x+(o.x*e.width+o.offsetX)-(o.x*i-o.offsetX)),n>e.height&&(h=e.y+(o.y*e.height+o.offsetY)-(o.y*n-o.offsetY))),o=t.rj,r=i-e.width,i<e.width+o.left+o.right?(a=Math.min(a+i/2,e.right+Math.max(r,o.right)-i/2),a=Math.max(a,e.left-Math.max(r,o.left)+i/2),a-=i/2):a>e.left?a=e.left:a<e.right-i&&(a=e.right-i),i=n-e.height,n<e.height+o.top+o.bottom?(h=Math.min(h+n/2,e.bottom+Math.max(i,o.bottom)-n/2),h=Math.max(h,e.top-Math.max(i,o.top)+n/2),h-=n/2):h>e.top?h=e.top:h<e.bottom-n&&(h=e.bottom-n)),s.x=isFinite(a)?a:-t.yb.left,s.y=isFinite(h)?h:-t.yb.top,null!==t.positionComputation&&(e=t.positionComputation(t,s),s.x=e.x,s.y=e.y),Zn(t.Yd,t.pa,s),t.pa.h(s.x,s.y),kr(t),pt.free(s)}function Xo(t,e,i,n){for(void 0===i&&(i=null),void 0===n&&(n=null),Qo(t),t=t.Wa.iteratorBackwards;t.next();){var o=t.value;if(o.visible&&!o.isTemporary&&null!==(o=o.ic(e,i,n)))return o}return null}function Uo(t,e,i){var n=t.Qg;return t.Qg=t.cj,t.cj=n,n.diagram=t,n.event=e,i?_o(t,e,n):(n.viewPoint=t.Qg.viewPoint,n.documentPoint=t.Qg.documentPoint),t=0,e.ctrlKey&&(t+=1),e.altKey&&(t+=2),e.shiftKey&&(t+=4),e.metaKey&&(t+=8),n.modifiers=t,n.button=e.button,void 0!==e.buttons&&(n.buttons=e.buttons),z&&0===e.button&&e.ctrlKey&&(n.button=2),n.down=!1,n.up=!1,n.clickCount=1,n.delta=0,n.handled=!1,n.bubbles=!1,n.timestamp=e.timeStamp,n.isMultiTouch=!1,n.targetDiagram=qo(e,e.target),n.targetObject=null,n}function qo(t,e){return null===e?null:(e=e.H)?e:((e=t.path)||"function"!=typeof t.composedPath||(e=t.composedPath()),e&&e[0]&&e[0].H?e[0].H:null)}function Wo(t,e,i,n,o,r){var s=t.Qg;return t.Qg=t.cj,t.cj=s,s.diagram=t,s.clickCount=1,t=s.delta=0,e.ctrlKey&&(t+=1),e.altKey&&(t+=2),e.shiftKey&&(t+=4),e.metaKey&&(t+=8),s.modifiers=t,s.event=e,s.timestamp=e.timeStamp,s.button=e.button,s.buttons=e.buttons,z&&0===e.button&&e.ctrlKey&&(s.button=2),s.down=i,s.up=n,s.handled=!1,s.bubbles=o,s.isMultiTouch=r,s}function Ko(t,e){return!!t.bubbles||(void 0!==e.stopPropagation&&e.stopPropagation(),!1!==e.cancelable&&e.preventDefault(),e.cancelBubble=!0,!1)}function _o(t,e,i){var n=t.ta,o=t.Aa,r=t.ya,s=0,a=0;null!==n&&(n=n.getBoundingClientRect(),s=e.clientX-o/n.width*n.left,a=e.clientY-r/n.height*n.top),i.viewPoint.h(s,a),null!==t.Ab?(e=pt.allocAt(s,a),t.Ab.Cd(e),i.documentPoint.assign(e),pt.free(e)):i.documentPoint.h(s,a)}function $o(t,e,i){if(null!==t.oj[0]){e=t.oj[e];var n=t.ta;null!==n&&(n=n.getBoundingClientRect(),i.h(e.clientX-t.Aa/n.width*n.left,e.clientY-t.ya/n.height*n.top))}}function Jo(t,e,i){!t.Ee||t.vb||t.animationManager.defaultAnimation.isAnimating||sr(t)||(e&&Qo(t),i&&Go(t,!1))}function Zo(t,e){if(!t.ld&&(t.kg=!1,null!==t.Ka||t.wo.w())){t.ld=!0;var i=t.animationManager,n=t.Xn;if(!i.isAnimating&&0!==n.length){for(var o=n.s,r=o.length,s=0;s<r;s++){var a=o[s];ia(a,!1),a.v()}n.clear()}0<(n=t.ow).count&&(n.each((function(t){t.Nv()})),n.clear()),o=n=!1,i.defaultAnimation.isAnimating&&(o=!0,n=t.skipsUndoManager,t.skipsUndoManager=!0),i.zb||Eo(t),Jo(t,!1,!0),null!==t.fe&&(t.fe.visible&&!t.mq&&(yr(t),t.mq=!0),!t.fe.visible&&t.mq&&(t.mq=!1)),Qo(t),r=!1,t.hf&&!t.xh||(t.hf?Pr(t,!t.Jk):(t.Ea("Initial Layout"),!1===i.isEnabled&&i.Cc(),Pr(t,!1)),r=!0),t.Jk=!1,Qo(t),t.ou||function(t){t.ld||Qo(t),t.Va()}(t),Jo(t,!0,!1),s=!1,r?((i=jt.alloc()).assign(t.viewportBounds),t.hf||(s=t.hf=!0,t.skipsUndoManager||(t.undoManager.isPendingClear=!0),t.undoManager.isPendingUnmodified=!0,function(t){if(t.Fg!==Yr)t.scale=Ho(t,t.Fg);else if(t.yh!==Yr)t.scale=Ho(t,t.yh);else{var e=t.initialScale;isFinite(e)&&0<e&&(t.scale=e)}Go(t,!0),e=t.Wa.s,t.Fd(e,e.length,t,t.viewportBounds),t.R("InitialLayoutCompleted"),t.du.assign(t.pa),yr(t)}(t)),t.R("LayoutCompleted"),Jo(t,!0,!1),jt.free(i)):i.Ok&&i.Qw&&(t.Fg!==Yr?t.scale=Ho(t,t.Fg):t.yh!==Yr?t.scale=Ho(t,t.yh):(i=t.initialScale,isFinite(i)&&0<i&&(t.scale=i)),Go(t,!0)),r&&s&&t.eb("Initial Layout"),Qo(t),e||t.gc(t.ib),o&&(t.skipsUndoManager=n),t.ld=!1}}function Qo(t){if(0!==t.De.count&&(t.ld||!t.animationManager.isTicking)){for(var e=0;23>e;e++){var i=t.De.iterator;if(null===i||0===t.De.count)break;t.De=new Z,t.Nv(i,t.De)}t.nodes.each((function(t){t instanceof gc&&0!=(65536&t.U)!=!1&&(t.U=65536^t.U)}))}}function tr(t,e){for(var i=A(),n=A(),o=e.memberParts;o.next();){var r=o.value;r.isVisible()&&(r instanceof gc?(ea(r)||na(r)||Ou(r))&&tr(t,r):r instanceof wc?r.fromNode===e||r.toNode===e?n.push(r):i.push(r):(r.measure(1/0,1/0),r.arrange()))}for(t=i.length,o=0;o<t;o++)(r=i[o]).measure(1/0,1/0),r.arrange();for(B(i),e.measure(1/0,1/0),e.arrange(),t=n.length,e=0;e<t;e++)(i=n[e]).measure(1/0,1/0),i.arrange();B(n)}function er(t,e,i,n,o,r,s,a,h,l){if(null!==t.Ka){null===t.ta&&w("No canvas specified"),void 0===s&&(s=null),void 0===a&&(a=null),void 0===h&&(h=!1),void 0===l&&(l=!1),or(t),t.ib.Vc(!0),t.vd=!0,t.$i=!0;var u=t.Ca;t.Ca=o;var c=t.Wa.s,d=c.length;try{var f=new jt(r.x,r.y,n.width/o,n.height/o),p=f.copy();p.Co(i),yr(t,p),Qo(t),t.Fd(c,d,t,f),e.setTransform(1,0,0,1,0,0),e.clearRect(0,0,n.width,n.height),null!==a&&""!==a&&(e.fillStyle=a,e.ox(0,0,n.width,n.height));var g=t.Mb;e.scale(g,g);var m=Ge.alloc();m.reset(),m.translate(i.left,i.top),m.scale(o),0===r.x&&0===r.y||m.translate(-r.x,-r.y),e.setTransform(m.m11,m.m12,m.m21,m.m22,m.dx,m.dy),e.yc(),e instanceof va&&xa(e,m.m11,m.m12,m.m21,m.m22,m.dx,m.dy),Ge.free(m),ir(t,e),e.globalAlpha=t.pb;var y=t.Qj("Grid");if(s){var v=new Z,x=s.iterator;for(x.reset();x.next();){var b=x.value;b instanceof ku&&(l||b.layer!==y)&&(b.Gj(),v.add(b))}for(l=0;l<d;l++)Po(c[l],e,t,v,h);v.each((function(t){return t.Gj()}))}else for(v=0;v<d;v++){var k=c[v];k===y?l&&k.gc(e,t,!0):k.gc(e,t,h)}t.$i=!1,t.Yf&&ls(t.Yf,t)&&t.Vp()}finally{t.Ca=u,t.ib.Vc(!0),t.vd=!0,t.Fd(c,d,t,t.viewportBounds),yr(t),t.ib instanceof va&&(t.ib.Nj.PA(),t.redraw())}}}function ir(t,e){null!==(t=t.Rg)&&(void 0!==t.imageSmoothingEnabled&&e.Wx(!!t.imageSmoothingEnabled),null!=(t=t.defaultFont)&&(e.font=t))}function nr(t,e){var i,n=t instanceof Th,o=t instanceof No;for(i in e){""===i&&w("Setting properties requires non-empty property names");var r=t,s=i;if(n||o){var a=i.indexOf(".");if(0<a){var h=i.substring(0,a);n?r=t.fb(h):null==(r=t[h])&&(r=t.toolManager[h]),C(r)?s=i.substr(a+1):w("Unable to find object named: "+h+" in "+t.toString()+" when trying to set property: "+i)}}if("_"!==s[0]&&!j(r,s)){if(o&&"ModelChanged"===s){t.Yw(e[s]);continue}if(o&&"Changed"===s){t.Pe(e[s]);continue}if(o&&j(t.toolManager,s))r=t.toolManager;else{if(o&&Nr(t,s)){t.Bj(s,e[s]);continue}if(t instanceof mf&&"Changed"===s){t.Pe(e[s]);continue}w('Trying to set undefined property "'+s+'" on object: '+r.toString())}}r[s]=e[i],"_"===s[0]&&r instanceof Fs&&r.Vw(s)}}function or(t){!1!==t.pn&&(t.pn=!1,rr(t,t.Aa,t.ya))}function rr(t,e,i){kr(t);var n=t.Mb;t.ta.resize(e*n,i*n,e,i)&&(t.Fc=!0,t.ib.Vc(!0))}function sr(t){var e=t.ta;if(null===e||t.wo.w())return!0;var i=t.Aa,n=t.ya,o=t.Ka,r=!1,s=t.gf?t.Db:0,a=t.Be?t.Db:0,h=o.clientWidth||i+s,l=o.clientHeight||n+a,u=t.viewportBounds;o=u.x;var c=u.y,d=u.width,f=u.height;if(h===i+s&&l===n+a||(t.gf=!1,t.Be=!1,a=s=0,t.Aa=h,t.ya=l,r=t.pn=!0,kr(t)),!t.hf||!t.viewportBounds.w())return!0;var p=t.ku,g=t.hu;if(t.Ee=!1,!(r||t.gf||t.Be||t.mn||t.nn))return!0;var m=t.documentBounds,y=0,v=0,x=0,b=0,w=u.width,k=u.height,S=t.rj;t.contentAlignment.sb()?(m.width>w&&(y=S.left,v=S.right),m.height>k&&(x=S.top,b=S.bottom)):(y=S.left,v=S.right,x=S.top,b=S.bottom);var M=m.width+y+v,C=m.height+x+b,P=M>h/(S=t.scale),T=C>l/S;if(!(r||t.gf||t.Be||P||T))return!0;y=m.x-y,h=u.x,v=m.right+v,l=u.right+s,x=m.y-x;var N=u.y;m=m.bottom+b,u=u.bottom+a;var L="1px";if(b="1px",t.scrollMode===Zr&&(P||T)&&(P&&t.hasHorizontalScrollbar&&t.allowHorizontalScroll&&(P=1,y+1<h&&(P=Math.max((h-y)*S+t.Aa,P)),v>l+1&&(P=Math.max((v-l)*S+t.Aa,P)),w+s+1<M&&(P=Math.max((M-w)*S+t.Aa,P)),L=P.toString()+"px"),T&&t.hasVerticalScrollbar&&t.allowVerticalScroll&&(P=1,x+1<N&&(P=Math.max((N-x)*S+t.ya,P)),m>u+1&&(P=Math.max((m-u)*S+t.ya,P)),k+a+1<C&&(P=Math.max((C-k)*S+t.ya,P)),b=P.toString()+"px")),T="1px"!==b,(P="1px"!==L)&&T||!P&&!T||(T&&(l-=t.Db),P&&(u-=t.Db),M<w+s||!t.hasHorizontalScrollbar||!t.allowHorizontalScroll||(s=1,y+1<h&&(s=Math.max((h-y)*S+t.Aa,s)),v>l+1&&(s=Math.max((v-l)*S+t.Aa,s)),w+1<M&&(s=Math.max((M-w)*S+t.Aa,s)),L=s.toString()+"px"),P="1px"!==L,s=t.ya,P!==t.Be&&(s=P?t.ya-t.Db:t.ya+t.Db),C<k+a||!t.hasVerticalScrollbar||!t.allowVerticalScroll||(a=1,x+1<N&&(a=Math.max((N-x)*S+s,a)),m>u+1&&(a=Math.max((m-u)*S+s,a)),k+1<C&&(a=Math.max((C-k)*S+s,a)),b=a.toString()+"px"),T="1px"!==b),t.qr&&P===t.Be&&T===t.gf)return i===t.Aa&&n===t.ya||t.bd(),!1;if(P!==t.Be&&(t.ya="1px"===L?t.ya+t.Db:Math.max(t.ya-t.Db,1),r=!0),t.Be=P,g.style.width=L,T!==t.gf&&(t.Aa="1px"===b?t.Aa+t.Db:Math.max(t.Aa-t.Db,1),r=!0,t.tn&&(a=pt.alloc(),T?(e.style.left=t.Db+"px",t.position=a.h(t.pa.x+t.Db/t.scale,t.pa.y)):(e.style.left="0px",t.position=a.h(t.pa.x-t.Db/t.scale,t.pa.y)),pt.free(a))),r&&kr(t),t.gf=T,g.style.height=b,t.gu=!0,r&&(t.pn=!0),e=p.scrollLeft,t.hasHorizontalScrollbar&&t.allowHorizontalScroll&&(w+1<M?e=(t.position.x-y)*S:y+1<h?e=p.scrollWidth-p.clientWidth:v>l+1&&(e=t.position.x*S)),t.tn)switch(t.bu){case"negative":e=-(p.scrollWidth-e-p.clientWidth);break;case"reverse":e=p.scrollWidth-e-p.clientWidth}return p.scrollLeft=e,t.hasVerticalScrollbar&&t.allowVerticalScroll&&(k+1<C?p.scrollTop=(t.position.y-x)*S:x+1<N?p.scrollTop=p.scrollHeight-p.clientHeight:m>u+1&&(p.scrollTop=t.position.y*S)),h=t.Aa,l=t.ya,p.style.width=h+(t.gf?t.Db:0)+"px",p.style.height=l+(t.Be?t.Db:0)+"px",i===h&&n===l&&!t.animationManager.zb||(i=jt.allocAt(o,c,d,f),t.onViewportBoundsChanged(i,t.viewportBounds,S,r),jt.free(i),!1)}function ar(t,e,i){var n=e.layer;null!==n&&n.diagram===t&&(e.isSelected=!1,e.isHighlighted=!1,e.C(2),i&&e.Lj(),0<=(i=n.pc(-1,e,!1))&&t.cb(pi,"parts",n,e,null,i,null),null!==(t=e.layerChanged)&&t(e,n,null))}function hr(t,e,i,n,o,r){if(!e.contains(i)&&(void 0===r&&(r=!1),!n||r||i.canMove()||i.canCopy()))if(void 0===o&&(o=ur(t)),i instanceof _u){if(e.add(i,t.Pd(o,i,i.location)),i instanceof gc&&(null!==i.placeholder||o.dragsMembers))for(r=i.memberParts;r.next();)hr(t,e,r.value,n,o,o.groupsAlwaysMove);for(r=i.linksConnected;r.next();){var s=r.value;if(!e.contains(s)){var a=s.fromNode,h=s.toNode;null!==a&&e.contains(a)&&null!==h&&e.contains(h)&&hr(t,e,s,n,o)}}if(o.dragsTree)for(i=i.Ou();i.next();)hr(t,e,i.value,n,o)}else if(i instanceof wc)for(e.add(i,t.Pd(o,i)),i=i.labelNodes;i.next();)hr(t,e,i.value,n,o);else i instanceof Wu||e.add(i,t.Pd(o,i,i.location))}function lr(t,e,i,n,o){if(null!==e&&0!==e.count){var r=pt.alloc(),s=pt.alloc();s.assign(i),isNaN(s.x)&&(s.x=0),isNaN(s.y)&&(s.y=0),(i=t.Mr)||dr(t,e);for(var a=A(),h=A(),l=e.iterator,u=pt.alloc();l.next();){var c=l.key,d=l.value;if(c.Zc()){var f=pr(t,c,e);null!==f?a.push(new ks(c,d,f)):o&&!c.canMove()||(f=d.point,r.assign(f),t.computeMove(c,r.add(s),n,u),c.location=u,void 0===d.shifted&&(d.shifted=new pt),d.shifted.assign(u.re(f)))}else l.key instanceof wc&&h.push(l.sa)}for(pt.free(u),o=a.length,l=0;l<o;l++)c=a[l],r.assign(c.info.point),void 0===c.Su.shifted&&(c.Su.shifted=new pt),c.node.location=r.add(c.Su.shifted);for(o=pt.alloc(),l=pt.alloc(),c=h.length,d=0;d<c;d++){var p=h[d];if((f=p.key)instanceof wc)if(f.suspendsRouting){f.Tg=null,u=f.fromNode;var g=f.toNode;if(null!==t.draggedLink&&n.dragsLink)if(g=p.value.point,null===f.dragComputation)e.add(f,t.Pd(n,f,s)),Mc(f,s.x-g.x,s.y-g.y);else{p=pt.allocAt(0,0),(u=f.i(0))&&u.w()&&p.assign(u);var m=u=pt.alloc().assign(p).add(s);n.isGridSnapEnabled&&(n.isGridSnapRealtime||t.lastInput.up)&&cr(t,f,u,m=pt.alloc(),n),u.assign(f.dragComputation(f,u,m)).re(p),e.add(f,t.Pd(n,f,u)),Mc(f,u.x-g.x,u.y-g.y),pt.free(p),pt.free(u),m!==u&&pt.free(m)}else null!==u&&(o.assign(u.location),null!==(m=e.I(u))&&o.re(m.point)),null!==g&&(l.assign(g.location),null!==(m=e.I(g))&&l.re(m.point)),null!==u&&null!==g?o.Xa(l)?(u=p.value.point,(g=r).assign(o),g.re(u),e.add(f,t.Pd(n,f,o)),Mc(f,g.x,g.y)):(f.suspendsRouting=!1,f.bb()):(p=p.value.point,u=null!==u?o:null!==g?l:s,e.add(f,t.Pd(n,f,u)),Mc(f,u.x-p.x,u.y-p.y))}else null!==f.fromNode&&null!==f.toNode||(u=p.value.point,e.add(f,t.Pd(n,f,s)),Mc(f,s.x-u.x,s.y-u.y))}pt.free(r),pt.free(s),pt.free(o),pt.free(l),B(a),B(h),i||(Qo(t),fr(t,e))}}function ur(t){var e=t.toolManager.findTool("Dragging");return null!==e?e.dragOptions:t.Wm}function cr(t,e,i,n,o){if(void 0===o&&(o=ur(t)),n.assign(i),null!==e){var r=t.grid;t=(e=o.gridSnapCellSize).width,e=e.height;var s=o.gridSnapOrigin,a=s.x;if(s=s.y,o=o.gridSnapCellSpot,null!==r){var h=r.gridCellSize;isNaN(t)&&(t=h.width),isNaN(e)&&(e=h.height),r=r.gridOrigin,isNaN(a)&&(a=r.x),isNaN(s)&&(s=r.y)}(r=pt.allocAt(0,0)).yi(0,0,t,e,o),Ye.No(i.x,i.y,a+r.x,s+r.y,t,e,n),pt.free(r)}}function dr(t,e){if(null!==e)for(t.Mr=!0,t=e.iterator;t.next();)(e=t.key)instanceof wc&&(e.suspendsRouting=!0)}function fr(t,e){if(null!==e){for(e=e.iterator;e.next();){var i=e.key;i instanceof wc&&(i.suspendsRouting=!1,Ac(i)&&i.bb())}t.Mr=!1}}function pr(t,e,i){if(null!==(e=e.containingGroup)){if(null!==(t=pr(t,e,i)))return t;if(null!==(t=i.I(e)))return t}return null}function gr(t,e,i){if(null!==e.diagram&&e.diagram!==t&&w("Cannot share a Layer with another Diagram: "+e+" of "+e.diagram),null===i?null!==e.diagram&&w("Cannot add an existing Layer to this Diagram again: "+e):(i.diagram!==t&&w("Existing Layer must be in this Diagram: "+i+" not in "+i.diagram),e===i&&w("Cannot move a Layer before or after itself: "+e)),e.diagram!==t){e=e.name,i=(t=t.Wa).count;for(var n=0;n<i;n++)t.M(n).name===e&&w("Cannot add Layer with the name '"+e+"'; a Layer with the same name is already present in this Diagram.")}}function mr(t,e,i){var n=t.animationManager;if(t.vb||t.ld)t.Ca=i,kr(t),t.N(),t.Ee=!0,n.zb&&(Kn(n)||n.ce.add(n.H,"scale",e,t.Ca));else if(null===t.ta)t.Ca=i,kr(t);else{t.vb=!0;var o=t.viewportBounds.copy(),r=t.Aa,s=t.ya,a=t.zoomPoint.x,h=t.zoomPoint.y,l=t.contentAlignment;isNaN(a)&&(l.$c()?l.Hf(ue)?a=0:l.Hf(ce)&&(a=r-1):a=l.sb()?l.x*(r-1):r/2),isNaN(h)&&(l.$c()?l.Hf(le)?h=0:l.Hf(de)&&(h=s-1):h=l.sb()?l.y*(s-1):s/2),null===t.scaleComputation||t.animationManager.defaultAnimation.isAnimating||(i=t.scaleComputation(t,i)),i<t.minScale&&(i=t.minScale),i>t.maxScale&&(i=t.maxScale),r=pt.allocAt(t.pa.x+a/e-a/i,t.pa.y+h/e-h/i),t.position=r,pt.free(r),t.Ca=i,kr(t),t.vb=!1,t.onViewportBoundsChanged(o,t.viewportBounds,e,!1),Go(t,!1),n.zb&&(Kn(n)||n.ce.add(n.H,"scale",e,t.Ca))}}function yr(t,e){var i=t.fe;if(null!==i&&i.visible){for(var n=At.alloc(),o=1,r=1,s=i.O.s,a=s.length,h=0;h<a;h++){var l=s[h],u=Math.abs(l.interval);2>u||(Dh(l.figure)?r=r*u/Ye.vx(r,u):o=o*u/Ye.vx(o,u))}if(s=i.gridCellSize,n.h(r*s.width,o*s.height),void 0!==e)o=e.width,r=e.height,t=e.x,s=e.y;else{if(e=jt.alloc(),t=t.viewportBounds,e.h(t.x,t.y,t.width,t.height),!e.w())return void jt.free(e);o=e.width,r=e.height,t=e.x,s=e.y,jt.free(e)}i.width=o+2*n.width,i.height=r+2*n.height,e=pt.alloc(),Ye.No(t,s,0,0,n.width,n.height,e),e.offset(-n.width,-n.height),At.free(n),i.part.location=e,pt.free(e)}}function vr(t){var e=t.isModified;t.Tw!==e&&(t.Tw=e,t.R("Modified"))}function xr(t,e){for(var i=(e=e.O.s).length,n=0;n<i;n++)br(t,e[n])}function br(t,e){if(e instanceof ou){var i=e.element;if(null!==i&&i instanceof HTMLImageElement){i.Bg instanceof Z&&i.Bg.add(t);var n=e.Eg;if(null!==n&&!0===n.sq&&null!==e.diagram&&e.diagram.Xn.add(e),i.hn)if(i=i.getAttribute("src")||"",null===(n=t.Og.I(i)))(n=[]).push(e),t.Og.add(i,n);else{for(t=0;t<n.length;t++)if(n[t]===e)return;n.push(e)}}}}function wr(t,e){if(e instanceof ou){var i=e.element;if(null!==i&&i instanceof HTMLImageElement&&i.hn){var n=i.getAttribute("src")||"",o=t.Og.I(n);if(null!==o)for(var r=0;r<o.length;r++)if(o[r]===e){o.splice(r,1),0===o.length&&(t.Og.remove(n),i.Fq&&i.removeEventListener("load",i.Fq),i.Yp&&i.removeEventListener("error",i.Yp),delete i.Fq,delete i.Yp,i.Bg instanceof Z&&i.Bg.remove(t),ru(n));break}}}}function kr(t){var e=t.pa,i=t.Ca;t.Rw.h(e.x,e.y,Math.max(t.Aa,0)/i,Math.max(t.ya,0)/i),t.vd=!0}function Sr(t,e){t.Zi=!1;var i=t.Sp;i.D(e)||(i=i.copy(),t.Sp.assign(e),Go(t,!1),t.R("DocumentBoundsChanged",void 0,i),t.Ee=!0,t.N())}function Mr(t,e){for(var i=t.ai.iterator;i.next();)Cr(t,i.value,e);t.layout&&(e?t.layout.isValidLayout=!1:t.layout.C())}function Cr(t,e,i){if(null!==e){for(var n=e.gl.iterator;n.next();)Cr(t,n.value,i);null!==e.layout&&(i?e.layout.isValidLayout=!1:e.layout.C())}}function Pr(t,e){if(t.xh&&!t.lt){var i=t.aa;t.aa=!0;var n=t.undoManager.transactionLevel,o=t.layout,r=t.animationManager;try{0===n&&(t.undoManager.isInternalTransaction=!0,t.Ea("Layout")),1>=n&&!r.defaultAnimation.isAnimating&&!r.zb&&(e||qn(r,"Layout")),t.xh=!1;for(var s=t.ai.iterator;s.next();)Tr(t,s.value,e,n);o.isValidLayout||(!e||o.isRealtime||null===o.isRealtime||0===n?(o.doLayout(t),Qo(t),o.isValidLayout=!0):t.xh=!0)}finally{e=t.undoManager.isInternalTransaction,0===n&&(t.eb("Layout"),t.undoManager.isInternalTransaction=!1),!e||0!==n&&1!==n||Wn(r),t.aa=i}}}function Tr(t,e,i,n){if(null!==e){for(var o=e.gl.iterator;o.next();)Tr(t,o.value,i,n);null===(o=e.layout)||o.isValidLayout||(!i||o.isRealtime||0===n?(e.rh=!e.location.w(),o.doLayout(e),e.C(32),tr(t,e),o.isValidLayout=!0):t.xh=!0)}}function Nr(t,e){var i=t.hw.I(e);return null!==i?i:t.hw.I(e.toLowerCase())}function Lr(t,e){var i=t.iw.I(e);return null!==i||null!==(i=t.iw.I(e.toLowerCase()))?i:void w("Unknown DiagramEvent name: "+e)}function Ar(t){if(t.animationManager.isTicking)return!1;var e=t.currentTool;return e!==t.toolManager.findTool("Dragging")||(!t.Mr||e.isComplexRoutingRealtime)}function Br(t,e,i,n){var o=t.Xh;if(null===o&&(t.Xh=o=new fd(t.avoidanceCellSize)),o.vs||o.group!==i||o.Yx!==n){if(o.Hx=Math.max(o.Os+1,Math.floor(t.avoidanceLimit/t.avoidanceCellSize.width)),o.Ix=Math.max(o.Os+1,Math.floor(t.avoidanceLimit/t.avoidanceCellSize.height)),null!==i&&(i=Dr(t,i)),null===i){e=jt.alloc(),t.computeOccupiedArea(e),e.Bc(100,100),o.initialize(e);for(var r=t.nodes;r.next();){var s=r.value,a=s.layer;null!==a&&a.visible&&!a.isTemporary&&Fr(t,s,n,e)}jt.free(e)}else{for(0<i.memberParts.count&&((e=t.computePartsBounds(i.memberParts,!1)).Bc(20,20),o.initialize(e)),e=jt.alloc(),r=i.memberParts;r.next();)(s=r.value)instanceof _u&&Fr(t,s,n,e);jt.free(e)}o.group=i,o.Yx=n,o.vs=!1}else e&&md(o);return o}function Dr(t,e){return e.avoidable&&!e.isLinkLabel?e:null!==e.containingGroup?Dr(t,e.containingGroup):null}function Fr(t,e,i,n){if(e!==i&&e.isVisible())if(e.avoidable&&!e.isLinkLabel){e=e.getAvoidableRect(n),t=t.Xh;var o=e.x,r=e.y;if(pd(t,o,r))for(i=(r-t.Od)/t.sc|0,n=Math.min((o+e.width-t.Nd)/t.rc|0,t.di),e=Math.min((r+e.height-t.Od)/t.sc|0,t.ei),o=(o-t.Nd)/t.rc|0;o<=n;o++)if((r=t.ac[o]).fill)r.fill(kd,i,e+1);else for(var s=i;s<=e;s++)r[s]=kd}else if(e instanceof gc)for(e=e.memberParts;e.next();)(o=e.value)instanceof _u&&Fr(t,o,i,n)}function jr(t,e){null===t.Xh||t.Xh.vs||void 0!==e&&(!e.avoidable||e.isLinkLabel)||(t.Xh.vs=!0)}function Er(t){-1===t.vk&&(t.vk=x((function(){if(-1!==t.vk&&(t.ug(),null!==t.lastInput.event)){var e=t.computeAutoScrollPosition(t.wp);e.Xa(t.position)||(t.position=e,t.lastInput.documentPoint=t.Ps(t.wp),t.doMouseMove(),t.Zi=!0,e=jt.alloc(),t.computeBounds(e),e.ed(t.documentBounds),Sr(t,e),jt.free(e),t.Fc=!0,t.bd(),Er(t))}}),t.vp))}function Or(t,e,i){function n(){var t=+new Date;for(r=!0,s.reset();s.next();)if(!s.value[0].al){r=!1;break}r||t-l>h?e(i,o,a):m.requestAnimationFrame(n)}for(var o=i.callback,r=!0,s=t.Og.iterator;s.next();)if(!s.value[0].al){r=!1;break}if("function"!=typeof o||r)return e(i,o,t);var a=t,h=i.callbackTimeout||300,l=+new Date;return m.requestAnimationFrame((function(){n()})),null}function Ir(t,e,i,n){if(t.animationManager.Cc(),t.bd(),null===t.ta)return null;"object"!=typeof e&&w("properties argument must be an Object.");var o=e.size||null,r=e.scale||null;void 0!==e.scale&&isNaN(e.scale)&&(r="NaN");var s=e.maxSize;void 0===e.maxSize&&(s="SVG"===i?new At(1/0,1/0):new At(2e3,2e3));var a=e.position||null,h=e.parts||null,l=void 0===e.padding?1:e.padding,u=e.background||null,c=e.omitTemporary;void 0===c&&(c=!0);var d=e.document||document,f=e.elementFinished||null,p=e.showTemporary;void 0===p&&(p=!c),void 0===(e=e.showGrid)&&(e=p),null!==o&&isNaN(o.width)&&isNaN(o.height)&&(o=null),"number"==typeof l?l=new Kt(l):l instanceof Kt||w("MakeImage padding must be a Margin or a number."),l.left=Math.max(l.left,0),l.right=Math.max(l.right,0),l.top=Math.max(l.top,0),l.bottom=Math.max(l.bottom,0),t.ib.Vc(!0);var g=(c=new Da(null,d,void 0,!0)).context;if(!(o||r||h||a))return c.width=t.Aa+Math.ceil(l.left+l.right),c.height=t.ya+Math.ceil(l.top+l.bottom),"SVG"===i?null===n?null:(n.resize(c.width,c.height,c.width,c.height),n.ownerDocument=d,n.hs=f,er(t,n.context,l,new At(c.width,c.height),t.Ca,t.pa,h,u,p,e),n.context):(t.Xm=!1,er(t,g,l,new At(c.width,c.height),t.Ca,t.pa,h,u,p,e),t.Xm=!0,c.context);var m=t.Pp,y=t.documentBounds.copy();if(y.Fv(t.yb),p)for(var v=t.Wa.s,x=v.length,b=0;b<x;b++){var k=v[b];if(k.visible&&k.isTemporary)for(var S=(k=k.Pa.s).length,M=0;M<S;M++){var C=k[M];C.isInDocumentBounds&&C.isVisible()&&((C=C.actualBounds).w()&&y.ed(C))}}if(v=new pt(y.x,y.y),null!==h){for(x=new jt(0,0,0,0),b=!0,(k=h.iterator).reset();k.next();)(S=k.value)instanceof ku&&(null!==(M=S.layer)&&!M.visible||null!==M&&!p&&M.isTemporary||!S.isVisible()||(S=S.actualBounds).w()&&(b?(b=!1,x.assign(S)):x.ed(S)));y.width=x.width,y.height=x.height,v.x=x.x,v.y=x.y}return null!==a&&a.w()&&(v=a,r||(r=m)),x=a=0,null!==l&&(a=l.left+l.right,x=l.top+l.bottom),b=k=0,null!==o&&(k=o.width,b=o.height,isFinite(k)&&(k=Math.max(0,k-a)),isFinite(b)&&(b=Math.max(0,b-x))),null!==o&&null!==r?("NaN"===r&&(r=m),o.w()?(o=k,y=b):isNaN(b)?(o=k,y=y.height*r):(o=y.width*r,y=b)):null!==o?o.w()?(r=Math.min(k/y.width,b/y.height),o=k,y=b):isNaN(b)?(r=k/y.width,o=k,y=y.height*r):(r=b/y.height,o=y.width*r,y=b):null!==r?"NaN"===r&&s.w()?(r=Math.min((s.width-a)/y.width,(s.height-x)/y.height))>m?(r=m,o=y.width,y=y.height):(o=s.width,y=s.height):(o=y.width*r,y=y.height*r):(r=m,o=y.width,y=y.height),null!==l?(o+=a,y+=x):l=new Kt(0),null!==s&&(m=s.width,s=s.height,isNaN(m)&&(m=2e3),isNaN(s)&&(s=2e3),isFinite(m)&&(o=Math.min(o,m)),isFinite(s)&&(y=Math.min(y,s))),c.width=Math.ceil(o),c.height=Math.ceil(y),"SVG"===i?null===n?null:(n.resize(c.width,c.height,c.width,c.height),n.ownerDocument=d,n.hs=f,er(t,n.context,l,new At(Math.ceil(o),Math.ceil(y)),r,v,h,u,p,e),n.context):(t.Xm=!1,er(t,g,l,new At(Math.ceil(o),Math.ceil(y)),r,v,h,u,p,e),t.Xm=!0,c.context)}vo.className="AnimationTrigger",vo.Default=wo,vo.Immediate=ko,vo.Bundled=So,(e=Mo.prototype).clear=function(){for(var t=this.Pa,e=0;e<t.length;e++){var i=t.s[e];i.Ig=null,Ys(i)}t.clear(),this.Zq.length=0},e.Xe=function(t){this.H=t},e.toString=function(t){void 0===t&&(t=0);var e='Layer "'+this.name+'"';if(0>=t)return e;for(var i=0,n=0,o=0,r=0,s=0,a=this.Pa.iterator;a.next();){var h=a.value;h instanceof gc?o++:h instanceof _u?n++:h instanceof wc?r++:h instanceof Wu?s++:i++}if(a="",0<i&&(a+=i+" Parts "),0<n&&(a+=n+" Nodes "),0<o&&(a+=o+" Groups "),0<r&&(a+=r+" Links "),0<s&&(a+=s+" Adornments "),1<t)for(t=this.Pa.iterator;t.next();)a+="\n "+(i=t.value).toString(),null!==(n=i.data)&&et(n)&&(a+=" #"+et(n)),i instanceof _u?a+=" "+F(n):i instanceof wc&&(a+=" "+F(i.fromNode)+" "+F(i.toNode));return e+" "+this.Pa.count+": "+a},e.ic=function(t,e,i){if(void 0===e&&(e=null),void 0===i&&(i=null),!1===this.Uh)return null;var n=!1;null!==this.diagram&&this.diagram.viewportBounds.ca(t)&&(n=!0);for(var o=pt.alloc(),r=this.Pa.s,s=r.length;s--;){var a=r[s];if((!0!==n||!1!==Ru(a))&&a.isVisible()&&(o.assign(t),vt(o,a.oe),null!==(a=a.ic(o,e,i))&&(null!==e&&(a=e(a)),null!==a&&(null===i||i(a)))))return pt.free(o),a}return pt.free(o),null},e.ji=function(t,e,i,n){if(void 0===e&&(e=null),void 0===i&&(i=null),n instanceof $||n instanceof Z||(n=new Z),!1===this.Uh)return n;var o=!1;null!==this.diagram&&this.diagram.viewportBounds.ca(t)&&(o=!0);for(var r=pt.alloc(),s=this.Pa.s,a=s.length;a--;){var h=s[a];if((!0!==o||!1!==Ru(h))&&h.isVisible()){r.assign(t),vt(r,h.oe);var l=h;h.ji(r,e,i,n)&&(null!==e&&(l=e(l)),null===l||null!==i&&!i(l)||n.add(l))}}return pt.free(r),n},e.Cf=function(t,e,i,n,o){if(void 0===e&&(e=null),void 0===i&&(i=null),void 0===n&&(n=!1),o instanceof $||o instanceof Z||(o=new Z),!1===this.Uh)return o;var r=!1;null!==this.diagram&&this.diagram.viewportBounds.Re(t)&&(r=!0);for(var s=this.Pa.s,a=s.length;a--;){var h=s[a];if((!0!==r||!1!==Ru(h))&&h.isVisible()){var l=h;h.Cf(t,e,i,n,o)&&(null!==e&&(l=e(l)),null===l||null!==i&&!i(l)||o.add(l))}}return o},e.Nu=function(t,e,i,n,o,r,s){if(!1===this.Uh)return o;for(var a=this.Pa.s,h=a.length;h--;){var l=a[h];if((!0!==s||!1!==Ru(l))&&r(l)&&l.isVisible()){var u=l;l.Cf(t,e,i,n,o)&&(null!==e&&(u=e(u)),null===u||null!==i&&!i(u)||o.add(u))}}return o},e.og=function(t,e,i,n,o,r){if(void 0===i&&(i=null),void 0===n&&(n=null),void 0===o&&(o=!0),!1!==o&&!0!==o&&((o instanceof $||o instanceof Z)&&(r=o),o=!0),r instanceof $||r instanceof Z||(r=new Z),!1===this.Uh)return r;var s=!1;null!==this.diagram&&this.diagram.viewportBounds.ca(t)&&(s=!0);for(var a=pt.alloc(),h=pt.alloc(),l=this.Pa.s,u=l.length;u--;){var c=l[u];if((!0!==s||!1!==Ru(c))&&c.isVisible()){a.assign(t),vt(a,c.oe),h.h(t.x+e,t.y),vt(h,c.oe);var d=c;c.og(a,h,i,n,o,r)&&(null!==i&&(d=i(d)),null===d||null!==n&&!n(d)||r.add(d))}}return pt.free(a),pt.free(h),r},e.Fd=function(t,e){if(this.visible){var i=this.Pa.s,n=i.length;if(0!==n){t=A();for(var o=A(),r=0;r<n;r++){var s=i[r];if(s.vw=r,s instanceof wc){if(!1===s.fd)continue}else if(s instanceof Wu&&null!==s.adornedPart)continue;var a=s.actualBounds;s.isVisible()&&Gt(a,e)?(s.Fd(!0),t.push(s)):(s.Fd(!1),null!==s.adornments&&0<s.adornments.count&&o.push(s))}for(e=0;e<t.length;e++)for(Mu(i=t[e]),i=i.adornments;i.next();)(n=i.value).measure(1/0,1/0),n.arrange(),n.Fd(!0);for(e=0;e<o.length;e++)Mu(o[e]);B(t),B(o)}}},e.gc=function(t,e,i){if(this.visible&&0!==this.pb&&(void 0===i&&(i=!0),i||!this.isTemporary)){var n=(i=this.Pa.s).length;if(0!==n){if(t.isTemporary)for(var o=0;o<n;o++)i[o].Gj();o=Co(this,t);var r=this.Zq;r.length=0;for(var s=e.scale,a=jt.alloc(),h=0;h<n;h++)this.Oj(t,i[h],e,r,s,a,!0);if(jt.free(a),t.isTemporary)for(e=0;e<n;e++)i[e].Gj();t.globalAlpha=o}}},e.Oj=function(t,e,i,n,o,r,s){if(s&&!Ru(e))t.Hs(e);else{if(null!==n&&e instanceof wc&&(e.isOrthogonal&&n.push(e),!1===e.fd))return void t.Hs(e);for(s=!1,n=e.containingGroup;null!==n;)s?null!==n.tb&&r.Ex(n.tb):null!==n.tb&&(s=!0,r.assign(n.tb)),n=n.containingGroup;var a=e.actualBounds;if(n=!1,s&&e.isVisible()){if(!r.Yc(a))return void t.Hs(e);n=!r.Re(a)}n&&(t.save(),t instanceof va?t.bk=r.copy():(t.beginPath(),t.rect(r.x,r.y,r.width,r.height),t.clip())),a.width*o>i.Oq||a.height*o>i.Oq?e.gc(t,i):(o=e.actualBounds,r=e.naturalBounds,0===o.width||0===o.height||isNaN(o.x)||isNaN(o.y)||!e.isVisible()||(i=e.transform,null!==e.areaBackground&&(Xs(e,t,e.areaBackground,!0,!0,r,o),t.fillRect(o.x,o.y,o.width,o.height)),null===e.areaBackground&&null===e.background&&(Xs(e,t,"rgba(0,0,0,0.3)",!0,!1,r,o),t.fillRect(o.x,o.y,o.width,o.height)),null!==e.background&&(t.transform(i.m11,i.m12,i.m21,i.m22,i.dx,i.dy),Xs(e,t,e.background,!0,!1,r,o),t.fillRect(0,0,r.width/2,r.height/2),i.ws()||(e=1/(i.m11*i.m22-i.m12*i.m21),t.transform(i.m22*e,-i.m12*e,-i.m21*e,i.m11*e,e*(i.m21*i.dy-i.m22*i.dx),e*(i.m12*i.dx-i.m11*i.dy)))))),n&&(t.restore(),t.Vc(!0))}},e.g=function(t,e,i,n,o){var r=this.diagram;null!==r&&r.cb(di,t,this,e,i,n,o)},e.oi=function(t,e,i){var n=this.Pa;if(e.Ig=this,null===this&&Ys(e),t>=n.count)t=n.count;else if(n.M(t)===e)return-1;return n.Gb(t,e),e.Vo(i),null!==(n=this.diagram)&&(i?n.N():n.oi(e)),To(this,t,e),t},e.pc=function(t,e,i){if(!i&&e.layer!==this&&null!==e.layer)return e.layer.pc(t,e,i);var n=this.Pa;if(0>t||t>=n.length){if(0>(t=n.indexOf(e)))return-1}else if(n.M(t)!==e&&0>(t=n.indexOf(e)))return-1;return e.Wo(i),n.mb(t),null!==(n=this.diagram)&&(i?n.N():n.pc(e)),e.Ig=null,Ys(e),t},d.Object.defineProperties(Mo.prototype,{parts:{get:function(){return this.Pa.iterator}},partsBackwards:{get:function(){return this.Pa.iteratorBackwards}},diagram:{get:function(){return this.H}},name:{get:function(){return this.xa},set:function(t){var e=this.xa;if(e!==t){var i=this.diagram;if(null!==i)for(""===e&&w("Cannot rename default Layer to: "+t),i=i.layers;i.next();)i.value.name===t&&w("Layer.name is already present in this diagram: "+t);for(this.xa=t,this.g("name",e,t),t=this.Pa.iterator;t.next();)t.value.layerName=this.xa}}},opacity:{get:function(){return this.pb},set:function(t){var e=this.pb;e!==t&&((0>t||1<t)&&S(t,"0 <= value <= 1",Mo,"opacity"),this.pb=t,this.g("opacity",e,t),null!==(t=this.diagram)&&t.N())}},isTemporary:{get:function(){return this.o},set:function(t){var e=this.o;e!==t&&((this.o=t)&&(this.isInDocumentBounds=!1),this.g("isTemporary",e,t))}},visible:{get:function(){return this.u},set:function(t){var e=this.u;if(e!==t){for(this.u=t,this.g("visible",e,t),e=this.Pa.iterator;e.next();)e.value.Zb(t);null!==(t=this.diagram)&&t.N()}}},pickable:{get:function(){return this.Uh},set:function(t){var e=this.Uh;e!==t&&(this.Uh=t,this.g("pickable",e,t))}},isInDocumentBounds:{get:function(){return this.j},set:function(t){this.j!==t&&(this.j=t,null!==this.diagram&&this.diagram.Ya())}},allowCopy:{get:function(){return this.Fi},set:function(t){var e=this.Fi;e!==t&&(this.Fi=t,this.g("allowCopy",e,t))}},allowDelete:{get:function(){return this.Gi},set:function(t){var e=this.Gi;e!==t&&(this.Gi=t,this.g("allowDelete",e,t))}},allowTextEdit:{get:function(){return this.Pi},set:function(t){var e=this.Pi;e!==t&&(this.Pi=t,this.g("allowTextEdit",e,t))}},allowGroup:{get:function(){return this.Hi},set:function(t){var e=this.Hi;e!==t&&(this.Hi=t,this.g("allowGroup",e,t))}},allowUngroup:{get:function(){return this.Qi},set:function(t){var e=this.Qi;e!==t&&(this.Qi=t,this.g("allowUngroup",e,t))}},allowLink:{get:function(){return this.Ii},set:function(t){var e=this.Ii;e!==t&&(this.Ii=t,this.g("allowLink",e,t))}},allowRelink:{get:function(){return this.Ki},set:function(t){var e=this.Ki;e!==t&&(this.Ki=t,this.g("allowRelink",e,t))}},allowMove:{get:function(){return this.Ji},set:function(t){var e=this.Ji;e!==t&&(this.Ji=t,this.g("allowMove",e,t))}},allowReshape:{get:function(){return this.Li},set:function(t){var e=this.Li;e!==t&&(this.Li=t,this.g("allowReshape",e,t))}},allowResize:{get:function(){return this.Mi},set:function(t){var e=this.Mi;e!==t&&(this.Mi=t,this.g("allowResize",e,t))}},allowRotate:{get:function(){return this.Ni},set:function(t){var e=this.Ni;e!==t&&(this.Ni=t,this.g("allowRotate",e,t))}},allowSelect:{get:function(){return this.Oi},set:function(t){var e=this.Oi;e!==t&&(this.Oi=t,this.g("allowSelect",e,t))}}}),Mo.prototype.findObjectsNear=Mo.prototype.og,Mo.prototype.findObjectsIn=Mo.prototype.Cf,Mo.prototype.findObjectsAt=Mo.prototype.ji,Mo.prototype.findObjectAt=Mo.prototype.ic,Mo.className="Layer",No.prototype.clear=function(){this.animationManager.Cc(),this.model.clear(),Gr=null,Hr="",Ao(this,!1),this.Xn.clear(),ru(),this.Og.clear(),this.Xh=null,this.Ya(),this.Va(),this.N()},No.prototype.reset=function(){this.clear(),this.vb=!0,Lo(this),kr(this),this.Wg=!0,Oo(this),this.layout=new Bd,this.Wg=!1,this.model=Ef(),this.model.undoManager=new mi,this.vb=this.rn=!1,this.N()},No.prototype.setRTL=function(t){null===(t=void 0===t?this.div:t)&&(t=m.document.body);var e=b("div");e.dir="rtl",e.style.cssText="font-size: 14px; width: 1px; height: 1px; position: absolute; top: -1000px; overflow: scroll;",e.textContent="A",t.appendChild(e);var i="reverse";0<e.scrollLeft?i="default":(e.scrollLeft=1,0===e.scrollLeft&&(i="negative")),t.removeChild(e),this.bu=i},No.prototype.setScrollWidth=function(t){null===(t=void 0===t?this.div:t)&&(t=m.document.body);var e=0;if(Vr){var i=Rr;e=xo,null===i&&((i=Rr=b("p")).style.width="100%",i.style.height="200px",i.style.boxSizing="content-box",(e=xo=b("div")).style.position="absolute",e.style.visibility="hidden",e.style.width="200px",e.style.height="150px",e.style.boxSizing="content-box",e.appendChild(i)),e.style.overflow="hidden",t.appendChild(e);var n=i.offsetWidth;e.style.overflow="scroll",n===(i=i.offsetWidth)&&(i=e.clientWidth),t.removeChild(e),0!==(e=n-i)||z||(e=11)}this.Db=e,this.Gw=!0},No.prototype.qb=function(t){t.classType===No&&(this.autoScale=t)},No.prototype.toString=function(t){void 0===t&&(t=0);var e="";if(this.div&&this.div.id&&(e=this.div.id),e='Diagram "'+e+'"',0>=t)return e;for(var i=this.Wa.iterator;i.next();)e+="\n "+i.value.toString(t-1);return e},No.prototype.addEventListener=function(t,e,i,n){t.addEventListener(e,i,{capture:n,passive:!1})},No.prototype.removeEventListener=function(t,e,i,n){t.removeEventListener(e,i,{capture:n})},No.prototype.computePixelRatio=function(){return null!==this.Yh?this.Yh:m.devicePixelRatio||1},No.prototype.doMouseMove=function(){this.currentTool.doMouseMove()},No.prototype.doMouseDown=function(){this.currentTool.doMouseDown()},No.prototype.doMouseUp=function(){this.currentTool.doMouseUp()},No.prototype.doMouseWheel=function(){this.currentTool.doMouseWheel()},No.prototype.doKeyDown=function(){this.currentTool.doKeyDown()},No.prototype.doKeyUp=function(){this.currentTool.doKeyUp()},No.prototype.doFocus=function(){this.focus()},No.prototype.focus=function(){if(this.ta)if(this.scrollsPageOnFocus)this.ta.focus();else{var t=m.scrollX||m.pageXOffset,e=m.scrollY||m.pageYOffset;this.ta.focus(),m.scrollTo(t,e)}},No.prototype.Oy=function(){this.H.R("GainedFocus")},No.prototype.Ny=function(){this.H.R("LostFocus")},No.prototype.kx=function(t){if(null!==this.ta){var e=this.ku,i=this.hu;this.qr=!0;var n=this.documentBounds,o=this.viewportBounds,r=this.rj,s=n.x-r.left,a=n.y-r.top,h=n.width+r.left+r.right,l=n.height+r.top+r.bottom,u=n.right+r.right;r=n.bottom+r.bottom;var c=o.x;n=o.y;var d=o.width,f=o.height,p=o.right,g=o.bottom;o=this.scale;var m=t.scrollLeft;if(this.tn)switch(this.bu){case"negative":m=m+t.scrollWidth-t.clientWidth;break;case"reverse":m=t.scrollWidth-m-t.clientWidth}var y=m;d<h||f<l?(m=pt.allocAt(this.position.x,this.position.y),this.allowHorizontalScroll&&this.ju!==y&&(m.x=y/o+s,this.ju=y),this.allowVerticalScroll&&this.lu!==t.scrollTop&&(m.y=t.scrollTop/o+a,this.lu=t.scrollTop),this.position=m,pt.free(m),this.Ee=this.qr=!1):(m=pt.alloc(),t.uy&&this.allowHorizontalScroll&&(s<c&&(this.position=m.h(y+s,this.position.y)),u>p&&(this.position=m.h(-(e.scrollWidth-this.Aa)+y-this.Aa/o+u,this.position.y))),t.vy&&this.allowVerticalScroll&&(a<n&&(this.position=m.h(this.position.x,t.scrollTop+a)),r>g&&(this.position=m.h(this.position.x,-(e.scrollHeight-this.ya)+t.scrollTop-this.ya/o+r))),pt.free(m),this.vd=!0,this.Ee=this.qr=!1,n=this.documentBounds,o=this.viewportBounds,u=n.right,p=o.right,r=n.bottom,g=o.bottom,s=n.x,c=o.x,a=n.y,n=o.y,d>=h&&s>=c&&u<=p&&(i.style.width="1px"),f>=l&&a>=n&&r<=g&&(i.style.height="1px"))}},No.prototype.computeBounds=function(t){return void 0===t&&(t=new jt),Qo(this),Vo(this,t)},No.prototype.computePartsBounds=function(t,e){void 0===e&&(e=!1);var i=null;if(P(t))for(var n=0;n<t.length;n++){var o=t[n];!e&&o instanceof wc||(o.Va(),null===i?i=o.actualBounds.copy():i.ed(o.actualBounds))}else for(t=t.iterator;t.next();)n=t.value,!e&&n instanceof wc||(n.Va(),null===i?i=n.actualBounds.copy():i.ed(n.actualBounds));return null===i?new jt(NaN,NaN,0,0):i},No.prototype.zoomToFit=function(){var t=this.sj;this.sj=Zr,this.scale=Ho(this,Xr),t!==Zr&&(Go(this,!1),Yo(this,this.documentBounds,this.Aa/this.Ca,this.ya/this.Ca,this.zk,!1)),this.sj=t},(e=No.prototype).BA=function(t,e){void 0===e&&(e=Xr);var i=t.width,n=t.height;if(!(0===i||0===n||isNaN(i)&&isNaN(n))){var o=1;if(e===Xr||e===Ur)if(isNaN(i))o=this.viewportBounds.height*this.scale/n;else if(isNaN(n))o=this.viewportBounds.width*this.scale/i;else{o=this.Aa;var r=this.ya;o=e===Ur?r/n>o/i?(r-(this.Be?this.Db:0))/n:(o-(this.gf?this.Db:0))/i:Math.min(r/n,o/i)}this.scale=o,this.position=new pt(t.x,t.y)}},e.Jy=function(t,e){this.Va();var i=this.documentBounds,n=this.viewportBounds;this.position=new pt(i.x+(t.x*i.width+t.offsetX)-(e.x*n.width-e.offsetX),i.y+(t.y*i.height+t.offsetY)-(e.y*n.height-e.offsetY))},e.zz=function(t){if(t instanceof Fs){this.eq=t;var e=pt.alloc();this.fq=this.op(t.ga(te,e)),pt.free(e)}else this.eq=null,this.fq=st},e.Ol=function(t,e){if(void 0===e&&(e=!0),e){if((t=Xo(this,t,(function(t){return t.part}),(function(t){return t.canSelect()})))instanceof ku)return t}else if((t=Xo(this,t,(function(t){return t.part})))instanceof ku)return t;return null},e.ic=function(t,e,i){void 0===e&&(e=null),void 0===i&&(i=null),Qo(this);for(var n=this.Wa.iteratorBackwards;n.next();){var o=n.value;if(o.visible&&null!==(o=o.ic(t,e,i)))return o}return null},e.lz=function(t,e,i){return void 0===e&&(e=!0),function(t,e,i,n,o){for(void 0===i&&(i=null),void 0===n&&(n=null),o instanceof $||o instanceof Z||(o=new Z),Qo(t),t=t.Wa.iteratorBackwards;t.next();){var r=t.value;r.visible&&!r.isTemporary&&r.ji(e,i,n,o)}return o}(this,t,(function(t){return t.part}),e?function(t){return t instanceof ku&&t.canSelect()}:null,i)},e.ji=function(t,e,i,n){void 0===e&&(e=null),void 0===i&&(i=null),n instanceof $||n instanceof Z||(n=new Z),Qo(this);for(var o=this.Wa.iteratorBackwards;o.next();){var r=o.value;r.visible&&r.ji(t,e,i,n)}return n},e.ux=function(t,e,i,n){return void 0===e&&(e=!1),void 0===i&&(i=!0),function(t,e,i,n,o){var r=null;for(void 0===r&&(r=null),void 0===i&&(i=null),void 0===n&&(n=!1),o instanceof $||o instanceof Z||(o=new Z),Qo(t),t=t.Wa.iteratorBackwards;t.next();){var s=t.value;s.visible&&!s.isTemporary&&s.Cf(e,r,i,n,o)}return o}(this,t,(function(t){return t instanceof ku&&(!i||t.canSelect())}),e,n)},e.Cf=function(t,e,i,n,o){void 0===e&&(e=null),void 0===i&&(i=null),void 0===n&&(n=!1),o instanceof $||o instanceof Z||(o=new Z),Qo(this);for(var r=this.Wa.iteratorBackwards;r.next();){var s=r.value;s.visible&&s.Cf(t,e,i,n,o)}return o},e.Nu=function(t,e,i,n,o,r){var s=new Z;Qo(this);for(var a=this.Wa.iteratorBackwards;a.next();){var h=a.value;h.visible&&h.Nu(t,e,i,n,s,o,r)}return s},e.mz=function(t,e,i,n,o){return void 0===i&&(i=!0),void 0===n&&(n=!0),function(t,e,i,n,o,r){var s=null;void 0===s&&(s=null),void 0===n&&(n=null),void 0===o&&(o=!0),!1!==o&&!0!==o&&((o instanceof $||o instanceof Z)&&(r=o),o=!0);for(r instanceof $||r instanceof Z||(r=new Z),Qo(t),t=t.Wa.iteratorBackwards;t.next();){var a=t.value;a.visible&&!a.isTemporary&&a.og(e,i,s,n,o,r)}return r}(this,t,e,(function(t){return t instanceof ku&&(!n||t.canSelect())}),i,o)},e.og=function(t,e,i,n,o,r){void 0===i&&(i=null),void 0===n&&(n=null),void 0===o&&(o=!0),!1!==o&&!0!==o&&((o instanceof $||o instanceof Z)&&(r=o),o=!0),r instanceof $||r instanceof Z||(r=new Z),Qo(this);for(var s=this.Wa.iteratorBackwards;s.next();){var a=s.value;a.visible&&a.og(t,e,i,n,o,r)}return r},No.prototype.acceptEvent=function(t){return Uo(this,t,t instanceof MouseEvent)},No.prototype.Qz=function(t){var e=this.H;if(!this.H.isEnabled)return!1;var i=Uo(e,t,!1);switch(i.key=String.fromCharCode(t.which),i.down=!0,t.which){case 8:i.key="Backspace";break;case 33:i.key="PageUp";break;case 34:i.key="PageDown";break;case 35:i.key="End";break;case 36:i.key="Home";break;case 37:i.key="Left";break;case 38:i.key="Up";break;case 39:i.key="Right";break;case 40:i.key="Down";break;case 45:i.key="Insert";break;case 46:i.key="Del";break;case 48:i.key="0";break;case 187:case 61:case 107:i.key="Add";break;case 189:case 173:case 109:i.key="Subtract";break;case 27:i.key="Esc"}return e.doKeyDown(),Ko(i,t)},No.prototype.Rz=function(t){var e=this.H;if(!e.isEnabled)return!1;var i=Uo(e,t,!1);switch(i.key=String.fromCharCode(t.which),i.up=!0,t.which){case 8:i.key="Backspace";break;case 33:i.key="PageUp";break;case 34:i.key="PageDown";break;case 35:i.key="End";break;case 36:i.key="Home";break;case 37:i.key="Left";break;case 38:i.key="Up";break;case 39:i.key="Right";break;case 40:i.key="Down";break;case 45:i.key="Insert";break;case 46:i.key="Del"}return e.doKeyUp(),Ko(i,t)},No.prototype.bz=function(t){var e=this.H;if(!e.isEnabled)return!1;var i=Uo(e,t,!0);return null!==e.mouseEnter&&e.mouseEnter(i),e.currentTool.standardMouseOver(),Ko(i,t)},No.prototype.cz=function(t){var e=this.H;if(!e.isEnabled)return!1;var i=Uo(e,t,!0);return null!==e.mouseLeave&&e.mouseLeave(i),Ko(i,t)},No.prototype.getMouse=function(t){var e=this.ta;if(null===e)return new pt(0,0);var i=e.getBoundingClientRect();return e=t.clientX-this.Aa/i.width*i.left,t=t.clientY-this.ya/i.height*i.top,null!==this.Ab?vt(new pt(e,t),this.Ab):new pt(e,t)},No.prototype.Ya=function(){this.Zi||(this.Zi=!0,this.$b(!1))},No.prototype.redraw=function(){this.vb||this.ld||(this.N(),this.bd())},(e=No.prototype).Pz=function(){return this.kg},e.Xy=function(t){void 0===t&&(t=null);var e=this.animationManager,i=e.isEnabled;e.Cc(),e.isEnabled=!1,Zo(this),this.hf=!1,this.du=new pt(NaN,NaN),e.isEnabled=i,this.ld=!0;var n=this;null!==t&&x((function(){n.ld=!1,qn(e,"Model"),t(n)}),1)},e.$b=function(t){if(void 0===t&&(t=!1),!0!==this.kg&&!(this.vb||!1===t&&this.ld)){this.kg=!0;var e=this;m.requestAnimationFrame((function(){e.kg&&e.bd()}))}},e.bd=function(){this.fn&&!this.kg||(this.fn&&(this.fn=!1),Zo(this))},e.Nv=function(t,e){for(t.reset();t.next();){var i=t.value;!i.Zc()||i instanceof gc||(i.si()?(i.measure(1/0,1/0),i.arrange()):e.add(i))}for(t.reset();t.next();)(i=t.value)instanceof gc&&i.isVisible()&&tr(this,i);for(t.reset();t.next();)(i=t.value)instanceof wc&&i.isVisible()&&(i.si()?(i.measure(1/0,1/0),i.arrange()):e.add(i));for(t.reset();t.next();)(i=t.value)instanceof Wu&&i.isVisible()&&(i.si()?(i.measure(1/0,1/0),i.arrange()):e.add(i))},e.Fd=function(t,e,i,n){if(this.vd||this.animationManager.isAnimating)for(var o=0;o<e;o++)t[o].Fd(i,n)},e.gc=function(t){if(null!==this.Ka)if(null===this.ta&&w("No canvas specified"),"svg"===this.nl){if(null!==this.Ka){var e=this.animationManager;if(!e.zb&&(!e.isAnimating||e.isTicking)){or(this);var i=this.Aa,n=this.ya;if(t.Gv.resize(i,n,i,n),n=(i=this.Wa.s).length,this.Fd(i,n,this,this.viewportBounds),this.Fc||e.isAnimating){e=this.pa;var o=this.Ca,r=Math.round(e.x*o)/o,s=Math.round(e.y*o)/o,a=this.Ab;for(a.reset(),1!==o&&a.scale(o),0===e.x&&0===e.y||a.translate(-r,-s),t.ti=null,xa(t,a.m11,a.m12,a.m21,a.m22,a.dx,a.dy),1!==this.pb&&(t.globalAlpha=this.pb),ir(this,t),e=this.Mb,this.ta.context.setTransform(e,0,0,e,0,0),this.ta.context.clearRect(0,0,this.Aa,this.ya),e=0;e<n;e++)i[e].gc(t,this);t=!1,this.Yf?ls(this.Yf,this)&&(t=this.Vp()):t=!0,t&&(Ge.prototype.Cd=Ge.prototype.Eu),this.Fc=this.vd=!1}}}}else t:if(r=this.animationManager,!r.zb&&(!r.isAnimating||r.isTicking)&&(i=new Date,or(this),"0"!==this.Ka.style.opacity)){if(n=t!==this.ib,o=(e=this.Wa.s).length,this.Fd(e,o,this,this.viewportBounds),n)t.Vc(!0),this.vd=!0;else if(!this.Fc&&!r.isAnimating)break t;(r=this.Ab).reset(),s=this.Mb,a=this.pa;var h=this.Ca,l=Math.round(a.x*h)/h,u=Math.round(a.y*h)/h;for(1!==h&&r.scale(h),0===a.x&&0===a.y||r.translate(-l,-u),t.setTransform(s,0,0,s,0,0),t.clearRect(0,0,this.Aa,this.ya),1!==this.pb&&(t.globalAlpha=this.pb),ir(this,t),a=0;a<o;a++)t.setTransform(s,0,0,s,0,0),t.transform(r.m11,r.m12,r.m21,r.m22,r.dx,r.dy),t.yc(),e[a].gc(t,this);if(e=!1,this.Yf?ls(this.Yf,this)&&(e=this.Vp()):e=!0,e&&(Ge.prototype.Cd=Ge.prototype.Eu),n?(this.ib.Vc(!0),this.vd=!0):this.Fc=this.vd=!1,e=+new Date-+i,n=X&&X.nx,i=this.zw,n||null===this.Yh){for(i[this.Tq]=e,this.Tq=(this.Tq+1)%i.length,o=e=0;o<i.length;o++)e+=i[o];this.Sq=e/i.length}if(1!==this.pb&&(t.globalAlpha=1),n)for(t.setTransform(1,0,0,1,0,0),n=0;n<i.length;n++)t.fillText(i[n].toString(),20,150+20*n)}},e.Gf=function(t){return this.Rg[t]},e.Xx=function(t,e){"minDrawingLength"===t&&(this.Oq=e),this.Rg[t]=e,this.redraw()},e.Tx=function(){this.Rg=new Y,this.Rg.drawShadows=!0,this.Rg.textGreeking=!0,this.Rg.viewportOptimizations=!z&&!I,this.Rg.temporaryPixelRatio=!0,this.Rg.pictureRatioOptimization=!0,this.Oq=this.Rg.minDrawingLength=1},e.Ql=function(t){return this.on[t]},e.sA=function(t,e){this.on[t]=e},e.Sx=function(){this.on=new Y,this.on.extraTouchArea=10,this.on.extraTouchThreshold=10,this.on.hasGestureZoom=!0},e.set=function(t){return Object.assign(this,t),this},e.Du=function(t){return this.nm(t)},e.nm=function(t){return nr(this,t),this},e.bx=function(){if(0!==this.Eh.count&&!(1<this.undoManager.transactionLevel)){for(;0<this.Eh.count;){var t=this.Eh;for(this.Eh=new ft,t=t.iterator;t.next();){var e=t.key;e.Xo(t.value),e.qc()}}this.N()}},e.N=function(t){if(void 0===t)this.Fc=!0,this.$b();else{var e=this.viewportBounds;t.w()&&e.Yc(t)&&(this.Fc=!0,this.$b())}this.R("InvalidateDraw")},No.prototype.invalidateViewport=function(t,e){if(!0!==this.Fc)if(this.Fc=!0,"svg"===this.nl)this.bd();else{var i=!0===this.Gf("temporaryPixelRatio");if(!0===this.Gf("viewportOptimizations")&&this.scrollMode!==Qr&&this.rj.hi(0,0,0,0)&&e.width===t.width&&e.height===t.height){var n=this.scale,o=Math.max(t.y,e.y),r=Math.min(t.y+t.height,e.y+e.height);if(0<Math.max(0,Math.min(t.x+t.width,e.x+e.width)-Math.max(t.x,e.x))*n&&0<Math.max(0,r-o)*n){if(!(this.ld||(this.kg=!1,null===this.Ka||(this.ld=!0,this.documentBounds.w()||(n=jt.alloc(),Sr(this,this.computeBounds(n)),jt.free(n)),n=this.ta,null===n||n instanceof ya)))){var s=this.Mb;o=this.Aa*s;var a=this.ya*s,h=this.scale*s;r=Math.round(Math.round(e.x*h)-Math.round(t.x*h)),e=Math.round(Math.round(e.y*h)-Math.round(t.y*h)),h=this.jw,t=this.oy,h.width!==o&&(h.width=o),h.height!==a&&(h.height=a),t.clearRect(0,0,o,a),h=190*s;var l=70*s,u=Math.max(r,0),c=Math.max(e,0),d=Math.floor(o-u),f=Math.floor(a-c);t.drawImage(n.Oa,u,c,d,f,0,0,d,f),ls(this.Yf,this)&&t.clearRect(0,0,h,l),n=A(),t=A(),f=Math.abs(r),d=Math.abs(e);var p=0===u?0:o-f;u=pt.allocAt(p,0),f=pt.allocAt(f+p,a),t.push(new jt(Math.min(u.x,f.x),Math.min(u.y,f.y),Math.abs(u.x-f.x),Math.abs(u.y-f.y)));var g=this.Ab;if(g.reset(),g.scale(s,s),1!==this.Ca&&g.scale(this.Ca),(0!==(s=this.pa).x||0!==s.y)&&isFinite(s.x)&&isFinite(s.y)&&g.translate(-s.x,-s.y),vt(u,g),vt(f,g),n.push(new jt(Math.min(u.x,f.x),Math.min(u.y,f.y),Math.abs(u.x-f.x),Math.abs(u.y-f.y))),p=0===c?0:a-d,u.h(0,p),f.h(o,d+p),t.push(new jt(Math.min(u.x,f.x),Math.min(u.y,f.y),Math.abs(u.x-f.x),Math.abs(u.y-f.y))),vt(u,g),vt(f,g),n.push(new jt(Math.min(u.x,f.x),Math.min(u.y,f.y),Math.abs(u.x-f.x),Math.abs(u.y-f.y))),ls(this.Yf,this)&&(o=0<r?0:-r,a=0<e?0:-e,u.h(o,a),f.h(h+o,l+a),t.push(new jt(Math.min(u.x,f.x),Math.min(u.y,f.y),Math.abs(u.x-f.x),Math.abs(u.y-f.y))),vt(u,g),vt(f,g),n.push(new jt(Math.min(u.x,f.x),Math.min(u.y,f.y),Math.abs(u.x-f.x),Math.abs(u.y-f.y)))),pt.free(u),pt.free(f),Jo(this,!1,!0),null===this.Ka&&w("No div specified"),null===this.ta&&w("No canvas specified"),!this.animationManager.zb&&(o=this.ib,this.Fc)){for(or(this),a=this.Mb,o.setTransform(1,0,0,1,0,0),o.clearRect(0,0,this.Aa*a,this.ya*a),o.drawImage(this.jw.Oa,0<r?0:Math.round(-r),0<e?0:Math.round(-e)),r=this.pa,s=this.Ca,h=Math.round(r.x*s)/s,l=Math.round(r.y*s)/s,(e=this.Ab).reset(),1!==s&&e.scale(s),0===r.x&&0===r.y||e.translate(-h,-l),o.save(),o.beginPath(),r=t.length,s=0;s<r;s++)0!==(h=t[s]).width&&0!==h.height&&o.rect(Math.floor(h.x),Math.floor(h.y),Math.ceil(h.width),Math.ceil(h.height));for(o.clip(),o.setTransform(a,0,0,a,0,0),o.transform(e.m11,e.m12,e.m21,e.m22,e.dx,e.dy),o.yc(),r=(e=this.Wa.s).length,this.Fd(e,r,this,this.viewportBounds),ir(this,o),o.globalAlpha=this.pb,a=0;a<r;a++)if(h=n,(s=e[a]).visible&&0!==s.pb){l=Co(s,o),(c=s.Zq).length=0,u=this.scale,d=jt.alloc(),g=(f=s.Pa.s).length,p=h.length;for(var m=0;m<g;m++){var y=f[m],v=Lu(y,y.actualBounds);t:{for(var x=2/u,b=4/u,k=0;k<p;k++){var S=h[k];if(0!==S.width&&0!==S.height&&v.Vu(S.x-x,S.y-x,S.width+b,S.height+b)){v=!0;break t}}v=!1}v&&s.Oj(o,y,this,c,u,d,!0)}jt.free(d),o.globalAlpha=l}o.restore(),o.Vc(!0),this.Yf&&ls(this.Yf,this)&&this.Vp(),this.Fc=this.vd=!1,this.hk()}B(n),B(t),this.ld=!1}}else this.bd();i&&(Fo(this),this.bd(),jo(this,!0))}else i?(Fo(this),this.bd(),jo(this,!0)):this.bd()}},(e=No.prototype).add=function(t){var e=t.diagram;if(e!==this&&(null!==e&&w("Cannot add part "+t.toString()+" to "+this.toString()+". It is already a part of "+e.toString()),null===(e=this.Qj(t.layerName))&&(e=this.Qj("")),null===e&&w('Cannot add a Part when unable find a Layer named "'+t.layerName+'" and there is no default Layer'),t.layer!==e)){var i=e.oi(99999999,t,t.diagram===this);0<=i&&this.cb(fi,"parts",e,null,t,null,i),e.isTemporary||this.Ya(),t.C(1),null!==(i=t.layerChanged)&&i(t,null,e)}},e.oi=function(t){this.partManager.oi(t);var e=this;jh(t,(function(t){xr(e,t)})),(t instanceof Wu||t instanceof gc&&null!==t.placeholder)&&t.v(),null!==t.data&&jh(t,(function(t){of(e.partManager,t)})),!0!==na(t)&&!0!==Ou(t)||this.De.add(t),ju(t,!0,this),Xu(t)?(t.actualBounds.w()&&this.N(Lu(t,t.actualBounds)),this.Ya()):t.isVisible()&&t.actualBounds.w()&&this.N(Lu(t,t.actualBounds)),this.$b()},e.pc=function(t){t.Ej(),this.partManager.pc(t);var e=this;null!==t.data&&jh(t,(function(t){rf(e.partManager,t,e)})),this.De.remove(t),Xu(t)?(t.actualBounds.w()&&this.N(Lu(t,t.actualBounds)),this.Ya()):t.isVisible()&&t.actualBounds.w()&&this.N(Lu(t,t.actualBounds)),this.$b()},e.remove=function(t){ar(this,t,!0)},e.Is=function(t,e){if(void 0===e&&(e=!1),P(t))for(var i=t.length,n=0;n<i;n++){var o=t[n];e&&!o.canDelete()||this.remove(o)}else for((i=new Z).addAll(t),t=i.iterator;t.next();)i=t.value,e&&!i.canDelete()||this.remove(i)},e.Kj=function(t,e,i){return void 0===i&&(i=!1),this.partManager.Kj(t,e,i)},No.prototype.moveParts=function(t,e,i,n){if(void 0===i&&(i=!1),void 0===n&&(n=ur(this)),null!==this.toolManager){var o=new ft;if(null!==t)if(P(t))for(var r=0;r<t.length;r++)hr(this,o,t[r],i,n);else for(t=t.iterator;t.next();)hr(this,o,t.value,i,n);else{for(t=this.parts;t.next();)hr(this,o,t.value,i,n);for(t=this.nodes;t.next();)hr(this,o,t.value,i,n);for(t=this.links;t.next();)hr(this,o,t.value,i,n)}lr(this,o,e,n,i)}},No.prototype.computeMove=function(t,e,i,n){if(void 0===n&&(n=new pt),n.assign(e),null===t)return n;var o=e,r=i.isGridSnapEnabled;r&&(i.isGridSnapRealtime||this.lastInput.up)&&cr(this,t,e,o=pt.alloc(),i),i=null!==t.dragComputation?t.dragComputation(t,e,o):o;var s=t.minLocation,a=s.x;isNaN(a)&&(a=r?Math.round(1e3*t.location.x)/1e3:t.location.x),s=s.y,isNaN(s)&&(s=r?Math.round(1e3*t.location.y)/1e3:t.location.y);var h=t.maxLocation,l=h.x;return isNaN(l)&&(l=r?Math.round(1e3*t.location.x)/1e3:t.location.x),h=h.y,isNaN(h)&&(h=r?Math.round(1e3*t.location.y)/1e3:t.location.y),n.h(Math.max(a,Math.min(i.x,l)),Math.max(s,Math.min(i.y,h))),o!==e&&pt.free(o),n},(e=No.prototype).Pd=function(t,e,i){if(void 0===i)return new us(it);var n=t.isGridSnapEnabled;return t.groupsSnapMembers||null===e.containingGroup||(n=!1),new us(n?new pt(Math.round(1e3*i.x)/1e3,Math.round(1e3*i.y)/1e3):i.copy())},e.Al=function(t){gr(this,t,null),t.Xe(this);var e=this.Wa,i=e.count-1;if(!t.isTemporary)for(;0<=i&&e.M(i).isTemporary;)i--;return e.Gb(i+1,t),null!==this.cc&&this.cb(fi,"layers",this,null,t,null,i+1),this.N(),this.Ya(),this},e.Ww=function(t,e){gr(this,t,e),t.Xe(this);var i=this.Wa,n=i.indexOf(t);0<=n&&(i.remove(t),null!==this.cc&&this.cb(pi,"layers",this,t,null,n,null));var o,r=i.count;for(o=0;o<r;o++)if(i.M(o)===e){i.Gb(o,t);break}return null!==this.cc&&this.cb(fi,"layers",this,null,t,null,o),this.N(),0>n&&this.Ya(),this},e.Cy=function(t,e){gr(this,t,e),t.Xe(this);var i=this.Wa,n=i.indexOf(t);0<=n&&(i.remove(t),null!==this.cc&&this.cb(pi,"layers",this,t,null,n,null));var o,r=i.count;for(o=0;o<r;o++)if(i.M(o)===e){i.Gb(o+1,t);break}return null!==this.cc&&this.cb(fi,"layers",this,null,t,null,o+1),this.N(),0>n&&this.Ya(),this},e.kA=function(t){if(t.diagram!==this&&w("Cannot remove a Layer from another Diagram: "+t+" of "+t.diagram),""!==t.name){var e=this.Wa,i=e.indexOf(t);if(e.remove(t)){for(e=t.Pa.copy().iterator;e.next();){var n=e.value,o=n.layerName;o!==t.name?n.layerName=o:n.layerName=""}null!==this.cc&&this.cb(pi,"layers",this,t,null,i,null),this.N(),this.Ya()}}},e.Qj=function(t){for(var e=this.layers;e.next();){var i=e.value;if(i.name===t)return i}return null},e.Yw=function(t){return null===this.pf&&(this.pf=new $),this.pf.add(t),this.model.Pe(t),this},e.mA=function(t){null!==this.pf&&(this.pf.remove(t),0===this.pf.count&&(this.pf=null)),this.model.ik(t)},e.Pe=function(t){return null===this.zg&&(this.zg=new $),this.zg.add(t),this},e.ik=function(t){null!==this.zg&&(this.zg.remove(t),0===this.zg.count&&(this.zg=null))},e.ds=function(t){if(this.skipsUndoManager||this.model.skipsUndoManager||this.model.undoManager.Tu(t),t.change!==ci&&(this.isModified=!0),null!==this.zg)for(var e=this.zg,i=e.length,n=0;n<i;n++)e.M(n)(t)},e.cb=function(t,e,i,n,o,r,s){void 0===r&&(r=null),void 0===s&&(s=null);var a=new ui;a.diagram=this,a.change=t,a.propertyName=e,a.object=i,a.oldValue=n,a.oldParam=r,a.newValue=o,a.newParam=s,this.ds(a)},e.g=function(t,e,i,n,o){this.cb(di,t,this,e,i,n,o)},No.prototype.changeState=function(t,e){if(null!==t&&t.diagram===this){var i=this.skipsModelSourceBindings;try{this.skipsModelSourceBindings=!0;var n=t.change;if(n===di){var o=t.object;if(Rf(o,t.propertyName,t.I(e)),o instanceof Fs){var r=o.part;null!==r&&r.Wb()}this.isModified=!0}else if(n===fi){var s=t.object,a=t.newParam,h=t.newValue;if(s instanceof Th)if("number"==typeof a&&h instanceof Fs){e?s.pc(a):s.Gb(a,h);var l=s.part;null!==l&&l.Wb()}else"number"==typeof a&&h instanceof hl&&(h.isRow?Uh(s,a,e?void 0:h):qh(s,a,e?void 0:h));else if(s instanceof Mo){var u=!0===t.oldParam;"number"==typeof a&&h instanceof ku&&(e?(h.isSelected=!1,h.isHighlighted=!1,h.Wb(),s.pc(u?a:-1,h,u)):s.oi(a,h,u))}else s instanceof No?"number"==typeof a&&h instanceof Mo&&(e?this.Wa.mb(a):(h.Xe(this),this.Wa.Gb(a,h))):w("unknown ChangedEvent.Insert object: "+t.toString());this.isModified=!0}else if(n===pi){var c=t.object,d=t.oldParam,f=t.oldValue;if(c instanceof Th)"number"==typeof d&&f instanceof Fs?e?c.Gb(d,f):c.pc(d):"number"==typeof d&&f instanceof hl&&(f.isRow?Uh(c,d,e?f:void 0):qh(c,d,e?f:void 0));else if(c instanceof Mo){var p=!0===t.newParam;"number"==typeof d&&f instanceof ku&&(e?0>c.Pa.indexOf(f)&&c.oi(d,f,p):(f.isSelected=!1,f.isHighlighted=!1,f.Wb(),c.pc(p?d:-1,f,p)))}else c instanceof No?"number"==typeof d&&f instanceof Mo&&(e?(f.Xe(this),this.Wa.Gb(d,f)):this.Wa.mb(d)):w("unknown ChangedEvent.Remove object: "+t.toString());this.isModified=!0}else n!==ci&&w("unknown ChangedEvent: "+t.toString())}finally{this.skipsModelSourceBindings=i}}},No.prototype.Ea=function(t){return this.undoManager.Ea(t)},No.prototype.eb=function(t){return this.undoManager.eb(t)},No.prototype.Kf=function(){return this.undoManager.Kf()},No.prototype.commit=function(t,e){void 0===e&&(e="");var i=this.skipsUndoManager;null===e&&(this.skipsUndoManager=!0,e=""),this.undoManager.Ea(e);var n=!1;try{t(this),n=!0}finally{n?this.undoManager.eb(e):this.undoManager.Kf(),this.skipsUndoManager=i}},No.prototype.updateAllTargetBindings=function(t){this.partManager.updateAllTargetBindings(t)},No.prototype.rp=function(){this.partManager.rp()},No.prototype.onViewportBoundsChanged=function(t,e,i,n){if(!t.D(e)){void 0===n&&(n=!1),n||(this.Ee=!0),this.vd=!0;var o=this.layout;null===o||!o.isViewportSized||this.autoScale!==Yr||t.width===e.width&&t.height===e.height||o.C(),o=this.currentTool,!0===this.Vk&&o instanceof xi&&(this.lastInput.documentPoint=this.Ps(this.lastInput.viewPoint),bi(o,this)),this.vb||this.invalidateViewport(t,e),yr(this),this.fc.scale=i,this.fc.position.x=t.x,this.fc.position.y=t.y,this.fc.bounds.assign(t),this.fc.canvasSize.width=Math.round(t.width*i),this.fc.canvasSize.height=Math.round(t.height*i),this.fc.newCanvasSize.width=this.Aa,this.fc.newCanvasSize.height=this.ya,this.fc.isScroll=n,this.R("ViewportBoundsChanged",this.fc,t),this.isVirtualized&&this.links.each((function(t){t.isAvoiding&&t.actualBounds.Yc(e)&&t.bb()}))}},No.prototype.clearSelection=function(t){void 0===t&&(t=!1);var e=this.selection;if(0!==e.count){t||this.R("ChangingSelection",e);for(var i=e.Fa(),n=i.length,o=0;o<n;o++)i[o].isSelected=!1;e.ka(),e.clear(),e.freeze(),t||this.R("ChangedSelection",e)}},No.prototype.select=function(t){null!==t&&t.diagram===this&&(!t.isSelected||1<this.selection.count)&&(this.R("ChangingSelection",this.selection),this.clearSelection(!0),t.isSelected=!0,this.R("ChangedSelection",this.selection))},No.prototype.rA=function(t){if(this.R("ChangingSelection",this.selection),this.clearSelection(!0),P(t))for(var e=t.length,i=0;i<e;i++){var n=t[i];n instanceof ku||w("Diagram.selectCollection given something that is not a Part: "+n),n.isSelected=!0}else for(t=t.iterator;t.next();)(e=t.value)instanceof ku||w("Diagram.selectCollection given something that is not a Part: "+e),e.isSelected=!0;this.R("ChangedSelection",this.selection)},No.prototype.clearHighlighteds=function(){var t=this.highlighteds;if(0<t.count){for(var e=t.Fa(),i=e.length,n=0;n<i;n++)e[n].isHighlighted=!1;t.ka(),t.clear(),t.freeze()}},(e=No.prototype).Iz=function(t){null!==t&&t.diagram===this&&(!t.isHighlighted||1<this.highlighteds.count)&&(this.clearHighlighteds(),t.isHighlighted=!0)},e.Jz=function(t){t=(new Z).addAll(t);for(var e=this.highlighteds.copy().hp(t).iterator;e.next();)e.value.isHighlighted=!1;for(t=t.iterator;t.next();)(e=t.value)instanceof ku||w("Diagram.highlightCollection given something that is not a Part: "+e),e.isHighlighted=!0},e.scroll=function(t,e,i){void 0===i&&(i=1);var n="up"===e||"down"===e,o=0,r=pt.alloc();if("pixel"===t)o=i;else if("line"===t)o=i*(n?this.scrollVerticalLineChange:this.scrollHorizontalLineChange);else if("page"===t)t=n?this.viewportBounds.height:this.viewportBounds.width,0!==(t*=this.scale)&&(o=i*Math.max(t-(n?this.scrollVerticalLineChange:this.scrollHorizontalLineChange),0));else{if("document"===t)return o=this.documentBounds,i=this.viewportBounds,"up"===e?this.position=r.h(i.x,o.y):"left"===e?this.position=r.h(o.x,i.y):"down"===e?this.position=r.h(i.x,o.bottom-i.height):"right"===e&&(this.position=r.h(o.right-i.width,i.y)),void pt.free(r);w("scrolling unit must be 'pixel', 'line', 'page', or 'document', not: "+t)}o/=this.scale,i=this.position,"up"===e?this.position=r.h(i.x,i.y-o):"down"===e?this.position=r.h(i.x,i.y+o):"left"===e?this.position=r.h(i.x-o,i.y):"right"===e?this.position=r.h(i.x+o,i.y):w("scrolling direction must be 'up', 'down', 'left', or 'right', not: "+e),pt.free(r)},e.tv=function(t){var e=this.viewportBounds;e.Re(t)||((t=t.center).x-=e.width/2,t.y-=e.height/2,this.position=t)},e.es=function(t){var e=this.viewportBounds;(t=t.center).x-=e.width/2,t.y-=e.height/2,this.position=t},e.op=function(t){var e=this.Ab;e.reset(),1!==this.Ca&&e.scale(this.Ca);var i=this.pa;return(0!==i.x||0!==i.y)&&isFinite(i.x)&&isFinite(i.y)&&e.translate(-i.x,-i.y),t.copy().transform(this.Ab)},e.zA=function(t){var e=this.Ab,i=t.x,n=t.y,o=i+t.width,r=n+t.height,s=e.m11,a=e.m12,h=e.m21,l=e.m22,u=e.dx,c=e.dy,d=i*s+n*h+u;e=i*a+n*l+c;var f=o*s+n*h+u;return t=o*a+n*l+c,n=i*s+r*h+u,i=i*a+r*l+c,s=o*s+r*h+u,o=o*a+r*l+c,r=Math.min(d,f),d=Math.max(d,f),f=Math.min(e,t),e=Math.max(e,t),r=Math.min(r,n),d=Math.max(d,n),f=Math.min(f,i),e=Math.max(e,i),r=Math.min(r,s),d=Math.max(d,s),new jt(r,f=Math.min(f,o),d-r,(e=Math.max(e,o))-f)},e.Ps=function(t){var e=this.Ab;e.reset(),1!==this.Ca&&e.scale(this.Ca);var i=this.pa;return(0!==i.x||0!==i.y)&&isFinite(i.x)&&isFinite(i.y)&&e.translate(-i.x,-i.y),vt(t.copy(),this.Ab)},No.prototype.doModelChanged=function(t){var e=this;if(t.model===this.model){var i=t.change,n=t.propertyName;if(i===ci&&"S"===n[0])if("StartingFirstTransaction"===n){var o=this;(t=this.toolManager).mouseDownTools.each((function(t){return t.diagram=o})),t.mouseMoveTools.each((function(t){return t.diagram=o})),t.mouseUpTools.each((function(t){return t.diagram=o})),this.ld||this.hf||(this.Jk=!0,this.fn&&(this.kg=!0))}else"StartingUndo"===n||"StartingRedo"===n?((t=this.animationManager).defaultAnimation.isAnimating&&!this.skipsUndoManager&&t.Cc(),this.R("ChangingSelection",this.selection)):"StartedTransaction"===n&&((t=this.animationManager).defaultAnimation.isAnimating&&!this.skipsUndoManager&&t.Cc());else if(this.aa){this.aa=!1;try{if(""===t.modelChange&&i===ci){"FinishedUndo"!==n&&"FinishedRedo"!==n||(this.R("ChangedSelection",this.selection),Qo(this));var r=this.animationManager;"RolledBackTransaction"===n&&r.Cc(),this.bx(),this.Jk=!0,this.bd(),0!==this.undoManager.transactionLevel&&1!==this.undoManager.transactionLevel||Wn(r),"CommittedTransaction"===n&&this.undoManager.isJustDiscarded&&(this.Ce=Math.min(this.Ce,this.undoManager.historyIndex-1)),"CommittedTransaction"!==n&&"RolledBackTransaction"!==n||!this.undoManager.isPendingUnmodified||setTimeout((function(){e.isModified=!1}),1);var s=t.isTransactionFinished;if(s&&(vr(this),this.As.clear(),function(t){for(t=t.Ei.iterator;t.next();)t.value.Xk=!1}(this.animationManager)),!this.Rt&&s&&this.lastInput.targetDiagram){this.Rt=!0;var a=this;x((function(){a.currentTool.standardMouseOver(),a.Rt=!1}),10)}}}finally{this.aa=!0}}}},No.prototype.Wd=function(){this.partManager.Wd()},No.prototype.Aj=function(t,e){this.Yd.Aj(t,e)},No.prototype.Cj=function(t,e){this.Yd.Cj(t,e)},No.prototype.findPartForKey=function(t){return this.partManager.findPartForKey(t)},No.prototype.Vb=function(t){return this.partManager.Vb(t)},No.prototype.findLinkForKey=function(t){return this.partManager.findLinkForKey(t)},(e=No.prototype).Lc=function(t){return this.partManager.Lc(t)},e.ii=function(t){return this.partManager.ii(t)},e.Kc=function(t){return this.partManager.Kc(t)},e.ms=function(t){for(var e=[],i=0;i<arguments.length;++i)e[i]=arguments[i];return this.partManager.ms.apply(this.partManager,e instanceof Array?e:r(o(e)))},e.ls=function(t){for(var e=[],i=0;i<arguments.length;++i)e[i]=arguments[i];return this.partManager.ls.apply(this.partManager,e instanceof Array?e:r(o(e)))},e.Va=function(){if(this.Zi){var t=jt.alloc();Sr(this,this.computeBounds(t)),jt.free(t)}},e.rz=function(){for(var t=new Z,e=this.nodes;e.next();){var i=e.value;i.isTopLevel&&t.add(i)}for(e=this.links;e.next();)(i=e.value).isTopLevel&&t.add(i);return t.iterator},e.qz=function(){return this.ai.iterator},e.Uz=function(t){Qo(this),t&&Mr(this,!0),this.ld?Pr(this,!1):(this.Jk=!0,Zo(this))},e.yz=function(){for(var t=new $,e=this.nodes;e.next();){var i=e.value;i.isTopLevel&&null===i.kh()&&t.add(i)}return t.iterator},e.Bj=function(t,e){return null!==(t=Lr(this,t))&&t.add(e),this},e.am=function(t,e){null!==(t=Lr(this,t))&&t.remove(e)},e.R=function(t,e,i){var n=Lr(this,t),o=new li;if(o.diagram=this,null!==(t=Nr(this,t))&&(o.name=t),void 0!==e&&(o.subject=e),void 0!==i&&(o.parameter=i),1===(e=n.length))n.M(0)(o);else if(0!==e)for(n=n.Fa(),i=0;i<e;i++)(0,n[i])(o)},e.Yj=function(t,e){return Br(this,!1,null,e||null).Yj(t.x,t.y,t.width,t.height)},No.prototype.computeOccupiedArea=function(t){return this.isVirtualized?this.viewportBounds.copy():this.Zi?Vo(this,t):t.assign(this.documentBounds)},No.prototype.gs=function(t){this.wp.assign(t),this.computeAutoScrollPosition(this.wp).Xa(this.position)?this.ug():Er(this)},No.prototype.ug=function(){-1!==this.vk&&(m.clearTimeout(this.vk),this.vk=-1)},No.prototype.computeAutoScrollPosition=function(t){var e=this.position,i=this.xp;if(0>=i.top&&0>=i.left&&0>=i.right&&0>=i.bottom)return e;var n=this.viewportBounds,o=this.scale;n=jt.allocAt(0,0,n.width*o,n.height*o);var r=pt.allocAt(0,0);if(t.x>=n.x&&t.x<n.x+i.left&&this.allowHorizontalScroll){var s=Math.max(this.scrollHorizontalLineChange,1);s|=0,r.x-=s,t.x<n.x+i.left/2&&(r.x-=s),t.x<n.x+i.left/4&&(r.x-=4*s)}else t.x<=n.x+n.width&&t.x>n.x+n.width-i.right&&this.allowHorizontalScroll&&(s=Math.max(this.scrollHorizontalLineChange,1),s|=0,r.x+=s,t.x>n.x+n.width-i.right/2&&(r.x+=s),t.x>n.x+n.width-i.right/4&&(r.x+=4*s));return t.y>=n.y&&t.y<n.y+i.top&&this.allowVerticalScroll?(s=Math.max(this.scrollVerticalLineChange,1),s|=0,r.y-=s,t.y<n.y+i.top/2&&(r.y-=s),t.y<n.y+i.top/4&&(r.y-=4*s)):t.y<=n.y+n.height&&t.y>n.y+n.height-i.bottom&&this.allowVerticalScroll&&(s=Math.max(this.scrollVerticalLineChange,1),s|=0,r.y+=s,t.y>n.y+n.height-i.bottom/2&&(r.y+=s),t.y>n.y+n.height-i.bottom/4&&(r.y+=4*s)),r.Xa(it)||(e=new pt(e.x+r.x/o,e.y+r.y/o)),jt.free(n),pt.free(r),e},(e=No.prototype).Cs=function(){return null},e.av=function(){return null},e.bs=function(t,e){this.pj.add(t,e)},e.Fu=function(t){(this.Pw=t)||this.nodes.each((function(t){t instanceof gc&&(t.$p=null)}))},e.Wz=function(t){return Vr?(void 0===t&&(t={}),t.returnType="Image",this.Jx(t)):null},e.Jx=function(t){return void 0===t&&(t={}),Or(this,this.Xz,t)},e.Xz=function(t,e,i){var n=Ir(i,t,"canvas",null);if(null===n)return null;var o=null;if(null!==(i=n.Z.canvas))switch(o=t.returnType,o=void 0===o?"string":o.toLowerCase(),o){case rs+"data":o=n.getImageData(0,0,i.width,i.height);break;case rs:(n=(t.document||document).createElement("img")).src=i.toDataURL(t.type,t.details),o=n;break;case"blob":return"function"!=typeof e&&w('Error: Diagram.makeImageData called with "returnType: toBlob", but no required "callback" function property defined.'),"function"==typeof i.toBlob?(i.toBlob(e,t.type,t.details),"toBlob"):(e(null),null);default:o=i.toDataURL(t.type,t.details)}return"function"==typeof e?(e(o),null):o},d.Object.defineProperties(No.prototype,{renderer:{get:function(){return this.nl},set:function(t){this instanceof Ps||(""===t&&(t="default"),(t=t.toLowerCase())!==this.nl&&(this.nl=t,"default"===t||"canvas"===t?(null!==(t=this.pj.get("svg"))&&t.Oa.remove(),this.ta&&(this.ib=this.ta.context)):"svg"===t?(this.pj.contains("svg")?t=this.pj.get("svg"):(t=new ya(this,m.document),this.bs("svg",t)),null!==this.div&&this.div.appendChild(t.Oa),this.ib=t.context,this.ta&&(this.ta.context.setTransform(this.Mb,0,0,this.Mb,0,0),this.ta.context.clearRect(0,0,this.Aa,this.ya))):"debug"!==t||this.pj.contains("SVG")||(t=new ya(this,m.document),this.bs("SVG",t),t.Oa.style.backgroundColor="whitesmoke",null!==this.div&&this.div.after(t.Oa)),this.hk()))}},div:{get:function(){return this.Ka},set:function(t){if(this.Ka!==t){var e=this.Ka;null!==e?(e.H=void 0,e.goDiagram=void 0,e.go=void 0,e.innerHTML="",null!==this.ta&&(e=this.ta.Oa,this.removeEventListener(e,"pointermove",this.dk,!1),this.removeEventListener(e,"pointerdown",this.ui,!1),this.removeEventListener(e,"pointerup",this.fk,!1),this.removeEventListener(e,"pointerout",this.ek,!1),this.removeEventListener(e,"pointercancel",this.ck,!1),this.ta.mx()),this.ol&&(this.ol.disconnect(),this.ol=null),null!==(e=this.toolManager)&&(e.mouseDownTools.each((function(t){t.cancelWaitAfter()})),e.mouseMoveTools.each((function(t){t.cancelWaitAfter()})),e.mouseUpTools.each((function(t){t.cancelWaitAfter()}))),e.cancelWaitAfter(),this.currentTool.doCancel(),this.ta=null,this.removeEventListener(m,"resize",this.Ov,!1),this.removeEventListener(m,"wheel",this.$j,!0),bo===this&&(bo=null)):null===this.ui&&(this.hf=!1),this.Ka=null,null!==t&&((e=t.H)&&(e.div=null),Do(this,t),this.hk())}}},$w:{get:function(){return this.Sq}},pi:{get:function(){return this.hf}},draggedLink:{get:function(){return this.nt},set:function(t){this.nt!==t&&(this.nt=t,null!==t&&(this.Vt=t.fromPort,this.Wt=t.toPort))}},Mx:{get:function(){return this.Vt},set:function(t){this.Vt=t}},Nx:{get:function(){return this.Wt},set:function(t){this.Wt=t}},animationManager:{get:function(){return this.Yd}},undoManager:{get:function(){return this.cc.undoManager}},skipsUndoManager:{get:function(){return this.Wg},set:function(t){this.Wg=t,this.cc.skipsUndoManager=t}},delaysLayout:{get:function(){return this.lt},set:function(t){this.lt=t}},opacity:{get:function(){return this.pb},set:function(t){var e=this.pb;e!==t&&((0>t||1<t)&&S(t,"0 <= value <= 1",No,"opacity"),this.pb=t,this.g("opacity",e,t),this.N())}},validCycle:{get:function(){return this.wu},set:function(t){var e=this.wu;e!==t&&(this.wu=t,this.g("validCycle",e,t))}},layers:{get:function(){return this.Wa.iterator}},isModelReadOnly:{get:function(){var t=this.cc;return null!==t&&t.isReadOnly},set:function(t){var e=this.cc;null!==e&&(e.isReadOnly=t)}},isReadOnly:{get:function(){return this.Gg},set:function(t){var e=this.Gg;e!==t&&(this.Gg=t,this.g("isReadOnly",e,t))}},isEnabled:{get:function(){return this.Jd},set:function(t){var e=this.Jd;e!==t&&(this.Jd=t,this.g("isEnabled",e,t))}},allowClipboard:{get:function(){return this.Us},set:function(t){var e=this.Us;e!==t&&(this.Us=t,this.g("allowClipboard",e,t))}},allowCopy:{get:function(){return this.Fi},set:function(t){var e=this.Fi;e!==t&&(this.Fi=t,this.g("allowCopy",e,t))}},allowDelete:{get:function(){return this.Gi},set:function(t){var e=this.Gi;e!==t&&(this.Gi=t,this.g("allowDelete",e,t))}},allowDragOut:{get:function(){return this.Vs},set:function(t){var e=this.Vs;e!==t&&(this.Vs=t,this.g("allowDragOut",e,t))}},allowDrop:{get:function(){return this.Ws},set:function(t){var e=this.Ws;e!==t&&(this.Ws=t,this.g("allowDrop",e,t))}},allowTextEdit:{get:function(){return this.Pi},set:function(t){var e=this.Pi;e!==t&&(this.Pi=t,this.g("allowTextEdit",e,t))}},allowGroup:{get:function(){return this.Hi},set:function(t){var e=this.Hi;e!==t&&(this.Hi=t,this.g("allowGroup",e,t))}},allowUngroup:{get:function(){return this.Qi},set:function(t){var e=this.Qi;e!==t&&(this.Qi=t,this.g("allowUngroup",e,t))}},allowInsert:{get:function(){return this.Ys},set:function(t){var e=this.Ys;e!==t&&(this.Ys=t,this.g("allowInsert",e,t))}},allowLink:{get:function(){return this.Ii},set:function(t){var e=this.Ii;e!==t&&(this.Ii=t,this.g("allowLink",e,t))}},allowRelink:{get:function(){return this.Ki},set:function(t){var e=this.Ki;e!==t&&(this.Ki=t,this.g("allowRelink",e,t))}},allowMove:{get:function(){return this.Ji},set:function(t){var e=this.Ji;e!==t&&(this.Ji=t,this.g("allowMove",e,t))}},allowReshape:{get:function(){return this.Li},set:function(t){var e=this.Li;e!==t&&(this.Li=t,this.g("allowReshape",e,t))}},allowResize:{get:function(){return this.Mi},set:function(t){var e=this.Mi;e!==t&&(this.Mi=t,this.g("allowResize",e,t))}},allowRotate:{get:function(){return this.Ni},set:function(t){var e=this.Ni;e!==t&&(this.Ni=t,this.g("allowRotate",e,t))}},allowSelect:{get:function(){return this.Oi},set:function(t){var e=this.Oi;e!==t&&(this.Oi=t,this.g("allowSelect",e,t))}},allowUndo:{get:function(){return this.Zs},set:function(t){var e=this.Zs;e!==t&&(this.Zs=t,this.g("allowUndo",e,t))}},allowZoom:{get:function(){return this.at},set:function(t){var e=this.at;e!==t&&(this.at=t,this.g("allowZoom",e,t))}},hasVerticalScrollbar:{get:function(){return this.nn},set:function(t){var e=this.nn;e!==t&&(this.nn=t,this.Ee=!0,this.N(),this.g("hasVerticalScrollbar",e,t),Go(this,!1))}},hasHorizontalScrollbar:{get:function(){return this.mn},set:function(t){var e=this.mn;e!==t&&(this.mn=t,this.Ee=!0,this.N(),this.g("hasHorizontalScrollbar",e,t),Go(this,!1))}},allowHorizontalScroll:{get:function(){return this.Xs},set:function(t){var e=this.Xs;e!==t&&(this.Xs=t,this.g("allowHorizontalScroll",e,t),Go(this,!1))}},allowVerticalScroll:{get:function(){return this.$s},set:function(t){var e=this.$s;e!==t&&(this.$s=t,this.g("allowVerticalScroll",e,t),Go(this,!1))}},scrollHorizontalLineChange:{get:function(){return this.iu},set:function(t){var e=this.iu;e!==t&&(0>t&&S(t,">= 0",No,"scrollHorizontalLineChange"),this.iu=t,this.g("scrollHorizontalLineChange",e,t))}},scrollVerticalLineChange:{get:function(){return this.mu},set:function(t){var e=this.mu;e!==t&&(0>t&&S(t,">= 0",No,"scrollVerticalLineChange"),this.mu=t,this.g("scrollVerticalLineChange",e,t))}},lastInput:{get:function(){return this.cj},set:function(t){this.cj=t}},previousInput:{get:function(){return this.Qg},set:function(t){this.Qg=t}},firstInput:{get:function(){return this.bq},set:function(t){this.bq=t}},currentCursor:{get:function(){return this.it},set:function(t){if(""===t&&(t=this.Op),this.it!==t){var e=this.ta,i=this.Ka;if(null!==e&&null!==i){this.it=t;var n=e.style.cursor;e.style.cursor=t,i.style.cursor=t,e.style.cursor===n&&(e.style.cursor="-webkit-"+t,i.style.cursor="-webkit-"+t,e.style.cursor===n&&(e.style.cursor="-moz-"+t,i.style.cursor="-moz-"+t,e.style.cursor===n&&(e.style.cursor=t,i.style.cursor=t)))}}}},defaultCursor:{get:function(){return this.Op},set:function(t){""===t&&(t="auto");var e=this.Op;e!==t&&(this.Op=t,this.g("defaultCursor",e,t))}},click:{get:function(){return this.zh},set:function(t){var e=this.zh;e!==t&&(this.zh=t,this.g("click",e,t))}},doubleClick:{get:function(){return this.Fh},set:function(t){var e=this.Fh;e!==t&&(this.Fh=t,this.g("doubleClick",e,t))}},contextClick:{get:function(){return this.Bh},set:function(t){var e=this.Bh;e!==t&&(this.Bh=t,this.g("contextClick",e,t))}},mouseOver:{get:function(){return this.Qh},set:function(t){var e=this.Qh;e!==t&&(this.Qh=t,this.g("mouseOver",e,t))}},mouseHover:{get:function(){return this.Oh},set:function(t){var e=this.Oh;e!==t&&(this.Oh=t,this.g("mouseHover",e,t))}},mouseHold:{get:function(){return this.Nh},set:function(t){var e=this.Nh;e!==t&&(this.Nh=t,this.g("mouseHold",e,t))}},mouseDragOver:{get:function(){return this.Qt},set:function(t){var e=this.Qt;e!==t&&(this.Qt=t,this.g("mouseDragOver",e,t))}},mouseDrop:{get:function(){return this.Lh},set:function(t){var e=this.Lh;e!==t&&(this.Lh=t,this.g("mouseDrop",e,t))}},handlesDragDropForTopLevelParts:{get:function(){return this.xt},set:function(t){var e=this.xt;e!==t&&(this.xt=t,this.g("handlesDragDropForTopLevelParts",e,t))}},mouseEnter:{get:function(){return this.Mh},set:function(t){var e=this.Mh;e!==t&&(this.Mh=t,this.g("mouseEnter",e,t))}},mouseLeave:{get:function(){return this.Ph},set:function(t){var e=this.Ph;e!==t&&(this.Ph=t,this.g("mouseLeave",e,t))}},toolTip:{get:function(){return this.$h},set:function(t){var e=this.$h;e!==t&&(this.$h=t,this.g("toolTip",e,t))}},contextMenu:{get:function(){return this.Ch},set:function(t){var e=this.Ch;e!==t&&(this.Ch=t,this.g("contextMenu",e,t))}},commandHandler:{get:function(){return this.nb},set:function(t){this.nb!==t&&(this.nb=t,t.Xe(this))}},toolManager:{get:function(){return this.te},set:function(t){this.te!==t&&(this.te=t,t.diagram=this)}},defaultTool:{get:function(){return this.ob},set:function(t){var e=this.ob;e!==t&&(this.ob=t,t.diagram=this,this.currentTool===e&&(this.currentTool=t))}},currentTool:{get:function(){return this.hb},set:function(t){var e=this.hb;e&&(e.isActive&&e.doDeactivate(),e.cancelWaitAfter(),e.doStop()),null===t&&(t=this.defaultTool),null!==t&&(this.hb=t,t.diagram=this,t.doStart())}},selection:{get:function(){return this.Hw}},maxSelectionCount:{get:function(){return this.Nt},set:function(t){var e=this.Nt;if(e!==t)if(0<=t&&!isNaN(t)){if(this.Nt=t,this.g("maxSelectionCount",e,t),!this.undoManager.isUndoingRedoing&&0<(t=this.selection.count-t)){this.R("ChangingSelection",this.selection),e=this.selection.Fa();for(var i=0;i<t;i++)e[i].isSelected=!1;this.R("ChangedSelection",this.selection)}}else S(t,">= 0",No,"maxSelectionCount")}},nodeSelectionAdornmentTemplate:{get:function(){return this.St},set:function(t){var e=this.St;e!==t&&(this.St=t,this.g("nodeSelectionAdornmentTemplate",e,t))}},groupSelectionAdornmentTemplate:{get:function(){return this.wt},set:function(t){var e=this.wt;e!==t&&(this.wt=t,this.g("groupSelectionAdornmentTemplate",e,t))}},linkSelectionAdornmentTemplate:{get:function(){return this.Kt},set:function(t){var e=this.Kt;e!==t&&(this.Kt=t,this.g("linkSelectionAdornmentTemplate",e,t))}},highlighteds:{get:function(){return this.nw}},isModified:{get:function(){var t=this.undoManager;return t.isEnabled?null!==t.currentTransaction||this.rn&&this.Ce!==t.historyIndex:this.rn},set:function(t){if(this.rn!==t){this.rn=t;var e=this.undoManager;!t&&e.isEnabled&&(this.Ce=e.historyIndex),t||vr(this)}}},model:{get:function(){return this.cc},set:function(t){var e=this.cc;if(e!==t){this.currentTool.doCancel(),e&&e.undoManager!==t.undoManager&&e.undoManager.isInTransaction&&w("Do not replace a Diagram.model while a transaction is in progress."),this.animationManager.Cc(!0);var i=Ao(this,!0);this.hf=!1,this.fn=!0,this.Ce=-2,this.kg=!1;var n=this.vb;this.vb=!0,qn(this.animationManager,"Model"),e&&(null!==this.pf&&this.pf.each((function(t){return e.ik(t)})),e.ik(this.Oc)),this.cc=t,this.partManager=function(t){return null!==(t=zr.get(t))?new t:new Zd}(this.cc.type);for(var o=0;o<i.length;o++)this.add(i[o]);t.Pe(this.Hb),this.partManager.addAllModeledParts(),t.ik(this.Hb),t.Pe(this.Oc),null!==this.pf&&this.pf.each((function(e){return t.Pe(e)})),this.vb=n,this.Ya(),this.vb||this.N(),e&&t.undoManager.copyProperties(e.undoManager)}}},aa:{get:function(){return this.rw},set:function(t){this.rw=t}},As:{get:function(){return this.sy}},skipsModelSourceBindings:{get:function(){return this.Iw},set:function(t){this.Iw=t}},Ns:{get:function(){return this.ou},set:function(t){this.ou=t}},nodeTemplate:{get:function(){return this.Lg.I("")},set:function(t){var e=this.Lg.I("");e!==t&&(this.Lg.add("",t),this.g("nodeTemplate",e,t),this.undoManager.isUndoingRedoing||this.Wd())}},nodeTemplateMap:{get:function(){return this.Lg},set:function(t){var e=this.Lg;e!==t&&(this.Lg=t,this.g("nodeTemplateMap",e,t),this.undoManager.isUndoingRedoing||this.Wd())}},groupTemplate:{get:function(){return this.Yi.I("")},set:function(t){var e=this.Yi.I("");e!==t&&(this.Yi.add("",t),this.g("groupTemplate",e,t),this.undoManager.isUndoingRedoing||this.Wd())}},groupTemplateMap:{get:function(){return this.Yi},set:function(t){var e=this.Yi;e!==t&&(this.Yi=t,this.g("groupTemplateMap",e,t),this.undoManager.isUndoingRedoing||this.Wd())}},linkTemplate:{get:function(){return this.Kh.I("")},set:function(t){var e=this.Kh.I("");e!==t&&(this.Kh.add("",t),this.g("linkTemplate",e,t),this.undoManager.isUndoingRedoing||this.Wd())}},linkTemplateMap:{get:function(){return this.Kh},set:function(t){var e=this.Kh;e!==t&&(this.Kh=t,this.g("linkTemplateMap",e,t),this.undoManager.isUndoingRedoing||this.Wd())}},isMouseCaptured:{get:function(){return this.qw},set:function(t){var e=this.ta;null!==e&&((e=e.Oa)instanceof SVGElement||(t?(this.lastInput.bubbles=!1,this.removeEventListener(e,"pointermove",this.dk,!1),this.removeEventListener(e,"pointerdown",this.ui,!1),this.removeEventListener(e,"pointerup",this.fk,!1),this.removeEventListener(e,"pointerout",this.ek,!1),this.removeEventListener(e,"pointercancel",this.ck,!1),this.addEventListener(m,"pointermove",this.dk,!0),this.addEventListener(m,"pointerdown",this.ui,!0),this.addEventListener(m,"pointerup",this.fk,!0),this.addEventListener(m,"pointerout",this.ek,!0),this.addEventListener(m,"pointercancel",this.ck,!0),this.removeEventListener(e,"wheel",this.$j,!1),this.addEventListener(m,"wheel",this.$j,!0),this.addEventListener(m,"selectstart",this.preventDefault,!1)):(this.removeEventListener(m,"pointermove",this.dk,!0),this.removeEventListener(m,"pointerdown",this.ui,!0),this.removeEventListener(m,"pointerup",this.fk,!0),this.removeEventListener(m,"pointerout",this.ek,!0),this.removeEventListener(m,"pointercancel",this.ck,!0),this.addEventListener(e,"pointermove",this.dk,!1),this.addEventListener(e,"pointerdown",this.ui,!1),this.addEventListener(e,"pointerup",this.fk,!1),this.addEventListener(e,"pointerout",this.ek,!1),this.addEventListener(e,"pointercancel",this.ck,!1),this.removeEventListener(m,"wheel",this.$j,!0),this.removeEventListener(m,"selectstart",this.preventDefault,!1),this.addEventListener(e,"wheel",this.$j,!1)),this.qw=t))}},position:{get:function(){return this.pa},set:function(t){var e=pt.alloc().assign(this.pa);if(!e.D(t)){var i=this.viewportBounds.copy();this.pa.assign(t),Zn(this.animationManager,e,this.pa),this.vb||null===this.ta&&!this.wo.w()?kr(this):(this.vb=!0,t=this.scale,Yo(this,this.Sp,this.Aa/t,this.ya/t,this.zk,!1),this.vb=!1),this.vb||this.onViewportBoundsChanged(i,this.viewportBounds,this.Ca,!1)}pt.free(e)}},initialPosition:{get:function(){return this.zt},set:function(t){this.zt.D(t)||(this.zt=t.J())}},initialScale:{get:function(){return this.At},set:function(t){this.At!==t&&(this.At=t)}},grid:{get:function(){return null===this.fe&&(this.fe=Io(this)),this.fe},set:function(t){var e=this.fe;if(e!==t){null===e&&(e=this.fe=Io(this)),t.type!==Th.Grid&&w("Diagram.grid must be a Panel of type Panel.Grid");var i=e.panel;null!==i&&i.remove(e),this.fe=t,t.name="GRID",null!==i&&i.add(t),yr(this),this.N(),this.g("grid",e,t)}}},viewportBounds:{get:function(){return this.Rw}},viewSize:{get:function(){return this.wo},set:function(t){var e=this.viewSize;e.D(t)||(this.wo=t=t.J(),this.ya=this.Aa=0,t.w()?(this.Aa=t.width,this.ya=t.height):null!==this.Ka&&(this.Aa=this.Ka.clientWidth||1,this.ya=this.Ka.clientHeight||1),kr(this),this.Ya(),this.g("viewSize",e,t),this.redraw())}},fixedBounds:{get:function(){return this.ut},set:function(t){var e=this.ut;e.D(t)||(-1/0!==t.width&&1/0!==t.height&&-1/0!==t.height||w("fixedBounds width/height must not be Infinity"),this.ut=t=t.J(),this.Ya(),this.g("fixedBounds",e,t))}},scrollMargin:{get:function(){return this.rj},set:function(t){"number"==typeof t&&(t=new Kt(t));var e=this.rj;e.D(t)||(this.rj=t=t.J(),this.g("scrollMargin",e,t),this.hk())}},scrollMode:{get:function(){return this.sj},set:function(t){var e=this.sj;e!==t&&(this.sj=t,t===Zr&&Go(this,!1),this.g("scrollMode",e,t),this.Ee=!0,this.N())}},scrollsPageOnFocus:{get:function(){return this.nu},set:function(t){var e=this.nu;e!==t&&(this.nu=t,this.g("scrollsPageOnFocus",e,t))}},positionComputation:{get:function(){return this.Zt},set:function(t){var e=this.Zt;e!==t&&(this.Zt=t,Go(this,!1),this.g("positionComputation",e,t))}},scaleComputation:{get:function(){return this.fu},set:function(t){var e=this.fu;e!==t&&(this.fu=t,mr(this,this.scale,this.scale),this.g("scaleComputation",e,t))}},documentBounds:{get:function(){return this.Sp}},isVirtualized:{get:function(){return this.It},set:function(t){var e=this.It;e!==t&&(this.It=t,this.g("isVirtualized",e,t))}},scale:{get:function(){return this.Ca},set:function(t){var e=this.Ca;e!==t&&mr(this,e,t)}},defaultScale:{get:function(){return this.Pp},set:function(t){this.Pp=t}},autoScale:{get:function(){return this.yh},set:function(t){var e=this.yh;e!==t&&(this.yh=t,this.g("autoScale",e,t),t!==Yr&&Go(this,!1))}},initialAutoScale:{get:function(){return this.Fg},set:function(t){var e=this.Fg;e!==t&&(this.Fg=t,this.g("initialAutoScale",e,t))}},initialViewportSpot:{get:function(){return this.Bt},set:function(t){var e=this.Bt;e!==t&&(t.sb()||w("initialViewportSpot must be a specific Spot: "+t),this.Bt=t,this.g("initialViewportSpot",e,t))}},initialDocumentSpot:{get:function(){return this.yt},set:function(t){var e=this.yt;e!==t&&(t.sb()||w("initialViewportSpot must be a specific Spot: "+t),this.yt=t,this.g("initialDocumentSpot",e,t))}},minScale:{get:function(){return this.Ot},set:function(t){var e=this.Ot;e!==t&&(0<t?(this.Ot=t,this.g("minScale",e,t),t>this.scale&&(this.scale=t)):S(t,"> 0",No,"minScale"))}},maxScale:{get:function(){return this.Mt},set:function(t){var e=this.Mt;e!==t&&(0<t?(this.Mt=t,this.g("maxScale",e,t),t<this.scale&&(this.scale=t)):S(t,"> 0",No,"maxScale"))}},zoomPoint:{get:function(){return this.zu},set:function(t){this.zu.D(t)||(this.zu=t=t.J())}},contentAlignment:{get:function(){return this.zk},set:function(t){var e=this.zk;e.D(t)||(this.zk=t=t.J(),this.g("contentAlignment",e,t),Go(this,!1))}},initialContentAlignment:{get:function(){return this.pq},set:function(t){var e=this.pq;e.D(t)||(this.pq=t=t.J(),this.g("initialContentAlignment",e,t))}},padding:{get:function(){return this.yb},set:function(t){"number"==typeof t&&(t=new Kt(t));var e=this.yb;e.D(t)||(this.yb=t=t.J(),this.Ya(),this.g("padding",e,t))}},partManager:{get:function(){return this.Pc},set:function(t){var e=this.Pc;e!==t&&(null!==t.diagram&&w("Cannot share PartManagers between Diagrams: "+t.toString()),e&&e.Xe(null),this.Pc=t,t.Xe(this))}},nodes:{get:function(){return this.partManager.nodes.iterator}},links:{get:function(){return this.partManager.links.iterator}},parts:{get:function(){return this.partManager.parts.iterator}},layout:{get:function(){return this.Sc},set:function(t){var e=this.Sc;e!==t&&(this.Sc=t,t.diagram=this,t.group=null,this.xh=!0,this.g("layout",e,t),this.$b())}},isTreePathToChildren:{get:function(){return this.Ht},set:function(t){var e=this.Ht;if(e!==t&&(this.Ht=t,this.g("isTreePathToChildren",e,t),!this.undoManager.isUndoingRedoing))for(t=this.nodes;t.next();)oc(t.value)}},treeCollapsePolicy:{get:function(){return this.uu},set:function(t){var e=this.uu;e!==t&&(t!==ts&&t!==es&&t!==is&&w("Unknown Diagram.treeCollapsePolicy: "+t),this.uu=t,this.g("treeCollapsePolicy",e,t))}},Ue:{get:function(){return this.pw},set:function(t){this.pw=t}},avoidanceCellSize:{get:function(){return this.aw},set:function(t){this.Xh=null,this.aw=new At(Math.max(1,t.width),Math.max(1,t.height))}},avoidanceLimit:{get:function(){return this.bw},set:function(t){this.bw=Math.max(1,t)}},autoScrollInterval:{get:function(){return this.vp},set:function(t){var e=this.vp;e!==t&&(this.vp=t,this.g("autoScrollInterval",e,t))}},autoScrollRegion:{get:function(){return this.xp},set:function(t){"number"==typeof t&&(t=new Kt(t));var e=this.xp;e.D(t)||(this.xp=t=t.J(),this.Ya(),this.g("autoScrollRegion",e,t))}}}),d.Object.defineProperties(No,{licenseKey:{get:function(){return ns.jc()},set:function(t){ns.add(t.replace(/\s/g,""))}},version:{get:function(){return os}}}),No.prototype.makeImageData=No.prototype.Jx,No.prototype.makeImage=No.prototype.Wz,No.prototype.cacheGroupExternalLinks=No.prototype.Fu,No.prototype.addRenderer=No.prototype.bs,No.prototype.makeSVG=No.prototype.av,No.prototype.makeSvg=No.prototype.Cs,No.prototype.stopAutoScroll=No.prototype.ug,No.prototype.doAutoScroll=No.prototype.gs,No.prototype.isUnoccupied=No.prototype.Yj,No.prototype.raiseDiagramEvent=No.prototype.R,No.prototype.removeDiagramListener=No.prototype.am,No.prototype.addDiagramListener=No.prototype.Bj,No.prototype.findTreeRoots=No.prototype.yz,No.prototype.layoutDiagram=No.prototype.Uz,No.prototype.findTopLevelGroups=No.prototype.qz,No.prototype.findTopLevelNodesAndLinks=No.prototype.rz,No.prototype.ensureBounds=No.prototype.Va,No.prototype.findLinksByExample=No.prototype.ls,No.prototype.findNodesByExample=No.prototype.ms,No.prototype.findLinkForData=No.prototype.Kc,No.prototype.findNodeForData=No.prototype.ii,No.prototype.findPartForData=No.prototype.Lc,No.prototype.findLinkForKey=No.prototype.findLinkForKey,No.prototype.findNodeForKey=No.prototype.Vb,No.prototype.findPartForKey=No.prototype.findPartForKey,No.prototype.rebuildParts=No.prototype.Wd,No.prototype.transformViewToDoc=No.prototype.Ps,No.prototype.transformRectDocToView=No.prototype.zA,No.prototype.transformDocToView=No.prototype.op,No.prototype.centerRect=No.prototype.es,No.prototype.scrollToRect=No.prototype.tv,No.prototype.scroll=No.prototype.scroll,No.prototype.highlightCollection=No.prototype.Jz,No.prototype.highlight=No.prototype.Iz,No.prototype.selectCollection=No.prototype.rA,No.prototype.select=No.prototype.select,No.prototype.updateAllRelationshipsFromData=No.prototype.rp,No.prototype.updateAllTargetBindings=No.prototype.updateAllTargetBindings,No.prototype.commit=No.prototype.commit,No.prototype.rollbackTransaction=No.prototype.Kf,No.prototype.commitTransaction=No.prototype.eb,No.prototype.startTransaction=No.prototype.Ea,No.prototype.raiseChanged=No.prototype.g,No.prototype.raiseChangedEvent=No.prototype.cb,No.prototype.removeChangedListener=No.prototype.ik,No.prototype.addChangedListener=No.prototype.Pe,No.prototype.removeModelChangedListener=No.prototype.mA,No.prototype.addModelChangedListener=No.prototype.Yw,No.prototype.findLayer=No.prototype.Qj,No.prototype.removeLayer=No.prototype.kA,No.prototype.addLayerAfter=No.prototype.Cy,No.prototype.addLayerBefore=No.prototype.Ww,No.prototype.addLayer=No.prototype.Al,No.prototype.moveParts=No.prototype.moveParts,No.prototype.copyParts=No.prototype.Kj,No.prototype.removeParts=No.prototype.Is,No.prototype.remove=No.prototype.remove,No.prototype.add=No.prototype.add,No.prototype.clearDelayedGeometries=No.prototype.bx,No.prototype.setProperties=No.prototype.nm,No.prototype.attach=No.prototype.Du,No.prototype.set=No.prototype.set,No.prototype.resetInputOptions=No.prototype.Sx,No.prototype.setInputOption=No.prototype.sA,No.prototype.getInputOption=No.prototype.Ql,No.prototype.resetRenderingHints=No.prototype.Tx,No.prototype.setRenderingHint=No.prototype.Xx,No.prototype.getRenderingHint=No.prototype.Gf,No.prototype.maybeUpdate=No.prototype.bd,No.prototype.requestUpdate=No.prototype.$b,No.prototype.delayInitialization=No.prototype.Xy,No.prototype.isUpdateRequested=No.prototype.Pz,No.prototype.invalidateDocumentBounds=No.prototype.Ya,No.prototype.findObjectsNear=No.prototype.og,No.prototype.findPartsNear=No.prototype.mz,No.prototype.findObjectsIn=No.prototype.Cf,No.prototype.findPartsIn=No.prototype.ux,No.prototype.findObjectsAt=No.prototype.ji,No.prototype.findPartsAt=No.prototype.lz,No.prototype.findObjectAt=No.prototype.ic,No.prototype.findPartAt=No.prototype.Ol,No.prototype.focusObject=No.prototype.zz,No.prototype.alignDocument=No.prototype.Jy,No.prototype.zoomToRect=No.prototype.BA,No.prototype.zoomToFit=No.prototype.zoomToFit,No.prototype.diagramScroll=No.prototype.kx,No.prototype.focus=No.prototype.focus;var zr=new ft,Rr=null,Vr=void 0!==m.document,Gr=null,Hr="",Yr=new V(No,"None",0),Xr=new V(No,"Uniform",1),Ur=new V(No,"UniformToFill",2),qr=new V(No,"CycleAll",10),Wr=new V(No,"CycleNotDirected",11),Kr=new V(No,"CycleNotDirectedFast",12),_r=new V(No,"CycleNotUndirected",13),$r=new V(No,"CycleDestinationTree",14),Jr=new V(No,"CycleSourceTree",15),Zr=new V(No,"DocumentScroll",1),Qr=new V(No,"InfiniteScroll",2),ts=new V(No,"TreeParentCollapsed",21),es=new V(No,"AllParentsCollapsed",22),is=new V(No,"AnyParentsCollapsed",23),ns=new $,os="2.3.10",rs="image",ss=null,as=!1;function hs(){this.wy=null,this.j="zz@orderNum","63ad05bbe23a1786468a4c741b6d2"===this._tk?this.Rc=this.j=!0:this.Rc=null}function ls(t,e){if(e.ib.setTransform(e.Mb,0,0,e.Mb,0,0),e.ib.yc(),null===t.Rc)t:{e="f";var i=m[O("76a715b2f73f148a")][O("72ba13b5")]||"";if(t.Rc=!0,Vr){var n=No[O("76a115b6ed251eaf4692")];if(n)for(var o=ns.iterator;o.next()&&!(6>(n=O(n=o.value).split(O("39e9"))).length);){var r=O(n[1]).split(".");if("7da71ca0"!==n[4])break;var s=O(y[O("6cae19")]).split(".");if(r[0]>s[0]||r[0]===s[0]&&r[1]>=s[1]){var a=m[O("74a900bae4370f8b51")][O("6fbb13a1c2311e8a57")].toLowerCase();if(s=a[O("73a612b6fb191d")](O("3aad1ab6e022098b4dc4")),r=O(n[2]),-1<s&&(a=a[O("73a612b6fb191d")](r.toLowerCase()+"/"),t.Rc=!(-1<a&&a<s),!t.Rc))break;for(s=i[O("76ad18b4f73e")],a=i[O("73a612b6fb191d")](O("35e7"))+2;a<s;a++)e+=i[a];if(0>(s=e[O("73a612b6fb191d")](r))&&r!==O("7da71ca0ad381e90")&&(s=e[O("73a612b6fb191d")](O("76a715b2ef3e149757"))),0>s&&(s=e[O("73a612b6fb191d")](O("76a715b2ef3e149757"))),0>s&&(s=e[O("73a612b6fb191d")](O("2bfa41fdb3784bca12"))),0>s&&(s=i[O("73a612b6fb191d")](O("7baa19a6f76c1988428554"))),t.Rc=!(0<=s&&s<e[O("73a612b6fb191d")](O("35"))||-1===e[O("73a612b6fb191d")](O("35"))),!t.Rc)break;if(i[O("73a612b6fb191d")](O("7fb002b6ed25128b4da25b2e"))&&(t.Rc=!(-1<i[O("73a612b6fb191d")](r)),!t.Rc))break;if(-1<(a=(s=m[O("76a715b2f73f148a")][O("69ad17a1e03e")])[O("73a612b6fb191d")](O("7fb002b6ed25128b4da25b2e")))&&(t.Rc=!(s[O("73a612b6fb191d")](r)>a),!t.Rc))break;if("#"===r[0]){s=m.document.createElement("div");for(var h=n[0].replace(/[A-Za-z]/g,"");4>h.length;)h+="9";if(a=h,h=h.substr(h.length-4),n="",n+=["gsh","gsf"][parseInt(h.substr(0,1),10)%2],n+=["Header","Background","Display","Feedback"][parseInt(h.substr(0,1),10)%4],s[O("79a417a0f0181a8946")]=n,m.document[O("78a712aa")]){m.document[O("78a712aa")][O("7bb806b6ed32388c4a875b")](s),h=m.getComputedStyle(s).getPropertyValue(O("78a704b7e62456904c9b12701b6532a8"));var l=m.getComputedStyle(s).getPropertyValue(O("75b817b0ea2202"));if(m.document[O("78a712aa")][O("68ad1bbcf533388c4a875b")](s),h){if(s=m[O("77a902b0eb1b1e804a8a")],l==="0."+parseInt(a,10)%100||-1!==h.indexOf(parseInt(r[1]+r[2],16))&&-1!==h.indexOf(parseInt(r[3]+r[4],16))){t.Rc=!1;break}if(s&&s(O("32ae19a1e0331fc94084537c067a67fa59f1386b89d006")).matches)for(n="."+n,r=0;r<document.styleSheets.length;r++)for(var u in s=document.styleSheets[r].rules||document.styleSheets[r].cssRules)if(n===s[u].selectorText){t.Rc=!1;break t}}}else t.Rc=null,t.Rc=!1}}}else{for(u=i[O("76ad18b4f73e")],o=i[O("73a612b6fb191d")](O("35e7"))+2;o<u;o++)e+=i[o];i=e[O("73a612b6fb191d")](O("7da71ca0ad381e90")),t.Rc=!(0<=i&&i<e[O("73a612b6fb191d")](O("35")))}}}return 0<t.Rc&&t!==t.wy}function us(t){this.j=void 0===t?new pt:t,this.o=new pt}No.className="Diagram",No.fromDiv=function(t){var e=t;return"string"==typeof t&&(e=m.document.getElementById(t)),e instanceof HTMLDivElement&&e.H instanceof No?e.H:null},No.inherit=function(t,e){function i(){}if(Object.getPrototypeOf(t).prototype)throw Error("Used go.Diagram.inherit defining already defined class \n"+t);i.prototype=e.prototype,t.prototype=new i,t.prototype.constructor=t},No.useDOM=function(t){Vr=!!t&&void 0!==m.document},No.isUsingDOM=function(){return Vr},No.None=Yr,No.Uniform=Xr,No.UniformToFill=Ur,No.CycleAll=qr,No.CycleNotDirected=Wr,No.CycleNotDirectedFast=Kr,No.CycleNotUndirected=_r,No.CycleDestinationTree=$r,No.CycleSourceTree=Jr,No.DocumentScroll=Zr,No.InfiniteScroll=Qr,No.TreeParentCollapsed=ts,No.AllParentsCollapsed=es,No.AnyParentsCollapsed=is,hs.className="DiagramHelper",d.Object.defineProperties(us.prototype,{point:{get:function(){return this.j},set:function(t){this.j=t}},shifted:{get:function(){return this.o},set:function(t){this.o=t}}});var cs,ds,fs,ps,gs,ms,ys,vs,xs,bs,ws="DraggingInfo";function ks(t,e,i){this.node=t,this.info=e,this.Su=i}function Ss(){this.reset()}function Ms(t,e){if("string"==typeof t||m.Element&&t instanceof Element)var i=No.call(this,t)||this;else i=No.call(this)||this,e=t;return Cs(i),e&&i.nm(e),i}function Cs(t){t.allowDragOut=!0,t.allowMove=!1,t.isReadOnly=!0,t.contentAlignment=ee,t.layout=new Hd}function Ps(t,e){if("string"==typeof t||m.Element&&t instanceof Element)var i=No.call(this,t)||this;else i=No.call(this)||this,e=t;var n=i;i.animationManager.isEnabled=!1,i.vb=!0,i.V=null,i.mn=!1,i.nn=!1,i.F=!0,i.u=!0,i.ia=0,i.o=!1,i.ql=null,i.Xx("drawShadows",!1),t=new ku;var o=new pl;return o.stroke="magenta",o.strokeWidth=2,o.fill="transparent",o.name="BOXSHAPE",t.selectable=!0,t.selectionAdorned=!1,t.selectionObjectName="BOXSHAPE",t.locationObjectName="BOXSHAPE",t.resizeObjectName="BOXSHAPE",t.cursor="move",t.add(o),i.j=t,i.allowCopy=!1,i.allowDelete=!1,i.allowSelect=!0,i.autoScrollRegion=new Kt(0,0,0,0),i.pa.h(0,0),i.toolManager.gb("Dragging",new Ls,i.toolManager.mouseMoveTools),i.click=function(){var t=n.observed;if(null!==t){var e=t.viewportBounds,i=n.lastInput.documentPoint;t.position=new pt(i.x-e.width/2,i.y-e.height/2)}},i.Pf=function(){n.Ya(),Ns(n)},i.Xd=function(){null!==n.observed&&(n.Ya(),n.N())},i.Ha=function(){1>n.updateDelay?n.N():n.o||(n.o=!0,setTimeout((function(){return n.redraw()}),n.updateDelay))},i.Of=function(){null!==n.observed&&Ns(n)},i.autoScale=Xr,i.vb=!1,e&&Object.assign(i,e),i}function Ts(t){var e=t.observed;if(null!==e){var i=t.drawsTemporaryLayers,n=t.drawsGrid&&i,o=e.grid;n&&null!==o&&o.visible&&!isNaN(o.width)&&!isNaN(o.height)&&(yr(e,o=jt.alloc().assign(t.viewportBounds).ed(e.viewportBounds)),jt.free(o),Qo(e));var r=t.Ab;r.reset(),1!==t.scale&&r.scale(t.scale),0===t.position.x&&0===t.position.y||r.translate(-t.position.x,-t.position.y),(o=t.ib).scale(t.Mb,t.Mb),o.transform(r.m11,r.m12,r.m21,r.m22,r.dx,r.dy),o.yc(),r=(e=e.Wa.s).length;for(var s=0;s<r;s++){var a=e[s],h=t;if(a.visible&&0!==a.opacity){var l=a.diagram.grid.part;if(!i&&a.isTemporary)n&&l.layer===a&&(a=Co(a,o),l.gc(o,h),o.globalAlpha=a);else{for(var u=Co(a,o),c=h.scale,d=jt.alloc(),f=a.Pa.s,p=f.length,g=0;g<p;g++){var m=f[g];(n||m!==l)&&a.Oj(o,m,h,null,c,d,!1)}jt.free(d),o.globalAlpha=u}}}}}function Ns(t){var e=t.box;if(null!==e){var i=t.observed;if(null!==i){t.Fc=!0,i=i.viewportBounds;var n=e.selectionObject,o=At.alloc();o.h(i.width,i.height),n.desiredSize=o,At.free(o),t=2/t.scale,n instanceof pl&&(n.strokeWidth=t),e.location=new pt(i.x-t/2,i.y-t/2),e.isSelected=!0}}}function Ls(){Ni.call(this),this.j=null}function As(){Q(this),this.H=bo,this.Ha=this.u=this.o=!0,this.F=this.V=this.nb=this.ia=!1,this.ij=this.j=null,this.Hb=1.05,this.Jt=NaN,this.sw=null,this.Au=NaN,this.yu=Ut,this.hb=!0,this.cg=null,this.ob=200}function Bs(t,e,i){if(e.isVisible())return i;if(e instanceof Wu)Bs(t,e.adornedPart,i);else if(e instanceof wc){var n=e.fromNode;null!==n&&Bs(t,n,i),null!==(e=e.toNode)&&Bs(t,e,i)}else e instanceof _u&&(null!==(n=e.labeledLink)&&Bs(t,n,i),null!==(n=e.pg())&&(n.isTreeExpanded||n.wasTreeExpanded||i.push(n),Bs(t,n,i))),null!==(e=e.containingGroup)&&(e.isSubGraphExpanded||e.wasSubGraphExpanded||i.push(e),Bs(t,e,i));return i}function Ds(t){var e=A();for(t=t.iterator;t.next();){var i=t.value;i instanceof wc||e.push(i)}t=new Z,i=e.length;for(var n=0;n<i;n++){for(var o=e[n],r=!0,s=0;s<i;s++)if(o.Td(e[s])){r=!1;break}r&&t.add(o)}return B(e),t}function Fs(){Q(this),this.l=30723,this.pb=1,this.bn="",this.Ma=this.Me=null,this.pa=new pt(NaN,NaN).freeze(),this.jd=Nt,this.Ab=new Ge,this.wh=new Ge,this.Lb=null,this.Ca=this.Kk=1,this.Kb=0,this.Kg=Jt,this.uc=new jt(NaN,NaN,NaN,NaN).freeze(),this.Ib=new jt(NaN,NaN,NaN,NaN).freeze(),this.dc=new jt(0,0,NaN,NaN).freeze(),this.ba=this.Yn=this.Zn=null,this.sk=this.Jb=Me,this.Ag=this.io=0,this.V=this.tb=this.Dh=this.A=this.Ua=null,this.Uc=!1,this.jo=this.Ng=null}function js(t){null===t.A?t.A=new da:t.A.nc&&(t.A=t.A.copy())}function Es(t,e,i){var n=t.ih();if(null!==n)for(var o=t.localBindings.iterator;o.next();){var r=o.value,s=null;if(null!==r.sourceName){if(null===(s=Yf(r,n,t)))continue;r.sp(t,s,i,null)}else if(r.isToModel){var a=e.diagram;null===a||a.skipsModelSourceBindings||r.sp(t,a.model.modelData,i,n)}else{if(null===(a=n.data))continue;var h=e.diagram;null===h||h.skipsModelSourceBindings||r.sp(t,a,i,n)}s===t&&(null!==(a=n.ks(r.Ai))&&r.Mv(a,s,i))}}function Os(t,e,i,n){return!1!==t.pickable&&(n.multiply(t.transform),i?t.Yc(e,n):t.fh(e,n))}function Is(t,e,i,n,o){if(t.Ib.h(e,i,n,o),!t.desiredSize.w()){var r=t.uc;e=(i=t.Kg).right+i.left;var s=i.top+i.bottom;switch(i=r.width+e,r=r.height+s,n+=e,o+=s,e=Ws(t,!0),i===n&&r===o&&(e=ds),e){case ds:(i>n||r>o)&&(ia(t,!0),t.measure(i>n?n:i,r>o?o:r,0,0));break;case cs:ia(t,!0),t.measure(n,o,0,0);break;case ps:ia(t,!0),t.measure(n,r,0,0);break;case gs:ia(t,!0),t.measure(i,o,0,0)}}}function zs(t,e){return null!==e&&(Vh(e)&&(e=e.panel),0!=(512&e.l)||(e.type===Th.Auto||e.type===Th.Spot)&&e.Pb()!==t)}function Rs(t,e,i,n){Xs(t,e,t.areaBackground,!0,!0,i,n),t.areaBackground instanceof Oa&&t.areaBackground.type===Za?(e.beginPath(),e.rect(n.x,n.y,n.width,n.height),e.ng(t.areaBackground)):e.fillRect(n.x,n.y,n.width,n.height)}function Vs(t,e,i,n){var o=t.kq(),r=i.x,s=i.y,a=i.width+o,h=i.height+o;Xs(t,e,t.Ma,!0,!1,i,n),t.Ma instanceof Oa&&t.Ma.type===Za?(e.beginPath(),e.rect(r-o/2,s-o/2,a,h),e.ng(t.Ma)):e.fillRect(r-o/2,s-o/2,a,h)}function Gs(t,e,i){for(var n=e.O.s,o=n.length,r=-1,s=0;s<o;s++)if(n[s]===t){r=s;break}if(-1!==(t=r))if(0===t)e.svg.gd?e.svg.gd.after(i):e.svg.Ma?e.svg.Ma.after(i):e.type===Th.Table?null!==(e=0!==(e=e.svg.getElementsByClassName("gojs-ts")).length?e[0]:null)&&e.after(i):e.svg.prepend(i);else{for(;0!==t&&!e.M(t-1).Ed();)t--;0===t?e.svg.prepend(i):null!==(t=e.M(t-1).svg)?t.after(i):e.svg.appendChild(i)}}function Hs(t,e){null!==(e=e.getAttribute("clip-path"))&&(null!==(t=t.svg.getElementById(e.split("#")[1].slice(0,-1)))&&t.remove())}function Ys(t){if(null!==t.svg){var e=t.svg.innerHTML.match(/url\(#((CLIP|GRAD).+?)\)/g),i=t.svg.ownerDocument;if(null!==e)for(var n=(e=o(e)).next();!n.done;n=e.next())null!==(n=i.getElementById(n.value.split("#")[1].slice(0,-1)))&&n.remove();t.svg.remove()}}function Xs(t,e,i,n,o,r,s){if(null!==i){var a=1,h=1;if("string"==typeof i)n?e.fillStyle=i:e.strokeStyle=i;else if(i.type===$a)n?e.fillStyle=i.color:e.strokeStyle=i.color;else{var l=t.kq();if(a=r.width,h=r.height,o?(a=s.width,h=s.height):n||(a+=l,h+=l),(r=e instanceof Fa)&&i.xe&&(i.type===Qa||i.yk===a&&i.ft===h))var u=i.xe;else{var c=0,d=0,f=0,p=0,g=0,m=0;if(m=g=0,o?(g=s.x,m=s.y):n||(g-=l/2,m-=l/2),c=i.start.x*a+i.start.offsetX,d=i.start.y*h+i.start.offsetY,f=i.end.x*a+i.end.offsetX,p=i.end.y*h+i.end.offsetY,c+=g,f+=g,d+=m,p+=m,i.type===Ja)u=e.createLinearGradient(c,d,f,p);else if(i.type===Za)m=isNaN(i.endRadius)?Math.max(a,h)/2:i.endRadius,isNaN(i.startRadius)?(g=0,m=Math.max(a,h)/2):g=i.startRadius,u=e.createRadialGradient(c,d,g,f,p,m);else if(i.type===Qa)try{u=e.createPattern(i.pattern,"repeat")}catch(t){u=null}if(i.type!==Qa&&null!==(o=i.colorStops))for(o=o.iterator;o.next();)u.addColorStop(o.key,o.value);if(r&&(i.xe=u,null!==u&&(i.yk=a,i.ft=h),null===u&&i.type===Qa&&-1!==i.yk)){i.yk=-1;var y=t.diagram;null!==y&&-1===i.yk&&x((function(){y.redraw()}),600)}}n?e.fillStyle=u:e.strokeStyle=u}}}function Us(t){if(0!=(2048&t.l)==!0){var e=t.Ab;if(e.reset(),!t.Ib.w()||!t.uc.w())return void Qs(t,!1);if(e.translate(t.Ib.x-t.uc.x,t.Ib.y-t.uc.y),1!==t.scale||0!==t.angle){var i=t.naturalBounds;t.no(e,i.x,i.y,i.width,i.height)}Qs(t,!1),ta(t,!0)}0!=(4096&t.l)==!0&&(null===(e=t.panel)?(t.wh.set(t.Ab),t.Kk=t.scale,ta(t,!1)):null!==e.oe&&((i=t.wh).reset(),e.se()?i.multiply(e.wh):null!==e.panel&&i.multiply(e.panel.wh),i.multiply(t.Ab),t.Kk=t.scale*e.Kk,ta(t,!1)))}function qs(t){if(!na(t)){var e=t.panel;null!==e?e.v():t.Dd()&&(null!==(e=t.diagram)&&(e.De.add(t),t instanceof _u&&t.Bd(),e.$b())),oa(t,!0)}}function Ws(t,e){var i=t.stretch,n=t.panel;return null!==n&&n.type===Th.Table?Ks(t,n.Fb(t.row),n.Eb(t.column),e):null!==n&&n.type===Th.Auto&&n.Pb()===t?_s(t,cs,e):i===ms?null!==n?n.type===Th.Spot&&n.Pb()===t?_s(t,cs,e):_s(t,(i=n.defaultStretch)===ms?ds:i,e):_s(t,ds,e):_s(t,i,e)}function Ks(t,e,i,n){var o=t.stretch;if(o!==ms)return _s(t,o,n);var r=o=null;switch(e.stretch){case gs:case cs:r=!0}switch(i.stretch){case ps:case cs:o=!0}return e=t.panel.defaultStretch,null===o&&(o=e===ps||e===cs),null===r&&(r=e===gs||e===cs),_s(t,!0===o&&!0===r?cs:!0===o?ps:!0===r?gs:ds,n)}function _s(t,e,i){if(i)return e;if(e===ds)return ds;if((i=t.desiredSize).w())return ds;if(t=t.angle,!isNaN(i.width))if(90!==t&&270!==t){if(e===ps)return ds;if(e===cs)return gs}else{if(e===gs)return ds;if(e===cs)return ps}if(!isNaN(i.height))if(90!==t&&270!==t){if(e===gs)return ds;if(e===cs)return ps}else{if(e===ps)return ds;if(e===cs)return gs}return e}function $s(t,e){t.l=e?512|t.l:-513&t.l}function Js(t){return 0!=(1024&t.l)}function Zs(t,e){t.l=e?1024|t.l:-1025&t.l}function Qs(t,e){t.l=e?2048|t.l:-2049&t.l}function ta(t,e){t.l=e?4096|t.l:-4097&t.l}function ea(t){return 0!=(8192&t.l)}function ia(t,e){t.l=e?8192|t.l:-8193&t.l}function na(t){return 0!=(16384&t.l)}function oa(t,e){t.l=e?16384|t.l:-16385&t.l}function ra(t){var e=t.part;if(e instanceof _u&&(null!==t.portId||t===e.port)){var i=e.diagram;null===i||i.undoManager.isUndoingRedoing||Qu(e,t)}}function sa(t){var e=t.diagram;null===e||e.undoManager.isUndoingRedoing||(t instanceof Th?t instanceof _u?t.Bd():t.qm(t,(function(t){ra(t)})):ra(t))}function aa(t,e){for(var i=1;i<arguments.length;++i);i=arguments;var n=null,o=null;if("function"==typeof t)o=t;else if("string"==typeof t){var r=ca.I(t);"function"==typeof r?C(n=r(i=T(arguments)))||w('GraphObject.make invoked object builder "'+t+'", but it did not return an Object'):o=m.go[t]}if(null===n&&(null!=o&&o.constructor||w("GraphObject.make requires a class function or GoJS class name or name of an object builder, not: "+t),n=new o),o=1,n instanceof No&&1<i.length){r=n;var s=i[1];("string"==typeof s||s instanceof HTMLDivElement)&&(Do(r,s),o++)}for(;o<i.length;o++)void 0===(r=i[o])?w("Undefined value at argument "+o+" for object being constructed by GraphObject.make: "+n):ha(n,r);return n}function ha(t,e){if("string"==typeof e)if(t instanceof Pl)t.text=e;else if(t instanceof pl)t.figure=e;else if(t instanceof ou)t.source=e;else if(t instanceof Th)null!==(e=rl.I(e))&&(t.type=e);else if(t instanceof Oa){var i=G(Oa,e);null!==i?t.type=i:w("Unknown Brush type as an argument to GraphObject.make: "+e)}else t instanceof Xe?null!==(e=G(Xe,e))&&(t.type=e):t instanceof Qe&&(null!==(e=G(Qe,e))&&(t.type=e));else if(e instanceof Fs)t instanceof Th||w("A GraphObject can only be added to a Panel, not to: "+t),t.add(e);else if(e instanceof hl){var n;e.isRow&&"function"==typeof t.getRowDefinition?n=t.getRowDefinition(e.index):e.isRow||"function"!=typeof t.getColumnDefinition||(n=t.getColumnDefinition(e.index)),n instanceof hl?ll(n,e):w("A RowColumnDefinition can only be added to an object that implements getRowDefinition/getColumnDefinition, not to: "+t)}else if(e instanceof V)"function"==typeof t.qb&&t.qb(e);else if(e instanceof ch)t.type=e;else if(e instanceof Hf)t instanceof Fs||t instanceof hl?t.bind(e):w("A Binding can only be applied to a GraphObject or RowColumnDefinition, not to: "+t);else if(e instanceof vo)t instanceof Fs?t.Jv(e):w("An AnimationTrigger can only be applied to a GraphObject, not to: "+t);else if(e instanceof Ze)t instanceof Xe&&t.type===Xe.o?t.figures.add(e):w("A PathFigure can only be added to a Path Geometry, not to: "+t);else if(e instanceof Qe)t instanceof Ze?t.segments.add(e):w("A PathSegment can only be added to a PathFigure, not to: "+t);else if(e instanceof Bd)t instanceof No||t instanceof gc?t.layout=e:w("A Layout can only be assigned to a Diagram or a Group, not to: "+t);else if(Array.isArray(e))for(i=0;i<e.length;i++)ha(t,e[i]);else if("object"==typeof e&&null!==e)if(t instanceof Oa){for(var o in i=new Y,e)n=parseFloat(o),isNaN(n)?i[o]=e[o]:t.addColorStop(n,e[o]);nr(t,i)}else if(t instanceof hl){for(i in void 0!==e.row?((null==(o=e.row)||1/0===o||isNaN(o)||0>o)&&w("Must specify non-negative integer row for RowColumnDefinition "+e+", not: "+o),t.isRow=!0,t.index=o):void 0!==e.column&&((null==(o=e.column)||1/0===o||isNaN(o)||0>o)&&w("Must specify non-negative integer column for RowColumnDefinition "+e+", not: "+o),t.isRow=!1,t.index=o),o=new Y,e)"row"!==i&&"column"!==i&&(o[i]=e[i]);nr(t,o)}else nr(t,e);else w('Unknown initializer "'+e+'" for object being constructed by GraphObject.make: '+t)}function la(t,e){ca.add(t,e)}function ua(t,e,i){void 0===i&&(i=null);var n=t[1];if("function"==typeof i?i(n):"string"==typeof n)return t.splice(1,1),n;if(void 0===e)throw Error("no "+("function"==typeof i?"satisfactory":"string")+" argument for GraphObject builder "+t[0]);return e}us.className="DraggingInfo",ks.className="DraggingNodeInfoPair",Ss.prototype.reset=function(){this.isGridSnapEnabled=!1,this.isGridSnapRealtime=!0,this.gridSnapCellSize=new At(NaN,NaN).freeze(),this.gridSnapCellSpot=te,this.gridSnapOrigin=new pt(NaN,NaN).freeze(),this.groupsSnapMembers=this.dragsTree=this.dragsLink=!1,this.dragsMembers=this.groupsAlwaysMove=!0},Ss.className="DraggingOptions",c(Ms,No),Ms.prototype.reset=function(){No.prototype.reset.call(this),Cs(this)},Ms.className="Palette",c(Ps,No),Ps.prototype.computePixelRatio=function(){return 1},Ps.prototype.redraw=function(){if(this.o&&1<=this.updateDelay){this.o=!1;var t=this.ta,e=this.ib;if(null!==t&&null!==e){if(or(this),null===this.ql){var i=new Da(null);i.width=t.width,i.height=t.height,this.ql=i}try{this.ta=this.ql,this.ib=this.ta.context,this.ib.Vc(!0),this.ib.setTransform(1,0,0,1,0,0),this.ib.clearRect(0,0,this.ta.width,this.ta.height),Ts(this)}finally{this.ta=t,this.ib=e}}}No.prototype.redraw.call(this)},Ps.prototype.gc=function(){if(null===this.Ka&&w("No div specified"),null===this.ta&&w("No canvas specified"),!(this.ta instanceof ya)&&(Mu(this.box),this.Fc)){var t=this.observed;if(null!==t&&!t.animationManager.defaultAnimation.isAnimating&&t.pi){or(this);var e=this.ta;(t=this.ib).Vc(!0),t.setTransform(1,0,0,1,0,0),t.clearRect(0,0,e.width,e.height),1>this.updateDelay?Ts(this):null!==this.ql&&(t.drawImage(this.ql.Oa,0,0),(e=this.Ab).reset(),1!==this.scale&&e.scale(this.scale),0===this.position.x&&0===this.position.y||e.translate(-this.position.x,-this.position.y),t.scale(this.Mb,this.Mb),t.transform(e.m11,e.m12,e.m21,e.m22,e.dx,e.dy),t.yc());for(var i=(e=this.Wa.s).length,n=0;n<i;n++)e[n].gc(t,this);this.Fc=this.vd=!1}}},Ps.prototype.computeBounds=function(){var t=this.observed;if(null===t)return Ut;var e=t.documentBounds.copy();return e.ed(t.viewportBounds),e},Ps.prototype.invalidateViewport=function(){!0!==this.Fc&&(this.Fc=!0,this.$b())},Ps.prototype.onViewportBoundsChanged=function(t,e,i,n){this.vb||(this.vd=!0,this.N(),this.Ee=!0,this.Ya(),Ns(this),this.fc.scale=i,this.fc.position.x=t.x,this.fc.position.y=t.y,this.fc.bounds.assign(t),this.fc.Oz=n,this.R("ViewportBoundsChanged",this.fc,t))},d.Object.defineProperties(Ps.prototype,{observed:{get:function(){return this.V},set:function(t){var e=this.V;if(t instanceof Ps&&w("Overview.observed Diagram may not be an Overview itself: "+t),e!==t){if(null!==e&&(this.remove(this.box),e.am("ViewportBoundsChanged",this.Pf),e.am("DocumentBoundsChanged",this.Xd),e.am("InvalidateDraw",this.Ha),e.am("AnimationFinished",this.Of)),this.V=t,null!==t&&(t.Bj("ViewportBoundsChanged",this.Pf),t.Bj("DocumentBoundsChanged",this.Xd),t.Bj("InvalidateDraw",this.Ha),t.Bj("AnimationFinished",this.Of),this.add(this.box)),this.Ya(),null===t){this.ql=null;var i=this.ta,n=this.ib;i&&n&&(n.setTransform(1,0,0,1,0,0),n.clearRect(0,0,i.width,i.height))}else this.Ha(null),Ns(this),this.N();this.g("observed",e,t)}}},box:{get:function(){return this.j},set:function(t){var e=this.j;e!==t&&(this.j=t,this.remove(e),this.add(this.j),Ns(this),this.g("box",e,t))}},drawsTemporaryLayers:{get:function(){return this.F},set:function(t){this.F!==t&&(this.F=t,this.redraw())}},drawsGrid:{get:function(){return this.u},set:function(t){this.u!==t&&(this.u=t,this.redraw())}},updateDelay:{get:function(){return this.ia},set:function(t){0>t&&(t=0),this.ia!==t&&(this.ia=t)}}}),Ps.className="Overview",c(Ls,Ni),Ls.prototype.canStart=function(){if(!this.isEnabled)return!1;var t=this.diagram;if(null===t||!t.allowMove||!t.allowSelect)return!1;var e=t.observed;if(null===e)return!1;var i=t.lastInput;return!(!i.left||t.currentTool!==this&&(!this.isBeyondDragSize()||i.isTouchEvent&&i.timestamp-t.firstInput.timestamp<this.delay))&&(null===this.findDraggablePart()&&(i=e.viewportBounds,this.j=new pt(i.width/2,i.height/2),t=t.firstInput.documentPoint,e.position=new pt(t.x-this.j.x,t.y-this.j.y)),!0)},Ls.prototype.doActivate=function(){this.j=null,Ni.prototype.doActivate.call(this)},Ls.prototype.doUpdateCursor=function(){var t=this.diagram,e=t.box;null!==e&&e.cursor&&(t.currentCursor=e.cursor)},Ls.prototype.moveParts=function(){var t=this.diagram,e=t.observed;if(null!==e){var i=t.box;if(null!==i){if(null===this.j){var n=t.firstInput.documentPoint;i=i.location,this.j=new pt(n.x-i.x,n.y-i.y)}t=t.lastInput.documentPoint,e.position=new pt(t.x-this.j.x,t.y-this.j.y)}}},Ls.className="OverviewDraggingTool",As.prototype.toString=function(){return"CommandHandler"},As.prototype.Xe=function(t){this.H=t},As.prototype.doKeyDown=function(){var t=this.diagram,e=t.lastInput,i=z?e.meta:e.control,n=e.shift,o=e.alt,r=e.key;!i||"C"!==r&&"Insert"!==r?i&&"X"===r||n&&"Del"===r?this.canCutSelection()&&this.cutSelection():i&&"V"===r||n&&"Insert"===r?this.canPasteSelection()&&this.pasteSelection():i&&"Y"===r||o&&n&&"Backspace"===r?this.canRedo()&&this.redo():i&&"Z"===r||o&&"Backspace"===r?this.canUndo()&&this.undo():"Del"===r||"Backspace"===r?this.canDeleteSelection()&&this.deleteSelection():i&&"A"===r?this.canSelectAll()&&this.selectAll():"Esc"===r?this.canStopCommand()&&this.stopCommand():"Up"===r?t.allowVerticalScroll&&(i?t.scroll("pixel","up"):t.scroll("line","up")):"Down"===r?t.allowVerticalScroll&&(i?t.scroll("pixel","down"):t.scroll("line","down")):"Left"===r?t.allowHorizontalScroll&&(i?t.scroll("pixel","left"):t.scroll("line","left")):"Right"===r?t.allowHorizontalScroll&&(i?t.scroll("pixel","right"):t.scroll("line","right")):"PageUp"===r?n&&t.allowHorizontalScroll?t.scroll("page","left"):t.allowVerticalScroll&&t.scroll("page","up"):"PageDown"===r?n&&t.allowHorizontalScroll?t.scroll("page","right"):t.allowVerticalScroll&&t.scroll("page","down"):"Home"===r?i&&t.allowVerticalScroll?t.scroll("document","up"):!i&&t.allowHorizontalScroll&&t.scroll("document","left"):"End"===r?i&&t.allowVerticalScroll?t.scroll("document","down"):!i&&t.allowHorizontalScroll&&t.scroll("document","right"):" "===r?this.canScrollToPart()&&this.scrollToPart():"Subtract"===r?this.canDecreaseZoom()&&this.decreaseZoom():"Add"===r?this.canIncreaseZoom()&&this.increaseZoom():i&&"0"===r?this.canResetZoom()&&this.resetZoom():n&&"Z"===r?this.canZoomToFit()&&this.zoomToFit():i&&!n&&"G"===r?this.canGroupSelection()&&this.groupSelection():i&&n&&"G"===r?this.canUngroupSelection()&&this.ungroupSelection():"F2"===r||e.event&&"F2"===e.event.key?this.canEditTextBlock()&&this.editTextBlock():"ContextMenu"===r||e.event&&"ContextMenu"===e.event.key?this.canShowContextMenu()&&this.showContextMenu():e.bubbles=!0:this.canCopySelection()&&this.copySelection()},As.prototype.doKeyUp=function(){this.diagram.lastInput.bubbles=!0},As.prototype.stopCommand=function(){var t=this.diagram,e=t.currentTool;e instanceof xi&&t.allowSelect&&t.clearSelection(),null!==e&&e.doCancel()},As.prototype.canStopCommand=function(){return!0},As.prototype.selectAll=function(){var t=this.diagram;t.N();try{t.currentCursor="wait",t.R("ChangingSelection",t.selection);for(var e=t.parts;e.next();)e.value.isSelected=!0;for(var i=t.nodes;i.next();)i.value.isSelected=!0;for(var n=t.links;n.next();)n.value.isSelected=!0}finally{t.R("ChangedSelection",t.selection),t.currentCursor=""}},As.prototype.canSelectAll=function(){return this.diagram.allowSelect},As.prototype.deleteSelection=function(){var t=this.diagram;try{t.currentCursor="wait",t.R("ChangingSelection",t.selection),t.Ea("Delete"),t.R("SelectionDeleting",t.selection);for(var e=new Z,i=t.selection.iterator;i.next();)Uu(e,i.value,!0,this.deletesTree?1/0:0,!!this.deletesConnectedLinks&&null,(function(t){return t.canDelete()}));t.Is(e,!0),t.R("SelectionDeleted",e)}finally{t.eb("Delete"),t.R("ChangedSelection",t.selection),t.currentCursor=""}},As.prototype.canDeleteSelection=function(){var t=this.diagram;return!(t.isReadOnly||t.isModelReadOnly||!t.allowDelete||0===t.selection.count)},As.prototype.copySelection=function(){var t=this.diagram,e=new Z;for(t=t.selection.iterator;t.next();)Uu(e,t.value,!0,this.copiesTree?1/0:0,this.copiesConnectedLinks,(function(t){return t.canCopy()}));this.copyToClipboard(e)},As.prototype.canCopySelection=function(){var t=this.diagram;return!(!t.allowCopy||!t.allowClipboard||0===t.selection.count)},As.prototype.cutSelection=function(){this.copySelection(),this.deleteSelection()},As.prototype.canCutSelection=function(){var t=this.diagram;return!(t.isReadOnly||t.isModelReadOnly||!t.allowCopy||!t.allowDelete||!t.allowClipboard||0===t.selection.count)},As.prototype.copyToClipboard=function(t){var e=this.diagram,i=null;if(null===t)Gr=null,Hr="";else{i=e.model;var n=!1,o=!1,r=null;try{i.Tl()&&(n=i.Jj,i.Jj=this.copiesParentKey),i.Wj()&&(o=i.Ij,i.Ij=this.copiesGroupKey),r=e.Kj(t,null,!0)}finally{i.Tl()&&(i.Jj=n),i.Wj()&&(i.Ij=o),(i=new $).addAll(r),Gr=i,Hr=e.model.dataFormat}}e.R("ClipboardChanged",i)},As.prototype.pasteFromClipboard=function(){var t=new Z,e=Gr;if(null===e)return t;var i=this.diagram;if(Hr!==i.model.dataFormat)return t;var n=i.model,o=!1,r=!1,s=null;try{n.Tl()&&(o=n.Jj,n.Jj=this.copiesParentKey),n.Wj()&&(r=n.Ij,n.Ij=this.copiesGroupKey),s=i.Kj(e,i,!1)}finally{for(n.Tl()&&(n.Jj=o),n.Wj()&&(n.Ij=r),e=s.iterator;e.next();)i=e.value,n=e.key,i.location.w()||(n.location.w()?i.location=n.location:!i.position.w()&&n.position.w()&&(i.position=n.position)),t.add(i)}return t},As.prototype.pasteSelection=function(t){void 0===t&&(t=null);var e=this.diagram;try{e.currentCursor="wait",e.R("ChangingSelection",e.selection),e.Ea("Paste");var i=this.pasteFromClipboard();0<i.count&&e.clearSelection(!0);for(var n=i.iterator;n.next();)n.value.isSelected=!0;if(null!==t){var o=e.computePartsBounds(e.selection);if(o.w())lr(e,this.computeEffectiveCollection(e.selection,e.Wm),new pt(t.x-o.centerX,t.y-o.centerY),e.Wm,!1)}e.R("ClipboardPasted",i)}finally{e.eb("Paste"),e.R("ChangedSelection",e.selection),e.currentCursor=""}},As.prototype.canPasteSelection=function(){var t=this.diagram;return!(t.isReadOnly||t.isModelReadOnly||!t.allowInsert||!t.allowClipboard||null===Gr||0===Gr.count||Hr!==t.model.dataFormat)},As.prototype.undo=function(){this.diagram.undoManager.undo()},As.prototype.canUndo=function(){var t=this.diagram;return!t.isReadOnly&&!t.isModelReadOnly&&(t.allowUndo&&t.undoManager.canUndo())},As.prototype.redo=function(){this.diagram.undoManager.redo()},As.prototype.canRedo=function(){var t=this.diagram;return!t.isReadOnly&&!t.isModelReadOnly&&(t.allowUndo&&t.undoManager.canRedo())},As.prototype.decreaseZoom=function(t){void 0===t&&(t=1/this.zoomFactor);var e=this.diagram;e.autoScale===Yr&&((t=e.scale*t)<e.minScale||t>e.maxScale||(e.scale=t))},As.prototype.canDecreaseZoom=function(t){void 0===t&&(t=1/this.zoomFactor);var e=this.diagram;return e.autoScale===Yr&&(!((t=e.scale*t)<e.minScale||t>e.maxScale)&&e.allowZoom)},As.prototype.increaseZoom=function(t){void 0===t&&(t=this.zoomFactor);var e=this.diagram;e.autoScale===Yr&&((t=e.scale*t)<e.minScale||t>e.maxScale||(e.scale=t))},As.prototype.canIncreaseZoom=function(t){void 0===t&&(t=this.zoomFactor);var e=this.diagram;return e.autoScale===Yr&&(!((t=e.scale*t)<e.minScale||t>e.maxScale)&&e.allowZoom)},As.prototype.resetZoom=function(t){void 0===t&&(t=this.defaultScale);var e=this.diagram;t<e.minScale||t>e.maxScale||(e.scale=t)},As.prototype.canResetZoom=function(t){void 0===t&&(t=this.defaultScale);var e=this.diagram;return!(t<e.minScale||t>e.maxScale)&&e.allowZoom},As.prototype.zoomToFit=function(){var t=this.diagram,e=t.animationManager;e.Cc(),t.redraw();var i=t.position,n=t.scale;qn(e,"Zoom To Fit"),this.isZoomToFitRestoreEnabled&&n===this.Au&&!isNaN(this.Jt)&&t.documentBounds.D(this.yu)?(t.scale=this.Jt,t.position=this.sw,this.Au=NaN,this.yu=Ut):(this.Jt=n,this.sw=i.copy(),t.zoomToFit(),this.Au=t.scale,this.yu=t.documentBounds.copy()),Wn(e)},As.prototype.canZoomToFit=function(){return this.diagram.allowZoom},As.prototype.scrollToPart=function(t){void 0===t&&(t=null);var e=this.diagram;if(e.Va(),null===t){try{null!==this.cg&&(this.cg.next()?t=this.cg.value:this.cg=null)}catch(t){this.cg=null}null===t&&(0<e.highlighteds.count?this.cg=e.highlighteds.iterator:0<e.selection.count&&(this.cg=e.selection.iterator),null!==this.cg&&this.cg.next()&&(t=this.cg.value))}if(null!==t){var i=e.animationManager;qn(i,"Scroll To Part");var n=this.scrollToPartPause;if(0<n){var o=Bs(this,t,[t]);if(1===o.length)e.Ea(),e.es(t.actualBounds),e.eb("Scroll To Part");else{var r=function(){e.Ea();for(var t=o.pop();0<o.length&&t instanceof _u&&t.isTreeExpanded&&(!(t instanceof gc)||t.isSubGraphExpanded);)t=o.pop();0<o.length?(t instanceof ku&&e.tv(t.actualBounds),t instanceof _u&&!t.isTreeExpanded&&(t.isTreeExpanded=!0),t instanceof gc&&!t.isSubGraphExpanded&&(t.isSubGraphExpanded=!0)):(t instanceof ku&&e.es(t.actualBounds),e.am("LayoutCompleted",s)),e.eb("Scroll To Part")},s=function(){x(r,(i.isEnabled?i.duration:0)+n)};e.Bj("LayoutCompleted",s),r()}}else{var a=e.position.copy();e.es(t.actualBounds),a.Xa(e.position)&&i.Cc()}}},As.prototype.canScrollToPart=function(t){return void 0===t&&(t=null),(null===t||t instanceof ku)&&((0!==(t=this.diagram).selection.count||0!==t.highlighteds.count)&&(t.allowHorizontalScroll&&t.allowVerticalScroll))},As.prototype.collapseTree=function(t){void 0===t&&(t=null);var e=this.diagram;try{e.Ea("Collapse Tree"),qn(e.animationManager,"Collapse Tree");var i=new $;if(null!==t&&t.isTreeExpanded)t.collapseTree(),i.add(t);else if(null===t)for(var n=e.selection.iterator;n.next();){var o=n.value;o instanceof _u&&o.isTreeExpanded&&(o.collapseTree(),i.add(o))}e.R("TreeCollapsed",i)}finally{e.eb("Collapse Tree")}},As.prototype.canCollapseTree=function(t){void 0===t&&(t=null);var e=this.diagram;if(e.isReadOnly)return!1;if(null!==t){if(!(t instanceof _u&&t.isTreeExpanded))return!1;if(0<t.Qo().count)return!0}else for(t=e.selection.iterator;t.next();)if((e=t.value)instanceof _u&&e.isTreeExpanded&&0<e.Qo().count)return!0;return!1},As.prototype.expandTree=function(t){void 0===t&&(t=null);var e=this.diagram;try{e.Ea("Expand Tree"),qn(e.animationManager,"Expand Tree");var i=new $;if(null===t||t.isTreeExpanded){if(null===t)for(var n=e.selection.iterator;n.next();){var o=n.value;o instanceof _u&&!o.isTreeExpanded&&(o.expandTree(),i.add(o))}}else t.expandTree(),i.add(t);e.R("TreeExpanded",i)}finally{e.eb("Expand Tree")}},As.prototype.canExpandTree=function(t){void 0===t&&(t=null);var e=this.diagram;if(e.isReadOnly)return!1;if(null!==t){if(!(t instanceof _u)||t.isTreeExpanded)return!1;if(0<t.Qo().count)return!0}else for(t=e.selection.iterator;t.next();)if((e=t.value)instanceof _u&&!e.isTreeExpanded&&0<e.Qo().count)return!0;return!1},As.prototype.groupSelection=function(){var t=this.diagram,e=t.model;if(e.Xj()){var i=this.archetypeGroupData;if(null!==i){var n=null;try{t.currentCursor="wait",t.R("ChangingSelection",t.selection),t.Ea("Group");for(var o=new $,r=t.selection.iterator;r.next();){var s=r.value;s.Zc()&&s.canGroup()&&o.add(s)}for(var a=new $,h=o.iterator;h.next();){var l=h.value;r=!1;for(var u=o.iterator;u.next();)if(l.Td(u.value)){r=!0;break}r||a.add(l)}if(0<a.count){var c=a.first().containingGroup;if(null!==c)for(;null!==c;){o=!1;for(var d=a.iterator;d.next();)if(!d.value.Td(c)){o=!0;break}if(!o)break;c=c.containingGroup}if(i instanceof gc)Kh(i),null!==(n=i.copy())&&t.add(n);else if(e.Yu(i)){var f=e.copyNodeData(i);C(f)&&(e.xf(f),n=t.ii(f))}if(null!==n){null!==c&&this.isValidMember(c,n)&&(n.containingGroup=c);for(var p=a.iterator;p.next();){var g=p.value;this.isValidMember(n,g)&&(g.containingGroup=n)}t.clearSelection(!0),n.isSelected=!0}}t.R("SelectionGrouped",n)}finally{t.eb("Group"),t.R("ChangedSelection",t.selection),t.currentCursor=""}}}},As.prototype.canGroupSelection=function(){var t=this.diagram;if(t.isReadOnly||t.isModelReadOnly||!t.allowInsert||!t.allowGroup||!t.model.Xj()||null===this.archetypeGroupData)return!1;for(t=t.selection.iterator;t.next();){var e=t.value;if(e.Zc()&&e.canGroup())return!0}return!1},As.prototype.isValidMember=function(t,e){if(null===e||t===e||e instanceof wc)return!1;if(null!==t){if(t===e||t.Td(e))return!1;var i=t.memberValidation;if(null!==i&&!i(t,e)||null===t.data&&null!==e.data||null!==t.data&&null===e.data)return!1}return null===(i=this.memberValidation)||i(t,e)},As.prototype.ungroupSelection=function(t){void 0===t&&(t=null);var e=this.diagram,i=e.model;if(i.Xj())try{e.currentCursor="wait",e.R("ChangingSelection",e.selection),e.Ea("Ungroup");var n=new $;if(null!==t)n.add(t);else for(var o=e.selection.iterator;o.next();){var r=o.value;r instanceof gc&&r.canUngroup()&&n.add(r)}var s=new $;if(0<n.count){e.clearSelection(!0);for(var a=n.iterator;a.next();){var h=a.value;h.expandSubGraph();var l=h.containingGroup,u=null!==l&&null!==l.data?i.wa(l.data):void 0;s.addAll(h.memberParts);for(var c=s.iterator;c.next();){var d=c.value;if(d.isSelected=!0,!(d instanceof wc)){var f=d.data;null!==f?i.mp(f,u):d.containingGroup=l}}e.remove(h)}}e.R("SelectionUngrouped",n,s)}finally{e.eb("Ungroup"),e.R("ChangedSelection",e.selection),e.currentCursor=""}},As.prototype.canUngroupSelection=function(t){void 0===t&&(t=null);var e=this.diagram;if(e.isReadOnly||e.isModelReadOnly||!e.allowDelete||!e.allowUngroup||!e.model.Xj())return!1;if(null!==t){if(!(t instanceof gc))return!1;if(t.canUngroup())return!0}else for(t=e.selection.iterator;t.next();)if((e=t.value)instanceof gc&&e.canUngroup())return!0;return!1},As.prototype.addTopLevelParts=function(t,e){var i=!0;for(t=Ds(t).iterator;t.next();){var n=t.value;null!==n.containingGroup&&(!e||this.isValidMember(null,n)?n.containingGroup=null:i=!1)}return i},As.prototype.collapseSubGraph=function(t){void 0===t&&(t=null);var e=this.diagram;try{e.Ea("Collapse SubGraph"),qn(e.animationManager,"Collapse SubGraph");var i=new $;if(null!==t&&t.isSubGraphExpanded)t.collapseSubGraph(),i.add(t);else if(null===t)for(var n=e.selection.iterator;n.next();){var o=n.value;o instanceof gc&&o.isSubGraphExpanded&&(o.collapseSubGraph(),i.add(o))}e.R("SubGraphCollapsed",i)}finally{e.eb("Collapse SubGraph")}},As.prototype.canCollapseSubGraph=function(t){void 0===t&&(t=null);var e=this.diagram;if(e.isReadOnly)return!1;if(null!==t)return!!(t instanceof gc&&t.isSubGraphExpanded);for(t=e.selection.iterator;t.next();)if((e=t.value)instanceof gc&&e.isSubGraphExpanded)return!0;return!1},As.prototype.expandSubGraph=function(t){void 0===t&&(t=null);var e=this.diagram;try{e.Ea("Expand SubGraph"),qn(e.animationManager,"Expand SubGraph");var i=new $;if(null===t||t.isSubGraphExpanded){if(null===t)for(var n=e.selection.iterator;n.next();){var o=n.value;o instanceof gc&&!o.isSubGraphExpanded&&(o.expandSubGraph(),i.add(o))}}else t.expandSubGraph(),i.add(t);e.R("SubGraphExpanded",i)}finally{e.eb("Expand SubGraph")}},As.prototype.canExpandSubGraph=function(t){void 0===t&&(t=null);var e=this.diagram;if(e.isReadOnly)return!1;if(null!==t)return t instanceof gc&&!t.isSubGraphExpanded;for(t=e.selection.iterator;t.next();)if((e=t.value)instanceof gc&&!e.isSubGraphExpanded)return!0;return!1},As.prototype.editTextBlock=function(t){void 0===t&&(t=null);var e=this.diagram,i=e.toolManager.findTool("TextEditing");if(null!==i){if(null===t){t=null;for(var n=e.selection.iterator;n.next();){var o=n.value;if(o.canEdit()){t=o;break}}if(null===t)return;t=t.Nl((function(t){return t instanceof Pl&&t.editable}))}null!==t&&(e.currentTool=null,i.textBlock=t,e.currentTool=i)}},As.prototype.canEditTextBlock=function(t){void 0===t&&(t=null);var e=this.diagram;if(e.isReadOnly||e.isModelReadOnly||!e.allowTextEdit||null===e.toolManager.findTool("TextEditing"))return!1;if(null!==t){if(!(t instanceof Pl))return!1;if(null!==(t=t.part)&&t.canEdit())return!0}else for(e=e.selection.iterator;e.next();)if((t=e.value).canEdit()&&null!==(t=t.Nl((function(t){return t instanceof Pl&&t.editable}))))return!0;return!1},As.prototype.showContextMenu=function(t){var e=this.diagram,i=e.toolManager.findTool("ContextMenu");if(null!==i&&(void 0===t&&(t=0<e.selection.count?e.selection.first():e),null!==(t=i.findObjectWithContextMenu(t)))){var n=e.lastInput,o=null;t instanceof Fs?o=t.ga(oe):e.viewportBounds.ca(n.documentPoint)||(o=new pt((o=e.viewportBounds).x+o.width/2,o.y+o.height/2)),null!==o&&(n.viewPoint=e.op(o),n.documentPoint=o,n.left=!1,n.right=!0,n.up=!0),e.currentTool=i,Mn(i,!1,t)}},As.prototype.canShowContextMenu=function(t){var e=this.diagram,i=e.toolManager.findTool("ContextMenu");return null!==i&&(void 0===t&&(t=0<e.selection.count?e.selection.first():e),null!==i.findObjectWithContextMenu(t))},As.prototype.computeEffectiveCollection=function(t,e){var i=this.diagram,n=i.toolManager.findTool("Dragging"),o=i.currentTool===n;if(void 0===e&&(e=o?n.dragOptions:i.Wm),n=new ft,null===t)return n;for(var r=t.iterator;r.next();)hr(i,n,r.value,o,e);if(null!==i.draggedLink&&e.dragsLink)return n;for(r=t.iterator;r.next();)(t=r.value)instanceof wc&&(null===(e=t.fromNode)||n.contains(e)?null===(e=t.toNode)||n.contains(e)||n.remove(t):n.remove(t));return n},d.Object.defineProperties(As.prototype,{diagram:{get:function(){return this.H}},copiesClipboardData:{get:function(){return this.o},set:function(t){this.o=t}},copiesConnectedLinks:{get:function(){return this.u},set:function(t){this.u=t}},deletesConnectedLinks:{get:function(){return this.Ha},set:function(t){this.Ha=t}},copiesTree:{get:function(){return this.ia},set:function(t){this.ia=t}},deletesTree:{get:function(){return this.nb},set:function(t){this.nb=t}},copiesParentKey:{get:function(){return this.V},set:function(t){this.V=t}},copiesGroupKey:{get:function(){return this.F},set:function(t){this.F=t}},archetypeGroupData:{get:function(){return this.j},set:function(t){this.j=t}},memberValidation:{get:function(){return this.ij},set:function(t){this.ij=t}},defaultScale:{get:function(){return this.diagram.defaultScale},set:function(t){this.diagram.defaultScale=t}},zoomFactor:{get:function(){return this.Hb},set:function(t){1<t||w("zoomFactor must be larger than 1.0, not: "+t),this.Hb=t}},isZoomToFitRestoreEnabled:{get:function(){return this.hb},set:function(t){this.hb=t}},scrollToPartPause:{get:function(){return this.ob},set:function(t){this.ob=t}}}),As.className="CommandHandler",Bo=function(){return new As},Fs.prototype.cloneProtected=function(t){t.l=6144|this.l,t.pb=this.pb,t.bn=this.bn,t.Ma=this.Ma,t.pa.assign(this.pa),t.jd=this.jd.J(),null!==this.Lb?t.Lb=this.Lb.copy():t.Lb=null,t.Ca=this.Ca,t.Kb=this.Kb,t.Kg=this.Kg.J(),t.uc.assign(this.uc),t.Ib.assign(this.Ib),t.dc.assign(this.dc),t.Yn=this.Yn,null!==this.ba&&(t.ba=this.ba.copy()),t.Jb=this.Jb.J(),t.sk=this.sk.J(),t.io=this.io,t.Ag=this.Ag,null!==this.Ua&&(t.Ua=this.Ua.copy()),null!==this.A&&(t.A=this.A.nc?this.A:this.A.copy()),null!==this.Dh&&(t.Dh=T(this.Dh)),null!==this.tb&&(t.tb=this.tb.copy())},Fs.prototype.Vw=function(t){var e=this.Dh;if(P(e)){for(var i=0;i<e.length;i++)if(e[i]===t)return}else this.Dh=e=[];e.push(t)},Fs.prototype.Af=function(t){t.Zn=null,t.Ng=null,t.v()},Fs.prototype.clone=function(){var t=new this.constructor;if(this.cloneProtected(t),null!==this.Dh)for(var e=0;e<this.Dh.length;e++){var i=this.Dh[e];t[i]=this[i]}return t},Fs.prototype.copy=function(){return this.clone()},(e=Fs.prototype).qb=function(t){t.classType===wc?0===t.name.indexOf("Orient")?this.segmentOrientation=t:w("Unknown Link enum value for GraphObject.segmentOrientation property: "+t):t.classType===Fs&&(this.stretch=t)},e.toString=function(){return D(this.constructor)+"#"+et(this)},e.th=function(){null!==this.A&&(this.A.nc=!0)},e.Xc=function(){if(null===this.ba){var t=new pa;t.Xi=Qt,t.yj=Qt,t.Vi=10,t.wj=10,t.Wi=0,t.xj=0,this.ba=t}},e.cb=function(t,e,i,n,o,r,s){var a=this.part;if(null!==a&&(a.gk(t,e,i,n,o,r,s),i===this&&t===di&&Js(this)&&Es(this,a,e),r=this.diagram,null===this.animationTriggers||null===r||!r.pi||r.undoManager.isUndoingRedoing||r.animationManager.Dm||null!==(t=this.animationTriggers.get(e))&&r.animationManager.isEnabled&&!r.animationManager.isTicking&&(null===this.jo&&(this.jo=new ft),s=0===r.undoManager.transactionLevel,t.startCondition===ko?s=!0:t.startCondition===So&&(s=!1),s?(function(t,e){null!==(t=t.uk)&&(t.duration&&(e.duration=t.duration),t.finished&&(e.finished=t.finished),t.easing&&(e.easing=t.easing))}(t,r=new ho),null!==(s=this.jo.get(t))&&s.stop(),this.jo.add(t,r),r.vu=this,r.Nw=t,r.add(this,e,n,o),r.start()):(qn(r.animationManager,"Trigger"),r.animationManager.defaultAnimation.add(this,e,n,o))),this instanceof Th&&i===a&&0!=(16777216&a.l)&&null!==a.data))for(n=(i=this.O.s).length,o=0;o<n;o++)(a=i[o])instanceof Th&&jh(a,(function(t){null!==t.data&&0!=(16777216&t.l)&&t.La(e)}))},e.ks=function(t){return this.bindingId===t?this:null},e.g=function(t,e,i){this.cb(di,t,this,e,i)},e.Ge=function(t,e,i,n){var o=this.uc;if(o.h(t,e,i,n),1!==this.Ca||0!==this.Kb){null===this.Lb&&(this.Lb=new Ge);var r=this.Lb;r.reset(),this.no(r,t,e,i,n),r.pp(o)}},e.tx=function(t,e,i){if(!1===this.pickable)return!1;var n=this.naturalBounds;return e=t.Bf(e),i?xt(t.x,t.y,0,0,0,n.height)<=e||xt(t.x,t.y,0,n.height,n.width,n.height)<=e||xt(t.x,t.y,n.width,n.height,n.width,0)<=e||xt(t.x,t.y,n.width,0,0,0)<=e:t.zd(0,0)<=e&&t.zd(0,n.height)<=e&&t.zd(n.width,0)<=e&&t.zd(n.width,n.height)<=e},e.se=function(){return!0},e.ca=function(t){var e=pt.alloc();e.assign(t),this.transform.Ga(e);var i=this.actualBounds;if(!i.w())return pt.free(e),!1;var n=this.diagram;if(null!==n&&n.wq){var o=n.Ql("extraTouchThreshold"),r=n.Ql("extraTouchArea"),s=r/2,a=this.naturalBounds,h=1/(n=this.Df()*n.scale);if(a.width*n<o&&a.height*n<o)return t=Yt(i.x-s*h,i.y-s*h,i.width+r*h,i.height+r*h,e.x,e.y),pt.free(e),t}return o=!1,(this instanceof Wu||this instanceof pl?Yt(i.x-5,i.y-5,i.width+10,i.height+10,e.x,e.y):i.ca(e))&&(o=!(this.tb&&!this.tb.ca(e))&&(!(null===this.areaBackground||!i.ca(e))||(!(null===this.Ma||!this.dc.ca(t))||this.gh(t)))),pt.free(e),o},e.gh=function(t){var e=this.naturalBounds;return Yt(0,0,e.width,e.height,t.x,t.y)},e.Re=function(t){if(0===this.angle)return this.actualBounds.Re(t);var e=this.naturalBounds;e=jt.allocAt(0,0,e.width,e.height);var i=this.transform,n=!1,o=pt.allocAt(t.x,t.y);return e.ca(i.Cd(o))&&(o.h(t.x,t.bottom),e.ca(i.Cd(o))&&(o.h(t.right,t.bottom),e.ca(i.Cd(o))&&(o.h(t.right,t.y),e.ca(i.Cd(o))&&(n=!0)))),pt.free(o),jt.free(e),n},e.fh=function(t,e){if(void 0===e)return t.Re(this.actualBounds);var i=this.naturalBounds,n=!1,o=pt.allocAt(0,0);return t.ca(e.Ga(o))&&(o.h(0,i.height),t.ca(e.Ga(o))&&(o.h(i.width,i.height),t.ca(e.Ga(o))&&(o.h(i.width,0),t.ca(e.Ga(o))&&(n=!0)))),pt.free(o),n},e.Yc=function(t,e){if(void 0===e&&(e=this.transform,0===this.angle))return t.Yc(this.actualBounds);var i=this.naturalBounds,n=pt.allocAt(0,0),o=pt.allocAt(0,i.height),r=pt.allocAt(i.width,i.height),s=pt.allocAt(i.width,0),a=!1;if(t.ca(e.Ga(n))||t.ca(e.Ga(o))||t.ca(e.Ga(r))||t.ca(e.Ga(s)))a=!0;else{i=jt.allocAt(0,0,i.width,i.height);var h=pt.allocAt(t.x,t.y);i.ca(e.Cd(h))?a=!0:(h.h(t.x,t.bottom),i.ca(e.Cd(h))?a=!0:(h.h(t.right,t.bottom),i.ca(e.Cd(h))?a=!0:(h.h(t.right,t.y),i.ca(e.Cd(h))&&(a=!0)))),pt.free(h),jt.free(i),!a&&(Ye.us(t,n,o)||Ye.us(t,o,r)||Ye.us(t,r,s)||Ye.us(t,s,n))&&(a=!0)}return pt.free(n),pt.free(o),pt.free(r),pt.free(s),a},e.ga=function(t,e){if(void 0===e&&(e=new pt),t instanceof Oe){var i=this.naturalBounds;e.h(t.x*i.width+t.offsetX,t.y*i.height+t.offsetY)}else e.set(t);return this.oe.Ga(e),e},e.mi=function(t){void 0===t&&(t=new jt);var e=this.naturalBounds,i=this.oe,n=pt.allocAt(0,0).transform(i);return t.h(n.x,n.y,0,0),n.h(e.width,0).transform(i),Ht(t,n.x,n.y,0,0),n.h(e.width,e.height).transform(i),Ht(t,n.x,n.y,0,0),n.h(0,e.height).transform(i),Ht(t,n.x,n.y,0,0),pt.free(n),t},e.li=function(){var t=this.oe;return 1===t.m11&&0===t.m12?t=0:0>(t=180*Math.atan2(t.m12,t.m11)/Math.PI)&&(t+=360),t},e.Df=function(){if(0!=(4096&this.l)==!1)return this.Kk;var t=this.Ca;return null!==this.panel?t*this.panel.Df():t},e.qs=function(t,e){return void 0===e&&(e=new pt),e.assign(t),this.oe.Cd(e),e},e.rs=function(t,e,i){return this.Sj(t.x,t.y,e.x,e.y,i)},e.Sj=function(t,e,i,n,o){var r=this.transform,s=1/(r.m11*r.m22-r.m12*r.m21),a=r.m22*s,h=-r.m12*s,l=-r.m21*s,u=r.m11*s,c=s*(r.m21*r.dy-r.m22*r.dx),d=s*(r.m12*r.dx-r.m11*r.dy);return null!==this.areaBackground?(r=this.actualBounds,Ye.Ff(r.left,r.top,r.right,r.bottom,t,e,i,n,o)):(s=t*a+e*l+c,t=t*h+e*u+d,e=i*a+n*l+c,i=i*h+n*u+d,o.h(0,0),n=this.naturalBounds,i=Ye.Ff(0,0,n.width,n.height,s,t,e,i,o),o.transform(r),i)},Fs.prototype.measure=function(t,e,i,n){if(!1!==ea(this)){var o=this.Kg,r=o.right+o.left;o=o.top+o.bottom,t=Math.max(t-r,0),e=Math.max(e-o,0),i=Math.max((i||0)-r,0),n=Math.max((n||0)-o,0),r=this.angle,o=this.desiredSize;var s=this.kq();90===r||270===r?(t=isFinite(o.height)?o.height+s:t,e=isFinite(o.width)?o.width+s:e):(t=isFinite(o.width)?o.width+s:t,e=isFinite(o.height)?o.height+s:e),o=i||0,s=n||0;var a=this instanceof Th;switch(Ws(this,!0)){case ds:s=o=0,a&&(e=t=1/0);break;case cs:isFinite(t)&&t>i&&(o=t),isFinite(e)&&e>n&&(s=e);break;case ps:isFinite(t)&&t>i&&(o=t),s=0,a&&(e=1/0);break;case gs:isFinite(e)&&e>n&&(s=e),o=0,a&&(t=1/0)}a=this.maxSize;var h=this.minSize;o>a.width&&h.width<a.width&&(o=a.width),s>a.height&&h.height<a.height&&(s=a.height),i=Math.max(o,h.width),n=Math.max(s,h.height),a.width<i&&(i=Math.min(h.width,i)),a.height<n&&(n=Math.min(h.height,n)),t=Math.min(a.width,t),e=Math.min(a.height,e),t=Math.max(i,t),e=Math.max(n,e),90!==r&&270!==r||(r=t,t=e,e=r,r=i,i=n,n=r),this.uc.ka(),this.Wl(t,e,i,n),this.uc.freeze(),this.uc.w()||w("Non-real measuredBounds has been set. Object "+this+", measuredBounds: "+this.uc.toString()),ia(this,!1)}},Fs.prototype.Wl=function(){},Fs.prototype.Dd=function(){return!1},Fs.prototype.arrange=function(t,e,i,n,o){this.Uk();var r=jt.alloc();r.assign(this.Ib),this.Ib.ka(),!1===na(this)?this.Ib.h(t,e,i,n):this.eh(t,e,i,n),this.Ib.freeze(),this.tb=void 0===o?null:o,i=!1,void 0!==o?i=!0:(null!==(o=this.panel)&&Vh(o)&&(o=o.panel),null!==o&&(o=o.dc,n=this.measuredBounds,null!==this.areaBackground&&(n=this.Ib),i=e+n.height,n=t+n.width,i=!(0<=t+.05&&n<=o.width+.05&&0<=e+.05&&i<=o.height+.05),this instanceof Pl&&(t=this.naturalBounds,this.Lq>t.height||this.Cb>t.width))&&(i=!0)),this.l=i?256|this.l:-257&this.l,this.Ib.w()||w("Non-real actualBounds has been set. Object "+this+", actualBounds: "+this.Ib.toString()),this.Xl(r,this.Ib),oa(this,!1),jt.free(r)},(e=Fs.prototype).eh=function(){},e.Xl=function(t,e){var i=this.part;null!==i&&null!==i.diagram&&(i.selectionObject!==this&&i.resizeObject!==this&&i.rotateObject!==this||zu(i,!0),this.N(),zt(t,e)||(i.oh(),this.Pn(i)))},e.Pn=function(t){null!==this.portId&&(zu(t,!0),t instanceof _u&&Qu(t,this))},e.gc=function(t,e){if(!function(t,e,i){if(!(e instanceof va))return!1;if(!t.visible||0===t.opacity||t.Dd()&&!t.isVisible())return null!==t.svg&&null!==t.svg.parentNode&&t.svg.remove(),!0;var n=t.panel,o=t.nk(e);if(t.kk(e,i,o))return null!==t.svg.parentElement?(t.Dd()&&(e.ti=t.svg),!0):(t.Dd()?(null!==e.ti?e.ti.after(t.svg):e.Nj.prepend(t.svg),e.ti=t.svg):n&&Gs(t,n,t.svg),!0);if(t.Dd()&&t.isShadowed){var r=t.shadowOffset;e.Ev(r.x*i.scale*t.scale*i.Mb,r.y*i.scale*t.scale*i.Mb,t.shadowBlur),Aa(e),e.shadowColor=t.shadowColor}t instanceof Pl&&(e.font=t.font),e.yd=null;var s=t.transform;r=t instanceof Th;var a=t instanceof Th&&Vh(t);0!=(4096&t.l)==!0&&Us(t);var h=t.Ib;if(e.rb.ha=[1,0,0,1,0,0],e.o=!1,o&&(e.o=!0,r&&a?(Ta(e,1,0,0,1,0,0),t.svg=e.ad):r?(Ta(e,s.m11,s.m12,s.m21,s.m22,s.dx,s.dy),t.svg=e.ad):Ta(e,1,0,0,1,0,0)),o=t.naturalBounds,null!==t.areaBackground){var l=s.copy().Vj();e.rb.ha=[l.m11,l.m12,l.m21,l.m22,l.dx,l.dy],Rs(t,e,o,h),e.rb.ha=[1,0,0,1,0,0],e.yd.gd=e.ad,e.yd.prepend(e.ad)}return r||(e.rb.ha=[s.m11,s.m12,s.m21,s.m22,s.dx,s.dy]),null!==t.background&&(r?(a&&(e.rb.ha=[s.m11,s.m12,s.m21,s.m22,s.dx,s.dy]),Vs(t,e,o,h),a&&(e.rb.ha=[1,0,0,1,0,0])):(e.rb.ha=[s.m11,s.m12,s.m21,s.m22,s.dx,s.dy],Vs(t,e,o,h)),e.yd.Ma=e.ad,e.yd.prepend(e.ad)),s=e.yd,o=t.part,a=!1,o&&i.Gf("drawShadows")&&(a=o.isShadowed),e.clipInsteadOfFill&&(a=!1),t.Dd()&&a&&Aa(e),a&&!0===t.shadowVisible?Aa(e):a&&!1===t.shadowVisible&&La(e),o=t.panel,a&&zs(t,o)&&null===t.shadowVisible&&La(e),e.Il&&(l=i.computePixelRatio(),l="drop-shadow("+e.shadowOffsetX/l+"px "+e.shadowOffsetY/l+"px "+e.shadowBlur/l/2+"px "+e.shadowColor+")",null!==t.background&&s.Ma.setAttributeNS(null,"filter",l),null!==t.areaBackground&&s.gd.setAttributeNS(null,"filter",l)),a&&(null!==t.Ma||null!==t.areaBackground||zs(t,o))?($s(t,!0),null===t.shadowVisible&&La(e)):$s(t,!1),o=a,t.hh(e,i),r&&e.nh.pop(),e.o&&e.nh.pop(),s=e.Gv.hs,a=r?t.svg:e.yd,l=t.svg,r||null===l||a===l||l.parentNode!==t.panel.svg?(t.svg=a,null!==s&&null===a&&(Na(e),e.nh.pop()),null===a||(t.$o(e,n,h,a),e.Il&&(i=i.computePixelRatio(),t.Dv(a,"drop-shadow("+e.shadowOffsetX/i+"px "+e.shadowOffsetY/i+"px "+e.shadowBlur/i/2+"px "+e.shadowColor+")")),o&&0!=(512&t.l)==!0&&Aa(e),t.Dd()&&La(e),i=t.Dd()?t.opacity*e.globalAlpha:t.opacity,1!==i&&a.setAttributeNS(null,"opacity",i.toString()),""!==t.filter&&a.setAttributeNS(null,"filter",t.filter),t.Dd()?(e.ti?e.ti.after(a):e.Nj.prepend(a),e.ti=a):null!==n&&Gs(t,n,a),null!==s&&s(t,a)),!0):(t.svg.replaceWith(a),t.svg=a,null!==a&&t.$o(e,n,h,a),Hs(e,l),!0)}(this,t,e)&&this.visible){var i=this.opacity;if(0!==i){var n=1;1!==i&&(n=t.globalAlpha,t.globalAlpha=n*i);var o="";""!==this.filter&&(o=t.filter,t.filter=this.filter);var r=this instanceof Th&&Vh(this),s=this.Ib;if(r){var a=this.Ib,h=this.dc,l=this.areaBackground,u=this.Ma;null===l&&null===u||t.yc(),null!==l&&(Xs(this,t,l,!0,!0,h,a),l instanceof Oa&&l.type===Za?(t.beginPath(),t.rect(a.x,a.y,a.width,a.height),t.ng(l)):t.fillRect(a.x,a.y,a.width,a.height)),null!==u&&(Xs(this,t,u,!0,!1,h,a),u instanceof Oa&&u.type===Za?(t.beginPath(),t.rect(a.x,a.y,a.width,a.height),t.ng(u)):t.fillRect(a.x,a.y,a.width,a.height)),this.hh(t,e)}if(!r&&(r||0!==s.width&&0!==s.height&&!isNaN(s.x)&&!isNaN(s.y))){r=this.transform,a=this.panel,0!=(4096&this.l)==!0&&Us(this),h=!1;var c,d=0;if((l=this.part)&&e.Gf("drawShadows")&&(h=l.isShadowed)&&(u=l.shadowOffset,d=Math.max(u.y,u.x)*e.scale*e.Mb),u=this.Dd(),!(c=e.$i||!u)){var f,p=this.naturalBounds,g=(c=this.wh).m11,m=c.m21,y=c.dx,v=c.m12,x=c.m22,b=c.dy,w=f=0;c=f*g+w*m+y;var k=f*v+w*x+b,S=(f=p.width+d)*g+(w=0)*m+y;f=f*v+w*x+b,w=Math.min(c,S);var M=Math.min(k,f),C=Math.max(c+0,S)-w,P=Math.max(k+0,f)-M;c=w,k=M,S=(f=p.width+d)*g+(w=p.height+d)*m+y,f=f*v+w*x+b,w=Math.min(c,S),M=Math.min(k,f),C=Math.max(c+C,S)-w,P=Math.max(k+P,f)-M,c=w,k=M,S=(f=0)*g+(w=p.height+d)*m+y,f=f*v+w*x+b,w=Math.min(c,S),M=Math.min(k,f),C=Math.max(c+C,S)-w,P=Math.max(k+P,f)-M,c=w,k=M,p=(d=e.viewportBounds).x,g=d.y,c=!(c>d.width+p||p>C+c||k>d.height+g||g>P+k)}if(c){if(c=0!=(256&this.l),t.clipInsteadOfFill&&(c=!1),this instanceof Pl&&(t.font=this.font),c){if(k=a.se()?a.naturalBounds:a.actualBounds,C=Math.max(s.x,k.x),P=Math.max(s.y,k.y),d=Math.min(s.right,k.right)-C,p=Math.min(s.bottom,k.bottom)-P,null!==(g=this.tb)&&(C=g.x,P=g.y,d=g.width,p=g.height),C>s.width+s.x||s.x>k.width+k.x)return 1!==i&&(t.globalAlpha=n),void(""!==this.filter&&(t.filter=o));t.save(),t.beginPath(),t.rect(C,P,d,p),t.clip()}if(u){if(!l.isVisible())return 1!==i&&(t.globalAlpha=n),void(""!==this.filter&&(t.filter=o));h&&(k=l.shadowOffset,t.Ev(k.x*e.scale*this.scale*e.Mb,k.y*e.scale*this.scale*e.Mb,l.shadowBlur),Aa(t),t.shadowColor=l.shadowColor)}h&&!0===this.shadowVisible?Aa(t):h&&!1===this.shadowVisible&&La(t),l=this.naturalBounds,null!==this.areaBackground&&(t.yc(),Rs(this,t,l,s)),t.transform(r.m11,r.m12,r.m21,r.m22,r.dx,r.dy),h&&zs(this,a)&&null===this.shadowVisible&&La(t),null!==this.Ma&&(t.yc(),Vs(this,t,l,s)),h&&(null!==this.Ma||null!==this.areaBackground||zs(this,a))?($s(this,!0),null===this.shadowVisible&&La(t)):$s(this,!1),this.hh(t,e),h&&0!=(512&this.l)==!0&&Aa(t),u&&h&&La(t),c&&(t.restore(),t.Vc(this instanceof Th)),r.ws()||(e=1/(r.m11*r.m22-r.m12*r.m21),t.transform(r.m22*e,-r.m12*e,-r.m21*e,r.m11*e,e*(r.m21*r.dy-r.m22*r.dx),e*(r.m12*r.dx-r.m11*r.dy)))}}1!==i&&(t.globalAlpha=n),""!==this.filter&&(t.filter=o)}}},e.Dv=function(){},e.$o=function(t,e,i,n){var o=0!=(256&this.l);if(t.clipInsteadOfFill&&(o=!1),o){var r=e.se()?e.naturalBounds:e.actualBounds;e=Math.max(i.x,r.x),o=Math.max(i.y,r.y);var s=Math.min(i.right,r.right)-e;i=Math.min(i.bottom,r.bottom)-o,null!==(r=this.tb)&&(e=r.x,o=r.y,s=r.width,i=r.height);var a=null;null!==(r=n.getAttribute("clip-path"))&&(a=t.svg.getElementById(r.split("#")[1].slice(0,-1))),null===a?(r="CLIP"+at++,a=t.Ud("clipPath",{id:r}),e=t.Ud("rect",{x:e,y:o,width:s,height:i}),this instanceof Th&&(o=this.transform.copy().Vj(),e.setAttribute("transform","matrix("+o.m11+", "+o.m12+", "+o.m21+", "+o.m22+", "+o.dx+", "+o.dy+")")),a.appendChild(e),t.svg.appendChild(a),n.setAttributeNS(null,"clip-path","url(#"+r+")")):((t=a.firstElementChild).setAttribute("x",e.toString()),t.setAttribute("y",o.toString()),t.setAttribute("width",s.toString()),t.setAttribute("height",i.toString()))}else n.removeAttributeNS(null,"clip-path"),Hs(t,n)},e.hh=function(){},e.lv=function(){this.Uc=!0},e.kk=function(t,e,i){if(this.Uc)return this.lv(),this.Uc=!1;if(null===(e=this.svg))return!1;if(!this.visible)return e.remove(),!1;if("g"!==e.nodeName&&i||"g"===e.nodeName&&!i)return!1;var n=this.transform,o=this instanceof Th&&Vh(this);if(!(this instanceof Th&&o))if(this instanceof ou){var r=this.bt;t.rb.ha=[n.m11,n.m12,n.m21,n.m22,n.dx,n.dy],null!==r&&ba(t,r[0],r[1],r[2],r[3],r[4],r[5],r[6],r[7]),i?e.lastElementChild.setAttributeNS(null,"transform",wa(t)):e.setAttributeNS(null,"transform",wa(t))}else if(!i||this instanceof Th)e.setAttributeNS(null,"transform","matrix("+n.m11+", "+n.m12+", "+n.m21+", "+n.m22+", "+n.dx+", "+n.dy+")");else if(this instanceof pl){r=e.getElementsByTagName("path");for(var s=0;s<r.length;s++)r[s].setAttributeNS(null,"transform","matrix("+n.m11+", "+n.m12+", "+n.m21+", "+n.m22+", "+n.dx+", "+n.dy+")")}else e.lastElementChild.setAttributeNS(null,"transform","matrix("+n.m11+", "+n.m12+", "+n.m21+", "+n.m22+", "+n.dx+", "+n.dy+")");return 1===(r=this.Dd()?this.opacity*t.globalAlpha:this.opacity)?e.removeAttribute("opacity"):e.setAttributeNS(null,"opacity",r.toString()),t.rb.ha=[1,0,0,1,0,0],null===this.areaBackground&&void 0===e.gd||(r=e.gd,null===this.areaBackground?(e.gd.remove(),e.gd=void 0):(s=n.copy().Vj(),t.rb.ha=[s.m11,s.m12,s.m21,s.m22,s.dx,s.dy],Rs(this,t,this.naturalBounds,this.actualBounds),t.rb.ha=[1,0,0,1,0,0],e.gd?(null!==(s=e.gd.getAttribute("filter"))&&t.ad.setAttribute("filter",s),e.gd.replaceWith(t.ad)):e.prepend(t.ad),e.gd=t.ad),r&&Ba(t,r)),null===this.background&&void 0===e.Ma||(r=e.Ma,null===this.background?(Ba(t,e.Ma),e.Ma.remove(),e.Ma=void 0):((o||i&&!(this instanceof Th))&&(t.rb.ha=[n.m11,n.m12,n.m21,n.m22,n.dx,n.dy]),Vs(this,t,this.naturalBounds,this.actualBounds),e.Ma?(Ba(t,e.Ma),null!==(i=e.Ma.getAttribute("filter"))&&t.ad.setAttribute("filter",i),e.Ma.replaceWith(t.ad)):e.prepend(t.ad),e.Ma=t.ad),r&&Ba(t,r)),this.$o(t,this.panel,this.actualBounds,e),!0},e.nk=function(t){if(null!==this.background||null!==this.areaBackground)return!0;var e=0!=(256&this.l);return t.clipInsteadOfFill&&(e=!1),!!e},e.rg=function(t){if(t instanceof Th)t:{if(this!==t&&null!==t)for(var e=this.panel;null!==e;){if(e===t){t=!0;break t}e=e.panel}t=!1}else t=!1;return t},e.Ed=function(){if(!this.visible)return!1;var t=this.panel;return null===t||t.Ed()},e.If=function(){for(var t=this instanceof Th?this:this.panel;null!==t&&t.isEnabled;)t=t.panel;return null===t},e.no=function(t,e,i,n,o){if(1!==this.Ca&&t.scale(this.Ca),0!==this.Kb){var r=pt.alloc();r.yi(e,i,n,o,oe),t.rotate(this.Kb,r.x,r.y),pt.free(r)}},e.v=function(t){if(!ea(this)){void 0===t&&(t=!1),ia(this,!0),oa(this,!0);var e=this.panel;null===e||t||e.v()}},e.Uj=function(){ea(this)||(ia(this,!0),oa(this,!0))},e.Uk=function(){0!=(2048&this.l)==!1&&(Qs(this,!0),ta(this,!0))},e.Wu=function(){ta(this,!0)},e.N=function(){var t=this.part;null!==t&&t.N()},e.Gj=function(){this.svg=null},e.wi=function(t){this.Me=t,null!==this.svg&&this.svg.remove()},e.Av=function(){},e.zv=function(t){return this.pa=t,qs(this),!0},e.mm=function(t,e){this.pa.x===t&&this.pa.y===e||(this.pa.h(t,e),this.Uk())},e.kq=function(){return 0},e.bind=function(t,e,i,n){var o=null;return(o="string"==typeof t?new Hf(t,e,i,n):t).xd=this,null!==(t=this.ih())&&Wh(t)&&w("Cannot add a Binding to a template that has already been copied: "+o),null===this.localBindings&&(this.localBindings=new $),this.localBindings.add(o),this},e.set=function(t){return Object.assign(this,t),this},e.Du=function(t){return ha(this,t),this},e.apply=function(t){return t(this),this},e.nm=function(t){return nr(this,t),this},e.pz=function(){return this.ih()},e.ih=function(){for(var t=this instanceof Th?this:this.panel;null!==t;){if(null!==t.allBindings)return t;t=t.panel}return null},e.Jv=function(t){return t.xd=this,null===this.animationTriggers&&(this.animationTriggers=new ft),this.animationTriggers.add(t.propertyName,t),this},d.Object.defineProperties(Fs.prototype,{bindingId:{get:function(){return null!==this.A?this.A.zp:-1},set:function(t){this.bindingId!==t&&(null===this.A&&(this.A=new da),this.A.zp=t)}},localBindings:{get:function(){return null!==this.A?this.A.te:null},set:function(t){this.localBindings!==t&&(null===this.A&&(this.A=new da),this.A.te=t)}},srcBindings:{get:function(){return null!==this.A?this.A.wm:null},set:function(t){this.srcBindings!==t&&(null===this.A&&(this.A=new da),this.A.wm=t)}},shadowVisible:{get:function(){return null!==this.A?this.A.Ci:null},set:function(t){var e=this.shadowVisible;e!==t&&(js(this),this.A.Ci=t,this.Uc=!0,this.N(),this.g("shadowVisible",e,t))}},enabledChanged:{get:function(){return null!==this.A?this.A.Hb:null},set:function(t){var e=this.enabledChanged;e!==t&&(js(this),this.A.Hb=t,this.g("enabledChanged",e,t))}},segmentOrientation:{get:function(){return null!==this.Ua?this.Ua.rr:Kc},set:function(t){var e=this.segmentOrientation;e!==t&&(null===this.Ua&&(this.Ua=new fa),this.Ua.rr=t,this.v(),this.g("segmentOrientation",e,t),t===Kc&&(this.angle=0))}},segmentIndex:{get:function(){return null!==this.Ua?this.Ua.u:-1/0},set:function(t){t=Math.round(t);var e=this.segmentIndex;e!==t&&(null===this.Ua&&(this.Ua=new fa),this.Ua.u=t,this.v(),this.g("segmentIndex",e,t))}},segmentFraction:{get:function(){return null!==this.Ua?this.Ua.o:0},set:function(t){isNaN(t)||0>t?t=0:1<t&&(t=1);var e=this.segmentFraction;e!==t&&(null===this.Ua&&(this.Ua=new fa),this.Ua.o=t,this.v(),this.g("segmentFraction",e,t))}},segmentOffset:{get:function(){return null!==this.Ua?this.Ua.F:it},set:function(t){var e=this.segmentOffset;e.D(t)||(t=t.J(),null===this.Ua&&(this.Ua=new fa),this.Ua.F=t,this.v(),this.g("segmentOffset",e,t))}},stretch:{get:function(){return null!==this.A?this.A.hg:ms},set:function(t){var e=this.stretch;e!==t&&(js(this),this.A.hg=t,this.v(),this.g("stretch",e,t))}},name:{get:function(){return null!==this.A?this.A.xa:""},set:function(t){var e=this.name;e!==t&&(js(this),this.A.xa=t,null!==this.part&&(this.part.Rh=null),this.g("name",e,t))}},opacity:{get:function(){return this.pb},set:function(t){var e=this.pb;e!==t&&((0>t||1<t)&&S(t,"0 <= value <= 1",Fs,"opacity"),this.pb=t,this.g("opacity",e,t),t=this.diagram,e=this.part,null!==t&&null!==e&&t.N(Lu(e,e.actualBounds)))}},filter:{get:function(){return this.bn},set:function(t){var e=this.bn;e!==t&&(this.bn=t,this.Uc=!0,this.g("filter",e,t),t=this.diagram,e=this.part,null!==t&&null!==e&&t.N(Lu(e,e.actualBounds)))}},visible:{get:function(){return 0!=(1&this.l)},set:function(t){var e=0!=(1&this.l);e!==t&&(this.l^=1,this.g("visible",e,t),null!==(e=this.panel)?e.v():this.Dd()&&this.Zb(t),this.N(),sa(this))}},pickable:{get:function(){return 0!=(2&this.l)},set:function(t){var e=0!=(2&this.l);e!==t&&(this.l^=2,this.g("pickable",e,t))}},fromLinkableDuplicates:{get:function(){return 0!=(4&this.l)},set:function(t){var e=0!=(4&this.l);e!==t&&(this.l^=4,this.g("fromLinkableDuplicates",e,t))}},fromLinkableSelfNode:{get:function(){return 0!=(8&this.l)},set:function(t){var e=0!=(8&this.l);e!==t&&(this.l^=8,this.g("fromLinkableSelfNode",e,t))}},toLinkableDuplicates:{get:function(){return 0!=(16&this.l)},set:function(t){var e=0!=(16&this.l);e!==t&&(this.l^=16,this.g("toLinkableDuplicates",e,t))}},toLinkableSelfNode:{get:function(){return 0!=(32&this.l)},set:function(t){var e=0!=(32&this.l);e!==t&&(this.l^=32,this.g("toLinkableSelfNode",e,t))}},isPanelMain:{get:function(){return 0!=(64&this.l)},set:function(t){var e=0!=(64&this.l);e!==t&&(this.l^=64,this.v(),this.g("isPanelMain",e,t))}},isActionable:{get:function(){return 0!=(128&this.l)},set:function(t){var e=0!=(128&this.l);e!==t&&(this.l^=128,this.g("isActionable",e,t))}},areaBackground:{get:function(){return null!==this.A?this.A.gd:null},set:function(t){var e=this.areaBackground;e!==t&&(null!==t&&Ka(t,"GraphObject.areaBackground"),t instanceof Oa&&t.freeze(),js(this),this.A.gd=t,this.N(),this.g("areaBackground",e,t))}},background:{get:function(){return this.Ma},set:function(t){var e=this.Ma;e!==t&&(null!==t&&Ka(t,"GraphObject.background"),t instanceof Oa&&t.freeze(),this.Ma=t,this.N(),this.g("background",e,t))}},part:{get:function(){if(this.Dd())return this;if(null!==this.Ng)return this.Ng;var t;for(t=this.panel;t;){if(t instanceof ku)return this.Ng=t;t=t.panel}return null}},svg:{get:function(){return this.V},set:function(t){this.V=t}},panel:{get:function(){return this.Me}},layer:{get:function(){var t=this.part;return null!==t?t.layer:null}},diagram:{get:function(){var t=this.part;return null!==t?t.diagram:null}},position:{get:function(){return this.pa},set:function(t){var e=t.x,i=t.y,n=this.pa,o=n.x;n=n.y,(o===e||isNaN(o)&&isNaN(e))&&(n===i||isNaN(n)&&isNaN(i))?this.Av():(t=t.copy(),this.zv(t,o,n)&&this.g("position",new pt(o,n),t))}},actualBounds:{get:function(){return this.Ib}},scale:{get:function(){return this.Ca},set:function(t){var e=this.Ca;e!==t&&(0>=t&&w("GraphObject.scale for "+this+" must be greater than zero, not: "+t),this.Ca=t,this.v(),this.g("scale",e,t))}},angle:{get:function(){return this.Kb},set:function(t){var e=this.Kb;e!==t&&(0>(t%=360)&&(t+=360),e!==t&&(this.Kb=t,sa(this),this.v(),this.g("angle",e,t)))}},desiredSize:{get:function(){return this.jd},set:function(t){var e=t.width,i=t.height,n=this.jd,o=n.width,r=n.height;(o===e||isNaN(o)&&isNaN(e))&&(r===i||isNaN(r)&&isNaN(i))||(this.jd=t=t.J(),this.v(),this instanceof pl&&this.qc(),this.g("desiredSize",n,t),Js(this)&&(null!==(t=this.part)&&(Es(this,t,"width"),Es(this,t,"height"))))}},width:{get:function(){return this.jd.width},set:function(t){var e=this.jd.width;e===t||isNaN(e)&&isNaN(t)||(e=this.jd,this.jd=t=new At(t,this.jd.height).freeze(),this.v(),this instanceof pl&&this.qc(),this.g("desiredSize",e,t),Js(this)&&(null!==(t=this.part)&&Es(this,t,"width")))}},height:{get:function(){return this.jd.height},set:function(t){var e=this.jd.height;e===t||isNaN(e)&&isNaN(t)||(e=this.jd,this.jd=t=new At(this.jd.width,t).freeze(),this.v(),this instanceof pl&&this.qc(),this.g("desiredSize",e,t),Js(this)&&(null!==(t=this.part)&&Es(this,t,"height")))}},minSize:{get:function(){return null!==this.A?this.A.u:kt},set:function(t){var e=this.minSize;e.D(t)||(t=t.copy(),isNaN(t.width)&&(t.width=0),isNaN(t.height)&&(t.height=0),t.freeze(),js(this),this.A.u=t,this.v(),this.g("minSize",e,t))}},maxSize:{get:function(){return null!==this.A?this.A.o:Tt},set:function(t){var e=this.maxSize;e.D(t)||(t=t.copy(),isNaN(t.width)&&(t.width=1/0),isNaN(t.height)&&(t.height=1/0),t.freeze(),js(this),this.A.o=t,this.v(),this.g("maxSize",e,t))}},measuredBounds:{get:function(){return this.uc}},naturalBounds:{get:function(){return this.dc}},margin:{get:function(){return this.Kg},set:function(t){"number"==typeof t&&(t=new Kt(t));var e=this.Kg;e.D(t)||(this.Kg=t=t.J(),this.v(),this.g("margin",e,t))}},transform:{get:function(){return 0!=(2048&this.l)==!0&&Us(this),this.Ab}},oe:{get:function(){return 0!=(4096&this.l)==!0&&Us(this),this.wh}},animationTriggers:{get:function(){return null!==this.A?this.A.hb:null},set:function(t){this.animationTriggers!==t&&(js(this),this.A.hb=t)}},reshapingBehavior:{get:function(){return null!==this.A?this.A.Pf:ds},set:function(t){this.reshapingBehavior!==t&&(js(this),this.A.Pf=t)}},alignment:{get:function(){return this.Jb},set:function(t){var e=this.Jb;e.D(t)||(t.Mc()&&!t.Xb()&&w("GraphObject.alignment for "+this+" must be a real Spot or Spot.Default, not: "+t),this.Jb=t=t.J(),qs(this),this.g("alignment",e,t))}},column:{get:function(){return this.Ag},set:function(t){t=Math.round(t);var e=this.Ag;e!==t&&(0>t&&S(t,">= 0",Fs,"column"),this.Ag=t,this.v(),this.g("column",e,t),null!==this.svg&&this.svg.remove())}},columnSpan:{get:function(){return null!==this.A?this.A.ob:1},set:function(t){t=Math.round(t);var e=this.columnSpan;e!==t&&(1>t&&S(t,">= 1",Fs,"columnSpan"),js(this),this.A.ob=t,this.v(),this.g("columnSpan",e,t))}},row:{get:function(){return this.io},set:function(t){t=Math.round(t);var e=this.io;e!==t&&(0>t&&S(t,">= 0",Fs,"row"),this.io=t,this.v(),this.g("row",e,t),null!==this.svg&&this.svg.remove())}},rowSpan:{get:function(){return null!==this.A?this.A.Bi:1},set:function(t){t=Math.round(t);var e=this.rowSpan;e!==t&&(1>t&&S(t,">= 1",Fs,"rowSpan"),js(this),this.A.Bi=t,this.v(),this.g("rowSpan",e,t))}},spanAllocation:{get:function(){return null!==this.A?this.A.Di:null},set:function(t){var e=this.spanAllocation;e!==t&&(js(this),this.A.Di=t,this.v(),this.g("spanAllocation",e,t))}},alignmentFocus:{get:function(){return this.sk},set:function(t){var e=this.sk;e.D(t)||(this.sk=t=t.J(),this.v(),this.g("alignmentFocus",e,t))}},portId:{get:function(){return this.Yn},set:function(t){var e=this.Yn;if(e!==t){var i=this.part;null===i||i instanceof _u||w("Cannot set portID on a Link: "+t),null!==e&&null!==i&&ac(i,this),this.Yn=t,null!==t&&null!==i&&(i.Te=!0,sc(i,this)),this.g("portId",e,t)}}},toSpot:{get:function(){return null!==this.ba?this.ba.yj:Qt},set:function(t){var e=this.toSpot;e.D(t)||(t=t.J(),this.Xc(),this.ba.yj=t,this.g("toSpot",e,t),ra(this))}},toEndSegmentLength:{get:function(){return null!==this.ba?this.ba.wj:10},set:function(t){var e=this.toEndSegmentLength;e!==t&&(0>t&&S(t,">= 0",Fs,"toEndSegmentLength"),this.Xc(),this.ba.wj=t,this.g("toEndSegmentLength",e,t),ra(this))}},toShortLength:{get:function(){return null!==this.ba?this.ba.xj:0},set:function(t){var e=this.toShortLength;e!==t&&(this.Xc(),this.ba.xj=t,this.g("toShortLength",e,t),ra(this))}},toLinkable:{get:function(){return null!==this.ba?this.ba.Tr:null},set:function(t){var e=this.toLinkable;e!==t&&(this.Xc(),this.ba.Tr=t,this.g("toLinkable",e,t))}},toMaxLinks:{get:function(){return null!==this.ba?this.ba.Ur:1/0},set:function(t){var e=this.toMaxLinks;e!==t&&(0>t&&S(t,">= 0",Fs,"toMaxLinks"),this.Xc(),this.ba.Ur=t,this.g("toMaxLinks",e,t))}},fromSpot:{get:function(){return null!==this.ba?this.ba.Xi:Qt},set:function(t){var e=this.fromSpot;e.D(t)||(t=t.J(),this.Xc(),this.ba.Xi=t,this.g("fromSpot",e,t),ra(this))}},fromEndSegmentLength:{get:function(){return null!==this.ba?this.ba.Vi:10},set:function(t){var e=this.fromEndSegmentLength;e!==t&&(0>t&&S(t,">= 0",Fs,"fromEndSegmentLength"),this.Xc(),this.ba.Vi=t,this.g("fromEndSegmentLength",e,t),ra(this))}},fromShortLength:{get:function(){return null!==this.ba?this.ba.Wi:0},set:function(t){var e=this.fromShortLength;e!==t&&(this.Xc(),this.ba.Wi=t,this.g("fromShortLength",e,t),ra(this))}},fromLinkable:{get:function(){return null!==this.ba?this.ba.hq:null},set:function(t){var e=this.fromLinkable;e!==t&&(this.Xc(),this.ba.hq=t,this.g("fromLinkable",e,t))}},fromMaxLinks:{get:function(){return null!==this.ba?this.ba.iq:1/0},set:function(t){var e=this.fromMaxLinks;e!==t&&(0>t&&S(t,">= 0",Fs,"fromMaxLinks"),this.Xc(),this.ba.iq=t,this.g("fromMaxLinks",e,t))}},cursor:{get:function(){return null!==this.A?this.A.j:""},set:function(t){var e=this.cursor;e!==t&&(js(this),this.A.j=t,this.g("cursor",e,t))}},click:{get:function(){return null!==this.A?this.A.zh:null},set:function(t){var e=this.click;e!==t&&(js(this),this.A.zh=t,this.g("click",e,t))}},doubleClick:{get:function(){return null!==this.A?this.A.Fh:null},set:function(t){var e=this.doubleClick;e!==t&&(js(this),this.A.Fh=t,this.g("doubleClick",e,t))}},contextClick:{get:function(){return null!==this.A?this.A.Bh:null},set:function(t){var e=this.contextClick;e!==t&&(js(this),this.A.Bh=t,this.g("contextClick",e,t))}},mouseEnter:{get:function(){return null!==this.A?this.A.Mh:null},set:function(t){var e=this.mouseEnter;e!==t&&(js(this),this.A.Mh=t,this.g("mouseEnter",e,t))}},mouseLeave:{get:function(){return null!==this.A?this.A.Ph:null},set:function(t){var e=this.mouseLeave;e!==t&&(js(this),this.A.Ph=t,this.g("mouseLeave",e,t))}},mouseOver:{get:function(){return null!==this.A?this.A.Qh:null},set:function(t){var e=this.mouseOver;e!==t&&(js(this),this.A.Qh=t,this.g("mouseOver",e,t))}},mouseHover:{get:function(){return null!==this.A?this.A.Oh:null},set:function(t){var e=this.mouseHover;e!==t&&(js(this),this.A.Oh=t,this.g("mouseHover",e,t))}},mouseHold:{get:function(){return null!==this.A?this.A.Nh:null},set:function(t){var e=this.mouseHold;e!==t&&(js(this),this.A.Nh=t,this.g("mouseHold",e,t))}},mouseDragEnter:{get:function(){return null!==this.A?this.A.Of:null},set:function(t){var e=this.mouseDragEnter;e!==t&&(js(this),this.A.Of=t,this.g("mouseDragEnter",e,t))}},mouseDragLeave:{get:function(){return null!==this.A?this.A.Xd:null},set:function(t){var e=this.mouseDragLeave;e!==t&&(js(this),this.A.Xd=t,this.g("mouseDragLeave",e,t))}},mouseDrop:{get:function(){return null!==this.A?this.A.Lh:null},set:function(t){var e=this.mouseDrop;e!==t&&(js(this),this.A.Lh=t,this.g("mouseDrop",e,t))}},actionDown:{get:function(){return null!==this.A?this.A.V:null},set:function(t){var e=this.actionDown;e!==t&&(js(this),this.A.V=t,this.g("actionDown",e,t))}},actionMove:{get:function(){return null!==this.A?this.A.ia:null},set:function(t){var e=this.actionMove;e!==t&&(js(this),this.A.ia=t,this.g("actionMove",e,t))}},actionUp:{get:function(){return null!==this.A?this.A.Ha:null},set:function(t){var e=this.actionUp;e!==t&&(js(this),this.A.Ha=t,this.g("actionUp",e,t))}},actionCancel:{get:function(){return null!==this.A?this.A.F:null},set:function(t){var e=this.actionCancel;e!==t&&(js(this),this.A.F=t,this.g("actionCancel",e,t))}},toolTip:{get:function(){return null!==this.A?this.A.$h:null},set:function(t){var e=this.toolTip;e!==t&&(js(this),this.A.$h=t,this.g("toolTip",e,t))}},contextMenu:{get:function(){return null!==this.A?this.A.Ch:null},set:function(t){var e=this.contextMenu;e!==t&&(js(this),this.A.Ch=t,this.g("contextMenu",e,t))}}}),Fs.prototype.trigger=Fs.prototype.Jv,Fs.prototype.findBindingPanel=Fs.prototype.ih,Fs.prototype.findTemplateBinder=Fs.prototype.pz,Fs.prototype.setProperties=Fs.prototype.nm,Fs.prototype.apply=Fs.prototype.apply,Fs.prototype.attach=Fs.prototype.Du,Fs.prototype.set=Fs.prototype.set,Fs.prototype.isEnabledObject=Fs.prototype.If,Fs.prototype.isVisibleObject=Fs.prototype.Ed,Fs.prototype.isContainedBy=Fs.prototype.rg,Fs.prototype.getNearestIntersectionPoint=Fs.prototype.rs,Fs.prototype.getLocalPoint=Fs.prototype.qs,Fs.prototype.getDocumentScale=Fs.prototype.Df,Fs.prototype.getDocumentAngle=Fs.prototype.li,Fs.prototype.getDocumentBounds=Fs.prototype.mi,Fs.prototype.getDocumentPoint=Fs.prototype.ga,Fs.prototype.intersectsRect=Fs.prototype.Yc,Fs.prototype.containedInRect=Fs.prototype.fh,Fs.prototype.containsRect=Fs.prototype.Re,Fs.prototype.containsPoint=Fs.prototype.ca,Fs.prototype.raiseChanged=Fs.prototype.g,Fs.prototype.raiseChangedEvent=Fs.prototype.cb,Fs.prototype.addCopyProperty=Fs.prototype.Vw;var ca=null;function da(){this.nc=!1,this.xa="",this.zp=-1,this.nb=this.wm=this.te=null,this.j="",this.hb=this.Di=this.Hb=this.Ch=this.$h=this.F=this.Ha=this.ia=this.V=this.Lh=this.Xd=this.Of=this.Nh=this.Oh=this.Qh=this.Ph=this.Mh=this.Bh=this.Fh=this.zh=null,this.u=kt,this.o=Tt,this.hg=ms,this.ob=this.Bi=1,this.Pf=ds,this.Pc=this.Ci=this.gd=null,this.Oc="category"}function fa(){this.u=-1/0,this.o=0,this.F=it,this.rr=Kc,this.j=this.V="None"}function pa(){this.yj=this.Xi=Me,this.xj=this.Wi=this.wj=this.Vi=NaN,this.Tr=this.hq=null,this.Ur=this.iq=1/0}function ga(){this.ha=[1,0,0,1,0,0]}function ma(t){this.type=t,this.r2=this.y2=this.x2=this.r1=this.y1=this.x1=0,this.gx=[],this.pattern=null}function ya(t,e,i){this.ownerDocument=t=void 0===e?m.document:e,this.cA="http://www.w3.org/2000/svg",void 0!==t&&(this.Oa=this.Ud("svg",{width:"1px",height:"1px",viewBox:"0 0 1 1"}),this.style.display="block",this.style.letterSpacing="normal",this.style.wordSpacing="normal",this.Oa.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns","http://www.w3.org/2000/svg"),this.Oa.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns:xlink","http://www.w3.org/1999/xlink")),this.hs=null,this.context=new va(this,i)}function va(t,e){this.Gv=t,this.svg=t.Oa,this.stack=[],this.nh=[],this.fillStyle="#000000",this.font="10px sans-serif",this.globalAlpha=1,this.lineCap="butt",this.lineDashOffset=0,this.lineJoin="miter",this.lineWidth=1,this.miterLimit=10,this.shadowBlur=0,this.shadowColor="rgba(0, 0, 0, 0)",this.shadowOffsetY=this.shadowOffsetX=0,this.Il=!1,this.strokeStyle="#000000",this.textAlign="start",this.clipInsteadOfFill=!1,this.Vg=this.Br=this.Ar=0,this.yd=this.ad=null,this.path=[],this.Yl={},this.Ct=!1,this.Yg=null,this.uj=0,this.rb=new ga,this.j=Na(this),this.Nj=Na(this,"gojs-diagram"),this.Hl=this.ti=null;var i=at++,n=this.Ud("clipPath",{id:"mainClip"+i});n.appendChild(this.Ud("rect",{x:0,y:0,width:t.width,height:t.height})),this.ww=n,this.svg.appendChild(this.j),this.j.appendChild(this.Nj),this.svg.appendChild(n),this.j.setAttributeNS(null,"clip-path","url(#mainClip"+i+")"),this.eA={},this.isTemporary=!!e,this.filter="",this.bk=null}function xa(t,e,i,n,o,r,s){void 0===t.Nj?Ta(t,e,i,n,o,r,s):t.Nj.setAttribute("transform","matrix("+e+", "+i+", "+n+", "+o+", "+r+", "+s+")")}function ba(t,e,i,n,o,r,s,a,h){n=a/n,o=h/o,0===r&&0===s||t.rb.translate(r,s),1===n&&1===o||t.rb.scale(n,o),0===e&&0===i||t.rb.translate(-e,-i)}function wa(t){return"matrix("+(t=t.rb.ha)[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+")"}function ka(t,e,i,n){"fill"===e?Sa(t,i):"stroke"===e&&Ca(t,i),null!==n&&(t=n.ha,i.transform="matrix("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+")")}function Sa(t,e){t.fillStyle instanceof ma?e.fill=Pa(t,t.fillStyle,!0):/^rgba\(/.test(t.fillStyle)?(t=/^\s*rgba\s*\(([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*([^,\s]+)\)\s*$/i.exec(t.fillStyle),e.fill="rgb("+t[1]+","+t[2]+","+t[3]+")",e["fill-opacity"]=t[4]):e.fill=t.fillStyle}function Ma(t,e,i){i=i?"fill":"stroke",t.fillStyle instanceof ma?e.setAttributeNS(null,"fill",Pa(t,t.fillStyle,!0)):/^rgba\(/.test(t.fillStyle)?(t=/^\s*rgba\s*\(([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*([^,\s]+)\)\s*$/i.exec(t.fillStyle),e.setAttributeNS(null,i,"rgb("+t[1]+","+t[2]+","+t[3]+")"),e.setAttributeNS(null,i+"-opacity",t[4])):e.setAttributeNS(null,i,t.fillStyle)}function Ca(t,e){if(t.strokeStyle instanceof ma)e.stroke=Pa(t,t.strokeStyle,!1);else if(/^rgba\(/.test(t.strokeStyle)){var i=/^\s*rgba\s*\(([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*([^,\s]+)\)\s*$/i.exec(t.strokeStyle);e.stroke="rgb("+i[1]+","+i[2]+","+i[3]+")",e["stroke-opacity"]=i[4]}else e.stroke=t.strokeStyle;e["stroke-width"]=t.lineWidth,e["stroke-linecap"]=t.lineCap,e["stroke-linejoin"]=t.lineJoin,e["stroke-miterlimit"]=t.miterLimit,t.Ct&&(e["stroke-dasharray"]=t.Yg.toString(),e["stroke-dashoffset"]=t.uj)}function Pa(t,e,i){var n="";if(null!==(n=null!==t.Hl?t.Hl.getAttribute(i?"fill":"stroke"):null)&&-1!==n.indexOf("GRAD")?(n=n.split("#")[1].slice(0,-1),null!==(i=t.svg.getElementById(n))&&i.remove()):n="GRAD"+at++,"linear"===e.type)i=t.Ud("linearGradient",{x1:e.x1,x2:e.x2,y1:e.y1,y2:e.y2,id:n,gradientUnits:"userSpaceOnUse"});else{if("radial"!==e.type)throw Error("invalid gradient");i=t.Ud("radialGradient",{x1:e.x1,x2:e.x2,y1:e.y1,y2:e.y2,r1:e.r1,r2:e.r2,id:n})}var o=e.gx;e=o.length;for(var r=[],s=0;s<e;s++){var a=o[s],h=a.color;a={offset:a.offset,"stop-color":h},/^rgba\(/.test(h)&&(h=/^\s*rgba\s*\(([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*([^,\s]+)\)\s*$/i.exec(h),a["stop-color"]="rgb("+h[1]+","+h[2]+","+h[3]+")",a["stop-opacity"]=h[4]),r.push(a)}for(r.sort((function(t,e){return t.offset>e.offset?1:-1})),o=0;o<e;o++)i.appendChild(t.Ud("stop",r[o]));return t.svg.appendChild(i),"url(#"+n+")"}function Ta(t,e,i,n,o,r,s){var a=new ga;a.ha=[e,i,n,o,r,s],ka(t,"g",e={},a),a=t.addElement("g",e),t.nh.push(a)}function Na(t,e){var i={};return e&&(i.class=e),e=t.addElement("g",i),t.nh.push(e),e}function La(t){t.Il=!1,t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowBlur=0}function Aa(t){t.Il=!0,t.shadowOffsetX=t.Ar,t.shadowOffsetY=t.Br,t.shadowBlur=t.Vg}function Ba(t,e){null!==(e=e.getAttribute("fill"))&&(1!==(e=e.split("#")).length&&(null!==(e=t.svg.getElementById(e[1].slice(0,-1)))&&1===t.svg.innerHTML.match(new RegExp(e.id,"g")).length&&e.remove()))}function Da(t,e,i,n){this.ownerDocument=e=void 0===e?m.document:e,this.hs=null,(e=e.createElement("canvas")).tabIndex=0,this.Oa=e,this.context=new Fa(e,i,n),e.H=t}function Fa(t,e,i){this.Z=t.getContext?t.getContext("2d",e):null,null===this.Z&&w("Browser does not support HTML Canvas Element"),this.ct=this.et=this.dt="",this.Hm=!1,this.Vg=this.Br=this.Ar=0,this.Il=!1,this.El=new Ge,this.isTemporary=!!i}Fs.className="GraphObject",ca=new ft,la("Button",(function(){function t(t,e){return null!==t.diagram.ic(t.documentPoint,(function(t){for(;null!==t.panel&&!t.isActionable;)t=t.panel;return t}),(function(t){return t===e}))}var e=aa(Th,Th.Auto,{isActionable:!0,enabledChanged:function(t,e){if(t instanceof Th){var i=t.fb("ButtonBorder");null!==i&&(i.fill=e?t._buttonFillNormal:t._buttonFillDisabled)}},cursor:"pointer",_buttonFillNormal:"#F5F5F5",_buttonStrokeNormal:"#BDBDBD",_buttonFillOver:"#E0E0E0",_buttonStrokeOver:"#9E9E9E",_buttonFillPressed:"#BDBDBD",_buttonStrokePressed:"#9E9E9E",_buttonFillDisabled:"#E5E5E5"},aa(pl,{name:"ButtonBorder",figure:"RoundedRectangle",spot1:new Oe(0,0,2.76142374915397,2.761423749153969),spot2:new Oe(1,1,-2.76142374915397,-2.761423749153969),parameter1:2,parameter2:2,fill:"#F5F5F5",stroke:"#BDBDBD"}));return e.mouseEnter=function(t,e){if(e.If()&&e instanceof Th&&(t=e.fb("ButtonBorder"))instanceof pl){var i=e._buttonFillOver;e._buttonFillNormal=t.fill,t.fill=i,i=e._buttonStrokeOver,e._buttonStrokeNormal=t.stroke,t.stroke=i}},e.mouseLeave=function(t,e){e.If()&&e instanceof Th&&((t=e.fb("ButtonBorder"))instanceof pl&&(t.fill=e._buttonFillNormal,t.stroke=e._buttonStrokeNormal))},e.actionDown=function(t,e){if(e.If()&&e instanceof Th&&null!==e._buttonFillPressed&&0===t.button){var i=e.fb("ButtonBorder");if(i instanceof pl){var n=(t=t.diagram).skipsUndoManager;t.skipsUndoManager=!0;var o=e._buttonFillPressed;e._buttonFillOver=i.fill,i.fill=o,o=e._buttonStrokePressed,e._buttonStrokeOver=i.stroke,i.stroke=o,t.skipsUndoManager=n}}},e.actionUp=function(e,i){if(i.If()&&i instanceof Th&&null!==i._buttonFillPressed&&0===e.button){var n=i.fb("ButtonBorder");if(n instanceof pl){var o=e.diagram,r=o.skipsUndoManager;o.skipsUndoManager=!0,t(e,i)?(n.fill=i._buttonFillOver,n.stroke=i._buttonStrokeOver):(n.fill=i._buttonFillNormal,n.stroke=i._buttonStrokeNormal),o.skipsUndoManager=r}}},e.actionCancel=function(e,i){if(i.If()&&i instanceof Th&&null!==i._buttonFillPressed){var n=i.fb("ButtonBorder");if(n instanceof pl){var o=e.diagram,r=o.skipsUndoManager;o.skipsUndoManager=!0,t(e,i)?(n.fill=i._buttonFillOver,n.stroke=i._buttonStrokeOver):(n.fill=i._buttonFillNormal,n.stroke=i._buttonStrokeNormal),o.skipsUndoManager=r}}},e.actionMove=function(e,i){if(i.If()&&i instanceof Th&&null!==i._buttonFillPressed){var n=e.diagram;if(0===n.firstInput.button&&(n.currentTool.standardMouseOver(),t(e,i)&&(e=i.fb("ButtonBorder"))instanceof pl)){var o=n.skipsUndoManager;n.skipsUndoManager=!0;var r=i._buttonFillPressed;e.fill!==r&&(e.fill=r),r=i._buttonStrokePressed,e.stroke!==r&&(e.stroke=r),n.skipsUndoManager=o}}},e})),la("TreeExpanderButton",(function(){var t=aa("Button",{_treeExpandedFigure:"MinusLine",_treeCollapsedFigure:"PlusLine"},aa(pl,{name:"ButtonIcon",figure:"MinusLine",stroke:"#424242",strokeWidth:2,desiredSize:Ct},new Hf("figure","isTreeExpanded",(function(t,e){return e=e.panel,t?e._treeExpandedFigure:e._treeCollapsedFigure})).cp()),{visible:!1},new Hf("visible","isTreeLeaf",(function(t){return!t})).cp());return t.click=function(t,e){if((e=e.part)instanceof Wu&&(e=e.adornedPart),e instanceof _u){var i=e.diagram;if(null!==i){if(i=i.commandHandler,e.isTreeExpanded){if(!i.canCollapseTree(e))return}else if(!i.canExpandTree(e))return;t.handled=!0,e.isTreeExpanded?i.collapseTree(e):i.expandTree(e)}}},t})),la("SubGraphExpanderButton",(function(){var t=aa("Button",{_subGraphExpandedFigure:"MinusLine",_subGraphCollapsedFigure:"PlusLine"},aa(pl,{name:"ButtonIcon",figure:"MinusLine",stroke:"#424242",strokeWidth:2,desiredSize:Ct},new Hf("figure","isSubGraphExpanded",(function(t,e){return e=e.panel,t?e._subGraphExpandedFigure:e._subGraphCollapsedFigure})).cp()));return t.click=function(t,e){if((e=e.part)instanceof Wu&&(e=e.adornedPart),e instanceof gc){var i=e.diagram;if(null!==i){if(i=i.commandHandler,e.isSubGraphExpanded){if(!i.canCollapseSubGraph(e))return}else if(!i.canExpandSubGraph(e))return;t.handled=!0,e.isSubGraphExpanded?i.collapseSubGraph(e):i.expandSubGraph(e)}}},t})),la("ToolTip",(function(){return aa(Wu,Th.Auto,{isShadowed:!0,shadowColor:"rgba(0, 0, 0, .4)",shadowOffset:new pt(0,3),shadowBlur:5},aa(pl,{name:"Border",figure:"RoundedRectangle",parameter1:1,parameter2:1,fill:"#F5F5F5",stroke:"#F0F0F0",spot1:new Oe(0,0,4,6),spot2:new Oe(1,1,-4,-4)}))})),la("ContextMenu",(function(){return aa(Wu,Th.Vertical,{background:"#F5F5F5",isShadowed:!0,shadowColor:"rgba(0, 0, 0, .4)",shadowOffset:new pt(0,3),shadowBlur:5},new Hf("background","",(function(t){return null!==t.adornedPart&&null!==t.placeholder?null:"#F5F5F5"})))})),la("ContextMenuButton",(function(){var t=aa("Button");t.stretch=ps;var e=t.fb("ButtonBorder");return e instanceof pl&&(e.figure="Rectangle",e.strokeWidth=0,e.spot1=new Oe(0,0,2,3),e.spot2=new Oe(1,1,-2,-2)),t})),la("PanelExpanderButton",(function(t){var e=ua(t,"COLLAPSIBLE"),i=aa("Button",{_buttonExpandedFigure:"M0 0 M0 6 L4 2 8 6 M8 8",_buttonCollapsedFigure:"M0 0 M0 2 L4 6 8 2 M8 8",_buttonFillNormal:"rgba(0, 0, 0, 0)",_buttonStrokeNormal:null,_buttonFillOver:"rgba(0, 0, 0, .2)",_buttonStrokeOver:null,_buttonFillPressed:"rgba(0, 0, 0, .4)",_buttonStrokePressed:null},aa(pl,{name:"ButtonIcon",strokeWidth:2},new Hf("geometryString","visible",(function(t){return t?i._buttonExpandedFigure:i._buttonCollapsedFigure})).cp(e)));return(t=i.fb("ButtonBorder"))instanceof pl&&(t.stroke=null,t.fill="rgba(0, 0, 0, 0)"),i.click=function(t,i){var n=i.diagram;if(null!==n&&!n.isReadOnly){var o=i.ih();null===o&&(o=i.part),null!==o&&(null!==(i=o.fb(e))&&(t.handled=!0,n.Ea("Collapse/Expand Panel"),i.visible=!i.visible,n.eb("Collapse/Expand Panel")))}},i})),la("CheckBoxButton",(function(t){var e=ua(t);return(t=aa("Button",{desiredSize:new At(14,14)},aa(pl,{name:"ButtonIcon",geometryString:"M0 0 M0 8.85 L4.9 13.75 16.2 2.45 M16.2 16.2",strokeWidth:2,stretch:cs,geometryStretch:fs,visible:!1},""!==e?new Hf("visible",e).Kx():[]))).click=function(t,i){if(i instanceof Th){var n=t.diagram;if(!(null===n||n.isReadOnly||""!==e&&n.model.isReadOnly)){t.handled=!0;var o=i.fb("ButtonIcon");n.Ea("checkbox"),o.visible=!o.visible,"function"==typeof i._doClick&&i._doClick(t,i),n.eb("checkbox")}}},t})),la("CheckBox",(function(t){t=aa("CheckBoxButton",t=ua(t),{name:"Button",isActionable:!1,margin:new Kt(0,1,0,0)});var e=aa(Th,"Horizontal",t,{isActionable:!0,cursor:t.cursor,margin:new Kt(1),_buttonFillNormal:t._buttonFillNormal,_buttonStrokeNormal:t._buttonStrokeNormal,_buttonFillOver:t._buttonFillOver,_buttonStrokeOver:t._buttonStrokeOver,_buttonFillPressed:t._buttonFillPressed,_buttonStrokePressed:t._buttonStrokePressed,_buttonFillDisabled:t._buttonFillDisabled,mouseEnter:t.mouseEnter,mouseLeave:t.mouseLeave,actionDown:t.actionDown,actionUp:t.actionUp,actionCancel:t.actionCancel,actionMove:t.actionMove,click:t.click,_buttonClick:t.click});return t.mouseEnter=null,t.mouseLeave=null,t.actionDown=null,t.actionUp=null,t.actionCancel=null,t.actionMove=null,t.click=null,e})),Fs.None=ds=new V(Fs,"None",0),Fs.Default=ms=new V(Fs,"Default",0),Fs.Vertical=gs=new V(Fs,"Vertical",4),Fs.Horizontal=ps=new V(Fs,"Horizontal",5),Fs.Fill=cs=new V(Fs,"Fill",3),Fs.Uniform=fs=new V(Fs,"Uniform",1),Fs.UniformToFill=ys=new V(Fs,"UniformToFill",2),Fs.FlipVertical=vs=new V(Fs,"FlipVertical",1),Fs.FlipHorizontal=xs=new V(Fs,"FlipHorizontal",2),Fs.FlipBoth=bs=new V(Fs,"FlipBoth",3),Fs.make=aa,Fs.getBuilders=function(){var t,e=new ft;for(t in ca)if(t!==t.toLowerCase()){var i=ca.I(t);"function"==typeof i&&e.add(t,i)}return e.freeze(),e},Fs.defineBuilder=la,Fs.build=function(t,e,i){for(var n=[],o=2;o<arguments.length;++o)n[o-2]=arguments[o];if("function"==typeof(o=ca.I(t))&&(n=o([t].concat(n)))instanceof Fs)return e&&n.set(e),n;w('GraphObject.build invoked object builder "'+t+'", but it did not return an Object')},Fs.takeBuilderArgument=ua,da.prototype.copy=function(){var t=new da;return t.xa=this.xa,t.zp=this.zp,t.te=this.te,t.nb=this.nb,t.j=this.j,t.zh=this.zh,t.Fh=this.Fh,t.Bh=this.Bh,t.Mh=this.Mh,t.Ph=this.Ph,t.Qh=this.Qh,t.Oh=this.Oh,t.Nh=this.Nh,t.Of=this.Of,t.Xd=this.Xd,t.Lh=this.Lh,t.V=this.V,t.ia=this.ia,t.Ha=this.Ha,t.F=this.F,t.$h=this.$h,t.Ch=this.Ch,t.Hb=this.Hb,t.Di=this.Di,t.hb=this.hb,t.u=this.u.J(),t.o=this.o.J(),t.hg=this.hg,t.Bi=this.Bi,t.ob=this.ob,t.Pf=this.Pf,t.gd=this.gd,t.Ci=this.Ci,t.Pc=this.Pc,t.Oc=this.Oc,t},fa.prototype.copy=function(){var t=new fa;return t.u=this.u,t.o=this.o,t.F=this.F.J(),t.rr=this.rr,t.V=this.V,t.j=this.j,t},fa.className="LinkElementSettings",pa.prototype.copy=function(){var t=new pa;return t.Xi=this.Xi.J(),t.yj=this.yj.J(),t.Vi=this.Vi,t.wj=this.wj,t.Wi=this.Wi,t.xj=this.xj,t.hq=this.hq,t.Tr=this.Tr,t.iq=this.iq,t.Ur=this.Ur,t},pa.className="LinkSettings",ga.prototype.copy=function(){var t=new ga;return t.ha[0]=this.ha[0],t.ha[1]=this.ha[1],t.ha[2]=this.ha[2],t.ha[3]=this.ha[3],t.ha[4]=this.ha[4],t.ha[5]=this.ha[5],t},ga.prototype.translate=function(t,e){this.ha[4]+=this.ha[0]*t+this.ha[2]*e,this.ha[5]+=this.ha[1]*t+this.ha[3]*e},ga.prototype.scale=function(t,e){this.ha[0]*=t,this.ha[1]*=t,this.ha[2]*=e,this.ha[3]*=e},ga.prototype.rotate=function(t,e,i){if(360<=t?t-=360:0>t&&(t+=360),0!==t){if(this.translate(e,i),90===t){t=0;var n=1}else 180===t?(t=-1,n=0):270===t?(t=0,n=-1):(n=t*Math.PI/180,t=Math.cos(n),n=Math.sin(n));var o=this.ha[1]*t+this.ha[3]*n,r=this.ha[0]*-n+this.ha[2]*t,s=this.ha[1]*-n+this.ha[3]*t;this.ha[0]=this.ha[0]*t+this.ha[2]*n,this.ha[1]=o,this.ha[2]=r,this.ha[3]=s,this.translate(-e,-i)}},ga.className="STransform",ma.prototype.addColorStop=function(t,e){this.gx.push({offset:t,color:e})},ma.className="SGradient",ya.prototype.resize=function(t,e,i,n){return(this.width!==t||this.height!==e)&&(this.width=t,this.height=e,this.style.width=i+"px",this.style.height=n+"px",this.Oa.setAttributeNS(null,"width",i+"px"),this.Oa.setAttributeNS(null,"height",n+"px"),this.Oa.setAttributeNS(null,"viewBox","0 0 "+i+" "+n),this.context.ww.firstElementChild.setAttributeNS(null,"width",i+"px"),this.context.ww.firstElementChild.setAttributeNS(null,"height",n+"px"),!0)},ya.prototype.Ud=function(t,e,i){if(t=this.ownerDocument.createElementNS(this.cA,t),C(e))for(var n in e)t.setAttributeNS("href"===n?"http://www.w3.org/1999/xlink":"",n,e[n]);return void 0!==i&&(t.textContent=i),t},ya.prototype.getBoundingClientRect=function(){return this.Oa.getBoundingClientRect()},ya.prototype.focus=function(){this.Oa.focus()},ya.prototype.mx=function(){this.ownerDocument=null},d.Object.defineProperties(ya.prototype,{width:{get:function(){return this.Oa.width.baseVal.value},set:function(t){this.Oa.setAttribute("width",t+"px")}},height:{get:function(){return this.Oa.height.baseVal.value},set:function(t){this.Oa.setAttribute("height",t+"px")}},style:{get:function(){return this.Oa.style}}}),ya.className="SVGSurface",(e=va.prototype).arc=function(t,e,i,n,o,r,s,a){var h=2*Math.PI,l=h-1e-6,u=i*Math.cos(n),c=i*Math.sin(n),d=t+u,f=e+c,p=r?0:1;n=r?n-o:o-n,(1e-6<Math.abs(s-d)||1e-6<Math.abs(a-f))&&this.path.push(["L",d,+f]),0>n&&(n=n%h+h),n>l?(this.path.push(["A",i,i,0,1,p,t-u,e-c]),this.path.push(["A",i,i,0,1,p,d,f])):1e-6<n&&this.path.push(["A",i,i,0,+(n>=Math.PI),p,t+i*Math.cos(o),e+i*Math.sin(o)])},e.beginPath=function(){this.path=[],this.Yl={stroke:"none",fill:"none"}},e.Se=function(t){this.addPath(this.path,this.rb,t||0)},e.bezierCurveTo=function(t,e,i,n,o,r){this.path.push(["C",t,e,i,n,o,r])},e.clearRect=function(){},e.clip=function(){this.Yl.clipPath=!0},e.closePath=function(){this.path.push(["z"])},e.createLinearGradient=function(t,e,i,n){var o=new ma("linear");return o.x1=t,o.y1=e,o.x2=i,o.y2=n,o},e.createPattern=function(t){var e="";t instanceof HTMLCanvasElement&&(e=t.toDataURL()),t instanceof HTMLImageElement&&(e=t.getAttribute("src"));var i=this.eA;if(i[e])return"url(#"+i[e]+")";var n="PATTERN"+at++,o={x:0,y:0,width:t.width,height:t.height,href:e};return(t=this.Ud("pattern",{width:t.width,height:t.height,id:n,patternUnits:"userSpaceOnUse"})).appendChild(this.Ud(rs,o)),this.svg.appendChild(t),i[e]=n,"url(#"+n+")"},e.createRadialGradient=function(t,e,i,n,o,r){var s=new ma("radial");return s.x1=t,s.y1=e,s.r1=i,s.x2=n,s.y2=o,s.r2=r,s},e.drawImage=function(t,e,i,n,o,r,s,a,h){var l="";t instanceof HTMLCanvasElement&&(l=t.toDataURL()),t instanceof HTMLImageElement&&(l=t.getAttribute("src"));var u=t instanceof HTMLImageElement?t.naturalWidth:t.width;t=t instanceof HTMLImageElement?t.naturalHeight:t.height,void 0===n&&(r=e,s=i,a=n=u,h=o=t),ba(this,e,i,n=n||0,o=o||0,r||0,s||0,a=a||0,h=h||0),r={x:0,y:0,width:u||n,height:t||o,href:l},Ye.$(n,a)&&Ye.$(o,h)?-1===l.toLowerCase().indexOf(".svg")&&-1===l.toLowerCase().indexOf("data:image/svg")&&(r.preserveAspectRatio="xMidYMid slice"):r.preserveAspectRatio="none",0===e&&0===i&&n===u&&o===t||(n+=e,o+=i,r["clip-path"]="path('M "+e+","+i+" L "+n+" "+i+" L "+n+" "+o+" L "+e+" "+o+" z')"),ka(this,rs,r,this.rb),this.addElement(rs,r)},e.fill=function(t){t&&(this.Yl["fill-rule"]="evenodd"),Sa(this,this.Yl)},e.ng=function(t,e){this.clipInsteadOfFill?this.clip():this.fill(e)},e.fillRect=function(t,e,i,n){ka(this,"fill",t={x:(t=[t,e,i,n])[0],y:t[1],width:t[2],height:t[3]},this.rb),this.addElement("rect",t)},e.ox=function(t,e,i,n){ka(this,"fill",t={x:t,y:e,width:i,height:n},this.rb),Sa(this,t),this.svg.prepend(this.Ud("rect",t))},e.fillText=function(t,e,i){t=[t,e,i],"left"===(e=this.textAlign)?e="start":"right"===e?e="end":"center"===e&&(e="middle"),ka(this,"fill",e={x:t[1],y:t[2],style:"font: "+this.font,"text-anchor":e},this.rb),this.addElement("text",e,t[0])},e.lineTo=function(t,e){this.path.push(["L",t,e])},e.moveTo=function(t,e){this.path.push(["M",t,e])},e.quadraticCurveTo=function(t,e,i,n){this.path.push(["Q",t,e,i,n])},e.rect=function(t,e,i,n){this.path.push(["M",t,e],["L",t+i,e],["L",t+i,e+n],["L",t,e+n],["z"])},e.restore=function(){this.rb=this.stack.pop(),this.path=this.stack.pop();var t=this.stack.pop();this.fillStyle=t.fillStyle,this.font=t.font,this.globalAlpha=t.globalAlpha,this.lineCap=t.lineCap,this.lineDashOffset=t.lineDashOffset,this.lineJoin=t.lineJoin,this.lineWidth=t.lineWidth,this.miterLimit=t.miterLimit,this.shadowBlur=t.shadowBlur,this.shadowColor=t.shadowColor,this.shadowOffsetX=t.shadowOffsetX,this.shadowOffsetY=t.shadowOffsetY,this.strokeStyle=t.strokeStyle,this.textAlign=t.textAlign,this.bk=t.bk},e.save=function(){this.stack.push({fillStyle:this.fillStyle,font:this.font,globalAlpha:this.globalAlpha,lineCap:this.lineCap,lineDashOffset:this.lineDashOffset,lineJoin:this.lineJoin,lineWidth:this.lineWidth,miterLimit:this.miterLimit,shadowBlur:this.shadowBlur,shadowColor:this.shadowColor,shadowOffsetX:this.shadowOffsetX,shadowOffsetY:this.shadowOffsetY,strokeStyle:this.strokeStyle,textAlign:this.textAlign,bk:this.bk});for(var t=[],e=0;e<this.path.length;e++)t.push(this.path[e]);this.stack.push(t),this.stack.push(this.rb.copy())},e.setTransform=function(t,e,i,n,o,r){1===t&&0===e&&0===i&&1===n&&0===o&&0===r||Ta(this,t,e,i,n,o,r)},e.scale=function(t,e){this.rb.scale(t,e)},e.translate=function(t,e){this.rb.translate(t,e)},e.transform=function(){},e.yc=function(){},e.stroke=function(){Ca(this,this.Yl)},e.jk=function(){this.clipInsteadOfFill||this.stroke()},e.Ud=function(t,e,i){return this.Gv.Ud(t,e,i)},e.addElement=function(t,e,i){return t=this.Ud(t,e,i),null!==this.yd?this.yd.appendChild(t):this.yd=t,this.ad=t},e.addPath=function(t,e,i){for(var n=[],o=0;o<t.length;o++){var r=T(t[o]),s=[r.shift()];if("A"===s[0])s.push(r.shift()+","+r.shift(),r.shift(),r.shift()+","+r.shift(),r.shift()+","+r.shift());else for(;r.length;)s.push(r.shift()+","+r.shift());n.push(s.join(" "))}if(n=n.join(" "),(t=this.Yl).clipPath)0<this.nh.length&&this.nh[this.nh.length-1].setAttributeNS(null,"clip-path",'path("'+n+'")');else if(t.d=n,ka(this,"",t,e),null!==this.Hl)if("g"!==(e=this.Hl).nodeName)for(var a in t)"transform"!==a&&e.setAttributeNS(null,a,t[a]);else for(var h in a=e.getElementsByTagName("path"),t)"transform"!==h&&a[i].setAttributeNS(null,h,t[h]);else this.addElement("path",t)},e.Ev=function(t,e,i){this.Ar=t,this.Br=e,this.Vg=i},e.js=function(t,e){this.Ct=!0,this.Yg=t,this.uj=e},e.fs=function(){this.Ct=!1},e.Vc=function(){},e.Wx=function(){},va.prototype.rotate=function(t){this.rb.rotate(57.2958*t,0,0)},va.prototype.getImageData=function(){return null},va.prototype.measureText=function(){return null},va.prototype.Hs=function(t){null!==t.svg&&t.svg.parentNode===this.Nj&&t.svg.remove()},va.className="SVGContext",No.prototype.Cs=function(t){this.pj.contains("SVG")||this.bs("SVG",new ya(this,m.document));var e=new ya(this,m.document,!0);void 0===t&&(t=new Y);var i=this;return Or(this,(function(t,n){return t=null!==(t=Ir(i,t,"SVG",e))?t.svg:null,"function"==typeof n?(n(t),null):t}),t)},No.prototype.makeSvg=No.prototype.Cs,No.prototype.av=function(t){return this.Cs(t)},No.prototype.makeSVG=No.prototype.av,Da.prototype.resize=function(t,e,i,n){return(this.width!==t||this.height!==e)&&(this.width=t,this.height=e,this.style.width=i+"px",this.style.height=n+"px",!0)},Da.prototype.toDataURL=function(t,e){return this.Oa.toDataURL(t,e)},Da.prototype.getBoundingClientRect=function(){return this.Oa.getBoundingClientRect()},Da.prototype.focus=function(){this.Oa.focus()},Da.prototype.mx=function(){this.ownerDocument=this.Oa.H=null},d.Object.defineProperties(Da.prototype,{width:{get:function(){return this.Oa.width},set:function(t){this.Oa.width=t}},height:{get:function(){return this.Oa.height},set:function(t){this.Oa.height=t}},style:{get:function(){return this.Oa.style}}}),Da.className="CanvasSurface",(e=Fa.prototype).Wx=function(t){this.Z.imageSmoothingEnabled=t},e.arc=function(t,e,i,n,o,r){this.Z.arc(t,e,i,n,o,r)},e.beginPath=function(){this.Z.beginPath()},e.Se=function(){},e.bezierCurveTo=function(t,e,i,n,o,r){this.Z.bezierCurveTo(t,e,i,n,o,r)},e.clearRect=function(t,e,i,n){this.yc(),this.Z.clearRect(t,e,i,n)},e.clip=function(){this.Z.clip()},e.closePath=function(){this.Z.closePath()},e.createLinearGradient=function(t,e,i,n){return this.Z.createLinearGradient(t,e,i,n)},e.createPattern=function(t,e){return this.Z.createPattern(t,e)},e.createRadialGradient=function(t,e,i,n,o,r){return this.Z.createRadialGradient(t,e,i,n,o,r)},e.drawImage=function(t,e,i,n,o,r,s,a,h){void 0===n?this.Z.drawImage(t,e,i):this.Z.drawImage(t,e,i,n,o,r,s,a,h)},e.fill=function(t){this.Z.fill(t?"evenodd":"nonzero")},e.fillRect=function(t,e,i,n){this.Z.fillRect(t,e,i,n)},e.ox=function(t,e,i,n){this.Z.fillRect(t,e,i,n)},e.fillText=function(t,e,i){this.Z.fillText(t,e,i)},e.getImageData=function(t,e,i,n){return this.Z.getImageData(t,e,i,n)},e.lineTo=function(t,e){this.Z.lineTo(t,e)},e.measureText=function(t){return this.Z.measureText(t)},e.moveTo=function(t,e){this.Z.moveTo(t,e)},e.quadraticCurveTo=function(t,e,i,n){this.Z.quadraticCurveTo(t,e,i,n)},e.rect=function(t,e,i,n){this.Z.rect(t,e,i,n)},e.restore=function(){this.Z.restore()},e.save=function(){this.yc(),this.Z.save()},Fa.prototype.rotate=function(t){this.El.rotate(57.2958*t,0,0)},(e=Fa.prototype).setTransform=function(t,e,i,n,o,r){this.El.setTransform(t,e,i,n,o,r)},e.scale=function(t,e){this.El.scale(t,e)},e.translate=function(t,e){this.El.translate(t,e)},e.stroke=function(){this.Z.stroke()},e.transform=function(t,e,i,n,o,r){if(1!==t||0!==e||0!==i||1!==n||0!==o||0!==r){var s=this.El,a=s.m11*t+s.m21*e;t=s.m12*t+s.m22*e,e=s.m11*i+s.m21*n,i=s.m12*i+s.m22*n,s.dx=s.m11*o+s.m21*r+s.dx,s.dy=s.m12*o+s.m22*r+s.dy,s.m11=a,s.m12=t,s.m21=e,s.m22=i}},e.yc=function(){var t=this.El;this.Z.setTransform(t.m11,t.m12,t.m21,t.m22,t.dx,t.dy)},e.ng=function(t,e){if(t instanceof Oa&&t.type===Za){var i=t.yk;(t=t.ft)>i?(this.scale(i/t,1),this.translate((t-i)/2,0)):i>t&&(this.scale(1,t/i),this.translate(0,(i-t)/2)),this.Hm?this.clip():this.fill(e),t>i?(this.translate(-(t-i)/2,0),this.scale(1/(i/t),1)):i>t&&(this.translate(0,-(i-t)/2),this.scale(1,1/(t/i)))}else this.Hm?this.clip():this.fill(e)},e.jk=function(){this.Hm||this.stroke()},e.Ev=function(t,e,i){this.Ar=t,this.Br=e,this.Vg=i},e.js=function(t,e){var i=this.Z;void 0!==i.setLineDash&&(i.setLineDash(t),i.lineDashOffset=e)},e.fs=function(){var t=this.Z;void 0!==t.setLineDash&&(t.setLineDash(ja),t.lineDashOffset=0)},e.Vc=function(t){t&&(this.dt=""),this.ct=this.et=""},e.Hs=function(){},d.Object.defineProperties(Fa.prototype,{fillStyle:{get:function(){return this.Z.fillStyle},set:function(t){this.ct!==t&&(this.ct=this.Z.fillStyle=t)}},font:{get:function(){return this.Z.font},set:function(t){this.dt!==t&&(this.dt=this.Z.font=t)}},globalAlpha:{get:function(){return this.Z.globalAlpha},set:function(t){this.Z.globalAlpha=t}},lineCap:{get:function(){return this.Z.lineCap},set:function(t){this.Z.lineCap=t}},lineDashOffset:{get:function(){return this.Z.lineDashOffset},set:function(t){this.Z.lineDashOffset=t}},lineJoin:{get:function(){return this.Z.lineJoin},set:function(t){this.Z.lineJoin=t}},lineWidth:{get:function(){return this.Z.lineWidth},set:function(t){this.Z.lineWidth=t}},miterLimit:{get:function(){return this.Z.miterLimit},set:function(t){this.Z.miterLimit=t}},shadowBlur:{get:function(){return this.Z.shadowBlur},set:function(t){this.Z.shadowBlur=t}},shadowColor:{get:function(){return this.Z.shadowColor},set:function(t){this.Z.shadowColor=t}},shadowOffsetX:{get:function(){return this.Z.shadowOffsetX},set:function(t){this.Z.shadowOffsetX=t}},shadowOffsetY:{get:function(){return this.Z.shadowOffsetY},set:function(t){this.Z.shadowOffsetY=t}},strokeStyle:{get:function(){return this.Z.strokeStyle},set:function(t){this.et!==t&&(this.et=this.Z.strokeStyle=t)}},textAlign:{get:function(){return this.Z.textAlign},set:function(t){this.Z.textAlign=t}},imageSmoothingEnabled:{get:function(){return this.Z.imageSmoothingEnabled},set:function(t){this.Z.imageSmoothingEnabled=t}},filter:{get:function(){return this.Z.filter},set:function(t){this.Z.filter=""===t?"none":t}},clipInsteadOfFill:{get:function(){return this.Hm},set:function(t){this.Hm=t}}});var ja=Object.freeze([]);function Ea(){this.F=this.o=this.u=this.j=0}function Oa(t,e){uh||(_a(),uh=!0),Q(this),this._isFrozen=!1,void 0===t?(this.na=$a,this.xk="black"):"string"==typeof t?(this.na=$a,this.xk=t):(this.na=t,this.xk="black"),(t=this.na)===Ja?(this.Qd=ee,this.Lk=ae):this.Lk=this.Qd=t===Za?oe:Qt,this.Gr=0,this.Xp=NaN,this.xe=this.cr=this.we=null,this.ft=this.yk=0,e&&Object.assign(this,e)}function Ia(t,e,i){return e=void 0===e||"number"!=typeof e?.2:e,i=void 0===i?th:i,Ha(t),Ga(e,i)}function za(t,e,i){return e=void 0===e||"number"!=typeof e?.2:e,i=void 0===i?th:i,Ha(t),Ga(-e,i)}function Ra(t,e,i){Ha(t),t=sh.j;var n=sh.u,o=sh.o,r=sh.F;return Ha(e),void 0===i&&(i=.5),"rgba("+Math.round((sh.j-t)*i+t)+", "+Math.round((sh.u-n)*i+n)+", "+Math.round((sh.o-o)*i+o)+", "+Math.round((sh.F-r)*i+r)+")"}function Va(t){return!!t&&(t instanceof Oa?t.Gx():(Ha(t),128>(299*sh.j+587*sh.u+114*sh.o)/1e3))}function Ga(t,e){switch(e){case th:e=100*Xa(sh.j);var i=100*Xa(sh.u),n=100*Xa(sh.o);return hh.j=.4124564*e+.3575761*i+.1804375*n,hh.u=.2126729*e+.7151522*i+.072175*n,hh.o=.0193339*e+.119192*i+.9503041*n,hh.F=sh.F,e=qa(hh.j/oh[0]),i=qa(hh.u/oh[1]),n=qa(hh.o/oh[2]),lh.j=116*i-16,lh.u=500*(e-i),lh.o=200*(i-n),lh.F=hh.F,lh.j=Math.min(100,Math.max(0,lh.j+100*t)),e=(t=(lh.j+16)/116)-lh.o/200,hh.j=oh[0]*Wa(lh.u/500+t),hh.u=oh[1]*(lh.j>nh*ih?Math.pow(t,3):lh.j/nh),hh.o=oh[2]*Wa(e),hh.F=lh.F,t=-.969266*hh.j+1.8760108*hh.u+.041556*hh.o,e=.0556434*hh.j+-.2040259*hh.u+1.0572252*hh.o,sh.j=255*Ua((3.2404542*hh.j+-1.5371385*hh.u+-.4985314*hh.o)/100),sh.u=255*Ua(t/100),sh.o=255*Ua(e/100),sh.F=hh.F,sh.j=Math.round(sh.j),255<sh.j?sh.j=255:0>sh.j&&(sh.j=0),sh.u=Math.round(sh.u),255<sh.u?sh.u=255:0>sh.u&&(sh.u=0),sh.o=Math.round(sh.o),255<sh.o?sh.o=255:0>sh.o&&(sh.o=0),"rgba("+sh.j+", "+sh.u+", "+sh.o+", "+sh.F+")";case eh:return Ya(),ah.o=Math.min(100,Math.max(0,ah.o+100*t)),"hsla("+ah.j+", "+ah.u+"%, "+ah.o+"%, "+ah.F+")";default:w("Unknown color space: "+e)}}function Ha(t){uh||(_a(),uh=!0);var e=rh;if(null!==e){e.clearRect(0,0,1,1),e.fillStyle="#000000";var i=e.fillStyle;e.fillStyle=t,e.fillStyle!==i?(e.fillRect(0,0,1,1),t=e.getImageData(0,0,1,1).data,sh.j=t[0],sh.u=t[1],sh.o=t[2],sh.F=t[3]/255):(e.fillStyle="#FFFFFF",e.fillStyle=t,sh.j=0,sh.u=0,sh.o=0,sh.F=1)}}function Ya(){var t=sh.j/255,e=sh.u/255,i=sh.o/255,n=Math.max(t,e,i),o=Math.min(t,e,i),r=n-o;if(o=(n+o)/2,0===r)var s=t=0;else{switch(n){case t:s=(e-i)/r%6;break;case e:s=(i-t)/r+2;break;case i:s=(t-e)/r+4}0>(s*=60)&&(s+=360),t=r/(1-Math.abs(2*o-1))}ah.j=Math.round(s),ah.u=Math.round(100*t),ah.o=Math.round(100*o),ah.F=sh.F}function Xa(t){return.04045>=(t/=255)?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Ua(t){return.0031308>=t?12.92*t:1.055*Math.pow(t,1/2.4)-.055}function qa(t){return t>ih?Math.pow(t,1/3):(nh*t+16)/116}function Wa(t){var e=t*t*t;return e>ih?e:(116*t-16)/nh}function Ka(t,e){"string"!=typeof t&&(t instanceof Oa||w("Value for "+e+" must be a color string or a Brush, not "+t))}function _a(){rh=Vr?new Da(null,void 0,{willReadFrequently:!0}).context:null}Fa.className="CanvasSurfaceContext",Ea.className="ColorNumbers",Oa.prototype.copy=function(){var t=new Oa;return t.na=this.na,t.xk=this.xk,t.Qd=this.Qd.J(),t.Lk=this.Lk.J(),t.Gr=this.Gr,t.Xp=this.Xp,null!==this.we&&(t.we=this.we.copy()),t.cr=this.cr,t},(e=Oa.prototype).freeze=function(){return this._isFrozen=!0,null!==this.we&&this.we.freeze(),this},e.ka=function(){return Object.isFrozen(this)&&w("cannot thaw constant: "+this),this._isFrozen=!1,null!==this.we&&this.we.ka(),this},e.qb=function(t){t.classType===Oa&&(this.type=t)},e.toString=function(){var t="Brush(";if(this.type===$a)t+=this.color;else if(t=this.type===Ja?t+"Linear ":this.type===Za?t+"Radial ":this.type===Qa?t+"Pattern ":t+"(unknown) ",t+=this.start+" "+this.end,null!==this.colorStops)for(var e=this.colorStops.iterator;e.next();)t+=" "+e.key+":"+e.value;return t+")"},e.addColorStop=function(t,e){return this._isFrozen&&k(this),("number"!=typeof t||!isFinite(t)||1<t||0>t)&&S(t,"0 <= loc <= 1",Oa,"addColorStop:loc"),null===this.we&&(this.we=new ft),this.we.add(t,e),this.na===$a&&(this.type=Ja),this.xe=null,this},e.Vz=function(t,e){if(this._isFrozen&&k(this),t=void 0===t||"number"!=typeof t?.2:t,e=void 0===e?th:e,this.type===$a)Ha(this.color),this.color=Ga(t,e);else if((this.type===Ja||this.type===Za)&&null!==this.colorStops)for(var i=this.colorStops.iterator;i.next();)Ha(i.value),this.addColorStop(i.key,Ga(t,e));return this},e.Wy=function(t,e){if(this._isFrozen&&k(this),t=void 0===t||"number"!=typeof t?.2:t,e=void 0===e?th:e,this.type===$a)Ha(this.color),this.color=Ga(-t,e);else if((this.type===Ja||this.type===Za)&&null!==this.colorStops)for(var i=this.colorStops.iterator;i.next();)Ha(i.value),this.addColorStop(i.key,Ga(-t,e));return this},e.Gx=function(){if(this.type===$a)return Va(this.color);if((this.type===Ja||this.type===Za)&&null!==this.colorStops){var t=this.colorStops;if(this.type===Za)return Va(t.first().value);if(null!==t.get(.5))return Va(t.get(.5));if(2===t.count)return Va(Ra((t=t.Fa())[0].value,t[1].value));for(var e=t.iterator,i=-1,n=-1,o=1,r=1;e.next();){var s=e.key,a=Math.abs(.5-e.key);o>r&&a<o?(i=s,o=a):r>=o&&a<r&&(n=s,r=a)}return i>n&&(r=i,i=n,n=r,r=o),o=n-i,Va(Ra(t.get(i),t.get(n),1-r/o))}return!1},d.Object.defineProperties(Oa.prototype,{type:{get:function(){return this.na},set:function(t){this._isFrozen&&k(this,t),this.na=t,this.start.Mc()&&(t===Ja?this.start=ee:t===Za&&(this.start=oe)),this.end.Mc()&&(t===Ja?this.end=ae:t===Za&&(this.end=oe)),this.xe=null}},color:{get:function(){return this.xk},set:function(t){this._isFrozen&&k(this,t),this.xk=t,this.xe=null}},start:{get:function(){return this.Qd},set:function(t){this._isFrozen&&k(this,t),this.Qd=t.J(),this.xe=null}},end:{get:function(){return this.Lk},set:function(t){this._isFrozen&&k(this,t),this.Lk=t.J(),this.xe=null}},startRadius:{get:function(){return this.Gr},set:function(t){this._isFrozen&&k(this,t),0>t&&S(t,">= zero",Oa,"startRadius"),this.Gr=t,this.xe=null}},endRadius:{get:function(){return this.Xp},set:function(t){this._isFrozen&&k(this,t),0>t&&S(t,">= zero",Oa,"endRadius"),this.Xp=t,this.xe=null}},colorStops:{get:function(){return this.we},set:function(t){this._isFrozen&&k(this,t),this.we=t,this.xe=null}},pattern:{get:function(){return this.cr},set:function(t){this._isFrozen&&k(this,t),this.cr=t,this.xe=null}}}),Oa.prototype.isDark=Oa.prototype.Gx,Oa.prototype.darkenBy=Oa.prototype.Wy,Oa.prototype.lightenBy=Oa.prototype.Vz,Oa.prototype.addColorStop=Oa.prototype.addColorStop;var $a,Ja,Za,Qa,th,eh,ih=216/24389,nh=24389/27,oh=[95.047,100,108.883],rh=null,sh=new Ea,ah=new Ea,hh=new Ea,lh=new Ea,uh=!1;function ch(){this.xa="Base"}function dh(){this.xa="Base"}function fh(){this.xa="Base"}function ph(){this.xa="Base"}function gh(){this.xa="Base"}function mh(t,e,i){var n=null;if(t instanceof Th&&""!==t.$e&&((n=t.fb(t.$e))===t&&(n=null)),null!==n)for(i&&t.arrange(0,0,e.width,e.height),e.assign(n.actualBounds),n=n.panel;n!==t;)n.transform.pp(e),n=n.panel}function yh(){this.xa="Base"}function vh(){this.xa="Base",this.name="Table"}function xh(){this.xa="Base"}function bh(){this.xa="Base"}function wh(){this.xa="Base"}function kh(){this.xa="Base"}function Sh(t,e,i,n){if(0>e)return t%e===i;if(t%e!==i)return!1;e=n.length;for(var o=0;o<e;o++)if(t%n[o]===i)return!1;return!0}function Mh(){this.xa="Base"}function Ch(t,e,i,n){if(!1!==ea(n)){var o=n.strokeWidth;0===o&&t instanceof Wu&&t.type===Th.Link&&t.adornedObject instanceof pl&&(o=t.adornedObject.strokeWidth),o*=n.Ca,t instanceof wc&&null!==t.ua?(t=t.geometry.bounds,n.Ge(t.x-o/2,t.y-o/2,t.width+o,t.height+o)):t instanceof Wu&&null!==t.adornedPart.ua?(t=t.adornedPart.ua.bounds,n.Ge(t.x-o/2,t.y-o/2,t.width+o,t.height+o)):n.Ge(-o/2,-o/2,e+o,i+o),(o=n.desiredSize).w()||null===n.ua?n.dc.h(0,0,o.width,o.height):n.dc.assign(n.ua.bounds),ia(n,!1)}}function Ph(){this.xa="Base"}function Th(t,e){if(Fs.call(this),this.na=null,void 0===t)this.na=Th.Position;else if("string"==typeof t){var i=rl.I(t);null!==i&&(this.na=i)}else t instanceof ch?this.na=t:t&&(this.na=Th.Position,e=t);null===this.na&&w("Panel type not specified or PanelLayout not loaded: "+t),this.l=4194304|this.l|(this.na===Th.Grid?1048576:0),this.O=new $,this.yb=Jt,this.Tm=Me,this.Uf=ms,this.$g=null,this.$e="",this.jg=new jt(NaN,NaN,NaN,NaN),this.T=this.F=null,this.xo=fs,this.jn=Pt,this.kn=it,this.ub=this.ra=null,this.zn=NaN,this.ge=this.Hh=null,e&&Object.assign(this,e)}function Nh(t,e){e.lineCap="butt";var i=0<t.rowCount?t.rowDefs:null,n=0<t.columnCount?t.colDefs:null;null!==i&&Ah(t,e,!0,i,!0),null!==n&&Ah(t,e,!1,n,!0),null!==i&&Lh(t,e,!0,i),null!==n&&Lh(t,e,!1,n),null!==i&&Ah(t,e,!0,i,!1),null!==n&&Ah(t,e,!1,n,!1)}function Lh(t,e,i,n){for(var o=n.length,r=t.actualBounds,s=t.naturalBounds,a=!0,h=0;h<o;h++){var l=n[h];if(void 0!==l&&0!==l.actual)if(a)a=!1;else{if(i){if(l.position>s.height)continue}else if(l.position>s.width)continue;var u=l.separatorStrokeWidth;isNaN(u)&&(u=i?t.defaultRowSeparatorStrokeWidth:t.defaultColumnSeparatorStrokeWidth);var c=l.separatorStroke;if(null===c&&(c=i?t.defaultRowSeparatorStroke:t.defaultColumnSeparatorStroke),0!==u&&null!==c){Xs(t,e,c,!1,!1,s,r),c=!1;var d=l.separatorDashArray;null===d&&(d=i?t.defaultRowSeparatorDashArray:t.defaultColumnSeparatorDashArray),null!==d&&(c=!0,e.js(d,0)),e.beginPath(),d=l.position+u,i?d>s.height&&(u-=d-s.height):d>s.width&&(u-=d-s.width),l=l.position+u/2,e.lineWidth=u,u=t.yb,i?(l+=u.top,d=s.width-u.right,e.moveTo(u.left,l),e.lineTo(d,l)):(l+=u.left,d=s.height-u.bottom,e.moveTo(l,u.top),e.lineTo(l,d)),e.stroke(),e.Se(),c&&e.fs()}}}}function Ah(t,e,i,n,o){for(var r=n.length,s=t.actualBounds,a=t.naturalBounds,h=Bh(t,!0),l=Bh(t,!1),u=0;u<r;u++){var c=n[u];if(void 0!==c&&null!==c.background&&c.coversSeparators!==o&&0!==c.actual){var d=i?s.height:s.width;if(!(c.position>d)){var f=c.Wc(),p=c.separatorStrokeWidth;isNaN(p)&&(p=i?t.defaultRowSeparatorStrokeWidth:t.defaultColumnSeparatorStrokeWidth);var g=c.separatorStroke;null===g&&(g=i?t.defaultRowSeparatorStroke:t.defaultColumnSeparatorStroke),null!==g&&c.index!==(i?h:l)||(p=0),f-=p,(p=c.position+p)+(f+=c.actual)>d&&(f=d-p),0>=f||(d=t.yb,Xs(t,e,c.background,!0,!1,a,s),i?e.fillRect(d.left,p+d.top,s.width-(d.left+d.right),f):e.fillRect(p+d.left,d.top,f,s.height-(d.top+d.bottom)))}}}}function Bh(t,e){for(var i=e?t.rowCount:t.columnCount,n=0;n<i;n++){var o=e?t.rowDefs[n]:t.colDefs[n];if(void 0!==o)return o.index}return 0}function Dh(t){return"LineV"===t||"BarV"===t}function Fh(t){return null!==t.part?t.part.locationObject:null}function jh(t,e){Eh(t,t,e)}function Eh(t,e,i){i(e);for(var n=(e=e.O.s).length,o=0;o<n;o++){var r=e[o];r instanceof Th&&Eh(t,r,i)}}function Oh(t,e){Ih(t,t,e)}function Ih(t,e,i){if(i(e),e instanceof Th)for(var n=(e=e.O.s).length,o=0;o<n;o++)Ih(t,e[o],i)}function zh(t,e,i){if(i(e))return e;if(e instanceof Th)for(var n=(e=e.O.s).length,o=0;o<n;o++){var r=zh(t,e[o],i);if(null!==r)return r}return null}function Rh(t){for(var e=(t=t.O.s).length,i=0,n=0;n<e;n++){var o=t[n];o instanceof Th?i=Math.max(i,Rh(o)):o instanceof pl&&(i=Math.max(i,o.ig/2*o.strokeMiterLimit*o.Df()))}return i}function Vh(t){return t.type===Th.TableRow||t.type===Th.TableColumn}function Gh(t,e,i,n){for(var o=t.O.s,r=o.length;r--;){var s=o[r];if(s.visible){var a=s.actualBounds,h=t.naturalBounds;a.x>h.width||a.y>h.height||0>a.x+a.width||0>a.y+a.height||(s instanceof Th&&Gh(s,e,i,n),null!==e&&(s=e(s)),null===s||null!==i&&!i(s)||n.add(s))}}}function Hh(t){var e=null;return t instanceof pl&&((e=t.spot1)===Me&&(e=null),null!==(t=t.geometry)&&null===e&&(e=t.spot1)),null===e&&(e=te),e}function Yh(t){var e=null;return t instanceof pl&&((e=t.spot2)===Me&&(e=null),null!==(t=t.geometry)&&null===e&&(e=t.spot2)),null===e&&(e=he),e}function Xh(t,e){t.l=e?16777216|t.l:-16777217&t.l}function Uh(t,e,i){var n=t.rowDefs;if(!(0>e)){if(n[e]=i instanceof hl?i:void 0,!i)for(e=n.length-1;0<=e&&void 0===n[e--];)n.length--;t.v()}}function qh(t,e,i){var n=t.colDefs;if(!(0>e)){if(n[e]=i instanceof hl?i:void 0,!i)for(e=n.length-1;0<=e&&void 0===n[e--];)n.length--;t.v()}}function Wh(t){return null!==(t=t.allBindings)&&t._isFrozen}function Kh(t){var e=t.allBindings;if(null===e)null!==t.data&&w("Template cannot have .data be non-null: "+t),t.allBindings=e=new $;else if(e._isFrozen)return;var i=new $;Xh(t,!1),t.qm(t,(function(t,n){n.th();var o=n.localBindings;if(null!==o)for(Zs(n,!1),o=o.iterator;o.next();){var r=o.value;r.mode===qf&&Zs(n,!0);var s=r.sourceName;null!==s&&("/"===s&&Xh(t,!0),null!==(s=Yf(r,t,n))&&(i.add(s),null===s.srcBindings&&(s.srcBindings=new $),s.srcBindings.add(r))),e.add(r)}if(n instanceof Th&&n.type===Th.Table){if(0<n.rowCount)for(o=(t=n.rowDefs).length,r=0;r<o;r++)if(void 0!==(s=t[r])&&null!==s.be)for(var a=s.be.iterator;a.next();){var h=a.value;h.xd=s,h.to=2,h.wl=s.index,e.add(h)}if(0<n.columnCount)for(t=(n=n.colDefs).length,o=0;o<t;o++)if(void 0!==(r=n[o])&&null!==r.be)for(s=r.be.iterator;s.next();)(a=s.value).xd=r,a.to=1,a.wl=r.index,e.add(a)}}));for(var n=i.iterator;n.next();){var o=n.value;if(null!==o.srcBindings){Zs(o,!0);for(var r=o.srcBindings.iterator;r.next();){var s=r.value;null===o.localBindings&&(o.localBindings=new $),o.localBindings.add(s)}}o.srcBindings=null}for(n=e.iterator;n.next();)if(null!==(r=(o=n.value).xd)){o.xd=null;var a=o.targetProperty,h=a.indexOf(".");0<h&&r instanceof Th&&(s=a.substring(0,h),a=a.substr(h+1),null!==(h=r.fb(s))?(r=h,o.targetProperty=a):M('Warning: unable to find GraphObject named "'+s+'" for Binding: '+o.toString())),r instanceof hl?(s=et(r.panel),o.Ai=void 0===s?-1:s,r.panel.bindingId=o.Ai):r instanceof Fs?(s=et(r),o.Ai=void 0===s?-1:s,r.bindingId=o.Ai):w("Unknown type of binding target: "+r)}e.freeze(),t instanceof ku&&t.Zc()&&t.Va()}function _h(t){if(t.type===Th.Spot||t.type===Th.Auto)return Math.min(t.O.length,1);if(t.type===Th.Link){for(var e=(t=t.O).length,i=0;i<e;i++){var n=t.M(i);if(!(n instanceof pl&&n.isPanelMain))break}return i}return t.type===Th.Table&&0<t.O.length&&((t=t.O.M(0)).isPanelMain&&t instanceof Th&&Vh(t))?1:0}function $h(t,e){var i=_h(t);if(null===e||0===e.length)for(;t.O.length>i;)t.pc(t.O.length-1,!1);else if(t.O.length<=i){i=e.length;for(var n=0;n<i;n++)Jh(t,e[n],n,!0)}else{n=i;for(var o=0;o<e.length;o++,n++){var r=e[o],s=n<t.O.length?t.O.M(n):null;if(s instanceof Th){if(s.data!==r){var a=Qh(t,s.data),h=Qh(t,r),l=h!==a;l||(a=tl(t,a),l=tl(t,h)!==a),l?(t.pc(n,!1),Jh(t,r,o,!1)):s.data=r}}else Jh(t,r,o,!1)}for(;n<t.O.length;)t.pc(n,!1);t.$g=null,Zh(t,i,0),ea(t)||t.v(),t.graduatedIntervals=null,t.If()||el(t,t,!1),null!==(e=t.part)&&(e.Rh=null,e.ag=NaN,t.Te&&e instanceof _u&&(e.Te=!0),e.Te&&e instanceof _u&&(e.wc=null))}}function Jh(t,e,i,n){if(!(null==e||0>i)){var o=Qh(t,e);if(null!==(o=tl(t,o))){if(Kh(o),0!=(16777216&(o=o.copy()).l)){var r=t.ih();null!==r&&Xh(r,!0)}"object"==typeof e&&(null===t.ge&&(t.ge=new ft),t.ge.add(e,o)),r=i+_h(t),t.Gb(r,o),n&&(o.ub=e,Zh(t,r,i),o.ub=null),o.data=e}}}function Zh(t,e,i){for(t=t.O;e<t.length;){var n=t.M(e);if(n instanceof Th){var o=e,r=i;n.type===Th.TableRow?n.row=o:n.type===Th.TableColumn&&(n.column=o),n.itemIndex=r}e++,i++}}function Qh(t,e){if(null===e)return"";if("function"==typeof(t=t.itemCategoryProperty))t=t(e);else{if("string"!=typeof t||"object"!=typeof e)return"";if(""===t)return"";t=zf(e,t)}return void 0===t?"":"string"==typeof t?t:void w("Panel.getCategoryForItemData found a non-string category for "+e+": "+t)}function tl(t,e){var i=t.itemTemplateMap,n=null;return null!==i&&(n=i.I(e)),null===n&&(null!==i&&(n=i.I("")),null===n&&(nl||(nl=!0,M('No item template Panel found for category "'+e+'" on '+t),M(" Using default item template."),t=new Th,(e=new Pl).bind(new Hf("text","",F)),t.add(e),ol=t),n=ol)),n}function el(t,e,i){var n=e.enabledChanged;if(null!==n&&n(e,i),e instanceof Th){n=(e=e.O.s).length;for(var o=0;o<n;o++){var r=e[o];i&&r instanceof Th&&!r.isEnabled||el(t,r,i)}}}function il(t,e){e.name=t,rl.add(t,e)}Oa.className="Brush",Oa.Solid=$a=new V(Oa,"Solid",0),Oa.Linear=Ja=new V(Oa,"Linear",1),Oa.Radial=Za=new V(Oa,"Radial",2),Oa.Pattern=Qa=new V(Oa,"Pattern",4),Oa.Lab=th=new V(Oa,"Lab",5),Oa.HSL=eh=new V(Oa,"HSL",6),Oa.randomColor=function(t,e){void 0===t&&(t=128),void 0===e&&(e=Math.max(t,255));var i=Math.abs(e-t);e=Math.floor(t+Math.random()*i).toString(16);var n=Math.floor(t+Math.random()*i).toString(16);return t=Math.floor(t+Math.random()*i).toString(16),2>e.length&&(e="0"+e),2>n.length&&(n="0"+n),2>t.length&&(t="0"+t),"#"+e+n+t},Oa.isValidColor=function(t){if("black"===t)return!0;if(""===t)return!1;uh||(_a(),uh=!0);var e=rh;if(null===e)return!0;e.fillStyle="#000000";var i=e.fillStyle;return e.fillStyle=t,e.fillStyle!==i||(e.fillStyle="#FFFFFF",i=e.fillStyle,e.fillStyle=t,e.fillStyle!==i)},Oa.lighten=function(t){return Ia(t)},Oa.lightenBy=Ia,Oa.darken=function(t){return za(t)},Oa.darkenBy=za,Oa.mix=Ra,Oa.isDark=Va,ch.prototype.measure=function(){},ch.prototype.Yz=function(t,e,i,n,o){t.measure(e,i,n,o)},ch.prototype.arrange=function(){},ch.prototype.Ly=function(t,e,i,n,o,r){t.arrange(e,i,n,o,r)},ch.prototype.iA=function(t){t.Uj()},ch.prototype.gc=function(){},d.Object.defineProperties(ch.prototype,{name:{get:function(){return this.xa},set:function(t){this.xa=t}},classType:{get:function(){return Th}}}),ch.prototype.remeasureObject=ch.prototype.iA,ch.prototype.arrangeElement=ch.prototype.Ly,ch.prototype.measureElement=ch.prototype.Yz,ch.className="PanelLayout",c(dh,ch),dh.prototype.measure=function(t,e,i,n,o,r,s){var a=n.length;t=Fh(t);for(var h=0;h<a;h++){var l=n[h];if(l.visible||l===t){var u=l.margin,c=u.right+u.left;u=u.top+u.bottom,l.measure(e,i,r,s);var d=l.measuredBounds;c=Math.max(d.width+c,0),u=Math.max(d.height+u,0),d=l.position.x;var f=l.position.y;isFinite(d)||(d=0),isFinite(f)||(f=0),l instanceof pl&&l.isGeometryPositioned&&(d-=l=l.strokeWidth/2,f-=l),Ht(o,d,f,c,u)}}},dh.prototype.arrange=function(t,e,i){var n=e.length,o=t.padding;for(t=i.x-o.left,i=i.y-o.top,o=0;o<n;o++){var r=e[o],s=r.measuredBounds,a=r.margin,h=r.position.x,l=r.position.y;if(h=isNaN(h)?-t:h-t,l=isNaN(l)?-i:l-i,r instanceof pl&&r.isGeometryPositioned){var u=r.strokeWidth/2;h-=u,l-=u}r.visible&&r.arrange(h+a.left,l+a.top,s.width,s.height)}},c(fh,ch),fh.prototype.measure=function(t,e,i,n,o,r,s){var a=n.length;e=A(),r=Fh(t);for(var h=0;h<a;h++){var l=n[h];if(l.visible||l===r){var u=Ws(l,!1);if(u!==ds&&u!==ps)e.push(l);else{l.measure(1/0,i,0,s),u=l.margin,l=l.measuredBounds;var c=Math.max(l.height+u.top+u.bottom,0);o.width+=Math.max(l.width+u.right+u.left,0),o.height=Math.max(o.height,c)}}}for(n=e.length,t.desiredSize.height?i=Math.min(t.desiredSize.height,t.maxSize.height):0!==o.height&&(i=Math.min(o.height,t.maxSize.height)),t=0;t<n;t++)((h=e[t]).visible||h===r)&&(a=(u=h.margin).right+u.left,u=u.top+u.bottom,h.measure(1/0,i,0,s),h=h.measuredBounds,u=Math.max(h.height+u,0),o.width+=Math.max(h.width+a,0),o.height=Math.max(o.height,u));B(e)},fh.prototype.arrange=function(t,e,i){for(var n=e.length,o=t.padding,r=o.top,s=t.isOpposite,a=s?i.width:o.left,h=0;h<n;h++){var l=r,u=e[h];if(u.visible){var c=u.measuredBounds,d=u.margin,f=d.top+d.bottom,p=r+o.bottom,g=c.height,m=Ws(u,!1);(isNaN(u.desiredSize.height)&&m===cs||m===gs)&&(g=Math.max(i.height-f-p,0)),f=g+f+p,(p=u.alignment).Xb()&&(p=t.defaultAlignment),p.sb()||(p=oe),s&&(a-=c.width+d.left+d.right),u.arrange(a+p.offsetX+d.left,l+p.offsetY+d.top+(i.height*p.y-f*p.y),c.width,g),s||(a+=c.width+d.left+d.right)}}},c(ph,ch),ph.prototype.measure=function(t,e,i,n,o,r){var s=n.length;i=A();for(var a=Fh(t),h=0;h<s;h++){var l=n[h];if(l.visible||l===a){var u=Ws(l,!1);if(u!==ds&&u!==gs)i.push(l);else{var c=l.margin;u=c.right+c.left,c=c.top+c.bottom,l.measure(e,1/0,r,0),l=l.measuredBounds,Et(o,Math.max(o.width,Math.max(l.width+u,0)),o.height+Math.max(l.height+c,0))}}}if(0!==(n=i.length)){for(t.desiredSize.width?e=Math.min(t.desiredSize.width,t.maxSize.width):0!==o.width&&(e=Math.min(o.width,t.maxSize.width)),t=0;t<n;t++)((h=i[t]).visible||h===a)&&(s=(l=h.margin).right+l.left,l=l.top+l.bottom,h.measure(e,1/0,r,0),h=h.measuredBounds,l=Math.max(h.height+l,0),o.width=Math.max(o.width,Math.max(h.width+s,0)),o.height+=l);B(i)}},ph.prototype.arrange=function(t,e,i){for(var n=e.length,o=t.padding,r=o.left,s=t.isOpposite,a=s?i.height:o.top,h=0;h<n;h++){var l=r,u=e[h];if(u.visible){var c=u.measuredBounds,d=u.margin,f=d.left+d.right,p=r+o.right,g=c.width,m=Ws(u,!1);(isNaN(u.desiredSize.width)&&m===cs||m===ps)&&(g=Math.max(i.width-f-p,0)),f=g+f+p,(p=u.alignment).Xb()&&(p=t.defaultAlignment),p.sb()||(p=oe),s&&(a-=c.height+d.bottom+d.top),u.arrange(l+p.offsetX+d.left+(i.width*p.x-f*p.x),a+p.offsetY+d.top,g,c.height),s||(a+=c.height+d.bottom+d.top)}}},c(gh,ch),gh.prototype.measure=function(t,e,i,n,o,r,s){var a=n.length,h=t.Pb(),l=h.margin,u=l.right+l.left,c=l.top+l.bottom;h.measure(e,i,r,s);var d=h.measuredBounds;r=d.width,s=d.height;var f=Math.max(r+u,0),p=Math.max(s+c,0),g=t.isClipping,m=jt.allocAt(-l.left,-l.top,f,p),y=jt.allocAt(0,0,r,s);mh(h,y,!0),r=y.width,s=y.height;for(var v=!0,x=Fh(t),b=0;b<a;b++){var w=n[b];d=e;var k=i;if(w!==h&&(w.visible||w===x)){var S=(l=w.margin).left,M=l.top;switch(f=l.right+l.left,p=l.top+l.bottom,l=Ws(w,!1)){case cs:d=r,k=s,M=S=p=f=0;break;case ps:d=r,S=f=0;break;case gs:k=s,M=p=0}w.measure(d,k,0,0),d=w.measuredBounds,f=Math.max(d.width+f,0),p=Math.max(d.height+p,0),(l=w.alignment).Xb()&&(l=t.defaultAlignment),l.sb()||(l=oe);var C=w.alignmentFocus;if(C.Xb()&&(C=oe),k=null,w instanceof Th&&""!==w.$e&&((k=w.fb(w.$e))===w&&(k=null)),S=y.x-S,M=y.y-M,null!==k){for(w.arrange(0,0,d.width,d.height),d=k.actualBounds,d=pt.allocAt(d.x+(C.x*d.width-C.offsetX),d.y+(C.y*d.height-C.offsetY)),k=k.panel;k!==w;)k.transform.Ga(d),k=k.panel;S+=l.x*r+l.offsetX-d.x,M+=l.y*s+l.offsetY-d.y,pt.free(d)}else S+=l.x*r+l.offsetX-(C.x*d.width+C.offsetX),M+=l.y*s+l.offsetY-(C.y*d.height+C.offsetY);v?(v=!1,o.h(S,M,f,p)):Ht(o,S,M,f,p)}}switch(v?o.assign(m):g?o.Uu(y.x,y.y,y.width,y.height):Ht(o,m.x,m.y,m.width,m.height),jt.free(m),jt.free(y),(l=h.stretch)===ms&&(l=Ws(h,!1)),l){case ds:return;case cs:if(!isFinite(e)&&!isFinite(i))return;break;case ps:if(!isFinite(e))return;break;case gs:if(!isFinite(i))return}for(r=(d=h.measuredBounds).width,s=d.height,f=Math.max(r+u,0),p=Math.max(s+c,0),l=h.margin,mh(h,y=jt.allocAt(-l.left,-l.top,f,p),!0),r=y.width,s=y.height,e=0;e<a;e++)(i=n[e])===h||!i.visible&&i!==x||(f=(l=i.margin).right+l.left,p=l.top+l.bottom,d=i.measuredBounds,f=Math.max(d.width+f,0),p=Math.max(d.height+p,0),(u=i.alignment).Xb()&&(u=t.defaultAlignment),u.sb()||(u=oe),(i=i.alignmentFocus).Xb()&&(i=oe),v?(v=!1,o.h(u.x*r+u.offsetX-(i.x*d.width+i.offsetX)-l.left,u.y*s+u.offsetY-(i.y*d.height+i.offsetY)-l.top,f,p)):Ht(o,u.x*r+u.offsetX-(i.x*d.width+i.offsetX)-l.left,u.y*s+u.offsetY-(i.y*d.height+i.offsetY)-l.top,f,p));v?o.assign(m):g?o.Uu(y.x,y.y,y.width,y.height):Ht(o,m.x,m.y,m.width,m.height),jt.free(y)},gh.prototype.arrange=function(t,e,i){var n=e.length,o=t.Pb(),r=o.measuredBounds,s=r.width,a=r.height,h=t.padding;r=h.left,h=h.top;var l=r-i.x,u=h-i.y;for(o.arrange(l,u,s,a),mh(o,s=jt.allocAt(0,0,s,a),!1),a=0;a<n;a++){var c=e[a];if(c!==o){var d=(l=c.measuredBounds).width,f=l.height;(u=c.alignment).Xb()&&(u=t.defaultAlignment),u.sb()||(u=oe);var p=c.alignmentFocus;if(p.Xb()&&(p=oe),l=null,c instanceof Th&&""!==c.$e&&((l=c.fb(c.$e))===c&&(l=null)),null!==l){var g=l.actualBounds;for(p=pt.allocAt(g.x+(p.x*g.width-p.offsetX),g.y+(p.y*g.height-p.offsetY)),l=l.panel;l!==c;)l.transform.Ga(p),l=l.panel;l=u.x*s.width+u.offsetX-p.x,u=u.y*s.height+u.offsetY-p.y,pt.free(p)}else l=u.x*s.width+u.offsetX-(p.x*d+p.offsetX),u=u.y*s.height+u.offsetY-(p.y*f+p.offsetY);l+=s.x-i.x,u+=s.y-i.y,c.visible&&c.arrange(r+l,h+u,d,f)}}jt.free(s)},c(yh,ch),yh.prototype.measure=function(t,e,i,n,o,r,s){var a=n.length,h=t.Pb(),l=h.margin,u=e,c=i,d=l.right+l.left,f=l.top+l.bottom;h.measure(e,i,r,s),l=h.measuredBounds;var p=0,g=null;h instanceof pl&&(p=(g=h).strokeWidth*g.scale);var m=Math.max(l.width+d,0);l=Math.max(l.height+f,0);var y=Hh(h),v=y.x*m+y.offsetX;y=y.y*l+y.offsetY;var x=Yh(h),b=x.x*m+x.offsetX;for(x=x.y*l+x.offsetY,isFinite(e)&&(u=Math.max(Math.abs(v-b)-p,0)),isFinite(i)&&(c=Math.max(Math.abs(y-x)-p,0)),(p=At.alloc()).h(0,0),t=Fh(t),x=0;x<a;x++)(y=n[x])===h||!y.visible&&y!==t||(m=(l=y.margin).right+l.left,v=l.top+l.bottom,y.measure(u,c,0,0),l=y.measuredBounds,m=Math.max(l.width+m,0),l=Math.max(l.height+v,0),p.h(Math.max(m,p.width),Math.max(l,p.height)));if(1===a)o.width=m,o.height=l,At.free(p);else{switch(y=Hh(h),a=n=0,(x=Yh(h)).x!==y.x&&x.y!==y.y&&(n=p.width/Math.abs(x.x-y.x),a=p.height/Math.abs(x.y-y.y)),At.free(p),p=0,null!==g&&(p=g.strokeWidth*g.scale,yl(g)===fs&&(n=a=Math.max(n,a))),n+=Math.abs(y.offsetX)+Math.abs(x.offsetX)+p,a+=Math.abs(y.offsetY)+Math.abs(x.offsetY)+p,(g=h.stretch)===ms&&(g=Ws(h,!1)),g){case ds:s=r=0;break;case cs:isFinite(e)&&(n=e),isFinite(i)&&(a=i);break;case ps:isFinite(e)&&(n=e),s=0;break;case gs:r=0,isFinite(i)&&(a=i)}h.Uj(),h.measure(n,a,r,s),o.width=h.measuredBounds.width+d,o.height=h.measuredBounds.height+f}},yh.prototype.arrange=function(t,e){var i=e.length,n=t.Pb(),o=n.measuredBounds,r=jt.alloc();r.h(0,0,1,1);var s=n.margin,a=s.left;s=s.top;var h=t.padding,l=h.left;h=h.top,n.arrange(l+a,h+s,o.width,o.height);var u=Hh(n),c=Yh(n),d=u.y*o.height+u.offsetY,f=c.x*o.width+c.offsetX;for(c=c.y*o.height+c.offsetY,r.x=u.x*o.width+u.offsetX,r.y=d,Ht(r,f,c,0,0),r.x+=a+l,r.y+=s+h,o=0;o<i;o++)(a=e[o])!==n&&(l=a.measuredBounds,s=a.margin,h=Math.max(l.width+s.right+s.left,0),u=Math.max(l.height+s.top+s.bottom,0),(d=a.alignment).Xb()&&(d=t.defaultAlignment),d.sb()||(d=oe),h=r.width*d.x+d.offsetX-h*d.x+s.left+r.x,s=r.height*d.y+d.offsetY-u*d.y+s.top+r.y,a.visible&&(Yt(r.x,r.y,r.width,r.height,h,s,l.width,l.height)?a.arrange(h,s,l.width,l.height):a.arrange(h,s,l.width,l.height,new jt(r.x,r.y,r.width,r.height))));jt.free(r)},c(vh,ch),vh.prototype.measure=function(t,e,i,n,o){for(var r=n.length,s=A(),a=A(),h=0;h<r;h++){var l=n[h],u=l instanceof Th?l:null;if(null!==u&&Vh(u)&&l.visible){a.push(u);for(var c=u.O.s,d=c.length,f=0;f<d;f++){var p=c[f];u.type===Th.TableRow?p.row=l.row:u.type===Th.TableColumn&&(p.column=l.column),s.push(p)}}else s.push(l)}0===(r=s.length)&&(t.Fb(0),t.Eb(0));for(var g=[],m=0;m<r;m++){var y=s[m];y.visible&&(ia(y,!0),oa(y,!0),g[y.row]||(g[y.row]=[]),g[y.row][y.column]||(g[y.row][y.column]=[]),g[y.row][y.column].push(y))}B(s);var v=A(),x=A(),b=A(),w={count:0},k={count:0},S=e,M=i,C=t.rowDefs,P=t.colDefs,T=null;r=C.length;for(var N=0;N<r;N++)void 0!==(T=C[N])&&(T.actual=0);r=P.length;for(var L=0;L<r;L++)void 0!==(T=P[L])&&(T.actual=0);for(var D=g.length,F=0,j=0;j<D;j++)g[j]&&(F=Math.max(F,g[j].length));var E=Math.min(t.topIndex,D-1),O=Math.min(t.leftIndex,F-1),I=0;D=g.length;for(var z=Fh(t),R=0;R<D;R++)if(g[R]){F=g[R].length;var V=t.Fb(R);V.actual=0;for(var G=V.oc=0;G<F;G++)if(g[R][G]){var H=t.Eb(G);void 0===v[G]&&(H.actual=0,H.oc=0,v[G]=!0);for(var Y=g[R][G],X=Y.length,U=0;U<X;U++){var q=Y[U];if(q.visible||q===z){var W=1<q.rowSpan||1<q.columnSpan;W&&(R<E||G<O||x.push(q));var K=q.margin,_=K.right+K.left,$=K.top+K.bottom,J=Ks(q,V,H,!1),Z=q.desiredSize,Q=!isNaN(Z.height),tt=!isNaN(Z.width)&&Q;if(W||J===ds||tt||R<E||G<O||(void 0!==w[G]||J!==cs&&J!==ps||(w[G]=-1,w.count++),void 0!==k[R]||J!==cs&&J!==gs||(k[R]=-1,k.count++),b.push(q)),q.measure(1/0,1/0,0,0),!(R<E||G<O)){var et=q.measuredBounds,it=Math.max(et.width+_,0),nt=Math.max(et.height+$,0);if(1===q.rowSpan&&(J===ds||J===ps)){var ot=(T=t.Fb(R)).Wc();(I=Math.max(nt-T.actual,0))+ot>M&&(I=Math.max(M-ot,0));var rt=0===T.oa;T.oc=T.oc+I,T.actual=T.oa+I,M=Math.max(M-(I+(rt?ot:0)),0)}if(1===q.columnSpan&&(J===ds||J===gs)){var st=(T=t.Eb(G)).Wc();(I=Math.max(it-T.actual,0))+st>S&&(I=Math.max(S-st,0));var at=0===T.oa;T.oc=T.oc+I,T.actual=T.oa+I,S=Math.max(S-(I+(at?st:0)),0)}W&&q.Uj()}}}}}B(v);var ht=0,lt=0;r=t.columnCount;for(var ut=0;ut<r;ut++){var ct=P[ut];void 0!==ct&&(ht+=isNaN(ct.Hc)?ct.oc:ct.Hc,0!==ct.oc&&(ht+=ct.Wc()))}r=t.rowCount;for(var dt=0;dt<r;dt++){var ft=C[dt];void 0!==ft&&(lt+=isNaN(ft.Hc)?ft.oc:ft.Hc,0!==ft.oc&&(lt+=ft.Wc()))}S=Math.max(e-ht,0);var pt=M=Math.max(i-lt,0),gt=S;r=b.length;for(var mt=0;mt<r;mt++){var yt=b[mt],vt=t.Fb(yt.row),xt=t.Eb(yt.column),bt=yt.measuredBounds,wt=yt.margin,kt=wt.right+wt.left,St=wt.top+wt.bottom;w[yt.column]=0===xt.oc&&void 0!==w[yt.column]?Math.max(bt.width+kt,w[yt.column]):null,k[yt.row]=0===vt.oc&&void 0!==k[yt.row]?Math.max(bt.height+St,k[yt.row]):null}var Mt,Ct=0,Pt=0;for(Mt in k)"count"!==Mt&&(Ct+=k[Mt]);for(Mt in w)"count"!==Mt&&(Pt+=w[Mt]);for(var Tt=At.alloc(),Nt=0;Nt<r;Nt++){var Lt=b[Nt];if(Lt.visible||Lt===z){var Bt=t.Fb(Lt.row),Dt=t.Eb(Lt.column),Ft=0;isFinite(Dt.width)?Ft=Dt.width:(Ft=isFinite(S)&&null!==w[Lt.column]?0===Pt?Dt.actual+S:w[Lt.column]/Pt*gt:null!==w[Lt.column]?S:Dt.actual||S,Ft=Math.max(0,Ft-Dt.Wc()));var jt=0;switch(isFinite(Bt.height)?jt=Bt.height:(jt=isFinite(M)&&null!==k[Lt.row]?0===Ct?Bt.actual+M:k[Lt.row]/Ct*pt:null!==k[Lt.row]?M:Bt.actual||M,jt=Math.max(0,jt-Bt.Wc())),Tt.h(Math.max(Dt.minimum,Math.min(Ft,Dt.maximum)),Math.max(Bt.minimum,Math.min(jt,Bt.maximum))),J=Ks(Lt,Bt,Dt,!1)){case ps:Tt.height=Math.max(Tt.height,Bt.actual+M);break;case gs:Tt.width=Math.max(Tt.width,Dt.actual+S)}var Et=Lt.margin,Ot=Et.right+Et.left,It=Et.top+Et.bottom;Lt.Uj(),Lt.measure(Tt.width,Tt.height,Dt.minimum,Bt.minimum);var zt=Lt.measuredBounds,Rt=Math.max(zt.width+Ot,0),Vt=Math.max(zt.height+It,0);isFinite(S)&&(Rt=Math.min(Rt,Tt.width)),isFinite(M)&&(Vt=Math.min(Vt,Tt.height));var Gt=0;Gt=Bt.actual,Bt.actual=Math.max(Bt.actual,Vt),Bt.oc=Math.max(Bt.oc,Vt),I=Bt.actual-Gt,M=Math.max(M-I,0),null===k[Lt.row]&&(pt=Math.max(pt-I,0)),Gt=Dt.actual,Dt.actual=Math.max(Dt.actual,Rt),Dt.oc=Math.max(Dt.oc,Rt),I=Dt.actual-Gt,S=Math.max(S-I,0),null===w[Lt.column]&&(gt=Math.max(gt-I,0))}}B(b);var Ht=At.alloc(),Yt=A(),Xt=A();if(0!==(r=x.length))for(var Ut=0;Ut<D;Ut++)if(g[Ut]){F=g[Ut].length;var qt=t.Fb(Ut);Yt[Ut]=qt.actual;for(var Wt=0;Wt<F;Wt++)if(g[Ut][Wt]){var Kt=t.Eb(Wt);Xt[Wt]=Kt.actual}}for(var _t=0;_t<r;_t++){var $t=x[_t];if($t.visible||$t===z){var Jt=t.Fb($t.row),Zt=t.Eb($t.column);switch(Tt.h(Math.max(Zt.minimum,Math.min(e,Zt.maximum)),Math.max(Jt.minimum,Math.min(i,Jt.maximum))),J=Ks($t,Jt,Zt,!1)){case cs:0!==Xt[Zt.index]&&(Tt.width=Math.min(Tt.width,Xt[Zt.index])),0!==Yt[Jt.index]&&(Tt.height=Math.min(Tt.height,Yt[Jt.index]));break;case ps:0!==Xt[Zt.index]&&(Tt.width=Math.min(Tt.width,Xt[Zt.index]));break;case gs:0!==Yt[Jt.index]&&(Tt.height=Math.min(Tt.height,Yt[Jt.index]))}isFinite(Zt.width)&&(Tt.width=Zt.width),isFinite(Jt.height)&&(Tt.height=Jt.height),Ht.h(0,0);for(var Qt=Zt.minimum,te=Jt.minimum,ee=1;ee<$t.rowSpan&&!($t.row+ee>=t.rowCount);ee++)T=t.Fb($t.row+ee),I=0,I=J===cs||J===gs?Math.max(T.minimum,0===Yt[$t.row+ee]?T.maximum:Math.min(Yt[$t.row+ee],T.maximum)):Math.max(T.minimum,isNaN(T.Hc)?T.maximum:Math.min(T.Hc,T.maximum)),Ht.height+=I,te+=T.minimum;for(var ie=1;ie<$t.columnSpan&&!($t.column+ie>=t.columnCount);ie++)T=t.Eb($t.column+ie),I=0,I=J===cs||J===ps?Math.max(T.minimum,0===Xt[$t.column+ie]?T.maximum:Math.min(Xt[$t.column+ie],T.maximum)):Math.max(T.minimum,isNaN(T.Hc)?T.maximum:Math.min(T.Hc,T.maximum)),Ht.width+=I,Qt+=T.minimum;Tt.width+=Ht.width,Tt.height+=Ht.height;var ne=$t.margin,oe=ne.right+ne.left,re=ne.top+ne.bottom;$t.measure(Tt.width,Tt.height,Qt,te);for(var se=$t.measuredBounds,ae=Math.max(se.width+oe,0),he=Math.max(se.height+re,0),le=0,ue=0;ue<$t.rowSpan&&!($t.row+ue>=t.rowCount);ue++)le+=(T=t.Fb($t.row+ue)).total||0;if(le<he){var ce=he-le,de=he-le;if(null!==$t.spanAllocation)for(var fe=$t.spanAllocation,pe=0;pe<$t.rowSpan&&!(0>=ce)&&!($t.row+pe>=t.rowCount);pe++){var ge=(T=t.Fb($t.row+pe)).oa||0,me=fe($t,T,de);T.actual=Math.min(T.maximum,ge+me),T.oa!==ge&&(ce-=T.oa-ge)}for(;0<ce;){var ye=T.oa||0;if(isNaN(T.height)&&T.maximum>ye&&(T.actual=Math.min(T.maximum,ye+ce),T.oa!==ye&&(ce-=T.oa-ye)),0===T.index)break;T=t.Fb(T.index-1)}}for(var ve=0,xe=0;xe<$t.columnSpan&&!($t.column+xe>=t.columnCount);xe++)ve+=(T=t.Eb($t.column+xe)).total||0;if(ve<ae){var be=ae-ve,we=ae-ve;if(null!==$t.spanAllocation)for(var ke=$t.spanAllocation,Se=0;Se<$t.columnSpan&&!(0>=be)&&!($t.column+Se>=t.columnCount);Se++){var Me=(T=t.Eb($t.column+Se)).oa||0,Ce=ke($t,T,we);T.actual=Math.min(T.maximum,Me+Ce),T.oa!==Me&&(be-=T.oa-Me)}for(;0<be;){var Pe=T.oa||0;if(isNaN(T.width)&&T.maximum>Pe&&(T.actual=Math.min(T.maximum,Pe+be),T.oa!==Pe&&(be-=T.oa-Pe)),0===T.index)break;T=t.Eb(T.index-1)}}}}B(x),At.free(Ht),At.free(Tt),void 0!==Yt&&B(Yt),void 0!==Xt&&B(Xt);var Te=0,Ne=0,Le=t.desiredSize,Ae=t.maxSize;J=Ws(t,!0);var Be=lt=ht=0,De=0;r=t.columnCount;for(var Fe=0;Fe<r;Fe++)void 0!==P[Fe]&&(T=t.Eb(Fe),isFinite(T.width)?(Be+=T.width,Be+=T.Wc()):ul(T)===dl?(Be+=T.oa,Be+=T.Wc()):0!==T.oa&&(ht+=T.oa,ht+=T.Wc()));Te=isFinite(Le.width)?Math.min(Le.width,Ae.width):J!==ds&&isFinite(e)?e:ht,Te=Math.max(Te,t.minSize.width),Te=Math.max(Te-Be,0);for(var je=0===ht?1:Math.max(Te/ht,1),Ee=0;Ee<r;Ee++)void 0!==P[Ee]&&(T=t.Eb(Ee),isFinite(T.width)||ul(T)===dl||(T.actual=T.oa*je),T.position=o.width,0!==T.oa&&(o.width+=T.oa,o.width+=T.Wc()));r=t.rowCount;for(var Oe=0;Oe<r;Oe++)void 0!==C[Oe]&&(T=t.Fb(Oe),isFinite(T.height)?(De+=T.height,De+=T.Wc()):ul(T)===dl?(De+=T.oa,De+=T.Wc()):0!==T.oa&&(lt+=T.oa,lt+=T.Wc()));Ne=isFinite(Le.height)?Math.min(Le.height,Ae.height):J!==ds&&isFinite(i)?i:lt,Ne=Math.max(Ne,t.minSize.height),Ne=Math.max(Ne-De,0);for(var Ie=0===lt?1:Math.max(Ne/lt,1),ze=0;ze<r;ze++)void 0!==C[ze]&&(T=t.Fb(ze),isFinite(T.height)||ul(T)===dl||(T.actual=T.oa*Ie),T.position=o.height,0!==T.oa&&(o.height+=T.oa,o.height+=T.Wc()));r=a.length;for(var Re=0;Re<r;Re++){var Ve=a[Re],Ge=0,He=0;Ve.type===Th.TableRow?(Ge=o.width,He=(T=t.Fb(Ve.row)).actual):(Ge=(T=t.Eb(Ve.column)).actual,He=o.height),Ve.measuredBounds.h(0,0,Ge,He),ia(Ve,!1)}B(a),t.inRowsCols=g},vh.prototype.arrange=function(t,e,i){var n=e.length,o=t.padding,r=o.left;o=o.top;var s=t.inRowsCols;if(null!==s){for(var a,h,l=s.length,u=0,c=0;c<l;c++)s[c]&&(u=Math.max(u,s[c].length));h=t.rowDefs,a=t.colDefs;var d=c=0,f=Math.min(t.topIndex,l-1);if(0<h.length){for(;f!==l&&(void 0===h[f]||0===h[f].oa);)f++;c=-h[f=Math.max(Math.min(f,l-1),0)].position}var p=Math.min(t.leftIndex,u-1);if(0<a.length){for(;p!==u&&(void 0===a[p]||0===a[p].oa);)p++;d=-a[p=Math.max(Math.min(p,u-1),0)].position}for(var g=0,m=0;g!==l&&void 0===h[g];)g++;for(;m!==l&&void 0===a[m];)m++;u=t.part,t.Fb(g),t.Eb(m);for(var y=0;y<e.length;y++){var v=e[y];if(v instanceof Th&&v.visible&&Vh(v)){if(v.type===Th.TableRow){a=t.Fb(v.row);var x=t.Eb(m)}else a=t.Fb(g),x=t.Eb(v.column);h=a.position+c+o,0!==a.oa&&(h+=a.Io(Math.max(g,f))),a=x.position+d+r,0!==x.oa&&(a+=x.Io(Math.max(m,p))),x=v.measuredBounds,v.Uk(),v.actualBounds.ka();var b=v.actualBounds,w=jt.allocAt(b.x,b.y,b.width,b.height);b.x=v.type===Th.TableRow?r:a,b.y=v.type===Th.TableColumn?o:h,b.width=x.width,b.height=x.height,v.actualBounds.freeze(),oa(v,!1),zt(w,b)||null===u||(u.oh(),v.Pn(u)),jt.free(w)}}for(y=At.alloc(),v=0;v<l;v++)if(s[v])for(u=s[v].length,h=(x=t.Fb(v)).position+c+o,0!==x.oa&&(h+=x.Io(Math.max(g,f))),b=0;b<u;b++)if(s[v][b]){a=(w=t.Eb(b)).position+d+r,0!==w.oa&&(a+=w.Io(Math.max(m,p)));for(var k=s[v][b],S=k.length,M=0;M<S;M++){var C=k[M],P=C.measuredBounds;y.h(0,0);for(var T=1;T<C.rowSpan&&!(v+T>=t.rowCount);T++){var N=t.Fb(v+T);0!==N.oa&&(y.height+=N.total)}for(T=1;T<C.columnSpan&&!(b+T>=t.columnCount);T++)0!==(N=t.Eb(b+T)).oa&&(y.width+=N.total);var L=w.oa+y.width,A=x.oa+y.height;T=a,N=h;var B=L,D=A,F=a,j=h,E=L,O=A;a+L>i.width&&(E=Math.max(i.width-a,0)),h+A>i.height&&(O=Math.max(i.height-h,0));var I=C.alignment;if(I.Xb()){(I=t.defaultAlignment).sb()||(I=oe);var z=I.x,R=I.y,V=I.offsetX;I=I.offsetY;var G=w.alignment,H=x.alignment;G.sb()&&(z=G.x,V=G.offsetX),H.sb()&&(R=H.y,I=H.offsetY)}else z=I.x,R=I.y,V=I.offsetX,I=I.offsetY;(isNaN(z)||isNaN(R))&&(R=z=.5,I=V=0),G=P.width,H=P.height;var Y=C.margin,X=Y.left+Y.right,U=Y.top+Y.bottom,q=Ks(C,x,w,!1);!isNaN(C.desiredSize.width)||q!==cs&&q!==ps||(G=Math.max(L-X,0)),!isNaN(C.desiredSize.height)||q!==cs&&q!==gs||(H=Math.max(A-U,0)),L=C.maxSize,A=C.minSize,G=Math.min(L.width,G),H=Math.min(L.height,H),G=Math.max(A.width,G),L=(H=Math.max(A.height,H))+U,T+=B*z-(G+X)*z+V+Y.left,N+=D*R-L*R+I+Y.top,C.visible&&(Yt(F,j,E,O,T,N,P.width,P.height)?C.arrange(T,N,G,H):C.arrange(T,N,G,H,new jt(F,j,E,O)))}}for(At.free(y),t=0;t<n;t++)null!==(r=(i=e[t])instanceof Th?i:null)&&Vh(r)&&(r=i.actualBounds,i.naturalBounds.ka(),i.naturalBounds.h(0,0,r.width,r.height),i.naturalBounds.freeze())}},c(xh,ch),xh.prototype.measure=function(){},xh.prototype.arrange=function(){},c(bh,ch),bh.prototype.measure=function(){},bh.prototype.arrange=function(){},c(wh,ch),wh.prototype.measure=function(t,e,i,n,o,r,s){1<n.length&&w("Viewbox Panel cannot contain more than one GraphObject."),(n=n[0]).Ca=1,n.Uj(),n.measure(1/0,1/0,r,s);var a=n.measuredBounds,h=n.margin,l=h.right+h.left;if(h=h.top+h.bottom,isFinite(e)||isFinite(i)){var u=n.scale,c=a.width;a=a.height;var d=Math.max(e-l,0),f=Math.max(i-h,0),p=1;t.viewboxStretch===fs?0!==c&&0!==a&&(p=Math.min(d/c,f/a)):0!==c&&0!==a&&(p=Math.max(d/c,f/a)),0===p&&(p=1e-4),n.Ca*=p,u!==n.scale&&(ia(n,!0),n.measure(1/0,1/0,r,s))}a=n.measuredBounds,o.width=isFinite(e)?e:Math.max(a.width+l,0),o.height=isFinite(i)?i:Math.max(a.height+h,0)},wh.prototype.arrange=function(t,e,i){var n=(e=e[0]).measuredBounds,o=e.margin,r=Math.max(n.width+(o.right+o.left),0);o=Math.max(n.height+(o.top+o.bottom),0);var s=e.alignment;s.Xb()&&(s=t.defaultAlignment),s.sb()||(s=oe),e.arrange(i.width*s.x-r*s.x+s.offsetX,i.height*s.y-o*s.y+s.offsetY,n.width,n.height)},c(kh,ch),kh.prototype.measure=function(){},kh.prototype.arrange=function(){},kh.prototype.gc=function(t,e,i){0>=(i=t.Df()*i.scale)&&(i=1);var n=t.gridCellSize,o=n.width;n=n.height;var r=t.naturalBounds,s=t.actualBounds,a=r.width,h=r.height,l=Math.ceil(a/o),u=Math.ceil(h/n),c=t.gridOrigin,d=c.x;c=c.y,e.save(),e.beginPath(),e.rect(0,0,a,h),e.clip(),e.Se();for(var f=[],p=t.O.s,g=p.length,m=0;m<g;m++){var y=p[m],v=[];if(f.push(v),y.visible){var x=y.interval;if(!(0>x)){y=Dh(y.figure);for(var b=0;b<g;b++)if(b!==m){var w=p[b];w.visible&&Dh(w.figure)===y&&((w=w.interval)>x&&v.push(w))}}}}for(g=(p=t.O.s).length,m=0;m<g;m++){var k=p[m];if(k.visible&&(v=k.interval||1,!(2>o*(y=Math.abs(v))*i))){if(x=k.segmentIndex,isFinite(x)&&!isNaN(x)||(x=0),0>x&&(x=y-Math.min(-x,y)),x=Math.round(x%y),b=1,1!==(y=k.opacity)){if(0===y)continue;b=e.globalAlpha,e.globalAlpha=b*y}w=f[m];var S=!1,M=k.strokeDashArray;if(null!==M&&(S=!0,e.js(M,k.strokeDashOffset)),"LineV"===k.figure&&null!==k.stroke&&0<k.strokeWidth){for(e.lineWidth=k.strokeWidth,Xs(t,e,k.stroke,!1,!1,r,s),e.beginPath(),M=k=Math.floor((d-o)/o);M<=k+l;M++){var C=M*o+d;0<=C&&C<=a&&Sh(M,v,x,w)&&(e.moveTo(C,0),e.lineTo(C,h))}e.stroke(),e.Se()}else if("LineH"===k.figure&&null!==k.stroke&&0<k.strokeWidth){for(e.lineWidth=k.strokeWidth,Xs(t,e,k.stroke,!1,!1,r,s),e.beginPath(),M=k=Math.floor((c-n)/n);M<=k+u;M++)0<=(C=M*n+c)&&C<=h&&Sh(M,v,x,w)&&(e.moveTo(0,C),e.lineTo(a,C));e.stroke(),e.Se()}else if("BarV"===k.figure&&null!==k.fill)for(Xs(t,e,k.fill,!0,!1,r,s),k=k.width,isNaN(k)&&(k=o),C=M=Math.floor((d-o)/o);C<=M+l;C++){var P=C*o+d;0<=P+k&&P<=a&&Sh(C,v,x,w)&&e.fillRect(P,0,k,h)}else if("BarH"===k.figure&&null!==k.fill)for(Xs(t,e,k.fill,!0,!1,r,s),k=k.height,isNaN(k)&&(k=n),C=M=Math.floor((c-n)/n);C<=M+u;C++)0<=(P=C*n+c)+k&&P<=h&&Sh(C,v,x,w)&&e.fillRect(0,P,a,k);S&&e.fs(),1!==y&&(e.globalAlpha=b)}}e.restore(),e.Vc(!1)},c(Mh,ch),Mh.prototype.measure=function(t,e,i,n,o){var r=n.length;if(t instanceof Wu||t instanceof wc){var s=null,a=null;if(t instanceof wc&&(s=t),t instanceof Wu&&(s=(a=t).adornedPart,null===t.j&&(t.j=[])),s instanceof wc){var h=s;if(0===r)Et(t.naturalBounds,0,0),t.measuredBounds.h(0,0,0,0);else{var l=t instanceof Wu?null:s.path;e=s.routeBounds,(i=t.jg).h(0,0,e.width,e.height);var u=h.points,c=s.pointsCount;null!==a?a.Ul(!1):null!==s&&s.Ul(!1),a=e.width;var d=e.height,f=t.j;if(f.length=0,null!==l){Ch(t,a,d,l);var p=l.measuredBounds;i.ed(p),f.push(p)}p=Ge.alloc();for(var g=pt.alloc(),m=pt.alloc(),y=0;y<r;y++){var v=n[y];if(v!==l)if(v.isPanelMain&&v instanceof pl){Ch(t,a,d,v);var x=v.measuredBounds;i.ed(x),f.push(x)}else if(2>c)v.measure(1/0,1/0,0,0),x=v.measuredBounds,i.ed(x),f.push(x);else{var b=v.segmentIndex,w=v.segmentFraction,k=v.alignmentFocus;k.Mc()&&(k=oe);var S=v.segmentOrientation,M=v.segmentOffset;if(isNaN(b)){var C=h.ua;x=A(),C.Qu(w,x);var P=pt.allocAt(x[0],x[1]);if(P.add(h.i(0)),C.type===Xe.j?P.offset(-C.startX,-C.startY):null!==(C=C.figures.first())&&P.offset(-C.startX,-C.startY),C=x[2],S!==Kc){var T=h.computeAngle(v,S,C);v.Kb=T}T=P.x-e.x;var N=P.y-e.y;pt.free(P),B(x)}else if(b<-c||b>=c)x=pt.alloc(),h.vg(),h.computeMidPoint(x),C=h.midAngle,S!==Kc&&(T=h.computeAngle(v,S,C),v.Kb=T),T=x.x-e.x,N=x.y-e.y,pt.free(x);else{if(T=0,0<=b?(N=u.M(b),x=b<c-1?u.M(b+1):N):(T=c+b,N=u.M(T),x=0<T?u.M(T-1):N),N.Xa(x)){0<=b?(C=0<b?u.M(b-1):N,T=b<c-2?u.M(b+2):x):(C=T<c-1?u.M(T+1):N,T=1<T?u.M(T-2):x),P=C.Bf(N);var L=x.Bf(T);C=P>L+10?0<=b?C.ab(N):N.ab(C):L>P+10?0<=b?x.ab(T):T.ab(x):0<=b?C.ab(T):T.ab(C)}else C=0<=b?N.ab(x):x.ab(N);S!==Kc&&(T=h.computeAngle(v,S,C),v.Kb=T),T=N.x+(x.x-N.x)*w-e.x,N=N.y+(x.y-N.y)*w-e.y}v.measure(1/0,1/0,0,0),x=v.measuredBounds,P=v.naturalBounds;var D=0;v instanceof pl&&(D=v.strokeWidth),L=P.width+D;var F=P.height+D;p.reset(),p.translate(-x.x,-x.y),p.scale(v.scale,v.scale),p.rotate(S===Kc?v.angle:C,L/2,F/2),S!==id&&S!==sd||p.rotate(90,L/2,F/2),S!==nd&&S!==ad||p.rotate(-90,L/2,F/2),S===hd&&(45<C&&135>C||225<C&&315>C)&&p.rotate(-C,L/2,F/2),P=new jt(0,0,L,F),g.xi(P,k),p.Ga(g),k=-g.x+D/2*v.scale,v=-g.y+D/2*v.scale,m.assign(M),D=isNaN(M.x);var j=isNaN(M.y);if(D||j){L=L/2+3,F=F/2+3;var E=45<=C&&135>=C,O=225<=C&&315>=C;S===Kc&&(E||O)?(m.x=j?L:M.y,m.y=D?F:M.x,E?0<=b||isNaN(b)&&.5>w||!D||(m.y=-F):O&&((0<=b||isNaN(b)&&.5>w)&&D&&(m.y=-F),j&&(m.x=-L))):(D&&(m.x=0<=b||isNaN(b)&&.5>w?L:-L),j&&(m.y=-F),m.rotate(C))}else m.rotate(C);T+=m.x,N+=m.y,P.set(x),P.h(T+k,N+v,x.width,x.height),f.push(P),i.ed(P)}}if(null!==s)for(n=s.labelNodes;n.next();)n.value.measure(1/0,1/0);t.jg=i,t.position.h(e.x+i.x,e.y+i.y),Et(o,i.width||0,i.height||0),Ge.free(p),pt.free(g),pt.free(m)}}}},Mh.prototype.arrange=function(t,e){var i=e.length;if(t instanceof Wu||t instanceof wc){var n=t,o=null;t instanceof Wu&&(n=(o=t).adornedPart);var r=t instanceof Wu?null:n.path,s=t.j;if(0!==s.length){var a=0;if(null!==r&&a<s.length){var h=s[a];a++,r.arrange(h.x-t.jg.x,h.y-t.jg.y,h.width,h.height)}for(h=0;h<i;h++){var l=e[h];if(l!==r&&a<s.length){var u=s[a];a++,l.arrange(u.x-t.jg.x,u.y-t.jg.y,u.width,u.height)}}}if(2<=(i=(e=n.points).count)&&t instanceof wc)for(r=t.labelNodes;r.next();){var c=t;a=(s=r.value).segmentIndex,h=s.segmentFraction;var d=s.alignmentFocus;if(l=s.segmentOrientation,u=s.segmentOffset,isNaN(a)){var f=c.ua,p=A();f.Qu(h,p);var g=pt.allocAt(p[0],p[1]);g.add(c.i(0)),f.type===Xe.j||(f=f.figures.first()),g.offset(-f.startX,-f.startY),f=p[2],l!==Kc&&(c=c.computeAngle(s,l,f),s.angle=c),c=g.x;var m=g.y;pt.free(g),B(p)}else if(a<-i||a>=i)m=p=pt.alloc(),(f=c).vg(),f.computeMidPoint(m),f=c.midAngle,l!==Kc&&(c=c.computeAngle(s,l,f),s.angle=c),c=p.x,m=p.y,pt.free(p);else{if(g=0,0<=a?(p=e.s[a],m=a<i-1?e.s[a+1]:p):(g=i+a,p=e.s[g],m=0<g?e.s[g-1]:p),p.Xa(m)){0<=a?(f=0<a?e.s[a-1]:p,g=a<i-2?e.s[a+2]:m):(f=g<i-1?e.s[g+1]:p,g=1<g?e.s[g-2]:m);var y=f.Bf(p),v=m.Bf(g);f=y>v+10?0<=a?f.ab(p):p.ab(f):v>y+10?0<=a?m.ab(g):g.ab(m):0<=a?f.ab(g):g.ab(f)}else f=0<=a?p.ab(m):m.ab(p);l!==Kc&&(c=c.computeAngle(s,l,f),s.angle=c),c=p.x+(m.x-p.x)*h,m=p.y+(m.y-p.y)*h}if(d.ys())s.location=new pt(c,m);else{d.Mc()&&(d=oe),(p=Ge.alloc()).reset(),p.scale(s.scale,s.scale),p.rotate(s.angle,0,0);var x=s.naturalBounds;g=jt.allocAt(0,0,x.width,x.height),(y=pt.alloc()).xi(g,d),p.Ga(y),d=-y.x,v=-y.y;var b=x.width,w=x.height;(x=pt.alloc()).assign(u);var k=isNaN(u.x),S=isNaN(u.y);if(k||S){b=b/2+3,w=w/2+3;var M=45<=f&&135>=f,C=225<=f&&315>=f;l===Kc&&(M||C)?(x.x=S?b:u.y,x.y=k?w:u.x,M?0<=a||isNaN(a)&&.5>h||!k||(x.y=-w):C&&((0<=a||isNaN(a)&&.5>h)&&k&&(x.y=-w),S&&(x.x=-b))):(k&&(x.x=0<=a||isNaN(a)&&.5>h?b:-b),S&&(x.y=-w),x.rotate(f))}else x.rotate(f);c+=x.x,m+=x.y,p.pp(g),d+=g.x,v+=g.y,a=pt.allocAt(c+d,m+v),s.move(a),pt.free(a),pt.free(x),pt.free(y),jt.free(g),Ge.free(p)}}null!==o?o.Ul(!1):n.Ul(!1),n=Nu(t),t.location.h(t.position.x+n.x,t.position.y+n.y),pt.free(n)}},c(Ph,ch),Ph.prototype.measure=function(t,e,i,n,o,r,s){var a=t.Pb();t.graduatedBounds=[];var h=a.margin,l=h.right+h.left,u=h.top+h.bottom;a.measure(e,i,r,s);var c=a.measuredBounds,d=new jt(-h.left,-h.top,Math.max(c.width+l,0),Math.max(c.height+u,0));t.graduatedBounds.push(d),o.assign(d);for(var f=a.geometry,p=a.strokeWidth,g=f.flattenedSegments,m=f.flattenedLengths,y=f.flattenedTotalLength,v=g.length,x=0,b=0,w=A(),k=0;k<v;k++){var S=g[k],M=[];b=x=0;for(var C=S.length,P=0;P<C;P+=2){var T=S[P],N=S[P+1];if(0!==P){var L=180*Math.atan2(N-b,T-x)/Math.PI;0>L&&(L+=360),M.push(L)}x=T,b=N}w.push(M)}if(null===t.graduatedIntervals){for(var D=[],F=t.O.s,j=F.length,E=0;E<j;E++){var O=F[E],I=[];if(D.push(I),O.visible){var z=O.interval;if(!(0>z))for(var R=0;R<j;R++)if(R!==E){var V=F[R];if(V.visible&&O.constructor===V.constructor){var G=V.interval;G>z&&I.push(G)}}}}t.graduatedIntervals=D}var H=t.graduatedIntervals,Y=t.O.s,X=Y.length,U=0,q=0,W=y;t.graduatedMarks=[];for(var K,_=0;_<X;_++){var $=Y[_];if(K=[],$.visible&&$!==a){var J=Math.abs($.interval),Z=t.graduatedTickUnit;if(!(2>Z*J*y/t.graduatedRange&&null===$.graduatedSkip)){var Q=m[0][0],tt=0,et=0;q=y*$.graduatedStart-1e-4,W=y*$.graduatedEnd+1e-4;var it=Z*J,nt=t.graduatedTickBase;if(nt<t.graduatedMin){var ot=(t.graduatedMin-nt)/it;nt+=(ot=0==ot%1?ot:Math.floor(ot+1))*it}else nt>t.graduatedMin+it&&(nt-=Math.floor((nt-t.graduatedMin)/it)*it);for(var rt=H[_],st=nt,at=1e-6*t.graduatedMax,ht=1;nt<=t.graduatedMax+at;ht++){t:{for(var lt=rt.length,ut=0;ut<lt;ut++){var ct=(nt-t.graduatedTickBase)%(rt[ut]*t.graduatedTickUnit),dt=1e-6*t.graduatedTickUnit;if(ct<dt&&ct>-dt){var ft=!1;break t}}ft=!0}if(ft&&(nt>t.graduatedMax&&(nt=t.graduatedMax),null===$.graduatedSkip||$ instanceof Pl&&!$.graduatedSkip(nt,$)||$ instanceof pl&&!$.graduatedSkip(nt,$))&&((U=(nt-t.graduatedMin)*y/t.graduatedRange)>y&&(U=y),q<=U&&U<=W)){for(var gt=w[tt][et],mt=m[tt][et];tt<m.length;){for(;U>Q&&et<m[tt].length-1;)et++,gt=w[tt][et],Q+=mt=m[tt][et];if(U<=Q)break;et=0,gt=w[++tt][et],Q+=mt=m[tt][et]}var yt=g[tt],vt=yt[2*et],xt=yt[2*et+1],bt=(U-(Q-mt))/mt,wt=new pt(vt+(yt[2*et+2]-vt)*bt+p/2-f.bounds.x,xt+(yt[2*et+3]-xt)*bt+p/2-f.bounds.y);wt.scale(a.scale,a.scale);t:{var kt=gt,St=w[tt];if(!(.5005>bt&&.4995<bt)){var Mt=kt;if(.5>bt?0<et?Mt=St[et-1]:Ye.$(yt[0],yt[yt.length-2])&&Ye.$(yt[1],yt[yt.length-1])&&(Mt=St[St.length-1]):.5<bt&&(et+1<St.length?Mt=St[et+1]:Ye.$(yt[0],yt[yt.length-2])&&Ye.$(yt[1],yt[yt.length-1])&&(Mt=St[0])),kt!==Mt){var Ct=Math.abs(kt-Mt);if(180<Ct&&(kt<Mt?kt+=360:Mt+=360,Ct=Math.abs(kt-Mt)),5e-4>bt||.9995<bt){gt=(kt+Mt)/2%360;break t}if(10>Ct){var Pt=1-Math.abs(.5-bt);gt=(kt*Pt+Mt*(1-Pt))%360;break t}}}gt=kt}if($ instanceof Pl){var Tt="";null!==$.graduatedFunction?Tt=null!=(Tt=$.graduatedFunction(nt,$))?Tt.toString():"":Tt=(+nt.toFixed(2)).toString(),""!==Tt&&K.push({$l:wt,angle:gt,text:Tt})}else K.push({$l:wt,angle:gt})}nt=st+ht*it}}}t.graduatedMarks.push(K)}B(w);var Nt=t.graduatedMarks;if(null!==Nt)for(var Lt=n.length,At=0;At<Lt;At++){var Bt=n[At],Dt=Nt[At];if(Bt.visible&&Bt!==a&&0!==Dt.length){if(Bt instanceof pl){var Ft=t,Et=o,Ot=Bt.alignmentFocus;Ot.Mc()&&(Ot=ee);var It=Bt.angle;Bt.Kb=0,Bt.measure(1/0,1/0,0,0),Bt.Kb=It;var zt=Bt.measuredBounds,Rt=zt.width,Vt=zt.height,Gt=jt.allocAt(0,0,Rt,Vt),Yt=pt.alloc();Yt.xi(Gt,Ot),jt.free(Gt);for(var Xt=-Yt.x,Ut=-Yt.y,qt=new jt,Wt=Dt.length,Kt=0;Kt<Wt;Kt++)for(var _t=Dt[Kt],$t=_t.$l.x,Jt=_t.$l.y,Zt=_t.angle,Qt=0;4>Qt;Qt++){switch(Qt){case 0:Yt.h(Xt,Ut);break;case 1:Yt.h(Xt+Rt,Ut);break;case 2:Yt.h(Xt,Ut+Vt);break;case 3:Yt.h(Xt+Rt,Ut+Vt)}Yt.rotate(Zt+Bt.angle),Yt.offset($t,Jt),0===Kt&&0===Qt?qt.h(Yt.x,Yt.y,0,0):qt.Ye(Yt),Yt.offset(-$t,-Jt),Yt.rotate(-Zt-Bt.angle)}pt.free(Yt),null!==Ft.graduatedBounds&&Ft.graduatedBounds.push(qt),Ht(Et,qt.x,qt.y,qt.width,qt.height)}else if(Bt instanceof Pl){var te=t,ie=o;null===te.temporaryTextBlock&&(te.temporaryTextBlock=new Pl);var ne=te.temporaryTextBlock;Nl(ne,Bt);var oe=Bt.alignmentFocus;oe.Mc()&&(oe=ee);for(var re=Bt.segmentOrientation,se=Bt.segmentOffset,ae=new jt,he=0,le=0,ue=0,ce=0,de=0,fe=Dt.length,pe=0;pe<fe;pe++){var ge=Dt[pe];he=ge.$l.x,le=ge.$l.y,ue=ge.angle,de=ce=Bt.angle,re!==Kc&&(de=re===ed||re===rd?ue+Bt.angle:ue,ce=wc.computeAngle(re,de)),ne.Kb=ce,ne.text=ge.text||"",ne.measure(1/0,1/0,0,0);var me=ne.measuredBounds,ye=ne.naturalBounds,ve=ye.width,xe=ye.height,be=Ge.alloc();be.reset(),be.translate(-me.x,-me.y),be.scale(ne.scale,ne.scale),be.rotate(de,ve/2,xe/2),re!==id&&re!==sd||be.rotate(90,ve/2,xe/2),re!==nd&&re!==ad||be.rotate(-90,ve/2,xe/2),re===hd&&(45<ue&&135>ue||225<ue&&315>ue)&&be.rotate(-ue,ve/2,xe/2);var we=jt.allocAt(0,0,ve,xe),ke=pt.alloc();ke.xi(we,oe),be.Ga(ke);var Se=-ke.x,Me=-ke.y,Ce=pt.alloc();Ce.assign(se),isNaN(Ce.x)&&(Ce.x=ve/2+3),isNaN(Ce.y)&&(Ce.y=-(xe/2+3)),Ce.rotate(ue);var Pe=new jt(he+=Ce.x+Se,le+=Ce.y+Me,me.width,me.height),Te=new jt(me.x,me.y,me.width,me.height),Ne=new jt(ye.x,ye.y,ye.width,ye.height);ge.Sz=ce,ge.lineCount=ne.lineCount,ge.lines=[ne.Cb,ne.Ih,ne.df,ne.Le,ne.Qc,ne.Qb,ne.ze],ge.actualBounds=Pe,ge.measuredBounds=Te,ge.naturalBounds=Ne,0===pe?ae.assign(Pe):ae.ed(Pe),pt.free(Ce),pt.free(ke),jt.free(we),Ge.free(be)}null!==te.graduatedBounds&&te.graduatedBounds.push(ae),Ht(ie,ae.x,ae.y,ae.width,ae.height)}ia(Bt,!1)}}},Ph.prototype.arrange=function(t,e,i){if(null!==t.graduatedBounds){var n=t.Pb(),o=t.graduatedMarks;if(null!==o){var r=t.graduatedBounds,s=0,a=r[s];s++,null!==n&&n.arrange(a.x-i.x,a.y-i.y,a.width,a.height);for(var h=e.length,l=0;l<h;l++){var u=e[l];a=o[l],u.visible&&u!==n&&0!==a.length&&(a=r[s],s++,u.arrange(a.x-i.x,a.y-i.y,a.width,a.height))}t.graduatedBounds=null}}},Ph.prototype.gc=function(t,e,i){var n=i.$i;i.$i=!0;var o=t.naturalBounds,r=o.width,s=o.height;o=e instanceof va,e.save(),e.beginPath(),e.rect(-1,-1,r+1,s+1),e.clip(),e.Se(),(r=t.Pb()).gc(e,i),0>=(s=t.Df()*i.scale)&&(s=1);for(var a=r.actualBounds,h=t.O.s,l=t.graduatedMarks,u=h.length,c=0;c<u;c++){var d=h[c],f=l[c],p=f.length;if(d.visible&&d!==r&&0!==f.length)if(d instanceof pl){if(!(2>t.graduatedTickUnit*d.interval*r.geometry.flattenedTotalLength/t.graduatedRange*s&&null===d.graduatedSkip)){var g=d.measuredBounds,m=d.strokeWidth*d.scale,y=d.alignmentFocus;y.Mc()&&(y=ee);for(var v=0;v<p;v++){var x=f[v].$l,b=f[v].angle,w=y,k=d.Ab;k.reset(),k.translate(x.x+a.x,x.y+a.y),k.rotate(b+d.angle,0,0),k.translate(-g.width*w.x+w.offsetX+m/2,-g.height*w.y+w.offsetY+m/2),k.scale(d.scale,d.scale),Qs(d,!1),d.wh.set(d.Ab),d.Kk=d.scale,ta(d,!1),d.gc(e,i),o&&(t.svg.appendChild(d.svg),d.svg=null),d.Ab.reset()}}}else if(d instanceof Pl)for(null===t.temporaryTextBlock&&(t.temporaryTextBlock=new Pl),Nl(g=t.temporaryTextBlock,d),m=0;m<p;m++)(y=f[m]).actualBounds&&y.measuredBounds&&y.naturalBounds&&(g.ec=y.text||"",g.Kb=y.Sz||0,g.Gc=y.lineCount||0,void 0!==(v=y.lines)&&(g.Cb=v[0],g.Ih=v[1],g.df=v[2],g.Le=v[3],g.Qc=v[4],g.Qb=v[5],g.ze=v[6]),y.naturalBounds&&(g.dc=y.naturalBounds),y.actualBounds&&(v=y.actualBounds,g.arrange(v.x,v.y,v.width,v.height)),v=y.actualBounds,g.arrange(v.x,v.y,v.width,v.height),x=y.measuredBounds,y=y.naturalBounds,(b=g.Ab).reset(),b.translate(v.x+a.x,v.y+a.y),b.translate(-x.x,-x.y),g.no(b,y.x,y.y,y.width,y.height),Qs(g,!1),g.wh.set(g.Ab),g.Kk=g.scale,ta(g,!1),g.Ng=d.part,g.Me=d.panel,g.gc(e,i),g.Me=null,g.Ng=null,o&&(t.svg.appendChild(g.svg),g.svg=null))}i.$i=n,e.restore(),e.Vc(!0)},c(Th,Fs),Th.prototype.cloneProtected=function(t){Fs.prototype.cloneProtected.call(this,t),t.na=this.na,t.yb=this.yb.J(),t.Tm=this.Tm.J(),t.Uf=this.Uf,t.$e=this.$e,t.jg.assign(this.jg),null!==this.T&&(t.T=this.T.copy(t)),t.xo=this.xo,t.jn=this.jn.J(),t.kn=this.kn.J(),null!==this.ra&&(t.ra=this.ra.copy()),t.ub=this.ub,t.zn=this.zn,t.Hh=this.Hh},Th.prototype.Af=function(t){Fs.prototype.Af.call(this,t),t.O=this.O;for(var e=t.O.s,i=e.length,n=0;n<i;n++)e[n].Me=t;t.$g=null},Th.prototype.copy=function(){var t=Fs.prototype.copy.call(this);if(null!==t){for(var e=this.O.s,i=e.length,n=0;n<i;n++){var o=e[n].copy();o.wi(t),o.Ng=null;var r=t.O,s=r.count;if(r.Gb(s,o),null!==(r=t.part)){r.Rh=null,null!==o.portId&&r instanceof _u&&(r.Te=!0);var a=t.diagram;null!==a&&a.undoManager.isUndoingRedoing||r.cb(fi,"elements",t,null,o,null,s)}}return t}return null},(e=Th.prototype).toString=function(){return"Panel("+this.type.name+")#"+et(this)},e.Pn=function(t){Fs.prototype.Pn.call(this,t);for(var e=this.O.s,i=e.length,n=0;n<i;n++)e[n].Pn(t)},e.hh=function(t,e){if(this.na===Th.Grid)t.yc(),this.na.gc(this,t,e);else if(this.na===Th.Graduated)t.yc(),this.na.gc(this,t,e);else{if(this.na===Th.Table)if(t.yc(),t instanceof va){var i=t.yd;t.yd=Na(t,"gojs-ts"),Nh(this,t),t.nh.pop(),t.yd=i}else Nh(this,t);(i=this.isClipping&&this.na===Th.Spot)&&t.save();for(var n=this.Pb(),o=this.O.s,r=o.length,s=0;s<r;s++){var a=o[s];i&&a===n&&(t.clipInsteadOfFill=!0),a.gc(t,e),i&&a===n&&(t.clipInsteadOfFill=!1)}i&&(t.restore(),t.Vc(!0))}},e.lv=function(){for(var t=this.O.s,e=t.length,i=0;i<e;i++)t[i].lv();this.Uc=!0},e.kk=function(t,e,i){if(!Fs.prototype.kk.call(this,t,e,i))return!1;if(this.type===Th.Table)null!==(i=0!==(i=this.svg.getElementsByClassName("gojs-ts")).length?i[0]:null)&&(i.innerHTML=""),t.yd=i,Nh(this,t),t.yd=null;else if(this.na===Th.Grid||this.na===Th.Graduated)return this.svg.innerHTML="",this.svg.remove(),!1;for(var n=(i=this.O.s).length,o=0;o<n;o++)i[o].gc(t,e);return!0},e.nk=function(){return!0},e.$o=function(t,e,i,n){if(!this.isClipping)if(this.Dd()&&null!==t.bk){t=t.bk,e=this.O.s;for(var o=0,r=0,s=0;s<e.length;s++)if(e[s].Ed()){var a=e[s].actualBounds;o=0===s?a.x:Math.min(a.x,o),r=0===s?a.y:Math.min(a.y,r)}n.setAttributeNS(null,"clip-path","path('M "+(t.x-i.x-o)+","+(t.y-i.y-r)+" l "+t.width+" 0 l 0 "+t.height+" l -"+t.width+" 0 z')")}else Fs.prototype.$o.call(this,t,e,i,n)},e.Sj=function(t,e,i,n,o){var r=this.se(),s=this.transform,a=1/(s.m11*s.m22-s.m12*s.m21),h=s.m22*a,l=-s.m12*a,u=-s.m21*a,c=s.m11*a,d=a*(s.m21*s.dy-s.m22*s.dx),f=a*(s.m12*s.dx-s.m11*s.dy);if(null!==this.areaBackground)return s=this.actualBounds,Ye.Ff(s.left,s.top,s.right,s.bottom,t,e,i,n,o);if(null!==this.background)return r=t*h+e*u+d,a=t*l+e*c+f,t=i*h+n*u+d,h=i*l+n*c+f,o.h(0,0),i=this.naturalBounds,r=Ye.Ff(0,0,i.width,i.height,r,a,t,h,o),o.transform(s),r;r||(h=1,u=l=0,c=1,f=d=0),a=t*h+e*u+d,t=t*l+e*c+f,h=i*h+n*u+d,i=i*l+n*c+f,o.h(h,i),n=(h-a)*(h-a)+(i-t)*(i-t),l=!1,f=(c=this.O.s).length,u=pt.alloc(),d=null,e=1/0;var p=null,g=this.isClipping&&this.na===Th.Spot;g&&(p=pt.alloc(),(l=(d=this.Pb()).Sj(a,t,h,i,p))&&(e=(a-p.x)*(a-p.x)+(t-p.y)*(t-p.y)));for(var m=0;m<f;m++){var y=c[m];y.visible&&y!==d&&y.Sj(a,t,h,i,u)&&(l=!0,(y=(a-u.x)*(a-u.x)+(t-u.y)*(t-u.y))<n&&(n=y,o.set(u)))}return g&&(e>n&&o.set(p),pt.free(p)),pt.free(u),r&&o.transform(s),l},e.Gj=function(){for(var t=this.O.s,e=t.length,i=0;i<e;i++)t[i].Gj();Fs.prototype.Gj.call(this)},e.v=function(t){if(!ea(this)){Fs.prototype.v.call(this,t),t=null,this.na!==Th.Auto&&this.na!==Th.Link||(t=this.Pb());for(var e=this.O.s,i=e.length,n=0;n<i;n++){var o=e[n];if((o===t||o.isPanelMain)&&o.v(!0),!o.desiredSize.w()){var r=Ws(o,!1);(o instanceof bc||o instanceof Th||o instanceof Pl||r!==ds)&&o.v(!0)}}}},e.Uj=function(){if(!ea(this)){ia(this,!0),oa(this,!0);for(var t=this.O.s,e=t.length,i=0;i<e;i++)t[i].Uj()}},e.Uk=function(){if(0!=(2048&this.l)==!1){Qs(this,!0),ta(this,!0);for(var t=this.O.s,e=t.length,i=0;i<e;i++)t[i].Wu()}},e.Wu=function(){ta(this,!0);for(var t=this.O.s,e=t.length,i=0;i<e;i++)t[i].Wu()},e.Wl=function(t,e,i,n){var o=this.jg;o.h(0,0,0,0);var r=this.desiredSize,s=this.minSize;void 0===i&&(i=s.width,n=s.height),i=Math.max(i,s.width),n=Math.max(n,s.height);var a=this.maxSize;isNaN(r.width)||(t=Math.min(r.width,a.width)),isNaN(r.height)||(e=Math.min(r.height,a.height)),t=Math.max(i,t),e=Math.max(n,e);var h=this.yb;t=Math.max(t-h.left-h.right,0),e=Math.max(e-h.top-h.bottom,0);var l=this.O.s;0!==l.length&&this.na.measure(this,t,e,l,o,i,n),t=o.width+h.left+h.right,h=o.height+h.top+h.bottom,isFinite(r.width)&&(t=r.width),isFinite(r.height)&&(h=r.height),t=Math.min(a.width,t),h=Math.min(a.height,h),t=Math.max(s.width,t),h=Math.max(s.height,h),Et(o,t=Math.max(i,t),h=Math.max(n,h)),Et(this.naturalBounds,t,h),this.Ge(0,0,t,h)},e.Pb=function(){if(null===this.$g){var t=this.O.s,e=t.length;if(0===e)return null;for(var i=0;i<e;i++){var n=t[i];if(!0===n.isPanelMain)return this.$g=n}this.$g=t[0]}return this.$g},e.eh=function(t,e,i,n){var o=this.O.s;if(this.actualBounds.h(t,e,i,n),0!==o.length){if(!this.desiredSize.w()){t=Ws(this,!0);var r=this.measuredBounds;e=r.width,r=r.height;var s=this.Kg,a=s.left+s.right;switch(s=s.top+s.bottom,e===i&&r===n&&(t=ds),t){case ds:(e>i||r>n)&&(this.v(),this.measure(e>i?i:e,r>n?n:r,0,0));break;case cs:this.v(!0),this.measure(i+a,n+s,0,0);break;case ps:this.v(!0),this.measure(i+a,r+s,0,0);break;case gs:this.v(!0),this.measure(e+a,n+s,0,0)}}this.na.arrange(this,o,this.jg)}},e.gh=function(t){var e=this.naturalBounds,i=Fh(this);if(Yt(0,0,e.width,e.height,t.x,t.y)){for(var n=(e=this.O.s).length,o=pt.allocAt(0,0);n--;){var r=e[n];if((r.visible||r===i)&&(vt(o.set(t),r.transform),r.ca(o)))return pt.free(o),!0}return pt.free(o),null!==this.Ma||null!==this.areaBackground}return!1},e.ks=function(t){if(this.bindingId===t)return this;for(var e=this.O.s,i=e.length,n=0;n<i;n++){var o=e[n].ks(t);if(null!==o)return o}return null},e.qm=function(t,e){if(e(this,t),t instanceof Th)for(var i=(t=t.O.s).length,n=0;n<i;n++)this.qm(t[n],e)},e.Nl=function(t){return zh(this,this,t)},e.fb=function(t){if(this.name===t)return this;var e=this.O.s,i=e.length;null===this.Hh&&null===this.itemTemplateMap||(i=_h(this));for(var n=0;n<i;n++){var o=e[n];if(o instanceof Th){var r=o.fb(t);if(null!==r)return r}if(o.name===t)return o}return null},e.se=function(){return!(this.type===Th.TableRow||this.type===Th.TableColumn)},e.ic=function(t,e,i){if(!1===this.pickable)return null;if(void 0===e&&(e=null),void 0===i&&(i=null),na(this))return null;var n=this.naturalBounds,o=1/this.Df(),r=this.se(),s=r?t:vt(pt.allocAt(t.x,t.y),this.transform),a=this.diagram,h=10,l=5;if(null!==a&&(l=(h=a.Ql("extraTouchArea"))/2),Yt(-l*o,-l*o,n.width+h*o,n.height+h*o,s.x,s.y)){if(!this.isAtomic){var u=(o=this.O.s).length;if(a=pt.alloc(),l=(h=this.isClipping&&this.na===Th.Spot)?this.Pb():null,h&&(l.se()?vt(a.set(t),l.transform):a.set(t),!l.ca(a)))return pt.free(a),r||pt.free(s),null;for(var c=Fh(this);u--;){var d=o[u];if((d.visible||d===c)&&(d.se()?vt(a.set(t),d.transform):a.set(t),!h||d!==l)){var f=null;if(d instanceof Th?f=d.ic(a,e,i):!0===d.pickable&&d.ca(a)&&(f=d),null!==f&&(null!==e&&(f=e(f)),null!==f&&(null===i||i(f))))return pt.free(a),r||pt.free(s),f}}pt.free(a)}return null===this.background&&null===this.areaBackground?(r||pt.free(s),null):(t=Yt(0,0,n.width,n.height,s.x,s.y)?this:null,r||pt.free(s),t)}return r||pt.free(s),null},e.ji=function(t,e,i,n){if(!1===this.pickable)return!1;void 0===e&&(e=null),void 0===i&&(i=null);var o=this.naturalBounds,r=this.se(),s=r?t:vt(pt.allocAt(t.x,t.y),this.transform);if(o=Yt(0,0,o.width,o.height,s.x,s.y),Vh(this)||o){if(!this.isAtomic){for(var a=this.O.s,h=a.length,l=pt.alloc(),u=Fh(this);h--;){var c=a[h];if(c.visible||c===u){c.se()?vt(l.set(t),c.transform):l.set(t);var d=c;(null!==(c=c instanceof Th?c:null)?c.ji(l,e,i,n):d.ca(l))&&!1!==d.pickable&&(null!==e&&(d=e(d)),null===d||null!==i&&!i(d)||n.add(d))}}pt.free(l)}return r||pt.free(s),o&&(null!==this.background||null!==this.areaBackground)}return r||pt.free(s),!1},e.Cf=function(t,e,i,n,o,r){if(!1===this.pickable)return!1;void 0===e&&(e=null),void 0===i&&(i=null);var s=r;if(void 0===r&&(s=Ge.alloc()).reset(),s.multiply(this.transform),this.fh(t,s))return Gh(this,e,i,o),void 0===r&&Ge.free(s),!0;if(this.Yc(t,s)){if(!this.isAtomic)for(var a=Fh(this),h=this.O.s,l=h.length;l--;){var u=h[l];if(u.visible||u===a){var c=u.actualBounds,d=this.naturalBounds;c.x>d.width||c.y>d.height||0>c.x+c.width||0>c.y+c.height||(c=u,u=u instanceof Th?u:null,(d=Ge.alloc()).set(s),(null!==u?u.Cf(t,e,i,n,o,d):Os(c,t,n,d))&&(null!==e&&(c=e(c)),null===c||null!==i&&!i(c)||o.add(c)),Ge.free(d))}}return void 0===r&&Ge.free(s),n}return void 0===r&&Ge.free(s),!1},e.og=function(t,e,i,n,o,r){if(!1===this.pickable)return!1;void 0===i&&(i=null),void 0===n&&(n=null);var s=this.naturalBounds,a=this.se(),h=a?t:vt(pt.allocAt(t.x,t.y),this.transform),l=a?e:vt(pt.allocAt(e.x,e.y),this.transform),u=h.Bf(l),c=0<h.x&&h.x<s.width&&0<h.y&&h.y<s.height||xt(h.x,h.y,0,0,0,s.height)<=u||xt(h.x,h.y,0,s.height,s.width,s.height)<=u||xt(h.x,h.y,s.width,s.height,s.width,0)<=u||xt(h.x,h.y,s.width,0,0,0)<=u;if(s=h.zd(0,0)<=u&&h.zd(0,s.height)<=u&&h.zd(s.width,0)<=u&&h.zd(s.width,s.height)<=u,a||(pt.free(h),pt.free(l)),c){if(!this.isAtomic){h=pt.alloc(),l=pt.alloc(),u=Fh(this);for(var d=this.O.s,f=d.length;f--;){var p=d[f];if(p.visible||p===u){var g=p.actualBounds,m=this.naturalBounds;a&&(g.x>m.width||g.y>m.height||0>g.x+g.width||0>g.y+g.height)||(p.se()?(g=p.transform,vt(h.set(t),g),vt(l.set(e),g)):(h.set(t),l.set(e)),g=p,(null!==(p=p instanceof Th?p:null)?p.og(h,l,i,n,o,r):g.tx(h,l,o))&&(null!==i&&(g=i(g)),null===g||null!==n&&!n(g)||r.add(g)))}}pt.free(h),pt.free(l)}return o?c:s}return!1},e.add=function(t){for(var e=[],i=0;i<arguments.length;++i)e[i]=arguments[i];for(i=0;i<e.length;i++)this.Gb(this.O.count,e[i]);return this},e.M=function(t){return this.O.M(t)},e.Gb=function(t,e){e instanceof ku&&w("Cannot add a Part to a Panel: "+e+"; use a Panel instead"),(this===e||this.rg(e))&&(this===e&&w("Cannot make a Panel contain itself: "+this.toString()),w("Cannot make a Panel indirectly contain itself: "+this.toString()+" already contains "+e.toString()));var i=e.panel;if(null!==i&&i!==this&&w("Cannot add a GraphObject that already belongs to another Panel to this Panel: "+e.toString()+", already contained by "+i.toString()+", cannot be shared by this Panel: "+this.toString()),this.na!==Th.Grid||e instanceof pl||w("Can only add Shapes to a Grid Panel, not: "+e),this.na!==Th.Graduated||e instanceof pl||e instanceof Pl||w("Can only add Shapes or TextBlocks to a Graduated Panel, not: "+e),e.wi(this),e.Ng=null,null!==this.itemArray){var n=e.data;null!==n&&"object"==typeof n&&(null===this.ge&&(this.ge=new ft),this.ge.add(n,e))}var o=this.O;if(n=-1,i===this){for(var r=-1,s=this.O.s,a=s.length,h=0;h<a;h++)if(s[h]===e){r=h;break}if(-1!==r){if(r===t||r+1>=o.count&&t>=o.count)return;o.mb(r),n=r}else w("element "+e.toString()+" has panel "+i.toString()+" but is not contained by it.")}(0>t||t>o.count)&&(t=o.count),o.Gb(t,e),(0===t||e.isPanelMain)&&(this.$g=null),ea(this)||this.v(),e.v(!1),(null!==e.portId||e instanceof Th&&!0===e.Te)&&(this.Te=!0),this.graduatedIntervals=null,this.If()||el(this,e,!1),null!==(i=this.part)&&(i.Rh=null,i.ag=NaN,this.Te&&i instanceof _u&&(i.Te=!0),i.Te&&i instanceof _u&&(i.wc=null),null!==(o=this.diagram)&&o.undoManager.isUndoingRedoing||(-1!==n&&i.cb(pi,"elements",this,e,null,n,null),i.cb(fi,"elements",this,null,e,null,t)))},e.remove=function(t){for(var e=this.O.s,i=e.length,n=-1,o=0;o<i;o++)if(e[o]===t){n=o;break}-1!==n&&this.pc(n,!0)},e.mb=function(t){0<=t&&this.pc(t,!0)},e.pc=function(t,e){var i=this.O,n=i.M(t);if(n.Ng=null,n.wi(null),null!==this.ge){var o=n.data;"object"==typeof o&&this.ge.remove(o)}i.mb(t),ia(this,!1),this.v(),this.$g===n&&(this.$g=null),this.graduatedIntervals=null;var r=this.part;null!==r&&(r.Rh=null,r.ag=NaN,r.Wb(),r instanceof _u&&(n instanceof Th?n.qm(n,(function(t,i){ac(r,i,e)})):ac(r,n,e)),null!==(i=this.diagram)&&i.undoManager.isUndoingRedoing||r.cb(pi,"elements",this,n,null,t,null))},e.Fb=function(t){0>t&&S(t,">= 0",Th,"getRowDefinition:idx"),t=Math.round(t);var e=this.rowDefs;if(void 0===e[t]){var i=new hl;i.wi(this),i.isRow=!0,i.index=t,e[t]=i,this.cb(fi,"rowdefs",this,null,i,null,t)}return e[t]},e.oA=function(t){if(0>t&&S(t,">= 0",Th,"removeRowDefinition:idx"),0!==this.rowCount){t=Math.round(t);var e=this.rowDefs,i=e[t];if(i){e[t]=void 0;for(var n=e.length-1;0<=n&&void 0===e[n--];)e.length--;this.cb(pi,"rowdefs",this,i,null,t,null),this.v()}}},e.Eb=function(t){0>t&&S(t,">= 0",Th,"getColumnDefinition:idx"),t=Math.round(t);var e=this.colDefs;if(void 0===e[t]){var i=new hl;i.wi(this),i.isRow=!1,i.index=t,e[t]=i,this.cb(fi,"coldefs",this,null,i,null,t)}return e[t]},e.jA=function(t){if(0>t&&S(t,">= 0",Th,"removeColumnDefinition:idx"),0!==this.columnCount){t=Math.round(t);var e=this.colDefs,i=e[t];if(i){e[t]=void 0;for(var n=e.length-1;0<=n&&void 0===e[n--];)e.length--;this.cb(pi,"coldefs",this,i,null,t,null),this.v()}}},e.Gy=function(t){var e=null;return t.isRow?e=this.Fb(t.index):t.isRow||(e=this.Eb(t.index)),e&&ll(e,t),this},e.Hy=function(t,e){return(t=this.Fb(t))&&ll(t,new hl(e)),this},e.By=function(t,e){return(t=this.Eb(t))&&ll(t,new hl(e)),this},e.nz=function(t){if(0>t||this.type!==Th.Table||0===this.rowCount)return-1;for(var e=0,i=this.rowDefs,n=i.length,o=this.topIndex;o<n;o++){var r=i[o];if(void 0!==r&&t<(e+=r.total))break}return o},e.fz=function(t){if(0>t||this.type!==Th.Table||0===this.columnCount)return-1;for(var e=0,i=this.colDefs,n=i.length,o=this.leftIndex;o<n;o++){var r=i[o];if(void 0!==r&&t<(e+=r.total))break}return o},e.Fz=function(t,e){if(void 0===e&&(e=new pt(NaN,NaN)),this.type!==Th.Graduated)return e.h(NaN,NaN),e;t=Math.min(Math.max(t,this.graduatedMin),this.graduatedMax);var i=this.Pb();return i.geometry.Pu((t-this.graduatedMin)/this.graduatedRange,e),i.transform.Ga(e)},e.Gz=function(t){if(this.type!==Th.Graduated)return NaN;var e=this.Pb();return e.transform.Cd(t),e.geometry.xx(t)*this.graduatedRange+this.graduatedMin},e.Uy=function(t){void 0===t&&(t=!1);var e=this.copy();return Oh(e,(function(t){t instanceof Th&&(t.allBindings=null,t.ub=null);var e=t.localBindings;null!==e&&(t.localBindings=null,e.each((function(e){t.bind(e.copy())}))),null!==(e=t.animationTriggers)&&(t.animationTriggers=null,e.each((function(e){t.Jv(e.value.copy())})))})),t&&Kh(e),e},e.La=function(t){var e=this.allBindings;if(null!==e)for(void 0===t&&(t=""),e=e.iterator;e.next();){var i=e.value,n=i.sourceProperty;if((""===t||""===n||n===t)&&(n=i.targetProperty,null!==i.converter||""!==n)){n=this.data;var o=i.sourceName;if(null!==o){if(""===o)n=this;else if("/"===o)n=this;else if("."===o)n=this;else if(".."===o)n=this;else if(null===(n=this.fb(o)))continue}else if(i.isToModel){if(null===(n=this.diagram))continue;n=n.model.modelData}var r=this,s=i.Ai;if(-1!==s){if(null===(r=this.ks(s)))continue}else null!==i.xd&&(r=i.xd);if("/"===o?n=r.part:"."===o?n=r:".."===o&&(n=r.panel),0!==(o=i.to)){if(!(r instanceof Th))continue;1===o?r=r.Eb(i.wl):2===o&&(r=r.Fb(i.wl))}void 0!==r&&i.Mv(r,n)}}},e.sx=function(t){return null==t||null===this.ge?null:this.ge.I(t)},e.mv=function(){for(var t=_h(this);this.O.length>t;)this.pc(this.O.length-1,!1);$h(this,this.itemArray)},d.Object.defineProperties(Th.prototype,{type:{get:function(){return this.na},set:function(t){var e=this.na;e!==t&&(this.na=t,this.isAtomic=this.na===Th.Grid,this.v(),this.g("type",e,t))}},elements:{get:function(){return this.O.iterator}},naturalBounds:{get:function(){return this.dc}},padding:{get:function(){return this.yb},set:function(t){"number"==typeof t?(0>t&&S(t,">= 0",Th,"padding"),t=new Kt(t)):(0>t.left&&S(t.left,">= 0",Th,"padding:value.left"),0>t.right&&S(t.right,">= 0",Th,"padding:value.right"),0>t.top&&S(t.top,">= 0",Th,"padding:value.top"),0>t.bottom&&S(t.bottom,">= 0",Th,"padding:value.bottom"));var e=this.yb;e.D(t)||(this.yb=t=t.J(),this.v(),this.g("padding",e,t))}},defaultAlignment:{get:function(){return this.Tm},set:function(t){var e=this.Tm;e.D(t)||(this.Tm=t=t.J(),this.v(),this.g("defaultAlignment",e,t))}},defaultStretch:{get:function(){return this.Uf},set:function(t){var e=this.Uf;e!==t&&(this.Uf=t,this.v(),this.g("defaultStretch",e,t))}},defaultSeparatorPadding:{get:function(){return null!==this.T?this.T.Qp:Jt},set:function(t){"number"==typeof t&&(t=new Kt(t));var e=this.defaultSeparatorPadding;e.D(t)||(t=t.J(),null===this.T&&(this.T=new al),this.T.Qp=t,this.v(),this.g("defaultSeparatorPadding",e,t))}},defaultRowSeparatorStroke:{get:function(){return null!==this.T?this.T.ia:null},set:function(t){var e=this.defaultRowSeparatorStroke;e!==t&&(null===t||"string"==typeof t||t instanceof Oa)&&(t instanceof Oa&&t.freeze(),null===this.T&&(this.T=new al),this.T.ia=t,this.N(),this.g("defaultRowSeparatorStroke",e,t))}},defaultRowSeparatorStrokeWidth:{get:function(){return null!==this.T?this.T.Ha:1},set:function(t){var e=this.defaultRowSeparatorStrokeWidth;e!==t&&isFinite(t)&&0<=t&&(null===this.T&&(this.T=new al),this.T.Ha=t,this.v(),this.g("defaultRowSeparatorStrokeWidth",e,t))}},defaultRowSeparatorDashArray:{get:function(){return null!==this.T?this.T.V:null},set:function(t){var e=this.defaultRowSeparatorDashArray;if(e!==t){if(null!==t){for(var i=t.length,n=0,o=0;o<i;o++){var r=t[o];"number"==typeof r&&0<=r&&isFinite(r)||w("defaultRowSeparatorDashArray value "+r+" at index "+o+" must be a positive number or zero."),n+=r}if(0===n){if(null===e)return;t=null}}null===this.T&&(this.T=new al),this.T.V=t,this.N(),this.g("defaultRowSeparatorDashArray",e,t)}}},defaultColumnSeparatorStroke:{get:function(){return null!==this.T?this.T.u:null},set:function(t){var e=this.defaultColumnSeparatorStroke;e!==t&&(null===t||"string"==typeof t||t instanceof Oa)&&(t instanceof Oa&&t.freeze(),null===this.T&&(this.T=new al),this.T.u=t,this.N(),this.g("defaultColumnSeparatorStroke",e,t))}},defaultColumnSeparatorStrokeWidth:{get:function(){return null!==this.T?this.T.F:1},set:function(t){var e=this.defaultColumnSeparatorStrokeWidth;e!==t&&isFinite(t)&&0<=t&&(null===this.T&&(this.T=new al),this.T.F=t,this.v(),this.g("defaultColumnSeparatorStrokeWidth",e,t))}},defaultColumnSeparatorDashArray:{get:function(){return null!==this.T?this.T.o:null},set:function(t){var e=this.defaultColumnSeparatorDashArray;if(e!==t){if(null!==t){for(var i=t.length,n=0,o=0;o<i;o++){var r=t[o];"number"==typeof r&&0<=r&&isFinite(r)||w("defaultColumnSeparatorDashArray value "+r+" at index "+o+" must be a positive number or zero."),n+=r}if(0===n){if(null===e)return;t=null}}null===this.T&&(this.T=new al),this.T.o=t,this.N(),this.g("defaultColumnSeparatorDashArray",e,t)}}},inRowsCols:{get:function(){return null!==this.T?this.T.nb:null},set:function(t){null===this.T&&(this.T=new al),this.T.nb=t}},viewboxStretch:{get:function(){return this.xo},set:function(t){var e=this.xo;e!==t&&(this.xo=t,this.v(),this.g("viewboxStretch",e,t))}},gridCellSize:{get:function(){return this.jn},set:function(t){var e=this.jn;if(!e.D(t)){t.w()&&0!==t.width&&0!==t.height||w("Invalid Panel.gridCellSize: "+t),this.jn=t.J();var i=this.diagram;null!==i&&this===i.grid&&yr(i),this.N(),this.g("gridCellSize",e,t)}}},gridOrigin:{get:function(){return this.kn},set:function(t){var e=this.kn;if(!e.D(t)){t.w()||w("Invalid Panel.gridOrigin: "+t),this.kn=t.J();var i=this.diagram;null!==i&&this===i.grid&&yr(i),this.N(),this.g("gridOrigin",e,t)}}},graduatedMin:{get:function(){return null!==this.ra?this.ra.lq:0},set:function(t){var e=this.graduatedMin;e!==t&&(null===this.ra&&(this.ra=new sl),this.ra.lq=t,this.v(),this.g("graduatedMin",e,t),Js(this)&&(null!==(t=this.part)&&Es(this,t,"graduatedRange")))}},graduatedMax:{get:function(){return null!==this.ra?this.ra.F:100},set:function(t){var e=this.graduatedMax;e!==t&&(null===this.ra&&(this.ra=new sl),this.ra.F=t,this.v(),this.g("graduatedMax",e,t),Js(this)&&(null!==(t=this.part)&&Es(this,t,"graduatedRange")))}},graduatedRange:{get:function(){return this.graduatedMax-this.graduatedMin}},graduatedTickUnit:{get:function(){return null!==this.ra?this.ra.ia:10},set:function(t){var e=this.graduatedTickUnit;e!==t&&0<t&&(null===this.ra&&(this.ra=new sl),this.ra.ia=t,this.v(),this.g("graduatedTickUnit",e,t))}},graduatedTickBase:{get:function(){return null!==this.ra?this.ra.V:0},set:function(t){var e=this.graduatedTickBase;e!==t&&(null===this.ra&&(this.ra=new sl),this.ra.V=t,this.v(),this.g("graduatedTickBase",e,t))}},graduatedMarks:{get:function(){return null!==this.ra?this.ra.u:null},set:function(t){null!==this.ra?this.ra.u=t:null!==t&&(this.ra=new sl,this.ra.u=t)}},graduatedBounds:{get:function(){return null!==this.ra?this.ra.j:null},set:function(t){null!==this.ra?this.ra.j=t:null!==t&&(this.ra=new sl,this.ra.j=t)}},graduatedIntervals:{get:function(){return null!==this.ra?this.ra.o:null},set:function(t){null!==this.ra?this.ra.o=t:null!==t&&(this.ra=new sl,this.ra.o=t)}},temporaryTextBlock:{get:function(){return null!==this.ra?this.ra.Zh:null},set:function(t){null!==this.ra?this.ra.Zh=t:null!==t&&(this.ra=new sl,this.ra.Zh=t)}},panelLayoutState:{get:function(){return this.F},set:function(t){this.F=t}},Te:{get:function(){return 0!=(8388608&this.l)},set:function(t){0!=(8388608&this.l)!==t&&(this.l^=8388608)}},rowDefs:{get:function(){return null===this.T&&(this.T=new al),this.T.Pc}},rowCount:{get:function(){return null===this.T?0:this.rowDefs.length}},colDefs:{get:function(){return null===this.T&&(this.T=new al),this.T.Oc}},columnCount:{get:function(){return null===this.T?0:this.colDefs.length}},rowSizing:{get:function(){return null!==this.T?this.T.ob:fl},set:function(t){var e=this.rowSizing;e!==t&&(null===this.T&&(this.T=new al),this.T.ob=t,this.v(),this.g("rowSizing",e,t))}},columnSizing:{get:function(){return null!==this.T?this.T.j:fl},set:function(t){var e=this.columnSizing;e!==t&&(null===this.T&&(this.T=new al),this.T.j=t,this.v(),this.g("columnSizing",e,t))}},topIndex:{get:function(){return null!==this.T?this.T.Hb:0},set:function(t){var e=this.topIndex;e!==t&&((!isFinite(t)||0>t)&&w("Panel.topIndex must be greater than zero and a real number, not: "+t),null===this.T&&(this.T=new al),this.T.Hb=t,this.v(),this.g("topIndex",e,t))}},leftIndex:{get:function(){return null!==this.T?this.T.hb:0},set:function(t){var e=this.leftIndex;e!==t&&((!isFinite(t)||0>t)&&w("Panel.leftIndex must be greater than zero and a real number, not: "+t),null===this.T&&(this.T=new al),this.T.hb=t,this.v(),this.g("leftIndex",e,t))}},data:{get:function(){return this.ub},set:function(t){var e=this.ub;if(e!==t){var i=this instanceof ku&&!(this instanceof Wu);Kh(this),this.ub=t;var n=this.diagram;null!==n&&(i?(i=n.partManager,this instanceof wc?(null!==e&&i.bf.remove(e),null!==t&&i.bf.add(t,this)):this instanceof ku&&(null!==e&&i.cf.remove(e),null!==t&&i.cf.add(t,this))):null!==(i=this.panel)&&null!==i.ge&&(null!==e&&i.ge.remove(e),null!==t&&i.ge.add(t,this))),this.g("data",e,t),null!==n&&n.undoManager.isUndoingRedoing||null!==t&&this.La()}}},itemIndex:{get:function(){return this.zn},set:function(t){var e=this.zn;e!==t&&(this.zn=t,this.g("itemIndex",e,t))}},allBindings:{get:function(){return null!==this.A?this.A.nb:null},set:function(t){this.localBindings!==t&&(null===this.A&&(this.A=new da),this.A.nb=t)}},itemArray:{get:function(){return this.Hh},set:function(t){var e=this.Hh;if(e!==t||null!==t&&function(t,e){for(var i=(t=t.O.s).length,n=e.length,o=0,r=null;o<i&&!((r=t[o])instanceof Th&&null!==r.data);)r=t[++o];if(i-o!==n)return!0;if(null===r)return 0<n;for(var s=0;o<i&&s<n;){if(!((r=t[o])instanceof Th)||r.data!==e[s])return!0;o++,s++}return!1}(this,t)){var i=this.diagram;e!==t&&(null!==i&&null!==e&&rf(i.partManager,this,i),this.Hh=t,null!==i&&null!==t&&of(i.partManager,this)),this.g("itemArray",e,t),null!==i&&i.undoManager.isUndoingRedoing||$h(this,t)}}},itemTemplate:{get:function(){return null===this.itemTemplateMap?null:this.itemTemplateMap.I("")},set:function(t){if(null===this.itemTemplateMap){if(null===t)return;this.itemTemplateMap=new ft}var e=this.itemTemplateMap.I("");e!==t&&((t instanceof ku||t.isPanelMain)&&w("Panel.itemTemplate must not be a Part or be Panel.isPanelMain: "+t),this.itemTemplateMap.add("",t),this.g("itemTemplate",e,t),null!==(t=this.diagram)&&t.undoManager.isUndoingRedoing||this.mv())}},itemTemplateMap:{get:function(){return null!==this.A?this.A.Pc:null},set:function(t){var e=this.itemTemplateMap;if(e!==t){for(var i=t.iterator;i.next(););js(this),this.A.Pc=t,this.g("itemTemplateMap",e,t),null!==(t=this.diagram)&&t.undoManager.isUndoingRedoing||this.mv()}}},itemCategoryProperty:{get:function(){return null!==this.A?this.A.Oc:"category"},set:function(t){var e=this.itemCategoryProperty;e!==t&&(js(this),this.A.Oc=t,this.g("itemCategoryProperty",e,t))}},isAtomic:{get:function(){return 0!=(1048576&this.l)},set:function(t){var e=0!=(1048576&this.l);e!==t&&(this.l^=1048576,this.g("isAtomic",e,t))}},isClipping:{get:function(){return 0!=(2097152&this.l)},set:function(t){var e=0!=(2097152&this.l);e!==t&&(this.l^=2097152,this instanceof gc&&(this.tb=null),this.v(),this.g("isClipping",e,t))}},isOpposite:{get:function(){return 0!=(33554432&this.l)},set:function(t){var e=0!=(33554432&this.l);e!==t&&(this.l^=33554432,this.v(),this.g("isOpposite",e,t))}},isEnabled:{get:function(){return 0!=(4194304&this.l)},set:function(t){var e=0!=(4194304&this.l);if(e!==t){var i=null===this.panel||this.panel.If();this.l^=4194304,this.g("isEnabled",e,t),null!==(e=this.diagram)&&e.undoManager.isUndoingRedoing||i&&el(this,this,t)}}},alignmentFocusName:{get:function(){return this.$e},set:function(t){var e=this.$e;e!==t&&(this.$e=t,this.v(),this.g("alignmentFocusName",e,t))}}}),d.Object.defineProperties(Th,{Position:{get:function(){return rl.I("Position")}},Horizontal:{get:function(){return rl.I("Horizontal")}},Vertical:{get:function(){return rl.I("Vertical")}},Spot:{get:function(){return rl.I("Spot")}},Auto:{get:function(){return rl.I("Auto")}},Table:{get:function(){return rl.I("Table")}},Viewbox:{get:function(){return rl.I("Viewbox")}},TableRow:{get:function(){return rl.I("TableRow")}},TableColumn:{get:function(){return rl.I("TableColumn")}},Link:{get:function(){return rl.I("Link")}},Grid:{get:function(){return rl.I("Grid")}},Graduated:{get:function(){return rl.I("Graduated")}}}),Th.prototype.rebuildItemElements=Th.prototype.mv,Th.prototype.findItemPanelForData=Th.prototype.sx,Th.prototype.updateTargetBindings=Th.prototype.La,Th.prototype.copyTemplate=Th.prototype.Uy,Th.prototype.graduatedValueForPoint=Th.prototype.Gz,Th.prototype.graduatedPointForValue=Th.prototype.Fz,Th.prototype.findColumnForLocalX=Th.prototype.fz,Th.prototype.findRowForLocalY=Th.prototype.nz,Th.prototype.addColumnDefinition=Th.prototype.By,Th.prototype.addRowDefinition=Th.prototype.Hy,Th.prototype.addRowColumnDefinition=Th.prototype.Gy,Th.prototype.removeColumnDefinition=Th.prototype.jA,Th.prototype.getColumnDefinition=Th.prototype.Eb,Th.prototype.removeRowDefinition=Th.prototype.oA,Th.prototype.getRowDefinition=Th.prototype.Fb,Th.prototype.removeAt=Th.prototype.mb,Th.prototype.remove=Th.prototype.remove,Th.prototype.insertAt=Th.prototype.Gb,Th.prototype.elt=Th.prototype.M,Th.prototype.add=Th.prototype.add,Th.prototype.findObject=Th.prototype.fb,Th.prototype.findInVisualTree=Th.prototype.Nl,Th.prototype.walkVisualTreeFrom=Th.prototype.qm,Th.prototype.findMainElement=Th.prototype.Pb;var nl=!1,ol=null,rl=new ft;function sl(){this.lq=0,this.F=100,this.ia=10,this.V=0,this.Zh=this.o=this.j=this.u=null}function al(){this.Pc=[],this.Oc=[],this.j=this.ob=fl,this.hb=this.Hb=0,this.Qp=Jt,this.Ha=1,this.V=this.ia=null,this.F=1,this.nb=this.o=this.u=null}function hl(t){Q(this),this.Me=null,this.uq=!0,this.Za=0,this.Hc=NaN,this.jj=0,this.hj=1/0,this.Jb=Me,this.pa=this.oc=this.oa=0,this.be=null,this.oo=cl,this.hg=ms,this.lo=this.dg=null,this.mo=NaN,this.Ma=this.tj=null,this.Pm=!1,t&&(Object.assign(this,t),void 0!==t.column?(this.isRow=!1,this.index=t.column):void 0!==t.row&&(this.isRow=!0,this.index=t.row))}function ll(t,e){e.isRow?t.height=e.height:t.width=e.width,t.minimum=e.minimum,t.maximum=e.maximum,t.alignment=e.alignment,t.stretch=e.stretch,t.sizing=e.sizing,t.dg=null===e.separatorPadding?null:e.separatorPadding.J(),t.separatorStroke=e.separatorStroke,t.separatorStrokeWidth=e.separatorStrokeWidth,t.tj=null,e.separatorDashArray&&(t.tj=T(e.separatorDashArray)),t.background=e.background,t.coversSeparators=e.coversSeparators,t.be=e.be}function ul(t){if(t.sizing===cl){var e=t.Me;return t.isRow?e.rowSizing:e.columnSizing}return t.sizing}Th.className="Panel",Th.definePanelLayout=il,il("Position",new dh),il("Vertical",new ph),il("Auto",new yh),il("Link",new Mh),sl.prototype.copy=function(){var t=new sl;return t.lq=this.lq,t.F=this.F,t.ia=this.ia,t.V=this.V,t.u=this.u,t.j=this.j,t.o=this.o,t.Zh=this.Zh,t},sl.className="GradPanelSettings",al.prototype.copy=function(t){for(var e=new al,i=this.Pc,n=i.length,o=e.Pc,r=0;r<n;r++)if(void 0!==i[r]){var s=i[r].copy();s.wi(t),o[r]=s}for(n=(i=this.Oc).length,o=e.Oc,r=0;r<n;r++)void 0!==i[r]&&((s=i[r].copy()).wi(t),o[r]=s);return e.ob=this.ob,e.j=this.j,e.Hb=this.Hb,e.hb=this.hb,e.Qp=this.Qp.J(),e.Ha=this.Ha,e.ia=this.ia,e.V=this.V,e.F=this.F,e.u=this.u,e.o=this.o,e.nb=this.nb,e},al.className="TablePanelSettings",hl.prototype.copy=function(){var t=new hl;return t.uq=this.uq,t.Za=this.Za,t.Hc=this.Hc,t.jj=this.jj,t.hj=this.hj,t.Jb=this.Jb,t.oa=this.oa,t.oc=this.oc,t.pa=this.pa,t.hg=this.hg,t.oo=this.oo,null===this.dg?t.dg=null:t.dg=this.dg.J(),t.lo=this.lo,t.mo=this.mo,t.tj=null,null!==this.tj&&(t.separatorDashArray=T(this.separatorDashArray)),t.Ma=this.Ma,t.Pm=this.Pm,t.be=this.be,t},(e=hl.prototype).qb=function(t){t.classType===hl&&(this.sizing=t)},e.toString=function(){return"RowColumnDefinition "+(this.isRow?"(Row ":"(Column ")+this.index+") #"+et(this)},e.wi=function(t){this.Me=t},e.Io=function(t){var e=0,i=this.Me;if(this.index!==t&&(null===(t=this.separatorStroke)&&null!==i&&(t=this.isRow?i.defaultRowSeparatorStroke:i.defaultColumnSeparatorStroke),null!==t&&(e=this.separatorStrokeWidth,isNaN(e)&&(e=null!==i?this.isRow?i.defaultRowSeparatorStrokeWidth:i.defaultColumnSeparatorStrokeWidth:0))),null===(t=this.dg)){if(null===i)return e;t=i.defaultSeparatorPadding}return e+(this.isRow?t.top:t.left)},e.Wc=function(){var t=0,e=this.Me,i=0,n=this.isRow;if(null!==e&&e.type===Th.Table)for(var o=n?e.rowDefs.length:e.colDefs.length,r=0;r<o;r++){var s=n?e.rowDefs[r]:e.colDefs[r];if(void 0!==s&&0!==s.oa){i=s.index;break}}if(this.index!==i&&(null===(i=this.separatorStroke)&&null!==e&&(i=n?e.defaultRowSeparatorStroke:e.defaultColumnSeparatorStroke),null!==i&&(t=this.separatorStrokeWidth,isNaN(t)&&(t=null!==e?n?e.defaultRowSeparatorStrokeWidth:e.defaultColumnSeparatorStrokeWidth:0))),null===(n=this.dg)){if(null===e)return t;n=e.defaultSeparatorPadding}return t+(this.isRow?n.top+n.bottom:n.left+n.right)},e.Ob=function(t,e,i){var n=this.Me;if(null!==n&&(n.cb(di,t,this,e,i,void 0,void 0),null!==this.be&&(null!==(e=n.diagram)&&!e.skipsModelSourceBindings&&(null!==(n=n.ih())&&null!==(e=n.data)))))for(i=this.be.iterator;i.next();)i.value.sp(this,e,t,n)},e.bind=function(t,e,i,n){var o=null;return(o="string"==typeof t?new Hf(t,e,i,n):t).xd=this,null!==(t=this.panel)&&(null!==(e=t.ih())&&Wh(e)&&w("Cannot add a Binding to a RowColumnDefinition that is already frozen: "+o+" on "+t)),null===this.be&&(this.be=new $),this.be.add(o),this},d.Object.defineProperties(hl.prototype,{panel:{get:function(){return this.Me}},isRow:{get:function(){return this.uq},set:function(t){this.uq=t}},index:{get:function(){return this.Za},set:function(t){this.Za=t}},height:{get:function(){return this.Hc},set:function(t){var e=this.Hc;e!==t&&(0>t&&S(t,">= 0",hl,"height"),this.Hc=t,this.actual=this.oa,null!==this.panel&&this.panel.v(),this.Ob("height",e,t))}},width:{get:function(){return this.Hc},set:function(t){var e=this.Hc;e!==t&&(0>t&&S(t,">= 0",hl,"width"),this.Hc=t,this.actual=this.oa,null!==this.panel&&this.panel.v(),this.Ob("width",e,t))}},minimum:{get:function(){return this.jj},set:function(t){var e=this.jj;e!==t&&((0>t||!isFinite(t))&&S(t,">= 0",hl,"minimum"),this.jj=t,this.actual=this.oa,null!==this.panel&&this.panel.v(),this.Ob("minimum",e,t))}},maximum:{get:function(){return this.hj},set:function(t){var e=this.hj;e!==t&&(0>t&&S(t,">= 0",hl,"maximum"),this.hj=t,this.actual=this.oa,null!==this.panel&&this.panel.v(),this.Ob("maximum",e,t))}},alignment:{get:function(){return this.Jb},set:function(t){var e=this.Jb;e.D(t)||(this.Jb=t.J(),null!==this.panel&&this.panel.v(),this.Ob("alignment",e,t))}},stretch:{get:function(){return this.hg},set:function(t){var e=this.hg;e!==t&&(this.hg=t,null!==this.panel&&this.panel.v(),this.Ob("stretch",e,t))}},separatorPadding:{get:function(){return this.dg},set:function(t){"number"==typeof t&&(t=new Kt(t));var e=this.dg;null!==t&&null!==e&&e.D(t)||(null!==t&&(t=t.J()),this.dg=t,null!==this.panel&&this.panel.v(),this.Ob("separatorPadding",e,t))}},separatorStroke:{get:function(){return this.lo},set:function(t){var e=this.lo;e!==t&&(null!==t&&Ka(t,"RowColumnDefinition.separatorStroke"),t instanceof Oa&&t.freeze(),this.lo=t,null!==this.panel&&this.panel.v(),this.Ob("separatorStroke",e,t))}},separatorStrokeWidth:{get:function(){return this.mo},set:function(t){var e=this.mo;e!==t&&(this.mo=t,null!==this.panel&&this.panel.v(),this.Ob("separatorStrokeWidth",e,t))}},separatorDashArray:{get:function(){return this.tj},set:function(t){var e=this.tj;if(e!==t){if(null!==t){for(var i=t.length,n=0,o=0;o<i;o++){var r=t[o];"number"==typeof r&&0<=r&&isFinite(r)||w("separatorDashArray value "+r+" at index "+o+" must be a positive number or zero."),n+=r}if(0===n){if(null===e)return;t=null}}this.tj=t,null!==this.panel&&this.panel.N(),this.Ob("separatorDashArray",e,t)}}},background:{get:function(){return this.Ma},set:function(t){var e=this.Ma;e!==t&&(null!==t&&Ka(t,"RowColumnDefinition.background"),t instanceof Oa&&t.freeze(),this.Ma=t,null!==this.panel&&this.panel.N(),this.Ob("background",e,t))}},coversSeparators:{get:function(){return this.Pm},set:function(t){var e=this.Pm;e!==t&&(this.Pm=t,null!==this.panel&&this.panel.N(),this.Ob("coversSeparators",e,t))}},sizing:{get:function(){return this.oo},set:function(t){var e=this.oo;e!==t&&(this.oo=t,null!==this.panel&&this.panel.v(),this.Ob("sizing",e,t))}},actual:{get:function(){return this.oa},set:function(t){this.oa=isNaN(this.Hc)?Math.max(Math.min(this.hj,t),this.jj):Math.max(Math.min(this.hj,this.Hc),this.jj)}},measured:{get:function(){return this.oc},set:function(t){this.oc=t}},total:{get:function(){return this.oa+this.Wc()}},position:{get:function(){return this.pa},set:function(t){this.pa=t}}}),hl.prototype.computeEffectiveSpacing=hl.prototype.Wc,hl.prototype.computeEffectiveSpacingTop=hl.prototype.Io;var cl=new V(hl,"Default",0),dl=new V(hl,"None",1),fl=new V(hl,"ProportionalExtra",2);function pl(t,e){Fs.call(this),this.Rd=this.ua=null,this.an="None",this.xc=this.Ui="black",this.ig=1,this.Na=this.Yg=null,this.Vn=this.Un=NaN,this.fa=null,"string"==typeof t?this.figure=t:t&&Object.assign(this,t),e&&Object.assign(this,e)}function gl(t){null===t.Na?t.Na=new Cl:t.Na.nc&&(t.Na=t.Na.copy())}function ml(t,e,i,n){var o=i.length;if(!(4>o)){var r=n.measuredBounds,s=Math.max(1,r.width);r=r.height;for(var a,h,l,u,c,d,f=i[0],p=i[1],g=0,m=A(),y=2;y<o;y+=2)0===(l=(a=i[y])-f)&&(l=.001),u=(f=(h=i[y+1])-p)/l,c=Math.atan2(f,l),d=Math.sqrt(l*l+f*f),m.push([l,c,u,d]),g+=d,f=a,p=h;f=i[0],p=i[1],l=n.measuredBounds.width,n instanceof pl&&(l-=n.strokeWidth),1>l&&(l=1),o=i=l,h=0!==(a=s/2),l=(d=m[y=0])[0],c=d[1],u=d[2],d=d[3];for(var v=0;.1<=g;){if(0===v&&(h?(o=i,o-=a,g-=a,h=!1):o=i,0===o&&(o=1)),o>g)return void B(m);o>d?(v=o-d,o=d):v=0;var x=Math.sqrt(o*o/(1+u*u));if(0>l&&(x=-x),f+=x,p+=u*x,t.translate(f,p),t.rotate(c),t.translate(-s/2,-r/2),0===v&&n.hh(t,e),t.translate(s/2,r/2),t.rotate(-c),t.translate(-f,-p),g-=o,d-=o,0!==v){if(++y===m.length)return void B(m);l=(d=m[y])[0],c=d[1],u=d[2],d=d[3],o=v}}B(m)}}function yl(t){var e=t.geometryStretch;return null!==t.Rd?e===ms?cs:e:e===ms?Ml[t.figure].defaultStretch:e}function vl(t,e,i,n,o){return(e=(t=i.x-t)*t+(e=i.y-e)*e)<n?(o.x=i.x,o.y=i.y,e):n}function xl(t,e,i,n,o,r,s,a,h){if(Ye.$(t,i)&&Ye.$(e,n)||Ye.$(o,s)&&Ye.$(r,a))return!1;var l=!1,u=(o-s)*(e-n)-(r-a)*(t-i);return 0!==u&&(h.x=((o*a-r*s)*(t-i)-(o-s)*(t*n-e*i))/u,h.y=((o*a-r*s)*(e-n)-(r-a)*(t*n-e*i))/u,(t>i?t-i:i-t)<(e>n?e-n:n-e)?(t=e<n?e:n,e=e<n?n:e,(h.y>t||Ye.$(h.y,t))&&(h.y<e||Ye.$(h.y,e))&&(l=!0)):(e=t<i?t:i,t=t<i?i:t,(h.x>e||Ye.$(h.x,e))&&(h.x<t||Ye.$(h.x,t))&&(l=!0)),l)}function bl(t,e,i,n){if(!t.rs(e,i,n))return!1;t=e.x,e=e.y;var o=i.x,r=i.y;return i=n.x,n=n.y,t===o?(e<r?(t=e,e=r):t=r,n>=t&&n<=e):(t<o?(n=t,t=o):n=o,i>=n&&i<=t)}function wl(t){var e=t.diagram;null!==e&&e.undoManager.isUndoingRedoing||(t.segmentOrientation=ed,"None"!==t.toArrow?(t.segmentIndex=-1,t.alignmentFocus=Be):"None"!==t.fromArrow&&(t.segmentIndex=0,t.alignmentFocus=new Oe(1-Be.x,Be.y)))}function kl(t){var e=Sl[t];if(void 0===e){var i=t.toLowerCase();if("none"===i)return"None";if(void 0===(e=Sl[i])){var n,o=null;for(n in Ye.um)if(n.toLowerCase()===i){o=n;break}if(null!==o)return t=Xe.parse(Ye.um[o],!1),Sl[o]=t,i!==o&&(Sl[i]=o),o}}return"string"==typeof e?e:e instanceof Xe?t:null}hl.className="RowColumnDefinition",hl.Default=cl,hl.None=dl,hl.ProportionalExtra=fl,c(pl,Fs),pl.prototype.cloneProtected=function(t){Fs.prototype.cloneProtected.call(this,t),t.ua=this.ua,t.Rd=this.Rd,t.an=this.an,t.Ui=this.Ui,t.xc=this.xc,t.ig=this.ig,null!==this.Yg&&(t.Yg=T(this.Yg)),null!==this.Na&&(t.Na=this.Na.nc?this.Na:this.Na.copy()),t.Un=this.Un,t.Vn=this.Vn,null!==this.fa&&(t.fa=this.fa.copy())},(e=pl.prototype).th=function(){Fs.prototype.th.call(this),null!==this.Na&&(this.Na.nc=!0)},e.qb=function(t){t===ds||t===fs||t===ys||t===ms?this.geometryStretch=t:Fs.prototype.qb.call(this,t)},e.toString=function(){return"Shape("+("None"!==this.figure?this.figure:"None"!==this.toArrow?this.toArrow:this.fromArrow)+")#"+et(this)},e.hh=function(t,e){var i=this.xc,n=this.Ui;if(null!==i||null!==n){var o=this.ua;if(null!==o){t.yc();var r=this.actualBounds,s=this.naturalBounds;null!==n&&Xs(this,t,n,!0,!1,s,r);var a=this.part,h=this.ig;if(null===i||0!==h||null===a||!this.isPanelMain&&a.Pb()!==this||(h=a.type===Th.Link&&a instanceof Wu&&"Selection"===a.category&&a.adornedObject instanceof pl&&a.adornedPart.Pb()===a.adornedObject?a.adornedObject.strokeWidth:0),0===h&&(i=null),null!==i&&0!==h&&(Xs(this,t,i,!1,!1,s,r),t.lineWidth=h,t.lineJoin=this.strokeJoin,t.lineCap=this.strokeCap,t.miterLimit=this.strokeMiterLimit),r=!1,a&&e.Gf("drawShadows")&&(r=a.isShadowed),!1===t.Il&&(r=!1),a=!0,null===i||null!==n&&"transparent"!==n||(a=!1),s=!1,null!==(h=this.strokeDashArray)&&(s=!0,t.js(h,this.strokeDashOffset)),o.type===Xe.j)t.beginPath(),t.moveTo(o.startX,o.startY),t.lineTo(o.endX,o.endY),null!==i&&t.jk(),t.Se();else if(o.type===Xe.u){var l=o.startX;h=o.startY;var u=o.endX,c=o.endY;o=Math.min(l,u);var d=Math.min(h,c);l=Math.abs(u-l),h=Math.abs(c-h),t.beginPath(),t.rect(o,d,l,h),null!==n&&t.ng(n),null!==i&&(a&&r&&La(t),t.jk(),a&&r&&Aa(t)),t.Se()}else if(o.type===Xe.F)l=o.startX,h=o.startY,u=o.endX,c=o.endY,o=Math.abs(u-l)/2,d=Math.abs(c-h)/2,l=Math.min(l,u)+o,h=Math.min(h,c)+d,t.beginPath(),t.moveTo(l,h-d),t.bezierCurveTo(l+Ye.wg*o,h-d,l+o,h-Ye.wg*d,l+o,h),t.bezierCurveTo(l+o,h+Ye.wg*d,l+Ye.wg*o,h+d,l,h+d),t.bezierCurveTo(l-Ye.wg*o,h+d,l-o,h+Ye.wg*d,l-o,h),t.bezierCurveTo(l-o,h-Ye.wg*d,l-Ye.wg*o,h-d,l,h-d),t.closePath(),null!==n&&t.ng(n),null!==i&&(a&&r&&La(t),t.jk(),a&&r&&Aa(t)),t.Se();else if(o.type===Xe.o)for(h=(o=o.figures).length,d=0;d<h;d++){l=o.s[d],t.beginPath(),t.moveTo(l.startX,l.startY),c=(u=l.segments.s).length;for(var f=null,p=0;p<c;p++){var g=u[p];switch(g.type){case ii:t.moveTo(g.endX,g.endY);break;case ni:t.lineTo(g.endX,g.endY);break;case oi:t.bezierCurveTo(g.point1X,g.point1Y,g.point2X,g.point2Y,g.endX,g.endY);break;case ri:t.quadraticCurveTo(g.point1X,g.point1Y,g.endX,g.endY);break;case si:if(g.radiusX===g.radiusY){var m=Math.PI/180;t.arc(g.point1X,g.point1Y,g.radiusX,g.startAngle*m,(g.startAngle+g.sweepAngle)*m,0>g.sweepAngle,null!==f?f.endX:l.startX,null!==f?f.endY:l.startY)}else if(0===(m=(f=ti(g,l)).length))t.lineTo(g.centerX,g.centerY);else for(var y=0;y<m;y++){var v=f[y];0===y&&t.lineTo(v[0],v[1]),t.bezierCurveTo(v[2],v[3],v[4],v[5],v[6],v[7])}break;case ai:if(y=m=0,null!==f&&f.type===si){if(0===(v=(f=ti(f,l)).length)){t.lineTo(g.endX,g.endY);break}null!==(f=f[v-1]||null)&&(m=f[6],y=f[7])}else m=null!==f?f.endX:l.startX,y=null!==f?f.endY:l.startY;if(0===(m=(f=ei(g,l,m,y)).length)){t.lineTo(g.endX,g.endY);break}for(y=0;y<m;y++)v=f[y],t.bezierCurveTo(v[2],v[3],v[4],v[5],v[6],v[7]);break;default:w("Segment not of valid type: "+g.type)}g.isClosed&&t.closePath(),f=g}u=l.isFilled,r?l.isShadowed?(!0===u&&"transparent"!==n&&null!==n&&t.ng(n,l.isEvenOdd),null!==i&&(u&&a&&La(t),t.jk(),u&&a&&Aa(t))):(La(t),u&&"transparent"!==n&&null!==n&&t.ng(n,l.isEvenOdd),null!==i&&t.jk(),Aa(t)):(u&&null!==n&&t.ng(n,l.isEvenOdd),null!==i&&t.jk()),t.Se(d)}if(s&&t.fs(),null!==this.pathPattern){if((i=this.pathPattern).measure(1/0,1/0),n=i.measuredBounds,i.arrange(0,0,n.width,n.height),r=this.geometry,t.save(),t.beginPath(),n=A(),r.type===Xe.j)n.push(r.startX),n.push(r.startY),n.push(r.endX),n.push(r.endY),ml(t,e,n,i);else if(r.type===Xe.o)for(r=r.figures.iterator;r.next();){for(a=r.value,n.length=0,n.push(a.startX),n.push(a.startY),h=s=a.startX,d=o=a.startY,u=(l=a.segments.s).length,c=0;c<u;c++){switch((p=l[c]).type){case ii:ml(t,e,n,i),n.length=0,n.push(p.endX),n.push(p.endY),h=s=p.endX,d=o=p.endY;break;case ni:n.push(p.endX),n.push(p.endY),s=p.endX,o=p.endY;break;case oi:Ye.Qe(s,o,p.point1X,p.point1Y,p.point2X,p.point2Y,p.endX,p.endY,.5,n),s=p.endX,o=p.endY;break;case ri:Ye.ep(s,o,p.point1X,p.point1Y,p.endX,p.endY,.5,n),s=p.endX,o=p.endY;break;case si:if(0===(f=(g=ti(p,a)).length)){n.push(p.centerX),n.push(p.centerY),s=p.centerX,o=p.centerY;break}for(m=0;m<f;m++)y=g[m],Ye.Qe(s,o,y[2],y[3],y[4],y[5],y[6],y[7],.5,n),s=y[6],o=y[7];break;case ai:if(0===(f=(g=ei(p,a,s,o)).length)){n.push(p.endX),n.push(p.endY),s=p.endX,o=p.endY;break}for(m=0;m<f;m++)y=g[m],Ye.Qe(s,o,y[2],y[3],y[4],y[5],y[6],y[7],.5,n),s=y[6],o=y[7];break;default:w("Segment not of valid type: "+p.type)}p.isClosed&&(n.push(h),n.push(d),ml(t,e,n,i))}ml(t,e,n,i)}else if(r.type===Xe.u)n.push(r.startX),n.push(r.startY),n.push(r.endX),n.push(r.startY),n.push(r.endX),n.push(r.endY),n.push(r.startX),n.push(r.endY),n.push(r.startX),n.push(r.startY),ml(t,e,n,i);else if(r.type===Xe.F){if((o=new Ze).startX=r.endX,o.startY=(r.startY+r.endY)/2,(s=new Qe(si)).startAngle=0,s.sweepAngle=360,s.centerX=(r.startX+r.endX)/2,s.centerY=(r.startY+r.endY)/2,s.radiusX=Math.abs(r.startX-r.endX)/2,s.radiusY=Math.abs(r.startY-r.endY)/2,o.add(s),0===(a=(r=ti(s,o)).length))n.push(s.centerX),n.push(s.centerY);else for(s=o.startX,o=o.startY,h=0;h<a;h++)d=r[h],Ye.Qe(s,o,d[2],d[3],d[4],d[5],d[6],d[7],.5,n),s=d[6],o=d[7];ml(t,e,n,i)}B(n),t.restore(),t.Vc(!1)}}}},e.kk=function(t,e,i){return!(!Fs.prototype.kk.call(this,t,e,i)||null===this.xc&&null===this.Ui||null===this.ua||null!==this.pathPattern||this.geometry.figures.length!==this.svg.getElementsByTagName("path").length)&&(t.Hl=this.svg,this.hh(t,e),t.Hl=null,!0)},e.nk=function(t){return null!==this.geometry&&1<this.geometry.figures.length||null!==this.pathPattern||Fs.prototype.nk.call(this,t)},e.Dv=function(t,e){if("g"!==t.nodeName)t.setAttributeNS(null,"filter",e);else{t=t.getElementsByTagName("path");for(var i=0;i<t.length;i++)t[i].setAttributeNS(null,"filter",e)}},e.ga=function(t,e){if(void 0===e&&(e=new pt),t instanceof Oe){t.Mc()&&w("getDocumentPoint Spot must be a real, specific Spot, not: "+t.toString());var i=this.naturalBounds,n=this.strokeWidth;e.h(t.x*(i.width+n)-n/2+i.x+t.offsetX,t.y*(i.height+n)-n/2+i.y+t.offsetY)}else e.set(t);return this.oe.Ga(e),e},e.mi=function(t){void 0===t&&(t=new jt);var e=this.naturalBounds,i=this.oe;e=jt.allocAt(e.x,e.y,e.width,e.height);var n=this.strokeWidth;return e.Bc(n/2,n/2),n=pt.allocAt(e.x,e.y).transform(i),t.h(n.x,n.y,0,0),n.h(e.right,e.y).transform(i),Ht(t,n.x,n.y,0,0),n.h(e.right,e.bottom).transform(i),Ht(t,n.x,n.y,0,0),n.h(e.x,e.bottom).transform(i),Ht(t,n.x,n.y,0,0),jt.free(e),pt.free(n),t},e.gh=function(t,e){var i=this.geometry;if(null===i||null===this.fill&&null===this.stroke)return!1;var n=i.bounds,o=this.strokeWidth/2;i.type!==Xe.j||e||(o+=2);var r=jt.alloc();if(r.assign(n),r.Bc(o+2,o+2),!r.ca(t))return jt.free(r),!1;if(n=o+1e-4,i.type===Xe.j)return null!==this.stroke&&(n=(i.endX-i.startX)*(t.x-i.startX)+(i.endY-i.startY)*(t.y-i.startY),!(0>(i.startX-i.endX)*(t.x-i.endX)+(i.startY-i.endY)*(t.y-i.endY)||0>n)&&(jt.free(r),Ye.Yb(i.startX,i.startY,i.endX,i.endY,o,t.x,t.y)));if(i.type===Xe.u){e=i.startX;var s=i.startY,a=i.endX;if(i=i.endY,r.x=Math.min(e,a),r.y=Math.min(s,i),r.width=Math.abs(a-e),r.height=Math.abs(i-s),null===this.fill){if(r.Bc(-n,-n),r.ca(t))return jt.free(r),!1;r.Bc(n,n)}return null!==this.stroke&&r.Bc(o,o),t=r.ca(t),jt.free(r),t}if(i.type===Xe.F){s=i.startX,o=i.startY,a=i.endX;var h=i.endY;if(i=Math.min(s,a),e=Math.min(o,h),s=Math.abs(a-s)/2,o=Math.abs(h-o)/2,i=t.x-(i+s),e=t.y-(e+o),null===this.fill){if(o-=n,0>=(s-=n)||0>=o||1>=i*i/(s*s)+e*e/(o*o))return jt.free(r),!1;s+=n,o+=n}return null!==this.stroke&&(s+=n,o+=n),jt.free(r),!(0>=s||0>=o)&&1>=i*i/(s*s)+e*e/(o*o)}if(i.type===Xe.o)return jt.free(r),null===this.fill?_e(i,t.x,t.y,o):We(i,t,o,1<this.strokeWidth,e);w("Unknown Geometry type: "+i.type)},e.Wl=function(t,e,i,n){var o=this.desiredSize,r=this.ig;if(t=Math.max(t,0),e=Math.max(e,0),null!==this.Rd)var s=this.geometry.bounds;else{var a=this.figure,h=Ml[a];if(void 0===h){var l=Ye.Ze[a];"string"==typeof l&&(l=Ye.Ze[l]),"function"==typeof l?(h=l(null,100,100),Ml[a]=h):w("Unsupported Figure: "+a)}s=h.bounds}a=s.width,h=s.height,l=s.width;var u=s.height;switch(Ws(this,!0)){case ds:n=i=0;break;case cs:l=Math.max(t-r,0),u=Math.max(e-r,0);break;case ps:l=Math.max(t-r,0),n=0;break;case gs:i=0,u=Math.max(e-r,0)}isFinite(o.width)&&(l=o.width),isFinite(o.height)&&(u=o.height);var c=this.maxSize,d=this.minSize;switch(i=Math.max(i-r,d.width),n=Math.max(n-r,d.height),l=Math.min(c.width,l),u=Math.min(c.height,u),l=isFinite(l)?Math.max(i,l):Math.max(a,i),u=isFinite(u)?Math.max(n,u):Math.max(h,n),i=yl(this)){case ds:break;case cs:a=l,h=u;break;case fs:i=Math.min(l/a,u/h),isFinite(i)||(i=1),a*=i,h*=i;break;default:w(i+" is not a valid geometryStretch.")}null!==this.Rd?(0===a&&(a=.001),0===h&&(h=.001),n=a/(s=(i=null!==this.Rd?this.Rd:this.ua).bounds).width,s=h/s.height,isFinite(n)||(n=1),isFinite(s)||(s=1),this.ua=1===n&&1===s?i:i.copy().scale(n,s)):null!==this.ua&&Ye.$(this.ua.Sk,t-r)&&Ye.$(this.ua.Rk,e-r)||(this.ua=pl.makeGeometry(this,a,h)),s=this.ua.bounds,1/0===t||1/0===e?this.Ge(s.x-r/2,s.y-r/2,0===t&&0===a?0:s.width+r,0===e&&0===h?0:s.height+r):this.Ge(-r/2,-r/2,l+r,u+r),o.w()?(l=o.width,u=o.height,l=Math.min(c.width,l),u=Math.min(c.height,u),l=Math.max(d.width,l),u=Math.max(d.height,u),this.dc.h(0,0,l,u)):this.dc.assign(s)},e.eh=function(t,e,i,n){Is(this,t,e,i,n)},e.rs=function(t,e,i){return this.Sj(t.x,t.y,e.x,e.y,i)},e.Sj=function(t,e,i,n,o){var r=this.transform,s=1/(r.m11*r.m22-r.m12*r.m21),a=r.m22*s,h=-r.m12*s,l=-r.m21*s,u=r.m11*s,c=s*(r.m21*r.dy-r.m22*r.dx),d=s*(r.m12*r.dx-r.m11*r.dy);r=t*a+e*l+c,s=t*h+e*u+d,a=i*a+n*l+c,h=i*h+n*u+d,c=this.ig/2,null===(l=this.ua)&&(this.measure(1/0,1/0),l=this.ua);var f=l.bounds;if(u=!1,l.type===Xe.j)if(1.5>=this.strokeWidth)u=Ye.Ve(l.startX,l.startY,l.endX,l.endY,r,s,a,h,o);else{if(l.startX===l.endX?(n=c,u=0):(e=(l.endY-l.startY)/(l.endX-l.startX),n=(u=c/Math.sqrt(1+e*e))*e),e=A(),t=new pt,Ye.Ve(l.startX+n,l.startY+u,l.endX+n,l.endY+u,r,s,a,h,t)&&e.push(t),t=new pt,Ye.Ve(l.startX-n,l.startY-u,l.endX-n,l.endY-u,r,s,a,h,t)&&e.push(t),t=new pt,Ye.Ve(l.startX+n,l.startY+u,l.startX-n,l.startY-u,r,s,a,h,t)&&e.push(t),t=new pt,Ye.Ve(l.endX+n,l.endY+u,l.endX-n,l.endY-u,r,s,a,h,t)&&e.push(t),0===(a=e.length))return B(e),!1;for(u=!0,h=1/0,n=0;n<a;n++)(i=((t=e[n]).x-r)*(t.x-r)+(t.y-s)*(t.y-s))<h&&(h=i,o.x=t.x,o.y=t.y);B(e)}else if(l.type===Xe.u)u=Ye.Ff(f.x-c,f.y-c,f.x+f.width+c,f.y+f.height+c,r,s,a,h,o);else if(l.type===Xe.F){t:if(0===(e=jt.allocAt(f.x,f.y,f.width,f.height).Bc(c,c)).width)u=Ye.Ve(e.x,e.y,e.x,e.y+e.height,r,s,a,h,o);else if(0===e.height)u=Ye.Ve(e.x,e.y,e.x+e.width,e.y,r,s,a,h,o);else{if(t=e.width/2,l=e.height/2,n=e.x+t,u=e.y+l,i=9999,r!==a&&(i=(s-h)/(r-a)),9999>Math.abs(i)){if(0>t*t*i*i+l*l-(h=s-u-i*(r-n))*h){o.x=NaN,o.y=NaN,u=!1;break t}a=(-t*t*i*h+t*l*(c=Math.sqrt(t*t*i*i+l*l-h*h)))/(l*l+t*t*i*i)+n,t=(-t*t*i*h-t*l*c)/(l*l+t*t*i*i)+n,l=i*(a-n)+h+u,h=i*(t-n)+h+u,Math.abs((r-a)*(r-a))+Math.abs((s-l)*(s-l))<Math.abs((r-t)*(r-t))+Math.abs((s-h)*(s-h))?(o.x=a,o.y=l):(o.x=t,o.y=h)}else{if(a=l*l,0>(a-=a/(t*t)*(h=r-n)*h)){o.x=NaN,o.y=NaN,u=!1;break t}a=u+(h=Math.sqrt(a)),h=u-h,Math.abs(a-s)<Math.abs(h-s)?(o.x=r,o.y=a):(o.x=r,o.y=h)}u=!0}jt.free(e)}else if(l.type===Xe.o){d=pt.alloc();var p=a-r,g=h-s,m=p*p+g*g,y=r,v=s;if(0<m&&f.contains(y,v)&&(d.x=y,d.y=v,this.ca(d)))for(0!==p&&.5>Math.abs(p)?(g*=.5/p,p=.5):0!==g&&.5>Math.abs(g)&&(p*=.5/g,g=.5),y-=p,v-=g;f.contains(y,v);)y-=p,v-=g;for(o.x=a,o.y=h,g=0;g<l.figures.count;g++)for(var x=l.figures.s[g],b=x.isFilled?y:r,k=x.isFilled?v:s,S=x.segments,M=f=x.startX,C=p=x.startY,P=0;P<S.count;P++){var T=S.s[P],N=T.type,L=T.endX,D=T.endY,F=!1;switch(N){case ii:M=L,C=D;break;case ni:F=xl(f,p,L,D,b,k,a,h,d);break;case oi:F=Ye.Eo(f,p,T.point1X,T.point1Y,T.point2X,T.point2Y,L,D,b,k,a,h,.6,d);break;case ri:F=Ye.Eo(f,p,f+2/3*(T.point1X-f),p+2/3*(T.point1Y-p),L+2/3*(T.point1X-L),D+2/3*(T.point1Y-D),L,D,b,k,a,h,.6,d);break;case si:case ai:var j=(N=T.type===si?ti(T,x):ei(T,x,f,p)).length;if(0===j){F=xl(f,p,T.type===si?T.centerX:T.endX,T.type===si?T.centerY:T.endY,b,k,a,h,d);break}for(D=null,L=0;L<j;L++){if(D=N[L],0===L&&xl(f,p,D[0],D[1],b,k,a,h,d)){var E=vl(b,k,d,m,o);E<m&&(m=E,u=!0)}Ye.Eo(D[0],D[1],D[2],D[3],D[4],D[5],D[6],D[7],b,k,a,h,.6,d)&&((E=vl(b,k,d,m,o))<m&&(m=E,u=!0))}L=D[6],D=D[7];break;default:w("Unknown Segment type: "+N)}f=L,p=D,F&&((F=vl(b,k,d,m,o))<m&&(m=F,u=!0)),T.isClosed&&(xl(f,p,L=M,D=C,b,k,a,h,d)&&((T=vl(b,k,d,m,o))<m&&(m=T,u=!0)))}r=i-t,s=n-e,0!==(a=Math.sqrt(r*r+s*s))&&(r/=a,s/=a),o.x-=r*c,o.y-=s*c,pt.free(d)}else w("Unknown Geometry type: "+l.type);return!!u&&(this.transform.Ga(o),!0)},e.fh=function(t,e){if(void 0===e)return t.Re(this.actualBounds);var i=this.ua;null===i&&(this.measure(1/0,1/0),i=this.ua),i=i.bounds;var n=this.strokeWidth/2,o=!1,r=pt.alloc();return r.h(i.x-n,i.y-n),t.ca(e.Ga(r))&&(r.h(i.x-n,i.bottom+n),t.ca(e.Ga(r))&&(r.h(i.right+n,i.bottom+n),t.ca(e.Ga(r))&&(r.h(i.right+n,i.y-n),t.ca(e.Ga(r))&&(o=!0)))),pt.free(r),o},e.Yc=function(t,e){if(this.fh(t,e)||void 0===e&&(e=this.transform,t.Re(this.actualBounds)))return!0;var i=Ge.alloc();i.set(e),i.Vj();var n=t.left,o=t.right,r=t.top;t=t.bottom;var s=pt.alloc();if(s.h(n,r),i.Ga(s),this.gh(s,!0))return pt.free(s),!0;if(s.h(o,r),i.Ga(s),this.gh(s,!0))return pt.free(s),!0;if(s.h(n,t),i.Ga(s),this.gh(s,!0))return pt.free(s),!0;if(s.h(o,t),i.Ga(s),this.gh(s,!0))return pt.free(s),!0;var a=pt.alloc(),h=pt.alloc();return i.set(e),i.bv(this.transform),i.Vj(),a.x=o,a.y=r,a.transform(i),s.x=n,s.y=r,s.transform(i),e=!1,bl(this,s,a,h)?e=!0:(s.x=o,s.y=t,s.transform(i),bl(this,s,a,h)?e=!0:(a.x=n,a.y=t,a.transform(i),bl(this,s,a,h)?e=!0:(s.x=n,s.y=r,s.transform(i),bl(this,s,a,h)&&(e=!0)))),pt.free(s),Ge.free(i),pt.free(a),pt.free(h),e},e.tx=function(t,e,i){function n(t,e){for(var i=t.length,n=0;n<i;n+=2)if(e.zd(t[n],t[n+1])>o)return!0;return!1}if(i&&null!==this.fill&&this.gh(t,!0))return!0;var o=t.Bf(e),r=o;if(1.5<this.strokeWidth&&(o=this.strokeWidth/2+Math.sqrt(o),o*=o),null===(e=this.ua)&&(this.measure(1/0,1/0),null===(e=this.ua)))return!1;if(!i){var s=e.bounds,a=s.x,h=s.y,l=s.x+s.width;if(s=s.y+s.height,bt(t.x,t.y,a,h)<=o&&bt(t.x,t.y,l,h)<=o&&bt(t.x,t.y,a,s)<=o&&bt(t.x,t.y,l,s)<=o)return!0}if(a=e.startX,h=e.startY,l=e.endX,s=e.endY,e.type===Xe.j){if(i=(a-l)*(t.x-l)+(h-s)*(t.y-s),xt(t.x,t.y,a,h,l,s)<=(0<=(l-a)*(t.x-a)+(s-h)*(t.y-h)&&0<=i?o:r))return!0}else{if(e.type===Xe.u)return e=!1,i&&(e=xt(t.x,t.y,a,h,a,s)<=o||xt(t.x,t.y,a,h,l,h)<=o||xt(t.x,t.y,l,h,l,s)<=o||xt(t.x,t.y,a,s,l,s)<=o),e;if(e.type===Xe.F){e=t.x-(a+l)/2,r=t.y-(h+s)/2;var u=Math.abs(l-a)/2,c=Math.abs(s-h)/2;if(0===u||0===c)return xt(t.x,t.y,a,h,l,s)<=o;if(!i)return!(bt(e,r,-u,0)>=o||bt(e,r,0,-c)>=o||bt(e,r,0,c)>=o||bt(e,r,u,0)>=o);if((t=Ye.$y(u,c,e,r))*t<=o)return!0}else if(e.type===Xe.o){if(r=(l=e.bounds).x,a=l.y,h=l.x+l.width,l=l.y+l.height,t.x>h&&t.x<r&&t.y>l&&t.y<a&&xt(t.x,t.y,r,a,r,l)>o&&xt(t.x,t.y,r,a,h,a)>o&&xt(t.x,t.y,h,l,r,l)>o&&xt(t.x,t.y,h,l,h,a)>o)return!1;if(r=Math.sqrt(o),!i){for(i=e.figures,e=0;e<i.count;e++){if(s=(r=i.s[e]).startX,u=r.startY,t.zd(s,u)>o)return!1;for(h=(a=r.segments.s).length,l=0;l<h;l++)switch(c=a[l],c.type){case ii:case ni:if(s=c.endX,u=c.endY,t.zd(s,u)>o)return!1;break;case oi:var d=A();if(Ye.Qe(s,u,c.point1X,c.point1Y,c.point2X,c.point2Y,c.endX,c.endY,.8,d),s=n(d,t),B(d),s)return!1;if(s=c.endX,u=c.endY,t.zd(s,u)>o)return!1;break;case ri:if(d=A(),Ye.ep(s,u,c.point1X,c.point1Y,c.endX,c.endY,.8,d),s=n(d,t),B(d),s)return!1;if(s=c.endX,u=c.endY,t.zd(s,u)>o)return!1;break;case si:case ai:var f=(d=c.type===si?ti(c,r):ei(c,r,s,u)).length;if(0===f){if(s=c.type===si?c.centerX:c.endX,u=c.type===si?c.centerY:c.endY,t.zd(s,u)>o)return!1;break}c=null;for(var p=A(),g=0;g<f;g++)if(c=d[g],p.length=0,Ye.Qe(c[0],c[1],c[2],c[3],c[4],c[5],c[6],c[7],.8,p),n(p,t))return B(p),!1;B(p),null!==c&&(s=c[6],u=c[7]);break;default:w("Unknown Segment type: "+c.type)}}return!0}if(null===this.fill?_e(e,t.x,t.y,r):We(e,t,r,!0,!1))return!0}}return!1},e.qc=function(){this.ua=null},e.kq=function(){return this.ig},pl.makeGeometry=function(t,e,i){if("None"!==t.toArrow)var n=Sl[t.toArrow];else"None"!==t.fromArrow?n=Sl[t.fromArrow]:("string"==typeof(n=Ye.Ze[t.figure])&&(n=Ye.Ze[n]),void 0===n&&w("Unknown Shape.figure: "+t.figure),(n=n(t,e,i)).Sk=e,n.Rk=i);if(null===n){var o=Ye.Ze.Rectangle;"function"==typeof o&&(n=o(t,e,i))}return n},d.Object.defineProperties(pl.prototype,{geometry:{get:function(){return null!==this.ua?this.ua:this.Rd},set:function(t){var e=this.ua,i=this.Rd;if(e!==t){this.Rd=this.ua=null!==t?t.freeze():null;var n=this.part;null!==n&&(n.ag=NaN),this.v(),this.g("geometry",e||i,t),Js(this)&&(null!==(t=this.part)&&Es(this,t,"geometryString"))}}},geometryString:{get:function(){return null===this.geometry?"":this.geometry.toString()},set:function(t){var e=(t=Xe.parse(t)).normalize();this.geometry=t,this.position=t=pt.allocAt(-e.x,-e.y),pt.free(t)}},isGeometryPositioned:{get:function(){return 0!=(1048576&this.l)},set:function(t){var e=0!=(1048576&this.l);e!==t&&(this.l^=1048576,this.v(),this.g("isGeometryPositioned",e,t))}},fill:{get:function(){return this.Ui},set:function(t){var e=this.Ui;e!==t&&(null!==t&&Ka(t,"Shape.fill"),t instanceof Oa&&t.freeze(),this.Ui=t,this.N(),this.g("fill",e,t))}},stroke:{get:function(){return this.xc},set:function(t){var e=this.xc;e!==t&&(null!==t&&Ka(t,"Shape.stroke"),t instanceof Oa&&t.freeze(),this.xc=t,this.N(),this.g("stroke",e,t))}},strokeWidth:{get:function(){return this.ig},set:function(t){var e=this.ig;if(e!==t)if(0<=t){this.ig=t,this.v();var i=this.part;null!==i&&(i.ag=NaN),this.g("strokeWidth",e,t)}else S(t,"value >= 0",pl,"strokeWidth:value")}},strokeCap:{get:function(){return null!==this.Na?this.Na.Hr:"butt"},set:function(t){var e=this.strokeCap;e!==t&&("string"!=typeof t||"butt"!==t&&"round"!==t&&"square"!==t?S(t,'"butt", "round", or "square"',pl,"strokeCap"):(gl(this),this.Na.Hr=t,this.N(),this.g("strokeCap",e,t)))}},strokeJoin:{get:function(){return null!==this.Na?this.Na.Ir:"miter"},set:function(t){var e=this.strokeJoin;e!==t&&("string"!=typeof t||"miter"!==t&&"bevel"!==t&&"round"!==t?S(t,'"miter", "bevel", or "round"',pl,"strokeJoin"):(gl(this),this.Na.Ir=t,this.N(),this.g("strokeJoin",e,t)))}},strokeMiterLimit:{get:function(){return null!==this.Na?this.Na.Jr:10},set:function(t){var e=this.strokeMiterLimit;if(e!==t&&1<=t){gl(this),this.Na.Jr=t,this.N();var i=this.part;null!==i&&(i.ag=NaN),this.g("strokeMiterLimit",e,t)}}},strokeDashArray:{get:function(){return this.Yg},set:function(t){var e=this.Yg;if(e!==t){if(null!==t){for(var i=t.length,n=0,o=0;o<i;o++){var r=t[o];0<=r&&isFinite(r)||w("strokeDashArray:value "+r+" at index "+o+" must be a positive number or zero."),n+=r}if(0===n){if(null===e)return;t=null}}this.Yg=t,this.N(),this.g("strokeDashArray",e,t)}}},strokeDashOffset:{get:function(){return null!==this.Na?this.Na.uj:0},set:function(t){var e=this.strokeDashOffset;e!==t&&0<=t&&(gl(this),this.Na.uj=t,this.N(),this.g("strokeDashOffset",e,t))}},figure:{get:function(){return this.an},set:function(t){var e=this.an;if(e!==t){var i=Ye.Ze[t];"function"==typeof i?i=t:(i=Ye.Ze[t.toLowerCase()])||w("Unknown Shape.figure: "+t),e!==i&&(null!==(t=this.part)&&(t.ag=NaN),this.an=i,this.Rd=null,this.qc(),this.v(),this.g("figure",e,i))}}},toArrow:{get:function(){return null!==this.Ua?this.Ua.V:"None"},set:function(t){var e=this.toArrow;if(!0===t?t="Standard":!1===t&&(t=""),e!==t){var i=kl(t);null===i?w("Unknown Shape.toArrow: "+t):e!==i&&(null===this.Ua&&(this.Ua=new fa),this.Ua.V=i,this.Rd=null,this.qc(),this.v(),wl(this),this.g("toArrow",e,i))}}},fromArrow:{get:function(){return null!==this.Ua?this.Ua.j:"None"},set:function(t){var e=this.fromArrow;if(!0===t?t="Standard":!1===t&&(t=""),e!==t){var i=kl(t);null===i?w("Unknown Shape.fromArrow: "+t):e!==i&&(null===this.Ua&&(this.Ua=new fa),this.Ua.j=i,this.Rd=null,this.qc(),this.v(),wl(this),this.g("fromArrow",e,i))}}},spot1:{get:function(){return null!==this.Na?this.Na.fg:Me},set:function(t){var e=this.spot1;e.D(t)||(t=t.J(),gl(this),this.Na.fg=t,this.v(),this.g("spot1",e,t))}},spot2:{get:function(){return null!==this.Na?this.Na.gg:Me},set:function(t){var e=this.spot2;e.D(t)||(t=t.J(),gl(this),this.Na.gg=t,this.v(),this.g("spot2",e,t))}},parameter1:{get:function(){return this.Un},set:function(t){var e=this.Un;e!==t&&(this.Un=t,this.qc(),this.v(),this.g("parameter1",e,t))}},parameter2:{get:function(){return this.Vn},set:function(t){var e=this.Vn;e!==t&&(this.Vn=t,this.qc(),this.v(),this.g("parameter2",e,t))}},naturalBounds:{get:function(){return this.dc}},pathPattern:{get:function(){return null!==this.Na?this.Na.br:null},set:function(t){var e=this.pathPattern;e!==t&&(gl(this),this.Na.br=t,this.N(),this.g("pathPattern",e,t))}},geometryStretch:{get:function(){return null!==this.Na?this.Na.jq:ms},set:function(t){var e=this.geometryStretch;e!==t&&(gl(this),this.Na.jq=t,this.v(),this.g("geometryStretch",e,t))}},interval:{get:function(){return null!==this.fa?this.fa.Tk:1},set:function(t){var e=this.interval;if(e!==(t=Math.round(t))&&0!==t&&isFinite(t)){null===this.fa&&(this.fa=new nu),this.fa.Tk=t;var i=this.diagram;null!==i&&this.panel===i.grid&&yr(i),this.v(),null!==(i=this.panel)&&(i.graduatedIntervals=null),this.g("interval",e,t)}}},graduatedStart:{get:function(){return null!==this.fa?this.fa.u:0},set:function(t){var e=this.graduatedStart;e!==t&&(0>t?t=0:1<t&&(t=1),null===this.fa&&(this.fa=new nu),this.fa.u=t,this.v(),this.g("graduatedStart",e,t))}},graduatedEnd:{get:function(){return null!==this.fa?this.fa.j:1},set:function(t){var e=this.graduatedEnd;e!==t&&(0>t?t=0:1<t&&(t=1),null===this.fa&&(this.fa=new nu),this.fa.j=t,this.v(),this.g("graduatedEnd",e,t))}},graduatedSkip:{get:function(){return null!==this.fa?this.fa.o:null},set:function(t){var e=this.graduatedSkip;e!==t&&(null===this.fa&&(this.fa=new nu),this.fa.o=t,this.v(),this.g("graduatedSkip",e,t))}}}),pl.prototype.intersectsRect=pl.prototype.Yc,pl.prototype.containedInRect=pl.prototype.fh,pl.prototype.getNearestIntersectionPoint=pl.prototype.rs,pl.prototype.getDocumentBounds=pl.prototype.mi,pl.prototype.getDocumentPoint=pl.prototype.ga;var Sl=new Y,Ml=new Y;function Cl(){this.nc=!1,this.Hr="butt",this.Ir="miter",this.Jr=10,this.uj=0,this.br=null,this.jq=ms,this.gg=this.fg=Me}function Pl(t,e){return Fs.call(this),eu||(tu=Vr?new Da(null).context:null,eu=!0),this.l|=2097152,this.ec="",this.xc="black",this.Ae="13px sans-serif",this.Lq=this.Cb=this.Gc=0,this.da=this.fa=this.Gm=null,this.Ih=0,this.df=null,this.Le=0,this.ze=this.Qb=this.Qc=null,"string"==typeof t?this.text=t:t&&Object.assign(this,t),e&&Object.assign(this,e),this}function Tl(t){null===t.da?t.da=new iu:t.da.nc&&(t.da=t.da.copy())}function Nl(t,e){t.l=6144|e.l,t.pb=e.opacity,t.Ma=e.background,t.areaBackground=e.areaBackground,t.jd=e.desiredSize.J(),t.minSize=e.minSize.J(),t.maxSize=e.maxSize.J(),null!==e.Lb?t.Lb=e.Lb.copy():t.Lb=null,t.Ca=e.scale,t.Kb=e.angle,t.stretch=e.stretch,t.Kg=e.margin.J(),t.Jb=e.alignment.J(),t.sk=e.alignmentFocus.J(),t.segmentFraction=e.segmentFraction,t.segmentOffset=e.segmentOffset.J(),t.segmentOrientation=e.segmentOrientation,null!==e.tb&&(t.tb=e.tb.copy()),t.shadowVisible=e.shadowVisible,t.ec=e.ec,t.xc=e.xc,t.Ae=e.Ae,null!==t.fa&&(t.fa=e.fa.copy()),null!==e.da&&(t.da=e.da.nc?e.da:e.da.copy()),t.Ih=e.Ih}function Ll(t,e,i){null===t.ze?(t.ze=e,t.Cb=i):(null!==t.Qb&&null!==t.Qc||(t.Qb=[],t.Qc=[],t.Qb.push(t.ze),t.Qc.push(t.Cb)),t.Qb.push(e),t.Qc.push(i),t.Qb.length>t.maxLines&&(t.l|=16777216))}function Al(t,e,i,n){var o=t.formatting===Ul;o&&(e=e.trim());var r=0,s=t.Ae,a=t.spacingAbove+t.spacingBelow;a=Math.max(0,Fl(t)+a);var h=t.overflow===Xl?jl(s):0;if(t.Gc>=t.maxLines)null!==n&&n.h(0,a);else if(s=e,t.wrap===Rl){t.Le=1;var l=Dl(e);if(0===h||l<=i)t.Cb=Math.max(t.Cb,l),Ll(t,e,t.Cb),null!==n&&n.h(l,a);else{for(l=Dl((r=Bl(t,s))+(e=Bl(t,s=s.substr(r.length))));0<e.length&&l<=i;)l=(r+=e)+(e=Bl(t,s=s.substr(e.length))),o&&(l=l.trim()),l=Dl(l);for(o&&(e=e.trim()),r+=e,i=Math.max(1,i-h);Dl(r)>i&&1<r.length;)r=r.substr(0,r.length-1);t.l|=16777216;var u=Dl(r+=Zl);t.Cb=u,Ll(t,r,u),null!==n&&n.h(u,a)}}else{for(h=0,0===s.length&&(h=1,Ll(t,s,0));0<s.length;){for(e=Bl(t,s),s=s.substr(e.length);Dl(e)>i;){var c=1;for(l=Dl(e.substr(0,c)),u=0;l<=i;)c++,u=l,l=Dl(e.substr(0,c));if(1===c){var d=l;r=Math.max(r,l)}else d=u,r=Math.max(r,u);if(1>--c&&(c=1),Ll(t,e.substr(0,c),d),h++,e=e.substr(c),t.Gc+h>t.maxLines)break}for(l=Dl(e+(u=Bl(t,s)));0<u.length&&l<=i;)l=(e+=u)+(u=Bl(t,s=s.substr(u.length))),o&&(l=l.trim()),l=Dl(l);if(o&&(e=e.trim()),""!==e&&(""===e[e.length-1]&&(e=e.substring(0,e.length-1)+"‐"),0===u.length?(c=l,r=Math.max(r,l)):(c=u=Dl(e),r=Math.max(r,u)),Ll(t,e,c),h++,t.Gc+h>t.maxLines))break}t.Le=Math.min(t.maxLines,h),t.Cb=Math.max(t.Cb,r),null!==n&&n.h(t.Cb,a*t.Le)}}function Bl(t,e){if(t.wrap===Hl)return e.substr(0,1);for(var i=e.length,n=0,o=Wl;n<i&&!o.test(e.charAt(n));)n++;for(t.formatting===ql&&(i=Math.min(i,n+1));n<i&&o.test(e.charAt(n));)n++;return n>=e.length?e:e.substr(0,n)}function Dl(t){return null===tu?8*t.length:tu.measureText(t).width}function Fl(t){if(null!==t.df)return t.df;var e=t.Ae;if(null===tu){var i=16;return t.df=i}return void 0!==Kl[e]&&5e3>_l?i=Kl[e]:(i=1.3*tu.measureText("M").width,Kl[e]=i,_l++),t.df=i}function jl(t){if(null===tu)return 6;if(void 0!==$l[t]&&5e3>Jl)var e=$l[t];else e=tu.measureText(Zl).width,$l[t]=e,Jl++;return e}function El(t,e){var i=t.ec.replace(/\r\n/g,"\n").replace(/\r/g,"\n"),n=t.spacingAbove+t.spacingBelow;if(n=Math.max(0,Fl(t)+n),0===i.length)return t.Cb=0,t.Gc=1,n;if(!t.isMultiline){var o=i.indexOf("\n",0);0<=o&&(i=i.substr(0,o))}o=0;for(var r,s=t.Gc=0,a=!1;!a;){if(-1===(r=i.indexOf("\n",s))&&(r=i.length,a=!0),s<=r){if(s=i.substr(s,r-s),t.wrap!==Rl){t.Le=0;var h=At.alloc();Al(t,s,e,h),o+=h.height,At.free(h),t.Gc+=t.Le}else Al(t,s,e,null),o+=n,t.Gc++;t.Gc===t.maxLines&&(a=!0)}s=r+1}return t.Lq=o}pl.className="Shape",pl.getFigureGenerators=function(){var t,e=new ft;for(t in Ye.Ze)t!==t.toLowerCase()&&e.add(t,Ye.Ze[t]);return e.freeze(),e},pl.defineFigureGenerator=function(t,e){var i=t.toLowerCase(),n=Ye.Ze;n[t]=e,n[i]=t},pl.getArrowheadGeometries=function(){var t=new ft;for(n in Ye.um)if(void 0===Sl[n]){var e=Xe.parse(Ye.um[n],!1);Sl[n]=e,(e=n.toLowerCase())!==n&&(Sl[e]=n)}for(var i in Sl)if(i!==i.toLowerCase()){var n=Sl[i];n instanceof Xe&&t.add(i,n)}return t.freeze(),t},pl.defineArrowheadGeometry=function(t,e){var i=null;i="string"==typeof e?Xe.parse(e,!1):e,"none"!==(e=t.toLowerCase())&&t!==e||w("Shape.defineArrowheadGeometry name must not be empty or None or all-lower-case: "+t);var n=Sl;n[t]=i,n[e]=t},Cl.prototype.copy=function(){var t=new Cl;return t.Hr=this.Hr,t.Ir=this.Ir,t.Jr=this.Jr,t.uj=this.uj,t.br=this.br,t.jq=this.jq,t.fg=this.fg.J(),t.gg=this.gg.J(),t},c(Pl,Fs),Pl.prototype.cloneProtected=function(t){Fs.prototype.cloneProtected.call(this,t),t.ec=this.ec,t.xc=this.xc,t.Ae=this.Ae,t.Gc=this.Gc,t.Cb=this.Cb,t.Lq=this.Lq,t.Gm=this.Gm,null!==this.fa&&(t.fa=this.fa.copy()),null!==this.da&&(t.da=this.da.nc?this.da:this.da.copy()),t.Ih=this.Ih,t.df=this.df,t.Le=this.Le,t.Qc=this.Qc,t.Qb=this.Qb,t.ze=this.ze},(e=Pl.prototype).th=function(){Fs.prototype.th.call(this),null!==this.da&&(this.da.nc=!0)},e.qb=function(t){t.classType===Pl?this.wrap=t:Fs.prototype.qb.call(this,t)},e.toString=function(){return 22<this.ec.length?'TextBlock("'+this.ec.substring(0,20)+'"...)':'TextBlock("'+this.ec+'")'},e.v=function(){Fs.prototype.v.call(this)},e.hh=function(t,e){if(null!==this.xc&&0!==this.ec.length&&null!==this.Ae){var i=this.naturalBounds,n=this.actualBounds,o=i.width,r=i.height,s=Fl(this),a=t.textAlign=this.textAlign,h=e.tn;"start"===a?a=h?"right":"left":"end"===a&&(a=h?"left":"right"),h=this.isUnderline;var l=this.isStrikethrough;Xs(this,t,this.xc,!0,!1,i,n),(h||l)&&Xs(this,t,this.xc,!1,!1,i,n),n=0,i=!1;var u=this.oe,c=u.dx-(s*u.m21+u.dx);u=u.dy-(s*u.m22+u.dy);var d=e.scale;switch(8>(c*c+u*u)*d*d&&(i=!0),e.ib!==t&&(i=!1),e.ib instanceof va&&(i=!1),!1===e.Gf("textGreeking")&&(i=!1),e=this.spacingAbove,c=this.spacingBelow,this.flip){case xs:t.translate(o,0),t.scale(-1,1);break;case vs:t.translate(0,r),t.scale(1,-1);break;case bs:t.translate(o,r),t.scale(-1,-1)}if(t.yc(),r>(d=(e+s+c)*(u=this.Gc))&&(n=(n=this.verticalAlignment).y*r-n.y*d+n.offsetY),1===u&&null!==this.ze)(c=this.Cb)>o&&(c=o),this.Oj(this.ze,t,0,n+e,o,s,c,i,a,h,l);else if(null!==this.Qc&&null!==this.Qb)for(d=0;d<u;d++){var f=this.Qc[d];f>o&&(f=o),n+=e,this.Oj(this.Qb[d],t,0,n,o,s,f,i,a,h,l),n+=s+c}switch(this.flip){case xs:t.scale(-1,1),t.translate(-o,0);break;case vs:t.scale(1,-1),t.translate(0,-r);break;case bs:t.scale(-1,-1),t.translate(-o,-r)}}},e.Oj=function(t,e,i,n,o,r,s,a,h,l,u){var c=0;if(a)"left"===h?c=0:"right"===h?c=o-s:"center"===h&&(c=(o-s)/2),e.fillRect(i+c,n+.25*r,s,1);else{if("left"===h?c=0:"right"===h?c=o:"center"===h&&(c=o/2),o=null!==Il?Il(this,r):.75*r,e.fillText(t,i+c,n+o),0===(t=r/20|0)&&(t=1),"right"===h?c-=s:"center"===h&&(c-=s/2),l){h=i+c,l=n+(a=null!==zl?zl(this,r):.8*r),o=i+c+s,a=n+a;var d=t;e.beginPath(),e.lineWidth=d,e.moveTo(h,l),e.lineTo(o,a),e.stroke(),e.Se(),e instanceof va&&e.ad.classList.add("gojs-td")}u&&(u=n+r-r/2.2|0,0!=t%2&&(u+=.5),n=i+c,r=u,i=i+c+s,s=u,c=t,e.beginPath(),e.lineWidth=c,e.moveTo(n,r),e.lineTo(i,s),e.stroke(),e.Se(),e instanceof va&&e.ad.classList.add("gojs-td"))}},e.kk=function(t,e,i){if(!Fs.prototype.kk.call(this,t,e,i))return!1;if(Xs(this,t,this.xc,!0,!1,this.naturalBounds,this.actualBounds),i){if(0===this.svg.getElementsByTagName("text").length)return!0;for(e=this.svg.getElementsByClassName("gojs-td"),i=0;i<e.length;i++)Ma(t,e[i],!1)}else(e=this.svg).innerHTML=this.text,Ma(t,e,!0);return!0},e.nk=function(t){return!!(1<this.lineCount||this.isUnderline||this.isStrikethrough)||Fs.prototype.nk.call(this,t)},e.Dv=function(t,e){if("g"!==t.nodeName)t.setAttributeNS(null,"filter",e);else{t=t.getElementsByTagName("text");for(var i=0;i<t.length;i++)t[i].setAttributeNS(null,"filter",e)}},e.Wl=function(t,e,i,n){var o=this.Gc;this.Ih=t,this.l&=-16777217;var r,s=this.Ae;if(null!==tu&&Ql!==s&&(Ql=tu.font=s),this.Cb=this.Le=0,this.ze=this.Qb=this.Qc=this.df=null,isNaN(this.desiredSize.width)){if(0===(s=this.ec.replace(/\r\n/g,"\n").replace(/\r/g,"\n")).length)s=8;else if(this.isMultiline){for(var a=r=0,h=!1;!h;){var l=s.indexOf("\n",a);-1===l&&(l=s.length,h=!0),a=s.substr(a,l-a),this.formatting===Ul&&(a=a.trim()),r=Math.max(r,Dl(a)),a=l+1}s=r}else 0<=(r=s.indexOf("\n",0))&&(s=s.substr(0,r)),s=Dl(s);s=Math.min(s,t/this.scale)}else s=this.desiredSize.width;if(null!==this.panel&&(s=Math.min(s,this.panel.maxSize.width)),r=El(this,s),h=r=isNaN(this.desiredSize.height)?Math.min(r,e/this.scale):this.desiredSize.height,0!==this.Cb&&null!==this.Qc&&null!==this.Qb&&this.overflow===Xl&&(e=this.Ae,e=this.overflow===Xl?jl(e):0,l=this.spacingAbove+this.spacingBelow,l=Math.max(0,Fl(this)+l),!((h=Math.min(this.maxLines-1,Math.max(Math.floor(h/l+.01)-1,0)))+1>=this.Qb.length))){for(this.l|=16777216,l=this.Qb[h],e=Math.max(1,t-e);Dl(l)>e&&1<l.length;)l=l.substr(0,l.length-1);e=Dl(l+=Zl),this.Qb[h]=l,this.Qb=this.Qb.slice(0,h+1),this.Qc[h]=e,this.Qc=this.Qc.slice(0,h+1),this.Le=this.Qb.length,this.Cb=Math.max(this.Cb,e),this.Gc=this.Le,1===this.Gc&&(this.ze=this.Qb[0])}(this.wrap===Vl||isNaN(this.desiredSize.width))&&(s=isNaN(t)?this.Cb:Math.min(t,this.Cb)),s=Math.max(i,s),r=Math.max(n,r),Et(this.dc,s,r),this.Ge(0,0,s,r),null!==this.svg&&o!==this.Gc&&(this.Uc=!0)},e.eh=function(t,e,i,n){Is(this,t,e,i,n)},d.Object.defineProperties(Pl.prototype,{font:{get:function(){return this.Ae},set:function(t){var e=this.Ae;e!==t&&(this.Ae=t,this.df=null,this.v(),this.g("font",e,t))}},text:{get:function(){return this.ec},set:function(t){var e=this.ec;e!==(t=null!=t?t.toString():"")&&(this.ec=t,this.v(),this.g("text",e,t),this.Uc=!0)}},textAlign:{get:function(){return null!==this.da?this.da.Or:"start"},set:function(t){var e=this.textAlign;e===t||"start"!==t&&"end"!==t&&"left"!==t&&"right"!==t&&"center"!==t||(Tl(this),this.da.Or=t,this.N(),this.g("textAlign",e,t))}},flip:{get:function(){return null!==this.da?this.da.Xf:ds},set:function(t){var e=this.flip;e!==t&&(Tl(this),this.da.Xf=t,this.N(),this.g("flip",e,t))}},verticalAlignment:{get:function(){return null!==this.da?this.da.Yr:Te},set:function(t){var e=this.verticalAlignment;e.D(t)||(t=t.J(),Tl(this),this.da.Yr=t,qs(this),this.g("verticalAlignment",e,t))}},naturalBounds:{get:function(){if(!this.dc.w()){var t=At.alloc();Al(this,this.ec,999999,t);var e=t.width;At.free(t),t=El(this,e);var i=this.desiredSize;isNaN(i.width)||(e=i.width),isNaN(i.height)||(t=i.height),Et(this.dc,e,t)}return this.dc}},isMultiline:{get:function(){return 0!=(2097152&this.l)},set:function(t){var e=0!=(2097152&this.l);e!==t&&(this.l^=2097152,this.v(),this.g("isMultiline",e,t))}},isUnderline:{get:function(){return 0!=(4194304&this.l)},set:function(t){var e=0!=(4194304&this.l);e!==t&&(this.l^=4194304,this.Uc=!0,this.N(),this.g("isUnderline",e,t))}},isStrikethrough:{get:function(){return 0!=(8388608&this.l)},set:function(t){var e=0!=(8388608&this.l);e!==t&&(this.l^=8388608,this.Uc=!0,this.N(),this.g("isStrikethrough",e,t))}},wrap:{get:function(){return null!==this.da?this.da.$r:Gl},set:function(t){var e=this.wrap;e!==t&&(Tl(this),this.da.$r=t,this.v(),this.g("wrap",e,t))}},overflow:{get:function(){return null!==this.da?this.da.$q:Yl},set:function(t){var e=this.overflow;e!==t&&(Tl(this),this.da.$q=t,this.v(),this.g("overflow",e,t))}},isOverflowed:{get:function(){return 0!=(16777216&this.l)}},stroke:{get:function(){return this.xc},set:function(t){var e=this.xc;e!==t&&(null!==t&&Ka(t,"TextBlock.stroke"),t instanceof Oa&&t.freeze(),this.xc=t,this.N(),this.g("stroke",e,t))}},lineCount:{get:function(){return this.Gc}},lineHeight:{get:function(){return Fl(this)}},editable:{get:function(){return 0!=(1048576&this.l)},set:function(t){var e=0!=(1048576&this.l);e!==t&&(this.l^=1048576,this.g("editable",e,t))}},textEditor:{get:function(){return null!==this.da?this.da.Qr:null},set:function(t){var e=this.textEditor;e!==t&&(Tl(this),this.da.Qr=t,this.g("textEditor",e,t))}},errorFunction:{get:function(){return null!==this.da?this.da.Hd:null},set:function(t){var e=this.errorFunction;e!==t&&(Tl(this),this.da.Hd=t,this.g("errorFunction",e,t))}},interval:{get:function(){return null!==this.fa?this.fa.Tk:1},set:function(t){var e=this.interval;if(e!==(t=Math.round(t))&&0!==t&&isFinite(t)){null===this.fa&&(this.fa=new nu),this.fa.Tk=t,this.v();var i=this.panel;null!==i&&(i.graduatedIntervals=null),this.g("interval",e,t)}}},graduatedStart:{get:function(){return null!==this.fa?this.fa.u:0},set:function(t){var e=this.graduatedStart;e!==t&&(0>t?t=0:1<t&&(t=1),null===this.fa&&(this.fa=new nu),this.fa.u=t,this.v(),this.g("graduatedStart",e,t))}},graduatedEnd:{get:function(){return null!==this.fa?this.fa.j:1},set:function(t){var e=this.graduatedEnd;e!==t&&(0>t?t=0:1<t&&(t=1),null===this.fa&&(this.fa=new nu),this.fa.j=t,this.v(),this.g("graduatedEnd",e,t))}},graduatedFunction:{get:function(){return null!==this.fa?this.fa.F:null},set:function(t){var e=this.graduatedFunction;e!==t&&(null===this.fa&&(this.fa=new nu),this.fa.F=t,this.v(),this.g("graduatedFunction",e,t))}},graduatedSkip:{get:function(){return null!==this.fa?this.fa.o:null},set:function(t){var e=this.graduatedSkip;e!==t&&(null===this.fa&&(this.fa=new nu),this.fa.o=t,this.v(),this.g("graduatedSkip",e,t))}},textValidation:{get:function(){return null!==this.da?this.da.vj:null},set:function(t){var e=this.textValidation;e!==t&&(Tl(this),this.da.vj=t,this.g("textValidation",e,t))}},textEdited:{get:function(){return null!==this.da?this.da.Pr:null},set:function(t){var e=this.textEdited;e!==t&&(Tl(this),this.da.Pr=t,this.g("textEdited",e,t))}},spacingAbove:{get:function(){return null!==this.da?this.da.Dr:0},set:function(t){var e=this.spacingAbove;e!==t&&(Tl(this),this.da.Dr=t,this.v(),this.g("spacingAbove",e,t))}},spacingBelow:{get:function(){return null!==this.da?this.da.Er:0},set:function(t){var e=this.spacingBelow;e!==t&&(Tl(this),this.da.Er=t,this.v(),this.g("spacingBelow",e,t))}},formatting:{get:function(){return null!==this.da?this.da.gq:Ul},set:function(t){var e=this.formatting;e!==t&&(Tl(this),this.da.gq=t,this.v(),this.g("formatting",e,t))}},maxLines:{get:function(){return null!==this.da?this.da.Jq:1/0},set:function(t){var e=this.maxLines;e!==t&&(0>=(t=Math.floor(t))&&S(t,"> 0",Pl,"maxLines"),Tl(this),this.da.Jq=t,this.v(),this.g("maxLines",e,t))}},metrics:{get:function(){return{arrSize:null!==this.Qc?this.Qc:[this.Cb],arrText:null!==this.Qb?this.Qb:[this.ze],maxLineWidth:this.Cb,fontHeight:this.df}}},choices:{get:function(){return this.Gm},set:function(t){var e=this.Gm;e!==t&&(this.Gm=t,this.g("choices",e,t))}}});var Ol,Il=null,zl=null,Rl=new V(Pl,"None",0),Vl=new V(Pl,"WrapFit",1),Gl=new V(Pl,"WrapDesiredSize",2),Hl=new V(Pl,"WrapBreakAll",3),Yl=new V(Pl,"OverflowClip",0),Xl=new V(Pl,"OverflowEllipsis",1),Ul=new V(Pl,"FormatTrim",0),ql=new V(Pl,"FormatNone",0),Wl=/[ \u200b\u00ad]/,Kl=new Y,_l=0,$l=new Y,Jl=0,Zl="...",Ql="",tu=null,eu=!1;function iu(){this.nc=!1,this.Hd=null,this.Xf=ds,this.gq=Ul,this.Jq=1/0,this.$q=Yl,this.Er=this.Dr=0,this.Or="start",this.vj=this.Qr=this.Pr=null,this.Yr=Te,this.$r=Gl}function nu(){this.Tk=1,this.u=0,this.j=1,this.o=this.F=null}function ou(t,e){Fs.call(this),this.Eg=null,this.qo="",this.Xg=qt,this.Nk=cs,this.Zg=this.Hd=null,this.Mk=oe,this.Xf=ds,this.vl=null,this.qn=!1,this.en=!0,this.al=!1,this.bt=this.rl=null,"string"==typeof t?this.source=t:t&&Object.assign(this,t),e&&Object.assign(this,e)}function ru(t){void 0===t&&(t=""),""!==t?Ol[t]&&(delete Ol[t],au--):(Ol=new Y,au=0)}function su(t,e){e.qy||(e.Fq=function(i){e.sq=!0,e.ln=!1;var n=e.Bg.copy();if(null!=n){for(n=n.iterator;n.next();){var o=n.value;o.N();var r=e.getAttribute("src")||"",s=o.Og.I(r);if(null!==s)for(var a=s.length,h=0;h<a;h++)r=s[h],o.Xn.add(r),r.Uc=!0,o.$b(),e.hn&&(void 0===e.eu&&(e.eu=i),null!==r.Zg&&r.Zg(r,i))}e.Bg.clear()}t.desiredSize.w()||(ia(t,!1),t.v())},e.Yp=function(t){e.ln=t;var i=e.Bg.copy();if(null!=i){for(i=i.iterator;i.next();){var n=i.value,o=e.getAttribute("src")||"",r=n.Og.I(o);if(null!==r){n=r.length,o=A();for(var s=0;s<n;s++)o.push(r[s]);if(e.hn)for(s=0;s<n;s++)null!==(r=o[s]).Hd&&r.Hd(r,t);B(o)}}e.Bg.clear()}},e.addEventListener("load",e.Fq),e.addEventListener("error",e.Yp),e.qy=!0)}Pl.className="TextBlock",iu.prototype.copy=function(){var t=new iu;return t.Hd=this.Hd,t.Xf=this.Xf,t.gq=this.gq,t.Jq=this.Jq,t.$q=this.$q,t.Dr=this.Dr,t.Er=this.Er,t.Or=this.Or,t.Pr=this.Pr,t.Qr=this.Qr,t.vj=this.vj,t.Yr=this.Yr,t.$r=this.$r,t},Pl.getEllipsis=function(){return Zl},Pl.setEllipsis=function(t){Zl=t,$l=new Y,Jl=0},Pl.getBaseline=function(){return Il},Pl.setBaseline=function(t){Il=t},Pl.getUnderline=function(){return zl},Pl.setUnderline=function(t){zl=t},Pl.isValidFont=function(t){if(eu||(tu=Vr?new Da(null).context:null,eu=!0),null===tu)return!0;var e=tu.font;if(t===e||"10px sans-serif"===t)return!0;tu.font="10px sans-serif",tu.font=t;var i=tu.font;if("10px sans-serif"!==i)return tu.font=e,!0;tu.font="19px serif";var n=tu.font;return tu.font=t,i=tu.font,tu.font=e,i!==n},Pl.FormatNone=ql,Pl.FormatTrim=Ul,Pl.None=Rl,Pl.OverflowClip=Yl,Pl.OverflowEllipsis=Xl,Pl.WrapBreakAll=Hl,Pl.WrapDesiredSize=Gl,Pl.WrapFit=Vl,nu.prototype.copy=function(){var t=new nu;return t.Tk=this.Tk,t.u=this.u,t.j=this.j,t.F=this.F,t.o=this.o,t},nu.className="GradElementSettings",c(ou,Fs),ou.prototype.cloneProtected=function(t){Fs.prototype.cloneProtected.call(this,t),t.qo=this.qo,t.element=this.Eg,t.Xg=this.Xg.J(),t.Nk=this.Nk,t.Xf=this.Xf,t.Hd=this.Hd,t.Zg=this.Zg,t.Mk=this.Mk.J(),t.en=this.en,t.rl=this.rl},ou.prototype.qb=function(t){t===ds||t===fs||t===ys?this.imageStretch=t:Fs.prototype.qb.call(this,t)},ou.prototype.toString=function(){return"Picture("+this.source+")#"+et(this)},ou.prototype.hA=function(){if(""!==this.source){ru(this.source);var t=this.source;this.source="",this.source=t}},ou.prototype.redraw=function(){this.N(),this.Uc=!0},ou.prototype.hh=function(t,e){var i=this.Eg;if(null!==i){var n=i.getAttribute("src");if(!(i instanceof HTMLImageElement&&(null===n||""===n)||i.ln instanceof Event&&t instanceof Fa)){var o=t instanceof va;n=this.naturalBounds;var r=0,s=0,a=this.qn,h=a?+i.width:i.naturalWidth;if(a=a?+i.height:i.naturalHeight,void 0===h&&i.videoWidth&&(h=i.videoWidth),void 0===a&&i.videoHeight&&(a=i.videoHeight),h=h||n.width,a=a||n.height,0!==h&&0!==a){var l=h,u=a;this.sourceRect.w()&&(r=this.Xg.x,s=this.Xg.y,h=this.Xg.width,a=this.Xg.height);var c=h,d=a,f=this.Nk,p=this.Mk;switch(f){case ds:if(this.sourceRect.w())break;c>=n.width&&(r=r+p.offsetX+(c*p.x-n.width*p.x)),d>=n.height&&(s=s+p.offsetY+(d*p.y-n.height*p.y)),h=Math.min(n.width,c),a=Math.min(n.height,d);break;case cs:c=n.width,d=n.height;break;case fs:case ys:f===fs?(c*=f=Math.min(n.height/d,n.width/c),d*=f):f===ys&&(d*=f=Math.max(n.height/d,n.width/c),(c*=f)>=n.width&&(r=(r+p.offsetX+(c*p.x-n.width*p.x)/c)*h),d>=n.height&&(s=(s+p.offsetY+(d*p.y-n.height*p.y)/d)*a),h*=1/(c/n.width),a*=1/(d/n.height),c=n.width,d=n.height)}var g=c*(f=this.Df()*e.scale)*d*f,m=h*a/g,y=i.__goCache;f=null;var v=hu;if(!o){if(i.sq&&void 0!==y&&4<g&&m>v*v)for(null===y.gi&&(uu(y,4,l,u,i),uu(y,16,l,u,i)),l=(o=y.gi).length,u=0;u<l&&o[u].ratio*o[u].ratio<m;u++)f=o[u];if(!e.Xm){if(null===this.vl)if(null===this.Eg)this.vl=!1;else{o=new Da(null).context;try{o.drawImage(this.Eg,0,0)}catch(t){this.en=!1}try{o.getImageData(0,0,1,1).data[3]&&(this.vl=!1),this.vl=!1}catch(t){this.vl=!0}}if(this.vl)return}}switch(o=c<n.width?p.offsetX+(n.width*p.x-c*p.x):0,p=d<n.height?p.offsetY+(n.height*p.y-d*p.y):0,this.flip){case xs:t.translate(Math.min(n.width,c),0),t.scale(-1,1);break;case vs:t.translate(0,Math.min(n.height,d)),t.scale(1,-1);break;case bs:t.translate(Math.min(n.width,c),Math.min(n.height,d)),t.scale(-1,-1)}if(t.yc(),e.Gf("pictureRatioOptimization")&&!e.$i&&void 0!==y&&null!==f&&1!==f.ratio){t.save(),e=f.ratio;try{t.drawImage(f.source,r/e,s/e,Math.min(f.source.width,h/e),Math.min(f.source.height,a/e),o,p,Math.min(n.width,c),Math.min(n.height,d)),t instanceof va&&(this.bt=[r/e,s/e,Math.min(f.source.width,h/e),Math.min(f.source.height,a/e),o,p,Math.min(n.width,c),Math.min(n.height,d)])}catch(t){this.en=!1}t.restore()}else try{t.drawImage(i,r,s,h,a,o,p,Math.min(n.width,c),Math.min(n.height,d)),t instanceof va&&(this.bt=[r,s,h,a,o,p,Math.min(n.width,c),Math.min(n.height,d)])}catch(t){this.en=!1}switch(this.flip){case xs:t.scale(-1,1),t.translate(-Math.min(n.width,c),0);break;case vs:t.scale(1,-1),t.translate(0,-Math.min(n.height,d));break;case bs:t.scale(-1,-1),t.translate(-Math.min(n.width,c),-Math.min(n.height,d))}}}}},ou.prototype.Wl=function(t,e,i,n){var o=this.desiredSize,r=Ws(this,!0),s=this.Eg,a=this.qn,h=0,l=0;(a||!this.al&&s&&s.complete)&&(this.al=!0),null===s?(isFinite(o.width)||(t=0),isFinite(o.height)||(e=0)):(h=a?+s.width:s.naturalWidth,l=a?+s.height:s.naturalHeight),isFinite(o.width)||r===cs||r===ps?(isFinite(t)||(this.sourceRect.w()?t=this.sourceRect.width:null!==s&&(t=h)),i=0):null!==s&&!1!==this.al&&(t=this.sourceRect.w()?this.sourceRect.width:h),isFinite(o.height)||r===cs||r===gs?(isFinite(e)||(this.sourceRect.w()?e=this.sourceRect.height:null!==s&&(e=l)),n=0):null!==s&&!1!==this.al&&(e=this.sourceRect.w()?this.sourceRect.height:l),isFinite(o.width)&&(t=o.width),isFinite(o.height)&&(e=o.height),o=this.maxSize,r=this.minSize,i=Math.max(i||0,r.width),n=Math.max(n||0,r.height),t=Math.min(o.width,t),e=Math.min(o.height,e),t=Math.max(i,t),e=Math.max(n,e),null===s||s.complete||(isFinite(t)||(t=0),isFinite(e)||(e=0)),Et(this.dc,t,e),this.Ge(0,0,t,e)},ou.prototype.eh=function(t,e,i,n){Is(this,t,e,i,n)},d.Object.defineProperties(ou.prototype,{element:{get:function(){return this.Eg},set:function(t){var e=this.Eg;if(this.Uc=!0,e!==t){this.qn=t instanceof HTMLCanvasElement;var i=t instanceof HTMLImageElement;null===t||i||t instanceof HTMLVideoElement||this.qn||w("Picture.element must be an instance of Image, Canvas, or Video, not: "+t);var n=this.diagram;null!==n&&wr(n,this),this.Eg=t,null!==t&&i&&void 0===t.Bg&&(t.Bg=new Z),null!==n&&i&&br(n,this),null!==t&&(this.qn||!0===t.complete?(t.hn&&(t.ln instanceof Event&&null!==this.Hd?this.Hd(this,t.ln):!0===t.sq&&!t.ln&&null!==this.Zg&&t.eu&&this.Zg(this,t.eu)),t.sq=!0,this.desiredSize.w()||(ia(this,!1),this.v())):i&&su(this,t)),this.g("element",e,t),this.N()}}},source:{get:function(){return this.qo},set:function(t){var e=this.qo;if(e!==t){this.Uc=!0,this.qo=t;var i=Ol;if(Vr){var n=null;if(void 0!==i[t])n=i[t];else if(""!==t){30<au&&(ru(),i=Ol),(n=b("img")).hn=!0,su(this,n);var o=this.rl;null!==o&&(n.crossOrigin=o(this)),n.src=t,i[t]=n,au++}this.element=n,null!==n&&void 0===n.__goCache&&(n.__goCache=new lu),this.v(),this.N()}this.g("source",e,t)}}},sourceCrossOrigin:{get:function(){return this.rl},set:function(t){if(this.rl!==t&&(this.rl=t,null!==this.element)){var e=this.element.getAttribute("src");null===t&&"string"==typeof e?this.element.crossOrigin=null:null!==t&&(this.element.crossOrigin=t(this)),this.element.src=e}}},sourceRect:{get:function(){return this.Xg},set:function(t){var e=this.Xg;e.D(t)||(this.Xg=t=t.J(),this.N(),this.g("sourceRect",e,t))}},imageStretch:{get:function(){return this.Nk},set:function(t){var e=this.Nk;e!==t&&(this.Nk=t,this.N(),this.g("imageStretch",e,t))}},flip:{get:function(){return this.Xf},set:function(t){var e=this.Xf;e!==t&&(this.Xf=t,this.N(),this.g("flip",e,t))}},imageAlignment:{get:function(){return this.Mk},set:function(t){var e=this.Mk;e.D(t)||(this.Mk=t=t.J(),this.N(),this.g("imageAlignment",e,t))}},errorFunction:{get:function(){return this.Hd},set:function(t){var e=this.Hd;e!==t&&(this.Hd=t,this.g("errorFunction",e,t))}},successFunction:{get:function(){return this.Zg},set:function(t){var e=this.Zg;e!==t&&(this.Zg=t,this.g("successFunction",e,t))}},naturalBounds:{get:function(){return this.dc}}}),ou.prototype.redraw=ou.prototype.redraw,ou.prototype.reloadSource=ou.prototype.hA;var au=0,hu=4;function lu(){this.gi=null}function uu(t,e,i,n,o){null===t.gi&&(t.gi=[]);var r=new Da(null),s=r.context,a=1/e;r.width=i/e,r.height=n/e,0!==r.width&&0!==r.height&&(e=new cu(r.Oa,e),i=1,0<t.gi.length&&(o=(i=t.gi[t.gi.length-1]).source,i=i.ratio),s.setTransform(a*i,0,0,a*i,0,0),s.yc(),s.drawImage(o,0,0),t.gi.push(e))}function cu(t,e){this.source=t,this.ratio=e}function du(){this.os=new Xe,this.mc=null}function fu(t,e,i,n,o,r){t.mc=new Ze,t.mc.startX=e,t.mc.startY=i,t.mc.isFilled=n,t.mc.isEvenOdd=r||!1,t.os.figures.add(t.mc),void 0!==o&&(t.mc.isShadowed=o)}function pu(t){var e=t.mc.segments.length;0<e&&t.mc.segments.M(e-1).close()}function gu(t,e,i,n,o,r,s){var a;void 0===a&&(a=!1);var h=new Qe(oi);h.point1X=e,h.point1Y=i,h.point2X=n,h.point2Y=o,h.endX=r,h.endY=s,a&&h.close(),t.mc.segments.add(h)}function mu(t,e,i,n,o){var r;void 0===r&&(r=!1);var s=new Qe(ri);s.point1X=e,s.point1Y=i,s.endX=n,s.endY=o,r&&s.close(),t.mc.segments.add(s)}function yu(t,e,i,n,o,r,s,a){var h;void 0===h&&(h=!1),e=new Qe(ai,s,a,e,i,n,o,r),h&&e.close(),t.mc.segments.add(e)}function vu(t){var e=xu;return null!==e?(xu=null,e.reset(t),e):((e=new du).reset(t),e)}ou.className="Picture",Ol=new Y,ou.clearCache=ru,lu.className="PictureCacheArray",cu.className="PictureCacheInstance",du.prototype.reset=function(t){null!==t?(t.ka(),this.os=t,t.figures.clear()):this.os=new Xe,this.mc=null},du.prototype.moveTo=function(t,e,i){void 0===i&&(i=!1);var n=new Qe(ii);n.endX=t,n.endY=e,i&&n.close(),this.mc.segments.add(n)},du.prototype.lineTo=function(t,e,i){void 0===i&&(i=!1);var n=new Qe(ni);n.endX=t,n.endY=e,i&&n.close(),this.mc.segments.add(n)},du.prototype.arcTo=function(t,e,i,n,o,r,s){void 0===r&&(r=0),void 0===s&&(s=!1);var a=new Qe(si);a.startAngle=t,a.sweepAngle=e,a.centerX=i,a.centerY=n,a.radiusX=o,a.radiusY=0!==r?r:o,s&&a.close(),this.mc.segments.add(a)};var xu=null;function bu(t,e){var i=t.toLowerCase(),n=Ye.Ze;n[t]=e,n[i]=t}function wu(){this.nc=!1,this.tr=this.Kp=this.zq=null,this.vr="",this.fr=this.oq=this.ur=null,this.hr="",this.gr=Nt,this.ir=null,this.jr="",this.lr=Me,this.Gq="",this.Hq=te,this.Pq=nt,this.Kq=ot,this.Up=null,this.Cq=127,this.zr=rt,this.yr="gray",this.Vg=4}function ku(t,e){void 0===t||t instanceof ch||"string"==typeof t?Th.call(this,t):(Th.call(this),t&&(e=t)),this.G=2408959,this.Tf="",this.P=null,this.Jg="",this.Qf=this.Ug=null,this.ec="",this.Ah=this.Ig=null,this.ke=new pt(NaN,NaN).freeze(),this.nf=null,this.Ao=NaN,this.vw=-1,this.py=new jt,this.Rh=null,this.ag=NaN,e&&Object.assign(this,e)}function Su(t){null===t.P?t.P=new wu:t.P.nc&&(t.P=t.P.copy())}function Mu(t){0!=(16384&t.G)!=!1&&(t.updateAdornments(),t.G&=-16385)}function Cu(t){if(!1===Ou(t)){Iu(t,!0),t.Uk();var e=t.diagram;null!==e&&(e.De.add(t),e.$b())}}function Pu(t){if(t.G|=2097152,!1!==Ou(t)){var e=t.position,i=t.location;i.w()&&e.w()||Bu(t,e,i),i=t.Ib;var n=jt.alloc().assign(i);i.ka(),i.x=e.x,i.y=e.y,i.freeze(),t.Xl(n,i),jt.free(n),Iu(t,!1)}}function Tu(t,e,i,n){void 0===n&&(n=new pt),i=i.Mc()?oe:i;var o=e.naturalBounds;if(n.h(o.width*i.x+i.offsetX,o.height*i.y+i.offsetY),null===e||e===t)return n;for(e.transform.Ga(n),e=e.panel;null!==e&&e!==t;)e.transform.Ga(n),e=e.panel;return null!==t.Lb&&t.Lb.Ga(n),n.offset(-t.uc.x,-t.uc.y),n}function Nu(t){var e=pt.alloc(),i=t.locationObject,n=i.naturalBounds,o=i instanceof pl?i.strokeWidth:0;if(e.yi(0,0,n.width+o,n.height+o,t.locationSpot),i!==t)for(e.offset(-o/2,-o/2),i.transform.Ga(e),i=i.panel;null!==i&&i!==t;)i.transform.Ga(e),i=i.panel;return null!==t.Lb&&t.Lb.Ga(e),e.offset(-t.uc.x,-t.uc.y),e}function Lu(t,e){var i=t.py;isNaN(t.ag)&&(t.ag=Rh(t));var n=t.ag,o=2*n;if(!t.isShadowed)return i.h(e.x-1-n,e.y-1-n,e.width+2+o,e.height+2+o),i;n=e.x,o=e.y;var r=e.width;e=e.height;var s=t.shadowBlur;return r+=s,e+=s,n-=s/2,o-=s/2,0<(t=t.shadowOffset).x?r+=t.x:(n+=t.x,r-=t.x),0<t.y?e+=t.y:(o+=t.y,e-=t.y),i.h(n-1,o-1,r+2,e+2),i}function Au(t,e,i,n,o){null===e||t instanceof Wu||(e=e.animationManager).zb&&_n(e,t,new pt(n,o),i)}function Bu(t,e,i){var n=Nu(t),o=t.diagram,r=i.w(),s=e.w();r&&s?0!=(2097152&t.G)?Du(t,e,i,o,n):Fu(t,e,i,o,n):r?Du(t,e,i,o,n):s&&Fu(t,e,i,o,n),t.G|=2097152,pt.free(n),t.Uk()}function Du(t,e,i,n,o){var r=e.x,s=e.y;e.h(i.x-o.x,i.y-o.y),null!==n&&((n=(i=n.animationManager).defaultAnimation.isAnimating)||!i.zb||t instanceof Wu||_n(i,t,new pt(r,s),e),n||e.x===r&&e.y===s||t.g("position",new pt(r,s),e.copy()))}function Fu(t,e,i,n,o){var r=i.copy();i.h(e.x+o.x,e.y+o.y),i.D(r)||null===n||t.g("location",r,i.copy())}function ju(t,e,i){zu(t,!1),t instanceof _u&&jr(i,t),t.layer.isTemporary||e||i.Ya(),e=t.Ib;var n=i.viewportBounds;n.w()?Ru(t)?(Gt(e,n)||t.Fd(!1),t.updateAdornments()):t.isVisible()&&e.Yc(n)?(t.Fd(!0),t.updateAdornments()):t.Wb():i.vd=!0}function Eu(t,e,i,n){e.constructor===t.constructor||qu||(qu=!0,M('Should not change the class of the Part when changing category from "'+i+'" to "'+n+'"'),M(" Old class: "+D(t.constructor)+", new class: "+D(e.constructor)+", part: "+t.toString())),t.Ej();var o=t.data;i=t.layerName;var r=t.isSelected,s=t.isHighlighted,a=!0,h=!0,l=!1;t instanceof _u&&(a=t.isTreeLeaf,h=t.isTreeExpanded,l=t.wasTreeExpanded),e.Af(t),e.cloneProtected(t),t.Tf=n,null!==t.svg&&(t.svg.remove(),t.svg=null,t.Uc=!0),t.v(),t.N(),n=!0,null!==(e=t.diagram)&&(n=e.skipsUndoManager,e.skipsUndoManager=!0),t.ub=o,t.G=r?4096|t.G:-4097&t.G,t.G=s?524288|t.G:-524289&t.G,t instanceof _u&&(t.U=a?4|t.U:-5&t.U,t.U=h?1|t.U:-2&t.U,t.U=l?2|t.U:-3&t.U),null!==o&&t.La(),(o=t.layerName)!==i&&(t.Jg=i,t.layerName=o),null!==e&&(e.skipsUndoManager=n),t.Zc()&&t.C(64)}function Ou(t){return 0!=(32768&t.G)}function Iu(t,e){t.G=e?32768|t.G:-32769&t.G}function zu(t,e){t.G=e?65536|t.G:-65537&t.G}function Ru(t){return 0!=(131072&t.G)}function Vu(t,e){t.G=e?1048576|t.G:-1048577&t.G}function Gu(t,e){var i=e.containingGroup;return null!==i?1+Gu(t,i):e instanceof _u&&null!==(e=e.labeledLink)?Gu(t,e):0}function Hu(t,e){var i=e.containingGroup;return null!==i||e instanceof _u&&null!==(i=e.labeledLink)?Hu(t,i):e}function Yu(t,e,i){if(e===i||null===i)return!1;var n=e.containingGroup;return!(null===n||n!==i&&!Yu(t,n,i))||e instanceof _u&&null!==(e=e.labeledLink)&&Yu(t,e,i)}function Xu(t){return!!t.isVisible()&&(null===(t=t.layer)||!t.isTemporary)}function Uu(t,e,i,n,o,r){if(void 0===r&&(r=null),!(t.contains(e)||null!==r&&!r(e)||e instanceof Wu))if(t.add(e),e instanceof _u){if(i&&e instanceof gc)for(var s=e.memberParts;s.next();)Uu(t,s.value,i,n,o,r);if(!1!==o)for(s=e.linksConnected;s.next();){var a=s.value;if(!t.contains(a)){var h=a.fromNode,l=a.toNode;h=null===h||t.contains(h),l=null===l||t.contains(l),(o?h&&l:h||l)&&Uu(t,a,i,n,o,r)}}if(1<n)for(e=e.Ou();e.next();)Uu(t,e.value,i,n-1,o,r)}else if(e instanceof wc)for(e=e.labelNodes;e.next();)Uu(t,e.value,i,n,o,r)}du.className="StreamGeometryContext",bu("Rectangle",(function(t,e,i){t="r"+e+","+i;var n=Ye.Mf[t];return void 0!==n||((n=new Xe(Xe.u)).endX=e,n.endY=i,Ye.Nf<Ye.vm&&(Ye.Mf[t]=n,Ye.Nf++)),n})),bu("Square",(function(t,e,i){t="s"+e+","+i;var n=Ye.Mf[t];return void 0!==n||((n=new Xe(Xe.u)).endX=e,n.endY=i,n.defaultStretch=fs,Ye.Nf<Ye.vm&&(Ye.Mf[t]=n,Ye.Nf++)),n})),bu("RoundedRectangle",(function(t,e,i){t=t?t.parameter1:NaN,(isNaN(t)||0>t)&&(t=5),t=Math.min(t,e/3);var n="rr"+e+","+i+","+(t=Math.min(t,i/3)),o=Ye.Mf[n];if(void 0!==o)return o;var r=t*Ye.wg;return o=(new Xe).add(new Ze(t,0,!0).add(new Qe(ni,e-t,0)).add(new Qe(oi,e,t,e-r,0,e,r)).add(new Qe(ni,e,i-t)).add(new Qe(oi,e-t,i,e,i-r,e-r,i)).add(new Qe(ni,t,i)).add(new Qe(oi,0,i-t,r,i,0,i-r)).add(new Qe(ni,0,t)).add(new Qe(oi,t,0,0,r,r,0).close())),1<r&&(o.spot1=new Oe(0,0,r,r),o.spot2=new Oe(1,1,-r,-r)),Ye.Nf<Ye.vm&&(Ye.Mf[n]=o,Ye.Nf++),o})),bu("Border","RoundedRectangle"),bu("Ellipse",(function(t,e,i){t="e"+e+","+i;var n=Ye.Mf[t];return void 0!==n||((n=new Xe(Xe.F)).endX=e,n.endY=i,n.spot1=Fe,n.spot2=je,Ye.Nf<Ye.vm&&(Ye.Mf[t]=n,Ye.Nf++)),n})),bu("Circle",(function(t,e,i){t="c"+e+","+i;var n=Ye.Mf[t];return void 0!==n||((n=new Xe(Xe.F)).endX=e,n.endY=i,n.spot1=Fe,n.spot2=je,n.defaultStretch=fs,Ye.Nf<Ye.vm&&(Ye.Mf[t]=n,Ye.Nf++)),n})),bu("TriangleRight",(function(t,e,i){return(new Xe).add(new Ze(0,0).add(new Qe(ni,e,.5*i)).add(new Qe(ni,0,i).close())).pm(0,.25,.5,.75)})),bu("TriangleDown",(function(t,e,i){return(new Xe).add(new Ze(0,0).add(new Qe(ni,e,0)).add(new Qe(ni,.5*e,i).close())).pm(.25,0,.75,.5)})),bu("TriangleLeft",(function(t,e,i){return(new Xe).add(new Ze(e,i).add(new Qe(ni,0,.5*i)).add(new Qe(ni,e,0).close())).pm(.5,.25,1,.75)})),bu("TriangleUp",(function(t,e,i){return(new Xe).add(new Ze(e,i).add(new Qe(ni,0,i)).add(new Qe(ni,.5*e,0).close())).pm(.25,.5,.75,1)})),bu("Triangle","TriangleUp"),bu("Diamond",(function(t,e,i){return(new Xe).add(new Ze(.5*e,0).add(new Qe(ni,0,.5*i)).add(new Qe(ni,.5*e,i)).add(new Qe(ni,e,.5*i).close())).pm(.25,.25,.75,.75)})),bu("LineH",(function(t,e,i){return(t=new Xe(Xe.j)).startX=0,t.startY=i/2,t.endX=e,t.endY=i/2,t})),bu("LineV",(function(t,e,i){return(t=new Xe(Xe.j)).startX=e/2,t.startY=0,t.endX=e/2,t.endY=i,t})),bu("None","Rectangle"),bu("BarH","Rectangle"),bu("BarV","Rectangle"),bu("MinusLine","LineH"),bu("PlusLine",(function(t,e,i){return(new Xe).add(new Ze(0,i/2,!1).add(new Qe(ni,e,i/2)).add(new Qe(ii,e/2,0)).add(new Qe(ni,e/2,i)))})),bu("XLine",(function(t,e,i){return(new Xe).add(new Ze(0,i,!1).add(new Qe(ni,e,0)).add(new Qe(ii,0,0)).add(new Qe(ni,e,i)))})),bu("LineRight",(function(t,e,i){return(new Xe).add(new Ze(.25*e,0,!1).add(new Qe(ni,.75*e,.5*i)).add(new Qe(ni,.25*e,i)))})),bu("LineDown",(function(t,e,i){return(new Xe).add(new Ze(0,.25*i,!1).add(new Qe(ni,.5*e,.75*i)).add(new Qe(ni,e,.25*i)))})),bu("LineLeft",(function(t,e,i){return(new Xe).add(new Ze(.75*e,0,!1).add(new Qe(ni,.25*e,.5*i)).add(new Qe(ni,.75*e,i)))})),bu("LineUp",(function(t,e,i){return(new Xe).add(new Ze(0,.75*i,!1).add(new Qe(ni,.5*e,.25*i)).add(new Qe(ni,e,.75*i)))})),Ye.um={"":"",Standard:"F1 m 0,0 l 8,4 -8,4 2,-4 z",Backward:"F1 m 8,0 l -2,4 2,4 -8,-4 z",Triangle:"F1 m 0,0 l 8,4.62 -8,4.62 z",BackwardTriangle:"F1 m 8,4 l 0,4 -8,-4 8,-4 0,4 z",Boomerang:"F1 m 0,0 l 8,4 -8,4 4,-4 -4,-4 z",BackwardBoomerang:"F1 m 8,0 l -8,4 8,4 -4,-4 4,-4 z",SidewaysV:"m 0,0 l 8,4 -8,4 0,-1 6,-3 -6,-3 0,-1 z",BackwardV:"m 8,0 l -8,4 8,4 0,-1 -6,-3 6,-3 0,-1 z",OpenTriangle:"m 0,0 l 8,4 -8,4",BackwardOpenTriangle:"m 8,0 l -8,4 8,4",OpenTriangleLine:"m 0,0 l 8,4 -8,4 m 8.5,0 l 0,-8",BackwardOpenTriangleLine:"m 8,0 l -8,4 8,4 m -8.5,0 l 0,-8",OpenTriangleTop:"m 0,0 l 8,4 m 0,4",BackwardOpenTriangleTop:"m 8,0 l -8,4 m 0,4",OpenTriangleBottom:"m 0,8 l 8,-4",BackwardOpenTriangleBottom:"m 0,4 l 8,4",HalfTriangleTop:"F1 m 0,0 l 0,4 8,0 z m 0,8",BackwardHalfTriangleTop:"F1 m 8,0 l 0,4 -8,0 z m 0,8",HalfTriangleBottom:"F1 m 0,4 l 0,4 8,-4 z",BackwardHalfTriangleBottom:"F1 m 8,4 l 0,4 -8,-4 z",ForwardSemiCircle:"m 4,0 b 270 180 0 4 4",BackwardSemiCircle:"m 4,8 b 90 180 0 -4 4",Feather:"m 0,0 l 3,4 -3,4",BackwardFeather:"m 3,0 l -3,4 3,4",DoubleFeathers:"m 0,0 l 3,4 -3,4 m 3,-8 l 3,4 -3,4",BackwardDoubleFeathers:"m 3,0 l -3,4 3,4 m 3,-8 l -3,4 3,4",TripleFeathers:"m 0,0 l 3,4 -3,4 m 3,-8 l 3,4 -3,4 m 3,-8 l 3,4 -3,4",BackwardTripleFeathers:"m 3,0 l -3,4 3,4 m 3,-8 l -3,4 3,4 m 3,-8 l -3,4 3,4",ForwardSlash:"m 0,8 l 5,-8",BackSlash:"m 0,0 l 5,8",DoubleForwardSlash:"m 0,8 l 4,-8 m -2,8 l 4,-8",DoubleBackSlash:"m 0,0 l 4,8 m -2,-8 l 4,8",TripleForwardSlash:"m 0,8 l 4,-8 m -2,8 l 4,-8 m -2,8 l 4,-8",TripleBackSlash:"m 0,0 l 4,8 m -2,-8 l 4,8 m -2,-8 l 4,8",Fork:"m 0,4 l 8,0 m -8,0 l 8,-4 m -8,4 l 8,4",BackwardFork:"m 8,4 l -8,0 m 8,0 l -8,-4 m 8,4 l -8,4",LineFork:"m 0,0 l 0,8 m 0,-4 l 8,0 m -8,0 l 8,-4 m -8,4 l 8,4",BackwardLineFork:"m 8,4 l -8,0 m 8,0 l -8,-4 m 8,4 l -8,4 m 8,-8 l 0,8",CircleFork:"F1 m 6,4 b 0 360 -3 0 3 z m 0,0 l 6,0 m -6,0 l 6,-4 m -6,4 l 6,4",BackwardCircleFork:"F1 m 0,4 l 6,0 m -6,-4 l 6,4 m -6,4 l 6,-4 m 6,0 b 0 360 -3 0 3",CircleLineFork:"F1 m 6,4 b 0 360 -3 0 3 z m 1,-4 l 0,8 m 0,-4 l 6,0 m -6,0 l 6,-4 m -6,4 l 6,4",BackwardCircleLineFork:"F1 m 0,4 l 6,0 m -6,-4 l 6,4 m -6,4 l 6,-4 m 0,-4 l 0,8 m 7,-4 b 0 360 -3 0 3",Circle:"F1 m 8,4 b 0 360 -4 0 4 z",Block:"F1 m 0,0 l 0,8 8,0 0,-8 z",StretchedDiamond:"F1 m 0,3 l 5,-3 5,3 -5,3 -5,-3 z",Diamond:"F1 m 0,4 l 4,-4 4,4 -4,4 -4,-4 z",Chevron:"F1 m 0,0 l 5,0 3,4 -3,4 -5,0 3,-4 -3,-4 z",StretchedChevron:"F1 m 0,0 l 8,0 3,4 -3,4 -8,0 3,-4 -3,-4 z",NormalArrow:"F1 m 0,2 l 4,0 0,-2 4,4 -4,4 0,-2 -4,0 z",X:"m 0,0 l 8,8 m 0,-8 l -8,8",TailedNormalArrow:"F1 m 0,0 l 2,0 1,2 3,0 0,-2 2,4 -2,4 0,-2 -3,0 -1,2 -2,0 1,-4 -1,-4 z",DoubleTriangle:"F1 m 0,0 l 4,4 -4,4 0,-8 z m 4,0 l 4,4 -4,4 0,-8 z",BigEndArrow:"F1 m 0,0 l 5,2 0,-2 3,4 -3,4 0,-2 -5,2 0,-8 z",ConcaveTailArrow:"F1 m 0,2 h 4 v -2 l 4,4 -4,4 v -2 h -4 l 2,-2 -2,-2 z",RoundedTriangle:"F1 m 0,1 a 1,1 0 0 1 1,-1 l 7,3 a 0.5,1 0 0 1 0,2 l -7,3 a 1,1 0 0 1 -1,-1 l 0,-6 z",SimpleArrow:"F1 m 1,2 l -1,-2 2,0 1,2 -1,2 -2,0 1,-2 5,0 0,-2 2,2 -2,2 0,-2 z",AccelerationArrow:"F1 m 0,0 l 0,8 0.2,0 0,-8 -0.2,0 z m 2,0 l 0,8 1,0 0,-8 -1,0 z m 3,0 l 2,0 2,4 -2,4 -2,0 0,-8 z",BoxArrow:"F1 m 0,0 l 4,0 0,2 2,0 0,-2 2,4 -2,4 0,-2 -2,0 0,2 -4,0 0,-8 z",TriangleLine:"F1 m 8,4 l -8,-4 0,8 8,-4 z m 0.5,4 l 0,-8",CircleEndedArrow:"F1 m 10,4 l -2,-3 0,2 -2,0 0,2 2,0 0,2 2,-3 z m -4,0 b 0 360 -3 0 3 z",DynamicWidthArrow:"F1 m 0,3 l 2,0 2,-1 2,-2 2,4 -2,4 -2,-2 -2,-1 -2,0 0,-2 z",EquilibriumArrow:"m 0,3 l 8,0 -3,-3 m 3,5 l -8,0 3,3",FastForward:"F1 m 0,0 l 3.5,4 0,-4 3.5,4 0,-4 1,0 0,8 -1,0 0,-4 -3.5,4 0,-4 -3.5,4 0,-8 z",Kite:"F1 m 0,4 l 2,-4 6,4 -6,4 -2,-4 z",HalfArrowTop:"F1 m 0,0 l 4,4 4,0 -8,-4 z m 0,8",HalfArrowBottom:"F1 m 0,8 l 4,-4 4,0 -8,4 z",OpposingDirectionDoubleArrow:"F1 m 0,4 l 2,-4 0,2 4,0 0,-2 2,4 -2,4 0,-2 -4,0 0,2 -2,-4 z",PartialDoubleTriangle:"F1 m 0,0 4,3 0,-3 4,4 -4,4 0,-3 -4,3 0,-8 z",LineCircle:"F1 m 0,0 l 0,8 m 7 -4 b 0 360 -3 0 3 z",DoubleLineCircle:"F1 m 0,0 l 0,8 m 2,-8 l 0,8 m 7 -4 b 0 360 -3 0 3 z",TripleLineCircle:"F1 m 0,0 l 0,8 m 2,-8 l 0,8 m 2,-8 l 0,8 m 7 -4 b 0 360 -3 0 3 z",CircleLine:"F1 m 6 4 b 0 360 -3 0 3 z m 1,-4 l 0,8",DiamondCircle:"F1 m 8,4 l -4,4 -4,-4 4,-4 4,4 m 8,0 b 0 360 -4 0 4 z",PlusCircle:"F1 m 8,4 b 0 360 -4 0 4 l -8 0 z m -4 -4 l 0 8",OpenRightTriangleTop:"m 8,0 l 0,4 -8,0 m 0,4",OpenRightTriangleBottom:"m 8,8 l 0,-4 -8,0",Line:"m 0,0 l 0,8",DoubleLine:"m 0,0 l 0,8 m 2,0 l 0,-8",TripleLine:"m 0,0 l 0,8 m 2,0 l 0,-8 m 2,0 l 0,8",PentagonArrow:"F1 m 8,4 l -4,-4 -4,0 0,8 4,0 4,-4 z"},wu.prototype.copy=function(){var t=new wu;return t.zq=this.zq,t.Kp=this.Kp,t.tr=this.tr,t.vr=this.vr,t.ur=this.ur,t.oq=this.oq,t.fr=this.fr,t.hr=this.hr,t.gr=this.gr.J(),t.ir=this.ir,t.jr=this.jr,t.lr=this.lr.J(),t.Gq=this.Gq,t.Hq=this.Hq.J(),t.Pq=this.Pq.J(),t.Kq=this.Kq.J(),t.Up=this.Up,t.Cq=this.Cq,t.zr=this.zr.J(),t.yr=this.yr,t.Vg=this.Vg,t},c(ku,Th),ku.prototype.cloneProtected=function(t){Th.prototype.cloneProtected.call(this,t),t.G=-4097&this.G|49152,t.Tf=this.Tf,null!==this.P&&(t.P=this.P.nc?this.P:this.P.copy()),t.Jg=this.Jg,t.Qf=null,t.ec=this.ec,t.ke.assign(this.ke),t.Ao=this.Ao},(e=ku.prototype).Af=function(t){Th.prototype.Af.call(this,t),t.oh(),t.Ug=null,t.nf=null,t.Rh=null},e.toString=function(){var t=D(this.constructor)+"#"+et(this);return null!==this.data&&(t+="("+F(this.data)+")"),t},e.th=function(){Th.prototype.th.call(this),null!==this.P&&(this.P.nc=!0)},e.gk=function(t,e,i,n,o,r,s){var a=this.diagram;null!==a&&(t===fi&&"elements"===e?o instanceof Th?jh(o,(function(t){of(a.partManager,t),xr(a,t)})):br(a,o):t===pi&&"elements"===e&&(o instanceof Th?jh(o,(function(t){rf(a.partManager,t,a)})):wr(a,o)),a.cb(t,e,i,n,o,r,s))},e.La=function(t){if(Th.prototype.La.call(this,t),null!==this.data){for(var e=this.O.s,i=e.length,n=0;n<i;n++){var o=e[n];o instanceof Th&&jh(o,(function(t){null!==t.data&&t.La()}))}for(e=this.adornments;e.next();)e.value.La(t)}},ku.prototype.updateRelationshipsFromData=function(){var t;null!==this.data&&(null===(t=this.diagram)||void 0===t||t.partManager.updateRelationshipsFromData(this))},ku.prototype.Pj=function(t){var e=this.Qf;return null===e?null:e.I(t)},ku.prototype.bh=function(t,e){if(null!==e){var i=null,n=this.Qf;if(null!==n&&(i=n.I(t)),i!==e){if(null!==i){var o=i.diagram;null!==o&&o.remove(i)}null===n&&(this.Qf=n=new ft),e.Tf!==t&&(e.category=t),n.add(t,e),null!==(t=this.diagram)&&(t.add(e),null!==(t=e.adornedObject)&&(null!==(t=t.ih())&&(e.data=t.data)))}}},ku.prototype.Jf=function(t){var e=this.Qf;if(null!==e){var i=e.I(t);if(null!==i){var n=i.diagram;null!==n&&n.remove(i)}e.remove(t),0===e.count&&(this.Qf=null)}},ku.prototype.Ej=function(){var t=this.Qf;if(null!==t){var e=A();for(t=t.iterator;t.next();)e.push(t.key);t=e.length;for(var i=0;i<t;i++)this.Jf(e[i]);B(e)}},ku.prototype.updateAdornments=function(){var t=this.diagram;if(null!==t){for(var e=this.adornments;e.next();){var i=e.value;i.v(),i.placeholder&&i.placeholder.v()}t:{if(this.isSelected&&this.selectionAdorned&&(null!==(e=this.selectionObject)&&this.actualBounds.w()&&this.isVisible()&&e.Ed()&&e.actualBounds.w())){if(null===(i=this.Pj("Selection"))){if(null===(i=this.selectionAdornmentTemplate)&&(i=this.ph()?t.linkSelectionAdornmentTemplate:this instanceof gc?t.groupSelectionAdornmentTemplate:t.nodeSelectionAdornmentTemplate),!(i instanceof Wu))break t;Kh(i),null!==(i=i.copy())&&(this.ph()&&this.selectionObject===this.path&&(i.type=Th.Link),i.adornedObject=e)}if(null!==i){i.type===Th.Link&&i.v(),this.bh("Selection",i);break t}}this.Jf("Selection")}for(function(t,e){e.toolManager.mouseDownTools.each((function(e){e.isEnabled&&e.updateAdornments(t)})),e.toolManager.updateAdornments(t)}(this,t),e=this.adornments;e.next();)e.value.La()}},ku.prototype.Wb=function(){var t=this.diagram;null!==t&&(t.vd=!0,0!=(16384&this.G)!=!0&&(this.G|=16384))},ku.prototype.Ge=function(t,e,i,n){var o=this.uc;o.h(t,e,i,n),null===this.Lb&&(this.Lb=new Ge);var r=this.Lb;r.reset(),this.no(r,t,e,i,n),this.Lb=r,r.ws()||r.pp(o)},ku.prototype.no=function(t,e,i,n,o){if(1!==this.Ca&&t.scale(this.Ca),0!==this.Kb){var r=oe;this.locationSpot.sb()&&(r=this.locationSpot);var s=pt.alloc();if(this.locationObject!==this)for(i=(e=this.locationObject).naturalBounds,s.yi(i.x,i.y,i.width,i.height,r),null!==e.Lb&&e.Lb.Ga(s),s.offset(-e.measuredBounds.x,-e.measuredBounds.y),r=e.panel;null!==r&&r!==this;)null!==r.Lb&&r.Lb.Ga(s),s.offset(-r.measuredBounds.x,-r.measuredBounds.y),r=r.panel;else s.yi(e,i,n,o,r);t.rotate(this.Kb,s.x,s.y),pt.free(s)}},ku.prototype.move=function(t,e){!0===e?this.location=t:this.position=t},ku.prototype.moveTo=function(t,e,i){t=pt.allocAt(t,e),this.move(t,i),pt.free(t)},ku.prototype.isVisible=function(){if(!this.visible)return!1;var t=this.layer;if(null!==t){if(!t.visible)return!1;if(null!==(t=t.diagram)&&t.animationManager.fv(this))return!0}return!!(null===(t=this.containingGroup)||t.isSubGraphExpanded&&t.isVisible())},ku.prototype.Zb=function(t){var e=this.diagram;t?(this.C(4),this.Wb(),null!==e&&e.De.add(this)):(this.C(8),this.Ej()),this.oh(),null!==e&&(e.Ya(),e.N())},ku.prototype.fb=function(t){if(this.name===t)return this;var e=this.Rh;if(null===e&&(this.Rh=e=new ft),null!==e.I(t))return e.I(t);var i=Th.prototype.fb.call(this,t);return null!==i?(e.set(t,i),i):(e.set(t,null),null)},ku.prototype.mi=function(t){return void 0===t&&(t=new jt),t.assign(this.actualBounds)},ku.prototype.Va=function(){this.measure(1/0,1/0),this.arrange()},ku.prototype.arrange=function(){if(!1===na(this))Pu(this);else{oa(this,!1);var t=this.Ib,e=jt.alloc();e.assign(t);var i=Ru(this);this.eh(0,0,this.uc.width,this.uc.height);var n=this.position;Bu(this,n,this.location),t.ka(),t.x=n.x,t.y=n.y,t.freeze(),this.Xl(e,t),e.D(t)?this.Fd(i):!this.Zc()||Ye.B(e.width,t.width)&&Ye.B(e.height,t.height)||0<=this.vw&&this.C(16),jt.free(e),Iu(this,!1)}},(e=ku.prototype).Xl=function(t,e){var i=this.diagram;if(null!==i){var n=!1;if(!1===i.Zi&&t.w()){var o=jt.alloc();o.assign(i.documentBounds),o.Fv(i.padding),t.x>o.x&&t.y>o.y&&t.right<o.right&&t.bottom<o.bottom&&e.x>o.x&&e.y>o.y&&e.right<o.right&&e.bottom<o.bottom&&(n=!0),jt.free(o)}0!=(65536&this.G)!=!0&&t.D(e)||ju(this,n,i),i.N(),!t.w()&&!e.w()||zt(t,e)||(this instanceof _u&&!i.undoManager.isUndoingRedoing&&this.Bd(),this.oh())}},e.zv=function(t,e,i){if(this.ph()||!t.w())return!1;var n=this.diagram;return null!==n&&Au(this,n,t,e,i),this.pa=t,this.G&=-2097153,!this.ke.w()||null!==n&&!n.animationManager.isTicking&&n.undoManager.isUndoingRedoing||(n=this.ke,this.ke=new pt(n.x+(t.x-e),n.y+(t.y-i)),this.g("location",n,this.ke.copy())),!1===Ou(this)&&!1===na(this)&&(Cu(this),Pu(this)),!0},e.mm=function(t,e,i){var n=this.ke,o=this.pa;if(i){if(n.x===t&&n.y===e)return;Ou(this)||na(this)?o.h(NaN,NaN):o.h(o.x+t-n.x,o.y+e-n.y),n.h(t,e)}else{if(o.x===t&&o.y===e)return;n.h(n.x+t-o.x,n.y+e-o.y),o.h(t,e)}Cu(this)},e.Av=function(){this.G&=-2097153,Cu(this)},e.si=function(){return!0},e.Zc=function(){return!0},e.ph=function(){return!1},e.Dd=function(){return!0},ku.prototype.canCopy=function(){if(!this.copyable)return!1;var t=this.layer;return null===t||!!t.allowCopy&&(null===(t=t.diagram)||!!t.allowCopy)},ku.prototype.canDelete=function(){if(!this.deletable)return!1;var t=this.layer;return null===t||!!t.allowDelete&&(null===(t=t.diagram)||!!t.allowDelete)},ku.prototype.canEdit=function(){if(!this.textEditable)return!1;var t=this.layer;return null===t||!!t.allowTextEdit&&(null===(t=t.diagram)||!!t.allowTextEdit)},ku.prototype.canGroup=function(){if(!this.groupable)return!1;var t=this.layer;return null===t||!!t.allowGroup&&(null===(t=t.diagram)||!!t.allowGroup)},ku.prototype.canMove=function(){if(!this.movable)return!1;var t=this.layer;return null===t||!!t.allowMove&&(null===(t=t.diagram)||!!t.allowMove)},ku.prototype.canReshape=function(){if(!this.reshapable)return!1;var t=this.layer;return null===t||!!t.allowReshape&&(null===(t=t.diagram)||!!t.allowReshape)},ku.prototype.canResize=function(){if(!this.resizable)return!1;var t=this.layer;return null===t||!!t.allowResize&&(null===(t=t.diagram)||!!t.allowResize)},ku.prototype.canRotate=function(){if(!this.rotatable)return!1;var t=this.layer;return null===t||!!t.allowRotate&&(null===(t=t.diagram)||!!t.allowRotate)},ku.prototype.canSelect=function(){if(!this.selectable)return!1;var t=this.layer;return null===t||!!t.allowSelect&&(null===(t=t.diagram)||!!t.allowSelect)},(e=ku.prototype).Fd=function(t){this.G=t?131072|this.G:-131073&this.G},e.oh=function(){var t=this.containingGroup;null!==t&&(t.v(),null!==t.placeholder&&t.placeholder.v(),t.Bd())},e.N=function(){var t=this.diagram;null!==t&&!na(this)&&!Ou(this)&&this.isVisible()&&this.Ib.w()&&t.N(Lu(this,this.Ib))},e.v=function(){Th.prototype.v.call(this);var t=this.diagram;null!==t&&(t.De.add(this),this instanceof _u&&null!==this.labeledLink&&qs(this.labeledLink),t.$b(!0))},e.Vo=function(t){t||null!==(t=this.Ah)&&mc(t,this)},e.Wo=function(t){t||null!==(t=this.Ah)&&yc(t,this)},e.Lj=function(){var t=this.data;if(null!==t){var e=this.diagram;null!==e&&(null!==(e=e.model)&&e.cm(t))}},e.oz=function(){return Gu(this,this)},e.sz=function(){return Hu(this,this)},e.Td=function(t){return t instanceof gc&&Yu(this,this,t)},e.px=function(t){if(null===t)return null;if(this===t)return this.containingGroup;for(var e=this;null!==e;){if(e instanceof gc&&Vu(e,!0),e instanceof _u){var i=e.labeledLink;null!==i&&(e=i)}e=e.containingGroup}for(i=null,e=t;null!==e;){if(0!=(1048576&e.G)){i=e;break}e instanceof _u&&(null!==(t=e.labeledLink)&&(e=t)),e=e.containingGroup}for(e=this;null!==e;)e instanceof gc&&Vu(e,!1),e instanceof _u&&(null!==(t=e.labeledLink)&&(e=t)),e=e.containingGroup;return i},ku.prototype.canLayout=function(){if(!this.isLayoutPositioned||!this.isVisible())return!1;var t=this.layer;return!(null!==t&&t.isTemporary||this instanceof _u&&this.isLinkLabel)},ku.prototype.C=function(t){if(void 0===t&&(t=16777215),this.isLayoutPositioned&&0!=(t&this.layoutConditions)){var e=this.layer;null!==e&&e.isTemporary||this instanceof _u&&this.isLinkLabel?e=!1:e=null===(e=this.diagram)||!e.undoManager.isUndoingRedoing}else e=!1;if(e)if(null!==(e=this.Ah)){var i=e.layout;null!==i?i.C():e.C(t)}else null!==(t=this.diagram)&&(null!==(t=t.layout)&&t.C())},d.Object.defineProperties(ku.prototype,{key:{get:function(){var t=this.diagram;if(null!==t)return t.model.wa(this.data)}},adornments:{get:function(){return null===this.Qf?q:this.Qf.iteratorValues}},layer:{get:function(){return this.Ig}},diagram:{get:function(){var t=this.Ig;return null==t?null:t.diagram}},layerName:{get:function(){return this.Jg},set:function(t){var e=this.Jg;if(e!==t){var i=this.diagram;if((null===i||null!==i.Qj(t)&&!i.partManager.addsToTemporaryLayer)&&(this.Jg=t,null!==i&&i.Ya(),this.g("layerName",e,t),null!==(e=this.layer)&&e.name!==t&&(null!==(i=e.diagram)&&(null!==(t=i.Qj(t))&&t!==e)))){var n=e.pc(-1,this,!0);if(0<=n&&i.cb(pi,"parts",e,this,null,n,!0),n=t.oi(99999999,this,!0),e.visible!==t.visible&&this.Zb(t.visible),0<=n&&i.cb(fi,"parts",t,null,this,!0,n),null!==(n=this.layerChanged)){var o=i.aa;i.aa=!0,n(this,e,t),i.aa=o}}}}},layerChanged:{get:function(){return null!==this.P?this.P.zq:null},set:function(t){var e=this.layerChanged;e!==t&&(Su(this),this.P.zq=t,this.g("layerChanged",e,t))}},zOrder:{get:function(){return this.Ao},set:function(t){var e=this.Ao;if(e!==t){this.Ao=t;var i=this.layer;null!==i&&To(i,-1,this),this.g("zOrder",e,t),null!==(t=this.diagram)&&t.N()}}},locationObject:{get:function(){if(null===this.nf){var t=this.locationObjectName;""!==t?(t=this.fb(t),this.nf=null!==t?t:this):this instanceof Wu&&this.type!==Th.Link&&null!==this.placeholder?this.nf=this.placeholder:this.nf=this}return this.nf.visible?this.nf:this}},minLocation:{get:function(){return null!==this.P?this.P.Pq:nt},set:function(t){var e=this.minLocation;e.D(t)||(t=t.J(),Su(this),this.P.Pq=t,this.g("minLocation",e,t))}},maxLocation:{get:function(){return null!==this.P?this.P.Kq:ot},set:function(t){var e=this.maxLocation;e.D(t)||(t=t.J(),Su(this),this.P.Kq=t,this.g("maxLocation",e,t))}},locationObjectName:{get:function(){return null!==this.P?this.P.Gq:""},set:function(t){var e=this.locationObjectName;e!==t&&(Su(this),this.P.Gq=t,this.nf=null,this.v(),this.g("locationObjectName",e,t))}},locationSpot:{get:function(){return null!==this.P?this.P.Hq:te},set:function(t){var e=this.locationSpot;e.D(t)||(t=t.J(),Su(this),this.P.Hq=t,this.v(),this.g("locationSpot",e,t))}},location:{get:function(){return this.ke},set:function(t){var e=t.x,i=t.y,n=this.ke;if(!(n.x===e||isNaN(n.x)&&isNaN(e))||!(n.y===i||isNaN(n.y)&&isNaN(i))){if(e=t=t.copy(),this.ph())e=!1;else{if(this.ke=e,this.G|=2097152,!1===na(this)&&(Cu(this),(i=this.pa).w())){var o=this.diagram;if(null===o||o.animationManager.isTicking||!o.undoManager.isUndoingRedoing){var r=i.copy();i.h(i.x+(e.x-n.x),i.y+(e.y-n.y)),Au(this,o,i,r.x,r.y),this.g("position",r,i.copy())}}e=!0}e&&this.g("location",n,t.copy())}}},category:{get:function(){return this.Tf},set:function(t){var e=this.Tf;if(e!==t){null!==this.svg&&(this.svg.remove(),this.Uc=!0);var i=this.diagram,n=this.data,o=null;if(null!==i&&null!==n&&!(this instanceof Wu)){var r=i.model.undoManager;r.isEnabled&&!r.isUndoingRedoing&&(o=this.clone()).O.addAll(this.O)}this.Tf=t,this.g("category",e,t),null===i||null===n||this instanceof Wu?this instanceof Wu&&(null!==(o=this.adornedPart)&&(null!==(t=o.Qf)&&t.remove(e),o.bh(this.category,this))):(r=i.model).undoManager.isUndoingRedoing||(this.ph()?(i.partManager.setLinkCategoryForData(n,t),null!==(i=i.partManager.findLinkTemplateForCategory(t))&&(Kh(i),null!==(i=i.copy())&&Eu(this,i,e,t))):(null!==r&&r.jm(n,t),null!==(i=tf(i.partManager,n,t))&&(Kh(i),null===(i=i.copy())||i instanceof wc||(n=this.location.copy(),Eu(this,i,e,t),this.location.w()||(this.location=n)))),null!==o&&((e=this.clone()).O.addAll(this.O),this.g("self",o,e)))}}},self:{get:function(){return this},set:function(t){Eu(this,t,this.category,t.category)}},copyable:{get:function(){return 0!=(1&this.G)},set:function(t){var e=0!=(1&this.G);e!==t&&(this.G^=1,this.g("copyable",e,t))}},deletable:{get:function(){return 0!=(2&this.G)},set:function(t){var e=0!=(2&this.G);e!==t&&(this.G^=2,this.g("deletable",e,t))}},textEditable:{get:function(){return 0!=(4&this.G)},set:function(t){var e=0!=(4&this.G);e!==t&&(this.G^=4,this.g("textEditable",e,t),this.Wb())}},groupable:{get:function(){return 0!=(8&this.G)},set:function(t){var e=0!=(8&this.G);e!==t&&(this.G^=8,this.g("groupable",e,t))}},movable:{get:function(){return 0!=(16&this.G)},set:function(t){var e=0!=(16&this.G);e!==t&&(this.G^=16,this.g("movable",e,t))}},selectionAdorned:{get:function(){return 0!=(32&this.G)},set:function(t){var e=0!=(32&this.G);e!==t&&(this.G^=32,this.g("selectionAdorned",e,t),this.Wb())}},isInDocumentBounds:{get:function(){return 0!=(64&this.G)},set:function(t){var e=0!=(64&this.G);if(e!==t){this.G^=64;var i=this.diagram;null!==i&&i.Ya(),this.g("isInDocumentBounds",e,t)}}},isLayoutPositioned:{get:function(){return 0!=(128&this.G)},set:function(t){var e=0!=(128&this.G);e!==t&&(this.G^=128,this.g("isLayoutPositioned",e,t),this.C(t?4:8))}},selectable:{get:function(){return 0!=(256&this.G)},set:function(t){var e=0!=(256&this.G);e!==t&&(this.G^=256,this.g("selectable",e,t),this.Wb())}},reshapable:{get:function(){return 0!=(512&this.G)},set:function(t){var e=0!=(512&this.G);e!==t&&(this.G^=512,this.g("reshapable",e,t),this.Wb())}},resizable:{get:function(){return 0!=(1024&this.G)},set:function(t){var e=0!=(1024&this.G);e!==t&&(this.G^=1024,this.g("resizable",e,t),this.Wb())}},rotatable:{get:function(){return 0!=(2048&this.G)},set:function(t){var e=0!=(2048&this.G);e!==t&&(this.G^=2048,this.g("rotatable",e,t),this.Wb())}},isSelected:{get:function(){return 0!=(4096&this.G)},set:function(t){var e=0!=(4096&this.G);if(e!==t){var i=this.diagram;if(!t||this.canSelect()&&!(null!==i&&i.selection.count>=i.maxSelectionCount)){this.G^=4096;var n=!1;if(null!==i){n=i.skipsUndoManager,i.skipsUndoManager=!0;var o=i.selection;o.ka(),t?o.add(this):o.remove(this),o.freeze()}this.g("isSelected",e,t),this.Wb(),null!==(t=this.selectionChanged)&&t(this),null!==i&&(i.$b(),i.skipsUndoManager=n)}}}},isHighlighted:{get:function(){return 0!=(524288&this.G)},set:function(t){var e=0!=(524288&this.G);if(e!==t){this.G^=524288;var i=this.diagram;null!==i&&((i=i.highlighteds).ka(),t?i.add(this):i.remove(this),i.freeze()),this.g("isHighlighted",e,t),this.N(),null!==(t=this.highlightedChanged)&&t(this)}}},isShadowed:{get:function(){return 0!=(8192&this.G)},set:function(t){var e=0!=(8192&this.G);e!==t&&(this.G^=8192,this.Uc=!0,this.g("isShadowed",e,t),this.N())}},isAnimated:{get:function(){return 0!=(262144&this.G)},set:function(t){var e=0!=(262144&this.G);e!==t&&(this.G^=262144,this.g("isAnimated",e,t))}},highlightedChanged:{get:function(){return null!==this.P?this.P.oq:null},set:function(t){var e=this.highlightedChanged;e!==t&&(Su(this),this.P.oq=t,this.g("highlightedChanged",e,t))}},selectionObjectName:{get:function(){return null!==this.P?this.P.vr:""},set:function(t){var e=this.selectionObjectName;e!==t&&(Su(this),this.P.vr=t,this.Ug=null,this.g("selectionObjectName",e,t))}},selectionAdornmentTemplate:{get:function(){return null!==this.P?this.P.tr:null},set:function(t){var e=this.selectionAdornmentTemplate;e!==t&&(Su(this),this.P.tr=t,this.g("selectionAdornmentTemplate",e,t))}},selectionObject:{get:function(){if(null===this.Ug){var t=this.selectionObjectName;null!==t&&""!==t?(t=this.fb(t),this.Ug=null!==t?t:this):this instanceof wc?(t=this.path,this.Ug=null!==t?t:this):this.Ug=this}return this.Ug}},selectionChanged:{get:function(){return null!==this.P?this.P.ur:null},set:function(t){var e=this.selectionChanged;e!==t&&(Su(this),this.P.ur=t,this.g("selectionChanged",e,t))}},resizeAdornmentTemplate:{get:function(){return null!==this.P?this.P.fr:null},set:function(t){var e=this.resizeAdornmentTemplate;e!==t&&(Su(this),this.P.fr=t,this.g("resizeAdornmentTemplate",e,t))}},resizeObjectName:{get:function(){return null!==this.P?this.P.hr:""},set:function(t){var e=this.resizeObjectName;e!==t&&(Su(this),this.P.hr=t,this.g("resizeObjectName",e,t))}},resizeObject:{get:function(){var t=this.resizeObjectName;return""!==t&&null!==(t=this.fb(t))?t:this}},resizeCellSize:{get:function(){return null!==this.P?this.P.gr:Nt},set:function(t){var e=this.resizeCellSize;e.D(t)||(t=t.J(),Su(this),this.P.gr=t,this.g("resizeCellSize",e,t))}},rotateAdornmentTemplate:{get:function(){return null!==this.P?this.P.ir:null},set:function(t){var e=this.rotateAdornmentTemplate;e!==t&&(Su(this),this.P.ir=t,this.g("rotateAdornmentTemplate",e,t))}},rotateObjectName:{get:function(){return null!==this.P?this.P.jr:""},set:function(t){var e=this.rotateObjectName;e!==t&&(Su(this),this.P.jr=t,this.g("rotateObjectName",e,t))}},rotateObject:{get:function(){var t=this.rotateObjectName;return""!==t&&null!==(t=this.fb(t))?t:this}},rotationSpot:{get:function(){return null!==this.P?this.P.lr:Me},set:function(t){var e=this.rotationSpot;e.D(t)||(t=t.J(),Su(this),this.P.lr=t,this.g("rotationSpot",e,t))}},text:{get:function(){return this.ec},set:function(t){var e=this.ec;e!==t&&(this.ec=t,this.g("text",e,t))}},containingGroup:{get:function(){return this.Ah},set:function(t){if(this.Zc()){var e=this.Ah;if(e!==t){null===t||this!==t&&!t.Td(this)||(this===t&&w("Cannot make a Group a member of itself: "+this.toString()),w("Cannot make a Group indirectly contain itself: "+this.toString()+" already contains "+t.toString())),this.C(2);var i=this.diagram;if(null!==e?yc(e,this):this instanceof gc&&null!==i&&i.ai.remove(this),this.Ah=t,null!==t?mc(t,this):this instanceof gc&&null!==i&&i.ai.add(this),this.C(1),null!==i&&i.aa){var n=this.data,o=i.model;if(null!==n&&o.Xj()){var r=o.wa(null!==t?t.data:null);o.mp(n,r)}}if(null!==(n=this.containingGroupChanged)&&(o=!0,null!==i&&(o=i.aa,i.aa=!0),n(this,e,t),null!==i&&(i.aa=o)),this instanceof gc)for(Uu(i=new Z,this,!0,0,!0),i=i.iterator;i.next();)if((n=i.value)instanceof _u)for(n=n.linksConnected;n.next();)kc(n.value);if(this instanceof _u){for(i=this.linksConnected;i.next();)kc(i.value);null!==(i=this.labeledLink)&&kc(i)}this.g("containingGroup",e,t),null!==t&&(null!==(e=t.layer)&&To(e,-1,t))}}else w("cannot set the Part.containingGroup of a Link or Adornment")}},containingGroupChanged:{get:function(){return null!==this.P?this.P.Kp:null},set:function(t){var e=this.containingGroupChanged;e!==t&&(Su(this),this.P.Kp=t,this.g("containingGroupChanged",e,t))}},isTopLevel:{get:function(){return!(null!==this.containingGroup||this instanceof _u&&null!==this.labeledLink)}},layoutConditions:{get:function(){return null!==this.P?this.P.Cq:127},set:function(t){var e=this.layoutConditions;e!==t&&(Su(this),this.P.Cq=t,this.g("layoutConditions",e,t))}},dragComputation:{get:function(){return null!==this.P?this.P.Up:null},set:function(t){var e=this.dragComputation;e!==t&&(Su(this),this.P.Up=t,this.g("dragComputation",e,t))}},shadowOffset:{get:function(){return null!==this.P?this.P.zr:rt},set:function(t){var e=this.shadowOffset;e.D(t)||(t=t.J(),Su(this),this.P.zr=t,this.N(),this.g("shadowOffset",e,t))}},shadowColor:{get:function(){return null!==this.P?this.P.yr:"gray"},set:function(t){var e=this.shadowColor;e!==t&&(Su(this),this.P.yr=t,this.N(),this.g("shadowColor",e,t))}},shadowBlur:{get:function(){return null!==this.P?this.P.Vg:4},set:function(t){var e=this.shadowBlur;e!==t&&(Su(this),this.P.Vg=t,this.N(),this.g("shadowBlur",e,t))}}}),ku.prototype.invalidateLayout=ku.prototype.C,ku.prototype.findCommonContainingGroup=ku.prototype.px,ku.prototype.isMemberOf=ku.prototype.Td,ku.prototype.findTopLevelPart=ku.prototype.sz,ku.prototype.findSubGraphLevel=ku.prototype.oz,ku.prototype.ensureBounds=ku.prototype.Va,ku.prototype.getDocumentBounds=ku.prototype.mi,ku.prototype.findObject=ku.prototype.fb,ku.prototype.moveTo=ku.prototype.moveTo,ku.prototype.invalidateAdornments=ku.prototype.Wb,ku.prototype.clearAdornments=ku.prototype.Ej,ku.prototype.removeAdornment=ku.prototype.Jf,ku.prototype.addAdornment=ku.prototype.bh,ku.prototype.findAdornment=ku.prototype.Pj,ku.prototype.updateTargetBindings=ku.prototype.La;var qu=!1;function Wu(t,e){void 0===t||t instanceof ch||"string"==typeof t?ku.call(this,t):(ku.call(this),t&&(e=t)),this.G&=-257,this.Jg="Adornment",this.ue=null,this.Aw=0,this.Uw=!1,this.j=this.$a=null,e&&Object.assign(this,e)}function Ku(){this.nc=!1,this.Vr=this.gj=this.Eq=this.Dq=null,this.yp=Zt,this.er=fc,this.Kr=this.ij=this.Nq=this.Mq=null}function _u(t,e){void 0===t||t instanceof ch||"string"==typeof t?ku.call(this,t):(ku.call(this),t&&(e=t)),this.U=13,this.Ba=null,this.jb=new $,this.wc=this.af=this.Yk=null,this.ci=!1,e&&Object.assign(this,e)}function $u(t){null===t.Ba?t.Ba=new Ku:t.Ba.nc&&(t.Ba=t.Ba.copy())}function Ju(t,e){null!==e&&(null===t.af&&(t.af=new Z),t.af.add(e))}function Zu(t,e,i,n){if(null===e||null===t.af)return null;for(var o=t.af.iterator;o.next();){var r=o.value;if(r.Ds===t&&r.cv===e&&r.Ox===i&&r.Px===n||r.Ds===e&&r.cv===t&&r.Ox===n&&r.Px===i)return r}return null}function Qu(t,e){for(t=t.linksConnected;t.next();){var i=t.value;i.fromPort!==e&&i.toPort!==e||(tc(i.fromPort),tc(i.toPort),i.bb())}}function tc(t){if(null!==t){var e=t.Zn;null!==e&&e.Sl(),null===(e=(t=t.part).containingGroup)||t.isVisible()||tc(e.port)}}function ec(t,e,i,n){if(null!==e&&!i.has(e)){i.add(e);var o=!0,r=t.diagram;null!==r&&(o=r.isTreePathToChildren),e.linksConnected.each((function(r){r.isTreeLink?(o?r.fromNode===e:r.toNode===e)&&ec(t,o?r.toNode:r.fromNode,i,n):n.add(r)}))}}function ic(t,e,i){tc(i);var n=t.jb.contains(e);if(n||t.jb.add(e),!n||e.fromNode===e.toNode){var o=t.linkConnected;if(null!==o){var r=!0,s=t.diagram;null!==s&&(r=s.aa,s.aa=!0),o(t,e,i),null!==s&&(s.aa=r)}}!n&&e.isTreeLink&&(i=e.fromNode,e=e.toNode,null!==i&&null!==e&&i!==e&&(n=!0,null!==(t=t.diagram)&&(n=t.isTreePathToChildren),r=n?i:e,(o=n?e:i).ci||(o.ci=r),!r.isTreeLeaf||null!==t&&t.undoManager.isUndoingRedoing||(n?i===r&&(r.isTreeLeaf=!1):e===r&&(r.isTreeLeaf=!1))))}function nc(t,e,i){tc(i);var n=t.jb.remove(e),o=null;if(n||e.toNode===e.fromNode){var r=t.linkDisconnected;if(o=t.diagram,null!==r){var s=!0;null!==o&&(s=o.aa,o.aa=!0),r(t,e,i),null!==o&&(o.aa=s)}}n&&e.isTreeLink&&(i=!0,null!==o&&(i=o.isTreePathToChildren),t=i?e.toNode:e.fromNode,e=i?e.fromNode:e.toNode,null!==t&&(t.ci=!1),null===e||e.isTreeLeaf||(0===e.jb.count?(e.ci=null,null!==o&&o.undoManager.isUndoingRedoing||(e.isTreeLeaf=!0)):oc(e)))}function oc(t){if(t.ci=!1,0!==t.jb.count){var e=!0,i=t.diagram;if(null===i||!i.undoManager.isUndoingRedoing){for(null!==i&&(e=i.isTreePathToChildren),i=t.jb.iterator;i.next();){var n=i.value;if(n.isTreeLink)if(e){if(n.fromNode===t)return void(t.isTreeLeaf=!1)}else if(n.toNode===t)return void(t.isTreeLeaf=!1)}t.isTreeLeaf=!0}}}function rc(t){null===t.wc?t.wc=new ft:t.wc.clear(),t.qm(t,(function(t,e){sc(t,e)})),0===t.wc.count&&t.wc.add("",t)}function sc(t,e){var i=e.portId;null!==i&&null!==t.wc&&t.wc.add(i,e)}function ac(t,e,i){var n=e.portId;if(null!==n&&(null!==t.wc&&t.wc.remove(n),null!==(e=t.diagram)&&i)){for(i=null,t=t.findLinksConnected(n);t.next();)n=t.value,null===i&&(i=A()),i.push(n);if(null!==i){for(t=0;t<i.length;t++)e.remove(i[t]);B(i)}}}function hc(t,e){return null===(e=e.pg())?0:1+hc(t,e)}function lc(t,e,i,n,o,r,s){if(1<n)for(var a=i?t.Mo():t.Sd();a.next();){var h=a.value;h.isTreeLink&&(null===(h=h.To(t))||h===t||e.contains(h)||(e.add(h),lc(h,e,i,n-1,o,r,s)))}else uc(t,e,i,o,r,s)}function uc(t,e,i,n,o,r){for(var s=o===t||t.isTreeExpanded,a=i?t.Mo():t.Sd(),h={};a.next();){var l=a.value;if(l.isTreeLink&&(null!==(l=l.To(t))&&l!==t)){var u=e.contains(l);if(u||e.add(l),s){var c=i?l.Oo():l.Po();h.uv=t,c.all(function(t){return function(e){return e===t.uv||!e.isTreeExpanded}}(h))&&n.Aj(l,o),l.oh(),l.Zb(!1)}l.isTreeExpanded&&(l.wasTreeExpanded=l.isTreeExpanded,u||uc(l,e,i,n,o,r))}h={uv:h.uv}}t.isTreeExpanded=!1}function cc(t,e,i,n,o,r,s){for(var a=r!==t&&t.isTreeExpanded,h=i?t.Mo():t.Sd(),l={};h.next();){var u=h.value;if(u.isTreeLink&&(a||u.fd||u.bb(),null!==(u=u.To(t))&&u!==t&&!e.contains(u))){if(e.add(u),!a){u.Zb(!0),u.oh();var c=i?u.Oo():u.Po();l.vv=t,c.all(function(t){return function(e){return e===t.vv||!e.isTreeExpanded}}(l))&&o.Cj(u,r)}(2<n||u.wasTreeExpanded)&&(u.wasTreeExpanded=!1,cc(u,e,i,n-1,o,r,s))}l={vv:l.vv}}t.isTreeExpanded=!0}ku.className="Part",ku.LayoutNone=0,ku.LayoutAdded=1,ku.LayoutRemoved=2,ku.LayoutShown=4,ku.LayoutHidden=8,ku.LayoutNodeSized=16,ku.LayoutGroupLayout=32,ku.LayoutNodeReplaced=64,ku.LayoutStandard=127,ku.LayoutAll=16777215,c(Wu,ku),Wu.prototype.toString=function(){var t=this.adornedPart;return"Adornment("+this.category+")"+(null!==t?t.toString():"")},Wu.prototype.updateRelationshipsFromData=function(){},Wu.prototype.Ul=function(t){var e=this.adornedObject,i=null==e?void 0:e.part;if(i instanceof wc&&e instanceof pl){e=i.path,i.Ul(t),t=e.geometry,e=(i=this.O.s).length;for(var n=0;n<e;n++){var o=i[n];o.isPanelMain&&o instanceof pl&&(o.ua=t)}}},Wu.prototype.si=function(){var t=this.ue;return null===t||(null===(t=t.part)||!na(t))},Wu.prototype.Zc=function(){return!1},Wu.prototype.gk=function(t,e,i,n,o,r,s){if(t===fi&&"elements"===e){if(o instanceof bc)null===this.$a&&(this.$a=o);else if(o instanceof Th){var a=o.Nl((function(t){return t instanceof bc}));a instanceof bc&&null===this.$a&&(this.$a=a)}}else t===pi&&"elements"===e&&null!==this.$a&&(n===this.$a||n instanceof Th&&this.$a.rg(n))&&(this.$a=null);ku.prototype.gk.call(this,t,e,i,n,o,r,s)},Wu.prototype.updateAdornments=function(){},Wu.prototype.Lj=function(){},d.Object.defineProperties(Wu.prototype,{placeholder:{get:function(){return this.$a}},adornedObject:{get:function(){return this.ue},set:function(t){var e=this.adornedPart,i=null;null!==t&&(i=t.part),null===e||null!==t&&e===i||e.Jf(this.category),this.ue=t,null!==i&&i.bh(this.category,this)}},adornedPart:{get:function(){var t=this.ue;return null!==t?t.part:null}},containingGroup:{get:function(){return null}}}),Wu.className="Adornment",Ku.prototype.copy=function(){var t=new Ku;return t.Dq=this.Dq,t.Eq=this.Eq,t.gj=this.gj,t.Vr=this.Vr,t.yp=this.yp.J(),t.er=this.er,t.Mq=this.Mq,t.Nq=this.Nq,t.ij=this.ij,t.Kr=this.Kr,t},c(_u,ku),_u.prototype.cloneProtected=function(t){ku.prototype.cloneProtected.call(this,t),t.U=this.U,null!==this.Ba&&(t.Ba=this.Ba.nc?this.Ba:this.Ba.copy())},(e=_u.prototype).Af=function(t){ku.prototype.Af.call(this,t),t.Bd(),t.af=this.af,t.wc=null},e.th=function(){ku.prototype.th.call(this),null!==this.Ba&&(this.Ba.nc=!0)},e.Lz=function(t,e,i){null==e&&(e=""),null==i&&(i=""),null!==(t=Zu(this,t,e,i))&&t.Sl()},e.gk=function(t,e,i,n,o,r,s){(t===fi&&"elements"===e||t===pi&&"elements"===e)&&(this.wc=null),ku.prototype.gk.call(this,t,e,i,n,o,r,s)},e.Bd=function(t){for(var e=this.linksConnected;e.next();){var i=e.value;void 0!==t&&t.contains(i)||(tc(i.fromPort),tc(i.toPort),i.bb())}},e.si=function(){return!0},_u.prototype.getAvoidableRect=function(t){return t.set(this.actualBounds),t.Co(this.avoidableMargin),t},_u.prototype.findVisibleNode=function(){for(var t=this;null!==t&&!t.isVisible();)t=t.containingGroup;return t},_u.prototype.isVisible=function(){if(!ku.prototype.isVisible.call(this))return!1;var t=!0,e=ts,i=this.diagram;if(null!==i&&(t=i.isTreePathToChildren,e=i.treeCollapsePolicy),e===ts){if(null!==(t=this.pg())&&!t.isTreeExpanded)return!1}else if(e===es){if(0<(t=t?this.Oo():this.Po()).count&&t.all((function(t){return!t.isTreeExpanded})))return!1}else if(e===is&&(0<(t=t?this.Oo():this.Po()).count&&t.any((function(t){return!t.isTreeExpanded}))))return!1;return null===(t=this.labeledLink)||t.isVisible()},_u.prototype.Zb=function(t){ku.prototype.Zb.call(this,t);for(var e=this.linksConnected;e.next();){var i=e.value;if(t&&null!==this.containingGroup){var n=i.To(this);null===n||n.Td(this.containingGroup)||i.bb()}i.Zb(t)}},_u.prototype.qx=function(){var t=new Z,e=new Z;return ec(this,this,t,e),e.iterator},_u.prototype.findLinksConnected=function(t){if(void 0===t&&(t=null),null===t)return this.jb.iterator;var e=new K(this.jb),i=this;return e.predicate=function(e){return e.fromNode===i&&e.fromPortId===t||e.toNode===i&&e.toPortId===t},e},(e=_u.prototype).Mo=function(t){void 0===t&&(t=null);var e=new K(this.jb),i=this;return e.predicate=function(e){return e.fromNode===i&&(null===t||e.fromPortId===t)},e},e.Sd=function(t){void 0===t&&(t=null);var e=new K(this.jb),i=this;return e.predicate=function(e){return e.toNode===i&&(null===t||e.toPortId===t)},e},e.Mu=function(t){void 0===t&&(t=null);for(var e=null,i=null,n=this.jb.iterator;n.next();){var o=n.value;o.fromNode===this?null!==t&&o.fromPortId!==t||(o=o.toNode,null!==e?e.add(o):null!==i&&i!==o?((e=new Z).add(i),e.add(o)):i=o):o.toNode!==this||null!==t&&o.toPortId!==t||(o=o.fromNode,null!==e?e.add(o):null!==i&&i!==o?((e=new Z).add(i),e.add(o)):i=o)}return null!==e?e.iterator:null!==i?new W(i):q},e.Po=function(t){void 0===t&&(t=null);for(var e=null,i=null,n=this.jb.iterator;n.next();){var o=n.value;o.fromNode!==this||null!==t&&o.fromPortId!==t||(o=o.toNode,null!==e?e.add(o):null!==i&&i!==o?((e=new Z).add(i),e.add(o)):i=o)}return null!==e?e.iterator:null!==i?new W(i):q},e.Oo=function(t){void 0===t&&(t=null);for(var e=null,i=null,n=this.jb.iterator;n.next();){var o=n.value;o.toNode!==this||null!==t&&o.toPortId!==t||(o=o.fromNode,null!==e?e.add(o):null!==i&&i!==o?((e=new Z).add(i),e.add(o)):i=o)}return null!==e?e.iterator:null!==i?new W(i):q},e.jz=function(t,e,i){void 0===e&&(e=null),void 0===i&&(i=null);var n=new K(this.jb),o=this;return n.predicate=function(n){return!(n.fromNode!==o||n.toNode!==t||null!==e&&n.fromPortId!==e||null!==i&&n.toPortId!==i)||!(n.fromNode!==t||n.toNode!==o||null!==i&&n.fromPortId!==i||null!==e&&n.toPortId!==e)},n},e.kz=function(t,e,i){void 0===e&&(e=null),void 0===i&&(i=null);var n=new K(this.jb),o=this;return n.predicate=function(n){return!(n.fromNode!==o||n.toNode!==t||null!==e&&n.fromPortId!==e||null!==i&&n.toPortId!==i)},n},_u.prototype.updateRelationshipsFromData=function(){var t=this.diagram;null!==t&&t.partManager.updateRelationshipsFromData(this)},(e=_u.prototype).Vo=function(t){ku.prototype.Vo.call(this,t),t||(oc(this),null!==(t=this.Yk)&&Sc(t,this))},e.Wo=function(t){ku.prototype.Wo.call(this,t),t||null!==(t=this.Yk)&&null!==t.wd&&(t.wd.remove(this),t.v())},e.Lj=function(){if(0<this.jb.count){var t=this.diagram;if(null!==t)for(var e=null===t.commandHandler||t.commandHandler.deletesConnectedLinks,i=this.jb.copy().iterator;i.next();){var n=i.value;e?t.remove(n):(n.fromNode===this&&(n.fromNode=null),n.toNode===this&&(n.toNode=null))}}this.labeledLink=null,ku.prototype.Lj.call(this)},e.ns=function(t){if(null===this.wc){if(""===t&&!1===this.Te)return this;rc(this)}var e=this.wc.I(t);return null!==e||""!==t&&null!==(e=this.wc.I(""))?e:this},e.Nz=function(t){if(null===t||t===this)return!1;var e=!0,i=this.diagram;if(null!==i&&(e=i.isTreePathToChildren),i=this,e)for(;i!==t;){e=null;for(var n=i.jb.iterator;n.next();){var o=n.value;if(o.isTreeLink&&((e=o.fromNode)!==i&&e!==this))break}if(e===this||null===e||e===i)return!1;i=e}else for(;i!==t;){for(e=null,n=i.jb.iterator;n.next()&&(!(o=n.value).isTreeLink||((e=o.toNode)===i||e===this)););if(e===this||null===e||e===i)return!1;i=e}return!0},e.xz=function(){var t=!0,e=this.diagram;if(null!==e&&(t=e.isTreePathToChildren),e=this,t)for(;;){t=null;for(var i=e.jb.iterator;i.next();){var n=i.value;if(n.isTreeLink&&((t=n.fromNode)!==e&&t!==this))break}if(t===this)return this;if(null===t||t===e)return e;e=t}else for(;;){for(t=null,i=e.jb.iterator;i.next()&&(!(n=i.value).isTreeLink||((t=n.toNode)===e||t===this)););if(t===this)return this;if(null===t||t===e)return e;e=t}},e.gz=function(t){if(null===t)return null;if(this===t)return this;for(var e=this;null!==e;)Vu(e,!0),e=e.pg();var i=null;for(e=t;null!==e;){if(0!=(1048576&e.G)){i=e;break}e=e.pg()}for(e=this;null!==e;)Vu(e,!1),e=e.pg();return i},e.kh=function(){var t=!0,e=this.diagram;if(null!==e&&(t=e.isTreePathToChildren),e=this.jb.iterator,t){for(;e.next();)if((t=e.value).isTreeLink&&t.fromNode!==this)return t}else for(;e.next();)if((t=e.value).isTreeLink&&t.toNode!==this)return t;return null},e.pg=function(){var t=this.ci;if(null===t)return null;if(t instanceof _u)return t;t=null===(t=this.diagram)||t.isTreePathToChildren;for(var e=this.jb.iterator;e.next();){var i=e.value;if(i.isTreeLink&&(i=t?i.fromNode:i.toNode)!==this)return this.ci=i}return this.ci=null},e.vz=function(){var t=new Z;return function t(e,i){i.add(e);var n=e.kh();null!==n&&(i.add(n),null!==(e=e.pg())&&t(e,i))}(this,t),t},e.uz=function(){return hc(this,this)},e.Qo=function(){var t=!0,e=this.diagram;null!==e&&(t=e.isTreePathToChildren),e=new K(this.jb);var i=this;return e.predicate=t?function(t){return!(!t.isTreeLink||t.fromNode!==i)}:function(t){return!(!t.isTreeLink||t.toNode!==i)},e},e.Ou=function(){var t=!0,e=this.diagram;null!==e&&(t=e.isTreePathToChildren);var i=e=null,n=this.jb.iterator;if(t)for(;n.next();)(t=n.value).isTreeLink&&t.fromNode===this&&(t=t.toNode,null!==e?e.add(t):null!==i&&i!==t?((e=new $).add(i),e.add(t)):i=t);else for(;n.next();)(t=n.value).isTreeLink&&t.toNode===this&&(t=t.fromNode,null!==e?e.add(t):null!==i&&i!==t?((e=new $).add(i),e.add(t)):i=t);return null!==e?e.iterator:null!==i?new W(i):q},e.wz=function(t){void 0===t&&(t=1/0);var e=new Z;return Uu(e,this,!1,t,!0),e},_u.prototype.collapseTree=function(t){void 0===t&&(t=1),1>t&&(t=1);var e=this.diagram;if(null!==e&&!e.Ue){e.Ue=!0;var i=new Z;i.add(this),lc(this,i,e.isTreePathToChildren,t,e,this,e.treeCollapsePolicy===ts),e.Ue=!1}},_u.prototype.expandTree=function(t){void 0===t&&(t=2),2>t&&(t=2);var e=this.diagram;if(null!==e&&!e.Ue){e.Ue=!0;var i=new Z;i.add(this),cc(this,i,e.isTreePathToChildren,t,e,this,e.treeCollapsePolicy===ts),e.Ue=!1}},d.Object.defineProperties(_u.prototype,{portSpreading:{get:function(){return null!==this.Ba?this.Ba.er:fc},set:function(t){var e=this.portSpreading;e!==t&&($u(this),this.Ba.er=t,this.g("portSpreading",e,t),null!==(t=this.diagram)&&t.undoManager.isUndoingRedoing||this.Bd())}},avoidable:{get:function(){return 0!=(8&this.U)},set:function(t){var e=0!=(8&this.U);if(e!==t){this.U^=8;var i=this.diagram;null!==i&&jr(i,this),this.g("avoidable",e,t)}}},avoidableMargin:{get:function(){return null!==this.Ba?this.Ba.yp:Zt},set:function(t){"number"==typeof t&&(t=new Kt(t));var e=this.avoidableMargin;if(!e.D(t)){t=t.J(),$u(this),this.Ba.yp=t;var i=this.diagram;null!==i&&jr(i,this),this.g("avoidableMargin",e,t)}}},linksConnected:{get:function(){return this.jb.iterator}},linkConnected:{get:function(){return null!==this.Ba?this.Ba.Dq:null},set:function(t){var e=this.linkConnected;e!==t&&($u(this),this.Ba.Dq=t,this.g("linkConnected",e,t))}},linkDisconnected:{get:function(){return null!==this.Ba?this.Ba.Eq:null},set:function(t){var e=this.linkDisconnected;e!==t&&($u(this),this.Ba.Eq=t,this.g("linkDisconnected",e,t))}},linkValidation:{get:function(){return null!==this.Ba?this.Ba.gj:null},set:function(t){var e=this.linkValidation;e!==t&&($u(this),this.Ba.gj=t,this.g("linkValidation",e,t))}},isLinkLabel:{get:function(){return null!==this.Yk}},labeledLink:{get:function(){return this.Yk},set:function(t){var e=this.Yk;if(e!==t){var i=this.diagram,n=this.data;if(null!==e){if(null!==e.wd&&(e.wd.remove(this),e.v()),null!==i&&null!==n&&!i.undoManager.isUndoingRedoing){var o=e.data,r=i.model;if(null!==o&&r.ri()){var s=r.wa(n);void 0!==s&&r.Qx(o,s)}}this.containingGroup=null}this.Yk=t,null!==t&&(Sc(t,this),null===i||null===n||i.undoManager.isUndoingRedoing||(o=t.data,i=i.model,null!==o&&i.ri()&&(void 0!==(n=i.wa(n))&&i.Bu(o,n))),this.containingGroup=t.containingGroup),qs(this),this.g("labeledLink",e,t)}}},port:{get:function(){return this.ns("")}},ports:{get:function(){return null===this.wc&&rc(this),this.wc.iteratorValues}},isTreeExpanded:{get:function(){return 0!=(1&this.U)},set:function(t){var e=0!=(1&this.U);if(e!==t){this.U^=1;var i=this.diagram;if(this.g("isTreeExpanded",e,t),null!==(e=this.treeExpandedChanged)){var n=!0;null!==i&&(n=i.aa,i.aa=!0),e(this),null!==i&&(i.aa=n)}null!==i&&i.undoManager.isUndoingRedoing?this.Zb(t):t?this.expandTree():this.collapseTree()}}},wasTreeExpanded:{get:function(){return 0!=(2&this.U)},set:function(t){var e=0!=(2&this.U);e!==t&&(this.U^=2,this.g("wasTreeExpanded",e,t))}},treeExpandedChanged:{get:function(){return null!==this.Ba?this.Ba.Vr:null},set:function(t){var e=this.treeExpandedChanged;e!==t&&($u(this),this.Ba.Vr=t,this.g("treeExpandedChanged",e,t))}},isTreeLeaf:{get:function(){return 0!=(4&this.U)},set:function(t){var e=0!=(4&this.U);e!==t&&(this.U^=4,this.g("isTreeLeaf",e,t))}}}),_u.prototype.expandTree=_u.prototype.expandTree,_u.prototype.collapseTree=_u.prototype.collapseTree,_u.prototype.findTreeParts=_u.prototype.wz,_u.prototype.findTreeChildrenNodes=_u.prototype.Ou,_u.prototype.findTreeChildrenLinks=_u.prototype.Qo,_u.prototype.findTreeLevel=_u.prototype.uz,_u.prototype.findTreeParentChain=_u.prototype.vz,_u.prototype.findTreeParentNode=_u.prototype.pg,_u.prototype.findTreeParentLink=_u.prototype.kh,_u.prototype.findCommonTreeParent=_u.prototype.gz,_u.prototype.findTreeRoot=_u.prototype.xz,_u.prototype.isInTreeOf=_u.prototype.Nz,_u.prototype.findPort=_u.prototype.ns,_u.prototype.findLinksTo=_u.prototype.kz,_u.prototype.findLinksBetween=_u.prototype.jz,_u.prototype.findNodesInto=_u.prototype.Oo,_u.prototype.findNodesOutOf=_u.prototype.Po,_u.prototype.findNodesConnected=_u.prototype.Mu,_u.prototype.findLinksInto=_u.prototype.Sd,_u.prototype.findLinksOutOf=_u.prototype.Mo,_u.prototype.findExternalTreeLinksConnected=_u.prototype.qx,_u.prototype.invalidateConnectedLinks=_u.prototype.Bd,_u.prototype.invalidateLinkBundle=_u.prototype.Lz;var dc=new V(_u,"SpreadingNone",10),fc=new V(_u,"SpreadingEvenly",11),pc=new V(_u,"SpreadingPacked",12);function gc(t,e){void 0===t||t instanceof ch||"string"==typeof t?_u.call(this,t):(_u.call(this),t&&(e=t)),this.U|=4608,this.Gn=new Z,this.$a=null,this.Sc=new Bd,this.Sc.group=this,this.gl=new Z,this.tb=this.$p=null,e&&Object.assign(this,e)}function mc(t,e){if(t.Gn.add(e)){e instanceof gc&&t.gl.add(e);var i=t.memberAdded;if(null!==i){var n=!0,o=t.diagram;null!==o&&(n=o.aa,o.aa=!0),i(t,e),null!==o&&(o.aa=n)}t.isVisible()&&t.isSubGraphExpanded||e.Zb(!1)}e instanceof wc&&!t.computesBoundsIncludingLinks||(null===(e=t.$a)&&(e=t),e.v())}function yc(t,e){if(t.Gn.remove(e)){e instanceof gc&&t.gl.remove(e);var i=t.memberRemoved;if(null!==i){var n=!0,o=t.diagram;null!==o&&(n=o.aa,o.aa=!0),i(t,e),null!==o&&(o.aa=n)}t.isVisible()&&t.isSubGraphExpanded||e.Zb(!0)}e instanceof wc&&!t.computesBoundsIncludingLinks||(null===(e=t.$a)&&(e=t),e.v())}function vc(t,e,i,n){for(var o=t.memberParts;o.next();){var r=o.value;if(r.Zb(!1),r instanceof gc&&r.isSubGraphExpanded&&(r.wasSubGraphExpanded=r.isSubGraphExpanded,vc(r,e,i,n)),r instanceof _u)r.Bd(e),i.Aj(r,n);else if(r instanceof wc)for(r=r.labelNodes;r.next();)r.value.Bd(e)}t.isSubGraphExpanded=!1}function xc(t,e,i,n){for(var o=t.memberParts;o.next();){var r=o.value;if(r.Zb(!0),r instanceof gc&&r.wasSubGraphExpanded&&(r.wasSubGraphExpanded=!1,xc(r,e,i,n)),r instanceof _u)r.Bd(e),i.Cj(r,n);else if(r instanceof wc)for(r=r.labelNodes;r.next();)r.value.Bd(e)}t.isSubGraphExpanded=!0}function bc(t){Fs.call(this),this.yb=Jt,this.ko=new jt(NaN,NaN,NaN,NaN),t&&Object.assign(this,t)}function wc(t){ku.call(this,Th.Link),this.Qa=8,this.ef=null,this.ff="",this.uf=this.gn=null,this.vf="",this.uo=null,this.qk=Kc,this.Om=0,this.Qm=Kc,this.Rm=NaN,this.qj=Xc,this.po=.5,this.wd=null,this.Nb=(new $).freeze(),this.Tg=this.Mg=null,this.ml=new jt,this.ua=new Xe,this.u=this.o=this.Sf=this.Wf=null,this.su=new pt,this.cq=this.Mw=this.Lw=null,this.vt=NaN,this.ba=null,this.j=[],t&&Object.assign(this,t)}function kc(t){var e=t.fromNode,i=t.toNode,n=null;if(n=null!==e?null!==i?e.px(i):e.containingGroup:null!==i?i.containingGroup:null,e=n,(i=t.Ah)!==e){null!==i&&yc(i,t),t.Ah=e,null!==e&&mc(e,t);var o=t.containingGroupChanged;if(null!==o){var r=!0,s=t.diagram;null!==s&&(r=s.aa,s.aa=!0),o(t,i,e),null!==s&&(s.aa=r)}!t.fd||t.Lw!==i&&t.Mw!==i||t.bb()}if(t.isLabeledLink)for(t=t.labelNodes;t.next();)t.value.containingGroup=n}function Sc(t,e){null===t.wd&&(t.wd=new Z),t.wd.add(e),t.v()}function Mc(t,e,i){if(0!==e||0!==i)if(0===t.pointsCount)t.defaultFromPoint&&t.defaultFromPoint.offset(e,i),t.defaultToPoint&&t.defaultToPoint.offset(e,i);else{for(var n=t.fd,o=new $,r=t.Nb.iterator;r.next();){var s=r.value;o.add(new pt(s.x+e,s.y+i).freeze())}o.freeze(),r=t.Nb,t.Nb=o,s=t.diagram,isNaN(e)||isNaN(i)||null!==s&&s.animationManager.zb?t.v():(t.ke.h(t.ke.x+e,t.ke.y+i),t.pa.h(t.pa.x+e,t.pa.y+i),qs(t)),n?Cc(t):(t.defaultFromPoint&&(t.defaultFromPoint=t.i(0)),t.defaultToPoint&&(t.defaultToPoint=t.i(t.pointsCount-1))),null!==s&&s.animationManager.zb&&Qn(s.animationManager,t,o),t.g("points",r,o)}}function Cc(t){0===t.Nb.count?t.fd=!1:(t.fd=!0,t.cq=null,t.vt=NaN,t.defaultFromPoint=t.i(0),t.defaultToPoint=t.i(t.pointsCount-1),zc(t,!1))}function Pc(t,e){return Math.abs(e.x-t.x)>Math.abs(e.y-t.y)?(e.x>=t.x?e.x=t.x+9e9:e.x=t.x-9e9,e.y=t.y):(e.y>=t.y?e.y=t.y+9e9:e.y=t.y-9e9,e.x=t.x),e}function Tc(t,e){var i=e.Zn;return null===i&&((i=new Td).port=e,i.node=e.part,e.Zn=i),Ld(i,t)}function Nc(t){return t===Qt||.5===t.x&&.5===t.y}function Lc(t){return.5===t.x&&.5===t.y?t:oe}function Ac(t){if(null===t.diagram||!t.isAvoiding||!Ar(t.diagram))return!1;var e=t.points.s,i=e.length;if(4>i)return!1;t=Br(t.diagram,!0,t.containingGroup,null);for(var n=1;n<i-2;n++){var o=e[n],r=e[n+1];if(!t.Yj(Math.min(o.x,r.x),Math.min(o.y,r.y),Math.abs(o.x-r.x),Math.abs(o.y-r.y)))return!0}return!1}function Bc(t,e,i,n,o,r,s){var a=e.Ho,h=e.Go,l=gd(e,i,n),u=i,c=n;for(0===o?u+=a:90===o?c+=h:180===o?u-=a:c-=h,o!==s&&l>Sd&&gd(e,u,c)!==l-1&&(gd(e,i-a,n)===l-1?(o=180,u=i-a,c=n):gd(e,i+a,n)===l-1?(o=0,u=i+a,c=n):gd(e,i,n-h)===l-1?(o=270,u=i,c=n-h):gd(e,i,n+h)===l-1&&(o=90,u=i,c=n+h));l>Sd&&gd(e,u,c)===l-1;)i=u,n=c,0===o?u+=a:90===o?c+=h:180===o?u-=a:c-=h,--l;r?l>Sd&&(180===o||0===o?i=Math.floor(i/a)*a+a/2:90!==o&&270!==o||(n=Math.floor(n/h)*h+h/2)):(i=Math.floor(i/a)*a+a/2,n=Math.floor(n/h)*h+h/2),l>Sd&&(r=o,s=i,u=n,0===o?(r=90,u+=h):90===o?(r=180,s-=a):180===o?(r=270,u-=h):270===o&&(r=0,s+=a),gd(e,s,u)===l-1?Bc(t,e,s,u,r,!1,r):(s=i,u=n,0===o?(r=270,u-=h):90===o?(r=0,s+=a):180===o?(r=90,u+=h):270===o&&(r=180,s-=a),gd(e,s,u)===l-1&&Bc(t,e,s,u,r,!1,r))),t.yf(i,n)}function Dc(t,e,i,n){return t=i-t,isNaN(t)||1/0===t||-1/0===t?NaN:(0>t&&(t=-t),e=n-e,isNaN(e)||1/0===e||-1/0===e?NaN:(0>e&&(e=-e),Ye.$(t,0)?e:Ye.$(e,0)?t:Math.sqrt(t*t+e*e)))}function Fc(t,e,i,n){var o=t.pointsCount;if(2>o)return e;if(i){var r=t.i(1);if(i=r.x-n.x,r=r.y-n.y,0===(n=Dc(e.x,e.y,i,r)))return e;o=2===o?.5*n:n,(t=t.computeShortLength(!0))>o&&(t=o),o=t*(r-e.y)/n,e.x+=t*(i-e.x)/n,e.y+=o}else{if(i=(r=t.i(o-2)).x-n.x,r=r.y-n.y,0===(n=Dc(e.x,e.y,i,r)))return e;o=2===o?.5*n:n,(t=t.computeShortLength(!1))>o&&(t=o),o=t*(e.y-r)/n,e.x-=t*(e.x-i)/n,e.y-=o}return e}function jc(t,e,i,n){for(var o=t.pointsCount,r=e;Ye.$(e.x,r.x)&&Ye.$(e.y,r.y);){if(i>=o)return o-1;r=t.i(i++)}if(!Ye.$(e.x,r.x)&&!Ye.$(e.y,r.y))return i-1;for(var s=r;Ye.$(e.x,r.x)&&Ye.$(r.x,s.x)&&(!n||(e.y>=r.y?r.y>=s.y:r.y<=s.y))||Ye.$(e.y,r.y)&&Ye.$(r.y,s.y)&&(!n||(e.x>=r.x?r.x>=s.x:r.x<=s.x));){if(i>=o)return o-1;s=t.i(i++)}return i-2}function Ec(t,e,i,n,o,r,s){if(!s&&Ic(t)){var a=(s=t.computeJumpLength())/2,h=[],l=0;if(t.isVisible()&&(l=function(t,e,i,n){var o=t.diagram;if(null===o||e.D(i))return 0;for(o=o.layers;o.next();){var r=o.value;if(null!==r&&r.visible)for(var s=(r=r.Pa.s).length,a=0;a<s;a++){var h=r[a];if(h instanceof wc){if(h===t)return 0<n.length&&n.sort((function(t,e){return t-e})),n.length;if(h.isVisible()&&Ic(h)){var l=h.routeBounds;l.w()&&t.routeBounds.Yc(l)&&!t.usesSamePort(h)&&(null!==(l=h.path)&&l.Ed()&&Oc(e,i,n,h))}}}}return 0<n.length&&n.sort((function(t,e){return t-e})),n.length}(t,o,r,h)),0<l)if(Ye.B(o.y,r.y))if(o.x<r.x)for(var u=0;u<l;){var c=Math.max(o.x,Math.min(h[u++]-a,r.x-s));e.lineTo(c+i,r.y+n);for(var d=c+i,f=Math.min(c+s,r.x);u<l&&(c=h[u])<f+s;)u++,f=Math.min(c+a,r.x);c=r.y-s+n,f+=i;var p=r.y+n;t.curve===$c?fu(e,f,p,!1):gu(e,d,c,f,c,f,p)}else for(--l;0<=l;){for(u=Math.min(o.x,Math.max(h[l--]+a,r.x+s)),e.lineTo(u+i,r.y+n),d=u+i,c=Math.max(u-s,r.x);0<=l&&(u=h[l])>c-s;)l--,c=Math.max(u-a,r.x);u=r.y-s+n,c+=i,f=r.y+n,t.curve===$c?fu(e,c,f,!1):gu(e,d,u,c,u,c,f)}else if(Ye.B(o.x,r.x))if(o.y<r.y)for(u=0;u<l;){for(c=Math.max(o.y,Math.min(h[u++]-a,r.y-s)),e.lineTo(r.x+i,c+n),d=c+n,c=Math.min(c+s,r.y);u<l&&(f=h[u])<c+s;)u++,c=Math.min(f+a,r.y);f=r.x-s+i,p=r.x+i,c+=n,t.curve===$c?fu(e,p,c,!1):gu(e,f,d,f,c,p,c)}else for(--l;0<=l;){for(u=Math.min(o.y,Math.max(h[l--]+a,r.y+s)),e.lineTo(r.x+i,u+n),d=u+n,u=Math.max(u-s,r.y);0<=l&&(c=h[l])>u-s;)l--,u=Math.max(c-a,r.y);c=r.x-s+i,f=r.x+i,u+=n,t.curve===$c?fu(e,f,u,!1):gu(e,c,d,c,u,f,u)}}e.lineTo(r.x+i,r.y+n)}function Oc(t,e,i,n){for(var o=Ye.B(t.y,e.y),r=n.pointsCount,s=n.i(0),a=pt.alloc(),h=1;h<r;h++){var l=n.i(h);if(h<r-1){var u=n.i(h+1);if(s.y===l.y&&l.y===u.y){if(l.x>s.x&&u.x>=l.x||l.x<s.x&&u.x<=l.x)continue}else if(s.x===l.x&&l.x===u.x&&(l.y>s.y&&u.y>=l.y||l.y<s.y&&u.y<=l.y))continue}t:{u=t.x;var c=t.y,d=e.x,f=e.y,p=s.x;s=s.y;var g=l.x,m=l.y;if(Ye.B(u,d)){if(!Ye.B(c,f)&&Ye.B(s,m)&&Math.min(c,f)<s&&Math.max(c,f)>s&&Math.min(p,g)<u&&Math.max(p,g)>u&&!Ye.B(p,g)){a.x=u,a.y=s,u=!0;break t}}else if(Ye.B(c,f)&&Ye.B(p,g)&&Math.min(u,d)<p&&Math.max(u,d)>p&&Math.min(s,m)<c&&Math.max(s,m)>c&&!Ye.B(s,m)){a.x=p,a.y=c,u=!0;break t}a.x=0,a.y=0,u=!1}u&&(o?i.push(a.x):i.push(a.y)),s=l}pt.free(a)}function Ic(t){return(t=t.curve)===Jc||t===$c}function zc(t,e){(e||Ic(t))&&(null===(e=t.diagram)||e.animationManager.isTicking||e.Eh.contains(t)||0===t.ml.width&&0===t.ml.height||e.Eh.add(t,t.ml.copy()))}function Rc(t,e,i){if(null!==e&&e.lk&&e.fd&&Ic(e)){var n=e.routeBounds;n.w()&&(t.routeBounds.Yc(n)||i.Yc(n))&&(t.usesSamePort(e)||e.qc())}}function Vc(t){var e=t.ef;if(null!==e){var i=t.uf;if(null!==i&&isNaN(t.curviness)){for(var n=t.ff,o=t.vf,r=t=null,s=e.jb.s,a=s.length,h=0;h<a;h++){var l=s[h];(l.ef===e&&l.ff===n&&l.uf===i&&l.vf===o||l.ef===i&&l.ff===o&&l.uf===e&&l.vf===n)&&(null===r?r=l:(null===t&&(t=[]).push(r),t.push(l)))}if(null!==t){for(null===(r=Zu(e,i,n,o))&&(Ju(e,r=new dd(e,n,i,o)),Ju(i,r)),r.links=t,e=0;e<t.length;e++)t[e].Sf=r;r.Sl()}}}}function Gc(t){var e=t.Sf;null!==e&&isNaN(t.curviness)&&(t.Sf=null,0<=(t=e.links.indexOf(t))&&(L(e.links,t),e.Sl()))}_u.className="Node",_u.SpreadingNone=dc,_u.SpreadingEvenly=fc,_u.SpreadingPacked=pc,c(gc,_u),gc.prototype.cloneProtected=function(t){_u.prototype.cloneProtected.call(this,t),this.U=-32769&this.U;var e=t.Nl((function(t){return t instanceof bc}));t.$a=e instanceof bc?e:null,null!==this.Sc?(t.Sc=this.Sc.copy(),t.Sc.group=t):(null!==t.Sc&&(t.Sc.group=null),t.Sc=null),null!==this.tb&&(t.tb=this.tb.copy())},(e=gc.prototype).Af=function(t){_u.prototype.Af.call(this,t);var e=t.Rj();for(t=t.memberParts;t.next();){var i=t.value;if(i.v(),i.C(8),i.Ej(),i instanceof _u)i.Bd(e);else if(i instanceof wc)for(i=i.labelNodes;i.next();)i.value.Bd(e)}},e.gk=function(t,e,i,n,o,r,s){if(t===fi&&"elements"===e){if(o instanceof bc)null===this.$a?this.$a=o:this.$a!==o&&w("Cannot insert a second Placeholder into the visual tree of a Group.");else if(o instanceof Th){var a=o.Nl((function(t){return t instanceof bc}));a instanceof bc&&(null===this.$a?this.$a=a:this.$a!==a&&w("Cannot insert a second Placeholder into the visual tree of a Group."))}}else t===pi&&"elements"===e&&null!==this.$a&&(n===this.$a||n instanceof Th&&this.$a.rg(n))&&(this.$a=null);_u.prototype.gk.call(this,t,e,i,n,o,r,s)},e.Xl=function(t,e){_u.prototype.Xl.call(this,t,e),this.isClipping&&this.type!==Th.Spot&&this.isSubGraphExpanded&&((t=this.resizeObject)instanceof Th&&(t=t.Pb()),null===this.tb&&(this.tb=new jt),t.mi(this.tb),t instanceof pl&&this.tb.Bc(-t.strokeWidth,-t.strokeWidth))},e.eh=function(t,e,i,n){this.nf=this.$a,_u.prototype.eh.call(this,t,e,i,n)},e.Va=function(){var t=this;t.isSubGraphExpanded&&this.memberParts.each((function(e){!t.computesBoundsIncludingLinks&&e instanceof wc||e.Va()})),_u.prototype.Va.call(this)},e.si=function(){if(!_u.prototype.si.call(this))return!1;for(var t=this.memberParts;t.next();){var e=t.value;if(e instanceof _u){if(e.isVisible()&&na(e))return!1}else if(e instanceof wc&&e.isVisible()&&na(e)&&e.fromNode!==this&&e.toNode!==this)return!1}return!0},e.Lj=function(){if(0<this.Gn.count){var t=this.diagram;if(null!==t)for(var e=this.Gn.copy().iterator;e.next();)t.remove(e.value)}_u.prototype.Lj.call(this)},gc.prototype.canAddMembers=function(t){var e=this.diagram;if(null===e)return!1;for(e=e.commandHandler,t=Ds(t).iterator;t.next();)if(!e.isValidMember(this,t.value))return!1;return!0},gc.prototype.addMembers=function(t,e){var i=this.diagram;if(null===i)return!1;i=i.commandHandler;var n=!0;for(t=Ds(t).iterator;t.next();){var o=t.value;!e||i.isValidMember(this,o)?o.containingGroup=this:n=!1}return n},gc.prototype.canUngroup=function(){if(!this.ungroupable)return!1;var t=this.layer;return!(null===t||!t.allowUngroup)&&!(null!==(t=t.diagram)&&!t.allowUngroup)},(e=gc.prototype).Bd=function(t){var e=0!=(65536&this.U);if(_u.prototype.Bd.call(this,t),!e)for(0!=(65536&this.U)!=!0&&(this.U=65536^this.U),e=this.Lu();e.next();){var i=e.value;if(void 0===t||!t.contains(i)){var n=i.fromNode;null!==n&&n!==this&&n.Td(this)&&!n.isVisible()?(tc(i.fromPort),tc(i.toPort),i.bb()):null!==(n=i.toNode)&&n!==this&&n.Td(this)&&!n.isVisible()&&(tc(i.fromPort),tc(i.toPort),i.bb())}}},e.Lu=function(){var t=null!==this.diagram&&this.diagram.Pw;if(t&&null!==this.$p)return this.$p.iterator;var e=this.Rj();e.add(this);for(var i=new Z,n=e.iterator;n.next();){var o=n.value;if(o instanceof _u)for(o=o.linksConnected;o.next();){var r=o.value;e.contains(r)||i.add(r)}}return t&&(this.$p=i),i.iterator},e.iz=function(){var t=this.Rj();t.add(this);for(var e=new Z,i=t.iterator;i.next();){var n=i.value;if(n instanceof _u)for(n=n.linksConnected;n.next();){var o=n.value,r=o.fromNode;null===r||t.contains(r)&&r!==this||e.add(r),null===(o=o.toNode)||t.contains(o)&&o!==this||e.add(o)}}return e.iterator},e.hz=function(){var t=new Z;return function t(e,i){null!==e&&(i.add(e),t(e.containingGroup,i))}(this,t),t},e.Rj=function(){var t=new Z;return Uu(t,this,!0,0,!0),t.remove(this),t},e.Zb=function(t){_u.prototype.Zb.call(this,t);for(var e=this.memberParts;e.next();)e.value.Zb(t)},gc.prototype.collapseSubGraph=function(){var t=this.diagram;null===t||t.Ue||(t.Ue=!0,vc(this,this.Rj(),t,this),t.Ue=!1)},gc.prototype.expandSubGraph=function(){var t=this.diagram;null===t||t.Ue||(t.Ue=!0,xc(this,this.Rj(),t,this),t.Ue=!1)},gc.prototype.move=function(t,e){void 0===e&&(e=!1);var i=e?this.location:this.position,n=i.x;i=i.y;var o=t.x,r=t.y;if(!(n===o||isNaN(n)&&isNaN(o))||!(i===r||isNaN(i)&&isNaN(r))){for(n=o-(isNaN(n)?0:n),i=r-(isNaN(i)?0:i),r=pt.alloc(),_u.prototype.move.call(this,t,e),t=new Z,e=this.Rj().iterator;e.next();)(o=e.value)instanceof wc&&(o.suspendsRouting&&t.add(o),o.fd||o.fromNode!==this&&o.toNode!==this)&&(o.suspendsRouting=!0);for(e.reset();e.next();)if(!((o=e.value).ph()||o instanceof _u&&o.isLinkLabel)){var s=o.position,a=o.location;s.w()?(r.x=s.x+n,r.y=s.y+i,o.position=r):a.w()&&(r.x=a.x+n,r.y=a.y+i,o.location=r)}for(e.reset();e.next();)(o=e.value)instanceof wc&&(o.suspendsRouting=t.contains(o),o.fd||o.fromNode!==this&&o.toNode!==this)&&(s=o.position,r.x=s.x+n,r.y=s.y+i,r.w()?o.move(r):o.bb(),Ac(o)&&o.bb());pt.free(r)}},d.Object.defineProperties(gc.prototype,{placeholder:{get:function(){return this.$a}},computesBoundsAfterDrag:{get:function(){return 0!=(2048&this.U)},set:function(t){var e=0!=(2048&this.U);e!==t&&(this.U^=2048,this.g("computesBoundsAfterDrag",e,t))}},computesBoundsIncludingLinks:{get:function(){return 0!=(4096&this.U)},set:function(t){var e=0!=(4096&this.U);e!==t&&(this.U^=4096,this.g("computesBoundsIncludingLinks",e,t))}},computesBoundsIncludingLocation:{get:function(){return 0!=(8192&this.U)},set:function(t){var e=0!=(8192&this.U);e!==t&&(this.U^=8192,this.g("computesBoundsIncludingLocation",e,t))}},handlesDragDropForMembers:{get:function(){return 0!=(16384&this.U)},set:function(t){var e=0!=(16384&this.U);e!==t&&(this.U^=16384,this.g("handlesDragDropForMembers",e,t))}},memberParts:{get:function(){return this.Gn.iterator}},layout:{get:function(){return this.Sc},set:function(t){var e=this.Sc;if(e!==t){null!==t&&null!==t.diagram&&t.diagram.layout===t&&w("A layout cannot be both the Diagram.layout and a Group.layout: "+t),null!==e&&(e.diagram=null,e.group=null),this.Sc=t;var i=this.diagram;null!==t&&(t.diagram=i,t.group=this),null!==i&&(i.xh=!0),this.g("layout",e,t),null!==i&&i.$b()}}},memberAdded:{get:function(){return null!==this.Ba?this.Ba.Mq:null},set:function(t){var e=this.memberAdded;e!==t&&($u(this),this.Ba.Mq=t,this.g("memberAdded",e,t))}},memberRemoved:{get:function(){return null!==this.Ba?this.Ba.Nq:null},set:function(t){var e=this.memberRemoved;e!==t&&($u(this),this.Ba.Nq=t,this.g("memberRemoved",e,t))}},memberValidation:{get:function(){return null!==this.Ba?this.Ba.ij:null},set:function(t){var e=this.memberValidation;e!==t&&($u(this),this.Ba.ij=t,this.g("memberValidation",e,t))}},ungroupable:{get:function(){return 0!=(256&this.U)},set:function(t){var e=0!=(256&this.U);e!==t&&(this.U^=256,this.g("ungroupable",e,t))}},isSubGraphExpanded:{get:function(){return 0!=(512&this.U)},set:function(t){var e=0!=(512&this.U);if(e!==t){this.U^=512;var i=this.diagram;if(this.g("isSubGraphExpanded",e,t),null!==(e=this.subGraphExpandedChanged)){var n=!0;null!==i&&(n=i.aa,i.aa=!0),e(this),null!==i&&(i.aa=n)}null!==i&&i.undoManager.isUndoingRedoing?(null!==this.$a&&this.$a.v(),this.memberParts.each((function(t){t.updateAdornments()}))):t?this.expandSubGraph():this.collapseSubGraph()}}},wasSubGraphExpanded:{get:function(){return 0!=(1024&this.U)},set:function(t){var e=0!=(1024&this.U);e!==t&&(this.U^=1024,this.g("wasSubGraphExpanded",e,t))}},subGraphExpandedChanged:{get:function(){return null!==this.Ba?this.Ba.Kr:null},set:function(t){var e=this.subGraphExpandedChanged;e!==t&&($u(this),this.Ba.Kr=t,this.g("subGraphExpandedChanged",e,t))}},rh:{get:function(){return 0!=(32768&this.U)},set:function(t){0!=(32768&this.U)!==t&&(this.U^=32768)}}}),gc.prototype.expandSubGraph=gc.prototype.expandSubGraph,gc.prototype.collapseSubGraph=gc.prototype.collapseSubGraph,gc.prototype.findSubGraphParts=gc.prototype.Rj,gc.prototype.findContainingGroupChain=gc.prototype.hz,gc.prototype.findExternalNodesConnected=gc.prototype.iz,gc.prototype.findExternalLinksConnected=gc.prototype.Lu,gc.prototype.ensureBounds=gc.prototype.Va,gc.className="Group",c(bc,Fs),bc.prototype.cloneProtected=function(t){Fs.prototype.cloneProtected.call(this,t),t.yb=this.yb.J(),t.ko=this.ko.copy()},bc.prototype.gh=function(t){if(null===this.background&&null===this.areaBackground)return!1;var e=this.naturalBounds;return Yt(0,0,e.width,e.height,t.x,t.y)},bc.prototype.Wl=function(){var t=this.part;if(null!==t&&(t instanceof gc||t instanceof Wu)||w("Placeholder is not inside a Group or Adornment."),t instanceof gc){var e=this.computeBorder(this.ko),i=this.minSize,n=this.dc;for(Et(n,(isFinite(i.width)?Math.max(i.width,e.width):e.width)||0,(isFinite(i.height)?Math.max(i.height,e.height):e.height)||0),this.Ge(0,0,n.width,n.height),n=t.memberParts,i=!1;n.next();)if(n.value.isVisible()){i=!0;break}n=t.diagram,!i||null===n||n.animationManager.Xu(t)||isNaN(e.x)||isNaN(e.y)||((i=pt.alloc()).xi(e,t.locationSpot),i.D(t.location)||(t.location=i),pt.free(i))}else{e=this.dc,n=(i=this.yb).left+i.right;var o=i.top+i.bottom,r=t.adornedObject;t.angle=r.li();var s=0;r instanceof pl&&(s=r.strokeWidth);var a=r.Df(),h=r.naturalBounds,l=(h.width+s)*a;s=(h.height+s)*a,t.type!==Th.Link&&(a=r.ga("Selection"===t.category?te:t.locationSpot,pt.alloc()),t.location=a,pt.free(a)),isNaN(l)||isNaN(s)?(t=r.ga(te,pt.alloc()),(l=jt.allocAt(t.x,t.y,0,0)).Ye(r.ga(he,t)),l.Ye(r.ga(ie,t)),l.Ye(r.ga(se,t)),Et(e,l.width+n||0,l.height+o||0),this.Ge(-i.left,-i.top,e.width,e.height),pt.free(t),jt.free(l)):(Et(e,l+n||0,s+o||0),this.Ge(-i.left,-i.top,e.width,e.height))}},bc.prototype.eh=function(t,e,i,n){this.actualBounds.h(t,e,i,n)},bc.prototype.computeBorder=function(t){var e=this.part,i=e.diagram,n=null===i||!i.animationManager.isAnimating;if(null!==i&&e instanceof gc&&!e.layer.isTemporary&&e.computesBoundsAfterDrag&&this.ko.w()){var o=i.toolManager.findTool("Dragging");if(o===i.currentTool&&null!==(i=o.computeBorder(e,this.ko,t)))return i}i=jt.alloc(),o=this.computeMemberBounds(i);var r=this.yb;return e instanceof gc&&!e.isSubGraphExpanded?t.h(o.x-r.left,o.y-r.top,0,0):t.h(o.x-r.left,o.y-r.top,Math.max(o.width+r.left+r.right,0),Math.max(o.height+r.top+r.bottom,0)),jt.free(i),n&&e instanceof gc&&e.computesBoundsIncludingLocation&&e.location.w()&&t.Ye(e.location),t},bc.prototype.computeMemberBounds=function(t){if(!(this.part instanceof gc))return t.h(0,0,0,0),t;for(var e=this.part,i=1/0,n=1/0,o=-1/0,r=-1/0,s=e.memberParts;s.next();){var a=s.value;if(a.isVisible()){if(a instanceof wc){if(!e.computesBoundsIncludingLinks)continue;if(ea(a))continue;if(a.fromNode===e||a.toNode===e)continue}(a=a.actualBounds).left<i&&(i=a.left),a.top<n&&(n=a.top),a.right>o&&(o=a.right),a.bottom>r&&(r=a.bottom)}}return isFinite(i)&&isFinite(n)?t.h(i,n,o-i,r-n):(e=e.location,t.h(e.x,e.y,0,0)),t},d.Object.defineProperties(bc.prototype,{padding:{get:function(){return this.yb},set:function(t){"number"==typeof t&&(t=new Kt(t));var e=this.yb;e.D(t)||(this.yb=t=t.J(),this.g("padding",e,t),this.v())}}}),bc.className="Placeholder",c(wc,ku),wc.prototype.cloneProtected=function(t){ku.prototype.cloneProtected.call(this,t),t.Qa=-113&this.Qa,t.ff=this.ff,t.gn=this.gn,t.vf=this.vf,t.uo=this.uo,t.qk=this.qk,t.Om=this.Om,t.Qm=this.Qm,t.Rm=this.Rm,t.qj=this.qj,t.po=this.po,null!==this.ba&&(t.ba=this.ba.copy())},(e=wc.prototype).Af=function(t){ku.prototype.Af.call(this,t),this.ff=t.ff,this.vf=t.vf,t.Mg=null,t.bb(),t.Sf=this.Sf;var e=t.fromPort;null!==e&&tc(e),null!==(t=t.toPort)&&tc(t)},e.qb=function(t){t.classType===wc?2==(2&t.value)?this.routing=t:t===_c||t===$c||t===Jc?this.curve=t:t===Zc||t===Qc||t===td?this.adjusting=t:t!==Xc&&t!==Kc&&w("Unknown Link enum value for a Link property: "+t):ku.prototype.qb.call(this,t)},e.Xc=function(){null===this.ba&&(this.ba=new pa)},e.si=function(){var t=this.fromNode;if(null!==t){var e=t.findVisibleNode();if(null!==e&&(t=e),na(t)||Ou(t))return!1}return null===(t=this.toNode)||(null!==(e=t.findVisibleNode())&&(t=e),!na(t)&&!Ou(t))},e.zv=function(){return!1},e.Av=function(){},e.Zc=function(){return!1},wc.prototype.computeAngle=function(t,e,i){return wc.computeAngle(e,i)},wc.computeAngle=function(t,e){switch(t){default:case Kc:t=0;break;case ed:t=e;break;case id:t=e+90;break;case nd:t=e-90;break;case od:t=e+180;break;case rd:90<(t=Ye.bp(e))&&270>t&&(t-=180);break;case sd:90<(t=Ye.bp(e+90))&&270>t&&(t-=180);break;case ad:90<(t=Ye.bp(e-90))&&270>t&&(t-=180);break;case hd:if(45<(t=Ye.bp(e))&&135>t||225<t&&315>t)return 0;90<t&&270>t&&(t-=180)}return Ye.bp(t)},(e=wc.prototype).oh=function(){var t=this.containingGroup;null!==t&&this.fromNode!==t&&this.toNode!==t&&t.computesBoundsIncludingLinks&&ku.prototype.oh.call(this)},e.To=function(t){var e=this.fromNode;return t===e?this.toNode:e},e.Cz=function(t){var e=this.fromPort;return t===e?this.toPort:e},e.Vo=function(t){if(ku.prototype.Vo.call(this,t),Ic(this)&&this.Xo(this.actualBounds),!t){var e=null;null!==(t=this.ef)&&ic(t,this,e=this.fromPort);var i=this.uf;if(null!==i){var n=this.toPort;i===t&&n===e||ic(i,this,n)}Vc(this)}},e.Wo=function(t){if(ku.prototype.Wo.call(this,t),Ic(this)&&this.Xo(this.actualBounds),!t){var e=null;null!==(t=this.ef)&&nc(t,this,e=this.fromPort);var i=this.uf;if(null!==i){var n=this.toPort;i===t&&n===e||nc(i,this,n)}Gc(this)}},e.Lj=function(){if(this.fd=!0,null!==this.wd){var t=this.diagram;if(null!==t)for(var e=this.wd.copy().iterator;e.next();)t.remove(e.value)}null!==this.data&&(null!==(t=this.diagram)&&t.partManager.removeDataForLink(this))},wc.prototype.updateRelationshipsFromData=function(){if(null!==this.data){var t=this.diagram;null!==t&&t.partManager.updateRelationshipsFromData(this)}},wc.prototype.move=function(t,e){var i=e?this.location:this.position,n=i.x;isNaN(n)&&(n=0);var o=i.y;for(isNaN(o)&&(o=0),n=t.x-n,o=t.y-o,!0===e?ku.prototype.move.call(this,t,!1):(t=pt.allocAt(i.x+n,i.y+o),ku.prototype.move.call(this,t,!1),pt.free(t)),Mc(this,n,o),t=this.labelNodes;t.next();)i=(e=t.value).position,e.moveTo(i.x+n,i.y+o)},wc.prototype.canRelinkFrom=function(){if(!this.relinkableFrom)return!1;var t=this.layer;return null===t||!!t.allowRelink&&!(null!==(t=t.diagram)&&!t.allowRelink)},wc.prototype.canRelinkTo=function(){if(!this.relinkableTo)return!1;var t=this.layer;return null===t||!!t.allowRelink&&!(null!==(t=t.diagram)&&!t.allowRelink)},wc.prototype.computeMidPoint=function(t){var e=this.pointsCount;if(0===e)return t.assign(st),t;if(1===e)return t.assign(this.i(0)),t;if(2===e){var i=this.i(0),n=this.i(1);return t.h((i.x+n.x)/2,(i.y+n.y)/2),t}if(this.isOrthogonal&&(15<=this.computeCorner()||this.computeCurve()===_c))return this.ua.Pu(.5,t),t.add(this.i(0)),i=this.ua.figures.first(),t.offset(-i.startX,-i.startY),t;if(this.computeCurve()===_c){if(3===e){i=this.i(0),n=this.i(1);var o=this.i(2);return Ye.ax(i.x,i.y,n.x,n.y,n.x,n.y,o.x,o.y,t),t}if(i=3*((n=(e-1)/3|0)/2|0),1==n%2){n=this.i(i),o=this.i(i+1);var r=this.i(i+2);i=this.i(i+3),Ye.ax(n.x,n.y,o.x,o.y,r.x,r.y,i.x,i.y,t)}else t.assign(this.i(i));return t}var s=this.flattenedLengths;for(i=this.flattenedTotalLength,o=r=n=0;n<i/2&&r<e&&!(n+(o=s[r])>i/2);)n+=o,r++;return e=this.i(r),r=this.i(r+1),1>Math.abs(e.x-r.x)?e.y>r.y?t.h(e.x,e.y-(i/2-n)):t.h(e.x,e.y+(i/2-n)):1>Math.abs(e.y-r.y)?e.x>r.x?t.h(e.x-(i/2-n),e.y):t.h(e.x+(i/2-n),e.y):(i=(i/2-n)/o,t.h(e.x+i*(r.x-e.x),e.y+i*(r.y-e.y))),t},wc.prototype.computeMidAngle=function(){var t=this.pointsCount;if(2>t)return NaN;if(2===t)return this.i(0).ab(this.i(1));if(this.isOrthogonal&&(15<=this.computeCorner()||this.computeCurve()===_c))return this.ua.wx(.5);if(this.computeCurve()===_c&&4<=t){var e=(t-1)/3|0,i=3*(e/2|0);if(1==e%2){i=Math.floor(i),t=this.i(i),e=this.i(i+1);var n=this.i(i+2);return i=this.i(i+3),Ye.My(t.x,t.y,e.x,e.y,n.x,n.y,i.x,i.y)}if(0<i&&i+1<t)return this.i(i-1).ab(this.i(i+1))}e=this.flattenedLengths,n=this.flattenedTotalLength;var o,r=0;for(i=0;r<n/2&&i<t&&!(r+(o=e[i])>n/2);)r+=o,i++;if(e=this.i(i),n=this.i(i+1),1>Math.abs(e.x-n.x)&&1>Math.abs(e.y-n.y)){if(0<i&&i+2<t)return this.i(i-1).ab(this.i(i+2))}else{if(1>Math.abs(e.x-n.x))return e.y>n.y?270:90;if(1>Math.abs(e.y-n.y))return e.x>n.x?180:0}return e.ab(n)},(e=wc.prototype).i=function(t){return this.Nb.s[t]},e.dd=function(t,e){this.Nb.cd(t,e)},e.L=function(t,e,i){this.Nb.cd(t,new pt(e,i))},e.Kz=function(t,e){this.Nb.Gb(t,e)},e.m=function(t,e,i){this.Nb.Gb(t,new pt(e,i))},e.ne=function(t){this.Nb.add(t)},e.yf=function(t,e){this.Nb.add(new pt(t,e))},e.pv=function(t){this.Nb.mb(t)},e.Fj=function(){this.Nb.clear()},e.uh=function(){null===this.Mg&&(this.Mg=this.Nb,this.Nb=this.Nb.copy())},e.zf=function(){if(null!==this.Mg){for(var t=this.Mg,e=this.Nb,i=1/0,n=1/0,o=t.s,r=o.length,s=0;s<r;s++){var a=o[s];i=Math.min(a.x,i),n=Math.min(a.y,n)}a=s=1/0;for(var h=e.s,l=h.length,u=0;u<l;u++){var c=h[u];s=Math.min(c.x,s),a=Math.min(c.y,a),c.freeze()}if(e.freeze(),l===r){for(r=0;r<l;r++)if(u=o[r],c=h[r],u.x-i!=c.x-s||u.y-n!=c.y-a){this.qc();break}}else this.qc();this.Mg=null,null!==(i=this.diagram)&&i.animationManager.zb&&Qn(i.animationManager,this,e),Cc(this),this.g("points",t,e)}},e.rv=function(){null!==this.Mg&&(this.Nb=this.Mg,this.Mg=null)},e.bb=function(){if(!this.suspendsRouting){var t=this.diagram;if(t){if(t.As.contains(this)||t.undoManager.isUndoingRedoing)return;if((t=t.animationManager).isTicking&&!t.isAnimating)return;null===this.Tg||t.isTicking||(this.Tg=null)}null!==(t=this.path)&&(this.fd=!1,this.v(),t.v())}},e.vg=function(){if(!this.fd&&!this.computingPoints){var t=!0;try{this.computingPoints=!0,this.uh(),t=this.computePoints()}catch(t){this.computingPoints=!1,this.rv()}finally{this.computingPoints=!1,t?this.zf():this.rv()}}},wc.prototype.computePoints=function(){if(null===this.diagram)return!1;var t=this.fromNode,e=null;if(null===t?(Hc||((Hc=new _u).desiredSize=kt,Hc.Va()),this.defaultFromPoint&&(Hc.location=this.defaultFromPoint,Hc.Va(),e=t=Hc)):e=this.fromPort,null!==e&&!t.isVisible()){var i=t.findVisibleNode();null!==i&&i!==t?(t=i,e=i.port):t=i}if(this.Lw=t,null===t||!t.location.w())return!1;for(;!(null===e||e.actualBounds.w()&&e.Ed());)e=e.panel;if(null===e)return!1;var n=this.toNode,o=null;if(null===n?(Yc||((Yc=new _u).desiredSize=kt,Yc.Va()),this.defaultToPoint&&(Yc.location=this.defaultToPoint,Yc.Va(),o=n=Yc)):o=this.toPort,null===o||n.isVisible()||(null!==(i=n.findVisibleNode())&&i!==n?(n=i,o=i.port):n=i),this.Mw=n,null===n||!n.location.w())return!1;for(;!(null===o||o.actualBounds.w()&&o.Ed());)o=o.panel;if(null===o)return!1;var r=this.pointsCount,s=this.computeSpot(!0,e);i=this.computeSpot(!1,o);var a=Nc(s),h=Nc(i),l=e===o&&null!==e,u=this.isOrthogonal,c=this.curve===_c;this.Wf=!(!l||u)&&(c=!0);var d=this.computeAdjusting()===Kc||l;if(!u&&!l&&a&&h){if(a=!1,!d&&3<=r&&(d=this.getLinkPoint(t,e,s,!0,!1,n,o),h=this.getLinkPoint(n,o,i,!1,!1,t,e),a=this.adjustPoints(0,d,r-1,h))&&(d=this.getLinkPoint(t,e,s,!0,!1,n,o),h=this.getLinkPoint(n,o,i,!1,!1,t,e),this.adjustPoints(0,d,r-1,h)),!a)if(this.Fj(),c){r=this.getLinkPoint(t,e,s,!0,!1,n,o),a=(d=this.getLinkPoint(n,o,i,!1,!1,t,e)).x-r.x,h=d.y-r.y,l=this.computeCurviness(),c=u=0;var f=r.x+a/3,p=r.y+h/3,g=f,m=p;Ye.B(h,0)?m=0<a?m-l:m+l:(u=-a/h,c=Math.sqrt(l*l/(u*u+1)),0>l&&(c=-c),m=u*((g=(0>h?-1:1)*c+f)-f)+p);var y=f=r.x+2*a/3,v=p=r.y+2*h/3;Ye.B(h,0)?v=0<a?v-l:v+l:v=u*((y=(0>h?-1:1)*c+f)-f)+p,this.Fj(),this.ne(r),this.yf(g,m),this.yf(y,v),this.ne(d),this.dd(0,this.getLinkPoint(t,e,s,!0,!1,n,o)),this.dd(3,this.getLinkPoint(n,o,i,!1,!1,t,e))}else r=n,d=o,n=this.getLinkPoint(t,e,s,!0,!1,r,d),o=this.getLinkPoint(r,d,i,!1,!1,t,e),this.hasCurviness()?(d=o.x-n.x,i=o.y-n.y,s=this.computeCurviness(),r=t=n.x+d/2,a=e=n.y+i/2,Ye.B(i,0)?a=0<d?a-s:a+s:(d=-d/i,r=Math.sqrt(s*s/(d*d+1)),0>s&&(r=-r),a=d*((r=(0>i?-1:1)*r+t)-t)+e),this.ne(n),this.yf(r,a),this.ne(o)):(this.ne(n),this.ne(o),a=jt.alloc(),e.mi(a),h=a.ca(o),d.mi(a),l=a.ca(n),(h||l)&&(s=e.ga(Lc(s),new pt),this.dd(0,this.getLinkPointFromPoint(t,e,s,o,!0,s)),i=d.ga(Lc(i),new pt),this.dd(1,this.getLinkPointFromPoint(r,d,i,n,!1,i))),jt.free(a))}else{c=this.isAvoiding,d&&(u&&c||l)&&this.Fj();var x=l?this.computeCurviness():0;c=this.getLinkPoint(t,e,s,!0,u,n,o),f=g=p=0,(u||!a||l)&&(m=this.computeEndSegmentLength(t,e,s,!0),f=this.getLinkDirection(t,e,c,s,!0,u,n,o),l&&(a||s.D(i)||!u&&1===s.x+i.x&&1===s.y+i.y)&&(f-=u?90:30,0>x&&(f-=180)),0>f?f+=360:360<=f&&(f-=360),l&&(m+=Math.abs(x)*(u?1:2)),0===f?p=m:90===f?g=m:180===f?p=-m:270===f?g=-m:(p=m*Math.cos(f*Math.PI/180),g=m*Math.sin(f*Math.PI/180)),s.Mc()&&l&&(m=e.ga(oe,pt.alloc()),y=pt.allocAt(m.x+1e3*p,m.y+1e3*g),this.getLinkPointFromPoint(t,e,m,y,!0,c),pt.free(m),pt.free(y))),m=this.getLinkPoint(n,o,i,!1,u,t,e);var b=v=y=0;if(u||!h||l){var w=this.computeEndSegmentLength(n,o,i,!1);b=this.getLinkDirection(n,o,m,i,!1,u,t,e),l&&(h||s.D(i)||!u&&1===s.x+i.x&&1===s.y+i.y)&&(b+=u?0:30,0>x&&(b+=180)),0>b?b+=360:360<=b&&(b-=360),l&&(w+=Math.abs(x)*(u?1:2)),0===b?y=w:90===b?v=w:180===b?y=-w:270===b?v=-w:(y=w*Math.cos(b*Math.PI/180),v=w*Math.sin(b*Math.PI/180)),i.Mc()&&l&&(i=o.ga(oe,pt.alloc()),s=pt.allocAt(i.x+1e3*y,i.y+1e3*v),this.getLinkPointFromPoint(n,o,i,s,!1,m),pt.free(i),pt.free(s))}i=c,(u||!a||l)&&(i=new pt(c.x+p,c.y+g)),s=m,(u||!h||l)&&(s=new pt(m.x+y,m.y+v)),!d&&!u&&a&&3<r&&this.adjustPoints(0,c,r-2,s)?this.dd(r-1,m):!d&&!u&&h&&3<r&&this.adjustPoints(1,i,r-1,m)?this.dd(0,c):!d&&(u?6<=r:4<r)&&this.adjustPoints(1,i,r-2,s)?(this.dd(0,c),this.dd(r-1,m)):(this.Fj(),this.ne(c),(u||!a||l)&&this.ne(i),u&&this.addOrthoPoints(i,f,s,b,t,n),(u||!h||l)&&this.ne(s),this.ne(m))}return!0},wc.prototype.getLinkPointFromPoint=function(t,e,i,n,o,r){if(void 0===r&&(r=new pt),null===t||null===e)return r.assign(i),r;if(t.isVisible()||null!==(o=t.findVisibleNode())&&o!==t&&(e=o.port),t=null,null===(o=e.panel)||o.se()||(o=o.panel),null===o){o=n.x,n=n.y;var s=i.x;i=i.y}else{o=1/((t=o.oe).m11*t.m22-t.m12*t.m21),s=t.m22*o;var a=-t.m12*o,h=-t.m21*o,l=t.m11*o,u=o*(t.m21*t.dy-t.m22*t.dx),c=o*(t.m12*t.dx-t.m11*t.dy);o=n.x*s+n.y*h+u,n=n.x*a+n.y*l+c,s=i.x*s+i.y*h+u,i=i.x*a+i.y*l+c}return e.Sj(o,n,s,i,r),null!==t&&r.transform(t),r},wc.prototype.getLinkPoint=function(t,e,i,n,o,r,s,a){if(void 0===a&&(a=new pt),i.sb()&&!Nc(i))return e.ga(i,a),a;if(i.$c()){var h=Tc(this,e);if(null!==h){if(a.assign(h.Zo),o&&this.routing===Wc){var l=Tc(this,s);if(null!==l&&h.Gl<l.Gl){h=pt.alloc(),l=pt.alloc();var u=new jt(e.ga(te,h),e.ga(he,l)),c=this.computeSpot(!n,s);t=this.getLinkPoint(r,s,c,!n,o,t,e,l),(i.Hf(ue)||i.Hf(ce))&&t.y>=u.y&&t.y<=u.y+u.height?a.y=t.y:(i.Hf(le)||i.Hf(de))&&t.x>=u.x&&t.x<=u.x+u.width&&(a.x=t.x),pt.free(h),pt.free(l)}}return a}}return i=e.ga(Lc(i),pt.alloc()),this.pointsCount>(o?6:2)?(s=n?this.i(1):this.i(this.pointsCount-2),o&&(s=Pc(i,s.copy()))):(h=this.computeSpot(!n,s),r=pt.alloc(),s=s.ga(Lc(h),r),o&&(s=Pc(i,s)),pt.free(r)),this.getLinkPointFromPoint(t,e,i,s,n,a),pt.free(i),a},wc.prototype.getLinkDirection=function(t,e,i,n,o,r,s,a){t:if(n.sb())var h=n.x>n.y?n.x>1-n.y?0:n.x<1-n.y?270:315:n.x<n.y?n.x>1-n.y?90:n.x<1-n.y?180:135:.5>n.x?225:.5<n.x?45:0;else{if(n.$c()&&null!==(h=Tc(this,e)))switch(h.Nc){case 1:h=270;break t;case 2:h=180;break t;default:case 4:h=0;break t;case 8:h=90;break t}h=e.ga(oe,pt.alloc()),this.pointsCount>(r?6:2)?(a=o?this.i(1):this.i(this.pointsCount-2),a=r?Pc(h,a.copy()):i):(i=pt.alloc(),a=a.ga(oe,i),pt.free(i)),i=Math.abs(a.x-h.x)>Math.abs(a.y-h.y)?a.x>=h.x?0:180:a.y>=h.y?90:270,pt.free(h),h=i}return n.Mc()&&s.Td(t)&&(360<=(h+=180)&&(h-=360)),Nc(n)||0===(t=e.li())||(45<=t&&135>t?h+=90:135<=t&&225>t?h+=180:225<=t&&315>t&&(h+=270),360<=h&&(h-=360)),h},wc.prototype.computeEndSegmentLength=function(t,e,i,n){return null!==e&&i.$c()&&null!==(t=Tc(this,e))?t.Ju:(t=n?this.fromEndSegmentLength:this.toEndSegmentLength,null!==e&&isNaN(t)&&(t=n?e.fromEndSegmentLength:e.toEndSegmentLength),isNaN(t)&&(t=10),t)},wc.prototype.computeSpot=function(t,e){return void 0===e&&(e=null),t?null===(t=e||this.fromPort)?t=oe:((e=this.fromSpot).Xb()&&(e=t.fromSpot),t=e===Me?Qt:e):null===(t=e||this.toPort)?t=oe:((e=this.toSpot).Xb()&&(e=t.toSpot),t=e===Me?Qt:e),t},wc.prototype.computeOtherPoint=function(t,e){return this.computeAdjusting()!==Kc&&4<this.pointsCount?this.computeMidPoint(new pt):null!==(t=null!==(t=e.Zn)?Ld(t,this):null)?t.Zo:e.ga(oe)},wc.prototype.computeShortLength=function(t){if(t){if(t=this.fromShortLength,isNaN(t)){var e=this.fromPort;null!==e&&(t=e.fromShortLength)}return isNaN(t)?0:t}return t=this.toShortLength,isNaN(t)&&(null!==(e=this.toPort)&&(t=e.toShortLength)),isNaN(t)?0:t},wc.prototype.Cf=function(t,e,i,n,o,r){if(!1===this.pickable)return!1;void 0===e&&(e=null),void 0===i&&(i=null);var s=r;if(void 0===r&&(s=Ge.alloc()).reset(),s.multiply(this.transform),this.fh(t,s))return Gh(this,e,i,o),void 0===r&&Ge.free(s),!0;if(this.Yc(t,s)){var a=!1;if(!this.isAtomic)for(var h=this.O.s,l=h.length;l--;){var u=h[l];if(u.visible||u===this.locationObject){var c=u.actualBounds,d=this.naturalBounds;if(!(c.x>d.width||c.y>d.height||0>c.x+c.width||0>c.y+c.height)){if((c=Ge.alloc()).set(s),u instanceof Th)a=u.Cf(t,e,i,n,o,c);else if(this.path===u){if(u instanceof pl)if(a=t,d=n,!1===u.pickable)a=!1;else if(c.multiply(u.transform),d)t:{var f=a,p=c;if(u.fh(f,p))a=!0;else{if(void 0===p&&(p=u.transform,f.Re(u.actualBounds))){a=!0;break t}a=f.left,d=f.right;var g=f.top;f=f.bottom;var m=pt.alloc(),y=pt.alloc(),v=pt.alloc(),x=Ge.alloc();x.set(p),x.bv(u.transform),x.Vj(),y.x=d,y.y=g,y.transform(x),m.x=a,m.y=g,m.transform(x),p=!1,bl(u,m,y,v)?p=!0:(m.x=d,m.y=f,m.transform(x),bl(u,m,y,v)?p=!0:(y.x=a,y.y=f,y.transform(x),bl(u,m,y,v)?p=!0:(m.x=a,m.y=g,m.transform(x),bl(u,m,y,v)&&(p=!0)))),Ge.free(x),pt.free(m),pt.free(y),pt.free(v),a=p}}else a=u.fh(a,c)}else a=Os(u,t,n,c);a&&(d=u,null!==e&&(d=e(u)),d&&(null===i||i(d))&&o.add(d)),Ge.free(c)}}}return void 0===r&&Ge.free(s),a||null!==this.background||null!==this.areaBackground}return void 0===r&&Ge.free(s),!1},wc.prototype.computeCurve=function(){if(null===this.Wf){var t=this.fromPort,e=this.isOrthogonal;this.Wf=null!==t&&t===this.toPort&&!e}return this.Wf?_c:this.curve},wc.prototype.computeCorner=function(){if(this.curve===_c)return 0;var t=this.corner;return(isNaN(t)||0>t)&&(t=10),t},wc.prototype.findMidLabel=function(){for(var t=this.path,e=this.O.s,i=e.length,n=0;n<i;n++){var o=e[n];if(o!==t&&!o.isPanelMain&&(-1/0===o.segmentIndex||isNaN(o.segmentIndex)))return o}for(t=this.labelNodes;t.next();)if(-1/0===(e=t.value).segmentIndex||isNaN(e.segmentIndex))return e;return null},wc.prototype.computeSpacing=function(){if(!this.isVisible())return 0;var t=ud;t=Math.max(t,this.computeThickness());var e=this.fromPort,i=this.toPort;if(null!==e&&null!==i){var n=this.findMidLabel();if(null!==n){var o=n.naturalBounds,r=n.margin,s=isNaN(o.width)?30:o.width*n.scale+r.left+r.right;o=isNaN(o.height)?14:o.height*n.scale+r.top+r.bottom,(n=n.segmentOrientation)===ed||n===rd||n===od?t=Math.max(t,o):n===nd||n===ad||n===id||n===sd?t=Math.max(t,s):(e=e.ga(oe).ab(i.ga(oe))/180*Math.PI,t=Math.max(t,Math.abs(Math.sin(e)*s)+Math.abs(Math.cos(e)*o)+1)),this.curve===_c&&(t*=1.333)}}return t},wc.prototype.arrangeBundledLinks=function(t,e){if(e)for(e=0;e<t.length;e++){var i=t[e];i.computeAdjusting()===Kc&&i.bb()}},wc.prototype.computeCurviness=function(){var t=this.curviness;if(isNaN(t)){t=ld;var e=this.Sf;if(null!==e){for(var i=A(),n=0,o=e.links,r=0;r<o.length;r++){var s=o[r].computeSpacing();i.push(s),n+=s}for(n=-n/2,r=0;r<o.length;r++){if(o[r]===this){t=n+i[r]/2;break}n+=i[r]}e.Ds===this.fromNode&&(t=-t),B(i)}}return t},wc.prototype.computeThickness=function(){if(!this.isVisible())return 0;var t=this.path;return null!==t?Math.max(t.strokeWidth,1):1},wc.prototype.hasCurviness=function(){return!isNaN(this.curviness)||null!==this.Sf},wc.prototype.adjustPoints=function(t,e,i,n){var o=this.computeAdjusting();if(this.isOrthogonal){if(o===Qc)return!1;o===td&&(o=Zc)}switch(o){case Qc:var r=this.i(t),s=this.i(i);if(!r.Xa(e)||!s.Xa(n)){o=r.x,r=r.y;var a=s.x-o,h=s.y-r,l=Math.sqrt(a*a+h*h);if(!Ye.$(l,0)){if(Ye.$(a,0))var u=0>h?-Math.PI/2:Math.PI/2;else u=Math.atan(h/Math.abs(a)),0>a&&(u=Math.PI-u);s=e.x;var c=e.y;a=n.x-s;var d=n.y-c;for(h=Math.sqrt(a*a+d*d),Ye.$(a,0)?d=0>d?-Math.PI/2:Math.PI/2:(d=Math.atan(d/Math.abs(a)),0>a&&(d=Math.PI-d)),l=h/l,u=d-u,this.dd(t,e),t+=1;t<i;t++)a=(e=this.i(t)).x-o,h=e.y-r,e=Math.sqrt(a*a+h*h),Ye.$(e,0)||(Ye.$(a,0)?h=0>h?-Math.PI/2:Math.PI/2:(h=Math.atan(h/Math.abs(a)),0>a&&(h=Math.PI-h)),a=h+u,e*=l,this.L(t,s+e*Math.cos(a),c+e*Math.sin(a)));this.dd(i,n)}}return!0;case td:if(r=this.i(t),c=this.i(i),!r.Xa(e)||!c.Xa(n)){o=r.x,r=r.y,l=((s=c.x)-o)*(s-o)+((c=c.y)-r)*(c-r),a=e.x,u=e.y,h=n.x,d=n.y;var f=1;if(0!=h-a){var p=(d-u)/(h-a);f=Math.sqrt(1+1/(p*p))}else p=9e9;for(this.dd(t,e),t+=1;t<i;t++){var g=(e=this.i(t)).x,m=e.y,y=.5;0!==l&&(y=((o-g)*(o-s)+(r-m)*(r-c))/l);var v=o+y*(s-o),x=r+y*(c-r);e=Math.sqrt((g-v)*(g-v)+(m-x)*(m-x)),m<p*(g-v)+x&&(e=-e),0<p&&(e=-e),g=a+y*(h-a),y=u+y*(d-u),0!==p?(e=g+e/f,this.L(t,e,y-(e-g)/p)):this.L(t,g,y+e)}this.dd(i,n)}return!0;case Zc:return this.isOrthogonal&&(o=this.i(t),r=this.i(t+1),s=this.i(t+2),c=a=r.x,l=u=r.y,Ye.B(o.y,r.y)?Ye.B(r.x,s.x)?u=e.y:Ye.B(r.y,s.y)&&(a=e.x):Ye.B(o.x,r.x)&&(Ye.B(r.y,s.y)?a=e.x:Ye.B(r.x,s.x)&&(u=e.y)),this.L(t+1,a,u),o=this.i(i),r=this.i(i-1),s=this.i(i-2),h=a=r.x,d=u=r.y,Ye.B(o.y,r.y)?Ye.B(r.x,s.x)?u=n.y:Ye.B(r.y,s.y)&&(a=n.x):Ye.B(o.x,r.x)&&(Ye.B(r.y,s.y)?a=n.x:Ye.B(r.x,s.x)&&(u=n.y)),this.L(i-1,a,u),Ac(this))?(this.L(t+1,c,l),this.L(i-1,h,d),i=!1):(this.dd(t,e),this.dd(i,n),i=!0),i;default:return!1}},wc.prototype.addOrthoPoints=function(t,e,i,n,o,r){0>e?e+=360:360<=e&&(e-=360),0>n?n+=360:360<=n&&(n-=360);var s=n;e=315<=e||45>e?0:45<=e&&135>e?90:135<=e&&225>e?180:270,n=315<=n||45>n?0:45<=n&&135>n?90:135<=n&&225>n?180:270;var a=o.actualBounds.copy(),h=r.actualBounds.copy();if(a.w()&&h.w()){a.Bc(cd,cd),h.Bc(cd,cd),a.Ye(t),h.Ye(i);var l=pt.alloc(),u=pt.alloc();0===e?i.x>t.x||270===n&&i.y<t.y&&h.right>t.x||90===n&&i.y>t.y&&h.right>t.x?(l.h(i.x,t.y),u.h(i.x,(t.y+i.y)/2),180===n?(l.x=this.computeMidOrthoPosition(t.x,t.y,i.x,i.y,!1),u.x=l.x,u.y=i.y):270===n&&i.y<t.y||90===n&&i.y>t.y?(l.x=t.x<h.left?this.computeMidOrthoPosition(t.x,t.y,h.left,i.y,!1):t.x<h.right&&(270===n&&t.y<h.top||90===n&&t.y>h.bottom)?this.computeMidOrthoPosition(t.x,t.y,i.x,i.y,!1):h.right,u.x=l.x,u.y=i.y):0===n&&t.x<h.left&&t.y>h.top&&t.y<h.bottom&&(l.x=t.x,l.y=t.y<i.y?Math.min(i.y,h.top):Math.max(i.y,h.bottom),u.y=l.y)):(l.h(t.x,i.y),u.h((t.x+i.x)/2,i.y),(180===n||90===n&&i.y<a.top||270===n&&i.y>a.bottom)&&(180===n&&(h.ca(t)||a.ca(i))?l.y=this.computeMidOrthoPosition(t.x,t.y,i.x,i.y,!0):i.y<t.y&&(180===n||90===n)?l.y=this.computeMidOrthoPosition(t.x,a.top,i.x,Math.max(i.y,h.bottom),!0):i.y>t.y&&(180===n||270===n)&&(l.y=this.computeMidOrthoPosition(t.x,a.bottom,i.x,Math.min(i.y,h.top),!0)),u.x=i.x,u.y=l.y),l.y>a.top&&l.y<a.bottom&&(i.x>=a.left&&i.x<=t.x||t.x<=h.right&&t.x>=i.x?90!==n&&270!==n||(l.h(Math.max((t.x+i.x)/2,t.x),t.y),u.h(l.x,i.y)):(l.y=270===n||(0===n||180===n)&&i.y<t.y?Math.min(i.y,0===n?a.top:Math.min(a.top,h.top)):Math.max(i.y,0===n?a.bottom:Math.max(a.bottom,h.bottom)),u.x=i.x,u.y=l.y))):180===e?i.x<t.x||270===n&&i.y<t.y&&h.left<t.x||90===n&&i.y>t.y&&h.left<t.x?(l.h(i.x,t.y),u.h(i.x,(t.y+i.y)/2),0===n?(l.x=this.computeMidOrthoPosition(t.x,t.y,i.x,i.y,!1),u.x=l.x,u.y=i.y):270===n&&i.y<t.y||90===n&&i.y>t.y?(l.x=t.x>h.right?this.computeMidOrthoPosition(t.x,t.y,h.right,i.y,!1):t.x>h.left&&(270===n&&t.y<h.top||90===n&&t.y>h.bottom)?this.computeMidOrthoPosition(t.x,t.y,i.x,i.y,!1):h.left,u.x=l.x,u.y=i.y):180===n&&t.x>h.right&&t.y>h.top&&t.y<h.bottom&&(l.x=t.x,l.y=t.y<i.y?Math.min(i.y,h.top):Math.max(i.y,h.bottom),u.y=l.y)):(l.h(t.x,i.y),u.h((t.x+i.x)/2,i.y),(0===n||90===n&&i.y<a.top||270===n&&i.y>a.bottom)&&(0===n&&(h.ca(t)||a.ca(i))?l.y=this.computeMidOrthoPosition(t.x,t.y,i.x,i.y,!0):i.y<t.y&&(0===n||90===n)?l.y=this.computeMidOrthoPosition(t.x,a.top,i.x,Math.max(i.y,h.bottom),!0):i.y>t.y&&(0===n||270===n)&&(l.y=this.computeMidOrthoPosition(t.x,a.bottom,i.x,Math.min(i.y,h.top),!0)),u.x=i.x,u.y=l.y),l.y>a.top&&l.y<a.bottom&&(i.x<=a.right&&i.x>=t.x||t.x>=h.left&&t.x<=i.x?90!==n&&270!==n||(l.h(Math.min((t.x+i.x)/2,t.x),t.y),u.h(l.x,i.y)):(l.y=270===n||(0===n||180===n)&&i.y<t.y?Math.min(i.y,180===n?a.top:Math.min(a.top,h.top)):Math.max(i.y,180===n?a.bottom:Math.max(a.bottom,h.bottom)),u.x=i.x,u.y=l.y))):90===e?i.y>t.y||180===n&&i.x<t.x&&h.bottom>t.y||0===n&&i.x>t.x&&h.bottom>t.y?(l.h(t.x,i.y),u.h((t.x+i.x)/2,i.y),270===n?(l.y=this.computeMidOrthoPosition(t.x,t.y,i.x,i.y,!0),u.x=i.x,u.y=l.y):180===n&&i.x<t.x||0===n&&i.x>t.x?(l.y=t.y<h.top?this.computeMidOrthoPosition(t.x,t.y,i.x,h.top,!0):t.y<h.bottom&&(180===n&&t.x<h.left||0===n&&t.x>h.right)?this.computeMidOrthoPosition(t.x,t.y,i.x,i.y,!0):h.bottom,u.x=i.x,u.y=l.y):90===n&&t.y<h.top&&t.x>h.left&&t.x<h.right&&(l.x=t.x<i.x?Math.min(i.x,h.left):Math.max(i.x,h.right),l.y=t.y,u.x=l.x)):(l.h(i.x,t.y),u.h(i.x,(t.y+i.y)/2),(270===n||0===n&&i.x<a.left||180===n&&i.x>a.right)&&(270===n&&(h.ca(t)||a.ca(i))?l.x=this.computeMidOrthoPosition(t.x,t.y,i.x,i.y,!1):i.x<t.x&&(270===n||0===n)?l.x=this.computeMidOrthoPosition(a.left,t.y,Math.max(i.x,h.right),i.y,!1):i.x>t.x&&(270===n||180===n)&&(l.x=this.computeMidOrthoPosition(a.right,t.y,Math.min(i.x,h.left),i.y,!1)),u.x=l.x,u.y=i.y),l.x>a.left&&l.x<a.right&&(i.y>=a.top&&i.y<=t.y||t.y<=h.bottom&&t.y>=i.y?0!==n&&180!==n||(l.h(t.x,Math.max((t.y+i.y)/2,t.y)),u.h(i.x,l.y)):(l.x=180===n||(90===n||270===n)&&i.x<t.x?Math.min(i.x,90===n?a.left:Math.min(a.left,h.left)):Math.max(i.x,90===n?a.right:Math.max(a.right,h.right)),u.x=l.x,u.y=i.y))):i.y<t.y||180===n&&i.x<t.x&&h.top<t.y||0===n&&i.x>t.x&&h.top<t.y?(l.h(t.x,i.y),u.h((t.x+i.x)/2,i.y),90===n?(l.y=this.computeMidOrthoPosition(t.x,t.y,i.x,i.y,!0),u.x=i.x,u.y=l.y):180===n&&i.x<t.x||0===n&&i.x>=t.x?(l.y=t.y>h.bottom?this.computeMidOrthoPosition(t.x,t.y,i.x,h.bottom,!0):t.y>h.top&&(180===n&&t.x<h.left||0===n&&t.x>h.right)?this.computeMidOrthoPosition(t.x,t.y,i.x,i.y,!0):h.top,u.x=i.x,u.y=l.y):270===n&&t.y>h.bottom&&t.x>h.left&&t.x<h.right&&(l.x=t.x<i.x?Math.min(i.x,h.left):Math.max(i.x,h.right),l.y=t.y,u.x=l.x)):(l.h(i.x,t.y),u.h(i.x,(t.y+i.y)/2),(90===n||0===n&&i.x<a.left||180===n&&i.x>a.right)&&(90===n&&(h.ca(t)||a.ca(i))?l.x=this.computeMidOrthoPosition(t.x,t.y,i.x,i.y,!1):i.x<t.x&&(90===n||0===n)?l.x=this.computeMidOrthoPosition(a.left,t.y,Math.max(i.x,h.right),i.y,!1):i.x>t.x&&(90===n||180===n)&&(l.x=this.computeMidOrthoPosition(a.right,t.y,Math.min(i.x,h.left),i.y,!1)),u.x=l.x,u.y=i.y),l.x>a.left&&l.x<a.right&&(i.y<=a.bottom&&i.y>=t.y||t.y>=h.top&&t.y<=i.y?0!==n&&180!==n||(l.h(t.x,Math.min((t.y+i.y)/2,t.y)),u.h(i.x,l.y)):(l.x=180===n||(90===n||270===n)&&i.x<t.x?Math.min(i.x,270===n?a.left:Math.min(a.left,h.left)):Math.max(i.x,270===n?a.right:Math.max(a.right,h.right)),u.x=l.x,u.y=i.y)));var c=i;if(this.isAvoiding){var d=this.diagram;if(null===d||o===r||this.layer.isTemporary||!Ar(d)||a.ca(c)&&!r.Td(o)||h.ca(t)&&!o.Td(r))e=!1;else{var f=Br(d,!0,this.containingGroup,null);if(17!==this.segmentIndex&&f.Yj(Math.min(t.x,l.x),Math.min(t.y,l.y),Math.abs(t.x-l.x),Math.abs(t.y-l.y))&&f.Yj(Math.min(l.x,u.x),Math.min(l.y,u.y),Math.abs(l.x-u.x),Math.abs(l.y-u.y))&&f.Yj(Math.min(u.x,c.x),Math.min(u.y,c.y),Math.abs(u.x-c.x),Math.abs(u.y-c.y)))e=!1;else{o=t,r=c;var p=i=null;if(d.isVirtualized){(d=f.bounds.copy()).Bc(-f.Ho,-f.Go);var g=pt.alloc();pd(f,t.x,t.y)||(Ye.Ff(d.x,d.y,d.x+d.width,d.y+d.height,t.x,t.y,l.x,l.y,g)?(i=t=g.copy(),e=g.ab(l)):Ye.Ff(d.x,d.y,d.x+d.width,d.y+d.height,l.x,l.y,u.x,u.y,g)?(i=t=g.copy(),e=g.ab(u)):Ye.Ff(d.x,d.y,d.x+d.width,d.y+d.height,u.x,u.y,c.x,c.y,g)&&(i=t=g.copy(),e=g.ab(c))),pd(f,c.x,c.y)||(Ye.Ff(d.x,d.y,d.x+d.width,d.y+d.height,c.x,c.y,u.x,u.y,g)?(p=c=g.copy(),n=u.ab(g)):Ye.Ff(d.x,d.y,d.x+d.width,d.y+d.height,u.x,u.y,l.x,l.y,g)?(p=c=g.copy(),n=l.ab(g)):Ye.Ff(d.x,d.y,d.x+d.width,d.y+d.height,l.x,l.y,t.x,t.y,g)&&(p=c=g.copy(),n=t.ab(g))),pt.free(g)}(a=a.copy().ed(h)).Bc(f.Ho*f.Os,f.Go*f.Os),bd(f,t,e,c,n,a,!0),h=gd(f,c.x,c.y),!f.abort&&h>=Md&&(md(f),a.Bc(f.Ho*f.Hx,f.Go*f.Ix),bd(f,t,e,c,n,a,!1),h=gd(f,c.x,c.y)),!f.abort&&h<Md&&gd(f,c.x,c.y)!==kd?(Bc(this,f,c.x,c.y,n,!0,s),a=this.i(2),4>this.pointsCount?(0===e||180===e?(a.x=t.x,a.y=c.y):(a.x=c.x,a.y=t.y),this.L(2,a.x,a.y),this.m(3,a.x,a.y)):(s=this.i(3),0===e||180===e?Ye.B(a.x,s.x)?(a=0===e?Math.max(a.x,t.x):Math.min(a.x,t.x),this.L(2,a,t.y),this.L(3,a,s.y)):Ye.B(a.y,s.y)?(Math.abs(t.y-a.y)<=f.Go/2&&(this.L(2,a.x,t.y),this.L(3,s.x,t.y)),this.m(2,a.x,t.y)):this.L(2,t.x,a.y):90!==e&&270!==e||(Ye.B(a.y,s.y)?(a=90===e?Math.max(a.y,t.y):Math.min(a.y,t.y),this.L(2,t.x,a),this.L(3,s.x,a)):Ye.B(a.x,s.x)?(Math.abs(t.x-a.x)<=f.Ho/2&&(this.L(2,t.x,a.y),this.L(3,t.x,s.y)),this.m(2,t.x,a.y)):this.L(2,a.x,t.y))),null!==i&&(t=this.i(1),s=this.i(2),t.x!==s.x&&t.y!==s.y?0===e||180===e?this.m(2,t.x,s.y):this.m(2,s.x,t.y):0===e||180===e?this.m(2,o.x,i.y):this.m(2,i.x,o.y)),null!==p&&(0===n||180===n?this.yf(r.x,p.y):this.yf(p.x,r.y)),e=!0):e=!1}}}else e=!1;e||(this.ne(l.copy()),this.ne(u.copy())),pt.free(l),pt.free(u)}},wc.prototype.computeMidOrthoPosition=function(t,e,i,n,o){var r=0;return!this.hasCurviness()||this.computeSpot(!0,this.fromPort).$c()||this.computeSpot(!1,this.toPort).$c()||(r=this.computeCurviness()),o?(e+n)/2+r:(t+i)/2+r},wc.prototype.ez=function(t){var e=t.x;t=t.y;for(var i=this.i(0),n=this.i(1),o=xt(e,t,i.x,i.y,n.x,n.y),r=0,s=1;s<this.pointsCount-1;s++){i=this.i(s+1);var a=xt(e,t,n.x,n.y,i.x,i.y);n=i,a<o&&(r=s,o=a)}return r},wc.prototype.qc=function(){this.lk=!1,this.v()},wc.prototype.Ul=function(t){if(!t){if(!1===this.fd)return;if(t=this.Pb(),this.lk&&(null===t||null!==t.geometry))return}if(2>this.pointsCount?this.lk=!0:this.ua=this.makeGeometry(),null!==(t=this.path)){t.ua=this.ua;for(var e=this.O.s,i=e.length,n=0;n<i;n++){var o=e[n];o!==t&&o.isPanelMain&&o instanceof pl&&(o.ua=this.ua)}}},wc.prototype.makeGeometry=function(){var t=this.ua,e=this.pointsCount,i=!1,n=this.diagram;null!==n&&Ic(this)&&n.Eh.contains(this)&&(0!==this.ml.width||0!==this.ml.height)&&(n.animationManager.isAnimating||n.currentTool!==n.toolManager)&&(i=!0);var o=this.i(0).copy(),r=o.copy();n=this.Nb.s;var s=this.computeCurve();if(s===_c&&3<=e&&!Ye.$(this.smoothness,0))if(3===e){var a=this.i(1);n=Math.min(o.x,a.x);var h=Math.min(o.y,a.y);a=this.i(2),n=Math.min(n,a.x),h=Math.min(h,a.y)}else{if(this.isOrthogonal)for(h=0;h<e;h++)a=n[h],r.x=Math.min(a.x,r.x),r.y=Math.min(a.y,r.y);else for(n=3;n<e;n+=3)n+3>=e&&(n=e-1),h=this.i(n),r.x=Math.min(h.x,r.x),r.y=Math.min(h.y,r.y);n=r.x,h=r.y}else{for(h=0;h<e;h++)a=n[h],r.x=Math.min(a.x,r.x),r.y=Math.min(a.y,r.y);n=r.x,h=r.y}if(n-=this.su.x,h-=this.su.y,o.x-=n,o.y-=h,2!==e||Ic(this)){if(t.type=Xe.o,a=vu(t),0!==this.computeShortLength(!0)&&(o=Fc(this,o,!0,r)),fu(a,o.x,o.y,!1),s===_c&&3<=e&&!Ye.$(this.smoothness,0))if(3===e)e=(i=this.i(1)).x-n,i=i.y-h,(o=this.i(2).copy()).x-=n,o.y-=h,0!==this.computeShortLength(!1)&&(o=Fc(this,o,!1,r)),gu(a,e,i,e,i,o.x,o.y);else if(this.isOrthogonal){e=pt.allocAt(n,h),(i=pt.alloc()).assign(this.i(1)),r=pt.allocAt(n,h),o=pt.allocAt(n,h),s=this.i(0);for(var l,u=this.smoothness/3,c=1;c<this.pointsCount-1;c++){var d=s,f=l=this.i(c),p=this.i(jc(this,l,c,!1));if(!(Ye.$(d.x,f.x)&&Ye.$(f.x,p.x)||Ye.$(d.y,f.y)&&Ye.$(f.y,p.y))){var g=u;isNaN(g)&&(g=this.smoothness/3);var m=d.x;d=d.y;var y=f.x;f=f.y;var v=p.x;p=p.y;var x=g*Dc(m,d,y,f);g*=Dc(y,f,v,p),Ye.$(d,f)&&Ye.$(y,v)&&(y>m?p>f?(r.x=y-x,r.y=f-x,o.x=y+g,o.y=f+g):(r.x=y-x,r.y=f+x,o.x=y+g,o.y=f-g):p>f?(r.x=y+x,r.y=f-x,o.x=y-g,o.y=f+g):(r.x=y+x,r.y=f+x,o.x=y-g,o.y=f-g)),Ye.$(m,y)&&Ye.$(f,p)&&(f>d?(v>y?(r.x=y-x,r.y=f-x,o.x=y+g):(r.x=y+x,r.y=f-x,o.x=y-g),o.y=f+g):(v>y?(r.x=y-x,r.y=f+x,o.x=y+g):(r.x=y+x,r.y=f+x,o.x=y-g),o.y=f-g)),(Ye.$(m,y)&&Ye.$(y,v)||Ye.$(d,f)&&Ye.$(f,p))&&(m=.5*(m+v),d=.5*(d+p),r.x=m,r.y=d,o.x=m,o.y=d),(1===c||2===c&&Ye.$(s.x,this.i(0).x)&&Ye.$(s.y,this.i(0).y))&&(i.x=.5*(s.x+l.x),i.y=.5*(s.y+l.y)),gu(a,i.x-n,i.y-h,r.x-n,r.y-h,l.x-n,l.y-h),e.set(r),i.set(o),s=l}}l=s.x,s=s.y,u=this.i(this.pointsCount-1),0!==this.computeShortLength(!1)&&(u=Fc(this,u.copy(),!1,it)),l=.5*(l+u.x),s=.5*(s+u.y),gu(a,o.x-n,o.y-h,l-n,s-h,u.x-n,u.y-h),pt.free(e),pt.free(i),pt.free(r),pt.free(o)}else for(i=3;i<e;i+=3)r=this.i(i-2),i+3>=e&&(i=e-1),o=this.i(i-1),s=this.i(i),i===e-1&&0!==this.computeShortLength(!1)&&(s=Fc(this,s.copy(),!1,it)),gu(a,r.x-n,r.y-h,o.x-n,o.y-h,s.x-n,s.y-h);else{for((r=pt.alloc()).assign(this.i(0)),(o=pt.alloc()).assign(r),s=this.computeCorner(),c=1,l=0;c<e;){if(c=jc(this,r,c,1<c),u=this.i(c),c>=e-1){if(r.D(u)){if(0===l)for(c=1;c<e;)o.assign(r),Ec(this,a,-n,-h,r,u=this.i(c++),i),r.assign(u)}else 0!==this.computeShortLength(!1)&&(u=Fc(this,u.copy(),!1,it)),Ec(this,a,-n,-h,r,u,i);break}if(l=jc(this,u,c+1,c<e-3),c=-n,m=-h,d=u,y=this.i(l),g=i,Ye.B(r.y,d.y)&&Ye.B(d.x,y.x))if(p=Math.min(s,Math.abs(d.x-o.x)/2),p=x=Math.min(p,Math.abs(y.y-d.y)/2),Ye.B(p,0))Ec(this,a,c,m,r,d,g),r.assign(d);else{var b=d.x,w=d.y;f=b,v=w,b=d.x>r.x?d.x-p:d.x+p,v=y.y>d.y?d.y+x:d.y-x,Ec(this,a,c,m,r,y=pt.allocAt(b,w),g),pt.free(y),mu(a,d.x+c,d.y+m,f+c,v+m),r.h(f,v)}else Ye.B(r.x,d.x)&&Ye.B(d.y,y.y)?(p=Math.min(s,Math.abs(d.y-o.y)/2),p=x=Math.min(p,Math.abs(y.x-d.x)/2),Ye.B(x,0)?(Ec(this,a,c,m,r,d,g),r.assign(d)):(f=b=d.x,v=w=d.y,w=d.y>r.y?d.y-p:d.y+p,f=y.x>d.x?d.x+x:d.x-x,Ec(this,a,c,m,r,y=pt.allocAt(b,w),g),pt.free(y),mu(a,d.x+c,d.y+m,f+c,v+m),r.h(f,v))):(Ec(this,a,c,m,r,d,g),r.assign(d));o.assign(u),c=l}pt.free(r)}xu=a}else(a=this.i(1).copy()).x-=n,a.y-=h,0!==this.computeShortLength(!0)&&(o=Fc(this,o,!0,r)),0!==this.computeShortLength(!1)&&(a=Fc(this,a,!1,r)),t.type=Xe.j,t.startX=o.x,t.startY=o.y,t.endX=a.x,t.endY=a.y;return this.lk=!0,t},wc.prototype.computeJumpLength=function(){return 10},wc.prototype.Xo=function(t){var e=this.layer;if(null!==e&&e.visible&&!e.isTemporary){var i=e.diagram;if(null!==i&&!i.animationManager.isTicking){var n=!1;for(i=i.layers;i.next();){var o=i.value;if(o.visible)if(o===e){n=!0;for(var r=!1,s=(o=o.Pa.s).length,a=0;a<s;a++){var h=o[a];h instanceof wc&&(h===this?r=!0:r&&Rc(this,h,t))}}else if(n)for(o=(r=o.Pa.s).length,s=0;s<o;s++)(a=r[s])instanceof wc&&Rc(this,a,t)}}}},wc.prototype.usesSamePort=function(t){var e=this.pointsCount,i=t.pointsCount;if(0<e&&0<i){var n=this.i(0),o=t.i(0);if(n.Xa(o))return!0;if(e=this.i(e-1),t=t.i(i-1),e.Xa(t)||n.Xa(t)||e.Xa(o))return!0}else if(this.fromNode===t.fromNode||this.toNode===t.toNode||this.fromNode===t.toNode||this.toNode===t.fromNode)return!0;return!1},wc.prototype.isVisible=function(){if(!ku.prototype.isVisible.call(this))return!1;var t=this.containingGroup,e=!0,i=this.diagram;if(null!==i&&(e=i.isTreePathToChildren),null!==(i=this.fromNode)){if(this.isTreeLink&&e&&!i.isTreeExpanded)return!1;if(i===t)return!0;for(var n=i;null!==n;){if(n.labeledLink===this)return!0;n=n.containingGroup}if(null===(i=i.findVisibleNode())||i===t)return!1}if(null!==(i=this.toNode)){if(this.isTreeLink&&!e&&!i.isTreeExpanded)return!1;if(i===t)return!0;for(e=i;null!==e;){if(e.labeledLink===this)return!0;e=e.containingGroup}if(null===(e=i.findVisibleNode())||e===t)return!1}return!0},wc.prototype.Zb=function(t){if(ku.prototype.Zb.call(this,t),t&&zc(this,!1),null!==this.Sf&&this.Sf.Sl(),null!==this.wd)for(var e=this.wd.iterator;e.next();)e.value.Zb(t)},wc.prototype.computeAdjusting=function(){return this.isAvoiding&&null!==this.diagram&&this.diagram.animationManager.defaultAnimation.isAnimating?Zc:this.qk},wc.prototype.ph=function(){return!0},d.Object.defineProperties(wc.prototype,{fromNode:{get:function(){return this.ef},set:function(t){var e=this.ef;if(e!==t){var i=this.fromPort;null!==e&&(this.uf!==e&&nc(e,this,i),Gc(this),this.C(2)),this.ef=t,null!==t&&this.Zb(t.isVisible()),this.Wf=null,this.bb();var n=this.diagram;null!==n&&n.aa&&n.partManager.setFromNodeForLink(this,t,e);var o=this.fromPort,r=this.fromPortChanged;if(null!==r){var s=!0;null!==n&&(s=n.aa,n.aa=!0),r(this,i,o),null!==n&&(n.aa=s)}null!==t&&(this.uf!==t&&ic(t,this,o),Vc(this),this.C(1)),this.g("fromNode",e,t),kc(this)}}},fromPortId:{get:function(){return this.ff},set:function(t){var e=this.ff;if(e!==t){var i=this.fromPort;null!==i&&tc(i),Gc(this),this.ff=t;var n=this.fromPort;null!==n&&tc(n);var o=this.diagram;if(null!==o){var r=this.data,s=o.model;null!==r&&s.ri()&&s.xv(r,t)}i!==n&&(this.Wf=null,this.bb(),null!==(r=this.fromPortChanged)&&(s=!0,null!==o&&(s=o.aa,o.aa=!0),r(this,i,n),null!==o&&(o.aa=s))),Vc(this),this.g("fromPortId",e,t)}}},fromPort:{get:function(){var t=this.ef;return null===t?null:t.ns(this.ff)}},fromPortChanged:{get:function(){return this.gn},set:function(t){var e=this.gn;e!==t&&(this.gn=t,this.g("fromPortChanged",e,t))}},toNode:{get:function(){return this.uf},set:function(t){var e=this.uf;if(e!==t){var i=this.toPort;null!==e&&(this.ef!==e&&nc(e,this,i),Gc(this),this.C(2)),this.uf=t,null!==t&&this.Zb(t.isVisible()),this.Wf=null,this.bb();var n=this.diagram;null!==n&&n.aa&&n.partManager.setToNodeForLink(this,t,e);var o=this.toPort,r=this.toPortChanged;if(null!==r){var s=!0;null!==n&&(s=n.aa,n.aa=!0),r(this,i,o),null!==n&&(n.aa=s)}null!==t&&(this.ef!==t&&ic(t,this,o),Vc(this),this.C(1)),this.g("toNode",e,t),kc(this)}}},toPortId:{get:function(){return this.vf},set:function(t){var e=this.vf;if(e!==t){var i=this.toPort;null!==i&&tc(i),Gc(this),this.vf=t;var n=this.toPort;null!==n&&tc(n);var o=this.diagram;if(null!==o){var r=this.data,s=o.model;null!==r&&s.ri()&&s.Cv(r,t)}i!==n&&(this.Wf=null,this.bb(),null!==(r=this.toPortChanged)&&(s=!0,null!==o&&(s=o.aa,o.aa=!0),r(this,i,n),null!==o&&(o.aa=s))),Vc(this),this.g("toPortId",e,t)}}},toPort:{get:function(){var t=this.uf;return null===t?null:t.ns(this.vf)}},toPortChanged:{get:function(){return this.uo},set:function(t){var e=this.uo;e!==t&&(this.uo=t,this.g("toPortChanged",e,t))}},fromSpot:{get:function(){return null!==this.ba?this.ba.Xi:Me},set:function(t){var e=this.fromSpot;e.D(t)||(t=t.J(),this.Xc(),this.ba.Xi=t,this.g("fromSpot",e,t),(e.$c()||t.$c())&&null!==this.fromNode&&tc(this.fromPort),this.bb())}},fromEndSegmentLength:{get:function(){return null!==this.ba?this.ba.Vi:NaN},set:function(t){var e=this.fromEndSegmentLength;e!==t&&(0>t&&S(t,">= 0",wc,"fromEndSegmentLength"),this.Xc(),this.ba.Vi=t,this.g("fromEndSegmentLength",e,t),this.bb())}},fromShortLength:{get:function(){return null!==this.ba?this.ba.Wi:NaN},set:function(t){var e=this.fromShortLength;e!==t&&(this.Xc(),this.ba.Wi=t,this.qc(),this.g("fromShortLength",e,t))}},toSpot:{get:function(){return null!==this.ba?this.ba.yj:Me},set:function(t){var e=this.toSpot;e.D(t)||(t=t.J(),this.Xc(),this.ba.yj=t,this.g("toSpot",e,t),(e.$c()||t.$c())&&null!==this.toNode&&tc(this.toPort),this.bb())}},toEndSegmentLength:{get:function(){return null!==this.ba?this.ba.wj:NaN},set:function(t){var e=this.toEndSegmentLength;e!==t&&(0>t&&S(t,">= 0",wc,"toEndSegmentLength"),this.Xc(),this.ba.wj=t,this.g("toEndSegmentLength",e,t),this.bb())}},toShortLength:{get:function(){return null!==this.ba?this.ba.xj:NaN},set:function(t){var e=this.toShortLength;e!==t&&(this.Xc(),this.ba.xj=t,this.qc(),this.g("toShortLength",e,t))}},isLabeledLink:{get:function(){return null!==this.wd&&0<this.wd.count}},labelNodes:{get:function(){return null===this.wd?q:this.wd.iterator}},relinkableFrom:{get:function(){return 0!=(1&this.Qa)},set:function(t){var e=0!=(1&this.Qa);e!==t&&(this.Qa^=1,this.g("relinkableFrom",e,t),this.Wb())}},relinkableTo:{get:function(){return 0!=(2&this.Qa)},set:function(t){var e=0!=(2&this.Qa);e!==t&&(this.Qa^=2,this.g("relinkableTo",e,t),this.Wb())}},resegmentable:{get:function(){return 0!=(4&this.Qa)},set:function(t){var e=0!=(4&this.Qa);e!==t&&(this.Qa^=4,this.g("resegmentable",e,t),this.Wb())}},isTreeLink:{get:function(){return 0!=(8&this.Qa)},set:function(t){var e=0!=(8&this.Qa);e!==t&&(this.Qa^=8,this.g("isTreeLink",e,t),null!==this.fromNode&&oc(this.fromNode),null!==this.toNode&&oc(this.toNode))}},path:{get:function(){var t=this.Pb();return t instanceof pl?t:null}},routeBounds:{get:function(){this.vg();var t=this.ml,e=1/0,i=1/0,n=this.pointsCount;if(0===n)t.h(NaN,NaN,0,0);else{if(1===n)n=this.i(0),e=Math.min(n.x,e),i=Math.min(n.y,i),t.h(n.x,n.y,0,0);else if(2===n){n=this.i(0);var o=this.i(1);e=Math.min(n.x,o.x),i=Math.min(n.y,o.y),t.h(n.x,n.y,0,0),t.Ye(o)}else if(this.computeCurve()===_c&&3<=n&&!this.isOrthogonal)if(e=(o=this.i(0)).x,i=o.y,t.h(e,i,0,0),3===n){n=this.i(1),e=Math.min(n.x,e),i=Math.min(n.y,i);var r=this.i(2);e=Math.min(r.x,e),i=Math.min(r.y,i),Ye.Dl(o.x,o.y,n.x,n.y,n.x,n.y,r.x,r.y,.5,t)}else for(r=3;r<n;r+=3){var s=this.i(r-2);r+3>=n&&(r=n-1);var a=this.i(r-1),h=this.i(r);Ye.Dl(o.x,o.y,s.x,s.y,a.x,a.y,h.x,h.y,.5,t),e=Math.min(h.x,e),i=Math.min(h.y,i),o=h}else for(o=this.i(0),r=this.i(1),e=Math.min(o.x,r.x),i=Math.min(o.y,r.y),t.h(o.x,o.y,0,0),t.Ye(r),o=2;o<n;o++)r=this.i(o),e=Math.min(r.x,e),i=Math.min(r.y,i),t.Ye(r);this.su.h(e-t.x,i-t.y)}return t}},midPoint:{get:function(){return this.vg(),this.computeMidPoint(new pt)}},midAngle:{get:function(){return this.vg(),this.computeMidAngle()}},flattenedLengths:{get:function(){if(null===this.cq){this.fd||Cc(this);for(var t=this.cq=[],e=this.pointsCount,i=0;i<e-1;i++){var n=this.i(i),o=this.i(i+1);Ye.$(n.x,o.x)?0>(n=o.y-n.y)&&(n=-n):Ye.$(n.y,o.y)?0>(n=o.x-n.x)&&(n=-n):n=Math.sqrt(n.Bf(o)),t.push(n)}}return this.cq}},flattenedTotalLength:{get:function(){var t=this.vt;if(isNaN(t)){for(var e=this.flattenedLengths,i=e.length,n=t=0;n<i;n++)t+=e[n];this.vt=t}return t}},points:{get:function(){return this.Nb},set:function(t){var e=this.Nb;if(e!==t){var i=null;if(Array.isArray(t)){var n=0==t.length%2;if(n)for(var o=0;o<t.length;o++)if("number"!=typeof t[o]||isNaN(t[o])){n=!1;break}if(n)for(i=new $,n=0;n<t.length/2;n++)o=new pt(t[2*n],t[2*n+1]).freeze(),i.add(o);else{for(n=!0,o=0;o<t.length;o++){var r=t[o];if(!C(r)||"number"!=typeof r.x||isNaN(r.x)||"number"!=typeof r.y||isNaN(r.y)){n=!1;break}}if(n)for(i=new $,n=0;n<t.length;n++)o=t[n],i.add(new pt(o.x,o.y).freeze())}}else if(t instanceof $)for(i=t.copy(),t=i.iterator;t.next();)t.value.freeze();else w("Link.points value is not an instance of List or Array: "+t);i.freeze(),this.Nb=i,this.qc(),Cc(this),null!==(t=this.diagram)&&(t.pi||t.undoManager.isUndoingRedoing||t.As.add(this),t.animationManager.zb&&Qn(t.animationManager,this,i)),this.g("points",e,i)}}},pointsCount:{get:function(){return this.Nb.count}},fd:{get:function(){return 0!=(16&this.Qa)},set:function(t){0!=(16&this.Qa)!==t&&(this.Qa^=16)}},suspendsRouting:{get:function(){return 0!=(32&this.Qa)},set:function(t){0!=(32&this.Qa)!==t&&(this.Qa^=32)}},computingPoints:{get:function(){return 0!=(64&this.Qa)},set:function(t){0!=(64&this.Qa)!==t&&(this.Qa^=64)}},defaultFromPoint:{get:function(){return this.o},set:function(t){this.o=t.copy()}},defaultToPoint:{get:function(){return this.u},set:function(t){this.u=t.copy()}},isOrthogonal:{get:function(){return 2==(2&this.qj.value)}},isAvoiding:{get:function(){return 4==(4&this.qj.value)}},lk:{get:function(){return 0!=(128&this.Qa)},set:function(t){0!=(128&this.Qa)!==t&&(this.Qa^=128)}},geometry:{get:function(){if(!this.lk){if(this.vg(),2>this.pointsCount)return this.lk=!0,this.ua;this.ua=this.makeGeometry()}return this.ua}},firstPickIndex:{get:function(){return 2>=this.pointsCount?0:this.isOrthogonal||!Nc(this.computeSpot(!0))?1:0}},lastPickIndex:{get:function(){var t=this.pointsCount;return 0===t?0:2>=t?t-1:this.isOrthogonal||!Nc(this.computeSpot(!1))?t-2:t-1}},adjusting:{get:function(){return this.qk},set:function(t){var e=this.qk;e!==t&&(this.qk=t,this.g("adjusting",e,t))}},corner:{get:function(){return this.Om},set:function(t){var e=this.Om;e!==t&&(this.Om=t,this.qc(),this.g("corner",e,t))}},curve:{get:function(){return this.Qm},set:function(t){var e=this.Qm;e!==t&&(this.Qm=t,this.bb(),this.qc(),zc(this,e===$c||e===Jc||t===$c||t===Jc),this.g("curve",e,t))}},curviness:{get:function(){return this.Rm},set:function(t){var e=this.Rm;e!==t&&(this.Rm=t,this.bb(),this.qc(),this.g("curviness",e,t))}},routing:{get:function(){return this.qj},set:function(t){var e=this.qj;e!==t&&(this.qj=t,this.Wf=null,this.bb(),zc(this,2==(2&e.value)||2==(2&t.value)),this.g("routing",e,t))}},smoothness:{get:function(){return this.po},set:function(t){var e=this.po;e!==t&&(this.po=t,this.qc(),this.g("smoothness",e,t))}},key:{get:function(){var t=this.diagram;if(null!==t&&t.model.ri())return t.model.Ac(this.data)}}}),wc.prototype.invalidateOtherJumpOvers=wc.prototype.Xo,wc.prototype.findClosestSegment=wc.prototype.ez,wc.prototype.updateRoute=wc.prototype.vg,wc.prototype.invalidateRoute=wc.prototype.bb,wc.prototype.rollbackRoute=wc.prototype.rv,wc.prototype.commitRoute=wc.prototype.zf,wc.prototype.startRoute=wc.prototype.uh,wc.prototype.clearPoints=wc.prototype.Fj,wc.prototype.removePoint=wc.prototype.pv,wc.prototype.addPointAt=wc.prototype.yf,wc.prototype.addPoint=wc.prototype.ne,wc.prototype.insertPointAt=wc.prototype.m,wc.prototype.insertPoint=wc.prototype.Kz,wc.prototype.setPointAt=wc.prototype.L,wc.prototype.setPoint=wc.prototype.dd,wc.prototype.getPoint=wc.prototype.i,wc.prototype.getOtherPort=wc.prototype.Cz,wc.prototype.getOtherNode=wc.prototype.To;var Hc=null,Yc=null,Xc=new V(wc,"Normal",1),Uc=new V(wc,"Orthogonal",2),qc=new V(wc,"AvoidsNodes",6),Wc=new V(wc,"AvoidsNodesStraight",7),Kc=new V(wc,"None",0),_c=new V(wc,"Bezier",9),$c=new V(wc,"JumpGap",10),Jc=new V(wc,"JumpOver",11),Zc=new V(wc,"End",17),Qc=new V(wc,"Scale",18),td=new V(wc,"Stretch",19),ed=new V(wc,"OrientAlong",21),id=new V(wc,"OrientPlus90",22),nd=new V(wc,"OrientMinus90",23),od=new V(wc,"OrientOpposite",24),rd=new V(wc,"OrientUpright",25),sd=new V(wc,"OrientPlus90Upright",26),ad=new V(wc,"OrientMinus90Upright",27),hd=new V(wc,"OrientUpright45",28),ld=16,ud=14,cd=8;function dd(t,e,i,n){Q(this),this.Fe=this.qq=!1,this.Ds=t,this.Ox=e,this.cv=i,this.Px=n,this.links=[]}function fd(t){Q(this),this.Yx=this.group=null,this.vs=!0,this.abort=!1,this.Od=this.Nd=1,this.Fn=this.En=-1,this.rc=t.width,this.sc=t.height,this.ac=null,this.ei=this.di=0,this.Os=11,this.Ix=this.Hx=22}function pd(t,e,i){return t.Nd<=e&&e<=t.En&&t.Od<=i&&i<=t.Fn}function gd(t,e,i){return pd(t,e,i)?(e-=t.Nd,e/=t.rc,i-=t.Od,i/=t.sc,t.ac[0|e][0|i]):Cd}function md(t){if(null!==t.ac)for(var e=0;e<=t.di;e++)for(var i=t.ac[e],n=0;n<=t.ei;n++)i[n]>=Sd&&(i[n]=Cd)}function yd(t,e,i,n,o,r,s,a,h){if(!(e<r||e>s||i<a||i>h)){var l=0|e,u=0|i,c=t.ac[l][u];if(c>=Sd&&c<Md)for(o?u+=n:l+=n,c+=1;r<=l&&l<=s&&a<=u&&u<=h&&!(c>=t.ac[l][u]);)t.ac[l][u]=c,c+=1,o?u+=n:l+=n;if(l=o?u:l,o)if(0<n)for(i+=n;i<l;i+=n)yd(t,e,i,1,!o,r,s,a,h),yd(t,e,i,-1,!o,r,s,a,h);else for(i+=n;i>l;i+=n)yd(t,e,i,1,!o,r,s,a,h),yd(t,e,i,-1,!o,r,s,a,h);else if(0<n)for(e+=n;e<l;e+=n)yd(t,e,i,1,!o,r,s,a,h),yd(t,e,i,-1,!o,r,s,a,h);else for(e+=n;e>l;e+=n)yd(t,e,i,1,!o,r,s,a,h),yd(t,e,i,-1,!o,r,s,a,h)}}function vd(t,e,i,n,o,r,s,a,h){e|=0,i|=0;var l=kd,u=Sd;for(t.ac[e][i]=u;l===kd&&e>r&&e<s&&i>a&&i<h;)u+=1,t.ac[e][i]=u,o?i+=n:e+=n,l=t.ac[e][i]}function xd(t,e,i,n,o,r,s,a,h){e|=0,i|=0;var l=kd,u=Md;for(t.ac[e][i]=u;l===kd&&e>r&&e<s&&i>a&&i<h;)t.ac[e][i]=u,o?i+=n:e+=n,l=t.ac[e][i]}function bd(t,e,i,n,o,r,s){if(null!==t.ac){t.abort=!1;var a=e.x,h=e.y;if(pd(t,a,h)){a-=t.Nd,a/=t.rc,h-=t.Od,h/=t.sc;var l=n.x,u=n.y;if(pd(t,l,u))if(l-=t.Nd,l/=t.rc,u-=t.Od,u/=t.sc,1>=Math.abs(a-l)&&1>=Math.abs(h-u))t.abort=!0;else{var c=r.x;n=r.y,e=r.x+r.width;var d=r.y+r.height;c-=t.Nd,c/=t.rc,n-=t.Od,n/=t.sc,e-=t.Nd,e/=t.rc,d-=t.Od,d/=t.sc,r=Math.max(0,Math.min(t.di,0|c)),e=Math.min(t.di,Math.max(0,0|e)),c=Math.max(0,Math.min(t.ei,0|n)),d=Math.min(t.ei,Math.max(0,0|d)),h|=0,l|=0,u|=0;var f=0===i||90===i?1:-1;if(i=90===i||270===i,(n=t.ac)[a|=0][h]===kd?(vd(t,a,h,f,i,r,e,c,d),vd(t,a,h,1,!i,r,e,c,d),vd(t,a,h,-1,!i,r,e,c,d)):vd(t,a,h,f,i,a,h,a,h),n[l][u]===kd?(xd(t,l,u,0===o||90===o?1:-1,90===o||270===o,r,e,c,d),xd(t,l,u,1,!(90===o||270===o),r,e,c,d),xd(t,l,u,-1,!(90===o||270===o),r,e,c,d)):xd(t,l,u,f,i,l,u,l,u),i=A(),s&&wd(t,l,u,o,a,h,i))for(i[0]===l&&i[1]===u||(i.unshift(u),i.unshift(l)),i[i.length-2]===a&&i[i.length-1]===h||(i.push(a),i.push(h)),t=Sd,o=i[i.length-2],s=i[i.length-1],n[o][s]=t++,r=i.length-4;0<=r;r-=2)for(o=i[r+2],s=i[r+3],e=i[r],l=i[r+1];e>o?o++:e<o?o--:l>s?s++:l<s&&s--,n[o][s]=t++,o!==e||s!==l;);else yd(t,a,h,1,!1,r,e,c,d),yd(t,a,h,-1,!1,r,e,c,d),yd(t,a,h,1,!0,r,e,c,d),yd(t,a,h,-1,!0,r,e,c,d);B(i)}}}}function wd(t,e,i,n,o,r,s){for(var a=t.ac,h=e,l=i;;){if(h===o&&l===r)return!0;var u=h,c=l;if(0===n){if(!(u<o))break;u++}else if(90===n){if(!(c<r))break;c++}else if(180===n){if(!(u>o))break;u--}else{if(!(c>r))break;c--}var d=a[u][c];if(0===d||d===Pd)break;h=u,l=c}for(;;){if(u=n,c=h,d=l,0===n?d<r?(u=90,d++):d>r&&(u=270,d--):90===n?c<o?(u=0,c++):c>o&&(u=180,c--):180===n?d<r?(u=90,d++):d>r&&(u=270,d--):c<o?(u=0,c++):c>o&&(u=180,c--),c=a[c][d],u!==n&&0!==c&&c!==Pd){if(s.push(h),s.push(l),wd(t,h,l,u,o,r,s))return!0;s.pop(),s.pop()}if(a[h][l]=Pd,0===n){if(h===e)return!1;h--}else if(90===n){if(l===i)return!1;l--}else if(180===n){if(h===e)return!1;h++}else{if(l===i)return!1;l++}}}wc.className="Link",wc.Normal=Xc,wc.Orthogonal=Uc,wc.AvoidsNodes=qc,wc.AvoidsNodesStraight=Wc,wc.None=Kc,wc.Bezier=_c,wc.JumpGap=$c,wc.JumpOver=Jc,wc.End=Zc,wc.Scale=Qc,wc.Stretch=td,wc.OrientAlong=ed,wc.OrientPlus90=id,wc.OrientMinus90=nd,wc.OrientOpposite=od,wc.OrientUpright=rd,wc.OrientPlus90Upright=sd,wc.OrientMinus90Upright=ad,wc.OrientUpright45=hd,wc.EndSegmentStep=8,wc.CurvinessStart=ld,wc.SpacingMin=ud,wc.OrthoShortCut=cd,dd.prototype.Sl=function(){if(!this.qq){var t=this.links;0<t.length&&(null!==(t=t[0].diagram)&&(t.ow.add(this),this.Fe=t.undoManager.isUndoingRedoing))}this.qq=!0},dd.prototype.Nv=function(){if(this.qq){this.qq=!1;var t=this.links;if(0<t.length){var e=t[0],i=e.diagram;i=null===i||i.pi&&!this.Fe,this.Fe=!1,e.arrangeBundledLinks(t,i),1===t.length&&(e.Sf=null,t.length=0)}0===t.length&&(t=this.Ds,null!==this&&null!==t.af&&t.af.remove(this),t=this.cv,null!==this&&null!==t.af&&t.af.remove(this))}},dd.className="LinkBundle",fd.prototype.initialize=function(t){if(!(0>=t.width||0>=t.height)){var e=t.y,i=t.x+t.width,n=t.y+t.height;if(this.Nd=Math.floor((t.x-this.rc)/this.rc)*this.rc,this.Od=Math.floor((e-this.sc)/this.sc)*this.sc,this.En=Math.ceil((i+2*this.rc)/this.rc)*this.rc,this.Fn=Math.ceil((n+2*this.sc)/this.sc)*this.sc,t=1+(0|Math.ceil((this.En-this.Nd)/this.rc)),e=1+(0|Math.ceil((this.Fn-this.Od)/this.sc)),null===this.ac||this.di<t-1||this.ei<e-1){for(i=[],n=0;n<=t;n++)i[n]=new Uint32Array(e);this.ac=i,this.di=t-1,this.ei=e-1}if(t=Cd,null!==this.ac)for(e=0;e<=this.di;e++)if((i=this.ac[e]).fill)i.fill(t);else for(n=0;n<=this.ei;n++)i[n]=t}},fd.prototype.Yj=function(t,e,i,n){if(t>this.En||t+i<this.Nd||e>this.Fn||e+n<this.Od)return!0;t=(t-this.Nd)/this.rc|0,e=(e-this.Od)/this.sc|0,i=Math.max(0,i)/this.rc+1|0;var o=Math.max(0,n)/this.sc+1|0;if(0>t&&(i+=t,t=0),0>e&&(o+=e,e=0),0>i||0>o)return!0;for(n=0|Math.min(t+i-1,this.di),i=0|Math.min(e+o-1,this.ei);t<=n;t++){o=this.ac[t];for(var r=e;r<=i;r++)if(o[r]===kd)return!1}return!0},d.Object.defineProperties(fd.prototype,{bounds:{get:function(){return new jt(this.Nd,this.Od,this.En-this.Nd,this.Fn-this.Od)}},Ho:{get:function(){return this.rc},set:function(t){0<t&&t!==this.rc&&(this.rc=t,this.initialize(this.bounds))}},Go:{get:function(){return this.sc},set:function(t){0<t&&t!==this.sc&&(this.sc=t,this.initialize(this.bounds))}}});var kd=0,Sd=1,Md=999999,Cd=Md+1,Pd=Md+2;function Td(){Q(this),this.port=this.node=null,this.pe=[],this.ap=!1}function Nd(t,e,i,n){switch(e=e.offsetY){case 8:return 90;case 2:return 180;case 1:return 270;case 4:return 0}switch(e){case 9:return 180<i?270:90;case 6:return 90<i&&270>=i?180:0}switch(t=180*Math.atan2(t.height,t.width)/Math.PI,e){case 3:return i>t&&i<=180+t?180:270;case 5:return i>180-t&&i<=360-t?270:0;case 12:return i>t&&i<=180+t?90:0;case 10:return i>180-t&&i<=360-t?180:90;case 7:return 90<i&&i<=180+t?180:i>180+t&&i<=360-t?270:0;case 13:return 180<i&&i<=360-t?270:i>t&&180>=i?90:0;case 14:return i>t&&i<=180-t?90:i>180-t&&270>=i?180:0;case 11:return i>180-t&&i<=180+t?180:i>180+t?270:90}return n&&15!==e&&(0>(i-=15)&&(i+=360)),i>t&&i<180-t?90:i>=180-t&&i<=180+t?180:i>180+t&&i<360-t?270:0}function Ld(t,e){var i=t.pe;if(0===i.length){t:if(!t.ap){i=t.ap,t.ap=!0;var n=null,o=t.node,r=o instanceof gc?o:null;if(null===r||r.isSubGraphExpanded)var s=o.isTreeExpanded?o.findLinksConnected(t.port.portId):o.qx();else{if(!r.actualBounds.w()){t.ap=i;break t}s=(n=r).Lu()}r=t.pe.length=0;var a=t.port.ga(te,pt.alloc()),h=t.port.ga(he,pt.alloc());for((o=jt.allocAt(a.x,a.y,0,0)).Ye(h),pt.free(a),pt.free(h),a=pt.allocAt(o.x+o.width/2,o.y+o.height/2),h=t.port.li(),s=s.iterator;s.next();){var l=s.value;if(l.isVisible()&&l.fromPort!==l.toPort){var u=l.fromPort===t.port||null!==l.fromNode&&l.fromNode.Td(n),c=l.computeSpot(u,t.port);if(c.$c()&&null!==(u=u?l.toPort:l.fromPort)){var d=u.part;if(null!==d){var f=d.findVisibleNode();null!==f&&f!==d&&(u=(d=f).port),u=l.computeOtherPoint(d,u),d=a.ab(u),0>(d-=h)?d+=360:360<=d&&(d-=360),0===(c=Nd(o,c,d,l.isOrthogonal))?(c=4,180<d&&(d-=360)):90===c?(c=8,270<d&&(d-=360)):180===c?c=2:(c=1,90>d&&(d+=360)),void 0===(f=t.pe[r])?(f=new Ad(l,d,c),t.pe[r]=f):(f.link=l,f.angle=d,f.Nc=c),f.hv.set(u),r++}}}}for(pt.free(a),t.pe.sort(Td.prototype.j),h=t.pe.length,n=-1,r=a=0;r<h;r++)void 0!==(s=t.pe[r])&&(s.Nc!==n&&(n=s.Nc,a=0),s.Uo=a,a++);for(n=-1,a=0,r=h-1;0<=r;r--)void 0!==(h=t.pe[r])&&(h.Nc!==n&&(n=h.Nc,a=h.Uo+1),h.Gl=a);if(r=t.pe,c=t.port,n=t.node.portSpreading,a=pt.alloc(),h=pt.alloc(),s=pt.alloc(),l=pt.alloc(),c.ga(te,a),c.ga(ie,h),c.ga(he,s),c.ga(se,l),f=d=u=c=0,n===pc)for(var p=0;p<r.length;p++){var g=r[p];if(null!==g){var m=g.link.computeThickness();switch(g.Nc){case 8:d+=m;break;case 2:f+=m;break;case 1:c+=m;break;default:u+=m}}}var y=p=0,v=1,x=g=0;for(m=0;m<r.length;m++){var b=r[m];if(null!==b){if(p!==b.Nc){switch(p=b.Nc){case 8:var w=s;y=l;break;case 2:w=l,y=a;break;case 1:w=a,y=h;break;default:w=h,y=s}switch(g=y.x-w.x,x=y.y-w.y,p){case 8:d>Math.abs(g)?(v=Math.abs(g)/d,d=Math.abs(g)):v=1;break;case 2:f>Math.abs(x)?(v=Math.abs(x)/f,f=Math.abs(x)):v=1;break;case 1:c>Math.abs(g)?(v=Math.abs(g)/c,c=Math.abs(g)):v=1;break;default:u>Math.abs(x)?(v=Math.abs(x)/u,u=Math.abs(x)):v=1}y=0}var k=b.Zo;if(n===pc){switch(b=b.link.computeThickness(),b*=v,k.set(w),p){case 8:k.x=w.x+g/2+d/2-y-b/2;break;case 2:k.y=w.y+x/2+f/2-y-b/2;break;case 1:k.x=w.x+g/2-c/2+y+b/2;break;default:k.y=w.y+x/2-u/2+y+b/2}y+=b}else{var S=.5;n===fc&&(S=(b.Uo+1)/(b.Gl+1)),k.x=w.x+g*S,k.y=w.y+x*S}}}for(pt.free(a),pt.free(h),pt.free(s),pt.free(l),w=t.pe,r=0;r<w.length;r++)null!==(n=w[r])&&(n.Ju=t.computeEndSegmentLength(n));t.ap=i,jt.free(o)}i=t.pe}for(t=0;t<i.length;t++)if(null!==(o=i[t])&&o.link===e)return o;return null}function Ad(t,e,i){this.link=t,this.angle=e,this.Nc=i,this.hv=new pt,this.Gl=this.Uo=0,this.Zo=new pt,this.Ju=0}function Bd(t){Q(this),this.o=this.H=null,this.Gh=this.sn=!0,this.yn=!1,this.Am=new pt(0,0).freeze(),this.vn=!0,this.Em=this.un=null,this.xn=!1,this.j=null,t&&Object.assign(this,t)}function Dd(t,e,i,n,o,r,s,a){for(i=i.iterator;i.next();){var h=i.value;n&&!h.isTopLevel||null!==o&&!o(h)||!h.canLayout()||(r&&h instanceof _u?h.isLinkLabel||(h instanceof gc&&null===h.layout?Dd(t,e,h.memberParts,!1,o,r,s,a):(Fd(h),e.add(h))):s&&h instanceof wc?e.add(h):!a||!h.Zc()||h instanceof _u||(Fd(h),e.add(h)))}}function Fd(t){var e=t.actualBounds;(0===e.width||0===e.height||isNaN(e.width)||isNaN(e.height))&&t.Va()}function jd(t){Q(this),this.Sc=t,this.wf=new Z,this.ye=new Z,this.Es=new ft,this.zs=new ft}function Ed(t,e){if(null===e)return!1;var i=t.wf.remove(e);return i&&(null!==(e=e.node)&&t.Es.remove(e)),i}function Od(t,e){if(null!==e){t.ye.add(e);var i=e.link;null!==i&&null===t.Lo(i)&&t.zs.add(i,e),e.network=t}}function Id(t,e){null!==e&&t.ye.remove(e)&&(null!==(e=e.link)&&t.zs.remove(e))}function zd(t,e,i){if(null!==i&&i.network!==e){Ed(t,i),e.dh(i);for(var n=i.sourceEdges;n.next();){var o=n.value;o.network!==e&&(Id(t,o),Od(e,o),zd(t,e,o.fromVertex))}for(n=i.destinationEdges;n.next();)(i=n.value).network!==e&&(Id(t,i),Od(e,i),zd(t,e,i.toVertex))}}function Rd(t){Q(this),this.ob=t,this.j=new jt(0,0,10,10).freeze(),this.o=new pt(5,5).freeze(),this.Sh=this.ub=null,this.tg=new $,this.mg=new $}function Vd(t,e){return t=t.Sh,e=e.Sh,t?e?(t=t.text)<(e=e.text)?-1:t>e?1:0:1:null!==e?-1:0}function Gd(t){Q(this),this.nb=t,this.qd=this.kd=this.$k=this.ub=null}function Hd(t){Bd.call(this),this.isViewportSized=!0,this.yo=this.zo=NaN,this.yg=new At(NaN,NaN).freeze(),this.tf=new At(10,10).freeze(),this.Jb=Ud,this.Rb=qd,this.nd=$d,this.hd=Yd,t&&Object.assign(this,t)}function Yd(t,e){return(t=t.text)<(e=e.text)?-1:t>e?1:0}fd.className="PositionArray",Td.prototype.toString=function(){for(var t=this.pe,e=this.node.toString()+" "+t.length.toString()+":",i=0;i<t.length;i++){var n=t[i];null!==n&&(e+="\n "+n.toString())}return e},Td.prototype.Sl=function(){this.pe.length=0},Td.prototype.j=function(t,e){return t===e?0:null===t?-1:null===e?1:t.Nc<e.Nc?-1:t.Nc>e.Nc?1:t.angle<e.angle?-1:t.angle>e.angle?1:0},Td.prototype.computeEndSegmentLength=function(t){var e=t.link,i=e.computeEndSegmentLength(this.node,this.port,Qt,e.fromPort===this.port),n=t.Uo;if(0>n)return i;var o=t.Gl;if(1>=o||!e.isOrthogonal)return i;e=t.hv;var r=t.Zo;return 2!==t.Nc&&8!==t.Nc||(n=o-1-n),((t=2===t.Nc||4===t.Nc)?e.y<r.y:e.x<r.x)?i+8*n:(t?e.y===r.y:e.x===r.x)?i:i+8*(o-1-n)},Td.className="Knot",Ad.prototype.toString=function(){return this.link.toString()+" "+this.angle.toString()+" "+this.Nc.toString()+":"+this.Uo.toString()+"/"+this.Gl.toString()+" "+this.Zo.toString()+" "+this.Ju.toString()+" "+this.hv.toString()},Ad.className="LinkInfo",Bd.prototype.cloneProtected=function(t){t.sn=this.sn,t.Gh=this.Gh,t.yn=this.yn,t.Am.assign(this.Am),t.vn=this.vn,t.un=this.un,t.Em=this.Em,t.xn=!0},Bd.prototype.copy=function(){var t=new this.constructor;return this.cloneProtected(t),t},Bd.prototype.qb=function(){},Bd.prototype.toString=function(){var t=D(this.constructor);return t+="(",null!==this.group&&(t+=" in "+this.group),null!==this.diagram&&(t+=" for "+this.diagram),t+")"},Bd.prototype.C=function(){if(this.isValidLayout){var t=this.diagram;if(null!==t&&!t.undoManager.isUndoingRedoing){var e=t.animationManager;!e.isTicking&&(e.defaultAnimation.isAnimating&&e.Cc(),this.isOngoing&&t.pi||this.isInitial&&!t.pi)&&(this.isValidLayout=!1,t.$b())}}},Bd.prototype.createNetwork=function(){return new jd(this)},Bd.prototype.makeNetwork=function(t){var e=this.createNetwork();return t instanceof No?(e.lg(t.nodes,!0),e.lg(t.links,!0)):t instanceof gc?e.lg(t.memberParts):e.lg(t.iterator),e},Bd.prototype.updateParts=function(){this.isValidLayout=!0;var t=this.diagram;if(null===t&&null!==this.network)for(var e=this.network.vertexes.iterator;e.next();){var i=e.value.node;if(null!==i&&null!==(t=i.diagram))break}try{null!==t&&t.Ea("Layout"),this.commitLayout()}finally{null!==t&&t.eb("Layout")}},Bd.prototype.commitLayout=function(){if(null!==this.network){for(var t=this.network.vertexes.iterator;t.next();)t.value.commit();if(this.isRouting)for(t=this.network.edges.iterator;t.next();)t.value.commit()}},Bd.prototype.doLayout=function(t){var e=new Z;t instanceof No?(Dd(this,e,t.nodes,!0,this.rh,!0,!1,!0),Dd(this,e,t.parts,!0,this.rh,!0,!1,!0)):t instanceof gc?Dd(this,e,t.memberParts,!1,this.rh,!0,!1,!0):e.addAll(t.iterator),0<e.count&&(null!==(t=this.diagram)&&t.Ea("Layout"),this.doMinimalNoNetworkLayout(e),null!==t&&t.eb("Layout")),this.isValidLayout=!0},Bd.prototype.doMinimalNoNetworkLayout=function(t){var e=Math.ceil(Math.sqrt(t.count));this.arrangementOrigin=this.initialOrigin(this.arrangementOrigin);var i=this.arrangementOrigin.x,n=i,o=this.arrangementOrigin.y,r=0,s=0;for(t=t.iterator;t.next();){var a=t.value;Fd(a);var h=a.measuredBounds,l=h.width;h=h.height,a.moveTo(n,o),a instanceof gc&&(a.rh=!1),n+=Math.max(l,50)+20,s=Math.max(s,Math.max(h,50)),r>=e-1?(r=0,n=i,o+=s+20,s=0):r++}},Bd.prototype.doMinimalNetworkLayout=function(){var t=Math.ceil(Math.sqrt(this.network.vertexes.count));this.arrangementOrigin=this.initialOrigin(this.arrangementOrigin);for(var e=this.arrangementOrigin.x,i=e,n=this.arrangementOrigin.y,o=0,r=0,s=this.network.vertexes.iterator;s.next();){var a=s.value.node;if(!(null===a||a instanceof wc)&&(Fd(a),this.rh(a))){var h=a.measuredBounds,l=h.width;h=h.height,a.moveTo(i,n),a instanceof gc&&(a.rh=!1),i+=Math.max(l,50)+20,r=Math.max(r,Math.max(h,50)),o>=t-1?(o=0,i=e,n+=r+20,r=0):o++}}},Bd.prototype.rh=function(t){return!(t.location.w()&&!(t instanceof gc&&t.rh))},Bd.prototype.ni=function(t,e){var i=this.boundsComputation;return null!==i?(e||(e=new jt),i(t,this,e)):e?(e.set(t.actualBounds),e):t.actualBounds},Bd.prototype.ex=function(t){var e=new Z;return t instanceof No?(Dd(this,e,t.nodes,!0,null,!0,!0,!0),Dd(this,e,t.links,!0,null,!0,!0,!0),Dd(this,e,t.parts,!0,null,!0,!0,!0)):Dd(this,e,t instanceof gc?t.memberParts:t.iterator,!1,null,!0,!0,!0),e},Bd.prototype.initialOrigin=function(t){var e=this.group;if(null!==e){var i=e.position.copy();return(isNaN(i.x)||isNaN(i.y))&&i.set(t),null!==(e=e.placeholder)&&(i=e.ga(te),(isNaN(i.x)||isNaN(i.y))&&i.set(t),t=e.padding,i.x+=t.left,i.y+=t.top),i}return t},d.Object.defineProperties(Bd.prototype,{diagram:{get:function(){return this.H},set:function(t){this.H=t}},group:{get:function(){return this.o},set:function(t){this.o!==t&&(this.o=t,null!==t&&(this.H=t.diagram))}},isOngoing:{get:function(){return this.sn},set:function(t){this.sn!==t&&(this.sn=t)}},isInitial:{get:function(){return this.Gh},set:function(t){this.Gh=t,t||(this.xn=!0)}},isViewportSized:{get:function(){return this.yn},set:function(t){this.yn!==t&&(this.yn=t)&&this.C()}},isRouting:{get:function(){return this.vn},set:function(t){this.vn!==t&&(this.vn=t)}},isRealtime:{get:function(){return this.un},set:function(t){this.un!==t&&(this.un=t)}},isValidLayout:{get:function(){return this.xn},set:function(t){this.xn!==t&&(this.xn=t,t||null!==(t=this.diagram)&&(t.xh=!0))}},network:{get:function(){return this.j},set:function(t){this.j!==t&&(this.j=t,null!==t&&(t.layout=this))}},boundsComputation:{get:function(){return this.Em},set:function(t){this.Em!==t&&(this.Em=t,this.C())}},arrangementOrigin:{get:function(){return this.Am},set:function(t){this.Am.D(t)||(this.Am.assign(t),this.C())}}}),Bd.prototype.collectParts=Bd.prototype.ex,Bd.prototype.getLayoutBounds=Bd.prototype.ni,Bd.prototype.invalidateLayout=Bd.prototype.C,Bd.className="Layout",jd.prototype.clear=function(){if(this.wf)for(var t=this.wf.iterator;t.next();)t.value.clear();if(this.ye)for(t=this.ye.iterator;t.next();)t.value.clear();this.wf=new Z,this.ye=new Z,this.Es=new ft,this.zs=new ft},jd.prototype.toString=function(t){void 0===t&&(t=0);var e="LayoutNetwork"+(null!==this.layout?"("+this.layout.toString()+")":"");if(0>=t)return e;if(e+=" vertexes: "+this.wf.count+" edges: "+this.ye.count,1<t){for(var i=this.wf.iterator;i.next();)e+="\n "+i.value.toString(t-1);for(i=this.ye.iterator;i.next();)e+="\n "+i.value.toString(t-1)}return e},jd.prototype.createVertex=function(){return new Rd(this)},jd.prototype.createEdge=function(){return new Gd(this)},jd.prototype.lg=function(t,e,i){if(null!==t){for(void 0===e&&(e=!1),void 0===i&&(i=null),null===i&&(i=function(t){if(t instanceof _u)return!t.isLinkLabel;if(t instanceof wc){var e=t.fromNode;return null!==e&&!e.isLinkLabel&&(null!==(t=t.toNode)&&!t.isLinkLabel)}return!1}),t=t.iterator;t.next();){var n=t.value;if(n instanceof _u&&(!e||n.isTopLevel)&&n.canLayout()&&i(n))if(n instanceof gc&&null===n.layout)this.lg(n.memberParts,!1);else if(null===this.ki(n)){var o=this.createVertex();o.node=n,this.dh(o)}}for(t.reset();t.next();)if((n=t.value)instanceof wc&&(!e||n.isTopLevel)&&n.canLayout()&&i(n)&&null===this.Lo(n)){var r=n.fromNode;o=n.toNode,null!==r&&null!==o&&r!==o&&(r=this.findGroupVertex(r),o=this.findGroupVertex(o),null!==r&&null!==o&&this.Zj(r,o,n))}}},jd.prototype.findGroupVertex=function(t){if(null===t)return null;var e=t.findVisibleNode();if(null===e)return null;if(null!==(t=this.ki(e)))return t;for(e=e.containingGroup;null!==e;){if(null!==(t=this.ki(e)))return t;e=e.containingGroup}return null},(e=jd.prototype).dh=function(t){if(null!==t){this.wf.add(t);var e=t.node;null!==e&&this.Es.add(e,t),t.network=this}},e.Bl=function(t){if(null===t)return null;var e=this.ki(t);return null===e&&((e=this.createVertex()).node=t,this.dh(e)),e},e.Iu=function(t){if(null!==t&&Ed(this,t)){for(var e=t.tg,i=e.count-1;0<=i;i--){var n=e.M(i);this.Mj(n)}for(t=(e=t.mg).count-1;0<=t;t--)i=e.M(t),this.Mj(i)}},e.Zy=function(t){null!==t&&(null!==(t=this.ki(t))&&this.Iu(t))},e.ki=function(t){return null===t?null:this.Es.I(t)},e.Bo=function(t){if(null!==t){Od(this,t);var e=t.toVertex;null!==e&&e.Cl(t),null!==(e=t.fromVertex)&&e.zl(t)}},e.Dy=function(t){if(null===t)return null;var e=t.fromNode,i=t.toNode,n=this.Lo(t);return null===n?((n=this.createEdge()).link=t,null!==e&&(n.fromVertex=this.Bl(e)),null!==i&&(n.toVertex=this.Bl(i)),this.Bo(n)):(n.fromVertex=null!==e?this.Bl(e):null,n.toVertex=null!==i?this.Bl(i):null),n},e.Mj=function(t){if(null!==t){var e=t.toVertex;null!==e&&e.Kl(t),null!==(e=t.fromVertex)&&e.Jl(t),Id(this,t)}},e.Yy=function(t){null!==t&&(null!==(t=this.Lo(t))&&this.Mj(t))},e.Lo=function(t){return null===t?null:this.zs.I(t)},e.Zj=function(t,e,i){if(null===t||null===e)return null;if(t.network===this&&e.network===this){var n=this.createEdge();return n.link=i,n.fromVertex=t,n.toVertex=e,this.Bo(n),n}return null},e.gm=function(t){if(null!==t){var e=t.fromVertex,i=t.toVertex;null!==e&&null!==i&&(e.Jl(t),i.Kl(t),t.gm(),e.Cl(t),i.zl(t))}},e.Ko=function(){for(var t=A(),e=this.ye.iterator;e.next();){var i=e.value;i.fromVertex===i.toVertex&&t.push(i)}for(e=t.length,i=0;i<e;i++)this.Mj(t[i]);B(t)},jd.prototype.deleteArtificialVertexes=function(){for(var t=A(),e=this.wf.iterator;e.next();){var i=e.value;null===i.node&&null===i.data&&t.push(i)}for(i=t.length,e=0;e<i;e++)this.Iu(t[e]);for(e=A(),i=this.ye.iterator;i.next();){var n=i.value;null===n.link&&null===n.data&&e.push(n)}for(i=e.length,n=0;n<i;n++)this.Mj(e[n]);B(t),B(e)},jd.prototype.Zx=function(t){void 0===t&&(t=!0),t&&(this.deleteArtificialVertexes(),function(t){for(var e=A(),i=t.ye.iterator;i.next();){var n=i.value;null!==n.fromVertex&&null!==n.toVertex||e.push(n)}for(i=e.length,n=0;n<i;n++)t.Mj(e[n]);B(e)}(this),this.Ko()),t=new $;for(var e=!0;e;){e=!1;for(var i=this.wf.iterator;i.next();){var n=i.value;if(0<n.tg.count||0<n.mg.count){e=this.layout.createNetwork(),t.add(e),zd(this,e,n),e=!0;break}}}return t.sort((function(t,e){return null===t||null===e||t===e?0:e.vertexes.count-t.vertexes.count})),t},jd.prototype.dz=function(){for(var t=new Z,e=this.wf.iterator;e.next();)t.add(e.value.node);for(e=this.ye.iterator;e.next();)t.add(e.value.link);return t},d.Object.defineProperties(jd.prototype,{layout:{get:function(){return this.Sc},set:function(t){null!==t&&(this.Sc=t)}},vertexes:{get:function(){return this.wf}},edges:{get:function(){return this.ye}}}),jd.prototype.findAllParts=jd.prototype.dz,jd.prototype.splitIntoSubNetworks=jd.prototype.Zx,jd.prototype.deleteSelfEdges=jd.prototype.Ko,jd.prototype.reverseEdge=jd.prototype.gm,jd.prototype.linkVertexes=jd.prototype.Zj,jd.prototype.findEdge=jd.prototype.Lo,jd.prototype.deleteLink=jd.prototype.Yy,jd.prototype.deleteEdge=jd.prototype.Mj,jd.prototype.addLink=jd.prototype.Dy,jd.prototype.addEdge=jd.prototype.Bo,jd.prototype.findVertex=jd.prototype.ki,jd.prototype.deleteNode=jd.prototype.Zy,jd.prototype.deleteVertex=jd.prototype.Iu,jd.prototype.addNode=jd.prototype.Bl,jd.prototype.addVertex=jd.prototype.dh,jd.prototype.addParts=jd.prototype.lg,jd.className="LayoutNetwork",Rd.prototype.clear=function(){this.Sh=this.ub=null,this.tg=new $,this.mg=new $},Rd.prototype.toString=function(t){void 0===t&&(t=0);var e="LayoutVertex#"+et(this);if(0<t&&(e+=null!==this.node?"("+this.node.toString()+")":"",1<t)){t="";for(var i=!0,n=this.tg.iterator;n.next();){var o=n.value;i?i=!1:t+=",",t+=o.toString(0)}for(o="",i=!0,n=this.mg.iterator;n.next();){i?i=!1:o+=",",o+=n.value.toString(0)}e+=" sources: "+t+" destinations: "+o}return e},Rd.prototype.commit=function(){var t=this.ub;if(null!==t){var e=this.bounds,i=t.bounds;C(i)?(i.x=e.x,i.y=e.y,i.width=e.width,i.height=e.height):t.bounds=e.copy()}else if(null!==(t=this.node)){if(e=this.bounds,!(t instanceof gc)){i=jt.alloc(),t.Va();var n=this.network.layout.ni(t,i),o=t.locationObject.ga(oe);if(n.w()&&o.w())return t.moveTo(e.x+this.focusX-(o.x-n.x),e.y+this.focusY-(o.y-n.y)),void jt.free(i);jt.free(i)}t.moveTo(e.x,e.y)}},Rd.prototype.Cl=function(t){null!==t&&(this.tg.contains(t)||this.tg.add(t))},Rd.prototype.Kl=function(t){null!==t&&this.tg.remove(t)},Rd.prototype.zl=function(t){null!==t&&(this.mg.contains(t)||this.mg.add(t))},Rd.prototype.Jl=function(t){null!==t&&this.mg.remove(t)},d.Object.defineProperties(Rd.prototype,{sourceEdgesArrayAccess:{get:function(){return this.tg._dataArray}},destinationEdgesArrayAccess:{get:function(){return this.mg._dataArray}},data:{get:function(){return this.ub},set:function(t){if(this.ub=t,null!==t&&t.bounds){var e=t.bounds;t=e.x;var i=e.y,n=e.width;e=e.height,this.o.h(n/2,e/2),this.j.h(t,i,n,e)}}},node:{get:function(){return this.Sh},set:function(t){if(this.Sh!==t){this.Sh=t,t.Va();var e=this.network.layout,i=jt.alloc(),n=e.ni(t,i);e=n.x;var o=n.y,r=n.width;if(n=n.height,isNaN(e)&&(e=0),isNaN(o)&&(o=0),this.j.h(e,o,r,n),jt.free(i),!(t instanceof gc)&&(t=t.locationObject.ga(oe)).w())return void this.o.h(t.x-e,t.y-o);this.o.h(r/2,n/2)}}},bounds:{get:function(){return this.j},set:function(t){this.j.D(t)||this.j.assign(t)}},focus:{get:function(){return this.o},set:function(t){this.o.D(t)||this.o.assign(t)}},centerX:{get:function(){return this.j.x+this.o.x},set:function(t){var e=this.j;e.x+this.o.x!==t&&(e.ka(),e.x=t-this.o.x,e.freeze())}},centerY:{get:function(){return this.j.y+this.o.y},set:function(t){var e=this.j;e.y+this.o.y!==t&&(e.ka(),e.y=t-this.o.y,e.freeze())}},focusX:{get:function(){return this.o.x},set:function(t){var e=this.o;e.x!==t&&(e.ka(),e.x=t,e.freeze())}},focusY:{get:function(){return this.o.y},set:function(t){var e=this.o;e.y!==t&&(e.ka(),e.y=t,e.freeze())}},x:{get:function(){return this.j.x},set:function(t){var e=this.j;e.x!==t&&(e.ka(),e.x=t,e.freeze())}},y:{get:function(){return this.j.y},set:function(t){var e=this.j;e.y!==t&&(e.ka(),e.y=t,e.freeze())}},width:{get:function(){return this.j.width},set:function(t){var e=this.j;e.width!==t&&(e.ka(),e.width=t,e.freeze())}},height:{get:function(){return this.j.height},set:function(t){var e=this.j;e.height!==t&&(e.ka(),e.height=t,e.freeze())}},network:{get:function(){return this.ob},set:function(t){this.ob=t}},sourceVertexes:{get:function(){for(var t=new Z,e=this.sourceEdges;e.next();)t.add(e.value.fromVertex);return t.iterator}},destinationVertexes:{get:function(){for(var t=new Z,e=this.destinationEdges;e.next();)t.add(e.value.toVertex);return t.iterator}},vertexes:{get:function(){for(var t=new Z,e=this.sourceEdges;e.next();)t.add(e.value.fromVertex);for(e=this.destinationEdges;e.next();)t.add(e.value.toVertex);return t.iterator}},sourceEdges:{get:function(){return this.tg.iterator}},destinationEdges:{get:function(){return this.mg.iterator}},edges:{get:function(){for(var t=new $,e=this.sourceEdges;e.next();)t.add(e.value);for(e=this.destinationEdges;e.next();)t.add(e.value);return t.iterator}},edgesCount:{get:function(){return this.tg.count+this.mg.count}}}),Rd.prototype.deleteDestinationEdge=Rd.prototype.Jl,Rd.prototype.addDestinationEdge=Rd.prototype.zl,Rd.prototype.deleteSourceEdge=Rd.prototype.Kl,Rd.prototype.addSourceEdge=Rd.prototype.Cl,Rd.className="LayoutVertex",Rd.standardComparer=Vd,Rd.smartComparer=function(t,e){if(null!==t){if(null!==e){t=t.Sh;var i=e.Sh;if(null!==t){if(null!==i){for(e=t.text.toLocaleLowerCase().split(/([+-]?[.]?\d+(?:\.\d*)?(?:e[+-]?\d+)?)/),t=i.text.toLocaleLowerCase().split(/([+-]?[.]?\d+(?:\.\d*)?(?:e[+-]?\d+)?)/),i=0;i<e.length;i++)if(""!==t[i]&&void 0!==t[i]){var n=parseFloat(e[i]),o=parseFloat(t[i]);if(isNaN(n)){if(!isNaN(o))return 1;if(0!==e[i].localeCompare(t[i]))return e[i].localeCompare(t[i])}else{if(isNaN(o))return-1;if(0!=n-o)return n-o}}else if(""!==e[i])return 1;return""!==t[i]&&void 0!==t[i]?-1:0}return 1}return null!==i?-1:0}return 1}return null!==e?-1:0},Gd.prototype.clear=function(){this.qd=this.kd=this.$k=this.ub=null},Gd.prototype.toString=function(t){void 0===t&&(t=0);var e="LayoutEdge#"+et(this);return 0<t&&(e+=null!==this.$k?"("+this.$k.toString()+")":"",1<t&&(e+=" "+(this.kd?this.kd.toString():"null")+" --\x3e "+(this.qd?this.qd.toString():"null"))),e},Gd.prototype.gm=function(){var t=this.kd;this.kd=this.qd,this.qd=t},Gd.prototype.commit=function(){},Gd.prototype.Ax=function(t){return this.qd===t?this.kd:this.kd===t?this.qd:null},d.Object.defineProperties(Gd.prototype,{network:{get:function(){return this.nb},set:function(t){this.nb=t}},data:{get:function(){return this.ub},set:function(t){this.ub!==t&&(this.ub=t)}},link:{get:function(){return this.$k},set:function(t){this.$k!==t&&(this.$k=t)}},fromVertex:{get:function(){return this.kd},set:function(t){this.kd!==t&&(this.kd=t)}},toVertex:{get:function(){return this.qd},set:function(t){this.qd!==t&&(this.qd=t)}}}),Gd.prototype.getOtherVertex=Gd.prototype.Ax,Gd.className="LayoutEdge",c(Hd,Bd),Hd.prototype.cloneProtected=function(t){Bd.prototype.cloneProtected.call(this,t),t.zo=this.zo,t.yo=this.yo,t.yg.assign(this.yg),t.tf.assign(this.tf),t.Jb=this.Jb,t.Rb=this.Rb,t.nd=this.nd,t.hd=this.hd},Hd.prototype.qb=function(t){t.classType===Hd?t===$d||t===Jd||t===Kd||t===_d?this.sorting=t:t===qd||t===Wd?this.arrangement=t:t===Ud||t===Xd?this.alignment=t:w("Unknown enum value: "+t):Bd.prototype.qb.call(this,t)},Hd.prototype.doLayout=function(t){this.arrangementOrigin=this.initialOrigin(this.arrangementOrigin);var e=this.ex(t);t=this.diagram;for(var i=e.copy().iterator;i.next();){var n=i.value;if(!n.ph()||null===n.fromNode&&null===n.toNode){if(n.Va(),n instanceof gc)for(n=n.memberParts;n.next();)e.remove(n.value)}else e.remove(n)}var o=e.Fa();if(0!==o.length){switch(this.sorting){case _d:o.reverse();break;case $d:o.sort(this.comparer);break;case Jd:o.sort(this.comparer),o.reverse()}var r=this.wrappingColumn;isNaN(r)&&(r=0);var s=this.wrappingWidth;switch(isNaN(s)&&null!==t?(e=t.padding,s=Math.max(t.viewportBounds.width-e.left-e.right,0)):s=Math.max(this.wrappingWidth,0),0>=r&&0>=s&&(r=1),e=this.spacing.width,isFinite(e)||(e=0),i=this.spacing.height,isFinite(i)||(i=0),null!==t&&t.Ea("Layout"),n=[],this.alignment){case Xd:var a=e,h=i,l=jt.alloc(),u=Math.max(this.cellSize.width,1);if(!isFinite(u))for(var c=u=0;c<o.length;c++){var d=this.ni(o[c],l);u=Math.max(u,d.width)}if(u=Math.max(u+a,1),c=Math.max(this.cellSize.height,1),!isFinite(c))for(d=c=0;d<o.length;d++){var f=this.ni(o[d],l);c=Math.max(c,f.height)}c=Math.max(c+h,1),d=this.arrangement;for(var p=f=this.arrangementOrigin.x,g=this.arrangementOrigin.y,m=0,y=0,v=0;v<o.length;v++){var x=o[v],b=this.ni(x,l),w=Math.ceil((b.width+a)/u)*u,k=Math.ceil((b.height+h)/c)*c;if(d===Wd)var S=Math.abs(p-b.width);else S=p+b.width;if((0<r&&m>r-1||0<s&&0<m&&S-f>s)&&(n.push(new jt(0,g,s+a,y)),m=0,p=f,g+=y,y=0),y=Math.max(y,k),d===Wd)b=-b.width;else b=0;if(x.moveTo(p+b,g),d===Wd)p-=w;else p+=w;m++}n.push(new jt(0,g,s+a,y)),jt.free(l);break;case Ud:for(h=s,u=r,c=e,d=i,s=jt.alloc(),f=Math.max(this.cellSize.width,1),r=g=l=0,a=pt.alloc(),p=0;p<o.length;p++)y=o[p],m=this.ni(y,s),y=Tu(y,y.locationObject,y.locationSpot,a),l=Math.max(l,y.x),g=Math.max(g,m.width-y.x),r=Math.max(r,y.y);if((p=this.arrangement)===Wd)l+=c;else g+=c;f=isFinite(f)?Math.max(f+c,1):Math.max(l+g,1);var M=y=this.arrangementOrigin.x;for(v=this.arrangementOrigin.y,g=0,h>=l&&(h-=l),l=x=0,w=Math.max(this.cellSize.height,1),b=r=0,k=!0,m=pt.alloc(),S=0;S<o.length;S++){var C=o[S],P=this.ni(C,s),T=Tu(C,C.locationObject,C.locationSpot,a);if(0<g)if(p===Wd)M=(M-y-(P.width-T.x))/f,M=(M=Ye.$(Math.round(M),M)?Math.round(M):Math.floor(M))*f+y;else M=(M-y+T.x)/f,M=(M=Ye.$(Math.round(M),M)?Math.round(M):Math.ceil(M))*f+y;else if(p===Wd)x=M+T.x+P.width;else x=M-T.x;if(p===Wd)var N=-(M+T.x)+x;else N=M+P.width-T.x-x;if(0<u&&g>u-1||0<h&&0<g&&N>h){for(n.push(new jt(0,k?v-r:v,h+c,b+r+d)),M=0;M<g&&S!==g;M++){var L=Tu(N=o[S-g+M],N.locationObject,N.locationSpot,m);N.moveTo(N.position.x,N.position.y+r-L.y)}b+=d,v=k?v+b:v+(b+r),g=b=r=0,M=y,k=!1}if(M===y&&(l=p===Wd?Math.max(l,P.width-T.x):Math.min(l,-T.x)),r=Math.max(r,T.y),b=Math.max(b,P.height-T.y),isFinite(w)&&(b=Math.max(b,Math.max(P.height,w)-T.y)),k?C.moveTo(M-T.x,v-T.y):C.moveTo(M-T.x,v),p===Wd)M-=T.x+c;else M+=P.width-T.x+c;g++}if(n.push(new jt(0,v,h+c,(k?b:b+r)+d)),o.length!==g)for(h=0;h<g;h++)c=Tu(u=o[o.length-g+h],u.locationObject,u.locationSpot,a),u.moveTo(u.position.x,u.position.y+r-c.y);if(pt.free(a),pt.free(m),p===Wd)for(o=0;o<n.length;o++)(r=n[o]).width+=l,r.x-=l;else for(o=0;o<n.length;o++)(r=n[o]).x>l&&(r.width+=r.x-l,r.x=l);jt.free(s)}for(a=r=s=o=0;a<n.length;a++)h=n[a],o=Math.min(o,h.x),s=Math.min(s,h.y),r=Math.max(r,h.x+h.width);this.arrangement===Wd?this.commitLayers(n,new pt(o+e/2-(r+o),s-i/2)):this.commitLayers(n,new pt(o-e/2,s-i/2)),null!==t&&t.eb("Layout"),this.isValidLayout=!0}},Hd.prototype.commitLayers=function(){},d.Object.defineProperties(Hd.prototype,{wrappingWidth:{get:function(){return this.zo},set:function(t){this.zo!==t&&(0<t||isNaN(t))&&(this.zo=t,this.isViewportSized=isNaN(t),this.C())}},wrappingColumn:{get:function(){return this.yo},set:function(t){this.yo!==t&&(0<t||isNaN(t))&&(this.yo=t,this.C())}},cellSize:{get:function(){return this.yg},set:function(t){this.yg.D(t)||(this.yg.assign(t),this.C())}},spacing:{get:function(){return this.tf},set:function(t){this.tf.D(t)||(this.tf.assign(t),this.C())}},alignment:{get:function(){return this.Jb},set:function(t){this.Jb===t||t!==Ud&&t!==Xd||(this.Jb=t,this.C())}},arrangement:{get:function(){return this.Rb},set:function(t){this.Rb===t||t!==qd&&t!==Wd||(this.Rb=t,this.C())}},sorting:{get:function(){return this.nd},set:function(t){this.nd===t||t!==Kd&&t!==_d&&t!==$d&&t!==Jd||(this.nd=t,this.C())}},comparer:{get:function(){return this.hd},set:function(t){this.hd!==t&&(this.hd=t,this.C())}}});var Xd=new V(Hd,"Position",0),Ud=new V(Hd,"Location",1),qd=new V(Hd,"LeftToRight",2),Wd=new V(Hd,"RightToLeft",3),Kd=new V(Hd,"Forward",4),_d=new V(Hd,"Reverse",5),$d=new V(Hd,"Ascending",6),Jd=new V(Hd,"Descending",7);function Zd(){this.On=new Z,this.Dn=new Z,this.Pa=new Z,this.cf=new ft,this.bf=new ft,this.aj=new ft,this.H=null,this.tp=!1}function Qd(t,e,i){if(null!=e&&!t.diagram.undoManager.isUndoingRedoing&&!t.cf.contains(e)){void 0===i&&(i=!0);t:{if(null!=e&&!t.H.undoManager.isUndoingRedoing&&!t.cf.contains(e)){var n=t.Ro(e),o=tf(t,e,n);if(null!==o&&(Kh(o),null!==(o=o.copy()))){var r=t.diagram.skipsModelSourceBindings;t.diagram.skipsModelSourceBindings=!0,o.Tf=n,o.ub=e,t.tp&&(o.Jg="Tool"),t.diagram.add(o),o.ub=null,o.data=e,t.diagram.skipsModelSourceBindings=r,n=o;break t}}n=null}null!==n&&i&&t.resolveReferencesForData(e)}}function tf(t,e,i){var n=(t=t.H).model;return n.Xj()&&n.Yu(e)?null===(e=t.groupTemplateMap.I(i))&&(null===(e=t.groupTemplateMap.I(""))&&(hf||(hf=!0,M('No Group template found for category "'+i+'"'),M(" Using default group template")),e=t.ly)):null===(e=t.nodeTemplateMap.I(i))&&(null===(e=t.nodeTemplateMap.I(""))&&(af||(af=!0,M('No Node template found for category "'+i+'"'),M(" Using default node template")),e=t.ny)),e}function ef(t,e,i){for(var n in i){var o=e[n],r=i[n];if(P(r)){if(!P(o)||o.length<r.length)return!1;for(var s=0;s<o.length;s++){var a=r[s];if(void 0!==a&&!nf(t,o[s],a))return!1}}else if(!nf(t,o,r))return!1}return!0}function nf(t,e,i){if("function"==typeof i){if(!i(e))return!1}else if(i instanceof RegExp){if(!e||!i.test(e.toString()))return!1}else if(C(e)&&C(i)){if(!ef(t,e,i))return!1}else if(e!==i)return!1;return!0}function of(t,e){var i=e.Hh;if(P(i)){var n=t.aj.I(i);if(null===n)(n=[]).push(e),t.aj.add(i,n);else{for(t=0;t<n.length;t++)if(n[t]===e)return;n.push(e)}}}function rf(t,e,i){jh(e,(function(t){for(var e=(t=t.O.s).length,n=0;n<e;n++)wr(i,t[n])}));var n=e.Hh;if(P(n)){var o=t.aj.I(n);if(null!==o)for(var r=0;r<o.length;r++)if(o[r]===e){o.splice(r,1),0===o.length&&t.aj.remove(n);break}}}function sf(t,e,i,n,o){if(null===e||o&&!e.canCopy())return null;if(n.contains(e))return n.I(e);var r=t.copyPartData(e,i);if(!(r instanceof ku))return null;if(r.isSelected=!1,r.isHighlighted=!1,n.add(e,r),e instanceof _u){for(var s=e.linksConnected;s.next();){var a=s.value;if(a.fromNode===e){var h=n.I(a);null!==h&&(h.fromNode=r)}a.toNode===e&&(null!==(a=n.I(a))&&(a.toNode=r))}if(e instanceof gc&&r instanceof gc)for(e=e.memberParts;e.next();)(s=sf(t,e.value,i,n,o))instanceof wc||null===s||(s.containingGroup=r)}else if(e instanceof wc&&r instanceof wc)for(null!==(s=e.fromNode)&&(null!==(s=n.I(s))&&(r.fromNode=s)),null!==(s=e.toNode)&&(null!==(s=n.I(s))&&(r.toNode=s)),e=e.labelNodes;e.next();)null!==(s=sf(t,e.value,i,n,o))&&s instanceof _u&&(s.labeledLink=r);return r}Hd.className="GridLayout",Hd.standardComparer=Yd,Hd.smartComparer=function(t,e){if(null!==t){if(null!==e){t=t.text.toLocaleLowerCase().split(/([+-]?[.]?\d+(?:\.\d*)?(?:e[+-]?\d+)?)/),e=e.text.toLocaleLowerCase().split(/([+-]?[.]?\d+(?:\.\d*)?(?:e[+-]?\d+)?)/);for(var i=0;i<t.length;i++)if(""!==e[i]&&void 0!==e[i]){var n=parseFloat(t[i]),o=parseFloat(e[i]);if(isNaN(n)){if(!isNaN(o))return 1;if(0!==t[i].localeCompare(e[i]))return t[i].localeCompare(e[i])}else{if(isNaN(o))return-1;if(0!=n-o)return n-o}}else if(""!==t[i])return 1;return""!==e[i]&&void 0!==e[i]?-1:0}return 1}return null!==e?-1:0},Hd.Position=Xd,Hd.Location=Ud,Hd.LeftToRight=qd,Hd.RightToLeft=Wd,Hd.Forward=Kd,Hd.Reverse=_d,Hd.Ascending=$d,Hd.Descending=Jd,(e=Zd.prototype).clear=function(){this.On.clear(),this.Dn.clear(),this.Pa.clear(),this.cf.clear(),this.bf.clear(),this.aj.clear()},e.Xe=function(t){this.H=t},e.oi=function(t){if(t instanceof _u){if(this.On.add(t),t instanceof gc){var e=t.containingGroup;null===e?this.H.ai.add(t):e.gl.add(t),null!==(e=t.layout)&&(e.diagram=this.H)}}else t instanceof wc?this.Dn.add(t):t instanceof Wu||this.Pa.add(t);null===(e=t.data)||t instanceof Wu||(t instanceof wc?this.bf.add(e,t):this.cf.add(e,t))},e.pc=function(t){if(t.Ej(),t instanceof _u){if(this.On.remove(t),t instanceof gc){var e=t.containingGroup;null===e?this.H.ai.remove(t):e.gl.remove(t),null!==(e=t.layout)&&(e.diagram=null)}}else t instanceof wc?this.Dn.remove(t):t instanceof Wu||this.Pa.remove(t);null===(e=t.data)||t instanceof Wu||(t instanceof wc?this.bf.remove(e):this.cf.remove(e))},e.Wd=function(){var t=this.H;if(null!==t){for(var e=t.nodeTemplateMap.iterator;e.next();){var i=e.value,n=e.key;(!i.Zc()||i instanceof gc)&&w('Invalid node template in Diagram.nodeTemplateMap: template for "'+n+'" must be a Node or a simple Part, not a Group or Link: '+i)}for(e=t.groupTemplateMap.iterator;e.next();)i=e.value,n=e.key,i instanceof gc||w('Invalid group template in Diagram.groupTemplateMap: template for "'+n+'" must be a Group, not a normal Node or Link: '+i);for(e=t.linkTemplateMap.iterator;e.next();)i=e.value,n=e.key,i instanceof wc||w('Invalid link template in Diagram.linkTemplateMap: template for "'+n+'" must be a Link, not a normal Node or simple Part: '+i);for(e=A(),i=t.selection.iterator;i.next();)(n=i.value.data)&&e.push(n);for(i=A(),t=t.highlighteds.iterator;t.next();)(n=t.value.data)&&i.push(n);for(t=A(),n=this.nodes.iterator;n.next();){var o=n.value;null!==o.data&&(t.push(o.data),t.push(o.location))}for(n=this.links.iterator;n.next();)null!==(o=n.value).data&&(t.push(o.data),t.push(o.location));for(n=this.parts.iterator;n.next();)null!==(o=n.value).data&&(t.push(o.data),t.push(o.location));for(this.removeAllModeledParts(),this.addAllModeledParts(),n=0;n<e.length;n++)null!==(o=this.Lc(e[n]))&&(o.isSelected=!0);for(n=0;n<i.length;n++)null!==(o=this.Lc(i[n]))&&(o.isHighlighted=!0);for(n=0;n<t.length;n+=2)null!==(o=this.Lc(t[n]))&&(o.location=t[n+1]);B(e),B(i),B(t)}},Zd.prototype.addAllModeledParts=function(){this.addModeledParts(this.diagram.model.nodeDataArray)},Zd.prototype.addModeledParts=function(t,e){var i=this,n=this.diagram.model;t.forEach((function(t){n.lb(t)&&Qd(i,t,!1)})),t.forEach((function(t){n.lb(t)&&i.resolveReferencesForData(t)})),!1!==e&&Mr(this.diagram,!1)},Zd.prototype.insertLink=function(){return null},Zd.prototype.resolveReferencesForData=function(){},Zd.prototype.Ro=function(t){return this.H.model.Ro(t)},Zd.prototype.getLinkCategoryForData=function(){return""},Zd.prototype.setLinkCategoryForData=function(){},Zd.prototype.setFromNodeForLink=function(){},Zd.prototype.setToNodeForLink=function(){},Zd.prototype.findLinkTemplateForCategory=function(t){var e=this.H,i=e.linkTemplateMap.I(t);return null===i&&(null===(i=e.linkTemplateMap.I(""))&&(lf||(lf=!0,M('No Link template found for category "'+t+'"'),M(" Using default link template")),i=e.my)),i},Zd.prototype.removeAllModeledParts=function(){this.Gs(this.diagram.model.nodeDataArray)},Zd.prototype.Gs=function(t){var e=this;t.forEach((function(t){e.ip(t)}))},Zd.prototype.ip=function(t){null!==(t=this.Lc(t))&&(ar(this.diagram,t,!1),this.unresolveReferencesForPart(t))},Zd.prototype.unresolveReferencesForPart=function(){},Zd.prototype.removeDataForLink=function(){},Zd.prototype.findPartForKey=function(t){return null==t?null:null!==(t=this.H.model.hc(t))?this.cf.I(t):null},Zd.prototype.Vb=function(t){return null==t||null===(t=this.H.model.hc(t))?null:(t=this.cf.I(t))instanceof _u?t:null},Zd.prototype.findLinkForKey=function(){return null},(e=Zd.prototype).Lc=function(t){if(null===t)return null;var e=this.cf.I(t);return null!==e?e:e=this.bf.I(t)},e.ii=function(t){return null===t?null:(t=this.cf.I(t))instanceof _u?t:null},e.Kc=function(t){return null===t?null:this.bf.I(t)},e.ms=function(t){for(var e=0;e<arguments.length;++e);e=new Z;for(var i=this.On.iterator;i.next();){var n=i.value,o=n.data;if(null!==o)for(var r=0;r<arguments.length;r++){var s=arguments[r];if(C(s)&&ef(this,o,s)){e.add(n);break}}}return e.iterator},e.ls=function(t){for(var e=0;e<arguments.length;++e);e=new Z;for(var i=this.Dn.iterator;i.next();){var n=i.value,o=n.data;if(null!==o)for(var r=0;r<arguments.length;r++){var s=arguments[r];if(C(s)&&ef(this,o,s)){e.add(n);break}}}return e.iterator},Zd.prototype.doModelChanged=function(t){if(this.H){var e=this.H;if(t.model===e.model){var i=t.change;if(e.doModelChanged(t),e.aa){e.aa=!1;try{var n=t.modelChange;if(""!==n)if(i===di){if("nodeCategory"===n){var o=this.Lc(t.object),r=t.newValue;null!==o&&"string"==typeof r&&(o.category=r)}else"nodeDataArray"===n&&(this.Gs(t.oldValue),this.addModeledParts(t.newValue));e.isModified=!0}else if(i===fi){var s=t.newValue;"nodeDataArray"===n&&C(s)&&Qd(this,s),e.isModified=!0}else if(i===pi){var a=t.oldValue;"nodeDataArray"===n&&C(a)&&this.ip(a),e.isModified=!0}else i===ci&&("SourceChanged"===n?null!==t.object?this.updateDataBindings(t.object,t.propertyName):(this.rp(),this.updateAllTargetBindings()):"ModelDisplaced"===n&&this.Wd());else if(i===di){var h=t.propertyName,l=t.object;l===e.model?"nodeKeyProperty"!==h&&"nodeCategoryProperty"!==h||e.undoManager.isUndoingRedoing||this.Wd():this.updateDataBindings(l,h),e.isModified=!0}else if(i===fi||i===pi){var u=t.change===fi,c=u?t.newParam:t.oldParam,d=u?t.newValue:t.oldValue,f=this.aj.I(t.object);if(Array.isArray(f))for(t=0;t<f.length;t++){var p=f[t];if(u)Jh(p,d,c,!0);else if(!(0>c)){var g=c+_h(p);p.pc(g,!0),Zh(p,g,c)}}e.isModified=!0}}finally{e.aa=!0}}}}},Zd.prototype.updateAllTargetBindings=function(t){void 0===t&&(t="");for(var e=this.parts.iterator;e.next();)e.value.La(t);for(e=this.nodes.iterator;e.next();)e.value.La(t);for(e=this.links.iterator;e.next();)e.value.La(t)},Zd.prototype.rp=function(){for(var t=this.H.model,e=new Z,i=t.nodeDataArray,n=0;n<i.length;n++)e.add(i[n]);var o=[];for(this.nodes.each((function(t){null===t.data||e.contains(t.data)||o.push(t.data)})),this.parts.each((function(t){null===t.data||e.contains(t.data)||o.push(t.data)})),o.forEach((function(e){Af(t,e,!1)})),n=0;n<i.length;n++){var r=i[n];null===this.Lc(r)&&Lf(t,r,!1)}for(this.refreshDataBoundLinks(),i=this.parts.iterator;i.next();)i.value.updateRelationshipsFromData();for(i=this.nodes.iterator;i.next();)i.value.updateRelationshipsFromData();for(i=this.links.iterator;i.next();)i.value.updateRelationshipsFromData()},Zd.prototype.refreshDataBoundLinks=function(){},Zd.prototype.updateRelationshipsFromData=function(){},Zd.prototype.updateDataBindings=function(t,e){if("string"==typeof e){var i=this.Lc(t);if(null!==i)i.La(e);else{i=null;for(var n=this.aj.iterator;n.next();){for(var o=n.value,r=0;r<o.length;r++){var s=o[r].sx(t);null!==s&&(null===i&&(i=A()),i.push(s))}if(null!==i)break}if(null!==i){for(n=0;n<i.length;n++)i[n].La(e);B(i)}}t===this.diagram.model.modelData&&this.updateAllTargetBindings(e)}},Zd.prototype.Kj=function(t,e,i){void 0===i&&(i=!1);var n=new ft;if(P(t))for(var o=0;o<t.length;o++)sf(this,t[o],e,n,i);else for(t=t.iterator;t.next();)sf(this,t.value,e,n,i);if(null!==e){i=e.model,t=null!==(t=e.toolManager.findTool("Dragging"))?t.dragOptions.dragsLink:e.Wm.dragsLink,o=new Z;for(var r=new ft,s=n.iterator;s.next();){var a=s.value;if(a instanceof wc)t||null!==a.fromNode&&null!==a.toNode||o.add(a);else if(a instanceof _u&&null!==a.data&&i.Tl()){var h=a,l=(a=s.key).pg();null!==l&&(null!==(l=n.I(l))?(i.qe(h.data,i.wa(l.data)),h=e.Kc(h.data),null!==(a=a.kh())&&null!==h&&r.add(a,h)):i.qe(h.data,void 0))}}if(0<o.count&&e.Is(o,!1),0<r.count)for(i=r.iterator;i.next();)n.add(i.key,i.value)}if(null!==e&&null!==this.H&&null!==(i=(e=e.model).afterCopyFunction)){var u=new ft;n.each((function(t){null!==t.key.data&&u.add(t.key.data,t.value.data)})),i(u,e,this.H.model)}for(e=n.iterator;e.next();)e.value.La();return n},Zd.prototype.copyPartData=function(t,e){var i=null,n=t.data;if(null!==n&&null!==e){var o=e.model;t instanceof wc||C(n=o.copyNodeData(n))&&(o.xf(n),i=e.Lc(n))}else Kh(t),null!==(i=t.copy())&&(o=this.H,null!==e?e.add(i):null!==n&&null!==o&&null!==o.commandHandler&&o.commandHandler.copiesClipboardData&&(e=o.model,o=null,i instanceof wc||(o=e.copyNodeData(n)),C(o)&&(i.data=o)));return i},d.Object.defineProperties(Zd.prototype,{nodes:{get:function(){return this.On}},links:{get:function(){return this.Dn}},parts:{get:function(){return this.Pa}},diagram:{get:function(){return this.H}},addsToTemporaryLayer:{get:function(){return this.tp},set:function(t){this.tp=t}}}),Zd.prototype.updateAllRelationshipsFromData=Zd.prototype.rp,Zd.prototype.findLinksByExample=Zd.prototype.ls,Zd.prototype.findNodesByExample=Zd.prototype.ms,Zd.prototype.findLinkForData=Zd.prototype.Kc,Zd.prototype.findNodeForData=Zd.prototype.ii,Zd.prototype.findPartForData=Zd.prototype.Lc,Zd.prototype.findNodeForKey=Zd.prototype.Vb,Zd.prototype.removeModeledPart=Zd.prototype.ip,Zd.prototype.removeModeledParts=Zd.prototype.Gs,Zd.prototype.rebuildParts=Zd.prototype.Wd;var af=!1,hf=!1,lf=!1;function uf(t){Zd.apply(this,arguments)}function cf(t,e){e.forEach((function(e){df(t,e)})),Mr(t.diagram,!1)}function df(t,e){if(null!=e&&!t.diagram.undoManager.isUndoingRedoing&&!t.bf.contains(e)){var i=t.getLinkCategoryForData(e),n=t.findLinkTemplateForCategory(i);if(null!==n){Kh(n);var o=n.copy();if(null!==o){n=t.diagram.skipsModelSourceBindings,t.diagram.skipsModelSourceBindings=!0,o.Tf=i,o.ub=e;var r=Jf(i=t.diagram.model,e,!0);""!==r&&(o.fromPortId=r),void 0!==(r=_f(i,e,!0))&&((r=t.Vb(r))instanceof _u&&(o.fromNode=r)),""!==(r=Jf(i,e,!1))&&(o.toPortId=r),void 0!==(r=_f(i,e,!1))&&((r=t.Vb(r))instanceof _u&&(o.toNode=r)),i=i.Ef(e),Array.isArray(i)&&i.forEach((function(e){null!==(e=t.Vb(e))&&(e.labeledLink=o)})),t.tp&&(o.Jg="Tool"),t.diagram.add(o),o.ub=null,o.data=e,t.diagram.skipsModelSourceBindings=n}}}}function ff(t,e){e.forEach((function(e){t.ip(e)}))}function pf(){Zd.apply(this,arguments),this.Sg=null}function gf(t,e,i){if(null!==e&&null!==i&&null===i.kh()){var n=t.diagram.toolManager.findTool("Linking"),o=e,r=i;if(t.diagram.isTreePathToChildren||(o=i,r=e),(null===n||!$i(n,o,r,null,!0))&&(e=t.getLinkCategoryForData(i.data),null!==(n=t.findLinkTemplateForCategory(e))&&(Kh(n),null!==(n=n.copy())))){var s=t.diagram.skipsModelSourceBindings;t.diagram.skipsModelSourceBindings=!0,n.Tf=e,n.ub=i.data,n.fromNode=o,n.toNode=r,t.diagram.add(n),n.ub=null,n.data=i.data,t.diagram.skipsModelSourceBindings=s}}}function mf(t,e){this.kl=new Z,this.il=new Z,this.Wv=',\n "insertedNodeKeys": ',this.jy=',\n "modifiedNodeData": ',this.Yv=',\n "removedNodeKeys": ',this.vh=null,Q(this),this.Sm=this.xa="",this.Gg=!1,this.j={},this.Tc=[],this.kb=new ft,this.Th="key",this.Bk=this.bl=null,this.Jm=this.Km=!1,this.Mm=!0,this.xm=null,this.lj="category",this.Vf=new ft,this.Lt=new $,this.Wg=!1,this.o=null,this.undoManager=new mi,void 0!==t&&(P(t)?this.nodeDataArray=t:e=t),e&&(Object.assign(this,e),t=e.Changed)&&(delete this.Changed,this.Pe(t))}function yf(t,e,i,n,o,r){function s(t,i){a?(void 0===t.__gohashid&&r.push(t),n.set(t,i)):(t=at++,n.set(t,i),o.set(t,e))}if(!C(e))return e;r||(r=[]);var a=Object.isExtensible(e);if(n||(n=new ft),a){var h=n.get(e);if(h)return h}else for(o||(o=new ft),h=o.iterator;h.next();){var l=h.key;if(h.value===e&&(l=n.get(l)))return l}if(Array.isArray(e)){s(e,h=[]);for(var u=0;u<e.length;u++)h.push(yf(t,e[u],!1,n,o,r))}else if(e instanceof pt||e instanceof At||e instanceof jt||e instanceof Kt||e instanceof Oe)h=e.copy(),s(e,h);else{if(e instanceof Oa||e instanceof Xe||e instanceof V)return e;if(e instanceof $)h=(new $).addAll(yf(t,e.Fa(),!1,n,o,r)),s(e,h);else if(e instanceof Z)h=(new Z).addAll(yf(t,e.Fa(),!1,n,o,r)),s(e,h);else if(e instanceof ft)h=(new ft).addAll(yf(t,e.Fa(),!1,n,o,r)),s(e,h);else if(e instanceof Date)h=new Date(e.getTime()),s(e,h);else if(e instanceof RegExp)h=new RegExp(e),s(e,h),h.lastIndex=e.lastIndex;else if("function"==typeof e.copy)h=e.copy(),s(e,h);else for(u in s(e,h={}),e)"__gohashid"!==u&&(h[u]=yf(t,e[u],!1,n,o,r))}return i&&r.forEach((function(t){delete t.__gohashid})),h}function vf(t,e){C(e=e.modelData)&&(t.dm(e),t.modelData=e)}function xf(t,e){function i(t,e){if((e=e.part)&&t!==(e=e.data)){var i=n.get(t);null===i?((i=new Z).add(e),n.add(t,i)):i.add(e)}}var n=t.vh;null===n&&(n=new ft,e.changes.each((function(t){if(null!==t.diagram){var e=t.change;e===di?(t=t.object.panel)&&(e=t.data)&&i(e,t):e!==fi&&e!==pi||(e=(t=t.object).itemArray)&&i(e,t)}})),t.vh=n)}function bf(t,e){for(var i=new Z,n=0;n<t.nodeDataArray.length;n++){var o=t.nodeDataArray[n];wf(t,e,o,o,i)}return i}function wf(t,e,i,n,o){if(Array.isArray(i))for(var r=0;r<i.length;r++){var s=i[r];if(s===e)return o.add(n),!0;if(wf(t,e,s,n,o))return!0}else if(C(i)&&Object.getPrototypeOf(i)===Object.prototype)for(r in i){if((s=i[r])===e)return o.add(n),!0;if(wf(t,e,s,n,o))return!0}return!1}function kf(t,e,i){void 0===i&&(i=!1);var n=e.length;if(0>=n)return"[]";var o=new H;o.add("["),i&&1<n&&o.add("\n");for(var r=0;r<n;r++){var s=e[r];void 0!==s&&(0<r&&(o.add(","),i&&o.add("\n")),o.add(t.sm(s)))}return i&&1<n&&o.add("\n"),o.add("]"),o.toString()}function Sf(t,e){return void 0===e||"__gohashid"===t||"_"===t[0]||"function"==typeof e}function Mf(t){return isNaN(t)?"NaN":1/0===t?"9e9999":-1/0===t?"-9e9999":t}function Cf(t,e){var i=e;if(i instanceof pt)e={class:"go.Point",x:Mf(i.x),y:Mf(i.y)};else if(i instanceof At)e={class:"go.Size",width:Mf(i.width),height:Mf(i.height)};else if(i instanceof jt)e={class:"go.Rect",x:Mf(i.x),y:Mf(i.y),width:Mf(i.width),height:Mf(i.height)};else if(i instanceof Kt)e={class:"go.Margin",top:Mf(i.top),right:Mf(i.right),bottom:Mf(i.bottom),left:Mf(i.left)};else if(i instanceof Oe)e=i.sb()?{class:"go.Spot",x:Mf(i.x),y:Mf(i.y),offsetX:Mf(i.offsetX),offsetY:Mf(i.offsetY)}:{class:"go.Spot",enum:i.toString()};else if(i instanceof Oa){if(e={class:"go.Brush",type:i.type.name},i.type===$a?e.color=i.color:i.type!==Ja&&i.type!==Za||(e.start=i.start,e.end=i.end,i.type===Za&&(0!==i.startRadius&&(e.startRadius=Mf(i.startRadius)),isNaN(i.endRadius)||(e.endRadius=Mf(i.endRadius)))),null!==i.colorStops){var n={};for(i=i.colorStops.iterator;i.next();)n[i.key]=i.value;e.colorStops=n}}else i instanceof Xe?(e={class:"go.Geometry",type:i.type.name},0!==i.startX&&(e.startX=Mf(i.startX)),0!==i.startY&&(e.startY=Mf(i.startY)),0!==i.endX&&(e.endX=Mf(i.endX)),0!==i.endY&&(e.endY=Mf(i.endY)),i.spot1.D(te)||(e.spot1=i.spot1),i.spot2.D(he)||(e.spot2=i.spot2),i.type===Xe.o&&(e.path=Xe.ia(i))):i instanceof V&&(e={class:"go.EnumValue",classType:Of(t,i.classType),name:i.name});for(var o in n="{",i=!0,e){var r=zf(e,o);if(!Sf(o,r))if(i?i=!1:n+=",",n+=t.quote(o)+":","points"===o&&r instanceof $){var s="[";for(r=r.iterator;r.next();){var a=r.value;1<s.length&&(s+=","),s+=t.sm(a.x),s+=",",s+=t.sm(a.y)}n+=s+="]"}else n+=t.sm(r)}return n+"}"}function Pf(t){return"number"==typeof t?t:"NaN"===t?NaN:"9e9999"===t?1/0:"-9e9999"===t?-1/0:parseFloat(t)}function Tf(t,e,i,n,o,r,s,a,h){void 0===a&&(a=null),void 0===h&&(h=null);var l=new ui;l.model=t,l.change=i,l.modelChange=e,l.propertyName=n,l.object=o,l.oldValue=r,l.oldParam=a,l.newValue=s,l.newParam=h,t.ds(l)}function Nf(t){return"number"==typeof t||"string"==typeof t}function Lf(t,e,i){var n=t.wa(e);void 0!==n&&t.kb.I(n)===e||(t.$u(e),void 0===(n=t.wa(e))&&w("Model.makeNodeDataKeyUnique failed on "+e+". Data not added to Model."),t.kb.add(n,e),n=null,i&&(n=t.Tc.length,N(t.Tc,n,e)),Tf(t,"nodeDataArray",fi,"nodeDataArray",t,null,e,null,n),t.fm(e),t.em(e))}function Af(t,e,i){var n=t.wa(e);if(void 0!==n&&t.kb.remove(n),n=null,i){t:if(i=t.Tc,Array.isArray(i))n=i.indexOf(e);else{n=i.length;for(var o=0;o<n;o++)if(i[o]===e){n=o;break t}n=-1}if(0>n)return;L(t.Tc,n)}Tf(t,"nodeDataArray",pi,"nodeDataArray",t,e,null,n,null),t.qp(e)}function Bf(t,e,i){if(void 0!==e){var n=t.Vf.I(e);null===n&&(n=new Z,t.Vf.add(e,n)),n.add(i)}}function Df(t,e,i){if(void 0!==e){var n=t.Vf.I(e);n instanceof Z&&(null==i?t.Vf.remove(e):(n.remove(i),0===n.count&&t.Vf.remove(e)))}}function Ff(t,e){return void 0===e?null:(t=t.Vf.I(e))instanceof Z?t:null}function jf(t,e,i){if(t.copiesArrays&&Array.isArray(e)){var n=[];for(i=0;i<e.length;i++){var o=jf(t,e[i],t.copiesArrayObjects);n.push(o)}return Q(n),n}if(i&&C(e)){for(n in i=(i=e.constructor)?new i:{},o=t.copiesKey||"string"!=typeof t.nodeKeyProperty?null:t.nodeKeyProperty,e)if("__gohashid"===n)i.__gohashid=void 0;else if(n===o)i[o]=void 0;else{var r=zf(e,n),s=Of(t,r);"GraphObject"===s||"Diagram"===s||"Layer"===s||"RowColumnDefinition"===s||"AnimationManager"===s||"Tool"===s||"CommandHandler"===s||"Layout"===s||"InputEvent"===s||"DiagramEvent"===s||r instanceof mf||r instanceof mi||r instanceof gi||r instanceof ui||(r=jf(t,r,!1)),Rf(i,n,r)}return Q(i),i}return e instanceof pt||e instanceof At||e instanceof jt||e instanceof Oe||e instanceof Kt?e.copy():e}function Ef(){return new mf}function Of(t,e){if("function"==typeof e){if(e.className)return e.className;if(e.name)return e.name}else if("object"==typeof e&&null!==e&&e.constructor)return Of(t,e.constructor);return typeof e}function If(t){return Gf[t]?Gf[t]:void 0!==m.go&&m.go[t]?m.go[t]:null}function zf(t,e){if(!t||!e)return null;try{if("function"==typeof e)var i=e(t);else"function"==typeof t.getAttribute?null===(i=t.getAttribute(e))&&(i=void 0):i=t[e]}catch(t){}return i}function Rf(t,e,i){if(t&&e)try{"function"==typeof e?e(t,i):"function"==typeof t.setAttribute?t.setAttribute(e,i):t[e]=i}catch(t){}}Zd.className="PartManager",c(uf,Zd),uf.prototype.addAllModeledParts=function(){var t=this.diagram.model;this.addModeledParts(t.nodeDataArray),cf(this,t.linkDataArray)},uf.prototype.addModeledParts=function(t){for(Zd.prototype.addModeledParts.call(this,t,!1),t=this.links.iterator;t.next();)kc(t.value);Mr(this.diagram,!1)},uf.prototype.removeAllModeledParts=function(){var t=this.diagram.model;ff(this,t.linkDataArray),this.Gs(t.nodeDataArray)},uf.prototype.getLinkCategoryForData=function(t){return this.diagram.model.ps(t)},uf.prototype.setLinkCategoryForData=function(t,e){return this.diagram.model.lp(t,e)},uf.prototype.setFromNodeForLink=function(t,e){var i=this.diagram.model;i.wv(t.data,i.wa(null!==e?e.data:null))},uf.prototype.setToNodeForLink=function(t,e){var i=this.diagram.model;i.Bv(t.data,i.wa(null!==e?e.data:null))},uf.prototype.removeDataForLink=function(t){this.diagram.model.bm(t.data)},uf.prototype.findPartForKey=function(t){var e=Zd.prototype.findPartForKey.call(this,t);return null===e&&null!==(t=this.diagram.model.jh(t))?this.bf.I(t):e},uf.prototype.findLinkForKey=function(t){return null==t?null:null!==(t=this.diagram.model.jh(t))?this.bf.I(t):null},uf.prototype.doModelChanged=function(t){var e=this;if(Zd.prototype.doModelChanged.call(this,t),this.diagram){var i=this.diagram;if(t.model===i.model){var n=t.change;if(i.aa){i.aa=!1;try{var o=t.modelChange;if(""!==o){if(n===di){if("linkFromKey"===o){var r=this.Kc(t.object);if(null!==r){var s=this.Vb(t.newValue);r.fromNode=s}}else if("linkToKey"===o){var a=this.Kc(t.object);if(null!==a){var h=this.Vb(t.newValue);a.toNode=h}}else if("linkFromPortId"===o){var l=this.Kc(t.object);if(null!==l){var u=t.newValue;"string"==typeof u&&(l.fromPortId=u)}}else if("linkToPortId"===o){var c=this.Kc(t.object);if(null!==c){var d=t.newValue;"string"==typeof d&&(c.toPortId=d)}}else if("nodeGroupKey"===o){var f=this.Lc(t.object);if(null!==f){var p=t.newValue;if(void 0!==p){var g=this.Vb(p);f.containingGroup=g instanceof gc?g:null}else f.containingGroup=null}}else if("linkLabelKeys"===o){var m=this.Kc(t.object);if(null!==m){var y=t.oldValue,v=t.newValue;Array.isArray(y)&&y.forEach((function(t){0<=v.indexOf(t)||null!==(t=e.Vb(t))&&(t.labeledLink=null)})),Array.isArray(v)&&v.forEach((function(t){null!==(t=e.Vb(t))&&(t.labeledLink=m)}))}}else if("linkCategory"===o){var x=this.Kc(t.object),b=t.newValue;null!==x&&"string"==typeof b&&(x.category=b)}else"linkDataArray"===o&&(ff(this,t.oldValue),cf(this,t.newValue));i.isModified=!0}else if(n===fi){var w=t.newValue;if("linkDataArray"===o&&"object"==typeof w&&null!==w)df(this,w);else if("linkLabelKeys"===o&&Nf(w)){var k=this.Kc(t.object),S=this.Vb(w);null!==k&&null!==S&&(S.labeledLink=k)}i.isModified=!0}else if(n===pi){var M=t.oldValue;if("linkDataArray"===o&&"object"==typeof M&&null!==M)this.ip(M);else if("linkLabelKeys"===o&&Nf(M)){var C=this.Vb(M);null!==C&&(C.labeledLink=null)}i.isModified=!0}}else if(n===di){var P=t.propertyName;t.object!==i.model||"linkFromKeyProperty"!==P&&"linkToKeyProperty"!==P&&"linkFromPortIdProperty"!==P&&"linkToPortIdProperty"!==P&&"linkLabelKeysProperty"!==P&&"nodeIsGroupProperty"!==P&&"nodeGroupKeyProperty"!==P&&"linkCategoryProperty"!==P||i.undoManager.isUndoingRedoing||this.Wd(),i.isModified=!0}}finally{i.aa=!0}}}}},uf.prototype.refreshDataBoundLinks=function(){var t=this,e=this.diagram.model,i=new Z,n=e.linkDataArray;n.forEach((function(t){i.add(t)}));var o=[];this.links.each((function(t){null===t.data||i.contains(t.data)||o.push(t.data)})),o.forEach((function(t){tp(e,t,!1)})),n.forEach((function(i){null===t.Kc(i)&&Qf(e,i,!1)}))},uf.prototype.updateRelationshipsFromData=function(t){var e=t.data;if(null!==e){var i=t.diagram;if(null!==i){var n=i.model;if(t instanceof wc){var o=_f(n,e,!0);if(o=i.Vb(o),t.fromNode=o,o=_f(n,e,!1),o=i.Vb(o),t.toNode=o,0<(e=n.Ef(e)).length||0<t.labelNodes.count){if(1===e.length&&1===t.labelNodes.count){o=e[0];var r=t.labelNodes.first();if(n.wa(r.data)===o)return}o=(new Z).addAll(e);var s=new Z;t.labelNodes.each((function(t){null!==t.data&&(void 0!==(t=n.wa(t.data))&&s.add(t))})),(e=s.copy()).hp(o),(o=o.copy()).hp(s),(0<e.count||0<o.count)&&(e.each((function(e){null!==(e=i.Vb(e))&&e.labeledLink===t&&(e.labeledLink=null)})),o.each((function(e){null!==(e=i.Vb(e))&&e.labeledLink!==t&&(e.labeledLink=t)})))}}else!(t instanceof Wu)&&(e=n.lh(e),null===(e=i.findPartForKey(e))||e instanceof gc)&&(t.containingGroup=e)}}},uf.prototype.resolveReferencesForData=function(t){var e=this.diagram.model,i=e.wa(t);if(void 0!==i){var n=Ff(e,i),o=this.Lc(t);if(null!==n&&null!==o){n=n.iterator;for(var r={};n.next();){var s=n.value;e.lb(s)?o instanceof gc&&e.lh(s)===i&&(null!==(s=this.Lc(s))&&(s.containingGroup=o)):(r.link=this.Kc(s),null!==r.link&&o instanceof _u&&(_f(e,s,!0)===i&&(r.link.fromNode=o),_f(e,s,!1)===i&&(r.link.toNode=o),s=e.Ef(s),Array.isArray(s)&&s.some(function(t){return function(e){return e===i&&(o.labeledLink=t.link,!0)}}(r)))),r={link:r.link}}Df(e,i)}void 0!==(t=e.lh(t))&&((t=this.Vb(t))instanceof gc&&(o.containingGroup=t))}},uf.prototype.unresolveReferencesForPart=function(t){var e=this.diagram.model;if(t instanceof _u){var i=e.wa(t.data);if(void 0!==i){for(var n=t.linksConnected;n.next();)Bf(e,i,n.value.data);if(t.isLinkLabel&&(null!==(n=t.labeledLink)&&Bf(e,i,n.data)),t instanceof gc)for(t=t.memberParts;t.next();)n=t.value.data,e.lb(n)&&Bf(e,i,n)}}},uf.prototype.copyPartData=function(t,e){var i=Zd.prototype.copyPartData.call(this,t,e);if(t instanceof wc)if(null!==(t=t.data)&&null!==e){var n=e.model;"object"==typeof(t=n.Jo(t))&&null!==t&&(n.fi(t),i=e.Kc(t))}else null!==i&&(e=this.diagram,null!==t&&null!==e&&null!==e.commandHandler&&e.commandHandler.copiesClipboardData&&("object"==typeof(e=e.model.Jo(t))&&null!==e&&(i.data=e)));return i},uf.prototype.insertLink=function(t,e,i,n){var o=this.diagram,r=o.model,s=o.toolManager.findTool("Linking"),a="";if(null!==t&&(null===e&&(e=t),null===(a=e.portId)&&(a="")),e="",null!==i&&(null===n&&(n=i),null===(e=n.portId)&&(e="")),(n=s.archetypeLinkData)instanceof wc){if(Kh(n),null!==(r=n.copy()))return r.fromNode=t,r.fromPortId=a,r.toNode=i,r.toPortId=e,o.add(r),(t=s.archetypeLabelNodeData)instanceof _u&&(Kh(t),null!==(t=t.copy())&&(t.labeledLink=r,o.add(t))),r}else if(null!==n&&("object"==typeof(n=r.Jo(n))&&null!==n))return null!==t&&$f(r,n,r.wa(t.data),!0),Zf(r,n,a,!0),null!==i&&$f(r,n,r.wa(i.data),!1),Zf(r,n,e,!1),r.fi(n),null===(t=s.archetypeLabelNodeData)||t instanceof _u||"object"==typeof(t=r.copyNodeData(t))&&null!==t&&(r.xf(t),void 0!==(t=r.wa(t))&&r.Bu(n,t)),o.Kc(n);return null},uf.prototype.findLinkForKey=uf.prototype.findLinkForKey,uf.prototype.findPartForKey=uf.prototype.findPartForKey,uf.prototype.removeAllModeledParts=uf.prototype.removeAllModeledParts,uf.prototype.addModeledParts=uf.prototype.addModeledParts,uf.prototype.addAllModeledParts=uf.prototype.addAllModeledParts,uf.className="GraphLinksPartManager",c(pf,Zd),pf.prototype.getLinkCategoryForData=function(t){return this.diagram.model.ss(t)},pf.prototype.setLinkCategoryForData=function(t,e){this.diagram.model.Ms(t,e)},pf.prototype.setFromNodeForLink=function(t,e,i){var n=this.diagram.model;if(void 0===i&&(i=null),e=null!==e?e.data:null,this.diagram.isTreePathToChildren)n.qe(t.data,n.wa(e));else{var o=this.Sg;this.Sg=t,null!==i&&n.qe(i.data,void 0),n.qe(e,n.wa(null!==t.toNode?t.toNode.data:null)),this.Sg=o}},pf.prototype.setToNodeForLink=function(t,e,i){var n=this.diagram.model;if(void 0===i&&(i=null),e=null!==e?e.data:null,this.diagram.isTreePathToChildren){var o=this.Sg;this.Sg=t,null!==i&&n.qe(i.data,void 0),n.qe(e,n.wa(null!==t.fromNode?t.fromNode.data:null)),this.Sg=o}else n.qe(t.data,n.wa(e))},pf.prototype.removeDataForLink=function(t){this.diagram.model.qe(t.data,void 0)},pf.prototype.findLinkForKey=function(t){return null==t?null:null!==(t=this.diagram.model.hc(t))?this.bf.I(t):null},pf.prototype.doModelChanged=function(t){if(Zd.prototype.doModelChanged.call(this,t),this.diagram){var e=this.diagram;if(t.model===e.model){var i=t.change;if(e.aa){e.aa=!1;try{var n=t.modelChange;if(""!==n){if(i===di){if("nodeParentKey"===n){var o=t.object,r=this.Vb(t.newValue),s=this.ii(o);if(null!==this.Sg)null!==r&&(this.Sg.data=o,this.Sg.category=this.getLinkCategoryForData(o));else if(null!==s){var a=s.kh();null!==a?null===r?e.remove(a):e.isTreePathToChildren?a.fromNode=r:a.toNode=r:gf(this,r,s)}}else if("parentLinkCategory"===n){var h=this.ii(t.object),l=t.newValue;if(null!==h&&"string"==typeof l){var u=h.kh();null!==u&&(u.category=l)}}e.isModified=!0}}else if(i===di){var c=t.propertyName;t.object===e.model&&"nodeParentKeyProperty"===c&&(e.undoManager.isUndoingRedoing||this.Wd()),e.isModified=!0}}finally{e.aa=!0}}}}},pf.prototype.updateRelationshipsFromData=function(t){var e=t.data;if(null!==e){var i=t.diagram;if(null!==i){var n=i.model;t instanceof _u&&(e=n.mh(e),(e=i.Vb(e))!==(n=t.pg())&&(n=t.kh(),null!==e?null!==n?i.isTreePathToChildren?n.fromNode=e:n.toNode=e:gf(this,e,t):null!==n&&ar(i,n,!1)))}}},pf.prototype.updateDataBindings=function(t,e){Zd.prototype.updateDataBindings.call(this,t,e),"string"==typeof e&&null!==this.Lc(t)&&(null!==(t=this.Kc(t))&&t.La(e))},pf.prototype.resolveReferencesForData=function(t){var e=this.diagram.model,i=e.wa(t);if(void 0!==i){var n=Ff(e,i),o=this.Lc(t);if(null!==n&&null!==o){for(n=n.iterator;n.next();){var r=n.value;e.lb(r)&&o instanceof _u&&e.mh(r)===i&&gf(this,o,this.ii(r))}Df(e,i)}void 0!==(t=e.mh(t))&&o instanceof _u&&gf(this,t=this.Vb(t),o)}},pf.prototype.unresolveReferencesForPart=function(t){var e=this.diagram.model;if(t instanceof _u){var i=e.wa(t.data),n=this.Kc(t.data);if(null!==n){n.isSelected=!1,n.isHighlighted=!1;var o=n.layer;if(null!==o){var r=o.pc(-1,n,!1);0<=r&&this.diagram.cb(pi,"parts",o,n,null,r,null),null!==(r=n.layerChanged)&&r(n,o,null)}}for(n=this.diagram.isTreePathToChildren,t=t.linksConnected;t.next();)o=t.value,o=(n?o.toNode:o.fromNode).data,e.lb(o)&&Bf(e,i,o)}},pf.prototype.insertLink=function(t,e,i){e=this.diagram.model;var n=t,o=i;return this.diagram.isTreePathToChildren||(n=i,o=t),null!==n&&null!==o?(e.qe(o.data,e.wa(n.data)),o.kh()):null},pf.prototype.findLinkForKey=pf.prototype.findLinkForKey,pf.className="TreePartManager",mf.prototype.cloneProtected=function(t){t.xa=this.xa,t.Sm=this.Sm,t.Gg=this.Gg,t.Th=this.Th,t.bl=this.bl,t.Bk=this.Bk,t.Km=this.Km,t.Jm=this.Jm,t.Mm=this.Mm,t.xm=this.xm,t.lj=this.lj},mf.prototype.copy=function(){var t=new this.constructor;return this.cloneProtected(t),t},mf.prototype.clear=function(){this.Tc=[],this.kb.clear(),this.Vf.clear(),this.undoManager.clear()},mf.prototype.toString=function(t){if(void 0===t&&(t=0),1<t)return this.np();var e=(""!==this.name?this.name:"")+" Model";if(0<t){e+="\n node data:";for(var i=(t=this.nodeDataArray).length,n=0;n<i;n++){var o=t[n];e+=" "+this.wa(o)+":"+F(o)}}return e},mf.prototype.xA=function(t){t.change!==ci&&w("Model.toIncrementalData argument is not a Transaction ChangedEvent:"+t.toString());var e=t.object;return t.isTransactionFinished&&e instanceof gi?(xf(this,e),t=this.Qv(e,"FinishedUndo"===t.propertyName),this.vh=null,t):null},mf.prototype.Qv=function(t,e){var i=this,n=!1,o=new Z,r=new Z,s=new Z,a=this.vh;t.changes.each((function(t){t.model===i&&("nodeDataArray"===t.modelChange?t.change===fi?o.add(t.newValue):t.change===pi&&s.add(t.oldValue):i.lb(t.object)?r.add(t.object):t.change!==di||i.modelData!==t.object&&"modelData"!==t.propertyName?null!==t.object&&(a&&a.contains(t.object)?a.get(t.object).each((function(t){i.lb(t)&&r.add(t)})):t.object instanceof mf||i.ri()&&i.Jc(t.object)||bf(i,t.object).each((function(t){r.add(t)}))):n=!0)}));var h=this.il;h.clear(),o.each((function(t){h.add(i.wa(t)),e||r.add(t)}));var l=this.kl;l.clear(),s.each((function(t){l.add(i.wa(t)),e&&r.add(t)})),t=i.cloneDeep(r.Fa());var u=null;return n&&(null===u&&(u={}),u.modelData=this.cloneDeep(this.modelData)),0<h.count&&(null===u&&(u={}),e?u.removedNodeKeys=h.Fa():u.insertedNodeKeys=h.Fa()),0<t.length&&(null===u&&(u={}),u.modifiedNodeData=t),0<l.count&&(null===u&&(u={}),e?u.insertedNodeKeys=l.Fa():u.removedNodeKeys=l.Fa()),l.clear(),h.clear(),u},mf.prototype.cloneDeep=function(t){return yf(this,t,!0)},(e=mf.prototype).quote=function(t){return JSON.stringify(t).replace(/[\u007F-\uFFFF]/g,(function(t){return"\\u"+("0000"+t.charCodeAt(0).toString(16)).substr(-4)}))},e.rm=function(){var t="";return""!==this.name&&(t+=',\n "name": '+this.quote(this.name)),""!==this.dataFormat&&(t+=',\n "dataFormat": '+this.quote(this.dataFormat)),this.isReadOnly&&(t+=',\n "isReadOnly": '+this.isReadOnly),"key"!==this.nodeKeyProperty&&"string"==typeof this.nodeKeyProperty&&(t+=',\n "nodeKeyProperty": '+this.quote(this.nodeKeyProperty)),this.copiesArrays&&(t+=',\n "copiesArrays": true'),this.copiesArrayObjects&&(t+=',\n "copiesArrayObjects": true'),this.copiesKey||(t+=',\n "copiesKey": false'),"category"!==this.nodeCategoryProperty&&"string"==typeof this.nodeCategoryProperty&&(t+=',\n "nodeCategoryProperty": '+this.quote(this.nodeCategoryProperty)),t},e.gp=function(t){t.name&&(this.name=t.name),t.dataFormat&&(this.dataFormat=t.dataFormat),t.isReadOnly&&(this.isReadOnly=!0),t.nodeKeyProperty&&(this.nodeKeyProperty=t.nodeKeyProperty),t.copiesArrays&&(this.copiesArrays=!0),t.copiesArrayObjects&&(this.copiesArrayObjects=!0),!1===t.copiesKey&&(this.copiesKey=!1),t.nodeCategoryProperty&&(this.nodeCategoryProperty=t.nodeCategoryProperty)},e.Rv=function(){var t,e=this.modelData,i=!1;for(t in e)if(!Sf(t,e[t])){i=!0;break}return e="",i&&(e=',\n "modelData": '+Cf(this,this.modelData)),e+',\n "nodeDataArray": '+kf(this,this.nodeDataArray,!0)},e.kv=function(t){vf(this,t),P(t=t.nodeDataArray)&&(this.dm(t),this.nodeDataArray=t)},e.Pv=function(t,e){var i=this,n=!1,o=new Z,r=new Z,s=new Z,a=this.vh;t.changes.each((function(t){t.model===i&&("nodeDataArray"===t.modelChange?t.change===fi?o.add(t.newValue):t.change===pi&&s.add(t.oldValue):i.lb(t.object)?r.add(t.object):t.change!==di||i.modelData!==t.object&&"modelData"!==t.propertyName?null!==t.object&&(a&&a.contains(t.object)?a.get(t.object).each((function(t){i.lb(t)&&r.add(t)})):t.object instanceof mf||i.ri()&&i.Jc(t.object)||bf(i,t.object).each((function(t){r.add(t)}))):n=!0)}));var h=this.il;h.clear(),o.each((function(t){h.add(i.wa(t)),e||r.add(t)}));var l=this.kl;return l.clear(),s.each((function(t){l.add(i.wa(t)),e&&r.add(t)})),t="",n&&(t+=',\n "modelData": '+Cf(this,this.modelData)),0<h.count&&(t+=(e?this.Yv:this.Wv)+kf(this,h.Fa(),!0)),0<r.count&&(t+=this.jy+kf(this,r.Fa(),!0)),0<l.count&&(t+=(e?this.Wv:this.Yv)+kf(this,l.Fa(),!0)),l.clear(),h.clear(),t},e.fp=function(t){(void 0!==t.name&&t.name!==this.name||void 0!==t.dataFormat&&t.dataFormat!==this.dataFormat||void 0!==t.isReadOnly&&t.isReadOnly!==this.isReadOnly||void 0!==t.nodeKeyProperty&&t.nodeKeyProperty!==this.nodeKeyProperty||void 0!==t.copiesArrays&&t.copiesArrays!==this.copiesArrays||void 0!==t.copiesArrayObjects&&t.copiesArrayObjects!==this.copiesArrayObjects||void 0!==t.copiesKey&&t.copiesKey!==this.copiesKey||void 0!==t.nodeCategoryProperty&&t.nodeCategoryProperty!==this.nodeCategoryProperty)&&w("applyIncrementalJson cannot change Model properties"),vf(this,t);var e=t.insertedNodeKeys,i=t.modifiedNodeData,n=new ft;if(Array.isArray(i))for(var o=0;o<i.length;o++){var r=i[o],s=this.wa(r);null!=s&&n.set(s,r)}if(Array.isArray(e))for(o=e.length,r=0;r<o;r++){s=e[r];var a=this.hc(s);null===a&&(a=(a=n.get(s))?a:this.copyNodeData({}),this.km(a,s),this.xf(a))}if(Array.isArray(i))for(e=i.length,n=0;n<e;n++)if(o=i[n],r=this.wa(o),null!==(r=this.hc(r))){for(var h in o)"__gohashid"===h||h===this.nodeKeyProperty||this.Wj()&&h===this.nodeIsGroupProperty||this.setDataProperty(r,h,o[h]);this.lm(o,r)}if(t=t.removedNodeKeys,Array.isArray(t))for(i=t.length,h=0;h<i;h++)null!==(e=this.hc(t[h]))&&this.cm(e)},e.$x=function(t,e){t.change!==ci&&w("Model.toIncrementalJson argument is not a Transaction ChangedEvent:"+t.toString());var i=t.object;return t.isTransactionFinished&&i instanceof gi?(void 0===e&&(e=Of(this,this)),xf(this,i),t=this.Pv(i,"FinishedUndo"===t.propertyName),this.vh=null,"2"===e?'{ "incremental": 2'+t+"}":'{ "class": '+this.quote(e)+', "incremental": 1'+this.rm()+t+"}"):'{ "incremental": 0 }'},e.yA=function(t,e){return this.$x(t,e)},e.np=function(t){return void 0===t&&(t=Of(this,this)),'{ "class": '+this.quote(t)+this.rm()+this.Rv()+"}"},e.toJSON=function(t){return this.np(t)},e.Zw=function(t){var e=null;if("string"==typeof t)try{e=m.JSON.parse(t)}catch(t){}else"object"==typeof t?e=t:w("Unable to modify a Model from: "+t);var i=e.incremental;"number"!=typeof i&&w("Unable to apply non-incremental changes to Model: "+t),0!==i&&(this.Ea("applyIncrementalJson"),this.fp(e),this.eb("applyIncrementalJson"))},e.Ky=function(t){return this.Zw(t)},mf.constructGraphLinksModel=function(){return new mf},(e=mf.prototype).dm=function(t){if(P(t))for(var e=t.length,i=0;i<e;i++){var n=t[i];if(C(n)){var o=i;n=this.dm(n),Array.isArray(t)?t[o]=n:w("Cannot replace an object in an HTMLCollection or NodeList at "+o)}}else if(C(t)){for(e in t)if(C(i=t[e])&&(i=this.dm(i),t[e]=i,"points"===e&&Array.isArray(i))){for(o=0==i.length%2,n=0;n<i.length;n++)if("number"!=typeof i[n]){o=!1;break}if(o){for(o=new $,n=0;n<i.length/2;n++)o.add(new pt(i[2*n],i[2*n+1]));o.freeze(),t[e]=o}}return function(t){if("object"!=typeof t)return t;var e=t.class||"";if("NaN"===e)return NaN;if("Date"===e)return new Date(t.value);if(0!==e.indexOf("go."))return t;e=e.substr(3);var i=t;if("Point"===e)i=new pt(Pf(t.x),Pf(t.y));else if("Size"===e)i=new At(Pf(t.width),Pf(t.height));else if("Rect"===e)i=new jt(Pf(t.x),Pf(t.y),Pf(t.width),Pf(t.height));else if("Margin"===e)i=new Kt(Pf(t.top),Pf(t.right),Pf(t.bottom),Pf(t.left));else if("Spot"===e)i="string"==typeof t.enum?ze(t.enum):new Oe(Pf(t.x),Pf(t.y),Pf(t.offsetX),Pf(t.offsetY));else if("Brush"===e){if((i=new Oa).type=G(Oa,t.type),"string"==typeof t.color&&(i.color=t.color),t.start instanceof Oe&&(i.start=t.start),t.end instanceof Oe&&(i.end=t.end),"number"==typeof t.startRadius&&(i.startRadius=Pf(t.startRadius)),"number"==typeof t.endRadius&&(i.endRadius=Pf(t.endRadius)),C(t=t.colorStops))for(var n in t)i.addColorStop(parseFloat(n),t[n])}else"Geometry"===e?(i=null,i="string"==typeof t.path?Xe.parse(t.path):new Xe,i.type=G(Xe,t.type),"number"==typeof t.startX&&(i.startX=Pf(t.startX)),"number"==typeof t.startY&&(i.startY=Pf(t.startY)),"number"==typeof t.endX&&(i.endX=Pf(t.endX)),"number"==typeof t.endY&&(i.endY=Pf(t.endY)),t.spot1 instanceof Oe&&(i.spot1=t.spot1),t.spot2 instanceof Oe&&(i.spot2=t.spot2)):"EnumValue"===e&&(n=t.classType,0===n.indexOf("go.")&&(n=n.substr(3)),n=If(n),"function"==typeof n&&(i=G(n,t.name)));return i}(t)}return t},e.sm=function(t){return void 0===t?"undefined":null===t?"null":!0===t?"true":!1===t?"false":"string"==typeof t?this.quote(t):"number"==typeof t?1/0===t?"9e9999":-1/0===t?"-9e9999":isNaN(t)?'{"class":"NaN"}':t.toString():t instanceof Date?'{"class":"Date", "value":"'+t.toJSON()+'"}':t instanceof Number?this.sm(t.valueOf()):P(t)?kf(this,t):C(t)?Cf(this,t):"function"==typeof t?"null":t.toString()},e.Pe=function(t){return this.Lt.add(t),this},e.ik=function(t){this.Lt.remove(t)},e.ds=function(t){this.skipsUndoManager||this.undoManager.Tu(t);for(var e=this.Lt,i=e.length,n=0;n<i;n++)e.M(n)(t)},e.cb=function(t,e,i,n,o,r,s){Tf(this,"",t,e,i,n,o,r,s)},e.g=function(t,e,i,n,o){Tf(this,"",di,t,this,e,i,n,o)},e.Fs=function(t,e,i,n,o,r){Tf(this,"",di,e,t,i,n,o,r)},mf.prototype.changeState=function(t,e){if(null!==t&&t.model===this)if(t.change===di){var i=t.object,n=t.propertyName,o=t.I(e);n===this.nodeKeyProperty&&this.lb(i)&&(void 0!==(e=t.I(!e))&&this.kb.remove(e),void 0!==o&&this.kb.add(o,i)),Rf(i,n,o)}else t.change===fi?(i=t.newParam,"nodeDataArray"===t.modelChange?C(t=t.newValue)&&"number"==typeof i&&(n=this.wa(t),e?(this.Tc[i]===t&&L(this.Tc,i),void 0!==n&&this.kb.remove(n)):(this.Tc[i]!==t&&N(this.Tc,i,t),void 0!==n&&this.kb.add(n,t))):""===t.modelChange?((n=t.object)&&!P(n)&&t.propertyName&&(n=zf(t.object,t.propertyName)),P(n)&&"number"==typeof i&&(t=t.newValue,e?L(n,i):N(n,i,t))):w("unknown ChangedEvent.Insert modelChange: "+t.toString())):t.change===pi?(i=t.oldParam,"nodeDataArray"===t.modelChange?C(t=t.oldValue)&&"number"==typeof i&&(n=this.wa(t),e?(this.Tc[i]!==t&&N(this.Tc,i,t),void 0!==n&&this.kb.add(n,t)):(this.Tc[i]===t&&L(this.Tc,i),void 0!==n&&this.kb.remove(n))):""===t.modelChange?((n=t.object)&&!P(n)&&t.propertyName&&(n=zf(t.object,t.propertyName)),P(n)&&"number"==typeof i&&(t=t.oldValue,e?N(n,i,t):L(n,i))):w("unknown ChangedEvent.Remove modelChange: "+t.toString())):t.change!==ci&&w("unknown ChangedEvent: "+t.toString())},mf.prototype.Ea=function(t){return this.undoManager.Ea(t)},mf.prototype.eb=function(t){return this.undoManager.eb(t)},mf.prototype.Kf=function(){return this.undoManager.Kf()},mf.prototype.commit=function(t,e){void 0===e&&(e="");var i=this.skipsUndoManager;null===e&&(this.skipsUndoManager=!0,e=""),this.undoManager.Ea(e);var n=!1;try{t(this),n=!0}finally{n?this.undoManager.eb(e):this.undoManager.Kf(),this.skipsUndoManager=i}},(e=mf.prototype).La=function(t,e){void 0===e&&(e=""),Tf(this,"SourceChanged",ci,e,t,null,null)},e.wa=function(t){if(null!==t){var e=this.Th;if(""!==e&&void 0!==(e=zf(t,e))){if(Nf(e))return e;w("Key value for node data "+t+" is not a number or a string: "+e)}}},e.km=function(t,e){if(null!==t){var i=this.Th;if(""!==i)if(this.lb(t)){var n=zf(t,i);n!==e&&null===this.hc(e)&&(Rf(t,i,e),void 0!==n&&this.kb.remove(n),this.kb.add(e,t),Tf(this,"nodeKey",di,i,t,n,e),"string"==typeof i&&this.La(t,i),this.jp(n,e))}else Rf(t,i,e)}},e.lb=function(t){var e=this.wa(t);return void 0!==e&&this.kb.I(e)===t},e.hc=function(t){return null===t&&w("Model.findNodeDataForKey:key must not be null"),void 0!==t&&Nf(t)?this.kb.I(t):null},e.$u=function(t){if(null!==t){var e=this.Th;if(""!==e){var i=this.wa(t);if(void 0===i||this.kb.contains(i)){var n=this.bl;if(null!==n&&(null!=(i=n(this,t))&&!this.kb.contains(i)))return void Rf(t,e,i);if("string"==typeof i){for(n=2;this.kb.contains(i+n);)n++;Rf(t,e,i+n)}else if(void 0===i||"number"==typeof i){for(i=-this.kb.count-1;this.kb.contains(i);)i--;Rf(t,e,i)}}}}},e.xf=function(t){null!==t&&(tt(t),this.lb(t)||Lf(this,t,!0))},e.Fy=function(t){if(P(t))for(var e=t.length,i=0;i<e;i++)this.xf(t[i]);else for(t=t.iterator;t.next();)this.xf(t.value)},e.cm=function(t){null!==t&&Af(this,t,!0)},e.nA=function(t){if(P(t))for(var e=t.length,i=0;i<e;i++)this.cm(t[i]);else for(t=t.iterator;t.next();)this.cm(t.value)},e.$z=function(t){if(t!==this.nodeDataArray&&P(t)){var e=this.kl;e.clear(),e.addAll(this.kb.iteratorKeys);var i=this.il;i.clear();for(var n=t.length,o=0;o<n;o++){var r=t[o],s=this.wa(r);if(void 0!==s){i.add(s);var a=this.hc(s);a!==r&&(null!==a?(this.Do(a,r),this.lm(r,a)):(r=this.cloneDeep(r),this.km(r,s),this.xf(r)))}else s=this.cloneDeep(r),this.xf(s),i.add(this.wa(s))}for(t=e.iterator;t.next();)n=t.value,i.contains(n)||(n=this.hc(n))&&this.cm(n);e.clear(),i.clear()}},e.jp=function(t,e){void 0!==e&&((t=Ff(this,t))instanceof Z&&this.Vf.add(e,t))},e.Lv=function(){},e.fm=function(){},e.em=function(){},e.qp=function(){},e.Qy=function(t){void 0===t?this.Vf.clear():this.Vf.remove(t)},mf.prototype.copyNodeData=function(t){if(null===t)return null;var e=this.Bk;return C(t=null!==e?e(t,this):jf(this,t,!0))&&Q(t),t},mf.prototype.setDataProperty=function(t,e,i){if(this.lb(t)){if(e===this.nodeKeyProperty)return void this.km(t,i);if(e===this.nodeCategoryProperty)return void this.jm(t,i)}else!Vf&&t instanceof Fs&&(Vf=!0,M('Model.setDataProperty is modifying a GraphObject, "'+t.toString()+'"'),M(" Is that really your intent?"));var n=zf(t,e);n!==i&&(Rf(t,e,i),this.Fs(t,e,n,i))},(e=mf.prototype).set=function(t,e,i){this.setDataProperty(t,e,i)},e.Do=function(t,e){if(e){var i,n=this.lb(t);for(i in e)"__gohashid"===i||n&&i===this.nodeKeyProperty||this.setDataProperty(t,i,e[i])}},e.Ay=function(t,e){this.ts(t,-1,e)},e.ts=function(t,e,i){0>e&&(e=t.length),N(t,e,i),Tf(this,"",fi,"",t,null,i,null,e)},e.ov=function(t,e){void 0===e&&(e=-1),t===this.Tc&&w("Model.removeArrayItem should not be called on the Model.nodeDataArray"),-1===e&&(e=t.length-1);var i=t[e];L(t,e),Tf(this,"",pi,"",t,i,null,e,null)},e.Ro=function(t){if(null===t)return"";var e=this.lj;return""===e||void 0===(e=zf(t,e))?"":"string"==typeof e?e:void w("getCategoryForNodeData found a non-string category for "+t+": "+e)},e.jm=function(t,e){if(null!==t){var i=this.lj;if(""!==i)if(this.lb(t)){var n=zf(t,i);void 0===n&&(n=""),n!==e&&(Rf(t,i,e),Tf(this,"nodeCategory",di,i,t,n,e))}else Rf(t,i,e)}},e.lm=function(t,e){this.jm(e,this.Ro(t))},e.Tl=function(){return!1},e.Wj=function(){return!1},e.ri=function(){return!1},e.xs=function(){return!1},e.Xj=function(){return!1},d.Object.defineProperties(mf.prototype,{name:{get:function(){return this.xa},set:function(t){var e=this.xa;e!==t&&(this.xa=t,this.g("name",e,t))}},dataFormat:{get:function(){return this.Sm},set:function(t){var e=this.Sm;e!==t&&(this.Sm=t,this.g("dataFormat",e,t))}},isReadOnly:{get:function(){return this.Gg},set:function(t){var e=this.Gg;e!==t&&(this.Gg=t,this.g("isReadOnly",e,t))}},modelData:{get:function(){return this.j},set:function(t){var e=this.j;e!==t&&(this.j=t,this.g("modelData",e,t),this.La(t))}},undoManager:{get:function(){return this.o},set:function(t){var e=this.o;e!==t&&(null!==e&&e.Rx(this),this.o=t,null!==t&&t.Xw(this))}},skipsUndoManager:{get:function(){return this.Wg},set:function(t){this.Wg=t}},nodeKeyProperty:{get:function(){return this.Th},set:function(t){var e=this.Th;e!==t&&(""===t&&w("Model.nodeKeyProperty may not be the empty string"),0<this.kb.count&&w("Cannot set Model.nodeKeyProperty when there is existing node data"),this.Th=t,this.g("nodeKeyProperty",e,t))}},makeUniqueKeyFunction:{get:function(){return this.bl},set:function(t){var e=this.bl;e!==t&&(this.bl=t,this.g("makeUniqueKeyFunction",e,t))}},nodeDataArray:{get:function(){return this.Tc},set:function(t){var e=this.Tc;if(e!==t){this.kb.clear(),this.Lv();for(var i=t.length,n=0;n<i;n++){var o=t[n];C(o)||w("Model.nodeDataArray must only contain Objects, not: "+o),tt(o)}for(this.Tc=t,n=new $,o=0;o<i;o++){var r=t[o],s=this.wa(r);void 0===s||null!==this.kb.I(s)?n.add(r):this.kb.add(s,r)}for(n=n.iterator;n.next();)o=n.value,this.$u(o),void 0!==(r=this.wa(o))&&this.kb.add(r,o);for(Tf(this,"nodeDataArray",di,"nodeDataArray",this,e,t),e=0;e<i;e++)n=t[e],this.fm(n),this.em(n);Array.isArray(t)||(this.isReadOnly=!0)}}},copyNodeDataFunction:{get:function(){return this.Bk},set:function(t){var e=this.Bk;e!==t&&(this.Bk=t,this.g("copyNodeDataFunction",e,t))}},copiesArrays:{get:function(){return this.Km},set:function(t){var e=this.Km;e!==t&&(this.Km=t,this.g("copiesArrays",e,t))}},copiesArrayObjects:{get:function(){return this.Jm},set:function(t){var e=this.Jm;e!==t&&(this.Jm=t,this.g("copiesArrayObjects",e,t))}},copiesKey:{get:function(){return this.Mm},set:function(t){var e=this.Mm;e!==t&&(this.Mm=t,this.g("copiesKey",e,t))}},afterCopyFunction:{get:function(){return this.xm},set:function(t){var e=this.xm;e!==t&&(this.xm=t,this.g("afterCopyFunction",e,t))}},nodeCategoryProperty:{get:function(){return this.lj},set:function(t){var e=this.lj;e!==t&&(this.lj=t,this.g("nodeCategoryProperty",e,t))}},type:{get:function(){return"Model"}}}),mf.prototype.setCategoryForNodeData=mf.prototype.jm,mf.prototype.getCategoryForNodeData=mf.prototype.Ro,mf.prototype.removeArrayItem=mf.prototype.ov,mf.prototype.insertArrayItem=mf.prototype.ts,mf.prototype.addArrayItem=mf.prototype.Ay,mf.prototype.assignAllDataProperties=mf.prototype.Do,mf.prototype.set=mf.prototype.set,mf.prototype.clearUnresolvedReferences=mf.prototype.Qy,mf.prototype.mergeNodeDataArray=mf.prototype.$z,mf.prototype.removeNodeDataCollection=mf.prototype.nA,mf.prototype.removeNodeData=mf.prototype.cm,mf.prototype.addNodeDataCollection=mf.prototype.Fy,mf.prototype.addNodeData=mf.prototype.xf,mf.prototype.makeNodeDataKeyUnique=mf.prototype.$u,mf.prototype.findNodeDataForKey=mf.prototype.hc,mf.prototype.containsNodeData=mf.prototype.lb,mf.prototype.setKeyForNodeData=mf.prototype.km,mf.prototype.getKeyForNodeData=mf.prototype.wa,mf.prototype.updateTargetBindings=mf.prototype.La,mf.prototype.commit=mf.prototype.commit,mf.prototype.rollbackTransaction=mf.prototype.Kf,mf.prototype.commitTransaction=mf.prototype.eb,mf.prototype.startTransaction=mf.prototype.Ea,mf.prototype.raiseDataChanged=mf.prototype.Fs,mf.prototype.raiseChanged=mf.prototype.g,mf.prototype.raiseChangedEvent=mf.prototype.cb,mf.prototype.removeChangedListener=mf.prototype.ik,mf.prototype.addChangedListener=mf.prototype.Pe,mf.prototype.writeJsonValue=mf.prototype.sm,mf.prototype.replaceJsonObjects=mf.prototype.dm,mf.prototype.applyIncrementalJSON=mf.prototype.Ky,mf.prototype.applyIncrementalJson=mf.prototype.Zw,mf.prototype.toJSON=mf.prototype.toJSON,mf.prototype.toJson=mf.prototype.np,mf.prototype.toIncrementalJSON=mf.prototype.yA,mf.prototype.toIncrementalJson=mf.prototype.$x,mf.prototype.toIncrementalData=mf.prototype.xA,mf.prototype.clear=mf.prototype.clear;var Vf=!1,Gf={};function Hf(t,e,i,n){Q(this),this._isFrozen=!1,void 0===t&&(t=""),void 0===e&&(e=t),void 0===i&&(i=null),this.j=-1,this.xd=null,this.xl=t,this.wl=this.to=0,this.Cr=null,this.wn=!1,this.sl=e,this.Im=i,void 0===n?(this.el=Uf,this.wk=null):(this.el=qf,this.wk=n),this.st=new Z}function Yf(t,e,i){return null===(t=t.sourceName)||""===t?e:"/"===t?i.part:"."===t?i:".."===t?i.panel:e.fb(t)}mf.className="Model",mf.fromJSON=mf.fromJson=function(t,e){void 0===e&&(e=null);var i=null;if("string"==typeof t)try{i=m.JSON.parse(t)}catch(t){}else"object"==typeof t?i=t:w("Unable to construct a Model from: "+t);if(null===e){t=null;var n=i.class;if("string"==typeof n)try{var o=null;0===n.indexOf("go.")?o=If(n=n.substr(3)):null===(o=If(n))&&(o=m[n]),"function"==typeof o&&(t=new o)}catch(t){}null===t||t instanceof mf?e=t:w("Unable to construct a Model of declared class: "+i.class)}return null===e&&(e=mf.constructGraphLinksModel()),e.gp(i),e.kv(i),e},mf.safePropertyValue=zf,mf.safePropertySet=Rf,Gf.Brush=Oa,Gf.ChangedEvent=ui,Gf.Geometry=Xe,Gf.Margin=Kt,Gf.Panel=Th,Gf.Point=pt,Gf.Rect=jt,Gf.Size=At,Gf.Spot=Oe,Gf.Transaction=gi,Gf.UndoManager=mi,Hf.prototype.copy=function(){var t=new Hf;return t.xl=this.xl,t.to=this.to,t.wl=this.wl,t.Cr=this.Cr,t.wn=this.wn,t.sl=this.sl,t.Im=this.Im,t.el=this.el,t.wk=this.wk,t},(e=Hf.prototype).qb=function(t){t.classType===Hf&&(this.mode=t)},e.toString=function(){return"Binding("+this.targetProperty+":"+this.sourceProperty+(-1!==this.Ai?" "+this.Ai:"")+" "+this.mode.name+")"},e.freeze=function(){return this._isFrozen=!0,this},e.ka=function(){return this._isFrozen=!1,this},e.Kx=function(t){return void 0===t&&(t=null),this.mode=qf,this.backConverter=t,this},e.cp=function(t){return void 0===t&&(t=""),this.sourceName=t,this.isToModel=!1,this},e.dA=function(){return this.sourceName=null,this.isToModel=!0,this},e.Mv=function(t,e,i){var n=this.sl;if(void 0===i||""===n||n===i){i=this.xl;var o=this.Im;if(null===o&&""===i)M("Binding error: target property is the empty string: "+this.toString());else{var r=e;if(""!==n&&(r=zf(e,n)),void 0!==r)if(null===o)""!==i&&Rf(t,i,r);else try{if(""!==i)Rf(t,i,o(r,t));else o(r,t)}catch(t){}}}},e.sp=function(t,e,i,n){if(this.el===qf){var o=this.xl;if(void 0===i||o===i){i=this.sl;var r=this.wk,s=t;if(""!==o&&(s=zf(t,o)),void 0!==s&&!this.st.contains(t))try{this.st.add(t);var a=null!==n?n.diagram:null,h=null!==a?a.model:null;if(null===r){if(""!==i)null!==h?h.setDataProperty(e,i,s):Rf(e,i,s);else if(null!==h&&null!==n&&0<=n.itemIndex&&null!==n.panel&&Array.isArray(n.panel.itemArray)){var l=n.itemIndex,u=n.panel.itemArray;h.ov(u,l),h.ts(u,l,s)}}else try{if(""!==i){var c=r(s,e,h);null!==h?h.setDataProperty(e,i,c):Rf(e,i,c)}else{var d=r(s,e,h);if(void 0!==d&&null!==h&&null!==n&&0<=n.itemIndex&&null!==n.panel&&Array.isArray(n.panel.itemArray)){var f=n.itemIndex,p=n.panel.itemArray;h.ov(p,f),h.ts(p,f,d)}}}catch(t){}}finally{this.st.remove(t)}}}},d.Object.defineProperties(Hf.prototype,{Ai:{get:function(){return this.j},set:function(t){this._isFrozen&&k(this),this.j=t}},targetProperty:{get:function(){return this.xl},set:function(t){this._isFrozen&&k(this),this.xl=t}},sourceName:{get:function(){return this.Cr},set:function(t){this._isFrozen&&k(this),this.Cr=t,null!==t&&(this.wn=!1)}},isToModel:{get:function(){return this.wn},set:function(t){this._isFrozen&&k(this),this.wn=t}},sourceProperty:{get:function(){return this.sl},set:function(t){this._isFrozen&&k(this),this.sl=t}},converter:{get:function(){return this.Im},set:function(t){this._isFrozen&&k(this),this.Im=t}},backConverter:{get:function(){return this.wk},set:function(t){this._isFrozen&&k(this),this.wk=t}},mode:{get:function(){return this.el},set:function(t){this._isFrozen&&k(this),this.el=t}}}),Hf.prototype.updateSource=Hf.prototype.sp,Hf.prototype.updateTarget=Hf.prototype.Mv,Hf.prototype.ofModel=Hf.prototype.dA,Hf.prototype.ofObject=Hf.prototype.cp,Hf.prototype.makeTwoWay=Hf.prototype.Kx;var Xf="Binding",Uf=new V(Hf,"OneWay",1),qf=new V(Hf,"TwoWay",2);function Wf(t,e,i){mf.call(this),this.Vv=',\n "insertedLinkKeys": ',this.iy=',\n "modifiedLinkData": ',this.Xv=',\n "removedLinkKeys": ',this.md=[],this.$f=new Z,this.wb=new ft,this.Jh="",this.Ri=this.Ak=this.cl=null,this.lf="from",this.mf="to",this.fj=this.ej="",this.dj="category",this.je="",this.jl="isGroup",this.Je="group",this.Lm=!1,void 0!==e&&(this.linkDataArray=e),void 0!==t&&(P(t)?this.nodeDataArray=t:i=t),i&&(Object.assign(this,i),t=i.Changed)&&(delete this.Changed,this.Pe(t))}function Kf(t,e){for(var i=new Z,n=0;n<t.linkDataArray.length;n++){var o=t.linkDataArray[n];wf(t,e,o,o,i)}return i}function _f(t,e,i){if(null!==e&&(""!==(t=i?t.lf:t.mf)&&void 0!==(t=zf(e,t)))){if(Nf(t))return t;w((i?"FromKey":"ToKey")+" value for link data "+e+" is not a number or a string: "+t)}}function $f(t,e,i,n){if(null===i&&(i=void 0),null!==e){var o=n?t.lf:t.mf;if(""!==o)if(i=t.Vl(i),t.Jc(e)){var r=zf(e,o);r!==i&&(Df(t,r,e),Rf(e,o,i),null===t.hc(i)&&Bf(t,i,e),Tf(t,n?"linkFromKey":"linkToKey",di,o,e,r,i),"string"==typeof o&&t.La(e,o))}else Rf(e,o,i)}}function Jf(t,e,i){return null===e||""===(t=i?t.ej:t.fj)||void 0===(e=zf(e,t))?"":e}function Zf(t,e,i,n){if(null!==e){var o=n?t.ej:t.fj;if(""!==o)if(t.Jc(e)){var r=zf(e,o);void 0===r&&(r=""),r!==i&&(Rf(e,o,i),Tf(t,n?"linkFromPortId":"linkToPortId",di,o,e,r,i),"string"==typeof o&&t.La(e,o))}else Rf(e,o,i)}}function Qf(t,e,i){if(""!==t.linkKeyProperty){var n=t.Ac(e);if(void 0!==n&&t.wb.I(n)===e)return;t.Bs(e),void 0===(n=t.Ac(e))&&w("GraphLinksModel.makeLinkDataKeyUnique failed on "+e+". Data not added to model."),t.wb.add(n,e)}t.$f.add(e),n=null,i&&(n=t.md.length,t.md.splice(n,0,e)),Tf(t,"linkDataArray",fi,"linkDataArray",t,null,e,null,n),ep(t,e)}function tp(t,e,i){t.$f.remove(e);var n=t.Ac(e);if(void 0!==n&&t.wb.remove(n),n=null,i){if(0>(n=t.md.indexOf(e)))return;t.md.splice(n,1)}if(Tf(t,"linkDataArray",pi,"linkDataArray",t,e,null,n,null),Df(t,i=_f(t,e,!0),e),Df(t,i=_f(t,e,!1),e),n=t.Ef(e),Array.isArray(n))for(var o=n.length,r=0;r<o;r++)Df(t,i=n[r],e)}function ep(t,e){var i=_f(t,e,!0);i=t.Vl(i),null===t.hc(i)&&Bf(t,i,e),i=_f(t,e,!1),i=t.Vl(i),null===t.hc(i)&&Bf(t,i,e);var n=t.Ef(e);if(Array.isArray(n))for(var o=n.length,r=0;r<o;r++)i=n[r],null===t.hc(i)&&Bf(t,i,e)}function ip(t,e,i){t.lp(i,t.ps(e)),t.wv(i,t.yx(e)),t.Bv(i,t.Bx(e)),t.Ls(i,t.Ef(e)),t.xv(i,t.zx(e)),t.Cv(i,t.Cx(e))}Hf.className="Binding",Hf.parseEnum=function(t,e){return function(i){return null===(i=G(t,i))?e:i}},Hf.toString=F,Hf.OneWay=Uf,Hf.TwoWay=qf,c(Wf,mf),Wf.constructGraphLinksModel=mf.constructGraphLinksModel,Wf.prototype.cloneProtected=function(t){mf.prototype.cloneProtected.call(this,t),t.Jh=this.Jh,t.cl=this.cl,t.Ak=this.Ak,t.lf=this.lf,t.mf=this.mf,t.ej=this.ej,t.fj=this.fj,t.dj=this.dj,t.je=this.je,t.jl=this.jl,t.Je=this.Je,t.Lm=this.Lm},(e=Wf.prototype).clear=function(){mf.prototype.clear.call(this),this.md=[],this.wb.clear(),this.$f.clear()},e.toString=function(t){if(void 0===t&&(t=0),2<=t)return this.np();var e=(""!==this.name?this.name:"")+" GraphLinksModel";if(0<t){e+="\n node data:";var i,n=(t=this.nodeDataArray).length;for(i=0;i<n;i++){var o=t[i];e+=" "+this.wa(o)+":"+F(o)}for(e+="\n link data:",n=(t=this.linkDataArray).length,i=0;i<n;i++)e+=" "+_f(this,o=t[i],!0)+"--\x3e"+_f(this,o,!1)}return e},e.Qv=function(t,e){""===this.linkKeyProperty&&w("GraphLinksModel.linkKeyProperty must not be an empty string for .toIncrementalData() to succeed.");var i=mf.prototype.Qv.call(this,t,e),n=this,o=new Z,r=new Z,s=new Z,a=this.vh;t.changes.each((function(t){t.model===n&&("linkDataArray"===t.modelChange?t.change===fi?o.add(t.newValue):t.change===pi&&s.add(t.oldValue):n.Jc(t.object)?r.add(t.object):null!==t.object&&(null!==t.object&&a&&a.contains(t.object)?a.get(t.object).each((function(t){n.Jc(t)&&r.add(t)})):t.object instanceof mf||n.lb(t.object)||Kf(n,t.object).each((function(t){r.add(t)}))))}));var h=this.il;h.clear(),o.each((function(t){h.add(n.Ac(t)),e||r.add(t)}));var l=this.kl;return l.clear(),s.each((function(t){l.add(n.Ac(t)),e&&r.add(t)})),t=n.cloneDeep(r.Fa()),0<h.count&&(null===i&&(i={}),e?i.removedLinkKeys=h.Fa():i.insertedLinkKeys=h.Fa()),0<t.length&&(null===i&&(i={}),i.modifiedLinkData=t),0<l.count&&(null===i&&(i={}),e?i.insertedLinkKeys=l.Fa():i.removedLinkKeys=l.Fa()),l.clear(),h.clear(),i},e.rm=function(){var t=mf.prototype.rm.call(this),e="";return"category"!==this.linkCategoryProperty&&"string"==typeof this.linkCategoryProperty&&(e+=',\n "linkCategoryProperty": '+this.quote(this.linkCategoryProperty)),""!==this.linkKeyProperty&&"string"==typeof this.linkKeyProperty&&(e+=',\n "linkKeyProperty": '+this.quote(this.linkKeyProperty)),"from"!==this.linkFromKeyProperty&&"string"==typeof this.linkFromKeyProperty&&(e+=',\n "linkFromKeyProperty": '+this.quote(this.linkFromKeyProperty)),"to"!==this.linkToKeyProperty&&"string"==typeof this.linkToKeyProperty&&(e+=',\n "linkToKeyProperty": '+this.quote(this.linkToKeyProperty)),""!==this.linkFromPortIdProperty&&"string"==typeof this.linkFromPortIdProperty&&(e+=',\n "linkFromPortIdProperty": '+this.quote(this.linkFromPortIdProperty)),""!==this.linkToPortIdProperty&&"string"==typeof this.linkToPortIdProperty&&(e+=',\n "linkToPortIdProperty": '+this.quote(this.linkToPortIdProperty)),""!==this.linkLabelKeysProperty&&"string"==typeof this.linkLabelKeysProperty&&(e+=',\n "linkLabelKeysProperty": '+this.quote(this.linkLabelKeysProperty)),"isGroup"!==this.nodeIsGroupProperty&&"string"==typeof this.nodeIsGroupProperty&&(e+=',\n "nodeIsGroupProperty": '+this.quote(this.nodeIsGroupProperty)),"group"!==this.nodeGroupKeyProperty&&"string"==typeof this.nodeGroupKeyProperty&&(e+=',\n "nodeGroupKeyProperty": '+this.quote(this.nodeGroupKeyProperty)),t+e},e.gp=function(t){mf.prototype.gp.call(this,t),t.linkKeyProperty&&(this.linkKeyProperty=t.linkKeyProperty),t.linkFromKeyProperty&&(this.linkFromKeyProperty=t.linkFromKeyProperty),t.linkToKeyProperty&&(this.linkToKeyProperty=t.linkToKeyProperty),t.linkFromPortIdProperty&&(this.linkFromPortIdProperty=t.linkFromPortIdProperty),t.linkToPortIdProperty&&(this.linkToPortIdProperty=t.linkToPortIdProperty),t.linkCategoryProperty&&(this.linkCategoryProperty=t.linkCategoryProperty),t.linkLabelKeysProperty&&(this.linkLabelKeysProperty=t.linkLabelKeysProperty),t.nodeIsGroupProperty&&(this.nodeIsGroupProperty=t.nodeIsGroupProperty),t.nodeGroupKeyProperty&&(this.nodeGroupKeyProperty=t.nodeGroupKeyProperty)},e.Rv=function(){return mf.prototype.Rv.call(this)+(',\n "linkDataArray": '+kf(this,this.linkDataArray,!0))},e.kv=function(t){mf.prototype.kv.call(this,t),t=t.linkDataArray,Array.isArray(t)&&(this.dm(t),this.linkDataArray=t)},e.Pv=function(t,e){""===this.linkKeyProperty&&w("GraphLinksModel.linkKeyProperty must not be an empty string for .toIncrementalJson() to succeed.");var i=mf.prototype.Pv.call(this,t,e),n=this,o=new Z,r=new Z,s=new Z,a=this.vh;t.changes.each((function(t){t.model===n&&("linkDataArray"===t.modelChange?t.change===fi?o.add(t.newValue):t.change===pi&&s.add(t.oldValue):n.Jc(t.object)?r.add(t.object):null!==t.object&&(null!==t.object&&a&&a.contains(t.object)?a.get(t.object).each((function(t){n.Jc(t)&&r.add(t)})):t.object instanceof mf||n.lb(t.object)||Kf(n,t.object).each((function(t){r.add(t)}))))}));var h=this.il;h.clear(),o.each((function(t){h.add(n.Ac(t)),e||r.add(t)}));var l=this.kl;return l.clear(),s.each((function(t){l.add(n.Ac(t)),e&&r.add(t)})),t=i,0<h.count&&(t+=(e?this.Xv:this.Vv)+kf(this,h.Fa(),!0)),0<r.count&&(t+=this.iy+kf(this,r.Fa(),!0)),0<l.count&&(t+=(e?this.Vv:this.Xv)+kf(this,l.Fa(),!0)),l.clear(),h.clear(),t},e.fp=function(t){(void 0!==t.linkCategoryProperty&&t.linkCategoryProperty!==this.linkCategoryProperty||void 0!==t.linkKeyProperty&&t.linkKeyProperty!==this.linkKeyProperty||void 0!==t.linkFromKeyProperty&&t.linkFromKeyProperty!==this.linkFromKeyProperty||void 0!==t.linkToKeyProperty&&t.linkToKeyProperty!==this.linkToKeyProperty||void 0!==t.linkFromPortIdProperty&&t.linkFromPortIdProperty!==this.linkFromPortIdProperty||void 0!==t.linkToPortIdProperty&&t.linkToPortIdProperty!==this.linkToPortIdProperty||void 0!==t.linkLabelKeysProperty&&t.linkLabelKeysProperty!==this.linkLabelKeysProperty||void 0!==t.nodeIsGroupProperty&&t.nodeIsGroupProperty!==this.nodeIsGroupProperty||void 0!==t.nodeGroupKeyProperty&&t.nodeGroupKeyProperty!==this.nodeGroupKeyProperty)&&w("applyIncrementalJson cannot change Model properties"),mf.prototype.fp.call(this,t);var e=t.insertedLinkKeys;if(Array.isArray(e))for(var i=e.length,n=0;n<i;n++){var o=e[n],r=this.jh(o);null===r&&(r=this.Jo({}),this.Ks(r,o),this.fi(r))}if(e=t.modifiedLinkData,Array.isArray(e))for(i=e.length,n=0;n<i;n++)if(o=e[n],r=this.Ac(o),null!==(r=this.jh(r))){for(var s in o)"__gohashid"!==s&&s!==this.linkKeyProperty&&this.setDataProperty(r,s,o[s]);ip(this,o,r)}if(t=t.removedLinkKeys,Array.isArray(t))for(s=t.length,e=0;e<s;e++)null!==(i=this.jh(t[e]))&&this.bm(i)},Wf.prototype.changeState=function(t,e){if(null!==t&&t.model===this){if(t.change===di){var i=t.object,n=t.propertyName;if(n===this.linkKeyProperty&&this.Jc(i)){var o=t.I(e);return void 0!==(e=t.I(!e))&&this.wb.remove(e),void 0!==o&&this.wb.add(o,i),void Rf(i,n,o)}}else if(t.change===fi){if(i=t.newParam,"linkDataArray"===t.modelChange)return void(C(t=t.newValue)&&"number"==typeof i&&(n=this.Ac(t),e?(this.$f.remove(t),this.md[i]===t&&this.md.splice(i,1),void 0!==n&&this.wb.remove(n)):(this.$f.add(t),this.md[i]!==t&&this.md.splice(i,0,t),void 0!==n&&this.wb.add(n,t))));if("linkLabelKeys"===t.modelChange)return n=this.Ef(t.object),void(Array.isArray(n)&&"number"==typeof i&&(e?(i=n.indexOf(t.newValue),0<=i&&n.splice(i,1)):0>n.indexOf(t.newValue)&&n.splice(i,0,t.newValue)))}else if(t.change===pi){if(i=t.oldParam,"linkDataArray"===t.modelChange)return void(C(t=t.oldValue)&&"number"==typeof i&&(n=this.Ac(t),e?(this.$f.add(t),this.md[i]!==t&&this.md.splice(i,0,t),void 0!==n&&this.wb.add(n,t)):(this.$f.remove(t),this.md[i]===t&&this.md.splice(i,1),void 0!==n&&this.wb.remove(n))));if("linkLabelKeys"===t.modelChange)return n=this.Ef(t.object),void(Array.isArray(n)&&"number"==typeof i&&(e?0>n.indexOf(t.newValue)&&n.splice(i,0,t.newValue):(i=n.indexOf(t.newValue),0<=i&&n.splice(i,1))))}mf.prototype.changeState.call(this,t,e)}},(e=Wf.prototype).Vl=function(t){if(void 0!==t){var e=this.Ri;if(null!==e){var i=this.hc(t);null===i&&(Rf(i=this.copyNodeData(e),this.nodeKeyProperty,t),this.xf(i))}return t}},e.yx=function(t){return _f(this,t,!0)},e.wv=function(t,e){$f(this,t,e,!0)},e.Bx=function(t){return _f(this,t,!1)},e.Bv=function(t,e){$f(this,t,e,!1)},e.zx=function(t){return Jf(this,t,!0)},e.xv=function(t,e){Zf(this,t,e,!0)},e.Cx=function(t){return Jf(this,t,!1)},e.Cv=function(t,e){Zf(this,t,e,!1)},e.Ef=function(t){if(null===t)return np;var e=this.je;return""===e||void 0===(t=zf(t,e))?np:t},e.Ls=function(t,e){if(null!==t){var i=this.je;if(""!==i)if(this.Jc(t)){var n=zf(t,i);if(void 0===n&&(n=np),n!==e){if(Array.isArray(n))for(var o=n.length,r=0;r<o;r++)Df(this,n[r],t);for(Rf(t,i,e),o=e.length,r=0;r<o;r++){var s=e[r];null===this.hc(s)&&Bf(this,s,t)}Tf(this,"linkLabelKeys",di,i,t,n,e),"string"==typeof i&&this.La(t,i)}}else Rf(t,i,e)}},e.Bu=function(t,e){if(null!=e&&null!==t){var i=this.je;if(""!==i){var n=zf(t,i);if(void 0===n)(i=[]).push(e),this.Ls(t,i);else if(Array.isArray(n)){var o=n.indexOf(e);0<=o||(o=n.length,n.push(e),this.Jc(t)&&(null===this.hc(e)&&Bf(this,e,t),Tf(this,"linkLabelKeys",fi,i,t,null,e,null,o)))}else w(i+" property is not an Array; cannot addLabelKeyForLinkData: "+t)}}},e.Qx=function(t,e){if(null!=e&&null!==t){var i=this.je;if(""!==i){var n=zf(t,i);if(Array.isArray(n)){var o=n.indexOf(e);0>o||(n.splice(o,1),this.Jc(t)&&(Df(this,e,t),Tf(this,"linkLabelKeys",pi,i,t,e,null,o,null)))}else void 0!==n&&w(i+" property is not an Array; cannot removeLabelKeyforLinkData: "+t)}}},e.Ac=function(t){if(null!==t){var e=this.Jh;if(""!==e&&void 0!==(e=zf(t,e))){if(Nf(e))return e;w("Key value for link data "+t+" is not a number or a string: "+e)}}},e.Ks=function(t,e){if(null!==t){var i=this.Jh;if(""!==i)if(this.Jc(t)){var n=zf(t,i);n!==e&&null===this.jh(e)&&(Rf(t,i,e),void 0!==n&&this.wb.remove(n),this.wb.add(e,t),Tf(this,"linkKey",di,i,t,n,e),"string"==typeof i&&this.La(t,i))}else Rf(t,i,e)}},e.jh=function(t){return null===t&&w("GraphLinksModel.findLinkDataForKey:key must not be null"),void 0!==t&&Nf(t)?this.wb.I(t):null},e.Bs=function(t){if(null!==t){var e=this.Jh;if(""!==e){var i=this.Ac(t);if(void 0===i||this.wb.contains(i)){var n=this.cl;if(null!==n&&(null!=(i=n(this,t))&&!this.wb.contains(i)))return void Rf(t,e,i);if("string"==typeof i){for(n=2;this.wb.contains(i+n);)n++;Rf(t,e,i+n)}else if(void 0===i||"number"==typeof i){for(i=-this.wb.count-1;this.wb.contains(i);)i--;Rf(t,e,i)}}}}},e.Jc=function(t){return null!==t&&this.$f.contains(t)},e.fi=function(t){null!==t&&(tt(t),this.Jc(t)||Qf(this,t,!0))},e.Ey=function(t){if(Array.isArray(t))for(var e=t.length,i=0;i<e;i++)this.fi(t[i]);else for(t=t.iterator;t.next();)this.fi(t.value)},e.bm=function(t){null!==t&&tp(this,t,!0)},e.lA=function(t){if(Array.isArray(t))for(var e=t.length,i=0;i<e;i++)this.bm(t[i]);else for(t=t.iterator;t.next();)this.bm(t.value)},e.Zz=function(t){if(""===this.linkKeyProperty&&w("GraphLinksModel.linkKeyProperty must not be an empty string for .mergeLinkDataArray() to succeed."),t!==this.linkDataArray&&P(t)){var e=this.kl;e.clear(),e.addAll(this.wb.iteratorKeys);var i=this.il;i.clear();for(var n=t.length,o=0;o<n;o++){var r=t[o],s=this.Ac(r);if(void 0!==s){i.add(s);var a=this.jh(s);a!==r&&(null!==a?(this.Do(a,r),ip(this,r,a)):(r=this.cloneDeep(r),this.Ks(r,s),this.fi(r)))}else s=this.cloneDeep(r),this.fi(s),i.add(this.Ac(s))}for(t=e.iterator;t.next();)n=t.value,i.contains(n)||(n=this.jh(n))&&this.bm(n);e.clear(),i.clear()}},e.Jo=function(t){if(null===t)return null;var e=this.Ak;return C(t=null!==e?e(t,this):jf(this,t,!0))&&(Q(t),""!==this.lf&&Rf(t,this.lf,void 0),""!==this.mf&&Rf(t,this.mf,void 0),""!==this.je&&Rf(t,this.je,[])),t},e.Yu=function(t){if(null===t)return!1;var e=this.jl;return""!==e&&!!zf(t,e)},e.lh=function(t){if(null!==t){var e=this.Je;if(""!==e&&void 0!==(e=zf(t,e))){if(Nf(e))return e;w("GroupKey value for node data "+t+" is not a number or a string: "+e)}}},e.mp=function(t,e){if(null===e&&(e=void 0),null!==t){var i=this.Je;if(""!==i)if(this.lb(t)){var n=zf(t,i);n!==e&&(Df(this,n,t),Rf(t,i,e),null===this.hc(e)&&Bf(this,e,t),Tf(this,"nodeGroupKey",di,i,t,n,e),"string"==typeof i&&this.La(t,i))}else Rf(t,i,e)}},Wf.prototype.copyNodeData=function(t){return null===t?null:(t=mf.prototype.copyNodeData.call(this,t),this.Ij||""===this.Je||void 0===zf(t,this.Je)||Rf(t,this.Je,void 0),t)},Wf.prototype.setDataProperty=function(t,e,i){if(this.lb(t)){if(e===this.nodeKeyProperty)return void this.km(t,i);if(e===this.nodeCategoryProperty)return void this.jm(t,i);if(e===this.nodeGroupKeyProperty)return void this.mp(t,i)}else if(this.Jc(t)){if(e===this.linkFromKeyProperty)return void $f(this,t,i,!0);if(e===this.linkToKeyProperty)return void $f(this,t,i,!1);if(e===this.linkFromPortIdProperty)return void Zf(this,t,i,!0);if(e===this.linkToPortIdProperty)return void Zf(this,t,i,!1);if(e===this.linkKeyProperty)return void this.Ks(t,i);if(e===this.linkCategoryProperty)return void this.lp(t,i);if(e===this.linkLabelKeysProperty)return void this.Ls(t,i)}var n=zf(t,e);n!==i&&(Rf(t,e,i),this.Fs(t,e,n,i))},(e=Wf.prototype).Do=function(t,e){if(e){var i,n=this.lb(t),o=this.Jc(t);for(i in e)"__gohashid"===i||n&&i===this.nodeKeyProperty||n&&i===this.nodeIsGroupProperty&&zf(t,i)===e[i]||o&&i===this.linkKeyProperty||this.setDataProperty(t,i,e[i])}},e.jp=function(t,e){mf.prototype.jp.call(this,t,e);for(var i=this.kb.iterator;i.next();)this.qv(i.value,t,e);for(i=this.$f.iterator;i.next();){var n=i.value,o=t,r=e;if(_f(this,n,!0)===o){var s=this.lf;Rf(n,s,r),Tf(this,"linkFromKey",di,s,n,o,r),"string"==typeof s&&this.La(n,s)}if(_f(this,n,!1)===o&&(Rf(n,s=this.mf,r),Tf(this,"linkToKey",di,s,n,o,r),"string"==typeof s&&this.La(n,s)),s=this.Ef(n),Array.isArray(s))for(var a=s.length,h=this.je,l=0;l<a;l++)s[l]===o&&(s[l]=r,Tf(this,"linkLabelKeys",fi,h,n,o,r,l,l))}},e.qv=function(t,e,i){if(this.lh(t)===e){var n=this.Je;Rf(t,n,i),Tf(this,"nodeGroupKey",di,n,t,e,i),"string"==typeof n&&this.La(t,n)}},e.Lv=function(){mf.prototype.Lv.call(this);for(var t=this.linkDataArray,e=t.length,i=0;i<e;i++)ep(this,t[i])},e.fm=function(t){mf.prototype.fm.call(this,t);var e=Ff(this,t=this.wa(t));if(null!==e){var i=A();for(e=e.iterator;e.next();){var n=e.value;if(this.lb(n)){if(this.lh(n)===t){var o=this.Je;Tf(this,"nodeGroupKey",di,o,n,t,t),"string"==typeof o&&this.La(n,o),i.push(n)}}else if(_f(this,n,!0)===t&&(o=this.lf,Tf(this,"linkFromKey",di,o,n,t,t),"string"==typeof o&&this.La(n,o),i.push(n)),_f(this,n,!1)===t&&(o=this.mf,Tf(this,"linkToKey",di,o,n,t,t),"string"==typeof o&&this.La(n,o),i.push(n)),o=this.Ef(n),Array.isArray(o))for(var r=o.length,s=this.je,a=0;a<r;a++)o[a]===t&&(Tf(this,"linkLabelKeys",fi,s,n,t,t,a,a),i.push(n))}for(e=0;e<i.length;e++)Df(this,t,i[e]);B(i)}},e.em=function(t){mf.prototype.em.call(this,t);var e=this.lh(t);null===this.hc(e)&&Bf(this,e,t)},e.qp=function(t){mf.prototype.qp.call(this,t),Df(this,this.lh(t),t)},e.ps=function(t){if(null===t)return"";var e=this.dj;return""===e||void 0===(e=zf(t,e))?"":"string"==typeof e?e:void w("getCategoryForLinkData found a non-string category for "+t+": "+e)},Wf.prototype.getLinkCategoryForData=function(t){return this.ps(t)},Wf.prototype.lp=function(t,e){if(null!==t){var i=this.dj;if(""!==i)if(this.Jc(t)){var n=zf(t,i);void 0===n&&(n=""),n!==e&&(Rf(t,i,e),Tf(this,"linkCategory",di,i,t,n,e),"string"==typeof i&&this.La(t,i))}else Rf(t,i,e)}},Wf.prototype.setLinkCategoryForData=function(t,e){this.lp(t,e)},(e=Wf.prototype).lm=function(t,e){mf.prototype.lm.call(this,t,e),this.mp(e,this.lh(t))},e.Wj=function(){return!0},e.ri=function(){return!0},e.xs=function(){return!0},e.Xj=function(){return!0},d.Object.defineProperties(Wf.prototype,{archetypeNodeData:{get:function(){return this.Ri},set:function(t){var e=this.Ri;e!==t&&(this.Ri=t,this.g("archetypeNodeData",e,t))}},linkFromKeyProperty:{get:function(){return this.lf},set:function(t){var e=this.lf;e!==t&&(this.lf=t,this.g("linkFromKeyProperty",e,t))}},linkToKeyProperty:{get:function(){return this.mf},set:function(t){var e=this.mf;e!==t&&(this.mf=t,this.g("linkToKeyProperty",e,t))}},linkFromPortIdProperty:{get:function(){return this.ej},set:function(t){var e=this.ej;e!==t&&(this.ej=t,this.g("linkFromPortIdProperty",e,t))}},linkToPortIdProperty:{get:function(){return this.fj},set:function(t){var e=this.fj;e!==t&&(this.fj=t,this.g("linkToPortIdProperty",e,t))}},linkLabelKeysProperty:{get:function(){return this.je},set:function(t){var e=this.je;e!==t&&(this.je=t,this.g("linkLabelKeysProperty",e,t))}},linkDataArray:{get:function(){return this.md},set:function(t){var e=this.md;if(e!==t){this.wb.clear();for(var i=t.length,n=0;n<i;n++){var o=t[n];C(o)||w("GraphLinksModel.linkDataArray must only contain Objects, not: "+o),tt(o)}if(this.md=t,""!==this.linkKeyProperty){for(n=new $,o=0;o<i;o++){var r=t[o],s=this.Ac(r);void 0===s||null!==this.wb.I(s)?n.add(r):this.wb.add(s,r)}for(n=n.iterator;n.next();)o=n.value,this.Bs(o),void 0!==(r=this.Ac(o))&&this.wb.add(r,o)}for(n=new Z,o=0;o<i;o++)n.add(t[o]);for(this.$f=n,Tf(this,"linkDataArray",di,"linkDataArray",this,e,t),e=0;e<i;e++)ep(this,t[e])}}},linkKeyProperty:{get:function(){return this.Jh},set:function(t){var e=this.Jh;if(e!==t){this.Jh=t,this.wb.clear();for(var i=this.linkDataArray.length,n=0;n<i;n++){var o=this.linkDataArray[n],r=this.Ac(o);void 0===r&&(this.Bs(o),r=this.Ac(o)),void 0!==r&&this.wb.add(r,o)}this.g("linkKeyProperty",e,t)}}},makeUniqueLinkKeyFunction:{get:function(){return this.cl},set:function(t){var e=this.cl;e!==t&&(this.cl=t,this.g("makeUniqueLinkKeyFunction",e,t))}},copyLinkDataFunction:{get:function(){return this.Ak},set:function(t){var e=this.Ak;e!==t&&(this.Ak=t,this.g("copyLinkDataFunction",e,t))}},nodeIsGroupProperty:{get:function(){return this.jl},set:function(t){var e=this.jl;e!==t&&(this.jl=t,this.g("nodeIsGroupProperty",e,t))}},nodeGroupKeyProperty:{get:function(){return this.Je},set:function(t){var e=this.Je;e!==t&&(this.Je=t,this.g("nodeGroupKeyProperty",e,t))}},Ij:{get:function(){return this.Lm},set:function(t){this.Lm!==t&&(this.Lm=t)}},linkCategoryProperty:{get:function(){return this.dj},set:function(t){var e=this.dj;e!==t&&(this.dj=t,this.g("linkCategoryProperty",e,t))}},type:{get:function(){return"GraphLinksModel"}}}),Wf.prototype.setCategoryForLinkData=Wf.prototype.lp,Wf.prototype.getCategoryForLinkData=Wf.prototype.ps,Wf.prototype.assignAllDataProperties=Wf.prototype.Do,Wf.prototype.setGroupKeyForNodeData=Wf.prototype.mp,Wf.prototype.getGroupKeyForNodeData=Wf.prototype.lh,Wf.prototype.isGroupForNodeData=Wf.prototype.Yu,Wf.prototype.copyLinkData=Wf.prototype.Jo,Wf.prototype.mergeLinkDataArray=Wf.prototype.Zz,Wf.prototype.removeLinkDataCollection=Wf.prototype.lA,Wf.prototype.removeLinkData=Wf.prototype.bm,Wf.prototype.addLinkDataCollection=Wf.prototype.Ey,Wf.prototype.addLinkData=Wf.prototype.fi,Wf.prototype.containsLinkData=Wf.prototype.Jc,Wf.prototype.makeLinkDataKeyUnique=Wf.prototype.Bs,Wf.prototype.findLinkDataForKey=Wf.prototype.jh,Wf.prototype.setKeyForLinkData=Wf.prototype.Ks,Wf.prototype.getKeyForLinkData=Wf.prototype.Ac,Wf.prototype.removeLabelKeyForLinkData=Wf.prototype.Qx,Wf.prototype.addLabelKeyForLinkData=Wf.prototype.Bu,Wf.prototype.setLabelKeysForLinkData=Wf.prototype.Ls,Wf.prototype.getLabelKeysForLinkData=Wf.prototype.Ef,Wf.prototype.setToPortIdForLinkData=Wf.prototype.Cv,Wf.prototype.getToPortIdForLinkData=Wf.prototype.Cx,Wf.prototype.setFromPortIdForLinkData=Wf.prototype.xv,Wf.prototype.getFromPortIdForLinkData=Wf.prototype.zx,Wf.prototype.setToKeyForLinkData=Wf.prototype.Bv,Wf.prototype.getToKeyForLinkData=Wf.prototype.Bx,Wf.prototype.setFromKeyForLinkData=Wf.prototype.wv,Wf.prototype.getFromKeyForLinkData=Wf.prototype.yx,Wf.prototype.clear=Wf.prototype.clear;var np=Object.freeze([]);function op(t,e){mf.call(this),this.Ke="parent",this.Nm=!1,this.nj="parentLinkCategory",void 0!==t&&(P(t)?this.nodeDataArray=t:e=t),e&&(Object.assign(this,e),t=e.Changed)&&(delete this.Changed,this.Pe(t))}function rp(t){Bd.call(this),this.lw=this.Zm=this.lc=0,this.Wp=360,this.kw=yp,this.Ti=0,this.Zv=new pt,this.Jp=this.me=0,this.Xr=new Dp,this.gt=this.mj=0,this.ty=600,this.eo=NaN,this.Cm=1,this.ro=0,this.ul=360,this.Rb=yp,this.K=wp,this.nd=Lp,this.hd=Vd,this.tf=6,this.Nn=Ap,t&&Object.assign(this,t)}function sp(t,e,i,n,o){var r=t.Wp,s=t.lc;t=t.me,n=n*Math.PI/180,i=i*Math.PI/180;for(var a=e.length,h=0;h<a;h++){var l=n+(o===wp?h*i/(360<=r?a:a-1):-h*i/a),u=e.M(h),c=s*Math.tan(l)/t;c=Math.sqrt((s*s+t*t*c*c)/(1+c*c)),u.centerX=c*Math.cos(l),u.centerY=c*Math.sin(l),u.actualAngle=180*l/Math.PI}}function ap(t,e,i,n){var o=t.lc,r=t.me,s=t.Ti;i=i*Math.PI/180;for(var a=e.length,h=0;h<a;h++){var l=e.M(h),u=e.M(h===a-1?0:h+1),c=r*Math.sin(i);l.centerX=o*Math.cos(i),l.centerY=c,l.actualAngle=180*i/Math.PI,isNaN(l.diameter)&&Ep(l,0),isNaN(u.diameter)&&Ep(u,0),l=mp(t,o,r,n===wp?i:-i,(l.diameter+u.diameter)/2+s),i+=n===wp?l:-l}}function hp(t,e,i,n){var o=t.lc,r=t.me,s=t.Jp;i=i*Math.PI/180;for(var a=e.length,h=0;h<a;h++){var l=e.M(h);l.centerX=o*Math.cos(i),l.centerY=r*Math.sin(i),l.actualAngle=180*i/Math.PI,l=mp(t,o,r,n===wp?i:-i,s),i+=n===wp?l:-l}}function lp(t,e,i,n,o){var r=t.Wp;if(t.mj=0,t.Xr=new Dp,360>i){for(r=n+(o===wp?r:-r);0>r;)r+=360;180<(r%=360)&&(r-=360),r*=Math.PI/180,t.gt=r,cp(t,e,i,n,o)}else up(t,e,i,n,o);t.Xr.commit(e)}function up(t,e,i,n,o){var r=t.lc,s=t.Ti,a=t.Zm,h=r*Math.cos(n*Math.PI/180),l=t.me*Math.sin(n*Math.PI/180),u=e.Fa();if(3===u.length)u[0].centerX=r,u[0].centerY=0,u[1].centerX=u[0].centerX-u[0].width/2-u[1].width/2-s,u[1].y=u[0].y,u[2].centerX=(u[0].centerX+u[1].centerX)/2,u[2].y=u[0].y-u[2].height-s;else if(4===u.length)u[0].centerX=r,u[0].centerY=0,u[2].centerX=-u[0].centerX,u[2].centerY=u[0].centerY,u[1].centerX=0,u[1].y=Math.min(u[0].y,u[2].y)-u[1].height-s,u[3].centerX=0,u[3].y=Math.max(u[0].y+u[0].height+s,u[2].y+u[2].height+s);else{r=pt.alloc();for(var c=0;c<u.length&&(u[c].centerX=h,u[c].centerY=l,!(c>=u.length-1));c++)dp(t,h,l,u,c,o,r)||fp(t,h,l,u,c,o,r),h=r.x,l=r.y;if(pt.free(r),t.mj++,!(23<t.mj)){h=u[0].centerX,l=u[0].centerY,r=u[u.length-1].centerX,c=u[u.length-1].centerY;var d=Math.abs(h-r)-((u[0].width+u[u.length-1].width)/2+s),f=Math.abs(l-c)-((u[0].height+u[u.length-1].height)/2+s);s=0,1>Math.abs(f)?Math.abs(h-r)<(u[0].width+u[u.length-1].width)/2&&(s=0):s=0<f?f:1>Math.abs(d)?0:d,h=Math.abs(r)>Math.abs(c)?0<r!=l>c:0<c!=h<r,(h=o===wp?h:!h)&&(s=-Math.abs(s),s=Math.min(s,-u[u.length-1].width),s=Math.min(s,-u[u.length-1].height)),t.Xr.compare(s,u),1<Math.abs(s)&&(t.lc=8>t.mj?t.lc-s/(2*Math.PI):5>u.length&&10<s?t.lc/2:t.lc-(0<s?1.7:-2.3),t.me=t.lc*a,up(t,e,i,n,o))}}}function cp(t,e,i,n,o){for(var r=t.lc,s=t.me,a=t.Zm,h=r*Math.cos(n*Math.PI/180),l=s*Math.sin(n*Math.PI/180),u=pt.alloc(),c=e.Fa(),d=0;d<c.length&&(c[d].centerX=h,c[d].centerY=l,!(d>=c.length-1));d++)dp(t,h,l,c,d,o,u)||fp(t,h,l,c,d,o,u),h=u.x,l=u.y;if(pt.free(u),t.mj++,!(23<t.mj)){if(h=Math.atan2(l,h),h=o===wp?t.gt-h:h-t.gt,r=(h=Math.abs(h)<Math.abs(h-2*Math.PI)?h:h-2*Math.PI)*(r+s)/2,s=t.Xr,Math.abs(r)<Math.abs(s.Pl))for(s.Pl=r,s.mk=[],s.tm=[],h=0;h<c.length;h++)s.mk[h]=c[h].bounds.x,s.tm[h]=c[h].bounds.y;1<Math.abs(r)&&(t.lc=8>t.mj?t.lc-r/(2*Math.PI):t.lc-(0<r?1.7:-2.3),t.me=t.lc*a,cp(t,e,i,n,o))}}function dp(t,e,i,n,o,r,s){var a=t.lc,h=t.me,l=0;t=(n[o].width+n[o+1].width)/2+t.Ti;var u=!1;if(0<=i!=(r===wp)){if((r=e+t)>a){if((r=e-t)<-a)return s.x=r,s.y=l,!1;u=!0}}else if((r=e-t)<-a){if((r=e+t)>a)return s.x=r,s.y=l,!1;u=!0}return l=Math.sqrt(1-Math.min(1,r*r/(a*a)))*h,0>i!==u&&(l=-l),Math.abs(i-l)>(n[o].height+n[o+1].height)/2?(s.x=r,s.y=l,!1):(s.x=r,s.y=l,!0)}function fp(t,e,i,n,o,r,s){var a=t.lc,h=t.me,l=0;if(t=(n[o].height+n[o+1].height)/2+t.Ti,n=!1,0<=e!=(r===wp)){if((r=i-t)<-h){if((r=i+t)>h)return s.x=l,void(s.y=r);n=!0}}else if((r=i+t)>h){if((r=i-t)<-h)return s.x=l,void(s.y=r);n=!0}l=Math.sqrt(1-Math.min(1,r*r/(h*h)))*a,0>e!==n&&(l=-l),s.x=l,s.y=r}function pp(t,e,i,n,o){var r=t.ty;if(.001>Math.abs(t.Zm-1))return void 0!==n&&void 0!==o?o*e:2*Math.PI*e;t=e>i?Math.sqrt(e*e-i*i)/e:Math.sqrt(i*i-e*e)/i;for(var s=0,a=void 0!==n&&void 0!==o?o/(r+1):Math.PI/(2*(r+1)),h=0,l=0;l<=r;l++){h=void 0!==n&&void 0!==o?n+l*o/r:l*Math.PI/(2*r);var u=Math.sin(h);s+=Math.sqrt(1-t*t*u*u)*a}return void 0!==n&&void 0!==o?(e>i?e:i)*s:4*(e>i?e:i)*s}function gp(t,e,i,n,o){return e/(void 0!==n&&void 0!==o?pp(t,1,i,n,o):pp(t,1,i))}function mp(t,e,i,n,o){if(.001>Math.abs(t.Zm-1))return o/e;var r=e>i?Math.sqrt(e*e-i*i)/e:Math.sqrt(i*i-e*e)/i,s=0;t=2*Math.PI/(700*t.network.vertexes.count),e>i&&(n+=Math.PI/2);for(var a=0;;a++){var h=Math.sin(n+a*t);if((s+=(e>i?e:i)*Math.sqrt(1-r*r*h*h)*t)>=o)return a*t}}Wf.className="GraphLinksModel",Gf.GraphLinksModel=Wf,mf.constructGraphLinksModel=mf.constructGraphLinksModel=function(){return new Wf},mf.initDiagramModel=Ef=function(){return new Wf},c(op,mf),op.constructGraphLinksModel=mf.constructGraphLinksModel,op.prototype.cloneProtected=function(t){mf.prototype.cloneProtected.call(this,t),t.Ke=this.Ke,t.Nm=this.Nm,t.nj=this.nj},(e=op.prototype).toString=function(t){if(void 0===t&&(t=0),2<=t)return this.np();var e=(""!==this.name?this.name:"")+" TreeModel";if(0<t){e+="\n node data:";for(var i=(t=this.nodeDataArray).length,n=0;n<i;n++){var o=t[n];e+=" "+this.wa(o)+":"+F(o)}}return e},e.rm=function(){var t=mf.prototype.rm.call(this),e="";return"parent"!==this.nodeParentKeyProperty&&"string"==typeof this.nodeParentKeyProperty&&(e+=',\n "nodeParentKeyProperty": '+this.quote(this.nodeParentKeyProperty)),t+e},e.gp=function(t){mf.prototype.gp.call(this,t),t.nodeParentKeyProperty&&(this.nodeParentKeyProperty=t.nodeParentKeyProperty)},e.fp=function(t){void 0!==t.nodeParentKeyProperty&&t.nodeParentKeyProperty!==this.nodeParentKeyProperty&&w("applyIncrementalJson cannot change Model properties"),mf.prototype.fp.call(this,t)},e.Vl=function(t){return t},e.mh=function(t){if(null!==t){var e=this.Ke;if(""!==e&&void 0!==(e=zf(t,e))){if(Nf(e))return e;w("ParentKey value for node data "+t+" is not a number or a string: "+e)}}},e.qe=function(t,e){if(null===e&&(e=void 0),null!==t){var i=this.Ke;if(""!==i)if(e=this.Vl(e),this.lb(t)){var n=zf(t,i);n!==e&&(Df(this,n,t),Rf(t,i,e),null===this.hc(e)&&Bf(this,e,t),Tf(this,"nodeParentKey",di,i,t,n,e),"string"==typeof i&&this.La(t,i))}else Rf(t,i,e)}},e.ss=function(t){if(null===t)return"";var e=this.nj;return""===e||void 0===(e=zf(t,e))?"":"string"==typeof e?e:(w("getParentLinkCategoryForNodeData found a non-string category for "+t+": "+e),"")},op.prototype.getLinkCategoryForData=function(t){return this.ss(t)},op.prototype.Ms=function(t,e){if(null!==t){var i=this.nj;if(""!==i)if(this.lb(t)){var n=zf(t,i);void 0===n&&(n=""),n!==e&&(Rf(t,i,e),Tf(this,"parentLinkCategory",di,i,t,n,e),"string"==typeof i&&this.La(t,i))}else Rf(t,i,e)}},op.prototype.setLinkCategoryForData=function(t,e){this.Ms(t,e)},op.prototype.copyNodeData=function(t){return null===t?null:(t=mf.prototype.copyNodeData.call(this,t),this.Jj||""===this.Ke||void 0===zf(t,this.Ke)||Rf(t,this.Ke,void 0),t)},op.prototype.setDataProperty=function(t,e,i){if(this.lb(t)){if(e===this.nodeKeyProperty)return void this.km(t,i);if(e===this.nodeCategoryProperty)return void this.jm(t,i);if(e===this.nodeParentKeyProperty)return void this.qe(t,i)}var n=zf(t,e);n!==i&&(Rf(t,e,i),this.Fs(t,e,n,i))},(e=op.prototype).jp=function(t,e){mf.prototype.jp.call(this,t,e);for(var i=this.kb.iterator;i.next();)this.qv(i.value,t,e)},e.qv=function(t,e,i){if(this.mh(t)===e){var n=this.Ke;Rf(t,n,i),Tf(this,"nodeParentKey",di,n,t,e,i),"string"==typeof n&&this.La(t,n)}},e.fm=function(t){mf.prototype.fm.call(this,t);var e=Ff(this,t=this.wa(t));if(null!==e){var i=A();for(e=e.iterator;e.next();){var n=e.value;if(this.lb(n)&&this.mh(n)===t){var o=this.Ke;Tf(this,"nodeParentKey",di,o,n,t,t),"string"==typeof o&&this.La(n,o),i.push(n)}}for(e=0;e<i.length;e++)Df(this,t,i[e]);B(i)}},e.em=function(t){mf.prototype.em.call(this,t);var e=this.mh(t);e=this.Vl(e),null===this.hc(e)&&Bf(this,e,t)},e.qp=function(t){mf.prototype.qp.call(this,t),Df(this,this.mh(t),t)},e.lm=function(t,e){mf.prototype.lm.call(this,t,e),this.Ms(e,this.ss(t)),this.qe(e,this.mh(t))},e.Tl=function(){return!0},e.xs=function(){return!0},d.Object.defineProperties(op.prototype,{nodeParentKeyProperty:{get:function(){return this.Ke},set:function(t){var e=this.Ke;e!==t&&(this.Ke=t,this.g("nodeParentKeyProperty",e,t))}},Jj:{get:function(){return this.Nm},set:function(t){this.Nm!==t&&(this.Nm=t)}},parentLinkCategoryProperty:{get:function(){return this.nj},set:function(t){var e=this.nj;e!==t&&(this.nj=t,this.g("parentLinkCategoryProperty",e,t))}},linkCategoryProperty:{get:function(){return this.parentLinkCategoryProperty},set:function(t){this.parentLinkCategoryProperty=t}},type:{get:function(){return"TreeModel"}}}),op.prototype.setParentLinkCategoryForNodeData=op.prototype.Ms,op.prototype.getParentLinkCategoryForNodeData=op.prototype.ss,op.prototype.setParentKeyForNodeData=op.prototype.qe,op.prototype.getParentKeyForNodeData=op.prototype.mh,op.className="TreeModel",Gf.TreeModel=op,c(rp,Bd),rp.prototype.cloneProtected=function(t){Bd.prototype.cloneProtected.call(this,t),t.eo=this.eo,t.Cm=this.Cm,t.ro=this.ro,t.ul=this.ul,t.Rb=this.Rb,t.K=this.K,t.nd=this.nd,t.hd=this.hd,t.tf=this.tf,t.Nn=this.Nn},rp.prototype.qb=function(t){t.classType===rp?t===Tp||t===Np||t===Cp||t===Pp||t===Lp?this.sorting=t:t===Sp||t===Mp||t===wp||t===kp?this.direction=t:t===xp||t===vp||t===yp||t===bp?this.arrangement=t:t!==Bp&&t!==Ap||(this.nodeDiameterFormula=t):Bd.prototype.qb.call(this,t)},rp.prototype.createNetwork=function(){return new Fp(this)},rp.prototype.doLayout=function(t){if(null===this.network&&(this.network=this.makeNetwork(t)),this.arrangementOrigin=this.initialOrigin(this.arrangementOrigin),1>=(t=this.network.vertexes).count)1===t.count&&((t=t.first()).centerX=0,t.centerY=0);else{var e=new $;e.addAll(t.iterator),t=new $;var i,n,o=new $,r=this.sort(e),s=this.Jp,a=this.arrangement,h=this.nodeDiameterFormula,l=this.radius;(!isFinite(l)||0>=l)&&(l=NaN);var u=this.aspectRatio;(!isFinite(u)||0>=u)&&(u=1);var c=this.startAngle;isFinite(c)||(c=0);var d=this.sweepAngle;if((!isFinite(d)||360<d||1>d)&&(d=360),e=this.spacing,isFinite(e)||(e=NaN),a===bp&&h===Bp?a=yp:a===bp&&h!==Bp&&(a=this.arrangement),(this.direction===Sp||this.direction===Mp)&&this.sorting!==Lp){for(h=0;!(h>=r.length)&&(t.add(r.M(h)),!(h+1>=r.length));h+=2)o.add(r.M(h+1));this.direction===Sp?(this.arrangement===bp&&t.reverse(),(r=new $).addAll(t),r.addAll(o)):(this.arrangement===bp&&o.reverse(),(r=new $).addAll(o),r.addAll(t))}h=r.length;for(var f=n=i=0;f<r.length;f++){var p=c+d*n*(this.direction===wp?1:-1)/h,g=r.M(f).diameter;isNaN(g)&&(g=Ep(r.M(f),p)),360>d&&(0===f||f===r.length-1)&&(g/=2),i+=g,n++}if(isNaN(l)||a===bp){if(isNaN(e)&&(e=6),a!==yp&&a!==bp){for(n=-1/0,s=0;s<h;s++)f=r.M(s),i=r.M(s===h-1?0:s+1),isNaN(f.diameter)&&Ep(f,0),isNaN(i.diameter)&&Ep(i,0),n=Math.max(n,(f.diameter+i.diameter)/2);s=n+e,l=a===xp?(n+e)/(2*Math.PI/h):gp(this,s*(360<=d?h:h-1),u,c*Math.PI/180,d*Math.PI/180)}else l=gp(this,i+(360<=d?h:h-1)*(a!==bp?e:1.6*e),u,c*Math.PI/180,d*Math.PI/180);n=l*u}else if(f=pp(this,l,n=l*u,c*Math.PI/180,d*Math.PI/180),isNaN(e))a!==yp&&a!==bp||(e=(f-i)/(360<=d?h:h-1));else if(a===yp||a===bp)(f=(f-i)/(360<=d?h:h-1))<e?n=(l=gp(this,i+e*(360<=d?h:h-1),u,c*Math.PI/180,d*Math.PI/180))*u:e=f;else{for(s=-1/0,i=0;i<h;i++)p=r.M(i),g=r.M(i===h-1?0:i+1),isNaN(p.diameter)&&Ep(p,0),isNaN(g.diameter)&&Ep(g,0),s=Math.max(s,(p.diameter+g.diameter)/2);(i=gp(this,(s+=e)*(360<=d?h:h-1),u,c*Math.PI/180,d*Math.PI/180))>l?n=(l=i)*u:s=f/(360<=d?h:h-1)}if(this.kw=a,this.lc=l,this.Zm=u,this.lw=c,this.Wp=d,this.Ti=e,this.me=n,this.Jp=s,e=r,r=this.kw,a=this.lc,l=this.lw,u=this.Wp,c=this.Ti,d=this.me,h=this.Jp,this.direction!==Sp&&this.direction!==Mp||r!==bp)if(this.direction===Sp||this.direction===Mp){switch(s=0,r){case vp:s=180*mp(this,a,d,l,h)/Math.PI;break;case yp:h=e=0,null!==(s=t.first())&&(e=Ep(s,Math.PI/2)),null!==(s=o.first())&&(h=Ep(s,Math.PI/2)),s=180*mp(this,a,d,l,c+(e+h)/2)/Math.PI;break;case xp:s=u/e.length}if(this.direction===Sp){switch(r){case vp:hp(this,t,l,kp);break;case yp:ap(this,t,l,kp);break;case xp:sp(this,t,u/2,l,kp)}switch(r){case vp:hp(this,o,l+s,wp);break;case yp:ap(this,o,l+s,wp);break;case xp:sp(this,o,u/2,l+s,wp)}}else{switch(r){case vp:hp(this,o,l,kp);break;case yp:ap(this,o,l,kp);break;case xp:sp(this,o,u/2,l,kp)}switch(r){case vp:hp(this,t,l+s,wp);break;case yp:ap(this,t,l+s,wp);break;case xp:sp(this,t,u/2,l+s,wp)}}}else switch(r){case vp:hp(this,e,l,this.direction);break;case yp:ap(this,e,l,this.direction);break;case xp:sp(this,e,u,l,this.direction);break;case bp:lp(this,e,u,l,this.direction)}else lp(this,e,u,l-u/2,wp)}this.updateParts(),this.network=null,this.isValidLayout=!0},rp.prototype.commitLayout=function(){this.commitNodes(),this.isRouting&&this.commitLinks()},rp.prototype.commitNodes=function(){var t=null!==this.group&&null!==this.group.placeholder&&this.group.isSubGraphExpanded,e=t?this.group.location.copy():null,i=this.actualCenter;t?i=new pt(0,0):(i.x=this.arrangementOrigin.x+this.lc,i.y=this.arrangementOrigin.y+this.me);for(var n=this.network.vertexes.iterator;n.next();){var o=n.value;o.x+=i.x,o.y+=i.y,o.commit()}t&&(this.group.Va(),t=this.group.position.copy(),i=this.group.location.copy(),e=e.re(i.re(t)),this.group.move(e),this.Zv=e.re(t))},rp.prototype.commitLinks=function(){for(var t=this.network.edges.iterator;t.next();)t.value.commit()},rp.prototype.sort=function(t){switch(this.sorting){case Cp:break;case Pp:t.reverse();break;case Tp:t.sort(this.comparer);break;case Np:t.sort(this.comparer),t.reverse();break;case Lp:return this.ak(function(t){for(var e=[],i=0;i<t.length;i++)e.push(0);i=new $;for(var n=0;n<t.length;n++){var o=-1,r=-1;if(0===n)for(var s=0;s<t.length;s++){var a=t.M(s).edgesCount;a>o&&(o=a,r=s)}else for(s=0;s<t.length;s++)(a=e[s])>o&&(o=a,r=s);for(i.add(t.M(r)),e[r]=-1,s=(r=t.M(r)).sourceEdges;s.next();)0>(o=t.indexOf(s.value.fromVertex))||0<=e[o]&&e[o]++;for(r=r.destinationEdges;r.next();)0>(o=t.indexOf(r.value.toVertex))||0<=e[o]&&e[o]++}return i}(t));default:w("Invalid sorting type.")}return t},rp.prototype.ak=function(t){for(var e=[],i=0;i<t.length;i++){var n=t.M(i);e[i]=[];for(var o,r=n.destinationEdges;r.next();)(o=t.indexOf(r.value.toVertex))!==i&&0>e[i].indexOf(o)&&e[i].push(o);for(n=n.sourceEdges;n.next();)(o=t.indexOf(n.value.fromVertex))!==i&&0>e[i].indexOf(o)&&e[i].push(o)}for(r=[],i=0;i<e.length;i++)r[i]=0;i=[];var s=[],a=[];n=[],o=new $;for(var h=0,l=0;l<e.length;l++){var u=e[l].length;if(1===u)n.push(l);else if(0===u)o.add(t.M(l));else{if(0===h)i.push(l);else{for(var c=u=1/0,d=-1,f=[],p=0;p<i.length;p++)0>e[i[p]].indexOf(i[p===i.length-1?0:p+1])&&f.push(p===i.length-1?0:p+1);if(0===f.length)for(p=0;p<i.length;p++)f.push(p);for(p=0;p<f.length;p++){for(var g=f[p],m=e[l],y=0,v=0;v<s.length;v++){var x=r[s[v]],b=r[a[v]];if(x<b){var w=x;x=b}else w=b;if(w<g&&g<=x)for(b=0;b<m.length;b++){var k=m[b];0>i.indexOf(k)||w<r[k]&&r[k]<x||w===r[k]||x===r[k]||y++}else for(b=0;b<m.length;b++)k=m[b],0>i.indexOf(k)||w<r[k]&&r[k]<x&&w!==r[k]&&x!==r[k]&&y++}for(m=y,v=y=0;v<e[l].length;v++)0<=(w=i.indexOf(e[l][v]))&&(y+=(w=Math.abs(g-(w>=g?w+1:w)))<i.length+1-w?w:i.length+1-w);for(v=0;v<s.length;v++)(w=r[s[v]])>=g&&w++,(x=r[a[v]])>=g&&x++,w>x&&(b=x,x=w,w=b),x-w<(i.length+2)/2==(w<g&&g<=x)&&y++;(m<u||m===u&&y<c)&&(u=m,c=y,d=g)}for(i.splice(d,0,l),u=0;u<i.length;u++)r[i[u]]=u;for(u=0;u<e[l].length;u++)c=e[l][u],0<=i.indexOf(c)&&(s.push(l),a.push(c))}h++}}for(s=i.length;;){for(r=!0,a=0;a<n.length;a++)if(l=e[h=n[a]][0],0<=(u=i.indexOf(l))){for(d=c=0;d<e[l].length;d++)0>(f=i.indexOf(e[l][d]))||f===u||(c+=f<u!=(p=f>u?f-u:u-f)>s-p?1:-1);i.splice(0>c?u:u+1,0,h),n.splice(a,1),a--}else r=!1;if(r)break;i.push(n[0]),n.splice(0,1)}for(e=0;e<i.length;e++)o.add(t.M(i[e]));return o},d.Object.defineProperties(rp.prototype,{radius:{get:function(){return this.eo},set:function(t){this.eo!==t&&(0<t||isNaN(t))&&(this.eo=t,this.C())}},aspectRatio:{get:function(){return this.Cm},set:function(t){this.Cm!==t&&0<t&&(this.Cm=t,this.C())}},startAngle:{get:function(){return this.ro},set:function(t){this.ro!==t&&(this.ro=t,this.C())}},sweepAngle:{get:function(){return this.ul},set:function(t){this.ul!==t&&(this.ul=0<t&&360>=t?t:360,this.C())}},arrangement:{get:function(){return this.Rb},set:function(t){this.Rb===t||t!==bp&&t!==yp&&t!==vp&&t!==xp||(this.Rb=t,this.C())}},direction:{get:function(){return this.K},set:function(t){this.K===t||t!==wp&&t!==kp&&t!==Sp&&t!==Mp||(this.K=t,this.C())}},sorting:{get:function(){return this.nd},set:function(t){this.nd===t||t!==Cp&&t!==Pp&&t!==Tp&&!Np&&t!==Lp||(this.nd=t,this.C())}},comparer:{get:function(){return this.hd},set:function(t){this.hd!==t&&(this.hd=t,this.C())}},spacing:{get:function(){return this.tf},set:function(t){this.tf!==t&&(this.tf=t,this.C())}},nodeDiameterFormula:{get:function(){return this.Nn},set:function(t){this.Nn===t||t!==Ap&&t!==Bp||(this.Nn=t,this.C())}},actualXRadius:{get:function(){return this.lc}},actualYRadius:{get:function(){return this.me}},actualSpacing:{get:function(){return this.Ti}},actualCenter:{get:function(){return this.Zv}}});var yp=new V(rp,"ConstantSpacing",0),vp=new V(rp,"ConstantDistance",1),xp=new V(rp,"ConstantAngle",2),bp=new V(rp,"Packed",3),wp=new V(rp,"Clockwise",4),kp=new V(rp,"Counterclockwise",5),Sp=new V(rp,"BidirectionalLeft",6),Mp=new V(rp,"BidirectionalRight",7),Cp=new V(rp,"Forwards",8),Pp=new V(rp,"Reverse",9),Tp=new V(rp,"Ascending",10),Np=new V(rp,"Descending",11),Lp=new V(rp,"Optimized",12),Ap=new V(rp,"Pythagorean",13),Bp=new V(rp,"Circular",14);function Dp(){this.Pl=-1/0,this.tm=this.mk=null}function Fp(t){jd.call(this,t)}function jp(t){Rd.call(this,t),this.u=this.Si=NaN}function Ep(t,e){var i=t.network;if(null===i)return NaN;if(null===(i=i.layout))return NaN;if(i.arrangement===bp)if(i.nodeDiameterFormula===Bp)t.Si=Math.max(t.width,t.height);else{if(i=Math.abs(Math.sin(e)),e=Math.abs(Math.cos(e)),0===i)return t.width;if(0===e)return t.height;t.Si=Math.min(t.height/i,t.width/e)}else t.Si=i.nodeDiameterFormula===Bp?Math.max(t.width,t.height):Math.sqrt(t.width*t.width+t.height*t.height);return t.Si}function Op(t){Gd.call(this,t)}function Ip(t){Bd.call(this),this.ah=null,this.An=0,this.$d=new At(100,100).freeze(),this.Bm=!1,this.sf=!0,this.td=!1,this.dl=100,this.$m=1,this.Zf=1e3,this.In=10,this.fo=Math,this.Hk=.05,this.Gk=50,this.Ek=150,this.Fk=0,this.Vm=10,this.Um=5,t&&Object.assign(this,t)}function zp(t,e,i){if(function(t,e){if(10<e||3>t.network.vertexes.count)return!1;for(t.ah=t.network.vertexes.Fa(),(t=t.ah).sort((function(t,e){return null===t||null===e||t===e?0:e.Vd-t.Vd})),e=t.length-1;0<=e&&1>=t[e].Vd;)e--;return 1<t.length-e}(t,e)){var n=t.Zf;t.Zf*=1+1/(e+1);var o=function(t,e){for(var i=t.network,n=new Up(t),o=0;o<t.ah.length;o++){var r=t.ah[o];if(!(1<r.Vd))break;n.dh(r);var s=new Xp;s.Rs=r.Vd,s.Ss=r.width,s.Qs=r.height,s.Sv=r.focus.x,s.Tv=r.focus.y,null===r.We&&(r.We=new $),r.We.add(s),r.sv=r.We.count-1}for(r=i.edges.iterator;r.next();){var a=r.value;o=a.fromVertex,s=a.toVertex,o.network===n&&s.network===n?n.Bo(a):o.network===n?(null===(a=o.Hj)&&(a=new $,o.Hj=a),a.add(s),o.Vd--,o.sh+=s.sh):s.network===n&&(null===(a=s.Hj)&&(a=new $,s.Hj=a),a.add(o),s.Vd--,s.sh+=o.sh)}for(o=n.edges.iterator;o.next();)(r=o.value).length*=Math.max(1,Ye.sqrt((r.fromVertex.sh+r.toVertex.sh)/(4*e+1)));for(e=n.vertexes.iterator;e.next();){var h=(o=e.value).Hj;if(null!==h&&0<h.count&&!(0>=(s=o.We.M(o.We.count-1).Rs-o.Vd))){for(var l=a=0,u=h.count-s;u<h.count;u++){var c=h.M(u),d=null;for(r=c.edges.iterator;r.next();){var f=r.value;if(f.Ax(c)===o){d=f;break}}null!==d&&(l+=d.length,a+=c.width*c.height)}r=o.centerX,h=o.centerY,u=o.width,c=o.height,d=o.focus,1>(f=u*c)&&(f=1),s=((a=Ye.sqrt((a+f+l*l*4/(s*s))/f))-1)*u/2,a=(a-1)*c/2,o.bounds=new jt(r-d.x-s,h-d.y-a,u+2*s,c+2*a),o.focus=new pt(d.x+s,d.y+a)}}return t.network=n,i}(t,e),r=Math.max(0,Math.max(Math.min(t.network.vertexes.count,i*(e+1)/11),10));for(t.maxIterations+=r,zp(t,e+1,i),Hp(t,r),function(t,e){for(var i=t.network.vertexes.iterator;i.next();){var n=i.value;if(n.network=e,null!==n.We){var o=n.We.M(n.sv);n.Vd=o.Rs;var r=o.Sv,s=o.Tv;n.bounds=new jt(n.centerX-r,n.centerY-s,o.Ss,o.Qs),n.focus=new pt(r,s),n.sv--}}for(i=t.network.edges.iterator;i.next();)i.value.network=e;t.network=e}(t,o),(e=o.vertexes.Fa()).sort((function(t,e){return null===t||null===e||t===e?0:e.Vd-t.Vd})),i=0;i<e.length;i++)Rp(t,e[i]);t.Zf=n}}function Rp(t,e){var i=e.Hj;if(null!==i&&0!==i.count){var n=e.centerX,o=e.centerY,r=e.width,s=e.height;null!==e.We&&0<e.We.count&&(r=(s=e.We.M(0)).Ss,s=s.Qs),r=Ye.sqrt(r*r+s*s)/2;for(var a=!1,h=s=0,l=0,u=e.vertexes.iterator;u.next();){var c=u.value;1>=c.Vd?h++:(a=!0,l++,s+=Math.atan2(e.centerY-c.centerY,e.centerX-c.centerX))}if(0!==h)for(0<l&&(s/=l),l=e=0,e=a?2*Math.PI/(h+1):2*Math.PI/h,0==h%2&&(l=e/2),1<i.count&&i.sort((function(t,e){return null===t||null===e||t===e?0:e.width*e.height-t.width*t.height})),a=0==h%2?0:1,i=i.iterator;i.next();)if(!(1<(h=i.value).Vd||t.isFixed(h))){for(u=null,c=h.edges.iterator;c.next();){u=c.value;break}c=h.width;var d=h.height;c=Ye.sqrt(c*c+d*d)/2,u=r+u.length+c,c=s+(e*(a/2>>1)+l)*(0==a%2?1:-1),h.centerX=n+u*Math.cos(c),h.centerY=o+u*Math.sin(c),a++}}}function Vp(t,e,i,n,o,r,s){var a=9e19,h=-1,l=0;t:for(;l<e;l++){var u=t[l],c=u.x-i,d=u.y-n;if((c=c*c+d*d)<a){for(d=l-1;0<=d;d--)if(t[d].y>u.y&&t[d].x-u.x<o+s.width)continue t;for(d=l+1;d<e;d++)if(t[d].x>u.x&&t[d].y-u.y<r+s.height)continue t;h=l,a=c}}return h}function Gp(t,e){var i=t.bounds,n=i.x;t=i.y;var o=i.width;i=i.height;var r=e.bounds,s=r.x;e=r.y;var a=r.width;return r=r.height,n+o<s?t>e+r?(i=n+o-s,t=t-e-r,Ye.sqrt(i*i+t*t)):t+i<e?(n=n+o-s,t=t+i-e,Ye.sqrt(n*n+t*t)):s-(n+o):n>s+a?t>e+r?(i=n-s-a,t=t-e-r,Ye.sqrt(i*i+t*t)):t+i<e?(n=n-s-a,t=t+i-e,Ye.sqrt(n*n+t*t)):n-(s+a):t>e+r?t-(e+r):t+i<e?e-(t+i):.1}function Hp(t,e){for(t.ah=null,e=t.An+e;t.An<e&&(t.An++,Yp(t)););t.ah=null}function Yp(t){null===t.ah&&(t.ah=t.network.vertexes.Fa());var e=t.ah;if(0>=e.length)return!1;var i=e[0];i.forceX=0,i.forceY=0;for(var n=i.centerX,o=n,r=i=i.centerY,s=1;s<e.length;s++){var a=e[s];a.forceX=0,a.forceY=0;var h=a.centerX;a=a.centerY,n=Math.min(n,h),o=Math.max(o,h),i=Math.min(i,a),r=Math.max(r,a)}(o=o-n>r-i)?e.sort((function(t,e){return null===t||null===e||t===e?0:t.centerX-e.centerX})):e.sort((function(t,e){return null===t||null===e||t===e?0:t.centerY-e.centerY})),i=t.Zf;var l=n=a=0;for(r=0;r<e.length;r++){n=(s=e[r]).bounds,a=s.focus,h=n.x+a.x;var u=n.y+a.y;n=s.charge*t.electricalFieldX(h,u),l=s.charge*t.electricalFieldY(h,u),n+=s.mass*t.gravitationalFieldX(h,u),l+=s.mass*t.gravitationalFieldY(h,u),s.forceX+=n,s.forceY+=l;for(var c=r+1;c<e.length;c++){var d=e[c];if(d!==s){n=d.bounds,a=d.focus,l=n.x+a.x;var f=n.y+a.y;if(h-l>i||l-h>i){if(o)break}else if(u-f>i||f-u>i){if(!o)break}else{var p=Gp(s,d);1>p?(null===(n=t.randomNumberGenerator)&&(t.randomNumberGenerator=n=new Kp),p=n.random(),a=n.random(),h>l?n=(1+(n=Math.abs(d.bounds.right-s.bounds.x)))*p:h<l?n=-(1+(n=Math.abs(d.bounds.x-s.bounds.right)))*p:n=(1+(n=Math.max(d.width,s.width)))*p-n/2,u>f?l=(1+(l=Math.abs(d.bounds.bottom-s.bounds.y)))*a:h<l?l=-(1+(l=Math.abs(d.bounds.y-s.bounds.bottom)))*a:l=(1+(l=Math.max(d.height,s.height)))*a-l/2):(n=(l-h)/p*(a=-s.charge*d.charge/(p*p)),l=(f-u)/p*a),s.forceX+=n,s.forceY+=l,d.forceX-=n,d.forceY-=l}}}}for(o=t.network.edges.iterator;o.next();)i=(a=o.value).fromVertex,r=a.toVertex,s=i.bounds,h=i.focus,n=s.x+h.x,s=s.y+h.y,u=r.bounds,c=r.focus,h=u.x+c.x,u=u.y+c.y,1>(c=Gp(i,r))?(null===(c=t.randomNumberGenerator)&&(t.randomNumberGenerator=c=new Kp),a=c.random(),c=c.random(),n=(n>h?1:-1)*(1+(r.width>i.width?r.width:i.width))*a,l=(s>u?1:-1)*(1+(r.height>i.height?r.height:i.height))*c):(n=(h-n)/c*(a=a.stiffness*(c-a.length)),l=(u-s)/c*a),i.forceX+=n,i.forceY+=l,r.forceX-=n,r.forceY-=l;for(o=n=0;o<e.length;o++)i=e[o],t.isFixed(i)?t.moveFixedVertex(i):n=Math.max(n,t.moveVertex(i)||0);return n>t.epsilonDistance*t.epsilonDistance}function Xp(){this.Tv=this.Sv=this.Qs=this.Ss=this.Rs=0}function Up(t){jd.call(this,t)}function qp(t){Rd.call(this,t),this.ia=!1,this.Ha=this.u=NaN,this.sh=this.Vd=this.V=this.F=0,this.We=this.Hj=null,this.sv=0}function Wp(t){Gd.call(this,t),this.j=this.o=NaN}function Kp(){var t=0;void 0===t&&(t=42),this.seed=t,this.ay=48271,this.ey=2147483647,this.Q=44488.07041494893,this.gy=3399,this.by=1/2147483647,this.random()}function _p(t){Bd.call(this),this.kc=this.ie=25,this.K=0,this.Dk=Dg,this.Zk=Eg,this.Qk=zg,this.bj=4,this.rk=Hg,this.bg=15,this.sf=!0,this.Cn=4,this.Ra=this.Iq=this.Ia=-1,this.Md=this.Hn=0,this.Ta=this.Kd=this.Ld=this.he=this.tc=null,this.Kn=0,this.Jn=this.kj=null,this.le=0,this.fl=null,this.Rf=new pt,this.He=[],this.He.length=100,this.xw=this.ve=0,t&&Object.assign(this,t)}function $p(t){var e=t.fromVertex.node||t.fromVertex.data;return t=t.toVertex.node||t.toVertex.data,null===e&&null===t?8:null===e||null===t?4:1}function Jp(t){null===t.kj&&(t.kj=[]);for(var e=0,i=t.network.vertexes.iterator;i.next();){var n=i.value;t.kj[e]=n.layer,e++,t.kj[e]=n.column,e++,t.kj[e]=n.index,e++}return t.kj}function Zp(t,e){var i=0;for(t=t.network.vertexes.iterator;t.next();){var n=t.value;n.layer=e[i],i++,n.column=e[i],i++,n.index=e[i],i++}}function Qp(t,e,i){var n=Ag(t,e),o=t.tc[e];(null===t.Jn||t.Jn.length<o*o)&&(t.Jn=[]);for(var r=t.Jn,s=0;s<o;s++){var a,h=0,l=n[s],u=l.near;if(null!==u&&u.layer===l.layer)if((l=u.index)>s)for(var c=s+1;c<l;c++){var d=n[c];d.near===u&&d.Dj===u.Dj||h++}else for(c=s-1;c>l;c--)(d=n[c]).near===u&&d.Dj===u.Dj||h++;if(0<=i)for(l=n[s].sourceEdgesArrayAccess,u=0;u<l.length;u++){var f=l[u];if(f.valid&&f.fromVertex.layer!==e)for(d=f.fromVertex.index,c=f.portToPos,f=f.portFromPos,a=u+1;a<l.length;a++){var p=l[a];if(p.valid&&p.fromVertex.layer!==e){var g=p.fromVertex.index,m=p.portToPos;p=p.portFromPos,c<m&&(d>g||d===g&&f>p)&&h++,m<c&&(g>d||g===d&&p>f)&&h++}}}if(0>=i)for(l=n[s].destinationEdgesArrayAccess,u=0;u<l.length;u++)if((f=l[u]).valid&&f.toVertex.layer!==e)for(d=f.toVertex.index,c=f.portToPos,f=f.portFromPos,a=u+1;a<l.length;a++)(p=l[a]).valid&&p.toVertex.layer!==e&&(g=p.toVertex.index,m=p.portToPos,f<(p=p.portFromPos)&&(d>g||d===g&&c>m)&&h++,p<f&&(g>d||g===d&&m>c)&&h++);for(r[s*o+s]=h,l=s+1;l<o;l++){var y=0,v=0;if(0<=i){h=n[s].sourceEdgesArrayAccess;var x=n[l].sourceEdgesArrayAccess;for(u=0;u<h.length;u++)if((f=h[u]).valid&&f.fromVertex.layer!==e)for(d=f.fromVertex.index,f=f.portFromPos,a=0;a<x.length;a++)(p=x[a]).valid&&p.fromVertex.layer!==e&&(g=p.fromVertex.index,p=p.portFromPos,(d<g||d===g&&f<p)&&v++,(g<d||g===d&&p<f)&&y++)}if(0>=i)for(h=n[s].destinationEdgesArrayAccess,x=n[l].destinationEdgesArrayAccess,u=0;u<h.length;u++)if((f=h[u]).valid&&f.toVertex.layer!==e)for(d=f.toVertex.index,c=f.portToPos,a=0;a<x.length;a++)(p=x[a]).valid&&p.toVertex.layer!==e&&(g=p.toVertex.index,m=p.portToPos,(d<g||d===g&&c<m)&&v++,(g<d||g===d&&m<c)&&y++);r[s*o+l]=y,r[l*o+s]=v}}return Bg(t,e,n),r}function tg(t){for(var e=0,i=0;i<=t.Ia;i++){for(var n=t,o=i,r=Ag(n,o),s=n.tc[o],a=0,h=0;h<s;h++){var l=r[h].destinationEdgesArrayAccess;if(null!==l)for(var u=0;u<l.length;u++){var c=l[u];if(c.valid&&c.toVertex.layer!==o){var d=c.fromVertex.column+c.portFromColOffset,f=c.toVertex.column+c.portToColOffset;a+=(Math.abs(d-f)+1)*$p(c)}}}Bg(n,o,r),e+=a}return e}function eg(t,e,i){for(var n=Ag(t,e),o=t.tc[e],r=[],s=0;s<o;s++){var a=n[s],h=null;0>=i&&(h=a.sourceEdgesArrayAccess);var l=null;0<=i&&(l=a.destinationEdgesArrayAccess);var u=0,c=0,d=a.near;if(null!==d&&d.layer===a.layer&&(u+=d.column-1,c++),null!==h)for(d=0;d<h.length;d++){var f=(a=h[d]).fromVertex;a.valid&&!a.rev&&f.layer!==e&&(u+=f.column,c++)}if(null!==l)for(h=0;h<l.length;h++)d=(a=l[h]).toVertex,a.valid&&!a.rev&&d.layer!==e&&(u+=d.column,c++);r[s]=0===c?-1:u/c}return Bg(t,e,n),r}function ig(t,e,i){for(var n=Ag(t,e),o=t.tc[e],r=[],s=0;s<o;s++){var a=n[s],h=null;0>=i&&(h=a.sourceEdgesArrayAccess);var l=null;0<=i&&(l=a.destinationEdgesArrayAccess);var u=0,c=[],d=a.near;if(null!==d&&d.layer===a.layer&&(c[u]=d.column-1,u++),a=void 0,null!==h)for(d=0;d<h.length;d++){var f=(a=h[d]).fromVertex;a.valid&&!a.rev&&f.layer!==e&&(c[u]=f.column+a.portFromColOffset,u++)}if(null!==l)for(h=0;h<l.length;h++)d=(a=l[h]).toVertex,a.valid&&!a.rev&&d.layer!==e&&(c[u]=d.column+a.portToColOffset,u++);0===u?r[s]=-1:(c.sort((function(t,e){return t-e})),l=u>>1,r[s]=0!=(1&u)?c[l]:c[l-1]+c[l]>>1)}return Bg(t,e,n),r}function ng(t,e,i,n,o,r){if(e.component===n){if(e.component=i,o)for(var s=e.destinationEdges;s.next();){var a=s.value,h=a.toVertex,l=e.layer-h.layer;l===(a=t.linkMinLength(a))&&ng(t,h,i,n,o,r)}if(r)for(s=e.sourceEdges;s.next();)(l=(h=(a=s.value).fromVertex).layer-e.layer)===(a=t.linkMinLength(a))&&ng(t,h,i,n,o,r)}}function og(t,e,i,n,o,r){if(e.component===n){if(e.component=i,o)for(var s=e.destinationEdges;s.next();)og(t,s.value.toVertex,i,n,o,r);if(r)for(e=e.sourceEdges;e.next();)og(t,e.value.fromVertex,i,n,o,r)}}function rg(t){for(t=t.vertexes.iterator;t.next();){var e=t.value;if(e.valid)return e}return null}function sg(t){for(t=t.vertexes.iterator;t.next();){var e=t.value;if(e.valid){for(var i=!0,n=e.destinationEdges;n.next();)if(n.value.toVertex.valid){i=!1;break}if(i)return e}}return null}function ag(t){for(t=t.vertexes.iterator;t.next();){var e=t.value;if(e.valid){for(var i=!0,n=e.sourceEdges;n.next();)if(n.value.fromVertex.valid){i=!1;break}if(i)return e}}return null}function hg(t,e){e.Ll=t.Kn,t.Kn++;for(var i=e.destinationEdges;i.next();){var n=i.value,o=n.toVertex;-1===o.Ll&&(n.forest=!0,hg(t,o))}e.finish=t.Kn,t.Kn++}function lg(t){for(var e=t.network.vertexes.iterator;e.next();){var i=ug(t,e.value);t.Ia=Math.max(i,t.Ia)}}function ug(t,e){var i=0;if(-1===e.layer){for(var n=e.destinationEdges;n.next();){var o=n.value,r=o.toVertex;o=t.linkMinLength(o),i=Math.max(i,ug(t,r)+o)}e.layer=i}else i=e.layer;return i}function cg(t,e){var i=0;if(-1===e.layer){for(var n=e.sourceEdges;n.next();){var o=n.value,r=o.fromVertex;o=t.linkMinLength(o),i=Math.max(i,cg(t,r)+o)}e.layer=i}else i=e.layer;return i}function dg(t,e){if(!e.valid){e.valid=!0;for(var i=e.destinationEdges;i.next();)dg(t,i.value.toVertex);for(i=t.network.vertexes.iterator;i.next();)i.value.component=-1;for(var n=e.sourceEdgesArrayAccess,o=n.length,r=0;r<o;r++){var s=n[r],a=s.fromVertex,h=s.toVertex;s=t.linkMinLength(s),a.layer-h.layer>s&&ng(t,a,0,-1,!0,!1)}for(ng(t,e,1,-1,!0,!0);0!==e.component;){for(r=0,n=1/0,a=0,h=null,s=t.network.vertexes.iterator;s.next();){var l=s.value;if(1===l.component){var u=0,c=!1,d=l.sourceEdgesArrayAccess;o=d.length;for(var f=0;f<o;f++){var p=d[f],g=p.fromVertex;u+=1,1!==g.component&&(r+=1,g=g.layer-l.layer,p=t.linkMinLength(p),n=Math.min(n,g-p))}for(o=(d=l.destinationEdgesArrayAccess).length,f=0;f<o;f++)--u,1!==(p=d[f].toVertex).component?--r:c=!0;(null===h||u<a)&&!c&&(h=l,a=u)}}if(0<r){for(i.reset();i.next();)1===(o=i.value).component&&(o.layer+=n);e.component=0}else h.component=0}for(i=t.network.vertexes.iterator;i.next();)i.value.component=-1;for(ng(t,e,1,-1,!0,!1);0!==e.component;){for(n=0,o=1/0,r=0,a=null,h=t.network.vertexes.iterator;h.next();)if(1===(s=h.value).component){for(l=0,u=!1,c=(d=s.sourceEdgesArrayAccess).length,f=0;f<c;f++)l+=1,1!==(p=d[f].fromVertex).component?n+=1:u=!0;for(c=(d=s.destinationEdgesArrayAccess).length,f=0;f<c;f++)--l,1!==(g=(p=d[f]).toVertex).component&&(--n,g=s.layer-g.layer,p=t.linkMinLength(p),o=Math.min(o,g-p));(null===a||l>r)&&!u&&(a=s,r=l)}if(0>n){for(i.reset();i.next();)1===(n=i.value).component&&(n.layer-=o);e.component=0}else a.component=0}}}function fg(t,e,i){return 90===t.K?i&&!e.rev||!i&&e.rev?270:90:180===t.K?i&&!e.rev||!i&&e.rev?0:180:270===t.K?i&&!e.rev||!i&&e.rev?90:270:i&&!e.rev||!i&&e.rev?180:0}function pg(t,e){var i=e.layer;for(e.index=t.tc[i],t.tc[i]++,e=e.destinationEdgesArrayAccess,i=!0;i;){i=!1;for(var n=0;n<e.length-1;n++){var o=e[n],r=e[n+1];o.portFromColOffset>r.portFromColOffset&&(i=!0,e[n]=r,e[n+1]=o)}}for(i=0;i<e.length;i++)(n=e[i]).valid&&(-1===(n=n.toVertex).index&&pg(t,n))}function gg(t,e){var i=e.layer;e.index=t.tc[i],t.tc[i]++,e=e.sourceEdgesArrayAccess;for(var n=!0;n;)for(n=!1,i=0;i<e.length-1;i++){var o=e[i],r=e[i+1];o.portToColOffset>r.portToColOffset&&(n=!0,e[i]=r,e[i+1]=o)}for(i=0;i<e.length;i++)(n=e[i]).valid&&(-1===(n=n.fromVertex).index&&gg(t,n))}function mg(t,e,i){var n=Ag(t,e),o=t.tc[e],r=ig(t,e,i),s=eg(t,e,i);for(i=0;i<o;i++)-1===s[i]&&(s[i]=n[i].column),-1===r[i]&&(r[i]=n[i].column);for(var a,h=!0;h;)for(h=!1,i=0;i<o-1;i++)(r[i+1]<r[i]||r[i+1]===r[i]&&s[i+1]<s[i])&&(h=!0,a=r[i],r[i]=r[i+1],r[i+1]=a,a=s[i],s[i]=s[i+1],s[i+1]=a,a=n[i],n[i]=n[i+1],n[i+1]=a);for(i=r=0;i<o;i++)(a=n[i]).index=i,r+=t.nodeMinColumnSpace(a,!0),a.column=r,r+=1,r+=t.nodeMinColumnSpace(a,!1);Bg(t,e,n)}function yg(t,e,i){var n,o=Ag(t,e),r=t.tc[e];i=Qp(t,e,i);var s=[];for(n=0;n<r;n++)s[n]=-1;var a=[];for(n=0;n<r;n++)a[n]=-1;for(var h=!1,l=!0;l;)for(l=!1,n=0;n<r-1;n++){var u=i[o[n].index*r+o[n+1].index],c=i[o[n+1].index*r+o[n].index],d=0,f=0,p=o[n].column,g=o[n+1].column,m=t.nodeMinColumnSpace(o[n],!0),y=t.nodeMinColumnSpace(o[n],!1),v=t.nodeMinColumnSpace(o[n+1],!0),x=t.nodeMinColumnSpace(o[n+1],!1);m=p-m+v,y=g-y+x;var b=o[n].sourceEdges.iterator;for(b.reset();b.next();)if(x=(v=b.value).fromVertex,v.valid&&x.layer===e){for(v=0;o[v]!==x;)v++;v<n&&(d+=2*(n-v),f+=2*(n+1-v)),v===n+1&&(d+=1),v>n+1&&(d+=4*(v-n),f+=4*(v-(n+1)))}for((b=o[n].destinationEdges.iterator).reset();b.next();)if(x=(v=b.value).toVertex,v.valid&&x.layer===e){for(v=0;o[v]!==x;)v++;v===n+1&&(f+=1)}for((b=o[n+1].sourceEdges.iterator).reset();b.next();)if(x=(v=b.value).fromVertex,v.valid&&x.layer===e){for(v=0;o[v]!==x;)v++;v<n&&(d+=2*(n+1-v),f+=2*(n-v)),v===n&&(f+=1),v>n+1&&(d+=4*(v-(n+1)),f+=4*(v-n))}for((b=o[n+1].destinationEdges.iterator).reset();b.next();)if(x=(v=b.value).toVertex,v.valid&&x.layer===e){for(v=0;o[v]!==x;)v++;v===n&&(d+=1)}v=x=0,b=s[o[n].index];var w=a[o[n].index],k=s[o[n+1].index],S=a[o[n+1].index];-1!==b&&(x+=Math.abs(b-p),v+=Math.abs(b-y)),-1!==w&&(x+=Math.abs(w-p),v+=Math.abs(w-y)),-1!==k&&(x+=Math.abs(k-g),v+=Math.abs(k-m)),-1!==S&&(x+=Math.abs(S-g),v+=Math.abs(S-m)),(f<d-.5||f===d&&c<u-.5||f===d&&c===u&&v<x-.5)&&(l=h=!0,o[n].column=y,o[n+1].column=m,u=o[n],o[n]=o[n+1],o[n+1]=u)}for(n=0;n<r;n++)o[n].index=n;return Bg(t,e,o),h}function vg(t,e,i){for(var n=!1;xg(t,e,i);)n=!0;return n}function xg(t,e,i){var n,o=Ag(t,e),r=t.tc[e],s=eg(t,e,-1);if(0<i)for(n=0;n<r;n++)s[n]=-1;var a=eg(t,e,1);if(0>i)for(n=0;n<r;n++)a[n]=-1;for(var h=!1,l=!0;l;)for(l=!1,n=0;n<r;n++){var u=o[n].column,c=t.nodeMinColumnSpace(o[n],!0),d=t.nodeMinColumnSpace(o[n],!1),f=0;f=0>n-1||u-o[n-1].column-1>c+t.nodeMinColumnSpace(o[n-1],!1)?u-1:u,c=n+1>=r||o[n+1].column-u-1>d+t.nodeMinColumnSpace(o[n+1],!0)?u+1:u;var p=d=0,g=0;if(0>=i)for(var m=o[n].sourceEdges.iterator;m.next();){var y=m.value,v=y.fromVertex;if(y.valid&&v.layer!==e){var x=$p(y),b=y.portFromColOffset;y=y.portToColOffset,v=v.column,d+=(Math.abs(u+y-(v+b))+1)*x,p+=(Math.abs(f+y-(v+b))+1)*x,g+=(Math.abs(c+y-(v+b))+1)*x}}if(0<=i)for(m=o[n].destinationEdges.iterator;m.next();)v=(y=m.value).toVertex,y.valid&&v.layer!==e&&(x=$p(y),b=y.portFromColOffset,y=y.portToColOffset,v=v.column,d+=(Math.abs(u+b-(v+y))+1)*x,p+=(Math.abs(f+b-(v+y))+1)*x,g+=(Math.abs(c+b-(v+y))+1)*x);y=b=x=0,m=s[o[n].index],v=a[o[n].index],-1!==m&&(x+=Math.abs(m-u),b+=Math.abs(m-f),y+=Math.abs(m-c)),-1!==v&&(x+=Math.abs(v-u),b+=Math.abs(v-f),y+=Math.abs(v-c)),p<d||p===d&&b<x?(l=h=!0,o[n].column=f):(g<d||g===d&&y<x)&&(l=h=!0,o[n].column=c)}return Bg(t,e,o),t.normalize(),h}function bg(t,e,i){var n=Ag(t,e),o=t.tc[e],r=ig(t,e,i),s=[];for(i=0;i<o;i++)s[i]=r[i];for(r=!0;r;)for(r=!1,i=0;i<o;i++){var a=n[i].column,h=t.nodeMinColumnSpace(n[i],!0),l=t.nodeMinColumnSpace(n[i],!1),u=0;if(-1===s[i])if(0===i&&i===o-1)u=a;else if(0===i){var c=n[i+1].column;u=c-a===l+t.nodeMinColumnSpace(n[i+1],!0)?a-1:a}else i===o-1?u=a-(c=n[i-1].column)===h+t.nodeMinColumnSpace(n[i-1],!1)?a+1:a:u=((h=(c=n[i-1].column)+t.nodeMinColumnSpace(n[i-1],!1)+h+1)+(l=(c=n[i+1].column)-t.nodeMinColumnSpace(n[i+1],!0)-l-1))/2|0;else 0===i&&i===o-1?u=s[i]:0===i?(l=(c=n[i+1].column)-t.nodeMinColumnSpace(n[i+1],!0)-l-1,u=Math.min(s[i],l)):i===o-1?(h=(c=n[i-1].column)+t.nodeMinColumnSpace(n[i-1],!1)+h+1,u=Math.max(s[i],h)):(h=(c=n[i-1].column)+t.nodeMinColumnSpace(n[i-1],!1)+h+1,l=(c=n[i+1].column)-t.nodeMinColumnSpace(n[i+1],!0)-l-1,h<s[i]&&s[i]<l?u=s[i]:h>=s[i]?u=h:l<=s[i]&&(u=l));u!==a&&(r=!0,n[i].column=u)}Bg(t,e,n),t.normalize()}function wg(t,e){for(var i=!0,n=t.network.vertexes.iterator;n.next();){var o=n.value,r=t.nodeMinColumnSpace(o,!0),s=t.nodeMinColumnSpace(o,!1);if(o.column-r<=e&&o.column+s>=e){i=!1;break}}if(t=!1,i)for(n.reset();n.next();)(i=n.value).column>e&&(--i.column,t=!0);return t}function kg(t,e){var i,n=e+1,o=[],r=[];for(i=0;i<=t.Ia;i++)o[i]=!1,r[i]=!1;for(var s=t.network.vertexes.iterator;s.next();){var a=(i=s.value).column-t.nodeMinColumnSpace(i,!0),h=i.column+t.nodeMinColumnSpace(i,!1);a<=e&&h>=e&&(o[i.layer]=!0),a<=n&&h>=n&&(r[i.layer]=!0)}for(a=!0,n=!1,i=0;i<=t.Ia;i++)a=a&&!(o[i]&&r[i]);if(a)for(s.reset();s.next();)(t=s.value).column>e&&(--t.column,n=!0);return n}function Sg(t,e){for(var i=0;i<=t.Ra;i++)for(;wg(t,i););for(t.normalize(),i=0;i<t.Ra;i++)for(;kg(t,i););var n;if(t.normalize(),0<e)for(i=0;i<=t.Ra;i++){var o=Jp(t),r=tg(t);for(n=r+1;r<n;){n=r,Mg(t,i,1);var s=tg(t);s>r?Zp(t,o):s<r&&(r=s,o=Jp(t))}}if(0>e)for(i=t.Ra;0<=i;i--)for(o=Jp(t),n=(r=tg(t))+1;r<n;)n=r,Mg(t,i,-1),(s=tg(t))>r?Zp(t,o):s<r&&(r=s,o=Jp(t));t.normalize()}function Mg(t,e,i){t.le=0;for(var n=t.network.vertexes.iterator;n.next();)n.value.component=-1;if(0<i)for(n.reset();n.next();){var o=n.value;o.column-t.nodeMinColumnSpace(o,!0)<=e&&(o.component=t.le)}if(0>i)for(n.reset();n.next();)(o=n.value).column+t.nodeMinColumnSpace(o,!1)>=e&&(o.component=t.le);for(t.le++,n.reset();n.next();)-1===(e=n.value).component&&(og(t,e,t.le,-1,!0,!0),t.le++);var r;for(e=[],r=0;r<t.le*t.le;r++)e[r]=!1;for(o=[],r=0;r<(t.Ia+1)*(t.Ra+1);r++)o[r]=-1;for(n.reset();n.next();)for(var s=(r=n.value).layer,a=Math.max(0,r.column-t.nodeMinColumnSpace(r,!0)),h=Math.min(t.Ra,r.column+t.nodeMinColumnSpace(r,!1));a<=h;a++)o[s*(t.Ra+1)+a]=r.component;for(r=0;r<=t.Ia;r++){if(0<i)for(s=0;s<t.Ra;s++)-1!==o[r*(t.Ra+1)+s]&&-1!==o[r*(t.Ra+1)+s+1]&&o[r*(t.Ra+1)+s]!==o[r*(t.Ra+1)+s+1]&&(e[o[r*(t.Ra+1)+s]*t.le+o[r*(t.Ra+1)+s+1]]=!0);if(0>i)for(s=t.Ra;0<s;s--)-1!==o[r*(t.Ra+1)+s]&&-1!==o[r*(t.Ra+1)+s-1]&&o[r*(t.Ra+1)+s]!==o[r*(t.Ra+1)+s-1]&&(e[o[r*(t.Ra+1)+s]*t.le+o[r*(t.Ra+1)+s-1]]=!0)}for(o=[],r=0;r<t.le;r++)o[r]=!0;for((s=[]).push(0);0!==s.length;)if(h=s[s.length-1],s.pop(),o[h])for(o[h]=!1,r=0;r<t.le;r++)e[h*t.le+r]&&s.splice(0,0,r);if(0<i)for(n.reset();n.next();)o[(t=n.value).component]&&--t.column;if(0>i)for(n.reset();n.next();)o[(i=n.value).component]&&(i.column+=1)}function Cg(t,e,i,n){for(var r=90===t.K||270===t.K,s=o(e),a=s.next();!a.done;a=s.next()){var h=o(a.value);for(a=h.next();!a.done;a=h.next())(a=a.value).sd=a,a.shift=1/0,a.zc=NaN,a.qg=0}for(a=90===t.K||270===t.K,h=(s=o(e)).next();!h.done;h=s.next())for(var l=(h=o(h.value)).next();!l.done;l=h.next())if((l=l.value).root===l){for(var u=0,c=l;c.align!==l;){var d=c.align,f=a?c.width:c.height,p=a?d.width:d.height;if(i){var g=_g(c,d),m=g.portFromPos,y=g.portToPos;null!==g.link&&(c.node&&c.node!==g.link.fromNode&&(m=a?c.focusX:c.focusY),d.node&&d.node!==g.link.toNode&&(y=a?d.focusX:d.focusY))}else m=(g=_g(d,c)).portToPos,y=g.portFromPos,null!==g.link&&(c.node&&c.node!==g.link.toNode&&(m=a?c.focusX:c.focusY),d.node&&d.node!==g.link.fromNode&&(y=a?d.focusX:d.focusY));f=n?c.qg+(f-m)-(p-y):c.qg+m-y,d.qg=f,u=Math.min(u,f),c=c.align}c=l;do{c.qg=c.qg-u,c=c.align}while(c!==l)}for(a=(i=o(e)).next();!a.done;a=i.next())for(a=(s=o(a.value)).next();!a.done;a=s.next())(a=a.value).root===a&&Pg(t,a,e);for(i=0;i<e.length;i++)if(!(0>=e[i].length)&&(a=e[i][0]).sd===a){1/0===a.sd.shift&&(a.sd.shift=0),a=i,h=0;do{for(s=e[a][h];s.align!==s.root;)a++,0<(s=s.align).vi&&((h=Tg(s,e)).sd.shift=Math.min(h.sd.shift,s.sd.shift+s.zc+s.qg-(h.zc+h.qg+(r?h.width:h.height)+t.columnSpacing)));h=s.vi+1}while(a<e.length&&h<e[a].length&&s.sd===e[a][h].sd)}for(t=new ft,a=(e=o(e)).next();!a.done;a=e.next())for(a=(i=o(a.value)).next();!a.done;a=i.next())(a=a.value).zc=a.zc+a.sd.shift+a.qg,s=r?a.width:a.height,t.add(a,n?-a.zc-s:a.zc);return t}function Pg(t,e,i){if(isNaN(e.zc)){e.zc=0;var n=e;do{if(0<n.vi){var o=Tg(n,i),r=o.root;Pg(t,r,i),e.sd===e&&(e.sd=r.sd);var s=90===t.K||270===t.K?o.width:o.height;e.sd===r.sd&&(e.zc=Math.max(e.zc,r.zc+o.qg+s-n.qg+t.columnSpacing))}n=n.align}while(n!==e);for(;n.align!==e;)(n=n.align).zc=e.zc,n.sd=e.sd}}function Tg(t,e){var i=t.Tz;return 1>(t=t.vi)&&w("Could not determine previous vertex in layer"),e[i][t-1]}function Ng(t,e,i,n,o){if(!e||0===e.count)return i[o]=0,n[o]=0,1/0;var r=1/0,s=-1/0;return e.each((function(e){var i=e.key;e=e.value,i=90===t.K||270===t.K?i.width:i.height,e<r&&(r=e),e+i>s&&(s=e+i)})),i[o]=r,n[o]=s,s-r}function Lg(t,e){return 270===t.K?e?Le:De:90===t.K?e?De:Le:180===t.K?e?Ae:Be:e?Be:Ae}function Ag(t,e){var i=t.tc[e];if(i>=t.He.length){for(var n=[],o=0;o<t.He.length;o++)n[o]=t.He[o];t.He=n}for(void 0===t.He[i]||null===t.He[i]?n=[]:(n=t.He[i],t.He[i]=null),t=t.fl[e],e=0;e<t.length;e++)n[(i=t[e]).index]=i;return n}function Bg(t,e,i){t.He[t.tc[e]]=i}rp.className="CircularLayout",rp.ConstantSpacing=yp,rp.ConstantDistance=vp,rp.ConstantAngle=xp,rp.Packed=bp,rp.Clockwise=wp,rp.Counterclockwise=kp,rp.BidirectionalLeft=Sp,rp.BidirectionalRight=Mp,rp.Forwards=Cp,rp.Reverse=Pp,rp.Ascending=Tp,rp.Descending=Np,rp.Optimized=Lp,rp.Pythagorean=Ap,rp.Circular=Bp,Dp.prototype.compare=function(t,e){if(0<t&&0>this.Pl||Math.abs(t)<Math.abs(this.Pl)&&!(0>t&&0<this.Pl))for(this.Pl=t,this.mk=[],this.tm=[],t=0;t<e.length;t++)this.mk[t]=e[t].bounds.x,this.tm[t]=e[t].bounds.y},Dp.prototype.commit=function(t){if(null!==this.mk&&null!==this.tm)for(var e=0;e<this.mk.length;e++){var i=t.M(e);i.x=this.mk[e],i.y=this.tm[e]}},Dp.className="VertexArrangement",c(Fp,jd),Fp.prototype.createVertex=function(){return new jp(this)},Fp.prototype.createEdge=function(){return new Op(this)},Fp.className="CircularNetwork",c(jp,Rd),d.Object.defineProperties(jp.prototype,{diameter:{get:function(){return this.Si},set:function(t){this.Si!==t&&(this.Si=t)}},actualAngle:{get:function(){return this.u},set:function(t){this.u!==t&&(this.u=t)}}}),jp.className="CircularVertex",c(Op,Gd),Op.className="CircularEdge",c(Ip,Bd),Ip.prototype.cloneProtected=function(t){Bd.prototype.cloneProtected.call(this,t),t.$d.assign(this.$d),t.Bm=this.Bm,t.sf=this.sf,t.td=this.td,t.dl=this.dl,t.$m=this.$m,t.Zf=this.Zf,t.In=this.In,t.fo=this.fo,t.Hk=this.Hk,t.Gk=this.Gk,t.Ek=this.Ek,t.Fk=this.Fk,t.Vm=this.Vm,t.Um=this.Um},Ip.prototype.createNetwork=function(){return new Up(this)},Ip.prototype.doLayout=function(t){if(null===this.network&&(this.network=this.makeNetwork(t)),t=this.maxIterations,0<this.network.vertexes.count){this.network.Ko();for(var e=this.network.vertexes.iterator;e.next();){var i=e.value;i.charge=this.electricalCharge(i),i.mass=this.gravitationalMass(i)}for(e=this.network.edges.iterator;e.next();)(i=e.value).stiffness=this.springStiffness(i),i.length=this.springLength(i);if(this.Cu(),this.An=0,this.needsClusterLayout()){for(var n=(i=(e=this.network).Zx()).iterator;n.next();){this.network=n.value;for(var o=this.network.vertexes.iterator;o.next();){var r=o.value;r.Vd=r.vertexes.count,r.sh=1,r.Hj=null,r.We=null}zp(this,0,t)}this.network=e;var s=n=i.iterator;n=this.arrangementSpacing;var a=s.count,h=!0;r=o=0;for(var l=A(),u=0;u<a+e.vertexes.count+2;u++)l[u]=null;a=0,s.reset();for(var c=jt.alloc();s.next();)if(u=s.value,this.computeBounds(u,c),h)h=!1,o=c.x+c.width/2,r=c.y+c.height/2,l[0]=new pt(c.x+c.width+n.width,c.y),l[1]=new pt(c.x,c.y+c.height+n.height),a=2;else{var d=Vp(l,a,o,r,c.width,c.height,n),f=l[d],p=new pt(f.x+c.width+n.width,f.y),g=new pt(f.x,f.y+c.height+n.height);for(d+1<a&&l.splice(d+1,0,null),l[d]=p,l[d+1]=g,a++,d=f.x-c.x,f=f.y-c.y,u=u.vertexes.iterator;u.next();)(p=u.value).centerX+=d,p.centerY+=f}for(jt.free(c),u=e.vertexes.iterator;u.next();)d=(s=u.value).bounds,2>a?(o=d.x+d.width/2,r=d.y+d.height/2,l[0]=new pt(d.x+d.width+n.width,d.y),l[1]=new pt(d.x,d.y+d.height+n.height),a=2):(f=new pt((c=l[h=Vp(l,a,o,r,d.width,d.height,n)]).x+d.width+n.width,c.y),d=new pt(c.x,c.y+d.height+n.height),h+1<a&&l.splice(h+1,0,null),l[h]=f,l[h+1]=d,a++,s.centerX=c.x+s.width/2,s.centerY=c.y+s.height/2);for(B(l),n=i.iterator;n.next();){for(o=(i=n.value).vertexes.iterator;o.next();)e.dh(o.value);for(i=i.edges.iterator;i.next();)e.Bo(i.value)}}Hp(this,t),this.updateParts()}this.dl=t,this.network=null,this.isValidLayout=!0},Ip.prototype.needsClusterLayout=function(){if(3>this.network.vertexes.count)return!1;for(var t=0,e=0,i=this.network.vertexes.first().bounds,n=this.network.vertexes.iterator;n.next();){if(n.value.bounds.Yc(i)&&2<++t)return!0;if(10<e)break;e++}return!1},Ip.prototype.computeBounds=function(t,e){var i=!0;for(t=t.vertexes.iterator;t.next();){var n=t.value;i?(i=!1,e.set(n.bounds)):e.ed(n.bounds)}return e},Ip.prototype.Cu=function(){if(this.comments)for(var t=this.network.vertexes.iterator;t.next();)this.addComments(t.value)},Ip.prototype.addComments=function(t){var e=t.node;if(null!==e)for(e=e.Mu();e.next();){var i=e.value;if("Comment"===i.category&&i.isVisible()){var n=this.network.ki(i);null===n&&(n=this.network.Bl(i)),n.charge=this.defaultCommentElectricalCharge,i=null;for(var o=n.destinationEdges;o.next();){var r=o.value;if(r.toVertex===t){i=r;break}}if(null===i)for(o=n.sourceEdges;o.next();)if((r=o.value).fromVertex===t){i=r;break}null===i&&(i=this.network.Zj(t,n,null)),i.length=this.defaultCommentSpringLength}}},Ip.prototype.moveVertex=function(t){var e=t.forceX,i=t.forceY,n=this.moveLimit;return e<-n?e=-n:e>n&&(e=n),i<-n?i=-n:i>n&&(i=n),t.centerX+=e,t.centerY+=i,e*e+i*i},Ip.prototype.moveFixedVertex=function(){},Ip.prototype.commitLayout=function(){this.yv(),this.commitNodes(),this.isRouting&&this.commitLinks()},Ip.prototype.yv=function(){if(this.setsPortSpots)for(var t=this.network.edges.iterator;t.next();){var e=t.value.link;null!==e&&(e.fromSpot=Me,e.toSpot=Me)}},Ip.prototype.commitNodes=function(){var t=0,e=0;if(this.arrangesToOrigin){var i=jt.alloc();this.computeBounds(this.network,i),t=(e=this.arrangementOrigin).x-i.x,e=e.y-i.y,jt.free(i)}i=jt.alloc();for(var n=this.network.vertexes.iterator;n.next();){var o=n.value;0===t&&0===e||(i.assign(o.bounds),i.x+=t,i.y+=e,o.bounds=i),o.commit()}jt.free(i)},Ip.prototype.commitLinks=function(){for(var t=this.network.edges.iterator;t.next();)t.value.commit()},Ip.prototype.springStiffness=function(t){return t=t.stiffness,isNaN(t)?this.Hk:t},Ip.prototype.springLength=function(t){return t=t.length,isNaN(t)?this.Gk:t},Ip.prototype.electricalCharge=function(t){return t=t.charge,isNaN(t)?this.Ek:t},Ip.prototype.electricalFieldX=function(){return 0},Ip.prototype.electricalFieldY=function(){return 0},Ip.prototype.gravitationalMass=function(t){return t=t.mass,isNaN(t)?this.Fk:t},Ip.prototype.gravitationalFieldX=function(){return 0},Ip.prototype.gravitationalFieldY=function(){return 0},Ip.prototype.isFixed=function(t){return t.isFixed},d.Object.defineProperties(Ip.prototype,{currentIteration:{get:function(){return this.An}},arrangementSpacing:{get:function(){return this.$d},set:function(t){this.$d.D(t)||(this.$d.assign(t),this.C())}},arrangesToOrigin:{get:function(){return this.Bm},set:function(t){this.Bm!==t&&(this.Bm=t,this.C())}},setsPortSpots:{get:function(){return this.sf},set:function(t){this.sf!==t&&(this.sf=t,this.C())}},comments:{get:function(){return this.td},set:function(t){this.td!==t&&(this.td=t,this.C())}},maxIterations:{get:function(){return this.dl},set:function(t){this.dl!==t&&0<=t&&(this.dl=t,this.C())}},epsilonDistance:{get:function(){return this.$m},set:function(t){this.$m!==t&&0<t&&(this.$m=t,this.C())}},infinityDistance:{get:function(){return this.Zf},set:function(t){this.Zf!==t&&1<t&&(this.Zf=t,this.C())}},moveLimit:{get:function(){return this.In},set:function(t){this.In!==t&&1<t&&(this.In=t,this.C())}},randomNumberGenerator:{get:function(){return this.fo},set:function(t){this.fo!==t&&(null!==t&&"function"!=typeof t.random&&w('ForceDirectedLayout.randomNumberGenerator must have a "random()" function on it: '+t),this.fo=t)}},defaultSpringStiffness:{get:function(){return this.Hk},set:function(t){this.Hk!==t&&(this.Hk=t,this.C())}},defaultSpringLength:{get:function(){return this.Gk},set:function(t){this.Gk!==t&&(this.Gk=t,this.C())}},defaultElectricalCharge:{get:function(){return this.Ek},set:function(t){this.Ek!==t&&(this.Ek=t,this.C())}},defaultGravitationalMass:{get:function(){return this.Fk},set:function(t){this.Fk!==t&&(this.Fk=t,this.C())}},defaultCommentSpringLength:{get:function(){return this.Vm},set:function(t){this.Vm!==t&&(this.Vm=t,this.C())}},defaultCommentElectricalCharge:{get:function(){return this.Um},set:function(t){this.Um!==t&&(this.Um=t,this.C())}}}),Ip.className="ForceDirectedLayout",Xp.className="ForceDirectedSubnet",c(Up,jd),Up.prototype.createVertex=function(){return new qp(this)},Up.prototype.createEdge=function(){return new Wp(this)},Up.className="ForceDirectedNetwork",c(qp,Rd),d.Object.defineProperties(qp.prototype,{isFixed:{get:function(){return this.ia},set:function(t){this.ia!==t&&(this.ia=t)}},charge:{get:function(){return this.u},set:function(t){this.u!==t&&(this.u=t)}},mass:{get:function(){return this.Ha},set:function(t){this.Ha!==t&&(this.Ha=t)}},forceX:{get:function(){return this.F},set:function(t){this.F!==t&&(this.F=t)}},forceY:{get:function(){return this.V},set:function(t){this.V!==t&&(this.V=t)}}}),qp.className="ForceDirectedVertex",c(Wp,Gd),d.Object.defineProperties(Wp.prototype,{stiffness:{get:function(){return this.o},set:function(t){this.o!==t&&(this.o=t)}},length:{get:function(){return this.j},set:function(t){this.j!==t&&(this.j=t)}}}),Wp.className="ForceDirectedEdge",Kp.prototype.random=function(){var t=this.seed%this.Q*this.ay-this.seed/this.Q*this.gy;return this.seed=0<t?t:t+this.ey,this.seed*this.by},Kp.className="RandomNumberGenerator",c(_p,Bd),_p.prototype.cloneProtected=function(t){Bd.prototype.cloneProtected.call(this,t),t.ie=this.ie,t.kc=this.kc,t.K=this.K,t.Dk=this.Dk,t.Zk=this.Zk,t.Qk=this.Qk,t.bj=this.bj,t.rk=this.rk,t.bg=this.bg,t.sf=this.sf,t.Cn=this.Cn,t.ve=this.ve},_p.prototype.qb=function(t){t.classType===_p?0===t.name.indexOf("Aggressive")?this.aggressiveOption=t:0===t.name.indexOf("Cycle")?this.cycleRemoveOption=t:0===t.name.indexOf("Init")?this.initializeOption=t:0===t.name.indexOf("Layer")?this.layeringOption=t:w("Unknown enum value: "+t):Bd.prototype.qb.call(this,t)},_p.prototype.createNetwork=function(){return new qg(this)},_p.prototype.doLayout=function(t){for(null===this.network&&(this.network=this.makeNetwork(t)),this.arrangementOrigin=this.initialOrigin(this.arrangementOrigin),this.Iq=-1,this.Md=this.Hn=0,this.fl=this.Jn=this.kj=null,t=0;t<this.He.length;t++)this.He[t]=null;if(0<this.network.vertexes.count){for(this.network.Ko(),this.cycleRemoveOption!==jg&&this.removeCycles(),t=this.network.vertexes.iterator;t.next();)t.value.layer=-1;for(this.Ia=-1,this.assignLayers(),t.reset();t.next();)this.Ia=Math.max(this.Ia,t.value.layer);this.cycleRemoveOption===jg&&this.removeCycles();for(var e=[],i=(t=this.network).edges.iterator;i.next();){var n=i.value;n.valid=!1,e.push(n)}for(i=0;i<e.length;i++){var o=(n=e[i]).fromVertex,r=n.toVertex;if(!(n.valid||(null===o.node&&null===o.data||null===r.node&&null===r.data)&&o.layer===r.layer)){var s=0,a=0,h=0,l=0;if(null!==n.link){if(null===(a=n.link))continue;var u=o.node;if(s=r.node,null===u||null===s)continue;var c=a.fromNode;h=a.toNode;for(var d=a.fromPort;null!==d&&!d.Ed();)d=d.panel;for(a=a.toPort;null!==a&&!a.Ed();)a=a.panel;if(n.rev){l=c;var f=d;c=h,d=a,h=l,a=f}var p=o.focus;l=r.focus;var g=n.rev?r.bounds:o.bounds;f=pt.alloc(),u!==c?g.w()&&c.isVisible()?c.actualBounds.w()?(Tu(c,d,oe,f),f.x+=c.actualBounds.x-g.x,f.y+=c.actualBounds.y-g.y):(Tu(c,d,oe,f),f.w()||f.assign(p)):f.assign(p):g.w()?(Tu(c,d,oe,f),f.w()||f.assign(p)):f.assign(p),c=n.rev?o.bounds:r.bounds,u=pt.alloc(),s!==h?c.w()&&h.isVisible()?h.actualBounds.w()?(Tu(h,a,oe,u),u.x+=h.actualBounds.x-c.x,u.y+=h.actualBounds.y-c.y):(Tu(h,a,oe,u),u.w()||u.assign(l)):u.assign(l):c.w()?(Tu(h,a,oe,u),u.w()||u.assign(l)):u.assign(l),90===this.K||270===this.K?(s=Math.round((f.x-p.x)/this.kc),h=f.x,a=Math.round((u.x-l.x)/this.kc),l=u.x):(s=Math.round((f.y-p.y)/this.kc),h=f.y,a=Math.round((u.y-l.y)/this.kc),l=u.y),pt.free(f),pt.free(u),n.portFromColOffset=s,n.portFromPos=h,n.portToColOffset=a,n.portToPos=l}else n.portFromColOffset=0,n.portFromPos=0,n.portToColOffset=0,n.portToPos=0;if(f=o.layer,u=r.layer,c=0,null!==(g=n.link)){var m=g.fromPort,y=g.toPort;if(null!==m&&null!==y){var v=g.fromNode;if(d=g.toNode,null!==v&&null!==d){var x=Lg(this,!0),b=Lg(this,!1),w=this.setsPortSpots?x:g.computeSpot(!0,m);p=this.setsPortSpots?b:g.computeSpot(!1,y);var k=g.isOrthogonal;w.$c()&&w.Hf(b)&&p.$c()&&p.Hf(x)?c=0:(x=g.getLinkPoint(v,m,w,!0,k,d,y,pt.alloc()),b=g.getLinkDirection(v,m,x,w,!0,k,d,y),pt.free(x),w.ys()||b!==fg(this,n,!0)?this.setsPortSpots&&null!==v&&1===v.ports.count&&n.rev&&(c+=1):c+=1,w=g.getLinkPoint(d,y,p,!1,k,v,m,pt.alloc()),g=g.getLinkDirection(d,y,w,p,!1,k,v,m),pt.free(w),p.ys()||g!==fg(this,n,!1)?this.setsPortSpots&&null!==d&&1===d.ports.count&&n.rev&&(c+=2):c+=2)}}}if(c=1===(d=c)||3===d,(d=2===d||3===d)&&((p=t.createVertex()).node=null,p.Dj=1,p.layer=f,p.near=o,t.dh(p),(o=t.Zj(o,p,n.link)).valid=!1,o.rev=n.rev,o.portFromColOffset=s,o.portToColOffset=0,o.portFromPos=h,o.portToPos=0,o=p),g=1,c&&g--,f-u>g&&0<f){for(n.valid=!1,(p=t.createVertex()).node=null,p.Dj=2,p.layer=f-1,t.dh(p),(o=t.Zj(o,p,n.link)).valid=!0,o.rev=n.rev,o.portFromColOffset=d?0:s,o.portToColOffset=0,o.portFromPos=d?0:h,o.portToPos=0,o=p,f--;f-u>g&&0<f;)(p=t.createVertex()).node=null,p.Dj=3,p.layer=f-1,t.dh(p),(o=t.Zj(o,p,n.link)).valid=!0,o.rev=n.rev,o.portFromColOffset=0,o.portToColOffset=0,o.portFromPos=0,o.portToPos=0,o=p,f--;(o=t.Zj(p,r,n.link)).valid=!c,c&&(p.near=r),o.rev=n.rev,o.portFromColOffset=0,o.portToColOffset=a,o.portFromPos=0,o.portToPos=l}else n.valid=!0}}for(t=this.tc=[],e=0;e<=this.Ia;e++)t[e]=0;for(e=this.network.vertexes.iterator;e.next();)e.value.index=-1;for(this.initializeIndices(),this.Iq=-1,i=this.Md=this.Hn=0;i<=this.Ia;i++)t[i]>t[this.Md]&&(this.Iq=t[i]-1,this.Md=i),t[i]<t[this.Hn]&&(this.Hn=i);for(this.fl=[],i=0;i<t.length;i++)this.fl[i]=[];for(e.reset();e.next();)t=e.value,this.fl[t.layer][t.index]=t;for(this.Ra=-1,t=0;t<=this.Ia;t++){for(e=Ag(this,t),i=0,n=this.tc[t],r=0;r<n;r++)o=e[r],i+=this.nodeMinColumnSpace(o,!0),o.column=i,i+=1,i+=this.nodeMinColumnSpace(o,!1);this.Ra=Math.max(this.Ra,i-1),Bg(this,t,e)}this.reduceCrossings(),this.straightenAndPack(),this.updateParts()}this.network=null,this.isValidLayout=!0},_p.prototype.linkMinLength=function(){return 1},_p.prototype.nodeMinLayerSpace=function(t,e){return null===t.node&&null===t.data?0:90===this.K||270===this.K?e?t.focus.y+10:t.bounds.height-t.focus.y+10:e?t.focus.x+10:t.bounds.width-t.focus.x+10},_p.prototype.nodeMinColumnSpace=function(t,e){if(null===t.node&&null===t.data)return 0;var i=e?t.ev:t.dv;return null!==i?i:90===(i=this.K)||270===i?e?t.ev=t.focus.x/this.kc+1|0:t.dv=(t.bounds.width-t.focus.x)/this.kc+1|0:e?t.ev=t.focus.y/this.kc+1|0:t.dv=(t.bounds.height-t.focus.y)/this.kc+1|0},_p.prototype.countCrossings=function(){for(var t=0,e=0;e<=this.Ia;e++)for(var i=Qp(this,e,1),n=this.tc[e],o=0;o<n;o++)for(var r=o;r<n;r++)t+=i[o*n+r];return t},_p.prototype.normalize=function(){var t=1/0;this.Ra=-1;for(var e=this.network.vertexes.iterator;e.next();){var i=e.value;t=Math.min(t,i.column-this.nodeMinColumnSpace(i,!0)),this.Ra=Math.max(this.Ra,i.column+this.nodeMinColumnSpace(i,!1))}for(e.reset();e.next();)e.value.column-=t;this.Ra-=t},_p.prototype.removeCycles=function(){for(var t=this.network.edges.iterator;t.next();)t.value.rev=!1;switch(this.Dk){default:case Fg:var e=0,i=(t=this.network).vertexes.count-1,n=[];n.length=i+1;for(var o=t.vertexes.iterator;o.next();)o.value.valid=!0;for(;null!==rg(t);){for(o=sg(t);null!==o;)n[i]=o,i--,o.valid=!1,o=sg(t);for(o=ag(t);null!==o;)n[e]=o,e++,o.valid=!1,o=ag(t);o=null;for(var r=0,s=this.network.vertexes.iterator;s.next();){var a=s.value;if(a.valid){for(var h=0,l=a.destinationEdges;l.next();)l.value.toVertex.valid&&h++;l=0;for(var u=a.sourceEdges;u.next();)u.value.fromVertex.valid&&l++;(null===o||r<h-l)&&(o=a,r=h-l)}}null!==o&&(n[e]=o,e++,o.valid=!1)}for(e=0;e<t.vertexes.count;e++)n[e].index=e;for(n=t.edges.iterator;n.next();)(e=n.value).fromVertex.index>e.toVertex.index&&(t.gm(e),e.rev=!0);break;case Dg:for(n=this.network.vertexes.iterator;n.next();)(t=n.value).Ll=-1,t.finish=-1;for(t=this.network.edges.iterator;t.next();)t.value.forest=!1;for(this.Kn=0,n.reset();n.next();)0===(e=n.value).sourceEdges.count&&hg(this,e);for(n.reset();n.next();)-1===(e=n.value).Ll&&hg(this,e);for(t.reset();t.next();)(n=t.value).forest||(i=(e=n.fromVertex).finish,r=(o=n.toVertex).finish,o.Ll<e.Ll&&i<r&&(this.network.gm(n),n.rev=!0));break;case jg:for(e=(t=this.network).vertexes.iterator,n=1/0;e.next();)n=Math.min(n,e.value.layer);if(1/0>n){if(0>n)for(e.reset();e.next();)e.value.layer-=n;for(n=[],e.reset();e.next();)void 0===(o=n[(i=e.value).layer])?n[i.layer]=[i]:o.push(i);for(i=e=0;i<n.length;i++)if((o=n[i])&&0!==o.length){if(0<i)for(r=0;r<o.length;r++)o[r].layer-=e}else e++;for(n=t.edges.iterator;n.next();)(e=n.value).fromVertex.layer<e.toVertex.layer&&(t.gm(e),e.rev=!0)}}},_p.prototype.assignLayers=function(){switch(this.Zk){case Og:lg(this);break;case Ig:for(var t,e=this.network.vertexes.iterator;e.next();)t=cg(this,e.value),this.Ia=Math.max(t,this.Ia);for(e.reset();e.next();)(t=e.value).layer=this.Ia-t.layer;break;default:for(lg(this),e=this.network.vertexes.iterator;e.next();)e.value.valid=!1;for(e.reset();e.next();)0===(t=e.value).sourceEdges.count&&dg(this,t);for(t=1/0,e.reset();e.next();)t=Math.min(t,e.value.layer);for(this.Ia=-1,e.reset();e.next();){var i=e.value;i.layer-=t,this.Ia=Math.max(this.Ia,i.layer)}}},_p.prototype.initializeIndices=function(){switch(this.Qk){default:case Vg:for(var t=this.network.vertexes.iterator;t.next();){var e=t.value,i=e.layer;e.index=this.tc[i],this.tc[i]++}break;case zg:for(t=this.network.vertexes.iterator,e=this.Ia;0<=e;e--)for(t.reset();t.next();)(i=t.value).layer===e&&-1===i.index&&pg(this,i);break;case Rg:for(t=this.network.vertexes.iterator,e=0;e<=this.Ia;e++)for(t.reset();t.next();)(i=t.value).layer===e&&-1===i.index&&gg(this,i)}},_p.prototype.reduceCrossings=function(){var t,e,i,n,o,r=this.countCrossings(),s=Jp(this);for(t=0;t<this.bj;t++){for(e=0;e<=this.Ia;e++)mg(this,e,1),yg(this,e,1);var a=this.countCrossings();for(a<r&&(r=a,s=Jp(this)),e=this.Ia;0<=e;e--)mg(this,e,-1),yg(this,e,-1);(a=this.countCrossings())<r&&(r=a,s=Jp(this))}for(Zp(this,s),t=0;t<this.bj;t++){for(e=0;e<=this.Ia;e++)mg(this,e,0),yg(this,e,0);for((a=this.countCrossings())<r&&(r=a,s=Jp(this)),e=this.Ia;0<=e;e--)mg(this,e,0),yg(this,e,0);(a=this.countCrossings())<r&&(r=a,s=Jp(this))}switch(Zp(this,s),this.rk){case Gg:break;case Yg:for(o=r+1;(e=this.countCrossings())<o;)for(o=e,t=this.Ia;0<=t;t--)for(n=0;n<=t;n++){for(i=!0;i;)for(i=!1,e=t;e>=n;e--)i=yg(this,e,-1)||i;for((a=this.countCrossings())>=r?Zp(this,s):(r=a,s=Jp(this)),i=!0;i;)for(i=!1,e=t;e>=n;e--)i=yg(this,e,1)||i;for((a=this.countCrossings())>=r?Zp(this,s):(r=a,s=Jp(this)),i=!0;i;)for(i=!1,e=n;e<=t;e++)i=yg(this,e,1)||i;for(a>=r?Zp(this,s):(r=a,s=Jp(this)),i=!0;i;)for(i=!1,e=n;e<=t;e++)i=yg(this,e,-1)||i;for(a>=r?Zp(this,s):(r=a,s=Jp(this)),i=!0;i;)for(i=!1,e=t;e>=n;e--)i=yg(this,e,0)||i;for(a>=r?Zp(this,s):(r=a,s=Jp(this)),i=!0;i;)for(i=!1,e=n;e<=t;e++)i=yg(this,e,0)||i;a>=r?Zp(this,s):(r=a,s=Jp(this))}break;default:for(t=this.Ia,n=0,o=r+1;(e=this.countCrossings())<o;){for(o=e,i=!0;i;)for(i=!1,e=t;e>=n;e--)i=yg(this,e,-1)||i;for((a=this.countCrossings())>=r?Zp(this,s):(r=a,s=Jp(this)),i=!0;i;)for(i=!1,e=t;e>=n;e--)i=yg(this,e,1)||i;for((a=this.countCrossings())>=r?Zp(this,s):(r=a,s=Jp(this)),i=!0;i;)for(i=!1,e=n;e<=t;e++)i=yg(this,e,1)||i;for(a>=r?Zp(this,s):(r=a,s=Jp(this)),i=!0;i;)for(i=!1,e=n;e<=t;e++)i=yg(this,e,-1)||i;for(a>=r?Zp(this,s):(r=a,s=Jp(this)),i=!0;i;)for(i=!1,e=t;e>=n;e--)i=yg(this,e,0)||i;for(a>=r?Zp(this,s):(r=a,s=Jp(this)),i=!0;i;)for(i=!1,e=n;e<=t;e++)i=yg(this,e,0)||i;a>=r?Zp(this,s):(r=a,s=Jp(this))}}Zp(this,s)},_p.prototype.straightenAndPack=function(){if(0===this.ve){var t=0!=(1&this.bg),e=0!=(this.bg&Xg);if(1e3<this.network.edges.count&&e&&(t=!1),t){var i=[];for(e=0;e<=this.Ia;e++)i[e]=0;for(var n,r=this.network.vertexes.iterator;r.next();){var s=r.value;e=s.layer,n=s.column,s=this.nodeMinColumnSpace(s,!1),i[e]=Math.max(i[e],n+s)}for(r.reset();r.next();)e=(s=r.value).layer,n=s.column,s.column=(8*(this.Ra-i[e])>>1)+8*n;this.Ra*=8}if(0!=(2&this.bg))for(i=!0;i;){for(i=!1,e=this.Md+1;e<=this.Ia;e++)i=vg(this,e,1)||i;for(e=this.Md-1;0<=e;e--)i=vg(this,e,-1)||i;i=vg(this,this.Md,0)||i}if(0!=(4&this.bg)){for(e=this.Md+1;e<=this.Ia;e++)bg(this,e,1);for(e=this.Md-1;0<=e;e--)bg(this,e,-1);bg(this,this.Md,0)}if(t&&(Sg(this,-1),Sg(this,1)),0!=(2&this.bg))for(i=!0;i;){for(i=!1,i=vg(this,this.Md,0)||i,e=this.Md+1;e<=this.Ia;e++)i=vg(this,e,0)||i;for(e=this.Md-1;0<=e;e--)i=vg(this,e,0)||i}}else!function(t){for(var e=A(),i=t.fl.length,n=0;n<=i;n++)e[n]=[];for(n=t.network.vertexes.iterator;n.next();){var r=n.value;e[i-r.layer][r.index]=r}i=new Z,function(t,e){for(var i=t.length,n=1;n<i-1;n++)for(var r=0,s=0,a=t[n],h=t[n+1],l=0;s<h.length;l++){var u=h[l];t:{if(null===u.node){var c=$g(u);if(0<c.length){c=null===c[0].node;break t}}c=!1}var d=c;if(l===h.length-1||d){for(c=a.length-1,d&&(c=$g(u)[0].index);s<=l;){if(!(u=h[s]).bo){d=[];for(var f=o(u.sourceEdgesArrayAccess),p=f.next();!p.done;p=f.next())(p=p.value).valid&&d.push(p);u.bo=d}for(d=(u=o(u.bo)).next();!d.done;d=u.next())((f=(d=d.value).fromVertex.index)<r||f>c)&&e.add(d);s++}r=c}}}(e,i);var s=null,a=null,h=null,l=null,u=0!=(1&t.ve),c=0!=(2&t.ve),d=0!=(4&t.ve),f=0!=(8&t.ve);for(u&&(t.verticalAlignment(e,i,!0),s=Cg(t,e,!0,!1)),e.reverse(),d&&(t.verticalAlignment(e,i,!1),h=Cg(t,e,!1,!1)),n=o(e),r=n.next();!r.done;r=n.next())r.value.reverse();f&&(t.verticalAlignment(e,i,!1),l=Cg(t,e,!1,!0)),e.reverse(),c&&(t.verticalAlignment(e,i,!0),a=Cg(t,e,!0,!0)),B(e),t.u(s,a,h,l),t.network.vertexes.each((function(t){var e=A();u&&e.push(s.get(t)),c&&e.push(a.get(t)),d&&e.push(h.get(t)),f&&e.push(l.get(t)),e.sort((function(t,e){return t-e}));var i=e.length;i=(e[Math.floor((i-1)/2)]+e[Math.ceil((i-1)/2)])/2,B(e),t.zc=i}))}(this)},_p.prototype.verticalAlignment=function(t,e,i){!function(t){for(var e=0;e<t.length;e++)for(var i=t[e],n=0;n<i.length;n++){var o=i[n];o.root=o,o.align=o,o.Tz=e,o.vi=n}}(t);for(var n=(t=o(t)).next();!n.done;n=t.next())for(var r=-1,s=(n=o(n.value)).next();!s.done;s=n.next()){s=s.value;var a=i?$g(s):Jg(s),h=a.length;if(0<h){a.sort((function(t,e){return t.vi-e.vi}));var l=(h-1)/2;for(h=Math.floor(l),l=Math.ceil(l);h<=l;h++)if(s.align===s){var u,c=a[h];u=i?_g(c,s):_g(s,c),!e.contains(u)&&r<c.vi&&(c.align=s,s.root=c.root,s.align=c.root,r=c.vi)}}}},_p.prototype.u=function(t){for(var e=[],i=0;i<arguments.length;++i)e[i]=arguments[i];i=-1;for(var n=A(),o=A(),r=1/0,s=0;4>s;s++)if(e[s]){var a=Ng(this,e[s],n,o,s);a<r&&(i=s,r=a)}for(r={},s=0;4>s;r={delta:r.delta},s++)e[s]&&(r.delta=0===s||2===s?n[i]-n[s]:o[i]-o[s],0!==r.delta&&e[s].each(function(t){return function(e){e.value+=t.delta}}(r)));B(n),B(o)},_p.prototype.commitLayout=function(){if(this.setsPortSpots)for(var t=Lg(this,!0),e=Lg(this,!1),i=this.network.edges.iterator;i.next();){var n=i.value.link;null!==n&&(n.fromSpot=t,n.toSpot=e)}this.commitNodes(),this.Gu(),this.isRouting&&this.commitLinks()},_p.prototype.commitNodes=function(){this.he=[],this.Ld=[],this.Kd=[],this.Ta=[];for(var t=0;t<=this.Ia;t++)this.he[t]=0,this.Ld[t]=0,this.Kd[t]=0,this.Ta[t]=0;for(t=this.network.vertexes.iterator;t.next();){var e=t.value,i=e.layer;this.he[i]=Math.max(this.he[i],this.nodeMinLayerSpace(e,!0)),this.Ld[i]=Math.max(this.Ld[i],this.nodeMinLayerSpace(e,!1))}e=0,i=this.ie;for(var n=0;n<=this.Ia;n++){var o=i;0>=this.he[n]+this.Ld[n]&&(o=0),0<n&&(e+=o/2),90===this.K||0===this.K?(e+=this.Ld[n],this.Kd[n]=e,e+=this.he[n]):(e+=this.he[n],this.Kd[n]=e,e+=this.Ld[n]),n<this.Ia&&(e+=o/2),this.Ta[n]=e}for(i=e,e=this.arrangementOrigin,n=0;n<=this.Ia;n++)270===this.K?this.Kd[n]=e.y+this.Kd[n]:90===this.K?(this.Kd[n]=e.y+i-this.Kd[n],this.Ta[n]=i-this.Ta[n]):180===this.K?this.Kd[n]=e.x+this.Kd[n]:(this.Kd[n]=e.x+i-this.Kd[n],this.Ta[n]=i-this.Ta[n]);i=0!==this.ve,t.reset(),n=270===this.K||90===this.K;for(var r=1/0,s=o=1/0,a=-1/0;t.next();){var h=t.value,l=h.layer,u=0|h.column;n?(s=e.x+this.kc*u,l=this.Kd[l]):(s=this.Kd[l],l=e.y+this.kc*u),h.centerX=s,h.centerY=l,i&&isFinite(h.zc)&&(n?h.node?h.x=e.x+h.zc:h.centerX=e.x+h.zc:h.node?h.y=e.y+h.zc:h.centerY=e.y+h.zc),r=Math.min(h.x,r),o=Math.min(h.y,o),n?(s=r,a=Math.max(a,h.bounds.right)):(s=o,a=Math.max(a,h.bounds.bottom))}for(this.xw=a-s,r=e.x-r,e=e.y-o,this.Rf=new pt(i&&n?0:r,i&&!n?0:e),t.reset();t.next();)(i=t.value).x+=r,i.y+=e,i.commit()},_p.prototype.Gu=function(){for(var t=0,e=this.ie,i=0;i<=this.Ia;i++)t+=this.he[i],t+=this.Ld[i];t+=this.Ia*e,e=[],i=0!==this.ve?this.xw:this.kc*this.Ra;for(var n=this.maxLayer;0<=n;n--)270===this.K?0===n?e.push(new jt(0,0,i,Math.abs(this.Ta[0]))):e.push(new jt(0,this.Ta[n-1],i,Math.abs(this.Ta[n-1]-this.Ta[n]))):90===this.K?0===n?e.push(new jt(0,this.Ta[0],i,Math.abs(this.Ta[0]-t))):e.push(new jt(0,this.Ta[n],i,Math.abs(this.Ta[n-1]-this.Ta[n]))):180===this.K?0===n?e.push(new jt(0,0,Math.abs(this.Ta[0]),i)):e.push(new jt(this.Ta[n-1],0,Math.abs(this.Ta[n-1]-this.Ta[n]),i)):0===n?e.push(new jt(this.Ta[0],0,Math.abs(this.Ta[0]-t),i)):e.push(new jt(this.Ta[n],0,Math.abs(this.Ta[n-1]-this.Ta[n]),i));this.commitLayers(e,this.Rf)},_p.prototype.commitLayers=function(){},_p.prototype.commitLinks=function(){for(var t,e=this.network.edges.iterator;e.next();)null!==(t=e.value.link)&&(t.uh(),t.Fj(),t.zf());for(e.reset();e.next();)null!==(t=e.value.link)&&t.vg();for(e.reset();e.next();){var i=e.value;if(null!==(t=i.link)){t.uh();var n=t,o=n.fromNode,r=n.toNode,s=n.fromPort,a=n.toPort;if(null!==o){var h=o.findVisibleNode();null!==h&&h!==o&&(o=h,s=h.port)}null!==r&&(null!==(h=r.findVisibleNode())&&h!==r&&(r=h,a=h.port));var l=t.computeSpot(!0,s);h=t.computeSpot(!1,a);var u=i.fromVertex,c=i.toVertex;if(i.valid)t.curve===_c&&4===t.pointsCount&&(u.column===c.column&&0===this.alignOption?(i=t.getLinkPoint(o,s,l,!0,!1,r,a),a=t.getLinkPoint(r,a,h,!1,!1,o,s),i.w()||i.set(o.actualBounds.center),a.w()||a.set(r.actualBounds.center),t.Fj(),t.yf(i.x,i.y),t.yf((2*i.x+a.x)/3,(2*i.y+a.y)/3),t.yf((i.x+2*a.x)/3,(i.y+2*a.y)/3),t.yf(a.x,a.y)):(i=n=!1,null!==s&&l===Qt&&(n=!0),null!==a&&h===Qt&&(i=!0),(n||i)&&(h=null,n&&((h=t.getLinkPointFromPoint(o,s,s.ga(oe),t.i(3),!0)).w()||h.set(o.actualBounds.center),t.L(0,h.x,h.y)),o=null,i&&((o=t.getLinkPointFromPoint(r,a,a.ga(oe),t.i(0),!1)).w()||o.set(r.actualBounds.center),t.L(3,o.x,o.y)),h&&(r=t.i(2),t.L(1,(2*h.x+r.x)/3,(2*h.y+r.y)/3)),o&&(r=t.i(1),t.L(2,(2*o.x+r.x)/3,(2*o.y+r.y)/3))))),t.zf();else if(u.layer===c.layer)t.zf();else{var d=!1,f=!1,p=this.ie,g=t.firstPickIndex+1;if(t.isOrthogonal){f=!0;var m=t.pointsCount;4<m&&t.points.removeRange(2,m-3)}else if(t.curve===_c)d=!0,4<(m=t.pointsCount)&&t.points.removeRange(2,m-3),4===m&&(g=2);else{m=t.pointsCount;var y=l===Qt,v=h===Qt;2<m&&y&&v?t.points.removeRange(1,m-2):3<m&&y&&!v?t.points.removeRange(1,m-3):3<m&&!y&&v?t.points.removeRange(2,m-2):4<m&&!y&&!v&&t.points.removeRange(2,m-3)}if(i.rev){for(;null!==c&&u!==c;){var x=m=null;for(y=c.sourceEdges.iterator;y.next()&&((v=y.value).link!==i.link||(m=v.fromVertex,x=v.toVertex,null!==m.node)););if(null===m)break;if(m!==u){y=t.i(g-1).x,v=t.i(g-1).y;var b=m.centerX,w=m.centerY;if(f)180===this.K||0===this.K?g===t.firstPickIndex+1?(t.m(g++,y,v),t.m(g++,y,w)):(null!==x?x.centerY:v)!==w&&(x=this.Ta[m.layer-1]+this.Rf.x,t.m(g++,x,v),t.m(g++,x,w)):g===t.firstPickIndex+1?(t.m(g++,y,v),t.m(g++,b,v)):(null!==x?x.centerX:y)!==b&&(x=this.Ta[m.layer-1]+this.Rf.y,t.m(g++,y,x),t.m(g++,b,x));else if(g===t.firstPickIndex+1){x=Math.max(10,this.he[c.layer]);var k=Math.max(10,this.Ld[c.layer]);if(d)180===this.K?b<=c.bounds.x?(c=c.bounds.x,t.m(g++,c-x,w),t.m(g++,c,w),t.m(g++,c+k,w)):(t.m(g++,b-x,w),t.m(g++,b,w),t.m(g++,b+k,w)):90===this.K?w>=c.bounds.bottom?(c=c.bounds.y+c.bounds.height,t.m(g++,b,c+k),t.m(g++,b,c),t.m(g++,b,c-x)):(t.m(g++,b,w+k),t.m(g++,b,w),t.m(g++,b,w-x)):270===this.K?w<=c.bounds.y?(c=c.bounds.y,t.m(g++,b,c-x),t.m(g++,b,c),t.m(g++,b,c+k)):(t.m(g++,b,w-x),t.m(g++,b,w),t.m(g++,b,w+k)):0===this.K&&(b>=c.bounds.right?(c=c.bounds.x+c.bounds.width,t.m(g++,c+k,w),t.m(g++,c,w),t.m(g++,c-x,w)):(t.m(g++,b+k,w),t.m(g++,b,w),t.m(g++,b-x,w)));else{t.m(g++,y,v);var S=0;180===this.K||0===this.K?((180===this.K?b>=c.bounds.right:b<=c.bounds.x)&&(S=(0===this.K?-x:k)/2),t.m(g++,y+S,w)):((270===this.K?w>=c.bounds.bottom:w<=c.bounds.y)&&(S=(90===this.K?-x:k)/2),t.m(g++,b,v+S)),t.m(g++,b,w)}}else x=Math.max(10,this.he[m.layer]),k=Math.max(10,this.Ld[m.layer]),d?180===this.K?(t.m(g++,b-x-p,w),t.m(g++,Math.min(b-x+p/2,b),w),t.m(g++,b,w),t.m(g++,b,w),t.m(g++,Math.max(b+k-p/2,b),w),t.m(g++,b+k+p,w)):90===this.K?(t.m(g++,b,w+k+p),t.m(g++,b,Math.max(w+k-p/2,w)),t.m(g++,b,w),t.m(g++,b,w),t.m(g++,b,Math.min(w-x+p/2,w)),t.m(g++,b,w-x-p)):270===this.K?(t.m(g++,b,w-x-p),t.m(g++,b,Math.min(w-x+p/2,w)),t.m(g++,b,w),t.m(g++,b,w),t.m(g++,b,Math.max(w+k-p/2,w)),t.m(g++,b,w+k+p)):(t.m(g++,b+k+p,w),t.m(g++,Math.max(b+k-p/2,b),w),t.m(g++,b,w),t.m(g++,b,w),t.m(g++,Math.min(b-x+p/2,b),w),t.m(g++,b-x-p,w)):t.m(g++,b,w)}c=m}(null===a||l!==Qt||f)&&(y=t.i(g-1).x,v=t.i(g-1).y,b=t.i(g).x,w=t.i(g).y,f?(p=this.Ld[u.layer],180===this.K||0===this.K?((f=v)>=u.bounds.y&&f<=u.bounds.bottom&&(180===this.K?b>=u.bounds.x:b<=u.bounds.right)&&(c=u.centerX+(180===this.K?-p:p),f=f<u.bounds.y+u.bounds.height/2?u.bounds.y-this.kc/2:u.bounds.bottom+this.kc/2,t.m(g++,c,v),t.m(g++,c,f)),t.m(g++,b,f)):((f=y)>=u.bounds.x&&f<=u.bounds.right&&(270===this.K?w>=u.bounds.y:w<=u.bounds.bottom)&&(c=u.centerY+(270===this.K?-p:p),f=f<u.bounds.x+u.bounds.width/2?u.bounds.x-this.kc/2:u.bounds.right+this.kc/2,t.m(g++,y,c),t.m(g++,f,c)),t.m(g++,f,w)),t.m(g++,b,w)):d?(x=Math.max(10,this.he[u.layer]),k=Math.max(10,this.Ld[u.layer]),180===this.K&&b>=u.bounds.x?(c=u.bounds.x+u.bounds.width,t.L(g-2,c,v),t.L(g-1,c+k,v)):90===this.K&&w<=u.bounds.bottom?(c=u.bounds.y,t.L(g-2,y,c),t.L(g-1,y,c-x)):270===this.K&&w>=u.bounds.y?(c=u.bounds.y+u.bounds.height,t.L(g-2,y,c),t.L(g-1,y,c+k)):0===this.K&&b<=u.bounds.right&&(c=u.bounds.x,t.L(g-2,c,v),t.L(g-1,c-x,v))):(x=Math.max(10,this.he[u.layer]),k=Math.max(10,this.Ld[u.layer]),f=0,180===this.K||0===this.K?((180===this.K?b<=u.bounds.x:b>=u.bounds.right)&&(f=(0===this.K?k:-x)/2),t.m(g++,b+f,v)):((270===this.K?w<=u.bounds.y:w>=u.bounds.bottom)&&(f=(90===this.K?k:-x)/2),t.m(g++,y,w+f)),t.m(g++,b,w)))}else{for(;null!==u&&u!==c;){for(x=m=null,u=u.destinationEdges.iterator;u.next()&&((y=u.value).link!==i.link||(m=y.toVertex,null!==(x=y.fromVertex).node&&(x=null),null!==m.node)););if(null===m)break;m!==c&&(y=t.i(g-1).x,v=t.i(g-1).y,b=m.centerX,w=m.centerY,f?180===this.K||0===this.K?(null!==x?x.centerY:v)!==w&&(x=this.Ta[m.layer]+this.Rf.x,g===t.firstPickIndex+1&&(x=0===this.K?Math.max(x,y):Math.min(x,y)),t.m(g++,x,v),t.m(g++,x,w)):(null!==x?x.centerX:y)!==b&&(x=this.Ta[m.layer]+this.Rf.y,g===t.firstPickIndex+1&&(x=90===this.K?Math.max(x,v):Math.min(x,v)),t.m(g++,y,x),t.m(g++,b,x)):(x=Math.max(10,this.he[m.layer]),k=Math.max(10,this.Ld[m.layer]),d?180===this.K?(t.m(g++,b+k+p,w),t.m(g++,Math.max(b+k-p/2,b),w),t.m(g++,b,w),t.m(g++,b,w),t.m(g++,Math.min(b-x+p/2,b),w),t.m(g++,b-x-p,w)):90===this.K?(t.m(g++,b,w-x-p),t.m(g++,b,Math.min(w-x+p/2,w)),t.m(g++,b,w),t.m(g++,b,w),t.m(g++,b,Math.max(w+k-p/2,w)),t.m(g++,b,w+k+p)):270===this.K?(t.m(g++,b,w+k+p),t.m(g++,b,Math.max(w+k-p/2,w)),t.m(g++,b,w),t.m(g++,b,w),t.m(g++,b,Math.min(w-x+p/2,w)),t.m(g++,b,w-x-p)):(t.m(g++,b-x-p,w),t.m(g++,Math.min(b-x+p/2,b),w),t.m(g++,b,w),t.m(g++,b,w),t.m(g++,Math.max(b+k-p/2,b),w),t.m(g++,b+k+p,w)):180===this.K?(t.m(g++,b+k,w),t.m(g++,b-x,w)):90===this.K?(t.m(g++,b,w-x),t.m(g++,b,w+k)):270===this.K?(t.m(g++,b,w+k),t.m(g++,b,w-x)):(t.m(g++,b-x,w),t.m(g++,b+k,w)))),u=m}f&&(y=t.i(g-1).x,v=t.i(g-1).y,b=t.i(g).x,w=t.i(g).y,180===this.K||0===this.K?v!==w&&(x=0===this.K?Math.min(Math.max((b+y)/2,this.Ta[c.layer]+this.Rf.x),b):Math.max(Math.min((b+y)/2,this.Ta[c.layer]+this.Rf.x),b),t.m(g++,x,v),t.m(g++,x,w)):y!==b&&(x=90===this.K?Math.min(Math.max((w+v)/2,this.Ta[c.layer]+this.Rf.y),w):Math.max(Math.min((w+v)/2,this.Ta[c.layer]+this.Rf.y),w),t.m(g++,y,x),t.m(g++,b,x)))}null!==n&&d&&4<=t.pointsCount&&(null!==s&&(s=l===Qt?t.getLinkPointFromPoint(o,s,s.ga(oe),t.i(3),!0):t.i(0),l===Qt&&(l=t.i(2),n=t.i(3),90===this.direction||270===this.direction?(t.L(1,(s.x+l.x)/2,l.y),t.L(2,n.x,(l.y+n.y)/2)):(t.L(1,l.x,(s.y+l.y)/2),t.L(2,(l.x+n.x)/2,n.y))),s.w()||s.set(o.actualBounds.center),t.L(0,s.x,s.y)),null!==a&&(o=h===Qt?t.getLinkPointFromPoint(r,a,a.ga(oe),t.i(t.pointsCount-4),!1):t.i(t.pointsCount-1),h===Qt&&(a=t.i(t.pointsCount-3),h=t.i(t.pointsCount-4),90===this.direction||270===this.direction?(t.L(t.pointsCount-2,(o.x+a.x)/2,a.y),t.L(t.pointsCount-2,h.x,(a.y+h.y)/2)):(t.L(t.pointsCount-2,a.x,(o.y+a.y)/2),t.L(t.pointsCount-3,(a.x+h.x)/2,h.y))),o.w()||o.set(r.actualBounds.center),t.L(t.pointsCount-1,o.x,o.y))),t.zf(),i.commit()}}}this.avoidOrthogonalOverlaps()},_p.prototype.avoidOrthogonalOverlaps=function(){if(!(0>=this.linkSpacing)){for(var t=new $,e=this.network.edges.iterator;e.next();){var i=e.value.link;null!==i&&i.isOrthogonal&&!t.contains(i)&&t.add(i)}if(0<t.count)if(90===this.K||270===this.K){for(e=0,i=[],t=t.iterator;t.next();){var n=t.value;if(null!==n&&n.isOrthogonal)for(var o=2;o<n.pointsCount-3;o++){var r=n.i(o),s=n.i(o+1);if(this.B(r.y,s.y)&&!this.B(r.x,s.x)){var a=new Ug;a.layer=Math.floor(r.y/2);var h=n.i(0),l=n.i(n.pointsCount-1);if(a.first=h.x*h.x+h.y,a.jc=l.x*l.x+l.y,a.rd=Math.min(r.x,s.x),a.Ic=Math.max(r.x,s.x),a.index=o,a.link=n,o+2<n.pointsCount){h=n.i(o-1),l=n.i(o+2);var u=0;h.y<r.y?u=l.y<r.y?3:r.x<s.x?2:1:h.y>r.y&&(u=l.y>r.y?0:s.x<r.x?2:1),a.j=u}i.push(a)}}}if(1<i.length)for(i.sort(this.Vx),t=0;t<i.length;){for(r=i[t].layer,n=t+1;n<i.length&&i[n].layer===r;)n++;if(1<n-t)for(r=t;r<n;){for(s=i[r].Ic,o=t+1;o<n&&i[o].rd<s;)s=Math.max(s,i[o].Ic),o++;if(1<(s=o-r)){for(this.zi(i,this.Js,r,r+s),u=1,a=i[r].jc,h=r;h<o;h++)(l=i[h]).jc!==a&&(u++,a=l.jc);this.zi(i,this.Ux,r,r+s);var c=1;for(a=i[r].first,h=r;h<o;h++)(l=i[h]).first!==a&&(c++,a=l.first);for(h=!0,l=c,u<c?(h=!1,l=u,a=i[r].jc,this.zi(i,this.Js,r,r+s)):a=i[r].first,u=0,c=r;c<o;c++){var d=i[c];(h?d.first:d.jc)!==a&&(u++,a=h?d.first:d.jc);var f=d.link;r=f.i(d.index),s=f.i(d.index+1);var p=this.linkSpacing*(u-(l-1)/2);e++,f.uh(),f.L(d.index,r.x,r.y+p),f.L(d.index+1,s.x,s.y+p),f.zf()}}r=o}t=n}}else{for(e=0,i=[],t=t.iterator;t.next();)if(null!==(n=t.value)&&n.isOrthogonal)for(o=2;o<n.pointsCount-3;o++)r=n.i(o),s=n.i(o+1),this.B(r.x,s.x)&&!this.B(r.y,s.y)&&((a=new Ug).layer=Math.floor(r.x/2),h=n.i(0),l=n.i(n.pointsCount-1),a.first=h.x+h.y*h.y,a.jc=l.x+l.y*l.y,a.rd=Math.min(r.y,s.y),a.Ic=Math.max(r.y,s.y),a.index=o,a.link=n,o+2<n.pointsCount&&(h=n.i(o-1),l=n.i(o+2),u=0,h.x<r.x?u=l.x<r.x?3:r.y<s.y?2:1:h.x>r.x&&(u=l.x>r.x?0:s.y<r.y?2:1),a.j=u),i.push(a));if(1<i.length)for(i.sort(this.Vx),t=0;t<i.length;){for(r=i[t].layer,n=t+1;n<i.length&&i[n].layer===r;)n++;if(1<n-t)for(r=t;r<n;){for(s=i[r].Ic,o=t+1;o<n&&i[o].rd<s;)s=Math.max(s,i[o].Ic),o++;if(1<(s=o-r)){for(this.zi(i,this.Js,r,r+s),u=1,a=i[r].jc,h=r;h<o;h++)(l=i[h]).jc!==a&&(u++,a=l.jc);for(this.zi(i,this.Ux,r,r+s),c=1,a=i[r].first,h=r;h<o;h++)(l=i[h]).first!==a&&(c++,a=l.first);for(h=!0,l=c,u<c?(h=!1,l=u,a=i[r].jc,this.zi(i,this.Js,r,r+s)):a=i[r].first,u=0,c=r;c<o;c++)d=i[c],(h?d.first:d.jc)!==a&&(u++,a=h?d.first:d.jc),r=(f=d.link).i(d.index),s=f.i(d.index+1),p=this.linkSpacing*(u-(l-1)/2),e++,f.uh(),f.L(d.index,r.x+p,r.y),f.L(d.index+1,s.x+p,s.y),f.zf()}r=o}t=n}}}},(e=_p.prototype).Vx=function(t,e){return t instanceof Ug&&e instanceof Ug&&t!==e?t.layer<e.layer?-1:t.layer>e.layer?1:t.rd<e.rd?-1:t.rd>e.rd?1:t.Ic<e.Ic?-1:t.Ic>e.Ic?1:0:0},e.Ux=function(t,e){return t instanceof Ug&&e instanceof Ug&&t!==e?t.first<e.first?-1:t.first>e.first||t.j<e.j?1:t.j>e.j||t.rd<e.rd?-1:t.rd>e.rd?1:t.Ic<e.Ic?-1:t.Ic>e.Ic?1:0:0},e.Js=function(t,e){return t instanceof Ug&&e instanceof Ug&&t!==e?t.jc<e.jc?-1:t.jc>e.jc||t.j<e.j?1:t.j>e.j||t.rd<e.rd?-1:t.rd>e.rd?1:t.Ic<e.Ic?-1:t.Ic>e.Ic?1:0:0},e.B=function(t,e){return-1<(t-=e)&&1>t},e.zi=function(t,e,i,n){var o=t.length,r=n-i;if(!(1>=r))if((0>i||i>=o-1)&&w("not in range 0 <= from < length: "+i),2===r)0<e(n=t[i],o=t[i+1])&&(t[i]=o,t[i+1]=n);else if(0===i)if(n>=o)t.sort(e);else for((i=t.slice(0,n)).sort(e),e=0;e<n;e++)t[e]=i[e];else if(n>=o)for((n=t.slice(i)).sort(e),e=i;e<o;e++)t[e]=n[e-i];else for((o=t.slice(i,n)).sort(e),e=i;e<n;e++)t[e]=o[e-i]},d.Object.defineProperties(_p.prototype,{layerSpacing:{get:function(){return this.ie},set:function(t){this.ie!==t&&0<=t&&(this.ie=t,this.C())}},columnSpacing:{get:function(){return this.kc},set:function(t){this.kc!==t&&0<t&&(this.kc=t,this.C())}},direction:{get:function(){return this.K},set:function(t){this.K!==t&&(0===t||90===t||180===t||270===t?(this.K=t,this.C()):w("LayeredDigraphLayout.direction must be 0, 90, 180, or 270"))}},cycleRemoveOption:{get:function(){return this.Dk},set:function(t){this.Dk===t||t!==Fg&&t!==Dg&&t!==jg||(this.Dk=t,this.C())}},layeringOption:{get:function(){return this.Zk},set:function(t){this.Zk===t||t!==Eg&&t!==Og&&t!==Ig||(this.Zk=t,this.C())}},initializeOption:{get:function(){return this.Qk},set:function(t){this.Qk===t||t!==zg&&t!==Rg&&t!==Vg||(this.Qk=t,this.C())}},iterations:{get:function(){return this.bj},set:function(t){this.bj!==t&&0<=t&&(this.bj=t,this.C())}},aggressiveOption:{get:function(){return this.rk},set:function(t){this.rk===t||t!==Gg&&t!==Hg&&t!==Yg||(this.rk=t,this.C())}},packOption:{get:function(){return this.bg},set:function(t){this.bg!==t&&0<=t&&8>t&&(this.bg=t,this.C())}},alignOption:{get:function(){return this.ve},set:function(t){this.ve!==t&&0<=t&&16>t&&(this.ve=t,this.C())}},setsPortSpots:{get:function(){return this.sf},set:function(t){this.sf!==t&&(this.sf=t,this.C())}},linkSpacing:{get:function(){return this.Cn},set:function(t){this.Cn!==t&&0<=t&&(this.Cn=t,this.C())}},maxLayer:{get:function(){return this.Ia}},maxIndex:{get:function(){return this.Iq}},maxColumn:{get:function(){return this.Ra}},minIndexLayer:{get:function(){return this.Hn}},maxIndexLayer:{get:function(){return this.Md}}});var Dg=new V(_p,"CycleDepthFirst",0),Fg=new V(_p,"CycleGreedy",1),jg=new V(_p,"CycleFromLayers",2),Eg=new V(_p,"LayerOptimalLinkLength",0),Og=new V(_p,"LayerLongestPathSink",1),Ig=new V(_p,"LayerLongestPathSource",2),zg=new V(_p,"InitDepthFirstOut",0),Rg=new V(_p,"InitDepthFirstIn",1),Vg=new V(_p,"InitNaive",2),Gg=new V(_p,"AggressiveNone",0),Hg=new V(_p,"AggressiveLess",1),Yg=new V(_p,"AggressiveMore",2),Xg=8;function Ug(){this.index=this.Ic=this.rd=this.jc=this.first=this.layer=0,this.link=null,this.j=0}function qg(t){jd.call(this,t)}function Wg(t){Rd.call(this,t),this.$n=this.bo=this.ao=this.co=null,this.Za=this.Ag=this.Ig=-1,this.u=NaN,this.F=null,this.valid=!1,this.finish=this.Ll=NaN,this.Dj=0,this.dv=this.ev=null}function Kg(t,e){return t.index-e.index}function _g(t,e){if(!t.$n){for(var i=[],n=o(t.destinationEdgesArrayAccess),r=n.next();!r.done;r=n.next())(r=r.value).valid&&i.push(r);t.$n=i}for(i=(t=o(t.$n)).next();!i.done;i=t.next())if((i=i.value).toVertex===e)return i;w("Unable to find destination edge to given vertex")}function $g(t){if(!t.co){for(var e=[],i=o(t.sourceEdgesArrayAccess),n=i.next();!n.done;n=i.next())(n=n.value).valid&&e.push(n.fromVertex);e.sort(Kg),t.co=e}return t.co}function Jg(t){if(!t.ao){for(var e=[],i=o(t.destinationEdgesArrayAccess),n=i.next();!n.done;n=i.next())(n=n.value).valid&&e.push(n.toVertex);e.sort(Kg),t.ao=e}return t.ao}function Zg(t){Gd.call(this,t),this.j=this.ia=this.Ha=!1,this.V=this.u=NaN,this.F=this.o=0}function Qg(t){Bd.call(this),this.Ub=new Z,this.Wn=Tm,this.ud=Nm,this.vo=Xm,this.Bq=Jm,this.$v=[],this.td=!0,this.Rb=Km,this.$d=new At(10,10).freeze();var e=new ty(this);this.W=new ey(e),this.Y=new ey(e),this.ru=[],t&&Object.assign(this,t)}function tm(t){var e=new Z;for(t=t.iterator;t.next();){var i=t.value;i.initialized||e.add(i)}return e}function em(t,e){var i=999999,n=null;for(e=e.iterator;e.next();){var o=e.value;switch(t.ud){case Nm:o.sourceEdges.count<i&&(i=o.sourceEdges.count,n=o);break;case Lm:o.destinationEdges.count<i&&(i=o.destinationEdges.count,n=o);break;default:w("Unhandled path value "+t.ud.toString())}}return n}function im(t,e){if(null!==e){switch(t.ud){case Nm:if(0<e.destinationEdges.count){for(var i=new $,n=e.destinationVertexes;n.next();){var o=n.value;nm(t,e,o)&&i.add(o)}0<i.count&&(e.children=i.Fa())}break;case Lm:if(0<e.sourceEdges.count){for(i=new $,n=e.sourceVertexes;n.next();)nm(t,e,o=n.value)&&i.add(o);0<i.count&&(e.children=i.Fa())}break;default:w("Unhandled path value"+t.ud.toString())}for(n=(i=e.children).length,o=0;o<n;o++){var r=i[o];r.initialized=!0,r.level=e.level+1,r.parent=e,t.Ub.remove(r)}for(e=0;e<n;e++)im(t,i[e])}}function nm(t,e,i){if(i.initialized){if(null===e)var n=!1;else{for(n=e.parent;null!==n&&n!==i;)n=n.parent;n=n===i}if(n||i.level>e.level)return!1;t.removeChild(i.parent,i)}return!0}function om(t,e){if(null!==e){t.initializeTreeVertexValues(e),e.alignment===Rm&&t.sortTreeVertexChildren(e);for(var i=0,n=e.childrenCount,o=0,r=e.children,s=r.length,a=0;a<s;a++){var h=r[a];om(t,h),i+=h.descendantCount+1,n=Math.max(n,h.maxChildrenCount),o=Math.max(o,h.maxGenerationCount)}e.descendantCount=i,e.maxChildrenCount=n,e.maxGenerationCount=0<n?o+1:0}}function rm(t,e){if(null!==e){t.assignTreeVertexValues(e);for(var i=(e=e.children).length,n=0;n<i;n++)rm(t,e[n])}}function sm(t,e){if(null!==e){e.alignment!==Rm&&t.sortTreeVertexChildren(e);for(var i=(e=e.children).length,n=0;n<i;n++)sm(t,e[n])}}function am(t){return t===zm||t===Rm||t===Vm||t===Gm}function hm(t){return t===zm||t===Rm}function lm(t){var e=t.parent;if(null!==e){var i=e.alignment;if(am(i)){if(hm(i)){for(e=e.children,i=0;i<e.length&&t!==e[i];)i++;return 0==i%2}if(i===Vm)return!0}}return!1}function um(t,e){if(0===e.childrenCount){var i=!1,n=0;null!==e.parent&&(n=e.parent.angle,i=am(i=e.parent.alignment));var o=lm(e);e.S.h(0,0),e.Da.h(e.width,e.height),null===e.parent||null===e.comments||(180!==n&&270!==n||i)&&!o?e.la.h(0,0):180===n&&!i||(90===n||270===n)&&o?e.la.h(e.width-2*e.focus.x,0):e.la.h(0,e.height-2*e.focus.y)}else{i=90===(n=Pm(e))||270===n;for(var r=0,s=(o=e.children).length,a=0;a<s;a++){var h=o[a];r=Math.max(r,i?h.Da.width:h.Da.height)}var l=e.alignment,u=l===Om,c=l===Im;a=am(l);var d=Math.max(0,e.breadthLimit);h=t.computeLayerSpacing(e);var f=e.nodeSpacing,p=t.computeNodeIndent(e),g=u||c?0:p/2,m=e.rowSpacing,y=0;(u||c||e.hm||e.im&&1===e.maxGenerationCount)&&(y=Math.max(0,e.rowIndent)),u=e.width;var v=e.height,x=0,b=0,w=0,k=0,S=0,M=0,C=0,P=0,T=0,N=0;if(a&&!hm(l)&&135<n&&o.reverse(),hm(l))if(1<s)for(var L=0;L<s;L++){var A=o[L],B=A.Da;0==L%2&&L!==s-1?T=Math.max(T,(i?B.width:B.height)+t.computeBusNodeSpacing(A)-f):0!=L%2&&(N=Math.max(N,(i?B.width:B.height)+t.computeBusNodeSpacing(A)-f))}else 1===s&&(T=i?o[0].Da.width:o[0].Da.height);if(a)switch(l){case zm:case Rm:T=(b=135>n?cm(t,e,o,T,x,b):dm(t,e,o,T,x,b)).x,x=b.width,b=b.height;break;case Vm:for(d=0;d<s;d++)w=(g=o[d]).Da,N=0===C?0:m,i?(g.S.h(r-w.width,S+N),x=Math.max(x,w.width),b=Math.max(b,S+N+w.height),S+=N+w.height):(g.S.h(k+N,r-w.height),x=Math.max(x,k+N+w.width),b=Math.max(b,w.height),k+=N+w.width),C++;break;case Gm:for(r=0;r<s;r++)g=(d=o[r]).Da,w=0===C?0:m,i?(d.S.h(f/2+e.focus.x,S+w),x=Math.max(x,g.width),b=Math.max(b,S+w+g.height),S+=w+g.height):(d.S.h(k+w,f/2+e.focus.y),x=Math.max(x,k+w+g.width),b=Math.max(b,g.height),k+=w+g.width),C++}else for(N=0;N<s;N++)A=(L=o[N]).Da,i?(0<d&&0<C&&k+f+A.width>d&&(k<r&&ym(e,l,r-k,0,P,N-1),M++,C=0,P=N,w=b,k=0,S=135<n?-b-m:b+m),B=0===C?g:f,xm(t,L,0,S),L.S.h(k+B,S),x=Math.max(x,k+B+A.width),b=Math.max(b,w+(0===M?0:m)+A.height),k+=B+A.width):(0<d&&0<C&&S+f+A.height>d&&(S<r&&ym(e,l,0,r-S,P,N-1),M++,C=0,P=N,w=x,S=0,k=135<n?-x-m:x+m),B=0===C?g:f,xm(t,L,k,0),L.S.h(k,S+B),b=Math.max(b,S+B+A.height),x=Math.max(x,w+(0===M?0:m)+A.width),S+=B+A.height),C++;switch(0<M&&(i?(b+=Math.max(0,h),k<x&&ym(e,l,x-k,0,P,s-1),0<y&&(c||vm(e,y,0,0,s-1),x+=y)):(x+=Math.max(0,h),S<b&&ym(e,l,0,b-S,P,s-1),0<y&&(c||vm(e,0,y,0,s-1),b+=y))),y=c=0,l){case jm:i?c+=x/2-e.focus.x-p/2:y+=b/2-e.focus.y-p/2;break;case Em:0<M?i?c+=x/2-e.focus.x-p/2:y+=b/2-e.focus.y-p/2:i?c+=(t=o[0].S.x+o[0].la.x)+(o[s-1].S.x+o[s-1].la.x+2*o[s-1].focus.x-t)/2-e.focus.x-p/2:y+=(t=o[0].S.y+o[0].la.y)+(o[s-1].S.y+o[s-1].la.y+2*o[s-1].focus.y-t)/2-e.focus.y-p/2;break;case Om:i?(c-=p,x+=p):(y-=p,b+=p);break;case Im:i?(c+=x-e.width+p,x+=p):(y+=b-e.height+p,b+=p);break;case zm:case Rm:i?c+=1<s?T+f/2-e.focus.x:o[0].focus.x-e.focus.x+o[0].la.x:y+=1<s?T+f/2-e.focus.y:o[0].focus.y-e.focus.y+o[0].la.y;break;case Vm:i?c+=x+f/2-e.focus.x:y+=b+f/2-e.focus.y;break;case Gm:break;default:c=(t=t.customAlignment(e,c,y,x,b))[0],y=t[1],x=t[2],b=t[3]}for(t=0;t<s;t++)p=o[t],i?p.S.h(p.S.x+p.la.x-c,p.S.y+(135<n?(a?-b:-p.Da.height)+p.la.y-h:v+h+p.la.y)):p.S.h(p.S.x+(135<n?(a?-x:-p.Da.width)+p.la.x-h:u+h+p.la.x),p.S.y+p.la.y-y);i?(x=pm(e,x,c),0>c&&(c=0),135<n&&(y+=b+h),b=Math.max(Math.max(b,v),b+v+h)):(135<n&&(c+=x+h),x=Math.max(Math.max(x,u),x+u+h),b=gm(e,b,y),0>y&&(y=0)),e.la.h(c,y),e.Da.h(x,b)}}function cm(t,e,i,n,o,r){var s=i.length;if(0===s)return new jt(n,0,o,r);if(1===s)return new jt(n,0,o=(e=i[0]).Da.width,r=e.Da.height);for(var a=e.nodeSpacing,h=e.rowSpacing,l=90===Pm(e),u=0,c=0,d=0,f=0;f<s;f++)if(!(0!=f%2||1<s&&f===s-1)){var p=i[f],g=p.Da,m=0===u?0:h;if(l){var y=t.computeBusNodeSpacing(p)-a;p.S.h(n-(g.width+y),d+m),o=Math.max(o,g.width+y),r=Math.max(r,d+m+g.height),d+=m+g.height}else y=t.computeBusNodeSpacing(p)-a,p.S.h(c+m,n-(g.height+y)),r=Math.max(r,g.height+y),o=Math.max(o,c+m+g.width),c+=m+g.width;u++}for(u=0,p=c,f=d,l?(c=n+a,d=0):(c=0,d=n+a),g=0;g<s;g++)if(0!=g%2){y=(m=i[g]).Da;var v=0===u?0:h;if(l){var x=t.computeBusNodeSpacing(m)-a;m.S.h(c+x,d+v),o=Math.max(o,c+y.width+x),r=Math.max(r,d+v+y.height),d+=v+y.height}else x=t.computeBusNodeSpacing(m)-a,m.S.h(c+v,d+x),o=Math.max(o,c+v+y.width),r=Math.max(r,d+y.height+x),c+=v+y.width;u++}return 1<s&&1==s%2&&(s=(i=i[s-1]).Da,t=t.computeBusLastRowSpacing(i,l?Math.max(Math.abs(f),Math.abs(d)):Math.max(Math.abs(p),Math.abs(c))),l?(i.S.h(n+a/2-i.focus.x-i.la.x,r+t),l=n+a/2-i.focus.x-i.la.x,o=Math.max(o,l+s.width),0>l&&(o-=l),r=Math.max(r,Math.max(f,d)+t+s.height),0>i.S.x&&(n=fm(e,i.S.x,!1,n,a))):(i.S.h(o+t,n+a/2-i.focus.y-i.la.y),o=Math.max(o,Math.max(p,c)+t+s.width),d=n+a/2-i.focus.y-i.la.y,r=Math.max(r,d+s.height),0>d&&(r-=d),0>i.S.y&&(n=fm(e,i.S.y,!0,n,a)))),new jt(n,0,o,r)}function dm(t,e,i,n,o,r){var s=i.length;if(0===s)return new jt(n,0,o,r);if(1===s)return new jt(n,0,o=(i=i[0]).Da.width,r=i.Da.height);for(var a=e.nodeSpacing,h=e.rowSpacing,l=270===Pm(e),u=0,c=0,d=0,f=0;f<s;f++)if(!(0!=f%2||1<s&&f===s-1)){var p=i[f],g=p.Da,m=0===u?0:h;if(l){var y=t.computeBusNodeSpacing(p)-a;d-=m+g.height,p.S.h(n-(g.width+y),d),o=Math.max(o,g.width+y),r=Math.max(r,Math.abs(d))}else y=t.computeBusNodeSpacing(p)-a,c-=m+g.width,p.S.h(c,n-(g.height+y)),r=Math.max(r,g.height+y),o=Math.max(o,Math.abs(c));u++}for(u=0,p=c,f=d,l?(c=n+a,d=0):(c=0,d=n+a),g=0;g<s;g++)if(0!=g%2){y=(m=i[g]).Da;var v=0===u?0:h;if(l){var x=t.computeBusNodeSpacing(m)-a;d-=v+y.height,m.S.h(c+x,d),o=Math.max(o,c+y.width+x),r=Math.max(r,Math.abs(d))}else x=t.computeBusNodeSpacing(m)-a,c-=v+y.width,m.S.h(c,d+x),r=Math.max(r,d+y.height+x),o=Math.max(o,Math.abs(c));u++}for(1<s&&1==s%2&&(u=(h=i[s-1]).Da,t=t.computeBusLastRowSpacing(h,l?Math.max(Math.abs(f),Math.abs(d)):Math.max(Math.abs(p),Math.abs(c))),l?(h.S.h(n+a/2-h.focus.x-h.la.x,-r-u.height-t),c=n+a/2-h.focus.x-h.la.x,o=Math.max(o,c+u.width),0>c&&(o-=c),r=Math.max(r,Math.abs(Math.min(f,d))+t+u.height),0>h.S.x&&(n=fm(e,h.S.x,!1,n,a))):(h.S.h(-o-u.width-t,n+a/2-h.focus.y-h.la.y),o=Math.max(o,Math.abs(Math.min(p,c))+t+u.width),d=n+a/2-h.focus.y-h.la.y,r=Math.max(r,d+u.height),0>d&&(r-=d),0>h.S.y&&(n=fm(e,h.S.y,!0,n,a)))),e=0;e<s;e++)a=i[e],l?a.S.h(a.S.x,a.S.y+r):a.S.h(a.S.x+o,a.S.y);return new jt(n,0,o,r)}function fm(t,e,i,n,o){for(var r=(t=t.children).length,s=0;s<r;s++)i?t[s].S.h(t[s].S.x,t[s].S.y-e):t[s].S.h(t[s].S.x-e,t[s].S.y);return e=t[r-1],Math.max(n,i?e.la.y+e.focus.y-o/2:e.la.x+e.focus.x-o/2)}function pm(t,e,i){switch(t.alignment){case Em:case jm:return i+t.width>e&&(e=i+t.width),0>i&&(e-=i),e;case Om:return t.width>e?t.width:e;case Im:return 2*t.focus.x>e?t.width:e+t.width-2*t.focus.x;case zm:case Rm:return Math.max(t.width,Math.max(e,i+t.width)-Math.min(0,i));case Vm:return t.width-t.focus.x+t.nodeSpacing/2+e;case Gm:return Math.max(t.width,t.focus.x+t.nodeSpacing/2+e);default:return e}}function gm(t,e,i){switch(t.alignment){case Em:case jm:return i+t.height>e&&(e=i+t.height),0>i&&(e-=i),e;case Om:return t.height>e?t.height:e;case Im:return 2*t.focus.y>e?t.height:e+t.height-2*t.focus.y;case zm:case Rm:return Math.max(t.height,Math.max(e,i+t.height)-Math.min(0,i));case Vm:return t.height-t.focus.y+t.nodeSpacing/2+e;case Gm:return Math.max(t.height,t.focus.y+t.nodeSpacing/2+e);default:return e}}function mm(t,e,i){switch(t){case jm:case Em:e/=2,i/=2;break;case Om:i=e=0;break;case Im:break;default:w("Unhandled alignment value "+t.toString())}return new pt(e,i)}function ym(t,e,i,n,o,r){vm(t,(e=mm(e,i,n)).x,e.y,o,r)}function vm(t,e,i,n,o){if(0!==e||0!==i)for(t=t.children;n<=o;n++){var r=t[n].S;r.x+=e,r.y+=i}}function xm(t,e,i,n){var o=e.parent;switch(t.ud){case Nm:for(t=e.sourceEdges;t.next();)(e=t.value).fromVertex===o&&e.relativePoint.h(i,n);break;case Lm:for(t=e.destinationEdges;t.next();)(e=t.value).toVertex===o&&e.relativePoint.h(i,n);break;default:w("Unhandled path value "+t.ud.toString())}}function bm(t,e,i){for(var n=0;n<t.length;n++){var o=t[n];o.x+=e,o.y+=i}}function wm(t,e,i,n,o,r,s,a){var h=Pm(e),l=90===h||270===h,u=e.nodeSpacing;e=n;var c=o;n=r;var d=s,f=i.Yo,p=i.kp;s=i.Da;var g=l?Math.max(d,s.height):Math.max(n,s.width);if(null!==f&&h===Pm(i)||(f=km(t,2),p=km(t,2),l?(f[0].h(0,0),f[1].h(0,s.height),p[0].h(s.width,0),p[1].h(p[0].x,f[1].y)):(f[0].h(0,0),f[1].h(s.width,0),p[0].h(0,s.height),p[1].h(f[1].x,p[0].y))),l){if(d=9999999,!(null===c||2>c.length||null===f||2>f.length))for(o=i=0;i<c.length&&o<f.length;){r=c[i];var m=f[o];h=m.x,l=m.y,h+=n;var y=r;i+1<c.length&&(y=c[i+1]);var v=m;m=v.x,v=v.y,o+1<f.length&&(m=(v=f[o+1]).x,v=v.y,m+=n);var x=d;r.y===l?x=h-r.x:r.y>l&&r.y<v?x=h+(r.y-l)/(v-l)*(m-h)-r.x:l>r.y&&l<y.y&&(x=h-(r.x+(l-r.y)/(y.y-r.y)*(y.x-r.x))),x<d&&(d=x),y.y<=r.y?i++:v<=l?o++:(y.y<=v&&i++,v<=y.y&&o++)}if(d=n-d,i=f,o=d+=u,null===e||2>e.length||null===i||2>i.length)n=null;else{for(u=km(t,e.length+i.length),n=r=h=0;r<i.length&&i[r].y<e[0].y;)l=i[r++],u[n++].h(l.x+o,l.y);for(;h<e.length;)l=e[h++],u[n++].h(l.x,l.y);for(h=e[e.length-1].y;r<i.length&&i[r].y<=h;)r++;for(;r<i.length&&i[r].y>h;)l=i[r++],u[n++].h(l.x+o,l.y);for(i=km(t,n),h=0;h<n;h++)i[h].assign(u[h]);Sm(t,u),n=i}if(r=p,h=d,null===c||2>c.length||null===r||2>r.length)o=null;else{for(u=km(t,c.length+r.length),o=l=i=0;i<c.length&&c[i].y<r[0].y;)y=c[i++],u[o++].h(y.x,y.y);for(;l<r.length;)y=r[l++],u[o++].h(y.x+h,y.y);for(r=r[r.length-1].y;i<c.length&&c[i].y<=r;)i++;for(;i<c.length&&c[i].y>r;)h=c[i++],u[o++].h(h.x,h.y);for(r=km(t,o),i=0;i<o;i++)r[i].assign(u[i]);Sm(t,u),o=r}return r=Math.max(0,d)+s.width,s=g,Sm(t,e),Sm(t,f),Sm(t,c),Sm(t,p),a[0]=n,a[1]=o,new jt(d,0,r,s)}if(n=9999999,!(null===c||2>c.length||null===f||2>f.length))for(o=i=0;i<c.length&&o<f.length;)r=c[i],h=(m=f[o]).x,l=m.y,l+=d,y=r,i+1<c.length&&(y=c[i+1]),m=(v=m).x,v=v.y,o+1<f.length&&(m=(v=f[o+1]).x,v=v.y,v+=d),x=n,r.x===h?x=l-r.y:r.x>h&&r.x<m?x=l+(r.x-h)/(m-h)*(v-l)-r.y:h>r.x&&h<y.x&&(x=l-(r.y+(h-r.x)/(y.x-r.x)*(y.y-r.y))),x<n&&(n=x),y.x<=r.x?i++:m<=h?o++:(y.x<=m&&i++,m<=y.x&&o++);if(d-=n,i=f,o=d+=u,null===e||2>e.length||null===i||2>i.length)n=null;else{for(u=km(t,e.length+i.length),n=r=h=0;r<i.length&&i[r].x<e[0].x;)l=i[r++],u[n++].h(l.x,l.y+o);for(;h<e.length;)l=e[h++],u[n++].h(l.x,l.y);for(h=e[e.length-1].x;r<i.length&&i[r].x<=h;)r++;for(;r<i.length&&i[r].x>h;)l=i[r++],u[n++].h(l.x,l.y+o);for(i=km(t,n),h=0;h<n;h++)i[h].assign(u[h]);Sm(t,u),n=i}if(r=p,h=d,null===c||2>c.length||null===r||2>r.length)o=null;else{for(u=km(t,c.length+r.length),o=l=i=0;i<c.length&&c[i].x<r[0].x;)y=c[i++],u[o++].h(y.x,y.y);for(;l<r.length;)y=r[l++],u[o++].h(y.x,y.y+h);for(r=r[r.length-1].x;i<c.length&&c[i].x<=r;)i++;for(;i<c.length&&c[i].x>r;)h=c[i++],u[o++].h(h.x,h.y);for(r=km(t,o),i=0;i<o;i++)r[i].assign(u[i]);Sm(t,u),o=r}return r=g,s=Math.max(0,d)+s.height,Sm(t,e),Sm(t,f),Sm(t,c),Sm(t,p),a[0]=n,a[1]=o,new jt(d,0,r,s)}function km(t,e){if(void 0!==(t=t.ru[e])&&void 0!==(t=t.pop()))return t;t=[];for(var i=0;i<e;i++)t[i]=new pt;return t}function Sm(t,e){var i=e.length,n=t.ru[i];void 0===n&&(n=[],t.ru[i]=n),n.push(e)}function Mm(t,e,i,n){if(null!==e){e.x=i,e.y=n;for(var o=(e=e.children).length,r=0;r<o;r++){var s=e[r];Mm(t,s,i+s.S.x,n+s.S.y)}}}function Cm(t,e){if(null!==e){t.setPortSpots(e);for(var i=(e=e.children).length,n=0;n<i;n++)Cm(t,e[n])}}function Pm(t){return 45>=(t=t.angle)?0:135>=t?90:225>=t?180:315>=t?270:0}_p.className="LayeredDigraphLayout",_p.CycleDepthFirst=Dg,_p.CycleGreedy=Fg,_p.CycleFromLayers=jg,_p.LayerOptimalLinkLength=Eg,_p.LayerLongestPathSink=Og,_p.LayerLongestPathSource=Ig,_p.InitDepthFirstOut=zg,_p.InitDepthFirstIn=Rg,_p.InitNaive=Vg,_p.AggressiveNone=Gg,_p.AggressiveLess=Hg,_p.AggressiveMore=Yg,_p.PackNone=0,_p.PackExpand=1,_p.PackStraighten=2,_p.PackMedian=4,_p.PackAll=15,_p.AlignNone=0,_p.AlignUpperLeft=1,_p.AlignUpperRight=2,_p.AlignLowerLeft=4,_p.AlignLowerRight=8,_p.AlignAll=15,Ug.className="SegInfo",c(qg,jd),qg.prototype.createVertex=function(){return new Wg(this)},qg.prototype.createEdge=function(){return new Zg(this)},qg.className="LayeredDigraphNetwork",c(Wg,Rd),Wg.prototype.Cl=function(t){Rd.prototype.Cl.call(this,t),this.bo=this.co=null},Wg.prototype.Kl=function(t){Rd.prototype.Kl.call(this,t),this.bo=this.co=null},Wg.prototype.zl=function(t){Rd.prototype.zl.call(this,t),this.$n=this.ao=null},Wg.prototype.Jl=function(t){Rd.prototype.Jl.call(this,t),this.$n=this.ao=null},d.Object.defineProperties(Wg.prototype,{layer:{get:function(){return this.Ig},set:function(t){this.Ig!==t&&(this.Ig=t)}},column:{get:function(){return this.Ag},set:function(t){this.Ag!==t&&(this.Ag=t)}},index:{get:function(){return this.Za},set:function(t){this.Za!==t&&(this.Za=t)}},component:{get:function(){return this.u},set:function(t){this.u!==t&&(this.u=t)}},near:{get:function(){return this.F},set:function(t){this.F!==t&&(this.F=t)}}}),Wg.prototype.deleteDestinationEdge=Wg.prototype.Jl,Wg.prototype.addDestinationEdge=Wg.prototype.zl,Wg.prototype.deleteSourceEdge=Wg.prototype.Kl,Wg.prototype.addSourceEdge=Wg.prototype.Cl,Wg.className="LayeredDigraphVertex",c(Zg,Gd),d.Object.defineProperties(Zg.prototype,{fromVertex:{get:function(){return this.kd},set:function(t){this.kd!==t&&(this.kd=t)}},toVertex:{get:function(){return this.qd},set:function(t){this.qd!==t&&(this.qd=t)}},valid:{get:function(){return this.Ha},set:function(t){this.Ha!==t&&(this.Ha=t)}},rev:{get:function(){return this.ia},set:function(t){this.ia!==t&&(this.ia=t)}},forest:{get:function(){return this.j},set:function(t){this.j!==t&&(this.j=t)}},portFromPos:{get:function(){return this.u},set:function(t){this.u!==t&&(this.u=t)}},portToPos:{get:function(){return this.V},set:function(t){this.V!==t&&(this.V=t)}},portFromColOffset:{get:function(){return this.o},set:function(t){this.o!==t&&(this.o=t)}},portToColOffset:{get:function(){return this.F},set:function(t){this.F!==t&&(this.F=t)}}}),Zg.className="LayeredDigraphEdge",c(Qg,Bd),Qg.prototype.cloneProtected=function(t){Bd.prototype.cloneProtected.call(this,t),t.Wn=this.Wn,t.vo=this.vo,t.Bq=this.Bq,t.td=this.td,t.Rb=this.Rb,t.$d.assign(this.$d),t.W.copyInheritedPropertiesFrom(this.W),t.Y.copyInheritedPropertiesFrom(this.Y)},Qg.prototype.qb=function(t){t.classType===Qg?0===t.name.indexOf("Alignment")?this.alignment=t:0===t.name.indexOf("Arrangement")?this.arrangement=t:0===t.name.indexOf("Compaction")?this.compaction=t:0===t.name.indexOf("Path")?this.path=t:0===t.name.indexOf("Sorting")?this.sorting=t:0===t.name.indexOf("Style")?this.treeStyle=t:w("Unknown enum value: "+t):Bd.prototype.qb.call(this,t)},Qg.prototype.createNetwork=function(){return new ty(this)},Qg.prototype.makeNetwork=function(t){function e(t){if(t instanceof _u)return!t.isLinkLabel&&"Comment"!==t.category;if(t instanceof wc){var e=t.fromNode;return null!==e&&!e.isLinkLabel&&"Comment"!==e.category&&(null!==(t=t.toNode)&&!t.isLinkLabel&&"Comment"!==t.category)}return!1}var i=this.createNetwork();return t instanceof No?(i.lg(t.nodes,!0,e),i.lg(t.links,!0,e)):t instanceof gc?i.lg(t.memberParts,!1,e):i.lg(t.iterator,!1,e),i},Qg.prototype.doLayout=function(t){null===this.network&&(this.network=this.makeNetwork(t)),this.arrangement!==$m&&(this.arrangementOrigin=this.initialOrigin(this.arrangementOrigin));var e=this.diagram;if(null===e&&t instanceof No&&(e=t),this.path===Tm&&null!==e?this.ud=e.isTreePathToChildren?Nm:Lm:this.ud=this.path===Tm?Nm:this.path,0<this.network.vertexes.count){for(this.network.Ko(),t=this.network.vertexes.iterator;t.next();)(e=t.value).initialized=!1,e.level=0,e.parent=null,e.children=[];if(0<this.Ub.count){for(t=new Z,e=this.Ub.iterator;e.next();){var i=e.value;i instanceof _u?null!==(i=this.network.ki(i))&&t.add(i):i instanceof ey&&t.add(i)}this.Ub=t}for(0===this.Ub.count&&this.findRoots(),t=this.Ub.copy().iterator;t.next();)(e=t.value).initialized||(e.initialized=!0,im(this,e));for(e=this.network.vertexes,t=null;0<(t=tm(e)).count;)null!==(e=em(this,t))&&this.Ub.add(e),e.initialized=!0,im(this,e),e=t;for(t=this.Ub.iterator;t.next();)(e=t.value)instanceof ey&&om(this,e);for(t=this.Ub.iterator;t.next();)(e=t.value)instanceof ey&&rm(this,e);for(t=this.Ub.iterator;t.next();)(e=t.value)instanceof ey&&sm(this,e);if(this.Cu(),this.layerStyle===Qm){for(t=[],e=this.network.vertexes.iterator;e.next();){var n=(i=e.value).parent;null===n&&(n=i),n=0===n.angle||180===n.angle;var o=t[i.level];void 0===o&&(o=0),t[i.level]=Math.max(o,n?i.width:i.height)}for(e=0;e<t.length;e++)void 0===t[e]&&(t[e]=0);for(this.$v=t,e=this.network.vertexes.iterator;e.next();)null===(n=(i=e.value).parent)&&(n=i),0===n.angle||180===n.angle?(180===n.angle&&(i.focusX+=t[i.level]-i.width),i.width=t[i.level]):(270===n.angle&&(i.focusY+=t[i.level]-i.height),i.height=t[i.level])}else if(this.layerStyle===Zm)for(t=this.network.vertexes.iterator;t.next();){for(i=0===(e=t.value).angle||180===e.angle,n=-1,o=0;o<e.children.length;o++){var r=e.children[o];n=Math.max(n,i?r.width:r.height)}if(0<=n)for(o=0;o<e.children.length;o++)r=e.children[o],i?(180===e.angle&&(r.focusX+=n-r.width),r.width=n):(270===e.angle&&(r.focusY+=n-r.height),r.height=n)}for(t=this.Ub.iterator;t.next();)(e=t.value)instanceof ey&&this.layoutTree(e);this.arrangeTrees(),this.updateParts()}this.network=null,this.Ub=new Z,this.isValidLayout=!0},Qg.prototype.findRoots=function(){for(var t=this.network.vertexes,e=t.iterator;e.next();){var i=e.value;switch(this.ud){case Nm:0===i.sourceEdges.count&&this.Ub.add(i);break;case Lm:0===i.destinationEdges.count&&this.Ub.add(i);break;default:w("Unhandled path value "+this.ud.toString())}}0===this.Ub.count&&(null!==(t=em(this,t))&&this.Ub.add(t))},Qg.prototype.removeChild=function(t,e){if(null!==t&&null!==e){for(var i=t.children,n=0,o=0;o<i.length;o++)i[o]===e&&n++;if(0<n){n=Array(i.length-n);for(var r=o=0;r<i.length;r++)i[r]!==e&&(n[o++]=i[r]);t.children=n}}},Qg.prototype.initializeTreeVertexValues=function(t){if(t.copyInheritedPropertiesFrom(function(t,e){switch(t.vo){default:case Xm:return null!==e.parent?e.parent:t.W;case Wm:return null===e.parent?t.W:null===e.parent.parent?t.Y:e.parent;case qm:return null!==e.parent?null!==e.parent.parent?e.parent.parent:t.Y:t.W;case Um:var i=!0;if(0===e.childrenCount)i=!1;else for(var n=e.children,o=n.length,r=0;r<o;r++)if(0<n[r].childrenCount){i=!1;break}return i&&null!==e.parent?t.Y:null!==e.parent?e.parent:t.W}}(this,t)),null!==t.parent&&t.parent.alignment===Rm){for(var e=t.angle,i=t.parent.children,n=0;n<i.length&&t!==i[n];)n++;0==n%2?n!==i.length-1&&(e=90===e?180:180===e?270:270===e?180:270):e=90===e?0:180===e?90:270===e?0:90,t.angle=e}t.initialized=!0},Qg.prototype.assignTreeVertexValues=function(){},Qg.prototype.sortTreeVertexChildren=function(t){switch(t.sorting){case Am:break;case Bm:t.children.reverse();break;case Dm:t.children.sort(t.comparer);break;case Fm:t.children.sort(t.comparer),t.children.reverse();break;default:w("Unhandled sorting value "+t.sorting.toString())}},Qg.prototype.Cu=function(){if(this.comments)for(var t=this.network.vertexes.iterator;t.next();)this.addComments(t.value)},Qg.prototype.addComments=function(t){var e=t.angle,i=t.parent,n=0,o=!1;null!==i&&(n=i.angle,o=am(o=i.alignment)),e=90===e||270===e,n=90===n||270===n,i=0===t.childrenCount;var r=0,s=0,a=0,h=t.commentSpacing;if(null!==t.node)for(var l=t.node.Mu();l.next();){var u=l.value;"Comment"===u.category&&u.canLayout()&&(null===t.comments&&(t.comments=[]),t.comments.push(u),u.Va(),u=u.measuredBounds,e&&!i||!o&&!n&&i||o&&n&&i?(r=Math.max(r,u.width),s+=u.height+Math.abs(a)):(r+=u.width+Math.abs(a),s=Math.max(s,u.height)),a=h)}null!==t.comments&&(e&&!i||!o&&!n&&i||o&&n&&i?(r+=Math.abs(t.commentMargin),s=Math.max(0,s-t.height)):(s+=Math.abs(t.commentMargin),r=Math.max(0,r-t.width)),o=jt.allocAt(0,0,t.bounds.width+r,t.bounds.height+s),t.bounds=o,jt.free(o))},Qg.prototype.layoutComments=function(t){if(null!==t.comments){var e=t.node.measuredBounds,i=t.parent,n=t.angle,o=0,r=!1;null!==i&&(o=i.angle,r=am(r=i.alignment)),n=90===n||270===n,i=90===o||270===o;for(var s=0===t.childrenCount,a=lm(t),h=0,l=t.comments,u=l.length,c=pt.alloc(),d=0;d<u;d++){var f=l[d],p=f.measuredBounds;if(n&&!s||!r&&!i&&s||r&&i&&s){if(135<o&&!r||i&&a)if(0<=t.commentMargin)for(c.h(t.bounds.x-t.commentMargin-p.width,t.bounds.y+h),f.move(c),f=f.Sd();f.next();){var g=f.value;g.fromSpot=Ae,g.toSpot=Be}else for(c.h(t.bounds.x+2*t.focus.x-t.commentMargin,t.bounds.y+h),f.move(c),f=f.Sd();f.next();)(g=f.value).fromSpot=Be,g.toSpot=Ae;else if(0<=t.commentMargin)for(c.h(t.bounds.x+2*t.focus.x+t.commentMargin,t.bounds.y+h),f.move(c),f=f.Sd();f.next();)(g=f.value).fromSpot=Be,g.toSpot=Ae;else for(c.h(t.bounds.x+t.commentMargin-p.width,t.bounds.y+h),f.move(c),f=f.Sd();f.next();)(g=f.value).fromSpot=Ae,g.toSpot=Be;h=0<=t.commentSpacing?h+(p.height+t.commentSpacing):h+(t.commentSpacing-p.height)}else{if(135<o&&!r||!i&&a)if(0<=t.commentMargin)for(c.h(t.bounds.x+h,t.bounds.y-t.commentMargin-p.height),f.move(c),f=f.Sd();f.next();)(g=f.value).fromSpot=Le,g.toSpot=De;else for(c.h(t.bounds.x+h,t.bounds.y+2*t.focus.y-t.commentMargin),f.move(c),f=f.Sd();f.next();)(g=f.value).fromSpot=De,g.toSpot=Le;else if(0<=t.commentMargin)for(c.h(t.bounds.x+h,t.bounds.y+2*t.focus.y+t.commentMargin),f.move(c),f=f.Sd();f.next();)(g=f.value).fromSpot=De,g.toSpot=Le;else for(c.h(t.bounds.x+h,t.bounds.y+t.commentMargin-p.height),f.move(c),f=f.Sd();f.next();)(g=f.value).fromSpot=Le,g.toSpot=De;h=0<=t.commentSpacing?h+(p.width+t.commentSpacing):h+(t.commentSpacing-p.width)}}if(pt.free(c),e=h-t.commentSpacing-(n?e.height:e.width),this.ud===Nm)for(t=t.destinationEdges;t.next();)null===(o=t.value.link)||o.isAvoiding||(o.fromEndSegmentLength=0<e?e:NaN);else for(t=t.sourceEdges;t.next();)null===(o=t.value.link)||o.isAvoiding||(o.toEndSegmentLength=0<e?e:NaN)}},Qg.prototype.layoutTree=function(t){if(null!==t){for(var e=t.children,i=e.length,n=0;n<i;n++)this.layoutTree(e[n]);switch(t.compaction){case Hm:um(this,t);break;case Ym:if(t.alignment===Rm)um(this,t);else if(0===t.childrenCount)i=!1,e=0,null!==(n=t.parent)&&(e=n.angle,i=am(i=n.alignment)),n=lm(t),t.S.h(0,0),t.Da.h(t.width,t.height),null===t.parent||null===t.comments||(180!==e&&270!==e||i)&&!n?t.la.h(0,0):180===e&&!i||(90===e||270===e)&&n?t.la.h(t.width-2*t.focus.x,0):t.la.h(0,t.height-2*t.focus.y),t.Yo=null,t.kp=null;else{var o=Pm(t);e=90===o||270===o;var r=0,s=t.children,a=s.length;for(i=0;i<a;i++)n=s[i],r=Math.max(r,e?n.Da.width:n.Da.height);var h=t.alignment;n=h===Om;var l=h===Im,u=am(h),c=Math.max(0,t.breadthLimit);i=this.computeLayerSpacing(t);var d=t.nodeSpacing,f=this.computeNodeIndent(t),p=t.rowSpacing,g=0;(n||l||t.hm||t.im&&1===t.maxGenerationCount)&&(g=Math.max(0,t.rowIndent)),n=t.width;var m=t.height,y=0,v=0,x=0,b=null,k=null,S=0,M=0,C=0,P=0,T=0,N=0,L=0,D=0;if(u&&!hm(h)&&135<o&&s.reverse(),hm(h))if(1<a)for(var F=0;F<a;F++)0==F%2&&F!==a-1&&(D=Math.max(D,e?s[F].Da.width:s[F].Da.height));else 1===a&&(D=e?s[0].Da.width:s[0].Da.height);if(u){switch(h){case zm:D=(v=135>o?cm(this,t,s,D,y,v):dm(this,t,s,D,y,v)).x,y=v.width,v=v.height;break;case Vm:for(b=0;b<a;b++)c=(k=s[b]).Da,x=0===N?0:p,e?(k.S.h(r-c.width,P+x),y=Math.max(y,c.width),v=Math.max(v,P+x+c.height),P+=x+c.height):(k.S.h(C+x,r-c.height),y=Math.max(y,C+x+c.width),v=Math.max(v,c.height),C+=x+c.width),N++;break;case Gm:for(b=0;b<a;b++)r=(k=s[b]).Da,c=0===N?0:p,e?(k.S.h(d/2+t.focus.x,P+c),y=Math.max(y,r.width),v=Math.max(v,P+c+r.height),P+=c+r.height):(k.S.h(C+c,d/2+t.focus.y),y=Math.max(y,C+c+r.width),v=Math.max(v,r.height),C+=c+r.width),N++}b=km(this,2),k=km(this,2),e?(b[0].h(0,0),b[1].h(0,v),k[0].h(y,0)):(b[0].h(0,0),b[1].h(y,0),k[0].h(0,v)),k[1].h(y,v)}else for(F=0;F<a;F++){var j=s[F],E=j.Da;if(e){0<c&&0<N&&C+d+E.width>c&&(C<r&&ym(t,h,r-C,0,L,F-1),T++,N=0,L=F,x=v,C=0,P=135<o?-v-p:v+p),xm(this,j,0,P);var O=0;if(0===N)b=j.Yo,k=j.kp,S=E.width,M=E.height,(null===b||null===k||o!==Pm(j))&&(b=km(this,2),k=km(this,2),b[0].h(0,0),b[1].h(0,M),k[0].h(S,0),k[1].h(S,M));else{var I=A();O=(M=wm(this,t,j,b,k,S,M,I)).x,b=I[0],k=I[1],S=M.width,M=M.height,B(I),C<E.width&&0>O&&(vm(t,-O,0,L,F-1),bm(b,-O,0),bm(k,-O,0),O=0)}j.S.h(O,P),y=Math.max(y,S),v=Math.max(v,x+(0===T?0:p)+E.height),C=S}else 0<c&&0<N&&P+d+E.height>c&&(P<r&&ym(t,h,0,r-P,L,F-1),T++,N=0,L=F,x=y,P=0,C=135<o?-y-p:y+p),xm(this,j,C,0),O=0,0===N?(b=j.Yo,k=j.kp,S=E.width,M=E.height,(null===b||null===k||o!==Pm(j))&&(b=km(this,2),k=km(this,2),b[0].h(0,0),b[1].h(S,0),k[0].h(0,M),k[1].h(S,M))):(O=(M=wm(this,t,j,b,k,S,M,I=A())).x,b=I[0],k=I[1],S=M.width,M=M.height,B(I),P<E.height&&0>O&&(vm(t,0,-O,L,F-1),bm(b,0,-O),bm(k,0,-O),O=0)),j.S.h(C,O),v=Math.max(v,M),y=Math.max(y,x+(0===T?0:p)+E.width),P=M;N++}switch(0<T&&(e?(v+=Math.max(0,i),C<y&&ym(t,h,y-C,0,L,a-1),0<g&&(l||vm(t,g,0,0,a-1),y+=g)):(y+=Math.max(0,i),P<v&&ym(t,h,0,v-P,L,a-1),0<g&&(l||vm(t,0,g,0,a-1),v+=g))),g=l=0,h){case jm:e?l+=y/2-t.focus.x-f/2:g+=v/2-t.focus.y-f/2;break;case Em:0<T?e?l+=y/2-t.focus.x-f/2:g+=v/2-t.focus.y-f/2:e?l+=(D=s[0].S.x+s[0].la.x)+(s[a-1].S.x+s[a-1].la.x+2*s[a-1].focus.x-D)/2-t.focus.x-f/2:g+=(D=s[0].S.y+s[0].la.y)+(s[a-1].S.y+s[a-1].la.y+2*s[a-1].focus.y-D)/2-t.focus.y-f/2;break;case Om:e?(l-=f,y+=f):(g-=f,v+=f);break;case Im:e?(l+=y-t.width+f,y+=f):(g+=v-t.height+f,v+=f);break;case zm:e?l+=1<a?D+d/2-t.focus.x:s[0].focus.x-t.focus.x+s[0].la.x:g+=1<a?D+d/2-t.focus.y:s[0].focus.y-t.focus.y+s[0].la.y;break;case Vm:e?l+=y+d/2-t.focus.x:g+=v+d/2-t.focus.y;break;case Gm:break;default:l=(v=this.customAlignment(t,l,g,y,v))[0],g=v[1],y=v[2],v=v[3]}for(f=0;f<a;f++)D=s[f],e?D.S.h(D.S.x+D.la.x-l,D.S.y+(135<o?(u?-v:-D.Da.height)+D.la.y-i:m+i+D.la.y)):D.S.h(D.S.x+(135<o?(u?-y:-D.Da.width)+D.la.x-i:n+i+D.la.x),D.S.y+D.la.y-g);if(a=s=0,u?e?(y=pm(t,y,l),0>l&&(l=0),135<o&&(g+=v+i),v+=m+i,h===Gm&&(s+=d/2+t.focus.x),a+=m+i):(135<o&&(l+=y+i),y+=n+i,v=gm(t,v,g),0>g&&(g=0),h===Gm&&(a+=d/2+t.focus.y),s+=n+i):e?(null===t.comments?n>y&&(s=(y=mm(h,n-y,0)).x,a=y.y,y=n,l=0):y=pm(t,y,l),0>l&&(s-=l,l=0),135<o&&(g+=v+i),v=Math.max(Math.max(v,m),v+m+i),a+=m+i):(135<o&&(l+=y+i),y=Math.max(Math.max(y,n),y+n+i),null===t.comments?m>v&&(s=(v=mm(h,0,m-v)).x,a=v.y,v=m,g=0):v=gm(t,v,g),0>g&&(a-=g,g=0),s+=n+i),0<T)o=km(this,4),T=km(this,4),e?(o[2].h(0,m+i),o[3].h(o[2].x,v),T[2].h(y,o[2].y),T[3].h(T[2].x,o[3].y)):(o[2].h(n+i,0),o[3].h(y,o[2].y),T[2].h(o[2].x,v),T[3].h(o[3].x,T[2].y));else{for(o=km(this,b.length+2),T=km(this,k.length+2),h=0;h<b.length;h++)u=b[h],o[h+2].h(u.x+s,u.y+a);for(h=0;h<k.length;h++)u=k[h],T[h+2].h(u.x+s,u.y+a)}e?(o[0].h(l,0),o[1].h(o[0].x,m),o[2].y<o[1].y&&(o[2].x>o[0].x?o[2].assign(o[1]):o[1].assign(o[2])),o[3].y<o[2].y&&(o[3].x>o[0].x?o[3].assign(o[2]):o[2].assign(o[3])),T[0].h(l+n,0),T[1].h(T[0].x,m),T[2].y<T[1].y&&(T[2].x<T[0].x?T[2].assign(T[1]):T[1].assign(T[2])),T[3].y<T[2].y&&(T[3].x<T[0].x?T[3].assign(T[2]):T[2].assign(T[3])),o[2].y-=i/2,T[2].y-=i/2):(o[0].h(0,g),o[1].h(n,o[0].y),o[2].x<o[1].x&&(o[2].y>o[0].y?o[2].assign(o[1]):o[1].assign(o[2])),o[3].x<o[2].x&&(o[3].y>o[0].y?o[3].assign(o[2]):o[2].assign(o[3])),T[0].h(0,g+m),T[1].h(n,T[0].y),T[2].x<T[1].x&&(T[2].y<T[0].y?T[2].assign(T[1]):T[1].assign(T[2])),T[3].x<T[2].x&&(T[3].y<T[0].y?T[3].assign(T[2]):T[2].assign(T[3])),o[2].x-=i/2,T[2].x-=i/2),Sm(this,b),Sm(this,k),t.Yo=o,t.kp=T,t.la.h(l,g),t.Da.h(y,v)}break;default:w("Unhandled compaction value "+t.compaction.toString())}}},Qg.prototype.customAlignment=function(t,e,i,n,o){return[e,i,n,o]},Qg.prototype.computeBusNodeSpacing=function(t){return null===t.parent?0:t.parent.nodeSpacing},Qg.prototype.computeBusLastRowSpacing=function(t){return null===t.parent?0:t.parent.rowSpacing},Qg.prototype.arrangeTrees=function(){if(this.Rb===$m)for(var t=this.Ub.iterator;t.next();){var e=t.value;if(e instanceof ey){var i=e.node;if(null!==i){var n=i.position;i=n.x,n=n.y,isFinite(i)||(i=0),isFinite(n)||(n=0),Mm(this,e,i,n)}}}else{for(t=[],e=this.Ub.iterator;e.next();)(i=e.value)instanceof ey&&t.push(i);switch(this.sorting){case Am:break;case Bm:t.reverse();break;case Dm:t.sort(this.comparer);break;case Fm:t.sort(this.comparer),t.reverse();break;default:w("Unhandled sorting value "+this.sorting.toString())}for(e=(i=this.arrangementOrigin).x,i=i.y,n=0;n<t.length;n++){var o=t[n];switch(Mm(this,o,e+o.la.x,i+o.la.y),this.Rb){case Km:i+=o.Da.height+this.$d.height;break;case _m:e+=o.Da.width+this.$d.width;break;default:w("Unhandled arrangement value "+this.Rb.toString())}}}},Qg.prototype.commitLayout=function(){this.yv(),this.commitNodes(),this.Gu(),this.isRouting&&this.commitLinks()},Qg.prototype.commitNodes=function(){for(var t=this.network.vertexes.iterator;t.next();)t.value.commit();for(t.reset();t.next();)this.layoutComments(t.value)},Qg.prototype.Gu=function(){if(this.layerStyle===Qm){for(var t=this.$v,e=[],i=null,n=this.network.vertexes.iterator;n.next();){var o=n.value;null===i?i=o.bounds.copy():i.ed(o.bounds);var r=e[o.level];r=void 0===r?this.computeLayerSpacing(o):Math.max(r,this.computeLayerSpacing(o)),e[o.level]=r}for(n=0;n<e.length;n++)void 0===e[n]&&(e[n]=0);if(90===this.angle||270===this.angle?(i.Bc(this.nodeSpacing/2,this.layerSpacing),n=new pt(-this.nodeSpacing/2,-this.layerSpacing/2)):(i.Bc(this.layerSpacing,this.nodeSpacing/2),n=new pt(-this.layerSpacing/2,-this.nodeSpacing/2)),o=[],i=90===this.angle||270===this.angle?i.width:i.height,r=0,180===this.angle||270===this.angle)for(var s=0;s<t.length;s++)r+=t[s]+e[s];for(s=0;s<t.length;s++){var a=t[s]+e[s];270===this.angle?(r-=a,o.push(new jt(0,r,i,a))):90===this.angle?(o.push(new jt(0,r,i,a)),r+=a):180===this.angle?(r-=a,o.push(new jt(r,0,a,i))):(o.push(new jt(r,0,a,i)),r+=a)}this.commitLayers(o,n)}},Qg.prototype.commitLayers=function(){},Qg.prototype.commitLinks=function(){for(var t=this.network.edges.iterator;t.next();)t.value.commit()},Qg.prototype.yv=function(){for(var t=this.Ub.iterator;t.next();){var e=t.value;e instanceof ey&&Cm(this,e)}},Qg.prototype.setPortSpots=function(t){var e=t.alignment;if(am(e)){var i=this.ud===Nm,n=Pm(t);switch(n){case 0:var o=Be;break;case 90:o=De;break;case 180:o=Ae;break;default:o=Le}var r=t.children,s=r.length;switch(e){case zm:case Rm:for(e=0;e<s;e++){var a=r[e];if(null!==(a=(i?a.sourceEdges:a.destinationEdges).first())&&null!==(a=a.link)){var h=90===n||270===n?Ae:Le;if(1===s||e===s-1&&1==s%2)switch(n){case 0:h=Ae;break;case 90:h=Le;break;case 180:h=Be;break;default:h=De}else 0==e%2&&(h=90===n||270===n?Be:De);i?(t.setsPortSpot&&(a.fromSpot=o),t.setsChildPortSpot&&(a.toSpot=h)):(t.setsPortSpot&&(a.fromSpot=h),t.setsChildPortSpot&&(a.toSpot=o))}}break;case Vm:for(n=90===n||270===n?Be:De,r=i?t.destinationEdges:t.sourceEdges;r.next();)null!==(s=r.value.link)&&(i?(t.setsPortSpot&&(s.fromSpot=o),t.setsChildPortSpot&&(s.toSpot=n)):(t.setsPortSpot&&(s.fromSpot=n),t.setsChildPortSpot&&(s.toSpot=o)));break;case Gm:for(n=90===n||270===n?Ae:Le,r=i?t.destinationEdges:t.sourceEdges;r.next();)null!==(s=r.value.link)&&(i?(t.setsPortSpot&&(s.fromSpot=o),t.setsChildPortSpot&&(s.toSpot=n)):(t.setsPortSpot&&(s.fromSpot=n),t.setsChildPortSpot&&(s.toSpot=o)))}}else if(i=Pm(t),this.ud===Nm){for(o=t.destinationEdges;o.next();)if(null!==(n=o.value.link)){if(t.setsPortSpot)if(t.portSpot.Xb())switch(i){case 0:n.fromSpot=Be;break;case 90:n.fromSpot=De;break;case 180:n.fromSpot=Ae;break;default:n.fromSpot=Le}else n.fromSpot=t.portSpot;if(t.setsChildPortSpot)if(t.childPortSpot.Xb())switch(i){case 0:n.toSpot=Ae;break;case 90:n.toSpot=Le;break;case 180:n.toSpot=Be;break;default:n.toSpot=De}else n.toSpot=t.childPortSpot}}else for(o=t.sourceEdges;o.next();)if(null!==(n=o.value.link)){if(t.setsPortSpot)if(t.portSpot.Xb())switch(i){case 0:n.toSpot=Be;break;case 90:n.toSpot=De;break;case 180:n.toSpot=Ae;break;default:n.toSpot=Le}else n.toSpot=t.portSpot;if(t.setsChildPortSpot)if(t.childPortSpot.Xb())switch(i){case 0:n.fromSpot=Ae;break;case 90:n.fromSpot=Le;break;case 180:n.fromSpot=Be;break;default:n.fromSpot=De}else n.fromSpot=t.childPortSpot}},Qg.prototype.computeLayerSpacing=function(t){var e=Pm(t);e=90===e||270===e;var i=t.layerSpacing;if(0<t.layerSpacingParentOverlap){var n=Math.min(1,t.layerSpacingParentOverlap);i-=e?t.height*n:t.width*n}return i<(e?-t.height:-t.width)&&(i=e?-t.height:-t.width),i},Qg.prototype.computeNodeIndent=function(t){var e=Pm(t),i=t.nodeIndent;if(0<t.nodeIndentPastParent){var n=Math.min(1,t.nodeIndentPastParent);i+=90===e||270===e?t.width*n:t.height*n}return Math.max(0,i)},d.Object.defineProperties(Qg.prototype,{roots:{get:function(){return this.Ub},set:function(t){this.Ub!==t&&(this.Ub=t,this.C())}},path:{get:function(){return this.Wn},set:function(t){this.Wn!==t&&(this.Wn=t,this.C())}},treeStyle:{get:function(){return this.vo},set:function(t){this.Rb===t||t!==Xm&&t!==qm&&t!==Um&&t!==Wm||(this.vo=t,this.C())}},layerStyle:{get:function(){return this.Bq},set:function(t){this.Rb===t||t!==Jm&&t!==Zm&&t!==Qm||(this.Bq=t,this.C())}},comments:{get:function(){return this.td},set:function(t){this.td!==t&&(this.td=t,this.C())}},arrangement:{get:function(){return this.Rb},set:function(t){this.Rb===t||t!==Km&&t!==_m&&t!==$m||(this.Rb=t,this.C())}},arrangementSpacing:{get:function(){return this.$d},set:function(t){this.$d.D(t)||(this.$d.assign(t),this.C())}},rootDefaults:{get:function(){return this.W},set:function(t){this.W!==t&&(this.W=t,this.C())}},alternateDefaults:{get:function(){return this.Y},set:function(t){this.Y!==t&&(this.Y=t,this.C())}},sorting:{get:function(){return this.W.sorting},set:function(t){this.W.sorting===t||t!==Am&&t!==Bm&&t!==Dm&&!Fm||(this.W.sorting=t,this.C())}},comparer:{get:function(){return this.W.comparer},set:function(t){this.W.comparer!==t&&(this.W.comparer=t,this.C())}},angle:{get:function(){return this.W.angle},set:function(t){this.W.angle!==t&&(0===t||90===t||180===t||270===t?(this.W.angle=t,this.C()):w("TreeLayout.angle must be 0, 90, 180, or 270"))}},alignment:{get:function(){return this.W.alignment},set:function(t){this.W.alignment!==t&&(this.W.alignment=t,this.C())}},nodeIndent:{get:function(){return this.W.nodeIndent},set:function(t){this.W.nodeIndent!==t&&0<=t&&(this.W.nodeIndent=t,this.C())}},nodeIndentPastParent:{get:function(){return this.W.nodeIndentPastParent},set:function(t){this.W.nodeIndentPastParent!==t&&0<=t&&1>=t&&(this.W.nodeIndentPastParent=t,this.C())}},nodeSpacing:{get:function(){return this.W.nodeSpacing},set:function(t){this.W.nodeSpacing!==t&&(this.W.nodeSpacing=t,this.C())}},layerSpacing:{get:function(){return this.W.layerSpacing},set:function(t){this.W.layerSpacing!==t&&(this.W.layerSpacing=t,this.C())}},layerSpacingParentOverlap:{get:function(){return this.W.layerSpacingParentOverlap},set:function(t){this.W.layerSpacingParentOverlap!==t&&0<=t&&1>=t&&(this.W.layerSpacingParentOverlap=t,this.C())}},compaction:{get:function(){return this.W.compaction},set:function(t){this.W.compaction===t||t!==Hm&&t!==Ym||(this.W.compaction=t,this.C())}},breadthLimit:{get:function(){return this.W.breadthLimit},set:function(t){this.W.breadthLimit!==t&&0<=t&&(this.W.breadthLimit=t,this.C())}},rowSpacing:{get:function(){return this.W.rowSpacing},set:function(t){this.W.rowSpacing!==t&&(this.W.rowSpacing=t,this.C())}},rowIndent:{get:function(){return this.W.rowIndent},set:function(t){this.W.rowIndent!==t&&0<=t&&(this.W.rowIndent=t,this.C())}},commentSpacing:{get:function(){return this.W.commentSpacing},set:function(t){this.W.commentSpacing!==t&&(this.W.commentSpacing=t,this.C())}},commentMargin:{get:function(){return this.W.commentMargin},set:function(t){this.W.commentMargin!==t&&(this.W.commentMargin=t,this.C())}},setsPortSpot:{get:function(){return this.W.setsPortSpot},set:function(t){this.W.setsPortSpot!==t&&(this.W.setsPortSpot=t,this.C())}},portSpot:{get:function(){return this.W.portSpot},set:function(t){this.W.portSpot.D(t)||(this.W.portSpot=t,this.C())}},setsChildPortSpot:{get:function(){return this.W.setsChildPortSpot},set:function(t){this.W.setsChildPortSpot!==t&&(this.W.setsChildPortSpot=t,this.C())}},childPortSpot:{get:function(){return this.W.childPortSpot},set:function(t){this.W.childPortSpot.D(t)||(this.W.childPortSpot=t,this.C())}},alternateSorting:{get:function(){return this.Y.sorting},set:function(t){this.Y.sorting===t||t!==Am&&t!==Bm&&t!==Dm&&!Fm||(this.Y.sorting=t,this.C())}},alternateComparer:{get:function(){return this.Y.comparer},set:function(t){this.Y.comparer!==t&&(this.Y.comparer=t,this.C())}},alternateAngle:{get:function(){return this.Y.angle},set:function(t){this.Y.angle===t||0!==t&&90!==t&&180!==t&&270!==t||(this.Y.angle=t,this.C())}},alternateAlignment:{get:function(){return this.Y.alignment},set:function(t){this.Y.alignment!==t&&(this.Y.alignment=t,this.C())}},alternateNodeIndent:{get:function(){return this.Y.nodeIndent},set:function(t){this.Y.nodeIndent!==t&&0<=t&&(this.Y.nodeIndent=t,this.C())}},alternateNodeIndentPastParent:{get:function(){return this.Y.nodeIndentPastParent},set:function(t){this.Y.nodeIndentPastParent!==t&&0<=t&&1>=t&&(this.Y.nodeIndentPastParent=t,this.C())}},alternateNodeSpacing:{get:function(){return this.Y.nodeSpacing},set:function(t){this.Y.nodeSpacing!==t&&(this.Y.nodeSpacing=t,this.C())}},alternateLayerSpacing:{get:function(){return this.Y.layerSpacing},set:function(t){this.Y.layerSpacing!==t&&(this.Y.layerSpacing=t,this.C())}},alternateLayerSpacingParentOverlap:{get:function(){return this.Y.layerSpacingParentOverlap},set:function(t){this.Y.layerSpacingParentOverlap!==t&&0<=t&&1>=t&&(this.Y.layerSpacingParentOverlap=t,this.C())}},alternateCompaction:{get:function(){return this.Y.compaction},set:function(t){this.Y.compaction===t||t!==Hm&&t!==Ym||(this.Y.compaction=t,this.C())}},alternateBreadthLimit:{get:function(){return this.Y.breadthLimit},set:function(t){this.Y.breadthLimit!==t&&0<=t&&(this.Y.breadthLimit=t,this.C())}},alternateRowSpacing:{get:function(){return this.Y.rowSpacing},set:function(t){this.Y.rowSpacing!==t&&(this.Y.rowSpacing=t,this.C())}},alternateRowIndent:{get:function(){return this.Y.rowIndent},set:function(t){this.Y.rowIndent!==t&&0<=t&&(this.Y.rowIndent=t,this.C())}},alternateCommentSpacing:{get:function(){return this.Y.commentSpacing},set:function(t){this.Y.commentSpacing!==t&&(this.Y.commentSpacing=t,this.C())}},alternateCommentMargin:{get:function(){return this.Y.commentMargin},set:function(t){this.Y.commentMargin!==t&&(this.Y.commentMargin=t,this.C())}},alternateSetsPortSpot:{get:function(){return this.Y.setsPortSpot},set:function(t){this.Y.setsPortSpot!==t&&(this.Y.setsPortSpot=t,this.C())}},alternatePortSpot:{get:function(){return this.Y.portSpot},set:function(t){this.Y.portSpot.D(t)||(this.Y.portSpot=t,this.C())}},alternateSetsChildPortSpot:{get:function(){return this.Y.setsChildPortSpot},set:function(t){this.Y.setsChildPortSpot!==t&&(this.Y.setsChildPortSpot=t,this.C())}},alternateChildPortSpot:{get:function(){return this.Y.childPortSpot},set:function(t){this.Y.childPortSpot.D(t)||(this.Y.childPortSpot=t,this.C())}}});var Tm=new V(Qg,"PathDefault",-1),Nm=new V(Qg,"PathDestination",0),Lm=new V(Qg,"PathSource",1),Am=new V(Qg,"SortingForwards",10),Bm=new V(Qg,"SortingReverse",11),Dm=new V(Qg,"SortingAscending",12),Fm=new V(Qg,"SortingDescending",13),jm=new V(Qg,"AlignmentCenterSubtrees",20),Em=new V(Qg,"AlignmentCenterChildren",21),Om=new V(Qg,"AlignmentStart",22),Im=new V(Qg,"AlignmentEnd",23),zm=new V(Qg,"AlignmentBus",24),Rm=new V(Qg,"AlignmentBusBranching",25),Vm=new V(Qg,"AlignmentTopLeftBus",26),Gm=new V(Qg,"AlignmentBottomRightBus",27),Hm=new V(Qg,"CompactionNone",30),Ym=new V(Qg,"CompactionBlock",31),Xm=new V(Qg,"StyleLayered",40),Um=new V(Qg,"StyleLastParents",41),qm=new V(Qg,"StyleAlternating",42),Wm=new V(Qg,"StyleRootOnly",43),Km=new V(Qg,"ArrangementVertical",50),_m=new V(Qg,"ArrangementHorizontal",51),$m=new V(Qg,"ArrangementFixedRoots",52),Jm=new V(Qg,"LayerIndividual",60),Zm=new V(Qg,"LayerSiblings",61),Qm=new V(Qg,"LayerUniform",62);function ty(t){jd.call(this,t)}function ey(t){Rd.call(this,t),this.V=!1,this.hb=null,this.u=[],this.nb=this.Ha=this.F=this.ia=0,this.td=null,this.S=new pt(0,0),this.Da=new At(0,0),this.la=new pt(0,0),this.im=this.hm=this.qA=!1,this.kp=this.Yo=null,this.nd=Am,this.hd=Vd,this.Kb=0,this.Jb=Em,this.Vq=this.Uq=0,this.Wq=20,this.ie=50,this.Aq=0,this.Hp=Ym,this.Ap=0,this.nr=25,this.Gp=this.mr=10,this.Fp=20,this.xr=!0,this.dr=Me,this.wr=!0,this.Dp=Me}function iy(t){Gd.call(this,t),this.$t=new pt(0,0)}Qg.className="TreeLayout",Qg.PathDefault=Tm,Qg.PathDestination=Nm,Qg.PathSource=Lm,Qg.SortingForwards=Am,Qg.SortingReverse=Bm,Qg.SortingAscending=Dm,Qg.SortingDescending=Fm,Qg.AlignmentCenterSubtrees=jm,Qg.AlignmentCenterChildren=Em,Qg.AlignmentStart=Om,Qg.AlignmentEnd=Im,Qg.AlignmentBus=zm,Qg.AlignmentBusBranching=Rm,Qg.AlignmentTopLeftBus=Vm,Qg.AlignmentBottomRightBus=Gm,Qg.CompactionNone=Hm,Qg.CompactionBlock=Ym,Qg.StyleLayered=Xm,Qg.StyleLastParents=Um,Qg.StyleAlternating=qm,Qg.StyleRootOnly=Wm,Qg.ArrangementVertical=Km,Qg.ArrangementHorizontal=_m,Qg.ArrangementFixedRoots=$m,Qg.LayerIndividual=Jm,Qg.LayerSiblings=Zm,Qg.LayerUniform=Qm,c(ty,jd),ty.prototype.createVertex=function(){return new ey(this)},ty.prototype.createEdge=function(){return new iy(this)},ty.className="TreeNetwork",c(ey,Rd),ey.prototype.copyInheritedPropertiesFrom=function(t){null!==t&&(this.nd=t.sorting,this.hd=t.comparer,this.Kb=t.angle,this.Jb=t.alignment,this.Uq=t.nodeIndent,this.Vq=t.nodeIndentPastParent,this.Wq=t.nodeSpacing,this.ie=t.layerSpacing,this.Aq=t.layerSpacingParentOverlap,this.Hp=t.compaction,this.Ap=t.breadthLimit,this.nr=t.rowSpacing,this.mr=t.rowIndent,this.Gp=t.commentSpacing,this.Fp=t.commentMargin,this.xr=t.setsPortSpot,this.dr=t.portSpot,this.wr=t.setsChildPortSpot,this.Dp=t.childPortSpot)},d.Object.defineProperties(ey.prototype,{initialized:{get:function(){return this.V},set:function(t){this.V!==t&&(this.V=t)}},parent:{get:function(){return this.hb},set:function(t){this.hb!==t&&(this.hb=t)}},children:{get:function(){return this.u},set:function(t){if(this.u!==t){if(null!==t)for(var e=t.length,i=0;i<e;i++);this.u=t}}},level:{get:function(){return this.ia},set:function(t){this.ia!==t&&(this.ia=t)}},descendantCount:{get:function(){return this.F},set:function(t){this.F!==t&&(this.F=t)}},maxChildrenCount:{get:function(){return this.Ha},set:function(t){this.Ha!==t&&(this.Ha=t)}},maxGenerationCount:{get:function(){return this.nb},set:function(t){this.nb!==t&&(this.nb=t)}},comments:{get:function(){return this.td},set:function(t){if(this.td!==t){if(null!==t)for(var e=t.length,i=0;i<e;i++);this.td=t}}},sorting:{get:function(){return this.nd},set:function(t){this.nd!==t&&(this.nd=t)}},comparer:{get:function(){return this.hd},set:function(t){this.hd!==t&&(this.hd=t)}},angle:{get:function(){return this.Kb},set:function(t){this.Kb!==t&&(this.Kb=t)}},alignment:{get:function(){return this.Jb},set:function(t){this.Jb!==t&&(this.Jb=t)}},nodeIndent:{get:function(){return this.Uq},set:function(t){this.Uq!==t&&(this.Uq=t)}},nodeIndentPastParent:{get:function(){return this.Vq},set:function(t){this.Vq!==t&&(this.Vq=t)}},nodeSpacing:{get:function(){return this.Wq},set:function(t){this.Wq!==t&&(this.Wq=t)}},layerSpacing:{get:function(){return this.ie},set:function(t){this.ie!==t&&(this.ie=t)}},layerSpacingParentOverlap:{get:function(){return this.Aq},set:function(t){this.Aq!==t&&(this.Aq=t)}},compaction:{get:function(){return this.Hp},set:function(t){this.Hp!==t&&(this.Hp=t)}},breadthLimit:{get:function(){return this.Ap},set:function(t){this.Ap!==t&&(this.Ap=t)}},rowSpacing:{get:function(){return this.nr},set:function(t){this.nr!==t&&(this.nr=t)}},rowIndent:{get:function(){return this.mr},set:function(t){this.mr!==t&&(this.mr=t)}},commentSpacing:{get:function(){return this.Gp},set:function(t){this.Gp!==t&&(this.Gp=t)}},commentMargin:{get:function(){return this.Fp},set:function(t){this.Fp!==t&&(this.Fp=t)}},setsPortSpot:{get:function(){return this.xr},set:function(t){this.xr!==t&&(this.xr=t)}},portSpot:{get:function(){return this.dr},set:function(t){this.dr.D(t)||(this.dr=t)}},setsChildPortSpot:{get:function(){return this.wr},set:function(t){this.wr!==t&&(this.wr=t)}},childPortSpot:{get:function(){return this.Dp},set:function(t){this.Dp.D(t)||(this.Dp=t)}},childrenCount:{get:function(){return this.children.length}},relativePosition:{get:function(){return this.S},set:function(t){this.S.set(t)}},subtreeSize:{get:function(){return this.Da},set:function(t){this.Da.set(t)}},subtreeOffset:{get:function(){return this.la},set:function(t){this.la.set(t)}}}),ey.className="TreeVertex",c(iy,Gd),iy.prototype.commit=function(){var t=this.link;if(null!==t&&!t.isAvoiding){var e=this.network.layout,i=null,n=null;switch(e.ud){case Nm:i=this.fromVertex,n=this.toVertex;break;case Lm:i=this.toVertex,n=this.fromVertex;break;default:w("Unhandled path value "+e.ud.toString())}if(null!==i&&null!==n){var o=this.$t;if(0!==o.x||0!==o.y||i.qA){n=i.bounds;var r=Pm(i),s=e.computeLayerSpacing(i),a=i.rowSpacing;t.vg();var h,l=t.curve===_c,u=t.isOrthogonal;if(t.uh(),u||l){for(h=2;4<t.pointsCount;)t.pv(2);var c=t.i(1),d=t.i(2)}else{for(h=1;3<t.pointsCount;)t.pv(1);c=t.i(0),d=t.i(t.pointsCount-1)}var f=t.i(t.pointsCount-1);0===r?(i.alignment===Im?(r=n.bottom+o.y,0===o.y&&c.y>f.y+i.rowIndent&&(r=Math.min(r,Math.max(c.y,r-e.computeNodeIndent(i))))):i.alignment===Om?(r=n.top+o.y,0===o.y&&c.y<f.y-i.rowIndent&&(r=Math.max(r,Math.min(c.y,r+e.computeNodeIndent(i))))):r=i.hm||i.im&&1===i.maxGenerationCount?n.top-i.la.y+o.y:n.y+n.height/2+o.y,l?(t.m(h,c.x,r),h++,t.m(h,n.right+s,r),h++,t.m(h,n.right+s+(o.x-a)/3,r),h++,t.m(h,n.right+s+2*(o.x-a)/3,r),h++,t.m(h,n.right+s+(o.x-a),r),h++,t.m(h,d.x,r)):(u&&(t.m(h,n.right+s/2,c.y),h++),t.m(h,n.right+s/2,r),h++,t.m(h,n.right+s+o.x-(u?a/2:a),r),h++,u&&t.m(h,t.i(h-1).x,d.y))):90===r?(i.alignment===Im?(r=n.right+o.x,0===o.x&&c.x>f.x+i.rowIndent&&(r=Math.min(r,Math.max(c.x,r-e.computeNodeIndent(i))))):i.alignment===Om?(r=n.left+o.x,0===o.x&&c.x<f.x-i.rowIndent&&(r=Math.max(r,Math.min(c.x,r+e.computeNodeIndent(i))))):r=i.hm||i.im&&1===i.maxGenerationCount?n.left-i.la.x+o.x:n.x+n.width/2+o.x,l?(t.m(h,r,c.y),h++,t.m(h,r,n.bottom+s),h++,t.m(h,r,n.bottom+s+(o.y-a)/3),h++,t.m(h,r,n.bottom+s+2*(o.y-a)/3),h++,t.m(h,r,n.bottom+s+(o.y-a)),h++,t.m(h,r,d.y)):(u&&(t.m(h,c.x,n.bottom+s/2),h++),t.m(h,r,n.bottom+s/2),h++,t.m(h,r,n.bottom+s+o.y-(u?a/2:a)),h++,u&&t.m(h,d.x,t.i(h-1).y))):180===r?(i.alignment===Im?(r=n.bottom+o.y,0===o.y&&c.y>f.y+i.rowIndent&&(r=Math.min(r,Math.max(c.y,r-e.computeNodeIndent(i))))):i.alignment===Om?(r=n.top+o.y,0===o.y&&c.y<f.y-i.rowIndent&&(r=Math.max(r,Math.min(c.y,r+e.computeNodeIndent(i))))):r=i.hm||i.im&&1===i.maxGenerationCount?n.top-i.la.y+o.y:n.y+n.height/2+o.y,l?(t.m(h,c.x,r),h++,t.m(h,n.left-s,r),h++,t.m(h,n.left-s+(o.x+a)/3,r),h++,t.m(h,n.left-s+2*(o.x+a)/3,r),h++,t.m(h,n.left-s+(o.x+a),r),h++,t.m(h,d.x,r)):(u&&(t.m(h,n.left-s/2,c.y),h++),t.m(h,n.left-s/2,r),h++,t.m(h,n.left-s+o.x+(u?a/2:a),r),h++,u&&t.m(h,t.i(h-1).x,d.y))):270===r?(i.alignment===Im?(r=n.right+o.x,0===o.x&&c.x>f.x+i.rowIndent&&(r=Math.min(r,Math.max(c.x,r-e.computeNodeIndent(i))))):i.alignment===Om?(r=n.left+o.x,0===o.x&&c.x<f.x-i.rowIndent&&(r=Math.max(r,Math.min(c.x,r+e.computeNodeIndent(i))))):r=i.hm||i.im&&1===i.maxGenerationCount?n.left-i.la.x+o.x:n.x+n.width/2+o.x,l?(t.m(h,r,c.y),h++,t.m(h,r,n.top-s),h++,t.m(h,r,n.top-s+(o.y+a)/3),h++,t.m(h,r,n.top-s+2*(o.y+a)/3),h++,t.m(h,r,n.top-s+(o.y+a)),h++,t.m(h,r,d.y)):(u&&(t.m(h,c.x,n.top-s/2),h++),t.m(h,r,n.top-s/2),h++,t.m(h,r,n.top-s+o.y+(u?a/2:a)),h++,u&&t.m(h,d.x,t.i(h-1).y))):w("Invalid angle "+r),t.zf()}else o=n,t=this.link,n=this.network.layout,(e=Pm(i))!==Pm(o)&&(s=n.computeLayerSpacing(i),a=i.bounds,i=o.bounds,0===e&&i.left-a.right<s+1||90===e&&i.top-a.bottom<s+1||180===e&&a.left-i.right<s+1||270===e&&a.top-i.bottom<s+1||(t.vg(),i=t.curve===_c,o=t.isOrthogonal,n=am(this.fromVertex.alignment),t.uh(),0===e?(e=a.right+s/2,i?4===t.pointsCount&&(i=t.i(3).y,t.L(1,e-20,t.i(1).y),t.m(2,e-20,i),t.m(3,e,i),t.m(4,e+20,i),t.L(5,t.i(5).x,i)):o?n?t.L(3,t.i(2).x,t.i(4).y):6===t.pointsCount&&(t.L(2,e,t.i(2).y),t.L(3,e,t.i(3).y)):4===t.pointsCount?t.m(2,e,t.i(2).y):3===t.pointsCount?t.L(1,e,t.i(2).y):2===t.pointsCount&&t.m(1,e,t.i(1).y)):90===e?(e=a.bottom+s/2,i?4===t.pointsCount&&(i=t.i(3).x,t.L(1,t.i(1).x,e-20),t.m(2,i,e-20),t.m(3,i,e),t.m(4,i,e+20),t.L(5,i,t.i(5).y)):o?n?t.L(3,t.i(2).x,t.i(4).y):6===t.pointsCount&&(t.L(2,t.i(2).x,e),t.L(3,t.i(3).x,e)):4===t.pointsCount?t.m(2,t.i(2).x,e):3===t.pointsCount?t.L(1,t.i(2).x,e):2===t.pointsCount&&t.m(1,t.i(1).x,e)):180===e?(e=a.left-s/2,i?4===t.pointsCount&&(i=t.i(3).y,t.L(1,e+20,t.i(1).y),t.m(2,e+20,i),t.m(3,e,i),t.m(4,e-20,i),t.L(5,t.i(5).x,i)):o?n?t.L(3,t.i(2).x,t.i(4).y):6===t.pointsCount&&(t.L(2,e,t.i(2).y),t.L(3,e,t.i(3).y)):4===t.pointsCount?t.m(2,e,t.i(2).y):3===t.pointsCount?t.L(1,e,t.i(2).y):2===t.pointsCount&&t.m(1,e,t.i(1).y)):270===e&&(e=a.top-s/2,i?4===t.pointsCount&&(i=t.i(3).x,t.L(1,t.i(1).x,e+20),t.m(2,i,e+20),t.m(3,i,e),t.m(4,i,e-20),t.L(5,i,t.i(5).y)):o?n?t.L(3,t.i(2).x,t.i(4).y):6===t.pointsCount&&(t.L(2,t.i(2).x,e),t.L(3,t.i(3).x,e)):4===t.pointsCount?t.m(2,t.i(2).x,e):3===t.pointsCount?t.L(1,t.i(2).x,e):2===t.pointsCount&&t.m(1,t.i(1).x,e)),t.zf()))}}},d.Object.defineProperties(iy.prototype,{fromVertex:{get:function(){return this.kd},set:function(t){this.kd!==t&&(this.kd=t)}},toVertex:{get:function(){return this.qd},set:function(t){this.qd!==t&&(this.qd=t)}},relativePoint:{get:function(){return this.$t},set:function(t){this.$t.set(t)}}}),iy.className="TreeEdge",xi.prototype.initializeStandardTools=function(){this.gb("Action",new gn,this.mouseDownTools),this.gb("Relinking",new on,this.mouseDownTools),this.gb("LinkReshaping",new sn,this.mouseDownTools),this.gb("Rotating",new fn,this.mouseDownTools),this.gb("Resizing",new dn,this.mouseDownTools),this.gb("Linking",new Qi,this.mouseMoveTools),this.gb("Dragging",new Ni,this.mouseMoveTools),this.gb("DragSelecting",new yn,this.mouseMoveTools),this.gb("Panning",new vn,this.mouseMoveTools),this.gb("ContextMenu",new wn,this.mouseUpTools),this.gb("TextEditing",new Ln,this.mouseUpTools),this.gb("ClickCreating",new mn,this.mouseUpTools),this.gb("ClickSelecting",new pn,this.mouseUpTools)},il("Horizontal",new fh),il("Spot",new gh),il("Table",new vh),il("Viewbox",new wh),il("TableRow",new xh),il("TableColumn",new bh),il("Graduated",new Ph),il("Grid",new kh),zr.add("GraphLinksModel",uf),zr.add("TreeModel",pf);var ny=m.go,oy={get licenseKey(){return No.licenseKey},set licenseKey(t){No.licenseKey=t},get version(){return No.version},Group:gc,EnumValue:V,List:$,Set:Z,Map:ft,Point:pt,Size:At,Rect:jt,Margin:Kt,Spot:Oe,Geometry:Xe,PathFigure:Ze,PathSegment:Qe,InputEvent:hi,DiagramEvent:li,ChangedEvent:ui,Model:mf,GraphLinksModel:Wf,TreeModel:op,Binding:Hf,Transaction:gi,UndoManager:mi,CommandHandler:As,Tool:vi,DraggingTool:Ni,DraggingInfo:us,DraggingOptions:Ss,LinkingBaseTool:Ki,LinkingTool:Qi,RelinkingTool:on,LinkReshapingTool:sn,ResizingTool:dn,RotatingTool:fn,ClickSelectingTool:pn,ActionTool:gn,ClickCreatingTool:mn,HTMLInfo:xn,ContextMenuTool:wn,DragSelectingTool:yn,PanningTool:vn,TextEditingTool:Ln,ToolManager:xi,Animation:ho,AnimationManager:Un,AnimationTrigger:vo,Layer:Mo,Diagram:No,Palette:Ms,Overview:Ps,Brush:Oa,GraphObject:Fs,Panel:Th,RowColumnDefinition:hl,Shape:pl,TextBlock:Pl,Picture:ou,Part:ku,Adornment:Wu,Node:_u,Link:wc,Placeholder:bc,Layout:Bd,LayoutNetwork:jd,LayoutVertex:Rd,LayoutEdge:Gd,GridLayout:Hd,PanelLayout:ch,CircularLayout:rp,CircularNetwork:Fp,CircularVertex:jp,CircularEdge:Op,ForceDirectedLayout:Ip,ForceDirectedNetwork:Up,ForceDirectedVertex:qp,ForceDirectedEdge:Wp,LayeredDigraphLayout:_p,LayeredDigraphNetwork:qg,LayeredDigraphVertex:Wg,LayeredDigraphEdge:Zg,TreeLayout:Qg,TreeNetwork:ty,TreeVertex:ey,TreeEdge:iy};"object"==typeof ny&&ny.version&&M("WARNING: a `go` object on the root object is already defined. "+("Debug"in ny?"debug ":"")+"version: "+ny.version+", replaced with version: "+oy.version),No.prototype.go=oy,m.go=oy,"object"==typeof t.exports&&(t.exports=void 0!==i.g?i.g.go:self.go)}();void 0!==i.g?i.g.go:self.go;const n=void 0!==i.g?i.g.go:self.go,o=n.Group,r=(n.EnumValue,n.List,n.Set),s=(n.Map,n.Point),a=n.Size,h=n.Rect,l=n.Margin,u=n.Spot,c=(n.Geometry,n.PathFigure,n.PathSegment,n.InputEvent,n.DiagramEvent,n.ChangedEvent),d=n.Model,f=n.GraphLinksModel,p=(n.TreeModel,n.Binding),g=(n.Transaction,n.UndoManager,n.CommandHandler,n.Tool,n.DraggingTool),m=(n.DraggingInfo,n.LinkingBaseTool,n.LinkingTool,n.RelinkingTool,n.LinkReshapingTool,n.ResizingTool,n.RotatingTool,n.ClickSelectingTool,n.ActionTool,n.ClickCreatingTool,n.HTMLInfo,n.ContextMenuTool,n.DragSelectingTool,n.PanningTool,n.TextEditingTool,n.ToolManager,n.Animation,n.AnimationManager,n.AnimationTrigger,n.Layer,n.Diagram),y=n.Palette,v=n.Overview,x=n.Brush,b=n.GraphObject,w=n.Panel,k=(n.RowColumnDefinition,n.Shape),S=n.TextBlock,M=(n.TextBlockMetrics,n.Picture,n.Part,n.Adornment),C=n.Node,P=n.Link,T=n.Placeholder,N=(n.Layout,n.LayoutNetwork,n.LayoutVertex,n.LayoutEdge,n.GridLayout,n.PanelLayout,n.CircularLayout,n.CircularNetwork,n.CircularVertex,n.CircularEdge,n.ForceDirectedLayout),L=(n.ForceDirectedNetwork,n.ForceDirectedVertex,n.ForceDirectedEdge,n.LayeredDigraphLayout,n.LayeredDigraphNetwork,n.LayeredDigraphVertex,n.LayeredDigraphEdge,n.TreeLayout);n.TreeNetwork,n.TreeVertex,n.TreeEdge,n.version},2859:function(t,e,i){"use strict";i.d(e,{hP:function(){return Z}});var n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])})(t,e)};function o(t,e){function i(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}function r(t,e,i,n){return new(i||(i=Promise))((function(o,r){function s(t){try{h(n.next(t))}catch(t){r(t)}}function a(t){try{h(n.throw(t))}catch(t){r(t)}}function h(t){var e;t.done?o(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(s,a)}h((n=n.apply(t,e||[])).next())}))}function s(t,e){var i,n,o,r,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return r={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function a(r){return function(a){return function(r){if(i)throw new TypeError("Generator is already executing.");for(;s;)try{if(i=1,n&&(o=2&r[0]?n.return:r[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,r[1])).done)return o;switch(n=0,o&&(r=[2&r[0],o.value]),r[0]){case 0:case 1:o=r;break;case 4:return s.label++,{value:r[1],done:!1};case 5:s.label++,n=r[1],r=[0];continue;case 7:r=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).length>0&&o[o.length-1])||6!==r[0]&&2!==r[0])){s=0;continue}if(3===r[0]&&(!o||r[1]>o[0]&&r[1]<o[3])){s.label=r[1];break}if(6===r[0]&&s.label<o[1]){s.label=o[1],o=r;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(r);break}o[2]&&s.ops.pop(),s.trys.pop();continue}r=e.call(t,s)}catch(t){r=[6,t],n=0}finally{i=o=0}if(5&r[0])throw r[1];return{value:r[0]?r[1]:void 0,done:!0}}([r,a])}}}function a(){for(var t=0,e=0,i=arguments.length;e<i;e++)t+=arguments[e].length;var n=Array(t),o=0;for(e=0;e<i;e++)for(var r=arguments[e],s=0,a=r.length;s<a;s++,o++)n[o]=r[s];return n}var h=function(){function t(){}return t.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},t.setAttributes=function(t,e){for(var i=0,n=e;i<n.length;i++){var o=n[i],r=o[0],s=o[1];t.setAttribute(r,s)}},t.createRect=function(e,i,n){var o=document.createElementNS("http://www.w3.org/2000/svg","rect");return o.setAttribute("width",e.toString()),o.setAttribute("height",i.toString()),n&&t.setAttributes(o,n),o},t.createLine=function(e,i,n,o,r){var s=document.createElementNS("http://www.w3.org/2000/svg","line");return s.setAttribute("x1",e.toString()),s.setAttribute("y1",i.toString()),s.setAttribute("x2",n.toString()),s.setAttribute("y2",o.toString()),r&&t.setAttributes(s,r),s},t.createPolygon=function(e,i){var n=document.createElementNS("http://www.w3.org/2000/svg","polygon");return n.setAttribute("points",e),i&&t.setAttributes(n,i),n},t.createCircle=function(e,i){var n=document.createElementNS("http://www.w3.org/2000/svg","circle");return n.setAttribute("cx",(e/2).toString()),n.setAttribute("cy",(e/2).toString()),n.setAttribute("r",e.toString()),i&&t.setAttributes(n,i),n},t.createEllipse=function(e,i,n){var o=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return o.setAttribute("cx",(e/2).toString()),o.setAttribute("cy",(i/2).toString()),o.setAttribute("rx",(e/2).toString()),o.setAttribute("ry",(i/2).toString()),n&&t.setAttributes(o,n),o},t.createGroup=function(e){var i=document.createElementNS("http://www.w3.org/2000/svg","g");return e&&t.setAttributes(i,e),i},t.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},t.createMarker=function(e,i,n,o,r,s,a){var h=document.createElementNS("http://www.w3.org/2000/svg","marker");return t.setAttributes(h,[["id",e],["orient",i],["markerWidth",n.toString()],["markerHeight",o.toString()],["refX",r.toString()],["refY",s.toString()]]),h.appendChild(a),h},t.createText=function(e){var i=document.createElementNS("http://www.w3.org/2000/svg","text");return i.setAttribute("x","0"),i.setAttribute("y","0"),e&&t.setAttributes(i,e),i},t.createTSpan=function(e,i){var n=document.createElementNS("http://www.w3.org/2000/svg","tspan");return n.textContent=e,i&&t.setAttributes(n,i),n},t.createImage=function(e){var i=document.createElementNS("http://www.w3.org/2000/svg","image");return e&&t.setAttributes(i,e),i},t.createPoint=function(t,e){var i=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return i.x=t,i.y=e,i},t.createPath=function(e,i){var n=document.createElementNS("http://www.w3.org/2000/svg","path");return n.setAttribute("d",e),i&&t.setAttributes(n,i),n},t}(),l=function(){function t(){}return t.addKey=function(e){t.key=e},Object.defineProperty(t,"isLicensed",{get:function(){return!!t.key&&new RegExp(/^MJS2-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(t.key)},enumerable:!1,configurable:!0}),t}(),u=function(){function t(){this.naturalSize=!1,this.imageType="image/png",this.markersOnly=!1}return t.prototype.rasterize=function(t,e,i){var n=this;return new Promise((function(o){var r=void 0!==i?i:document.createElement("canvas");null===t&&(n.markersOnly=!0,n.naturalSize=!1);var s=document.createElementNS("http://www.w3.org/2000/svg","svg");s.setAttribute("xmlns","http://www.w3.org/2000/svg"),s.setAttribute("width",e.width.baseVal.valueAsString),s.setAttribute("height",e.height.baseVal.valueAsString),s.setAttribute("viewBox","0 0 "+e.viewBox.baseVal.width.toString()+" "+e.viewBox.baseVal.height.toString()),s.innerHTML=e.innerHTML,!0===n.naturalSize?(s.width.baseVal.value=t.naturalWidth,s.height.baseVal.value=t.naturalHeight):void 0!==n.width&&void 0!==n.height&&(s.width.baseVal.value=n.width,s.height.baseVal.value=n.height),r.width=s.width.baseVal.value,r.height=s.height.baseVal.value;var a=s.outerHTML,h=r.getContext("2d");!0!==n.markersOnly&&h.drawImage(t,0,0,r.width,r.height);var l=window.URL,u=new Image(r.width,r.height);u.setAttribute("crossOrigin","anonymous");var c=new Blob([a],{type:"image/svg+xml"}),d=l.createObjectURL(c);u.onload=function(){h.drawImage(u,0,0),l.revokeObjectURL(d);var t=r.toDataURL(n.imageType,n.imageQuality);o(t)},u.src=d}))},t}(),c=function(){},d=function(){function t(t){this._classNamePrefixBase="__markerjs2_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+t+"_"}return Object.defineProperty(t.prototype,"classNamePrefixBase",{get:function(){return this._classNamePrefixBase},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"classNamePrefix",{get:function(){return this._classNamePrefix},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"defaultSettings",{get:function(){return{canvasBackgroundColor:"#ffffff",toolbarBackgroundColor:"#111111",toolbarBackgroundHoverColor:"#333333",toolbarColor:"#eeeeee",toolbarHeight:40,toolboxColor:"#eeeeee",toolboxAccentColor:"#3080c3",undoButtonVisible:!0,redoButtonVisible:!1,zoomButtonVisible:!1,zoomOutButtonVisible:!1,clearButtonVisible:!1,resultButtonBlockVisible:!0,logoPosition:"left"}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fadeInAnimationClassName",{get:function(){return this.classNamePrefix+"fade_in"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fadeOutAnimationClassName",{get:function(){return this.classNamePrefix+"fade_out"},enumerable:!1,configurable:!0}),t.prototype.addClass=function(t){return void 0===this.styleSheet&&this.addStyleSheet(),t.name=""+this.classNamePrefix+t.localName,this.classes.push(t),this.styleSheet.sheet.insertRule("."+t.name+" {"+t.style+"}",this.styleSheet.sheet.cssRules.length),t},t.prototype.addRule=function(t){void 0===this.styleSheet&&this.addStyleSheet(),this.rules.push(t),this.styleSheet.sheet.insertRule(t.selector+" {"+t.style+"}",this.styleSheet.sheet.cssRules.length)},t.prototype.addStyleSheet=function(){var t;this.styleSheet=document.createElement("style"),(null!==(t=this.styleSheetRoot)&&void 0!==t?t:document.head).appendChild(this.styleSheet),this.addRule(new f("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new f("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames","\n from {\n opacity: 0;\n }\n to {\n opacity: 1;\n }\n ")),this.addRule(new f("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames","\n from {\n opacity: 1;\n }\n to {\n opacity: 0;\n }\n ")),this.addClass(new p("fade_in","\n animation-duration: 0.3s;\n animation-name: "+this.classNamePrefix+"_fade_in_animation_frames;\n ")),this.addClass(new p("fade_out","\n animation-duration: 0.3s;\n animation-name: "+this.classNamePrefix+"_fade_out_animation_frames;\n "))},t.prototype.removeStyleSheet=function(){var t;this.styleSheet&&((null!==(t=this.styleSheetRoot)&&void 0!==t?t:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},t}(),f=function(t,e){this.selector=t,this.style=e},p=function(t,e){this.localName=t,this.style=e},g=function(){function t(t,e,i,n,o){this.buttons=[],this.markerButtons=[],this.buttonClickListeners=[],this.markerjsContainer=t,this.displayMode=e,this.markerItems=i,this.uiStyleSettings=n,this.styles=o,this.addStyles(),this.adjustLayout=this.adjustLayout.bind(this),this.overflowButtonClicked=this.overflowButtonClicked.bind(this),this.setCurrentMarker=this.setCurrentMarker.bind(this)}return t.prototype.show=function(t){var e=this;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=t,this.uiContainer.className=this.toolbarStyleClass.name+" "+this.styles.fadeInAnimationClassName+" "+(this.uiStyleSettings.toolbarStyleColorsClassName?this.uiStyleSettings.toolbarStyleColorsClassName:this.toolbarStyleColorsClass.name);var i=document.createElement("div");i.className=this.toolbarBlockStyleClass.name,i.style.whiteSpace="nowrap",this.uiContainer.appendChild(i),this.addActionButton(i,'<svg viewBox="0 0 24 24"><path d="M10.07 14.27a.997.997 0 011.33.48l2.3 4.99 1.8-.85-2.31-4.98c-.24-.5-.02-1.1.48-1.33l.28-.08 2.3-.45L8 5.12V15.9l1.82-1.47.25-.16m3.57 7.7a.99.99 0 01-1.33-.47l-2.18-4.74-2.51 2.02c-.17.14-.38.22-.62.22a1 1 0 01-1-1V3a1 1 0 011-1c.24 0 .47.09.64.23l.01-.01 11.49 9.64a1.001 1.001 0 01-.44 1.75l-3.16.62 2.2 4.73c.26.5.02 1.09-.48 1.32l-3.62 1.69z"/></svg>',"select"),this.addActionButton(i,'<svg viewBox="0 0 24 24"><path d="M9 3v1H4v2h1v13a2 2 0 002 2h10a2 2 0 002-2V6h1V4h-5V3H9M7 6h10v13H7V6m2 2v9h2V8H9m4 0v9h2V8h-2z"/></svg>',"delete"),this.uiStyleSettings.clearButtonVisible&&this.addActionButton(i,'<svg viewBox="0 0 24 24"><path d="M19.36 2.72l1.42 1.42-5.72 5.71c1.07 1.54 1.22 3.39.32 4.59L9.06 8.12c1.2-.9 3.05-.75 4.59.32l5.71-5.72M5.93 17.57c-2.01-2.01-3.24-4.41-3.58-6.65l4.88-2.09 7.44 7.44-2.09 4.88c-2.24-.34-4.64-1.57-6.65-3.58z"/></svg>',"clear"),this.uiStyleSettings.undoButtonVisible&&this.addActionButton(i,'<svg viewBox="0 0 24 24"><path d="M12.5 8c-2.65 0-5.05 1-6.9 2.6L2 7v9h9l-3.62-3.62c1.39-1.16 3.16-1.88 5.12-1.88 3.54 0 6.55 2.31 7.6 5.5l2.37-.78C21.08 11.03 17.15 8 12.5 8z"/></svg>',"undo"),this.uiStyleSettings.redoButtonVisible&&this.addActionButton(i,'<svg viewBox="0 0 24 24"><path d="M18.4 10.6C16.55 9 14.15 8 11.5 8c-4.65 0-8.58 3.03-9.96 7.22L3.9 16a8.002 8.002 0 017.6-5.5c1.95 0 3.73.72 5.12 1.88L13 16h9V7l-3.6 3.6z"/></svg>',"redo"),this.uiStyleSettings.zoomButtonVisible&&this.addActionButton(i,'<svg viewBox="0 0 24 24"><path d="M15.5 14l5 5-1.5 1.5-5-5v-.79l-.27-.28A6.471 6.471 0 019.5 16 6.5 6.5 0 013 9.5 6.5 6.5 0 019.5 3 6.5 6.5 0 0116 9.5c0 1.61-.59 3.09-1.57 4.23l.28.27h.79m-6 0C12 14 14 12 14 9.5S12 5 9.5 5 5 7 5 9.5 7 14 9.5 14m2.5-4h-2v2H9v-2H7V9h2V7h1v2h2v1z"/></svg>',"zoom"),this.uiStyleSettings.zoomButtonVisible&&this.uiStyleSettings.zoomOutButtonVisible&&this.addActionButton(i,'<svg viewBox="0 0 24 24"><path d="M15.5 14h-.79l-.28-.27A6.471 6.471 0 0016 9.5 6.5 6.5 0 009.5 3 6.5 6.5 0 003 9.5 6.5 6.5 0 009.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 5 1.5-1.5-5-5m-6 0C7 14 5 12 5 9.5S7 5 9.5 5 14 7 14 9.5 12 14 9.5 14M7 9h5v1H7V9z"/></svg>',"zoom-out"),this.uiStyleSettings.notesButtonVisible&&this.addActionButton(i,'<svg viewBox="0 0 24 24"><path d="M18.13 12l1.26-1.26c.44-.44 1-.68 1.61-.74V9l-6-6H5c-1.11 0-2 .89-2 2v14a2 2 0 002 2h6v-1.87l.13-.13H5V5h7v7h6.13M14 4.5l5.5 5.5H14V4.5m5.13 9.33l2.04 2.04L15.04 22H13v-2.04l6.13-6.13m3.72.36l-.98.98-2.04-2.04.98-.98c.19-.2.52-.2.72 0l1.32 1.32c.2.2.2.53 0 .72z"/></svg>',"notes"),this.markerButtonBlock=document.createElement("div"),this.markerButtonBlock.className=this.toolbarBlockStyleClass.name,this.markerButtonBlock.style.flexGrow="2",this.markerButtonBlock.style.textAlign="center",this.uiContainer.appendChild(this.markerButtonBlock),this.markerButtonOverflowBlock=document.createElement("div"),this.markerButtonOverflowBlock.className=this.toolbarOverflowBlockStyleClass.name+" "+(this.uiStyleSettings.toolbarOverflowBlockStyleColorsClassName?this.uiStyleSettings.toolbarOverflowBlockStyleColorsClassName:this.toolbarOverflowBlockStyleColorsClass.name),this.markerButtonOverflowBlock.style.display="none",this.uiContainer.appendChild(this.markerButtonOverflowBlock),this.markerItems&&(this.markerItems.forEach((function(t){var i=document.createElement("div");i.className=""+e.toolbarButtonStyleClass.name,i.setAttribute("data-type-name",t.typeName),i.innerHTML=t.icon,i.addEventListener("click",(function(){e.markerToolbarButtonClicked(i,t)})),e.buttons.push(i),e.markerButtons.push(i)})),this.overflowButton=document.createElement("div"),this.overflowButton.className=this.toolbarButtonStyleClass.name+" "+(this.uiStyleSettings.toolbarButtonStyleColorsClassName?this.uiStyleSettings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name),this.overflowButton.innerHTML='<svg viewBox="0 0 24 24"><path d="M12 16a2 2 0 012 2 2 2 0 01-2 2 2 2 0 01-2-2 2 2 0 012-2m0-6a2 2 0 012 2 2 2 0 01-2 2 2 2 0 01-2-2 2 2 0 012-2m0-6a2 2 0 012 2 2 2 0 01-2 2 2 2 0 01-2-2 2 2 0 012-2z"/></svg>',this.overflowButton.addEventListener("click",this.overflowButtonClicked),this.markerButtonBlock.appendChild(this.overflowButton));var n=document.createElement("div");n.className=this.toolbarBlockStyleClass.name,n.style.whiteSpace="nowrap",n.style.display=!1!==this.uiStyleSettings.resultButtonBlockVisible?"":"none",this.uiContainer.appendChild(n),this.addActionButton(n,'<svg viewBox="0 0 24 24"><path d="M9 20.42l-6.21-6.21 2.83-2.83L9 14.77l9.88-9.89 2.83 2.83L9 20.42z"/></svg>',"render"),this.addActionButton(n,'<svg viewBox="0 0 24 24"><path d="M20 6.91L17.09 4 12 9.09 6.91 4 4 6.91 9.09 12 4 17.09 6.91 20 12 14.91 17.09 20 20 17.09 14.91 12 20 6.91z"/></svg>',"close"),this.markerjsContainer.appendChild(this.uiContainer),this.setSelectMode(),this.setCurrentMarker(),this.adjustLayout()},t.prototype.addButtonClickListener=function(t){this.buttonClickListeners.push(t)},t.prototype.removeButtonClickListener=function(t){this.buttonClickListeners.indexOf(t)>-1&&this.buttonClickListeners.splice(this.buttonClickListeners.indexOf(t),1)},t.prototype.setSelectMode=function(){this.resetButtonStyles(),this.setActiveButton(this.buttons[0])},t.prototype.adjustLayout=function(){if(this.markerButtons&&this.markerButtons.length>0){var t=Math.floor(this.markerButtonBlock.clientWidth/this.uiStyleSettings.toolbarHeight)-1;this.markerButtonBlock.innerHTML="",this.markerButtonOverflowBlock.innerHTML="";for(var e=0;e<this.markerButtons.length;e++)e<t||e===t&&this.markerButtons.length-1===t?this.markerButtonBlock.appendChild(this.markerButtons[e]):(e===t&&this.markerButtonBlock.appendChild(this.overflowButton),this.markerButtonOverflowBlock.appendChild(this.markerButtons[e]))}},t.prototype.overflowButtonClicked=function(){"none"!==this.markerButtonOverflowBlock.style.display?(this.markerButtonOverflowBlock.className=this.markerButtonOverflowBlock.className.replace(this.styles.fadeInAnimationClassName,""),this.markerButtonOverflowBlock.style.display="none"):(this.markerButtonOverflowBlock.className+=" "+this.styles.fadeInAnimationClassName,this.markerButtonOverflowBlock.style.top=this.uiContainer.offsetTop+this.overflowButton.offsetHeight+"px",this.markerButtonOverflowBlock.style.right=this.uiContainer.offsetWidth-this.overflowButton.offsetLeft-this.overflowButton.offsetWidth+2*this.uiContainer.offsetLeft+"px",this.markerButtonOverflowBlock.style.display="inline-block")},t.prototype.resetButtonStyles=function(){var t=this;this.buttons.forEach((function(e){e.className=e.className.replace(t.uiStyleSettings.toolbarButtonStyleColorsClassName?t.uiStyleSettings.toolbarButtonStyleColorsClassName:t.toolbarButtonStyleColorsClass.name,"").trim(),e.className=e.className.replace(t.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?t.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:t.toolbarActiveButtonStyleColorsClass.name,"").trim(),e.className+=" "+(t.uiStyleSettings.toolbarButtonStyleColorsClassName?t.uiStyleSettings.toolbarButtonStyleColorsClassName:t.toolbarButtonStyleColorsClass.name)}))},t.prototype.addActionButton=function(t,e,i){var n=this,o=document.createElement("div");switch(o.className=""+this.toolbarButtonStyleClass.name,o.innerHTML=e,o.setAttribute("data-action",i),o.addEventListener("click",(function(){n.actionToolbarButtonClicked(o,i)})),i){case"select":case"undo":case"redo":o.style.fill=this.uiStyleSettings.selectButtonColor;break;case"delete":case"clear":o.style.fill=this.uiStyleSettings.deleteButtonColor;break;case"render":o.style.fill=this.uiStyleSettings.okButtonColor;break;case"close":o.style.fill=this.uiStyleSettings.closeButtonColor}t.appendChild(o),this.buttons.push(o)},t.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new p("toolbar","\n width: 100%;\n flex-shrink: 0;\n display: flex;\n flex-direction: row;\n justify-content: space-between; \n height: "+this.uiStyleSettings.toolbarHeight+"px;\n box-sizing: content-box;\n "+("inline"===this.displayMode?"border-top-left-radius: "+Math.round(this.uiStyleSettings.toolbarHeight/10)+"px;":"")+"\n "+("inline"===this.displayMode?"border-top-right-radius: "+Math.round(this.uiStyleSettings.toolbarHeight/10)+"px;":"")+"\n overflow: hidden;\n ")),this.toolbarStyleColorsClass=this.styles.addClass(new p("toolbar_colors","\n background-color: "+this.uiStyleSettings.toolbarBackgroundColor+";\n box-shadow: 0px 3px rgba(33, 33, 33, 0.1);\n ")),this.toolbarBlockStyleClass=this.styles.addClass(new p("toolbar-block","\n display: inline-block;\n box-sizing: content-box;\n ")),this.toolbarOverflowBlockStyleClass=this.styles.addClass(new p("toolbar-overflow-block","\n position: absolute;\n top: "+this.uiStyleSettings.toolbarHeight+"px;\n max-width: "+2*this.uiStyleSettings.toolbarHeight+"px;\n z-index: 10;\n box-sizing: content-box;\n ")),this.toolbarOverflowBlockStyleColorsClass=this.styles.addClass(new p("toolbar-overflow-block_colors","\n background-color: "+this.uiStyleSettings.toolbarBackgroundColor+";\n "));var t=this.uiStyleSettings.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new p("toolbar_button","\n display: inline-block;\n width: "+(this.uiStyleSettings.toolbarHeight-2*t)+"px;\n height: "+(this.uiStyleSettings.toolbarHeight-2*t)+"px;\n padding: "+t+"px;\n box-sizing: content-box;\n ")),this.toolbarButtonStyleColorsClass=this.styles.addClass(new p("toolbar_button_colors","\n fill: "+this.uiStyleSettings.toolbarColor+";\n ")),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new p("toolbar_active_button","\n fill: "+this.uiStyleSettings.toolbarColor+";\n background-color: "+this.uiStyleSettings.toolbarBackgroundHoverColor+"\n ")),this.styles.addRule(new f("."+this.toolbarButtonStyleClass.name+" svg","\n height: "+this.uiStyleSettings.toolbarHeight/2+"px;\n ")),this.styles.addRule(new f("."+this.toolbarButtonStyleColorsClass.name+":hover","\n background-color: "+this.uiStyleSettings.toolbarBackgroundHoverColor+"\n "))},t.prototype.markerToolbarButtonClicked=function(t,e){this.setActiveButton(t),this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach((function(t){return t("marker",e)})),this.markerButtonOverflowBlock.style.display="none"},t.prototype.actionToolbarButtonClicked=function(t,e){this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach((function(t){return t("action",e)})),this.markerButtonOverflowBlock.style.display="none",this.setActiveButton(this.buttons[0])},t.prototype.setActiveButton=function(t){this.resetButtonStyles(),t.className=t.className.replace(this.uiStyleSettings.toolbarButtonStyleColorsClassName?this.uiStyleSettings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name,"").trim(),t.className+=" "+(this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:this.toolbarActiveButtonStyleColorsClass.name)},t.prototype.setActiveMarkerButton=function(t){var e=this.markerButtons.find((function(e){return e.getAttribute("data-type-name")===t}));e&&this.setActiveButton(e)},t.prototype.setCurrentMarker=function(t){var e=this;this.currentMarker=t,this.buttons.filter((function(t){return/delete|notes/.test(t.getAttribute("data-action"))})).forEach((function(t){void 0===e.currentMarker?(t.style.fillOpacity="0.4",t.style.pointerEvents="none"):(t.style.fillOpacity="1",t.style.pointerEvents="all")}))},t}(),m=function(){function t(t,e,i,n){this.panels=[],this.panelButtons=[],this.markerjsContainer=t,this.displayMode=e,this.uiStyleSettings=i,this.styles=n,this.panelButtonClick=this.panelButtonClick.bind(this),this.addStyles()}return t.prototype.addStyles=function(){var t;this.toolboxStyleClass=this.styles.addClass(new p("toolbox","\n width: 100%;\n flex-shrink: 0;\n display: flex;\n flex-direction: column;\n font-family: sans-serif;\n "+("popup"===this.displayMode?"height:"+2.5*this.uiStyleSettings.toolbarHeight+"px;":"")+"\n box-sizing: content-box;\n "+("popup"===this.displayMode?"background-color: "+this.uiStyleSettings.canvasBackgroundColor+";":"")+"\n "+("inline"===this.displayMode?"border-bottom-left-radius: "+Math.round(this.uiStyleSettings.toolbarHeight/10)+"px;":"")+"\n "+("inline"===this.displayMode?"border-bottom-right-radius: "+Math.round(this.uiStyleSettings.toolbarHeight/10)+"px;":"")+"\n overflow: hidden;\n ")),this.toolboxStyleColorsClass=this.styles.addClass(new p("toolbox_colors","\n color: "+this.uiStyleSettings.toolboxColor+";\n "));var e=this.uiStyleSettings.toolbarHeight/4;this.toolboxButtonRowStyleClass=this.styles.addClass(new p("toolbox-button-row","\n display: flex;\n cursor: default;\n box-sizing: content-box;\n ")),this.toolboxButtonRowStyleColorsClass=this.styles.addClass(new p("toolbox-button-row_colors","\n background-color: "+this.uiStyleSettings.toolbarBackgroundColor+";\n ")),this.toolboxPanelRowStyleClass=this.styles.addClass(new p("toolbox-panel-row","\n display: flex;\n "+("inline"===this.displayMode?"position: absolute;":"")+"\n "+("inline"===this.displayMode?"bottom: "+this.uiStyleSettings.toolbarHeight+"px;":"")+"\n cursor: default;\n height: "+1.5*this.uiStyleSettings.toolbarHeight+"px;\n "+("inline"===this.displayMode?"width: 100%;":"")+"\n box-sizing: content-box;\n ")),this.toolboxPanelRowStyleColorsClass=this.styles.addClass(new p("toolbox-panel-row_colors","\n background-color: "+(null!==(t=this.uiStyleSettings.toolboxBackgroundColor)&&void 0!==t?t:this.uiStyleSettings.toolbarBackgroundHoverColor)+";\n ")),this.toolboxButtonStyleClass=this.styles.addClass(new p("toolbox_button","\n display: inline-block;\n width: "+(this.uiStyleSettings.toolbarHeight-2*e)+"px;\n height: "+(this.uiStyleSettings.toolbarHeight-2*e)+"px;\n padding: "+e+"px;\n box-sizing: content-box;\n ")),this.toolboxButtonStyleColorsClass=this.styles.addClass(new p("toolbox-button_colors","\n fill: "+this.uiStyleSettings.toolbarColor+";\n ")),this.toolboxActiveButtonStyleColorsClass=this.styles.addClass(new p("toolbox-active-button_colors","\n background-color: "+this.uiStyleSettings.toolbarBackgroundHoverColor+";\n fill: "+this.uiStyleSettings.toolbarColor+";\n ")),this.styles.addRule(new f("."+this.toolboxButtonStyleColorsClass.name+":hover","\n background-color: "+this.uiStyleSettings.toolbarBackgroundHoverColor+"\n ")),this.styles.addRule(new f("."+this.toolboxButtonStyleClass.name+" svg","\n height: "+this.uiStyleSettings.toolbarHeight/2+"px;\n "))},t.prototype.show=function(t){var e;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=t,this.uiContainer.className=this.toolboxStyleClass.name+" "+(null!==(e=this.uiStyleSettings.toolboxStyleColorsClassName)&&void 0!==e?e:this.toolboxStyleColorsClass.name),this.markerjsContainer.appendChild(this.uiContainer)},t.prototype.setPanelButtons=function(t){var e,i,n=this;this.panels=t,void 0!==this.uiContainer&&(this.uiContainer.innerHTML="",this.panelRow=document.createElement("div"),this.panelRow.className=this.toolboxPanelRowStyleClass.name+" "+(null!==(e=this.uiStyleSettings.toolboxPanelRowStyleColorsClassName)&&void 0!==e?e:this.toolboxPanelRowStyleColorsClass.name),this.uiContainer.appendChild(this.panelRow),this.buttonRow=document.createElement("div"),this.buttonRow.className=this.toolboxButtonRowStyleClass.name+" "+(null!==(i=this.uiStyleSettings.toolboxButtonRowStyleColorsClassName)&&void 0!==i?i:this.toolboxButtonRowStyleColorsClass.name)+" ",this.uiContainer.appendChild(this.buttonRow),this.panelButtons.splice(0),this.panels.forEach((function(t){var e;t.uiStyleSettings=n.uiStyleSettings;var i=document.createElement("div");i.className=n.toolboxButtonStyleClass.name+" "+(null!==(e=n.uiStyleSettings.toolboxButtonStyleColorsClassName)&&void 0!==e?e:n.toolboxButtonStyleColorsClass.name),i.innerHTML=t.icon,i.title=t.title,i.addEventListener("click",(function(){n.panelButtonClick(t)})),n.panelButtons.push(i),n.buttonRow.appendChild(i)})),"inline"===this.displayMode?this.panelRow.style.display="none":this.panelRow.style.visibility="hidden")},t.prototype.panelButtonClick=function(t){var e=this,i=-1;if(t!==this.activePanel){i=this.panels.indexOf(t),this.panelRow.innerHTML="";var n=t.getUi();n.style.margin=this.uiStyleSettings.toolbarHeight/4+"px",this.panelRow.appendChild(n),this.panelRow.style.display="flex",this.panelRow.style.visibility="visible",this.panelRow.className=this.panelRow.className.replace(this.styles.fadeOutAnimationClassName,""),this.panelRow.className+=" "+this.styles.fadeInAnimationClassName,this.activePanel=t}else this.activePanel=void 0,this.panelRow.className=this.panelRow.className.replace(this.styles.fadeInAnimationClassName,""),this.panelRow.className+=" "+this.styles.fadeOutAnimationClassName,setTimeout((function(){"inline"===e.displayMode?e.panelRow.style.display="none":e.panelRow.style.visibility="hidden"}),200);this.panelButtons.forEach((function(t,n){var o,r;t.className=e.toolboxButtonStyleClass.name+" "+(n===i?""+(null!==(o=e.uiStyleSettings.toolboxActiveButtonStyleColorsClassName)&&void 0!==o?o:e.toolboxActiveButtonStyleColorsClass.name):""+(null!==(r=e.uiStyleSettings.toolboxButtonStyleColorsClassName)&&void 0!==r?r:e.toolboxButtonStyleColorsClass.name))}))},t}(),y=function(t,e){this.title=t,this.icon=e},v=function(t){function e(e,i,n,o){var r=t.call(this,e,o||'<svg viewBox="0 0 24 24"><path d="M17.5 12a1.5 1.5 0 01-1.5-1.5A1.5 1.5 0 0117.5 9a1.5 1.5 0 011.5 1.5 1.5 1.5 0 01-1.5 1.5m-3-4A1.5 1.5 0 0113 6.5 1.5 1.5 0 0114.5 5 1.5 1.5 0 0116 6.5 1.5 1.5 0 0114.5 8m-5 0A1.5 1.5 0 018 6.5 1.5 1.5 0 019.5 5 1.5 1.5 0 0111 6.5 1.5 1.5 0 019.5 8m-3 4A1.5 1.5 0 015 10.5 1.5 1.5 0 016.5 9 1.5 1.5 0 018 10.5 1.5 1.5 0 016.5 12M12 3a9 9 0 00-9 9 9 9 0 009 9 1.5 1.5 0 001.5-1.5c0-.39-.15-.74-.39-1-.23-.27-.38-.62-.38-1a1.5 1.5 0 011.5-1.5H16a5 5 0 005-5c0-4.42-4.03-8-9-8z"/></svg>')||this;return r.colors=[],r.addTransparent=!1,r.colorBoxes=[],r.colors=i,r.currentColor=n,r.setCurrentColor=r.setCurrentColor.bind(r),r.getColorBox=r.getColorBox.bind(r),r}return o(e,t),e.prototype.getUi=function(){var t=this,e=document.createElement("div");return e.style.overflow="hidden",e.style.whiteSpace="nowrap",this.colors.forEach((function(i){var n=t.getColorBox(i);e.appendChild(n),t.colorBoxes.push(n)})),e},e.prototype.getColorBox=function(t){var e=this,i=this.uiStyleSettings.toolbarHeight/4,n=this.uiStyleSettings.toolbarHeight-i,o=document.createElement("div");o.style.display="inline-block",o.style.boxSizing="content-box",o.style.width=n-2+"px",o.style.height=n-2+"px",o.style.padding="1px",o.style.marginRight="2px",o.style.marginBottom="2px",o.style.borderWidth="2px",o.style.borderStyle="solid",o.style.borderRadius=(n+2)/2+"px",o.style.borderColor=t===this.currentColor?this.uiStyleSettings.toolboxAccentColor:"transparent",o.addEventListener("click",(function(){e.setCurrentColor(t,o)}));var r=document.createElement("div");return r.style.display="inline-block",r.style.width=n-2+"px",r.style.height=n-2+"px",r.style.backgroundColor=t,r.style.borderRadius=n/2+"px","transparent"===t&&(r.style.fill=this.uiStyleSettings.toolboxAccentColor,r.innerHTML='<svg viewBox="0 0 24 24">\n <path d="M2,5.27L3.28,4L20,20.72L18.73,22L15.65,18.92C14.5,19.3 13.28,19.5 12,19.5C7,19.5 2.73,16.39 1,12C1.69,10.24 2.79,8.69 4.19,7.46L2,5.27M12,9A3,3 0 0,1 15,12C15,12.35 14.94,12.69 14.83,13L11,9.17C11.31,9.06 11.65,9 12,9M12,4.5C17,4.5 21.27,7.61 23,12C22.18,14.08 20.79,15.88 19,17.19L17.58,15.76C18.94,14.82 20.06,13.54 20.82,12C19.17,8.64 15.76,6.5 12,6.5C10.91,6.5 9.84,6.68 8.84,7L7.3,5.47C8.74,4.85 10.33,4.5 12,4.5M3.18,12C4.83,15.36 8.24,17.5 12,17.5C12.69,17.5 13.37,17.43 14,17.29L11.72,15C10.29,14.85 9.15,13.71 9,12.28L5.6,8.87C4.61,9.72 3.78,10.78 3.18,12Z" />\n </svg>'),o.appendChild(r),o},e.prototype.setCurrentColor=function(t,e){var i=this;this.currentColor=t,this.colorBoxes.forEach((function(t){t.style.borderColor=t===e?i.uiStyleSettings.toolboxAccentColor:"transparent"})),this.onColorChanged&&this.onColorChanged(t)},e}(y),x=function(){function t(t,e,i){this._state="new",this._isSelected=!1,this._container=t,this._overlayContainer=e,this.globalSettings=i,this.stateChanged=this.stateChanged.bind(this),this.colorChanged=this.colorChanged.bind(this),this.fillColorChanged=this.fillColorChanged.bind(this)}return Object.defineProperty(t.prototype,"typeName",{get:function(){return Object.getPrototypeOf(this).constructor.typeName},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"container",{get:function(){return this._container},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"overlayContainer",{get:function(){return this._overlayContainer},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"state",{get:function(){return this._state},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"toolboxPanels",{get:function(){return[]},enumerable:!1,configurable:!0}),t.prototype.ownsTarget=function(t){return!1},Object.defineProperty(t.prototype,"isSelected",{get:function(){return this._isSelected},enumerable:!1,configurable:!0}),t.prototype.select=function(){this.container.style.cursor="move",this._isSelected=!0,this.manipulationStartState=this.getState()},t.prototype.deselect=function(){this.container.style.cursor="default",this._isSelected=!1,this.stateChanged()},t.prototype.pointerDown=function(t,e){},t.prototype.dblClick=function(t,e){},t.prototype.manipulate=function(t){},t.prototype.pointerUp=function(t){this.stateChanged()},t.prototype.dispose=function(){},t.prototype.addMarkerVisualToContainer=function(t){this.container.childNodes.length>0?this.container.insertBefore(t,this.container.childNodes[0]):this.container.appendChild(t)},t.prototype.getState=function(){return{typeName:t.typeName,state:this.state,notes:this.notes}},t.prototype.restoreState=function(t){this._state=t.state,this.notes=t.notes},t.prototype.scale=function(t,e){},t.prototype.colorChanged=function(t){this.onColorChanged&&this.onColorChanged(t),this.stateChanged()},t.prototype.fillColorChanged=function(t){this.onFillColorChanged&&this.onFillColorChanged(t),this.stateChanged()},t.prototype.stateChanged=function(){if(this.onStateChanged&&"creating"!==this.state&&"new"!==this.state){var t=this.getState();void 0!==this.manipulationStartState&&(this.manipulationStartState.state="select"),t.state="select",JSON.stringify(this.manipulationStartState)!=JSON.stringify(t)&&this.onStateChanged(this)}},t.typeName="MarkerBase",t}(),b=function(){function t(){this.findGripByVisual=this.findGripByVisual.bind(this)}return t.prototype.findGripByVisual=function(t){return this.topLeft.ownsTarget(t)?this.topLeft:this.topCenter.ownsTarget(t)?this.topCenter:this.topRight.ownsTarget(t)?this.topRight:this.centerLeft.ownsTarget(t)?this.centerLeft:this.centerRight.ownsTarget(t)?this.centerRight:this.bottomLeft.ownsTarget(t)?this.bottomLeft:this.bottomCenter.ownsTarget(t)?this.bottomCenter:this.bottomRight.ownsTarget(t)?this.bottomRight:void 0},t}(),w=function(){function t(){this.GRIP_SIZE=10,this.visual=h.createGroup(),this.visual.appendChild(h.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(h.createCircle(this.GRIP_SIZE,[["fill","#cccccc"],["fill-opacity","0.7"],["stroke","#333333"],["stroke-width","2"],["stroke-opacity","0.7"]]))}return t.prototype.ownsTarget=function(t){return t===this.visual||t===this.visual.childNodes[0]||t===this.visual.childNodes[1]},t}(),k=function(){function t(){}return t.toITransformMatrix=function(t){return{a:t.a,b:t.b,c:t.c,d:t.d,e:t.e,f:t.f}},t.toSVGMatrix=function(t,e){return t.a=e.a,t.b=e.b,t.c=e.c,t.d=e.d,t.e=e.e,t.f=e.f,t},t}(),S=function(t){function e(e,i,n){var o=t.call(this,e,i,n)||this;return o.left=0,o.top=0,o.width=0,o.height=0,o.defaultSize={x:50,y:20},o.offsetX=0,o.offsetY=0,o.rotationAngle=0,o.CB_DISTANCE=10,o._suppressMarkerCreateEvent=!1,o.container.transform.baseVal.appendItem(h.createTransform()),o.setupControlBox(),o}return o(e,t),Object.defineProperty(e.prototype,"centerX",{get:function(){return this.left+this.width/2},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"centerY",{get:function(){return this.top+this.height/2},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"visual",{get:function(){return this._visual},set:function(t){this._visual=t;var e=h.createTransform();this._visual.transform.baseVal.appendItem(e)},enumerable:!1,configurable:!0}),e.prototype.ownsTarget=function(e){return!!t.prototype.ownsTarget.call(this,e)||!!(void 0!==this.controlGrips.findGripByVisual(e)||void 0!==this.rotatorGrip&&this.rotatorGrip.ownsTarget(e))},e.prototype.pointerDown=function(e,i){t.prototype.pointerDown.call(this,e,i),"new"===this.state&&(this.left=e.x,this.top=e.y),this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.manipulationStartWidth=this.width,this.manipulationStartHeight=this.height;var n=this.unrotatePoint(e);if(this.manipulationStartX=n.x,this.manipulationStartY=n.y,this.offsetX=n.x-this.left,this.offsetY=n.y-this.top,"new"!==this.state)if(this.select(),this.activeGrip=this.controlGrips.findGripByVisual(i),void 0!==this.activeGrip)this._state="resize";else if(void 0!==this.rotatorGrip&&this.rotatorGrip.ownsTarget(i)){this.activeGrip=this.rotatorGrip;var o=this.rotatePoint({x:this.centerX,y:this.centerY});this.left=o.x-this.width/2,this.top=o.y-this.height/2,this.moveVisual({x:this.left,y:this.top});var r=this.container.transform.baseVal.getItem(0);r.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(r,0),this.adjustControlBox(),this._state="rotate"}else this._state="move"},e.prototype.pointerUp=function(e){var i=this.state;t.prototype.pointerUp.call(this,e),"creating"===this.state&&this.width<10&&this.height<10?(this.width=this.defaultSize.x,this.height=this.defaultSize.y):this.manipulate(e),this._state="select","creating"===i&&this.onMarkerCreated&&!1===this._suppressMarkerCreateEvent&&this.onMarkerCreated(this)},e.prototype.moveVisual=function(t){this.visual.style.transform="translate("+t.x+"px, "+t.y+"px)"},e.prototype.manipulate=function(t){var e=this.unrotatePoint(t);"creating"===this.state?this.resize(t):"move"===this.state?(this.left=this.manipulationStartLeft+(e.x-this.manipulationStartLeft)-this.offsetX,this.top=this.manipulationStartTop+(e.y-this.manipulationStartTop)-this.offsetY,this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()):"resize"===this.state?this.resize(e):"rotate"===this.state&&this.rotate(t)},e.prototype.resize=function(t){var e=this.manipulationStartLeft,i=this.manipulationStartWidth,n=this.manipulationStartTop,o=this.manipulationStartHeight;switch(this.activeGrip){case this.controlGrips.bottomLeft:case this.controlGrips.centerLeft:case this.controlGrips.topLeft:e=this.manipulationStartLeft+t.x-this.manipulationStartX,i=this.manipulationStartWidth+this.manipulationStartLeft-e;break;case this.controlGrips.bottomRight:case this.controlGrips.centerRight:case this.controlGrips.topRight:case void 0:i=this.manipulationStartWidth+t.x-this.manipulationStartX}switch(this.activeGrip){case this.controlGrips.topCenter:case this.controlGrips.topLeft:case this.controlGrips.topRight:n=this.manipulationStartTop+t.y-this.manipulationStartY,o=this.manipulationStartHeight+this.manipulationStartTop-n;break;case this.controlGrips.bottomCenter:case this.controlGrips.bottomLeft:case this.controlGrips.bottomRight:case void 0:o=this.manipulationStartHeight+t.y-this.manipulationStartY}i>=0?(this.left=e,this.width=i):(this.left=e+i,this.width=-i),o>=0?(this.top=n,this.height=o):(this.top=n+o,this.height=-o),this.setSize()},e.prototype.setSize=function(){this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()},e.prototype.rotate=function(t){if(Math.abs(t.x-this.centerX)>.1){var e=Math.sign(t.x-this.centerX);this.rotationAngle=180*Math.atan((t.y-this.centerY)/(t.x-this.centerX))/Math.PI+90*e,this.applyRotation()}},e.prototype.applyRotation=function(){var t=this.container.transform.baseVal.getItem(0);t.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(t,0)},e.prototype.rotatePoint=function(t){if(0===this.rotationAngle)return t;var e=this.container.getCTM(),i=h.createPoint(t.x,t.y);return{x:(i=i.matrixTransform(e)).x,y:i.y}},e.prototype.unrotatePoint=function(t){if(0===this.rotationAngle)return t;var e=this.container.getCTM();e=e.inverse();var i=h.createPoint(t.x,t.y);return{x:(i=i.matrixTransform(e)).x,y:i.y}},e.prototype.select=function(){t.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},e.prototype.deselect=function(){t.prototype.deselect.call(this),this.controlBox.style.display="none"},e.prototype.setupControlBox=function(){this.controlBox=h.createGroup();var t=h.createTransform();t.setTranslate(-this.CB_DISTANCE/2,-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.appendItem(t),this.container.appendChild(this.controlBox),this.controlRect=h.createRect(this.width+this.CB_DISTANCE,this.height+this.CB_DISTANCE,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"],["fill","transparent"],["pointer-events","none"]]),this.controlBox.appendChild(this.controlRect),!0!==this.globalSettings.disableRotation&&(this.rotatorGripLine=h.createLine((this.width+2*this.CB_DISTANCE)/2,this.top-this.CB_DISTANCE,(this.width+2*this.CB_DISTANCE)/2,this.top-3*this.CB_DISTANCE,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.controlBox.appendChild(this.rotatorGripLine)),this.controlGrips=new b,this.addControlGrips(),this.controlBox.style.display="none"},e.prototype.adjustControlBox=function(){var t=this.controlBox.transform.baseVal.getItem(0);t.setTranslate(this.left-this.CB_DISTANCE/2,this.top-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.replaceItem(t,0),this.controlRect.setAttribute("width",(this.width+this.CB_DISTANCE).toString()),this.controlRect.setAttribute("height",(this.height+this.CB_DISTANCE).toString()),void 0!==this.rotatorGripLine&&(this.rotatorGripLine.setAttribute("x1",((this.width+this.CB_DISTANCE)/2).toString()),this.rotatorGripLine.setAttribute("y1",(-this.CB_DISTANCE/2).toString()),this.rotatorGripLine.setAttribute("x2",((this.width+this.CB_DISTANCE)/2).toString()),this.rotatorGripLine.setAttribute("y2",(3*-this.CB_DISTANCE).toString())),this.positionGrips()},e.prototype.addControlGrips=function(){this.controlGrips.topLeft=this.createGrip(),this.controlGrips.topCenter=this.createGrip(),this.controlGrips.topRight=this.createGrip(),this.controlGrips.centerLeft=this.createGrip(),this.controlGrips.centerRight=this.createGrip(),this.controlGrips.bottomLeft=this.createGrip(),this.controlGrips.bottomCenter=this.createGrip(),this.controlGrips.bottomRight=this.createGrip(),!0!==this.globalSettings.disableRotation&&(this.rotatorGrip=this.createGrip()),this.positionGrips()},e.prototype.createGrip=function(){var t=new w;return t.visual.transform.baseVal.appendItem(h.createTransform()),this.controlBox.appendChild(t.visual),t},e.prototype.positionGrips=function(){var t=this.controlGrips.topLeft.GRIP_SIZE,e=-t/2,i=e,n=(this.width+this.CB_DISTANCE)/2-t/2,o=(this.height+this.CB_DISTANCE)/2-t/2,r=this.height+this.CB_DISTANCE-t/2,s=this.width+this.CB_DISTANCE-t/2;this.positionGrip(this.controlGrips.topLeft.visual,e,i),this.positionGrip(this.controlGrips.topCenter.visual,n,i),this.positionGrip(this.controlGrips.topRight.visual,s,i),this.positionGrip(this.controlGrips.centerLeft.visual,e,o),this.positionGrip(this.controlGrips.centerRight.visual,s,o),this.positionGrip(this.controlGrips.bottomLeft.visual,e,r),this.positionGrip(this.controlGrips.bottomCenter.visual,n,r),this.positionGrip(this.controlGrips.bottomRight.visual,s,r),void 0!==this.rotatorGrip&&this.positionGrip(this.rotatorGrip.visual,n,i-3*this.CB_DISTANCE)},e.prototype.positionGrip=function(t,e,i){var n=t.transform.baseVal.getItem(0);n.setTranslate(e,i),t.transform.baseVal.replaceItem(n,0)},e.prototype.hideControlBox=function(){this.controlBox.style.display="none"},e.prototype.showControlBox=function(){this.controlBox.style.display=""},e.prototype.getState=function(){return Object.assign({left:this.left,top:this.top,width:this.width,height:this.height,rotationAngle:this.rotationAngle,visualTransformMatrix:k.toITransformMatrix(this.visual.transform.baseVal.getItem(0).matrix),containerTransformMatrix:k.toITransformMatrix(this.container.transform.baseVal.getItem(0).matrix)},t.prototype.getState.call(this))},e.prototype.restoreState=function(e){t.prototype.restoreState.call(this,e);var i=e;this.left=i.left,this.top=i.top,this.width=i.width,this.height=i.height,this.rotationAngle=i.rotationAngle,this.visual.transform.baseVal.getItem(0).setMatrix(k.toSVGMatrix(this.visual.transform.baseVal.getItem(0).matrix,i.visualTransformMatrix)),this.container.transform.baseVal.getItem(0).setMatrix(k.toSVGMatrix(this.container.transform.baseVal.getItem(0).matrix,i.containerTransformMatrix))},e.prototype.scale=function(e,i){t.prototype.scale.call(this,e,i);var n=this.rotatePoint({x:this.left,y:this.top}),o=this.unrotatePoint({x:n.x*e,y:n.y*i});this.left=o.x,this.top=o.y,this.width=this.width*e,this.height=this.height*i,this.adjustControlBox()},e}(x),M=function(t){function e(e,i,n){var o=t.call(this,e,i,n)||this;return o.fillColor="transparent",o.strokeColor="transparent",o.strokeWidth=0,o.strokeDasharray="",o.opacity=1,o.setStrokeColor=o.setStrokeColor.bind(o),o.setFillColor=o.setFillColor.bind(o),o.setStrokeWidth=o.setStrokeWidth.bind(o),o.setStrokeDasharray=o.setStrokeDasharray.bind(o),o.createVisual=o.createVisual.bind(o),o}return o(e,t),e.prototype.ownsTarget=function(e){return!(!t.prototype.ownsTarget.call(this,e)&&e!==this.visual)},e.prototype.createVisual=function(){this.visual=h.createRect(1,1,[["fill",this.fillColor],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()],["stroke-dasharray",this.strokeDasharray],["opacity",this.opacity.toString()]]),this.addMarkerVisualToContainer(this.visual)},e.prototype.pointerDown=function(e,i){t.prototype.pointerDown.call(this,e,i),"new"===this.state&&(this.createVisual(),this.moveVisual(e),this._state="creating")},e.prototype.manipulate=function(e){t.prototype.manipulate.call(this,e)},e.prototype.resize=function(e){t.prototype.resize.call(this,e),this.setSize()},e.prototype.setSize=function(){t.prototype.setSize.call(this),h.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]])},e.prototype.pointerUp=function(e){t.prototype.pointerUp.call(this,e),this.setSize()},e.prototype.setStrokeColor=function(t){this.strokeColor=t,this.visual&&h.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(t),this.stateChanged()},e.prototype.setFillColor=function(t){this.fillColor=t,this.visual&&h.setAttributes(this.visual,[["fill",this.fillColor]]),this.stateChanged()},e.prototype.setStrokeWidth=function(t){this.strokeWidth=t,this.visual&&h.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},e.prototype.setStrokeDasharray=function(t){this.strokeDasharray=t,this.visual&&h.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},e.prototype.getState=function(){return Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},t.prototype.getState.call(this))},e.prototype.restoreState=function(e){var i=e;this.fillColor=i.fillColor,this.strokeColor=i.strokeColor,this.strokeWidth=i.strokeWidth,this.strokeDasharray=i.strokeDasharray,this.opacity=i.opacity,this.createVisual(),t.prototype.restoreState.call(this,e),this.setSize()},e.prototype.scale=function(e,i){t.prototype.scale.call(this,e,i),this.setSize()},e.title="Rectangle marker",e}(S),C=function(t){function e(e,i,n,o){var r=t.call(this,e,o||'<svg viewBox="0 0 24 24"><path d="M3 17h18v-2H3v2m0 3h18v-1H3v1m0-7h18v-3H3v3m0-9v4h18V4H3z"/></svg>')||this;return r.widths=[],r.widthBoxes=[],r.widths=i,r.currentWidth=n,r.setCurrentWidth=r.setCurrentWidth.bind(r),r}return o(e,t),e.prototype.getUi=function(){var t=this,e=document.createElement("div");return e.style.display="flex",e.style.overflow="hidden",e.style.flexGrow="2",this.widths.forEach((function(i){var n=document.createElement("div");n.style.display="flex",n.style.flexGrow="2",n.style.alignItems="center",n.style.justifyContent="space-between",n.style.padding="5px",n.style.borderWidth="2px",n.style.borderStyle="solid",n.style.borderColor=i===t.currentWidth?t.uiStyleSettings.toolboxAccentColor:"transparent",n.addEventListener("click",(function(){t.setCurrentWidth(i,n)})),e.appendChild(n);var o=document.createElement("div");o.innerText=i.toString(),o.style.marginRight="5px",n.appendChild(o);var r=document.createElement("div");r.style.minHeight="20px",r.style.flexGrow="2",r.style.display="flex",r.style.alignItems="center";var s=document.createElement("hr");s.style.minWidth="20px",s.style.border="0px",s.style.borderTop=i+"px solid "+t.uiStyleSettings.toolboxColor,s.style.flexGrow="2",r.appendChild(s),n.appendChild(r),t.widthBoxes.push(n)})),e},e.prototype.setCurrentWidth=function(t,e){var i=this;this.currentWidth=t,this.widthBoxes.forEach((function(t){t.style.borderColor=t===e?i.uiStyleSettings.toolboxAccentColor:"transparent"})),this.onWidthChanged&&this.onWidthChanged(this.currentWidth)},e}(y),P=function(t){function e(e,i,n,o){var r=t.call(this,e,o||'<svg viewBox="0 0 24 24"><path d="M3 16h5v-2H3v2m6.5 0h5v-2h-5v2m6.5 0h5v-2h-5v2M3 20h2v-2H3v2m4 0h2v-2H7v2m4 0h2v-2h-2v2m4 0h2v-2h-2v2m4 0h2v-2h-2v2M3 12h8v-2H3v2m10 0h8v-2h-8v2M3 4v4h18V4H3z"/></svg>')||this;return r.styles=[],r.styleBoxes=[],r.styles=i,r.currentStyle=n,r.setCurrentStyle=r.setCurrentStyle.bind(r),r}return o(e,t),e.prototype.getUi=function(){var t=this,e=document.createElement("div");return e.style.display="flex",e.style.overflow="hidden",e.style.flexGrow="2",this.styles.forEach((function(i){var n=document.createElement("div");n.style.display="flex",n.style.alignItems="center",n.style.justifyContent="space-between",n.style.padding="5px",n.style.borderWidth="2px",n.style.borderStyle="solid",n.style.overflow="hidden",n.style.maxWidth=100/t.styles.length-5+"%",n.style.borderColor=i===t.currentStyle?t.uiStyleSettings.toolboxAccentColor:"transparent",n.addEventListener("click",(function(){t.setCurrentStyle(i,n)})),e.appendChild(n);var o=document.createElement("div");o.style.minHeight="20px",o.style.flexGrow="2",o.style.overflow="hidden";var r='<svg width="100" height="20">\n <line x1="0" y1="10" x2="100" y2="10" stroke="'+t.uiStyleSettings.toolboxColor+'" stroke-width="3" '+(""!==i?'stroke-dasharray="'+i+'"':"")+" />\n </svg>";o.innerHTML=r,n.appendChild(o),t.styleBoxes.push(n)})),e},e.prototype.setCurrentStyle=function(t,e){var i=this;this.currentStyle=t,this.styleBoxes.forEach((function(t){t.style.borderColor=t===e?i.uiStyleSettings.toolboxAccentColor:"transparent"})),this.onStyleChanged&&this.onStyleChanged(this.currentStyle)},e}(y),T=function(t){function e(e,i,n){var o=t.call(this,e,i,n)||this;return o.strokeColor=n.defaultColor,o.strokeWidth=n.defaultStrokeWidth,o.strokeDasharray=n.defaultStrokeDasharray,o.strokePanel=new v("Line color",n.defaultColorSet,n.defaultColor),o.strokePanel.onColorChanged=o.setStrokeColor,o.strokeWidthPanel=new C("Line width",n.defaultStrokeWidths,n.defaultStrokeWidth),o.strokeWidthPanel.onWidthChanged=o.setStrokeWidth,o.strokeStylePanel=new P("Line style",n.defaultStrokeDasharrays,n.defaultStrokeDasharray),o.strokeStylePanel.onStyleChanged=o.setStrokeDasharray,o}return o(e,t),Object.defineProperty(e.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),e.prototype.getState=function(){var i=t.prototype.getState.call(this);return i.typeName=e.typeName,i},e.typeName="FrameMarker",e.title="Frame marker",e.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4m14 11H6V8h12v9z"/></svg>',e}(M),N=function(){this.defaultColorSet=["#EF4444","#10B981","#2563EB","#FFFF00","#7C3AED","#F472B6","#000000","#FFFFFF"],this.defaultColor=this.defaultColorSet[0],this.defaultFillColor=this.defaultColorSet[0],this.defaultStrokeColor=this.defaultColorSet[7],this.defaultHighlightColor=this.defaultColorSet[3],this.defaultStrokeWidth=3,this.defaultStrokeDasharray="",this.defaultHighlightOpacity=.5,this.defaultFontFamily="Helvetica, Arial, sans-serif",this.defaultStrokeWidths=[1,2,3,5,10],this.defaultStrokeDasharrays=["","3","12 3","9 6 3 6"],this.defaultOpacitySteps=[.1,.25,.5,.75,1],this.displayMode="inline",this.defaultFontFamilies=['Times, "Times New Roman", serif',"Helvetica, Arial, sans-serif",'Courier, "Courier New", monospace',"cursive","fantasy"],this.popupMargin=30,this.newFreehandMarkerOnPointerUp=!1,this.defaultColorsFollowCurrentColors=!1,this.freehandPixelRatio=1,this.disableRotation=!1,this.defaultCaptionFontSize="1rem",this.defaultCaptionText="Text"},L=function(t){function e(e,i,n){var o=t.call(this,e,i,n)||this;return o.x1=0,o.y1=0,o.x2=0,o.y2=0,o.defaultLength=50,o.manipulationStartX=0,o.manipulationStartY=0,o.manipulationStartX1=0,o.manipulationStartY1=0,o.manipulationStartX2=0,o.manipulationStartY2=0,o.setupControlBox(),o}return o(e,t),e.prototype.ownsTarget=function(e){return!!t.prototype.ownsTarget.call(this,e)||!(!this.grip1.ownsTarget(e)&&!this.grip2.ownsTarget(e))},e.prototype.pointerDown=function(e,i){t.prototype.pointerDown.call(this,e,i),this.manipulationStartX=e.x,this.manipulationStartY=e.y,"new"===this.state&&(this.x1=e.x,this.y1=e.y,this.x2=e.x,this.y2=e.y),this.manipulationStartX1=this.x1,this.manipulationStartY1=this.y1,this.manipulationStartX2=this.x2,this.manipulationStartY2=this.y2,"new"!==this.state&&(this.select(),this.grip1.ownsTarget(i)?this.activeGrip=this.grip1:this.grip2.ownsTarget(i)?this.activeGrip=this.grip2:this.activeGrip=void 0,this.activeGrip?this._state="resize":this._state="move")},e.prototype.pointerUp=function(e){var i=this.state;t.prototype.pointerUp.call(this,e),"creating"===this.state&&Math.abs(this.x1-this.x2)<10&&Math.abs(this.y1-this.y2)<10?(this.x2=this.x1+this.defaultLength,this.adjustVisual(),this.adjustControlBox()):this.manipulate(e),this._state="select","creating"===i&&this.onMarkerCreated&&this.onMarkerCreated(this)},e.prototype.adjustVisual=function(){},e.prototype.manipulate=function(t){"creating"===this.state?this.resize(t):"move"===this.state?(this.x1=this.manipulationStartX1+t.x-this.manipulationStartX,this.y1=this.manipulationStartY1+t.y-this.manipulationStartY,this.x2=this.manipulationStartX2+t.x-this.manipulationStartX,this.y2=this.manipulationStartY2+t.y-this.manipulationStartY,this.adjustVisual(),this.adjustControlBox()):"resize"===this.state&&this.resize(t)},e.prototype.resize=function(t){switch(this.activeGrip){case this.grip1:this.x1=t.x,this.y1=t.y;break;case this.grip2:case void 0:this.x2=t.x,this.y2=t.y}this.adjustVisual(),this.adjustControlBox()},e.prototype.select=function(){t.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},e.prototype.deselect=function(){t.prototype.deselect.call(this),this.controlBox.style.display="none"},e.prototype.setupControlBox=function(){this.controlBox=h.createGroup(),this.container.appendChild(this.controlBox),this.addControlGrips(),this.controlBox.style.display="none"},e.prototype.adjustControlBox=function(){this.positionGrips()},e.prototype.addControlGrips=function(){this.grip1=this.createGrip(),this.grip2=this.createGrip(),this.positionGrips()},e.prototype.createGrip=function(){var t=new w;return t.visual.transform.baseVal.appendItem(h.createTransform()),this.controlBox.appendChild(t.visual),t},e.prototype.positionGrips=function(){var t=this.grip1.GRIP_SIZE;this.positionGrip(this.grip1.visual,this.x1-t/2,this.y1-t/2),this.positionGrip(this.grip2.visual,this.x2-t/2,this.y2-t/2)},e.prototype.positionGrip=function(t,e,i){var n=t.transform.baseVal.getItem(0);n.setTranslate(e,i),t.transform.baseVal.replaceItem(n,0)},e.prototype.getState=function(){return Object.assign({x1:this.x1,y1:this.y1,x2:this.x2,y2:this.y2},t.prototype.getState.call(this))},e.prototype.restoreState=function(e){t.prototype.restoreState.call(this,e);var i=e;this.x1=i.x1,this.y1=i.y1,this.x2=i.x2,this.y2=i.y2},e.prototype.scale=function(e,i){t.prototype.scale.call(this,e,i),this.x1=this.x1*e,this.y1=this.y1*i,this.x2=this.x2*e,this.y2=this.y2*i,this.adjustVisual(),this.adjustControlBox()},e}(x),A=function(t){function e(e,i,n){var o=t.call(this,e,i,n)||this;return o.strokeColor="transparent",o.strokeWidth=0,o.strokeDasharray="",o.setStrokeColor=o.setStrokeColor.bind(o),o.setStrokeWidth=o.setStrokeWidth.bind(o),o.setStrokeDasharray=o.setStrokeDasharray.bind(o),o.strokeColor=n.defaultColor,o.strokeWidth=n.defaultStrokeWidth,o.strokeDasharray=n.defaultStrokeDasharray,o.strokePanel=new v("Line color",n.defaultColorSet,n.defaultColor),o.strokePanel.onColorChanged=o.setStrokeColor,o.strokeWidthPanel=new C("Line width",n.defaultStrokeWidths,n.defaultStrokeWidth),o.strokeWidthPanel.onWidthChanged=o.setStrokeWidth,o.strokeStylePanel=new P("Line style",n.defaultStrokeDasharrays,n.defaultStrokeDasharray),o.strokeStylePanel.onStyleChanged=o.setStrokeDasharray,o}return o(e,t),e.prototype.ownsTarget=function(e){return!(!t.prototype.ownsTarget.call(this,e)&&e!==this.visual&&e!==this.selectorLine&&e!==this.visibleLine)},e.prototype.createVisual=function(){this.visual=h.createGroup(),this.selectorLine=h.createLine(this.x1,this.y1,this.x2,this.y2,[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()]]),this.visibleLine=h.createLine(this.x1,this.y1,this.x2,this.y2,[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),this.visual.appendChild(this.selectorLine),this.visual.appendChild(this.visibleLine),this.addMarkerVisualToContainer(this.visual)},e.prototype.pointerDown=function(e,i){t.prototype.pointerDown.call(this,e,i),"new"===this.state&&(this.createVisual(),this.adjustVisual(),this._state="creating")},e.prototype.adjustVisual=function(){this.selectorLine&&this.visibleLine&&(this.selectorLine.setAttribute("x1",this.x1.toString()),this.selectorLine.setAttribute("y1",this.y1.toString()),this.selectorLine.setAttribute("x2",this.x2.toString()),this.selectorLine.setAttribute("y2",this.y2.toString()),this.visibleLine.setAttribute("x1",this.x1.toString()),this.visibleLine.setAttribute("y1",this.y1.toString()),this.visibleLine.setAttribute("x2",this.x2.toString()),this.visibleLine.setAttribute("y2",this.y2.toString()),h.setAttributes(this.visibleLine,[["stroke",this.strokeColor]]),h.setAttributes(this.visibleLine,[["stroke-width",this.strokeWidth.toString()]]),h.setAttributes(this.visibleLine,[["stroke-dasharray",this.strokeDasharray.toString()]]))},e.prototype.setStrokeColor=function(t){this.strokeColor=t,this.adjustVisual(),this.colorChanged(t)},e.prototype.setStrokeWidth=function(t){this.strokeWidth=t,this.adjustVisual()},e.prototype.setStrokeDasharray=function(t){this.strokeDasharray=t,this.adjustVisual(),this.stateChanged()},Object.defineProperty(e.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),e.prototype.getState=function(){var i=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray},t.prototype.getState.call(this));return i.typeName=e.typeName,i},e.prototype.restoreState=function(e){t.prototype.restoreState.call(this,e);var i=e;this.strokeColor=i.strokeColor,this.strokeWidth=i.strokeWidth,this.strokeDasharray=i.strokeDasharray,this.createVisual(),this.adjustVisual()},e.typeName="LineMarker",e.title="Line marker",e.icon='<svg viewBox="0 0 24 24"><path d="M19 13H5v-2h14v2z"/></svg>',e}(L),B=function(t){function e(e,i,n,o){var r=t.call(this,e,o||'<svg viewBox="0 0 24 24"><path d="M17 8h3v12h1v1h-4v-1h1v-3h-4l-1.5 3H14v1h-4v-1h1l6-12m1 1l-3.5 7H18V9M5 3h5c1.11 0 2 .89 2 2v11H9v-5H6v5H3V5c0-1.11.89-2 2-2m1 2v4h3V5H6z"/></svg>')||this;return r.fonts=[],r.fontBoxes=[],r.fonts=i,r.currentFont=n,r.setCurrentFont=r.setCurrentFont.bind(r),r}return o(e,t),e.prototype.getUi=function(){var t=this,e=document.createElement("div");return e.style.overflow="hidden",e.style.flexGrow="2",this.fonts.forEach((function(i){var n=document.createElement("div");n.style.display="inline-block",n.style.alignItems="center",n.style.justifyContent="space-between",n.style.padding="5px",n.style.borderWidth="2px",n.style.borderStyle="solid",n.style.overflow="hidden",n.style.maxWidth=100/t.fonts.length-5+"%",n.style.borderColor=i===t.currentFont?t.uiStyleSettings.toolboxAccentColor:"transparent",n.addEventListener("click",(function(){t.setCurrentFont(i,n)})),e.appendChild(n);var o=document.createElement("div");o.style.display="flex",o.style.minHeight="20px",o.style.flexGrow="2",o.style.fontFamily=i,o.style.overflow="hidden";var r=document.createElement("div");r.style.whiteSpace="nowrap",r.style.overflow="hidden",r.style.textOverflow="ellipsis",r.innerHTML="The quick brown fox jumps over the lazy dog",o.appendChild(r),n.appendChild(o),t.fontBoxes.push(n)})),e},e.prototype.setCurrentFont=function(t,e){var i=this;this.currentFont=t,this.fontBoxes.forEach((function(t){t.style.borderColor=t===e?i.uiStyleSettings.toolboxAccentColor:"transparent"})),this.onFontChanged&&this.onFontChanged(this.currentFont)},e}(y),D=function(t){function e(e,i,n){var o=t.call(this,e,i,n)||this;return o.color="transparent",o.padding=5,o.DEFAULT_TEXT="请输入文本",o.text=o.DEFAULT_TEXT,o.isMoved=!1,o.color=n.defaultColor,o.fontFamily=n.defaultFontFamily,o.defaultSize={x:100,y:30},o.setColor=o.setColor.bind(o),o.setFont=o.setFont.bind(o),o.renderText=o.renderText.bind(o),o.sizeText=o.sizeText.bind(o),o.textEditDivClicked=o.textEditDivClicked.bind(o),o.showTextEditor=o.showTextEditor.bind(o),o.setSize=o.setSize.bind(o),o.positionTextEditor=o.positionTextEditor.bind(o),o.colorPanel=new v("Color",n.defaultColorSet,n.defaultColor),o.colorPanel.onColorChanged=o.setColor,o.fontFamilyPanel=new B("Font",n.defaultFontFamilies,n.defaultFontFamily),o.fontFamilyPanel.onFontChanged=o.setFont,o}return o(e,t),e.prototype.ownsTarget=function(e){if(t.prototype.ownsTarget.call(this,e)||e===this.visual||e===this.textElement||e===this.bgRectangle)return!0;var i=!1;return this.textElement.childNodes.forEach((function(t){t===e&&(i=!0)})),i},e.prototype.createVisual=function(){this.visual=h.createGroup(),this.bgRectangle=h.createRect(1,1,[["fill","transparent"]]),this.visual.appendChild(this.bgRectangle),this.textElement=h.createText([["fill",this.color],["font-family",this.fontFamily],["font-size","16px"],["x","0"],["y","0"]]),this.textElement.transform.baseVal.appendItem(h.createTransform()),this.textElement.transform.baseVal.appendItem(h.createTransform()),this.visual.appendChild(this.textElement),this.addMarkerVisualToContainer(this.visual),this.renderText()},e.prototype.pointerDown=function(e,i){t.prototype.pointerDown.call(this,e,i),this.isMoved=!1,this.pointerDownPoint=e,this.pointerDownTimestamp=Date.now(),"new"===this.state&&(this.createVisual(),this.moveVisual(e),this._state="creating")},e.prototype.renderText=function(){var t=this;if(this.textElement){for(;this.textElement.lastChild;)this.textElement.removeChild(this.textElement.lastChild);this.text.split(/\r\n|[\n\v\f\r\x85\u2028\u2029]/).forEach((function(e){t.textElement.appendChild(h.createTSpan(""===e.trim()?" ":e.trim(),[["x","0"],["dy","1.2em"]]))})),setTimeout(this.sizeText,10)}},e.prototype.getTextScale=function(){var t=this.textElement.getBBox(),e=1;if(t.width>0&&t.height>0){var i=(1*this.width-this.width*this.padding*2/100)/t.width,n=(1*this.height-this.height*this.padding*2/100)/t.height;e=Math.min(i,n)}return e},e.prototype.getTextPosition=function(t){var e=this.textElement.getBBox(),i=0,n=0;return e.width>0&&e.height>0&&(i=(this.width-e.width*t)/2,n=this.height/2-e.height*t/2),{x:i,y:n}},e.prototype.sizeText=function(){var t=this.textElement.getBBox(),e=this.getTextScale(),i=this.getTextPosition(e);i.y-=t.y*e,navigator.userAgent.indexOf("Edge/")>-1?this.textElement.style.transform="translate("+i.x+"px, "+i.y+"px) scale("+e+", "+e+")":(this.textElement.transform.baseVal.getItem(0).setTranslate(i.x,i.y),this.textElement.transform.baseVal.getItem(1).setScale(e,e))},e.prototype.manipulate=function(e){t.prototype.manipulate.call(this,e),void 0!==this.pointerDownPoint&&(this.isMoved=Math.abs(e.x-this.pointerDownPoint.x)>5||Math.abs(e.y-this.pointerDownPoint.y)>5)},e.prototype.resize=function(e){t.prototype.resize.call(this,e),this.isMoved=!0,this.setSize(),this.sizeText()},e.prototype.setSize=function(){t.prototype.setSize.call(this),this.visual&&this.bgRectangle&&(h.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),h.setAttributes(this.bgRectangle,[["width",this.width.toString()],["height",this.height.toString()]]))},e.prototype.pointerUp=function(e){var i=this.state;"creating"===i&&(this._suppressMarkerCreateEvent=!0),t.prototype.pointerUp.call(this,e),this.setSize(),("creating"===i||!this.isMoved&&Date.now()-this.pointerDownTimestamp>500)&&this.showTextEditor(),this.pointerDownPoint=void 0},e.prototype.showTextEditor=function(){var t=this;this._state="edit",this.overlayContainer.innerHTML="",this.textEditDiv=document.createElement("div"),this.textEditDiv.style.flexGrow="2",this.textEditDiv.style.alignItems="center",this.textEditDiv.style.justifyContent="center",this.textEditDiv.style.pointerEvents="auto",this.textEditDiv.style.overflow="hidden",this.textEditor=document.createElement("div"),this.textEditor.style.position="absolute",this.textEditor.style.fontFamily=this.fontFamily,this.textEditor.style.lineHeight="1em",this.textEditor.innerText=this.text,this.textEditor.contentEditable="true",this.textEditor.style.color=this.color,this.textEditor.style.whiteSpace="pre",this.positionTextEditor(),this.textEditor.addEventListener("pointerup",(function(t){t.stopPropagation()})),this.textEditor.addEventListener("input",(function(){for(var e=Number.parseFloat(t.textEditor.style.fontSize);t.textEditor.clientWidth>=Number.parseInt(t.textEditor.style.maxWidth)&&e>.9;)e-=.1,t.textEditor.style.fontSize=Math.max(e,.9)+"em"})),this.textEditor.addEventListener("keyup",(function(t){t.cancelBubble=!0})),this.textEditor.addEventListener("paste",(function(t){if(t.clipboardData){var e=t.clipboardData.getData("text"),i=window.getSelection();if(!i.rangeCount)return!1;i.deleteFromDocument(),i.getRangeAt(0).insertNode(document.createTextNode(e)),t.preventDefault()}})),this.textEditDiv.addEventListener("pointerup",(function(){t.textEditDivClicked(t.textEditor.innerText)})),this.textEditDiv.appendChild(this.textEditor),this.overlayContainer.appendChild(this.textEditDiv),this.hideVisual(),this.textEditor.focus(),document.execCommand("selectAll")},e.prototype.positionTextEditor=function(){if("edit"===this.state)if(void 0===this.textEditor)this.showTextEditor();else{this.textElement.style.display="";var t=this.getTextScale(),e=this.rotatePoint({x:this.left+this.width/2,y:this.top+this.height/2}),i=this.textElement.getBBox(),n={x:i.width*t,y:i.height*t};e.x-=n.x/2,e.y-=n.y/2,this.textEditor.style.top=e.y+"px",this.textEditor.style.left=e.x+"px",this.textEditor.style.maxWidth=this.overlayContainer.offsetWidth-e.x+"px",this.textEditor.style.fontSize=Math.max(16*t,12)+"px",this.textElement.style.display="none"}},e.prototype.textEditDivClicked=function(t){this.text=t.trim(),this.overlayContainer.innerHTML="",this.renderText(),this.showVisual(),this._suppressMarkerCreateEvent&&(this._suppressMarkerCreateEvent=!1,this.onMarkerCreated&&this.onMarkerCreated(this)),this.stateChanged()},e.prototype.select=function(){t.prototype.select.call(this),"edit"===this.state&&this.textEditDivClicked(this.textEditor.innerText)},e.prototype.deselect=function(){"edit"===this.state&&this.textEditDivClicked(this.textEditor.innerText),t.prototype.deselect.call(this)},e.prototype.dblClick=function(e,i){t.prototype.dblClick.call(this,e,i),this.showTextEditor()},e.prototype.setColor=function(t){this.textElement&&h.setAttributes(this.textElement,[["fill",t]]),this.color=t,this.textEditor&&(this.textEditor.style.color=this.color),this.colorChanged(t)},e.prototype.setFont=function(t){this.textElement&&h.setAttributes(this.textElement,[["font-family",t]]),this.fontFamily=t,this.textEditor&&(this.textEditor.style.fontFamily=this.fontFamily),this.renderText(),this.stateChanged()},e.prototype.hideVisual=function(){this.textElement.style.display="none",this.hideControlBox()},e.prototype.showVisual=function(){"edit"===this.state&&(this._state="select"),this.textElement.style.display="",this.showControlBox()},Object.defineProperty(e.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),e.prototype.getState=function(){var i=Object.assign({color:this.color,fontFamily:this.fontFamily,padding:this.padding,text:this.text},t.prototype.getState.call(this));return i.typeName=e.typeName,i},e.prototype.restoreState=function(e){var i=e;this.color=i.color,this.fontFamily=i.fontFamily,this.padding=i.padding,this.text=i.text,this.createVisual(),t.prototype.restoreState.call(this,e),this.setSize()},e.prototype.scale=function(e,i){t.prototype.scale.call(this,e,i),this.setSize(),this.sizeText(),this.positionTextEditor()},e.typeName="TextMarker",e.title="Text marker",e.icon='<svg viewBox="0 0 24 24"><path d="M9.6 14L12 7.7l2.4 6.3M11 5L5.5 19h2.2l1.1-3H15l1.1 3h2.2L13 5h-2z"/></svg>',e}(S),F=function(t){function e(e,i,n){var o=t.call(this,e,i,n)||this;return o.color="transparent",o.lineWidth=3,o.drawing=!1,o.pixelRatio=1,o.color=n.defaultColor,o.lineWidth=n.defaultStrokeWidth,o.pixelRatio=n.freehandPixelRatio,o.setColor=o.setColor.bind(o),o.addCanvas=o.addCanvas.bind(o),o.finishCreation=o.finishCreation.bind(o),o.setLineWidth=o.setLineWidth.bind(o),o.colorPanel=new v("Color",n.defaultColorSet,n.defaultColor),o.colorPanel.onColorChanged=o.setColor,o.lineWidthPanel=new C("Line width",n.defaultStrokeWidths,n.defaultStrokeWidth),o.lineWidthPanel.onWidthChanged=o.setLineWidth,o}return o(e,t),e.prototype.ownsTarget=function(e){return!(!t.prototype.ownsTarget.call(this,e)&&e!==this.visual&&e!==this.drawingImage)},e.prototype.createVisual=function(){this.visual=h.createGroup(),this.drawingImage=h.createImage(),this.visual.appendChild(this.drawingImage);var t=h.createTransform();this.visual.transform.baseVal.appendItem(t),this.addMarkerVisualToContainer(this.visual)},e.prototype.pointerDown=function(e,i){"new"===this.state&&(this.addCanvas(),this.createVisual(),this._state="creating"),"creating"===this.state?(this.canvasContext.strokeStyle=this.color,this.canvasContext.lineWidth=this.lineWidth,this.canvasContext.beginPath(),this.canvasContext.moveTo(e.x,e.y),this.drawing=!0):t.prototype.pointerDown.call(this,e,i)},e.prototype.manipulate=function(e){"creating"===this.state?this.drawing&&(this.canvasContext.lineTo(e.x,e.y),this.canvasContext.stroke()):t.prototype.manipulate.call(this,e)},e.prototype.resize=function(e){t.prototype.resize.call(this,e),h.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),h.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]])},e.prototype.pointerUp=function(e){"creating"===this._state?this.drawing&&(this.canvasContext.closePath(),this.drawing=!1,this.globalSettings.newFreehandMarkerOnPointerUp&&this.finishCreation()):t.prototype.pointerUp.call(this,e)},e.prototype.addCanvas=function(){this.overlayContainer.innerHTML="",this.canvasElement=document.createElement("canvas"),this.canvasElement.width=this.overlayContainer.clientWidth*this.pixelRatio,this.canvasElement.height=this.overlayContainer.clientHeight*this.pixelRatio,this.canvasContext=this.canvasElement.getContext("2d"),this.canvasContext.scale(this.pixelRatio,this.pixelRatio),this.overlayContainer.appendChild(this.canvasElement)},e.prototype.select=function(){"creating"===this.state&&this.finishCreation(),t.prototype.select.call(this)},e.prototype.deselect=function(){"creating"===this.state&&this.finishCreation(),t.prototype.deselect.call(this)},e.prototype.finishCreation=function(){for(var t=this.canvasContext.getImageData(0,0,this.canvasElement.width,this.canvasElement.height),e=[this.canvasElement.width+1,this.canvasElement.height+1,-1,-1],i=e[0],n=e[1],o=e[2],r=e[3],s=!1,a=0;a<this.canvasElement.height;a++)for(var h=0;h<this.canvasElement.width;h++)t.data[a*this.canvasElement.width*4+4*h+3]>0&&(s=!0,a<n&&(n=a),h<i&&(i=h),a>r&&(r=a),h>o&&(o=h));if(s){this.left=i/this.pixelRatio,this.top=n/this.pixelRatio,this.width=(o-i)/this.pixelRatio,this.height=(r-n)/this.pixelRatio;var l=document.createElement("canvas");l.width=o-i,l.height=r-n,l.getContext("2d").putImageData(this.canvasContext.getImageData(i,n,o-i,r-n),0,0),this.drawingImgUrl=l.toDataURL("image/png"),this.setDrawingImage(),this._state="select",this.onMarkerCreated&&this.onMarkerCreated(this)}this.overlayContainer.innerHTML=""},e.prototype.setDrawingImage=function(){h.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]]),h.setAttributes(this.drawingImage,[["href",this.drawingImgUrl]]),this.moveVisual({x:this.left,y:this.top})},e.prototype.setColor=function(t){this.color=t,this.colorChanged(t)},e.prototype.setLineWidth=function(t){this.lineWidth=t},Object.defineProperty(e.prototype,"toolboxPanels",{get:function(){return"new"===this.state||"creating"===this.state?[this.colorPanel,this.lineWidthPanel]:[]},enumerable:!1,configurable:!0}),e.prototype.getState=function(){var i=Object.assign({drawingImgUrl:this.drawingImgUrl},t.prototype.getState.call(this));return i.typeName=e.typeName,i},e.prototype.restoreState=function(e){this.createVisual(),t.prototype.restoreState.call(this,e),this.drawingImgUrl=e.drawingImgUrl,this.setDrawingImage()},e.prototype.scale=function(e,i){t.prototype.scale.call(this,e,i),this.setDrawingImage()},e.typeName="FreehandMarker",e.title="Freehand marker",e.icon='<svg viewBox="0 0 24 24"><path d="M9.75 20.85c1.78-.7 1.39-2.63.49-3.85-.89-1.25-2.12-2.11-3.36-2.94A9.817 9.817 0 014.54 12c-.28-.33-.85-.94-.27-1.06.59-.12 1.61.46 2.13.68.91.38 1.81.82 2.65 1.34l1.01-1.7C8.5 10.23 6.5 9.32 4.64 9.05c-1.06-.16-2.18.06-2.54 1.21-.32.99.19 1.99.77 2.77 1.37 1.83 3.5 2.71 5.09 4.29.34.33.75.72.95 1.18.21.44.16.47-.31.47-1.24 0-2.79-.97-3.8-1.61l-1.01 1.7c1.53.94 4.09 2.41 5.96 1.79m11.09-15.6c.22-.22.22-.58 0-.79l-1.3-1.3a.562.562 0 00-.78 0l-1.02 1.02 2.08 2.08M11 10.92V13h2.08l6.15-6.15-2.08-2.08L11 10.92z"/></svg>',e}(S),j=function(t){function e(e,i,n){var o=t.call(this,e,n||'<svg viewBox="0 0 24 24"><path d="M8 14v4l-6-6 6-6v4h8V6l6 6-6 6v-4H8z"/></svg>')||this;return o.typeBoxes=[],o.currentType=i,o.setCurrentType=o.setCurrentType.bind(o),o}return o(e,t),e.prototype.getUi=function(){var t=this,e=document.createElement("div");e.style.display="flex",e.style.overflow="hidden",e.style.flexGrow="2";for(var i=function(i){var o="both";switch(i){case 0:o="both";break;case 1:o="start";break;case 2:o="end";break;case 3:o="none"}var r=document.createElement("div");if(r.style.display="flex",r.style.flexGrow="2",r.style.alignItems="center",r.style.justifyContent="space-between",r.style.padding="5px",r.style.borderWidth="2px",r.style.borderStyle="solid",r.style.borderColor=o===n.currentType?n.uiStyleSettings.toolboxAccentColor:"transparent",r.addEventListener("click",(function(){t.setCurrentType(o,r)})),e.appendChild(r),"both"===o||"start"===o){var s=document.createElement("div");s.style.display="flex",s.style.alignItems="center",s.style.minHeight="20px",s.innerHTML='<svg viewBox="0 0 10 10" width="10" height="10" xmlns="http://www.w3.org/2000/svg">\n <polygon points="0,5 10,0 10,10" fill="'+(void 0!==n.uiStyleSettings?n.uiStyleSettings.toolboxColor:"#eeeeee")+'" />\n </svg>',s.style.marginLeft="5px",r.appendChild(s)}var a=document.createElement("div");a.style.display="flex",a.style.alignItems="center",a.style.minHeight="20px",a.style.flexGrow="2";var h=document.createElement("hr");if(h.style.minWidth="20px",h.style.border="0px",h.style.borderTop="3px solid "+(void 0!==n.uiStyleSettings?n.uiStyleSettings.toolboxColor:"#eeeeee"),h.style.flexGrow="2",a.appendChild(h),r.appendChild(a),"both"===o||"end"===o){var l=document.createElement("div");l.style.display="flex",l.style.alignItems="center",l.style.minHeight="20px",l.innerHTML='<svg viewBox="0 0 10 10" width="10" height="10" xmlns="http://www.w3.org/2000/svg">\n <polygon points="0,0 10,5 0,10" fill="'+(void 0!==n.uiStyleSettings?n.uiStyleSettings.toolboxColor:"#eeeeee")+'" />\n </svg>',l.style.marginRight="5px",r.appendChild(l)}n.typeBoxes.push(r)},n=this,o=0;o<4;o++)i(o);return e},e.prototype.setCurrentType=function(t,e){var i=this;this.currentType=t,this.typeBoxes.forEach((function(t){t.style.borderColor=t===e?void 0!==i.uiStyleSettings?i.uiStyleSettings.toolboxAccentColor:"#3080c3":"transparent"})),this.onArrowTypeChanged&&this.onArrowTypeChanged(this.currentType)},e}(y),E=function(t){function e(e,i,n){var o=t.call(this,e,i,n)||this;return o.arrowType="end",o.arrowBaseHeight=10,o.arrowBaseWidth=10,o.getArrowPoints=o.getArrowPoints.bind(o),o.setArrowType=o.setArrowType.bind(o),o.arrowTypePanel=new j("Arrow type","end"),o.arrowTypePanel.onArrowTypeChanged=o.setArrowType,o}return o(e,t),e.prototype.ownsTarget=function(e){return!(!t.prototype.ownsTarget.call(this,e)&&e!==this.arrow1&&e!==this.arrow2)},e.prototype.getArrowPoints=function(t,e){var i=this.arrowBaseWidth+2*this.strokeWidth,n=this.arrowBaseHeight+2*this.strokeWidth;return t-i/2+","+(e+n/2)+" "+t+","+(e-n/2)+" "+(t+i/2)+","+(e+n/2)},e.prototype.createTips=function(){this.arrow1=h.createPolygon(this.getArrowPoints(this.x1,this.y1),[["fill",this.strokeColor]]),this.arrow1.transform.baseVal.appendItem(h.createTransform()),this.visual.appendChild(this.arrow1),this.arrow2=h.createPolygon(this.getArrowPoints(this.x2,this.y2),[["fill",this.strokeColor]]),this.arrow2.transform.baseVal.appendItem(h.createTransform()),this.visual.appendChild(this.arrow2)},e.prototype.pointerDown=function(e,i){t.prototype.pointerDown.call(this,e,i),"creating"===this.state&&this.createTips()},e.prototype.adjustVisual=function(){if(t.prototype.adjustVisual.call(this),this.arrow1&&this.arrow2){this.arrow1.style.display="both"===this.arrowType||"start"===this.arrowType?"":"none",this.arrow2.style.display="both"===this.arrowType||"end"===this.arrowType?"":"none",h.setAttributes(this.arrow1,[["points",this.getArrowPoints(this.x1,this.y1)],["fill",this.strokeColor]]),h.setAttributes(this.arrow2,[["points",this.getArrowPoints(this.x2,this.y2)],["fill",this.strokeColor]]);var e=0;Math.abs(this.x1-this.x2)>.1&&(e=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2));var i=this.arrow1.transform.baseVal.getItem(0);i.setRotate(e,this.x1,this.y1),this.arrow1.transform.baseVal.replaceItem(i,0);var n=this.arrow2.transform.baseVal.getItem(0);n.setRotate(e+180,this.x2,this.y2),this.arrow2.transform.baseVal.replaceItem(n,0)}},e.prototype.setArrowType=function(t){this.arrowType=t,this.adjustVisual(),this.stateChanged()},Object.defineProperty(e.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel,this.arrowTypePanel]},enumerable:!1,configurable:!0}),e.prototype.getState=function(){var i=Object.assign({arrowType:this.arrowType},t.prototype.getState.call(this));return i.typeName=e.typeName,i},e.prototype.restoreState=function(e){t.prototype.restoreState.call(this,e);var i=e;this.arrowType=i.arrowType,this.createTips(),this.adjustVisual()},e.typeName="ArrowMarker",e.title="Arrow marker",e.icon='<svg viewBox="0 0 24 24"><path d="M19 6.41L17.59 5 7 15.59V9H5v10h10v-2H8.41L19 6.41z"/></svg>',e}(A),O=function(t){function e(e,i,n){var o=t.call(this,e,i,n)||this;return o.fillColor=n.defaultFillColor,o.strokeWidth=0,o.fillPanel=new v("Color",n.defaultColorSet,n.defaultFillColor),o.fillPanel.onColorChanged=o.setFillColor,o}return o(e,t),Object.defineProperty(e.prototype,"toolboxPanels",{get:function(){return[this.fillPanel]},enumerable:!1,configurable:!0}),e.prototype.getState=function(){var i=t.prototype.getState.call(this);return i.typeName=e.typeName,i},e.typeName="CoverMarker",e.title="Cover marker",e.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4z"/></svg>',e}(M),I=function(t){function e(e,i,n,o){var r=t.call(this,e,o||'<svg viewBox="0 0 24 24"><path d="M17.66 8L12 2.35 6.34 8A8.02 8.02 0 004 13.64c0 2 .78 4.11 2.34 5.67a7.99 7.99 0 0011.32 0c1.56-1.56 2.34-3.67 2.34-5.67S19.22 9.56 17.66 8M6 14c0-2 .62-3.27 1.76-4.4L12 5.27l4.24 4.38C17.38 10.77 18 12 18 14H6z"/></svg>')||this;return r.opacities=[],r.opacityBoxes=[],r.opacities=i,r.currentOpacity=n,r.setCurrentOpacity=r.setCurrentOpacity.bind(r),r}return o(e,t),e.prototype.getUi=function(){var t=this,e=document.createElement("div");return e.style.display="flex",e.style.overflow="hidden",e.style.flexGrow="2",e.style.justifyContent="space-between",this.opacities.forEach((function(i){var n=document.createElement("div");n.style.display="flex",n.style.alignItems="center",n.style.justifyContent="center",n.style.padding="5px",n.style.borderWidth="2px",n.style.borderStyle="solid",n.style.borderColor=i===t.currentOpacity?t.uiStyleSettings.toolboxAccentColor:"transparent",n.addEventListener("click",(function(){t.setCurrentOpacity(i,n)})),e.appendChild(n);var o=document.createElement("div");o.innerText=100*i+"%",n.appendChild(o),t.opacityBoxes.push(n)})),e},e.prototype.setCurrentOpacity=function(t,e){var i=this;this.currentOpacity=t,this.opacityBoxes.forEach((function(t){t.style.borderColor=t===e?i.uiStyleSettings.toolboxAccentColor:"transparent"})),this.onOpacityChanged&&this.onOpacityChanged(this.currentOpacity)},e}(y),z=function(t){function e(e,i,n){var o=t.call(this,e,i,n)||this;return o.setOpacity=o.setOpacity.bind(o),o.fillColor=n.defaultHighlightColor,o.strokeWidth=0,o.opacity=n.defaultHighlightOpacity,o.fillPanel=new v("Color",n.defaultColorSet,o.fillColor),o.fillPanel.onColorChanged=o.setFillColor,o.opacityPanel=new I("Opacity",n.defaultOpacitySteps,o.opacity),o.opacityPanel.onOpacityChanged=o.setOpacity,o}return o(e,t),e.prototype.setOpacity=function(t){this.opacity=t,this.visual&&h.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(e.prototype,"toolboxPanels",{get:function(){return[this.fillPanel,this.opacityPanel]},enumerable:!1,configurable:!0}),e.prototype.getState=function(){var i=t.prototype.getState.call(this);return i.typeName=e.typeName,i},e.typeName="HighlightMarker",e.title="Highlight marker",e.icon='<svg viewBox="0 0 24 24"><path d="M18.5 1.15c-.53 0-1.04.19-1.43.58l-5.81 5.82 5.65 5.65 5.82-5.81c.77-.78.77-2.04 0-2.83l-2.84-2.83c-.39-.39-.89-.58-1.39-.58M10.3 8.5l-5.96 5.96c-.78.78-.78 2.04.02 2.85C3.14 18.54 1.9 19.77.67 21h5.66l.86-.86c.78.76 2.03.75 2.81-.02l5.95-5.96"/></svg>',e}(O),R='<svg viewBox="0 0 24 24"><path d="M9.62 12L12 5.67 14.37 12M11 3L5.5 17h2.25l1.12-3h6.25l1.13 3h2.25L13 3h-2z"/></svg>',V='<svg viewBox="0 0 24 24"><path d="M19 11.5s-2 2.17-2 3.5a2 2 0 002 2 2 2 0 002-2c0-1.33-2-3.5-2-3.5M5.21 10L10 5.21 14.79 10m1.77-1.06L7.62 0 6.21 1.41l2.38 2.38-5.15 5.15c-.59.56-.59 1.53 0 2.12l5.5 5.5c.29.29.68.44 1.06.44s.77-.15 1.06-.44l5.5-5.5c.59-.59.59-1.56 0-2.12z"/></svg>',G=function(t){function e(e,i,n){var o=t.call(this,e,i,n)||this;return o.bgColor="transparent",o.tipPosition={x:0,y:0},o.tipBase1Position={x:0,y:0},o.tipBase2Position={x:0,y:0},o.tipMoving=!1,o.color=n.defaultStrokeColor,o.bgColor=n.defaultFillColor,o.fontFamily=n.defaultFontFamily,o.defaultSize={x:100,y:30},o.setBgColor=o.setBgColor.bind(o),o.getTipPoints=o.getTipPoints.bind(o),o.positionTip=o.positionTip.bind(o),o.setTipPoints=o.setTipPoints.bind(o),o.colorPanel=new v("Text color",n.defaultColorSet,o.color,R),o.colorPanel.onColorChanged=o.setColor,o.bgColorPanel=new v("Fill color",n.defaultColorSet,o.bgColor,V),o.bgColorPanel.onColorChanged=o.setBgColor,o.fontFamilyPanel=new B("Font",n.defaultFontFamilies,n.defaultFontFamily),o.fontFamilyPanel.onFontChanged=o.setFont,o.tipGrip=new w,o.tipGrip.visual.transform.baseVal.appendItem(h.createTransform()),o.controlBox.appendChild(o.tipGrip.visual),o}return o(e,t),e.prototype.ownsTarget=function(e){return t.prototype.ownsTarget.call(this,e)||this.tipGrip.ownsTarget(e)||this.tip===e},e.prototype.createTip=function(){h.setAttributes(this.bgRectangle,[["fill",this.bgColor],["rx","10px"]]),this.tip=h.createPolygon(this.getTipPoints(),[["fill",this.bgColor]]),this.visual.appendChild(this.tip)},e.prototype.pointerDown=function(e,i){"new"===this.state&&t.prototype.pointerDown.call(this,e,i),"creating"===this.state?this.createTip():this.tipGrip.ownsTarget(i)?(this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.tipMoving=!0):t.prototype.pointerDown.call(this,e,i)},e.prototype.pointerUp=function(e){if(this.tipMoving)this.tipMoving=!1,this.isMoved=!0,t.prototype.pointerUp.call(this,e);else{var i="creating"===this.state;t.prototype.pointerUp.call(this,e),this.setTipPoints(i),this.positionTip()}},e.prototype.manipulate=function(e){if(this.tipMoving){var i=this.unrotatePoint(e);this.tipPosition={x:i.x-this.manipulationStartLeft,y:i.y-this.manipulationStartTop},this.positionTip()}else t.prototype.manipulate.call(this,e)},e.prototype.setBgColor=function(t){this.bgRectangle&&this.tip&&(h.setAttributes(this.bgRectangle,[["fill",t]]),h.setAttributes(this.tip,[["fill",t]])),this.bgColor=t,this.fillColorChanged(t)},e.prototype.getTipPoints=function(){return this.setTipPoints("creating"===this.state),this.tipBase1Position.x+","+this.tipBase1Position.y+" "+this.tipBase2Position.x+","+this.tipBase2Position.y+" "+this.tipPosition.x+","+this.tipPosition.y},e.prototype.setTipPoints=function(t){void 0===t&&(t=!1);var e=Math.min(this.height/2,15),i=this.height/5;t&&(this.tipPosition={x:e+i/2,y:this.height+20});var n=Math.atan(this.height/2/(this.width/2));this.tipPosition.x<this.width/2&&this.tipPosition.y<this.height/2?n<Math.atan((this.height/2-this.tipPosition.y)/(this.width/2-this.tipPosition.x))?(i=this.width/5,e=Math.min(this.width/2,15),this.tipBase1Position={x:e,y:0},this.tipBase2Position={x:e+i,y:0}):(this.tipBase1Position={x:0,y:e},this.tipBase2Position={x:0,y:e+i}):this.tipPosition.x>=this.width/2&&this.tipPosition.y<this.height/2?n<Math.atan((this.height/2-this.tipPosition.y)/(this.tipPosition.x-this.width/2))?(i=this.width/5,e=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-e-i,y:0},this.tipBase2Position={x:this.width-e,y:0}):(this.tipBase1Position={x:this.width,y:e},this.tipBase2Position={x:this.width,y:e+i}):this.tipPosition.x>=this.width/2&&this.tipPosition.y>=this.height/2?n<Math.atan((this.tipPosition.y-this.height/2)/(this.tipPosition.x-this.width/2))?(i=this.width/5,e=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-e-i,y:this.height},this.tipBase2Position={x:this.width-e,y:this.height}):(this.tipBase1Position={x:this.width,y:this.height-e-i},this.tipBase2Position={x:this.width,y:this.height-e}):n<Math.atan((this.tipPosition.y-this.height/2)/(this.width/2-this.tipPosition.x))?(i=this.width/5,e=Math.min(this.width/2,15),this.tipBase1Position={x:e,y:this.height},this.tipBase2Position={x:e+i,y:this.height}):(this.tipBase1Position={x:0,y:this.height-e},this.tipBase2Position={x:0,y:this.height-e-i})},e.prototype.resize=function(e){t.prototype.resize.call(this,e),this.positionTip()},e.prototype.positionTip=function(){h.setAttributes(this.tip,[["points",this.getTipPoints()]]);var t=this.tipGrip.visual.transform.baseVal.getItem(0);t.setTranslate(this.tipPosition.x,this.tipPosition.y),this.tipGrip.visual.transform.baseVal.replaceItem(t,0)},Object.defineProperty(e.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.bgColorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),e.prototype.select=function(){this.positionTip(),t.prototype.select.call(this)},e.prototype.getState=function(){var i=Object.assign({bgColor:this.bgColor,tipPosition:this.tipPosition},t.prototype.getState.call(this));return i.typeName=e.typeName,i},e.prototype.restoreState=function(e){var i=e;this.bgColor=i.bgColor,this.tipPosition=i.tipPosition,t.prototype.restoreState.call(this,e),this.createTip(),this.setTipPoints()},e.prototype.scale=function(e,i){t.prototype.scale.call(this,e,i),this.tipPosition={x:this.tipPosition.x*e,y:this.tipPosition.y*i},this.positionTip()},e.typeName="CalloutMarker",e.title="Callout marker",e.icon='<svg viewBox="0 0 24 24"><path d="M4 2h16a2 2 0 012 2v12a2 2 0 01-2 2h-4l-4 4-4-4H4a2 2 0 01-2-2V4a2 2 0 012-2m0 2v12h4.83L12 19.17 15.17 16H20V4H4m2 3h12v2H6V7m0 4h10v2H6v-2z"/></svg>',e}(D),H=function(t){function e(e,i,n){var o=t.call(this,e,i,n)||this;return o.fillColor="transparent",o.strokeColor="transparent",o.strokeWidth=0,o.strokeDasharray="",o.opacity=1,o.strokeColor=n.defaultColor,o.strokeWidth=n.defaultStrokeWidth,o.strokeDasharray=n.defaultStrokeDasharray,o.fillColor=n.defaultFillColor,o.setStrokeColor=o.setStrokeColor.bind(o),o.setFillColor=o.setFillColor.bind(o),o.setStrokeWidth=o.setStrokeWidth.bind(o),o.setStrokeDasharray=o.setStrokeDasharray.bind(o),o.setOpacity=o.setOpacity.bind(o),o.createVisual=o.createVisual.bind(o),o.strokePanel=new v("Line color",a(n.defaultColorSet,["transparent"]),n.defaultColor),o.strokePanel.onColorChanged=o.setStrokeColor,o.fillPanel=new v("Fill color",a(n.defaultColorSet,["transparent"]),o.fillColor,V),o.fillPanel.onColorChanged=o.setFillColor,o.strokeWidthPanel=new C("Line width",n.defaultStrokeWidths,n.defaultStrokeWidth),o.strokeWidthPanel.onWidthChanged=o.setStrokeWidth,o.strokeStylePanel=new P("Line style",n.defaultStrokeDasharrays,n.defaultStrokeDasharray),o.strokeStylePanel.onStyleChanged=o.setStrokeDasharray,o.opacityPanel=new I("Opacity",n.defaultOpacitySteps,o.opacity),o.opacityPanel.onOpacityChanged=o.setOpacity,o}return o(e,t),e.prototype.ownsTarget=function(e){return!(!t.prototype.ownsTarget.call(this,e)&&e!==this.visual)},e.prototype.createVisual=function(){this.visual=h.createEllipse(this.width/2,this.height/2,[["fill",this.fillColor],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()],["stroke-dasharray",this.strokeDasharray],["opacity",this.opacity.toString()]]),this.addMarkerVisualToContainer(this.visual)},e.prototype.pointerDown=function(e,i){t.prototype.pointerDown.call(this,e,i),"new"===this.state&&(this.createVisual(),this.moveVisual(e),this._state="creating")},e.prototype.manipulate=function(e){t.prototype.manipulate.call(this,e)},e.prototype.resize=function(e){t.prototype.resize.call(this,e),this.setSize()},e.prototype.setSize=function(){t.prototype.setSize.call(this),h.setAttributes(this.visual,[["cx",(this.width/2).toString()],["cy",(this.height/2).toString()],["rx",(this.width/2).toString()],["ry",(this.height/2).toString()]])},e.prototype.pointerUp=function(e){t.prototype.pointerUp.call(this,e),this.setSize()},e.prototype.setStrokeColor=function(t){this.strokeColor=t,this.visual&&h.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(t),this.stateChanged()},e.prototype.setFillColor=function(t){this.fillColor=t,this.visual&&h.setAttributes(this.visual,[["fill",this.fillColor]]),this.fillColorChanged(t),this.stateChanged()},e.prototype.setStrokeWidth=function(t){this.strokeWidth=t,this.visual&&h.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},e.prototype.setStrokeDasharray=function(t){this.strokeDasharray=t,this.visual&&h.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},e.prototype.setOpacity=function(t){this.opacity=t,this.visual&&h.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(e.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.fillPanel,this.strokeWidthPanel,this.strokeStylePanel,this.opacityPanel]},enumerable:!1,configurable:!0}),e.prototype.getState=function(){var i=Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},t.prototype.getState.call(this));return i.typeName=e.typeName,i},e.prototype.restoreState=function(e){var i=e;this.fillColor=i.fillColor,this.strokeColor=i.strokeColor,this.strokeWidth=i.strokeWidth,this.strokeDasharray=i.strokeDasharray,this.opacity=i.opacity,this.createVisual(),t.prototype.restoreState.call(this,e),this.setSize()},e.prototype.scale=function(e,i){t.prototype.scale.call(this,e,i),this.setSize()},e.typeName="EllipseMarker",e.title="Ellipse marker",e.icon='<svg viewBox="0 0 24 24"><path d="M12 4C6.5 4 2 7.58 2 12s4.5 8 10 8 10-3.58 10-8-4.5-8-10-8z"/></svg>',e}(S),Y=function(t){function e(e,i,n){return t.call(this,e,i,n)||this}return o(e,t),Object.defineProperty(e.prototype,"tipLength",{get:function(){return 10+3*this.strokeWidth},enumerable:!1,configurable:!0}),e.prototype.ownsTarget=function(e){return!(!t.prototype.ownsTarget.call(this,e)&&e!==this.tip1&&e!==this.tip2)},e.prototype.createTips=function(){this.tip1=h.createLine(this.x1-this.tipLength/2,this.y1,this.x1+this.tipLength/2,this.y1,[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),this.tip1.transform.baseVal.appendItem(h.createTransform()),this.visual.appendChild(this.tip1),this.tip2=h.createLine(this.x2-this.tipLength/2,this.y2,this.x2+this.tipLength/2,this.y2,[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),this.tip2.transform.baseVal.appendItem(h.createTransform()),this.visual.appendChild(this.tip2)},e.prototype.pointerDown=function(e,i){t.prototype.pointerDown.call(this,e,i),"creating"===this.state&&this.createTips()},e.prototype.adjustVisual=function(){if(t.prototype.adjustVisual.call(this),this.tip1&&this.tip2&&(h.setAttributes(this.tip1,[["x1",(this.x1-this.tipLength/2).toString()],["y1",this.y1.toString()],["x2",(this.x1+this.tipLength/2).toString()],["y2",this.y1.toString()],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),h.setAttributes(this.tip2,[["x1",(this.x2-this.tipLength/2).toString()],["y1",this.y2.toString()],["x2",(this.x2+this.tipLength/2).toString()],["y2",this.y2.toString()],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),Math.abs(this.x1-this.x2)>.1)){var e=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),i=this.tip1.transform.baseVal.getItem(0);i.setRotate(e,this.x1,this.y1),this.tip1.transform.baseVal.replaceItem(i,0);var n=this.tip2.transform.baseVal.getItem(0);n.setRotate(e+180,this.x2,this.y2),this.tip2.transform.baseVal.replaceItem(n,0)}},Object.defineProperty(e.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),e.prototype.getState=function(){var i=t.prototype.getState.call(this);return i.typeName=e.typeName,i},e.prototype.restoreState=function(e){t.prototype.restoreState.call(this,e),this.createTips(),this.adjustVisual()},e.typeName="MeasurementMarker",e.title="Measurement marker",e.icon='<svg viewBox="0 0 24 24"><path d="M1.39 18.36l1.77-1.76L4.58 18l1.06-1.05-1.42-1.41 1.42-1.42 2.47 2.48 1.06-1.06-2.47-2.48 1.41-1.41 1.42 1.41L10.59 12l-1.42-1.41 1.42-1.42 2.47 2.48 1.06-1.06-2.47-2.48 1.41-1.41 1.41 1.41 1.07-1.06-1.42-1.41 1.42-1.42L18 6.7l1.07-1.06-2.47-2.48 1.76-1.77 4.25 4.25L5.64 22.61l-4.25-4.25z"/></svg>',e}(A),X=function(t){function e(e,i,n){var o=t.call(this,e,i,n)||this;return o.strokePanel.colors=n.defaultColorSet,o.fillColor="transparent",o}return o(e,t),Object.defineProperty(e.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),e.prototype.getState=function(){var i=t.prototype.getState.call(this);return i.typeName=e.typeName,i},e.typeName="EllipseFrameMarker",e.title="Ellipse frame marker",e.icon='<svg viewBox="0 0 24 24"><path d="M12 6c4.41 0 8 2.69 8 6s-3.59 6-8 6-8-2.69-8-6 3.59-6 8-6m0-2C6.5 4 2 7.58 2 12s4.5 8 10 8 10-3.58 10-8-4.5-8-10-8z"/></svg>',e}(H),U=function(){function t(){this.undoStack=[],this.redoStack=[]}return Object.defineProperty(t.prototype,"isUndoPossible",{get:function(){return this.undoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isRedoPossible",{get:function(){return this.redoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"undoStepCount",{get:function(){return this.undoStack.length},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"redoStepCount",{get:function(){return this.redoStack.length},enumerable:!1,configurable:!0}),t.prototype.addUndoStep=function(t){0!==this.undoStack.length&&JSON.stringify(this.undoStack[this.undoStack.length-1])===JSON.stringify(t)||(this.undoStack.push(t),JSON.stringify(this.lastRedoStep)!==JSON.stringify(t)&&this.redoStack.splice(0,this.redoStack.length))},t.prototype.replaceLastUndoStep=function(t){this.undoStack.length>0&&(this.undoStack[this.undoStack.length-1]=t)},t.prototype.getLastUndoStep=function(){return this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0},t.prototype.undo=function(){if(this.undoStack.length>1){var t=this.undoStack.pop();return void 0!==t&&this.redoStack.push(t),this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0}},t.prototype.redo=function(){return this.lastRedoStep=this.redoStack.pop(),this.lastRedoStep},t}(),q=function(t){function e(e,i,n){var o=t.call(this,e,i,n)||this;return o.strokeColor="transparent",o.strokeWidth=0,o.strokeDasharray="",o.curveX=0,o.curveY=0,o.manipulationStartCurveX=0,o.manipulationStartCurveY=0,o.setStrokeColor=o.setStrokeColor.bind(o),o.setStrokeWidth=o.setStrokeWidth.bind(o),o.setStrokeDasharray=o.setStrokeDasharray.bind(o),o.positionGrips=o.positionGrips.bind(o),o.addControlGrips=o.addControlGrips.bind(o),o.adjustVisual=o.adjustVisual.bind(o),o.setupControlBox=o.setupControlBox.bind(o),o.resize=o.resize.bind(o),o.strokeColor=n.defaultColor,o.strokeWidth=n.defaultStrokeWidth,o.strokeDasharray=n.defaultStrokeDasharray,o.strokePanel=new v("Line color",n.defaultColorSet,n.defaultColor),o.strokePanel.onColorChanged=o.setStrokeColor,o.strokeWidthPanel=new C("Line width",n.defaultStrokeWidths,n.defaultStrokeWidth),o.strokeWidthPanel.onWidthChanged=o.setStrokeWidth,o.strokeStylePanel=new P("Line style",n.defaultStrokeDasharrays,n.defaultStrokeDasharray),o.strokeStylePanel.onStyleChanged=o.setStrokeDasharray,o}return o(e,t),e.prototype.ownsTarget=function(e){return!(!t.prototype.ownsTarget.call(this,e)&&e!==this.visual&&e!==this.selectorCurve&&e!==this.visibleCurve&&!this.curveGrip.ownsTarget(e))},e.prototype.getPathD=function(){return"M "+this.x1+" "+this.y1+" Q "+this.curveX+" "+this.curveY+", "+this.x2+" "+this.y2},e.prototype.createVisual=function(){this.visual=h.createGroup(),this.selectorCurve=h.createPath(this.getPathD(),[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()],["fill","transparent"]]),this.visibleCurve=h.createPath(this.getPathD(),[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()],["fill","transparent"]]),this.visual.appendChild(this.selectorCurve),this.visual.appendChild(this.visibleCurve),this.addMarkerVisualToContainer(this.visual)},e.prototype.pointerDown=function(e,i){t.prototype.pointerDown.call(this,e,i),this.manipulationStartCurveX=this.curveX,this.manipulationStartCurveY=this.curveY,"new"===this.state&&(this.curveX=e.x,this.curveY=e.y),"new"===this.state?(this.createVisual(),this.adjustVisual(),this._state="creating"):this.curveGrip.ownsTarget(i)&&(this.activeGrip=this.curveGrip,this._state="resize")},e.prototype.adjustVisual=function(){this.selectorCurve&&this.visibleCurve&&(this.selectorCurve.setAttribute("d",this.getPathD()),this.visibleCurve.setAttribute("d",this.getPathD()),h.setAttributes(this.visibleCurve,[["stroke",this.strokeColor]]),h.setAttributes(this.visibleCurve,[["stroke-width",this.strokeWidth.toString()]]),h.setAttributes(this.visibleCurve,[["stroke-dasharray",this.strokeDasharray.toString()]]))},e.prototype.setupControlBox=function(){t.prototype.setupControlBox.call(this),this.curveControlLine1=h.createLine(this.x1,this.y1,this.curveX,this.curveY,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.curveControlLine2=h.createLine(this.x2,this.y2,this.curveX,this.curveY,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.controlBox.insertBefore(this.curveControlLine1,this.controlBox.firstChild),this.controlBox.insertBefore(this.curveControlLine2,this.controlBox.firstChild)},e.prototype.addControlGrips=function(){this.curveGrip=this.createGrip(),this.curveX=0,this.curveY=0,t.prototype.addControlGrips.call(this)},e.prototype.positionGrips=function(){t.prototype.positionGrips.call(this);var e=this.curveGrip.GRIP_SIZE;this.positionGrip(this.curveGrip.visual,this.curveX-e/2,this.curveY-e/2),this.curveControlLine1&&this.curveControlLine2&&(this.curveControlLine1.setAttribute("x1",this.x1.toString()),this.curveControlLine1.setAttribute("y1",this.y1.toString()),this.curveControlLine1.setAttribute("x2",this.curveX.toString()),this.curveControlLine1.setAttribute("y2",this.curveY.toString()),this.curveControlLine2.setAttribute("x1",this.x2.toString()),this.curveControlLine2.setAttribute("y1",this.y2.toString()),this.curveControlLine2.setAttribute("x2",this.curveX.toString()),this.curveControlLine2.setAttribute("y2",this.curveY.toString()))},e.prototype.manipulate=function(e){"move"===this.state&&(this.curveX=this.manipulationStartCurveX+e.x-this.manipulationStartX,this.curveY=this.manipulationStartCurveY+e.y-this.manipulationStartY),t.prototype.manipulate.call(this,e)},e.prototype.resize=function(e){this.activeGrip===this.curveGrip&&(this.curveX=e.x,this.curveY=e.y),t.prototype.resize.call(this,e),"creating"===this.state&&(this.curveX=this.x1+(this.x2-this.x1)/2,this.curveY=this.y1+(this.y2-this.y1)/2)},e.prototype.setStrokeColor=function(t){this.strokeColor=t,this.adjustVisual(),this.colorChanged(t)},e.prototype.setStrokeWidth=function(t){this.strokeWidth=t,this.adjustVisual()},e.prototype.setStrokeDasharray=function(t){this.strokeDasharray=t,this.adjustVisual()},e.prototype.scale=function(e,i){this.curveX=this.curveX*e,this.curveY=this.curveY*i,t.prototype.scale.call(this,e,i)},Object.defineProperty(e.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),e.prototype.getState=function(){var i=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,curveX:this.curveX,curveY:this.curveY},t.prototype.getState.call(this));return i.typeName=e.typeName,i},e.prototype.restoreState=function(e){t.prototype.restoreState.call(this,e);var i=e;this.strokeColor=i.strokeColor,this.strokeWidth=i.strokeWidth,this.strokeDasharray=i.strokeDasharray,this.curveX=i.curveX,this.curveY=i.curveY,this.createVisual(),this.adjustVisual()},e.typeName="CurveMarker",e.title="Curve marker",e.icon='<svg viewBox="0 0 24 24"><path d="M18.5 2A1.5 1.5 0 0120 3.5 1.5 1.5 0 0118.5 5c-.23 0-.45-.05-.65-.15l-3.69 3.7.34.45c2.19-1.26 4.76-2 7.5-2l1 .03v2.01L22 9c-2.58 0-5 .75-7 2.04A3.96 3.96 0 0111.04 15C9.75 17 9 19.42 9 22l.04 1H7.03L7 22c0-2.74.74-5.31 2-7.5l-.45-.34-3.7 3.69c.1.2.15.42.15.65A1.5 1.5 0 013.5 20 1.5 1.5 0 012 18.5 1.5 1.5 0 013.5 17c.23 0 .45.05.65.15l3.69-3.7C7.31 12.78 7 11.92 7 11a4 4 0 014-4c.92 0 1.78.31 2.45.84l3.7-3.69c-.1-.2-.15-.42-.15-.65A1.5 1.5 0 0118.5 2M11 9a2 2 0 00-2 2 2 2 0 002 2 2 2 0 002-2 2 2 0 00-2-2z"/></svg>',e}(L),W=function(t){function e(e,i,n){var o=t.call(this,e,i,n)||this;return o.fillColor="transparent",o.strokeColor="transparent",o.strokeWidth=0,o.strokeDasharray="",o.textColor="transparent",o.fontSize="1rem",o.isMoved=!1,o.captionText="Caption",o.PADDING=5,o.captionBoxWidth=0,o.captionBoxHeight=0,o.strokeColor=n.defaultColor,o.strokeWidth=n.defaultStrokeWidth,o.strokeDasharray=n.defaultStrokeDasharray,o.fillColor=n.defaultFillColor,o.textColor=n.defaultStrokeColor,o.fontFamily=n.defaultFontFamily,o.fontSize=n.defaultCaptionFontSize,o.captionText=n.defaultCaptionText,o.setStrokeColor=o.setStrokeColor.bind(o),o.setFillColor=o.setFillColor.bind(o),o.setStrokeWidth=o.setStrokeWidth.bind(o),o.setStrokeDasharray=o.setStrokeDasharray.bind(o),o.createVisual=o.createVisual.bind(o),o.sizeCaption=o.sizeCaption.bind(o),o.setCaptionText=o.setCaptionText.bind(o),o.showTextEditor=o.showTextEditor.bind(o),o.positionTextEditor=o.positionTextEditor.bind(o),o.finishTextEditing=o.finishTextEditing.bind(o),o.setFont=o.setFont.bind(o),o.setTextColor=o.setTextColor.bind(o),o.strokePanel=new v("Line color",a(n.defaultColorSet,["transparent"]),o.strokeColor),o.strokePanel.onColorChanged=o.setStrokeColor,o.fillPanel=new v("Fill color",a(n.defaultColorSet,["transparent"]),o.fillColor,V),o.fillPanel.onColorChanged=o.setFillColor,o.strokeWidthPanel=new C("Line width",n.defaultStrokeWidths,n.defaultStrokeWidth),o.strokeWidthPanel.onWidthChanged=o.setStrokeWidth,o.strokeStylePanel=new P("Line style",n.defaultStrokeDasharrays,n.defaultStrokeDasharray),o.strokeStylePanel.onStyleChanged=o.setStrokeDasharray,o.fontFamilyPanel=new B("Font",n.defaultFontFamilies,n.defaultFontFamily),o.fontFamilyPanel.onFontChanged=o.setFont,o.textColorPanel=new v("Text color",n.defaultColorSet,o.textColor,R),o.textColorPanel.onColorChanged=o.setTextColor,o}return o(e,t),e.prototype.ownsTarget=function(e){return!(!t.prototype.ownsTarget.call(this,e)&&e!==this.visual&&e!==this.frame&&e!==this.captionBg&&e!==this.captionElement)},e.prototype.createVisual=function(){this.visual=h.createGroup(),this.addMarkerVisualToContainer(this.visual),this.captionBg=h.createRect(1,1,[["fill",this.fillColor]]),this.visual.appendChild(this.captionBg),this.captionElement=h.createText([["fill",this.textColor],["font-family",this.fontFamily]]),this.captionElement.style.fontSize=this.fontSize,this.captionElement.style.textAnchor="start",this.captionElement.style.dominantBaseline="text-before-edge",this.captionElement.textContent=this.captionText,this.visual.appendChild(this.captionElement),this.frame=h.createRect(this.width,this.height,[["fill","transparent"],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()],["stroke-dasharray",this.strokeDasharray]]),this.visual.appendChild(this.frame),this.sizeCaption()},e.prototype.setCaptionText=function(t){this.captionText=t,this.captionElement.textContent=this.captionText,this.sizeCaption()},e.prototype.pointerDown=function(e,i){t.prototype.pointerDown.call(this,e,i),this.isMoved=!1,this.pointerDownPoint=e,this.pointerDownTimestamp=Date.now(),"new"===this.state&&(this.createVisual(),this.moveVisual(e),this._state="creating")},e.prototype.manipulate=function(e){t.prototype.manipulate.call(this,e),void 0!==this.pointerDownPoint&&(this.isMoved=Math.abs(e.x-this.pointerDownPoint.x)>5||Math.abs(e.y-this.pointerDownPoint.y)>5)},e.prototype.resize=function(e){t.prototype.resize.call(this,e),this.setSize()},e.prototype.sizeCaption=function(){var t=this.captionElement.getBBox();""!==this.captionText.trim()?(this.captionBoxWidth=t.width+2*this.PADDING,this.captionBoxHeight=t.height+2*this.PADDING):(this.captionBoxWidth=0,this.captionBoxHeight=0),h.setAttributes(this.captionBg,[["width",this.captionBoxWidth.toString()],["height",this.captionBoxHeight.toString()],["clip-path","path('M0,0 H"+this.width+" V"+this.height+" H"+-this.width+" Z')"]]),h.setAttributes(this.captionElement,[["x",this.PADDING.toString()],["y",this.PADDING.toString()],["clip-path","path('M0,0 H"+(this.width-this.PADDING)+" V"+this.height+" H"+(-this.width-this.PADDING)+" Z')"]])},e.prototype.showTextEditor=function(){var t=this;this._state="edit",this.overlayContainer.innerHTML="",this.textEditDiv=document.createElement("div"),this.textEditDiv.style.flexGrow="2",this.textEditDiv.style.alignItems="center",this.textEditDiv.style.justifyContent="center",this.textEditDiv.style.pointerEvents="auto",this.textEditDiv.style.overflow="hidden",this.textEditBox=document.createElement("input"),this.textEditBox.style.position="absolute",this.textEditBox.style.width=this.width+"px",this.captionBoxHeight>0&&(this.textEditBox.style.height=this.captionBoxHeight+"px"),this.textEditBox.style.fontSize=this.fontSize,this.textEditBox.style.fontFamily=this.fontFamily,this.textEditBox.style.backgroundColor=this.fillColor,this.textEditBox.style.color=this.textColor,this.textEditBox.style.borderWidth="0",this.textEditBox.setAttribute("value",this.captionText),this.textEditBox.select(),this.textEditDiv.appendChild(this.textEditBox),this.overlayContainer.appendChild(this.textEditDiv),this.textEditBox.addEventListener("pointerup",(function(t){t.stopPropagation()})),this.textEditBox.addEventListener("keypress",(function(e){"Enter"===e.key&&t.finishTextEditing(t.textEditBox.value)})),this.textEditBox.addEventListener("keyup",(function(t){t.cancelBubble=!0})),this.textEditBox.addEventListener("blur",(function(){t.finishTextEditing(t.textEditBox.value)})),this.textEditDiv.addEventListener("pointerup",(function(){t.finishTextEditing(t.textEditBox.value)})),this.positionTextEditor(),this.textEditBox.focus()},e.prototype.positionTextEditor=function(){"edit"===this.state&&(void 0===this.textEditBox?this.showTextEditor():(this.textEditBox.style.left=this.left+"px",this.textEditBox.style.top=this.top+"px",this.textEditBox.style.transform="rotate("+this.rotationAngle+"deg)",this.textEditBox.style.transformOrigin=this.width/2+"px "+this.height/2+"px"))},e.prototype.finishTextEditing=function(t){this.setCaptionText(t.trim()),this.overlayContainer.innerHTML="",this.stateChanged()},e.prototype.setFont=function(t){this.captionElement&&h.setAttributes(this.captionElement,[["font-family",t]]),this.fontFamily=t,this.textEditBox&&(this.textEditBox.style.fontFamily=this.fontFamily),this.sizeCaption(),this.stateChanged()},e.prototype.setTextColor=function(t){this.captionElement&&h.setAttributes(this.captionElement,[["fill",t]]),this.textColor=t,this.textEditBox&&(this.textEditBox.style.color=this.textColor),this.stateChanged()},e.prototype.setSize=function(){t.prototype.setSize.call(this),h.setAttributes(this.frame,[["width",this.width.toString()],["height",this.height.toString()]]),this.sizeCaption()},e.prototype.pointerUp=function(e){t.prototype.pointerUp.call(this,e),this.setSize(),!this.isMoved&&Date.now()-this.pointerDownTimestamp>500&&this.showTextEditor(),this.pointerDownPoint=void 0},e.prototype.dblClick=function(e,i){t.prototype.dblClick.call(this,e,i),this.showTextEditor()},e.prototype.setStrokeColor=function(t){this.strokeColor=t,this.frame&&h.setAttributes(this.frame,[["stroke",this.strokeColor]]),this.colorChanged(t),this.stateChanged()},e.prototype.setFillColor=function(t){this.fillColor=t,this.captionBg&&h.setAttributes(this.captionBg,[["fill",this.fillColor]]),this.fillColorChanged(t),this.stateChanged()},e.prototype.setStrokeWidth=function(t){this.strokeWidth=t,this.frame&&h.setAttributes(this.frame,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},e.prototype.setStrokeDasharray=function(t){this.strokeDasharray=t,this.frame&&h.setAttributes(this.frame,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},Object.defineProperty(e.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.fillPanel,this.strokeWidthPanel,this.strokeStylePanel,this.fontFamilyPanel,this.textColorPanel]},enumerable:!1,configurable:!0}),e.prototype.getState=function(){var e=Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:1,textColor:this.textColor,fontFamily:this.fontFamily,fontSize:this.fontSize,captionText:this.captionText},t.prototype.getState.call(this));return e.typeName=this.typeName,e},e.prototype.restoreState=function(e){var i=e;this.fillColor=i.fillColor,this.strokeColor=i.strokeColor,this.strokeWidth=i.strokeWidth,this.strokeDasharray=i.strokeDasharray,this.textColor=i.textColor,this.fontFamily=i.fontFamily,this.captionText=i.captionText,this.fontSize=i.fontSize,this.createVisual(),t.prototype.restoreState.call(this,e),this.setSize()},e.prototype.scale=function(e,i){t.prototype.scale.call(this,e,i),this.setSize()},e.typeName="CaptionFrameMarker",e.title="Caption frame marker",e.icon='<svg viewBox="0 0 24 24"><path d="M5 3c-1.11 0-2 .89-2 2v14c0 1.11.89 2 2 2h14c1.11 0 2-.89 2-2V5c0-1.11-.89-2-2-2H5m0 2h14v14H5V5m2 2v2h10V7H7z"/></svg>',e}(S),K=function(){function t(t,e){void 0===e&&(e=!1),this.cancelable=!1,this._defaultPrevented=!1,this.markerArea=t,this.cancelable=e}return Object.defineProperty(t.prototype,"defaultPrevented",{get:function(){return this._defaultPrevented},enumerable:!1,configurable:!0}),t.prototype.preventDefault=function(){this._defaultPrevented=!0},t}(),_=function(t){function e(e,i,n){var o=t.call(this,e,!1)||this;return o.dataUrl=i,o.state=n,o}return o(e,t),e}(K),$=function(t){function e(e,i,n){void 0===n&&(n=!1);var o=t.call(this,e,n)||this;return o.marker=i,o}return o(e,t),e}(K),J=function(){function t(){this.render=[],this.beforeclose=[],this.close=[],this.show=[],this.restorestate=[],this.statechange=[],this.markerselect=[],this.markerdeselect=[],this.markercreating=[],this.markercreate=[],this.markerbeforedelete=[],this.markerdelete=[],this.markerchange=[],this.focus=[],this.blur=[]}return t.prototype.addEventListener=function(t,e){this[t].push(e)},t.prototype.removeEventListener=function(t,e){var i=this[t].indexOf(e);i>-1&&this[t].splice(i,1)},t}(),Z=function(){function t(e){this.touchPoints=0,this._availableMarkerTypes=this.DEFAULT_MARKER_TYPES,this.mode="select",this.markers=[],this.isDragging=!1,this.renderEventListeners=[],this.closeEventListeners=[],this.settings=new N,this._isOpen=!1,this.undoRedoManager=new U,this.renderAtNaturalSize=!1,this.renderImageType="image/png",this.renderMarkersOnly=!1,this.zoomSteps=[1,1.5,2,4],this._zoomLevel=1,this._isResizing=!1,this.prevPanPoint={x:0,y:0},this.eventListeners=new J,this._silentRenderMode=!1,this._isFocused=!1,this._instanceNo=t.instanceCounter++,this.styles=new d(this.instanceNo),this.uiStyleSettings=this.styles.settings,this.target=e,this.targetRoot=document.body,this.width=e.clientWidth,this.height=e.clientHeight,this.styles.removeStyleSheet(),this.open=this.open.bind(this),this.setTopLeft=this.setTopLeft.bind(this),this.toolbarButtonClicked=this.toolbarButtonClicked.bind(this),this.createNewMarker=this.createNewMarker.bind(this),this.addNewMarker=this.addNewMarker.bind(this),this.markerCreated=this.markerCreated.bind(this),this.setCurrentMarker=this.setCurrentMarker.bind(this),this.onPointerDown=this.onPointerDown.bind(this),this.onDblClick=this.onDblClick.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.onPointerOut=this.onPointerOut.bind(this),this.onKeyUp=this.onKeyUp.bind(this),this.overrideOverflow=this.overrideOverflow.bind(this),this.restoreOverflow=this.restoreOverflow.bind(this),this.close=this.close.bind(this),this.closeUI=this.closeUI.bind(this),this.addCloseEventListener=this.addCloseEventListener.bind(this),this.removeCloseEventListener=this.removeCloseEventListener.bind(this),this.addRenderEventListener=this.addRenderEventListener.bind(this),this.removeRenderEventListener=this.removeRenderEventListener.bind(this),this.clientToLocalCoordinates=this.clientToLocalCoordinates.bind(this),this.onWindowResize=this.onWindowResize.bind(this),this.deleteSelectedMarker=this.deleteSelectedMarker.bind(this),this.setWindowHeight=this.setWindowHeight.bind(this),this.removeMarker=this.removeMarker.bind(this),this.colorChanged=this.colorChanged.bind(this),this.fillColorChanged=this.fillColorChanged.bind(this),this.onPopupTargetResize=this.onPopupTargetResize.bind(this),this.showNotesEditor=this.showNotesEditor.bind(this),this.hideNotesEditor=this.hideNotesEditor.bind(this),this.stepZoom=this.stepZoom.bind(this),this.focus=this.focus.bind(this),this.blur=this.blur.bind(this),this.markerStateChanged=this.markerStateChanged.bind(this),this.switchToSelectMode=this.switchToSelectMode.bind(this),this.addDefs=this.addDefs.bind(this),this.addDefsToImage=this.addDefsToImage.bind(this)}return Object.defineProperty(t.prototype,"ALL_MARKER_TYPES",{get:function(){return[T,F,E,D,X,H,z,G,Y,O,A,q,W]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"DEFAULT_MARKER_TYPES",{get:function(){return[T,F,E,D,H,z,G]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"BASIC_MARKER_TYPES",{get:function(){return[T,F,E,D,z]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"availableMarkerTypes",{get:function(){return this._availableMarkerTypes},set:function(t){var e=this;this._availableMarkerTypes.splice(0),t.forEach((function(t){if("string"==typeof t){var i=e.ALL_MARKER_TYPES.find((function(e){return e.typeName===t}));void 0!==i&&e._availableMarkerTypes.push(i)}else e._availableMarkerTypes.push(t)}))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"currentMarker",{get:function(){return this._currentMarker},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isUndoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isUndoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isRedoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isRedoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"zoomLevel",{get:function(){return this._zoomLevel},set:function(t){this._zoomLevel=t,this.editorCanvas&&this.contentDiv&&(this.editorCanvas.style.transform="scale("+this._zoomLevel+")",this.contentDiv.scrollTo({left:(this.editorCanvas.clientWidth*this._zoomLevel-this.contentDiv.clientWidth)/2,top:(this.editorCanvas.clientHeight*this._zoomLevel-this.contentDiv.clientHeight)/2}))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),t.prototype.open=function(){this.setupResizeObserver(),this.setEditingTarget(),this.setTopLeft(),this.initMarkerCanvas(),this.initOverlay(),this.attachEvents(),"popup"===this.settings.displayMode&&this.onPopupTargetResize(),l.isLicensed||this.addLogo(),this._isOpen=!0,this._isFocused=!0},t.prototype.show=function(){var t=this;void 0===this.styles.styleSheetRoot&&void 0!==c.styleSheetRoot&&(this.styles.styleSheetRoot=c.styleSheetRoot),this.setWindowHeight(),this.showUI(),this.open(),this.eventListeners.show.forEach((function(e){return e(new K(t))}))},t.prototype.render=function(){return r(this,void 0,void 0,(function(){var t;return s(this,(function(e){switch(e.label){case 0:return this.setCurrentMarker(),(t=new u).naturalSize=this.renderAtNaturalSize,t.imageType=this.renderImageType,t.imageQuality=this.renderImageQuality,t.markersOnly=this.renderMarkersOnly,t.width=this.renderWidth,t.height=this.renderHeight,[4,t.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 1:return e.sent(),[4,t.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 2:return[2,e.sent()]}}))}))},t.prototype.close=function(t){var e=this;if(void 0===t&&(t=!1),this.isOpen){var i=!1;t||this.eventListeners.beforeclose.forEach((function(t){var n=new K(e,!0);t(n),n.defaultPrevented&&(i=!0)})),i||(this.coverDiv&&this.closeUI(),this.targetObserver&&(this.targetObserver.unobserve(this.target),this.targetObserver.unobserve(this.editorCanvas)),"popup"===this.settings.displayMode&&window.removeEventListener("resize",this.setWindowHeight),this.eventListeners.close.forEach((function(t){return t(new K(e))})),this.detachEvents(),this._isOpen=!1)}},t.prototype.addMarkersToToolbar=function(){for(var t,e=[],i=0;i<arguments.length;i++)e[i]=arguments[i];(t=this._availableMarkerTypes).push.apply(t,e)},t.prototype.addRenderEventListener=function(t){this.addEventListener("render",(function(e){t(e.dataUrl,e.state)}))},t.prototype.removeRenderEventListener=function(t){},t.prototype.addCloseEventListener=function(t){this.addEventListener("close",(function(){t()}))},t.prototype.removeCloseEventListener=function(t){},t.prototype.setupResizeObserver=function(){var t=this;"inline"===this.settings.displayMode?window.ResizeObserver&&(this.targetObserver=new ResizeObserver((function(){t.resize(t.target.clientWidth,t.target.clientHeight)})),this.targetObserver.observe(this.target)):"popup"===this.settings.displayMode&&(window.ResizeObserver&&(this.targetObserver=new ResizeObserver((function(){return t.onPopupTargetResize()})),this.targetObserver.observe(this.editorCanvas)),window.addEventListener("resize",this.setWindowHeight))},t.prototype.onPopupTargetResize=function(){var t=1*this.target.clientWidth/this.target.clientHeight,e=this.editorCanvas.clientWidth/t>this.editorCanvas.clientHeight?this.editorCanvas.clientHeight*t:this.editorCanvas.clientWidth,i=e<this.editorCanvas.clientWidth?this.editorCanvas.clientHeight:this.editorCanvas.clientWidth/t;this.resize(e,i)},t.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},t.prototype.resize=function(t,e){this._isResizing=!0;var i=t/this.imageWidth,n=e/this.imageHeight;this.imageWidth=Math.round(t),this.imageHeight=Math.round(e),this.target instanceof HTMLImageElement&&this.editingTarget instanceof HTMLImageElement&&(this.editingTarget.src=this.target.src),this.editingTarget.width=this.imageWidth,this.editingTarget.height=this.imageHeight,this.editingTarget.style.width=this.imageWidth+"px",this.editingTarget.style.height=this.imageHeight+"px",this.markerImage.setAttribute("width",this.imageWidth.toString()),this.markerImage.setAttribute("height",this.imageHeight.toString()),this.markerImage.setAttribute("viewBox","0 0 "+this.imageWidth.toString()+" "+this.imageHeight.toString()),this.markerImageHolder.style.width=this.imageWidth+"px",this.markerImageHolder.style.height=this.imageHeight+"px",this.overlayContainer.style.width=this.imageWidth+"px",this.overlayContainer.style.height=this.imageHeight+"px","popup"!==this.settings.displayMode?this.coverDiv.style.width=this.imageWidth.toString()+"px":(this.setTopLeft(),this.positionMarkerImage()),void 0!==this.toolbar&&this.toolbar.adjustLayout(),this.positionLogo(),this.scaleMarkers(i,n),this._isResizing=!1},t.prototype.scaleMarkers=function(t,e){var i,n=this;this._currentMarker&&this._currentMarker instanceof D?this._currentMarker.scale(t,e):(i=this._currentMarker,this.setCurrentMarker()),this.markers.forEach((function(i){i!==n._currentMarker&&i.scale(t,e)})),void 0!==i&&this.setCurrentMarker(i)},t.prototype.setEditingTarget=function(){this.imageWidth=Math.round(this.target.clientWidth),this.imageHeight=Math.round(this.target.clientHeight),this.target instanceof HTMLImageElement&&this.editingTarget instanceof HTMLImageElement&&(this.editingTarget.src=this.target.src),this.editingTarget.width=this.imageWidth,this.editingTarget.height=this.imageHeight,this.editingTarget.style.width=this.imageWidth+"px",this.editingTarget.style.height=this.imageHeight+"px"},t.prototype.setTopLeft=function(){var t=this.editingTarget.getBoundingClientRect(),e=this.editorCanvas.getBoundingClientRect();this.left=t.left-e.left,this.top=t.top-e.top},t.prototype.initMarkerCanvas=function(){this.markerImageHolder=document.createElement("div"),this.markerImageHolder.style.setProperty("touch-action","pinch-zoom"),this.markerImage=document.createElementNS("http://www.w3.org/2000/svg","svg"),this.markerImage.setAttribute("xmlns","http://www.w3.org/2000/svg"),this.markerImage.setAttribute("width",this.imageWidth.toString()),this.markerImage.setAttribute("height",this.imageHeight.toString()),this.markerImage.setAttribute("viewBox","0 0 "+this.imageWidth.toString()+" "+this.imageHeight.toString()),this.markerImage.style.pointerEvents="auto",this.markerImageHolder.style.position="absolute",this.markerImageHolder.style.width=this.imageWidth+"px",this.markerImageHolder.style.height=this.imageHeight+"px",this.markerImageHolder.style.transformOrigin="top left",this.positionMarkerImage(),this.markerImageHolder.appendChild(this.markerImage),this.editorCanvas.appendChild(this.markerImageHolder)},t.prototype.addDefs=function(){for(var t,e=[],i=0;i<arguments.length;i++)e[i]=arguments[i];this.defs=h.createDefs(),this.addDefsToImage(),(t=this.defs).append.apply(t,e)},t.prototype.addDefsToImage=function(){this.defs&&this.markerImage.insertBefore(this.defs,this.markerImage.firstChild)},t.prototype.initOverlay=function(){this.overlayContainer=document.createElement("div"),this.overlayContainer.style.position="absolute",this.overlayContainer.style.left="0px",this.overlayContainer.style.top="0px",this.overlayContainer.style.width=this.imageWidth+"px",this.overlayContainer.style.height=this.imageHeight+"px",this.overlayContainer.style.display="flex",this.markerImageHolder.appendChild(this.overlayContainer)},t.prototype.positionMarkerImage=function(){this.markerImageHolder.style.top=this.top/this.zoomLevel+"px",this.markerImageHolder.style.left=this.left/this.zoomLevel+"px"},t.prototype.attachEvents=function(){this.markerImage.addEventListener("pointerdown",this.onPointerDown),this.markerImage.addEventListener("dblclick",this.onDblClick),this.attachWindowEvents()},t.prototype.attachWindowEvents=function(){window.addEventListener("pointermove",this.onPointerMove),window.addEventListener("pointerup",this.onPointerUp),window.addEventListener("pointercancel",this.onPointerOut),window.addEventListener("pointerout",this.onPointerOut),window.addEventListener("pointerleave",this.onPointerUp),window.addEventListener("resize",this.onWindowResize),window.addEventListener("keyup",this.onKeyUp)},t.prototype.detachEvents=function(){this.markerImage.removeEventListener("pointerdown",this.onPointerDown),this.markerImage.removeEventListener("dblclick",this.onDblClick),this.detachWindowEvents()},t.prototype.detachWindowEvents=function(){window.removeEventListener("pointermove",this.onPointerMove),window.removeEventListener("pointerup",this.onPointerUp),window.removeEventListener("pointercancel",this.onPointerOut),window.removeEventListener("pointerout",this.onPointerOut),window.removeEventListener("pointerleave",this.onPointerUp),window.removeEventListener("resize",this.onWindowResize),window.removeEventListener("keyup",this.onKeyUp)},t.prototype.addLogo=function(){this.logoUI=document.createElement("div"),this.logoUI.style.display="inline-block",this.logoUI.style.margin="0px",this.logoUI.style.padding="0px",this.logoUI.style.fill="#333333";var t=document.createElement("a");t.href="https://markerjs.com/",t.target="_blank",t.innerHTML='<svg viewBox="0 0 112 96" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414"><path fill="#e5f20d" fill-opacity=".647" d="M0 40.386h111.96V95.62H0z"/><path d="M93.61 61.452c0 .987-.328 1.831-.987 2.53-.657.7-1.52 1.048-2.591 1.048-1.481 0-2.222-.74-2.222-2.22 0-16.617-.533-29.347-1.604-38.192-1.068-8.842-2.92-13.265-5.552-13.265-4.443 0-10.94 15.509-19.497 46.52v.124c0 .987-.328 1.831-.987 2.53-.657.7-1.52 1.048-2.592 1.048-1.48 0-2.22-.74-2.22-2.22 0-3.29.165-8.392.493-15.302.33-7.732.494-13.82.494-18.262 0-6.17-.186-10.55-.556-13.142-.37-2.591-1.172-3.887-2.406-3.887-2.796 0-6.333 5.12-10.612 15.363C38.494 34.367 34.01 46.44 29.32 60.34l-1.11 3.209a5.714 5.714 0 01-1.42 2.097c-.617.578-1.295.864-2.036.864-.987 0-1.644-.081-1.974-.247-.328-.162-.533-.656-.617-1.48-.41-4.03-.74-9.418-.987-16.165-.163-1.728-.329-4.566-.494-8.515-.822-13.901-1.562-23.3-2.221-28.196-.657-4.893-.987-7.628-.987-8.205 0-.657.33-1.44.987-2.345.659-.903 1.276-1.357 1.85-1.357 1.319 0 2.387.947 3.21 2.838.411.906.863 4.526 1.357 10.859.493 6.335.905 14.19 1.233 23.568l.617 18.88c4.527-13.983 9.216-26.673 14.068-38.068C45.65 6.686 50.093.988 54.123.988c2.715 0 4.566 1.974 5.553 5.923.987 3.949 1.481 9.667 1.481 17.152 0 3.949-.081 9.625-.247 17.029l-.123 5.676c3.373-11.762 6.725-21.634 10.057-29.615 3.331-7.979 6.685-11.97 10.056-11.97 8.475 0 12.71 18.757 12.71 56.269z" fill-rule="nonzero"/></svg>',t.title="Powered by marker.js",t.style.display="grid",t.style.alignItems="center",t.style.justifyItems="center",t.style.padding="3px",t.style.width="20px",t.style.height="20px",this.logoUI.appendChild(t),this.editorCanvas.appendChild(this.logoUI),this.logoUI.style.position="absolute",this.logoUI.style.pointerEvents="all",this.positionLogo()},t.prototype.positionLogo=function(){this.logoUI&&("right"!==this.uiStyleSettings.logoPosition?this.logoUI.style.left=this.markerImageHolder.offsetLeft+10+"px":this.logoUI.style.left=this.markerImageHolder.offsetLeft+this.markerImageHolder.offsetWidth-this.logoUI.clientWidth-10+"px",this.logoUI.style.top=this.markerImageHolder.offsetTop+this.markerImageHolder.offsetHeight-this.logoUI.clientHeight-10+"px")},t.prototype.overrideOverflow=function(){this.scrollXState=window.scrollX,this.scrollYState=window.scrollY,this.bodyOverflowState=document.body.style.overflow,window.scroll({top:0,left:0}),document.body.style.overflow="hidden"},t.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},t.prototype.showUI=function(){switch("popup"===this.settings.displayMode&&this.overrideOverflow(),this.coverDiv=document.createElement("div"),this.coverDiv.style.visibility=this._silentRenderMode?"hidden":"visible",this.coverDiv.className=this.styles.classNamePrefixBase+" "+this.styles.classNamePrefix,this.coverDiv.style.fontSize="16px",this.coverDiv.style.userSelect="none",this.settings.displayMode){case"inline":this.coverDiv.style.position="absolute";var t=void 0!==this.settings.uiOffsetTop?this.target.offsetTop+this.settings.uiOffsetTop:this.target.offsetTop>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=t+"px",this.coverDiv.style.left=this.target.offsetLeft.toString()+"px",this.coverDiv.style.width=this.target.offsetWidth.toString()+"px",this.coverDiv.style.zIndex=void 0!==this.uiStyleSettings.zIndex?this.uiStyleSettings.zIndex:"5";break;case"popup":this.coverDiv.style.position="absolute",this.coverDiv.style.top="0px",this.coverDiv.style.left="0px",this.coverDiv.style.width="100vw",this.coverDiv.style.height=window.innerHeight+"px",this.coverDiv.style.backgroundColor="rgba(0, 0, 0, 0.75)",this.coverDiv.style.zIndex=void 0!==this.uiStyleSettings.zIndex?this.uiStyleSettings.zIndex:"1000",this.coverDiv.style.display="flex"}this.targetRoot.appendChild(this.coverDiv),this.uiDiv=document.createElement("div"),this.uiDiv.style.display="flex",this.uiDiv.style.flexDirection="column",this.uiDiv.style.flexGrow="2",this.uiDiv.style.margin="popup"===this.settings.displayMode?this.settings.popupMargin+"px":"0px",this.uiDiv.style.border="0px",this.coverDiv.appendChild(this.uiDiv),this.toolbar=new g(this.uiDiv,this.settings.displayMode,this._availableMarkerTypes,this.uiStyleSettings,this.styles),this.toolbar.addButtonClickListener(this.toolbarButtonClicked),this.toolbar.show(this._silentRenderMode||this.uiStyleSettings.hideToolbar?"hidden":"visible"),this.contentDiv=document.createElement("div"),this.contentDiv.style.display="flex",this.contentDiv.style.flexDirection="row",this.contentDiv.style.flexGrow="2",this.contentDiv.style.flexShrink="1","popup"===this.settings.displayMode&&(this.contentDiv.style.backgroundColor=this.uiStyleSettings.canvasBackgroundColor,this.contentDiv.style.maxHeight=this.windowHeight-2*this.settings.popupMargin-3.5*this.uiStyleSettings.toolbarHeight+"px",this.contentDiv.style.maxWidth="calc(100vw - "+2*this.settings.popupMargin+"px)"),this.contentDiv.style.overflow="auto",this.uiDiv.appendChild(this.contentDiv),this.editorCanvas=document.createElement("div"),this.editorCanvas.style.flexGrow="2",this.editorCanvas.style.flexShrink="1",this.editorCanvas.style.position="relative",this.editorCanvas.style.overflow="hidden",this.editorCanvas.style.display="flex","popup"===this.settings.displayMode&&(this.editorCanvas.style.alignItems="center",this.editorCanvas.style.justifyContent="center"),this.editorCanvas.style.pointerEvents="none",this.editorCanvas.style.transformOrigin="left top",this.editorCanvas.style.transform="scale("+this.zoomLevel+")",this.contentDiv.appendChild(this.editorCanvas),this.editingTarget=this.target instanceof HTMLImageElement?document.createElement("img"):document.createElement("canvas"),void 0===this.settings.uiOffsetTop&&this.target.offsetTop<this.styles.settings.toolbarHeight&&(this.editingTarget.style.marginTop=this.target.offsetTop-this.styles.settings.toolbarHeight+"px"),this.editorCanvas.appendChild(this.editingTarget),this.toolbox=new m(this.uiDiv,this.settings.displayMode,this.uiStyleSettings,this.styles),this.toolbox.show(this._silentRenderMode||this.uiStyleSettings.hideToolbox?"hidden":"visible")},t.prototype.closeUI=function(){"popup"===this.settings.displayMode&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},t.prototype.removeMarker=function(t){this.markerImage.removeChild(t.container),this.markers.indexOf(t)>-1&&this.markers.splice(this.markers.indexOf(t),1),t.dispose()},t.prototype.switchToSelectMode=function(){this.mode="select",this.hideNotesEditor(),void 0!==this._currentMarker&&("new"!==this._currentMarker.state?this._currentMarker.select():(this.removeMarker(this._currentMarker),this.setCurrentMarker(),this.markerImage.style.cursor="default"),this.addUndoStep())},t.prototype.toolbarButtonClicked=function(t,e){if("marker"===t&&void 0!==e)this.createNewMarker(e);else if("action"===t)switch(e){case"select":this.switchToSelectMode(),this.switchToSelectMode();break;case"delete":this.deleteSelectedMarker();break;case"clear":this.clear();break;case"undo":this.undo();break;case"redo":this.redo();break;case"zoom":this.stepZoom();break;case"zoom-out":this.zoomLevel=1;break;case"notes":void 0===this.notesArea?(this.switchToSelectMode(),this.zoomLevel=1,this.showNotesEditor()):this.switchToSelectMode();break;case"close":this.close();break;case"render":this.switchToSelectMode(),this.startRenderAndClose()}},t.prototype.deleteSelectedMarker=function(){var t=this;if(void 0!==this._currentMarker){var e=!1;if(this.eventListeners.markerbeforedelete.forEach((function(i){var n=new $(t,t._currentMarker,!0);i(n),n.defaultPrevented&&(e=!0)})),!e){var i=this._currentMarker;this._currentMarker.dispose(),this.markerImage.removeChild(this._currentMarker.container),this.markers.splice(this.markers.indexOf(this._currentMarker),1),this.setCurrentMarker(),this.addUndoStep(),this.eventListeners.markerdelete.forEach((function(e){return e(new $(t,i))}))}}},t.prototype.clear=function(){var t=this,e=!1;if(this.markers.length>0&&(this.eventListeners.markerbeforedelete.forEach((function(i){var n=new $(t,void 0,!0);i(n),n.defaultPrevented&&(e=!0)})),!e)){this.setCurrentMarker();for(var i=function(e){var i=n.markers[e];n.setCurrentMarker(n.markers[e]),n._currentMarker.dispose(),n.markerImage.removeChild(n._currentMarker.container),n.markers.splice(n.markers.indexOf(n._currentMarker),1),n.eventListeners.markerdelete.forEach((function(e){return e(new $(t,i))}))},n=this,o=this.markers.length-1;o>=0;o--)i(o);this.addUndoStep()}},Object.defineProperty(t.prototype,"isNotesAreaOpen",{get:function(){return void 0!==this.notesArea},enumerable:!1,configurable:!0}),t.prototype.showNotesEditor=function(){var t;void 0!==this._currentMarker&&(this.overlayContainer.innerHTML="",this.notesArea=document.createElement("textarea"),this.notesArea.className=this.uiStyleSettings.notesAreaStyleClassName,this.notesArea.style.pointerEvents="auto",this.notesArea.style.alignSelf="stretch",this.notesArea.style.width="100%",this.notesArea.style.margin=this.uiStyleSettings.toolbarHeight/4+"px",this.notesArea.value=null!==(t=this._currentMarker.notes)&&void 0!==t?t:"",this.overlayContainer.appendChild(this.notesArea))},t.prototype.hideNotesEditor=function(){this.isNotesAreaOpen&&(void 0!==this._currentMarker&&(this._currentMarker.notes=""!==this.notesArea.value.trim()?this.notesArea.value:void 0),this.overlayContainer.removeChild(this.notesArea),this.notesArea=void 0)},t.prototype.selectLastMarker=function(){this.markers.length>0?this.setCurrentMarker(this.markers[this.markers.length-1]):this.setCurrentMarker()},t.prototype.addUndoStep=function(){var t=this;if(void 0===this._currentMarker||"edit"!==this._currentMarker.state){var e=this.getState(),i=this.undoRedoManager.getLastUndoStep();if(!i||i.width===e.width&&i.height===e.height){var n=this.undoRedoManager.undoStepCount;this.undoRedoManager.addUndoStep(e),n<this.undoRedoManager.undoStepCount&&this.eventListeners.statechange.forEach((function(e){return e(new K(t))}))}else this.undoRedoManager.replaceLastUndoStep(e),this.eventListeners.statechange.forEach((function(e){return e(new K(t))}))}},t.prototype.undo=function(){this.switchToSelectMode(),this.addUndoStep(),this.undoStep()},t.prototype.undoStep=function(){var t=this,e=this.undoRedoManager.undo();void 0!==e&&(this.restoreState(e),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach((function(e){return e(new K(t))})))},t.prototype.redo=function(){this.switchToSelectMode(),this.redoStep()},t.prototype.redoStep=function(){var t=this,e=this.undoRedoManager.redo();void 0!==e&&(this.restoreState(e),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach((function(e){return e(new K(t))})))},t.prototype.stepZoom=function(){var t=this.zoomSteps.indexOf(this.zoomLevel);this.zoomLevel=t<this.zoomSteps.length-1?this.zoomSteps[t+1]:this.zoomSteps[0]},t.prototype.panTo=function(t){this.contentDiv.scrollBy({left:this.prevPanPoint.x-t.x,top:this.prevPanPoint.y-t.y}),this.prevPanPoint=t},t.prototype.startRenderAndClose=function(){return r(this,void 0,void 0,(function(){var t,e,i=this;return s(this,(function(n){switch(n.label){case 0:return[4,this.render()];case 1:return t=n.sent(),e=this.getState(),this.eventListeners.render.forEach((function(n){return n(new _(i,t,e))})),this.close(!0),[2]}}))}))},t.prototype.getState=function(t){!0===t&&this.setCurrentMarker();var e={width:this.imageWidth,height:this.imageHeight,markers:[]};return this.markers.forEach((function(t){return e.markers.push(t.getState())})),e},t.prototype.restoreState=function(t){var e=this;for(this.markers.splice(0);this.markerImage.lastChild;)this.markerImage.removeChild(this.markerImage.lastChild);t.markers.forEach((function(t){var i=e._availableMarkerTypes.find((function(e){return e.typeName===t.typeName}));if(void 0!==i){var n=e.addNewMarker(i);n.restoreState(t),e.markers.push(n)}})),t.width&&t.height&&(t.width!==this.imageWidth||t.height!==this.imageHeight)&&this.scaleMarkers(this.imageWidth/t.width,this.imageHeight/t.height),this.eventListeners.restorestate.forEach((function(t){return t(new K(e))}))},t.prototype.addNewMarker=function(t){var e=h.createGroup();return this.markerImage.appendChild(e),new t(e,this.overlayContainer,this.settings)},t.prototype.createNewMarker=function(t){var e,i=this;(e="string"==typeof t?this._availableMarkerTypes.find((function(e){return e.typeName===t})):t)&&(this.setCurrentMarker(),this.addUndoStep(),this._currentMarker=this.addNewMarker(e),this._currentMarker.onMarkerCreated=this.markerCreated,this._currentMarker.onColorChanged=this.colorChanged,this._currentMarker.onFillColorChanged=this.fillColorChanged,this._currentMarker.onStateChanged=this.markerStateChanged,this.markerImage.style.cursor="crosshair",this.toolbar.setActiveMarkerButton(e.typeName),this.toolbox.setPanelButtons(this._currentMarker.toolboxPanels),this.eventListeners.markercreating.forEach((function(t){return t(new $(i,i._currentMarker))})))},t.prototype.markerCreated=function(t){var e=this;this.mode="select",this.markerImage.style.cursor="default",this.markers.push(t),this.setCurrentMarker(t),t instanceof F&&this.settings.newFreehandMarkerOnPointerUp?this.createNewMarker(F):this.toolbar.setSelectMode(),this.addUndoStep(),this.eventListeners.markercreate.forEach((function(t){return t(new $(e,e._currentMarker))}))},t.prototype.colorChanged=function(t){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultColor=t,this.settings.defaultStrokeColor=t)},t.prototype.fillColorChanged=function(t){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultFillColor=t)},t.prototype.markerStateChanged=function(t){var e=this;this.eventListeners.markerchange.forEach((function(i){return i(new $(e,t))}))},t.prototype.setCurrentMarker=function(t){var e=this;this._currentMarker!==t&&void 0!==this._currentMarker&&(this._currentMarker.deselect(),this.toolbar.setCurrentMarker(),this.toolbox.setPanelButtons([]),this._isResizing||this.eventListeners.markerdeselect.forEach((function(t){return t(new $(e,e._currentMarker))}))),this._currentMarker=t,void 0===this._currentMarker||this._currentMarker.isSelected||("new"!==this._currentMarker.state&&this._currentMarker.select(),this.toolbar.setCurrentMarker(this._currentMarker),this.toolbox.setPanelButtons(this._currentMarker.toolboxPanels),this._isResizing||this.eventListeners.markerselect.forEach((function(t){return t(new $(e,e._currentMarker))})))},t.prototype.onPointerDown=function(t){if(this._isFocused||this.focus(),this.touchPoints++,1===this.touchPoints||"touch"!==t.pointerType)if(void 0===this._currentMarker||"new"!==this._currentMarker.state&&"creating"!==this._currentMarker.state){if("select"===this.mode){var e=this.markers.find((function(e){return e.ownsTarget(t.target)}));void 0!==e?(this.setCurrentMarker(e),this.isDragging=!0,this._currentMarker.pointerDown(this.clientToLocalCoordinates(t.clientX,t.clientY),t.target)):(this.setCurrentMarker(),this.isDragging=!0,this.prevPanPoint={x:t.clientX,y:t.clientY})}}else this.isDragging=!0,this._currentMarker.pointerDown(this.clientToLocalCoordinates(t.clientX,t.clientY))},t.prototype.onDblClick=function(t){if(this._isFocused||this.focus(),"select"===this.mode){var e=this.markers.find((function(e){return e.ownsTarget(t.target)}));void 0!==e&&e!==this._currentMarker&&this.setCurrentMarker(e),void 0!==this._currentMarker?this._currentMarker.dblClick(this.clientToLocalCoordinates(t.clientX,t.clientY),t.target):this.setCurrentMarker()}},t.prototype.onPointerMove=function(t){1!==this.touchPoints&&"touch"===t.pointerType||(void 0!==this._currentMarker||this.isDragging)&&(void 0!==this._currentMarker&&"edit"===this._currentMarker.state||t.preventDefault(),void 0!==this._currentMarker?this._currentMarker.manipulate(this.clientToLocalCoordinates(t.clientX,t.clientY)):this.zoomLevel>1&&this.panTo({x:t.clientX,y:t.clientY}))},t.prototype.onPointerUp=function(t){this.touchPoints>0&&this.touchPoints--,0===this.touchPoints&&this.isDragging&&void 0!==this._currentMarker&&this._currentMarker.pointerUp(this.clientToLocalCoordinates(t.clientX,t.clientY)),this.isDragging=!1,this.addUndoStep()},t.prototype.onPointerOut=function(){this.touchPoints>0&&this.touchPoints--},t.prototype.onKeyUp=function(t){void 0===this._currentMarker||void 0!==this.notesArea||"Delete"!==t.key&&"Backspace"!==t.key||this.deleteSelectedMarker()},t.prototype.clientToLocalCoordinates=function(t,e){var i=this.markerImage.getBoundingClientRect();return{x:(t-i.left)/this.zoomLevel,y:(e-i.top)/this.zoomLevel}},t.prototype.onWindowResize=function(){this.positionUI()},t.prototype.positionUI=function(){switch(this.setTopLeft(),this.settings.displayMode){case"inline":var t=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=t+"px",this.coverDiv.style.left=this.target.offsetLeft.toString()+"px";break;case"popup":this.coverDiv.style.top="0px",this.coverDiv.style.left="0px",this.coverDiv.style.width="100vw",this.coverDiv.style.height=this.windowHeight+"px",this.contentDiv.style.maxHeight=this.windowHeight-2*this.settings.popupMargin-3.5*this.styles.settings.toolbarHeight+"px"}this.positionMarkerImage(),this.positionLogo()},t.prototype.addLicenseKey=function(t){l.addKey(t)},t.prototype.addEventListener=function(t,e){this.eventListeners.addEventListener(t,e)},t.prototype.removeEventListener=function(t,e){this.eventListeners.removeEventListener(t,e)},t.prototype.renderState=function(t){this._silentRenderMode=!0,this.settings.displayMode="inline",this.isOpen||this.show(),this.restoreState(t),this.startRenderAndClose(),this._silentRenderMode=!1},Object.defineProperty(t.prototype,"isFocused",{get:function(){return this._isFocused},enumerable:!1,configurable:!0}),t.prototype.focus=function(){var t=this;this._isFocused||(this.attachWindowEvents(),this._isFocused=!0,void 0!==this._previousCurrentMarker&&this.setCurrentMarker(this._previousCurrentMarker),this.eventListeners.focus.forEach((function(e){return e(new K(t))})))},t.prototype.blur=function(){var t=this;this._isFocused&&(this.detachWindowEvents(),this._isFocused=!1,this._previousCurrentMarker=this._currentMarker,this.setCurrentMarker(),this.eventListeners.blur.forEach((function(e){return e(new K(t))})))},t.instanceCounter=0,t}()}}]); |