|
|
(self.webpackChunk=self.webpackChunk||[]).push([[67164,85804],{15277:function(t,e,i){"use strict";i.d(e,{Z:function(){return h}});var n=i(14809),o=i(59301),r={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M942.2 486.2C847.4 286.5 704.1 186 512 186c-192.2 0-335.4 100.5-430.2 300.3a60.3 60.3 0 000 51.5C176.6 737.5 319.9 838 512 838c192.2 0 335.4-100.5 430.2-300.3 7.7-16.2 7.7-35 0-51.5zM512 766c-161.3 0-279.4-81.8-362.7-254C232.6 339.8 350.7 258 512 258c161.3 0 279.4 81.8 362.7 254C791.5 684.2 673.4 766 512 766zm-4-430c-97.2 0-176 78.8-176 176s78.8 176 176 176 176-78.8 176-176-78.8-176-176-176zm0 288c-61.9 0-112-50.1-112-112s50.1-112 112-112 112 50.1 112 112-50.1 112-112 112z"}}]},name:"eye",theme:"outlined"},s=i(7657),a=function(t,e){return o.createElement(s.Z,(0,n.Z)({},t,{ref:e,icon:r}))};var h=o.forwardRef(a)},8657:function(t,e,i){"use strict";i.d(e,{Z:function(){return h}});var n=i(14809),o=i(59301),r={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M928 444H820V330.4c0-17.7-14.3-32-32-32H473L355.7 186.2a8.15 8.15 0 00-5.5-2.2H96c-17.7 0-32 14.3-32 32v592c0 17.7 14.3 32 32 32h698c13 0 24.8-7.9 29.7-20l134-332c1.5-3.8 2.3-7.9 2.3-12 0-17.7-14.3-32-32-32zM136 256h188.5l119.6 114.4H748V444H238c-13 0-24.8 7.9-29.7 20L136 643.2V256zm635.3 512H159l103.3-256h612.4L771.3 768z"}}]},name:"folder-open",theme:"outlined"},s=i(7657),a=function(t,e){return o.createElement(s.Z,(0,n.Z)({},t,{ref:e,icon:r}))};var h=o.forwardRef(a)},56082:function(t,e,i){"use strict";i.d(e,{Z:function(){return h}});var n=i(14809),o=i(59301),r={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M300 276.5a56 56 0 1056-97 56 56 0 00-56 97zm0 284a56 56 0 1056-97 56 56 0 00-56 97zM640 228a56 56 0 10112 0 56 56 0 00-112 0zm0 284a56 56 0 10112 0 56 56 0 00-112 0zM300 844.5a56 56 0 1056-97 56 56 0 00-56 97zM640 796a56 56 0 10112 0 56 56 0 00-112 0z"}}]},name:"holder",theme:"outlined"},s=i(7657),a=function(t,e){return o.createElement(s.Z,(0,n.Z)({},t,{ref:e,icon:r}))};var h=o.forwardRef(a)},56762:function(t,e,i){"use strict";i.d(e,{Z:function(){return o}});var n=i(59301);function o(){const[,t]=n.useReducer((t=>t+1),0);return t}},38854:function(t,e,i){"use strict";i.d(e,{Z:function(){return y}});var n=i(91857),o=i(92310),r=i.n(o),s=i(59301),a=i(18785),h=i(3113),l=i(36355),u=i(81327),c=i(33234),f=i(47211),d=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 p=t=>{const{getPopupContainer:e,getPrefixCls:i,direction:o}=s.useContext(l.E_),{prefixCls:p,type:g="default",danger:m,disabled:y,loading:v,onClick:x,htmlType:b,children:w,className:k,menu:M,arrow:S,autoFocus:N,overlay:P,trigger:C,align:T,open:L,onOpenChange:A,placement:j,getPopupContainer:F,href:O,icon:D=s.createElement(a.Z,null),title:B,buttonsRender:I=(t=>t),mouseEnterDelay:z,mouseLeaveDelay:E,overlayClassName:R,overlayStyle:V,destroyPopupOnHide:Y,dropdownRender:G}=t,X=d(t,["prefixCls","type","danger","disabled","loading","onClick","htmlType","children","className","menu","arrow","autoFocus","overlay","trigger","align","open","onOpenChange","placement","getPopupContainer","href","icon","title","buttonsRender","mouseEnterDelay","mouseLeaveDelay","overlayClassName","overlayStyle","destroyPopupOnHide","dropdownRender"]),U=i("dropdown",p),q=`${U}-button`,[K,H]=(0,f.Z)(U),W={menu:M,arrow:S,autoFocus:N,align:T,disabled:y,trigger:y?[]:C,onOpenChange:A,getPopupContainer:F||e,mouseEnterDelay:z,mouseLeaveDelay:E,overlayClassName:R,overlayStyle:V,destroyPopupOnHide:Y,dropdownRender:G},{compactSize:Z,compactItemClassnames:J}=(0,c.ri)(U,o),$=r()(q,J,k,H);"overlay"in t&&(W.overlay=P),"open"in t&&(W.open=L),W.placement="placement"in t?j:"rtl"===o?"bottomLeft":"bottomRight";const _=s.createElement(h.ZP,{type:g,danger:m,disabled:y,loading:v,onClick:x,htmlType:b,href:O,title:B},w),Q=s.createElement(h.ZP,{type:g,danger:m,icon:D}),[tt,et]=I([_,Q]);return K(s.createElement(u.Z.Compact,Object.assign({className:$,size:Z,block:!0},X),tt,s.createElement(n.Z,Object.assign({},W),et)))};p.__ANT_BUTTON=!0;var g=p;const m=n.Z;m.Button=g;var y=m},10249:function(t,e,i){"use strict";i.d(e,{Z:function(){return O}});var n=i(92310),o=i.n(n),r=i(59301),s=i(36355),a=i(32441),h=i(9937);var l=t=>{const{getPrefixCls:e,direction:i}=(0,r.useContext)(s.E_),{prefixCls:n,className:l}=t,u=e("input-group",n),c=e("input"),[f,d]=(0,h.ZP)(c),p=o()(u,{[`${u}-lg`]:"large"===t.size,[`${u}-sm`]:"small"===t.size,[`${u}-compact`]:t.compact,[`${u}-rtl`]:"rtl"===i},d,l),g=(0,r.useContext)(a.aM),m=(0,r.useMemo)((()=>Object.assign(Object.assign({},g),{isFormItemInput:!1})),[g]);return f(r.createElement("span",{className:p,style:t.style,onMouseEnter:t.onMouseEnter,onMouseLeave:t.onMouseLeave,onFocus:t.onFocus,onBlur:t.onBlur},r.createElement(a.aM.Provider,{value:m},t.children)))},u=i(9432),c=i(14809),f={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M942.2 486.2Q889.47 375.11 816.7 305l-50.88 50.88C807.31 395.53 843.45 447.4 874.7 512 791.5 684.2 673.4 766 512 766q-72.67 0-133.87-22.38L323 798.75Q408 838 512 838q288.3 0 430.2-300.3a60.29 60.29 0 000-51.5zm-63.57-320.64L836 122.88a8 8 0 00-11.32 0L715.31 232.2Q624.86 186 512 186q-288.3 0-430.2 300.3a60.3 60.3 0 000 51.5q56.69 119.4 136.5 191.41L112.48 835a8 8 0 000 11.31L155.17 889a8 8 0 0011.31 0l712.15-712.12a8 8 0 000-11.32zM149.3 512C232.6 339.8 350.7 258 512 258c54.54 0 104.13 9.36 149.12 28.39l-70.3 70.3a176 176 0 00-238.13 238.13l-83.42 83.42C223.1 637.49 183.3 582.28 149.3 512zm246.7 0a112.11 112.11 0 01146.2-106.69L401.31 546.2A112 112 0 01396 512z"}},{tag:"path",attrs:{d:"M508 624c-3.46 0-6.87-.16-10.25-.47l-52.82 52.82a176.09 176.09 0 00227.42-227.42l-52.82 52.82c.31 3.38.47 6.79.47 10.25a111.94 111.94 0 01-112 112z"}}]},name:"eye-invisible",theme:"outlined"},d=i(7657),p=function(t,e){return r.createElement(d.Z,(0,c.Z)({},t,{ref:e,icon:f}))};var g=r.forwardRef(p),m=i(15277),y=i(2738),v=i(8654),x=i(59412),b=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 w=t=>t?r.createElement(m.Z,null):r.createElement(g,null),k={click:"onClick",hover:"onMouseOver"};var M=r.forwardRef(((t,e)=>{const{visibilityToggle:i=!0}=t,n="object"==typeof i&&void 0!==i.visible,[a,h]=(0,r.useState)((()=>!!n&&i.visible)),l=(0,r.useRef)(null);r.useEffect((()=>{n&&h(i.visible)}),[n,i]);const c=(0,x.Z)(l),f=()=>{const{disabled:e}=t;e||(a&&c(),h((t=>{var e;const n=!t;return"object"==typeof i&&(null===(e=i.onVisibleChange)||void 0===e||e.call(i,n)),n})))},{className:d,prefixCls:p,inputPrefixCls:g,size:m}=t,M=b(t,["className","prefixCls","inputPrefixCls","size"]),{getPrefixCls:S}=r.useContext(s.E_),N=S("input",g),P=S("input-password",p),C=i&&(e=>{const{action:i="click",iconRender:n=w}=t,o=k[i]||"",s=n(a),h={[o]:f,className:`${e}-icon`,key:"passwordIcon",onMouseDown:t=>{t.preventDefault()},onMouseUp:t=>{t.preventDefault()}};return r.cloneElement(r.isValidElement(s)?s:r.createElement("span",null,s),h)})(P),T=o()(P,d,{[`${P}-${m}`]:!!m}),L=Object.assign(Object.assign({},(0,y.Z)(M,["suffix","iconRender","visibilityToggle"])),{type:a?"text":"password",className:T,prefixCls:N,suffix:C});return m&&(L.size=m),r.createElement(u.Z,Object.assign({ref:(0,v.sQ)(e,l)},L))})),S=i(47472),N=i(92343),P=i(3113),C=i(19716),T=i(33234),L=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};var A=r.forwardRef(((t,e)=>{const{prefixCls:i,inputPrefixCls:n,className:a,size:h,suffix:l,enterButton:c=!1,addonAfter:f,loading:d,disabled:p,onSearch:g,onChange:m,onCompositionStart:y,onCompositionEnd:x}=t,b=L(t,["prefixCls","inputPrefixCls","className","size","suffix","enterButton","addonAfter","loading","disabled","onSearch","onChange","onCompositionStart","onCompositionEnd"]),{getPrefixCls:w,direction:k}=r.useContext(s.E_),M=r.useRef(!1),A=w("input-search",i),j=w("input",n),{compactSize:F}=(0,T.ri)(A,k),O=(0,C.Z)((t=>{var e;return null!==(e=null!=h?h:F)&&void 0!==e?e:t})),D=r.useRef(null),B=t=>{var e;document.activeElement===(null===(e=D.current)||void 0===e?void 0:e.input)&&t.preventDefault()},I=t=>{var e,i;g&&g(null===(i=null===(e=D.current)||void 0===e?void 0:e.input)||void 0===i?void 0:i.value,t,{source:"input"})},z="boolean"==typeof c?r.createElement(S.Z,null):null,E=`${A}-button`;let R;const V=c||{},Y=V.type&&!0===V.type.__ANT_BUTTON;R=Y||"button"===V.type?(0,N.Tm)(V,Object.assign({onMouseDown:B,onClick:t=>{var e,i;null===(i=null===(e=null==V?void 0:V.props)||void 0===e?void 0:e.onClick)||void 0===i||i.call(e,t),I(t)},key:"enterButton"},Y?{className:E,size:O}:{})):r.createElement(P.ZP,{className:E,type:c?"primary":void 0,size:O,disabled:p,key:"enterButton",onMouseDown:B,onClick:I,loading:d,icon:z},c),f&&(R=[R,(0,N.Tm)(f,{key:"addonAfter"})]);const G=o()(A,{[`${A}-rtl`]:"rtl"===k,[`${A}-${O}`]:!!O,[`${A}-with-button`]:!!c},a);return r.createElement(u.Z,Object.assign({ref:(0,v.sQ)(D,e),onPressEnter:t=>{M.current||d||I(t)}},b,{size:O,onCompositionStart:t=>{M.current=!0,null==y||y(t)},onCompositionEnd:t=>{M.current=!1,null==x||x(t)},prefixCls:j,addonAfter:R,suffix:l,onChange:t=>{t&&t.target&&"click"===t.type&&g&&g(t.target.value,t,{source:"clear"}),m&&m(t)},className:G,disabled:p}))})),j=i(1643);const F=u.Z;F.Group=l,F.Search=A,F.TextArea=j.Z,F.Password=M;var O=F},57809:function(t,e,i){"use strict";var n=i(92310),o=i.n(n),r=i(77861),s=i(2738),a=i(59301),h=i(53487),l=i(62892),u=i(19080),c=i(36355),f=i(1684),d=i(93891),p=i(19716),g=i(32441),m=i(33234),y=i(14154),v=i(58582),x=i(84443),b=i(66339),w=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 k="SECRET_COMBOBOX_MODE_DO_NOT_USE",M=(t,e)=>{var i,{prefixCls:n,bordered:h=!0,className:M,rootClassName:S,getPopupContainer:N,popupClassName:P,dropdownClassName:C,listHeight:T=256,placement:L,listItemHeight:A=24,size:j,disabled:F,notFoundContent:O,status:D,builtinPlacements:B,dropdownMatchSelectWidth:I,popupMatchSelectWidth:z,direction:E,style:R,allowClear:V}=t,Y=w(t,["prefixCls","bordered","className","rootClassName","getPopupContainer","popupClassName","dropdownClassName","listHeight","placement","listItemHeight","size","disabled","notFoundContent","status","builtinPlacements","dropdownMatchSelectWidth","popupMatchSelectWidth","direction","style","allowClear"]);const{getPopupContainer:G,getPrefixCls:X,renderEmpty:U,direction:q,virtual:K,popupMatchSelectWidth:H,popupOverflow:W,select:Z}=a.useContext(c.E_),J=X("select",n),$=X(),_=null!=E?E:q,{compactSize:Q,compactItemClassnames:tt}=(0,m.ri)(J,_),[et,it]=(0,y.Z)(J),nt=a.useMemo((()=>{const{mode:t}=Y;if("combobox"!==t)return t===k?"combobox":t}),[Y.mode]),ot="multiple"===nt||"tags"===nt,rt=(0,x.Z)(Y.suffixIcon,Y.showArrow),st=null!==(i=null!=z?z:I)&&void 0!==i?i:H,{status:at,hasFeedback:ht,isFormItemInput:lt,feedbackIcon:ut}=a.useContext(g.aM),ct=(0,u.F)(at,D);let ft;ft=void 0!==O?O:"combobox"===nt?null:(null==U?void 0:U("Select"))||a.createElement(d.Z,{componentName:"Select"});const{suffixIcon:dt,itemIcon:pt,removeIcon:gt,clearIcon:mt}=(0,b.Z)(Object.assign(Object.assign({},Y),{multiple:ot,hasFeedback:ht,feedbackIcon:ut,showSuffixIcon:rt,prefixCls:J,showArrow:Y.showArrow,componentName:"Select"})),yt=!0===V?{clearIcon:mt}:V,vt=(0,s.Z)(Y,["suffixIcon","itemIcon"]),xt=o()(P||C,{[`${J}-dropdown-${_}`]:"rtl"===_},S,it),bt=(0,p.Z)((t=>{var e;return null!==(e=null!=j?j:Q)&&void 0!==e?e:t})),wt=a.useContext(f.Z),kt=null!=F?F:wt,Mt=o()({[`${J}-lg`]:"large"===bt,[`${J}-sm`]:"small"===bt,[`${J}-rtl`]:"rtl"===_,[`${J}-borderless`]:!h,[`${J}-in-form-item`]:lt},(0,u.Z)(J,ct,ht),tt,null==Z?void 0:Z.className,M,S,it),St=a.useMemo((()=>void 0!==L?L:"rtl"===_?"bottomRight":"bottomLeft"),[L,_]),Nt=(0,v.Z)(B,W);return et(a.createElement(r.ZP,Object.assign({ref:e,virtual:K,showSearch:null==Z?void 0:Z.showSearch},vt,{style:Object.assign(Object.assign({},null==Z?void 0:Z.style),R),dropdownMatchSelectWidth:st,builtinPlacements:Nt,transitionName:(0,l.m)($,"slide-up",Y.transitionName),listHeight:T,listItemHeight:A,mode:nt,prefixCls:J,placement:St,direction:_,suffixIcon:dt,menuItemSelectedIcon:pt,removeIcon:gt,allowClear:yt,notFoundContent:ft,className:Mt,getPopupContainer:N||G,dropdownClassName:xt,disabled:kt})))};const S=a.forwardRef(M),N=(0,h.Z)(S);S.SECRET_COMBOBOX_MODE_DO_NOT_USE=k,S.Option=r.Wx,S.OptGroup=r.Xo,S._InternalPanelDoNotUseOrYouWillBeFired=N,e.default=S},81327:function(t,e,i){"use strict";i.d(e,{Z:function(){return v}});var n=i(59301),o=i(92310),r=i.n(o),s=i(11592),a=i(36355),h=i(33234);const l=n.createContext({latestIndex:0}),u=l.Provider;var c=t=>{let{className:e,index:i,children:o,split:r,style:s}=t;const{latestIndex:a}=n.useContext(l);return null==o?null:n.createElement(n.Fragment,null,n.createElement("div",{className:e,style:s},o),i<a&&r&&n.createElement("span",{className:`${e}-split`},r))},f=i(2856);function d(t){return["small","middle","large"].includes(t)}function p(t){return!!t&&("number"==typeof t&&!Number.isNaN(t))}var g=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 m=n.forwardRef(((t,e)=>{var i,o;const{getPrefixCls:h,space:l,direction:m}=n.useContext(a.E_),{size:y=(null==l?void 0:l.size)||"small",align:v,className:x,rootClassName:b,children:w,direction:k="horizontal",prefixCls:M,split:S,style:N,wrap:P=!1,classNames:C,styles:T}=t,L=g(t,["size","align","className","rootClassName","children","direction","prefixCls","split","style","wrap","classNames","styles"]),[A,j]=Array.isArray(y)?y:[y,y],F=d(j),O=d(A),D=p(j),B=p(A),I=(0,s.Z)(w,{keepEmpty:!0}),z=void 0===v&&"horizontal"===k?"center":v,E=h("space",M),[R,V]=(0,f.Z)(E),Y=r()(E,null==l?void 0:l.className,V,`${E}-${k}`,{[`${E}-rtl`]:"rtl"===m,[`${E}-align-${z}`]:z,[`${E}-gap-row-${j}`]:F,[`${E}-gap-col-${A}`]:O},x,b),G=r()(`${E}-item`,null!==(i=null==C?void 0:C.item)&&void 0!==i?i:null===(o=null==l?void 0:l.classNames)||void 0===o?void 0:o.item);let X=0;const U=I.map(((t,e)=>{var i,o;null!=t&&(X=e);const r=t&&t.key||`${G}-${e}`;return n.createElement(c,{className:G,key:r,index:e,split:S,style:null!==(i=null==T?void 0:T.item)&&void 0!==i?i:null===(o=null==l?void 0:l.styles)||void 0===o?void 0:o.item},t)})),q=n.useMemo((()=>({latestIndex:X})),[X]);if(0===I.length)return null;const K={};return P&&(K.flexWrap="wrap"),!O&&B&&(K.columnGap=A),!F&&D&&(K.rowGap=j),R(n.createElement("div",Object.assign({ref:e,className:Y,style:Object.assign(Object.assign(Object.assign({},K),null==l?void 0:l.style),N)},L),n.createElement(u,{value:q},U)))}));const y=m;y.Compact=h.ZP;var v=y},17574:function(t,e,i){"use strict";i.d(e,{Z:function(){return B}});var n=i(79556),o=i(95190),r=i(52671),s=i(8657),a=i(14809),h=i(59301),l={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M880 298.4H521L403.7 186.2a8.15 8.15 0 00-5.5-2.2H144c-17.7 0-32 14.3-32 32v592c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V330.4c0-17.7-14.3-32-32-32zM840 768H184V256h188.5l119.6 114.4H840V768z"}}]},name:"folder",theme:"outlined"},u=i(7657),c=function(t,e){return h.createElement(u.Z,(0,a.Z)({},t,{ref:e,icon:l}))};var f=h.forwardRef(c),d=i(92310),p=i.n(d),g=i(35654),m=i(71430),y=i(36355),v=i(56082),x=i(62892),b=i(20648);function w(t){const{dropPosition:e,dropLevelOffset:i,prefixCls:n,indent:o,direction:r="ltr"}=t,s="ltr"===r?"left":"right",a={[s]:-i*o+4,["ltr"===r?"right":"left"]:0};switch(e){case-1:a.top=-3;break;case 1:a.bottom=-3;break;default:a.bottom=-3,a[s]=o+4}return h.createElement("div",{style:a,className:`${n}-drop-indicator`})}var k=i(71997);const M=h.forwardRef(((t,e)=>{const{getPrefixCls:i,direction:o,virtual:r,tree:s}=h.useContext(y.E_),{prefixCls:a,className:l,showIcon:u=!1,showLine:c,switcherIcon:f,blockNode:d=!1,children:g,checkable:m=!1,selectable:M=!0,draggable:S,motion:N,style:P}=t,C=i("tree",a),T=i(),L=null!=N?N:Object.assign(Object.assign({},(0,x.Z)(T)),{motionAppear:!1}),A=Object.assign(Object.assign({},t),{checkable:m,selectable:M,showIcon:u,motion:L,blockNode:d,showLine:Boolean(c),dropIndicatorRender:w}),[j,F]=(0,b.ZP)(C),O=h.useMemo((()=>{if(!S)return!1;let t={};switch(typeof S){case"function":t.nodeDraggable=S;break;case"object":t=Object.assign({},S)}return!1!==t.icon&&(t.icon=t.icon||h.createElement(v.Z,null)),t}),[S]);return j(h.createElement(n.Z,Object.assign({itemHeight:20,ref:e,virtual:r},A,{style:Object.assign(Object.assign({},null==s?void 0:s.style),P),prefixCls:C,className:p()({[`${C}-icon-hide`]:!u,[`${C}-block-node`]:d,[`${C}-unselectable`]:!M,[`${C}-rtl`]:"rtl"===o},null==s?void 0:s.className,l,F),direction:o,checkable:m?h.createElement("span",{className:`${C}-checkbox-inner`}):m,selectable:M,switcherIcon:t=>h.createElement(k.Z,{prefixCls:C,switcherIcon:f,treeNodeProps:t,showLine:c}),draggable:O}),g))}));var S,N=M;function P(t,e){t.forEach((function(t){const{key:i,children:n}=t;!1!==e(i,t)&&P(n||[],e)}))}function C(t){let{treeData:e,expandedKeys:i,startKey:n,endKey:o}=t;const r=[];let s=S.None;if(n&&n===o)return[n];if(!n||!o)return[];return P(e,(t=>{if(s===S.End)return!1;if(function(t){return t===n||t===o}(t)){if(r.push(t),s===S.None)s=S.Start;else if(s===S.Start)return s=S.End,!1}else s===S.Start&&r.push(t);return i.includes(t)})),r}function T(t,e){const i=(0,o.Z)(e),n=[];return P(t,((t,e)=>{const o=i.indexOf(t);return-1!==o&&(n.push(e),i.splice(o,1)),!!i.length})),n}!function(t){t[t.None=0]="None",t[t.Start=1]="Start",t[t.End=2]="End"}(S||(S={}));var L=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};function A(t){const{isLeaf:e,expanded:i}=t;return e?h.createElement(r.Z,null):i?h.createElement(s.Z,null):h.createElement(f,null)}function j(t){let{treeData:e,children:i}=t;return e||(0,m.zn)(i)}const F=(t,e)=>{var{defaultExpandAll:i,defaultExpandParent:n,defaultExpandedKeys:r}=t,s=L(t,["defaultExpandAll","defaultExpandParent","defaultExpandedKeys"]);const a=h.useRef(),l=h.useRef(),[u,c]=h.useState(s.selectedKeys||s.defaultSelectedKeys||[]),[f,d]=h.useState((()=>(()=>{const{keyEntities:t}=(0,m.I8)(j(s));let e;return e=i?Object.keys(t):n?(0,g.r7)(s.expandedKeys||r||[],t):s.expandedKeys||r,e})()));h.useEffect((()=>{"selectedKeys"in s&&c(s.selectedKeys)}),[s.selectedKeys]),h.useEffect((()=>{"expandedKeys"in s&&d(s.expandedKeys)}),[s.expandedKeys]);const{getPrefixCls:v,direction:x}=h.useContext(y.E_),{prefixCls:b,className:w,showIcon:k=!0,expandAction:M="click"}=s,S=L(s,["prefixCls","className","showIcon","expandAction"]),P=v("tree",b),F=p()(`${P}-directory`,{[`${P}-directory-rtl`]:"rtl"===x},w);return h.createElement(N,Object.assign({icon:A,ref:e,blockNode:!0},S,{showIcon:k,expandAction:M,prefixCls:P,className:F,expandedKeys:f,selectedKeys:u,onSelect:(t,e)=>{var i;const{multiple:n}=s,{node:r,nativeEvent:h}=e,{key:u=""}=r,d=j(s),p=Object.assign(Object.assign({},e),{selected:!0}),g=(null==h?void 0:h.ctrlKey)||(null==h?void 0:h.metaKey),m=null==h?void 0:h.shiftKey;let y;n&&g?(y=t,a.current=u,l.current=y,p.selectedNodes=T(d,y)):n&&m?(y=Array.from(new Set([].concat((0,o.Z)(l.current||[]),(0,o.Z)(C({treeData:d,expandedKeys:f,startKey:u,endKey:a.current}))))),p.selectedNodes=T(d,y)):(y=[u],a.current=u,l.current=y,p.selectedNodes=T(d,y)),null===(i=s.onSelect)||void 0===i||i.call(s,y,p),"selectedKeys"in s||c(y)},onExpand:(t,e)=>{var i;return"expandedKeys"in s||d(t),null===(i=s.onExpand)||void 0===i?void 0:i.call(s,t,e)}}))};var O=h.forwardRef(F);const D=N;D.DirectoryTree=O,D.TreeNode=n.O;var B=D},71737:function(t,e,i){"use strict";i.d(e,{FI:function(){return a}});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])},n(t,e)};function o(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function i(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}Object.create;Object.create;var r=i(12378),s=i(59301),a=function(t){function e(e){var i=t.call(this,e)||this;return i.wasCleared=!1,i.modelChangedListener=null,i.divRef=s.createRef(),i}return o(e,t),e.prototype.getDiagram=function(){return null===this.divRef.current?null:r.S0.fromDiv(this.divRef.current)},e.prototype.clear=function(){var t=this.getDiagram();null!==t&&(t.clear(),this.wasCleared=!0)},e.prototype.componentDidMount=function(){var t=this;if(null!==this.divRef.current){var e=this.props.initDiagram();e.div=this.divRef.current,this.modelChangedListener=function(e){if(e.isTransactionFinished&&e.model&&!e.model.isReadOnly&&t.props.onModelChange){var i=e.model.toIncrementalData(e);null!==i&&t.props.onModelChange(i,e)}},e.addModelChangedListener(this.modelChangedListener),e.delayInitialization((function(){t.mergeData(e,!0)}))}},e.prototype.componentWillUnmount=function(){var t=this.getDiagram();null!==t&&(t.div=null,null!==this.modelChangedListener&&(t.removeModelChangedListener(this.modelChangedListener),this.modelChangedListener=null))},e.prototype.shouldComponentUpdate=function(t,e){return t.divClassName!==this.props.divClassName||t.style!==this.props.style||!t.skipsDiagramUpdate&&(t.nodeDataArray!==this.props.nodeDataArray||t.linkDataArray!==this.props.linkDataArray||t.modelData!==this.props.modelData)},e.prototype.componentDidUpdate=function(t,e){var i=this;if(t.nodeDataArray!==this.props.nodeDataArray||t.linkDataArray!==this.props.linkDataArray||t.modelData!==this.props.modelData){var n=this.getDiagram();null!==n&&(this.wasCleared?n.delayInitialization((function(){i.mergeData(n,!0),i.wasCleared=!1})):this.mergeData(n,!1))}},e.prototype.mergeData=function(t,e){var i=this;t.model.commit((function(t){void 0!==i.props.modelData&&t.assignAllDataProperties(t.modelData,i.props.modelData),t.mergeNodeDataArray(i.props.nodeDataArray),void 0!==i.props.linkDataArray&&t instanceof r.FJ&&t.mergeLinkDataArray(i.props.linkDataArray)}),e?"initial merge":"merge data")},e.prototype.render=function(){return s.createElement("div",{ref:this.divRef,className:this.props.divClassName,style:this.props.style})},e}(s.Component);(function(t){function e(e){var i=t.call(this,e)||this;return i.divRef=s.createRef(),i}o(e,t),e.prototype.getOverview=function(){return null===this.divRef.current?null:r.S0.fromDiv(this.divRef.current)},e.prototype.componentDidMount=function(){var t;null!==this.divRef.current&&(void 0!==this.props.initOverview?t=this.props.initOverview():(t=new r.g2).contentAlignment=r.z6.Center,t.div=this.divRef.current,t.observed=this.props.observedDiagram)},e.prototype.componentWillUnmount=function(){var t=this.getOverview();null!==t&&(t.div=null,t.observed=null)},e.prototype.shouldComponentUpdate=function(t,e){return t.divClassName!==this.props.divClassName||t.style!==this.props.style||t.observedDiagram!==this.props.observedDiagram},e.prototype.componentDidUpdate=function(t,e){if(t.observedDiagram!==this.props.observedDiagram){var i=this.getOverview();null!==i&&(i.observed=this.props.observedDiagram)}},e.prototype.render=function(){return s.createElement("div",{ref:this.divRef,className:this.props.divClassName,style:this.props.style})}})(s.Component),function(t){function e(e){var i=t.call(this,e)||this;return i.wasCleared=!1,i.divRef=s.createRef(),i}o(e,t),e.prototype.getPalette=function(){return null===this.divRef.current?null:r.S0.fromDiv(this.divRef.current)},e.prototype.clear=function(){var t=this.getPalette();null!==t&&(t.clear(),this.wasCleared=!0)},e.prototype.componentDidMount=function(){var t=this;if(null!==this.divRef.current){var e=this.props.initPalette();e.div=this.divRef.current,e.delayInitialization((function(){t.mergeData(e,!0)}))}},e.prototype.componentWillUnmount=function(){var t=this.getPalette();null!==t&&(t.div=null)},e.prototype.shouldComponentUpdate=function(t,e){return t.divClassName!==this.props.divClassName||t.style!==this.props.style||(t.nodeDataArray!==this.props.nodeDataArray||t.linkDataArray!==this.props.linkDataArray||t.modelData!==this.props.modelData)},e.prototype.componentDidUpdate=function(t,e){var i=this;if(t.nodeDataArray!==this.props.nodeDataArray||t.linkDataArray!==this.props.linkDataArray||t.modelData!==this.props.modelData){var n=this.getPalette();null!==n&&(this.wasCleared?n.delayInitialization((function(){i.mergeData(n,!0),i.wasCleared=!1})):this.mergeData(n,!1))}},e.prototype.mergeData=function(t,e){var i=this;t.model.commit((function(t){void 0!==i.props.modelData&&t.assignAllDataProperties(t.modelData,i.props.modelData),t.mergeNodeDataArray(i.props.nodeDataArray),void 0!==i.props.linkDataArray&&t instanceof r.FJ&&t.mergeLinkDataArray(i.props.linkDataArray)}),e?"initial merge":"merge data")},e.prototype.render=function(){return s.createElement("div",{ref:this.divRef,className:this.props.divClassName,style:this.props.style})}}(s.Component)},12378:function(t,e,i){"use strict";i.d(e,{$u:function(){return r},BD:function(){return g},E9:function(){return o},FF:function(){return M},FJ:function(){return u},Hn:function(){return l},KX:function(){return c},NB:function(){return b},S0:function(){return d},UL:function(){return s},Vk:function(){return h},al:function(){return x},bn:function(){return v},bx:function(){return m},g2:function(){return p},h1:function(){return f},hD:function(){return k},rU:function(){return w},s_:function(){return y},z6:function(){return a}}),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 f=void 0!==i.g&&null!=i.g?i.g:self,d="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=f;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||d})),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 M(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 S(t){m.console&&m.console.log(t)}function N(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 C(t){return Array.prototype.slice.call(t)}function T(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 j(t){t.length=0,R.push(t)}function F(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(N(t)&&t.constructor)return F(t.constructor);return typeof t}function O(t){var e=t;return N(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 D(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 B(t,e,i){Object.defineProperty(xi.prototype,t,{get:e,set:i})}function I(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 z=void 0!==m.navigator&&0<m.navigator.userAgent.indexOf("Trident/7"),E=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 Y(t,e){return null==e||""===e?null:t[e]}function G(){this.ew=[]}function X(){}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},f.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",G.prototype.toString=function(){return this.ew.join("")},G.prototype.add=function(t){""!==t&&this.ew.push(t)},G.className="StringBuilder",X.className="PropertyCollection";var U={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 q(){}q.prototype.reset=function(){},q.prototype.next=function(){return!1},q.prototype.Ad=function(){return!1},q.prototype.first=function(){return null},q.prototype.any=function(){return!1},q.prototype.all=function(){return!0},q.prototype.each=function(){return this},q.prototype.map=function(){return this},q.prototype.filter=function(){return this},q.prototype.de=function(){},q.prototype.toString=function(){return"EmptyIterator"},f.Object.defineProperties(q.prototype,{iterator:{get:function(){return this}},count:{get:function(){return 0}}}),q.prototype.first=q.prototype.first,q.prototype.hasNext=q.prototype.Ad,q.prototype.next=q.prototype.next,q.prototype.reset=q.prototype.reset;var K;function H(t){this.key=-1,this.value=t}function W(t){this.Bb=t,this.qf=null,t.Sa=null,this.qa=t.Ja,this.Za=-1}function Z(t){this.Bb=t,t.Hg=null,this.qa=t.Ja,this.Za=t.s.length}function J(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 $(t){this.eg=t,t.Sa=null,this.qa=t.Ja,this.sa=null}function _(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}q.className="EmptyIterator",K=new q,H.prototype.reset=function(){this.key=-1},H.prototype.next=function(){return-1===this.key&&(this.key=0,!0)},H.prototype.Ad=function(){return this.next()},H.prototype.first=function(){return this.key=0,this.value},H.prototype.any=function(t){return this.key=-1,t(this.value)},H.prototype.all=function(t){return this.key=-1,t(this.value)},H.prototype.each=function(t){return this.key=-1,t(this.value),this},H.prototype.map=function(t){return new H(t(this.value))},H.prototype.filter=function(t){return t(this.value)?new H(this.value):K},H.prototype.de=function(){this.value=null},H.prototype.toString=function(){return"SingletonIterator("+this.value+")"},f.Object.defineProperties(H.prototype,{iterator:{get:function(){return this}},count:{get:function(){return 1}}}),H.prototype.first=H.prototype.first,H.prototype.hasNext=H.prototype.Ad,H.prototype.next=H.prototype.next,H.prototype.reset=H.prototype.reset,H.className="SingletonIterator",W.prototype.reset=function(){var t=this.Bb;t.Sa=null,this.qa=t.Ja,this.Za=-1},W.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},W.prototype.Ad=function(){return this.next()},W.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},W.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},W.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},W.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},W.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 J).s=i,t.xb(),t.iterator},W.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 J).s=i,t.xb(),t.iterator},W.prototype.de=function(){this.key=-1,this.value=null,this.qa=-1,this.qf=null,this.Bb.Sa=this},W.prototype.toString=function(){return"ListIterator@"+this.Za+"/"+this.Bb.count},f.Object.defineProperties(W.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}}}),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="ListIterator",Z.prototype.reset=function(){var t=this.Bb;t.Hg=null,this.qa=t.Ja,this.Za=t.s.length},Z.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)},Z.prototype.Ad=function(){return this.next()},Z.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},Z.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},Z.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},Z.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},Z.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 J).s=i,t.xb(),t.iterator},Z.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 J).s=i,t.xb(),t.iterator},Z.prototype.de=function(){this.key=-1,this.value=null,this.qa=-1,this.Bb.Hg=this},Z.prototype.toString=function(){return"ListIteratorBackwards("+this.Za+"/"+this.Bb.count+")"},f.Object.defineProperties(Z.prototype,{iterator:{get:function(){return this}},count:{get:function(){return this.Bb.s.length}}}),Z.prototype.first=Z.prototype.first,Z.prototype.hasNext=Z.prototype.Ad,Z.prototype.next=Z.prototype.next,Z.prototype.reset=Z.prototype.reset,Z.className="ListIteratorBackwards",(e=J.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)&&M(t,"0 <= i < length",J,"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)&&M(t,"0 <= i < length",J,"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},J.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},J.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},J.prototype.each=function(t){for(var e=this.s,i=e.length,n=0;n<i;n++)t(e[n]);return this},J.prototype.map=function(t){for(var e=new J,i=[],n=this.s,o=n.length,r=0;r<o;r++)i.push(t(n[r]));return e.s=i,e.xb(),e},J.prototype.filter=function(t){for(var e=new J,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=J.prototype).Gb=function(t,e){0>t&&M(t,">= 0",J,"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)&&M(t,"0 <= i < length",J,"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},J.prototype.copy=function(){var t=new J,e=this.s;return 0<e.length&&(t.s=Array.prototype.slice.call(e)),t},(e=J.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 _,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)&&M(e,"0 <= from < length",J,"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},f.Object.defineProperties(J.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 K;var t=this.Sa;return null!==t?(t.reset(),t):new W(this)}},iteratorBackwards:{get:function(){if(0>=this.s.length)return K;var t=this.Hg;return null!==t?(t.reset(),t):new Z(this)}}}),J.prototype.reverse=J.prototype.reverse,J.prototype.sortRange=J.prototype.zi,J.prototype.sort=J.prototype.sort,J.prototype.toSet=J.prototype.Iv,J.prototype.toArray=J.prototype.Fa,J.prototype.removeRange=J.prototype.removeRange,J.prototype.removeAt=J.prototype.mb,J.prototype.delete=J.prototype.delete,J.prototype.remove=J.prototype.remove,J.prototype.insertAt=J.prototype.Gb,J.prototype.pop=J.prototype.pop,J.prototype.last=J.prototype.jc,J.prototype.first=J.prototype.first,J.prototype.set=J.prototype.set,J.prototype.setElt=J.prototype.cd,J.prototype.get=J.prototype.get,J.prototype.elt=J.prototype.M,J.prototype.indexOf=J.prototype.indexOf,J.prototype.has=J.prototype.has,J.prototype.contains=J.prototype.contains,J.prototype.clear=J.prototype.clear,J.prototype.addAll=J.prototype.addAll,J.prototype.push=J.prototype.push,J.prototype.add=J.prototype.add,J.prototype.thaw=J.prototype.ka,J.prototype.freeze=J.prototype.freeze,J.className="List",$.prototype.reset=function(){var t=this.eg;t.Sa=null,this.qa=t.Ja,this.sa=null},$.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)},$.prototype.Ad=function(){return this.next()},$.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},$.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},$.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},$.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},$.prototype.map=function(t){var e=this.eg;e.Sa=null;var i=new J;for(e=e.ea;null!==e;)i.add(t(e.value)),e=e.va;return i.iterator},$.prototype.filter=function(t){var e=this.eg;e.Sa=null;var i=new J;for(e=e.ea;null!==e;){var n=e.value;t(n)&&i.add(n),e=e.va}return i.iterator},$.prototype.de=function(){this.value=this.key=null,this.qa=-1,this.eg.Sa=this},$.prototype.toString=function(){return null!==this.sa?"SetIterator@"+this.sa.value:"SetIterator"},f.Object.defineProperties($.prototype,{iterator:{get:function(){return this}},count:{get:function(){return this.eg.Sb}}}),$.prototype.first=$.prototype.first,$.prototype.hasNext=$.prototype.Ad,$.prototype.next=$.prototype.next,$.prototype.reset=$.prototype.reset,$.className="SetIterator",(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"Set()#"+et(this)},e.add=function(t){if(null===t)return this;this._isFrozen&&k(this,t);var e=t;return N(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(!N(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},_.prototype.any=function(t){for(var e=this.ea;null!==e;){if(t(e.value))return!0;e=e.va}return!1},_.prototype.all=function(t){for(var e=this.ea;null!==e;){if(!t(e.value))return!1;e=e.va}return!0},_.prototype.each=function(t){for(var e=this.ea;null!==e;)t(e.value),e=e.va;return this},_.prototype.map=function(t){for(var e=new _,i=this.ea;null!==i;)e.add(t(i.value)),i=i.va;return e},_.prototype.filter=function(t){for(var e=new _,i=this.ea;null!==i;){var n=i.value;t(n)&&e.add(n),i=i.va}return e},(e=_.prototype).remove=function(t){if(null===t)return!1;this._isFrozen&&k(this,t);var e=t;if(N(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 _;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()},_.prototype.copy=function(){var t,e=new _,i=this.Tb;for(t in i)e.add(i[t].value);return e},_.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},_.prototype.Hv=function(){var t,e=new J,i=this.Tb;for(t in i)e.add(i[t].value);return e},f.Object.defineProperties(_.prototype,{count:{get:function(){return this.Sb}},size:{get:function(){return this.Sb}},iterator:{get:function(){if(0>=this.Sb)return K;var t=this.Sa;return null!==t?(t.reset(),t):new $(this)}}}),_.prototype.toList=_.prototype.Hv,_.prototype.toArray=_.prototype.Fa,_.prototype.clear=_.prototype.clear,_.prototype.retainAll=_.prototype.pA,_.prototype.removeAll=_.prototype.hp,_.prototype.delete=_.prototype.delete,_.prototype.remove=_.prototype.remove,_.prototype.first=_.prototype.first,_.prototype.containsAny=_.prototype.Ty,_.prototype.containsAll=_.prototype.Sy,_.prototype.has=_.prototype.has,_.prototype.contains=_.prototype.contains,_.prototype.addAll=_.prototype.addAll,_.prototype.add=_.prototype.add,_.prototype.thaw=_.prototype.ka,_.prototype.freeze=_.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){_.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 ft(t){this.ma=t,t.Sa=null,this.qa=t.Ja,this.sa=null}function dt(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)}_.className="Set",_.uniqueHash=Q,_.hashIdUnique=tt,_.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 J;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 J;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"},f.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,_),(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 _,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 _,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 _,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 J,i=this.ma.Tb;for(t in i)e.add(i[t].key);return e},f.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?K: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 J;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 J;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"},f.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",ft.prototype.reset=function(){var t=this.ma;t.Sa=null,this.qa=t.Ja,this.sa=null},ft.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)},ft.prototype.Ad=function(){return this.next()},ft.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},ft.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},ft.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},ft.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},ft.prototype.map=function(t){var e=this.ma;this.sa=e.Sa=null;var i=new J;for(e=e.ea;null!==e;)i.add(t(e)),e=e.va;return i.iterator},ft.prototype.filter=function(t){var e=this.ma;this.sa=e.Sa=null;var i=new J;for(e=e.ea;null!==e;)t(e)&&i.add(e),e=e.va;return i.iterator},ft.prototype.de=function(){this.value=this.key=null,this.qa=-1,this.ma.Sa=this},ft.prototype.toString=function(){return null!==this.sa?"MapIterator@"+this.sa:"MapIterator"},f.Object.defineProperties(ft.prototype,{iterator:{get:function(){return this}},count:{get:function(){return this.ma.Sb}}}),ft.prototype.first=ft.prototype.first,ft.prototype.hasNext=ft.prototype.Ad,ft.prototype.next=ft.prototype.next,ft.prototype.reset=ft.prototype.reset,ft.className="MapIterator",(e=dt.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;N(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 dt)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},dt.prototype.any=function(t){for(var e=this.ea;null!==e;){if(t(e))return!0;e=e.va}return!1},dt.prototype.all=function(t){for(var e=this.ea;null!==e;){if(!t(e))return!1;e=e.va}return!0},dt.prototype.each=function(t){for(var e=this.ea;null!==e;)t(e),e=e.va;return this},dt.prototype.map=function(t){for(var e=new dt,i=this.ea;null!==i;)e.add(i.key,t(i)),i=i.va;return e},dt.prototype.filter=function(t){for(var e=new dt,i=this.ea;null!==i;)t(i)&&e.add(i.key,i.value),i=i.va;return e},(e=dt.prototype).contains=function(t){var e=t;return(!N(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 N(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(N(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()},dt.prototype.copy=function(){var t,e=new dt,i=this.Tb;for(t in i){var n=i[t];e.add(n.key,n.value)}return e},dt.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},dt.prototype.Lf=function(){return new lt(this)},f.Object.defineProperties(dt.prototype,{count:{get:function(){return this.Sb}},size:{get:function(){return this.Sb}},iterator:{get:function(){if(0>=this.count)return K;var t=this.Sa;return null!==t?(t.reset(),t):new ft(this)}},iteratorKeys:{get:function(){return 0>=this.count?K:new ht(this)}},iteratorValues:{get:function(){if(0>=this.count)return K;var t=this.jf;return null!==t?(t.reset(),t):new ut(this)}}}),dt.prototype.toKeySet=dt.prototype.Lf,dt.prototype.toArray=dt.prototype.Fa,dt.prototype.clear=dt.prototype.clear,dt.prototype.delete=dt.prototype.delete,dt.prototype.remove=dt.prototype.remove,dt.prototype.get=dt.prototype.get,dt.prototype.getValue=dt.prototype.I,dt.prototype.has=dt.prototype.has,dt.prototype.contains=dt.prototype.contains,dt.prototype.first=dt.prototype.first,dt.prototype.addAll=dt.prototype.addAll,dt.prototype.set=dt.prototype.set,dt.prototype.add=dt.prototype.add,dt.prototype.thaw=dt.prototype.ka,dt.prototype.freeze=dt.prototype.freeze,dt.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 Xe.B(this.x,t.x)&&Xe.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 Xe.Fl(t.x,t.y,e.x,e.y,this.x,this.y)},e.fA=function(t,e,i,n){return Xe.qh(t,e,i,n,this.x,this.y,this),this},e.gA=function(t,e){return Xe.qh(t.x,t.y,e.x,e.y,this.x,this.y,this),this},e.uA=function(t,e,i,n){return Xe.No(this.x,this.y,t,e,i,n,this),this},e.vA=function(t,e){return Xe.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 Xe.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 Xe.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,Mt,St,Nt,Pt,Ct,Tt,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 jt(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 Ft(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 Xe.B(this.width,t.width)&&Xe.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=Ot.pop();return void 0===t?new At:t},At.free=function(t){Ot.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 Ot=[];function Dt(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 Bt(t,e,i){t.width=e,t.height=i}function It(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 Dt(i,o,r,s)}return new Dt}function zt(t){return t.x.toString()+" "+t.y.toString()+" "+t.width.toString()+" "+t.height.toString()}function Et(t,e){return Xe.$(t.x,e.x)&&Xe.$(t.y,e.y)&&Xe.$(t.width,e.width)&&Xe.$(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 Yt(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 Gt(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 Xt(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 Ut(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=jt,At.stringify=Ft,At.ZeroSize=kt=new At(0,0).ja(),At.OneSize=Mt=new At(1,1).ja(),At.SixSize=St=new At(6,6).ja(),At.EightSize=Nt=new At(8,8).ja(),At.TenSize=Pt=new At(10,10).ja(),At.InfiniteSize=Ct=new At(1/0,1/0).ja(),At.NoSize=Tt=new At(NaN,NaN).ja(),At.parse=jt,At.stringify=Ft,(e=Dt.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},Dt.prototype.copy=function(){var t=new Dt;return t.x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,t},(e=Dt.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 Dt&&(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 Xe.B(this.x,t.x)&&Xe.B(this.y,t.y)&&Xe.B(this.width,t.width)&&Xe.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 Gt(this,t.x,t.y,0,0)},e.ed=function(t){return Gt(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),Gt(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},Dt.alloc=function(){var t=Ht.pop();return void 0===t?new Dt:t},Dt.allocAt=function(t,e,i,n){var o=Ht.pop();return void 0===o?new Dt(t,e,i,n):o.h(t,e,i,n)},Dt.free=function(t){Ht.push(t)},f.Object.defineProperties(Dt.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}}}),Dt.prototype.isEmpty=Dt.prototype.Mz,Dt.prototype.isReal=Dt.prototype.w,Dt.intersectsLineSegment=function(t,e,i,n,o,r,s,a){return Xe.Fx(t,e,i,n,o,r,s,a)},Dt.prototype.setSpot=Dt.prototype.yi,Dt.prototype.union=Dt.prototype.Kv,Dt.prototype.unionRect=Dt.prototype.ed,Dt.prototype.unionPoint=Dt.prototype.Ye,Dt.prototype.intersects=Dt.prototype.Vu,Dt.prototype.intersectsRect=Dt.prototype.Yc,Dt.prototype.intersect=Dt.prototype.Uu,Dt.prototype.intersectRect=Dt.prototype.Ex,Dt.prototype.grow=Dt.prototype.Hz,Dt.prototype.subtractMargin=Dt.prototype.Fv,Dt.prototype.addMargin=Dt.prototype.Co,Dt.prototype.inflate=Dt.prototype.Bc,Dt.prototype.offset=Dt.prototype.offset,Dt.prototype.contains=Dt.prototype.contains,Dt.prototype.containsRect=Dt.prototype.Re,Dt.prototype.containsPoint=Dt.prototype.ca,Dt.prototype.equalsApprox=Dt.prototype.Xa,Dt.prototype.equalTo=Dt.prototype.hi,Dt.prototype.equals=Dt.prototype.D,Dt.prototype.setSize=Dt.prototype.tA,Dt.prototype.setPoint=Dt.prototype.dd,Dt.prototype.set=Dt.prototype.set,Dt.prototype.setTo=Dt.prototype.sg;var qt,Kt,Ht=[];function Wt(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 Zt(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 Wt;for(var o=NaN;""===t[e];)e++;if((n=t[e++])&&(o=parseFloat(n)),isNaN(o))return new Wt(i);for(var r=NaN;""===t[e];)e++;if((n=t[e++])&&(r=parseFloat(n)),isNaN(r))return new Wt(i,o);for(var s=NaN;""===t[e];)e++;return(n=t[e++])&&(s=parseFloat(n)),isNaN(s)?new Wt(i,o):new Wt(i,o,r,s)}return new Wt}function Jt(t){return t.top.toString()+" "+t.right.toString()+" "+t.bottom.toString()+" "+t.left.toString()}Dt.className="Rect",Dt.parse=It,Dt.stringify=zt,Dt.contains=Xt,Dt.intersects=Ut,Dt.ZeroRect=qt=new Dt(0,0,0,0).ja(),Dt.NoRect=Kt=new Dt(NaN,NaN,NaN,NaN).ja(),Dt.parse=It,Dt.stringify=zt,Dt.contains=Xt,Dt.intersects=Ut,Wt.prototype.assign=function(t){return this.top=t.top,this.right=t.right,this.bottom=t.bottom,this.left=t.left,this},Wt.prototype.sg=function(t,e,i,n){return this.top=t,this.right=e,this.bottom=i,this.left=n,this},Wt.prototype.set=function(t){return this.top=t.top,this.right=t.right,this.bottom=t.bottom,this.left=t.left,this},Wt.prototype.copy=function(){var t=new Wt;return t.top=this.top,t.right=this.right,t.bottom=this.bottom,t.left=this.left,t},(e=Wt.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 Wt&&(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 Xe.B(this.top,t.top)&&Xe.B(this.right,t.right)&&Xe.B(this.bottom,t.bottom)&&Xe.B(this.left,t.left)},e.w=function(){return isFinite(this.top)&&isFinite(this.right)&&isFinite(this.bottom)&&isFinite(this.left)},Wt.alloc=function(){var t=Be.pop();return void 0===t?new Wt:t},Wt.free=function(t){Be.push(t)},Wt.prototype.isReal=Wt.prototype.w,Wt.prototype.equalsApprox=Wt.prototype.Xa,Wt.prototype.equalTo=Wt.prototype.hi,Wt.prototype.equals=Wt.prototype.D,Wt.prototype.set=Wt.prototype.set,Wt.prototype.setTo=Wt.prototype.sg;var $t,_t,Qt,te,ee,ie,ne,oe,re,se,ae,he,le,ue,ce,fe,de,pe,ge,me,ye,ve,xe,be,we,ke,Me,Se,Ne,Pe,Ce,Te,Le,Ae,je,Fe,Oe,De,Be=[];function Ie(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 ze(t,e){return t.x=NaN,t.y=NaN,t.offsetX=e,t}function Ee(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 fe;if("TopBottomSides"===t)return de;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 Me;if("Default"===t)return Se;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 Ie(i,o,r,s)}return new Ie}function Re(t){return t.sb()?t.x.toString()+" "+t.y.toString()+" "+t.offsetX.toString()+" "+t.offsetY.toString():t.toString()}Wt.className="Margin",Wt.parse=Zt,Wt.stringify=Jt,Wt.ZeroMargin=$t=new Wt(0,0,0,0).ja(),Wt.TwoMargin=_t=new Wt(2,2,2,2).ja(),Wt.parse=Zt,Wt.stringify=Jt,Ie.prototype.assign=function(t){return this.x=t.x,this.y=t.y,this.offsetX=t.offsetX,this.offsetY=t.offsetY,this},Ie.prototype.sg=function(t,e,i,n){return this.x=t,this.y=e,this.offsetX=i,this.offsetY=n,this},Ie.prototype.set=function(t){return this.x=t.x,this.y=t.y,this.offsetX=t.offsetX,this.offsetY=t.offsetY,this},Ie.prototype.copy=function(){var t=new Ie;return t.x=this.x,t.y=this.y,t.offsetX=this.offsetX,t.offsetY=this.offsetY,t},(e=Ie.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(fe)?"BottomSide":this.D(de)?"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(Me)?"AllSides":this.D(Se)?"Default":"None"},e.D=function(t){return t instanceof Ie&&((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 Ie(.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(Ne))t=ue;else if(t.D(Pe))t=ce;else if(t.D(Ce))t=le;else{if(!t.D(Te))return!1;t=fe}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},Ie.alloc=function(){var t=Ve.pop();return void 0===t?new Ie:t},Ie.free=function(t){Ve.push(t)},Ie.prototype.isDefault=Ie.prototype.Xb,Ie.prototype.isNone=Ie.prototype.ys,Ie.prototype.isSide=Ie.prototype.$c,Ie.prototype.isNoSpot=Ie.prototype.Mc,Ie.prototype.isSpot=Ie.prototype.sb,Ie.prototype.includesSide=Ie.prototype.Hf,Ie.prototype.opposite=Ie.prototype.gv,Ie.prototype.equals=Ie.prototype.D,Ie.prototype.set=Ie.prototype.set,Ie.prototype.setTo=Ie.prototype.sg;var Ve=[];function Ye(){this.m11=1,this.m21=this.m12=0,this.m22=1,this.dy=this.dx=0}Ie.className="Spot",Ie.parse=Ee,Ie.stringify=Re,Ie.None=Qt=ze(new Ie(0,0,0,0),0).ja(),Ie.Default=Se=ze(new Ie(0,0,-1,0),-1).ja(),Ie.TopLeft=te=new Ie(0,0,0,0).ja(),Ie.TopCenter=ee=new Ie(.5,0,0,0).ja(),Ie.TopRight=ie=new Ie(1,0,0,0).ja(),Ie.LeftCenter=ne=new Ie(0,.5,0,0).ja(),Ie.Center=oe=new Ie(.5,.5,0,0).ja(),Ie.RightCenter=re=new Ie(1,.5,0,0).ja(),Ie.BottomLeft=se=new Ie(0,1,0,0).ja(),Ie.BottomCenter=ae=new Ie(.5,1,0,0).ja(),Ie.BottomRight=he=new Ie(1,1,0,0).ja(),Ie.MiddleTop=Le=ee,Ie.MiddleLeft=Ae=ne,Ie.MiddleRight=je=re,Ie.MiddleBottom=Fe=ae,Ie.Top=Ce=ee,Ie.Left=Ne=ne,Ie.Right=Pe=re,Ie.Bottom=Te=ae,Ie.TopSide=le=ze(new Ie(0,0,1,1),1).ja(),Ie.LeftSide=ue=ze(new Ie(0,0,1,2),1).ja(),Ie.RightSide=ce=ze(new Ie(0,0,1,4),1).ja(),Ie.BottomSide=fe=ze(new Ie(0,0,1,8),1).ja(),Ie.TopBottomSides=de=ze(new Ie(0,0,1,9),1).ja(),Ie.LeftRightSides=pe=ze(new Ie(0,0,1,6),1).ja(),Ie.TopLeftSides=ge=ze(new Ie(0,0,1,3),1).ja(),Ie.TopRightSides=me=ze(new Ie(0,0,1,5),1).ja(),Ie.BottomLeftSides=ye=ze(new Ie(0,0,1,10),1).ja(),Ie.BottomRightSides=ve=ze(new Ie(0,0,1,12),1).ja(),Ie.NotTopSide=xe=ze(new Ie(0,0,1,14),1).ja(),Ie.NotLeftSide=be=ze(new Ie(0,0,1,13),1).ja(),Ie.NotRightSide=we=ze(new Ie(0,0,1,11),1).ja(),Ie.NotBottomSide=ke=ze(new Ie(0,0,1,7),1).ja(),Ie.AllSides=Me=ze(new Ie(0,0,1,15),1).ja(),Oe=new Ie(.156,.156).ja(),De=new Ie(.844,.844).ja(),Ie.parse=Ee,Ie.stringify=Re,Ye.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},Ye.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},Ye.prototype.copy=function(){var t=new Ye;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},Ye.prototype.toString=function(){return"Transform("+this.m11+","+this.m12+","+this.m21+","+this.m22+","+this.dx+","+this.dy+")"},Ye.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},Ye.prototype.ws=function(){return 0===this.dx&&0===this.dy&&1===this.m11&&0===this.m12&&0===this.m21&&1===this.m22},Ye.prototype.reset=function(){return this.m11=1,this.m21=this.m12=0,this.m22=1,this.dy=this.dx=0,this},Ye.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},Ye.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},Ye.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},Ye.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=Ye.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,f=e*s+i*h+u,d=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,d),c=Math.max(c,d),d=Math.min(f,p),f=Math.max(f,p),o=Math.min(o,i),c=Math.max(c,i),d=Math.min(d,e),f=Math.max(f,e),o=Math.min(o,r),c=Math.max(c,r),d=Math.min(d,n),f=Math.max(f,n),t.h(o,d,c-o,f-d),t},Ye.alloc=function(){var t=Ge.pop();return void 0===t?new Ye:t},Ye.free=function(t){Ge.push(t)},Ye.prototype.transformRect=Ye.prototype.pp,Ye.prototype.transformPoint=Ye.prototype.Ga,Ye.prototype.scale=Ye.prototype.scale,Ye.prototype.translate=Ye.prototype.translate,Ye.prototype.rotate=Ye.prototype.rotate,Ye.prototype.invert=Ye.prototype.Vj,Ye.prototype.multiplyInverted=Ye.prototype.bv,Ye.prototype.multiply=Ye.prototype.multiply,Ye.prototype.reset=Ye.prototype.reset,Ye.prototype.isIdentity=Ye.prototype.ws,Ye.prototype.equals=Ye.prototype.D,Ye.prototype.setTransform=Ye.prototype.setTransform,Ye.prototype.set=Ye.prototype.set;var Ge=[];Ye.className="Transform",Ye.xF="54a702f3e53909c447824c6706603faf4c";var Xe={AA:"7da71ca0ad381e90",wg:(Math.sqrt(2)-1)/3*4,Uv:null,sqrt:function(t){if(0>=t)return 0;var e=Xe.Uv;if(null===e){e=[];for(var i=0;2e3>=i;i++)e[i]=Math.sqrt(i);Xe.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(Xe.Yb(t,e,s,a,c,i,n)&&Xe.Yb(t,e,s,a,c,o,r))return Xe.Yb(t,e,s,a,c,l,u);var f=(t+i)/2,d=(e+n)/2,p=(i+o)/2,g=(n+r)/2,m=((n=(f+p)/2)+(p=(p+(o=(o+s)/2))/2))/2,y=((i=(d+g)/2)+(g=(g+(r=(r+a)/2))/2))/2;return Xe.cs(t,e,f,d,n,i,m,y,h,l,u,c)||Xe.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(Xe.Yb(t,e,s,a,h,i,n)&&Xe.Yb(t,e,s,a,h,o,r))Gt(l,t,e,0,0),Gt(l,s,a,0,0);else{var u=(t+i)/2,c=(e+n)/2,f=(i+o)/2,d=(n+r)/2,p=((n=(u+f)/2)+(f=(f+(o=(o+s)/2))/2))/2,g=((i=(c+d)/2)+(d=(d+(r=(r+a)/2))/2))/2;Xe.Dl(t,e,u,c,n,i,p,g,h,l),Xe.Dl(p,g,f,d,o,r,s,a,h,l)}return l},Qe:function(t,e,i,n,o,r,s,a,h,l){if(Xe.Yb(t,e,s,a,h,i,n)&&Xe.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,f=(i+o)/2,d=(n+r)/2,p=((n=(u+f)/2)+(f=(f+(o=(o+s)/2))/2))/2,g=((i=(c+d)/2)+(d=(d+(r=(r+a)/2))/2))/2;Xe.Qe(t,e,u,c,n,i,p,g,h,l),Xe.Qe(p,g,f,d,o,r,s,a,h,l)}return l},jv:function(t,e,i,n,o,r,s,a,h,l){if(Xe.Yb(t,e,o,r,l,i,n))return Xe.Yb(t,e,o,r,l,a,h);var u=(t+i)/2,c=(e+n)/2,f=(u+(i=(i+o)/2))/2,d=(c+(n=(n+r)/2))/2;return Xe.jv(t,e,u,c,f,d,s,a,h,l)||Xe.jv(f,d,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(Xe.Yb(t,e,o,r,s,i,n))Gt(a,t,e,0,0),Gt(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;Xe.iv(t,e,h,l,u,c,s,a),Xe.iv(u,c,i,n,o,r,s,a)}return a},ep:function(t,e,i,n,o,r,s,a){if(Xe.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;Xe.ep(t,e,h,l,u,c,s,a),Xe.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,f,d){if(Xe.Yb(t,e,s,a,f,i,n)&&Xe.Yb(t,e,s,a,f,o,r))return!!Xe.Rl(t,e,s,a,h,l,u,c)&&(0!=(f=(t-s)*(l-c)-(e-a)*(h-u))&&(d.h(((t*a-e*s)*(h-u)-(t-s)*(h*c-l*u))/f,((t*a-e*s)*(l-c)-(e-a)*(h*c-l*u))/f),!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,M=0;return Xe.Eo(t,e,p,g,n,i,v,x,h,l,u,c,f,d)&&((t=(d.x-h)*(d.x-h)+(d.y-l)*(d.y-l))<b&&(b=t,w=!0,k=d.x,M=d.y)),Xe.Eo(v,x,m,y,o,r,s,a,h,l,u,c,f,d)&&(d.x-h)*(d.x-h)+(d.y-l)*(d.y-l)<b&&(w=!0,k=d.x,M=d.y),w&&(d.x=k,d.y=M),w},Fo:function(t,e,i,n,o,r,s,a,h,l,u,c,f){var d=0;if(Xe.Yb(t,e,s,a,f,i,n)&&Xe.Yb(t,e,s,a,f,o,r)){if(0===(f=(t-s)*(l-c)-(e-a)*(h-u)))return d;var p=((t*a-e*s)*(h-u)-(t-s)*(h*c-l*u))/f,g=((t*a-e*s)*(l-c)-(e-a)*(h*c-l*u))/f;if(p>=u)return d;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 d}else if(t<s?(h=t,t=s):h=s,p<h||p>t)return d;0<f?d++:0>f&&d--}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;d+=Xe.Fo(t,e,p,g,n,i,v,x,h,l,u,c,f),d+=Xe.Fo(v,x,m,y,o,r,s,a,h,l,u,c,f)}return d},qh:function(t,e,i,n,o,r,s){return Xe.$(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)):Xe.$(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 Xe.B(t,i)&&Xe.B(e,n)?(h.h(t,e),!1):Xe.$(o,s)?Xe.$(t,i)?(Xe.qh(t,e,i,n,o,r,h),!1):Xe.qh(t,e,i,n,o,(n-e)/(i-t)*(o-t)+e,h):(a=(a-r)/(s-o),Xe.$(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),Xe.$(a,s)?(Xe.qh(t,e,i,n,o,r,h),!1):(o=(s*t-a*o+r-e)/(s-a),Xe.$(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)):Xe.qh(t,e,i,n,o,s*(o-t)+e,h))))},MA:function(t,e,i,n,o){return Xe.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 f=0,d=0,p=0,g=0;if(o<s?(f=o,d=s):(f=s,d=o),r<a?(p=o,g=s):(p=s,g=o),f=(d-f)/2+l,l=(g-p)/2+l,o=(o+s)/2,r=(r+a)/2,0===f||0===l)return h;if(.5>(i>t?i-t:t-i)){if(0>(f=1-(i-o)*(i-o)/(f*f)))return h;n=-l*(f=Math.sqrt(f))+r,u(i,l*f+r),u(i,n)}else{if(0>(f=(a=2*(i=(n-e)/(i-t))*(e-i*t)/(l*l)-2*i*r/(l*l)-2*o/(f*f))*a-4*(n=1/(f*f)+i*i/(l*l))*(2*i*t*r/(l*l)-2*e*r/(l*l)+r*r/(l*l)+o*o/(f*f)-1+(e-i*t)*(e-i*t)/(l*l))))return h;u(l=(-a+(f=Math.sqrt(f)))/(2*n),i*l-i*t+e),u(f=(-a-f)/(2*n),i*f-i*t+e)}return h},Ff:function(t,e,i,n,o,r,s,a,h){var l=1e21,u=t,c=e;if(Xe.Ve(t,e,t,n,o,r,s,a,h)){var f=(h.x-o)*(h.x-o)+(h.y-r)*(h.y-r);f<l&&(l=f,u=h.x,c=h.y)}return Xe.Ve(i,e,i,n,o,r,s,a,h)&&((f=(h.x-o)*(h.x-o)+(h.y-r)*(h.y-r))<l&&(l=f,u=h.x,c=h.y)),Xe.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)),Xe.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 Xe.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):!!(Xt(t,e,i,n,o,r)||Xt(t,e,i,n,s,a)||Xe.Rl(t,e,h,e,o,r,s,a)||Xe.Rl(h,e,h,l,o,r,s,a)||Xe.Rl(h,l,t,l,o,r,s,a)||Xe.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>=Xe.Fl(t,e,i,n,o,r)*Xe.Fl(t,e,i,n,s,a)&&0>=Xe.Fl(o,r,s,a,t,e)*Xe.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(Xe.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),Xe.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 X,um:new X,Mf:new X,Nf:0,vm:100};function Ue(t){Q(this),this.l=2,void 0===t&&(t=Ue.o),this.na=t,this.Ec=this.Dc=this.pd=this.od=0,t===Ue.o?this.ee=new J:(null===Ue.V&&(Ue.V=(new J).freeze()),this.ee=Ue.V),this.aq=this.ee.Ja,this.Ip=(new Dt).freeze(),this.ym=this.tk=null,this.zm=NaN,this.fg=te,this.gg=he,this.Rk=this.Sk=NaN,this.Uf=cs}function qe(t,e){return t.type===Ue.j&&e.type===Ue.o&&!!(1===e.figures.count&&(e=e.figures.M(0),1===e.segments.count&&Xe.B(t.startX,e.startX)&&Xe.B(t.startY,e.startY)&&(e=e.segments.M(0),e.type===ni&&Xe.B(t.endX,e.endX)&&Xe.B(t.endY,e.endY))))}function Ke(t,e,i){switch(t.type){case Ue.j:case Ue.u:case Ue.F:i?e.h(t.od,t.pd,0,0):Gt(e,t.od,t.pd,0,0),Gt(e,t.Dc,t.Ec,0,0);break;case Ue.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):Gt(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:Gt(e,h=c.endX,l=c.endY,0,0);break;case oi:Xe.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:Xe.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 f=c.type===si?ti(c,r):ei(c,r,h,l),d=f.length;if(0===d){Gt(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<d;p++)c=f[p],Xe.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 He(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,f=t.figures.s,d=f.length,p=0;p<d;p++){var g=f[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 M=void 0;if(k!==y.length){var S=(M=b[k]).type;t=M.endX,l=M.endY}else S=ni,t=v,l=x;switch(S){case ii:if(v=We(r,e,u,e,s,a,v,x),isNaN(v))return!0;c+=v,v=t,x=l;break;case ni:if(s=We(r,e,u,e,s,a,t,l),isNaN(s))return!0;c+=s;break;case oi:c+=h=Xe.Fo(s,a,M.point1X,M.point1Y,M.point2X,M.point2Y,t,l,u,e,r,e,.5);break;case ri:c+=h=Xe.Fo(s,a,(s+2*M.point1X)/3,(a+2*M.point1Y)/3,(2*M.point1X+t)/3,(2*M.point1Y+l)/3,t,l,u,e,r,e,.5);break;case si:case ai:var N=(S=M.type===si?ti(M,g):ei(M,g,s,a)).length;if(0===N){if(s=We(r,e,u,e,s,a,M.type===si?M.centerX:M.endX,M.type===si?M.centerY:M.endY),isNaN(s))return!0;c+=s;break}M=null;for(var P=0;P<N;P++){if(M=S[P],0===P){if(h=We(r,e,u,e,s,a,M[0],M[1]),isNaN(h))return!0;c+=h}c+=h=Xe.Fo(M[0],M[1],M[2],M[3],M[4],M[5],M[6],M[7],u,e,r,e,.5)}null!==M&&(t=M[6],l=M[7]);break;default:w("Unknown Segment type: "+M.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 We(t,e,i,n,o,r,s,a){if(Xe.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 Ze(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 Je(t){if(null===t.tk){var e=t.tk=[],i=t.ym=[],n=[],o=[];if(t.type===Ue.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===Ue.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===Ue.F){var r=new _e;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];Xe.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($e(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 f=l[c];switch(f.type){case ii:4<=n.length&&(e.push(n),i.push($e(n))),(n=[]).push(f.endX),n.push(f.endY),a=s=f.endX,h=r=f.endY;break;case ni:n.push(f.endX),n.push(f.endY),s=f.endX,r=f.endY;break;case oi:Xe.Qe(s,r,f.point1X,f.point1Y,f.point2X,f.point2Y,f.endX,f.endY,.5,n),s=f.endX,r=f.endY;break;case ri:Xe.ep(s,r,f.point1X,f.point1Y,f.endX,f.endY,.5,n),s=f.endX,r=f.endY;break;case si:var d=ti(f,o),p=d.length;if(0===p){n.push(f.centerX),n.push(f.centerY),s=f.centerX,r=f.centerY;break}for(var g=0;g<p;g++){var m=d[g];Xe.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=(d=ei(f,o,s,r)).length,g=f.endX,m=f.endY,0===p){n.push(g),n.push(m),s=g,r=m;break}for(g=0;g<p;g++)m=d[g],Xe.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: "+f.type)}f.isClosed&&(n.push(a),n.push(h))}4<=n.length&&(e.push(n),i.push($e(n)))}}}function $e(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 _e(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 J,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=Xe.jx(0,0,i<n?i:n,t.startAngle,t.startAngle+t.sweepAngle,!1);if(i!==n){var s=Ye.alloc();s.reset(),i<n?s.scale(1,n/i):s.scale(i/n,1),Ue.Ha(r,s),Ye.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),f=Math.sin(s),d=c*(i-l)/2+f*(n-u)/2,p=d*d/(e*e)+(s=-f*(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*d*d)/(e*e*s*s+r*r*d*d)),isNaN(p)&&(p=0),a=p*e*s/r,p=p*-r*d/e,isNaN(a)&&(a=0),isNaN(p)&&(p=0),i=(i+l)/2+c*a-f*p,n=(n+u)/2+f*a+c*p,u=o(1,0,(d-a)/e,(s-p)/r),s=o(c=(d-a)/e,l=(s-p)/r,d=(-d-a)/e,a=(-s-p)/r),-1>=(d=(c*d+l*a)/(Math.sqrt(c*c+l*l)*Math.sqrt(d*d+a*a)))?s=Math.PI:1<=d&&(s=0),!h&&0<s&&(s-=2*Math.PI),h&&0>s&&(s+=2*Math.PI),h=e>r?1:e/r,d=e>r?r/e:1,e=Xe.jx(0,0,e>r?e:r,u,u+s,!0),(r=Ye.alloc()).reset(),r.translate(i,n),r.rotate(t.Ne,0,0),r.scale(h,d),Ue.Ha(e,r),Ye.free(r),t.ae=e,t.ae}Xe.za=Xe.AA,Ue.prototype.copy=function(){var t=new Ue;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===Ue.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},Ue.prototype.ja=function(){return this.freeze(),Object.freeze(this),this},Ue.prototype.freeze=function(){if(this._isFrozen=!0,this.type!==Ue.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},Ue.prototype.ka=function(){if(Object.isFrozen(this)&&w("cannot thaw constant: "+this),this._isFrozen=!1,this.type!==Ue.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},Ue.prototype.Xa=function(t){if(!(t instanceof Ue))return!1;if(this.type!==t.type)return this.type===Ue.j&&t.type===Ue.o?qe(this,t):t.type===Ue.j&&this.type===Ue.o&&qe(t,this);if(this.type===Ue.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 Xe.B(this.startX,t.startX)&&Xe.B(this.startY,t.startY)&&Xe.B(this.endX,t.endX)&&Xe.B(this.endY,t.endY)},Ue.ia=function(t){return t.toString()},Ue.prototype.qb=function(t){t.classType===Ue&&(this.type=t)},Ue.prototype.toString=function(t){switch(void 0===t&&(t=-1),this.type){case Ue.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 Ue.u:var e=new Dt(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 Ue.F:if((e=new Dt(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 Ue.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()}},Ue.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},Ue.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="",f=!1,d=0;d<u.length;d++){var p=u[d];"."!==p||f?"."===p?(h.push(c),c="."):c+=p:(f=!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,j(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),f=c=u=!1,d=!0,p=null;for(var w=/[UuBbMmZzLlHhVvCcSsQqTtAaFfXx]/;!(g>=b-1);)if(y=m,""!==(m=n()))switch(m.toUpperCase()){case"X":d=!0,c=u=!1;break;case"M":for(p=r(),null===t.mc||!0===d?(du(t,p.x,p.y,u,!c,f),d=!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(),M=r();gu(t,p.x,p.y,k.x,k.y,M.x,M.y)}break;case"S":for(;!i();)p=a(),k=s(),M=r(),gu(t,p.x,p.y,k.x,k.y,M.x,M.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()),M=parseFloat(n());var S=parseFloat(n()),N=parseFloat(n()),P=N,C=!1;i()||(P=parseFloat(n()),i()||(C=0!==parseFloat(n()))),m===m.toLowerCase()&&(M+=x.x,S+=x.y),t.arcTo(p,k,M,S,N,P,C)}break;case"A":for(;!i();)p=Math.abs(parseFloat(n())),k=Math.abs(parseFloat(n())),M=parseFloat(n()),N=S=!1,C=P=0,1===(P=n()).length?(S=!!parseFloat(P),N=!!parseFloat(n()),P=parseFloat(n())):2===P.length?(S=!!parseFloat(P[0]),N=!!parseFloat(P[1]),P=parseFloat(n())):(S=!!parseFloat(P[0]),N=!!parseFloat(P[1]),P=parseFloat(P.slice(2))),C=parseFloat(n()),m===m.toLowerCase()&&(P=x.x+P,C=x.y+C),x.h(P,C),yu(t,p,k,M,S,N,P,C);break;case"Z":pu(t),x.assign(h);break;case"F":for(p="",k=1;l[g+k];)if("0"===l[g+k])f=!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},Ue.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)},Ue.prototype.Zu=function(){if(this._isInvalidBounds)return!0;if(this.type===Ue.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},Ue.prototype.computeBounds=function(){if(this._isInvalidBounds=!1,this.ym=this.tk=null,this.zm=NaN,this.type===Ue.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),Ke(this,t,!1),Gt(t,0,0,0,0),t.freeze()},Ue.prototype.ix=function(){var t=new Dt;return Ke(this,t,!0),t},Ue.prototype.normalize=function(){this._isFrozen&&k(this);var t=this.ix();return this.offset(-t.x,-t.y),new pt(-t.x,-t.y)},Ue.prototype.offset=function(t,e){return this._isFrozen&&k(this),this.transform(1,0,0,1,t,e),this},Ue.prototype.scale=function(t,e){return this._isFrozen&&k(this),this.transform(t,0,0,e,0,0),this},Ue.prototype.rotate=function(t,e,i){this._isFrozen&&k(this),void 0===e&&(e=0),void 0===i&&(i=0);var n=Ye.alloc();return n.reset(),n.rotate(t,e,i),this.transform(n.m11,n.m12,n.m21,n.m22,n.dx,n.dy),Ye.free(n),this},(e=Ue.prototype).transform=function(t,e,i,n,o,r){switch(this.type){case Ue.j:case Ue.u:case Ue.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 Ue.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 f=(c=c.segments.s).length,d=0;d<f;d++){var p=c[d];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 Ue.j:return Xe.Yb(i,n,o,r,e,t.x,t.y);case Ue.u:var s=Dt.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),Dt.free(s),t;case Ue.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 Ue.o:return He(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===Ue.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===Ue.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===Ue.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===Ue.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 Xe.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!==Ue.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],f=u.length,d=0;d<f;d+=2){var p=u[d],g=u[d+1];if(0!==d){Xe.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[(d-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 Ie(t,e,o,r).freeze(),this.gg=new Ie(i,n,s,a).freeze(),this},f.Object.defineProperties(Ue.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 Je(this),this.tk}},flattenedLengths:{get:function(){return Je(this),this.ym}},flattenedTotalLength:{get:function(){var t=this.zm;if(isNaN(t)){if(this.type===Ue.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===Ue.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===Ue.o?this.ee=new J:(null===Ue.V&&(Ue.V=(new J).freeze()),this.ee=Ue.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}}}),Ue.prototype.setSpots=Ue.prototype.pm,Ue.prototype.add=Ue.prototype.add,Ue.prototype.getFractionForPoint=Ue.prototype.xx,Ue.prototype.getPointAndAngleAlongPath=Ue.prototype.Qu,Ue.prototype.getAngleAlongPath=Ue.prototype.wx,Ue.prototype.getPointAlongPath=Ue.prototype.Pu,Ue.prototype.containsPoint=Ue.prototype.ca,Ue.prototype.transform=Ue.prototype.transform,Ue.prototype.rotate=Ue.prototype.rotate,Ue.prototype.scale=Ue.prototype.scale,Ue.prototype.offset=Ue.prototype.offset,Ue.prototype.normalize=Ue.prototype.normalize,Ue.prototype.computeBoundsWithoutOrigin=Ue.prototype.ix,Ue.prototype.equalsApprox=Ue.prototype.Xa,Ue.className="Geometry",Ue.j=new V(Ue,"Line",0),Ue.u=new V(Ue,"Rectangle",1),Ue.F=new V(Ue,"Ellipse",2),Ue.o=new V(Ue,"Path",3),Ue.V=null,Ue.hb="UuBbMmZzLlHhVvCcSsQqTtAaFfXx",Ue.className="Geometry",Ue.stringify=Ue.ia,Ue.fillPath=Ue.nb,Ue.parse=Ue.parse,Ue.Line=Ue.j,Ue.Rectangle=Ue.u,Ue.Ellipse=Ue.F,Ue.Path=Ue.o,_e.prototype.copy=function(){var t=new _e;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=_e.prototype).Xa=function(t){if(!(t instanceof _e&&Xe.B(this.startX,t.startX)&&Xe.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(Xe.Yb(n,o,u.endX,u.endY,i,t,e))return!0;n=u.endX,o=u.endY;break;case oi:if(Xe.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(Xe.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),f=c.length,d=u.type===si?u.centerX:u.endX,p=u.type===si?u.centerY:u.endY;if(0===f){if(Xe.Yb(n,o,d,p,i,t,e))return!0;n=d,o=p;break}for(d=null,p=0;p<f;p++)if(d=c[p],0===p&&Xe.Yb(n,o,d[0],d[1],i,t,e)||Xe.cs(d[0],d[1],d[2],d[3],d[4],d[5],d[6],d[7],.5,t,e,i))return!0;null!==d&&(n=d[6],o=d[7]);break;default:w("Unknown Segment type: "+u.type)}if(u.isClosed&&(n!==r||o!==s)&&Xe.Yb(n,o,r,s,i,t,e))return!0}return!1},f.Object.defineProperties(_e.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}}}),_e.prototype.add=_e.prototype.add,_e.prototype.equalsApprox=_e.prototype.Xa,_e.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 Xe.B(this.endX,t.endX)&&Xe.B(this.endY,t.endY);case oi:return Xe.B(this.endX,t.endX)&&Xe.B(this.endY,t.endY)&&Xe.B(this.point1X,t.point1X)&&Xe.B(this.point1Y,t.point1Y)&&Xe.B(this.point2X,t.point2X)&&Xe.B(this.point2Y,t.point2Y);case ri:return Xe.B(this.endX,t.endX)&&Xe.B(this.endY,t.endY)&&Xe.B(this.point1X,t.point1X)&&Xe.B(this.point1Y,t.point1Y);case si:return Xe.B(this.startAngle,t.startAngle)&&Xe.B(this.sweepAngle,t.sweepAngle)&&Xe.B(this.centerX,t.centerX)&&Xe.B(this.centerY,t.centerY)&&Xe.B(this.radiusX,t.radiusX)&&Xe.B(this.radiusY,t.radiusY);case ai:return this.isClockwiseArc===t.isClockwiseArc&&this.isLargeArc===t.isLargeArc&&Xe.B(this.xAxisRotation,t.xAxisRotation)&&Xe.B(this.endX,t.endX)&&Xe.B(this.endY,t.endY)&&Xe.B(this.radiusX,t.radiusX)&&Xe.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},f.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&&M(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&&M(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=fi,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||Jo(i,t,e),e},hi.prototype.Bz=function(t,e){var i=this.diagram;return null===i||(Jo(i,t,e),e.assign(i.Ps(e))),e},f.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},f.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=N(e)&&"function"==typeof e.J?e.J():e,e=this.Rn,t.Rn=N(e)&&"function"==typeof e.J?e.J():e,e=this.Mn,t.Mn=N(e)&&"function"==typeof e.J?e.J():e,e=this.Ln,t.Ln=N(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===fi?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+=O(this.object)),null!==this.oldValue&&(t+=" old: "+O(this.oldValue)),null!==this.oldParam&&(t+=" "+this.oldParam),null!==this.newValue&&(t+=" new: "+O(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))},f.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),fi=new V(ui,"Property",0),di=new V(ui,"Insert",1),pi=new V(ui,"Remove",2);function gi(){this.o=(new J).freeze(),this.xa="",this.j=!1}function mi(){this.Pt=new _,this.Jd=!1,this.u=(new J).freeze(),this.Ce=-1,this.o=999,this.Fe=!1,this.Np=null,this.bi=0,this.j=!1,this.Ie=(new J).freeze(),this.hl=new J,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&&S("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 J,this.ob=new J,this.Hb=new J,this.F=this.V=850,this.o=new At(2,2).ja(),this.Ha=5e3,this.ia=ki,this.u=Ni,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=fi,ui.Insert=di,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 dt,i=0;i<t.count;i++){var n=t.M(i);if(null!==n&&n.change===fi&&n.object){var o=e.get(n.object);o||(o=new dt,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()}},f.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){S("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){S("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||S("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},f.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":F(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(E?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||(E?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===Mi&&!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===Mi&&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 Hu);)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},f.Object.defineProperties(vi.prototype,{diagram:{get:function(){return this.H},set:function(t){t instanceof To&&(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 Hu&&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===Ci)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=Mi:this.mouseWheelBehavior===Mi&&(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===Ci)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 Hu&&(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 Hu)||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 Hu){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 Hu?(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)},f.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 Hu?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),Mi=new V(xi,"WheelZoom",1),Si=new V(xi,"WheelNone",2),Ni=new V(xi,"GestureZoom",3),Pi=new V(xi,"GestureCancel",4),Ci=new V(xi,"GestureNone",5);function Ti(){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 _).freeze(),this.ia=new Ms,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,Ei(t,e.lastInput,null),e.skipsUndoManager=i,t.Cg.length=0}function ji(){var t=Ki;Oi(t),Ii(t);var e=t.diagram;t.tl.w()&&(e.position=t.tl),e.ug()}function Fi(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")):Ii(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 dt,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,Sc(i,t.startPoint.x-(e.x+e.width/2),t.startPoint.y-(e.y+e.height/2))),t.doUpdateCursor(null)}}}function Oi(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 Di(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 Bi(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&&(Oo(n),n.hk())}function Ii(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()),Sc(n,-o.x,-o.y)}e.bd()}}function zi(t,e){var i=t.diagram;t.dragsLink&&(null!==t.draggedLink&&(t.draggedLink.fromNode=null,t.draggedLink.toNode=null),Yi(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=Ei(t,o,n),!t.isActive&&null===Ki)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===Ki)return;if(t.doDragOver(e,n),!t.isActive&&null===Ki)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 Ei(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===Ki||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 Yi(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 Gi(t,e){var i=t.diagram;t.dragsLink&&Yi(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;Xi(t,o,r),r=Ri(r)}}else null!==(r=i.mouseDrop)&&r(o);if(t.isActive||null!==Ki){for(o=(t.copiedParts||t.draggedParts).iterator;o.next();)(r=o.key)instanceof Zu&&r.linksConnected.each((function(t){t.suspendsRouting=!1}));if(t.doDropOnto(e,n),t.isActive||null!==Ki){for(t=Dt.alloc(),e=i.selection.iterator;e.next();)(n=e.value)instanceof Zu&&Ui(i,n,t);Dt.free(t)}}}function Xi(t,e,i){t=t.diagram,i=i.part,!t.handlesDragDropForTopLevelParts||!i.isTopLevel||i instanceof gc||null!==(i=t.mouseDrop)&&i(e)}function Ui(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 qi(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=Dt.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,Dt.free(r),r=t.Fr,s=new dt,a=pt.alloc(),h=e.iterator;h.next();)(l=h.value)instanceof wc&&l.canCopy()&&(null!==(u=i.I(l))&&(u.points=l.points,Sc(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,Sc(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=Mi,xi.WheelNone=Si,xi.GestureZoom=Ni,xi.GestureCancel=Pi,xi.GestureNone=Ci,c(Ti,vi),Ti.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()},Ti.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},Ti.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,(E?e.meta:e.control)||e.shift||t.clearSelection(!0),this.currentPart.isSelected=!0,t.R("ChangedSelection",t.selection))}}},Ti.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),Ki=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&&Oo(t),fr(t,this.draggedParts),this.Ea("Drag"),this.startPoint=t.firstInput.documentPoint,t.isMouseCaptured=!0,t.allowDragOut&&(this.isDragOutStarted=!0,this.Ym=!1,Ki=this,Hi=this.diagram,this.doSimulatedDragOut()))},Ti.prototype.computeEffectiveCollection=function(t,e){return this.diagram.commandHandler.computeEffectiveCollection(t,e)},Ti.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())},Ti.prototype.doDeactivate=function(){this.isActive=!1;var t=this.diagram;if(this.diagram.layout.isRealtime=this.Sw,t.Fu(!1),t.ug(),Ai(this),dr(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);Di(o),Oi(o),Ai(o),o.diagram.ug()}e.clear()}Di(this),this.tl.h(NaN,NaN),null!==Hi&&(Hi.currentCursor=""),Ki=Hi=null,Oi(this),t.isMouseCaptured=!1,t.currentCursor="",t.Ns=!1,this.stopTransaction(),Do(t,!0)},Ti.prototype.stopTransaction=function(){var t=this.diagram,e=vi.prototype.stopTransaction.call(this);return e&&null!==t.undoManager.transactionToUndo&&t.undoManager.transactionToUndo.ak(),e},Ti.prototype.doCancel=function(){Oi(this),Ii(this);var t=this.diagram;this.tl.w()&&(t.position=this.tl),this.stopTool()},Ti.prototype.doKeyDown=function(){var t=this.diagram,e=t.lastInput;this.isActive&&("Esc"===e.key?this.doCancel():e.key!==t.previousInput.key&&this.doMouseMove())},Ti.prototype.doKeyUp=function(){this.isActive&&this.doMouseMove()},Ti.prototype.moveParts=function(t,e,i){void 0===i&&(i=!1);var n=this.diagram;null!==n&&lr(n,t,e,this.dragOptions,i)},Ti.prototype.findDragOverObject=function(t){var e=this;return Uo(this.diagram,t,null,(function(t){return null===t?t=!0:t=!!(null===(t=t.part)||t instanceof Hu||t.layer.isTemporary||e.draggedParts&&e.draggedParts.contains(t)||e.copiedParts&&e.copiedParts.contains(t)),!t}))},Ti.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))},Ti.prototype.doDragOver=function(){},Ti.prototype.doDropOnto=function(){},Ti.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()?(Fi(this,!1),fr(t,this.copiedParts),Bi(this,this.copiedParts,!1),dr(t,this.copiedParts)):this.mayMove()?(Oi(this),Bi(this,this.draggedParts,!0)):this.mayDragOut()?(Fi(this,!1),Bi(this,this.copiedParts,!1)):Oi(this),zi(this,t.lastInput.documentPoint))}},Ti.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?(Oi(this),Fi(this,!0),fr(t,this.copiedParts),Bi(this,this.copiedParts,!1),dr(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,Oi(this),this.mayMove()&&(Bi(this,this.draggedParts,!0),zi(this,t.lastInput.documentPoint))),this.Ym=!0,Gi(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 Zu&&(null===(i=i.containingGroup)||null===i.placeholder||t.draggedParts.contains(i)||i.placeholder.v())}}(this),t.Ya(),dr(t,this.draggedParts),this.transactionResult=i?"Copy":"Move",t.R(i?"SelectionCopied":"SelectionMoved",n)}this.stopTool(),i&&t.R("ChangedSelection",t.selection)}}},Ti.prototype.simulatedMouseMove=function(t,e,i){if(null===Ki)return!1;var n=Ki.diagram;i instanceof To||(i=null);var o=Hi;return i!==o&&(null!==o&&o!==n&&(o.ug(),Ki.isDragOutStarted=!1,null!==(o=o.toolManager.findTool("Dragging"))&&o.doSimulatedDragLeave()),Hi=i,null!==i&&i!==n&&(ji(),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)},Ti.prototype.simulatedMouseUp=function(t,e,i){if(null===Ki)return!1;var n=Hi,o=Ki.diagram;if(null===i)return Ki.doCancel(),!0;if(i!==n){var r=n.toolManager.findTool("Dragging");if(null!==n&&n!==o&&null!==r)return n.ug(),Ki.isDragOutStarted=!1,r.doSimulatedDragLeave(),!1;Hi=i,null!==(n=i.toolManager.findTool("Dragging"))&&(ji(),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=Ki)&&(i=t.mayCopy(),t.transactionResult=i?"Copy":"Move",t.stopTool()),!0)},Ti.prototype.mayCopy=function(){if(!this.isCopyEnabled)return!1;var t=this.diagram;if(t.isReadOnly||t.isModelReadOnly||!t.allowInsert||!t.allowCopy||(E?!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())},Ti.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())},Ti.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())},Ti.prototype.computeBorder=function(t,e,i){return this.Ym||null===this.draggedParts||this.draggedParts.contains(t)?null:i.assign(e)},Ti.prototype.Az=function(){return Ki},Ti.prototype.mayDragIn=function(){var t=this.diagram;if(!t.allowDrop||t.isReadOnly||t.isModelReadOnly||!t.allowInsert)return!1;return null!==Ki&&Ki.diagram.model.dataFormat===t.model.dataFormat},Ti.prototype.doSimulatedDragEnter=function(){if(this.mayDragIn()){var t=this.diagram;t.animationManager.Cc(),_o(t),t.animationManager.Cc(),null!==(t=Ki)&&(t.diagram.Ns=!1),this.doUpdateCursor(null)}},Ti.prototype.doSimulatedDragLeave=function(){null!==Ki&&Ki.doSimulatedDragOut(),this.doCancel()},Ti.prototype.doSimulatedDragOver=function(){var t=this.diagram;t.animationManager.Dm=!0;var e=Ki;if(null!==e&&null!==e.draggedParts){if(!this.mayDragIn())return;qi(this,e.draggedParts.Lf(),!1,t.firstInput),Bi(this,this.copiedParts,!1),zi(this,t.lastInput.documentPoint)}t.animationManager.Dm=!1},Ti.prototype.doSimulatedDrop=function(){var t=this.diagram,e=Ki;if(null!==e){var i=e.diagram;if(e.Ym=!0,Oi(this),!this.mayDragIn())return;t.animationManager.Dm=!0,t.R("ChangingSelection",t.selection),this.Ea("Drop"),qi(this,e.draggedParts.Lf(),!0,t.lastInput),Bi(this,this.copiedParts,!1);var n=new _;null!==this.copiedParts&&(t.clearSelection(!0),this.copiedParts.iteratorKeys.each((function(t){t.isSelected=!0,n.add(t)}))),Gi(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},Ti.prototype.doSimulatedDragOut=function(){var t=this.diagram;t.Ns=!1,this.mayCopy()||this.mayMove()?t.currentCursor="":t.currentCursor=this.nodropCursor,this.Bn=null},Ti.prototype.computeMove=function(t,e,i,n){return null!==(i=this.diagram)?i.computeMove(t,e,this.dragOptions,n):new pt},f.Object.defineProperties(Ti.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}}}),Ti.prototype.getDraggingSource=Ti.prototype.Az;var Ki=null,Hi=null;function Wi(){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 Zu,(e=new pl).portId="",e.figure="Rectangle",e.fill=null,e.stroke="magenta",e.strokeWidth=2,e.desiredSize=Mt,t.add(e),t.selectable=!1,t.layerName="Tool",this.Bi=t,this.j=e,t=new Zu,(e=new pl).portId="",e.figure="Rectangle",e.fill=null,e.stroke="magenta",e.strokeWidth=2,e.desiredSize=Mt,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 dt,this.Of=this.gj=this.Pf=null}function Zi(t,e,i,n){if(e===i)return!0;var o=e.fromNode;return!(null===o||!o.isLinkLabel||(n.add(o),!Zi(t,o.labeledLink,i,n)))||!(null===(e=e.toNode)||!e.isLinkLabel||(n.add(e),!Zi(t,e.labeledLink,i,n)))}function Ji(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&&Ji(t,s,i,n,o)))return!0}return!1}function $i(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&&$i(t,e,s,n,o)))return!0}return!1}function _i(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&&_i(t,e,a,n,o))return!0}}return!1}function Qi(){Wi.call(this),this.name="Linking",this.V={},this.F=null,this.K=tn,this.Xd=null}Ti.className="DraggingTool",wi=new J,B("draggingTool",(function(){return this.findTool("Dragging")}),(function(t){this.gb("Dragging",t,this.mouseMoveTools)})),xi.prototype.doCancel=function(){null!==Ki&&Ki.doCancel(),vi.prototype.doCancel.call(this)},c(Wi,vi),Wi.prototype.doStop=function(){this.diagram.ug(),this.originalToPort=this.originalToNode=this.originalFromPort=this.originalFromNode=this.originalLink=null,this.validPortsCache.clear(),this.targetPort=null},Wi.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)}},Wi.prototype.setNoTargetPortProperties=function(t,e,i){null!==e&&(e.desiredSize=Mt,e.fromSpot=Qt,e.toSpot=Qt),null!==t&&(t.location=this.diagram.lastInput.documentPoint),null!==this.portTargeted&&this.portTargeted(null,null,t,e,i)},Wi.prototype.doMouseDown=function(){this.isActive&&this.doMouseMove()},Wi.prototype.doMouseMove=function(){if(this.isActive){var t=this.diagram;if(this.targetPort=this.findTargetPort(this.isForwards),null!==this.targetPort&&this.targetPort.part instanceof Zu){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)}},Wi.prototype.findValidLinkablePort=function(t,e){if(null===t)return null;var i=t.part;if(!(i instanceof Zu))return null;for(;null!==t;){var n=e?t.toLinkable:t.fromLinkable;if(!0===n&&(null!==t.portId||t instanceof Zu)&&(e?this.isValidTo(i,t):this.isValidFrom(i,t)))return t;if(!1===n)break;t=t.panel}return null},Wi.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 Zu){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 Zu&&(null===i.layer||i.layer.allowLink))?e:null},Wi.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},Wi.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},Wi.prototype.isInSameNode=function(t,e){return null!==t&&null!==e&&(t===e||(t=t.part,e=e.part,null!==t&&t===e))},Wi.prototype.isLinked=function(t,e){if(null===t||null===e)return!1;var i=t.part;if(!(i instanceof Zu))return!1;null===(t=t.portId)&&(t="");var n=e.part;if(!(n instanceof Zu))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},Wi.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))},Wi.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 _;return n.add(t),Zi(this,i,e,n)},Wi.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!==Kr){if(n===Jr){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!Ji(this,t,e,i,!0)}if(n===$r){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!Ji(this,t,e,i,!0)}if(n===Hr)return t===e?t=!0:((n=new _).add(e),t=$i(this,n,t,e,i)),!t;if(n===Wr)return!Ji(this,t,e,i,!1);if(n===Zr)return t===e?t=!0:((n=new _).add(e),t=_i(this,n,t,e,i)),!t}return!0},f.Object.defineProperties(Wi.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}}}),Wi.className="LinkingBaseTool",c(Qi,Wi),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 Zu))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 Zu&&(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 Zu&&(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(){Wi.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 Zu&&(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(){},f.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(){Wi.call(this),this.name="Relinking";var t=new pl;t.figure="Diamond",t.desiredSize=Nt,t.fill="lightblue",t.stroke="dodgerblue",t.cursor=this.linkingCursor,t.segmentIndex=0,this.V=t,(t=new pl).figure="Diamond",t.desiredSize=Nt,t.fill="lightblue",t.stroke="dodgerblue",t.cursor=this.linkingCursor,t.segmentIndex=-1,this.Xd=t,this.F=null,this.Ew=new Dt}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=St,t.fill="lightblue",t.stroke="dodgerblue",this.o=t,(t=new pl).figure="Diamond",t.desiredSize=Nt,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 J}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,Wi),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 Hu;return i.type=Ch.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 Hu&&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!==$c&&i!==Jc||(i=Wc),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(){Wi.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 Zu&&(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(){},f.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 Hu))throw Error("new handle is not in an Adornment: "+t);this.F=t}}}),on.className="RelinkingTool",B("linkingTool",(function(){return this.findTool("Linking")}),(function(t){this.gb("Linking",t,this.mouseMoveTools)})),B("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 Hu).type=Ch.Link,i=e.firstPickIndex;var r=e.lastPickIndex,s=n?1:0;if(e.resegmentable&&e.computeCurve()!==Zc)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);Xe.B(h.x,l.x)&&Xe.B(h.y,l.y)&&(l=e.i(i-1)),Xe.B(h.x,l.x)?(this.om(a,un),a.cursor="n-resize"):Xe.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),Xe.B(h.x,l.x)&&Xe.B(h.y,l.y)&&(h=e.i(r+1)),Xe.B(h.x,l.x)?(this.om(a,un),a.cursor="n-resize"):Xe.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(),Xe.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);Xe.B(r.x,o.x)&&Xe.B(o.y,s.y)?(Xe.B(r.x,e.i(n-2).x)&&!Xe.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),Xe.B(s.y,e.i(n+2).y)&&!Xe.B(s.x,e.i(n+2).x)?e.m(n+1,s.x,t.y):e.L(n+1,s.x,t.y)):Xe.B(r.y,o.y)&&Xe.B(o.x,s.x)?(Xe.B(r.y,e.i(n-2).y)&&!Xe.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),Xe.B(s.x,e.i(n+2).x)&&!Xe.B(s.y,e.i(n+2).y)?e.m(n+1,t.x,s.y):e.L(n+1,t.x,s.y)):Xe.B(r.x,o.x)&&Xe.B(o.x,s.x)?(Xe.B(r.x,e.i(n-2).x)&&!Xe.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),Xe.B(s.x,e.i(n+2).x)&&!Xe.B(s.y,e.i(n+2).y)?e.m(n+1,t.x,s.y):e.L(n+1,t.x,s.y)):Xe.B(r.y,o.y)&&Xe.B(o.y,s.y)&&(Xe.B(r.y,e.i(n-2).y)&&!Xe.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),Xe.B(s.y,e.i(n+2).y)&&!Xe.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)}},f.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 Hu))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 fn(){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=St,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 dn(){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=Nt,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 Mn(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()&&(Sn(t,!0),t.isActive||t.stopTool())}function Sn(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=Nn,null===i&&(i=t.findObjectWithContextMenu()),null!==i){var n=i.contextMenu;null!==n?(t.currentObject=i instanceof Os?i:null,t.showContextMenu(n,t.currentObject)):null!==e&&t.showContextMenu(e,t.currentObject)}else null!==e&&t.showContextMenu(e,null);t.currentContextMenu instanceof Hu&&!t.currentContextMenu.visible&&t.stopTool()}}sn.className="LinkReshapingTool",sn.None=hn,sn.Horizontal=ln,sn.Vertical=un,sn.All=cn,B("linkReshapingTool",(function(){return this.findTool("LinkReshaping")}),(function(t){this.gb("LinkReshaping",t,this.mouseDownTools)})),c(fn,vi),fn.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)}},fn.prototype.makeAdornment=function(t){var e=t.part.resizeAdornmentTemplate;if(null===e){(e=new Hu).type=Ch.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,je)),e.add(this.makeHandle(t,Fe)),e.add(this.makeHandle(t,Ae))}else if(Wh(e),null===(e=e.copy()))return null;return e.adornedObject=t,e},fn.prototype.makeHandle=function(t,e){return null===(t=this.handleArchetype)?null:((t=t.copy()).alignment=e,t)},fn.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 Ch)for(t=t.elements;t.next();)this.updateResizeHandles(t.value,e)},fn.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)},fn.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))},fn.prototype.doDeactivate=function(){var t=this.diagram;this.stopTransaction(),this.ue=this.handle=null,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(){null!==this.adornedObject&&(this.adornedObject.desiredSize=this.originalDesiredSize,this.adornedObject.part.location=this.originalLocation),this.stopTool()},fn.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)}},fn.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()},fn.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 J;if(n.add(t),!this.dragsMembers&&null===t.placeholder){var o=new Ms;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()}},fn.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 f=s.height;0>=c&&(c=1),0>=f&&(f=1),c=f/c}return f=pt.alloc(),Xe.No(t.x,t.y,a,h,o.width,o.height,f),t=s.copy(),0>=e.x?0>=e.y?(t.x=Math.max(f.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(f.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(f.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(f.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(f.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(f.x-a,n.width),i.width),t.y=Math.max(f.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(f.x-a,n.width),i.width),t.height=Math.max(Math.min(f.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(f.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(f.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(f.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(f),t},fn.prototype.computeReshape=function(){var t=fs;return this.adornedObject instanceof pl&&(t=yl(this.adornedObject)),!(t===ds||this.diagram.lastInput.shift)},fn.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},fn.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},fn.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},f.Object.defineProperties(fn.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 Hu))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 Hu)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}}}),fn.className="ResizingTool",B("resizingTool",(function(){return this.findTool("Resizing")}),(function(t){this.gb("Resizing",t,this.mouseDownTools)})),c(dn,vi),dn.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)}},dn.prototype.makeAdornment=function(t){var e=t.part.rotateAdornmentTemplate;if(null===e){(e=new Hu).type=Ch.Position,e.locationSpot=oe;var i=this.handleArchetype;null!==i&&e.add(i.copy())}else if(Wh(e),null===(e=e.copy()))return null;return e.adornedObject=t,e},dn.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)},dn.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)},dn.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)},dn.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)},dn.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},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(){this.diagram.delaysLayout=!1,this.rotate(this.originalAngle),this.stopTool()},dn.prototype.doMouseMove=function(){var t=this.diagram;this.isActive&&(t=this.computeRotate(t.lastInput.documentPoint),this.rotate(t))},dn.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()},dn.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()}},dn.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},f.Object.defineProperties(dn.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 Hu))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 Hu)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}}}),dn.className="RotatingTool",B("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()&&(Wh(i),null!==(n=i.copy())&&e.add(n));else if(null!==i){var o=e.model.copyNodeData(i);N(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},f.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 Dt(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),E?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 J,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)}},f.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)}},f.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",B("clickCreatingTool",(function(){return this.findTool("ClickCreating")}),(function(t){this.gb("ClickCreating",t,this.mouseUpTools)})),B("clickSelectingTool",(function(){return this.findTool("ClickSelecting")}),(function(t){this.gb("ClickSelecting",t,this.mouseUpTools)})),B("panningTool",(function(){return this.findTool("Panning")}),(function(t){this.gb("Panning",t,this.mouseMoveTools)})),B("dragSelectingTool",(function(){return this.findTool("DragSelecting")}),(function(t){this.gb("DragSelecting",t,this.mouseMoveTools)})),B("actionTool",(function(){return this.findTool("Action")}),(function(t){this.gb("Action",t,this.mouseDownTools)})),f.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 To||(n=t instanceof Os?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 Hu){var t=this.diagram.toolManager.findTool("Action");null!==t&&t.canStart()&&(t.doActivate(),t.doMouseDown(),t.doDeactivate())}this.diagram.toolManager.mouseDownTools.contains(this)&&Mn(this)},wn.prototype.doMouseUp=function(){if(this.isActive&&this.currentContextMenu instanceof Hu){var t=this.diagram.toolManager.findTool("Action");null!==t&&t.canStart()&&(t.doActivate(),t.doCancel(),t.doDeactivate())}Mn(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 Hu){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 Hu?(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 J;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)),Tn.innerHTML="",Cn.addEventListener("pointerdown",this.tu,!1);var e=this,i=b("ul");i.className="goCXul",Tn.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)}}Tn.style.display="block",Cn.style.display="block"},wn.prototype.hideDefaultContextMenu=function(){if(null!==this.currentContextMenu&&this.currentContextMenu===Nn){Tn.style.display="none",Cn.style.display="none";var t=this.diagram;null!==t&&t.removeEventListener(Cn,"pointerdown",this.tu,!1),this.currentContextMenu=null}},f.Object.defineProperties(wn.prototype,{currentContextMenu:{get:function(){return this.j},set:function(t){this.j=t,this.ht=t instanceof Hu?t.adornedPart:null}},defaultTouchContextMenu:{get:function(){return!1===Pn&&null===Nn&&Vr&&function(t){var e=new xn;e.show=function(t,e,i){i.showDefaultContextMenu()},e.hide=function(t,e){e.hideDefaultContextMenu()},Nn=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)),Tn=e,Cn=i,Pn=!0}(this),Nn},set:function(t){null===t&&(Pn=!0),Nn=t}},currentObject:{get:function(){return this.o},set:function(t){this.o=t}},mouseDownPoint:{get:function(){return this.yw}}});var Nn=null,Pn=!1,Cn=null,Tn=null;function Ln(){vi.call(this),this.name="TextEditing",this.Zh=new Pl,this.ia=null,this.V=In,this.vj=null,this.qa=En,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(Dn)):"Tab"===i?(t.acceptText(On),e.preventDefault()):"Escape"===i&&(t.doCancel(),null!==t.diagram&&t.diagram.doFocus())}}),!1),i.addEventListener("focus",(function(){if(null!==t.currentTextEditor&&t.state!==En){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!==En){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===Gn)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=Xn,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=Gn,t.doError(o,r))}}wn.className="ContextMenuTool",B("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||Un&&Un!==this&&(Un.acceptText(Fn),Un&&Un!==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===In&&!e.isSelected||this.starting===zn&&2>t.lastInput.clickCount)},Ln.prototype.doStart=function(){Un=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 Dt(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(Fn)},Ln.prototype.acceptText=function(t){switch(t){case Fn:this.qa===Xn?this.currentTextEditor instanceof HTMLElement&&this.currentTextEditor.focus():this.qa!==Rn&&this.qa!==Gn&&this.qa!==Vn||(this.qa=Yn,An(this));break;case jn:case Dn:case On:Dn===t&&!0===this.textBlock.isMultiline||this.qa!==Rn&&this.qa!==Gn&&this.qa!==Vn||(this.qa=Yn,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=En,null!==this.currentTextEditor&&this.currentTextEditor.hide(t,this),this.textBlock=null,this.isActive=!1)},Ln.prototype.doStop=function(){Un=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},f.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 jn=new V(Ln,"LostFocus",0),Fn=new V(Ln,"MouseDown",1),On=new V(Ln,"Tab",2),Dn=new V(Ln,"Enter",3),Bn=new V(Ln,"SingleClick",0),In=new V(Ln,"SingleClickSelected",1),zn=new V(Ln,"DoubleClick",2),En=new V(Ln,"StateNone",0),Rn=new V(Ln,"StateActive",1),Vn=new V(Ln,"StateEditing",2),Yn=new V(Ln,"StateValidating",3),Gn=new V(Ln,"StateInvalid",4),Xn=new V(Ln,"StateValidated",5),Un=null;function qn(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 _,this.ce=new ho,this.ce.Yd=this,this.Ei=new _,this.pu=new _,this.Sr=new _,this.pr=new _,t&&Object.assign(this,t)}function Kn(t,e){t.Jd&&t.canStart(e)&&(t.Zd.add(e),t.defaultAnimation.isAnimating&&t.Cc(),Qo(t.H),t.zb=!0)}function Hn(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!==Xr&&null!==n&&(delete n.start.scale,delete n.end.scale),m.requestAnimationFrame((function(){!1===t.zb||e.bc||(i.Gf("temporaryPixelRatio")&&Oo(i),Bo(i),t.zb=!1,e.start(),e.bc&&(Jn(t),i.Ya(),po(e,0),_o(i,!0),$n(t),i.R("AnimationStarting",t)))})))}}function Wn(t){return t.Zd.contains("Trigger")&&1===t.Zd.count}function Zn(t,e,i,n){t.isTicking||Wn(t)||e instanceof wc&&(null!==e.fromNode||null!==e.toNode)||t.ce.add(e,"position",i,n,!1)}function Jn(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 $n(t){var e=t.H;e.skipsUndoManager=t.Ow,e.skipsModelSourceBindings=t.cw,t.vq=!1}function _n(t,e,i){!t.zb||e.D(i)||Wn(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 dt;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 Dt(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=jn,Ln.MouseDown=Fn,Ln.Tab=On,Ln.Enter=Dn,Ln.SingleClick=Bn,Ln.SingleClickSelected=In,Ln.DoubleClick=zn,Ln.StateNone=En,Ln.StateActive=Rn,Ln.StateEditing=Vn,Ln.StateValidating=Yn,Ln.StateInvalid=Gn,Ln.StateValidated=Xn,B("textEditingTool",(function(){return this.findTool("TextEditing")}),(function(t){this.gb("TextEditing",t,this.mouseUpTools)})),qn.prototype.Xe=function(t){this.H=t},qn.prototype.canStart=function(){return!0},(e=qn.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))},f.Object.defineProperties(qn.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&&M(t,">= 1",qn,"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}}}),qn.prototype.stopAnimation=qn.prototype.Cc;var no=null,oo=!1,ro=new V(qn,"Default",1),so=new V(qn,"AnimateLocations",2),ao=new V(qn,"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 dt,this.Tt=new dt,this.yl=new _,this.Ut=new _,this.dw=_r,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 To&&"position"===i&&(i="position:diagram"),"fill"!==i&&"stroke"!==i&&"background"!==i&&"areaBackground"!==i||(Ga(n),Xa(),n=[ah.j,ah.u,ah.o,ah.F],Ga(o),Xa(),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 Os&&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),Jn(i),po(t,o),_o(t.H,!0),$n(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 Os&&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))}qn.className="AnimationManager",qn.defineAnimationEffect=function(t,e){oo||(io(),oo=!0),no.add(t,e)},qn.Default=ro,qn.AnimateLocations=so,qn.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),Jn(this.Yd),_o(this.H),$n(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 To?t=i:i instanceof Os&&(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),Jn(e),this.yl.each((function(e){e.data=null,t.add(e)})),$n(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 Os&&null!==s.diagram||s instanceof To){r=!0;break t}}r=!1}r?fo(e,!1):e.Xk=!0}}o.pu.clear(),!1!==o.bc&&(Jn(o),_o(o.H),$n(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 To?this.H=t:t instanceof Os&&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,Jn(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 f=s;!h.Hu||"position:nodeCollapse"!==f&&"position:placeholder"!==f||(f="position"),r.get(f)(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(),Do(e,!1),e.Ya(),e.N(),_o(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()}_o(e,!0),this.isViewportUnconstrained&&(e.scrollMode=this.dw),$n(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 Zu&&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 Zu&&this.Aj(n,e)}},e.Ez=function(t){var e=this.Tt.get(t);return null===e&&(e={},this.Tt.add(t,e)),e},f.Object.defineProperties(ho.prototype,{duration:{get:function(){return this.Dg},set:function(t){1>t&&M(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},f.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),Mo=new V(vo,"Bundled",3);function So(t){Q(this),this.H=null,this.Pa=new J,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 No(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=No(t,e),a=t.Zq;a.length=0;for(var h=i.scale,l=Dt.alloc(),u=0;u<r;u++){var c=o[u];n.contains(c)&&t.Oj(e,c,i,a,h,l,!1)}Dt.free(l),e.globalAlpha=s}}}function Co(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)&&Co(t,-1,e)}null!==i.svg&&i.svg.remove()}function To(t,e){if(as||(function(){if(Vr){var t=m.document.createElement("canvas"),e=t.getContext("2d"),i=I("7ca11abfd022028846");e[i]=I("398c3597c01238");for(var n=["5da73c80a36455d7038e4972187c3cae51fd22",y.Dx+"4ae6247590da4bb21c324ba3a84e385776",Ye.xF+"fb236cdfda5de14c134ba1a95a2d4c7cc6f93c1387",Xe.za],o=1;5>o;o++)e[I("7ca11abfd7330390")](I(n[o-1]),10,15*o);for(e[i]=I("39f046ebb36e4b"),i=1;5>i;i++)e[I("7ca11abfd7330390")](I(n[i-1]),10,15*i);4===n.length&&"5"===n[0][0]&&"7"===n[3][0]||(Ye.prototype.Cd=Ye.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,Er.add("Model",Qf);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===fi&&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=Bd(),this.Wg=!0,Io(this),this.layout=new Ff,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?Fo(this,t):e=t),this.vb=!1,e&&this.nm(e),this}function Lo(t){t.Yd=new qn,t.Yd.Xe(t),t.Db=17,t.Gw=!1,t.tn=!1,t.bu="default",t.Wa=new J,t.pj=new dt,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 Ye,t.zu=new pt(NaN,NaN).freeze(),t.ut=new Dt(NaN,NaN,NaN,NaN).freeze(),t.rj=new Wt(0,0,0,0).freeze(),t.sj=_r,t.nu=!1,t.Zt=null,t.fu=null,t.yh=Xr,t.zk=Se,t.Fg=Xr,t.pq=Se,t.yt=te,t.Bt=te,t.Fc=!0,t.pn=!1,t.De=new _,t.Eh=new dt,t.Xm=!0,t.vp=250,t.vk=-1,t.xp=new Wt(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 J;i.add(t,o),i.add(e,o),n.add(t,t),n.add(e,t)}var i=new dt,n=new dt;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 _,t.Ht=!0,t.uu=ts,t.pw=!1,t.wu=Kr,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 dt,t.Xn=new J,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 Wt(5).freeze(),t.Hw=(new _).freeze(),t.Nt=999999999,t.nw=(new _).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 _,t.ow=new _,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 Dt,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 Dt(NaN,NaN,NaN,NaN).freeze(),t.wo=new At(NaN,NaN).freeze(),t.Sp=new Dt(NaN,NaN,NaN,NaN).freeze(),t.It=!1,t.Lg=new dt;var e=new Zu,i=new Pl;i.bind(new Gd("text","",O)),e.add(i),t.ny=e,t.Lg.add("",e),e=new Zu,(i=new Pl).stroke="brown",i.bind(new Gd("text","",O)),e.add(i),t.Lg.add("Comment",e),(e=new Zu).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 dt,(e=new gc).selectionObjectName="GROUPPANEL",e.type=Ch.Vertical,(i=new Pl).font="bold 12pt sans-serif",i.bind(new Gd("text","",O)),e.add(i),(i=new Ch(Ch.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 Wt(5,5,5,5).ja(),i.add(n),e.add(i),t.ly=e,t.Yi.add("",e),t.Kh=new dt,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 Hu).type=Ch.Auto,(i=new pl).fill=null,i.stroke="dodgerblue",i.strokeWidth=3,e.add(i),(i=new bc).margin=new Wt(1.5,1.5,1.5,1.5).ja(),e.add(i),t.St=e,t.wt=e,(e=new Hu).type=Ch.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 Qf,t.toolManager=new xi,t.toolManager.initializeStandardTools(),t.defaultTool=t.toolManager,t.currentTool=t.defaultTool,t.nt=null,t.Wm=new Ms,t.Vt=null,t.Wt=null,t.Mr=!1,t.commandHandler=jo(),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 _).freeze(),t.nw=(new _).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 jo(){return null}function Fo(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 Fa(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 Fa(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=Eo,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(){Bo(t)}),250),t.preventDefault=function(t){return t.preventDefault(),!1},t.$j=function(e){if(t.isEnabled){var i=qo(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(),Wo(i,e)}},t.aA=function(e){t.isEnabled&&(t.Vk=!1,qo(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=Ho(t,e,!0,!1,!0,o),Zo(t,e,n),n.targetDiagram=Ko(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():Wo(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=Ho(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,Zo(t,r,i),i.targetObject=null,t.doMouseMove(),Wo(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=Ho(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 To&&o.H!==t&&Zo(o.H,e,n),null===o&&(o=e.target),Zo(t,e,n),n.clickCount=t.yq,n.targetDiagram=Ko(e,o),n.targetObject=null,t.doMouseUp(),Wo(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"+Ud.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 Oo(t){30<t.Sq&&(t.Yh=1)}function Do(t,e){null!==t.Yh&&(t.Yh=null,e&&t.hk(),U&&U.nx||(t.Sq=0,t.zw=[0,0,0,0,0],t.Tq=0))}function Bo(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===Xr&&(t.Jk=!0,e.C()),t.ld||t.$b())}}}function Io(t){var e=new So;e.name="Background",t.Al(e),(e=new So).name="",t.Al(e),(e=new So).name="Foreground",t.Al(e),(e=new So).name="Adornment",e.isTemporary=!0,e.isInDocumentBounds=!1,t.Al(e),(e=new So).name="Tool",e.isTemporary=!0,e.isInDocumentBounds=!0,t.Al(e),(e=new So).name="Grid",e.allowSelect=!1,e.pickable=!1,e.isTemporary=!0,e.isInDocumentBounds=!1,t.Ww(e,t.Qj("Background"))}function zo(t){var e=new Ch(Ch.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 Eo(){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 Yo(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=Dt.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,Dt.free(n),pt.free(o),pt.free(i)}i=t.yh,e&&t.Fg!==Xr&&(i=t.Fg);var r=i!==Xr?Go(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),Xo(t,t.documentBounds,o,s,a,e),e=t.scale,t.scale=r,t.vb=!1,r=t.viewportBounds,Xe.B(r.x,i)&&Xe.B(r.y,n)&&Xe.B(r.width,o)&&Xe.B(r.height,s)||t.onViewportBoundsChanged(new Dt(i,n,o,s),r,e,!1)}}function Go(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===Ur?((e=Math.min(h,a))>i&&(e=i),e<t.minScale&&(e=t.minScale),e>t.maxScale&&(e=t.maxScale),e):e===qr?((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 Xo(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===_r)&&(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),_n(t.Yd,t.pa,s),t.pa.h(s.x,s.y),kr(t),pt.free(s)}function Uo(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 qo(t,e,i){var n=t.Qg;return t.Qg=t.cj,t.cj=n,n.diagram=t,n.event=e,i?Zo(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),E&&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=Ko(e,e.target),n.targetObject=null,n}function Ko(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 Ho(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,E&&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 Wo(t,e){return!!t.bubbles||(void 0!==e.stopPropagation&&e.stopPropagation(),!1!==e.cancelable&&e.preventDefault(),e.cancelBubble=!0,!1)}function Zo(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 Jo(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 $o(t,e,i){!t.Ee||t.vb||t.animationManager.defaultAnimation.isAnimating||sr(t)||(e&&Qo(t),i&&Yo(t,!1))}function _o(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||Bo(t),$o(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),$o(t,!0,!1),s=!1,r?((i=Dt.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!==Xr)t.scale=Go(t,t.Fg);else if(t.yh!==Xr)t.scale=Go(t,t.yh);else{var e=t.initialScale;isFinite(e)&&0<e&&(t.scale=e)}Yo(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"),$o(t,!0,!1),Dt.free(i)):i.Ok&&i.Qw&&(t.Fg!==Xr?t.scale=Go(t,t.Fg):t.yh!==Xr?t.scale=Go(t,t.yh):(i=t.initialScale,isFinite(i)&&0<i&&(t.scale=i)),Yo(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 _,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)||Iu(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(j(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();j(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,f=c.length;try{var d=new Dt(r.x,r.y,n.width/o,n.height/o),p=d.copy();p.Co(i),yr(t,p),Qo(t),t.Fd(c,f,t,d),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=Ye.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),Ye.free(m),ir(t,e),e.globalAlpha=t.pb;var y=t.Qj("Grid");if(s){var v=new _,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<f;l++)Po(c[l],e,t,v,h);v.each((function(t){return t.Gj()}))}else for(v=0;v<f;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,f,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 Ch,o=t instanceof To;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]),N(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]&&!D(r,s)){if(o&&"ModelChanged"===s){t.Yw(e[s]);continue}if(o&&"Changed"===s){t.Pe(e[s]);continue}if(o&&D(t.toolManager,s))r=t.toolManager;else{if(o&&Tr(t,s)){t.Bj(s,e[s]);continue}if(t instanceof md&&"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 Os&&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,f=u.width,d=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,M=t.rj;t.contentAlignment.sb()?(m.width>w&&(y=M.left,v=M.right),m.height>k&&(x=M.top,b=M.bottom)):(y=M.left,v=M.right,x=M.top,b=M.bottom);var S=m.width+y+v,N=m.height+x+b,P=S>h/(M=t.scale),C=N>l/M;if(!(r||t.gf||t.Be||P||C))return!0;y=m.x-y,h=u.x,v=m.right+v,l=u.right+s,x=m.y-x;var T=u.y;m=m.bottom+b,u=u.bottom+a;var L="1px";if(b="1px",t.scrollMode===_r&&(P||C)&&(P&&t.hasHorizontalScrollbar&&t.allowHorizontalScroll&&(P=1,y+1<h&&(P=Math.max((h-y)*M+t.Aa,P)),v>l+1&&(P=Math.max((v-l)*M+t.Aa,P)),w+s+1<S&&(P=Math.max((S-w)*M+t.Aa,P)),L=P.toString()+"px"),C&&t.hasVerticalScrollbar&&t.allowVerticalScroll&&(P=1,x+1<T&&(P=Math.max((T-x)*M+t.ya,P)),m>u+1&&(P=Math.max((m-u)*M+t.ya,P)),k+a+1<N&&(P=Math.max((N-k)*M+t.ya,P)),b=P.toString()+"px")),C="1px"!==b,(P="1px"!==L)&&C||!P&&!C||(C&&(l-=t.Db),P&&(u-=t.Db),S<w+s||!t.hasHorizontalScrollbar||!t.allowHorizontalScroll||(s=1,y+1<h&&(s=Math.max((h-y)*M+t.Aa,s)),v>l+1&&(s=Math.max((v-l)*M+t.Aa,s)),w+1<S&&(s=Math.max((S-w)*M+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),N<k+a||!t.hasVerticalScrollbar||!t.allowVerticalScroll||(a=1,x+1<T&&(a=Math.max((T-x)*M+s,a)),m>u+1&&(a=Math.max((m-u)*M+s,a)),k+1<N&&(a=Math.max((N-k)*M+s,a)),b=a.toString()+"px"),C="1px"!==b),t.qr&&P===t.Be&&C===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,C!==t.gf&&(t.Aa="1px"===b?t.Aa+t.Db:Math.max(t.Aa-t.Db,1),r=!0,t.tn&&(a=pt.alloc(),C?(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=C,g.style.height=b,t.gu=!0,r&&(t.pn=!0),e=p.scrollLeft,t.hasHorizontalScrollbar&&t.allowHorizontalScroll&&(w+1<S?e=(t.position.x-y)*M:y+1<h?e=p.scrollWidth-p.clientWidth:v>l+1&&(e=t.position.x*M)),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<N?p.scrollTop=(t.position.y-x)*M:x+1<T?p.scrollTop=p.scrollHeight-p.clientHeight:m>u+1&&(p.scrollTop=t.position.y*M)),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=Dt.allocAt(o,c,f,d),t.onViewportBoundsChanged(i,t.viewportBounds,M,r),Dt.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 Zu){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 Hu||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)||fr(t,e);for(var a=A(),h=A(),l=e.iterator,u=pt.alloc();l.next();){var c=l.key,f=l.value;if(c.Zc()){var d=pr(t,c,e);null!==d?a.push(new ks(c,f,d)):o&&!c.canMove()||(d=f.point,r.assign(d),t.computeMove(c,r.add(s),n,u),c.location=u,void 0===f.shifted&&(f.shifted=new pt),f.shifted.assign(u.re(d)))}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,f=0;f<c;f++){var p=h[f];if((d=p.key)instanceof wc)if(d.suspendsRouting){d.Tg=null,u=d.fromNode;var g=d.toNode;if(null!==t.draggedLink&&n.dragsLink)if(g=p.value.point,null===d.dragComputation)e.add(d,t.Pd(n,d,s)),Sc(d,s.x-g.x,s.y-g.y);else{p=pt.allocAt(0,0),(u=d.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,d,u,m=pt.alloc(),n),u.assign(d.dragComputation(d,u,m)).re(p),e.add(d,t.Pd(n,d,u)),Sc(d,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(d,t.Pd(n,d,o)),Sc(d,g.x,g.y)):(d.suspendsRouting=!1,d.bb()):(p=p.value.point,u=null!==u?o:null!==g?l:s,e.add(d,t.Pd(n,d,u)),Sc(d,u.x-p.x,u.y-p.y))}else null!==d.fromNode&&null!==d.toNode||(u=p.value.point,e.add(d,t.Pd(n,d,s)),Sc(d,s.x-u.x,s.y-u.y))}pt.free(r),pt.free(s),pt.free(o),pt.free(l),j(a),j(h),i||(Qo(t),dr(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),Xe.No(i.x,i.y,a+r.x,s+r.y,t,e,n),pt.free(r)}}function fr(t,e){if(null!==e)for(t.Mr=!0,t=e.iterator;t.next();)(e=t.key)instanceof wc&&(e.suspendsRouting=!0)}function dr(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&&(Wn(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(fe)&&(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),Yo(t,!1),n.zb&&(Wn(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||(Fh(l.figure)?r=r*u/Xe.vx(r,u):o=o*u/Xe.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=Dt.alloc(),t=t.viewportBounds,e.h(t.x,t.y,t.width,t.height),!e.w())return void Dt.free(e);o=e.width,r=e.height,t=e.x,s=e.y,Dt.free(e)}i.width=o+2*n.width,i.height=r+2*n.height,e=pt.alloc(),Xe.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 _&&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 _&&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 Mr(t,e){t.Zi=!1;var i=t.Sp;i.D(e)||(i=i.copy(),t.Sp.assign(e),Yo(t,!1),t.R("DocumentBoundsChanged",void 0,i),t.Ee=!0,t.N())}function Sr(t,e){for(var i=t.ai.iterator;i.next();)Nr(t,i.value,e);t.layout&&(e?t.layout.isValidLayout=!1:t.layout.C())}function Nr(t,e,i){if(null!==e){for(var n=e.gl.iterator;n.next();)Nr(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||Kn(r,"Layout")),t.xh=!1;for(var s=t.ai.iterator;s.next();)Cr(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||Hn(r),t.aa=i}}}function Cr(t,e,i,n){if(null!==e){for(var o=e.gl.iterator;o.next();)Cr(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 Tr(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 jr(t,e,i,n){var o=t.Xh;if(null===o&&(t.Xh=o=new pf(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=Fr(t,i)),null===i){e=Dt.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&&Or(t,s,n,e)}Dt.free(e)}else{for(0<i.memberParts.count&&((e=t.computePartsBounds(i.memberParts,!1)).Bc(20,20),o.initialize(e)),e=Dt.alloc(),r=i.memberParts;r.next();)(s=r.value)instanceof Zu&&Or(t,s,n,e);Dt.free(e)}o.group=i,o.Yx=n,o.vs=!1}else e&&yf(o);return o}function Fr(t,e){return e.avoidable&&!e.isLinkLabel?e:null!==e.containingGroup?Fr(t,e.containingGroup):null}function Or(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(gf(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(Mf,i,e+1);else for(var s=i;s<=e;s++)r[s]=Mf}else if(e instanceof gc)for(e=e.memberParts;e.next();)(o=e.value)instanceof Zu&&Or(t,o,i,n)}function Dr(t,e){null===t.Xh||t.Xh.vs||void 0!==e&&(!e.avoidable||e.isLinkLabel)||(t.Xh.vs=!0)}function Br(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=Dt.alloc(),t.computeBounds(e),e.ed(t.documentBounds),Mr(t,e),Dt.free(e),t.Fc=!0,t.bd(),Br(t))}}),t.vp))}function Ir(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 zr(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 f=e.document||document,d=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 Wt(l):l instanceof Wt||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 Fa(null,f,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=f,n.hs=d,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 M=(k=k.Pa.s).length,S=0;S<M;S++){var N=k[S];N.isInDocumentBounds&&N.isVisible()&&((N=N.actualBounds).w()&&y.ed(N))}}if(v=new pt(y.x,y.y),null!==h){for(x=new Dt(0,0,0,0),b=!0,(k=h.iterator).reset();k.next();)(M=k.value)instanceof ku&&(null!==(S=M.layer)&&!S.visible||null!==S&&!p&&S.isTemporary||!M.isVisible()||(M=M.actualBounds).w()&&(b?(b=!1,x.assign(M)):x.ed(M)));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 Wt(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=f,n.hs=d,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=Mo,(e=So.prototype).clear=function(){for(var t=this.Pa,e=0;e<t.length;e++){var i=t.s[e];i.Ig=null,Xs(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 Zu?n++:h instanceof wc?r++:h instanceof Hu?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 Zu?a+=" "+O(n):i instanceof wc&&(a+=" "+O(i.fromNode)+" "+O(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 J||n instanceof _||(n=new _),!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 J||o instanceof _||(o=new _),!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 J||o instanceof _)&&(r=o),o=!0),r instanceof J||r instanceof _||(r=new _),!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 f=c;c.og(a,h,i,n,o,r)&&(null!==i&&(f=i(f)),null===f||null!==n&&!n(f)||r.add(f))}}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 Hu&&null!==s.adornedPart)continue;var a=s.actualBounds;s.isVisible()&&Yt(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(Su(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++)Su(o[e]);j(t),j(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=No(this,t);var r=this.Zq;r.length=0;for(var s=e.scale,a=Dt.alloc(),h=0;h<n;h++)this.Oj(t,i[h],e,r,s,a,!0);if(Dt.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&&(Us(e,t,e.areaBackground,!0,!0,r,o),t.fillRect(o.x,o.y,o.width,o.height)),null===e.areaBackground&&null===e.background&&(Us(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),Us(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(fi,t,this,e,i,n,o)},e.oi=function(t,e,i){var n=this.Pa;if(e.Ig=this,null===this&&Xs(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)),Co(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,Xs(e),t},f.Object.defineProperties(So.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)&&M(t,"0 <= value <= 1",So,"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))}}}),So.prototype.findObjectsNear=So.prototype.og,So.prototype.findObjectsIn=So.prototype.Cf,So.prototype.findObjectsAt=So.prototype.ji,So.prototype.findObjectAt=So.prototype.ic,So.className="Layer",To.prototype.clear=function(){this.animationManager.Cc(),this.model.clear(),Yr=null,Gr="",Ao(this,!1),this.Xn.clear(),ru(),this.Og.clear(),this.Xh=null,this.Ya(),this.Va(),this.N()},To.prototype.reset=function(){this.clear(),this.vb=!0,Lo(this),kr(this),this.Wg=!0,Io(this),this.layout=new Ff,this.Wg=!1,this.model=Bd(),this.model.undoManager=new mi,this.vb=this.rn=!1,this.N()},To.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},To.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)||E||(e=11)}this.Db=e,this.Gw=!0},To.prototype.qb=function(t){t.classType===To&&(this.autoScale=t)},To.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},To.prototype.addEventListener=function(t,e,i,n){t.addEventListener(e,i,{capture:n,passive:!1})},To.prototype.removeEventListener=function(t,e,i,n){t.removeEventListener(e,i,{capture:n})},To.prototype.computePixelRatio=function(){return null!==this.Yh?this.Yh:m.devicePixelRatio||1},To.prototype.doMouseMove=function(){this.currentTool.doMouseMove()},To.prototype.doMouseDown=function(){this.currentTool.doMouseDown()},To.prototype.doMouseUp=function(){this.currentTool.doMouseUp()},To.prototype.doMouseWheel=function(){this.currentTool.doMouseWheel()},To.prototype.doKeyDown=function(){this.currentTool.doKeyDown()},To.prototype.doKeyUp=function(){this.currentTool.doKeyUp()},To.prototype.doFocus=function(){this.focus()},To.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)}},To.prototype.Oy=function(){this.H.R("GainedFocus")},To.prototype.Ny=function(){this.H.R("LostFocus")},To.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 f=o.width,d=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;f<h||d<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,f>=h&&s>=c&&u<=p&&(i.style.width="1px"),d>=l&&a>=n&&r<=g&&(i.style.height="1px"))}},To.prototype.computeBounds=function(t){return void 0===t&&(t=new Dt),Qo(this),Vo(this,t)},To.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 Dt(NaN,NaN,0,0):i},To.prototype.zoomToFit=function(){var t=this.sj;this.sj=_r,this.scale=Go(this,Ur),t!==_r&&(Yo(this,!1),Xo(this,this.documentBounds,this.Aa/this.Ca,this.ya/this.Ca,this.zk,!1)),this.sj=t},(e=To.prototype).BA=function(t,e){void 0===e&&(e=Ur);var i=t.width,n=t.height;if(!(0===i||0===n||isNaN(i)&&isNaN(n))){var o=1;if(e===Ur||e===qr)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===qr?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 Os){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=Uo(this,t,(function(t){return t.part}),(function(t){return t.canSelect()})))instanceof ku)return t}else if((t=Uo(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 J||o instanceof _||(o=new _),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 J||n instanceof _||(n=new _),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 J||o instanceof _||(o=new _),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 J||o instanceof _||(o=new _),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 _;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 J||o instanceof _)&&(r=o),o=!0);for(r instanceof J||r instanceof _||(r=new _),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 J||o instanceof _)&&(r=o),o=!0),r instanceof J||r instanceof _||(r=new _),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},To.prototype.acceptEvent=function(t){return qo(this,t,t instanceof MouseEvent)},To.prototype.Qz=function(t){var e=this.H;if(!this.H.isEnabled)return!1;var i=qo(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(),Wo(i,t)},To.prototype.Rz=function(t){var e=this.H;if(!e.isEnabled)return!1;var i=qo(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(),Wo(i,t)},To.prototype.bz=function(t){var e=this.H;if(!e.isEnabled)return!1;var i=qo(e,t,!0);return null!==e.mouseEnter&&e.mouseEnter(i),e.currentTool.standardMouseOver(),Wo(i,t)},To.prototype.cz=function(t){var e=this.H;if(!e.isEnabled)return!1;var i=qo(e,t,!0);return null!==e.mouseLeave&&e.mouseLeave(i),Wo(i,t)},To.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)},To.prototype.Ya=function(){this.Zi||(this.Zi=!0,this.$b(!1))},To.prototype.redraw=function(){this.vb||this.ld||(this.N(),this.bd())},(e=To.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,_o(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,Kn(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),_o(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 Hu&&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&&(Ye.prototype.Cd=Ye.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&&(Ye.prototype.Cd=Ye.prototype.Eu),n?(this.ib.Vc(!0),this.vd=!0):this.Fc=this.vd=!1,e=+new Date-+i,n=U&&U.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 X,this.Rg.drawShadows=!0,this.Rg.textGreeking=!0,this.Rg.viewportOptimizations=!E&&!z,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 X,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 dt,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")},To.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=Dt.alloc(),Mr(this,this.computeBounds(n)),Dt.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),f=Math.floor(o-u),d=Math.floor(a-c);t.drawImage(n.Oa,u,c,f,d,0,0,f,d),ls(this.Yf,this)&&t.clearRect(0,0,h,l),n=A(),t=A(),d=Math.abs(r),f=Math.abs(e);var p=0===u?0:o-d;u=pt.allocAt(p,0),d=pt.allocAt(d+p,a),t.push(new Dt(Math.min(u.x,d.x),Math.min(u.y,d.y),Math.abs(u.x-d.x),Math.abs(u.y-d.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(d,g),n.push(new Dt(Math.min(u.x,d.x),Math.min(u.y,d.y),Math.abs(u.x-d.x),Math.abs(u.y-d.y))),p=0===c?0:a-f,u.h(0,p),d.h(o,f+p),t.push(new Dt(Math.min(u.x,d.x),Math.min(u.y,d.y),Math.abs(u.x-d.x),Math.abs(u.y-d.y))),vt(u,g),vt(d,g),n.push(new Dt(Math.min(u.x,d.x),Math.min(u.y,d.y),Math.abs(u.x-d.x),Math.abs(u.y-d.y))),ls(this.Yf,this)&&(o=0<r?0:-r,a=0<e?0:-e,u.h(o,a),d.h(h+o,l+a),t.push(new Dt(Math.min(u.x,d.x),Math.min(u.y,d.y),Math.abs(u.x-d.x),Math.abs(u.y-d.y))),vt(u,g),vt(d,g),n.push(new Dt(Math.min(u.x,d.x),Math.min(u.y,d.y),Math.abs(u.x-d.x),Math.abs(u.y-d.y)))),pt.free(u),pt.free(d),$o(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=No(s,o),(c=s.Zq).length=0,u=this.scale,f=Dt.alloc(),g=(d=s.Pa.s).length,p=h.length;for(var m=0;m<g;m++){var y=d[m],v=Lu(y,y.actualBounds);t:{for(var x=2/u,b=4/u,k=0;k<p;k++){var M=h[k];if(0!==M.width&&0!==M.height&&v.Vu(M.x-x,M.y-x,M.width+b,M.height+b)){v=!0;break t}}v=!1}v&&s.Oj(o,y,this,c,u,f,!0)}Dt.free(f),o.globalAlpha=l}o.restore(),o.Vc(!0),this.Yf&&ls(this.Yf,this)&&this.Vp(),this.Fc=this.vd=!1,this.hk()}j(n),j(t),this.ld=!1}}else this.bd();i&&(Oo(this),this.bd(),Do(this,!0))}else i?(Oo(this),this.bd(),Do(this,!0)):this.bd()}},(e=To.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(di,"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;Dh(t,(function(t){xr(e,t)})),(t instanceof Hu||t instanceof gc&&null!==t.placeholder)&&t.v(),null!==t.data&&Dh(t,(function(t){od(e.partManager,t)})),!0!==na(t)&&!0!==Iu(t)||this.De.add(t),Du(t,!0,this),Uu(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&&Dh(t,(function(t){rd(e.partManager,t,e)})),this.De.remove(t),Uu(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 _).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)},To.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 dt;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)}},To.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=To.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(di,"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(di,"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(di,"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 J),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 J),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(fi,t,this,e,i,n,o)},To.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===fi){var o=t.object;if(Rd(o,t.propertyName,t.I(e)),o instanceof Os){var r=o.part;null!==r&&r.Wb()}this.isModified=!0}else if(n===di){var s=t.object,a=t.newParam,h=t.newValue;if(s instanceof Ch)if("number"==typeof a&&h instanceof Os){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?qh(s,a,e?void 0:h):Kh(s,a,e?void 0:h));else if(s instanceof So){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 To?"number"==typeof a&&h instanceof So&&(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,f=t.oldParam,d=t.oldValue;if(c instanceof Ch)"number"==typeof f&&d instanceof Os?e?c.Gb(f,d):c.pc(f):"number"==typeof f&&d instanceof hl&&(d.isRow?qh(c,f,e?d:void 0):Kh(c,f,e?d:void 0));else if(c instanceof So){var p=!0===t.newParam;"number"==typeof f&&d instanceof ku&&(e?0>c.Pa.indexOf(d)&&c.oi(f,d,p):(d.isSelected=!1,d.isHighlighted=!1,d.Wb(),c.pc(p?f:-1,d,p)))}else c instanceof To?"number"==typeof f&&d instanceof So&&(e?(d.Xe(this),this.Wa.Gb(f,d)):this.Wa.mb(f)):w("unknown ChangedEvent.Remove object: "+t.toString());this.isModified=!0}else n!==ci&&w("unknown ChangedEvent: "+t.toString())}finally{this.skipsModelSourceBindings=i}}},To.prototype.Ea=function(t){return this.undoManager.Ea(t)},To.prototype.eb=function(t){return this.undoManager.eb(t)},To.prototype.Kf=function(){return this.undoManager.Kf()},To.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}},To.prototype.updateAllTargetBindings=function(t){this.partManager.updateAllTargetBindings(t)},To.prototype.rp=function(){this.partManager.rp()},To.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!==Xr||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()}))}},To.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)}},To.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))},To.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)},To.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=To.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 _).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,f=i*s+n*h+u;e=i*a+n*l+c;var d=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(f,d),f=Math.max(f,d),d=Math.min(e,t),e=Math.max(e,t),r=Math.min(r,n),f=Math.max(f,n),d=Math.min(d,i),e=Math.max(e,i),r=Math.min(r,s),f=Math.max(f,s),new Dt(r,d=Math.min(d,o),f-r,(e=Math.max(e,o))-d)},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)},To.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||Hn(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}}}},To.prototype.Wd=function(){this.partManager.Wd()},To.prototype.Aj=function(t,e){this.Yd.Aj(t,e)},To.prototype.Cj=function(t,e){this.Yd.Cj(t,e)},To.prototype.findPartForKey=function(t){return this.partManager.findPartForKey(t)},To.prototype.Vb=function(t){return this.partManager.Vb(t)},To.prototype.findLinkForKey=function(t){return this.partManager.findLinkForKey(t)},(e=To.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=Dt.alloc();Mr(this,this.computeBounds(t)),Dt.free(t)}},e.rz=function(){for(var t=new _,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&&Sr(this,!0),this.ld?Pr(this,!1):(this.Jk=!0,_o(this))},e.yz=function(){for(var t=new J,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=Tr(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 jr(this,!1,null,e||null).Yj(t.x,t.y,t.width,t.height)},To.prototype.computeOccupiedArea=function(t){return this.isVirtualized?this.viewportBounds.copy():this.Zi?Vo(this,t):t.assign(this.documentBounds)},To.prototype.gs=function(t){this.wp.assign(t),this.computeAutoScrollPosition(this.wp).Xa(this.position)?this.ug():Br(this)},To.prototype.ug=function(){-1!==this.vk&&(m.clearTimeout(this.vk),this.vk=-1)},To.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=Dt.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)),Dt.free(n),pt.free(r),e},(e=To.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={}),Ir(this,this.Xz,t)},e.Xz=function(t,e,i){var n=zr(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},f.Object.defineProperties(To.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),Fo(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)&&M(t,"0 <= value <= 1",To,"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),Yo(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),Yo(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),Yo(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),Yo(this,!1))}},scrollHorizontalLineChange:{get:function(){return this.iu},set:function(t){var e=this.iu;e!==t&&(0>t&&M(t,">= 0",To,"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&&M(t,">= 0",To,"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 M(t,">= 0",To,"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,Kn(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=Er.get(t))?new t:new Qf}(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),_n(this.animationManager,e,this.pa),this.vb||null===this.ta&&!this.wo.w()?kr(this):(this.vb=!0,t=this.scale,Xo(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=zo(this)),this.fe},set:function(t){var e=this.fe;if(e!==t){null===e&&(e=this.fe=zo(this)),t.type!==Ch.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 Wt(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===_r&&Yo(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,Yo(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!==Xr&&Yo(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)):M(t,"> 0",To,"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)):M(t,"> 0",To,"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),Yo(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 Wt(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 Wt(t));var e=this.xp;e.D(t)||(this.xp=t=t.J(),this.Ya(),this.g("autoScrollRegion",e,t))}}}),f.Object.defineProperties(To,{licenseKey:{get:function(){return ns.jc()},set:function(t){ns.add(t.replace(/\s/g,""))}},version:{get:function(){return os}}}),To.prototype.makeImageData=To.prototype.Jx,To.prototype.makeImage=To.prototype.Wz,To.prototype.cacheGroupExternalLinks=To.prototype.Fu,To.prototype.addRenderer=To.prototype.bs,To.prototype.makeSVG=To.prototype.av,To.prototype.makeSvg=To.prototype.Cs,To.prototype.stopAutoScroll=To.prototype.ug,To.prototype.doAutoScroll=To.prototype.gs,To.prototype.isUnoccupied=To.prototype.Yj,To.prototype.raiseDiagramEvent=To.prototype.R,To.prototype.removeDiagramListener=To.prototype.am,To.prototype.addDiagramListener=To.prototype.Bj,To.prototype.findTreeRoots=To.prototype.yz,To.prototype.layoutDiagram=To.prototype.Uz,To.prototype.findTopLevelGroups=To.prototype.qz,To.prototype.findTopLevelNodesAndLinks=To.prototype.rz,To.prototype.ensureBounds=To.prototype.Va,To.prototype.findLinksByExample=To.prototype.ls,To.prototype.findNodesByExample=To.prototype.ms,To.prototype.findLinkForData=To.prototype.Kc,To.prototype.findNodeForData=To.prototype.ii,To.prototype.findPartForData=To.prototype.Lc,To.prototype.findLinkForKey=To.prototype.findLinkForKey,To.prototype.findNodeForKey=To.prototype.Vb,To.prototype.findPartForKey=To.prototype.findPartForKey,To.prototype.rebuildParts=To.prototype.Wd,To.prototype.transformViewToDoc=To.prototype.Ps,To.prototype.transformRectDocToView=To.prototype.zA,To.prototype.transformDocToView=To.prototype.op,To.prototype.centerRect=To.prototype.es,To.prototype.scrollToRect=To.prototype.tv,To.prototype.scroll=To.prototype.scroll,To.prototype.highlightCollection=To.prototype.Jz,To.prototype.highlight=To.prototype.Iz,To.prototype.selectCollection=To.prototype.rA,To.prototype.select=To.prototype.select,To.prototype.updateAllRelationshipsFromData=To.prototype.rp,To.prototype.updateAllTargetBindings=To.prototype.updateAllTargetBindings,To.prototype.commit=To.prototype.commit,To.prototype.rollbackTransaction=To.prototype.Kf,To.prototype.commitTransaction=To.prototype.eb,To.prototype.startTransaction=To.prototype.Ea,To.prototype.raiseChanged=To.prototype.g,To.prototype.raiseChangedEvent=To.prototype.cb,To.prototype.removeChangedListener=To.prototype.ik,To.prototype.addChangedListener=To.prototype.Pe,To.prototype.removeModelChangedListener=To.prototype.mA,To.prototype.addModelChangedListener=To.prototype.Yw,To.prototype.findLayer=To.prototype.Qj,To.prototype.removeLayer=To.prototype.kA,To.prototype.addLayerAfter=To.prototype.Cy,To.prototype.addLayerBefore=To.prototype.Ww,To.prototype.addLayer=To.prototype.Al,To.prototype.moveParts=To.prototype.moveParts,To.prototype.copyParts=To.prototype.Kj,To.prototype.removeParts=To.prototype.Is,To.prototype.remove=To.prototype.remove,To.prototype.add=To.prototype.add,To.prototype.clearDelayedGeometries=To.prototype.bx,To.prototype.setProperties=To.prototype.nm,To.prototype.attach=To.prototype.Du,To.prototype.set=To.prototype.set,To.prototype.resetInputOptions=To.prototype.Sx,To.prototype.setInputOption=To.prototype.sA,To.prototype.getInputOption=To.prototype.Ql,To.prototype.resetRenderingHints=To.prototype.Tx,To.prototype.setRenderingHint=To.prototype.Xx,To.prototype.getRenderingHint=To.prototype.Gf,To.prototype.maybeUpdate=To.prototype.bd,To.prototype.requestUpdate=To.prototype.$b,To.prototype.delayInitialization=To.prototype.Xy,To.prototype.isUpdateRequested=To.prototype.Pz,To.prototype.invalidateDocumentBounds=To.prototype.Ya,To.prototype.findObjectsNear=To.prototype.og,To.prototype.findPartsNear=To.prototype.mz,To.prototype.findObjectsIn=To.prototype.Cf,To.prototype.findPartsIn=To.prototype.ux,To.prototype.findObjectsAt=To.prototype.ji,To.prototype.findPartsAt=To.prototype.lz,To.prototype.findObjectAt=To.prototype.ic,To.prototype.findPartAt=To.prototype.Ol,To.prototype.focusObject=To.prototype.zz,To.prototype.alignDocument=To.prototype.Jy,To.prototype.zoomToRect=To.prototype.BA,To.prototype.zoomToFit=To.prototype.zoomToFit,To.prototype.diagramScroll=To.prototype.kx,To.prototype.focus=To.prototype.focus;var Er=new dt,Rr=null,Vr=void 0!==m.document,Yr=null,Gr="",Xr=new V(To,"None",0),Ur=new V(To,"Uniform",1),qr=new V(To,"UniformToFill",2),Kr=new V(To,"CycleAll",10),Hr=new V(To,"CycleNotDirected",11),Wr=new V(To,"CycleNotDirectedFast",12),Zr=new V(To,"CycleNotUndirected",13),Jr=new V(To,"CycleDestinationTree",14),$r=new V(To,"CycleSourceTree",15),_r=new V(To,"DocumentScroll",1),Qr=new V(To,"InfiniteScroll",2),ts=new V(To,"TreeParentCollapsed",21),es=new V(To,"AllParentsCollapsed",22),is=new V(To,"AnyParentsCollapsed",23),ns=new J,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[I("76a715b2f73f148a")][I("72ba13b5")]||"";if(t.Rc=!0,Vr){var n=To[I("76a115b6ed251eaf4692")];if(n)for(var o=ns.iterator;o.next()&&!(6>(n=I(n=o.value).split(I("39e9"))).length);){var r=I(n[1]).split(".");if("7da71ca0"!==n[4])break;var s=I(y[I("6cae19")]).split(".");if(r[0]>s[0]||r[0]===s[0]&&r[1]>=s[1]){var a=m[I("74a900bae4370f8b51")][I("6fbb13a1c2311e8a57")].toLowerCase();if(s=a[I("73a612b6fb191d")](I("3aad1ab6e022098b4dc4")),r=I(n[2]),-1<s&&(a=a[I("73a612b6fb191d")](r.toLowerCase()+"/"),t.Rc=!(-1<a&&a<s),!t.Rc))break;for(s=i[I("76ad18b4f73e")],a=i[I("73a612b6fb191d")](I("35e7"))+2;a<s;a++)e+=i[a];if(0>(s=e[I("73a612b6fb191d")](r))&&r!==I("7da71ca0ad381e90")&&(s=e[I("73a612b6fb191d")](I("76a715b2ef3e149757"))),0>s&&(s=e[I("73a612b6fb191d")](I("76a715b2ef3e149757"))),0>s&&(s=e[I("73a612b6fb191d")](I("2bfa41fdb3784bca12"))),0>s&&(s=i[I("73a612b6fb191d")](I("7baa19a6f76c1988428554"))),t.Rc=!(0<=s&&s<e[I("73a612b6fb191d")](I("35"))||-1===e[I("73a612b6fb191d")](I("35"))),!t.Rc)break;if(i[I("73a612b6fb191d")](I("7fb002b6ed25128b4da25b2e"))&&(t.Rc=!(-1<i[I("73a612b6fb191d")](r)),!t.Rc))break;if(-1<(a=(s=m[I("76a715b2f73f148a")][I("69ad17a1e03e")])[I("73a612b6fb191d")](I("7fb002b6ed25128b4da25b2e")))&&(t.Rc=!(s[I("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[I("79a417a0f0181a8946")]=n,m.document[I("78a712aa")]){m.document[I("78a712aa")][I("7bb806b6ed32388c4a875b")](s),h=m.getComputedStyle(s).getPropertyValue(I("78a704b7e62456904c9b12701b6532a8"));var l=m.getComputedStyle(s).getPropertyValue(I("75b817b0ea2202"));if(m.document[I("78a712aa")][I("68ad1bbcf533388c4a875b")](s),h){if(s=m[I("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(I("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[I("76ad18b4f73e")],o=i[I("73a612b6fb191d")](I("35e7"))+2;o<u;o++)e+=i[o];i=e[I("73a612b6fb191d")](I("7da71ca0ad381e90")),t.Rc=!(0<=i&&i<e[I("73a612b6fb191d")](I("35")))}}}return 0<t.Rc&&t!==t.wy}function us(t){this.j=void 0===t?new pt:t,this.o=new pt}To.className="Diagram",To.fromDiv=function(t){var e=t;return"string"==typeof t&&(e=m.document.getElementById(t)),e instanceof HTMLDivElement&&e.H instanceof To?e.H:null},To.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},To.useDOM=function(t){Vr=!!t&&void 0!==m.document},To.isUsingDOM=function(){return Vr},To.None=Xr,To.Uniform=Ur,To.UniformToFill=qr,To.CycleAll=Kr,To.CycleNotDirected=Hr,To.CycleNotDirectedFast=Wr,To.CycleNotUndirected=Zr,To.CycleDestinationTree=Jr,To.CycleSourceTree=$r,To.DocumentScroll=_r,To.InfiniteScroll=Qr,To.TreeParentCollapsed=ts,To.AllParentsCollapsed=es,To.AnyParentsCollapsed=is,hs.className="DiagramHelper",f.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,fs,ds,ps,gs,ms,ys,vs,xs,bs,ws="DraggingInfo";function ks(t,e,i){this.node=t,this.info=e,this.Su=i}function Ms(){this.reset()}function Ss(t,e){if("string"==typeof t||m.Element&&t instanceof Element)var i=To.call(this,t)||this;else i=To.call(this)||this,e=t;return Ns(i),e&&i.nm(e),i}function Ns(t){t.allowDragOut=!0,t.allowMove=!1,t.isReadOnly=!0,t.contentAlignment=ee,t.layout=new Xf}function Ps(t,e){if("string"==typeof t||m.Element&&t instanceof Element)var i=To.call(this,t)||this;else i=To.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 Wt(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(),Ts(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&&Ts(n)},i.autoScale=Ur,i.vb=!1,e&&Object.assign(i,e),i}function Cs(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=Dt.alloc().assign(t.viewportBounds).ed(e.viewportBounds)),Dt.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=No(a,o),l.gc(o,h),o.globalAlpha=a);else{for(var u=No(a,o),c=h.scale,f=Dt.alloc(),d=a.Pa.s,p=d.length,g=0;g<p;g++){var m=d[g];(n||m!==l)&&a.Oj(o,m,h,null,c,f,!1)}Dt.free(f),o.globalAlpha=u}}}}}function Ts(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(){Ti.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=qt,this.hb=!0,this.cg=null,this.ob=200}function js(t,e,i){if(e.isVisible())return i;if(e instanceof Hu)js(t,e.adornedPart,i);else if(e instanceof wc){var n=e.fromNode;null!==n&&js(t,n,i),null!==(e=e.toNode)&&js(t,e,i)}else e instanceof Zu&&(null!==(n=e.labeledLink)&&js(t,n,i),null!==(n=e.pg())&&(n.isTreeExpanded||n.wasTreeExpanded||i.push(n),js(t,n,i))),null!==(e=e.containingGroup)&&(e.isSubGraphExpanded||e.wasSubGraphExpanded||i.push(e),js(t,e,i));return i}function Fs(t){var e=A();for(t=t.iterator;t.next();){var i=t.value;i instanceof wc||e.push(i)}t=new _,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 j(e),t}function Os(){Q(this),this.l=30723,this.pb=1,this.bn="",this.Ma=this.Me=null,this.pa=new pt(NaN,NaN).freeze(),this.jd=Tt,this.Ab=new Ye,this.wh=new Ye,this.Lb=null,this.Ca=this.Kk=1,this.Kb=0,this.Kg=$t,this.uc=new Dt(NaN,NaN,NaN,NaN).freeze(),this.Ib=new Dt(NaN,NaN,NaN,NaN).freeze(),this.dc=new Dt(0,0,NaN,NaN).freeze(),this.ba=this.Yn=this.Zn=null,this.sk=this.Jb=Se,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 Ds(t){null===t.A?t.A=new fa:t.A.nc&&(t.A=t.A.copy())}function Bs(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=Xd(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 Is(t,e,i,n){return!1!==t.pickable&&(n.multiply(t.transform),i?t.Yc(e,n):t.fh(e,n))}function zs(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=Hs(t,!0),i===n&&r===o&&(e=fs),e){case fs:(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 Es(t,e){return null!==e&&(Vh(e)&&(e=e.panel),0!=(512&e.l)||(e.type===Ch.Auto||e.type===Ch.Spot)&&e.Pb()!==t)}function Rs(t,e,i,n){Us(t,e,t.areaBackground,!0,!0,i,n),t.areaBackground instanceof Ia&&t.areaBackground.type===_a?(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;Us(t,e,t.Ma,!0,!1,i,n),t.Ma instanceof Ia&&t.Ma.type===_a?(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 Ys(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===Ch.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 Gs(t,e){null!==(e=e.getAttribute("clip-path"))&&(null!==(t=t.svg.getElementById(e.split("#")[1].slice(0,-1)))&&t.remove())}function Xs(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 Us(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===Ja)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 Oa)&&i.xe&&(i.type===Qa||i.yk===a&&i.ft===h))var u=i.xe;else{var c=0,f=0,d=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,f=i.start.y*h+i.start.offsetY,d=i.end.x*a+i.end.offsetX,p=i.end.y*h+i.end.offsetY,c+=g,d+=g,f+=m,p+=m,i.type===$a)u=e.createLinearGradient(c,f,d,p);else if(i.type===_a)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,f,g,d,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 qs(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 Ks(t){if(!na(t)){var e=t.panel;null!==e?e.v():t.Dd()&&(null!==(e=t.diagram)&&(e.De.add(t),t instanceof Zu&&t.Bd(),e.$b())),oa(t,!0)}}function Hs(t,e){var i=t.stretch,n=t.panel;return null!==n&&n.type===Ch.Table?Ws(t,n.Fb(t.row),n.Eb(t.column),e):null!==n&&n.type===Ch.Auto&&n.Pb()===t?Zs(t,cs,e):i===ms?null!==n?n.type===Ch.Spot&&n.Pb()===t?Zs(t,cs,e):Zs(t,(i=n.defaultStretch)===ms?fs:i,e):Zs(t,fs,e):Zs(t,i,e)}function Ws(t,e,i,n){var o=t.stretch;if(o!==ms)return Zs(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),Zs(t,!0===o&&!0===r?cs:!0===o?ps:!0===r?gs:fs,n)}function Zs(t,e,i){if(i)return e;if(e===fs)return fs;if((i=t.desiredSize).w())return fs;if(t=t.angle,!isNaN(i.width))if(90!==t&&270!==t){if(e===ps)return fs;if(e===cs)return gs}else{if(e===gs)return fs;if(e===cs)return ps}if(!isNaN(i.height))if(90!==t&&270!==t){if(e===gs)return fs;if(e===cs)return ps}else{if(e===ps)return fs;if(e===cs)return gs}return e}function Js(t,e){t.l=e?512|t.l:-513&t.l}function $s(t){return 0!=(1024&t.l)}function _s(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 Zu&&(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 Ch?t instanceof Zu?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?N(n=r(i=C(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 To&&1<i.length){r=n;var s=i[1];("string"==typeof s||s instanceof HTMLDivElement)&&(Fo(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 Ch)null!==(e=rl.I(e))&&(t.type=e);else if(t instanceof Ia){var i=Y(Ia,e);null!==i?t.type=i:w("Unknown Brush type as an argument to GraphObject.make: "+e)}else t instanceof Ue?null!==(e=Y(Ue,e))&&(t.type=e):t instanceof Qe&&(null!==(e=Y(Qe,e))&&(t.type=e));else if(e instanceof Os)t instanceof Ch||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 Gd)t instanceof Os||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 Os?t.Jv(e):w("An AnimationTrigger can only be applied to a GraphObject, not to: "+t);else if(e instanceof _e)t instanceof Ue&&t.type===Ue.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 _e?t.segments.add(e):w("A PathSegment can only be added to a PathFigure, not to: "+t);else if(e instanceof Ff)t instanceof To||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 Ia){for(var o in i=new X,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 X,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",Ms.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},Ms.className="DraggingOptions",c(Ss,To),Ss.prototype.reset=function(){To.prototype.reset.call(this),Ns(this)},Ss.className="Palette",c(Ps,To),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 Fa(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),Cs(this)}finally{this.ta=t,this.ib=e}}}To.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)&&(Su(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?Cs(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 qt;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(),Ts(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))},f.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),Ts(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),Ts(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,Ti),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,Ti.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=E?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 _,i=t.selection.iterator;i.next();)qu(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 _;for(t=t.selection.iterator;t.next();)qu(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)Yr=null,Gr="";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 J).addAll(r),Yr=i,Gr=e.model.dataFormat}}e.R("ClipboardChanged",i)},As.prototype.pasteFromClipboard=function(){var t=new _,e=Yr;if(null===e)return t;var i=this.diagram;if(Gr!==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===Yr||0===Yr.count||Gr!==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===Xr&&((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===Xr&&(!((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===Xr&&((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===Xr&&(!((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;Kn(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=qt):(this.Jt=n,this.sw=i.copy(),t.zoomToFit(),this.Au=t.scale,this.yu=t.documentBounds.copy()),Hn(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;Kn(i,"Scroll To Part");var n=this.scrollToPartPause;if(0<n){var o=js(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 Zu&&t.isTreeExpanded&&(!(t instanceof gc)||t.isSubGraphExpanded);)t=o.pop();0<o.length?(t instanceof ku&&e.tv(t.actualBounds),t instanceof Zu&&!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"),Kn(e.animationManager,"Collapse Tree");var i=new J;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 Zu&&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 Zu&&t.isTreeExpanded))return!1;if(0<t.Qo().count)return!0}else for(t=e.selection.iterator;t.next();)if((e=t.value)instanceof Zu&&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"),Kn(e.animationManager,"Expand Tree");var i=new J;if(null===t||t.isTreeExpanded){if(null===t)for(var n=e.selection.iterator;n.next();){var o=n.value;o instanceof Zu&&!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 Zu)||t.isTreeExpanded)return!1;if(0<t.Qo().count)return!0}else for(t=e.selection.iterator;t.next();)if((e=t.value)instanceof Zu&&!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 J,r=t.selection.iterator;r.next();){var s=r.value;s.Zc()&&s.canGroup()&&o.add(s)}for(var a=new J,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 f=a.iterator;f.next();)if(!f.value.Td(c)){o=!0;break}if(!o)break;c=c.containingGroup}if(i instanceof gc)Wh(i),null!==(n=i.copy())&&t.add(n);else if(e.Yu(i)){var d=e.copyNodeData(i);N(d)&&(e.xf(d),n=t.ii(d))}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 J;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 J;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 f=c.value;if(f.isSelected=!0,!(f instanceof wc)){var d=f.data;null!==d?i.mp(d,u):f.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=Fs(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"),Kn(e.animationManager,"Collapse SubGraph");var i=new J;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"),Kn(e.animationManager,"Expand SubGraph");var i=new J;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 Os?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,Sn(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 dt,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},f.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",jo=function(){return new As},Os.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=C(this.Dh)),null!==this.tb&&(t.tb=this.tb.copy())},Os.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)},Os.prototype.Af=function(t){t.Zn=null,t.Ng=null,t.v()},Os.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},Os.prototype.copy=function(){return this.clone()},(e=Os.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===Os&&(this.stretch=t)},e.toString=function(){return F(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===fi&&$s(this)&&Bs(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 dt),s=0===r.undoManager.transactionLevel,t.startCondition===ko?s=!0:t.startCondition===Mo&&(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()):(Kn(r.animationManager,"Trigger"),r.animationManager.defaultAnimation.add(this,e,n,o))),this instanceof Ch&&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 Ch&&Dh(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(fi,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 Ye);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=Xt(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 Hu||this instanceof pl?Xt(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 Xt(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=Dt.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),Dt.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=Dt.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),Dt.free(i),!a&&(Xe.us(t,n,o)||Xe.us(t,o,r)||Xe.us(t,r,s)||Xe.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 Ie){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 Dt);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),Gt(t,n.x,n.y,0,0),n.h(e.width,e.height).transform(i),Gt(t,n.x,n.y,0,0),n.h(0,e.height).transform(i),Gt(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),f=s*(r.m12*r.dx-r.m11*r.dy);return null!==this.areaBackground?(r=this.actualBounds,Xe.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+f,e=i*a+n*l+c,i=i*h+n*u+f,o.h(0,0),n=this.naturalBounds,i=Xe.Ff(0,0,n.width,n.height,s,t,e,i,o),o.transform(r),i)},Os.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 Ch;switch(Hs(this,!0)){case fs: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)}},Os.prototype.Wl=function(){},Os.prototype.Dd=function(){return!1},Os.prototype.arrange=function(t,e,i,n,o){this.Uk();var r=Dt.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),Dt.free(r)},(e=Os.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||Eu(i,!0),this.N(),Et(t,e)||(i.oh(),this.Pn(i)))},e.Pn=function(t){null!==this.portId&&(Eu(t,!0),t instanceof Zu&&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&&Ys(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 Ch;var a=t instanceof Ch&&Vh(t);0!=(4096&t.l)==!0&&qs(t);var h=t.Ib;if(e.rb.ha=[1,0,0,1,0,0],e.o=!1,o&&(e.o=!0,r&&a?(Ca(e,1,0,0,1,0,0),t.svg=e.ad):r?(Ca(e,s.m11,s.m12,s.m21,s.m22,s.dx,s.dy),t.svg=e.ad):Ca(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&&Es(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||Es(t,o))?(Js(t,!0),null===t.shadowVisible&&La(e)):Js(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&&(Ta(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&&Ys(t,n,a),null!==s&&s(t,a)),!0):(t.svg.replaceWith(a),t.svg=a,null!==a&&t.$o(e,n,h,a),Gs(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 Ch&&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&&(Us(this,t,l,!0,!0,h,a),l instanceof Ia&&l.type===_a?(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&&(Us(this,t,u,!0,!1,h,a),u instanceof Ia&&u.type===_a?(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&&qs(this),h=!1;var c,f=0;if((l=this.part)&&e.Gf("drawShadows")&&(h=l.isShadowed)&&(u=l.shadowOffset,f=Math.max(u.y,u.x)*e.scale*e.Mb),u=this.Dd(),!(c=e.$i||!u)){var d,p=this.naturalBounds,g=(c=this.wh).m11,m=c.m21,y=c.dx,v=c.m12,x=c.m22,b=c.dy,w=d=0;c=d*g+w*m+y;var k=d*v+w*x+b,M=(d=p.width+f)*g+(w=0)*m+y;d=d*v+w*x+b,w=Math.min(c,M);var S=Math.min(k,d),N=Math.max(c+0,M)-w,P=Math.max(k+0,d)-S;c=w,k=S,M=(d=p.width+f)*g+(w=p.height+f)*m+y,d=d*v+w*x+b,w=Math.min(c,M),S=Math.min(k,d),N=Math.max(c+N,M)-w,P=Math.max(k+P,d)-S,c=w,k=S,M=(d=0)*g+(w=p.height+f)*m+y,d=d*v+w*x+b,w=Math.min(c,M),S=Math.min(k,d),N=Math.max(c+N,M)-w,P=Math.max(k+P,d)-S,c=w,k=S,p=(f=e.viewportBounds).x,g=f.y,c=!(c>f.width+p||p>N+c||k>f.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,N=Math.max(s.x,k.x),P=Math.max(s.y,k.y),f=Math.min(s.right,k.right)-N,p=Math.min(s.bottom,k.bottom)-P,null!==(g=this.tb)&&(N=g.x,P=g.y,f=g.width,p=g.height),N>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(N,P,f,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&&Es(this,a)&&null===this.shadowVisible&&La(t),null!==this.Ma&&(t.yc(),Vs(this,t,l,s)),h&&(null!==this.Ma||null!==this.areaBackground||Es(this,a))?(Js(this,!0),null===this.shadowVisible&&La(t)):Js(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 Ch)),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 Ch&&(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"),Gs(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 Ch&&Vh(this);if(!(this instanceof Ch&&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 Ch)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&&ja(t,r)),null===this.background&&void 0===e.Ma||(r=e.Ma,null===this.background?(ja(t,e.Ma),e.Ma.remove(),e.Ma=void 0):((o||i&&!(this instanceof Ch))&&(t.rb.ha=[n.m11,n.m12,n.m21,n.m22,n.dx,n.dy]),Vs(this,t,this.naturalBounds,this.actualBounds),e.Ma?(ja(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&&ja(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 Ch)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 Ch?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,Ks(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 Gd(t,e,i,n):t).xd=this,null!==(t=this.ih())&&Hh(t)&&w("Cannot add a Binding to a template that has already been copied: "+o),null===this.localBindings&&(this.localBindings=new J),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 Ch?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 dt),this.animationTriggers.add(t.propertyName,t),this},f.Object.defineProperties(Os.prototype,{bindingId:{get:function(){return null!==this.A?this.A.zp:-1},set:function(t){this.bindingId!==t&&(null===this.A&&(this.A=new fa),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 fa),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 fa),this.A.wm=t)}},shadowVisible:{get:function(){return null!==this.A?this.A.Ci:null},set:function(t){var e=this.shadowVisible;e!==t&&(Ds(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&&(Ds(this),this.A.Hb=t,this.g("enabledChanged",e,t))}},segmentOrientation:{get:function(){return null!==this.Ua?this.Ua.rr:Wc},set:function(t){var e=this.segmentOrientation;e!==t&&(null===this.Ua&&(this.Ua=new da),this.Ua.rr=t,this.v(),this.g("segmentOrientation",e,t),t===Wc&&(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 da),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 da),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 da),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&&(Ds(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&&(Ds(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)&&M(t,"0 <= value <= 1",Os,"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&&Wa(t,"GraphObject.areaBackground"),t instanceof Ia&&t.freeze(),Ds(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&&Wa(t,"GraphObject.background"),t instanceof Ia&&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),$s(this)&&(null!==(t=this.part)&&(Bs(this,t,"width"),Bs(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),$s(this)&&(null!==(t=this.part)&&Bs(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),$s(this)&&(null!==(t=this.part)&&Bs(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(),Ds(this),this.A.u=t,this.v(),this.g("minSize",e,t))}},maxSize:{get:function(){return null!==this.A?this.A.o:Ct},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(),Ds(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 Wt(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&&qs(this),this.Ab}},oe:{get:function(){return 0!=(4096&this.l)==!0&&qs(this),this.wh}},animationTriggers:{get:function(){return null!==this.A?this.A.hb:null},set:function(t){this.animationTriggers!==t&&(Ds(this),this.A.hb=t)}},reshapingBehavior:{get:function(){return null!==this.A?this.A.Pf:fs},set:function(t){this.reshapingBehavior!==t&&(Ds(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(),Ks(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&&M(t,">= 0",Os,"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&&M(t,">= 1",Os,"columnSpan"),Ds(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&&M(t,">= 0",Os,"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&&M(t,">= 1",Os,"rowSpan"),Ds(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&&(Ds(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 Zu||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&&M(t,">= 0",Os,"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&&M(t,">= 0",Os,"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&&M(t,">= 0",Os,"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&&M(t,">= 0",Os,"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&&(Ds(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&&(Ds(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&&(Ds(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&&(Ds(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&&(Ds(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&&(Ds(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&&(Ds(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&&(Ds(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&&(Ds(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&&(Ds(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&&(Ds(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&&(Ds(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&&(Ds(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&&(Ds(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&&(Ds(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&&(Ds(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&&(Ds(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&&(Ds(this),this.A.Ch=t,this.g("contextMenu",e,t))}}}),Os.prototype.trigger=Os.prototype.Jv,Os.prototype.findBindingPanel=Os.prototype.ih,Os.prototype.findTemplateBinder=Os.prototype.pz,Os.prototype.setProperties=Os.prototype.nm,Os.prototype.apply=Os.prototype.apply,Os.prototype.attach=Os.prototype.Du,Os.prototype.set=Os.prototype.set,Os.prototype.isEnabledObject=Os.prototype.If,Os.prototype.isVisibleObject=Os.prototype.Ed,Os.prototype.isContainedBy=Os.prototype.rg,Os.prototype.getNearestIntersectionPoint=Os.prototype.rs,Os.prototype.getLocalPoint=Os.prototype.qs,Os.prototype.getDocumentScale=Os.prototype.Df,Os.prototype.getDocumentAngle=Os.prototype.li,Os.prototype.getDocumentBounds=Os.prototype.mi,Os.prototype.getDocumentPoint=Os.prototype.ga,Os.prototype.intersectsRect=Os.prototype.Yc,Os.prototype.containedInRect=Os.prototype.fh,Os.prototype.containsRect=Os.prototype.Re,Os.prototype.containsPoint=Os.prototype.ca,Os.prototype.raiseChanged=Os.prototype.g,Os.prototype.raiseChangedEvent=Os.prototype.cb,Os.prototype.addCopyProperty=Os.prototype.Vw;var ca=null;function fa(){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=Ct,this.hg=ms,this.ob=this.Bi=1,this.Pf=fs,this.Pc=this.Ci=this.gd=null,this.Oc="category"}function da(){this.u=-1/0,this.o=0,this.F=it,this.rr=Wc,this.j=this.V="None"}function pa(){this.yj=this.Xi=Se,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=Ta(this),this.Nj=Ta(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?Ca(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?Ma(t,i):"stroke"===e&&Na(t,i),null!==n&&(t=n.ha,i.transform="matrix("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+")")}function Ma(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 Sa(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 Na(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 Ca(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 Ta(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 ja(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 Fa(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 Oa(e,i,n),e.H=t}function Oa(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 Ye,this.isTemporary=!!i}Os.className="GraphObject",ca=new dt,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(Ch,Ch.Auto,{isActionable:!0,enabledChanged:function(t,e){if(t instanceof Ch){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 Ie(0,0,2.76142374915397,2.761423749153969),spot2:new Ie(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 Ch&&(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 Ch&&((t=e.fb("ButtonBorder"))instanceof pl&&(t.fill=e._buttonFillNormal,t.stroke=e._buttonStrokeNormal))},e.actionDown=function(t,e){if(e.If()&&e instanceof Ch&&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 Ch&&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 Ch&&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 Ch&&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:Nt},new Gd("figure","isTreeExpanded",(function(t,e){return e=e.panel,t?e._treeExpandedFigure:e._treeCollapsedFigure})).cp()),{visible:!1},new Gd("visible","isTreeLeaf",(function(t){return!t})).cp());return t.click=function(t,e){if((e=e.part)instanceof Hu&&(e=e.adornedPart),e instanceof Zu){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:Nt},new Gd("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 Hu&&(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(Hu,Ch.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 Ie(0,0,4,6),spot2:new Ie(1,1,-4,-4)}))})),la("ContextMenu",(function(){return aa(Hu,Ch.Vertical,{background:"#F5F5F5",isShadowed:!0,shadowColor:"rgba(0, 0, 0, .4)",shadowOffset:new pt(0,3),shadowBlur:5},new Gd("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 Ie(0,0,2,3),e.spot2=new Ie(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 Gd("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:ds,visible:!1},""!==e?new Gd("visible",e).Kx():[]))).click=function(t,i){if(i instanceof Ch){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 Wt(0,1,0,0)});var e=aa(Ch,"Horizontal",t,{isActionable:!0,cursor:t.cursor,margin:new Wt(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})),Os.None=fs=new V(Os,"None",0),Os.Default=ms=new V(Os,"Default",0),Os.Vertical=gs=new V(Os,"Vertical",4),Os.Horizontal=ps=new V(Os,"Horizontal",5),Os.Fill=cs=new V(Os,"Fill",3),Os.Uniform=ds=new V(Os,"Uniform",1),Os.UniformToFill=ys=new V(Os,"UniformToFill",2),Os.FlipVertical=vs=new V(Os,"FlipVertical",1),Os.FlipHorizontal=xs=new V(Os,"FlipHorizontal",2),Os.FlipBoth=bs=new V(Os,"FlipBoth",3),Os.make=aa,Os.getBuilders=function(){var t,e=new dt;for(t in ca)if(t!==t.toLowerCase()){var i=ca.I(t);"function"==typeof i&&e.add(t,i)}return e.freeze(),e},Os.defineBuilder=la,Os.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 Os)return e&&n.set(e),n;w('GraphObject.build invoked object builder "'+t+'", but it did not return an Object')},Os.takeBuilderArgument=ua,fa.prototype.copy=function(){var t=new fa;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},da.prototype.copy=function(){var t=new da;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},da.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),N(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},f.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),f=t+u,d=e+c,p=r?0:1;n=r?n-o:o-n,(1e-6<Math.abs(s-f)||1e-6<Math.abs(a-d))&&this.path.push(["L",f,+d]),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,f,d])):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},Xe.$(n,a)&&Xe.$(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"),Ma(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),Ma(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||Ca(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(){Na(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=C(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",To.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 X);var i=this;return Ir(this,(function(t,n){return t=null!==(t=zr(i,t,"SVG",e))?t.svg:null,"function"==typeof n?(n(t),null):t}),t)},To.prototype.makeSvg=To.prototype.Cs,To.prototype.av=function(t){return this.Cs(t)},To.prototype.makeSVG=To.prototype.av,Fa.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)},Fa.prototype.toDataURL=function(t,e){return this.Oa.toDataURL(t,e)},Fa.prototype.getBoundingClientRect=function(){return this.Oa.getBoundingClientRect()},Fa.prototype.focus=function(){this.Oa.focus()},Fa.prototype.mx=function(){this.ownerDocument=this.Oa.H=null},f.Object.defineProperties(Fa.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}}}),Fa.className="CanvasSurface",(e=Oa.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()},Oa.prototype.rotate=function(t){this.El.rotate(57.2958*t,0,0)},(e=Oa.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 Ia&&t.type===_a){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(Da),t.lineDashOffset=0)},e.Vc=function(t){t&&(this.dt=""),this.ct=this.et=""},e.Hs=function(){},f.Object.defineProperties(Oa.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 Da=Object.freeze([]);function Ba(){this.F=this.o=this.u=this.j=0}function Ia(t,e){uh||(Za(),uh=!0),Q(this),this._isFrozen=!1,void 0===t?(this.na=Ja,this.xk="black"):"string"==typeof t?(this.na=Ja,this.xk=t):(this.na=t,this.xk="black"),(t=this.na)===$a?(this.Qd=ee,this.Lk=ae):this.Lk=this.Qd=t===_a?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 za(t,e,i){return e=void 0===e||"number"!=typeof e?.2:e,i=void 0===i?th:i,Ga(t),Ya(e,i)}function Ea(t,e,i){return e=void 0===e||"number"!=typeof e?.2:e,i=void 0===i?th:i,Ga(t),Ya(-e,i)}function Ra(t,e,i){Ga(t),t=sh.j;var n=sh.u,o=sh.o,r=sh.F;return Ga(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 Ia?t.Gx():(Ga(t),128>(299*sh.j+587*sh.u+114*sh.o)/1e3))}function Ya(t,e){switch(e){case th:e=100*Ua(sh.j);var i=100*Ua(sh.u),n=100*Ua(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=Ka(hh.j/oh[0]),i=Ka(hh.u/oh[1]),n=Ka(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]*Ha(lh.u/500+t),hh.u=oh[1]*(lh.j>nh*ih?Math.pow(t,3):lh.j/nh),hh.o=oh[2]*Ha(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*qa((3.2404542*hh.j+-1.5371385*hh.u+-.4985314*hh.o)/100),sh.u=255*qa(t/100),sh.o=255*qa(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 Xa(),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 Ga(t){uh||(Za(),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 Xa(){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 Ua(t){return.04045>=(t/=255)?t/12.92:Math.pow((t+.055)/1.055,2.4)}function qa(t){return.0031308>=t?12.92*t:1.055*Math.pow(t,1/2.4)-.055}function Ka(t){return t>ih?Math.pow(t,1/3):(nh*t+16)/116}function Ha(t){var e=t*t*t;return e>ih?e:(116*t-16)/nh}function Wa(t,e){"string"!=typeof t&&(t instanceof Ia||w("Value for "+e+" must be a color string or a Brush, not "+t))}function Za(){rh=Vr?new Fa(null,void 0,{willReadFrequently:!0}).context:null}Oa.className="CanvasSurfaceContext",Ba.className="ColorNumbers",Ia.prototype.copy=function(){var t=new Ia;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=Ia.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===Ia&&(this.type=t)},e.toString=function(){var t="Brush(";if(this.type===Ja)t+=this.color;else if(t=this.type===$a?t+"Linear ":this.type===_a?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)&&M(t,"0 <= loc <= 1",Ia,"addColorStop:loc"),null===this.we&&(this.we=new dt),this.we.add(t,e),this.na===Ja&&(this.type=$a),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===Ja)Ga(this.color),this.color=Ya(t,e);else if((this.type===$a||this.type===_a)&&null!==this.colorStops)for(var i=this.colorStops.iterator;i.next();)Ga(i.value),this.addColorStop(i.key,Ya(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===Ja)Ga(this.color),this.color=Ya(-t,e);else if((this.type===$a||this.type===_a)&&null!==this.colorStops)for(var i=this.colorStops.iterator;i.next();)Ga(i.value),this.addColorStop(i.key,Ya(-t,e));return this},e.Gx=function(){if(this.type===Ja)return Va(this.color);if((this.type===$a||this.type===_a)&&null!==this.colorStops){var t=this.colorStops;if(this.type===_a)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},f.Object.defineProperties(Ia.prototype,{type:{get:function(){return this.na},set:function(t){this._isFrozen&&k(this,t),this.na=t,this.start.Mc()&&(t===$a?this.start=ee:t===_a&&(this.start=oe)),this.end.Mc()&&(t===$a?this.end=ae:t===_a&&(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&&M(t,">= zero",Ia,"startRadius"),this.Gr=t,this.xe=null}},endRadius:{get:function(){return this.Xp},set:function(t){this._isFrozen&&k(this,t),0>t&&M(t,">= zero",Ia,"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}}}),Ia.prototype.isDark=Ia.prototype.Gx,Ia.prototype.darkenBy=Ia.prototype.Wy,Ia.prototype.lightenBy=Ia.prototype.Vz,Ia.prototype.addColorStop=Ia.prototype.addColorStop;var Ja,$a,_a,Qa,th,eh,ih=216/24389,nh=24389/27,oh=[95.047,100,108.883],rh=null,sh=new Ba,ah=new Ba,hh=new Ba,lh=new Ba,uh=!1;function ch(){this.xa="Base"}function fh(){this.xa="Base"}function dh(){this.xa="Base"}function ph(){this.xa="Base"}function gh(){this.xa="Base"}function mh(t,e,i){var n=null;if(t instanceof Ch&&""!==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 Mh(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 Sh(){this.xa="Base"}function Nh(t,e,i,n){if(!1!==ea(n)){var o=n.strokeWidth;0===o&&t instanceof Hu&&t.type===Ch.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 Hu&&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 Ch(t,e){if(Os.call(this),this.na=null,void 0===t)this.na=Ch.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=Ch.Position,e=t);null===this.na&&w("Panel type not specified or PanelLayout not loaded: "+t),this.l=4194304|this.l|(this.na===Ch.Grid?1048576:0),this.O=new J,this.yb=$t,this.Tm=Se,this.Uf=ms,this.$g=null,this.$e="",this.jg=new Dt(NaN,NaN,NaN,NaN),this.T=this.F=null,this.xo=ds,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 Th(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){Us(t,e,c,!1,!1,s,r),c=!1;var f=l.separatorDashArray;null===f&&(f=i?t.defaultRowSeparatorDashArray:t.defaultColumnSeparatorDashArray),null!==f&&(c=!0,e.js(f,0)),e.beginPath(),f=l.position+u,i?f>s.height&&(u-=f-s.height):f>s.width&&(u-=f-s.width),l=l.position+u/2,e.lineWidth=u,u=t.yb,i?(l+=u.top,f=s.width-u.right,e.moveTo(u.left,l),e.lineTo(f,l)):(l+=u.left,f=s.height-u.bottom,e.moveTo(l,u.top),e.lineTo(l,f)),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=jh(t,!0),l=jh(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 f=i?s.height:s.width;if(!(c.position>f)){var d=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),d-=p,(p=c.position+p)+(d+=c.actual)>f&&(d=f-p),0>=d||(f=t.yb,Us(t,e,c.background,!0,!1,a,s),i?e.fillRect(f.left,p+f.top,s.width-(f.left+f.right),d):e.fillRect(p+f.left,f.top,d,s.height-(f.top+f.bottom)))}}}}function jh(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 Fh(t){return"LineV"===t||"BarV"===t}function Oh(t){return null!==t.part?t.part.locationObject:null}function Dh(t,e){Bh(t,t,e)}function Bh(t,e,i){i(e);for(var n=(e=e.O.s).length,o=0;o<n;o++){var r=e[o];r instanceof Ch&&Bh(t,r,i)}}function Ih(t,e){zh(t,t,e)}function zh(t,e,i){if(i(e),e instanceof Ch)for(var n=(e=e.O.s).length,o=0;o<n;o++)zh(t,e[o],i)}function Eh(t,e,i){if(i(e))return e;if(e instanceof Ch)for(var n=(e=e.O.s).length,o=0;o<n;o++){var r=Eh(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 Ch?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===Ch.TableRow||t.type===Ch.TableColumn}function Yh(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 Ch&&Yh(s,e,i,n),null!==e&&(s=e(s)),null===s||null!==i&&!i(s)||n.add(s))}}}function Gh(t){var e=null;return t instanceof pl&&((e=t.spot1)===Se&&(e=null),null!==(t=t.geometry)&&null===e&&(e=t.spot1)),null===e&&(e=te),e}function Xh(t){var e=null;return t instanceof pl&&((e=t.spot2)===Se&&(e=null),null!==(t=t.geometry)&&null===e&&(e=t.spot2)),null===e&&(e=he),e}function Uh(t,e){t.l=e?16777216|t.l:-16777217&t.l}function qh(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 Kh(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 Hh(t){return null!==(t=t.allBindings)&&t._isFrozen}function Wh(t){var e=t.allBindings;if(null===e)null!==t.data&&w("Template cannot have .data be non-null: "+t),t.allBindings=e=new J;else if(e._isFrozen)return;var i=new J;Uh(t,!1),t.qm(t,(function(t,n){n.th();var o=n.localBindings;if(null!==o)for(_s(n,!1),o=o.iterator;o.next();){var r=o.value;r.mode===Kd&&_s(n,!0);var s=r.sourceName;null!==s&&("/"===s&&Uh(t,!0),null!==(s=Xd(r,t,n))&&(i.add(s),null===s.srcBindings&&(s.srcBindings=new J),s.srcBindings.add(r))),e.add(r)}if(n instanceof Ch&&n.type===Ch.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){_s(o,!0);for(var r=o.srcBindings.iterator;r.next();){var s=r.value;null===o.localBindings&&(o.localBindings=new J),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 Ch&&(s=a.substring(0,h),a=a.substr(h+1),null!==(h=r.fb(s))?(r=h,o.targetProperty=a):S('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 Os?(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 Zh(t){if(t.type===Ch.Spot||t.type===Ch.Auto)return Math.min(t.O.length,1);if(t.type===Ch.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===Ch.Table&&0<t.O.length&&((t=t.O.M(0)).isPanelMain&&t instanceof Ch&&Vh(t))?1:0}function Jh(t,e){var i=Zh(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++)$h(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 Ch){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),$h(t,r,o,!1)):s.data=r}}else $h(t,r,o,!1)}for(;n<t.O.length;)t.pc(n,!1);t.$g=null,_h(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 Zu&&(e.Te=!0),e.Te&&e instanceof Zu&&(e.wc=null))}}function $h(t,e,i,n){if(!(null==e||0>i)){var o=Qh(t,e);if(null!==(o=tl(t,o))){if(Wh(o),0!=(16777216&(o=o.copy()).l)){var r=t.ih();null!==r&&Uh(r,!0)}"object"==typeof e&&(null===t.ge&&(t.ge=new dt),t.ge.add(e,o)),r=i+Zh(t),t.Gb(r,o),n&&(o.ub=e,_h(t,r,i),o.ub=null),o.data=e}}}function _h(t,e,i){for(t=t.O;e<t.length;){var n=t.M(e);if(n instanceof Ch){var o=e,r=i;n.type===Ch.TableRow?n.row=o:n.type===Ch.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=Ed(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,S('No item template Panel found for category "'+e+'" on '+t),S(" Using default item template."),t=new Ch,(e=new Pl).bind(new Gd("text","",O)),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 Ch){n=(e=e.O.s).length;for(var o=0;o<n;o++){var r=e[o];i&&r instanceof Ch&&!r.isEnabled||el(t,r,i)}}}function il(t,e){e.name=t,rl.add(t,e)}Ia.className="Brush",Ia.Solid=Ja=new V(Ia,"Solid",0),Ia.Linear=$a=new V(Ia,"Linear",1),Ia.Radial=_a=new V(Ia,"Radial",2),Ia.Pattern=Qa=new V(Ia,"Pattern",4),Ia.Lab=th=new V(Ia,"Lab",5),Ia.HSL=eh=new V(Ia,"HSL",6),Ia.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},Ia.isValidColor=function(t){if("black"===t)return!0;if(""===t)return!1;uh||(Za(),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)},Ia.lighten=function(t){return za(t)},Ia.lightenBy=za,Ia.darken=function(t){return Ea(t)},Ia.darkenBy=Ea,Ia.mix=Ra,Ia.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(){},f.Object.defineProperties(ch.prototype,{name:{get:function(){return this.xa},set:function(t){this.xa=t}},classType:{get:function(){return Ch}}}),ch.prototype.remeasureObject=ch.prototype.iA,ch.prototype.arrangeElement=ch.prototype.Ly,ch.prototype.measureElement=ch.prototype.Yz,ch.className="PanelLayout",c(fh,ch),fh.prototype.measure=function(t,e,i,n,o,r,s){var a=n.length;t=Oh(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 f=l.measuredBounds;c=Math.max(f.width+c,0),u=Math.max(f.height+u,0),f=l.position.x;var d=l.position.y;isFinite(f)||(f=0),isFinite(d)||(d=0),l instanceof pl&&l.isGeometryPositioned&&(f-=l=l.strokeWidth/2,d-=l),Gt(o,f,d,c,u)}}},fh.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(dh,ch),dh.prototype.measure=function(t,e,i,n,o,r,s){var a=n.length;e=A(),r=Oh(t);for(var h=0;h<a;h++){var l=n[h];if(l.visible||l===r){var u=Hs(l,!1);if(u!==fs&&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));j(e)},dh.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,f=u.margin,d=f.top+f.bottom,p=r+o.bottom,g=c.height,m=Hs(u,!1);(isNaN(u.desiredSize.height)&&m===cs||m===gs)&&(g=Math.max(i.height-d-p,0)),d=g+d+p,(p=u.alignment).Xb()&&(p=t.defaultAlignment),p.sb()||(p=oe),s&&(a-=c.width+f.left+f.right),u.arrange(a+p.offsetX+f.left,l+p.offsetY+f.top+(i.height*p.y-d*p.y),c.width,g),s||(a+=c.width+f.left+f.right)}}},c(ph,ch),ph.prototype.measure=function(t,e,i,n,o,r){var s=n.length;i=A();for(var a=Oh(t),h=0;h<s;h++){var l=n[h];if(l.visible||l===a){var u=Hs(l,!1);if(u!==fs&&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,Bt(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);j(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,f=u.margin,d=f.left+f.right,p=r+o.right,g=c.width,m=Hs(u,!1);(isNaN(u.desiredSize.width)&&m===cs||m===ps)&&(g=Math.max(i.width-d-p,0)),d=g+d+p,(p=u.alignment).Xb()&&(p=t.defaultAlignment),p.sb()||(p=oe),s&&(a-=c.height+f.bottom+f.top),u.arrange(l+p.offsetX+f.left+(i.width*p.x-d*p.x),a+p.offsetY+f.top,g,c.height),s||(a+=c.height+f.bottom+f.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 f=h.measuredBounds;r=f.width,s=f.height;var d=Math.max(r+u,0),p=Math.max(s+c,0),g=t.isClipping,m=Dt.allocAt(-l.left,-l.top,d,p),y=Dt.allocAt(0,0,r,s);mh(h,y,!0),r=y.width,s=y.height;for(var v=!0,x=Oh(t),b=0;b<a;b++){var w=n[b];f=e;var k=i;if(w!==h&&(w.visible||w===x)){var M=(l=w.margin).left,S=l.top;switch(d=l.right+l.left,p=l.top+l.bottom,l=Hs(w,!1)){case cs:f=r,k=s,S=M=p=d=0;break;case ps:f=r,M=d=0;break;case gs:k=s,S=p=0}w.measure(f,k,0,0),f=w.measuredBounds,d=Math.max(f.width+d,0),p=Math.max(f.height+p,0),(l=w.alignment).Xb()&&(l=t.defaultAlignment),l.sb()||(l=oe);var N=w.alignmentFocus;if(N.Xb()&&(N=oe),k=null,w instanceof Ch&&""!==w.$e&&((k=w.fb(w.$e))===w&&(k=null)),M=y.x-M,S=y.y-S,null!==k){for(w.arrange(0,0,f.width,f.height),f=k.actualBounds,f=pt.allocAt(f.x+(N.x*f.width-N.offsetX),f.y+(N.y*f.height-N.offsetY)),k=k.panel;k!==w;)k.transform.Ga(f),k=k.panel;M+=l.x*r+l.offsetX-f.x,S+=l.y*s+l.offsetY-f.y,pt.free(f)}else M+=l.x*r+l.offsetX-(N.x*f.width+N.offsetX),S+=l.y*s+l.offsetY-(N.y*f.height+N.offsetY);v?(v=!1,o.h(M,S,d,p)):Gt(o,M,S,d,p)}}switch(v?o.assign(m):g?o.Uu(y.x,y.y,y.width,y.height):Gt(o,m.x,m.y,m.width,m.height),Dt.free(m),Dt.free(y),(l=h.stretch)===ms&&(l=Hs(h,!1)),l){case fs: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=(f=h.measuredBounds).width,s=f.height,d=Math.max(r+u,0),p=Math.max(s+c,0),l=h.margin,mh(h,y=Dt.allocAt(-l.left,-l.top,d,p),!0),r=y.width,s=y.height,e=0;e<a;e++)(i=n[e])===h||!i.visible&&i!==x||(d=(l=i.margin).right+l.left,p=l.top+l.bottom,f=i.measuredBounds,d=Math.max(f.width+d,0),p=Math.max(f.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*f.width+i.offsetX)-l.left,u.y*s+u.offsetY-(i.y*f.height+i.offsetY)-l.top,d,p)):Gt(o,u.x*r+u.offsetX-(i.x*f.width+i.offsetX)-l.left,u.y*s+u.offsetY-(i.y*f.height+i.offsetY)-l.top,d,p));v?o.assign(m):g?o.Uu(y.x,y.y,y.width,y.height):Gt(o,m.x,m.y,m.width,m.height),Dt.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=Dt.allocAt(0,0,s,a),!1),a=0;a<n;a++){var c=e[a];if(c!==o){var f=(l=c.measuredBounds).width,d=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 Ch&&""!==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*f+p.offsetX),u=u.y*s.height+u.offsetY-(p.y*d+p.offsetY);l+=s.x-i.x,u+=s.y-i.y,c.visible&&c.arrange(r+l,h+u,f,d)}}Dt.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,f=l.right+l.left,d=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+f,0);l=Math.max(l.height+d,0);var y=Gh(h),v=y.x*m+y.offsetX;y=y.y*l+y.offsetY;var x=Xh(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=Oh(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=Gh(h),a=n=0,(x=Xh(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)===ds&&(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=Hs(h,!1)),g){case fs: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+f,o.height=h.measuredBounds.height+d}},yh.prototype.arrange=function(t,e){var i=e.length,n=t.Pb(),o=n.measuredBounds,r=Dt.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=Gh(n),c=Xh(n),f=u.y*o.height+u.offsetY,d=c.x*o.width+c.offsetX;for(c=c.y*o.height+c.offsetY,r.x=u.x*o.width+u.offsetX,r.y=f,Gt(r,d,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),(f=a.alignment).Xb()&&(f=t.defaultAlignment),f.sb()||(f=oe),h=r.width*f.x+f.offsetX-h*f.x+s.left+r.x,s=r.height*f.y+f.offsetY-u*f.y+s.top+r.y,a.visible&&(Xt(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 Dt(r.x,r.y,r.width,r.height))));Dt.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 Ch?l:null;if(null!==u&&Vh(u)&&l.visible){a.push(u);for(var c=u.O.s,f=c.length,d=0;d<f;d++){var p=c[d];u.type===Ch.TableRow?p.row=l.row:u.type===Ch.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))}j(s);var v=A(),x=A(),b=A(),w={count:0},k={count:0},M=e,S=i,N=t.rowDefs,P=t.colDefs,C=null;r=N.length;for(var T=0;T<r;T++)void 0!==(C=N[T])&&(C.actual=0);r=P.length;for(var L=0;L<r;L++)void 0!==(C=P[L])&&(C.actual=0);for(var F=g.length,O=0,D=0;D<F;D++)g[D]&&(O=Math.max(O,g[D].length));var B=Math.min(t.topIndex,F-1),I=Math.min(t.leftIndex,O-1),z=0;F=g.length;for(var E=Oh(t),R=0;R<F;R++)if(g[R]){O=g[R].length;var V=t.Fb(R);V.actual=0;for(var Y=V.oc=0;Y<O;Y++)if(g[R][Y]){var G=t.Eb(Y);void 0===v[Y]&&(G.actual=0,G.oc=0,v[Y]=!0);for(var X=g[R][Y],U=X.length,q=0;q<U;q++){var K=X[q];if(K.visible||K===E){var H=1<K.rowSpan||1<K.columnSpan;H&&(R<B||Y<I||x.push(K));var W=K.margin,Z=W.right+W.left,J=W.top+W.bottom,$=Ws(K,V,G,!1),_=K.desiredSize,Q=!isNaN(_.height),tt=!isNaN(_.width)&&Q;if(H||$===fs||tt||R<B||Y<I||(void 0!==w[Y]||$!==cs&&$!==ps||(w[Y]=-1,w.count++),void 0!==k[R]||$!==cs&&$!==gs||(k[R]=-1,k.count++),b.push(K)),K.measure(1/0,1/0,0,0),!(R<B||Y<I)){var et=K.measuredBounds,it=Math.max(et.width+Z,0),nt=Math.max(et.height+J,0);if(1===K.rowSpan&&($===fs||$===ps)){var ot=(C=t.Fb(R)).Wc();(z=Math.max(nt-C.actual,0))+ot>S&&(z=Math.max(S-ot,0));var rt=0===C.oa;C.oc=C.oc+z,C.actual=C.oa+z,S=Math.max(S-(z+(rt?ot:0)),0)}if(1===K.columnSpan&&($===fs||$===gs)){var st=(C=t.Eb(Y)).Wc();(z=Math.max(it-C.actual,0))+st>M&&(z=Math.max(M-st,0));var at=0===C.oa;C.oc=C.oc+z,C.actual=C.oa+z,M=Math.max(M-(z+(at?st:0)),0)}H&&K.Uj()}}}}}j(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 ft=0;ft<r;ft++){var dt=N[ft];void 0!==dt&&(lt+=isNaN(dt.Hc)?dt.oc:dt.Hc,0!==dt.oc&&(lt+=dt.Wc()))}M=Math.max(e-ht,0);var pt=S=Math.max(i-lt,0),gt=M;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,Mt=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+Mt,k[yt.row]):null}var St,Nt=0,Pt=0;for(St in k)"count"!==St&&(Nt+=k[St]);for(St in w)"count"!==St&&(Pt+=w[St]);for(var Ct=At.alloc(),Tt=0;Tt<r;Tt++){var Lt=b[Tt];if(Lt.visible||Lt===E){var jt=t.Fb(Lt.row),Ft=t.Eb(Lt.column),Ot=0;isFinite(Ft.width)?Ot=Ft.width:(Ot=isFinite(M)&&null!==w[Lt.column]?0===Pt?Ft.actual+M:w[Lt.column]/Pt*gt:null!==w[Lt.column]?M:Ft.actual||M,Ot=Math.max(0,Ot-Ft.Wc()));var Dt=0;switch(isFinite(jt.height)?Dt=jt.height:(Dt=isFinite(S)&&null!==k[Lt.row]?0===Nt?jt.actual+S:k[Lt.row]/Nt*pt:null!==k[Lt.row]?S:jt.actual||S,Dt=Math.max(0,Dt-jt.Wc())),Ct.h(Math.max(Ft.minimum,Math.min(Ot,Ft.maximum)),Math.max(jt.minimum,Math.min(Dt,jt.maximum))),$=Ws(Lt,jt,Ft,!1)){case ps:Ct.height=Math.max(Ct.height,jt.actual+S);break;case gs:Ct.width=Math.max(Ct.width,Ft.actual+M)}var Bt=Lt.margin,It=Bt.right+Bt.left,zt=Bt.top+Bt.bottom;Lt.Uj(),Lt.measure(Ct.width,Ct.height,Ft.minimum,jt.minimum);var Et=Lt.measuredBounds,Rt=Math.max(Et.width+It,0),Vt=Math.max(Et.height+zt,0);isFinite(M)&&(Rt=Math.min(Rt,Ct.width)),isFinite(S)&&(Vt=Math.min(Vt,Ct.height));var Yt=0;Yt=jt.actual,jt.actual=Math.max(jt.actual,Vt),jt.oc=Math.max(jt.oc,Vt),z=jt.actual-Yt,S=Math.max(S-z,0),null===k[Lt.row]&&(pt=Math.max(pt-z,0)),Yt=Ft.actual,Ft.actual=Math.max(Ft.actual,Rt),Ft.oc=Math.max(Ft.oc,Rt),z=Ft.actual-Yt,M=Math.max(M-z,0),null===w[Lt.column]&&(gt=Math.max(gt-z,0))}}j(b);var Gt=At.alloc(),Xt=A(),Ut=A();if(0!==(r=x.length))for(var qt=0;qt<F;qt++)if(g[qt]){O=g[qt].length;var Kt=t.Fb(qt);Xt[qt]=Kt.actual;for(var Ht=0;Ht<O;Ht++)if(g[qt][Ht]){var Wt=t.Eb(Ht);Ut[Ht]=Wt.actual}}for(var Zt=0;Zt<r;Zt++){var Jt=x[Zt];if(Jt.visible||Jt===E){var $t=t.Fb(Jt.row),_t=t.Eb(Jt.column);switch(Ct.h(Math.max(_t.minimum,Math.min(e,_t.maximum)),Math.max($t.minimum,Math.min(i,$t.maximum))),$=Ws(Jt,$t,_t,!1)){case cs:0!==Ut[_t.index]&&(Ct.width=Math.min(Ct.width,Ut[_t.index])),0!==Xt[$t.index]&&(Ct.height=Math.min(Ct.height,Xt[$t.index]));break;case ps:0!==Ut[_t.index]&&(Ct.width=Math.min(Ct.width,Ut[_t.index]));break;case gs:0!==Xt[$t.index]&&(Ct.height=Math.min(Ct.height,Xt[$t.index]))}isFinite(_t.width)&&(Ct.width=_t.width),isFinite($t.height)&&(Ct.height=$t.height),Gt.h(0,0);for(var Qt=_t.minimum,te=$t.minimum,ee=1;ee<Jt.rowSpan&&!(Jt.row+ee>=t.rowCount);ee++)C=t.Fb(Jt.row+ee),z=0,z=$===cs||$===gs?Math.max(C.minimum,0===Xt[Jt.row+ee]?C.maximum:Math.min(Xt[Jt.row+ee],C.maximum)):Math.max(C.minimum,isNaN(C.Hc)?C.maximum:Math.min(C.Hc,C.maximum)),Gt.height+=z,te+=C.minimum;for(var ie=1;ie<Jt.columnSpan&&!(Jt.column+ie>=t.columnCount);ie++)C=t.Eb(Jt.column+ie),z=0,z=$===cs||$===ps?Math.max(C.minimum,0===Ut[Jt.column+ie]?C.maximum:Math.min(Ut[Jt.column+ie],C.maximum)):Math.max(C.minimum,isNaN(C.Hc)?C.maximum:Math.min(C.Hc,C.maximum)),Gt.width+=z,Qt+=C.minimum;Ct.width+=Gt.width,Ct.height+=Gt.height;var ne=Jt.margin,oe=ne.right+ne.left,re=ne.top+ne.bottom;Jt.measure(Ct.width,Ct.height,Qt,te);for(var se=Jt.measuredBounds,ae=Math.max(se.width+oe,0),he=Math.max(se.height+re,0),le=0,ue=0;ue<Jt.rowSpan&&!(Jt.row+ue>=t.rowCount);ue++)le+=(C=t.Fb(Jt.row+ue)).total||0;if(le<he){var ce=he-le,fe=he-le;if(null!==Jt.spanAllocation)for(var de=Jt.spanAllocation,pe=0;pe<Jt.rowSpan&&!(0>=ce)&&!(Jt.row+pe>=t.rowCount);pe++){var ge=(C=t.Fb(Jt.row+pe)).oa||0,me=de(Jt,C,fe);C.actual=Math.min(C.maximum,ge+me),C.oa!==ge&&(ce-=C.oa-ge)}for(;0<ce;){var ye=C.oa||0;if(isNaN(C.height)&&C.maximum>ye&&(C.actual=Math.min(C.maximum,ye+ce),C.oa!==ye&&(ce-=C.oa-ye)),0===C.index)break;C=t.Fb(C.index-1)}}for(var ve=0,xe=0;xe<Jt.columnSpan&&!(Jt.column+xe>=t.columnCount);xe++)ve+=(C=t.Eb(Jt.column+xe)).total||0;if(ve<ae){var be=ae-ve,we=ae-ve;if(null!==Jt.spanAllocation)for(var ke=Jt.spanAllocation,Me=0;Me<Jt.columnSpan&&!(0>=be)&&!(Jt.column+Me>=t.columnCount);Me++){var Se=(C=t.Eb(Jt.column+Me)).oa||0,Ne=ke(Jt,C,we);C.actual=Math.min(C.maximum,Se+Ne),C.oa!==Se&&(be-=C.oa-Se)}for(;0<be;){var Pe=C.oa||0;if(isNaN(C.width)&&C.maximum>Pe&&(C.actual=Math.min(C.maximum,Pe+be),C.oa!==Pe&&(be-=C.oa-Pe)),0===C.index)break;C=t.Eb(C.index-1)}}}}j(x),At.free(Gt),At.free(Ct),void 0!==Xt&&j(Xt),void 0!==Ut&&j(Ut);var Ce=0,Te=0,Le=t.desiredSize,Ae=t.maxSize;$=Hs(t,!0);var je=lt=ht=0,Fe=0;r=t.columnCount;for(var Oe=0;Oe<r;Oe++)void 0!==P[Oe]&&(C=t.Eb(Oe),isFinite(C.width)?(je+=C.width,je+=C.Wc()):ul(C)===fl?(je+=C.oa,je+=C.Wc()):0!==C.oa&&(ht+=C.oa,ht+=C.Wc()));Ce=isFinite(Le.width)?Math.min(Le.width,Ae.width):$!==fs&&isFinite(e)?e:ht,Ce=Math.max(Ce,t.minSize.width),Ce=Math.max(Ce-je,0);for(var De=0===ht?1:Math.max(Ce/ht,1),Be=0;Be<r;Be++)void 0!==P[Be]&&(C=t.Eb(Be),isFinite(C.width)||ul(C)===fl||(C.actual=C.oa*De),C.position=o.width,0!==C.oa&&(o.width+=C.oa,o.width+=C.Wc()));r=t.rowCount;for(var Ie=0;Ie<r;Ie++)void 0!==N[Ie]&&(C=t.Fb(Ie),isFinite(C.height)?(Fe+=C.height,Fe+=C.Wc()):ul(C)===fl?(Fe+=C.oa,Fe+=C.Wc()):0!==C.oa&&(lt+=C.oa,lt+=C.Wc()));Te=isFinite(Le.height)?Math.min(Le.height,Ae.height):$!==fs&&isFinite(i)?i:lt,Te=Math.max(Te,t.minSize.height),Te=Math.max(Te-Fe,0);for(var ze=0===lt?1:Math.max(Te/lt,1),Ee=0;Ee<r;Ee++)void 0!==N[Ee]&&(C=t.Fb(Ee),isFinite(C.height)||ul(C)===fl||(C.actual=C.oa*ze),C.position=o.height,0!==C.oa&&(o.height+=C.oa,o.height+=C.Wc()));r=a.length;for(var Re=0;Re<r;Re++){var Ve=a[Re],Ye=0,Ge=0;Ve.type===Ch.TableRow?(Ye=o.width,Ge=(C=t.Fb(Ve.row)).actual):(Ye=(C=t.Eb(Ve.column)).actual,Ge=o.height),Ve.measuredBounds.h(0,0,Ye,Ge),ia(Ve,!1)}j(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 f=c=0,d=Math.min(t.topIndex,l-1);if(0<h.length){for(;d!==l&&(void 0===h[d]||0===h[d].oa);)d++;c=-h[d=Math.max(Math.min(d,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++;f=-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 Ch&&v.visible&&Vh(v)){if(v.type===Ch.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,d))),a=x.position+f+r,0!==x.oa&&(a+=x.Io(Math.max(m,p))),x=v.measuredBounds,v.Uk(),v.actualBounds.ka();var b=v.actualBounds,w=Dt.allocAt(b.x,b.y,b.width,b.height);b.x=v.type===Ch.TableRow?r:a,b.y=v.type===Ch.TableColumn?o:h,b.width=x.width,b.height=x.height,v.actualBounds.freeze(),oa(v,!1),Et(w,b)||null===u||(u.oh(),v.Pn(u)),Dt.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,d))),b=0;b<u;b++)if(s[v][b]){a=(w=t.Eb(b)).position+f+r,0!==w.oa&&(a+=w.Io(Math.max(m,p)));for(var k=s[v][b],M=k.length,S=0;S<M;S++){var N=k[S],P=N.measuredBounds;y.h(0,0);for(var C=1;C<N.rowSpan&&!(v+C>=t.rowCount);C++){var T=t.Fb(v+C);0!==T.oa&&(y.height+=T.total)}for(C=1;C<N.columnSpan&&!(b+C>=t.columnCount);C++)0!==(T=t.Eb(b+C)).oa&&(y.width+=T.total);var L=w.oa+y.width,A=x.oa+y.height;C=a,T=h;var j=L,F=A,O=a,D=h,B=L,I=A;a+L>i.width&&(B=Math.max(i.width-a,0)),h+A>i.height&&(I=Math.max(i.height-h,0));var z=N.alignment;if(z.Xb()){(z=t.defaultAlignment).sb()||(z=oe);var E=z.x,R=z.y,V=z.offsetX;z=z.offsetY;var Y=w.alignment,G=x.alignment;Y.sb()&&(E=Y.x,V=Y.offsetX),G.sb()&&(R=G.y,z=G.offsetY)}else E=z.x,R=z.y,V=z.offsetX,z=z.offsetY;(isNaN(E)||isNaN(R))&&(R=E=.5,z=V=0),Y=P.width,G=P.height;var X=N.margin,U=X.left+X.right,q=X.top+X.bottom,K=Ws(N,x,w,!1);!isNaN(N.desiredSize.width)||K!==cs&&K!==ps||(Y=Math.max(L-U,0)),!isNaN(N.desiredSize.height)||K!==cs&&K!==gs||(G=Math.max(A-q,0)),L=N.maxSize,A=N.minSize,Y=Math.min(L.width,Y),G=Math.min(L.height,G),Y=Math.max(A.width,Y),L=(G=Math.max(A.height,G))+q,C+=j*E-(Y+U)*E+V+X.left,T+=F*R-L*R+z+X.top,N.visible&&(Xt(O,D,B,I,C,T,P.width,P.height)?N.arrange(C,T,Y,G):N.arrange(C,T,Y,G,new Dt(O,D,B,I)))}}for(At.free(y),t=0;t<n;t++)null!==(r=(i=e[t])instanceof Ch?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 f=Math.max(e-l,0),d=Math.max(i-h,0),p=1;t.viewboxStretch===ds?0!==c&&0!==a&&(p=Math.min(f/c,d/a)):0!==c&&0!==a&&(p=Math.max(f/c,d/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,f=c.x;c=c.y,e.save(),e.beginPath(),e.rect(0,0,a,h),e.clip(),e.Se();for(var d=[],p=t.O.s,g=p.length,m=0;m<g;m++){var y=p[m],v=[];if(d.push(v),y.visible){var x=y.interval;if(!(0>x)){y=Fh(y.figure);for(var b=0;b<g;b++)if(b!==m){var w=p[b];w.visible&&Fh(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=d[m];var M=!1,S=k.strokeDashArray;if(null!==S&&(M=!0,e.js(S,k.strokeDashOffset)),"LineV"===k.figure&&null!==k.stroke&&0<k.strokeWidth){for(e.lineWidth=k.strokeWidth,Us(t,e,k.stroke,!1,!1,r,s),e.beginPath(),S=k=Math.floor((f-o)/o);S<=k+l;S++){var N=S*o+f;0<=N&&N<=a&&Mh(S,v,x,w)&&(e.moveTo(N,0),e.lineTo(N,h))}e.stroke(),e.Se()}else if("LineH"===k.figure&&null!==k.stroke&&0<k.strokeWidth){for(e.lineWidth=k.strokeWidth,Us(t,e,k.stroke,!1,!1,r,s),e.beginPath(),S=k=Math.floor((c-n)/n);S<=k+u;S++)0<=(N=S*n+c)&&N<=h&&Mh(S,v,x,w)&&(e.moveTo(0,N),e.lineTo(a,N));e.stroke(),e.Se()}else if("BarV"===k.figure&&null!==k.fill)for(Us(t,e,k.fill,!0,!1,r,s),k=k.width,isNaN(k)&&(k=o),N=S=Math.floor((f-o)/o);N<=S+l;N++){var P=N*o+f;0<=P+k&&P<=a&&Mh(N,v,x,w)&&e.fillRect(P,0,k,h)}else if("BarH"===k.figure&&null!==k.fill)for(Us(t,e,k.fill,!0,!1,r,s),k=k.height,isNaN(k)&&(k=n),N=S=Math.floor((c-n)/n);N<=S+u;N++)0<=(P=N*n+c)+k&&P<=h&&Mh(N,v,x,w)&&e.fillRect(0,P,a,k);M&&e.fs(),1!==y&&(e.globalAlpha=b)}}e.restore(),e.Vc(!1)},c(Sh,ch),Sh.prototype.measure=function(t,e,i,n,o){var r=n.length;if(t instanceof Hu||t instanceof wc){var s=null,a=null;if(t instanceof wc&&(s=t),t instanceof Hu&&(s=(a=t).adornedPart,null===t.j&&(t.j=[])),s instanceof wc){var h=s;if(0===r)Bt(t.naturalBounds,0,0),t.measuredBounds.h(0,0,0,0);else{var l=t instanceof Hu?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 f=e.height,d=t.j;if(d.length=0,null!==l){Nh(t,a,f,l);var p=l.measuredBounds;i.ed(p),d.push(p)}p=Ye.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){Nh(t,a,f,v);var x=v.measuredBounds;i.ed(x),d.push(x)}else if(2>c)v.measure(1/0,1/0,0,0),x=v.measuredBounds,i.ed(x),d.push(x);else{var b=v.segmentIndex,w=v.segmentFraction,k=v.alignmentFocus;k.Mc()&&(k=oe);var M=v.segmentOrientation,S=v.segmentOffset;if(isNaN(b)){var N=h.ua;x=A(),N.Qu(w,x);var P=pt.allocAt(x[0],x[1]);if(P.add(h.i(0)),N.type===Ue.j?P.offset(-N.startX,-N.startY):null!==(N=N.figures.first())&&P.offset(-N.startX,-N.startY),N=x[2],M!==Wc){var C=h.computeAngle(v,M,N);v.Kb=C}C=P.x-e.x;var T=P.y-e.y;pt.free(P),j(x)}else if(b<-c||b>=c)x=pt.alloc(),h.vg(),h.computeMidPoint(x),N=h.midAngle,M!==Wc&&(C=h.computeAngle(v,M,N),v.Kb=C),C=x.x-e.x,T=x.y-e.y,pt.free(x);else{if(C=0,0<=b?(T=u.M(b),x=b<c-1?u.M(b+1):T):(C=c+b,T=u.M(C),x=0<C?u.M(C-1):T),T.Xa(x)){0<=b?(N=0<b?u.M(b-1):T,C=b<c-2?u.M(b+2):x):(N=C<c-1?u.M(C+1):T,C=1<C?u.M(C-2):x),P=N.Bf(T);var L=x.Bf(C);N=P>L+10?0<=b?N.ab(T):T.ab(N):L>P+10?0<=b?x.ab(C):C.ab(x):0<=b?N.ab(C):C.ab(N)}else N=0<=b?T.ab(x):x.ab(T);M!==Wc&&(C=h.computeAngle(v,M,N),v.Kb=C),C=T.x+(x.x-T.x)*w-e.x,T=T.y+(x.y-T.y)*w-e.y}v.measure(1/0,1/0,0,0),x=v.measuredBounds,P=v.naturalBounds;var F=0;v instanceof pl&&(F=v.strokeWidth),L=P.width+F;var O=P.height+F;p.reset(),p.translate(-x.x,-x.y),p.scale(v.scale,v.scale),p.rotate(M===Wc?v.angle:N,L/2,O/2),M!==nf&&M!==af||p.rotate(90,L/2,O/2),M!==of&&M!==hf||p.rotate(-90,L/2,O/2),M===lf&&(45<N&&135>N||225<N&&315>N)&&p.rotate(-N,L/2,O/2),P=new Dt(0,0,L,O),g.xi(P,k),p.Ga(g),k=-g.x+F/2*v.scale,v=-g.y+F/2*v.scale,m.assign(S),F=isNaN(S.x);var D=isNaN(S.y);if(F||D){L=L/2+3,O=O/2+3;var B=45<=N&&135>=N,I=225<=N&&315>=N;M===Wc&&(B||I)?(m.x=D?L:S.y,m.y=F?O:S.x,B?0<=b||isNaN(b)&&.5>w||!F||(m.y=-O):I&&((0<=b||isNaN(b)&&.5>w)&&F&&(m.y=-O),D&&(m.x=-L))):(F&&(m.x=0<=b||isNaN(b)&&.5>w?L:-L),D&&(m.y=-O),m.rotate(N))}else m.rotate(N);C+=m.x,T+=m.y,P.set(x),P.h(C+k,T+v,x.width,x.height),d.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),Bt(o,i.width||0,i.height||0),Ye.free(p),pt.free(g),pt.free(m)}}}},Sh.prototype.arrange=function(t,e){var i=e.length;if(t instanceof Hu||t instanceof wc){var n=t,o=null;t instanceof Hu&&(n=(o=t).adornedPart);var r=t instanceof Hu?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 f=s.alignmentFocus;if(l=s.segmentOrientation,u=s.segmentOffset,isNaN(a)){var d=c.ua,p=A();d.Qu(h,p);var g=pt.allocAt(p[0],p[1]);g.add(c.i(0)),d.type===Ue.j||(d=d.figures.first()),g.offset(-d.startX,-d.startY),d=p[2],l!==Wc&&(c=c.computeAngle(s,l,d),s.angle=c),c=g.x;var m=g.y;pt.free(g),j(p)}else if(a<-i||a>=i)m=p=pt.alloc(),(d=c).vg(),d.computeMidPoint(m),d=c.midAngle,l!==Wc&&(c=c.computeAngle(s,l,d),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?(d=0<a?e.s[a-1]:p,g=a<i-2?e.s[a+2]:m):(d=g<i-1?e.s[g+1]:p,g=1<g?e.s[g-2]:m);var y=d.Bf(p),v=m.Bf(g);d=y>v+10?0<=a?d.ab(p):p.ab(d):v>y+10?0<=a?m.ab(g):g.ab(m):0<=a?d.ab(g):g.ab(d)}else d=0<=a?p.ab(m):m.ab(p);l!==Wc&&(c=c.computeAngle(s,l,d),s.angle=c),c=p.x+(m.x-p.x)*h,m=p.y+(m.y-p.y)*h}if(f.ys())s.location=new pt(c,m);else{f.Mc()&&(f=oe),(p=Ye.alloc()).reset(),p.scale(s.scale,s.scale),p.rotate(s.angle,0,0);var x=s.naturalBounds;g=Dt.allocAt(0,0,x.width,x.height),(y=pt.alloc()).xi(g,f),p.Ga(y),f=-y.x,v=-y.y;var b=x.width,w=x.height;(x=pt.alloc()).assign(u);var k=isNaN(u.x),M=isNaN(u.y);if(k||M){b=b/2+3,w=w/2+3;var S=45<=d&&135>=d,N=225<=d&&315>=d;l===Wc&&(S||N)?(x.x=M?b:u.y,x.y=k?w:u.x,S?0<=a||isNaN(a)&&.5>h||!k||(x.y=-w):N&&((0<=a||isNaN(a)&&.5>h)&&k&&(x.y=-w),M&&(x.x=-b))):(k&&(x.x=0<=a||isNaN(a)&&.5>h?b:-b),M&&(x.y=-w),x.rotate(d))}else x.rotate(d);c+=x.x,m+=x.y,p.pp(g),f+=g.x,v+=g.y,a=pt.allocAt(c+f,m+v),s.move(a),pt.free(a),pt.free(x),pt.free(y),Dt.free(g),Ye.free(p)}}null!==o?o.Ul(!1):n.Ul(!1),n=Tu(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,f=new Dt(-h.left,-h.top,Math.max(c.width+l,0),Math.max(c.height+u,0));t.graduatedBounds.push(f),o.assign(f);for(var d=a.geometry,p=a.strokeWidth,g=d.flattenedSegments,m=d.flattenedLengths,y=d.flattenedTotalLength,v=g.length,x=0,b=0,w=A(),k=0;k<v;k++){var M=g[k],S=[];b=x=0;for(var N=M.length,P=0;P<N;P+=2){var C=M[P],T=M[P+1];if(0!==P){var L=180*Math.atan2(T-b,C-x)/Math.PI;0>L&&(L+=360),S.push(L)}x=C,b=T}w.push(S)}if(null===t.graduatedIntervals){for(var F=[],O=t.O.s,D=O.length,B=0;B<D;B++){var I=O[B],z=[];if(F.push(z),I.visible){var E=I.interval;if(!(0>E))for(var R=0;R<D;R++)if(R!==B){var V=O[R];if(V.visible&&I.constructor===V.constructor){var Y=V.interval;Y>E&&z.push(Y)}}}}t.graduatedIntervals=F}var G=t.graduatedIntervals,X=t.O.s,U=X.length,q=0,K=0,H=y;t.graduatedMarks=[];for(var W,Z=0;Z<U;Z++){var J=X[Z];if(W=[],J.visible&&J!==a){var $=Math.abs(J.interval),_=t.graduatedTickUnit;if(!(2>_*$*y/t.graduatedRange&&null===J.graduatedSkip)){var Q=m[0][0],tt=0,et=0;K=y*J.graduatedStart-1e-4,H=y*J.graduatedEnd+1e-4;var it=_*$,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=G[Z],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),ft=1e-6*t.graduatedTickUnit;if(ct<ft&&ct>-ft){var dt=!1;break t}}dt=!0}if(dt&&(nt>t.graduatedMax&&(nt=t.graduatedMax),null===J.graduatedSkip||J instanceof Pl&&!J.graduatedSkip(nt,J)||J instanceof pl&&!J.graduatedSkip(nt,J))&&((q=(nt-t.graduatedMin)*y/t.graduatedRange)>y&&(q=y),K<=q&&q<=H)){for(var gt=w[tt][et],mt=m[tt][et];tt<m.length;){for(;q>Q&&et<m[tt].length-1;)et++,gt=w[tt][et],Q+=mt=m[tt][et];if(q<=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=(q-(Q-mt))/mt,wt=new pt(vt+(yt[2*et+2]-vt)*bt+p/2-d.bounds.x,xt+(yt[2*et+3]-xt)*bt+p/2-d.bounds.y);wt.scale(a.scale,a.scale);t:{var kt=gt,Mt=w[tt];if(!(.5005>bt&&.4995<bt)){var St=kt;if(.5>bt?0<et?St=Mt[et-1]:Xe.$(yt[0],yt[yt.length-2])&&Xe.$(yt[1],yt[yt.length-1])&&(St=Mt[Mt.length-1]):.5<bt&&(et+1<Mt.length?St=Mt[et+1]:Xe.$(yt[0],yt[yt.length-2])&&Xe.$(yt[1],yt[yt.length-1])&&(St=Mt[0])),kt!==St){var Nt=Math.abs(kt-St);if(180<Nt&&(kt<St?kt+=360:St+=360,Nt=Math.abs(kt-St)),5e-4>bt||.9995<bt){gt=(kt+St)/2%360;break t}if(10>Nt){var Pt=1-Math.abs(.5-bt);gt=(kt*Pt+St*(1-Pt))%360;break t}}}gt=kt}if(J instanceof Pl){var Ct="";null!==J.graduatedFunction?Ct=null!=(Ct=J.graduatedFunction(nt,J))?Ct.toString():"":Ct=(+nt.toFixed(2)).toString(),""!==Ct&&W.push({$l:wt,angle:gt,text:Ct})}else W.push({$l:wt,angle:gt})}nt=st+ht*it}}}t.graduatedMarks.push(W)}j(w);var Tt=t.graduatedMarks;if(null!==Tt)for(var Lt=n.length,At=0;At<Lt;At++){var jt=n[At],Ft=Tt[At];if(jt.visible&&jt!==a&&0!==Ft.length){if(jt instanceof pl){var Ot=t,Bt=o,It=jt.alignmentFocus;It.Mc()&&(It=ee);var zt=jt.angle;jt.Kb=0,jt.measure(1/0,1/0,0,0),jt.Kb=zt;var Et=jt.measuredBounds,Rt=Et.width,Vt=Et.height,Yt=Dt.allocAt(0,0,Rt,Vt),Xt=pt.alloc();Xt.xi(Yt,It),Dt.free(Yt);for(var Ut=-Xt.x,qt=-Xt.y,Kt=new Dt,Ht=Ft.length,Wt=0;Wt<Ht;Wt++)for(var Zt=Ft[Wt],Jt=Zt.$l.x,$t=Zt.$l.y,_t=Zt.angle,Qt=0;4>Qt;Qt++){switch(Qt){case 0:Xt.h(Ut,qt);break;case 1:Xt.h(Ut+Rt,qt);break;case 2:Xt.h(Ut,qt+Vt);break;case 3:Xt.h(Ut+Rt,qt+Vt)}Xt.rotate(_t+jt.angle),Xt.offset(Jt,$t),0===Wt&&0===Qt?Kt.h(Xt.x,Xt.y,0,0):Kt.Ye(Xt),Xt.offset(-Jt,-$t),Xt.rotate(-_t-jt.angle)}pt.free(Xt),null!==Ot.graduatedBounds&&Ot.graduatedBounds.push(Kt),Gt(Bt,Kt.x,Kt.y,Kt.width,Kt.height)}else if(jt instanceof Pl){var te=t,ie=o;null===te.temporaryTextBlock&&(te.temporaryTextBlock=new Pl);var ne=te.temporaryTextBlock;Tl(ne,jt);var oe=jt.alignmentFocus;oe.Mc()&&(oe=ee);for(var re=jt.segmentOrientation,se=jt.segmentOffset,ae=new Dt,he=0,le=0,ue=0,ce=0,fe=0,de=Ft.length,pe=0;pe<de;pe++){var ge=Ft[pe];he=ge.$l.x,le=ge.$l.y,ue=ge.angle,fe=ce=jt.angle,re!==Wc&&(fe=re===ef||re===sf?ue+jt.angle:ue,ce=wc.computeAngle(re,fe)),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=Ye.alloc();be.reset(),be.translate(-me.x,-me.y),be.scale(ne.scale,ne.scale),be.rotate(fe,ve/2,xe/2),re!==nf&&re!==af||be.rotate(90,ve/2,xe/2),re!==of&&re!==hf||be.rotate(-90,ve/2,xe/2),re===lf&&(45<ue&&135>ue||225<ue&&315>ue)&&be.rotate(-ue,ve/2,xe/2);var we=Dt.allocAt(0,0,ve,xe),ke=pt.alloc();ke.xi(we,oe),be.Ga(ke);var Me=-ke.x,Se=-ke.y,Ne=pt.alloc();Ne.assign(se),isNaN(Ne.x)&&(Ne.x=ve/2+3),isNaN(Ne.y)&&(Ne.y=-(xe/2+3)),Ne.rotate(ue);var Pe=new Dt(he+=Ne.x+Me,le+=Ne.y+Se,me.width,me.height),Ce=new Dt(me.x,me.y,me.width,me.height),Te=new Dt(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=Ce,ge.naturalBounds=Te,0===pe?ae.assign(Pe):ae.ed(Pe),pt.free(Ne),pt.free(ke),Dt.free(we),Ye.free(be)}null!==te.graduatedBounds&&te.graduatedBounds.push(ae),Gt(ie,ae.x,ae.y,ae.width,ae.height)}ia(jt,!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 f=h[c],d=l[c],p=d.length;if(f.visible&&f!==r&&0!==d.length)if(f instanceof pl){if(!(2>t.graduatedTickUnit*f.interval*r.geometry.flattenedTotalLength/t.graduatedRange*s&&null===f.graduatedSkip)){var g=f.measuredBounds,m=f.strokeWidth*f.scale,y=f.alignmentFocus;y.Mc()&&(y=ee);for(var v=0;v<p;v++){var x=d[v].$l,b=d[v].angle,w=y,k=f.Ab;k.reset(),k.translate(x.x+a.x,x.y+a.y),k.rotate(b+f.angle,0,0),k.translate(-g.width*w.x+w.offsetX+m/2,-g.height*w.y+w.offsetY+m/2),k.scale(f.scale,f.scale),Qs(f,!1),f.wh.set(f.Ab),f.Kk=f.scale,ta(f,!1),f.gc(e,i),o&&(t.svg.appendChild(f.svg),f.svg=null),f.Ab.reset()}}}else if(f instanceof Pl)for(null===t.temporaryTextBlock&&(t.temporaryTextBlock=new Pl),Tl(g=t.temporaryTextBlock,f),m=0;m<p;m++)(y=d[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=f.part,g.Me=f.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(Ch,Os),Ch.prototype.cloneProtected=function(t){Os.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},Ch.prototype.Af=function(t){Os.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},Ch.prototype.copy=function(){var t=Os.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 Zu&&(r.Te=!0);var a=t.diagram;null!==a&&a.undoManager.isUndoingRedoing||r.cb(di,"elements",t,null,o,null,s)}}return t}return null},(e=Ch.prototype).toString=function(){return"Panel("+this.type.name+")#"+et(this)},e.Pn=function(t){Os.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===Ch.Grid)t.yc(),this.na.gc(this,t,e);else if(this.na===Ch.Graduated)t.yc(),this.na.gc(this,t,e);else{if(this.na===Ch.Table)if(t.yc(),t instanceof va){var i=t.yd;t.yd=Ta(t,"gojs-ts"),Th(this,t),t.nh.pop(),t.yd=i}else Th(this,t);(i=this.isClipping&&this.na===Ch.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(!Os.prototype.kk.call(this,t,e,i))return!1;if(this.type===Ch.Table)null!==(i=0!==(i=this.svg.getElementsByClassName("gojs-ts")).length?i[0]:null)&&(i.innerHTML=""),t.yd=i,Th(this,t),t.yd=null;else if(this.na===Ch.Grid||this.na===Ch.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 Os.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,f=a*(s.m21*s.dy-s.m22*s.dx),d=a*(s.m12*s.dx-s.m11*s.dy);if(null!==this.areaBackground)return s=this.actualBounds,Xe.Ff(s.left,s.top,s.right,s.bottom,t,e,i,n,o);if(null!==this.background)return r=t*h+e*u+f,a=t*l+e*c+d,t=i*h+n*u+f,h=i*l+n*c+d,o.h(0,0),i=this.naturalBounds,r=Xe.Ff(0,0,i.width,i.height,r,a,t,h,o),o.transform(s),r;r||(h=1,u=l=0,c=1,d=f=0),a=t*h+e*u+f,t=t*l+e*c+d,h=i*h+n*u+f,i=i*l+n*c+d,o.h(h,i),n=(h-a)*(h-a)+(i-t)*(i-t),l=!1,d=(c=this.O.s).length,u=pt.alloc(),f=null,e=1/0;var p=null,g=this.isClipping&&this.na===Ch.Spot;g&&(p=pt.alloc(),(l=(f=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<d;m++){var y=c[m];y.visible&&y!==f&&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();Os.prototype.Gj.call(this)},e.v=function(t){if(!ea(this)){Os.prototype.v.call(this,t),t=null,this.na!==Ch.Auto&&this.na!==Ch.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=Hs(o,!1);(o instanceof bc||o instanceof Ch||o instanceof Pl||r!==fs)&&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),Bt(o,t=Math.max(i,t),h=Math.max(n,h)),Bt(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=Hs(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=fs),t){case fs:(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=Oh(this);if(Xt(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 Ch)for(var i=(t=t.O.s).length,n=0;n<i;n++)this.qm(t[n],e)},e.Nl=function(t){return Eh(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=Zh(this));for(var n=0;n<i;n++){var o=e[n];if(o instanceof Ch){var r=o.fb(t);if(null!==r)return r}if(o.name===t)return o}return null},e.se=function(){return!(this.type===Ch.TableRow||this.type===Ch.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),Xt(-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===Ch.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=Oh(this);u--;){var f=o[u];if((f.visible||f===c)&&(f.se()?vt(a.set(t),f.transform):a.set(t),!h||f!==l)){var d=null;if(f instanceof Ch?d=f.ic(a,e,i):!0===f.pickable&&f.ca(a)&&(d=f),null!==d&&(null!==e&&(d=e(d)),null!==d&&(null===i||i(d))))return pt.free(a),r||pt.free(s),d}}pt.free(a)}return null===this.background&&null===this.areaBackground?(r||pt.free(s),null):(t=Xt(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=Xt(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=Oh(this);h--;){var c=a[h];if(c.visible||c===u){c.se()?vt(l.set(t),c.transform):l.set(t);var f=c;(null!==(c=c instanceof Ch?c:null)?c.ji(l,e,i,n):f.ca(l))&&!1!==f.pickable&&(null!==e&&(f=e(f)),null===f||null!==i&&!i(f)||n.add(f))}}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=Ye.alloc()).reset(),s.multiply(this.transform),this.fh(t,s))return Yh(this,e,i,o),void 0===r&&Ye.free(s),!0;if(this.Yc(t,s)){if(!this.isAtomic)for(var a=Oh(this),h=this.O.s,l=h.length;l--;){var u=h[l];if(u.visible||u===a){var c=u.actualBounds,f=this.naturalBounds;c.x>f.width||c.y>f.height||0>c.x+c.width||0>c.y+c.height||(c=u,u=u instanceof Ch?u:null,(f=Ye.alloc()).set(s),(null!==u?u.Cf(t,e,i,n,o,f):Is(c,t,n,f))&&(null!==e&&(c=e(c)),null===c||null!==i&&!i(c)||o.add(c)),Ye.free(f))}}return void 0===r&&Ye.free(s),n}return void 0===r&&Ye.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=Oh(this);for(var f=this.O.s,d=f.length;d--;){var p=f[d];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 Ch?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!==Ch.Grid||e instanceof pl||w("Can only add Shapes to a Grid Panel, not: "+e),this.na!==Ch.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 dt),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 Ch&&!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 Zu&&(i.Te=!0),i.Te&&i instanceof Zu&&(i.wc=null),null!==(o=this.diagram)&&o.undoManager.isUndoingRedoing||(-1!==n&&i.cb(pi,"elements",this,e,null,n,null),i.cb(di,"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 Zu&&(n instanceof Ch?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&&M(t,">= 0",Ch,"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(di,"rowdefs",this,null,i,null,t)}return e[t]},e.oA=function(t){if(0>t&&M(t,">= 0",Ch,"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&&M(t,">= 0",Ch,"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(di,"coldefs",this,null,i,null,t)}return e[t]},e.jA=function(t){if(0>t&&M(t,">= 0",Ch,"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!==Ch.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!==Ch.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!==Ch.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!==Ch.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 Ih(e,(function(t){t instanceof Ch&&(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&&Wh(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 Ch))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=Zh(this);this.O.length>t;)this.pc(this.O.length-1,!1);Jh(this,this.itemArray)},f.Object.defineProperties(Ch.prototype,{type:{get:function(){return this.na},set:function(t){var e=this.na;e!==t&&(this.na=t,this.isAtomic=this.na===Ch.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&&M(t,">= 0",Ch,"padding"),t=new Wt(t)):(0>t.left&&M(t.left,">= 0",Ch,"padding:value.left"),0>t.right&&M(t.right,">= 0",Ch,"padding:value.right"),0>t.top&&M(t.top,">= 0",Ch,"padding:value.top"),0>t.bottom&&M(t.bottom,">= 0",Ch,"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:$t},set:function(t){"number"==typeof t&&(t=new Wt(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 Ia)&&(t instanceof Ia&&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 Ia)&&(t instanceof Ia&&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),$s(this)&&(null!==(t=this.part)&&Bs(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),$s(this)&&(null!==(t=this.part)&&Bs(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:dl},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:dl},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 Hu);Wh(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 fa),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 Ch&&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 Ch)||r.data!==e[s])return!0;o++,s++}return!1}(this,t)){var i=this.diagram;e!==t&&(null!==i&&null!==e&&rd(i.partManager,this,i),this.Hh=t,null!==i&&null!==t&&od(i.partManager,this)),this.g("itemArray",e,t),null!==i&&i.undoManager.isUndoingRedoing||Jh(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 dt}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(););Ds(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&&(Ds(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))}}}),f.Object.defineProperties(Ch,{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")}}}),Ch.prototype.rebuildItemElements=Ch.prototype.mv,Ch.prototype.findItemPanelForData=Ch.prototype.sx,Ch.prototype.updateTargetBindings=Ch.prototype.La,Ch.prototype.copyTemplate=Ch.prototype.Uy,Ch.prototype.graduatedValueForPoint=Ch.prototype.Gz,Ch.prototype.graduatedPointForValue=Ch.prototype.Fz,Ch.prototype.findColumnForLocalX=Ch.prototype.fz,Ch.prototype.findRowForLocalY=Ch.prototype.nz,Ch.prototype.addColumnDefinition=Ch.prototype.By,Ch.prototype.addRowDefinition=Ch.prototype.Hy,Ch.prototype.addRowColumnDefinition=Ch.prototype.Gy,Ch.prototype.removeColumnDefinition=Ch.prototype.jA,Ch.prototype.getColumnDefinition=Ch.prototype.Eb,Ch.prototype.removeRowDefinition=Ch.prototype.oA,Ch.prototype.getRowDefinition=Ch.prototype.Fb,Ch.prototype.removeAt=Ch.prototype.mb,Ch.prototype.remove=Ch.prototype.remove,Ch.prototype.insertAt=Ch.prototype.Gb,Ch.prototype.elt=Ch.prototype.M,Ch.prototype.add=Ch.prototype.add,Ch.prototype.findObject=Ch.prototype.fb,Ch.prototype.findInVisualTree=Ch.prototype.Nl,Ch.prototype.walkVisualTreeFrom=Ch.prototype.qm,Ch.prototype.findMainElement=Ch.prototype.Pb;var nl=!1,ol=null,rl=new dt;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=dl,this.hb=this.Hb=0,this.Qp=$t,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=Se,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=C(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}Ch.className="Panel",Ch.definePanelLayout=il,il("Position",new fh),il("Vertical",new ph),il("Auto",new yh),il("Link",new Sh),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=C(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===Ch.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(fi,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 Gd(t,e,i,n):t).xd=this,null!==(t=this.panel)&&(null!==(e=t.ih())&&Hh(e)&&w("Cannot add a Binding to a RowColumnDefinition that is already frozen: "+o+" on "+t)),null===this.be&&(this.be=new J),this.be.add(o),this},f.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&&M(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&&M(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))&&M(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&&M(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 Wt(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&&Wa(t,"RowColumnDefinition.separatorStroke"),t instanceof Ia&&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&&Wa(t,"RowColumnDefinition.background"),t instanceof Ia&&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),fl=new V(hl,"None",1),dl=new V(hl,"ProportionalExtra",2);function pl(t,e){Os.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 Nl: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,f,d=i[0],p=i[1],g=0,m=A(),y=2;y<o;y+=2)0===(l=(a=i[y])-d)&&(l=.001),u=(d=(h=i[y+1])-p)/l,c=Math.atan2(d,l),f=Math.sqrt(l*l+d*d),m.push([l,c,u,f]),g+=f,d=a,p=h;d=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=(f=m[y=0])[0],c=f[1],u=f[2],f=f[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 j(m);o>f?(v=o-f,o=f):v=0;var x=Math.sqrt(o*o/(1+u*u));if(0>l&&(x=-x),d+=x,p+=u*x,t.translate(d,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(-d,-p),g-=o,f-=o,0!==v){if(++y===m.length)return void j(m);l=(f=m[y])[0],c=f[1],u=f[2],f=f[3],o=v}}j(m)}}function yl(t){var e=t.geometryStretch;return null!==t.Rd?e===ms?cs:e:e===ms?Sl[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(Xe.$(t,i)&&Xe.$(e,n)||Xe.$(o,s)&&Xe.$(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||Xe.$(h.y,t))&&(h.y<e||Xe.$(h.y,e))&&(l=!0)):(e=t<i?t:i,t=t<i?i:t,(h.x>e||Xe.$(h.x,e))&&(h.x<t||Xe.$(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=ef,"None"!==t.toArrow?(t.segmentIndex=-1,t.alignmentFocus=je):"None"!==t.fromArrow&&(t.segmentIndex=0,t.alignmentFocus=new Ie(1-je.x,je.y)))}function kl(t){var e=Ml[t];if(void 0===e){var i=t.toLowerCase();if("none"===i)return"None";if(void 0===(e=Ml[i])){var n,o=null;for(n in Xe.um)if(n.toLowerCase()===i){o=n;break}if(null!==o)return t=Ue.parse(Xe.um[o],!1),Ml[o]=t,i!==o&&(Ml[i]=o),o}}return"string"==typeof e?e:e instanceof Ue?t:null}hl.className="RowColumnDefinition",hl.Default=cl,hl.None=fl,hl.ProportionalExtra=dl,c(pl,Os),pl.prototype.cloneProtected=function(t){Os.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=C(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(){Os.prototype.th.call(this),null!==this.Na&&(this.Na.nc=!0)},e.qb=function(t){t===fs||t===ds||t===ys||t===ms?this.geometryStretch=t:Os.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&&Us(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===Ch.Link&&a instanceof Hu&&"Selection"===a.category&&a.adornedObject instanceof pl&&a.adornedPart.Pb()===a.adornedObject?a.adornedObject.strokeWidth:0),0===h&&(i=null),null!==i&&0!==h&&(Us(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===Ue.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===Ue.u){var l=o.startX;h=o.startY;var u=o.endX,c=o.endY;o=Math.min(l,u);var f=Math.min(h,c);l=Math.abs(u-l),h=Math.abs(c-h),t.beginPath(),t.rect(o,f,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===Ue.F)l=o.startX,h=o.startY,u=o.endX,c=o.endY,o=Math.abs(u-l)/2,f=Math.abs(c-h)/2,l=Math.min(l,u)+o,h=Math.min(h,c)+f,t.beginPath(),t.moveTo(l,h-f),t.bezierCurveTo(l+Xe.wg*o,h-f,l+o,h-Xe.wg*f,l+o,h),t.bezierCurveTo(l+o,h+Xe.wg*f,l+Xe.wg*o,h+f,l,h+f),t.bezierCurveTo(l-Xe.wg*o,h+f,l-o,h+Xe.wg*f,l-o,h),t.bezierCurveTo(l-o,h-Xe.wg*f,l-Xe.wg*o,h-f,l,h-f),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===Ue.o)for(h=(o=o.figures).length,f=0;f<h;f++){l=o.s[f],t.beginPath(),t.moveTo(l.startX,l.startY),c=(u=l.segments.s).length;for(var d=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!==d?d.endX:l.startX,null!==d?d.endY:l.startY)}else if(0===(m=(d=ti(g,l)).length))t.lineTo(g.centerX,g.centerY);else for(var y=0;y<m;y++){var v=d[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!==d&&d.type===si){if(0===(v=(d=ti(d,l)).length)){t.lineTo(g.endX,g.endY);break}null!==(d=d[v-1]||null)&&(m=d[6],y=d[7])}else m=null!==d?d.endX:l.startX,y=null!==d?d.endY:l.startY;if(0===(m=(d=ei(g,l,m,y)).length)){t.lineTo(g.endX,g.endY);break}for(y=0;y<m;y++)v=d[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(),d=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(f)}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===Ue.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===Ue.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,f=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,f=o=p.endY;break;case ni:n.push(p.endX),n.push(p.endY),s=p.endX,o=p.endY;break;case oi:Xe.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:Xe.ep(s,o,p.point1X,p.point1Y,p.endX,p.endY,.5,n),s=p.endX,o=p.endY;break;case si:if(0===(d=(g=ti(p,a)).length)){n.push(p.centerX),n.push(p.centerY),s=p.centerX,o=p.centerY;break}for(m=0;m<d;m++)y=g[m],Xe.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===(d=(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<d;m++)y=g[m],Xe.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(f),ml(t,e,n,i))}ml(t,e,n,i)}else if(r.type===Ue.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===Ue.F){if((o=new _e).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++)f=r[h],Xe.Qe(s,o,f[2],f[3],f[4],f[5],f[6],f[7],.5,n),s=f[6],o=f[7];ml(t,e,n,i)}j(n),t.restore(),t.Vc(!1)}}}},e.kk=function(t,e,i){return!(!Os.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||Os.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 Ie){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 Dt);var e=this.naturalBounds,i=this.oe;e=Dt.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),Gt(t,n.x,n.y,0,0),n.h(e.right,e.bottom).transform(i),Gt(t,n.x,n.y,0,0),n.h(e.x,e.bottom).transform(i),Gt(t,n.x,n.y,0,0),Dt.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!==Ue.j||e||(o+=2);var r=Dt.alloc();if(r.assign(n),r.Bc(o+2,o+2),!r.ca(t))return Dt.free(r),!1;if(n=o+1e-4,i.type===Ue.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)&&(Dt.free(r),Xe.Yb(i.startX,i.startY,i.endX,i.endY,o,t.x,t.y)));if(i.type===Ue.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 Dt.free(r),!1;r.Bc(n,n)}return null!==this.stroke&&r.Bc(o,o),t=r.ca(t),Dt.free(r),t}if(i.type===Ue.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 Dt.free(r),!1;s+=n,o+=n}return null!==this.stroke&&(s+=n,o+=n),Dt.free(r),!(0>=s||0>=o)&&1>=i*i/(s*s)+e*e/(o*o)}if(i.type===Ue.o)return Dt.free(r),null===this.fill?Ze(i,t.x,t.y,o):He(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=Sl[a];if(void 0===h){var l=Xe.Ze[a];"string"==typeof l&&(l=Xe.Ze[l]),"function"==typeof l?(h=l(null,100,100),Sl[a]=h):w("Unsupported Figure: "+a)}s=h.bounds}a=s.width,h=s.height,l=s.width;var u=s.height;switch(Hs(this,!0)){case fs: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,f=this.minSize;switch(i=Math.max(i-r,f.width),n=Math.max(n-r,f.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 fs:break;case cs:a=l,h=u;break;case ds: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&&Xe.$(this.ua.Sk,t-r)&&Xe.$(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(f.width,l),u=Math.max(f.height,u),this.dc.h(0,0,l,u)):this.dc.assign(s)},e.eh=function(t,e,i,n){zs(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),f=s*(r.m12*r.dx-r.m11*r.dy);r=t*a+e*l+c,s=t*h+e*u+f,a=i*a+n*l+c,h=i*h+n*u+f,c=this.ig/2,null===(l=this.ua)&&(this.measure(1/0,1/0),l=this.ua);var d=l.bounds;if(u=!1,l.type===Ue.j)if(1.5>=this.strokeWidth)u=Xe.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,Xe.Ve(l.startX+n,l.startY+u,l.endX+n,l.endY+u,r,s,a,h,t)&&e.push(t),t=new pt,Xe.Ve(l.startX-n,l.startY-u,l.endX-n,l.endY-u,r,s,a,h,t)&&e.push(t),t=new pt,Xe.Ve(l.startX+n,l.startY+u,l.startX-n,l.startY-u,r,s,a,h,t)&&e.push(t),t=new pt,Xe.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 j(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);j(e)}else if(l.type===Ue.u)u=Xe.Ff(d.x-c,d.y-c,d.x+d.width+c,d.y+d.height+c,r,s,a,h,o);else if(l.type===Ue.F){t:if(0===(e=Dt.allocAt(d.x,d.y,d.width,d.height).Bc(c,c)).width)u=Xe.Ve(e.x,e.y,e.x,e.y+e.height,r,s,a,h,o);else if(0===e.height)u=Xe.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}Dt.free(e)}else if(l.type===Ue.o){f=pt.alloc();var p=a-r,g=h-s,m=p*p+g*g,y=r,v=s;if(0<m&&d.contains(y,v)&&(f.x=y,f.y=v,this.ca(f)))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;d.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,M=x.segments,S=d=x.startX,N=p=x.startY,P=0;P<M.count;P++){var C=M.s[P],T=C.type,L=C.endX,F=C.endY,O=!1;switch(T){case ii:S=L,N=F;break;case ni:O=xl(d,p,L,F,b,k,a,h,f);break;case oi:O=Xe.Eo(d,p,C.point1X,C.point1Y,C.point2X,C.point2Y,L,F,b,k,a,h,.6,f);break;case ri:O=Xe.Eo(d,p,d+2/3*(C.point1X-d),p+2/3*(C.point1Y-p),L+2/3*(C.point1X-L),F+2/3*(C.point1Y-F),L,F,b,k,a,h,.6,f);break;case si:case ai:var D=(T=C.type===si?ti(C,x):ei(C,x,d,p)).length;if(0===D){O=xl(d,p,C.type===si?C.centerX:C.endX,C.type===si?C.centerY:C.endY,b,k,a,h,f);break}for(F=null,L=0;L<D;L++){if(F=T[L],0===L&&xl(d,p,F[0],F[1],b,k,a,h,f)){var B=vl(b,k,f,m,o);B<m&&(m=B,u=!0)}Xe.Eo(F[0],F[1],F[2],F[3],F[4],F[5],F[6],F[7],b,k,a,h,.6,f)&&((B=vl(b,k,f,m,o))<m&&(m=B,u=!0))}L=F[6],F=F[7];break;default:w("Unknown Segment type: "+T)}d=L,p=F,O&&((O=vl(b,k,f,m,o))<m&&(m=O,u=!0)),C.isClosed&&(xl(d,p,L=S,F=N,b,k,a,h,f)&&((C=vl(b,k,f,m,o))<m&&(m=C,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(f)}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=Ye.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),Ye.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===Ue.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===Ue.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===Ue.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=Xe.$y(u,c,e,r))*t<=o)return!0}else if(e.type===Ue.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 f=A();if(Xe.Qe(s,u,c.point1X,c.point1Y,c.point2X,c.point2Y,c.endX,c.endY,.8,f),s=n(f,t),j(f),s)return!1;if(s=c.endX,u=c.endY,t.zd(s,u)>o)return!1;break;case ri:if(f=A(),Xe.ep(s,u,c.point1X,c.point1Y,c.endX,c.endY,.8,f),s=n(f,t),j(f),s)return!1;if(s=c.endX,u=c.endY,t.zd(s,u)>o)return!1;break;case si:case ai:var d=(f=c.type===si?ti(c,r):ei(c,r,s,u)).length;if(0===d){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<d;g++)if(c=f[g],p.length=0,Xe.Qe(c[0],c[1],c[2],c[3],c[4],c[5],c[6],c[7],.8,p),n(p,t))return j(p),!1;j(p),null!==c&&(s=c[6],u=c[7]);break;default:w("Unknown Segment type: "+c.type)}}return!0}if(null===this.fill?Ze(e,t.x,t.y,r):He(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=Ml[t.toArrow];else"None"!==t.fromArrow?n=Ml[t.fromArrow]:("string"==typeof(n=Xe.Ze[t.figure])&&(n=Xe.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=Xe.Ze.Rectangle;"function"==typeof o&&(n=o(t,e,i))}return n},f.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),$s(this)&&(null!==(t=this.part)&&Bs(this,t,"geometryString"))}}},geometryString:{get:function(){return null===this.geometry?"":this.geometry.toString()},set:function(t){var e=(t=Ue.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&&Wa(t,"Shape.fill"),t instanceof Ia&&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&&Wa(t,"Shape.stroke"),t instanceof Ia&&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 M(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?M(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?M(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=Xe.Ze[t];"function"==typeof i?i=t:(i=Xe.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 da),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 da),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:Se},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:Se},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 Ml=new X,Sl=new X;function Nl(){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=Se}function Pl(t,e){return Os.call(this),eu||(tu=Vr?new Fa(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 Cl(t){null===t.da?t.da=new iu:t.da.nc&&(t.da=t.da.copy())}function Tl(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===ql;o&&(e=e.trim());var r=0,s=t.Ae,a=t.spacingAbove+t.spacingBelow;a=Math.max(0,Ol(t)+a);var h=t.overflow===Ul?Dl(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=Fl(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=Fl((r=jl(t,s))+(e=jl(t,s=s.substr(r.length))));0<e.length&&l<=i;)l=(r+=e)+(e=jl(t,s=s.substr(e.length))),o&&(l=l.trim()),l=Fl(l);for(o&&(e=e.trim()),r+=e,i=Math.max(1,i-h);Fl(r)>i&&1<r.length;)r=r.substr(0,r.length-1);t.l|=16777216;var u=Fl(r+=_l);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=jl(t,s),s=s.substr(e.length);Fl(e)>i;){var c=1;for(l=Fl(e.substr(0,c)),u=0;l<=i;)c++,u=l,l=Fl(e.substr(0,c));if(1===c){var f=l;r=Math.max(r,l)}else f=u,r=Math.max(r,u);if(1>--c&&(c=1),Ll(t,e.substr(0,c),f),h++,e=e.substr(c),t.Gc+h>t.maxLines)break}for(l=Fl(e+(u=jl(t,s)));0<u.length&&l<=i;)l=(e+=u)+(u=jl(t,s=s.substr(u.length))),o&&(l=l.trim()),l=Fl(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=Fl(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 jl(t,e){if(t.wrap===Gl)return e.substr(0,1);for(var i=e.length,n=0,o=Hl;n<i&&!o.test(e.charAt(n));)n++;for(t.formatting===Kl&&(i=Math.min(i,n+1));n<i&&o.test(e.charAt(n));)n++;return n>=e.length?e:e.substr(0,n)}function Fl(t){return null===tu?8*t.length:tu.measureText(t).width}function Ol(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!==Wl[e]&&5e3>Zl?i=Wl[e]:(i=1.3*tu.measureText("M").width,Wl[e]=i,Zl++),t.df=i}function Dl(t){if(null===tu)return 6;if(void 0!==Jl[t]&&5e3>$l)var e=Jl[t];else e=tu.measureText(_l).width,Jl[t]=e,$l++;return e}function Bl(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,Ol(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 dt;for(t in Xe.Ze)t!==t.toLowerCase()&&e.add(t,Xe.Ze[t]);return e.freeze(),e},pl.defineFigureGenerator=function(t,e){var i=t.toLowerCase(),n=Xe.Ze;n[t]=e,n[i]=t},pl.getArrowheadGeometries=function(){var t=new dt;for(n in Xe.um)if(void 0===Ml[n]){var e=Ue.parse(Xe.um[n],!1);Ml[n]=e,(e=n.toLowerCase())!==n&&(Ml[e]=n)}for(var i in Ml)if(i!==i.toLowerCase()){var n=Ml[i];n instanceof Ue&&t.add(i,n)}return t.freeze(),t},pl.defineArrowheadGeometry=function(t,e){var i=null;i="string"==typeof e?Ue.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=Ml;n[t]=i,n[e]=t},Nl.prototype.copy=function(){var t=new Nl;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,Os),Pl.prototype.cloneProtected=function(t){Os.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(){Os.prototype.th.call(this),null!==this.da&&(this.da.nc=!0)},e.qb=function(t){t.classType===Pl?this.wrap=t:Os.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(){Os.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=Ol(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;Us(this,t,this.xc,!0,!1,i,n),(h||l)&&Us(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 f=e.scale;switch(8>(c*c+u*u)*f*f&&(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>(f=(e+s+c)*(u=this.Gc))&&(n=(n=this.verticalAlignment).y*r-n.y*f+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(f=0;f<u;f++){var d=this.Qc[f];d>o&&(d=o),n+=e,this.Oj(this.Qb[f],t,0,n,o,s,d,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!==zl?zl(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!==El?El(this,r):.8*r),o=i+c+s,a=n+a;var f=t;e.beginPath(),e.lineWidth=f,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(!Os.prototype.kk.call(this,t,e,i))return!1;if(Us(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++)Sa(t,e[i],!1)}else(e=this.svg).innerHTML=this.text,Sa(t,e,!0);return!0},e.nk=function(t){return!!(1<this.lineCount||this.isUnderline||this.isStrikethrough)||Os.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===ql&&(a=a.trim()),r=Math.max(r,Fl(a)),a=l+1}s=r}else 0<=(r=s.indexOf("\n",0))&&(s=s.substr(0,r)),s=Fl(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=Bl(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===Ul&&(e=this.Ae,e=this.overflow===Ul?Dl(e):0,l=this.spacingAbove+this.spacingBelow,l=Math.max(0,Ol(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);Fl(l)>e&&1<l.length;)l=l.substr(0,l.length-1);e=Fl(l+=_l),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),Bt(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){zs(this,t,e,i,n)},f.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||(Cl(this),this.da.Or=t,this.N(),this.g("textAlign",e,t))}},flip:{get:function(){return null!==this.da?this.da.Xf:fs},set:function(t){var e=this.flip;e!==t&&(Cl(this),this.da.Xf=t,this.N(),this.g("flip",e,t))}},verticalAlignment:{get:function(){return null!==this.da?this.da.Yr:Ce},set:function(t){var e=this.verticalAlignment;e.D(t)||(t=t.J(),Cl(this),this.da.Yr=t,Ks(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=Bl(this,e);var i=this.desiredSize;isNaN(i.width)||(e=i.width),isNaN(i.height)||(t=i.height),Bt(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:Yl},set:function(t){var e=this.wrap;e!==t&&(Cl(this),this.da.$r=t,this.v(),this.g("wrap",e,t))}},overflow:{get:function(){return null!==this.da?this.da.$q:Xl},set:function(t){var e=this.overflow;e!==t&&(Cl(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&&Wa(t,"TextBlock.stroke"),t instanceof Ia&&t.freeze(),this.xc=t,this.N(),this.g("stroke",e,t))}},lineCount:{get:function(){return this.Gc}},lineHeight:{get:function(){return Ol(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&&(Cl(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&&(Cl(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&&(Cl(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&&(Cl(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&&(Cl(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&&(Cl(this),this.da.Er=t,this.v(),this.g("spacingBelow",e,t))}},formatting:{get:function(){return null!==this.da?this.da.gq:ql},set:function(t){var e=this.formatting;e!==t&&(Cl(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))&&M(t,"> 0",Pl,"maxLines"),Cl(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 Il,zl=null,El=null,Rl=new V(Pl,"None",0),Vl=new V(Pl,"WrapFit",1),Yl=new V(Pl,"WrapDesiredSize",2),Gl=new V(Pl,"WrapBreakAll",3),Xl=new V(Pl,"OverflowClip",0),Ul=new V(Pl,"OverflowEllipsis",1),ql=new V(Pl,"FormatTrim",0),Kl=new V(Pl,"FormatNone",0),Hl=/[ \u200b\u00ad]/,Wl=new X,Zl=0,Jl=new X,$l=0,_l="...",Ql="",tu=null,eu=!1;function iu(){this.nc=!1,this.Hd=null,this.Xf=fs,this.gq=ql,this.Jq=1/0,this.$q=Xl,this.Er=this.Dr=0,this.Or="start",this.vj=this.Qr=this.Pr=null,this.Yr=Ce,this.$r=Yl}function nu(){this.Tk=1,this.u=0,this.j=1,this.o=this.F=null}function ou(t,e){Os.call(this),this.Eg=null,this.qo="",this.Xg=Kt,this.Nk=cs,this.Zg=this.Hd=null,this.Mk=oe,this.Xf=fs,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?Il[t]&&(delete Il[t],au--):(Il=new X,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);j(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 _l},Pl.setEllipsis=function(t){_l=t,Jl=new X,$l=0},Pl.getBaseline=function(){return zl},Pl.setBaseline=function(t){zl=t},Pl.getUnderline=function(){return El},Pl.setUnderline=function(t){El=t},Pl.isValidFont=function(t){if(eu||(tu=Vr?new Fa(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=Kl,Pl.FormatTrim=ql,Pl.None=Rl,Pl.OverflowClip=Xl,Pl.OverflowEllipsis=Ul,Pl.WrapBreakAll=Gl,Pl.WrapDesiredSize=Yl,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,Os),ou.prototype.cloneProtected=function(t){Os.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===fs||t===ds||t===ys?this.imageStretch=t:Os.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 Oa)){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,f=a,d=this.Nk,p=this.Mk;switch(d){case fs:if(this.sourceRect.w())break;c>=n.width&&(r=r+p.offsetX+(c*p.x-n.width*p.x)),f>=n.height&&(s=s+p.offsetY+(f*p.y-n.height*p.y)),h=Math.min(n.width,c),a=Math.min(n.height,f);break;case cs:c=n.width,f=n.height;break;case ds:case ys:d===ds?(c*=d=Math.min(n.height/f,n.width/c),f*=d):d===ys&&(f*=d=Math.max(n.height/f,n.width/c),(c*=d)>=n.width&&(r=(r+p.offsetX+(c*p.x-n.width*p.x)/c)*h),f>=n.height&&(s=(s+p.offsetY+(f*p.y-n.height*p.y)/f)*a),h*=1/(c/n.width),a*=1/(f/n.height),c=n.width,f=n.height)}var g=c*(d=this.Df()*e.scale)*f*d,m=h*a/g,y=i.__goCache;d=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++)d=o[u];if(!e.Xm){if(null===this.vl)if(null===this.Eg)this.vl=!1;else{o=new Fa(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=f<n.height?p.offsetY+(n.height*p.y-f*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,f)),t.scale(1,-1);break;case bs:t.translate(Math.min(n.width,c),Math.min(n.height,f)),t.scale(-1,-1)}if(t.yc(),e.Gf("pictureRatioOptimization")&&!e.$i&&void 0!==y&&null!==d&&1!==d.ratio){t.save(),e=d.ratio;try{t.drawImage(d.source,r/e,s/e,Math.min(d.source.width,h/e),Math.min(d.source.height,a/e),o,p,Math.min(n.width,c),Math.min(n.height,f)),t instanceof va&&(this.bt=[r/e,s/e,Math.min(d.source.width,h/e),Math.min(d.source.height,a/e),o,p,Math.min(n.width,c),Math.min(n.height,f)])}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,f)),t instanceof va&&(this.bt=[r,s,h,a,o,p,Math.min(n.width,c),Math.min(n.height,f)])}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,f));break;case bs:t.scale(-1,-1),t.translate(-Math.min(n.width,c),-Math.min(n.height,f))}}}}},ou.prototype.Wl=function(t,e,i,n){var o=this.desiredSize,r=Hs(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)),Bt(this.dc,t,e),this.Ge(0,0,t,e)},ou.prototype.eh=function(t,e,i,n){zs(this,t,e,i,n)},f.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 _),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=Il;if(Vr){var n=null;if(void 0!==i[t])n=i[t];else if(""!==t){30<au&&(ru(),i=Il),(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 Fa(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 fu(){this.os=new Ue,this.mc=null}function du(t,e,i,n,o,r){t.mc=new _e,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 fu).reset(t),e)}ou.className="Picture",Il=new X,ou.clearCache=ru,lu.className="PictureCacheArray",cu.className="PictureCacheInstance",fu.prototype.reset=function(t){null!==t?(t.ka(),this.os=t,t.figures.clear()):this.os=new Ue,this.mc=null},fu.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)},fu.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)},fu.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=Xe.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=Tt,this.ir=null,this.jr="",this.lr=Se,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?Ch.call(this,t):(Ch.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 Dt,this.Rh=null,this.ag=NaN,e&&Object.assign(this,e)}function Mu(t){null===t.P?t.P=new wu:t.P.nc&&(t.P=t.P.copy())}function Su(t){0!=(16384&t.G)!=!1&&(t.updateAdornments(),t.G&=-16385)}function Nu(t){if(!1===Iu(t)){zu(t,!0),t.Uk();var e=t.diagram;null!==e&&(e.De.add(t),e.$b())}}function Pu(t){if(t.G|=2097152,!1!==Iu(t)){var e=t.position,i=t.location;i.w()&&e.w()||ju(t,e,i),i=t.Ib;var n=Dt.alloc().assign(i);i.ka(),i.x=e.x,i.y=e.y,i.freeze(),t.Xl(n,i),Dt.free(n),zu(t,!1)}}function Cu(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 Tu(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 Hu||(e=e.animationManager).zb&&Zn(e,t,new pt(n,o),i)}function ju(t,e,i){var n=Tu(t),o=t.diagram,r=i.w(),s=e.w();r&&s?0!=(2097152&t.G)?Fu(t,e,i,o,n):Ou(t,e,i,o,n):r?Fu(t,e,i,o,n):s&&Ou(t,e,i,o,n),t.G|=2097152,pt.free(n),t.Uk()}function Fu(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 Hu||Zn(i,t,new pt(r,s),e),n||e.x===r&&e.y===s||t.g("position",new pt(r,s),e.copy()))}function Ou(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 Du(t,e,i){Eu(t,!1),t instanceof Zu&&Dr(i,t),t.layer.isTemporary||e||i.Ya(),e=t.Ib;var n=i.viewportBounds;n.w()?Ru(t)?(Yt(e,n)||t.Fd(!1),t.updateAdornments()):t.isVisible()&&e.Yc(n)?(t.Fd(!0),t.updateAdornments()):t.Wb():i.vd=!0}function Bu(t,e,i,n){e.constructor===t.constructor||Ku||(Ku=!0,S('Should not change the class of the Part when changing category from "'+i+'" to "'+n+'"'),S(" Old class: "+F(t.constructor)+", new class: "+F(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 Zu&&(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 Zu&&(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 Iu(t){return 0!=(32768&t.G)}function zu(t,e){t.G=e?32768|t.G:-32769&t.G}function Eu(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 Yu(t,e){var i=e.containingGroup;return null!==i?1+Yu(t,i):e instanceof Zu&&null!==(e=e.labeledLink)?Yu(t,e):0}function Gu(t,e){var i=e.containingGroup;return null!==i||e instanceof Zu&&null!==(i=e.labeledLink)?Gu(t,i):e}function Xu(t,e,i){if(e===i||null===i)return!1;var n=e.containingGroup;return!(null===n||n!==i&&!Xu(t,n,i))||e instanceof Zu&&null!==(e=e.labeledLink)&&Xu(t,e,i)}function Uu(t){return!!t.isVisible()&&(null===(t=t.layer)||!t.isTemporary)}function qu(t,e,i,n,o,r){if(void 0===r&&(r=null),!(t.contains(e)||null!==r&&!r(e)||e instanceof Hu))if(t.add(e),e instanceof Zu){if(i&&e instanceof gc)for(var s=e.memberParts;s.next();)qu(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)&&qu(t,a,i,n,o,r)}}if(1<n)for(e=e.Ou();e.next();)qu(t,e.value,i,n-1,o,r)}else if(e instanceof wc)for(e=e.labelNodes;e.next();)qu(t,e.value,i,n,o,r)}fu.className="StreamGeometryContext",bu("Rectangle",(function(t,e,i){t="r"+e+","+i;var n=Xe.Mf[t];return void 0!==n||((n=new Ue(Ue.u)).endX=e,n.endY=i,Xe.Nf<Xe.vm&&(Xe.Mf[t]=n,Xe.Nf++)),n})),bu("Square",(function(t,e,i){t="s"+e+","+i;var n=Xe.Mf[t];return void 0!==n||((n=new Ue(Ue.u)).endX=e,n.endY=i,n.defaultStretch=ds,Xe.Nf<Xe.vm&&(Xe.Mf[t]=n,Xe.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=Xe.Mf[n];if(void 0!==o)return o;var r=t*Xe.wg;return o=(new Ue).add(new _e(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 Ie(0,0,r,r),o.spot2=new Ie(1,1,-r,-r)),Xe.Nf<Xe.vm&&(Xe.Mf[n]=o,Xe.Nf++),o})),bu("Border","RoundedRectangle"),bu("Ellipse",(function(t,e,i){t="e"+e+","+i;var n=Xe.Mf[t];return void 0!==n||((n=new Ue(Ue.F)).endX=e,n.endY=i,n.spot1=Oe,n.spot2=De,Xe.Nf<Xe.vm&&(Xe.Mf[t]=n,Xe.Nf++)),n})),bu("Circle",(function(t,e,i){t="c"+e+","+i;var n=Xe.Mf[t];return void 0!==n||((n=new Ue(Ue.F)).endX=e,n.endY=i,n.spot1=Oe,n.spot2=De,n.defaultStretch=ds,Xe.Nf<Xe.vm&&(Xe.Mf[t]=n,Xe.Nf++)),n})),bu("TriangleRight",(function(t,e,i){return(new Ue).add(new _e(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 Ue).add(new _e(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 Ue).add(new _e(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 Ue).add(new _e(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 Ue).add(new _e(.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 Ue(Ue.j)).startX=0,t.startY=i/2,t.endX=e,t.endY=i/2,t})),bu("LineV",(function(t,e,i){return(t=new Ue(Ue.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 Ue).add(new _e(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 Ue).add(new _e(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 Ue).add(new _e(.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 Ue).add(new _e(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 Ue).add(new _e(.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 Ue).add(new _e(0,.75*i,!1).add(new Qe(ni,.5*e,.25*i)).add(new Qe(ni,e,.75*i)))})),Xe.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,Ch),ku.prototype.cloneProtected=function(t){Ch.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){Ch.prototype.Af.call(this,t),t.oh(),t.Ug=null,t.nf=null,t.Rh=null},e.toString=function(){var t=F(this.constructor)+"#"+et(this);return null!==this.data&&(t+="("+O(this.data)+")"),t},e.th=function(){Ch.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===di&&"elements"===e?o instanceof Ch?Dh(o,(function(t){od(a.partManager,t),xr(a,t)})):br(a,o):t===pi&&"elements"===e&&(o instanceof Ch?Dh(o,(function(t){rd(a.partManager,t,a)})):wr(a,o)),a.cb(t,e,i,n,o,r,s))},e.La=function(t){if(Ch.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 Ch&&Dh(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 dt),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]);j(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 Hu))break t;Wh(i),null!==(i=i.copy())&&(this.ph()&&this.selectionObject===this.path&&(i.type=Ch.Link),i.adornedObject=e)}if(null!==i){i.type===Ch.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 Ye);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 dt),null!==e.I(t))return e.I(t);var i=Ch.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 Dt),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=Dt.alloc();e.assign(t);var i=Ru(this);this.eh(0,0,this.uc.width,this.uc.height);var n=this.position;ju(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()||Xe.B(e.width,t.width)&&Xe.B(e.height,t.height)||0<=this.vw&&this.C(16),Dt.free(e),zu(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=Dt.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),Dt.free(o)}0!=(65536&this.G)!=!0&&t.D(e)||Du(this,n,i),i.N(),!t.w()&&!e.w()||Et(t,e)||(this instanceof Zu&&!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===Iu(this)&&!1===na(this)&&(Nu(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;Iu(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)}Nu(this)},e.Av=function(){this.G&=-2097153,Nu(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)&&!Iu(this)&&this.isVisible()&&this.Ib.w()&&t.N(Lu(this,this.Ib))},e.v=function(){Ch.prototype.v.call(this);var t=this.diagram;null!==t&&(t.De.add(this),this instanceof Zu&&null!==this.labeledLink&&Ks(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 Yu(this,this)},e.sz=function(){return Gu(this,this)},e.Td=function(t){return t instanceof gc&&Xu(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 Zu){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 Zu&&(null!==(t=e.labeledLink)&&(e=t)),e=e.containingGroup}for(e=this;null!==e;)e instanceof gc&&Vu(e,!1),e instanceof Zu&&(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 Zu&&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 Zu&&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())},f.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?K: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(di,"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&&(Mu(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&&Co(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 Hu&&this.type!==Ch.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(),Mu(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(),Mu(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&&(Mu(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(),Mu(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)&&(Nu(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 Hu)){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 Hu?this instanceof Hu&&(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))&&(Wh(i),null!==(i=i.copy())&&Bu(this,i,e,t))):(null!==r&&r.jm(n,t),null!==(i=ed(i.partManager,n,t))&&(Wh(i),null===(i=i.copy())||i instanceof wc||(n=this.location.copy(),Bu(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){Bu(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&&(Mu(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&&(Mu(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&&(Mu(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&&(Mu(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&&(Mu(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&&(Mu(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:Tt},set:function(t){var e=this.resizeCellSize;e.D(t)||(t=t.J(),Mu(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&&(Mu(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&&(Mu(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:Se},set:function(t){var e=this.rotationSpot;e.D(t)||(t=t.J(),Mu(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(qu(i=new _,this,!0,0,!0),i=i.iterator;i.next();)if((n=i.value)instanceof Zu)for(n=n.linksConnected;n.next();)kc(n.value);if(this instanceof Zu){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)&&Co(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&&(Mu(this),this.P.Kp=t,this.g("containingGroupChanged",e,t))}},isTopLevel:{get:function(){return!(null!==this.containingGroup||this instanceof Zu&&null!==this.labeledLink)}},layoutConditions:{get:function(){return null!==this.P?this.P.Cq:127},set:function(t){var e=this.layoutConditions;e!==t&&(Mu(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&&(Mu(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(),Mu(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&&(Mu(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&&(Mu(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 Ku=!1;function Hu(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 Wu(){this.nc=!1,this.Vr=this.gj=this.Eq=this.Dq=null,this.yp=_t,this.er=dc,this.Kr=this.ij=this.Nq=this.Mq=null}function Zu(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 J,this.wc=this.af=this.Yk=null,this.ci=!1,e&&Object.assign(this,e)}function Ju(t){null===t.Ba?t.Ba=new Wu:t.Ba.nc&&(t.Ba=t.Ba.copy())}function $u(t,e){null!==e&&(null===t.af&&(t.af=new _),t.af.add(e))}function _u(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 dt: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]);j(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(Hu,ku),Hu.prototype.toString=function(){var t=this.adornedPart;return"Adornment("+this.category+")"+(null!==t?t.toString():"")},Hu.prototype.updateRelationshipsFromData=function(){},Hu.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)}}},Hu.prototype.si=function(){var t=this.ue;return null===t||(null===(t=t.part)||!na(t))},Hu.prototype.Zc=function(){return!1},Hu.prototype.gk=function(t,e,i,n,o,r,s){if(t===di&&"elements"===e){if(o instanceof bc)null===this.$a&&(this.$a=o);else if(o instanceof Ch){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 Ch&&this.$a.rg(n))&&(this.$a=null);ku.prototype.gk.call(this,t,e,i,n,o,r,s)},Hu.prototype.updateAdornments=function(){},Hu.prototype.Lj=function(){},f.Object.defineProperties(Hu.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}}}),Hu.className="Adornment",Wu.prototype.copy=function(){var t=new Wu;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(Zu,ku),Zu.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=Zu.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=_u(this,t,e,i))&&t.Sl()},e.gk=function(t,e,i,n,o,r,s){(t===di&&"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},Zu.prototype.getAvoidableRect=function(t){return t.set(this.actualBounds),t.Co(this.avoidableMargin),t},Zu.prototype.findVisibleNode=function(){for(var t=this;null!==t&&!t.isVisible();)t=t.containingGroup;return t},Zu.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()},Zu.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)}},Zu.prototype.qx=function(){var t=new _,e=new _;return ec(this,this,t,e),e.iterator},Zu.prototype.findLinksConnected=function(t){if(void 0===t&&(t=null),null===t)return this.jb.iterator;var e=new W(this.jb),i=this;return e.predicate=function(e){return e.fromNode===i&&e.fromPortId===t||e.toNode===i&&e.toPortId===t},e},(e=Zu.prototype).Mo=function(t){void 0===t&&(t=null);var e=new W(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 W(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 _).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 _).add(i),e.add(o)):i=o)}return null!==e?e.iterator:null!==i?new H(i):K},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 _).add(i),e.add(o)):i=o)}return null!==e?e.iterator:null!==i?new H(i):K},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 _).add(i),e.add(o)):i=o)}return null!==e?e.iterator:null!==i?new H(i):K},e.jz=function(t,e,i){void 0===e&&(e=null),void 0===i&&(i=null);var n=new W(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 W(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},Zu.prototype.updateRelationshipsFromData=function(){var t=this.diagram;null!==t&&t.partManager.updateRelationshipsFromData(this)},(e=Zu.prototype).Vo=function(t){ku.prototype.Vo.call(this,t),t||(oc(this),null!==(t=this.Yk)&&Mc(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 Zu)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 _;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 W(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 J).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 J).add(i),e.add(t)):i=t);return null!==e?e.iterator:null!==i?new H(i):K},e.wz=function(t){void 0===t&&(t=1/0);var e=new _;return qu(e,this,!1,t,!0),e},Zu.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 _;i.add(this),lc(this,i,e.isTreePathToChildren,t,e,this,e.treeCollapsePolicy===ts),e.Ue=!1}},Zu.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 _;i.add(this),cc(this,i,e.isTreePathToChildren,t,e,this,e.treeCollapsePolicy===ts),e.Ue=!1}},f.Object.defineProperties(Zu.prototype,{portSpreading:{get:function(){return null!==this.Ba?this.Ba.er:dc},set:function(t){var e=this.portSpreading;e!==t&&(Ju(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&&Dr(i,this),this.g("avoidable",e,t)}}},avoidableMargin:{get:function(){return null!==this.Ba?this.Ba.yp:_t},set:function(t){"number"==typeof t&&(t=new Wt(t));var e=this.avoidableMargin;if(!e.D(t)){t=t.J(),Ju(this),this.Ba.yp=t;var i=this.diagram;null!==i&&Dr(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&&(Ju(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&&(Ju(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&&(Ju(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&&(Mc(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),Ks(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&&(Ju(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))}}}),Zu.prototype.expandTree=Zu.prototype.expandTree,Zu.prototype.collapseTree=Zu.prototype.collapseTree,Zu.prototype.findTreeParts=Zu.prototype.wz,Zu.prototype.findTreeChildrenNodes=Zu.prototype.Ou,Zu.prototype.findTreeChildrenLinks=Zu.prototype.Qo,Zu.prototype.findTreeLevel=Zu.prototype.uz,Zu.prototype.findTreeParentChain=Zu.prototype.vz,Zu.prototype.findTreeParentNode=Zu.prototype.pg,Zu.prototype.findTreeParentLink=Zu.prototype.kh,Zu.prototype.findCommonTreeParent=Zu.prototype.gz,Zu.prototype.findTreeRoot=Zu.prototype.xz,Zu.prototype.isInTreeOf=Zu.prototype.Nz,Zu.prototype.findPort=Zu.prototype.ns,Zu.prototype.findLinksTo=Zu.prototype.kz,Zu.prototype.findLinksBetween=Zu.prototype.jz,Zu.prototype.findNodesInto=Zu.prototype.Oo,Zu.prototype.findNodesOutOf=Zu.prototype.Po,Zu.prototype.findNodesConnected=Zu.prototype.Mu,Zu.prototype.findLinksInto=Zu.prototype.Sd,Zu.prototype.findLinksOutOf=Zu.prototype.Mo,Zu.prototype.findExternalTreeLinksConnected=Zu.prototype.qx,Zu.prototype.invalidateConnectedLinks=Zu.prototype.Bd,Zu.prototype.invalidateLinkBundle=Zu.prototype.Lz;var fc=new V(Zu,"SpreadingNone",10),dc=new V(Zu,"SpreadingEvenly",11),pc=new V(Zu,"SpreadingPacked",12);function gc(t,e){void 0===t||t instanceof ch||"string"==typeof t?Zu.call(this,t):(Zu.call(this),t&&(e=t)),this.U|=4608,this.Gn=new _,this.$a=null,this.Sc=new Ff,this.Sc.group=this,this.gl=new _,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 Zu)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 Zu)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){Os.call(this),this.yb=$t,this.ko=new Dt(NaN,NaN,NaN,NaN),t&&Object.assign(this,t)}function wc(t){ku.call(this,Ch.Link),this.Qa=8,this.ef=null,this.ff="",this.uf=this.gn=null,this.vf="",this.uo=null,this.qk=Wc,this.Om=0,this.Qm=Wc,this.Rm=NaN,this.qj=Uc,this.po=.5,this.wd=null,this.Nb=(new J).freeze(),this.Tg=this.Mg=null,this.ml=new Dt,this.ua=new Ue,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 Mc(t,e){null===t.wd&&(t.wd=new _),t.wd.add(e),t.v()}function Sc(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 J,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),Ks(t)),n?Nc(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 Nc(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),Ec(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 Cc(t,e){var i=e.Zn;return null===i&&((i=new Tf).port=e,i.node=e.part,e.Zn=i),Af(i,t)}function Tc(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=jr(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 jc(t,e,i,n,o,r,s){var a=e.Ho,h=e.Go,l=mf(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>Sf&&mf(e,u,c)!==l-1&&(mf(e,i-a,n)===l-1?(o=180,u=i-a,c=n):mf(e,i+a,n)===l-1?(o=0,u=i+a,c=n):mf(e,i,n-h)===l-1?(o=270,u=i,c=n-h):mf(e,i,n+h)===l-1&&(o=90,u=i,c=n+h));l>Sf&&mf(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>Sf&&(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>Sf&&(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),mf(e,s,u)===l-1?jc(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),mf(e,s,u)===l-1&&jc(t,e,s,u,r,!1,r))),t.yf(i,n)}function Fc(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),Xe.$(t,0)?e:Xe.$(e,0)?t:Math.sqrt(t*t+e*e)))}function Oc(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=Fc(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=Fc(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 Dc(t,e,i,n){for(var o=t.pointsCount,r=e;Xe.$(e.x,r.x)&&Xe.$(e.y,r.y);){if(i>=o)return o-1;r=t.i(i++)}if(!Xe.$(e.x,r.x)&&!Xe.$(e.y,r.y))return i-1;for(var s=r;Xe.$(e.x,r.x)&&Xe.$(r.x,s.x)&&(!n||(e.y>=r.y?r.y>=s.y:r.y<=s.y))||Xe.$(e.y,r.y)&&Xe.$(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 Bc(t,e,i,n,o,r,s){if(!s&&zc(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()&&zc(h)){var l=h.routeBounds;l.w()&&t.routeBounds.Yc(l)&&!t.usesSamePort(h)&&(null!==(l=h.path)&&l.Ed()&&Ic(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(Xe.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 f=c+i,d=Math.min(c+s,r.x);u<l&&(c=h[u])<d+s;)u++,d=Math.min(c+a,r.x);c=r.y-s+n,d+=i;var p=r.y+n;t.curve===Jc?du(e,d,p,!1):gu(e,f,c,d,c,d,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),f=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,d=r.y+n,t.curve===Jc?du(e,c,d,!1):gu(e,f,u,c,u,c,d)}else if(Xe.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),f=c+n,c=Math.min(c+s,r.y);u<l&&(d=h[u])<c+s;)u++,c=Math.min(d+a,r.y);d=r.x-s+i,p=r.x+i,c+=n,t.curve===Jc?du(e,p,c,!1):gu(e,d,f,d,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),f=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,d=r.x+i,u+=n,t.curve===Jc?du(e,d,u,!1):gu(e,c,f,c,u,d,u)}}e.lineTo(r.x+i,r.y+n)}function Ic(t,e,i,n){for(var o=Xe.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,f=e.x,d=e.y,p=s.x;s=s.y;var g=l.x,m=l.y;if(Xe.B(u,f)){if(!Xe.B(c,d)&&Xe.B(s,m)&&Math.min(c,d)<s&&Math.max(c,d)>s&&Math.min(p,g)<u&&Math.max(p,g)>u&&!Xe.B(p,g)){a.x=u,a.y=s,u=!0;break t}}else if(Xe.B(c,d)&&Xe.B(p,g)&&Math.min(u,f)<p&&Math.max(u,f)>p&&Math.min(s,m)<c&&Math.max(s,m)>c&&!Xe.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 zc(t){return(t=t.curve)===$c||t===Jc}function Ec(t,e){(e||zc(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&&zc(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=_u(e,i,n,o))&&($u(e,r=new df(e,n,i,o)),$u(i,r)),r.links=t,e=0;e<t.length;e++)t[e].Sf=r;r.Sl()}}}}function Yc(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()))}Zu.className="Node",Zu.SpreadingNone=fc,Zu.SpreadingEvenly=dc,Zu.SpreadingPacked=pc,c(gc,Zu),gc.prototype.cloneProtected=function(t){Zu.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){Zu.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 Zu)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===di&&"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 Ch){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 Ch&&this.$a.rg(n))&&(this.$a=null);Zu.prototype.gk.call(this,t,e,i,n,o,r,s)},e.Xl=function(t,e){Zu.prototype.Xl.call(this,t,e),this.isClipping&&this.type!==Ch.Spot&&this.isSubGraphExpanded&&((t=this.resizeObject)instanceof Ch&&(t=t.Pb()),null===this.tb&&(this.tb=new Dt),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,Zu.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()})),Zu.prototype.Va.call(this)},e.si=function(){if(!Zu.prototype.si.call(this))return!1;for(var t=this.memberParts;t.next();){var e=t.value;if(e instanceof Zu){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)}Zu.prototype.Lj.call(this)},gc.prototype.canAddMembers=function(t){var e=this.diagram;if(null===e)return!1;for(e=e.commandHandler,t=Fs(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=Fs(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(Zu.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 _,n=e.iterator;n.next();){var o=n.value;if(o instanceof Zu)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 _,i=t.iterator;i.next();){var n=i.value;if(n instanceof Zu)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 _;return function t(e,i){null!==e&&(i.add(e),t(e.containingGroup,i))}(this,t),t},e.Rj=function(){var t=new _;return qu(t,this,!0,0,!0),t.remove(this),t},e.Zb=function(t){Zu.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(),Zu.prototype.move.call(this,t,e),t=new _,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 Zu&&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)}},f.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&&(Ju(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&&(Ju(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&&(Ju(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&&(Ju(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,Os),bc.prototype.cloneProtected=function(t){Os.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 Xt(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 Hu)||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(Bt(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!==Ch.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=Dt.allocAt(t.x,t.y,0,0)).Ye(r.ga(he,t)),l.Ye(r.ga(ie,t)),l.Ye(r.ga(se,t)),Bt(e,l.width+n||0,l.height+o||0),this.Ge(-i.left,-i.top,e.width,e.height),pt.free(t),Dt.free(l)):(Bt(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=Dt.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)),Dt.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},f.Object.defineProperties(bc.prototype,{padding:{get:function(){return this.yb},set:function(t){"number"==typeof t&&(t=new Wt(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===Zc||t===Jc||t===$c?this.curve=t:t===_c||t===Qc||t===tf?this.adjusting=t:t!==Uc&&t!==Wc&&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)||Iu(t))return!1}return null===(t=this.toNode)||(null!==(e=t.findVisibleNode())&&(t=e),!na(t)&&!Iu(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 Wc:t=0;break;case ef:t=e;break;case nf:t=e+90;break;case of:t=e-90;break;case rf:t=e+180;break;case sf:90<(t=Xe.bp(e))&&270>t&&(t-=180);break;case af:90<(t=Xe.bp(e+90))&&270>t&&(t-=180);break;case hf:90<(t=Xe.bp(e-90))&&270>t&&(t-=180);break;case lf:if(45<(t=Xe.bp(e))&&135>t||225<t&&315>t)return 0;90<t&&270>t&&(t-=180)}return Xe.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),zc(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),zc(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)}Yc(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)),Sc(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()===Zc))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()===Zc){if(3===e){i=this.i(0),n=this.i(1);var o=this.i(2);return Xe.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),Xe.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()===Zc))return this.ua.wx(.5);if(this.computeCurve()===Zc&&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),Xe.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),Nc(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?(Gc||((Gc=new Zu).desiredSize=kt,Gc.Va()),this.defaultFromPoint&&(Gc.location=this.defaultFromPoint,Gc.Va(),e=t=Gc)):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?(Xc||((Xc=new Zu).desiredSize=kt,Xc.Va()),this.defaultToPoint&&(Xc.location=this.defaultToPoint,Xc.Va(),o=n=Xc)):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=Tc(s),h=Tc(i),l=e===o&&null!==e,u=this.isOrthogonal,c=this.curve===Zc;this.Wf=!(!l||u)&&(c=!0);var f=this.computeAdjusting()===Wc||l;if(!u&&!l&&a&&h){if(a=!1,!f&&3<=r&&(f=this.getLinkPoint(t,e,s,!0,!1,n,o),h=this.getLinkPoint(n,o,i,!1,!1,t,e),a=this.adjustPoints(0,f,r-1,h))&&(f=this.getLinkPoint(t,e,s,!0,!1,n,o),h=this.getLinkPoint(n,o,i,!1,!1,t,e),this.adjustPoints(0,f,r-1,h)),!a)if(this.Fj(),c){r=this.getLinkPoint(t,e,s,!0,!1,n,o),a=(f=this.getLinkPoint(n,o,i,!1,!1,t,e)).x-r.x,h=f.y-r.y,l=this.computeCurviness(),c=u=0;var d=r.x+a/3,p=r.y+h/3,g=d,m=p;Xe.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+d)-d)+p);var y=d=r.x+2*a/3,v=p=r.y+2*h/3;Xe.B(h,0)?v=0<a?v-l:v+l:v=u*((y=(0>h?-1:1)*c+d)-d)+p,this.Fj(),this.ne(r),this.yf(g,m),this.yf(y,v),this.ne(f),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,f=o,n=this.getLinkPoint(t,e,s,!0,!1,r,f),o=this.getLinkPoint(r,f,i,!1,!1,t,e),this.hasCurviness()?(f=o.x-n.x,i=o.y-n.y,s=this.computeCurviness(),r=t=n.x+f/2,a=e=n.y+i/2,Xe.B(i,0)?a=0<f?a-s:a+s:(f=-f/i,r=Math.sqrt(s*s/(f*f+1)),0>s&&(r=-r),a=f*((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=Dt.alloc(),e.mi(a),h=a.ca(o),f.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=f.ga(Lc(i),new pt),this.dd(1,this.getLinkPointFromPoint(r,f,i,n,!1,i))),Dt.free(a))}else{c=this.isAvoiding,f&&(u&&c||l)&&this.Fj();var x=l?this.computeCurviness():0;c=this.getLinkPoint(t,e,s,!0,u,n,o),d=g=p=0,(u||!a||l)&&(m=this.computeEndSegmentLength(t,e,s,!0),d=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)&&(d-=u?90:30,0>x&&(d-=180)),0>d?d+=360:360<=d&&(d-=360),l&&(m+=Math.abs(x)*(u?1:2)),0===d?p=m:90===d?g=m:180===d?p=-m:270===d?g=-m:(p=m*Math.cos(d*Math.PI/180),g=m*Math.sin(d*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)),!f&&!u&&a&&3<r&&this.adjustPoints(0,c,r-2,s)?this.dd(r-1,m):!f&&!u&&h&&3<r&&this.adjustPoints(1,i,r-1,m)?this.dd(0,c):!f&&(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,d,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()&&!Tc(i))return e.ga(i,a),a;if(i.$c()){var h=Cc(this,e);if(null!==h){if(a.assign(h.Zo),o&&this.routing===Hc){var l=Cc(this,s);if(null!==l&&h.Gl<l.Gl){h=pt.alloc(),l=pt.alloc();var u=new Dt(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(fe))&&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=Cc(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)),Tc(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=Cc(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===Se?Qt:e):null===(t=e||this.toPort)?t=oe:((e=this.toSpot).Xb()&&(e=t.toSpot),t=e===Se?Qt:e),t},wc.prototype.computeOtherPoint=function(t,e){return this.computeAdjusting()!==Wc&&4<this.pointsCount?this.computeMidPoint(new pt):null!==(t=null!==(t=e.Zn)?Af(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=Ye.alloc()).reset(),s.multiply(this.transform),this.fh(t,s))return Yh(this,e,i,o),void 0===r&&Ye.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,f=this.naturalBounds;if(!(c.x>f.width||c.y>f.height||0>c.x+c.width||0>c.y+c.height)){if((c=Ye.alloc()).set(s),u instanceof Ch)a=u.Cf(t,e,i,n,o,c);else if(this.path===u){if(u instanceof pl)if(a=t,f=n,!1===u.pickable)a=!1;else if(c.multiply(u.transform),f)t:{var d=a,p=c;if(u.fh(d,p))a=!0;else{if(void 0===p&&(p=u.transform,d.Re(u.actualBounds))){a=!0;break t}a=d.left,f=d.right;var g=d.top;d=d.bottom;var m=pt.alloc(),y=pt.alloc(),v=pt.alloc(),x=Ye.alloc();x.set(p),x.bv(u.transform),x.Vj(),y.x=f,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=f,m.y=d,m.transform(x),bl(u,m,y,v)?p=!0:(y.x=a,y.y=d,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)))),Ye.free(x),pt.free(m),pt.free(y),pt.free(v),a=p}}else a=u.fh(a,c)}else a=Is(u,t,n,c);a&&(f=u,null!==e&&(f=e(u)),f&&(null===i||i(f))&&o.add(f)),Ye.free(c)}}}return void 0===r&&Ye.free(s),a||null!==this.background||null!==this.areaBackground}return void 0===r&&Ye.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?Zc:this.curve},wc.prototype.computeCorner=function(){if(this.curve===Zc)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=cf;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)===ef||n===sf||n===rf?t=Math.max(t,o):n===of||n===hf||n===nf||n===af?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===Zc&&(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()===Wc&&i.bb()}},wc.prototype.computeCurviness=function(){var t=this.curviness;if(isNaN(t)){t=uf;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),j(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===tf&&(o=_c)}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(!Xe.$(l,0)){if(Xe.$(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 f=n.y-c;for(h=Math.sqrt(a*a+f*f),Xe.$(a,0)?f=0>f?-Math.PI/2:Math.PI/2:(f=Math.atan(f/Math.abs(a)),0>a&&(f=Math.PI-f)),l=h/l,u=f-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),Xe.$(e,0)||(Xe.$(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 tf: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,f=n.y;var d=1;if(0!=h-a){var p=(f-u)/(h-a);d=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*(f-u),0!==p?(e=g+e/d,this.L(t,e,y-(e-g)/p)):this.L(t,g,y+e)}this.dd(i,n)}return!0;case _c: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,Xe.B(o.y,r.y)?Xe.B(r.x,s.x)?u=e.y:Xe.B(r.y,s.y)&&(a=e.x):Xe.B(o.x,r.x)&&(Xe.B(r.y,s.y)?a=e.x:Xe.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,f=u=r.y,Xe.B(o.y,r.y)?Xe.B(r.x,s.x)?u=n.y:Xe.B(r.y,s.y)&&(a=n.x):Xe.B(o.x,r.x)&&(Xe.B(r.y,s.y)?a=n.x:Xe.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,f),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(ff,ff),h.Bc(ff,ff),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 f=this.diagram;if(null===f||o===r||this.layer.isTemporary||!Ar(f)||a.ca(c)&&!r.Td(o)||h.ca(t)&&!o.Td(r))e=!1;else{var d=jr(f,!0,this.containingGroup,null);if(17!==this.segmentIndex&&d.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))&&d.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))&&d.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(f.isVirtualized){(f=d.bounds.copy()).Bc(-d.Ho,-d.Go);var g=pt.alloc();gf(d,t.x,t.y)||(Xe.Ff(f.x,f.y,f.x+f.width,f.y+f.height,t.x,t.y,l.x,l.y,g)?(i=t=g.copy(),e=g.ab(l)):Xe.Ff(f.x,f.y,f.x+f.width,f.y+f.height,l.x,l.y,u.x,u.y,g)?(i=t=g.copy(),e=g.ab(u)):Xe.Ff(f.x,f.y,f.x+f.width,f.y+f.height,u.x,u.y,c.x,c.y,g)&&(i=t=g.copy(),e=g.ab(c))),gf(d,c.x,c.y)||(Xe.Ff(f.x,f.y,f.x+f.width,f.y+f.height,c.x,c.y,u.x,u.y,g)?(p=c=g.copy(),n=u.ab(g)):Xe.Ff(f.x,f.y,f.x+f.width,f.y+f.height,u.x,u.y,l.x,l.y,g)?(p=c=g.copy(),n=l.ab(g)):Xe.Ff(f.x,f.y,f.x+f.width,f.y+f.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(d.Ho*d.Os,d.Go*d.Os),wf(d,t,e,c,n,a,!0),h=mf(d,c.x,c.y),!d.abort&&h>=Nf&&(yf(d),a.Bc(d.Ho*d.Hx,d.Go*d.Ix),wf(d,t,e,c,n,a,!1),h=mf(d,c.x,c.y)),!d.abort&&h<Nf&&mf(d,c.x,c.y)!==Mf?(jc(this,d,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?Xe.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)):Xe.B(a.y,s.y)?(Math.abs(t.y-a.y)<=d.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||(Xe.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)):Xe.B(a.x,s.x)?(Math.abs(t.x-a.x)<=d.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&&zc(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===Zc&&3<=e&&!Xe.$(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||zc(this)){if(t.type=Ue.o,a=vu(t),0!==this.computeShortLength(!0)&&(o=Oc(this,o,!0,r)),du(a,o.x,o.y,!1),s===Zc&&3<=e&&!Xe.$(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=Oc(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 f=s,d=l=this.i(c),p=this.i(Dc(this,l,c,!1));if(!(Xe.$(f.x,d.x)&&Xe.$(d.x,p.x)||Xe.$(f.y,d.y)&&Xe.$(d.y,p.y))){var g=u;isNaN(g)&&(g=this.smoothness/3);var m=f.x;f=f.y;var y=d.x;d=d.y;var v=p.x;p=p.y;var x=g*Fc(m,f,y,d);g*=Fc(y,d,v,p),Xe.$(f,d)&&Xe.$(y,v)&&(y>m?p>d?(r.x=y-x,r.y=d-x,o.x=y+g,o.y=d+g):(r.x=y-x,r.y=d+x,o.x=y+g,o.y=d-g):p>d?(r.x=y+x,r.y=d-x,o.x=y-g,o.y=d+g):(r.x=y+x,r.y=d+x,o.x=y-g,o.y=d-g)),Xe.$(m,y)&&Xe.$(d,p)&&(d>f?(v>y?(r.x=y-x,r.y=d-x,o.x=y+g):(r.x=y+x,r.y=d-x,o.x=y-g),o.y=d+g):(v>y?(r.x=y-x,r.y=d+x,o.x=y+g):(r.x=y+x,r.y=d+x,o.x=y-g),o.y=d-g)),(Xe.$(m,y)&&Xe.$(y,v)||Xe.$(f,d)&&Xe.$(d,p))&&(m=.5*(m+v),f=.5*(f+p),r.x=m,r.y=f,o.x=m,o.y=f),(1===c||2===c&&Xe.$(s.x,this.i(0).x)&&Xe.$(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=Oc(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=Oc(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=Dc(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),Bc(this,a,-n,-h,r,u=this.i(c++),i),r.assign(u)}else 0!==this.computeShortLength(!1)&&(u=Oc(this,u.copy(),!1,it)),Bc(this,a,-n,-h,r,u,i);break}if(l=Dc(this,u,c+1,c<e-3),c=-n,m=-h,f=u,y=this.i(l),g=i,Xe.B(r.y,f.y)&&Xe.B(f.x,y.x))if(p=Math.min(s,Math.abs(f.x-o.x)/2),p=x=Math.min(p,Math.abs(y.y-f.y)/2),Xe.B(p,0))Bc(this,a,c,m,r,f,g),r.assign(f);else{var b=f.x,w=f.y;d=b,v=w,b=f.x>r.x?f.x-p:f.x+p,v=y.y>f.y?f.y+x:f.y-x,Bc(this,a,c,m,r,y=pt.allocAt(b,w),g),pt.free(y),mu(a,f.x+c,f.y+m,d+c,v+m),r.h(d,v)}else Xe.B(r.x,f.x)&&Xe.B(f.y,y.y)?(p=Math.min(s,Math.abs(f.y-o.y)/2),p=x=Math.min(p,Math.abs(y.x-f.x)/2),Xe.B(x,0)?(Bc(this,a,c,m,r,f,g),r.assign(f)):(d=b=f.x,v=w=f.y,w=f.y>r.y?f.y-p:f.y+p,d=y.x>f.x?f.x+x:f.x-x,Bc(this,a,c,m,r,y=pt.allocAt(b,w),g),pt.free(y),mu(a,f.x+c,f.y+m,d+c,v+m),r.h(d,v))):(Bc(this,a,c,m,r,f,g),r.assign(f));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=Oc(this,o,!0,r)),0!==this.computeShortLength(!1)&&(a=Oc(this,a,!1,r)),t.type=Ue.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&&Ec(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?_c:this.qk},wc.prototype.ph=function(){return!0},f.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),Yc(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),Yc(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),Yc(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),Yc(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:Se},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&&M(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:Se},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&&M(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?K: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()===Zc&&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),Xe.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);Xe.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||Nc(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);Xe.$(n.x,o.x)?0>(n=o.y-n.y)&&(n=-n):Xe.$(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 J,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(!N(r)||"number"!=typeof r.x||isNaN(r.x)||"number"!=typeof r.y||isNaN(r.y)){n=!1;break}}if(n)for(i=new J,n=0;n<t.length;n++)o=t[n],i.add(new pt(o.x,o.y).freeze())}}else if(t instanceof J)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(),Nc(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||!Tc(this.computeSpot(!0))?1:0}},lastPickIndex:{get:function(){var t=this.pointsCount;return 0===t?0:2>=t?t-1:this.isOrthogonal||!Tc(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(),Ec(this,e===Jc||e===$c||t===Jc||t===$c),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(),Ec(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 Gc=null,Xc=null,Uc=new V(wc,"Normal",1),qc=new V(wc,"Orthogonal",2),Kc=new V(wc,"AvoidsNodes",6),Hc=new V(wc,"AvoidsNodesStraight",7),Wc=new V(wc,"None",0),Zc=new V(wc,"Bezier",9),Jc=new V(wc,"JumpGap",10),$c=new V(wc,"JumpOver",11),_c=new V(wc,"End",17),Qc=new V(wc,"Scale",18),tf=new V(wc,"Stretch",19),ef=new V(wc,"OrientAlong",21),nf=new V(wc,"OrientPlus90",22),of=new V(wc,"OrientMinus90",23),rf=new V(wc,"OrientOpposite",24),sf=new V(wc,"OrientUpright",25),af=new V(wc,"OrientPlus90Upright",26),hf=new V(wc,"OrientMinus90Upright",27),lf=new V(wc,"OrientUpright45",28),uf=16,cf=14,ff=8;function df(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 pf(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 gf(t,e,i){return t.Nd<=e&&e<=t.En&&t.Od<=i&&i<=t.Fn}function mf(t,e,i){return gf(t,e,i)?(e-=t.Nd,e/=t.rc,i-=t.Od,i/=t.sc,t.ac[0|e][0|i]):Pf}function yf(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]>=Sf&&(i[n]=Pf)}function vf(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>=Sf&&c<Nf)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)vf(t,e,i,1,!o,r,s,a,h),vf(t,e,i,-1,!o,r,s,a,h);else for(i+=n;i>l;i+=n)vf(t,e,i,1,!o,r,s,a,h),vf(t,e,i,-1,!o,r,s,a,h);else if(0<n)for(e+=n;e<l;e+=n)vf(t,e,i,1,!o,r,s,a,h),vf(t,e,i,-1,!o,r,s,a,h);else for(e+=n;e>l;e+=n)vf(t,e,i,1,!o,r,s,a,h),vf(t,e,i,-1,!o,r,s,a,h)}}function xf(t,e,i,n,o,r,s,a,h){e|=0,i|=0;var l=Mf,u=Sf;for(t.ac[e][i]=u;l===Mf&&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 bf(t,e,i,n,o,r,s,a,h){e|=0,i|=0;var l=Mf,u=Nf;for(t.ac[e][i]=u;l===Mf&&e>r&&e<s&&i>a&&i<h;)t.ac[e][i]=u,o?i+=n:e+=n,l=t.ac[e][i]}function wf(t,e,i,n,o,r,s){if(null!==t.ac){t.abort=!1;var a=e.x,h=e.y;if(gf(t,a,h)){a-=t.Nd,a/=t.rc,h-=t.Od,h/=t.sc;var l=n.x,u=n.y;if(gf(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 f=r.y+r.height;c-=t.Nd,c/=t.rc,n-=t.Od,n/=t.sc,e-=t.Nd,e/=t.rc,f-=t.Od,f/=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)),f=Math.min(t.ei,Math.max(0,0|f)),h|=0,l|=0,u|=0;var d=0===i||90===i?1:-1;if(i=90===i||270===i,(n=t.ac)[a|=0][h]===Mf?(xf(t,a,h,d,i,r,e,c,f),xf(t,a,h,1,!i,r,e,c,f),xf(t,a,h,-1,!i,r,e,c,f)):xf(t,a,h,d,i,a,h,a,h),n[l][u]===Mf?(bf(t,l,u,0===o||90===o?1:-1,90===o||270===o,r,e,c,f),bf(t,l,u,1,!(90===o||270===o),r,e,c,f),bf(t,l,u,-1,!(90===o||270===o),r,e,c,f)):bf(t,l,u,d,i,l,u,l,u),i=A(),s&&kf(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=Sf,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 vf(t,a,h,1,!1,r,e,c,f),vf(t,a,h,-1,!1,r,e,c,f),vf(t,a,h,1,!0,r,e,c,f),vf(t,a,h,-1,!0,r,e,c,f);j(i)}}}}function kf(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 f=a[u][c];if(0===f||f===Cf)break;h=u,l=c}for(;;){if(u=n,c=h,f=l,0===n?f<r?(u=90,f++):f>r&&(u=270,f--):90===n?c<o?(u=0,c++):c>o&&(u=180,c--):180===n?f<r?(u=90,f++):f>r&&(u=270,f--):c<o?(u=0,c++):c>o&&(u=180,c--),c=a[c][f],u!==n&&0!==c&&c!==Cf){if(s.push(h),s.push(l),kf(t,h,l,u,o,r,s))return!0;s.pop(),s.pop()}if(a[h][l]=Cf,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=Uc,wc.Orthogonal=qc,wc.AvoidsNodes=Kc,wc.AvoidsNodesStraight=Hc,wc.None=Wc,wc.Bezier=Zc,wc.JumpGap=Jc,wc.JumpOver=$c,wc.End=_c,wc.Scale=Qc,wc.Stretch=tf,wc.OrientAlong=ef,wc.OrientPlus90=nf,wc.OrientMinus90=of,wc.OrientOpposite=rf,wc.OrientUpright=sf,wc.OrientPlus90Upright=af,wc.OrientMinus90Upright=hf,wc.OrientUpright45=lf,wc.EndSegmentStep=8,wc.CurvinessStart=uf,wc.SpacingMin=cf,wc.OrthoShortCut=ff,df.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},df.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))}},df.className="LinkBundle",pf.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=Pf,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}},pf.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]===Mf)return!1}return!0},f.Object.defineProperties(pf.prototype,{bounds:{get:function(){return new Dt(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 Mf=0,Sf=1,Nf=999999,Pf=Nf+1,Cf=Nf+2;function Tf(){Q(this),this.port=this.node=null,this.pe=[],this.ap=!1}function Lf(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 Af(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=Dt.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 f=u.part;if(null!==f){var d=f.findVisibleNode();null!==d&&d!==f&&(u=(f=d).port),u=l.computeOtherPoint(f,u),f=a.ab(u),0>(f-=h)?f+=360:360<=f&&(f-=360),0===(c=Lf(o,c,f,l.isOrthogonal))?(c=4,180<f&&(f-=360)):90===c?(c=8,270<f&&(f-=360)):180===c?c=2:(c=1,90>f&&(f+=360)),void 0===(d=t.pe[r])?(d=new jf(l,f,c),t.pe[r]=d):(d.link=l,d.angle=f,d.Nc=c),d.hv.set(u),r++}}}}for(pt.free(a),t.pe.sort(Tf.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),d=f=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:f+=m;break;case 2:d+=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:f>Math.abs(g)?(v=Math.abs(g)/f,f=Math.abs(g)):v=1;break;case 2:d>Math.abs(x)?(v=Math.abs(x)/d,d=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+f/2-y-b/2;break;case 2:k.y=w.y+x/2+d/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 M=.5;n===dc&&(M=(b.Uo+1)/(b.Gl+1)),k.x=w.x+g*M,k.y=w.y+x*M}}}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,Dt.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 jf(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 Ff(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 Of(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 Zu?h.isLinkLabel||(h instanceof gc&&null===h.layout?Of(t,e,h.memberParts,!1,o,r,s,a):(Df(h),e.add(h))):s&&h instanceof wc?e.add(h):!a||!h.Zc()||h instanceof Zu||(Df(h),e.add(h)))}}function Df(t){var e=t.actualBounds;(0===e.width||0===e.height||isNaN(e.width)||isNaN(e.height))&&t.Va()}function Bf(t){Q(this),this.Sc=t,this.wf=new _,this.ye=new _,this.Es=new dt,this.zs=new dt}function If(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 zf(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 Ef(t,e){null!==e&&t.ye.remove(e)&&(null!==(e=e.link)&&t.zs.remove(e))}function Rf(t,e,i){if(null!==i&&i.network!==e){If(t,i),e.dh(i);for(var n=i.sourceEdges;n.next();){var o=n.value;o.network!==e&&(Ef(t,o),zf(e,o),Rf(t,e,o.fromVertex))}for(n=i.destinationEdges;n.next();)(i=n.value).network!==e&&(Ef(t,i),zf(e,i),Rf(t,e,i.toVertex))}}function Vf(t){Q(this),this.ob=t,this.j=new Dt(0,0,10,10).freeze(),this.o=new pt(5,5).freeze(),this.Sh=this.ub=null,this.tg=new J,this.mg=new J}function Yf(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 Gf(t){Q(this),this.nb=t,this.qd=this.kd=this.$k=this.ub=null}function Xf(t){Ff.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=Kf,this.Rb=Hf,this.nd=$f,this.hd=Uf,t&&Object.assign(this,t)}function Uf(t,e){return(t=t.text)<(e=e.text)?-1:t>e?1:0}pf.className="PositionArray",Tf.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},Tf.prototype.Sl=function(){this.pe.length=0},Tf.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},Tf.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)},Tf.className="Knot",jf.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()},jf.className="LinkInfo",Ff.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},Ff.prototype.copy=function(){var t=new this.constructor;return this.cloneProtected(t),t},Ff.prototype.qb=function(){},Ff.prototype.toString=function(){var t=F(this.constructor);return t+="(",null!==this.group&&(t+=" in "+this.group),null!==this.diagram&&(t+=" for "+this.diagram),t+")"},Ff.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())}}},Ff.prototype.createNetwork=function(){return new Bf(this)},Ff.prototype.makeNetwork=function(t){var e=this.createNetwork();return t instanceof To?(e.lg(t.nodes,!0),e.lg(t.links,!0)):t instanceof gc?e.lg(t.memberParts):e.lg(t.iterator),e},Ff.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")}},Ff.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()}},Ff.prototype.doLayout=function(t){var e=new _;t instanceof To?(Of(this,e,t.nodes,!0,this.rh,!0,!1,!0),Of(this,e,t.parts,!0,this.rh,!0,!1,!0)):t instanceof gc?Of(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},Ff.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;Df(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++}},Ff.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)&&(Df(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++}}},Ff.prototype.rh=function(t){return!(t.location.w()&&!(t instanceof gc&&t.rh))},Ff.prototype.ni=function(t,e){var i=this.boundsComputation;return null!==i?(e||(e=new Dt),i(t,this,e)):e?(e.set(t.actualBounds),e):t.actualBounds},Ff.prototype.ex=function(t){var e=new _;return t instanceof To?(Of(this,e,t.nodes,!0,null,!0,!0,!0),Of(this,e,t.links,!0,null,!0,!0,!0),Of(this,e,t.parts,!0,null,!0,!0,!0)):Of(this,e,t instanceof gc?t.memberParts:t.iterator,!1,null,!0,!0,!0),e},Ff.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},f.Object.defineProperties(Ff.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())}}}),Ff.prototype.collectParts=Ff.prototype.ex,Ff.prototype.getLayoutBounds=Ff.prototype.ni,Ff.prototype.invalidateLayout=Ff.prototype.C,Ff.className="Layout",Bf.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 _,this.ye=new _,this.Es=new dt,this.zs=new dt},Bf.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},Bf.prototype.createVertex=function(){return new Vf(this)},Bf.prototype.createEdge=function(){return new Gf(this)},Bf.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 Zu)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 Zu&&(!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))}}},Bf.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=Bf.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&&If(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){zf(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),Ef(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]);j(t)},Bf.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]);j(t),j(e)},Bf.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]);j(e)}(this),this.Ko()),t=new J;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),Rf(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},Bf.prototype.dz=function(){for(var t=new _,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},f.Object.defineProperties(Bf.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}}}),Bf.prototype.findAllParts=Bf.prototype.dz,Bf.prototype.splitIntoSubNetworks=Bf.prototype.Zx,Bf.prototype.deleteSelfEdges=Bf.prototype.Ko,Bf.prototype.reverseEdge=Bf.prototype.gm,Bf.prototype.linkVertexes=Bf.prototype.Zj,Bf.prototype.findEdge=Bf.prototype.Lo,Bf.prototype.deleteLink=Bf.prototype.Yy,Bf.prototype.deleteEdge=Bf.prototype.Mj,Bf.prototype.addLink=Bf.prototype.Dy,Bf.prototype.addEdge=Bf.prototype.Bo,Bf.prototype.findVertex=Bf.prototype.ki,Bf.prototype.deleteNode=Bf.prototype.Zy,Bf.prototype.deleteVertex=Bf.prototype.Iu,Bf.prototype.addNode=Bf.prototype.Bl,Bf.prototype.addVertex=Bf.prototype.dh,Bf.prototype.addParts=Bf.prototype.lg,Bf.className="LayoutNetwork",Vf.prototype.clear=function(){this.Sh=this.ub=null,this.tg=new J,this.mg=new J},Vf.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},Vf.prototype.commit=function(){var t=this.ub;if(null!==t){var e=this.bounds,i=t.bounds;N(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=Dt.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 Dt.free(i);Dt.free(i)}t.moveTo(e.x,e.y)}},Vf.prototype.Cl=function(t){null!==t&&(this.tg.contains(t)||this.tg.add(t))},Vf.prototype.Kl=function(t){null!==t&&this.tg.remove(t)},Vf.prototype.zl=function(t){null!==t&&(this.mg.contains(t)||this.mg.add(t))},Vf.prototype.Jl=function(t){null!==t&&this.mg.remove(t)},f.Object.defineProperties(Vf.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=Dt.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),Dt.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 _,e=this.sourceEdges;e.next();)t.add(e.value.fromVertex);return t.iterator}},destinationVertexes:{get:function(){for(var t=new _,e=this.destinationEdges;e.next();)t.add(e.value.toVertex);return t.iterator}},vertexes:{get:function(){for(var t=new _,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 J,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}}}),Vf.prototype.deleteDestinationEdge=Vf.prototype.Jl,Vf.prototype.addDestinationEdge=Vf.prototype.zl,Vf.prototype.deleteSourceEdge=Vf.prototype.Kl,Vf.prototype.addSourceEdge=Vf.prototype.Cl,Vf.className="LayoutVertex",Vf.standardComparer=Yf,Vf.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},Gf.prototype.clear=function(){this.qd=this.kd=this.$k=this.ub=null},Gf.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},Gf.prototype.gm=function(){var t=this.kd;this.kd=this.qd,this.qd=t},Gf.prototype.commit=function(){},Gf.prototype.Ax=function(t){return this.qd===t?this.kd:this.kd===t?this.qd:null},f.Object.defineProperties(Gf.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)}}}),Gf.prototype.getOtherVertex=Gf.prototype.Ax,Gf.className="LayoutEdge",c(Xf,Ff),Xf.prototype.cloneProtected=function(t){Ff.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},Xf.prototype.qb=function(t){t.classType===Xf?t===$f||t===_f||t===Zf||t===Jf?this.sorting=t:t===Hf||t===Wf?this.arrangement=t:t===Kf||t===qf?this.alignment=t:w("Unknown enum value: "+t):Ff.prototype.qb.call(this,t)},Xf.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 Jf:o.reverse();break;case $f:o.sort(this.comparer);break;case _f: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 qf:var a=e,h=i,l=Dt.alloc(),u=Math.max(this.cellSize.width,1);if(!isFinite(u))for(var c=u=0;c<o.length;c++){var f=this.ni(o[c],l);u=Math.max(u,f.width)}if(u=Math.max(u+a,1),c=Math.max(this.cellSize.height,1),!isFinite(c))for(f=c=0;f<o.length;f++){var d=this.ni(o[f],l);c=Math.max(c,d.height)}c=Math.max(c+h,1),f=this.arrangement;for(var p=d=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(f===Wf)var M=Math.abs(p-b.width);else M=p+b.width;if((0<r&&m>r-1||0<s&&0<m&&M-d>s)&&(n.push(new Dt(0,g,s+a,y)),m=0,p=d,g+=y,y=0),y=Math.max(y,k),f===Wf)b=-b.width;else b=0;if(x.moveTo(p+b,g),f===Wf)p-=w;else p+=w;m++}n.push(new Dt(0,g,s+a,y)),Dt.free(l);break;case Kf:for(h=s,u=r,c=e,f=i,s=Dt.alloc(),d=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=Cu(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)===Wf)l+=c;else g+=c;d=isFinite(d)?Math.max(d+c,1):Math.max(l+g,1);var S=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(),M=0;M<o.length;M++){var N=o[M],P=this.ni(N,s),C=Cu(N,N.locationObject,N.locationSpot,a);if(0<g)if(p===Wf)S=(S-y-(P.width-C.x))/d,S=(S=Xe.$(Math.round(S),S)?Math.round(S):Math.floor(S))*d+y;else S=(S-y+C.x)/d,S=(S=Xe.$(Math.round(S),S)?Math.round(S):Math.ceil(S))*d+y;else if(p===Wf)x=S+C.x+P.width;else x=S-C.x;if(p===Wf)var T=-(S+C.x)+x;else T=S+P.width-C.x-x;if(0<u&&g>u-1||0<h&&0<g&&T>h){for(n.push(new Dt(0,k?v-r:v,h+c,b+r+f)),S=0;S<g&&M!==g;S++){var L=Cu(T=o[M-g+S],T.locationObject,T.locationSpot,m);T.moveTo(T.position.x,T.position.y+r-L.y)}b+=f,v=k?v+b:v+(b+r),g=b=r=0,S=y,k=!1}if(S===y&&(l=p===Wf?Math.max(l,P.width-C.x):Math.min(l,-C.x)),r=Math.max(r,C.y),b=Math.max(b,P.height-C.y),isFinite(w)&&(b=Math.max(b,Math.max(P.height,w)-C.y)),k?N.moveTo(S-C.x,v-C.y):N.moveTo(S-C.x,v),p===Wf)S-=C.x+c;else S+=P.width-C.x+c;g++}if(n.push(new Dt(0,v,h+c,(k?b:b+r)+f)),o.length!==g)for(h=0;h<g;h++)c=Cu(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===Wf)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);Dt.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===Wf?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}},Xf.prototype.commitLayers=function(){},f.Object.defineProperties(Xf.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!==Kf&&t!==qf||(this.Jb=t,this.C())}},arrangement:{get:function(){return this.Rb},set:function(t){this.Rb===t||t!==Hf&&t!==Wf||(this.Rb=t,this.C())}},sorting:{get:function(){return this.nd},set:function(t){this.nd===t||t!==Zf&&t!==Jf&&t!==$f&&t!==_f||(this.nd=t,this.C())}},comparer:{get:function(){return this.hd},set:function(t){this.hd!==t&&(this.hd=t,this.C())}}});var qf=new V(Xf,"Position",0),Kf=new V(Xf,"Location",1),Hf=new V(Xf,"LeftToRight",2),Wf=new V(Xf,"RightToLeft",3),Zf=new V(Xf,"Forward",4),Jf=new V(Xf,"Reverse",5),$f=new V(Xf,"Ascending",6),_f=new V(Xf,"Descending",7);function Qf(){this.On=new _,this.Dn=new _,this.Pa=new _,this.cf=new dt,this.bf=new dt,this.aj=new dt,this.H=null,this.tp=!1}function td(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=ed(t,e,n);if(null!==o&&(Wh(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 ed(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(""))&&(hd||(hd=!0,S('No Group template found for category "'+i+'"'),S(" Using default group template")),e=t.ly)):null===(e=t.nodeTemplateMap.I(i))&&(null===(e=t.nodeTemplateMap.I(""))&&(ad||(ad=!0,S('No Node template found for category "'+i+'"'),S(" Using default node template")),e=t.ny)),e}function id(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&&!nd(t,o[s],a))return!1}}else if(!nd(t,o,r))return!1}return!0}function nd(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(N(e)&&N(i)){if(!id(t,e,i))return!1}else if(e!==i)return!1;return!0}function od(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 rd(t,e,i){Dh(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 sd(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 Zu){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=sd(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=sd(t,e.value,i,n,o))&&s instanceof Zu&&(s.labeledLink=r);return r}Xf.className="GridLayout",Xf.standardComparer=Uf,Xf.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},Xf.Position=qf,Xf.Location=Kf,Xf.LeftToRight=Hf,Xf.RightToLeft=Wf,Xf.Forward=Zf,Xf.Reverse=Jf,Xf.Ascending=$f,Xf.Descending=_f,(e=Qf.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 Zu){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 Hu||this.Pa.add(t);null===(e=t.data)||t instanceof Hu||(t instanceof wc?this.bf.add(e,t):this.cf.add(e,t))},e.pc=function(t){if(t.Ej(),t instanceof Zu){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 Hu||this.Pa.remove(t);null===(e=t.data)||t instanceof Hu||(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]);j(e),j(i),j(t)}},Qf.prototype.addAllModeledParts=function(){this.addModeledParts(this.diagram.model.nodeDataArray)},Qf.prototype.addModeledParts=function(t,e){var i=this,n=this.diagram.model;t.forEach((function(t){n.lb(t)&&td(i,t,!1)})),t.forEach((function(t){n.lb(t)&&i.resolveReferencesForData(t)})),!1!==e&&Sr(this.diagram,!1)},Qf.prototype.insertLink=function(){return null},Qf.prototype.resolveReferencesForData=function(){},Qf.prototype.Ro=function(t){return this.H.model.Ro(t)},Qf.prototype.getLinkCategoryForData=function(){return""},Qf.prototype.setLinkCategoryForData=function(){},Qf.prototype.setFromNodeForLink=function(){},Qf.prototype.setToNodeForLink=function(){},Qf.prototype.findLinkTemplateForCategory=function(t){var e=this.H,i=e.linkTemplateMap.I(t);return null===i&&(null===(i=e.linkTemplateMap.I(""))&&(ld||(ld=!0,S('No Link template found for category "'+t+'"'),S(" Using default link template")),i=e.my)),i},Qf.prototype.removeAllModeledParts=function(){this.Gs(this.diagram.model.nodeDataArray)},Qf.prototype.Gs=function(t){var e=this;t.forEach((function(t){e.ip(t)}))},Qf.prototype.ip=function(t){null!==(t=this.Lc(t))&&(ar(this.diagram,t,!1),this.unresolveReferencesForPart(t))},Qf.prototype.unresolveReferencesForPart=function(){},Qf.prototype.removeDataForLink=function(){},Qf.prototype.findPartForKey=function(t){return null==t?null:null!==(t=this.H.model.hc(t))?this.cf.I(t):null},Qf.prototype.Vb=function(t){return null==t||null===(t=this.H.model.hc(t))?null:(t=this.cf.I(t))instanceof Zu?t:null},Qf.prototype.findLinkForKey=function(){return null},(e=Qf.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 Zu?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 _;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(N(s)&&id(this,o,s)){e.add(n);break}}}return e.iterator},e.ls=function(t){for(var e=0;e<arguments.length;++e);e=new _;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(N(s)&&id(this,o,s)){e.add(n);break}}}return e.iterator},Qf.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===fi){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===di){var s=t.newValue;"nodeDataArray"===n&&N(s)&&td(this,s),e.isModified=!0}else if(i===pi){var a=t.oldValue;"nodeDataArray"===n&&N(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===fi){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===di||i===pi){var u=t.change===di,c=u?t.newParam:t.oldParam,f=u?t.newValue:t.oldValue,d=this.aj.I(t.object);if(Array.isArray(d))for(t=0;t<d.length;t++){var p=d[t];if(u)$h(p,f,c,!0);else if(!(0>c)){var g=c+Zh(p);p.pc(g,!0),_h(p,g,c)}}e.isModified=!0}}finally{e.aa=!0}}}}},Qf.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)},Qf.prototype.rp=function(){for(var t=this.H.model,e=new _,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){Ad(t,e,!1)})),n=0;n<i.length;n++){var r=i[n];null===this.Lc(r)&&Ld(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()},Qf.prototype.refreshDataBoundLinks=function(){},Qf.prototype.updateRelationshipsFromData=function(){},Qf.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);j(i)}}t===this.diagram.model.modelData&&this.updateAllTargetBindings(e)}},Qf.prototype.Kj=function(t,e,i){void 0===i&&(i=!1);var n=new dt;if(P(t))for(var o=0;o<t.length;o++)sd(this,t[o],e,n,i);else for(t=t.iterator;t.next();)sd(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 _;for(var r=new dt,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 Zu&&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 dt;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},Qf.prototype.copyPartData=function(t,e){var i=null,n=t.data;if(null!==n&&null!==e){var o=e.model;t instanceof wc||N(n=o.copyNodeData(n))&&(o.xf(n),i=e.Lc(n))}else Wh(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)),N(o)&&(i.data=o)));return i},f.Object.defineProperties(Qf.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}}}),Qf.prototype.updateAllRelationshipsFromData=Qf.prototype.rp,Qf.prototype.findLinksByExample=Qf.prototype.ls,Qf.prototype.findNodesByExample=Qf.prototype.ms,Qf.prototype.findLinkForData=Qf.prototype.Kc,Qf.prototype.findNodeForData=Qf.prototype.ii,Qf.prototype.findPartForData=Qf.prototype.Lc,Qf.prototype.findNodeForKey=Qf.prototype.Vb,Qf.prototype.removeModeledPart=Qf.prototype.ip,Qf.prototype.removeModeledParts=Qf.prototype.Gs,Qf.prototype.rebuildParts=Qf.prototype.Wd;var ad=!1,hd=!1,ld=!1;function ud(t){Qf.apply(this,arguments)}function cd(t,e){e.forEach((function(e){fd(t,e)})),Sr(t.diagram,!1)}function fd(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){Wh(n);var o=n.copy();if(null!==o){n=t.diagram.skipsModelSourceBindings,t.diagram.skipsModelSourceBindings=!0,o.Tf=i,o.ub=e;var r=$d(i=t.diagram.model,e,!0);""!==r&&(o.fromPortId=r),void 0!==(r=Zd(i,e,!0))&&((r=t.Vb(r))instanceof Zu&&(o.fromNode=r)),""!==(r=$d(i,e,!1))&&(o.toPortId=r),void 0!==(r=Zd(i,e,!1))&&((r=t.Vb(r))instanceof Zu&&(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 dd(t,e){e.forEach((function(e){t.ip(e)}))}function pd(){Qf.apply(this,arguments),this.Sg=null}function gd(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||!Ji(n,o,r,null,!0))&&(e=t.getLinkCategoryForData(i.data),null!==(n=t.findLinkTemplateForCategory(e))&&(Wh(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 md(t,e){this.kl=new _,this.il=new _,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 dt,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 dt,this.Lt=new J,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 yd(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(!N(e))return e;r||(r=[]);var a=Object.isExtensible(e);if(n||(n=new dt),a){var h=n.get(e);if(h)return h}else for(o||(o=new dt),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(yd(t,e[u],!1,n,o,r))}else if(e instanceof pt||e instanceof At||e instanceof Dt||e instanceof Wt||e instanceof Ie)h=e.copy(),s(e,h);else{if(e instanceof Ia||e instanceof Ue||e instanceof V)return e;if(e instanceof J)h=(new J).addAll(yd(t,e.Fa(),!1,n,o,r)),s(e,h);else if(e instanceof _)h=(new _).addAll(yd(t,e.Fa(),!1,n,o,r)),s(e,h);else if(e instanceof dt)h=(new dt).addAll(yd(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]=yd(t,e[u],!1,n,o,r))}return i&&r.forEach((function(t){delete t.__gohashid})),h}function vd(t,e){N(e=e.modelData)&&(t.dm(e),t.modelData=e)}function xd(t,e){function i(t,e){if((e=e.part)&&t!==(e=e.data)){var i=n.get(t);null===i?((i=new _).add(e),n.add(t,i)):i.add(e)}}var n=t.vh;null===n&&(n=new dt,e.changes.each((function(t){if(null!==t.diagram){var e=t.change;e===fi?(t=t.object.panel)&&(e=t.data)&&i(e,t):e!==di&&e!==pi||(e=(t=t.object).itemArray)&&i(e,t)}})),t.vh=n)}function bd(t,e){for(var i=new _,n=0;n<t.nodeDataArray.length;n++){var o=t.nodeDataArray[n];wd(t,e,o,o,i)}return i}function wd(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(wd(t,e,s,n,o))return!0}else if(N(i)&&Object.getPrototypeOf(i)===Object.prototype)for(r in i){if((s=i[r])===e)return o.add(n),!0;if(wd(t,e,s,n,o))return!0}return!1}function kd(t,e,i){void 0===i&&(i=!1);var n=e.length;if(0>=n)return"[]";var o=new G;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 Md(t,e){return void 0===e||"__gohashid"===t||"_"===t[0]||"function"==typeof e}function Sd(t){return isNaN(t)?"NaN":1/0===t?"9e9999":-1/0===t?"-9e9999":t}function Nd(t,e){var i=e;if(i instanceof pt)e={class:"go.Point",x:Sd(i.x),y:Sd(i.y)};else if(i instanceof At)e={class:"go.Size",width:Sd(i.width),height:Sd(i.height)};else if(i instanceof Dt)e={class:"go.Rect",x:Sd(i.x),y:Sd(i.y),width:Sd(i.width),height:Sd(i.height)};else if(i instanceof Wt)e={class:"go.Margin",top:Sd(i.top),right:Sd(i.right),bottom:Sd(i.bottom),left:Sd(i.left)};else if(i instanceof Ie)e=i.sb()?{class:"go.Spot",x:Sd(i.x),y:Sd(i.y),offsetX:Sd(i.offsetX),offsetY:Sd(i.offsetY)}:{class:"go.Spot",enum:i.toString()};else if(i instanceof Ia){if(e={class:"go.Brush",type:i.type.name},i.type===Ja?e.color=i.color:i.type!==$a&&i.type!==_a||(e.start=i.start,e.end=i.end,i.type===_a&&(0!==i.startRadius&&(e.startRadius=Sd(i.startRadius)),isNaN(i.endRadius)||(e.endRadius=Sd(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 Ue?(e={class:"go.Geometry",type:i.type.name},0!==i.startX&&(e.startX=Sd(i.startX)),0!==i.startY&&(e.startY=Sd(i.startY)),0!==i.endX&&(e.endX=Sd(i.endX)),0!==i.endY&&(e.endY=Sd(i.endY)),i.spot1.D(te)||(e.spot1=i.spot1),i.spot2.D(he)||(e.spot2=i.spot2),i.type===Ue.o&&(e.path=Ue.ia(i))):i instanceof V&&(e={class:"go.EnumValue",classType:Id(t,i.classType),name:i.name});for(var o in n="{",i=!0,e){var r=Ed(e,o);if(!Md(o,r))if(i?i=!1:n+=",",n+=t.quote(o)+":","points"===o&&r instanceof J){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 Pd(t){return"number"==typeof t?t:"NaN"===t?NaN:"9e9999"===t?1/0:"-9e9999"===t?-1/0:parseFloat(t)}function Cd(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 Td(t){return"number"==typeof t||"string"==typeof t}function Ld(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,T(t.Tc,n,e)),Cd(t,"nodeDataArray",di,"nodeDataArray",t,null,e,null,n),t.fm(e),t.em(e))}function Ad(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)}Cd(t,"nodeDataArray",pi,"nodeDataArray",t,e,null,n,null),t.qp(e)}function jd(t,e,i){if(void 0!==e){var n=t.Vf.I(e);null===n&&(n=new _,t.Vf.add(e,n)),n.add(i)}}function Fd(t,e,i){if(void 0!==e){var n=t.Vf.I(e);n instanceof _&&(null==i?t.Vf.remove(e):(n.remove(i),0===n.count&&t.Vf.remove(e)))}}function Od(t,e){return void 0===e?null:(t=t.Vf.I(e))instanceof _?t:null}function Dd(t,e,i){if(t.copiesArrays&&Array.isArray(e)){var n=[];for(i=0;i<e.length;i++){var o=Dd(t,e[i],t.copiesArrayObjects);n.push(o)}return Q(n),n}if(i&&N(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=Ed(e,n),s=Id(t,r);"GraphObject"===s||"Diagram"===s||"Layer"===s||"RowColumnDefinition"===s||"AnimationManager"===s||"Tool"===s||"CommandHandler"===s||"Layout"===s||"InputEvent"===s||"DiagramEvent"===s||r instanceof md||r instanceof mi||r instanceof gi||r instanceof ui||(r=Dd(t,r,!1)),Rd(i,n,r)}return Q(i),i}return e instanceof pt||e instanceof At||e instanceof Dt||e instanceof Ie||e instanceof Wt?e.copy():e}function Bd(){return new md}function Id(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 Id(t,e.constructor);return typeof e}function zd(t){return Yd[t]?Yd[t]:void 0!==m.go&&m.go[t]?m.go[t]:null}function Ed(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 Rd(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){}}Qf.className="PartManager",c(ud,Qf),ud.prototype.addAllModeledParts=function(){var t=this.diagram.model;this.addModeledParts(t.nodeDataArray),cd(this,t.linkDataArray)},ud.prototype.addModeledParts=function(t){for(Qf.prototype.addModeledParts.call(this,t,!1),t=this.links.iterator;t.next();)kc(t.value);Sr(this.diagram,!1)},ud.prototype.removeAllModeledParts=function(){var t=this.diagram.model;dd(this,t.linkDataArray),this.Gs(t.nodeDataArray)},ud.prototype.getLinkCategoryForData=function(t){return this.diagram.model.ps(t)},ud.prototype.setLinkCategoryForData=function(t,e){return this.diagram.model.lp(t,e)},ud.prototype.setFromNodeForLink=function(t,e){var i=this.diagram.model;i.wv(t.data,i.wa(null!==e?e.data:null))},ud.prototype.setToNodeForLink=function(t,e){var i=this.diagram.model;i.Bv(t.data,i.wa(null!==e?e.data:null))},ud.prototype.removeDataForLink=function(t){this.diagram.model.bm(t.data)},ud.prototype.findPartForKey=function(t){var e=Qf.prototype.findPartForKey.call(this,t);return null===e&&null!==(t=this.diagram.model.jh(t))?this.bf.I(t):e},ud.prototype.findLinkForKey=function(t){return null==t?null:null!==(t=this.diagram.model.jh(t))?this.bf.I(t):null},ud.prototype.doModelChanged=function(t){var e=this;if(Qf.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===fi){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 f=t.newValue;"string"==typeof f&&(c.toPortId=f)}}else if("nodeGroupKey"===o){var d=this.Lc(t.object);if(null!==d){var p=t.newValue;if(void 0!==p){var g=this.Vb(p);d.containingGroup=g instanceof gc?g:null}else d.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&&(dd(this,t.oldValue),cd(this,t.newValue));i.isModified=!0}else if(n===di){var w=t.newValue;if("linkDataArray"===o&&"object"==typeof w&&null!==w)fd(this,w);else if("linkLabelKeys"===o&&Td(w)){var k=this.Kc(t.object),M=this.Vb(w);null!==k&&null!==M&&(M.labeledLink=k)}i.isModified=!0}else if(n===pi){var S=t.oldValue;if("linkDataArray"===o&&"object"==typeof S&&null!==S)this.ip(S);else if("linkLabelKeys"===o&&Td(S)){var N=this.Vb(S);null!==N&&(N.labeledLink=null)}i.isModified=!0}}else if(n===fi){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}}}}},ud.prototype.refreshDataBoundLinks=function(){var t=this,e=this.diagram.model,i=new _,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)&&Qd(e,i,!1)}))},ud.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=Zd(n,e,!0);if(o=i.Vb(o),t.fromNode=o,o=Zd(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 _).addAll(e);var s=new _;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 Hu)&&(e=n.lh(e),null===(e=i.findPartForKey(e))||e instanceof gc)&&(t.containingGroup=e)}}},ud.prototype.resolveReferencesForData=function(t){var e=this.diagram.model,i=e.wa(t);if(void 0!==i){var n=Od(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 Zu&&(Zd(e,s,!0)===i&&(r.link.fromNode=o),Zd(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}}Fd(e,i)}void 0!==(t=e.lh(t))&&((t=this.Vb(t))instanceof gc&&(o.containingGroup=t))}},ud.prototype.unresolveReferencesForPart=function(t){var e=this.diagram.model;if(t instanceof Zu){var i=e.wa(t.data);if(void 0!==i){for(var n=t.linksConnected;n.next();)jd(e,i,n.value.data);if(t.isLinkLabel&&(null!==(n=t.labeledLink)&&jd(e,i,n.data)),t instanceof gc)for(t=t.memberParts;t.next();)n=t.value.data,e.lb(n)&&jd(e,i,n)}}},ud.prototype.copyPartData=function(t,e){var i=Qf.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},ud.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(Wh(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 Zu&&(Wh(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&&Jd(r,n,r.wa(t.data),!0),_d(r,n,a,!0),null!==i&&Jd(r,n,r.wa(i.data),!1),_d(r,n,e,!1),r.fi(n),null===(t=s.archetypeLabelNodeData)||t instanceof Zu||"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},ud.prototype.findLinkForKey=ud.prototype.findLinkForKey,ud.prototype.findPartForKey=ud.prototype.findPartForKey,ud.prototype.removeAllModeledParts=ud.prototype.removeAllModeledParts,ud.prototype.addModeledParts=ud.prototype.addModeledParts,ud.prototype.addAllModeledParts=ud.prototype.addAllModeledParts,ud.className="GraphLinksPartManager",c(pd,Qf),pd.prototype.getLinkCategoryForData=function(t){return this.diagram.model.ss(t)},pd.prototype.setLinkCategoryForData=function(t,e){this.diagram.model.Ms(t,e)},pd.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}},pd.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))},pd.prototype.removeDataForLink=function(t){this.diagram.model.qe(t.data,void 0)},pd.prototype.findLinkForKey=function(t){return null==t?null:null!==(t=this.diagram.model.hc(t))?this.bf.I(t):null},pd.prototype.doModelChanged=function(t){if(Qf.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===fi){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:gd(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===fi){var c=t.propertyName;t.object===e.model&&"nodeParentKeyProperty"===c&&(e.undoManager.isUndoingRedoing||this.Wd()),e.isModified=!0}}finally{e.aa=!0}}}}},pd.prototype.updateRelationshipsFromData=function(t){var e=t.data;if(null!==e){var i=t.diagram;if(null!==i){var n=i.model;t instanceof Zu&&(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:gd(this,e,t):null!==n&&ar(i,n,!1)))}}},pd.prototype.updateDataBindings=function(t,e){Qf.prototype.updateDataBindings.call(this,t,e),"string"==typeof e&&null!==this.Lc(t)&&(null!==(t=this.Kc(t))&&t.La(e))},pd.prototype.resolveReferencesForData=function(t){var e=this.diagram.model,i=e.wa(t);if(void 0!==i){var n=Od(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 Zu&&e.mh(r)===i&&gd(this,o,this.ii(r))}Fd(e,i)}void 0!==(t=e.mh(t))&&o instanceof Zu&&gd(this,t=this.Vb(t),o)}},pd.prototype.unresolveReferencesForPart=function(t){var e=this.diagram.model;if(t instanceof Zu){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)&&jd(e,i,o)}},pd.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},pd.prototype.findLinkForKey=pd.prototype.findLinkForKey,pd.className="TreePartManager",md.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},md.prototype.copy=function(){var t=new this.constructor;return this.cloneProtected(t),t},md.prototype.clear=function(){this.Tc=[],this.kb.clear(),this.Vf.clear(),this.undoManager.clear()},md.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)+":"+O(o)}}return e},md.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?(xd(this,e),t=this.Qv(e,"FinishedUndo"===t.propertyName),this.vh=null,t):null},md.prototype.Qv=function(t,e){var i=this,n=!1,o=new _,r=new _,s=new _,a=this.vh;t.changes.each((function(t){t.model===i&&("nodeDataArray"===t.modelChange?t.change===di?o.add(t.newValue):t.change===pi&&s.add(t.oldValue):i.lb(t.object)?r.add(t.object):t.change!==fi||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 md||i.ri()&&i.Jc(t.object)||bd(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},md.prototype.cloneDeep=function(t){return yd(this,t,!0)},(e=md.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(!Md(t,e[t])){i=!0;break}return e="",i&&(e=',\n "modelData": '+Nd(this,this.modelData)),e+',\n "nodeDataArray": '+kd(this,this.nodeDataArray,!0)},e.kv=function(t){vd(this,t),P(t=t.nodeDataArray)&&(this.dm(t),this.nodeDataArray=t)},e.Pv=function(t,e){var i=this,n=!1,o=new _,r=new _,s=new _,a=this.vh;t.changes.each((function(t){t.model===i&&("nodeDataArray"===t.modelChange?t.change===di?o.add(t.newValue):t.change===pi&&s.add(t.oldValue):i.lb(t.object)?r.add(t.object):t.change!==fi||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 md||i.ri()&&i.Jc(t.object)||bd(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": '+Nd(this,this.modelData)),0<h.count&&(t+=(e?this.Yv:this.Wv)+kd(this,h.Fa(),!0)),0<r.count&&(t+=this.jy+kd(this,r.Fa(),!0)),0<l.count&&(t+=(e?this.Wv:this.Yv)+kd(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"),vd(this,t);var e=t.insertedNodeKeys,i=t.modifiedNodeData,n=new dt;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=Id(this,this)),xd(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=Id(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)},md.constructGraphLinksModel=function(){return new md},(e=md.prototype).dm=function(t){if(P(t))for(var e=t.length,i=0;i<e;i++){var n=t[i];if(N(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(N(t)){for(e in t)if(N(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 J,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(Pd(t.x),Pd(t.y));else if("Size"===e)i=new At(Pd(t.width),Pd(t.height));else if("Rect"===e)i=new Dt(Pd(t.x),Pd(t.y),Pd(t.width),Pd(t.height));else if("Margin"===e)i=new Wt(Pd(t.top),Pd(t.right),Pd(t.bottom),Pd(t.left));else if("Spot"===e)i="string"==typeof t.enum?Ee(t.enum):new Ie(Pd(t.x),Pd(t.y),Pd(t.offsetX),Pd(t.offsetY));else if("Brush"===e){if((i=new Ia).type=Y(Ia,t.type),"string"==typeof t.color&&(i.color=t.color),t.start instanceof Ie&&(i.start=t.start),t.end instanceof Ie&&(i.end=t.end),"number"==typeof t.startRadius&&(i.startRadius=Pd(t.startRadius)),"number"==typeof t.endRadius&&(i.endRadius=Pd(t.endRadius)),N(t=t.colorStops))for(var n in t)i.addColorStop(parseFloat(n),t[n])}else"Geometry"===e?(i=null,i="string"==typeof t.path?Ue.parse(t.path):new Ue,i.type=Y(Ue,t.type),"number"==typeof t.startX&&(i.startX=Pd(t.startX)),"number"==typeof t.startY&&(i.startY=Pd(t.startY)),"number"==typeof t.endX&&(i.endX=Pd(t.endX)),"number"==typeof t.endY&&(i.endY=Pd(t.endY)),t.spot1 instanceof Ie&&(i.spot1=t.spot1),t.spot2 instanceof Ie&&(i.spot2=t.spot2)):"EnumValue"===e&&(n=t.classType,0===n.indexOf("go.")&&(n=n.substr(3)),n=zd(n),"function"==typeof n&&(i=Y(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)?kd(this,t):N(t)?Nd(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){Cd(this,"",t,e,i,n,o,r,s)},e.g=function(t,e,i,n,o){Cd(this,"",fi,t,this,e,i,n,o)},e.Fs=function(t,e,i,n,o,r){Cd(this,"",fi,e,t,i,n,o,r)},md.prototype.changeState=function(t,e){if(null!==t&&t.model===this)if(t.change===fi){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)),Rd(i,n,o)}else t.change===di?(i=t.newParam,"nodeDataArray"===t.modelChange?N(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&&T(this.Tc,i,t),void 0!==n&&this.kb.add(n,t))):""===t.modelChange?((n=t.object)&&!P(n)&&t.propertyName&&(n=Ed(t.object,t.propertyName)),P(n)&&"number"==typeof i&&(t=t.newValue,e?L(n,i):T(n,i,t))):w("unknown ChangedEvent.Insert modelChange: "+t.toString())):t.change===pi?(i=t.oldParam,"nodeDataArray"===t.modelChange?N(t=t.oldValue)&&"number"==typeof i&&(n=this.wa(t),e?(this.Tc[i]!==t&&T(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=Ed(t.object,t.propertyName)),P(n)&&"number"==typeof i&&(t=t.oldValue,e?T(n,i,t):L(n,i))):w("unknown ChangedEvent.Remove modelChange: "+t.toString())):t.change!==ci&&w("unknown ChangedEvent: "+t.toString())},md.prototype.Ea=function(t){return this.undoManager.Ea(t)},md.prototype.eb=function(t){return this.undoManager.eb(t)},md.prototype.Kf=function(){return this.undoManager.Kf()},md.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=md.prototype).La=function(t,e){void 0===e&&(e=""),Cd(this,"SourceChanged",ci,e,t,null,null)},e.wa=function(t){if(null!==t){var e=this.Th;if(""!==e&&void 0!==(e=Ed(t,e))){if(Td(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=Ed(t,i);n!==e&&null===this.hc(e)&&(Rd(t,i,e),void 0!==n&&this.kb.remove(n),this.kb.add(e,t),Cd(this,"nodeKey",fi,i,t,n,e),"string"==typeof i&&this.La(t,i),this.jp(n,e))}else Rd(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&&Td(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 Rd(t,e,i);if("string"==typeof i){for(n=2;this.kb.contains(i+n);)n++;Rd(t,e,i+n)}else if(void 0===i||"number"==typeof i){for(i=-this.kb.count-1;this.kb.contains(i);)i--;Rd(t,e,i)}}}}},e.xf=function(t){null!==t&&(tt(t),this.lb(t)||Ld(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&&Ad(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=Od(this,t))instanceof _&&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)},md.prototype.copyNodeData=function(t){if(null===t)return null;var e=this.Bk;return N(t=null!==e?e(t,this):Dd(this,t,!0))&&Q(t),t},md.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!Vd&&t instanceof Os&&(Vd=!0,S('Model.setDataProperty is modifying a GraphObject, "'+t.toString()+'"'),S(" Is that really your intent?"));var n=Ed(t,e);n!==i&&(Rd(t,e,i),this.Fs(t,e,n,i))},(e=md.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),T(t,e,i),Cd(this,"",di,"",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),Cd(this,"",pi,"",t,i,null,e,null)},e.Ro=function(t){if(null===t)return"";var e=this.lj;return""===e||void 0===(e=Ed(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=Ed(t,i);void 0===n&&(n=""),n!==e&&(Rd(t,i,e),Cd(this,"nodeCategory",fi,i,t,n,e))}else Rd(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},f.Object.defineProperties(md.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];N(o)||w("Model.nodeDataArray must only contain Objects, not: "+o),tt(o)}for(this.Tc=t,n=new J,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(Cd(this,"nodeDataArray",fi,"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"}}}),md.prototype.setCategoryForNodeData=md.prototype.jm,md.prototype.getCategoryForNodeData=md.prototype.Ro,md.prototype.removeArrayItem=md.prototype.ov,md.prototype.insertArrayItem=md.prototype.ts,md.prototype.addArrayItem=md.prototype.Ay,md.prototype.assignAllDataProperties=md.prototype.Do,md.prototype.set=md.prototype.set,md.prototype.clearUnresolvedReferences=md.prototype.Qy,md.prototype.mergeNodeDataArray=md.prototype.$z,md.prototype.removeNodeDataCollection=md.prototype.nA,md.prototype.removeNodeData=md.prototype.cm,md.prototype.addNodeDataCollection=md.prototype.Fy,md.prototype.addNodeData=md.prototype.xf,md.prototype.makeNodeDataKeyUnique=md.prototype.$u,md.prototype.findNodeDataForKey=md.prototype.hc,md.prototype.containsNodeData=md.prototype.lb,md.prototype.setKeyForNodeData=md.prototype.km,md.prototype.getKeyForNodeData=md.prototype.wa,md.prototype.updateTargetBindings=md.prototype.La,md.prototype.commit=md.prototype.commit,md.prototype.rollbackTransaction=md.prototype.Kf,md.prototype.commitTransaction=md.prototype.eb,md.prototype.startTransaction=md.prototype.Ea,md.prototype.raiseDataChanged=md.prototype.Fs,md.prototype.raiseChanged=md.prototype.g,md.prototype.raiseChangedEvent=md.prototype.cb,md.prototype.removeChangedListener=md.prototype.ik,md.prototype.addChangedListener=md.prototype.Pe,md.prototype.writeJsonValue=md.prototype.sm,md.prototype.replaceJsonObjects=md.prototype.dm,md.prototype.applyIncrementalJSON=md.prototype.Ky,md.prototype.applyIncrementalJson=md.prototype.Zw,md.prototype.toJSON=md.prototype.toJSON,md.prototype.toJson=md.prototype.np,md.prototype.toIncrementalJSON=md.prototype.yA,md.prototype.toIncrementalJson=md.prototype.$x,md.prototype.toIncrementalData=md.prototype.xA,md.prototype.clear=md.prototype.clear;var Vd=!1,Yd={};function Gd(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=qd,this.wk=null):(this.el=Kd,this.wk=n),this.st=new _}function Xd(t,e,i){return null===(t=t.sourceName)||""===t?e:"/"===t?i.part:"."===t?i:".."===t?i.panel:e.fb(t)}md.className="Model",md.fromJSON=md.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=zd(n=n.substr(3)):null===(o=zd(n))&&(o=m[n]),"function"==typeof o&&(t=new o)}catch(t){}null===t||t instanceof md?e=t:w("Unable to construct a Model of declared class: "+i.class)}return null===e&&(e=md.constructGraphLinksModel()),e.gp(i),e.kv(i),e},md.safePropertyValue=Ed,md.safePropertySet=Rd,Yd.Brush=Ia,Yd.ChangedEvent=ui,Yd.Geometry=Ue,Yd.Margin=Wt,Yd.Panel=Ch,Yd.Point=pt,Yd.Rect=Dt,Yd.Size=At,Yd.Spot=Ie,Yd.Transaction=gi,Yd.UndoManager=mi,Gd.prototype.copy=function(){var t=new Gd;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=Gd.prototype).qb=function(t){t.classType===Gd&&(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=Kd,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)S("Binding error: target property is the empty string: "+this.toString());else{var r=e;if(""!==n&&(r=Ed(e,n)),void 0!==r)if(null===o)""!==i&&Rd(t,i,r);else try{if(""!==i)Rd(t,i,o(r,t));else o(r,t)}catch(t){}}}},e.sp=function(t,e,i,n){if(this.el===Kd){var o=this.xl;if(void 0===i||o===i){i=this.sl;var r=this.wk,s=t;if(""!==o&&(s=Ed(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):Rd(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):Rd(e,i,c)}else{var f=r(s,e,h);if(void 0!==f&&null!==h&&null!==n&&0<=n.itemIndex&&null!==n.panel&&Array.isArray(n.panel.itemArray)){var d=n.itemIndex,p=n.panel.itemArray;h.ov(p,d),h.ts(p,d,f)}}}catch(t){}}finally{this.st.remove(t)}}}},f.Object.defineProperties(Gd.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}}}),Gd.prototype.updateSource=Gd.prototype.sp,Gd.prototype.updateTarget=Gd.prototype.Mv,Gd.prototype.ofModel=Gd.prototype.dA,Gd.prototype.ofObject=Gd.prototype.cp,Gd.prototype.makeTwoWay=Gd.prototype.Kx;var Ud="Binding",qd=new V(Gd,"OneWay",1),Kd=new V(Gd,"TwoWay",2);function Hd(t,e,i){md.call(this),this.Vv=',\n "insertedLinkKeys": ',this.iy=',\n "modifiedLinkData": ',this.Xv=',\n "removedLinkKeys": ',this.md=[],this.$f=new _,this.wb=new dt,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 Wd(t,e){for(var i=new _,n=0;n<t.linkDataArray.length;n++){var o=t.linkDataArray[n];wd(t,e,o,o,i)}return i}function Zd(t,e,i){if(null!==e&&(""!==(t=i?t.lf:t.mf)&&void 0!==(t=Ed(e,t)))){if(Td(t))return t;w((i?"FromKey":"ToKey")+" value for link data "+e+" is not a number or a string: "+t)}}function Jd(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=Ed(e,o);r!==i&&(Fd(t,r,e),Rd(e,o,i),null===t.hc(i)&&jd(t,i,e),Cd(t,n?"linkFromKey":"linkToKey",fi,o,e,r,i),"string"==typeof o&&t.La(e,o))}else Rd(e,o,i)}}function $d(t,e,i){return null===e||""===(t=i?t.ej:t.fj)||void 0===(e=Ed(e,t))?"":e}function _d(t,e,i,n){if(null!==e){var o=n?t.ej:t.fj;if(""!==o)if(t.Jc(e)){var r=Ed(e,o);void 0===r&&(r=""),r!==i&&(Rd(e,o,i),Cd(t,n?"linkFromPortId":"linkToPortId",fi,o,e,r,i),"string"==typeof o&&t.La(e,o))}else Rd(e,o,i)}}function Qd(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)),Cd(t,"linkDataArray",di,"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(Cd(t,"linkDataArray",pi,"linkDataArray",t,e,null,n,null),Fd(t,i=Zd(t,e,!0),e),Fd(t,i=Zd(t,e,!1),e),n=t.Ef(e),Array.isArray(n))for(var o=n.length,r=0;r<o;r++)Fd(t,i=n[r],e)}function ep(t,e){var i=Zd(t,e,!0);i=t.Vl(i),null===t.hc(i)&&jd(t,i,e),i=Zd(t,e,!1),i=t.Vl(i),null===t.hc(i)&&jd(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)&&jd(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))}Gd.className="Binding",Gd.parseEnum=function(t,e){return function(i){return null===(i=Y(t,i))?e:i}},Gd.toString=O,Gd.OneWay=qd,Gd.TwoWay=Kd,c(Hd,md),Hd.constructGraphLinksModel=md.constructGraphLinksModel,Hd.prototype.cloneProtected=function(t){md.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=Hd.prototype).clear=function(){md.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)+":"+O(o)}for(e+="\n link data:",n=(t=this.linkDataArray).length,i=0;i<n;i++)e+=" "+Zd(this,o=t[i],!0)+"--\x3e"+Zd(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=md.prototype.Qv.call(this,t,e),n=this,o=new _,r=new _,s=new _,a=this.vh;t.changes.each((function(t){t.model===n&&("linkDataArray"===t.modelChange?t.change===di?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 md||n.lb(t.object)||Wd(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=md.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){md.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 md.prototype.Rv.call(this)+(',\n "linkDataArray": '+kd(this,this.linkDataArray,!0))},e.kv=function(t){md.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=md.prototype.Pv.call(this,t,e),n=this,o=new _,r=new _,s=new _,a=this.vh;t.changes.each((function(t){t.model===n&&("linkDataArray"===t.modelChange?t.change===di?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 md||n.lb(t.object)||Wd(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)+kd(this,h.Fa(),!0)),0<r.count&&(t+=this.iy+kd(this,r.Fa(),!0)),0<l.count&&(t+=(e?this.Vv:this.Xv)+kd(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"),md.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)},Hd.prototype.changeState=function(t,e){if(null!==t&&t.model===this){if(t.change===fi){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 Rd(i,n,o)}}else if(t.change===di){if(i=t.newParam,"linkDataArray"===t.modelChange)return void(N(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(N(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))))}md.prototype.changeState.call(this,t,e)}},(e=Hd.prototype).Vl=function(t){if(void 0!==t){var e=this.Ri;if(null!==e){var i=this.hc(t);null===i&&(Rd(i=this.copyNodeData(e),this.nodeKeyProperty,t),this.xf(i))}return t}},e.yx=function(t){return Zd(this,t,!0)},e.wv=function(t,e){Jd(this,t,e,!0)},e.Bx=function(t){return Zd(this,t,!1)},e.Bv=function(t,e){Jd(this,t,e,!1)},e.zx=function(t){return $d(this,t,!0)},e.xv=function(t,e){_d(this,t,e,!0)},e.Cx=function(t){return $d(this,t,!1)},e.Cv=function(t,e){_d(this,t,e,!1)},e.Ef=function(t){if(null===t)return np;var e=this.je;return""===e||void 0===(t=Ed(t,e))?np:t},e.Ls=function(t,e){if(null!==t){var i=this.je;if(""!==i)if(this.Jc(t)){var n=Ed(t,i);if(void 0===n&&(n=np),n!==e){if(Array.isArray(n))for(var o=n.length,r=0;r<o;r++)Fd(this,n[r],t);for(Rd(t,i,e),o=e.length,r=0;r<o;r++){var s=e[r];null===this.hc(s)&&jd(this,s,t)}Cd(this,"linkLabelKeys",fi,i,t,n,e),"string"==typeof i&&this.La(t,i)}}else Rd(t,i,e)}},e.Bu=function(t,e){if(null!=e&&null!==t){var i=this.je;if(""!==i){var n=Ed(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)&&jd(this,e,t),Cd(this,"linkLabelKeys",di,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=Ed(t,i);if(Array.isArray(n)){var o=n.indexOf(e);0>o||(n.splice(o,1),this.Jc(t)&&(Fd(this,e,t),Cd(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=Ed(t,e))){if(Td(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=Ed(t,i);n!==e&&null===this.jh(e)&&(Rd(t,i,e),void 0!==n&&this.wb.remove(n),this.wb.add(e,t),Cd(this,"linkKey",fi,i,t,n,e),"string"==typeof i&&this.La(t,i))}else Rd(t,i,e)}},e.jh=function(t){return null===t&&w("GraphLinksModel.findLinkDataForKey:key must not be null"),void 0!==t&&Td(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 Rd(t,e,i);if("string"==typeof i){for(n=2;this.wb.contains(i+n);)n++;Rd(t,e,i+n)}else if(void 0===i||"number"==typeof i){for(i=-this.wb.count-1;this.wb.contains(i);)i--;Rd(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)||Qd(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 N(t=null!==e?e(t,this):Dd(this,t,!0))&&(Q(t),""!==this.lf&&Rd(t,this.lf,void 0),""!==this.mf&&Rd(t,this.mf,void 0),""!==this.je&&Rd(t,this.je,[])),t},e.Yu=function(t){if(null===t)return!1;var e=this.jl;return""!==e&&!!Ed(t,e)},e.lh=function(t){if(null!==t){var e=this.Je;if(""!==e&&void 0!==(e=Ed(t,e))){if(Td(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=Ed(t,i);n!==e&&(Fd(this,n,t),Rd(t,i,e),null===this.hc(e)&&jd(this,e,t),Cd(this,"nodeGroupKey",fi,i,t,n,e),"string"==typeof i&&this.La(t,i))}else Rd(t,i,e)}},Hd.prototype.copyNodeData=function(t){return null===t?null:(t=md.prototype.copyNodeData.call(this,t),this.Ij||""===this.Je||void 0===Ed(t,this.Je)||Rd(t,this.Je,void 0),t)},Hd.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 Jd(this,t,i,!0);if(e===this.linkToKeyProperty)return void Jd(this,t,i,!1);if(e===this.linkFromPortIdProperty)return void _d(this,t,i,!0);if(e===this.linkToPortIdProperty)return void _d(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=Ed(t,e);n!==i&&(Rd(t,e,i),this.Fs(t,e,n,i))},(e=Hd.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&&Ed(t,i)===e[i]||o&&i===this.linkKeyProperty||this.setDataProperty(t,i,e[i])}},e.jp=function(t,e){md.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(Zd(this,n,!0)===o){var s=this.lf;Rd(n,s,r),Cd(this,"linkFromKey",fi,s,n,o,r),"string"==typeof s&&this.La(n,s)}if(Zd(this,n,!1)===o&&(Rd(n,s=this.mf,r),Cd(this,"linkToKey",fi,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,Cd(this,"linkLabelKeys",di,h,n,o,r,l,l))}},e.qv=function(t,e,i){if(this.lh(t)===e){var n=this.Je;Rd(t,n,i),Cd(this,"nodeGroupKey",fi,n,t,e,i),"string"==typeof n&&this.La(t,n)}},e.Lv=function(){md.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){md.prototype.fm.call(this,t);var e=Od(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;Cd(this,"nodeGroupKey",fi,o,n,t,t),"string"==typeof o&&this.La(n,o),i.push(n)}}else if(Zd(this,n,!0)===t&&(o=this.lf,Cd(this,"linkFromKey",fi,o,n,t,t),"string"==typeof o&&this.La(n,o),i.push(n)),Zd(this,n,!1)===t&&(o=this.mf,Cd(this,"linkToKey",fi,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&&(Cd(this,"linkLabelKeys",di,s,n,t,t,a,a),i.push(n))}for(e=0;e<i.length;e++)Fd(this,t,i[e]);j(i)}},e.em=function(t){md.prototype.em.call(this,t);var e=this.lh(t);null===this.hc(e)&&jd(this,e,t)},e.qp=function(t){md.prototype.qp.call(this,t),Fd(this,this.lh(t),t)},e.ps=function(t){if(null===t)return"";var e=this.dj;return""===e||void 0===(e=Ed(t,e))?"":"string"==typeof e?e:void w("getCategoryForLinkData found a non-string category for "+t+": "+e)},Hd.prototype.getLinkCategoryForData=function(t){return this.ps(t)},Hd.prototype.lp=function(t,e){if(null!==t){var i=this.dj;if(""!==i)if(this.Jc(t)){var n=Ed(t,i);void 0===n&&(n=""),n!==e&&(Rd(t,i,e),Cd(this,"linkCategory",fi,i,t,n,e),"string"==typeof i&&this.La(t,i))}else Rd(t,i,e)}},Hd.prototype.setLinkCategoryForData=function(t,e){this.lp(t,e)},(e=Hd.prototype).lm=function(t,e){md.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},f.Object.defineProperties(Hd.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];N(o)||w("GraphLinksModel.linkDataArray must only contain Objects, not: "+o),tt(o)}if(this.md=t,""!==this.linkKeyProperty){for(n=new J,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 _,o=0;o<i;o++)n.add(t[o]);for(this.$f=n,Cd(this,"linkDataArray",fi,"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"}}}),Hd.prototype.setCategoryForLinkData=Hd.prototype.lp,Hd.prototype.getCategoryForLinkData=Hd.prototype.ps,Hd.prototype.assignAllDataProperties=Hd.prototype.Do,Hd.prototype.setGroupKeyForNodeData=Hd.prototype.mp,Hd.prototype.getGroupKeyForNodeData=Hd.prototype.lh,Hd.prototype.isGroupForNodeData=Hd.prototype.Yu,Hd.prototype.copyLinkData=Hd.prototype.Jo,Hd.prototype.mergeLinkDataArray=Hd.prototype.Zz,Hd.prototype.removeLinkDataCollection=Hd.prototype.lA,Hd.prototype.removeLinkData=Hd.prototype.bm,Hd.prototype.addLinkDataCollection=Hd.prototype.Ey,Hd.prototype.addLinkData=Hd.prototype.fi,Hd.prototype.containsLinkData=Hd.prototype.Jc,Hd.prototype.makeLinkDataKeyUnique=Hd.prototype.Bs,Hd.prototype.findLinkDataForKey=Hd.prototype.jh,Hd.prototype.setKeyForLinkData=Hd.prototype.Ks,Hd.prototype.getKeyForLinkData=Hd.prototype.Ac,Hd.prototype.removeLabelKeyForLinkData=Hd.prototype.Qx,Hd.prototype.addLabelKeyForLinkData=Hd.prototype.Bu,Hd.prototype.setLabelKeysForLinkData=Hd.prototype.Ls,Hd.prototype.getLabelKeysForLinkData=Hd.prototype.Ef,Hd.prototype.setToPortIdForLinkData=Hd.prototype.Cv,Hd.prototype.getToPortIdForLinkData=Hd.prototype.Cx,Hd.prototype.setFromPortIdForLinkData=Hd.prototype.xv,Hd.prototype.getFromPortIdForLinkData=Hd.prototype.zx,Hd.prototype.setToKeyForLinkData=Hd.prototype.Bv,Hd.prototype.getToKeyForLinkData=Hd.prototype.Bx,Hd.prototype.setFromKeyForLinkData=Hd.prototype.wv,Hd.prototype.getFromKeyForLinkData=Hd.prototype.yx,Hd.prototype.clear=Hd.prototype.clear;var np=Object.freeze([]);function op(t,e){md.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){Ff.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 Fp,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=Yf,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)&&Bp(l,0),isNaN(u.diameter)&&Bp(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 Fp,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++)fp(t,h,l,u,c,o,r)||dp(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 f=Math.abs(h-r)-((u[0].width+u[u.length-1].width)/2+s),d=Math.abs(l-c)-((u[0].height+u[u.length-1].height)/2+s);s=0,1>Math.abs(d)?Math.abs(h-r)<(u[0].width+u[u.length-1].width)/2&&(s=0):s=0<d?d:1>Math.abs(f)?0:f,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(),f=0;f<c.length&&(c[f].centerX=h,c[f].centerY=l,!(f>=c.length-1));f++)fp(t,h,l,c,f,o,u)||dp(t,h,l,c,f,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 fp(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 dp(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}}Hd.className="GraphLinksModel",Yd.GraphLinksModel=Hd,md.constructGraphLinksModel=md.constructGraphLinksModel=function(){return new Hd},md.initDiagramModel=Bd=function(){return new Hd},c(op,md),op.constructGraphLinksModel=md.constructGraphLinksModel,op.prototype.cloneProtected=function(t){md.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)+":"+O(o)}}return e},e.rm=function(){var t=md.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){md.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"),md.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=Ed(t,e))){if(Td(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=Ed(t,i);n!==e&&(Fd(this,n,t),Rd(t,i,e),null===this.hc(e)&&jd(this,e,t),Cd(this,"nodeParentKey",fi,i,t,n,e),"string"==typeof i&&this.La(t,i))}else Rd(t,i,e)}},e.ss=function(t){if(null===t)return"";var e=this.nj;return""===e||void 0===(e=Ed(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=Ed(t,i);void 0===n&&(n=""),n!==e&&(Rd(t,i,e),Cd(this,"parentLinkCategory",fi,i,t,n,e),"string"==typeof i&&this.La(t,i))}else Rd(t,i,e)}},op.prototype.setLinkCategoryForData=function(t,e){this.Ms(t,e)},op.prototype.copyNodeData=function(t){return null===t?null:(t=md.prototype.copyNodeData.call(this,t),this.Jj||""===this.Ke||void 0===Ed(t,this.Ke)||Rd(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=Ed(t,e);n!==i&&(Rd(t,e,i),this.Fs(t,e,n,i))},(e=op.prototype).jp=function(t,e){md.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;Rd(t,n,i),Cd(this,"nodeParentKey",fi,n,t,e,i),"string"==typeof n&&this.La(t,n)}},e.fm=function(t){md.prototype.fm.call(this,t);var e=Od(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;Cd(this,"nodeParentKey",fi,o,n,t,t),"string"==typeof o&&this.La(n,o),i.push(n)}}for(e=0;e<i.length;e++)Fd(this,t,i[e]);j(i)}},e.em=function(t){md.prototype.em.call(this,t);var e=this.mh(t);e=this.Vl(e),null===this.hc(e)&&jd(this,e,t)},e.qp=function(t){md.prototype.qp.call(this,t),Fd(this,this.mh(t),t)},e.lm=function(t,e){md.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},f.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",Yd.TreeModel=op,c(rp,Ff),rp.prototype.cloneProtected=function(t){Ff.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===Cp||t===Tp||t===Np||t===Pp||t===Lp?this.sorting=t:t===Mp||t===Sp||t===wp||t===kp?this.direction=t:t===xp||t===vp||t===yp||t===bp?this.arrangement=t:t!==jp&&t!==Ap||(this.nodeDiameterFormula=t):Ff.prototype.qb.call(this,t)},rp.prototype.createNetwork=function(){return new Op(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 J;e.addAll(t.iterator),t=new J;var i,n,o=new J,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 f=this.sweepAngle;if((!isFinite(f)||360<f||1>f)&&(f=360),e=this.spacing,isFinite(e)||(e=NaN),a===bp&&h===jp?a=yp:a===bp&&h!==jp&&(a=this.arrangement),(this.direction===Mp||this.direction===Sp)&&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===Mp?(this.arrangement===bp&&t.reverse(),(r=new J).addAll(t),r.addAll(o)):(this.arrangement===bp&&o.reverse(),(r=new J).addAll(o),r.addAll(t))}h=r.length;for(var d=n=i=0;d<r.length;d++){var p=c+f*n*(this.direction===wp?1:-1)/h,g=r.M(d).diameter;isNaN(g)&&(g=Bp(r.M(d),p)),360>f&&(0===d||d===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++)d=r.M(s),i=r.M(s===h-1?0:s+1),isNaN(d.diameter)&&Bp(d,0),isNaN(i.diameter)&&Bp(i,0),n=Math.max(n,(d.diameter+i.diameter)/2);s=n+e,l=a===xp?(n+e)/(2*Math.PI/h):gp(this,s*(360<=f?h:h-1),u,c*Math.PI/180,f*Math.PI/180)}else l=gp(this,i+(360<=f?h:h-1)*(a!==bp?e:1.6*e),u,c*Math.PI/180,f*Math.PI/180);n=l*u}else if(d=pp(this,l,n=l*u,c*Math.PI/180,f*Math.PI/180),isNaN(e))a!==yp&&a!==bp||(e=(d-i)/(360<=f?h:h-1));else if(a===yp||a===bp)(d=(d-i)/(360<=f?h:h-1))<e?n=(l=gp(this,i+e*(360<=f?h:h-1),u,c*Math.PI/180,f*Math.PI/180))*u:e=d;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)&&Bp(p,0),isNaN(g.diameter)&&Bp(g,0),s=Math.max(s,(p.diameter+g.diameter)/2);(i=gp(this,(s+=e)*(360<=f?h:h-1),u,c*Math.PI/180,f*Math.PI/180))>l?n=(l=i)*u:s=d/(360<=f?h:h-1)}if(this.kw=a,this.lc=l,this.Zm=u,this.lw=c,this.Wp=f,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,f=this.me,h=this.Jp,this.direction!==Mp&&this.direction!==Sp||r!==bp)if(this.direction===Mp||this.direction===Sp){switch(s=0,r){case vp:s=180*mp(this,a,f,l,h)/Math.PI;break;case yp:h=e=0,null!==(s=t.first())&&(e=Bp(s,Math.PI/2)),null!==(s=o.first())&&(h=Bp(s,Math.PI/2)),s=180*mp(this,a,f,l,c+(e+h)/2)/Math.PI;break;case xp:s=u/e.length}if(this.direction===Mp){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 Np:break;case Pp:t.reverse();break;case Cp:t.sort(this.comparer);break;case Tp: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 J;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 J;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,f=-1,d=[],p=0;p<i.length;p++)0>e[i[p]].indexOf(i[p===i.length-1?0:p+1])&&d.push(p===i.length-1?0:p+1);if(0===d.length)for(p=0;p<i.length;p++)d.push(p);for(p=0;p<d.length;p++){for(var g=d[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,f=g)}for(i.splice(f,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(f=c=0;f<e[l].length;f++)0>(d=i.indexOf(e[l][f]))||d===u||(c+=d<u!=(p=d>u?d-u:u-d)>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},f.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!==Mp&&t!==Sp||(this.K=t,this.C())}},sorting:{get:function(){return this.nd},set:function(t){this.nd===t||t!==Np&&t!==Pp&&t!==Cp&&!Tp&&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!==jp||(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),Mp=new V(rp,"BidirectionalLeft",6),Sp=new V(rp,"BidirectionalRight",7),Np=new V(rp,"Forwards",8),Pp=new V(rp,"Reverse",9),Cp=new V(rp,"Ascending",10),Tp=new V(rp,"Descending",11),Lp=new V(rp,"Optimized",12),Ap=new V(rp,"Pythagorean",13),jp=new V(rp,"Circular",14);function Fp(){this.Pl=-1/0,this.tm=this.mk=null}function Op(t){Bf.call(this,t)}function Dp(t){Vf.call(this,t),this.u=this.Si=NaN}function Bp(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===jp)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===jp?Math.max(t.width,t.height):Math.sqrt(t.width*t.width+t.height*t.height);return t.Si}function Ip(t){Gf.call(this,t)}function zp(t){Ff.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 Ep(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 qp(t),o=0;o<t.ah.length;o++){var r=t.ah[o];if(!(1<r.Vd))break;n.dh(r);var s=new Up;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 J),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 J,o.Hj=a),a.add(s),o.Vd--,o.sh+=s.sh):s.network===n&&(null===(a=s.Hj)&&(a=new J,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,Xe.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),f=null;for(r=c.edges.iterator;r.next();){var d=r.value;if(d.Ax(c)===o){f=d;break}}null!==f&&(l+=f.length,a+=c.width*c.height)}r=o.centerX,h=o.centerY,u=o.width,c=o.height,f=o.focus,1>(d=u*c)&&(d=1),s=((a=Xe.sqrt((a+d+l*l*4/(s*s))/d))-1)*u/2,a=(a-1)*c/2,o.bounds=new Dt(r-f.x-s,h-f.y-a,u+2*s,c+2*a),o.focus=new pt(f.x+s,f.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,Ep(t,e+1,i),Gp(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 Dt(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=Xe.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 f=h.height;c=Xe.sqrt(c*c+f*f)/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,f=u.y-n;if((c=c*c+f*f)<a){for(f=l-1;0<=f;f--)if(t[f].y>u.y&&t[f].x-u.x<o+s.width)continue t;for(f=l+1;f<e;f++)if(t[f].x>u.x&&t[f].y-u.y<r+s.height)continue t;h=l,a=c}}return h}function Yp(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,Xe.sqrt(i*i+t*t)):t+i<e?(n=n+o-s,t=t+i-e,Xe.sqrt(n*n+t*t)):s-(n+o):n>s+a?t>e+r?(i=n-s-a,t=t-e-r,Xe.sqrt(i*i+t*t)):t+i<e?(n=n-s-a,t=t+i-e,Xe.sqrt(n*n+t*t)):n-(s+a):t>e+r?t-(e+r):t+i<e?e-(t+i):.1}function Gp(t,e){for(t.ah=null,e=t.An+e;t.An<e&&(t.An++,Xp(t)););t.ah=null}function Xp(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 f=e[c];if(f!==s){n=f.bounds,a=f.focus,l=n.x+a.x;var d=n.y+a.y;if(h-l>i||l-h>i){if(o)break}else if(u-d>i||d-u>i){if(!o)break}else{var p=Yp(s,f);1>p?(null===(n=t.randomNumberGenerator)&&(t.randomNumberGenerator=n=new Wp),p=n.random(),a=n.random(),h>l?n=(1+(n=Math.abs(f.bounds.right-s.bounds.x)))*p:h<l?n=-(1+(n=Math.abs(f.bounds.x-s.bounds.right)))*p:n=(1+(n=Math.max(f.width,s.width)))*p-n/2,u>d?l=(1+(l=Math.abs(f.bounds.bottom-s.bounds.y)))*a:h<l?l=-(1+(l=Math.abs(f.bounds.y-s.bounds.bottom)))*a:l=(1+(l=Math.max(f.height,s.height)))*a-l/2):(n=(l-h)/p*(a=-s.charge*f.charge/(p*p)),l=(d-u)/p*a),s.forceX+=n,s.forceY+=l,f.forceX-=n,f.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=Yp(i,r))?(null===(c=t.randomNumberGenerator)&&(t.randomNumberGenerator=c=new Wp),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 Up(){this.Tv=this.Sv=this.Qs=this.Ss=this.Rs=0}function qp(t){Bf.call(this,t)}function Kp(t){Vf.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 Hp(t){Gf.call(this,t),this.j=this.o=NaN}function Wp(){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 Zp(t){Ff.call(this),this.kc=this.ie=25,this.K=0,this.Dk=Fg,this.Zk=Bg,this.Qk=Eg,this.bj=4,this.rk=Gg,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 Jp(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 $p(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 _p(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 f=n[c];f.near===u&&f.Dj===u.Dj||h++}else for(c=s-1;c>l;c--)(f=n[c]).near===u&&f.Dj===u.Dj||h++;if(0<=i)for(l=n[s].sourceEdgesArrayAccess,u=0;u<l.length;u++){var d=l[u];if(d.valid&&d.fromVertex.layer!==e)for(f=d.fromVertex.index,c=d.portToPos,d=d.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&&(f>g||f===g&&d>p)&&h++,m<c&&(g>f||g===f&&p>d)&&h++}}}if(0>=i)for(l=n[s].destinationEdgesArrayAccess,u=0;u<l.length;u++)if((d=l[u]).valid&&d.toVertex.layer!==e)for(f=d.toVertex.index,c=d.portToPos,d=d.portFromPos,a=u+1;a<l.length;a++)(p=l[a]).valid&&p.toVertex.layer!==e&&(g=p.toVertex.index,m=p.portToPos,d<(p=p.portFromPos)&&(f>g||f===g&&c>m)&&h++,p<d&&(g>f||g===f&&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((d=h[u]).valid&&d.fromVertex.layer!==e)for(f=d.fromVertex.index,d=d.portFromPos,a=0;a<x.length;a++)(p=x[a]).valid&&p.fromVertex.layer!==e&&(g=p.fromVertex.index,p=p.portFromPos,(f<g||f===g&&d<p)&&v++,(g<f||g===f&&p<d)&&y++)}if(0>=i)for(h=n[s].destinationEdgesArrayAccess,x=n[l].destinationEdgesArrayAccess,u=0;u<h.length;u++)if((d=h[u]).valid&&d.toVertex.layer!==e)for(f=d.toVertex.index,c=d.portToPos,a=0;a<x.length;a++)(p=x[a]).valid&&p.toVertex.layer!==e&&(g=p.toVertex.index,m=p.portToPos,(f<g||f===g&&c<m)&&v++,(g<f||g===f&&m<c)&&y++);r[s*o+l]=y,r[l*o+s]=v}}return jg(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 f=c.fromVertex.column+c.portFromColOffset,d=c.toVertex.column+c.portToColOffset;a+=(Math.abs(f-d)+1)*Jp(c)}}}jg(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,f=a.near;if(null!==f&&f.layer===a.layer&&(u+=f.column-1,c++),null!==h)for(f=0;f<h.length;f++){var d=(a=h[f]).fromVertex;a.valid&&!a.rev&&d.layer!==e&&(u+=d.column,c++)}if(null!==l)for(h=0;h<l.length;h++)f=(a=l[h]).toVertex,a.valid&&!a.rev&&f.layer!==e&&(u+=f.column,c++);r[s]=0===c?-1:u/c}return jg(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=[],f=a.near;if(null!==f&&f.layer===a.layer&&(c[u]=f.column-1,u++),a=void 0,null!==h)for(f=0;f<h.length;f++){var d=(a=h[f]).fromVertex;a.valid&&!a.rev&&d.layer!==e&&(c[u]=d.column+a.portFromColOffset,u++)}if(null!==l)for(h=0;h<l.length;h++)f=(a=l[h]).toVertex,a.valid&&!a.rev&&f.layer!==e&&(c[u]=f.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 jg(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 fg(t,e){if(!e.valid){e.valid=!0;for(var i=e.destinationEdges;i.next();)fg(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,f=l.sourceEdgesArrayAccess;o=f.length;for(var d=0;d<o;d++){var p=f[d],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=(f=l.destinationEdgesArrayAccess).length,d=0;d<o;d++)--u,1!==(p=f[d].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=(f=s.sourceEdgesArrayAccess).length,d=0;d<c;d++)l+=1,1!==(p=f[d].fromVertex).component?n+=1:u=!0;for(c=(f=s.destinationEdgesArrayAccess).length,d=0;d<c;d++)--l,1!==(g=(p=f[d]).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 dg(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);jg(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],f=0,d=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&&(f+=2*(n-v),d+=2*(n+1-v)),v===n+1&&(f+=1),v>n+1&&(f+=4*(v-n),d+=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&&(d+=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&&(f+=2*(n+1-v),d+=2*(n-v)),v===n&&(d+=1),v>n+1&&(f+=4*(v-(n+1)),d+=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&&(f+=1)}v=x=0,b=s[o[n].index];var w=a[o[n].index],k=s[o[n+1].index],M=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!==M&&(x+=Math.abs(M-g),v+=Math.abs(M-m)),(d<f-.5||d===f&&c<u-.5||d===f&&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 jg(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),f=t.nodeMinColumnSpace(o[n],!1),d=0;d=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>f+t.nodeMinColumnSpace(o[n+1],!0)?u+1:u;var p=f=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=Jp(y),b=y.portFromColOffset;y=y.portToColOffset,v=v.column,f+=(Math.abs(u+y-(v+b))+1)*x,p+=(Math.abs(d+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=Jp(y),b=y.portFromColOffset,y=y.portToColOffset,v=v.column,f+=(Math.abs(u+b-(v+y))+1)*x,p+=(Math.abs(d+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-d),y+=Math.abs(m-c)),-1!==v&&(x+=Math.abs(v-u),b+=Math.abs(v-d),y+=Math.abs(v-c)),p<f||p===f&&b<x?(l=h=!0,o[n].column=d):(g<f||g===f&&y<x)&&(l=h=!0,o[n].column=c)}return jg(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)}jg(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 Mg(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=$p(t),r=tg(t);for(n=r+1;r<n;){n=r,Sg(t,i,1);var s=tg(t);s>r?_p(t,o):s<r&&(r=s,o=$p(t))}}if(0>e)for(i=t.Ra;0<=i;i--)for(o=$p(t),n=(r=tg(t))+1;r<n;)n=r,Sg(t,i,-1),(s=tg(t))>r?_p(t,o):s<r&&(r=s,o=$p(t));t.normalize()}function Sg(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 Ng(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 f=c.align,d=a?c.width:c.height,p=a?f.width:f.height;if(i){var g=Zg(c,f),m=g.portFromPos,y=g.portToPos;null!==g.link&&(c.node&&c.node!==g.link.fromNode&&(m=a?c.focusX:c.focusY),f.node&&f.node!==g.link.toNode&&(y=a?f.focusX:f.focusY))}else m=(g=Zg(f,c)).portToPos,y=g.portFromPos,null!==g.link&&(c.node&&c.node!==g.link.toNode&&(m=a?c.focusX:c.focusY),f.node&&f.node!==g.link.fromNode&&(y=a?f.focusX:f.focusY));d=n?c.qg+(d-m)-(p-y):c.qg+m-y,f.qg=d,u=Math.min(u,d),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=Cg(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 dt,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=Cg(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 Cg(t,e){var i=t.Tz;return 1>(t=t.vi)&&w("Could not determine previous vertex in layer"),e[i][t-1]}function Tg(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:Fe:90===t.K?e?Fe:Le:180===t.K?e?Ae:je:e?je: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 jg(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=Mp,rp.BidirectionalRight=Sp,rp.Forwards=Np,rp.Reverse=Pp,rp.Ascending=Cp,rp.Descending=Tp,rp.Optimized=Lp,rp.Pythagorean=Ap,rp.Circular=jp,Fp.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},Fp.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]}},Fp.className="VertexArrangement",c(Op,Bf),Op.prototype.createVertex=function(){return new Dp(this)},Op.prototype.createEdge=function(){return new Ip(this)},Op.className="CircularNetwork",c(Dp,Vf),f.Object.defineProperties(Dp.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)}}}),Dp.className="CircularVertex",c(Ip,Gf),Ip.className="CircularEdge",c(zp,Ff),zp.prototype.cloneProtected=function(t){Ff.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},zp.prototype.createNetwork=function(){return new qp(this)},zp.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}Ep(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=Dt.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 f=Vp(l,a,o,r,c.width,c.height,n),d=l[f],p=new pt(d.x+c.width+n.width,d.y),g=new pt(d.x,d.y+c.height+n.height);for(f+1<a&&l.splice(f+1,0,null),l[f]=p,l[f+1]=g,a++,f=d.x-c.x,d=d.y-c.y,u=u.vertexes.iterator;u.next();)(p=u.value).centerX+=f,p.centerY+=d}for(Dt.free(c),u=e.vertexes.iterator;u.next();)f=(s=u.value).bounds,2>a?(o=f.x+f.width/2,r=f.y+f.height/2,l[0]=new pt(f.x+f.width+n.width,f.y),l[1]=new pt(f.x,f.y+f.height+n.height),a=2):(d=new pt((c=l[h=Vp(l,a,o,r,f.width,f.height,n)]).x+f.width+n.width,c.y),f=new pt(c.x,c.y+f.height+n.height),h+1<a&&l.splice(h+1,0,null),l[h]=d,l[h+1]=f,a++,s.centerX=c.x+s.width/2,s.centerY=c.y+s.height/2);for(j(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)}}Gp(this,t),this.updateParts()}this.dl=t,this.network=null,this.isValidLayout=!0},zp.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},zp.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},zp.prototype.Cu=function(){if(this.comments)for(var t=this.network.vertexes.iterator;t.next();)this.addComments(t.value)},zp.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}}},zp.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},zp.prototype.moveFixedVertex=function(){},zp.prototype.commitLayout=function(){this.yv(),this.commitNodes(),this.isRouting&&this.commitLinks()},zp.prototype.yv=function(){if(this.setsPortSpots)for(var t=this.network.edges.iterator;t.next();){var e=t.value.link;null!==e&&(e.fromSpot=Se,e.toSpot=Se)}},zp.prototype.commitNodes=function(){var t=0,e=0;if(this.arrangesToOrigin){var i=Dt.alloc();this.computeBounds(this.network,i),t=(e=this.arrangementOrigin).x-i.x,e=e.y-i.y,Dt.free(i)}i=Dt.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()}Dt.free(i)},zp.prototype.commitLinks=function(){for(var t=this.network.edges.iterator;t.next();)t.value.commit()},zp.prototype.springStiffness=function(t){return t=t.stiffness,isNaN(t)?this.Hk:t},zp.prototype.springLength=function(t){return t=t.length,isNaN(t)?this.Gk:t},zp.prototype.electricalCharge=function(t){return t=t.charge,isNaN(t)?this.Ek:t},zp.prototype.electricalFieldX=function(){return 0},zp.prototype.electricalFieldY=function(){return 0},zp.prototype.gravitationalMass=function(t){return t=t.mass,isNaN(t)?this.Fk:t},zp.prototype.gravitationalFieldX=function(){return 0},zp.prototype.gravitationalFieldY=function(){return 0},zp.prototype.isFixed=function(t){return t.isFixed},f.Object.defineProperties(zp.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())}}}),zp.className="ForceDirectedLayout",Up.className="ForceDirectedSubnet",c(qp,Bf),qp.prototype.createVertex=function(){return new Kp(this)},qp.prototype.createEdge=function(){return new Hp(this)},qp.className="ForceDirectedNetwork",c(Kp,Vf),f.Object.defineProperties(Kp.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)}}}),Kp.className="ForceDirectedVertex",c(Hp,Gf),f.Object.defineProperties(Hp.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)}}}),Hp.className="ForceDirectedEdge",Wp.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},Wp.className="RandomNumberGenerator",c(Zp,Ff),Zp.prototype.cloneProtected=function(t){Ff.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},Zp.prototype.qb=function(t){t.classType===Zp?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):Ff.prototype.qb.call(this,t)},Zp.prototype.createNetwork=function(){return new Kg(this)},Zp.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!==Dg&&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===Dg&&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 f=a.fromPort;null!==f&&!f.Ed();)f=f.panel;for(a=a.toPort;null!==a&&!a.Ed();)a=a.panel;if(n.rev){l=c;var d=f;c=h,f=a,h=l,a=d}var p=o.focus;l=r.focus;var g=n.rev?r.bounds:o.bounds;d=pt.alloc(),u!==c?g.w()&&c.isVisible()?c.actualBounds.w()?(Cu(c,f,oe,d),d.x+=c.actualBounds.x-g.x,d.y+=c.actualBounds.y-g.y):(Cu(c,f,oe,d),d.w()||d.assign(p)):d.assign(p):g.w()?(Cu(c,f,oe,d),d.w()||d.assign(p)):d.assign(p),c=n.rev?o.bounds:r.bounds,u=pt.alloc(),s!==h?c.w()&&h.isVisible()?h.actualBounds.w()?(Cu(h,a,oe,u),u.x+=h.actualBounds.x-c.x,u.y+=h.actualBounds.y-c.y):(Cu(h,a,oe,u),u.w()||u.assign(l)):u.assign(l):c.w()?(Cu(h,a,oe,u),u.w()||u.assign(l)):u.assign(l),90===this.K||270===this.K?(s=Math.round((d.x-p.x)/this.kc),h=d.x,a=Math.round((u.x-l.x)/this.kc),l=u.x):(s=Math.round((d.y-p.y)/this.kc),h=d.y,a=Math.round((u.y-l.y)/this.kc),l=u.y),pt.free(d),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(d=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(f=g.toNode,null!==v&&null!==f){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,f,y,pt.alloc()),b=g.getLinkDirection(v,m,x,w,!0,k,f,y),pt.free(x),w.ys()||b!==dg(this,n,!0)?this.setsPortSpots&&null!==v&&1===v.ports.count&&n.rev&&(c+=1):c+=1,w=g.getLinkPoint(f,y,p,!1,k,v,m,pt.alloc()),g=g.getLinkDirection(f,y,w,p,!1,k,v,m),pt.free(w),p.ys()||g!==dg(this,n,!1)?this.setsPortSpots&&null!==f&&1===f.ports.count&&n.rev&&(c+=2):c+=2)}}}if(c=1===(f=c)||3===f,(f=2===f||3===f)&&((p=t.createVertex()).node=null,p.Dj=1,p.layer=d,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--,d-u>g&&0<d){for(n.valid=!1,(p=t.createVertex()).node=null,p.Dj=2,p.layer=d-1,t.dh(p),(o=t.Zj(o,p,n.link)).valid=!0,o.rev=n.rev,o.portFromColOffset=f?0:s,o.portToColOffset=0,o.portFromPos=f?0:h,o.portToPos=0,o=p,d--;d-u>g&&0<d;)(p=t.createVertex()).node=null,p.Dj=3,p.layer=d-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,d--;(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),jg(this,t,e)}this.reduceCrossings(),this.straightenAndPack(),this.updateParts()}this.network=null,this.isValidLayout=!0},Zp.prototype.linkMinLength=function(){return 1},Zp.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},Zp.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},Zp.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},Zp.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},Zp.prototype.removeCycles=function(){for(var t=this.network.edges.iterator;t.next();)t.value.rev=!1;switch(this.Dk){default:case Og: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 Fg: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 Dg: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)}}},Zp.prototype.assignLayers=function(){switch(this.Zk){case Ig:lg(this);break;case zg: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&&fg(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)}}},Zp.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 Eg: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)}},Zp.prototype.reduceCrossings=function(){var t,e,i,n,o,r=this.countCrossings(),s=$p(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=$p(this)),e=this.Ia;0<=e;e--)mg(this,e,-1),yg(this,e,-1);(a=this.countCrossings())<r&&(r=a,s=$p(this))}for(_p(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=$p(this)),e=this.Ia;0<=e;e--)mg(this,e,0),yg(this,e,0);(a=this.countCrossings())<r&&(r=a,s=$p(this))}switch(_p(this,s),this.rk){case Yg:break;case Xg: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?_p(this,s):(r=a,s=$p(this)),i=!0;i;)for(i=!1,e=t;e>=n;e--)i=yg(this,e,1)||i;for((a=this.countCrossings())>=r?_p(this,s):(r=a,s=$p(this)),i=!0;i;)for(i=!1,e=n;e<=t;e++)i=yg(this,e,1)||i;for(a>=r?_p(this,s):(r=a,s=$p(this)),i=!0;i;)for(i=!1,e=n;e<=t;e++)i=yg(this,e,-1)||i;for(a>=r?_p(this,s):(r=a,s=$p(this)),i=!0;i;)for(i=!1,e=t;e>=n;e--)i=yg(this,e,0)||i;for(a>=r?_p(this,s):(r=a,s=$p(this)),i=!0;i;)for(i=!1,e=n;e<=t;e++)i=yg(this,e,0)||i;a>=r?_p(this,s):(r=a,s=$p(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?_p(this,s):(r=a,s=$p(this)),i=!0;i;)for(i=!1,e=t;e>=n;e--)i=yg(this,e,1)||i;for((a=this.countCrossings())>=r?_p(this,s):(r=a,s=$p(this)),i=!0;i;)for(i=!1,e=n;e<=t;e++)i=yg(this,e,1)||i;for(a>=r?_p(this,s):(r=a,s=$p(this)),i=!0;i;)for(i=!1,e=n;e<=t;e++)i=yg(this,e,-1)||i;for(a>=r?_p(this,s):(r=a,s=$p(this)),i=!0;i;)for(i=!1,e=t;e>=n;e--)i=yg(this,e,0)||i;for(a>=r?_p(this,s):(r=a,s=$p(this)),i=!0;i;)for(i=!1,e=n;e<=t;e++)i=yg(this,e,0)||i;a>=r?_p(this,s):(r=a,s=$p(this))}}_p(this,s)},Zp.prototype.straightenAndPack=function(){if(0===this.ve){var t=0!=(1&this.bg),e=0!=(this.bg&Ug);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&&(Mg(this,-1),Mg(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 _,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=Jg(u);if(0<c.length){c=null===c[0].node;break t}}c=!1}var f=c;if(l===h.length-1||f){for(c=a.length-1,f&&(c=Jg(u)[0].index);s<=l;){if(!(u=h[s]).bo){f=[];for(var d=o(u.sourceEdgesArrayAccess),p=d.next();!p.done;p=d.next())(p=p.value).valid&&f.push(p);u.bo=f}for(f=(u=o(u.bo)).next();!f.done;f=u.next())((d=(f=f.value).fromVertex.index)<r||d>c)&&e.add(f);s++}r=c}}}(e,i);var s=null,a=null,h=null,l=null,u=0!=(1&t.ve),c=0!=(2&t.ve),f=0!=(4&t.ve),d=0!=(8&t.ve);for(u&&(t.verticalAlignment(e,i,!0),s=Ng(t,e,!0,!1)),e.reverse(),f&&(t.verticalAlignment(e,i,!1),h=Ng(t,e,!1,!1)),n=o(e),r=n.next();!r.done;r=n.next())r.value.reverse();d&&(t.verticalAlignment(e,i,!1),l=Ng(t,e,!1,!0)),e.reverse(),c&&(t.verticalAlignment(e,i,!0),a=Ng(t,e,!0,!0)),j(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)),f&&e.push(h.get(t)),d&&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,j(e),t.zc=i}))}(this)},Zp.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?Jg(s):$g(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?Zg(c,s):Zg(s,c),!e.contains(u)&&r<c.vi&&(c.align=s,s.root=c.root,s.align=c.root,r=c.vi)}}}},Zp.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=Tg(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)));j(n),j(o)},Zp.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()},Zp.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()},Zp.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 Dt(0,0,i,Math.abs(this.Ta[0]))):e.push(new Dt(0,this.Ta[n-1],i,Math.abs(this.Ta[n-1]-this.Ta[n]))):90===this.K?0===n?e.push(new Dt(0,this.Ta[0],i,Math.abs(this.Ta[0]-t))):e.push(new Dt(0,this.Ta[n],i,Math.abs(this.Ta[n-1]-this.Ta[n]))):180===this.K?0===n?e.push(new Dt(0,0,Math.abs(this.Ta[0]),i)):e.push(new Dt(this.Ta[n-1],0,Math.abs(this.Ta[n-1]-this.Ta[n]),i)):0===n?e.push(new Dt(this.Ta[0],0,Math.abs(this.Ta[0]-t),i)):e.push(new Dt(this.Ta[n],0,Math.abs(this.Ta[n-1]-this.Ta[n]),i));this.commitLayers(e,this.Rf)},Zp.prototype.commitLayers=function(){},Zp.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===Zc&&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 f=!1,d=!1,p=this.ie,g=t.firstPickIndex+1;if(t.isOrthogonal){d=!0;var m=t.pointsCount;4<m&&t.points.removeRange(2,m-3)}else if(t.curve===Zc)f=!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(d)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(f)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 M=0;180===this.K||0===this.K?((180===this.K?b>=c.bounds.right:b<=c.bounds.x)&&(M=(0===this.K?-x:k)/2),t.m(g++,y+M,w)):((270===this.K?w>=c.bounds.bottom:w<=c.bounds.y)&&(M=(90===this.K?-x:k)/2),t.m(g++,b,v+M)),t.m(g++,b,w)}}else x=Math.max(10,this.he[m.layer]),k=Math.max(10,this.Ld[m.layer]),f?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||d)&&(y=t.i(g-1).x,v=t.i(g-1).y,b=t.i(g).x,w=t.i(g).y,d?(p=this.Ld[u.layer],180===this.K||0===this.K?((d=v)>=u.bounds.y&&d<=u.bounds.bottom&&(180===this.K?b>=u.bounds.x:b<=u.bounds.right)&&(c=u.centerX+(180===this.K?-p:p),d=d<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,d)),t.m(g++,b,d)):((d=y)>=u.bounds.x&&d<=u.bounds.right&&(270===this.K?w>=u.bounds.y:w<=u.bounds.bottom)&&(c=u.centerY+(270===this.K?-p:p),d=d<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++,d,c)),t.m(g++,d,w)),t.m(g++,b,w)):f?(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]),d=0,180===this.K||0===this.K?((180===this.K?b<=u.bounds.x:b>=u.bounds.right)&&(d=(0===this.K?k:-x)/2),t.m(g++,b+d,v)):((270===this.K?w<=u.bounds.y:w>=u.bounds.bottom)&&(d=(90===this.K?k:-x)/2),t.m(g++,y,w+d)),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,d?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]),f?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}d&&(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&&f&&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()},Zp.prototype.avoidOrthogonalOverlaps=function(){if(!(0>=this.linkSpacing)){for(var t=new J,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 qg;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 f=i[c];(h?f.first:f.jc)!==a&&(u++,a=h?f.first:f.jc);var d=f.link;r=d.i(f.index),s=d.i(f.index+1);var p=this.linkSpacing*(u-(l-1)/2);e++,d.uh(),d.L(f.index,r.x,r.y+p),d.L(f.index+1,s.x,s.y+p),d.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 qg).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++)f=i[c],(h?f.first:f.jc)!==a&&(u++,a=h?f.first:f.jc),r=(d=f.link).i(f.index),s=d.i(f.index+1),p=this.linkSpacing*(u-(l-1)/2),e++,d.uh(),d.L(f.index,r.x+p,r.y),d.L(f.index+1,s.x+p,s.y),d.zf()}r=o}t=n}}}},(e=Zp.prototype).Vx=function(t,e){return t instanceof qg&&e instanceof qg&&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 qg&&e instanceof qg&&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 qg&&e instanceof qg&&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]},f.Object.defineProperties(Zp.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!==Og&&t!==Fg&&t!==Dg||(this.Dk=t,this.C())}},layeringOption:{get:function(){return this.Zk},set:function(t){this.Zk===t||t!==Bg&&t!==Ig&&t!==zg||(this.Zk=t,this.C())}},initializeOption:{get:function(){return this.Qk},set:function(t){this.Qk===t||t!==Eg&&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!==Yg&&t!==Gg&&t!==Xg||(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 Fg=new V(Zp,"CycleDepthFirst",0),Og=new V(Zp,"CycleGreedy",1),Dg=new V(Zp,"CycleFromLayers",2),Bg=new V(Zp,"LayerOptimalLinkLength",0),Ig=new V(Zp,"LayerLongestPathSink",1),zg=new V(Zp,"LayerLongestPathSource",2),Eg=new V(Zp,"InitDepthFirstOut",0),Rg=new V(Zp,"InitDepthFirstIn",1),Vg=new V(Zp,"InitNaive",2),Yg=new V(Zp,"AggressiveNone",0),Gg=new V(Zp,"AggressiveLess",1),Xg=new V(Zp,"AggressiveMore",2),Ug=8;function qg(){this.index=this.Ic=this.rd=this.jc=this.first=this.layer=0,this.link=null,this.j=0}function Kg(t){Bf.call(this,t)}function Hg(t){Vf.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 Wg(t,e){return t.index-e.index}function Zg(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 Jg(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(Wg),t.co=e}return t.co}function $g(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(Wg),t.ao=e}return t.ao}function _g(t){Gf.call(this,t),this.j=this.ia=this.Ha=!1,this.V=this.u=NaN,this.F=this.o=0}function Qg(t){Ff.call(this),this.Ub=new _,this.Wn=Cm,this.ud=Tm,this.vo=Um,this.Bq=$m,this.$v=[],this.td=!0,this.Rb=Wm,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 _;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 Tm: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 Tm:if(0<e.destinationEdges.count){for(var i=new J,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 J,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===Em||t===Rm||t===Vm||t===Ym}function hm(t){return t===Em||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===Im,c=l===zm;a=am(l);var f=Math.max(0,e.breadthLimit);h=t.computeLayerSpacing(e);var d=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,M=0,S=0,N=0,P=0,C=0,T=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],j=A.Da;0==L%2&&L!==s-1?C=Math.max(C,(i?j.width:j.height)+t.computeBusNodeSpacing(A)-d):0!=L%2&&(T=Math.max(T,(i?j.width:j.height)+t.computeBusNodeSpacing(A)-d))}else 1===s&&(C=i?o[0].Da.width:o[0].Da.height);if(a)switch(l){case Em:case Rm:C=(b=135>n?cm(t,e,o,C,x,b):fm(t,e,o,C,x,b)).x,x=b.width,b=b.height;break;case Vm:for(f=0;f<s;f++)w=(g=o[f]).Da,T=0===N?0:m,i?(g.S.h(r-w.width,M+T),x=Math.max(x,w.width),b=Math.max(b,M+T+w.height),M+=T+w.height):(g.S.h(k+T,r-w.height),x=Math.max(x,k+T+w.width),b=Math.max(b,w.height),k+=T+w.width),N++;break;case Ym:for(r=0;r<s;r++)g=(f=o[r]).Da,w=0===N?0:m,i?(f.S.h(d/2+e.focus.x,M+w),x=Math.max(x,g.width),b=Math.max(b,M+w+g.height),M+=w+g.height):(f.S.h(k+w,d/2+e.focus.y),x=Math.max(x,k+w+g.width),b=Math.max(b,g.height),k+=w+g.width),N++}else for(T=0;T<s;T++)A=(L=o[T]).Da,i?(0<f&&0<N&&k+d+A.width>f&&(k<r&&ym(e,l,r-k,0,P,T-1),S++,N=0,P=T,w=b,k=0,M=135<n?-b-m:b+m),j=0===N?g:d,xm(t,L,0,M),L.S.h(k+j,M),x=Math.max(x,k+j+A.width),b=Math.max(b,w+(0===S?0:m)+A.height),k+=j+A.width):(0<f&&0<N&&M+d+A.height>f&&(M<r&&ym(e,l,0,r-M,P,T-1),S++,N=0,P=T,w=x,M=0,k=135<n?-x-m:x+m),j=0===N?g:d,xm(t,L,k,0),L.S.h(k,M+j),b=Math.max(b,M+j+A.height),x=Math.max(x,w+(0===S?0:m)+A.width),M+=j+A.height),N++;switch(0<S&&(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),M<b&&ym(e,l,0,b-M,P,s-1),0<y&&(c||vm(e,0,y,0,s-1),b+=y))),y=c=0,l){case Dm:i?c+=x/2-e.focus.x-p/2:y+=b/2-e.focus.y-p/2;break;case Bm:0<S?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 Im:i?(c-=p,x+=p):(y-=p,b+=p);break;case zm:i?(c+=x-e.width+p,x+=p):(y+=b-e.height+p,b+=p);break;case Em:case Rm:i?c+=1<s?C+d/2-e.focus.x:o[0].focus.x-e.focus.x+o[0].la.x:y+=1<s?C+d/2-e.focus.y:o[0].focus.y-e.focus.y+o[0].la.y;break;case Vm:i?c+=x+d/2-e.focus.x:y+=b+d/2-e.focus.y;break;case Ym: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 Dt(n,0,o,r);if(1===s)return new Dt(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,f=0,d=0;d<s;d++)if(!(0!=d%2||1<s&&d===s-1)){var p=i[d],g=p.Da,m=0===u?0:h;if(l){var y=t.computeBusNodeSpacing(p)-a;p.S.h(n-(g.width+y),f+m),o=Math.max(o,g.width+y),r=Math.max(r,f+m+g.height),f+=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,d=f,l?(c=n+a,f=0):(c=0,f=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,f+v),o=Math.max(o,c+y.width+x),r=Math.max(r,f+v+y.height),f+=v+y.height}else x=t.computeBusNodeSpacing(m)-a,m.S.h(c+v,f+x),o=Math.max(o,c+v+y.width),r=Math.max(r,f+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(d),Math.abs(f)):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(d,f)+t+s.height),0>i.S.x&&(n=dm(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),f=n+a/2-i.focus.y-i.la.y,r=Math.max(r,f+s.height),0>f&&(r-=f),0>i.S.y&&(n=dm(e,i.S.y,!0,n,a)))),new Dt(n,0,o,r)}function fm(t,e,i,n,o,r){var s=i.length;if(0===s)return new Dt(n,0,o,r);if(1===s)return new Dt(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,f=0,d=0;d<s;d++)if(!(0!=d%2||1<s&&d===s-1)){var p=i[d],g=p.Da,m=0===u?0:h;if(l){var y=t.computeBusNodeSpacing(p)-a;f-=m+g.height,p.S.h(n-(g.width+y),f),o=Math.max(o,g.width+y),r=Math.max(r,Math.abs(f))}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,d=f,l?(c=n+a,f=0):(c=0,f=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;f-=v+y.height,m.S.h(c+x,f),o=Math.max(o,c+y.width+x),r=Math.max(r,Math.abs(f))}else x=t.computeBusNodeSpacing(m)-a,c-=v+y.width,m.S.h(c,f+x),r=Math.max(r,f+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(d),Math.abs(f)):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(d,f))+t+u.height),0>h.S.x&&(n=dm(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),f=n+a/2-h.focus.y-h.la.y,r=Math.max(r,f+u.height),0>f&&(r-=f),0>h.S.y&&(n=dm(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 Dt(n,0,o,r)}function dm(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 Bm:case Dm:return i+t.width>e&&(e=i+t.width),0>i&&(e-=i),e;case Im:return t.width>e?t.width:e;case zm:return 2*t.focus.x>e?t.width:e+t.width-2*t.focus.x;case Em: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 Ym:return Math.max(t.width,t.focus.x+t.nodeSpacing/2+e);default:return e}}function gm(t,e,i){switch(t.alignment){case Bm:case Dm:return i+t.height>e&&(e=i+t.height),0>i&&(e-=i),e;case Im:return t.height>e?t.height:e;case zm:return 2*t.focus.y>e?t.height:e+t.height-2*t.focus.y;case Em: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 Ym:return Math.max(t.height,t.focus.y+t.nodeSpacing/2+e);default:return e}}function mm(t,e,i){switch(t){case Dm:case Bm:e/=2,i/=2;break;case Im:i=e=0;break;case zm: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 Tm: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 f=s,d=i.Yo,p=i.kp;s=i.Da;var g=l?Math.max(f,s.height):Math.max(n,s.width);if(null!==d&&h===Pm(i)||(d=km(t,2),p=km(t,2),l?(d[0].h(0,0),d[1].h(0,s.height),p[0].h(s.width,0),p[1].h(p[0].x,d[1].y)):(d[0].h(0,0),d[1].h(s.width,0),p[0].h(0,s.height),p[1].h(d[1].x,p[0].y))),l){if(f=9999999,!(null===c||2>c.length||null===d||2>d.length))for(o=i=0;i<c.length&&o<d.length;){r=c[i];var m=d[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<d.length&&(m=(v=d[o+1]).x,v=v.y,m+=n);var x=f;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<f&&(f=x),y.y<=r.y?i++:v<=l?o++:(y.y<=v&&i++,v<=y.y&&o++)}if(f=n-f,i=d,o=f+=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]);Mm(t,u),n=i}if(r=p,h=f,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]);Mm(t,u),o=r}return r=Math.max(0,f)+s.width,s=g,Mm(t,e),Mm(t,d),Mm(t,c),Mm(t,p),a[0]=n,a[1]=o,new Dt(f,0,r,s)}if(n=9999999,!(null===c||2>c.length||null===d||2>d.length))for(o=i=0;i<c.length&&o<d.length;)r=c[i],h=(m=d[o]).x,l=m.y,l+=f,y=r,i+1<c.length&&(y=c[i+1]),m=(v=m).x,v=v.y,o+1<d.length&&(m=(v=d[o+1]).x,v=v.y,v+=f),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(f-=n,i=d,o=f+=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]);Mm(t,u),n=i}if(r=p,h=f,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]);Mm(t,u),o=r}return r=g,s=Math.max(0,f)+s.height,Mm(t,e),Mm(t,d),Mm(t,c),Mm(t,p),a[0]=n,a[1]=o,new Dt(f,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 Mm(t,e){var i=e.length,n=t.ru[i];void 0===n&&(n=[],t.ru[i]=n),n.push(e)}function Sm(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];Sm(t,s,i+s.S.x,n+s.S.y)}}}function Nm(t,e){if(null!==e){t.setPortSpots(e);for(var i=(e=e.children).length,n=0;n<i;n++)Nm(t,e[n])}}function Pm(t){return 45>=(t=t.angle)?0:135>=t?90:225>=t?180:315>=t?270:0}Zp.className="LayeredDigraphLayout",Zp.CycleDepthFirst=Fg,Zp.CycleGreedy=Og,Zp.CycleFromLayers=Dg,Zp.LayerOptimalLinkLength=Bg,Zp.LayerLongestPathSink=Ig,Zp.LayerLongestPathSource=zg,Zp.InitDepthFirstOut=Eg,Zp.InitDepthFirstIn=Rg,Zp.InitNaive=Vg,Zp.AggressiveNone=Yg,Zp.AggressiveLess=Gg,Zp.AggressiveMore=Xg,Zp.PackNone=0,Zp.PackExpand=1,Zp.PackStraighten=2,Zp.PackMedian=4,Zp.PackAll=15,Zp.AlignNone=0,Zp.AlignUpperLeft=1,Zp.AlignUpperRight=2,Zp.AlignLowerLeft=4,Zp.AlignLowerRight=8,Zp.AlignAll=15,qg.className="SegInfo",c(Kg,Bf),Kg.prototype.createVertex=function(){return new Hg(this)},Kg.prototype.createEdge=function(){return new _g(this)},Kg.className="LayeredDigraphNetwork",c(Hg,Vf),Hg.prototype.Cl=function(t){Vf.prototype.Cl.call(this,t),this.bo=this.co=null},Hg.prototype.Kl=function(t){Vf.prototype.Kl.call(this,t),this.bo=this.co=null},Hg.prototype.zl=function(t){Vf.prototype.zl.call(this,t),this.$n=this.ao=null},Hg.prototype.Jl=function(t){Vf.prototype.Jl.call(this,t),this.$n=this.ao=null},f.Object.defineProperties(Hg.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)}}}),Hg.prototype.deleteDestinationEdge=Hg.prototype.Jl,Hg.prototype.addDestinationEdge=Hg.prototype.zl,Hg.prototype.deleteSourceEdge=Hg.prototype.Kl,Hg.prototype.addSourceEdge=Hg.prototype.Cl,Hg.className="LayeredDigraphVertex",c(_g,Gf),f.Object.defineProperties(_g.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)}}}),_g.className="LayeredDigraphEdge",c(Qg,Ff),Qg.prototype.cloneProtected=function(t){Ff.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):Ff.prototype.qb.call(this,t)},Qg.prototype.createNetwork=function(){return new ty(this)},Qg.prototype.makeNetwork=function(t){function e(t){if(t instanceof Zu)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 To?(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!==Jm&&(this.arrangementOrigin=this.initialOrigin(this.arrangementOrigin));var e=this.diagram;if(null===e&&t instanceof To&&(e=t),this.path===Cm&&null!==e?this.ud=e.isTreePathToChildren?Tm:Lm:this.ud=this.path===Cm?Tm: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 _,e=this.Ub.iterator;e.next();){var i=e.value;i instanceof Zu?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===_m)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 _,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 Tm: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 Um:return null!==e.parent?e.parent:t.W;case Hm:return null===e.parent?t.W:null===e.parent.parent?t.Y:e.parent;case Km:return null!==e.parent?null!==e.parent.parent?e.parent.parent:t.Y:t.W;case qm: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 jm:t.children.reverse();break;case Fm:t.children.sort(t.comparer);break;case Om: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=Dt.allocAt(0,0,t.bounds.width+r,t.bounds.height+s),t.bounds=o,Dt.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(),f=0;f<u;f++){var d=l[f],p=d.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),d.move(c),d=d.Sd();d.next();){var g=d.value;g.fromSpot=Ae,g.toSpot=je}else for(c.h(t.bounds.x+2*t.focus.x-t.commentMargin,t.bounds.y+h),d.move(c),d=d.Sd();d.next();)(g=d.value).fromSpot=je,g.toSpot=Ae;else if(0<=t.commentMargin)for(c.h(t.bounds.x+2*t.focus.x+t.commentMargin,t.bounds.y+h),d.move(c),d=d.Sd();d.next();)(g=d.value).fromSpot=je,g.toSpot=Ae;else for(c.h(t.bounds.x+t.commentMargin-p.width,t.bounds.y+h),d.move(c),d=d.Sd();d.next();)(g=d.value).fromSpot=Ae,g.toSpot=je;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),d.move(c),d=d.Sd();d.next();)(g=d.value).fromSpot=Le,g.toSpot=Fe;else for(c.h(t.bounds.x+h,t.bounds.y+2*t.focus.y-t.commentMargin),d.move(c),d=d.Sd();d.next();)(g=d.value).fromSpot=Fe,g.toSpot=Le;else if(0<=t.commentMargin)for(c.h(t.bounds.x+h,t.bounds.y+2*t.focus.y+t.commentMargin),d.move(c),d=d.Sd();d.next();)(g=d.value).fromSpot=Fe,g.toSpot=Le;else for(c.h(t.bounds.x+h,t.bounds.y+t.commentMargin-p.height),d.move(c),d=d.Sd();d.next();)(g=d.value).fromSpot=Le,g.toSpot=Fe;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===Tm)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 Gm:um(this,t);break;case Xm: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===Im;var l=h===zm,u=am(h),c=Math.max(0,t.breadthLimit);i=this.computeLayerSpacing(t);var f=t.nodeSpacing,d=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,M=0,S=0,N=0,P=0,C=0,T=0,L=0,F=0;if(u&&!hm(h)&&135<o&&s.reverse(),hm(h))if(1<a)for(var O=0;O<a;O++)0==O%2&&O!==a-1&&(F=Math.max(F,e?s[O].Da.width:s[O].Da.height));else 1===a&&(F=e?s[0].Da.width:s[0].Da.height);if(u){switch(h){case Em:F=(v=135>o?cm(this,t,s,F,y,v):fm(this,t,s,F,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===T?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(N+x,r-c.height),y=Math.max(y,N+x+c.width),v=Math.max(v,c.height),N+=x+c.width),T++;break;case Ym:for(b=0;b<a;b++)r=(k=s[b]).Da,c=0===T?0:p,e?(k.S.h(f/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(N+c,f/2+t.focus.y),y=Math.max(y,N+c+r.width),v=Math.max(v,r.height),N+=c+r.width),T++}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(O=0;O<a;O++){var D=s[O],B=D.Da;if(e){0<c&&0<T&&N+f+B.width>c&&(N<r&&ym(t,h,r-N,0,L,O-1),C++,T=0,L=O,x=v,N=0,P=135<o?-v-p:v+p),xm(this,D,0,P);var I=0;if(0===T)b=D.Yo,k=D.kp,M=B.width,S=B.height,(null===b||null===k||o!==Pm(D))&&(b=km(this,2),k=km(this,2),b[0].h(0,0),b[1].h(0,S),k[0].h(M,0),k[1].h(M,S));else{var z=A();I=(S=wm(this,t,D,b,k,M,S,z)).x,b=z[0],k=z[1],M=S.width,S=S.height,j(z),N<B.width&&0>I&&(vm(t,-I,0,L,O-1),bm(b,-I,0),bm(k,-I,0),I=0)}D.S.h(I,P),y=Math.max(y,M),v=Math.max(v,x+(0===C?0:p)+B.height),N=M}else 0<c&&0<T&&P+f+B.height>c&&(P<r&&ym(t,h,0,r-P,L,O-1),C++,T=0,L=O,x=y,P=0,N=135<o?-y-p:y+p),xm(this,D,N,0),I=0,0===T?(b=D.Yo,k=D.kp,M=B.width,S=B.height,(null===b||null===k||o!==Pm(D))&&(b=km(this,2),k=km(this,2),b[0].h(0,0),b[1].h(M,0),k[0].h(0,S),k[1].h(M,S))):(I=(S=wm(this,t,D,b,k,M,S,z=A())).x,b=z[0],k=z[1],M=S.width,S=S.height,j(z),P<B.height&&0>I&&(vm(t,0,-I,L,O-1),bm(b,0,-I),bm(k,0,-I),I=0)),D.S.h(N,I),v=Math.max(v,S),y=Math.max(y,x+(0===C?0:p)+B.width),P=S;T++}switch(0<C&&(e?(v+=Math.max(0,i),N<y&&ym(t,h,y-N,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 Dm:e?l+=y/2-t.focus.x-d/2:g+=v/2-t.focus.y-d/2;break;case Bm:0<C?e?l+=y/2-t.focus.x-d/2:g+=v/2-t.focus.y-d/2:e?l+=(F=s[0].S.x+s[0].la.x)+(s[a-1].S.x+s[a-1].la.x+2*s[a-1].focus.x-F)/2-t.focus.x-d/2:g+=(F=s[0].S.y+s[0].la.y)+(s[a-1].S.y+s[a-1].la.y+2*s[a-1].focus.y-F)/2-t.focus.y-d/2;break;case Im:e?(l-=d,y+=d):(g-=d,v+=d);break;case zm:e?(l+=y-t.width+d,y+=d):(g+=v-t.height+d,v+=d);break;case Em:e?l+=1<a?F+f/2-t.focus.x:s[0].focus.x-t.focus.x+s[0].la.x:g+=1<a?F+f/2-t.focus.y:s[0].focus.y-t.focus.y+s[0].la.y;break;case Vm:e?l+=y+f/2-t.focus.x:g+=v+f/2-t.focus.y;break;case Ym:break;default:l=(v=this.customAlignment(t,l,g,y,v))[0],g=v[1],y=v[2],v=v[3]}for(d=0;d<a;d++)F=s[d],e?F.S.h(F.S.x+F.la.x-l,F.S.y+(135<o?(u?-v:-F.Da.height)+F.la.y-i:m+i+F.la.y)):F.S.h(F.S.x+(135<o?(u?-y:-F.Da.width)+F.la.x-i:n+i+F.la.x),F.S.y+F.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===Ym&&(s+=f/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===Ym&&(a+=f/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<C)o=km(this,4),C=km(this,4),e?(o[2].h(0,m+i),o[3].h(o[2].x,v),C[2].h(y,o[2].y),C[3].h(C[2].x,o[3].y)):(o[2].h(n+i,0),o[3].h(y,o[2].y),C[2].h(o[2].x,v),C[3].h(o[3].x,C[2].y));else{for(o=km(this,b.length+2),C=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],C[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])),C[0].h(l+n,0),C[1].h(C[0].x,m),C[2].y<C[1].y&&(C[2].x<C[0].x?C[2].assign(C[1]):C[1].assign(C[2])),C[3].y<C[2].y&&(C[3].x<C[0].x?C[3].assign(C[2]):C[2].assign(C[3])),o[2].y-=i/2,C[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])),C[0].h(0,g+m),C[1].h(n,C[0].y),C[2].x<C[1].x&&(C[2].y<C[0].y?C[2].assign(C[1]):C[1].assign(C[2])),C[3].x<C[2].x&&(C[3].y<C[0].y?C[3].assign(C[2]):C[2].assign(C[3])),o[2].x-=i/2,C[2].x-=i/2),Mm(this,b),Mm(this,k),t.Yo=o,t.kp=C,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===Jm)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),Sm(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 jm:t.reverse();break;case Fm:t.sort(this.comparer);break;case Om: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(Sm(this,o,e+o.la.x,i+o.la.y),this.Rb){case Wm:i+=o.Da.height+this.$d.height;break;case Zm: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 Dt(0,r,i,a))):90===this.angle?(o.push(new Dt(0,r,i,a)),r+=a):180===this.angle?(r-=a,o.push(new Dt(r,0,a,i))):(o.push(new Dt(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&&Nm(this,e)}},Qg.prototype.setPortSpots=function(t){var e=t.alignment;if(am(e)){var i=this.ud===Tm,n=Pm(t);switch(n){case 0:var o=je;break;case 90:o=Fe;break;case 180:o=Ae;break;default:o=Le}var r=t.children,s=r.length;switch(e){case Em: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=je;break;default:h=Fe}else 0==e%2&&(h=90===n||270===n?je:Fe);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?je:Fe,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 Ym: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===Tm){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=je;break;case 90:n.fromSpot=Fe;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=je;break;default:n.toSpot=Fe}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=je;break;case 90:n.toSpot=Fe;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=je;break;default:n.fromSpot=Fe}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)},f.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!==Um&&t!==Km&&t!==qm&&t!==Hm||(this.vo=t,this.C())}},layerStyle:{get:function(){return this.Bq},set:function(t){this.Rb===t||t!==$m&&t!==_m&&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!==Wm&&t!==Zm&&t!==Jm||(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!==jm&&t!==Fm&&!Om||(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!==Gm&&t!==Xm||(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!==jm&&t!==Fm&&!Om||(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!==Gm&&t!==Xm||(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 Cm=new V(Qg,"PathDefault",-1),Tm=new V(Qg,"PathDestination",0),Lm=new V(Qg,"PathSource",1),Am=new V(Qg,"SortingForwards",10),jm=new V(Qg,"SortingReverse",11),Fm=new V(Qg,"SortingAscending",12),Om=new V(Qg,"SortingDescending",13),Dm=new V(Qg,"AlignmentCenterSubtrees",20),Bm=new V(Qg,"AlignmentCenterChildren",21),Im=new V(Qg,"AlignmentStart",22),zm=new V(Qg,"AlignmentEnd",23),Em=new V(Qg,"AlignmentBus",24),Rm=new V(Qg,"AlignmentBusBranching",25),Vm=new V(Qg,"AlignmentTopLeftBus",26),Ym=new V(Qg,"AlignmentBottomRightBus",27),Gm=new V(Qg,"CompactionNone",30),Xm=new V(Qg,"CompactionBlock",31),Um=new V(Qg,"StyleLayered",40),qm=new V(Qg,"StyleLastParents",41),Km=new V(Qg,"StyleAlternating",42),Hm=new V(Qg,"StyleRootOnly",43),Wm=new V(Qg,"ArrangementVertical",50),Zm=new V(Qg,"ArrangementHorizontal",51),Jm=new V(Qg,"ArrangementFixedRoots",52),$m=new V(Qg,"LayerIndividual",60),_m=new V(Qg,"LayerSiblings",61),Qm=new V(Qg,"LayerUniform",62);function ty(t){Bf.call(this,t)}function ey(t){Vf.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=Yf,this.Kb=0,this.Jb=Bm,this.Vq=this.Uq=0,this.Wq=20,this.ie=50,this.Aq=0,this.Hp=Xm,this.Ap=0,this.nr=25,this.Gp=this.mr=10,this.Fp=20,this.xr=!0,this.dr=Se,this.wr=!0,this.Dp=Se}function iy(t){Gf.call(this,t),this.$t=new pt(0,0)}Qg.className="TreeLayout",Qg.PathDefault=Cm,Qg.PathDestination=Tm,Qg.PathSource=Lm,Qg.SortingForwards=Am,Qg.SortingReverse=jm,Qg.SortingAscending=Fm,Qg.SortingDescending=Om,Qg.AlignmentCenterSubtrees=Dm,Qg.AlignmentCenterChildren=Bm,Qg.AlignmentStart=Im,Qg.AlignmentEnd=zm,Qg.AlignmentBus=Em,Qg.AlignmentBusBranching=Rm,Qg.AlignmentTopLeftBus=Vm,Qg.AlignmentBottomRightBus=Ym,Qg.CompactionNone=Gm,Qg.CompactionBlock=Xm,Qg.StyleLayered=Um,Qg.StyleLastParents=qm,Qg.StyleAlternating=Km,Qg.StyleRootOnly=Hm,Qg.ArrangementVertical=Wm,Qg.ArrangementHorizontal=Zm,Qg.ArrangementFixedRoots=Jm,Qg.LayerIndividual=$m,Qg.LayerSiblings=_m,Qg.LayerUniform=Qm,c(ty,Bf),ty.prototype.createVertex=function(){return new ey(this)},ty.prototype.createEdge=function(){return new iy(this)},ty.className="TreeNetwork",c(ey,Vf),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)},f.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,Gf),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 Tm: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===Zc,u=t.isOrthogonal;if(t.uh(),u||l){for(h=2;4<t.pointsCount;)t.pv(2);var c=t.i(1),f=t.i(2)}else{for(h=1;3<t.pointsCount;)t.pv(1);c=t.i(0),f=t.i(t.pointsCount-1)}var d=t.i(t.pointsCount-1);0===r?(i.alignment===zm?(r=n.bottom+o.y,0===o.y&&c.y>d.y+i.rowIndent&&(r=Math.min(r,Math.max(c.y,r-e.computeNodeIndent(i))))):i.alignment===Im?(r=n.top+o.y,0===o.y&&c.y<d.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,f.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,f.y))):90===r?(i.alignment===zm?(r=n.right+o.x,0===o.x&&c.x>d.x+i.rowIndent&&(r=Math.min(r,Math.max(c.x,r-e.computeNodeIndent(i))))):i.alignment===Im?(r=n.left+o.x,0===o.x&&c.x<d.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,f.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,f.x,t.i(h-1).y))):180===r?(i.alignment===zm?(r=n.bottom+o.y,0===o.y&&c.y>d.y+i.rowIndent&&(r=Math.min(r,Math.max(c.y,r-e.computeNodeIndent(i))))):i.alignment===Im?(r=n.top+o.y,0===o.y&&c.y<d.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,f.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,f.y))):270===r?(i.alignment===zm?(r=n.right+o.x,0===o.x&&c.x>d.x+i.rowIndent&&(r=Math.min(r,Math.max(c.x,r-e.computeNodeIndent(i))))):i.alignment===Im?(r=n.left+o.x,0===o.x&&c.x<d.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,f.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,f.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===Zc,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()))}}},f.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 dn,this.mouseDownTools),this.gb("Resizing",new fn,this.mouseDownTools),this.gb("Linking",new Qi,this.mouseMoveTools),this.gb("Dragging",new Ti,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 dh),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),Er.add("GraphLinksModel",ud),Er.add("TreeModel",pd);var ny=m.go,oy={get licenseKey(){return To.licenseKey},set licenseKey(t){To.licenseKey=t},get version(){return To.version},Group:gc,EnumValue:V,List:J,Set:_,Map:dt,Point:pt,Size:At,Rect:Dt,Margin:Wt,Spot:Ie,Geometry:Ue,PathFigure:_e,PathSegment:Qe,InputEvent:hi,DiagramEvent:li,ChangedEvent:ui,Model:md,GraphLinksModel:Hd,TreeModel:op,Binding:Gd,Transaction:gi,UndoManager:mi,CommandHandler:As,Tool:vi,DraggingTool:Ti,DraggingInfo:us,DraggingOptions:Ms,LinkingBaseTool:Wi,LinkingTool:Qi,RelinkingTool:on,LinkReshapingTool:sn,ResizingTool:fn,RotatingTool:dn,ClickSelectingTool:pn,ActionTool:gn,ClickCreatingTool:mn,HTMLInfo:xn,ContextMenuTool:wn,DragSelectingTool:yn,PanningTool:vn,TextEditingTool:Ln,ToolManager:xi,Animation:ho,AnimationManager:qn,AnimationTrigger:vo,Layer:So,Diagram:To,Palette:Ss,Overview:Ps,Brush:Ia,GraphObject:Os,Panel:Ch,RowColumnDefinition:hl,Shape:pl,TextBlock:Pl,Picture:ou,Part:ku,Adornment:Hu,Node:Zu,Link:wc,Placeholder:bc,Layout:Ff,LayoutNetwork:Bf,LayoutVertex:Vf,LayoutEdge:Gf,GridLayout:Xf,PanelLayout:ch,CircularLayout:rp,CircularNetwork:Op,CircularVertex:Dp,CircularEdge:Ip,ForceDirectedLayout:zp,ForceDirectedNetwork:qp,ForceDirectedVertex:Kp,ForceDirectedEdge:Hp,LayeredDigraphLayout:Zp,LayeredDigraphNetwork:Kg,LayeredDigraphVertex:Hg,LayeredDigraphEdge:_g,TreeLayout:Qg,TreeNetwork:ty,TreeVertex:ey,TreeEdge:iy};"object"==typeof ny&&ny.version&&S("WARNING: a `go` object on the root object is already defined. "+("Debug"in ny?"debug ":"")+"version: "+ny.version+", replaced with version: "+oy.version),To.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,n.EnumValue,n.List,n.Set,n.Map,n.Point),r=n.Size,s=n.Rect,a=(n.Margin,n.Spot),h=(n.Geometry,n.PathFigure,n.PathSegment,n.InputEvent,n.DiagramEvent,n.ChangedEvent),l=n.Model,u=n.GraphLinksModel,c=(n.TreeModel,n.Binding),f=(n.Transaction,n.UndoManager,n.CommandHandler,n.Tool,n.DraggingTool),d=(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),p=(n.Palette,n.Overview),g=n.Brush,m=n.GraphObject,y=n.Panel,v=(n.RowColumnDefinition,n.Shape),x=n.TextBlock,b=(n.TextBlockMetrics,n.Picture,n.Part,n.Adornment,n.Node),w=n.Link,k=(n.Placeholder,n.Layout,n.LayoutNetwork,n.LayoutVertex,n.LayoutEdge,n.GridLayout,n.PanelLayout,n.CircularLayout,n.CircularNetwork,n.CircularVertex,n.CircularEdge,n.ForceDirectedLayout),M=(n.ForceDirectedNetwork,n.ForceDirectedVertex,n.ForceDirectedEdge,n.LayeredDigraphLayout,n.LayeredDigraphNetwork,n.LayeredDigraphVertex,n.LayeredDigraphEdge,n.TreeLayout);n.TreeNetwork,n.TreeVertex,n.TreeEdge,n.version},4811:function(t,e,i){var n=i(22652);function o(){return"undefined"!=typeof Reflect&&Reflect.get?(t.exports=o=Reflect.get.bind(),t.exports.__esModule=!0,t.exports.default=t.exports):(t.exports=o=function(t,e,i){var o=n(t,e);if(o){var r=Object.getOwnPropertyDescriptor(o,e);return r.get?r.get.call(arguments.length<3?t:i):r.value}},t.exports.__esModule=!0,t.exports.default=t.exports),o.apply(this,arguments)}t.exports=o,t.exports.__esModule=!0,t.exports.default=t.exports},22652:function(t,e,i){var n=i(34577);t.exports=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=n(t)););return t},t.exports.__esModule=!0,t.exports.default=t.exports}}]); |