-
Notifications
You must be signed in to change notification settings - Fork 0
/
go.js
2142 lines (2142 loc) · 874 KB
/
go.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
* GoJS v2.1.15 JavaScript Library for HTML Diagrams, https://gojs.net
* GoJS and Northwoods Software are registered trademarks of Northwoods Software Corporation, https://www.nwoods.com.
* Copyright (C) 1998-2020 by Northwoods Software Corporation. All Rights Reserved.
* THIS SOFTWARE IS LICENSED. THE LICENSE AGREEMENT IS AT: https://gojs.net/2.1.15/license.html.
* DO NOT MODIFY THIS FILE. DO NOT DISTRIBUTE A MODIFIED COPY OF THE CONTENTS OF THIS FILE.
*/
(function() { var t;function aa(a){var b=0;return function(){return b<a.length?{done:!1,value:a[b++]}:{done:!0}}}function ba(a){var b="undefined"!=typeof Symbol&&Symbol.iterator&&a[Symbol.iterator];return b?b.call(a):{next:aa(a)}}function da(a){for(var b,c=[];!(b=a.next()).done;)c.push(b.value);return c}var ea="function"==typeof Object.create?Object.create:function(a){function b(){}b.prototype=a;return new b},fa;
if("function"==typeof Object.setPrototypeOf)fa=Object.setPrototypeOf;else{var ha;a:{var ia={a:!0},ja={};try{ja.__proto__=ia;ha=ja.a;break a}catch(a){}ha=!1}fa=ha?function(a,b){a.__proto__=b;if(a.__proto__!==b)throw new TypeError(a+" is not extensible");return a}:null}var ka=fa;
function la(a,b){a.prototype=ea(b.prototype);a.prototype.constructor=a;if(ka)ka(a,b);else for(var c in b)if("prototype"!=c)if(Object.defineProperties){var d=Object.getOwnPropertyDescriptor(b,c);d&&Object.defineProperty(a,c,d)}else a[c]=b[c];a.LA=b.prototype}var ma="undefined"!=typeof window&&window===self?self:"undefined"!=typeof global&&null!=global?global:self,na="function"==typeof Object.defineProperties?Object.defineProperty:function(a,b,c){a!=Array.prototype&&a!=Object.prototype&&(a[b]=c.value)};
function oa(a){if(a){for(var b=ma,c=["Array","prototype","fill"],d=0;d<c.length-1;d++){var e=c[d];e in b||(b[e]={});b=b[e]}c=c[c.length-1];d=b[c];a=a(d);a!=d&&null!=a&&na(b,c,{writable:!0,value:a})}}oa(function(a){return a?a:function(a,c,d){var b=this.length||0;0>c&&(c=Math.max(0,b+c));if(null==d||d>b)d=b;d=Number(d);0>d&&(d=Math.max(0,b+d));for(c=Number(c||0);c<d;c++)this[c]=a;return this}});var x="object"===typeof self&&self.self===self&&self||"object"===typeof global&&global.global===global&&global||"object"===typeof window&&window.window===window&&window||{};void 0===x.requestAnimationFrame&&(x.requestAnimationFrame=x.setImmediate);function qa(){}function ra(a,b){var c=-1;return function(){var d=this,e=arguments;-1!==c&&x.clearTimeout(c);c=sa(function(){c=-1;a.apply(d,e)},b)}}function sa(a,b){return x.setTimeout(a,b)}function ta(a){return x.document.createElement(a)}
function B(a){throw Error(a);}function ua(a,b){a="The object is frozen, so its properties cannot be set: "+a.toString();void 0!==b&&(a+=" to value: "+b);B(a)}function va(a,b,c,d){c=null===c?"*":"string"===typeof c?c:"function"===typeof c&&"string"===typeof c.className?c.className:"";void 0!==d&&(c+="."+d);B(c+" is not in the range "+b+": "+a)}function wa(a){x.console&&x.console.log(a)}
function ya(){x.console&&x.console.log("Warning: List/Map/Set constructors no longer take an argument that enforces type.Instead they take an optional collection of Values to add to the collection. See 2.0 changelog for details.")}function za(a){return"object"===typeof a&&null!==a}function Aa(a){return Array.isArray(a)||x.NodeList&&a instanceof x.NodeList||x.HTMLCollection&&a instanceof x.HTMLCollection}function Ba(a){return Array.prototype.slice.call(a)}
function Ca(a,b,c){Array.isArray(a)?b>=a.length?a.push(c):a.splice(b,0,c):B("Cannot insert an object into an HTMLCollection or NodeList: "+c+" at "+b)}function Da(a,b){Array.isArray(a)?b>=a.length?a.pop():a.splice(b,1):B("Cannot remove an object from an HTMLCollection or NodeList at "+b)}function Fa(){var a=Ga.pop();return void 0===a?[]:a}function Ha(a){a.length=0;Ga.push(a)}
function Ia(a){if("function"===typeof a){if(a.className)return a.className;if(a.name)return a.name;var b=a.toString();b=b.substring(9,b.indexOf("(")).trim();if(""!==b)return a._className=b}else if(za(a)&&a.constructor)return Ia(a.constructor);return typeof a}
function Ja(a){var b=a;za(a)&&(a.text?b=a.text:a.name?b=a.name:void 0!==a.key?b=a.key:void 0!==a.id?b=a.id:a.constructor===Object&&(a.Text?b=a.Text:a.Name?b=a.Name:void 0!==a.Key?b=a.Key:void 0!==a.Id?b=a.Id:void 0!==a.ID&&(b=a.ID)));return void 0===b?"undefined":null===b?"null":b.toString()}function Ka(a,b){if(a.hasOwnProperty(b))return!0;for(a=Object.getPrototypeOf(a);a&&a!==Function;){if(a.hasOwnProperty(b))return!0;var c=a.FA;if(c&&c[b])return!0;a=Object.getPrototypeOf(a)}return!1}
function La(a,b,c){Object.defineProperty(Oa.prototype,a,{get:b,set:c})}function Pa(){var a=Qa;if(0===a.length)for(var b=x.document.getElementsByTagName("canvas"),c=b.length,d=0;d<c;d++){var e=b[d];e.parentElement&&e.parentElement.B&&a.push(e.parentElement.B)}return a}
function Ra(a){for(var b=[],c=0;256>c;c++)b["0123456789abcdef".charAt(c>>4)+"0123456789abcdef".charAt(c&15)]=String.fromCharCode(c);a.length%2&&(a="0"+a);c=[];for(var d=0,e=0;e<a.length;e+=2)c[d++]=b[a.substr(e,2)];a=c.join("");a=""===a?"0":a;b=[];for(c=0;256>c;c++)b[c]=c;for(c=d=0;256>c;c++)d=(d+b[c]+119)%256,e=b[c],b[c]=b[d],b[d]=e;d=c=0;for(var f="",g=0;g<a.length;g++)c=(c+1)%256,d=(d+b[c])%256,e=b[c],b[c]=b[d],b[d]=e,f+=String.fromCharCode(a.charCodeAt(g)^b[(b[c]+b[d])%256]);return f}
var Sa=void 0!==x.navigator&&0<x.navigator.userAgent.indexOf("MSIE 9.0"),Ta=void 0!==x.navigator&&0<x.navigator.userAgent.indexOf("MSIE 10.0"),Ua=void 0!==x.navigator&&0<x.navigator.userAgent.indexOf("Trident/7"),Va=void 0!==x.navigator&&0<x.navigator.userAgent.indexOf("Edge/"),Wa=void 0!==x.navigator&&void 0!==x.navigator.platform&&0<=x.navigator.platform.toUpperCase().indexOf("MAC"),Xa=void 0!==x.navigator&&void 0!==x.navigator.platform&&null!==x.navigator.platform.match(/(iPhone|iPod|iPad)/i),
Ga=[];Object.freeze([]);var Qa=[];qa.className="Util";qa.Dx="32ab5ff3b26f42dc0ed90f21442913b5";qa.adym="gojs.net";qa.vfo="28e647fdb263";qa.className="Util";function D(a,b,c){Ya(this);this.l=a;this.Qa=b;this.v=c}D.prototype.toString=function(){return"EnumValue."+this.Qa};function Za(a,b){return void 0===b||null===b||""===b?null:a[b]}
ma.Object.defineProperties(D.prototype,{classType:{get:function(){return this.l}},name:{get:function(){return this.Qa}},value:{get:function(){return this.v}}});D.className="EnumValue";function cb(){this.Ow=[]}cb.prototype.toString=function(){return this.Ow.join("")};cb.prototype.add=function(a){""!==a&&this.Ow.push(a)};cb.className="StringBuilder";function db(){}db.className="PropertyCollection";
function eb(){}eb.prototype.reset=function(){};eb.prototype.next=function(){return!1};eb.prototype.ed=function(){return!1};eb.prototype.first=function(){return null};eb.prototype.any=function(){return!1};eb.prototype.all=function(){return!0};eb.prototype.each=function(){return this};eb.prototype.map=function(){return this};eb.prototype.filter=function(){return this};eb.prototype.Cd=function(){};eb.prototype.toString=function(){return"EmptyIterator"};
ma.Object.defineProperties(eb.prototype,{iterator:{get:function(){return this}},count:{get:function(){return 0}}});eb.prototype.first=eb.prototype.first;eb.prototype.hasNext=eb.prototype.ed;eb.prototype.next=eb.prototype.next;eb.prototype.reset=eb.prototype.reset;var fb=null;eb.className="EmptyIterator";fb=new eb;function gb(a){this.key=-1;this.value=a}gb.prototype.reset=function(){this.key=-1};
gb.prototype.next=function(){return-1===this.key?(this.key=0,!0):!1};gb.prototype.ed=function(){return this.next()};gb.prototype.first=function(){this.key=0;return this.value};gb.prototype.any=function(a){this.key=-1;return a(this.value)};gb.prototype.all=function(a){this.key=-1;return a(this.value)};gb.prototype.each=function(a){this.key=-1;a(this.value);return this};gb.prototype.map=function(a){return new gb(a(this.value))};
gb.prototype.filter=function(a){return a(this.value)?new gb(this.value):fb};gb.prototype.Cd=function(){this.value=null};gb.prototype.toString=function(){return"SingletonIterator("+this.value+")"};ma.Object.defineProperties(gb.prototype,{iterator:{get:function(){return this}},count:{get:function(){return 1}}});gb.prototype.first=gb.prototype.first;gb.prototype.hasNext=gb.prototype.ed;gb.prototype.next=gb.prototype.next;
gb.prototype.reset=gb.prototype.reset;gb.className="SingletonIterator";function jb(a){this.nb=a;this.af=null;a.Fa=null;this.ia=a.Aa;this.Oa=-1}jb.prototype.reset=function(){var a=this.nb;a.Fa=null;this.ia=a.Aa;this.Oa=-1};jb.prototype.next=function(){var a=this.nb;if(a.Aa!==this.ia&&0>this.key)return!1;a=a.j;var b=a.length,c=++this.Oa,d=this.af;if(null!==d)for(;c<b;){var e=a[c];if(d(e))return this.key=this.Oa=c,this.value=e,!0;c++}else{if(c<b)return this.key=c,this.value=a[c],!0;this.Cd()}return!1};
jb.prototype.ed=function(){return this.next()};jb.prototype.first=function(){var a=this.nb;this.ia=a.Aa;this.Oa=0;a=a.j;var b=a.length,c=this.af;if(null!==c){for(var d=0;d<b;){var e=a[d];if(c(e))return this.key=this.Oa=d,this.value=e;d++}return null}return 0<b?(a=a[0],this.key=0,this.value=a):null};jb.prototype.any=function(a){var b=this.nb;b.Fa=null;this.Oa=-1;b=b.j;for(var c=b.length,d=this.af,e=0;e<c;e++){var f=b[e];if((null===d||d(f))&&a(f))return!0}return!1};
jb.prototype.all=function(a){var b=this.nb;b.Fa=null;this.Oa=-1;b=b.j;for(var c=b.length,d=this.af,e=0;e<c;e++){var f=b[e];if((null===d||d(f))&&!a(f))return!1}return!0};jb.prototype.each=function(a){var b=this.nb;b.Fa=null;this.Oa=-1;b=b.j;for(var c=b.length,d=this.af,e=0;e<c;e++){var f=b[e];(null===d||d(f))&&a(f)}return this};
jb.prototype.map=function(a){var b=this.nb;b.Fa=null;this.Oa=-1;var c=[];b=b.j;for(var d=b.length,e=this.af,f=0;f<d;f++){var g=b[f];(null===e||e(g))&&c.push(a(g))}a=new E;a.j=c;a.ib();return a.iterator};jb.prototype.filter=function(a){var b=this.nb;b.Fa=null;this.Oa=-1;var c=[];b=b.j;for(var d=b.length,e=this.af,f=0;f<d;f++){var g=b[f];(null===e||e(g))&&a(g)&&c.push(g)}a=new E;a.j=c;a.ib();return a.iterator};
jb.prototype.Cd=function(){this.key=-1;this.value=null;this.ia=-1;this.af=null;this.nb.Fa=this};jb.prototype.toString=function(){return"ListIterator@"+this.Oa+"/"+this.nb.count};
ma.Object.defineProperties(jb.prototype,{iterator:{get:function(){return this}},predicate:{get:function(){return this.af},set:function(a){this.af=a}},count:{get:function(){var a=this.af;if(null!==a){for(var b=0,c=this.nb.j,d=c.length,e=0;e<d;e++)a(c[e])&&b++;return b}return this.nb.j.length}}});jb.prototype.first=jb.prototype.first;jb.prototype.hasNext=jb.prototype.ed;jb.prototype.next=jb.prototype.next;
jb.prototype.reset=jb.prototype.reset;jb.className="ListIterator";function kb(a){this.nb=a;a.bh=null;this.ia=a.Aa;this.Oa=a.j.length}kb.prototype.reset=function(){var a=this.nb;a.bh=null;this.ia=a.Aa;this.Oa=a.j.length};kb.prototype.next=function(){var a=this.nb;if(a.Aa!==this.ia&&0>this.key)return!1;var b=--this.Oa;if(0<=b)return this.key=b,this.value=a.j[b],!0;this.Cd();return!1};kb.prototype.ed=function(){return this.next()};
kb.prototype.first=function(){var a=this.nb;this.ia=a.Aa;var b=a.j;this.Oa=a=b.length-1;return 0<=a?(b=b[a],this.key=a,this.value=b):null};kb.prototype.any=function(a){var b=this.nb;b.bh=null;b=b.j;var c=b.length;this.Oa=c;for(--c;0<=c;c--)if(a(b[c]))return!0;return!1};kb.prototype.all=function(a){var b=this.nb;b.bh=null;b=b.j;var c=b.length;this.Oa=c;for(--c;0<=c;c--)if(!a(b[c]))return!1;return!0};
kb.prototype.each=function(a){var b=this.nb;b.bh=null;b=b.j;var c=b.length;this.Oa=c;for(--c;0<=c;c--)a(b[c]);return this};kb.prototype.map=function(a){var b=this.nb;b.bh=null;var c=[];b=b.j;var d=b.length;this.Oa=d;for(--d;0<=d;d--)c.push(a(b[d]));a=new E;a.j=c;a.ib();return a.iterator};kb.prototype.filter=function(a){var b=this.nb;b.bh=null;var c=[];b=b.j;var d=b.length;this.Oa=d;for(--d;0<=d;d--){var e=b[d];a(e)&&c.push(e)}a=new E;a.j=c;a.ib();return a.iterator};
kb.prototype.Cd=function(){this.key=-1;this.value=null;this.ia=-1;this.nb.bh=this};kb.prototype.toString=function(){return"ListIteratorBackwards("+this.Oa+"/"+this.nb.count+")"};ma.Object.defineProperties(kb.prototype,{iterator:{get:function(){return this}},count:{get:function(){return this.nb.j.length}}});kb.prototype.first=kb.prototype.first;kb.prototype.hasNext=kb.prototype.ed;kb.prototype.next=kb.prototype.next;kb.prototype.reset=kb.prototype.reset;
kb.className="ListIteratorBackwards";function E(a){Ya(this);this.s=!1;this.j=[];this.Aa=0;this.bh=this.Fa=null;void 0!==a&&("function"===typeof a||"string"===typeof a?ya():this.addAll(a))}t=E.prototype;t.ib=function(){var a=this.Aa;a++;999999999<a&&(a=0);this.Aa=a};t.freeze=function(){this.s=!0;return this};t.ea=function(){this.s=!1;return this};t.toString=function(){return"List()#"+lb(this)};t.add=function(a){if(null===a)return this;this.s&&ua(this,a);this.j.push(a);this.ib();return this};
t.push=function(a){this.add(a)};t.addAll=function(a){if(null===a)return this;this.s&&ua(this);var b=this.j;if(Aa(a))for(var c=a.length,d=0;d<c;d++)b.push(a[d]);else for(a=a.iterator;a.next();)b.push(a.value);this.ib();return this};t.clear=function(){this.s&&ua(this);this.j.length=0;this.ib()};t.contains=function(a){return null===a?!1:-1!==this.j.indexOf(a)};t.has=function(a){return this.contains(a)};t.indexOf=function(a){return null===a?-1:this.j.indexOf(a)};
t.L=function(a){var b=this.j;(0>a||a>=b.length)&&va(a,"0 <= i < length",E,"elt:i");return b[a]};t.get=function(a){return this.L(a)};t.hd=function(a,b){var c=this.j;(0>a||a>=c.length)&&va(a,"0 <= i < length",E,"setElt:i");this.s&&ua(this,a);c[a]=b};t.set=function(a,b){this.hd(a,b)};t.first=function(){var a=this.j;return 0===a.length?null:a[0]};t.Xb=function(){var a=this.j,b=a.length;return 0<b?a[b-1]:null};t.pop=function(){this.s&&ua(this);var a=this.j;return 0<a.length?a.pop():null};
E.prototype.any=function(a){for(var b=this.j,c=b.length,d=0;d<c;d++)if(a(b[d]))return!0;return!1};E.prototype.all=function(a){for(var b=this.j,c=b.length,d=0;d<c;d++)if(!a(b[d]))return!1;return!0};E.prototype.each=function(a){for(var b=this.j,c=b.length,d=0;d<c;d++)a(b[d]);return this};E.prototype.map=function(a){for(var b=new E,c=[],d=this.j,e=d.length,f=0;f<e;f++)c.push(a(d[f]));b.j=c;b.ib();return b};
E.prototype.filter=function(a){for(var b=new E,c=[],d=this.j,e=d.length,f=0;f<e;f++){var g=d[f];a(g)&&c.push(g)}b.j=c;b.ib();return b};t=E.prototype;t.Kb=function(a,b){0>a&&va(a,">= 0",E,"insertAt:i");this.s&&ua(this,a);var c=this.j;a>=c.length?c.push(b):c.splice(a,0,b);this.ib()};t.remove=function(a){if(null===a)return!1;this.s&&ua(this,a);var b=this.j;a=b.indexOf(a);if(-1===a)return!1;a===b.length-1?b.pop():b.splice(a,1);this.ib();return!0};t.delete=function(a){return this.remove(a)};
t.lb=function(a){var b=this.j;(0>a||a>=b.length)&&va(a,"0 <= i < length",E,"removeAt:i");this.s&&ua(this,a);a===b.length-1?b.pop():b.splice(a,1);this.ib()};t.removeRange=function(a,b){var c=this.j,d=c.length;if(0>a)a=0;else if(a>=d)return this;if(0>b)return this;b>=d&&(b=d-1);if(a>b)return this;this.s&&ua(this);for(var e=a,f=b+1;f<d;)c[e++]=c[f++];c.length=d-(b-a+1);this.ib();return this};E.prototype.copy=function(){var a=new E,b=this.j;0<b.length&&(a.j=Array.prototype.slice.call(b));return a};
t=E.prototype;t.na=function(){for(var a=this.j,b=this.count,c=Array(b),d=0;d<b;d++)c[d]=a[d];return c};t.mw=function(){for(var a=new F,b=this.j,c=this.count,d=0;d<c;d++)a.add(b[d]);return a};t.sort=function(a){this.s&&ua(this);this.j.sort(a);this.ib();return this};
t.ej=function(a,b,c){var d=this.j,e=d.length;void 0===b&&(b=0);void 0===c&&(c=e);this.s&&ua(this);var f=c-b;if(1>=f)return this;(0>b||b>=e-1)&&va(b,"0 <= from < length",E,"sortRange:from");if(2===f)return c=d[b],e=d[b+1],0<a(c,e)&&(d[b]=e,d[b+1]=c,this.ib()),this;if(0===b)if(c>=e)d.sort(a);else for(b=d.slice(0,c),b.sort(a),a=0;a<c;a++)d[a]=b[a];else if(c>=e)for(c=d.slice(b),c.sort(a),a=b;a<e;a++)d[a]=c[a-b];else for(e=d.slice(b,c),e.sort(a),a=b;a<c;a++)d[a]=e[a-b];this.ib();return this};
t.reverse=function(){this.s&&ua(this);this.j.reverse();this.ib();return this};
ma.Object.defineProperties(E.prototype,{_dataArray:{get:function(){return this.j}},count:{get:function(){return this.j.length}},size:{get:function(){return this.j.length}},length:{get:function(){return this.j.length}},iterator:{get:function(){if(0>=this.j.length)return fb;var a=this.Fa;return null!==a?(a.reset(),a):new jb(this)}},iteratorBackwards:{
get:function(){if(0>=this.j.length)return fb;var a=this.bh;return null!==a?(a.reset(),a):new kb(this)}}});E.prototype.reverse=E.prototype.reverse;E.prototype.sortRange=E.prototype.ej;E.prototype.sort=E.prototype.sort;E.prototype.toSet=E.prototype.mw;E.prototype.toArray=E.prototype.na;E.prototype.removeRange=E.prototype.removeRange;E.prototype.removeAt=E.prototype.lb;E.prototype["delete"]=E.prototype.delete;E.prototype.remove=E.prototype.remove;E.prototype.insertAt=E.prototype.Kb;
E.prototype.pop=E.prototype.pop;E.prototype.last=E.prototype.Xb;E.prototype.first=E.prototype.first;E.prototype.set=E.prototype.set;E.prototype.setElt=E.prototype.hd;E.prototype.get=E.prototype.get;E.prototype.elt=E.prototype.L;E.prototype.indexOf=E.prototype.indexOf;E.prototype.has=E.prototype.has;E.prototype.contains=E.prototype.contains;E.prototype.clear=E.prototype.clear;E.prototype.addAll=E.prototype.addAll;E.prototype.push=E.prototype.push;E.prototype.add=E.prototype.add;E.prototype.thaw=E.prototype.ea;
E.prototype.freeze=E.prototype.freeze;E.className="List";function mb(a){this.rg=a;a.Fa=null;this.ia=a.Aa;this.la=null}mb.prototype.reset=function(){var a=this.rg;a.Fa=null;this.ia=a.Aa;this.la=null};mb.prototype.next=function(){var a=this.rg;if(a.Aa!==this.ia&&null===this.key)return!1;var b=this.la;b=null===b?a.ba:b.oa;if(null!==b)return this.la=b,this.value=b.value,this.key=b.key,!0;this.Cd();return!1};mb.prototype.ed=function(){return this.next()};
mb.prototype.first=function(){var a=this.rg;this.ia=a.Aa;a=a.ba;if(null!==a){this.la=a;var b=a.value;this.key=a.key;return this.value=b}return null};mb.prototype.any=function(a){var b=this.rg;this.la=b.Fa=null;for(b=b.ba;null!==b;){if(a(b.value))return!0;b=b.oa}return!1};mb.prototype.all=function(a){var b=this.rg;this.la=b.Fa=null;for(b=b.ba;null!==b;){if(!a(b.value))return!1;b=b.oa}return!0};mb.prototype.each=function(a){var b=this.rg;this.la=b.Fa=null;for(b=b.ba;null!==b;)a(b.value),b=b.oa;return this};
mb.prototype.map=function(a){var b=this.rg;b.Fa=null;var c=new E;for(b=b.ba;null!==b;)c.add(a(b.value)),b=b.oa;return c.iterator};mb.prototype.filter=function(a){var b=this.rg;b.Fa=null;var c=new E;for(b=b.ba;null!==b;){var d=b.value;a(d)&&c.add(d);b=b.oa}return c.iterator};mb.prototype.Cd=function(){this.value=this.key=null;this.ia=-1;this.rg.Fa=this};mb.prototype.toString=function(){return null!==this.la?"SetIterator@"+this.la.value:"SetIterator"};
ma.Object.defineProperties(mb.prototype,{iterator:{get:function(){return this}},count:{get:function(){return this.rg.Cb}}});mb.prototype.first=mb.prototype.first;mb.prototype.hasNext=mb.prototype.ed;mb.prototype.next=mb.prototype.next;mb.prototype.reset=mb.prototype.reset;mb.className="SetIterator";
function F(a){Ya(this);this.s=!1;this.Eb={};this.Cb=0;this.Fa=null;this.Aa=0;this.Ve=this.ba=null;void 0!==a&&("function"===typeof a||"string"===typeof a?ya():this.addAll(a))}t=F.prototype;t.ib=function(){var a=this.Aa;a++;999999999<a&&(a=0);this.Aa=a};t.freeze=function(){this.s=!0;return this};t.ea=function(){this.s=!1;return this};t.toString=function(){return"Set()#"+lb(this)};
t.add=function(a){if(null===a)return this;this.s&&ua(this,a);var b=a;za(a)&&(b=nb(a));void 0===this.Eb[b]&&(this.Cb++,a=new ob(a,a),this.Eb[b]=a,b=this.Ve,null===b?this.ba=a:(a.Dl=b,b.oa=a),this.Ve=a,this.ib());return this};t.addAll=function(a){if(null===a)return this;this.s&&ua(this);if(Aa(a))for(var b=a.length,c=0;c<b;c++)this.add(a[c]);else for(a=a.iterator;a.next();)this.add(a.value);return this};
t.contains=function(a){if(null===a)return!1;var b=a;return za(a)&&(b=lb(a),void 0===b)?!1:void 0!==this.Eb[b]};t.has=function(a){return this.contains(a)};t.Uy=function(a){if(null===a)return!0;for(a=a.iterator;a.next();)if(!this.contains(a.value))return!1;return!0};t.Vy=function(a){if(null===a)return!0;for(a=a.iterator;a.next();)if(this.contains(a.value))return!0;return!1};t.first=function(){var a=this.ba;return null===a?null:a.value};
F.prototype.any=function(a){for(var b=this.ba;null!==b;){if(a(b.value))return!0;b=b.oa}return!1};F.prototype.all=function(a){for(var b=this.ba;null!==b;){if(!a(b.value))return!1;b=b.oa}return!0};F.prototype.each=function(a){for(var b=this.ba;null!==b;)a(b.value),b=b.oa;return this};F.prototype.map=function(a){for(var b=new F,c=this.ba;null!==c;)b.add(a(c.value)),c=c.oa;return b};F.prototype.filter=function(a){for(var b=new F,c=this.ba;null!==c;){var d=c.value;a(d)&&b.add(d);c=c.oa}return b};t=F.prototype;
t.remove=function(a){if(null===a)return!1;this.s&&ua(this,a);var b=a;if(za(a)&&(b=lb(a),void 0===b))return!1;a=this.Eb[b];if(void 0===a)return!1;var c=a.oa,d=a.Dl;null!==c&&(c.Dl=d);null!==d&&(d.oa=c);this.ba===a&&(this.ba=c);this.Ve===a&&(this.Ve=d);delete this.Eb[b];this.Cb--;this.ib();return!0};t.delete=function(a){return this.remove(a)};
t.Fq=function(a){if(null===a)return this;this.s&&ua(this);if(Aa(a))for(var b=a.length,c=0;c<b;c++)this.remove(a[c]);else for(a=a.iterator;a.next();)this.remove(a.value);return this};t.qA=function(a){if(null===a||0===this.count)return this;this.s&&ua(this);var b=new F;b.addAll(a);a=[];for(var c=this.iterator;c.next();){var d=c.value;b.contains(d)||a.push(d)}this.Fq(a);return this};t.clear=function(){this.s&&ua(this);this.Eb={};this.Cb=0;null!==this.Fa&&this.Fa.reset();this.Ve=this.ba=null;this.ib()};
F.prototype.copy=function(){var a=new F,b=this.Eb,c;for(c in b)a.add(b[c].value);return a};F.prototype.na=function(){var a=Array(this.Cb),b=this.Eb,c=0,d;for(d in b)a[c]=b[d].value,c++;return a};F.prototype.lw=function(){var a=new E,b=this.Eb,c;for(c in b)a.add(b[c].value);return a};function Ya(a){a.__gohashid=pb++}function nb(a){var b=a.__gohashid;void 0===b&&(b=pb++,a.__gohashid=b);return b}function lb(a){return a.__gohashid}
ma.Object.defineProperties(F.prototype,{count:{get:function(){return this.Cb}},size:{get:function(){return this.Cb}},iterator:{get:function(){if(0>=this.Cb)return fb;var a=this.Fa;return null!==a?(a.reset(),a):new mb(this)}}});F.prototype.toList=F.prototype.lw;F.prototype.toArray=F.prototype.na;F.prototype.clear=F.prototype.clear;F.prototype.retainAll=F.prototype.qA;F.prototype.removeAll=F.prototype.Fq;
F.prototype["delete"]=F.prototype.delete;F.prototype.remove=F.prototype.remove;F.prototype.first=F.prototype.first;F.prototype.containsAny=F.prototype.Vy;F.prototype.containsAll=F.prototype.Uy;F.prototype.has=F.prototype.has;F.prototype.contains=F.prototype.contains;F.prototype.addAll=F.prototype.addAll;F.prototype.add=F.prototype.add;F.prototype.thaw=F.prototype.ea;F.prototype.freeze=F.prototype.freeze;var pb=1;F.className="Set";F.uniqueHash=Ya;F.hashIdUnique=nb;F.hashId=lb;
function qb(a){this.fa=a;this.ia=a.Aa;this.la=null}qb.prototype.reset=function(){this.ia=this.fa.Aa;this.la=null};qb.prototype.next=function(){var a=this.fa;if(a.Aa!==this.ia&&null===this.key)return!1;var b=this.la;b=null===b?a.ba:b.oa;if(null!==b)return this.la=b,this.value=this.key=a=b.key,!0;this.Cd();return!1};qb.prototype.ed=function(){return this.next()};qb.prototype.first=function(){var a=this.fa;this.ia=a.Aa;a=a.ba;return null!==a?(this.la=a,this.value=this.key=a=a.key):null};
qb.prototype.any=function(a){var b=this.fa;this.la=null;for(b=b.ba;null!==b;){if(a(b.key))return!0;b=b.oa}return!1};qb.prototype.all=function(a){var b=this.fa;this.la=null;for(b=b.ba;null!==b;){if(!a(b.key))return!1;b=b.oa}return!0};qb.prototype.each=function(a){var b=this.fa;this.la=null;for(b=b.ba;null!==b;)a(b.key),b=b.oa;return this};qb.prototype.map=function(a){var b=this.fa;this.la=null;var c=new E;for(b=b.ba;null!==b;)c.add(a(b.key)),b=b.oa;return c.iterator};
qb.prototype.filter=function(a){var b=this.fa;this.la=null;var c=new E;for(b=b.ba;null!==b;){var d=b.key;a(d)&&c.add(d);b=b.oa}return c.iterator};qb.prototype.Cd=function(){this.value=this.key=null;this.ia=-1};qb.prototype.toString=function(){return null!==this.la?"MapKeySetIterator@"+this.la.value:"MapKeySetIterator"};ma.Object.defineProperties(qb.prototype,{iterator:{get:function(){return this}},count:{get:function(){return this.fa.Cb}}});
qb.prototype.first=qb.prototype.first;qb.prototype.hasNext=qb.prototype.ed;qb.prototype.next=qb.prototype.next;qb.prototype.reset=qb.prototype.reset;qb.className="MapKeySetIterator";function rb(a){F.call(this);Ya(this);this.s=!0;this.fa=a}la(rb,F);t=rb.prototype;t.freeze=function(){return this};t.ea=function(){return this};t.toString=function(){return"MapKeySet("+this.fa.toString()+")"};t.add=function(){B("This Set is read-only: "+this.toString());return this};t.contains=function(a){return this.fa.contains(a)};
t.has=function(a){return this.contains(a)};t.remove=function(){B("This Set is read-only: "+this.toString());return!1};t.delete=function(a){return this.remove(a)};t.clear=function(){B("This Set is read-only: "+this.toString())};t.first=function(){var a=this.fa.ba;return null!==a?a.key:null};rb.prototype.any=function(a){for(var b=this.fa.ba;null!==b;){if(a(b.key))return!0;b=b.oa}return!1};rb.prototype.all=function(a){for(var b=this.fa.ba;null!==b;){if(!a(b.key))return!1;b=b.oa}return!0};
rb.prototype.each=function(a){for(var b=this.fa.ba;null!==b;)a(b.key),b=b.oa;return this};rb.prototype.map=function(a){for(var b=new F,c=this.fa.ba;null!==c;)b.add(a(c.key)),c=c.oa;return b};rb.prototype.filter=function(a){for(var b=new F,c=this.fa.ba;null!==c;){var d=c.key;a(d)&&b.add(d);c=c.oa}return b};rb.prototype.copy=function(){return new rb(this.fa)};rb.prototype.mw=function(){var a=new F,b=this.fa.Eb,c;for(c in b)a.add(b[c].key);return a};
rb.prototype.na=function(){var a=this.fa.Eb,b=Array(this.fa.Cb),c=0,d;for(d in a)b[c]=a[d].key,c++;return b};rb.prototype.lw=function(){var a=new E,b=this.fa.Eb,c;for(c in b)a.add(b[c].key);return a};ma.Object.defineProperties(rb.prototype,{count:{get:function(){return this.fa.Cb}},size:{get:function(){return this.fa.Cb}},iterator:{get:function(){return 0>=this.fa.Cb?fb:new qb(this.fa)}}});
rb.prototype.toList=rb.prototype.lw;rb.prototype.toArray=rb.prototype.na;rb.prototype.toSet=rb.prototype.mw;rb.prototype.first=rb.prototype.first;rb.prototype.clear=rb.prototype.clear;rb.prototype["delete"]=rb.prototype.delete;rb.prototype.remove=rb.prototype.remove;rb.prototype.has=rb.prototype.has;rb.prototype.contains=rb.prototype.contains;rb.prototype.add=rb.prototype.add;rb.prototype.thaw=rb.prototype.ea;rb.prototype.freeze=rb.prototype.freeze;rb.className="MapKeySet";
function sb(a){this.fa=a;a.Ue=null;this.ia=a.Aa;this.la=null}sb.prototype.reset=function(){var a=this.fa;a.Ue=null;this.ia=a.Aa;this.la=null};sb.prototype.next=function(){var a=this.fa;if(a.Aa!==this.ia&&null===this.key)return!1;var b=this.la;b=null===b?a.ba:b.oa;if(null!==b)return this.la=b,this.value=b.value,this.key=b.key,!0;this.Cd();return!1};sb.prototype.ed=function(){return this.next()};
sb.prototype.first=function(){var a=this.fa;this.ia=a.Aa;a=a.ba;if(null!==a){this.la=a;var b=a.value;this.key=a.key;return this.value=b}return null};sb.prototype.any=function(a){var b=this.fa;this.la=b.Ue=null;for(b=b.ba;null!==b;){if(a(b.value))return!0;b=b.oa}return!1};sb.prototype.all=function(a){var b=this.fa;this.la=b.Ue=null;for(b=b.ba;null!==b;){if(!a(b.value))return!1;b=b.oa}return!0};sb.prototype.each=function(a){var b=this.fa;this.la=b.Ue=null;for(b=b.ba;null!==b;)a(b.value),b=b.oa;return this};
sb.prototype.map=function(a){var b=this.fa;this.la=b.Ue=null;var c=new E;for(b=b.ba;null!==b;)c.add(a(b.value)),b=b.oa;return c.iterator};sb.prototype.filter=function(a){var b=this.fa;this.la=b.Ue=null;var c=new E;for(b=b.ba;null!==b;){var d=b.value;a(d)&&c.add(d);b=b.oa}return c.iterator};sb.prototype.Cd=function(){this.value=this.key=null;this.ia=-1;this.fa.Ue=this};sb.prototype.toString=function(){return null!==this.la?"MapValueSetIterator@"+this.la.value:"MapValueSetIterator"};
ma.Object.defineProperties(sb.prototype,{iterator:{get:function(){return this}},count:{get:function(){return this.fa.Cb}}});sb.prototype.first=sb.prototype.first;sb.prototype.hasNext=sb.prototype.ed;sb.prototype.next=sb.prototype.next;sb.prototype.reset=sb.prototype.reset;sb.className="MapValueSetIterator";function ob(a,b){this.key=a;this.value=b;this.Dl=this.oa=null}ob.prototype.toString=function(){return"{"+this.key+":"+this.value+"}"};
ob.className="KeyValuePair";function tb(a){this.fa=a;a.Fa=null;this.ia=a.Aa;this.la=null}tb.prototype.reset=function(){var a=this.fa;a.Fa=null;this.ia=a.Aa;this.la=null};tb.prototype.next=function(){var a=this.fa;if(a.Aa!==this.ia&&null===this.key)return!1;var b=this.la;b=null===b?a.ba:b.oa;if(null!==b)return this.la=b,this.key=b.key,this.value=b.value,!0;this.Cd();return!1};tb.prototype.ed=function(){return this.next()};
tb.prototype.first=function(){var a=this.fa;this.ia=a.Aa;a=a.ba;return null!==a?(this.la=a,this.key=a.key,this.value=a.value,a):null};tb.prototype.any=function(a){var b=this.fa;this.la=b.Fa=null;for(b=b.ba;null!==b;){if(a(b))return!0;b=b.oa}return!1};tb.prototype.all=function(a){var b=this.fa;this.la=b.Fa=null;for(b=b.ba;null!==b;){if(!a(b))return!1;b=b.oa}return!0};tb.prototype.each=function(a){var b=this.fa;this.la=b.Fa=null;for(b=b.ba;null!==b;)a(b),b=b.oa;return this};
tb.prototype.map=function(a){var b=this.fa;this.la=b.Fa=null;var c=new E;for(b=b.ba;null!==b;)c.add(a(b)),b=b.oa;return c.iterator};tb.prototype.filter=function(a){var b=this.fa;this.la=b.Fa=null;var c=new E;for(b=b.ba;null!==b;)a(b)&&c.add(b),b=b.oa;return c.iterator};tb.prototype.Cd=function(){this.value=this.key=null;this.ia=-1;this.fa.Fa=this};tb.prototype.toString=function(){return null!==this.la?"MapIterator@"+this.la:"MapIterator"};
ma.Object.defineProperties(tb.prototype,{iterator:{get:function(){return this}},count:{get:function(){return this.fa.Cb}}});tb.prototype.first=tb.prototype.first;tb.prototype.hasNext=tb.prototype.ed;tb.prototype.next=tb.prototype.next;tb.prototype.reset=tb.prototype.reset;tb.className="MapIterator";
function G(a){Ya(this);this.s=!1;this.Eb={};this.Cb=0;this.Ue=this.Fa=null;this.Aa=0;this.Ve=this.ba=null;void 0!==a&&("function"===typeof a||"string"===typeof a?ya():this.addAll(a))}t=G.prototype;t.ib=function(){var a=this.Aa;a++;999999999<a&&(a=0);this.Aa=a};t.freeze=function(){this.s=!0;return this};t.ea=function(){this.s=!1;return this};t.toString=function(){return"Map()#"+lb(this)};
t.add=function(a,b){this.s&&ua(this,a);var c=a;za(a)&&(c=nb(a));var d=this.Eb[c];void 0===d?(this.Cb++,a=new ob(a,b),this.Eb[c]=a,c=this.Ve,null===c?this.ba=a:(a.Dl=c,c.oa=a),this.Ve=a,this.ib()):d.value=b;return this};t.set=function(a,b){return this.add(a,b)};
t.addAll=function(a){if(null===a)return this;if(Aa(a))for(var b=a.length,c=0;c<b;c++){var d=a[c];this.add(d.key,d.value)}else if(a instanceof G)for(a=a.iterator;a.next();)this.add(a.key,a.value);else for(a=a.iterator;a.next();)b=a.value,this.add(b.key,b.value);return this};t.first=function(){return this.ba};G.prototype.any=function(a){for(var b=this.ba;null!==b;){if(a(b))return!0;b=b.oa}return!1};G.prototype.all=function(a){for(var b=this.ba;null!==b;){if(!a(b))return!1;b=b.oa}return!0};
G.prototype.each=function(a){for(var b=this.ba;null!==b;)a(b),b=b.oa;return this};G.prototype.map=function(a){for(var b=new G,c=this.ba;null!==c;)b.add(c.key,a(c)),c=c.oa;return b};G.prototype.filter=function(a){for(var b=new G,c=this.ba;null!==c;)a(c)&&b.add(c.key,c.value),c=c.oa;return b};t=G.prototype;t.contains=function(a){var b=a;return za(a)&&(b=lb(a),void 0===b)?!1:void 0!==this.Eb[b]};t.has=function(a){return this.contains(a)};
t.H=function(a){var b=a;if(za(a)&&(b=lb(a),void 0===b))return null;a=this.Eb[b];return void 0===a?null:a.value};t.get=function(a){return this.H(a)};t.remove=function(a){if(null===a)return!1;this.s&&ua(this,a);var b=a;if(za(a)&&(b=lb(a),void 0===b))return!1;a=this.Eb[b];if(void 0===a)return!1;var c=a.oa,d=a.Dl;null!==c&&(c.Dl=d);null!==d&&(d.oa=c);this.ba===a&&(this.ba=c);this.Ve===a&&(this.Ve=d);delete this.Eb[b];this.Cb--;this.ib();return!0};t.delete=function(a){return this.remove(a)};
t.clear=function(){this.s&&ua(this);this.Eb={};this.Cb=0;null!==this.Fa&&this.Fa.reset();null!==this.Ue&&this.Ue.reset();this.Ve=this.ba=null;this.ib()};G.prototype.copy=function(){var a=new G,b=this.Eb,c;for(c in b){var d=b[c];a.add(d.key,d.value)}return a};G.prototype.na=function(){var a=this.Eb,b=Array(this.Cb),c=0,d;for(d in a){var e=a[d];b[c]=new ob(e.key,e.value);c++}return b};G.prototype.Df=function(){return new rb(this)};
ma.Object.defineProperties(G.prototype,{count:{get:function(){return this.Cb}},size:{get:function(){return this.Cb}},iterator:{get:function(){if(0>=this.count)return fb;var a=this.Fa;return null!==a?(a.reset(),a):new tb(this)}},iteratorKeys:{get:function(){return 0>=this.count?fb:new qb(this)}},iteratorValues:{get:function(){if(0>=this.count)return fb;
var a=this.Ue;return null!==a?(a.reset(),a):new sb(this)}}});G.prototype.toKeySet=G.prototype.Df;G.prototype.toArray=G.prototype.na;G.prototype.clear=G.prototype.clear;G.prototype["delete"]=G.prototype.delete;G.prototype.remove=G.prototype.remove;G.prototype.get=G.prototype.get;G.prototype.getValue=G.prototype.H;G.prototype.has=G.prototype.has;G.prototype.contains=G.prototype.contains;G.prototype.first=G.prototype.first;G.prototype.addAll=G.prototype.addAll;G.prototype.set=G.prototype.set;
G.prototype.add=G.prototype.add;G.prototype.thaw=G.prototype.ea;G.prototype.freeze=G.prototype.freeze;G.className="Map";function I(a,b){void 0===a?this.y=this.x=0:"number"===typeof a&&"number"===typeof b?(this.x=a,this.y=b):B("Invalid arguments to Point constructor: "+a+", "+b);this.s=!1}I.prototype.assign=function(a){this.x=a.x;this.y=a.y;return this};I.prototype.h=function(a,b){this.x=a;this.y=b;return this};I.prototype.Fg=function(a,b){this.x=a;this.y=b;return this};
I.prototype.set=function(a){this.x=a.x;this.y=a.y;return this};I.prototype.copy=function(){var a=new I;a.x=this.x;a.y=this.y;return a};t=I.prototype;t.ca=function(){this.s=!0;Object.freeze(this);return this};t.G=function(){return this.s||Object.isFrozen(this)?this:this.copy().freeze()};t.freeze=function(){this.s=!0;return this};t.ea=function(){Object.isFrozen(this)&&B("cannot thaw constant: "+this);this.s=!1;return this};
function ub(a){if("string"===typeof a){a=a.split(" ");for(var b=0,c=0;""===a[b];)b++;var d=a[b++];d&&(c=parseFloat(d));for(var e=0;""===a[b];)b++;(d=a[b++])&&(e=parseFloat(d));return new I(c,e)}return new I}function vb(a){return a.x.toString()+" "+a.y.toString()}t.toString=function(){return"Point("+this.x+","+this.y+")"};t.w=function(a){return a instanceof I?this.x===a.x&&this.y===a.y:!1};t.Ri=function(a,b){return this.x===a&&this.y===b};t.Ma=function(a){return J.A(this.x,a.x)&&J.A(this.y,a.y)};
t.add=function(a){this.x+=a.x;this.y+=a.y;return this};t.$d=function(a){this.x-=a.x;this.y-=a.y;return this};t.offset=function(a,b){this.x+=a;this.y+=b;return this};I.prototype.rotate=function(a){if(0===a)return this;var b=this.x,c=this.y;if(0===b&&0===c)return this;360<=a?a-=360:0>a&&(a+=360);if(90===a){a=0;var d=1}else 180===a?(a=-1,d=0):270===a?(a=0,d=-1):(d=a*Math.PI/180,a=Math.cos(d),d=Math.sin(d));this.x=a*b-d*c;this.y=d*b+a*c;return this};t=I.prototype;
t.scale=function(a,b){this.x*=a;this.y*=b;return this};t.Be=function(a){var b=a.x-this.x;a=a.y-this.y;return b*b+a*a};t.dd=function(a,b){a-=this.x;b-=this.y;return a*a+b*b};t.normalize=function(){var a=this.x,b=this.y,c=Math.sqrt(a*a+b*b);0<c&&(this.x=a/c,this.y=b/c);return this};t.Sa=function(a){return zb(a.x-this.x,a.y-this.y)};t.direction=function(a,b){return zb(a-this.x,b-this.y)};
function zb(a,b){if(0===a)return 0<b?90:0>b?270:0;if(0===b)return 0<a?0:180;if(isNaN(a)||isNaN(b))return 0;var c=180*Math.atan(Math.abs(b/a))/Math.PI;0>a?c=0>b?c+180:180-c:0>b&&(c=360-c);return c}t.kA=function(a,b,c,d){J.Lh(a,b,c,d,this.x,this.y,this);return this};t.lA=function(a,b){J.Lh(a.x,a.y,b.x,b.y,this.x,this.y,this);return this};t.wA=function(a,b,c,d){J.mq(this.x,this.y,a,b,c,d,this);return this};t.xA=function(a,b){J.mq(this.x,this.y,a.x,a.y,b.width,b.height,this);return this};
t.dj=function(a,b){this.x=a.x+b.x*a.width+b.offsetX;this.y=a.y+b.y*a.height+b.offsetY;return this};t.xk=function(a,b,c,d,e){this.x=a+e.x*c+e.offsetX;this.y=b+e.y*d+e.offsetY;return this};t.transform=function(a){a.ra(this);return this};function Ab(a,b){b.Wd(a);return a}function Bb(a,b,c,d,e,f){var g=e-c,h=f-d,k=g*g+h*h;c-=a;d-=b;var l=-c*g-d*h;if(0>=l||l>=k)return g=e-a,h=f-b,Math.min(c*c+d*d,g*g+h*h);a=g*d-h*c;return a*a/k}function Cb(a,b,c,d){a=c-a;b=d-b;return a*a+b*b}
function Db(a,b,c,d){a=c-a;b=d-b;if(0===a)return 0<b?90:0>b?270:0;if(0===b)return 0<a?0:180;if(isNaN(a)||isNaN(b))return 0;d=180*Math.atan(Math.abs(b/a))/Math.PI;0>a?d=0>b?d+180:180-d:0>b&&(d=360-d);return d}t.u=function(){return isFinite(this.x)&&isFinite(this.y)};I.alloc=function(){var a=Eb.pop();return void 0===a?new I:a};I.allocAt=function(a,b){var c=Eb.pop();if(void 0===c)return new I(a,b);c.x=a;c.y=b;return c};I.free=function(a){Eb.push(a)};I.prototype.isReal=I.prototype.u;
I.prototype.setSpot=I.prototype.xk;I.prototype.setRectSpot=I.prototype.dj;I.prototype.snapToGridPoint=I.prototype.xA;I.prototype.snapToGrid=I.prototype.wA;I.prototype.projectOntoLineSegmentPoint=I.prototype.lA;I.prototype.projectOntoLineSegment=I.prototype.kA;I.intersectingLineSegments=function(a,b,c,d,e,f,g,h){return J.sq(a,b,c,d,e,f,g,h)};I.prototype.direction=I.prototype.direction;I.prototype.directionPoint=I.prototype.Sa;I.prototype.normalize=I.prototype.normalize;
I.prototype.distanceSquared=I.prototype.dd;I.prototype.distanceSquaredPoint=I.prototype.Be;I.prototype.scale=I.prototype.scale;I.prototype.rotate=I.prototype.rotate;I.prototype.offset=I.prototype.offset;I.prototype.subtract=I.prototype.$d;I.prototype.add=I.prototype.add;I.prototype.equalsApprox=I.prototype.Ma;I.prototype.equalTo=I.prototype.Ri;I.prototype.equals=I.prototype.w;I.prototype.set=I.prototype.set;I.prototype.setTo=I.prototype.Fg;var Gb=null,Hb=null,Ib=null,Jb=null,Kb=null,Eb=[];
I.className="Point";I.parse=ub;I.stringify=vb;I.distanceLineSegmentSquared=Bb;I.distanceSquared=Cb;I.direction=Db;I.Origin=Gb=(new I(0,0)).ca();I.InfiniteTopLeft=Hb=(new I(-Infinity,-Infinity)).ca();I.InfiniteBottomRight=Ib=(new I(Infinity,Infinity)).ca();I.SixPoint=Jb=(new I(6,6)).ca();I.NoPoint=Kb=(new I(NaN,NaN)).ca();I.parse=ub;I.stringify=vb;I.distanceLineSegmentSquared=Bb;I.distanceSquared=Cb;I.direction=Db;
function M(a,b){void 0===a?this.height=this.width=0:"number"===typeof a&&(0<=a||isNaN(a))&&"number"===typeof b&&(0<=b||isNaN(b))?(this.width=a,this.height=b):B("Invalid arguments to Size constructor: "+a+", "+b);this.s=!1}var Lb,Mb,Nb,Ob,Pb,Qb,Rb;M.prototype.assign=function(a){this.width=a.width;this.height=a.height;return this};M.prototype.h=function(a,b){this.width=a;this.height=b;return this};M.prototype.Fg=function(a,b){this.width=a;this.height=b;return this};
M.prototype.set=function(a){this.width=a.width;this.height=a.height;return this};M.prototype.copy=function(){var a=new M;a.width=this.width;a.height=this.height;return a};t=M.prototype;t.ca=function(){this.s=!0;Object.freeze(this);return this};t.G=function(){return this.s||Object.isFrozen(this)?this:this.copy().freeze()};t.freeze=function(){this.s=!0;return this};t.ea=function(){Object.isFrozen(this)&&B("cannot thaw constant: "+this);this.s=!1;return this};
function Sb(a){if("string"===typeof a){a=a.split(" ");for(var b=0,c=0;""===a[b];)b++;var d=a[b++];d&&(c=parseFloat(d));for(var e=0;""===a[b];)b++;(d=a[b++])&&(e=parseFloat(d));return new M(c,e)}return new M}function Tb(a){return a.width.toString()+" "+a.height.toString()}t.toString=function(){return"Size("+this.width+","+this.height+")"};t.w=function(a){return a instanceof M?this.width===a.width&&this.height===a.height:!1};t.Ri=function(a,b){return this.width===a&&this.height===b};
t.Ma=function(a){return J.A(this.width,a.width)&&J.A(this.height,a.height)};t.u=function(){return isFinite(this.width)&&isFinite(this.height)};M.alloc=function(){var a=Ub.pop();return void 0===a?new M:a};M.free=function(a){Ub.push(a)};M.prototype.isReal=M.prototype.u;M.prototype.equalsApprox=M.prototype.Ma;M.prototype.equalTo=M.prototype.Ri;M.prototype.equals=M.prototype.w;M.prototype.set=M.prototype.set;M.prototype.setTo=M.prototype.Fg;var Ub=[];M.className="Size";M.parse=Sb;M.stringify=Tb;
M.ZeroSize=Lb=(new M(0,0)).ca();M.OneSize=Mb=(new M(1,1)).ca();M.SixSize=Nb=(new M(6,6)).ca();M.EightSize=Ob=(new M(8,8)).ca();M.TenSize=Pb=(new M(10,10)).ca();M.InfiniteSize=Qb=(new M(Infinity,Infinity)).ca();M.NoSize=Rb=(new M(NaN,NaN)).ca();M.parse=Sb;M.stringify=Tb;
function N(a,b,c,d){void 0===a?this.height=this.width=this.y=this.x=0:a instanceof I?(c=a.x,a=a.y,b instanceof I?(d=b.x,b=b.y,this.x=Math.min(c,d),this.y=Math.min(a,b),this.width=Math.abs(c-d),this.height=Math.abs(a-b)):b instanceof M?(this.x=c,this.y=a,this.width=b.width,this.height=b.height):B("Incorrect arguments supplied to Rect constructor")):"number"===typeof a&&"number"===typeof b&&"number"===typeof c&&(0<=c||isNaN(c))&&"number"===typeof d&&(0<=d||isNaN(d))?(this.x=a,this.y=b,this.width=c,
this.height=d):B("Invalid arguments to Rect constructor: "+a+", "+b+", "+c+", "+d);this.s=!1}t=N.prototype;t.assign=function(a){this.x=a.x;this.y=a.y;this.width=a.width;this.height=a.height;return this};t.h=function(a,b,c,d){this.x=a;this.y=b;this.width=c;this.height=d;return this};function Vb(a,b,c){a.width=b;a.height=c}t.Fg=function(a,b,c,d){this.x=a;this.y=b;this.width=c;this.height=d;return this};t.set=function(a){this.x=a.x;this.y=a.y;this.width=a.width;this.height=a.height;return this};
t.jd=function(a){this.x=a.x;this.y=a.y;return this};t.uA=function(a){this.width=a.width;this.height=a.height;return this};N.prototype.copy=function(){var a=new N;a.x=this.x;a.y=this.y;a.width=this.width;a.height=this.height;return a};t=N.prototype;t.ca=function(){this.s=!0;Object.freeze(this);return this};t.G=function(){return this.s||Object.isFrozen(this)?this:this.copy().freeze()};t.freeze=function(){this.s=!0;return this};
t.ea=function(){Object.isFrozen(this)&&B("cannot thaw constant: "+this);this.s=!1;return this};function Wb(a){if("string"===typeof a){a=a.split(" ");for(var b=0,c=0;""===a[b];)b++;var d=a[b++];d&&(c=parseFloat(d));for(var e=0;""===a[b];)b++;(d=a[b++])&&(e=parseFloat(d));for(var f=0;""===a[b];)b++;(d=a[b++])&&(f=parseFloat(d));for(var g=0;""===a[b];)b++;(d=a[b++])&&(g=parseFloat(d));return new N(c,e,f,g)}return new N}
function Zb(a){return a.x.toString()+" "+a.y.toString()+" "+a.width.toString()+" "+a.height.toString()}t.toString=function(){return"Rect("+this.x+","+this.y+","+this.width+","+this.height+")"};t.w=function(a){return a instanceof N?this.x===a.x&&this.y===a.y&&this.width===a.width&&this.height===a.height:!1};t.Ri=function(a,b,c,d){return this.x===a&&this.y===b&&this.width===c&&this.height===d};t.Ma=function(a){return J.A(this.x,a.x)&&J.A(this.y,a.y)&&J.A(this.width,a.width)&&J.A(this.height,a.height)};
function $b(a,b){return J.$(a.x,b.x)&&J.$(a.y,b.y)&&J.$(a.width,b.width)&&J.$(a.height,b.height)}t.aa=function(a){return this.x<=a.x&&this.x+this.width>=a.x&&this.y<=a.y&&this.y+this.height>=a.y};t.Ae=function(a){return this.x<=a.x&&a.x+a.width<=this.x+this.width&&this.y<=a.y&&a.y+a.height<=this.y+this.height};t.contains=function(a,b,c,d){void 0===c&&(c=0);void 0===d&&(d=0);return this.x<=a&&a+c<=this.x+this.width&&this.y<=b&&b+d<=this.y+this.height};t.offset=function(a,b){this.x+=a;this.y+=b;return this};
t.Vc=function(a,b){return ac(this,b,a,b,a)};t.cq=function(a){return ac(this,a.top,a.right,a.bottom,a.left)};t.kw=function(a){return ac(this,-a.top,-a.right,-a.bottom,-a.left)};t.Oz=function(a,b,c,d){return ac(this,a,b,c,d)};function ac(a,b,c,d,e){var f=a.width;c+e<=-f?(a.x+=f/2,a.width=0):(a.x-=e,a.width+=c+e);c=a.height;b+d<=-c?(a.y+=c/2,a.height=0):(a.y-=b,a.height+=b+d);return a}t.Sz=function(a){return bc(this,a.x,a.y,a.width,a.height)};t.Ev=function(a,b,c,d){return bc(this,a,b,c,d)};
function bc(a,b,c,d,e){var f=Math.max(a.x,b),g=Math.max(a.y,c);b=Math.min(a.x+a.width,b+d);c=Math.min(a.y+a.height,c+e);a.x=f;a.y=g;a.width=Math.max(0,b-f);a.height=Math.max(0,c-g);return a}t.Gc=function(a){return this.Fv(a.x,a.y,a.width,a.height)};t.Fv=function(a,b,c,d){var e=this.width,f=this.x;if(Infinity!==e&&Infinity!==c&&(e+=f,c+=a,isNaN(c)||isNaN(e)||f>c||a>e))return!1;a=this.height;c=this.y;return Infinity!==a&&Infinity!==d&&(a+=c,d+=b,isNaN(d)||isNaN(a)||c>d||b>a)?!1:!0};
function dc(a,b){var c=a.width,d=a.x,e=b.x-10;if(d>b.width+10+10+e||e>c+d)return!1;c=a.height;a=a.y;d=b.y-10;return a>b.height+10+10+d||d>c+a?!1:!0}t.Ie=function(a){return ec(this,a.x,a.y,0,0)};t.Hc=function(a){return ec(this,a.x,a.y,a.width,a.height)};t.rw=function(a,b,c,d){void 0===c&&(c=0);void 0===d&&(d=0);return ec(this,a,b,c,d)};
function ec(a,b,c,d,e){var f=Math.min(a.x,b),g=Math.min(a.y,c);b=Math.max(a.x+a.width,b+d);c=Math.max(a.y+a.height,c+e);a.x=f;a.y=g;a.width=b-f;a.height=c-g;return a}t.xk=function(a,b,c){this.x=a-c.offsetX-c.x*this.width;this.y=b-c.offsetY-c.y*this.height;return this};function fc(a,b,c,d,e,f,g,h){void 0===g&&(g=0);void 0===h&&(h=0);return a<=e&&e+g<=a+c&&b<=f&&f+h<=b+d}function gc(a,b,c,d,e,f,g,h){return a>g+e||e>c+a?!1:b>h+f||f>d+b?!1:!0}
t.u=function(){return isFinite(this.x)&&isFinite(this.y)&&isFinite(this.width)&&isFinite(this.height)};t.Uz=function(){return 0===this.width&&0===this.height};N.alloc=function(){var a=hc.pop();return void 0===a?new N:a};N.allocAt=function(a,b,c,d){var e=hc.pop();return void 0===e?new N(a,b,c,d):e.h(a,b,c,d)};N.free=function(a){hc.push(a)};
ma.Object.defineProperties(N.prototype,{left:{get:function(){return this.x},set:function(a){this.x=a}},top:{get:function(){return this.y},set:function(a){this.y=a}},right:{get:function(){return this.x+this.width},set:function(a){this.x+=a-(this.x+this.width)}},bottom:{get:function(){return this.y+this.height},set:function(a){this.y+=a-(this.y+this.height)}},position:{
get:function(){return new I(this.x,this.y)},set:function(a){this.x=a.x;this.y=a.y}},size:{get:function(){return new M(this.width,this.height)},set:function(a){this.width=a.width;this.height=a.height}},center:{get:function(){return new I(this.x+this.width/2,this.y+this.height/2)},set:function(a){this.x=a.x-this.width/2;this.y=a.y-this.height/2}},centerX:{get:function(){return this.x+this.width/2},
set:function(a){this.x=a-this.width/2}},centerY:{get:function(){return this.y+this.height/2},set:function(a){this.y=a-this.height/2}}});N.prototype.isEmpty=N.prototype.Uz;N.prototype.isReal=N.prototype.u;N.intersectsLineSegment=function(a,b,c,d,e,f,g,h){return J.Rx(a,b,c,d,e,f,g,h)};N.prototype.setSpot=N.prototype.xk;N.prototype.union=N.prototype.rw;N.prototype.unionRect=N.prototype.Hc;N.prototype.unionPoint=N.prototype.Ie;N.prototype.intersects=N.prototype.Fv;
N.prototype.intersectsRect=N.prototype.Gc;N.prototype.intersect=N.prototype.Ev;N.prototype.intersectRect=N.prototype.Sz;N.prototype.grow=N.prototype.Oz;N.prototype.subtractMargin=N.prototype.kw;N.prototype.addMargin=N.prototype.cq;N.prototype.inflate=N.prototype.Vc;N.prototype.offset=N.prototype.offset;N.prototype.contains=N.prototype.contains;N.prototype.containsRect=N.prototype.Ae;N.prototype.containsPoint=N.prototype.aa;N.prototype.equalsApprox=N.prototype.Ma;N.prototype.equalTo=N.prototype.Ri;
N.prototype.equals=N.prototype.w;N.prototype.setSize=N.prototype.uA;N.prototype.setPoint=N.prototype.jd;N.prototype.set=N.prototype.set;N.prototype.setTo=N.prototype.Fg;var ic=null,nc=null,hc=[];N.className="Rect";N.parse=Wb;N.stringify=Zb;N.contains=fc;N.intersects=gc;N.ZeroRect=ic=(new N(0,0,0,0)).ca();N.NoRect=nc=(new N(NaN,NaN,NaN,NaN)).ca();N.parse=Wb;N.stringify=Zb;N.contains=fc;N.intersects=gc;
function oc(a,b,c,d){void 0===a?this.left=this.bottom=this.right=this.top=0:void 0===b?this.left=this.bottom=this.right=this.top=a:void 0===c?(this.top=a,this.right=b,this.bottom=a,this.left=b):void 0!==d?(this.top=a,this.right=b,this.bottom=c,this.left=d):B("Invalid arguments to Margin constructor: "+a+", "+b+", "+c+", "+d);this.s=!1}oc.prototype.assign=function(a){this.top=a.top;this.right=a.right;this.bottom=a.bottom;this.left=a.left;return this};
oc.prototype.Fg=function(a,b,c,d){this.top=a;this.right=b;this.bottom=c;this.left=d;return this};oc.prototype.set=function(a){this.top=a.top;this.right=a.right;this.bottom=a.bottom;this.left=a.left;return this};oc.prototype.copy=function(){var a=new oc;a.top=this.top;a.right=this.right;a.bottom=this.bottom;a.left=this.left;return a};t=oc.prototype;t.ca=function(){this.s=!0;Object.freeze(this);return this};t.G=function(){return this.s||Object.isFrozen(this)?this:this.copy().freeze()};
t.freeze=function(){this.s=!0;return this};t.ea=function(){Object.isFrozen(this)&&B("cannot thaw constant: "+this);this.s=!1;return this};
function pc(a){if("string"===typeof a){a=a.split(" ");for(var b=0,c=NaN;""===a[b];)b++;var d=a[b++];d&&(c=parseFloat(d));if(isNaN(c))return new oc;for(var e=NaN;""===a[b];)b++;(d=a[b++])&&(e=parseFloat(d));if(isNaN(e))return new oc(c);for(var f=NaN;""===a[b];)b++;(d=a[b++])&&(f=parseFloat(d));if(isNaN(f))return new oc(c,e);for(var g=NaN;""===a[b];)b++;(d=a[b++])&&(g=parseFloat(d));return isNaN(g)?new oc(c,e):new oc(c,e,f,g)}return new oc}
function qc(a){return a.top.toString()+" "+a.right.toString()+" "+a.bottom.toString()+" "+a.left.toString()}t.toString=function(){return"Margin("+this.top+","+this.right+","+this.bottom+","+this.left+")"};t.w=function(a){return a instanceof oc?this.top===a.top&&this.right===a.right&&this.bottom===a.bottom&&this.left===a.left:!1};t.Ri=function(a,b,c,d){return this.top===a&&this.right===b&&this.bottom===c&&this.left===d};
t.Ma=function(a){return J.A(this.top,a.top)&&J.A(this.right,a.right)&&J.A(this.bottom,a.bottom)&&J.A(this.left,a.left)};t.u=function(){return isFinite(this.top)&&isFinite(this.right)&&isFinite(this.bottom)&&isFinite(this.left)};oc.alloc=function(){var a=rc.pop();return void 0===a?new oc:a};oc.free=function(a){rc.push(a)};oc.prototype.isReal=oc.prototype.u;oc.prototype.equalsApprox=oc.prototype.Ma;oc.prototype.equalTo=oc.prototype.Ri;oc.prototype.equals=oc.prototype.w;oc.prototype.set=oc.prototype.set;
oc.prototype.setTo=oc.prototype.Fg;var sc=null,tc=null,rc=[];oc.className="Margin";oc.parse=pc;oc.stringify=qc;oc.ZeroMargin=sc=(new oc(0,0,0,0)).ca();oc.TwoMargin=tc=(new oc(2,2,2,2)).ca();oc.parse=pc;oc.stringify=qc;function P(a,b,c,d){void 0===a?this.offsetY=this.offsetX=this.y=this.x=0:(void 0===b&&(b=0),void 0===c&&(c=0),void 0===d&&(d=0),this.x=a,this.y=b,this.offsetX=c,this.offsetY=d);this.s=!1}
var uc,vc,wc,yc,zc,Ac,Bc,Cc,Dc,Gc,Hc,Ic,Jc,Kc,Lc,Mc,Nc,Pc,Qc,Rc,Sc,Tc,Uc,Vc,Zc,$c,ad,bd,cd,dd,ed,fd,gd,hd,id,jd;P.prototype.assign=function(a){this.x=a.x;this.y=a.y;this.offsetX=a.offsetX;this.offsetY=a.offsetY;return this};P.prototype.Fg=function(a,b,c,d){this.x=a;this.y=b;this.offsetX=c;this.offsetY=d;return this};P.prototype.set=function(a){this.x=a.x;this.y=a.y;this.offsetX=a.offsetX;this.offsetY=a.offsetY;return this};
P.prototype.copy=function(){var a=new P;a.x=this.x;a.y=this.y;a.offsetX=this.offsetX;a.offsetY=this.offsetY;return a};t=P.prototype;t.ca=function(){this.s=!0;Object.freeze(this);return this};t.G=function(){return this.s||Object.isFrozen(this)?this:this.copy().freeze()};t.freeze=function(){this.s=!0;return this};t.ea=function(){Object.isFrozen(this)&&B("cannot thaw constant: "+this);this.s=!1;return this};function kd(a,b){a.x=NaN;a.y=NaN;a.offsetX=b;return a}
function ld(a){if("string"===typeof a){a=a.trim();if("None"===a)return uc;if("TopLeft"===a)return vc;if("Top"===a||"TopCenter"===a||"MiddleTop"===a)return wc;if("TopRight"===a)return yc;if("Left"===a||"LeftCenter"===a||"MiddleLeft"===a)return zc;if("Center"===a)return Ac;if("Right"===a||"RightCenter"===a||"MiddleRight"===a)return Bc;if("BottomLeft"===a)return Cc;if("Bottom"===a||"BottomCenter"===a||"MiddleBottom"===a)return Dc;if("BottomRight"===a)return Gc;if("TopSide"===a)return Hc;if("LeftSide"===
a)return Ic;if("RightSide"===a)return Jc;if("BottomSide"===a)return Kc;if("TopBottomSides"===a)return Lc;if("LeftRightSides"===a)return Mc;if("TopLeftSides"===a)return Nc;if("TopRightSides"===a)return Pc;if("BottomLeftSides"===a)return Qc;if("BottomRightSides"===a)return Rc;if("NotTopSide"===a)return Sc;if("NotLeftSide"===a)return Tc;if("NotRightSide"===a)return Uc;if("NotBottomSide"===a)return Vc;if("AllSides"===a)return Zc;if("Default"===a)return $c;a=a.split(" ");for(var b=0,c=0;""===a[b];)b++;
var d=a[b++];void 0!==d&&0<d.length&&(c=parseFloat(d));for(var e=0;""===a[b];)b++;d=a[b++];void 0!==d&&0<d.length&&(e=parseFloat(d));for(var f=0;""===a[b];)b++;d=a[b++];void 0!==d&&0<d.length&&(f=parseFloat(d));for(var g=0;""===a[b];)b++;d=a[b++];void 0!==d&&0<d.length&&(g=parseFloat(d));return new P(c,e,f,g)}return new P}function md(a){return a.eb()?a.x.toString()+" "+a.y.toString()+" "+a.offsetX.toString()+" "+a.offsetY.toString():a.toString()}
t.toString=function(){return this.eb()?0===this.offsetX&&0===this.offsetY?"Spot("+this.x+","+this.y+")":"Spot("+this.x+","+this.y+","+this.offsetX+","+this.offsetY+")":this.w(uc)?"None":this.w(vc)?"TopLeft":this.w(wc)?"Top":this.w(yc)?"TopRight":this.w(zc)?"Left":this.w(Ac)?"Center":this.w(Bc)?"Right":this.w(Cc)?"BottomLeft":this.w(Dc)?"Bottom":this.w(Gc)?"BottomRight":this.w(Hc)?"TopSide":this.w(Ic)?"LeftSide":this.w(Jc)?"RightSide":this.w(Kc)?"BottomSide":this.w(Lc)?"TopBottomSides":this.w(Mc)?
"LeftRightSides":this.w(Nc)?"TopLeftSides":this.w(Pc)?"TopRightSides":this.w(Qc)?"BottomLeftSides":this.w(Rc)?"BottomRightSides":this.w(Sc)?"NotTopSide":this.w(Tc)?"NotLeftSide":this.w(Uc)?"NotRightSide":this.w(Vc)?"NotBottomSide":this.w(Zc)?"AllSides":this.w($c)?"Default":"None"};t.w=function(a){return a instanceof P?(this.x===a.x||isNaN(this.x)&&isNaN(a.x))&&(this.y===a.y||isNaN(this.y)&&isNaN(a.y))&&this.offsetX===a.offsetX&&this.offsetY===a.offsetY:!1};
t.Qv=function(){return new P(.5-(this.x-.5),.5-(this.y-.5),-this.offsetX,-this.offsetY)};t.xf=function(a){if(!this.gd())return!1;if(!a.gd())if(a.w(ad))a=Ic;else if(a.w(bd))a=Jc;else if(a.w(cd))a=Hc;else if(a.w(dd))a=Kc;else return!1;a=a.offsetY;return(this.offsetY&a)===a};t.eb=function(){return!isNaN(this.x)&&!isNaN(this.y)};t.jc=function(){return isNaN(this.x)||isNaN(this.y)};t.gd=function(){return isNaN(this.x)&&isNaN(this.y)&&1===this.offsetX&&0!==this.offsetY};
t.wt=function(){return isNaN(this.x)&&isNaN(this.y)&&0===this.offsetX&&0===this.offsetY};t.Mb=function(){return isNaN(this.x)&&isNaN(this.y)&&-1===this.offsetX&&0===this.offsetY};P.alloc=function(){var a=pd.pop();return void 0===a?new P:a};P.free=function(a){pd.push(a)};P.prototype.isDefault=P.prototype.Mb;P.prototype.isNone=P.prototype.wt;P.prototype.isSide=P.prototype.gd;P.prototype.isNoSpot=P.prototype.jc;P.prototype.isSpot=P.prototype.eb;P.prototype.includesSide=P.prototype.xf;
P.prototype.opposite=P.prototype.Qv;P.prototype.equals=P.prototype.w;P.prototype.set=P.prototype.set;P.prototype.setTo=P.prototype.Fg;var pd=[];P.className="Spot";P.parse=ld;P.stringify=md;P.None=uc=kd(new P(0,0,0,0),0).ca();P.Default=$c=kd(new P(0,0,-1,0),-1).ca();P.TopLeft=vc=(new P(0,0,0,0)).ca();P.TopCenter=wc=(new P(.5,0,0,0)).ca();P.TopRight=yc=(new P(1,0,0,0)).ca();P.LeftCenter=zc=(new P(0,.5,0,0)).ca();P.Center=Ac=(new P(.5,.5,0,0)).ca();P.RightCenter=Bc=(new P(1,.5,0,0)).ca();
P.BottomLeft=Cc=(new P(0,1,0,0)).ca();P.BottomCenter=Dc=(new P(.5,1,0,0)).ca();P.BottomRight=Gc=(new P(1,1,0,0)).ca();P.MiddleTop=ed=wc;P.MiddleLeft=fd=zc;P.MiddleRight=gd=Bc;P.MiddleBottom=hd=Dc;P.Top=cd=wc;P.Left=ad=zc;P.Right=bd=Bc;P.Bottom=dd=Dc;P.TopSide=Hc=kd(new P(0,0,1,1),1).ca();P.LeftSide=Ic=kd(new P(0,0,1,2),1).ca();P.RightSide=Jc=kd(new P(0,0,1,4),1).ca();P.BottomSide=Kc=kd(new P(0,0,1,8),1).ca();P.TopBottomSides=Lc=kd(new P(0,0,1,9),1).ca();P.LeftRightSides=Mc=kd(new P(0,0,1,6),1).ca();
P.TopLeftSides=Nc=kd(new P(0,0,1,3),1).ca();P.TopRightSides=Pc=kd(new P(0,0,1,5),1).ca();P.BottomLeftSides=Qc=kd(new P(0,0,1,10),1).ca();P.BottomRightSides=Rc=kd(new P(0,0,1,12),1).ca();P.NotTopSide=Sc=kd(new P(0,0,1,14),1).ca();P.NotLeftSide=Tc=kd(new P(0,0,1,13),1).ca();P.NotRightSide=Uc=kd(new P(0,0,1,11),1).ca();P.NotBottomSide=Vc=kd(new P(0,0,1,7),1).ca();P.AllSides=Zc=kd(new P(0,0,1,15),1).ca();id=(new P(.156,.156)).ca();jd=(new P(.844,.844)).ca();P.parse=ld;P.stringify=md;
function qd(){this.m11=1;this.m21=this.m12=0;this.m22=1;this.dy=this.dx=0}qd.prototype.set=function(a){this.m11=a.m11;this.m12=a.m12;this.m21=a.m21;this.m22=a.m22;this.dx=a.dx;this.dy=a.dy;return this};qd.prototype.copy=function(){var a=new qd;a.m11=this.m11;a.m12=this.m12;a.m21=this.m21;a.m22=this.m22;a.dx=this.dx;a.dy=this.dy;return a};t=qd.prototype;t.toString=function(){return"Transform("+this.m11+","+this.m12+","+this.m21+","+this.m22+","+this.dx+","+this.dy+")"};
t.w=function(a){return this.m11===a.m11&&this.m12===a.m12&&this.m21===a.m21&&this.m22===a.m22&&this.dx===a.dx&&this.dy===a.dy};t.ut=function(){return 0===this.dx&&0===this.dy&&1===this.m11&&0===this.m12&&0===this.m21&&1===this.m22};t.reset=function(){this.m11=1;this.m21=this.m12=0;this.m22=1;this.dy=this.dx=0;return this};
t.multiply=function(a){var b=this.m11*a.m11+this.m21*a.m12,c=this.m12*a.m11+this.m22*a.m12,d=this.m11*a.m21+this.m21*a.m22,e=this.m12*a.m21+this.m22*a.m22;this.dx=this.m11*a.dx+this.m21*a.dy+this.dx;this.dy=this.m12*a.dx+this.m22*a.dy+this.dy;this.m11=b;this.m12=c;this.m21=d;this.m22=e;return this};
t.Mv=function(a){var b=1/(a.m11*a.m22-a.m12*a.m21),c=a.m22*b,d=-a.m12*b,e=-a.m21*b,f=a.m11*b,g=b*(a.m21*a.dy-a.m22*a.dx);a=b*(a.m12*a.dx-a.m11*a.dy);b=this.m11*c+this.m21*d;c=this.m12*c+this.m22*d;d=this.m11*e+this.m21*f;e=this.m12*e+this.m22*f;this.dx=this.m11*g+this.m21*a+this.dx;this.dy=this.m12*g+this.m22*a+this.dy;this.m11=b;this.m12=c;this.m21=d;this.m22=e;return this};
t.tt=function(){var a=1/(this.m11*this.m22-this.m12*this.m21),b=-this.m12*a,c=-this.m21*a,d=this.m11*a,e=a*(this.m21*this.dy-this.m22*this.dx),f=a*(this.m12*this.dx-this.m11*this.dy);this.m11=this.m22*a;this.m12=b;this.m21=c;this.m22=d;this.dx=e;this.dy=f;return this};
qd.prototype.rotate=function(a,b,c){360<=a?a-=360:0>a&&(a+=360);if(0===a)return this;this.translate(b,c);if(90===a){a=0;var d=1}else 180===a?(a=-1,d=0):270===a?(a=0,d=-1):(d=a*Math.PI/180,a=Math.cos(d),d=Math.sin(d));var e=this.m12*a+this.m22*d,f=this.m11*-d+this.m21*a,g=this.m12*-d+this.m22*a;this.m11=this.m11*a+this.m21*d;this.m12=e;this.m21=f;this.m22=g;this.translate(-b,-c);return this};t=qd.prototype;t.translate=function(a,b){this.dx+=this.m11*a+this.m21*b;this.dy+=this.m12*a+this.m22*b;return this};
t.scale=function(a,b){void 0===b&&(b=a);this.m11*=a;this.m12*=a;this.m21*=b;this.m22*=b;return this};t.ra=function(a){var b=a.x,c=a.y;return a.h(b*this.m11+c*this.m21+this.dx,b*this.m12+c*this.m22+this.dy)};t.Wd=function(a){var b=1/(this.m11*this.m22-this.m12*this.m21),c=a.x,d=a.y;return a.h(c*this.m22*b+d*-this.m21*b+b*(this.m21*this.dy-this.m22*this.dx),c*-this.m12*b+d*this.m11*b+b*(this.m12*this.dx-this.m11*this.dy))};
t.qw=function(a){var b=a.x,c=a.y,d=b+a.width,e=c+a.height,f=this.m11,g=this.m12,h=this.m21,k=this.m22,l=this.dx,m=this.dy,n=b*f+c*h+l,p=b*g+c*k+m,r=d*f+c*h+l,q=d*g+c*k+m;c=b*f+e*h+l;b=b*g+e*k+m;f=d*f+e*h+l;d=d*g+e*k+m;e=Math.min(n,r);n=Math.max(n,r);r=Math.min(p,q);p=Math.max(p,q);e=Math.min(e,c);n=Math.max(n,c);r=Math.min(r,b);p=Math.max(p,b);e=Math.min(e,f);n=Math.max(n,f);r=Math.min(r,d);p=Math.max(p,d);a.h(e,r,n-e,p-r);return a};qd.alloc=function(){var a=rd.pop();return void 0===a?new qd:a};
qd.free=function(a){rd.push(a)};qd.prototype.transformRect=qd.prototype.qw;qd.prototype.invertedTransformPoint=qd.prototype.Wd;qd.prototype.transformPoint=qd.prototype.ra;qd.prototype.scale=qd.prototype.scale;qd.prototype.translate=qd.prototype.translate;qd.prototype.rotate=qd.prototype.rotate;qd.prototype.invert=qd.prototype.tt;qd.prototype.multiplyInverted=qd.prototype.Mv;qd.prototype.multiply=qd.prototype.multiply;qd.prototype.reset=qd.prototype.reset;qd.prototype.isIdentity=qd.prototype.ut;
qd.prototype.equals=qd.prototype.w;qd.prototype.set=qd.prototype.set;var rd=[];qd.className="Transform";qd.xF="54a702f3e53909c447824c6706603faf4c";
var J={DA:"7da71ca0ad381e90",Ig:(Math.sqrt(2)-1)/3*4,Hw:null,sqrt:function(a){if(0>=a)return 0;var b=J.Hw;if(null===b){b=[];for(var c=0;2E3>=c;c++)b[c]=Math.sqrt(c);J.Hw=b}return 1>a?(c=1/a,2E3>=c?1/b[c|0]:Math.sqrt(a)):2E3>=a?b[a|0]:Math.sqrt(a)},A:function(a,b){a-=b;return.5>a&&-.5<a},$:function(a,b){a-=b;return 5E-8>a&&-5E-8<a},Nb:function(a,b,c,d,e,f,g){0>=e&&(e=1E-6);if(a<c){var h=a;var k=c}else h=c,k=a;if(b<d){var l=b;var m=d}else l=d,m=b;if(a===c)return l<=g&&g<=m&&a-e<=f&&f<=a+e;if(b===d)return h<=
f&&f<=k&&b-e<=g&&g<=b+e;k+=e;h-=e;if(h<=f&&f<=k&&(m+=e,l-=e,l<=g&&g<=m))if(k-h>m-l)if(a-c>e||c-a>e){if(f=(d-b)/(c-a)*(f-a)+b,f-e<=g&&g<=f+e)return!0}else return!0;else if(b-d>e||d-b>e){if(g=(c-a)/(d-b)*(g-b)+a,g-e<=f&&f<=g+e)return!0}else return!0;return!1},at:function(a,b,c,d,e,f,g,h,k,l,m,n){if(J.Nb(a,b,g,h,n,c,d)&&J.Nb(a,b,g,h,n,e,f))return J.Nb(a,b,g,h,n,l,m);var p=(a+c)/2,r=(b+d)/2,q=(c+e)/2,u=(d+f)/2;e=(e+g)/2;f=(f+h)/2;d=(p+q)/2;c=(r+u)/2;q=(q+e)/2;u=(u+f)/2;var v=(d+q)/2,w=(c+u)/2;return J.at(a,
b,p,r,d,c,v,w,k,l,m,n)||J.at(v,w,q,u,e,f,g,h,k,l,m,n)},Qy:function(a,b,c,d,e,f,g,h,k){var l=(c+e)/2,m=(d+f)/2;k.h((((a+c)/2+l)/2+(l+(e+g)/2)/2)/2,(((b+d)/2+m)/2+(m+(f+h)/2)/2)/2);return k},Py:function(a,b,c,d,e,f,g,h){var k=(c+e)/2,l=(d+f)/2;return Db(((a+c)/2+k)/2,((b+d)/2+l)/2,(k+(e+g)/2)/2,(l+(f+h)/2)/2)},bm:function(a,b,c,d,e,f,g,h,k,l){if(J.Nb(a,b,g,h,k,c,d)&&J.Nb(a,b,g,h,k,e,f))ec(l,a,b,0,0),ec(l,g,h,0,0);else{var m=(a+c)/2,n=(b+d)/2,p=(c+e)/2,r=(d+f)/2;e=(e+g)/2;f=(f+h)/2;d=(m+p)/2;c=(n+r)/
2;p=(p+e)/2;r=(r+f)/2;var q=(d+p)/2,u=(c+r)/2;J.bm(a,b,m,n,d,c,q,u,k,l);J.bm(q,u,p,r,e,f,g,h,k,l)}return l},ze:function(a,b,c,d,e,f,g,h,k,l){if(J.Nb(a,b,g,h,k,c,d)&&J.Nb(a,b,g,h,k,e,f))0===l.length&&(l.push(a),l.push(b)),l.push(g),l.push(h);else{var m=(a+c)/2,n=(b+d)/2,p=(c+e)/2,r=(d+f)/2;e=(e+g)/2;f=(f+h)/2;d=(m+p)/2;c=(n+r)/2;p=(p+e)/2;r=(r+f)/2;var q=(d+p)/2,u=(c+r)/2;J.ze(a,b,m,n,d,c,q,u,k,l);J.ze(q,u,p,r,e,f,g,h,k,l)}return l},Tv:function(a,b,c,d,e,f,g,h,k,l){if(J.Nb(a,b,e,f,l,c,d))return J.Nb(a,
b,e,f,l,h,k);var m=(a+c)/2,n=(b+d)/2;c=(c+e)/2;d=(d+f)/2;var p=(m+c)/2,r=(n+d)/2;return J.Tv(a,b,m,n,p,r,g,h,k,l)||J.Tv(p,r,c,d,e,f,g,h,k,l)},JA:function(a,b,c,d,e,f,g){g.h(((a+c)/2+(c+e)/2)/2,((b+d)/2+(d+f)/2)/2);return g},Sv:function(a,b,c,d,e,f,g,h){if(J.Nb(a,b,e,f,g,c,d))ec(h,a,b,0,0),ec(h,e,f,0,0);else{var k=(a+c)/2,l=(b+d)/2;c=(c+e)/2;d=(d+f)/2;var m=(k+c)/2,n=(l+d)/2;J.Sv(a,b,k,l,m,n,g,h);J.Sv(m,n,c,d,e,f,g,h)}return h},Cq:function(a,b,c,d,e,f,g,h){if(J.Nb(a,b,e,f,g,c,d))0===h.length&&(h.push(a),
h.push(b)),h.push(e),h.push(f);else{var k=(a+c)/2,l=(b+d)/2;c=(c+e)/2;d=(d+f)/2;var m=(k+c)/2,n=(l+d)/2;J.Cq(a,b,k,l,m,n,g,h);J.Cq(m,n,c,d,e,f,g,h)}return h},eq:function(a,b,c,d,e,f,g,h,k,l,m,n,p,r){if(J.Nb(a,b,g,h,p,c,d)&&J.Nb(a,b,g,h,p,e,f)){var q=(a-g)*(l-n)-(b-h)*(k-m);if(0===q)return!1;p=((a*h-b*g)*(k-m)-(a-g)*(k*n-l*m))/q;q=((a*h-b*g)*(l-n)-(b-h)*(k*n-l*m))/q;if((k>m?k-m:m-k)<(l>n?l-n:n-l)){if(b<h?g=b:(g=h,h=b),q<g||q>h)return!1}else if(a<g?h=a:(h=g,g=a),p<h||p>g)return!1;r.h(p,q);return!0}q=
(a+c)/2;var u=(b+d)/2;c=(c+e)/2;d=(d+f)/2;e=(e+g)/2;f=(f+h)/2;var v=(q+c)/2,w=(u+d)/2;c=(c+e)/2;d=(d+f)/2;var y=(v+c)/2,z=(w+d)/2,A=(m-k)*(m-k)+(n-l)*(n-l),C=!1;J.eq(a,b,q,u,v,w,y,z,k,l,m,n,p,r)&&(a=(r.x-k)*(r.x-k)+(r.y-l)*(r.y-l),a<A&&(A=a,C=!0));a=r.x;b=r.y;J.eq(y,z,c,d,e,f,g,h,k,l,m,n,p,r)&&((r.x-k)*(r.x-k)+(r.y-l)*(r.y-l)<A?C=!0:r.h(a,b));return C},fq:function(a,b,c,d,e,f,g,h,k,l,m,n,p){var r=0;if(J.Nb(a,b,g,h,p,c,d)&&J.Nb(a,b,g,h,p,e,f)){p=(a-g)*(l-n)-(b-h)*(k-m);if(0===p)return r;var q=((a*
h-b*g)*(k-m)-(a-g)*(k*n-l*m))/p,u=((a*h-b*g)*(l-n)-(b-h)*(k*n-l*m))/p;if(q>=m)return r;if((k>m?k-m:m-k)<(l>n?l-n:n-l)){if(b<h?(a=b,b=h):a=h,u<a||u>b)return r}else if(a<g?(b=a,a=g):b=g,q<b||q>a)return r;0<p?r++:0>p&&r--}else{q=(a+c)/2;u=(b+d)/2;var v=(c+e)/2,w=(d+f)/2;e=(e+g)/2;f=(f+h)/2;d=(q+v)/2;c=(u+w)/2;v=(v+e)/2;w=(w+f)/2;var y=(d+v)/2,z=(c+w)/2;r+=J.fq(a,b,q,u,d,c,y,z,k,l,m,n,p);r+=J.fq(y,z,v,w,e,f,g,h,k,l,m,n,p)}return r},Lh:function(a,b,c,d,e,f,g){if(J.$(a,c)){b<d?(c=b,b=d):c=d;if(f<c)return g.h(a,
c),!1;if(f>b)return g.h(a,b),!1;g.h(a,f);return!0}if(J.$(b,d)){a<c?(d=a,a=c):d=c;if(e<d)return g.h(d,b),!1;if(e>a)return g.h(a,b),!1;g.h(e,b);return!0}e=((a-e)*(a-c)+(b-f)*(b-d))/((c-a)*(c-a)+(d-b)*(d-b));if(-5E-6>e)return g.h(a,b),!1;if(1.000005<e)return g.h(c,d),!1;g.h(a+e*(c-a),b+e*(d-b));return!0},Ee:function(a,b,c,d,e,f,g,h,k){if(J.A(a,c)&&J.A(b,d))return k.h(a,b),!1;if(J.$(e,g))return J.$(a,c)?(J.Lh(a,b,c,d,e,f,k),!1):J.Lh(a,b,c,d,e,(d-b)/(c-a)*(e-a)+b,k);h=(h-f)/(g-e);if(J.$(a,c)){c=h*(a-e)+
f;b<d?(e=b,b=d):e=d;if(c<e)return k.h(a,e),!1;if(c>b)return k.h(a,b),!1;k.h(a,c);return!0}g=(d-b)/(c-a);if(J.$(h,g))return J.Lh(a,b,c,d,e,f,k),!1;e=(g*a-h*e+f-b)/(g-h);if(J.$(g,0)){a<c?(d=a,a=c):d=c;if(e<d)return k.h(d,b),!1;if(e>a)return k.h(a,b),!1;k.h(e,b);return!0}return J.Lh(a,b,c,d,e,g*(e-a)+b,k)},IA:function(a,b,c,d,e){return J.Ee(c.x,c.y,d.x,d.y,a.x,a.y,b.x,b.y,e)},HA:function(a,b,c,d,e,f,g,h,k,l){function m(c,d){var e=(c-a)*(c-a)+(d-b)*(d-b);e<n&&(n=e,k.h(c,d))}var n=Infinity;m(k.x,k.y);
var p=0,r=0,q=0,u=0;e<g?(p=e,r=g):(p=g,r=e);f<h?(q=e,u=g):(q=g,u=e);p=(r-p)/2+l;l=(u-q)/2+l;e=(e+g)/2;f=(f+h)/2;if(0===p||0===l)return k;if(.5>(c>a?c-a:a-c)){p=1-(c-e)*(c-e)/(p*p);if(0>p)return k;p=Math.sqrt(p);d=-l*p+f;m(c,l*p+f);m(c,d)}else{c=(d-b)/(c-a);d=1/(p*p)+c*c/(l*l);h=2*c*(b-c*a)/(l*l)-2*c*f/(l*l)-2*e/(p*p);p=h*h-4*d*(2*c*a*f/(l*l)-2*b*f/(l*l)+f*f/(l*l)+e*e/(p*p)-1+(b-c*a)*(b-c*a)/(l*l));if(0>p)return k;p=Math.sqrt(p);l=(-h+p)/(2*d);m(l,c*l-c*a+b);p=(-h-p)/(2*d);m(p,c*p-c*a+b)}return k},
Uc:function(a,b,c,d,e,f,g,h,k){var l=1E21,m=a,n=b;if(J.Ee(a,b,a,d,e,f,g,h,k)){var p=(k.x-e)*(k.x-e)+(k.y-f)*(k.y-f);p<l&&(l=p,m=k.x,n=k.y)}J.Ee(c,b,c,d,e,f,g,h,k)&&(p=(k.x-e)*(k.x-e)+(k.y-f)*(k.y-f),p<l&&(l=p,m=k.x,n=k.y));J.Ee(a,b,c,b,e,f,g,h,k)&&(b=(k.x-e)*(k.x-e)+(k.y-f)*(k.y-f),b<l&&(l=b,m=k.x,n=k.y));J.Ee(a,d,c,d,e,f,g,h,k)&&(a=(k.x-e)*(k.x-e)+(k.y-f)*(k.y-f),a<l&&(l=a,m=k.x,n=k.y));k.h(m,n);return 1E21>l},GA:function(a,b,c,d,e,f,g,h,k){c=a-c;g=e-g;0===c||0===g?0===c?(b=(f-h)/g,h=a,e=b*h+(f-
b*e)):(f=(b-d)/c,h=e,e=f*h+(b-f*a)):(d=(b-d)/c,h=(f-h)/g,a=b-d*a,h=(f-h*e-a)/(d-h),e=d*h+a);k.h(h,e);return k},rt:function(a,b,c){return J.Rx(a.x,a.y,a.width,a.height,b.x,b.y,c.x,c.y)},Rx:function(a,b,c,d,e,f,g,h){var k=a+c,l=b+d;return e===g?(f<h?(g=f,f=h):g=h,a<=e&&e<=k&&g<=l&&f>=b):f===h?(e<g?(h=e,e=g):h=g,b<=f&&f<=l&&h<=k&&e>=a):fc(a,b,c,d,e,f)||fc(a,b,c,d,g,h)||J.sq(a,b,k,b,e,f,g,h)||J.sq(k,b,k,l,e,f,g,h)||J.sq(k,l,a,l,e,f,g,h)||J.sq(a,l,a,b,e,f,g,h)?!0:!1},sq:function(a,b,c,d,e,f,g,h){return 0>=
J.dt(a,b,c,d,e,f)*J.dt(a,b,c,d,g,h)&&0>=J.dt(e,f,g,h,a,b)*J.dt(e,f,g,h,c,d)},dt:function(a,b,c,d,e,f){c-=a;d-=b;a=e-a;b=f-b;f=a*d-b*c;0===f&&(f=a*c+b*d,0<f&&(f=(a-c)*c+(b-d)*d,0>f&&(f=0)));return 0>f?-1:0<f?1:0},zq:function(a){0>a&&(a+=360);360<=a&&(a-=360);return a},Cx:function(a,b,c,d,e,f){var g=Math.PI;f||(d*=g/180,e*=g/180);var h=d>e?-1:1;f=[];var k=g/2,l=d;d=Math.min(2*g,Math.abs(e-d));if(1E-5>d)return k=l+h*Math.min(d,k),h=a+c*Math.cos(l),l=b+c*Math.sin(l),a+=c*Math.cos(k),b+=c*Math.sin(k),
c=(h+a)/2,k=(l+b)/2,f.push([h,l,c,k,c,k,a,b]),f;for(;1E-5<d;)e=l+h*Math.min(d,k),f.push(J.Xy(c,l,e,a,b)),d-=Math.abs(e-l),l=e;return f},Xy:function(a,b,c,d,e){var f=(c-b)/2,g=a*Math.cos(f),h=a*Math.sin(f),k=-h,l=g*g+k*k,m=l+g*g+k*h;l=4/3*(Math.sqrt(2*l*m)-m)/(g*h-k*g);h=g-l*k;g=k+l*g;k=-g;l=f+b;f=Math.cos(l);l=Math.sin(l);return[d+a*Math.cos(b),e+a*Math.sin(b),d+h*f-g*l,e+h*l+g*f,d+h*f-k*l,e+h*l+k*f,d+a*Math.cos(c),e+a*Math.sin(c)]},mq:function(a,b,c,d,e,f,g){c=Math.floor((a-c)/e)*e+c;d=Math.floor((b-
d)/f)*f+d;var h=c;c+e-a<e/2&&(h=c+e);a=d;d+f-b<f/2&&(a=d+f);g.h(h,a);return g},Nx:function(a,b){var c=Math.max(a,b);a=Math.min(a,b);var d;do b=c%a,c=d=a,a=b;while(0<b);return d},bz:function(a,b,c,d){var e=0>c,f=0>d;if(a<b){var g=1;var h=0}else g=0,h=1;var k=0===g?a:b;var l=0===g?c:d;if(0===g?e:f)l=-l;g=h;c=0===g?c:d;if(0===g?e:f)c=-c;return J.cz(k,0===g?a:b,l,c,0,0)},cz:function(a,b,c,d,e,f){if(0<d)if(0<c){e=a*a;f=b*b;a*=c;var g=b*d,h=-f+g,k=-f+Math.sqrt(a*a+g*g);b=h;for(var l=0;9999999999>l;++l){b=
.5*(h+k);if(b===h||b===k)break;var m=a/(b+e),n=g/(b+f);m=m*m+n*n-1;if(0<m)h=b;else if(0>m)k=b;else break}c=e*c/(b+e)-c;d=f*d/(b+f)-d;c=Math.sqrt(c*c+d*d)}else c=Math.abs(d-b);else d=a*a-b*b,f=a*c,f<d?(d=f/d,f=b*Math.sqrt(Math.abs(1-d*d)),c=a*d-c,c=Math.sqrt(c*c+f*f)):c=Math.abs(c-a);return c},Ke:new db,Nm:new db,Ff:new db,Gf:0};J.za=J.DA;
function sd(a){Ya(this);this.s=!1;void 0===a&&(a=td);this.pa=a;this.mc=this.ec=this.Sc=this.Rc=0;this.rj=new E;this.Dr=this.rj.Aa;this.kr=(new N).freeze();this.qa=!0;this.Tm=this.Gk=null;this.Um=NaN;this.jf=vc;this.kf=Gc;this.jl=this.kl=NaN;this.Qf=ud}
sd.prototype.copy=function(){var a=new sd;a.pa=this.pa;a.Rc=this.Rc;a.Sc=this.Sc;a.ec=this.ec;a.mc=this.mc;for(var b=this.rj.j,c=b.length,d=a.rj,e=0;e<c;e++){var f=b[e].copy();d.add(f)}a.Dr=this.Dr;a.kr.assign(this.kr);a.qa=this.qa;a.Gk=this.Gk;a.Tm=this.Tm;a.Um=this.Um;a.jf=this.jf.G();a.kf=this.kf.G();a.kl=this.kl;a.jl=this.jl;a.Qf=this.Qf;return a};t=sd.prototype;t.ca=function(){this.freeze();Object.freeze(this);return this};
t.freeze=function(){this.s=!0;var a=this.figures;a.freeze();a=a.j;for(var b=a.length,c=0;c<b;c++)a[c].freeze();return this};t.ea=function(){Object.isFrozen(this)&&B("cannot thaw constant: "+this);this.s=!1;var a=this.figures;a.ea();a=a.j;for(var b=a.length,c=0;c<b;c++)a[c].ea();return this};
t.Ma=function(a){if(!(a instanceof sd))return!1;if(this.type!==a.type)return this.type===vd&&a.type===td?wd(this,a):a.type===vd&&this.type===td?wd(a,this):!1;if(this.type===td){var b=this.figures.j;a=a.figures.j;var c=b.length;if(c!==a.length)return!1;for(var d=0;d<c;d++)if(!b[d].Ma(a[d]))return!1;return!0}return J.A(this.startX,a.startX)&&J.A(this.startY,a.startY)&&J.A(this.endX,a.endX)&&J.A(this.endY,a.endY)};
function wd(a,b){return a.type!==vd||b.type!==td?!1:1===b.figures.count&&(b=b.figures.L(0),1===b.segments.count&&J.A(a.startX,b.startX)&&J.A(a.startY,b.startY)&&(b=b.segments.L(0),b.type===xd&&J.A(a.endX,b.endX)&&J.A(a.endY,b.endY)))?!0:!1}function yd(a){return a.toString()}t.cb=function(a){a.classType===sd&&(this.type=a)};
t.toString=function(a){void 0===a&&(a=-1);switch(this.type){case vd:return 0>a?"M"+this.startX.toString()+" "+this.startY.toString()+"L"+this.endX.toString()+" "+this.endY.toString():"M"+this.startX.toFixed(a)+" "+this.startY.toFixed(a)+"L"+this.endX.toFixed(a)+" "+this.endY.toFixed(a);case Gd:var b=new N(this.startX,this.startY,0,0);b.rw(this.endX,this.endY,0,0);return 0>a?"M"+b.x.toString()+" "+b.y.toString()+"H"+b.right.toString()+"V"+b.bottom.toString()+"H"+b.left.toString()+"z":"M"+b.x.toFixed(a)+
" "+b.y.toFixed(a)+"H"+b.right.toFixed(a)+"V"+b.bottom.toFixed(a)+"H"+b.left.toFixed(a)+"z";case Hd:b=new N(this.startX,this.startY,0,0);b.rw(this.endX,this.endY,0,0);if(0>a)return a=b.left.toString()+" "+(b.y+b.height/2).toString(),"M"+a+"A"+(b.width/2).toString()+" "+(b.height/2).toString()+" 0 0 1 "+(b.right.toString()+" "+(b.y+b.height/2).toString())+"A"+(b.width/2).toString()+" "+(b.height/2).toString()+" 0 0 1 "+a;var c=b.left.toFixed(a)+" "+(b.y+b.height/2).toFixed(a);return"M"+c+"A"+(b.width/
2).toFixed(a)+" "+(b.height/2).toFixed(a)+" 0 0 1 "+(b.right.toFixed(a)+" "+(b.y+b.height/2).toFixed(a))+"A"+(b.width/2).toFixed(a)+" "+(b.height/2).toFixed(a)+" 0 0 1 "+c;case td:b="";c=this.figures.j;for(var d=c.length,e=0;e<d;e++){var f=c[e];0<e&&(b+=" x ");f.isFilled&&(b+="F ");b+=f.toString(a)}return b;default:return this.type.toString()}};
function Id(a,b){function c(){return u>=A-1?!0:null!==k[u+1].match(/[UuBbMmZzLlHhVvCcSsQqTtAaFfXx]/)}function d(){u++;return k[u]}function e(){var a=new I(parseFloat(d()),parseFloat(d()));v===v.toLowerCase()&&(a.x=z.x+a.x,a.y=z.y+a.y);return a}function f(){return z=e()}function g(){return y=e()}function h(){var a=w.toLowerCase();return"c"!==a&&"s"!==a&&"q"!==a&&"t"!==a?z:new I(2*z.x-y.x,2*z.y-y.y)}void 0===b&&(b=!1);a=a.replace(/,/gm," ");a=a.replace(/([UuBbMmZzLlHhVvCcSsQqTtAaFfXx])([UuBbMmZzLlHhVvCcSsQqTtAaFfXx])/gm,
"$1 $2");a=a.replace(/([UuBbMmZzLlHhVvCcSsQqTtAaFfXx])([UuBbMmZzLlHhVvCcSsQqTtAaFfXx])/gm,"$1 $2");a=a.replace(/([UuBbMmZzLlHhVvCcSsQqTtAaFfXx])([^\s])/gm,"$1 $2");a=a.replace(/([^\s])([UuBbMmZzLlHhVvCcSsQqTtAaFfXx])/gm,"$1 $2");a=a.replace(/([0-9])([+\-])/gm,"$1 $2");a=a.replace(/([Aa](\s+[0-9]+){3})\s+([01])\s*([01])/gm,"$1 $3 $4 ");a=a.replace(/[\s\r\t\n]+/gm," ");a=a.replace(/^\s+|\s+$/g,"");var k=a.split(" ");for(a=0;a<k.length;a++){var l=k[a];if(null!==l.match(/(\.[0-9]*)(\.)/gm)){for(var m=
Fa(),n="",p=!1,r=0;r<l.length;r++){var q=l[r];"."!==q||p?"."===q?(m.push(n),n="."):n+=q:(p=!0,n+=q)}m.push(n);k.splice(a,1);for(l=0;l<m.length;l++)k.splice(a+l,0,m[l]);a+=m.length-1;Ha(m)}}var u=-1,v="",w="";m=new I(0,0);var y=new I(0,0),z=new I(0,0),A=k.length;a=Jd(null);n=l=!1;p=!0;for(r=null;!(u>=A-1);)if(w=v,v=d(),""!==v)switch(v.toUpperCase()){case "X":p=!0;n=l=!1;break;case "M":r=f();null===a.fc||!0===p?(Kd(a,r.x,r.y,l,!n),p=!1):a.moveTo(r.x,r.y);for(m=z;!c();)r=f(),a.lineTo(r.x,r.y);break;
case "L":for(;!c();)r=f(),a.lineTo(r.x,r.y);break;case "H":for(;!c();)z=new I((v===v.toLowerCase()?z.x:0)+parseFloat(d()),z.y),a.lineTo(z.x,z.y);break;case "V":for(;!c();)z=new I(z.x,(v===v.toLowerCase()?z.y:0)+parseFloat(d())),a.lineTo(z.x,z.y);break;case "C":for(;!c();){r=e();q=g();var C=f();Ld(a,r.x,r.y,q.x,q.y,C.x,C.y)}break;case "S":for(;!c();)r=h(),q=g(),C=f(),Ld(a,r.x,r.y,q.x,q.y,C.x,C.y);break;case "Q":for(;!c();)r=g(),q=f(),Qd(a,r.x,r.y,q.x,q.y);break;case "T":for(;!c();)y=r=h(),q=f(),Qd(a,
r.x,r.y,q.x,q.y);break;case "B":for(;!c();){r=parseFloat(d());q=parseFloat(d());C=parseFloat(d());var H=parseFloat(d()),L=parseFloat(d()),K=L,V=!1;c()||(K=parseFloat(d()),c()||(V=0!==parseFloat(d())));v===v.toLowerCase()&&(C+=z.x,H+=z.y);a.arcTo(r,q,C,H,L,K,V)}break;case "A":for(;!c();)r=Math.abs(parseFloat(d())),q=Math.abs(parseFloat(d())),C=parseFloat(d()),H=!!parseFloat(d()),L=!!parseFloat(d()),K=f(),Rd(a,r,q,C,H,L,K.x,K.y);break;case "Z":Sd(a);z=m;break;case "F":r="";for(q=1;k[u+q];)if(null!==
k[u+q].match(/[Uu]/))q++;else if(null===k[u+q].match(/[UuBbMmZzLlHhVvCcSsQqTtAaFfXx]/))q++;else{r=k[u+q];break}r.match(/[Mm]/)?l=!0:0<a.fc.segments.length&&(a.fc.isFilled=!0);break;case "U":r="";for(q=1;k[u+q];)if(null!==k[u+q].match(/[Ff]/))q++;else if(null===k[u+q].match(/[UuBbMmZzLlHhVvCcSsQqTtAaFfXx]/))q++;else{r=k[u+q];break}r.match(/[Mm]/)?n=!0:a.Lq(!1)}m=a.mt;Td=a;if(b)for(b=m.figures.iterator;b.next();)b.value.isFilled=!0;return m}
function Ud(a,b){for(var c=a.length,d=I.alloc(),e=0;e<c;e++){var f=a[e];d.x=f[0];d.y=f[1];b.ra(d);f[0]=d.x;f[1]=d.y;d.x=f[2];d.y=f[3];b.ra(d);f[2]=d.x;f[3]=d.y;d.x=f[4];d.y=f[5];b.ra(d);f[4]=d.x;f[5]=d.y;d.x=f[6];d.y=f[7];b.ra(d);f[6]=d.x;f[7]=d.y}I.free(d)}t.Jv=function(){if(this.qa||this.Dr!==this.figures.Aa)return!0;for(var a=this.figures.j,b=a.length,c=0;c<b;c++)if(a[c].Jv())return!0;return!1};
sd.prototype.computeBounds=function(){this.qa=!1;this.Tm=this.Gk=null;this.Um=NaN;this.Dr=this.figures.Aa;for(var a=this.figures.j,b=a.length,c=0;c<b;c++){var d=a[c];d.qa=!1;var e=d.segments;d.Is=e.Aa;d=e.j;e=d.length;for(var f=0;f<e;f++){var g=d[f];g.qa=!1;g.Me=null}}a=this.kr;a.ea();isNaN(this.kl)||isNaN(this.jl)?a.h(0,0,0,0):a.h(0,0,this.kl,this.jl);Vd(this,a,!1);ec(a,0,0,0,0);a.freeze()};sd.prototype.Bx=function(){var a=new N;Vd(this,a,!0);return a};
function Vd(a,b,c){switch(a.type){case vd:case Gd:case Hd:c?b.h(a.Rc,a.Sc,0,0):ec(b,a.Rc,a.Sc,0,0);ec(b,a.ec,a.mc,0,0);break;case td:var d=a.figures;a=d.j;d=d.length;for(var e=0;e<d;e++){var f=a[e];c&&0===e?b.h(f.startX,f.startY,0,0):ec(b,f.startX,f.startY,0,0);for(var g=f.segments.j,h=g.length,k=f.startX,l=f.startY,m=0;m<h;m++){var n=g[m];switch(n.type){case xd:case Wd:k=n.endX;l=n.endY;ec(b,k,l,0,0);break;case Xd:J.bm(k,l,n.point1X,n.point1Y,n.point2X,n.point2Y,n.endX,n.endY,.5,b);k=n.endX;l=n.endY;
break;case Yd:J.Sv(k,l,n.point1X,n.point1Y,n.endX,n.endY,.5,b);k=n.endX;l=n.endY;break;case Zd:case $d:var p=n.type===Zd?ae(n,f):be(n,f,k,l),r=p.length;if(0===r){k=n.centerX;l=n.centerY;ec(b,k,l,0,0);break}n=null;for(var q=0;q<r;q++)n=p[q],J.bm(n[0],n[1],n[2],n[3],n[4],n[5],n[6],n[7],.5,b);null!==n&&(k=n[6],l=n[7]);break;default:B("Unknown Segment type: "+n.type)}}}break;default:B("Unknown Geometry type: "+a.type)}}
sd.prototype.normalize=function(){this.s&&ua(this);var a=this.Bx();this.offset(-a.x,-a.y);return new I(-a.x,-a.y)};sd.prototype.offset=function(a,b){this.s&&ua(this);this.transform(1,0,0,1,a,b);return this};sd.prototype.scale=function(a,b){this.s&&ua(this);this.transform(a,0,0,b,0,0);return this};sd.prototype.rotate=function(a,b,c){this.s&&ua(this);void 0===b&&(b=0);void 0===c&&(c=0);var d=qd.alloc();d.reset();d.rotate(a,b,c);this.transform(d.m11,d.m12,d.m21,d.m22,d.dx,d.dy);qd.free(d);return this};
t=sd.prototype;
t.transform=function(a,b,c,d,e,f){switch(this.type){case vd:case Gd:case Hd:var g=this.Rc;var h=this.Sc;this.Rc=g*a+h*c+e;this.Sc=g*b+h*d+f;g=this.ec;h=this.mc;this.ec=g*a+h*c+e;this.mc=g*b+h*d+f;break;case td:for(var k=this.figures.j,l=k.length,m=0;m<l;m++){var n=k[m];g=n.startX;h=n.startY;n.startX=g*a+h*c+e;n.startY=g*b+h*d+f;n=n.segments.j;for(var p=n.length,r=0;r<p;r++){var q=n[r];switch(q.type){case xd:case Wd:g=q.endX;h=q.endY;q.endX=g*a+h*c+e;q.endY=g*b+h*d+f;break;case Xd:g=q.point1X;h=q.point1Y;
q.point1X=g*a+h*c+e;q.point1Y=g*b+h*d+f;g=q.point2X;h=q.point2Y;q.point2X=g*a+h*c+e;q.point2Y=g*b+h*d+f;g=q.endX;h=q.endY;q.endX=g*a+h*c+e;q.endY=g*b+h*d+f;break;case Yd:g=q.point1X;h=q.point1Y;q.point1X=g*a+h*c+e;q.point1Y=g*b+h*d+f;g=q.endX;h=q.endY;q.endX=g*a+h*c+e;q.endY=g*b+h*d+f;break;case Zd:g=q.centerX;h=q.centerY;q.centerX=g*a+h*c+e;q.centerY=g*b+h*d+f;0!==b&&(g=180*Math.atan2(b,a)/Math.PI,0>g&&(g+=360),q.startAngle+=g);0>a&&(q.startAngle=180-q.startAngle,q.sweepAngle=-q.sweepAngle);0>d&&
(q.startAngle=-q.startAngle,q.sweepAngle=-q.sweepAngle);q.radiusX*=Math.sqrt(a*a+c*c);void 0!==q.radiusY&&(q.radiusY*=Math.sqrt(b*b+d*d));break;case $d:g=q.endX;h=q.endY;q.endX=g*a+h*c+e;q.endY=g*b+h*d+f;0!==b&&(g=180*Math.atan2(b,a)/Math.PI,0>g&&(g+=360),q.xAxisRotation+=g);0>a&&(q.xAxisRotation=180-q.xAxisRotation,q.isClockwiseArc=!q.isClockwiseArc);0>d&&(q.xAxisRotation=-q.xAxisRotation,q.isClockwiseArc=!q.isClockwiseArc);q.radiusX*=Math.sqrt(a*a+c*c);q.radiusY*=Math.sqrt(b*b+d*d);break;default:B("Unknown Segment type: "+
q.type)}}}}this.qa=!0;return this};
t.aa=function(a,b){void 0===b&&(b=0);var c=this.Rc,d=this.Sc,e=this.ec,f=this.mc;switch(this.type){case vd:return J.Nb(c,d,e,f,b,a.x,a.y);case Gd:var g=N.allocAt(Math.min(c,e)-b,Math.min(d,f)-b,Math.abs(e-c)+2*b,Math.abs(f-d)+2*b);a=g.aa(a);N.free(g);return a;case Hd:g=Math.min(c,e)-b;var h=Math.min(d,f)-b;c=(Math.abs(e-c)+2*b)/2;b=(Math.abs(f-d)+2*b)/2;if(0>=c||0>=b)return!1;g=a.x-(g+c);h=a.y-(h+b);return 1>=g*g/(c*c)+h*h/(b*b);case td:return ce(this,a,b,!0,!1);default:return!1}};
function ce(a,b,c,d,e){var f=b.x;b=b.y;for(var g=a.bounds.x-20,h=0,k,l,m,n,p=a.figures.j,r=p.length,q=0;q<r;q++){var u=p[q];if(u.isFilled){if(d&&u.aa(f,b,c))return!0;var v=u.segments;k=u.startX;l=u.startY;for(var w=k,y=l,z=v.j,A=0;A<=v.length;A++){var C=void 0;if(A!==v.length){C=z[A];var H=C.type;a=C.endX;n=C.endY}else H=xd,a=w,n=y;switch(H){case Wd:w=de(f,b,g,b,k,l,w,y);if(isNaN(w))return!0;h+=w;w=a;y=n;break;case xd:k=de(f,b,g,b,k,l,a,n);if(isNaN(k))return!0;h+=k;break;case Xd:m=J.fq(k,l,C.point1X,
C.point1Y,C.point2X,C.point2Y,a,n,g,b,f,b,.5);h+=m;break;case Yd:m=J.fq(k,l,(k+2*C.point1X)/3,(l+2*C.point1Y)/3,(2*C.point1X+a)/3,(2*C.point1Y+n)/3,a,n,g,b,f,b,.5);h+=m;break;case Zd:case $d:H=C.type===Zd?ae(C,u):be(C,u,k,l);var L=H.length;if(0===L){k=de(f,b,g,b,k,l,C.centerX,C.centerY);if(isNaN(k))return!0;h+=k;break}C=null;for(var K=0;K<L;K++){C=H[K];if(0===K){m=de(f,b,g,b,k,l,C[0],C[1]);if(isNaN(m))return!0;h+=m}m=J.fq(C[0],C[1],C[2],C[3],C[4],C[5],C[6],C[7],g,b,f,b,.5);h+=m}null!==C&&(a=C[6],
n=C[7]);break;default:B("Unknown Segment type: "+C.type)}k=a;l=n}if(0!==h)return!0;h=0}else if(u.aa(f,b,e?c:c+2))return!0}return 0!==h}function de(a,b,c,d,e,f,g,h){if(J.Nb(e,f,g,h,.05,a,b))return NaN;var k=(a-c)*(f-h);if(0===k)return 0;var l=((a*d-b*c)*(e-g)-(a-c)*(e*h-f*g))/k;b=(a*d-b*c)*(f-h)/k;if(l>=a)return 0;if((e>g?e-g:g-e)<(f>h?f-h:h-f))if(f<h){if(b<f||b>h)return 0}else{if(b<h||b>f)return 0}else if(e<g){if(l<e||l>g)return 0}else if(l<g||l>e)return 0;return 0<k?1:-1}
function ee(a,b,c,d){a=a.figures.j;for(var e=a.length,f=0;f<e;f++)if(a[f].aa(b,c,d))return!0;return!1}
t.zv=function(a,b){0>a?a=0:1<a&&(a=1);void 0===b&&(b=new I);if(this.type===vd)return b.h(this.startX+a*(this.endX-this.startX),this.startY+a*(this.endY-this.startY)),b;for(var c=this.flattenedSegments,d=this.flattenedLengths,e=c.length,f=this.flattenedTotalLength*a,g=0,h=0;h<e;h++){var k=d[h],l=k.length;for(a=0;a<l;a++){var m=k[a];if(g+m>=f)return d=f-g,d=0===m?0:d/m,c=c[h],h=c[2*a],e=c[2*a+1],b.h(h+(c[2*a+2]-h)*d,e+(c[2*a+3]-e)*d),b;g+=m}}return b};
t.Ox=function(a){0>a?a=0:1<a&&(a=1);if(this.type===vd)return 180*Math.atan2(this.endY-this.startY,this.endX-this.startX)/Math.PI;for(var b=this.flattenedSegments,c=this.flattenedLengths,d=b.length,e=this.flattenedTotalLength*a,f=0,g=0;g<d;g++){var h=c[g],k=h.length;for(a=0;a<k;a++){var l=h[a];if(f+l>=e)return e=b[g],b=e[2*a],c=e[2*a+1],d=e[2*a+2],a=e[2*a+3],1>Math.abs(d-b)&&1>Math.abs(a-c)?0:1>Math.abs(d-b)?0<=a-c?90:270:1>Math.abs(a-c)?0<=d-b?0:180:180*Math.atan2(a-c,d-b)/Math.PI;f+=l}}return NaN};
t.Av=function(a,b){0>a?a=0:1<a&&(a=1);void 0===b&&(b=[]);b.length=3;if(this.type===vd)return b[0]=this.startX+a*(this.endX-this.startX),b[1]=this.startY+a*(this.endY-this.startY),b[2]=180*Math.atan2(this.endY-this.startY,this.endX-this.startX)/Math.PI,b;for(var c=this.flattenedSegments,d=this.flattenedLengths,e=c.length,f=this.flattenedTotalLength*a,g=0,h=0;h<e;h++){var k=d[h],l=k.length;for(a=0;a<l;a++){var m=k[a];if(g+m>=f)return d=f-g,d=0===m?0:d/m,m=c[h],c=m[2*a],h=m[2*a+1],e=m[2*a+2],a=m[2*a+
3],b[0]=c+(e-c)*d,b[1]=h+(a-h)*d,b[2]=1>Math.abs(e-c)&&1>Math.abs(a-h)?0:1>Math.abs(e-c)?0<=a-h?90:270:1>Math.abs(a-h)?0<=e-c?0:180:180*Math.atan2(a-h,e-c)/Math.PI,b;g+=m}}return b};
t.Px=function(a){if(this.type===vd){var b=this.startX,c=this.startY,d=this.endX,e=this.endY;if(b!==d||c!==e){var f=a.x;a=a.y;if(b===d){if(c<e){var g=c;d=e}else g=e,d=c;return a<=g?g===c?0:1:a>=d?d===c?0:1:Math.abs(a-c)/(d-g)}if(c===e)return b<d?g=b:(g=d,d=b),f<=g?g===b?0:1:f>=d?d===b?0:1:Math.abs(f-b)/(d-g);g=(d-b)*(d-b)+(e-c)*(e-c);var h=I.alloc();J.Lh(b,c,d,e,f,a,h);a=h.x;f=h.y;I.free(h);return Math.sqrt(((a-b)*(a-b)+(f-c)*(f-c))/g)}}else if(this.type===Gd){g=this.startX;h=this.startY;var k=this.endX;
e=this.endY;if(g!==k||h!==e){b=k-g;c=e-h;f=2*b+2*c;d=a.x;a=a.y;d=Math.min(Math.max(d,g),k);a=Math.min(Math.max(a,h),e);g=Math.abs(d-g);k=Math.abs(d-k);h=Math.abs(a-h);e=Math.abs(a-e);var l=Math.min(g,k,h,e);if(l===h)return d/f;if(l===k)return(b+a)/f;if(l===e)return(2*b+c-d)/f;if(l===g)return(2*b+2*c-a)/f}}else{b=this.flattenedSegments;c=this.flattenedLengths;f=this.flattenedTotalLength;d=I.alloc();e=Infinity;h=g=0;k=b.length;for(var m=l=0,n=0;n<k;n++)for(var p=b[n],r=c[n],q=p.length,u=0;u<q;u+=2){var v=
p[u],w=p[u+1];if(0!==u){J.Lh(l,m,v,w,a.x,a.y,d);var y=(d.x-a.x)*(d.x-a.x)+(d.y-a.y)*(d.y-a.y);y<e&&(e=y,g=h,g+=Math.sqrt((d.x-l)*(d.x-l)+(d.y-m)*(d.y-m)));h+=r[(u-2)/2]}l=v;m=w}I.free(d);a=g/f;return 0>a?0:1<a?1:a}return 0};
function fe(a){if(null===a.Gk){var b=a.Gk=[],c=a.Tm=[],d=[],e=[];if(a.type===vd)d.push(a.startX),d.push(a.startY),d.push(a.endX),d.push(a.endY),b.push(d),e.push(Math.sqrt((a.startX-a.endX)*(a.startX-a.endX)+(a.startY-a.endY)*(a.startY-a.endY))),c.push(e);else if(a.type===Gd)d.push(a.startX),d.push(a.startY),d.push(a.endX),d.push(a.startY),d.push(a.endX),d.push(a.endY),d.push(a.startX),d.push(a.endY),d.push(a.startX),d.push(a.startY),b.push(d),e.push(Math.abs(a.startX-a.endX)),e.push(Math.abs(a.startY-
a.endY)),e.push(Math.abs(a.startX-a.endX)),e.push(Math.abs(a.startY-a.endY)),c.push(e);else if(a.type===Hd){var f=new ne;f.startX=a.endX;f.startY=(a.startY+a.endY)/2;var g=new oe(Zd);g.startAngle=0;g.sweepAngle=360;g.centerX=(a.startX+a.endX)/2;g.centerY=(a.startY+a.endY)/2;g.radiusX=Math.abs(a.startX-a.endX)/2;g.radiusY=Math.abs(a.startY-a.endY)/2;f.add(g);a=ae(g,f);e=a.length;if(0===e)d.push(g.centerX),d.push(g.centerY);else{g=f.startX;f=f.startY;for(var h=0;h<e;h++){var k=a[h];J.ze(g,f,k[2],k[3],
k[4],k[5],k[6],k[7],.5,d);g=k[6];f=k[7]}}b.push(d);c.push(pe(d))}else for(a=a.figures.iterator;a.next();){e=a.value;d=[];d.push(e.startX);d.push(e.startY);g=e.startX;f=e.startY;h=g;k=f;for(var l=e.segments.j,m=l.length,n=0;n<m;n++){var p=l[n];switch(p.type){case Wd:4<=d.length&&(b.push(d),c.push(pe(d)));d=[];d.push(p.endX);d.push(p.endY);g=p.endX;f=p.endY;h=g;k=f;break;case xd:d.push(p.endX);d.push(p.endY);g=p.endX;f=p.endY;break;case Xd:J.ze(g,f,p.point1X,p.point1Y,p.point2X,p.point2Y,p.endX,p.endY,
.5,d);g=p.endX;f=p.endY;break;case Yd:J.Cq(g,f,p.point1X,p.point1Y,p.endX,p.endY,.5,d);g=p.endX;f=p.endY;break;case Zd:var r=ae(p,e),q=r.length;if(0===q){d.push(p.centerX);d.push(p.centerY);g=p.centerX;f=p.centerY;break}for(var u=0;u<q;u++){var v=r[u];J.ze(g,f,v[2],v[3],v[4],v[5],v[6],v[7],.5,d);g=v[6];f=v[7]}break;case $d:r=be(p,e,g,f);q=r.length;if(0===q){d.push(p.centerX);d.push(p.centerY);g=p.centerX;f=p.centerY;break}for(u=0;u<q;u++)v=r[u],J.ze(g,f,v[2],v[3],v[4],v[5],v[6],v[7],.5,d),g=v[6],
f=v[7];break;default:B("Segment not of valid type: "+p.type)}p.isClosed&&(d.push(h),d.push(k))}4<=d.length&&(b.push(d),c.push(pe(d)))}}}function pe(a){for(var b=[],c=0,d=0,e=a.length,f=0;f<e;f+=2){var g=a[f],h=a[f+1];0!==f&&b.push(Math.sqrt(Cb(c,d,g,h)));c=g;d=h}return b}t.add=function(a){this.rj.add(a);return this};t.Jm=function(a,b,c,d,e,f,g,h){this.s&&ua(this);this.jf=(new P(a,b,e,f)).freeze();this.kf=(new P(c,d,g,h)).freeze();return this};
ma.Object.defineProperties(sd.prototype,{flattenedSegments:{get:function(){fe(this);return this.Gk}},flattenedLengths:{get:function(){fe(this);return this.Tm}},flattenedTotalLength:{get:function(){var a=this.Um;if(isNaN(a)){if(this.type===vd){a=Math.abs(this.endX-this.startX);var b=Math.abs(this.endY-this.startY);a=Math.sqrt(a*a+b*b)}else if(this.type===Gd)a=2*Math.abs(this.endX-this.startX)+2*Math.abs(this.endY-
this.startY);else{b=this.flattenedLengths;for(var c=b.length,d=a=0;d<c;d++)for(var e=b[d],f=e.length,g=0;g<f;g++)a+=e[g]}this.Um=a}return a}},type:{get:function(){return this.pa},set:function(a){this.pa!==a&&(this.s&&ua(this,a),this.pa=a,this.qa=!0)}},startX:{get:function(){return this.Rc},set:function(a){this.Rc!==a&&(this.s&&ua(this,a),this.Rc=a,this.qa=!0)}},startY:{get:function(){return this.Sc},set:function(a){this.Sc!==
a&&(this.s&&ua(this,a),this.Sc=a,this.qa=!0)}},endX:{get:function(){return this.ec},set:function(a){this.ec!==a&&(this.s&&ua(this,a),this.ec=a,this.qa=!0)}},endY:{get:function(){return this.mc},set:function(a){this.mc!==a&&(this.s&&ua(this,a),this.mc=a,this.qa=!0)}},figures:{get:function(){return this.rj},set:function(a){this.rj!==a&&(this.s&&ua(this,a),this.rj=a,this.qa=!0)}},spot1:{
get:function(){return this.jf},set:function(a){this.s&&ua(this,a);this.jf=a.G()}},spot2:{get:function(){return this.kf},set:function(a){this.s&&ua(this,a);this.kf=a.G()}},defaultStretch:{get:function(){return this.Qf},set:function(a){this.s&&ua(this,a);this.Qf=a}},bounds:{get:function(){this.Jv()&&this.computeBounds();return this.kr}}});sd.prototype.setSpots=sd.prototype.Jm;sd.prototype.add=sd.prototype.add;
sd.prototype.getFractionForPoint=sd.prototype.Px;sd.prototype.getPointAndAngleAlongPath=sd.prototype.Av;sd.prototype.getAngleAlongPath=sd.prototype.Ox;sd.prototype.getPointAlongPath=sd.prototype.zv;sd.prototype.containsPoint=sd.prototype.aa;sd.prototype.transform=sd.prototype.transform;sd.prototype.rotate=sd.prototype.rotate;sd.prototype.scale=sd.prototype.scale;sd.prototype.offset=sd.prototype.offset;sd.prototype.normalize=sd.prototype.normalize;sd.prototype.computeBoundsWithoutOrigin=sd.prototype.Bx;
sd.prototype.equalsApprox=sd.prototype.Ma;var vd=new D(sd,"Line",0),Gd=new D(sd,"Rectangle",1),Hd=new D(sd,"Ellipse",2),td=new D(sd,"Path",3);sd.className="Geometry";sd.stringify=yd;sd.fillPath=function(a){a=a.split(/[Xx]/);for(var b=a.length,c="",d=0;d<b;d++){var e=a[d];c=null!==e.match(/[Ff]/)?0===d?c+e:c+("X"+(" "===e[0]?"":" ")+e):c+((0===d?"":"X ")+"F"+(" "===e[0]?"":" ")+e)}return c};sd.parse=Id;sd.Line=vd;sd.Rectangle=Gd;sd.Ellipse=Hd;sd.Path=td;
function ne(a,b,c,d){Ya(this);this.s=!1;void 0===c&&(c=!0);this.Or=c;void 0===d&&(d=!0);this.Sr=d;void 0!==a?this.Rc=a:this.Rc=0;void 0!==b?this.Sc=b:this.Sc=0;this.Kl=new E;this.Is=this.Kl.Aa;this.qa=!0}ne.prototype.copy=function(){var a=new ne;a.Or=this.Or;a.Sr=this.Sr;a.Rc=this.Rc;a.Sc=this.Sc;for(var b=this.Kl.j,c=b.length,d=a.Kl,e=0;e<c;e++){var f=b[e].copy();d.add(f)}a.Is=this.Is;a.qa=this.qa;return a};t=ne.prototype;
t.Ma=function(a){if(!(a instanceof ne&&J.A(this.startX,a.startX)&&J.A(this.startY,a.startY)))return!1;var b=this.segments.j;a=a.segments.j;var c=b.length;if(c!==a.length)return!1;for(var d=0;d<c;d++)if(!b[d].Ma(a[d]))return!1;return!0};t.toString=function(a){void 0===a&&(a=-1);var b=0>a?"M"+this.startX.toString()+" "+this.startY.toString():"M"+this.startX.toFixed(a)+" "+this.startY.toFixed(a);for(var c=this.segments.j,d=c.length,e=0;e<d;e++)b+=" "+c[e].toString(a);return b};
t.freeze=function(){this.s=!0;var a=this.segments;a.freeze();var b=a.j;a=a.length;for(var c=0;c<a;c++)b[c].freeze();return this};t.ea=function(){this.s=!1;var a=this.segments;a.ea();a=a.j;for(var b=a.length,c=0;c<b;c++)a[c].ea();return this};t.Jv=function(){if(this.qa)return!0;var a=this.segments;if(this.Is!==a.Aa)return!0;a=a.j;for(var b=a.length,c=0;c<b;c++)if(a[c].qa)return!0;return!1};t.add=function(a){this.Kl.add(a);return this};
t.aa=function(a,b,c){for(var d=this.startX,e=this.startY,f=d,g=e,h=this.segments.j,k=h.length,l=0;l<k;l++){var m=h[l];switch(m.type){case Wd:f=m.endX;g=m.endY;d=m.endX;e=m.endY;break;case xd:if(J.Nb(d,e,m.endX,m.endY,c,a,b))return!0;d=m.endX;e=m.endY;break;case Xd:if(J.at(d,e,m.point1X,m.point1Y,m.point2X,m.point2Y,m.endX,m.endY,.5,a,b,c))return!0;d=m.endX;e=m.endY;break;case Yd:if(J.Tv(d,e,m.point1X,m.point1Y,m.endX,m.endY,.5,a,b,c))return!0;d=m.endX;e=m.endY;break;case Zd:case $d:var n=m.type===
Zd?ae(m,this):be(m,this,d,e),p=n.length;if(0===p){if(J.Nb(d,e,m.centerX,m.centerY,c,a,b))return!0;d=m.centerX;e=m.centerY;break}for(var r=null,q=0;q<p;q++)if(r=n[q],0===q&&J.Nb(d,e,r[0],r[1],c,a,b)||J.at(r[0],r[1],r[2],r[3],r[4],r[5],r[6],r[7],.5,a,b,c))return!0;null!==r&&(d=r[6],e=r[7]);break;default:B("Unknown Segment type: "+m.type)}if(m.isClosed&&(d!==f||e!==g)&&J.Nb(d,e,f,g,c,a,b))return!0}return!1};
ma.Object.defineProperties(ne.prototype,{isFilled:{get:function(){return this.Or},set:function(a){this.s&&ua(this,a);this.Or=a}},isShadowed:{get:function(){return this.Sr},set:function(a){this.s&&ua(this,a);this.Sr=a}},startX:{get:function(){return this.Rc},set:function(a){this.s&&ua(this,a);this.Rc=a;this.qa=!0}},startY:{get:function(){return this.Sc},set:function(a){this.s&&ua(this,
a);this.Sc=a;this.qa=!0}},segments:{get:function(){return this.Kl},set:function(a){this.s&&ua(this,a);this.Kl=a;this.qa=!0}}});ne.prototype.add=ne.prototype.add;ne.prototype.equalsApprox=ne.prototype.Ma;ne.className="PathFigure";
function oe(a,b,c,d,e,f,g,h){Ya(this);this.s=!1;void 0===a&&(a=xd);this.pa=a;void 0!==b?this.ec=b:this.ec=0;void 0!==c?this.mc=c:this.mc=0;void 0===d&&(d=0);void 0===e&&(e=0);void 0===f&&(f=0);void 0===g&&(g=0);a===$d?(a=f%360,0>a&&(a+=360),this.ve=a,this.Di=0,this.Ei=Math.max(d,0),this.kh=Math.max(e,0),this.sl="boolean"===typeof g?!!g:!1,this.Kk=!!h):(this.ve=d,this.Di=e,a===Zd&&(f=Math.max(f,0)),this.Ei=f,"number"===typeof g?(a===Zd&&(g=Math.max(g,0)),this.kh=g):this.kh=0,this.Kk=this.sl=!1);this.wj=
!1;this.qa=!0;this.Me=null}oe.prototype.copy=function(){var a=new oe;a.pa=this.pa;a.ec=this.ec;a.mc=this.mc;a.ve=this.ve;a.Di=this.Di;a.Ei=this.Ei;a.kh=this.kh;a.sl=this.sl;a.Kk=this.Kk;a.wj=this.wj;a.qa=this.qa;return a};t=oe.prototype;
t.Ma=function(a){if(!(a instanceof oe)||this.type!==a.type||this.isClosed!==a.isClosed)return!1;switch(this.type){case Wd:case xd:return J.A(this.endX,a.endX)&&J.A(this.endY,a.endY);case Xd:return J.A(this.endX,a.endX)&&J.A(this.endY,a.endY)&&J.A(this.point1X,a.point1X)&&J.A(this.point1Y,a.point1Y)&&J.A(this.point2X,a.point2X)&&J.A(this.point2Y,a.point2Y);case Yd:return J.A(this.endX,a.endX)&&J.A(this.endY,a.endY)&&J.A(this.point1X,a.point1X)&&J.A(this.point1Y,a.point1Y);case Zd:return J.A(this.startAngle,
a.startAngle)&&J.A(this.sweepAngle,a.sweepAngle)&&J.A(this.centerX,a.centerX)&&J.A(this.centerY,a.centerY)&&J.A(this.radiusX,a.radiusX)&&J.A(this.radiusY,a.radiusY);case $d:return this.isClockwiseArc===a.isClockwiseArc&&this.isLargeArc===a.isLargeArc&&J.A(this.xAxisRotation,a.xAxisRotation)&&J.A(this.endX,a.endX)&&J.A(this.endY,a.endY)&&J.A(this.radiusX,a.radiusX)&&J.A(this.radiusY,a.radiusY);default:return!1}};t.cb=function(a){a.classType===oe&&(this.type=a)};
t.toString=function(a){void 0===a&&(a=-1);switch(this.type){case Wd:a=0>a?"M"+this.endX.toString()+" "+this.endY.toString():"M"+this.endX.toFixed(a)+" "+this.endY.toFixed(a);break;case xd:a=0>a?"L"+this.endX.toString()+" "+this.endY.toString():"L"+this.endX.toFixed(a)+" "+this.endY.toFixed(a);break;case Xd:a=0>a?"C"+this.point1X.toString()+" "+this.point1Y.toString()+" "+this.point2X.toString()+" "+this.point2Y.toString()+" "+this.endX.toString()+" "+this.endY.toString():"C"+this.point1X.toFixed(a)+
" "+this.point1Y.toFixed(a)+" "+this.point2X.toFixed(a)+" "+this.point2Y.toFixed(a)+" "+this.endX.toFixed(a)+" "+this.endY.toFixed(a);break;case Yd:a=0>a?"Q"+this.point1X.toString()+" "+this.point1Y.toString()+" "+this.endX.toString()+" "+this.endY.toString():"Q"+this.point1X.toFixed(a)+" "+this.point1Y.toFixed(a)+" "+this.endX.toFixed(a)+" "+this.endY.toFixed(a);break;case Zd:a=0>a?"B"+this.startAngle.toString()+" "+this.sweepAngle.toString()+" "+this.centerX.toString()+" "+this.centerY.toString()+
" "+this.radiusX.toString()+" "+this.radiusY.toString():"B"+this.startAngle.toFixed(a)+" "+this.sweepAngle.toFixed(a)+" "+this.centerX.toFixed(a)+" "+this.centerY.toFixed(a)+" "+this.radiusX.toFixed(a)+" "+this.radiusY.toFixed(a);break;case $d:a=0>a?"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(a)+" "+this.radiusY.toFixed(a)+
" "+this.xAxisRotation.toFixed(a)+" "+(this.isLargeArc?1:0)+" "+(this.isClockwiseArc?1:0)+" "+this.endX.toFixed(a)+" "+this.endY.toFixed(a);break;default:a=this.type.toString()}return a+(this.wj?"z":"")};t.freeze=function(){this.s=!0;return this};t.ea=function(){this.s=!1;return this};t.close=function(){this.wj=!0;return this};
function ae(a,b){if(null!==a.Me&&!1===b.qa)return a.Me;var c=a.radiusX,d=a.radiusY;void 0===d&&(d=c);if(0===c||0===d)return a.Me=[],a.Me;b=a.ve;var e=a.Di,f=J.Cx(0,0,c<d?c:d,a.startAngle,a.startAngle+a.sweepAngle,!1);if(c!==d){var g=qd.alloc();g.reset();c<d?g.scale(1,d/c):g.scale(c/d,1);Ud(f,g);qd.free(g)}c=f.length;for(d=0;d<c;d++)g=f[d],g[0]+=b,g[1]+=e,g[2]+=b,g[3]+=e,g[4]+=b,g[5]+=e,g[6]+=b,g[7]+=e;a.Me=f;return a.Me}
function be(a,b,c,d){function e(a,b,c,d){return(a*d<b*c?-1:1)*Math.acos((a*c+b*d)/(Math.sqrt(a*a+b*b)*Math.sqrt(c*c+d*d)))}if(null!==a.Me&&!1===b.qa)return a.Me;b=a.Ei;var f=a.kh;0===b&&(b=1E-4);0===f&&(f=1E-4);var g=Math.PI/180*a.ve,h=a.sl,k=a.Kk,l=a.ec,m=a.mc,n=Math.cos(g),p=Math.sin(g),r=n*(c-l)/2+p*(d-m)/2;g=-p*(c-l)/2+n*(d-m)/2;var q=r*r/(b*b)+g*g/(f*f);1<q&&(b*=Math.sqrt(q),f*=Math.sqrt(q));q=(h===k?-1:1)*Math.sqrt((b*b*f*f-b*b*g*g-f*f*r*r)/(b*b*g*g+f*f*r*r));isNaN(q)&&(q=0);h=q*b*g/f;q=q*-f*
r/b;isNaN(h)&&(h=0);isNaN(q)&&(q=0);c=(c+l)/2+n*h-p*q;d=(d+m)/2+p*h+n*q;m=e(1,0,(r-h)/b,(g-q)/f);n=(r-h)/b;l=(g-q)/f;r=(-r-h)/b;h=(-g-q)/f;g=e(n,l,r,h);r=(n*r+l*h)/(Math.sqrt(n*n+l*l)*Math.sqrt(r*r+h*h));-1>=r?g=Math.PI:1<=r&&(g=0);!k&&0<g&&(g-=2*Math.PI);k&&0>g&&(g+=2*Math.PI);k=b>f?1:b/f;r=b>f?f/b:1;b=J.Cx(0,0,b>f?b:f,m,m+g,!0);f=qd.alloc();f.reset();f.translate(c,d);f.rotate(a.ve,0,0);f.scale(k,r);Ud(b,f);qd.free(f);a.Me=b;return a.Me}
ma.Object.defineProperties(oe.prototype,{isClosed:{get:function(){return this.wj},set:function(a){this.wj!==a&&(this.wj=a,this.qa=!0)}},type:{get:function(){return this.pa},set:function(a){this.s&&ua(this,a);this.pa=a;this.qa=!0}},endX:{get:function(){return this.ec},set:function(a){this.s&&ua(this,a);this.ec=a;this.qa=!0}},endY:{get:function(){return this.mc},set:function(a){this.s&&
ua(this,a);this.mc=a;this.qa=!0}},point1X:{get:function(){return this.ve},set:function(a){this.s&&ua(this,a);this.ve=a;this.qa=!0}},point1Y:{get:function(){return this.Di},set:function(a){this.s&&ua(this,a);this.Di=a;this.qa=!0}},point2X:{get:function(){return this.Ei},set:function(a){this.s&&ua(this,a);this.Ei=a;this.qa=!0}},point2Y:{get:function(){return this.kh},set:function(a){this.s&&
ua(this,a);this.kh=a;this.qa=!0}},centerX:{get:function(){return this.ve},set:function(a){this.s&&ua(this,a);this.ve=a;this.qa=!0}},centerY:{get:function(){return this.Di},set:function(a){this.s&&ua(this,a);this.Di=a;this.qa=!0}},radiusX:{get:function(){return this.Ei},set:function(a){0>a&&va(a,">= zero",oe,"radiusX");this.s&&ua(this,a);this.Ei=a;this.qa=!0}},radiusY:{get:function(){return this.kh},
set:function(a){0>a&&va(a,">= zero",oe,"radiusY");this.s&&ua(this,a);this.kh=a;this.qa=!0}},startAngle:{get:function(){return this.ec},set:function(a){this.ec!==a&&(this.s&&ua(this,a),a%=360,0>a&&(a+=360),this.ec=a,this.qa=!0)}},sweepAngle:{get:function(){return this.mc},set:function(a){this.s&&ua(this,a);360<a&&(a=360);-360>a&&(a=-360);this.mc=a;this.qa=!0}},isClockwiseArc:{get:function(){return this.Kk},set:function(a){this.s&&
ua(this,a);this.Kk=a;this.qa=!0}},isLargeArc:{get:function(){return this.sl},set:function(a){this.s&&ua(this,a);this.sl=a;this.qa=!0}},xAxisRotation:{get:function(){return this.ve},set:function(a){a%=360;0>a&&(a+=360);this.s&&ua(this,a);this.ve=a;this.qa=!0}}});oe.prototype.equalsApprox=oe.prototype.Ma;
var Wd=new D(oe,"Move",0),xd=new D(oe,"Line",1),Xd=new D(oe,"Bezier",2),Yd=new D(oe,"QuadraticBezier",3),Zd=new D(oe,"Arc",4),$d=new D(oe,"SvgArc",4);oe.className="PathSegment";oe.Move=Wd;oe.Line=xd;oe.Bezier=Xd;oe.QuadraticBezier=Yd;oe.Arc=Zd;oe.SvgArc=$d;function qe(){this.B=null;this.Zu=(new I(0,0)).freeze();this.ju=(new I(0,0)).freeze();this.cr=this.fs=0;this.dr=1;this.Wr="";this.Ws=this.xr=!1;this.ur=this.fr=0;this.Mg=this.Hr=this.Qr=!1;this.Cr=null;this.Rs=0;this.bd=this.Qs=null}
qe.prototype.copy=function(){var a=new qe;return this.clone(a)};qe.prototype.clone=function(a){a.B=this.B;a.Zu.assign(this.viewPoint);a.ju.assign(this.documentPoint);a.fs=this.fs;a.cr=this.cr;a.dr=this.dr;a.Wr=this.Wr;a.xr=this.xr;a.Ws=this.Ws;a.fr=this.fr;a.ur=this.ur;a.Qr=this.Qr;a.Hr=this.Hr;a.Mg=this.Mg;a.Cr=this.Cr;a.Rs=this.Rs;a.Qs=this.Qs;a.bd=this.bd;return a};
qe.prototype.toString=function(){var a="^";0!==this.modifiers&&(a+="M:"+this.modifiers);0!==this.button&&(a+="B:"+this.button);""!==this.key&&(a+="K:"+this.key);0!==this.clickCount&&(a+="C:"+this.clickCount);0!==this.delta&&(a+="D:"+this.delta);this.handled&&(a+="h");this.bubbles&&(a+="b");null!==this.documentPoint&&(a+="@"+this.documentPoint.toString());return a};qe.prototype.oq=function(a,b){var c=this.diagram;if(null===c)return b;re(c,this.event,a,b);return b};
qe.prototype.Ez=function(a,b){var c=this.diagram;if(null===c)return b;re(c,this.event,a,b);b.assign(c.Qt(b));return b};
ma.Object.defineProperties(qe.prototype,{diagram:{get:function(){return this.B},set:function(a){this.B=a}},viewPoint:{get:function(){return this.Zu},set:function(a){this.Zu.assign(a)}},documentPoint:{get:function(){return this.ju},set:function(a){this.ju.assign(a)}},modifiers:{get:function(){return this.fs},set:function(a){this.fs=a}},button:{get:function(){return this.cr},
set:function(a){this.cr=a;if(null===this.event)switch(a){case 0:this.buttons=1;break;case 1:this.buttons=4;break;case 2:this.buttons=2}}},buttons:{get:function(){return this.dr},set:function(a){this.dr=a}},key:{get:function(){return this.Wr},set:function(a){this.Wr=a}},down:{get:function(){return this.xr},set:function(a){this.xr=a}},up:{get:function(){return this.Ws},set:function(a){this.Ws=
a}},clickCount:{get:function(){return this.fr},set:function(a){this.fr=a}},delta:{get:function(){return this.ur},set:function(a){this.ur=a}},isMultiTouch:{get:function(){return this.Qr},set:function(a){this.Qr=a}},handled:{get:function(){return this.Hr},set:function(a){this.Hr=a}},bubbles:{get:function(){return this.Mg},set:function(a){this.Mg=a}},event:{
get:function(){return this.Cr},set:function(a){this.Cr=a}},isTouchEvent:{get:function(){var a=x.TouchEvent,b=this.event;return a&&b instanceof a?!0:(a=x.PointerEvent)&&b instanceof a&&("touch"===b.pointerType||"pen"===b.pointerType)}},timestamp:{get:function(){return this.Rs},set:function(a){this.Rs=a}},targetDiagram:{get:function(){return this.Qs},set:function(a){this.Qs=a}},targetObject:{
get:function(){return this.bd},set:function(a){this.bd=a}},control:{get:function(){return 0!==(this.modifiers&1)},set:function(a){this.modifiers=a?this.modifiers|1:this.modifiers&-2}},shift:{get:function(){return 0!==(this.modifiers&4)},set:function(a){this.modifiers=a?this.modifiers|4:this.modifiers&-5}},alt:{get:function(){return 0!==(this.modifiers&2)},set:function(a){this.modifiers=a?this.modifiers|
2:this.modifiers&-3}},meta:{get:function(){return 0!==(this.modifiers&8)},set:function(a){this.modifiers=a?this.modifiers|8:this.modifiers&-9}},left:{get:function(){var a=this.event;return null===a||"mousedown"!==a.type&&"mouseup"!==a.type&&"pointerdown"!==a.type&&"pointerup"!==a.type?0!==(this.buttons&1):0===this.button},set:function(a){this.buttons=a?this.buttons|1:this.buttons&-2}},right:{get:function(){var a=
this.event;return null===a||"mousedown"!==a.type&&"mouseup"!==a.type&&"pointerdown"!==a.type&&"pointerup"!==a.type?0!==(this.buttons&2):2===this.button},set:function(a){this.buttons=a?this.buttons|2:this.buttons&-3}},middle:{get:function(){var a=this.event;return null===a||"mousedown"!==a.type&&"mouseup"!==a.type&&"pointerdown"!==a.type&&"pointerup"!==a.type?0!==(this.buttons&4):1===this.button},set:function(a){this.buttons=a?this.buttons|4:this.buttons&-5}}});
qe.prototype.getMultiTouchDocumentPoint=qe.prototype.Ez;qe.prototype.getMultiTouchViewPoint=qe.prototype.oq;qe.className="InputEvent";function se(){this.B=null;this.Qa="";this.qs=this.Ps=null}se.prototype.copy=function(){var a=new se;a.B=this.B;a.Qa=this.Qa;a.Ps=this.Ps;a.qs=this.qs;return a};se.prototype.toString=function(){var a="*"+this.name;null!==this.subject&&(a+=":"+this.subject.toString());null!==this.parameter&&(a+="("+this.parameter.toString()+")");return a};
ma.Object.defineProperties(se.prototype,{diagram:{get:function(){return this.B},set:function(a){this.B=a}},name:{get:function(){return this.Qa},set:function(a){this.Qa=a}},subject:{get:function(){return this.Ps},set:function(a){this.Ps=a}},parameter:{get:function(){return this.qs},set:function(a){this.qs=a}}});se.className="DiagramEvent";
function te(){this.dn=ue;this.bf=this.es="";this.Oo=this.Po=this.Vo=this.Wo=this.Uo=this.B=this.ac=null}te.prototype.clear=function(){this.Oo=this.Po=this.Vo=this.Wo=this.Uo=this.B=this.ac=null};
te.prototype.copy=function(){var a=new te;a.dn=this.dn;a.es=this.es;a.bf=this.bf;a.ac=this.ac;a.B=this.B;a.Uo=this.Uo;var b=this.Wo;a.Wo=za(b)&&"function"===typeof b.G?b.G():b;b=this.Vo;a.Vo=za(b)&&"function"===typeof b.G?b.G():b;b=this.Po;a.Po=za(b)&&"function"===typeof b.G?b.G():b;b=this.Oo;a.Oo=za(b)&&"function"===typeof b.G?b.G():b;return a};te.prototype.cb=function(a){a.classType===te&&(this.change=a)};
te.prototype.toString=function(){var a="";a=this.change===ve?a+"* ":this.change===ue?a+(null!==this.model?"!m":"!d"):a+((null!==this.model?"!m":"!d")+this.change);this.propertyName&&"string"===typeof this.propertyName&&(a+=" "+this.propertyName);this.modelChange&&this.modelChange!==this.propertyName&&(a+=" "+this.modelChange);a+=": ";this.change===ve?null!==this.oldValue&&(a+=" "+this.oldValue):(null!==this.object&&(a+=Ja(this.object)),null!==this.oldValue&&(a+=" old: "+Ja(this.oldValue)),null!==
this.oldParam&&(a+=" "+this.oldParam),null!==this.newValue&&(a+=" new: "+Ja(this.newValue)),null!==this.newParam&&(a+=" "+this.newParam));return a};te.prototype.H=function(a){return a?this.oldValue:this.newValue};te.prototype.Gz=function(a){return a?this.oldParam:this.newParam};te.prototype.canUndo=function(){return null!==this.model||null!==this.diagram?!0:!1};
te.prototype.undo=function(){this.canUndo()&&(null!==this.model?this.model.changeState(this,!0):null!==this.diagram&&this.diagram.changeState(this,!0))};te.prototype.canRedo=function(){return null!==this.model||null!==this.diagram?!0:!1};te.prototype.redo=function(){this.canRedo()&&(null!==this.model?this.model.changeState(this,!1):null!==this.diagram&&this.diagram.changeState(this,!1))};
ma.Object.defineProperties(te.prototype,{model:{get:function(){return this.ac},set:function(a){this.ac=a}},diagram:{get:function(){return this.B},set:function(a){this.B=a}},change:{get:function(){return this.dn},set:function(a){this.dn=a}},modelChange:{get:function(){return this.es},set:function(a){this.es=a}},propertyName:{get:function(){return this.bf},
set:function(a){this.bf=a}},isTransactionFinished:{get:function(){return this.dn===ve&&("CommittedTransaction"===this.bf||"FinishedUndo"===this.bf||"FinishedRedo"===this.bf)}},object:{get:function(){return this.Uo},set:function(a){this.Uo=a}},oldValue:{get:function(){return this.Wo},set:function(a){this.Wo=a}},oldParam:{get:function(){return this.Vo},set:function(a){this.Vo=a}},
newValue:{get:function(){return this.Po},set:function(a){this.Po=a}},newParam:{get:function(){return this.Oo},set:function(a){this.Oo=a}}});te.prototype.redo=te.prototype.redo;te.prototype.canRedo=te.prototype.canRedo;te.prototype.undo=te.prototype.undo;te.prototype.canUndo=te.prototype.canUndo;te.prototype.getParam=te.prototype.Gz;te.prototype.getValue=te.prototype.H;te.prototype.clear=te.prototype.clear;
var ve=new D(te,"Transaction",-1),ue=new D(te,"Property",0),we=new D(te,"Insert",1),xe=new D(te,"Remove",2);te.className="ChangedEvent";te.Transaction=ve;te.Property=ue;te.Insert=we;te.Remove=xe;function ye(){this.v=(new E).freeze();this.Qa="";this.l=!1}ye.prototype.toString=function(a){var b="Transaction: "+this.name+" "+this.changes.count.toString()+(this.isComplete?"":", incomplete");if(void 0!==a&&0<a){a=this.changes.count;for(var c=0;c<a;c++){var d=this.changes.L(c);null!==d&&(b+="\n "+d.toString())}}return b};
ye.prototype.clear=function(){var a=this.changes;a.ea();for(var b=a.count-1;0<=b;b--){var c=a.L(b);null!==c&&c.clear()}a.clear();a.freeze()};ye.prototype.canUndo=function(){return this.isComplete};ye.prototype.undo=function(){if(this.canUndo())for(var a=this.changes.count-1;0<=a;a--){var b=this.changes.L(a);null!==b&&b.undo()}};ye.prototype.canRedo=function(){return this.isComplete};
ye.prototype.redo=function(){if(this.canRedo())for(var a=this.changes.count,b=0;b<a;b++){var c=this.changes.L(b);null!==c&&c.redo()}};ma.Object.defineProperties(ye.prototype,{changes:{get:function(){return this.v}},name:{get:function(){return this.Qa},set:function(a){this.Qa=a}},isComplete:{get:function(){return this.l},set:function(a){this.l=a}}});ye.prototype.redo=ye.prototype.redo;ye.prototype.canRedo=ye.prototype.canRedo;
ye.prototype.undo=ye.prototype.undo;ye.prototype.canUndo=ye.prototype.canUndo;ye.prototype.clear=ye.prototype.clear;ye.className="Transaction";function ze(){this.Gu=new F;this.Mc=!1;this.I=(new E).freeze();this.Hd=-1;this.v=999;this.le=!1;this.rr=null;this.Li=0;this.l=!1;this.re=(new E).freeze();this.Al=new E;this.qu=!0;this.Au=!1}
ze.prototype.toString=function(a){var b="UndoManager "+this.historyIndex+"<"+this.history.count+"<="+this.maxHistoryLength;b+="[";for(var c=this.nestedTransactionNames.count,d=0;d<c;d++)0<d&&(b+=" "),b+=this.nestedTransactionNames.L(d);b+="]";if(void 0!==a&&0<a)for(c=this.history.count,d=0;d<c;d++)b+="\n "+this.history.L(d).toString(a-1);return b};
ze.prototype.clear=function(){var a=this.history;a.ea();for(var b=a.count-1;0<=b;b--){var c=a.L(b);null!==c&&c.clear()}a.clear();this.Hd=-1;a.freeze();this.le=!1;this.rr=null;this.Li=0;this.re.ea();this.re.clear();this.re.freeze();this.Al.clear()};ze.prototype.copyProperties=function(a){this.isEnabled=a.isEnabled;this.maxHistoryLength=a.maxHistoryLength;this.checksTransactionLevel=a.checksTransactionLevel};t=ze.prototype;t.ux=function(a){this.Gu.add(a)};t.by=function(a){this.Gu.remove(a)};
t.ua=function(a){void 0===a&&(a="");null===a&&(a="");if(this.isUndoingRedoing)return!1;!0===this.qu&&(this.qu=!1,this.Li++,this.xb("StartingFirstTransaction",a,this.currentTransaction),0<this.Li&&this.Li--);this.isEnabled&&(this.re.ea(),this.re.add(a),this.re.freeze(),null===this.currentTransaction?this.Al.add(0):this.Al.add(this.currentTransaction.changes.count));this.Li++;var b=1===this.transactionLevel;b&&this.xb("StartedTransaction",a,this.currentTransaction);return b};
t.Ua=function(a){void 0===a&&(a="");return Ae(this,!0,a)};t.Bf=function(){return Ae(this,!1,"")};
function Ae(a,b,c){if(a.isUndoingRedoing)return!1;a.checksTransactionLevel&&1>a.transactionLevel&&wa("Ending transaction without having started a transaction: "+c);var d=1===a.transactionLevel;d&&b&&a.xb("CommittingTransaction",c,a.currentTransaction);var e=0;if(0<a.transactionLevel&&(a.Li--,a.isEnabled)){var f=a.re.count;0<f&&(""===c&&(c=a.re.L(0)),a.re.ea(),a.re.lb(f-1),a.re.freeze());f=a.Al.count;0<f&&(e=a.Al.L(f-1),a.Al.lb(f-1))}f=a.currentTransaction;if(d){if(b){a.Au=!1;if(a.isEnabled&&null!==
f){b=f;b.isComplete=!0;b.name=c;d=a.history;d.ea();for(e=d.count-1;e>a.historyIndex;e--)f=d.L(e),null!==f&&f.clear(),d.lb(e),a.Au=!0;e=a.maxHistoryLength;0<=e&&(0===e?d.clear():d.count>=e&&(f=d.L(0),null!==f&&f.clear(),d.lb(0),a.Hd--));0!==e&&(d.add(b),a.Hd++);d.freeze();f=b}a.xb("CommittedTransaction",c,f)}else{a.le=!0;try{a.isEnabled&&null!==f&&(f.isComplete=!0,f.undo())}finally{a.xb("RolledBackTransaction",c,f),a.le=!1}null!==f&&f.clear()}a.rr=null;return!0}if(a.isEnabled&&!b&&null!==f){a=e;c=
f.changes;for(b=c.count-1;b>=a;b--)d=c.L(b),null!==d&&d.undo(),c.ea(),c.lb(b);c.freeze()}return!1}ze.prototype.canUndo=function(){if(!this.isEnabled||0<this.transactionLevel)return!1;var a=this.transactionToUndo;return null!==a&&a.canUndo()?!0:!1};ze.prototype.undo=function(){if(this.canUndo()){var a=this.transactionToUndo;try{this.le=!0,this.xb("StartingUndo","Undo",a),this.Hd--,a.undo()}catch(b){wa("undo error: "+b.toString())}finally{this.xb("FinishedUndo","Undo",a),this.le=!1}}};
ze.prototype.canRedo=function(){if(!this.isEnabled||0<this.transactionLevel)return!1;var a=this.transactionToRedo;return null!==a&&a.canRedo()?!0:!1};ze.prototype.redo=function(){if(this.canRedo()){var a=this.transactionToRedo;try{this.le=!0,this.xb("StartingRedo","Redo",a),this.Hd++,a.redo()}catch(b){wa("redo error: "+b.toString())}finally{this.xb("FinishedRedo","Redo",a),this.le=!1}}};
ze.prototype.xb=function(a,b,c){void 0===c&&(c=null);var d=new te;d.change=ve;d.propertyName=a;d.object=c;d.oldValue=b;for(a=this.models;a.next();)b=a.value,d.model=b,b.bt(d)};
ze.prototype.Dv=function(a){if(this.isEnabled&&!this.isUndoingRedoing&&!this.skipsEvent(a)){var b=this.currentTransaction;null===b&&(this.rr=b=new ye);var c=a.copy();b=b.changes;b.ea();b.add(c);b.freeze();this.checksTransactionLevel&&0>=this.transactionLevel&&!this.qu&&(a=a.diagram,null!==a&&!1===a.kk||wa("Change not within a transaction: "+c.toString()))}};
ze.prototype.skipsEvent=function(a){if(null===a||0>a.change.value)return!0;a=a.object;if(null===a)return!1;if(void 0!==a.layer){if(a=a.layer,null!==a&&a.isTemporary)return!0}else if(a.isTemporary)return!0;return!1};
ma.Object.defineProperties(ze.prototype,{models:{get:function(){return this.Gu.iterator}},isEnabled:{get:function(){return this.Mc},set:function(a){this.Mc=a}},transactionToUndo:{get:function(){return 0<=this.historyIndex&&this.historyIndex<=this.history.count-1?this.history.L(this.historyIndex):null}},transactionToRedo:{get:function(){return this.historyIndex<this.history.count-
1?this.history.L(this.historyIndex+1):null}},isUndoingRedoing:{get:function(){return this.le}},history:{get:function(){return this.I}},maxHistoryLength:{get:function(){return this.v},set:function(a){this.v=a}},historyIndex:{get:function(){return this.Hd}},currentTransaction:{get:function(){return this.rr}},transactionLevel:{
get:function(){return this.Li}},isInTransaction:{get:function(){return 0<this.Li}},checksTransactionLevel:{get:function(){return this.l},set:function(a){this.l=a}},nestedTransactionNames:{get:function(){return this.re}}});ze.prototype.handleChanged=ze.prototype.Dv;ze.prototype.redo=ze.prototype.redo;ze.prototype.undo=ze.prototype.undo;ze.prototype.canUndo=ze.prototype.canUndo;
ze.prototype.rollbackTransaction=ze.prototype.Bf;ze.prototype.commitTransaction=ze.prototype.Ua;ze.prototype.startTransaction=ze.prototype.ua;ze.prototype.removeModel=ze.prototype.by;ze.prototype.addModel=ze.prototype.ux;ze.prototype.clear=ze.prototype.clear;ze.className="UndoManager";function Be(){Ya(this);this.B=Ce;this.Qa="";this.Mc=!0;this.kd=!1;this.Gw=null;this.Ey=new qe;this.Zs=-1}Be.prototype.toString=function(){return""!==this.name?this.name+" Tool":Ia(this.constructor)};
Be.prototype.updateAdornments=function(){};Be.prototype.canStart=function(){return this.isEnabled};Be.prototype.doStart=function(){};Be.prototype.doActivate=function(){this.isActive=!0};Be.prototype.doDeactivate=function(){this.isActive=!1};Be.prototype.doStop=function(){};Be.prototype.doCancel=function(){this.transactionResult=null;this.stopTool()};Be.prototype.stopTool=function(){var a=this.diagram;a.currentTool===this&&(a.currentTool=null,a.currentCursor="")};
Be.prototype.doMouseDown=function(){!this.isActive&&this.canStart()&&this.doActivate()};Be.prototype.doMouseMove=function(){};Be.prototype.doMouseUp=function(){this.stopTool()};Be.prototype.doMouseWheel=function(){};Be.prototype.canStartMultiTouch=function(){return!0};
Be.prototype.standardPinchZoomStart=function(){var a=this.diagram,b=a.lastInput,c=b.oq(0,I.allocAt(NaN,NaN)),d=b.oq(1,I.allocAt(NaN,NaN));if(c.u()&&d.u()&&(this.doCancel(),a.mm("hasGestureZoom"))){a.Cl=a.scale;var e=d.x-c.x,f=d.y-c.y;a.Tu=Math.sqrt(e*e+f*f);b.bubbles=!1}I.free(c);I.free(d)};
Be.prototype.standardPinchZoomMove=function(){var a=this.diagram,b=a.lastInput,c=b.oq(0,I.allocAt(NaN,NaN)),d=b.oq(1,I.allocAt(NaN,NaN));if(c.u()&&d.u()&&(this.doCancel(),a.mm("hasGestureZoom"))){var e=d.x-c.x,f=d.y-c.y;f=Math.sqrt(e*e+f*f)/a.Tu;e=new I((Math.min(d.x,c.x)+Math.max(d.x,c.x))/2,(Math.min(d.y,c.y)+Math.max(d.y,c.y))/2);f*=a.Cl;var g=a.commandHandler;if(f!==a.scale&&g.canResetZoom(f)){var h=a.zoomPoint;a.zoomPoint=e;g.resetZoom(f);a.zoomPoint=h}b.bubbles=!1}I.free(c);I.free(d)};
Be.prototype.doKeyDown=function(){"Esc"===this.diagram.lastInput.key&&this.doCancel()};Be.prototype.doKeyUp=function(){};Be.prototype.ua=function(a){void 0===a&&(a=this.name);this.transactionResult=null;return this.diagram.ua(a)};Be.prototype.Hg=function(){var a=this.diagram;return null===this.transactionResult?a.Bf():a.Ua(this.transactionResult)};
Be.prototype.standardMouseSelect=function(){var a=this.diagram;if(a.allowSelect){var b=a.lastInput,c=a.jm(b.documentPoint,!1);if(null!==c)if(Wa?b.meta:b.control){a.R("ChangingSelection",a.selection);for(b=c;null!==b&&!b.canSelect();)b=b.containingGroup;null!==b&&(b.isSelected=!b.isSelected);a.R("ChangedSelection",a.selection)}else if(b.shift){if(!c.isSelected){a.R("ChangingSelection",a.selection);for(b=c;null!==b&&!b.canSelect();)b=b.containingGroup;null!==b&&(b.isSelected=!0);a.R("ChangedSelection",
a.selection)}}else{if(!c.isSelected){for(b=c;null!==b&&!b.canSelect();)b=b.containingGroup;null!==b&&a.select(b)}}else!b.left||(Wa?b.meta:b.control)||b.shift||a.clearSelection()}};Be.prototype.standardMouseClick=function(a,b){void 0===a&&(a=null);void 0===b&&(b=function(a){return!a.layer.isTemporary});var c=this.diagram,d=c.lastInput;a=c.Ub(d.documentPoint,a,b);d.targetObject=a;De(a,d,c);return d.handled};
function De(a,b,c){b.handled=!1;if(null===a||a.Eg()){var d=0;b.left?d=1===b.clickCount?1:2===b.clickCount?2:1:b.right&&1===b.clickCount&&(d=3);var e="ObjectSingleClicked";if(null!==a){switch(d){case 1:e="ObjectSingleClicked";break;case 2:e="ObjectDoubleClicked";break;case 3:e="ObjectContextClicked"}0!==d&&c.R(e,a)}else{switch(d){case 1:e="BackgroundSingleClicked";break;case 2:e="BackgroundDoubleClicked";break;case 3:e="BackgroundContextClicked"}0!==d&&c.R(e)}if(null!==a)for(;null!==a;){c=null;switch(d){case 1:c=
a.click;break;case 2:c=a.doubleClick?a.doubleClick:a.click;break;case 3:c=a.contextClick}if(null!==c&&(c(b,a),b.handled))break;a=a.panel}else{a=null;switch(d){case 1:a=c.click;break;case 2:a=c.doubleClick?c.doubleClick:c.click;break;case 3:a=c.contextClick}null!==a&&a(b)}}}
Be.prototype.standardMouseOver=function(){var a=this.diagram,b=a.lastInput;if(!0!==a.animationManager.qc){var c=a.skipsUndoManager;a.skipsUndoManager=!0;var d=a.viewportBounds.aa(b.documentPoint)?a.Ub(b.documentPoint,null,null):null;b.targetObject=d;var e=!1;if(d!==a.mj){var f=a.mj,g=f;a.mj=d;this.doCurrentObjectChanged(f,d);for(b.handled=!1;null!==f;){var h=f.mouseLeave;if(null!==h){if(d===f)break;if(null!==d&&d.Dg(f))break;h(b,f,d);e=!0;if(b.handled)break}f=f.panel}f=g;for(b.handled=!1;null!==d;){g=
d.mouseEnter;if(null!==g){if(f===d)break;if(null!==f&&f.Dg(d))break;g(b,d,f);e=!0;if(b.handled)break}d=d.panel}d=a.mj}if(null!==d){f=d;for(g="";null!==f;){g=f.cursor;if(""!==g)break;f=f.panel}a.currentCursor=g;b.handled=!1;for(f=d;null!==f;){d=f.mouseOver;if(null!==d&&(d(b,f),e=!0,b.handled))break;f=f.panel}}else a.currentCursor="",d=a.mouseOver,null!==d&&(d(b),e=!0);e&&a.Pb();a.skipsUndoManager=c}};Be.prototype.doCurrentObjectChanged=function(){};
Be.prototype.standardMouseWheel=function(){var a=this.diagram,b=a.lastInput,c=b.delta;if(0!==c&&a.documentBounds.u()){var d=a.commandHandler,e=a.toolManager.mouseWheelBehavior;if(null!==d&&(e===Ee&&!b.shift||e===Fe&&b.control)){if(0<c?d.canIncreaseZoom():d.canDecreaseZoom())e=a.zoomPoint,a.zoomPoint=b.viewPoint,0<c?d.increaseZoom():d.decreaseZoom(),a.zoomPoint=e;b.bubbles=!1}else if(e===Ee&&b.shift||e===Fe&&!b.control){d=a.position.copy();var f=0<c?c:-c,g=b.event,h=g.deltaMode;e=g.deltaX;g=g.deltaY;
if(Ta||Ua||Va)h=1,0<e&&(e=3),0>e&&(e=-3),0<g&&(g=3),0>g&&(g=-3);if(void 0===h||void 0===e||void 0===g||0===e&&0===g||b.shift)!b.shift&&a.allowVerticalScroll?(f=3*f*a.scrollVerticalLineChange,0<c?a.scroll("pixel","up",f):a.scroll("pixel","down",f)):b.shift&&a.allowHorizontalScroll&&(f=3*f*a.scrollHorizontalLineChange,0<c?a.scroll("pixel","left",f):a.scroll("pixel","right",f));else{switch(h){case 0:c="pixel";break;case 1:c="line";break;case 2:c="page";break;default:c="pixel"}0!==e&&a.allowHorizontalScroll&&
(e*=a.scrollHorizontalLineChange/16,0<e?a.scroll(c,"left",-e):a.scroll(c,"right",e));0!==g&&a.allowVerticalScroll&&(g*=a.scrollVerticalLineChange/16,0<g?a.scroll(c,"up",-g):a.scroll(c,"down",g))}a.position.w(d)||(b.bubbles=!1)}}};Be.prototype.standardWaitAfter=function(a,b){void 0===b&&(b=this.diagram.lastInput);this.cancelWaitAfter();var c=this,d=b.clone(this.Ey);this.Zs=sa(function(){c.doWaitAfter(d)},a)};Be.prototype.cancelWaitAfter=function(){-1!==this.Zs&&x.clearTimeout(this.Zs);this.Zs=-1};
Be.prototype.doWaitAfter=function(){};Be.prototype.findToolHandleAt=function(a,b){a=this.diagram.Ub(a,function(a){for(;null!==a&&!(a.panel instanceof Ke);)a=a.panel;return a});return null===a?null:a.part.category===b?a:null};Be.prototype.isBeyondDragSize=function(a,b){var c=this.diagram;void 0===a&&(a=c.firstInput.viewPoint);void 0===b&&(b=c.lastInput.viewPoint);var d=c.toolManager.dragSize,e=d.width;d=d.height;c.firstInput.isTouchEvent&&(e+=6,d+=6);return Math.abs(b.x-a.x)>e||Math.abs(b.y-a.y)>d};
ma.Object.defineProperties(Be.prototype,{diagram:{get:function(){return this.B},set:function(a){a instanceof R&&(this.B=a)}},name:{get:function(){return this.Qa},set:function(a){this.Qa=a}},isEnabled:{get:function(){return this.Mc},set:function(a){this.Mc=a}},isActive:{get:function(){return this.kd},set:function(a){this.kd=a}},transactionResult:{get:function(){return this.Gw},
set:function(a){this.Gw=a}}});Be.prototype.stopTransaction=Be.prototype.Hg;Be.prototype.startTransaction=Be.prototype.ua;Be.className="Tool";function Oa(){Be.call(this);this.name="ToolManager";this.Ic=new E;this.Yc=new E;this.Ef=new E;this.Y=this.Ha=850;this.v=(new M(2,2)).ca();this.Za=5E3;this.Ia=Fe;this.I=Le;this.qr=this.l=null;this.Qj=-1}la(Oa,Be);Oa.prototype.initializeStandardTools=function(){};
Oa.prototype.updateAdornments=function(a){var b=this.currentToolTip;if(b instanceof Ke&&this.qr===a){var c=b.adornedObject;(null!==a?c.part===a:null===c)?this.showToolTip(b,c):this.hideToolTip()}};
Oa.prototype.doMouseDown=function(){var a=this.diagram,b=a.lastInput;b.isTouchEvent&&this.gestureBehavior===Me&&(b.bubbles=!1);if(b.isMultiTouch){this.cancelWaitAfter();if(this.gestureBehavior===Ne){b.bubbles=!0;return}if(this.gestureBehavior===Me)return;if(a.currentTool.canStartMultiTouch()){a.currentTool.standardPinchZoomStart();return}}for(var c=this.mouseDownTools.length,d=0;d<c;d++){var e=this.mouseDownTools.L(d);e.diagram=this.diagram;if(e.canStart()){a.doFocus();a.currentTool=e;a.currentTool===
e&&(e.isActive||e.doActivate(),e.doMouseDown());return}}1===a.lastInput.button&&(this.mouseWheelBehavior===Fe?this.mouseWheelBehavior=Ee:this.mouseWheelBehavior===Ee&&(this.mouseWheelBehavior=Fe));this.doActivate();this.standardWaitAfter(this.holdDelay,b)};
Oa.prototype.doMouseMove=function(){var a=this.diagram,b=a.lastInput;if(b.isMultiTouch){if(this.gestureBehavior===Ne){b.bubbles=!0;return}if(this.gestureBehavior===Me)return;if(a.currentTool.canStartMultiTouch()){a.currentTool.standardPinchZoomMove();return}}if(this.isActive)for(var c=this.mouseMoveTools.length,d=0;d<c;d++){var e=this.mouseMoveTools.L(d);e.diagram=this.diagram;if(e.canStart()){a.doFocus();a.currentTool=e;a.currentTool===e&&(e.isActive||e.doActivate(),e.doMouseMove());return}}Oe(this,
a);a=b.event;null===a||"mousemove"!==a.type&&"pointermove"!==a.type&&a.cancelable||(b.bubbles=!0)};function Oe(a,b){a.standardMouseOver();a.isBeyondDragSize()&&a.standardWaitAfter(a.isActive?a.holdDelay:a.hoverDelay,b.lastInput)}Oa.prototype.doCurrentObjectChanged=function(a,b){a=this.currentToolTip;null===a||null!==b&&a instanceof Ke&&(b===a||b.Dg(a))||this.hideToolTip()};
Oa.prototype.doWaitAfter=function(a){var b=this.diagram;b.sa&&(this.doMouseHover(),this.isActive||this.doToolTip(),a.isTouchEvent&&!b.lastInput.handled&&(a=a.copy(),a.button=2,a.buttons=2,b.lastInput=a,b.Pj=!0,b.doMouseUp()))};
Oa.prototype.doMouseHover=function(){var a=this.diagram,b=a.lastInput;null===b.targetObject&&(b.targetObject=a.Ub(b.documentPoint,null,null));var c=b.targetObject;if(null!==c)for(b.handled=!1;null!==c;){a=this.isActive?c.mouseHold:c.mouseHover;if(null!==a&&(a(b,c),b.handled))break;c=c.panel}else c=this.isActive?a.mouseHold:a.mouseHover,null!==c&&c(b)};
Oa.prototype.doToolTip=function(){var a=this.diagram,b=a.lastInput;null===b.targetObject&&(b.targetObject=a.Ub(b.documentPoint,null,null));b=b.targetObject;if(null!==b){if(a=this.currentToolTip,!(a instanceof Ke)||b!==a&&!b.Dg(a)){for(;null!==b;){a=b.toolTip;if(null!==a){this.showToolTip(a,b);return}b=b.panel}this.hideToolTip()}}else b=a.toolTip,null!==b?this.showToolTip(b,null):this.hideToolTip()};
Oa.prototype.showToolTip=function(a,b){var c=this.diagram;a!==this.currentToolTip&&this.hideToolTip();if(a instanceof Ke){a.layerName="Tool";a.selectable=!1;a.scale=1/c.scale;a.category="ToolTip";null!==a.placeholder&&(a.placeholder.scale=c.scale);var d=a.diagram;null!==d&&d!==c&&d.remove(a);c.add(a);null!==b?a.adornedObject=b:a.data=c.model;a.yb();this.positionToolTip(a,b)}else a instanceof Pe&&a!==this.currentToolTip&&a.show(b,c,this);this.currentToolTip=a;-1!==this.Qj&&(x.clearTimeout(this.Qj),
this.Qj=-1);a=this.toolTipDuration;if(0<a&&Infinity!==a){var e=this;this.Qj=sa(function(){e.hideToolTip()},a)}};Oa.prototype.positionToolTip=function(a){if(null===a.placeholder){var b=this.diagram,c=b.lastInput.documentPoint.copy(),d=a.measuredBounds,e=b.viewportBounds;b.lastInput.isTouchEvent&&(c.x-=d.width);c.x+d.width>e.right&&(c.x-=d.width+5/b.scale);c.x<e.x&&(c.x=e.x);c.y=c.y+20/b.scale+d.height>e.bottom?c.y-(d.height+5/b.scale):c.y+20/b.scale;c.y<e.y&&(c.y=e.y);a.position=c}};
Oa.prototype.hideToolTip=function(){-1!==this.Qj&&(x.clearTimeout(this.Qj),this.Qj=-1);var a=this.diagram,b=this.currentToolTip;null!==b&&(b instanceof Ke?(a.remove(b),null!==this.qr&&this.qr.Af(b.category),b.data=null,b.adornedObject=null):b instanceof Pe&&null!==b.hide&&b.hide(a,this),this.currentToolTip=null)};
Oa.prototype.doMouseUp=function(){this.cancelWaitAfter();var a=this.diagram;if(this.isActive)for(var b=this.mouseUpTools.length,c=0;c<b;c++){var d=this.mouseUpTools.L(c);d.diagram=this.diagram;if(d.canStart()){a.doFocus();a.currentTool=d;a.currentTool===d&&(d.isActive||d.doActivate(),d.doMouseUp());return}}a.doFocus();this.doDeactivate()};Oa.prototype.doMouseWheel=function(){this.standardMouseWheel()};Oa.prototype.doKeyDown=function(){var a=this.diagram;null!==a.commandHandler&&a.commandHandler.doKeyDown()};
Oa.prototype.doKeyUp=function(){var a=this.diagram;null!==a.commandHandler&&a.commandHandler.doKeyUp()};Oa.prototype.findTool=function(a){for(var b=this.mouseDownTools.length,c=0;c<b;c++){var d=this.mouseDownTools.L(c);if(d.name===a)return d}b=this.mouseMoveTools.length;for(c=0;c<b;c++)if(d=this.mouseMoveTools.L(c),d.name===a)return d;b=this.mouseUpTools.length;for(c=0;c<b;c++)if(d=this.mouseUpTools.L(c),d.name===a)return d;return null};
Oa.prototype.replaceTool=function(a,b){null!==b&&(b.diagram=this.diagram);for(var c=this.mouseDownTools.length,d=0;d<c;d++){var e=this.mouseDownTools.L(d);if(e.name===a)return null!==b?this.mouseDownTools.hd(d,b):this.mouseDownTools.lb(d),e}c=this.mouseMoveTools.length;for(d=0;d<c;d++)if(e=this.mouseMoveTools.L(d),e.name===a)return null!==b?this.mouseMoveTools.hd(d,b):this.mouseMoveTools.lb(d),e;c=this.mouseUpTools.length;for(d=0;d<c;d++)if(e=this.mouseUpTools.L(d),e.name===a)return null!==b?this.mouseUpTools.hd(d,
b):this.mouseUpTools.lb(d),e;return null};Oa.prototype.Va=function(a,b,c){null!==b&&(b.name=a,b.diagram=this.diagram);this.findTool(a)?this.replaceTool(a,b):null!==b&&c.add(b)};
ma.Object.defineProperties(Oa.prototype,{mouseWheelBehavior:{get:function(){return this.Ia},set:function(a){this.Ia=a}},gestureBehavior:{get:function(){return this.I},set:function(a){this.I=a}},currentToolTip:{get:function(){return this.l},set:function(a){this.l=a;this.qr=null!==a&&a instanceof Ke?a.adornedPart:null}},mouseDownTools:{get:function(){return this.Ic}},mouseMoveTools:{
get:function(){return this.Yc}},mouseUpTools:{get:function(){return this.Ef}},hoverDelay:{get:function(){return this.Ha},set:function(a){this.Ha=a}},holdDelay:{get:function(){return this.Y},set:function(a){this.Y=a}},dragSize:{get:function(){return this.v},set:function(a){this.v=a.G()}},toolTipDuration:{get:function(){return this.Za},set:function(a){this.Za=
a}}});Oa.prototype.replaceStandardTool=Oa.prototype.Va;var Fe=new D(Oa,"WheelScroll",0),Ee=new D(Oa,"WheelZoom",1),Qe=new D(Oa,"WheelNone",2),Le=new D(Oa,"GestureZoom",3),Me=new D(Oa,"GestureCancel",4),Ne=new D(Oa,"GestureNone",5);Oa.className="ToolManager";Oa.WheelScroll=Fe;Oa.WheelZoom=Ee;Oa.WheelNone=Qe;Oa.GestureZoom=Le;Oa.GestureCancel=Me;Oa.GestureNone=Ne;
function Re(){Be.call(this);this.name="Dragging";this.I=this.Yc=!0;this.v=this.Za=this.Ha=this.og=null;this.Bn=this.Ef=!1;this.Ql=new I(NaN,NaN);this.Ns=new I;this.Ic=!0;this.Vk=100;this.Tg=[];this.Sq=(new F).freeze();this.Ia=new Se;this.ko=null;this.Y="copy";this.Oh="";this.Je="no-drop"}la(Re,Be);
Re.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram;if(a.isReadOnly&&!a.allowDragOut||!a.allowMove&&!a.allowCopy&&!a.allowDragOut||!a.allowSelect)return!1;var b=a.lastInput;return!b.left||a.currentTool!==this&&(!this.isBeyondDragSize()||b.isTouchEvent&&b.timestamp-a.firstInput.timestamp<this.Vk)?!1:null!==this.findDraggablePart()};
Re.prototype.findDraggablePart=function(){var a=this.diagram;a=a.jm(a.firstInput.documentPoint,!1);if(null===a)return null;for(;null!==a&&!a.canSelect();)a=a.containingGroup;return null!==a&&(a.canMove()||a.canCopy())?a:null};
Re.prototype.standardMouseSelect=function(){var a=this.diagram;if(a.allowSelect){var b=a.jm(a.firstInput.documentPoint,!1);if(null!==b){for(;null!==b&&!b.canSelect();)b=b.containingGroup;this.currentPart=b;null===this.currentPart||this.currentPart.isSelected||(a.R("ChangingSelection",a.selection),b=a.lastInput,(Wa?b.meta:b.control)||b.shift||a.clearSelection(!0),this.currentPart.isSelected=!0,a.R("ChangedSelection",a.selection))}}};
Re.prototype.doActivate=function(){var a=this.diagram;this.ko=null;null===this.currentPart&&this.standardMouseSelect();var b=this.currentPart;null!==b&&(b.canMove()||b.canCopy())&&(Te=null,this.isActive=!0,this.Ql.set(a.position),Ue(this,a.selection),this.Tg.length=0,this.draggedParts=this.computeEffectiveCollection(a.selection,this.dragOptions),a.Pt=!0,!0===a.Ce("temporaryPixelRatio")&&30<a.xx&&Ve(a),We(a,this.draggedParts),this.ua("Drag"),this.startPoint=a.firstInput.documentPoint,a.isMouseCaptured=
!0,a.allowDragOut&&(this.isDragOutStarted=!0,this.Bn=!1,Te=this,Xe=this.diagram,this.doSimulatedDragOut()))};function Ue(a,b){if(a.dragsLink){var c=a.diagram;c.allowRelink&&(c.model.ik()&&1===b.count&&b.first()instanceof S?(a.draggedLink=b.first(),a.draggedLink.canRelinkFrom()&&a.draggedLink.canRelinkTo()&&a.draggedLink.Yj(),a.og=c.toolManager.findTool("Relinking"),null===a.og&&(a.og=new Ye,a.og.diagram=c)):(a.draggedLink=null,a.og=null))}}
Re.prototype.computeEffectiveCollection=function(a,b){return this.diagram.commandHandler.computeEffectiveCollection(a,b)};Re.prototype.td=function(a){return void 0===a?new cf(Gb):this.isGridSnapEnabled?new cf(new I(Math.round(a.x),Math.round(a.y))):new cf(a.copy())};
Re.prototype.doDeactivate=function(){this.isActive=!1;var a=this.diagram;a.Cf();df(this);ef(a,this.draggedParts);this.draggedParts=this.currentPart=this.ko=null;this.Bn=this.isDragOutStarted=!1;if(0<ff.count){for(var b=ff,c=b.length,d=0;d<c;d++){var e=b.L(d);gf(e);hf(e);df(e);e.diagram.Cf()}b.clear()}gf(this);this.Ql.h(NaN,NaN);Te=Xe=null;hf(this);a.isMouseCaptured=!1;a.currentCursor="";a.Pt=!1;this.Hg();jf(a,!0)};
function df(a){var b=a.diagram,c=b.skipsUndoManager;b.skipsUndoManager=!0;kf(a,b.lastInput,null);b.skipsUndoManager=c;a.Tg.length=0}function lf(){var a=Te;hf(a);mf(a);var b=a.diagram;a.Ql.u()&&(b.position=a.Ql);b.Cf()}Re.prototype.doCancel=function(){hf(this);mf(this);var a=this.diagram;this.Ql.u()&&(a.position=this.Ql);this.stopTool()};Re.prototype.doKeyDown=function(){this.isActive&&("Esc"===this.diagram.lastInput.key?this.doCancel():this.doMouseMove())};
Re.prototype.doKeyUp=function(){this.isActive&&this.doMouseMove()};function nf(a,b){var c=Infinity,d=Infinity,e=-Infinity,f=-Infinity;for(a=a.iterator;a.next();){var g=a.value;if(g.Wb()&&g.isVisible()){var h=g.location;g=h.x;h=h.y;isNaN(g)||isNaN(h)||(g<c&&(c=g),h<d&&(d=h),g>e&&(e=g),h>f&&(f=h))}}Infinity===c?b.h(0,0,0,0):b.h(c,d,e-c,f-d)}
function of(a,b){if(null===a.copiedParts){var c=a.diagram;if((!b||!c.isReadOnly&&!c.isModelReadOnly)&&null!==a.draggedParts){var d=c.undoManager;d.isEnabled&&d.isInTransaction?null!==d.currentTransaction&&0<d.currentTransaction.changes.count&&(c.undoManager.Bf(),c.ua("Drag")):mf(a);c.skipsUndoManager=!b;c.partManager.addsToTemporaryLayer=!b;a.startPoint=c.firstInput.documentPoint;b=a.copiesEffectiveCollection?a.draggedParts.Df():c.selection;c=c.ck(b,c,!0);for(b=c.iterator;b.next();)b.value.location=
b.key.location;b=N.alloc();nf(c,b);N.free(b);b=new G;for(d=a.draggedParts.iterator;d.next();){var e=d.key;e.Wb()&&e.canCopy()&&(e=c.H(e),null!==e&&(e.yb(),b.add(e,a.td(e.location))))}for(c=c.iterator;c.next();)d=c.value,d instanceof S&&d.canCopy()&&b.add(d,a.td());a.copiedParts=b;Ue(a,b.Df());null!==a.draggedLink&&(c=a.draggedLink,b=c.routeBounds,pf(c,a.startPoint.x-(b.x+b.width/2),a.startPoint.y-(b.y+b.height/2)))}}}
function hf(a){var b=a.diagram;if(null!==a.copiedParts&&(b.Jt(a.copiedParts.Df(),!1),a.copiedParts=null,null!==a.draggedParts))for(var c=a.draggedParts.iterator;c.next();)c.key instanceof S&&(c.value.point=new I(0,0));b.skipsUndoManager=!1;b.partManager.addsToTemporaryLayer=!1;a.startPoint=b.firstInput.documentPoint}
function gf(a){if(null!==a.draggedLink){if(a.dragsLink&&null!==a.og){var b=a.og;b.diagram.remove(b.temporaryFromNode);b.diagram.remove(b.temporaryToNode)}a.draggedLink=null;a.og=null}}function qf(a,b,c){var d=a.diagram,e=a.startPoint,f=I.alloc();f.assign(d.lastInput.documentPoint);a.moveParts(b,f.$d(e),c);I.free(f);!0===d.Ce("temporaryPixelRatio")&&null===d.uh&&30<d.xx&&(Ve(d),d.Ht())}Re.prototype.moveParts=function(a,b,c){var d=this.diagram;null!==d&&rf(d,a,b,this.dragOptions,c)};
function mf(a){if(null!==a.draggedParts){for(var b=a.diagram,c=a.draggedParts.iterator;c.next();){var d=c.key;d.Wb()&&(d.location=c.value.point)}for(c=a.draggedParts.iterator;c.next();)if(d=c.key,d instanceof S&&d.suspendsRouting){var e=c.value.point;a.draggedParts.add(d,a.td());pf(d,-e.x,-e.y)}b.Wc()}}
function sf(a,b){var c=a.diagram;a.dragsLink&&(null!==a.draggedLink&&(a.draggedLink.fromNode=null,a.draggedLink.toNode=null),tf(a,!1));var d=a.findDragOverObject(b),e=c.lastInput;e.targetObject=d;a.doUpdateCursor(d);var f=c.skipsUndoManager,g=!1;try{c.skipsUndoManager=!0;g=kf(a,e,d);if(!a.isActive&&null===Te)return;var h=null!==d?d.part:null;if(null===h||c.handlesDragDropForTopLevelParts&&h.isTopLevel&&!(h instanceof T)){var k=c.mouseDragOver;null!==k&&(k(e),g=!0)}if(!a.isActive&&null===Te)return;
a.doDragOver(b,d);if(!a.isActive&&null===Te)return}finally{c.skipsUndoManager=f,g&&c.Wc()}a.ko=d;c.isReadOnly||!c.allowMove&&!c.allowCopy||!c.allowHorizontalScroll&&!c.allowVerticalScroll||c.gt(e.viewPoint)}Re.prototype.findDragOverObject=function(a){var b=this;return uf(this.diagram,a,null,function(a){null===a?a=!0:(a=a.part,a=null===a||a instanceof Ke||a.layer.isTemporary||b.draggedParts&&b.draggedParts.contains(a)||b.copiedParts&&b.copiedParts.contains(a)?!0:!1);return!a})};
Re.prototype.doUpdateCursor=function(a){var b=this.diagram;this.ko!==a&&(!this.diagram.currentTool.isActive||this.mayCopy()?b.currentCursor=this.copyCursor:this.mayMove()?b.currentCursor=this.moveCursor:this.mayDragOut()&&(b.currentCursor=this.nodropCursor))};
function kf(a,b,c){var d=!1,e=a.Tg.length,f=0<e?a.Tg[0]:null;if(c===f)return!1;b.handled=!1;for(var g=0;g<e;g++){var h=a.Tg[g],k=h.mouseDragLeave;if(null!==k&&(k(b,h,c),d=!0,b.handled))break}a.Tg.length=0;if(!a.isActive&&null===Te||null===c)return d;b.handled=!1;for(e=c;null!==e;)a.Tg.push(e),e=vf(e);e=a.Tg.length;for(c=0;c<e&&(g=a.Tg[c],h=g.mouseDragEnter,null===h||(h(b,g,f),d=!0,!b.handled));c++);return d}
function vf(a){var b=a.panel;return null!==b?b:a instanceof U&&!(a instanceof T)&&(a=a.containingGroup,null!==a&&a.handlesDragDropForMembers)?a:null}function wf(a,b,c){var d=a.og;if(null===d)return null;var e=a.diagram.Ag(b,d.portGravity,function(a){return d.findValidLinkablePort(a,c)});a=I.alloc();var f=Infinity,g=null;for(e=e.iterator;e.next();){var h=e.value;if(null!==h.part){var k=h.ga(Ac,a);k=b.Be(k);k<f&&(g=h,f=k)}}I.free(a);return g}
function tf(a,b){var c=a.draggedLink;if(null!==c&&!(2>c.pointsCount)){var d=a.diagram;if(!d.isReadOnly){var e=a.og;if(null!==e){var f=null,g=null;null===c.fromNode&&(f=wf(a,c.i(0),!1),null!==f&&(g=f.part));var h=null,k=null;null===c.toNode&&(h=wf(a,c.i(c.pointsCount-1),!0),null!==h&&(k=h.part));e.isValidLink(g,f,k,h)?b?(c.defaultFromPoint=c.i(0),c.defaultToPoint=c.i(c.pointsCount-1),c.suspendsRouting=!1,c.fromNode=g,null!==f&&(c.fromPortId=f.portId),c.toNode=k,null!==h&&(c.toPortId=h.portId),c.fromPort!==
d.Xx&&d.R("LinkRelinked",c,d.Xx),c.toPort!==d.Yx&&d.R("LinkRelinked",c,d.Yx)):xf(e,g,f,k,h):xf(e,null,null,null,null)}}}}Re.prototype.doDragOver=function(){};
function Df(a,b){var c=a.diagram;a.dragsLink&&tf(a,!0);df(a);var d=a.findDragOverObject(b),e=c.lastInput;e.targetObject=d;if(null!==d){e.handled=!1;for(var f=d;null!==f;){var g=f.mouseDrop;if(null!==g&&(g(e,f),e.handled))break;Ef(a,e,f);f=vf(f)}}else f=c.mouseDrop,null!==f&&f(e);if(a.isActive||null!==Te){for(e=(a.copiedParts||a.draggedParts).iterator;e.next();)f=e.key,f instanceof W&&f.linksConnected.each(function(a){a.suspendsRouting=!1});a.doDropOnto(b,d);if(a.isActive||null!==Te){a=N.alloc();for(b=
c.selection.iterator;b.next();)d=b.value,d instanceof W&&Ff(c,d,a);N.free(a)}}}function Ef(a,b,c){a=a.diagram;c=c.part;!a.handlesDragDropForTopLevelParts||!c.isTopLevel||c instanceof T||(c=a.mouseDrop,null!==c&&c(b))}function Ff(a,b,c){var d=!1;b.getAvoidableRect(c);a.viewportBounds.Ae(c)&&(d=!0);a=a.vv(c,function(a){return a.part},function(a){return a instanceof S},!0,function(a){return a instanceof S},d);if(0!==a.count)for(a=a.iterator;a.next();)c=a.value,!c.Xd(b)&&c.isAvoiding&&c.Ta()}
Re.prototype.doDropOnto=function(){};Re.prototype.doMouseMove=function(){if(this.isActive){var a=this.diagram,b=a.lastInput;this.simulatedMouseMove(b.event,b.documentPoint,b.targetDiagram)||null===this.currentPart||null===this.draggedParts||(this.mayCopy()?(of(this,!1),We(a,this.copiedParts),qf(this,this.copiedParts,!1),ef(a,this.copiedParts)):this.mayMove()?(hf(this),qf(this,this.draggedParts,!0)):this.mayDragOut()?(of(this,!1),qf(this,this.copiedParts,!1)):hf(this),sf(this,a.lastInput.documentPoint))}};
Re.prototype.doMouseUp=function(){if(this.isActive){var a=this.diagram,b=a.lastInput;if(!this.simulatedMouseUp(b.event,b.documentPoint,b.targetDiagram)){b=!1;var c=this.mayCopy();c&&null!==this.copiedParts?(hf(this),of(this,!0),We(a,this.copiedParts),qf(this,this.copiedParts,!1),ef(a,this.copiedParts),null!==this.copiedParts&&(a.R("ChangingSelection",a.selection),a.clearSelection(!0),this.copiedParts.iteratorKeys.each(function(a){a.isSelected=!0}))):(b=!0,hf(this),this.mayMove()&&(qf(this,this.draggedParts,
!0),sf(this,a.lastInput.documentPoint)));this.Bn=!0;Df(this,a.lastInput.documentPoint);if(this.isActive){var d=c?this.copiedParts.Df():this.draggedParts.Df();this.copiedParts=null;b&&Gf(this);a.Na();ef(a,this.draggedParts);this.transactionResult=c?"Copy":"Move";a.R(c?"SelectionCopied":"SelectionMoved",d)}this.stopTool();c&&a.R("ChangedSelection",a.selection)}}};
Re.prototype.simulatedMouseMove=function(a,b,c){if(null===Te)return!1;var d=Te.diagram;c instanceof R||(c=null);var e=Xe;c!==e&&(null!==e&&e!==d&&(e.Cf(),Te.isDragOutStarted=!1,e=e.toolManager.findTool("Dragging"),null!==e&&e.doSimulatedDragLeave()),Xe=c,null!==c&&c!==d&&(lf(),e=c.toolManager.findTool("Dragging"),null!==e&&(ff.contains(e)||ff.add(e),e.doSimulatedDragEnter())));if(null===c||c===d||!c.allowDrop||c.isReadOnly||!c.allowInsert)return!1;d=c.toolManager.findTool("Dragging");null!==d&&(null!==
a&&(void 0!==a.targetTouches&&(0<a.targetTouches.length?a=a.targetTouches[0]:0<a.changedTouches.length&&(a=a.changedTouches[0])),b=c.getMouse(a)),c.lastInput.documentPoint=b,c.lastInput.viewPoint=c.Nq(b),c.lastInput.down=!1,c.lastInput.up=!1,d.doSimulatedDragOver());return!0};
Re.prototype.simulatedMouseUp=function(a,b,c){if(null===Te)return!1;var d=Xe,e=Te.diagram;if(null===c)return Te.doCancel(),!0;if(c!==d){var f=d.toolManager.findTool("Dragging");if(null!==d&&d!==e&&null!==f)return d.Cf(),Te.isDragOutStarted=!1,f.doSimulatedDragLeave(),!1;Xe=c;d=c.toolManager.findTool("Dragging");null!==d&&(lf(),ff.contains(d)||ff.add(d),d.doSimulatedDragEnter())}return c!==this.diagram?(null!==a?(void 0!==a.targetTouches&&(0<a.targetTouches.length?a=a.targetTouches[0]:0<a.changedTouches.length&&
(a=a.changedTouches[0])),b=c.getMouse(a)):null===b&&(b=new I),c.lastInput.documentPoint=b,c.lastInput.viewPoint=c.Nq(b),c.lastInput.down=!1,c.lastInput.up=!0,a=c.toolManager.findTool("Dragging"),null!==a&&a.doSimulatedDrop(),a=Te,null!==a&&(c=a.mayCopy(),a.transactionResult=c?"Copy":"Move",a.stopTool()),!0):!1};
function Gf(a){if(null!==a.draggedParts)for(var b=a.draggedParts.iterator;b.next();){var c=b.key;c instanceof W&&(c=c.containingGroup,null===c||null===c.placeholder||a.draggedParts.contains(c)||c.placeholder.o())}}
Re.prototype.mayCopy=function(){if(!this.isCopyEnabled)return!1;var a=this.diagram;if(a.isReadOnly||a.isModelReadOnly||!a.allowInsert||!a.allowCopy||(Wa?!a.lastInput.alt:!a.lastInput.control))return!1;for(a=a.selection.iterator;a.next();){var b=a.value;if(b.Wb()&&b.canCopy())return!0}return null!==this.draggedLink&&this.dragsLink&&this.draggedLink.canCopy()?!0:!1};
Re.prototype.mayDragOut=function(){if(!this.isCopyEnabled)return!1;var a=this.diagram;if(!a.allowDragOut||!a.allowCopy||a.allowMove)return!1;for(a=a.selection.iterator;a.next();){var b=a.value;if(b.Wb()&&b.canCopy())return!0}return null!==this.draggedLink&&this.dragsLink&&this.draggedLink.canCopy()?!0:!1};
Re.prototype.mayMove=function(){var a=this.diagram;if(a.isReadOnly||!a.allowMove)return!1;for(a=a.selection.iterator;a.next();){var b=a.value;if(b.Wb()&&b.canMove())return!0}return null!==this.draggedLink&&this.dragsLink&&this.draggedLink.canMove()?!0:!1};Re.prototype.computeBorder=function(a,b,c){return this.Bn||null===this.draggedParts||this.draggedParts.contains(a)?null:c.assign(b)};Re.prototype.Bz=function(){return Te};
Re.prototype.mayDragIn=function(){var a=this.diagram;if(!a.allowDrop||a.isReadOnly||a.isModelReadOnly||!a.allowInsert)return!1;var b=Te;return null===b||b.diagram.model.dataFormat!==a.model.dataFormat?!1:!0};Re.prototype.doSimulatedDragEnter=function(){if(this.mayDragIn()){var a=this.diagram;a.animationManager.Xc();Hf(a);a.animationManager.Xc();var b=Te;null!==b&&(b.diagram.Pt=!1);this.doUpdateCursor(a.grid)}};
Re.prototype.doSimulatedDragLeave=function(){var a=Te;null!==a&&a.doSimulatedDragOut();this.doCancel()};Re.prototype.doSimulatedDragOver=function(){var a=this.diagram;a.animationManager.bn=!0;var b=Te;if(null!==b&&null!==b.draggedParts){if(!this.mayDragIn())return;If(this,b.draggedParts.Df(),!1,a.firstInput);qf(this,this.copiedParts,!1);sf(this,a.lastInput.documentPoint)}a.animationManager.bn=!1};
Re.prototype.doSimulatedDrop=function(){var a=this.diagram,b=Te;if(null!==b){var c=b.diagram;b.Bn=!0;hf(this);if(!this.mayDragIn())return;a.animationManager.bn=!0;a.R("ChangingSelection",a.selection);this.ua("Drop");If(this,b.draggedParts.Df(),!0,a.lastInput);qf(this,this.copiedParts,!1);null!==this.copiedParts&&(a.clearSelection(!0),this.copiedParts.iteratorKeys.each(function(a){a.isSelected=!0}));Df(this,a.lastInput.documentPoint);a.Na();b=a.selection;null!==this.copiedParts?this.transactionResult=
"ExternalCopy":b=new F;this.copiedParts=null;a.doFocus();a.R("ExternalObjectsDropped",b,c);this.Hg();a.R("ChangedSelection",a.selection)}a.animationManager.bn=!1};
function If(a,b,c,d){if(null===a.copiedParts){var e=a.diagram;if(!e.isReadOnly&&!e.isModelReadOnly){e.skipsUndoManager=!c;e.partManager.addsToTemporaryLayer=!c;a.startPoint=d.documentPoint;c=e.ck(b,e,!0);var f=N.alloc();nf(b,f);d=f.x+f.width/2;e=f.y+f.height/2;N.free(f);f=a.Ns;var g=new G,h=I.alloc();for(b=b.iterator;b.next();){var k=b.value,l=c.H(k);k.Wb()&&k.canCopy()?(k=k.location,h.h(f.x-(d-k.x),f.y-(e-k.y)),l.location=h,l.yb(),g.add(l,a.td(h))):l instanceof S&&k.canCopy()&&(pf(l,f.x-d,f.y-e),
g.add(l,a.td()))}I.free(h);a.copiedParts=g;Ue(a,g.Df());null!==a.draggedLink&&(c=a.draggedLink,d=c.routeBounds,pf(c,a.startPoint.x-(d.x+d.width/2),a.startPoint.y-(d.y+d.height/2)))}}}Re.prototype.doSimulatedDragOut=function(){var a=this.diagram;a.Pt=!1;this.mayCopy()||this.mayMove()?a.currentCursor="":a.currentCursor=this.nodropCursor;this.ko=null};Re.prototype.computeMove=function(a,b,c,d){c=this.diagram;return null!==c?c.computeMove(a,b,this.dragOptions,d):new I};
ma.Object.defineProperties(Re.prototype,{isCopyEnabled:{get:function(){return this.Yc},set:function(a){this.Yc=a}},copiesEffectiveCollection:{get:function(){return this.I},set:function(a){this.I=a}},dragOptions:{get:function(){return this.Ia},set:function(a){this.Ia=a}},isGridSnapEnabled:{get:function(){return this.dragOptions.isGridSnapEnabled},set:function(a){this.dragOptions.isGridSnapEnabled=
a}},isComplexRoutingRealtime:{get:function(){return this.Ic},set:function(a){this.Ic=a}},isGridSnapRealtime:{get:function(){return this.dragOptions.isGridSnapRealtime},set:function(a){this.dragOptions.isGridSnapRealtime=a}},gridSnapCellSize:{get:function(){return this.dragOptions.gridSnapCellSize},set:function(a){this.dragOptions.gridSnapCellSize.w(a)||(a=a.G(),this.dragOptions.gridSnapCellSize=a)}},gridSnapCellSpot:{
get:function(){return this.dragOptions.gridSnapCellSpot},set:function(a){this.dragOptions.gridSnapCellSpot.w(a)||(a=a.G(),this.dragOptions.gridSnapCellSpot=a)}},gridSnapOrigin:{get:function(){return this.dragOptions.gridSnapOrigin},set:function(a){this.dragOptions.gridSnapOrigin.w(a)||(a=a.G(),this.dragOptions.gridSnapOrigin=a)}},dragsLink:{get:function(){return this.dragOptions.dragsLink},set:function(a){this.dragOptions.dragsLink=
a}},dragsTree:{get:function(){return this.dragOptions.dragsTree},set:function(a){this.dragOptions.dragsTree=a}},copyCursor:{get:function(){return this.Y},set:function(a){this.Y=a}},moveCursor:{get:function(){return this.Oh},set:function(a){this.Oh=a}},nodropCursor:{get:function(){return this.Je},set:function(a){this.Je=a}},currentPart:{get:function(){return this.Ha},
set:function(a){this.Ha=a}},copiedParts:{get:function(){return this.v},set:function(a){this.v=a}},draggedParts:{get:function(){return this.Za},set:function(a){this.Za=a}},draggingParts:{get:function(){return null!==this.copiedParts?this.copiedParts.Df():null!==this.draggedParts?this.draggedParts.Df():this.Sq}},draggedLink:{get:function(){return this.diagram.draggedLink},set:function(a){this.diagram.draggedLink=
a}},isDragOutStarted:{get:function(){return this.Ef},set:function(a){this.Ef=a}},startPoint:{get:function(){return this.Ns},set:function(a){this.Ns.w(a)||this.Ns.assign(a)}},delay:{get:function(){return this.Vk},set:function(a){this.Vk=a}}});Re.prototype.getDraggingSource=Re.prototype.Bz;var ff=null,Te=null,Xe=null;Re.className="DraggingTool";ff=new E;
La("draggingTool",function(){return this.findTool("Dragging")},function(a){this.Va("Dragging",a,this.mouseMoveTools)});Oa.prototype.doCancel=function(){null!==Te&&Te.doCancel();Be.prototype.doCancel.call(this)};
function Jf(){Be.call(this);this.Ef=100;this.Y=!1;this.fi="pointer";var a=new S,b=new Kf;b.isPanelMain=!0;b.stroke="blue";a.add(b);b=new Kf;b.toArrow="Standard";b.fill="blue";b.stroke="blue";a.add(b);a.layerName="Tool";this.Dw=a;a=new W;b=new Kf;b.portId="";b.figure="Rectangle";b.fill=null;b.stroke="magenta";b.strokeWidth=2;b.desiredSize=Mb;a.add(b);a.selectable=!1;a.layerName="Tool";this.Bw=a;this.Cw=b;a=new W;b=new Kf;b.portId="";b.figure="Rectangle";b.fill=null;b.stroke="magenta";b.strokeWidth=
2;b.desiredSize=Mb;a.add(b);a.selectable=!1;a.layerName="Tool";this.Ew=a;this.Fw=b;this.Yc=this.Ic=this.Ia=this.Ha=this.Za=null;this.I=!0;this.vy=new G;this.Oh=this.xi=this.Sq=null}la(Jf,Be);Jf.prototype.doStop=function(){this.diagram.Cf();this.originalToPort=this.originalToNode=this.originalFromPort=this.originalFromNode=this.originalLink=null;this.validPortsCache.clear();this.targetPort=null};
Jf.prototype.copyPortProperties=function(a,b,c,d,e){if(null!==a&&null!==b&&null!==c&&null!==d){var f=b.vf(),g=M.alloc();g.width=b.naturalBounds.width*f;g.height=b.naturalBounds.height*f;d.desiredSize=g;M.free(g);e?(d.toSpot=b.toSpot,d.toEndSegmentLength=b.toEndSegmentLength):(d.fromSpot=b.fromSpot,d.fromEndSegmentLength=b.fromEndSegmentLength);c.locationSpot=Ac;f=I.alloc();c.location=b.ga(Ac,f);I.free(f);d.angle=b.Xi();null!==this.portTargeted&&this.portTargeted(a,b,c,d,e)}};
Jf.prototype.setNoTargetPortProperties=function(a,b,c){null!==b&&(b.desiredSize=Mb,b.fromSpot=uc,b.toSpot=uc);null!==a&&(a.location=this.diagram.lastInput.documentPoint);null!==this.portTargeted&&this.portTargeted(null,null,a,b,c)};Jf.prototype.doMouseDown=function(){this.isActive&&this.doMouseMove()};
Jf.prototype.doMouseMove=function(){if(this.isActive){var a=this.diagram;this.targetPort=this.findTargetPort(this.isForwards);if(null!==this.targetPort&&this.targetPort.part instanceof W){var b=this.targetPort.part;this.isForwards?this.copyPortProperties(b,this.targetPort,this.temporaryToNode,this.temporaryToPort,!0):this.copyPortProperties(b,this.targetPort,this.temporaryFromNode,this.temporaryFromPort,!1)}else this.isForwards?this.setNoTargetPortProperties(this.temporaryToNode,this.temporaryToPort,
!0):this.setNoTargetPortProperties(this.temporaryFromNode,this.temporaryFromPort,!1);(a.allowHorizontalScroll||a.allowVerticalScroll)&&a.gt(a.lastInput.viewPoint)}};Jf.prototype.findValidLinkablePort=function(a,b){if(null===a)return null;var c=a.part;if(!(c instanceof W))return null;for(;null!==a;){var d=b?a.toLinkable:a.fromLinkable;if(!0===d&&(null!==a.portId||a instanceof W)&&(b?this.isValidTo(c,a):this.isValidFrom(c,a)))return a;if(!1===d)break;a=a.panel}return null};
Jf.prototype.findTargetPort=function(a){var b=this.diagram,c=b.lastInput.documentPoint,d=this.portGravity;0>=d&&(d=.1);var e=this,f=b.Ag(c,d,function(b){return e.findValidLinkablePort(b,a)},null,!0);d=Infinity;b=null;for(f=f.iterator;f.next();){var g=f.value,h=g.part;if(h instanceof W){var k=g.ga(Ac,I.alloc()),l=c.x-k.x,m=c.y-k.y;I.free(k);k=l*l+m*m;k<d&&(l=this.validPortsCache.H(g),null!==l?l&&(b=g,d=k):a&&this.isValidLink(this.originalFromNode,this.originalFromPort,h,g)||!a&&this.isValidLink(h,
g,this.originalToNode,this.originalToPort)?(this.validPortsCache.add(g,!0),b=g,d=k):this.validPortsCache.add(g,!1))}}return null!==b&&(c=b.part,c instanceof W&&(null===c.layer||c.layer.allowLink))?b:null};
Jf.prototype.isValidFrom=function(a,b){if(null===a||null===b)return this.isUnconnectedLinkValid;if(this.diagram.currentTool===this&&(null!==a.layer&&!a.layer.allowLink||!0!==b.fromLinkable))return!1;var c=b.fromMaxLinks;if(Infinity>c){if(null!==this.originalLink&&a===this.originalFromNode&&b===this.originalFromPort)return!0;b=b.portId;null===b&&(b="");if(a.lq(b).count>=c)return!1}return!0};
Jf.prototype.isValidTo=function(a,b){if(null===a||null===b)return this.isUnconnectedLinkValid;if(this.diagram.currentTool===this&&(null!==a.layer&&!a.layer.allowLink||!0!==b.toLinkable))return!1;var c=b.toMaxLinks;if(Infinity>c){if(null!==this.originalLink&&a===this.originalToNode&&b===this.originalToPort)return!0;b=b.portId;null===b&&(b="");if(a.wd(b).count>=c)return!1}return!0};
Jf.prototype.isInSameNode=function(a,b){if(null===a||null===b)return!1;if(a===b)return!0;a=a.part;b=b.part;return null!==a&&a===b};Jf.prototype.isLinked=function(a,b){if(null===a||null===b)return!1;var c=a.part;if(!(c instanceof W))return!1;a=a.portId;null===a&&(a="");var d=b.part;if(!(d instanceof W))return!1;b=b.portId;null===b&&(b="");for(b=d.wd(b);b.next();)if(d=b.value,d.fromNode===c&&d.fromPortId===a)return!0;return!1};
Jf.prototype.isValidLink=function(a,b,c,d){if(!this.isValidFrom(a,b)||!this.isValidTo(c,d)||!(null===b||null===d||(b.fromLinkableSelfNode&&d.toLinkableSelfNode||!this.isInSameNode(b,d))&&(b.fromLinkableDuplicates&&d.toLinkableDuplicates||!this.isLinked(b,d)))||null!==this.originalLink&&(null!==a&&this.isLabelDependentOnLink(a,this.originalLink)||null!==c&&this.isLabelDependentOnLink(c,this.originalLink))||null!==a&&null!==c&&(null===a.data&&null!==c.data||null!==a.data&&null===c.data)||!this.isValidCycle(a,
c,this.originalLink))return!1;if(null!==a){var e=a.linkValidation;if(null!==e&&!e(a,b,c,d,this.originalLink))return!1}if(null!==c&&(e=c.linkValidation,null!==e&&!e(a,b,c,d,this.originalLink)))return!1;e=this.linkValidation;return null!==e?e(a,b,c,d,this.originalLink):!0};Jf.prototype.isLabelDependentOnLink=function(a,b){if(null===a)return!1;var c=a.labeledLink;if(null===c)return!1;if(c===b)return!0;var d=new F;d.add(a);return Lf(this,c,b,d)};
function Lf(a,b,c,d){if(b===c)return!0;var e=b.fromNode;if(null!==e&&e.isLinkLabel&&(d.add(e),Lf(a,e.labeledLink,c,d)))return!0;b=b.toNode;return null!==b&&b.isLinkLabel&&(d.add(b),Lf(a,b.labeledLink,c,d))?!0:!1}
Jf.prototype.isValidCycle=function(a,b,c){void 0===c&&(c=null);if(null===a||null===b)return this.isUnconnectedLinkValid;var d=this.diagram.validCycle;if(d!==Mf){if(d===Nf){d=c||this.temporaryLink;if(null!==d&&!d.isTreeLink)return!0;for(d=b.linksConnected;d.next();){var e=d.value;if(e!==c&&e.isTreeLink&&e.toNode===b)return!1}return!Of(this,a,b,c,!0)}if(d===Pf){d=c||this.temporaryLink;if(null!==d&&!d.isTreeLink)return!0;for(d=a.linksConnected;d.next();)if(e=d.value,e!==c&&e.isTreeLink&&e.fromNode===
a)return!1;return!Of(this,a,b,c,!0)}if(d===Qf)return a===b?a=!0:(d=new F,d.add(b),a=Rf(this,d,a,b,c)),!a;if(d===Sf)return!Of(this,a,b,c,!1);if(d===Tf)return a===b?a=!0:(d=new F,d.add(b),a=Uf(this,d,a,b,c)),!a}return!0};function Of(a,b,c,d,e){if(b===c)return!0;if(null===b||null===c)return!1;for(var f=b.linksConnected;f.next();){var g=f.value;if(g!==d&&(!e||g.isTreeLink)&&g.toNode===b&&(g=g.fromNode,g!==b&&Of(a,g,c,d,e)))return!0}return!1}
function Rf(a,b,c,d,e){if(c===d)return!0;if(null===c||null===d||b.contains(c))return!1;b.add(c);for(var f=c.linksConnected;f.next();){var g=f.value;if(g!==e&&g.toNode===c&&(g=g.fromNode,g!==c&&Rf(a,b,g,d,e)))return!0}return!1}function Uf(a,b,c,d,e){if(c===d)return!0;if(null===c||null===d||b.contains(c))return!1;b.add(c);for(var f=c.linksConnected;f.next();){var g=f.value;if(g!==e){var h=g.fromNode;g=g.toNode;h=h===c?g:h;if(h!==c&&Uf(a,b,h,d,e))return!0}}return!1}
ma.Object.defineProperties(Jf.prototype,{portGravity:{get:function(){return this.Ef},set:function(a){0<=a&&(this.Ef=a)}},isUnconnectedLinkValid:{get:function(){return this.Y},set:function(a){this.Y=a}},linkingCursor:{get:function(){return this.fi},set:function(a){this.fi=a}},temporaryLink:{get:function(){return this.Dw},set:function(a){this.Dw=a}},temporaryFromNode:{
get:function(){return this.Bw},set:function(a){this.Bw=a}},temporaryFromPort:{get:function(){return this.Cw},set:function(a){this.Cw=a}},temporaryToNode:{get:function(){return this.Ew},set:function(a){this.Ew=a}},temporaryToPort:{get:function(){return this.Fw},set:function(a){this.Fw=a}},originalLink:{get:function(){return this.Za},set:function(a){this.Za=a}},originalFromNode:{
get:function(){return this.Ha},set:function(a){this.Ha=a}},originalFromPort:{get:function(){return this.Ia},set:function(a){this.Ia=a}},originalToNode:{get:function(){return this.Ic},set:function(a){this.Ic=a}},originalToPort:{get:function(){return this.Yc},set:function(a){this.Yc=a}},isForwards:{get:function(){return this.I},set:function(a){this.I=a}},validPortsCache:{
get:function(){return this.vy}},targetPort:{get:function(){return this.Sq},set:function(a){this.Sq=a}},linkValidation:{get:function(){return this.xi},set:function(a){this.xi=a}},portTargeted:{get:function(){return this.Oh},set:function(a){this.Oh=a}}});Jf.className="LinkingBaseTool";function Vf(){Jf.call(this);this.name="Linking";this.v={};this.l=null;this.J=Wf;this.Je=null}la(Vf,Jf);
Vf.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram;return a.isReadOnly||a.isModelReadOnly||!a.allowLink||!a.model.vt()||!a.lastInput.left||a.currentTool!==this&&!this.isBeyondDragSize()?!1:null!==this.findLinkablePort()};
Vf.prototype.findLinkablePort=function(){var a=this.diagram,b=this.startObject;null===b&&(b=a.Ub(a.firstInput.documentPoint,null,null));if(null===b||!(b.part instanceof W))return null;a=this.direction;if(a===Wf||a===Xf){var c=this.findValidLinkablePort(b,!1);if(null!==c)return this.isForwards=!0,c}if(a===Wf||a===Yf)if(b=this.findValidLinkablePort(b,!0),null!==b)return this.isForwards=!1,b;return null};
Vf.prototype.doActivate=function(){var a=this.diagram,b=this.findLinkablePort();null!==b&&(this.ua(this.name),a.isMouseCaptured=!0,a.currentCursor=this.linkingCursor,this.isForwards?(null===this.temporaryToNode||this.temporaryToNode.location.u()||(this.temporaryToNode.location=a.lastInput.documentPoint),this.originalFromPort=b,b=this.originalFromPort.part,b instanceof W&&(this.originalFromNode=b),this.copyPortProperties(this.originalFromNode,this.originalFromPort,this.temporaryFromNode,this.temporaryFromPort,
!1)):(null===this.temporaryFromNode||this.temporaryFromNode.location.u()||(this.temporaryFromNode.location=a.lastInput.documentPoint),this.originalToPort=b,b=this.originalToPort.part,b instanceof W&&(this.originalToNode=b),this.copyPortProperties(this.originalToNode,this.originalToPort,this.temporaryToNode,this.temporaryToPort,!0)),a.add(this.temporaryFromNode),a.add(this.temporaryToNode),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.Ta(),a.add(this.temporaryLink)),this.isActive=!0)};Vf.prototype.doDeactivate=function(){this.isActive=!1;var a=this.diagram;a.remove(this.temporaryLink);a.remove(this.temporaryFromNode);a.remove(this.temporaryToNode);a.isMouseCaptured=!1;a.currentCursor="";this.Hg()};Vf.prototype.doStop=function(){Jf.prototype.doStop.call(this);this.startObject=null};
Vf.prototype.doMouseUp=function(){var a=this.diagram;if(this.isActive){var b=this.transactionResult=null,c=null,d=null,e=null,f=null;try{var g=this.targetPort=this.findTargetPort(this.isForwards);if(null!==g){var h=g.part;h instanceof W&&(this.isForwards?(null!==this.originalFromNode&&(b=this.originalFromNode,c=this.originalFromPort),d=h,e=g):(b=h,c=g,null!==this.originalToNode&&(d=this.originalToNode,e=this.originalToPort)))}else this.isForwards?null!==this.originalFromNode&&this.isUnconnectedLinkValid&&
(b=this.originalFromNode,c=this.originalFromPort):null!==this.originalToNode&&this.isUnconnectedLinkValid&&(d=this.originalToNode,e=this.originalToPort);null!==b||null!==d?(f=this.insertLink(b,c,d,e),null!==f?(null===g&&(this.isForwards?f.defaultToPoint=a.lastInput.documentPoint:f.defaultFromPoint=a.lastInput.documentPoint),a.allowSelect&&(a.R("ChangingSelection",a.selection),a.clearSelection(!0),f.isSelected=!0),this.transactionResult=this.name,a.R("LinkDrawn",f)):(a.model.gq(),this.doNoLink(b,c,
d,e))):this.isForwards?this.doNoLink(this.originalFromNode,this.originalFromPort,null,null):this.doNoLink(null,null,this.originalToNode,this.originalToPort)}finally{this.stopTool(),f&&a.allowSelect&&a.R("ChangedSelection",a.selection)}}};
Vf.prototype.isNewTreeLink=function(){var a=this.archetypeLinkData;if(null===a)return!0;if(a instanceof S)return a.isTreeLink;var b=this.diagram;if(null===b)return!0;a=b.partManager.getLinkCategoryForData(a);b=b.partManager.findLinkTemplateForCategory(a);return null!==b?b.isTreeLink:!0};Vf.prototype.insertLink=function(a,b,c,d){return this.diagram.partManager.insertLink(a,b,c,d)};Vf.prototype.doNoLink=function(){};
ma.Object.defineProperties(Vf.prototype,{archetypeLinkData:{get:function(){return this.v},set:function(a){this.v=a}},archetypeLabelNodeData:{get:function(){return this.l},set:function(a){this.l=a}},direction:{get:function(){return this.J},set:function(a){this.J=a}},startObject:{get:function(){return this.Je},set:function(a){this.Je=a}}});
var Wf=new D(Vf,"Either",0),Xf=new D(Vf,"ForwardsOnly",0),Yf=new D(Vf,"BackwardsOnly",0);Vf.className="LinkingTool";Vf.Either=Wf;Vf.ForwardsOnly=Xf;Vf.BackwardsOnly=Yf;
function Ye(){Jf.call(this);this.name="Relinking";var a=new Kf;a.figure="Diamond";a.desiredSize=Ob;a.fill="lightblue";a.stroke="dodgerblue";a.cursor=this.linkingCursor;a.segmentIndex=0;this.v=a;a=new Kf;a.figure="Diamond";a.desiredSize=Ob;a.fill="lightblue";a.stroke="dodgerblue";a.cursor=this.linkingCursor;a.segmentIndex=-1;this.Je=a;this.l=null;this.gx=new N}la(Ye,Jf);
Ye.prototype.updateAdornments=function(a){if(null!==a&&a instanceof S){var b="RelinkFrom",c=null;if(a.isSelected&&!this.diagram.isReadOnly){var d=a.selectionObject;null!==d&&a.canRelinkFrom()&&a.actualBounds.u()&&a.isVisible()&&d.actualBounds.u()&&d.zf()&&(c=a.fk(b),null===c&&(c=this.makeAdornment(d,!1),a.Ch(b,c)))}null===c&&a.Af(b);b="RelinkTo";c=null;a.isSelected&&!this.diagram.isReadOnly&&(d=a.selectionObject,null!==d&&a.canRelinkTo()&&a.actualBounds.u()&&a.isVisible()&&d.actualBounds.u()&&d.zf()&&
(c=a.fk(b),null===c?(c=this.makeAdornment(d,!0),a.Ch(b,c)):c.o()));null===c&&a.Af(b)}};Ye.prototype.makeAdornment=function(a,b){var c=new Ke;c.type=X.Link;b=b?this.toHandleArchetype:this.fromHandleArchetype;null!==b&&c.add(b.copy());c.adornedObject=a;return c};
Ye.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram;if(a.isReadOnly||a.isModelReadOnly||!a.allowRelink||!a.model.vt()||!a.lastInput.left)return!1;var b=this.findToolHandleAt(a.firstInput.documentPoint,"RelinkFrom");null===b&&(b=this.findToolHandleAt(a.firstInput.documentPoint,"RelinkTo"));return null!==b};
Ye.prototype.doActivate=function(){var a=this.diagram;if(null===this.originalLink){var b=this.handle;null===b&&(b=this.findToolHandleAt(a.firstInput.documentPoint,"RelinkFrom"),null===b&&(b=this.findToolHandleAt(a.firstInput.documentPoint,"RelinkTo")));if(null===b)return;var c=b.part;if(!(c instanceof Ke&&c.adornedPart instanceof S))return;this.handle=b;this.isForwards=null===c||"RelinkTo"===c.category;this.originalLink=c.adornedPart}this.ua(this.name);a.isMouseCaptured=!0;a.currentCursor=this.linkingCursor;
this.originalFromPort=this.originalLink.fromPort;this.originalFromNode=this.originalLink.fromNode;this.originalToPort=this.originalLink.toPort;this.originalToNode=this.originalLink.toNode;this.gx.set(this.originalLink.actualBounds);null!==this.originalLink&&0<this.originalLink.pointsCount&&(null===this.originalLink.fromNode&&(null!==this.temporaryFromPort&&(this.temporaryFromPort.desiredSize=Lb),null!==this.temporaryFromNode&&(this.temporaryFromNode.location=this.originalLink.i(0))),null===this.originalLink.toNode&&
(null!==this.temporaryToPort&&(this.temporaryToPort.desiredSize=Lb),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);a.add(this.temporaryFromNode);a.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.Ta(),a.add(this.temporaryLink));this.isActive=!0};
Ye.prototype.copyLinkProperties=function(a,b){if(null!==a&&null!==b){b.adjusting=a.adjusting;b.corner=a.corner;var c=a.curve;if(c===Zf||c===$f)c=ag;b.curve=c;b.curviness=a.curviness;b.isTreeLink=a.isTreeLink;b.points=a.points;b.routing=a.routing;b.smoothness=a.smoothness;b.fromSpot=a.fromSpot;b.fromEndSegmentLength=a.fromEndSegmentLength;b.fromShortLength=a.fromShortLength;b.toSpot=a.toSpot;b.toEndSegmentLength=a.toEndSegmentLength;b.toShortLength=a.toShortLength}};
Ye.prototype.doDeactivate=function(){this.isActive=!1;var a=this.diagram;a.remove(this.temporaryLink);a.remove(this.temporaryFromNode);a.remove(this.temporaryToNode);a.isMouseCaptured=!1;a.currentCursor="";this.Hg()};Ye.prototype.doStop=function(){Jf.prototype.doStop.call(this);this.handle=null};
Ye.prototype.doMouseUp=function(){if(this.isActive){var a=this.diagram;this.transactionResult=null;var b=this.originalFromNode,c=this.originalFromPort,d=this.originalToNode,e=this.originalToPort,f=this.originalLink;this.targetPort=this.findTargetPort(this.isForwards);if(null!==this.targetPort){var g=this.targetPort.part;g instanceof W&&(this.isForwards?(d=g,e=this.targetPort):(b=g,c=this.targetPort))}else this.isUnconnectedLinkValid?this.isForwards?e=d=null:c=b=null:f=null;null!==f?(this.reconnectLink(f,
this.isForwards?d:b,this.isForwards?e:c,this.isForwards),null===this.targetPort&&(this.isForwards?f.defaultToPoint=a.lastInput.documentPoint:f.defaultFromPoint=a.lastInput.documentPoint,f.Ta()),a.allowSelect&&(f.isSelected=!0),this.transactionResult=this.name,a.R("LinkRelinked",f,this.isForwards?this.originalToPort:this.originalFromPort)):this.doNoRelink(this.originalLink,this.isForwards);this.originalLink.tq(this.gx)}this.stopTool()};
Ye.prototype.reconnectLink=function(a,b,c,d){c=null!==c&&null!==c.portId?c.portId:"";d?(a.toNode=b,a.toPortId=c):(a.fromNode=b,a.fromPortId=c);return!0};Ye.prototype.doNoRelink=function(){};
function xf(a,b,c,d,e){null!==b?(a.copyPortProperties(b,c,a.temporaryFromNode,a.temporaryFromPort,!1),a.diagram.add(a.temporaryFromNode)):a.diagram.remove(a.temporaryFromNode);null!==d?(a.copyPortProperties(d,e,a.temporaryToNode,a.temporaryToPort,!0),a.diagram.add(a.temporaryToNode)):a.diagram.remove(a.temporaryToNode)}
ma.Object.defineProperties(Ye.prototype,{fromHandleArchetype:{get:function(){return this.v},set:function(a){this.v=a}},toHandleArchetype:{get:function(){return this.Je},set:function(a){this.Je=a}},handle:{get:function(){return this.l},set:function(a){if(null!==a&&!(a.part instanceof Ke))throw Error("new handle is not in an Adornment: "+a);this.l=a}}});Ye.className="RelinkingTool";
La("linkingTool",function(){return this.findTool("Linking")},function(a){this.Va("Linking",a,this.mouseMoveTools)});La("relinkingTool",function(){return this.findTool("Relinking")},function(a){this.Va("Relinking",a,this.mouseDownTools)});
function bg(){Be.call(this);this.name="LinkReshaping";var a=new Kf;a.figure="Rectangle";a.desiredSize=Nb;a.fill="lightblue";a.stroke="dodgerblue";this.v=a;a=new Kf;a.figure="Diamond";a.desiredSize=Ob;a.fill="lightblue";a.stroke="dodgerblue";a.cursor="move";this.I=a;this.Y=3;this.Yt=this.l=null;this.hx=new I;this.ps=new E}la(bg,Be);bg.prototype.Bv=function(a){return a&&a.ws&&0!==a.ws.value?a.ws:cg};bg.prototype.Im=function(a,b){a.ws=b};
bg.prototype.updateAdornments=function(a){if(null!==a&&a instanceof S){var b=null;if(a.isSelected&&!this.diagram.isReadOnly){var c=a.path;null!==c&&a.canReshape()&&a.actualBounds.u()&&a.isVisible()&&c.actualBounds.u()&&c.zf()&&(b=a.fk(this.name),null===b||b.ax!==a.pointsCount||b.qx!==a.resegmentable)&&(b=this.makeAdornment(c),null!==b&&(b.ax=a.pointsCount,b.qx=a.resegmentable,a.Ch(this.name,b)))}null===b&&a.Af(this.name)}};
bg.prototype.makeAdornment=function(a){var b=a.part,c=b.pointsCount,d=b.isOrthogonal,e=null;if(null!==b.points&&1<c){e=new Ke;e.type=X.Link;c=b.firstPickIndex;var f=b.lastPickIndex,g=d?1:0;if(b.resegmentable&&b.computeCurve()!==og)for(var h=c+g;h<f-g;h++){var k=this.makeResegmentHandle(a,h);null!==k&&(k.segmentIndex=h,k.segmentFraction=.5,k.fromMaxLinks=999,e.add(k))}for(g=c+1;g<f;g++)if(h=this.makeHandle(a,g),null!==h){h.segmentIndex=g;if(g!==c)if(g===c+1&&d){k=b.i(c);var l=b.i(c+1);J.A(k.x,l.x)&&
J.A(k.y,l.y)&&(l=b.i(c-1));J.A(k.x,l.x)?(this.Im(h,pg),h.cursor="n-resize"):J.A(k.y,l.y)&&(this.Im(h,qg),h.cursor="w-resize")}else g===f-1&&d?(k=b.i(f-1),l=b.i(f),J.A(k.x,l.x)&&J.A(k.y,l.y)&&(k=b.i(f+1)),J.A(k.x,l.x)?(this.Im(h,pg),h.cursor="n-resize"):J.A(k.y,l.y)&&(this.Im(h,qg),h.cursor="w-resize")):g!==f&&(this.Im(h,rg),h.cursor="move");e.add(h)}e.adornedObject=a}return e};bg.prototype.makeHandle=function(){var a=this.handleArchetype;return null===a?null:a.copy()};
bg.prototype.makeResegmentHandle=function(){var a=this.midHandleArchetype;return null===a?null:a.copy()};bg.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram;return!a.isReadOnly&&a.allowReshape&&a.lastInput.left?null!==this.findToolHandleAt(a.firstInput.documentPoint,this.name):!1};
bg.prototype.doActivate=function(){var a=this.diagram;null===this.handle&&(this.handle=this.findToolHandleAt(a.firstInput.documentPoint,this.name));if(null!==this.handle){var b=this.handle.part.adornedPart;if(b instanceof S){this.Yt=b;a.isMouseCaptured=!0;this.ua(this.name);if(b.resegmentable&&999===this.handle.fromMaxLinks){var c=b.points.copy(),d=this.getResegmentingPoint();c.Kb(this.handle.segmentIndex+1,d);b.isOrthogonal&&c.Kb(this.handle.segmentIndex+1,d);b.points=c;b.Lb();b.updateAdornments();
this.handle=this.findToolHandleAt(a.firstInput.documentPoint,this.name);if(null===this.handle){this.doDeactivate();return}}this.hx=b.i(this.handle.segmentIndex);this.ps=b.points.copy();this.isActive=!0}}};bg.prototype.doDeactivate=function(){this.Hg();this.Yt=this.handle=null;this.isActive=this.diagram.isMouseCaptured=!1};bg.prototype.doCancel=function(){var a=this.adornedLink;null!==a&&(a.points=this.ps);this.stopTool()};bg.prototype.getResegmentingPoint=function(){return this.handle.ga(Ac)};
bg.prototype.doMouseMove=function(){var a=this.diagram;this.isActive&&(a=this.computeReshape(a.lastInput.documentPoint),this.reshape(a))};
bg.prototype.doMouseUp=function(){var a=this.diagram;if(this.isActive){var b=this.computeReshape(a.lastInput.documentPoint);this.reshape(b);b=this.adornedLink;if(null!==b&&b.resegmentable){var c=this.handle.segmentIndex,d=b.i(c-1),e=b.i(c),f=b.i(c+1);if(b.isOrthogonal){if(c>b.firstPickIndex+1&&c<b.lastPickIndex-1){var g=b.i(c-2);if(Math.abs(d.x-e.x)<this.resegmentingDistance&&Math.abs(d.y-e.y)<this.resegmentingDistance&&(sg(this,g,d,e,f,!0)||sg(this,g,d,e,f,!1))){var h=b.points.copy();sg(this,g,d,
e,f,!0)?(h.hd(c-2,new I(g.x,(f.y+g.y)/2)),h.hd(c+1,new I(f.x,(f.y+g.y)/2))):(h.hd(c-2,new I((f.x+g.x)/2,g.y)),h.hd(c+1,new I((f.x+g.x)/2,f.y)));h.lb(c);h.lb(c-1);b.points=h;b.Lb()}else g=b.i(c+2),Math.abs(e.x-f.x)<this.resegmentingDistance&&Math.abs(e.y-f.y)<this.resegmentingDistance&&(sg(this,d,e,f,g,!0)||sg(this,d,e,f,g,!1))&&(h=b.points.copy(),sg(this,d,e,f,g,!0)?(h.hd(c-1,new I(d.x,(d.y+g.y)/2)),h.hd(c+2,new I(g.x,(d.y+g.y)/2))):(h.hd(c-1,new I((d.x+g.x)/2,d.y)),h.hd(c+2,new I((d.x+g.x)/2,g.y))),
h.lb(c+1),h.lb(c),b.points=h,b.Lb())}}else g=I.alloc(),J.Lh(d.x,d.y,f.x,f.y,e.x,e.y,g)&&g.Be(e)<this.resegmentingDistance*this.resegmentingDistance&&(d=b.points.copy(),d.lb(c),b.points=d,b.Lb()),I.free(g)}a.Na();this.transactionResult=this.name;a.R("LinkReshaped",this.adornedLink,this.ps)}this.stopTool()};
function sg(a,b,c,d,e,f){return f?Math.abs(b.y-c.y)<a.resegmentingDistance&&Math.abs(c.y-d.y)<a.resegmentingDistance&&Math.abs(d.y-e.y)<a.resegmentingDistance:Math.abs(b.x-c.x)<a.resegmentingDistance&&Math.abs(c.x-d.x)<a.resegmentingDistance&&Math.abs(d.x-e.x)<a.resegmentingDistance}
bg.prototype.reshape=function(a){var b=this.adornedLink;b.Nh();var c=this.handle.segmentIndex,d=this.Bv(this.handle);if(b.isOrthogonal)if(c===b.firstPickIndex+1)c=b.firstPickIndex+1,d===pg?(b.K(c,b.i(c-1).x,a.y),b.K(c+1,b.i(c+2).x,a.y)):d===qg&&(b.K(c,a.x,b.i(c-1).y),b.K(c+1,a.x,b.i(c+2).y));else if(c===b.lastPickIndex-1)c=b.lastPickIndex-1,d===pg?(b.K(c-1,b.i(c-2).x,a.y),b.K(c,b.i(c+1).x,a.y)):d===qg&&(b.K(c-1,a.x,b.i(c-2).y),b.K(c,a.x,b.i(c+1).y));else{d=c;var e=b.i(d),f=b.i(d-1),g=b.i(d+1);J.A(f.x,
e.x)&&J.A(e.y,g.y)?(J.A(f.x,b.i(d-2).x)&&!J.A(f.y,b.i(d-2).y)?(b.m(d,a.x,f.y),c++,d++):b.K(d-1,a.x,f.y),J.A(g.y,b.i(d+2).y)&&!J.A(g.x,b.i(d+2).x)?b.m(d+1,g.x,a.y):b.K(d+1,g.x,a.y)):J.A(f.y,e.y)&&J.A(e.x,g.x)?(J.A(f.y,b.i(d-2).y)&&!J.A(f.x,b.i(d-2).x)?(b.m(d,f.x,a.y),c++,d++):b.K(d-1,f.x,a.y),J.A(g.x,b.i(d+2).x)&&!J.A(g.y,b.i(d+2).y)?b.m(d+1,a.x,g.y):b.K(d+1,a.x,g.y)):J.A(f.x,e.x)&&J.A(e.x,g.x)?(J.A(f.x,b.i(d-2).x)&&!J.A(f.y,b.i(d-2).y)?(b.m(d,a.x,f.y),c++,d++):b.K(d-1,a.x,f.y),J.A(g.x,b.i(d+2).x)&&
!J.A(g.y,b.i(d+2).y)?b.m(d+1,a.x,g.y):b.K(d+1,a.x,g.y)):J.A(f.y,e.y)&&J.A(e.y,g.y)&&(J.A(f.y,b.i(d-2).y)&&!J.A(f.x,b.i(d-2).x)?(b.m(d,f.x,a.y),c++,d++):b.K(d-1,f.x,a.y),J.A(g.y,b.i(d+2).y)&&!J.A(g.x,b.i(d+2).x)?b.m(d+1,g.x,a.y):b.K(d+1,g.x,a.y));b.K(c,a.x,a.y)}else b.K(c,a.x,a.y),d=b.fromNode,e=b.fromPort,null!==d&&(f=d.findVisibleNode(),null!==f&&f!==d&&(d=f,e=d.port)),1===c&&b.computeSpot(!0,e).jc()&&(f=e.ga(Ac,I.alloc()),d=b.getLinkPointFromPoint(d,e,f,a,!0,I.alloc()),b.K(0,d.x,d.y),I.free(f),
I.free(d)),d=b.toNode,e=b.toPort,null!==d&&(f=d.findVisibleNode(),null!==f&&f!==d&&(d=f,e=d.port)),c===b.pointsCount-2&&b.computeSpot(!1,e).jc()&&(c=e.ga(Ac,I.alloc()),a=b.getLinkPointFromPoint(d,e,c,a,!1,I.alloc()),b.K(b.pointsCount-1,a.x,a.y),I.free(c),I.free(a));b.sf()};bg.prototype.computeReshape=function(a){var b=this.adornedLink,c=this.handle.segmentIndex;switch(this.Bv(this.handle)){case rg:return a;case pg:return new I(b.i(c).x,a.y);case qg:return new I(a.x,b.i(c).y);default:case cg:return b.i(c)}};
ma.Object.defineProperties(bg.prototype,{handleArchetype:{get:function(){return this.v},set:function(a){this.v=a}},midHandleArchetype:{get:function(){return this.I},set:function(a){this.I=a}},handle:{get:function(){return this.l},set:function(a){if(null!==a&&!(a.part instanceof Ke))throw Error("new handle is not in an Adornment: "+a);this.l=a}},adornedLink:{get:function(){return this.Yt}},
resegmentingDistance:{get:function(){return this.Y},set:function(a){this.Y=a}},originalPoint:{get:function(){return this.hx}},originalPoints:{get:function(){return this.ps}}});bg.prototype.setReshapingBehavior=bg.prototype.Im;bg.prototype.getReshapingBehavior=bg.prototype.Bv;var cg=new D(bg,"None",0),qg=new D(bg,"Horizontal",1),pg=new D(bg,"Vertical",2),rg=new D(bg,"All",3);bg.className="LinkReshapingTool";
bg.None=cg;bg.Horizontal=qg;bg.Vertical=pg;bg.All=rg;La("linkReshapingTool",function(){return this.findTool("LinkReshaping")},function(a){this.Va("LinkReshaping",a,this.mouseDownTools)});
function tg(){Be.call(this);this.name="Resizing";this.eg=(new M(1,1)).freeze();this.dg=(new M(9999,9999)).freeze();this.Ng=(new M(NaN,NaN)).freeze();this.I=!1;this.be=null;var a=new Kf;a.alignmentFocus=Ac;a.figure="Rectangle";a.desiredSize=Nb;a.fill="lightblue";a.stroke="dodgerblue";a.strokeWidth=1;a.cursor="pointer";this.v=a;this.l=null;this.os=new I;this.ex=new M;this.Xo=new I;this.ou=new M(0,0);this.nu=new M(Infinity,Infinity);this.mu=new M(1,1);this.$w=!0}la(tg,Be);
tg.prototype.updateAdornments=function(a){if(!(null===a||a instanceof S)){if(a.isSelected&&!this.diagram.isReadOnly){var b=a.resizeObject,c=a.fk(this.name);if(null!==b&&a.canResize()&&a.actualBounds.u()&&a.isVisible()&&b.actualBounds.u()&&b.zf()){if(null===c||c.adornedObject!==b)c=this.makeAdornment(b);if(null!==c){b=b.Xi();ug(a)&&this.updateResizeHandles(c,b);a.Ch(this.name,c);return}}}a.Af(this.name)}};
tg.prototype.makeAdornment=function(a){var b=a.part.resizeAdornmentTemplate;if(null===b){b=new Ke;b.type=X.Spot;b.locationSpot=Ac;var c=new vg;c.isPanelMain=!0;b.add(c);b.add(this.makeHandle(a,vc));b.add(this.makeHandle(a,yc));b.add(this.makeHandle(a,Gc));b.add(this.makeHandle(a,Cc));b.add(this.makeHandle(a,ed));b.add(this.makeHandle(a,gd));b.add(this.makeHandle(a,hd));b.add(this.makeHandle(a,fd))}else if(wg(b),b=b.copy(),null===b)return null;b.adornedObject=a;return b};
tg.prototype.makeHandle=function(a,b){a=this.handleArchetype;if(null===a)return null;a=a.copy();a.alignment=b;return a};
tg.prototype.updateResizeHandles=function(a,b){if(null!==a)if(!a.alignment.Mb()&&("pointer"===a.cursor||0<a.cursor.indexOf("resize")))a:{var c=a.alignment;c.jc()&&(c=Ac);if(0>=c.x)b=0>=c.y?b+225:1<=c.y?b+135:b+180;else if(1<=c.x)0>=c.y?b+=315:1<=c.y&&(b+=45);else if(0>=c.y)b+=270;else if(1<=c.y)b+=90;else break a;0>b?b+=360:360<=b&&(b-=360);a.cursor=22.5>b?"e-resize":67.5>b?"se-resize":112.5>b?"s-resize":157.5>b?"sw-resize":202.5>b?"w-resize":247.5>b?"nw-resize":292.5>b?"n-resize":337.5>b?"ne-resize":
"e-resize"}else if(a instanceof X)for(a=a.elements;a.next();)this.updateResizeHandles(a.value,b)};tg.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram;return!a.isReadOnly&&a.allowResize&&a.lastInput.left?null!==this.findToolHandleAt(a.firstInput.documentPoint,this.name):!1};
tg.prototype.doActivate=function(){var a=this.diagram;null===this.handle&&(this.handle=this.findToolHandleAt(a.firstInput.documentPoint,this.name));null!==this.handle&&(this.adornedObject=this.handle.part.adornedObject,null!==this.adornedObject&&(this.os.set(this.adornedObject.ga(this.handle.alignment.Qv())),this.Xo.set(this.adornedObject.part.location),this.ex.set(this.adornedObject.desiredSize),this.mu=this.computeCellSize(),this.ou=this.computeMinSize(),this.nu=this.computeMaxSize(),a.isMouseCaptured=
!0,this.$w=a.animationManager.isEnabled,a.animationManager.isEnabled=!1,this.ua(this.name),this.isActive=!0))};tg.prototype.doDeactivate=function(){var a=this.diagram;this.Hg();this.be=this.handle=null;this.isActive=a.isMouseCaptured=!1;a.animationManager.isEnabled=this.$w};tg.prototype.doCancel=function(){null!==this.adornedObject&&(this.adornedObject.desiredSize=this.originalDesiredSize,this.adornedObject.part.location=this.originalLocation);this.stopTool()};
tg.prototype.doMouseMove=function(){var a=this.diagram;if(this.isActive){var b=this.ou,c=this.nu,d=this.mu,e=this.adornedObject.ot(a.lastInput.documentPoint,I.alloc()),f=this.computeReshape();b=this.computeResize(e,this.handle.alignment,b,c,d,f);this.resize(b);a.Wc();I.free(e)}};
tg.prototype.doMouseUp=function(){var a=this.diagram;if(this.isActive){var b=this.ou,c=this.nu,d=this.mu,e=this.adornedObject.ot(a.lastInput.documentPoint,I.alloc()),f=this.computeReshape();b=this.computeResize(e,this.handle.alignment,b,c,d,f);this.resize(b);I.free(e);a.Na();this.transactionResult=this.name;a.R("PartResized",this.adornedObject,this.originalDesiredSize)}this.stopTool()};
tg.prototype.resize=function(a){var b=this.diagram,c=this.adornedObject;if(null!==c){c.desiredSize=a.size;a=c.part;a.yb();c=c.ga(this.handle.alignment.Qv());if(a instanceof T){var d=new E;d.add(a);b.moveParts(d,this.oppositePoint.copy().$d(c),!0)}else a.location=a.location.copy().$d(c).add(this.oppositePoint);b.Wc()}};
tg.prototype.computeResize=function(a,b,c,d,e,f){b.jc()&&(b=Ac);var g=this.adornedObject.naturalBounds,h=g.x,k=g.y,l=g.x+g.width,m=g.y+g.height,n=1;if(!f){n=g.width;var p=g.height;0>=n&&(n=1);0>=p&&(p=1);n=p/n}p=I.alloc();J.mq(a.x,a.y,h,k,e.width,e.height,p);a=g.copy();0>=b.x?0>=b.y?(a.x=Math.max(p.x,l-d.width),a.x=Math.min(a.x,l-c.width),a.width=Math.max(l-a.x,c.width),a.y=Math.max(p.y,m-d.height),a.y=Math.min(a.y,m-c.height),a.height=Math.max(m-a.y,c.height),f||(1<=a.height/a.width?(a.height=Math.max(Math.min(n*
a.width,d.height),c.height),a.width=a.height/n):(a.width=Math.max(Math.min(a.height/n,d.width),c.width),a.height=n*a.width),a.x=l-a.width,a.y=m-a.height)):1<=b.y?(a.x=Math.max(p.x,l-d.width),a.x=Math.min(a.x,l-c.width),a.width=Math.max(l-a.x,c.width),a.height=Math.max(Math.min(p.y-k,d.height),c.height),f||(1<=a.height/a.width?(a.height=Math.max(Math.min(n*a.width,d.height),c.height),a.width=a.height/n):(a.width=Math.max(Math.min(a.height/n,d.width),c.width),a.height=n*a.width),a.x=l-a.width)):(a.x=
Math.max(p.x,l-d.width),a.x=Math.min(a.x,l-c.width),a.width=l-a.x,f||(a.height=Math.max(Math.min(n*a.width,d.height),c.height),a.width=a.height/n,a.y=k+.5*(m-k-a.height))):1<=b.x?0>=b.y?(a.width=Math.max(Math.min(p.x-h,d.width),c.width),a.y=Math.max(p.y,m-d.height),a.y=Math.min(a.y,m-c.height),a.height=Math.max(m-a.y,c.height),f||(1<=a.height/a.width?(a.height=Math.max(Math.min(n*a.width,d.height),c.height),a.width=a.height/n):(a.width=Math.max(Math.min(a.height/n,d.width),c.width),a.height=n*a.width),
a.y=m-a.height)):1<=b.y?(a.width=Math.max(Math.min(p.x-h,d.width),c.width),a.height=Math.max(Math.min(p.y-k,d.height),c.height),f||(1<=a.height/a.width?(a.height=Math.max(Math.min(n*a.width,d.height),c.height),a.width=a.height/n):(a.width=Math.max(Math.min(a.height/n,d.width),c.width),a.height=n*a.width))):(a.width=Math.max(Math.min(p.x-h,d.width),c.width),f||(a.height=Math.max(Math.min(n*a.width,d.height),c.height),a.width=a.height/n,a.y=k+.5*(m-k-a.height))):0>=b.y?(a.y=Math.max(p.y,m-d.height),
a.y=Math.min(a.y,m-c.height),a.height=m-a.y,f||(a.width=Math.max(Math.min(a.height/n,d.width),c.width),a.height=n*a.width,a.x=h+.5*(l-h-a.width))):1<=b.y&&(a.height=Math.max(Math.min(p.y-k,d.height),c.height),f||(a.width=Math.max(Math.min(a.height/n,d.width),c.width),a.height=n*a.width,a.x=h+.5*(l-h-a.width)));I.free(p);return a};tg.prototype.computeReshape=function(){var a=xg;this.adornedObject instanceof Kf&&(a=yg(this.adornedObject));return!(a===zg||this.diagram.lastInput.shift)};
tg.prototype.computeMinSize=function(){var a=this.adornedObject.minSize.copy(),b=this.minSize;!isNaN(b.width)&&b.width>a.width&&(a.width=b.width);!isNaN(b.height)&&b.height>a.height&&(a.height=b.height);return a};tg.prototype.computeMaxSize=function(){var a=this.adornedObject.maxSize.copy(),b=this.maxSize;!isNaN(b.width)&&b.width<a.width&&(a.width=b.width);!isNaN(b.height)&&b.height<a.height&&(a.height=b.height);return a};
tg.prototype.computeCellSize=function(){var a=new M(NaN,NaN),b=this.adornedObject.part;null!==b&&(b=b.resizeCellSize,!isNaN(b.width)&&0<b.width&&(a.width=b.width),!isNaN(b.height)&&0<b.height&&(a.height=b.height));b=this.cellSize;isNaN(a.width)&&!isNaN(b.width)&&0<b.width&&(a.width=b.width);isNaN(a.height)&&!isNaN(b.height)&&0<b.height&&(a.height=b.height);b=this.diagram;(isNaN(a.width)||isNaN(a.height))&&b&&(b=b.grid,null!==b&&b.visible&&this.isGridSnapEnabled&&(b=b.gridCellSize,isNaN(a.width)&&
!isNaN(b.width)&&0<b.width&&(a.width=b.width),isNaN(a.height)&&!isNaN(b.height)&&0<b.height&&(a.height=b.height)));if(isNaN(a.width)||0===a.width||Infinity===a.width)a.width=1;if(isNaN(a.height)||0===a.height||Infinity===a.height)a.height=1;return a};
ma.Object.defineProperties(tg.prototype,{handleArchetype:{get:function(){return this.v},set:function(a){this.v=a}},handle:{get:function(){return this.l},set:function(a){if(null!==a&&!(a.part instanceof Ke))throw Error("new handle is not in an Adornment: "+a);this.l=a}},adornedObject:{get:function(){return this.be},set:function(a){if(null!==a&&a.part instanceof Ke)throw Error("new handle must not be in an Adornment: "+
a);this.be=a}},minSize:{get:function(){return this.eg},set:function(a){if(!this.eg.w(a)){var b=a.width;isNaN(b)&&(b=0);a=a.height;isNaN(a)&&(a=0);this.eg.h(b,a)}}},maxSize:{get:function(){return this.dg},set:function(a){if(!this.dg.w(a)){var b=a.width;isNaN(b)&&(b=Infinity);a=a.height;isNaN(a)&&(a=Infinity);this.dg.h(b,a)}}},cellSize:{get:function(){return this.Ng},set:function(a){this.Ng.w(a)||this.Ng.assign(a)}},
isGridSnapEnabled:{get:function(){return this.I},set:function(a){this.I=a}},oppositePoint:{get:function(){return this.os},set:function(a){this.os.w(a)||this.os.assign(a)}},originalDesiredSize:{get:function(){return this.ex}},originalLocation:{get:function(){return this.Xo}}});tg.className="ResizingTool";
La("resizingTool",function(){return this.findTool("Resizing")},function(a){this.Va("Resizing",a,this.mouseDownTools)});function Ag(){Be.call(this);this.name="Rotating";this.Ia=45;this.Ha=2;this.Xo=new I;this.be=null;var a=new Kf;a.figure="Ellipse";a.desiredSize=Ob;a.fill="lightblue";a.stroke="dodgerblue";a.strokeWidth=1;a.cursor="pointer";this.v=a;this.l=null;this.bx=0;this.Mu=new I(NaN,NaN);this.I=0;this.Y=50}la(Ag,Be);
Ag.prototype.updateAdornments=function(a){if(null!==a){if(a.Kh()){var b=a.rotateObject;if(b===a||b===a.path||b.isPanelMain)return}if(a.isSelected&&!this.diagram.isReadOnly&&(b=a.rotateObject,null!==b&&a.canRotate()&&a.actualBounds.u()&&a.isVisible()&&b.actualBounds.u()&&b.zf())){var c=a.fk(this.name);if(null===c||c.adornedObject!==b)c=this.makeAdornment(b);if(null!==c){c.angle=b.Xi();null===c.placeholder&&(c.location=this.computeAdornmentLocation(b));a.Ch(this.name,c);return}}a.Af(this.name)}};
Ag.prototype.makeAdornment=function(a){var b=a.part.rotateAdornmentTemplate;if(null===b){b=new Ke;b.type=X.Position;b.locationSpot=Ac;var c=this.handleArchetype;null!==c&&b.add(c.copy())}else if(wg(b),b=b.copy(),null===b)return null;b.adornedObject=a;return b};Ag.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram;return!a.isReadOnly&&a.allowRotate&&a.lastInput.left?null!==this.findToolHandleAt(a.firstInput.documentPoint,this.name):!1};
Ag.prototype.doActivate=function(){var a=this.diagram;if(null===this.adornedObject){null===this.handle&&(this.handle=this.findToolHandleAt(a.firstInput.documentPoint,this.name));if(null===this.handle)return;this.adornedObject=this.handle.part.adornedObject}null!==this.adornedObject&&(this.bx=this.adornedObject.angle,this.Mu=this.computeRotationPoint(this.adornedObject),this.Xo=this.adornedObject.part.location.copy(),a.isMouseCaptured=!0,a.delaysLayout=!0,this.ua(this.name),this.isActive=!0)};
Ag.prototype.computeRotationPoint=function(a){var b=a.part,c=b.locationObject;return b.rotationSpot.eb()?a.ga(b.rotationSpot):a===b||a===c?c.ga(b.locationSpot):a.ga(Ac)};
Ag.prototype.computeAdornmentLocation=function(a){var b=this.rotationPoint;b.u()||(b=this.computeRotationPoint(a));b=a.ot(b);var c=this.handleAngle;0>c?c+=360:360<=c&&(c-=360);c=Math.round(45*Math.round(c/45));var d=this.handleDistance;0===c?b.x=a.naturalBounds.width+d:45===c?(b.x=a.naturalBounds.width+d,b.y=a.naturalBounds.height+d):90===c?b.y=a.naturalBounds.height+d:135===c?(b.x=-d,b.y=a.naturalBounds.height+d):180===c?b.x=-d:225===c?(b.x=-d,b.y=-d):270===c?b.y=-d:315===c&&(b.x=a.naturalBounds.width+
d,b.y=-d);return a.ga(b)};Ag.prototype.doDeactivate=function(){var a=this.diagram;this.Hg();this.be=this.handle=null;this.Mu=new I(NaN,NaN);this.isActive=a.isMouseCaptured=!1};Ag.prototype.doCancel=function(){this.diagram.delaysLayout=!1;this.rotate(this.originalAngle);this.stopTool()};Ag.prototype.doMouseMove=function(){var a=this.diagram;this.isActive&&(a=this.computeRotate(a.lastInput.documentPoint),this.rotate(a))};
Ag.prototype.doMouseUp=function(){var a=this.diagram;if(this.isActive){a.delaysLayout=!1;var b=this.computeRotate(a.lastInput.documentPoint);this.rotate(b);a.Na();this.transactionResult=this.name;a.R("PartRotated",this.adornedObject,this.originalAngle)}this.stopTool()};
Ag.prototype.rotate=function(a){var b=this.adornedObject;if(null!==b){b.angle=a;b=b.part;b.yb();var c=b.locationObject,d=b.rotateObject;if(c===d||c.Dg(d))c=this.Xo.copy(),b.location=c.$d(this.rotationPoint).rotate(a-this.originalAngle).add(this.rotationPoint);this.diagram.Wc()}};
Ag.prototype.computeRotate=function(a){a=this.rotationPoint.Sa(a)-this.handleAngle;var b=this.adornedObject.panel;null!==b&&(a-=b.Xi());360<=a?a-=360:0>a&&(a+=360);b=Math.min(Math.abs(this.snapAngleMultiple),180);var c=Math.min(Math.abs(this.snapAngleEpsilon),b/2);!this.diagram.lastInput.shift&&0<b&&0<c&&(a%b<c?a=Math.floor(a/b)*b:a%b>b-c&&(a=(Math.floor(a/b)+1)*b));360<=a?a-=360:0>a&&(a+=360);return a};
ma.Object.defineProperties(Ag.prototype,{handleArchetype:{get:function(){return this.v},set:function(a){this.v=a}},handle:{get:function(){return this.l},set:function(a){if(null!==a&&!(a.part instanceof Ke))throw Error("new handle is not in an Adornment: "+a);this.l=a}},adornedObject:{get:function(){return this.be},set:function(a){if(null!==a&&a.part instanceof Ke)throw Error("new handle must not be in an Adornment: "+
a);this.be=a}},snapAngleMultiple:{get:function(){return this.Ia},set:function(a){this.Ia=a}},snapAngleEpsilon:{get:function(){return this.Ha},set:function(a){this.Ha=a}},originalAngle:{get:function(){return this.bx}},rotationPoint:{get:function(){return this.Mu}},handleAngle:{get:function(){return this.I},set:function(a){this.I=a}},handleDistance:{
get:function(){return this.Y},set:function(a){this.Y=a}}});Ag.className="RotatingTool";La("rotatingTool",function(){return this.findTool("Rotating")},function(a){this.Va("Rotating",a,this.mouseDownTools)});function Bg(){Be.call(this);this.name="ClickSelecting"}la(Bg,Be);Bg.prototype.canStart=function(){return!this.isEnabled||this.isBeyondDragSize()?!1:!0};
Bg.prototype.doMouseUp=function(){this.isActive&&(this.standardMouseSelect(),!this.standardMouseClick()&&this.diagram.lastInput.isTouchEvent&&this.diagram.toolManager.doToolTip());this.stopTool()};Bg.className="ClickSelectingTool";function Cg(){Be.call(this);this.name="Action";this.Bk=null}la(Cg,Be);
Cg.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram,b=a.lastInput,c=a.Ub(b.documentPoint,function(a){for(;null!==a.panel&&!a.isActionable;)a=a.panel;return a});if(null!==c){if(!c.isActionable)return!1;this.Bk=c;a.mj=a.Ub(b.documentPoint,null,null);return!0}return!1};Cg.prototype.doMouseDown=function(){if(this.isActive){var a=this.diagram.lastInput,b=this.Bk;null!==b&&(a.targetObject=b,null!==b.actionDown&&b.actionDown(a,b))}else this.canStart()&&this.doActivate()};
Cg.prototype.doMouseMove=function(){if(this.isActive){var a=this.diagram.lastInput,b=this.Bk;null!==b&&(a.targetObject=b,null!==b.actionMove&&b.actionMove(a,b))}};Cg.prototype.doMouseUp=function(){if(this.isActive){var a=this.diagram.lastInput,b=this.Bk;if(null===b)return;a.targetObject=b;null!==b.actionUp&&b.actionUp(a,b);this.standardMouseClick(function(a){for(;null!==a.panel&&(!a.isActionable||a!==b);)a=a.panel;return a},function(a){return a===b})}this.stopTool()};
Cg.prototype.doCancel=function(){var a=this.diagram.lastInput,b=this.Bk;null!==b&&(a.targetObject=b,null!==b.actionCancel&&b.actionCancel(a,b),this.stopTool())};Cg.prototype.doStop=function(){this.Bk=null};Cg.className="ActionTool";function Dg(){Be.call(this);this.name="ClickCreating";this.ij=null;this.v=!0;this.l=!1;this.Uw=new I(0,0)}la(Dg,Be);
Dg.prototype.canStart=function(){if(!this.isEnabled||null===this.archetypeNodeData)return!1;var a=this.diagram;if(a.isReadOnly||a.isModelReadOnly||!a.allowInsert||!a.lastInput.left||this.isBeyondDragSize())return!1;if(this.isDoubleClick){if(1===a.lastInput.clickCount&&(this.Uw=a.lastInput.viewPoint.copy()),2!==a.lastInput.clickCount||this.isBeyondDragSize(this.Uw))return!1}else if(1!==a.lastInput.clickCount)return!1;return a.currentTool!==this&&null!==a.jm(a.lastInput.documentPoint,!0)?!1:!0};
Dg.prototype.doMouseUp=function(){var a=this.diagram;this.isActive&&this.insertPart(a.lastInput.documentPoint);this.stopTool()};
Dg.prototype.insertPart=function(a){var b=this.diagram,c=this.archetypeNodeData;if(null===c)return null;var d=null;try{b.R("ChangingSelection",b.selection);this.ua(this.name);if(c instanceof U)c.Wb()&&(wg(c),d=c.copy(),null!==d&&b.add(d));else if(null!==c){var e=b.model.copyNodeData(c);za(e)&&(b.model.qf(e),d=b.wc(e))}if(null!==d){var f=I.allocAt(a.x,a.y);this.isGridSnapEnabled&&Eg(this.diagram,d,a,f);d.location=f;b.allowSelect&&(b.clearSelection(!0),d.isSelected=!0);I.free(f)}b.Na();this.transactionResult=
this.name;b.R("PartCreated",d)}finally{this.Hg(),b.R("ChangedSelection",b.selection)}return d};ma.Object.defineProperties(Dg.prototype,{archetypeNodeData:{get:function(){return this.ij},set:function(a){this.ij=a}},isDoubleClick:{get:function(){return this.v},set:function(a){this.v=a}},isGridSnapEnabled:{get:function(){return this.l},set:function(a){this.l=a}}});Dg.className="ClickCreatingTool";
function Fg(){Be.call(this);this.name="DragSelecting";this.Vk=175;this.v=!1;var a=new U;a.layerName="Tool";a.selectable=!1;var b=new Kf;b.name="SHAPE";b.figure="Rectangle";b.fill=null;b.stroke="magenta";a.add(b);this.l=a}la(Fg,Be);
Fg.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram;if(!a.allowSelect)return!1;var b=a.lastInput;return!b.left||a.currentTool!==this&&(!this.isBeyondDragSize()||b.timestamp-a.firstInput.timestamp<this.delay||null!==a.jm(b.documentPoint,!0))?!1:!0};Fg.prototype.doActivate=function(){var a=this.diagram;this.isActive=!0;a.isMouseCaptured=!0;a.skipsUndoManager=!0;a.add(this.box);this.doMouseMove()};
Fg.prototype.doDeactivate=function(){var a=this.diagram;a.Cf();a.remove(this.box);a.skipsUndoManager=!1;this.isActive=a.isMouseCaptured=!1};Fg.prototype.doMouseMove=function(){var a=this.diagram;if(this.isActive&&null!==this.box){var b=this.computeBoxBounds(),c=this.box.Xa("SHAPE");null===c&&(c=this.box.zb());var d=M.alloc().h(b.width,b.height);b=I.allocAt(b.x,b.y);c.desiredSize=d;this.box.position=b;M.free(d);I.free(b);(a.allowHorizontalScroll||a.allowVerticalScroll)&&a.gt(a.lastInput.viewPoint)}};
Fg.prototype.doMouseUp=function(){if(this.isActive){var a=this.diagram;a.remove(this.box);try{a.currentCursor="wait",a.R("ChangingSelection",a.selection),this.selectInRect(this.computeBoxBounds()),a.R("ChangedSelection",a.selection)}finally{a.currentCursor=""}}this.stopTool()};Fg.prototype.computeBoxBounds=function(){var a=this.diagram;return new N(a.firstInput.documentPoint,a.lastInput.documentPoint)};
Fg.prototype.selectInRect=function(a){var b=this.diagram,c=b.lastInput;a=b.Mx(a,this.isPartialInclusion);if(Wa?c.meta:c.control)if(c.shift)for(a=a.iterator;a.next();)b=a.value,b.isSelected&&(b.isSelected=!1);else for(a=a.iterator;a.next();)b=a.value,b.isSelected=!b.isSelected;else if(c.shift)for(a=a.iterator;a.next();)b=a.value,b.isSelected||(b.isSelected=!0);else{c=new E;for(b=b.selection.iterator;b.next();){var d=b.value;a.contains(d)||c.add(d)}for(b=c.iterator;b.next();)b.value.isSelected=!1;for(a=
a.iterator;a.next();)b=a.value,b.isSelected||(b.isSelected=!0)}};ma.Object.defineProperties(Fg.prototype,{delay:{get:function(){return this.Vk},set:function(a){this.Vk=a}},isPartialInclusion:{get:function(){return this.v},set:function(a){this.v=a}},box:{get:function(){return this.l},set:function(a){this.l=a}}});Fg.className="DragSelectingTool";
function Gg(){Be.call(this);this.name="Panning";this.Ju=new I;this.Dy=new I;this.Mg=!1;var a=this;this.kx=function(){var b=a.diagram;null!==b&&b.removeEventListener(x.document,"scroll",a.kx,!1);a.stopTool()}}la(Gg,Be);Gg.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram;return!a.allowHorizontalScroll&&!a.allowVerticalScroll||!a.lastInput.left||a.currentTool!==this&&!this.isBeyondDragSize()?!1:!0};
Gg.prototype.doActivate=function(){var a=this.diagram;this.Mg?(a.lastInput.bubbles=!0,a.addEventListener(x.document,"scroll",this.kx,!1)):(a.currentCursor="move",a.isMouseCaptured=!0,this.Ju.assign(a.position));this.isActive=!0};Gg.prototype.doDeactivate=function(){var a=this.diagram;a.currentCursor="";this.isActive=a.isMouseCaptured=!1};Gg.prototype.doCancel=function(){var a=this.diagram;a.position=this.Ju;a.isMouseCaptured=!1;this.stopTool()};Gg.prototype.doMouseMove=function(){this.move()};
Gg.prototype.doMouseUp=function(){this.move();this.stopTool()};Gg.prototype.move=function(){var a=this.diagram;if(this.isActive&&a)if(this.Mg)a.lastInput.bubbles=!0;else{var b=a.position,c=a.firstInput.documentPoint,d=a.lastInput.documentPoint,e=b.x+c.x-d.x;c=b.y+c.y-d.y;a.allowHorizontalScroll||(e=b.x);a.allowVerticalScroll||(c=b.y);a.position=this.Dy.h(e,c)}};
ma.Object.defineProperties(Gg.prototype,{bubbles:{get:function(){return this.Mg},set:function(a){this.Mg=a}},originalPosition:{get:function(){return this.Ju}}});Gg.className="PanningTool";La("clickCreatingTool",function(){return this.findTool("ClickCreating")},function(a){this.Va("ClickCreating",a,this.mouseUpTools)});La("clickSelectingTool",function(){return this.findTool("ClickSelecting")},function(a){this.Va("ClickSelecting",a,this.mouseUpTools)});
La("panningTool",function(){return this.findTool("Panning")},function(a){this.Va("Panning",a,this.mouseMoveTools)});La("dragSelectingTool",function(){return this.findTool("DragSelecting")},function(a){this.Va("DragSelecting",a,this.mouseMoveTools)});La("actionTool",function(){return this.findTool("Action")},function(a){this.Va("Action",a,this.mouseDownTools)});function Pe(){this.Y=this.I=this.l=this.v=null}
ma.Object.defineProperties(Pe.prototype,{mainElement:{get:function(){return this.I},set:function(a){this.I=a}},show:{get:function(){return this.v},set:function(a){this.v!==a&&(this.v=a)}},hide:{get:function(){return this.l},set:function(a){this.l!==a&&(this.l=a)}},valueFunction:{get:function(){return this.Y},set:function(a){this.Y=a}}});Pe.className="HTMLInfo";
function Hg(a,b,c){this.text=a;this.Ax=b;this.visible=c}Hg.className="ContextMenuButtonInfo";function Ig(){Be.call(this);this.name="ContextMenu";this.v=this.du=this.l=null;this.Zw=new I;this.eu=null;this.yu=!1;var a=this;this.Xu=function(){a.stopTool()}}la(Ig,Be);
function Jg(a){var b=new Pe;b.show=function(a,b,c){c.showDefaultContextMenu()};b.hide=function(a,b){b.hideDefaultContextMenu()};Kg=b;a.Xu=function(){a.stopTool()};b=ta("div");var c=ta("div");b.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";c.style.cssText="z-index:10001;position: fixed;display: none;top: 0;left: 0;width: 100%;height: 100%;background-color: black;opacity: 0.8;";
var d=ta("style");x.document.getElementsByTagName("head")[0].appendChild(d);d.sheet.insertRule(".goCXul { list-style: none; }",0);d.sheet.insertRule(".goCXli {font:700 1.5em Helvetica, Arial, sans-serif;position: relative;min-width: 60px; }",0);d.sheet.insertRule(".goCXa {color: #444;display: inline-block;padding: 4px;text-decoration: none;margin: 2px;border: 1px solid gray;border-radius: 10px; }",0);d=a.diagram;null!==d&&(d.addEventListener(b,"contextmenu",Lg,!1),d.addEventListener(b,"selectstart",
Lg,!1),d.addEventListener(c,"contextmenu",Lg,!1));b.className="goCXforeground";c.className="goCXbackground";x.document.body&&(x.document.body.appendChild(b),x.document.body.appendChild(c));Mg=b;Ng=c;Og=!0}function Lg(a){a.preventDefault();return!1}Ig.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram;return this.isBeyondDragSize()||!a.lastInput.right?!1:a.lastInput.isTouchEvent&&null!==this.defaultTouchContextMenu||null!==this.findObjectWithContextMenu()?!0:!1};
Ig.prototype.doStart=function(){this.Zw.set(this.diagram.firstInput.documentPoint)};Ig.prototype.doStop=function(){this.hideContextMenu();this.currentObject=null};
Ig.prototype.findObjectWithContextMenu=function(a){void 0===a&&(a=null);var b=this.diagram,c=b.lastInput,d=null;a instanceof R||(a instanceof Y?d=a:d=b.Ub(c.documentPoint,null,function(a){return!a.layer.isTemporary}));if(null!==d){for(a=d;null!==a;){if(null!==a.contextMenu)return a;a=a.panel}if(b.lastInput.isTouchEvent&&this.defaultTouchContextMenu)return d.part}else if(null!==b.contextMenu)return b;return null};Ig.prototype.doActivate=function(){};
Ig.prototype.doMouseDown=function(){Be.prototype.doMouseDown.call(this);if(this.isActive&&this.currentContextMenu instanceof Ke){var a=this.diagram.toolManager.findTool("Action");null!==a&&a.canStart()&&(a.doActivate(),a.doMouseDown(),a.doDeactivate())}this.diagram.toolManager.mouseDownTools.contains(this)&&Pg(this)};
Ig.prototype.doMouseUp=function(){if(this.isActive&&this.currentContextMenu instanceof Ke){var a=this.diagram.toolManager.findTool("Action");null!==a&&a.canStart()&&(a.doActivate(),a.doCancel(),a.doDeactivate())}Pg(this)};
function Pg(a){var b=a.diagram;if(a.isActive){var c=a.currentContextMenu;if(null!==c){if(!(c instanceof Pe)){var d=b.Ub(b.lastInput.documentPoint,null,null);null!==d&&d.Dg(c)&&a.standardMouseClick(null,null)}a.stopTool();a.canStart()&&(b.currentTool=a,a.doMouseUp())}}else a.canStart()&&(Qg(a,!0),a.isActive||a.stopTool())}
function Qg(a,b,c){void 0===c&&(c=null);if(!a.yu&&(a.yu=!0,b&&a.standardMouseSelect(),b=a.standardMouseClick(),a.yu=!1,!b))if(a.isActive=!0,b=Kg,null===c&&(c=a.findObjectWithContextMenu()),null!==c){var d=c.contextMenu;null!==d?(a.currentObject=c instanceof Y?c:null,a.showContextMenu(d,a.currentObject)):null!==b&&a.showContextMenu(b,a.currentObject)}else null!==b&&a.showContextMenu(b,null)}
Ig.prototype.doMouseMove=function(){var a=this.diagram.toolManager.findTool("Action");null!==a&&a.doMouseMove();this.isActive&&this.diagram.toolManager.doMouseMove()};
Ig.prototype.showContextMenu=function(a,b){var c=this.diagram;a!==this.currentContextMenu&&this.hideContextMenu();if(a instanceof Ke){a.layerName="Tool";a.selectable=!1;a.scale=1/c.scale;a.category=this.name;null!==a.placeholder&&(a.placeholder.scale=c.scale);var d=a.diagram;null!==d&&d!==c&&d.remove(a);c.add(a);null!==b?a.adornedObject=b:a.data=c.model;a.yb();this.positionContextMenu(a,b)}else a instanceof Pe&&a.show(b,c,this);this.currentContextMenu=a};
Ig.prototype.positionContextMenu=function(a){if(null===a.placeholder){var b=this.diagram,c=b.lastInput.documentPoint.copy(),d=a.measuredBounds,e=b.viewportBounds;b.lastInput.isTouchEvent&&(c.x-=d.width);c.x+d.width>e.right&&(c.x-=d.width+5/b.scale);c.x<e.x&&(c.x=e.x);c.y+d.height>e.bottom&&(c.y-=d.height+5/b.scale);c.y<e.y&&(c.y=e.y);a.position=c}};
Ig.prototype.hideContextMenu=function(){var a=this.diagram,b=this.currentContextMenu;null!==b&&(b instanceof Ke?(a.remove(b),null!==this.du&&this.du.Af(b.category),b.data=null,b.adornedObject=null):b instanceof Pe&&(null!==b.hide?b.hide(a,this):null!==b.mainElement&&(b.mainElement.style.display="none")),this.currentContextMenu=null,this.standardMouseOver())};
function Rg(a){var b=new E;b.add(new Hg("Copy",function(a){a.commandHandler.copySelection()},function(a){return a.commandHandler.canCopySelection()}));b.add(new Hg("Cut",function(a){a.commandHandler.cutSelection()},function(a){return a.commandHandler.canCutSelection()}));b.add(new Hg("Delete",function(a){a.commandHandler.deleteSelection()},function(a){return a.commandHandler.canDeleteSelection()}));b.add(new Hg("Paste",function(b){b.commandHandler.pasteSelection(a.mouseDownPoint)},function(b){return b.commandHandler.canPasteSelection(a.mouseDownPoint)}));
b.add(new Hg("Select All",function(a){a.commandHandler.selectAll()},function(a){return a.commandHandler.canSelectAll()}));b.add(new Hg("Undo",function(a){a.commandHandler.undo()},function(a){return a.commandHandler.canUndo()}));b.add(new Hg("Redo",function(a){a.commandHandler.redo()},function(a){return a.commandHandler.canRedo()}));b.add(new Hg("Scroll To Part",function(a){a.commandHandler.scrollToPart()},function(a){return a.commandHandler.canScrollToPart()}));b.add(new Hg("Zoom To Fit",function(a){a.commandHandler.zoomToFit()},
function(a){return a.commandHandler.canZoomToFit()}));b.add(new Hg("Reset Zoom",function(a){a.commandHandler.resetZoom()},function(a){return a.commandHandler.canResetZoom()}));b.add(new Hg("Group Selection",function(a){a.commandHandler.groupSelection()},function(a){return a.commandHandler.canGroupSelection()}));b.add(new Hg("Ungroup Selection",function(a){a.commandHandler.ungroupSelection()},function(a){return a.commandHandler.canUngroupSelection()}));b.add(new Hg("Edit Text",function(a){a.commandHandler.editTextBlock()},
function(a){return a.commandHandler.canEditTextBlock()}));return b}
Ig.prototype.showDefaultContextMenu=function(){var a=this.diagram;null===this.eu&&(this.eu=Rg(this));Mg.innerHTML="";Ng.addEventListener("click",this.Xu,!1);var b=this,c=ta("ul");c.className="goCXul";Mg.appendChild(c);c.innerHTML="";for(var d=this.eu.iterator;d.next();){var e=d.value,f=e.visible;if("function"===typeof e.Ax&&("function"!==typeof f||f(a))){f=ta("li");f.className="goCXli";var g=ta("a");g.className="goCXa";g.href="#";g.xy=e.Ax;g.addEventListener("click",function(c){this.xy(a);b.stopTool();
c.preventDefault();return!1},!1);g.textContent=e.text;f.appendChild(g);c.appendChild(f)}}Mg.style.display="block";Ng.style.display="block"};Ig.prototype.hideDefaultContextMenu=function(){if(null!==this.currentContextMenu&&this.currentContextMenu===Kg){Mg.style.display="none";Ng.style.display="none";var a=this.diagram;null!==a&&a.removeEventListener(Ng,"click",this.Xu,!1);this.currentContextMenu=null}};
ma.Object.defineProperties(Ig.prototype,{currentContextMenu:{get:function(){return this.l},set:function(a){this.l=a;this.du=a instanceof Ke?a.adornedPart:null}},defaultTouchContextMenu:{get:function(){!1===Og&&null===Kg&&Sg&&Jg(this);return Kg},set:function(a){null===a&&(Og=!0);Kg=a}},currentObject:{get:function(){return this.v},set:function(a){this.v=a}},mouseDownPoint:{get:function(){return this.Zw}}});
var Kg=null,Og=!1,Ng=null,Mg=null;Ig.className="ContextMenuTool";La("contextMenuTool",function(){return this.findTool("ContextMenu")},function(a){this.Va("ContextMenu",a,this.mouseUpTools)});function Tg(){Be.call(this);this.name="TextEditing";this.vh=new Ug;this.Ia=null;this.Ha=Vg;this.Ji=null;this.ia=Wg;this.I=1;this.Y=!0;this.v=null;this.l=new Pe;this.iu=null;Xg(this,this.l)}la(Tg,Be);
function Xg(a,b){if(Sg){var c=ta("textarea");a.iu=c;c.addEventListener("input",function(){if(null!==a.textBlock){var b=a.Wx(this.value);this.style.width=20+b.measuredBounds.width*this.yA+"px";this.rows=b.lineCount}},!1);c.addEventListener("keydown",function(b){if(null!==a.textBlock){var c=b.which;13===c?(!1===a.textBlock.isMultiline&&b.preventDefault(),a.acceptText(Yg)):9===c?(a.acceptText(Zg),b.preventDefault()):27===c&&(a.doCancel(),null!==a.diagram&&a.diagram.doFocus())}},!1);c.addEventListener("focus",
function(){if(null!==a.currentTextEditor&&a.state!==Wg){var b=a.iu;a.ia===$g&&(a.ia=ah);"function"===typeof b.select&&a.selectsTextOnActivate&&(b.select(),b.setSelectionRange(0,9999))}},!1);c.addEventListener("blur",function(){if(null!==a.currentTextEditor&&a.state!==Wg){var b=a.iu;"function"===typeof b.focus&&b.focus();"function"===typeof b.select&&a.selectsTextOnActivate&&(b.select(),b.setSelectionRange(0,9999))}},!1);b.valueFunction=function(){return c.value};b.mainElement=c;b.show=function(a,
b,f){if(a instanceof Ug&&f instanceof Tg)if(f.state===bh)c.style.border="3px solid red",c.focus();else{var d=a.ga(Ac),e=b.position,k=b.scale,l=a.vf()*k;l<f.minimumEditorScale&&(l=f.minimumEditorScale);var m=a.naturalBounds.width*l+6,n=a.naturalBounds.height*l+2,p=(d.x-e.x)*k;d=(d.y-e.y)*k;c.value=a.text;b.div.style.font=a.font;c.style.position="absolute";c.style.zIndex="100";c.style.font="inherit";c.style.fontSize=100*l+"%";c.style.lineHeight="normal";c.style.width=m+"px";c.style.left=(p-m/2|0)-1+
"px";c.style.top=(d-n/2|0)-1+"px";c.style.textAlign=a.textAlign;c.style.margin="0";c.style.padding="1px";c.style.border="0";c.style.outline="none";c.style.whiteSpace="pre-wrap";c.style.overflow="hidden";c.rows=a.lineCount;c.yA=l;c.className="goTXarea";b.div.appendChild(c);c.focus();f.selectsTextOnActivate&&(c.select(),c.setSelectionRange(0,9999))}};b.hide=function(a){a.div.removeChild(c)}}}
Tg.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram;if(null===a||a.isReadOnly||ch&&ch!==this&&(ch.acceptText(dh),ch&&ch!==this)||!a.lastInput.left||this.isBeyondDragSize())return!1;var b=a.Ub(a.lastInput.documentPoint);if(!(null!==b&&b instanceof Ug&&b.editable&&b.part.canEdit()))return!1;b=b.part;return null===b||this.starting===Vg&&!b.isSelected||this.starting===eh&&2>a.lastInput.clickCount?!1:!0};Tg.prototype.doStart=function(){ch=this;null!==this.textBlock&&this.doActivate()};
Tg.prototype.doActivate=function(){if(!this.isActive){var a=this.diagram;if(null!==a){var b=this.textBlock;null===b&&(b=a.Ub(a.lastInput.documentPoint));if(null!==b&&b instanceof Ug&&(this.textBlock=b,null!==b.part)){this.isActive=!0;this.ia=$g;var c=this.defaultTextEditor;null!==b.textEditor&&(c=b.textEditor);this.vh=this.textBlock.copy();var d=new N(this.textBlock.ga(vc),this.textBlock.ga(Gc));a.dw(d);c.show(b,a,this);this.currentTextEditor=c}}}};Tg.prototype.doCancel=function(){this.stopTool()};
Tg.prototype.doMouseUp=function(){this.canStart()&&this.doActivate()};Tg.prototype.doMouseDown=function(){this.isActive&&this.acceptText(dh)};Tg.prototype.acceptText=function(a){switch(a){case dh:if(this.ia===fh)this.currentTextEditor instanceof HTMLElement&&this.currentTextEditor.focus();else if(this.ia===$g||this.ia===bh||this.ia===ah)this.ia=gh,hh(this);break;case ih:case Yg:case Zg:if(Yg!==a||!0!==this.textBlock.isMultiline)if(this.ia===$g||this.ia===bh||this.ia===ah)this.ia=gh,hh(this)}};
function hh(a){var b=a.textBlock,c=a.diagram,d=a.currentTextEditor;if(null!==b&&null!==d){var e=b.text,f="";null!==d.valueFunction&&(f=d.valueFunction());if(a.isValidText(b,e,f))a.ua(a.name),a.ia=fh,a.transactionResult=a.name,b.text=f,d=a.textBlock,null!==d.textEdited&&d.textEdited(d,e,f),null!==c&&c.R("TextEdited",b,e),a.Hg(),a.stopTool(),null!==c&&c.doFocus();else{a.ia=bh;var g=a.textBlock;null!==g.errorFunction&&g.errorFunction(a,e,f);d.show(b,c,a)}}}
Tg.prototype.doDeactivate=function(){var a=this.diagram;null!==a&&(this.ia=Wg,this.textBlock=null,null!==this.currentTextEditor&&this.currentTextEditor.hide(a,this),this.isActive=!1)};Tg.prototype.doStop=function(){ch=null};Tg.prototype.isValidText=function(a,b,c){var d=this.textValidation;if(null!==d&&!d(a,b,c))return!1;d=a.textValidation;return null===d||d(a,b,c)?!0:!1};Tg.prototype.Wx=function(a){var b=this.vh;b.text=a;b.measure(this.textBlock.ti,Infinity);return b};
ma.Object.defineProperties(Tg.prototype,{textBlock:{get:function(){return this.Ia},set:function(a){this.Ia=a}},currentTextEditor:{get:function(){return this.v},set:function(a){this.v=a}},defaultTextEditor:{get:function(){return this.l},set:function(a){this.l=a}},starting:{get:function(){return this.Ha},set:function(a){this.Ha=a}},textValidation:{get:function(){return this.Ji},
set:function(a){this.Ji=a}},minimumEditorScale:{get:function(){return this.I},set:function(a){this.I=a}},selectsTextOnActivate:{get:function(){return this.Y},set:function(a){this.Y=a}},state:{get:function(){return this.ia},set:function(a){this.ia!==a&&(this.ia=a)}}});Tg.prototype.measureTemporaryTextBlock=Tg.prototype.Wx;
var ih=new D(Tg,"LostFocus",0),dh=new D(Tg,"MouseDown",1),Zg=new D(Tg,"Tab",2),Yg=new D(Tg,"Enter",3),vh=new D(Tg,"SingleClick",0),Vg=new D(Tg,"SingleClickSelected",1),eh=new D(Tg,"DoubleClick",2),Wg=new D(Tg,"StateNone",0),$g=new D(Tg,"StateActive",1),ah=new D(Tg,"StateEditing",2),gh=new D(Tg,"StateValidating",3),bh=new D(Tg,"StateInvalid",4),fh=new D(Tg,"StateValidated",5),ch=null;Tg.className="TextEditingTool";Tg.LostFocus=ih;Tg.MouseDown=dh;Tg.Tab=Zg;Tg.Enter=Yg;Tg.SingleClick=vh;
Tg.SingleClickSelected=Vg;Tg.DoubleClick=eh;Tg.StateNone=Wg;Tg.StateActive=$g;Tg.StateEditing=ah;Tg.StateValidating=gh;Tg.StateInvalid=bh;Tg.StateValidated=fh;La("textEditingTool",function(){return this.findTool("TextEditing")},function(a){this.Va("TextEditing",a,this.mouseUpTools)});
function wh(){xh||(yh(),xh=!0);this.B=Ce;this.gl=this.$e=this.qc=this.Tr=this.hc=!1;this.px=!0;this.hl=zh;this.bn=!1;this.oi=this.Mc=!0;this.Ug=600;this.Mw=this.ox=!1;this.Le=new F;this.Bd=new Ah;this.Bd.Jc=this;this.Ck=new F;this.Uu=new F;this.Ss=new F}wh.prototype.Zd=function(a){this.B=a};wh.prototype.canStart=function(){return!0};function Bh(a,b){Ch(a,b)&&(a.$e=!0)}function Ch(a,b){if(!a.Mc||!a.canStart(b))return!1;a.Le.add(b);a.defaultAnimation.isAnimating&&a.Xc();return a.qc=!0}
function Dh(a){if(a.Mc&&a.qc){var b=a.Bd,c=a.B,d=a.Le.contains("Model");d&&(a.gl=!0,a.hl===zh?(b.isViewportUnconstrained=!0,b.pc.clear(),b.add(c,"position",c.position.copy().offset(0,-200),c.position),b.add(c,"opacity",0,1)):a.hl===Eh&&b.pc.clear(),c.R("InitialAnimationStarting",a));d&&!a.oi||0===b.pc.count?(a.Le.clear(),a.qc=!1,a.$e=!1,b.pc.clear(),Fh(b),a.gl=!1,c.M()):(a.Le.clear(),c.xe=!1,x.requestAnimationFrame(function(){!1===a.qc||b.hc||(c.Ce("temporaryPixelRatio")&&Ve(c),Gh(c),a.qc=!1,a.$e=
!1,a.px=d&&a.hl===Hh&&c.Ou.w(c.ma)?!0:!1,b.start(),Ih(a),c.Na(),Jh(b,0),Hf(c,!0),Kh(a),c.R("AnimationStarting",a))}))}}function Lh(a,b,c,d){b instanceof S&&(null!==b.fromNode||null!==b.toNode)||a.Bd.add(b,"position",c,d,!1)}t=wh.prototype;t.Dt=function(a){return this.Bd.Dt(a)};t.Hv=function(a){return this.Bd.Hv(a)};
function Mh(a,b){function c(){0<e.Ss.count&&(d.addAll(e.Ss),e.Ss.clear(),e.hc=!0);if(!1!==e.hc&&0!==d.count){e.Uu.addAll(d);for(var a=e.Uu.iterator;a.next();){var b=a.value;if(!1!==b.hc){a:if(0<b.Xl.count)var h=!0;else{for(h=b.pc.iterator;h.next();){var k=h.key;if(k instanceof Y&&null!==k.diagram||k instanceof R){h=!0;break a}}h=!1}h?Nh(b,!1):b.pl=!0}}e.Uu.clear();Ih(e);Hf(e.B);Kh(e);x.requestAnimationFrame(c)}}var d=a.Ck,e=a;a.hc?a.Ss.add(b):(a.hc=!0,d.add(b),x.requestAnimationFrame(function(){c()}))}
function Oh(a){for(a=a.Ck.iterator;a.next();)a.value.pl=!1}function Ih(a){if(!a.Tr){var b=a.B;a.ox=b.skipsUndoManager;a.Mw=b.skipsModelSourceBindings;b.skipsUndoManager=!0;b.skipsModelSourceBindings=!0;a.Tr=!0}}function Kh(a){var b=a.B;b.skipsUndoManager=a.ox;b.skipsModelSourceBindings=a.Mw;a.Tr=!1}
t.Xc=function(a){var b=this.Bd;!0===this.qc&&(this.gl=this.$e=this.qc=!1,this.Le.clear(),0<b.pc.count&&this.B.Pb());if(this.hc&&this.Mc){if(b.gm(!0),b.pc.clear(),Fh(b),!0===a)for(a=this.Ck.na(),b=0;b<a.length;b++)a[b].gm(!0)}else b.pc.clear(),Fh(b)};t.gm=function(a){a===this.defaultAnimation&&this.defaultAnimation.pc.clear();this.Ck.remove(a);0===this.Ck.count&&(this.hc=!1,this.B.Pb());a===this.defaultAnimation&&(this.defaultAnimation.pc.clear(),this.B.R("AnimationFinished",this))};
t.Vj=function(a,b){this.$e&&(this.Le.contains("Expand Tree")||this.Le.contains("Expand SubGraph"))&&this.Bd.Vj(a,b)};t.Tj=function(a,b){this.$e&&(this.Le.contains("Collapse Tree")||this.Le.contains("Collapse SubGraph"))&&(this.Bd.Tj(a,b),Ph(this.Bd,b,"position",b.position,b.position))};function Qh(a,b,c){a.$e&&!b.w(c)&&(a.B.kk||(b=c.copy()),Ph(a.Bd,a.B,"position",b,c))}
function Rh(a,b,c,d,e){null===a&&(a="rgba(0,0,0,0)");null===b&&(b="rgba(0,0,0,0)");Sh(a);Th();var f=Uh.l,g=Uh.I,h=Uh.v;a=Uh.Y;Sh(b);Th();var k=Uh.I,l=Uh.v;b=Uh.Y;f=e(c,f,Uh.l-f,d);g=e(c,g,k-g,d);h=e(c,h,l-h,d);c=e(c,a,b-a,d);return"hsla("+f+", "+g+"%, "+h+"%, "+c+")"}
function yh(){var a=new G;a.add("position:diagram",function(a,c,d,e,f,g){a.position=new I(e(f,c.x,d.x-c.x,g),e(f,c.y,d.y-c.y,g))});a.add("position",function(a,c,d,e,f,g){f<g?a.Kq(e(f,c.x,d.x-c.x,g),e(f,c.y,d.y-c.y,g),!1):a.position=new I(e(f,c.x,d.x-c.x,g),e(f,c.y,d.y-c.y,g))});a.add("location",function(a,c,d,e,f,g){f<g?a.Kq(e(f,c.x,d.x-c.x,g),e(f,c.y,d.y-c.y,g),!0):a.location=new I(e(f,c.x,d.x-c.x,g),e(f,c.y,d.y-c.y,g))});a.add("position:placeholder",function(a,c,d,e,f,g){f<g?a.Kq(e(f,c.x,d.x-c.x,
g),e(f,c.y,d.y-c.y,g),!1):a.position=new I(e(f,c.x,d.x-c.x,g),e(f,c.y,d.y-c.y,g))});a.add("position:node",function(a,c,d,e,f,g){var b=a.actualBounds,k=d.actualBounds;d=k.x+k.width/2-b.width/2;b=k.y+k.height/2-b.height/2;f<g?a.Kq(e(f,c.x,d-c.x,g),e(f,c.y,b-c.y,g),!1):a.position=new I(e(f,c.x,d-c.x,g),e(f,c.y,b-c.y,g))});a.add("desiredSize",function(a,c,d,e,f,g){a.desiredSize=new N(e(f,c.width,d.width-c.width,g),e(f,c.height,d.height-c.height,g))});a.add("width",function(a,c,d,e,f,g){a.width=e(f,c,
d-c,g)});a.add("height",function(a,c,d,e,f,g){a.height=e(f,c,d-c,g)});a.add("fill",function(a,c,d,e,f,g){a.fill=Rh(c,d,f,g,e)});a.add("stroke",function(a,c,d,e,f,g){a.stroke=Rh(c,d,f,g,e)});a.add("strokeWidth",function(a,c,d,e,f,g){a.strokeWidth=e(f,c,d-c,g)});a.add("strokeDashOffset",function(a,c,d,e,f,g){a.strokeDashOffset=e(f,c,d-c,g)});a.add("background",function(a,c,d,e,f,g){a.background=Rh(c,d,f,g,e)});a.add("areaBackground",function(a,c,d,e,f,g){a.areaBackground=Rh(c,d,f,g,e)});a.add("opacity",
function(a,c,d,e,f,g){a.opacity=e(f,c,d-c,g)});a.add("scale",function(a,c,d,e,f,g){a.scale=e(f,c,d-c,g)});a.add("angle",function(a,c,d,e,f,g){a.angle=e(f,c,d-c,g)});Vh=a}
ma.Object.defineProperties(wh.prototype,{animationReasons:{get:function(){return this.Le}},isEnabled:{get:function(){return this.Mc},set:function(a){this.Mc=a}},duration:{get:function(){return this.Ug},set:function(a){1>a&&va(a,">= 1",wh,"duration");this.Ug=a}},isAnimating:{get:function(){return this.hc}},isTicking:{get:function(){return this.Tr}},isInitial:{
get:function(){return this.oi},set:function(a){this.oi=a}},defaultAnimation:{get:function(){return this.Bd}},activeAnimations:{get:function(){return this.Ck}},initialAnimationStyle:{get:function(){return this.hl},set:function(a){this.hl=a}}});wh.prototype.stopAnimation=wh.prototype.Xc;var Vh=null,xh=!1,zh=new D(wh,"Default",1),Hh=new D(wh,"AnimateLocations",2),Eh=new D(wh,"None",3);
wh.className="AnimationManager";wh.defineAnimationEffect=function(a,b){xh||(yh(),xh=!0);Vh.add(a,b)};wh.Default=zh;wh.AnimateLocations=Hh;wh.None=Eh;function Ah(){this.Yu=this.nx=this.Jc=this.B=null;this.pl=this.hc=this.l=!1;this.Gn=this.ud=0;this.nr=this.lu=Wh;this.ol=this.lp=!1;this.Nu=1;this.Lu=0;this.nd=this.Ug=NaN;this.Pw=0;this.Hn=null;this.v=Gb;this.pc=new G;this.Hu=new G;this.Xl=new F;this.Iu=new F;this.Nw=Xh}Ah.prototype.suspend=function(){this.pl=!0};
Ah.prototype.advanceTo=function(a,b){b&&(this.pl=!1);this.lp&&a>=this.nd&&(this.ol=!0,a-=this.nd);this.Pw=a;Nh(this,!0);Ih(this.Jc);Hf(this.B);Kh(this.Jc);this.B.Fe()};function Fh(a){a.Hu.clear();a.ol=!1;a.Lu=0;a.nd=NaN;0<a.Xl.count&&a.Xl.clear();0<a.Iu.count&&a.Iu.clear()}t=Ah.prototype;
t.start=function(){if(0!==this.pc.count&&!this.hc){for(var a=this.B,b=this.pc.iterator;b.next();){var c=b.value.end,d=b.key;if(c["position:placeholder"]){var e=d.findVisibleNode();if(e instanceof T&&null!==e.placeholder){var f=e.placeholder;e=f.ga(vc);f=f.padding;e.x+=f.left;e.y+=f.top;c["position:placeholder"]=e}}null===a&&(d instanceof R?a=d:d instanceof Y&&(a=d.diagram))}null!==a&&(this.B=a,b=this.Jc=a.animationManager,this.nd=isNaN(this.Ug)?b.duration:this.Ug,this.nr=this.lu,b.gl&&b.hl===zh&&
this===b.defaultAnimation&&(this.nr=Yh,this.nd=isNaN(this.Ug)?600===b.duration?900:b.duration:this.Ug),this.Nw=a.scrollMode,this.isViewportUnconstrained&&(a.Gi=Zh),Ih(b),this.Xl.each(function(b){b.data=null;a.add(b)}),Kh(b),this.hc=!0,this.ud=+new Date,this.Gn=this.ud+this.nd,Mh(b,this))}};t.Ly=function(a,b){a.Wb()&&(this.Xl.add(a),this.B=b)};
t.add=function(a,b,c,d,e){"position"===b&&c.w(d)||(null===this.B&&(a instanceof R?this.B=a:a instanceof Y&&null!==a.diagram&&(this.B=a.diagram)),a instanceof U&&!a.isAnimated||Ph(this,a,b,c,d,e))};
function Ph(a,b,c,d,e,f){var g=a.pc;b instanceof R&&"position"===c&&(c="position:diagram");if(g.contains(b)){var h=g.H(b);var k=h.start;var l=h.end;void 0===k[c]&&(k[c]=$h(d));l[c]=$h(e)}else k={},l={},k[c]=$h(d),l[c]=$h(e),h=k.position,b instanceof Y&&h instanceof I&&!h.u()&&b.diagram.animationManager.Le.contains("Expand SubGraph")&&h.assign(l.position),h=new ai(k,l,f),g.add(b,h);g=k[c];g instanceof I&&!g.u()&&g.assign(a.v);f&&0===c.indexOf("position:")&&b instanceof U?h.qv.location=$h(b.location):
f&&(h.qv[c]=$h(d))}function $h(a){return a instanceof I?a.copy():a instanceof M?a.copy():a}t.Dt=function(a){if(!this.hc)return!1;a=this.pc.H(a);return null!==a&&a.Vv};t.Hv=function(a){if(!this.hc)return!1;a=this.pc.H(a);return null!==a&&(a.start.position||a.start.location)};
function Nh(a,b){if(!a.pl||b){var c=a.Jc;if(!1!==a.hc){var d=+new Date,e=d>a.Gn?a.nd:d-a.ud;b&&(e=a.Pw,e<a.nd?(a.ud=+new Date-e,a.Gn=a.ud+a.nd):e=a.nd);Ih(c);Jh(a,e);Hf(a.B,!0);Kh(c);d>a.Gn&&(a.lp&&!a.ol?(a.ud=+new Date,a.Gn=a.ud+a.nd,a.ol=!0):a.gm(!1))}}}
function Jh(a,b){for(var c=a.nd,d=a.pc.iterator,e=a.ol;d.next();){var f=d.key;if(!(f instanceof Y&&null===f.diagram)){var g=d.value,h=e?g.end:g.start;g=e?g.start:g.end;var k=Vh,l;for(l in g)"position"===l&&(g["position:placeholder"]||g["position:node"])||null===k.get(l)||k.get(l)(f,h[l],g[l],a.nr,b,c,a)}}}t.stop=function(){this.hc&&this.gm(!0)};
t.gm=function(a){null!==this.Yu&&this.Yu.sp.remove(this.nx);if(this.hc){var b=this.B,c=this.Jc;this.pl=this.hc=c.gl=!1;Ih(c);for(var d=this.pc,e=this.Xl.iterator;e.next();)b.remove(e.value);for(e=this.Iu.iterator;e.next();)e.value.o();e=this.lp;d=d.iterator;for(var f=Vh;d.next();){var g=d.key,h=d.value,k=e?h.end:h.start,l=e?h.start:h.end,m=h.qv,n;for(n in l)if(null!==f.get(n)){var p=n;!h.lv||"position:node"!==p&&"position:placeholder"!==p||(p="position");f.get(p)(g,k[n],void 0!==m[n]?m[n]:h.lv?k[n]:
l[n],this.nr,this.nd,this.nd,this)}h.lv&&void 0!==m.location&&g instanceof U&&(g.location=m.location);h.Vv&&g instanceof U&&g.Ob(!1)}if(c.defaultAnimation===this)for(n=this.B.links;n.next();)e=n.value,null===e.oh?(d=e.path,null!==d&&(e.ld=!1,e.o(),d.o())):(e.points=e.oh,e.oh=null);b.yt.clear();jf(b,!1);b.Na();b.M();Hf(b,!0);this.isViewportUnconstrained&&(b.scrollMode=this.Nw);Kh(c);this.Lu++;!a&&this.Nu>this.Lu?(this.ol=!1,this.start()):(this.Hn&&this.Hn(this),Fh(this),c.gm(this),b.Pb())}};
t.Vj=function(a,b){var c=b.actualBounds,d=null;b instanceof T&&(d=b.placeholder);null!==d?(c=d.ga(vc),d=d.padding,c.x+=d.left,c.y+=d.top,this.add(a,"position",c,a.position,!1)):this.add(a,"position",new I(c.x+c.width/2,c.y+c.height/2),a.position,!1);this.add(a,"scale",.01,a.scale,!1);if(a instanceof T)for(a=a.memberParts;a.next();)d=a.value,d instanceof W&&this.Vj(d,b)};
t.Tj=function(a,b){if(a.isVisible()){var c=null;b instanceof T&&(c=b.placeholder);null!==c?this.add(a,"position:placeholder",a.position,c,!0):this.add(a,"position:node",a.position,b,!0);this.add(a,"scale",a.scale,.01,!0);c=this.pc;c.contains(a)&&(c.H(a).Vv=!0);if(a instanceof T)for(a=a.memberParts;a.next();)c=a.value,c instanceof W&&this.Tj(c,b)}};t.Hz=function(a){var b=this.Hu.get(a);null===b&&(b={},this.Hu.add(a,b));return b};
ma.Object.defineProperties(Ah.prototype,{duration:{get:function(){return this.Ug},set:function(a){1>a&&va(a,">= 1",Ah,"duration");this.Ug=a}},reversible:{get:function(){return this.lp},set:function(a){this.lp=a}},runCount:{get:function(){return this.Nu},set:function(a){0<a?this.Nu=a:B("Animation.runCount value must be a positive integer.")}},finished:{get:function(){return this.Hn},
set:function(a){this.Hn!==a&&(this.Hn=a)}},easing:{get:function(){return this.lu},set:function(a){this.lu=a}},isViewportUnconstrained:{get:function(){return this.l},set:function(a){this.l=a}},isAnimating:{get:function(){return this.hc}}});Ah.prototype.getTemporaryState=Ah.prototype.Hz;Ah.prototype.stop=Ah.prototype.stop;Ah.prototype.add=Ah.prototype.add;Ah.prototype.addTemporaryPart=Ah.prototype.Ly;
function Wh(a,b,c,d){a/=d/2;return 1>a?c/2*a*a+b:-c/2*(--a*(a-2)-1)+b}function Yh(a,b,c,d){return a===d?b+c:c*(-Math.pow(2,-10*a/d)+1)+b}Ah.className="Animation";Ah.EaseLinear=function(a,b,c,d){return c*a/d+b};Ah.EaseInOutQuad=Wh;Ah.EaseInQuad=function(a,b,c,d){return c*(a/=d)*a+b};Ah.EaseOutQuad=function(a,b,c,d){return-c*(a/=d)*(a-2)+b};Ah.EaseInExpo=function(a,b,c,d){return 0===a?b:c*Math.pow(2,10*(a/d-1))+b};Ah.EaseOutExpo=Yh;
function ai(a,b,c){this.start=a;this.end=b;this.qv={};this.lv=c;this.Vv=!1}ai.className="AnimationState";function bi(a,b,c){this.bd=null;this.bf=a;this.Mp=c||ci;this.Hk=null;void 0!==b&&(this.Hk=b,void 0===c&&(this.Mp=di))}bi.prototype.copy=function(){var a=new bi(this.bf);a.Mp=this.Mp;var b=this.Hk;if(null!==b){var c={};void 0!==b.duration&&(c.Hx=b.duration);void 0!==b.finished&&(c.Hx=b.finished);void 0!==b.easing&&(c.Hx=b.easing);a.Hk=c}return a};
function ei(a,b){a=a.Hk;null!==a&&(a.duration&&(b.duration=a.duration),a.finished&&(b.finished=a.finished),a.easing&&(b.easing=a.easing))}ma.Object.defineProperties(bi.prototype,{propertyName:{get:function(){return this.bf},set:function(a){this.bf=a}},animationSettings:{get:function(){return this.Hk},set:function(a){this.Hk=a}},startCondition:{get:function(){return this.Mp},set:function(a){this.Mp=a}}});
var ci=new D(bi,"Default",1),di=new D(bi,"Immediate",2),fi=new D(bi,"Bundled",3);bi.className="AnimationTrigger";bi.Default=ci;bi.Immediate=di;bi.Bundled=fi;function gi(){Ya(this);this.B=null;this.Ca=new E;this.Qa="";this.qb=1;this.v=!1;this.Bi=this.I=this.$h=this.Zh=this.Yh=this.Xh=this.Vh=this.Wh=this.Uh=this.bi=this.Th=this.ai=this.Sh=this.Rh=!0;this.l=!1;this.Yo=[]}t=gi.prototype;t.clear=function(){this.Ca.clear();this.Yo.length=0};t.Zd=function(a){this.B=a};
t.toString=function(a){void 0===a&&(a=0);var b='Layer "'+this.name+'"';if(0>=a)return b;for(var c=0,d=0,e=0,f=0,g=0,h=this.Ca.iterator;h.next();){var k=h.value;k instanceof T?e++:k instanceof W?d++:k instanceof S?f++:k instanceof Ke?g++:c++}h="";0<c&&(h+=c+" Parts ");0<d&&(h+=d+" Nodes ");0<e&&(h+=e+" Groups ");0<f&&(h+=f+" Links ");0<g&&(h+=g+" Adornments ");if(1<a)for(a=this.Ca.iterator;a.next();)c=a.value,h+="\n "+c.toString(),d=c.data,null!==d&&lb(d)&&(h+=" #"+lb(d)),c instanceof W?h+=" "+
Ja(d):c instanceof S&&(h+=" "+Ja(c.fromNode)+" "+Ja(c.toNode));return b+" "+this.Ca.count+": "+h};t.Ub=function(a,b,c){void 0===b&&(b=null);void 0===c&&(c=null);if(!1===this.Bi)return null;var d=!1;null!==this.diagram&&this.diagram.viewportBounds.aa(a)&&(d=!0);for(var e=I.alloc(),f=this.Ca.j,g=f.length;g--;){var h=f[g];if((!0!==d||!1!==ug(h))&&h.isVisible()&&(e.assign(a),Ab(e,h.vd),h=h.Ub(e,b,c),null!==h&&(null!==b&&(h=b(h)),null!==h&&(null===c||c(h)))))return I.free(e),h}I.free(e);return null};
t.Ti=function(a,b,c,d){void 0===b&&(b=null);void 0===c&&(c=null);d instanceof E||d instanceof F||(d=new F);if(!1===this.Bi)return d;var e=!1;null!==this.diagram&&this.diagram.viewportBounds.aa(a)&&(e=!0);for(var f=I.alloc(),g=this.Ca.j,h=g.length;h--;){var k=g[h];if((!0!==e||!1!==ug(k))&&k.isVisible()){f.assign(a);Ab(f,k.vd);var l=k;k.Ti(f,b,c,d)&&(null!==b&&(l=b(l)),null===l||null!==c&&!c(l)||d.add(l))}}I.free(f);return d};
t.uf=function(a,b,c,d,e){void 0===b&&(b=null);void 0===c&&(c=null);void 0===d&&(d=!1);e instanceof E||e instanceof F||(e=new F);if(!1===this.Bi)return e;var f=!1;null!==this.diagram&&this.diagram.viewportBounds.Ae(a)&&(f=!0);for(var g=this.Ca.j,h=g.length;h--;){var k=g[h];if((!0!==f||!1!==ug(k))&&k.isVisible()){var l=k;k.uf(a,b,c,d,e)&&(null!==b&&(l=b(l)),null===l||null!==c&&!c(l)||e.add(l))}}return e};
t.vv=function(a,b,c,d,e,f,g){if(!1===this.Bi)return e;for(var h=this.Ca.j,k=h.length;k--;){var l=h[k];if((!0!==g||!1!==ug(l))&&f(l)&&l.isVisible()){var m=l;l.uf(a,b,c,d,e)&&(null!==b&&(m=b(m)),null===m||null!==c&&!c(m)||e.add(m))}}return e};
t.Ag=function(a,b,c,d,e,f){void 0===c&&(c=null);void 0===d&&(d=null);void 0===e&&(e=!0);if(!1!==e&&!0!==e){if(e instanceof E||e instanceof F)f=e;e=!0}f instanceof E||f instanceof F||(f=new F);if(!1===this.Bi)return f;var g=!1;null!==this.diagram&&this.diagram.viewportBounds.aa(a)&&(g=!0);for(var h=I.alloc(),k=I.alloc(),l=this.Ca.j,m=l.length;m--;){var n=l[m];if((!0!==g||!1!==ug(n))&&n.isVisible()){h.assign(a);Ab(h,n.vd);k.h(a.x+b,a.y);Ab(k,n.vd);var p=n;n.Ag(h,k,c,d,e,f)&&(null!==c&&(p=c(p)),null===
p||null!==d&&!d(p)||f.add(p))}}I.free(h);I.free(k);return f};
t.zd=function(a,b){if(this.visible){var c=void 0===b?a.viewportBounds:b;var d=this.Ca.j,e=d.length;a=Fa();b=Fa();for(var f=0;f<e;f++){var g=d[f];g.Xw=f;g instanceof S&&!1===g.ld||g instanceof Ke&&null!==g.adornedPart||(dc(g.actualBounds,c)?(g.zd(!0),a.push(g)):(g.zd(!1),null!==g.adornments&&0<g.adornments.count&&b.push(g)))}for(c=0;c<a.length;c++)for(d=a[c],hi(d),d=d.adornments;d.next();)e=d.value,e.measure(Infinity,Infinity),e.arrange(),e.zd(!0);for(c=0;c<b.length;c++)d=b[c],d.updateAdornments(),
ii(d,!0);Ha(a);Ha(b)}};function ji(a,b){var c=1;1!==a.qb&&(c=b.globalAlpha,b.globalAlpha=c*a.qb);return c}t.bc=function(a,b,c){if(this.visible&&0!==this.qb&&(void 0===c&&(c=!0),c||!this.isTemporary)){c=this.Ca.j;var d=c.length;if(0!==d){var e=ji(this,a),f=this.Yo;f.length=0;for(var g=b.scale,h=N.alloc(),k=0;k<d;k++)this.Pi(a,c[k],b,f,g,h);N.free(h);a.globalAlpha=e}}};
t.Pi=function(a,b,c,d,e,f){if(null!==d&&b instanceof S&&(b.isOrthogonal&&d.push(b),!1===b.ld))return;var g=b.actualBounds;d=!1;var h=b.containingGroup;if(null!==h&&h.isClipping&&h.type!==X.Spot){h.locationObject.lm(f);if(!f.Gc(g))return;d=!f.Ae(g)}d&&(a.save(),a.beginPath(),a.rect(f.x,f.y,f.width,f.height),a.clip());g.width*e>c.Bo||g.height*e>c.Bo?b.bc(a,c):(e=b.actualBounds,f=b.naturalBounds,0===e.width||0===e.height||isNaN(e.x)||isNaN(e.y)||!b.isVisible()||(c=b.transform,null!==b.areaBackground&&
(ki(b,a,b.areaBackground,!0,!0,f,e),a.fillRect(e.x,e.y,e.width,e.height)),null===b.areaBackground&&null===b.background&&(ki(b,a,"rgba(0,0,0,0.3)",!0,!1,f,e),a.fillRect(e.x,e.y,e.width,e.height)),null!==b.background&&(a.transform(c.m11,c.m12,c.m21,c.m22,c.dx,c.dy),ki(b,a,b.background,!0,!1,f,e),a.fillRect(0,0,f.width/2,f.height/2),c.ut()||(b=1/(c.m11*c.m22-c.m12*c.m21),a.transform(c.m22*b,-c.m12*b,-c.m21*b,c.m11*b,b*(c.m21*c.dy-c.m22*c.dx),b*(c.m12*c.dx-c.m11*c.dy))))));d&&(a.restore(),a.sc(!0))};
t.g=function(a,b,c,d,e){var f=this.diagram;null!==f&&f.Ya(ue,a,this,b,c,d,e)};t.aj=function(a,b,c){var d=this.Ca;b.ui=this;if(a>=d.count)a=d.count;else if(d.L(a)===b)return-1;d.Kb(a,b);b.qq(c);d=this.diagram;null!==d&&(c?d.M():d.aj(b));li(this,a,b);return a};
t.Fc=function(a,b,c){if(!c&&b.layer!==this&&null!==b.layer)return b.layer.Fc(a,b,c);var d=this.Ca;if(0>a||a>=d.length){if(a=d.indexOf(b),0>a)return-1}else if(d.L(a)!==b&&(a=d.indexOf(b),0>a))return-1;b.rq(c);d.lb(a);d=this.diagram;null!==d&&(c?d.M():d.Fc(b));b.ui=null;return a};
function li(a,b,c){b=mi(a,b,c);if(c instanceof T&&null!==c&&isNaN(c.zOrder)){if(0!==c.memberParts.count){for(var d=-1,e=a.Ca.j,f=e.length,g=0;g<f;g++){var h=e[g];if(h===c&&(b=g,0<=d))break;if(0>d&&h.containingGroup===c&&(d=g,0<=b))break}!(0>d)&&d<b&&(e=a.Ca,e.lb(b),e.Kb(d,c))}c=c.containingGroup;null!==c&&li(a,-1,c)}}
function mi(a,b,c){var d=c.zOrder;if(isNaN(d))return b;a=a.Ca;var e=a.count;if(1>=e)return b;0>b&&(b=a.indexOf(c));if(0>b)return-1;for(var f=b-1,g=NaN;0<=f;){g=a.L(f).zOrder;if(!isNaN(g))break;f--}for(var h=b+1,k=NaN;h<e;){k=a.L(h).zOrder;if(!isNaN(k))break;h++}if(!isNaN(g)&&g>d)for(;;){if(-1===f||g<=d){f++;if(f===b)break;a.lb(b);a.Kb(f,c);return f}for(g=NaN;0<=--f&&(g=a.L(f).zOrder,isNaN(g)););}else if(!isNaN(k)&&k<d)for(;;){if(h===e||k>=d){h--;if(h===b)break;a.lb(b);a.Kb(h,c);return h}for(k=NaN;++h<
e&&(k=a.L(h).zOrder,isNaN(k)););}return b}
ma.Object.defineProperties(gi.prototype,{parts:{get:function(){return this.Ca.iterator}},partsBackwards:{get:function(){return this.Ca.iteratorBackwards}},diagram:{get:function(){return this.B}},name:{get:function(){return this.Qa},set:function(a){var b=this.Qa;if(b!==a){var c=this.diagram;if(null!==c)for(""===b&&B("Cannot rename default Layer to: "+a),c=c.layers;c.next();)c.value.name===
a&&B("Layer.name is already present in this diagram: "+a);this.Qa=a;this.g("name",b,a);for(a=this.Ca.iterator;a.next();)a.value.layerName=this.Qa}}},opacity:{get:function(){return this.qb},set:function(a){var b=this.qb;b!==a&&((0>a||1<a)&&va(a,"0 <= value <= 1",gi,"opacity"),this.qb=a,this.g("opacity",b,a),a=this.diagram,null!==a&&a.M())}},isTemporary:{get:function(){return this.v},set:function(a){var b=this.v;b!==a&&(this.v=a,this.g("isTemporary",
b,a))}},visible:{get:function(){return this.I},set:function(a){var b=this.I;if(b!==a){this.I=a;this.g("visible",b,a);for(b=this.Ca.iterator;b.next();)b.value.Ob(a);a=this.diagram;null!==a&&a.M()}}},pickable:{get:function(){return this.Bi},set:function(a){var b=this.Bi;b!==a&&(this.Bi=a,this.g("pickable",b,a))}},isBoundsIncluded:{get:function(){return this.l},set:function(a){this.l!==a&&(this.l=a,null!==this.diagram&&
this.diagram.Na())}},allowCopy:{get:function(){return this.Rh},set:function(a){var b=this.Rh;b!==a&&(this.Rh=a,this.g("allowCopy",b,a))}},allowDelete:{get:function(){return this.Sh},set:function(a){var b=this.Sh;b!==a&&(this.Sh=a,this.g("allowDelete",b,a))}},allowTextEdit:{get:function(){return this.ai},set:function(a){var b=this.ai;b!==a&&(this.ai=a,this.g("allowTextEdit",b,a))}},allowGroup:{
get:function(){return this.Th},set:function(a){var b=this.Th;b!==a&&(this.Th=a,this.g("allowGroup",b,a))}},allowUngroup:{get:function(){return this.bi},set:function(a){var b=this.bi;b!==a&&(this.bi=a,this.g("allowUngroup",b,a))}},allowLink:{get:function(){return this.Uh},set:function(a){var b=this.Uh;b!==a&&(this.Uh=a,this.g("allowLink",b,a))}},allowRelink:{get:function(){return this.Wh},set:function(a){var b=
this.Wh;b!==a&&(this.Wh=a,this.g("allowRelink",b,a))}},allowMove:{get:function(){return this.Vh},set:function(a){var b=this.Vh;b!==a&&(this.Vh=a,this.g("allowMove",b,a))}},allowReshape:{get:function(){return this.Xh},set:function(a){var b=this.Xh;b!==a&&(this.Xh=a,this.g("allowReshape",b,a))}},allowResize:{get:function(){return this.Yh},set:function(a){var b=this.Yh;b!==a&&(this.Yh=a,this.g("allowResize",b,a))}},
allowRotate:{get:function(){return this.Zh},set:function(a){var b=this.Zh;b!==a&&(this.Zh=a,this.g("allowRotate",b,a))}},allowSelect:{get:function(){return this.$h},set:function(a){var b=this.$h;b!==a&&(this.$h=a,this.g("allowSelect",b,a))}}});gi.prototype.findObjectsNear=gi.prototype.Ag;gi.prototype.findObjectsIn=gi.prototype.uf;gi.prototype.findObjectsAt=gi.prototype.Ti;gi.prototype.findObjectAt=gi.prototype.Ub;gi.className="Layer";
function R(a){function b(){c.removeEventListener(x.document,"DOMContentLoaded",b,!1);c.setRTL()}1<arguments.length&&B("Diagram constructor can only take one optional argument, the DIV HTML element or its id.");ni||(oi(),ni=!0);Ya(this);Ce=this;Qa=[];this.Rb=!0;this.Jc=new wh;this.Jc.Zd(this);this.jb=17;this.nl=this.Qu=!1;this.zs="default";this.La=null;var c=this;Sg&&(null!==x.document.body?this.setRTL():c.addEventListener(x.document,"DOMContentLoaded",b,!1));this.Ja=new E;this.va=this.wa=0;this.sa=
null;this.jx=new G;this.cf=this.Db=null;this.bw();this.vj=null;this.aw();this.qb=1;this.ma=(new I(NaN,NaN)).freeze();this.Ou=new I(NaN,NaN);this.yn=this.ya=1;this.Kr=(new I(NaN,NaN)).freeze();this.Lr=NaN;this.ds=1E-4;this.bs=100;this.kb=new qd;this.$s=(new I(NaN,NaN)).freeze();this.Fr=(new N(NaN,NaN,NaN,NaN)).freeze();this.Fi=(new oc(0,0,0,0)).freeze();this.Gi=Xh;this.Hs=!1;this.As=this.vs=null;this.Lg=pi;this.lj=$c;this.Xf=pi;this.Xn=$c;this.Mr=this.Jr=vc;this.Ac=!0;this.ll=!1;this.od=new F;this.Sg=
new G;this.Xk=!0;this.Zm=250;this.jj=-1;this.an=(new oc(16,16,16,16)).freeze();this.pj=this.xe=!1;this.sj=!0;this.Uf=new qe;this.Uf.diagram=this;this.Qd=new qe;this.Qd.diagram=this;this.dh=new qe;this.dh.diagram=this;this.pe=this.Mf=null;this.Pj=!1;this.vr=this.wr=null;this.Vm=x.PointerEvent&&(Ta||Ua||Va)&&x.navigator&&!1!==x.navigator.msPointerEnabled;qi(this);this.zh=new F;this.Ur=!0;this.Vs=ri;this.vu=!1;this.Xs=Mf;this.Ia=null;si.add("Model",ti);this.pr=this.sr=this.Ts=null;this.xn=this.mr="auto";
this.fg=this.gs=this.hg=this.ig=this.kg=this.Of=this.Sf=this.Nf=null;this.Ir=!1;this.Pf=this.ug=this.jg=this.gg=null;this.hs=!1;this.ts={};this.Kj=[null,null];this.gr=null;this.tr=this.Ls=this.Su=this.sg=!1;this.zu=!0;this.ni=this.Bc=!1;this.ac=null;var d=this;this.kd=function(a){var b=d.partManager;if(a.model===b.diagram.model&&b.diagram.Z){b.diagram.Z=!1;try{var c=a.change;""===a.modelChange&&c===ue&&b.updateDataBindings(a.object,a.propertyName)}finally{b.diagram.Z=!0}}};this.Ic=function(a){d.partManager.doModelChanged(a)};
this.av=!0;this.Hd=-2;this.Ci=new G;this.ss=new E;this.Zf=!1;this.Sh=this.Rh=this.Uq=this.Mc=!0;this.Vq=!1;this.ar=this.Zq=this.$h=this.Zh=this.Yh=this.Xh=this.Vh=this.Wh=this.Uh=this.Yq=this.bi=this.Th=this.ai=this.Wq=!0;this.Yf=this.xu=!1;this.$q=this.Xq=this.dl=this.cl=!0;this.Gs=this.Cs=16;this.Bs=this.vp=!1;this.wp=this.Es=null;this.Ds=this.Fs=0;this.bb=(new oc(5)).freeze();this.Ru=(new F).freeze();this.cs=999999999;this.su=(new F).freeze();this.mi=this.li=this.ki=!0;this.Te=this.ie=!1;this.ic=
null;this.If=!0;this.je=!1;this.Yw=new F;this.tu=new F;this.Gb=null;this.Cl=1;this.Tu=0;this.Sd={scale:1,position:new I,bounds:new N,Kv:!1};this.$u=(new N(NaN,NaN,NaN,NaN)).freeze();this.Zl=(new M(NaN,NaN)).freeze();this.zn=(new N(NaN,NaN,NaN,NaN)).freeze();this.Vr=!1;this.qo=this.Vn=this.Ro=this.gu=this.fu=this.hu=this.ag=this.ah=this.Ze=this.zr=null;ui(this);this.Fb=null;this.Un=!1;this.mj=null;this.partManager=new ti;this.toolManager=new Oa;this.toolManager.initializeStandardTools();this.currentTool=
this.defaultTool=this.toolManager;this.yr=null;this.Qk=new Se;this.ns=this.ms=null;this.Op=!1;this.commandHandler=Ci();this.model=Di();this.sg=!0;Ei(this);this.layout=new Fi;this.sg=!1;this.Rw=this.ku=null;this.Sb=1;this.uh=null;this.Bo=1;this.Io=0;this.Jo=[0,0,0,0,0];this.Ko=0;this.pd=1;this.Aj=0;this.lo=new I;this.Us=500;this.$m=new I;this.ke=!1;this.preventDefault=this.Ht=this.vm=this.wm=this.um=this.tm=this.rk=this.tk=this.sk=this.pk=this.qk=this.vw=this.nw=this.ow=this.pw=this.nh=this.Gl=this.mh=
this.Fl=null;this.$n=!1;this.ji=new Gi;this.Pp=!1;void 0!==a&&Hi(this,a);this.In=null;this.Jn=Kb;this.Rb=!1}R.prototype.clear=function(){this.animationManager.Xc();this.model.clear();Ii=null;Ji="";Ki(this,!1);this.Na();Li(this);this.M()};
function Ki(a,b){a.animationManager.Xc(!0);a.Ru=(new F).freeze();a.su=(new F).freeze();var c=a.skipsUndoManager;null!==a.model&&(a.skipsUndoManager=!0);var d=null;null!==a.Fb&&(d=a.Fb.part,null!==d&&a.remove(d));var e=[],f=a.Ja.length;if(b){for(b=0;b<f;b++)for(var g=a.Ja.j[b].parts;g.next();){var h=g.value;h!==d&&null===h.data&&e.push(h)}for(b=0;b<e.length;b++)a.remove(e[b])}for(b=0;b<f;b++)a.Ja.j[b].clear();a.partManager.clear();a.od.clear();a.Sg.clear();a.zh.clear();a.mj=null;Ga=[];null!==d&&(a.add(d),
a.partManager.parts.remove(d));null!==a.model&&(a.skipsUndoManager=c);return e}function Ci(){return null}
R.prototype.reset=function(){this.clear();this.Rb=!0;this.Jc=new wh;this.Jc.Zd(this);this.jb=17;this.nl=this.Qu=!1;this.zs="default";this.Ja=new E;this.jx=new G;this.cf=null;this.bw();this.vj=null;this.aw();this.qb=1;this.ma=(new I(NaN,NaN)).freeze();this.Ou=new I(NaN,NaN);this.yn=this.ya=1;this.Kr=(new I(NaN,NaN)).freeze();this.Lr=NaN;this.ds=1E-4;this.bs=100;this.kb=new qd;this.$s=(new I(NaN,NaN)).freeze();this.Fr=(new N(NaN,NaN,NaN,NaN)).freeze();this.Fi=(new oc(0,0,0,0)).freeze();this.Gi=Xh;this.Hs=
!1;this.As=this.vs=null;this.Lg=pi;this.lj=$c;this.Xf=pi;this.Xn=$c;this.Mr=this.Jr=vc;this.Ac=!0;this.ll=!1;this.od=new F;this.Sg=new G;this.Xk=!0;this.Zm=250;this.jj=-1;this.an=(new oc(16,16,16,16)).freeze();this.pj=this.xe=!1;this.sj=!0;this.Uf=new qe;this.Uf.diagram=this;this.Qd=new qe;this.Qd.diagram=this;this.dh=new qe;this.dh.diagram=this;this.pe=this.Mf=null;this.Pj=!1;this.vr=this.wr=null;this.Vm=x.PointerEvent&&(Ta||Ua||Va)&&x.navigator&&!1!==x.navigator.msPointerEnabled;qi(this);this.zh=
new F;this.Ur=!0;this.Vs=ri;this.vu=!1;this.Xs=Mf;this.pr=this.sr=this.Ts=null;this.xn=this.mr="auto";this.fg=this.gs=this.hg=this.ig=this.kg=this.Of=this.Sf=this.Nf=null;this.Ir=!1;this.Pf=this.ug=this.jg=this.gg=null;this.hs=!1;this.ts={};this.Kj=[null,null];this.gr=null;this.tr=this.Ls=this.Su=this.sg=!1;this.zu=!0;this.ni=this.Bc=!1;this.av=!0;this.Hd=-2;this.Ci=new G;this.ss=new E;this.Zf=!1;this.Sh=this.Rh=this.Uq=this.Mc=!0;this.Vq=!1;this.ar=this.Zq=this.$h=this.Zh=this.Yh=this.Xh=this.Vh=
this.Wh=this.Uh=this.Yq=this.bi=this.Th=this.ai=this.Wq=!0;this.Yf=this.xu=!1;this.$q=this.Xq=this.dl=this.cl=!0;this.Gs=this.Cs=16;this.Bs=this.vp=!1;this.Ds=this.Fs=0;this.bb=(new oc(5)).freeze();this.Ru=(new F).freeze();this.cs=999999999;this.su=(new F).freeze();this.mi=this.li=this.ki=!0;this.Te=this.ie=!1;this.ic=null;this.If=!0;this.je=!1;this.Yw=new F;this.tu=new F;this.Gb=null;this.Cl=1;this.Tu=0;this.Sd={scale:1,position:new I,bounds:new N,Kv:!1};this.$u=(new N(NaN,NaN,NaN,NaN)).freeze();
this.Zl=(new M(NaN,NaN)).freeze();this.zn=(new N(NaN,NaN,NaN,NaN)).freeze();this.Vr=!1;this.qo=this.Vn=this.Ro=this.gu=this.fu=this.hu=this.ag=this.ah=this.Ze=null;ui(this);this.Fb=null;this.Un=!1;this.mj=null;this.partManager=new ti;this.toolManager=new Oa;this.toolManager.initializeStandardTools();this.currentTool=this.defaultTool=this.toolManager;this.yr=null;this.Qk=new Se;this.ns=this.ms=null;this.Op=!1;this.commandHandler=Ci();this.sg=!0;Ei(this);this.layout=new Fi;this.sg=!1;this.model=Di();
this.model.undoManager=new ze;this.je=!1;this.sj=!0;this.xe=!1;this.Sb=1;this.uh=null;this.Bo=1;this.Io=0;this.Jo=[0,0,0,0,0];this.Ko=0;this.pd=1;this.Aj=0;this.lo=new I;this.Us=500;this.$m=new I;this.ke=!1;this.nh=this.Gl=this.mh=this.Fl=null;this.Pp=this.$n=!1;this.In=null;this.Jn=Kb;this.Rb=!1;this.M()};
function ui(a){a.Ze=new G;var b=new W,c=new Ug;c.bind(new Mi("text","",Ja));b.add(c);a.hu=b;a.Ze.add("",b);b=new W;c=new Ug;c.stroke="brown";c.bind(new Mi("text","",Ja));b.add(c);a.Ze.add("Comment",b);b=new W;b.selectable=!1;b.avoidable=!1;c=new Kf;c.figure="Ellipse";c.fill="black";c.stroke=null;c.desiredSize=(new M(3,3)).ca();b.add(c);a.Ze.add("LinkLabel",b);a.ah=new G;b=new T;b.selectionObjectName="GROUPPANEL";b.type=X.Vertical;c=new Ug;c.font="bold 12pt sans-serif";c.bind(new Mi("text","",Ja));
b.add(c);c=new X(X.Auto);c.name="GROUPPANEL";var d=new Kf;d.figure="Rectangle";d.fill="rgba(128,128,128,0.2)";d.stroke="black";c.add(d);d=new vg;d.padding=(new oc(5,5,5,5)).ca();c.add(d);b.add(c);a.fu=b;a.ah.add("",b);a.ag=new G;b=new S;c=new Kf;c.isPanelMain=!0;b.add(c);c=new Kf;c.toArrow="Standard";c.fill="black";c.stroke=null;c.strokeWidth=0;b.add(c);a.gu=b;a.ag.add("",b);b=new S;c=new Kf;c.isPanelMain=!0;c.stroke="brown";b.add(c);a.ag.add("Comment",b);b=new Ke;b.type=X.Auto;c=new Kf;c.fill=null;
c.stroke="dodgerblue";c.strokeWidth=3;b.add(c);c=new vg;c.margin=(new oc(1.5,1.5,1.5,1.5)).ca();b.add(c);a.Ro=b;a.Vn=b;b=new Ke;b.type=X.Link;c=new Kf;c.isPanelMain=!0;c.fill=null;c.stroke="dodgerblue";c.strokeWidth=3;b.add(c);a.qo=b}
R.prototype.setRTL=function(a){a=void 0===a?this.div:a;null===a&&(a=x.document.body);var b=ta("div");b.dir="rtl";b.style.cssText="font-size: 14px; width: 1px; height: 1px; position: absolute; top: -1000px; overflow: scroll;";b.textContent="A";a.appendChild(b);var c="reverse";0<b.scrollLeft?c="default":(b.scrollLeft=1,0===b.scrollLeft&&(c="negative"));a.removeChild(b);this.zs=c};
R.prototype.setScrollWidth=function(a){a=void 0===a?this.div:a;null===a&&(a=x.document.body);var b=0;if(Sg){var c=Ni;b=Oi;null===c&&(c=Ni=ta("p"),c.style.width="100%",c.style.height="200px",c.style.boxSizing="content-box",b=Oi=ta("div"),b.style.position="absolute",b.style.visibility="hidden",b.style.width="200px",b.style.height="150px",b.style.boxSizing="content-box",b.appendChild(c));b.style.overflow="hidden";a.appendChild(b);var d=c.offsetWidth;b.style.overflow="scroll";c=c.offsetWidth;d===c&&(c=
b.clientWidth);a.removeChild(b);b=d-c;0!==b||Xa||(b=11)}this.jb=b;this.Qu=!0};R.prototype.cb=function(a){a.classType===R&&(this.autoScale=a)};R.prototype.toString=function(a){void 0===a&&(a=0);var b="";this.div&&this.div.id&&(b=this.div.id);b='Diagram "'+b+'"';if(0>=a)return b;for(var c=this.Ja.iterator;c.next();)b+="\n "+c.value.toString(a-1);return b};R.prototype.addEventListener=function(a,b,c,d){a.addEventListener(b,c,d)};
R.prototype.removeEventListener=function(a,b,c,d){a.removeEventListener(b,c,d)};
function Pi(a){var b=a.sa.Ea;b instanceof HTMLCanvasElement&&(a.Vm?(a.addEventListener(b,"pointerdown",a.tm,!1),a.addEventListener(b,"pointermove",a.um,!1),a.addEventListener(b,"pointerup",a.wm,!1),a.addEventListener(b,"pointerout",a.vm,!1)):(a.addEventListener(b,"touchstart",a.pw,!1),a.addEventListener(b,"touchmove",a.ow,!1),a.addEventListener(b,"touchend",a.nw,!1),a.addEventListener(b,"mousemove",a.qk,!1),a.addEventListener(b,"mousedown",a.pk,!1),a.addEventListener(b,"mouseup",a.sk,!1),a.addEventListener(b,
"mouseout",a.rk,!1)),a.addEventListener(b,"mouseenter",a.dz,!1),a.addEventListener(b,"mouseleave",a.ez,!1),a.addEventListener(b,"wheel",a.tk,!1),a.addEventListener(b,"keydown",a.Xz,!1),a.addEventListener(b,"keyup",a.Yz,!1),a.addEventListener(b,"blur",a.Ry,!1),a.addEventListener(b,"focus",a.Sy,!1),a.addEventListener(b,"selectstart",function(a){a.preventDefault();return!1},!1),a.addEventListener(b,"contextmenu",function(a){a.preventDefault();return!1},!1),a.addEventListener(b,"gesturestart",function(b){a.toolManager.gestureBehavior!==
Ne&&(a.toolManager.gestureBehavior===Me?b.preventDefault():a.ke&&a.lastInput.handled||(b.preventDefault(),a.Cl=a.scale,a.currentTool.doCancel()))},!1),a.addEventListener(b,"gesturechange",function(b){if(a.toolManager.gestureBehavior!==Ne)if(a.toolManager.gestureBehavior===Me)b.preventDefault();else if(!a.ke||!a.lastInput.handled){b.preventDefault();var c=b.scale;if(null!==a.Cl){var e=a.sa.getBoundingClientRect();b=new I(b.pageX-window.scrollX-a.wa/e.width*e.left,b.pageY-window.scrollY-a.va/e.height*
e.top);c=a.Cl*c;e=a.commandHandler;if(c!==a.scale&&e.canResetZoom(c)){var f=a.zoomPoint;a.zoomPoint=b;e.resetZoom(c);a.zoomPoint=f}}}},!1),a.addEventListener(x,"resize",a.vw,!1))}function Ve(a){30<a.Io&&(a.uh=1)}function jf(a,b){null!==a.uh&&(a.uh=null,b&&a.Ht(),a.Io=0,a.Jo=[0,0,0,0,0],a.Ko=0)}R.prototype.computePixelRatio=function(){return null!==this.uh?this.uh:x.devicePixelRatio||1};R.prototype.doMouseMove=function(){this.currentTool.doMouseMove()};R.prototype.doMouseDown=function(){this.currentTool.doMouseDown()};
R.prototype.doMouseUp=function(){this.currentTool.doMouseUp()};R.prototype.doMouseWheel=function(){this.currentTool.doMouseWheel()};R.prototype.doKeyDown=function(){this.currentTool.doKeyDown()};R.prototype.doKeyUp=function(){this.currentTool.doKeyUp()};R.prototype.doFocus=function(){this.focus()};R.prototype.focus=function(){if(this.sa)if(this.scrollsPageOnFocus)this.sa.focus();else{var a=x.scrollX||x.pageXOffset,b=x.scrollY||x.pageYOffset;this.sa.focus();x.scrollTo(a,b)}};R.prototype.Sy=function(){this.B.R("GainedFocus")};
R.prototype.Ry=function(){this.B.R("LostFocus")};function Gh(a){if(null!==a.sa){var b=a.La;if(0!==b.clientWidth&&0!==b.clientHeight){a.Qu||a.setScrollWidth();var c=a.Te?a.jb:0,d=a.ie?a.jb:0,e=a.Sb;a.Sb=a.computePixelRatio();a.Sb!==e&&(a.ll=!0,a.Pb());if(b.clientWidth!==a.wa+c||b.clientHeight!==a.va+d)a.li=!0,a.Ac=!0,b=a.layout,null!==b&&b.isViewportSized&&a.autoScale===pi&&(a.pj=!0,b.C()),a.Bc||a.Pb()}}}
function Ei(a){var b=new gi;b.name="Background";a.$l(b);b=new gi;b.name="";a.$l(b);b=new gi;b.name="Foreground";a.$l(b);b=new gi;b.name="Adornment";b.isTemporary=!0;a.$l(b);b=new gi;b.name="Tool";b.isTemporary=!0;b.isBoundsIncluded=!0;a.$l(b);b=new gi;b.name="Grid";b.allowSelect=!1;b.pickable=!1;b.isTemporary=!0;a.tx(b,a.im("Background"))}
function Qi(a){a.Fb=new X(X.Grid);a.Fb.name="GRID";var b=new Kf;b.figure="LineH";b.stroke="lightgray";b.strokeWidth=.5;b.interval=1;a.Fb.add(b);b=new Kf;b.figure="LineH";b.stroke="gray";b.strokeWidth=.5;b.interval=5;a.Fb.add(b);b=new Kf;b.figure="LineH";b.stroke="gray";b.strokeWidth=1;b.interval=10;a.Fb.add(b);b=new Kf;b.figure="LineV";b.stroke="lightgray";b.strokeWidth=.5;b.interval=1;a.Fb.add(b);b=new Kf;b.figure="LineV";b.stroke="gray";b.strokeWidth=.5;b.interval=5;a.Fb.add(b);b=new Kf;b.figure=
"LineV";b.stroke="gray";b.strokeWidth=1;b.interval=10;a.Fb.add(b);b=new U;b.add(a.Fb);b.layerName="Grid";b.zOrder=0;b.isInDocumentBounds=!1;b.isAnimated=!1;b.pickable=!1;b.locationObjectName="GRID";a.add(b);a.partManager.parts.remove(b);a.Fb.visible=!1}function Ri(){this.B.Bs?this.B.Bs=!1:this.B.isEnabled?this.B.Ex(this):Si(this.B)}function Ti(a){this.B.isEnabled?(this.B.Fs=a.target.scrollTop,this.B.Ds=a.target.scrollLeft):Si(this.B)}
R.prototype.Ex=function(a){if(null!==this.sa){this.vp=!0;var b=this.documentBounds,c=this.viewportBounds,d=this.Fi,e=b.x-d.left,f=b.y-d.top,g=b.width+d.left+d.right,h=b.height+d.top+d.bottom,k=b.right+d.right;d=b.bottom+d.bottom;var l=c.x;b=c.y;var m=c.width,n=c.height,p=c.right,r=c.bottom;c=this.scale;var q=a.scrollLeft;if(this.nl)switch(this.zs){case "negative":q=q+a.scrollWidth-a.clientWidth;break;case "reverse":q=a.scrollWidth-q-a.clientWidth}var u=q;m<g||n<h?(q=I.allocAt(this.position.x,this.position.y),
this.allowHorizontalScroll&&this.Ds!==u&&(q.x=u/c+e,this.Ds=u),this.allowVerticalScroll&&this.Fs!==a.scrollTop&&(q.y=a.scrollTop/c+f,this.Fs=a.scrollTop),this.position=q,I.free(q),this.li=this.vp=!1):(q=I.alloc(),a.Ay&&this.allowHorizontalScroll&&(e<l&&(this.position=q.h(u+e,this.position.y)),k>p&&(this.position=q.h(-(this.Es.scrollWidth-this.wa)+u-this.wa/c+k,this.position.y))),a.By&&this.allowVerticalScroll&&(f<b&&(this.position=q.h(this.position.x,a.scrollTop+f)),d>r&&(this.position=q.h(this.position.x,
-(this.Es.scrollHeight-this.va)+a.scrollTop-this.va/c+d))),I.free(q),Ui(this),this.li=this.vp=!1,b=this.documentBounds,c=this.viewportBounds,k=b.right,p=c.right,d=b.bottom,r=c.bottom,e=b.x,l=c.x,f=b.y,b=c.y,m>=g&&e>=l&&k<=p&&(this.wp.style.width="1px"),n>=h&&f>=b&&d<=r&&(this.wp.style.height="1px"))}};R.prototype.computeBounds=function(){0<this.od.count&&Vi(this);return Wi(this)};
function Wi(a){if(a.fixedBounds.u()){var b=a.fixedBounds.copy();b.cq(a.bb);return b}for(var c=!0,d=a.Ja.j,e=d.length,f=0;f<e;f++){var g=d[f];if(g.visible&&(!g.isTemporary||g.isBoundsIncluded)){g=g.Ca.j;for(var h=g.length,k=0;k<h;k++){var l=g[k];l.isInDocumentBounds&&l.isVisible()&&(l=l.actualBounds,l.u()&&(c?(c=!1,b=l.copy()):b.Hc(l)))}}}c&&(b=new N(0,0,0,0));b.cq(a.bb);return b}
R.prototype.computePartsBounds=function(a,b){void 0===b&&(b=!1);var c=null;if(Aa(a))for(var d=0;d<a.length;d++){var e=a[d];!b&&e instanceof S||(e.yb(),null===c?c=e.actualBounds.copy():c.Hc(e.actualBounds))}else for(a=a.iterator;a.next();)d=a.value,!b&&d instanceof S||(d.yb(),null===c?c=d.actualBounds.copy():c.Hc(d.actualBounds));return null===c?new N(NaN,NaN,0,0):c};
function Xi(a,b){if((b||a.je)&&!a.Rb&&null!==a.sa&&a.documentBounds.u()){if(b){var c=a.initialPosition;if(c.u()){a.position=c;return}c=I.alloc();c.dj(a.documentBounds,a.initialDocumentSpot);var d=a.viewportBounds;d=N.allocAt(0,0,d.width,d.height);var e=I.alloc();e.dj(d,a.initialViewportSpot);e.h(c.x-e.x,c.y-e.y);a.position=e;N.free(d);I.free(e);I.free(c)}a.Rb=!0;c=a.Lg;b&&a.Xf!==pi&&(c=a.Xf);d=c!==pi?Yi(a,c):a.scale;c=a.viewportBounds.copy();e=a.wa/d;var f=a.va/d,g=a.lj,h=a.Xn;b&&!g.eb()&&(h.eb()||
h.Mb())&&(g=h.Mb()?Ac:h);Zi(a,a.documentBounds,e,f,g,b);b=a.scale;a.scale=d;a.Rb=!1;d=a.viewportBounds;d.Ma(c)||a.Bq(c,d,b,!1);$i(a);aj(a,!0,!1)}}
function Yi(a,b){var c=a.yn;if(null===a.sa)return c;Li(a);var d=a.documentBounds;if(!d.u())return c;var e=d.width;d=d.height;var f=a.wa+(a.Te?a.jb:0),g=a.va+(a.ie?a.jb:0),h=f/e,k=g/d;return b===bj?(b=Math.min(k,h),b>c&&(b=c),b<a.minScale&&(b=a.minScale),b>a.maxScale&&(b=a.maxScale),b):b===cj?(b=k>h?(g-a.jb)/d:(f-a.jb)/e,b>c&&(b=c),b<a.minScale&&(b=a.minScale),b>a.maxScale&&(b=a.maxScale),b):a.scale}
R.prototype.zoomToFit=function(){var a=this.Gi;this.Gi=Xh;this.scale=Yi(this,bj);a!==Xh&&(Xi(this,!1),Zi(this,this.documentBounds,this.wa/this.ya,this.va/this.ya,this.lj,!1));this.Gi=a};t=R.prototype;
t.EA=function(a,b){void 0===b&&(b=bj);var c=a.width,d=a.height;if(!(0===c||0===d||isNaN(c)&&isNaN(d))){var e=1;if(b===bj||b===cj)if(isNaN(c))e=this.viewportBounds.height*this.scale/d;else if(isNaN(d))e=this.viewportBounds.width*this.scale/c;else{e=this.wa;var f=this.va;e=b===cj?f/d>e/c?(f-(this.ie?this.jb:0))/d:(e-(this.Te?this.jb:0))/c:Math.min(f/d,e/c)}this.scale=e;this.position=new I(a.x,a.y)}};
t.My=function(a,b){Li(this);var c=this.documentBounds,d=this.viewportBounds;this.position=new I(c.x+(a.x*c.width+a.offsetX)-(b.x*d.width-b.offsetX),c.y+(a.y*c.height+a.offsetY)-(b.y*d.height-b.offsetY))};t.Az=function(a){if(a instanceof Y){this.In=a;var b=I.alloc();this.Jn=this.Nq(a.ga(vc,b));I.free(b)}else this.In=null,this.Jn=Kb};
function Zi(a,b,c,d,e,f){var g=I.allocAt(a.ma.x,a.ma.y),h=g.x,k=g.y;if(null!==a.In){var l=I.alloc();l=a.In.ga(vc,l);h=l.x-a.Jn.x/a.scale;k=l.y-a.Jn.y/a.scale;e=uc;I.free(l)}if(f||a.scrollMode===Xh)e.eb()&&(c>b.width&&(h=b.x+(e.x*b.width+e.offsetX)-(e.x*c-e.offsetX)),d>b.height&&(k=b.y+(e.y*b.height+e.offsetY)-(e.y*d-e.offsetY))),e=a.Fi,f=c-b.width,c<b.width+e.left+e.right?(h=Math.min(h+c/2,b.right+Math.max(f,e.right)-c/2),h=Math.max(h,b.left-Math.max(f,e.left)+c/2),h-=c/2):h>b.left?h=b.left:h<b.right-
c&&(h=b.right-c),c=d-b.height,d<b.height+e.top+e.bottom?(k=Math.min(k+d/2,b.bottom+Math.max(c,e.bottom)-d/2),k=Math.max(k,b.top-Math.max(c,e.top)+d/2),k-=d/2):k>b.top?k=b.top:k<b.bottom-d&&(k=b.bottom-d);g.x=isFinite(h)?h:-a.bb.left;g.y=isFinite(k)?k:-a.bb.top;null!==a.positionComputation&&(b=a.positionComputation(a,g),g.x=b.x,g.y=b.y);a.Jc.qc&&Qh(a.Jc,a.ma,g);a.ma.h(g.x,g.y);I.free(g)}
t.jm=function(a,b){void 0===b&&(b=!0);if(b){if(a=uf(this,a,function(a){return a.part},function(a){return a.canSelect()}),a instanceof U)return a}else if(a=uf(this,a,function(a){return a.part}),a instanceof U)return a;return null};t.Ub=function(a,b,c){void 0===b&&(b=null);void 0===c&&(c=null);Vi(this);for(var d=this.Ja.iteratorBackwards;d.next();){var e=d.value;if(e.visible&&(e=e.Ub(a,b,c),null!==e))return e}return null};
function uf(a,b,c,d){void 0===c&&(c=null);void 0===d&&(d=null);Vi(a);for(a=a.Ja.iteratorBackwards;a.next();){var e=a.value;if(e.visible&&!e.isTemporary&&(e=e.Ub(b,c,d),null!==e))return e}return null}t.nz=function(a,b,c){void 0===b&&(b=!0);return dj(this,a,function(a){return a.part},b?function(a){return a instanceof U&&a.canSelect()}:null,c)};
function dj(a,b,c,d,e){void 0===c&&(c=null);void 0===d&&(d=null);e instanceof E||e instanceof F||(e=new F);Vi(a);for(a=a.Ja.iteratorBackwards;a.next();){var f=a.value;f.visible&&!f.isTemporary&&f.Ti(b,c,d,e)}return e}t.Ti=function(a,b,c,d){void 0===b&&(b=null);void 0===c&&(c=null);d instanceof E||d instanceof F||(d=new F);Vi(this);for(var e=this.Ja.iteratorBackwards;e.next();){var f=e.value;f.visible&&f.Ti(a,b,c,d)}return d};
t.Mx=function(a,b,c,d){void 0===b&&(b=!1);void 0===c&&(c=!0);return ej(this,a,function(a){return a instanceof U&&(!c||a.canSelect())},b,d)};t.uf=function(a,b,c,d,e){void 0===b&&(b=null);void 0===c&&(c=null);void 0===d&&(d=!1);e instanceof E||e instanceof F||(e=new F);Vi(this);for(var f=this.Ja.iteratorBackwards;f.next();){var g=f.value;g.visible&&g.uf(a,b,c,d,e)}return e};
t.vv=function(a,b,c,d,e,f){var g=new F;Vi(this);for(var h=this.Ja.iteratorBackwards;h.next();){var k=h.value;k.visible&&k.vv(a,b,c,d,g,e,f)}return g};function ej(a,b,c,d,e){var f=null;void 0===f&&(f=null);void 0===c&&(c=null);void 0===d&&(d=!1);e instanceof E||e instanceof F||(e=new F);Vi(a);for(a=a.Ja.iteratorBackwards;a.next();){var g=a.value;g.visible&&!g.isTemporary&&g.uf(b,f,c,d,e)}return e}
t.oz=function(a,b,c,d,e){void 0===c&&(c=!0);void 0===d&&(d=!0);return fj(this,a,b,function(a){return a instanceof U&&(!d||a.canSelect())},c,e)};t.Ag=function(a,b,c,d,e,f){void 0===c&&(c=null);void 0===d&&(d=null);void 0===e&&(e=!0);if(!1!==e&&!0!==e){if(e instanceof E||e instanceof F)f=e;e=!0}f instanceof E||f instanceof F||(f=new F);Vi(this);for(var g=this.Ja.iteratorBackwards;g.next();){var h=g.value;h.visible&&h.Ag(a,b,c,d,e,f)}return f};
function fj(a,b,c,d,e,f){var g=null;void 0===g&&(g=null);void 0===d&&(d=null);void 0===e&&(e=!0);if(!1!==e&&!0!==e){if(e instanceof E||e instanceof F)f=e;e=!0}f instanceof E||f instanceof F||(f=new F);Vi(a);for(a=a.Ja.iteratorBackwards;a.next();){var h=a.value;h.visible&&!h.isTemporary&&h.Ag(b,c,g,d,e,f)}return f}R.prototype.acceptEvent=function(a){return gj(this,a,a instanceof MouseEvent)};
function gj(a,b,c){var d=a.Qd;a.Qd=a.dh;a.dh=d;d.diagram=a;d.event=b;c?hj(a,b,d):(d.viewPoint=a.Qd.viewPoint,d.documentPoint=a.Qd.documentPoint);a=0;b.ctrlKey&&(a+=1);b.altKey&&(a+=2);b.shiftKey&&(a+=4);b.metaKey&&(a+=8);d.modifiers=a;d.button=b.button;void 0===b.buttons||Sa||(d.buttons=b.buttons);Wa&&0===b.button&&b.ctrlKey&&(d.button=2);d.down=!1;d.up=!1;d.clickCount=1;d.delta=0;d.handled=!1;d.bubbles=!1;d.timestamp=b.timeStamp;d.isMultiTouch=!1;d.targetDiagram=ij(b);d.targetObject=null;return d}
function ij(a){var b=a.target.B;if(!b){var c=a.path;c||"function"!==typeof a.composedPath||(c=a.composedPath());c&&c[0]&&(b=c[0].B)}return b?b:null}function jj(a,b,c,d){var e=kj(a,b,!0,!1,!0,d);hj(a,c,e);e.targetDiagram=ij(b);e.targetObject=null;d||e.clone(a.Uf);return e}
function lj(a,b,c,d){var e;d=kj(a,b,!1,!1,!1,d);null!==c?((e=x.document.elementFromPoint(c.clientX,c.clientY))&&e.B?(b=c,c=e.B):(b=void 0!==b.targetTouches?b.targetTouches[0]:b,c=a),d.targetDiagram=c,hj(a,b,d)):null!==a.Qd?(d.documentPoint=a.Qd.documentPoint,d.viewPoint=a.Qd.viewPoint,d.targetDiagram=a.Qd.targetDiagram):null!==a.Uf&&(d.documentPoint=a.Uf.documentPoint,d.viewPoint=a.Uf.viewPoint,d.targetDiagram=a.Uf.targetDiagram);d.targetObject=null;return d}
function kj(a,b,c,d,e,f){var g=a.Qd;a.Qd=a.dh;a.dh=g;g.diagram=a;g.clickCount=1;var h=g.delta=0;b.ctrlKey&&(h+=1);b.altKey&&(h+=2);b.shiftKey&&(h+=4);b.metaKey&&(h+=8);g.modifiers=h;g.button=0;g.buttons=1;g.event=b;g.timestamp=b.timeStamp;a.Vm&&b instanceof x.PointerEvent&&"touch"!==b.pointerType&&(g.button=b.button,void 0===b.buttons||Sa||(g.buttons=b.buttons),Wa&&0===b.button&&b.ctrlKey&&(g.button=2));g.down=c;g.up=d;g.handled=!1;g.bubbles=e;g.isMultiTouch=f;return g}
function mj(a,b){if(a.bubbles)return!0;void 0!==b.stopPropagation&&b.stopPropagation();!1!==b.cancelable&&b.preventDefault();b.cancelBubble=!0;return!1}
R.prototype.Xz=function(a){var b=this.B;if(!this.B.isEnabled)return!1;var c=gj(b,a,!1);c.key=String.fromCharCode(a.which);c.down=!0;switch(a.which){case 8:c.key="Backspace";break;case 33:c.key="PageUp";break;case 34:c.key="PageDown";break;case 35:c.key="End";break;case 36:c.key="Home";break;case 37:c.key="Left";break;case 38:c.key="Up";break;case 39:c.key="Right";break;case 40:c.key="Down";break;case 45:c.key="Insert";break;case 46:c.key="Del";break;case 48:c.key="0";break;case 187:case 61:case 107:c.key=
"Add";break;case 189:case 173:case 109:c.key="Subtract";break;case 27:c.key="Esc"}b.doKeyDown();return mj(c,a)};
R.prototype.Yz=function(a){var b=this.B;if(!b.isEnabled)return!1;var c=gj(b,a,!1);c.key=String.fromCharCode(a.which);c.up=!0;switch(a.which){case 8:c.key="Backspace";break;case 33:c.key="PageUp";break;case 34:c.key="PageDown";break;case 35:c.key="End";break;case 36:c.key="Home";break;case 37:c.key="Left";break;case 38:c.key="Up";break;case 39:c.key="Right";break;case 40:c.key="Down";break;case 45:c.key="Insert";break;case 46:c.key="Del"}b.doKeyUp();return mj(c,a)};
R.prototype.dz=function(a){var b=this.B;if(!b.isEnabled)return!1;var c=gj(b,a,!0);null!==b.mouseEnter&&b.mouseEnter(c);return mj(c,a)};R.prototype.ez=function(a){var b=this.B;if(!b.isEnabled)return!1;var c=gj(b,a,!0);null!==b.mouseLeave&&b.mouseLeave(c);return mj(c,a)};
R.prototype.getMouse=function(a){var b=this.sa;if(null===b)return new I(0,0);var c=b.getBoundingClientRect();b=a.clientX-this.wa/c.width*c.left;a=a.clientY-this.va/c.height*c.top;return null!==this.kb?Ab(new I(b,a),this.kb):new I(b,a)};
function hj(a,b,c){var d=a.sa,e=a.wa,f=a.va,g=0,h=0;null!==d&&(d=d.getBoundingClientRect(),g=b.clientX-e/d.width*d.left,h=b.clientY-f/d.height*d.top);c.viewPoint.h(g,h);null!==a.kb?(b=I.allocAt(g,h),a.kb.Wd(b),c.documentPoint.assign(b),I.free(b)):c.documentPoint.h(g,h)}
function re(a,b,c,d){if(void 0!==b.targetTouches){if(2>b.targetTouches.length)return;b=b.targetTouches[c]}else if(null!==a.Kj[0])b=a.Kj[c];else return;c=a.sa;null!==c&&(c=c.getBoundingClientRect(),d.h(b.clientX-a.wa/c.width*c.left,b.clientY-a.va/c.height*c.top))}t=R.prototype;t.Na=function(){this.ki||(this.ki=!0,this.Pb(!0))};function nj(a){a.Bc||Vi(a);Li(a)}t.Fe=function(){this.Rb||this.Bc||(this.M(),$i(this),Ui(this),this.Na(),this.Wc())};t.Wz=function(){return this.xe};
t.Zy=function(a){void 0===a&&(a=null);var b=this.animationManager,c=b.isEnabled;b.Xc();b.isEnabled=!1;Hf(this);this.je=!1;b.isEnabled=c;null!==a&&sa(function(){Bh(b,"Model");a()},1)};t.Pb=function(a){void 0===a&&(a=!1);if(!0!==this.xe&&!(this.Rb||!1===a&&this.Bc)){this.xe=!0;var b=this;x.requestAnimationFrame(function(){b.xe&&b.Wc()})}};t.Wc=function(){if(!this.sj||this.xe)this.sj&&(this.sj=!1),Hf(this)};
function aj(a,b,c){a.animationManager.defaultAnimation.isAnimating||a.Rb||!a.li||Si(a)||(b&&Vi(a),c&&Xi(a,!1))}
function Hf(a,b){if(!a.Bc&&(a.xe=!1,null!==a.La||a.Zl.u())){a.Bc=!0;var c=a.animationManager,d=a.ss;if(!c.isAnimating&&0!==d.length){for(var e=d.j,f=e.length,g=0;g<f;g++){var h=e[g];oj(h,!1);h.o()}d.clear()}d=a.tu;0<d.count&&(d.each(function(a){a.uw()}),d.clear());e=d=!1;c.isAnimating&&(e=!0,d=a.skipsUndoManager,a.skipsUndoManager=!0);c.qc||Gh(a);aj(a,!1,!1);null!==a.Fb&&(a.Fb.visible&&!a.Un&&(pj(a),a.Un=!0),!a.Fb.visible&&a.Un&&(a.Un=!1));Vi(a);f=!1;if(!a.je||a.If)a.je?qj(a,!a.pj):(a.ua("Initial Layout"),
!1===c.isEnabled&&c.Xc(),qj(a,!1)),f=!0;a.pj=!1;Vi(a);a.Ls||nj(a);aj(a,!0,!1);g=!1;f?(a.je||(g=a.je=!0,rj(a)),a.R("LayoutCompleted")):c.gl&&c.px&&(a.Xf!==pi?a.scale=Yi(a,a.Xf):a.Lg!==pi?a.scale=Yi(a,a.Lg):(c=a.initialScale,isFinite(c)&&0<c&&(a.scale=c)),Xi(a,!0));Vi(a);f&&g&&(a.Ua("Initial Layout"),a.skipsUndoManager||a.undoManager.clear(),sa(function(){a.isModified=!1},1));a.hv();b||a.bc(a.Db);e&&(a.skipsUndoManager=d);a.Bc=!1}}
function rj(a){var b=a.ya;if(a.Xf!==pi)a.scale=Yi(a,a.Xf);else if(a.Lg!==pi)a.scale=Yi(a,a.Lg);else{var c=a.initialScale;isFinite(c)&&0<c&&(a.scale=c)}a.ya!==b&&($i(a),aj(a,!0,!1));Xi(a,!0);a.Ou.assign(a.ma);b=a.Ja.j;a.zd(b,b.length,a);a.R("InitialLayoutCompleted");pj(a)}
function Vi(a){if((a.Bc||!a.animationManager.isTicking)&&0!==a.od.count){for(var b=0;23>b;b++){var c=a.od.iterator;if(null===c||0===a.od.count)break;a.od=new F;a.uw(c,a.od)}a.nodes.each(function(a){a instanceof T&&0!==(a.P&65536)!==!1&&(a.P=a.P^65536)})}}
t.uw=function(a,b){for(a.reset();a.next();){var c=a.value;!c.Wb()||c instanceof T||(c.bj()?(c.measure(Infinity,Infinity),c.arrange()):b.add(c))}for(a.reset();a.next();)c=a.value,c instanceof T&&c.isVisible()&&sj(this,c);for(a.reset();a.next();)c=a.value,c instanceof S&&c.isVisible()&&(c.bj()?(c.measure(Infinity,Infinity),c.arrange()):b.add(c));for(a.reset();a.next();)c=a.value,c instanceof Ke&&c.isVisible()&&(c.bj()?(c.measure(Infinity,Infinity),c.arrange()):b.add(c))};
function sj(a,b){for(var c=Fa(),d=Fa(),e=b.memberParts;e.next();){var f=e.value;f.isVisible()&&(f instanceof T?(tj(f)||uj(f)||vj(f))&&sj(a,f):f instanceof S?f.fromNode===b||f.toNode===b?d.push(f):c.push(f):(f.measure(Infinity,Infinity),f.arrange()))}a=c.length;for(e=0;e<a;e++)f=c[e],f.measure(Infinity,Infinity),f.arrange();Ha(c);b.measure(Infinity,Infinity);b.arrange();a=d.length;for(b=0;b<a;b++)c=d[b],c.measure(Infinity,Infinity),c.arrange();Ha(d)}
t.zd=function(a,b,c,d){if(this.mi||this.animationManager.isAnimating)for(var e=0;e<b;e++)a[e].zd(c,d)};
t.bc=function(a,b){void 0===b&&(b=null);if(null!==this.La){null===this.sa&&B("No canvas specified");var c=this.animationManager;if(!c.qc&&(!c.isAnimating||c.isTicking)){var d=new Date;wj(this);if("0"!==this.La.style.opacity){var e=a!==this.Db,f=this.Ja.j,g=f.length,h=this;this.zd(f,g,h);if(e)a.sc(!0),Ui(this);else if(!this.Ac&&null===b&&!c.isAnimating)return;g=this.ma;var k=this.ya,l=Math.round(g.x*k)/k,m=Math.round(g.y*k)/k;c=this.kb;c.reset();1!==k&&c.scale(k);0===g.x&&0===g.y||c.translate(-l,-m);
k=this.Sb;a.setTransform(1,0,0,1,0,0);a.scale(k,k);a.clearRect(0,0,this.wa,this.va);a.setTransform(1,0,0,1,0,0);a.scale(k,k);a.transform(c.m11,c.m12,c.m21,c.m22,c.dx,c.dy);xj(this,a);a.globalAlpha=this.qb;l=null!==b?function(c){var d=b;if(c.visible&&0!==c.qb){var e=c.Ca.j,f=e.length;if(0!==f){var g=ji(c,a),k=c.Yo;k.length=0;for(var l=h.scale,m=N.alloc(),n=0;n<f;n++){var A=e[n];d.contains(A)||c.Pi(a,A,h,k,l,m)}N.free(m);a.globalAlpha=g}}}:function(b){b.bc(a,h)};g=f.length;for(m=0;m<g;m++)a.setTransform(1,
0,0,1,0,0),a.scale(k,k),a.transform(c.m11,c.m12,c.m21,c.m22,c.dx,c.dy),l(f[m]);this.ji&&yj(this.ji,this)&&this.zr();e?(this.Db.sc(!0),Ui(this)):this.Ac=this.mi=!1;e=+new Date-+d;if(null===this.uh){d=this.Jo;d[this.Ko]=e;this.Ko=(this.Ko+1)%d.length;for(f=e=0;f<this.Jo.length;f++)e+=this.Jo[f];this.Io=e/d.length}}}}};
function zj(a,b,c,d,e,f,g,h,k,l){if(null!==a.La){null===a.sa&&B("No canvas specified");void 0===g&&(g=null);void 0===h&&(h=null);void 0===k&&(k=!1);void 0===l&&(l=!1);wj(a);a.Db.sc(!0);Ui(a);a.ni=!0;var m=a.ya;a.ya=e;var n=a.Ja.j,p=n.length;try{var r=new N(f.x,f.y,d.width/e,d.height/e),q=r.copy();q.cq(c);pj(a,q);Vi(a);a.zd(n,p,a,r);var u=a.Sb;b.setTransform(1,0,0,1,0,0);b.scale(u,u);b.clearRect(0,0,d.width,d.height);null!==h&&""!==h&&(b.fillStyle=h,b.fillRect(0,0,d.width,d.height));var v=qd.alloc();
v.reset();v.translate(c.left,c.top);v.scale(e);0===f.x&&0===f.y||v.translate(-f.x,-f.y);b.setTransform(v.m11,v.m12,v.m21,v.m22,v.dx,v.dy);qd.free(v);xj(a,b);b.globalAlpha=a.qb;if(null!==g){var w=new F,y=g.iterator;for(y.reset();y.next();){var z=y.value;!1===l&&"Grid"===z.layer.name||null===z||w.add(z)}var A=function(c){if(c.visible&&0!==c.qb&&(k||!c.isTemporary)){var d=c.Ca.j,e=d.length;if(0!==e){var f=ji(c,b),g=c.Yo;g.length=0;for(var h=a.scale,l=N.alloc(),m=0;m<e;m++){var n=d[m];w.contains(n)&&
c.Pi(b,n,a,g,h,l)}N.free(l);b.globalAlpha=f}}}}else if(!k&&l){var C=a.grid.part,H=C.layer;A=function(c){c===H?C.bc(b,a):c.bc(b,a,k)}}else A=function(c){c.bc(b,a,k)};for(c=0;c<p;c++)A(n[c]);a.ni=!1;a.ji&&yj(a.ji,a)&&a.zr()}finally{a.ya=m,a.Db.sc(!0),Ui(a),a.zd(n,p,a),pj(a)}}}t.Ce=function(a){return this.cf[a]};t.ly=function(a,b){"minDrawingLength"===a&&(this.Bo=b);this.cf[a]=b;this.Fe()};
t.bw=function(){this.cf=new db;this.cf.drawShadows=!0;this.cf.textGreeking=!0;this.cf.viewportOptimizations=Xa||Ta||Ua?!1:!0;this.cf.temporaryPixelRatio=!0;this.cf.pictureRatioOptimization=!0;this.Bo=this.cf.minDrawingLength=1};function xj(a,b){a=a.cf;null!==a&&(void 0!==a.imageSmoothingEnabled&&b.ky(!!a.imageSmoothingEnabled),a=a.defaultFont,void 0!==a&&null!==a&&(b.font=a))}t.mm=function(a){return this.vj[a]};t.tA=function(a,b){this.vj[a]=b};
t.aw=function(){this.vj=new db;this.vj.extraTouchArea=10;this.vj.extraTouchThreshold=10;this.vj.hasGestureZoom=!0};t.iw=function(a){Aj(this,a)};
function Aj(a,b){var c=a instanceof X,d=a instanceof R,e;for(e in b){""===e&&B("Setting properties requires non-empty property names");var f=a,g=e;if(c||d){var h=e.indexOf(".");if(0<h){var k=e.substring(0,h);if(c)f=a.Xa(k);else if(f=a[k],void 0===f||null===f)f=a.toolManager[k];za(f)?g=e.substr(h+1):B("Unable to find object named: "+k+" in "+a.toString()+" when trying to set property: "+e)}}if("_"!==g[0]&&!Ka(f,g))if(d&&"ModelChanged"===g){a.vx(b[g]);continue}else if(d&&"Changed"===g){a.Dh(b[g]);continue}else if(d&&
Ka(a.toolManager,g))f=a.toolManager;else if(d&&Bj(a,g)){a.Uj(g,b[g]);continue}else if(a instanceof Z&&"Changed"===g){a.Dh(b[g]);continue}else B('Trying to set undefined property "'+g+'" on object: '+f.toString());f[g]=b[e];"_"===g[0]&&f instanceof Y&&f.sx(g)}}t.hv=function(){if(0===this.undoManager.transactionLevel&&0!==this.Sg.count){for(;0<this.Sg.count;){var a=this.Sg;this.Sg=new G;for(a=a.iterator;a.next();){var b=a.key;b.tq(a.value);b.cc()}}this.M()}};
t.M=function(a){void 0===a&&(a=null);if(null===a)this.Ac=!0,this.Pb();else{var b=this.viewportBounds;null!==a&&a.u()&&b.Gc(a)&&(this.Ac=!0,this.Pb())}this.R("InvalidateDraw")};
t.Sx=function(a,b){if(!0!==this.Ac){this.Ac=!0;var c=!0===this.Ce("temporaryPixelRatio");if(!0===this.Ce("viewportOptimizations")&&this.scrollMode!==Zh&&this.Fi.Ri(0,0,0,0)&&b.width===a.width&&b.height===a.height){var d=this.scale,e=Math.max(a.x,b.x),f=Math.max(a.y,b.y);d=N.allocAt(e,f,Math.max(0,Math.min(a.x+a.width,b.x+b.width)-e)*d,Math.max(0,Math.min(a.y+a.height,b.y+b.height)-f)*d);if(!this.Pp&&0<d.width&&0<d.height){if(!(this.Bc||(this.xe=!1,null===this.La||(this.Bc=!0,this.hv(),this.documentBounds.u()||
Cj(this,this.computeBounds()),e=this.sa,null===e||e instanceof Dj)))){var g=this.Sb;f=this.wa*g;var h=this.va*g,k=this.scale*g,l=Math.round(Math.round(b.x*k)-Math.round(a.x*k));b=Math.round(Math.round(b.y*k)-Math.round(a.y*k));k=this.ku;a=this.Rw;k.width!==f&&(k.width=f);k.height!==h&&(k.height=h);a.clearRect(0,0,f,h);k=190*g;var m=70*g,n=Math.max(l,0),p=Math.max(b,0),r=Math.floor(f-n),q=Math.floor(h-p);a.drawImage(e.Ea,n,p,r,q,0,0,r,q);yj(this.ji,this)&&a.clearRect(0,0,k,m);e=Fa();a=Fa();q=Math.abs(l);
r=Math.abs(b);var u=0===n?0:f-q;n=I.allocAt(u,0);q=I.allocAt(q+u,h);a.push(new N(Math.min(n.x,q.x),Math.min(n.y,q.y),Math.abs(n.x-q.x),Math.abs(n.y-q.y)));var v=this.kb;v.reset();v.scale(g,g);1!==this.ya&&v.scale(this.ya);g=this.ma;(0!==g.x||0!==g.y)&&isFinite(g.x)&&isFinite(g.y)&&v.translate(-g.x,-g.y);Ab(n,v);Ab(q,v);e.push(new N(Math.min(n.x,q.x),Math.min(n.y,q.y),Math.abs(n.x-q.x),Math.abs(n.y-q.y)));u=0===p?0:h-r;n.h(0,u);q.h(f,r+u);a.push(new N(Math.min(n.x,q.x),Math.min(n.y,q.y),Math.abs(n.x-
q.x),Math.abs(n.y-q.y)));Ab(n,v);Ab(q,v);e.push(new N(Math.min(n.x,q.x),Math.min(n.y,q.y),Math.abs(n.x-q.x),Math.abs(n.y-q.y)));yj(this.ji,this)&&(f=0<l?0:-l,h=0<b?0:-b,n.h(f,h),q.h(k+f,m+h),a.push(new N(Math.min(n.x,q.x),Math.min(n.y,q.y),Math.abs(n.x-q.x),Math.abs(n.y-q.y))),Ab(n,v),Ab(q,v),e.push(new N(Math.min(n.x,q.x),Math.min(n.y,q.y),Math.abs(n.x-q.x),Math.abs(n.y-q.y))));I.free(n);I.free(q);aj(this,!1,!0);null===this.La&&B("No div specified");null===this.sa&&B("No canvas specified");if(!this.animationManager.qc&&
(f=this.Db,this.Ac)){wj(this);h=this.Sb;f.setTransform(1,0,0,1,0,0);f.clearRect(0,0,this.wa*h,this.va*h);f.drawImage(this.ku.Ea,0<l?0:Math.round(-l),0<b?0:Math.round(-b));l=this.ma;g=this.ya;k=Math.round(l.x*g)/g;m=Math.round(l.y*g)/g;b=this.kb;b.reset();1!==g&&b.scale(g);0===l.x&&0===l.y||b.translate(-k,-m);f.save();f.beginPath();l=a.length;for(g=0;g<l;g++)k=a[g],0!==k.width&&0!==k.height&&f.rect(Math.floor(k.x),Math.floor(k.y),Math.ceil(k.width),Math.ceil(k.height));f.clip();f.setTransform(1,0,
0,1,0,0);f.scale(h,h);f.transform(b.m11,b.m12,b.m21,b.m22,b.dx,b.dy);b=this.Ja.j;l=b.length;this.zd(b,l,this);xj(this,f);f.globalAlpha=this.qb;for(h=0;h<l;h++)if(g=b[h],k=e,g.visible&&0!==g.qb){m=ji(g,f);p=g.Yo;p.length=0;n=this.scale;r=N.alloc();q=g.Ca.j;v=q.length;u=k.length;for(var w=0;w<v;w++){var y=q[w],z=Ej(y,y.actualBounds);a:{for(var A=2/n,C=4/n,H=0;H<u;H++){var L=k[H];if(0!==L.width&&0!==L.height&&z.Fv(L.x-A,L.y-A,L.width+C,L.height+C)){z=!0;break a}}z=!1}z&&g.Pi(f,y,this,p,n,r)}N.free(r);
f.globalAlpha=m}f.restore();f.sc(!0);this.ji&&yj(this.ji,this)&&this.zr();this.Ac=this.mi=!1;this.Ht()}Ha(e);Ha(a);this.Bc=!1}}else this.Wc();N.free(d);c&&(Ve(this),this.Wc(),jf(this,!0))}else c?(Ve(this),this.Wc(),jf(this,!0)):this.Wc()}};function $i(a){!1===a.li&&(a.li=!0)}function Ui(a){!1===a.mi&&(a.mi=!0)}function wj(a){!1!==a.ll&&(a.ll=!1,Fj(a,a.wa,a.va))}function Fj(a,b,c){var d=a.Sb;a.sa.resize(b*d,c*d,b,c)&&(a.Ac=!0,a.Db.sc(!0))}
function Si(a){var b=a.sa;if(null===b)return!0;var c=a.La,d=a.wa,e=a.va,f=a.$u.copy();if(!f.u())return!0;var g=!1,h=a.Te?a.jb:0,k=a.ie?a.jb:0,l=c.clientWidth||d+h,m=c.clientHeight||e+k;if(l!==d+h||m!==e+k)a.Te=!1,a.ie=!1,k=h=0,a.wa=l,a.va=m,g=a.ll=!0;if(!(g||a.Te||a.ie||a.cl||a.dl))return!0;a.li=!1;var n=a.viewportBounds,p=a.documentBounds,r=0,q=0,u=0,v=0;c=n.width;var w=n.height,y=a.Fi;a.contentAlignment.eb()?(p.width>c&&(r=y.left,q=y.right),p.height>w&&(u=y.top,v=y.bottom)):(r=y.left,q=y.right,
u=y.top,v=y.bottom);y=p.width+r+q;var z=p.height+u+v;r=p.x-r;var A=n.x;q=p.right+q;var C=n.right+h;u=p.y-u;var H=n.y;p=p.bottom+v;n=n.bottom+k;var L="1px",K="1px";v=a.scale;l=y>l/v;m=z>m/v;a.scrollMode===Xh&&(l||m)&&(l&&a.hasHorizontalScrollbar&&a.allowHorizontalScroll&&(l=1,r+1<A&&(l=Math.max((A-r)*v+a.wa,l)),q>C+1&&(l=Math.max((q-C)*v+a.wa,l)),c+h+1<y&&(l=Math.max((y-c)*v+a.wa,l)),L=l.toString()+"px"),m&&a.hasVerticalScrollbar&&a.allowVerticalScroll&&(l=1,u+1<H&&(l=Math.max((H-u)*v+a.va,l)),p>n+
1&&(l=Math.max((p-n)*v+a.va,l)),w+k+1<z&&(l=Math.max((z-w)*v+a.va,l)),K=l.toString()+"px"));l="1px"!==L;m="1px"!==K;l&&m||!l&&!m||(m&&(C-=a.jb),l&&(n-=a.jb),y<c+h||!a.hasHorizontalScrollbar||!a.allowHorizontalScroll||(h=1,r+1<A&&(h=Math.max((A-r)*v+a.wa,h)),q>C+1&&(h=Math.max((q-C)*v+a.wa,h)),c+1<y&&(h=Math.max((y-c)*v+a.wa,h)),L=h.toString()+"px"),l="1px"!==L,h=a.va,l!==a.ie&&(h=l?a.va-a.jb:a.va+a.jb),z<w+k||!a.hasVerticalScrollbar||!a.allowVerticalScroll||(k=1,u+1<H&&(k=Math.max((H-u)*v+h,k)),p>
n+1&&(k=Math.max((p-n)*v+h,k)),w+1<z&&(k=Math.max((z-w)*v+h,k)),K=k.toString()+"px"),m="1px"!==K);if(a.vp&&l===a.ie&&m===a.Te)return d===a.wa&&e===a.va||a.Wc(),!1;l!==a.ie&&("1px"===L?a.va=a.va+a.jb:a.va=Math.max(a.va-a.jb,1),g=!0);a.ie=l;a.wp.style.width=L;m!==a.Te&&("1px"===K?a.wa=a.wa+a.jb:a.wa=Math.max(a.wa-a.jb,1),g=!0,a.nl&&(k=I.alloc(),m?(b.style.left=a.jb+"px",a.position=k.h(a.ma.x+a.jb/a.scale,a.ma.y)):(b.style.left="0px",a.position=k.h(a.ma.x-a.jb/a.scale,a.ma.y)),I.free(k)));a.Te=m;a.wp.style.height=
K;a.Bs=!0;g&&(a.ll=!0);b=a.Es;k=b.scrollLeft;a.hasHorizontalScrollbar&&a.allowHorizontalScroll&&(c+1<y?k=(a.position.x-r)*v:r+1<A?k=b.scrollWidth-b.clientWidth:q>C+1&&(k=a.position.x*v));if(a.nl)switch(a.zs){case "negative":k=-(b.scrollWidth-k-b.clientWidth);break;case "reverse":k=b.scrollWidth-k-b.clientWidth}b.scrollLeft=k;a.hasVerticalScrollbar&&a.allowVerticalScroll&&(w+1<z?b.scrollTop=(a.position.y-u)*v:u+1<H?b.scrollTop=b.scrollHeight-b.clientHeight:p>n+1&&(b.scrollTop=a.position.y*v));l=a.wa;
m=a.va;b.style.width=l+(a.Te?a.jb:0)+"px";b.style.height=m+(a.ie?a.jb:0)+"px";return d!==l||e!==m||a.animationManager.qc?(a.Bq(f,a.viewportBounds,v,g),!1):!0}
t.add=function(a){var b=a.diagram;if(b!==this&&(null!==b&&B("Cannot add part "+a.toString()+" to "+this.toString()+". It is already a part of "+b.toString()),b=this.im(a.layerName),null===b&&(b=this.im("")),null===b&&B('Cannot add a Part when unable find a Layer named "'+a.layerName+'" and there is no default Layer'),a.layer!==b)){var c=b.aj(99999999,a,a.diagram===this);0<=c&&this.Ya(we,"parts",b,null,a,null,c);b.isTemporary||this.Na();a.C(1);c=a.layerChanged;null!==c&&c(a,null,b)}};
t.aj=function(a){this.partManager.aj(a);var b=this;Gj(a,function(a){Hj(b,a)});(a instanceof Ke||a instanceof T&&null!==a.placeholder)&&a.o();null!==a.data&&Gj(a,function(a){Ij(b.partManager,a)});!0!==uj(a)&&!0!==vj(a)||this.od.add(a);Jj(a,!0,this);Kj(a)?(a.actualBounds.u()&&this.M(Ej(a,a.actualBounds)),this.Na()):a.isVisible()&&a.actualBounds.u()&&this.M(Ej(a,a.actualBounds));this.Pb()};
t.Fc=function(a){a.Yj();this.partManager.Fc(a);var b=this;null!==a.data&&Gj(a,function(a){Lj(b.partManager,a,b)});this.od.remove(a);Kj(a)?(a.actualBounds.u()&&this.M(Ej(a,a.actualBounds)),this.Na()):a.isVisible()&&a.actualBounds.u()&&this.M(Ej(a,a.actualBounds));this.Pb()};t.remove=function(a){Mj(this,a,!0)};
function Mj(a,b,c){var d=b.layer;null!==d&&d.diagram===a&&(b.isSelected=!1,b.isHighlighted=!1,b.C(2),c&&b.dk(),c=d.Fc(-1,b,!1),0<=c&&a.Ya(xe,"parts",d,b,null,c,null),a=b.layerChanged,null!==a&&a(b,d,null))}t.Jt=function(a,b){if(Aa(a))for(var c=a.length,d=0;d<c;d++){var e=a[d];b&&!e.canDelete()||this.remove(e)}else for(c=new F,c.addAll(a),a=c.iterator;a.next();)c=a.value,b&&!c.canDelete()||this.remove(c)};t.ck=function(a,b,c){return this.partManager.ck(a,b,c)};
R.prototype.moveParts=function(a,b,c,d){void 0===d&&(d=Nj(this));if(null!==this.toolManager){var e=new G;if(null!==a)if(Aa(a))for(var f=0;f<a.length;f++)Oj(this,e,a[f],c,d);else for(a=a.iterator;a.next();)Oj(this,e,a.value,c,d);else{for(a=this.parts;a.next();)Oj(this,e,a.value,c,d);for(a=this.nodes;a.next();)Oj(this,e,a.value,c,d);for(a=this.links;a.next();)Oj(this,e,a.value,c,d)}rf(this,e,b,d,c)}};
function Oj(a,b,c,d,e,f){if(!b.contains(c)&&(void 0===f&&(f=!1),!d||f||c.canMove()||c.canCopy()))if(void 0===e&&(e=Nj(a)),c instanceof W){b.add(c,a.td(e,c,c.location));if(c instanceof T)for(f=c.memberParts;f.next();)Oj(a,b,f.value,d,e,e.Mz);for(f=c.linksConnected;f.next();){var g=f.value;if(!b.contains(g)){var h=g.fromNode,k=g.toNode;null!==h&&b.contains(h)&&null!==k&&b.contains(k)&&Oj(a,b,g,d,e)}}if(e.dragsTree)for(c=c.wv();c.next();)Oj(a,b,c.value,d,e)}else if(c instanceof S)for(b.add(c,a.td(e,
c)),c=c.labelNodes;c.next();)Oj(a,b,c.value,d,e);else c instanceof Ke||b.add(c,a.td(e,c,c.location))}
function rf(a,b,c,d,e){if(null!==b&&0!==b.count){var f=I.alloc(),g=I.alloc();g.assign(c);isNaN(g.x)&&(g.x=0);isNaN(g.y)&&(g.y=0);(c=a.Op)||We(a,b);for(var h=Fa(),k=Fa(),l=b.iterator,m=I.alloc();l.next();){var n=l.key,p=l.value;if(n.Wb()){var r=Pj(a,n,b);if(null!==r)h.push(new Qj(n,p,r));else if(!e||n.canMove())r=p.point,f.assign(r),a.computeMove(n,f.add(g),d,m),n.location=m,void 0===p.shifted&&(p.shifted=new I),p.shifted.assign(m.$d(r))}else l.key instanceof S&&k.push(l.la)}I.free(m);e=h.length;for(l=
0;l<e;l++)n=h[l],f.assign(n.info.point),void 0===n.Cv.shifted&&(n.Cv.shifted=new I),n.node.location=f.add(n.Cv.shifted);e=I.alloc();l=I.alloc();n=k.length;for(p=0;p<n;p++){var q=k[p];r=q.key;if(r instanceof S)if(r.suspendsRouting){r.oh=null;m=r.fromNode;var u=r.toNode;if(null!==a.draggedLink&&d.dragsLink)if(u=q.value.point,null===r.dragComputation)b.add(r,a.td(d,r,g)),pf(r,g.x-u.x,g.y-u.y);else{q=I.allocAt(0,0);(m=r.i(0))&&m.u()&&q.assign(m);var v=m=I.alloc().assign(q).add(g);d.isGridSnapEnabled&&
(d.isGridSnapRealtime||a.lastInput.up)&&(v=I.alloc(),Eg(a,r,m,v,d));m.assign(r.dragComputation(r,m,v)).$d(q);b.add(r,a.td(d,r,m));pf(r,m.x-u.x,m.y-u.y);I.free(q);I.free(m);v!==m&&I.free(v)}else null!==m&&(e.assign(m.location),v=b.H(m),null!==v&&e.$d(v.point)),null!==u&&(l.assign(u.location),v=b.H(u),null!==v&&l.$d(v.point)),null!==m&&null!==u?e.Ma(l)?(m=q.value.point,u=f,u.assign(e),u.$d(m),b.add(r,a.td(d,r,e)),pf(r,u.x,u.y)):(r.suspendsRouting=!1,r.Ta()):(q=q.value.point,m=null!==m?e:null!==u?l:
g,b.add(r,a.td(d,r,m)),pf(r,m.x-q.x,m.y-q.y))}else if(null===r.fromNode||null===r.toNode)m=q.value.point,b.add(r,a.td(d,r,g)),pf(r,g.x-m.x,g.y-m.y)}I.free(f);I.free(g);I.free(e);I.free(l);Ha(h);Ha(k);c||(Vi(a),ef(a,b))}}
R.prototype.computeMove=function(a,b,c,d){void 0===d&&(d=new I);d.assign(b);if(null===a)return d;var e=b,f=c.isGridSnapEnabled;f&&(c.isGridSnapRealtime||this.lastInput.up)&&(e=I.alloc(),Eg(this,a,b,e,c));c=null!==a.dragComputation?a.dragComputation(a,b,e):e;var g=a.minLocation,h=g.x;isNaN(h)&&(h=f?Math.round(a.location.x):a.location.x);g=g.y;isNaN(g)&&(g=f?Math.round(a.location.y):a.location.y);var k=a.maxLocation,l=k.x;isNaN(l)&&(l=f?Math.round(a.location.x):a.location.x);k=k.y;isNaN(k)&&(k=f?Math.round(a.location.y):
a.location.y);d.h(Math.max(h,Math.min(c.x,l)),Math.max(g,Math.min(c.y,k)));e!==b&&I.free(e);return d};function Nj(a){var b=a.toolManager.findTool("Dragging");return null!==b?b.dragOptions:a.Qk}
function Eg(a,b,c,d,e){void 0===e&&(e=Nj(a));d.assign(c);if(null!==b){var f=a.grid;b=e.gridSnapCellSize;a=b.width;b=b.height;var g=e.gridSnapOrigin,h=g.x;g=g.y;e=e.gridSnapCellSpot;if(null!==f){var k=f.gridCellSize;isNaN(a)&&(a=k.width);isNaN(b)&&(b=k.height);f=f.gridOrigin;isNaN(h)&&(h=f.x);isNaN(g)&&(g=f.y)}f=I.allocAt(0,0);f.xk(0,0,a,b,e);J.mq(c.x,c.y,h+f.x,g+f.y,a,b,d);I.free(f)}}function We(a,b){if(null!==b)for(a.Op=!0,a=b.iterator;a.next();)b=a.key,b instanceof S&&(b.suspendsRouting=!0)}
function ef(a,b){if(null!==b){for(b=b.iterator;b.next();){var c=b.key;c instanceof S&&(c.suspendsRouting=!1,Rj(c)&&c.Ta())}a.Op=!1}}function Pj(a,b,c){b=b.containingGroup;if(null!==b){a=Pj(a,b,c);if(null!==a)return a;a=c.H(b);if(null!==a)return a}return null}t=R.prototype;t.td=function(a,b,c){if(void 0===c)return new cf(Gb);var d=a.isGridSnapEnabled;a.Nz||null===b.containingGroup||(d=!1);return d?new cf(new I(Math.round(c.x),Math.round(c.y))):new cf(c.copy())};
function Sj(a,b,c){null!==b.diagram&&b.diagram!==a&&B("Cannot share a Layer with another Diagram: "+b+" of "+b.diagram);null===c?null!==b.diagram&&B("Cannot add an existing Layer to this Diagram again: "+b):(c.diagram!==a&&B("Existing Layer must be in this Diagram: "+c+" not in "+c.diagram),b===c&&B("Cannot move a Layer before or after itself: "+b));if(b.diagram!==a){b=b.name;a=a.Ja;c=a.count;for(var d=0;d<c;d++)a.L(d).name===b&&B("Cannot add Layer with the name '"+b+"'; a Layer with the same name is already present in this Diagram.")}}
t.$l=function(a){Sj(this,a,null);a.Zd(this);var b=this.Ja,c=b.count-1;if(!a.isTemporary)for(;0<=c&&b.L(c).isTemporary;)c--;b.Kb(c+1,a);null!==this.ac&&this.Ya(we,"layers",this,null,a,null,c+1);this.M();this.Na()};t.tx=function(a,b){Sj(this,a,b);a.Zd(this);var c=this.Ja,d=c.indexOf(a);0<=d&&(c.remove(a),null!==this.ac&&this.Ya(xe,"layers",this,a,null,d,null));var e=c.count,f;for(f=0;f<e;f++)if(c.L(f)===b){c.Kb(f,a);break}null!==this.ac&&this.Ya(we,"layers",this,null,a,null,f);this.M();0>d&&this.Na()};
t.Gy=function(a,b){Sj(this,a,b);a.Zd(this);var c=this.Ja,d=c.indexOf(a);0<=d&&(c.remove(a),null!==this.ac&&this.Ya(xe,"layers",this,a,null,d,null));var e=c.count,f;for(f=0;f<e;f++)if(c.L(f)===b){c.Kb(f+1,a);break}null!==this.ac&&this.Ya(we,"layers",this,null,a,null,f+1);this.M();0>d&&this.Na()};
t.mA=function(a){a.diagram!==this&&B("Cannot remove a Layer from another Diagram: "+a+" of "+a.diagram);if(""!==a.name){var b=this.Ja,c=b.indexOf(a);if(b.remove(a)){for(b=a.Ca.copy().iterator;b.next();){var d=b.value,e=d.layerName;e!==a.name?d.layerName=e:d.layerName=""}null!==this.ac&&this.Ya(xe,"layers",this,a,null,c,null);this.M();this.Na()}}};t.im=function(a){for(var b=this.layers;b.next();){var c=b.value;if(c.name===a)return c}return null};
t.vx=function(a){null===this.pe&&(this.pe=new E);this.pe.add(a);this.model.Dh(a)};t.oA=function(a){null!==this.pe&&(this.pe.remove(a),0===this.pe.count&&(this.pe=null));this.model.wk(a)};t.Dh=function(a){null===this.Mf&&(this.Mf=new E);this.Mf.add(a)};t.wk=function(a){null!==this.Mf&&(this.Mf.remove(a),0===this.Mf.count&&(this.Mf=null))};
t.bt=function(a){this.skipsUndoManager||this.model.skipsUndoManager||this.model.undoManager.Dv(a);a.change!==ve&&(this.isModified=!0);if(null!==this.Mf)for(var b=this.Mf,c=b.length,d=0;d<c;d++)b.L(d)(a)};t.Ya=function(a,b,c,d,e,f,g){void 0===f&&(f=null);void 0===g&&(g=null);var h=new te;h.diagram=this;h.change=a;h.propertyName=b;h.object=c;h.oldValue=d;h.oldParam=f;h.newValue=e;h.newParam=g;this.bt(h)};t.g=function(a,b,c,d,e){this.Ya(ue,a,this,b,c,d,e)};
R.prototype.changeState=function(a,b){if(null!==a&&a.diagram===this){var c=this.skipsModelSourceBindings;try{this.skipsModelSourceBindings=!0;var d=a.change;if(d===ue){var e=a.object;Tj(e,a.propertyName,a.H(b));if(e instanceof Y){var f=e.part;null!==f&&f.Lb()}this.isModified=!0}else if(d===we){var g=a.object,h=a.newParam,k=a.newValue;if(g instanceof X)if("number"===typeof h&&k instanceof Y){b?g.Fc(h):g.Kb(h,k);var l=g.part;null!==l&&l.Lb()}else{if("number"===typeof h&&k instanceof Uj)if(b)k.isRow?
g.Zv(h):g.Xv(h);else{var m=k.isRow?g.getRowDefinition(k.index):g.getColumnDefinition(k.index);m.et(k)}}else if(g instanceof gi){var n=!0===a.oldParam;"number"===typeof h&&k instanceof U&&(b?(k.isSelected=!1,k.isHighlighted=!1,k.Lb(),g.Fc(n?h:-1,k,n)):g.aj(h,k,n))}else g instanceof R?"number"===typeof h&&k instanceof gi&&(b?this.Ja.lb(h):(k.Zd(this),this.Ja.Kb(h,k))):B("unknown ChangedEvent.Insert object: "+a.toString());this.isModified=!0}else if(d===xe){var p=a.object,r=a.oldParam,q=a.oldValue;if(p instanceof
X)"number"===typeof r&&q instanceof Y?b?p.Kb(r,q):p.Fc(r):"number"===typeof r&&q instanceof Uj&&(b?(m=q.isRow?p.getRowDefinition(q.index):p.getColumnDefinition(q.index),m.et(q)):q.isRow?p.Zv(r):p.Xv(r));else if(p instanceof gi){var u=!0===a.newParam;"number"===typeof r&&q instanceof U&&(b?0>p.Ca.indexOf(q)&&p.aj(r,q,u):(q.isSelected=!1,q.isHighlighted=!1,q.Lb(),p.Fc(u?r:-1,q,u)))}else p instanceof R?"number"===typeof r&&q instanceof gi&&(b?(q.Zd(this),this.Ja.Kb(r,q)):this.Ja.lb(r)):B("unknown ChangedEvent.Remove object: "+
a.toString());this.isModified=!0}else d!==ve&&B("unknown ChangedEvent: "+a.toString())}finally{this.skipsModelSourceBindings=c}}};R.prototype.ua=function(a){return this.undoManager.ua(a)};R.prototype.Ua=function(a){return this.undoManager.Ua(a)};R.prototype.Bf=function(){return this.undoManager.Bf()};
R.prototype.commit=function(a,b){void 0===b&&(b="");var c=this.skipsUndoManager;null===b&&(this.skipsUndoManager=!0,b="");this.undoManager.ua(b);var d=!1;try{a(this),d=!0}finally{d?this.undoManager.Ua(b):this.undoManager.Bf(),this.skipsUndoManager=c}};R.prototype.updateAllTargetBindings=function(a){this.partManager.updateAllTargetBindings(a)};R.prototype.Pq=function(){this.partManager.Pq()};
function Vj(a,b,c){var d=a.animationManager;if(a.Rb||a.Bc)a.ya=c,d.$e&&d.Bd.add(d.B,"scale",b,a.ya);else if(a.Rb=!0,null===a.sa)a.ya=c;else{var e=a.viewportBounds.copy(),f=a.wa,g=a.va;e.width=a.wa/b;e.height=a.va/b;var h=a.zoomPoint.x,k=a.zoomPoint.y,l=a.contentAlignment;isNaN(h)&&(l.gd()?l.xf(Ic)?h=0:l.xf(Jc)&&(h=f-1):h=l.eb()?l.x*(f-1):f/2);isNaN(k)&&(l.gd()?l.xf(Hc)?k=0:l.xf(Kc)&&(k=g-1):k=l.eb()?l.y*(g-1):g/2);null===a.scaleComputation||a.animationManager.isAnimating||(c=a.scaleComputation(a,
c));c<a.minScale&&(c=a.minScale);c>a.maxScale&&(c=a.maxScale);f=I.allocAt(a.ma.x+h/b-h/c,a.ma.y+k/b-k/c);a.position=f;I.free(f);a.ya=c;a.Bq(e,a.viewportBounds,b,!1);a.Rb=!1;Xi(a,!1);d.$e&&d.Bd.add(d.B,"scale",b,a.ya);a.M();$i(a)}}
R.prototype.Bq=function(a,b,c,d){if(!a.w(b)){void 0===d&&(d=!1);d||$i(this);Ui(this);var e=this.layout;null===e||!e.isViewportSized||this.autoScale!==pi||d||a.width===b.width&&a.height===b.height||e.C();e=this.currentTool;!0===this.Yf&&e instanceof Oa&&(this.lastInput.documentPoint=this.Qt(this.lastInput.viewPoint),Oe(e,this));this.Rb||this.Sx(a,b);pj(this);this.Sd.scale=c;this.Sd.position.x=a.x;this.Sd.position.y=a.y;this.Sd.bounds.assign(a);this.Sd.Kv=d;this.R("ViewportBoundsChanged",this.Sd,a);
this.isVirtualized&&this.links.each(function(a){a.isAvoiding&&a.actualBounds.Gc(b)&&a.Ta()})}};
function pj(a,b){void 0===b&&(b=null);var c=a.Fb;if(null!==c&&c.visible){for(var d=M.alloc(),e=1,f=1,g=c.W.j,h=g.length,k=0;k<h;k++){var l=g[k],m=l.interval;2>m||(Wj(l.figure)?f=f*m/J.Nx(f,m):e=e*m/J.Nx(e,m))}g=c.gridCellSize;d.h(f*g.width,e*g.height);if(null!==b)e=b.width,f=b.height,a=b.x,g=b.y;else{b=N.alloc();a=a.viewportBounds;b.h(a.x,a.y,a.width,a.height);if(!b.u()){N.free(b);return}e=b.width;f=b.height;a=b.x;g=b.y;N.free(b)}c.width=e+2*d.width;c.height=f+2*d.height;b=I.alloc();J.mq(a,g,0,0,
d.width,d.height,b);b.offset(-d.width,-d.height);M.free(d);c.part.location=b;I.free(b)}}R.prototype.clearSelection=function(a){void 0===a&&(a=!1);var b=this.selection;if(0!==b.count){a||this.R("ChangingSelection",b);for(var c=b.na(),d=c.length,e=0;e<d;e++)c[e].isSelected=!1;b.ea();b.clear();b.freeze();a||this.R("ChangedSelection",b)}};
R.prototype.select=function(a){null!==a&&a.layer.diagram===this&&(!a.isSelected||1<this.selection.count)&&(this.R("ChangingSelection",this.selection),this.clearSelection(!0),a.isSelected=!0,this.R("ChangedSelection",this.selection))};
R.prototype.sA=function(a){this.R("ChangingSelection",this.selection);this.clearSelection(!0);if(Aa(a))for(var b=a.length,c=0;c<b;c++){var d=a[c];d instanceof U||B("Diagram.selectCollection given something that is not a Part: "+d);d.isSelected=!0}else for(a=a.iterator;a.next();)b=a.value,b instanceof U||B("Diagram.selectCollection given something that is not a Part: "+b),b.isSelected=!0;this.R("ChangedSelection",this.selection)};
R.prototype.clearHighlighteds=function(){var a=this.highlighteds;if(0<a.count){for(var b=a.na(),c=b.length,d=0;d<c;d++)b[d].isHighlighted=!1;a.ea();a.clear();a.freeze()}};t=R.prototype;t.Pz=function(a){null!==a&&a.layer.diagram===this&&(!a.isHighlighted||1<this.highlighteds.count)&&(this.clearHighlighteds(),a.isHighlighted=!0)};
t.Qz=function(a){a=(new F).addAll(a);for(var b=this.highlighteds.copy().Fq(a).iterator;b.next();)b.value.isHighlighted=!1;for(a=a.iterator;a.next();)b=a.value,b instanceof U||B("Diagram.highlightCollection given something that is not a Part: "+b),b.isHighlighted=!0};
t.scroll=function(a,b,c){void 0===c&&(c=1);var d="up"===b||"down"===b,e=0;if("pixel"===a)e=c;else if("line"===a)e=c*(d?this.scrollVerticalLineChange:this.scrollHorizontalLineChange);else if("page"===a)a=d?this.viewportBounds.height:this.viewportBounds.width,a*=this.scale,0!==a&&(e=c*Math.max(a-(d?this.scrollVerticalLineChange:this.scrollHorizontalLineChange),0));else{if("document"===a){e=this.documentBounds;c=this.viewportBounds;d=I.alloc();"up"===b?this.position=d.h(c.x,e.y):"left"===b?this.position=
d.h(e.x,c.y):"down"===b?this.position=d.h(c.x,e.bottom-c.height):"right"===b&&(this.position=d.h(e.right-c.width,c.y));I.free(d);return}B("scrolling unit must be 'pixel', 'line', 'page', or 'document', not: "+a)}e/=this.scale;c=this.position.copy();"up"===b?c.y=this.position.y-e:"down"===b?c.y=this.position.y+e:"left"===b?c.x=this.position.x-e:"right"===b?c.x=this.position.x+e:B("scrolling direction must be 'up', 'down', 'left', or 'right', not: "+b);this.position=c};
t.dw=function(a){var b=this.viewportBounds;b.Ae(a)||(a=a.center,a.x-=b.width/2,a.y-=b.height/2,this.position=a)};t.ct=function(a){var b=this.viewportBounds;a=a.center;a.x-=b.width/2;a.y-=b.height/2;this.position=a};t.Nq=function(a){var b=this.kb;b.reset();1!==this.ya&&b.scale(this.ya);var c=this.ma;(0!==c.x||0!==c.y)&&isFinite(c.x)&&isFinite(c.y)&&b.translate(-c.x,-c.y);return a.copy().transform(this.kb)};
t.BA=function(a){var b=this.kb,c=a.x,d=a.y,e=c+a.width,f=d+a.height,g=b.m11,h=b.m12,k=b.m21,l=b.m22,m=b.dx,n=b.dy,p=c*g+d*k+m;b=c*h+d*l+n;var r=e*g+d*k+m;a=e*h+d*l+n;d=c*g+f*k+m;c=c*h+f*l+n;g=e*g+f*k+m;e=e*h+f*l+n;f=Math.min(p,r);p=Math.max(p,r);r=Math.min(b,a);b=Math.max(b,a);f=Math.min(f,d);p=Math.max(p,d);r=Math.min(r,c);b=Math.max(b,c);f=Math.min(f,g);p=Math.max(p,g);r=Math.min(r,e);b=Math.max(b,e);return new N(f,r,p-f,b-r)};
t.Qt=function(a){var b=this.kb;b.reset();1!==this.ya&&b.scale(this.ya);var c=this.ma;(0!==c.x||0!==c.y)&&isFinite(c.x)&&isFinite(c.y)&&b.translate(-c.x,-c.y);return Ab(a.copy(),this.kb)};function gk(a){var b=a.isModified;a.av!==b&&(a.av=b,a.R("Modified"))}function kk(a){a=si.get(a);return null!==a?new a:new ti}
R.prototype.doModelChanged=function(a){if(a.model===this.model){var b=a.change,c=a.propertyName;if(b===ve&&"S"===c[0])if("StartingFirstTransaction"===c){var d=this;a=this.toolManager;a.mouseDownTools.each(function(a){a.diagram=d});a.mouseMoveTools.each(function(a){a.diagram=d});a.mouseUpTools.each(function(a){a.diagram=d});this.Bc||this.je||(this.pj=!0,this.sj&&(this.xe=!0))}else"StartingUndo"===c||"StartingRedo"===c?(a=this.animationManager,a.defaultAnimation.isAnimating&&!this.skipsUndoManager&&
a.Xc(),this.R("ChangingSelection",this.selection)):"StartedTransaction"===c&&(a=this.animationManager,a.defaultAnimation.isAnimating&&!this.skipsUndoManager&&a.Xc());else if(this.Z){this.Z=!1;try{if(""===a.modelChange&&b===ve){if("FinishedUndo"===c||"FinishedRedo"===c)this.R("ChangedSelection",this.selection),Vi(this);var e=this.animationManager;"RolledBackTransaction"===c&&e.Xc();this.pj=!0;this.Wc();0!==this.undoManager.transactionLevel&&1!==this.undoManager.transactionLevel||Dh(e);"CommittedTransaction"===
c&&this.undoManager.Au&&(this.Hd=Math.min(this.Hd,this.undoManager.historyIndex-1));var f=a.isTransactionFinished;f&&(gk(this),this.yt.clear(),Oh(this.animationManager));if(!this.hs&&f){this.hs=!0;var g=this;sa(function(){g.currentTool.standardMouseOver();g.hs=!1},10)}}}finally{this.Z=!0}}}};function Hj(a,b){b=b.W.j;for(var c=b.length,d=0;d<c;d++)lk(a,b[d])}
function lk(a,b){if(b instanceof mk){var c=b.element;if(null!==c&&c instanceof HTMLImageElement){var d=b.Vg;null!==d&&(d.bl instanceof Event&&null!==b.zc&&b.zc(b,d.bl),!0===d.Pr&&(null!==b.lf&&b.lf(b,d.Pu),null!==b.diagram&&b.diagram.ss.add(b)));c=c.getAttribute("src");d=a.Ci.H(c);if(null===d)d=[],d.push(b),a.Ci.add(c,d);else{for(a=0;a<d.length;a++)if(d[a]===b)return;d.push(b)}}}}
function nk(a,b){if(b instanceof mk){var c=b.element;if(null!==c&&c instanceof HTMLImageElement){c=c.getAttribute("src");var d=a.Ci.H(c);if(null!==d)for(var e=0;e<d.length;e++)if(d[e]===b){d.splice(e,1);0===d.length&&(a.Ci.remove(c),ok(c));break}}}}R.prototype.yd=function(){this.partManager.yd()};R.prototype.Tj=function(a,b){this.Jc.Tj(a,b)};R.prototype.Vj=function(a,b){this.Jc.Vj(a,b)};R.prototype.findPartForKey=function(a){return this.partManager.findPartForKey(a)};R.prototype.Jb=function(a){return this.partManager.Jb(a)};
R.prototype.findLinkForKey=function(a){return this.partManager.findLinkForKey(a)};t=R.prototype;t.wc=function(a){return this.partManager.wc(a)};t.Si=function(a){return this.partManager.Si(a)};t.vc=function(a){return this.partManager.vc(a)};t.kt=function(a){for(var b=[],c=0;c<arguments.length;++c)b[c]=arguments[c];return this.partManager.kt.apply(this.partManager,b instanceof Array?b:da(ba(b)))};
t.jt=function(a){for(var b=[],c=0;c<arguments.length;++c)b[c]=arguments[c];return this.partManager.jt.apply(this.partManager,b instanceof Array?b:da(ba(b)))};function Cj(a,b){a.ki=!1;var c=a.zn;c.w(b)||(b=b.G(),a.zn=b,Xi(a,!1),a.R("DocumentBoundsChanged",null,c.copy()),$i(a))}function Li(a){a.ki&&Cj(a,a.computeBounds())}t.sz=function(){for(var a=new F,b=this.nodes;b.next();){var c=b.value;c.isTopLevel&&a.add(c)}for(b=this.links;b.next();)c=b.value,c.isTopLevel&&a.add(c);return a.iterator};t.rz=function(){return this.zh.iterator};
t.aA=function(a){Vi(this);a&&pk(this,!0);this.pj=!0;Hf(this)};function pk(a,b){for(var c=a.zh.iterator;c.next();)qk(a,c.value,b);null!==a.layout&&(b?a.layout.isValidLayout=!1:a.layout.C())}function qk(a,b,c){if(null!==b){for(var d=b.zl.iterator;d.next();)qk(a,d.value,c);null!==b.layout&&(c?b.layout.isValidLayout=!1:b.layout.C())}}
function qj(a,b){if(a.If&&!a.tr){var c=a.Z;a.Z=!0;var d=a.undoManager.transactionLevel,e=a.layout;try{0===d&&a.ua("Layout");var f=a.animationManager;1>=d&&!f.isAnimating&&!f.qc&&(b||Bh(f,"Layout"));a.If=!1;for(var g=a.zh.iterator;g.next();)rk(a,g.value,b,d);e.isValidLayout||(!b||e.isRealtime||null===e.isRealtime||0===d?(e.doLayout(a),Vi(a),e.isValidLayout=!0):a.If=!0)}finally{0===d&&a.Ua("Layout"),a.If=!e.isValidLayout,a.Z=c}}}
function rk(a,b,c,d){if(null!==b){for(var e=b.zl.iterator;e.next();)rk(a,e.value,c,d);e=b.layout;null===e||e.isValidLayout||(!c||e.isRealtime||0===d?(b.uk=!b.location.u(),e.doLayout(b),b.C(32),sj(a,b),e.isValidLayout=!0):a.If=!0)}}t.zz=function(){for(var a=new E,b=this.nodes;b.next();){var c=b.value;c.isTopLevel&&null===c.Vi()&&a.add(c)}return a.iterator};
function qi(a){function b(a){var b=a.toLowerCase(),e=new E;c.add(a,e);c.add(b,e);d.add(a,a);d.add(b,a)}var c=new G,d=new G;b("InitialAnimationStarting");b("AnimationStarting");b("AnimationFinished");b("BackgroundSingleClicked");b("BackgroundDoubleClicked");b("BackgroundContextClicked");b("ClipboardChanged");b("ClipboardPasted");b("DocumentBoundsChanged");b("ExternalObjectsDropped");b("GainedFocus");b("InitialLayoutCompleted");b("LayoutCompleted");b("LinkDrawn");b("LinkRelinked");b("LinkReshaped");
b("LostFocus");b("Modified");b("ObjectSingleClicked");b("ObjectDoubleClicked");b("ObjectContextClicked");b("PartCreated");b("PartResized");b("PartRotated");b("SelectionMoved");b("SelectionCopied");b("SelectionDeleting");b("SelectionDeleted");b("SelectionGrouped");b("SelectionUngrouped");b("ChangingSelection");b("ChangedSelection");b("SubGraphCollapsed");b("SubGraphExpanded");b("TextEdited");b("TreeCollapsed");b("TreeExpanded");b("ViewportBoundsChanged");b("InvalidateDraw");a.wr=c;a.vr=d}
function Bj(a,b){var c=a.vr.H(b);return null!==c?c:a.vr.H(b.toLowerCase())}function sk(a,b){var c=a.wr.H(b);if(null!==c)return c;c=a.wr.H(b.toLowerCase());if(null!==c)return c;B("Unknown DiagramEvent name: "+b);return null}t.Uj=function(a,b){a=sk(this,a);null!==a&&a.add(b)};t.ym=function(a,b){a=sk(this,a);null!==a&&a.remove(b)};
t.R=function(a,b,c){var d=sk(this,a),e=new se;e.diagram=this;a=Bj(this,a);null!==a&&(e.name=a);void 0!==b&&(e.subject=b);void 0!==c&&(e.parameter=c);b=d.length;if(1===b)d.L(0)(e);else if(0!==b)for(d=d.na(),c=0;c<b;c++)(0,d[c])(e)};function tk(a){if(a.animationManager.isAnimating)return!1;var b=a.currentTool;return b===a.toolManager.findTool("Dragging")?!a.Op||b.isComplexRoutingRealtime:!0}t.lk=function(a,b){void 0===b&&(b=null);return uk(this,!1,null,b).lk(a.x,a.y,a.width,a.height)};
R.prototype.computeOccupiedArea=function(){return this.isVirtualized?this.viewportBounds.copy():this.ki?Wi(this):this.documentBounds.copy()};
function uk(a,b,c,d){null===a.Gb&&(a.Gb=new vk);if(a.Gb.st||a.Gb.group!==c||a.Gb.oy!==d){if(null===c){b=a.computeOccupiedArea();b.Vc(100,100);a.Gb.initialize(b);b=N.alloc();for(var e=a.nodes;e.next();){var f=e.value,g=f.layer;null!==g&&g.visible&&!g.isTemporary&&wk(a,f,d,b)}N.free(b)}else{0<c.memberParts.count&&(b=a.computePartsBounds(c.memberParts,!1),b.Vc(20,20),a.Gb.initialize(b));b=N.alloc();for(e=c.memberParts;e.next();)f=e.value,f instanceof W&&wk(a,f,d,b);N.free(b)}a.Gb.group=c;a.Gb.oy=d;a.Gb.st=
!1}else b&&xk(a.Gb);return a.Gb}function wk(a,b,c,d){if(b!==c)if(b.isVisible()&&b.avoidable&&!b.isLinkLabel){var e=b.getAvoidableRect(d),f=a.Gb.dm;c=a.Gb.cm;d=e.x+e.width;b=e.y+e.height;for(var g=e.x;g<d;g+=f){for(var h=e.y;h<b;h+=c)yk(a.Gb,g,h);yk(a.Gb,g,b)}for(e=e.y;e<b;e+=c)yk(a.Gb,d,e);yk(a.Gb,d,b)}else if(b instanceof T)for(b=b.memberParts;b.next();)e=b.value,e instanceof W&&wk(a,e,c,d)}
function zk(a,b){null!==a.Gb&&!a.Gb.st&&(void 0===b&&(b=null),null===b||b.avoidable&&!b.isLinkLabel)&&(a.Gb.st=!0)}t=R.prototype;t.gt=function(a){this.$m.assign(a);Ak(this,this.$m).Ma(this.position)?this.Cf():Bk(this)};
function Bk(a){-1===a.jj&&(a.jj=sa(function(){if(-1!==a.jj&&(a.Cf(),null!==a.lastInput.event)){var b=Ak(a,a.$m);b.Ma(a.position)||(a.position=b,a.lastInput.documentPoint=a.Qt(a.$m),a.doMouseMove(),a.ki=!0,Cj(a,a.documentBounds.copy().Hc(a.computeBounds())),a.Ac=!0,a.Wc(),Bk(a))}},a.Zm))}t.Cf=function(){-1!==this.jj&&(x.clearTimeout(this.jj),this.jj=-1)};
function Ak(a,b){var c=a.position,d=a.an;if(0>=d.top&&0>=d.left&&0>=d.right&&0>=d.bottom)return c;var e=a.viewportBounds,f=a.scale;e=N.allocAt(0,0,e.width*f,e.height*f);var g=I.allocAt(0,0);if(b.x>=e.x&&b.x<e.x+d.left){var h=Math.max(a.scrollHorizontalLineChange,1);h|=0;g.x-=h;b.x<e.x+d.left/2&&(g.x-=h);b.x<e.x+d.left/4&&(g.x-=4*h)}else b.x<=e.x+e.width&&b.x>e.x+e.width-d.right&&(h=Math.max(a.scrollHorizontalLineChange,1),h|=0,g.x+=h,b.x>e.x+e.width-d.right/2&&(g.x+=h),b.x>e.x+e.width-d.right/4&&
(g.x+=4*h));b.y>=e.y&&b.y<e.y+d.top?(a=Math.max(a.scrollVerticalLineChange,1),a|=0,g.y-=a,b.y<e.y+d.top/2&&(g.y-=a),b.y<e.y+d.top/4&&(g.y-=4*a)):b.y<=e.y+e.height&&b.y>e.y+e.height-d.bottom&&(a=Math.max(a.scrollVerticalLineChange,1),a|=0,g.y+=a,b.y>e.y+e.height-d.bottom/2&&(g.y+=a),b.y>e.y+e.height-d.bottom/4&&(g.y+=4*a));g.Ma(Gb)||(c=new I(c.x+g.x/f,c.y+g.y/f));N.free(e);I.free(g);return c}t.At=function(){return null};t.Lv=function(){return null};t.Ky=function(a,b){this.jx.add(a,b)};
function Ck(a,b,c){function d(){var a=+new Date;f=!0;for(g.reset();g.next();)if(!g.value[0].vl){f=!1;break}f||a-l>k?b(c,e,h):x.requestAnimationFrame(d)}for(var e=c.callback,f=!0,g=a.Ci.iterator;g.next();)if(!g.value[0].vl){f=!1;break}if("function"!==typeof e||f)return b(c,e,a);var h=a,k=c.callbackTimeout||300,l=+new Date;x.requestAnimationFrame(function(){d()});return null}t.cA=function(a){if(!Sg)return null;void 0===a&&(a=new db);a.returnType="Image";return this.Ux(a)};
t.Ux=function(a){void 0===a&&(a=new db);return Ck(this,this.dA,a)};
t.dA=function(a,b,c){var d=Dk(c,a,"canvas",null);if(null===d)return null;c=d.V.canvas;var e=null;if(null!==c)switch(e=a.returnType,void 0===e?e="string":e=e.toLowerCase(),e){case "imagedata":e=d.getImageData(0,0,c.width,c.height);break;case "image":d=(a.document||document).createElement("img");d.src=c.toDataURL(a.type,a.details);e=d;break;case "blob":"function"!==typeof b&&B('Error: Diagram.makeImageData called with "returnType: toBlob", but no required "callback" function property defined.');if("function"===
typeof c.toBlob)return c.toBlob(b,a.type,a.details),"toBlob";if("function"===typeof c.msToBlob)return b(c.msToBlob()),"msToBlob";b(null);return null;default:e=c.toDataURL(a.type,a.details)}return"function"===typeof b?(b(e),null):e};
function Dk(a,b,c,d){a.animationManager.Xc();a.Wc();if(null===a.sa)return null;"object"!==typeof b&&B("properties argument must be an Object.");var e=b.size||null,f=b.scale||null;void 0!==b.scale&&isNaN(b.scale)&&(f="NaN");var g=b.maxSize;void 0===b.maxSize&&(g="SVG"===c?new M(Infinity,Infinity):new M(2E3,2E3));var h=b.position||null,k=b.parts||null,l=void 0===b.padding?1:b.padding,m=b.background||null,n=b.omitTemporary;void 0===n&&(n=!0);var p=b.document||document,r=b.elementFinished||null,q=b.showTemporary;
void 0===q&&(q=!n);b=b.showGrid;void 0===b&&(b=q);null!==e&&isNaN(e.width)&&isNaN(e.height)&&(e=null);"number"===typeof l?l=new oc(l):l instanceof oc||B("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);a.Db.sc(!0);n=new Ek(null,p);var u=n.context;if(!(e||f||k||h)){n.width=a.wa+Math.ceil(l.left+l.right);n.height=a.va+Math.ceil(l.top+l.bottom);if("SVG"===c){if(null===d)return null;d.resize(n.width,
n.height,n.width,n.height);d.ownerDocument=p;d.jq=r;zj(a,d.context,l,new M(n.width,n.height),a.ya,a.ma,k,m,q,b);return d.context}a.Xk=!1;zj(a,u,l,new M(n.width,n.height),a.ya,a.ma,k,m,q,b);a.Xk=!0;return n.context}var v=a.yn,w=a.documentBounds.copy();w.kw(a.bb);if(q)for(var y=a.Ja.j,z=y.length,A=0;A<z;A++){var C=y[A];if(C.visible&&C.isTemporary){C=C.Ca.j;for(var H=C.length,L=0;L<H;L++){var K=C[L];K.isInDocumentBounds&&K.isVisible()&&(K=K.actualBounds,K.u()&&w.Hc(K))}}}y=new I(w.x,w.y);if(null!==k){z=
!0;A=k.iterator;for(A.reset();A.next();)if(C=A.value,C instanceof U&&(H=C.layer,(null===H||H.visible)&&(null===H||q||!H.isTemporary)&&C.isVisible()&&(C=C.actualBounds,C.u())))if(z){z=!1;var V=C.copy()}else V.Hc(C);z&&(V=new N(0,0,0,0));w.width=V.width;w.height=V.height;y.x=V.x;y.y=V.y}null!==h&&h.u()&&(y=h,f||(f=v));V=h=0;null!==l&&(h=l.left+l.right,V=l.top+l.bottom);z=A=0;null!==e&&(A=e.width,z=e.height,isFinite(A)&&(A=Math.max(0,A-h)),isFinite(z)&&(z=Math.max(0,z-V)));null!==e&&null!==f?("NaN"===
f&&(f=v),e.u()?(e=A,w=z):isNaN(z)?(e=A,w=w.height*f):(e=w.width*f,w=z)):null!==e?e.u()?(f=Math.min(A/w.width,z/w.height),e=A,w=z):isNaN(z)?(f=A/w.width,e=A,w=w.height*f):(f=z/w.height,e=w.width*f,w=z):null!==f?"NaN"===f&&g.u()?(f=Math.min((g.width-h)/w.width,(g.height-V)/w.height),f>v?(f=v,e=w.width,w=w.height):(e=g.width,w=g.height)):(e=w.width*f,w=w.height*f):(f=v,e=w.width,w=w.height);null!==l?(e+=h,w+=V):l=new oc(0);null!==g&&(v=g.width,g=g.height,isNaN(v)&&(v=2E3),isNaN(g)&&(g=2E3),isFinite(v)&&
(e=Math.min(e,v)),isFinite(g)&&(w=Math.min(w,g)));n.width=Math.ceil(e);n.height=Math.ceil(w);if("SVG"===c){if(null===d)return null;d.resize(n.width,n.height,n.width,n.height);d.ownerDocument=p;d.jq=r;zj(a,d.context,l,new M(Math.ceil(e),Math.ceil(w)),f,y,k,m,q,b);return d.context}a.Xk=!1;zj(a,u,l,new M(Math.ceil(e),Math.ceil(w)),f,y,k,m,q,b);a.Xk=!0;return n.context}
ma.Object.defineProperties(R.prototype,{div:{get:function(){return this.La},set:function(a){if(this.La!==a){Qa=[];var b=this.La;null!==b?(b.B=void 0,b.innerHTML="",null!==this.sa&&(b=this.sa.Ea,this.removeEventListener(b,"touchstart",this.pw,!1),this.removeEventListener(b,"touchmove",this.ow,!1),this.removeEventListener(b,"touchend",this.nw,!1),this.sa.Fx()),b=this.toolManager,null!==b&&(b.mouseDownTools.each(function(a){a.cancelWaitAfter()}),b.mouseMoveTools.each(function(a){a.cancelWaitAfter()}),
b.mouseUpTools.each(function(a){a.cancelWaitAfter()})),b.cancelWaitAfter(),this.currentTool.doCancel(),this.Db=this.sa=null,this.removeEventListener(x,"resize",this.vw,!1),this.removeEventListener(x,"mousemove",this.qk,!0),this.removeEventListener(x,"mousedown",this.pk,!0),this.removeEventListener(x,"mouseup",this.sk,!0),this.removeEventListener(x,"wheel",this.tk,!0),this.removeEventListener(x,"mouseout",this.rk,!0),Ce===this&&(Ce=null)):this.je=!1;this.La=null;if(null!==a){if(b=a.B)b.div=null;Hi(this,
a);this.Fe()}}}},xx:{get:function(){return this.Io}},kk:{get:function(){return this.je}},draggedLink:{get:function(){return this.yr},set:function(a){this.yr!==a&&(this.yr=a,null!==a&&(this.ms=a.fromPort,this.ns=a.toPort))}},Xx:{get:function(){return this.ms},set:function(a){this.ms=a}},Yx:{get:function(){return this.ns},set:function(a){this.ns=a}},animationManager:{
get:function(){return this.Jc}},undoManager:{get:function(){return this.ac.undoManager}},skipsUndoManager:{get:function(){return this.sg},set:function(a){this.sg=a;this.ac.skipsUndoManager=a}},delaysLayout:{get:function(){return this.tr},set:function(a){this.tr=a}},opacity:{get:function(){return this.qb},set:function(a){var b=this.qb;b!==a&&((0>a||1<a)&&va(a,"0 <= value <= 1",
R,"opacity"),this.qb=a,this.g("opacity",b,a),this.M())}},validCycle:{get:function(){return this.Xs},set:function(a){var b=this.Xs;b!==a&&(this.Xs=a,this.g("validCycle",b,a))}},layers:{get:function(){return this.Ja.iterator}},isModelReadOnly:{get:function(){var a=this.ac;return null===a?!1:a.isReadOnly},set:function(a){var b=this.ac;null!==b&&(b.isReadOnly=a)}},isReadOnly:{get:function(){return this.Zf},
set:function(a){var b=this.Zf;b!==a&&(this.Zf=a,this.g("isReadOnly",b,a))}},isEnabled:{get:function(){return this.Mc},set:function(a){var b=this.Mc;b!==a&&(this.Mc=a,this.g("isEnabled",b,a))}},allowClipboard:{get:function(){return this.Uq},set:function(a){var b=this.Uq;b!==a&&(this.Uq=a,this.g("allowClipboard",b,a))}},allowCopy:{get:function(){return this.Rh},set:function(a){var b=this.Rh;b!==a&&(this.Rh=a,this.g("allowCopy",
b,a))}},allowDelete:{get:function(){return this.Sh},set:function(a){var b=this.Sh;b!==a&&(this.Sh=a,this.g("allowDelete",b,a))}},allowDragOut:{get:function(){return this.Vq},set:function(a){var b=this.Vq;b!==a&&(this.Vq=a,this.g("allowDragOut",b,a))}},allowDrop:{get:function(){return this.Wq},set:function(a){var b=this.Wq;b!==a&&(this.Wq=a,this.g("allowDrop",b,a))}},allowTextEdit:{
get:function(){return this.ai},set:function(a){var b=this.ai;b!==a&&(this.ai=a,this.g("allowTextEdit",b,a))}},allowGroup:{get:function(){return this.Th},set:function(a){var b=this.Th;b!==a&&(this.Th=a,this.g("allowGroup",b,a))}},allowUngroup:{get:function(){return this.bi},set:function(a){var b=this.bi;b!==a&&(this.bi=a,this.g("allowUngroup",b,a))}},allowInsert:{get:function(){return this.Yq},set:function(a){var b=
this.Yq;b!==a&&(this.Yq=a,this.g("allowInsert",b,a))}},allowLink:{get:function(){return this.Uh},set:function(a){var b=this.Uh;b!==a&&(this.Uh=a,this.g("allowLink",b,a))}},allowRelink:{get:function(){return this.Wh},set:function(a){var b=this.Wh;b!==a&&(this.Wh=a,this.g("allowRelink",b,a))}},allowMove:{get:function(){return this.Vh},set:function(a){var b=this.Vh;b!==a&&(this.Vh=a,this.g("allowMove",b,a))}},allowReshape:{
get:function(){return this.Xh},set:function(a){var b=this.Xh;b!==a&&(this.Xh=a,this.g("allowReshape",b,a))}},allowResize:{get:function(){return this.Yh},set:function(a){var b=this.Yh;b!==a&&(this.Yh=a,this.g("allowResize",b,a))}},allowRotate:{get:function(){return this.Zh},set:function(a){var b=this.Zh;b!==a&&(this.Zh=a,this.g("allowRotate",b,a))}},allowSelect:{get:function(){return this.$h},set:function(a){var b=
this.$h;b!==a&&(this.$h=a,this.g("allowSelect",b,a))}},allowUndo:{get:function(){return this.Zq},set:function(a){var b=this.Zq;b!==a&&(this.Zq=a,this.g("allowUndo",b,a))}},allowZoom:{get:function(){return this.ar},set:function(a){var b=this.ar;b!==a&&(this.ar=a,this.g("allowZoom",b,a))}},hasVerticalScrollbar:{get:function(){return this.dl},set:function(a){var b=this.dl;b!==a&&(this.dl=a,$i(this),this.M(),this.g("hasVerticalScrollbar",
b,a),Xi(this,!1))}},hasHorizontalScrollbar:{get:function(){return this.cl},set:function(a){var b=this.cl;b!==a&&(this.cl=a,$i(this),this.M(),this.g("hasHorizontalScrollbar",b,a),Xi(this,!1))}},allowHorizontalScroll:{get:function(){return this.Xq},set:function(a){var b=this.Xq;b!==a&&(this.Xq=a,this.g("allowHorizontalScroll",b,a),Xi(this,!1))}},allowVerticalScroll:{get:function(){return this.$q},set:function(a){var b=
this.$q;b!==a&&(this.$q=a,this.g("allowVerticalScroll",b,a),Xi(this,!1))}},scrollHorizontalLineChange:{get:function(){return this.Cs},set:function(a){var b=this.Cs;b!==a&&(0>a&&va(a,">= 0",R,"scrollHorizontalLineChange"),this.Cs=a,this.g("scrollHorizontalLineChange",b,a))}},scrollVerticalLineChange:{get:function(){return this.Gs},set:function(a){var b=this.Gs;b!==a&&(0>a&&va(a,">= 0",R,"scrollVerticalLineChange"),this.Gs=a,this.g("scrollVerticalLineChange",
b,a))}},lastInput:{get:function(){return this.dh},set:function(a){this.dh=a}},firstInput:{get:function(){return this.Uf},set:function(a){this.Uf=a}},currentCursor:{get:function(){return this.mr},set:function(a){""===a&&(a=this.xn);if(this.mr!==a){var b=this.sa,c=this.La;if(null!==b){this.mr=a;var d=b.style.cursor;b.style.cursor=a;c.style.cursor=a;b.style.cursor===d&&(b.style.cursor="-webkit-"+a,c.style.cursor=
"-webkit-"+a,b.style.cursor===d&&(b.style.cursor="-moz-"+a,c.style.cursor="-moz-"+a,b.style.cursor===d&&(b.style.cursor=a,c.style.cursor=a)))}}}},defaultCursor:{get:function(){return this.xn},set:function(a){""===a&&(a="auto");var b=this.xn;b!==a&&(this.xn=a,this.g("defaultCursor",b,a))}},click:{get:function(){return this.Nf},set:function(a){var b=this.Nf;b!==a&&(this.Nf=a,this.g("click",b,a))}},doubleClick:{
get:function(){return this.Sf},set:function(a){var b=this.Sf;b!==a&&(this.Sf=a,this.g("doubleClick",b,a))}},contextClick:{get:function(){return this.Of},set:function(a){var b=this.Of;b!==a&&(this.Of=a,this.g("contextClick",b,a))}},mouseOver:{get:function(){return this.kg},set:function(a){var b=this.kg;b!==a&&(this.kg=a,this.g("mouseOver",b,a))}},mouseHover:{get:function(){return this.ig},set:function(a){var b=
this.ig;b!==a&&(this.ig=a,this.g("mouseHover",b,a))}},mouseHold:{get:function(){return this.hg},set:function(a){var b=this.hg;b!==a&&(this.hg=a,this.g("mouseHold",b,a))}},mouseDragOver:{get:function(){return this.gs},set:function(a){var b=this.gs;b!==a&&(this.gs=a,this.g("mouseDragOver",b,a))}},mouseDrop:{get:function(){return this.fg},set:function(a){var b=this.fg;b!==a&&(this.fg=a,this.g("mouseDrop",b,a))}},
handlesDragDropForTopLevelParts:{get:function(){return this.Ir},set:function(a){var b=this.Ir;b!==a&&(this.Ir=a,this.g("handlesDragDropForTopLevelParts",b,a))}},mouseEnter:{get:function(){return this.gg},set:function(a){var b=this.gg;b!==a&&(this.gg=a,this.g("mouseEnter",b,a))}},mouseLeave:{get:function(){return this.jg},set:function(a){var b=this.jg;b!==a&&(this.jg=a,this.g("mouseLeave",b,a))}},toolTip:{
get:function(){return this.ug},set:function(a){var b=this.ug;b!==a&&(this.ug=a,this.g("toolTip",b,a))}},contextMenu:{get:function(){return this.Pf},set:function(a){var b=this.Pf;b!==a&&(this.Pf=a,this.g("contextMenu",b,a))}},commandHandler:{get:function(){return this.gr},set:function(a){this.gr!==a&&(this.gr=a,a.Zd(this))}},toolManager:{get:function(){return this.Ts},set:function(a){this.Ts!==a&&
(this.Ts=a,a.diagram=this)}},defaultTool:{get:function(){return this.sr},set:function(a){var b=this.sr;b!==a&&(this.sr=a,a.diagram=this,this.currentTool===b&&(this.currentTool=a))}},currentTool:{get:function(){return this.pr},set:function(a){var b=this.pr;null!==b&&(b.isActive&&b.doDeactivate(),b.cancelWaitAfter(),b.doStop());null===a&&(a=this.defaultTool);null!==a&&(this.pr=a,a.diagram=this,a.doStart())}},selection:{
get:function(){return this.Ru}},maxSelectionCount:{get:function(){return this.cs},set:function(a){var b=this.cs;if(b!==a)if(0<=a&&!isNaN(a)){if(this.cs=a,this.g("maxSelectionCount",b,a),!this.undoManager.isUndoingRedoing&&(a=this.selection.count-a,0<a)){this.R("ChangingSelection",this.selection);b=this.selection.na();for(var c=0;c<a;c++)b[c].isSelected=!1;this.R("ChangedSelection",this.selection)}}else va(a,">= 0",R,"maxSelectionCount")}},nodeSelectionAdornmentTemplate:{
get:function(){return this.Ro},set:function(a){var b=this.Ro;b!==a&&(this.Ro=a,this.g("nodeSelectionAdornmentTemplate",b,a))}},groupSelectionAdornmentTemplate:{get:function(){return this.Vn},set:function(a){var b=this.Vn;b!==a&&(this.Vn=a,this.g("groupSelectionAdornmentTemplate",b,a))}},linkSelectionAdornmentTemplate:{get:function(){return this.qo},set:function(a){var b=this.qo;b!==a&&(this.qo=a,this.g("linkSelectionAdornmentTemplate",
b,a))}},highlighteds:{get:function(){return this.su}},isModified:{get:function(){var a=this.undoManager;return a.isEnabled?null!==a.currentTransaction?!0:this.$n&&this.Hd!==a.historyIndex:this.$n},set:function(a){if(this.$n!==a){this.$n=a;var b=this.undoManager;!a&&b.isEnabled&&(this.Hd=b.historyIndex);a||gk(this)}}},model:{get:function(){return this.ac},set:function(a){var b=this.ac;if(b!==a){this.currentTool.doCancel();
null!==b&&b.undoManager!==a.undoManager&&b.undoManager.isInTransaction&&B("Do not replace a Diagram.model while a transaction is in progress.");this.animationManager.Xc(!0);var c=Ki(this,!0);this.je=!1;this.sj=!0;this.Hd=-2;this.xe=!1;var d=this.Bc;this.Bc=!0;Bh(this.animationManager,"Model");null!==b&&(null!==this.pe&&this.pe.each(function(a){b.wk(a)}),b.wk(this.Ic));this.ac=a;this.partManager=kk(this.ac.constructor.type);for(var e=0;e<c.length;e++)this.add(c[e]);a.Dh(this.kd);this.partManager.addAllModeledParts();
a.wk(this.kd);a.Dh(this.Ic);null!==this.pe&&this.pe.each(function(b){a.Dh(b)});this.Bc=d;this.Rb||this.M();null!==b&&a.undoManager.copyProperties(b.undoManager)}}},Z:{get:function(){return this.zu},set:function(a){this.zu=a}},yt:{get:function(){return this.Yw}},skipsModelSourceBindings:{get:function(){return this.Su},set:function(a){this.Su=a}},Pt:{get:function(){return this.Ls},
set:function(a){this.Ls=a}},nodeTemplate:{get:function(){return this.Ze.H("")},set:function(a){var b=this.Ze.H("");b!==a&&(this.Ze.add("",a),this.g("nodeTemplate",b,a),this.undoManager.isUndoingRedoing||this.yd())}},nodeTemplateMap:{get:function(){return this.Ze},set:function(a){var b=this.Ze;b!==a&&(this.Ze=a,this.g("nodeTemplateMap",b,a),this.undoManager.isUndoingRedoing||this.yd())}},groupTemplate:{get:function(){return this.ah.H("")},
set:function(a){var b=this.ah.H("");b!==a&&(this.ah.add("",a),this.g("groupTemplate",b,a),this.undoManager.isUndoingRedoing||this.yd())}},groupTemplateMap:{get:function(){return this.ah},set:function(a){var b=this.ah;b!==a&&(this.ah=a,this.g("groupTemplateMap",b,a),this.undoManager.isUndoingRedoing||this.yd())}},linkTemplate:{get:function(){return this.ag.H("")},set:function(a){var b=this.ag.H("");b!==a&&(this.ag.add("",a),this.g("linkTemplate",
b,a),this.undoManager.isUndoingRedoing||this.yd())}},linkTemplateMap:{get:function(){return this.ag},set:function(a){var b=this.ag;b!==a&&(this.ag=a,this.g("linkTemplateMap",b,a),this.undoManager.isUndoingRedoing||this.yd())}},isMouseCaptured:{get:function(){return this.xu},set:function(a){var b=this.sa;null!==b&&(b=b.Ea,b instanceof SVGElement||(a?(this.lastInput.bubbles=!1,this.Vm?(this.removeEventListener(b,"pointermove",this.um,!1),this.removeEventListener(b,
"pointerdown",this.tm,!1),this.removeEventListener(b,"pointerup",this.wm,!1),this.removeEventListener(b,"pointerout",this.vm,!1),this.addEventListener(x,"pointermove",this.um,!0),this.addEventListener(x,"pointerdown",this.tm,!0),this.addEventListener(x,"pointerup",this.wm,!0),this.addEventListener(x,"pointerout",this.vm,!0)):(this.removeEventListener(b,"mousemove",this.qk,!1),this.removeEventListener(b,"mousedown",this.pk,!1),this.removeEventListener(b,"mouseup",this.sk,!1),this.removeEventListener(b,
"mouseout",this.rk,!1),this.addEventListener(x,"mousemove",this.qk,!0),this.addEventListener(x,"mousedown",this.pk,!0),this.addEventListener(x,"mouseup",this.sk,!0),this.addEventListener(x,"mouseout",this.rk,!0)),this.removeEventListener(b,"wheel",this.tk,!1),this.addEventListener(x,"wheel",this.tk,!0),this.addEventListener(x,"selectstart",this.preventDefault,!1)):(this.Vm?(this.removeEventListener(x,"pointermove",this.um,!0),this.removeEventListener(x,"pointerdown",this.tm,!0),this.removeEventListener(x,
"pointerup",this.wm,!0),this.removeEventListener(x,"pointerout",this.vm,!0),this.addEventListener(b,"pointermove",this.um,!1),this.addEventListener(b,"pointerdown",this.tm,!1),this.addEventListener(b,"pointerup",this.wm,!1),this.addEventListener(b,"pointerout",this.vm,!1)):(this.removeEventListener(x,"mousemove",this.qk,!0),this.removeEventListener(x,"mousedown",this.pk,!0),this.removeEventListener(x,"mouseup",this.sk,!0),this.removeEventListener(x,"mouseout",this.rk,!0),this.addEventListener(b,"mousemove",
this.qk,!1),this.addEventListener(b,"mousedown",this.pk,!1),this.addEventListener(b,"mouseup",this.sk,!1),this.addEventListener(b,"mouseout",this.rk,!1)),this.removeEventListener(x,"wheel",this.tk,!0),this.removeEventListener(x,"selectstart",this.preventDefault,!1),this.addEventListener(b,"wheel",this.tk,!1)),this.xu=a))}},position:{get:function(){return this.ma},set:function(a){var b=I.alloc().assign(this.ma);if(!b.w(a)){var c=this.viewportBounds.copy();this.ma.assign(a);
Qh(this.animationManager,b,this.ma);this.Rb||null===this.sa&&!this.Zl.u()||(this.Rb=!0,a=this.scale,Zi(this,this.zn,this.wa/a,this.va/a,this.lj,!1),this.Rb=!1);this.Rb||this.Bq(c,this.viewportBounds,this.ya,!1)}I.free(b)}},initialPosition:{get:function(){return this.Kr},set:function(a){this.Kr.w(a)||(this.Kr=a.G())}},initialScale:{get:function(){return this.Lr},set:function(a){this.Lr!==a&&(this.Lr=a)}},grid:{
get:function(){null===this.Fb&&Qi(this);return this.Fb},set:function(a){var b=this.Fb;if(b!==a){null===b&&(Qi(this),b=this.Fb);a.type!==X.Grid&&B("Diagram.grid must be a Panel of type Panel.Grid");var c=b.panel;null!==c&&c.remove(b);this.Fb=a;a.name="GRID";null!==c&&c.add(a);pj(this);this.M();this.g("grid",b,a)}}},viewportBounds:{get:function(){var a=this.$u,b=this.ma,c=this.ya;if(null===this.sa)return this.Zl.u()&&a.h(b.x,b.y,this.wa/c,this.va/c),a;a.h(b.x,b.y,Math.max(this.wa,
0)/c,Math.max(this.va,0)/c);return a}},viewSize:{get:function(){return this.Zl},set:function(a){var b=this.viewSize;b.w(a)||(this.Zl=a=a.G(),this.wa=a.width,this.va=a.height,this.Na(),this.g("viewSize",b,a))}},fixedBounds:{get:function(){return this.Fr},set:function(a){var b=this.Fr;b.w(a)||(-Infinity!==a.width&&Infinity!==a.height&&-Infinity!==a.height||B("fixedBounds width/height must not be Infinity"),this.Fr=a=a.G(),this.Na(),this.g("fixedBounds",
b,a))}},scrollMargin:{get:function(){return this.Fi},set:function(a){"number"===typeof a&&(a=new oc(a));var b=this.Fi;b.w(a)||(this.Fi=a=a.G(),this.g("scrollMargin",b,a),this.Fe())}},scrollMode:{get:function(){return this.Gi},set:function(a){var b=this.Gi;b!==a&&(this.Gi=a,a===Xh&&Xi(this,!1),this.g("scrollMode",b,a),this.M())}},scrollsPageOnFocus:{get:function(){return this.Hs},set:function(a){var b=this.Hs;
b!==a&&(this.Hs=a,this.g("scrollsPageOnFocus",b,a))}},positionComputation:{get:function(){return this.vs},set:function(a){var b=this.vs;b!==a&&(this.vs=a,Xi(this,!1),this.g("positionComputation",b,a))}},scaleComputation:{get:function(){return this.As},set:function(a){var b=this.As;b!==a&&(this.As=a,Vj(this,this.scale,this.scale),this.g("scaleComputation",b,a))}},documentBounds:{get:function(){return this.zn}},
isVirtualized:{get:function(){return this.Vr},set:function(a){var b=this.Vr;b!==a&&(this.Vr=a,this.g("isVirtualized",b,a))}},scale:{get:function(){return this.ya},set:function(a){var b=this.ya;b!==a&&Vj(this,b,a)}},defaultScale:{get:function(){return this.yn},set:function(a){this.yn=a}},autoScale:{get:function(){return this.Lg},set:function(a){var b=this.Lg;b!==a&&(this.Lg=a,this.g("autoScale",
b,a),a!==pi&&Xi(this,!1))}},initialAutoScale:{get:function(){return this.Xf},set:function(a){var b=this.Xf;b!==a&&(this.Xf=a,this.g("initialAutoScale",b,a))}},initialViewportSpot:{get:function(){return this.Mr},set:function(a){var b=this.Mr;b!==a&&(a.eb()||B("initialViewportSpot must be a specific Spot: "+a),this.Mr=a,this.g("initialViewportSpot",b,a))}},initialDocumentSpot:{get:function(){return this.Jr},set:function(a){var b=
this.Jr;b!==a&&(a.eb()||B("initialViewportSpot must be a specific Spot: "+a),this.Jr=a,this.g("initialDocumentSpot",b,a))}},minScale:{get:function(){return this.ds},set:function(a){var b=this.ds;b!==a&&(0<a?(this.ds=a,this.g("minScale",b,a),a>this.scale&&(this.scale=a)):va(a,"> 0",R,"minScale"))}},maxScale:{get:function(){return this.bs},set:function(a){var b=this.bs;b!==a&&(0<a?(this.bs=a,this.g("maxScale",b,a),a<this.scale&&(this.scale=
a)):va(a,"> 0",R,"maxScale"))}},zoomPoint:{get:function(){return this.$s},set:function(a){this.$s.w(a)||(this.$s=a=a.G())}},contentAlignment:{get:function(){return this.lj},set:function(a){var b=this.lj;b.w(a)||(this.lj=a=a.G(),this.g("contentAlignment",b,a),Xi(this,!1))}},initialContentAlignment:{get:function(){return this.Xn},set:function(a){var b=this.Xn;b.w(a)||(this.Xn=a=a.G(),this.g("initialContentAlignment",
b,a))}},padding:{get:function(){return this.bb},set:function(a){"number"===typeof a&&(a=new oc(a));var b=this.bb;b.w(a)||(this.bb=a=a.G(),this.Na(),this.g("padding",b,a))}},partManager:{get:function(){return this.Ia},set:function(a){var b=this.Ia;b!==a&&(null!==a.diagram&&B("Cannot share PartManagers between Diagrams: "+a.toString()),null!==b&&b.Zd(null),this.Ia=a,a.Zd(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.ic},set:function(a){var b=this.ic;b!==a&&(this.ic=a,a.diagram=this,a.group=null,this.If=!0,this.g("layout",b,a),this.Pb())}},isTreePathToChildren:{get:function(){return this.Ur},set:function(a){var b=this.Ur;if(b!==a&&(this.Ur=
a,this.g("isTreePathToChildren",b,a),!this.undoManager.isUndoingRedoing))for(a=this.nodes;a.next();)Fk(a.value)}},treeCollapsePolicy:{get:function(){return this.Vs},set:function(a){var b=this.Vs;b!==a&&(a!==ri&&a!==Gk&&a!==Hk&&B("Unknown Diagram.treeCollapsePolicy: "+a),this.Vs=a,this.g("treeCollapsePolicy",b,a))}},De:{get:function(){return this.vu},set:function(a){this.vu=a}},autoScrollInterval:{get:function(){return this.Zm},
set:function(a){var b=this.Zm;b!==a&&(this.Zm=a,this.g("autoScrollInterval",b,a))}},autoScrollRegion:{get:function(){return this.an},set:function(a){"number"===typeof a&&(a=new oc(a));var b=this.an;b.w(a)||(this.an=a=a.G(),this.Na(),this.g("autoScrollRegion",b,a))}}});ma.Object.defineProperties(R,{licenseKey:{get:function(){return Ik.Xb()},set:function(a){Ik.add(a)}},version:{get:function(){return Jk}}});
R.prototype.makeImageData=R.prototype.Ux;R.prototype.makeImage=R.prototype.cA;R.prototype.addRenderer=R.prototype.Ky;R.prototype.makeSVG=R.prototype.Lv;R.prototype.makeSvg=R.prototype.At;R.prototype.stopAutoScroll=R.prototype.Cf;R.prototype.doAutoScroll=R.prototype.gt;R.prototype.isUnoccupied=R.prototype.lk;R.prototype.raiseDiagramEvent=R.prototype.R;R.prototype.removeDiagramListener=R.prototype.ym;R.prototype.addDiagramListener=R.prototype.Uj;R.prototype.findTreeRoots=R.prototype.zz;
R.prototype.layoutDiagram=R.prototype.aA;R.prototype.findTopLevelGroups=R.prototype.rz;R.prototype.findTopLevelNodesAndLinks=R.prototype.sz;R.prototype.findLinksByExample=R.prototype.jt;R.prototype.findNodesByExample=R.prototype.kt;R.prototype.findLinkForData=R.prototype.vc;R.prototype.findNodeForData=R.prototype.Si;R.prototype.findPartForData=R.prototype.wc;R.prototype.findLinkForKey=R.prototype.findLinkForKey;R.prototype.findNodeForKey=R.prototype.Jb;R.prototype.findPartForKey=R.prototype.findPartForKey;
R.prototype.rebuildParts=R.prototype.yd;R.prototype.transformViewToDoc=R.prototype.Qt;R.prototype.transformRectDocToView=R.prototype.BA;R.prototype.transformDocToView=R.prototype.Nq;R.prototype.centerRect=R.prototype.ct;R.prototype.scrollToRect=R.prototype.dw;R.prototype.scroll=R.prototype.scroll;R.prototype.highlightCollection=R.prototype.Qz;R.prototype.highlight=R.prototype.Pz;R.prototype.selectCollection=R.prototype.sA;R.prototype.select=R.prototype.select;
R.prototype.updateAllRelationshipsFromData=R.prototype.Pq;R.prototype.updateAllTargetBindings=R.prototype.updateAllTargetBindings;R.prototype.commit=R.prototype.commit;R.prototype.rollbackTransaction=R.prototype.Bf;R.prototype.commitTransaction=R.prototype.Ua;R.prototype.startTransaction=R.prototype.ua;R.prototype.raiseChanged=R.prototype.g;R.prototype.raiseChangedEvent=R.prototype.Ya;R.prototype.removeChangedListener=R.prototype.wk;R.prototype.addChangedListener=R.prototype.Dh;
R.prototype.removeModelChangedListener=R.prototype.oA;R.prototype.addModelChangedListener=R.prototype.vx;R.prototype.findLayer=R.prototype.im;R.prototype.removeLayer=R.prototype.mA;R.prototype.addLayerAfter=R.prototype.Gy;R.prototype.addLayerBefore=R.prototype.tx;R.prototype.addLayer=R.prototype.$l;R.prototype.moveParts=R.prototype.moveParts;R.prototype.copyParts=R.prototype.ck;R.prototype.removeParts=R.prototype.Jt;R.prototype.remove=R.prototype.remove;R.prototype.add=R.prototype.add;
R.prototype.clearDelayedGeometries=R.prototype.hv;R.prototype.setProperties=R.prototype.iw;R.prototype.resetInputOptions=R.prototype.aw;R.prototype.setInputOption=R.prototype.tA;R.prototype.getInputOption=R.prototype.mm;R.prototype.resetRenderingHints=R.prototype.bw;R.prototype.setRenderingHint=R.prototype.ly;R.prototype.getRenderingHint=R.prototype.Ce;R.prototype.maybeUpdate=R.prototype.Wc;R.prototype.requestUpdate=R.prototype.Pb;R.prototype.delayInitialization=R.prototype.Zy;
R.prototype.isUpdateRequested=R.prototype.Wz;R.prototype.redraw=R.prototype.Fe;R.prototype.invalidateDocumentBounds=R.prototype.Na;R.prototype.findObjectsNear=R.prototype.Ag;R.prototype.findPartsNear=R.prototype.oz;R.prototype.findObjectsIn=R.prototype.uf;R.prototype.findPartsIn=R.prototype.Mx;R.prototype.findObjectsAt=R.prototype.Ti;R.prototype.findPartsAt=R.prototype.nz;R.prototype.findObjectAt=R.prototype.Ub;R.prototype.findPartAt=R.prototype.jm;R.prototype.focusObject=R.prototype.Az;
R.prototype.alignDocument=R.prototype.My;R.prototype.zoomToRect=R.prototype.EA;R.prototype.zoomToFit=R.prototype.zoomToFit;R.prototype.diagramScroll=R.prototype.Ex;R.prototype.focus=R.prototype.focus;R.prototype.reset=R.prototype.reset;R.useDOM=function(a){Sg=a?void 0!==x.document:!1};R.isUsingDOM=function(){return Sg};
var Ce=null,si=new G,Oi=null,Ni=null,Sg=void 0!==x.document,Ii=null,Ji="",pi=new D(R,"None",0),bj=new D(R,"Uniform",1),cj=new D(R,"UniformToFill",2),Mf=new D(R,"CycleAll",10),Qf=new D(R,"CycleNotDirected",11),Sf=new D(R,"CycleNotDirectedFast",12),Tf=new D(R,"CycleNotUndirected",13),Nf=new D(R,"CycleDestinationTree",14),Pf=new D(R,"CycleSourceTree",15),Xh=new D(R,"DocumentScroll",1),Zh=new D(R,"InfiniteScroll",2),ri=new D(R,"TreeParentCollapsed",21),Gk=new D(R,"AllParentsCollapsed",22),Hk=new D(R,
"AnyParentsCollapsed",23),Ik=new E,Jk="2.1.15",Kk=null,ni=!1;
function oi(){if(Sg){var a=x.document.createElement("canvas"),b=a.getContext("2d"),c=Ra("7ca11abfd022028846");b[c]=Ra("398c3597c01238");for(var d=["5da73c80a36455d5038e4972187c3cae51fd22",qa.Dx+"4ae6247590da4bb21c324ba3a84e385776",qd.xF+"fb236cdfda5de14c134ba1a95a2d4c7cc6f93c1387",J.za],e=1;5>e;e++)b[Ra("7ca11abfd7330390")](Ra(d[e-1]),10,15*e);b[c]=Ra("39f046ebb36e4b");for(c=1;5>c;c++)b[Ra("7ca11abfd7330390")](Ra(d[c-1]),10,15*c);Kk=a}}R.className="Diagram";
R.fromDiv=function(a){var b=a;"string"===typeof a&&(b=x.document.getElementById(a));return b instanceof HTMLDivElement&&b.B instanceof R?b.B:null};R.inherit=function(a,b){function c(){}if(Object.getPrototypeOf(a).prototype)throw Error("Used go.Diagram.inherit defining already defined class \n"+a);c.prototype=b.prototype;a.prototype=new c;a.prototype.constructor=a};R.None=pi;R.Uniform=bj;R.UniformToFill=cj;R.CycleAll=Mf;R.CycleNotDirected=Qf;R.CycleNotDirectedFast=Sf;R.CycleNotUndirected=Tf;
R.CycleDestinationTree=Nf;R.CycleSourceTree=Pf;R.DocumentScroll=Xh;R.InfiniteScroll=Zh;R.TreeParentCollapsed=ri;R.AllParentsCollapsed=Gk;R.AnyParentsCollapsed=Hk;function Gi(){this.Cy=null;this.l="zz@orderNum";"63ad05bbe23a1786468a4c741b6d2"===this._tk?this.Qe=this.l=!0:this.Qe=null}
function yj(a,b){b.Db.setTransform(b.Sb,0,0,b.Sb,0,0);if(null===a.Qe){b="f";var c=x[Ra("76a715b2f73f148a")][Ra("72ba13b5")];a.Qe=!0;if(Sg){var d=R[Ra("76a115b6ed251eaf4692")];if(d)for(var e=Ik.iterator;e.next();){d=e.value;d=Ra(d).split(Ra("39e9"));if(6>d.length)break;var f=Ra(d[1]).split(".");if("7da71ca0"!==d[4])break;var g=Ra(qa[Ra("6cae19")]).split(".");if(f[0]>g[0]||f[0]===g[0]&&f[1]>=g[1]){f=c[Ra("76ad18b4f73e")];for(g=c[Ra("73a612b6fb191d")](Ra("35e7"))+2;g<f;g++)b+=c[g];f=b[Ra("73a612b6fb191d")](Ra(d[2]));
0>f&&Ra(d[2])!==Ra("7da71ca0ad381e90")&&(f=b[Ra("73a612b6fb191d")](Ra("76a715b2ef3e149757")));0>f&&(f=b[Ra("73a612b6fb191d")](Ra("76a715b2ef3e149757")));0>f&&(f=c[Ra("73a612b6fb191d")](Ra("7baa19a6f76c1988428554")));a.Qe=!(0<=f&&f<b[Ra("73a612b6fb191d")](Ra("35"))||-1===b[Ra("73a612b6fb191d")](Ra("35")));if(!a.Qe)break;f=Ra(d[2]);if("#"!==f[0])break;g=x.document.createElement("div");for(var h=d[0].replace(/[A-Za-z]/g,"");4>h.length;)h+="9";h=h.substr(h.length-4);d="";d+=["gsh","gsf"][parseInt(h.substr(0,
1),10)%2];d+=["Header","Background","Display","Feedback"][parseInt(h.substr(0,1),10)%4];g[Ra("79a417a0f0181a8946")]=d;if(x.document[Ra("78a712aa")]){x.document[Ra("78a712aa")][Ra("7bb806b6ed32388c4a875b")](g);h=x.getComputedStyle(g).getPropertyValue(Ra("78a704b7e62456904c9b12701b6532a8"));x.document[Ra("78a712aa")][Ra("68ad1bbcf533388c4a875b")](g);if(!h)break;if(-1!==h.indexOf(parseInt(f[1]+f[2],16))&&-1!==h.indexOf(parseInt(f[3]+f[4],16))){a.Qe=!1;break}else if(Sa||Ta||Ua||Va)for(d="."+d,f=0;f<document.styleSheets.length;f++){g=
document.styleSheets[f].rules||document.styleSheets[f].cssRules;for(var k in g)if(d===g[k].selectorText){a.Qe=!1;break}}}else a.Qe=null,a.Qe=!1}}else{k=c[Ra("76ad18b4f73e")];for(e=c[Ra("73a612b6fb191d")](Ra("35e7"))+2;e<k;e++)b+=c[e];c=b[Ra("73a612b6fb191d")](Ra("7da71ca0ad381e90"));a.Qe=!(0<=c&&c<b[Ra("73a612b6fb191d")](Ra("35")))}}}return 0<a.Qe&&a!==a.Cy?!0:!1}
function Hi(a,b){if(Sg){void 0!==b&&null!==b||B("Diagram setup requires an argument DIV.");null!==a.La&&B("Diagram has already completed setup.");"string"===typeof b?a.La=x.document.getElementById(b):b instanceof HTMLDivElement?a.La=b:B("No DIV or DIV id supplied: "+b);null===a.La&&B("Invalid DIV id; could not get element with id: "+b);void 0!==a.La.B&&B("Invalid div id; div already has a Diagram associated with it.");"static"===x.getComputedStyle(a.La,null).position&&(a.La.style.position="relative");
a.La.style["-webkit-tap-highlight-color"]="rgba(255, 255, 255, 0)";a.La.style["-ms-touch-action"]="none";a.La.innerHTML="";a.La.B=a;var c=a.Pp?new Dj(a):new Ek(a);void 0!==c.style&&(c.style.position="absolute",c.style.top="0px",c.style.left="0px","rtl"===x.getComputedStyle(a.La,null).getPropertyValue("direction")&&(a.nl=!0),c.style.zIndex="2",c.style.userSelect="none",c.style.webkitUserSelect="none",c.style.MozUserSelect="none");a.sa=c;a.Db=c.context;b=a.Db;a.Sb=a.computePixelRatio();a.wa=a.La.clientWidth||
1;a.va=a.La.clientHeight||1;Fj(a,a.wa,a.va);a.zr=b.V[Ra("7eba17a4ca3b1a8346")][Ra("78a118b7")](b.V,Kk,4,4);a.La.insertBefore(c.Ea,a.La.firstChild);c=new Ek(null);c.width=1;c.height=1;a.ku=c;a.Rw=c.context;if(Sg){c=ta("div");var d=ta("div");c.style.position="absolute";c.style.overflow="auto";c.style.width=a.wa+"px";c.style.height=a.va+"px";c.style.zIndex="1";d.style.position="absolute";d.style.width="1px";d.style.height="1px";a.La.appendChild(c);c.appendChild(d);c.onscroll=Ri;c.onmousedown=Ti;c.ontouchstart=
Ti;c.B=a;c.Ay=!0;c.By=!0;a.Es=c;a.wp=d}a.Ht=ra(function(){a.uh=null;a.M()},300);a.vw=ra(function(){Gh(a)},250);a.preventDefault=function(a){a.preventDefault();return!1};a.qk=function(b){if(a.isEnabled){a.Yf=!0;var c=gj(a,b,!0);a.doMouseMove();a.currentTool.isBeyondDragSize()&&(a.pd=0);mj(c,b)}};a.pk=function(b){if(a.isEnabled)if(a.Yf=!0,a.ke)b.preventDefault();else{var c=gj(a,b,!0);c.down=!0;c.clickCount=b.detail;if(Ta||Ua)b.timeStamp-a.Aj<a.Us&&!a.currentTool.isBeyondDragSize()?a.pd++:a.pd=1,a.Aj=
b.timeStamp,c.clickCount=a.pd;c.clone(a.firstInput);a.doMouseDown();1===b.button?b.preventDefault():mj(c,b)}};a.sk=function(b){if(a.isEnabled)if(a.ke&&2===b.button)b.preventDefault();else if(a.ke&&0===b.button&&(a.ke=!1),a.Pj)b.preventDefault();else{a.Yf=!0;var c=gj(a,b,!0);c.up=!0;c.clickCount=b.detail;if(Ta||Ua)c.clickCount=a.pd;c.bubbles=b.bubbles;c.targetDiagram=ij(b);a.doMouseUp();a.Cf();mj(c,b)}};a.tk=function(b){if(a.isEnabled){var c=gj(a,b,!0);c.bubbles=!0;var d=0,e=0;c.delta=0;void 0!==b.deltaX?
(0!==b.deltaX&&(d=0<b.deltaX?1:-1),0!==b.deltaY&&(e=0<b.deltaY?1:-1),c.delta=Math.abs(b.deltaX)>Math.abs(b.deltaY)?-d:-e):void 0!==b.wheelDeltaX?(0!==b.wheelDeltaX&&(d=0<b.wheelDeltaX?-1:1),0!==b.wheelDeltaY&&(e=0<b.wheelDeltaY?-1:1),c.delta=Math.abs(b.wheelDeltaX)>Math.abs(b.wheelDeltaY)?-d:-e):void 0!==b.wheelDelta&&0!==b.wheelDelta&&(c.delta=0<b.wheelDelta?1:-1);a.doMouseWheel();mj(c,b)}};a.rk=function(b){a.isEnabled&&(a.Yf=!1,gj(a,b,!0),b=a.currentTool,b.cancelWaitAfter(),b.standardMouseOver())};
a.pw=function(b){if(a.isEnabled){a.Pj=!1;a.ke=!0;var c=jj(a,b,b.targetTouches[0],1<b.touches.length),d=null;0<b.targetTouches.length?d=b.targetTouches[0]:0<b.changedTouches.length&&(d=b.changedTouches[0]);if(null!==d){var e=d.screenX;d=d.screenY;var k=a.lo;b.timeStamp-a.Aj<a.Us&&!(25<Math.abs(k.x-e)||25<Math.abs(k.y-d))?a.pd++:a.pd=1;c.clickCount=a.pd;a.Aj=b.timeStamp;a.lo.h(e,d)}a.doMouseDown();mj(c,b)}};a.ow=function(b){if(a.isEnabled){var c=null;0<b.targetTouches.length?c=b.targetTouches[0]:0<
b.changedTouches.length&&(c=b.changedTouches[0]);c=lj(a,b,c,1<b.touches.length);a.doMouseMove();mj(c,b)}};a.nw=function(b){if(a.isEnabled)if(a.Pj)b.preventDefault();else if(!(1<b.touches.length)){var c=null,d=null;0<b.targetTouches.length?d=b.targetTouches[0]:0<b.changedTouches.length&&(d=b.changedTouches[0]);var e=kj(a,b,!1,!0,!1,!1);null!==d&&(c=x.document.elementFromPoint(d.clientX,d.clientY),null!==c&&c.B instanceof R&&c.B!==a&&hj(c.B,d,e),hj(a,d,e),e.clickCount=a.pd);null===c?e.targetDiagram=
ij(b):c.B?e.targetDiagram=c.B:e.targetDiagram=null;e.targetObject=null;a.doMouseUp();mj(e,b);a.ke=!1}};a.tm=function(b){if(a.isEnabled){a.Yf=!0;var c=a.ts;void 0===c[b.pointerId]&&(c[b.pointerId]=b);c=a.Kj;var d=!1;if(null!==c[0]&&c[0].pointerId===b.pointerId)c[0]=b;else if(null!==c[1]&&c[1].pointerId===b.pointerId)c[1]=b,d=!0;else if(null===c[0])c[0]=b;else if(null===c[1])c[1]=b,d=!0;else{b.preventDefault();return}if("touch"===b.pointerType||"pen"===b.pointerType)a.Pj=!1,a.ke=!0;c=jj(a,b,b,d);d=
a.lo;var e="touch"===b.pointerType||"pen"===b.pointerType?25:10;b.timeStamp-a.Aj<a.Us&&!(Math.abs(d.x-b.screenX)>e||Math.abs(d.y-b.screenY)>e)?a.pd++:a.pd=1;c.clickCount=a.pd;a.Aj=b.timeStamp;a.lo.Fg(b.screenX,b.screenY);a.doMouseDown();1===b.button?b.preventDefault():mj(c,b)}};a.um=function(b){if(a.isEnabled){a.Yf=!0;var c=a.Kj;if(null!==c[0]&&c[0].pointerId===b.pointerId)c[0]=b;else{if(null!==c[1]&&c[1].pointerId===b.pointerId){c[1]=b;return}if(null===c[0])c[0]=b;else return}c[0].pointerId===b.pointerId&&
(c=lj(a,b,b,null!==c[1]),c.targetDiagram=ij(b),a.doMouseMove(),mj(c,b))}};a.wm=function(b){if(a.isEnabled){a.Yf=!0;var c="touch"===b.pointerType||"pen"===b.pointerType,d=a.ts;if(c&&a.Pj)delete d[b.pointerId],b.preventDefault();else if(d=a.Kj,null!==d[0]&&d[0].pointerId===b.pointerId){d[0]=null;d=kj(a,b,!1,!0,!0,!1);var e=x.document.elementFromPoint(b.clientX,b.clientY);null!==e&&e.B instanceof R&&e.B!==a&&hj(e.B,b,d);hj(a,b,d);d.clickCount=a.pd;null===e?d.targetDiagram=ij(b):e.B?d.targetDiagram=e.B:
d.targetDiagram=null;d.targetObject=null;a.doMouseUp();mj(d,b);c&&(a.ke=!1)}else null!==d[1]&&d[1].pointerId===b.pointerId&&(d[1]=null)}};a.vm=function(b){if(a.isEnabled){a.Yf=!1;var c=a.ts;c[b.pointerId]&&delete c[b.pointerId];c=a.Kj;null!==c[0]&&c[0].pointerId===b.pointerId&&(c[0]=null);null!==c[1]&&c[1].pointerId===b.pointerId&&(c[1]=null);"touch"!==b.pointerType&&"pen"!==b.pointerType&&(b=a.currentTool,b.cancelWaitAfter(),b.standardMouseOver())}};b.sc(!0);Pi(a)}}Gi.className="DiagramHelper";
function cf(a){this.l=void 0===a?new I:a;this.v=new I}ma.Object.defineProperties(cf.prototype,{point:{get:function(){return this.l},set:function(a){this.l=a}},shifted:{get:function(){return this.v},set:function(a){this.v=a}}});cf.className="DraggingInfo";function Qj(a,b,c){this.node=a;this.info=b;this.Cv=c}Qj.className="DraggingNodeInfoPair";function Se(){this.reset()}
Se.prototype.reset=function(){this.isGridSnapEnabled=!1;this.isGridSnapRealtime=!0;this.gridSnapCellSize=(new M(NaN,NaN)).freeze();this.gridSnapCellSpot=vc;this.gridSnapOrigin=(new I(NaN,NaN)).freeze();this.Nz=this.dragsTree=this.dragsLink=!1;this.Mz=!0};function Lk(a){1<arguments.length&&B("Palette constructor can only take one optional argument, the DIV HTML element or its id.");R.call(this,a);Mk(this)}la(Lk,R);
function Mk(a){a.allowDragOut=!0;a.allowMove=!1;a.isReadOnly=!0;a.contentAlignment=wc;a.layout=new Nk}Lk.prototype.reset=function(){R.prototype.reset.call(this);Mk(this)};Lk.className="Palette";
function Ok(a){1<arguments.length&&B("Overview constructor can only take one optional argument, the DIV HTML element or its id.");R.call(this,a);var b=this;this.animationManager.isEnabled=!1;this.Rb=!0;this.Ha=null;this.dl=this.cl=!1;this.v=this.I=!0;this.Za=0;this.Y=!1;this.Ml=null;this.ly("drawShadows",!1);var c=new U,d=new Kf;d.stroke="magenta";d.strokeWidth=2;d.fill="transparent";d.name="BOXSHAPE";c.selectable=!0;c.selectionAdorned=!1;c.selectionObjectName="BOXSHAPE";c.locationObjectName="BOXSHAPE";
c.resizeObjectName="BOXSHAPE";c.cursor="move";c.add(d);this.l=c;this.allowDelete=this.allowCopy=!1;this.allowSelect=!0;this.autoScrollRegion=new oc(0,0,0,0);this.ma.h(0,0);this.toolManager.Va("Dragging",new Pk,this.toolManager.mouseMoveTools);this.click=function(){var a=b.observed;if(null!==a){var c=a.viewportBounds,d=b.lastInput.documentPoint;a.position=new I(d.x-c.width/2,d.y-c.height/2)}};this.Je=function(){b.Na();Qk(b)};this.Ef=function(){null!==b.observed&&(b.Na(),b.M())};this.Oh=function(){1>
b.updateDelay?b.M():b.Y||(b.Y=!0,setTimeout(function(){b.Y=!1;Rk(b);b.M()},b.updateDelay))};this.Yc=function(){null!==b.observed&&Qk(b)};this.autoScale=bj;this.Rb=!1}la(Ok,R);Ok.prototype.computePixelRatio=function(){return 1};
Ok.prototype.bc=function(){null===this.La&&B("No div specified");null===this.sa&&B("No canvas specified");if(!(this.sa instanceof Dj)&&(hi(this.box),this.Ac)){var a=this.observed;if(null!==a&&!a.animationManager.isAnimating){wj(this);var b=this.sa;a=this.Db;a.sc(!0);a.setTransform(1,0,0,1,0,0);a.clearRect(0,0,b.width,b.height);1>this.updateDelay?Sk(this):null!==this.Ml&&(a.drawImage(this.Ml.Ea,0,0),b=this.kb,b.reset(),1!==this.scale&&b.scale(this.scale),0===this.position.x&&0===this.position.y||b.translate(-this.position.x,
-this.position.y),a.scale(this.Sb,this.Sb),a.transform(b.m11,b.m12,b.m21,b.m22,b.dx,b.dy));b=this.Ja.j;for(var c=b.length,d=0;d<c;d++)b[d].bc(a,this);this.Ac=this.mi=!1}}};function Rk(a){var b=a.sa,c=a.Db;if(null!==b&&null!==c){wj(a);if(null===a.Ml){var d=new Ek(null);d.width=b.width;d.height=b.height;a.Ml=d}try{a.sa=a.Ml,a.Db=a.sa.context,a.Db.sc(!0),a.Db.setTransform(1,0,0,1,0,0),a.Db.clearRect(0,0,a.sa.width,a.sa.height),Sk(a)}finally{a.sa=b,a.Db=c}}}
function Sk(a){var b=a.observed;if(null!==b){var c=a.drawsTemporaryLayers,d=a.drawsGrid&&c,e=b.grid;d&&null!==e&&e.visible&&!isNaN(e.width)&&!isNaN(e.height)&&(e=N.alloc().assign(a.viewportBounds).Hc(b.viewportBounds),pj(b,e),N.free(e),Vi(b));var f=a.kb;f.reset();1!==a.scale&&f.scale(a.scale);0===a.position.x&&0===a.position.y||f.translate(-a.position.x,-a.position.y);e=a.Db;e.scale(a.Sb,a.Sb);e.transform(f.m11,f.m12,f.m21,f.m22,f.dx,f.dy);b=b.Ja.j;f=b.length;for(var g=0;g<f;g++){var h=b[g],k=a;if(h.visible&&
0!==h.opacity){var l=h.diagram.grid.part;if(!c&&h.isTemporary)d&&l.layer===h&&(h=ji(h,e),l.bc(e,k),e.globalAlpha=h);else{for(var m=ji(h,e),n=k.scale,p=N.alloc(),r=h.Ca.j,q=r.length,u=0;u<q;u++){var v=r[u];(d||v!==l)&&h.Pi(e,v,k,null,n,p)}N.free(p);e.globalAlpha=m}}}}}
function Qk(a){var b=a.box;if(null!==b){var c=a.observed;if(null!==c){a.Ac=!0;c=c.viewportBounds;var d=b.selectionObject,e=M.alloc();e.h(c.width,c.height);d.desiredSize=e;M.free(e);a=2/a.scale;d instanceof Kf&&(d.strokeWidth=a);b.location=new I(c.x-a/2,c.y-a/2);b.isSelected=!0}}}Ok.prototype.computeBounds=function(){var a=this.observed;if(null===a)return ic;var b=a.documentBounds.copy();b.Hc(a.viewportBounds);return b};Ok.prototype.Sx=function(){!0!==this.Ac&&(this.Ac=!0,this.Pb())};
Ok.prototype.Bq=function(a,b,c,d){this.Rb||(Ui(this),this.M(),$i(this),this.Na(),Qk(this),this.Sd.scale=c,this.Sd.position.x=a.x,this.Sd.position.y=a.y,this.Sd.bounds.assign(a),this.Sd.Kv=d,this.R("ViewportBoundsChanged",this.Sd,a))};
ma.Object.defineProperties(Ok.prototype,{observed:{get:function(){return this.Ha},set:function(a){var b=this.Ha;a instanceof Ok&&B("Overview.observed Diagram may not be an Overview itself: "+a);if(b!==a){null!==b&&(this.remove(this.box),b.ym("ViewportBoundsChanged",this.Je),b.ym("DocumentBoundsChanged",this.Ef),b.ym("InvalidateDraw",this.Oh),b.ym("AnimationFinished",this.Yc));this.Ha=a;null!==a&&(a.Uj("ViewportBoundsChanged",this.Je),a.Uj("DocumentBoundsChanged",this.Ef),
a.Uj("InvalidateDraw",this.Oh),a.Uj("AnimationFinished",this.Yc),this.add(this.box),Qk(this));this.Na();if(null===a){this.Ml=null;var c=this.sa,d=this.Db;c&&d&&(d.setTransform(1,0,0,1,0,0),d.clearRect(0,0,c.width,c.height))}else Rk(this),Qk(this),this.M();this.g("observed",b,a)}}},box:{get:function(){return this.l},set:function(a){var b=this.l;b!==a&&(this.l=a,this.remove(b),this.add(this.l),Qk(this),this.g("box",b,a))}},drawsTemporaryLayers:{
get:function(){return this.I},set:function(a){this.I!==a&&(this.I=a,this.Fe())}},drawsGrid:{get:function(){return this.v},set:function(a){this.v!==a&&(this.v=a,this.Fe())}},updateDelay:{get:function(){return this.Za},set:function(a){0>a&&(a=0);this.Za!==a&&(this.Za=a)}}});Ok.className="Overview";function Pk(){Re.call(this);this.l=null}la(Pk,Re);
Pk.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram;if(null===a||!a.allowMove||!a.allowSelect)return!1;var b=a.observed;if(null===b)return!1;var c=a.lastInput;if(!c.left||a.currentTool!==this&&(!this.isBeyondDragSize()||c.isTouchEvent&&c.timestamp-a.firstInput.timestamp<this.delay))return!1;null===this.findDraggablePart()&&(c=b.viewportBounds,this.l=new I(c.width/2,c.height/2),a=a.firstInput.documentPoint,b.position=new I(a.x-this.l.x,a.y-this.l.y));return!0};
Pk.prototype.doActivate=function(){this.l=null;Re.prototype.doActivate.call(this)};Pk.prototype.doUpdateCursor=function(){var a=this.diagram,b=a.box;null!==b&&b.cursor&&(a.currentCursor=b.cursor)};Pk.prototype.moveParts=function(){var a=this.diagram,b=a.observed;if(null!==b){var c=a.box;if(null!==c){if(null===this.l){var d=a.firstInput.documentPoint;c=c.location;this.l=new I(d.x-c.x,d.y-c.y)}a=a.lastInput.documentPoint;b.position=new I(a.x-this.l.x,a.y-this.l.y)}}};Pk.className="OverviewDraggingTool";
function Tk(){Ya(this);this.B=Ce;this.Za=this.I=this.v=!0;this.Y=this.Ha=this.kd=this.Ia=!1;this.yi=this.l=null;this.Yc=1.05;this.Bu=NaN;this.Ww=null;this.cv=NaN;this.bv=ic;this.pg=null;this.Ic=200}Tk.prototype.toString=function(){return"CommandHandler"};Tk.prototype.Zd=function(a){this.B=a};
Tk.prototype.doKeyDown=function(){var a=this.diagram,b=a.lastInput,c=Wa?b.meta:b.control,d=b.shift,e=b.alt,f=b.key;!c||"C"!==f&&"Insert"!==f?c&&"X"===f||d&&"Del"===f?this.canCutSelection()&&this.cutSelection():c&&"V"===f||d&&"Insert"===f?this.canPasteSelection()&&this.pasteSelection():c&&"Y"===f||e&&d&&"Backspace"===f?this.canRedo()&&this.redo():c&&"Z"===f||e&&"Backspace"===f?this.canUndo()&&this.undo():"Del"===f||"Backspace"===f?this.canDeleteSelection()&&this.deleteSelection():c&&"A"===f?this.canSelectAll()&&
this.selectAll():"Esc"===f?this.canStopCommand()&&this.stopCommand():"Up"===f?a.allowVerticalScroll&&(c?a.scroll("pixel","up"):a.scroll("line","up")):"Down"===f?a.allowVerticalScroll&&(c?a.scroll("pixel","down"):a.scroll("line","down")):"Left"===f?a.allowHorizontalScroll&&(c?a.scroll("pixel","left"):a.scroll("line","left")):"Right"===f?a.allowHorizontalScroll&&(c?a.scroll("pixel","right"):a.scroll("line","right")):"PageUp"===f?d&&a.allowHorizontalScroll?a.scroll("page","left"):a.allowVerticalScroll&&
a.scroll("page","up"):"PageDown"===f?d&&a.allowHorizontalScroll?a.scroll("page","right"):a.allowVerticalScroll&&a.scroll("page","down"):"Home"===f?c&&a.allowVerticalScroll?a.scroll("document","up"):!c&&a.allowHorizontalScroll&&a.scroll("document","left"):"End"===f?c&&a.allowVerticalScroll?a.scroll("document","down"):!c&&a.allowHorizontalScroll&&a.scroll("document","right"):" "===f?this.canScrollToPart()&&this.scrollToPart():"Subtract"===f?this.canDecreaseZoom()&&this.decreaseZoom():"Add"===f?this.canIncreaseZoom()&&
this.increaseZoom():c&&"0"===f?this.canResetZoom()&&this.resetZoom():d&&"Z"===f?this.canZoomToFit()&&this.zoomToFit():c&&!d&&"G"===f?this.canGroupSelection()&&this.groupSelection():c&&d&&"G"===f?this.canUngroupSelection()&&this.ungroupSelection():b.event&&113===b.event.which?this.canEditTextBlock()&&this.editTextBlock():b.event&&93===b.event.which?this.canShowContextMenu()&&this.showContextMenu():b.bubbles=!0:this.canCopySelection()&&this.copySelection()};
Tk.prototype.doKeyUp=function(){this.diagram.lastInput.bubbles=!0};Tk.prototype.stopCommand=function(){var a=this.diagram,b=a.currentTool;b instanceof Oa&&a.allowSelect&&a.clearSelection();null!==b&&b.doCancel()};Tk.prototype.canStopCommand=function(){return!0};
Tk.prototype.selectAll=function(){var a=this.diagram;a.M();try{a.currentCursor="wait";a.R("ChangingSelection",a.selection);for(var b=a.parts;b.next();)b.value.isSelected=!0;for(var c=a.nodes;c.next();)c.value.isSelected=!0;for(var d=a.links;d.next();)d.value.isSelected=!0}finally{a.R("ChangedSelection",a.selection),a.currentCursor=""}};Tk.prototype.canSelectAll=function(){return this.diagram.allowSelect};
Tk.prototype.deleteSelection=function(){var a=this.diagram;try{a.currentCursor="wait";a.R("ChangingSelection",a.selection);a.ua("Delete");a.R("SelectionDeleting",a.selection);for(var b=new F,c=a.selection.iterator;c.next();)Uk(b,c.value,!0,this.deletesTree?Infinity:0,this.deletesConnectedLinks?null:!1,function(a){return a.canDelete()});a.Jt(b,!0);a.R("SelectionDeleted",b)}finally{a.Ua("Delete"),a.R("ChangedSelection",a.selection),a.currentCursor=""}};
Tk.prototype.canDeleteSelection=function(){var a=this.diagram;return a.isReadOnly||a.isModelReadOnly||!a.allowDelete||0===a.selection.count?!1:!0};Tk.prototype.copySelection=function(){var a=this.diagram,b=new F;for(a=a.selection.iterator;a.next();)Uk(b,a.value,!0,this.copiesTree?Infinity:0,this.copiesConnectedLinks,function(a){return a.canCopy()});this.copyToClipboard(b)};Tk.prototype.canCopySelection=function(){var a=this.diagram;return a.allowCopy&&a.allowClipboard&&0!==a.selection.count?!0:!1};
Tk.prototype.cutSelection=function(){this.copySelection();this.deleteSelection()};Tk.prototype.canCutSelection=function(){var a=this.diagram;return!a.isReadOnly&&!a.isModelReadOnly&&a.allowCopy&&a.allowDelete&&a.allowClipboard&&0!==a.selection.count?!0:!1};
Tk.prototype.copyToClipboard=function(a){var b=this.diagram,c=null;if(null===a)Ii=null,Ji="";else{c=b.model;var d=!1,e=!1,f=null;try{c.qm()&&(d=c.bk,c.bk=this.copiesParentKey),c.ik()&&(e=c.ak,c.ak=this.copiesGroupKey),f=b.ck(a,null,!0)}finally{c.qm()&&(c.bk=d),c.ik()&&(c.ak=e),c=new E,c.addAll(f),Ii=c,Ji=b.model.dataFormat}}b.R("ClipboardChanged",c)};
Tk.prototype.pasteFromClipboard=function(){var a=new F,b=Ii;if(null===b)return a;var c=this.diagram;if(Ji!==c.model.dataFormat)return a;var d=c.model,e=!1,f=!1,g=null;try{d.qm()&&(e=d.bk,d.bk=this.copiesParentKey),d.ik()&&(f=d.ak,d.ak=this.copiesGroupKey),g=c.ck(b,c,!1)}finally{for(d.qm()&&(d.bk=e),d.ik()&&(d.ak=f),b=g.iterator;b.next();)c=b.value,d=b.key,c.location.u()||(d.location.u()?c.location=d.location:!c.position.u()&&d.position.u()&&(c.position=d.position)),a.add(c)}return a};
Tk.prototype.pasteSelection=function(a){void 0===a&&(a=null);var b=this.diagram;try{b.currentCursor="wait";b.R("ChangingSelection",b.selection);b.ua("Paste");var c=this.pasteFromClipboard();0<c.count&&b.clearSelection(!0);for(var d=c.iterator;d.next();)d.value.isSelected=!0;if(null!==a){var e=b.computePartsBounds(b.selection);if(e.u()){var f=this.computeEffectiveCollection(b.selection,b.Qk);rf(b,f,new I(a.x-e.centerX,a.y-e.centerY),b.Qk,!1)}}b.R("ClipboardPasted",c)}finally{b.Ua("Paste"),b.R("ChangedSelection",
b.selection),b.currentCursor=""}};Tk.prototype.canPasteSelection=function(){var a=this.diagram;return a.isReadOnly||a.isModelReadOnly||!a.allowInsert||!a.allowClipboard||null===Ii||0===Ii.count||Ji!==a.model.dataFormat?!1:!0};Tk.prototype.undo=function(){this.diagram.undoManager.undo()};Tk.prototype.canUndo=function(){var a=this.diagram;return a.isReadOnly||a.isModelReadOnly?!1:a.allowUndo&&a.undoManager.canUndo()};Tk.prototype.redo=function(){this.diagram.undoManager.redo()};
Tk.prototype.canRedo=function(){var a=this.diagram;return a.isReadOnly||a.isModelReadOnly?!1:a.allowUndo&&a.undoManager.canRedo()};Tk.prototype.decreaseZoom=function(a){void 0===a&&(a=1/this.zoomFactor);var b=this.diagram;b.autoScale===pi&&(a=b.scale*a,a<b.minScale||a>b.maxScale||(b.scale=a))};Tk.prototype.canDecreaseZoom=function(a){void 0===a&&(a=1/this.zoomFactor);var b=this.diagram;if(b.autoScale!==pi)return!1;a=b.scale*a;return a<b.minScale||a>b.maxScale?!1:b.allowZoom};
Tk.prototype.increaseZoom=function(a){void 0===a&&(a=this.zoomFactor);var b=this.diagram;b.autoScale===pi&&(a=b.scale*a,a<b.minScale||a>b.maxScale||(b.scale=a))};Tk.prototype.canIncreaseZoom=function(a){void 0===a&&(a=this.zoomFactor);var b=this.diagram;if(b.autoScale!==pi)return!1;a=b.scale*a;return a<b.minScale||a>b.maxScale?!1:b.allowZoom};Tk.prototype.resetZoom=function(a){void 0===a&&(a=this.defaultScale);var b=this.diagram;a<b.minScale||a>b.maxScale||(b.scale=a)};
Tk.prototype.canResetZoom=function(a){void 0===a&&(a=this.defaultScale);var b=this.diagram;return a<b.minScale||a>b.maxScale?!1:b.allowZoom};Tk.prototype.zoomToFit=function(){var a=this.diagram,b=a.animationManager;b.Xc();a.Fe();var c=a.position,d=a.scale;Bh(b,"Zoom To Fit");d===this.cv&&!isNaN(this.Bu)&&a.documentBounds.w(this.bv)?(a.scale=this.Bu,a.position=this.Ww,this.cv=NaN,this.bv=ic):(this.Bu=d,this.Ww=c.copy(),a.zoomToFit(),this.cv=a.scale,this.bv=a.documentBounds.copy());Dh(b)};
Tk.prototype.canZoomToFit=function(){return this.diagram.allowZoom};
Tk.prototype.scrollToPart=function(a){void 0===a&&(a=null);var b=this.diagram;Li(b);if(null===a){try{null!==this.pg&&(this.pg.next()?a=this.pg.value:this.pg=null)}catch(k){this.pg=null}null===a&&(0<b.highlighteds.count?this.pg=b.highlighteds.iterator:0<b.selection.count&&(this.pg=b.selection.iterator),null!==this.pg&&this.pg.next()&&(a=this.pg.value))}if(null!==a){var c=b.animationManager;Bh(c,"Scroll To Part");var d=this.scrollToPartPause;if(0<d){var e=Vk(this,a,[a]);if(1===e.length)b.ua(),b.ct(a.actualBounds),
b.Ua("Scroll To Part");else{var f=function(){b.ua();for(var a=e.pop();0<e.length&&a instanceof W&&a.isTreeExpanded&&(!(a instanceof T)||a.isSubGraphExpanded);)a=e.pop();0<e.length?(a instanceof U&&b.dw(a.actualBounds),a instanceof W&&!a.isTreeExpanded&&(a.isTreeExpanded=!0),a instanceof T&&!a.isSubGraphExpanded&&(a.isSubGraphExpanded=!0)):(a instanceof U&&b.ct(a.actualBounds),b.ym("LayoutCompleted",g));b.Ua("Scroll To Part")},g=function(){sa(f,(c.isEnabled?c.duration:0)+d)};b.Uj("LayoutCompleted",
g);f()}}else{var h=b.position.copy();b.ct(a.actualBounds);h.Ma(b.position)&&c.Xc()}}};
function Vk(a,b,c){if(b.isVisible())return c;if(b instanceof Ke)Vk(a,b.adornedPart,c);else if(b instanceof S){var d=b.fromNode;null!==d&&Vk(a,d,c);b=b.toNode;null!==b&&Vk(a,b,c)}else b instanceof W&&(d=b.labeledLink,null!==d&&Vk(a,d,c),d=b.Bg(),null!==d&&(d.isTreeExpanded||d.wasTreeExpanded||c.push(d),Vk(a,d,c))),b=b.containingGroup,null!==b&&(b.isSubGraphExpanded||b.wasSubGraphExpanded||c.push(b),Vk(a,b,c));return c}
Tk.prototype.canScrollToPart=function(a){void 0===a&&(a=null);if(null!==a&&!(a instanceof U))return!1;a=this.diagram;return 0===a.selection.count&&0===a.highlighteds.count?!1:a.allowHorizontalScroll&&a.allowVerticalScroll};
Tk.prototype.collapseTree=function(a){void 0===a&&(a=null);var b=this.diagram;try{b.ua("Collapse Tree");Bh(b.animationManager,"Collapse Tree");var c=new E;if(null!==a&&a.isTreeExpanded)a.collapseTree(),c.add(a);else if(null===a)for(var d=b.selection.iterator;d.next();){var e=d.value;e instanceof W&&e.isTreeExpanded&&(e.collapseTree(),c.add(e))}b.R("TreeCollapsed",c)}finally{b.Ua("Collapse Tree")}};
Tk.prototype.canCollapseTree=function(a){void 0===a&&(a=null);var b=this.diagram;if(b.isReadOnly)return!1;if(null!==a){if(!(a instanceof W&&a.isTreeExpanded))return!1;if(0<a.nq().count)return!0}else for(a=b.selection.iterator;a.next();)if(b=a.value,b instanceof W&&b.isTreeExpanded&&0<b.nq().count)return!0;return!1};
Tk.prototype.expandTree=function(a){void 0===a&&(a=null);var b=this.diagram;try{b.ua("Expand Tree");Bh(b.animationManager,"Expand Tree");var c=new E;if(null!==a&&!a.isTreeExpanded)a.expandTree(),c.add(a);else if(null===a)for(var d=b.selection.iterator;d.next();){var e=d.value;e instanceof W&&!e.isTreeExpanded&&(e.expandTree(),c.add(e))}b.R("TreeExpanded",c)}finally{b.Ua("Expand Tree")}};
Tk.prototype.canExpandTree=function(a){void 0===a&&(a=null);var b=this.diagram;if(b.isReadOnly)return!1;if(null!==a){if(!(a instanceof W)||a.isTreeExpanded)return!1;if(0<a.nq().count)return!0}else for(a=b.selection.iterator;a.next();)if(b=a.value,b instanceof W&&!b.isTreeExpanded&&0<b.nq().count)return!0;return!1};
Tk.prototype.groupSelection=function(){var a=this.diagram,b=a.model;if(b.jk()){var c=this.archetypeGroupData;if(null!==c){var d=null;try{a.currentCursor="wait";a.R("ChangingSelection",a.selection);a.ua("Group");for(var e=new E,f=a.selection.iterator;f.next();){var g=f.value;g.Wb()&&g.canGroup()&&e.add(g)}for(var h=new E,k=e.iterator;k.next();){var l=k.value;f=!1;for(var m=e.iterator;m.next();)if(l.Xd(m.value)){f=!0;break}f||h.add(l)}if(0<h.count){var n=h.first().containingGroup;if(null!==n)for(;null!==
n;){e=!1;for(var p=h.iterator;p.next();)if(!p.value.Xd(n)){e=!0;break}if(e)n=n.containingGroup;else break}if(c instanceof T)wg(c),d=c.copy(),null!==d&&a.add(d);else if(b.Iv(c)){var r=b.copyNodeData(c);za(r)&&(b.qf(r),d=a.Si(r))}if(null!==d){null!==n&&this.isValidMember(n,d)&&(d.containingGroup=n);for(var q=h.iterator;q.next();){var u=q.value;this.isValidMember(d,u)&&(u.containingGroup=d)}a.clearSelection(!0);d.isSelected=!0}}a.R("SelectionGrouped",d)}finally{a.Ua("Group"),a.R("ChangedSelection",a.selection),
a.currentCursor=""}}}};Tk.prototype.canGroupSelection=function(){var a=this.diagram;if(a.isReadOnly||a.isModelReadOnly||!a.allowInsert||!a.allowGroup||!a.model.jk()||null===this.archetypeGroupData)return!1;for(a=a.selection.iterator;a.next();){var b=a.value;if(b.Wb()&&b.canGroup())return!0}return!1};
function Wk(a){var b=Fa();for(a=a.iterator;a.next();){var c=a.value;c instanceof S||b.push(c)}a=new F;c=b.length;for(var d=0;d<c;d++){for(var e=b[d],f=!0,g=0;g<c;g++)if(e.Xd(b[g])){f=!1;break}f&&a.add(e)}Ha(b);return a}
Tk.prototype.isValidMember=function(a,b){if(null===b||a===b||b instanceof S)return!1;if(null!==a){if(a===b||a.Xd(b))return!1;var c=a.memberValidation;if(null!==c&&!c(a,b)||null===a.data&&null!==b.data||null!==a.data&&null===b.data)return!1}c=this.memberValidation;return null!==c?c(a,b):!0};
Tk.prototype.ungroupSelection=function(a){void 0===a&&(a=null);var b=this.diagram,c=b.model;if(c.jk())try{b.currentCursor="wait";b.R("ChangingSelection",b.selection);b.ua("Ungroup");var d=new E;if(null!==a)d.add(a);else for(var e=b.selection.iterator;e.next();){var f=e.value;f instanceof T&&f.canUngroup()&&d.add(f)}var g=new E;if(0<d.count){b.clearSelection(!0);for(var h=d.iterator;h.next();){var k=h.value;k.expandSubGraph();var l=k.containingGroup,m=null!==l&&null!==l.data?c.ja(l.data):void 0;g.addAll(k.memberParts);
for(var n=g.iterator;n.next();){var p=n.value;p.isSelected=!0;if(!(p instanceof S)){var r=p.data;null!==r?c.Mt(r,m):p.containingGroup=l}}b.remove(k)}}b.R("SelectionUngrouped",d,g)}finally{b.Ua("Ungroup"),b.R("ChangedSelection",b.selection),b.currentCursor=""}};
Tk.prototype.canUngroupSelection=function(a){void 0===a&&(a=null);var b=this.diagram;if(b.isReadOnly||b.isModelReadOnly||!b.allowDelete||!b.allowUngroup||!b.model.jk())return!1;if(null!==a){if(!(a instanceof T))return!1;if(a.canUngroup())return!0}else for(a=b.selection.iterator;a.next();)if(b=a.value,b instanceof T&&b.canUngroup())return!0;return!1};
Tk.prototype.addTopLevelParts=function(a,b){var c=!0;for(a=Wk(a).iterator;a.next();){var d=a.value;null!==d.containingGroup&&(!b||this.isValidMember(null,d)?d.containingGroup=null:c=!1)}return c};
Tk.prototype.collapseSubGraph=function(a){void 0===a&&(a=null);var b=this.diagram;try{b.ua("Collapse SubGraph");Bh(b.animationManager,"Collapse SubGraph");var c=new E;if(null!==a&&a.isSubGraphExpanded)a.collapseSubGraph(),c.add(a);else if(null===a)for(var d=b.selection.iterator;d.next();){var e=d.value;e instanceof T&&e.isSubGraphExpanded&&(e.collapseSubGraph(),c.add(e))}b.R("SubGraphCollapsed",c)}finally{b.Ua("Collapse SubGraph")}};
Tk.prototype.canCollapseSubGraph=function(a){void 0===a&&(a=null);var b=this.diagram;if(b.isReadOnly)return!1;if(null!==a)return a instanceof T&&a.isSubGraphExpanded?!0:!1;for(a=b.selection.iterator;a.next();)if(b=a.value,b instanceof T&&b.isSubGraphExpanded)return!0;return!1};
Tk.prototype.expandSubGraph=function(a){void 0===a&&(a=null);var b=this.diagram;try{b.ua("Expand SubGraph");Bh(b.animationManager,"Expand SubGraph");var c=new E;if(null!==a&&!a.isSubGraphExpanded)a.expandSubGraph(),c.add(a);else if(null===a)for(var d=b.selection.iterator;d.next();){var e=d.value;e instanceof T&&!e.isSubGraphExpanded&&(e.expandSubGraph(),c.add(e))}b.R("SubGraphExpanded",c)}finally{b.Ua("Expand SubGraph")}};
Tk.prototype.canExpandSubGraph=function(a){void 0===a&&(a=null);var b=this.diagram;if(b.isReadOnly)return!1;if(null!==a)return a instanceof T&&!a.isSubGraphExpanded?!0:!1;for(a=b.selection.iterator;a.next();)if(b=a.value,b instanceof T&&!b.isSubGraphExpanded)return!0;return!1};
Tk.prototype.editTextBlock=function(a){void 0===a&&(a=null);var b=this.diagram,c=b.toolManager.findTool("TextEditing");if(null!==c){if(null===a){a=null;for(var d=b.selection.iterator;d.next();){var e=d.value;if(e.canEdit()){a=e;break}}if(null===a)return;a=a.hm(function(a){return a instanceof Ug&&a.editable})}null!==a&&(b.currentTool=null,c.textBlock=a,b.currentTool=c)}};
Tk.prototype.canEditTextBlock=function(a){void 0===a&&(a=null);var b=this.diagram;if(b.isReadOnly||b.isModelReadOnly||!b.allowTextEdit||null===b.toolManager.findTool("TextEditing"))return!1;if(null!==a){if(!(a instanceof Ug))return!1;a=a.part;if(null!==a&&a.canEdit())return!0}else for(b=b.selection.iterator;b.next();)if(a=b.value,a.canEdit()&&(a=a.hm(function(a){return a instanceof Ug&&a.editable}),null!==a))return!0;return!1};
Tk.prototype.showContextMenu=function(a){var b=this.diagram,c=b.toolManager.findTool("ContextMenu");if(null!==c&&(void 0===a&&(a=0<b.selection.count?b.selection.first():b),a=c.findObjectWithContextMenu(a),null!==a)){var d=b.lastInput,e=null;a instanceof Y?e=a.ga(Ac):b.viewportBounds.aa(d.documentPoint)||(e=b.viewportBounds,e=new I(e.x+e.width/2,e.y+e.height/2));null!==e&&(d.viewPoint=b.Nq(e),d.documentPoint=e,d.left=!1,d.right=!0,d.up=!0);b.currentTool=c;Qg(c,!1,a)}};
Tk.prototype.canShowContextMenu=function(a){var b=this.diagram,c=b.toolManager.findTool("ContextMenu");if(null===c)return!1;void 0===a&&(a=0<b.selection.count?b.selection.first():b);return null===c.findObjectWithContextMenu(a)?!1:!0};
Tk.prototype.computeEffectiveCollection=function(a,b){var c=this.diagram,d=c.toolManager.findTool("Dragging"),e=c.currentTool===d;void 0===b&&(b=e?d.dragOptions:c.Qk);d=new G;if(null===a)return d;for(var f=a.iterator;f.next();)Oj(c,d,f.value,e,b);if(null!==c.draggedLink&&b.dragsLink)return d;for(f=a.iterator;f.next();)a=f.value,a instanceof S&&(b=a.fromNode,null===b||d.contains(b)?(b=a.toNode,null===b||d.contains(b)||d.remove(a)):d.remove(a));return d};
ma.Object.defineProperties(Tk.prototype,{diagram:{get:function(){return this.B}},copiesClipboardData:{get:function(){return this.v},set:function(a){this.v=a}},copiesConnectedLinks:{get:function(){return this.I},set:function(a){this.I=a}},deletesConnectedLinks:{get:function(){return this.Za},set:function(a){this.Za=a}},copiesTree:{get:function(){return this.Ia},
set:function(a){this.Ia=a}},deletesTree:{get:function(){return this.kd},set:function(a){this.kd=a}},copiesParentKey:{get:function(){return this.Ha},set:function(a){this.Ha=a}},copiesGroupKey:{get:function(){return this.Y},set:function(a){this.Y=a}},archetypeGroupData:{get:function(){return this.l},set:function(a){this.l=a}},memberValidation:{get:function(){return this.yi},
set:function(a){this.yi=a}},defaultScale:{get:function(){return this.diagram.defaultScale},set:function(a){this.diagram.defaultScale=a}},zoomFactor:{get:function(){return this.Yc},set:function(a){1<a||B("zoomFactor must be larger than 1.0, not: "+a);this.Yc=a}},scrollToPartPause:{get:function(){return this.Ic},set:function(a){this.Ic=a}}});Tk.className="CommandHandler";Ci=function(){return new Tk};
function Y(){Ya(this);this.F=4225027;this.qb=1;this.ng=null;this.Qa="";this.dc=this.gb=null;this.ma=(new I(NaN,NaN)).freeze();this.Lc=Rb;this.eg=Lb;this.dg=Qb;this.kb=new qd;this.Qh=new qd;this.bg=new qd;this.ya=this.Wk=1;this.Yb=0;this.we=Xk;this.fh=sc;this.nc=(new N(NaN,NaN,NaN,NaN)).freeze();this.ub=(new N(NaN,NaN,NaN,NaN)).freeze();this.oc=(new N(0,0,NaN,NaN)).freeze();this.O=this.cp=this.ep=null;this.Fk=this.vb=$c;this.pp=0;this.qp=1;this.Og=0;this.gn=1;this.Kp=null;this.xp=-Infinity;this.Hl=
0;this.Il=Gb;this.Jl=ag;this.fi="";this.$a=this.N=null;this.Jk=-1;this.Ll=this.md=this.ei=this.Pl=null;this.ws=xg;this.sp=this.Kg=this.Jj=null}var ud,xg,zg,Xk,Yk,Zk,$k,al,bl,cl;
Y.prototype.cloneProtected=function(a){a.F=this.F|6144;a.qb=this.qb;a.Qa=this.Qa;a.gb=this.gb;a.dc=this.dc;a.Kg=this.Kg;a.ma.assign(this.ma);a.Lc=this.Lc.G();a.eg=this.eg.G();a.dg=this.dg.G();a.bg=this.bg.copy();a.ya=this.ya;a.Yb=this.Yb;a.we=this.we;a.fh=this.fh.G();a.nc.assign(this.nc);a.ub.assign(this.ub);a.oc.assign(this.oc);a.cp=this.cp;null!==this.O&&(a.O=this.O.copy());a.vb=this.vb.G();a.Fk=this.Fk.G();a.pp=this.pp;a.qp=this.qp;a.Og=this.Og;a.gn=this.gn;a.Kp=this.Kp;a.xp=this.xp;a.Hl=this.Hl;
a.Il=this.Il.G();a.Jl=this.Jl;a.fi=this.fi;null!==this.N&&(a.N=this.N.copy());a.$a=this.$a;a.Jk=this.Jk;null!==this.ei&&(a.ei=Ba(this.ei));null!==this.md&&(a.md=this.md.copy());a.Ll=this.Ll};Y.prototype.sx=function(a){var b=this.ei;if(Aa(b))for(var c=0;c<b.length;c++){if(b[c]===a)return}else this.ei=b=[];b.push(a)};Y.prototype.tf=function(a){a.ep=null;a.Jj=null;a.o()};
Y.prototype.clone=function(){var a=new this.constructor;this.cloneProtected(a);if(null!==this.ei)for(var b=0;b<this.ei.length;b++){var c=this.ei[b];a[c]=this[c]}return a};Y.prototype.copy=function(){return this.clone()};t=Y.prototype;t.cb=function(a){a.classType===S?0===a.name.indexOf("Orient")?this.segmentOrientation=a:B("Unknown Link enum value for GraphObject.segmentOrientation property: "+a):a.classType===Y&&(this.stretch=a)};t.toString=function(){return Ia(this.constructor)+"#"+lb(this)};
function dl(a){null===a.N&&(a.N=new el)}t.Ec=function(){if(null===this.O){var a=new fl;a.Yg=uc;a.yh=uc;a.Wg=10;a.wh=10;a.Xg=0;a.xh=0;this.O=a}};
t.Ya=function(a,b,c,d,e,f,g){var h=this.part;if(null!==h&&(h.vk(a,b,c,d,e,f,g),c===this&&a===ue&&gl(this)&&hl(this,h,b),f=this.diagram,null===this.Kg||null===f||!f.kk||f.undoManager.isUndoingRedoing||f.currentTool!==f.toolManager||f.animationManager.bn||(a=this.Kg.get(b),null===a||f.animationManager.isTicking||(null===this.sp&&(this.sp=new G),g=0===f.undoManager.transactionLevel,a.startCondition===di?g=!0:a.startCondition===fi&&(g=!1),g?(f=new Ah,ei(a,f),g=this.sp.get(a),null!==g&&g.stop(),this.sp.add(a,
f),f.Yu=this,f.nx=a,f.add(this,b,d,e),f.start()):(Ch(f.animationManager,"Trigger"),f.animationManager.defaultAnimation.add(this,b,d,e)))),this instanceof X&&c===h&&0!==(h.F&16777216)&&null!==h.data))for(c=this.W.j,d=c.length,e=0;e<d;e++)h=c[e],h instanceof X&&Gj(h,function(a){null!==a.data&&0!==(a.F&16777216)&&a.Ba(b)})};
function hl(a,b,c){var d=a.Ui();if(null!==d)for(var e=a.$a.iterator;e.next();){var f=e.value,g=null;if(null!==f.sourceName){g=il(f,d,a);if(null===g)continue;f.Qq(a,g,c,null)}else if(f.isToModel){var h=b.diagram;null===h||h.skipsModelSourceBindings||f.Qq(a,h.model.modelData,c,d)}else{h=d.data;if(null===h)continue;var k=b.diagram;null===k||k.skipsModelSourceBindings||f.Qq(a,h,c,d)}g===a&&(h=d.it(f.gj),null!==h&&f.tw(h,g,c))}}t.it=function(a){return this.Jk===a?this:null};
t.g=function(a,b,c){this.Ya(ue,a,this,b,c)};function jl(a,b,c,d,e){var f=a.nc,g=a.bg;g.reset();kl(a,g,b,c,d,e);a.bg=g;f.h(b,c,d,e);g.ut()||g.qw(f)}function ll(a,b,c,d){if(!1===a.pickable)return!1;d.multiply(a.transform);return c?a.Gc(b,d):a.Gh(b,d)}
t.Lx=function(a,b,c){if(!1===this.pickable)return!1;var d=this.naturalBounds;b=a.Be(b);return c?Bb(a.x,a.y,0,0,0,d.height)<=b||Bb(a.x,a.y,0,d.height,d.width,d.height)<=b||Bb(a.x,a.y,d.width,d.height,d.width,0)<=b||Bb(a.x,a.y,d.width,0,0,0)<=b:a.dd(0,0)<=b&&a.dd(0,d.height)<=b&&a.dd(d.width,0)<=b&&a.dd(d.width,d.height)<=b};t.ae=function(){return!0};
t.aa=function(a){var b=I.alloc();b.assign(a);this.transform.ra(b);var c=this.actualBounds;if(!c.u())return I.free(b),!1;var d=this.diagram;if(null!==d&&d.ke){var e=d.mm("extraTouchThreshold"),f=d.mm("extraTouchArea"),g=f/2,h=this.naturalBounds;d=this.vf()*d.scale;var k=1/d;if(h.width*d<e&&h.height*d<e)return a=fc(c.x-g*k,c.y-g*k,c.width+f*k,c.height+f*k,b.x,b.y),I.free(b),a}e=!1;if(this instanceof Ke||this instanceof Kf?fc(c.x-5,c.y-5,c.width+10,c.height+10,b.x,b.y):c.aa(b))this.md&&!this.md.aa(b)?
e=!1:null!==this.dc&&c.aa(b)?e=!0:null!==this.gb&&this.oc.aa(a)?e=!0:e=this.Hh(a);I.free(b);return e};t.Hh=function(a){var b=this.naturalBounds;return fc(0,0,b.width,b.height,a.x,a.y)};
t.Ae=function(a){if(0===this.angle)return this.actualBounds.Ae(a);var b=this.naturalBounds;b=N.allocAt(0,0,b.width,b.height);var c=this.transform,d=!1,e=I.allocAt(a.x,a.y);b.aa(c.Wd(e))&&(e.h(a.x,a.bottom),b.aa(c.Wd(e))&&(e.h(a.right,a.bottom),b.aa(c.Wd(e))&&(e.h(a.right,a.y),b.aa(c.Wd(e))&&(d=!0))));I.free(e);N.free(b);return d};
t.Gh=function(a,b){if(void 0===b)return a.Ae(this.actualBounds);var c=this.naturalBounds,d=!1,e=I.allocAt(0,0);a.aa(b.ra(e))&&(e.h(0,c.height),a.aa(b.ra(e))&&(e.h(c.width,c.height),a.aa(b.ra(e))&&(e.h(c.width,0),a.aa(b.ra(e))&&(d=!0))));I.free(e);return d};
t.Gc=function(a,b){if(void 0===b&&(b=this.transform,0===this.angle))return a.Gc(this.actualBounds);var c=this.naturalBounds,d=I.allocAt(0,0),e=I.allocAt(0,c.height),f=I.allocAt(c.width,c.height),g=I.allocAt(c.width,0),h=!1;if(a.aa(b.ra(d))||a.aa(b.ra(e))||a.aa(b.ra(f))||a.aa(b.ra(g)))h=!0;else{c=N.allocAt(0,0,c.width,c.height);var k=I.allocAt(a.x,a.y);c.aa(b.Wd(k))?h=!0:(k.h(a.x,a.bottom),c.aa(b.Wd(k))?h=!0:(k.h(a.right,a.bottom),c.aa(b.Wd(k))?h=!0:(k.h(a.right,a.y),c.aa(b.Wd(k))&&(h=!0))));I.free(k);
N.free(c);!h&&(J.rt(a,d,e)||J.rt(a,e,f)||J.rt(a,f,g)||J.rt(a,g,d))&&(h=!0)}I.free(d);I.free(e);I.free(f);I.free(g);return h};t.ga=function(a,b){void 0===b&&(b=new I);if(a instanceof P){var c=this.naturalBounds;b.h(a.x*c.width+a.offsetX,a.y*c.height+a.offsetY)}else b.set(a);this.vd.ra(b);return b};
t.lm=function(a){void 0===a&&(a=new N);var b=this.naturalBounds,c=this.vd,d=I.allocAt(0,0).transform(c);a.h(d.x,d.y,0,0);d.h(b.width,0).transform(c);ec(a,d.x,d.y,0,0);d.h(b.width,b.height).transform(c);ec(a,d.x,d.y,0,0);d.h(0,b.height).transform(c);ec(a,d.x,d.y,0,0);I.free(d);return a};t.Xi=function(){var a=this.vd;1===a.m11&&0===a.m12?a=0:(a=180*Math.atan2(a.m12,a.m11)/Math.PI,0>a&&(a+=360));return a};
t.vf=function(){if(0!==(this.F&4096)===!1)return this.Wk;var a=this.ya;return null!==this.panel?a*this.panel.vf():a};t.ot=function(a,b){void 0===b&&(b=new I);b.assign(a);this.vd.Wd(b);return b};t.Uc=function(a,b,c){return this.hk(a.x,a.y,b.x,b.y,c)};
t.hk=function(a,b,c,d,e){var f=this.transform,g=1/(f.m11*f.m22-f.m12*f.m21),h=f.m22*g,k=-f.m12*g,l=-f.m21*g,m=f.m11*g,n=g*(f.m21*f.dy-f.m22*f.dx),p=g*(f.m12*f.dx-f.m11*f.dy);if(null!==this.areaBackground)return f=this.actualBounds,J.Uc(f.left,f.top,f.right,f.bottom,a,b,c,d,e);g=a*h+b*l+n;a=a*k+b*m+p;b=c*h+d*l+n;c=c*k+d*m+p;e.h(0,0);d=this.naturalBounds;c=J.Uc(0,0,d.width,d.height,g,a,b,c,e);e.transform(f);return c};
Y.prototype.measure=function(a,b,c,d){if(!1!==tj(this)){var e=this.fh,f=e.right+e.left;e=e.top+e.bottom;a=Math.max(a-f,0);b=Math.max(b-e,0);c=Math.max((c||0)-f,0);d=Math.max((d||0)-e,0);f=this.angle;e=this.desiredSize;var g=0;this instanceof Kf&&(g=this.strokeWidth);90===f||270===f?(a=isFinite(e.height)?e.height+g:a,b=isFinite(e.width)?e.width+g:b):(a=isFinite(e.width)?e.width+g:a,b=isFinite(e.height)?e.height+g:b);e=c||0;g=d||0;var h=this instanceof X;switch(ml(this,!0)){case xg:g=e=0;h&&(b=a=Infinity);
break;case ud:isFinite(a)&&a>c&&(e=a);isFinite(b)&&b>d&&(g=b);break;case Yk:isFinite(a)&&a>c&&(e=a);g=0;h&&(b=Infinity);break;case Zk:isFinite(b)&&b>d&&(g=b),e=0,h&&(a=Infinity)}h=this.maxSize;var k=this.minSize;e>h.width&&k.width<h.width&&(e=h.width);g>h.height&&k.height<h.height&&(g=h.height);c=Math.max(e/this.scale,k.width);d=Math.max(g/this.scale,k.height);h.width<c&&(c=Math.min(k.width,c));h.height<d&&(d=Math.min(k.height,d));a=Math.min(h.width,a);b=Math.min(h.height,b);a=Math.max(c,a);b=Math.max(d,
b);if(90===f||270===f)f=a,a=b,b=f,f=c,c=d,d=f;this.nc.ea();this.sm(a,b,c,d);this.nc.freeze();this.nc.u()||B("Non-real measuredBounds has been set. Object "+this+", measuredBounds: "+this.nc.toString());oj(this,!1)}};Y.prototype.sm=function(){};Y.prototype.yf=function(){return!1};
Y.prototype.arrange=function(a,b,c,d,e){this.ml();var f=N.alloc();f.assign(this.ub);this.ub.ea();!1===uj(this)?this.ub.h(a,b,c,d):this.Fh(a,b,c,d);this.ub.freeze();void 0===e?this.md=null:this.md=e;c=!1;if(void 0!==e)c=!0;else if(e=this.panel,null===e||e.type!==X.TableRow&&e.type!==X.TableColumn||(e=e.panel),null!==e&&(e=e.oc,d=this.measuredBounds,null!==this.areaBackground&&(d=this.ub),c=b+d.height,d=a+d.width,c=!(0<=a+.05&&d<=e.width+.05&&0<=b+.05&&c<=e.height+.05),this instanceof Ug&&(a=this.naturalBounds,
this.$r>a.height||this.pb>a.width)))c=!0;this.F=c?this.F|256:this.F&-257;this.ub.u()||B("Non-real actualBounds has been set. Object "+this+", actualBounds: "+this.ub.toString());this.Et(f,this.ub);nl(this,!1);N.free(f)};t=Y.prototype;t.Fh=function(){};
function ol(a,b,c,d,e){a.ub.h(b,c,d,e);if(!a.desiredSize.u()){var f=a.nc;c=a.fh;b=c.right+c.left;var g=c.top+c.bottom;c=f.width+b;f=f.height+g;d+=b;e+=g;b=ml(a,!0);c===d&&f===e&&(b=xg);switch(b){case xg:if(c>d||f>e)oj(a,!0),a.measure(c>d?d:c,f>e?e:f,0,0);break;case ud:oj(a,!0);a.measure(d,e,0,0);break;case Yk:oj(a,!0);a.measure(d,f,0,0);break;case Zk:oj(a,!0),a.measure(c,e,0,0)}}}
t.Et=function(a,b){var c=this.part;null!==c&&null!==c.diagram&&(c.selectionObject!==this&&c.resizeObject!==this&&c.rotateObject!==this||pl(c,!0),this.M(),$b(a,b)||(c.Jh(),this.To(c)))};t.To=function(a){null!==this.portId&&(pl(a,!0),a instanceof W&&ql(a,this))};
t.bc=function(a,b){if(this.visible){var c=this instanceof X&&(this.type===X.TableRow||this.type===X.TableColumn),d=this.ub;if(c||0!==d.width&&0!==d.height&&!isNaN(d.x)&&!isNaN(d.y)){var e=this.opacity;if(0!==e){var f=1;1!==e&&(f=a.globalAlpha,a.globalAlpha=f*e);if(!this.Gx(a,b))if(c)rl(this,a,b);else{this instanceof S&&this.nk(!1);c=this.transform;var g=this.panel;0!==(this.F&4096)===!0&&sl(this);var h=this.part,k=!1,l=0;if(h&&b.Ce("drawShadows")&&(k=h.isShadowed)){var m=h.shadowOffset;l=Math.max(m.y,
m.x)*b.scale*b.Sb}if(!(m=b.ni||!this.yf())){var n=this.naturalBounds;m=this.Qh;var p=m.m11,r=m.m21,q=m.dx,u=m.m12,v=m.m22,w=m.dy,y,z=y=0;m=y*p+z*r+q;var A=y*u+z*v+w;y=n.width+l;z=0;var C=y*p+z*r+q;y=y*u+z*v+w;z=Math.min(m,C);var H=Math.min(A,y);var L=Math.max(m+0,C)-z;var K=Math.max(A+0,y)-H;m=z;A=H;y=n.width+l;z=n.height+l;C=y*p+z*r+q;y=y*u+z*v+w;z=Math.min(m,C);H=Math.min(A,y);L=Math.max(m+L,C)-z;K=Math.max(A+K,y)-H;m=z;A=H;y=0;z=n.height+l;C=y*p+z*r+q;y=y*u+z*v+w;z=Math.min(m,C);H=Math.min(A,y);
L=Math.max(m+L,C)-z;K=Math.max(A+K,y)-H;m=z;A=H;l=b.viewportBounds;n=l.x;p=l.y;m=!(m>l.width+n||n>L+m||A>l.height+p||p>K+A)}if(m){m=0!==(this.F&256);a.clipInsteadOfFill&&(m=!1);this instanceof Ug&&(a.font=this.font);if(m){A=g.ae()?g.naturalBounds:g.actualBounds;null!==this.md?(n=this.md,L=n.x,K=n.y,l=n.width,n=n.height):(L=Math.max(d.x,A.x),K=Math.max(d.y,A.y),l=Math.min(d.right,A.right)-L,n=Math.min(d.bottom,A.bottom)-K);if(L>d.width+d.x||d.x>A.width+A.x){1!==e&&(a.globalAlpha=f);return}a.save();
a.beginPath();a.rect(L,K,l,n);a.clip()}if(this.yf()){if(!h.isVisible()){1!==e&&(a.globalAlpha=f);return}k&&(A=h.shadowOffset,a.jw(A.x*b.scale*b.Sb,A.y*b.scale*b.Sb,h.shadowBlur),tl(a),a.shadowColor=h.shadowColor)}!0===this.shadowVisible?tl(a):!1===this.shadowVisible&&ul(a);h=this.naturalBounds;null!==this.dc&&(ki(this,a,this.dc,!0,!0,h,d),this.dc instanceof vl&&this.dc.type===wl?(a.beginPath(),a.rect(d.x,d.y,d.width,d.height),a.Vd(this.dc)):a.fillRect(d.x,d.y,d.width,d.height));a.transform(c.m11,
c.m12,c.m21,c.m22,c.dx,c.dy);k&&(null!==g&&0!==(g.F&512)||null!==g&&(g.type===X.Auto||g.type===X.Spot)&&g.zb()!==this)&&null===this.shadowVisible&&ul(a);null!==this.gb&&(l=this.naturalBounds,L=A=0,K=l.width,l=l.height,n=0,this instanceof Kf&&(l=this.ka.bounds,A=l.x,L=l.y,K=l.width,l=l.height,n=this.strokeWidth),ki(this,a,this.gb,!0,!1,h,d),this.gb instanceof vl&&this.gb.type===wl?(a.beginPath(),a.rect(A-n/2,L-n/2,K+n,l+n),a.Vd(this.gb)):a.fillRect(A-n/2,L-n/2,K+n,l+n));k&&(null!==this.gb||null!==
this.dc||null!==g&&0!==(g.F&512)||null!==g&&(g.type===X.Auto||g.type===X.Spot)&&g.zb()!==this)?(xl(this,!0),null===this.shadowVisible&&ul(a)):xl(this,!1);this.Qi(a,b);k&&0!==(this.F&512)===!0&&tl(a);this.yf()&&k&&ul(a);m?(a.restore(),this instanceof X?a.sc(!0):a.sc(!1)):c.ut()||(b=1/(c.m11*c.m22-c.m12*c.m21),a.transform(c.m22*b,-c.m12*b,-c.m21*b,c.m11*b,b*(c.m21*c.dy-c.m22*c.dx),b*(c.m12*c.dx-c.m11*c.dy)))}}1!==e&&(a.globalAlpha=f)}}}};t.Gx=function(){return!1};
function rl(a,b,c){var d=a.ub,e=a.oc;null!==a.dc&&(ki(a,b,a.dc,!0,!0,e,d),a.dc instanceof vl&&a.dc.type===wl?(b.beginPath(),b.rect(d.x,d.y,d.width,d.height),b.Vd(a.dc)):b.fillRect(d.x,d.y,d.width,d.height));null!==a.gb&&(ki(a,b,a.gb,!0,!1,e,d),a.gb instanceof vl&&a.gb.type===wl?(b.beginPath(),b.rect(d.x,d.y,d.width,d.height),b.Vd(a.gb)):b.fillRect(d.x,d.y,d.width,d.height));a.Qi(b,c)}t.Qi=function(){};
function ki(a,b,c,d,e,f,g){if(null!==c){var h=1,k=1;if("string"===typeof c)d?b.fillStyle=c:b.strokeStyle=c;else if(c.type===yl)d?b.fillStyle=c.color:b.strokeStyle=c.color;else{h=f.width;k=f.height;e&&(h=g.width,k=g.height);if((f=b instanceof zl)&&c.de&&(c.type===Al||c.Mk===h&&c.bu===k))var l=c.de;else{var m=0,n=0,p=0,r=0,q=0,u=0;u=q=0;e&&(q=g.x,u=g.y);m=c.start.x*h+c.start.offsetX;n=c.start.y*k+c.start.offsetY;p=c.end.x*h+c.end.offsetX;r=c.end.y*k+c.end.offsetY;m+=q;p+=q;n+=u;r+=u;if(c.type===Bl)l=
b.createLinearGradient(m,n,p,r);else if(c.type===wl)u=isNaN(c.endRadius)?Math.max(h,k)/2:c.endRadius,isNaN(c.startRadius)?(q=0,u=Math.max(h,k)/2):q=c.startRadius,l=b.createRadialGradient(m,n,q,p,r,u);else if(c.type===Al)try{l=b.createPattern(c.pattern,"repeat")}catch(w){l=null}if(c.type!==Al&&(e=c.colorStops,null!==e))for(e=e.iterator;e.next();)l.addColorStop(e.key,e.value);if(f&&(c.de=l,null!==l&&(c.Mk=h,c.bu=k),null===l&&c.type===Al&&-1!==c.Mk)){c.Mk=-1;var v=a.diagram;null!==v&&-1===c.Mk&&sa(function(){v.Fe()},
600)}}d?b.fillStyle=l:b.strokeStyle=l}}}t.Dg=function(a){if(a instanceof X)a:{if(this!==a&&null!==a)for(var b=this.panel;null!==b;){if(b===a){a=!0;break a}b=b.panel}a=!1}else a=!1;return a};t.zf=function(){if(!this.visible)return!1;var a=this.panel;return null!==a?a.zf():!0};t.Eg=function(){for(var a=this instanceof X?this:this.panel;null!==a&&a.isEnabled;)a=a.panel;return null===a};
function sl(a){if(0!==(a.F&2048)===!0){var b=a.kb;b.reset();if(!a.ub.u()||!a.nc.u()){Cl(a,!1);return}b.translate(a.ub.x-a.nc.x,a.ub.y-a.nc.y);if(1!==a.scale||0!==a.angle){var c=a.naturalBounds;kl(a,b,c.x,c.y,c.width,c.height)}Cl(a,!1);Dl(a,!0)}0!==(a.F&4096)===!0&&(b=a.panel,null===b?(a.Qh.set(a.kb),a.Wk=a.scale,Dl(a,!1)):null!==b.vd&&(c=a.Qh,c.reset(),b.ae()?c.multiply(b.Qh):null!==b.panel&&c.multiply(b.panel.Qh),c.multiply(a.kb),a.Wk=a.scale*b.Wk,Dl(a,!1)))}
function kl(a,b,c,d,e,f){1!==a.scale&&b.scale(a.scale);if(0!==a.Yb){var g=Ac;a.yf()&&a.locationSpot.eb()&&(g=a.locationSpot);var h=I.alloc();if(a instanceof U&&a.locationObject!==a)for(c=a.locationObject,d=c.naturalBounds,h.xk(d.x,d.y,d.width,d.height,g),c.bg.ra(h),h.offset(-c.measuredBounds.x,-c.measuredBounds.y),g=c.panel;null!==g&&g!==a;)g.bg.ra(h),h.offset(-g.measuredBounds.x,-g.measuredBounds.y),g=g.panel;else h.xk(c,d,e,f,g);b.rotate(a.Yb,h.x,h.y);I.free(h)}}
t.o=function(a){void 0===a&&(a=!1);if(!0!==tj(this)){oj(this,!0);nl(this,!0);var b=this.panel;null===b||a||b.o()}};t.om=function(){!0!==tj(this)&&(oj(this,!0),nl(this,!0))};function El(a){if(!1===uj(a)){var b=a.panel;null!==b?b.o():a.yf()&&(b=a.diagram,null!==b&&(b.od.add(a),a instanceof W&&a.fd(),b.Pb()));nl(a,!0)}}t.ml=function(){0!==(this.F&2048)===!1&&(Cl(this,!0),Dl(this,!0))};t.Gv=function(){Dl(this,!0)};t.M=function(){var a=this.part;null!==a&&a.M()};
function ml(a,b){var c=a.stretch,d=a.panel;if(null!==d&&d.type===X.Table)return Fl(a,d.getRowDefinition(a.row),d.getColumnDefinition(a.column),b);if(null!==d&&d.type===X.Auto&&d.zb()===a)return Gl(a,ud,b);if(c===Xk){if(null!==d){if(d.type===X.Spot&&d.zb()===a)return Gl(a,ud,b);c=d.defaultStretch;return c===Xk?Gl(a,xg,b):Gl(a,c,b)}return Gl(a,xg,b)}return Gl(a,c,b)}
function Fl(a,b,c,d){var e=a.stretch;if(e!==Xk)return Gl(a,e,d);var f=e=null;switch(b.stretch){case Zk:f=!0;break;case ud:f=!0}switch(c.stretch){case Yk:e=!0;break;case ud:e=!0}b=a.panel.defaultStretch;null===e&&(e=b===Yk||b===ud);null===f&&(f=b===Zk||b===ud);return!0===e&&!0===f?Gl(a,ud,d):!0===e?Gl(a,Yk,d):!0===f?Gl(a,Zk,d):Gl(a,xg,d)}
function Gl(a,b,c){if(c)return b;if(b===xg)return xg;c=a.desiredSize;if(c.u())return xg;a=a.angle;if(!isNaN(c.width))if(90!==a&&270!==a){if(b===Yk)return xg;if(b===ud)return Zk}else{if(b===Zk)return xg;if(b===ud)return Yk}if(!isNaN(c.height))if(90!==a&&270!==a){if(b===Zk)return xg;if(b===ud)return Yk}else{if(b===Yk)return xg;if(b===ud)return Zk}return b}function xl(a,b){a.F=b?a.F|512:a.F&-513}function gl(a){return 0!==(a.F&1024)}function Hl(a,b){a.F=b?a.F|1024:a.F&-1025}
function Cl(a,b){a.F=b?a.F|2048:a.F&-2049}function Dl(a,b){a.F=b?a.F|4096:a.F&-4097}function tj(a){return 0!==(a.F&8192)}function oj(a,b){a.F=b?a.F|8192:a.F&-8193}function uj(a){return 0!==(a.F&16384)}function nl(a,b){a.F=b?a.F|16384:a.F&-16385}t.cj=function(a){this.ng=a};t.Ot=function(){};t.hw=function(a){this.ma.assign(a);El(this);return!0};t.Kq=function(a,b){if(this.ma.x!==a||this.ma.y!==b)this.ma.h(a,b),this.ml()};
function Il(a){var b=a.part;if(b instanceof W&&(null!==a.portId||a===b.port)){var c=b.diagram;null===c||c.undoManager.isUndoingRedoing||ql(b,a)}}function Jl(a){var b=a.diagram;null===b||b.undoManager.isUndoingRedoing||(a instanceof X?a instanceof W?a.fd():a.Km(a,function(a){Il(a)}):Il(a))}t.bind=function(a){a.bd=this;var b=this.Ui();null!==b&&Kl(b)&&B("Cannot add a Binding to a template that has already been copied: "+a);null===this.$a&&(this.$a=new E);this.$a.add(a)};
t.Ui=function(){for(var a=this instanceof X?this:this.panel;null!==a;){if(null!==a.ci)return a;a=a.panel}return null};t.iw=function(a){Aj(this,a)};function Ll(a,b){b.bd=a;null===a.Kg&&(a.Kg=new G);a.Kg.add(b.propertyName,b)}
function Ml(a,b){for(var c=1;c<arguments.length;++c);c=arguments;var d=null,e=null;if("function"===typeof a)e=a;else if("string"===typeof a){var f=Nl.H(a);"function"===typeof f?(c=Ba(arguments),d=f(c),za(d)||B('GraphObject.make invoked object builder "'+a+'", but it did not return an Object')):e=x.go[a]}null===d&&(void 0!==e&&null!==e&&e.constructor||B("GraphObject.make requires a class function or GoJS class name or name of an object builder, not: "+a),d=new e);e=1;if(d instanceof R&&1<c.length){f=
d;var g=c[1];if("string"===typeof g||g instanceof HTMLDivElement)Hi(f,g),e++}for(;e<c.length;e++)f=c[e],void 0===f?B("Undefined value at argument "+e+" for object being constructed by GraphObject.make: "+d):Ol(d,f);return d}
function Ol(a,b){if("string"===typeof b)if(a instanceof Ug)a.text=b;else if(a instanceof Kf)a.figure=b;else if(a instanceof mk)a.source=b;else if(a instanceof X)b=Pl.H(b),null!==b&&(a.type=b);else if(a instanceof vl){var c=Za(vl,b);null!==c?a.type=c:B("Unknown Brush type as an argument to GraphObject.make: "+b)}else a instanceof sd?(b=Za(sd,b),null!==b&&(a.type=b)):a instanceof oe&&(b=Za(oe,b),null!==b&&(a.type=b));else if(b instanceof Y)a instanceof X||B("A GraphObject can only be added to a Panel, not to: "+
a),a.add(b);else if(b instanceof Uj){var d;b.isRow&&"function"===typeof a.getRowDefinition?d=a.getRowDefinition(b.index):b.isRow||"function"!==typeof a.getColumnDefinition||(d=a.getColumnDefinition(b.index));d instanceof Uj?d.et(b):B("A RowColumnDefinition can only be added to an object that implements getRowDefinition/getColumnDefinition, not to: "+a)}else if(b instanceof D)"function"===typeof a.cb&&a.cb(b);else if(b instanceof Ql)a.type=b;else if(b instanceof Mi)a instanceof Y?a.bind(b):a instanceof
Uj?a.bind(b):B("A Binding can only be applied to a GraphObject or RowColumnDefinition, not to: "+a);else if(b instanceof bi)a instanceof Y?Ll(a,b):B("An AnimationTrigger can only be applied to a GraphObject, not to: "+a);else if(b instanceof ne)a instanceof sd?a.figures.add(b):B("A PathFigure can only be added to a Geometry, not to: "+a);else if(b instanceof oe)a instanceof ne?a.segments.add(b):B("A PathSegment can only be added to a PathFigure, not to: "+a);else if(b instanceof Fi)a instanceof R?
a.layout=b:a instanceof T?a.layout=b:B("A Layout can only be assigned to a Diagram or a Group, not to: "+a);else if(Array.isArray(b))for(c=0;c<b.length;c++)Ol(a,b[c]);else if("object"===typeof b&&null!==b)if(a instanceof vl){c=new db;for(var e in b)d=parseFloat(e),isNaN(d)?c[e]=b[e]:a.addColorStop(d,b[e]);Aj(a,c)}else if(a instanceof Uj){void 0!==b.row?(e=b.row,(void 0===e||null===e||Infinity===e||isNaN(e)||0>e)&&B("Must specify non-negative integer row for RowColumnDefinition "+b+", not: "+e),a.isRow=
!0,a.index=e):void 0!==b.column&&(e=b.column,(void 0===e||null===e||Infinity===e||isNaN(e)||0>e)&&B("Must specify non-negative integer column for RowColumnDefinition "+b+", not: "+e),a.isRow=!1,a.index=e);e=new db;for(c in b)"row"!==c&&"column"!==c&&(e[c]=b[c]);Aj(a,e)}else Aj(a,b);else B('Unknown initializer "'+b+'" for object being constructed by GraphObject.make: '+a)}function Rl(a,b){Nl.add(a,b)}
function Sl(a,b,c){void 0===c&&(c=null);var d=a[1];if("function"===typeof c?c(d):"string"===typeof d)return a.splice(1,1),d;if(void 0===b)throw Error("no "+("function"===typeof c?"satisfactory":"string")+" argument for GraphObject builder "+a[0]);return b}
ma.Object.defineProperties(Y.prototype,{shadowVisible:{get:function(){return this.Ll},set:function(a){var b=this.Ll;b!==a&&(this.Ll=a,this.M(),this.g("shadowVisible",b,a))}},enabledChanged:{get:function(){return null!==this.N?this.N.En:null},set:function(a){dl(this);var b=this.N.En;b!==a&&(this.N.En=a,this.g("enabledChanged",b,a))}},segmentOrientation:{get:function(){return this.Jl},set:function(a){var b=this.Jl;
b!==a&&(this.Jl=a,this.o(),this.g("segmentOrientation",b,a),a===ag&&(this.angle=0))}},segmentIndex:{get:function(){return this.xp},set:function(a){a=Math.round(a);var b=this.xp;b!==a&&(this.xp=a,this.o(),this.g("segmentIndex",b,a))}},segmentFraction:{get:function(){return this.Hl},set:function(a){isNaN(a)?a=0:0>a?a=0:1<a&&(a=1);var b=this.Hl;b!==a&&(this.Hl=a,this.o(),this.g("segmentFraction",b,a))}},segmentOffset:{
get:function(){return this.Il},set:function(a){var b=this.Il;b.w(a)||(this.Il=a=a.G(),this.o(),this.g("segmentOffset",b,a))}},stretch:{get:function(){return this.we},set:function(a){var b=this.we;b!==a&&(this.we=a,this.o(),this.g("stretch",b,a))}},name:{get:function(){return this.Qa},set:function(a){var b=this.Qa;b!==a&&(this.Qa=a,null!==this.part&&(this.part.Fj=null),this.g("name",b,a))}},opacity:{get:function(){return this.qb},
set:function(a){var b=this.qb;b!==a&&((0>a||1<a)&&va(a,"0 <= value <= 1",Y,"opacity"),this.qb=a,this.g("opacity",b,a),a=this.diagram,b=this.part,null!==a&&null!==b&&a.M(Ej(b,b.actualBounds)))}},visible:{get:function(){return 0!==(this.F&1)},set:function(a){var b=0!==(this.F&1);b!==a&&(this.F^=1,this.g("visible",b,a),b=this.panel,null!==b?b.o():this.yf()&&this.Ob(a),this.M(),Jl(this))}},pickable:{get:function(){return 0!==(this.F&2)},set:function(a){var b=
0!==(this.F&2);b!==a&&(this.F^=2,this.g("pickable",b,a))}},fromLinkableDuplicates:{get:function(){return 0!==(this.F&4)},set:function(a){var b=0!==(this.F&4);b!==a&&(this.F^=4,this.g("fromLinkableDuplicates",b,a))}},fromLinkableSelfNode:{get:function(){return 0!==(this.F&8)},set:function(a){var b=0!==(this.F&8);b!==a&&(this.F^=8,this.g("fromLinkableSelfNode",b,a))}},toLinkableDuplicates:{get:function(){return 0!==
(this.F&16)},set:function(a){var b=0!==(this.F&16);b!==a&&(this.F^=16,this.g("toLinkableDuplicates",b,a))}},toLinkableSelfNode:{get:function(){return 0!==(this.F&32)},set:function(a){var b=0!==(this.F&32);b!==a&&(this.F^=32,this.g("toLinkableSelfNode",b,a))}},isPanelMain:{get:function(){return 0!==(this.F&64)},set:function(a){var b=0!==(this.F&64);b!==a&&(this.F^=64,this.o(),this.g("isPanelMain",b,a))}},isActionable:{
get:function(){return 0!==(this.F&128)},set:function(a){var b=0!==(this.F&128);b!==a&&(this.F^=128,this.g("isActionable",b,a))}},areaBackground:{get:function(){return this.dc},set:function(a){var b=this.dc;b!==a&&(null!==a&&Tl(a,"GraphObject.areaBackground"),a instanceof vl&&a.freeze(),this.dc=a,this.M(),this.g("areaBackground",b,a))}},background:{get:function(){return this.gb},set:function(a){var b=this.gb;b!==a&&(null!==a&&Tl(a,"GraphObject.background"),
a instanceof vl&&a.freeze(),this.gb=a,this.M(),this.g("background",b,a))}},part:{get:function(){if(this.yf())return this;if(null!==this.Jj)return this.Jj;var a;for(a=this.panel;a;){if(a instanceof U)return this.Jj=a;a=a.panel}return null}},svg:{get:function(){return this.Pp},set:function(a){this.Pp=a}},panel:{get:function(){return this.ng}},layer:{get:function(){var a=this.part;
return null!==a?a.layer:null}},diagram:{get:function(){var a=this.part;return null!==a?a.diagram:null}},position:{get:function(){return this.ma},set:function(a){var b=a.x,c=a.y,d=this.ma,e=d.x,f=d.y;(e===b||isNaN(e)&&isNaN(b))&&(f===c||isNaN(f)&&isNaN(c))?this.Ot():(a=a.copy(),this.hw(a,d)&&this.g("position",d.copy(),a))}},actualBounds:{get:function(){return this.ub}},scale:{get:function(){return this.ya},
set:function(a){var b=this.ya;b!==a&&(0>=a&&B("GraphObject.scale for "+this+" must be greater than zero, not: "+a),this.ya=a,this.o(),this.g("scale",b,a))}},angle:{get:function(){return this.Yb},set:function(a){var b=this.Yb;b!==a&&(a%=360,0>a&&(a+=360),b!==a&&(this.Yb=a,Jl(this),this.o(),this.g("angle",b,a)))}},desiredSize:{get:function(){return this.Lc},set:function(a){var b=a.width,c=a.height,d=this.Lc,e=d.width,f=d.height;(e===b||isNaN(e)&&
isNaN(b))&&(f===c||isNaN(f)&&isNaN(c))||(this.Lc=a=a.G(),this.o(),this instanceof Kf&&this.cc(),this.g("desiredSize",d,a),gl(this)&&(a=this.part,null!==a&&(hl(this,a,"width"),hl(this,a,"height"))))}},width:{get:function(){return this.Lc.width},set:function(a){var b=this.Lc.width;b===a||isNaN(b)&&isNaN(a)||(b=this.Lc,this.Lc=a=(new M(a,this.Lc.height)).freeze(),this.o(),this instanceof Kf&&this.cc(),this.g("desiredSize",b,a),gl(this)&&(a=this.part,null!==a&&hl(this,a,
"width")))}},height:{get:function(){return this.Lc.height},set:function(a){var b=this.Lc.height;b===a||isNaN(b)&&isNaN(a)||(b=this.Lc,this.Lc=a=(new M(this.Lc.width,a)).freeze(),this.o(),this instanceof Kf&&this.cc(),this.g("desiredSize",b,a),gl(this)&&(a=this.part,null!==a&&hl(this,a,"height")))}},minSize:{get:function(){return this.eg},set:function(a){var b=this.eg;b.w(a)||(a=a.copy(),isNaN(a.width)&&(a.width=0),isNaN(a.height)&&(a.height=
0),a.freeze(),this.eg=a,this.o(),this.g("minSize",b,a))}},maxSize:{get:function(){return this.dg},set:function(a){var b=this.dg;b.w(a)||(a=a.copy(),isNaN(a.width)&&(a.width=Infinity),isNaN(a.height)&&(a.height=Infinity),a.freeze(),this.dg=a,this.o(),this.g("maxSize",b,a))}},measuredBounds:{get:function(){return this.nc}},naturalBounds:{get:function(){return this.oc}},margin:{get:function(){return this.fh},
set:function(a){"number"===typeof a&&(a=new oc(a));var b=this.fh;b.w(a)||(this.fh=a=a.G(),this.o(),this.g("margin",b,a))}},transform:{get:function(){0!==(this.F&2048)===!0&&sl(this);return this.kb}},vd:{get:function(){0!==(this.F&4096)===!0&&sl(this);return this.Qh}},alignment:{get:function(){return this.vb},set:function(a){var b=this.vb;b.w(a)||(a.jc()&&!a.Mb()&&B("GraphObject.alignment for "+this+" must be a real Spot or Spot.Default, not: "+
a),this.vb=a=a.G(),El(this),this.g("alignment",b,a))}},column:{get:function(){return this.Og},set:function(a){a=Math.round(a);var b=this.Og;b!==a&&(0>a&&va(a,">= 0",Y,"column"),this.Og=a,this.o(),this.g("column",b,a))}},columnSpan:{get:function(){return this.gn},set:function(a){a=Math.round(a);var b=this.gn;b!==a&&(1>a&&va(a,">= 1",Y,"columnSpan"),this.gn=a,this.o(),this.g("columnSpan",b,a))}},row:{get:function(){return this.pp},
set:function(a){a=Math.round(a);var b=this.pp;b!==a&&(0>a&&va(a,">= 0",Y,"row"),this.pp=a,this.o(),this.g("row",b,a))}},rowSpan:{get:function(){return this.qp},set:function(a){a=Math.round(a);var b=this.qp;b!==a&&(1>a&&va(a,">= 1",Y,"rowSpan"),this.qp=a,this.o(),this.g("rowSpan",b,a))}},spanAllocation:{get:function(){return this.Kp},set:function(a){var b=this.Kp;b!==a&&(this.Kp=a,this.o(),this.g("spanAllocation",b,a))}},alignmentFocus:{
get:function(){return this.Fk},set:function(a){var b=this.Fk;b.w(a)||(this.Fk=a=a.G(),this.o(),this.g("alignmentFocus",b,a))}},portId:{get:function(){return this.cp},set:function(a){var b=this.cp;if(b!==a){var c=this.part;null===c||c instanceof W||(B("Cannot set portID on a Link: "+a),c=null);null!==b&&null!==c&&Ul(c,this);this.cp=a;null!==a&&null!==c&&(c.Ih=!0,Vl(c,this));this.g("portId",b,a)}}},toSpot:{get:function(){return null!==
this.O?this.O.yh:uc},set:function(a){this.Ec();var b=this.O.yh;b.w(a)||(a=a.G(),this.O.yh=a,this.g("toSpot",b,a),Il(this))}},toEndSegmentLength:{get:function(){return null!==this.O?this.O.wh:10},set:function(a){this.Ec();var b=this.O.wh;b!==a&&(0>a&&va(a,">= 0",Y,"toEndSegmentLength"),this.O.wh=a,this.g("toEndSegmentLength",b,a),Il(this))}},toShortLength:{get:function(){return null!==this.O?this.O.xh:0},set:function(a){this.Ec();var b=this.O.xh;
b!==a&&(this.O.xh=a,this.g("toShortLength",b,a),Il(this))}},toLinkable:{get:function(){return null!==this.O?this.O.Tp:null},set:function(a){this.Ec();var b=this.O.Tp;b!==a&&(this.O.Tp=a,this.g("toLinkable",b,a))}},toMaxLinks:{get:function(){return null!==this.O?this.O.Up:Infinity},set:function(a){this.Ec();var b=this.O.Up;b!==a&&(0>a&&va(a,">= 0",Y,"toMaxLinks"),this.O.Up=a,this.g("toMaxLinks",b,a))}},fromSpot:{
get:function(){return null!==this.O?this.O.Yg:uc},set:function(a){this.Ec();var b=this.O.Yg;b.w(a)||(a=a.G(),this.O.Yg=a,this.g("fromSpot",b,a),Il(this))}},fromEndSegmentLength:{get:function(){return null!==this.O?this.O.Wg:10},set:function(a){this.Ec();var b=this.O.Wg;b!==a&&(0>a&&va(a,">= 0",Y,"fromEndSegmentLength"),this.O.Wg=a,this.g("fromEndSegmentLength",b,a),Il(this))}},fromShortLength:{get:function(){return null!==this.O?this.O.Xg:
0},set:function(a){this.Ec();var b=this.O.Xg;b!==a&&(this.O.Xg=a,this.g("fromShortLength",b,a),Il(this))}},fromLinkable:{get:function(){return null!==this.O?this.O.Kn:null},set:function(a){this.Ec();var b=this.O.Kn;b!==a&&(this.O.Kn=a,this.g("fromLinkable",b,a))}},fromMaxLinks:{get:function(){return null!==this.O?this.O.Ln:Infinity},set:function(a){this.Ec();var b=this.O.Ln;b!==a&&(0>a&&va(a,">= 0",Y,"fromMaxLinks"),this.O.Ln=a,this.g("fromMaxLinks",
b,a))}},cursor:{get:function(){return this.fi},set:function(a){var b=this.fi;b!==a&&(this.fi=a,this.g("cursor",b,a))}},click:{get:function(){return null!==this.N?this.N.Nf:null},set:function(a){dl(this);var b=this.N.Nf;b!==a&&(this.N.Nf=a,this.g("click",b,a))}},doubleClick:{get:function(){return null!==this.N?this.N.Sf:null},set:function(a){dl(this);var b=this.N.Sf;b!==a&&(this.N.Sf=a,this.g("doubleClick",b,
a))}},contextClick:{get:function(){return null!==this.N?this.N.Of:null},set:function(a){dl(this);var b=this.N.Of;b!==a&&(this.N.Of=a,this.g("contextClick",b,a))}},mouseEnter:{get:function(){return null!==this.N?this.N.gg:null},set:function(a){dl(this);var b=this.N.gg;b!==a&&(this.N.gg=a,this.g("mouseEnter",b,a))}},mouseLeave:{get:function(){return null!==this.N?this.N.jg:null},set:function(a){dl(this);var b=
this.N.jg;b!==a&&(this.N.jg=a,this.g("mouseLeave",b,a))}},mouseOver:{get:function(){return null!==this.N?this.N.kg:null},set:function(a){dl(this);var b=this.N.kg;b!==a&&(this.N.kg=a,this.g("mouseOver",b,a))}},mouseHover:{get:function(){return null!==this.N?this.N.ig:null},set:function(a){dl(this);var b=this.N.ig;b!==a&&(this.N.ig=a,this.g("mouseHover",b,a))}},mouseHold:{get:function(){return null!==this.N?this.N.hg:
null},set:function(a){dl(this);var b=this.N.hg;b!==a&&(this.N.hg=a,this.g("mouseHold",b,a))}},mouseDragEnter:{get:function(){return null!==this.N?this.N.Fo:null},set:function(a){dl(this);var b=this.N.Fo;b!==a&&(this.N.Fo=a,this.g("mouseDragEnter",b,a))}},mouseDragLeave:{get:function(){return null!==this.N?this.N.Go:null},set:function(a){dl(this);var b=this.N.Go;b!==a&&(this.N.Go=a,this.g("mouseDragLeave",b,a))}},mouseDrop:{
get:function(){return null!==this.N?this.N.fg:null},set:function(a){dl(this);var b=this.N.fg;b!==a&&(this.N.fg=a,this.g("mouseDrop",b,a))}},actionDown:{get:function(){return null!==this.N?this.N.Pm:null},set:function(a){dl(this);var b=this.N.Pm;b!==a&&(this.N.Pm=a,this.g("actionDown",b,a))}},actionMove:{get:function(){return null!==this.N?this.N.Qm:null},set:function(a){dl(this);var b=this.N.Qm;b!==a&&(this.N.Qm=a,this.g("actionMove",
b,a))}},actionUp:{get:function(){return null!==this.N?this.N.Rm:null},set:function(a){dl(this);var b=this.N.Rm;b!==a&&(this.N.Rm=a,this.g("actionUp",b,a))}},actionCancel:{get:function(){return null!==this.N?this.N.Om:null},set:function(a){dl(this);var b=this.N.Om;b!==a&&(this.N.Om=a,this.g("actionCancel",b,a))}},toolTip:{get:function(){return null!==this.N?this.N.ug:null},set:function(a){dl(this);var b=this.N.ug;
b!==a&&(this.N.ug=a,this.g("toolTip",b,a))}},contextMenu:{get:function(){return null!==this.N?this.N.Pf:null},set:function(a){dl(this);var b=this.N.Pf;b!==a&&(this.N.Pf=a,this.g("contextMenu",b,a))}}});Y.prototype.setProperties=Y.prototype.iw;Y.prototype.findTemplateBinder=Y.prototype.Ui;Y.prototype.bind=Y.prototype.bind;Y.prototype.isEnabledObject=Y.prototype.Eg;Y.prototype.isVisibleObject=Y.prototype.zf;Y.prototype.isContainedBy=Y.prototype.Dg;
Y.prototype.getNearestIntersectionPoint=Y.prototype.Uc;Y.prototype.getLocalPoint=Y.prototype.ot;Y.prototype.getDocumentScale=Y.prototype.vf;Y.prototype.getDocumentAngle=Y.prototype.Xi;Y.prototype.getDocumentBounds=Y.prototype.lm;Y.prototype.getDocumentPoint=Y.prototype.ga;Y.prototype.intersectsRect=Y.prototype.Gc;Y.prototype.containedInRect=Y.prototype.Gh;Y.prototype.containsRect=Y.prototype.Ae;Y.prototype.containsPoint=Y.prototype.aa;Y.prototype.raiseChanged=Y.prototype.g;
Y.prototype.raiseChangedEvent=Y.prototype.Ya;Y.prototype.addCopyProperty=Y.prototype.sx;var Nl=null;Y.className="GraphObject";Nl=new G;
Rl("Button",function(){function a(a,b){return null!==a.diagram.Ub(a.documentPoint,function(a){for(;null!==a.panel&&!a.isActionable;)a=a.panel;return a},function(a){return a===b})}var b=Ml(X,X.Auto,{isActionable:!0,enabledChanged:function(a,b){if(a instanceof X){var c=a.Xa("ButtonBorder");null!==c&&(c.fill=b?a._buttonFillNormal:a._buttonFillDisabled)}},cursor:"pointer",_buttonFillNormal:"#F5F5F5",_buttonStrokeNormal:"#BDBDBD",_buttonFillOver:"#E0E0E0",_buttonStrokeOver:"#9E9E9E",_buttonFillPressed:"#BDBDBD",
_buttonStrokePressed:"#9E9E9E",_buttonFillDisabled:"#E5E5E5"},Ml(Kf,{name:"ButtonBorder",figure:"RoundedRectangle",spot1:new P(0,0,2.76142374915397,2.761423749153969),spot2:new P(1,1,-2.76142374915397,-2.761423749153969),parameter1:2,parameter2:2,fill:"#F5F5F5",stroke:"#BDBDBD"}));b.mouseEnter=function(a,b){if(b.Eg()&&b instanceof X&&(a=b.Xa("ButtonBorder"),a instanceof Kf)){var c=b._buttonFillOver;b._buttonFillNormal=a.fill;a.fill=c;c=b._buttonStrokeOver;b._buttonStrokeNormal=a.stroke;a.stroke=c}};
b.mouseLeave=function(a,b){b.Eg()&&b instanceof X&&(a=b.Xa("ButtonBorder"),a instanceof Kf&&(a.fill=b._buttonFillNormal,a.stroke=b._buttonStrokeNormal))};b.actionDown=function(a,b){if(b.Eg()&&b instanceof X&&null!==b._buttonFillPressed&&0===a.button){var c=b.Xa("ButtonBorder");if(c instanceof Kf){a=a.diagram;var d=a.skipsUndoManager;a.skipsUndoManager=!0;var g=b._buttonFillPressed;b._buttonFillOver=c.fill;c.fill=g;g=b._buttonStrokePressed;b._buttonStrokeOver=c.stroke;c.stroke=g;a.skipsUndoManager=
d}}};b.actionUp=function(b,d){if(d.Eg()&&d instanceof X&&null!==d._buttonFillPressed&&0===b.button){var c=d.Xa("ButtonBorder");if(c instanceof Kf){var f=b.diagram,g=f.skipsUndoManager;f.skipsUndoManager=!0;a(b,d)?(c.fill=d._buttonFillOver,c.stroke=d._buttonStrokeOver):(c.fill=d._buttonFillNormal,c.stroke=d._buttonStrokeNormal);f.skipsUndoManager=g}}};b.actionCancel=function(b,d){if(d.Eg()&&d instanceof X&&null!==d._buttonFillPressed){var c=d.Xa("ButtonBorder");if(c instanceof Kf){var f=b.diagram,
g=f.skipsUndoManager;f.skipsUndoManager=!0;a(b,d)?(c.fill=d._buttonFillOver,c.stroke=d._buttonStrokeOver):(c.fill=d._buttonFillNormal,c.stroke=d._buttonStrokeNormal);f.skipsUndoManager=g}}};b.actionMove=function(b,d){if(d.Eg()&&d instanceof X&&null!==d._buttonFillPressed){var c=b.diagram;if(0===c.firstInput.button&&(c.currentTool.standardMouseOver(),a(b,d)&&(b=d.Xa("ButtonBorder"),b instanceof Kf))){var f=c.skipsUndoManager;c.skipsUndoManager=!0;var g=d._buttonFillPressed;b.fill!==g&&(b.fill=g);g=
d._buttonStrokePressed;b.stroke!==g&&(b.stroke=g);c.skipsUndoManager=f}}};return b});
Rl("TreeExpanderButton",function(){var a=Ml("Button",{_treeExpandedFigure:"MinusLine",_treeCollapsedFigure:"PlusLine"},Ml(Kf,{name:"ButtonIcon",figure:"MinusLine",stroke:"#424242",strokeWidth:2,desiredSize:Ob},(new Mi("figure","isTreeExpanded",function(a,c){c=c.panel;return a?c._treeExpandedFigure:c._treeCollapsedFigure})).Aq()),{visible:!1},(new Mi("visible","isTreeLeaf",function(a){return!a})).Aq());a.click=function(a,c){c=c.part;c instanceof Ke&&(c=c.adornedPart);if(c instanceof W){var b=c.diagram;
if(null!==b){b=b.commandHandler;if(c.isTreeExpanded){if(!b.canCollapseTree(c))return}else if(!b.canExpandTree(c))return;a.handled=!0;c.isTreeExpanded?b.collapseTree(c):b.expandTree(c)}}};return a});
Rl("SubGraphExpanderButton",function(){var a=Ml("Button",{_subGraphExpandedFigure:"MinusLine",_subGraphCollapsedFigure:"PlusLine"},Ml(Kf,{name:"ButtonIcon",figure:"MinusLine",stroke:"#424242",strokeWidth:2,desiredSize:Ob},(new Mi("figure","isSubGraphExpanded",function(a,c){c=c.panel;return a?c._subGraphExpandedFigure:c._subGraphCollapsedFigure})).Aq()));a.click=function(a,c){c=c.part;c instanceof Ke&&(c=c.adornedPart);if(c instanceof T){var b=c.diagram;if(null!==b){b=b.commandHandler;if(c.isSubGraphExpanded){if(!b.canCollapseSubGraph(c))return}else if(!b.canExpandSubGraph(c))return;
a.handled=!0;c.isSubGraphExpanded?b.collapseSubGraph(c):b.expandSubGraph(c)}}};return a});Rl("ToolTip",function(){return Ml(Ke,X.Auto,{isShadowed:!0,shadowColor:"rgba(0, 0, 0, .4)",shadowOffset:new I(0,3),shadowBlur:5},Ml(Kf,{name:"Border",figure:"RoundedRectangle",parameter1:1,parameter2:1,fill:"#F5F5F5",stroke:"#F0F0F0",spot1:new P(0,0,4,6),spot2:new P(1,1,-4,-4)}))});
Rl("ContextMenu",function(){return Ml(Ke,X.Vertical,{background:"#F5F5F5",isShadowed:!0,shadowColor:"rgba(0, 0, 0, .4)",shadowOffset:new I(0,3),shadowBlur:5},new Mi("background","",function(a){return null!==a.adornedPart&&null!==a.placeholder?null:"#F5F5F5"}))});Rl("ContextMenuButton",function(){var a=Ml("Button");a.stretch=Yk;var b=a.Xa("ButtonBorder");b instanceof Kf&&(b.figure="Rectangle",b.strokeWidth=0,b.spot1=new P(0,0,2,3),b.spot2=new P(1,1,-2,-2));return a});
Rl("PanelExpanderButton",function(a){var b=Sl(a,"COLLAPSIBLE"),c=Ml("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},Ml(Kf,{name:"ButtonIcon",strokeWidth:2},(new Mi("geometryString","visible",function(a){return a?c._buttonExpandedFigure:c._buttonCollapsedFigure})).Aq(b)));
a=c.Xa("ButtonBorder");a instanceof Kf&&(a.stroke=null,a.fill="rgba(0, 0, 0, 0)");c.click=function(a,c){var d=c.diagram;if(null!==d&&!d.isReadOnly){var e=c.Ui();null===e&&(e=c.part);null!==e&&(c=e.Xa(b),null!==c&&(a.handled=!0,d.ua("Collapse/Expand Panel"),c.visible=!c.visible,d.Ua("Collapse/Expand Panel")))}};return c});
Rl("CheckBoxButton",function(a){var b=Sl(a);a=Ml("Button",{desiredSize:new M(14,14)},Ml(Kf,{name:"ButtonIcon",geometryString:"M0 0 M0 8.85 L4.9 13.75 16.2 2.45 M16.2 16.2",strokeWidth:2,stretch:ud,geometryStretch:zg,visible:!1},""!==b?(new Mi("visible",b)).Vx():[]));a.click=function(a,d){if(d instanceof X){var c=a.diagram;if(!(null===c||c.isReadOnly||""!==b&&c.model.isReadOnly)){a.handled=!0;var f=d.Xa("ButtonIcon");c.ua("checkbox");f.visible=!f.visible;"function"===typeof d._doClick&&d._doClick(a,
d);c.Ua("checkbox")}}};return a});
Rl("CheckBox",function(a){a=Sl(a);a=Ml("CheckBoxButton",a,{name:"Button",isActionable:!1,margin:new oc(0,1,0,0)});var b=Ml(X,"Horizontal",a,{isActionable:!0,cursor:a.cursor,margin:1,_buttonFillNormal:a._buttonFillNormal,_buttonStrokeNormal:a._buttonStrokeNormal,_buttonFillOver:a._buttonFillOver,_buttonStrokeOver:a._buttonStrokeOver,_buttonFillPressed:a._buttonFillPressed,_buttonStrokePressed:a._buttonStrokePressed,_buttonFillDisabled:a._buttonFillDisabled,mouseEnter:a.mouseEnter,mouseLeave:a.mouseLeave,
actionDown:a.actionDown,actionUp:a.actionUp,actionCancel:a.actionCancel,actionMove:a.actionMove,click:a.click,_buttonClick:a.click});a.mouseEnter=null;a.mouseLeave=null;a.actionDown=null;a.actionUp=null;a.actionCancel=null;a.actionMove=null;a.click=null;return b});Y.None=xg=new D(Y,"None",0);Y.Default=Xk=new D(Y,"Default",0);Y.Vertical=Zk=new D(Y,"Vertical",4);Y.Horizontal=Yk=new D(Y,"Horizontal",5);Y.Fill=ud=new D(Y,"Fill",3);Y.Uniform=zg=new D(Y,"Uniform",1);
Y.UniformToFill=$k=new D(Y,"UniformToFill",2);Y.FlipVertical=al=new D(Y,"FlipVertical",1);Y.FlipHorizontal=bl=new D(Y,"FlipHorizontal",2);Y.FlipBoth=cl=new D(Y,"FlipBoth",3);Y.make=Ml;Y.getBuilders=function(){var a=new G,b;for(b in Nl)if(b!==b.toLowerCase()){var c=Nl.H(b);"function"===typeof c&&a.add(b,c)}a.freeze();return a};Y.defineBuilder=Rl;Y.takeBuilderArgument=Sl;
function el(){this.En=this.Pf=this.ug=this.Om=this.Rm=this.Qm=this.Pm=this.fg=this.Go=this.Fo=this.hg=this.ig=this.kg=this.jg=this.gg=this.Of=this.Sf=this.Nf=null}el.prototype.copy=function(){var a=new el;a.Nf=this.Nf;a.Sf=this.Sf;a.Of=this.Of;a.gg=this.gg;a.jg=this.jg;a.kg=this.kg;a.ig=this.ig;a.hg=this.hg;a.Fo=this.Fo;a.Go=this.Go;a.fg=this.fg;a.Pm=this.Pm;a.Qm=this.Qm;a.Rm=this.Rm;a.Om=this.Om;a.ug=this.ug;a.Pf=this.Pf;a.En=this.En;return a};el.className="GraphObjectEventHandlers";
function Wl(){this.Ka=[1,0,0,1,0,0]}Wl.prototype.copy=function(){var a=new Wl;a.Ka[0]=this.Ka[0];a.Ka[1]=this.Ka[1];a.Ka[2]=this.Ka[2];a.Ka[3]=this.Ka[3];a.Ka[4]=this.Ka[4];a.Ka[5]=this.Ka[5];return a};Wl.prototype.translate=function(a,b){this.Ka[4]+=this.Ka[0]*a+this.Ka[2]*b;this.Ka[5]+=this.Ka[1]*a+this.Ka[3]*b};Wl.prototype.scale=function(a,b){this.Ka[0]*=a;this.Ka[1]*=a;this.Ka[2]*=b;this.Ka[3]*=b};Wl.className="STransform";
function Xl(a){this.type=a;this.r2=this.y2=this.x2=this.r1=this.y1=this.x1=0;this.zx=[];this.pattern=null}Xl.prototype.addColorStop=function(a,b){this.zx.push({offset:a,color:b})};Xl.className="SGradient";
function Dj(a,b){this.ownerDocument=a=void 0===b?x.document:b;this.hA="http://www.w3.org/2000/svg";void 0!==a&&(this.Ea=this.tb("svg",{width:"1px",height:"1px",viewBox:"0 0 1 1"}),this.Ea.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns","http://www.w3.org/2000/svg"),this.Ea.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns:xlink","http://www.w3.org/1999/xlink"));this.jq=null;this.context=new Yl(this)}
Dj.prototype.resize=function(a,b,c,d){return this.width!==a||this.height!==b?(this.style.width=c+"px",this.style.height=d+"px",this.Ea.setAttributeNS(null,"width",c+"px"),this.Ea.setAttributeNS(null,"height",d+"px"),this.Ea.setAttributeNS(null,"viewBox","0 0 "+c+" "+d),this.context.Du.firstElementChild.setAttributeNS(null,"width",c+"px"),this.context.Du.firstElementChild.setAttributeNS(null,"height",d+"px"),!0):!1};
Dj.prototype.tb=function(a,b,c){a=this.ownerDocument.createElementNS(this.hA,a);if(za(b))for(var d in b)a.setAttributeNS("href"===d?"http://www.w3.org/1999/xlink":"",d,b[d]);void 0!==c&&(a.textContent=c);return a};Dj.prototype.getBoundingClientRect=function(){return this.Ea.getBoundingClientRect()};Dj.prototype.focus=function(){this.Ea.focus()};Dj.prototype.Fx=function(){this.ownerDocument=null};
ma.Object.defineProperties(Dj.prototype,{width:{get:function(){return this.Ea.width.baseVal.value},set:function(a){this.Ea.width=a}},height:{get:function(){return this.Ea.height.baseVal.value},set:function(a){this.Ea.height=a}},style:{get:function(){return this.Ea.style}}});Dj.className="SVGSurface";
function Yl(a){this.yk=a;this.svg=a.Ea;this.stack=[];this.xc=[];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.strokeStyle="#000000";this.textAlign="start";this.clipInsteadOfFill=!1;this.ef=this.Gp=this.Fp=0;this.uq=null;this.path=[];this.wu=!1;this.rh=null;this.sh=0;this.Ud=new Wl;
Zl(this,1,0,0,1,0,0);var b=pb++,c=this.tb("clipPath",{id:"mainClip"+b});c.appendChild(this.tb("rect",{x:0,y:0,width:a.width,height:a.height}));this.Du=c;this.yk.Ea.appendChild(c);this.xc[0].setAttributeNS(null,"clip-path","url(#mainClip"+b+")");this.jA={}}t=Yl.prototype;
t.reset=function(){this.stack=[];this.xc=[];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.strokeStyle="#000000";this.textAlign="start";this.clipInsteadOfFill=!1;this.ef=this.Gp=this.Fp=0;this.uq=null;this.path=[];this.Ud=new Wl;Zl(this,1,0,0,1,0,0);var a=pb++,b=this.tb("clipPath",
{id:"mainClip"+a});b.appendChild(this.tb("rect",{x:0,y:0,width:this.yk.width,height:this.yk.height}));this.Du=b;this.yk.Ea.appendChild(b);this.xc[0].setAttributeNS(null,"clip-path","url(#mainClip"+a+")")};
t.arc=function(a,b,c,d,e,f,g,h){var k=2*Math.PI,l=k-1E-6,m=c*Math.cos(d),n=c*Math.sin(d),p=a+m,r=b+n,q=f?0:1;d=f?d-e:e-d;(1E-6<Math.abs(g-p)||1E-6<Math.abs(h-r))&&this.path.push(["L",p,+r]);0>d&&(d=d%k+k);d>l?(this.path.push(["A",c,c,0,1,q,a-m,b-n]),this.path.push(["A",c,c,0,1,q,p,r])):1E-6<d&&this.path.push(["A",c,c,0,+(d>=Math.PI),q,a+c*Math.cos(e),b+c*Math.sin(e)])};t.beginPath=function(){this.path=[]};t.bezierCurveTo=function(a,b,c,d,e,f){this.path.push(["C",a,b,c,d,e,f])};t.clearRect=function(){};
t.clip=function(){this.addPath("clipPath",this.path,this.Ud);this.addPath("clipPath",this.path,new Wl)};t.closePath=function(){this.path.push(["z"])};t.createLinearGradient=function(a,b,c,d){var e=new Xl("linear");e.x1=a;e.y1=b;e.x2=c;e.y2=d;return e};
t.createPattern=function(a){var b="";a instanceof HTMLCanvasElement&&(b=a.toDataURL());a instanceof HTMLImageElement&&(b=a.getAttribute("src"));var c=this.jA;if(c[b])return"url(#"+c[b]+")";var d="PATTERN"+pb++,e={x:0,y:0,width:a.width,height:a.height,href:b};a=this.tb("pattern",{width:a.width,height:a.height,id:d,patternUnits:"userSpaceOnUse"});a.appendChild(this.tb("image",e));this.svg.appendChild(a);c[b]=d;return"url(#"+d+")"};
t.createRadialGradient=function(a,b,c,d,e,f){var g=new Xl("radial");g.x1=a;g.y1=b;g.r1=c;g.x2=d;g.y2=e;g.r2=f;return g};
t.drawImage=function(a,b,c,d,e,f,g,h,k){var l="";a instanceof HTMLCanvasElement&&(l=a.toDataURL());a instanceof HTMLImageElement&&(l=a.getAttribute("src"));var m=a instanceof HTMLImageElement?a.naturalWidth:a.width,n=a instanceof HTMLImageElement?a.naturalHeight:a.height;void 0===d&&(f=b,g=c,h=d=m,k=e=n);d=d||0;e=e||0;f=f||0;g=g||0;h=h||0;k=k||0;l={x:0,y:0,width:m||d,height:n||e,href:l,preserveAspectRatio:"xMidYMid slice"};J.$(d,h)&&J.$(e,k)||(l.preserveAspectRatio="none");a="";h/=d;k/=e;if(0!==f||
0!==g)a+=" translate("+f+", "+g+")";if(1!==h||1!==k)a+=" scale("+h+", "+k+")";if(0!==b||0!==c)a+=" translate("+-b+", "+-c+")";if(0!==b||0!==c||d!==m||e!==n)f="CLIP"+pb++,g=this.tb("clipPath",{id:f}),g.appendChild(this.tb("rect",{x:b,y:c,width:d,height:e})),this.svg.appendChild(g),l["clip-path"]="url(#"+f+")";$l(this,"image",l,this.Ud,a);this.addElement("image",l)};t.fill=function(){this.addPath("fill",this.path,this.Ud)};t.Vd=function(){this.clipInsteadOfFill?this.clip():this.fill()};
t.fillRect=function(a,b,c,d){a=[a,b,c,d];a={x:a[0],y:a[1],width:a[2],height:a[3]};$l(this,"fill",a,this.Ud);this.addElement("rect",a)};t.fillText=function(a,b,c){a=[a,b,c];b=this.textAlign;"left"===b?b="start":"right"===b?b="end":"center"===b&&(b="middle");b={x:a[1],y:a[2],style:"font: "+this.font,"text-anchor":b};$l(this,"fill",b,this.Ud);this.addElement("text",b,a[0])};t.lineTo=function(a,b){this.path.push(["L",a,b])};t.moveTo=function(a,b){this.path.push(["M",a,b])};
t.quadraticCurveTo=function(a,b,c,d){this.path.push(["Q",a,b,c,d])};t.rect=function(a,b,c,d){this.path.push(["M",a,b],["L",a+c,b],["L",a+c,b+d],["L",a,b+d],["z"])};
t.restore=function(){this.Ud=this.stack.pop();this.path=this.stack.pop();var a=this.stack.pop();this.fillStyle=a.fillStyle;this.font=a.font;this.globalAlpha=a.globalAlpha;this.lineCap=a.lineCap;this.lineDashOffset=a.lineDashOffset;this.lineJoin=a.lineJoin;this.lineWidth=a.lineWidth;this.miterLimit=a.miterLimit;this.shadowBlur=a.shadowBlur;this.shadowColor=a.shadowColor;this.shadowOffsetX=a.shadowOffsetX;this.shadowOffsetY=a.shadowOffsetY;this.strokeStyle=a.strokeStyle;this.textAlign=a.textAlign};
t.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});for(var a=[],b=0;b<this.path.length;b++)a.push(this.path[b]);this.stack.push(a);this.stack.push(this.Ud.copy())};
t.setTransform=function(a,b,c,d,e,f){1===a&&0===b&&0===c&&1===d&&0===e&&0===f||Zl(this,a,b,c,d,e,f)};t.scale=function(a,b){this.Ud.scale(a,b)};t.translate=function(a,b){this.Ud.translate(a,b)};t.transform=function(){};t.stroke=function(){this.addPath("stroke",this.path,this.Ud)};t.fj=function(){this.clipInsteadOfFill||this.stroke()};t.tb=function(a,b,c){return this.yk.tb(a,b,c)};