MediaWiki:AlcCodeMapVis.js

!function(e){var t={};function i(n){if(t[n])return t[n].exports;var r=t[n]={i:n,l:!1,exports:{}};return e[n].call(r.exports,r,r.exports,i),r.l=!0,r.exports}i.m=e,i.c=t,i.d=function(e,t,n){i.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:n})},i.n=function(e){var t=e&&e.__esModule?function{return e.default}:function{return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="",i(i.s=2)}([function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.default={font:{glyphs:{0:{ha:828,x_min:51,x_max:779,o:"m 415 -25 q 143 131 243 -25 q 51 476 51 272 q 142 825 51 683 q 415 983 243 983 q 688 825 586 983 q 779 476 779 682 q 689 132 779 272 q 415 -25 588 -25 m 415 138 q 529 243 486 138 q 568 478 568 339 q 531 714 568 619 q 415 821 489 821 q 303 719 344 821 q 263 478 263 617 q 302 238 263 338 q 415 138 342 138 z "},1:{ha:828,x_min:199,x_max:629,o:"m 629 0 l 435 0 l 435 674 l 199 674 l 199 810 q 375 838 319 810 q 469 985 451 876 l 629 985 l 629 0 z "},2:{ha:828,x_min:64,x_max:764,o:"m 764 685 q 675 453 764 542 q 485 325 638 415 q 307 168 357 250 l 754 168 l 754 0 l 64 0 q 193 301 64 175 q 433 481 203 311 q 564 674 564 576 q 519 781 564 738 q 417 824 475 824 q 318 781 358 824 q 263 633 271 731 l 81 633 q 185 903 81 807 q 415 988 276 988 q 654 907 553 988 q 764 685 764 819 z "},3:{ha:828,x_min:61,x_max:767,o:"m 767 290 q 653 51 767 143 q 403 -32 549 -32 q 168 49 263 -32 q 61 300 61 140 l 250 300 q 299 174 250 219 q 406 132 343 132 q 514 169 471 132 q 563 282 563 211 q 492 406 563 369 q 343 432 439 432 l 343 568 q 472 593 425 568 q 533 701 533 626 q 493 794 533 758 q 399 829 453 829 q 306 790 344 829 q 268 669 268 750 l 81 669 q 183 910 81 824 q 411 986 275 986 q 633 917 540 986 q 735 719 735 840 q 703 609 735 657 q 615 522 672 561 q 727 428 688 486 q 767 290 767 369 z "},4:{ha:828,x_min:53,x_max:775,o:"m 775 213 l 660 213 l 660 0 l 469 0 l 469 213 l 53 213 l 53 385 l 417 958 l 660 958 l 660 369 l 775 369 l 775 213 m 474 364 l 474 786 l 204 364 l 474 364 z "},5:{ha:828,x_min:60,x_max:768,o:"m 768 319 q 646 60 768 158 q 383 -29 535 -29 q 160 43 249 -29 q 60 264 60 124 l 253 264 q 297 165 253 201 q 401 129 340 129 q 514 172 468 129 q 565 308 565 221 q 515 438 565 388 q 400 488 465 488 q 331 472 363 488 q 272 419 299 456 l 94 428 l 158 958 l 724 958 l 724 790 l 296 790 l 272 593 q 349 635 307 621 q 432 649 390 649 q 665 551 561 649 q 768 319 768 453 z "},6:{ha:828,x_min:57,x_max:771,o:"m 744 733 l 544 733 q 500 802 533 776 q 425 828 467 828 q 315 769 360 828 q 264 571 264 701 q 451 638 343 638 q 692 538 603 638 q 771 315 771 449 q 683 79 771 176 q 421 -29 586 -29 q 135 124 228 -29 q 57 456 57 250 q 185 865 57 721 q 453 988 293 988 q 658 916 571 988 q 744 733 744 844 m 428 128 q 538 178 499 128 q 578 300 578 229 q 539 422 578 372 q 417 479 494 479 q 306 431 344 479 q 267 314 267 382 q 310 184 267 240 q 428 128 354 128 z "},7:{ha:828,x_min:65,x_max:763,o:"m 763 808 q 522 435 604 626 q 410 0 439 244 l 206 0 q 314 422 228 235 q 549 789 388 583 l 65 789 l 65 958 l 763 958 l 763 808 z "},8:{ha:828,x_min:57,x_max:769,o:"m 625 517 q 733 417 697 478 q 769 285 769 356 q 675 69 769 161 q 415 -29 574 -29 q 146 65 244 -29 q 57 274 57 150 q 94 414 57 350 q 204 517 131 478 q 113 610 143 557 q 83 718 83 663 q 178 906 83 825 q 414 986 272 986 q 650 904 556 986 q 744 715 744 822 q 716 608 744 658 q 625 517 688 558 m 414 590 q 516 625 479 590 q 553 707 553 660 q 517 792 553 756 q 414 828 481 828 q 312 792 349 828 q 275 707 275 757 q 310 624 275 658 q 414 590 346 590 m 414 135 q 528 179 488 135 q 564 279 564 218 q 525 386 564 342 q 411 436 482 436 q 299 388 342 436 q 261 282 261 344 q 301 178 261 222 q 414 135 340 135 z "},9:{ha:828,x_min:58,x_max:769,o:"m 769 493 q 647 90 769 232 q 385 -33 540 -33 q 188 35 272 -33 q 83 224 99 107 l 283 224 q 324 154 288 182 q 406 126 360 126 q 514 182 472 126 q 564 385 564 249 q 476 335 533 356 q 374 315 419 315 q 138 417 225 315 q 58 643 58 508 q 144 878 58 782 q 408 985 240 985 q 694 828 603 985 q 769 493 769 700 m 415 476 q 524 522 488 476 q 561 633 561 567 q 519 765 561 710 q 403 826 474 826 q 298 774 338 826 q 258 650 258 721 q 296 531 258 578 q 415 476 339 476 z "},A:{ha:1069,x_min:0,x_max:967,o:"m 967 0 l 747 0 l 679 208 l 286 208 l 218 0 l 0 0 l 361 1013 l 600 1013 l 967 0 m 624 376 l 481 810 l 340 376 l 624 376 z "},B:{ha:938,x_min:0,x_max:835,o:"m 675 547 q 791 451 747 518 q 835 304 835 383 q 718 75 835 158 q 461 0 613 0 l 0 0 l 0 1013 l 478 1013 q 697 951 610 1013 q 797 754 797 881 q 766 631 797 686 q 675 547 735 575 m 439 621 q 539 646 496 621 q 590 731 590 676 q 538 814 590 785 q 436 838 494 838 l 199 838 l 199 621 l 439 621 m 446 182 q 561 211 514 182 q 618 311 618 247 q 565 410 618 375 q 444 446 513 446 l 199 446 l 199 182 l 446 182 z "},C:{ha:1043,x_min:0,x_max:971,o:"m 971 346 q 803 70 933 169 q 490 -29 672 -29 q 131 131 268 -29 q 0 507 0 282 q 135 886 0 738 q 503 1040 275 1040 q 802 940 668 1040 q 965 679 936 839 l 746 679 q 649 809 717 761 q 496 857 582 857 q 283 747 361 857 q 214 508 214 649 q 282 268 214 368 q 493 154 360 154 q 651 205 585 154 q 753 346 718 256 l 971 346 z "},D:{ha:968,x_min:0,x_max:864,o:"m 400 1013 q 736 874 608 1013 q 864 524 864 735 q 717 147 864 293 q 340 0 571 0 l 0 0 l 0 1013 l 400 1013 m 399 836 l 206 836 l 206 182 l 372 182 q 585 276 507 182 q 657 504 657 365 q 594 726 657 632 q 399 836 522 836 z "},E:{ha:824,x_min:0,x_max:761,o:"m 761 0 l 0 0 l 0 1013 l 735 1013 l 735 836 l 206 836 l 206 621 l 690 621 l 690 446 l 206 446 l 206 186 l 761 186 l 761 0 z "},F:{ha:778,x_min:0,x_max:707,o:"m 707 836 l 206 836 l 206 607 l 646 607 l 646 432 l 206 432 l 206 0 l 0 0 l 0 1013 l 707 1013 l 707 836 z "},G:{ha:1057,x_min:0,x_max:971,o:"m 971 -1 l 829 -1 l 806 118 q 479 -29 671 -29 q 126 133 261 -29 q 0 510 0 286 q 131 885 0 738 q 493 1040 268 1040 q 790 949 660 1040 q 961 697 921 857 l 736 697 q 644 814 710 769 q 500 858 578 858 q 285 747 364 858 q 213 506 213 646 q 285 264 213 363 q 506 154 365 154 q 667 217 599 154 q 761 374 736 281 l 549 374 l 549 547 l 971 547 l 971 -1 z "},H:{ha:953,x_min:0,x_max:838,o:"m 838 0 l 628 0 l 628 450 l 210 450 l 210 0 l 0 0 l 0 1013 l 210 1013 l 210 635 l 628 635 l 628 1013 l 838 1013 l 838 0 z "},I:{ha:365,x_min:42,x_max:250,o:"m 250 0 l 42 0 l 42 1013 l 250 1013 l 250 0 z "},J:{ha:760,x_min:0,x_max:649,o:"m 649 294 q 573 48 649 125 q 328 -29 497 -29 q 61 82 136 -29 q 0 375 0 174 l 200 375 l 199 310 q 219 194 199 231 q 321 144 249 144 q 418 193 390 144 q 440 307 440 232 l 440 1013 l 649 1013 l 649 294 z "},K:{ha:996,x_min:0,x_max:900,o:"m 900 0 l 647 0 l 317 463 l 208 356 l 208 0 l 0 0 l 0 1013 l 208 1013 l 208 596 l 604 1013 l 864 1013 l 461 603 l 900 0 z "},L:{ha:763,x_min:0,x_max:704,o:"m 704 0 l 0 0 l 0 1013 l 208 1013 l 208 186 l 704 186 l 704 0 z "},M:{ha:1135,x_min:0,x_max:1019,o:"m 1019 0 l 824 0 l 824 818 l 618 0 l 403 0 l 194 818 l 194 0 l 0 0 l 0 1013 l 310 1013 l 510 242 l 708 1013 l 1019 1013 l 1019 0 z "},N:{ha:949,x_min:0,x_max:833,o:"m 833 0 l 618 0 l 206 696 l 206 0 l 0 0 l 0 1013 l 217 1013 l 629 315 l 629 1013 l 833 1013 l 833 0 z "},O:{ha:1094,x_min:0,x_max:994,o:"m 497 -29 q 133 128 272 -29 q 0 506 0 278 q 132 883 0 733 q 497 1040 271 1040 q 861 883 722 1040 q 994 506 994 733 q 863 128 994 278 q 497 -29 724 -29 m 497 154 q 711 267 632 154 q 781 507 781 365 q 711 746 781 647 q 497 857 632 857 q 283 747 361 857 q 213 507 213 647 q 282 267 213 365 q 497 154 361 154 z "},P:{ha:838,x_min:0,x_max:771,o:"m 208 361 l 208 0 l 0 0 l 0 1013 l 450 1013 q 682 919 593 1013 q 771 682 771 826 q 688 453 771 544 q 467 361 604 361 l 208 361 m 422 836 l 210 836 l 210 544 l 411 544 q 526 580 481 544 q 571 683 571 615 q 528 792 571 747 q 422 836 485 836 z "},Q:{ha:1096,x_min:0,x_max:994,o:"m 994 47 l 882 -71 l 760 42 q 639 -12 707 4 q 496 -29 571 -29 q 135 124 271 -29 q 0 504 0 276 q 132 882 0 732 q 497 1040 271 1040 q 860 883 719 1040 q 994 507 994 732 q 967 322 994 414 q 885 153 939 229 l 994 47 m 731 299 q 767 395 756 344 q 779 504 779 446 q 714 743 779 644 q 506 857 639 857 q 285 746 367 857 q 210 501 210 644 q 279 265 210 361 q 492 157 357 157 q 615 182 557 157 l 508 288 l 621 406 l 731 299 z "},R:{ha:947,x_min:0,x_max:836,o:"m 836 0 l 608 0 q 588 53 596 21 q 581 144 581 86 q 581 180 581 163 q 582 215 581 197 q 554 346 582 307 q 429 393 519 393 l 208 393 l 208 0 l 0 0 l 0 1013 l 492 1013 q 721 944 631 1013 q 819 735 819 869 q 779 584 819 654 q 665 486 739 514 q 758 415 728 464 q 794 232 794 358 l 794 171 q 801 84 794 117 q 836 32 807 51 l 836 0 m 463 838 l 208 838 l 208 572 l 453 572 q 563 604 518 572 q 613 704 613 640 q 569 801 613 765 q 463 838 526 838 z "},S:{ha:915,x_min:0,x_max:826,o:"m 826 307 q 701 56 826 149 q 424 -29 588 -29 q 139 60 256 -29 q 0 318 14 154 l 208 318 q 289 192 217 238 q 438 151 353 151 q 560 181 507 151 q 624 282 624 217 q 467 411 624 372 q 176 488 197 478 q 18 719 18 557 q 136 958 18 869 q 400 1040 244 1040 q 671 957 561 1040 q 792 714 792 865 l 592 714 q 526 827 583 788 q 393 867 469 867 q 278 839 326 867 q 218 743 218 806 q 375 618 218 656 q 668 543 647 553 q 826 307 826 472 z "},T:{ha:894,x_min:0,x_max:808,o:"m 808 831 l 508 831 l 508 0 l 299 0 l 299 831 l 0 831 l 0 1013 l 808 1013 l 808 831 z "},U:{ha:926,x_min:0,x_max:813,o:"m 813 363 q 697 79 813 188 q 406 -29 582 -29 q 115 78 229 -29 q 0 363 0 186 l 0 1013 l 210 1013 l 210 386 q 260 225 210 290 q 408 153 315 153 q 554 225 500 153 q 603 386 603 290 l 603 1013 l 813 1013 l 813 363 z "},V:{ha:997,x_min:0,x_max:896,o:"m 896 1013 l 550 0 l 347 0 l 0 1013 l 232 1013 l 447 256 l 667 1013 l 896 1013 z "},W:{ha:1399,x_min:0,x_max:1292,o:"m 1292 1013 l 1003 0 l 803 0 l 646 776 l 490 0 l 289 0 l 0 1013 l 215 1013 l 389 299 l 535 1013 l 757 1013 l 904 299 l 1076 1013 l 1292 1013 z "},X:{ha:999,x_min:0,x_max:894,o:"m 894 0 l 654 0 l 446 351 l 239 0 l 0 0 l 317 517 l 0 1013 l 239 1013 l 446 660 l 653 1013 l 894 1013 l 578 519 l 894 0 z "},Y:{ha:931,x_min:0,x_max:836,o:"m 836 1013 l 532 376 l 532 0 l 322 0 l 322 376 l 0 1013 l 208 1013 l 428 576 l 626 1013 l 836 1013 z "},Z:{ha:906,x_min:0,x_max:804,o:"m 804 836 l 251 182 l 793 182 l 793 0 l 0 0 l 0 176 l 551 829 l 11 829 l 11 1013 l 804 1013 l 804 836 z "}},familyName:"Helvetiker",ascender:1215,descender:-333,underlinePosition:-139,underlineThickness:69,boundingBox:{yMin:-333,xMin:-162,yMax:1215,xMax:1681},resolution:1e3,original_font_information:{format:0,copyright:"Copyright (c) Magenta ltd, 2004.",fontFamily:"Helvetiker",fontSubfamily:"Bold",uniqueID:"Magenta ltd:Helvetiker Bold:22-10-104",fullName:"Helvetiker Bold",version:"Version 1.00 2004 initial release",postScriptName:"Helvetiker-Bold",manufacturer:"Magenta ltd",manufacturerURL:"http://www.magenta.gr",licence:'Copyright (c) 2004 by MAGENTA Ltd. All Rights Reserved.\r\n\r\nPermission is hereby granted, free of charge, to any person obtaining a copy of the fonts accompanying this license ("Fonts") and associated documentation files (the "Font Software"), to reproduce and distribute the Font Software, including without limitation the rights to use, copy, merge, publish, distribute, and/or sell copies of the Font Software, and to permit persons to whom the Font Software is furnished to do so, subject to the following conditions: \r\n\r\nThe above copyright and this permission notice shall be included in all copies of one or more of the Font Software typefaces.\r\n\r\nThe Font Software may be modified, altered, or added to, and in particular the designs of glyphs or characters in the Fonts may be modified and additional glyphs or characters may be added to the Fonts, only if the fonts are renamed to names not containing the word "MgOpen", or if the modifications are accepted for inclusion in the Font Software itself by the each appointed Administrator.\r\n\r\nThis License becomes null and void to the extent applicable to Fonts or Font Software that has been modified and is distributed under the "MgOpen" name.\r\n\r\nThe Font Software may be sold as part of a larger software package but no copy of one or more of the Font Software typefaces may be sold by itself. \r\n\r\nTHE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL MAGENTA OR PERSONS OR BODIES IN CHARGE OF ADMINISTRATION AND MAINTENANCE OF THE FONT SOFTWARE BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE FONT SOFTWARE.',licenceURL:"http://www.ellak.gr/fonts/MgOpen/license.html",preferredFamily:"Helvetiker",preferredSubfamily:"Bold",compatibleFullName:"Helvetiker Bold"},cssFontWeight:"bold",cssFontStyle:"normal"},tileWidth:1,tileHeight:.5,backgroundColor:8421504}},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function{function e(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}};var r=function{function e{!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return n(e,null,[{key:"clamp",value:function(e,t,i){return Math.min(Math.max(e,t),i)}},{key:"hex2a",value:function(e){for(var t=e.toString,i="",n=0;n<t.length;n+=2)i+=String.fromCharCode(parseInt(t.substr(n,2),16));return i}}]),e};t.default=r},function(e,t,i){"use strict";var n,r=function{function e(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}},a=i(3),l=(n=a)&&n.__esModule?n:{default:n};var o=[],s=function{function e{!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return r(e,null,[{key:"loadMaps",value:function{o.forEach(function(e){return e.dispose}),o=[],Array.from(document.getElementsByClassName("loadable-map")).forEach(function(e){console.log("Processing DOM element",e);var t=new l.default(e);t.update,o.push(t)})}}]),e};window.AlcCodeMapVis=s},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function{function e(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}},r=s(i(4)),a=s(i(5)),l=s(i(0)),o=s(i(1));function s(e){return e&&e.__esModule?e:{default:e}}var h=function{function e(t){var i=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.domContainer=t,this.scene=new THREE.Scene,this.running=!0,this.camera=new THREE.PerspectiveCamera(75,this.domContainer.clientWidth/this.domContainer.clientHeight,.1,1e3),this.camera.up=new THREE.Vector3(0,0,1),this.scene.add(this.camera),this.renderer=new THREE.WebGLRenderer({antialias:!0}),this.renderer.setSize(this.domContainer.clientWidth,this.domContainer.clientHeight),this.renderer.setClearColor(l.default.backgroundColor,1),this.domContainer.innerHTML="",this.domContainer.appendChild(this.renderer.domElement),this.interactiveCamera=new r.default(this.camera,this.renderer.domElement),this.interactiveCamera.attachListeners,this.onResizeEvent=function{i.camera.aspect=i.domContainer.clientWidth/i.domContainer.clientHeight,i.camera.updateProjectionMatrix,i.renderer.setSize(i.domContainer.clientWidth,i.domContainer.clientHeight)},window.addEventListener("resize",this.onResizeEvent),this.beforeRenderEvents=[],this.loadMapToScene}return n(e,[{key:"loadMapToScene",value:function{var e=JSON.parse(o.default.hex2a(this.domContainer.dataset.map)),t=new a.default(e);t.addToScene(this,this.scene);var i=t.getCenter;this.interactiveCamera.setCenter(i.x,i.y,i.z),this.interactiveCamera.setSphereParameters((t.width+t.height)*l.default.tileWidth/2,-Math.PI/4,Math.PI/4)}},{key:"update",value:function{var e=this;this.running&&(requestAnimationFrame(function{return e.update}),this.interactiveCamera.updateCameraPosition,this.beforeRenderEvents.forEach(function(t){return t(e.scene,e.interactiveCamera)}),this.renderer.render(this.scene,this.camera))}},{key:"dispose",value:function{for(this.running=!1,this.interactiveCamera.dispose,this.beforeRenderEvents=[],window.removeEventListener("resize",this.onResizeEvent);0!==this.scene.children.length;){var e=this.scene.children[0];this.scene.remove(e),this.disposeNode(e)}this.renderer.dispose,this.renderer.forceContextLoss,this.renderer.context=void 0,this.renderer.domElement=void 0}},{key:"disposeNode",value:function(e){if(e instanceof THREE.Mesh||e instanceof THREE.LineSegments)e.geometry&&e.geometry.dispose,e.material&&(e.material.map&&e.material.map.dispose,e.material.lightMap&&e.material.lightMap.dispose,e.material.bumpMap&&e.material.bumpMap.dispose,e.material.normalMap&&e.material.normalMap.dispose,e.material.specularMap&&e.material.specularMap.dispose,e.material.envMap&&e.material.envMap.dispose,e.material.dispose);else if(e instanceof THREE.Group)for(0!==e.children.length;){var t=e.children[0];e.remove(t),this.disposeNode(t)}}}]),e};t.default=h},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n,r=function{function e(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}},a=i(1),l=(n=a)&&n.__esModule?n:{default:n};var o=function{function e(t,i){var n=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.camera=t,this.domElement=i,this.radPerPixel=Math.PI/450,this.minZoom=5,this.maxZoom=100,this.radial=10,this.azi=0,this.polar=Math.PI/2,this.center=new THREE.Vector3(0,0,0);var r=!1,a=0,o=0;this.dragStartEvent=function(e){if("touchstart"===e.type){if(1!==e.touches.length)return;a=e.touches[0].clientX,o=e.touches[0].clientY}else a=e.clientX,o=e.clientY;r=!0},this.dragMoveEvent=function(e){if(r&&("touchmove"!==e.type||1===e.touches.length)){var t=void 0,i=void 0;"touchmove"===e.type?(t=e.touches[0].clientX,i=e.touches[0].clientY,e.preventDefault):(t=e.clientX,i=e.clientY),n.azi-=(t-a)*n.radPerPixel,n.polar-=(i-o)*n.radPerPixel,n.polar=l.default.clamp(n.polar,.001,Math.PI/2),a=t,o=i}},this.dragEndEvent=function{return r=!1},this.wheelEvent=function(e){n.radial-=.01*e.wheelDeltaY,n.radial=l.default.clamp(n.radial,n.minZoom,n.maxZoom),e.preventDefault};var s=!1,h=void 0;this.pinchStartEvent=function(e){if(2===e.touches.length){var t=e.touches[0].clientX-e.touches[1].clientX,i=e.touches[0].clientY-e.touches[1].clientY;h=Math.sqrt(t*t+i*i),s=!0}},this.pinchMoveEvent=function(e){if(s){var t=e.touches[0].clientX-e.touches[1].clientX,i=e.touches[0].clientY-e.touches[1].clientY,r=Math.sqrt(t*t+i*i);n.radial-=.01*(r-h),n.radial=l.default.clamp(n.radial,n.minZoom,n.maxZoom),h=r,e.preventDefault}},this.pinchEndEvent=function{return s=!1}}return r(e,[{key:"setCenter",value:function(e,t,i){this.center=new THREE.Vector3(e,t,i)}},{key:"setSphereParameters",value:function(e,t,i){this.radial=e,this.azi=t,this.polar=i}},{key:"attachListeners",value:function{this.domElement.addEventListener("mousedown",this.dragStartEvent),this.domElement.addEventListener("mousemove",this.dragMoveEvent),this.domElement.addEventListener("mouseup",this.dragEndEvent),this.domElement.addEventListener("mouseout",this.dragEndEvent),this.domElement.addEventListener("wheel",this.wheelEvent),this.domElement.addEventListener("touchstart",this.dragStartEvent),this.domElement.addEventListener("touchmove",this.dragMoveEvent),this.domElement.addEventListener("touchend",this.dragEndEvent),this.domElement.addEventListener("touchcancel",this.dragEndEvent),this.domElement.addEventListener("touchleave",this.dragEndEvent),this.domElement.addEventListener("touchstart",this.pinchStartEvent),this.domElement.addEventListener("touchmove",this.pinchMoveEvent),this.domElement.addEventListener("touchend",this.pinchEndEvent),this.domElement.addEventListener("touchcancel",this.pinchEndEvent),this.domElement.addEventListener("touchleave",this.pinchEndEvent)}},{key:"updateCameraPosition",value:function{this.camera.position.set(this.center.x+this.radial*Math.cos(this.azi)*Math.sin(this.polar),this.center.y+this.radial*Math.sin(this.azi)*Math.sin(this.polar),this.center.z+this.radial*Math.cos(this.polar)),this.camera.lookAt(this.center)}},{key:"dispose",value:function{this.domElement.removeEventListener("mousedown",this.dragStartEvent),this.domElement.removeEventListener("mousemove",this.dragMoveEvent),this.domElement.removeEventListener("mouseup",this.dragEndEvent),this.domElement.removeEventListener("mouseout",this.dragEndEvent),this.domElement.removeEventListener("wheel",this.wheelEvent),this.domElement.removeEventListener("touchstart",this.dragStartEvent),this.domElement.removeEventListener("touchmove",this.dragMoveEvent),this.domElement.removeEventListener("touchend",this.dragEndEvent),this.domElement.removeEventListener("touchcancel",this.dragEndEvent),this.domElement.removeEventListener("touchleave",this.dragEndEvent),this.domElement.removeEventListener("touchstart",this.pinchStartEvent),this.domElement.removeEventListener("touchmove",this.pinchMoveEvent),this.domElement.removeEventListener("touchend",this.pinchEndEvent),this.domElement.removeEventListener("touchcancel",this.pinchEndEvent),this.domElement.removeEventListener("touchleave",this.pinchEndEvent)}}]),e};t.default=o},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function{function e(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}},r=o(i(0)),a=o(i(6)),l=o(i(7));function o(e){return e&&e.__esModule?e:{default:e}}var s=function{function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.width=t.w,this.height=t.h,this.grid=[],this.meshBuilder=new a.default;for(var i=0;i<this.width;i++){this.grid[i]=[];for(var n=0;n<this.height;n++)this.grid[i][n]=t.grid[n*this.width+i]}}return n(e,[{key:"getCenter",value:function{return{x:r.default.tileWidth*this.width/2,y:r.default.tileWidth*this.height/2,z:r.default.tileHeight}}},{key:"getTilePosition",value:function(e,t,i){return{x:r.default.tileWidth*e,y:r.default.tileWidth*t,z:r.default.tileHeight*i+r.default.tileHeight/2}}},{key:"addToScene",value:function(e,t){for(var i=0;i<this.width;i++)for(var n=0;n<this.height;n++){for(var a=this.grid[i][n],o=this.getTilePosition(i,n,a.h),s=0;s<a.h+1;s++){var h=this.getTilePosition(i,n,s),d=this.meshBuilder.buildTileMesh;d.position.set(h.x,h.y,h.z-r.default.tileHeight/2),t.add(d)}if("m"in a)switch(a.m){case l.default.PLAYER_UNIT:var u=this.meshBuilder.buildTextMesh(a.n),m=this.meshBuilder.buildPlayerUnitMesh("5P"===a.n);m.position.set(i*r.default.tileWidth,o.y,o.z+.5*r.default.tileHeight),u.mesh.position.set(i*r.default.tileWidth,o.y,o.z+1.5*r.default.tileHeight),t.add(m),t.add(u.mesh),e.beforeRenderEvents.push(u.before_render);break;case l.default.ENEMY_UNIT:var c=this.meshBuilder.buildTextMesh(a.n),E=this.meshBuilder.buildEnemyUnitMesh;E.position.set(o.x,o.y,o.z+.5*r.default.tileHeight),c.mesh.position.set(o.x,o.y,o.z+1.5*r.default.tileHeight),t.add(E),t.add(c.mesh),e.beforeRenderEvents.push(c.before_render);break;case l.default.DELAYED_ENEMY_UNIT:var f=this.meshBuilder.buildTextMesh(a.n),q=this.meshBuilder.buildDelayedUnitMesh;q.mesh.position.set(o.x,o.y,o.z+.25*r.default.tileWidth),f.mesh.position.set(o.x,o.y,o.z+1.5*r.default.tileHeight),t.add(q.mesh),t.add(f.mesh),e.beforeRenderEvents.push(q.before_render),e.beforeRenderEvents.push(f.before_render);break;case l.default.TREASURE:var y=this.meshBuilder.buildTreasureMesh;y.position.set(o.x,o.y,o.z+.15*r.default.tileHeight),t.add(y);break;case l.default.RED_GEM:var v=this.meshBuilder.buildRedGemMesh;v.mesh.position.set(o.x,o.y,o.z+r.default.tileWidth/2),t.add(v.mesh),e.beforeRenderEvents.push(v.before_render);break;case l.default.GREEN_GEM:var M=this.meshBuilder.buildGreenGemMesh;M.mesh.position.set(o.x,o.y,o.z+r.default.tileWidth/2),t.add(M.mesh),e.beforeRenderEvents.push(M.before_render);break;case l.default.BLUE_GEM:var p=this.meshBuilder.buildBlueGemMesh;p.mesh.position.set(o.x,o.y,o.z+r.default.tileWidth/2),t.add(p.mesh),e.beforeRenderEvents.push(p.before_render);break;case l.default.PURPLE_GEM:var T=this.meshBuilder.buildPurpleGemMesh;T.mesh.position.set(o.x,o.y,o.z+r.default.tileWidth/2),t.add(T.mesh),e.beforeRenderEvents.push(T.before_render);break;default:console.log("Unknown model found:",a)}if("t"in a){var g=this.meshBuilder.buildBlockedTileMesh;g.position.set(o.x,o.y,o.z),t.add(g)}}}}]),e};t.default=s},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n,r=function{function e(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}},a=i(0),l=(n=a)&&n.__esModule?n:{default:n};var o=function{function e{!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.edgeMaterial=new THREE.LineBasicMaterial({color:0}),this.blackMaterial=new THREE.MeshBasicMaterial({color:0}),this.getCameraFollowEffect=function(e){return function(t,i){var n=i.camera.position.x-e.position.x,r=i.camera.position.y-e.position.y;e.rotation.y=Math.PI/2+Math.atan2(r,n)}},this.initTiles,this.initTreasure,this.initEntity,this.initDelayedEnemy,this.initBlockedTerrain,this.initText,this.initGems}return r(e,[{key:"initTiles",value:function{this.tileGeometry=new THREE.BoxGeometry(l.default.tileWidth,l.default.tileWidth,l.default.tileHeight),this.tileMaterial=new THREE.MeshBasicMaterial({color:16777215,polygonOffset:!0,polygonOffsetFactor:1,polygonOffsetUnits:2}),this.tileEdgesGeometry=new THREE.EdgesGeometry(this.tileGeometry)}},{key:"initTreasure",value:function{var e=.3*l.default.tileWidth,t=.5*l.default.tileWidth,i=.3*l.default.tileHeight;this.treasureGeometry=new THREE.BoxGeometry(e,t,i),this.treasureMaterial=new THREE.MeshBasicMaterial({color:9858867,polygonOffset:!0,polygonOffsetFactor:1.2,polygonOffsetUnits:2}),this.treasureEdgesGeometry=new THREE.EdgesGeometry(this.treasureGeometry),this.treasureTopGeometry=new THREE.CylinderGeometry(e/2,e/2,t,8,1,!1,-Math.PI/2,Math.PI),this.treasureTopGeometry.applyMatrix((new THREE.Matrix4).makeTranslation(0,0,i/2)),this.treasureTopEdgesGeometry=new THREE.EdgesGeometry(this.treasureTopGeometry,90);var n=.2*e;this.treasureKeylockGeometry=new THREE.PlaneGeometry(n,n),this.treasureKeylockMaterial=new THREE.MeshBasicMaterial({color:16776960,polygonOffset:!0,polygonOffsetFactor:1.1,polygonOffsetUnits:2}),this.treasureKeyholeGeometry=new THREE.CircleGeometry(.01*l.default.tileWidth,16),this.treasureKeyholeMaterial=this.blackMaterial;var r=(new THREE.Matrix4).multiplyMatrices((new THREE.Matrix4).makeTranslation(-e/2,0,i/2-n/2),(new THREE.Matrix4).makeRotationY(-Math.PI/2));this.treasureKeylockGeometry.applyMatrix(r),this.treasureKeyholeGeometry.applyMatrix(r)}},{key:"initEntity",value:function{var e=.5*l.default.tileHeight;this.entityGeometry=new THREE.SphereGeometry(e,4,2),this.entityGeometry.scale(.5,.5,1),this.entityEdgesGeometry=new THREE.EdgesGeometry(this.entityGeometry),this.unitMaterial=new THREE.MeshBasicMaterial({color:65280}),this.mercMaterial=new THREE.MeshBasicMaterial({color:65535}),this.enemyMaterial=new THREE.MeshBasicMaterial({color:16711680})}},{key:"initDelayedEnemy",value:function{var e=.25*l.default.tileWidth,t=.02*l.default.tileWidth;this.clockBorderGeometry=new THREE.RingGeometry(e-.03,e,16),this.clockEnemyColor=new THREE.MeshBasicMaterial({color:16711680}),this.clockBackgroundMaterial=new THREE.MeshBasicMaterial({color:16119260,polygonOffset:!0,polygonOffsetFactor:1,polygonOffsetUnits:1}),this.clockInnerGeometry=new THREE.CircleGeometry(.1*e,16),this.clockHourGeometry=new THREE.PlaneGeometry(t,.2*l.default.tileWidth),this.clockHourGeometry.applyMatrix((new THREE.Matrix4).makeTranslation(0,this.clockHourGeometry.parameters.height/2,0)),this.clockMinuteGeometry=new THREE.PlaneGeometry(.15*l.default.tileWidth,t),this.clockMinuteGeometry.applyMatrix((new THREE.Matrix4).makeTranslation(this.clockMinuteGeometry.parameters.width/2,0,0)),this.clockBackgroundGeometry=new THREE.CircleGeometry(e,16)}},{key:"initBlockedTerrain",value:function{this.blockedGeometry=new THREE.PlaneGeometry(l.default.tileWidth,.2*l.default.tileWidth),this.blockedMaterial=new THREE.MeshBasicMaterial({color:16711680})}},{key:"initText",value:function{this.textMaterial=this.blackMaterial,this.fontData=new THREE.Font(l.default.font)}},{key:"initGems",value:function{this.redGemMaterial=new THREE.MeshBasicMaterial({color:16711680}),this.greenGemMaterial=new THREE.MeshBasicMaterial({color:65280}),this.blueGemMaterial=new THREE.MeshBasicMaterial({color:255}),this.purpleGemMaterial=new THREE.MeshBasicMaterial({color:16711935});var e=.1*l.default.tileWidth;this.gemGeometry=new THREE.SphereGeometry(e);var t=l.default.tileWidth/2-.2;this.gemRingGeometry=new THREE.RingGeometry(.2-.05,.2,8,8,-Math.PI/2,Math.PI),this.gemConeGeometry=new THREE.ConeGeometry(.1*l.default.tileWidth,t,2),this.gemBottomMaterial=this.blackMaterial,this.gemConeGeometry.applyMatrix((new THREE.Matrix4).multiply((new THREE.Matrix4).makeTranslation(t,0,0)).multiply((new THREE.Matrix4).makeRotationZ(-Math.PI/2)).multiply((new THREE.Matrix4).makeRotationY(-Math.PI/2)))}},{key:"buildTileMesh",value:function{var e=new THREE.Group;return e.add(new THREE.Mesh(this.tileGeometry,this.tileMaterial)),e.add(new THREE.LineSegments(this.tileEdgesGeometry,this.edgeMaterial)),e}},{key:"buildTreasureMesh",value:function{var e=new THREE.Group;return e.add(new THREE.Mesh(this.treasureGeometry,this.treasureMaterial)),e.add(new THREE.LineSegments(this.treasureEdgesGeometry,this.edgeMaterial)),e.add(new THREE.Mesh(this.treasureTopGeometry,this.treasureMaterial)),e.add(new THREE.LineSegments(this.treasureTopEdgesGeometry,this.edgeMaterial)),e.add(new THREE.Mesh(this.treasureKeylockGeometry,this.treasureKeylockMaterial)),e.add(new THREE.Mesh(this.treasureKeyholeGeometry,this.treasureKeyholeMaterial)),e.applyMatrix((new THREE.Matrix4).makeRotationZ(Math.PI/2)),e}},{key:"buildPlayerUnitMesh",value:function(e){return e?this.buildEntityMesh(this.mercMaterial):this.buildEntityMesh(this.unitMaterial)}},{key:"buildEnemyUnitMesh",value:function{return this.buildEntityMesh(this.enemyMaterial)}},{key:"buildEntityMesh",value:function(e){var t=new THREE.Group;return t.add(new THREE.Mesh(this.entityGeometry,e)),t.add(new THREE.LineSegments(this.entityEdgesGeometry,this.edgeMaterial)),t}},{key:"buildDelayedUnitMesh",value:function{var e=new THREE.Group;return e.add(new THREE.Mesh(this.clockBorderGeometry,this.clockEnemyColor)),e.add(new THREE.Mesh(this.clockInnerGeometry,this.clockEnemyColor)),e.add(new THREE.Mesh(this.clockHourGeometry,this.clockEnemyColor)),e.add(new THREE.Mesh(this.clockMinuteGeometry,this.clockEnemyColor)),e.add(new THREE.Mesh(this.clockMinuteGeometry,this.clockEnemyColor)),e.add(new THREE.Mesh(this.clockBackgroundGeometry,this.clockBackgroundMaterial)),e.applyMatrix((new THREE.Matrix4).makeRotationX(Math.PI/2)),{mesh:e,before_render:this.getCameraFollowEffect(e)}}},{key:"buildBlockedTileMesh",value:function{var e=new THREE.Mesh(this.blockedGeometry,this.blockedMaterial),t=new THREE.Mesh(this.blockedGeometry,this.blockedMaterial);e.rotation.set(0,0,Math.PI/4),t.rotation.set(0,0,-Math.PI/4);var i=new THREE.Group;return i.add(e),i.add(t),i}},{key:"buildRedGemMesh",value:function{return this.buildGemMesh(this.redGemMaterial)}},{key:"buildBlueGemMesh",value:function{return this.buildGemMesh(this.blueGemMaterial)}},{key:"buildGreenGemMesh",value:function{return this.buildGemMesh(this.greenGemMaterial)}},{key:"buildPurpleGemMesh",value:function{return this.buildGemMesh(this.purpleGemMaterial)}},{key:"buildGemMesh",value:function(e){var t=new THREE.Group,i=new THREE.Mesh(this.gemGeometry,e),n=new THREE.Mesh(this.gemRingGeometry,this.gemBottomMaterial),r=new THREE.Mesh(this.gemConeGeometry,this.gemBottomMaterial);return t.add(i),t.add(n),t.add(r),t.applyMatrix((new THREE.Matrix4).multiply((new THREE.Matrix4).makeRotationY(Math.PI/2)).multiply((new THREE.Matrix4).makeRotationX(Math.PI/2))),{mesh:t,before_render:this.getCameraFollowEffect(t)}}},{key:"buildTextMesh",value:function(e){void 0===e&&(e="");var t=new THREE.TextGeometry(e,{font:this.fontData,size:.2*l.default.tileWidth,height:.001*l.default.tileWidth,curveSegments:3});t.center;var i=new THREE.Mesh(t,this.textMaterial);return i.applyMatrix((new THREE.Matrix4).makeRotationX(Math.PI/2)),{mesh:i,before_render:this.getCameraFollowEffect(i)}}}]),e};t.default=o},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function{function e(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}};var r=function{function e{!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return n(e,null,[{key:"PLAYER_UNIT",get:function{return 0}},{key:"ENEMY_UNIT",get:function{return 1}},{key:"DELAYED_ENEMY_UNIT",get:function{return 2}},{key:"TREASURE",get:function{return 16}},{key:"RED_GEM",get:function{return 32}},{key:"GREEN_GEM",get:function{return 33}},{key:"BLUE_GEM",get:function{return 34}},{key:"PURPLE_GEM",get:function{return 35}}]),e};t.default=r}]);