From ff1e879955778da6ac22d7b0c41c117ed9cf90b3 Mon Sep 17 00:00:00 2001 From: Hugo Gonzalez Labrador Date: Thu, 20 Jul 2017 14:19:55 +0200 Subject: [PATCH] init --- .travis.yml | 53 + AUTHORS.md | 4 + CHANGELOG.md | 6 + COPYING | 661 ++ Makefile | 177 + README.md | 52 + appinfo/app.php | 35 + appinfo/autoload.php | 19 + appinfo/info.xml | 14 + appinfo/routes.php | 25 + controller/pagecontroller.php | 86 + css/style.css | 25 + css/vendor/JSRootInterface.min.css | 1 + css/vendor/JSRootPainter.min.css | 1 + img/app.svg | 7 + js/script.js | 183 + js/scripts/JSRoot3DPainter.js | 837 ++ js/scripts/JSRoot3DPainter.min.js | 1 + js/scripts/JSRootCore.js | 2491 +++++ js/scripts/JSRootCore.min.js | 1 + js/scripts/JSRootIOEvolution.js | 1834 ++++ js/scripts/JSRootIOEvolution.min.js | 1 + js/scripts/JSRootInterface.js | 226 + js/scripts/JSRootInterface.min.js | 1 + js/scripts/JSRootPainter.jquery.js | 983 ++ js/scripts/JSRootPainter.jquery.min.js | 1 + js/scripts/JSRootPainter.js | 9285 ++++++++++++++++++ js/scripts/JSRootPainter.min.js | 1 + js/scripts/d3.v3.min.js | 5 + js/scripts/helvetiker_bold.typeface.js | 1 + js/scripts/helvetiker_regular.typeface.js | 1 + js/scripts/jquery-ui.min.js | 13 + js/scripts/jquery.min.js | 4 + js/scripts/jquery.mousewheel.js | 221 + js/scripts/jquery.mousewheel.min.js | 8 + js/scripts/mathjax_config.js | 9 + js/scripts/rawinflate.js | 755 ++ js/scripts/rawinflate.min.js | 1 + js/scripts/three.min.js | 827 ++ js/scripts/touch-punch.min.js | 11 + phpunit.integration.xml | 7 + phpunit.xml | 7 + templates/main.php | 17 + templates/part.content.php | 10 + templates/part.navigation.php | 10 + templates/part.settings.php | 10 + tests/bootstrap.php | 13 + tests/integration/AppTest.php | 36 + tests/unit/controller/PageControllerTest.php | 48 + 49 files changed, 19025 insertions(+) create mode 100755 .travis.yml create mode 100755 AUTHORS.md create mode 100755 CHANGELOG.md create mode 100755 COPYING create mode 100755 Makefile create mode 100755 README.md create mode 100755 appinfo/app.php create mode 100755 appinfo/autoload.php create mode 100755 appinfo/info.xml create mode 100755 appinfo/routes.php create mode 100755 controller/pagecontroller.php create mode 100755 css/style.css create mode 100755 css/vendor/JSRootInterface.min.css create mode 100755 css/vendor/JSRootPainter.min.css create mode 100755 img/app.svg create mode 100755 js/script.js create mode 100755 js/scripts/JSRoot3DPainter.js create mode 100755 js/scripts/JSRoot3DPainter.min.js create mode 100755 js/scripts/JSRootCore.js create mode 100755 js/scripts/JSRootCore.min.js create mode 100755 js/scripts/JSRootIOEvolution.js create mode 100755 js/scripts/JSRootIOEvolution.min.js create mode 100755 js/scripts/JSRootInterface.js create mode 100755 js/scripts/JSRootInterface.min.js create mode 100755 js/scripts/JSRootPainter.jquery.js create mode 100755 js/scripts/JSRootPainter.jquery.min.js create mode 100755 js/scripts/JSRootPainter.js create mode 100755 js/scripts/JSRootPainter.min.js create mode 100755 js/scripts/d3.v3.min.js create mode 100755 js/scripts/helvetiker_bold.typeface.js create mode 100755 js/scripts/helvetiker_regular.typeface.js create mode 100755 js/scripts/jquery-ui.min.js create mode 100755 js/scripts/jquery.min.js create mode 100755 js/scripts/jquery.mousewheel.js create mode 100755 js/scripts/jquery.mousewheel.min.js create mode 100755 js/scripts/mathjax_config.js create mode 100755 js/scripts/rawinflate.js create mode 100755 js/scripts/rawinflate.min.js create mode 100755 js/scripts/three.min.js create mode 100755 js/scripts/touch-punch.min.js create mode 100755 phpunit.integration.xml create mode 100755 phpunit.xml create mode 100755 templates/main.php create mode 100755 templates/part.content.php create mode 100755 templates/part.navigation.php create mode 100755 templates/part.settings.php create mode 100755 tests/bootstrap.php create mode 100755 tests/integration/AppTest.php create mode 100755 tests/unit/controller/PageControllerTest.php diff --git a/.travis.yml b/.travis.yml new file mode 100755 index 0000000..13b390d --- /dev/null +++ b/.travis.yml @@ -0,0 +1,53 @@ +sudo: required +dist: trusty +language: php +php: + - 5.6 + - 7 +env: + global: + - CORE_BRANCH=stable9 + matrix: + - DB=pgsql + +matrix: + allow_failures: + - env: DB=pgsql CORE_BRANCH=master + include: + - php: 5.6 + env: DB=sqlite + - php: 5.6 + env: DB=mysql + - php: 5.6 + env: DB=pgsql CORE_BRANCH=master + fast_finish: true + +before_install: + # install firefox and enable a display for running JavaScript tests + - export DISPLAY=:99.0 + - sh -e /etc/init.d/xvfb start + - sudo apt-get update + - sudo apt-get -y install python3-setuptools firefox mariadb-server + - sudo easy_install3 requests ocdev + - nvm install 5.9 + - npm install -g npm@latest + - make + # install core + - cd ../ + - ocdev setup core --dir owncloud --branch $CORE_BRANCH --no-history + - mv rootviewer owncloud/apps/ + +before_script: + - createuser -U travis -s oc_autotest + - mysql -u root -e 'create database oc_autotest;' + - mysql -u root -e "CREATE USER 'oc_autotest'@'localhost' IDENTIFIED BY '';" + - mysql -u root -e "grant all on oc_autotest.* to 'oc_autotest'@'localhost';" + - cd owncloud + - mkdir data + - ./occ maintenance:install --database-name oc_autotest --database-user oc_autotest --admin-user admin --admin-pass admin --database $DB --database-pass='' + - ./occ app:enable rootviewer + - ocdev server & + - cd apps/rootviewer + +script: + - make test \ No newline at end of file diff --git a/AUTHORS.md b/AUTHORS.md new file mode 100755 index 0000000..2e00f93 --- /dev/null +++ b/AUTHORS.md @@ -0,0 +1,4 @@ +# Authors + +* Hugo Gonzalez Labrador (CERN): + diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100755 index 0000000..51d903b --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,6 @@ +owncloud-rootviewer (0.0.1) +* **Security**: Security description here +* **Backwards incompatible change**: Changes in the API +* **New dependency**: New dependencies such as a new ownCloud or PHP version +* **Bugfix**: Bugfix description +* **Enhancement**: New feature description \ No newline at end of file diff --git a/COPYING b/COPYING new file mode 100755 index 0000000..2def0e8 --- /dev/null +++ b/COPYING @@ -0,0 +1,661 @@ + GNU AFFERO GENERAL PUBLIC LICENSE + Version 3, 19 November 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU Affero General Public License is a free, copyleft license for +software and other kinds of works, specifically designed to ensure +cooperation with the community in the case of network server software. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +our General Public Licenses are intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + Developers that use our General Public Licenses protect your rights +with two steps: (1) assert copyright on the software, and (2) offer +you this License which gives you legal permission to copy, distribute +and/or modify the software. + + A secondary benefit of defending all users' freedom is that +improvements made in alternate versions of the program, if they +receive widespread use, become available for other developers to +incorporate. Many developers of free software are heartened and +encouraged by the resulting cooperation. However, in the case of +software used on network servers, this result may fail to come about. +The GNU General Public License permits making a modified version and +letting the public access it on a server without ever releasing its +source code to the public. + + The GNU Affero General Public License is designed specifically to +ensure that, in such cases, the modified source code becomes available +to the community. It requires the operator of a network server to +provide the source code of the modified version running there to the +users of that server. Therefore, public use of a modified version, on +a publicly accessible server, gives the public access to the source +code of the modified version. + + An older license, called the Affero General Public License and +published by Affero, was designed to accomplish similar goals. This is +a different license, not a version of the Affero GPL, but Affero has +released a new version of the Affero GPL which permits relicensing under +this license. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU Affero General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Remote Network Interaction; Use with the GNU General Public License. + + Notwithstanding any other provision of this License, if you modify the +Program, your modified version must prominently offer all users +interacting with it remotely through a computer network (if your version +supports such interaction) an opportunity to receive the Corresponding +Source of your version by providing access to the Corresponding Source +from a network server at no charge, through some standard or customary +means of facilitating copying of software. This Corresponding Source +shall include the Corresponding Source for any work covered by version 3 +of the GNU General Public License that is incorporated pursuant to the +following paragraph. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the work with which it is combined will remain governed by version +3 of the GNU General Public License. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU Affero General Public License from time to time. Such new versions +will be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU Affero General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU Affero General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU Affero General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If your software can interact with users remotely through a computer +network, you should also make sure that it provides a way for users to +get its source. For example, if your program is a web application, its +interface could display a "Source" link that leads users to an archive +of the code. There are many ways you could offer source, and different +solutions will be better for different programs; see section 13 for the +specific requirements. + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU AGPL, see +. \ No newline at end of file diff --git a/Makefile b/Makefile new file mode 100755 index 0000000..25892ed --- /dev/null +++ b/Makefile @@ -0,0 +1,177 @@ +# This file is licensed under the Affero General Public License version 3 or +# later. See the COPYING file. +# @author Bernhard Posselt +# @copyright Bernhard Posselt 2012, 2014 + +# Generic Makefile for building and packaging an ownCloud app which uses npm and +# Composer. +# +# Dependencies: +# * make +# * which +# * curl: used if phpunit and composer are not installed to fetch them from the web +# * tar: for building the archive +# * npm: for building and testing everything JS +# +# If no composer.json is in the app root directory, the Composer step +# will be skipped. The same goes for the package.json which can be located in +# the app root or the js/ directory. +# +# The npm command by launches the npm build script: +# +# npm run build +# +# The npm test command launches the npm test script: +# +# npm run test +# +# The idea behind this is to be completely testing and build tool agnostic. All +# build tools and additional package managers should be installed locally in +# your project, since this won't pollute people's global namespace. +# +# The following npm scripts in your package.json install and update the bower +# and npm dependencies and use gulp as build system (notice how everything is +# run from the node_modules folder): +# +# "scripts": { +# "test": "node node_modules/gulp-cli/bin/gulp.js karma", +# "prebuild": "npm install && node_modules/bower/bin/bower install && node_modules/bower/bin/bower update", +# "build": "node node_modules/gulp-cli/bin/gulp.js" +# }, + +app_name=$(notdir $(CURDIR)) +build_tools_directory=$(CURDIR)/build/tools +source_build_directory=$(CURDIR)/build/artifacts/source +source_package_name=$(source_build_directory)/$(app_name) +appstore_build_directory=$(CURDIR)/build/artifacts/appstore +appstore_package_name=$(appstore_build_directory)/$(app_name) +npm=$(shell which npm 2> /dev/null) +composer=$(shell which composer 2> /dev/null) + +all: build + +# Fetches the PHP and JS dependencies and compiles the JS. If no composer.json +# is present, the composer step is skipped, if no package.json or js/package.json +# is present, the npm step is skipped +.PHONY: build +build: +ifneq (,$(wildcard $(CURDIR)/composer.json)) + make composer +endif +ifneq (,$(wildcard $(CURDIR)/package.json)) + make npm +endif +ifneq (,$(wildcard $(CURDIR)/js/package.json)) + make npm +endif + +# Installs and updates the composer dependencies. If composer is not installed +# a copy is fetched from the web +.PHONY: composer +composer: +ifeq (, $(composer)) + @echo "No composer command available, downloading a copy from the web" + mkdir -p $(build_tools_directory) + curl -sS https://getcomposer.org/installer | php + mv composer.phar $(build_tools_directory) + php $(build_tools_directory)/composer.phar install --prefer-dist + php $(build_tools_directory)/composer.phar update --prefer-dist +else + composer install --prefer-dist + composer update --prefer-dist +endif + +# Installs npm dependencies +.PHONY: npm +npm: +ifeq (,$(wildcard $(CURDIR)/package.json)) + cd js && $(npm) run build +else + npm run build +endif + +# Removes the appstore build +.PHONY: clean +clean: + rm -rf ./build + +# Same as clean but also removes dependencies installed by composer, bower and +# npm +.PHONY: distclean +distclean: clean + rm -rf vendor + rm -rf node_modules + rm -rf js/vendor + rm -rf js/node_modules + +# Builds the source and appstore package +.PHONY: dist +dist: + make source + make appstore + +# Builds the source package +.PHONY: source +source: + make build + make test + rm -rf $(source_build_directory) + mkdir -p $(source_build_directory) + tar cvzf $(source_package_name).tar.gz ../$(app_name) \ + --exclude-vcs \ + --exclude="../$(app_name)/build" \ + --exclude="../$(app_name)/js/node_modules" \ + --exclude="../$(app_name)/*.log" \ + --exclude="../$(app_name)/js/*.log" \ + +# Builds the source package for the app store, ignores php and js tests +.PHONY: appstore +appstore: + make build + make test + rm -rf $(appstore_build_directory) + mkdir -p $(appstore_build_directory) + tar cvzf $(appstore_package_name).tar.gz ../$(app_name) \ + --exclude-vcs \ + --exclude="../$(app_name)/build" \ + --exclude="../$(app_name)/tests" \ + --exclude="../$(app_name)/Makefile" \ + --exclude="../$(app_name)/*.log" \ + --exclude="../$(app_name)/phpunit*xml" \ + --exclude="../$(app_name)/composer.*" \ + --exclude="../$(app_name)/js/node_modules" \ + --exclude="../$(app_name)/js/tests" \ + --exclude="../$(app_name)/js/test" \ + --exclude="../$(app_name)/js/*.log" \ + --exclude="../$(app_name)/js/package.json" \ + --exclude="../$(app_name)/js/bower.json" \ + --exclude="../$(app_name)/js/karma.*" \ + --exclude="../$(app_name)/js/protractor.*" \ + --exclude="../$(app_name)/package.json" \ + --exclude="../$(app_name)/bower.json" \ + --exclude="../$(app_name)/karma.*" \ + --exclude="../$(app_name)/protractor\.*" \ + --exclude="../$(app_name)/.*" \ + --exclude="../$(app_name)/js/.*" \ + +# Command for running JS and PHP tests. Works for package.json files in the js/ +# and root directory. If phpunit is not installed systemwide, a copy is fetched +# from the internet +.PHONY: test +test: +ifneq (,$(wildcard $(CURDIR)/js/package.json)) + cd js && $(npm) run test +endif +ifneq (,$(wildcard $(CURDIR)/package.json)) + $(npm) run test +endif +ifeq (, $(shell which phpunit 2> /dev/null)) + @echo "No phpunit command available, downloading a copy from the web" + mkdir -p $(build_tools_directory) + curl -sSL https://phar.phpunit.de/phpunit.phar -o $(build_tools_directory)/phpunit.phar + php $(build_tools_directory)/phpunit.phar -c phpunit.xml + php $(build_tools_directory)/phpunit.phar -c phpunit.integration.xml +else + phpunit -c phpunit.xml + phpunit -c phpunit.integration.xml +endif \ No newline at end of file diff --git a/README.md b/README.md new file mode 100755 index 0000000..b94e157 --- /dev/null +++ b/README.md @@ -0,0 +1,52 @@ +# Root Viewer +Place this app in **owncloud/apps/** + +## Building the app + +The app can be built by using the provided Makefile by running: + + make + +This requires the following things to be present: +* make +* which +* tar: for building the archive +* curl: used if phpunit and composer are not installed to fetch them from the web +* npm: for building and testing everything JS, only required if a package.json is placed inside the **js/** folder + +The make command will install or update Composer dependencies if a composer.json is present and also **npm run build** if a package.json is present in the **js/** folder. The npm **build** script should use local paths for build systems and package managers, so people that simply want to build the app won't need to install npm libraries globally, e.g.: + +**package.json**: +```json +"scripts": { + "test": "node node_modules/gulp-cli/bin/gulp.js karma", + "prebuild": "npm install && node_modules/bower/bin/bower install && node_modules/bower/bin/bower update", + "build": "node node_modules/gulp-cli/bin/gulp.js" +} +``` + + +## Publish to App Store + +First get an account for the [App Store](http://apps.owncloud.com/) then run: + + make appstore + +The archive is located in build/artifacts/appstore and can then be uploaded to the App Store. + +## Running tests +You can use the provided Makefile to run all tests by using: + + make test + +This will run the PHP unit and integration tests and if a package.json is present in the **js/** folder will execute **npm run test** + +Of course you can also install [PHPUnit](http://phpunit.de/getting-started.html) and use the configurations directly: + + phpunit -c phpunit.xml + +or: + + phpunit -c phpunit.integration.xml + +for integration tests \ No newline at end of file diff --git a/appinfo/app.php b/appinfo/app.php new file mode 100755 index 0000000..aeb815f --- /dev/null +++ b/appinfo/app.php @@ -0,0 +1,35 @@ + + * @copyright Hugo Gonzalez Labrador (CERN) 2017 + */ + +namespace OCA\RootViewer\AppInfo; + +use OCP\AppFramework\App; + +require_once __DIR__ . '/autoload.php'; + +$app = new App('rootviewer'); +$container = $app->getContainer(); + +\OCP\Util::addScript('rootviewer', 'script'); +\OCP\Util::addStyle('rootviewer', 'style'); + + +\OCP\Util::addStyle('rootviewer', 'style'); +\OCP\Util::addStyle('rootviewer', 'vendor/JSRootPainter.min'); +\OCP\Util::addStyle('rootviewer', 'vendor/JSRootInterface.min'); + +\OCP\Util::addscript('rootviewer', 'editor'); +\OCP\Util::addscript('rootviewer', 'scripts/JSRootCore.min'); +\OCP\Util::addscript('rootviewer', 'scripts/d3.v3.min'); +\OCP\Util::addscript('rootviewer', 'scripts/JSRootPainter.min'); +\OCP\Util::addscript('rootviewer', 'scripts/JSRootInterface.min'); +\OCP\Util::addscript('rootviewer', 'scripts/JSRootPainter.jquery.min'); +\OCP\Util::addscript('rootviewer', 'scripts/JSRootIOEvolution.min'); \ No newline at end of file diff --git a/appinfo/autoload.php b/appinfo/autoload.php new file mode 100755 index 0000000..796f216 --- /dev/null +++ b/appinfo/autoload.php @@ -0,0 +1,19 @@ + + * @copyright Hugo Gonzalez Labrador (CERN) 2017 + */ + +namespace OCA\RootViewer\AppInfo; + +use OCP\AppFramework\App; + +/** + * Additional autoloader registration, e.g. registering composer autoloaders + */ +// require_once __DIR__ . '/../vendor/autoload.php'; \ No newline at end of file diff --git a/appinfo/info.xml b/appinfo/info.xml new file mode 100755 index 0000000..dc84c87 --- /dev/null +++ b/appinfo/info.xml @@ -0,0 +1,14 @@ + + + rootviewer + Root Viewer + My first ownCloud app + AGPL + Hugo Gonzalez Labrador (CERN) + 0.0.1 + RootViewer + other + + + + \ No newline at end of file diff --git a/appinfo/routes.php b/appinfo/routes.php new file mode 100755 index 0000000..7019e2b --- /dev/null +++ b/appinfo/routes.php @@ -0,0 +1,25 @@ + + * @copyright Hugo Gonzalez Labrador (CERN) 2017 + */ + +/** + * Create your routes in here. The name is the lowercase name of the controller + * without the controller part, the stuff after the hash is the method. + * e.g. page#index -> OCA\RootViewer\Controller\PageController->index() + * + * The controller class has to be registered in the application.php file since + * it's instantiated in there + */ +return [ + 'routes' => [ + ['name' => 'page#do_load', 'url' => '/load', 'verb' => 'GET'], + ['name' => 'page#do_public_load', 'url' => '/publicload', 'verb' => 'GET'], + ] +]; \ No newline at end of file diff --git a/controller/pagecontroller.php b/controller/pagecontroller.php new file mode 100755 index 0000000..be6e0c4 --- /dev/null +++ b/controller/pagecontroller.php @@ -0,0 +1,86 @@ + + * @copyright Hugo Gonzalez Labrador (CERN) 2017 + */ + +namespace OCA\RootViewer\Controller; + +use OCP\IRequest; +use OCP\AppFramework\Http\TemplateResponse; +use OCP\AppFramework\Http\DataResponse; +use OCP\AppFramework\Controller; + +class PageController extends Controller { + + + private $userId; + private $eosUtil; + + public function __construct($AppName, IRequest $request, $UserId){ + parent::__construct($AppName, $request); + $this->userId = $UserId; + $this->eosUtil = \OC::$server->getCernBoxEosUtil(); + } + + /** + * @NoAdminRequired + * @NoCSRFRequired + */ + public function doLoad($filename) { + if(!$this->userId) { + return new DataResponse(['error' => 'user is not logged in']); + } + + list($uid, $gid) = $this->eosUtil->getUidAndGidForUsername($this->userId); + if(!$uid || !$gid) { + return new DataResponse(['error' => 'user does not have valid uid/gid']); + } + + $node = \OC::$server->getUserFolder($this->userId)->get($filename); + if(!$node) { + return new DataResponse(['error' => 'file does not exists']); + } + + $info = $node->stat(); + // TODO(labkode): check for file size limit maybe? + + $content = $node->getContent(); + echo $content; + } + + /** + * @PublicPage + * @NoCSRFRequired + */ + public function doPublicLoad($token, $filename) { + $share = \OC::$server->getShareManager()->getShareByToken($token); + if(!$share) { + return new DataResponse(['error' => 'invalid token']); + } + $owner = $share->getShareOwner(); + list($uid, $gid) = $this->eosUtil->getUidAndGidForUsername($owner); + if(!$uid || !$gid) { + return new DataResponse(['error' => 'user does not have valid uid/gid']); + } + + $node = $share->getNode(); + if($node->getType() === \OCP\Files\FileInfo::TYPE_FOLDER) { + $node = $share->getNode()->get($filename); + } + if(!$node) { + return new DataResponse(['error' => 'file does not exists']); + } + + $info = $node->stat(); + // TODO(labkode): check for file size limit maybe? + + $content = $node->getContent(); + echo $content; + } +} \ No newline at end of file diff --git a/css/style.css b/css/style.css new file mode 100755 index 0000000..77345ba --- /dev/null +++ b/css/style.css @@ -0,0 +1,25 @@ +#rootviewer-div#simpleGUI { + position: relative; + display: block; + top: 0; + left: 0; + z-index: 100; + height: 100%; + width: 100%; +} + +#rootviewer-div { + position: absolute; + display: block; + top: 0; + left: 0; + padding-top: 44px; + height: 100%; + width: 100%; + -moz-box-sizing: border-box; + box-sizing: border-box; +} +#simpleGUI_close { + float: right; + margin-right: 9px; +} diff --git a/css/vendor/JSRootInterface.min.css b/css/vendor/JSRootInterface.min.css new file mode 100755 index 0000000..eae7b77 --- /dev/null +++ b/css/vendor/JSRootInterface.min.css @@ -0,0 +1 @@ +*{padding:0;margin:0}* html,body{height:100%}body,textarea{font-family:"lucida sans",verdana,arial,helvetica,sans-serif;font-size:80%}h1{font-size:20pt}h2{font-size:18pt;font-weight:bold;color:navy}h3{font-size:16pt;font-weight:bold;color:#483d8b}h4{font-size:14pt;font-weight:bold;color:#c71585;margin-bottom:2px;margin-top:8px}h5{font-size:10pt;font-weight:bold;color:#6495ed;margin-bottom:2px}h6{font-size:10pt;font-weight:bold;color:navy}body{margin:1px}textarea{font-size:100%}p{margin-top:5px;margin-bottom:5px}#left-div{left:1px;width:300px;padding:5px;overflow:auto}#separator-div{left:305px;width:4px;border:0;position:absolute;top:1px;bottom:1px;background-color:white;cursor:ew-resize}#right-div{left:310px;right:1px;margin-left:0}#browser{font-size:70%}div.column{border:1px dotted #666;background-color:#e6e6fa;position:absolute}div.separator{background-color:white;position:absolute;border:0;margin:0;padding:0}input.tb{margin-left:8px;margin-right:8px;width:94%}.basic div{background-color:#eee}.ui-accordion-icons .ui-accordion-header a{padding-left:2.2em}.ui-accordion .ui-accordion-header .ui-icon{left:.5em;margin-top:-8px;position:absolute;top:50%}.ui-accordion .ui-accordion-content{border:1px solid #aaa;border-top:0;margin-top:-2px;margin-bottom:2px;overflow:hidden;padding:3px 0 3px 0}.ui-state-active{background:#fff;border-bottom:0;color:#3a3a3a}.ui-accordion-content-active{background-color:#fff}button.closeButton{margin-top:-3px;margin-right:-2px;float:right}.ui-icon-close{float:left;margin:.4em .2em 0 0;cursor:pointer} diff --git a/css/vendor/JSRootPainter.min.css b/css/vendor/JSRootPainter.min.css new file mode 100755 index 0000000..2a42b72 --- /dev/null +++ b/css/vendor/JSRootPainter.min.css @@ -0,0 +1 @@ +.h_tree{display:block;white-space:nowrap}.h_tree img{border:0;vertical-align:middle}.h_tree a{font-family:Verdana,Geneva,Arial,Helvetica,sans-serif;font-size:11px;white-space:nowrap;text-decoration:none;vertical-align:top;white-space:nowrap;padding:1px 2px 1px 2px}.h_item{cursor:pointer}.h_item:hover{text-decoration:underline}.h_childs{overflow:hidden;display:block}.img_minus{display:inline-block;height:18px;width:18px;background-image:url("data:image/gif;base64,R0lGODlhEgASAJEDAIKCgoCAgAAAAP///yH5BAEAAAMALAAAAAASABIAAAInnD+By+2rnpyhWvsizE0zf4CIIpRlgiqaiDosa7zZdU22A9y6u98FADs=")}.img_minusbottom{display:inline-block;height:18px;width:18px;background-image:url("data:image/gif;base64,R0lGODlhEgASAJECAICAgAAAAP///wAAACH5BAEAAAIALAAAAAASABIAAAImlC+Ay+2rnpygWvsizE0zf4CIEpRlgiqaiDosa7zZdU32jed6XgAAOw==")}.img_plus{display:inline-block;height:18px;width:18px;background-image:url("data:image/gif;base64,R0lGODlhEgASAJECAICAgAAAAP///wAAACH5BAEAAAIALAAAAAASABIAAAIqlC+Ay+2rnpygWvsizCcczWieAW7BeSaqookfZ4yqU5LZdU06vfe8rysAADs=")}.img_plusbottom{display:inline-block;height:18px;width:18px;background-image:url("data:image/gif;base64,R0lGODlhEgASAJECAICAgAAAAP///wAAACH5BAEAAAIALAAAAAASABIAAAIplC+Ay+2rnpygWvsizCcczWieAW7BeSaqookfZ4yqU5LZdU36zvd+XwAAOw==")}.img_empty{display:inline-block;height:18px;width:18px;background-image:url("data:image/gif;base64,R0lGODlhEgASAJEAAAAAAP///4CAgP///yH5BAEAAAMALAAAAAASABIAAAIPnI+py+0Po5y02ouz3pwXADs=")}.img_line{display:inline-block;height:18px;width:18px;background-image:url("data:image/gif;base64,R0lGODlhEgASAIABAICAgP///yH5BAEAAAEALAAAAAASABIAAAIZjB+Ay+2rnpwo0uss3kfz7X1XKE5k+ZxoAQA7")}.img_join{display:inline-block;height:18px;width:18px;background-image:url("data:image/gif;base64,R0lGODlhEgASAIABAICAgP///yH5BAEAAAEALAAAAAASABIAAAIcjB+Ay+2rnpwo0uss3kf5BGocNJZiSZ2opK5BAQA7")}.img_joinbottom{display:inline-block;height:18px;width:18px;background-image:url("data:image/gif;base64,R0lGODlhEgASAIABAICAgP///yH5BAEAAAEALAAAAAASABIAAAIZjB+Ay+2rnpwo0uss3kf5BGrcSJbmiaZGAQA7")}.img_base{display:inline-block;height:18px;width:18px;background-image:url("data:image/gif;base64,R0lGODlhEwASAPcAAPv6/Pn4+mnN/4zf/764x2vO//Dv84HZ/5jl/0ZGmfTz9vLy8lHB/+zr70u+/7S03IODtd7d6c/P0ndqiq/w/4Pb/5SKo/Py9fPy9tTU121kjd/f4MzM062tx5+zy5rO67GwxNDM14d8mJzn/7awwry713zX/9bW27u71lFRmW5uoZ+fxjOy/zm1/9HQ2o3g/2xfgZeMplav7sn9/6Cgv37X/6Dp/3jU/2uJ2M7J1JC63vn5+v38/d7e38PD0Z7o/9LR4LS01cPDzPb1+Nzb5IJ2lHCEv5bk/53C3MrJ3X56t+np6YF7o3JsndTU5Wtgh5GHoKaesuLi4mrO/19RdnnV/4WBqF5QdWPK/4+PvW5uu4+PuuHh4q7w/97e68C9z63w/9PT0+zs7FtbmWVXerS0yaqitpuSqWVlpcL6/8jD0H/C9mVajqWu3nFwpYqHtFfE/42DnaWl0bTz/5OPt+7u7tra5Y+Yz+Tk56fM6Gek5pG50LGpvOHh72LJ/9XU5lbD/6GnwHpujfDu8mxpntzb45qav7PH41+n6JeXyUZGopyYsWeGyDu2/6LQ44re/1yV41TD/8LC1zix/sS/zdTU4Y+gsd/c5L7z+a6uzE+3+XG89L6+087O1sTD3K2twoGBtWVbgomo4P///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAAKMALAAAAAATABIAAAjtAEcJFLgDTyE7SVCsAAJgoMNRYTII8fEpkAckOpiEaPhwlARLexxhmpEGzJEmBAJ0HMXhw6MfXeZQsDHADZ8hK13kMTEAwQgEL2oYiaJgJZFDU24cqHCgSgFGFgysBJAJkB8BBQRggQNJxKCVo0rIcMAgEgMHmnBMaADWEyIWLRptEqWETRG2K//ombSmjRZFoaCo4djRyZ0HchIlSECIRNGVXur0WcAlCJoUoOhcAltpyQIxPSRtGQPhjRkMKyN0krLhBCcaKrJoOCO1I48vi0CU6WDIyhNBKcEGyBEDBpUrZOJQugC2ufPnDwMCADs=")}.img_folder{display:inline-block;height:18px;width:18px;background-image:url("data:image/gif;base64,R0lGODlhEgASANUAAPv7++/v79u3UsyZNOTk5MHBwaNxC8KPKre3t55sBrqHIpxqBMmWMb2KJbOBG5lnAdu3cbWCHaBuCMuYM///urB+GMWSLad1D8eUL6ampqVzDbeEH6t5E8iVMMCNKMbGxq58FppoAqh2EKx6FP/Ub//4k+vr6///nP/bdf/kf//viba2tv//////mQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAAC4ALAAAAAASABIAAAaRQJdwSCwaj8ik0jUYTBidAEA5YFkplANhehxABGAwpKHYRByVwHBibbvbo8+Q0TrZ7/jWBTHEtP6AgX8GK0MWLSWJiostEoVCBy0qk5SVLQmPLh4tKZ2eny0LmQ0tKKanqC0hmQotJK+wsS0PfEIBZxUgHCIaBhIJCw8ZBUMABAUrycrLBQREAAEm0tPUUktKQQA7")}.img_folderopen{display:inline-block;height:18px;width:18px;background-image:url("data:image/gif;base64,R0lGODlhEgASANUAAO/v76VzDfv7+8yZNMHBweTk5JpoAqBuCMuYM8mWMZ5sBpxqBPr7/Le3t///pcaaGvDker2KJc+iJqd1D7B+GOKzQ8KPKqJwCrOBG7WCHbeEH9e4QNq/bP/rhJlnAffwiaampuLBUMmgIf3VcKRyDP/XhLqHIqNxC8iVMMbGxqx6FP/kf//bdf/vievr67a2tv/4k8aaGf//nP//mf///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAADUALAAAAAASABIAAAaVwJpwSCwaj8ikUjgYIBIogEA5oFkZDEtheqzKvl9axKTJYCiAIYIGblutqtQwQYPZ73jZpCGM+f+AfiEdJy99M21tMxwxJQeGNTGIeHcyHzEjCpAAki2en54OIhULkAKSMiuqqysOGxIGkDWcMyy2t7YQDx58QqcBwMAkFwcKCwYgBEQFBC/Oz9AEBUUALtbX2FJLSUEAOw==")}.img_page{display:inline-block;height:18px;width:18px;background-image:url("data:image/gif;base64,R0lGODlhEgASAOYAAPv7++/v7/j7/+32/8HBweTk5P39/djr/8Df//7///P5/8Ph//T09fn5+YGVw2t0pc7n/15hkFWn7ZOq0nqDsMDA/9nh7YSbyoqo2eTx/5G46pK873N+sPX6//f395Cjy83m/7rd/9jl9m13qGVqmoeh0n+OvI+z5Yyu387T//b6/2dtnvz9/32JtpS/8sbGxv7+/tvn92lwom96rHJ8rnSAsoep3NHp/8nk/7e3t+vr67a2tun1/3V4o+Hw/9vt/////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAAEEALAAAAAASABIAAAejgEGCg4SFhoeILjaLjDY1AQCHG0AGAA0eDBY1E5CGGjBAoQkCMTUSHwGGJwaiAh0iNbEvhiihAgIDPDwpFRw5hhgsuLk8Pz8HNL+FJSoKuT4+xzczyoQXzjzQxjcgI9WDDrraPzc4OA/fgibZ0eTmCzLpQS0Z7TflCwgr8hT2EOYIQpCQ16OgwYMRCBgqQGCHw4cOCRQwBCCAjosYL3ZCxNFQIAA7")}.img_remove{display:inline-block;height:16px;width:16px;background-image:url("data:image/gif;base64,R0lGODlhEAAQAN0AAMMZALwUAMkfANYqANAkAPfu7v339pAOCN0wAKEHAJorJ+A9EJ0uJ7QOALYOAK8SAMYlAKoMAMEgAKk5J/bWzvva0dmtrdqurf749v/49vnv7vrw7u97WbxOO7NMRJkwLrRHNONoSudsStBXStVbSv///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAACUALAAAAAAQABAAAAZnwJJwSCwaj8jk0fIpCAsfy/FySCgKBUXicDF6Go4IgxFxNDxGwygQeDzYI8PRQALYAST5UdMR+AUdGkcbExIEhwQSExtGIBADAyEhkBAgRhQLCCIYGCIICxRHFRwZQhkcFUqqq6xGQQA7")}.img_question{display:inline-block;height:18px;width:18px;background-image:url("data:image/gif;base64,R0lGODlhEgASAPelAOP0//7//9bs//n///j//9Ls/8Pn//r//6rB1t3f5crO2N7g5k1livT4+7PW9dXt/+v4/+Xl5LHW9Ov6/+j1/6CyxrfCz9rd5Nzj6un1/Z6ouwcvj8HBzO7+/+3//+Ln7BUuXNHv/6K4y+/9/wEBZvX08snn/19qhufs8fP7/87n/+/t7czr/5q1yk55q97v/3Cfztnu//z//+X6/ypIdMHY7rPc/7fX9cbl/9/h52WHr2yKrd/0/9fw/4KTs9rm75Svzb2+ya690pu92mWJrcT3//H//+Dv/Xym35S216Ouwsvt/3N/mMnZ5gEBcMnq/wEBXs/o/wEBetzw/zdYpTdZpsvP2ClGml2N3b3H0Nzu/2Z2lF1ricrl/93w/97h6JqluktojM/u/+/z9g8pVff4+ebu9q+1xa6/zzdFaIiXr5Wyz0xslrTK4uL//2uIp11rh8Xj/NXn+Oz2/9bf6bG2xAEBePP//1xwkK/K5Nbr/8fp/2OBtG53kai3ykVCYwEBde/6/7O4xabI+fD//+by/x8+jDhZpM/q/6jK58nO19ny/7jV7ZO42NHr/9H4/2ZwimSV6VBxwMDX7Nvf5hYwX5m20sfb6Ieqyk9Yjr/k/cPM2NDp/+/098Tl9yQ9jLfW+Mne8sjU30JklP///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAAKUALAAAAAASABIAAAjxAEsJHEiwoMEyGMaQWthg0xeDAlGUWKjoz5mFAegY/LBiIalMUK54JCWEoJkIpA6kSDmoAykKgRaqGSiq04A5A5r4AKOEAAAtE2S0USAwSwYIhUb8METiUwAvemLMCMVEoIUjAF5MIYXAThUCDzgVWDQJjkA0cngIEHAHCCAqRqJ0QeQoDxeBFS71KKDCwxonhwiZwPEkzo4+AimJqBFCjBs+UjZ4WmLgxhAQVgb6acGIBShJkbAgMSAhCQ1IBTW8sZRI055HDhoRqXQCYo4tDMJgsqGDTJo6EAlyYFNkVJDgBgXBcJEAucEFeC44n04wIAA7")}.img_histo1d{display:inline-block;height:16px;width:16px;background-image:url("data:image/gif;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAADAFBMVEW9vb2np6empqanpqenpqivr6//AAD3+fn09vb19vf3+Pv8+v//+//29/v3+fr19vbZ3Nza3d7X0+Lb3t7b3N3AwMP2+PimpqXe4+Th6uvQ0dTi6uzg5ebFx8nt6vb////r5/T2+fnl4e3a3uDN0NT7/P6lpqX3+vvn9vhcVVHu+//W1uH48//29P///f+mpqelpqb4/v/t/f9oY2H6///59v/x8fXw9fny9/78/v+lpqf7//9iXl12dHPW2t/R1tdtaGbT2dpoZmT6/v9ycnKCgoJpZGJ6dnT3///2///0//95entpa2t+gIKLjI55d3aDgYBvcXL1+/z9/v6lpaWGiIt7fH6Ji42SlJeEhIZubGyMjI17fYD+//+kpKSmpaaRk5WIioyRk5aYmp2OkJJ+f4KTlZilpKWcnqGVl5qcnqCfoaOYmp6PkZOdn6GsrrGoqq6qrK+rrbGpq66lp6uqrbCoqq20tLSsrKzc3NzMzMzPz88AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAB6enrU4/9iYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmLU4/9KSkoAAAAAAAAAAAB6enrU4//m5uZiYmLm5uZiYmLm5uZiYmLm5uZiYmLm5ubU4/9KSkoAAAAAAAAAAAB6enrU4/9KSkpKSkpKSkpKSkpKSkpKSkpKSkpKSkpKSkrU4/9KSkoAAAAAAAAAAABubm7U4//U4//U4//U4//U4//U4//U4//U4//U4//U4//U4/9KSkoAAAAAAAAAAABubm5KSkpKSkpKSkpKSkpKSkpKSkpKSkpKSkpKSkpKSkpKSkpKSkoAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABt6dBwBYjWHVG2AAAAB3RSTlP///////8AGksDRgAAAAlwSFlzAAALEgAACxIB0t1+/AAAAOxJREFUeNpjYGBkggBmFmYmRlY2BkZ2DhDg5OLm4eblY2RjYOIXEBQSFhEFkgKCYkxsDOKcEpJS0jKycvJS8gpcIAFFJWUVGFIFCqipa8hrymtpy+sI6crr6bMxGBgayRvLm8iamkmZW1gCBayslWxs7ewd7OwdlZStrYC2ODm7uLrJu3t4usl7mRiwMeh7+/j6+VsHBMr7+wQFhwAFQsPCIyKjomOiIsOiYuPYGOITEpOSU1LTElNTElPlgQLpGZlZ2Tm5eZm5OZm5IAGm/ILCouKS0rKS4oISeaDDypniEICpgo2hsgoZVLMBAHIaNxuoIXy2AAAAAElFTkSuQmCC")}.img_histo2d{display:inline-block;height:16px;width:16px;background-image:url("data:image/gif;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAACXBIWXMAAAsSAAALEgHS3X78AAABUUlEQVR42o1R0U7CQBDkU/w/v8qk1/OhCS+88miMiQYMBMNRTqiisQiRhF6h13adsuVKDEYvm81kdmdv9q7V7XallP65I30UrpErLGW73SaiFtDF5dXWmNNITJrubJ4RWUI2qU33GTorAdSJMeMwhOxpEE20noRTYISaajBcMrsdOlkgME+/vILtPw6j+BPg5vZuFRuUgZGX71tc2AjALuYrpWcP/WE1+ADAADMAY/OyFghfpJnlSTCAvLb1YDbJmArC5izwQa0K4g5EdgSbTQKTX8keOC8bgXSWAEbqmbs5BmPF3iyR8I+vdNrhIj3ewzdnlaBeWroCDHBZxWtm9DzaEyU2L8pSCNEI+N76+fVs8rE8fbeRUiWR53kHgWgs6cXbD2OOIScQnji7g7OE2UVZNILflnbrulx/XKfTAfL+OugJgqAShGF4/7/T6/Ug+AYZrx7y3UV8agAAAABJRU5ErkJggg==")}.img_histo3d{display:inline-block;height:16px;width:16px;background-image:url("data:image/gif;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAADAFBMVEX////48OjIgTrHfjjKgTr78+yixH9HiQBHiACiw37jvJXfpVP6wzT7zTn7yj3lp1qOhyJzvgCa3wCa3gB2ugBinQ6Pt2D4+vfOjEr96p3986z83mT99rD99a3WhEvC0kaU3gCV3ADG71zo/KORzw1gowBonS3Z5snHfTb6uyD6tzD+/Nb7z0/70D3KdTXI1l3h+qTi+KXD7luU3ACY3gCc4QCi3g1QjwXHfjr710T6xi/+9sn70UH73E/MdDqhvQCi1BKkug2XxACU1wCS2ADD51rr9aJXkw/MpYDgpkb71U7+9MP7007hnEO3niOj0hGq3SCZtQCbtQCjtwj//+7F4Vui0wBDhgDk5eTMxcGxfi3TfTq+fyPPz4ak3xux5TG87kmZuwCZvACWtgDf8a+c0gCy3yNLiwD7/Ps1iwCiyAPF3F7j7bG67EW77kmq5yWYzwCZwwCTugDc8KTE51ve9YZCigCgwgCVuQDa5p7U9YSq4yWT2gCV2wCT2wCp2h/y+9HC6lW87DlChQBGigCixgCYvgDK3nyXvgC72UjG7mSj3xXL7XDK7W7b9J+36TrG9lBDhQBHigClywCbxQDJ33SXvwCYvQCcwADq+8S77Ei460Hd+KDD9VHU/2VEhgBdlR1rowCXwwDK4W6bxgCaxQCVvQDp/L+/8k7F91fn/6zC9V18tiNbkx/U1dSyv6RglihnoQCYwwChyQDs/7/P/2fE92F5tCBdkib19vXW1taoupVLiwNooQCWwADo/7h5tSBFhgaouZXx8vHOz86ftYVJiQBNjQKetIXt7u3Nzs0AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABBfAAAAAAAAAA2tmA2tmAAACQAAAAAAAAAAAAAAAAAAAAAATgAABNBfMAAAAAAAAA2tpQ2tpQAACQAAAAAAAAAAAAAAAAAAAAAAdQAABNBfMAAAAAAAAA2tsg2tsgAACQAAAAAAAAAAAAAAAAAAAAAAggAABNBfMCaVmCSAAAAAXRSTlMAQObYZgAAAAlwSFlzAAALEgAACxIB0t1+/AAAAQVJREFUeNpjYGBkYmZhZWBj5+BkAAMubh5ePn4BQSFhEVExcaCAhKSUtIysnLyCopKyiqqaOoOGppa2jq6evoGhkbGJqZk5g4WllbWNrZ29g6OTs4urmzuDh6eXt4+vn39AYFBwSGhYOENEZFR0TGxcfEJiUnJKalo6A0NGZlZ2Tm5efkFhUXFJqTnQnrLyisqq6prauvqGxqZmoEBLa1t7R2dXd09vX/+EiUCBSZOnTJ02fcbMWbPnzJ03HyiwYOGixUuWLlu+YuWq1WvWAgXWrd+wcdPmTVu2btu+Y/06kHd27tq9Z+++/QcOHtq1E+JBhsNHjh47fuLIYQYEOHnq1EkwAwCuO1brXBOTOwAAAABJRU5ErkJggg==")}.img_graph{display:inline-block;height:16px;width:16px;background-image:url("data:image/gif;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAADAFBMVEW9vb2np6empqanpqenpqivr68AAAD3+fn09vb19vf3+Pv8+v//+//29/v3+fr19vbZ3Nza3d6/wcLb3t7b3N3AwMPi4et2oz0yfwDh3+n2+PimpqXe4+Th6uvD0NHi6uzg5ebFx8nt6vY2ggDs/881gQDr5/T2+fnFz9DDZVrAIhDEZVvJ0tTN0NTX0+IvZAA4hAAuYgDT0N77/P6lpqX3+vvn9vi/JRL81cHBJhTu+//W1uEkXgD48//29P8fWwD//f+mpqelpqb4/v/t/f+yCwDBKBi3CgD6//8kYAD59v/x8fXQ0dTw9fny9/78/v+lpqf7//+wAADV5ezZ5e7g6PQjZQDf4+/W2t/R1tfT2drT3+OvAAD9///6/v/////k4vIiXwC1AAD3///2///X6Oz0//9+rUgzfwAwdADa6u6xCwDAJxb5///1+/z9/v6lpaUwfADo/8vl4e3a3uDb6eu+IxL808C+IhDZ5+nW2tr+//+kpKSmpaaArUgvewB1oj39/v/e5ebVd227HgvJa2H8///6/PylpKXn4+ze4eLg5+j9/v20tLSsrKzc3NzMzMzPz88AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAPAAAAAAEAAAEAAABzL1z/CSMAAAAAAAAAAAAAAAMAAAAmCTsAAAAAAAAAAAAAAAAAAAQAAQEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA7op0gAAAAB3RSTlP///////8AGksDRgAAAAlwSFlzAAALEgAACxIB0t1+/AAAAOhJREFUeNpjYGBkggBmFmYmRlY2BkZ2DhDg5OLm4eblY2RjYOIXEBQSFhEVE5cQl5RiYmOQ5pSRlZNXUFRSVlFV4wIJqGtoamnr6OrpGxgaGQMFTEzNzC0sraxtbPXs7B0c2RicnF1c3dw9PL28fXz9/IECAYFBwSGhYeERkVHRMYEBQFti4+ITEuOTklNSg9I8nNgYHOPTMzLjA7Oyc7Jz8/ILQAKFRRnFJaVl5RWVVdU1bAy18XX1DfGNTc0trW3t8UCBjvj4+M746q74+O7qHpAAUzwyADqsl6kGAZj62Bj6JyCDiWwAyPNF46u5fYIAAAAASUVORK5CYII=")}.img_tree{display:inline-block;height:16px;width:16px;background-image:url("data:image/gif;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAABIAAAASABGyWs+AAAACXZwQWcAAAAQAAAAEABcxq3DAAACjklEQVQ4y4WTy49LcRzFP+2tzmVUr9dIDJOWGGVBicgEyTQTCzIetUFssDKJSFhY2SARCYvBbGrj8QcIkYglk8xCmEQ9xqNexbQVY2Zub3un9/W7PwstHZH4Jie/7+Kc8/suzgnwr+kjBqSBbm2lkm6bHyH3XM9SZQ8Z8s3UQJPo0IJVof5EZ7v2faxMrKONlhmQWN5GSFEwLbhybjBPhDwVsmQ4AaA09Mou+k8d702EAzXiS6KEgzahoIthGOi6DtKlN71GS+/cEPs0WewaX2R9ZphssP776UhESY0WSpQNg7Jh4Anx+zgJVKpV3uZyvHjzir27NwGs/XVBH8c7N2nnjx7eSqlYxPM8JCCkxBU+rhA4dVhCYJgmyc4Ej96/7rLi8nNAPc/k2ZNp7cnTpziuiy8lvpSI+tvYhS/xpY8vJXMiEbZv3MzFq3cJqaqiPX72jnKt9kfQRPZ9f5qZ70sMawyAas1GseIy1rNtVXK8Mkm1VsP2PBzhYQuB5Qns+t6AJQSqqlIcrTAy+ONGENBWLF3MN71MxXGo1mE6DqbrYLou8z/a7L3uMKvgUnU8xk2T3u71ADGFDdgvCx/3TwkLEfKxhWDHbY+eYZ+Obz6tJcmRApRsuJ8Ex4Po7Jl8/TDBl7flm4Gm5F1vSZKaFQUh4cB9OLgaDB3UVrjwA+6tBnKAis4El8lwujmJSVQeoKAxFzqDcG0KWhZC6R30tUJRQD3Odxqy4G+DDFks4pisY5RLgRx5pZ5T4cKy95yhSrxZDBCaVqIMOpAd2EIeSEW7wLQh3Ar7RtCHbk0v0vQy1WdgCymgf147Sa0dhAOVMZgoALDu2BDZ/xloQAzQgIOhMCnPYQ+gHRvi4d/8n00kYDRVLifLAAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDEwLTAyLTExVDE0OjUxOjE3LTA2OjAwHh/NoQAAACV0RVh0ZGF0ZTptb2RpZnkAMjAwNC0wOS0yMFQxNzoxMDoyNi0wNTowMCcJijsAAAAASUVORK5CYII=")}.img_branch{display:inline-block;height:16px;width:16px;background-image:url("data:image/gif;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAADAFBMVEX///99plFAfADL27hpmyfP8YxyoilSiRiv0XGGygK02VtRiBmVwjh8xQCcziFZkhLz9+9BfQB2rwaCyACRygFQigXw9Ox0mkpXkQCJzwBblgBmkzP8/fxEgQBCfwBEgQejwITe3t5hkC1CfgBfjynZ2tmSq3eArDu72oNvoDJajyTY2dhFgQDCzLqhvn9EgAazx55XkwCVzC2824GMs1J0oUTY48xajiK72YR9qj2Tq3dhkix+th99xAB3uADA3oQ+fABEgABIgwW82oOUyi5VkgCf0CaEygB+wwCbzjN1mkrA3YZ1tAB7wAB+uB1vl0JdmgCJwwCKzwBoqAB4nVBikiuayzZ8wQCFywCg0Sjd3t1lkjFBfABLgwhKgwlmpgCK0QCJxQBclwDMzMzPz89GggCDpFxDfgCIpmPl5eUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABhAABQEABuZQBjYQBvcgAIZABiYQBlZAAABQDU/wCx/wCO/wBr/wBI/wAl/wAA/wAA3AAAuQAAlgAAcwAAUADU/wCx/wCO/wBr/wBI/wAl/wAA/gAA3AAAuQAAlgAAcwAAUADj/wDH/wCr/wCP/wBz/wBX/wBV/wBJ3AA9uQAxlgAlcwAZUADw/wDi/wDU/wDG/wC4/wCq/wCq/wCS3AB6uQBilgBKcwAyUAD//wD//wD//wD//wD//wD//wD+/gDc3AC5uQCWlgBzcwBQUAD/8AD/4gD/1AD/xgD/uAD/qgD/qgDckgC5egCWYgBzSgBQMgD/4wD/xwD/qwD/jwD/cwD/VwD/VQDcSQC5PQCWMQBzJQBQGQD/1AD/sQD/jgD/awD/SAD/JQD+AADcAAC5AACWAABzAABQAAD/1AD/sQD/jgD/awD/SAD/JQD/AADcAACwULzWAAAAAXRSTlMAQObYZgAAAAlwSFlzAAALEgAACxIB0t1+/AAAALZJREFUeNpjYAADRiZGBmTAzMLKxowswM7BycWNLMDEw8vHL4AkICgkLCIqhiQgLiEpJS0D5cjKySsoKimrqMJk1dQ1NLW0dXQZ9PTlZEECBoZGxiamOmbmmhaWViABaxtbO3sHRycTZxdXA7ANbu4enkxeDt4+vn7WIAH/gMCg4JBQprDwiEhBkEBUtGBMrI5OXHxCYpI/2BrV5OSU5NS09BjB6CiE01JTM5KTVZHcmpycCWEAANfrHJleKislAAAAAElFTkSuQmCC")}.img_leaf{display:inline-block;height:16px;width:16px;background-image:url("data:image/gif;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAADAFBMVEX////M27mQs2tilDA9eQA7egBbkhVTjAxJgwWBqVdGgQBrnySdxViu0WrE4oaYv2PC35NtoCqxvaSevX5FgAB7qje73nDK6neu109vpyVupCGo2kJ9xwBQhBtilC9pnx7G63PM6olgnAB/vQBDigCVv0yb1CaDzAB8uBJwmkNnnBnB52ui2Ca94WZopAE/hgCtz2ue2CmDywCByACKujtdjyqdvHpdlhLV9YdkowCFxwCw1lFXmAJvpC5jng1coABlpwBprAB8sitAfABDfgKx31Gr3TuCsi5sqABtqgBUkxTV85zL7I213mef0j+OxyKk00k/ewCp3TCSyhCw0mRRjQC23HmU0h55wQB5vQB4uQB1tgCIwBeJxgCBvQDC3ndCjACYx1204Fx6wwB7vQB1tABzsQBBfQBpkzdtpQB9tQA/iQCMu1SMukNUlQBYmQBsqAd4rh11rwZyrQBvqgBDfwCqvZVWkQBUnACp0Hq/43K733C+4X+w12eZyT2IvSN5sgpZkwBxmUSDqFlbnACJzQy742p/wwB2ugBysgBwrwBvqwBwqQBhmgBCfwDV2NN8pk1foACO1QBZmABRkABpqwB3uQB0sgB0rgBnogBUjgC7w7NymkFdnQBUhxmis41okjdCfgBGgQWHpWPMzMzb3NtumD5NhQzT09Pv8O/a2trOz87l5eXc3NzPz88AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABtHAA4HXQAAEgAAB9CTigAAABCfCQ4HTxy6Kw4HXRy+8xy+8wAAMwAAAAAAAAAAAAAAAAAAAAAAAgAAAgAABgYAAG7AAAAACgAAAgAAAgYAAEAAAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4Hnw4HnwAAFRpRiYmO2V0aWRtSSY7ZWdsZVNpdGNBO251amRGO3R0bCYmO3J3ZWlvVCY7c2xuaVc7d28ABCwBG8q3AAAAAXRSTlMAQObYZgAAAAlwSFlzAAALEgAACxIB0t1+/AAAAOtJREFUeNpjYIACRiZmFlY2dg4ol5OLm4eXj19AUAjMFRYRFROXkJSSlpEF8+XkFRSVlFVU1dQ1NMF8LW0dXT19A0MjYxNTIN/M3MLSytrG1s7ewdHJGSjg4urm7uHp5e3j6+cfABIIDAoOCVUJC4+IjIqOAQk4x8bFJyQmJadEpaalpQMFMjKzsnNy8/ILCouKS0qBAmXlFZVV1TW1dfUNJY1NQIHmlta29o7ozq7unt6+fgaGCRMnTZ4ydVrU9BkzZ5XOBiqYM3HuvPkL0tPTFy5avATkzqXLlq9YuWoJEKxeA/Ho2nUMyAAA9OtDOfv2TiUAAAAASUVORK5CYII=")}.img_globe{display:inline-block;height:19px;width:18px;background-image:url("data:image/gif;base64,R0lGODlhEwASAPcAAPr7/AFyAQFCpwGD6jy3/wE9on7N0AE+pAFjyMLI0AE2mwF94wGP9QFpzgU3nISSopWgrmJsfTNLfgFHqAFuBilNiTp4sLnGzwWb/0xYb/P09mRygGl0hRlnMgR12V2Pr6e4xF9peS2Cyh5FpBdSfgF84YmisdPa30hjvw+foQFYvlWj4HWIlkWb5gk5n/b4+gw+kgFMscXb6ylmieDj5ju2pylTsniElgqd/u/x8wGW/O7v8SVMsUq+JSSJXQFiwfv+/AFqvB9ntobZeKbc/9vt+B+YmW2rvKruzQGPkm3PPrjmxQFIklrFLVbD4QGMYaXkoIPD13LC+nGw5AGFQHG66gF2eBaJxket9sLf84HI+wF7axBdbg2c0CR+1QFsEIfJ7yqoUIbH41tldgF+KzVTjn3QfitZgTJZkaDR8gKDsXeWrE+zogE3nCeKzQFtJ0tknjdnbQGB6EJgxQFqAcLJ0WC//yKm/wE+o7vI0ARozEOz/4/g/4KToyaX4/D09pCpuNHV24HA6gw7oAF/AXWKnEVSb5TI6VzDTrPprxBQts7e6FNdcBA9oySd9RRjPAhnD2NvgIydrF+6wdLo9v7//2K+twKSdDmKyeD56wGCyHq12VnF+ZXXsARdTjZWthShoo7gtilDlAFw1RCXvF+z6p/R8kqZzAF0Oj5jjFuJqgFoAkRgxtzr9YmcrJKsugFlylfBgxJGhjJIeFnFuhmi/+bo65ipt8Hn+UhVco7B5SZowAGBKoaZqAGGAVHBUwF8Qq7Y819qe4DEoVyYwrnb8QGN9GCy6QFTuHB9jgGY/gFRtuTu9ZOhr150iwFbwTFiwFus4h9mYt/y+kWZ35vM7hGfccz43Xy/6m3BuS1GiYveqDRfwnbUV4rdu////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAAN8ALAAAAAATABIAAAj/AL8JHEiwVTVspar8ITiwiJhswyaBibJJUq9Trxh+S2OAVihvSzqRcoTpmy5ADIPFqrHtGpBETbrIuXJEBgiGbHoogTItExJOoAbw8rHmAkFTC8KYwTWkGx8COp4AozAjD8Epo4wQQfTLCQEcxqigoiONBUFqerRYspYCgzIGmgi98cRlA8EVLaR4UJPk0oASVgKs6kAiBMFDdrzAarDFF5kgCJA9ilNBGMFjWAQse/YjwBcVMfCcgTMr2UBKe0QIaHNgAiQmBRS4+CSKEYSBWe44E6JoEAxZDhrxmDPCEAcaA4vVinTCwi5uKFhBs6EtQ4QEOQYy8+NGUDRiqdCUJJGQa8yNQDsADHyxSNUHE4Vc3erzoFkdWxoAVNLIv7///98EBAA7")}.img_canvas{display:inline-block;height:16px;width:16px;background-image:url("data:image/gif;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAADAFBMVEX/AAC1t7etsLCsrq6rrq6rrq2tr6+0tratsK/////p6enIysrl5OTn5uXo5+ajpaXo5+dhhKdliKlmialgg6elp6f6+/vIycnr7Ozw7u7x7u7x7u3t6+vLzMvp7vbs7/bz8PD17+3z7u2rrq/6xS76xy13zv9+z/+EwLF4zP/38/NfgqWAoL36uCj6vCmR2f+TxamSrBmNvoj++fz8+Pf69/WZ3f+g4P+n4/+Cnw2Dox16nQ3//f9hg6eBob6x5/+46f+77P+p2NKSZhOi1s////7//fusrq98sB6CsyWDtSmFuC9+dBl/tilfgqasr6+sr7DbAADcAABcgqWAoLyusLC4urqssLCssLGrsLCrr7Ctr67c3NzMzMwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABoAAAKAgJldmV0dU8GB3JvTnZDBWVyb2xsYwdjYWxhUBB0bmVrY2F1b3IICGRPYmFyZWQAAAXj1P/Hsf+rjv+Pa/9zSP9XJf9VAP9JANw9ALkxAJYlAHMZAFDU1P+xsf+Ojv9ra/9ISP8lJf8AAP4AANwAALkAAJYAAHMAAFDU4/+xx/+Oq/9rj/9Ic/8lV/8AVf8ASdwAPbkAMZYAJXMAGVDU8P+x4v+O1P9rxv9IuP8lqv8Aqv8AktwAerkAYpYASnMAMlDU//+x//+O//9r//9I//8l//8A/v4A3NwAubkAlpYAc3MAUFDU//Cx/+KO/9Rr/8ZI/7gl/6oA/6oA3JIAuXoAlmIAc0oAUDLU/+Ox/8eO/6tr/49I/3Ml/1cA/1UA3EkAuT0AljEAcyUAUBnU/9Sx/7GO/45r/2tI/0gl/yUA/gAA3AAAuQAAlgAAcwAAUADj/9TH/7Gr/46P/2tz/0hX/yVV/wBJ3AAQ+AFLAAAAAXRSTlMAQObYZgAAAAlwSFlzAAALEgAACxIB0t1+/AAAALpJREFUeNpjYGBkYmZhYWFlYWNngAAOTijg4oYIMHPy8PLx8nDycwpwQwUEhYSFRDhFxTi5xCECEpJS0jKcsqL8nGwgARZOOXkFRSWwMcwgAWVOFVU1dQ1NLW0dmICunr6BoZGxiSlEgJnTzNzC0sraxtYOJmDv4Ojk7MLp6gYRcOf08PTy9vHl9IOa4c+JAGCBAM7AoEDOwEDO4BCIABOSilCQQBhTeERkVGS4f3R0aBhIICYWAWIYGAClIBsa7hXG7gAAAABJRU5ErkJggg==")}.img_profile{display:inline-block;height:16px;width:16px;background-image:url("data:image/gif;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAACXBIWXMAAAsSAAALEgHS3X78AAABZElEQVR42o1R22rCQBD1U/p//apCNtsHwRdfBaFIKbRoUVKMMTWBWIxVCq2b+07POrn4UKjDMpw9O2fm7G5vNBpJKe2/Qto4uEc2WMrBYEBEPaAky36UulwnlSRpUeZEBSGrpEiyHJVGAPVJqZvbO3ftv83Dle+vvPV4/LD0PGYAcKrSFJUsEOgHKoj3s9dFGH9uou3k8ekQKxyDQcYpBnYC7Hm9zBZmlL8BiIJDC0AWpa4FwhZJXoDCBgYAjgU5ToBt+k1tL14ssFNNvIEBAFwVljJlSDBfpwyg1ISnYoEsiHju5XLcd+T50q0tEQm7eaWKKNfUWgKApUsbPFY0lzY6DraEZm585Do/CLMzqLQWQnSC9k34lVa7PTsBs/zYOa4LB5ZlnQXCbif40Ra50jUwE6JtCcMlUiMQlugEQYisG8CWtGlRdQL+jmui/rjhcAhk/Reo6ff7RuB53vN1MZ1OIfgFQC1cuR3Y6lIAAAAASUVORK5CYII=")}.img_execute{display:inline-block;height:16px;width:16px;background-image:url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAABlBMVEXAwMAAxwCvbOAvAAAAAXRSTlMAQObYZgAAAAlwSFlzAAALEgAACxIB0t1+/AAAACBJREFUCFtjYIABHgYGfiA6wMD/gYH/B5g8ABLhYUAGAHniBNrUPuoHAAAAAElFTkSuQmCC')}.img_file{display:inline-block;height:16px;width:16px;background-image:url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQEAYAAABPYyMiAAAABmJLR0T///////8JWPfcAAAACXBIWXMAAABIAAAASABGyWs+AAAACXZwQWcAAAAQAAAAEABcxq3DAAAA2klEQVRIx61VURbDIAgTX+9ljg4n2z5sNouj1ml+LE9rQkSU5PA6kTZBToTznj5aqKqq+py4lFJKScnMzCwlAAB6IbnNuyXycd1g3oHrf32CmR9mZqpVOdDHs2DmI+c+AiJixu1RAN9xFUcdWCjVIr8xCX8Jubc8Ao9CJF8nRFgNJBxZSCEkjmrIxxSS0yIAoBU4OkpfU8sCPEbEvqaOXcR31zWORbYJ8EI8rsK+DWm7gMVb8F/GK7eg6818jNjJZjMn0agY7x6oxqL5sWbIbhLHoQN78PQ5F3kDgX8u9tphBfoAAAAldEVYdGRhdGU6Y3JlYXRlADIwMTUtMDItMDZUMTA6Mjc6MzErMDE6MDChLu/mAAAAJXRFWHRkYXRlOm1vZGlmeQAyMDE0LTExLTEyVDA4OjM5OjIwKzAxOjAwIGvf8wAAAABJRU5ErkJggg==')}.img_text{display:inline-block;height:18px;width:18px;background-image:url('data:image/gif;base64,R0lGODlhEgASALMAAP/////MzP+Zmf9mZv8zM/8AAMzM/8zMzJmZ/5mZmWZm/2ZmZjMz/zMzMwAA/////yH5BAUUAA8ALAAAAAASABIAAARo8MlJq73SKGSwdSDjUQoIjhNYOujDnGAnFXRBZKoBIpMw1ICHaaigBAq/AUK1CVEIhcfPNFlRbAEBEvWr0VDYQLYgkCQWh8XiAfgRymPyoTFRa2uPO009maP8ZmsjAHxnBygLDQ1zihEAOw==')}#tt{position:absolute;display:block}#tttop{display:block;height:5px;margin-left:5px;overflow:hidden}#ttcont{display:block;padding:2px 12px 3px 7px;margin-left:5px;font-size:11px;background:#777;color:#fff}#ttbot{display:block;height:5px;margin-left:5px;overflow:hidden}.xaxis path,.xaxis line,.yaxis path,.yaxis line,.zaxis path,.zaxis line{fill:none;stroke:#000;shape-rendering:crispEdges}.brush .extent{stroke:#fff;fill-opacity:.125;shape-rendering:crispEdges}rect.zoom{stroke:steelblue;fill-opacity:.1}svg:not(:root){overflow:hidden}.ctxmenu{position:absolute;min-width:64px;height:auto;padding:4px;margin:0;margin-left:0;margin-top:0;border:1px solid #999;background:#f8f8f8;box-shadow:2px 2px 2px #AAA;z-index:11;overflow:visible;font-size:11px} \ No newline at end of file diff --git a/img/app.svg b/img/app.svg new file mode 100755 index 0000000..4c8bb1b --- /dev/null +++ b/img/app.svg @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/js/script.js b/js/script.js new file mode 100755 index 0000000..ae7ff26 --- /dev/null +++ b/js/script.js @@ -0,0 +1,183 @@ +/** + * ownCloud - rootviewer + * + * This file is licensed under the Affero General Public License version 3 or + * later. See the COPYING file. + * + * @author Hugo Gonzalez Labrador (CERN) + * @copyright Hugo Gonzalez Labrador (CERN) 2017 + */ + +(function ($, OC, OCA) { + + var isRootFileOpen = false; + + function setUpEditor(fileURL, publicLinkRender) { + isRootFileOpen = true; + var mainDiv = $('#rootviewer'); + + if(mainDiv.length < 1) + { + mainDiv = $('
'); + mainDiv.css('position', 'absolute'); + mainDiv.css('top', '0'); + mainDiv.css('left', '0'); + mainDiv.css('width', '100%'); + mainDiv.css('height', '100%'); + mainDiv.css('z-index', '200'); + mainDiv.css('background-color', '#fff'); + + var frame = $('
'); + frame.css('position', 'absolute'); + frame.css('top', '0'); + frame.css('left', '0'); + frame.css('width', '100%'); + frame.css('height', '100%'); + + mainDiv.append(frame); + if(publicLinkRender) { + $('#preview').append(mainDiv); + } else { + $('#content').append(mainDiv); + } + } + + var loadingImg = $('
'); + loadingImg.css('position', 'absolute'); + loadingImg.css('top', '50%'); + loadingImg.css('left', '50%'); + loadingImg.css('width', 'auto'); + loadingImg.css('height', 'auto'); + var img = OC.imagePath('core', 'loading-dark.gif'); + var imgContent = $(''); + imgContent.attr('src',img); + loadingImg.append(imgContent); + + var closeButton = $('
'); + closeButton.css('position', 'absolute'); + closeButton.css('top', '0'); + closeButton.css('left', '95%'); + closeButton.css('width', 'auto'); + closeButton.css('height', 'auto'); + closeButton.css('z-index', '200'); + closeButton.css('background-color', '#f00'); + var closeImg = OC.imagePath('core', 'actions/close.svg'); + var closeImgContent = $(''); + closeImgContent.attr('src', closeImg); + closeButton.append(closeImgContent); + + closeButton.click(function() { closeFile(); }); + + $('#app-navigation').hide(); + $('#app-content').hide(); + + mainDiv.append(loadingImg); + mainDiv.append(closeButton); + + + + $('#rootviewer-loader').remove(); + var doc = $('#rootviewer-div'); + doc.append('
'); + $('#simpleGUI').attr('files', fileURL); + BuildSimpleGUI(); + + // Adapt interface to make it simple + $("#simpleGUI #urlToLoad").val(fileURL); + $("#simpleGUI #urlToLoad").hide(); + $("#simpleGUI select[name='s']").hide(); + + var layout = $("#simpleGUI #layout"); + var loadButton = $("#simpleGUI input[value='Load']"); + var resetButton = $("#simpleGUI input[value='Reset']"); + var buttonGroup = loadButton.parent(); + var form = $("simpleGUI form"); + var banner = "

This viewer is based on the ROOT data analysis framework developed at CERN.
If you have questions or issues please refer to ROOT Support page
Integration done by CERNBOX team

"; + var left = $("#simpleGUI #left-div"); + var right = $("#simpleGUI #right-div"); + + left.append(banner); + loadButton.hide(); + resetButton.hide(); + loadButton.click(); + layout.attr("style", ""); + $("#simpleGUI #left-div>h1").hide(); + $("#simpleGUI #left-div>p").hide(); + $("#simpleGUI #left-div form>p").hide(); + left.append(banner); + left.css({border:"0px", "background-color":"white"}); + right.css({border:"0px", "background-color":"white"}); + + var reloadButton = $(''); + buttonGroup.append(reloadButton); + reloadButton.on('click', function(e) { + resetButton.click(); + loadButton.click() + }); + }; + + var isPublicPage = function () { + + if ($("input#isPublic") && $("input#isPublic").val() === "1") { + return true; + } else { + return false; + } + }; + + var getSharingToken = function () { + if ($("input#sharingToken") && $("input#sharingToken").val()) { + return $("input#sharingToken").val(); + } else { + return null; + } + }; + + var closeFile = function(callback) { + if(isRootFileOpen) { + $('#rootviewer').remove(); + $('#app-navigation').show(); + $('#app-content').show(); + isRootFileOpen = false; + + if(callback) { + callback(); + } + } + }; + + var onView = function(filename, data) { + if(isPublicPage()) { + return onViewPublic(filename, data, getSharingToken()); + } + var url = OC.generateUrl('/apps/rootviewer/load') + "?filename=" + encodeURIComponent(filename); + setUpEditor(url); + }; + + var onViewPublic = function(filename, data, token) { + url = OC.generateUrl('/apps/rootviewer/publicload') + "?filename=" + encodeURIComponent(filename) + "&token=" + token; + setUpEditor(url); + }; + + var onViewPublicSingleFile = function(token) { + url = OC.generateUrl('/apps/rootviewer/publicload') + "?filename=" + encodeURIComponent(filename) + "&token=" + token; + setUpEditor(url); + }; + + $(document).ready(function () { + JSROOT.source_dir = window.location.origin + window.oc_webroot + "/apps/rootviewer/js/"; + + //loadConfig(); + if (OCA && OCA.Files) { + OCA.Files.fileActions.register('application/root', 'Default View', OC.PERMISSION_READ, OC.imagePath('core', 'actions/play'), onView); + OCA.Files.fileActions.setDefault('application/root', 'Default View'); + } + // Doesn't work with IE below 9 + if(!$.browser.msie || ($.browser.msie && $.browser.version >= 9)){ + if ($('#isPublic').val() && $('#mimetype').val() === 'application/root' && $("input#passwordProtected").val() === "false") { + var sharingToken = $('#sharingToken').val(); + onViewPublicSingleFile(sharingToken); + } + } + }); +})(jQuery, OC, OCA); \ No newline at end of file diff --git a/js/scripts/JSRoot3DPainter.js b/js/scripts/JSRoot3DPainter.js new file mode 100755 index 0000000..08e41e7 --- /dev/null +++ b/js/scripts/JSRoot3DPainter.js @@ -0,0 +1,837 @@ +/// @file JSRoot3DPainter.js +/// JavaScript ROOT 3D graphics + +(function( factory ) { + if ( typeof define === "function" && define.amd ) { + // AMD. Register as an anonymous module. + define( ['jquery','jquery-ui', 'd3', 'JSRootPainter', 'THREE', 'jquery.mousewheel'], factory ); + } else { + + if (typeof JSROOT == 'undefined') { + var e1 = new Error('JSROOT is not defined'); + e1.source = 'JSRoot3DPainter.js'; + throw e1; + } + + if (typeof d3 != 'object') { + var e1 = new Error('This extension requires d3.v3.js'); + e1.source = 'JSRoot3DPainter.js'; + throw e1; + } + + if (typeof JSROOT.Painter != 'object') { + var e1 = new Error('JSROOT.Painter is not defined'); + e1.source = 'JSRoot3DPainter.js'; + throw e1; + } + + if (typeof THREE == 'undefined') { + var e1 = new Error('THREE is not defined'); + e1.source = 'JSRoot3DPainter.js'; + throw e1; + } + + factory(jQuery, jQuery.ui, d3, JSROOT); + } +} (function($, myui, d3, JSROOT) { + + JSROOT.Painter.add3DInteraction = function(renderer, scene, camera, toplevel, painter) { + // add 3D mouse interactive functions + var mouseX, mouseY, mouseDowned = false; + var mouse = { x : 0, y : 0 }, INTERSECTED; + + var tooltip = function() { + var id = 'tt'; + var top = 3; + var left = 3; + var maxw = 150; + var speed = 10; + var timer = 20; + var endalpha = 95; + var alpha = 0; + var tt, t, c, b, h; + var ie = document.all ? true : false; + return { + show : function(v, w) { + if (tt == null) { + tt = document.createElement('div'); + tt.setAttribute('id', id); + t = document.createElement('div'); + t.setAttribute('id', id + 'top'); + c = document.createElement('div'); + c.setAttribute('id', id + 'cont'); + b = document.createElement('div'); + b.setAttribute('id', id + 'bot'); + tt.appendChild(t); + tt.appendChild(c); + tt.appendChild(b); + document.body.appendChild(tt); + tt.style.opacity = 0; + tt.style.filter = 'alpha(opacity=0)'; + document.onmousemove = this.pos; + } + tt.style.display = 'block'; + c.innerHTML = v; + tt.style.width = w ? w + 'px' : 'auto'; + tt.style.width = 'auto'; // let it be automatically resizing... + if (!w && ie) { + t.style.display = 'none'; + b.style.display = 'none'; + tt.style.width = tt.offsetWidth; + t.style.display = 'block'; + b.style.display = 'block'; + } + // if (tt.offsetWidth > maxw) { tt.style.width = maxw + 'px'; } + h = parseInt(tt.offsetHeight) + top; + clearInterval(tt.timer); + tt.timer = setInterval(function() { tooltip.fade(1) }, timer); + }, + pos : function(e) { + var u = ie ? event.clientY + document.documentElement.scrollTop : e.pageY; + var l = ie ? event.clientX + document.documentElement.scrollLeft : e.pageX; + tt.style.top = u + 15 + 'px';// (u - h) + 'px'; + tt.style.left = (l + left) + 'px'; + }, + fade : function(d) { + var a = alpha; + if ((a != endalpha && d == 1) || (a != 0 && d == -1)) { + var i = speed; + if (endalpha - a < speed && d == 1) { + i = endalpha - a; + } else if (alpha < speed && d == -1) { + i = a; + } + alpha = a + (i * d); + tt.style.opacity = alpha * .01; + tt.style.filter = 'alpha(opacity=' + alpha + ')'; + } else { + clearInterval(tt.timer); + if (d == -1) { + tt.style.display = 'none'; + } + } + }, + hide : function() { + if (tt == null) + return; + clearInterval(tt.timer); + tt.timer = setInterval(function() { + tooltip.fade(-1) + }, timer); + } + }; + }(); + + var radius = 100; + var theta = 0; + var projector = new THREE.Projector(); + function findIntersection() { + // find intersections + if (mouseDowned) { + if (INTERSECTED) { + INTERSECTED.material.emissive.setHex(INTERSECTED.currentHex); + renderer.render(scene, camera); + } + INTERSECTED = null; + if (JSROOT.gStyle.Tooltip) + tooltip.hide(); + return; + } + var vector = new THREE.Vector3(mouse.x, mouse.y, 1); + projector.unprojectVector(vector, camera); + var raycaster = new THREE.Raycaster(camera.position, vector.sub( + camera.position).normalize()); + var intersects = raycaster.intersectObjects(scene.children, true); + if (intersects.length > 0) { + var pick = null; + for (var i = 0; i < intersects.length; ++i) { + if ('emissive' in intersects[i].object.material) { + pick = intersects[i]; + break; + } + } + if (pick && INTERSECTED != pick.object) { + if (INTERSECTED) + INTERSECTED.material.emissive.setHex(INTERSECTED.currentHex); + INTERSECTED = pick.object; + INTERSECTED.currentHex = INTERSECTED.material.emissive.getHex(); + INTERSECTED.material.emissive.setHex(0x5f5f5f); + renderer.render(scene, camera); + if (JSROOT.gStyle.Tooltip) + tooltip.show(INTERSECTED.name.length > 0 ? INTERSECTED.name + : INTERSECTED.parent.name, 200); + } + } else { + if (INTERSECTED) { + INTERSECTED.material.emissive.setHex(INTERSECTED.currentHex); + renderer.render(scene, camera); + } + INTERSECTED = null; + if (JSROOT.gStyle.Tooltip) + tooltip.hide(); + } + } + ; + + $(renderer.domElement).on('touchstart mousedown', function(e) { + // var touch = e.changedTouches[0] || {}; + if (JSROOT.gStyle.Tooltip) + tooltip.hide(); + e.preventDefault(); + var touch = e; + if ('changedTouches' in e) + touch = e.changedTouches[0]; + else if ('touches' in e) + touch = e.touches[0]; + else if ('originalEvent' in e) { + if ('changedTouches' in e.originalEvent) + touch = e.originalEvent.changedTouches[0]; + else if ('touches' in e.originalEvent) + touch = e.originalEvent.touches[0]; + } + mouseX = touch.pageX; + mouseY = touch.pageY; + mouseDowned = true; + }); + $(renderer.domElement).on('touchmove mousemove', function(e) { + if (mouseDowned) { + var touch = e; + if ('changedTouches' in e) + touch = e.changedTouches[0]; + else if ('touches' in e) + touch = e.touches[0]; + else if ('originalEvent' in e) { + if ('changedTouches' in e.originalEvent) + touch = e.originalEvent.changedTouches[0]; + else if ('touches' in e.originalEvent) + touch = e.originalEvent.touches[0]; + } + var moveX = touch.pageX - mouseX; + var moveY = touch.pageY - mouseY; + // limited X rotate in -45 to 135 deg + if ((moveY > 0 && toplevel.rotation.x < Math.PI * 3 / 4) + || (moveY < 0 && toplevel.rotation.x > -Math.PI / 4)) { + toplevel.rotation.x += moveY * 0.02; + } + toplevel.rotation.y += moveX * 0.02; + renderer.render(scene, camera); + mouseX = touch.pageX; + mouseY = touch.pageY; + } else { + e.preventDefault(); + var mouse_x = 'offsetX' in e.originalEvent ? e.originalEvent.offsetX : e.originalEvent.layerX; + var mouse_y = 'offsetY' in e.originalEvent ? e.originalEvent.offsetY : e.originalEvent.layerY; + mouse.x = (mouse_x / renderer.domElement.width) * 2 - 1; + mouse.y = -(mouse_y / renderer.domElement.height) * 2 + 1; + // enable picking once tootips are available... + findIntersection(); + } + }); + $(renderer.domElement).on('touchend mouseup', function(e) { + mouseDowned = false; + }); + + $(renderer.domElement).on('mousewheel', function(e, d) { + e.preventDefault(); + camera.position.z += d * 20; + renderer.render(scene, camera); + }); + + $(renderer.domElement).on('contextmenu', function(e) { + e.preventDefault(); + + if (JSROOT.gStyle.Tooltip) tooltip.hide(); + + JSROOT.Painter.createMenu(function(menu) { + if (painter) + menu.add("header:"+ painter.histo['fName']); + + menu.add(JSROOT.gStyle.Tooltip ? "Disable tooltip" : "Enable tooltip", function() { + JSROOT.gStyle.Tooltip = !JSROOT.gStyle.Tooltip; + tooltip.hide(); + }); + + if (painter) + menu.add("Switch to 2D", function() { + $(painter.svg_pad().node()).show().parent().find(renderer.domElement).remove(); + tooltip.hide(); + painter.Draw2D(); + }); + menu.add("Close"); + + menu.show(e.originalEvent); + }); + + }); + } + + JSROOT.Painter.real_drawHistogram2D = function(painter) { + + var w = painter.pad_width(), h = painter.pad_height(), size = 100; + + var xmin = painter.xmin, xmax = painter.xmax; + if (painter.zoom_xmin != painter.zoom_xmax) { + xmin = painter.zoom_xmin; + xmax = painter.zoom_xmax; + } + var ymin = painter.ymin, ymax = painter.ymax; + if (painter.zoom_ymin != painter.zoom_ymax) { + ymin = painter.zoom_ymin; + ymax = painter.zoom_ymax; + } + + var tx, utx, ty, uty, tz, utz; + + if (painter.options.Logx) { + tx = d3.scale.log().domain([ xmin, xmax ]).range([ -size, size ]); + utx = d3.scale.log().domain([ -size, size ]).range([ xmin, xmax ]); + } else { + tx = d3.scale.linear().domain([ xmin, xmax ]).range([ -size, size ]); + utx = d3.scale.linear().domain([ -size, size ]).range([ xmin, xmax ]); + } + if (painter.options.Logy) { + ty = d3.scale.log().domain([ ymin, ymax ]).range([ -size, size ]); + uty = d3.scale.log().domain([ size, -size ]).range([ ymin, ymax ]); + } else { + ty = d3.scale.linear().domain([ ymin, ymax ]).range([ -size, size ]); + uty = d3.scale.linear().domain([ size, -size ]).range([ ymin, ymax ]); + } + if (painter.options.Logz) { + tz = d3.scale.log().domain([ painter.gminbin, Math.ceil(painter.gmaxbin / 100) * 105 ]).range([ 0, size * 2 ]); + utz = d3.scale.log().domain([ 0, size * 2 ]).range([ painter.gminbin, Math.ceil(painter.gmaxbin / 100) * 105 ]); + } else { + tz = d3.scale.linear().domain([ painter.gminbin, Math.ceil(painter.gmaxbin / 100) * 105 ]).range( [ 0, size * 2 ]); + utz = d3.scale.linear().domain([ 0, size * 2 ]).range( [ painter.gminbin, Math.ceil(painter.gmaxbin / 100) * 105 ]); + } + + var constx = (size * 2 / painter.nbinsx) / painter.gmaxbin; + var consty = (size * 2 / painter.nbinsy) / painter.gmaxbin; + + var colorFlag = (painter.options.Color > 0); + var fcolor = d3.rgb(JSROOT.Painter.root_colors[painter.histo['fFillColor']]); + + var local_bins = painter.CreateDrawBins(100, 100, 2, (JSROOT.gStyle.Tooltip ? 1 : 0)); + + // three.js 3D drawing + var scene = new THREE.Scene(); + + var toplevel = new THREE.Object3D(); + toplevel.rotation.x = 30 * Math.PI / 180; + toplevel.rotation.y = 30 * Math.PI / 180; + scene.add(toplevel); + + var wireMaterial = new THREE.MeshBasicMaterial({ + color : 0x000000, + wireframe : true, + wireframeLinewidth : 0.5, + side : THREE.DoubleSide + }); + + // create a new mesh with cube geometry + var cube = new THREE.Mesh(new THREE.BoxGeometry(size * 2, size * 2, size * 2), wireMaterial); + //cube.position.y = size; + + var helper = new THREE.BoxHelper(cube); + helper.material.color.set(0x000000); + + var box = new THREE.Object3D(); + box.add(helper); + box.position.y = size; + + // add the cube to the scene + toplevel.add(box); + + var textMaterial = new THREE.MeshBasicMaterial({ color : 0x000000 }); + + // add the calibration vectors and texts + var geometry = new THREE.Geometry(); + var imax, istep, len = 3, plen, sin45 = Math.sin(45); + var text3d, text; + var xmajors = tx.ticks(8); + var xminors = tx.ticks(50); + for (var i = -size, j = 0, k = 0; i < size; ++i) { + var is_major = (utx(i) <= xmajors[j] && utx(i + 1) > xmajors[j]) ? true : false; + var is_minor = (utx(i) <= xminors[k] && utx(i + 1) > xminors[k]) ? true : false; + plen = (is_major ? len + 2 : len) * sin45; + if (is_major) { + text3d = new THREE.TextGeometry(xmajors[j], { size : 7, height : 0, curveSegments : 10 }); + ++j; + + text3d.computeBoundingBox(); + var centerOffset = 0.5 * (text3d.boundingBox.max.x - text3d.boundingBox.min.x); + + text = new THREE.Mesh(text3d, textMaterial); + text.position.set(i - centerOffset, -13, size + plen); + toplevel.add(text); + + text = new THREE.Mesh(text3d, textMaterial); + text.position.set(i + centerOffset, -13, -size - plen); + text.rotation.y = Math.PI; + toplevel.add(text); + } + if (is_major || is_minor) { + ++k; + geometry.vertices.push(new THREE.Vector3(i, 0, size)); + geometry.vertices.push(new THREE.Vector3(i, -plen, size + plen)); + geometry.vertices.push(new THREE.Vector3(i, 0, -size)); + geometry.vertices.push(new THREE.Vector3(i, -plen, -size - plen)); + } + } + var ymajors = ty.ticks(8); + var yminors = ty.ticks(50); + for (var i = size, j = 0, k = 0; i > -size; --i) { + var is_major = (uty(i) <= ymajors[j] && uty(i - 1) > ymajors[j]) ? true : false; + var is_minor = (uty(i) <= yminors[k] && uty(i - 1) > yminors[k]) ? true : false; + plen = (is_major ? len + 2 : len) * sin45; + if (is_major) { + text3d = new THREE.TextGeometry(ymajors[j], { size : 7, height : 0, curveSegments : 10 }); + ++j; + + text3d.computeBoundingBox(); + var centerOffset = 0.5 * (text3d.boundingBox.max.x - text3d.boundingBox.min.x); + + text = new THREE.Mesh(text3d, textMaterial); + text.position.set(size + plen, -13, i + centerOffset); + text.rotation.y = Math.PI / 2; + toplevel.add(text); + + text = new THREE.Mesh(text3d, textMaterial); + text.position.set(-size - plen, -13, i - centerOffset); + text.rotation.y = -Math.PI / 2; + toplevel.add(text); + } + if (is_major || is_minor) { + ++k; + geometry.vertices.push(new THREE.Vector3(size, 0, i)); + geometry.vertices.push(new THREE.Vector3(size + plen, -plen, i)); + geometry.vertices.push(new THREE.Vector3(-size, 0, i)); + geometry.vertices.push(new THREE.Vector3(-size - plen, -plen, i)); + } + } + var zmajors = tz.ticks(8); + var zminors = tz.ticks(50); + for (var i = 0, j = 0, k = 0; i < (size * 2); ++i) { + var is_major = (utz(i) <= zmajors[j] && utz(i + 1) > zmajors[j]) ? true : false; + var is_minor = (utz(i) <= zminors[k] && utz(i + 1) > zminors[k]) ? true : false; + plen = (is_major ? len + 2 : len) * sin45; + if (is_major) { + text3d = new THREE.TextGeometry(zmajors[j], { size : 7, height : 0, curveSegments : 10 }); + ++j; + + text3d.computeBoundingBox(); + var offset = 0.8 * (text3d.boundingBox.max.x - text3d.boundingBox.min.x); + + text = new THREE.Mesh(text3d, textMaterial); + text.position.set(size + offset + 5, i - 2.5, size + offset + 5); + text.rotation.y = Math.PI * 3 / 4; + toplevel.add(text); + + text = new THREE.Mesh(text3d, textMaterial); + text.position.set(size + offset + 5, i - 2.5, -size - offset - 5); + text.rotation.y = -Math.PI * 3 / 4; + toplevel.add(text); + + text = new THREE.Mesh(text3d, textMaterial); + text.position.set(-size - offset - 5, i - 2.5, size + offset + 5); + text.rotation.y = Math.PI / 4; + toplevel.add(text); + + text = new THREE.Mesh(text3d, textMaterial); + text.position.set(-size - offset - 5, i - 2.5, -size - offset - 5); + text.rotation.y = -Math.PI / 4; + toplevel.add(text); + } + if (is_major || is_minor) { + ++k; + geometry.vertices.push(new THREE.Vector3(size, i, size)); + geometry.vertices.push(new THREE.Vector3(size + plen, i, size + plen)); + geometry.vertices.push(new THREE.Vector3(size, i, -size)); + geometry.vertices.push(new THREE.Vector3(size + plen, i, -size - plen)); + geometry.vertices.push(new THREE.Vector3(-size, i, size)); + geometry.vertices.push(new THREE.Vector3(-size - plen, i, size + plen)); + geometry.vertices.push(new THREE.Vector3(-size, i, -size)); + geometry.vertices.push(new THREE.Vector3(-size - plen, i, -size - plen)); + } + } + + // add the calibration lines + var lineMaterial = new THREE.LineBasicMaterial({ color : 0x000000 }); + var line = new THREE.Line(geometry, lineMaterial); + line.type = THREE.LinePieces; + toplevel.add(line); + + // create the bin cubes + + var fillcolor = new THREE.Color(0xDDDDDD); + fillcolor.setRGB(fcolor.r / 255, fcolor.g / 255, fcolor.b / 255); + var bin, wei, hh; + + for (var i = 0; i < local_bins.length; ++i) { + hh = local_bins[i]; + wei = tz(hh.z); + + bin = THREE.SceneUtils.createMultiMaterialObject( + new THREE.BoxGeometry(2 * size / painter.nbinsx, wei, 2 * size / painter.nbinsy), + [ new THREE.MeshLambertMaterial({ color : fillcolor.getHex(), shading : THREE.NoShading }), wireMaterial ]); + bin.position.x = tx(hh.x); + bin.position.y = wei / 2; + bin.position.z = -(ty(hh.y)); + + if (JSROOT.gStyle.Tooltip) + bin.name = hh.tip; + toplevel.add(bin); + } + + delete local_bins; + local_bins = null; + + // create a point light + var pointLight = new THREE.PointLight(0xcfcfcf); + pointLight.position.set(0, 50, 250); + scene.add(pointLight); + + // var directionalLight = new THREE.DirectionalLight( + // 0x7f7f7f ); + // directionalLight.position.set( 0, -70, 100 + // ).normalize(); + // scene.add( directionalLight ); + + var camera = new THREE.PerspectiveCamera(45, w / h, 1, 1000); + camera.position.set(0, size / 2, 500); + camera.lookat = cube; + + /** + * @author alteredq / http://alteredqualia.com/ + * @author mr.doob / http://mrdoob.com/ + */ + var Detector = { + canvas : !!window.CanvasRenderingContext2D, + webgl : (function() { try { + return !!window.WebGLRenderingContext && !!document.createElement('canvas').getContext('experimental-webgl'); + } catch (e) { + return false; + } + })(), + workers : !!window.Worker, + fileapi : window.File && window.FileReader && window.FileList && window.Blob + }; + + var renderer = Detector.webgl ? new THREE.WebGLRenderer({ antialias : true }) : + new THREE.CanvasRenderer({ antialias : true }); + renderer.setClearColor(0xffffff, 1); + renderer.setSize(w, h); + $(painter.svg_pad().node()).hide().parent().append(renderer.domElement); + renderer.render(scene, camera); + + JSROOT.Painter.add3DInteraction(renderer, scene, camera, toplevel, painter); + } + + JSROOT.Painter.drawHistogram3D = function(divid, histo, opt, painter) { + + var logx = false, logy = false, logz = false, gridx = false, gridy = false, gridz = false; + + painter.SetDivId(divid, -1); + var pad = painter.root_pad(); + + var render_to; + if (!painter.svg_pad().empty()) + render_to = $(painter.svg_pad().node()).hide().parent(); + else + render_to = $("#" + divid); + + var opt = histo['fOption'].toLowerCase(); + // if (opt=="") opt = "colz"; + + if (pad) { + logx = pad['fLogx']; + logy = pad['fLogy']; + logz = pad['fLogz']; + gridx = pad['fGridx']; + gridy = pad['fGridy']; + gridz = pad['fGridz']; + } + + var fillcolor = JSROOT.Painter.root_colors[histo['fFillColor']]; + var linecolor = JSROOT.Painter.root_colors[histo['fLineColor']]; + if (histo['fFillColor'] == 0) { + fillcolor = '#4572A7'; + } + if (histo['fLineColor'] == 0) { + linecolor = '#4572A7'; + } + var nbinsx = histo['fXaxis']['fNbins']; + var nbinsy = histo['fYaxis']['fNbins']; + var nbinsz = histo['fZaxis']['fNbins']; + var scalex = (histo['fXaxis']['fXmax'] - histo['fXaxis']['fXmin']) / histo['fXaxis']['fNbins']; + var scaley = (histo['fYaxis']['fXmax'] - histo['fYaxis']['fXmin']) / histo['fYaxis']['fNbins']; + var scalez = (histo['fZaxis']['fXmax'] - histo['fZaxis']['fXmin']) / histo['fZaxis']['fNbins']; + var maxbin = -1e32, minbin = 1e32; + maxbin = d3.max(histo['fArray']); + minbin = d3.min(histo['fArray']); + var bins = new Array(); + for (var i = 0; i <= nbinsx + 2; ++i) { + for (var j = 0; j < nbinsy + 2; ++j) { + for (var k = 0; k < nbinsz + 2; ++k) { + var bin_content = histo.getBinContent(i, j, k); + if (bin_content > minbin) { + var point = { + x : histo['fXaxis']['fXmin'] + (i * scalex), + y : histo['fYaxis']['fXmin'] + (j * scaley), + z : histo['fZaxis']['fXmin'] + (k * scalez), + n : bin_content + }; + bins.push(point); + } + } + } + } + var w = render_to.width(), h = render_to.height(), size = 100; + if (h<10) { render_to.height(0.66*w); h = render_to.height(); } + + if (logx) { + var tx = d3.scale.log().domain([ histo['fXaxis']['fXmin'], histo['fXaxis']['fXmax'] ]).range( [ -size, size ]); + var utx = d3.scale.log().domain([ -size, size ]).range([ histo['fXaxis']['fXmin'], histo['fXaxis']['fXmax'] ]); + } else { + var tx = d3.scale.linear().domain( [ histo['fXaxis']['fXmin'], histo['fXaxis']['fXmax'] ]).range( [ -size, size ]); + var utx = d3.scale.linear().domain([ -size, size ]).range([ histo['fXaxis']['fXmin'], histo['fXaxis']['fXmax'] ]); + } + if (logy) { + var ty = d3.scale.log().domain([ histo['fYaxis']['fXmin'], histo['fYaxis']['fXmax'] ]).range( [ -size, size ]); + var uty = d3.scale.log().domain([ size, -size ]).range([ histo['fYaxis']['fXmin'], histo['fYaxis']['fXmax'] ]); + } else { + var ty = d3.scale.linear().domain( [ histo['fYaxis']['fXmin'], histo['fYaxis']['fXmax'] ]).range([ -size, size ]); + var uty = d3.scale.linear().domain([ size, -size ]).range([ histo['fYaxis']['fXmin'], histo['fYaxis']['fXmax'] ]); + } + if (logz) { + var tz = d3.scale.log().domain([ histo['fZaxis']['fXmin'], histo['fZaxis']['fXmax'] ]).range([ -size, size ]); + var utz = d3.scale.log().domain([ -size, size ]).range([ histo['fZaxis']['fXmin'], histo['fZaxis']['fXmax'] ]); + } else { + var tz = d3.scale.linear().domain([ histo['fZaxis']['fXmin'], histo['fZaxis']['fXmax'] ]).range([ -size, size ]); + var utz = d3.scale.linear().domain([ -size, size ]).range([ histo['fZaxis']['fXmin'], histo['fZaxis']['fXmax'] ]); + } + + // three.js 3D drawing + var scene = new THREE.Scene(); + + var toplevel = new THREE.Object3D(); + toplevel.rotation.x = 30 * Math.PI / 180; + toplevel.rotation.y = 30 * Math.PI / 180; + scene.add(toplevel); + + var wireMaterial = new THREE.MeshBasicMaterial({ + color : 0x000000, + wireframe : true, + wireframeLinewidth : 0.5, + side : THREE.DoubleSide + }); + + // create a new mesh with cube geometry + var cube = new THREE.Mesh(new THREE.BoxGeometry(size * 2, size * 2, size * 2), wireMaterial); + + var helper = new THREE.BoxHelper(cube); + helper.material.color.set(0x000000); + + // add the cube to the scene + toplevel.add(helper); + + var textMaterial = new THREE.MeshBasicMaterial({ color : 0x000000 }); + + // add the calibration vectors and texts + var geometry = new THREE.Geometry(); + var imax, istep, len = 3, plen, sin45 = Math.sin(45); + var text3d, text; + var xmajors = tx.ticks(5); + var xminors = tx.ticks(25); + for (var i = -size, j = 0, k = 0; i <= size; ++i) { + var is_major = (utx(i) <= xmajors[j] && utx(i + 1) > xmajors[j]) ? true : false; + var is_minor = (utx(i) <= xminors[k] && utx(i + 1) > xminors[k]) ? true : false; + plen = (is_major ? len + 2 : len) * sin45; + if (is_major) { + text3d = new THREE.TextGeometry(xmajors[j], { size : 7, height : 0, curveSegments : 10 }); + ++j; + + text3d.computeBoundingBox(); + var centerOffset = 0.5 * (text3d.boundingBox.max.x - text3d.boundingBox.min.x); + + text = new THREE.Mesh(text3d, textMaterial); + text.position.set(i - centerOffset, -size - 13, size + plen); + toplevel.add(text); + + text = new THREE.Mesh(text3d, textMaterial); + text.position.set(i + centerOffset, -size - 13, -size - plen); + text.rotation.y = Math.PI; + toplevel.add(text); + } + if (is_major || is_minor) { + ++k; + geometry.vertices.push(new THREE.Vector3(i, -size, size)); + geometry.vertices.push(new THREE.Vector3(i, -size - plen, size + plen)); + geometry.vertices.push(new THREE.Vector3(i, -size, -size)); + geometry.vertices.push(new THREE.Vector3(i, -size - plen, -size - plen)); + } + } + var ymajors = ty.ticks(5); + var yminors = ty.ticks(25); + for (var i = size, j = 0, k = 0; i > -size; --i) { + var is_major = (uty(i) <= ymajors[j] && uty(i - 1) > ymajors[j]) ? true : false; + var is_minor = (uty(i) <= yminors[k] && uty(i - 1) > yminors[k]) ? true : false; + plen = (is_major ? len + 2 : len) * sin45; + if (is_major) { + text3d = new THREE.TextGeometry(ymajors[j], { size : 7, height : 0, curveSegments : 10 }); + ++j; + + text3d.computeBoundingBox(); + var centerOffset = 0.5 * (text3d.boundingBox.max.x - text3d.boundingBox.min.x); + + text = new THREE.Mesh(text3d, textMaterial); + text.position.set(size + plen, -size - 13, i + centerOffset); + text.rotation.y = Math.PI / 2; + toplevel.add(text); + + text = new THREE.Mesh(text3d, textMaterial); + text.position.set(-size - plen, -size - 13, i - centerOffset); + text.rotation.y = -Math.PI / 2; + toplevel.add(text); + } + if (is_major || is_minor) { + ++k; + geometry.vertices.push(new THREE.Vector3(size, -size, i)); + geometry.vertices.push(new THREE.Vector3(size + plen, -size - plen, i)); + geometry.vertices.push(new THREE.Vector3(-size, -size, i)); + geometry.vertices.push(new THREE.Vector3(-size - plen, -size - plen, i)); + } + } + var zmajors = tz.ticks(5); + var zminors = tz.ticks(25); + for (var i = -size, j = 0, k = 0; i <= size; ++i) { + var is_major = (utz(i) <= zmajors[j] && utz(i + 1) > zmajors[j]) ? true : false; + var is_minor = (utz(i) <= zminors[k] && utz(i + 1) > zminors[k]) ? true : false; + plen = (is_major ? len + 2 : len) * sin45; + if (is_major) { + text3d = new THREE.TextGeometry(zmajors[j], { size : 7, height : 0, curveSegments : 10 }); + ++j; + + text3d.computeBoundingBox(); + var offset = 0.6 * (text3d.boundingBox.max.x - text3d.boundingBox.min.x); + + text = new THREE.Mesh(text3d, textMaterial); + text.position.set(size + offset + 7, i - 2.5, size + offset + 7); + text.rotation.y = Math.PI * 3 / 4; + toplevel.add(text); + + text = new THREE.Mesh(text3d, textMaterial); + text.position.set(size + offset + 7, i - 2.5, -size - offset - 7); + text.rotation.y = -Math.PI * 3 / 4; + toplevel.add(text); + + text = new THREE.Mesh(text3d, textMaterial); + text.position.set(-size - offset - 7, i - 2.5, size + offset + 7); + text.rotation.y = Math.PI / 4; + toplevel.add(text); + + text = new THREE.Mesh(text3d, textMaterial); + text.position.set(-size - offset - 7, i - 2.5, -size - offset - 7); + text.rotation.y = -Math.PI / 4; + toplevel.add(text); + } + if (is_major || is_minor) { + ++k; + geometry.vertices.push(new THREE.Vector3(size, i, size)); + geometry.vertices.push(new THREE.Vector3(size + plen, i, size + plen)); + geometry.vertices.push(new THREE.Vector3(size, i, -size)); + geometry.vertices.push(new THREE.Vector3(size + plen, i, -size - plen)); + geometry.vertices.push(new THREE.Vector3(-size, i, size)); + geometry.vertices.push(new THREE.Vector3(-size - plen, i, size + plen)); + geometry.vertices.push(new THREE.Vector3(-size, i, -size)); + geometry.vertices.push(new THREE.Vector3(-size - plen, i, -size - plen)); + } + } + + // add the calibration lines + var lineMaterial = new THREE.LineBasicMaterial({ color : 0x000000 }); + var line = new THREE.Line(geometry, lineMaterial); + line.type = THREE.LinePieces; + toplevel.add(line); + + // create the bin cubes + var constx = (size * 2 / histo['fXaxis']['fNbins']) / maxbin; + var consty = (size * 2 / histo['fYaxis']['fNbins']) / maxbin; + var constz = (size * 2 / histo['fZaxis']['fNbins']) / maxbin; + + var optFlag = (opt.indexOf('colz') != -1 || opt.indexOf('col') != -1); + var fcolor = d3.rgb(JSROOT.Painter.root_colors[histo['fFillColor']]); + var fillcolor = new THREE.Color(0xDDDDDD); + fillcolor.setRGB(fcolor.r / 255, fcolor.g / 255, fcolor.b / 255); + var bin, wei; + for (var i = 0; i < bins.length; ++i) { + wei = (optFlag ? maxbin : bins[i].n); + if (opt.indexOf('box1') != -1) { + bin = new THREE.Mesh(new THREE.SphereGeometry(0.5 * wei * constx /* , 16, 16 */), + new THREE.MeshPhongMaterial({ color : fillcolor.getHex(), specular : 0xbfbfbf/* , shading: THREE.NoShading */})); + } else { + bin = THREE.SceneUtils.createMultiMaterialObject( + new THREE.BoxGeometry(wei * constx, wei * constz, wei * consty), + [ new THREE.MeshLambertMaterial({ color : fillcolor.getHex(), shading : THREE.NoShading }), wireMaterial ]); + } + bin.position.x = tx(bins[i].x - (scalex / 2)); + bin.position.y = tz(bins[i].z - (scalez / 2)); + bin.position.z = -(ty(bins[i].y - (scaley / 2))); + bin.name = "x: [" + bins[i].x.toPrecision(4) + ", " + + (bins[i].x + scalex).toPrecision(4) + "]
" + + "y: [" + bins[i].y.toPrecision(4) + ", " + + (bins[i].y + scaley).toPrecision(4) + "]
" + + "z: [" + bins[i].z.toPrecision(4) + ", " + + (bins[i].z + scalez).toPrecision(4) + "]
" + + "entries: " + bins[i].n.toFixed(); + toplevel.add(bin); + } + // create a point light + var pointLight = new THREE.PointLight(0xcfcfcf); + pointLight.position.set(0, 50, 250); + scene.add(pointLight); + + // var directionalLight = new THREE.DirectionalLight( 0x7f7f7f ); + // directionalLight.position.set( 0, -70, 100).normalize(); + // scene.add( directionalLight ); + + var camera = new THREE.PerspectiveCamera(45, w / h, 1, 1000); + camera.position.set(0, 0, 500); + camera.lookat = cube; + + /** + * @author alteredq / http://alteredqualia.com/ + * @author mr.doob / http://mrdoob.com/ + */ + var Detector = { + canvas : !!window.CanvasRenderingContext2D, + webgl : (function() { + try { + return !!window.WebGLRenderingContext + && !!document.createElement('canvas') + .getContext('experimental-webgl'); + } catch (e) { + return false; + } + })(), + workers : !!window.Worker, + fileapi : window.File && window.FileReader + && window.FileList && window.Blob + }; + + var renderer = Detector.webgl ? + new THREE.WebGLRenderer({ antialias : true }) : + new THREE.CanvasRenderer({antialias : true }); + renderer.setClearColor(0xffffff, 1); + renderer.setSize(w, h); + render_to.append(renderer.domElement); + renderer.render(scene, camera); + + JSROOT.Painter.add3DInteraction(renderer, scene, camera, toplevel, null); + + return painter.DrawingReady(); + } + + return JSROOT.Painter; + +})); + diff --git a/js/scripts/JSRoot3DPainter.min.js b/js/scripts/JSRoot3DPainter.min.js new file mode 100755 index 0000000..f81a45a --- /dev/null +++ b/js/scripts/JSRoot3DPainter.min.js @@ -0,0 +1 @@ +(function(a){if(typeof define==="function"&&define.amd){define(["jquery","jquery-ui","d3","JSRootPainter","THREE","jquery.mousewheel"],a)}else{if(typeof JSROOT=="undefined"){var b=new Error("JSROOT is not defined");b.source="JSRoot3DPainter.js";throw b}if(typeof d3!="object"){var b=new Error("This extension requires d3.v3.js");b.source="JSRoot3DPainter.js";throw b}if(typeof JSROOT.Painter!="object"){var b=new Error("JSROOT.Painter is not defined");b.source="JSRoot3DPainter.js";throw b}if(typeof THREE=="undefined"){var b=new Error("THREE is not defined");b.source="JSRoot3DPainter.js";throw b}a(jQuery,jQuery.ui,d3,JSROOT)}}(function(c,d,b,a){a.Painter.add3DInteraction=function(m,h,l,r,p){var g,f,i=false;var k={x:0,y:0},o;var s=function(){var v="tt";var G=3;var x=3;var F=150;var y=10;var w=20;var B=95;var z=0;var C,H,D,E,A;var u=document.all?true:false;return{show:function(I,t){if(C==null){C=document.createElement("div");C.setAttribute("id",v);H=document.createElement("div");H.setAttribute("id",v+"top");D=document.createElement("div");D.setAttribute("id",v+"cont");E=document.createElement("div");E.setAttribute("id",v+"bot");C.appendChild(H);C.appendChild(D);C.appendChild(E);document.body.appendChild(C);C.style.opacity=0;C.style.filter="alpha(opacity=0)";document.onmousemove=this.pos}C.style.display="block";D.innerHTML=I;C.style.width=t?t+"px":"auto";C.style.width="auto";if(!t&&u){H.style.display="none";E.style.display="none";C.style.width=C.offsetWidth;H.style.display="block";E.style.display="block"}A=parseInt(C.offsetHeight)+G;clearInterval(C.timer);C.timer=setInterval(function(){s.fade(1)},w)},pos:function(J){var I=u?event.clientY+document.documentElement.scrollTop:J.pageY;var t=u?event.clientX+document.documentElement.scrollLeft:J.pageX;C.style.top=I+15+"px";C.style.left=(t+x)+"px"},fade:function(J){var t=z;if((t!=B&&J==1)||(t!=0&&J==-1)){var I=y;if(B-t0){var w=null;for(var v=0;v0?o.name:o.parent.name,200)}}}else{if(o){o.material.emissive.setHex(o.currentHex);m.render(h,l)}o=null;if(a.gStyle.Tooltip){s.hide()}}}c(m.domElement).on("touchstart mousedown",function(t){if(a.gStyle.Tooltip){s.hide()}t.preventDefault();var u=t;if("changedTouches" in t){u=t.changedTouches[0]}else{if("touches" in t){u=t.touches[0]}else{if("originalEvent" in t){if("changedTouches" in t.originalEvent){u=t.originalEvent.changedTouches[0]}else{if("touches" in t.originalEvent){u=t.originalEvent.touches[0]}}}}}g=u.pageX;f=u.pageY;i=true});c(m.domElement).on("touchmove mousemove",function(x){if(i){var y=x;if("changedTouches" in x){y=x.changedTouches[0]}else{if("touches" in x){y=x.touches[0]}else{if("originalEvent" in x){if("changedTouches" in x.originalEvent){y=x.originalEvent.changedTouches[0]}else{if("touches" in x.originalEvent){y=x.originalEvent.touches[0]}}}}}var w=y.pageX-g;var v=y.pageY-f;if((v>0&&r.rotation.x-Math.PI/4)){r.rotation.x+=v*0.02}r.rotation.y+=w*0.02;m.render(h,l);g=y.pageX;f=y.pageY}else{x.preventDefault();var u="offsetX" in x.originalEvent?x.originalEvent.offsetX:x.originalEvent.layerX;var t="offsetY" in x.originalEvent?x.originalEvent.offsetY:x.originalEvent.layerY;k.x=(u/m.domElement.width)*2-1;k.y=-(t/m.domElement.height)*2+1;q()}});c(m.domElement).on("touchend mouseup",function(t){i=false});c(m.domElement).on("mousewheel",function(t,u){t.preventDefault();l.position.z+=u*20;m.render(h,l)});c(m.domElement).on("contextmenu",function(t){t.preventDefault();if(a.gStyle.Tooltip){s.hide()}a.Painter.createMenu(function(u){if(p){u.add("header:"+p.histo.fName)}u.add(a.gStyle.Tooltip?"Disable tooltip":"Enable tooltip",function(){a.gStyle.Tooltip=!a.gStyle.Tooltip;s.hide()});if(p){u.add("Switch to 2D",function(){c(p.svg_pad().node()).show().parent().find(m.domElement).remove();s.hide();p.Draw2D()})}u.add("Close");u.show(t.originalEvent)})})};a.Painter.real_drawHistogram2D=function(o){var ad=o.pad_width(),al=o.pad_height(),q=100;var t=o.xmin,ab=o.xmax;if(o.zoom_xmin!=o.zoom_xmax){t=o.zoom_xmin;ab=o.zoom_xmax}var U=o.ymin,m=o.ymax;if(o.zoom_ymin!=o.zoom_ymax){U=o.zoom_ymin;m=o.zoom_ymax}var aj,H,ah,G,af,E;if(o.options.Logx){aj=b.scale.log().domain([t,ab]).range([-q,q]);H=b.scale.log().domain([-q,q]).range([t,ab])}else{aj=b.scale.linear().domain([t,ab]).range([-q,q]);H=b.scale.linear().domain([-q,q]).range([t,ab])}if(o.options.Logy){ah=b.scale.log().domain([U,m]).range([-q,q]);G=b.scale.log().domain([q,-q]).range([U,m])}else{ah=b.scale.linear().domain([U,m]).range([-q,q]);G=b.scale.linear().domain([q,-q]).range([U,m])}if(o.options.Logz){af=b.scale.log().domain([o.gminbin,Math.ceil(o.gmaxbin/100)*105]).range([0,q*2]);E=b.scale.log().domain([0,q*2]).range([o.gminbin,Math.ceil(o.gmaxbin/100)*105])}else{af=b.scale.linear().domain([o.gminbin,Math.ceil(o.gmaxbin/100)*105]).range([0,q*2]);E=b.scale.linear().domain([0,q*2]).range([o.gminbin,Math.ceil(o.gmaxbin/100)*105])}var P=(q*2/o.nbinsx)/o.gmaxbin;var O=(q*2/o.nbinsy)/o.gmaxbin;var Y=(o.options.Color>0);var r=b.rgb(a.Painter.root_colors[o.histo.fFillColor]);var N=o.CreateDrawBins(100,100,2,(a.gStyle.Tooltip?1:0));var Q=new THREE.Scene();var D=new THREE.Object3D();D.rotation.x=30*Math.PI/180;D.rotation.y=30*Math.PI/180;Q.add(D);var e=new THREE.MeshBasicMaterial({color:0,wireframe:true,wireframeLinewidth:0.5,side:THREE.DoubleSide});var f=new THREE.Mesh(new THREE.BoxGeometry(q*2,q*2,q*2),e);var x=new THREE.BoxHelper(f);x.material.color.set(0);var p=new THREE.Object3D();p.add(x);p.position.y=q;D.add(p);var C=new THREE.MeshBasicMaterial({color:0});var F=new THREE.Geometry();var S,am,M=3,J,K=Math.sin(45);var I,R;var B=aj.ticks(8);var aa=aj.ticks(50);for(var ak=-q,ai=0,ag=0;akB[ai])?true:false;var V=(H(ak)<=aa[ag]&&H(ak+1)>aa[ag])?true:false;J=(ae?M+2:M)*K;if(ae){I=new THREE.TextGeometry(B[ai],{size:7,height:0,curveSegments:10});++ai;I.computeBoundingBox();var g=0.5*(I.boundingBox.max.x-I.boundingBox.min.x);R=new THREE.Mesh(I,C);R.position.set(ak-g,-13,q+J);D.add(R);R=new THREE.Mesh(I,C);R.position.set(ak+g,-13,-q-J);R.rotation.y=Math.PI;D.add(R)}if(ae||V){++ag;F.vertices.push(new THREE.Vector3(ak,0,q));F.vertices.push(new THREE.Vector3(ak,-J,q+J));F.vertices.push(new THREE.Vector3(ak,0,-q));F.vertices.push(new THREE.Vector3(ak,-J,-q-J))}}var A=ah.ticks(8);var Z=ah.ticks(50);for(var ak=q,ai=0,ag=0;ak>-q;--ak){var ae=(G(ak)<=A[ai]&&G(ak-1)>A[ai])?true:false;var V=(G(ak)<=Z[ag]&&G(ak-1)>Z[ag])?true:false;J=(ae?M+2:M)*K;if(ae){I=new THREE.TextGeometry(A[ai],{size:7,height:0,curveSegments:10});++ai;I.computeBoundingBox();var g=0.5*(I.boundingBox.max.x-I.boundingBox.min.x);R=new THREE.Mesh(I,C);R.position.set(q+J,-13,ak+g);R.rotation.y=Math.PI/2;D.add(R);R=new THREE.Mesh(I,C);R.position.set(-q-J,-13,ak-g);R.rotation.y=-Math.PI/2;D.add(R)}if(ae||V){++ag;F.vertices.push(new THREE.Vector3(q,0,ak));F.vertices.push(new THREE.Vector3(q+J,-J,ak));F.vertices.push(new THREE.Vector3(-q,0,ak));F.vertices.push(new THREE.Vector3(-q-J,-J,ak))}}var z=af.ticks(8);var X=af.ticks(50);for(var ak=0,ai=0,ag=0;ak<(q*2);++ak){var ae=(E(ak)<=z[ai]&&E(ak+1)>z[ai])?true:false;var V=(E(ak)<=X[ag]&&E(ak+1)>X[ag])?true:false;J=(ae?M+2:M)*K;if(ae){I=new THREE.TextGeometry(z[ai],{size:7,height:0,curveSegments:10});++ai;I.computeBoundingBox();var ac=0.8*(I.boundingBox.max.x-I.boundingBox.min.x);R=new THREE.Mesh(I,C);R.position.set(q+ac+5,ak-2.5,q+ac+5);R.rotation.y=Math.PI*3/4;D.add(R);R=new THREE.Mesh(I,C);R.position.set(q+ac+5,ak-2.5,-q-ac-5);R.rotation.y=-Math.PI*3/4;D.add(R);R=new THREE.Mesh(I,C);R.position.set(-q-ac-5,ak-2.5,q+ac+5);R.rotation.y=Math.PI/4;D.add(R);R=new THREE.Mesh(I,C);R.position.set(-q-ac-5,ak-2.5,-q-ac-5);R.rotation.y=-Math.PI/4;D.add(R)}if(ae||V){++ag;F.vertices.push(new THREE.Vector3(q,ak,q));F.vertices.push(new THREE.Vector3(q+J,ak,q+J));F.vertices.push(new THREE.Vector3(q,ak,-q));F.vertices.push(new THREE.Vector3(q+J,ak,-q-J));F.vertices.push(new THREE.Vector3(-q,ak,q));F.vertices.push(new THREE.Vector3(-q-J,ak,q+J));F.vertices.push(new THREE.Vector3(-q,ak,-q));F.vertices.push(new THREE.Vector3(-q-J,ak,-q-J))}}var y=new THREE.LineBasicMaterial({color:0});var s=new THREE.Line(F,y);s.type=THREE.LinePieces;D.add(s);var v=new THREE.Color(14540253);v.setRGB(r.r/255,r.g/255,r.b/255);var u,n,an;for(var ak=0;akG){var f={x:m.fXaxis["fXmin"]+(T*M),y:m.fYaxis["fXmin"]+(S*K),z:m.fZaxis["fXmin"]+(Q*I),n:N};ar.push(f)}}}}var D=n.width(),V=n.height(),E=100;if(V<10){n.height(0.66*D);V=n.height()}if(aF){var aa=b.scale.log().domain([m.fXaxis["fXmin"],m.fXaxis["fXmax"]]).range([-E,E]);var aw=b.scale.log().domain([-E,E]).range([m.fXaxis["fXmin"],m.fXaxis["fXmax"]])}else{var aa=b.scale.linear().domain([m.fXaxis["fXmin"],m.fXaxis["fXmax"]]).range([-E,E]);var aw=b.scale.linear().domain([-E,E]).range([m.fXaxis["fXmin"],m.fXaxis["fXmax"]])}if(aE){var Z=b.scale.log().domain([m.fYaxis["fXmin"],m.fYaxis["fXmax"]]).range([-E,E]);var av=b.scale.log().domain([E,-E]).range([m.fYaxis["fXmin"],m.fYaxis["fXmax"]])}else{var Z=b.scale.linear().domain([m.fYaxis["fXmin"],m.fYaxis["fXmax"]]).range([-E,E]);var av=b.scale.linear().domain([E,-E]).range([m.fYaxis["fXmin"],m.fYaxis["fXmax"]])}if(aD){var Y=b.scale.log().domain([m.fZaxis["fXmin"],m.fZaxis["fXmax"]]).range([-E,E]);var au=b.scale.log().domain([-E,E]).range([m.fZaxis["fXmin"],m.fZaxis["fXmax"]])}else{var Y=b.scale.linear().domain([m.fZaxis["fXmin"],m.fZaxis["fXmax"]]).range([-E,E]);var au=b.scale.linear().domain([-E,E]).range([m.fZaxis["fXmin"],m.fZaxis["fXmax"]])}var C=new THREE.Scene();var O=new THREE.Object3D();O.rotation.x=30*Math.PI/180;O.rotation.y=30*Math.PI/180;C.add(O);var ab=new THREE.MeshBasicMaterial({color:0,wireframe:true,wireframeLinewidth:0.5,side:THREE.DoubleSide});var W=new THREE.Mesh(new THREE.BoxGeometry(E*2,E*2,E*2),ab);var X=new THREE.BoxHelper(W);X.material.color.set(0);O.add(X);var U=new THREE.MeshBasicMaterial({color:0});var am=new THREE.Geometry();var aB,ae,ai=3,ac,ay=Math.sin(45);var ao,aq;var R=aa.ticks(5);var e=aa.ticks(25);for(var T=-E,S=0,Q=0;T<=E;++T){var v=(aw(T)<=R[S]&&aw(T+1)>R[S])?true:false;var F=(aw(T)<=e[Q]&&aw(T+1)>e[Q])?true:false;ac=(v?ai+2:ai)*ay;if(v){ao=new THREE.TextGeometry(R[S],{size:7,height:0,curveSegments:10});++S;ao.computeBoundingBox();var l=0.5*(ao.boundingBox.max.x-ao.boundingBox.min.x);aq=new THREE.Mesh(ao,U);aq.position.set(T-l,-E-13,E+ac);O.add(aq);aq=new THREE.Mesh(ao,U);aq.position.set(T+l,-E-13,-E-ac);aq.rotation.y=Math.PI;O.add(aq)}if(v||F){++Q;am.vertices.push(new THREE.Vector3(T,-E,E));am.vertices.push(new THREE.Vector3(T,-E-ac,E+ac));am.vertices.push(new THREE.Vector3(T,-E,-E));am.vertices.push(new THREE.Vector3(T,-E-ac,-E-ac))}}var x=Z.ticks(5);var az=Z.ticks(25);for(var T=E,S=0,Q=0;T>-E;--T){var v=(av(T)<=x[S]&&av(T-1)>x[S])?true:false;var F=(av(T)<=az[Q]&&av(T-1)>az[Q])?true:false;ac=(v?ai+2:ai)*ay;if(v){ao=new THREE.TextGeometry(x[S],{size:7,height:0,curveSegments:10});++S;ao.computeBoundingBox();var l=0.5*(ao.boundingBox.max.x-ao.boundingBox.min.x);aq=new THREE.Mesh(ao,U);aq.position.set(E+ac,-E-13,T+l);aq.rotation.y=Math.PI/2;O.add(aq);aq=new THREE.Mesh(ao,U);aq.position.set(-E-ac,-E-13,T-l);aq.rotation.y=-Math.PI/2;O.add(aq)}if(v||F){++Q;am.vertices.push(new THREE.Vector3(E,-E,T));am.vertices.push(new THREE.Vector3(E+ac,-E-ac,T));am.vertices.push(new THREE.Vector3(-E,-E,T));am.vertices.push(new THREE.Vector3(-E-ac,-E-ac,T))}}var s=Y.ticks(5);var ap=Y.ticks(25);for(var T=-E,S=0,Q=0;T<=E;++T){var v=(au(T)<=s[S]&&au(T+1)>s[S])?true:false;var F=(au(T)<=ap[Q]&&au(T+1)>ap[Q])?true:false;ac=(v?ai+2:ai)*ay;if(v){ao=new THREE.TextGeometry(s[S],{size:7,height:0,curveSegments:10});++S;ao.computeBoundingBox();var q=0.6*(ao.boundingBox.max.x-ao.boundingBox.min.x);aq=new THREE.Mesh(ao,U);aq.position.set(E+q+7,T-2.5,E+q+7);aq.rotation.y=Math.PI*3/4;O.add(aq);aq=new THREE.Mesh(ao,U);aq.position.set(E+q+7,T-2.5,-E-q-7);aq.rotation.y=-Math.PI*3/4;O.add(aq);aq=new THREE.Mesh(ao,U);aq.position.set(-E-q-7,T-2.5,E+q+7);aq.rotation.y=Math.PI/4;O.add(aq);aq=new THREE.Mesh(ao,U);aq.position.set(-E-q-7,T-2.5,-E-q-7);aq.rotation.y=-Math.PI/4;O.add(aq)}if(v||F){++Q;am.vertices.push(new THREE.Vector3(E,T,E));am.vertices.push(new THREE.Vector3(E+ac,T,E+ac));am.vertices.push(new THREE.Vector3(E,T,-E));am.vertices.push(new THREE.Vector3(E+ac,T,-E-ac));am.vertices.push(new THREE.Vector3(-E,T,E));am.vertices.push(new THREE.Vector3(-E-ac,T,E+ac));am.vertices.push(new THREE.Vector3(-E,T,-E));am.vertices.push(new THREE.Vector3(-E-ac,T,-E-ac))}}var ax=new THREE.LineBasicMaterial({color:0});var o=new THREE.Line(am,ax);o.type=THREE.LinePieces;O.add(o);var B=(E*2/m.fXaxis["fNbins"])/r;var z=(E*2/m.fYaxis["fNbins"])/r;var y=(E*2/m.fZaxis["fNbins"])/r;var aA=(an.indexOf("colz")!=-1||an.indexOf("col")!=-1);var p=b.rgb(a.Painter.root_colors[m.fFillColor]);var ag=new THREE.Color(14540253);ag.setRGB(p.r/255,p.g/255,p.b/255);var u,A;for(var T=0;Ty: ["+ar[T].y.toPrecision(4)+", "+(ar[T].y+K).toPrecision(4)+"]
z: ["+ar[T].z.toPrecision(4)+", "+(ar[T].z+I).toPrecision(4)+"]
entries: "+ar[T].n.toFixed();O.add(u)}var P=new THREE.PointLight(13619151);P.position.set(0,50,250);C.add(P);var at=new THREE.PerspectiveCamera(45,D/V,1,1000);at.position.set(0,0,500);at.lookat=W;var g={canvas:!!window.CanvasRenderingContext2D,webgl:(function(){try{return !!window.WebGLRenderingContext&&!!document.createElement("canvas").getContext("experimental-webgl")}catch(h){return false}})(),workers:!!window.Worker,fileapi:window.File&&window.FileReader&&window.FileList&&window.Blob};var ad=g.webgl?new THREE.WebGLRenderer({antialias:true}):new THREE.CanvasRenderer({antialias:true});ad.setClearColor(16777215,1);ad.setSize(D,V);n.append(ad.domElement);ad.render(C,at);a.Painter.add3DInteraction(ad,C,at,O,null);return af.DrawingReady()};return a.Painter})); \ No newline at end of file diff --git a/js/scripts/JSRootCore.js b/js/scripts/JSRootCore.js new file mode 100755 index 0000000..2c52ba6 --- /dev/null +++ b/js/scripts/JSRootCore.js @@ -0,0 +1,2491 @@ +/// @file JSRootCore.js +/// Core methods of JavaScript ROOT + +/// @namespace JSROOT +/// Holder of all JSROOT functions and classes + +(function( factory ) { + if ( typeof define === "function" && define.amd ) { + + var dir = "scripts"; + var scripts = document.getElementsByTagName('script'); + for (var n in scripts) { + if (scripts[n]['type'] != 'text/javascript') continue; + var src = scripts[n]['src']; + if ((src == null) || (src.length == 0)) continue; + var pos = src.indexOf("scripts/JSRootCore."); + if (pos>=0) { + dir = src.substr(0, pos+7); + break; + } + } + + // first configure all dependencies + requirejs.config({ + baseUrl: dir, + paths: { + 'd3' : 'd3.v3.min', + 'helvetiker_bold' : 'helvetiker_bold.typeface', + 'jquery' : 'jquery.min', + 'jquery-ui' : 'jquery-ui.min', + 'touch-punch' : 'touch-punch.min', + 'MathJax' : 'https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_SVG&delayStartupUntil=configured', + 'THREE' : 'helvetiker_regular.typeface' + }, + shim: { + helvetiker_bold: { + deps: ['three.min'] + }, + THREE: { + deps: ['helvetiker_bold'] + }, + MathJax: { + exports: "MathJax", + init: function () { + MathJax.Hub.Config({ TeX: { extensions: ["color.js"] }}); + MathJax.Hub.Register.StartupHook("SVG Jax Ready",function () { + var VARIANT = MathJax.OutputJax.SVG.FONTDATA.VARIANT; + VARIANT["normal"].fonts.unshift("MathJax_SansSerif"); + VARIANT["bold"].fonts.unshift("MathJax_SansSerif-bold"); + VARIANT["italic"].fonts.unshift("MathJax_SansSerif"); + VARIANT["-tex-mathit"].fonts.unshift("MathJax_SansSerif"); + }); + MathJax.Hub.Startup.onload(); + return MathJax; + } + } + } + }); + + // AMD. Register as an anonymous module. + define( factory ); + } else { + + if (typeof JSROOT != 'undefined') { + var e1 = new Error("JSROOT is already defined"); + e1.source = "JSRootCore.js"; + throw e1; + } + + JSROOT = {}; + + // Browser globals + factory(JSROOT); + } +} (function(JSROOT) { + + JSROOT.version = "3.7 22/07/2015"; + + JSROOT.source_dir = ""; + JSROOT.source_min = false; + + JSROOT.id_counter = 0; + + JSROOT.touches = ('ontouchend' in document); // identify if touch events are supported + + JSROOT.browser = {}; + + JSROOT.browser.isOpera = !!window.opera || navigator.userAgent.indexOf(' OPR/') >= 0; + JSROOT.browser.isFirefox = typeof InstallTrigger !== 'undefined'; + JSROOT.browser.isSafari = Object.prototype.toString.call(window.HTMLElement).indexOf('Constructor') > 0; + JSROOT.browser.isChrome = !!window.chrome && !JSROOT.browser.isOpera; + JSROOT.browser.isIE = false || !!document.documentMode; + JSROOT.browser.isWebKit = JSROOT.browser.isChrome || JSROOT.browser.isSafari; + + JSROOT.function_list = []; // do we really need it here? + + JSROOT.MathJax = 0; // indicate usage of mathjax 0 - off, 1 - on + + JSROOT.BIT = function(n) { return 1 << (n); } + + // TH1 status bits + JSROOT.TH1StatusBits = { + kNoStats : JSROOT.BIT(9), // don't draw stats box + kUserContour : JSROOT.BIT(10), // user specified contour levels + kCanRebin : JSROOT.BIT(11), // can rebin axis + kLogX : JSROOT.BIT(15), // X-axis in log scale + kIsZoomed : JSROOT.BIT(16), // bit set when zooming on Y axis + kNoTitle : JSROOT.BIT(17), // don't draw the histogram title + kIsAverage : JSROOT.BIT(18) // Bin contents are average (used by Add) + }; + + JSROOT.EAxisBits = { + kTickPlus : JSROOT.BIT(9), + kTickMinus : JSROOT.BIT(10), + kAxisRange : JSROOT.BIT(11), + kCenterTitle : JSROOT.BIT(12), + kCenterLabels : JSROOT.BIT(14), + kRotateTitle : JSROOT.BIT(15), + kPalette : JSROOT.BIT(16), + kNoExponent : JSROOT.BIT(17), + kLabelsHori : JSROOT.BIT(18), + kLabelsVert : JSROOT.BIT(19), + kLabelsDown : JSROOT.BIT(20), + kLabelsUp : JSROOT.BIT(21), + kIsInteger : JSROOT.BIT(22), + kMoreLogLabels : JSROOT.BIT(23), + kDecimals : JSROOT.BIT(11) + }; + + // wrapper for console.log, avoids missing console in IE + // if divid specified, provide output to the HTML element + JSROOT.console = function(value, divid) { + if ((divid!=null) && (typeof document.getElementById(divid)!='undefined')) + document.getElementById(divid).innerHTML = value; + else + if ((typeof console != 'undefined') && (typeof console.log == 'function')) + console.log(value); + } + + // This is part of the JSON-R code, found on + // https://github.com/graniteds/jsonr + // Only unref part was used, arrays are not accounted as objects + // Should be used to reintroduce objects references, produced by TBufferJSON + JSROOT.JSONR_unref = function(value, dy) { + var c, i, k, ks; + if (!dy) dy = []; + + switch (typeof value) { + case 'string': + if ((value.length > 5) && (value.substr(0, 5) == "$ref:")) { + c = parseInt(value.substr(5)); + if (!isNaN(c) && (c < dy.length)) { + value = dy[c]; + } + } + break; + + case 'object': + if (value !== null) { + + if (Object.prototype.toString.apply(value) === '[object Array]') { + for (i = 0; i < value.length; i++) { + value[i] = this.JSONR_unref(value[i], dy); + } + } else { + + // account only objects in ref table + if (dy.indexOf(value) === -1) { + dy.push(value); + } + + // add methods to all objects, where _typename is specified + if ('_typename' in value) this.addMethods(value); + + ks = Object.keys(value); + for (i = 0; i < ks.length; i++) { + k = ks[i]; + value[k] = this.JSONR_unref(value[k], dy); + } + } + } + break; + } + + return value; + } + + JSROOT.debug = 0; + + // This should be similar to the jQuery.extend method + // Just copy (not clone) all fields from source to the target object + JSROOT.extend = function(tgt, src, map) { + if (!map) map = { obj:[], clones:[] }; + + if (typeof src != 'object') return src; + + if (src == null) return null; + + var i = map.obj.indexOf(src); + if (i>=0) return map.clones[i]; + + // process array + if (Object.prototype.toString.apply(src) === '[object Array]') { + if ((tgt==null) || (Object.prototype.toString.apply(tgt) != '[object Array]')) { + tgt = []; + map.obj.push(src); + map.clones.push(tgt); + } + + for (i = 0; i < src.length; i++) + tgt.push(JSROOT.extend(null, src[i], map)); + + return tgt; + } + + if ((tgt==null) || (typeof tgt != 'object')) { + tgt = {}; + map.obj.push(src); + map.clones.push(tgt); + } + + for (var k in src) + tgt[k] = JSROOT.extend(tgt[k], src[k], map); + + return tgt; + } + + // Instead of jquery use JSROOT.extend function + JSROOT.clone = function(obj) { + return JSROOT.extend(null, obj); + } + + JSROOT.parse = function(arg) { + if ((arg==null) || (arg=="")) return null; + var obj = JSON.parse(arg); + if (obj!=null) obj = this.JSONR_unref(obj); + return obj; + } + + JSROOT.GetUrlOption = function(opt, url, dflt) { + // analyzes document.URL and extracts options after '?' mark + // following options supported ?opt1&opt2=3 + // In case of opt1 empty string will be returned, in case of opt2 '3' + // If option not found, null is returned (or provided default value) + + if ((opt==null) || (typeof opt != 'string') || (opt.length==0)) return dflt; + + if (!url) url = document.URL; + + var pos = url.indexOf("?"); + if (pos<0) return dflt; + url = url.slice(pos+1); + + while (url.length>0) { + + if (url==opt) return ""; + + pos = url.indexOf("&"); + if (pos < 0) pos = url.length; + + if (url.indexOf(opt) == 0) { + if (url.charAt(opt.length)=="&") return ""; + + // replace several symbols which are known to make a problem + if (url.charAt(opt.length)=="=") + return url.slice(opt.length+1, pos).replace(/%27/g, "'").replace(/%22/g, '"').replace(/%20/g, ' ').replace(/%3C/g, '<').replace(/%3E/g, '>').replace(/%5B/g, '[').replace(/%5D/g, ']'); + } + + url = url.slice(pos+1); + } + return dflt; + } + + JSROOT.ParseAsArray = function(val) { + // parse string value as array. + // It could be just simple string: "value" + // or array with or without string quotes: [element], ['eleme1',elem2] + + var res = []; + + if (typeof val != 'string') return res; + + val = val.trim(); + if (val=="") return res; + + // return as array with single element + if ((val.length<2) || (val[0]!='[') || (val[val.length-1]!=']')) { + res.push(val); return res; + } + + // try to parse ourself + var arr = val.substr(1, val.length-2).split(","); // remove brackets + + for (var i in arr) { + var sub = arr[i].trim(); + if ((sub.length>1) && (sub[0]==sub[sub.length-1]) && ((sub[0]=='"') || (sub[0]=="'"))) + sub = sub.substr(1, sub.length-2); + res.push(sub); + } + return res; + } + + JSROOT.GetUrlOptionAsArray = function(opt, url) { + // special handling of URL options to produce array + // if normal option is specified ...?opt=abc, than array with single element will be created + // one could specify normal JSON array ...?opt=['item1','item2'] + // but also one could skip quotes ...?opt=[item1,item2] + // one could collect values from several options, specifying + // options names via semicolon like opt='item;items' + + var res = []; + + while (opt.length>0) { + var separ = opt.indexOf(";"); + var part = separ>0 ? opt.substr(0, separ) : opt; + if (separ>0) opt = opt.substr(separ+1); else opt = ""; + + var val = this.GetUrlOption(part, url, null); + res = res.concat(JSROOT.ParseAsArray(val)); + } + return res; + } + + JSROOT.findFunction = function(name) { + var func = window[name]; + if (typeof func == 'function') return func; + var separ = name.lastIndexOf("."); + if (separ<0) return null; + var namespace = name.slice(0, separ); + name = name.slice(separ+1); + if (namespace=="JSROOT") func = this[name]; else + if (namespace=="JSROOT.Painter") { if ('Painter' in this) func = this['Painter'][name]; } else + if (window[namespace]) func = window[namespace][name]; + return (typeof func == 'function') ? func : null; + } + + JSROOT.CallBack = function(func, arg1, arg2) { + // generic method to invoke callback function + // func either normal function or container like + // { obj: object_pointer, func: name of method to call } + // { _this: object pointer, func: function to call } + // arg1, arg2 are optional arguments of the callback + + if (func == null) return; + + if (typeof func == 'string') func = JSROOT.findFunction(func); + + if (typeof func == 'function') return func(arg1,arg2); + + if (typeof func != 'object') return; + + if (('obj' in func) && ('func' in func) && + (typeof func.obj == 'object') && (typeof func.func == 'string') && + (typeof func.obj[func.func] == 'function')) return func.obj[func.func](arg1, arg2); + + if (('_this' in func) && ('func' in func) && + (typeof func.func == 'function')) return func.func.call(func._this, arg1, arg2); + } + + JSROOT.NewHttpRequest = function(url, kind, user_call_back) { + // Create asynchronous XMLHttpRequest object. + // One should call req.send() to submit request + // kind of the request can be: + // "bin" - abstract binary data (default) + // "text" - returns req.responseText + // "object" - returns JSROOT.parse(req.responseText) + // "xml" - returns res.responseXML + // "head" - returns request itself, uses "HEAD" method + // Result will be returned to the callback functions + // Request will be set as this pointer in the callback + // If failed, request returns null + + var xhr = new XMLHttpRequest(); + + function callback(res) { + // we set pointer on request when calling callback + if (typeof user_call_back == 'function') user_call_back.call(xhr, res); + } + + var pthis = this; + + if (window.ActiveXObject) { + + xhr.onreadystatechange = function() { + if (xhr.readyState != 4) return; + + if (xhr.status != 200 && xhr.status != 206) { + // error + return callback(null); + } + + if (kind == "xml") return callback(xhr.responseXML); + if (kind == "text") return callback(xhr.responseText); + if (kind == "object") return callback(pthis.parse(xhr.responseText)); + if (kind == "head") return callback(xhr); + + var filecontent = new String(""); + var array = new VBArray(xhr.responseBody).toArray(); + for (var i = 0; i < array.length; i++) { + filecontent = filecontent + String.fromCharCode(array[i]); + } + + callback(filecontent); + filecontent = null; + } + + xhr.open(kind == 'head' ? 'HEAD' : 'GET', url, true); + + } else { + + xhr.onreadystatechange = function() { + if (xhr.readyState != 4) return; + + if (xhr.status != 200 && xhr.status != 206) { + return callback(null); + } + + if (kind == "xml") return callback(xhr.responseXML); + if (kind == "text") return callback(xhr.responseText); + if (kind == "object") return callback(pthis.parse(xhr.responseText)); + if (kind == "head") return callback(xhr); + + var HasArrayBuffer = ('ArrayBuffer' in window && 'Uint8Array' in window); + var Buf, filecontent; + if (HasArrayBuffer && 'mozResponse' in xhr) { + Buf = xhr.mozResponse; + } else if (HasArrayBuffer && xhr.mozResponseArrayBuffer) { + Buf = xhr.mozResponseArrayBuffer; + } else if ('responseType' in xhr) { + Buf = xhr.response; + } else { + Buf = xhr.responseText; + HasArrayBuffer = false; + } + + if (HasArrayBuffer) { + filecontent = new String(""); + var bLen = Buf.byteLength; + var u8Arr = new Uint8Array(Buf, 0, bLen); + for (var i = 0; i < u8Arr.length; i++) { + filecontent = filecontent + String.fromCharCode(u8Arr[i]); + } + delete u8Arr; + } else { + filecontent = Buf; + } + + callback(filecontent); + + filecontent = null; + } + + xhr.open(kind == 'head' ? 'HEAD' : 'GET', url, true); + + if (kind == "bin") { + var HasArrayBuffer = ('ArrayBuffer' in window && 'Uint8Array' in window); + if (HasArrayBuffer && 'mozResponseType' in xhr) { + xhr.mozResponseType = 'arraybuffer'; + } else if (HasArrayBuffer && 'responseType' in xhr) { + xhr.responseType = 'arraybuffer'; + } else { + //XHR binary charset opt by Marcus Granado 2006 [http://mgran.blogspot.com] + xhr.overrideMimeType("text/plain; charset=x-user-defined"); + } + } + } + return xhr; + } + + JSROOT.loadScript = function(urllist, callback, debugout) { + // dynamic script loader using callback + // (as loading scripts may be asynchronous) + // one could specify list of scripts or style files, separated by semicolon ';' + // one can prepend file name with '$$$' - than file will be loaded from JSROOT location + // This location can be set by JSROOT.source_dir or it will be detected automatically + // by the position of JSRootCore.js file, which must be loaded by normal methods: + // + + function completeLoad() { + if ((urllist!=null) && (urllist.length>0)) + return JSROOT.loadScript(urllist, callback, debugout); + + if (debugout) + document.getElementById(debugout).innerHTML = ""; + + JSROOT.CallBack(callback); + } + + if ((urllist==null) || (urllist.length==0)) + return completeLoad(); + + var filename = urllist; + var separ = filename.indexOf(";"); + if (separ>0) { + filename = filename.substr(0, separ); + urllist = urllist.slice(separ+1); + } else { + urllist = ""; + } + + var isrootjs = false; + if (filename.indexOf("$$$")==0) { + isrootjs = true; + filename = filename.slice(3); + if ((filename.indexOf("style/")==0) && JSROOT.source_min && + (filename.lastIndexOf('.css')==filename.length-3) && + (filename.indexOf('.min.css')<0)) + filename = filename.slice(0, filename.length-4) + '.min.css'; + } + var isstyle = filename.indexOf('.css') > 0; + + if (isstyle) { + var styles = document.getElementsByTagName('link'); + for (var n in styles) { + if ((styles[n]['type'] != 'text/css') || (styles[n]['rel'] != 'stylesheet')) continue; + + var href = styles[n]['href']; + if ((href == null) || (href.length == 0)) continue; + + if (href.indexOf(filename)>=0) return completeLoad(); + } + + } else { + var scripts = document.getElementsByTagName('script'); + + for (var n in scripts) { + if (scripts[n]['type'] != 'text/javascript') continue; + + var src = scripts[n]['src']; + if ((src == null) || (src.length == 0)) continue; + + if ((src.indexOf(filename)>=0) && (src.indexOf("load=")<0)) { + // avoid wrong decision when script name is specified as more argument + return completeLoad(); + } + } + } + + if (isrootjs && (JSROOT.source_dir!=null)) filename = JSROOT.source_dir + filename; + + var element = null; + + JSROOT.console("loading " + filename + " ...", debugout); + + if (isstyle) { + element = document.createElement("link"); + element.setAttribute("rel", "stylesheet"); + element.setAttribute("type", "text/css"); + element.setAttribute("href", filename); + } else { + element = document.createElement("script"); + element.setAttribute('type', "text/javascript"); + element.setAttribute('src', filename); + } + + if (element.readyState) { // Internet Explorer specific + element.onreadystatechange = function() { + if (element.readyState == "loaded" || element.readyState == "complete") { + element.onreadystatechange = null; + completeLoad(); + } + } + } else { // Other browsers + element.onload = function() { + element.onload = null; + completeLoad(); + } + } + + document.getElementsByTagName("head")[0].appendChild(element); + } + + JSROOT.AssertPrerequisites = function(kind, callback, debugout) { + // one could specify kind of requirements + // 'io' for I/O functionality (default) + // '2d' for 2d graphic + // 'jq' jQuery and jQuery-ui + // 'jq2d' jQuery-dependend part of 2d graphic + // '3d' for 3d graphic + // 'simple' for basic user interface + // 'load:' list of user-specific scripts at the end of kind string + + var jsroot = this; + + if ((typeof kind != 'string') || (kind == '')) + return jsroot.CallBack(callback); + + if (kind=='shift') { + var req = jsroot.doing_assert.shift(); + kind = req._kind; + callback = req._callback; + debugout = req._debug; + } else + if (jsroot.doing_assert != null) { + // if function already called, store request + return jsroot.doing_assert.push({_kind:kind, _callback:callback, _debug: debugout}); + } else { + jsroot.doing_assert = []; + } + + if (kind.charAt(kind.length-1)!=";") kind+=";"; + + var ext = jsroot.source_min ? ".min" : ""; + + var need_jquery = false; + + // file names should be separated with ';' + var mainfiles = "", extrafiles = ""; // scripts for direct loadin + var modules = []; // modules used for require.js + + if (kind.indexOf('io;')>=0) { + mainfiles += "$$$scripts/rawinflate" + ext + ".js;" + + "$$$scripts/JSRootIOEvolution" + ext + ".js;"; + modules.push('JSRootIOEvolution'); + } + + if (kind.indexOf('2d;')>=0) { + if (typeof d3 != 'undefined') + jsroot.console('Reuse existing d3.js ' + d3.version + ", required 3.4.10", debugout); + else + mainfiles += '$$$scripts/d3.v3.min.js;'; + modules.push('JSRootPainter'); + mainfiles += '$$$scripts/JSRootPainter' + ext + ".js;"; + extrafiles += '$$$style/JSRootPainter' + ext + '.css;'; + } + + if (kind.indexOf('jq;')>=0) need_jquery = true; + + if (kind.indexOf('jq2d;')>=0) { + mainfiles += '$$$scripts/JSRootPainter.jquery' + ext + ".js;"; + modules.push('JSRootPainter.jquery'); + need_jquery = true; + } + + if (kind.indexOf("3d;")>=0) { + need_jquery = true; + mainfiles += "$$$scripts/jquery.mousewheel" + ext + ".js;" + + "$$$scripts/three.min.js;" + + "$$$scripts/helvetiker_regular.typeface.js;" + + "$$$scripts/helvetiker_bold.typeface.js;" + + "$$$scripts/JSRoot3DPainter" + ext + ".js;"; + modules.push('JSRoot3DPainter'); + } + + if (kind.indexOf("mathjax;")>=0) { + if (typeof MathJax == 'undefined') { + mainfiles += "https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_SVG," + + jsroot.source_dir + "scripts/mathjax_config.js;"; + } + if (JSROOT.MathJax == 0) JSROOT.MathJax = 1; + modules.push('MathJax'); + } + + if (kind.indexOf("simple;")>=0) { + need_jquery = true; + mainfiles += '$$$scripts/JSRootInterface' + ext + ".js;"; + extrafiles += '$$$style/JSRootInterface' + ext + '.css;'; + modules.push('JSRootInterface'); + } + + if (need_jquery && (JSROOT.load_jquery==null)) { + var has_jq = (typeof jQuery != 'undefined'), lst_jq = ""; + + if (has_jq) + jsroot.console('Reuse existing jQuery ' + jQuery.fn.jquery + ", required 2.1.1", debugout); + else + lst_jq += "$$$scripts/jquery.min.js;"; + if (has_jq && typeof $.ui != 'undefined') + jsroot.console('Reuse existing jQuery-ui ' + $.ui.version + ", required 1.11.0", debugout); + else { + lst_jq += '$$$scripts/jquery-ui.min.js;'; + extrafiles += '$$$style/jquery-ui' + ext + '.css;'; + } + + if (JSROOT.touches) { + lst_jq += '$$$scripts/touch-punch.min.js;'; + modules.push('touch-punch'); + } + + modules.splice(0,0, 'jquery', 'jquery-ui'); + mainfiles = lst_jq + mainfiles; + + jsroot.load_jquery = true; + } + + var pos = kind.indexOf("user:"); + if (pos<0) pos = kind.indexOf("load:"); + if (pos>=0) extrafiles += kind.slice(pos+5); + + var load_callback = function() { + if (jsroot.doing_assert.length==0) jsroot.doing_assert = null; + jsroot.CallBack(callback); + if (jsroot.doing_assert && (jsroot.doing_assert.length>0)) { + jsroot.AssertPrerequisites('shift'); + } + } + + if ((typeof define === "function") && define.amd && (modules.length>0)) { + jsroot.console("loading " + modules + " with require.js", debugout); + require(modules, function() { + jsroot.loadScript(extrafiles, load_callback, debugout); + }); + } else { + jsroot.loadScript(mainfiles + extrafiles, load_callback, debugout); + } + } + + JSROOT.BuildSimpleGUI = function(user_scripts, andThen) { + + var jsroot = this; + + if (typeof user_scripts == 'function') { + andThen = user_scripts; + user_scripts = null; + } + + var debugout = null; + var nobrowser = jsroot.GetUrlOption('nobrowser')!=null; + var requirements = "io;2d;"; + + if (document.getElementById('simpleGUI')) { + debugout = 'simpleGUI'; + if ((jsroot.GetUrlOption('json')!=null) && + (jsroot.GetUrlOption('file')==null) && + (jsroot.GetUrlOption('files')==null)) requirements = "2d;"; + } else + if (document.getElementById('onlineGUI')) { debugout = 'onlineGUI'; requirements = "2d;"; } else + if (document.getElementById('drawGUI')) { debugout = 'drawGUI'; requirements = "2d;"; nobrowser = true; } + + if (user_scripts == 'check_existing_elements') { + user_scripts = null; + if (debugout == null) return; + } + + if (!nobrowser) requirements += 'jq2d;simple;'; + + if (user_scripts == null) user_scripts = jsroot.GetUrlOption("autoload"); + if (user_scripts == null) user_scripts = jsroot.GetUrlOption("load"); + + if (user_scripts != null) + requirements += "load:" + user_scripts + ";"; + + this.AssertPrerequisites(requirements, function() { + var func = jsroot.findFunction(nobrowser ? 'JSROOT.BuildNobrowserGUI' : 'BuildSimpleGUI'); + jsroot.CallBack(func); + jsroot.CallBack(andThen); + }, debugout); + } + + JSROOT.addFormula = function(obj) { + var formula = obj['fTitle']; + formula = formula.replace('abs(', 'Math.abs('); + formula = formula.replace('sin(', 'Math.sin('); + formula = formula.replace('cos(', 'Math.cos('); + var code = obj['fName'] + " = function(x) { return " + formula + " };"; + eval(code); + var sig = obj['fName']+'(x)'; + + var pos = JSROOT.function_list.indexOf(sig); + if (pos >= 0) { + JSROOT.function_list.splice(pos, 1); + } + JSROOT.function_list.push(sig); + } + + JSROOT.Create = function(typename, target) { + var obj = target; + if (obj == null) + obj = { _typename: typename }; + + if (typename == 'TObject') + JSROOT.extend(obj, { fUniqueID: 0, fBits: 0x3000008 }); + else + if (typename == 'TNamed') + JSROOT.extend(obj, { fUniqueID: 0, fBits: 0x3000008, fName: "", fTitle: "" }); + else + if ((typename == 'TList') || (typename == 'THashList')) + JSROOT.extend(obj, { name: typename, arr : [], opt : [] }); + else + if (typename == 'TAttAxis') { + JSROOT.extend(obj, { fNdivisions: 510, fAxisColor: 1, + fLabelColor: 1, fLabelFont: 42, fLabelOffset: 0.005, fLabelSize: 0.035, fTickLength: 0.03, + fTitleOffset: 1, fTitleSize: 0.035, fTitleColor: 1, fTitleFont : 42 }); + } else + if (typename == 'TAxis') { + JSROOT.Create("TNamed", obj); + JSROOT.Create("TAttAxis", obj); + JSROOT.extend(obj, { fNbins: 0, fXmin: 0, fXmax: 0, fXbins : [], fFirst: 0, fLast: 0, + fBits2: 0, fTimeDisplay: false, fTimeFormat: "", fLabels: null }); + } else + if (typename == 'TAttLine') { + JSROOT.extend(obj, { fLineColor: 1, fLineStyle : 1, fLineWidth : 1 }); + } else + if (typename == 'TAttFill') { + JSROOT.extend(obj, { fFillColor: 0, fFillStyle : 0 } ); + } else + if (typename == 'TAttMarker') { + JSROOT.extend(obj, { fMarkerColor: 1, fMarkerStyle : 1, fMarkerSize : 1. }); + } else + if (typename == 'TBox') { + JSROOT.Create("TObject", obj); + JSROOT.Create("TAttLine", obj); + JSROOT.Create("TAttFill", obj); + JSROOT.extend(obj, { fX1: 0, fY1: 0, fX2: 1, fY2: 1 }); + } else + if (typename == 'TPave') { + JSROOT.Create("TBox", obj); + JSROOT.extend(obj, { fX1NDC : 0., fY1NDC: 0, fX2NDC: 1, fY2NDC: 1, + fBorderSize: 0, fInit: 1, fShadowColor: 1, + fCornerRadius: 0, fOption: "blNDC", fName: "title" }); + } else + if (typename == 'TAttText') { + JSROOT.extend(obj, { fTextAngle: 0, fTextSize: 0, fTextAlign: 22, fTextColor: 1, fTextFont: 42}); + } else + if (typename == 'TPaveText') { + JSROOT.Create("TPave", obj); + JSROOT.Create("TAttText", obj); + JSROOT.extend(obj, { fLabel: "", fLongest: 27, fMargin: 0.05, fLines: JSROOT.Create("TList") }); + } else + if (typename == 'TPaveStats') { + JSROOT.Create("TPaveText", obj); + JSROOT.extend(obj, { fOptFit: 0, fOptStat: 0, fFitFormat: "", fStatFormat: "", fParent: null }); + } else + if (typename == 'TObjString') { + JSROOT.Create("TObject", obj); + JSROOT.extend(obj, { fString: ""}); + } else + if (typename == 'TH1') { + JSROOT.Create("TNamed", obj); + JSROOT.Create("TAttLine", obj); + JSROOT.Create("TAttFill", obj); + JSROOT.Create("TAttMarker", obj); + + JSROOT.extend(obj, { + fNcells : 0, + fXaxis: JSROOT.Create("TAxis"), + fYaxis: JSROOT.Create("TAxis"), + fZaxis: JSROOT.Create("TAxis"), + fBarOffset : 0, fBarWidth : 1000, fEntries : 0., + fTsumw : 0., fTsumw2 : 0., fTsumwx : 0., fTsumwx2 : 0., + fMaximum : -1111., fMinimum : -1111, fNormFactor : 0., fContour : [], + fSumw2 : [], fOption : "", + fFunctions : JSROOT.Create("TList"), + fBufferSize : 0, fBuffer : [], fBinStatErrOpt : 0 }); + } else + if (typename == 'TH1I' || typename == 'TH1F' || typename == 'TH1D' || typename == 'TH1S' || typename == 'TH1C') { + JSROOT.Create("TH1", obj); + JSROOT.extend(obj, { fArray: [] }); + } else + if (typename == 'TH2') { + JSROOT.Create("TH1", obj); + JSROOT.extend(obj, { fScalefactor: 1., fTsumwy: 0., fTsumwy2: 0, fTsumwxy : 0}); + } else + if (typename == 'TH2I' || typename == 'TH2F' || typename == 'TH2D' || typename == 'TH2S' || typename == 'TH2C') { + JSROOT.Create("TH2", obj); + JSROOT.extend(obj, { fArray: [] }); + } else + if (typename == 'TGraph') { + JSROOT.Create("TNamed", obj); + JSROOT.Create("TAttLine", obj); + JSROOT.Create("TAttFill", obj); + JSROOT.Create("TAttMarker", obj); + JSROOT.extend(obj, { fFunctions: JSROOT.Create("TList"), fHistogram: JSROOT.CreateTH1(), + fMaxSize: 0, fMaximum:0, fMinimum:0, fNpoints: 0, fX: [], fY: [] }); + } + + JSROOT.addMethods(obj, typename); + return obj; + } + + // obsolete functions, can be removed by next JSROOT release + JSROOT.CreateTList = function() { return JSROOT.Create("TList"); } + JSROOT.CreateTAxis = function() { return JSROOT.Create("TAxis"); } + + JSROOT.CreateTH1 = function(nbinsx) { + var histo = JSROOT.Create("TH1I"); + JSROOT.extend(histo, { fName: "dummy_histo_" + this.id_counter++, fTitle: "dummytitle" }); + + if (nbinsx!=null) { + histo['fNcells'] = nbinsx+2; + for (var i=0;i0) { + graph['fMaxSize'] = graph['fNpoints'] = npoints; + for (var i=0;i maxx) maxx = graph['fX'][i]; + if (graph['fY'][i] < miny) miny = graph['fY'][i]; + if (graph['fY'][i] > maxy) maxy = graph['fY'][i]; + } + + if (miny==maxy) maxy = miny + 1; + + if (graph['fHistogram'] == null) graph['fHistogram'] = JSROOT.CreateTH1(graph['fNpoints']); + + graph['fHistogram']['fXaxis']['fXmin'] = minx; + graph['fHistogram']['fXaxis']['fXmax'] = maxx; + + if ((ygap!=null) && (ygap!=0)) { + if (miny>0) miny*= (1-2*ygap); else miny*=(1+ygap); + if (maxy>0) maxy*= (1+ygap); else maxy*=(1-2*ygap); + } + + graph['fHistogram']['fYaxis']['fXmin'] = miny; + graph['fHistogram']['fYaxis']['fXmax'] = maxy; + } + + JSROOT.addMethods = function(obj, obj_typename) { + // check object type and add methods if needed + if (('fBits' in obj) && !('TestBit' in obj)) { + obj['TestBit'] = function (f) { + return ((obj['fBits'] & f) != 0); + }; + } + + if (!obj_typename) { + if (!('_typename' in obj)) return; + obj_typename = obj['_typename']; + } + + var EBinErrorOpt = { + kNormal : 0, // errors with Normal (Wald) approximation: errorUp=errorLow= sqrt(N) + kPoisson : 1, // errors from Poisson interval at 68.3% (1 sigma) + kPoisson2 : 2 // errors from Poisson interval at 95% CL (~ 2 sigma) + }; + + var EErrorType = { + kERRORMEAN : 0, + kERRORSPREAD : 1, + kERRORSPREADI : 2, + kERRORSPREADG : 3 + }; + + if (obj_typename.indexOf("TAxis") == 0) { + obj['getFirst'] = function() { + if (!this.TestBit(JSROOT.EAxisBits.kAxisRange)) return 1; + return this['fFirst']; + }; + obj['getLast'] = function() { + if (!this.TestBit(JSROOT.EAxisBits.kAxisRange)) return this['fNbins']; + return this['fLast']; + }; + obj['getBinCenter'] = function(bin) { + // Return center of bin + var binwidth; + if (!this['fNbins'] || bin < 1 || bin > this['fNbins']) { + binwidth = (this['fXmax'] - this['fXmin']) / this['fNbins']; + return this['fXmin'] + (bin-1) * binwidth + 0.5*binwidth; + } else { + binwidth = this['fXbins'][bin] - this['fXbins'][bin-1]; + return this['fXbins'][bin-1] + 0.5*binwidth; + } + }; + } + + if ((obj_typename == 'TList') || (obj_typename == 'THashList')) { + obj['Clear'] = function() { + this['arr'] = new Array; + this['opt'] = new Array; + } + obj['Add'] = function(obj,opt) { + this['arr'].push(obj); + this['opt'].push((opt && typeof opt=='string') ? opt : ""); + } + obj['AddFirst'] = function(obj,opt) { + this['arr'].unshift(obj); + this['opt'].unshift((opt && typeof opt=='string') ? opt : ""); + } + obj['RemoveAt'] = function(indx) { + this['arr'].splice(indx, 1); + this['opt'].splice(indx, 1); + } + } + + if ((obj_typename == "TPaveText") || (obj_typename == "TPaveStats")) { + obj['AddText'] = function(txt) { + this['fLines'].Add({'fTitle' : txt, "fTextColor" : 1 }); + } + obj['Clear'] = function() { + this['fLines'].Clear(); + } + } + + if ((obj_typename.indexOf("TFormula") != -1) || + (obj_typename.indexOf("TF1") == 0)) { + obj['evalPar'] = function(x) { + var i, _function = this['fTitle']; + _function = _function.replace('TMath::Exp(', 'Math.exp('); + _function = _function.replace('TMath::Abs(', 'Math.abs('); + _function = _function.replace('gaus(', 'JSROOT.Math.gaus(this, ' + x + ', '); + _function = _function.replace('gausn(', 'JSROOT.Math.gausn(this, ' + x + ', '); + _function = _function.replace('expo(', 'JSROOT.Math.expo(this, ' + x + ', '); + _function = _function.replace('landau(', 'JSROOT.Math.landau(this, ' + x + ', '); + _function = _function.replace('landaun(', 'JSROOT.Math.landaun(this, ' + x + ', '); + _function = _function.replace('pi', 'Math.PI'); + for (i=0;i 0) { + res.xmin = res.xmax = this['fX'][0]; + res.ymin = res.ymax = this['fY'][0]; + for (var i=1; i res.xmax) res.xmax = this['fX'][i]; + if (this['fY'][i] < res.ymin) res.ymin = this['fY'][i]; + if (this['fY'][i] > res.ymax) res.ymax = this['fY'][i]; + } + } + return res; + }; + // check if point inside figure specified by the TGrpah + obj['IsInside'] = function(xp,yp) { + var j = this['fNpoints'] - 1 ; + var x = this['fX'], y = this['fY']; + var oddNodes = false; + + for (var i=0; i=yp) || (y[j]=yp)) { + if (x[i]+(yp-y[i])/(y[j]-y[i])*(x[j]-x[i])= this['fNcells']) bin = this['fNcells'] - 1; + if (this['fNcells'] && this['fSumw2'].length > 0) { + var err2 = this['fSumw2'][bin]; + return Math.sqrt(err2); + } + var error2 = Math.abs(this['fArray'][bin]); + return Math.sqrt(error2); + }; + obj['getBinErrorLow'] = function(bin) { + // -*-*-*-*-*Return lower error associated to bin number bin*-*-*-*-* + // The error will depend on the statistic option used will return + // the binContent - lower interval value + if (this['fBinStatErrOpt'] == EBinErrorOpt.kNormal) return this.getBinError(bin); + if (bin < 0) bin = 0; + if (bin >= this['fNcells']) bin = this['fNcells'] - 1; + var alpha = 1.0 - 0.682689492; + if (this['fBinStatErrOpt'] == EBinErrorOpt.kPoisson2) alpha = 0.05; + var c = this['fArray'][bin]; + var n = Math.round(c); + if (n < 0) { + alert("GetBinErrorLow : Histogram has negative bin content-force usage to normal errors"); + this['fBinStatErrOpt'] = EBinErrorOpt.kNormal; + return this.getBinError(bin); + } + if (n == 0) return 0; + return c - JSROOT.Math.gamma_quantile( alpha/2, n, 1.); + }; + obj['getBinErrorUp'] = function(bin) { + // -*-*-*-*-*Return lower error associated to bin number bin*-*-*-*-* + // The error will depend on the statistic option used will return + // the binContent - lower interval value + if (this['fBinStatErrOpt'] == EBinErrorOpt.kNormal) return this.getBinError(bin); + if (bin < 0) bin = 0; + if (bin >= this['fNcells']) bin = this['fNcells'] - 1; + var alpha = 1.0 - 0.682689492; + if (this['fBinStatErrOpt'] == EBinErrorOpt.kPoisson2) alpha = 0.05; + var c = this['fArray'][bin]; + var n = Math.round(c); + if (n < 0) { + alert("GetBinErrorLow : Histogram has negative bin content-force usage to normal errors"); + this['fBinStatErrOpt'] = EBinErrorOpt.kNormal; + return this.getBinError(bin); + } + // for N==0 return an upper limit at 0.68 or (1-alpha)/2 ? + // decide to return always (1-alpha)/2 upper interval + //if (n == 0) return ROOT::Math::gamma_quantile_c(alpha,n+1,1); + return JSROOT.Math.gamma_quantile_c( alpha/2, n+1, 1) - c; + }; + obj['getBinLowEdge'] = function(bin) { + // Return low edge of bin + if (this['fXaxis']['fXbins'].length && bin > 0 && bin <= this['fXaxis']['fNbins']) + return this['fXaxis']['fXbins']['fArray'][bin-1]; + var binwidth = (this['fXaxis']['fXmax'] - this['fXaxis']['fXmin']) / this['fXaxis']['fNbins']; + return this['fXaxis']['fXmin'] + (bin-1) * binwidth; + }; + obj['getBinUpEdge'] = function(bin) { + // Return up edge of bin + var binwidth; + if (!this['fXaxis']['fXbins'].length || bin < 1 || bin > this['fXaxis']['fNbins']) { + binwidth = (this['fXaxis']['fXmax'] - this['fXaxis']['fXmin']) / this['fXaxis']['fNbins']; + return this['fXaxis']['fXmin'] + bin * binwidth; + } else { + binwidth = this['fArray'][bin] - this['fArray'][bin-1]; + return this['fArray'][bin-1] + binwidth; + } + }; + obj['getBinWidth'] = function(bin) { + // Return bin width + if (this['fXaxis']['fNbins'] <= 0) return 0; + if (this['fXaxis']['fXbins'].length <= 0) + return (this['fXaxis']['fXmax'] - this['fXaxis']['fXmin']) / this['fXaxis']['fNbins']; + if (bin > this['fXaxis']['fNbins']) bin = this['fXaxis']['fNbins']; + if (bin < 1) bin = 1; + return this['fArray'][bin] - this['fArray'][bin-1]; + }; + obj['add'] = function(h1, c1) { + // Performs the operation: this = this + c1*h1 + // if errors are defined (see TH1::Sumw2), errors are also recalculated. + // Note that if h1 has Sumw2 set, Sumw2 is automatically called for this + // if not already set. + if (!h1 || typeof(h1) == 'undefined') { + alert("Add : Attempt to add a non-existing histogram"); + return false; + } + if (!c1 || typeof(c1) == 'undefined') c1 = 1; + var nbinsx = this['fXaxis']['fNbins'], + nbinsy = this['fYaxis']['fNbins'], + nbinsz = this['fZaxis']['fNbins']; + + if (this['fDimension'] < 2) nbinsy = -1; + if (this['fDimension'] < 3) nbinsz = -1; + + // Create Sumw2 if h1 has Sumw2 set + if (this['fSumw2'].length == 0 && h1['fSumw2'].length != 0) this.sumw2(); + + // - Add statistics + if (this['fEntries'] == NaN) this['fEntries'] = 0; + var entries = Math.abs( this['fEntries'] + c1 * h1['fEntries'] ); + + // statistics can be preserved only in case of positive coefficients + // otherwise with negative c1 (histogram subtraction) one risks to get negative variances + var resetStats = (c1 < 0); + var s1, s2; + if (!resetStats) { + // need to initialize to zero s1 and s2 since + // GetStats fills only used elements depending on dimension and type + s1 = this.getStats(); + s2 = h1.getStats(); + } + this['fMinimum'] = -1111; + this['fMaximum'] = -1111; + + // - Loop on bins (including underflows/overflows) + var bin, binx, biny, binz; + var cu, factor = 1; + if (Math.abs(h1['fNormFactor']) > Number.MIN_VALUE) factor = h1['fNormFactor'] / h1.getSumOfWeights(); + for (binz=0;binz<=nbinsz+1;binz++) { + for (biny=0;biny<=nbinsy+1;biny++) { + for (binx=0;binx<=nbinsx+1;binx++) { + bin = binx +(nbinsx+2)*(biny + (nbinsy+2)*binz); + //special case where histograms have the kIsAverage bit set + if (this.TestBit(JSROOT.TH1StatusBits.kIsAverage) + && h1.TestBit(JSROOT.TH1StatusBits.kIsAverage)) { + var y1 = h1.getBinContent(bin), + y2 = this.getBinContent(bin), + e1 = h1.getBinError(bin), + e2 = this.getBinError(bin), + w1 = 1, w2 = 1; + // consider all special cases when bin errors are zero + // see http://root.cern.ch/phpBB3//viewtopic.php?f=3&t=13299 + if (e1 > 0) + w1 = 1.0 / (e1 * e1); + else if (h1['fSumw2'].length) { + w1 = 1.E200; // use an arbitrary huge value + if (y1 == 0) { + // use an estimated error from the global histogram scale + var sf = (s2[0] != 0) ? s2[1] / s2[0] : 1; + w1 = 1.0 / (sf * sf); + } + } + if (e2 > 0) + w2 = 1.0 / (e2 * e2); + else if (this['fSumw2'].length) { + w2 = 1.E200; // use an arbitrary huge value + if (y2 == 0) { + // use an estimated error from the global histogram scale + var sf = (s1[0] != 0) ? s1[1] / s1[0] : 1; + w2 = 1.0 / (sf * sf); + } + } + var y = (w1 * y1 + w2 * y2) / (w1 + w2); + this.setBinContent(bin, y); + if (this['fSumw2'].length) { + var err2 = 1.0 / (w1 + w2); + if (err2 < 1.E-200) err2 = 0; // to remove arbitrary value when e1=0 AND e2=0 + this['fSumw2'][bin] = err2; + } + } + //normal case of addition between histograms + else { + cu = c1 * factor * h1.getBinContent(bin); + this['fArray'][bin] += cu; + if (this['fSumw2'].length) { + var e1 = factor * h1.getBinError(bin); + this['fSumw2'][bin] += c1 * c1 * e1 * e1; + } + } + } + } + } + // update statistics (do here to avoid changes by SetBinContent) + if (resetStats) { + // statistics need to be reset in case coefficient are negative + this.resetStats(); + } + else { + var kNstat = 13; + for (var i=0;i= nx) binx = nx-1; + return binx; + } + if (this['fDimension'] < 3) { + nx = this['fXaxis']['fNbins']+2; + if (binx < 0) binx = 0; + if (binx >= nx) binx = nx-1; + ny = this['fYaxis']['fNbins']+2; + if (biny < 0) biny = 0; + if (biny >= ny) biny = ny-1; + return binx + nx*biny; + } + if (this['fDimension'] < 4) { + nx = this['fXaxis']['fNbins']+2; + if (binx < 0) binx = 0; + if (binx >= nx) binx = nx-1; + ny = this['fYaxis']['fNbins']+2; + if (biny < 0) biny = 0; + if (biny >= ny) biny = ny-1; + nz = this['fZaxis']['fNbins']+2; + if (binz < 0) binz = 0; + if (binz >= nz) binz = nz-1; + return binx + nx*(biny +ny*binz); + } + return -1; + }; + obj['getBinXYZ'] = function(binglobal) { + // return binx, biny, binz corresponding to the global bin number globalbin + // see TH1::GetBin function above + var binx, biny, binz; + var nx = this['fXaxis']['fNbins']+2; + var ny = this['fYaxis']['fNbins']+2; + if (this['fDimension'] < 2) { + binx = binglobal%nx; + biny = -1; + binz = -1; + } + if (this['fDimension'] < 3) { + binx = binglobal%nx; + biny = ((binglobal-binx)/nx)%ny; + binz = -1; + } + if (this['fDimension'] < 4) { + binx = binglobal%nx; + biny = ((binglobal-binx)/nx)%ny; + binz = ((binglobal-binx)/nx -biny)/ny; + } + return { binsx: binx, biny: biny, binz: binz }; + }; + obj['getMaximum'] = function(maxval) { + // Return maximum value smaller than maxval of bins in the range, + // unless the value has been overridden by TH1::SetMaximum, + // in which case it returns that value. (This happens, for example, + // when the histogram is drawn and the y or z axis limits are changed + // + // To get the maximum value of bins in the histogram regardless of + // whether the value has been overridden, use + // h->GetBinContent(h->GetMaximumBin()) + + if (this['fMaximum'] != -1111) return this['fMaximum']; + if (!maxval || typeof(maxval) == 'undefined') maxval = Number.MAX_VALUE; + var bin, binx, biny, binz; + var xfirst = this['fXaxis'].getFirst(); + xlast = this['fXaxis'].getLast(), + yfirst = this['fYaxis'].getFirst(), + ylast = this['fYaxis'].getLast(), + zfirst = this['fZaxis'].getFirst(), + zlast = this['fZaxis'].getLast(); + var maximum = -Number.MAX_VALUE, val; + for (binz=zfirst;binz<=zlast;binz++) { + for (biny=yfirst;biny<=ylast;biny++) { + for (binx=xfirst;binx<=xlast;binx++) { + bin = this.getBin(binx,biny,binz); + val = this.getBinContent(bin); + if (val > maximum && val < maxval) maximum = val; + } + } + } + return maximum; + }; + obj['getMinimum'] = function(minval) { + // Return minimum value smaller than maxval of bins in the range, + // unless the value has been overridden by TH1::SetMinimum, + // in which case it returns that value. (This happens, for example, + // when the histogram is drawn and the y or z axis limits are changed + if (this['fMinimum'] != -1111) return this['fMinimum']; + if (!minval || typeof(minval) == 'undefined') minval = -Number.MAX_VALUE; + var bin, binx, biny, binz; + var xfirst = this['fXaxis'].getFirst(); + xlast = this['fXaxis'].getLast(), + yfirst = this['fYaxis'].getFirst(), + ylast = this['fYaxis'].getLast(), + zfirst = this['fZaxis'].getFirst(), + zlast = this['fZaxis'].getLast(); + var minimum = Number.MAX_VALUE, val; + for (binz=zfirst;binz<=zlast;binz++) { + for (biny=yfirst;biny<=ylast;biny++) { + for (binx=xfirst;binx<=xlast;binx++) { + bin = this.getBin(binx,biny,binz); + val = this.getBinContent(bin); + if (val < minimum && val > minval) minimum = val; + } + } + } + return minimum; + }; + obj['getSumOfWeights'] = function() { + // -*-*-*-*-*-*Return the sum of weights excluding under/overflows*-*-*-*-* + var sum = 0; + for (var binz=1; binz<=this['fZaxis']['fNbins']; binz++) { + for (var biny=1; biny<=this['fYaxis']['fNbins']; biny++) { + for (var binx=1; binx<=this['fXaxis']['fNbins']; binx++) { + var bin = this.getBin(binx,biny,binz); + sum += this.getBinContent(bin); + } + } + } + return sum; + }; + obj['labelsInflate'] = function(ax) { + // Double the number of bins for axis. + // Refill histogram + + var axis = null; + var achoice = ax[0].toUpperCase(); + if (achoice == 'X') axis = this['fXaxis']; + if (achoice == 'Y') axis = this['fYaxis']; + if (achoice == 'Z') axis = this['fZaxis']; + if (axis == null) return; + + var hold = JSROOT.clone(this); + + var timedisp = axis['fTimeDisplay']; + var nbxold = this['fXaxis']['fNbins']; + var nbyold = this['fYaxis']['fNbins']; + var nbzold = this['fZaxis']['fNbins']; + var nbins = axis['fNbins']; + var xmin = axis['fXmin']; + var xmax = axis['fXmax']; + xmax = xmin + 2 * (xmax - xmin); + axis['fFirst'] = 1; + axis['fLast'] = axis['fNbins']; + this['fBits'] &= ~(JSROOT.EAxisBits.kAxisRange & 0x00ffffff); // SetBit(kAxisRange, 0); + // double the bins and recompute ncells + axis['fNbins'] = 2*nbins; + axis['fXmin'] = xmin; + axis['fXmax'] = xmax; + this['fNcells'] = -1; + this['fArray'].length = -1; + var errors = this['fSumw2'].length; + if (errors) ['fSumw2'].length = this['fNcells']; + axis['fTimeDisplay'] = timedisp; + + Reset("ICE"); // reset content and error + this['fSumw2'].splice(0, this['fSumw2'].length); + this['fMinimum'] = -1111; + this['fMaximum'] = -1111; + + //now loop on all bins and refill + var oldEntries = this['fEntries']; + var bin, ibin, bins; + for (ibin = 0; ibin < this['fNcells']; ibin++) { + bins = this.getBinXYZ(ibin); + bin = hold.getBin(bins['binx'],bins['biny'],bins['binz']); + // NOTE that overflow in hold will be not considered + if (bins['binx'] > nbxold || bins['biny'] > nbyold || bins['binz'] > nbzold) bin = -1; + if (bin > 0) { + var cu = hold.getBinContent(bin); + this['fArray'][bin] += cu; + if (errors) this['fSumw2'][ibin] += hold['fSumw2'][bin]; + } + } + this['fEntries'] = oldEntries; + delete hold; + }; + obj['resetStats'] = function() { + // Reset the statistics including the number of entries + // and replace with values calculates from bin content + // The number of entries is set to the total bin content or (in case of weighted histogram) + // to number of effective entries + this['fTsumw'] = 0; + this['fEntries'] = 1; // to force re-calculation of the statistics in TH1::GetStats + var stats = this.getStats(); + this['fTsumw'] = stats[0]; + this['fTsumw2'] = stats[1]; + this['fTsumwx'] = stats[2]; + this['fTsumwx2'] = stats[3]; + this['fEntries'] = Math.abs(this['fTsumw']); + // use effective entries for weighted histograms: (sum_w) ^2 / sum_w2 + if (this['fSumw2'].length > 0 && this['fTsumw'] > 0 && stats[1] > 0 ) + this['fEntries'] = stats[0] * stats[0] / stats[1]; + } + obj['setBinContent'] = function(bin, content) { + // Set bin content + // see convention for numbering bins in TH1::GetBin + // In case the bin number is greater than the number of bins and + // the timedisplay option is set or the kCanRebin bit is set, + // the number of bins is automatically doubled to accommodate the new bin + + this['fEntries']++; + this['fTsumw'] = 0; + if (bin < 0) return; + if (bin >= this['fNcells']-1) { + if (this['fXaxis']['fTimeDisplay'] || this.TestBit(JSROOT.TH1StatusBits.kCanRebin) ) { + while (bin >= this['fNcells']-1) this.labelsInflate(); + } else { + if (bin == this['fNcells']-1) this['fArray'][bin] = content; + return; + } + } + this['fArray'][bin] = content; + }; + obj['sumw2'] = function() { + // Create structure to store sum of squares of weights*-*-*-*-*-*-*-* + // + // if histogram is already filled, the sum of squares of weights + // is filled with the existing bin contents + // + // The error per bin will be computed as sqrt(sum of squares of weight) + // for each bin. + // + // This function is automatically called when the histogram is created + // if the static function TH1::SetDefaultSumw2 has been called before. + + if (this['fSumw2'].length == this['fNcells']) return; + this['fSumw2'].length = this['fNcells']; + if ( this['fEntries'] > 0 ) { + for (var bin=0; bin= this['fNcells']) bin = this['fNcells']-1; + return this['fArray'][bin]; + }; + obj['getStats'] = function() { + // fill the array stats from the contents of this histogram + // The array stats must be correctly dimensioned in the calling program. + // stats[0] = sumw + // stats[1] = sumw2 + // stats[2] = sumwx + // stats[3] = sumwx2 + // Loop on bins (possibly including underflows/overflows) + var bin, binx, w, err, x, stats = new Array(0,0,0,0,0); + // case of labels with rebin of axis set + // statistics in x does not make any sense - set to zero + if (this['fXaxis']['fLabels'] && this.TestBit(JSROOT.TH1StatusBits.kCanRebin) ) { + stats[0] = this['fTsumw']; + stats[1] = this['fTsumw2']; + stats[2] = 0; + stats[3] = 0; + } + else if ((this['fTsumw'] == 0 && this['fEntries'] > 0) || + this['fXaxis'].TestBit(JSROOT.EAxisBits.kAxisRange)) { + for (bin=0;bin<4;bin++) stats[bin] = 0; + + var firstBinX = this['fXaxis'].getFirst(); + var lastBinX = this['fXaxis'].getLast(); + for (binx = firstBinX; binx <= lastBinX; binx++) { + x = this['fXaxis'].getBinCenter(binx); + w = this.getBinContent(binx); + err = Math.abs(this.getBinError(binx)); + stats[0] += w; + stats[1] += err*err; + stats[2] += w*x; + stats[3] += w*x*x; + } + } else { + stats[0] = this['fTsumw']; + stats[1] = this['fTsumw2']; + stats[2] = this['fTsumwx']; + stats[3] = this['fTsumwx2']; + } + return stats; + }; + } + if (obj_typename.indexOf("TH2") == 0) { + obj['fDimension'] = 2; + obj['getBin'] = function(x, y) { + var nx = this['fXaxis']['fNbins']+2; + return (x + nx * y); + }; + obj['getBinContent'] = function(x, y) { + return this['fArray'][this.getBin(x, y)]; + }; + obj['getStats'] = function() { + var bin, binx, biny, stats = new Array(0,0,0,0,0,0,0,0,0,0,0,0,0); + if ((this['fTsumw'] == 0 && this['fEntries'] > 0) || this['fXaxis'].TestBit(JSROOT.EAxisBits.kAxisRange) || this['fYaxis'].TestBit(JSROOT.EAxisBits.kAxisRange)) { + var firstBinX = this['fXaxis'].getFirst(); + var lastBinX = this['fXaxis'].getLast(); + var firstBinY = this['fYaxis'].getFirst(); + var lastBinY = this['fYaxis'].getLast(); + // include underflow/overflow if TH1::StatOverflows(kTRUE) in case no range is set on the axis + if (this['fgStatOverflows']) { + if ( !this['fXaxis'].TestBit(JSROOT.EAxisBits.kAxisRange) ) { + if (firstBinX == 1) firstBinX = 0; + if (lastBinX == this['fXaxis']['fNbins'] ) lastBinX += 1; + } + if ( !this['fYaxis'].TestBit(JSROOT.EAxisBits.kAxisRange) ) { + if (firstBinY == 1) firstBinY = 0; + if (lastBinY == this['fYaxis']['fNbins'] ) lastBinY += 1; + } + } + for (biny = firstBinY; biny <= lastBinY; biny++) { + y = this['fYaxis'].getBinCenter(biny); + for (binx = firstBinX; binx <= lastBinX; binx++) { + bin = this.getBin(binx,biny); + x = this['fXaxis'].getBinCenter(binx); + w = this.GetBinContent(bin); + err = Math.abs(this.getBinError(bin)); + stats[0] += w; + stats[1] += err*err; + stats[2] += w*x; + stats[3] += w*x*x; + stats[4] += w*y; + stats[5] += w*y*y; + stats[6] += w*x*y; + } + } + } else { + stats[0] = this['fTsumw']; + stats[1] = this['fTsumw2']; + stats[2] = this['fTsumwx']; + stats[3] = this['fTsumwx2']; + stats[4] = this['fTsumwy']; + stats[5] = this['fTsumwy2']; + stats[6] = this['fTsumwxy']; + } + return stats; + }; + } + if (obj_typename.indexOf("TH3") == 0) { + obj['fDimension'] = 3; + obj['getBin'] = function(x, y, z) { + var nx = this['fXaxis']['fNbins']+2; + if (x < 0) x = 0; + if (x >= nx) x = nx-1; + var ny = this['fYaxis']['fNbins']+2; + if (y < 0) y = 0; + if (y >= ny) y = ny-1; + return (x + nx * (y + ny * z)); + }; + obj['getBinContent'] = function(x, y, z) { + return this['fArray'][this.getBin(x, y, z)]; + }; + obj['getStats'] = function() { + var bin, binx, biny, binz, stats = new Array(0,0,0,0,0,0,0,0,0,0,0,0,0); + if ((obj['fTsumw'] == 0 && obj['fEntries'] > 0) || obj['fXaxis'].TestBit(JSROOT.EAxisBits.kAxisRange) || obj['fYaxis'].TestBit(JSROOT.EAxisBits.kAxisRange) || obj['fZaxis'].TestBit(JSROOT.EAxisBits.kAxisRange)) { + var firstBinX = obj['fXaxis'].getFirst(); + var lastBinX = obj['fXaxis'].getLast(); + var firstBinY = obj['fYaxis'].getFirst(); + var lastBinY = obj['fYaxis'].getLast(); + var firstBinZ = obj['fZaxis'].getFirst(); + var lastBinZ = obj['fZaxis'].getLast(); + // include underflow/overflow if TH1::StatOverflows(kTRUE) in case no range is set on the axis + if (obj['fgStatOverflows']) { + if ( !obj['fXaxis'].TestBit(JSROOT.EAxisBits.kAxisRange) ) { + if (firstBinX == 1) firstBinX = 0; + if (lastBinX == obj['fXaxis']['fNbins'] ) lastBinX += 1; + } + if ( !obj['fYaxis'].TestBit(JSROOT.EAxisBits.kAxisRange) ) { + if (firstBinY == 1) firstBinY = 0; + if (lastBinY == obj['fYaxis']['fNbins'] ) lastBinY += 1; + } + if ( !obj['fZaxis'].TestBit(JSROOT.EAxisBits.kAxisRange) ) { + if (firstBinZ == 1) firstBinZ = 0; + if (lastBinZ == obj['fZaxis']['fNbins'] ) lastBinZ += 1; + } + } + for (binz = firstBinZ; binz <= lastBinZ; binz++) { + z = obj['fZaxis'].getBinCenter(binz); + for (biny = firstBinY; biny <= lastBinY; biny++) { + y = obj['fYaxis'].getBinCenter(biny); + for (binx = firstBinX; binx <= lastBinX; binx++) { + bin = obj.getBin(binx,biny,binz); + x = obj['fXaxis'].getBinCenter(binx); + w = obj.GetBinContent(bin); + err = Math.abs(obj.getBinError(bin)); + stats[0] += w; + stats[1] += err*err; + stats[2] += w*x; + stats[3] += w*x*x; + stats[4] += w*y; + stats[5] += w*y*y; + stats[6] += w*x*y; + stats[7] += w*z; + stats[8] += w*z*z; + stats[9] += w*x*z; + stats[10] += w*y*z; + } + } + } + } else { + stats[0] = obj['fTsumw']; + stats[1] = obj['fTsumw2']; + stats[2] = obj['fTsumwx']; + stats[3] = obj['fTsumwx2']; + stats[4] = obj['fTsumwy']; + stats[5] = obj['fTsumwy2']; + stats[6] = obj['fTsumwxy']; + stats[7] = obj['fTsumwz']; + stats[8] = obj['fTsumwz2']; + stats[9] = obj['fTsumwxz']; + stats[10] =obj['fTsumwyz']; + } + return stats; + }; + } + if (obj_typename.indexOf("THStack") == 0) { + obj['buildStack'] = function() { + // build sum of all histograms + // Build a separate list fStack containing the running sum of all histograms + if ('fStack' in this) return; + if (!'fHists' in this) return; + var nhists = this['fHists'].arr.length; + if (nhists <= 0) return; + this['fStack'] = JSROOT.Create("TList"); + var h = JSROOT.clone(this['fHists'].arr[0]); + this['fStack'].arr.push(h); + for (var i=1;i themax) themax = them; + } + } + if (lerr) { + for (var i=0;i 3 && axis < 11) || axis > 13) return 0; + var stats = this.getStats(); + if (stats[0] == 0) return 0; + var ax = new Array(2,4,7); + return stats[ax[axis-1]]/stats[0]; + }; + obj['getRMS'] = function(axis) { + if (axis < 1 || (axis > 3 && axis < 11) || axis > 13) return 0; + var stats = this.getStats(); + if (stats[0] == 0) return 0; + var ax = new Array(2,4,7); + var axm = ax[axis%10 - 1]; + var x = stats[axm]/stats[0]; + var rms2 = Math.abs(stats[axm+1]/stats[0] -x*x); + return Math.sqrt(rms2); + }; + } + if (obj_typename.indexOf("TProfile") == 0) { + obj['getBinContent'] = function(bin) { + if (bin < 0 || bin >= this['fNcells']) return 0; + if (this['fBinEntries'][bin] < 1e-300) return 0; + if (!this['fArray']) return 0; + return this['fArray'][bin]/this['fBinEntries'][bin]; + }; + obj['getBinEffectiveEntries'] = function(bin) { + if (bin < 0 || bin >= this['fNcells']) return 0; + var sumOfWeights = this['fBinEntries'][bin]; + if ( this['fBinSumw2'] == null || this['fBinSumw2'].length != this['fNcells']) { + // this can happen when reading an old file + return sumOfWeights; + } + var sumOfWeightsSquare = this['fSumw2'][bin]; + return ( sumOfWeightsSquare > 0 ? sumOfWeights * sumOfWeights / sumOfWeightsSquare : 0 ); + }; + obj['getStats'] = function() { + var bin, binx, stats = new Array(0,0,0,0,0,0,0,0,0,0,0,0,0); + if (this['fTsumw'] < 1e-300 || this['fXaxis'].TestBit(JSROOT.EAxisBits.kAxisRange)) { + var firstBinX = this['fXaxis'].getFirst(); + var lastBinX = this['fXaxis'].getLast(); + for (binx = this['firstBinX']; binx <= lastBinX; binx++) { + var w = onj['fBinEntries'][binx]; + var w2 = (this['fBinSumw2'] ? this['fBinSumw2'][binx] : w); + var x = fXaxis.GetBinCenter(binx); + stats[0] += w; + stats[1] += w2; + stats[2] += w*x; + stats[3] += w*x*x; + stats[4] += this['fArray'][binx]; + stats[5] += this['fSumw2'][binx]; + } + } else { + if (this['fTsumwy'] < 1e-300 && this['fTsumwy2'] < 1e-300) { + //this case may happen when processing TProfiles with version <=3 + for (binx=this['fXaxis'].getFirst();binx<=this['fXaxis'].getLast();binx++) { + this['fTsumwy'] += this['fArray'][binx]; + this['fTsumwy2'] += this['fSumw2'][binx]; + } + } + stats[0] = this['fTsumw']; + stats[1] = this['fTsumw2']; + stats[2] = this['fTsumwx']; + stats[3] = this['fTsumwx2']; + stats[4] = this['fTsumwy']; + stats[5] = this['fTsumwy2']; + } + return stats; + }; + obj['getBinError'] = function(bin) { + if (bin < 0 || bin >= this['fNcells']) return 0; + var cont = this['fArray'][bin]; // sum of bin w *y + var sum = this['fBinEntries'][bin]; // sum of bin weights + var err2 = this['fSumw2'][bin]; // sum of bin w * y^2 + var neff = this.getBinEffectiveEntries(bin); // (sum of w)^2 / (sum of w^2) + if (sum < 1e-300) return 0; // for empty bins + // case the values y are gaussian distributed y +/- sigma and w = 1/sigma^2 + if (this['fErrorMode'] == EErrorType.kERRORSPREADG) { + return (1.0/Math.sqrt(sum)); + } + // compute variance in y (eprim2) and standard deviation in y (eprim) + var contsum = cont/sum; + var eprim2 = Math.abs(err2/sum - contsum*contsum); + var eprim = Math.sqrt(eprim2); + if (this['fErrorMode'] == EErrorType.kERRORSPREADI) { + if (eprim != 0) return eprim/Math.sqrt(neff); + // in case content y is an integer (so each my has an error +/- 1/sqrt(12) + // when the std(y) is zero + return (1.0/Math.sqrt(12*neff)); + } + // if approximate compute the sums (of w, wy and wy2) using all the bins + // when the variance in y is zero + var testing = 1; + if (err2 != 0 && neff < 5) testing = eprim2*sum/err2; + if (this['fgApproximate'] && (testing < 1.e-4 || eprim2 < 1e-6)) { //3.04 + var stats = this.getStats(); + var ssum = stats[0]; + // for 1D profile + var idx = 4; // index in the stats array for 1D + var scont = stats[idx]; + var serr2 = stats[idx+1]; + // compute mean and variance in y + var scontsum = scont/ssum; // global mean + var seprim2 = Math.abs(serr2/ssum - scontsum*scontsum); // global variance + eprim = 2*Math.sqrt(seprim2); // global std (why factor of 2 ??) + sum = ssum; + } + sum = Math.abs(sum); + // case option "S" return standard deviation in y + if (this['fErrorMode'] == EErrorType.kERRORSPREAD) return eprim; + // default case : fErrorMode = kERRORMEAN + // return standard error on the mean of y + return (eprim/Math.sqrt(neff)); + }; + } + }; + + JSROOT.lastFFormat = ""; + + JSROOT.FFormat = function(value, fmt) { + // method used to convert numeric value to string according specified format + // format can be like 5.4g or 4.2e or 6.4f + // function saves actual format in JSROOT.lastFFormat variable + if (!fmt) fmt = "6.4g"; + + JSROOT.lastFFormat = ""; + + if (!fmt) fmt = "6.4g"; + fmt = fmt.trim(); + var len = fmt.length; + if (len<2) return value.toFixed(4); + var last = fmt.charAt(len-1); + fmt = fmt.slice(0,len-1); + var isexp = null; + var prec = fmt.indexOf("."); + if (prec<0) prec = 4; else prec = Number(fmt.slice(prec+1)); + if ((prec==NaN) || (prec<0) || (prec==null)) prec = 4; + var significance = false; + if ((last=='e') || (last=='E')) { isexp = true; } else + if (last=='Q') { isexp = true; significance = true; } else + if ((last=='f') || (last=='F')) { isexp = false; } else + if (last=='W') { isexp = false; significance = true; } else + if ((last=='g') || (last=='G')) { + var se = JSROOT.FFormat(value, fmt+'Q'); + var _fmt = JSROOT.lastFFormat; + var sg = JSROOT.FFormat(value, fmt+'W'); + + if (se.length < sg.length) { + JSROOT.lastFFormat = _fmt; + return se; + } + return sg; + } else { + isexp = false; + prec = 4; + } + + if (isexp) { + // for exponential representation only one significant digit befor point + if (significance) prec--; + if (prec<0) prec = 0; + + JSROOT.lastFFormat = '5.'+prec+'e'; + + return value.toExponential(prec); + } + + var sg = value.toFixed(prec); + + if (significance) { + + // when using fixed representation, one could get 0.0 + if ((value!=0) && (Number(sg)==0.) && (prec>0)) { + prec = 40; sg = value.toFixed(prec); + } + + var l = 0; + while ((ll) diff--; + + if (diff != 0) { + prec-=diff; if (prec<0) prec = 0; + sg = value.toFixed(prec); + } + } + + JSROOT.lastFFormat = '5.'+prec+'f'; + + return sg; + } + + + // math methods for Javascript ROOT + + JSROOT.Math = {}; + + + JSROOT.Math.lgam = function( x ) { + var p, q, u, w, z; + var i; + + var sgngam = 1; + + if (x >= Number.POSITIVE_INFINITY) + return(Number.POSITIVE_INFINITY); + + if ( x < -34.0 ) { + q = -x; + w = this.lgam(q); + p = Math.floor(q); + if ( p==q )//_unur_FP_same(p,q) + return (Number.POSITIVE_INFINITY); + i = Math.round(p); + if ( (i & 1) == 0 ) + sgngam = -1; + else + sgngam = 1; + z = q - p; + if ( z > 0.5 ) { + p += 1.0; + z = p - q; + } + z = q * Math.sin( Math.PI * z ); + if ( z < 1e-300 ) + return (Number.POSITIVE_INFINITY); + z = Math.log(Math.PI) - Math.log( z ) - w; + return( z ); + } + if ( x < 13.0 ) { + z = 1.0; + p = 0.0; + u = x; + while ( u >= 3.0 ) { + p -= 1.0; + u = x + p; + z *= u; + } + while ( u < 2.0 ) { + if ( u < 1e-300 ) + return (Number.POSITIVE_INFINITY); + z /= u; + p += 1.0; + u = x + p; + } + if ( z < 0.0 ) { + sgngam = -1; + z = -z; + } + else + sgngam = 1; + if ( u == 2.0 ) + return( Math.log(z) ); + p -= 2.0; + x = x + p; + p = x * this.Polynomialeval(x, B, 5 ) / this.Polynomial1eval( x, C, 6); + return( Math.log(z) + p ); + } + if ( x > kMAXLGM ) + return( sgngam * Number.POSITIVE_INFINITY ); + + q = ( x - 0.5 ) * Math.log(x) - x + LS2PI; + if ( x > 1.0e8 ) + return( q ); + + p = 1.0/(x*x); + if ( x >= 1000.0 ) + q += ((7.9365079365079365079365e-4 * p + - 2.7777777777777777777778e-3) *p + + 0.0833333333333333333333) / x; + else + q += this.Polynomialeval( p, A, 4 ) / x; + return( q ); + }; + + /* + * calculates a value of a polynomial of the form: + * a[0]x^N+a[1]x^(N-1) + ... + a[N] + */ + JSROOT.Math.Polynomialeval = function(x, a, N) { + if (N==0) return a[0]; + else { + var pom = a[0]; + for (var i=1; i <= N; i++) + pom = pom *x + a[i]; + return pom; + } + }; + + /* + * calculates a value of a polynomial of the form: + * x^N+a[0]x^(N-1) + ... + a[N-1] + */ + JSROOT.Math.Polynomial1eval = function(x, a, N) { + if (N==0) return a[0]; + else { + var pom = x + a[0]; + for (var i=1; i < N; i++) + pom = pom *x + a[i]; + return pom; + } + }; + + JSROOT.Math.ndtri = function( y0 ) { + if ( y0 <= 0.0 ) + return( Number.NEGATIVE_INFINITY ); + if ( y0 >= 1.0 ) + return( Number.POSITIVE_INFINITY ); + + var P0 = new Array( + -5.99633501014107895267E1, + 9.80010754185999661536E1, + -5.66762857469070293439E1, + 1.39312609387279679503E1, + -1.23916583867381258016E0 + ); + + var Q0 = new Array( + 1.95448858338141759834E0, + 4.67627912898881538453E0, + 8.63602421390890590575E1, + -2.25462687854119370527E2, + 2.00260212380060660359E2, + -8.20372256168333339912E1, + 1.59056225126211695515E1, + -1.18331621121330003142E0 + ); + + var P1 = new Array( + 4.05544892305962419923E0, + 3.15251094599893866154E1, + 5.71628192246421288162E1, + 4.40805073893200834700E1, + 1.46849561928858024014E1, + 2.18663306850790267539E0, + -1.40256079171354495875E-1, + -3.50424626827848203418E-2, + -8.57456785154685413611E-4 + ); + + var Q1 = new Array( + 1.57799883256466749731E1, + 4.53907635128879210584E1, + 4.13172038254672030440E1, + 1.50425385692907503408E1, + 2.50464946208309415979E0, + -1.42182922854787788574E-1, + -3.80806407691578277194E-2, + -9.33259480895457427372E-4 + ); + + var P2 = new Array( + 3.23774891776946035970E0, + 6.91522889068984211695E0, + 3.93881025292474443415E0, + 1.33303460815807542389E0, + 2.01485389549179081538E-1, + 1.23716634817820021358E-2, + 3.01581553508235416007E-4, + 2.65806974686737550832E-6, + 6.23974539184983293730E-9 + ); + + var Q2 = new Array( + 6.02427039364742014255E0, + 3.67983563856160859403E0, + 1.37702099489081330271E0, + 2.16236993594496635890E-1, + 1.34204006088543189037E-2, + 3.28014464682127739104E-4, + 2.89247864745380683936E-6, + 6.79019408009981274425E-9 + ); + + var s2pi = 2.50662827463100050242e0; + var code = 1; + var y = y0; + var x, z, y2, x0, x1; + + if ( y > (1.0 - 0.13533528323661269189) ) { + y = 1.0 - y; + code = 0; + } + if ( y > 0.13533528323661269189 ) { + y = y - 0.5; + y2 = y * y; + x = y + y * (y2 * this.Polynomialeval( y2, P0, 4)/ this.Polynomial1eval( y2, Q0, 8 )); + x = x * s2pi; + return(x); + } + x = Math.sqrt( -2.0 * Math.log(y) ); + x0 = x - Math.log(x)/x; + z = 1.0/x; + if ( x < 8.0 ) + x1 = z * this.Polynomialeval( z, P1, 8 )/ this.Polynomial1eval( z, Q1, 8 ); + else + x1 = z * this.Polynomialeval( z, P2, 8 )/ this.Polynomial1eval( z, Q2, 8 ); + x = x0 - x1; + if ( code != 0 ) + x = -x; + return( x ); + }; + + JSROOT.Math.igami = function(a, y0) { + var x0, x1, x, yl, yh, y, d, lgm, dithresh; + var i, dir; + var kMACHEP = 1.11022302462515654042363166809e-16; + + // check the domain + if (a <= 0) { + alert("igami : Wrong domain for parameter a (must be > 0)"); + return 0; + } + if (y0 <= 0) { + return Number.POSITIVE_INFINITY; + } + if (y0 >= 1) { + return 0; + } + /* bound the solution */ + var kMAXNUM = Number.MAX_VALUE; + x0 = kMAXNUM; + yl = 0; + x1 = 0; + yh = 1.0; + dithresh = 5.0 * kMACHEP; + + /* approximation to inverse function */ + d = 1.0/(9.0*a); + y = ( 1.0 - d - this.ndtri(y0) * Math.sqrt(d) ); + x = a * y * y * y; + + lgm = this.lgam(a); + + for( i=0; i<10; i++ ) { + if ( x > x0 || x < x1 ) + break; + y = igamc(a,x); + if ( y < yl || y > yh ) + break; + if ( y < y0 ) { + x0 = x; + yl = y; + } + else { + x1 = x; + yh = y; + } + /* compute the derivative of the function at this point */ + d = (a - 1.0) * Math.log(x) - x - lgm; + if ( d < -kMAXLOG ) + break; + d = -Math.exp(d); + /* compute the step to the next approximation of x */ + d = (y - y0)/d; + if ( Math.abs(d/x) < kMACHEP ) + return( x ); + x = x - d; + } + /* Resort to interval halving if Newton iteration did not converge. */ + d = 0.0625; + if ( x0 == kMAXNUM ) { + if ( x <= 0.0 ) + x = 1.0; + while ( x0 == kMAXNUM ) { + x = (1.0 + d) * x; + y = igamc( a, x ); + if ( y < y0 ) { + x0 = x; + yl = y; + break; + } + d = d + d; + } + } + d = 0.5; + dir = 0; + + for( i=0; i<400; i++ ) { + x = x1 + d * (x0 - x1); + y = igamc( a, x ); + lgm = (x0 - x1)/(x1 + x0); + if ( Math.abs(lgm) < dithresh ) + break; + lgm = (y - y0)/y0; + if ( Math.abs(lgm) < dithresh ) + break; + if ( x <= 0.0 ) + break; + if ( y >= y0 ) { + x1 = x; + yh = y; + if ( dir < 0 ) { + dir = 0; + d = 0.5; + } + else if ( dir > 1 ) + d = 0.5 * d + 0.5; + else + d = (y0 - yl)/(yh - yl); + dir += 1; + } + else { + x0 = x; + yl = y; + if ( dir > 0 ) { + dir = 0; + d = 0.5; + } + else if ( dir < -1 ) + d = 0.5 * d; + else + d = (y0 - yl)/(yh - yl); + dir -= 1; + } + } + return( x ); + }; + + JSROOT.Math.gamma_quantile_c = function(z, alpha, theta) { + return theta * this.igami( alpha, z); + }; + + JSROOT.Math.gamma_quantile = function(z, alpha, theta) { + return theta * this.igami( alpha, 1.- z); + }; + + JSROOT.Math.log10 = function(n) { + return Math.log(n) / Math.log(10); + }; + + JSROOT.Math.landau_pdf = function(x, xi, x0) { + // LANDAU pdf : algorithm from CERNLIB G110 denlan + // same algorithm is used in GSL + if (xi <= 0) return 0; + var v = (x - x0)/xi; + var u, ue, us, denlan; + var p1 = new Array(0.4259894875,-0.1249762550, 0.03984243700, -0.006298287635, 0.001511162253); + var q1 = new Array(1.0 ,-0.3388260629, 0.09594393323, -0.01608042283, 0.003778942063); + var p2 = new Array(0.1788541609, 0.1173957403, 0.01488850518, -0.001394989411, 0.0001283617211); + var q2 = new Array(1.0 , 0.7428795082, 0.3153932961, 0.06694219548, 0.008790609714); + var p3 = new Array(0.1788544503, 0.09359161662,0.006325387654, 0.00006611667319,-0.000002031049101); + var q3 = new Array(1.0 , 0.6097809921, 0.2560616665, 0.04746722384, 0.006957301675); + var p4 = new Array(0.9874054407, 118.6723273, 849.2794360, -743.7792444, 427.0262186); + var q4 = new Array(1.0 , 106.8615961, 337.6496214, 2016.712389, 1597.063511); + var p5 = new Array(1.003675074, 167.5702434, 4789.711289, 21217.86767, -22324.94910); + var q5 = new Array(1.0 , 156.9424537, 3745.310488, 9834.698876, 66924.28357); + var p6 = new Array(1.000827619, 664.9143136, 62972.92665, 475554.6998, -5743609.109); + var q6 = new Array(1.0 , 651.4101098, 56974.73333, 165917.4725, -2815759.939); + var a1 = new Array(0.04166666667,-0.01996527778, 0.02709538966); + var a2 = new Array(-1.845568670,-4.284640743); + + if (v < -5.5) { + u = Math.exp(v+1.0); + if (u < 1e-10) return 0.0; + ue = Math.exp(-1/u); + us = Math.sqrt(u); + denlan = 0.3989422803*(ue/us)*(1+(a1[0]+(a1[1]+a1[2]*u)*u)*u); + } else if(v < -1) { + u = Math.exp(-v-1); + denlan = Math.exp(-u)*Math.sqrt(u)* + (p1[0]+(p1[1]+(p1[2]+(p1[3]+p1[4]*v)*v)*v)*v)/ + (q1[0]+(q1[1]+(q1[2]+(q1[3]+q1[4]*v)*v)*v)*v); + } else if(v < 1) { + denlan = (p2[0]+(p2[1]+(p2[2]+(p2[3]+p2[4]*v)*v)*v)*v)/ + (q2[0]+(q2[1]+(q2[2]+(q2[3]+q2[4]*v)*v)*v)*v); + } else if(v < 5) { + denlan = (p3[0]+(p3[1]+(p3[2]+(p3[3]+p3[4]*v)*v)*v)*v)/ + (q3[0]+(q3[1]+(q3[2]+(q3[3]+q3[4]*v)*v)*v)*v); + } else if(v < 12) { + u = 1/v; + denlan = u*u*(p4[0]+(p4[1]+(p4[2]+(p4[3]+p4[4]*u)*u)*u)*u)/ + (q4[0]+(q4[1]+(q4[2]+(q4[3]+q4[4]*u)*u)*u)*u); + } else if(v < 50) { + u = 1/v; + denlan = u*u*(p5[0]+(p5[1]+(p5[2]+(p5[3]+p5[4]*u)*u)*u)*u)/ + (q5[0]+(q5[1]+(q5[2]+(q5[3]+q5[4]*u)*u)*u)*u); + } else if(v < 300) { + u = 1/v; + denlan = u*u*(p6[0]+(p6[1]+(p6[2]+(p6[3]+p6[4]*u)*u)*u)*u)/ + (q6[0]+(q6[1]+(q6[2]+(q6[3]+q6[4]*u)*u)*u)*u); + } else { + u = 1/(v-v*Math.log(v)/(v+1)); + denlan = u*u*(1+(a2[0]+a2[1]*u)*u); + } + return denlan/xi; + }; + + JSROOT.Math.Landau = function(x, mpv, sigma, norm) { + if (sigma <= 0) return 0; + var den = JSROOT.Math.landau_pdf((x - mpv) / sigma, 1, 0); + if (!norm) return den; + return den/sigma; + }; + + JSROOT.Math.gaus = function(f, x, i) { + return f['fParams'][i+0] * Math.exp(-0.5 * Math.pow((x-f['fParams'][i+1]) / f['fParams'][i+2], 2)); + }; + + JSROOT.Math.gausn = function(f, x, i) { + return JSROOT.Math.gaus(f, x, i)/(Math.sqrt(2 * Math.PI) * f['fParams'][i+2]); + }; + + JSROOT.Math.expo = function(f, x, i) { + return Math.exp(f['fParams'][i+0] + f['fParams'][i+1] * x); + }; + + JSROOT.Math.landau = function(f, x, i) { + return JSROOT.Math.Landau(x, f['fParams'][i+1],f['fParams'][i+2], false); + }; + + JSROOT.Math.landaun = function(f, x, i) { + return JSROOT.Math.Landau(x, f['fParams'][i+1],f['fParams'][i+2], true); + }; + + // it is important to run this function at the end when all other + // functions are available + (function() { + function window_on_load(func) { + if (func==null) return; + if (document.attachEvent ? document.readyState === 'complete' : document.readyState !== 'loading') + func(); + else + window.onload = func; + } + + + var scripts = document.getElementsByTagName('script'); + + for (var n in scripts) { + if (scripts[n]['type'] != 'text/javascript') continue; + + var src = scripts[n]['src']; + if ((src == null) || (src.length == 0)) continue; + + var pos = src.indexOf("scripts/JSRootCore."); + if (pos<0) continue; + + JSROOT.source_dir = src.substr(0, pos); + JSROOT.source_min = src.indexOf("scripts/JSRootCore.min.js")>=0; + + JSROOT.console("Set JSROOT.source_dir to " + JSROOT.source_dir); + + if (JSROOT.GetUrlOption('gui', src)!=null) + return window_on_load(function() { JSROOT.BuildSimpleGUI(); }); + + if ( typeof define === "function" && define.amd ) + return window_on_load(function() { JSROOT.BuildSimpleGUI('check_existing_elements'); }); + + var prereq = ""; + if (JSROOT.GetUrlOption('io', src)!=null) prereq += "io;"; + if (JSROOT.GetUrlOption('2d', src)!=null) prereq += "2d;"; + if (JSROOT.GetUrlOption('jq2d', src)!=null) prereq += "jq2d;"; + if (JSROOT.GetUrlOption('3d', src)!=null) prereq += "3d;"; + if (JSROOT.GetUrlOption('mathjax', src)!=null) prereq += "mathjax;"; + var user = JSROOT.GetUrlOption('load', src); + if ((user!=null) && (user.length>0)) prereq += "load:" + user; + var onload = JSROOT.GetUrlOption('onload', src); + + if ((prereq.length>0) || (onload!=null)) + window_on_load(function() { + if (prereq.length>0) JSROOT.AssertPrerequisites(prereq, onload); else + if (onload!=null) { + onload = JSROOT.findFunction(onload); + if (typeof onload == 'function') onload(); + } + }); + + return; + } + })(); + + return JSROOT; + +})); + +/// JSRootCore.js ends + diff --git a/js/scripts/JSRootCore.min.js b/js/scripts/JSRootCore.min.js new file mode 100755 index 0000000..2b63bbb --- /dev/null +++ b/js/scripts/JSRootCore.min.js @@ -0,0 +1 @@ +(function(b){if(typeof define==="function"&&define.amd){var c="scripts";var a=document.getElementsByTagName("script");for(var g in a){if(a[g]["type"]!="text/javascript"){continue}var e=a[g]["src"];if((e==null)||(e.length==0)){continue}var f=e.indexOf("scripts/JSRootCore.");if(f>=0){c=e.substr(0,f+7);break}}requirejs.config({baseUrl:c,paths:{d3:"d3.v3.min",helvetiker_bold:"helvetiker_bold.typeface",jquery:"jquery.min","jquery-ui":"jquery-ui.min","touch-punch":"touch-punch.min",MathJax:"https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_SVG&delayStartupUntil=configured",THREE:"helvetiker_regular.typeface"},shim:{helvetiker_bold:{deps:["three.min"]},THREE:{deps:["helvetiker_bold"]},MathJax:{exports:"MathJax",init:function(){MathJax.Hub.Config({TeX:{extensions:["color.js"]}});MathJax.Hub.Register.StartupHook("SVG Jax Ready",function(){var h=MathJax.OutputJax.SVG.FONTDATA.VARIANT;h.normal.fonts.unshift("MathJax_SansSerif");h.bold.fonts.unshift("MathJax_SansSerif-bold");h.italic.fonts.unshift("MathJax_SansSerif");h["-tex-mathit"].fonts.unshift("MathJax_SansSerif")});MathJax.Hub.Startup.onload();return MathJax}}}});define(b)}else{if(typeof JSROOT!="undefined"){var d=new Error("JSROOT is already defined");d.source="JSRootCore.js";throw d}JSROOT={};b(JSROOT)}}(function(JSROOT){JSROOT.version="3.7 22/07/2015";JSROOT.source_dir="";JSROOT.source_min=false;JSROOT.id_counter=0;JSROOT.touches=("ontouchend" in document);JSROOT.browser={};JSROOT.browser.isOpera=!!window.opera||navigator.userAgent.indexOf(" OPR/")>=0;JSROOT.browser.isFirefox=typeof InstallTrigger!=="undefined";JSROOT.browser.isSafari=Object.prototype.toString.call(window.HTMLElement).indexOf("Constructor")>0;JSROOT.browser.isChrome=!!window.chrome&&!JSROOT.browser.isOpera;JSROOT.browser.isIE=false||!!document.documentMode;JSROOT.browser.isWebKit=JSROOT.browser.isChrome||JSROOT.browser.isSafari;JSROOT.function_list=[];JSROOT.MathJax=0;JSROOT.BIT=function(n){return 1<<(n)};JSROOT.TH1StatusBits={kNoStats:JSROOT.BIT(9),kUserContour:JSROOT.BIT(10),kCanRebin:JSROOT.BIT(11),kLogX:JSROOT.BIT(15),kIsZoomed:JSROOT.BIT(16),kNoTitle:JSROOT.BIT(17),kIsAverage:JSROOT.BIT(18)};JSROOT.EAxisBits={kTickPlus:JSROOT.BIT(9),kTickMinus:JSROOT.BIT(10),kAxisRange:JSROOT.BIT(11),kCenterTitle:JSROOT.BIT(12),kCenterLabels:JSROOT.BIT(14),kRotateTitle:JSROOT.BIT(15),kPalette:JSROOT.BIT(16),kNoExponent:JSROOT.BIT(17),kLabelsHori:JSROOT.BIT(18),kLabelsVert:JSROOT.BIT(19),kLabelsDown:JSROOT.BIT(20),kLabelsUp:JSROOT.BIT(21),kIsInteger:JSROOT.BIT(22),kMoreLogLabels:JSROOT.BIT(23),kDecimals:JSROOT.BIT(11)};JSROOT.console=function(value,divid){if((divid!=null)&&(typeof document.getElementById(divid)!="undefined")){document.getElementById(divid).innerHTML=value}else{if((typeof console!="undefined")&&(typeof console.log=="function")){console.log(value)}}};JSROOT.JSONR_unref=function(value,dy){var c,i,k,ks;if(!dy){dy=[]}switch(typeof value){case"string":if((value.length>5)&&(value.substr(0,5)=="$ref:")){c=parseInt(value.substr(5));if(!isNaN(c)&&(c=0){return map.clones[i]}if(Object.prototype.toString.apply(src)==="[object Array]"){if((tgt==null)||(Object.prototype.toString.apply(tgt)!="[object Array]")){tgt=[];map.obj.push(src);map.clones.push(tgt)}for(i=0;i0){if(url==opt){return""}pos=url.indexOf("&");if(pos<0){pos=url.length}if(url.indexOf(opt)==0){if(url.charAt(opt.length)=="&"){return""}if(url.charAt(opt.length)=="="){return url.slice(opt.length+1,pos).replace(/%27/g,"'").replace(/%22/g,'"').replace(/%20/g," ").replace(/%3C/g,"<").replace(/%3E/g,">").replace(/%5B/g,"[").replace(/%5D/g,"]")}}url=url.slice(pos+1)}return dflt};JSROOT.ParseAsArray=function(val){var res=[];if(typeof val!="string"){return res}val=val.trim();if(val==""){return res}if((val.length<2)||(val[0]!="[")||(val[val.length-1]!="]")){res.push(val);return res}var arr=val.substr(1,val.length-2).split(",");for(var i in arr){var sub=arr[i].trim();if((sub.length>1)&&(sub[0]==sub[sub.length-1])&&((sub[0]=='"')||(sub[0]=="'"))){sub=sub.substr(1,sub.length-2)}res.push(sub)}return res};JSROOT.GetUrlOptionAsArray=function(opt,url){var res=[];while(opt.length>0){var separ=opt.indexOf(";");var part=separ>0?opt.substr(0,separ):opt;if(separ>0){opt=opt.substr(separ+1)}else{opt=""}var val=this.GetUrlOption(part,url,null);res=res.concat(JSROOT.ParseAsArray(val))}return res};JSROOT.findFunction=function(name){var func=window[name];if(typeof func=="function"){return func}var separ=name.lastIndexOf(".");if(separ<0){return null}var namespace=name.slice(0,separ);name=name.slice(separ+1);if(namespace=="JSROOT"){func=this[name]}else{if(namespace=="JSROOT.Painter"){if("Painter" in this){func=this["Painter"][name]}}else{if(window[namespace]){func=window[namespace][name]}}}return(typeof func=="function")?func:null};JSROOT.CallBack=function(func,arg1,arg2){if(func==null){return}if(typeof func=="string"){func=JSROOT.findFunction(func)}if(typeof func=="function"){return func(arg1,arg2)}if(typeof func!="object"){return}if(("obj" in func)&&("func" in func)&&(typeof func.obj=="object")&&(typeof func.func=="string")&&(typeof func.obj[func.func]=="function")){return func.obj[func.func](arg1,arg2)}if(("_this" in func)&&("func" in func)&&(typeof func.func=="function")){return func.func.call(func._this,arg1,arg2)}};JSROOT.NewHttpRequest=function(url,kind,user_call_back){var xhr=new XMLHttpRequest();function callback(res){if(typeof user_call_back=="function"){user_call_back.call(xhr,res)}}var pthis=this;if(window.ActiveXObject){xhr.onreadystatechange=function(){if(xhr.readyState!=4){return}if(xhr.status!=200&&xhr.status!=206){return callback(null)}if(kind=="xml"){return callback(xhr.responseXML)}if(kind=="text"){return callback(xhr.responseText)}if(kind=="object"){return callback(pthis.parse(xhr.responseText))}if(kind=="head"){return callback(xhr)}var filecontent=new String("");var array=new VBArray(xhr.responseBody).toArray();for(var i=0;i0)){return JSROOT.loadScript(urllist,callback,debugout)}if(debugout){document.getElementById(debugout).innerHTML=""}JSROOT.CallBack(callback)}if((urllist==null)||(urllist.length==0)){return completeLoad()}var filename=urllist;var separ=filename.indexOf(";");if(separ>0){filename=filename.substr(0,separ);urllist=urllist.slice(separ+1)}else{urllist=""}var isrootjs=false;if(filename.indexOf("$$$")==0){isrootjs=true;filename=filename.slice(3);if((filename.indexOf("style/")==0)&&JSROOT.source_min&&(filename.lastIndexOf(".css")==filename.length-3)&&(filename.indexOf(".min.css")<0)){filename=filename.slice(0,filename.length-4)+".min.css"}}var isstyle=filename.indexOf(".css")>0;if(isstyle){var styles=document.getElementsByTagName("link");for(var n in styles){if((styles[n]["type"]!="text/css")||(styles[n]["rel"]!="stylesheet")){continue}var href=styles[n]["href"];if((href==null)||(href.length==0)){continue}if(href.indexOf(filename)>=0){return completeLoad()}}}else{var scripts=document.getElementsByTagName("script");for(var n in scripts){if(scripts[n]["type"]!="text/javascript"){continue}var src=scripts[n]["src"];if((src==null)||(src.length==0)){continue}if((src.indexOf(filename)>=0)&&(src.indexOf("load=")<0)){return completeLoad()}}}if(isrootjs&&(JSROOT.source_dir!=null)){filename=JSROOT.source_dir+filename}var element=null;JSROOT.console("loading "+filename+" ...",debugout);if(isstyle){element=document.createElement("link");element.setAttribute("rel","stylesheet");element.setAttribute("type","text/css");element.setAttribute("href",filename)}else{element=document.createElement("script");element.setAttribute("type","text/javascript");element.setAttribute("src",filename)}if(element.readyState){element.onreadystatechange=function(){if(element.readyState=="loaded"||element.readyState=="complete"){element.onreadystatechange=null;completeLoad()}}}else{element.onload=function(){element.onload=null;completeLoad()}}document.getElementsByTagName("head")[0].appendChild(element)};JSROOT.AssertPrerequisites=function(kind,callback,debugout){var jsroot=this;if((typeof kind!="string")||(kind=="")){return jsroot.CallBack(callback)}if(kind=="shift"){var req=jsroot.doing_assert.shift();kind=req._kind;callback=req._callback;debugout=req._debug}else{if(jsroot.doing_assert!=null){return jsroot.doing_assert.push({_kind:kind,_callback:callback,_debug:debugout})}else{jsroot.doing_assert=[]}}if(kind.charAt(kind.length-1)!=";"){kind+=";"}var ext=jsroot.source_min?".min":"";var need_jquery=false;var mainfiles="",extrafiles="";var modules=[];if(kind.indexOf("io;")>=0){mainfiles+="$$$scripts/rawinflate"+ext+".js;$$$scripts/JSRootIOEvolution"+ext+".js;";modules.push("JSRootIOEvolution")}if(kind.indexOf("2d;")>=0){if(typeof d3!="undefined"){jsroot.console("Reuse existing d3.js "+d3.version+", required 3.4.10",debugout)}else{mainfiles+="$$$scripts/d3.v3.min.js;"}modules.push("JSRootPainter");mainfiles+="$$$scripts/JSRootPainter"+ext+".js;";extrafiles+="$$$style/JSRootPainter"+ext+".css;"}if(kind.indexOf("jq;")>=0){need_jquery=true}if(kind.indexOf("jq2d;")>=0){mainfiles+="$$$scripts/JSRootPainter.jquery"+ext+".js;";modules.push("JSRootPainter.jquery");need_jquery=true}if(kind.indexOf("3d;")>=0){need_jquery=true;mainfiles+="$$$scripts/jquery.mousewheel"+ext+".js;$$$scripts/three.min.js;$$$scripts/helvetiker_regular.typeface.js;$$$scripts/helvetiker_bold.typeface.js;$$$scripts/JSRoot3DPainter"+ext+".js;";modules.push("JSRoot3DPainter")}if(kind.indexOf("mathjax;")>=0){if(typeof MathJax=="undefined"){mainfiles+="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_SVG,"+jsroot.source_dir+"scripts/mathjax_config.js;"}if(JSROOT.MathJax==0){JSROOT.MathJax=1}modules.push("MathJax")}if(kind.indexOf("simple;")>=0){need_jquery=true;mainfiles+="$$$scripts/JSRootInterface"+ext+".js;";extrafiles+="$$$style/JSRootInterface"+ext+".css;";modules.push("JSRootInterface")}if(need_jquery&&(JSROOT.load_jquery==null)){var has_jq=(typeof jQuery!="undefined"),lst_jq="";if(has_jq){jsroot.console("Reuse existing jQuery "+jQuery.fn.jquery+", required 2.1.1",debugout)}else{lst_jq+="$$$scripts/jquery.min.js;"}if(has_jq&&typeof $.ui!="undefined"){jsroot.console("Reuse existing jQuery-ui "+$.ui.version+", required 1.11.0",debugout)}else{lst_jq+="$$$scripts/jquery-ui.min.js;";extrafiles+="$$$style/jquery-ui"+ext+".css;"}if(JSROOT.touches){lst_jq+="$$$scripts/touch-punch.min.js;";modules.push("touch-punch")}modules.splice(0,0,"jquery","jquery-ui");mainfiles=lst_jq+mainfiles;jsroot.load_jquery=true}var pos=kind.indexOf("user:");if(pos<0){pos=kind.indexOf("load:")}if(pos>=0){extrafiles+=kind.slice(pos+5)}var load_callback=function(){if(jsroot.doing_assert.length==0){jsroot.doing_assert=null}jsroot.CallBack(callback);if(jsroot.doing_assert&&(jsroot.doing_assert.length>0)){jsroot.AssertPrerequisites("shift")}};if((typeof define==="function")&&define.amd&&(modules.length>0)){jsroot.console("loading "+modules+" with require.js",debugout);require(modules,function(){jsroot.loadScript(extrafiles,load_callback,debugout)})}else{jsroot.loadScript(mainfiles+extrafiles,load_callback,debugout)}};JSROOT.BuildSimpleGUI=function(user_scripts,andThen){var jsroot=this;if(typeof user_scripts=="function"){andThen=user_scripts;user_scripts=null}var debugout=null;var nobrowser=jsroot.GetUrlOption("nobrowser")!=null;var requirements="io;2d;";if(document.getElementById("simpleGUI")){debugout="simpleGUI";if((jsroot.GetUrlOption("json")!=null)&&(jsroot.GetUrlOption("file")==null)&&(jsroot.GetUrlOption("files")==null)){requirements="2d;"}}else{if(document.getElementById("onlineGUI")){debugout="onlineGUI";requirements="2d;"}else{if(document.getElementById("drawGUI")){debugout="drawGUI";requirements="2d;";nobrowser=true}}}if(user_scripts=="check_existing_elements"){user_scripts=null;if(debugout==null){return}}if(!nobrowser){requirements+="jq2d;simple;"}if(user_scripts==null){user_scripts=jsroot.GetUrlOption("autoload")}if(user_scripts==null){user_scripts=jsroot.GetUrlOption("load")}if(user_scripts!=null){requirements+="load:"+user_scripts+";"}this.AssertPrerequisites(requirements,function(){var func=jsroot.findFunction(nobrowser?"JSROOT.BuildNobrowserGUI":"BuildSimpleGUI");jsroot.CallBack(func);jsroot.CallBack(andThen)},debugout)};JSROOT.addFormula=function(obj){var formula=obj.fTitle;formula=formula.replace("abs(","Math.abs(");formula=formula.replace("sin(","Math.sin(");formula=formula.replace("cos(","Math.cos(");var code=obj.fName+" = function(x) { return "+formula+" };";eval(code);var sig=obj.fName+"(x)";var pos=JSROOT.function_list.indexOf(sig);if(pos>=0){JSROOT.function_list.splice(pos,1)}JSROOT.function_list.push(sig)};JSROOT.Create=function(typename,target){var obj=target;if(obj==null){obj={_typename:typename}}if(typename=="TObject"){JSROOT.extend(obj,{fUniqueID:0,fBits:50331656})}else{if(typename=="TNamed"){JSROOT.extend(obj,{fUniqueID:0,fBits:50331656,fName:"",fTitle:""})}else{if((typename=="TList")||(typename=="THashList")){JSROOT.extend(obj,{name:typename,arr:[],opt:[]})}else{if(typename=="TAttAxis"){JSROOT.extend(obj,{fNdivisions:510,fAxisColor:1,fLabelColor:1,fLabelFont:42,fLabelOffset:0.005,fLabelSize:0.035,fTickLength:0.03,fTitleOffset:1,fTitleSize:0.035,fTitleColor:1,fTitleFont:42})}else{if(typename=="TAxis"){JSROOT.Create("TNamed",obj);JSROOT.Create("TAttAxis",obj);JSROOT.extend(obj,{fNbins:0,fXmin:0,fXmax:0,fXbins:[],fFirst:0,fLast:0,fBits2:0,fTimeDisplay:false,fTimeFormat:"",fLabels:null})}else{if(typename=="TAttLine"){JSROOT.extend(obj,{fLineColor:1,fLineStyle:1,fLineWidth:1})}else{if(typename=="TAttFill"){JSROOT.extend(obj,{fFillColor:0,fFillStyle:0})}else{if(typename=="TAttMarker"){JSROOT.extend(obj,{fMarkerColor:1,fMarkerStyle:1,fMarkerSize:1})}else{if(typename=="TBox"){JSROOT.Create("TObject",obj);JSROOT.Create("TAttLine",obj);JSROOT.Create("TAttFill",obj);JSROOT.extend(obj,{fX1:0,fY1:0,fX2:1,fY2:1})}else{if(typename=="TPave"){JSROOT.Create("TBox",obj);JSROOT.extend(obj,{fX1NDC:0,fY1NDC:0,fX2NDC:1,fY2NDC:1,fBorderSize:0,fInit:1,fShadowColor:1,fCornerRadius:0,fOption:"blNDC",fName:"title"})}else{if(typename=="TAttText"){JSROOT.extend(obj,{fTextAngle:0,fTextSize:0,fTextAlign:22,fTextColor:1,fTextFont:42})}else{if(typename=="TPaveText"){JSROOT.Create("TPave",obj);JSROOT.Create("TAttText",obj);JSROOT.extend(obj,{fLabel:"",fLongest:27,fMargin:0.05,fLines:JSROOT.Create("TList")})}else{if(typename=="TPaveStats"){JSROOT.Create("TPaveText",obj);JSROOT.extend(obj,{fOptFit:0,fOptStat:0,fFitFormat:"",fStatFormat:"",fParent:null})}else{if(typename=="TObjString"){JSROOT.Create("TObject",obj);JSROOT.extend(obj,{fString:""})}else{if(typename=="TH1"){JSROOT.Create("TNamed",obj);JSROOT.Create("TAttLine",obj);JSROOT.Create("TAttFill",obj);JSROOT.Create("TAttMarker",obj);JSROOT.extend(obj,{fNcells:0,fXaxis:JSROOT.Create("TAxis"),fYaxis:JSROOT.Create("TAxis"),fZaxis:JSROOT.Create("TAxis"),fBarOffset:0,fBarWidth:1000,fEntries:0,fTsumw:0,fTsumw2:0,fTsumwx:0,fTsumwx2:0,fMaximum:-1111,fMinimum:-1111,fNormFactor:0,fContour:[],fSumw2:[],fOption:"",fFunctions:JSROOT.Create("TList"),fBufferSize:0,fBuffer:[],fBinStatErrOpt:0})}else{if(typename=="TH1I"||typename=="TH1F"||typename=="TH1D"||typename=="TH1S"||typename=="TH1C"){JSROOT.Create("TH1",obj);JSROOT.extend(obj,{fArray:[]})}else{if(typename=="TH2"){JSROOT.Create("TH1",obj);JSROOT.extend(obj,{fScalefactor:1,fTsumwy:0,fTsumwy2:0,fTsumwxy:0})}else{if(typename=="TH2I"||typename=="TH2F"||typename=="TH2D"||typename=="TH2S"||typename=="TH2C"){JSROOT.Create("TH2",obj);JSROOT.extend(obj,{fArray:[]})}else{if(typename=="TGraph"){JSROOT.Create("TNamed",obj);JSROOT.Create("TAttLine",obj);JSROOT.Create("TAttFill",obj);JSROOT.Create("TAttMarker",obj);JSROOT.extend(obj,{fFunctions:JSROOT.Create("TList"),fHistogram:JSROOT.CreateTH1(),fMaxSize:0,fMaximum:0,fMinimum:0,fNpoints:0,fX:[],fY:[]})}}}}}}}}}}}}}}}}}}}JSROOT.addMethods(obj,typename);return obj};JSROOT.CreateTList=function(){return JSROOT.Create("TList")};JSROOT.CreateTAxis=function(){return JSROOT.Create("TAxis")};JSROOT.CreateTH1=function(nbinsx){var histo=JSROOT.Create("TH1I");JSROOT.extend(histo,{fName:"dummy_histo_"+this.id_counter++,fTitle:"dummytitle"});if(nbinsx!=null){histo.fNcells=nbinsx+2;for(var i=0;i0){graph.fMaxSize=graph.fNpoints=npoints;for(var i=0;imaxx){maxx=graph.fX[i]}if(graph.fY[i]maxy){maxy=graph.fY[i]}}if(miny==maxy){maxy=miny+1}if(graph.fHistogram==null){graph.fHistogram=JSROOT.CreateTH1(graph.fNpoints)}graph.fHistogram["fXaxis"]["fXmin"]=minx;graph.fHistogram["fXaxis"]["fXmax"]=maxx;if((ygap!=null)&&(ygap!=0)){if(miny>0){miny*=(1-2*ygap)}else{miny*=(1+ygap)}if(maxy>0){maxy*=(1+ygap)}else{maxy*=(1-2*ygap)}}graph.fHistogram["fYaxis"]["fXmin"]=miny;graph.fHistogram["fYaxis"]["fXmax"]=maxy};JSROOT.addMethods=function(obj,obj_typename){if(("fBits" in obj)&&!("TestBit" in obj)){obj.TestBit=function(f){return((obj.fBits&f)!=0)}}if(!obj_typename){if(!("_typename" in obj)){return}obj_typename=obj._typename}var EBinErrorOpt={kNormal:0,kPoisson:1,kPoisson2:2};var EErrorType={kERRORMEAN:0,kERRORSPREAD:1,kERRORSPREADI:2,kERRORSPREADG:3};if(obj_typename.indexOf("TAxis")==0){obj.getFirst=function(){if(!this.TestBit(JSROOT.EAxisBits.kAxisRange)){return 1}return this["fFirst"]};obj.getLast=function(){if(!this.TestBit(JSROOT.EAxisBits.kAxisRange)){return this["fNbins"]}return this["fLast"]};obj.getBinCenter=function(bin){var binwidth;if(!this["fNbins"]||bin<1||bin>this["fNbins"]){binwidth=(this["fXmax"]-this["fXmin"])/this["fNbins"];return this["fXmin"]+(bin-1)*binwidth+0.5*binwidth}else{binwidth=this["fXbins"][bin]-this["fXbins"][bin-1];return this["fXbins"][bin-1]+0.5*binwidth}}}if((obj_typename=="TList")||(obj_typename=="THashList")){obj.Clear=function(){this["arr"]=new Array;this["opt"]=new Array};obj.Add=function(obj,opt){this["arr"].push(obj);this["opt"].push((opt&&typeof opt=="string")?opt:"")};obj.AddFirst=function(obj,opt){this["arr"].unshift(obj);this["opt"].unshift((opt&&typeof opt=="string")?opt:"")};obj.RemoveAt=function(indx){this["arr"].splice(indx,1);this["opt"].splice(indx,1)}}if((obj_typename=="TPaveText")||(obj_typename=="TPaveStats")){obj.AddText=function(txt){this["fLines"].Add({fTitle:txt,fTextColor:1})};obj.Clear=function(){this["fLines"].Clear()}}if((obj_typename.indexOf("TFormula")!=-1)||(obj_typename.indexOf("TF1")==0)){obj.evalPar=function(x){var i,_function=this["fTitle"];_function=_function.replace("TMath::Exp(","Math.exp(");_function=_function.replace("TMath::Abs(","Math.abs(");_function=_function.replace("gaus(","JSROOT.Math.gaus(this, "+x+", ");_function=_function.replace("gausn(","JSROOT.Math.gausn(this, "+x+", ");_function=_function.replace("expo(","JSROOT.Math.expo(this, "+x+", ");_function=_function.replace("landau(","JSROOT.Math.landau(this, "+x+", ");_function=_function.replace("landaun(","JSROOT.Math.landaun(this, "+x+", ");_function=_function.replace("pi","Math.PI");for(i=0;i0){res.xmin=res.xmax=this["fX"][0];res.ymin=res.ymax=this["fY"][0];for(var i=1;ires.xmax){res.xmax=this["fX"][i]}if(this["fY"][i]res.ymax){res.ymax=this["fY"][i]}}}return res};obj.IsInside=function(xp,yp){var j=this["fNpoints"]-1;var x=this["fX"],y=this["fY"];var oddNodes=false;for(var i=0;i=yp)||(y[j]=yp)){if(x[i]+(yp-y[i])/(y[j]-y[i])*(x[j]-x[i])=this["fNcells"]){bin=this["fNcells"]-1}if(this["fNcells"]&&this["fSumw2"].length>0){var err2=this["fSumw2"][bin];return Math.sqrt(err2)}var error2=Math.abs(this["fArray"][bin]);return Math.sqrt(error2)};obj.getBinErrorLow=function(bin){if(this["fBinStatErrOpt"]==EBinErrorOpt.kNormal){return this.getBinError(bin)}if(bin<0){bin=0}if(bin>=this["fNcells"]){bin=this["fNcells"]-1}var alpha=1-0.682689492;if(this["fBinStatErrOpt"]==EBinErrorOpt.kPoisson2){alpha=0.05}var c=this["fArray"][bin];var n=Math.round(c);if(n<0){alert("GetBinErrorLow : Histogram has negative bin content-force usage to normal errors");this["fBinStatErrOpt"]=EBinErrorOpt.kNormal;return this.getBinError(bin)}if(n==0){return 0}return c-JSROOT.Math.gamma_quantile(alpha/2,n,1)};obj.getBinErrorUp=function(bin){if(this["fBinStatErrOpt"]==EBinErrorOpt.kNormal){return this.getBinError(bin)}if(bin<0){bin=0}if(bin>=this["fNcells"]){bin=this["fNcells"]-1}var alpha=1-0.682689492;if(this["fBinStatErrOpt"]==EBinErrorOpt.kPoisson2){alpha=0.05}var c=this["fArray"][bin];var n=Math.round(c);if(n<0){alert("GetBinErrorLow : Histogram has negative bin content-force usage to normal errors");this["fBinStatErrOpt"]=EBinErrorOpt.kNormal;return this.getBinError(bin)}return JSROOT.Math.gamma_quantile_c(alpha/2,n+1,1)-c};obj.getBinLowEdge=function(bin){if(this["fXaxis"]["fXbins"].length&&bin>0&&bin<=this["fXaxis"]["fNbins"]){return this["fXaxis"]["fXbins"]["fArray"][bin-1]}var binwidth=(this["fXaxis"]["fXmax"]-this["fXaxis"]["fXmin"])/this["fXaxis"]["fNbins"];return this["fXaxis"]["fXmin"]+(bin-1)*binwidth};obj.getBinUpEdge=function(bin){var binwidth;if(!this["fXaxis"]["fXbins"].length||bin<1||bin>this["fXaxis"]["fNbins"]){binwidth=(this["fXaxis"]["fXmax"]-this["fXaxis"]["fXmin"])/this["fXaxis"]["fNbins"];return this["fXaxis"]["fXmin"]+bin*binwidth}else{binwidth=this["fArray"][bin]-this["fArray"][bin-1];return this["fArray"][bin-1]+binwidth}};obj.getBinWidth=function(bin){if(this["fXaxis"]["fNbins"]<=0){return 0}if(this["fXaxis"]["fXbins"].length<=0){return(this["fXaxis"]["fXmax"]-this["fXaxis"]["fXmin"])/this["fXaxis"]["fNbins"]}if(bin>this["fXaxis"]["fNbins"]){bin=this["fXaxis"]["fNbins"]}if(bin<1){bin=1}return this["fArray"][bin]-this["fArray"][bin-1]};obj.add=function(h1,c1){if(!h1||typeof(h1)=="undefined"){alert("Add : Attempt to add a non-existing histogram");return false}if(!c1||typeof(c1)=="undefined"){c1=1}var nbinsx=this["fXaxis"]["fNbins"],nbinsy=this["fYaxis"]["fNbins"],nbinsz=this["fZaxis"]["fNbins"];if(this["fDimension"]<2){nbinsy=-1}if(this["fDimension"]<3){nbinsz=-1}if(this["fSumw2"].length==0&&h1.fSumw2.length!=0){this.sumw2()}if(this["fEntries"]==NaN){this["fEntries"]=0}var entries=Math.abs(this["fEntries"]+c1*h1.fEntries);var resetStats=(c1<0);var s1,s2;if(!resetStats){s1=this.getStats();s2=h1.getStats()}this["fMinimum"]=-1111;this["fMaximum"]=-1111;var bin,binx,biny,binz;var cu,factor=1;if(Math.abs(h1.fNormFactor)>Number.MIN_VALUE){factor=h1.fNormFactor/h1.getSumOfWeights()}for(binz=0;binz<=nbinsz+1;binz++){for(biny=0;biny<=nbinsy+1;biny++){for(binx=0;binx<=nbinsx+1;binx++){bin=binx+(nbinsx+2)*(biny+(nbinsy+2)*binz);if(this.TestBit(JSROOT.TH1StatusBits.kIsAverage)&&h1.TestBit(JSROOT.TH1StatusBits.kIsAverage)){var y1=h1.getBinContent(bin),y2=this.getBinContent(bin),e1=h1.getBinError(bin),e2=this.getBinError(bin),w1=1,w2=1;if(e1>0){w1=1/(e1*e1)}else{if(h1.fSumw2.length){w1=1e+200;if(y1==0){var sf=(s2[0]!=0)?s2[1]/s2[0]:1;w1=1/(sf*sf)}}}if(e2>0){w2=1/(e2*e2)}else{if(this["fSumw2"].length){w2=1e+200;if(y2==0){var sf=(s1[0]!=0)?s1[1]/s1[0]:1;w2=1/(sf*sf)}}}var y=(w1*y1+w2*y2)/(w1+w2);this.setBinContent(bin,y);if(this["fSumw2"].length){var err2=1/(w1+w2);if(err2<1e-200){err2=0}this["fSumw2"][bin]=err2}}else{cu=c1*factor*h1.getBinContent(bin);this["fArray"][bin]+=cu;if(this["fSumw2"].length){var e1=factor*h1.getBinError(bin);this["fSumw2"][bin]+=c1*c1*e1*e1}}}}}if(resetStats){this.resetStats()}else{var kNstat=13;for(var i=0;i=nx){binx=nx-1}return binx}if(this["fDimension"]<3){nx=this["fXaxis"]["fNbins"]+2;if(binx<0){binx=0}if(binx>=nx){binx=nx-1}ny=this["fYaxis"]["fNbins"]+2;if(biny<0){biny=0}if(biny>=ny){biny=ny-1}return binx+nx*biny}if(this["fDimension"]<4){nx=this["fXaxis"]["fNbins"]+2;if(binx<0){binx=0}if(binx>=nx){binx=nx-1}ny=this["fYaxis"]["fNbins"]+2;if(biny<0){biny=0}if(biny>=ny){biny=ny-1}nz=this["fZaxis"]["fNbins"]+2;if(binz<0){binz=0}if(binz>=nz){binz=nz-1}return binx+nx*(biny+ny*binz)}return -1};obj.getBinXYZ=function(binglobal){var binx,biny,binz;var nx=this["fXaxis"]["fNbins"]+2;var ny=this["fYaxis"]["fNbins"]+2;if(this["fDimension"]<2){binx=binglobal%nx;biny=-1;binz=-1}if(this["fDimension"]<3){binx=binglobal%nx;biny=((binglobal-binx)/nx)%ny;binz=-1}if(this["fDimension"]<4){binx=binglobal%nx;biny=((binglobal-binx)/nx)%ny;binz=((binglobal-binx)/nx-biny)/ny}return{binsx:binx,biny:biny,binz:binz}};obj.getMaximum=function(maxval){if(this["fMaximum"]!=-1111){return this["fMaximum"]}if(!maxval||typeof(maxval)=="undefined"){maxval=Number.MAX_VALUE}var bin,binx,biny,binz;var xfirst=this["fXaxis"].getFirst();xlast=this["fXaxis"].getLast(),yfirst=this["fYaxis"].getFirst(),ylast=this["fYaxis"].getLast(),zfirst=this["fZaxis"].getFirst(),zlast=this["fZaxis"].getLast();var maximum=-Number.MAX_VALUE,val;for(binz=zfirst;binz<=zlast;binz++){for(biny=yfirst;biny<=ylast;biny++){for(binx=xfirst;binx<=xlast;binx++){bin=this.getBin(binx,biny,binz);val=this.getBinContent(bin);if(val>maximum&&valminval){minimum=val}}}}return minimum};obj.getSumOfWeights=function(){var sum=0;for(var binz=1;binz<=this["fZaxis"]["fNbins"];binz++){for(var biny=1;biny<=this["fYaxis"]["fNbins"];biny++){for(var binx=1;binx<=this["fXaxis"]["fNbins"];binx++){var bin=this.getBin(binx,biny,binz);sum+=this.getBinContent(bin)}}}return sum};obj.labelsInflate=function(ax){var axis=null;var achoice=ax[0].toUpperCase();if(achoice=="X"){axis=this["fXaxis"]}if(achoice=="Y"){axis=this["fYaxis"]}if(achoice=="Z"){axis=this["fZaxis"]}if(axis==null){return}var hold=JSROOT.clone(this);var timedisp=axis.fTimeDisplay;var nbxold=this["fXaxis"]["fNbins"];var nbyold=this["fYaxis"]["fNbins"];var nbzold=this["fZaxis"]["fNbins"];var nbins=axis.fNbins;var xmin=axis.fXmin;var xmax=axis.fXmax;xmax=xmin+2*(xmax-xmin);axis.fFirst=1;axis.fLast=axis.fNbins;this["fBits"]&=~(JSROOT.EAxisBits.kAxisRange&16777215);axis.fNbins=2*nbins;axis.fXmin=xmin;axis.fXmax=xmax;this["fNcells"]=-1;this["fArray"].length=-1;var errors=this["fSumw2"].length;if(errors){["fSumw2"].length=this["fNcells"]}axis.fTimeDisplay=timedisp;Reset("ICE");this["fSumw2"].splice(0,this["fSumw2"].length);this["fMinimum"]=-1111;this["fMaximum"]=-1111;var oldEntries=this["fEntries"];var bin,ibin,bins;for(ibin=0;ibinnbxold||bins.biny>nbyold||bins.binz>nbzold){bin=-1}if(bin>0){var cu=hold.getBinContent(bin);this["fArray"][bin]+=cu;if(errors){this["fSumw2"][ibin]+=hold.fSumw2[bin]}}}this["fEntries"]=oldEntries;delete hold};obj.resetStats=function(){this["fTsumw"]=0;this["fEntries"]=1;var stats=this.getStats();this["fTsumw"]=stats[0];this["fTsumw2"]=stats[1];this["fTsumwx"]=stats[2];this["fTsumwx2"]=stats[3];this["fEntries"]=Math.abs(this["fTsumw"]);if(this["fSumw2"].length>0&&this["fTsumw"]>0&&stats[1]>0){this["fEntries"]=stats[0]*stats[0]/stats[1]}};obj.setBinContent=function(bin,content){this["fEntries"]++;this["fTsumw"]=0;if(bin<0){return}if(bin>=this["fNcells"]-1){if(this["fXaxis"]["fTimeDisplay"]||this.TestBit(JSROOT.TH1StatusBits.kCanRebin)){while(bin>=this["fNcells"]-1){this.labelsInflate()}}else{if(bin==this["fNcells"]-1){this["fArray"][bin]=content}return}}this["fArray"][bin]=content};obj.sumw2=function(){if(this["fSumw2"].length==this["fNcells"]){return}this["fSumw2"].length=this["fNcells"];if(this["fEntries"]>0){for(var bin=0;bin=this["fNcells"]){bin=this["fNcells"]-1}return this["fArray"][bin]};obj.getStats=function(){var bin,binx,w,err,x,stats=new Array(0,0,0,0,0);if(this["fXaxis"]["fLabels"]&&this.TestBit(JSROOT.TH1StatusBits.kCanRebin)){stats[0]=this["fTsumw"];stats[1]=this["fTsumw2"];stats[2]=0;stats[3]=0}else{if((this["fTsumw"]==0&&this["fEntries"]>0)||this["fXaxis"].TestBit(JSROOT.EAxisBits.kAxisRange)){for(bin=0;bin<4;bin++){stats[bin]=0}var firstBinX=this["fXaxis"].getFirst();var lastBinX=this["fXaxis"].getLast();for(binx=firstBinX;binx<=lastBinX;binx++){x=this["fXaxis"].getBinCenter(binx);w=this.getBinContent(binx);err=Math.abs(this.getBinError(binx));stats[0]+=w;stats[1]+=err*err;stats[2]+=w*x;stats[3]+=w*x*x}}else{stats[0]=this["fTsumw"];stats[1]=this["fTsumw2"];stats[2]=this["fTsumwx"];stats[3]=this["fTsumwx2"]}}return stats}}if(obj_typename.indexOf("TH2")==0){obj.fDimension=2;obj.getBin=function(x,y){var nx=this["fXaxis"]["fNbins"]+2;return(x+nx*y)};obj.getBinContent=function(x,y){return this["fArray"][this.getBin(x,y)]};obj.getStats=function(){var bin,binx,biny,stats=new Array(0,0,0,0,0,0,0,0,0,0,0,0,0);if((this["fTsumw"]==0&&this["fEntries"]>0)||this["fXaxis"].TestBit(JSROOT.EAxisBits.kAxisRange)||this["fYaxis"].TestBit(JSROOT.EAxisBits.kAxisRange)){var firstBinX=this["fXaxis"].getFirst();var lastBinX=this["fXaxis"].getLast();var firstBinY=this["fYaxis"].getFirst();var lastBinY=this["fYaxis"].getLast();if(this["fgStatOverflows"]){if(!this["fXaxis"].TestBit(JSROOT.EAxisBits.kAxisRange)){if(firstBinX==1){firstBinX=0}if(lastBinX==this["fXaxis"]["fNbins"]){lastBinX+=1}}if(!this["fYaxis"].TestBit(JSROOT.EAxisBits.kAxisRange)){if(firstBinY==1){firstBinY=0}if(lastBinY==this["fYaxis"]["fNbins"]){lastBinY+=1}}}for(biny=firstBinY;biny<=lastBinY;biny++){y=this["fYaxis"].getBinCenter(biny);for(binx=firstBinX;binx<=lastBinX;binx++){bin=this.getBin(binx,biny);x=this["fXaxis"].getBinCenter(binx);w=this.GetBinContent(bin);err=Math.abs(this.getBinError(bin));stats[0]+=w;stats[1]+=err*err;stats[2]+=w*x;stats[3]+=w*x*x;stats[4]+=w*y;stats[5]+=w*y*y;stats[6]+=w*x*y}}}else{stats[0]=this["fTsumw"];stats[1]=this["fTsumw2"];stats[2]=this["fTsumwx"];stats[3]=this["fTsumwx2"];stats[4]=this["fTsumwy"];stats[5]=this["fTsumwy2"];stats[6]=this["fTsumwxy"]}return stats}}if(obj_typename.indexOf("TH3")==0){obj.fDimension=3;obj.getBin=function(x,y,z){var nx=this["fXaxis"]["fNbins"]+2;if(x<0){x=0}if(x>=nx){x=nx-1}var ny=this["fYaxis"]["fNbins"]+2;if(y<0){y=0}if(y>=ny){y=ny-1}return(x+nx*(y+ny*z))};obj.getBinContent=function(x,y,z){return this["fArray"][this.getBin(x,y,z)]};obj.getStats=function(){var bin,binx,biny,binz,stats=new Array(0,0,0,0,0,0,0,0,0,0,0,0,0);if((obj.fTsumw==0&&obj.fEntries>0)||obj.fXaxis.TestBit(JSROOT.EAxisBits.kAxisRange)||obj.fYaxis.TestBit(JSROOT.EAxisBits.kAxisRange)||obj.fZaxis.TestBit(JSROOT.EAxisBits.kAxisRange)){var firstBinX=obj.fXaxis.getFirst();var lastBinX=obj.fXaxis.getLast();var firstBinY=obj.fYaxis.getFirst();var lastBinY=obj.fYaxis.getLast();var firstBinZ=obj.fZaxis.getFirst();var lastBinZ=obj.fZaxis.getLast();if(obj.fgStatOverflows){if(!obj.fXaxis.TestBit(JSROOT.EAxisBits.kAxisRange)){if(firstBinX==1){firstBinX=0}if(lastBinX==obj.fXaxis["fNbins"]){lastBinX+=1}}if(!obj.fYaxis.TestBit(JSROOT.EAxisBits.kAxisRange)){if(firstBinY==1){firstBinY=0}if(lastBinY==obj.fYaxis["fNbins"]){lastBinY+=1}}if(!obj.fZaxis.TestBit(JSROOT.EAxisBits.kAxisRange)){if(firstBinZ==1){firstBinZ=0}if(lastBinZ==obj.fZaxis["fNbins"]){lastBinZ+=1}}}for(binz=firstBinZ;binz<=lastBinZ;binz++){z=obj.fZaxis.getBinCenter(binz);for(biny=firstBinY;biny<=lastBinY;biny++){y=obj.fYaxis.getBinCenter(biny);for(binx=firstBinX;binx<=lastBinX;binx++){bin=obj.getBin(binx,biny,binz);x=obj.fXaxis.getBinCenter(binx);w=obj.GetBinContent(bin);err=Math.abs(obj.getBinError(bin));stats[0]+=w;stats[1]+=err*err;stats[2]+=w*x;stats[3]+=w*x*x;stats[4]+=w*y;stats[5]+=w*y*y;stats[6]+=w*x*y;stats[7]+=w*z;stats[8]+=w*z*z;stats[9]+=w*x*z;stats[10]+=w*y*z}}}}else{stats[0]=obj.fTsumw;stats[1]=obj.fTsumw2;stats[2]=obj.fTsumwx;stats[3]=obj.fTsumwx2;stats[4]=obj.fTsumwy;stats[5]=obj.fTsumwy2;stats[6]=obj.fTsumwxy;stats[7]=obj.fTsumwz;stats[8]=obj.fTsumwz2;stats[9]=obj.fTsumwxz;stats[10]=obj.fTsumwyz}return stats}}if(obj_typename.indexOf("THStack")==0){obj.buildStack=function(){if("fStack" in this){return}if(!"fHists" in this){return}var nhists=this["fHists"].arr.length;if(nhists<=0){return}this["fStack"]=JSROOT.Create("TList");var h=JSROOT.clone(this["fHists"].arr[0]);this["fStack"].arr.push(h);for(var i=1;ithemax){themax=them}}}if(lerr){for(var i=0;i3&&axis<11)||axis>13){return 0}var stats=this.getStats();if(stats[0]==0){return 0}var ax=new Array(2,4,7);return stats[ax[axis-1]]/stats[0]};obj.getRMS=function(axis){if(axis<1||(axis>3&&axis<11)||axis>13){return 0}var stats=this.getStats();if(stats[0]==0){return 0}var ax=new Array(2,4,7);var axm=ax[axis%10-1];var x=stats[axm]/stats[0];var rms2=Math.abs(stats[axm+1]/stats[0]-x*x);return Math.sqrt(rms2)}}if(obj_typename.indexOf("TProfile")==0){obj.getBinContent=function(bin){if(bin<0||bin>=this["fNcells"]){return 0}if(this["fBinEntries"][bin]<1e-300){return 0}if(!this["fArray"]){return 0}return this["fArray"][bin]/this["fBinEntries"][bin]};obj.getBinEffectiveEntries=function(bin){if(bin<0||bin>=this["fNcells"]){return 0}var sumOfWeights=this["fBinEntries"][bin];if(this["fBinSumw2"]==null||this["fBinSumw2"].length!=this["fNcells"]){return sumOfWeights}var sumOfWeightsSquare=this["fSumw2"][bin];return(sumOfWeightsSquare>0?sumOfWeights*sumOfWeights/sumOfWeightsSquare:0)};obj.getStats=function(){var bin,binx,stats=new Array(0,0,0,0,0,0,0,0,0,0,0,0,0);if(this["fTsumw"]<1e-300||this["fXaxis"].TestBit(JSROOT.EAxisBits.kAxisRange)){var firstBinX=this["fXaxis"].getFirst();var lastBinX=this["fXaxis"].getLast();for(binx=this["firstBinX"];binx<=lastBinX;binx++){var w=onj.fBinEntries[binx];var w2=(this["fBinSumw2"]?this["fBinSumw2"][binx]:w);var x=fXaxis.GetBinCenter(binx);stats[0]+=w;stats[1]+=w2;stats[2]+=w*x;stats[3]+=w*x*x;stats[4]+=this["fArray"][binx];stats[5]+=this["fSumw2"][binx]}}else{if(this["fTsumwy"]<1e-300&&this["fTsumwy2"]<1e-300){for(binx=this["fXaxis"].getFirst();binx<=this["fXaxis"].getLast();binx++){this["fTsumwy"]+=this["fArray"][binx];this["fTsumwy2"]+=this["fSumw2"][binx]}}stats[0]=this["fTsumw"];stats[1]=this["fTsumw2"];stats[2]=this["fTsumwx"];stats[3]=this["fTsumwx2"];stats[4]=this["fTsumwy"];stats[5]=this["fTsumwy2"]}return stats};obj.getBinError=function(bin){if(bin<0||bin>=this["fNcells"]){return 0}var cont=this["fArray"][bin];var sum=this["fBinEntries"][bin];var err2=this["fSumw2"][bin];var neff=this.getBinEffectiveEntries(bin);if(sum<1e-300){return 0}if(this["fErrorMode"]==EErrorType.kERRORSPREADG){return(1/Math.sqrt(sum))}var contsum=cont/sum;var eprim2=Math.abs(err2/sum-contsum*contsum);var eprim=Math.sqrt(eprim2);if(this["fErrorMode"]==EErrorType.kERRORSPREADI){if(eprim!=0){return eprim/Math.sqrt(neff)}return(1/Math.sqrt(12*neff))}var testing=1;if(err2!=0&&neff<5){testing=eprim2*sum/err2}if(this["fgApproximate"]&&(testing<0.0001||eprim2<0.000001)){var stats=this.getStats();var ssum=stats[0];var idx=4;var scont=stats[idx];var serr2=stats[idx+1];var scontsum=scont/ssum;var seprim2=Math.abs(serr2/ssum-scontsum*scontsum);eprim=2*Math.sqrt(seprim2);sum=ssum}sum=Math.abs(sum);if(this["fErrorMode"]==EErrorType.kERRORSPREAD){return eprim}return(eprim/Math.sqrt(neff))}}};JSROOT.lastFFormat="";JSROOT.FFormat=function(value,fmt){if(!fmt){fmt="6.4g"}JSROOT.lastFFormat="";if(!fmt){fmt="6.4g"}fmt=fmt.trim();var len=fmt.length;if(len<2){return value.toFixed(4)}var last=fmt.charAt(len-1);fmt=fmt.slice(0,len-1);var isexp=null;var prec=fmt.indexOf(".");if(prec<0){prec=4}else{prec=Number(fmt.slice(prec+1))}if((prec==NaN)||(prec<0)||(prec==null)){prec=4}var significance=false;if((last=="e")||(last=="E")){isexp=true}else{if(last=="Q"){isexp=true;significance=true}else{if((last=="f")||(last=="F")){isexp=false}else{if(last=="W"){isexp=false;significance=true}else{if((last=="g")||(last=="G")){var se=JSROOT.FFormat(value,fmt+"Q");var _fmt=JSROOT.lastFFormat;var sg=JSROOT.FFormat(value,fmt+"W");if(se.length0)){prec=40;sg=value.toFixed(prec)}var l=0;while((ll){diff--}if(diff!=0){prec-=diff;if(prec<0){prec=0}sg=value.toFixed(prec)}}JSROOT.lastFFormat="5."+prec+"f";return sg};JSROOT.Math={};JSROOT.Math.lgam=function(x){var p,q,u,w,z;var i;var sgngam=1;if(x>=Number.POSITIVE_INFINITY){return(Number.POSITIVE_INFINITY)}if(x<-34){q=-x;w=this.lgam(q);p=Math.floor(q);if(p==q){return(Number.POSITIVE_INFINITY)}i=Math.round(p);if((i&1)==0){sgngam=-1}else{sgngam=1}z=q-p;if(z>0.5){p+=1;z=p-q}z=q*Math.sin(Math.PI*z);if(z<1e-300){return(Number.POSITIVE_INFINITY)}z=Math.log(Math.PI)-Math.log(z)-w;return(z)}if(x<13){z=1;p=0;u=x;while(u>=3){p-=1;u=x+p;z*=u}while(u<2){if(u<1e-300){return(Number.POSITIVE_INFINITY)}z/=u;p+=1;u=x+p}if(z<0){sgngam=-1;z=-z}else{sgngam=1}if(u==2){return(Math.log(z))}p-=2;x=x+p;p=x*this.Polynomialeval(x,B,5)/this.Polynomial1eval(x,C,6);return(Math.log(z)+p)}if(x>kMAXLGM){return(sgngam*Number.POSITIVE_INFINITY)}q=(x-0.5)*Math.log(x)-x+LS2PI;if(x>100000000){return(q)}p=1/(x*x);if(x>=1000){q+=((0.0007936507936507937*p-0.002777777777777778)*p+0.08333333333333333)/x}else{q+=this.Polynomialeval(p,A,4)/x}return(q)};JSROOT.Math.Polynomialeval=function(x,a,N){if(N==0){return a[0]}else{var pom=a[0];for(var i=1;i<=N;i++){pom=pom*x+a[i]}return pom}};JSROOT.Math.Polynomial1eval=function(x,a,N){if(N==0){return a[0]}else{var pom=x+a[0];for(var i=1;i=1){return(Number.POSITIVE_INFINITY)}var P0=new Array(-59.96335010141079,98.00107541859997,-56.67628574690703,13.931260938727968,-1.2391658386738125);var Q0=new Array(1.9544885833814176,4.676279128988815,86.36024213908905,-225.46268785411937,200.26021238006066,-82.03722561683334,15.90562251262117,-1.1833162112133);var P1=new Array(4.0554489230596245,31.525109459989388,57.16281922464213,44.08050738932008,14.684956192885803,2.1866330685079025,-0.1402560791713545,-0.03504246268278482,-0.0008574567851546854);var Q1=new Array(15.779988325646675,45.39076351288792,41.3172038254672,15.04253856929075,2.504649462083094,-0.14218292285478779,-0.03808064076915783,-0.0009332594808954574);var P2=new Array(3.2377489177694603,6.915228890689842,3.9388102529247444,1.3330346081580755,0.20148538954917908,0.012371663481782003,0.00030158155350823543,0.0000026580697468673755,6.239745391849833e-9);var Q2=new Array(6.02427039364742,3.6798356385616087,1.3770209948908132,0.21623699359449663,0.013420400608854318,0.00032801446468212774,0.0000028924786474538068,6.790194080099813e-9);var s2pi=2.5066282746310007;var code=1;var y=y0;var x,z,y2,x0,x1;if(y>(1-0.1353352832366127)){y=1-y;code=0}if(y>0.1353352832366127){y=y-0.5;y2=y*y;x=y+y*(y2*this.Polynomialeval(y2,P0,4)/this.Polynomial1eval(y2,Q0,8));x=x*s2pi;return(x)}x=Math.sqrt(-2*Math.log(y));x0=x-Math.log(x)/x;z=1/x;if(x<8){x1=z*this.Polynomialeval(z,P1,8)/this.Polynomial1eval(z,Q1,8)}else{x1=z*this.Polynomialeval(z,P2,8)/this.Polynomial1eval(z,Q2,8)}x=x0-x1;if(code!=0){x=-x}return(x)};JSROOT.Math.igami=function(a,y0){var x0,x1,x,yl,yh,y,d,lgm,dithresh;var i,dir;var kMACHEP=1.1102230246251565e-16;if(a<=0){alert("igami : Wrong domain for parameter a (must be > 0)");return 0}if(y0<=0){return Number.POSITIVE_INFINITY}if(y0>=1){return 0}var kMAXNUM=Number.MAX_VALUE;x0=kMAXNUM;yl=0;x1=0;yh=1;dithresh=5*kMACHEP;d=1/(9*a);y=(1-d-this.ndtri(y0)*Math.sqrt(d));x=a*y*y*y;lgm=this.lgam(a);for(i=0;i<10;i++){if(x>x0||xyh){break}if(y=y0){x1=x;yh=y;if(dir<0){dir=0;d=0.5}else{if(dir>1){d=0.5*d+0.5}else{d=(y0-yl)/(yh-yl)}}dir+=1}else{x0=x;yl=y;if(dir>0){dir=0;d=0.5}else{if(dir<-1){d=0.5*d}else{d=(y0-yl)/(yh-yl)}}dir-=1}}return(x)};JSROOT.Math.gamma_quantile_c=function(z,alpha,theta){return theta*this.igami(alpha,z)};JSROOT.Math.gamma_quantile=function(z,alpha,theta){return theta*this.igami(alpha,1-z)};JSROOT.Math.log10=function(n){return Math.log(n)/Math.log(10)};JSROOT.Math.landau_pdf=function(x,xi,x0){if(xi<=0){return 0}var v=(x-x0)/xi;var u,ue,us,denlan;var p1=new Array(0.4259894875,-0.124976255,0.039842437,-0.006298287635,0.001511162253);var q1=new Array(1,-0.3388260629,0.09594393323,-0.01608042283,0.003778942063);var p2=new Array(0.1788541609,0.1173957403,0.01488850518,-0.001394989411,0.0001283617211);var q2=new Array(1,0.7428795082,0.3153932961,0.06694219548,0.008790609714);var p3=new Array(0.1788544503,0.09359161662,0.006325387654,0.00006611667319,-0.000002031049101);var q3=new Array(1,0.6097809921,0.2560616665,0.04746722384,0.006957301675);var p4=new Array(0.9874054407,118.6723273,849.279436,-743.7792444,427.0262186);var q4=new Array(1,106.8615961,337.6496214,2016.712389,1597.063511);var p5=new Array(1.003675074,167.5702434,4789.711289,21217.86767,-22324.9491);var q5=new Array(1,156.9424537,3745.310488,9834.698876,66924.28357);var p6=new Array(1.000827619,664.9143136,62972.92665,475554.6998,-5743609.109);var q6=new Array(1,651.4101098,56974.73333,165917.4725,-2815759.939);var a1=new Array(0.04166666667,-0.01996527778,0.02709538966);var a2=new Array(-1.84556867,-4.284640743);if(v<-5.5){u=Math.exp(v+1);if(u<1e-10){return 0}ue=Math.exp(-1/u);us=Math.sqrt(u);denlan=0.3989422803*(ue/us)*(1+(a1[0]+(a1[1]+a1[2]*u)*u)*u)}else{if(v<-1){u=Math.exp(-v-1);denlan=Math.exp(-u)*Math.sqrt(u)*(p1[0]+(p1[1]+(p1[2]+(p1[3]+p1[4]*v)*v)*v)*v)/(q1[0]+(q1[1]+(q1[2]+(q1[3]+q1[4]*v)*v)*v)*v)}else{if(v<1){denlan=(p2[0]+(p2[1]+(p2[2]+(p2[3]+p2[4]*v)*v)*v)*v)/(q2[0]+(q2[1]+(q2[2]+(q2[3]+q2[4]*v)*v)*v)*v)}else{if(v<5){denlan=(p3[0]+(p3[1]+(p3[2]+(p3[3]+p3[4]*v)*v)*v)*v)/(q3[0]+(q3[1]+(q3[2]+(q3[3]+q3[4]*v)*v)*v)*v)}else{if(v<12){u=1/v;denlan=u*u*(p4[0]+(p4[1]+(p4[2]+(p4[3]+p4[4]*u)*u)*u)*u)/(q4[0]+(q4[1]+(q4[2]+(q4[3]+q4[4]*u)*u)*u)*u)}else{if(v<50){u=1/v;denlan=u*u*(p5[0]+(p5[1]+(p5[2]+(p5[3]+p5[4]*u)*u)*u)*u)/(q5[0]+(q5[1]+(q5[2]+(q5[3]+q5[4]*u)*u)*u)*u)}else{if(v<300){u=1/v;denlan=u*u*(p6[0]+(p6[1]+(p6[2]+(p6[3]+p6[4]*u)*u)*u)*u)/(q6[0]+(q6[1]+(q6[2]+(q6[3]+q6[4]*u)*u)*u)*u)}else{u=1/(v-v*Math.log(v)/(v+1));denlan=u*u*(1+(a2[0]+a2[1]*u)*u)}}}}}}}return denlan/xi};JSROOT.Math.Landau=function(x,mpv,sigma,norm){if(sigma<=0){return 0}var den=JSROOT.Math.landau_pdf((x-mpv)/sigma,1,0);if(!norm){return den}return den/sigma};JSROOT.Math.gaus=function(f,x,i){return f.fParams[i+0]*Math.exp(-0.5*Math.pow((x-f.fParams[i+1])/f.fParams[i+2],2))};JSROOT.Math.gausn=function(f,x,i){return JSROOT.Math.gaus(f,x,i)/(Math.sqrt(2*Math.PI)*f.fParams[i+2])};JSROOT.Math.expo=function(f,x,i){return Math.exp(f.fParams[i+0]+f.fParams[i+1]*x)};JSROOT.Math.landau=function(f,x,i){return JSROOT.Math.Landau(x,f.fParams[i+1],f.fParams[i+2],false)};JSROOT.Math.landaun=function(f,x,i){return JSROOT.Math.Landau(x,f.fParams[i+1],f.fParams[i+2],true)};(function(){function window_on_load(func){if(func==null){return}if(document.attachEvent?document.readyState==="complete":document.readyState!=="loading"){func()}else{window.onload=func}}var scripts=document.getElementsByTagName("script");for(var n in scripts){if(scripts[n]["type"]!="text/javascript"){continue}var src=scripts[n]["src"];if((src==null)||(src.length==0)){continue}var pos=src.indexOf("scripts/JSRootCore.");if(pos<0){continue}JSROOT.source_dir=src.substr(0,pos);JSROOT.source_min=src.indexOf("scripts/JSRootCore.min.js")>=0;JSROOT.console("Set JSROOT.source_dir to "+JSROOT.source_dir);if(JSROOT.GetUrlOption("gui",src)!=null){return window_on_load(function(){JSROOT.BuildSimpleGUI()})}if(typeof define==="function"&&define.amd){return window_on_load(function(){JSROOT.BuildSimpleGUI("check_existing_elements")})}var prereq="";if(JSROOT.GetUrlOption("io",src)!=null){prereq+="io;"}if(JSROOT.GetUrlOption("2d",src)!=null){prereq+="2d;"}if(JSROOT.GetUrlOption("jq2d",src)!=null){prereq+="jq2d;"}if(JSROOT.GetUrlOption("3d",src)!=null){prereq+="3d;"}if(JSROOT.GetUrlOption("mathjax",src)!=null){prereq+="mathjax;"}var user=JSROOT.GetUrlOption("load",src);if((user!=null)&&(user.length>0)){prereq+="load:"+user}var onload=JSROOT.GetUrlOption("onload",src);if((prereq.length>0)||(onload!=null)){window_on_load(function(){if(prereq.length>0){JSROOT.AssertPrerequisites(prereq,onload)}else{if(onload!=null){onload=JSROOT.findFunction(onload);if(typeof onload=="function"){onload()}}}})}return}})();return JSROOT})); diff --git a/js/scripts/JSRootIOEvolution.js b/js/scripts/JSRootIOEvolution.js new file mode 100755 index 0000000..32a381f --- /dev/null +++ b/js/scripts/JSRootIOEvolution.js @@ -0,0 +1,1834 @@ +/// @file JSRootIOEvolution.js +/// I/O methods of JavaScript ROOT + +(function( factory ) { + if ( typeof define === "function" && define.amd ) { + // AMD. Register as an anonymous module. + define( ['JSRootCore', 'rawinflate'], factory ); + } else { + if (typeof JSROOT == 'undefined') { + var e1 = new Error("This extension requires JSRootCore.js"); + e1.source = "JSRootIOEvolution.js"; + throw e1; + } + + if (typeof JSROOT.IO == "object") { + var e1 = new Error("This JSROOT IO already loaded"); + e1.source = "JSRootIOEvolution.js"; + throw e1; + } + + factory(JSROOT); + } +} (function(JSROOT) { + + JSROOT.IO = { + kBase : 0, kOffsetL : 20, kOffsetP : 40, kCounter : 6, kCharStar : 7, + kChar : 1, kShort : 2, kInt : 3, kLong : 4, kFloat : 5, + kDouble : 8, kDouble32 : 9, kLegacyChar : 10, kUChar : 11, kUShort : 12, + kUInt : 13, kULong : 14, kBits : 15, kLong64 : 16, kULong64 : 17, kBool : 18, + kFloat16 : 19, + kObject : 61, kAny : 62, kObjectp : 63, kObjectP : 64, kTString : 65, + kTObject : 66, kTNamed : 67, kAnyp : 68, kAnyP : 69, kAnyPnoVT : 70, + kSTLp : 71, + kSkip : 100, kSkipL : 120, kSkipP : 140, + kConv : 200, kConvL : 220, kConvP : 240, + kSTL : 300, kSTLstring : 365, + kStreamer : 500, kStreamLoop : 501, + kMapOffset : 2, + kByteCountMask : 0x40000000, + kNewClassTag : 0xFFFFFFFF, + kClassMask : 0x80000000, + Z_DEFLATED : 8, + Z_HDRSIZE : 9 + }; + + JSROOT.fUserStreamers = null; // map of user-streamer function like func(buf,obj,prop,streamerinfo) + + JSROOT.addUserStreamer = function(type, user_streamer) { + if (JSROOT.fUserStreamers == null) JSROOT.fUserStreamers = {}; + JSROOT.fUserStreamers[type] = user_streamer; + } + + JSROOT.R__unzip_header = function(str, off, noalert) { + // Reads header envelope, and determines target size. + + if (off + JSROOT.IO.Z_HDRSIZE > str.length) { + if (!noalert) alert("Error R__unzip_header: header size exceeds buffer size"); + return -1; + } + + /* C H E C K H E A D E R */ + if (!(str.charAt(off) == 'Z' && str.charAt(off+1) == 'L' && str.charCodeAt(off+2) == JSROOT.IO.Z_DEFLATED) && + !(str.charAt(off) == 'C' && str.charAt(off+1) == 'S' && str.charCodeAt(off+2) == JSROOT.IO.Z_DEFLATED) && + !(str.charAt(off) == 'X' && str.charAt(off+1) == 'Z' && str.charCodeAt(off+2) == 0)) { + if (!noalert) alert("Error R__unzip_header: error in header"); + return -1; + } + return JSROOT.IO.Z_HDRSIZE + + ((str.charCodeAt(off+3) & 0xff) | + ((str.charCodeAt(off+4) & 0xff) << 8) | + ((str.charCodeAt(off+5) & 0xff) << 16)); + } + + JSROOT.R__unzip = function(srcsize, str, off, noalert) { + + /* C H E C K H E A D E R */ + if (srcsize < JSROOT.IO.Z_HDRSIZE) { + if (!noalert) alert("R__unzip: too small source"); + return null; + } + + /* C H E C K H E A D E R */ + if (!(str.charAt(off) == 'Z' && str.charAt(off+1) == 'L' && str.charCodeAt(off+2) == JSROOT.IO.Z_DEFLATED) && + !(str.charAt(off) == 'C' && str.charAt(off+1) == 'S' && str.charCodeAt(off+2) == JSROOT.IO.Z_DEFLATED) && + !(str.charAt(off) == 'X' && str.charAt(off+1) == 'Z' && str.charCodeAt(off+2) == 0)) { + if (!noalert) alert("Error R__unzip: error in header"); + return null; + } + var ibufcnt = ((str.charCodeAt(off+3) & 0xff) | + ((str.charCodeAt(off+4) & 0xff) << 8) | + ((str.charCodeAt(off+5) & 0xff) << 16)); + if (ibufcnt + JSROOT.IO.Z_HDRSIZE != srcsize) { + if (!noalert) alert("R__unzip: discrepancy in source length"); + return null; + } + + /* D E C O M P R E S S D A T A */ + if (str.charAt(off) == 'Z' && str.charAt(off+1) == 'L') { + /* New zlib format */ + var data = str.substr(off + JSROOT.IO.Z_HDRSIZE + 2, srcsize); + return window.RawInflate.inflate(data); + } + /* Old zlib format */ + else { + if (!noalert) alert("R__unzip: Old zlib format is not supported!"); + return null; + } + return null; + } + + JSROOT.ReconstructObject = function(class_name, obj_rawdata, sinfo_rawdata) { + // method can be used to reconstruct ROOT object from binary buffer + // Buffer can be requested from online server with request like: + // http://localhost:8080/Files/job1.root/hpx/root.bin + // One also requires buffer with streamer infos, reqeusted with command + // http://localhost:8080/StreamerInfo/root.bin + // And one should provide class name of the object + // + // Method provided for convenience only to see how binary JSROOT.IO works. + // It is strongly recommended to use JSON representation: + // http://localhost:8080/Files/job1.root/hpx/root.json + + var file = new JSROOT.TFile; + var buf = new JSROOT.TBuffer(sinfo_rawdata, 0, file); + file.ExtractStreamerInfos(buf); + + var obj = {}; + + buf = new JSROOT.TBuffer(obj_rawdata, 0, file); + buf.MapObject(obj, 1); + buf.ClassStreamer(obj, class_name); + + return obj; + } + + JSROOT.TBuffer = function(_str, _o, _file) { + this._typename = "TBuffer"; + this.b = _str; + this.o = (_o==null) ? 0 : _o; + this.fFile = _file; + this.ClearObjectMap(); + this.fTagOffset = 0; + return this; + } + + JSROOT.TBuffer.prototype.locate = function(pos) { + this.o = pos; + } + + JSROOT.TBuffer.prototype.shift = function(cnt) { + this.o += cnt; + } + + JSROOT.TBuffer.prototype.ntou1 = function() { + return (this.b.charCodeAt(this.o++) & 0xff) >>> 0; + } + + JSROOT.TBuffer.prototype.ntou2 = function() { + // convert (read) two bytes of buffer b into a UShort_t + var n = ((this.b.charCodeAt(this.o) & 0xff) << 8) >>> 0; + n += (this.b.charCodeAt(this.o+1) & 0xff) >>> 0; + this.o += 2; + return n; + } + + JSROOT.TBuffer.prototype.ntou4 = function() { + // convert (read) four bytes of buffer b into a UInt_t + var n = ((this.b.charCodeAt(this.o) & 0xff) << 24) >>> 0; + n += ((this.b.charCodeAt(this.o+1) & 0xff) << 16) >>> 0; + n += ((this.b.charCodeAt(this.o+2) & 0xff) << 8) >>> 0; + n += (this.b.charCodeAt(this.o+3) & 0xff) >>> 0; + this.o += 4; + return n; + } + + JSROOT.TBuffer.prototype.ntou8 = function() { + // convert (read) eight bytes of buffer b into a ULong_t + var n = ((this.b.charCodeAt(this.o) & 0xff) << 56) >>> 0; + n += ((this.b.charCodeAt(this.o+1) & 0xff) << 48) >>> 0; + n += ((this.b.charCodeAt(this.o+2) & 0xff) << 40) >>> 0; + n += ((this.b.charCodeAt(this.o+3) & 0xff) << 32) >>> 0; + n += ((this.b.charCodeAt(this.o+4) & 0xff) << 24) >>> 0; + n += ((this.b.charCodeAt(this.o+5) & 0xff) << 16) >>> 0; + n += ((this.b.charCodeAt(this.o+6) & 0xff) << 8) >>> 0; + n += (this.b.charCodeAt(this.o+7) & 0xff) >>> 0; + this.o += 8; + return n; + } + + JSROOT.TBuffer.prototype.ntoi1 = function() { + return (this.b.charCodeAt(this.o++) & 0xff); + } + + JSROOT.TBuffer.prototype.ntoi2 = function() { + // convert (read) two bytes of buffer b into a Short_t + var n = (this.b.charCodeAt(this.o) & 0xff) << 8; + n += (this.b.charCodeAt(this.o+1) & 0xff); + this.o += 2; + return n; + } + + JSROOT.TBuffer.prototype.ntoi4 = function() { + // convert (read) four bytes of buffer b into a Int_t + var n = ((this.b.charCodeAt(this.o) & 0xff) << 24) + + ((this.b.charCodeAt(this.o+1) & 0xff) << 16) + + ((this.b.charCodeAt(this.o+2) & 0xff) << 8) + + ((this.b.charCodeAt(this.o+3) & 0xff)); + this.o += 4; + return n; + } + + JSROOT.TBuffer.prototype.ntoi8 = function(b, o) { + // convert (read) eight bytes of buffer b into a Long_t + var n = (this.b.charCodeAt(this.o) & 0xff) << 56; + n += (this.b.charCodeAt(this.o+1) & 0xff) << 48; + n += (this.b.charCodeAt(this.o+2) & 0xff) << 40; + n += (this.b.charCodeAt(this.o+3) & 0xff) << 32; + n += (this.b.charCodeAt(this.o+4) & 0xff) << 24; + n += (this.b.charCodeAt(this.o+5) & 0xff) << 16; + n += (this.b.charCodeAt(this.o+6) & 0xff) << 8; + n += (this.b.charCodeAt(this.o+7) & 0xff); + this.o += 8; + return n; + } + + JSROOT.TBuffer.prototype.ntof = function() { + // IEEE-754 Floating-Point Conversion (single precision - 32 bits) + var inString = this.b.substring(this.o, this.o + 4); this.o+=4; + if (inString.length < 4) return Number.NaN; + var bits = ""; + for (var i=0; i<4; i++) { + var curByte = (inString.charCodeAt(i) & 0xff).toString(2); + var byteLen = curByte.length; + if (byteLen < 8) { + for (var bit=0; bit<(8-byteLen); bit++) + curByte = '0' + curByte; + } + bits = bits + curByte; + } + //var bsign = parseInt(bits[0]) ? -1 : 1; + var bsign = (bits.charAt(0) == '1') ? -1 : 1; + var bexp = parseInt(bits.substring(1, 9), 2) - 127; + var bman; + if (bexp == -127) + bman = 0; + else { + bman = 1; + for (var i=0; i<23; i++) { + if (parseInt(bits.substr(9+i, 1)) == 1) + bman = bman + 1 / Math.pow(2, i+1); + } + } + return (bsign * Math.pow(2, bexp) * bman); + } + + JSROOT.TBuffer.prototype.ntod = function() { + // IEEE-754 Floating-Point Conversion (double precision - 64 bits) + var inString = this.b.substring(this.o, this.o + 8); this.o+=8; + if (inString.length < 8) return Number.NaN; + var bits = ""; + for (var i=0; i<8; i++) { + var curByte = (inString.charCodeAt(i) & 0xff).toString(2); + var byteLen = curByte.length; + if (byteLen < 8) { + for (var bit=0; bit<(8-byteLen); bit++) + curByte = '0' + curByte; + } + bits = bits + curByte; + } + //var bsign = parseInt(bits[0]) ? -1 : 1; + var bsign = (bits.charAt(0) == '1') ? -1 : 1; + var bexp = parseInt(bits.substring(1, 12), 2) - 1023; + var bman; + if (bexp == -127) + bman = 0; + else { + bman = 1; + for (var i=0; i<52; i++) { + if (parseInt(bits.substr(12+i, 1)) == 1) + bman = bman + 1 / Math.pow(2, i+1); + } + } + return (bsign * Math.pow(2, bexp) * bman); + } + + JSROOT.TBuffer.prototype.ReadFastArray = function(n, array_type) { + // read array of n integers from the I/O buffer + var array = new Array(); + switch (array_type) { + case 'D': + for (var i = 0; i < n; ++i) { + array[i] = this.ntod(); + if (Math.abs(array[i]) < 1e-300) array[i] = 0.0; + } + break; + case 'F': + for (var i = 0; i < n; ++i) { + array[i] = this.ntof(); + if (Math.abs(array[i]) < 1e-300) array[i] = 0.0; + } + break; + case 'L': + for (var i = 0; i < n; ++i) + array[i] = this.ntoi8(); + break; + case 'LU': + for (var i = 0; i < n; ++i) + array[i] = this.ntou8(); + break; + case 'I': + for (var i = 0; i < n; ++i) + array[i] = this.ntoi4(); + break; + case 'U': + for (var i = 0; i < n; ++i) + array[i] = this.ntou4(); + break; + case 'S': + for (var i = 0; i < n; ++i) + array[i] = this.ntoi2(); + break; + case 'C': + for (var i = 0; i < n; ++i) + array[i] = this.b.charCodeAt(this.o++) & 0xff; + break; + case 'TString': + for (var i = 0; i < n; ++i) + array[i] = this.ReadTString(); + break; + default: + for (var i = 0; i < n; ++i) + array[i] = this.ntou4(); + break; + } + return array; + } + + JSROOT.TBuffer.prototype.ReadBasicPointer = function(len, array_type) { + var isArray = this.b.charCodeAt(this.o++) & 0xff; + if (isArray) + return this.ReadFastArray(len, array_type); + + if (len==0) return new Array(); + + this.o--; + return this.ReadFastArray(len, array_type); + } + + JSROOT.TBuffer.prototype.ReadString = function(max_len) { + // stream a string from buffer + max_len = typeof(max_len) != 'undefined' ? max_len : 0; + var len = 0; + var pos0 = this.o; + while ((max_len==0) || (len") res = this.ReadFastArray(this.ntoi4(),'D'); else + if (typname == "vector") res = this.ReadFastArray(this.ntoi4(),'I'); else + if (typname == "vector") res = this.ReadFastArray(this.ntoi4(),'F'); else + if (typname == "vector") { + var n = this.ntoi4(); + res = []; + for (var i=0;i 3) { + this.ReadTObject(list); + list['name'] = this.ReadTString(); + var nobjects = this.ntou4(); + for (var i = 0; i < nobjects; ++i) { + + var obj = this.ReadObjectAny(); + list['arr'].push(obj); + + var opt = this.ReadTString(); + list['opt'].push(opt); + } + } + + return this.CheckBytecount(ver); + } + + JSROOT.TBuffer.prototype.ReadTObjArray = function(list) { + list['_typename'] = "TObjArray"; + list['name'] = ""; + list['arr'] = new Array(); + var ver = this.ReadVersion(); + if (ver['val'] > 2) + this.ReadTObject(list); + if (ver['val'] > 1) + list['name'] = this.ReadTString(); + var nobjects = this.ntou4(); + var lowerbound = this.ntou4(); + for (var i = 0; i < nobjects; i++) { + var obj = this.ReadObjectAny(); + list['arr'].push(obj); + } + return this.CheckBytecount(ver, "ReadTObjArray"); + } + + JSROOT.TBuffer.prototype.ReadTClonesArray = function(list) { + list['_typename'] = "TClonesArray"; + list['name'] = ""; + list['arr'] = new Array(); + var ver = this.ReadVersion(); + if (ver['val'] > 2) + this.ReadTObject(list); + if (ver['val'] > 1) + list['name'] = this.ReadTString(); + var s = this.ReadTString(); + var classv = s; + var clv = 0; + var pos = s.indexOf(";"); + if (pos != -1) { + classv = s.slice(0, pos); + s = s.slice(pos+1, s.length()-pos-1); + clv = parseInt(s); + } + var nobjects = this.ntou4(); + if (nobjects < 0) nobjects = -nobjects; // for backward compatibility + var lowerbound = this.ntou4(); + for (var i = 0; i < nobjects; i++) { + var obj = {}; + + this.ClassStreamer(obj, classv); + + list['arr'].push(obj); + } + return this.CheckBytecount(ver, "ReadTClonesArray"); + } + + JSROOT.TBuffer.prototype.ReadTPolyMarker3D = function(marker) { + var ver = this.ReadVersion(); + + this.ReadTObject(marker); + + this.ClassStreamer(marker, "TAttMarker"); + + marker['fN'] = this.ntoi4(); + + marker['fP'] = this.ReadFastArray(marker['fN']*3, 'F'); + + marker['fOption'] = this.ReadTString(); + + if (ver['val'] > 1) + marker['fName'] = this.ReadTString(); + else + marker['fName'] = "TPolyMarker3D"; + + return this.CheckBytecount(ver, "ReadTPolyMarker3D"); + } + + JSROOT.TBuffer.prototype.ReadTCollection = function(list, str, o) { + list['_typename'] = "TCollection"; + list['name'] = ""; + list['arr'] = new Array(); + var ver = this.ReadVersion(); + if (ver['val'] > 2) + this.ReadTObject(list); + if (ver['val'] > 1) + list['name'] = this.ReadTString(); + var nobjects = this.ntou4(); + for (var i = 0; i < nobjects; i++) { + o += 10; // skip object bits & unique id + list['arr'].push(null); + } + return this.CheckBytecount(ver,"ReadTCollection"); + } + + JSROOT.TBuffer.prototype.ReadTKey = function(key) { + key['fNbytes'] = this.ntoi4(); + key['fVersion'] = this.ntoi2(); + key['fObjlen'] = this.ntou4(); + var datime = this.ntou4(); + key['fDatime'] = new Date(); + key['fDatime'].setFullYear((datime >>> 26) + 1995); + key['fDatime'].setMonth((datime << 6) >>> 28); + key['fDatime'].setDate((datime << 10) >>> 27); + key['fDatime'].setHours((datime << 15) >>> 27); + key['fDatime'].setMinutes((datime << 20) >>> 26); + key['fDatime'].setSeconds((datime << 26) >>> 26); + key['fDatime'].setMilliseconds(0); + key['fKeylen'] = this.ntou2(); + key['fCycle'] = this.ntou2(); + if (key['fVersion'] > 1000) { + key['fSeekKey'] = this.ntou8(); + this.shift(8); // skip seekPdir + } else { + key['fSeekKey'] = this.ntou4(); + this.shift(4); // skip seekPdir + } + key['fClassName'] = this.ReadTString(); + key['fName'] = this.ReadTString(); + key['fTitle'] = this.ReadTString(); + + var name = key['fName'].replace(/['"]/g,''); + + if (name != key['fName']) { + key['fRealName'] = key['fName']; + key['fName'] = name; + } + + return true; + } + + JSROOT.TBuffer.prototype.ReadTBasket = function(obj) { + this.ReadTKey(obj); + var ver = this.ReadVersion(); + obj['fBufferSize'] = this.ntoi4(); + obj['fNevBufSize'] = this.ntoi4(); + obj['fNevBuf'] = this.ntoi4(); + obj['fLast'] = this.ntoi4(); + var flag = this.ntoi1(); + // here we implement only data skipping, no real I/O for TBasket is performed + if ((flag % 10) != 2) { + var sz = this.ntoi4(); this.o += sz*4; // fEntryOffset + if (flag>40) { sz = this.ntoi4(); this.o += sz*4; } // fDisplacement + } + + if (flag == 1 || flag > 10) { + var sz = obj['fLast']; + if (ver['val'] <=1) sz = this.ntoi4(); + this.o += sz; // fBufferRef + } + return this.CheckBytecount(ver,"ReadTBasket"); + } + + + JSROOT.TBuffer.prototype.ReadTCanvas = function(obj) { + // stream all objects in the list from the I/O buffer + var ver = this.ReadVersion(); + + this.ClassStreamer(obj, "TPad"); + + obj['fDISPLAY'] = this.ReadTString(); + obj['fDoubleBuffer'] = this.ntoi4(); + obj['fRetained'] = this.ntou1()!=0; + obj['fXsizeUser'] = this.ntoi4(); + obj['fYsizeUser'] = this.ntoi4(); + obj['fXsizeReal'] = this.ntoi4(); + obj['fYsizeReal'] = this.ntoi4(); + obj['fWindowTopX'] = this.ntoi4(); + obj['fWindowTopY'] = this.ntoi4(); + obj['fWindowWidth'] = this.ntoi4(); + obj['fWindowHeight'] = this.ntoi4(); + obj['fCw'] = this.ntou4(); + obj['fCh'] = this.ntou4(); + + obj['fCatt'] = {}; + this.ClassStreamer(obj['fCatt'], "TAttCanvas"); + this.ntou1(); // ignore b << TestBit(kMoveOpaque); + this.ntou1(); // ignore b << TestBit(kResizeOpaque); + obj['fHighLightColor'] = this.ntoi2(); + obj['fBatch'] = this.ntou1()!=0; + this.ntou1(); // ignore b << TestBit(kShowEventStatus); + this.ntou1(); // ignore b << TestBit(kAutoExec); + this.ntou1(); // ignore b << TestBit(kMenuBar); + + // now TCanvas streamer should be complete - verify that bytecount is correct + return this.CheckBytecount(ver, "TCanvas"); + } + + JSROOT.TBuffer.prototype.ReadTStreamerInfo = function(streamerinfo) { + // stream an object of class TStreamerInfo from the I/O buffer + + var R__v = this.ReadVersion(); + if (R__v['val'] > 1) { + this.ReadTNamed(streamerinfo); + + streamerinfo['fCheckSum'] = this.ntou4(); + streamerinfo['fClassVersion'] = this.ntou4(); + + streamerinfo['fElements'] = this.ReadObjectAny(); + } + return this.CheckBytecount(R__v, "ReadTStreamerInfo"); + } + + JSROOT.TBuffer.prototype.ReadStreamerElement = function(element) { + // stream an object of class TStreamerElement + + var R__v = this.ReadVersion(); + this.ReadTNamed(element); + element['type'] = this.ntou4(); + element['size'] = this.ntou4(); + element['length'] = this.ntou4(); + element['dim'] = this.ntou4(); + if (R__v['val'] == 1) { + var n = this.ntou4(); + element['maxindex'] = this.ReadFastArray(n, 'U'); + } else { + element['maxindex'] = this.ReadFastArray(5, 'U'); + } + element['fTypeName'] = this.ReadTString(); + element['typename'] = element['fTypeName']; // TODO - should be removed + if ((element['type'] == 11) && (element['typename'] == "Bool_t" || + element['typename'] == "bool")) + element['type'] = 18; + if (R__v['val'] > 1) { + element['uuid'] = 0; + } + if (R__v['val'] <= 2) { + // In TStreamerElement v2, fSize was holding the size of + // the underlying data type. In later version it contains + // the full length of the data member. + } + if (R__v['val'] == 3) { + element['xmin'] = this.ntou4(); + element['xmax'] = this.ntou4(); + element['factor'] = this.ntou4(); + //if (element['factor'] > 0) SetBit(kHasRange); + } + if (R__v['val'] > 3) { + //if (TestBit(kHasRange)) GetRange(GetTitle(),fXmin,fXmax,fFactor); + } + return this.CheckBytecount(R__v, "ReadStreamerElement"); + } + + JSROOT.TBuffer.prototype.ReadStreamerBase = function(streamerbase) { + // stream an object of class TStreamerBase + + var R__v = this.ReadVersion(); + this.ReadStreamerElement(streamerbase); + if (R__v['val'] > 2) { + streamerbase['baseversion'] = this.ntou4(); + } + return this.CheckBytecount(R__v, "ReadStreamerBase"); + } + + JSROOT.TBuffer.prototype.ReadStreamerSubElement = function(streamerbase, lmt) { + // stream an object class derived from TStreamerElement + // without data members, check version number + if (lmt==null) lmt = 1; + + var R__v = this.ReadVersion(); + if (R__v['val'] > lmt) { + this.ReadStreamerElement(streamerbase); + } + return this.CheckBytecount(R__v, "ReadStreamerSubElement"); + } + + JSROOT.TBuffer.prototype.ReadStreamerBasicPointer = function(streamerbase) { + // stream an object of class TStreamerBasicPointer + var R__v = this.ReadVersion(); + if (R__v['val'] > 1) { + this.ReadStreamerElement(streamerbase); + streamerbase['countversion'] = this.ntou4(); + streamerbase['countName'] = this.ReadTString(); + streamerbase['countClass'] = this.ReadTString(); + } + return this.CheckBytecount(R__v, "ReadStreamerBasicPointer"); + } + + JSROOT.TBuffer.prototype.ReadStreamerSTL = function(streamerSTL) { + // stream an object of class TStreamerSTL + + var R__v = this.ReadVersion(); + if (R__v['val'] > 1) { + this.ReadStreamerElement(streamerSTL); + streamerSTL['stltype'] = this.ntou4(); + streamerSTL['ctype'] = this.ntou4(); + } + return this.CheckBytecount(R__v, "ReadStreamerSTL"); + } + + JSROOT.TBuffer.prototype.ReadClass = function() { + // read class definition from I/O buffer + var classInfo = {}; + classInfo['name'] = -1; + var tag = 0; + var bcnt = this.ntou4(); + + var startpos = this.o; + if (!(bcnt & JSROOT.IO.kByteCountMask) || (bcnt == JSROOT.IO.kNewClassTag)) { + tag = bcnt; + bcnt = 0; + } else { + // classInfo['fVersion'] = 1; + tag = this.ntou4(); + } + if (!(tag & JSROOT.IO.kClassMask)) { + classInfo['objtag'] = tag; // indicate that we have deal with objects tag + return classInfo; + } + if (tag == JSROOT.IO.kNewClassTag) { + // got a new class description followed by a new object + classInfo['name'] = this.ReadString(); + + if (this.GetMappedClass(this.fTagOffset + startpos + JSROOT.IO.kMapOffset)==-1) + this.MapClass(this.fTagOffset + startpos + JSROOT.IO.kMapOffset, classInfo['name']); + } + else { + // got a tag to an already seen class + var clTag = (tag & ~JSROOT.IO.kClassMask); + classInfo['name'] = this.GetMappedClass(clTag); + + if (classInfo['name']==-1) { + alert("Did not found class with tag " + clTag); + } + + } + // classInfo['cnt'] = (bcnt & ~JSROOT.IO.kByteCountMask); + + return classInfo; + } + + JSROOT.TBuffer.prototype.ReadObjectAny = function() { + var startpos = this.o; + var clRef = this.ReadClass(); + + // class identified as object and should be handled so + if ('objtag' in clRef) + return this.GetMappedObject(clRef['objtag']); + + if (clRef['name'] == -1) return null; + + var obj = {}; + + this.MapObject(this.fTagOffset + startpos + JSROOT.IO.kMapOffset, obj); + + this.ClassStreamer(obj, clRef['name']); + + return obj; + } + + JSROOT.TBuffer.prototype.ClassStreamer = function(obj, classname) { + if (! ('_typename' in obj)) obj['_typename'] = classname; + + if (classname == 'TObject' || classname == 'TMethodCall') { + this.ReadTObject(obj); + } + else if (classname == 'TQObject') { + // skip TQObject + } + else if (classname == 'TObjString') { + this.ReadTObjString(obj); + } + else if (classname == 'TObjArray') { + this.ReadTObjArray(obj); + } + else if (classname == 'TClonesArray') { + this.ReadTClonesArray(obj); + } + else if ((classname == 'TList') || (classname == 'THashList')) { + this.ReadTList(obj); + } + else if (classname == 'TCollection') { + this.ReadTCollection(obj); + alert("Trying to read TCollection - wrong!!!"); + } + else if (classname == 'TCanvas') { + this.ReadTCanvas(obj); + } + else if (classname == 'TPolyMarker3D') { + this.ReadTPolyMarker3D(obj); + } + else if (classname == "TStreamerInfo") { + this.ReadTStreamerInfo(obj); + } + else if (classname == "TStreamerBase") { + this.ReadStreamerBase(obj); + } + else if ((classname == "TStreamerBasicPointer") || (classname == "TStreamerLoop")) { + this.ReadStreamerBasicPointer(obj); + } + else if (classname == "TStreamerSTL") { + this.ReadStreamerSTL(obj); + } + else if (classname == "TStreamerObject" || classname == "TStreamerBasicType" || + classname == "TStreamerObjectAny" || classname == "TStreamerString" || + classname == "TStreamerObjectPointer") { + this.ReadStreamerSubElement(obj); + } + else if (classname == "TStreamerObjectAnyPointer") { + this.ReadStreamerSubElement(obj, 0); + } + else if (classname == "TBasket") { + this.ReadTBasket(obj); + } + else { + var streamer = this.fFile.GetStreamer(classname); + if (streamer != null) + streamer.Stream(obj, this); + else { + JSROOT.console("Did not found streamer for class " + classname + " try to skip data"); + var ver = this.ReadVersion(); + this.CheckBytecount(ver); + } + } + + JSROOT.addMethods(obj); + } + + + // ============================================================================== + + // ctor + JSROOT.TStreamer = function(file) { + this.fFile = file; + this._typename = "TStreamer"; + return this; + } + + JSROOT.TStreamer.prototype.ReadBasicType = function(buf, obj, prop) { + // read basic types (known from the streamer info) + switch (this[prop]['type']) { + case JSROOT.IO.kBase: + break; + case JSROOT.IO.kOffsetL: + break; + case JSROOT.IO.kOffsetP: + break; + case JSROOT.IO.kCharStar: + var n_el = obj[this[prop]['cntname']]; + obj[prop] = buf.ReadBasicPointer(n_el, 'C'); + break; + case JSROOT.IO.kChar: + case JSROOT.IO.kLegacyChar: + obj[prop] = buf.b.charCodeAt(buf.o++) & 0xff; + break; + case JSROOT.IO.kShort: + obj[prop] = buf.ntoi2(); + break; + case JSROOT.IO.kInt: + case JSROOT.IO.kCounter: + obj[prop] = buf.ntoi4(); + break; + case JSROOT.IO.kLong: + obj[prop] = buf.ntoi8(); + break; + case JSROOT.IO.kFloat: + case JSROOT.IO.kDouble32: + obj[prop] = buf.ntof(); + if (Math.abs(obj[prop]) < 1e-300) obj[prop] = 0.0; + break; + case JSROOT.IO.kDouble: + obj[prop] = buf.ntod(); + if (Math.abs(obj[prop]) < 1e-300) obj[prop] = 0.0; + break; + case JSROOT.IO.kUChar: + obj[prop] = (buf.b.charCodeAt(buf.o++) & 0xff) >>> 0; + break; + case JSROOT.IO.kUShort: + obj[prop] = buf.ntou2(); + break; + case JSROOT.IO.kUInt: + obj[prop] = buf.ntou4(); + break; + case JSROOT.IO.kULong: + obj[prop] = buf.ntou8(); + break; + case JSROOT.IO.kBits: + alert('failed to stream bits ' + prop + ' (' + this[prop]['typename'] + ')'); + break; + case JSROOT.IO.kLong64: + obj[prop] = buf.ntoi8(); + break; + case JSROOT.IO.kULong64: + obj[prop] = buf.ntou8(); + break; + case JSROOT.IO.kBool: + obj[prop] = (buf.b.charCodeAt(buf.o++) & 0xff) != 0; + break; + case JSROOT.IO.kFloat16: + obj[prop] = 0; + buf.o += 2; + break; + case JSROOT.IO.kAny: + case JSROOT.IO.kAnyp: + case JSROOT.IO.kObjectp: + case JSROOT.IO.kObject: + var classname = this[prop]['typename']; + if (classname.charAt(classname.length-1) == "*") + classname = classname.substr(0, classname.length - 1); + + obj[prop] = {}; + buf.ClassStreamer(obj[prop], classname); + break; + + case JSROOT.IO.kAnyP: + case JSROOT.IO.kObjectP: + obj[prop] = buf.ReadObjectAny(); + break; + case JSROOT.IO.kTString: + obj[prop] = buf.ReadTString(); + break; + case JSROOT.IO.kTObject: + buf.ReadTObject(obj); + break; + case JSROOT.IO.kTNamed: + buf.ReadTNamed(obj); + break; + //case JSROOT.IO.kAnyPnoVT: + //case JSROOT.IO.kSTLp: + //case JSROOT.IO.kSTL: + //case JSROOT.IO.kSkip: + //case JSROOT.IO.kSkipL: + //case JSROOT.IO.kSkipP: + //case JSROOT.IO.kConv: + //case JSROOT.IO.kConvL: + //case JSROOT.IO.kConvP: + //case JSROOT.IO.kSTLstring: + //case JSROOT.IO.kStreamLoop: + case JSROOT.IO.kStreamer: + obj[prop] = buf.ReadSpecial(this[prop]['type'], this[prop]['typename']); + break; + case JSROOT.IO.kOffsetL+JSROOT.IO.kShort: + case JSROOT.IO.kOffsetL+JSROOT.IO.kUShort: + alert("Strange code was here????"); // var n_el = str.charCodeAt(o) & 0xff; + var n_el = this[prop]['length']; + obj[prop] = buf.ReadFastArray(n_el, 'S'); + break; + case JSROOT.IO.kOffsetL+JSROOT.IO.kInt: + var n_el = this[prop]['length']; + obj[prop] = buf.ReadFastArray(n_el, 'I'); + break; + case JSROOT.IO.kOffsetL+JSROOT.IO.kUInt: + var n_el = this[prop]['length']; + obj[prop] = buf.ReadFastArray(n_el, 'U'); + break; + case JSROOT.IO.kOffsetL+JSROOT.IO.kULong: + case JSROOT.IO.kOffsetL+JSROOT.IO.kULong64: + var n_el = this[prop]['length']; + obj[prop] = buf.ReadFastArray(n_el, 'LU'); + break; + case JSROOT.IO.kOffsetL+JSROOT.IO.kLong: + case JSROOT.IO.kOffsetL+JSROOT.IO.kLong64: + var n_el = this[prop]['length']; + obj[prop] = buf.ReadFastArray(n_el, 'L'); + break; + case JSROOT.IO.kOffsetL+JSROOT.IO.kFloat: + case JSROOT.IO.kOffsetL+JSROOT.IO.kDouble32: + //var n_el = str.charCodeAt(o) & 0xff; + var n_el = this[prop]['length']; + obj[prop] = buf.ReadFastArray(n_el, 'F'); + break; + case JSROOT.IO.kOffsetL+JSROOT.IO.kDouble: + //var n_el = str.charCodeAt(o) & 0xff; + var n_el = this[prop]['length']; + obj[prop] = buf.ReadFastArray(n_el, 'D'); + break; + case JSROOT.IO.kOffsetP+JSROOT.IO.kChar: + var n_el = obj[this[prop]['cntname']]; + obj[prop] = buf.ReadBasicPointer(n_el, 'C'); + break; + case JSROOT.IO.kOffsetP+JSROOT.IO.kShort: + case JSROOT.IO.kOffsetP+JSROOT.IO.kUShort: + var n_el = obj[this[prop]['cntname']]; + obj[prop] = buf.ReadBasicPointer(n_el, 'S'); + break; + case JSROOT.IO.kOffsetP+JSROOT.IO.kInt: + var n_el = obj[this[prop]['cntname']]; + obj[prop] = buf.ReadBasicPointer(n_el, 'I'); + break; + case JSROOT.IO.kOffsetP+JSROOT.IO.kUInt: + var n_el = obj[this[prop]['cntname']]; + obj[prop] = buf.ReadBasicPointer(n_el, 'U'); + break; + case JSROOT.IO.kOffsetP+JSROOT.IO.kULong: + case JSROOT.IO.kOffsetP+JSROOT.IO.kULong64: + var n_el = obj[this[prop]['cntname']]; + obj[prop] = buf.ReadBasicPointer(n_el, 'LU'); + break; + case JSROOT.IO.kOffsetP+JSROOT.IO.kLong: + case JSROOT.IO.kOffsetP+JSROOT.IO.kLong64: + var n_el = obj[this[prop]['cntname']]; + obj[prop] = buf.ReadBasicPointer(n_el, 'L'); + break; + case JSROOT.IO.kOffsetP+JSROOT.IO.kFloat: + case JSROOT.IO.kOffsetP+JSROOT.IO.kDouble32: + var n_el = obj[this[prop]['cntname']]; + obj[prop] = buf.ReadBasicPointer(n_el, 'F'); + break; + case JSROOT.IO.kOffsetP+JSROOT.IO.kDouble: + var n_el = obj[this[prop]['cntname']]; + obj[prop] = buf.ReadBasicPointer(n_el, 'D'); + break; + default: + alert('failed to stream ' + prop + ' (' + this[prop]['typename'] + ')'); + break; + } + } + + JSROOT.TStreamer.prototype.Stream = function(obj, buf) { + + var ver = buf.ReadVersion(); + + // first base classes + for (var prop in this) { + if (!this[prop] || typeof(this[prop]) === "function") + continue; + if (this[prop]['typename'] === 'BASE') { + var clname = this[prop]['class']; + if (this[prop]['class'].indexOf("TArray") == 0) { + var array_type = this[prop]['class'].charAt(6); + var len = buf.ntou4(); + obj['fArray'] = buf.ReadFastArray(len, array_type); + } else { + buf.ClassStreamer(obj, this[prop]['class']); + } + } + } + // then class members + for (var prop in this) { + + if (!this[prop] || typeof(this[prop]) === "function") continue; + + var prop_typename = this[prop]['typename']; + + if (typeof(prop_typename) === "undefined" || prop_typename === "BASE") continue; + + if (JSROOT.fUserStreamers !== null) { + var user_func = JSROOT.fUserStreamers[prop_typename]; + + if (user_func !== undefined) { + user_func(buf, obj, prop, this); + continue; + } + } + + // special classes (custom streamers) + switch (prop_typename) { + case "TString*": + // TODO: check how and when it used + var r__v = buf.ReadVersion(); + obj[prop] = new Array(); + for (var i = 0; i 0) { + var dirname = keyname.substr(0, pos); + var subname = keyname.substr(pos+1); + + var dirkey = this.GetKey(dirname, 1); + if ((dirkey!=null) && (typeof call_back == 'function') && + (dirkey['fClassName'].indexOf("TDirectory")==0)) { + + this.fFile.ReadObject(this['dir_name'] + "/" + dirname, 1, function(newdir) { + if (newdir) newdir.GetKey(subname, cycle, call_back); + }); + return null; + } + + pos = keyname.lastIndexOf("/", pos-1); + } + + + JSROOT.CallBack(call_back, null); + return null; + } + + JSROOT.TDirectory.prototype.ReadKeys = function(readkeys_callback) { + var thisdir = this; + var file = this.fFile; + + //*-*-------------Read directory info + var nbytes = this.fNbytesName + 22; + nbytes += 4; // fDatimeC.Sizeof(); + nbytes += 4; // fDatimeM.Sizeof(); + nbytes += 18; // fUUID.Sizeof(); + // assume that the file may be above 2 Gbytes if file version is > 4 + if (file.fVersion >= 40000) nbytes += 12; + + file.Seek(this.fSeekDir, this.fFile.ERelativeTo.kBeg); + file.ReadBuffer(nbytes, function(blob1) { + if (blob1==null) return JSROOT.CallBack(readkeys_callback,null); + var buf = new JSROOT.TBuffer(blob1, thisdir.fNbytesName, file); + + thisdir.StreamHeader(buf); + + //*-*---------read TKey::FillBuffer info + buf.locate(4); // Skip NBytes; + var keyversion = buf.ntoi2(); + // Skip ObjLen, DateTime, KeyLen, Cycle, SeekKey, SeekPdir + if (keyversion > 1000) buf.shift(28); // Large files + else buf.shift(20); + buf.ReadTString(); + buf.ReadTString(); + thisdir.fTitle = buf.ReadTString(); + if (thisdir.fNbytesName < 10 || thisdir.fNbytesName > 10000) { + JSROOT.console("Cannot read directory info of file " + file.fURL); + return JSROOT.CallBack(readkeys_callback, null); + } + //*-* -------------Read keys of the top directory + + if (thisdir.fSeekKeys <=0) + return JSROOT.CallBack(readkeys_callback, null); + + file.Seek(thisdir.fSeekKeys, file.ERelativeTo.kBeg); + file.ReadBuffer(thisdir.fNbytesKeys, function(blob2) { + if (blob2 == null) return JSROOT.CallBack(readkeys_callback, null); + + var buf = new JSROOT.TBuffer(blob2, 0, file); + + var key = file.ReadKey(buf); + + var nkeys = buf.ntoi4(); + for (var i = 0; i < nkeys; i++) { + key = file.ReadKey(buf); + thisdir.fKeys.push(key); + } + file.fDirectories.push(thisdir); + delete buf; + + JSROOT.CallBack(readkeys_callback, thisdir); + }); + + delete buf; + }); + } + + JSROOT.TDirectory.prototype.StreamHeader = function(buf) { + var version = buf.ntou2(); + var versiondir = version % 1000; + buf.shift(8); // skip fDatimeC and fDatimeM + this.fNbytesKeys = buf.ntou4(); + this.fNbytesName = buf.ntou4(); + this.fSeekDir = (version > 1000) ? buf.ntou8() : buf.ntou4(); + this.fSeekParent = (version > 1000) ? buf.ntou8() : buf.ntou4(); + this.fSeekKeys = (version > 1000) ? buf.ntou8() : buf.ntou4(); + if (versiondir > 2) buf.shift(18); // skip fUUID + } + + + // ============================================================================== + // A class that reads ROOT files. + // + //////////////////////////////////////////////////////////////////////////////// + // A ROOT file is a suite of consecutive data records (TKey's) with + // the following format (see also the TKey class). If the key is + // located past the 32 bit file limit (> 2 GB) then some fields will + // be 8 instead of 4 bytes: + // 1->4 Nbytes = Length of compressed object (in bytes) + // 5->6 Version = TKey version identifier + // 7->10 ObjLen = Length of uncompressed object + // 11->14 Datime = Date and time when object was written to file + // 15->16 KeyLen = Length of the key structure (in bytes) + // 17->18 Cycle = Cycle of key + // 19->22 [19->26] SeekKey = Pointer to record itself (consistency check) + // 23->26 [27->34] SeekPdir = Pointer to directory header + // 27->27 [35->35] lname = Number of bytes in the class name + // 28->.. [36->..] ClassName = Object Class Name + // ..->.. lname = Number of bytes in the object name + // ..->.. Name = lName bytes with the name of the object + // ..->.. lTitle = Number of bytes in the object title + // ..->.. Title = Title of the object + // -----> DATA = Data bytes associated to the object + // + + + // ctor + JSROOT.TFile = function(url, newfile_callback) { + if (! (this instanceof arguments.callee) ) { + var error = new Error("you must use new to instantiate this class"); + error.source = "JSROOT.TFile.ctor"; + throw error; + } + + this._typename = "TFile"; + this.fOffset = 0; + this.fEND = 0; + this.fFullURL = url; + this.fURL = url; + this.fAcceptRanges = true; // when disabled ('+' at the end of file name), complete file content read with single operation + this.fUseStampPar = true; // use additional stamp parameter for file name to avoid browser caching problem + this.fFileContent = ""; // this can be full or parial content of the file (if ranges are not supported or if 1K header read from file) + + this.ERelativeTo = { kBeg : 0, kCur : 1, kEnd : 2 }; + this.fDirectories = new Array(); + this.fKeys = new Array(); + this.fSeekInfo = 0; + this.fNbytesInfo = 0; + this.fTagOffset = 0; + this.fStreamers = 0; + this.fStreamerInfos = null; + this.fFileName = ""; + this.fStreamers = new Array; + + if (typeof this.fURL != 'string') return this; + + if (this.fURL.charAt(this.fURL.length-1) == "+") { + this.fURL = this.fURL.substr(0, this.fURL.length-1); + this.fAcceptRanges = false; + } + + var pos = Math.max(this.fURL.lastIndexOf("/"), this.fURL.lastIndexOf("\\")); + this.fFileName = pos>=0 ? this.fURL.substr(pos+1) : this.fURL; + + if (!this.fAcceptRanges) { + this.ReadKeys(newfile_callback); + } else { + var file = this; + + var xhr = JSROOT.NewHttpRequest(this.fURL, "head", function(res) { + if (res==null) + return JSROOT.CallBack(newfile_callback, null); + + var accept_ranges = res.getResponseHeader("Accept-Ranges"); + if (accept_ranges==null) file.fAcceptRanges = false; + var len = res.getResponseHeader("Content-Length"); + if (len!=null) file.fEND = parseInt(len); + else file.fAcceptRanges = false; + file.ReadKeys(newfile_callback); + }); + + xhr.send(null); + } + + return this; + } + + JSROOT.TFile.prototype.ReadBuffer = function(len, callback) { + + if ((this.fFileContent.length>0) && (!this.fAcceptRanges || (this.fOffset+len <= this.fFileContent.length))) + return callback(this.fFileContent.substr(this.fOffset, len)); + + var file = this; + + var url = this.fURL; + if (this.fUseStampPar) { + // try to avoid browser caching by adding stamp parameter to URL + if (url.indexOf('?')>0) url+="&stamp="; else url += "?stamp="; + var d = new Date; + url += d.getTime(); + } + + function read_callback(res) { + if ((res==null) && file.fUseStampPar && (file.fOffset==0)) { + // if fail to read file with stamp parameter, try once to avoid it + file.fUseStampPar = false; + var xhr2 = JSROOT.NewHttpRequest(this.fURL, "bin", read_callback); + if (this.fAcceptRanges) + xhr2.setRequestHeader("Range", "bytes=" + this.fOffset + "-" + (this.fOffset + len - 1)); + xhr2.send(null); + return; + } else + if ((res!=null) && (file.fOffset==0) && (file.fFileContent.length == 0)) { + // special case - read content all at once + file.fFileContent = res; + if (!this.fAcceptRanges) { + file.fEND = res.length; + res = file.fFileContent.substr(file.fOffset, len); + } + } + + callback(res); + } + + var xhr = JSROOT.NewHttpRequest(url, "bin", read_callback); + if (this.fAcceptRanges) + xhr.setRequestHeader("Range", "bytes=" + this.fOffset + "-" + (this.fOffset + len - 1)); + xhr.send(null); + } + + JSROOT.TFile.prototype.Seek = function(offset, pos) { + // Set position from where to start reading. + switch (pos) { + case this.ERelativeTo.kBeg: + this.fOffset = offset; + break; + case this.ERelativeTo.kCur: + this.fOffset += offset; + break; + case this.ERelativeTo.kEnd: + // this option is not used currently in the ROOT code + if (this.fEND == 0) + throw "Seek : seeking from end in file with fEND==0 is not supported"; + this.fOffset = this.fEND - offset; + break; + default: + throw "Seek : unknown seek option (" + pos + ")"; + break; + } + } + + JSROOT.TFile.prototype.ReadKey = function(buf) { + // read key from buffer + var key = {}; + buf.ReadTKey(key); + return key; + } + + JSROOT.TFile.prototype.GetDir = function(dirname, cycle) { + // check first that directory with such name exists + + if ((cycle==null) && (typeof dirname == 'string')) { + var pos = dirname.lastIndexOf(';'); + if (pos>0) { cycle = dirname.substr(pos+1); dirname = dirname.substr(0,pos); } + } + + for (var j in this.fDirectories) { + var dir = this.fDirectories[j]; + if (dir['dir_name'] != dirname) continue; + if ((cycle!=null) && (dir['dir_cycle']!=cycle)) continue; + return dir; + } + return null; + } + + JSROOT.TFile.prototype.GetKey = function(keyname, cycle, getkey_callback) { + // retrieve a key by its name and cycle in the list of keys + // one should call_back when keys must be read first from the directory + + for (var i in this.fKeys) { + if (this.fKeys[i]['fName'] == keyname && this.fKeys[i]['fCycle'] == cycle) { + JSROOT.CallBack(getkey_callback, this.fKeys[i]); + return this.fKeys[i]; + } + } + + var pos = keyname.lastIndexOf("/"); + // try to handle situation when object name contains slashed (bad practice anyway) + while (pos > 0) { + var dirname = keyname.substr(0, pos); + var subname = keyname.substr(pos+1); + + var dir = this.GetDir(dirname); + if (dir!=null) return dir.GetKey(subname, cycle, getkey_callback); + + var dirkey = this.GetKey(dirname, 1); + if ((dirkey!=null) && (getkey_callback != null) && + (dirkey['fClassName'].indexOf("TDirectory")==0)) { + + this.ReadObject(dirname, function(newdir) { + if (newdir) newdir.GetKey(subname, cycle, getkey_callback); + }); + return null; + } + + pos = keyname.lastIndexOf("/", pos-1); + } + + JSROOT.CallBack(getkey_callback, null); + return null; + } + + JSROOT.TFile.prototype.ReadObjBuffer = function(key, callback) { + // read and inflate object buffer described by its key + + var file = this; + + this.Seek(key['fSeekKey'] + key['fKeylen'], this.ERelativeTo.kBeg); + this.ReadBuffer(key['fNbytes'] - key['fKeylen'], function(blob1) { + + if (blob1==null) callback(null); + + var buf = null; + + if (key['fObjlen'] <= key['fNbytes']-key['fKeylen']) { + buf = new JSROOT.TBuffer(blob1, 0, file); + } else { + var hdrsize = JSROOT.R__unzip_header(blob1, 0); + if (hdrsize<0) return callback(null); + var objbuf = JSROOT.R__unzip(hdrsize, blob1, 0); + buf = new JSROOT.TBuffer(objbuf, 0, file); + } + + buf.fTagOffset = key.fKeylen; + callback(buf); + delete buf; + }); + } + + JSROOT.TFile.prototype.ReadObject = function(obj_name, cycle, user_call_back) { + // Read any object from a root file + // One could specify cycle number in the object name or as separate argument + // Last argument should be callback function, while data reading from file is asynchron + + if (typeof cycle == 'function') { user_call_back = cycle; cycle = 1; } + + var pos = obj_name.lastIndexOf(";"); + if (pos>0) { + cycle = parseInt(obj_name.slice(pos+1)); + obj_name = obj_name.slice(0, pos); + } + + if ((typeof cycle != 'number') || (cycle<0)) cycle = 1; + // remove leading slashes + while ((obj_name.length>0) && (obj_name[0] == "/")) obj_name = obj_name.substr(1); + + var file = this; + + // we use callback version while in some cases we need to + // read sub-directory to get list of keys + // in such situation calls are asynchrone + this.GetKey(obj_name, cycle, function(key) { + + if (key == null) + return JSROOT.CallBack(user_call_back, null); + + if ((obj_name=="StreamerInfo") && (key['fClassName']=="TList")) + return file.fStreamerInfos; + + var isdir = false; + if ((key['fClassName'] == 'TDirectory' || key['fClassName'] == 'TDirectoryFile')) { + isdir = true; + var dir = file.GetDir(obj_name, cycle); + if (dir!=null) + return JSROOT.CallBack(user_call_back, dir); + } + + file.ReadObjBuffer(key, function(buf) { + if (!buf) return JSROOT.CallBack(user_call_back, null); + + if (isdir) { + var dir = new JSROOT.TDirectory(file, obj_name, cycle); + dir.StreamHeader(buf); + if (dir.fSeekKeys) { + dir.ReadKeys(user_call_back); + } else { + JSROOT.CallBack(user_call_back,dir); + } + + return; + } + + var obj = {}; + buf.MapObject(1, obj); // tag object itself with id==1 + buf.ClassStreamer(obj, key['fClassName']); + + JSROOT.CallBack(user_call_back, obj); + }); // end of ReadObjBuffer callback + }); // end of GetKey callback + } + + JSROOT.TFile.prototype.ExtractStreamerInfos = function(buf) + { + if (!buf) return; + + var lst = {}; + buf.MapObject(1, lst); + buf.ClassStreamer(lst, 'TList'); + + lst['_typename'] = "TStreamerInfoList"; + + this.fStreamerInfos = lst; + } + + JSROOT.TFile.prototype.ReadFormulas = function() + { + for (var i in this.fKeys) + if (this.fKeys[i]['fClassName'] == 'TFormula') + this.ReadObject(this.fKeys[i]['fName'], this.fKeys[i]['fCycle'], function(obj) { + JSROOT.addFormula(obj); + }); + } + + JSROOT.TFile.prototype.ReadStreamerInfos = function(si_callback) + { + if (this.fSeekInfo == 0 || this.fNbytesInfo == 0) return si_callback(null); + this.Seek(this.fSeekInfo, this.ERelativeTo.kBeg); + + var file = this; + + file.ReadBuffer(file.fNbytesInfo, function(blob1) { + var buf = new JSROOT.TBuffer(blob1, 0, file); + var key = file.ReadKey(buf); + if (key == null) return si_callback(null); + file.fKeys.push(key); + + file.ReadObjBuffer(key, function(blob2) { + if (blob2==null) return si_callback(null); + file.ExtractStreamerInfos(blob2); + file.ReadFormulas(); + si_callback(file); + }); + }); + } + + JSROOT.TFile.prototype.ReadKeys = function(readkeys_callback) { + // read keys only in the root file + + var file = this; + + // with the first readbuffer we read bigger amount to create header cache + this.ReadBuffer(1024, function(blob1) { + if (blob1==null) return JSROOT.CallBack(readkeys_callback, null); + + if (blob1.substring(0, 4)!='root') { + alert("NOT A ROOT FILE! " + file.fURL); + return JSROOT.CallBack(readkeys_callback, null); + } + + var buf = new JSROOT.TBuffer(blob1, 4, file); // skip the "root" file identifier + file.fVersion = buf.ntou4(); + file.fBEGIN = buf.ntou4(); + if (file.fVersion < 1000000) { //small file + file.fEND = buf.ntou4(); + file.fSeekFree = buf.ntou4(); + file.fNbytesFree = buf.ntou4(); + var nfree = buf.ntoi4(); + file.fNbytesName = buf.ntou4(); + file.fUnits = buf.ntou1(); + file.fCompress = buf.ntou4(); + file.fSeekInfo = buf.ntou4(); + file.fNbytesInfo = buf.ntou4(); + } else { // new format to support large files + file.fEND = buf.ntou8(); + file.fSeekFree = buf.ntou8(); + file.fNbytesFree = buf.ntou4(); + var nfree = buf.ntou4(); + file.fNbytesName = buf.ntou4(); + file.fUnits = buf.ntou1(); + file.fCompress = buf.ntou4(); + file.fSeekInfo = buf.ntou8(); + file.fNbytesInfo = buf.ntou4(); + } + + // empty file + if (!file.fSeekInfo && !file.fNbytesInfo) + return JSROOT.CallBack(readkeys_callback, null); + + //*-*-------------Read directory info + var nbytes = file.fNbytesName + 22; + nbytes += 4; // fDatimeC.Sizeof(); + nbytes += 4; // fDatimeM.Sizeof(); + nbytes += 18; // fUUID.Sizeof(); + // assume that the file may be above 2 Gbytes if file version is > 4 + if (file.fVersion >= 40000) nbytes += 12; + + file.Seek(file.fBEGIN, file.ERelativeTo.kBeg); + + file.ReadBuffer(Math.max(300, nbytes), function(blob3) { + if (blob3==null) return JSROOT.CallBack(readkeys_callback, null); + + var buf3 = new JSROOT.TBuffer(blob3, file.fNbytesName, file); + + // we call TDirectory method while TFile is just derived class + JSROOT.TDirectory.prototype.StreamHeader.call(file, buf3); + + //*-*---------read TKey::FillBuffer info + buf3.o = 4; // Skip NBytes; + var keyversion = buf3.ntoi2(); + // Skip ObjLen, DateTime, KeyLen, Cycle, SeekKey, SeekPdir + if (keyversion > 1000) buf3.shift(28); // Large files + else buf3.shift(20); + buf3.ReadTString(); + buf3.ReadTString(); + file.fTitle = buf3.ReadTString(); + if (file.fNbytesName < 10 || this.fNbytesName > 10000) { + JSROOT.console("Init : cannot read directory info of file " + file.fURL); + return JSROOT.CallBack(readkeys_callback, null); + } + //*-* -------------Read keys of the top directory + + if (file.fSeekKeys <= 0) { + JSROOT.console("Empty keys list - not supported" + file.fURL); + return JSROOT.CallBack(readkeys_callback, null); + } + + file.Seek(file.fSeekKeys, file.ERelativeTo.kBeg); + file.ReadBuffer(file.fNbytesKeys, function(blob4) { + if (blob4==null) return JSROOT.CallBack(readkeys_callback, null); + + var buf4 = new JSROOT.TBuffer(blob4, 0, file); + + var key = file.ReadKey(buf4); + + var nkeys = buf4.ntoi4(); + for (var i = 0; i < nkeys; i++) { + key = file.ReadKey(buf4); + file.fKeys.push(key); + } + file.ReadStreamerInfos(readkeys_callback); + delete buf4; + }); + delete buf3; + }); + delete buf; + }); + } + + JSROOT.TFile.prototype.ReadDirectory = function(dir_name, cycle, readdir_callback) { + // read the directory content from a root file + // do not read directory if it is already exists + + return this.ReadObject(dir_name, cycle, readdir_callback); + } + + JSROOT.TFile.prototype.GetStreamer = function(clname) { + // return the streamer for the class 'clname', from the list of streamers + // or generate it from the streamer infos and add it to the list + + var streamer = this.fStreamers[clname]; + if (typeof(streamer) != 'undefined') return streamer; + + var s_i; + + if (this.fStreamerInfos) + for (var i in this.fStreamerInfos.arr) + if (this.fStreamerInfos.arr[i].fName == clname) { + s_i = this.fStreamerInfos.arr[i]; + break; + } + if (typeof s_i == 'undefined') return null; + + this.fStreamers[clname] = new JSROOT.TStreamer(this); + if (typeof(s_i['fElements']) != 'undefined') { + var n_el = s_i['fElements']['arr'].length; + for (var j=0;jd.length){if(!b){alert("Error R__unzip_header: header size exceeds buffer size")}return -1}if(!(d.charAt(c)=="Z"&&d.charAt(c+1)=="L"&&d.charCodeAt(c+2)==a.IO.Z_DEFLATED)&&!(d.charAt(c)=="C"&&d.charAt(c+1)=="S"&&d.charCodeAt(c+2)==a.IO.Z_DEFLATED)&&!(d.charAt(c)=="X"&&d.charAt(c+1)=="Z"&&d.charCodeAt(c+2)==0)){if(!b){alert("Error R__unzip_header: error in header")}return -1}return a.IO.Z_HDRSIZE+((d.charCodeAt(c+3)&255)|((d.charCodeAt(c+4)&255)<<8)|((d.charCodeAt(c+5)&255)<<16))};a.R__unzip=function(g,f,e,b){if(g>>0};a.TBuffer.prototype.ntou2=function(){var b=((this.b.charCodeAt(this.o)&255)<<8)>>>0;b+=(this.b.charCodeAt(this.o+1)&255)>>>0;this.o+=2;return b};a.TBuffer.prototype.ntou4=function(){var b=((this.b.charCodeAt(this.o)&255)<<24)>>>0;b+=((this.b.charCodeAt(this.o+1)&255)<<16)>>>0;b+=((this.b.charCodeAt(this.o+2)&255)<<8)>>>0;b+=(this.b.charCodeAt(this.o+3)&255)>>>0;this.o+=4;return b};a.TBuffer.prototype.ntou8=function(){var b=((this.b.charCodeAt(this.o)&255)<<56)>>>0;b+=((this.b.charCodeAt(this.o+1)&255)<<48)>>>0;b+=((this.b.charCodeAt(this.o+2)&255)<<40)>>>0;b+=((this.b.charCodeAt(this.o+3)&255)<<32)>>>0;b+=((this.b.charCodeAt(this.o+4)&255)<<24)>>>0;b+=((this.b.charCodeAt(this.o+5)&255)<<16)>>>0;b+=((this.b.charCodeAt(this.o+6)&255)<<8)>>>0;b+=(this.b.charCodeAt(this.o+7)&255)>>>0;this.o+=8;return b};a.TBuffer.prototype.ntoi1=function(){return(this.b.charCodeAt(this.o++)&255)};a.TBuffer.prototype.ntoi2=function(){var b=(this.b.charCodeAt(this.o)&255)<<8;b+=(this.b.charCodeAt(this.o+1)&255);this.o+=2;return b};a.TBuffer.prototype.ntoi4=function(){var b=((this.b.charCodeAt(this.o)&255)<<24)+((this.b.charCodeAt(this.o+1)&255)<<16)+((this.b.charCodeAt(this.o+2)&255)<<8)+((this.b.charCodeAt(this.o+3)&255));this.o+=4;return b};a.TBuffer.prototype.ntoi8=function(c,d){var e=(this.b.charCodeAt(this.o)&255)<<56;e+=(this.b.charCodeAt(this.o+1)&255)<<48;e+=(this.b.charCodeAt(this.o+2)&255)<<40;e+=(this.b.charCodeAt(this.o+3)&255)<<32;e+=(this.b.charCodeAt(this.o+4)&255)<<24;e+=(this.b.charCodeAt(this.o+5)&255)<<16;e+=(this.b.charCodeAt(this.o+6)&255)<<8;e+=(this.b.charCodeAt(this.o+7)&255);this.o+=8;return e};a.TBuffer.prototype.ntof=function(){var c=this.b.substring(this.o,this.o+4);this.o+=4;if(c.length<4){return Number.NaN}var k="";for(var d=0;d<4;d++){var b=(c.charCodeAt(d)&255).toString(2);var e=b.length;if(e<8){for(var h=0;h<(8-e);h++){b="0"+b}}k=k+b}var g=(k.charAt(0)=="1")?-1:1;var j=parseInt(k.substring(1,9),2)-127;var f;if(j==-127){f=0}else{f=1;for(var d=0;d<23;d++){if(parseInt(k.substr(9+d,1))==1){f=f+1/Math.pow(2,d+1)}}}return(g*Math.pow(2,j)*f)};a.TBuffer.prototype.ntod=function(){var c=this.b.substring(this.o,this.o+8);this.o+=8;if(c.length<8){return Number.NaN}var k="";for(var d=0;d<8;d++){var b=(c.charCodeAt(d)&255).toString(2);var e=b.length;if(e<8){for(var h=0;h<(8-e);h++){b="0"+b}}k=k+b}var g=(k.charAt(0)=="1")?-1:1;var j=parseInt(k.substring(1,12),2)-1023;var f;if(j==-127){f=0}else{f=1;for(var d=0;d<52;d++){if(parseInt(k.substr(12+d,1))==1){f=f+1/Math.pow(2,d+1)}}}return(g*Math.pow(2,j)*f)};a.TBuffer.prototype.ReadFastArray=function(e,c){var d=new Array();switch(c){case"D":for(var b=0;b"){d=this.ReadFastArray(this.ntoi4(),"D")}else{if(e=="vector"){d=this.ReadFastArray(this.ntoi4(),"I")}else{if(e=="vector"){d=this.ReadFastArray(this.ntoi4(),"F")}else{if(e=="vector"){var j=this.ntoi4();d=[];for(var c=0;c3){this.ReadTObject(e);e.name=this.ReadTString();var g=this.ntou4();for(var d=0;d2){this.ReadTObject(e)}if(b.val>1){e.name=this.ReadTString()}var g=this.ntou4();var c=this.ntou4();for(var d=0;d2){this.ReadTObject(h)}if(g.val>1){h.name=this.ReadTString()}var l=this.ReadTString();var f=l;var k=0;var j=l.indexOf(";");if(j!=-1){f=l.slice(0,j);l=l.slice(j+1,l.length()-j-1);k=parseInt(l)}var b=this.ntou4();if(b<0){b=-b}var c=this.ntou4();for(var e=0;e1){c.fName=this.ReadTString()}else{c.fName="TPolyMarker3D"}return this.CheckBytecount(b,"ReadTPolyMarker3D")};a.TBuffer.prototype.ReadTCollection=function(d,g,f){d._typename="TCollection";d.name="";d.arr=new Array();var b=this.ReadVersion();if(b.val>2){this.ReadTObject(d)}if(b.val>1){d.name=this.ReadTString()}var e=this.ntou4();for(var c=0;c>>26)+1995);c.fDatime.setMonth((d<<6)>>>28);c.fDatime.setDate((d<<10)>>>27);c.fDatime.setHours((d<<15)>>>27);c.fDatime.setMinutes((d<<20)>>>26);c.fDatime.setSeconds((d<<26)>>>26);c.fDatime.setMilliseconds(0);c.fKeylen=this.ntou2();c.fCycle=this.ntou2();if(c.fVersion>1000){c.fSeekKey=this.ntou8();this.shift(8)}else{c.fSeekKey=this.ntou4();this.shift(4)}c.fClassName=this.ReadTString();c.fName=this.ReadTString();c.fTitle=this.ReadTString();var b=c.fName.replace(/['"]/g,"");if(b!=c.fName){c.fRealName=c.fName;c.fName=b}return true};a.TBuffer.prototype.ReadTBasket=function(e){this.ReadTKey(e);var b=this.ReadVersion();e.fBufferSize=this.ntoi4();e.fNevBufSize=this.ntoi4();e.fNevBuf=this.ntoi4();e.fLast=this.ntoi4();var c=this.ntoi1();if((c%10)!=2){var d=this.ntoi4();this.o+=d*4;if(c>40){d=this.ntoi4();this.o+=d*4}}if(c==1||c>10){var d=e.fLast;if(b.val<=1){d=this.ntoi4()}this.o+=d}return this.CheckBytecount(b,"ReadTBasket")};a.TBuffer.prototype.ReadTCanvas=function(c){var b=this.ReadVersion();this.ClassStreamer(c,"TPad");c.fDISPLAY=this.ReadTString();c.fDoubleBuffer=this.ntoi4();c.fRetained=this.ntou1()!=0;c.fXsizeUser=this.ntoi4();c.fYsizeUser=this.ntoi4();c.fXsizeReal=this.ntoi4();c.fYsizeReal=this.ntoi4();c.fWindowTopX=this.ntoi4();c.fWindowTopY=this.ntoi4();c.fWindowWidth=this.ntoi4();c.fWindowHeight=this.ntoi4();c.fCw=this.ntou4();c.fCh=this.ntou4();c.fCatt={};this.ClassStreamer(c.fCatt,"TAttCanvas");this.ntou1();this.ntou1();c.fHighLightColor=this.ntoi2();c.fBatch=this.ntou1()!=0;this.ntou1();this.ntou1();this.ntou1();return this.CheckBytecount(b,"TCanvas")};a.TBuffer.prototype.ReadTStreamerInfo=function(c){var b=this.ReadVersion();if(b.val>1){this.ReadTNamed(c);c.fCheckSum=this.ntou4();c.fClassVersion=this.ntou4();c.fElements=this.ReadObjectAny()}return this.CheckBytecount(b,"ReadTStreamerInfo")};a.TBuffer.prototype.ReadStreamerElement=function(b){var c=this.ReadVersion();this.ReadTNamed(b);b.type=this.ntou4();b.size=this.ntou4();b.length=this.ntou4();b.dim=this.ntou4();if(c.val==1){var d=this.ntou4();b.maxindex=this.ReadFastArray(d,"U")}else{b.maxindex=this.ReadFastArray(5,"U")}b.fTypeName=this.ReadTString();b.typename=b.fTypeName;if((b.type==11)&&(b.typename=="Bool_t"||b.typename=="bool")){b.type=18}if(c.val>1){b.uuid=0}if(c.val<=2){}if(c.val==3){b.xmin=this.ntou4();b.xmax=this.ntou4();b.factor=this.ntou4()}if(c.val>3){}return this.CheckBytecount(c,"ReadStreamerElement")};a.TBuffer.prototype.ReadStreamerBase=function(c){var b=this.ReadVersion();this.ReadStreamerElement(c);if(b.val>2){c.baseversion=this.ntou4()}return this.CheckBytecount(b,"ReadStreamerBase")};a.TBuffer.prototype.ReadStreamerSubElement=function(c,d){if(d==null){d=1}var b=this.ReadVersion();if(b.val>d){this.ReadStreamerElement(c)}return this.CheckBytecount(b,"ReadStreamerSubElement")};a.TBuffer.prototype.ReadStreamerBasicPointer=function(c){var b=this.ReadVersion();if(b.val>1){this.ReadStreamerElement(c);c.countversion=this.ntou4();c.countName=this.ReadTString();c.countClass=this.ReadTString()}return this.CheckBytecount(b,"ReadStreamerBasicPointer")};a.TBuffer.prototype.ReadStreamerSTL=function(b){var c=this.ReadVersion();if(c.val>1){this.ReadStreamerElement(b);b.stltype=this.ntou4();b.ctype=this.ntou4()}return this.CheckBytecount(c,"ReadStreamerSTL")};a.TBuffer.prototype.ReadClass=function(){var f={};f.name=-1;var b=0;var e=this.ntou4();var d=this.o;if(!(e&a.IO.kByteCountMask)||(e==a.IO.kNewClassTag)){b=e;e=0}else{b=this.ntou4()}if(!(b&a.IO.kClassMask)){f.objtag=b;return f}if(b==a.IO.kNewClassTag){f.name=this.ReadString();if(this.GetMappedClass(this.fTagOffset+d+a.IO.kMapOffset)==-1){this.MapClass(this.fTagOffset+d+a.IO.kMapOffset,f.name)}}else{var c=(b&~a.IO.kClassMask);f.name=this.GetMappedClass(c);if(f.name==-1){alert("Did not found class with tag "+c)}}return f};a.TBuffer.prototype.ReadObjectAny=function(){var b=this.o;var d=this.ReadClass();if("objtag" in d){return this.GetMappedObject(d.objtag)}if(d.name==-1){return null}var c={};this.MapObject(this.fTagOffset+b+a.IO.kMapOffset,c);this.ClassStreamer(c,d.name);return c};a.TBuffer.prototype.ClassStreamer=function(e,d){if(!("_typename" in e)){e._typename=d}if(d=="TObject"||d=="TMethodCall"){this.ReadTObject(e)}else{if(d=="TQObject"){}else{if(d=="TObjString"){this.ReadTObjString(e)}else{if(d=="TObjArray"){this.ReadTObjArray(e)}else{if(d=="TClonesArray"){this.ReadTClonesArray(e)}else{if((d=="TList")||(d=="THashList")){this.ReadTList(e)}else{if(d=="TCollection"){this.ReadTCollection(e);alert("Trying to read TCollection - wrong!!!")}else{if(d=="TCanvas"){this.ReadTCanvas(e)}else{if(d=="TPolyMarker3D"){this.ReadTPolyMarker3D(e)}else{if(d=="TStreamerInfo"){this.ReadTStreamerInfo(e)}else{if(d=="TStreamerBase"){this.ReadStreamerBase(e)}else{if((d=="TStreamerBasicPointer")||(d=="TStreamerLoop")){this.ReadStreamerBasicPointer(e)}else{if(d=="TStreamerSTL"){this.ReadStreamerSTL(e)}else{if(d=="TStreamerObject"||d=="TStreamerBasicType"||d=="TStreamerObjectAny"||d=="TStreamerString"||d=="TStreamerObjectPointer"){this.ReadStreamerSubElement(e)}else{if(d=="TStreamerObjectAnyPointer"){this.ReadStreamerSubElement(e,0)}else{if(d=="TBasket"){this.ReadTBasket(e)}else{var c=this.fFile.GetStreamer(d);if(c!=null){c.Stream(e,this)}else{a.console("Did not found streamer for class "+d+" try to skip data");var b=this.ReadVersion();this.CheckBytecount(b)}}}}}}}}}}}}}}}}}a.addMethods(e)};a.TStreamer=function(b){this.fFile=b;this._typename="TStreamer";return this};a.TStreamer.prototype.ReadBasicType=function(b,d,f){switch(this[f]["type"]){case a.IO.kBase:break;case a.IO.kOffsetL:break;case a.IO.kOffsetP:break;case a.IO.kCharStar:var e=d[this[f]["cntname"]];d[f]=b.ReadBasicPointer(e,"C");break;case a.IO.kChar:case a.IO.kLegacyChar:d[f]=b.b.charCodeAt(b.o++)&255;break;case a.IO.kShort:d[f]=b.ntoi2();break;case a.IO.kInt:case a.IO.kCounter:d[f]=b.ntoi4();break;case a.IO.kLong:d[f]=b.ntoi8();break;case a.IO.kFloat:case a.IO.kDouble32:d[f]=b.ntof();if(Math.abs(d[f])<1e-300){d[f]=0}break;case a.IO.kDouble:d[f]=b.ntod();if(Math.abs(d[f])<1e-300){d[f]=0}break;case a.IO.kUChar:d[f]=(b.b.charCodeAt(b.o++)&255)>>>0;break;case a.IO.kUShort:d[f]=b.ntou2();break;case a.IO.kUInt:d[f]=b.ntou4();break;case a.IO.kULong:d[f]=b.ntou8();break;case a.IO.kBits:alert("failed to stream bits "+f+" ("+this[f]["typename"]+")");break;case a.IO.kLong64:d[f]=b.ntoi8();break;case a.IO.kULong64:d[f]=b.ntou8();break;case a.IO.kBool:d[f]=(b.b.charCodeAt(b.o++)&255)!=0;break;case a.IO.kFloat16:d[f]=0;b.o+=2;break;case a.IO.kAny:case a.IO.kAnyp:case a.IO.kObjectp:case a.IO.kObject:var c=this[f]["typename"];if(c.charAt(c.length-1)=="*"){c=c.substr(0,c.length-1)}d[f]={};b.ClassStreamer(d[f],c);break;case a.IO.kAnyP:case a.IO.kObjectP:d[f]=b.ReadObjectAny();break;case a.IO.kTString:d[f]=b.ReadTString();break;case a.IO.kTObject:b.ReadTObject(d);break;case a.IO.kTNamed:b.ReadTNamed(d);break;case a.IO.kStreamer:d[f]=b.ReadSpecial(this[f]["type"],this[f]["typename"]);break;case a.IO.kOffsetL+a.IO.kShort:case a.IO.kOffsetL+a.IO.kUShort:alert("Strange code was here????");var e=this[f]["length"];d[f]=b.ReadFastArray(e,"S");break;case a.IO.kOffsetL+a.IO.kInt:var e=this[f]["length"];d[f]=b.ReadFastArray(e,"I");break;case a.IO.kOffsetL+a.IO.kUInt:var e=this[f]["length"];d[f]=b.ReadFastArray(e,"U");break;case a.IO.kOffsetL+a.IO.kULong:case a.IO.kOffsetL+a.IO.kULong64:var e=this[f]["length"];d[f]=b.ReadFastArray(e,"LU");break;case a.IO.kOffsetL+a.IO.kLong:case a.IO.kOffsetL+a.IO.kLong64:var e=this[f]["length"];d[f]=b.ReadFastArray(e,"L");break;case a.IO.kOffsetL+a.IO.kFloat:case a.IO.kOffsetL+a.IO.kDouble32:var e=this[f]["length"];d[f]=b.ReadFastArray(e,"F");break;case a.IO.kOffsetL+a.IO.kDouble:var e=this[f]["length"];d[f]=b.ReadFastArray(e,"D");break;case a.IO.kOffsetP+a.IO.kChar:var e=d[this[f]["cntname"]];d[f]=b.ReadBasicPointer(e,"C");break;case a.IO.kOffsetP+a.IO.kShort:case a.IO.kOffsetP+a.IO.kUShort:var e=d[this[f]["cntname"]];d[f]=b.ReadBasicPointer(e,"S");break;case a.IO.kOffsetP+a.IO.kInt:var e=d[this[f]["cntname"]];d[f]=b.ReadBasicPointer(e,"I");break;case a.IO.kOffsetP+a.IO.kUInt:var e=d[this[f]["cntname"]];d[f]=b.ReadBasicPointer(e,"U");break;case a.IO.kOffsetP+a.IO.kULong:case a.IO.kOffsetP+a.IO.kULong64:var e=d[this[f]["cntname"]];d[f]=b.ReadBasicPointer(e,"LU");break;case a.IO.kOffsetP+a.IO.kLong:case a.IO.kOffsetP+a.IO.kLong64:var e=d[this[f]["cntname"]];d[f]=b.ReadBasicPointer(e,"L");break;case a.IO.kOffsetP+a.IO.kFloat:case a.IO.kOffsetP+a.IO.kDouble32:var e=d[this[f]["cntname"]];d[f]=b.ReadBasicPointer(e,"F");break;case a.IO.kOffsetP+a.IO.kDouble:var e=d[this[f]["cntname"]];d[f]=b.ReadBasicPointer(e,"D");break;default:alert("failed to stream "+f+" ("+this[f]["typename"]+")");break}};a.TStreamer.prototype.Stream=function(h,e){var j=e.ReadVersion();for(var b in this){if(!this[b]||typeof(this[b])==="function"){continue}if(this[b]["typename"]==="BASE"){var c=this[b]["class"];if(this[b]["class"].indexOf("TArray")==0){var o=this[b]["class"].charAt(6);var k=e.ntou4();h.fArray=e.ReadFastArray(k,o)}else{e.ClassStreamer(h,this[b]["class"])}}}for(var b in this){if(!this[b]||typeof(this[b])==="function"){continue}var d=this[b]["typename"];if(typeof(d)==="undefined"||d==="BASE"){continue}if(a.fUserStreamers!==null){var m=a.fUserStreamers[d];if(m!==undefined){m(e,h,b,this);continue}}switch(d){case"TString*":var l=e.ReadVersion();h[b]=new Array();for(var g=0;g0){var f=g.substr(0,j);var h=g.substr(j+1);var d=this.GetKey(f,1);if((d!=null)&&(typeof e=="function")&&(d.fClassName.indexOf("TDirectory")==0)){this.fFile.ReadObject(this["dir_name"]+"/"+f,1,function(i){if(i){i.GetKey(h,c,e)}});return null}j=g.lastIndexOf("/",j-1)}a.CallBack(e,null);return null};a.TDirectory.prototype.ReadKeys=function(b){var e=this;var d=this.fFile;var c=this.fNbytesName+22;c+=4;c+=4;c+=18;if(d.fVersion>=40000){c+=12}d.Seek(this.fSeekDir,this.fFile.ERelativeTo.kBeg);d.ReadBuffer(c,function(h){if(h==null){return a.CallBack(b,null)}var f=new a.TBuffer(h,e.fNbytesName,d);e.StreamHeader(f);f.locate(4);var g=f.ntoi2();if(g>1000){f.shift(28)}else{f.shift(20)}f.ReadTString();f.ReadTString();e.fTitle=f.ReadTString();if(e.fNbytesName<10||e.fNbytesName>10000){a.console("Cannot read directory info of file "+d.fURL);return a.CallBack(b,null)}if(e.fSeekKeys<=0){return a.CallBack(b,null)}d.Seek(e.fSeekKeys,d.ERelativeTo.kBeg);d.ReadBuffer(e.fNbytesKeys,function(n){if(n==null){return a.CallBack(b,null)}var j=new a.TBuffer(n,0,d);var l=d.ReadKey(j);var m=j.ntoi4();for(var k=0;k1000)?c.ntou8():c.ntou4();this.fSeekParent=(b>1000)?c.ntou8():c.ntou4();this.fSeekKeys=(b>1000)?c.ntou8():c.ntou4();if(d>2){c.shift(18)}};a.TFile=function(d,b){if(!(this instanceof arguments.callee)){var c=new Error("you must use new to instantiate this class");c.source="JSROOT.TFile.ctor";throw c}this._typename="TFile";this.fOffset=0;this.fEND=0;this.fFullURL=d;this.fURL=d;this.fAcceptRanges=true;this.fUseStampPar=true;this.fFileContent="";this.ERelativeTo={kBeg:0,kCur:1,kEnd:2};this.fDirectories=new Array();this.fKeys=new Array();this.fSeekInfo=0;this.fNbytesInfo=0;this.fTagOffset=0;this.fStreamers=0;this.fStreamerInfos=null;this.fFileName="";this.fStreamers=new Array;if(typeof this.fURL!="string"){return this}if(this.fURL.charAt(this.fURL.length-1)=="+"){this.fURL=this.fURL.substr(0,this.fURL.length-1);this.fAcceptRanges=false}var g=Math.max(this.fURL.lastIndexOf("/"),this.fURL.lastIndexOf("\\"));this.fFileName=g>=0?this.fURL.substr(g+1):this.fURL;if(!this.fAcceptRanges){this.ReadKeys(b)}else{var e=this;var f=a.NewHttpRequest(this.fURL,"head",function(i){if(i==null){return a.CallBack(b,null)}var j=i.getResponseHeader("Accept-Ranges");if(j==null){e.fAcceptRanges=false}var h=i.getResponseHeader("Content-Length");if(h!=null){e.fEND=parseInt(h)}else{e.fAcceptRanges=false}e.ReadKeys(b)});f.send(null)}return this};a.TFile.prototype.ReadBuffer=function(b,i){if((this.fFileContent.length>0)&&(!this.fAcceptRanges||(this.fOffset+b<=this.fFileContent.length))){return i(this.fFileContent.substr(this.fOffset,b))}var e=this;var c=this.fURL;if(this.fUseStampPar){if(c.indexOf("?")>0){c+="&stamp="}else{c+="?stamp="}var h=new Date;c+=h.getTime()}function f(d){if((d==null)&&e.fUseStampPar&&(e.fOffset==0)){e.fUseStampPar=false;var j=a.NewHttpRequest(this.fURL,"bin",f);if(this.fAcceptRanges){j.setRequestHeader("Range","bytes="+this.fOffset+"-"+(this.fOffset+b-1))}j.send(null);return}else{if((d!=null)&&(e.fOffset==0)&&(e.fFileContent.length==0)){e.fFileContent=d;if(!this.fAcceptRanges){e.fEND=d.length;d=e.fFileContent.substr(e.fOffset,b)}}}i(d)}var g=a.NewHttpRequest(c,"bin",f);if(this.fAcceptRanges){g.setRequestHeader("Range","bytes="+this.fOffset+"-"+(this.fOffset+b-1))}g.send(null)};a.TFile.prototype.Seek=function(b,c){switch(c){case this.ERelativeTo.kBeg:this.fOffset=b;break;case this.ERelativeTo.kCur:this.fOffset+=b;break;case this.ERelativeTo.kEnd:if(this.fEND==0){throw"Seek : seeking from end in file with fEND==0 is not supported"}this.fOffset=this.fEND-b;break;default:throw"Seek : unknown seek option ("+c+")";break}};a.TFile.prototype.ReadKey=function(b){var c={};b.ReadTKey(c);return c};a.TFile.prototype.GetDir=function(e,d){if((d==null)&&(typeof e=="string")){var f=e.lastIndexOf(";");if(f>0){d=e.substr(f+1);e=e.substr(0,f)}}for(var c in this.fDirectories){var b=this.fDirectories[c];if(b.dir_name!=e){continue}if((d!=null)&&(b.dir_cycle!=d)){continue}return b}return null};a.TFile.prototype.GetKey=function(f,d,b){for(var e in this.fKeys){if(this.fKeys[e]["fName"]==f&&this.fKeys[e]["fCycle"]==d){a.CallBack(b,this.fKeys[e]);return this.fKeys[e]}}var j=f.lastIndexOf("/");while(j>0){var g=f.substr(0,j);var k=f.substr(j+1);var c=this.GetDir(g);if(c!=null){return c.GetKey(k,d,b)}var h=this.GetKey(g,1);if((h!=null)&&(b!=null)&&(h.fClassName.indexOf("TDirectory")==0)){this.ReadObject(g,function(i){if(i){i.GetKey(k,d,b)}});return null}j=f.lastIndexOf("/",j-1)}a.CallBack(b,null);return null};a.TFile.prototype.ReadObjBuffer=function(c,d){var b=this;this.Seek(c.fSeekKey+c.fKeylen,this.ERelativeTo.kBeg);this.ReadBuffer(c.fNbytes-c.fKeylen,function(h){if(h==null){d(null)}var e=null;if(c.fObjlen<=c.fNbytes-c.fKeylen){e=new a.TBuffer(h,0,b)}else{var f=a.R__unzip_header(h,0);if(f<0){return d(null)}var g=a.R__unzip(f,h,0);e=new a.TBuffer(g,0,b)}e.fTagOffset=c.fKeylen;d(e);delete e})};a.TFile.prototype.ReadObject=function(b,e,d){if(typeof e=="function"){d=e;e=1}var f=b.lastIndexOf(";");if(f>0){e=parseInt(b.slice(f+1));b=b.slice(0,f)}if((typeof e!="number")||(e<0)){e=1}while((b.length>0)&&(b[0]=="/")){b=b.substr(1)}var c=this;this.GetKey(b,e,function(i){if(i==null){return a.CallBack(d,null)}if((b=="StreamerInfo")&&(i.fClassName=="TList")){return c.fStreamerInfos}var g=false;if((i.fClassName=="TDirectory"||i.fClassName=="TDirectoryFile")){g=true;var h=c.GetDir(b,e);if(h!=null){return a.CallBack(d,h)}}c.ReadObjBuffer(i,function(k){if(!k){return a.CallBack(d,null)}if(g){var j=new a.TDirectory(c,b,e);j.StreamHeader(k);if(j.fSeekKeys){j.ReadKeys(d)}else{a.CallBack(d,j)}return}var l={};k.MapObject(1,l);k.ClassStreamer(l,i.fClassName);a.CallBack(d,l)})})};a.TFile.prototype.ExtractStreamerInfos=function(c){if(!c){return}var b={};c.MapObject(1,b);c.ClassStreamer(b,"TList");b._typename="TStreamerInfoList";this.fStreamerInfos=b};a.TFile.prototype.ReadFormulas=function(){for(var b in this.fKeys){if(this.fKeys[b]["fClassName"]=="TFormula"){this.ReadObject(this.fKeys[b]["fName"],this.fKeys[b]["fCycle"],function(c){a.addFormula(c)})}}};a.TFile.prototype.ReadStreamerInfos=function(c){if(this.fSeekInfo==0||this.fNbytesInfo==0){return c(null)}this.Seek(this.fSeekInfo,this.ERelativeTo.kBeg);var b=this;b.ReadBuffer(b.fNbytesInfo,function(f){var d=new a.TBuffer(f,0,b);var e=b.ReadKey(d);if(e==null){return c(null)}b.fKeys.push(e);b.ReadObjBuffer(e,function(g){if(g==null){return c(null)}b.ExtractStreamerInfos(g);b.ReadFormulas();c(b)})})};a.TFile.prototype.ReadKeys=function(b){var c=this;this.ReadBuffer(1024,function(g){if(g==null){return a.CallBack(b,null)}if(g.substring(0,4)!="root"){alert("NOT A ROOT FILE! "+c.fURL);return a.CallBack(b,null)}var e=new a.TBuffer(g,4,c);c.fVersion=e.ntou4();c.fBEGIN=e.ntou4();if(c.fVersion<1000000){c.fEND=e.ntou4();c.fSeekFree=e.ntou4();c.fNbytesFree=e.ntou4();var f=e.ntoi4();c.fNbytesName=e.ntou4();c.fUnits=e.ntou1();c.fCompress=e.ntou4();c.fSeekInfo=e.ntou4();c.fNbytesInfo=e.ntou4()}else{c.fEND=e.ntou8();c.fSeekFree=e.ntou8();c.fNbytesFree=e.ntou4();var f=e.ntou4();c.fNbytesName=e.ntou4();c.fUnits=e.ntou1();c.fCompress=e.ntou4();c.fSeekInfo=e.ntou8();c.fNbytesInfo=e.ntou4()}if(!c.fSeekInfo&&!c.fNbytesInfo){return a.CallBack(b,null)}var d=c.fNbytesName+22;d+=4;d+=4;d+=18;if(c.fVersion>=40000){d+=12}c.Seek(c.fBEGIN,c.ERelativeTo.kBeg);c.ReadBuffer(Math.max(300,d),function(j){if(j==null){return a.CallBack(b,null)}var i=new a.TBuffer(j,c.fNbytesName,c);a.TDirectory.prototype.StreamHeader.call(c,i);i.o=4;var h=i.ntoi2();if(h>1000){i.shift(28)}else{i.shift(20)}i.ReadTString();i.ReadTString();c.fTitle=i.ReadTString();if(c.fNbytesName<10||this.fNbytesName>10000){a.console("Init : cannot read directory info of file "+c.fURL);return a.CallBack(b,null)}if(c.fSeekKeys<=0){a.console("Empty keys list - not supported"+c.fURL);return a.CallBack(b,null)}c.Seek(c.fSeekKeys,c.ERelativeTo.kBeg);c.ReadBuffer(c.fNbytesKeys,function(o){if(o==null){return a.CallBack(b,null)}var m=new a.TBuffer(o,0,c);var l=c.ReadKey(m);var n=m.ntoi4();for(var k=0;kJSROOT version " + JSROOT.version + "

" + + '

Hierarchy in json and xml format

' + + ' Monitoring ' + + ' '; + } else { + + var files = myDiv.attr("files"); + var path = JSROOT.GetUrlOption("path"); + if (path==null) path = myDiv.attr("path"); + if (path==null) path = ""; + + if (files==null) files = "../files/hsimple.root"; + var arrFiles = files.split(';'); + + guiCode += "

Read a ROOT file

" + + "

JSROOT version " + JSROOT.version + "

"; + + if (JSROOT.GetUrlOption("noselect")==null) { + guiCode += '
' + +'' + +'
' + +'

Other file URLs might not work because of same-origin security policy, ' + +'see e.g. developer.mozilla.org on how to avoid it.

' + +'' + +'' + +'
' + +'
'; + } + } + + guiCode += '
' + +'' + +'
' + +'
'; + + var drawDivId = 'right-div'; + + myDiv.empty().append(guiCode); + + var h0 = null; + + if (online) { + if (typeof GetCachedHierarchy == 'function') h0 = GetCachedHierarchy(); + if (typeof h0 != 'object') h0 = ""; + } + + hpainter = new JSROOT.HierarchyPainter('root', 'browser'); + + hpainter.SetDisplay(guiLayout(), drawDivId); + + JSROOT.Painter.ConfigureVSeparator(hpainter); + + // JSROOT.Painter.ConfigureHSeparator(28, true); + + hpainter.StartGUI(h0, function() { + + setGuiLayout(hpainter.GetLayout()); + + // specify display kind every time selection done + // will be actually used only for first drawing or after reset + $("#layout").change(function() { + if (hpainter) hpainter.SetDisplay(guiLayout(), drawDivId); + }); + + if (online) { + if ((hpainter.h!=null) && ('_toptitle' in hpainter.h)) + $("#toptitle").html(hpainter.h._toptitle); + $("#monitoring") + .prop('checked', hpainter.IsMonitoring()) + .click(function() { + hpainter.EnableMonitoring(this.checked); + hpainter.updateAll(!this.checked); + }); + } else { + var fname = ""; + hpainter.ForEachRootFile(function(item) { if (fname=="") fname = item._fullurl; }); + $("#urlToLoad").val(fname); + } + }); + } + + return JSROOT; + +})); + diff --git a/js/scripts/JSRootInterface.min.js b/js/scripts/JSRootInterface.min.js new file mode 100755 index 0000000..efc986c --- /dev/null +++ b/js/scripts/JSRootInterface.min.js @@ -0,0 +1 @@ +(function(a){if(typeof define==="function"&&define.amd){define(["jquery","jquery-ui","d3","JSRootPainter"],a)}else{if(typeof jQuery=="undefined"){var b=new Error("jQuery not defined ");b.source="JSRootPainter.jquery.js";throw b}if(typeof jQuery.ui=="undefined"){var b=new Error("jQuery-ui not defined ");b.source="JSRootPainter.jquery.js";throw b}if(typeof d3!="object"){var b=new Error("This extension requires d3.v3.js");b.source="JSRootPainter.jquery.js";throw b}if(typeof JSROOT=="undefined"){var b=new Error("JSROOT is not defined");b.source="JSRootPainter.jquery.js";throw b}if(typeof JSROOT.Painter!="object"){var b=new Error("JSROOT.Painter not defined");b.source="JSRootPainter.jquery.js";throw b}a(jQuery,jQuery.ui,d3,JSROOT)}}(function(d,e,b,a){var c=null;if(typeof define==="function"&&define.amd){a.loadScript("$$$style/JSRootInterface.css")}ResetUI=function(){if(c){c.clear(true)}};guiLayout=function(){var g="collapsible";var f=document.getElementById("layout");if(f){g=f.options[f.selectedIndex].text}return g};setGuiLayout=function(j){var g=document.getElementById("layout");if(!g){return}for(var f in g.options){var h=g.options[f].text;if(typeof h=="undefined"){continue}if((h==j)||(h.replace(/ /g,"")==j)){g.selectedIndex=f;break}}};ReadFile=function(){var g=navigator.appVersion;if(typeof ActiveXObject=="function"){if((g.indexOf("MSIE 8")!=-1)||(g.indexOf("MSIE 7")!=-1)){alert("You need at least MS Internet Explorer version 9.0. Note you can also use any other web browser");return}}else{if((g.indexOf("Windows NT")==-1)&&(g.indexOf("Safari")!=-1)&&(g.indexOf("Version/5.1.7")!=-1)){alert("There are know issues with Safari 5.1.7 on MacOS X. It may become unresponsive or even hangs. You can use any other web browser");return}}var f=d("#urlToLoad").val();f.trim();if(f.length==0){return}if(c==null){alert("Hierarchy painter not initialized")}if((f.lastIndexOf(".json")==f.length-5)||(f.lastIndexOf(".JSON")==f.length-5)){c.OpenJsonFile(f)}else{c.OpenRootFile(f)}};BuildSimpleGUI=function(){if(a.GetUrlOption("nobrowser")!=null){return a.BuildNobrowserGUI()}var g=d("#simpleGUI");var l=false;if(g.length==0){g=d("#onlineGUI");if(g.length==0){return alert("no div for simple gui found")}l=true}a.Painter.readStyleFromURL();var h="
";if(l){h+="

ROOT online server

JSROOT version "+a.version+'

Hierarchy in json and xml format

Monitoring '}else{var f=g.attr("files");var o=a.GetUrlOption("path");if(o==null){o=g.attr("path")}if(o==null){o=""}if(f==null){f="../files/hsimple.root"}var j=f.split(";");h+="

Read a ROOT file

JSROOT version "+a.version+"

";if(a.GetUrlOption("noselect")==null){h+='

Other file URLs might not work because of same-origin security policy, see e.g. developer.mozilla.org on how to avoid it.


'}}h+='
';var m="right-div";g.empty().append(h);var n=null;if(l){if(typeof GetCachedHierarchy=="function"){n=GetCachedHierarchy()}if(typeof n!="object"){n=""}}c=new a.HierarchyPainter("root","browser");c.SetDisplay(guiLayout(),m);a.Painter.ConfigureVSeparator(c);c.StartGUI(n,function(){setGuiLayout(c.GetLayout());d("#layout").change(function(){if(c){c.SetDisplay(guiLayout(),m)}});if(l){if((c.h!=null)&&("_toptitle" in c.h)){d("#toptitle").html(c.h._toptitle)}d("#monitoring").prop("checked",c.IsMonitoring()).click(function(){c.EnableMonitoring(this.checked);c.updateAll(!this.checked)})}else{var i="";c.ForEachRootFile(function(p){if(i==""){i=p._fullurl}});d("#urlToLoad").val(i)}})};return a})); \ No newline at end of file diff --git a/js/scripts/JSRootPainter.jquery.js b/js/scripts/JSRootPainter.jquery.js new file mode 100755 index 0000000..59627ce --- /dev/null +++ b/js/scripts/JSRootPainter.jquery.js @@ -0,0 +1,983 @@ +/// @file JSRootPainter.jquery.js +/// Part of JavaScript ROOT graphics, dependent from jQuery functionality + +(function( factory ) { + if ( typeof define === "function" && define.amd ) { + // AMD. Register as an anonymous module. + define( ['jquery', 'jquery-ui', 'd3', 'JSRootPainter'], factory ); + } else { + + if (typeof jQuery == 'undefined') { + var e1 = new Error('jQuery not defined '); + e1.source = 'JSRootPainter.jquery.js'; + throw e1; + } + + if (typeof jQuery.ui == 'undefined') { + var e1 = new Error('jQuery-ui not defined '); + e1.source = 'JSRootPainter.jquery.js'; + throw e1; + } + + if (typeof d3 != 'object') { + var e1 = new Error('This extension requires d3.v3.js'); + e1.source = 'JSRootPainter.jquery.js'; + throw e1; + } + + if (typeof JSROOT == 'undefined') { + var e1 = new Error('JSROOT is not defined'); + e1.source = 'JSRootPainter.jquery.js'; + throw e1; + } + + if (typeof JSROOT.Painter != 'object') { + var e1 = new Error('JSROOT.Painter not defined'); + e1.source = 'JSRootPainter.jquery.js'; + throw e1; + } + + // Browser globals + factory(jQuery, jQuery.ui, d3, JSROOT); + } +} (function($, myui, d3, JSROOT) { + + if ( typeof define === "function" && define.amd ) + JSROOT.loadScript('$$$style/jquery-ui.css'); + + JSROOT.Painter.createMenu = function(maincallback, menuname) { + if (!menuname) menuname = "root_ctx_menu"; + + var menu = { divid: menuname, code:"", cnt: 1, funcs : {} }; + + menu.add = function(name, arg, func) { + if (name.indexOf("header:")==0) { + this.code += "
  • "+name.substr(7)+"
  • "; + return; + } + + if (name=="endsub:") { this.code += ""; return; } + var close_tag = ""; + if (name.indexOf("sub:")==0) { name = name.substr(4); close_tag="
      "; } + + if (typeof arg == 'function') { func = arg; arg = name; } + + if ((arg==null) || (typeof arg != 'string')) arg = name; + + // special handling of first versions with menu support + if (($.ui.version.indexOf("1.10")==0) || ($.ui.version.indexOf("1.9")==0)) + name = '' + name + ''; + + this.code += "
    • " + name + close_tag; + if (typeof func == 'function') this.funcs[this.cnt] = func; // keep call-back function + + this.cnt++; + } + + menu.size = function() { return this.cnt-1; } + + menu.addDrawMenu = function(menu_name, opts, call_back) { + if (opts==null) opts = new Array; + if (opts.length==0) opts.push(""); + + this.add((opts.length > 1) ? ("sub:" + menu_name) : menu_name, opts[0], call_back); + if (opts.length<2) return; + + for (var i=0;i' + this.code + '
    '); + + $("#" + menuname) + .css('left', event.clientX + window.pageXOffset) + .css('top', event.clientY + window.pageYOffset) + .attr('class', 'ctxmenu') + .css('font-size', '80%') + .menu({ + items: "> :not(.ui-widget-header)", + select: function( event, ui ) { + var arg = ui.item.attr('arg'); + var cnt = ui.item.attr('cnt'); + var func = cnt ? menu.funcs[cnt] : null; + menu.remove(); + if (typeof func == 'function') func(arg); + } + }); + + var newx = null, newy = null; + + if (event.clientX + $("#" + menuname).width() > $(window).width()) newx = $(window).width() - $("#" + menuname).width() - 20; + if (event.clientY + $("#" + menuname).height() > $(window).height()) newy = $(window).height() - $("#" + menuname).height() - 20; + + if (newx!=null) $("#" + menuname).css('left',(newx>0 ? newx : 0) + window.pageXOffset); + if (newy!=null) $("#" + menuname).css('top',(newy>0 ? newy : 0) + window.pageYOffset); + } + + JSROOT.CallBack(maincallback, menu); + + return menu; + } + + JSROOT.HierarchyPainter.prototype.isLastSibling = function(hitem) { + if (!hitem || !hitem._parent || !hitem._parent._childs) return false; + var chlds = hitem._parent._childs; + var indx = chlds.indexOf(hitem); + if (indx<0) return false; + while (++indx < chlds.length) + if (!('_hidden' in chlds[indx])) return false; + return true; + } + + JSROOT.HierarchyPainter.prototype.addItemHtml = function(hitem, parent) { + var isroot = (parent == null); + var has_childs = '_childs' in hitem; + if (!isroot) hitem._parent = parent; + + if ('_hidden' in hitem) return; + + var handle = JSROOT.getDrawHandle(hitem._kind); + var img1 = "", img2 = ""; + var can_click = false; + if (handle!=null) { + if ('icon' in handle) img1 = handle.icon; + if ('icon2' in handle) img2 = handle.icon2; + if (('func' in handle) || ('execute' in handle) || ('aslink' in handle)) can_click = true; + } + if ('_icon' in hitem) img1 = hitem['_icon']; + if ('_icon2' in hitem) img2 = hitem['_icon2']; + if ((img1.length==0) && ('_online' in hitem)) img1 = "img_globe"; + if ((img1.length==0) && isroot) img1 = "img_base"; + + if ('_more' in hitem) { + can_click = true; + if (img1.length == 0) { + img1 = 'img_folder'; + img2 = 'img_folderopen'; + } + } + + if (img2.length==0) img2 = img1; + if (img1.length==0) img1 = has_childs ? "img_folder" : "img_page"; + if (img2.length==0) img2 = has_childs ? "img_folderopen" : "img_page"; + + hitem['_img1'] = img1; + hitem['_img2'] = img2; + + var itemname = this.itemFullName(hitem); + + this['html'] += '
    '; + + // build indent + var sindent = ""; + var prnt = isroot ? null : hitem._parent; + while ((prnt != null) && (prnt != this.h)) { + sindent = '
    ' + sindent; + prnt = prnt._parent; + } + this['html'] += sindent; + + var icon_class = "", plusminus = false; + + if (isroot) { + // for root node no extra code + } else + if (has_childs) { + icon_class = hitem._isopen ? "img_minus" : "img_plus"; + plusminus = true; + } else { + icon_class = "img_join"; + } + + if (icon_class.length > 0) { + this['html'] += '
    '; + else + this['html'] += ''; + + this['html'] += ''; + + if (has_childs && (isroot || hitem._isopen)) { + this['html'] += '
    '; + for (var i in hitem._childs) + this.addItemHtml(hitem._childs[i], hitem); + this['html'] += '
    '; + } + + this['html'] += '
    '; + } + + JSROOT.HierarchyPainter.prototype.RefreshHtml = function(callback) { + + if (this.frameid == null) return JSROOT.CallBack(callback); + var elem = $("#" + this.frameid); + if ((this.h == null) || (elem.length == 0)) { + elem.html(""); + return JSROOT.CallBack(callback); + } + + var factcmds = [], status_item = null; + this.ForEach(function(item) { + if (('_fastcmd' in item) && (item._kind == 'Command')) factcmds.push(item); + if (('_status' in item) && (status_item==null)) status_item = item; + }); + + this['html'] = ""; + if (factcmds.length>0) { + for (var n in factcmds) + this['html'] += ""; + } + this['html'] += "

    "; + this['html'] += "open all"; + this['html'] += "| close all"; + if ('_online' in this.h) + this['html'] += "| reload"; + else + this['html'] += ""; + + if ('disp_kind' in this) + this['html'] += "| clear"; + else + this['html'] += ""; + + this['html'] += "

    "; + + this['html'] += '
    '; + this.addItemHtml(this.h, null); + this['html'] += '
    '; + + var h = this; + + var items = elem.html(this['html']) + .find(".h_item") + .click(function() { h.tree_click($(this)); }); + + if ('disp_kind' in h) { + if (JSROOT.gStyle.DragAndDrop) + items.draggable({ revert: "invalid", appendTo: "body", helper: "clone" }); + + if (JSROOT.gStyle.ContextMenu) + items.on('contextmenu', function(e) { h.tree_contextmenu($(this), e); }); + } + + elem.find(".plus_minus").click(function() { h.tree_click($(this),true); }); + + elem.find("a").first().click(function() { h.toggle(true); return false; }) + .next().click(function() { h.toggle(false); return false; }) + .next().click(function() { h.reload(); return false; }) + .next().click(function() { h.clear(false); return false; }); + + if (factcmds.length>0) + elem.find('.fast_command').each(function(index) { + if ('_icon' in factcmds[index]) + $(this).text("").append(''); + $(this).button() + .attr("item", h.itemFullName(factcmds[index])) + .attr("title", factcmds[index]._title) + .click(function() { h.ExecuteCommand($(this).attr("item"), $(this)); }); + }); + + if ((status_item!=null) && (JSROOT.GetUrlOption('nostatus')==null)) { + var func = JSROOT.findFunction(status_item._status); + var hdiv = (typeof func == 'function') ? JSROOT.Painter.ConfigureHSeparator(30) : null; + if (hdiv != null) + func(hdiv, this.itemFullName(status_item)); + } + + JSROOT.CallBack(callback); + } + + JSROOT.HierarchyPainter.prototype.UpdateTreeNode = function(node, hitem) { + var has_childs = '_childs' in hitem; + + var newname = hitem._isopen ? hitem._img2 : hitem._img1; + var oldname = hitem._isopen ? hitem._img1 : hitem._img2; + + var img = node.find("a").first().prev(); + + if (newname.indexOf("img_")<0) { + img.attr("src", newname); + } else { + if (newname!=oldname) + img.switchClass(oldname, newname); + } + + img = img.prev(); + + var h = this; + + var new_class = hitem._isopen ? "img_minus" : "img_plus"; + if (this.isLastSibling(hitem)) new_class += "bottom"; + + if (img.hasClass("plus_minus")) { + img.attr('class', new_class + " plus_minus"); + } else + if (has_childs) { + img.attr('class', new_class + " plus_minus"); + img.css('cursor', 'pointer'); + img.click(function() { h.tree_click($(this), true); }); + } + + var childs = node.children().last(); + if (childs.hasClass("h_childs")) childs.remove(); + + var display_childs = has_childs && hitem._isopen; + if (!display_childs) return; + + this['html'] = '
    '; + for (var i in hitem._childs) + this.addItemHtml(hitem._childs[i], hitem); + this['html'] += '
    '; + node.append(this['html']); + childs = node.children().last(); + + var items = childs.find(".h_item") + .click(function() { h.tree_click($(this)); }); + + if ('disp_kind' in h) { + if (JSROOT.gStyle.DragAndDrop) + items.draggable({ revert: "invalid", appendTo: "body", helper: "clone" }); + + if (JSROOT.gStyle.ContextMenu) + items.on('contextmenu', function(e) { h.tree_contextmenu($(this), e); }) + } + + childs.find(".plus_minus").click(function() { h.tree_click($(this), true); }); + } + + JSROOT.HierarchyPainter.prototype.tree_click = function(node, plusminus) { + var itemname = node.parent().attr('item'); + + if (itemname==null) return; + + var hitem = this.Find(itemname); + if (hitem==null) return; + + if (!plusminus) { + + if ('_player' in hitem) + return this.player(itemname); + + var handle = JSROOT.getDrawHandle(hitem._kind); + if (handle!=null) { + if ('aslink' in handle) + return window.open(itemname); + + if ('func' in handle) + return this.display(itemname); + + if ('execute' in handle) + return this.ExecuteCommand(itemname, node); + } + + if ((hitem['_childs'] == null) && ('_more' in hitem)) + return this.expand(itemname, hitem, node.parent()); + + if (!('_childs' in hitem) || (hitem === this.h)) return; + } + + if (hitem._isopen) + delete hitem._isopen; + else + hitem._isopen = true; + + this.UpdateTreeNode(node.parent(), hitem); + } + + JSROOT.HierarchyPainter.prototype.tree_contextmenu = function(node, event) { + event.preventDefault(); + + var itemname = node.parent().attr('item'); + + var hitem = this.Find(itemname); + if (hitem==null) return; + + var painter = this; + + var onlineprop = painter.GetOnlineProp(itemname); + var fileprop = painter.GetFileProp(itemname); + + function qualifyURL(url) { + function escapeHTML(s) { + return s.split('&').join('&').split('<').join('<').split('"').join('"'); + } + var el = document.createElement('div'); + el.innerHTML = '
    x'; + return el.firstChild.href; + } + + JSROOT.Painter.createMenu(function(menu) { + + if (itemname == "") { + var addr = "", cnt = 0; + function separ() { return cnt++ > 0 ? "&" : "?"; } + + var files = []; + painter.ForEachRootFile(function(item) { files.push(item._file.fFullURL); }); + + if (painter.GetTopOnlineItem()==null) + addr = JSROOT.source_dir + "index.htm"; + + if (painter.IsMonitoring()) + addr += separ() + "monitoring=" + painter.MonitoringInterval(); + + if (files.length==1) + addr += separ() + "file=" + files[0]; + else + if (files.length>1) + addr += separ() + "files=" + JSON.stringify(files); + + if (painter['disp_kind']) + addr += separ() + "layout=" + painter['disp_kind'].replace(/ /g, ""); + + var items = []; + + if (painter['disp'] != null) + painter['disp'].ForEachPainter(function(p) { + if (p.GetItemName()!=null) + items.push(p.GetItemName()); + }); + + if (items.length == 1) { + addr += separ() + "item=" + items[0]; + } else if (items.length > 1) { + addr += separ() + "items=" + JSON.stringify(items); + } + + menu.add("Direct link", function() { window.open(addr); }); + menu.add("Only items", function() { window.open(addr + "&nobrowser"); }); + } else + if (onlineprop != null) { + painter.FillOnlineMenu(menu, onlineprop, itemname); + } else + if (fileprop != null) { + var opts = JSROOT.getDrawOptions(hitem._kind, 'nosame'); + + menu.addDrawMenu("Draw", opts, function(arg) { painter.display(itemname, arg); }); + + var filepath = qualifyURL(fileprop.fileurl); + if (filepath.indexOf(JSROOT.source_dir) == 0) + filepath = filepath.slice(JSROOT.source_dir.length); + + menu.addDrawMenu("Draw in new window", opts, function(arg) { + window.open(JSROOT.source_dir + "index.htm?nobrowser&file=" + filepath + "&item=" + fileprop.itemname+"&opt="+arg); + }); + } + + if (menu.size()>0) { + menu['tree_node'] = node; + menu.add("Close"); + menu.show(event); + } + + }); // end menu creation + + return false; + } + + JSROOT.HierarchyPainter.prototype.expand = function(itemname, item0, node) { + var painter = this; + + if (node==null) + node = $("#" + this.frameid).find("[item='" + itemname + "']"); + + if (node.length==0) + return JSROOT.console("Did not found node with item = " + itemname); + + if (item0==null) item0 = this.Find(itemname); + if (item0==null) return; + item0['_doing_expand'] = true; + + this.get(itemname, function(item, obj) { + delete item0['_doing_expand']; + if ((item == null) || (obj == null)) return; + + var curr = item; + while (curr != null) { + if (('_expand' in curr) && (typeof (curr['_expand']) == 'function')) { + if (curr['_expand'](item, obj)) { + var itemname = painter.itemFullName(item); + node.attr('item', itemname); + node.find("a").text(item._name); + item._isopen = true; + painter.UpdateTreeNode(node, item); + } + return; + } + curr = ('_parent' in curr) ? curr['_parent'] : null; + } + }); + } + + JSROOT.HierarchyPainter.prototype.CreateDisplay = function(callback) { + if ('disp' in this) { + if (this['disp'].NumDraw() > 0) return JSROOT.CallBack(callback, this['disp']); + this['disp'].Reset(); + delete this['disp']; + } + + // check that we can found frame where drawing should be done + if (document.getElementById(this['disp_frameid']) == null) + return JSROOT.CallBack(callback, null); + + if (this['disp_kind'] == "tabs") + this['disp'] = new JSROOT.TabsDisplay(this['disp_frameid']); + else + if (this['disp_kind'].search("grid") == 0) + this['disp'] = new JSROOT.GridDisplay(this['disp_frameid'], this['disp_kind']); + else + if (this['disp_kind'] == "simple") + this['disp'] = new JSROOT.SimpleDisplay(this['disp_frameid']); + else + this['disp'] = new JSROOT.CollapsibleDisplay(this['disp_frameid']); + + JSROOT.CallBack(callback, this['disp']); + } + + JSROOT.HierarchyPainter.prototype.enable_dropping = function(frame, itemname) { + var h = this; + if (JSROOT.gStyle.DragAndDrop) + $(frame).droppable({ + hoverClass : "ui-state-active", + accept: function(ui) { + var dropname = ui.parent().attr('item'); + if ((dropname == itemname) || (dropname==null)) return false; + + var ditem = h.Find(dropname); + if ((ditem==null) || (!('_kind' in ditem))) return false; + + return ditem._kind.indexOf("ROOT.")==0; + }, + drop: function(event, ui) { + var dropname = ui.draggable.parent().attr('item'); + if (dropname==null) return false; + return h.dropitem(dropname, $(this).attr("id")); + } + }); + } + + // ================================================== + + JSROOT.CollapsibleDisplay = function(frameid) { + JSROOT.MDIDisplay.call(this, frameid); + this.cnt = 0; // use to count newly created frames + } + + JSROOT.CollapsibleDisplay.prototype = Object.create(JSROOT.MDIDisplay.prototype); + + JSROOT.CollapsibleDisplay.prototype.ForEachFrame = function(userfunc, only_visible) { + var topid = this.frameid + '_collapsible'; + + if (document.getElementById(topid) == null) return; + + if (typeof userfunc != 'function') return; + + $('#' + topid + ' .collapsible_draw').each(function() { + + // check if only visible specified + if (only_visible && $(this).is(":hidden")) return; + + userfunc($(this).get(0)); + }); + } + + JSROOT.CollapsibleDisplay.prototype.ActivateFrame = function(frame) { + if ($(frame).is(":hidden")) { + $(frame).prev().toggleClass("ui-accordion-header-active ui-state-active ui-state-default ui-corner-bottom") + .find("> .ui-icon").toggleClass("ui-icon-triangle-1-e ui-icon-triangle-1-s").end() + .next().toggleClass("ui-accordion-content-active").slideDown(0); + } + $(frame).prev()[0].scrollIntoView(); + } + + JSROOT.CollapsibleDisplay.prototype.CreateFrame = function(title) { + + var topid = this.frameid + '_collapsible'; + + if (document.getElementById(topid) == null) + $("#right-div").append('
    '); + + var hid = topid + "_sub" + this.cnt++; + var uid = hid + "h"; + + var entryInfo = "
    " + title + " 
    \n"; + entryInfo += "
    \n"; + $("#" + topid).append(entryInfo); + + var pthis = this; + + $('#' + uid) + .addClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-top ui-corner-bottom") + .hover(function() { $(this).toggleClass("ui-state-hover"); }) + .prepend('') + .append('') + .click( function() { + $(this).toggleClass("ui-accordion-header-active ui-state-active ui-state-default ui-corner-bottom") + .find("> .ui-icon").toggleClass("ui-icon-triangle-1-e ui-icon-triangle-1-s") + .end().next().toggleClass("ui-accordion-content-active").slideToggle(0); + pthis.CheckResize($(this).next().attr('id')); + return false; + }) + .next() + .addClass("ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom") + .hide(); + + $('#' + uid) + .toggleClass("ui-accordion-header-active ui-state-active ui-state-default ui-corner-bottom") + .find("> .ui-icon").toggleClass("ui-icon-triangle-1-e ui-icon-triangle-1-s").end().next() + .toggleClass("ui-accordion-content-active").slideToggle(0); + + $("#" + hid).prop('title', title); + + return $("#" + hid).get(0); + } + + // ================================================ + + JSROOT.TabsDisplay = function(frameid) { + JSROOT.MDIDisplay.call(this, frameid); + this.cnt = 0; + } + + JSROOT.TabsDisplay.prototype = Object.create(JSROOT.MDIDisplay.prototype); + + JSROOT.TabsDisplay.prototype.ForEachFrame = function(userfunc, only_visible) { + var topid = this.frameid + '_tabs'; + + if (document.getElementById(topid) == null) return; + + if (typeof userfunc != 'function') return; + + var cnt = -1; + var active = $('#' + topid).tabs("option", "active"); + + $('#' + topid + '> .tabs_draw').each(function() { + cnt++; + if (!only_visible || (cnt == active)) + userfunc($(this).get(0)); + }); + } + + JSROOT.TabsDisplay.prototype.ActivateFrame = function(frame) { + var cnt = 0, id = -1; + this.ForEachFrame(function(fr) { + if ($(fr).attr('id') == $(frame).attr('id')) id = cnt; + cnt++; + }); + $('#' + this.frameid + "_tabs").tabs("option", "active", id); + } + + JSROOT.TabsDisplay.prototype.CreateFrame = function(title) { + var topid = this.frameid + '_tabs'; + + var hid = topid + "_sub" + this.cnt++; + + var li = '
  • ' + title + + 'Remove Tab
  • '; + var cont = '
    '; + + var pthis = this; + + if (document.getElementById(topid) == null) { + $("#" + this.frameid).append('
    ' + '
      ' + li + '
    ' + cont + '
    '); + + var tabs = $("#" + topid) + .css('overflow','hidden') + .tabs({ + heightStyle : "fill", + activate : function (event,ui) { + $(ui.newPanel).css('overflow', 'hidden'); + pthis.CheckResize($(ui.newPanel).attr('id')); + } + }); + + tabs.delegate("span.ui-icon-close", "click", function() { + var panelId = $(this).closest("li").remove().attr("aria-controls"); + $("#" + panelId).remove(); + tabs.tabs("refresh"); + }); + } else { + $("#" + topid).find("> .ui-tabs-nav").append(li); + $("#" + topid).append(cont); + $("#" + topid).tabs("refresh"); + $("#" + topid).tabs("option", "active", -1); + } + $('#' + hid) + .empty() + .css('overflow', 'hidden') + .prop('title', title); + + return $('#' + hid).get(0); + } + + // ========== performs tree drawing on server ================== + + JSROOT.TTreePlayer = function(itemname, url) { + JSROOT.TBasePainter.call(this); + this.SetItemName(itemname); + this.url = url; + this.hist_painter = null; + return this; + } + + JSROOT.TTreePlayer.prototype = Object.create( JSROOT.TBasePainter.prototype ); + + JSROOT.TTreePlayer.prototype.Show = function(divid) { + this.drawid = divid + "_draw"; + + $("#" + divid) + .html("
    " + + "" + + " Expr: " + + "" + + "
    " + + "
    "); + + var player = this; + + $("#" + divid).find('.treedraw_exe').click(function() { player.PerformDraw(); }); + $("#" + divid).find('.treedraw_varexp') + .val("px:py") + .keyup(function(e){ + if(e.keyCode == 13) player.PerformDraw(); + }); + + $("#" + divid).find('.treedraw_more').click(function() { + $(this).remove(); + $("#" + divid).find(".treedraw_buttons") + .append(" Cut:"+ + " Opt:"+ + " Num:" + + " First:"); + + $("#" + divid +" .treedraw_opt").val(""); + $("#" + divid +" .treedraw_number").val("").spinner({ numberFormat: "n", min: 0, page: 1000}); + $("#" + divid +" .treedraw_first").val("").spinner({ numberFormat: "n", min: 0, page: 1000}); + }); + + this.CheckResize(); + + this.SetDivId(divid); + } + + JSROOT.TTreePlayer.prototype.PerformDraw = function() { + + var frame = $("#" + this.divid); + + var url = this.url + '/exe.json.gz?compact=3&method=Draw'; + var expr = frame.find('.treedraw_varexp').val(); + var hname = "h_tree_draw"; + + var pos = expr.indexOf(">>"); + if (pos<0) { + expr += ">>" + hname; + } else { + hname = expr.substr(pos+2); + if (hname[0]=='+') hname = hname.substr(1); + var pos2 = hname.indexOf("("); + if (pos2>0) hname = hname.substr(0, pos2); + } + + if (frame.find('.treedraw_more').length==0) { + var cut = frame.find('.treedraw_cut').val(); + var option = frame.find('.treedraw_opt').val(); + var nentries = frame.find('.treedraw_number').val(); + var firstentry = frame.find('.treedraw_first').val(); + + url += '&prototype="const char*,const char*,Option_t*,Long64_t,Long64_t"&varexp="' + expr + '"&selection="' + cut + '"'; + + // if any of optional arguments specified, specify all of them + if ((option!="") || (nentries!="") || (firstentry!="")) { + if (nentries=="") nentries = "1000000000"; + if (firstentry=="") firstentry = "0"; + url += '&option="' + option + '"&nentries=' + nentries + '&firstentry=' + firstentry; + } + } else { + url += '&prototype="Option_t*"&opt="' + expr + '"'; + } + url += '&_ret_object_=' + hname; + + var player = this; + + JSROOT.NewHttpRequest(url, 'object', function(res) { + if (res==null) return; + $("#"+player.drawid).empty(); + player.hist_painter = JSROOT.draw(player.drawid, res) + }).send(); + } + + JSROOT.TTreePlayer.prototype.CheckResize = function(force) { + $("#" + this.drawid).width($("#" + this.divid).width()); + var h = $("#" + this.divid).height(); + var h0 = $("#" + this.divid +" .treedraw_buttons").height(); + if (h>h0+30) $("#" + this.drawid).height(h - 1 - h0); + + if (this.hist_painter) { + this.hist_painter.CheckResize(force); + } + } + + JSROOT.drawTreePlayer = function(hpainter, itemname) { + + var url = hpainter.GetOnlineItemUrl(itemname); + if (url == null) return null; + + var mdi = hpainter.GetDisplay(); + if (mdi == null) return null; + + var frame = mdi.FindFrame(itemname, true); + if (frame==null) return null; + + var divid = d3.select(frame).attr('id'); + + var player = new JSROOT.TTreePlayer(itemname, url); + player.Show(divid); + return player; + } + + // ======================================================================= + + JSROOT.Painter.separ = null; + + JSROOT.Painter.AdjustLayout = function(left, height, firsttime) { + if (this.separ == null) return; + + if (left!=null) { + var wdiff = $("#"+this.separ.left).outerWidth() - $("#"+this.separ.left).width(); + var w = JSROOT.touches ? 10 : 4; + $("#"+this.separ.vertical).css('left', left + "px").width(w).css('top','1px'); + $("#"+this.separ.left).width(left-wdiff-1).css('top','1px'); + $("#"+this.separ.right).css('left',left+w+"px").css('top','1px'); + if (!this.separ.horizontal) { + $("#"+this.separ.vertical).css('bottom', '1px'); + $("#"+this.separ.left).css('bottom', '1px'); + $("#"+this.separ.right).css('bottom', '1px'); + } + } + + if ((height!=null) && this.separ.horizontal) { + var diff = $("#"+this.separ.bottom).outerHeight() - $("#"+this.separ.bottom).height(); + height -= 2*diff; + if (height<5) height = 5; + var bot = height + diff; + $('#'+this.separ.bottom).height(height); + var h = JSROOT.touches ? 10 : 4; + $("#"+this.separ.horizontal).css('bottom', bot + 'px').height(h); + bot += h; + $("#"+this.separ.left).css('bottom', bot + 'px'); + } + + if (this.separ.horizontal) + if (this.separ.hpart) { + var ww = $("#"+this.separ.left).outerWidth() - 2; + $('#'+this.separ.bottom).width(ww); + $("#"+this.separ.horizontal).width(ww); + } else { + var bot = $("#"+this.separ.left).css('bottom'); + $("#"+this.separ.vertical).css('bottom', bot); + $("#"+this.separ.right).css('bottom', bot); + } + + if (firsttime || (this.separ.handle==null)) return; + + if (typeof this.separ.handle == 'function') this.separ.handle(); else + if ((typeof this.separ.handle == 'object') && + (typeof this.separ.handle['CheckResize'] == 'function')) this.separ.handle.CheckResize(); + } + + JSROOT.Painter.ConfigureVSeparator = function(handle) { + + JSROOT.Painter.separ = { handle: handle, left: "left-div", right: "right-div", vertical: "separator-div", + horizontal : null, bottom : null, hpart: true }; + + $("#separator-div").addClass("separator").draggable({ + axis: "x" , zIndex: 100, cursor: "ew-resize", + helper : function() { return $("#separator-div").clone().attr('id','separator-clone').css('background-color','grey'); }, + stop: function(event,ui) { + event.stopPropagation(); + var left = ui.position.left; + $("#separator-clone").remove(); + JSROOT.Painter.AdjustLayout(left, null, false); + } + }); + + var w0 = Math.round($(window).width() * 0.2); + if (w0<300) w0 = Math.min(300, Math.round($(window).width() * 0.5)); + + JSROOT.Painter.AdjustLayout(w0, null, true); + } + + JSROOT.Painter.ConfigureHSeparator = function(height, onlyleft) { + + if ((JSROOT.Painter.separ == null) || + (JSROOT.Painter.separ.horizontal != null)) return null; + + JSROOT.Painter.separ['horizontal'] = 'horizontal-separator-div'; + JSROOT.Painter.separ['bottom'] = 'bottom-div'; + JSROOT.Painter.separ.hpart = (onlyleft === true); + + var prnt = $("#"+this.separ.left).parent(); + + prnt.append('
    '); + prnt.append('
    '); + + $("#horizontal-separator-div").addClass("separator").draggable({ + axis: "y" , zIndex: 100, cursor: "ns-resize", + helper : function() { return $("#horizontal-separator-div").clone().attr('id','horizontal-separator-clone').css('background-color','grey'); }, + stop: function(event,ui) { + event.stopPropagation(); + var top = $(window).height() - ui.position.top; + $('#horizontal-separator-clone').remove(); + JSROOT.Painter.AdjustLayout(null, top, false); + } + }); + + JSROOT.Painter.AdjustLayout(null, height, false); + + return JSROOT.Painter.separ.bottom; + } + + return JSROOT.Painter; + +})); + diff --git a/js/scripts/JSRootPainter.jquery.min.js b/js/scripts/JSRootPainter.jquery.min.js new file mode 100755 index 0000000..18446cc --- /dev/null +++ b/js/scripts/JSRootPainter.jquery.min.js @@ -0,0 +1 @@ +(function(a){if(typeof define==="function"&&define.amd){define(["jquery","jquery-ui","d3","JSRootPainter"],a)}else{if(typeof jQuery=="undefined"){var b=new Error("jQuery not defined ");b.source="JSRootPainter.jquery.js";throw b}if(typeof jQuery.ui=="undefined"){var b=new Error("jQuery-ui not defined ");b.source="JSRootPainter.jquery.js";throw b}if(typeof d3!="object"){var b=new Error("This extension requires d3.v3.js");b.source="JSRootPainter.jquery.js";throw b}if(typeof JSROOT=="undefined"){var b=new Error("JSROOT is not defined");b.source="JSRootPainter.jquery.js";throw b}if(typeof JSROOT.Painter!="object"){var b=new Error("JSROOT.Painter not defined");b.source="JSRootPainter.jquery.js";throw b}a(jQuery,jQuery.ui,d3,JSROOT)}}(function(c,d,b,a){if(typeof define==="function"&&define.amd){a.loadScript("$$$style/jquery-ui.css")}a.Painter.createMenu=function(e,f){if(!f){f="root_ctx_menu"}var g={divid:f,code:"",cnt:1,funcs:{}};g.add=function(i,h,k){if(i.indexOf("header:")==0){this.code+="
  • "+i.substr(7)+"
  • ";return}if(i=="endsub:"){this.code+="";return}var j="";if(i.indexOf("sub:")==0){i=i.substr(4);j="
      "}if(typeof h=="function"){k=h;h=i}if((h==null)||(typeof h!="string")){h=i}if((c.ui.version.indexOf("1.10")==0)||(c.ui.version.indexOf("1.9")==0)){i=''+i+""}this.code+="
    • "+i+j;if(typeof k=="function"){this.funcs[this.cnt]=k}this.cnt++};g.size=function(){return this.cnt-1};g.addDrawMenu=function(m,k,l){if(k==null){k=new Array}if(k.length==0){k.push("")}this.add((k.length>1)?("sub:"+m):m,k[0],l);if(k.length<2){return}for(var j=0;j'+this.code+"
    ");c("#"+f).css("left",h.clientX+window.pageXOffset).css("top",h.clientY+window.pageYOffset).attr("class","ctxmenu").css("font-size","80%").menu({items:"> :not(.ui-widget-header)",select:function(n,o){var k=o.item.attr("arg");var l=o.item.attr("cnt");var m=l?g.funcs[l]:null;g.remove();if(typeof m=="function"){m(k)}}});var j=null,i=null;if(h.clientX+c("#"+f).width()>c(window).width()){j=c(window).width()-c("#"+f).width()-20}if(h.clientY+c("#"+f).height()>c(window).height()){i=c(window).height()-c("#"+f).height()-20}if(j!=null){c("#"+f).css("left",(j>0?j:0)+window.pageXOffset)}if(i!=null){c("#"+f).css("top",(i>0?i:0)+window.pageYOffset)}};a.CallBack(e,g);return g};a.HierarchyPainter.prototype.isLastSibling=function(f){if(!f||!f._parent||!f._parent._childs){return false}var e=f._parent._childs;var g=e.indexOf(f);if(g<0){return false}while(++g';var p="";var h=v?null:u._parent;while((h!=null)&&(h!=this.h)){p='
    '+p;h=h._parent}this["html"]+=p;var e="",g=false;if(v){}else{if(f){e=u._isopen?"img_minus":"img_plus";g=true}else{e="img_join"}}if(e.length>0){this["html"]+='
    '}else{this["html"]+=''}this["html"]+="";if(f&&(v||u._isopen)){this["html"]+='
    ';for(var n in u._childs){this.addItemHtml(u._childs[n],u)}this["html"]+="
    "}this["html"]+="
    "};a.HierarchyPainter.prototype.RefreshHtml=function(m){if(this.frameid==null){return a.CallBack(m)}var g=c("#"+this.frameid);if((this.h==null)||(g.length==0)){g.html("");return a.CallBack(m)}var l=[],e=null;this.ForEach(function(h){if(("_fastcmd" in h)&&(h._kind=="Command")){l.push(h)}if(("_status" in h)&&(e==null)){e=h}});this["html"]="";if(l.length>0){for(var f in l){this["html"]+=""}}this["html"]+="

    ";this["html"]+="open all";this["html"]+="| close all";if("_online" in this.h){this["html"]+="| reload"}else{this["html"]+=""}if("disp_kind" in this){this["html"]+="| clear"}else{this["html"]+=""}this["html"]+="

    ";this["html"]+='
    ';this.addItemHtml(this.h,null);this["html"]+="
    ";var j=this;var k=g.html(this["html"]).find(".h_item").click(function(){j.tree_click(c(this))});if("disp_kind" in j){if(a.gStyle.DragAndDrop){k.draggable({revert:"invalid",appendTo:"body",helper:"clone"})}if(a.gStyle.ContextMenu){k.on("contextmenu",function(h){j.tree_contextmenu(c(this),h)})}}g.find(".plus_minus").click(function(){j.tree_click(c(this),true)});g.find("a").first().click(function(){j.toggle(true);return false}).next().click(function(){j.toggle(false);return false}).next().click(function(){j.reload();return false}).next().click(function(){j.clear(false);return false});if(l.length>0){g.find(".fast_command").each(function(h){if("_icon" in l[h]){c(this).text("").append('')}c(this).button().attr("item",j.itemFullName(l[h])).attr("title",l[h]._title).click(function(){j.ExecuteCommand(c(this).attr("item"),c(this))})})}if((e!=null)&&(a.GetUrlOption("nostatus")==null)){var i=a.findFunction(e._status);var o=(typeof i=="function")?a.Painter.ConfigureHSeparator(30):null;if(o!=null){i(o,this.itemFullName(e))}}a.CallBack(m)};a.HierarchyPainter.prototype.UpdateTreeNode=function(f,r){var e="_childs" in r;var g=r._isopen?r._img2:r._img1;var p=r._isopen?r._img1:r._img2;var l=f.find("a").first().prev();if(g.indexOf("img_")<0){l.attr("src",g)}else{if(g!=p){l.switchClass(p,g)}}l=l.prev();var m=this;var j=r._isopen?"img_minus":"img_plus";if(this.isLastSibling(r)){j+="bottom"}if(l.hasClass("plus_minus")){l.attr("class",j+" plus_minus")}else{if(e){l.attr("class",j+" plus_minus");l.css("cursor","pointer");l.click(function(){m.tree_click(c(this),true)})}}var o=f.children().last();if(o.hasClass("h_childs")){o.remove()}var q=e&&r._isopen;if(!q){return}this["html"]='
    ';for(var k in r._childs){this.addItemHtml(r._childs[k],r)}this["html"]+="
    ";f.append(this["html"]);o=f.children().last();var n=o.find(".h_item").click(function(){m.tree_click(c(this))});if("disp_kind" in m){if(a.gStyle.DragAndDrop){n.draggable({revert:"invalid",appendTo:"body",helper:"clone"})}if(a.gStyle.ContextMenu){n.on("contextmenu",function(h){m.tree_contextmenu(c(this),h)})}}o.find(".plus_minus").click(function(){m.tree_click(c(this),true)})};a.HierarchyPainter.prototype.tree_click=function(f,h){var i=f.parent().attr("item");if(i==null){return}var e=this.Find(i);if(e==null){return}if(!h){if("_player" in e){return this.player(i)}var g=a.getDrawHandle(e._kind);if(g!=null){if("aslink" in g){return window.open(i)}if("func" in g){return this.display(i)}if("execute" in g){return this.ExecuteCommand(i,f)}}if((e._childs==null)&&("_more" in e)){return this.expand(i,e,f.parent())}if(!("_childs" in e)||(e===this.h)){return}}if(e._isopen){delete e._isopen}else{e._isopen=true}this.UpdateTreeNode(f.parent(),e)};a.HierarchyPainter.prototype.tree_contextmenu=function(h,g){g.preventDefault();var l=h.parent().attr("item");var f=this.Find(l);if(f==null){return}var e=this;var k=e.GetOnlineProp(l);var j=e.GetFileProp(l);function i(m){function o(p){return p.split("&").join("&").split("<").join("<").split('"').join(""")}var n=document.createElement("div");n.innerHTML='
    x';return n.firstChild.href}a.Painter.createMenu(function(s){if(l==""){var t="",n=0;function r(){return n++>0?"&":"?"}var p=[];e.ForEachRootFile(function(u){p.push(u._file.fFullURL)});if(e.GetTopOnlineItem()==null){t=a.source_dir+"index.htm"}if(e.IsMonitoring()){t+=r()+"monitoring="+e.MonitoringInterval()}if(p.length==1){t+=r()+"file="+p[0]}else{if(p.length>1){t+=r()+"files="+JSON.stringify(p)}}if(e.disp_kind){t+=r()+"layout="+e.disp_kind.replace(/ /g,"")}var m=[];if(e.disp!=null){e.disp.ForEachPainter(function(u){if(u.GetItemName()!=null){m.push(u.GetItemName())}})}if(m.length==1){t+=r()+"item="+m[0]}else{if(m.length>1){t+=r()+"items="+JSON.stringify(m)}}s.add("Direct link",function(){window.open(t)});s.add("Only items",function(){window.open(t+"&nobrowser")})}else{if(k!=null){e.FillOnlineMenu(s,k,l)}else{if(j!=null){var o=a.getDrawOptions(f._kind,"nosame");s.addDrawMenu("Draw",o,function(u){e.display(l,u)});var q=i(j.fileurl);if(q.indexOf(a.source_dir)==0){q=q.slice(a.source_dir.length)}s.addDrawMenu("Draw in new window",o,function(u){window.open(a.source_dir+"index.htm?nobrowser&file="+q+"&item="+j.itemname+"&opt="+u)})}}}if(s.size()>0){s.tree_node=h;s.add("Close");s.show(g)}});return false};a.HierarchyPainter.prototype.expand=function(h,f,g){var e=this;if(g==null){g=c("#"+this.frameid).find("[item='"+h+"']")}if(g.length==0){return a.console("Did not found node with item = "+h)}if(f==null){f=this.Find(h)}if(f==null){return}f._doing_expand=true;this.get(h,function(i,k){delete f._doing_expand;if((i==null)||(k==null)){return}var j=i;while(j!=null){if(("_expand" in j)&&(typeof(j._expand)=="function")){if(j._expand(i,k)){var l=e.itemFullName(i);g.attr("item",l);g.find("a").text(i._name);i._isopen=true;e.UpdateTreeNode(g,i)}return}j=("_parent" in j)?j._parent:null}})};a.HierarchyPainter.prototype.CreateDisplay=function(e){if("disp" in this){if(this["disp"].NumDraw()>0){return a.CallBack(e,this["disp"])}this["disp"].Reset();delete this["disp"]}if(document.getElementById(this["disp_frameid"])==null){return a.CallBack(e,null)}if(this["disp_kind"]=="tabs"){this["disp"]=new a.TabsDisplay(this["disp_frameid"])}else{if(this["disp_kind"].search("grid")==0){this["disp"]=new a.GridDisplay(this["disp_frameid"],this["disp_kind"])}else{if(this["disp_kind"]=="simple"){this["disp"]=new a.SimpleDisplay(this["disp_frameid"])}else{this["disp"]=new a.CollapsibleDisplay(this["disp_frameid"])}}}a.CallBack(e,this["disp"])};a.HierarchyPainter.prototype.enable_dropping=function(f,g){var e=this;if(a.gStyle.DragAndDrop){c(f).droppable({hoverClass:"ui-state-active",accept:function(j){var i=j.parent().attr("item");if((i==g)||(i==null)){return false}var h=e.Find(i);if((h==null)||(!("_kind" in h))){return false}return h._kind.indexOf("ROOT.")==0},drop:function(i,j){var h=j.draggable.parent().attr("item");if(h==null){return false}return e.dropitem(h,c(this).attr("id"))}})}};a.CollapsibleDisplay=function(e){a.MDIDisplay.call(this,e);this.cnt=0};a.CollapsibleDisplay.prototype=Object.create(a.MDIDisplay.prototype);a.CollapsibleDisplay.prototype.ForEachFrame=function(f,g){var e=this.frameid+"_collapsible";if(document.getElementById(e)==null){return}if(typeof f!="function"){return}c("#"+e+" .collapsible_draw").each(function(){if(g&&c(this).is(":hidden")){return}f(c(this).get(0))})};a.CollapsibleDisplay.prototype.ActivateFrame=function(e){if(c(e).is(":hidden")){c(e).prev().toggleClass("ui-accordion-header-active ui-state-active ui-state-default ui-corner-bottom").find("> .ui-icon").toggleClass("ui-icon-triangle-1-e ui-icon-triangle-1-s").end().next().toggleClass("ui-accordion-content-active").slideDown(0)}c(e).prev()[0].scrollIntoView()};a.CollapsibleDisplay.prototype.CreateFrame=function(j){var h=this.frameid+"_collapsible";if(document.getElementById(h)==null){c("#right-div").append('
    ')}var f=h+"_sub"+this.cnt++;var i=f+"h";var e='
    '+j+" 
    \n";e+="
    \n";c("#"+h).append(e);var g=this;c("#"+i).addClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-top ui-corner-bottom").hover(function(){c(this).toggleClass("ui-state-hover")}).prepend('').append('').click(function(){c(this).toggleClass("ui-accordion-header-active ui-state-active ui-state-default ui-corner-bottom").find("> .ui-icon").toggleClass("ui-icon-triangle-1-e ui-icon-triangle-1-s").end().next().toggleClass("ui-accordion-content-active").slideToggle(0);g.CheckResize(c(this).next().attr("id"));return false}).next().addClass("ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom").hide();c("#"+i).toggleClass("ui-accordion-header-active ui-state-active ui-state-default ui-corner-bottom").find("> .ui-icon").toggleClass("ui-icon-triangle-1-e ui-icon-triangle-1-s").end().next().toggleClass("ui-accordion-content-active").slideToggle(0);c("#"+f).prop("title",j);return c("#"+f).get(0)};a.TabsDisplay=function(e){a.MDIDisplay.call(this,e);this.cnt=0};a.TabsDisplay.prototype=Object.create(a.MDIDisplay.prototype);a.TabsDisplay.prototype.ForEachFrame=function(f,i){var e=this.frameid+"_tabs";if(document.getElementById(e)==null){return}if(typeof f!="function"){return}var g=-1;var h=c("#"+e).tabs("option","active");c("#"+e+"> .tabs_draw").each(function(){g++;if(!i||(g==h)){f(c(this).get(0))}})};a.TabsDisplay.prototype.ActivateFrame=function(f){var e=0,g=-1;this.ForEachFrame(function(h){if(c(h).attr("id")==c(f).attr("id")){g=e}e++});c("#"+this.frameid+"_tabs").tabs("option","active",g)};a.TabsDisplay.prototype.CreateFrame=function(k){var i=this.frameid+"_tabs";var g=i+"_sub"+this.cnt++;var f='
  • '+k+'Remove Tab
  • ';var e='
    ';var h=this;if(document.getElementById(i)==null){c("#"+this.frameid).append('
      '+f+"
    "+e+"
    ");var j=c("#"+i).css("overflow","hidden").tabs({heightStyle:"fill",activate:function(l,m){c(m.newPanel).css("overflow","hidden");h.CheckResize(c(m.newPanel).attr("id"))}});j.delegate("span.ui-icon-close","click",function(){var l=c(this).closest("li").remove().attr("aria-controls");c("#"+l).remove();j.tabs("refresh")})}else{c("#"+i).find("> .ui-tabs-nav").append(f);c("#"+i).append(e);c("#"+i).tabs("refresh");c("#"+i).tabs("option","active",-1)}c("#"+g).empty().css("overflow","hidden").prop("title",k);return c("#"+g).get(0)};a.TTreePlayer=function(f,e){a.TBasePainter.call(this);this.SetItemName(f);this.url=e;this.hist_painter=null;return this};a.TTreePlayer.prototype=Object.create(a.TBasePainter.prototype);a.TTreePlayer.prototype.Show=function(f){this.drawid=f+"_draw";c("#"+f).html("
    Expr:
    ");var e=this;c("#"+f).find(".treedraw_exe").click(function(){e.PerformDraw()});c("#"+f).find(".treedraw_varexp").val("px:py").keyup(function(g){if(g.keyCode==13){e.PerformDraw()}});c("#"+f).find(".treedraw_more").click(function(){c(this).remove();c("#"+f).find(".treedraw_buttons").append(" Cut: Opt: Num: First:");c("#"+f+" .treedraw_opt").val("");c("#"+f+" .treedraw_number").val("").spinner({numberFormat:"n",min:0,page:1000});c("#"+f+" .treedraw_first").val("").spinner({numberFormat:"n",min:0,page:1000})});this.CheckResize();this.SetDivId(f)};a.TTreePlayer.prototype.PerformDraw=function(){var g=c("#"+this.divid);var f=this.url+"/exe.json.gz?compact=3&method=Draw";var n=g.find(".treedraw_varexp").val();var e="h_tree_draw";var k=n.indexOf(">>");if(k<0){n+=">>"+e}else{e=n.substr(k+2);if(e[0]=="+"){e=e.substr(1)}var l=e.indexOf("(");if(l>0){e=e.substr(0,l)}}if(g.find(".treedraw_more").length==0){var m=g.find(".treedraw_cut").val();var h=g.find(".treedraw_opt").val();var j=g.find(".treedraw_number").val();var i=g.find(".treedraw_first").val();f+='&prototype="const char*,const char*,Option_t*,Long64_t,Long64_t"&varexp="'+n+'"&selection="'+m+'"';if((h!="")||(j!="")||(i!="")){if(j==""){j="1000000000"}if(i==""){i="0"}f+='&option="'+h+'"&nentries='+j+"&firstentry="+i}}else{f+='&prototype="Option_t*"&opt="'+n+'"'}f+="&_ret_object_="+e;var o=this;a.NewHttpRequest(f,"object",function(p){if(p==null){return}c("#"+o.drawid).empty();o.hist_painter=a.draw(o.drawid,p)}).send()};a.TTreePlayer.prototype.CheckResize=function(g){c("#"+this.drawid).width(c("#"+this.divid).width());var f=c("#"+this.divid).height();var e=c("#"+this.divid+" .treedraw_buttons").height();if(f>e+30){c("#"+this.drawid).height(f-1-e)}if(this.hist_painter){this.hist_painter.CheckResize(g)}};a.drawTreePlayer=function(g,k){var e=g.GetOnlineItemUrl(k);if(e==null){return null}var j=g.GetDisplay();if(j==null){return null}var h=j.FindFrame(k,true);if(h==null){return null}var i=b.select(h).attr("id");var f=new a.TTreePlayer(k,e);f.Show(i);return f};a.Painter.separ=null;a.Painter.AdjustLayout=function(e,n,k){if(this.separ==null){return}if(e!=null){var g=c("#"+this.separ.left).outerWidth()-c("#"+this.separ.left).width();var m=a.touches?10:4;c("#"+this.separ.vertical).css("left",e+"px").width(m).css("top","1px");c("#"+this.separ.left).width(e-g-1).css("top","1px");c("#"+this.separ.right).css("left",e+m+"px").css("top","1px");if(!this.separ.horizontal){c("#"+this.separ.vertical).css("bottom","1px");c("#"+this.separ.left).css("bottom","1px");c("#"+this.separ.right).css("bottom","1px")}}if((n!=null)&&this.separ.horizontal){var l=c("#"+this.separ.bottom).outerHeight()-c("#"+this.separ.bottom).height();n-=2*l;if(n<5){n=5}var j=n+l;c("#"+this.separ.bottom).height(n);var i=a.touches?10:4;c("#"+this.separ.horizontal).css("bottom",j+"px").height(i);j+=i;c("#"+this.separ.left).css("bottom",j+"px")}if(this.separ.horizontal){if(this.separ.hpart){var f=c("#"+this.separ.left).outerWidth()-2;c("#"+this.separ.bottom).width(f);c("#"+this.separ.horizontal).width(f)}else{var j=c("#"+this.separ.left).css("bottom");c("#"+this.separ.vertical).css("bottom",j);c("#"+this.separ.right).css("bottom",j)}}if(k||(this.separ.handle==null)){return}if(typeof this.separ.handle=="function"){this.separ.handle()}else{if((typeof this.separ.handle=="object")&&(typeof this.separ.handle.CheckResize=="function")){this.separ.handle.CheckResize()}}};a.Painter.ConfigureVSeparator=function(f){a.Painter.separ={handle:f,left:"left-div",right:"right-div",vertical:"separator-div",horizontal:null,bottom:null,hpart:true};c("#separator-div").addClass("separator").draggable({axis:"x",zIndex:100,cursor:"ew-resize",helper:function(){return c("#separator-div").clone().attr("id","separator-clone").css("background-color","grey")},stop:function(g,h){g.stopPropagation();var i=h.position.left;c("#separator-clone").remove();a.Painter.AdjustLayout(i,null,false)}});var e=Math.round(c(window).width()*0.2);if(e<300){e=Math.min(300,Math.round(c(window).width()*0.5))}a.Painter.AdjustLayout(e,null,true)};a.Painter.ConfigureHSeparator=function(e,g){if((a.Painter.separ==null)||(a.Painter.separ.horizontal!=null)){return null}a.Painter.separ.horizontal="horizontal-separator-div";a.Painter.separ.bottom="bottom-div";a.Painter.separ.hpart=(g===true);var f=c("#"+this.separ.left).parent();f.append('
    ');f.append('
    ');c("#horizontal-separator-div").addClass("separator").draggable({axis:"y",zIndex:100,cursor:"ns-resize",helper:function(){return c("#horizontal-separator-div").clone().attr("id","horizontal-separator-clone").css("background-color","grey")},stop:function(h,i){h.stopPropagation();var j=c(window).height()-i.position.top;c("#horizontal-separator-clone").remove();a.Painter.AdjustLayout(null,j,false)}});a.Painter.AdjustLayout(null,e,false);return a.Painter.separ.bottom};return a.Painter})); \ No newline at end of file diff --git a/js/scripts/JSRootPainter.js b/js/scripts/JSRootPainter.js new file mode 100755 index 0000000..3df998c --- /dev/null +++ b/js/scripts/JSRootPainter.js @@ -0,0 +1,9285 @@ +/// @file JSRootPainter.js +/// JavaScript ROOT graphics + +(function( factory ) { + if ( typeof define === "function" && define.amd ) { + // AMD. Register as an anonymous module. + define( ['JSRootCore', 'd3'], factory ); + } else { + + if (typeof JSROOT == 'undefined') { + var e1 = new Error('JSROOT is not defined'); + e1.source = 'JSRootPainter.js'; + throw e1; + } + + if (typeof d3 != 'object') { + var e1 = new Error('d3 is not defined'); + e1.source = 'JSRootPainter.js'; + throw e1; + } + + if (typeof JSROOT.Painter == 'object') { + var e1 = new Error('JSROOT.Painter already defined'); + e1.source = 'JSRootPainter.js'; + throw e1; + } + + factory(JSROOT, d3); + } +} (function(JSROOT, d3) { + + // do it here while require.js does not provide method to load css files + if ( typeof define === "function" && define.amd ) + JSROOT.loadScript('$$$style/JSRootPainter.css'); + + // list of user painters, called with arguments func(vis, obj, opt) + JSROOT.DrawFuncs = {lst:[], cache:{}}; + + // add draw function for the class + // List of supported draw options could be provided, separated with ';' + // Several different draw functions for the same class or kind could be specified + JSROOT.addDrawFunc = function(_name, _func, _opt) { + if ((arguments.length == 1) && (typeof arguments[0] == 'object')) { + JSROOT.DrawFuncs.lst.push(arguments[0]); + return arguments[0]; + } + var handle = { name:_name, func:_func, opt:_opt }; + JSROOT.DrawFuncs.lst.push(handle); + return handle; + } + + JSROOT.gStyle = { + Tooltip : true, // tooltip on/off + ContextMenu : true, + Zooming : true, + MoveResize : true, // enable move and resize of elements like statbox, title, pave, colz + DragAndDrop : true, // enables drag and drop functionality + OptimizeDraw : 1, // drawing optimization: 0 - disabled, 1 - only for large (>5000 bins) histograms, 2 - always + DefaultCol : 1, // default col option 1-svg, 2-canvas + AutoStat : true, + OptStat : 1111, + OptFit : 0, + FrameNDC : { fX1NDC: 0.07, fY1NDC: 0.12, fX2NDC: 0.95, fY2NDC: 0.88 }, + StatNDC : { fX1NDC: 0.78, fY1NDC: 0.75, fX2NDC: 0.98, fY2NDC: 0.91 }, + StatText : { fTextAngle: 0, fTextSize: 9, fTextAlign: 12, fTextColor: 1, fTextFont: 42 }, + StatFill : { fFillColor: 0, fFillStyle: 1001 }, + TimeOffset : 788918400000, // UTC time at 01/01/95 + StatFormat : "6.4g", + FitFormat : "5.4g", + MathJax : 0, // 0 - never, 1 - only for complex cases, 2 - always + Palette : null, // color palette, initialized first time when used, + Interpolate : "basis" // d3.js interpolate methods, used in TGraph and TF1 painters + }; + + /** + * @class JSROOT.Painter Holder of different functions and classes for drawing + */ + JSROOT.Painter = {}; + + /** + * Converts an HSL color value to RGB. Conversion formula adapted from + * http://en.wikipedia.org/wiki/HSL_color_space. Assumes h, s, and l are + * contained in the set [0, 1] and returns r, g, and b in the set [0, 255]. + * + * @param Number + * h The hue + * @param Number + * s The saturation + * @param Number + * l The lightness + * @return Array The RGB representation + */ + JSROOT.Painter.HLStoRGB = function(h, l, s) { + var r, g, b; + if (s < 1e-300) { + r = g = b = l; // achromatic + } else { + function hue2rgb(p, q, t) { + if (t < 0) t += 1; + if (t > 1) t -= 1; + if (t < 1 / 6) return p + (q - p) * 6 * t; + if (t < 1 / 2) return q; + if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6; + return p; + } + var q = l < 0.5 ? l * (1 + s) : l + s - l * s; + var p = 2 * l - q; + r = hue2rgb(p, q, h + 1 / 3); + g = hue2rgb(p, q, h); + b = hue2rgb(p, q, h - 1 / 3); + } + return 'rgb(' + Math.round(r * 255) + ',' + Math.round(g * 255) + ',' + Math.round(b * 255) + ')'; + } + + JSROOT.gStyle.GetColorPalette = function(ncol) { + // return either full palette or only color specified + + if (this.Palette == null) { + this.Palette = []; + var saturation = 1, lightness = 0.5, maxHue = 280, minHue = 0, maxPretty = 50; + for (var i = 0; i < maxPretty; i++) { + var hue = (maxHue - (i + 1) * ((maxHue - minHue) / maxPretty)) / 360.0; + var rgbval = JSROOT.Painter.HLStoRGB(hue, lightness, saturation); + this.Palette.push(rgbval); + } + } + + if (ncol==null) return this.Palette; + + if (ncol<0) return this.Palette[0]; + if (ncol>=this.Palette.length) return this.Palette[this.Palette.length-1]; + return this.Palette[ncol]; + } + + + JSROOT.Painter.createMenu = function(maincallback, menuname) { + // dummy functions, forward call to the jquery function + document.body.style.cursor = 'wait'; + JSROOT.AssertPrerequisites('jq2d', function() { + document.body.style.cursor = 'auto'; + JSROOT.Painter.createMenu(maincallback, menuname); + }); + } + + JSROOT.Painter.closeMenu = function(menuname) { + if (!menuname) menuname = 'root_ctx_menu'; + var x = document.getElementById(menuname); + if (x) x.parentNode.removeChild(x); + } + + JSROOT.Painter.readStyleFromURL = function(url) { + var optimize = JSROOT.GetUrlOption("optimize", url); + if (optimize=="") JSROOT.gStyle.OptimizeDraw = 2; else + if (optimize!=null) { + JSROOT.gStyle.OptimizeDraw = parseInt(optimize); + if (JSROOT.gStyle.OptimizeDraw==NaN) JSROOT.gStyle.OptimizeDraw = 2; + } + + var inter = JSROOT.GetUrlOption("interactive", url); + if ((inter=="") || (inter=="1")) inter = "11111"; else + if (inter=="0") inter = "00000"; + if ((inter!=null) && (inter.length==5)) { + JSROOT.gStyle.Tooltip = (inter.charAt(0) != '0'); + JSROOT.gStyle.ContextMenu = (inter.charAt(1) != '0'); + JSROOT.gStyle.Zooming = (inter.charAt(2) != '0'); + JSROOT.gStyle.MoveResize = (inter.charAt(3) != '0'); + JSROOT.gStyle.DragAndDrop = (inter.charAt(4) != '0'); + } + + var col = JSROOT.GetUrlOption("col", url); + if (col!=null) { + col = parseInt(col); + if ((col!=NaN) && (col>0) && (col<4)) JSROOT.gStyle.DefaultCol = col; + } + + var mathjax = JSROOT.GetUrlOption("mathjax", url); + if ((mathjax!=null) && (mathjax!="0")) JSROOT.MathJax = 1; + + if (JSROOT.GetUrlOption("nomenu", url)!=null) JSROOT.gStyle.ContextMenu = false; + + JSROOT.gStyle.OptStat = JSROOT.GetUrlOption("optstat", url, JSROOT.gStyle.OptStat); + JSROOT.gStyle.OptFit = JSROOT.GetUrlOption("optfit", url, JSROOT.gStyle.OptFit); + JSROOT.gStyle.StatFormat = JSROOT.GetUrlOption("statfmt", url, JSROOT.gStyle.StatFormat); + JSROOT.gStyle.FitFormat = JSROOT.GetUrlOption("fitfmt", url, JSROOT.gStyle.FitFormat); + + var interpolate = JSROOT.GetUrlOption("interpolate", url); + if (interpolate!=null) JSROOT.gStyle.Interpolate = interpolate; + } + + JSROOT.Painter.Coord = { + kCARTESIAN : 1, + kPOLAR : 2, + kCYLINDRICAL : 3, + kSPHERICAL : 4, + kRAPIDITY : 5 + } + + /** Function that generates all root colors */ + JSROOT.Painter.root_colors = function() { + var colorMap = new Array('white', 'black', 'red', 'green', 'blue', + 'rgb(255,255,0)', 'rgb(255,0,255)', 'rgb(0,255,255)', + 'rgb(89, 211,84)', 'rgb(89,84,216)', 'rgb(254,254,254)', + 'rgb(191,181,173)', 'rgb(76,76,76)', 'rgb(102,102,102)', + 'rgb(127,127,127)', 'rgb(153,153,153)', 'rgb(178,178,178)', + 'rgb(204,204,204)', 'rgb(229,229,229)', 'rgb(242,242,242)', + 'rgb(204,198,170)', 'rgb(204,198,170)', 'rgb(193,191,168)', + 'rgb(186,181,163)', 'rgb(178,165,150)', 'rgb(183,163,155)', + 'rgb(173,153,140)', 'rgb(155,142,130)', 'rgb(135,102,86)', + 'rgb(175,206,198)', 'rgb(132,193,163)', 'rgb(137,168,160)', + 'rgb(130,158,140)', 'rgb(173,188,198)', 'rgb(122,142,153)', + 'rgb(117,137,145)', 'rgb(104,130,150)', 'rgb(109,122,132)', + 'rgb(124,153,209)', 'rgb(127,127,155)', 'rgb(170,165,191)', + 'rgb(211,206,135)', 'rgb(221,186,135)', 'rgb(188,158,130)', + 'rgb(198,153,124)', 'rgb(191,130,119)', 'rgb(206,94,96)', + 'rgb(170,142,147)', 'rgb(165,119,122)', 'rgb(147,104,112)', + 'rgb(211,89,84)'); + + var circleColors = [ 632, 416, 600, 400, 616, 432 ]; + + var rectangleColors = [ 800, 820, 840, 860, 880, 900 ]; + + var set1 = [ 255, 204, 204, 255, 153, 153, 204, 153, 153, 255, 102, 102, + 204, 102, 102, 153, 102, 102, 255, 51, 51, 204, 51, 51, 153, 51, + 51, 102, 51, 51, 255, 0, 0, 204, 0, 0, 153, 0, 0, 102, 0, 0, 51, 0, 0 ]; + var set2 = [ 204, 255, 204, 153, 255, 153, 153, 204, 153, 102, 255, 102, + 102, 204, 102, 102, 153, 102, 51, 255, 51, 51, 204, 51, 51, 153, + 51, 51, 102, 51, 0, 255, 0, 0, 204, 0, 0, 153, 0, 0, 102, 0, 0, 51, 0 ]; + var set3 = [ 204, 204, 255, 153, 153, 255, 153, 153, 204, 102, 102, 255, + 102, 102, 204, 102, 102, 153, 51, 51, 255, 51, 51, 204, 51, 51, + 153, 51, 51, 102, 0, 0, 255, 0, 0, 204, 0, 0, 153, 0, 0, 102, 0, 0, 51 ]; + var set4 = [ 255, 255, 204, 255, 255, 153, 204, 204, 153, 255, 255, 102, + 204, 204, 102, 153, 153, 102, 255, 255, 51, 204, 204, 51, 153, 153, + 51, 102, 102, 51, 255, 255, 0, 204, 204, 0, 153, 153, 0, 102, 102, 0, 51, 51, 0 ]; + var set5 = [ 255, 204, 255, 255, 153, 255, 204, 153, 204, 255, 102, 255, + 204, 102, 204, 153, 102, 153, 255, 51, 255, 204, 51, 204, 153, 51, + 153, 102, 51, 102, 255, 0, 255, 204, 0, 204, 153, 0, 153, 102, 0, 102, 51, 0, 51 ]; + var set6 = [ 204, 255, 255, 153, 255, 255, 153, 204, 204, 102, 255, 255, + 102, 204, 204, 102, 153, 153, 51, 255, 255, 51, 204, 204, 51, 153, + 153, 51, 102, 102, 0, 255, 255, 0, 204, 204, 0, 153, 153, 0, 102, 102, 0, 51, 51 ]; + + var circleSets = new Array(set1, set2, set3, set4, set5, set6); + + var set7 = [ 255, 204, 153, 204, 153, 102, 153, 102, 51, 153, 102, 0, + 204, 153, 51, 255, 204, 102, 255, 153, 0, 255, 204, 51, 204, 153, + 0, 255, 204, 0, 255, 153, 51, 204, 102, 0, 102, 51, 0, 153, 51, 0, + 204, 102, 51, 255, 153, 102, 255, 102, 0, 255, 102, 51, 204, 51, 0, + 255, 51, 0 ]; + var set8 = [ 153, 255, 51, 102, 204, 0, 51, 102, 0, 51, 153, 0, 102, 204, + 51, 153, 255, 102, 102, 255, 0, 102, 255, 51, 51, 204, 0, 51, 255, + 0, 204, 255, 153, 153, 204, 102, 102, 153, 51, 102, 153, 0, 153, + 204, 51, 204, 255, 102, 153, 255, 0, 204, 255, 51, 153, 204, 0, + 204, 255, 0 ]; + var set9 = [ 153, 255, 204, 102, 204, 153, 51, 153, 102, 0, 153, 102, 51, + 204, 153, 102, 255, 204, 0, 255, 102, 51, 255, 204, 0, 204, 153, 0, + 255, 204, 51, 255, 153, 0, 204, 102, 0, 102, 51, 0, 153, 51, 51, + 204, 102, 102, 255, 153, 0, 255, 153, 51, 255, 102, 0, 204, 51, 0, + 255, 51 ]; + var set10 = [ 153, 204, 255, 102, 153, 204, 51, 102, 153, 0, 51, 153, 51, + 102, 204, 102, 153, 255, 0, 102, 255, 51, 102, 255, 0, 51, 204, 0, + 51, 255, 51, 153, 255, 0, 102, 204, 0, 51, 102, 0, 102, 153, 51, + 153, 204, 102, 204, 255, 0, 153, 255, 51, 204, 255, 0, 153, 204, 0, + 204, 255 ]; + var set11 = [ 204, 153, 255, 153, 102, 204, 102, 51, 153, 102, 0, 153, + 153, 51, 204, 204, 102, 255, 153, 0, 255, 204, 51, 255, 153, 0, + 204, 204, 0, 255, 153, 51, 255, 102, 0, 204, 51, 0, 102, 51, 0, + 153, 102, 51, 204, 153, 102, 255, 102, 0, 255, 102, 51, 255, 51, 0, + 204, 51, 0, 255 ]; + var set12 = [ 255, 51, 153, 204, 0, 102, 102, 0, 51, 153, 0, 51, 204, 51, + 102, 255, 102, 153, 255, 0, 102, 255, 51, 102, 204, 0, 51, 255, 0, + 51, 255, 153, 204, 204, 102, 153, 153, 51, 102, 153, 0, 102, 204, + 51, 153, 255, 102, 204, 255, 0, 153, 204, 0, 153, 255, 51, 204, + 255, 0, 153 ]; + + var rectSets = new Array(set7, set8, set9, set10, set11, set12); + + for (var i = 0; i < 6; i++) { + for (var j = 0; j < 15; j++) { + var colorn = circleColors[i] + j - 10; + colorMap[colorn] = 'rgb(' + circleSets[i][3 * j] + ',' + circleSets[i][3 * j + 1] + ',' + circleSets[i][3 * j + 2] + ')'; + colorn = rectangleColors[i] + j - 9; + colorMap[colorn] = 'rgb(' + rectSets[i][3 * j] + ',' + rectSets[i][3 * j + 1] + ',' + rectSets[i][3 * j + 2] + ')'; + } + } + return colorMap; + }(); + + JSROOT.Painter.adoptRootColors = function(objarr) { + if (!objarr || !objarr.arr) return; + + for (var n in objarr.arr) { + var col = objarr.arr[n]; + if ((col==null) || (col['_typename'] != 'TColor')) continue; + + var num = col.fNumber; + if ((num<0) || (num>4096)) continue; + + var rgb = "rgb(" + (col.fRed*255).toFixed(0) + "," + (col.fGreen*255).toFixed(0) + "," + (col.fBlue*255).toFixed(0) + ")"; + + if (rgb == 'rgb(255,255,255)') rgb = 'white'; + + while (num>JSROOT.Painter.root_colors.length) + JSROOT.Painter.root_colors.push(rgb); + + if (JSROOT.Painter.root_colors[num] != rgb) { + JSROOT.Painter.root_colors[num] = rgb; + } + } + } + + JSROOT.Painter.root_line_styles = new Array("", "", "3, 3", "1, 2", + "3, 4, 1, 4", "5, 3, 1, 3", "5, 3, 1, 3, 1, 3, 1, 3", "5, 5", + "5, 3, 1, 3, 1, 3", "20, 5", "20, 10, 1, 10", "1, 2"); + + // Initialize ROOT markers + JSROOT.Painter.root_markers = new Array('fcircle', 'fcircle', 'fcross', + 'dcross', 'ocircle', 'gcross', 'fcircle', 'fcircle', 'fcircle', + 'fcircle', 'fcircle', 'fcircle', 'fcircle', 'fcircle', 'fcircle', + 'fcircle', 'fcircle', 'fcircle', 'fcircle', 'fcircle', 'fcircle', + 'fsquare', 'ftriangle-up', 'ftriangle-down', 'ocircle', 'osquare', + 'otriangle-up', 'odiamond', 'ocross', 'fstar', 'ostar', 'dcross', + 'otriangle-down', 'fdiamond', 'fcross'); + + /** Function returns the ready to use marker for drawing */ + JSROOT.Painter.createAttMarker = function(attmarker, style) { + + if (style==null) style = attmarker['fMarkerStyle']; + + var marker_name = JSROOT.Painter.root_markers[style]; + + var info = { shape: 0, toFill: true, toRotate: false }; + + if (typeof (marker_name) != 'undefined') { + switch (marker_name.charAt(0)) { + case 'd': info.shape = 7; break; + case 'o': info.toFill = false; break; + case 'g': info.toRotate = true; break; + } + + switch (marker_name.substr(1)) { + case "circle": info.shape = 0; break; + case "cross": info.shape = 1; break; + case "diamond": info.shape = 2; break; + case "square": info.shape = 3; break; + case "triangle-up": info.shape = 4; break; + case "triangle-down": info.shape = 5; break; + case "star": info.shape = 6; break; + } + } + + var markerSize = attmarker['fMarkerSize']; + + var markerScale = 64; + if (style == 1) markerScale = 1; + + var marker_color = JSROOT.Painter.root_colors[attmarker['fMarkerColor']]; + + var res = { stroke: marker_color, fill: marker_color, marker: "" }; + if (!info.toFill) res['fill'] = 'none'; + + if (info.shape==6) + res['marker'] = "M " + (-4*markerSize) + " " + (-1*markerSize) + + " L " + 4*markerSize + " " + (-1*markerSize) + + " L " + (-2.4*markerSize) + " " + 4*markerSize + + " L 0 " + (-4*markerSize) + + " L " + 2.8*markerSize + " " + 4*markerSize + " z"; + else + if (info.shape==7) + res['marker'] = "M " + (-4*markerSize) + " " + (-4*markerSize) + + " L " + 4*markerSize + " " + 4*markerSize + + " M 0 " + (-4*markerSize) + " 0 " + 4*markerSize + + " M " + 4*markerSize + " " + (-4*markerSize) + + " L " + (-4*markerSize) + " " + 4*markerSize + + " M " + (-4*markerSize) + " 0 L " + 4*markerSize + " 0"; + else + res['marker'] = d3.svg.symbol().type(d3.svg.symbolTypes[info.shape]).size(markerSize * markerScale); + + res.SetMarker = function(selection) { + selection.style("fill", this.fill) + .style("stroke", this.stroke) + .style("pointer-events","visibleFill") // even if not filled, get events + .attr("d", this.marker); + } + res.func = res.SetMarker.bind(res); + + return res; + } + + JSROOT.Painter.createAttLine = function(attline, borderw) { + + var color = 0, _width = 0, style = 0; + + if (attline=='black') { color = 1; _width = 1; } else + if (attline=='none') { _width = 0; } else + if (typeof attline == 'object') { + if ('fLineColor' in attline) color = attline['fLineColor']; + if ('fLineWidth' in attline) _width = attline['fLineWidth']; + if ('fLineStyle' in attline) style = attline['fLineStyle']; + } + if (borderw!=null) _width = borderw; + + var line = { + color: JSROOT.Painter.root_colors[color], + width: _width, + dash: JSROOT.Painter.root_line_styles[style] + }; + + if ((_width==0) || (color==0)) line.color = 'none'; + + line.SetLine = function(selection) { + selection.style('stroke', this.color); + if (this.color!='none') { + selection.style('stroke-width', this.width); + selection.style('stroke-dasharray', this.dash); + } + } + line.func = line.SetLine.bind(line); + + return line; + } + + + JSROOT.Painter.clearCuts = function(chopt) { + /* decode string "chopt" and remove graphical cuts */ + var left = chopt.indexOf('['); + var right = chopt.indexOf(']'); + if ((left>=0) && (right>=0) && (left 0) + y = JSROOT.Math.log10(y); + else + y = pad['fUymin']; + } + return y; + }; + + JSROOT.Painter.chooseTimeFormat = function(range, nticks) { + if (nticks < 1) nticks = 1; + var awidth = range / nticks; + var reasformat = 0; + + // code from TAxis::ChooseTimeFormat + // width in seconds ? + if (awidth >= .5) { + reasformat = 1; + // width in minutes ? + if (awidth >= 30) { + awidth /= 60; reasformat = 2; + // width in hours ? + if (awidth >= 30) { + awidth /= 60; reasformat = 3; + // width in days ? + if (awidth >= 12) { + awidth /= 24; reasformat = 4; + // width in months ? + if (awidth >= 15.218425) { + awidth /= 30.43685; reasformat = 5; + // width in years ? + if (awidth >= 6) { + awidth /= 12; reasformat = 6; + if (awidth >= 2) { + awidth /= 12; reasformat = 7; + } + } + } + } + } + } + } + + switch (reasformat) { + case 0: return "%S"; + case 1: return "%Mm%S"; + case 2: return "%Hh%M"; + case 3: return "%d-%Hh"; + case 4: return "%d/%m"; + case 5: return "%d/%m/%y"; + case 6: return "%d/%m/%y"; + case 7: return "%m/%y"; + } + + return "%Y"; + } + + JSROOT.Painter.getTimeFormat = function(axis) { + var timeFormat = axis['fTimeFormat']; + var idF = timeFormat.indexOf('%F'); + if (idF >= 0) + return timeFormat.substr(0, idF); + return timeFormat; + } + + JSROOT.Painter.getTimeOffset = function(axis) { + var idF = axis['fTimeFormat'].indexOf('%F'); + if (idF < 0) return JSROOT.gStyle['TimeOffset']; + var sof = axis['fTimeFormat'].substr(idF + 2); + if (sof == '1995-01-01 00:00:00s0') return 788918400000; + // special case, used from DABC painters + if ((sof == "0") || (sof == "")) return 0; + + // decode time from ROOT string + var dt = new Date(0); + var pos = sof.indexOf("-"); dt.setFullYear(sof.substr(0,pos)); sof = sof.substr(pos+1); + pos = sof.indexOf("-"); dt.setMonth(parseInt(sof.substr(0,pos))-1); sof = sof.substr(pos+1); + pos = sof.indexOf(" "); dt.setDate(sof.substr(0,pos)); sof = sof.substr(pos+1); + pos = sof.indexOf(":"); dt.setHours(sof.substr(0,pos)); sof = sof.substr(pos+1); + pos = sof.indexOf(":"); dt.setMinutes(sof.substr(0,pos)); sof = sof.substr(pos+1); + pos = sof.indexOf("s"); dt.setSeconds(sof.substr(0,pos)); + if (pos>0) { sof = sof.substr(pos+1); dt.setMilliseconds(sof); } + return dt.getTime(); + } + + JSROOT.Painter.formatExp = function(label) { + var str = label; + if (parseFloat(str) == 1.0) return '1'; + if (parseFloat(str) == 10.0) return '10'; + var str = str.replace('e+', 'x10@'); + var str = str.replace('e-', 'x10@-'); + var _val = str.substring(0, str.indexOf('@')); + var _exp = str.substr(str.indexOf('@')); + _val = _val.replace('@', ''); + _exp = _exp.replace('@', ''); + var u, size = _exp.length; + for (var j = 0; j < size; ++j) { + var u, c = _exp.charAt(j); + if (c == '+') u = '\u207A'; else + if (c == '-') u = '\u207B'; else { + var e = parseInt(c); + if (e == 1) u = String.fromCharCode(0xB9); else + if (e > 1 && e < 4) u = String.fromCharCode(0xB0 + e); else + u = String.fromCharCode(0x2070 + e); + } + _exp = _exp.replace(c, u); + } + _val = _val.replace('1x', ''); + return _val + _exp; + }; + + JSROOT.Painter.translateExp = function(str) { + var lstr = str.match(/\^{[0-9]*}/gi); + if (lstr != null) { + var symbol = ''; + for (var i = 0; i < lstr.length; ++i) { + symbol = lstr[i].replace(' ', ''); + symbol = symbol.replace('^{', ''); // &sup + symbol = symbol.replace('}', ''); // ; + var size = symbol.length; + for (var j = 0; j < size; ++j) { + var c = symbol.charAt(j); + var u, e = parseInt(c); + if (e == 1) u = String.fromCharCode(0xB9); + else if (e > 1 && e < 4) u = String.fromCharCode(0xB0 + e); + else u = String.fromCharCode(0x2070 + e); + symbol = symbol.replace(c, u); + } + str = str.replace(lstr[i], symbol); + } + } + return str; + }; + + JSROOT.Painter.symbols_map = { + // greek letters + '#alpha' : '\u03B1', + '#beta' : '\u03B2', + '#chi' : '\u03C7', + '#delta' : '\u03B4', + '#varepsilon' : '\u03B5', + '#phi' : '\u03C6', + '#gamma' : '\u03B3', + '#eta' : '\u03B7', + '#iota' : '\u03B9', + '#varphi' : '\u03C6', + '#kappa' : '\u03BA', + '#lambda' : '\u03BB', + '#mu' : '\u03BC', + '#nu' : '\u03BD', + '#omicron' : '\u03BF', + '#pi' : '\u03C0', + '#theta' : '\u03B8', + '#rho' : '\u03C1', + '#sigma' : '\u03C3', + '#tau' : '\u03C4', + '#upsilon' : '\u03C5', + '#varomega' : '\u03D6', + '#omega' : '\u03C9', + '#xi' : '\u03BE', + '#psi' : '\u03C8', + '#zeta' : '\u03B6', + '#Alpha' : '\u0391', + '#Beta' : '\u0392', + '#Chi' : '\u03A7', + '#Delta' : '\u0394', + '#Epsilon' : '\u0395', + '#Phi' : '\u03A6', + '#Gamma' : '\u0393', + '#Eta' : '\u0397', + '#Iota' : '\u0399', + '#vartheta' : '\u03D1', + '#Kappa' : '\u039A', + '#Lambda' : '\u039B', + '#Mu' : '\u039C', + '#Nu' : '\u039D', + '#Omicron' : '\u039F', + '#Pi' : '\u03A0', + '#Theta' : '\u0398', + '#Rho' : '\u03A1', + '#Sigma' : '\u03A3', + '#Tau' : '\u03A4', + '#Upsilon' : '\u03A5', + '#varsigma' : '\u03C2', + '#Omega' : '\u03A9', + '#Xi' : '\u039E', + '#Psi' : '\u03A8', + '#Zeta' : '\u0396', + '#varUpsilon' : '\u03D2', + '#epsilon' : '\u03B5', + // math symbols + + '#sqrt' : '\u221A', + + // from TLatex tables #2 & #3 + '#leq' : '\u2264', + '#/' : '\u2044', + '#infty' : '\u221E', + '#voidb' : '\u0192', + '#club' : '\u2663', + '#diamond' : '\u2666', + '#heart' : '\u2665', + '#spade' : '\u2660', + '#leftrightarrow' : '\u2194', + '#leftarrow' : '\u2190', + '#uparrow' : '\u2191', + '#rightarrow' : '\u2192', + '#downarrow' : '\u2193', + '#circ' : '\u02C6', // ^ + '#pm' : '\xB1', + '#doublequote' : '\u2033', + '#geq' : '\u2265', + '#times' : '\xD7', + '#propto' : '\u221D', + '#partial' : '\u2202', + '#bullet' : '\u2022', + '#divide' : '\xF7', + '#neq' : '\u2260', + '#equiv' : '\u2261', + '#approx' : '\u2248', // should be \u2245 ? + '#3dots' : '\u2026', + '#cbar' : '\u007C', + '#topbar' : '\xAF', + '#downleftarrow' : '\u21B5', + '#aleph' : '\u2135', + '#Jgothic' : '\u2111', + '#Rgothic' : '\u211C', + '#voidn' : '\u2118', + '#otimes' : '\u2297', + '#oplus' : '\u2295', + '#oslash' : '\u2205', + '#cap' : '\u2229', + '#cup' : '\u222A', + '#supseteq' : '\u2287', + '#supset' : '\u2283', + '#notsubset' : '\u2284', + '#subseteq' : '\u2286', + '#subset' : '\u2282', + '#int' : '\u222B', + '#in' : '\u2208', + '#notin' : '\u2209', + '#angle' : '\u2220', + '#nabla' : '\u2207', + '#oright' : '\xAE', + '#ocopyright' : '\xA9', + '#trademark' : '\u2122', + '#prod' : '\u220F', + '#surd' : '\u221A', + '#upoint' : '\u22C5', + '#corner' : '\xAC', + '#wedge' : '\u2227', + '#vee' : '\u2228', + '#Leftrightarrow' : '\u21D4', + '#Leftarrow' : '\u21D0', + '#Uparrow' : '\u21D1', + '#Rightarrow' : '\u21D2', + '#Downarrow' : '\u21D3', + '#LT' : '\x3C', + '#void1' : '\xAE', + '#copyright' : '\xA9', + '#void3' : '\u2122', + '#sum' : '\u2211', + '#arctop' : '', + '#lbar' : '', + '#arcbottom' : '', + '#void8' : '', + '#bottombar' : '\u230A', + '#arcbar' : '', + '#ltbar' : '', + '#AA' : '\u212B', + '#aa' : '\u00E5', + '#void06' : '', + '#GT' : '\x3E', + '#forall' : '\u2200', + '#exists' : '\u2203', + '#bar' : '', + '#vec' : '', + '#dot' : '\u22C5', + '#hat' : '\xB7', + '#ddot' : '', + '#acute' : '\acute', + '#grave' : '', + '#check' : '\u2713', + '#tilde' : '\u02DC', + '#slash' : '\u2044', + '#hbar' : '\u0127', + '#box' : '', + '#Box' : '', + '#parallel' : '', + '#perp' : '\u22A5', + '#odot' : '', + '#left' : '', + '#right' : '' + }; + + JSROOT.Painter.translateLaTeX = function(string) { + var str = string; + str = this.translateExp(str); + while (str.indexOf('^{o}') != -1) + str = str.replace('^{o}', '\xBA'); + var lstr = str.match(/\#sqrt{(.*?)}/gi); + if (lstr != null) + for (var i = 0; i < lstr.length; ++i) { + var symbol = lstr[i].replace(' ', ''); + symbol = symbol.replace('#sqrt{', '#sqrt'); + symbol = symbol.replace('}', ''); + str = str.replace(lstr[i], symbol); + } + lstr = str.match(/\_{(.*?)}/gi); + if (lstr != null) + for (var i = 0; i < lstr.length; ++i) { + var symbol = lstr[i].replace(' ', ''); + symbol = symbol.replace('_{', ''); // &sub + symbol = symbol.replace('}', ''); // ; + str = str.replace(lstr[i], symbol); + } + lstr = str.match(/\^{(.*?)}/gi); + if (lstr != null) + for (i = 0; i < lstr.length; ++i) { + var symbol = lstr[i].replace(' ', ''); + symbol = symbol.replace('^{', ''); // &sup + symbol = symbol.replace('}', ''); // ; + str = str.replace(lstr[i], symbol); + } + while (str.indexOf('#/') != -1) + str = str.replace('#/', JSROOT.Painter.symbols_map['#/']); + for ( var x in JSROOT.Painter.symbols_map) { + while (str.indexOf(x) != -1) + str = str.replace(x, JSROOT.Painter.symbols_map[x]); + } + return str; + } + + JSROOT.Painter.isAnyLatex = function(str) { + + return (str.indexOf("#")>=0) || (str.indexOf("\\")>=0) || (str.indexOf("{")>=0); + + //var specials = "\\{}_()#"; + //for (var i=0;i=0) return true; + //} + //return false; + + //for ( var x in JSROOT.Painter.symbols_map) + // if (str.indexOf(x) >= 0) return true; + } + + JSROOT.Painter.translateMath = function(str, kind, color) { + // function translate ROOT TLatex into MathJax format + + if (kind!=2) { + str = str.replace(/#LT/g, "\\langle"); + str = str.replace(/#GT/g, "\\rangle"); + str = str.replace(/#club/g, "\\clubsuit"); + str = str.replace(/#spade/g, "\\spadesuit"); + str = str.replace(/#heart/g, "\\heartsuit"); + str = str.replace(/#diamond/g, "\\diamondsuit"); + str = str.replace(/#voidn/g, "\\wp"); + str = str.replace(/#voidb/g, "f"); + str = str.replace(/#copyright/g, "(c)"); + str = str.replace(/#ocopyright/g, "(c)"); + str = str.replace(/#trademark/g, "TM"); + str = str.replace(/#void3/g, "TM"); + str = str.replace(/#oright/g, "R"); + str = str.replace(/#void1/g, "R"); + str = str.replace(/#3dots/g, "\\ldots"); + str = str.replace(/#lbar/g, "\\mid"); + str = str.replace(/#void8/g, "\\mid"); + str = str.replace(/#divide/g, "\\div"); + str = str.replace(/#Jgothic/g, "\\Im"); + str = str.replace(/#Rgothic/g, "\\Re"); + str = str.replace(/#doublequote/g, "\""); + str = str.replace(/#plus/g, "+"); + + str = str.replace(/#diamond/g, "\\diamondsuit"); + str = str.replace(/#voidn/g, "\\wp"); + str = str.replace(/#voidb/g, "f"); + str = str.replace(/#copyright/g, "(c)"); + str = str.replace(/#ocopyright/g, "(c)"); + str = str.replace(/#trademark/g, "TM"); + str = str.replace(/#void3/g, "TM"); + str = str.replace(/#oright/g, "R"); + str = str.replace(/#void1/g, "R"); + str = str.replace(/#3dots/g, "\\ldots"); + str = str.replace(/#lbar/g, "\\mid"); + str = str.replace(/#void8/g, "\\mid"); + str = str.replace(/#divide/g, "\\div"); + str = str.replace(/#Jgothic/g, "\\Im"); + str = str.replace(/#Rgothic/g, "\\Re"); + str = str.replace(/#doublequote/g, "\""); + str = str.replace(/#plus/g, "+"); + str = str.replace(/#minus/g, "-"); + str = str.replace(/#\//g, "/"); + str = str.replace(/#upoint/g, "."); + str = str.replace(/#aa/g, "\\mathring{a}"); + str = str.replace(/#AA/g, "\\mathring{A}"); + + str = str.replace(/#omicron/g, "o"); + str = str.replace(/#Alpha/g, "A"); + str = str.replace(/#Beta/g, "B"); + str = str.replace(/#Epsilon/g, "E"); + str = str.replace(/#Zeta/g, "Z"); + str = str.replace(/#Eta/g, "H"); + str = str.replace(/#Iota/g, "I"); + str = str.replace(/#Kappa/g, "K"); + str = str.replace(/#Mu/g, "M"); + str = str.replace(/#Nu/g, "N"); + str = str.replace(/#Omicron/g, "O"); + str = str.replace(/#Rho/g, "P"); + str = str.replace(/#Tau/g, "T"); + str = str.replace(/#Chi/g, "X"); + str = str.replace(/#varomega/g, "\\varpi"); + + str = str.replace(/#corner/g, "?"); + str = str.replace(/#ltbar/g, "?"); + str = str.replace(/#bottombar/g, "?"); + str = str.replace(/#notsubset/g, "?"); + str = str.replace(/#arcbottom/g, "?"); + str = str.replace(/#cbar/g, "?"); + str = str.replace(/#arctop/g, "?"); + str = str.replace(/#topbar/g, "?"); + str = str.replace(/#arcbar/g, "?"); + str = str.replace(/#downleftarrow/g, "?"); + str = str.replace(/#splitline/g, "\\genfrac{}{}{0pt}{}"); + + str = str.replace(/#frac/g, "\\frac"); + //str = str.replace(/#left{/g, "\\left\\{"); + //str = str.replace(/#right}/g, "\\right\\}"); + str = str.replace(/#left{/g, "\\lbrace"); + str = str.replace(/#right}/g, "\\rbrace"); + str = str.replace(/#left\[/g, "\\lbrack"); + str = str.replace(/#right\]/g, "\\rbrack"); + //str = str.replace(/#left/g, "\\left"); + //str = str.replace(/#right/g, "\\right"); + // processing of #[] #{} should be done + str = str.replace(/#\[\]{/g, "\\lbrack"); + str = str.replace(/ } /g, "\\rbrack"); + //str = str.replace(/#\[\]/g, "\\brack"); + //str = str.replace(/#{}/g, "\\brace"); + str = str.replace(/#\[/g, "\\lbrack"); + str = str.replace(/#\]/g, "\\rbrack"); + str = str.replace(/#{/g, "\\lbrace"); + str = str.replace(/#}/g, "\\rbrace"); + str = str.replace(/ /g, "\\;"); + + for (var x in JSROOT.Painter.symbols_map) { + var y = "\\" + x.substr(1); + str = str.replace(new RegExp(x,'g'), y); + } + } else { + str = str.replace(/\\\^/g, "\\hat"); + } + + if (typeof color != 'string') return "\\(" + str + "\\)"; + mathcolor = color; + mathcolor = mathcolor.replace(/rgb/g, "[RGB]"); + mathcolor = mathcolor.replace(/\(/g, '{'); + mathcolor = mathcolor.replace(/\)/g, '}'); + return "\\(\\color " + mathcolor + str + "\\)"; + } + + // ============================================================================== + + JSROOT.TBasePainter = function() { + } + + JSROOT.TBasePainter.prototype.Cleanup = function() { + // generic method to cleanup painter + } + + JSROOT.TBasePainter.prototype.DrawingReady = function() { + // function should be called by the painter when first drawing is completed + this['_ready_called_'] = true; + if ('_ready_callback_' in this) { + JSROOT.CallBack(this['_ready_callback_'], this); + delete this['_ready_callback_']; + this['_ready_callback_'] = null; + } + return this; + } + + JSROOT.TBasePainter.prototype.WhenReady = function(callback) { + // call back will be called when painter ready with the drawing + if ('_ready_called_' in this) return JSROOT.CallBack(callback, this); + this['_ready_callback_'] = callback; + } + + JSROOT.TBasePainter.prototype.GetObject = function() { + return null; + } + + JSROOT.TBasePainter.prototype.UpdateObject = function(obj) { + return false; + } + + JSROOT.TBasePainter.prototype.RedrawPad = function(resize) { + } + + JSROOT.TBasePainter.prototype.RedrawObject = function(obj) { + if (this.UpdateObject(obj)) { + var current = document.body.style.cursor; + document.body.style.cursor = 'wait'; + this.RedrawPad(); + document.body.style.cursor = current; + } + } + + JSROOT.TBasePainter.prototype.CheckResize = function(force) { + } + + JSROOT.TBasePainter.prototype.SetDivId = function(divid) { + // base painter does not creates canvas or frames + // it registered in the first child element + + this['divid'] = divid; + + var main = d3.select("#" + divid); + if (main.node() && main.node().firstChild) + main.node().firstChild['painter'] = this; + } + + JSROOT.TBasePainter.prototype.SetItemName = function(name, opt) { + if (name==null) { + delete this['_hitemname']; + } else { + this['_hitemname'] = name; + } + if (opt!=null) this['_hdrawopt'] = opt; + } + + JSROOT.TBasePainter.prototype.GetItemName = function() { + return ('_hitemname' in this) ? this['_hitemname'] : null; + } + + JSROOT.TBasePainter.prototype.GetItemDrawOpt = function() { + return ('_hdrawopt' in this) ? this['_hdrawopt'] : ""; + } + + + // ============================================================================== + + JSROOT.TObjectPainter = function(obj) { + JSROOT.TBasePainter.call(this); + this.obj_typename = (obj!=null) && ('_typename' in obj) ? obj['_typename'] : ""; + this.draw_g = null; // container for all draw objects + this.pad_name = ""; // name of pad where object is drawn + this.main = null; // main painter, received from pad + } + + JSROOT.TObjectPainter.prototype = Object.create(JSROOT.TBasePainter.prototype); + + JSROOT.TObjectPainter.prototype.CheckResize = function(force) { + // no canvas - no resize + var can = this.svg_canvas(); + + var pad_painter = can.empty() ? null : can.property('pad_painter'); + + if (pad_painter) pad_painter.CheckCanvasResize(); + } + + JSROOT.TObjectPainter.prototype.RemoveDrawG = function() { + // generic method to delete all graphical elements, associated with + // painter may not work for all cases + + if (this.draw_g != null) { + this.draw_g.remove(); + this.draw_g = null; + } + } + + JSROOT.TObjectPainter.prototype.RecreateDrawG = function(take_pad, layer, normalg) { + //this.RemoveDrawG(); + + if (this.draw_g) + this.draw_g.selectAll("*").remove(); + + if (take_pad) { + if (layer==null) layer = ".text_layer" + if (!this.draw_g) + this.draw_g = this.svg_pad().select(layer).append("svg:g"); + } else { + var frame = this.svg_frame(); + + var w = frame.attr("width"); + var h = frame.attr("height"); + + if (!this.draw_g) { + if (layer==null) layer = ".main_layer"; + if (normalg) + this.draw_g = frame.select(layer).append("g"); + else + this.draw_g = frame.select(layer).append("svg"); + } + + if (!normalg) + this.draw_g.attr("x", 0) + .attr("y", 0) + .attr("width",w) + .attr("height", h) + .attr("viewBox", "0 0 " + w + " " + h) + .attr('overflow', 'hidden'); + } + } + + /** This is main graphical SVG element, where all Canvas drawing are performed */ + JSROOT.TObjectPainter.prototype.svg_canvas = function() { + return d3.select("#" + this.divid + " .root_canvas"); + } + + /** This is SVG element, correspondent to current pad */ + JSROOT.TObjectPainter.prototype.svg_pad = function() { + var c = this.svg_canvas(); + if ((this.pad_name != '') && !c.empty()) + c = c.select("[pad=" + this.pad_name + ']'); + return c; + } + + JSROOT.TObjectPainter.prototype.root_pad = function() { + var p = this.svg_pad(); + var pad_painter = p.empty() ? null : p.property('pad_painter'); + return pad_painter ? pad_painter.pad : null; + } + + /** This is SVG element with current frame */ + JSROOT.TObjectPainter.prototype.svg_frame = function() { + return this.svg_pad().select(".root_frame"); + } + + JSROOT.TObjectPainter.prototype.pad_width = function() { + var res = parseInt(this.svg_pad().attr("width")); + return (res==NaN) ? 0 : res; + } + + JSROOT.TObjectPainter.prototype.pad_height = function() { + var res = parseInt(this.svg_pad().attr("height")); + return (res==NaN) ? 0 : res; + } + + JSROOT.TObjectPainter.prototype.frame_width = function() { + var res = parseInt(this.svg_frame().attr("width")); + return (res==NaN) ? 0 : res; + } + + JSROOT.TObjectPainter.prototype.frame_height = function() { + var res = parseInt(this.svg_frame().attr("height")); + return (res==NaN) ? 0 : res; + } + + /** Returns main pad painter - normally TH1/TH2 painter, which draws all axis */ + JSROOT.TObjectPainter.prototype.main_painter = function() { + if (!this.main) { + var svg_p = this.svg_pad(); + if (!svg_p.empty()) this.main = svg_p.property('mainpainter'); + } + return this.main; + } + + JSROOT.TObjectPainter.prototype.is_main_painter = function() { + return this == this.main_painter(); + } + + JSROOT.TObjectPainter.prototype.SetDivId = function(divid, is_main) { + // Assigns id of top element (normally
    where drawing is done + // is_main - -1 - not add to painters list, + // 0 - normal painter, + // 1 - major objects like TH1/TH2 + // In some situations canvas may not exists - for instance object drawn as html, not as svg. + // In such case the only painter will be assigned to the first element + + this['divid'] = divid; + + if (is_main == null) is_main = 0; + + this['create_canvas'] = false; + + // SVG element where canvas is drawn + var svg_c = this.svg_canvas(); + + if (svg_c.empty() && (is_main>0)) { + JSROOT.Painter.drawCanvas(divid, null); + svg_c = this.svg_canvas(); + this['create_canvas'] = true; + } + + if (svg_c.empty()) { + if ((is_main < 0) || (this.obj_typename=="TCanvas")) return; + + JSROOT.console("Special case for " + this.obj_typename + " assign painter to first DOM element"); + var main = d3.select("#" + divid); + if (main.node() && main.node().firstChild) + main.node().firstChild['painter'] = this; + return; + } + + // SVG element where current pad is drawn (can be canvas itself) + this.pad_name = svg_c.property('current_pad'); + + if (is_main < 0) return; + + // create TFrame element if not exists when + if ((is_main > 0) && this.svg_frame().empty()) { + JSROOT.Painter.drawFrame(divid, null); + if (this.svg_frame().empty()) return alert("Fail to draw dummy TFrame"); + this['create_canvas'] = true; + } + + var svg_p = this.svg_pad(); + if (svg_p.empty()) return; + + if (svg_p.property('pad_painter') != this) + svg_p.property('pad_painter').painters.push(this); + + if ((is_main > 0) && (svg_p.property('mainpainter')==null)) + // when this is first main painter in the pad + svg_p.property('mainpainter', this); + } + + JSROOT.TObjectPainter.prototype.SetForeignObjectPosition = function(fo, x, y) { + // method used to set absolute coordinates for foreignObject + // it is known problem of WebKit http://bit.ly/1wjqCQ9 + + var sel = fo; + + if (JSROOT.browser.isWebKit) { + // force canvas redraw when foreign object used - it is not correctly scaled + this.svg_canvas().property('redraw_by_resize', true); + while (sel && sel.attr('class') != 'root_canvas') { + if ((sel.attr('class') == 'root_frame') || (sel.attr('class') == 'root_pad')) { + x += parseInt(sel.attr("x")); + y += parseInt(sel.attr("y")); + } + sel = d3.select(sel.node().parentNode); + } + } + + fo.attr("x",x).attr("y",y); + } + + + JSROOT.TObjectPainter.prototype.createAttFill = function(attfill, pattern, color) { + + if ((pattern==null) && attfill) pattern = attfill['fFillStyle']; + if ((color==null) && attfill) color = attfill['fFillColor']; + + var fill = { color: "none" }; + fill.SetFill = function(selection) { + selection.style('fill', this.color); + if ('antialias' in this) + selection.style('antialias', this.antialias); + } + fill.func = fill.SetFill.bind(fill); + + if (typeof attfill == 'string') { + fill.color = attfill; + return fill; + } + + if ((pattern < 1001) || ((pattern >= 4000) && (pattern <= 4100))) return fill; + + fill.color = JSROOT.Painter.root_colors[color]; + if (typeof fill.color != 'string') fill.color = "none"; + + var svg = this.svg_canvas(); + + if ((pattern < 3000) || (pattern>3025) || svg.empty()) return fill; + + var id = "pat_" + pattern + "_" + color; + + fill.color = "url(#" + id + ")"; + fill.antialias = false; + + if (document.getElementById(id) != null) return fill; + + var line_color = JSROOT.Painter.root_colors[color]; + + switch (pattern) { + case 3001: + svg.append('svg:pattern') + .attr("id", id).attr("patternUnits","userSpaceOnUse") + .attr("width", "3px").attr("height", "2px").style("stroke", line_color) + .append('svg:rect') + .attr("x", 0).attr("y", 0).attr("width", 1).attr("height", 1).style("stroke",line_color) + .append('svg:rect') + .attr("x", 2).attr("y", 0).attr("width", 1).attr("height", 1).style("stroke", line_color) + .append('svg:rect') + .attr("x", 1).attr("y", 1).attr("width", 1).attr("height", 1).style("stroke", line_color); + break; + case 3002: + svg.append('svg:pattern') + .attr("id", id).attr("patternUnits", "userSpaceOnUse") + .attr("width", "4px").attr("height", "2px").style("stroke", line_color) + .append('svg:rect') + .attr("x", 1).attr("y", 0).attr("width", 1).attr("height", 1).style("stroke", line_color) + .append('svg:rect') + .attr("x", 3).attr("y", 1).attr("width", 1).attr("height", 1).style("stroke", line_color); + break; + case 3003: + svg.append('svg:pattern') + .attr("id", id).attr("patternUnits", "userSpaceOnUse") + .attr("width", "4px").attr("height", "4px").style("stroke", line_color) + .append('svg:rect') + .attr("x", 2).attr("y", 1).attr("width", 1).attr("height", 1).style("stroke", line_color) + .append('svg:rect') + .attr("x", 0).attr("y", 3).attr("width", 1).attr("height", 1).style("stroke", line_color); + break; + case 3004: + svg.append('svg:pattern') + .attr("id", id).attr("patternUnits", "userSpaceOnUse") + .attr("width", "8px").attr("height", "8px").style("stroke", line_color) + .append("svg:line") + .attr("x1", 8).attr("y1", 0).attr("x2", 0).attr("y2", 8) + .style("stroke",line_color).style("stroke-width", 1); + break; + case 3005: + svg.append('svg:pattern') + .attr("id", id).attr("patternUnits", "userSpaceOnUse") + .attr("width", "8px").attr("height", "8px").style("stroke", line_color) + .append("svg:line") + .attr("x1", 0).attr("y1", 0).attr("x2", 8).attr("y2", 8) + .style("stroke",line_color).style("stroke-width", 1); + break; + case 3006: + svg.append('svg:pattern') + .attr("id", id).attr("patternUnits", "userSpaceOnUse") + .attr("width", "4px").attr("height", "4px").style("stroke", line_color) + .append("svg:line") + .attr("x1", 1).attr("y1", 0).attr("x2", 1).attr("y2", 3) + .style("stroke",line_color).style("stroke-width", 1); + break; + case 3007: + svg.append('svg:pattern') + .attr("id", id).attr("patternUnits","userSpaceOnUse") + .attr("width", "4px").attr("height", "4px").style("stroke", line_color) + .append("svg:line") + .attr("x1", 0).attr("y1", 1).attr("x2", 3).attr("y2", 1) + .style("stroke",line_color).style("stroke-width", 1); + break; + default: /* == 3004 */ + svg.append('svg:pattern') + .attr("id", id).attr("patternUnits","userSpaceOnUse") + .attr("width", "8px").attr("height", "8px").style("stroke", line_color) + .append("svg:line") + .attr("x1", 8).attr("y1", 0).attr("x2", 0).attr("y2", 8) + .style("stroke",line_color).style("stroke-width", 1); + break; + } + + return fill; + } + + + JSROOT.TObjectPainter.prototype.ForEachPainter = function(userfunc) { + // Iterate over all known painters + + var main = d3.select("#" + this.divid); + var painter = (main.node() && main.node().firstChild) ? main.node().firstChild['painter'] : null; + if (painter!=null) { userfunc(painter); return; } + + var svg_c = this.svg_canvas(); + if (svg_c.empty()) return; + + userfunc(svg_c.property('pad_painter')); + var painters = svg_c.property('pad_painter').painters; + for (var k in painters) userfunc(painters[k]); + } + + JSROOT.TObjectPainter.prototype.Cleanup = function() { + // generic method to cleanup painters + d3.select("#" + this.divid).html(""); + } + + JSROOT.TObjectPainter.prototype.RedrawPad = function() { + // call Redraw methods for each painter in the frame + // if selobj specified, painter with selected object will be redrawn + + var pad = this.svg_pad(); + + var pad_painter = pad.empty() ? null : pad.property('pad_painter'); + + if (pad_painter) pad_painter.Redraw(); + } + + JSROOT.TObjectPainter.prototype.AddDrag = function(callback) { + if (!JSROOT.gStyle.MoveResize) return; + + var pthis = this; + + var rect_width = function() { return Number(pthis.draw_g.attr("width")); } + var rect_height = function() { return Number(pthis.draw_g.attr("height")); } + + var acc_x = 0, acc_y = 0, pad_w = 1, pad_h = 1; + + function detectRightButton(event) { + if ('buttons' in event) return event.buttons === 2; + else if ('which' in event) return event.which === 2; + else if ('button' in event) return event.button === 2; + return false; + } + + var resize_rect = + pthis.draw_g.append("rect") + .style("opacity", "0") + .style("cursor", "se-resize") + .attr("x", rect_width() - 20) + .attr("y", rect_height() - 20) + .attr("width", 20) + .attr("height", 20); + + var drag_rect = null; + + var drag_move = d3.behavior.drag().origin(Object) + .on("dragstart", function() { + if (detectRightButton(d3.event.sourceEvent)) return; + + d3.event.sourceEvent.preventDefault(); + acc_x = 0; acc_y = 0; + pad_w = pthis.pad_width() - rect_width(); + pad_h = pthis.pad_height() - rect_height(); + + drag_rect = d3.select(pthis.draw_g.node().parentNode).append("rect") + .classed("zoom", true) + .attr("x", pthis.draw_g.attr("x")) + .attr("y", pthis.draw_g.attr("y")) + .attr("width", rect_width()) + .attr("height", rect_height()) + .style("cursor", "move"); + }).on("drag", function() { + if (drag_rect == null) return; + + d3.event.sourceEvent.preventDefault(); + + var x = Number(drag_rect.attr("x")), y = Number(drag_rect.attr("y")); + var dx = d3.event.dx, dy = d3.event.dy; + + if ((acc_x<0) && (dx>0)) { acc_x+=dx; dx=0; if (acc_x>0) { dx=acc_x; acc_x=0; }} + if ((acc_x>0) && (dx<0)) { acc_x+=dx; dx=0; if (acc_x<0) { dx=acc_x; acc_x=0; }} + if ((acc_y<0) && (dy>0)) { acc_y+=dy; dy=0; if (acc_y>0) { dy=acc_y; acc_y=0; }} + if ((acc_y>0) && (dy<0)) { acc_y+=dy; dy=0; if (acc_y<0) { dy=acc_y; acc_y=0; }} + + if (x+dx<0) { acc_x+=(x+dx); x=0; } else + if (x+dx>pad_w) { acc_x+=(x+dx-pad_w); x=pad_w; } else x+=dx; + + if (y+dy<0) { acc_y+=(y+dy); y = 0; } else + if (y+dy>pad_h) { acc_y+=(y+dy-pad_h); y=pad_h; } else y+=dy; + + drag_rect.attr("x", x).attr("y", y); + + d3.event.sourceEvent.stopPropagation(); + }).on("dragend", function() { + if (drag_rect==null) return; + + d3.event.sourceEvent.preventDefault(); + + drag_rect.style("cursor", "auto"); + + var x = Number(drag_rect.attr("x")), y = Number(drag_rect.attr("y")); + var dx = x - Number(pthis.draw_g.attr("x")), dy = y - Number(pthis.draw_g.attr("y")); + + drag_rect.remove(); + drag_rect = null; + + pthis.draw_g.attr("x", x).attr("y", y) + .attr("transform", "translate(" + x + "," + y + ")"); + + resize_rect.attr("x", rect_width() - 20) + .attr("y", rect_height() - 20); + + if ('move' in callback) callback.move(x, y, dx, dy); + else if ('obj' in callback) { + callback.obj['fX1NDC'] += dx / pthis.pad_width(); + callback.obj['fX2NDC'] += dx / pthis.pad_width(); + callback.obj['fY1NDC'] -= dy / pthis.pad_height(); + callback.obj['fY2NDC'] -= dy / pthis.pad_height(); + } + }); + + var drag_resize = d3.behavior.drag().origin(Object) + .on( "dragstart", function() { + if (detectRightButton(d3.event.sourceEvent)) return; + + d3.event.sourceEvent.stopPropagation(); + d3.event.sourceEvent.preventDefault(); + + acc_x = 0; acc_y = 0; + pad_w = pthis.pad_width() - Number(pthis.draw_g.attr("x")); + pad_h = pthis.pad_height() - Number(pthis.draw_g.attr("y")); + drag_rect = d3.select(pthis.draw_g.node().parentNode).append("rect") + .classed("zoom",true) + .attr("x", pthis.draw_g.attr("x")) + .attr("y", pthis.draw_g.attr("y")) + .attr("width", rect_width()) + .attr("height", rect_height()) + .style("cursor", "se-resize"); + }).on("drag", function() { + if (drag_rect == null) return; + + d3.event.sourceEvent.preventDefault(); + + var w = Number(drag_rect.attr("width")), h = Number(drag_rect.attr("height")); + var dx = d3.event.dx, dy = d3.event.dy; + if ((acc_x<0) && (dx>0)) { acc_x+=dx; dx=0; if (acc_x>0) { dx=acc_x; acc_x=0; }} + if ((acc_x>0) && (dx<0)) { acc_x+=dx; dx=0; if (acc_x<0) { dx=acc_x; acc_x=0; }} + if ((acc_y<0) && (dy>0)) { acc_y+=dy; dy=0; if (acc_y>0) { dy=acc_y; acc_y=0; }} + if ((acc_y>0) && (dy<0)) { acc_y+=dy; dy=0; if (acc_y<0) { dy=acc_y; acc_y=0; }} + if (w+dx>pad_w) { acc_x += (w+dx-pad_w); w=pad_w;} else + if (w+dx<0) { acc_x += (w+dx); w=0;} else w+=dx; + if (h+dy>pad_h) { acc_y += (h+dy-pad_h); h=pad_h; } else + if (h+dy<0) { acc_y += (h+dy); h=0; } else h+=dy; + drag_rect.attr("width", w).attr("height", h); + + d3.event.sourceEvent.stopPropagation(); + }).on( "dragend", function() { + if (drag_rect == null) return; + + d3.event.sourceEvent.preventDefault(); + + drag_rect.style("cursor", "auto"); + + var newwidth = Number(drag_rect.attr("width")); + var newheight = Number(drag_rect.attr("height")); + + pthis.draw_g.attr('width', newwidth).attr('height', newheight); + + drag_rect.remove(); + drag_rect = null; + + resize_rect.attr("x", newwidth - 20) + .attr("y", newheight - 20); + + if ('resize' in callback) callback.resize(newwidth, newheight); else { + if ('obj' in callback) { + callback.obj['fX2NDC'] = callback.obj['fX1NDC'] + newwidth / pthis.pad_width(); + callback.obj['fY1NDC'] = callback.obj['fY2NDC'] - newheight / pthis.pad_height(); + } + if (('redraw' in callback) && + (typeof pthis[callback.redraw] == 'function')) pthis[callback.redraw](); + } + }); + + pthis.draw_g.style("cursor", "move").call(drag_move); + + resize_rect.call(drag_resize); + } + + JSROOT.TObjectPainter.prototype.FindPainterFor = function(selobj,selname) { + // try to find painter for sepcified object + // can be used to find painter for some special objects, registered as + // histogram functions + + var ppp = this.svg_pad(); + var painters = ppp.empty() ? null : ppp.property('pad_painter').painters; + if (painters == null) return null; + + for (var n in painters) { + var pobj = painters[n].GetObject(); + if (pobj==null) continue; + + if (selobj && (pobj === selobj)) return painters[n]; + + if (selname && ('fName' in pobj) && (pobj['fName']==selname)) return painters[n]; + } + + return null; + } + + JSROOT.TObjectPainter.prototype.Redraw = function() { + // basic method, should be reimplemented in all derived objects + // for the case when drawing should be repeated, probably with different + // options + } + + JSROOT.TObjectPainter.prototype.StartTextDrawing = function(font_face, font_size, draw_g) { + // we need to preserve font to be able rescle at the end + + if (!draw_g) draw_g = this.draw_g; + + var font = JSROOT.Painter.getFontDetails(font_face, font_size); + + draw_g.call(font.func); + + draw_g.property('text_font', font); + draw_g.property('mathjax_use', false); + draw_g.property('text_factor', 0.); + draw_g.property('max_text_width', 0); // keep maximal text width, use it later + } + + JSROOT.TObjectPainter.prototype.TextScaleFactor = function(value, draw_g) { + // function used to remember maximal text scaling factor + if (!draw_g) draw_g = this.draw_g; + if (value && (value > draw_g.property('text_factor'))) draw_g.property('text_factor', value); + } + + JSROOT.TObjectPainter.prototype.GetBoundarySizes = function(elem) { + // getBBox does not work in mozilla when object is not displayed or not visisble :( + // getBoundingClientRect() returns wrong sizes for MathJax + // are there good solution? + var box = elem.getBoundingClientRect(); // works always, but returns sometimes wrong results + if (parseInt(box.width) > 0) box = elem.getBBox(); // works only for visisble + return { width : parseInt(box.width), height : parseInt(box.height) }; + } + + JSROOT.TObjectPainter.prototype.FinishTextDrawing = function(draw_g) { + + if (!draw_g) draw_g = this.draw_g; + + var svgs = null; + + if (draw_g.property('mathjax_use')) { + draw_g.property('mathjax_use', false); + draw_g.property('_painter', this); + + var missing = false; + svgs = draw_g.selectAll(".math_svg"); + + svgs.each(function() { + var fo_g = d3.select(this); + if (fo_g.node().parentNode !== draw_g.node()) return; + var entry = fo_g.property('_element'); + if (d3.select(entry).select("svg").empty()) missing = true; + }); + + // is any svg missing we shold wait until drawing is really finished + if (missing) + return JSROOT.AssertPrerequisites('mathjax', { _this:draw_g, func: function() { + if (typeof MathJax != 'object') return; + MathJax.Hub.Queue(["FinishTextDrawing", this.property('_painter'), this]); + }}); + } + + if (svgs==null) svgs = draw_g.selectAll(".math_svg"); + + var painter = this; + + // first remove dummy divs and check scaling coefficient + svgs.each(function() { + var fo_g = d3.select(this); + if (fo_g.node().parentNode !== draw_g.node()) return; + var entry = fo_g.property('_element'); fo_g.property('_element', null); + + var vvv = d3.select(entry).select("svg"); + if (vvv.empty()) { + JSROOT.console('MathJax SVG ouptut error'); + return; + } + + vvv.remove(); + document.body.removeChild(entry); + + fo_g.append(function() { return vvv.node(); }); + + if (fo_g.property('_scale')) { + var box = painter.GetBoundarySizes(fo_g.node()); + painter.TextScaleFactor(1.* box.width / parseInt(fo_g.attr('width')), draw_g); + painter.TextScaleFactor(1.* box.height / parseInt(fo_g.attr('height')), draw_g); + } + }); + + // adjust font size + var f = draw_g.property('text_factor'); + var font = draw_g.property('text_font'); + if ((f>0) && ((f<0.9) || (f>1.))) { + font.size = Math.floor(font.size/f); + draw_g.call(font.func); + } + + svgs.each(function() { + var fo_g = d3.select(this); + // only direct parent + if (fo_g.node().parentNode !== draw_g.node()) return; + var box = painter.GetBoundarySizes(fo_g.node()); + var align = fo_g.property('_align'); + var rotate = fo_g.property('_rotate'); + var fo_w = parseInt(fo_g.attr('width')), fo_h = parseInt(fo_g.attr('height')); + var fo_x = parseInt(fo_g.attr('x')), fo_y = parseInt(fo_g.attr('y')); + + if (fo_g.property('_scale')) { + if (align[0] == 'middle') fo_x += (fo_w - box.width)/2; else + if (align[0] == 'end') fo_x += (fo_w - box.width); + if (align[1] == 'middle') fo_y += (fo_h - box.height)/2; else + if (align[1] == 'top' && !rotate) fo_y += (fo_h - box.height); else + if (align[1] == 'bottom' && rotate) fo_y += (fo_h - box.height); + } else { + if (align[0] == 'middle') fo_x -= box.width/2; else + if (align[0] == 'end') fo_x -= box.width; + if (align[1] == 'middle') fo_y -= box.height/2; else + if (align[1] == 'bottom' && !rotate) fo_y -= box.height; else + if (align[1] == 'top' && rotate) fo_y -= box.height; + } + + fo_g.attr('x', fo_x).attr('y', fo_y) // use x/y while transform used for rotation + .attr('width', box.width+10).attr('height', box.height+10) // width and height required by Chrome + .attr('visibility', null); + }); + + // now hidden text after rescaling can be shown + draw_g.selectAll('.hidden_text').attr('opacity', '1').classed('hidden_text',false); + + return draw_g.property('max_text_width'); + } + + JSROOT.TObjectPainter.prototype.DrawText = function(align_arg, x, y, w, h, label, tcolor, latex_kind, draw_g) { + if (!draw_g) draw_g = this.draw_g; + var align; + + if (typeof align_arg == 'string') { + align = align_arg.split(";"); + if (align.length==1) align.push('middle'); + } else { + align = ['start', 'middle']; + if ((align_arg / 10) >= 3) align[0] = 'end'; else + if ((align_arg / 10) >= 2) align[0] = 'middle'; + if ((align_arg % 10) == 0) align[1] = 'bottom'; else + if ((align_arg % 10) == 1) align[1] = 'bottom'; else + if ((align_arg % 10) == 3) align[1] = 'top'; + } + + var scale = (w>0) && (h>0); + + if (latex_kind==null) latex_kind = 1; + if (latex_kind<2) + if (!JSROOT.Painter.isAnyLatex(label)) latex_kind = 0; + + var use_normal_text = ((JSROOT.MathJax<1) && (latex_kind!=2)) || (latex_kind<1); + + // only Firefox can correctly rotate incapsulated SVG, produced by MathJax + if (!use_normal_text && (h<0) && !JSROOT.browser.isFirefox) use_normal_text = true; + + if (use_normal_text) { + if (latex_kind>0) label = JSROOT.Painter.translateLaTeX(label); + + var pos_x = x.toFixed(1), pos_y = y.toFixed(1), pos_dy = null, middleline = false; + + if (w>0) { + // adjust x position when scale into specified rectangle + if (align[0]=="middle") pos_x = (x+w*0.5).toFixed(1); else + if (align[0]=="end") pos_x = (x+w).toFixed(1); + } + + if (h>0) { + if (align[1] == 'bottom') pos_y = (y + h).toFixed(1); else + if (align[1] == 'top') pos_dy = ".8em"; else { + pos_y = (y + h/2).toFixed(1); + if (JSROOT.browser.isIE) pos_dy = ".4em"; else middleline = true; + } + } else + if (h==0) { + if (align[1] == 'top') pos_dy = ".8em"; else + if (align[1] == 'middle') { + if (JSROOT.browser.isIE) pos_dy = ".4em"; else middleline = true; + } + } + + var txt = draw_g.append("text") + .attr("text-anchor", align[0]) + .attr("x", pos_x) + .attr("y", pos_y) + .attr("fill", tcolor ? tcolor : null) + .text(label); + if (pos_dy!=null) txt.attr("dy", pos_dy); + if (middleline) txt.attr("dominant-baseline", "middle"); + if ((!scale) && (h==-270)) txt.attr("transform", "rotate(270, 0, 0)"); + + var box = this.GetBoundarySizes(txt.node()); + + if (scale) txt.classed('hidden_text',true).attr('opacity','0'); // hide rescale elements + + if (box.width > draw_g.property('max_text_width')) draw_g.property('max_text_width', box.width); + if ((w>0) && scale) this.TextScaleFactor(1.*box.width / w, draw_g); + if ((h>0) && scale) this.TextScaleFactor(1.*box.height / h, draw_g); + + return box.width; + } + + w = Math.round(w); h = Math.round(h); + x = Math.round(x); y = Math.round(y); + + var rotate = false; + + if (!scale) { + if (h==-270) rotate = true; + w = this.pad_width(); h = this.pad_height(); // artifical values, big enough to see output + // w = 5; h = 5; + } + + var fo_g = draw_g.append("svg") + .attr('x',x).attr('y',y) // set x,y, width,height attribute to be able apply alignment later + .attr('width',w).attr('height',h) + .attr('class', 'math_svg') + .attr('visibility','hidden') + .property('_scale', scale) + .property('_rotate', rotate) + .property('_align', align); + + if (rotate) fo_g.attr("transform", "rotate(270, 0, 0)"); + + var element = document.createElement("div"); + d3.select(element).style("visibility", "hidden") + .style("overflow", "hidden") + .style("position", "absolute") + .html(JSROOT.Painter.translateMath(label, latex_kind, tcolor)); + document.body.appendChild(element) + + draw_g.property('mathjax_use', true); // one need to know that mathjax is used + fo_g.property('_element', element); + + JSROOT.AssertPrerequisites('mathjax', { _this:element, func: function() { + if (typeof MathJax == 'object') + MathJax.Hub.Queue(["Typeset", MathJax.Hub, this]); + }}); + + return 0; + } + + // =========================================================== + + JSROOT.TFramePainter = function(tframe) { + JSROOT.TObjectPainter.call(this, tframe); + this.tframe = tframe; + } + + JSROOT.TFramePainter.prototype = Object.create(JSROOT.TObjectPainter.prototype); + + JSROOT.TFramePainter.prototype.GetObject = function() { + return this.tframe; + } + + JSROOT.TFramePainter.prototype.Shrink = function(shrink_left, shrink_right) { + var ndc = this.svg_frame().property('NDC'); + if (ndc) { + ndc.fX1NDC += shrink_left; + ndc.fX2NDC -= shrink_right; + } + } + + JSROOT.TFramePainter.prototype.DrawFrameSvg = function() { + var width = this.pad_width(), height = this.pad_height(); + var w = width, h = height; + + var ndc = this.svg_frame().empty() ? null : this.svg_frame().property('NDC'); + if (ndc == null) ndc = JSROOT.clone(JSROOT.gStyle.FrameNDC); + + var root_pad = this.root_pad(); + + var lm = width * ndc.fX1NDC; + var rm = width * (1 - ndc.fX2NDC); + var tm = height * ndc.fY1NDC; + var bm = height * (1 - ndc.fY2NDC); + + var framecolor = this.createAttFill('white'), + lineatt = JSROOT.Painter.createAttLine('black'), + bordermode = 0, bordersize = 0; + + if (this.tframe) { + bordermode = this.tframe['fBorderMode']; + bordersize = this.tframe['fBorderSize']; + lineatt = JSROOT.Painter.createAttLine(this.tframe); + if (root_pad) { + var xspan = width / Math.abs(root_pad['fX2'] - root_pad['fX1']); + var yspan = height / Math.abs(root_pad['fY2'] - root_pad['fY1']); + var px1 = (this.tframe['fX1'] - root_pad['fX1']) * xspan; + var py1 = (this.tframe['fY1'] - root_pad['fY1']) * yspan; + var px2 = (this.tframe['fX2'] - root_pad['fX1']) * xspan; + var py2 = (this.tframe['fY2'] - root_pad['fY1']) * yspan; + var pxl, pxt, pyl, pyt; + if (px1 < px2) { pxl = px1; pxt = px2; } + else { pxl = px2; pxt = px1; } + if (py1 < py2) { pyl = py1; pyt = py2; } + else { pyl = py2; pyt = py1; } + lm = pxl; + bm = pyl; + w = pxt - pxl; + h = pyt - pyl; + tm = height - pyt; + rm = width - pxt; + } else { + lm = this.tframe['fX1'] * width; + tm = this.tframe['fY1'] * height; + bm = (1.0 - this.tframe['fY2']) * height; + rm = (1.0 - this.tframe['fX2'] + shrink_right) * width; + w -= (lm + rm); + h -= (tm + bm); + } + framecolor = this.createAttFill(this.tframe); + } else { + if (root_pad) { + framecolor = this.createAttFill(null, root_pad['fFrameFillStyle'], root_pad['fFrameFillColor']); + } + w -= (lm + rm); + h -= (tm + bm); + } + + // force white color for the frame + if (framecolor.color == 'none') framecolor.color = 'white'; + + // this is svg:g object - container for every other items belonging to frame + var frame_g = this.svg_pad().select(".root_frame"); + + var top_rect = null; + + if (frame_g.empty()) { + frame_g = this.svg_pad().select(".frame_layer").append("svg:g").attr("class", "root_frame"); + + top_rect = frame_g.append("svg:rect"); + + // append for the moment three layers - for drawing and axis + frame_g.append('svg:g').attr('class','grid_layer'); + frame_g.append('svg:g').attr('class','main_layer'); + frame_g.append('svg:g').attr('class','axis_layer'); + frame_g.append('svg:g').attr('class','upper_layer'); + } else { + top_rect = frame_g.select("rect"); + } + + // calculate actual NDC coordinates, use them to properly locate PALETTE + frame_g.property('NDC', { + fX1NDC : lm / width, + fX2NDC : (lm + w) / width, + fY1NDC : tm / height, + fY2NDC : (tm + h) / height + }); + + // simple workaround to access painter via frame container + frame_g.property('frame_painter', this); + + lm = Math.round(lm); tm = Math.round(tm); + w = Math.round(w); h = Math.round(h); + + frame_g.attr("x", lm) + .attr("y", tm) + .attr("width", w) + .attr("height", h) + .attr("transform", "translate(" + lm + "," + tm + ")"); + + top_rect.attr("x", 0) + .attr("y", 0) + .attr("width", w) + .attr("height", h) + .call(framecolor.func) + .call(lineatt.func); + } + + JSROOT.TFramePainter.prototype.Redraw = function() { + this.DrawFrameSvg(); + } + + JSROOT.Painter.drawFrame = function(divid, obj) { + var p = new JSROOT.TFramePainter(obj); + p.SetDivId(divid); + p.DrawFrameSvg(); + return p.DrawingReady(); + } + + // ========================================================================= + + JSROOT.TF1Painter = function(tf1) { + JSROOT.TObjectPainter.call(this, tf1); + this.tf1 = tf1; + } + + JSROOT.TF1Painter.prototype = Object.create(JSROOT.TObjectPainter.prototype); + + JSROOT.TF1Painter.prototype.GetObject = function() { + return this.tf1; + } + + JSROOT.TF1Painter.prototype.Redraw = function() { + this.DrawBins(); + } + + JSROOT.TF1Painter.prototype.Eval = function(x) { + return this.tf1.evalPar(x); + } + + JSROOT.TF1Painter.prototype.CreateDummyHisto = function() { + var xmin = 0, xmax = 0, ymin = 0, ymax = 0; + if (this.tf1['fSave'].length > 0) { + // in the case where the points have been saved, useful for example + // if we don't have the user's function + var nb_points = this.tf1['fNpx']; + for (var i = 0; i < nb_points; ++i) { + var h = this.tf1['fSave'][i]; + if ((i == 0) || (h > ymax)) + ymax = h; + if ((i == 0) || (h < ymin)) + ymin = h; + } + xmin = this.tf1['fSave'][nb_points + 1]; + xmax = this.tf1['fSave'][nb_points + 2]; + } else { + // we don't have the points, so let's try to interpret the function + // use fNpfits instead of fNpx if possible (to use more points) + if (this.tf1['fNpfits'] <= 103) + this.tf1['fNpfits'] = 103; + xmin = this.tf1['fXmin']; + xmax = this.tf1['fXmax']; + + var nb_points = Math.max(this.tf1['fNpx'], this.tf1['fNpfits']); + + var binwidthx = (xmax - xmin) / nb_points; + var left = -1, right = -1; + for (var i = 0; i < nb_points; ++i) { + var h = this.Eval(xmin + (i * binwidthx)); + if (isNaN(h)) continue; + + if (left < 0) { + left = i; + ymax = h; + ymin = h; + } + if ((right < 0) || (right == i - 1)) + right = i; + + if (h > ymax) + ymax = h; + if (h < ymin) + ymin = h; + } + + if (left < right) { + xmax = xmin + right * binwidthx; + xmin = xmin + left * binwidthx; + } + } + + if (ymax > 0.0) ymax *= 1.05; + if (ymin < 0.0) ymin *= 1.05; + + var histo = JSROOT.Create("TH1I"); + + histo['fName'] = this.tf1['fName'] + "_hist"; + histo['fTitle'] = this.tf1['fTitle']; + + histo['fXaxis']['fXmin'] = xmin; + histo['fXaxis']['fXmax'] = xmax; + histo['fYaxis']['fXmin'] = ymin; + histo['fYaxis']['fXmax'] = ymax; + + return histo; + } + + JSROOT.TF1Painter.prototype.CreateBins = function() { + + var pthis = this; + + if (this.tf1['fSave'].length > 0) { + // in the case where the points have been saved, useful for example + // if we don't have the user's function + var nb_points = this.tf1['fNpx']; + + var xmin = this.tf1['fSave'][nb_points + 1]; + var xmax = this.tf1['fSave'][nb_points + 2]; + var binwidthx = (xmax - xmin) / nb_points; + + this['bins'] = d3.range(nb_points).map(function(p) { + return { + x : xmin + (p * binwidthx), + y : pthis.tf1['fSave'][p] + }; + }); + this['interpolate_method'] = 'monotone'; + } else { + if (this.tf1['fNpfits'] <= 103) + this.tf1['fNpfits'] = 333; + var xmin = this.tf1['fXmin']; + var xmax = this.tf1['fXmax']; + var nb_points = Math.max(this.tf1['fNpx'], this.tf1['fNpfits']); + var binwidthx = (xmax - xmin) / nb_points; + this['bins'] = d3.range(nb_points).map(function(p) { + var xx = xmin + (p * binwidthx); + var yy = pthis.Eval(xx); + if (isNaN(yy)) yy = 0; + return { + x : xx, + y : yy + }; + }); + this['interpolate_method'] = 'cardinal-open'; + } + } + + JSROOT.TF1Painter.prototype.DrawBins = function() { + var w = this.frame_width(), h = this.frame_height(); + + this.RecreateDrawG(); + + var pthis = this; + var pmain = this.main_painter(); + + var attline = JSROOT.Painter.createAttLine(this.tf1); + var fill = this.createAttFill(this.tf1); + if (fill.color == 'white') fill.color = 'none'; + + var line = d3.svg.line() + .x(function(d) { return pmain.grx(d.x).toFixed(1); }) + .y(function(d) { return pmain.gry(d.y).toFixed(1); }) + .interpolate(this.interpolate_method); + + var area = d3.svg.area() + .x(function(d) { return pmain.grx(d.x).toFixed(1); }) + .y1(h) + .y0(function(d) { return pmain.gry(d.y).toFixed(1); }); + + if (attline.color != "none") + this.draw_g.append("svg:path") + .attr("class", "line") + .attr("d",line(pthis.bins)) + .style("fill", "none") + .call(attline.func); + + if (fill.color != "none") + this.draw_g.append("svg:path") + .attr("class", "area") + .attr("d",area(pthis.bins)) + .style("stroke", "none") + .style("pointer-events", "none") + .call(fill.func); + + // add tooltips + if (JSROOT.gStyle.Tooltip) + this.draw_g.selectAll() + .data(this.bins).enter() + .append("svg:circle") + .attr("cx", function(d) { return pmain.grx(d.x).toFixed(1); }) + .attr("cy", function(d) { return pmain.gry(d.y).toFixed(1); }) + .attr("r", 4) + .style("opacity", 0) + .append("svg:title") + .text( function(d) { return "x = " + pmain.AxisAsText("x",d.x) + " \ny = " + pmain.AxisAsText("y", d.y); }); + } + + JSROOT.TF1Painter.prototype.UpdateObject = function(obj) { + if (obj['_typename'] != this.tf1['_typename']) return false; + // TODO: realy update object content + this.tf1 = obj; + this.CreateBins(); + return true; + } + + JSROOT.Painter.drawFunction = function(divid, tf1) { + var painter = new JSROOT.TF1Painter(tf1); + painter.SetDivId(divid, -1); + if (painter.main_painter() == null) { + var histo = painter.CreateDummyHisto(); + JSROOT.Painter.drawHistogram1D(divid, histo); + } + painter.SetDivId(divid); + painter.CreateBins(); + painter.DrawBins(); + return painter.DrawingReady(); + } + + // ======================================================================= + + JSROOT.TGraphPainter = function(graph) { + JSROOT.TObjectPainter.call(this, graph); + this.graph = graph; + this.ownhisto = false; // indicate if graph histogram was drawn for axes + this.bins = null; + } + + JSROOT.TGraphPainter.prototype = Object.create(JSROOT.TObjectPainter.prototype); + + JSROOT.TGraphPainter.prototype.GetObject = function() { + return this.graph; + } + + JSROOT.TGraphPainter.prototype.Redraw = function() { + this.DrawBins(); + } + + JSROOT.TGraphPainter.prototype.DecodeOptions = function(opt) { + this.draw_all = true; + JSROOT.extend(this, { optionLine:0, optionAxis:0, optionCurve:0, optionRect:0, + optionMark:0, optionBar:0, optionR:0, optionE:0, optionEF:0, + optionFill:0, optionZ:0, optionBrackets:0, + opt:"LP", out_of_range: false, has_errors: false, draw_errors: false, is_bent:false }); + + this.is_bent = this.graph['_typename'] == 'TGraphBentErrors'; + this.has_errors = (this.graph['_typename'] == 'TGraphErrors' || + this.graph['_typename'] == 'TGraphAsymmErrors' || + this.is_bent || this.graph['_typename'].match(/^RooHist/)); + this.draw_errors = this.has_errors; + + if ((opt != null) && (opt != "")) { + this.opt = opt.toUpperCase(); + this.opt.replace('SAME', ''); + } + if (this.opt.indexOf('L') != -1) + this.optionLine = 1; + if (this.opt.indexOf('F') != -1) + this.optionFill = 1; + if (this.opt.indexOf('A') != -1) + this.optionAxis = 1; + if (this.opt.indexOf('C') != -1) { + this.optionCurve = 1; + if (this.optionFill==0) this.optionLine = 1; + } + if (this.opt.indexOf('*') != -1) + this.optionMark = 2; + if (this.opt.indexOf('P') != -1) + this.optionMark = 1; + if (this.opt.indexOf('B') != -1) { + this.optionBar = 1; + this.draw_errors = false; + } + if (this.opt.indexOf('R') != -1) + this.optionR = 1; + + if (this.opt.indexOf('[]') != -1) { + this.optionBrackets = 1; + this.draw_errors = false; + } + + if (this.opt.indexOf('0') != -1) { + this.optionMark = 1; + this.draw_errors = true; + this.out_of_range = true; + } + + if (this.opt.indexOf('1') != -1) { + if (this.optionBar == 1) this.optionBar = 2; + } + if (this.opt.indexOf('2') != -1) + this.optionRect = 1; + + if (this.opt.indexOf('3') != -1) { + this.optionEF = 1; + this.optionLine = 0; + this.draw_errors = false; + } + if (this.opt.indexOf('4') != -1) { + this.optionEF = 2; + this.optionLine = 0; + this.draw_errors = false; + } + + if (this.opt.indexOf('2') != -1 || this.opt.indexOf('5') != -1) this.optionE = 1; + + // if no drawing option is selected and if opt<>' ' nothing is done. + if (this.optionLine + this.optionFill + this.optionMark + this.optionBar + this.optionE + + this.optionEF + this.optionRect + this.optionBrackets == 0) { + if (this.opt.length == 0) + this.optionLine = 1; + } + + if (this.graph['_typename'] == 'TGraphErrors') { + var maxEX = d3.max(this.graph['fEX']); + var maxEY = d3.max(this.graph['fEY']); + if (maxEX < 1.0e-300 && maxEY < 1.0e-300) + this.draw_errors = false; + } + + } + + JSROOT.TGraphPainter.prototype.CreateBins = function() { + var gr = this.graph; + if (gr==null) return; + + var npoints = gr['fNpoints']; + if ((gr._typename=="TCutG") && (npoints>3)) npoints--; + + var kind = 0; + if (gr['_typename'] == 'TGraphErrors') kind = 1; else + if (gr['_typename'] == 'TGraphAsymmErrors' || gr['_typename'] == 'TGraphBentErrors' + || gr['_typename'].match(/^RooHist/)) kind = 2; + + this.bins = d3.range(npoints).map( + function(p) { + if (kind == 1) + return { + x : gr['fX'][p], + y : gr['fY'][p], + exlow : gr['fEX'][p], + exhigh : gr['fEX'][p], + eylow : gr['fEY'][p], + eyhigh : gr['fEY'][p] + }; + if (kind == 2) + return { + x : gr['fX'][p], + y : gr['fY'][p], + exlow : gr['fEXlow'][p], + exhigh : gr['fEXhigh'][p], + eylow : gr['fEYlow'][p], + eyhigh : gr['fEYhigh'][p] + }; + return { + x : gr['fX'][p], + y : gr['fY'][p] + }; + }); + } + + JSROOT.TGraphPainter.prototype.CreateHistogram = function() { + // bins should be created + + var xmin, xmax, ymin, ymax; + + if (this.bins==null) { + xmin = 0; xmax = 1; ymin = 0; ymax = 1; + } else + for (var n in this.bins) { + var pnt = this.bins[n]; + if ((xmin==null) || (pnt.x < xmin)) xmin = pnt.x; + if ((xmax==null) || (pnt.x > xmax)) xmax = pnt.x; + if ((ymin==null) || (pnt.y < ymin)) ymin = pnt.y; + if ((ymax==null) || (pnt.y > ymax)) ymax = pnt.y; + if ('exlow' in pnt) { + xmin = Math.min(xmin, pnt.x - pnt.exlow, pnt.x + pnt.exhigh); + xmax = Math.max(xmax, pnt.x - pnt.exlow, pnt.x + pnt.exhigh); + ymin = Math.min(ymin, pnt.y - pnt.eylow, pnt.y + pnt.eylow); + ymax = Math.max(ymax, pnt.y - pnt.eylow, pnt.y + pnt.eylow); + } + } + + if (xmin == xmax) xmax+=1; + if (ymin == ymax) ymax+=1; + var dx = (xmax - xmin)*0.1; + var dy = (ymax - ymin)*0.1; + var uxmin = xmin - dx, uxmax = xmax + dx; + var minimum = ymin - dy, maximum = ymax + dy; + if ((uxmin<0) && (xmin>=0)) uxmin = xmin*0.9; + if ((uxmax>0) && (xmax<=0)) uxmax = 0; + + if (this.graph.fMinimum != -1111) minimum = ymin = this.graph.fMinimum; + if (this.graph.fMaximum != -1111) maximum = ymax = this.graph.fMaximum; + if ((minimum < 0) && (ymin >=0)) minimum = 0.9*ymin; + + var histo = JSROOT.CreateTH1(100); + histo.fName = this.graph.fName + "_h"; + histo.fTitle = this.graph.fTitle; + histo.fXaxis.fXmin = uxmin; + histo.fXaxis.fXmax = uxmax; + histo.fYaxis.fXmin = minimum; + histo.fYaxis.fXmax = maximum; + histo.fXaxis.fMinimum = minimum; + histo.fXaxis.fMaximum = maximum; + histo.fBits = histo.fBits | JSROOT.TH1StatusBits.kNoStats; + return histo; + } + + JSROOT.TGraphPainter.prototype.DrawBars = function() { + var bins = this.bins; + if (bins.length == 1) { + // special case of single bar + var binwidthx = (this.graph['fHistogram']['fXaxis']['fXmax'] - + this.graph['fHistogram']['fXaxis']['fXmin']); + bins[0].xl = bins[0].x - binwidthx/2; + bins[0].xr = bins[0].x + binwidthx/2; + } else + for (var n=0;n0) bins[n].xl = (bins[n].x + bins[n-1].x)/2; + if (n=0)) return pmain.gry(d.y).toFixed(1); + return pmain.gry(0).toFixed(1); + }) + .attr("width", function(d) { return (pmain.grx(d.xr) - pmain.grx(d.xl)-1).toFixed(1); }) + .attr("height", function(d) { + var hh = pmain.gry(d.y); + if (normal) return hh>h ? 0 : (h - hh).toFixed(1); + return (d.y<0) ? (hh - pmain.gry(0)).toFixed(1) : (pmain.gry(0) - hh).toFixed(1); + }) + .call(this.fillatt.func); + } + + JSROOT.TGraphPainter.prototype.DrawBins = function() { + var w = this.frame_width(), h = this.frame_height(); + + this.RecreateDrawG(); + + var pthis = this; + var pmain = this.main_painter(); + + this.lineatt = JSROOT.Painter.createAttLine(this.graph); + this.fillatt = this.createAttFill(this.graph); + + function TooltipText(d) { + + var res = "x = " + pmain.AxisAsText("x", d.x) + "\n" + + "y = " + pmain.AxisAsText("y", d.y); + + if (pthis.draw_errors && (pmain.x_kind=='normal') && ('exlow' in d) && ((d.exlow!=0) || (d.exhigh!=0))) + res += "\nerror x = -" + pmain.AxisAsText("x", d.exlow) + + "/+" + pmain.AxisAsText("x", d.exhigh); + + if (pthis.draw_errors && !pmain.y_time && ('eylow' in d) && ((d.eylow!=0) || (d.eyhigh!=0)) ) + res += "\nerror y = -" + pmain.AxisAsText("y", d.eylow) + + "/+" + pmain.AxisAsText("y", d.eyhigh); + + return res; + } + + if (this.optionEF > 0) { + var area = d3.svg.area() + .x(function(d) { return pmain.grx(d.x).toFixed(1); }) + .y0(function(d) { return pmain.gry(d.y - d.eylow).toFixed(1); }) + .y1(function(d) { return pmain.gry(d.y + d.eyhigh).toFixed(1); }); + if (this.optionEF > 1) area = area.interpolate(JSROOT.gStyle.Interpolate); + this.draw_g.append("svg:path") + .attr("d", area(this.bins)) + .style("stroke", "none") + .call(this.fillatt.func); + } + + var line = d3.svg.line() + .x(function(d) { return pmain.grx(d.x).toFixed(1); }) + .y(function(d) { return pmain.gry(d.y).toFixed(1); }); + + // use smoothing of the line by basic spline interpolation + if (this.optionCurve == 1) + line = line.interpolate(JSROOT.gStyle.Interpolate); + + if (this.optionBar) { + var nodes = this.DrawBars(); + if (JSROOT.gStyle.Tooltip) + nodes.append("svg:title").text(TooltipText); + } + + if (this.lineatt.width > 99) { + /* first draw exclusion area, and then the line */ + this.optionMark = 0; + + this.DrawExclusion(line); + } + + if (this.optionLine == 1 || this.optionFill == 1) { + + var close_symbol = ""; + if (this.graph._typename=="TCutG") close_symbol = " Z"; + + var lineatt = this.lineatt; + if (this.optionLine == 0) lineatt = JSROOT.Painter.createAttLine('none'); + + if (this.optionFill != 1) { + this.fillatt.color = 'none'; + } + + this.draw_g.append("svg:path") + .attr("d", line(pthis.bins) + close_symbol) + .attr("class", "draw_line") + .style("pointer-events","none") + .call(lineatt.func) + .call(this.fillatt.func); + + // do not add tooltip for line, when we wants to add markers + if (JSROOT.gStyle.Tooltip && (this.optionMark==0)) + this.draw_g.selectAll("draw_line") + .data(pthis.bins).enter() + .append("svg:circle") + .attr("cx", function(d) { return pmain.grx(d.x).toFixed(1); }) + .attr("cy", function(d) { return Math.round(pmain.gry(d.y)); }) + .attr("r", 3) + .style("opacity", 0) + .append("svg:title") + .text(TooltipText); + } + + var nodes = null; + + if (this.draw_errors || this.optionMark || this.optionRect || this.optionBrackets) { + var draw_bins = new Array; + for (var i in this.bins) { + var pnt = this.bins[i]; + var grx = pmain.grx(pnt.x); + var gry = pmain.gry(pnt.y); + if (!this.out_of_range && ((grx<0) || (grx>w) || (gry<0) || (gry>h))) continue; + + // caluclate graphical coordinates + pnt['grx1'] = grx.toFixed(1); + pnt['gry1'] = gry.toFixed(1); + + if (this.has_errors) { + pnt['grx0'] = (pmain.grx(pnt.x - pnt.exlow) - grx).toFixed(1); + pnt['grx2'] = (pmain.grx(pnt.x + pnt.exhigh) - grx).toFixed(1); + pnt['gry0'] = (pmain.gry(pnt.y - pnt.eylow) - gry).toFixed(1); + pnt['gry2'] = (pmain.gry(pnt.y + pnt.eyhigh) - gry).toFixed(1); + + if (this.is_bent) { + pnt['grdx0'] = pmain.gry(pnt.y + this.graph.fEXlowd[i]) - gry; + pnt['grdx2'] = pmain.gry(pnt.y + this.graph.fEXhighd[i]) - gry; + pnt['grdy0'] = pmain.grx(pnt.x + this.graph.fEYlowd[i]) - grx; + pnt['grdy2'] = pmain.grx(pnt.x + this.graph.fEYhighd[i]) - grx; + } else { + pnt['grdx0'] = 0; // in y direction + pnt['grdx2'] = 0; // in y direction + pnt['grdy0'] = 0; // in x direction + pnt['grdy2'] = 0; // in x direction + } + } + + draw_bins.push(pnt); + } + // here are up to five elements are collected, try to group them + nodes = this.draw_g.selectAll("g.node") + .data(draw_bins) + .enter() + .append("svg:g") + .attr("transform", function(d) { return "translate(" + d.grx1 + "," + d.gry1 + ")"; }); + } + + if (JSROOT.gStyle.Tooltip && nodes) + nodes.append("svg:title").text(TooltipText); + + if (this.optionRect) { + nodes.filter(function(d) { return (d.exlow > 0) && (d.exhigh > 0) && (d.eylow > 0) && (d.eyhigh > 0); }) + .append("svg:rect") + .attr("x", function(d) { return d.grx0; }) + .attr("y", function(d) { return d.gry2; }) + .attr("width", function(d) { return d.grx2 - d.grx0; }) + .attr("height", function(d) { return d.gry0 - d.gry2; }) + .call(this.fillatt.func); + } + + if (this.optionBrackets) { + var prnt = nodes.filter(function(d) { return (d.eylow > 0); }); + prnt.append("svg:line") + .attr("x1", -5) + .attr("y1", function(d) { return d.gry0; }) + .attr("x2", 5) + .attr("y2", function(d) { return d.gry0; }) + .style("stroke", this.lineatt.color) + .style("stroke-width", this.lineatt.width) + prnt.append("svg:line") + .attr("x1", -5) + .attr("y1", function(d) { return d.gry0; }) + .attr("x2", -5) + .attr("y2", function(d) { return Number(d.gry0)-3; }) + .style("stroke", this.lineatt.color) + .style("stroke-width", this.lineatt.width); + prnt.append("svg:line") + .attr("x1", 5) + .attr("y1", function(d) { return d.gry0; }) + .attr("x2", 5) + .attr("y2", function(d) { return Number(d.gry0)-3; }) + .style("stroke", this.lineatt.color) + .style("stroke-width", this.lineatt.width); + + prnt = nodes.filter(function(d) { return (d.eyhigh > 0); }); + prnt.append("svg:line") + .attr("x1", -5) + .attr("y1", function(d) { return d.gry2; }) + .attr("x2", 5) + .attr("y2", function(d) { return d.gry2; }) + .style("stroke", this.lineatt.color) + .style("stroke-width", this.lineatt.width); + prnt.append("svg:line") + .attr("x1", -5) + .attr("y1", function(d) { return d.gry2; }) + .attr("x2", -5) + .attr("y2", function(d) { return Number(d.gry2)+3; }) + .style("stroke", this.lineatt.color) + .style("stroke-width", this.lineatt.width); + prnt.append("svg:line") + .attr("x1", 5) + .attr("y1", function(d) { return d.gry2; }) + .attr("x2", 5) + .attr("y2", function(d) { return Number(d.gry2)+3; }) + .style("stroke", this.lineatt.color) + .style("stroke-width", this.lineatt.width); + } + + if (this.draw_errors) { + // lower x error + var prnt = nodes.filter(function(d) { return (d.exlow > 0); }); + prnt.append("svg:line") + .attr("y1", 0).attr("x1", 0) + .attr("x2", function(d) { return d.grx0; }) + .attr("y2", function(d) { return d.grdx0.toFixed(1); }) + .style("stroke", this.lineatt.color) + .style("stroke-width", this.lineatt.width); + prnt.append("svg:line") + .attr("y1", function(d) { return (d.grdx0-3).toFixed(1); }) + .attr("x1", function(d) { return d.grx0; }) + .attr("y2", function(d) { return (d.grdx0+3).toFixed(1); }) + .attr("x2", function(d) { return d.grx0; }) + .style("stroke", this.lineatt.color) + .style("stroke-width", this.lineatt.width); + + // high x error + prnt = nodes.filter(function(d) { return (d.exhigh > 0); }); + prnt.append("svg:line") + .attr("x1", 0).attr("y1", 0) + .attr("x2", function(d) { return d.grx2; }) + .attr("y2", function(d) { return d.grdx2.toFixed(1); }) + .style("stroke", this.lineatt.color) + .style("stroke-width", this.lineatt.width); + prnt.append("svg:line") + .attr("x1", function(d) { return d.grx2; }) + .attr("y1", function(d) { return (d.grdx2-3).toFixed(1); }) + .attr("x2", function(d) { return d.grx2; }) + .attr("y2", function(d) { return (d.grdx2+3).toFixed(1); }) + .style("stroke", this.lineatt.color) + .style( "stroke-width", this.lineatt.width); + + // low y error + prnt = nodes.filter(function(d) { return (d.eylow > 0); }); + prnt.append("svg:line") + .attr("x1", 0).attr("y1", 0) + .attr("x2", function(d) { return d.grdy0.toFixed(1); }) + .attr("y2", function(d) { return d.gry0; }) + .style("stroke", this.lineatt.color) + .style("stroke-width", this.lineatt.width); + prnt.append("svg:line") + .attr("x1", function(d) { return (d.grdy0-3).toFixed(1); }) + .attr("y1", function(d) { return d.gry0; }) + .attr("x2", function(d) { return (d.grdy0+3).toFixed(1); }) + .attr("y2", function(d) { return d.gry0; }) + .style("stroke", this.lineatt.color) + .style("stroke-width", this.lineatt.width); + + // high y error + prnt = nodes.filter(function(d) { return (d.eyhigh > 0); }) + prnt.append("svg:line") + .attr("x1", 0).attr("y1", 0) + .attr("x2", function(d) { return d.grdy2.toFixed(1); }) + .attr("y2", function(d) { return d.gry2; }) + .style("stroke", this.lineatt.color) + .style("stroke-width", this.lineatt.width); + prnt.append("svg:line") + .attr("x1", function(d) { return (d.grdy2-3).toFixed(1); }) + .attr("y1", function(d) { return d.gry2; }) + .attr("x2", function(d) { return (d.grdy2+3).toFixed(1); }) + .attr("y2", function(d) { return d.gry2; }) + .style("stroke", this.lineatt.color) + .style("stroke-width", this.lineatt.width); + } + + if (this.optionMark) { + /* Add markers */ + var style = (this.optionMark == 2) ? 3 : null; + + var marker = JSROOT.Painter.createAttMarker(this.graph, style); + + nodes.append("svg:path").call(marker.func); + } + } + + JSROOT.TGraphPainter.prototype.DrawExclusion = function(line) { + var normx, normy; + var n = this.graph['fNpoints']; + var xo = new Array(n + 2), + yo = new Array(n + 2), + xt = new Array(n + 2), + yt = new Array(n + 2), + xf = new Array(2 * n + 2), + yf = new Array(2 * n + 2); + // negative value means another side of the line... + + var a, i, j, nf, wk = 1; + if (this.lineatt.width > 32767) { + this.lineatt.width = 65536 - this.lineatt.width; + wk = -1; + } + wk *= (this.lineatt.width / 100) * 0.005; + this.lineatt.width = this.lineatt.width % 100; // line width + if (this.lineatt.width > 0) this.optionLine = 1; + + var w = this.frame_width(), h = this.frame_height(); + + var ratio = w / h; + + var xmin = this.main_painter().xmin, xmax = this.main_painter().xmax, + ymin = this.main_painter().ymin, ymax = this.main_painter().ymax; + for (i = 0; i < n; i++) { + xo[i] = (this.graph['fX'][i] - xmin) / (xmax - xmin); + yo[i] = (this.graph['fY'][i] - ymin) / (ymax - ymin); + if (w > h) + yo[i] = yo[i] / ratio; + else if (h > w) + xo[i] = xo[i] / ratio; + } + // The first part of the filled area is made of the graph points. + // Make sure that two adjacent points are different. + xf[0] = xo[0]; + yf[0] = yo[0]; + nf = 0; + for (i = 1; i < n; i++) { + if (xo[i] == xo[i - 1] && yo[i] == yo[i - 1]) continue; + nf++; + xf[nf] = xo[i]; + if (xf[i] == xf[i - 1]) + xf[i] += 0.000001; // add an epsilon to avoid exact vertical + // lines. + yf[nf] = yo[i]; + } + // For each graph points a shifted points is computed to build up + // the second part of the filled area. First and last points are + // treated as special cases, outside of the loop. + if (xf[1] == xf[0]) { + a = Math.PI / 2.0; + } else { + a = Math.atan((yf[1] - yf[0]) / (xf[1] - xf[0])); + } + if (xf[0] <= xf[1]) { + xt[0] = xf[0] - wk * Math.sin(a); + yt[0] = yf[0] + wk * Math.cos(a); + } else { + xt[0] = xf[0] + wk * Math.sin(a); + yt[0] = yf[0] - wk * Math.cos(a); + } + if (xf[nf] == xf[nf - 1]) { + a = Math.PI / 2.0; + } else { + a = Math.atan((yf[nf] - yf[nf - 1]) / (xf[nf] - xf[nf - 1])); + } + if (xf[nf] >= xf[nf - 1]) { + xt[nf] = xf[nf] - wk * Math.sin(a); + yt[nf] = yf[nf] + wk * Math.cos(a); + } else { + xt[nf] = xf[nf] + wk * Math.sin(a); + yt[nf] = yf[nf] - wk * Math.cos(a); + } + + var a1, a2, a3, xi0, yi0, xi1, yi1, xi2, yi2; + for (i = 1; i < nf; i++) { + xi0 = xf[i]; + yi0 = yf[i]; + xi1 = xf[i + 1]; + yi1 = yf[i + 1]; + xi2 = xf[i - 1]; + yi2 = yf[i - 1]; + if (xi1 == xi0) { + a1 = Math.PI / 2.0; + } else { + a1 = Math.atan((yi1 - yi0) / (xi1 - xi0)); + } + if (xi1 < xi0) + a1 = a1 + Math.PI; + if (xi2 == xi0) { + a2 = Math.PI / 2.0; + } else { + a2 = Math.atan((yi0 - yi2) / (xi0 - xi2)); + } + if (xi0 < xi2) + a2 = a2 + Math.PI; + x1 = xi0 - wk * Math.sin(a1); + y1 = yi0 + wk * Math.cos(a1); + x2 = xi0 - wk * Math.sin(a2); + y2 = yi0 + wk * Math.cos(a2); + xm = (x1 + x2) * 0.5; + ym = (y1 + y2) * 0.5; + if (xm == xi0) { + a3 = Math.PI / 2.0; + } else { + a3 = Math.atan((ym - yi0) / (xm - xi0)); + } + x3 = xi0 - wk * Math.sin(a3 + (Math.PI / 2.0)); + y3 = yi0 + wk * Math.cos(a3 + (Math.PI / 2.0)); + // Rotate (x3,y3) by PI around (xi0,yi0) if it is not on the (xm,ym) + // side. + if ((xm - xi0) * (x3 - xi0) < 0 && (ym - yi0) * (y3 - yi0) < 0) { + x3 = 2 * xi0 - x3; + y3 = 2 * yi0 - y3; + } + if ((xm == x1) && (ym == y1)) { + x3 = xm; + y3 = ym; + } + xt[i] = x3; + yt[i] = y3; + } + // Close the polygon if the first and last points are the same + if (xf[nf] == xf[0] && yf[nf] == yf[0]) { + xm = (xt[nf] + xt[0]) * 0.5; + ym = (yt[nf] + yt[0]) * 0.5; + if (xm == xf[0]) { + a3 = Math.PI / 2.0; + } else { + a3 = Math.atan((ym - yf[0]) / (xm - xf[0])); + } + x3 = xf[0] + wk * Math.sin(a3 + (Math.PI / 2.0)); + y3 = yf[0] - wk * Math.cos(a3 + (Math.PI / 2.0)); + if ((xm - xf[0]) * (x3 - xf[0]) < 0 && (ym - yf[0]) * (y3 - yf[0]) < 0) { + x3 = 2 * xf[0] - x3; + y3 = 2 * yf[0] - y3; + } + xt[nf] = x3; + xt[0] = x3; + yt[nf] = y3; + yt[0] = y3; + } + // Find the crossing segments and remove the useless ones + var xc, yc, c1, b1, c2, b2; + var cross = false; + var nf2 = nf; + for (i = nf2; i > 0; i--) { + for (j = i - 1; j > 0; j--) { + if (xt[i - 1] == xt[i] || xt[j - 1] == xt[j]) + continue; + c1 = (yt[i - 1] - yt[i]) / (xt[i - 1] - xt[i]); + b1 = yt[i] - c1 * xt[i]; + c2 = (yt[j - 1] - yt[j]) / (xt[j - 1] - xt[j]); + b2 = yt[j] - c2 * xt[j]; + if (c1 != c2) { + xc = (b2 - b1) / (c1 - c2); + yc = c1 * xc + b1; + if (xc > Math.min(xt[i], xt[i - 1]) + && xc < Math.max(xt[i], xt[i - 1]) + && xc > Math.min(xt[j], xt[j - 1]) + && xc < Math.max(xt[j], xt[j - 1]) + && yc > Math.min(yt[i], yt[i - 1]) + && yc < Math.max(yt[i], yt[i - 1]) + && yc > Math.min(yt[j], yt[j - 1]) + && yc < Math.max(yt[j], yt[j - 1])) { + nf++; + xf[nf] = xt[i]; + yf[nf] = yt[i]; + nf++; + xf[nf] = xc; + yf[nf] = yc; + i = j; + cross = true; + break; + } else { + continue; + } + } else { + continue; + } + } + if (!cross) { + nf++; + xf[nf] = xt[i]; + yf[nf] = yt[i]; + } + cross = false; + } + nf++; + xf[nf] = xt[0]; + yf[nf] = yt[0]; + nf++; + + for (i = 0; i < nf; i++) { + if (w > h) { + xf[i] = xmin + (xf[i] * (xmax - xmin)); + yf[i] = ymin + (yf[i] * (ymax - ymin)) * ratio; + } else if (h > w) { + xf[i] = xmin + (xf[i] * (xmax - xmin)) * ratio; + yf[i] = ymin + (yf[i] * (ymax - ymin)); + } else { + xf[i] = xmin + (xf[i] * (xmax - xmin)); + yf[i] = ymin + (yf[i] * (ymax - ymin)); + } + if ((xf[i] <= 0.0) && this.main_painter().options.Logx) xf[i] = xmin; + if ((yf[i] <= 0.0) && this.main_painter().options.Logy) yf[i] = ymin; + } + + var excl = d3.range(nf).map(function(p) { return { x : xf[p], y : yf[p] }; }); + + /* some clean-up */ + xo.splice(0, xo.length); + yo.splice(0, yo.length); + xo = null; + yo = null; + xt.splice(0, xt.length); + yt.splice(0, yt.length); + xt = null; + yt = null; + xf.splice(0, xf.length); + yf.splice(0, yf.length); + xf = null; + yf = null; + + this.draw_g.append("svg:path") + .attr("d", line(excl)) + .style("stroke", "none") + .style("stroke-width", 1) + .call(this.fillatt.func) + .style('opacity', 0.75); + } + + JSROOT.TGraphPainter.prototype.UpdateObject = function(obj) { + if (obj['_typename'] != this.graph['_typename']) + return false; + + // if our own histogram was used as axis drawing, we need update histogram as well + if (this.ownhisto) + this.main_painter().UpdateObject(obj['fHistogram']); + + // TODO: make real update of TGraph object content + this.graph['fX'] = obj['fX']; + this.graph['fY'] = obj['fY']; + this.graph['fNpoints'] = obj['fNpoints']; + this.CreateBins(); + return true; + } + + JSROOT.Painter.drawGraph = function(divid, graph, opt) { + var painter = new JSROOT.TGraphPainter(graph); + painter.CreateBins(); + + painter.SetDivId(divid, -1); // just to get access to existing elements + + if (painter.main_painter() == null) { + if (graph['fHistogram']==null) + graph['fHistogram'] = painter.CreateHistogram(); + JSROOT.Painter.drawHistogram1D(divid, graph['fHistogram']); + painter.ownhisto = true; + } + + painter.SetDivId(divid); + painter.DecodeOptions(opt); + painter.DrawBins(); + return painter.DrawingReady(); + } + + // ============================================================ + + JSROOT.TPavePainter = function(pave) { + JSROOT.TObjectPainter.call(this, pave); + this.pavetext = pave; + this.Enabled = true; + } + + JSROOT.TPavePainter.prototype = Object.create(JSROOT.TObjectPainter.prototype); + + JSROOT.TPavePainter.prototype.GetObject = function() { + return this.pavetext; + } + + JSROOT.TPavePainter.prototype.DrawPaveText = function() { + var pavetext = this.pavetext; + + var w = this.pad_width(), h = this.pad_height(); + + if ((pavetext.fOption.indexOf("NDC")<0) && !pavetext.fInit) { + pavetext.fInit = 1; + var pad = this.root_pad(); + if (pad!=null) { + if (pad['fLogx']) { + if (pavetext.fX1 > 0) pavetext.fX1 = JSROOT.Math.log10(pavetext.fX1); + if (pavetext.fX2 > 0) pavetext.fX2 = JSROOT.Math.log10(pavetext.fX2); + } + if (pad['fLogy']) { + if (pavetext.fY1 > 0) pavetext.fY1 = JSROOT.Math.log10(pavetext.fY1); + if (pavetext.fY2 > 0) pavetext.fY2 = JSROOT.Math.log10(pavetext.fY2); + } + pavetext['fX1NDC'] = (pavetext.fX1-pad['fX1'])/(pad['fX2'] - pad['fX1']); + pavetext['fY1NDC'] = (pavetext.fY1-pad['fY1'])/(pad['fY2'] - pad['fY1']); + pavetext['fX2NDC'] = (pavetext.fX2-pad['fX1'])/(pad['fX2'] - pad['fX1']); + pavetext['fY2NDC'] = (pavetext.fY2-pad['fY1'])/(pad['fY2'] - pad['fY1']); + + } else { + pavetext['fX1NDC'] = 0.1; + pavetext['fX2NDC'] = 0.9; + pavetext['fY1NDC'] = 0.1; + pavetext['fY2NDC'] = 0.9; + } + } + + var pos_x = Math.round(pavetext['fX1NDC'] * w); + var pos_y = Math.round((1.0 - pavetext['fY1NDC']) * h); + var width = Math.round(Math.abs(pavetext['fX2NDC'] - pavetext['fX1NDC']) * w); + var height = Math.round(Math.abs(pavetext['fY2NDC'] - pavetext['fY1NDC']) * h); + + pos_y -= height; + var nlines = pavetext['fLines'].arr.length; + var tcolor = JSROOT.Painter.root_colors[pavetext['fTextColor']]; + var scolor = JSROOT.Painter.root_colors[pavetext['fShadowColor']]; + var fcolor = this.createAttFill(pavetext); + + var lwidth = pavetext['fBorderSize'] ? pavetext['fBorderSize'] : 0; + var attline = JSROOT.Painter.createAttLine(pavetext, lwidth>0 ? 1 : 0); + + var first_stat = 0, num_cols = 0; + var lines = new Array; + + // adjust font size + for (var j = 0; j < nlines; ++j) { + var line = pavetext['fLines'].arr[j]['fTitle']; + lines.push(line); + if (!this.IsStats() || (j == 0) || (line.indexOf('|') < 0)) continue; + if (first_stat === 0) first_stat = j; + var parts = line.split("|"); + if (parts.length > num_cols) + num_cols = parts.length; + } + + var pthis = this; + + // container used to recalculate coordinates + this.RecreateDrawG(true,".stat_layer"); + + // position and size required only for drag functions + this.draw_g + .attr("x", pos_x) + .attr("y", pos_y) + .attr("width", width) + .attr("height", height) + .attr("transform", "translate(" + pos_x + "," + pos_y + ")"); + + var rect = this.draw_g.append("rect") + .attr("x", 0) + .attr("y", 0) + .attr("width", width) + .attr("height", height) + .call(fcolor.func) + .call(attline.func); + + // for characters like 'p' or 'y' several more pixels required to stay in the box when drawn in last line + var stepy = height / nlines, has_head = false; + var margin_x = pavetext['fMargin'] * width; + + this.StartTextDrawing(pavetext['fTextFont'], height/(nlines * 1.2)); + + if (nlines == 1) { + this.DrawText(pavetext['fTextAlign'], 0, 0, width, height, lines[0], tcolor); + } else { + for (var j = 0; j < nlines; ++j) { + var jcolor = JSROOT.Painter.root_colors[pavetext['fLines'].arr[j]['fTextColor']]; + if (pavetext['fLines'].arr[j]['fTextColor'] == 0) jcolor = tcolor; + var posy = j*stepy; + + if (this.IsStats()) { + if ((first_stat > 0) && (j >= first_stat)) { + var parts = lines[j].split("|"); + for (var n = 0; n < parts.length; n++) + this.DrawText("middle", + width * n / num_cols, posy, + width/num_cols, stepy, parts[n], jcolor); + } else if (lines[j].indexOf('=') < 0) { + if (j==0) has_head = true; + this.DrawText((j == 0) ? "middle" : "start", + margin_x, posy, width-2*margin_x, stepy, lines[j], jcolor); + } else { + var parts = lines[j].split("="), sumw = 0; + for (var n = 0; n < 2; n++) + sumw += this.DrawText((n == 0) ? "start" : "end", + margin_x, posy, width-2*margin_x, stepy, parts[n], jcolor); + this.TextScaleFactor(sumw/(width-2*margin_x), this.draw_g); + } + } else { + this.DrawText(pavetext['fTextAlign'], margin_x, posy, width-2*margin_x, stepy, lines[j], jcolor); + } + } + } + + var maxtw = this.FinishTextDrawing(); + + if (pavetext['fBorderSize'] && has_head) { + this.draw_g.append("svg:line") + .attr("x1", 0) + .attr("y1", stepy.toFixed(1)) + .attr("x2", width) + .attr("y2", stepy.toFixed(1)) + .call(attline.func); + } + + if ((first_stat > 0) && (num_cols > 1)) { + for (var nrow = first_stat; nrow < nlines; nrow++) + this.draw_g.append("svg:line") + .attr("x1", 0) + .attr("y1", (nrow * stepy).toFixed(1)) + .attr("x2", width) + .attr("y2", (nrow * stepy).toFixed(1)) + .call(attline.func); + + for (var ncol = 0; ncol < num_cols - 1; ncol++) + this.draw_g.append("svg:line") + .attr("x1", (width / num_cols * (ncol + 1)).toFixed(1)) + .attr("y1", (first_stat * stepy).toFixed(1)) + .attr("x2", (width / num_cols * (ncol + 1)).toFixed(1)) + .attr("y2", height) + .call(attline.func); + } + + if (lwidth && lwidth > 1) { + this.draw_g.append("svg:line") + .attr("x1", width + (lwidth / 2)) + .attr("y1", lwidth + 1) + .attr("x2", width + (lwidth / 2)) + .attr("y2", height + lwidth - 1) + .style("stroke", attline.color) + .style("stroke-width", lwidth); + this.draw_g.append("svg:line") + .attr("x1", lwidth + 1) + .attr("y1", height + (lwidth / 2)) + .attr("x2", width + lwidth - 1) + .attr("y2", height + (lwidth / 2)) + .style("stroke", attline.color) + .style("stroke-width", lwidth); + } + + if ((pavetext.fLabel.length>0) && !this.IsStats()) { + var lbl_g = this.draw_g.append("svg:g") + .attr("x", width*0.25) + .attr("y", -h*0.02) + .attr("width", width*0.5) + .attr("height", h*0.04) + .attr("transform", "translate(" + width*0.25 + "," + -h*0.02 + ")"); + + var lbl_rect = lbl_g.append("rect") + .attr("x", 0) + .attr("y", 0) + .attr("width", width*0.5) + .attr("height", h*0.04) + .call(fcolor.func) + .call(attline.func); + + this.StartTextDrawing(pavetext['fTextFont'], h*0.04/1.5, lbl_g); + + this.DrawText(22, 0, 0, width*0.5, h*0.04, pavetext.fLabel, tcolor, 1, lbl_g); + + this.FinishTextDrawing(lbl_g); + } + + this.AddDrag({ obj:pavetext, redraw:'DrawPaveText' }); + } + + JSROOT.TPavePainter.prototype.AddLine = function(txt) { + this.pavetext.AddText(txt); + } + + JSROOT.TPavePainter.prototype.IsStats = function() { + if (!this.pavetext) return false; + return this.pavetext['_typename'] == 'TPaveStats'; + } + + JSROOT.TPavePainter.prototype.Format = function(value, fmt) { + // method used to convert value to string according specified format + // format can be like 5.4g or 4.2e or 6.4f + if (!fmt) fmt = "stat"; + + if (fmt=="stat") { + fmt = this.pavetext.fStatFormat; + if (!fmt) fmt = JSROOT.gStyle.StatFormat; + } else + if (fmt=="fit") { + fmt = this.pavetext.fFitFormat; + if (!fmt) fmt = JSROOT.gStyle.FitFormat; + } else + if (fmt=="entries") { + if (value < 1e9) return value.toFixed(0); + fmt = "14.7g"; + } else + if (fmt=="last") { + fmt = this['lastformat']; + } + + delete this['lastformat']; + + if (!fmt) fmt = "6.4g"; + + var res = JSROOT.FFormat(value, fmt); + + this['lastformat'] = JSROOT.lastFFormat; + + return res; + } + + JSROOT.TPavePainter.prototype.FillStatistic = function() { + if (!this.IsStats()) return; + if (this.pavetext['fName'] != "stats") return; + + var dostat = new Number(this.pavetext['fOptStat']); + var dofit = new Number(this.pavetext['fOptFit']); + if (!dostat) dostat = JSROOT.gStyle.OptStat; + if (!dofit) dofit = JSROOT.gStyle.OptFit; + + // we take histogram from first painter + if ('FillStatistic' in this.main_painter()) { + + // make empty at the beginning + this.pavetext.Clear(); + + this.main_painter().FillStatistic(this, dostat, dofit); + } + } + + JSROOT.TPavePainter.prototype.UpdateObject = function(obj) { + if (obj._typename != 'TPaveText') return false; + this.pavetext['fLines'] = JSROOT.clone(obj['fLines']); + return true; + } + + JSROOT.TPavePainter.prototype.Redraw = function() { + + // if pavetext artificially disabled, do not redraw it + if (this.Enabled) { + this.FillStatistic(); + this.DrawPaveText(); + } else { + this.RemoveDrawG(); + } + } + + JSROOT.Painter.drawPaveText = function(divid, pavetext) { + var painter = new JSROOT.TPavePainter(pavetext); + painter.SetDivId(divid); + + // refill statistic in any case + painter.FillStatistic(); + painter.DrawPaveText(); + return painter.DrawingReady(); + } + + // =========================================================================== + + JSROOT.TPadPainter = function(pad, iscan) { + JSROOT.TObjectPainter.call(this, pad); + if (this.obj_typename=="") this.obj_typename = iscan ? "TCanvas" : "TPad"; + this.pad = pad; + this.iscan = iscan; // indicate if workign with canvas + this.painters = new Array; // complete list of all painters in the pad + } + + JSROOT.TPadPainter.prototype = Object.create(JSROOT.TObjectPainter.prototype); + + JSROOT.TPadPainter.prototype.GetStyleValue = function(select, name) { + var value = select.style(name); + if (!value) return 0; + value = parseFloat(value.replace("px","")); + return (value === NaN) ? 0 : value; + } + + JSROOT.TPadPainter.prototype.CreateCanvasSvg = function(check_resize) { + + var render_to = d3.select("#" + this.divid); + + var rect = render_to.node().getBoundingClientRect(); + + var w = Math.round(rect.width - this.GetStyleValue(render_to, 'padding-left') - this.GetStyleValue(render_to, 'padding-right')); + var h = Math.round(rect.height - this.GetStyleValue(render_to, 'padding-top') - this.GetStyleValue(render_to, 'padding-bottom')); + var factor = null; + + var svg = null; + + if (check_resize > 0) { + + svg = this.svg_canvas(); + + var oldw = svg.property('last_width'); + var oldh = svg.property('last_height'); + + if ((w<=0) && (h<=0)) { + svg.attr("visibility", "hidden"); + return false; + } else { + svg.attr("visibility", "visible"); + } + + if (check_resize == 1) { + if ((svg.attr('width') == w) && (svg.attr('height') == h)) return false; + if ((oldw == w) && (oldh == h)) return false; + } + + factor = svg.property('height_factor'); + + if (factor!=null) { + // if canvas was resize when created, resize height also now + h = Math.round(w * factor); + render_to.style('height', h+'px'); + } + + if ((check_resize==1) && (oldw>0) && (oldh>0) && !svg.property('redraw_by_resize')) + if ((w/oldw>0.5) && (w/oldw<2) && (h/oldh>0.5) && (h/oldh<2)) { + // change view port without changing view box + // let SVG scale drawing itself + svg.attr("width", w).attr("height", h); + return false; + } + + } else { + + if ((h < 10) && (w > 0)) { + // set aspect ratio for the place, where object will be drawn + + factor = 0.66; + + // for TCanvas reconstruct ratio between width and height + if ((this.pad!=null) && ('fCw' in this.pad) && ('fCh' in this.pad) && (this.pad['fCw'] > 0)) { + factor = this.pad['fCh'] / this.pad['fCw']; + if ((factor < 0.1) || (factor > 10)) + factor = 0.66; + } + + h = Math.round(w * factor); + + render_to.style('height', h+'px'); + } + + var fill = null; + + if (this.pad && 'fFillColor' in this.pad) + fill = this.createAttFill(this.pad); + else + fill = this.createAttFill('white'); + + render_to.style("background-color", fill.color); + + svg = d3.select("#" + this.divid) + .append("svg") + .attr("class", "root_canvas") + .style("background-color", fill.color) + .property('pad_painter', this) // this is custom property + .property('mainpainter', null) // this is custom property + .property('current_pad', "") // this is custom property + + svg.append("svg:g").attr("class","frame_layer"); + svg.append("svg:g").attr("class","text_layer"); + svg.append("svg:g").attr("class","stat_layer"); + } + + if ((w<=0) || (h<=0)) { + svg.attr("visibility", "hidden"); + w = 200; h = 100; // just to complete drawing + } else { + svg.attr("visibility", "visible"); + } + + svg.attr("width", w).attr("height", h) + .attr("viewBox", "0 0 " + w + " " + h) + .attr("preserveAspectRatio", "none") // we do not preserve relative ratio + .property('height_factor', factor) + .property('last_width', w) + .property('last_height', h) + .property('redraw_by_resize', false); + + return true; + } + + + JSROOT.TPadPainter.prototype.CreatePadSvg = function(only_resize) { + var width = Number(this.svg_canvas().attr("width")), + height = Number(this.svg_canvas().attr("height")); + var x = Math.round(this.pad['fAbsXlowNDC'] * width); + var y = Math.round(height - this.pad['fAbsYlowNDC'] * height); + var w = Math.round(this.pad['fAbsWNDC'] * width); + var h = Math.round(this.pad['fAbsHNDC'] * height); + y -= h; + + var fill = this.createAttFill(this.pad); + var attline = JSROOT.Painter.createAttLine(this.pad) + if (this.pad['fBorderMode'] == 0) attline.color = 'none'; + + var svg_pad = null, svg_rect = null; + + if (only_resize) { + svg_pad = this.svg_pad(); + svg_rect = svg_pad.select(".root_pad_border"); + } else { + svg_pad = this.svg_canvas().append("g") + .attr("class", "root_pad") + .attr("pad", this.pad['fName']) // set extra attribute to mark pad name + .property('pad_painter', this) // this is custom property + .property('mainpainter', null); // this is custom property + svg_rect = svg_pad.append("svg:rect").attr("class", "root_pad_border"); + svg_pad.append("svg:g").attr("class","frame_layer"); + svg_pad.append("svg:g").attr("class","text_layer"); + svg_pad.append("svg:g").attr("class","stat_layer"); + } + + svg_pad.attr("width", w) + .attr("height", h) + .attr("viewBox", x + " " + y + " " + (x+w) + " " + (y+h)) + .attr("transform", "translate(" + x + "," + y + ")"); + + svg_rect.attr("x", 0) + .attr("y", 0) + .attr("width", w) + .attr("height", h) + .call(fill.func) + .call(attline.func); + } + + JSROOT.TPadPainter.prototype.CheckColors = function(can) { + if (can==null) return; + for (var i in can.fPrimitives.arr) { + var obj = can.fPrimitives.arr[i]; + if (obj==null) continue; + if ((obj._typename=="TObjArray") && (obj.name == "ListOfColors")) { + JSROOT.Painter.adoptRootColors(obj); + can.fPrimitives.arr.splice(i,1); + can.fPrimitives.opt.splice(i,1); + return; + } + } + } + + JSROOT.TPadPainter.prototype.DrawPrimitives = function() { + if (this.pad==null) return; + + for (var i in this.pad.fPrimitives.arr) { + var pp = JSROOT.draw(this.divid, this.pad.fPrimitives.arr[i], this.pad.fPrimitives.opt[i]); + if (pp) pp['_primitive'] = true; // mark painter as belonging to primitive + } + } + + JSROOT.TPadPainter.prototype.Redraw = function() { + if (this.iscan) + this.CreateCanvasSvg(2); + else + this.CreatePadSvg(true); + + // at the moment canvas painter donot redraw its subitems + for (var i in this.painters) + this.painters[i].Redraw(); + } + + JSROOT.TPadPainter.prototype.CheckCanvasResize = function() { + if (!this.iscan) return; + + var changed = this.CreateCanvasSvg(1); + + // at the moment canvas painter donot redraw its subitems + if (changed) + for (var i in this.painters) + this.painters[i].Redraw(); + } + + JSROOT.TPadPainter.prototype.UpdateObject = function(obj) { + + if ((obj == null) || !('fPrimitives' in obj)) return false; + + if (this.iscan) this.CheckColors(obj); + + if (obj.fPrimitives.arr.length != this.pad.fPrimitives.arr.length) return false; + + var isany = false, p = 0; + + for (var n in obj.fPrimitives.arr) { + var sub = obj.fPrimitives.arr[n]; + + while (p s_width*0.8) tickSize = s_width*0.8; + + // Draw palette pad + this.RecreateDrawG(true, ".text_layer"); + + this.draw_g + .attr("x", pos_x).attr("y", pos_y) // position required only for drag functions + .attr("width", s_width).attr("height", s_height) // dimension required only for drag functions + .attr("transform", "translate(" + pos_x + ", " + pos_y + ")"); + + + for (var i=0;i width-3) xoffset = width - 3 - pos_x; + var tcolor = JSROOT.Painter.root_colors[axis['fTextColor']]; + this.StartTextDrawing(axis['fTextFont'], axis['fTitleSize'] * height); + this.DrawText(33, 0, xoffset, 0, -270, axis['fTitle'], tcolor); + this.FinishTextDrawing(); + } + + this.AddDrag({ obj: palette, redraw: 'DrawPalette' }); + + if (!JSROOT.gStyle.Zooming) return; + + var pthis = this, evnt = null, doing_zoom = false, sel1 = 0, sel2 = 0, zoom_rect = null; + + function moveRectSel() { + + if (!doing_zoom) return; + + d3.event.preventDefault(); + var m = d3.mouse(evnt); + + if (m[1] < sel1) sel1 = m[1]; else sel2 = m[1]; + + zoom_rect.attr("y", sel1) + .attr("height", Math.abs(sel2-sel1)); + } + + function endRectSel() { + if (!doing_zoom) return; + + d3.event.preventDefault(); + // d3.select(window).on("touchmove.zoomRect", + // null).on("touchend.zoomRect", null); + d3.select(window).on("mousemove.colzoomRect", null) + .on("mouseup.colzoomRect", null); + // d3.select("body").classed("noselect", false); + // d3.select("body").style("-webkit-user-select", "auto"); + zoom_rect.remove(); + zoom_rect = null; + doing_zoom = false; + + var zmin = Math.min(z.invert(sel1), z.invert(sel2)); + var zmax = Math.max(z.invert(sel1), z.invert(sel2)); + + pthis.main_painter().Zoom(0, 0, 0, 0, zmin, zmax); + } + + function startRectSel() { + + // ignore when touch selection is actiavated + if (doing_zoom) return; + doing_zoom = true; + + d3.event.preventDefault(); + + evnt = this; + var origin = d3.mouse(evnt); + + sel1 = sel2 = origin[1]; + + zoom_rect = pthis.draw_g + .append("svg:rect") + .attr("class", "zoom") + .attr("id", "colzoomRect") + .attr("x", "0") + .attr("width", s_width) + .attr("y", sel1) + .attr("height", 5); + + d3.select(window).on("mousemove.colzoomRect", moveRectSel) + .on("mouseup.colzoomRect", endRectSel, true); + + d3.event.stopPropagation(); + } + + this.draw_g.append("svg:rect") + .attr("x", s_width) + .attr("y", 0) + .attr("width", 20) + .attr("height", s_height) + .style("cursor", "crosshair") + .style("opacity", "0") + .on("mousedown", startRectSel); + } + + JSROOT.TPaletteAxisPainter.prototype.Redraw = function() { + + var enabled = true; + + if ('options' in this.main_painter()) + enabled = (this.main_painter().options.Zscale > 0) && (this.main_painter().options.Color > 0); + + if (enabled) { + this.DrawPalette(); + } else { + // if palette artificially disabled, do not redraw it + this.RemoveDrawG(); + } + } + + JSROOT.Painter.drawPaletteAxis = function(divid, palette) { + var painter = new JSROOT.TPaletteAxisPainter(palette); + + painter.SetDivId(divid); + + painter.DrawPalette(); + + return painter; + } + + // ============================================================= + + JSROOT.THistPainter = function(histo) { + JSROOT.TObjectPainter.call(this, histo); + this.histo = histo; + this.shrink_frame_left = 0.; + this.draw_content = true; + this.nbinsx = 0; + this.nbinsy = 0; + this.x_kind = 'normal'; // 'normal', 'time', 'labels' + this.y_time = false; + } + + JSROOT.THistPainter.prototype = Object.create(JSROOT.TObjectPainter.prototype); + + JSROOT.THistPainter.prototype.GetObject = function() { + return this.histo; + } + + JSROOT.THistPainter.prototype.IsTProfile = function() { + return this.histo && this.histo['_typename'] == 'TProfile'; + } + + JSROOT.THistPainter.prototype.IsTH2Poly = function() { + return this.histo && this.histo['_typename'].match(/^TH2Poly/); + } + + JSROOT.THistPainter.prototype.Dimension = function() { + if (!this.histo) return 0; + if ('fDimension' in this.histo) return this.histo['fDimension']; + if (this.histo['_typename'].match(/^TH2/)) return 2; + if (this.histo['_typename'].match(/^TH3/)) return 3; + return 1; + } + + JSROOT.THistPainter.prototype.DecodeOptions = function(opt) { + if ((opt == null) || (opt == "")) opt = this.histo['fOption']; + + /* decode string 'opt' and fill the option structure */ + var hdim = this.Dimension(); + var option = { + Axis: 0, Bar: 0, Curve: 0, Error: 0, Hist: 0, Line: 0, + Mark: 0, Fill: 0, Same: 0, Scat: 0, Func: 0, Star: 0, + Arrow: 0, Box: 0, Text: 0, Char: 0, Color: 0, Contour: 0, + Lego: 0, Surf: 0, Off: 0, Tri: 0, Proj: 0, AxisPos: 0, + Spec: 0, Pie: 0, List: 0, Zscale: 0, FrontBox: 1, BackBox: 1, + System: JSROOT.Painter.Coord.kCARTESIAN, + AutoColor : 0, NoStat : 0, AutoZoom : false, + HighRes: 0, Zero: 0, Logx: 0, Logy: 0, Logz: 0, Gridx: 0, Gridy: 0 + }; + // check for graphical cuts + var chopt = opt.toUpperCase(); + chopt = JSROOT.Painter.clearCuts(chopt); + if (hdim > 1) option.Scat = 1; + if ((hdim==1) && (this.histo.fSumw2.length>0)) option.Error = 2; + if ('fFunctions' in this.histo) option.Func = 1; + + if (chopt.indexOf('AUTOCOL') != -1) { + option.AutoColor = 1; + option.Hist = 1; + chopt = chopt.replace('AUTOCOL', ''); + } + if (chopt.indexOf('AUTOZOOM') != -1) { + option.AutoZoom = 1; + option.Hist = 1; + chopt = chopt.replace('AUTOZOOM', ''); + } + if (chopt.indexOf('NOSTAT') != -1) { + option.NoStat = 1; + chopt = chopt.replace('NOSTAT', ''); + } + if (chopt.indexOf('LOGX') != -1) { + option.Logx = 1; + chopt = chopt.replace('LOGX', ''); + } + if (chopt.indexOf('LOGY') != -1) { + option.Logy = 1; + chopt = chopt.replace('LOGY', ''); + } + if (chopt.indexOf('LOGZ') != -1) { + option.Logz = 1; + chopt = chopt.replace('LOGZ', ''); + } + + chopt = chopt.trim(); + while ((chopt.length>0) && (chopt[0]==',' || chopt[0]==';')) chopt = chopt.substr(1); + + var nch = chopt.length; + if (!nch) option.Hist = 1; + + var l = chopt.indexOf('SPEC'); + if (l != -1) { + option.Scat = 0; + chopt = chopt.replace('SPEC', ' '); + var bs = 0; + l = chopt.indexOf('BF('); + if (l != -1) bs = parseInt(chopt) + option.Spec = Math.max(1600, bs); + return option; + } + if (chopt.indexOf('GL') != -1) chopt = chopt.replace('GL', ' '); + if (chopt.indexOf('X+') != -1) { + option.AxisPos = 10; + chopt = chopt.replace('X+', ' '); + } + if (chopt.indexOf('Y+') != -1) { + option.AxisPos += 1; + chopt = chopt.replace('Y+', ' '); + } + if ((option.AxisPos == 10 || option.AxisPos == 1) && (nch == 2)) + option.Hist = 1; + if (option.AxisPos == 11 && nch == 4) + option.Hist = 1; + if (chopt.indexOf('SAMES') != -1) { + if (nch == 5) option.Hist = 1; + option.Same = 2; + chopt = chopt.replace('SAMES', ' '); + } + if (chopt.indexOf('SAME') != -1) { + if (nch == 4) option.Hist = 1; + option.Same = 1; + chopt = chopt.replace('SAME', ' '); + } + if (chopt.indexOf('PIE') != -1) { + option.Pie = 1; + chopt = chopt.replace('PIE', ' '); + } + l = chopt.indexOf('LEGO'); + if (l != -1) { + option.Scat = 0; + option.Lego = 1; + chopt = chopt.replace('LEGO', ' '); + if (chopt[l + 4] == '1') { + option.Lego = 11; + chopt[l + 4] = ' '; + } + if (chopt[l + 4] == '2') { + option.Lego = 12; + chopt[l + 4] = ' '; + } + if (chopt[l + 4] == '3') { + option.Lego = 13; + chopt[l + 4] = ' '; + } + l = chopt.indexOf('FB'); + if (l != -1) { + option.FrontBox = 0; + chopt = chopt.replace('FB', ' '); + } + l = chopt.indexOf('BB'); + if (l != -1) { + option.BackBox = 0; + chopt = chopt.replace('BB', ' '); + } + l = chopt.indexOf('0'); + if (l != -1) { + option.Zero = 1; + chopt = chopt.replace('0', ' '); + } + } + l = chopt.indexOf('SURF'); + if (l != -1) { + option.Scat = 0; + option.Surf = 1; + chopt = chopt.replace('SURF', ' '); + if (chopt[l + 4] == '1') { + option.Surf = 11; + chopt[l + 4] = ' '; + } + if (chopt[l + 4] == '2') { + option.Surf = 12; + chopt[l + 4] = ' '; + } + if (chopt[l + 4] == '3') { + option.Surf = 13; + chopt[l + 4] = ' '; + } + if (chopt[l + 4] == '4') { + option.Surf = 14; + chopt[l + 4] = ' '; + } + if (chopt[l + 4] == '5') { + option.Surf = 15; + chopt[l + 4] = ' '; + } + if (chopt[l + 4] == '6') { + option.Surf = 16; + chopt[l + 4] = ' '; + } + if (chopt[l + 4] == '7') { + option.Surf = 17; + chopt[l + 4] = ' '; + } + l = chopt.indexOf('FB'); + if (l != -1) { + option.FrontBox = 0; + chopt = chopt.replace('FB', ' '); + } + l = chopt.indexOf('BB'); + if (l != -1) { + option.BackBox = 0; + chopt = chopt.replace('BB', ' '); + } + } + l = chopt.indexOf('TF3'); + if (l != -1) { + l = chopt.indexOf('FB'); + if (l != -1) { + option.FrontBox = 0; + chopt = chopt.replace('FB', ' '); + } + l = chopt.indexOf('BB'); + if (l != -1) { + option.BackBox = 0; + chopt = chopt.replace('BB', ' '); + } + } + l = chopt.indexOf('ISO'); + if (l != -1) { + l = chopt.indexOf('FB'); + if (l != -1) { + option.FrontBox = 0; + chopt = chopt.replace('FB', ' '); + } + l = chopt.indexOf('BB'); + if (l != -1) { + option.BackBox = 0; + chopt = chopt.replace('BB', ' '); + } + } + l = chopt.indexOf('LIST'); + if (l != -1) { + option.List = 1; + chopt = chopt.replace('LIST', ' '); + } + l = chopt.indexOf('CONT'); + if (l != -1) { + chopt = chopt.replace('CONT', ' '); + if (hdim > 1) { + option.Scat = 0; + option.Contour = 1; + if (chopt[l + 4] == '1') { + option.Contour = 11; + chopt[l + 4] = ' '; + } + if (chopt[l + 4] == '2') { + option.Contour = 12; + chopt[l + 4] = ' '; + } + if (chopt[l + 4] == '3') { + option.Contour = 13; + chopt[l + 4] = ' '; + } + if (chopt[l + 4] == '4') { + option.Contour = 14; + chopt[l + 4] = ' '; + } + if (chopt[l + 4] == '5') { + option.Contour = 15; + chopt[l + 4] = ' '; + } + } else { + option.Hist = 1; + } + } + l = chopt.indexOf('HBAR'); + if (l != -1) { + option.Hist = 0; + option.Bar = 20; + chopt = chopt.replace('HBAR', ' '); + if (chopt[l + 4] == '1') { + option.Bar = 21; + chopt[l + 4] = ' '; + } + if (chopt[l + 4] == '2') { + option.Bar = 22; + chopt[l + 4] = ' '; + } + if (chopt[l + 4] == '3') { + option.Bar = 23; + chopt[l + 4] = ' '; + } + if (chopt[l + 4] == '4') { + option.Bar = 24; + chopt[l + 4] = ' '; + } + } + l = chopt.indexOf('BAR'); + if (l != -1) { + option.Hist = 0; + option.Bar = 10; + chopt = chopt.replace('BAR', ' '); + if (chopt[l + 3] == '1') { + option.Bar = 11; + chopt[l + 3] = ' '; + } + if (chopt[l + 3] == '2') { + option.Bar = 12; + chopt[l + 3] = ' '; + } + if (chopt[l + 3] == '3') { + option.Bar = 13; + chopt[l + 3] = ' '; + } + if (chopt[l + 3] == '4') { + option.Bar = 14; + chopt[l + 3] = ' '; + } + } + l = chopt.indexOf('ARR'); + if (l != -1) { + chopt = chopt.replace('ARR', ' '); + if (hdim > 1) { + option.Arrow = 1; + option.Scat = 0; + } else { + option.Hist = 1; + } + } + l = chopt.indexOf('BOX'); + if (l != -1) { + chopt = chopt.replace('BOX', ' '); + if (hdim > 1) { + Hoption.Scat = 0; + Hoption.Box = 1; + if (chopt[l + 3] == '1') { + option.Box = 11; + chopt[l + 3] = ' '; + } + } else { + option.Hist = 1; + } + } + + l = chopt.indexOf('COL'); + if (l!=-1) { + var name = 'COL'; + + if (chopt.charAt(l+3)=='1') { option.Color = 1; name += "1"; l++; } else + if (chopt.charAt(l+3)=='2') { option.Color = 2; name += "2"; l++; } else + if (chopt.charAt(l+3)=='3') { option.Color = 3; name += "3"; l++; } else + option.Color = JSROOT.gStyle.DefaultCol; + + if (chopt.charAt(l+4)=='Z') { option.Zscale = 1; name += 'Z'; } + chopt = chopt.replace(name, ''); + if (hdim == 1) { + option.Hist = 1; + } else { + option.Scat = 0; + } + } + + if (chopt.indexOf('CHAR') != -1) { + option.Char = 1; + chopt = chopt.replace('CHAR', ' '); + option.Scat = 0; + } + l = chopt.indexOf('FUNC'); + if (l != -1) { + option.Func = 2; + chopt = chopt.replace('FUNC', ' '); + option.Hist = 0; + } + l = chopt.indexOf('HIST'); + if (l != -1) { + option.Hist = 2; + chopt = chopt.replace('HIST', ' '); + option.Func = 0; + option.Error = 0; + } + if (chopt.indexOf('AXIS') != -1) { + option.Axis = 1; + chopt = chopt.replace('AXIS', ' '); + } + if (chopt.indexOf('AXIG') != -1) { + option.Axis = 2; + chopt = chopt.replace('AXIG', ' '); + } + if (chopt.indexOf('SCAT') != -1) { + option.Scat = 1; + chopt = chopt.replace('SCAT', ' '); + } + l = chopt.indexOf('TEXT'); + if (l != -1) { + var angle = parseInt(chopt); + if (!isNaN(angle)) { + if (angle < 0) + angle = 0; + if (angle > 90) + angle = 90; + option.Text = 1000 + angle; + } else { + option.Text = 1; + } + chopt = chopt.replace('TEXT', ' '); + l = chopt.indexOf('N'); + if (l != -1 && this.IsTH2Poly()) + option.Text += 3000; + option.Scat = 0; + } + if (chopt.indexOf('POL') != -1) { + option.System = JSROOT.Painter.Coord.kPOLAR; + chopt = chopt.replace('POL', ' '); + } + if (chopt.indexOf('CYL') != -1) { + option.System = JSROOT.Painter.Coord.kCYLINDRICAL; + chopt = chopt.replace('CYL', ' '); + } + if (chopt.indexOf('SPH') != -1) { + option.System = JSROOT.Painter.Coord.kSPHERICAL; + chopt = chopt.replace('SPH', ' '); + } + l = chopt.indexOf('PSR'); + if (l != -1) { + option.System = JSROOT.Painter.Coord.kRAPIDITY; + chopt = chopt.replace('PSR', ' '); + } + l = chopt.indexOf('TRI'); + if (l != -1) { + option.Scat = 0; + option.Color = 0; + option.Tri = 1; + chopt = chopt.replace('TRI', ' '); + l = chopt.indexOf('FB'); + if (l != -1) { + option.FrontBox = 0; + chopt = chopt.replace('FB', ' '); + } + l = chopt.indexOf('BB'); + if (l != -1) { + option.BackBox = 0; + chopt = chopt.replace('BB', ' '); + } + l = chopt.indexOf('ERR'); + if (l != -1) + chopt = chopt.replace('ERR', ' '); + } + l = chopt.indexOf('AITOFF'); + if (l != -1) { + Hoption.Proj = 1; + chopt = chopt.replace('AITOFF', ' '); // Aitoff projection + } + l = chopt.indexOf('MERCATOR'); + if (l != -1) { + option.Proj = 2; + chopt = chopt.replace('MERCATOR', ' '); // Mercator projection + } + l = chopt.indexOf('SINUSOIDAL'); + if (l != -1) { + option.Proj = 3; + chopt = chopt.replace('SINUSOIDAL', ' '); // Sinusoidal + // projection + } + l = chopt.indexOf('PARABOLIC'); + if (l != -1) { + option.Proj = 4; + chopt = chopt.replace('PARABOLIC', ' '); // Parabolic + // projection + } + if (option.Proj > 0) { + option.Scat = 0; + option.Contour = 14; + } + if (chopt.indexOf('A') != -1) + option.Axis = -1; + if (chopt.indexOf('B') != -1) + option.Bar = 1; + if (chopt.indexOf('C') != -1) { + option.Curve = 1; + option.Hist = -1; + } + if (chopt.indexOf('F') != -1) + option.Fill = 1; + if (chopt.indexOf('][') != -1) { + option.Off = 1; + option.Hist = 1; + } + if (chopt.indexOf('F2') != -1) option.Fill = 2; + if (chopt.indexOf('L') != -1) { + option.Line = 1; + option.Hist = -1; + } + if (chopt.indexOf('P') != -1) { + option.Mark = 1; + option.Hist = -1; + } + if (chopt.indexOf('Z') != -1) option.Zscale = 1; + if (chopt.indexOf('*') != -1) option.Star = 1; + if (chopt.indexOf('H') != -1) option.Hist = 2; + if (chopt.indexOf('P0') != -1) option.Mark = 10; + if (this.IsTH2Poly()) { + if (option.Fill + option.Line + option.Mark != 0) option.Scat = 0; + } + + if (chopt.indexOf('E') != -1) { + if (hdim == 1) { + option.Error = 1; + if (chopt.indexOf('E0') != -1) option.Error = 10; + if (chopt.indexOf('E1') != -1) option.Error = 11; + if (chopt.indexOf('E2') != -1) option.Error = 12; + if (chopt.indexOf('E3') != -1) option.Error = 13; + if (chopt.indexOf('E4') != -1) option.Error = 14; + if (chopt.indexOf('E5') != -1) option.Error = 15; + if (chopt.indexOf('E6') != -1) option.Error = 16; + if (chopt.indexOf('X0') != -1) { + if (option.Error == 1) option.Error += 20; + option.Error += 10; + } + if (option.Text && this.IsTProfile()) { + option.Text += 2000; + option.Error = 0; + } + } else { + if (option.Error == 0) { + option.Error = 100; + option.Scat = 0; + } + if (option.Text) { + option.Text += 2000; + option.Error = 0; + } + } + } + if (chopt.indexOf('9') != -1) option.HighRes = 1; + if (option.Surf == 15) { + if (option.System == JSROOT.Painter.Coord.kPOLAR + || option.System == JSROOT.Painter.Coord.kCARTESIAN) { + option.Surf = 13; + // Warning('MakeChopt','option SURF5 is not supported in Cartesian + // and Polar modes'); + } + } + + // Check options incompatibilities + if (option.Bar == 1) option.Hist = -1; + + return option; + } + + JSROOT.THistPainter.prototype.GetAutoColor = function(col) { + if (this.options.AutoColor<=0) return col; + + var id = this.options.AutoColor; + this.options.AutoColor = id % 8 + 1; + return JSROOT.Painter.root_colors[id]; + } + + JSROOT.THistPainter.prototype.ScanContent = function() { + // function will be called once new histogram or + // new histogram content is assigned + // one should find min,max,nbins, maxcontent values + + alert("HistPainter.prototype.ScanContent not implemented"); + } + + JSROOT.THistPainter.prototype.CheckPadOptions = function() { + + var pad = this.root_pad(); + + if (pad!=null) { + // Copy options from current pad + this.options.Logx = pad['fLogx']; + this.options.Logy = pad['fLogy']; + this.options.Logz = pad['fLogz']; + this.options.Gridx = pad['fGridx']; + this.options.Gridy = pad['fGridy']; + } + + if (this.main_painter() !== this) return; + + this['zoom_xmin'] = 0; + this['zoom_xmax'] = 0; + + this['zoom_ymin'] = 0; + this['zoom_ymax'] = 0; + + this['zoom_zmin'] = 0; + this['zoom_zmax'] = 0; + + if ((pad!=null) && ('fUxmin' in pad) && !this.create_canvas) { + this['zoom_xmin'] = pad.fUxmin; + this['zoom_xmax'] = pad.fUxmax; + this['zoom_ymin'] = pad.fUymin; + this['zoom_ymax'] = pad.fUymax; + + if (pad.fLogx > 0) { + this['zoom_xmin'] = Math.exp(this['zoom_xmin'] * Math.log(10)); + this['zoom_xmax'] = Math.exp(this['zoom_xmax'] * Math.log(10)); + } + + if (pad.fLogy > 0) { + this['zoom_ymin'] = Math.exp(this['zoom_ymin'] * Math.log(10)); + this['zoom_ymax'] = Math.exp(this['zoom_ymax'] * Math.log(10)); + } + } + } + + + JSROOT.THistPainter.prototype.UpdateObject = function(obj) { + if (obj['_typename'] != this.histo['_typename']) { + alert("JSROOT.THistPainter.UpdateObject - wrong class " + obj['_typename'] + " expected " + this.histo['_typename']); + return false; + } + + // TODO: simple replace of object does not help - one can have different + // complex relations between histo and stat box, histo and colz axis, + // on could have THStack or TMultiGraph object + // The only that could be done is update of content + + // this.histo = obj; + + this.histo['fArray'] = obj['fArray']; + this.histo['fNcells'] = obj['fNcells']; + this.histo['fTitle'] = obj['fTitle']; + this.histo['fMinimum'] = obj['fMinimum']; + this.histo['fMaximum'] = obj['fMaximum']; + this.histo['fXaxis']['fNbins'] = obj['fXaxis']['fNbins']; + this.histo['fXaxis']['fXmin'] = obj['fXaxis']['fXmin']; + this.histo['fXaxis']['fXmax'] = obj['fXaxis']['fXmax']; + this.histo['fYaxis']['fXmin'] = obj['fYaxis']['fXmin']; + this.histo['fYaxis']['fXmax'] = obj['fYaxis']['fXmax']; + + if (this.IsTProfile()) { + this.histo['fBinEntries'] = obj['fBinEntries']; + this.histo['fSumw2'] = obj['fSumw2']; + } + + this.ScanContent(); + + return true; + } + + JSROOT.THistPainter.prototype.CreateXY = function() { + // here we create x,y objects which maps our physical coordnates into pixels + // while only first painter really need such object, all others just reuse it + // following functions are introduced + // this.GetBin[X/Y] return bin coordinate + // this.Convert[X/Y] converts root value in JS date when date scale is used + // this.[x,y] these are d3.scale objects + // this.gr[x,y] converts root scale into graphical value + // this.Revert[X/Y] converts graphical coordinates to root scale value + + if (!this.is_main_painter()) { + this['x'] = this.main_painter()['x']; + this['y'] = this.main_painter()['y']; + return; + } + + var w = this.frame_width(), h = this.frame_height(); + + if (this.histo['fXaxis']['fTimeDisplay']) { + this.x_kind = 'time'; + this['timeoffsetx'] = JSROOT.Painter.getTimeOffset(this.histo['fXaxis']); + this['ConvertX'] = function(x) { return new Date(this.timeoffsetx + x*1000); }; + this['RevertX'] = function(grx) { return (this.x.invert(grx) - this.timeoffsetx) / 1000; }; + } else { + this.x_kind = this.histo['fXaxis'].fLabels== null ? 'normal' : 'labels'; + this['ConvertX'] = function(x) { return x; }; + this['RevertX'] = function(grx) { return this.x.invert(grx); }; + } + + this['scale_xmin'] = this.xmin; + this['scale_xmax'] = this.xmax; + if (this.zoom_xmin != this.zoom_xmax) { + this['scale_xmin'] = this.zoom_xmin; + this['scale_xmax'] = this.zoom_xmax; + } + + if (this.x_kind == 'time') { + this['x'] = d3.time.scale(); + } else + if (this.options.Logx) { + if (this.scale_xmax <= 0) this.scale_xmax = 0; + + if ((this.scale_xmin <= 0) && (this.nbinsx>0)) + for (var i=0;i0) { this.scale_xmin = left; break; } + } + + if ((this.scale_xmin <= 0) || (this.scale_xmin >= this.scale_xmax)) { + this.scale_xmin = this.scale_xmax * 0.0001; + } + + this['x'] = d3.scale.log(); + } else { + this['x'] = d3.scale.linear(); + } + + this.x.domain([this.ConvertX(this.scale_xmin), this.ConvertX(this.scale_xmax)]).range([ 0, w ]); + + if (this.x_kind == 'time') { + // we emulate scale functionality + this['grx'] = function(val) { return this.x(this.ConvertX(val)); } + } else + if (this.options.Logx) { + this['grx'] = function(val) { return (val < this.scale_xmin) ? - 5 : this.x(val); } + } else { + this['grx'] = this.x; + } + + this['scale_ymin'] = this.ymin; + this['scale_ymax'] = this.ymax; + + if ((this.Dimension()==1) && (this.histo.fMinimum != -1111) && (this.histo.fMaximum != -1111)) { + // only for 1D histogram use min.max for range selection + this['scale_ymin'] = this.histo.fMinimum; + this['scale_ymax'] = this.histo.fMaximum; + } + + if (this.zoom_ymin != this.zoom_ymax) { + this['scale_ymin'] = this.zoom_ymin; + this['scale_ymax'] = this.zoom_ymax; + } + + if (this.histo['fYaxis']['fTimeDisplay']) { + this.y_time = true; + this['timeoffsety'] = JSROOT.Painter.getTimeOffset(this.histo['fYaxis']); + this['ConvertY'] = function(y) { return new Date(this.timeoffsety + y*1000); }; + this['RevertY'] = function(gry) { return (this.y.invert(gry) - this.timeoffsety) / 1000; }; + } else { + this.y_time = false; + this['ConvertY'] = function(y) { return y; }; + this['RevertY'] = function(gry) { return this.y.invert(gry); }; + } + + if (this.options.Logy) { + if (this.scale_ymax <= 0) this.scale_ymax = 1; + + if ((this.scale_ymin <= 0) && (this.nbinsy>0)) + for (var i=0;i0) { this.scale_ymin = down; break; } + } + + if ((this.scale_ymin <= 0) && ('ymin_nz' in this) && (this.ymin_nz > 0)) + this.scale_ymin = 0.3*this.ymin_nz; + + if ((this.scale_ymin <= 0) || (this.scale_ymin >= this.scale_ymax)) + this.scale_ymin = 0.000001 * this.scale_ymax; + this['y'] = d3.scale.log(); + } else + if (this.y_time) { + this['y'] = d3.time.scale(); + } else { + this['y'] = d3.scale.linear() + } + + this['y'].domain([ this.ConvertY(this.scale_ymin), this.ConvertY(this.scale_ymax) ]).range([ h, 0 ]); + + if (this.y_time) { + // we emulate scale functionality + this['gry'] = function(val) { return this.y(this.ConvertY(val)); } + } else + if (this.options.Logy) { + // make protecttion for log + this['gry'] = function(val) { return (val < this.scale_ymin) ? h+5 : this.y(val); } + } else { + this['gry'] = this.y; + } + + } + + JSROOT.THistPainter.prototype.DrawGrids = function() { + // grid can only be drawn by first painter + if (!this.is_main_painter()) return; + + var layer = this.svg_frame().select(".grid_layer"); + + layer.selectAll(".xgrid").remove(); + layer.selectAll(".ygrid").remove(); + /* add a grid on x axis, if the option is set */ + + // add a grid on x axis, if the option is set + if (this.options.Gridx) { + + var h = this.frame_height(); + + var xticks = this.x.ticks(this.x_nticks); + + layer.selectAll(".xgrid") + .data(xticks).enter() + .append("svg:line") + .attr("class", "xgrid") + .attr("x1", this.x) + .attr("y1", h) + .attr("x2", this.x) + .attr("y2",0) + .style("stroke", "black") + .style("stroke-width", 1) + .style("stroke-dasharray", JSROOT.Painter.root_line_styles[11]); + } + + // add a grid on y axis, if the option is set + if (this.options.Gridy) { + var w = this.frame_width(); + + var yticks = this.y.ticks(this.y_nticks); + + layer.selectAll('.ygrid') + .data(yticks).enter() + .append("svg:line") + .attr("class", "ygrid") + .attr("x1", 0) + .attr("y1", this.y) + .attr("x2", w) + .attr("y2", this.y) + .style("stroke", "black") + .style("stroke-width", 1) + .style("stroke-dasharray", JSROOT.Painter.root_line_styles[11]); + } + } + + JSROOT.THistPainter.prototype.DrawBins = function() { + alert("HistPainter.DrawBins not implemented"); + } + + JSROOT.THistPainter.prototype.AxisAsText = function(axis, value) { + if (axis == "x") { + if (this.x_kind == 'time') { + value = this.ConvertX(value); + // this is indication of time format + if ('formatx' in this) return this.formatx(value); + return value.toString(); + } + + if (this.x_kind == 'labels') { + var indx = parseInt(value) + 1; + if ((indx<1) || (indx>this.histo['fXaxis'].fNbins)) return null; + for (var i in this.histo['fXaxis'].fLabels.arr) { + var tstr = this.histo['fXaxis'].fLabels.arr[i]; + if (tstr.fUniqueID == indx) return tstr.fString; + } + } + + if (Math.abs(value) < 1e-14) + if (Math.abs(this.xmax - this.xmin) > 1e-5) value = 0; + return value.toPrecision(4); + } + + if (axis == "y") { + if ('dfy' in this) { + return this.dfy(new Date(this.timeoffsety + value * 1000)); + } + if (Math.abs(value) < 1e-14) + if (Math.abs(this.ymax - this.ymin) > 1e-5) + value = 0; + return value.toPrecision(4); + } + + return value.toPrecision(4); + } + + JSROOT.THistPainter.prototype.DrawAxes = function(shrink_forbidden) { + // axes can be drawn only for main histogram + + if (!this.is_main_painter()) return; + + var w = this.frame_width(), h = this.frame_height(); + + var xax_g = this.svg_frame().selectAll(".xaxis_container"); + if (xax_g.empty()) + xax_g = this.svg_frame().select(".axis_layer").append("svg:g").attr("class","xaxis_container"); + + xax_g.selectAll("*").remove(); + xax_g.attr("transform", "translate(0," + h + ")"); + + var yax_g = this.svg_frame().selectAll(".yaxis_container"); + if (yax_g.empty()) yax_g = this.svg_frame().select(".axis_layer").append("svg:g").attr("class", "yaxis_container"); + yax_g.selectAll("*").remove(); + + var ndivx = this.histo['fXaxis']['fNdivisions']; + this['x_nticks'] = ndivx % 100; // used also to draw grids + var n2ax = (ndivx % 10000 - this.x_nticks) / 100; + var n3ax = ndivx / 10000; + + var ndivy = this.histo['fYaxis']['fNdivisions']; + this['y_nticks'] = ndivy % 100; // used also to draw grids + var n2ay = (ndivy % 10000 - this.y_nticks) / 100; + var n3ay = ndivy / 10000; + + /* X-axis label */ + var xlabelfont = JSROOT.Painter.getFontDetails(this.histo['fXaxis']['fLabelFont'], this.histo['fXaxis']['fLabelSize'] * h); + + var xAxisLabelOffset = 3 + (this.histo['fXaxis']['fLabelOffset'] * h); + + if (this.histo['fXaxis']['fTitle'].length > 0) { + this.StartTextDrawing(this.histo['fXaxis']['fTitleFont'], this.histo['fXaxis']['fTitleSize'] * h, xax_g); + + var res = this.DrawText('end', w, xAxisLabelOffset + xlabelfont.size * (1.+this.histo['fXaxis']['fTitleOffset']), + 0, 0, this.histo['fXaxis']['fTitle'], null, 1, xax_g); + + if (res<=0) shrink_forbidden = true; + + this.FinishTextDrawing(xax_g); + } + + /* Y-axis label */ + var yAxisLabelOffset = 3 + (this.histo['fYaxis']['fLabelOffset'] * w); + + var ylabelfont = JSROOT.Painter.getFontDetails(this.histo['fYaxis']['fLabelFont'], this.histo['fYaxis']['fLabelSize'] * h); + + if (this.histo['fYaxis']['fTitle'].length > 0) { + this.StartTextDrawing(this.histo['fYaxis']['fTitleFont'], this.histo['fYaxis']['fTitleSize'] * h, yax_g); + + var res = this.DrawText("end", 0, - yAxisLabelOffset - (1 + this.histo['fYaxis']['fTitleOffset']) * ylabelfont.size - yax_g.property('text_font').size, + 0, -270, this.histo['fYaxis']['fTitle'], null, 1, yax_g); + + if (res<=0) shrink_forbidden = true; + + this.FinishTextDrawing(yax_g); + } + + var xAxisColor = this.histo['fXaxis']['fAxisColor']; + var xDivLength = this.histo['fXaxis']['fTickLength'] * h; + var yAxisColor = this.histo['fYaxis']['fAxisColor']; + var yDivLength = this.histo['fYaxis']['fTickLength'] * w; + + var pthis = this; + + /* Define the scales, according to the information from the pad */ + + delete this['formatx']; + + if (this.x_kind == 'time') { + if (this.x_nticks > 8) this.x_nticks = 8; + + var scale_xrange = this.scale_xmax - this.scale_xmin; + var timeformatx = JSROOT.Painter.getTimeFormat(this.histo['fXaxis']); + if ((timeformatx.length == 0) || (scale_xrange < 0.1 * (this.xmax - this.xmin))) + timeformatx = JSROOT.Painter.chooseTimeFormat(scale_xrange, this.x_nticks); + + if (timeformatx.length > 0) + this['formatx'] = d3.time.format(timeformatx); + + } else if (this.options.Logx) { + + var noexpx = this.histo['fXaxis'].TestBit(JSROOT.EAxisBits.kNoExponent); + if (this.scale_xmax < 100 && this.scale_xmin > 0 && this.scale_xmax / this.scale_xmin < 100) noexpx = true; + var moreloglabelsx = this.histo['fXaxis'].TestBit(JSROOT.EAxisBits.kMoreLogLabels); + + this['formatx'] = function(d) { + var val = parseFloat(d); + var vlog = Math.abs(JSROOT.Math.log10(val)); + if (moreloglabelsx) { + if (vlog % 1 < 0.7 || vlog % 1 > 0.9999) { + if (noexpx) + return val.toFixed(); + else + return JSROOT.Painter.formatExp(val.toExponential(0)); + } else + return null; + } else { + if (vlog % 1 < 0.0001 || vlog % 1 > 0.9999) { + if (noexpx) + return val.toFixed(); + else + return JSROOT.Painter.formatExp(val.toExponential(0)); + } else + return null; + } + } + } else { + if (this.x_kind=='labels') { + if (this.x_nticks > 8) this.x_nticks = 8; + var scale_xrange = this.scale_xmax - this.scale_xmin; + if (this.x_nticks > scale_xrange) + this.x_nticks = parseInt(scale_xrange); + } + + this['formatx'] = function(d) { + // do not show x at all + if (this.x_kind=='labels') return this.AxisAsText("x", d); + + if ((Math.abs(d) < 1e-14) && (Math.abs(this.xmax - this.xmin) > 1e-5)) d = 0; + return parseFloat(d.toPrecision(12)); + } + } + + var x_axis = d3.svg.axis().scale(this.x).orient("bottom") + .tickPadding(xAxisLabelOffset) + .tickSize(-xDivLength, -xDivLength / 2, -xDivLength / 4) + .ticks(this.x_nticks); + + if ('formatx' in this) + x_axis.tickFormat(function(d) { return pthis.formatx(d); }); + + delete this['formaty']; + + if (this.y_time) { + if (this.y_nticks > 8) this.y_nticks = 8; + + var timeformaty = JSROOT.Painter.getTimeFormat(this.histo['fYaxis']); + + if ((timeformaty.length == 0) || (scale_yrange < 0.1 * (this.ymax - this.ymin))) + timeformaty = JSROOT.Painter.chooseTimeFormat(scale_yrange, this.y_nticks); + + if (timeformaty.length > 0) + this['formaty'] = d3.time.format(timeformaty); + + } else if (this.options.Logy) { + var noexpy = this.histo['fYaxis'].TestBit(JSROOT.EAxisBits.kNoExponent); + var moreloglabelsy = this.histo['fYaxis'].TestBit(JSROOT.EAxisBits.kMoreLogLabels); + if (this.scale_ymax < 100 && this.scale_ymin > 0 && this.scale_ymax / this.scale_ymin < 100) noexpy = true; + + this['formaty'] = function(d) { + var val = parseFloat(d); + var vlog = Math.abs(JSROOT.Math.log10(val)); + if (moreloglabelsy) { + if (vlog % 1 < 0.7 || vlog % 1 > 0.9999) { + if (noexpy) + return val.toFixed(); + else + return JSROOT.Painter.formatExp(val.toExponential(0)); + } else + return null; + } else { + if (vlog % 1 < 0.0001 || vlog % 1 > 0.9999) { + if (noexpy) + return val.toFixed(); + else + return JSROOT.Painter.formatExp(val.toExponential(0)); + } else + return null; + } + }; + } else { + if (this.y_nticks >= 10) this.y_nticks -= 2; + + this['formaty'] = function(d) { + if ((Math.abs(d) < 1e-14) && (Math.abs(pthis.ymax - pthis.ymin) > 1e-5)) d = 0; + return parseFloat(d.toPrecision(12)); + } + } + + var y_axis = d3.svg.axis() + .scale(this.y) + .orient("left") + .tickPadding(yAxisLabelOffset) + .tickSize(-yDivLength, -yDivLength / 2,-yDivLength / 4) + .ticks(this.y_nticks); + + if ('formaty' in this) + y_axis.tickFormat(function(d) { return pthis.formaty(d); }); + + var drawx = xax_g.append("svg:g").attr("class", "xaxis").call(x_axis); + + // this is additional ticks, required in d3.v3 + if (this.x_kind == 'labels') { + // shift labels + drawx.selectAll(".tick text") + .style("text-anchor", "start") + .attr("x", 10).attr("y", 6); + } else + if ((n2ax > 0) && !this.options.Logx) { + var x_axis_sub = + d3.svg.axis().scale(this.x).orient("bottom") + .tickPadding(xAxisLabelOffset).innerTickSize(-xDivLength / 2) + .tickFormat(function(d) { return; }) + .ticks(this.x.ticks(this.x_nticks).length * n2ax); + + xax_g.append("svg:g").attr("class", "xaxis").call(x_axis_sub); + } + + yax_g.append("svg:g").attr("class", "yaxis").call(y_axis); + + // this is additional ticks, required in d3.v3 + if ((n2ay > 0) && !this.options.Logy) { + var y_axis_sub = d3.svg.axis().scale(this.y).orient("left") + .tickPadding(yAxisLabelOffset).innerTickSize(-yDivLength / 2) + .tickFormat(function(d) { return; }) + .ticks(this.y.ticks(this.y_nticks).length * n2ay); + + yax_g.append("svg:g").attr("class", "yaxis").call(y_axis_sub); + } + + xax_g.call(xlabelfont.func); + yax_g.call(ylabelfont.func); + + // we will use such rect for zoom selection + if (JSROOT.gStyle.Zooming) { + xax_g.append("svg:rect") + .attr("x", 0) + .attr("y", 0) + .attr("width", w) + .attr("height", xlabelfont.size + 3) + .style('opacity', "0") + .style("cursor", "crosshair"); + + // we will use such rect for zoom selection + yax_g.append("svg:rect") + .attr("x",-2 * ylabelfont.size - 3) + .attr("y", 0) + .attr("width", 2 * ylabelfont.size + 3) + .attr("height", h) + .style('opacity', "0") + .style("cursor", "crosshair"); + } + + if ((shrink_forbidden==null) && typeof yax_g.node()['getBoundingClientRect'] == 'function') { + + var rect1 = yax_g.node().getBoundingClientRect(); + var rect2 = this.svg_pad().node().getBoundingClientRect(); + var position = rect1.left - rect2.left; + + var shrink = 0.; + + if (position < 0) { + shrink = -position/w + 0.001; + this.shrink_frame_left += shrink; + } else + if ((this.shrink_frame_left > 0) && (position/w > this.shrink_frame_left)) { + shrink = -this.shrink_frame_left; + this.shrink_frame_left = 0.; + } + + if (shrink != 0) { + this.svg_frame().property('frame_painter').Shrink(shrink, 0); + this.svg_frame().property('frame_painter').Redraw(); + this.CreateXY(); + this.DrawAxes(true); + } + } + } + + JSROOT.THistPainter.prototype.DrawTitle = function() { + + var painter = this.FindPainterFor(null,"title"); + + if (painter!=null) { + painter.pavetext.Clear(); + painter.pavetext.AddText(this.histo['fTitle']); + } else { + + var pavetext = JSROOT.Create("TPaveText"); + + JSROOT.extend(pavetext, { fName: "title", + fX1NDC: 0.2809483, fY1NDC: 0.9339831, + fX2NDC: 0.7190517, fY2NDC: 0.995}); + pavetext.AddText(this.histo['fTitle']); + + painter = JSROOT.Painter.drawPaveText(this.divid, pavetext); + } + } + + JSROOT.THistPainter.prototype.ToggleStat = function() { + + var stat = this.FindStat(); + + if (stat == null) { + + // when statbox created first time, one need to draw it + stat = this.CreateStat(); + + this.Redraw(); + + return; + } + + var statpainter = this.FindPainterFor(stat); + if (statpainter == null) { + alert("Did not found painter for existing stat??"); + return; + } + + statpainter.Enabled = !statpainter.Enabled; + + // when stat box is drawed, it always can be draw individualy while it + // should be last for colz RedrawPad is used + statpainter.Redraw(); + } + + JSROOT.THistPainter.prototype.IsAxisZoomed = function(axis) { + var obj = this.main_painter(); + if (obj == null) obj = this; + if (axis == "x") return obj.zoom_xmin != obj.zoom_xmax; + if (axis == "y") return obj.zoom_ymin != obj.zoom_ymax; + return false; + } + + JSROOT.THistPainter.prototype.GetSelectIndex = function(axis, size, add) { + // be aware - here indexs starts from 0 + var indx = 0; + var obj = this.main_painter(); + if (obj == null) obj = this; + var nbin = 0; + if (!add) add = 0; + + if (axis == "x") { + nbin = this.nbinsx; + if (obj.zoom_xmin != obj.zoom_xmax) { + if (size == "left") + indx = Math.floor((obj.zoom_xmin - this.xmin) / this.binwidthx + add); + else + indx = Math.round((obj.zoom_xmax - this.xmin) / this.binwidthx + 0.5 + add); + } else { + indx = (size == "left") ? 0 : nbin; + } + + } else + if (axis == "y") { + nbin = this.nbinsy; + if (obj.zoom_ymin != obj.zoom_ymax) { + if (size == "left") + indx = Math.floor((obj.zoom_ymin - this.ymin) / this.binwidthy + add); + else + indx = Math.round((obj.zoom_ymax - this.ymin) / this.binwidthy + 0.5 + add); + } else { + indx = (size == "left") ? 0 : nbin; + } + } + + if (size == "left") { + if (indx < 0) indx = 0; + } else { + if (indx > nbin) indx = nbin; + } + + return indx; + } + + JSROOT.THistPainter.prototype.FindStat = function() { + + if ('fFunctions' in this.histo) + for ( var i in this.histo.fFunctions.arr) { + + var func = this.histo.fFunctions.arr[i]; + + if (func['_typename'] == 'TPaveText' || func['_typename'] == 'TPaveStats') { + return func; + } + } + + return null; + } + + JSROOT.THistPainter.prototype.CreateStat = function() { + + if (!this.draw_content) return null; + if (this.FindStat() != null) return null; + + var stats = JSROOT.Create('TPaveStats'); + JSROOT.extend(stats, { _AutoCreated: true, + fName : 'stats', + fOptStat: JSROOT.gStyle.OptStat, + fOptFit: JSROOT.gStyle.OptFit, + fBorderSize : 1} ); + JSROOT.extend(stats, JSROOT.gStyle.StatNDC); + JSROOT.extend(stats, JSROOT.gStyle.StatText); + JSROOT.extend(stats, JSROOT.gStyle.StatFill); + + if (this.histo['_typename'] && (this.histo['_typename'].match(/^TProfile/) || this.histo['_typename'].match(/^TH2/))) + stats['fY1NDC'] = 0.67; + + stats.AddText(this.histo['fName']); + + if (!'fFunctions' in this.histo) + this.histo['fFunctions'] = JSROOT.Create("TList"); + + this.histo.fFunctions.arr.push(stats); + + return stats; + } + + JSROOT.THistPainter.prototype.FindF1 = function() { + // search for TF1 object in list of functions, it is fitted function + if (!('fFunctions' in this.histo)) return null; + for ( var i in this.histo.fFunctions.arr) { + var func = this.histo.fFunctions.arr[i]; + if (func['_typename'] == 'TF1') return func; + } + return null; + } + + JSROOT.THistPainter.prototype.DrawFunctions = function() { + + // draw statistics box & other TPaveTexts, which are belongs to histogram + // should be called once to create all painters, which are than updated separately + // not drawn when no stats or + + if (!('fFunctions' in this.histo)) return; + // if (this.options.Func == 0) return; // in some cases on need to disable + // functions drawing + + // do not draw functions when 'same' option was used + if (this.options.Same) return; + var nostat = this.histo.TestBit(JSROOT.TH1StatusBits.kNoStats) || (this.options.NoStat==1); + + var lastpainter = this; + + var kNotDraw = JSROOT.BIT(9); // don't draw the function (TF1) when in a TH1 + + var EStatusBits = { + kCanDelete : JSROOT.BIT(0), // if object in a list can be deleted + kMustCleanup : JSROOT.BIT(3), // if object destructor must call RecursiveRemove() + kObjInCanvas : JSROOT.BIT(3), // for backward compatibility only, use kMustCleanup + kIsReferenced : JSROOT.BIT(4), // if object is referenced by a TRef or TRefArray + kHasUUID : JSROOT.BIT(5), // if object has a TUUID (its fUniqueID=UUIDNumber) + kCannotPick : JSROOT.BIT(6), // if object in a pad cannot be picked + kNoContextMenu : JSROOT.BIT(8), // if object does not want context menu + kInvalidObject : JSROOT.BIT(13) // if object ctor succeeded but object should not be used + } + + for ( var i in this.histo.fFunctions.arr) { + + var func = this.histo.fFunctions.arr[i]; + var opt = this.histo.fFunctions.opt[i]; + + var funcpainter = this.FindPainterFor(func); + + // no need to do something if painter for object was already done + // object will be redraw automatically + if (funcpainter != null) continue; + + if (func['_typename'] == 'TPaveText' || func['_typename'] == 'TPaveStats') { + if (!nostat) + funcpainter = JSROOT.Painter.drawPaveText(this.divid, func, opt); + } else if (func['_typename'] == 'TF1') { + if (!func.TestBit(kNotDraw)) + funcpainter = JSROOT.Painter.drawFunction(this.divid, func, opt); + } else { + funcpainter = JSROOT.draw(this.divid, func, opt); + } + } + } + + JSROOT.THistPainter.prototype.Redraw = function() { + this.CreateXY(); + this.DrawAxes(); + this.DrawGrids(); + this.DrawBins(); + if (this.create_canvas) this.DrawTitle(); + } + + JSROOT.THistPainter.prototype.Unzoom = function(dox, doy, doz) { + var obj = this.main_painter(); + if (!obj) obj = this; + + var changed = false; + + if (dox) { + if (obj['zoom_xmin'] != obj['zoom_xmax']) changed = true; + obj['zoom_xmin'] = obj['zoom_xmax'] = 0; + } + if (doy) { + if (obj['zoom_ymin'] != obj['zoom_ymax']) changed = true; + obj['zoom_ymin'] = obj['zoom_ymax'] = 0; + } + if (doz) { + if (obj['zoom_zmin'] != obj['zoom_zmax']) changed = true; + obj['zoom_zmin'] = obj['zoom_zmax'] = 0; + } + if (changed) this.RedrawPad(); + } + + JSROOT.THistPainter.prototype.Zoom = function(xmin, xmax, ymin, ymax, zmin, zmax) { + var obj = this.main_painter(); + if (!obj) obj = this; + + var isany = false; + + if ((xmin != xmax) && (Math.abs(xmax-xmin) > obj.binwidthx*2.0)) { + obj['zoom_xmin'] = xmin; + obj['zoom_xmax'] = xmax; + isany = true; + } + if ((ymin != ymax) && (Math.abs(ymax-ymin) > (('binwidthy' in obj) ? (obj.binwidthy*2.0) : Math.abs(obj.ymax-obj.ymin)*1e-6))) { + obj['zoom_ymin'] = ymin; + obj['zoom_ymax'] = ymax; + isany = true; + } + if ((zmin!=zmax) && (zmin!=null) && (zmax!=null)) { + obj['zoom_zmin'] = zmin; + obj['zoom_zmax'] = zmax; + isany = true; + } + + if (isany) this.RedrawPad(); + } + + JSROOT.THistPainter.prototype.AddInteractive = function() { + + // only first painter in list allowed to add interactive functionality to the main pad + if (!JSROOT.gStyle.Zooming || !this.is_main_painter()) return; + + // if (!this.draw_content) return; + + var width = this.frame_width(), height = this.frame_height(); + var e, origin, curr = null, rect = null; + var lasttouch = new Date(0); + + var zoom_kind = 0; // 0 - none, 1 - XY, 2 - only X, 3 - only Y, (+100 for touches) + + var disable_tooltip = false; + + // var zoom = d3.behavior.zoom().x(this.x).y(this.y); + + var pthis = this; + + function closeAllExtras() { + JSROOT.Painter.closeMenu(); + if (rect != null) { rect.remove(); rect = null; } + zoom_kind = 0; + if (disable_tooltip) { + JSROOT.gStyle.Tooltip = true; + disable_tooltip = false; + } + } + + function showContextMenu() { + + d3.event.preventDefault(); + + // ignore context menu when touches zooming is ongoing + if (zoom_kind > 100) return; + + // one need to copy event, while after call back event may be changed + var evnt = d3.event; + + // suppress any running zomming + closeAllExtras(); + + JSROOT.Painter.createMenu(function(menu) { + menu['painter'] = pthis; + menu.add("header:"+ pthis.histo['fName']); + pthis.FillContextMenu(menu); + menu.show(evnt); + }); + + } + + function startTouchSel() { + // in case when zooming was started, block any other kind of events + if (zoom_kind != 0) { + d3.event.preventDefault(); + d3.event.stopPropagation(); + return; + } + + // update frame dimensions while frame could be resized + width = Number(pthis.svg_frame().attr("width")); + height = Number(pthis.svg_frame().attr("height")); + + e = this; + // var t = d3.event.changedTouches; + var arr = d3.touches(e); + + // only double-touch will be handled + if (arr.length == 1) { + + var now = new Date(); + var diff = now.getTime() - lasttouch.getTime(); + + if ((diff < 300) && (curr != null) + && (Math.abs(curr[0] - arr[0][0]) < 30) + && (Math.abs(curr[1] - arr[0][1]) < 30)) { + + d3.event.preventDefault(); + d3.event.stopPropagation(); + + closeAllExtras(); + pthis.Unzoom(true, true, true); + } else { + lasttouch = now; + curr = arr[0]; + } + } + + if (arr.length != 2) return; + + d3.event.preventDefault(); + + closeAllExtras(); + + var pnt1 = arr[0]; + var pnt2 = arr[1]; + + curr = new Array; // minimum + origin = new Array; // maximum + + curr.push(Math.min(pnt1[0], pnt2[0])); + curr.push(Math.min(pnt1[1], pnt2[1])); + origin.push(Math.max(pnt1[0], pnt2[0])); + origin.push(Math.max(pnt1[1], pnt2[1])); + + if (curr[0] < 0) { + zoom_kind = 103; // only y + curr[0] = 0; + origin[0] = width; + } else if (origin[1] > height) { + zoom_kind = 102; // only x + curr[1] = 0; + origin[1] = height; + } else { + zoom_kind = 101; // x and y + } + + // d3.select("body").classed("noselect", true); + // d3.select("body").style("-webkit-user-select", "none"); + + rect = pthis.svg_frame().append("rect") + .attr("class", "zoom") + .attr("id", "zoomRect") + .attr("x", curr[0]) + .attr("y", curr[1]) + .attr("width", origin[0] - curr[0]) + .attr("height", origin[1] - curr[1]); + + // pthis.svg_frame().on("dblclick", unZoom); + + d3.select(window).on("touchmove.zoomRect", moveTouchSel) + .on("touchcancel.zoomRect", endTouchSel) + .on("touchend.zoomRect", endTouchSel, true); + d3.event.stopPropagation(); + } + + function moveTouchSel() { + if (zoom_kind < 100) return; + + d3.event.preventDefault(); + + // var t = d3.event.changedTouches; + var arr = d3.touches(e); + + if (arr.length != 2) { + closeAllExtras(); + zoom_kind = 0; + return; + } + + var pnt1 = arr[0]; + var pnt2 = arr[1]; + + if (zoom_kind != 103) { + curr[0] = Math.min(pnt1[0], pnt2[0]); + origin[0] = Math.max(pnt1[0], pnt2[0]); + } + if (zoom_kind != 102) { + curr[1] = Math.min(pnt1[1], pnt2[1]); + origin[1] = Math.max(pnt1[1], pnt2[1]); + } + + rect.attr("x", curr[0]) + .attr("y", curr[1]) + .attr("width", origin[0] - curr[0]) + .attr("height", origin[1] - curr[1]); + + if (JSROOT.gStyle.Tooltip && ((origin[0] - curr[0]>10) || (origin[1] - curr[1]>10))) { + JSROOT.gStyle.Tooltip = false; + disable_tooltip = true; + } + + d3.event.stopPropagation(); + } + + function endTouchSel() { + + if (zoom_kind < 100) return; + + d3.event.preventDefault(); + d3.select(window).on("touchmove.zoomRect", null) + .on("touchend.zoomRect", null) + .on("touchcancel.zoomRect", null); + d3.select("body").classed("noselect", false); + + var xmin = 0, xmax = 0, ymin = 0, ymax = 0; + + var isany = false; + + if ((zoom_kind != 103) && (Math.abs(curr[0] - origin[0]) > 10)) { + xmin = Math.min(pthis.RevertX(origin[0]), pthis.RevertX(curr[0])); + xmax = Math.max(pthis.RevertX(origin[0]), pthis.RevertX(curr[0])); + isany = true; + } + + if ((zoom_kind != 102) && (Math.abs(curr[1] - origin[1]) > 10)) { + ymin = Math.min(pthis.y.invert(origin[1]), pthis.y.invert(curr[1])); + ymax = Math.max(pthis.y.invert(origin[1]), pthis.y.invert(curr[1])); + isany = true; + } + + d3.select("body").style("-webkit-user-select", "auto"); + + if (disable_tooltip) + JSROOT.gStyle.Tooltip = true; + + rect.remove(); + rect = null; + zoom_kind = 0; + + if (isany) pthis.Zoom(xmin, xmax, ymin, ymax); + + d3.event.stopPropagation(); + } + + function startRectSel() { + + // ignore when touch selection is actiavated + if (zoom_kind > 100) return; + + d3.event.preventDefault(); + + // update frame dimensions while frame could be resized + width = Number(pthis.svg_frame().attr("width")); + height = Number(pthis.svg_frame().attr("height")); + + closeAllExtras(); + + e = this; + origin = d3.mouse(e); + + curr = new Array; + curr.push(Math.max(0, Math.min(width, origin[0]))); + curr.push(Math.max(0, Math.min(height, origin[1]))); + + if (origin[0] < 0) { + zoom_kind = 3; // only y + origin[0] = 0; + origin[1] = curr[1]; + curr[0] = width; + curr[1] += 1; + } else if (origin[1] > height) { + zoom_kind = 2; // only x + origin[0] = curr[0]; + origin[1] = 0; + curr[0] += 1; + curr[1] = height; + } else { + zoom_kind = 1; // x and y + origin[0] = curr[0]; + origin[1] = curr[1]; + } + + // d3.select("body").classed("noselect", true); + // d3.select("body").style("-webkit-user-select", "none"); + + rect = pthis.svg_frame() + .append("rect") + .attr("class", "zoom") + .attr("id", "zoomRect"); + + pthis.svg_frame().on("dblclick", unZoom); + + d3.select(window).on("mousemove.zoomRect", moveRectSel) + .on("mouseup.zoomRect", endRectSel, true); + + d3.event.stopPropagation(); + } + + function unZoom() { + d3.event.preventDefault(); + var m = d3.mouse(e); + closeAllExtras(); + if (m[0] < 0) pthis.Unzoom(false, true, false); else + if (m[1] > height) pthis.Unzoom(true, false, false); else { + pthis.Unzoom(true, true, true); + pthis.svg_frame().on("dblclick", null); + } + } + + function moveRectSel() { + + if ((zoom_kind == 0) || (zoom_kind > 100)) return; + + d3.event.preventDefault(); + var m = d3.mouse(e); + + m[0] = Math.max(0, Math.min(width, m[0])); + m[1] = Math.max(0, Math.min(height, m[1])); + + switch (zoom_kind) { + case 1: curr[0] = m[0]; curr[1] = m[1]; break; + case 2: curr[0] = m[0]; break; + case 3: curr[1] = m[1]; break; + } + + rect.attr("x", Math.min(origin[0], curr[0])) + .attr("y", Math.min(origin[1], curr[1])) + .attr("width", Math.abs(curr[0] - origin[0])) + .attr("height", Math.abs(curr[1] - origin[1])); + + if (JSROOT.gStyle.Tooltip && ((Math.abs(curr[0] - origin[0])>10) || (Math.abs(curr[1] - origin[1])>10))) { + JSROOT.gStyle.Tooltip = false; + disable_tooltip = true; + } + } + + function endRectSel() { + if ((zoom_kind == 0) || (zoom_kind > 100)) return; + + d3.event.preventDefault(); + // d3.select(window).on("touchmove.zoomRect", + // null).on("touchend.zoomRect", null); + d3.select(window).on("mousemove.zoomRect", null) + .on("mouseup.zoomRect", null); + d3.select("body").classed("noselect", false); + + var m = d3.mouse(e); + + m[0] = Math.max(0, Math.min(width, m[0])); + m[1] = Math.max(0, Math.min(height, m[1])); + + switch (zoom_kind) { + case 1: curr[0] = m[0]; curr[1] = m[1]; break; + case 2: curr[0] = m[0]; break; // only X + case 3: curr[1] = m[1]; break; // only Y + } + + var xmin = 0, xmax = 0, ymin = 0, ymax = 0; + + var isany = false; + + if ((zoom_kind != 3) && (Math.abs(curr[0] - origin[0]) > 10)) { + xmin = Math.min(pthis.RevertX(origin[0]), pthis.RevertX(curr[0])); + xmax = Math.max(pthis.RevertX(origin[0]), pthis.RevertX(curr[0])); + isany = true; + } + + if ((zoom_kind != 2) && (Math.abs(curr[1] - origin[1]) > 10)) { + ymin = Math.min(pthis.y.invert(origin[1]), pthis.y.invert(curr[1])); + ymax = Math.max(pthis.y.invert(origin[1]), pthis.y.invert(curr[1])); + isany = true; + } + + d3.select("body").style("-webkit-user-select", "auto"); + + if (disable_tooltip) { + JSROOT.gStyle.Tooltip = true; + disable_tooltip = false; + } + + rect.remove(); + rect = null; + zoom_kind = 0; + + if (isany) pthis.Zoom(xmin, xmax, ymin, ymax); + } + + this.svg_frame().on("mousedown", startRectSel); + this.svg_frame().on("touchstart", startTouchSel); + if (JSROOT.gStyle.ContextMenu) + this.svg_frame().on("contextmenu", showContextMenu); + } + + JSROOT.THistPainter.prototype.FillContextMenu = function(menu) { + + if (this.zoom_xmin!=this.zoom_xmax) + menu.add("Unzoom X", function() { menu['painter'].Unzoom(true, false, false); }); + if (this.zoom_ymin!=this.zoom_ymax) + menu.add("Unzoom Y", function() { menu['painter'].Unzoom(false, true, false); }); + if (this.zoom_zmin!=this.zoom_zmax) + menu.add("Unzoom Z", function() { menu['painter'].Unzoom(false, false, true); }); + menu.add("Unzoom", function() { menu['painter'].Unzoom(true, true, true); }); + + menu.add(JSROOT.gStyle.Tooltip ? "Disable tooltip" : "Enable tooltip", function() { + JSROOT.gStyle.Tooltip = !JSROOT.gStyle.Tooltip; + menu['painter'].RedrawPad(); + }); + + if (this.options) { + + var item = this.options.Logx > 0 ? "Linear X" : "Log X"; + + menu.add(item, function() { + menu['painter'].options.Logx = 1 - menu['painter'].options.Logx; + menu['painter'].RedrawPad(); + }); + + item = this.options.Logy > 0 ? "Linear Y" : "Log Y"; + menu.add(item, function() { + menu['painter'].options.Logy = 1 - menu['painter'].options.Logy; + menu['painter'].RedrawPad(); + }); + + if (this.Dimension() == 2) { + item = this.options.Logz > 0 ? "Linear Z" : "Log Z"; + menu.add(item, function() { + menu['painter'].options.Logz = 1 - menu['painter'].options.Logz; + menu['painter'].RedrawPad(); + }); + } + } + if (this.draw_content) + menu.add("Toggle stat", function() { menu['painter'].ToggleStat(); }); + } + + // ======= TH1 painter================================================ + + JSROOT.TH1Painter = function(histo) { + JSROOT.THistPainter.call(this, histo); + } + + JSROOT.TH1Painter.prototype = Object.create(JSROOT.THistPainter.prototype); + + JSROOT.TH1Painter.prototype.ScanContent = function() { + + // from here we analyze object content + // therefore code will be moved + this.fill = this.createAttFill(this.histo); + if (this.fill.color == 'white') this.fill.color = 'none'; + + this.attline = JSROOT.Painter.createAttLine(this.histo); + var main = this.main_painter(); + if (main!=null) this.attline.color = main.GetAutoColor(this.attline.color); + + var hmin = 0, hmin_nz = 0, hmax = 0, hsum = 0; + + var profile = this.IsTProfile(); + + this.nbinsx = this.histo['fXaxis']['fNbins']; + + for (var i = 0; i < this.nbinsx; ++i) { + var value = this.histo.getBinContent(i + 1); + hsum += profile ? this.histo.fBinEntries[i + 1] : value; + if (value > 0) + if ((hmin_nz == 0) || (value 0) value += this.histo.getBinError(i + 1); + if (i == 0) hmin = hmax = value; + if (value < hmin) hmin = value; else + if (value > hmax) hmax = value; + } + + // account overflow/underflow bins + if (profile) + hsum += this.histo.fBinEntries[0] + this.histo.fBinEntries[this.nbinsx + 1]; + else + hsum += this.histo.getBinContent(0) + this.histo.getBinContent(this.nbinsx + 1); + + this.stat_entries = hsum; + + // used in CreateXY and tooltip providing + this.xmin = this.histo['fXaxis']['fXmin']; + this.xmax = this.histo['fXaxis']['fXmax']; + + this.binwidthx = (this.xmax - this.xmin); + if (this.nbinsx > 0) + this.binwidthx = this.binwidthx / this.nbinsx; + + this['GetBinX'] = function(bin) { return this.xmin+bin*this.binwidthx; }; + + this.ymin = this.histo['fYaxis']['fXmin']; + this.ymax = this.histo['fYaxis']['fXmax']; + this.ymin_nz = hmin_nz; // value can be used to show optimal log scale + + if ((this.nbinsx == 0) || ((Math.abs(hmin) < 1e-300 && Math.abs(hmax) < 1e-300))) { + if (this.histo['fMinimum'] != -1111) this.ymin = this.histo['fMinimum']; + if (this.histo['fMaximum'] != -1111) this.ymax = this.histo['fMaximum']; + this.draw_content = false; + } else { + if (this.histo['fMinimum'] != -1111) hmin = this.histo['fMinimum']; + if (this.histo['fMaximum'] != -1111) hmax = this.histo['fMaximum']; + if (hmin >= hmax) { + if (hmin == 0) { this.ymax = 0; this.ymax = 1; } else + if (hmin < 0) { this.ymin = 2 * hmin; this.ymax = 0; } + else { this.ymin = 0; this.ymax = hmin * 2; } + } else { + var dy = (hmax - hmin) * 0.1; + this.ymin = hmin - dy; + if ((this.ymin < 0) && (hmin >= 0)) this.ymin = 0; + this.ymax = hmax + dy; + } + this.draw_content = true; + } + + // If no any draw options specified, do not try draw histogram + if (this.options.Bar == 0 && this.options.Hist == 0 + && this.options.Error == 0 && this.options.Same == 0) { + this.draw_content = false; + } + if (this.options.Axis > 0) { // Paint histogram axis only + this.draw_content = false; + } + } + + JSROOT.TH1Painter.prototype.CountStat = function(cond) { + var profile = this.IsTProfile(); + + var stat_sumw = 0, stat_sumwx = 0, stat_sumwx2 = 0, stat_sumwy = 0, stat_sumwy2 = 0; + + var left = this.GetSelectIndex("x", "left"); + var right = this.GetSelectIndex("x", "right"); + + var xx = 0, w = 0, xmax = null, wmax = null; + + for (var i = left; i < right; i++) { + xx = this.GetBinX(i+0.5); + + if ((cond!=null) && !cond(xx)) continue; + + if (profile) { + w = this.histo.fBinEntries[i + 1]; + stat_sumwy += this.histo.fArray[i + 1]; + stat_sumwy2 += this.histo.fSumw2[i + 1]; + } else { + w = this.histo.getBinContent(i + 1); + } + + if ((xmax==null) || (w>wmax)) { xmax = xx; wmax = w; } + + stat_sumw += w; + stat_sumwx += w * xx; + stat_sumwx2 += w * xx * xx; + } + + // when no range selection done, use original statistic from histogram + if (!this.IsAxisZoomed("x") && (this.histo.fTsumw>0)) { + stat_sumw = this.histo.fTsumw; + stat_sumwx = this.histo.fTsumwx; + stat_sumwx2 = this.histo.fTsumwx2; + } + + var res = { meanx: 0, meany: 0, rmsx: 0, rmsy: 0, integral: stat_sumw, entries: this.stat_entries, xmax:0, wmax:0 }; + + + if (stat_sumw > 0) { + res.meanx = stat_sumwx / stat_sumw; + res.meany = stat_sumwy / stat_sumw; + res.rmsx = Math.sqrt(stat_sumwx2 / stat_sumw - res.meanx * res.meanx); + res.rmsy = Math.sqrt(stat_sumwy2 / stat_sumw - res.meany * res.meany); + } + + if (xmax!=null) { + res.xmax = xmax; + res.wmax = wmax; + } + + return res; + } + + JSROOT.TH1Painter.prototype.FillStatistic = function(stat, dostat, dofit) { + if (!this.histo) return false; + + var data = this.CountStat(); + + var print_name = Math.floor(dostat % 10); + var print_entries = Math.floor(dostat / 10) % 10; + var print_mean = Math.floor(dostat / 100) % 10; + var print_rms = Math.floor(dostat / 1000) % 10; + var print_under = Math.floor(dostat / 10000) % 10; + var print_over = Math.floor(dostat / 100000) % 10; + var print_integral = Math.floor(dostat / 1000000) % 10; + var print_skew = Math.floor(dostat / 10000000) % 10; + var print_kurt = Math.floor(dostat / 100000000) % 10; + + if (print_name > 0) + stat.AddLine(this.histo['fName']); + + if (this.IsTProfile()) { + + if (print_entries > 0) + stat.AddLine("Entries = " + stat.Format(data.entries,"entries")); + + if (print_mean > 0) { + stat.AddLine("Mean = " + stat.Format(data.meanx)); + stat.AddLine("Mean y = " + stat.Format(data.meany)); + } + + if (print_rms > 0) { + stat.AddLine("RMS = " + stat.Format(data.rmsx)); + stat.AddLine("RMS y = " + stat.Format(data.rmsy)); + } + + } else { + + if (print_entries > 0) + stat.AddLine("Entries = " + stat.Format(data.entries,"entries")); + + if (print_mean > 0) { + stat.AddLine("Mean = " + stat.Format(data.meanx)); + } + + if (print_rms > 0) { + stat.AddLine("RMS = " + stat.Format(data.rmsx)); + } + + if (print_under > 0) { + var res = 0; + if (this.histo['fArray'].length > 0) + res = this.histo['fArray'][0]; + stat.AddLine("Underflow = " + stat.Format(res)); + } + + if (print_over > 0) { + var res = 0; + if (this.histo['fArray'].length > 0) + res = this.histo['fArray'][this.histo['fArray'].length - 1]; + stat.AddLine("Overflow = " + stat.Format(res)); + } + + if (print_integral > 0) { + stat.AddLine("Integral = " + stat.Format(data.integral,"entries")); + } + + if (print_skew > 0) + stat.AddLine("Skew = "); + + if (print_kurt > 0) + stat.AddLine("Kurt = "); + } + + if (dofit!=0) { + var f1 = this.FindF1(); + if (f1!=null) { + var print_fval = dofit%10; + var print_ferrors = (dofit/10)%10; + var print_fchi2 = (dofit/100)%10; + var print_fprob = (dofit/1000)%10; + + if (print_fchi2 > 0) + stat.AddLine("#chi^2 / ndf = " + stat.Format(f1.fChisquare,"fit") + " / " + f1.fNDF); + if (print_fprob > 0) + stat.AddLine("Prob = "); + if ((print_fval > 0) || (print_ferrors > 0)) { + for(var n=0;n 0) && (parerr.length>0)) + stat.AddLine(parname + " = " + parvalue + " #pm " + parerr); + else + stat.AddLine(parname + " = " + parvalue); + } + } + } + } + + // adjust the size of the stats box with the number of lines + var nlines = stat.pavetext['fLines'].arr.length; + var stath = nlines * JSROOT.gStyle.StatFontSize; + if (stath <= 0 || 3 == (JSROOT.gStyle.StatFont % 10)) { + stath = 0.25 * nlines * JSROOT.gStyle.StatH; + stat.pavetext['fY1NDC'] = 0.93 - stath; + stat.pavetext['fY2NDC'] = 0.93; + } + + return true; + } + + JSROOT.TH1Painter.prototype.CreateDrawBins = function(width, height, exclude_zeros) { + // method is called directly before bins must be drawn + + var left = this.GetSelectIndex("x", "left", -1); + var right = this.GetSelectIndex("x", "right", 2); + + var draw_bins = new Array; + + var can_optimize = ((JSROOT.gStyle.OptimizeDraw > 0) && (right-left > 5000)) || + ((JSROOT.gStyle.OptimizeDraw > 1) && (right-left > 2*width)); + + var x1, x2 = this.GetBinX(left); + var grx1 = -1111, grx2 = -1111, gry; + + var point = null; + var searchmax = false; + var pmain = this.main_painter(); + + var name = this.GetItemName(); + if ((name==null) || (name=="")) name = this.histo.fName; + + for (var i = left; i < right; i++) { + // if interval wider than specified range, make it shorter + x1 = x2; + x2 = this.GetBinX(i+1); + + if (this.options.Logx && (x1 <= 0)) continue; + + grx1 = grx2; + grx2 = pmain.grx(x2); + if (grx1 < 0) grx1 = pmain.grx(x1); + + var pmax = i, cont = this.histo.getBinContent(i + 1); + + if (can_optimize) { + searchmax = !searchmax; + + // consider all points which are not far than 0.5 pixel away + while ((i+1cont : ccc 0) { + point['xerr'] = (grx2 - grx1) / 2; + point['yerr'] = gry - pmain.gry(cont + this.histo.getBinError(pmax + 1)); + } + + if (this.options.Error > 0) { + point['x'] = (grx1 + grx2) / 2; + point['tip'] = name + "\n" + + "x = " + this.AxisAsText("x", (x1 + x2)/2) + "\n" + + "y = " + this.AxisAsText("y", cont) + "\n" + + "error x = " + ((x2 - x1) / 2).toPrecision(4) + "\n" + + "error y = " + this.histo.getBinError(pmax + 1).toPrecision(4); + } else { + point['width'] = grx2 - grx1; + + point['tip'] = name + "\n" + + "bin = " + (pmax + 1) + "\n"; + + if (pmain.x_kind=='labels') + point['tip'] += ("x = " + this.AxisAsText("x", x1) + "\n"); + else + point['tip'] += ("x = [" + this.AxisAsText("x", x1) + ", " + this.AxisAsText("x", x2) + "]\n"); + point['tip'] += ("entries = " + cont); + } + + draw_bins.push(point); + } + + // if we need to draw line or area, we need extra point for correct drawing + if ((right == this.nbinsx) && (this.options.Error == 0) && (point!=null)) { + var extrapoint = JSROOT.extend({}, point); + extrapoint.x = grx2; + draw_bins.push(extrapoint); + } + + return draw_bins; + } + + JSROOT.TH1Painter.prototype.DrawAsMarkers = function(draw_bins, w, h) { + + /* Add a panel for each data point */ + var draw_bins = this.CreateDrawBins(w, h, this.IsTProfile() || (this.Mark==10)); + + // here are up to five elements are collected, try to group them + var nodes = this.draw_g.selectAll("g") + .data(draw_bins) + .enter() + .append("svg:g") + .attr("transform", function(d) { return "translate(" + d.x.toFixed(1) + "," + d.y.toFixed(1) + ")";}); + + if (JSROOT.gStyle.Tooltip) + nodes.append("svg:title").text(function(d) { return d.tip; }); + + if (this.options.Error == 12) { + // draw as rectangles + + nodes.append("svg:rect") + .attr("x", function(d) { return (-d.xerr).toFixed(1); }) + .attr("y", function(d) { return (-d.yerr).toFixed(1); }) + .attr("width", function(d) { return (2*d.xerr).toFixed(1); }) + .attr("height", function(d) { return (2*d.yerr).toFixed(1); }) + .call(this.attline.func) + .call(this.fill.func) + .style("pointer-events","visibleFill") // even when fill attribute not specified, get mouse events + .property("fill0", this.fill.color) // remember color + .on('mouseover', function() { + if (JSROOT.gStyle.Tooltip) + d3.select(this).transition().duration(100).style("fill", "grey"); + }) + .on('mouseout', function() { + d3.select(this).transition().duration(100).style("fill", this['fill0']); + }); + + + //.append("svg:title").text(function(d) { return d.tip; }); + } else + if (this.options.Error > 0) { + /* Draw main error indicators */ + nodes.append("svg:line") // x indicator + .attr("x1", function(d) { return (-d.xerr).toFixed(1); }) + .attr("y1", 0) + .attr("x2", function(d) { return d.xerr.toFixed(1); }) + .attr("y2", 0) + .call(this.attline.func); + nodes.append("svg:line") // y indicator + .attr("x1", 0) + .attr("y1", function(d) { return (-d.yerr).toFixed(1); }) + .attr("x2", 0) + .attr("y2", function(d) { return d.yerr.toFixed(1); }) + .call(this.attline.func); + } + + if (this.options.Error == 11) { + nodes.append("svg:line") + .attr("y1", -3) + .attr("x1", function(d) { return (-d.xerr).toFixed(1); }) + .attr("y2", 3) + .attr("x2", function(d) { return (-d.xerr).toFixed(1); }) + .call(this.attline.func); + nodes.append("svg:line") + .attr("y1", -3) + .attr("x1", function(d) { return d.xerr.toFixed(1); }) + .attr("y2", 3) + .attr("x2", function(d) { return d.xerr.toFixed(1); }) + .call(this.attline.func); + nodes.append("svg:line") + .attr("x1", -3) + .attr("y1", function(d) { return (-d.yerr).toFixed(1); }) + .attr("x2", 3) + .attr("y2", function(d) { return (-d.yerr).toFixed(1); }) + .call(this.attline.func); + nodes.append("svg:line") + .attr("x1", -3) + .attr("y1", function(d) { return d.yerr.toFixed(1); }) + .attr("x2", 3) + .attr("y2", function(d) { return d.yerr.toFixed(1); }) + .call(this.attline.func); + } + + if ((this.options.Mark > 0) || (this.options.Error == 12)) { + // draw markers also when e2 option was specified + var marker = JSROOT.Painter.createAttMarker(this.histo); + nodes.append("svg:path").call(marker.func); + } + } + + JSROOT.TH1Painter.prototype.DrawBins = function() { + + var width = this.frame_width(), height = this.frame_height(); + + if (!this.draw_content || (width<=0) || (height<=0)) { + this.RemoveDrawG(); + return; + } + + this.RecreateDrawG(); + + if (this.IsTProfile() || (this.options.Error > 0) || (this.options.Mark > 0)) + return this.DrawAsMarkers(width, height); + + var draw_bins = this.CreateDrawBins(width, height); + + if (this.fill.color != 'none') { + + // histogram filling + var area = d3.svg.area() + .x(function(d) { return d.x.toFixed(1); }) + .y0(function(d) { return d.y.toFixed(1); }) + .y1(function(d) { return height; }) + .interpolate("step-after"); + + this.draw_g.append("svg:path") + .attr("d", area(draw_bins)) + .style("pointer-events","none") + .call(this.attline.func) + .call(this.fill.func); + } else { + + var line = d3.svg.line() + .x(function(d) { return d.x.toFixed(1); }) + .y(function(d) { return d.y.toFixed(1); }) + .interpolate("step-after"); + + this.draw_g + .append("svg:path") + .attr("d", line(draw_bins)) + .call(this.attline.func) + .style("fill", "none"); + } + + if (JSROOT.gStyle.Tooltip) { + // TODO: limit number of tooltips by number of visible pixels + this.draw_g.selectAll("selections") + .data(draw_bins).enter() + .append("svg:line") + .attr("x1", function(d) { return d.x + d.width / 2; }) + .attr("y1", function(d) { return Math.max(0, d.y); }) + .attr("x2", function(d) { return d.x + d.width / 2; }) + .attr("y2", function(d) { return height; }) + .style("opacity", 0) + .style("stroke", "#4572A7") + .style("stroke-width", function(d) { return d.width; }) + .on('mouseover', function() { + if (JSROOT.gStyle.Tooltip && (d3.select(this).style("opacity")=="0")) + d3.select(this).transition().duration(100).style("opacity", "0.3"); + }) + .on('mouseout', function() { + d3.select(this).transition().duration(100).style("opacity", "0"); + }) + .append("svg:title").text(function(d) { return d.tip; }); + } + } + + JSROOT.TH1Painter.prototype.FillContextMenu = function(menu) { + JSROOT.THistPainter.prototype.FillContextMenu.call(this, menu); + if (this.draw_content) + menu.add("Auto zoom-in", function() { menu['painter'].AutoZoom(); }); + } + + JSROOT.TH1Painter.prototype.AutoZoom = function() { + var left = this.GetSelectIndex("x", "left", -1); + var right = this.GetSelectIndex("x", "right", 1); + + var dist = (right - left); + if (dist == 0) return; + + // first find minimum + var min = this.histo.getBinContent(left + 1); + for (var indx = left; indx < right; indx++) + if (this.histo.getBinContent(indx + 1) < min) + min = this.histo.getBinContent(indx + 1); + if (min>0) return; // if all points positive, no chance for autoscale + + while ((left < right) && (this.histo.getBinContent(left + 1) <= min)) left++; + while ((left < right) && (this.histo.getBinContent(right) <= min)) right--; + + if ((right - left < dist) && (left < right)) + this.Zoom(this.GetBinX(left), this.GetBinX(right), 0, 0); + } + + JSROOT.Painter.drawHistogram1D = function(divid, histo, opt) { + + // create painter and add it to canvas + var painter = new JSROOT.TH1Painter(histo); + + painter.SetDivId(divid, 1); + + // here we deciding how histogram will look like and how will be shown + painter.options = painter.DecodeOptions(opt); + + painter.CheckPadOptions(); + + painter.ScanContent(); + + painter.CreateXY(); + + painter.DrawAxes(); + + painter.DrawGrids(); + + painter.DrawBins(); + + if (painter.create_canvas) painter.DrawTitle(); + + if (JSROOT.gStyle.AutoStat && painter.create_canvas) { + painter.CreateStat(); + } + + painter.DrawFunctions(); + + painter.AddInteractive(); + + if (painter.options.AutoZoom) painter.AutoZoom(); + + return painter.DrawingReady(); + } + + // ==================== painter for TH2 histograms ============================== + + JSROOT.TH2Painter = function(histo) { + JSROOT.THistPainter.call(this, histo); + this.fContour = null; // contour levels + this.fUserContour = false; // are this user-defined levels + } + + JSROOT.TH2Painter.prototype = Object.create(JSROOT.THistPainter.prototype); + + JSROOT.TH2Painter.prototype.FillContextMenu = function(menu) { + JSROOT.THistPainter.prototype.FillContextMenu.call(this, menu); + menu.add("Auto zoom-in", function() { menu['painter'].AutoZoom(); }); + menu.add("Draw in 3D", function() { menu['painter'].Draw3D(); }); + menu.add("Toggle col", function() { + if (menu['painter'].options.Color == 0) + menu['painter'].options.Color = JSROOT.gStyle.DefaultCol; + else + menu['painter'].options.Color = -1 * menu['painter'].options.Color; + menu['painter'].RedrawPad(); + }); + + if (this.options.Color > 0) + menu.add("Toggle colz", function() { menu['painter'].ToggleColz(); }); + } + + JSROOT.TH2Painter.prototype.FindPalette = function(remove) { + if ('fFunctions' in this.histo) + for (var i in this.histo.fFunctions.arr) { + var func = this.histo.fFunctions.arr[i]; + if (func['_typename'] != 'TPaletteAxis') continue; + if (remove) { + this.histo.fFunctions.RemoveAt(i); + return null; + } + + return func; + } + + return null; + } + + JSROOT.TH2Painter.prototype.ToggleColz = function() { + if (this.FindPalette() == null) { + var shrink = this.CreatePalette(0.04); + this.svg_frame().property('frame_painter').Shrink(0, shrink); + this.options.Zscale = 1; + // one should draw palette + JSROOT.Painter.drawPaletteAxis(this.divid, this.FindPalette()); + } else { + if (this.options.Zscale > 0) + this.options.Zscale = 0; + else + this.options.Zscale = 1; + } + + this.RedrawPad(); + } + + JSROOT.TH2Painter.prototype.AutoZoom = function() { + var i1 = this.GetSelectIndex("x", "left", -1); + var i2 = this.GetSelectIndex("x", "right", 1); + var j1 = this.GetSelectIndex("y", "left", -1); + var j2 = this.GetSelectIndex("y", "right", 1); + + if ((i1 == i2) || (j1 == j2)) return; + + // first find minimum + var min = this.histo.getBinContent(i1 + 1, j1 + 1); + for (var i = i1; i < i2; i++) + for (var j = j1; j < j2; j++) + if (this.histo.getBinContent(i + 1, j + 1) < min) + min = this.histo.getBinContent(i + 1, j + 1); + if (min>0) return; // if all points positive, no chance for autoscale + + var ileft = i2, iright = i1, jleft = j2, jright = j1; + + for (var i = i1; i < i2; i++) + for (var j = j1; j < j2; j++) + if (this.histo.getBinContent(i + 1, j + 1) > min) { + if (i < ileft) ileft = i; + if (i >= iright) iright = i + 1; + if (j < jleft) jleft = j; + if (j >= jright) jright = j + 1; + } + + var xmin = 0, xmax = 0, ymin = 0, ymax = 0; + + if ((ileft > i1 || iright < i2) && (ileft < iright - 1)) { + xmin = this.GetBinX(ileft); + xmax = this.GetBinX(iright); + } + + if ((jleft > j1 || jright < j2) && (jleft < jright - 1)) { + ymin = this.GetBinY(jleft); + ymax = this.GetBinY(jright); + } + + this.Zoom(xmin, xmax, ymin, ymax); + } + + JSROOT.TH2Painter.prototype.CreatePalette = function(rel_width) { + if (this.FindPalette() != null) return 0.; + + if (!rel_width || rel_width <= 0) rel_width = 0.04; + + var pal = {}; + pal['_typename'] = 'TPaletteAxis'; + pal['fName'] = 'palette'; + + pal['_AutoCreated'] = true; + + var ndc = this.svg_frame().property('NDC'); + + pal['fX1NDC'] = ndc.fX2NDC - rel_width; + pal['fY1NDC'] = ndc.fY1NDC; + pal['fX2NDC'] = ndc.fX2NDC; + pal['fY2NDC'] = ndc.fY2NDC; + pal['fInit'] = 1; + pal['fShadowColor'] = 1; + pal['fCorenerRadius'] = 0; + pal['fResizing'] = false; + pal['fBorderSize'] = 4; + pal['fName'] = "TPave"; + pal['fOption'] = "br"; + pal['fLineColor'] = 1; + pal['fLineSyle'] = 1; + pal['fLineWidth'] = 1; + pal['fFillColor'] = 1; + pal['fFillSyle'] = 1; + + var axis = {}; + + axis['_typename'] = 'TGaxis'; + axis['fTickSize'] = 0.03; + axis['fLabelOffset'] = 0.005; + axis['fLabelSize'] = 0.035; + axis['fTitleOffset'] = 1; + axis['fTitleSize'] = 0.035; + axis['fNdiv'] = 8; + axis['fLabelColor'] = 1; + axis['fLabelFont'] = 42; + axis['fChopt'] = ""; + axis['fName'] = ""; + axis['fTitle'] = ""; + axis['fTimeFormat'] = ""; + axis['fFunctionName'] = ""; + axis['fWmin'] = 0; + axis['fWmax'] = 100; + axis['fLineColor'] = 1; + axis['fLineSyle'] = 1; + axis['fLineWidth'] = 1; + axis['fTextAngle'] = 0; + axis['fTextSize'] = 0.04; + axis['fTextAlign'] = 11; + axis['fTextColor'] = 1; + axis['fTextFont'] = 42; + + pal['fAxis'] = axis; + + if (!'fFunctions' in this.histo) + this.histo['fFunctions'] = JSROOT.Create("TList"); + + // place colz in the beginning, that stat box is always drawn on the top + this.histo.fFunctions.AddFirst(pal); + + // and at the end try to check how much place will be used by the labels + // in the palette + + var width = this.frame_width(), height = this.frame_height(); + + var axisOffset = Math.round(axis['fLabelOffset'] * width); + var tickSize = Math.round(axis['fTickSize'] * width); + var axisfont = JSROOT.Painter.getFontDetails(axis['fLabelFont'], axis['fLabelSize'] * height); + + var ticks = d3.scale.linear().clamp(true) + .domain([ this.minbin, this.maxbin ]) + .range([ height, 0 ]).nice().ticks(axis['fNdiv'] % 100); + + var maxlen = 0; + for (var i in ticks) { + var len = axisfont.stringWidth(this.svg_frame(), ticks[i]); + if (len > maxlen) maxlen = len; + } + + var rel = (maxlen + axisOffset) / width; + + if (pal['fX2NDC'] + rel > 0.98) { + var shift = pal['fX2NDC'] + rel - 0.98; + + pal['fX1NDC'] -= shift; + pal['fX2NDC'] -= shift; + rel_width += shift; + } + + return rel_width + 0.01; + } + + JSROOT.TH2Painter.prototype.ScanContent = function() { + this.fillcolor = JSROOT.Painter.root_colors[this.histo['fFillColor']]; + // if (this.histo['fFillColor'] == 0) this.fillcolor = '#4572A7'; // why? + + this.attline = JSROOT.Painter.createAttLine(this.histo); + if (this.attline.color == 'none') this.attline.color = '#4572A7'; + + this.nbinsx = this.histo['fXaxis']['fNbins']; + this.nbinsy = this.histo['fYaxis']['fNbins']; + + // used in CreateXY method + this.xmin = this.histo['fXaxis']['fXmin']; + this.xmax = this.histo['fXaxis']['fXmax']; + this.ymin = this.histo['fYaxis']['fXmin']; + this.ymax = this.histo['fYaxis']['fXmax']; + + this.binwidthx = (this.xmax - this.xmin); + if (this.nbinsx > 0) + this.binwidthx = this.binwidthx / this.nbinsx; + + this['GetBinX'] = function(bin) { return this.xmin+bin*this.binwidthx; }; + + this.binwidthy = (this.ymax - this.ymin); + if (this.nbinsy > 0) + this.binwidthy = this.binwidthy / this.nbinsy + + this['GetBinY'] = function(bin) { return this.ymin+bin*this.binwidthy; }; + + this.gmaxbin = this.histo.getBinContent(1, 1); + this.gminbin = this.gmaxbin; // global min/max, used at the moment in 3D drawing + for (var i = 0; i < this.nbinsx; ++i) { + for (var j = 0; j < this.nbinsy; ++j) { + var bin_content = this.histo.getBinContent(i + 1, j + 1); + if (bin_content < this.gminbin) this.gminbin = bin_content; else + if (bin_content > this.gmaxbin) this.gmaxbin = bin_content; + } + } + + // used to enable/disable stat box + this.draw_content = this.gmaxbin > 0; + } + + JSROOT.TH2Painter.prototype.CountStat = function(cond) { + var stat_sum0 = 0, stat_sumx1 = 0, stat_sumy1 = 0, stat_sumx2 = 0, stat_sumy2 = 0, stat_sumxy = 0; + + var res = { entries: 0, integral: 0, meanx: 0, meany: 0, rmsx: 0, rmsy: 0, matrix : [], xmax: 0, ymax:0, wmax: null }; + for (var n = 0; n < 9; n++) res.matrix.push(0); + + var xleft = this.GetSelectIndex("x", "left"); + var xright = this.GetSelectIndex("x", "right"); + + var yleft = this.GetSelectIndex("y", "left"); + var yright = this.GetSelectIndex("y", "right"); + + for (var xi = 0; xi <= this.nbinsx + 1; xi++) { + var xside = (xi <= xleft) ? 0 : (xi > xright ? 2 : 1); + var xx = this.GetBinX(xi - 0.5); + + for (var yi = 0; yi <= this.nbinsx + 1; yi++) { + var yside = (yi <= yleft) ? 0 : (yi > yright ? 2 : 1); + var yy = this.ymin + (yi - 0.5) * this.binwidthy; + + var zz = this.histo.getBinContent(xi, yi); + + res.entries += zz; + + res.matrix[yside * 3 + xside] += zz; + + if ((xside != 1) || (yside != 1)) continue; + + if ((cond!=null) && !cond(xx,yy)) continue; + + if ((res.wmax==null) || (zz>res.wmax)) { res.wmax = zz; res.xmax = xx; res.ymax = yy; } + + stat_sum0 += zz; + stat_sumx1 += xx * zz; + stat_sumy1 += yy * zz; + stat_sumx2 += xx * xx * zz; + stat_sumy2 += yy * yy * zz; + stat_sumxy += xx * yy * zz; + } + } + + if (!this.IsAxisZoomed("x") && !this.IsAxisZoomed("y") && (this.histo.fTsumw>0)) { + stat_sum0 = this.histo.fTsumw; + stat_sumx1 = this.histo.fTsumwx; + stat_sumx2 = this.histo.fTsumwx2; + stat_sumy1 = this.histo.fTsumwy; + stat_sumy2 = this.histo.fTsumwy2; + stat_sumxy = this.histo.fTsumwxy; + } + + if (stat_sum0 > 0) { + res.meanx = stat_sumx1 / stat_sum0; + res.meany = stat_sumy1 / stat_sum0; + res.rmsx = Math.sqrt(stat_sumx2 / stat_sum0 - res.meanx * res.meanx); + res.rmsy = Math.sqrt(stat_sumy2 / stat_sum0 - res.meany * res.meany); + } + + if (res.wmax==null) res.wmax = 0; + res.integral = stat_sum0; + + return res; + } + + JSROOT.TH2Painter.prototype.FillStatistic = function(stat, dostat, dofit) { + if (!this.histo) return false; + + var data = this.CountStat(); + + var print_name = Math.floor(dostat % 10); + var print_entries = Math.floor(dostat / 10) % 10; + var print_mean = Math.floor(dostat / 100) % 10; + var print_rms = Math.floor(dostat / 1000) % 10; + var print_under = Math.floor(dostat / 10000) % 10; + var print_over = Math.floor(dostat / 100000) % 10; + var print_integral = Math.floor(dostat / 1000000) % 10; + var print_skew = Math.floor(dostat / 10000000) % 10; + var print_kurt = Math.floor(dostat / 100000000) % 10; + + if (print_name > 0) + stat.AddLine(this.histo['fName']); + + if (print_entries > 0) + stat.AddLine("Entries = " + stat.Format(data.entries,"entries")); + + if (print_mean > 0) { + stat.AddLine("Mean x = " + stat.Format(data.meanx)); + stat.AddLine("Mean y = " + stat.Format(data.meany)); + } + + if (print_rms > 0) { + stat.AddLine("RMS x = " + stat.Format(data.rmsx)); + stat.AddLine("RMS y = " + stat.Format(data.rmsy)); + } + + if (print_integral > 0) { + stat.AddLine("Integral = " + stat.Format(data.matrix[4],"entries")); + } + + if (print_skew > 0) { + stat.AddLine("Skewness x = "); + stat.AddLine("Skewness y = "); + } + + if (print_kurt > 0) + stat.AddLine("Kurt = "); + + if ((print_under > 0) || (print_over > 0)) { + var m = data.matrix; + + stat.AddLine("" + m[6].toFixed(0) + " | " + m[7].toFixed(0) + " | " + m[7].toFixed(0)); + stat.AddLine("" + m[3].toFixed(0) + " | " + m[4].toFixed(0) + " | " + m[5].toFixed(0)); + stat.AddLine("" + m[0].toFixed(0) + " | " + m[1].toFixed(0) + " | " + m[2].toFixed(0)); + } + + // adjust the size of the stats box wrt the number of lines + var nlines = stat.pavetext['fLines'].arr.length; + var stath = nlines * JSROOT.gStyle.StatFontSize; + if (stath <= 0 || 3 == (JSROOT.gStyle.StatFont % 10)) { + stath = 0.25 * nlines * JSROOT.gStyle.StatH; + stat.pavetext['fY1NDC'] = 0.93 - stath; + stat.pavetext['fY2NDC'] = 0.93; + } + +// if (dofit!=0) { +// var f1 = this.FindF1(); +// if (f1!=null) {} +// } + + return true; + } + + JSROOT.TH2Painter.prototype.getValueColor = function(zc) { + if (this.fContour == null) { + // if not initialized, first create controur array + // difference from ROOT - fContour includes also last element with maxbin, which makes easier to build logz + this.fUserContour = false; + + if ((this.histo.fContour!=null) && (this.histo.fContour.length>0) && this.histo.TestBit(JSROOT.TH1StatusBits.kUserContour)) { + this.fContour = JSROOT.clone(this.histo.fContour); + this.fUserContour = true; + } else { + var nlevels = 20; + if (this.histo.fContour != null) nlevels = this.histo.fContour.length; + if (nlevels<1) nlevels = 20; + this.fContour = []; + this.zmin = this.minbin; + this.zmax = this.maxbin; + if (this.zoom_zmin != this.zoom_zmax) { + this.zmin = this.zoom_zmin; + this.zmax = this.zoom_zmax; + } + + if (this.options.Logz) { + if (this.zmax <= 0) this.zmax = 1.; + if (this.zmin <= 0) this.zmin = 0.001*this.zmax; + var logmin = Math.log(this.zmin)/Math.log(10); + var logmax = Math.log(this.zmax)/Math.log(10); + var dz = (logmax-logmin)/nlevels; + this.fContour.push(this.zmin); + for (var level=1; level= this.fContour[k]) color++; + } + } else { + color = Math.floor(0.01+(zc-this.zmin)*(this.fContour.length-1)/(this.zmax-this.zmin)); + } + + // do not draw bin where color is negative + if (color<0) return null; + + var palette = JSROOT.gStyle.GetColorPalette(); + var theColor = Math.floor((color+0.99)*palette.length/(this.fContour.length-1)); + if (theColor > palette.length-1) theColor = palette.length-1; + return palette[theColor]; + } + + JSROOT.TH2Painter.prototype.CreateDrawBins = function(w, h, coordinates_kind, tipkind) { + var i1 = this.GetSelectIndex("x", "left", 0); + var i2 = this.GetSelectIndex("x", "right", 0); + var j1 = this.GetSelectIndex("y", "left", 0); + var j2 = this.GetSelectIndex("y", "right", 0); + + var x1, y1, x2, y2, grx1, gry1, grx2, gry2, fillcol, shrx, shry, binz, point, wx ,wy; + + // first found min/max values in selected range + this.maxbin = this.minbin = this.histo.getBinContent(i1 + 1, j1 + 1); + for (var i = i1; i < i2; i++) { + for (var j = j1; j < j2; j++) { + binz = this.histo.getBinContent(i + 1, j + 1); + if (binz>this.maxbin) this.maxbin = binz; else + if (binzthis.maxbin) this.maxbin = binz; else + if (binz= j1; j--) { + for (var i = i1; i < i2; i++) { + var bin = this.histo.getBinContent(i + 1, j + 1); + var col = bin>this.minbin ? this.getValueColor(bin) : 'white'; + var c = d3.rgb(col); + image.data[++p] = c.r; + image.data[++p] = c.g; + image.data[++p] = c.b; + image.data[++p] = 255; + } + } + + context.putImageData(image, 0, 0); + } + + JSROOT.TH2Painter.prototype.DrawNormalCanvas = function(w,h) { + + var local_bins = this.CreateDrawBins(w, h, 0, 0); + + var fo = this.draw_g.append("foreignObject").attr("width", w).attr("height", h); + this.SetForeignObjectPosition(fo, 0, 0); + + var canvas = fo.append("xhtml:canvas").attr("width", w).attr("height", h); + + var ctx = canvas.node().getContext("2d"); + + for (var i in local_bins) { + var bin = local_bins[i]; + ctx.fillStyle = bin.fill; + ctx.fillRect(bin.x,bin.y,bin.width,bin.height); + } + + ctx.stroke(); + } + + + JSROOT.TH2Painter.prototype.DrawBins = function() { + + this.RecreateDrawG(); + + var w = this.frame_width(), h = this.frame_height(); + + if ((this.options.Color==2) && !JSROOT.browser.isIE) + return this.DrawSimpleCanvas(w,h); + + if ((this.options.Color==3) && !JSROOT.browser.isIE) + return this.DrawNormalCanvas(w,h); + + // this.options.Scat =1; + // this.histo['fMarkerStyle'] = 2; + + var draw_markers = (this.options.Scat > 0 && this.histo['fMarkerStyle'] > 1); + var normal_coordinates = (this.options.Color > 0) || draw_markers; + + var tipkind = 0; + if (JSROOT.gStyle.Tooltip) tipkind = draw_markers ? 2 : 1; + + var local_bins = this.CreateDrawBins(w, h, normal_coordinates ? 0 : 1, tipkind); + + if (draw_markers) { + // Add markers + var marker = JSROOT.Painter.createAttMarker(this.histo); + + var markers = + this.draw_g.selectAll(".marker") + .data(local_bins) + .enter().append("svg:path") + .attr("class", "marker") + .attr("transform", function(d) { return "translate(" + d.x.toFixed(1) + "," + d.y.toFixed(1) + ")" }) + .call(marker.func); + + if (JSROOT.gStyle.Tooltip) + markers.append("svg:title").text(function(d) { return d.tip; }); + } else { + var drawn_bins = this.draw_g.selectAll(".bins") + .data(local_bins).enter() + .append("svg:rect") + .attr("class", "bins") + .attr("x", function(d) { return d.x.toFixed(1); }) + .attr("y", function(d) { return d.y.toFixed(1); }) + .attr("width", function(d) { return d.width.toFixed(1); }) + .attr("height", function(d) { return d.height.toFixed(1); }) + .style("stroke", function(d) { return d.stroke; }) + .style("fill", function(d) { + this['f0'] = d.fill; + this['f1'] = d.tipcolor; + return d.fill; + }); + + if (JSROOT.gStyle.Tooltip) + drawn_bins + .on('mouseover', function() { + if (JSROOT.gStyle.Tooltip) + d3.select(this).transition().duration(100).style("fill", this['f1']); + }) + .on('mouseout', function() { + d3.select(this).transition().duration(100).style("fill", this['f0']); + }) + .append("svg:title").text(function(d) { return d.tip; }); + } + + delete local_bins; + } + + JSROOT.TH2Painter.prototype.Draw2D = function() { + + if (this.options.Lego>0) this.options.Lego = 0; + + if (this['done2d']) return; + + // check if we need to create palette + if ((this.FindPalette() == null) && this.create_canvas && (this.options.Zscale > 0)) { + // create pallette + var shrink = this.CreatePalette(0.04); + this.svg_frame().property('frame_painter').Shrink(0, shrink); + this.svg_frame().property('frame_painter').Redraw(); + this.CreateXY(); + } else if (this.options.Zscale == 0) { + // delete palette - it may appear there due to previous draw options + this.FindPalette(true); + } + + // check if we need to create statbox + if (JSROOT.gStyle.AutoStat && this.create_canvas) + this.CreateStat(); + + this.DrawAxes(); + + this.DrawGrids(); + + this.DrawBins(); + + if (this.create_canvas) this.DrawTitle(); + + this.DrawFunctions(); + + this.AddInteractive(); + + if (this.options.AutoZoom) this.AutoZoom(); + + this['done2d'] = true; // indicate that 2d drawing was once done + } + + JSROOT.TH2Painter.prototype.Draw3D = function() { + + if (this.options.Lego<=0) this.options.Lego = 1; + var painter = this; + + JSROOT.AssertPrerequisites('3d', function() { + JSROOT.Painter.real_drawHistogram2D(painter); + }); + } + + JSROOT.Painter.drawHistogram2D = function(divid, histo, opt) { + + // create painter and add it to canvas + var painter = new JSROOT.TH2Painter(histo); + + painter.SetDivId(divid, 1); + + // here we deciding how histogram will look like and how will be shown + painter.options = painter.DecodeOptions(opt); + + painter.CheckPadOptions(); + + painter.ScanContent(); + + painter.CreateXY(); + + if (painter.options.Lego > 0) + painter.Draw3D(); + else + painter.Draw2D(); + + return painter.DrawingReady(); + } + + // ==================================================================== + + JSROOT.THStackPainter = function(stack) { + JSROOT.TObjectPainter.call(this, stack); + this.stack = stack; + this.nostack = false; + this.firstpainter = null; + this.painters = new Array; // keep painters to be able update objects + } + + JSROOT.THStackPainter.prototype = Object.create(JSROOT.TObjectPainter.prototype); + + JSROOT.THStackPainter.prototype.GetObject = function() { + return this.stack; + } + + JSROOT.THStackPainter.prototype.drawStack = function(opt) { + + var pad = this.root_pad(); + var histos = this.stack['fHists']; + var nhists = histos.arr.length; + + if (opt == null) opt = ""; + else opt = opt.toLowerCase(); + var lsame = false; + if (opt.indexOf("same") != -1) { + lsame = true; + opt.replace("same", ""); + } + // compute the min/max of each axis + var i, h; + var xmin = 0, xmax = 0, ymin = 0, ymax = 0; + for (var i = 0; i < nhists; ++i) { + h = histos.arr[i]; + if (i == 0 || h['fXaxis']['fXmin'] < xmin) + xmin = h['fXaxis']['fXmin']; + if (i == 0 || h['fXaxis']['fXmax'] > xmax) + xmax = h['fXaxis']['fXmax']; + if (i == 0 || h['fYaxis']['fXmin'] < ymin) + ymin = h['fYaxis']['fXmin']; + if (i == 0 || h['fYaxis']['fXmax'] > ymax) + ymax = h['fYaxis']['fXmax']; + } + this.nostack = opt.indexOf("nostack") == -1 ? false : true; + if (!this.nostack) + this.stack.buildStack(); + + var themin, themax; + if (this.stack['fMaximum'] == -1111) themax = this.stack.getMaximum(opt); + else themax = this.stack['fMaximum']; + if (this.stack['fMinimum'] == -1111) { + themin = this.stack.getMinimum(opt); + if (pad && pad['fLogy']) { + if (themin > 0) + themin *= .9; + else + themin = themax * 1.e-3; + } else if (themin > 0) + themin = 0; + } else + themin = this.stack['fMinimum']; + if (!('fHistogram' in this.stack)) { + h = this.stack['fHists'].arr[0]; + this.stack['fHistogram'] = JSROOT.Create("TH1I"); + this.stack['fHistogram']['fName'] = "unnamed"; + this.stack['fHistogram']['fXaxis'] = JSROOT.clone(h['fXaxis']); + this.stack['fHistogram']['fYaxis'] = JSROOT.clone(h['fYaxis']); + this.stack['fHistogram']['fXaxis']['fXmin'] = xmin; + this.stack['fHistogram']['fXaxis']['fXmax'] = xmax; + this.stack['fHistogram']['fYaxis']['fXmin'] = ymin; + this.stack['fHistogram']['fYaxis']['fXmax'] = ymax; + } + this.stack['fHistogram']['fTitle'] = this.stack['fTitle']; + // var histo = JSROOT.clone(stack['fHistogram']); + var histo = this.stack['fHistogram']; + if (!histo.TestBit(JSROOT.TH1StatusBits.kIsZoomed)) { + if (this.nostack && this.stack['fMaximum'] != -1111) + histo['fMaximum'] = this.stack['fMaximum']; + else { + if (pad && pad['fLogy']) + histo['fMaximum'] = themax * (1 + 0.2 * JSROOT.Math.log10(themax / themin)); + else + histo['fMaximum'] = 1.05 * themax; + } + if (this.nostack && this.stack['fMinimum'] != -1111) + histo['fMinimum'] = this.stack['fMinimum']; + else { + if (pad && pad['fLogy']) + histo['fMinimum'] = themin / (1 + 0.5 * JSROOT.Math.log10(themax / themin)); + else + histo['fMinimum'] = themin; + } + } + if (!lsame) { + + var hopt = histo['fOption']; + if ((opt != "") && (hopt.indexOf(opt) == -1)) + hopt += opt; + + if (histo['_typename'].match(/^TH1/)) + this.firstpainter = JSROOT.Painter.drawHistogram1D(this.divid, histo, hopt); + else + if (histo['_typename'].match(/^TH2/)) + this.firstpainter = JSROOT.Painter.drawHistogram2D(this.divid, histo, hopt); + + } + for (var i = 0; i < nhists; ++i) { + if (this.nostack) + h = histos.arr[i]; + else + h = this.stack['fStack'].arr[nhists - i - 1]; + + var hopt = h['fOption']; + if ((opt != "") && (hopt.indexOf(opt) == -1)) hopt += opt; + hopt += "same"; + + if (h['_typename'].match(/^TH1/)) { + var subpainter = JSROOT.Painter.drawHistogram1D(this.divid, h, hopt); + this.painters.push(subpainter); + } + } + } + + JSROOT.THStackPainter.prototype.UpdateObject = function(obj) { + var isany = false; + if (this.firstpainter) + if (this.firstpainter.UpdateObject(obj['fHistogram'])) isany = true; + + var histos = obj['fHists']; + var nhists = histos.arr.length; + + for (var i = 0; i < nhists; ++i) { + var h = null; + + if (this.nostack) + h = histos.arr[i]; + else + h = obj['fStack'].arr[nhists - i - 1]; + + if (this.painters[i].UpdateObject(h)) isany = true; + } + + return isany; + } + + + JSROOT.Painter.drawHStack = function(divid, stack, opt) { + // paint the list of histograms + // By default, histograms are shown stacked. + // -the first histogram is paint + // -then the sum of the first and second, etc + + if (!'fHists' in stack) return; + if (stack['fHists'].arr.length == 0) return; + + var painter = new JSROOT.THStackPainter(stack); + painter.SetDivId(divid); + painter.drawStack(opt); + return painter.DrawingReady(); + } + + // ============================================================================== + + JSROOT.TLegendPainter = function(legend) { + JSROOT.TObjectPainter.call(this, legend); + this.legend = legend; + } + + JSROOT.TLegendPainter.prototype = Object.create(JSROOT.TObjectPainter.prototype); + + JSROOT.TLegendPainter.prototype.GetObject = function() { + return this.legend; + } + + JSROOT.TLegendPainter.prototype.drawLegend = function() { + this.RecreateDrawG(true, ".text_layer"); + + var svg = this.svg_pad(); + var pave = this.legend; + + var x = 0, y = 0, w = 0, h = 0; + if (pave['fInit'] == 0) { + x = pave['fX1'] * Number(svg.attr("width")); + y = Number(svg.attr("height")) - pave['fY1'] + * Number(svg.attr("height")); + w = (pave['fX2'] - pave['fX1']) * Number(svg.attr("width")); + h = (pave['fY2'] - pave['fY1']) * Number(svg.attr("height")); + } else { + x = pave['fX1NDC'] * Number(svg.attr("width")); + y = Number(svg.attr("height")) - pave['fY1NDC'] + * Number(svg.attr("height")); + w = (pave['fX2NDC'] - pave['fX1NDC']) * Number(svg.attr("width")); + h = (pave['fY2NDC'] - pave['fY1NDC']) * Number(svg.attr("height")); + } + y -= h; + var lwidth = pave['fBorderSize'] ? pave['fBorderSize'] : 0; + var fill = this.createAttFill(pave); + var lcolor = JSROOT.Painter.createAttLine(pave, lwidth); + var nlines = pave.fPrimitives.arr.length; + + this.draw_g.attr("x", x) + .attr("y", y) + .attr("width", w) + .attr("height", h) + .attr("transform", "translate(" + x + "," + y + ")"); + + this.StartTextDrawing(pave['fTextFont'], h / (nlines * 1.2)); + + this.draw_g + .append("svg:rect") + .attr("x", 0) + .attr("y", 0) + .attr("width", w) + .attr("height", h) + .call(fill.func) + .style("stroke-width", lwidth ? 1 : 0) + .style("stroke", lcolor.color); + + var tcolor = JSROOT.Painter.root_colors[pave['fTextColor']]; + var tpos_x = Math.round(pave['fMargin'] * w); + var padding_x = Math.round(0.03 * w); + var padding_y = Math.round(0.03 * h); + + var leg_painter = this; + + var step_y = (h - 2*padding_y)/nlines; + + for (var i = 0; i < nlines; ++i) { + var leg = pave.fPrimitives.arr[i]; + var lopt = leg['fOption'].toLowerCase(); + + var pos_y = Math.round(padding_y + i*step_y); // top corner + var mid_y = Math.round(padding_y + (i+0.5)*step_y); // top corner + + var attfill = leg; + var attmarker = leg; + var attline = leg; + + var mo = leg['fObject']; + + if ((mo != null) && (typeof mo == 'object')) { + if ('fLineColor' in mo) attline = mo; + if ('fFillColor' in mo) attfill = mo; + if ('fMarkerColor' in mo) attmarker = mo; + } + + var fill = this.createAttFill(attfill); + var llll = JSROOT.Painter.createAttLine(attline); + + // Draw fill pattern (in a box) + if (lopt.indexOf('f') != -1) { + // box total height is yspace*0.7 + // define x,y as the center of the symbol for this entry + this.draw_g.append("svg:rect") + .attr("x", padding_x) + .attr("y", Math.round(pos_y+step_y*0.1)) + .attr("width", tpos_x - 2*padding_x) + .attr("height", Math.round(step_y*0.8)) + .call(llll.func) + .call(fill.func); + } + // Draw line + if (lopt.indexOf('l') != -1) { + this.draw_g.append("svg:line") + .attr("x1", padding_x) + .attr("y1", mid_y) + .attr("x2", tpos_x - padding_x) + .attr("y2", mid_y) + .call(llll.func); + } + // Draw error only + if (lopt.indexOf('e') != -1 && (lopt.indexOf('l') == -1 || lopt.indexOf('f') != -1)) { + } + // Draw Polymarker + if (lopt.indexOf('p') != -1) { + var marker = JSROOT.Painter.createAttMarker(attmarker); + this.draw_g.append("svg:path") + .attr("transform", function(d) { return "translate(" + tpos_x/2 + "," + mid_y + ")"; }) + .call(marker.func); + } + + var pos_x = tpos_x; + if ((lopt.indexOf('h')>=0) || (lopt.length==0)) pos_x = padding_x; + + this.DrawText("start", pos_x, pos_y, w-pos_x-padding_x, step_y, leg['fLabel'], tcolor); + } + + // rescale after all entries are shown + this.FinishTextDrawing(); + + if (lwidth && lwidth > 1) { + this.draw_g.append("svg:line") + .attr("x1", w + (lwidth / 2)) + .attr("y1", lwidth + 1) + .attr("x2", w + (lwidth / 2)) + .attr("y2", h + lwidth - 1) + .call(lcolor.func); + this.draw_g.append("svg:line") + .attr("x1", lwidth + 1) + .attr("y1", h + (lwidth / 2)) + .attr("x2", w + lwidth - 1) + .attr("y2", h + (lwidth / 2)) + .call(lcolor.func); + } + + this.AddDrag({ obj:pave, redraw: 'drawLegend' }); + } + + JSROOT.TLegendPainter.prototype.Redraw = function() { + this.drawLegend(); + } + + JSROOT.Painter.drawLegend = function(divid, obj, opt) { + var painter = new JSROOT.TLegendPainter(obj); + painter.SetDivId(divid); + painter.Redraw(); + return painter.DrawingReady(); + } + + // ============================================================= + + JSROOT.TMultiGraphPainter = function(mgraph) { + JSROOT.TObjectPainter.call(this, mgraph); + this.mgraph = mgraph; + this.firstpainter = null; + this.painters = new Array; // keep painters to be able update objects + } + + JSROOT.TMultiGraphPainter.prototype = Object.create(JSROOT.TObjectPainter.prototype); + + JSROOT.TMultiGraphPainter.prototype.GetObject = function() { + return this.mgraph; + } + + JSROOT.TMultiGraphPainter.prototype.UpdateObject = function(obj) { + + if ((obj==null) || (obj['_typename'] != 'TMultiGraph')) return false; + + var histo = obj['fHistogram']; + var graphs = obj['fGraphs']; + + var isany = false; + if (this.firstpainter && histo) + if (this.firstpainter.UpdateObject(histo)) isany = true; + + for (var i in graphs.arr) { + if (i>=this.painters.length) break; + if (this.painters[i].UpdateObject(graphs.arr[i])) isany = true; + } + + return isany; + } + + JSROOT.TMultiGraphPainter.prototype.drawMultiGraph = function(opt) { + var maximum, minimum, rwxmin = 0, rwxmax = 0, rwymin = 0, rwymax = 0, uxmin = 0, uxmax = 0, dx, dy; + var histo = this.mgraph['fHistogram']; + var graphs = this.mgraph['fGraphs']; + var scalex = 1, scaley = 1; + var logx = false, logy = false; + var draw_all = true; + + var pad = this.root_pad(); + + if (pad!=null) { + rwxmin = pad.fUxmin; + rwxmax = pad.fUxmax; + rwymin = pad.fUymin; + rwymax = pad.fUymax; + logx = pad['fLogx']; + logy = pad['fLogy']; + } + if (histo!=null) { + minimum = histo['fYaxis']['fXmin']; + maximum = histo['fYaxis']['fXmax']; + if (pad) { + uxmin = JSROOT.Painter.padtoX(pad, rwxmin); + uxmax = JSROOT.Painter.padtoX(pad, rwxmax); + } + } else { + for (var i = 0; i < graphs.arr.length; ++i) { + var r = graphs.arr[i].ComputeRange(); + if ((i==0) || (r.xmin < rwxmin)) rwxmin = r.xmin; + if ((i==0) || (r.ymin < rwymin)) rwymin = r.ymin; + if ((i==0) || (r.xmax > rwxmax)) rwxmax = r.xmax; + if ((i==0) || (r.ymax > rwymax)) rwymax = r.ymax; + } + if (rwxmin == rwxmax) + rwxmax += 1.; + if (rwymin == rwymax) + rwymax += 1.; + dx = 0.05 * (rwxmax - rwxmin); + dy = 0.05 * (rwymax - rwymin); + uxmin = rwxmin - dx; + uxmax = rwxmax + dx; + if (logy) { + if (rwymin <= 0) rwymin = 0.001 * rwymax; + minimum = rwymin / (1 + 0.5 * JSROOT.Math.log10(rwymax / rwymin)); + maximum = rwymax * (1 + 0.2 * JSROOT.Math.log10(rwymax / rwymin)); + } else { + minimum = rwymin - dy; + maximum = rwymax + dy; + } + if (minimum < 0 && rwymin >= 0) + minimum = 0; + if (maximum > 0 && rwymax <= 0) + maximum = 0; + } + if (this.mgraph['fMinimum'] != -1111) + rwymin = minimum = this.mgraph['fMinimum']; + if (this.mgraph['fMaximum'] != -1111) + rwymax = maximum = this.mgraph['fMaximum']; + if (uxmin < 0 && rwxmin >= 0) { + if (logx) uxmin = 0.9 * rwxmin; + // else uxmin = 0; + } + if (uxmax > 0 && rwxmax <= 0) { + if (logx) uxmax = 1.1 * rwxmax; + } + if (minimum < 0 && rwymin >= 0) { + if (logy) minimum = 0.9 * rwymin; + } + if (maximum > 0 && rwymax <= 0) { + if (logy) maximum = 1.1 * rwymax; + } + if (minimum <= 0 && logy) + minimum = 0.001 * maximum; + if (uxmin <= 0 && logx) { + if (uxmax > 1000) + uxmin = 1; + else + uxmin = 0.001 * uxmax; + } + rwymin = minimum; + rwymax = maximum; + if (histo!=null) { + histo['fYaxis']['fXmin'] = rwymin; + histo['fYaxis']['fXmax'] = rwymax; + } + + // Create a temporary histogram to draw the axis (if necessary) + if (!histo) { + histo = JSROOT.Create("TH1I"); + histo['fXaxis']['fXmin'] = rwxmin; + histo['fXaxis']['fXmax'] = rwxmax; + histo['fYaxis']['fXmin'] = rwymin; + histo['fYaxis']['fXmax'] = rwymax; + } + + // histogram painter will be first in the pad, will define axis and + // interactive actions + this.firstpainter = JSROOT.Painter.drawHistogram1D(this.divid, histo); + + for (var i in graphs.arr) { + var subpainter = JSROOT.Painter.drawGraph(this.divid, graphs.arr[i]); + this.painters.push(subpainter); + } + } + + JSROOT.Painter.drawMultiGraph = function(divid, mgraph, opt) { + var painter = new JSROOT.TMultiGraphPainter(mgraph); + painter.SetDivId(divid); + painter.drawMultiGraph(opt); + return painter.DrawingReady(); + } + + // ===================================================================================== + + JSROOT.TTextPainter = function(text) { + JSROOT.TObjectPainter.call(this, text); + this.text = text; + } + + JSROOT.TTextPainter.prototype = Object.create(JSROOT.TObjectPainter.prototype); + + JSROOT.TTextPainter.prototype.GetObject = function() { + return this.text; + } + + JSROOT.TTextPainter.prototype.drawPaveLabel = function() { + + this.RecreateDrawG(true, ".text_layer"); + + var pavelabel = this.text; + + var w = this.pad_width(), h = this.pad_height(); + + var pos_x = pavelabel['fX1NDC'] * w; + var pos_y = (1.0 - pavelabel['fY1NDC']) * h; + var width = Math.abs(pavelabel['fX2NDC'] - pavelabel['fX1NDC']) * w; + var height = Math.abs(pavelabel['fY2NDC'] - pavelabel['fY1NDC']) * h; + pos_y -= height; + var fcolor = this.createAttFill(pavelabel); + var tcolor = JSROOT.Painter.root_colors[pavelabel['fTextColor']]; + var scolor = JSROOT.Painter.root_colors[pavelabel['fShadowColor']]; + + // align = 10*HorizontalAlign + VerticalAlign + // 1=left adjusted, 2=centered, 3=right adjusted + // 1=bottom adjusted, 2=centered, 3=top adjusted + var align = 'start', halign = Math.round(pavelabel['fTextAlign'] / 10); + var baseline = 'bottom', valign = pavelabel['fTextAlign'] % 10; + if (halign == 1) align = 'start'; + else if (halign == 2) align = 'middle'; + else if (halign == 3) align = 'end'; + if (valign == 1) baseline = 'bottom'; + else if (valign == 2) baseline = 'middle'; + else if (valign == 3) baseline = 'top'; + + var lwidth = pavelabel['fBorderSize'] ? pavelabel['fBorderSize'] : 0; + + var lcolor = JSROOT.Painter.createAttLine(pavelabel, lwidth); + + var pave = this.draw_g + .attr("x", pos_x) + .attr("y", pos_y) + .attr("width", width) + .attr("height", height) + .attr("transform", "translate(" + pos_x + "," + pos_y + ")"); + + pave.append("svg:rect") + .attr("x", 0) + .attr("y", 0) + .attr("width", width) + .attr("height", height) + .call(fcolor.func) + .style("stroke-width", lwidth ? 1 : 0) + .style("stroke", lcolor.color); + + this.StartTextDrawing(pavelabel['fTextFont'], height / 1.7); + + this.DrawText(align, 0.02*width, 0, 0.96*width, height, pavelabel['fLabel'], tcolor); + + this.FinishTextDrawing(); + + if (lwidth && lwidth > 1) { + pave.append("svg:line") + .attr("x1", width + (lwidth / 2)) + .attr("y1", lwidth + 1) + .attr("x2", width + (lwidth / 2)) + .attr("y2", height + lwidth - 1) + .call(lcolor.func); + pave.append("svg:line") + .attr("x1", lwidth + 1) + .attr("y1", height + (lwidth / 2)) + .attr("x2", width + lwidth - 1) + .attr("y2", height + (lwidth / 2)) + .call(lcolor.func); + } + + var pave_painter = this; + + this.AddDrag({ obj : pavelabel, redraw:'drawPaveLabel' }); + } + + JSROOT.TTextPainter.prototype.drawText = function() { + + var kTextNDC = JSROOT.BIT(14); + + var w = this.pad_width(), h = this.pad_height(), use_pad = true; + var pos_x = this.text['fX'], pos_y = this.text['fY']; + if (this.text.TestBit(kTextNDC)) { + pos_x = pos_x * w; + pos_y = (1 - pos_y) * h; + } else + if (this.main_painter()!=null) { + w = this.frame_width(); h = this.frame_height(); use_pad = false; + pos_x = this.main_painter().grx(pos_x); + pos_y = this.main_painter().gry(pos_y); + } else + if (this.root_pad()!=null) { + var pad = this.root_pad(); + if (pad['fLogx']) + pos_x = (pos_x > 0) ? JSROOT.Math.log10(pos_x) : pad['fUxmin']; + if (pad['fLogy']) + pos_y = (pos_y > 0) ? JSROOT.Math.log10(pos_y) : pad['fUymin']; + + pos_x = ((Math.abs(pad['fX1']) + pos_x) / (pad['fX2'] - pad['fX1'])) * w; + pos_y = (1 - ((Math.abs(pad['fY1']) + pos_y) / (pad['fY2'] - pad['fY1']))) * h; + } else { + JSROOT.console("Cannot draw text at x/y coordinates without real TPad object"); + pos_x = w/2; + pos_y = h/2; + } + + this.RecreateDrawG(use_pad, use_pad ? ".text_layer" : ".upper_layer", true); + + var tcolor = JSROOT.Painter.root_colors[this.text['fTextColor']]; + + var latex_kind = 0, fact = 1.; + if (this.text['_typename'] == 'TLatex') { latex_kind = 1; fact = 0.9; } else + if (this.text['_typename'] == 'TMathText') { latex_kind = 2; fact = 0.8; } + + this.StartTextDrawing(this.text['fTextFont'], this.text['fTextSize'] * Math.min(w,h) * fact); + + this.DrawText(this.text.fTextAlign, pos_x, pos_y, 0, 0, this.text['fTitle'], tcolor, latex_kind); + + this.FinishTextDrawing(); + } + + JSROOT.TTextPainter.prototype.UpdateObject = function(obj) { + if (this.text['_typename'] != obj['_typename']) return false; + if (this.text['_typename'] == 'TPaveLabel') { + this.text['fLabel'] = obj['fLabel']; + } else { + this.text['fTitle'] = obj['fTitle']; + } + + return true; + } + + + JSROOT.TTextPainter.prototype.Redraw = function() { + if (this.text['_typename'] == 'TPaveLabel') + this.drawPaveLabel(); + else + this.drawText(); + } + + JSROOT.Painter.drawText = function(divid, text) { + var painter = new JSROOT.TTextPainter(text); + painter.SetDivId(divid); + painter.Redraw(); + return painter.DrawingReady(); + } + + JSROOT.Painter.drawStreamerInfo = function(divid, obj) { + d3.select("#" + divid).style( 'overflow' , 'auto' ); + var painter = new JSROOT.HierarchyPainter('sinfo', divid); + painter.ShowStreamerInfo(obj); + return painter.DrawingReady(); + } + + // ================= painer of raw text ======================================== + + JSROOT.RawTextPainter = function(txt) { + JSROOT.TBasePainter.call(this); + this.txt = txt; + return this; + } + + JSROOT.RawTextPainter.prototype = Object.create( JSROOT.TBasePainter.prototype ); + + JSROOT.RawTextPainter.prototype.RedrawObject = function(obj) { + this.txt = obj; + this.Draw(); + return true; + } + + JSROOT.RawTextPainter.prototype.Draw = function() { + var txt = this.txt.value; + if (txt==null) txt = ""; + + var mathjax = 'mathjax' in this.txt; + + if (!mathjax && !('as_is' in this.txt)) { + var arr = txt.split("\n"); txt = ""; + for (var i in arr) + txt += "
    " + arr[i] + "
    "; + } + + var frame = d3.select("#" + this.divid); + var main = frame.select("div"); + if (main.empty()) + main = frame.append("div") + .style('max-width','100%') + .style('max-height','100%') + .style('overflow','auto'); + + main.html(txt); + + // (re) set painter to first child element + this.SetDivId(this.divid); + + if (mathjax) { + if (this['loading_mathjax']) return; + this['loading_mathjax'] = true; + var painter = this; + JSROOT.AssertPrerequisites('mathjax', function() { + painter['loading_mathjax'] = false; + if (typeof MathJax == 'object') { + MathJax.Hub.Queue(["Typeset", MathJax.Hub, frame.node()]); + } + }); + } + } + + JSROOT.Painter.drawRawText = function(divid, txt, opt) { + var painter = new JSROOT.RawTextPainter(txt); + painter.SetDivId(divid); + painter.Draw(); + return painter.DrawingReady(); + } + + // =========== painter of hierarchical structures ================================= + + JSROOT.hpainter = null; // global pointer + + JSROOT.HierarchyPainter = function(name, frameid) { + JSROOT.TBasePainter.call(this); + this.name = name; + this.frameid = frameid; + this.h = null; // hierarchy + this.files_monitoring = (frameid == null); // by default files monitored when nobrowser option specified + + // remember only very first instance + if (JSROOT.hpainter == null) + JSROOT.hpainter = this; + } + + JSROOT.HierarchyPainter.prototype = Object.create(JSROOT.TBasePainter.prototype); + + JSROOT.HierarchyPainter.prototype.Cleanup = function() { + // clear drawing and browser + this.clear(true); + } + + JSROOT.HierarchyPainter.prototype.ListHierarchy = function(folder, lst) { + folder['_childs'] = []; + for ( var i in lst.arr) { + var obj = lst.arr[i]; + var item = { + _name : obj['fName'], + _kind : "ROOT." + obj['_typename'], + _readobj : obj + }; + folder._childs.push(item); + } + } + + JSROOT.HierarchyPainter.prototype.StreamerInfoHierarchy = function(folder, lst) { + folder['_childs'] = []; + + for ( var i in lst.arr) { + var entry = lst.arr[i] + + if (typeof (entry['fName']) == 'undefined') { + JSROOT.console("strange element in StreamerInfo with name " + entry['fName']); + continue; + } + + var item = { + _name : entry['fName'], + _kind : "", + _childs : [] + }; + + folder._childs.push(item); + + item._childs.push({ _name : 'Checksum: ' + entry['fCheckSum'] }); + item._childs.push({ _name : 'Class version: ' + entry['fClassVersion'] }); + if (entry['fTitle'] != '') item._childs.push({ _name : 'Title: ' + entry['fTitle'] }); + if (typeof entry['fElements'] == 'undefined') continue; + for ( var l in entry['fElements']['arr']) { + var elem = entry['fElements']['arr'][l]; + if ((elem == null) || (typeof (elem['fName']) == 'undefined')) continue; + var info = elem['fTypeName'] + " " + elem['fName'] + ";"; + if (elem['fTitle'] != '') info += " // " + elem['fTitle']; + item._childs.push({ _name : info }); + } + } + } + + JSROOT.HierarchyPainter.prototype.TreeHierarchy = function(node, obj) { + node._childs = []; + + for ( var i in obj['fBranches'].arr) { + var branch = obj['fBranches'].arr[i]; + var nb_leaves = branch['fLeaves'].arr.length; + + // display branch with only leaf as leaf + if (nb_leaves == 1 && branch['fLeaves'].arr[0]['fName'] == branch['fName']) nb_leaves = 0; + + var subitem = { + _name : branch['fName'], + _kind : nb_leaves > 0 ? "ROOT.TBranch" : "ROOT.TLeafF" + } + + node._childs.push(subitem); + + if (nb_leaves > 0) { + subitem._childs = []; + for (var j = 0; j < nb_leaves; ++j) { + var leafitem = { + _name : branch['fLeaves'].arr[j]['fName'], + _kind : "ROOT.TLeafF" + } + subitem._childs.push(leafitem); + } + } + } + } + + JSROOT.HierarchyPainter.prototype.KeysHierarchy = function(folder, keys, file, dirname) { + folder['_childs'] = []; + + var painter = this; + for (var i in keys) { + var key = keys[i]; + + var item = { + _name : key['fName'] + ";" + key['fCycle'], + _kind : "ROOT." + key['fClassName'], + _title : key['fTitle'], + _keyname : key['fName'], + _readobj : null, + _parent : folder + }; + + if ('fRealName' in key) + item['_realname'] = key['fRealName'] + ";" + key['fCycle']; + + if ((key['fClassName'] == 'TTree' || key['fClassName'] == 'TNtuple')) { + item["_more"] = true; + + item['_expand'] = function(node, obj) { + painter.TreeHierarchy(node, obj); + return true; + } + } else if (key['fClassName'] == 'TDirectory' || key['fClassName'] == 'TDirectoryFile') { + var dir = null; + if ((dirname!=null) && (file!=null)) dir = file.GetDir(dirname + key['fName']); + item["_isdir"] = true; + if (dir==null) { + item["_more"] = true; + item['_expand'] = function(node, obj) { + painter.KeysHierarchy(node, obj.fKeys); + return true; + } + } else { + // remove cycle number - we have already directory + item['_name'] = key['fName']; + painter.KeysHierarchy(item, dir.fKeys, file, dirname + key['fName'] + "/"); + } + } else if ((key['fClassName'] == 'TList') && (key['fName'] == 'StreamerInfo')) { + item['_name'] = 'StreamerInfo'; + item['_kind'] = "ROOT.TStreamerInfoList"; + item['_title'] = "List of streamer infos for binary I/O"; + item['_readobj'] = file.fStreamerInfos; + } else if (key['fClassName'] == 'TList' + || key['fClassName'] == 'TObjArray' + || key['fClassName'] == 'TClonesArray') { + item["_more"] = true; + item['_expand'] = function(node, obj) { + painter.ListHierarchy(node, obj); + return true; + } + } + + folder._childs.push(item); + } + } + + JSROOT.HierarchyPainter.prototype.FileHierarchy = function(file) { + var painter = this; + + var folder = { + _name : file.fFileName, + _kind : "ROOT.TFile", + _file : file, + _fullurl : file.fFullURL, + _had_direct_read : false, + // this is central get method, item or itemname can be used + _get : function(item, itemname, callback) { + + var fff = this; // file item + + if ((item!=null) && (item._readobj != null)) + return JSROOT.CallBack(callback, item, item._readobj); + + if (item!=null) itemname = painter.itemFullName(item, fff); + // var pos = fullname.lastIndexOf(";"); + // if (pos>0) fullname = fullname.slice(0, pos); + + function ReadFileObject(file) { + if (fff._file==null) fff._file = file; + + if (file == null) return JSROOT.CallBack(callback, item, null); + + file.ReadObject(itemname, function(obj) { + + // if object was read even when item didnot exist try to reconstruct new hierarchy + if ((item==null) && (obj!=null)) { + // first try to found last read directory + var diritem = painter.Find({name:itemname, top:fff, last_exists:true, check_keys:true }); + if ((diritem!=null) && (diritem!=fff)) { + // reconstruct only subdir hierarchy + var dir = file.GetDir(painter.itemFullName(diritem, fff)); + if (dir) { + diritem['_name'] = diritem['_keyname']; + var dirname = painter.itemFullName(diritem, fff); + painter.KeysHierarchy(diritem, dir.fKeys, file, dirname + "/"); + } + } else { + // reconstruct full file hierarchy + painter.KeysHierarchy(fff, file.fKeys, file, ""); + } + item = painter.Find({name:itemname, top: fff}); + } + + if (item!=null) { + item._readobj = obj; + // remove cycle number for objects supporting expand + if ('_expand' in item) item._name = item._keyname; + } + + JSROOT.CallBack(callback, item, obj); + }); + } + + if (fff._file != null) { + ReadFileObject(fff._file); + } else { + // try to reopen ROOT file + new JSROOT.TFile(fff._fullurl, ReadFileObject); + } + } + }; + + this.KeysHierarchy(folder, file.fKeys, file, ""); + + return folder; + } + + JSROOT.HierarchyPainter.prototype.ForEach = function(callback, top) { + + if (top==null) top = this.h; + if ((top==null) || (typeof callback != 'function')) return; + function each_item(item) { + callback(item); + if ('_childs' in item) + for (var n in item._childs) { + item._childs[n]._parent = item; + each_item(item._childs[n]); + } + } + + each_item(top); + } + + JSROOT.HierarchyPainter.prototype.Find = function(arg) { + // search item in the hierarchy + // One could specify simply item name or object with following arguments + // name: item to search + // force: specified elements will be created when not exists + // last_exists: when specified last parent element will be returned + // top: element to start search from + + function find_in_hierarchy(top, fullname) { + + if (!fullname || fullname.length == 0) return top; + + var pos = -1; + + function process_child(child) { + // set parent pointer when searching child + child['_parent'] = top; + if ((pos + 1 == fullname.length) || (pos < 0)) return child; + + return find_in_hierarchy(child, fullname.substr(pos + 1)); + } + + do { + // we try to find element with slashes inside + pos = fullname.indexOf("/", pos + 1); + + var localname = (pos < 0) ? fullname : fullname.substr(0, pos); + + // first try to find direct matched item + for (var i in top._childs) + if (top._childs[i]._name == localname) + return process_child(top._childs[i]); + + // if allowed, try to found item with key + if ('check_keys' in arg) + for (var i in top._childs) { + if (top._childs[i]._name.indexOf(localname + ";")==0) + return process_child(top._childs[i]); + } + + if ('force' in arg) { + // if didnot found element with given name we just generate it + if (! ('_childs' in top)) top['_childs'] = []; + var child = { _name: localname }; + top['_childs'].push(child); + return process_child(child); + } + } while (pos > 0); + + return ('last_exists' in arg) ? top : null; + } + + var top = this.h; + var itemname = ""; + + if (typeof arg == 'string') { itemname = arg; arg = {}; } else + if (typeof arg == 'object') { itemname = arg.name; if ('top' in arg) top = arg.top; } else + return null; + + return find_in_hierarchy(top, itemname); + } + + JSROOT.HierarchyPainter.prototype.itemFullName = function(node, uptoparent) { + var res = ""; + + while ('_parent' in node) { + if (res.length > 0) res = "/" + res; + res = node._name + res; + node = node._parent; + if ((uptoparent != null) && (node == uptoparent)) break; + } + + return res; + } + + JSROOT.HierarchyPainter.prototype.ExecuteCommand = function(itemname, callback) { + // execute item marked as 'Command' + // If command requires additional arguments, they could be specified as extra arguments + // Or they will be requested interactive + + var hitem = this.Find(itemname); + var url = itemname + "/cmd.json"; + var pthis = this; + + if ('_numargs' in hitem) + for (var n=0;n0) + itemname = itemname.substr(parentname.length+1); + break; + } + if (!('_parent' in last_parent)) { last_parent = null; break; } + last_parent = last_parent._parent; + } + + if (last_parent==null) last_parent = this.h; + + if ('_get' in last_parent) + return last_parent._get(null, itemname, callback, options); + } + + + // normally search _get method in the parent items + var curr = item; + while (curr != null) { + if (('_get' in curr) && (typeof (curr._get) == 'function')) + return curr._get(item, null, callback, options); + curr = ('_parent' in curr) ? curr['_parent'] : null; + } + + JSROOT.CallBack(callback, item, null); + } + + JSROOT.HierarchyPainter.prototype.draw = function(divid, obj, drawopt) { + // just envelope, one should be able to redefine it for sub-classes + return JSROOT.draw(divid, obj, drawopt); + } + + JSROOT.HierarchyPainter.prototype.player = function(itemname, option, call_back) { + var item = this.Find(itemname); + + if (!item || !('_player' in item)) return JSROOT.CallBack(call_back, null); + + var hpainter = this; + + var prereq = ('_prereq' in item) ? item['_prereq'] : ''; + + JSROOT.AssertPrerequisites(prereq, function() { + + var player_func = JSROOT.findFunction(item._player); + if (player_func == null) return JSROOT.CallBack(call_back, null); + + hpainter.CreateDisplay(function(mdi) { + var res = null; + if (mdi) res = player_func(hpainter, itemname, option); + JSROOT.CallBack(call_back, res); + }); + }); + } + + JSROOT.HierarchyPainter.prototype.display = function(itemname, drawopt, call_back) { + var h = this; + var painter = null; + + function display_callback() { JSROOT.CallBack(call_back, painter, itemname); } + + h.CreateDisplay(function(mdi) { + if (!mdi) return display_callback(); + + var updating = (typeof(drawopt)=='string') && (drawopt.indexOf("update:")==0); + + var item = h.Find(itemname); + + if ((item!=null) && ('_player' in item)) + return h.player(itemname, drawopt, display_callback); + + if (updating) { + drawopt = drawopt.substr(7); + if ((item==null) || ('_doing_update' in item)) return display_callback(); + item['_doing_update'] = true; + } + + if (item!=null) { + var handle = JSROOT.getDrawHandle(item._kind, drawopt); + if ((handle==null) || !('func' in handle)) return display_callback(); + } + + h.get(itemname, function(item, obj) { + + if (updating && item) delete item['_doing_update']; + if (obj==null) return display_callback(); + + var pos = drawopt ? drawopt.indexOf("divid:") : -1; + + if (pos>=0) { + var divid = drawopt.slice(pos+6); + drawopt = drawopt.slice(0, pos); + painter = h.draw(divid, obj, drawopt); + } else { + mdi.ForEachPainter(function(p, frame) { + if (p.GetItemName() != itemname) return; + // verify that object was drawn with same option as specified now (if any) + if (!updating && (drawopt!=null) && (p.GetItemDrawOpt()!=drawopt)) return; + painter = p; + mdi.ActivateFrame(frame); + painter.RedrawObject(obj); + }); + } + + if (painter==null) { + if (updating) { + JSROOT.console("something went wrong - did not found painter when doing update of " + itemname); + } else { + var frame = mdi.FindFrame(itemname, true); + d3.select(frame).html(""); + mdi.ActivateFrame(frame); + painter = h.draw(d3.select(frame).attr("id"), obj, drawopt); + h.enable_dropping(frame, itemname); + } + } + + if (painter) painter.SetItemName(itemname, updating ? null : drawopt); // mark painter as created from hierarchy + + display_callback(); + }, drawopt); + }); + } + + JSROOT.HierarchyPainter.prototype.enable_dropping = function(frame, itemname) { + // here is not used - implemented with jquery + } + + JSROOT.HierarchyPainter.prototype.dropitem = function(itemname, divid, call_back) { + var h = this; + var mdi = h['disp']; + + h.get(itemname, function(item, obj) { + if (obj!=null) { + var painter = h.draw(divid, obj, "same"); + if (painter) painter.SetItemName(itemname); + } + + JSROOT.CallBack(call_back); + }); + + return true; + } + + JSROOT.HierarchyPainter.prototype.updateItems = function(items) { + // argument is item name or array of string with items name + // only already drawn items will be update with same draw option + + var mdi = this['disp']; + if ((mdi == null) || (items==null)) return; + + var draw_items = [], draw_options = []; + + mdi.ForEachPainter(function(p) { + var itemname = p.GetItemName(); + if ((itemname==null) || (draw_items.indexOf(itemname)>=0)) return; + if (typeof items == 'array') { + if (items.indexOf(itemname) < 0) return; + } else { + if (items != itemname) return; + } + draw_items.push(itemname); + draw_options.push("update:" + p.GetItemDrawOpt()); + }, true); // only visible panels are considered + + if (draw_items.length > 0) + this.displayAll(draw_items, draw_options); + } + + + JSROOT.HierarchyPainter.prototype.updateAll = function(only_auto_items, only_items) { + // method can be used to fetch new objects and update all existing drawings + // if only_auto_items specified, only automatic items will be updated + + var mdi = this['disp']; + if (mdi == null) return; + + var allitems = [], options = [], hpainter = this; + + // first collect items + mdi.ForEachPainter(function(p) { + var itemname = p.GetItemName(); + var drawopt = p.GetItemDrawOpt(); + if ((itemname==null) || (allitems.indexOf(itemname)>=0)) return; + + var item = hpainter.Find(itemname); + if ((item==null) || ('_not_monitor' in item) || ('_player' in item)) return; + var forced = false; + + if ('_always_monitor' in item) { + forced = true; + } else { + var handle = JSROOT.getDrawHandle(item._kind); + if (handle && ('monitor' in handle)) { + if ((handle.monitor===false) || (handle.monitor=='never')) return; + if (handle.monitor==='always') forced = true; + } + } + + if (forced || !only_auto_items) { + allitems.push(itemname); + options.push("update:" + drawopt); + } + }, true); // only visible panels are considered + + var painter = this; + + // force all files to read again (normally in non-browser mode) + if (this.files_monitoring) + this.ForEachRootFile(function(item) { + painter.ForEach(function(fitem) { delete fitem['_readobj'] }, item); + delete item['_file']; + }); + + this.displayAll(allitems, options); + } + + JSROOT.HierarchyPainter.prototype.displayAll = function(items, options, call_back) { + + if ((items == null) || (items.length == 0)) return JSROOT.CallBack(call_back); + + var h = this; + + h.CreateDisplay(function(mdi) { + if (!mdi) return JSROOT.CallBack(call_back); + + if (options == null) options = []; + while (options.length < items.length) + options.push(""); + + var dropitems = new Array(items.length); + + // First of all check that items are exists, look for cycle extension + for (var i in items) { + dropitems[i] = null; + if (h.Find(items[i])) continue; + if (h.Find(items[i] + ";1")) { items[i] += ";1"; continue; } + + var pos = items[i].indexOf("+"); + if (pos>0) { + dropitems[i] = items[i].split("+"); + items[i] = dropitems[i].shift(); + // allow to specify _same_ item in different file + for (var j in dropitems[i]) { + var pos = dropitems[i][j].indexOf("_same_"); + if ((pos>0) && (h.Find(dropitems[i][j])==null)) + dropitems[i][j] = dropitems[i][j].substr(0,pos) + items[i].substr(pos); + } + } + + // also check if subsequent items has _same_, than use name from first item + var pos = items[i].indexOf("_same_"); + if ((pos>0) && !h.Find(items[i]) && (i>0)) + items[i] = items[i].substr(0,pos) + items[0].substr(pos); + } + + // Than create empty frames for each item + for (var i in items) + if (options[i].indexOf('update:')!=0) + mdi.CreateFrame(items[i]); + + // We start display of all items parallel + for (var i in items) + h.display(items[i], options[i], function(painter, itemname) { + // one cannot use index i in callback - it is asynchron + var indx = items.indexOf(itemname); + if (indx<0) return JSROOT.console('did not found item ' + itemname); + + items[indx] = "---"; // mark item as ready + + function DropNextItem() { + if ((painter!=null) && (dropitems[indx]!=null) && (dropitems[indx].length>0)) + return h.dropitem(dropitems[indx].shift(), painter.divid, DropNextItem); + + var isany = false; + for (var cnt in items) + if (items[cnt]!='---') isany = true; + + // only when items drawn and all sub-items dropped, one could perform call-back + if (!isany) JSROOT.CallBack(call_back); + } + + DropNextItem(); + }); + }); + } + + JSROOT.HierarchyPainter.prototype.reload = function() { + var hpainter = this; + if ('_online' in this.h) + this.OpenOnline(this.h['_online'], function() { + hpainter.RefreshHtml(); + }); + } + + JSROOT.HierarchyPainter.prototype.expand = function(itemname) { + alert('expand ' + itemname + ' can be used only jquery part loaded'); + } + + JSROOT.HierarchyPainter.prototype.GetTopOnlineItem = function() { + if (this.h==null) return null; + if ('_online' in this.h) return this.h; + if ((this.h._childs!=null) && ('_online' in this.h._childs[0])) return this.h._childs[0]; + return null; + } + + + JSROOT.HierarchyPainter.prototype.ForEachJsonFile = function(call_back) { + if (this.h==null) return; + if ('_jsonfile' in this.h) + return JSROOT.CallBack(call_back, this.h); + + if (this.h._childs!=null) + for (var n in this.h._childs) { + var item = this.h._childs[n]; + if ('_jsonfile' in item) JSROOT.CallBack(call_back, item); + } + } + + JSROOT.HierarchyPainter.prototype.OpenJsonFile = function(filepath, call_back) { + var isfileopened = false; + this.ForEachJsonFile(function(item) { if (item._jsonfile==filepath) isfileopened = true; }); + if (isfileopened) return JSROOT.CallBack(call_back); + + var pthis = this; + JSROOT.NewHttpRequest(filepath,'object', function(res) { + if (res == null) return JSROOT.CallBack(call_back); + var h1 = { _jsonfile : filepath, _kind : "ROOT." + res._typename, _jsontmp : res, _name: filepath.split("/").pop() }; + if ('fTitle' in res) h1._title = res.fTitle; + h1._get = function(item,itemname,callback) { + if ('_jsontmp' in item) { + var res = item._jsontmp; delete item['_jsontmp']; + return JSROOT.CallBack(callback, item, res); + } + JSROOT.NewHttpRequest(item._jsonfile, 'object', function(res) { + return JSROOT.CallBack(callback, item, res); + }).send(null); + } + if (pthis.h == null) pthis.h = h1; else + if (pthis.h._kind == 'TopFolder') pthis.h._childs.push(h1); else { + var h0 = pthis.h; + var topname = ('_jsonfile' in h0) ? "Files" : "Items"; + pthis.h = { _name: topname, _kind: 'TopFolder', _childs : [h0, h1] }; + } + + pthis.RefreshHtml(call_back); + }).send(null); + } + + JSROOT.HierarchyPainter.prototype.ForEachRootFile = function(call_back) { + if (this.h==null) return; + if ((this.h._kind == "ROOT.TFile") && (this.h._file!=null)) + return JSROOT.CallBack(call_back, this.h); + + if (this.h._childs!=null) + for (var n in this.h._childs) { + var item = this.h._childs[n]; + if ((item._kind == 'ROOT.TFile') && ('_fullurl' in item)) + JSROOT.CallBack(call_back, item); + } + } + + JSROOT.HierarchyPainter.prototype.OpenRootFile = function(filepath, call_back) { + // first check that file with such URL already opened + var isfileopened = false; + this.ForEachRootFile(function(item) { if (item._fullurl==filepath) isfileopened = true; }); + if (isfileopened) return JSROOT.CallBack(call_back); + + var pthis = this; + + JSROOT.AssertPrerequisites('io', function() { + new JSROOT.TFile(filepath, function(file) { + if (file == null) return JSROOT.CallBack(call_back); + var h1 = pthis.FileHierarchy(file); + h1._isopen = true; + if (pthis.h == null) pthis.h = h1; else + if (pthis.h._kind == 'TopFolder') pthis.h._childs.push(h1); else { + var h0 = pthis.h; + var topname = (h0._kind == "ROOT.TFile") ? "Files" : "Items"; + pthis.h = { _name: topname, _kind: 'TopFolder', _childs : [h0, h1] }; + } + + pthis.RefreshHtml(call_back); + }); + }); + } + + JSROOT.HierarchyPainter.prototype.GetFileProp = function(itemname) { + var item = this.Find(itemname); + if (item == null) return null; + + var subname = item._name; + while (item._parent != null) { + item = item._parent; + if ('_file' in item) { + return { + fileurl : item._file.fURL, + itemname : subname + }; + } + subname = item._name + "/" + subname; + } + + return null; + } + + JSROOT.MarkAsStreamerInfo = function(h,item,obj) { + // this function used on THttpServer to mark streamer infos list + // as fictional TStreamerInfoList class, which has special draw function + if ((obj!=null) && (obj['_typename']=='TList')) + obj['_typename'] = 'TStreamerInfoList'; + } + + JSROOT.HierarchyPainter.prototype.GetOnlineItemUrl = function(item) { + // returns URL, which could be used to request item from the online server + if ((item!=null) && (typeof item == "string")) item = this.Find(item); + if (item==null) return null; + var top = item; + while ((top!=null) && (!('_online' in top))) top = top._parent; + return this.itemFullName(item, top); + } + + JSROOT.HierarchyPainter.prototype.GetOnlineItem = function(item, itemname, callback, option) { + // method used to request object from the http server + + var url = itemname, h_get = false, req = "", req_kind = "object", pthis = this, draw_handle = null; + + if (item != null) { + url = this.GetOnlineItemUrl(item); + var func = null; + if ('_kind' in item) draw_handle = JSROOT.getDrawHandle(item._kind); + + + if ('_doing_expand' in item) { + h_get = true; + req = 'h.json?compact=3'; + } else + if ('_make_request' in item) { + func = JSROOT.findFunction(item['_make_request']); + } else + if ((draw_handle!=null) && ('make_request' in draw_handle)) { + func = draw_handle['make_request']; + } + + if (typeof func == 'function') { + // ask to make request + var dreq = func(pthis, item, url, option); + // result can be simple string or object with req and kind fields + if (dreq!=null) + if (typeof dreq == 'string') req = dreq; else { + if ('req' in dreq) req = dreq.req; + if ('kind' in dreq) req_kind = dreq.kind; + } + } + + if ((req.length==0) && (item._kind.indexOf("ROOT.")!=0)) + req = 'item.json.gz?compact=3'; + } + + if ((itemname==null) && (item!=null) && ('_cached_draw_object' in this) && (req.length == 0)) { + // special handling for drawGUI when cashed + var obj = this['_cached_draw_object']; + delete this['_cached_draw_object']; + return JSROOT.CallBack(callback, item, obj); + } + + if (req.length == 0) req = 'root.json.gz?compact=3'; + + if (url.length > 0) url += "/"; + url += req; + + var itemreq = JSROOT.NewHttpRequest(url, req_kind, function(obj) { + + var func = null; + + if (!h_get && (item!=null) && ('_after_request' in item)) { + func = JSROOT.findFunction(item['_after_request']); + } else + if ((draw_handle!=null) && ('after_request' in draw_handle)) + func = draw_handle['after_request']; + + if (typeof func == 'function') { + var res = func(pthis, item, obj, option, itemreq); + if ((res!=null) && (typeof res == "object")) obj = res; + } + + JSROOT.CallBack(callback, item, obj); + }); + + itemreq.send(null); + } + + JSROOT.HierarchyPainter.prototype.OpenOnline = function(server_address, user_callback) { + var painter = this; + + function AdoptHierarchy(result) { + painter.h = result; + if (painter.h == null) return; + + if (('_title' in painter.h) && (painter.h._title!='')) document.title = painter.h._title; + + result._isopen = true; + + // mark top hierarchy as online data and + painter.h['_online'] = server_address; + + painter.h['_get'] = function(item, itemname, callback, option) { + painter.GetOnlineItem(item, itemname, callback, option); + } + + painter.h['_expand'] = function(node, obj) { + // central function for all expand + + if ((obj != null) && (node != null) && ('_childs' in obj)) { + node._childs = obj._childs; + obj._childs = null; + return true; + } + return false; + } + + var scripts = "", modules = ""; + painter.ForEach(function(item) { + if ('_autoload' in item) { + var arr = item._autoload.split(";"); + for (var n in arr) + if ((arr[n].length>3) && + ((arr[n].lastIndexOf(".js")==arr[n].length-3) || + (arr[n].lastIndexOf(".css")==arr[n].length-4))) { + if (scripts.indexOf(arr[n])<0) scripts+=arr[n]+";"; + } else { + if (modules.indexOf(arr[n])<0) modules+=arr[n]+";"; + } + } + }); + + if (scripts.length > 0) scripts = "user:" + scripts; + + // use AssertPrerequisites, while it protect us from race conditions + JSROOT.AssertPrerequisites(modules + scripts, function() { + + painter.ForEach(function(item) { + if (!('_drawfunc' in item) || !('_kind' in item)) return; + var typename = "kind:" + item._kind; + if (item._kind.indexOf('ROOT.')==0) typename = item._kind.slice(5); + var drawopt = item['_drawopt']; + if (!JSROOT.canDraw(typename) || (drawopt!=null)) + JSROOT.addDrawFunc({ name: typename, func: item['_drawfunc'], script:item['_drawscript'], opt: drawopt}); + }); + + JSROOT.CallBack(user_callback, painter); + }); + } + + if (!server_address) server_address = ""; + + if (typeof server_address == 'object') { + var h = server_address; + server_address = ""; + return AdoptHierarchy(h); + } + + JSROOT.NewHttpRequest(server_address + "h.json?compact=3", 'object', AdoptHierarchy).send(null); + } + + JSROOT.HierarchyPainter.prototype.GetOnlineProp = function(itemname) { + var item = this.Find(itemname); + if (item == null) return null; + + var subname = item._name; + while (item._parent != null) { + item = item._parent; + + if ('_online' in item) { + return { + server : item['_online'], + itemname : subname + }; + } + subname = item._name + "/" + subname; + } + + return null; + } + + JSROOT.HierarchyPainter.prototype.FillOnlineMenu = function(menu, onlineprop, itemname) { + + var painter = this; + + var node = this.Find(itemname); + var opts = JSROOT.getDrawOptions(node._kind, 'nosame'); + var handle = JSROOT.getDrawHandle(node._kind); + var root_type = node._kind.indexOf("ROOT.") == 0; + + if (opts != null) + menu.addDrawMenu("Draw", opts, function(arg) { painter.display(itemname, arg); }); + + if ((node['_childs'] == null) && (('_more' in node) || root_type)) + menu.add("Expand", function() { painter.expand(itemname); }); + + if (handle && ('execute' in handle)) + menu.add("Execute", function() { painter.ExecuteCommand(itemname, menu['tree_node']); }); + + var drawurl = onlineprop.server + onlineprop.itemname + "/draw.htm"; + var separ = "?"; + if (this.IsMonitoring()) { + drawurl += separ + "monitoring=" + this.MonitoringInterval(); + separ = "&"; + } + + if (opts != null) + menu.addDrawMenu("Draw in new window", opts, function(arg) { window.open(drawurl+separ+"opt=" +arg); }); + + if ((opts!=null) && (opts.length > 0) && root_type) + menu.addDrawMenu("Draw as png", opts, function(arg) { + window.open(onlineprop.server + onlineprop.itemname + "/root.png?w=400&h=300&opt=" + arg); + }); + + if ('_player' in node) + menu.add("Player", function() { painter.player(itemname); }); + } + + JSROOT.HierarchyPainter.prototype.ShowStreamerInfo = function(sinfo) { + this.h = { _name : "StreamerInfo" }; + this.StreamerInfoHierarchy(this.h, sinfo); + this.RefreshHtml(); + } + + JSROOT.HierarchyPainter.prototype.Adopt = function(h) { + this.h = h; + this.RefreshHtml(); + } + + JSROOT.HierarchyPainter.prototype.SetMonitoring = function(val) { + this['_monitoring_on'] = false; + this['_monitoring_interval'] = 3000; + + if ((val!=null) && (val!='0')) { + this['_monitoring_on'] = true; + this['_monitoring_interval'] = parseInt(val); + if ((this['_monitoring_interval'] == NaN) || (this['_monitoring_interval']<100)) + this['_monitoring_interval'] = 3000; + } + } + + JSROOT.HierarchyPainter.prototype.MonitoringInterval = function(val) { + // returns interval + return ('_monitoring_interval' in this) ? this['_monitoring_interval'] : 3000; + } + + JSROOT.HierarchyPainter.prototype.EnableMonitoring = function(on) { + this['_monitoring_on'] = on; + } + + JSROOT.HierarchyPainter.prototype.IsMonitoring = function() { + return this['_monitoring_on']; + } + + JSROOT.HierarchyPainter.prototype.SetDisplay = function(layout, frameid) { + this['disp_kind'] = layout; + this['disp_frameid'] = frameid; + } + + JSROOT.HierarchyPainter.prototype.GetLayout = function() { + return this['disp_kind']; + } + + JSROOT.HierarchyPainter.prototype.clear = function(withbrowser) { + if ('disp' in this) { + this['disp'].Reset(); + delete this['disp']; + } + + if (withbrowser) { + d3.select("#" + this.frameid).html(""); + delete this.h; + } else { + // when only display cleared, try to clear all browser items + this.ForEach(function(item) { + if (('clear' in item) && (typeof item['clear']=='function')) item.clear(); + }); + } + } + + JSROOT.HierarchyPainter.prototype.GetDisplay = function() { + return ('disp' in this) ? this['disp'] : null; + } + + JSROOT.HierarchyPainter.prototype.CreateDisplay = function(callback) { + + var h = this; + + if ('disp' in this) { + if (h['disp'].NumDraw() > 0) return JSROOT.CallBack(callback, h['disp']); + h['disp'].Reset(); + delete h['disp']; + } + + // check that we can found frame where drawing should be done + if (document.getElementById(this['disp_frameid']) == null) + return JSROOT.CallBack(callback, null); + + if (h['disp_kind'] == "simple") + h['disp'] = new JSROOT.SimpleDisplay(h['disp_frameid']); + else + if (h['disp_kind'].search("grid") == 0) + h['disp'] = new JSROOT.GridDisplay(h['disp_frameid'], h['disp_kind']); + + if (h['disp'] != null) + JSROOT.CallBack(callback, h['disp']); + else + JSROOT.AssertPrerequisites('jq2d', function() { + h.CreateDisplay(callback); + }); + } + + JSROOT.HierarchyPainter.prototype.updateOnOtherFrames = function(painter, obj) { + // function should update object drawings for other painters + var mdi = this['disp']; + if (mdi==null) return false; + + var isany = false; + mdi.ForEachPainter(function(p, frame) { + if ((p===painter) || (p.GetItemName() != painter.GetItemName())) return; + mdi.ActivateFrame(frame); + p.RedrawObject(obj); + isany = true; + }); + return isany; + } + + JSROOT.HierarchyPainter.prototype.CheckResize = function(force) { + if ('disp' in this) + this['disp'].CheckResize(); + } + + JSROOT.HierarchyPainter.prototype.StartGUI = function(h0, call_back) { + var hpainter = this; + var filesarr = JSROOT.GetUrlOptionAsArray("file;files"); + var jsonarr = JSROOT.GetUrlOptionAsArray("json"); + var filesdir = JSROOT.GetUrlOption("path"); + if (filesdir!=null) { + for (var i in filesarr) filesarr[i] = filesdir + filesarr[i]; + for (var i in jsonarr) jsonarr[i] = filesdir + jsonarr[i]; + } + + var itemsarr = JSROOT.GetUrlOptionAsArray("item;items"); + + var optionsarr = JSROOT.GetUrlOptionAsArray("opt;opts"); + + var monitor = JSROOT.GetUrlOption("monitoring"); + + if ((jsonarr.length>0) && (itemsarr.length==0)) itemsarr.push(""); + + var layout = JSROOT.GetUrlOption("layout"); + if (!this['disp_kind'] || (layout!=null)) + this['disp_kind'] = (layout && layout.length>0) ? layout : 'simple'; + + if (JSROOT.GetUrlOption('files_monitoring')!=null) this.files_monitoring = true; + + JSROOT.RegisterForResize(this); + + this.SetMonitoring(monitor); + + function OpenAllFiles() { + if (jsonarr.length>0) + hpainter.OpenJsonFile(jsonarr.shift(), OpenAllFiles); + else if (filesarr.length>0) + hpainter.OpenRootFile(filesarr.shift(), OpenAllFiles); + else + hpainter.displayAll(itemsarr, optionsarr, function() { + hpainter.RefreshHtml(); + + JSROOT.RegisterForResize(hpainter); + + setInterval(function() { hpainter.updateAll(!hpainter.IsMonitoring()); }, hpainter.MonitoringInterval()); + + JSROOT.CallBack(call_back); + }); + } + + function AfterOnlineOpened() { + // check if server enables monitoring + if (('_monitoring' in hpainter.h) && (monitor==null)) { + hpainter.SetMonitoring(hpainter.h._monitoring); + } + + if (('_layout' in hpainter.h) && (layout==null)) { + hpainter['disp_kind'] = hpainter.h._layout; + } + + if (('_loadfile' in hpainter.h) && (filesarr.length==0)) { + filesarr = JSROOT.ParseAsArray(hpainter.h._loadfile); + } + + if (('_drawitem' in hpainter.h) && (itemsarr.length==0)) { + itemsarr = JSROOT.ParseAsArray(hpainter.h._drawitem); + optionsarr = JSROOT.ParseAsArray(hpainter.h['_drawopt']); + } + + OpenAllFiles(); + } + + if (h0!=null) hpainter.OpenOnline(h0, AfterOnlineOpened); + else OpenAllFiles(); + } + + JSROOT.BuildNobrowserGUI = function() { + var myDiv = d3.select('#simpleGUI'); + var online = false, drawing = false; + + if (myDiv.empty()) { + online = true; + myDiv = d3.select('#onlineGUI'); + if (myDiv.empty()) { myDiv = d3.select('#drawGUI'); drawing = true; } + if (myDiv.empty()) return alert('no div for simple nobrowser gui found'); + } + + JSROOT.Painter.readStyleFromURL(); + + d3.select('html').style('height','100%'); + d3.select('body').style({ 'min-height':'100%', 'margin':'0px', "overflow": "hidden"}); + + myDiv.style({"position":"absolute", "left":"1px", "top" :"1px", "bottom" :"1px", "right": "1px"}); + + var hpainter = new JSROOT.HierarchyPainter('root', null); + hpainter.SetDisplay('simple', myDiv.attr('id')); + + var h0 = null; + if (online) { + var func = JSROOT.findFunction('GetCachedHierarchy'); + if (typeof func == 'function') h0 = func(); + if (typeof h0 != 'object') h0 = ""; + } + + hpainter.StartGUI(h0, function() { + if (!drawing) return; + var func = JSROOT.findFunction('GetCachedObject'); + var obj = (typeof func == 'function') ? JSROOT.JSONR_unref(func()) : null; + if (obj!=null) hpainter['_cached_draw_object'] = obj; + var opt = JSROOT.GetUrlOption("opt"); + hpainter.display("", opt); + }); + } + + // ================================================================ + + // JSROOT.MDIDisplay - class to manage multiple document interface for drawings + + JSROOT.MDIDisplay = function(frameid) { + this.frameid = frameid; + d3.select("#"+this.frameid).property('mdi', this); + } + + JSROOT.MDIDisplay.prototype.ForEachFrame = function(userfunc, only_visible) { + // method dedicated to iterate over existing panels + // provided userfunc is called with arguemnts (frame) + + alert("ForEachFrame not implemented"); + } + + JSROOT.MDIDisplay.prototype.ForEachPainter = function(userfunc, only_visible) { + // method dedicated to iterate over existing panles + // provided userfunc is called with arguemnts (painter, frame) + + this.ForEachFrame(function(frame) { + var dummy = new JSROOT.TObjectPainter(); + dummy.SetDivId(d3.select(frame).attr('id'), -1); + dummy.ForEachPainter(function(painter) { userfunc(painter, frame); }); + }, only_visible); + } + + JSROOT.MDIDisplay.prototype.NumDraw = function() { + var cnt = 0; + this.ForEachFrame(function() { cnt++; }); + return cnt; + } + + JSROOT.MDIDisplay.prototype.FindFrame = function(searchtitle, force) { + var found_frame = null; + + this.ForEachFrame(function(frame) { + if (d3.select(frame).attr('title') == searchtitle) + found_frame = frame; + }); + + if ((found_frame == null) && force) + found_frame = this.CreateFrame(searchtitle); + + return found_frame; + } + + JSROOT.MDIDisplay.prototype.ActivateFrame = function(frame) { + // do nothing by default + } + + JSROOT.MDIDisplay.prototype.CheckResize = function(only_frame_id) { + // perform resize for each frame + var resized_frame = null; + + this.ForEachPainter(function(painter, frame) { + + if ((only_frame_id != null) && (d3.select(frame).attr('id') != only_frame_id)) return; + + if ((painter.GetItemName()!=null) && (typeof painter['CheckResize'] == 'function')) { + // do not call resize for many painters on the same frame + if (resized_frame === frame) return; + painter.CheckResize(); + resized_frame = frame; + } + }); + } + + JSROOT.MDIDisplay.prototype.Reset = function() { + this.ForEachPainter(function(painter) { + if ((painter.GetItemName()!=null) && (typeof painter['Clenaup'] == 'function')) + painter.Clenaup(); + }); + + d3.select("#"+this.frameid).html('').property('mdi', null); + } + + JSROOT.MDIDisplay.prototype.Draw = function(title, obj, drawopt) { + // draw object with specified options + if (!obj) return; + + if (!JSROOT.canDraw(obj['_typename'], drawopt)) return; + + var frame = this.FindFrame(title, true); + + this.ActivateFrame(frame); + + return JSROOT.redraw(d3.select(frame).attr("id"), obj, drawopt); + } + + + // ================================================== + + JSROOT.SimpleDisplay = function(frameid) { + JSROOT.MDIDisplay.call(this, frameid); + } + + JSROOT.SimpleDisplay.prototype = Object.create(JSROOT.MDIDisplay.prototype); + + JSROOT.SimpleDisplay.prototype.ForEachFrame = function(userfunc, only_visible) { + var node = d3.select("#"+this.frameid + "_simple_display"); + if (!node.empty()) + JSROOT.CallBack(userfunc, node.node()); + } + + JSROOT.SimpleDisplay.prototype.CreateFrame = function(title) { + + return d3.select("#"+this.frameid) + .html("") + .append("div") + .attr("id", this.frameid + "_simple_display") + .style("width", "100%") + .style("height", "100%") + .style("overflow" ,"hidden") + .property("title", title) + .node(); + } + + JSROOT.SimpleDisplay.prototype.Reset = function() { + JSROOT.MDIDisplay.prototype.Reset.call(this); + // try to remove different properties from the div + d3.select("#"+this.frameid).html(""); + } + + // ================================================ + + JSROOT.GridDisplay = function(frameid, sizex, sizey) { + // create grid display object + // one could use followinf arguments + // new JSROOT.GridDisplay('yourframeid','4x4'); + // new JSROOT.GridDisplay('yourframeid','3x2'); + // new JSROOT.GridDisplay('yourframeid', 3, 4); + + JSROOT.MDIDisplay.call(this, frameid); + this.cnt = 0; + if (typeof sizex == "string") { + if (sizex.search("grid") == 0) + sizex = sizex.slice(4).trim(); + + var separ = sizex.search("x"); + + if (separ > 0) { + sizey = parseInt(sizex.slice(separ + 1)); + sizex = parseInt(sizex.slice(0, separ)); + } else { + sizex = parseInt(sizex); + sizey = sizex; + } + + if (sizex == NaN) sizex = 3; + if (sizey == NaN) sizey = 3; + } + + if (!sizex) sizex = 3; + if (!sizey) sizey = sizex; + this.sizex = sizex; + this.sizey = sizey; + } + + JSROOT.GridDisplay.prototype = Object.create(JSROOT.MDIDisplay.prototype); + + JSROOT.GridDisplay.prototype.IsSingle = function() { + return (this.sizex == 1) && (this.sizey == 1); + } + + JSROOT.GridDisplay.prototype.ForEachFrame = function(userfunc, only_visible) { + for (var cnt = 0; cnt < this.sizex * this.sizey; cnt++) { + var elem = this.IsSingle() ? d3.select("#"+this.frameid) : d3.select("#" + this.frameid + "_grid_" + cnt); + + if (!elem.empty() && elem.property('title') != '') + JSROOT.CallBack(userfunc, elem.node()); + } + } + + JSROOT.GridDisplay.prototype.CreateFrame = function(title) { + + var main = d3.select("#" + this.frameid); + if (main.empty()) return null; + + if (!this.IsSingle()) { + var topid = this.frameid + '_grid'; + if (d3.select("#" + topid).empty()) { + var rect = main.node().getBoundingClientRect(); + var h = Math.floor(rect.height / this.sizey) - 1; + var w = Math.floor(rect.width / this.sizex) - 1; + + var content = "
    "; + content += ""; + var cnt = 0; + for (var i = 0; i < this.sizey; i++) { + content += ""; + for (var j = 0; j < this.sizex; j++) + content += ""; + content += ""; + } + content += "
    "; + + main.html(content); + main.selectAll('.grid_cell').style({ 'width': w + 'px', 'height': h + 'px', 'overflow' : 'hidden'}); + } + + main = d3.select( "#" + topid + "_" + this.cnt); + if (++this.cnt >= this.sizex * this.sizey) this.cnt = 0; + } + + return main.html("").property('title', title).node(); + } + + JSROOT.GridDisplay.prototype.Reset = function() { + JSROOT.MDIDisplay.prototype.Reset.call(this); + if (this.IsSingle()) + d3.select("#" + this.frameid).property('title', null); + this.cnt = 0; + } + + JSROOT.GridDisplay.prototype.CheckResize = function() { + + if (!this.IsSingle()) { + var main = d3.select("#" + this.frameid); + var rect = main.node().getBoundingClientRect(); + var h = Math.floor(rect.height / this.sizey) - 1; + var w = Math.floor(rect.width / this.sizex) - 1; + main.selectAll('.grid_cell').style({ 'width': w + 'px', 'height': h + 'px'}); + } + + JSROOT.MDIDisplay.prototype.CheckResize.call(this); + } + + // ========================================================================= + + JSROOT.RegisterForResize = function(handle, delay) { + // function used to react on browser window resize event + // While many resize events could come in short time, + // resize will be handled with delay after last resize event + // handle can be function or object with CheckResize function + // one could specify delay after which resize event will be handled + + var myInterval = null; + var myCounter = -1; + var myPeriod = delay ? delay / 2.5 : 100; + if (myPeriod < 20) myPeriod = 20; + + function ResizeTimer() { + if (myCounter < 0) return; + myCounter += 1; + if (myCounter < 3) return; + + if (myInterval != null) { + clearInterval(myInterval); + myInterval = null; + } + myCounter = -1; + + if (handle==null) return; + + document.body.style.cursor = 'wait'; + if (typeof handle == 'function') handle(); else + if ((typeof handle == 'object') && (typeof handle['CheckResize'] == 'function')) handle.CheckResize(); else + if (typeof handle == 'string') { + var node = d3.select('#'+handle); + if (!node.empty()) { + var mdi = node.property('mdi'); + if (mdi) { + mdi.CheckResize(); + } else { + var dummy = new JSROOT.TObjectPainter(); + var first = true; + dummy.SetDivId(handle, -1); + dummy.ForEachPainter(function(painter) { + if (first && (typeof painter['CheckResize'] == 'function')) { + first = false; + painter.CheckResize(); + } + }); + } + } + } + document.body.style.cursor = 'auto'; + } + + function ProcessResize() { + if (myInterval == null) { + myInterval = setInterval(ResizeTimer, myPeriod); + } + myCounter = 0; + } + + window.addEventListener('resize', ProcessResize); + } + + JSROOT.addDrawFunc({ name: "TCanvas", icon: "img_canvas", func:JSROOT.Painter.drawCanvas }); + JSROOT.addDrawFunc({ name: "TPad", func:JSROOT.Painter.drawPad }); + JSROOT.addDrawFunc({ name: "TFrame", func:JSROOT.Painter.drawFrame }); + JSROOT.addDrawFunc({ name: "TLegend", func:JSROOT.Painter.drawLegend }); + JSROOT.addDrawFunc({ name: "TPaveText", func:JSROOT.Painter.drawPaveText }); + JSROOT.addDrawFunc({ name: "TPaveStats", func:JSROOT.Painter.drawPaveText }); + JSROOT.addDrawFunc({ name: "TLatex", func:JSROOT.Painter.drawText }); + JSROOT.addDrawFunc({ name: "TMathText", func:JSROOT.Painter.drawText }); + JSROOT.addDrawFunc({ name: "TText", func:JSROOT.Painter.drawText }); + JSROOT.addDrawFunc({ name: "TPaveLabel", func:JSROOT.Painter.drawText }); + JSROOT.addDrawFunc({ name: /^TH1/, icon: "img_histo1d", func:JSROOT.Painter.drawHistogram1D, opt:";P;P0;E;E1;E2;same"}); + JSROOT.addDrawFunc({ name: "TProfile", icon: "img_profile", func:JSROOT.Painter.drawHistogram1D, opt:";E1;E2"}); + JSROOT.addDrawFunc({ name: /^TH2/, icon: "img_histo2d", func:JSROOT.Painter.drawHistogram2D, opt:";COL;COLZ;COL3;LEGO;same" }); + JSROOT.addDrawFunc({ name: /^TH3/, icon: 'img_histo3d', prereq: "3d", func: "JSROOT.Painter.drawHistogram3D" }); + JSROOT.addDrawFunc({ name: "THStack", func:JSROOT.Painter.drawHStack }); + JSROOT.addDrawFunc({ name: "TF1", icon: "img_graph", func:JSROOT.Painter.drawFunction }); + JSROOT.addDrawFunc({ name: /^TGraph/, icon:"img_graph", func:JSROOT.Painter.drawGraph, opt:";L;P"}); + JSROOT.addDrawFunc({ name: "TCutG", icon:"img_graph", func:JSROOT.Painter.drawGraph, opt:";L;P"}); + JSROOT.addDrawFunc({ name: /^RooHist/, icon:"img_graph", func:JSROOT.Painter.drawGraph, opt:";L;P" }); + JSROOT.addDrawFunc({ name: /^RooCurve/, icon:"img_graph", func:JSROOT.Painter.drawGraph, opt:";L;P" }); + JSROOT.addDrawFunc({ name: "TMultiGraph", func:JSROOT.Painter.drawMultiGraph }); + JSROOT.addDrawFunc({ name: "TStreamerInfoList", icon:'img_question', func:JSROOT.Painter.drawStreamerInfo }); + JSROOT.addDrawFunc({ name: "TPaletteAxis", func:JSROOT.Painter.drawPaletteAxis }); + JSROOT.addDrawFunc({ name: "kind:Text", icon:"img_text", func:JSROOT.Painter.drawRawText }); + // these are not draw functions, but provide extra info about correspondent classes + JSROOT.addDrawFunc({ name: "kind:Command", icon:"img_execute", execute: true }); + JSROOT.addDrawFunc({ name: "TFolder", icon:"img_folder", icon2:"img_folderopen" }); + JSROOT.addDrawFunc({ name: "TTree", icon:"img_tree" }); + JSROOT.addDrawFunc({ name: "TNtuple", icon:"img_tree" }); + JSROOT.addDrawFunc({ name: "TBranch", icon:"img_branch" }); + JSROOT.addDrawFunc({ name: /^TLeaf/, icon:"img_leaf" }); + JSROOT.addDrawFunc({ name: "TFile", icon:"img_file" }); + JSROOT.addDrawFunc({ name: "TMemFile", icon:"img_file" }); + JSROOT.addDrawFunc({ name: "Session", icon:"img_globe" }); + JSROOT.addDrawFunc({ name: "kind:TopFolder", icon:"img_base" }); + + JSROOT.getDrawHandle = function(kind, selector) { + // return draw handle for specified item kind + // kind could be ROOT.TH1I for ROOT classes or just + // kind string like "Command" or "Text" + // selector can be used to search for draw handle with specified option (string) + // or just sequence id + + if (typeof kind != 'string') return null; + if (selector === "") selector = null; + + var first = null; + + if ((selector == null) && (kind in JSROOT.DrawFuncs.cache)) + return JSROOT.DrawFuncs.cache[kind]; + + var search = (kind.indexOf("ROOT.")==0) ? kind.substr(5) : "kind:"+kind; + + var counter = 0; + for (var i in JSROOT.DrawFuncs.lst) { + var h = JSROOT.DrawFuncs.lst[i]; + if (typeof h.name == "string") { + if (h.name != search) continue; + } else { + if (!search.match(h.name)) continue; + } + + if (selector==null) { + // store found handle in cache, can reuse later + if (!(kind in JSROOT.DrawFuncs.cache)) JSROOT.DrawFuncs.cache[kind] = h; + return h; + } else + if (typeof selector=='string') { + if (first == null) first = h; + // if drawoption specified, check it present in the list + if ('opt' in h) { + var opts = h.opt.split(';'); + for (var j in opts) opts[j] = opts[j].toLowerCase(); + if (opts.indexOf(selector.toLowerCase())>=0) return h; + } + } else { + if (selector === counter) return h; + } + counter++; + } + + return first; + } + + // returns array with supported draw options for the specified class + JSROOT.getDrawOptions = function(kind, selector) { + if (typeof kind != 'string') return null; + var allopts = null, isany = false; + for (var cnt=0;cnt<1000;cnt++) { + var h = JSROOT.getDrawHandle(kind, cnt); + if (h==null) break; + isany = true; + if (! ('opt' in h)) continue; + var opts = h.opt.split(';'); + for (var i in opts) { + opts[i] = opts[i].toLowerCase(); + if ((selector=='nosame') && (opts[i].indexOf('same')==0)) continue; + + if (allopts==null) allopts = []; + if (allopts.indexOf(opts[i])<0) allopts.push(opts[i]); + } + } + + if (isany && (allopts==null)) { + allopts = new Array; + allopts.push(""); + } + + return allopts; + } + + JSROOT.canDraw = function(classname) { + return JSROOT.getDrawHandle("ROOT." + classname) != null; + } + + /** @fn JSROOT.draw(divid, obj, opt) + * Draw object in specified HTML element with given draw options */ + + JSROOT.draw = function(divid, obj, opt) { + if ((obj==null) || (typeof obj != 'object')) return null; + + var handle = null; + if ('_typename' in obj) handle = JSROOT.getDrawHandle("ROOT." + obj['_typename'], opt); + else if ('_kind' in obj) handle = JSROOT.getDrawHandle(obj['_kind'], opt); + + if ((handle==null) || !('func' in handle)) return null; + + if (typeof handle.func == 'function') return handle.func(divid, obj, opt); + + var funcname = "", prereq = ""; + if (typeof handle.func == 'object') { + if ('func' in handle.func) funcname = handle.func.func; + if ('script' in handle.func) prereq = "user:" + handle.func.script; + } else + if (typeof handle.func == 'string') { + funcname = handle.func; + if (('prereq' in handle) && (typeof handle.prereq == 'string')) prereq = handle.prereq; + if (('script' in handle) && (typeof handle.script == 'string')) prereq += ";user:" + handle.script; + } + + if (funcname.length==0) return null; + + if (prereq.length > 0) { + // special handling for painters, which should be loaded via extra scripts + // such painter get extra last argument - pointer on dummy painter object + + var painter = (funcname.indexOf("JSROOT.Painter")==0) ? + new JSROOT.TObjectPainter() : new JSROOT.TBasePainter(); + + JSROOT.AssertPrerequisites(prereq, function() { + var func = JSROOT.findFunction(funcname); + if (func==null) { + alert('Fail to find function ' + funcname + ' after loading ' + prereq); + return null; + } + + var ppp = func(divid, obj, opt, painter); + + if (ppp !== painter) + alert('Painter function ' + funcname + ' do not follow rules of dynamicaly loaded painters'); + }); + + return painter; + } + + var func = JSROOT.findFunction(funcname); + if (func != null) return func(divid, obj, opt); + + return null; + } + + /** @fn JSROOT.redraw(divid, obj, opt) + * Redraw object in specified HTML element with given draw options + * If drawing was not exists, it will be performed with JSROOT.draw. + * If drawing was already done, that content will be updated */ + + JSROOT.redraw = function(divid, obj, opt) { + if (obj==null) return; + + var can = d3.select("#" + divid + " .root_canvas"); + var can_painter = can.empty() ? null : can.property('pad_painter'); + + if (can_painter != null) { + if (obj._typename=="TCanvas") { + can_painter.RedrawObject(obj); + return can_painter; + } + + for (var i in can_painter.painters) { + var obj0 = can_painter.painters[i].GetObject(); + + if ((obj0 != null) && (obj0._typename == obj._typename)) + if (can_painter.painters[i].UpdateObject(obj)) { + can_painter.RedrawPad(); + return can_painter.painters[i]; + } + } + } + + if (can_painter) + JSROOT.console("Cannot find painter to update object of type " + obj._typename); + + d3.select("#"+divid).html(""); + return JSROOT.draw(divid, obj, opt); + } + + return JSROOT; + +})); + +// JSRootPainter.js ends + +// example of user code for streamer and painter + +/* + + (function(){ + + Amore_String_Streamer = function(buf, obj, prop, streamer) { + JSROOT.console("read property " + prop + " of typename " + streamer[prop]['typename']); + obj[prop] = buf.ReadTString(); + } + + Amore_Draw = function(divid, obj, opt) { // custom draw function. + return JSROOT.draw(divid, obj['fVal'], opt); + } + + JSROOT.addUserStreamer("amore::core::String_t", Amore_String_Streamer); + + JSROOT.addDrawFunc("amore::core::MonitorObjectHisto", Amore_Draw); + +})(); + +*/ + diff --git a/js/scripts/JSRootPainter.min.js b/js/scripts/JSRootPainter.min.js new file mode 100755 index 0000000..d7f0dfd --- /dev/null +++ b/js/scripts/JSRootPainter.min.js @@ -0,0 +1 @@ +(function(a){if(typeof define==="function"&&define.amd){define(["JSRootCore","d3"],a)}else{if(typeof JSROOT=="undefined"){var b=new Error("JSROOT is not defined");b.source="JSRootPainter.js";throw b}if(typeof d3!="object"){var b=new Error("d3 is not defined");b.source="JSRootPainter.js";throw b}if(typeof JSROOT.Painter=="object"){var b=new Error("JSROOT.Painter already defined");b.source="JSRootPainter.js";throw b}a(JSROOT,d3)}}(function(a,b){if(typeof define==="function"&&define.amd){a.loadScript("$$$style/JSRootPainter.css")}a.DrawFuncs={lst:[],cache:{}};a.addDrawFunc=function(c,d,e){if((arguments.length==1)&&(typeof arguments[0]=="object")){a.DrawFuncs.lst.push(arguments[0]);return arguments[0]}var f={name:c,func:d,opt:e};a.DrawFuncs.lst.push(f);return f};a.gStyle={Tooltip:true,ContextMenu:true,Zooming:true,MoveResize:true,DragAndDrop:true,OptimizeDraw:1,DefaultCol:1,AutoStat:true,OptStat:1111,OptFit:0,FrameNDC:{fX1NDC:0.07,fY1NDC:0.12,fX2NDC:0.95,fY2NDC:0.88},StatNDC:{fX1NDC:0.78,fY1NDC:0.75,fX2NDC:0.98,fY2NDC:0.91},StatText:{fTextAngle:0,fTextSize:9,fTextAlign:12,fTextColor:1,fTextFont:42},StatFill:{fFillColor:0,fFillStyle:1001},TimeOffset:788918400000,StatFormat:"6.4g",FitFormat:"5.4g",MathJax:0,Palette:null,Interpolate:"basis"};a.Painter={};a.Painter.HLStoRGB=function(j,i,n){var c,k,m;if(n<1e-300){c=k=m=i}else{function f(l,h,g){if(g<0){g+=1}if(g>1){g-=1}if(g<1/6){return l+(h-l)*6*g}if(g<1/2){return h}if(g<2/3){return l+(h-l)*(2/3-g)*6}return l}var d=i<0.5?i*(1+n):i+n-i*n;var e=2*i-d;c=f(e,d,j+1/3);k=f(e,d,j);m=f(e,d,j-1/3)}return"rgb("+Math.round(c*255)+","+Math.round(k*255)+","+Math.round(m*255)+")"};a.gStyle.GetColorPalette=function(g){if(this.Palette==null){this.Palette=[];var f=1,l=0.5,d=280,c=0,k=50;for(var e=0;e=this.Palette.length){return this.Palette[this.Palette.length-1]}return this.Palette[g]};a.Painter.createMenu=function(c,d){document.body.style.cursor="wait";a.AssertPrerequisites("jq2d",function(){document.body.style.cursor="auto";a.Painter.createMenu(c,d)})};a.Painter.closeMenu=function(d){if(!d){d="root_ctx_menu"}var c=document.getElementById(d);if(c){c.parentNode.removeChild(c)}};a.Painter.readStyleFromURL=function(f){var h=a.GetUrlOption("optimize",f);if(h==""){a.gStyle.OptimizeDraw=2}else{if(h!=null){a.gStyle.OptimizeDraw=parseInt(h);if(a.gStyle.OptimizeDraw==NaN){a.gStyle.OptimizeDraw=2}}}var c=a.GetUrlOption("interactive",f);if((c=="")||(c=="1")){c="11111"}else{if(c=="0"){c="00000"}}if((c!=null)&&(c.length==5)){a.gStyle.Tooltip=(c.charAt(0)!="0");a.gStyle.ContextMenu=(c.charAt(1)!="0");a.gStyle.Zooming=(c.charAt(2)!="0");a.gStyle.MoveResize=(c.charAt(3)!="0");a.gStyle.DragAndDrop=(c.charAt(4)!="0")}var e=a.GetUrlOption("col",f);if(e!=null){e=parseInt(e);if((e!=NaN)&&(e>0)&&(e<4)){a.gStyle.DefaultCol=e}}var g=a.GetUrlOption("mathjax",f);if((g!=null)&&(g!="0")){a.MathJax=1}if(a.GetUrlOption("nomenu",f)!=null){a.gStyle.ContextMenu=false}a.gStyle.OptStat=a.GetUrlOption("optstat",f,a.gStyle.OptStat);a.gStyle.OptFit=a.GetUrlOption("optfit",f,a.gStyle.OptFit);a.gStyle.StatFormat=a.GetUrlOption("statfmt",f,a.gStyle.StatFormat);a.gStyle.FitFormat=a.GetUrlOption("fitfmt",f,a.gStyle.FitFormat);var d=a.GetUrlOption("interpolate",f);if(d!=null){a.gStyle.Interpolate=d}};a.Painter.Coord={kCARTESIAN:1,kPOLAR:2,kCYLINDRICAL:3,kSPHERICAL:4,kRAPIDITY:5};a.Painter.root_colors=function(){var q=new Array("white","black","red","green","blue","rgb(255,255,0)","rgb(255,0,255)","rgb(0,255,255)","rgb(89, 211,84)","rgb(89,84,216)","rgb(254,254,254)","rgb(191,181,173)","rgb(76,76,76)","rgb(102,102,102)","rgb(127,127,127)","rgb(153,153,153)","rgb(178,178,178)","rgb(204,204,204)","rgb(229,229,229)","rgb(242,242,242)","rgb(204,198,170)","rgb(204,198,170)","rgb(193,191,168)","rgb(186,181,163)","rgb(178,165,150)","rgb(183,163,155)","rgb(173,153,140)","rgb(155,142,130)","rgb(135,102,86)","rgb(175,206,198)","rgb(132,193,163)","rgb(137,168,160)","rgb(130,158,140)","rgb(173,188,198)","rgb(122,142,153)","rgb(117,137,145)","rgb(104,130,150)","rgb(109,122,132)","rgb(124,153,209)","rgb(127,127,155)","rgb(170,165,191)","rgb(211,206,135)","rgb(221,186,135)","rgb(188,158,130)","rgb(198,153,124)","rgb(191,130,119)","rgb(206,94,96)","rgb(170,142,147)","rgb(165,119,122)","rgb(147,104,112)","rgb(211,89,84)");var c=[632,416,600,400,616,432];var w=[800,820,840,860,880,900];var o=[255,204,204,255,153,153,204,153,153,255,102,102,204,102,102,153,102,102,255,51,51,204,51,51,153,51,51,102,51,51,255,0,0,204,0,0,153,0,0,102,0,0,51,0,0];var n=[204,255,204,153,255,153,153,204,153,102,255,102,102,204,102,102,153,102,51,255,51,51,204,51,51,153,51,51,102,51,0,255,0,0,204,0,0,153,0,0,102,0,0,51,0];var m=[204,204,255,153,153,255,153,153,204,102,102,255,102,102,204,102,102,153,51,51,255,51,51,204,51,51,153,51,51,102,0,0,255,0,0,204,0,0,153,0,0,102,0,0,51];var l=[255,255,204,255,255,153,204,204,153,255,255,102,204,204,102,153,153,102,255,255,51,204,204,51,153,153,51,102,102,51,255,255,0,204,204,0,153,153,0,102,102,0,51,51,0];var k=[255,204,255,255,153,255,204,153,204,255,102,255,204,102,204,153,102,153,255,51,255,204,51,204,153,51,153,102,51,102,255,0,255,204,0,204,153,0,153,102,0,102,51,0,51];var g=[204,255,255,153,255,255,153,204,204,102,255,255,102,204,204,102,153,153,51,255,255,51,204,204,51,153,153,51,102,102,0,255,255,0,204,204,0,153,153,0,102,102,0,51,51];var x=new Array(o,n,m,l,k,g);var f=[255,204,153,204,153,102,153,102,51,153,102,0,204,153,51,255,204,102,255,153,0,255,204,51,204,153,0,255,204,0,255,153,51,204,102,0,102,51,0,153,51,0,204,102,51,255,153,102,255,102,0,255,102,51,204,51,0,255,51,0];var e=[153,255,51,102,204,0,51,102,0,51,153,0,102,204,51,153,255,102,102,255,0,102,255,51,51,204,0,51,255,0,204,255,153,153,204,102,102,153,51,102,153,0,153,204,51,204,255,102,153,255,0,204,255,51,153,204,0,204,255,0];var d=[153,255,204,102,204,153,51,153,102,0,153,102,51,204,153,102,255,204,0,255,102,51,255,204,0,204,153,0,255,204,51,255,153,0,204,102,0,102,51,0,153,51,51,204,102,102,255,153,0,255,153,51,255,102,0,204,51,0,255,51];var v=[153,204,255,102,153,204,51,102,153,0,51,153,51,102,204,102,153,255,0,102,255,51,102,255,0,51,204,0,51,255,51,153,255,0,102,204,0,51,102,0,102,153,51,153,204,102,204,255,0,153,255,51,204,255,0,153,204,0,204,255];var u=[204,153,255,153,102,204,102,51,153,102,0,153,153,51,204,204,102,255,153,0,255,204,51,255,153,0,204,204,0,255,153,51,255,102,0,204,51,0,102,51,0,153,102,51,204,153,102,255,102,0,255,102,51,255,51,0,204,51,0,255];var t=[255,51,153,204,0,102,102,0,51,153,0,51,204,51,102,255,102,153,255,0,102,255,51,102,204,0,51,255,0,51,255,153,204,204,102,153,153,51,102,153,0,102,204,51,153,255,102,204,255,0,153,204,0,153,255,51,204,255,0,153];var h=new Array(f,e,d,v,u,t);for(var s=0;s<6;s++){for(var r=0;r<15;r++){var p=c[s]+r-10;q[p]="rgb("+x[s][3*r]+","+x[s][3*r+1]+","+x[s][3*r+2]+")";p=w[s]+r-9;q[p]="rgb("+h[s][3*r]+","+h[s][3*r+1]+","+h[s][3*r+2]+")"}}return q}();a.Painter.adoptRootColors=function(f){if(!f||!f.arr){return}for(var g in f.arr){var e=f.arr[g];if((e==null)||(e._typename!="TColor")){continue}var d=e.fNumber;if((d<0)||(d>4096)){continue}var c="rgb("+(e.fRed*255).toFixed(0)+","+(e.fGreen*255).toFixed(0)+","+(e.fBlue*255).toFixed(0)+")";if(c=="rgb(255,255,255)"){c="white"}while(d>a.Painter.root_colors.length){a.Painter.root_colors.push(c)}if(a.Painter.root_colors[d]!=c){a.Painter.root_colors[d]=c}}};a.Painter.root_line_styles=new Array("","","3, 3","1, 2","3, 4, 1, 4","5, 3, 1, 3","5, 3, 1, 3, 1, 3, 1, 3","5, 5","5, 3, 1, 3, 1, 3","20, 5","20, 10, 1, 10","1, 2");a.Painter.root_markers=new Array("fcircle","fcircle","fcross","dcross","ocircle","gcross","fcircle","fcircle","fcircle","fcircle","fcircle","fcircle","fcircle","fcircle","fcircle","fcircle","fcircle","fcircle","fcircle","fcircle","fcircle","fsquare","ftriangle-up","ftriangle-down","ocircle","osquare","otriangle-up","odiamond","ocross","fstar","ostar","dcross","otriangle-down","fdiamond","fcross");a.Painter.createAttMarker=function(i,e){if(e==null){e=i.fMarkerStyle}var d=a.Painter.root_markers[e];var h={shape:0,toFill:true,toRotate:false};if(typeof(d)!="undefined"){switch(d.charAt(0)){case"d":h.shape=7;break;case"o":h.toFill=false;break;case"g":h.toRotate=true;break}switch(d.substr(1)){case"circle":h.shape=0;break;case"cross":h.shape=1;break;case"diamond":h.shape=2;break;case"square":h.shape=3;break;case"triangle-up":h.shape=4;break;case"triangle-down":h.shape=5;break;case"star":h.shape=6;break}}var j=i.fMarkerSize;var g=64;if(e==1){g=1}var f=a.Painter.root_colors[i.fMarkerColor];var c={stroke:f,fill:f,marker:""};if(!h.toFill){c.fill="none"}if(h.shape==6){c.marker="M "+(-4*j)+" "+(-1*j)+" L "+4*j+" "+(-1*j)+" L "+(-2.4*j)+" "+4*j+" L 0 "+(-4*j)+" L "+2.8*j+" "+4*j+" z"}else{if(h.shape==7){c.marker="M "+(-4*j)+" "+(-4*j)+" L "+4*j+" "+4*j+" M 0 "+(-4*j)+" 0 "+4*j+" M "+4*j+" "+(-4*j)+" L "+(-4*j)+" "+4*j+" M "+(-4*j)+" 0 L "+4*j+" 0"}else{c.marker=b.svg.symbol().type(b.svg.symbolTypes[h.shape]).size(j*g)}}c.SetMarker=function(k){k.style("fill",this.fill).style("stroke",this.stroke).style("pointer-events","visibleFill").attr("d",this.marker)};c.func=c.SetMarker.bind(c);return c};a.Painter.createAttLine=function(h,f){var e=0,c=0,g=0;if(h=="black"){e=1;c=1}else{if(h=="none"){c=0}else{if(typeof h=="object"){if("fLineColor" in h){e=h.fLineColor}if("fLineWidth" in h){c=h.fLineWidth}if("fLineStyle" in h){g=h.fLineStyle}}}}if(f!=null){c=f}var d={color:a.Painter.root_colors[e],width:c,dash:a.Painter.root_line_styles[g]};if((c==0)||(e==0)){d.color="none"}d.SetLine=function(i){i.style("stroke",this.color);if(this.color!="none"){i.style("stroke-width",this.width);i.style("stroke-dasharray",this.dash)}};d.func=d.SetLine.bind(d);return d};a.Painter.clearCuts=function(c){var f=c.indexOf("[");var e=c.indexOf("]");if((f>=0)&&(e>=0)&&(f0){d=a.Math.log10(d)}else{d=c.fUymin}}return d};a.Painter.chooseTimeFormat=function(d,e){if(e<1){e=1}var f=d/e;var c=0;if(f>=0.5){c=1;if(f>=30){f/=60;c=2;if(f>=30){f/=60;c=3;if(f>=12){f/=24;c=4;if(f>=15.218425){f/=30.43685;c=5;if(f>=6){f/=12;c=6;if(f>=2){f/=12;c=7}}}}}}}switch(c){case 0:return"%S";case 1:return"%Mm%S";case 2:return"%Hh%M";case 3:return"%d-%Hh";case 4:return"%d/%m";case 5:return"%d/%m/%y";case 6:return"%d/%m/%y";case 7:return"%m/%y"}return"%Y"};a.Painter.getTimeFormat=function(c){var e=c.fTimeFormat;var d=e.indexOf("%F");if(d>=0){return e.substr(0,d)}return e};a.Painter.getTimeOffset=function(d){var f=d.fTimeFormat.indexOf("%F");if(f<0){return a.gStyle.TimeOffset}var c=d.fTimeFormat.substr(f+2);if(c=="1995-01-01 00:00:00s0"){return 788918400000}if((c=="0")||(c=="")){return 0}var e=new Date(0);var g=c.indexOf("-");e.setFullYear(c.substr(0,g));c=c.substr(g+1);g=c.indexOf("-");e.setMonth(parseInt(c.substr(0,g))-1);c=c.substr(g+1);g=c.indexOf(" ");e.setDate(c.substr(0,g));c=c.substr(g+1);g=c.indexOf(":");e.setHours(c.substr(0,g));c=c.substr(g+1);g=c.indexOf(":");e.setMinutes(c.substr(0,g));c=c.substr(g+1);g=c.indexOf("s");e.setSeconds(c.substr(0,g));if(g>0){c=c.substr(g+1);e.setMilliseconds(c)}return e.getTime()};a.Painter.formatExp=function(l){var k=l;if(parseFloat(k)==1){return"1"}if(parseFloat(k)==10){return"10"}var k=k.replace("e+","x10@");var k=k.replace("e-","x10@-");var f=k.substring(0,k.indexOf("@"));var g=k.substr(k.indexOf("@"));f=f.replace("@","");g=g.replace("@","");var m,n=g.length;for(var d=0;d1&&h<4){m=String.fromCharCode(176+h)}else{m=String.fromCharCode(8304+h)}}}}g=g.replace(i,m)}f=f.replace("1x","");return f+g};a.Painter.translateExp=function(m){var h=m.match(/\^{[0-9]*}/gi);if(h!=null){var d="";for(var g=0;g1&&k<4){n=String.fromCharCode(176+k)}else{n=String.fromCharCode(8304+k)}}d=d.replace(l,n)}m=m.replace(h[g],d)}}return m};a.Painter.symbols_map={"#alpha":"\u03B1","#beta":"\u03B2","#chi":"\u03C7","#delta":"\u03B4","#varepsilon":"\u03B5","#phi":"\u03C6","#gamma":"\u03B3","#eta":"\u03B7","#iota":"\u03B9","#varphi":"\u03C6","#kappa":"\u03BA","#lambda":"\u03BB","#mu":"\u03BC","#nu":"\u03BD","#omicron":"\u03BF","#pi":"\u03C0","#theta":"\u03B8","#rho":"\u03C1","#sigma":"\u03C3","#tau":"\u03C4","#upsilon":"\u03C5","#varomega":"\u03D6","#omega":"\u03C9","#xi":"\u03BE","#psi":"\u03C8","#zeta":"\u03B6","#Alpha":"\u0391","#Beta":"\u0392","#Chi":"\u03A7","#Delta":"\u0394","#Epsilon":"\u0395","#Phi":"\u03A6","#Gamma":"\u0393","#Eta":"\u0397","#Iota":"\u0399","#vartheta":"\u03D1","#Kappa":"\u039A","#Lambda":"\u039B","#Mu":"\u039C","#Nu":"\u039D","#Omicron":"\u039F","#Pi":"\u03A0","#Theta":"\u0398","#Rho":"\u03A1","#Sigma":"\u03A3","#Tau":"\u03A4","#Upsilon":"\u03A5","#varsigma":"\u03C2","#Omega":"\u03A9","#Xi":"\u039E","#Psi":"\u03A8","#Zeta":"\u0396","#varUpsilon":"\u03D2","#epsilon":"\u03B5","#sqrt":"\u221A","#leq":"\u2264","#/":"\u2044","#infty":"\u221E","#voidb":"\u0192","#club":"\u2663","#diamond":"\u2666","#heart":"\u2665","#spade":"\u2660","#leftrightarrow":"\u2194","#leftarrow":"\u2190","#uparrow":"\u2191","#rightarrow":"\u2192","#downarrow":"\u2193","#circ":"\u02C6","#pm":"\xB1","#doublequote":"\u2033","#geq":"\u2265","#times":"\xD7","#propto":"\u221D","#partial":"\u2202","#bullet":"\u2022","#divide":"\xF7","#neq":"\u2260","#equiv":"\u2261","#approx":"\u2248","#3dots":"\u2026","#cbar":"\u007C","#topbar":"\xAF","#downleftarrow":"\u21B5","#aleph":"\u2135","#Jgothic":"\u2111","#Rgothic":"\u211C","#voidn":"\u2118","#otimes":"\u2297","#oplus":"\u2295","#oslash":"\u2205","#cap":"\u2229","#cup":"\u222A","#supseteq":"\u2287","#supset":"\u2283","#notsubset":"\u2284","#subseteq":"\u2286","#subset":"\u2282","#int":"\u222B","#in":"\u2208","#notin":"\u2209","#angle":"\u2220","#nabla":"\u2207","#oright":"\xAE","#ocopyright":"\xA9","#trademark":"\u2122","#prod":"\u220F","#surd":"\u221A","#upoint":"\u22C5","#corner":"\xAC","#wedge":"\u2227","#vee":"\u2228","#Leftrightarrow":"\u21D4","#Leftarrow":"\u21D0","#Uparrow":"\u21D1","#Rightarrow":"\u21D2","#Downarrow":"\u21D3","#LT":"\x3C","#void1":"\xAE","#copyright":"\xA9","#void3":"\u2122","#sum":"\u2211","#arctop":"","#lbar":"","#arcbottom":"","#void8":"","#bottombar":"\u230A","#arcbar":"","#ltbar":"","#AA":"\u212B","#aa":"\u00E5","#void06":"","#GT":"\x3E","#forall":"\u2200","#exists":"\u2203","#bar":"","#vec":"","#dot":"\u22C5","#hat":"\xB7","#ddot":"","#acute":"acute","#grave":"","#check":"\u2713","#tilde":"\u02DC","#slash":"\u2044","#hbar":"\u0127","#box":"","#Box":"","#parallel":"","#perp":"\u22A5","#odot":"","#left":"","#right":""};a.Painter.translateLaTeX=function(d){var h=d;h=this.translateExp(h);while(h.indexOf("^{o}")!=-1){h=h.replace("^{o}","\xBA")}var f=h.match(/\#sqrt{(.*?)}/gi);if(f!=null){for(var e=0;e=0)||(c.indexOf("\\")>=0)||(c.indexOf("{")>=0)};a.Painter.translateMath=function(f,e,d){if(e!=2){f=f.replace(/#LT/g,"\\langle");f=f.replace(/#GT/g,"\\rangle");f=f.replace(/#club/g,"\\clubsuit");f=f.replace(/#spade/g,"\\spadesuit");f=f.replace(/#heart/g,"\\heartsuit");f=f.replace(/#diamond/g,"\\diamondsuit");f=f.replace(/#voidn/g,"\\wp");f=f.replace(/#voidb/g,"f");f=f.replace(/#copyright/g,"(c)");f=f.replace(/#ocopyright/g,"(c)");f=f.replace(/#trademark/g,"TM");f=f.replace(/#void3/g,"TM");f=f.replace(/#oright/g,"R");f=f.replace(/#void1/g,"R");f=f.replace(/#3dots/g,"\\ldots");f=f.replace(/#lbar/g,"\\mid");f=f.replace(/#void8/g,"\\mid");f=f.replace(/#divide/g,"\\div");f=f.replace(/#Jgothic/g,"\\Im");f=f.replace(/#Rgothic/g,"\\Re");f=f.replace(/#doublequote/g,'"');f=f.replace(/#plus/g,"+");f=f.replace(/#diamond/g,"\\diamondsuit");f=f.replace(/#voidn/g,"\\wp");f=f.replace(/#voidb/g,"f");f=f.replace(/#copyright/g,"(c)");f=f.replace(/#ocopyright/g,"(c)");f=f.replace(/#trademark/g,"TM");f=f.replace(/#void3/g,"TM");f=f.replace(/#oright/g,"R");f=f.replace(/#void1/g,"R");f=f.replace(/#3dots/g,"\\ldots");f=f.replace(/#lbar/g,"\\mid");f=f.replace(/#void8/g,"\\mid");f=f.replace(/#divide/g,"\\div");f=f.replace(/#Jgothic/g,"\\Im");f=f.replace(/#Rgothic/g,"\\Re");f=f.replace(/#doublequote/g,'"');f=f.replace(/#plus/g,"+");f=f.replace(/#minus/g,"-");f=f.replace(/#\//g,"/");f=f.replace(/#upoint/g,".");f=f.replace(/#aa/g,"\\mathring{a}");f=f.replace(/#AA/g,"\\mathring{A}");f=f.replace(/#omicron/g,"o");f=f.replace(/#Alpha/g,"A");f=f.replace(/#Beta/g,"B");f=f.replace(/#Epsilon/g,"E");f=f.replace(/#Zeta/g,"Z");f=f.replace(/#Eta/g,"H");f=f.replace(/#Iota/g,"I");f=f.replace(/#Kappa/g,"K");f=f.replace(/#Mu/g,"M");f=f.replace(/#Nu/g,"N");f=f.replace(/#Omicron/g,"O");f=f.replace(/#Rho/g,"P");f=f.replace(/#Tau/g,"T");f=f.replace(/#Chi/g,"X");f=f.replace(/#varomega/g,"\\varpi");f=f.replace(/#corner/g,"?");f=f.replace(/#ltbar/g,"?");f=f.replace(/#bottombar/g,"?");f=f.replace(/#notsubset/g,"?");f=f.replace(/#arcbottom/g,"?");f=f.replace(/#cbar/g,"?");f=f.replace(/#arctop/g,"?");f=f.replace(/#topbar/g,"?");f=f.replace(/#arcbar/g,"?");f=f.replace(/#downleftarrow/g,"?");f=f.replace(/#splitline/g,"\\genfrac{}{}{0pt}{}");f=f.replace(/#frac/g,"\\frac");f=f.replace(/#left{/g,"\\lbrace");f=f.replace(/#right}/g,"\\rbrace");f=f.replace(/#left\[/g,"\\lbrack");f=f.replace(/#right\]/g,"\\rbrack");f=f.replace(/#\[\]{/g,"\\lbrack");f=f.replace(/ } /g,"\\rbrack");f=f.replace(/#\[/g,"\\lbrack");f=f.replace(/#\]/g,"\\rbrack");f=f.replace(/#{/g,"\\lbrace");f=f.replace(/#}/g,"\\rbrace");f=f.replace(/ /g,"\\;");for(var c in a.Painter.symbols_map){var g="\\"+c.substr(1);f=f.replace(new RegExp(c,"g"),g)}}else{f=f.replace(/\\\^/g,"\\hat")}if(typeof d!="string"){return"\\("+f+"\\)"}mathcolor=d;mathcolor=mathcolor.replace(/rgb/g,"[RGB]");mathcolor=mathcolor.replace(/\(/g,"{");mathcolor=mathcolor.replace(/\)/g,"}");return"\\(\\color "+mathcolor+f+"\\)"};a.TBasePainter=function(){};a.TBasePainter.prototype.Cleanup=function(){};a.TBasePainter.prototype.DrawingReady=function(){this["_ready_called_"]=true;if("_ready_callback_" in this){a.CallBack(this["_ready_callback_"],this);delete this["_ready_callback_"];this["_ready_callback_"]=null}return this};a.TBasePainter.prototype.WhenReady=function(c){if("_ready_called_" in this){return a.CallBack(c,this)}this["_ready_callback_"]=c};a.TBasePainter.prototype.GetObject=function(){return null};a.TBasePainter.prototype.UpdateObject=function(c){return false};a.TBasePainter.prototype.RedrawPad=function(c){};a.TBasePainter.prototype.RedrawObject=function(d){if(this.UpdateObject(d)){var c=document.body.style.cursor;document.body.style.cursor="wait";this.RedrawPad();document.body.style.cursor=c}};a.TBasePainter.prototype.CheckResize=function(c){};a.TBasePainter.prototype.SetDivId=function(d){this["divid"]=d;var c=b.select("#"+d);if(c.node()&&c.node().firstChild){c.node().firstChild.painter=this}};a.TBasePainter.prototype.SetItemName=function(c,d){if(c==null){delete this["_hitemname"]}else{this["_hitemname"]=c}if(d!=null){this["_hdrawopt"]=d}};a.TBasePainter.prototype.GetItemName=function(){return("_hitemname" in this)?this["_hitemname"]:null};a.TBasePainter.prototype.GetItemDrawOpt=function(){return("_hdrawopt" in this)?this["_hdrawopt"]:""};a.TObjectPainter=function(c){a.TBasePainter.call(this);this.obj_typename=(c!=null)&&("_typename" in c)?c._typename:"";this.draw_g=null;this.pad_name="";this.main=null};a.TObjectPainter.prototype=Object.create(a.TBasePainter.prototype);a.TObjectPainter.prototype.CheckResize=function(e){var c=this.svg_canvas();var d=c.empty()?null:c.property("pad_painter");if(d){d.CheckCanvasResize()}};a.TObjectPainter.prototype.RemoveDrawG=function(){if(this.draw_g!=null){this.draw_g.remove();this.draw_g=null}};a.TObjectPainter.prototype.RecreateDrawG=function(d,e,g){if(this.draw_g){this.draw_g.selectAll("*").remove()}if(d){if(e==null){e=".text_layer"}if(!this.draw_g){this.draw_g=this.svg_pad().select(e).append("svg:g")}}else{var i=this.svg_frame();var c=i.attr("width");var f=i.attr("height");if(!this.draw_g){if(e==null){e=".main_layer"}if(g){this.draw_g=i.select(e).append("g")}else{this.draw_g=i.select(e).append("svg")}}if(!g){this.draw_g.attr("x",0).attr("y",0).attr("width",c).attr("height",f).attr("viewBox","0 0 "+c+" "+f).attr("overflow","hidden")}}};a.TObjectPainter.prototype.svg_canvas=function(){return b.select("#"+this.divid+" .root_canvas")};a.TObjectPainter.prototype.svg_pad=function(){var d=this.svg_canvas();if((this.pad_name!="")&&!d.empty()){d=d.select("[pad="+this.pad_name+"]")}return d};a.TObjectPainter.prototype.root_pad=function(){var d=this.svg_pad();var c=d.empty()?null:d.property("pad_painter");return c?c.pad:null};a.TObjectPainter.prototype.svg_frame=function(){return this.svg_pad().select(".root_frame")};a.TObjectPainter.prototype.pad_width=function(){var c=parseInt(this.svg_pad().attr("width"));return(c==NaN)?0:c};a.TObjectPainter.prototype.pad_height=function(){var c=parseInt(this.svg_pad().attr("height"));return(c==NaN)?0:c};a.TObjectPainter.prototype.frame_width=function(){var c=parseInt(this.svg_frame().attr("width"));return(c==NaN)?0:c};a.TObjectPainter.prototype.frame_height=function(){var c=parseInt(this.svg_frame().attr("height"));return(c==NaN)?0:c};a.TObjectPainter.prototype.main_painter=function(){if(!this.main){var c=this.svg_pad();if(!c.empty()){this.main=c.property("mainpainter")}}return this.main};a.TObjectPainter.prototype.is_main_painter=function(){return this==this.main_painter()};a.TObjectPainter.prototype.SetDivId=function(g,f){this["divid"]=g;if(f==null){f=0}this["create_canvas"]=false;var e=this.svg_canvas();if(e.empty()&&(f>0)){a.Painter.drawCanvas(g,null);e=this.svg_canvas();this["create_canvas"]=true}if(e.empty()){if((f<0)||(this.obj_typename=="TCanvas")){return}a.console("Special case for "+this.obj_typename+" assign painter to first DOM element");var c=b.select("#"+g);if(c.node()&&c.node().firstChild){c.node().firstChild.painter=this}return}this.pad_name=e.property("current_pad");if(f<0){return}if((f>0)&&this.svg_frame().empty()){a.Painter.drawFrame(g,null);if(this.svg_frame().empty()){return alert("Fail to draw dummy TFrame")}this["create_canvas"]=true}var d=this.svg_pad();if(d.empty()){return}if(d.property("pad_painter")!=this){d.property("pad_painter").painters.push(this)}if((f>0)&&(d.property("mainpainter")==null)){d.property("mainpainter",this)}};a.TObjectPainter.prototype.SetForeignObjectPosition=function(d,c,f){var e=d;if(a.browser.isWebKit){this.svg_canvas().property("redraw_by_resize",true);while(e&&e.attr("class")!="root_canvas"){if((e.attr("class")=="root_frame")||(e.attr("class")=="root_pad")){c+=parseInt(e.attr("x"));f+=parseInt(e.attr("y"))}e=b.select(e.node().parentNode)}}d.attr("x",c).attr("y",f)};a.TObjectPainter.prototype.createAttFill=function(f,g,d){if((g==null)&&f){g=f.fFillStyle}if((d==null)&&f){d=f.fFillColor}var h={color:"none"};h.SetFill=function(j){j.style("fill",this.color);if("antialias" in this){j.style("antialias",this.antialias)}};h.func=h.SetFill.bind(h);if(typeof f=="string"){h.color=f;return h}if((g<1001)||((g>=4000)&&(g<=4100))){return h}h.color=a.Painter.root_colors[d];if(typeof h.color!="string"){h.color="none"}var c=this.svg_canvas();if((g<3000)||(g>3025)||c.empty()){return h}var i="pat_"+g+"_"+d;h.color="url(#"+i+")";h.antialias=false;if(document.getElementById(i)!=null){return h}var e=a.Painter.root_colors[d];switch(g){case 3001:c.append("svg:pattern").attr("id",i).attr("patternUnits","userSpaceOnUse").attr("width","3px").attr("height","2px").style("stroke",e).append("svg:rect").attr("x",0).attr("y",0).attr("width",1).attr("height",1).style("stroke",e).append("svg:rect").attr("x",2).attr("y",0).attr("width",1).attr("height",1).style("stroke",e).append("svg:rect").attr("x",1).attr("y",1).attr("width",1).attr("height",1).style("stroke",e);break;case 3002:c.append("svg:pattern").attr("id",i).attr("patternUnits","userSpaceOnUse").attr("width","4px").attr("height","2px").style("stroke",e).append("svg:rect").attr("x",1).attr("y",0).attr("width",1).attr("height",1).style("stroke",e).append("svg:rect").attr("x",3).attr("y",1).attr("width",1).attr("height",1).style("stroke",e);break;case 3003:c.append("svg:pattern").attr("id",i).attr("patternUnits","userSpaceOnUse").attr("width","4px").attr("height","4px").style("stroke",e).append("svg:rect").attr("x",2).attr("y",1).attr("width",1).attr("height",1).style("stroke",e).append("svg:rect").attr("x",0).attr("y",3).attr("width",1).attr("height",1).style("stroke",e);break;case 3004:c.append("svg:pattern").attr("id",i).attr("patternUnits","userSpaceOnUse").attr("width","8px").attr("height","8px").style("stroke",e).append("svg:line").attr("x1",8).attr("y1",0).attr("x2",0).attr("y2",8).style("stroke",e).style("stroke-width",1);break;case 3005:c.append("svg:pattern").attr("id",i).attr("patternUnits","userSpaceOnUse").attr("width","8px").attr("height","8px").style("stroke",e).append("svg:line").attr("x1",0).attr("y1",0).attr("x2",8).attr("y2",8).style("stroke",e).style("stroke-width",1);break;case 3006:c.append("svg:pattern").attr("id",i).attr("patternUnits","userSpaceOnUse").attr("width","4px").attr("height","4px").style("stroke",e).append("svg:line").attr("x1",1).attr("y1",0).attr("x2",1).attr("y2",3).style("stroke",e).style("stroke-width",1);break;case 3007:c.append("svg:pattern").attr("id",i).attr("patternUnits","userSpaceOnUse").attr("width","4px").attr("height","4px").style("stroke",e).append("svg:line").attr("x1",0).attr("y1",1).attr("x2",3).attr("y2",1).style("stroke",e).style("stroke-width",1);break;default:c.append("svg:pattern").attr("id",i).attr("patternUnits","userSpaceOnUse").attr("width","8px").attr("height","8px").style("stroke",e).append("svg:line").attr("x1",8).attr("y1",0).attr("x2",0).attr("y2",8).style("stroke",e).style("stroke-width",1);break}return h};a.TObjectPainter.prototype.ForEachPainter=function(f){var c=b.select("#"+this.divid);var d=(c.node()&&c.node().firstChild)?c.node().firstChild.painter:null;if(d!=null){f(d);return}var g=this.svg_canvas();if(g.empty()){return}f(g.property("pad_painter"));var h=g.property("pad_painter").painters;for(var e in h){f(h[e])}};a.TObjectPainter.prototype.Cleanup=function(){b.select("#"+this.divid).html("")};a.TObjectPainter.prototype.RedrawPad=function(){var d=this.svg_pad();var c=d.empty()?null:d.property("pad_painter");if(c){c.Redraw()}};a.TObjectPainter.prototype.AddDrag=function(l){if(!a.gStyle.MoveResize){return}var d=this;var c=function(){return Number(d.draw_g.attr("width"))};var n=function(){return Number(d.draw_g.attr("height"))};var o=0,m=0,h=1,e=1;function j(p){if("buttons" in p){return p.buttons===2}else{if("which" in p){return p.which===2}else{if("button" in p){return p.button===2}}}return false}var f=d.draw_g.append("rect").style("opacity","0").style("cursor","se-resize").attr("x",c()-20).attr("y",n()-20).attr("width",20).attr("height",20);var g=null;var k=b.behavior.drag().origin(Object).on("dragstart",function(){if(j(b.event.sourceEvent)){return}b.event.sourceEvent.preventDefault();o=0;m=0;h=d.pad_width()-c();e=d.pad_height()-n();g=b.select(d.draw_g.node().parentNode).append("rect").classed("zoom",true).attr("x",d.draw_g.attr("x")).attr("y",d.draw_g.attr("y")).attr("width",c()).attr("height",n()).style("cursor","move")}).on("drag",function(){if(g==null){return}b.event.sourceEvent.preventDefault();var p=Number(g.attr("x")),s=Number(g.attr("y"));var r=b.event.dx,q=b.event.dy;if((o<0)&&(r>0)){o+=r;r=0;if(o>0){r=o;o=0}}if((o>0)&&(r<0)){o+=r;r=0;if(o<0){r=o;o=0}}if((m<0)&&(q>0)){m+=q;q=0;if(m>0){q=m;m=0}}if((m>0)&&(q<0)){m+=q;q=0;if(m<0){q=m;m=0}}if(p+r<0){o+=(p+r);p=0}else{if(p+r>h){o+=(p+r-h);p=h}else{p+=r}}if(s+q<0){m+=(s+q);s=0}else{if(s+q>e){m+=(s+q-e);s=e}else{s+=q}}g.attr("x",p).attr("y",s);b.event.sourceEvent.stopPropagation()}).on("dragend",function(){if(g==null){return}b.event.sourceEvent.preventDefault();g.style("cursor","auto");var p=Number(g.attr("x")),s=Number(g.attr("y"));var r=p-Number(d.draw_g.attr("x")),q=s-Number(d.draw_g.attr("y"));g.remove();g=null;d.draw_g.attr("x",p).attr("y",s).attr("transform","translate("+p+","+s+")");f.attr("x",c()-20).attr("y",n()-20);if("move" in l){l.move(p,s,r,q)}else{if("obj" in l){l.obj.fX1NDC+=r/d.pad_width();l.obj.fX2NDC+=r/d.pad_width();l.obj.fY1NDC-=q/d.pad_height();l.obj.fY2NDC-=q/d.pad_height()}}});var i=b.behavior.drag().origin(Object).on("dragstart",function(){if(j(b.event.sourceEvent)){return}b.event.sourceEvent.stopPropagation();b.event.sourceEvent.preventDefault();o=0;m=0;h=d.pad_width()-Number(d.draw_g.attr("x"));e=d.pad_height()-Number(d.draw_g.attr("y"));g=b.select(d.draw_g.node().parentNode).append("rect").classed("zoom",true).attr("x",d.draw_g.attr("x")).attr("y",d.draw_g.attr("y")).attr("width",c()).attr("height",n()).style("cursor","se-resize")}).on("drag",function(){if(g==null){return}b.event.sourceEvent.preventDefault();var q=Number(g.attr("width")),s=Number(g.attr("height"));var r=b.event.dx,p=b.event.dy;if((o<0)&&(r>0)){o+=r;r=0;if(o>0){r=o;o=0}}if((o>0)&&(r<0)){o+=r;r=0;if(o<0){r=o;o=0}}if((m<0)&&(p>0)){m+=p;p=0;if(m>0){p=m;m=0}}if((m>0)&&(p<0)){m+=p;p=0;if(m<0){p=m;m=0}}if(q+r>h){o+=(q+r-h);q=h}else{if(q+r<0){o+=(q+r);q=0}else{q+=r}}if(s+p>e){m+=(s+p-e);s=e}else{if(s+p<0){m+=(s+p);s=0}else{s+=p}}g.attr("width",q).attr("height",s);b.event.sourceEvent.stopPropagation()}).on("dragend",function(){if(g==null){return}b.event.sourceEvent.preventDefault();g.style("cursor","auto");var p=Number(g.attr("width"));var q=Number(g.attr("height"));d.draw_g.attr("width",p).attr("height",q);g.remove();g=null;f.attr("x",p-20).attr("y",q-20);if("resize" in l){l.resize(p,q)}else{if("obj" in l){l.obj.fX2NDC=l.obj.fX1NDC+p/d.pad_width();l.obj.fY1NDC=l.obj.fY2NDC-q/d.pad_height()}if(("redraw" in l)&&(typeof d[l.redraw]=="function")){d[l.redraw]()}}});d.draw_g.style("cursor","move").call(k);f.call(i)};a.TObjectPainter.prototype.FindPainterFor=function(c,g){var e=this.svg_pad();var f=e.empty()?null:e.property("pad_painter").painters;if(f==null){return null}for(var h in f){var d=f[h].GetObject();if(d==null){continue}if(c&&(d===c)){return f[h]}if(g&&("fName" in d)&&(d.fName==g)){return f[h]}}return null};a.TObjectPainter.prototype.Redraw=function(){};a.TObjectPainter.prototype.StartTextDrawing=function(e,c,f){if(!f){f=this.draw_g}var d=a.Painter.getFontDetails(e,c);f.call(d.func);f.property("text_font",d);f.property("mathjax_use",false);f.property("text_factor",0);f.property("max_text_width",0)};a.TObjectPainter.prototype.TextScaleFactor=function(d,c){if(!c){c=this.draw_g}if(d&&(d>c.property("text_factor"))){c.property("text_factor",d)}};a.TObjectPainter.prototype.GetBoundarySizes=function(d){var c=d.getBoundingClientRect();if(parseInt(c.width)>0){c=d.getBBox()}return{width:parseInt(c.width),height:parseInt(c.height)}};a.TObjectPainter.prototype.FinishTextDrawing=function(g){if(!g){g=this.draw_g}var i=null;if(g.property("mathjax_use")){g.property("mathjax_use",false);g.property("_painter",this);var e=false;i=g.selectAll(".math_svg");i.each(function(){var j=b.select(this);if(j.node().parentNode!==g.node()){return}var f=j.property("_element");if(b.select(f).select("svg").empty()){e=true}});if(e){return a.AssertPrerequisites("mathjax",{_this:g,func:function(){if(typeof MathJax!="object"){return}MathJax.Hub.Queue(["FinishTextDrawing",this.property("_painter"),this])}})}}if(i==null){i=g.selectAll(".math_svg")}var c=this;i.each(function(){var k=b.select(this);if(k.node().parentNode!==g.node()){return}var j=k.property("_element");k.property("_element",null);var l=b.select(j).select("svg");if(l.empty()){a.console("MathJax SVG ouptut error");return}l.remove();document.body.removeChild(j);k.append(function(){return l.node()});if(k.property("_scale")){var f=c.GetBoundarySizes(k.node());c.TextScaleFactor(1*f.width/parseInt(k.attr("width")),g);c.TextScaleFactor(1*f.height/parseInt(k.attr("height")),g)}});var h=g.property("text_factor");var d=g.property("text_font");if((h>0)&&((h<0.9)||(h>1))){d.size=Math.floor(d.size/h);g.call(d.func)}i.each(function(){var o=b.select(this);if(o.node().parentNode!==g.node()){return}var n=c.GetBoundarySizes(o.node());var p=o.property("_align");var l=o.property("_rotate");var k=parseInt(o.attr("width")),m=parseInt(o.attr("height"));var j=parseInt(o.attr("x")),f=parseInt(o.attr("y"));if(o.property("_scale")){if(p[0]=="middle"){j+=(k-n.width)/2}else{if(p[0]=="end"){j+=(k-n.width)}}if(p[1]=="middle"){f+=(m-n.height)/2}else{if(p[1]=="top"&&!l){f+=(m-n.height)}else{if(p[1]=="bottom"&&l){f+=(m-n.height)}}}}else{if(p[0]=="middle"){j-=n.width/2}else{if(p[0]=="end"){j-=n.width}}if(p[1]=="middle"){f-=n.height/2}else{if(p[1]=="bottom"&&!l){f-=n.height}else{if(p[1]=="top"&&l){f-=n.height}}}}o.attr("x",j).attr("y",f).attr("width",n.width+10).attr("height",n.height+10).attr("visibility",null)});g.selectAll(".hidden_text").attr("opacity","1").classed("hidden_text",false);return g.property("max_text_width")};a.TObjectPainter.prototype.DrawText=function(p,l,j,m,u,g,v,n,z){if(!z){z=this.draw_g}var r;if(typeof p=="string"){r=p.split(";");if(r.length==1){r.push("middle")}}else{r=["start","middle"];if((p/10)>=3){r[0]="end"}else{if((p/10)>=2){r[0]="middle"}}if((p%10)==0){r[1]="bottom"}else{if((p%10)==1){r[1]="bottom"}else{if((p%10)==3){r[1]="top"}}}}var A=(m>0)&&(u>0);if(n==null){n=1}if(n<2){if(!a.Painter.isAnyLatex(g)){n=0}}var t=((a.MathJax<1)&&(n!=2))||(n<1);if(!t&&(u<0)&&!a.browser.isFirefox){t=true}if(t){if(n>0){g=a.Painter.translateLaTeX(g)}var d=l.toFixed(1),c=j.toFixed(1),i=null,f=false;if(m>0){if(r[0]=="middle"){d=(l+m*0.5).toFixed(1)}else{if(r[0]=="end"){d=(l+m).toFixed(1)}}}if(u>0){if(r[1]=="bottom"){c=(j+u).toFixed(1)}else{if(r[1]=="top"){i=".8em"}else{c=(j+u/2).toFixed(1);if(a.browser.isIE){i=".4em"}else{f=true}}}}else{if(u==0){if(r[1]=="top"){i=".8em"}else{if(r[1]=="middle"){if(a.browser.isIE){i=".4em"}else{f=true}}}}}var o=z.append("text").attr("text-anchor",r[0]).attr("x",d).attr("y",c).attr("fill",v?v:null).text(g);if(i!=null){o.attr("dy",i)}if(f){o.attr("dominant-baseline","middle")}if((!A)&&(u==-270)){o.attr("transform","rotate(270, 0, 0)")}var k=this.GetBoundarySizes(o.node());if(A){o.classed("hidden_text",true).attr("opacity","0")}if(k.width>z.property("max_text_width")){z.property("max_text_width",k.width)}if((m>0)&&A){this.TextScaleFactor(1*k.width/m,z)}if((u>0)&&A){this.TextScaleFactor(1*k.height/u,z)}return k.width}m=Math.round(m);u=Math.round(u);l=Math.round(l);j=Math.round(j);var s=false;if(!A){if(u==-270){s=true}m=this.pad_width();u=this.pad_height()}var q=z.append("svg").attr("x",l).attr("y",j).attr("width",m).attr("height",u).attr("class","math_svg").attr("visibility","hidden").property("_scale",A).property("_rotate",s).property("_align",r);if(s){q.attr("transform","rotate(270, 0, 0)")}var e=document.createElement("div");b.select(e).style("visibility","hidden").style("overflow","hidden").style("position","absolute").html(a.Painter.translateMath(g,n,v));document.body.appendChild(e);z.property("mathjax_use",true);q.property("_element",e);a.AssertPrerequisites("mathjax",{_this:e,func:function(){if(typeof MathJax=="object"){MathJax.Hub.Queue(["Typeset",MathJax.Hub,this])}}});return 0};a.TFramePainter=function(c){a.TObjectPainter.call(this,c);this.tframe=c};a.TFramePainter.prototype=Object.create(a.TObjectPainter.prototype);a.TFramePainter.prototype.GetObject=function(){return this.tframe};a.TFramePainter.prototype.Shrink=function(e,c){var d=this.svg_frame().property("NDC");if(d){d.fX1NDC+=e;d.fX2NDC-=c}};a.TFramePainter.prototype.DrawFrameSvg=function(){var t=this.pad_width(),s=this.pad_height();var n=t,z=s;var y=this.svg_frame().empty()?null:this.svg_frame().property("NDC");if(y==null){y=a.clone(a.gStyle.FrameNDC)}var D=this.root_pad();var m=t*y.fX1NDC;var o=t*(1-y.fX2NDC);var f=s*y.fY1NDC;var c=s*(1-y.fY2NDC);var r=this.createAttFill("white"),C=a.Painter.createAttLine("black"),g=0,j=0;if(this.tframe){g=this.tframe.fBorderMode;j=this.tframe.fBorderSize;C=a.Painter.createAttLine(this.tframe);if(D){var A=t/Math.abs(D.fX2-D.fX1);var l=s/Math.abs(D.fY2-D.fY1);var x=(this.tframe.fX1-D.fX1)*A;var e=(this.tframe.fY1-D.fY1)*l;var v=(this.tframe.fX2-D.fX1)*A;var d=(this.tframe.fY2-D.fY1)*l;var p,k,B,u;if(x0){var g=this.tf1.fNpx;for(var k=0;kd)){d=m}if((k==0)||(md){d=m}if(m0){d*=1.05}if(n<0){n*=1.05}var j=a.Create("TH1I");j.fName=this.tf1.fName+"_hist";j.fTitle=this.tf1.fTitle;j.fXaxis["fXmin"]=c;j.fXaxis["fXmax"]=l;j.fYaxis["fXmin"]=n;j.fYaxis["fXmax"]=d;return j};a.TF1Painter.prototype.CreateBins=function(){var c=this;if(this.tf1.fSave.length>0){var g=this.tf1.fNpx;var f=this.tf1.fSave[g+1];var d=this.tf1.fSave[g+2];var e=(d-f)/g;this["bins"]=b.range(g).map(function(h){return{x:f+(h*e),y:c.tf1.fSave[h]}});this["interpolate_method"]="monotone"}else{if(this.tf1.fNpfits<=103){this.tf1.fNpfits=333}var f=this.tf1.fXmin;var d=this.tf1.fXmax;var g=Math.max(this.tf1.fNpx,this.tf1.fNpfits);var e=(d-f)/g;this["bins"]=b.range(g).map(function(h){var i=f+(h*e);var j=c.Eval(i);if(isNaN(j)){j=0}return{x:i,y:j}});this["interpolate_method"]="cardinal-open"}};a.TF1Painter.prototype.DrawBins=function(){var e=this.frame_width(),g=this.frame_height();this.RecreateDrawG();var f=this;var d=this.main_painter();var k=a.Painter.createAttLine(this.tf1);var j=this.createAttFill(this.tf1);if(j.color=="white"){j.color="none"}var c=b.svg.line().x(function(h){return d.grx(h.x).toFixed(1)}).y(function(h){return d.gry(h.y).toFixed(1)}).interpolate(this.interpolate_method);var i=b.svg.area().x(function(h){return d.grx(h.x).toFixed(1)}).y1(g).y0(function(h){return d.gry(h.y).toFixed(1)});if(k.color!="none"){this.draw_g.append("svg:path").attr("class","line").attr("d",c(f.bins)).style("fill","none").call(k.func)}if(j.color!="none"){this.draw_g.append("svg:path").attr("class","area").attr("d",i(f.bins)).style("stroke","none").style("pointer-events","none").call(j.func)}if(a.gStyle.Tooltip){this.draw_g.selectAll().data(this.bins).enter().append("svg:circle").attr("cx",function(h){return d.grx(h.x).toFixed(1)}).attr("cy",function(h){return d.gry(h.y).toFixed(1)}).attr("r",4).style("opacity",0).append("svg:title").text(function(h){return"x = "+d.AxisAsText("x",h.x)+" \ny = "+d.AxisAsText("y",h.y)})}};a.TF1Painter.prototype.UpdateObject=function(c){if(c._typename!=this.tf1._typename){return false}this.tf1=c;this.CreateBins();return true};a.Painter.drawFunction=function(f,e){var c=new a.TF1Painter(e);c.SetDivId(f,-1);if(c.main_painter()==null){var d=c.CreateDummyHisto();a.Painter.drawHistogram1D(f,d)}c.SetDivId(f);c.CreateBins();c.DrawBins();return c.DrawingReady()};a.TGraphPainter=function(c){a.TObjectPainter.call(this,c);this.graph=c;this.ownhisto=false;this.bins=null};a.TGraphPainter.prototype=Object.create(a.TObjectPainter.prototype);a.TGraphPainter.prototype.GetObject=function(){return this.graph};a.TGraphPainter.prototype.Redraw=function(){this.DrawBins()};a.TGraphPainter.prototype.DecodeOptions=function(c){this.draw_all=true;a.extend(this,{optionLine:0,optionAxis:0,optionCurve:0,optionRect:0,optionMark:0,optionBar:0,optionR:0,optionE:0,optionEF:0,optionFill:0,optionZ:0,optionBrackets:0,opt:"LP",out_of_range:false,has_errors:false,draw_errors:false,is_bent:false});this.is_bent=this.graph._typename=="TGraphBentErrors";this.has_errors=(this.graph._typename=="TGraphErrors"||this.graph._typename=="TGraphAsymmErrors"||this.is_bent||this.graph._typename.match(/^RooHist/));this.draw_errors=this.has_errors;if((c!=null)&&(c!="")){this.opt=c.toUpperCase();this.opt.replace("SAME","")}if(this.opt.indexOf("L")!=-1){this.optionLine=1}if(this.opt.indexOf("F")!=-1){this.optionFill=1}if(this.opt.indexOf("A")!=-1){this.optionAxis=1}if(this.opt.indexOf("C")!=-1){this.optionCurve=1;if(this.optionFill==0){this.optionLine=1}}if(this.opt.indexOf("*")!=-1){this.optionMark=2}if(this.opt.indexOf("P")!=-1){this.optionMark=1}if(this.opt.indexOf("B")!=-1){this.optionBar=1;this.draw_errors=false}if(this.opt.indexOf("R")!=-1){this.optionR=1}if(this.opt.indexOf("[]")!=-1){this.optionBrackets=1;this.draw_errors=false}if(this.opt.indexOf("0")!=-1){this.optionMark=1;this.draw_errors=true;this.out_of_range=true}if(this.opt.indexOf("1")!=-1){if(this.optionBar==1){this.optionBar=2}}if(this.opt.indexOf("2")!=-1){this.optionRect=1}if(this.opt.indexOf("3")!=-1){this.optionEF=1;this.optionLine=0;this.draw_errors=false}if(this.opt.indexOf("4")!=-1){this.optionEF=2;this.optionLine=0;this.draw_errors=false}if(this.opt.indexOf("2")!=-1||this.opt.indexOf("5")!=-1){this.optionE=1}if(this.optionLine+this.optionFill+this.optionMark+this.optionBar+this.optionE+this.optionEF+this.optionRect+this.optionBrackets==0){if(this.opt.length==0){this.optionLine=1}}if(this.graph._typename=="TGraphErrors"){var e=b.max(this.graph.fEX);var d=b.max(this.graph.fEY);if(e<1e-300&&d<1e-300){this.draw_errors=false}}};a.TGraphPainter.prototype.CreateBins=function(){var c=this.graph;if(c==null){return}var e=c.fNpoints;if((c._typename=="TCutG")&&(e>3)){e--}var d=0;if(c._typename=="TGraphErrors"){d=1}else{if(c._typename=="TGraphAsymmErrors"||c._typename=="TGraphBentErrors"||c._typename.match(/^RooHist/)){d=2}}this.bins=b.range(e).map(function(f){if(d==1){return{x:c.fX[f],y:c.fY[f],exlow:c.fEX[f],exhigh:c.fEX[f],eylow:c.fEY[f],eyhigh:c.fEY[f]}}if(d==2){return{x:c.fX[f],y:c.fY[f],exlow:c.fEXlow[f],exhigh:c.fEXhigh[f],eylow:c.fEYlow[f],eyhigh:c.fEYhigh[f]}}return{x:c.fX[f],y:c.fY[f]}})};a.TGraphPainter.prototype.CreateHistogram=function(){var d,j,l,e;if(this.bins==null){d=0;j=1;l=0;e=1}else{for(var f in this.bins){var c=this.bins[f];if((d==null)||(c.xj)){j=c.x}if((l==null)||(c.ye)){e=c.y}if("exlow" in c){d=Math.min(d,c.x-c.exlow,c.x+c.exhigh);j=Math.max(j,c.x-c.exlow,c.x+c.exhigh);l=Math.min(l,c.y-c.eylow,c.y+c.eylow);e=Math.max(e,c.y-c.eylow,c.y+c.eylow)}}}if(d==j){j+=1}if(l==e){e+=1}var p=(j-d)*0.1;var o=(e-l)*0.1;var m=d-p,g=j+p;var k=l-o,h=e+o;if((m<0)&&(d>=0)){m=d*0.9}if((g>0)&&(j<=0)){g=0}if(this.graph.fMinimum!=-1111){k=l=this.graph.fMinimum}if(this.graph.fMaximum!=-1111){h=e=this.graph.fMaximum}if((k<0)&&(l>=0)){k=0.9*l}var i=a.CreateTH1(100);i.fName=this.graph.fName+"_h";i.fTitle=this.graph.fTitle;i.fXaxis.fXmin=m;i.fXaxis.fXmax=g;i.fYaxis.fXmin=k;i.fYaxis.fXmax=h;i.fXaxis.fMinimum=k;i.fXaxis.fMaximum=h;i.fBits=i.fBits|a.TH1StatusBits.kNoStats;return i};a.TGraphPainter.prototype.DrawBars=function(){var e=this.bins;if(e.length==1){var f=(this.graph.fHistogram["fXaxis"]["fXmax"]-this.graph.fHistogram["fXaxis"]["fXmin"]);e[0].xl=e[0].x-f/2;e[0].xr=e[0].x+f/2}else{for(var i=0;i0){e[i].xl=(e[i].x+e[i-1].x)/2}if(i=0)){return c.gry(h.y).toFixed(1)}return c.gry(0).toFixed(1)}).attr("width",function(h){return(c.grx(h.xr)-c.grx(h.xl)-1).toFixed(1)}).attr("height",function(j){var h=c.gry(j.y);if(g){return h>d?0:(d-h).toFixed(1)}return(j.y<0)?(h-c.gry(0)).toFixed(1):(c.gry(0)-h).toFixed(1)}).call(this.fillatt.func)};a.TGraphPainter.prototype.DrawBins=function(){var m=this.frame_width(),q=this.frame_height();this.RecreateDrawG();var f=this;var k=this.main_painter();this.lineatt=a.Painter.createAttLine(this.graph);this.fillatt=this.createAttFill(this.graph);function s(i){var h="x = "+k.AxisAsText("x",i.x)+"\ny = "+k.AxisAsText("y",i.y);if(f.draw_errors&&(k.x_kind=="normal")&&("exlow" in i)&&((i.exlow!=0)||(i.exhigh!=0))){h+="\nerror x = -"+k.AxisAsText("x",i.exlow)+"/+"+k.AxisAsText("x",i.exhigh)}if(f.draw_errors&&!k.y_time&&("eylow" in i)&&((i.eylow!=0)||(i.eyhigh!=0))){h+="\nerror y = -"+k.AxisAsText("y",i.eylow)+"/+"+k.AxisAsText("y",i.eyhigh)}return h}if(this.optionEF>0){var t=b.svg.area().x(function(h){return k.grx(h.x).toFixed(1)}).y0(function(h){return k.gry(h.y-h.eylow).toFixed(1)}).y1(function(h){return k.gry(h.y+h.eyhigh).toFixed(1)});if(this.optionEF>1){t=t.interpolate(a.gStyle.Interpolate)}this.draw_g.append("svg:path").attr("d",t(this.bins)).style("stroke","none").call(this.fillatt.func)}var l=b.svg.line().x(function(h){return k.grx(h.x).toFixed(1)}).y(function(h){return k.gry(h.y).toFixed(1)});if(this.optionCurve==1){l=l.interpolate(a.gStyle.Interpolate)}if(this.optionBar){var n=this.DrawBars();if(a.gStyle.Tooltip){n.append("svg:title").text(s)}}if(this.lineatt.width>99){this.optionMark=0;this.DrawExclusion(l)}if(this.optionLine==1||this.optionFill==1){var c="";if(this.graph._typename=="TCutG"){c=" Z"}var v=this.lineatt;if(this.optionLine==0){v=a.Painter.createAttLine("none")}if(this.optionFill!=1){this.fillatt.color="none"}this.draw_g.append("svg:path").attr("d",l(f.bins)+c).attr("class","draw_line").style("pointer-events","none").call(v.func).call(this.fillatt.func);if(a.gStyle.Tooltip&&(this.optionMark==0)){this.draw_g.selectAll("draw_line").data(f.bins).enter().append("svg:circle").attr("cx",function(h){return k.grx(h.x).toFixed(1)}).attr("cy",function(h){return Math.round(k.gry(h.y))}).attr("r",3).style("opacity",0).append("svg:title").text(s)}}var n=null;if(this.draw_errors||this.optionMark||this.optionRect||this.optionBrackets){var d=new Array;for(var p in this.bins){var u=this.bins[p];var g=k.grx(u.x);var e=k.gry(u.y);if(!this.out_of_range&&((g<0)||(g>m)||(e<0)||(e>q))){continue}u.grx1=g.toFixed(1);u.gry1=e.toFixed(1);if(this.has_errors){u.grx0=(k.grx(u.x-u.exlow)-g).toFixed(1);u.grx2=(k.grx(u.x+u.exhigh)-g).toFixed(1);u.gry0=(k.gry(u.y-u.eylow)-e).toFixed(1);u.gry2=(k.gry(u.y+u.eyhigh)-e).toFixed(1);if(this.is_bent){u.grdx0=k.gry(u.y+this.graph.fEXlowd[p])-e;u.grdx2=k.gry(u.y+this.graph.fEXhighd[p])-e;u.grdy0=k.grx(u.x+this.graph.fEYlowd[p])-g;u.grdy2=k.grx(u.x+this.graph.fEYhighd[p])-g}else{u.grdx0=0;u.grdx2=0;u.grdy0=0;u.grdy2=0}}d.push(u)}n=this.draw_g.selectAll("g.node").data(d).enter().append("svg:g").attr("transform",function(h){return"translate("+h.grx1+","+h.gry1+")"})}if(a.gStyle.Tooltip&&n){n.append("svg:title").text(s)}if(this.optionRect){n.filter(function(h){return(h.exlow>0)&&(h.exhigh>0)&&(h.eylow>0)&&(h.eyhigh>0)}).append("svg:rect").attr("x",function(h){return h.grx0}).attr("y",function(h){return h.gry2}).attr("width",function(h){return h.grx2-h.grx0}).attr("height",function(h){return h.gry0-h.gry2}).call(this.fillatt.func)}if(this.optionBrackets){var o=n.filter(function(h){return(h.eylow>0)});o.append("svg:line").attr("x1",-5).attr("y1",function(h){return h.gry0}).attr("x2",5).attr("y2",function(h){return h.gry0}).style("stroke",this.lineatt.color).style("stroke-width",this.lineatt.width);o.append("svg:line").attr("x1",-5).attr("y1",function(h){return h.gry0}).attr("x2",-5).attr("y2",function(h){return Number(h.gry0)-3}).style("stroke",this.lineatt.color).style("stroke-width",this.lineatt.width);o.append("svg:line").attr("x1",5).attr("y1",function(h){return h.gry0}).attr("x2",5).attr("y2",function(h){return Number(h.gry0)-3}).style("stroke",this.lineatt.color).style("stroke-width",this.lineatt.width);o=n.filter(function(h){return(h.eyhigh>0)});o.append("svg:line").attr("x1",-5).attr("y1",function(h){return h.gry2}).attr("x2",5).attr("y2",function(h){return h.gry2}).style("stroke",this.lineatt.color).style("stroke-width",this.lineatt.width);o.append("svg:line").attr("x1",-5).attr("y1",function(h){return h.gry2}).attr("x2",-5).attr("y2",function(h){return Number(h.gry2)+3}).style("stroke",this.lineatt.color).style("stroke-width",this.lineatt.width);o.append("svg:line").attr("x1",5).attr("y1",function(h){return h.gry2}).attr("x2",5).attr("y2",function(h){return Number(h.gry2)+3}).style("stroke",this.lineatt.color).style("stroke-width",this.lineatt.width)}if(this.draw_errors){var o=n.filter(function(h){return(h.exlow>0)});o.append("svg:line").attr("y1",0).attr("x1",0).attr("x2",function(h){return h.grx0}).attr("y2",function(h){return h.grdx0.toFixed(1)}).style("stroke",this.lineatt.color).style("stroke-width",this.lineatt.width);o.append("svg:line").attr("y1",function(h){return(h.grdx0-3).toFixed(1)}).attr("x1",function(h){return h.grx0}).attr("y2",function(h){return(h.grdx0+3).toFixed(1)}).attr("x2",function(h){return h.grx0}).style("stroke",this.lineatt.color).style("stroke-width",this.lineatt.width);o=n.filter(function(h){return(h.exhigh>0)});o.append("svg:line").attr("x1",0).attr("y1",0).attr("x2",function(h){return h.grx2}).attr("y2",function(h){return h.grdx2.toFixed(1)}).style("stroke",this.lineatt.color).style("stroke-width",this.lineatt.width);o.append("svg:line").attr("x1",function(h){return h.grx2}).attr("y1",function(h){return(h.grdx2-3).toFixed(1)}).attr("x2",function(h){return h.grx2}).attr("y2",function(h){return(h.grdx2+3).toFixed(1)}).style("stroke",this.lineatt.color).style("stroke-width",this.lineatt.width);o=n.filter(function(h){return(h.eylow>0)});o.append("svg:line").attr("x1",0).attr("y1",0).attr("x2",function(h){return h.grdy0.toFixed(1)}).attr("y2",function(h){return h.gry0}).style("stroke",this.lineatt.color).style("stroke-width",this.lineatt.width);o.append("svg:line").attr("x1",function(h){return(h.grdy0-3).toFixed(1)}).attr("y1",function(h){return h.gry0}).attr("x2",function(h){return(h.grdy0+3).toFixed(1)}).attr("y2",function(h){return h.gry0}).style("stroke",this.lineatt.color).style("stroke-width",this.lineatt.width);o=n.filter(function(h){return(h.eyhigh>0)});o.append("svg:line").attr("x1",0).attr("y1",0).attr("x2",function(h){return h.grdy2.toFixed(1)}).attr("y2",function(h){return h.gry2}).style("stroke",this.lineatt.color).style("stroke-width",this.lineatt.width);o.append("svg:line").attr("x1",function(h){return(h.grdy2-3).toFixed(1)}).attr("y1",function(h){return h.gry2}).attr("x2",function(h){return(h.grdy2+3).toFixed(1)}).attr("y2",function(h){return h.gry2}).style("stroke",this.lineatt.color).style("stroke-width",this.lineatt.width)}if(this.optionMark){var r=(this.optionMark==2)?3:null;var j=a.Painter.createAttMarker(this.graph,r);n.append("svg:path").call(j.func)}};a.TGraphPainter.prototype.DrawExclusion=function(r){var z,y;var Q=this.graph.fNpoints;var H=new Array(Q+2),x=new Array(Q+2),F=new Array(Q+2),s=new Array(Q+2),L=new Array(2*Q+2),A=new Array(2*Q+2);var U,S,R,c,d=1;if(this.lineatt.width>32767){this.lineatt.width=65536-this.lineatt.width;d=-1}d*=(this.lineatt.width/100)*0.005;this.lineatt.width=this.lineatt.width%100;if(this.lineatt.width>0){this.optionLine=1}var J=this.frame_width(),T=this.frame_height();var K=J/T;var q=this.main_painter().xmin,I=this.main_painter().xmax,G=this.main_painter().ymin,g=this.main_painter().ymax;for(S=0;ST){x[S]=x[S]/K}else{if(T>J){H[S]=H[S]/K}}}L[0]=H[0];A[0]=x[0];c=0;for(S=1;S=L[c-1]){F[c]=L[c]-d*Math.sin(U);s[c]=A[c]+d*Math.cos(U)}else{F[c]=L[c]+d*Math.sin(U);s[c]=A[c]-d*Math.cos(U)}var P,O,N,v,p,u,o,t,m;for(S=1;S0;S--){for(R=S-1;R>0;R--){if(F[S-1]==F[S]||F[R-1]==F[R]){continue}l=(s[S-1]-s[S])/(F[S-1]-F[S]);E=s[S]-l*F[S];k=(s[R-1]-s[R])/(F[R-1]-F[R]);D=s[R]-k*F[R];if(l!=k){M=(D-E)/(l-k);C=l*M+E;if(M>Math.min(F[S],F[S-1])&&MMath.min(F[R],F[R-1])&&MMath.min(s[S],s[S-1])&&CMath.min(s[R],s[R-1])&&CT){L[S]=q+(L[S]*(I-q));A[S]=G+(A[S]*(g-G))*K}else{if(T>J){L[S]=q+(L[S]*(I-q))*K;A[S]=G+(A[S]*(g-G))}else{L[S]=q+(L[S]*(I-q));A[S]=G+(A[S]*(g-G))}}if((L[S]<=0)&&this.main_painter().options.Logx){L[S]=q}if((A[S]<=0)&&this.main_painter().options.Logy){A[S]=G}}var f=b.range(c).map(function(h){return{x:L[h],y:A[h]}});H.splice(0,H.length);x.splice(0,x.length);H=null;x=null;F.splice(0,F.length);s.splice(0,s.length);F=null;s=null;L.splice(0,L.length);A.splice(0,A.length);L=null;A=null;this.draw_g.append("svg:path").attr("d",r(f)).style("stroke","none").style("stroke-width",1).call(this.fillatt.func).style("opacity",0.75)};a.TGraphPainter.prototype.UpdateObject=function(c){if(c._typename!=this.graph._typename){return false}if(this.ownhisto){this.main_painter().UpdateObject(c.fHistogram)}this.graph.fX=c.fX;this.graph.fY=c.fY;this.graph.fNpoints=c.fNpoints;this.CreateBins();return true};a.Painter.drawGraph=function(f,e,d){var c=new a.TGraphPainter(e);c.CreateBins();c.SetDivId(f,-1);if(c.main_painter()==null){if(e.fHistogram==null){e.fHistogram=c.CreateHistogram()}a.Painter.drawHistogram1D(f,e.fHistogram);c.ownhisto=true}c.SetDivId(f);c.DecodeOptions(d);c.DrawBins();return c.DrawingReady()};a.TPavePainter=function(c){a.TObjectPainter.call(this,c);this.pavetext=c;this.Enabled=true};a.TPavePainter.prototype=Object.create(a.TObjectPainter.prototype);a.TPavePainter.prototype.GetObject=function(){return this.pavetext};a.TPavePainter.prototype.DrawPaveText=function(){var s=this.pavetext;var r=this.pad_width(),G=this.pad_height();if((s.fOption.indexOf("NDC")<0)&&!s.fInit){s.fInit=1;var J=this.root_pad();if(J!=null){if(J.fLogx){if(s.fX1>0){s.fX1=a.Math.log10(s.fX1)}if(s.fX2>0){s.fX2=a.Math.log10(s.fX2)}}if(J.fLogy){if(s.fY1>0){s.fY1=a.Math.log10(s.fY1)}if(s.fY2>0){s.fY2=a.Math.log10(s.fY2)}}s.fX1NDC=(s.fX1-J.fX1)/(J.fX2-J.fX1);s.fY1NDC=(s.fY1-J.fY1)/(J.fY2-J.fY1);s.fX2NDC=(s.fX2-J.fX1)/(J.fX2-J.fX1);s.fY2NDC=(s.fY2-J.fY1)/(J.fY2-J.fY1)}else{s.fX1NDC=0.1;s.fX2NDC=0.9;s.fY1NDC=0.1;s.fY2NDC=0.9}}var f=Math.round(s.fX1NDC*r);var c=Math.round((1-s.fY1NDC)*G);var C=Math.round(Math.abs(s.fX2NDC-s.fX1NDC)*r);var v=Math.round(Math.abs(s.fY2NDC-s.fY1NDC)*G);c-=v;var u=s.fLines.arr.length;var M=a.Painter.root_colors[s.fTextColor];var I=a.Painter.root_colors[s.fShadowColor];var m=this.createAttFill(s);var K=s.fBorderSize?s.fBorderSize:0;var e=a.Painter.createAttLine(s,K>0?1:0);var N=0,H=0;var g=new Array;for(var F=0;FH){H=B.length}}var o=this;this.RecreateDrawG(true,".stat_layer");this.draw_g.attr("x",f).attr("y",c).attr("width",C).attr("height",v).attr("transform","translate("+f+","+c+")");var i=this.draw_g.append("rect").attr("x",0).attr("y",0).attr("width",C).attr("height",v).call(m.func).call(e.func);var A=v/u,l=false;var L=s.fMargin*C;this.StartTextDrawing(s.fTextFont,v/(u*1.2));if(u==1){this.DrawText(s.fTextAlign,0,0,C,v,g[0],M)}else{for(var F=0;F0)&&(F>=N)){var B=g[F].split("|");for(var y=0;y0)&&(H>1)){for(var D=N;D1){this.draw_g.append("svg:line").attr("x1",C+(K/2)).attr("y1",K+1).attr("x2",C+(K/2)).attr("y2",v+K-1).style("stroke",e.color).style("stroke-width",K);this.draw_g.append("svg:line").attr("x1",K+1).attr("y1",v+(K/2)).attr("x2",C+K-1).attr("y2",v+(K/2)).style("stroke",e.color).style("stroke-width",K)}if((s.fLabel.length>0)&&!this.IsStats()){var k=this.draw_g.append("svg:g").attr("x",C*0.25).attr("y",-G*0.02).attr("width",C*0.5).attr("height",G*0.04).attr("transform","translate("+C*0.25+","+-G*0.02+")");var t=k.append("rect").attr("x",0).attr("y",0).attr("width",C*0.5).attr("height",G*0.04).call(m.func).call(e.func);this.StartTextDrawing(s.fTextFont,G*0.04/1.5,k);this.DrawText(22,0,0,C*0.5,G*0.04,s.fLabel,M,1,k);this.FinishTextDrawing(k)}this.AddDrag({obj:s,redraw:"DrawPaveText"})};a.TPavePainter.prototype.AddLine=function(c){this.pavetext.AddText(c)};a.TPavePainter.prototype.IsStats=function(){if(!this.pavetext){return false}return this.pavetext._typename=="TPaveStats"};a.TPavePainter.prototype.Format=function(e,c){if(!c){c="stat"}if(c=="stat"){c=this.pavetext.fStatFormat;if(!c){c=a.gStyle.StatFormat}}else{if(c=="fit"){c=this.pavetext.fFitFormat;if(!c){c=a.gStyle.FitFormat}}else{if(c=="entries"){if(e<1000000000){return e.toFixed(0)}c="14.7g"}else{if(c=="last"){c=this["lastformat"]}}}}delete this["lastformat"];if(!c){c="6.4g"}var d=a.FFormat(e,c);this["lastformat"]=a.lastFFormat;return d};a.TPavePainter.prototype.FillStatistic=function(){if(!this.IsStats()){return}if(this.pavetext.fName!="stats"){return}var c=new Number(this.pavetext.fOptStat);var d=new Number(this.pavetext.fOptFit);if(!c){c=a.gStyle.OptStat}if(!d){d=a.gStyle.OptFit}if("FillStatistic" in this.main_painter()){this.pavetext.Clear();this.main_painter().FillStatistic(this,c,d)}};a.TPavePainter.prototype.UpdateObject=function(c){if(c._typename!="TPaveText"){return false}this.pavetext.fLines=a.clone(c.fLines);return true};a.TPavePainter.prototype.Redraw=function(){if(this.Enabled){this.FillStatistic();this.DrawPaveText()}else{this.RemoveDrawG()}};a.Painter.drawPaveText=function(e,d){var c=new a.TPavePainter(d);c.SetDivId(e);c.FillStatistic();c.DrawPaveText();return c.DrawingReady()};a.TPadPainter=function(d,c){a.TObjectPainter.call(this,d);if(this.obj_typename==""){this.obj_typename=c?"TCanvas":"TPad"}this.pad=d;this.iscan=c;this.painters=new Array};a.TPadPainter.prototype=Object.create(a.TObjectPainter.prototype);a.TPadPainter.prototype.GetStyleValue=function(c,d){var e=c.style(d);if(!e){return 0}e=parseFloat(e.replace("px",""));return(e===NaN)?0:e};a.TPadPainter.prototype.CreateCanvasSvg=function(e){var d=b.select("#"+this.divid);var k=d.node().getBoundingClientRect();var l=Math.round(k.width-this.GetStyleValue(d,"padding-left")-this.GetStyleValue(d,"padding-right"));var f=Math.round(k.height-this.GetStyleValue(d,"padding-top")-this.GetStyleValue(d,"padding-bottom"));var j=null;var g=null;if(e>0){g=this.svg_canvas();var i=g.property("last_width");var c=g.property("last_height");if((l<=0)&&(f<=0)){g.attr("visibility","hidden");return false}else{g.attr("visibility","visible")}if(e==1){if((g.attr("width")==l)&&(g.attr("height")==f)){return false}if((i==l)&&(c==f)){return false}}j=g.property("height_factor");if(j!=null){f=Math.round(l*j);d.style("height",f+"px")}if((e==1)&&(i>0)&&(c>0)&&!g.property("redraw_by_resize")){if((l/i>0.5)&&(l/i<2)&&(f/c>0.5)&&(f/c<2)){g.attr("width",l).attr("height",f);return false}}}else{if((f<10)&&(l>0)){j=0.66;if((this.pad!=null)&&("fCw" in this.pad)&&("fCh" in this.pad)&&(this.pad.fCw>0)){j=this.pad.fCh/this.pad.fCw;if((j<0.1)||(j>10)){j=0.66}}f=Math.round(l*j);d.style("height",f+"px")}var m=null;if(this.pad&&"fFillColor" in this.pad){m=this.createAttFill(this.pad)}else{m=this.createAttFill("white")}d.style("background-color",m.color);g=b.select("#"+this.divid).append("svg").attr("class","root_canvas").style("background-color",m.color).property("pad_painter",this).property("mainpainter",null).property("current_pad","");g.append("svg:g").attr("class","frame_layer");g.append("svg:g").attr("class","text_layer");g.append("svg:g").attr("class","stat_layer")}if((l<=0)||(f<=0)){g.attr("visibility","hidden");l=200;f=100}else{g.attr("visibility","visible")}g.attr("width",l).attr("height",f).attr("viewBox","0 0 "+l+" "+f).attr("preserveAspectRatio","none").property("height_factor",j).property("last_width",l).property("last_height",f).property("redraw_by_resize",false);return true};a.TPadPainter.prototype.CreatePadSvg=function(n){var d=Number(this.svg_canvas().attr("width")),l=Number(this.svg_canvas().attr("height"));var j=Math.round(this.pad.fAbsXlowNDC*d);var i=Math.round(l-this.pad.fAbsYlowNDC*l);var k=Math.round(this.pad.fAbsWNDC*d);var g=Math.round(this.pad.fAbsHNDC*l);i-=g;var m=this.createAttFill(this.pad);var c=a.Painter.createAttLine(this.pad);if(this.pad.fBorderMode==0){c.color="none"}var e=null,f=null;if(n){e=this.svg_pad();f=e.select(".root_pad_border")}else{e=this.svg_canvas().append("g").attr("class","root_pad").attr("pad",this.pad.fName).property("pad_painter",this).property("mainpainter",null);f=e.append("svg:rect").attr("class","root_pad_border");e.append("svg:g").attr("class","frame_layer");e.append("svg:g").attr("class","text_layer");e.append("svg:g").attr("class","stat_layer")}e.attr("width",k).attr("height",g).attr("viewBox",j+" "+i+" "+(j+k)+" "+(i+g)).attr("transform","translate("+j+","+i+")");f.attr("x",0).attr("y",0).attr("width",k).attr("height",g).call(m.func).call(c.func)};a.TPadPainter.prototype.CheckColors=function(d){if(d==null){return}for(var c in d.fPrimitives.arr){var e=d.fPrimitives.arr[c];if(e==null){continue}if((e._typename=="TObjArray")&&(e.name=="ListOfColors")){a.Painter.adoptRootColors(e);d.fPrimitives.arr.splice(c,1);d.fPrimitives.opt.splice(c,1);return}}};a.TPadPainter.prototype.DrawPrimitives=function(){if(this.pad==null){return}for(var d in this.pad.fPrimitives.arr){var c=a.draw(this.divid,this.pad.fPrimitives.arr[d],this.pad.fPrimitives.opt[d]);if(c){c._primitive=true}}};a.TPadPainter.prototype.Redraw=function(){if(this.iscan){this.CreateCanvasSvg(2)}else{this.CreatePadSvg(true)}for(var c in this.painters){this.painters[c].Redraw()}};a.TPadPainter.prototype.CheckCanvasResize=function(){if(!this.iscan){return}var d=this.CreateCanvasSvg(1);if(d){for(var c in this.painters){this.painters[c].Redraw()}}};a.TPadPainter.prototype.UpdateObject=function(g){if((g==null)||!("fPrimitives" in g)){return false}if(this.iscan){this.CheckColors(g)}if(g.fPrimitives.arr.length!=this.pad.fPrimitives.arr.length){return false}var e=false,f=0;for(var h in g.fPrimitives.arr){var d=g.fPrimitives.arr[h];while(fn*0.8){y=n*0.8}this.RecreateDrawG(true,".text_layer");this.draw_g.attr("x",e).attr("y",d).attr("width",n).attr("height",I).attr("transform","translate("+e+", "+d+")");for(var G=0;GA-3){t=A-3-e}var L=a.Painter.root_colors[g.fTextColor];this.StartTextDrawing(g.fTextFont,g.fTitleSize*x);this.DrawText(33,0,t,0,-270,g.fTitle,L);this.FinishTextDrawing()}this.AddDrag({obj:H,redraw:"DrawPalette"});if(!a.gStyle.Zooming){return}var k=this,m=null,J=false,D=0,C=0,c=null;function q(){if(!J){return}b.event.preventDefault();var i=b.mouse(m);if(i[1]0)&&(this.main_painter().options.Color>0)}if(c){this.DrawPalette()}else{this.RemoveDrawG()}};a.Painter.drawPaletteAxis=function(e,d){var c=new a.TPaletteAxisPainter(d);c.SetDivId(e);c.DrawPalette();return c};a.THistPainter=function(c){a.TObjectPainter.call(this,c);this.histo=c;this.shrink_frame_left=0;this.draw_content=true;this.nbinsx=0;this.nbinsy=0;this.x_kind="normal";this.y_time=false};a.THistPainter.prototype=Object.create(a.TObjectPainter.prototype);a.THistPainter.prototype.GetObject=function(){return this.histo};a.THistPainter.prototype.IsTProfile=function(){return this.histo&&this.histo._typename=="TProfile"};a.THistPainter.prototype.IsTH2Poly=function(){return this.histo&&this.histo._typename.match(/^TH2Poly/)};a.THistPainter.prototype.Dimension=function(){if(!this.histo){return 0}if("fDimension" in this.histo){return this.histo.fDimension}if(this.histo._typename.match(/^TH2/)){return 2}if(this.histo._typename.match(/^TH3/)){return 3}return 1};a.THistPainter.prototype.DecodeOptions=function(d){if((d==null)||(d=="")){d=this.histo.fOption}var g=this.Dimension();var i={Axis:0,Bar:0,Curve:0,Error:0,Hist:0,Line:0,Mark:0,Fill:0,Same:0,Scat:0,Func:0,Star:0,Arrow:0,Box:0,Text:0,Char:0,Color:0,Contour:0,Lego:0,Surf:0,Off:0,Tri:0,Proj:0,AxisPos:0,Spec:0,Pie:0,List:0,Zscale:0,FrontBox:1,BackBox:1,System:a.Painter.Coord.kCARTESIAN,AutoColor:0,NoStat:0,AutoZoom:false,HighRes:0,Zero:0,Logx:0,Logy:0,Logz:0,Gridx:0,Gridy:0};var h=d.toUpperCase();h=a.Painter.clearCuts(h);if(g>1){i.Scat=1}if((g==1)&&(this.histo.fSumw2.length>0)){i.Error=2}if("fFunctions" in this.histo){i.Func=1}if(h.indexOf("AUTOCOL")!=-1){i.AutoColor=1;i.Hist=1;h=h.replace("AUTOCOL","")}if(h.indexOf("AUTOZOOM")!=-1){i.AutoZoom=1;i.Hist=1;h=h.replace("AUTOZOOM","")}if(h.indexOf("NOSTAT")!=-1){i.NoStat=1;h=h.replace("NOSTAT","")}if(h.indexOf("LOGX")!=-1){i.Logx=1;h=h.replace("LOGX","")}if(h.indexOf("LOGY")!=-1){i.Logy=1;h=h.replace("LOGY","")}if(h.indexOf("LOGZ")!=-1){i.Logz=1;h=h.replace("LOGZ","")}h=h.trim();while((h.length>0)&&(h[0]==","||h[0]==";")){h=h.substr(1)}var k=h.length;if(!k){i.Hist=1}var f=h.indexOf("SPEC");if(f!=-1){i.Scat=0;h=h.replace("SPEC"," ");var j=0;f=h.indexOf("BF(");if(f!=-1){j=parseInt(h)}i.Spec=Math.max(1600,j);return i}if(h.indexOf("GL")!=-1){h=h.replace("GL"," ")}if(h.indexOf("X+")!=-1){i.AxisPos=10;h=h.replace("X+"," ")}if(h.indexOf("Y+")!=-1){i.AxisPos+=1;h=h.replace("Y+"," ")}if((i.AxisPos==10||i.AxisPos==1)&&(k==2)){i.Hist=1}if(i.AxisPos==11&&k==4){i.Hist=1}if(h.indexOf("SAMES")!=-1){if(k==5){i.Hist=1}i.Same=2;h=h.replace("SAMES"," ")}if(h.indexOf("SAME")!=-1){if(k==4){i.Hist=1}i.Same=1;h=h.replace("SAME"," ")}if(h.indexOf("PIE")!=-1){i.Pie=1;h=h.replace("PIE"," ")}f=h.indexOf("LEGO");if(f!=-1){i.Scat=0;i.Lego=1;h=h.replace("LEGO"," ");if(h[f+4]=="1"){i.Lego=11;h[f+4]=" "}if(h[f+4]=="2"){i.Lego=12;h[f+4]=" "}if(h[f+4]=="3"){i.Lego=13;h[f+4]=" "}f=h.indexOf("FB");if(f!=-1){i.FrontBox=0;h=h.replace("FB"," ")}f=h.indexOf("BB");if(f!=-1){i.BackBox=0;h=h.replace("BB"," ")}f=h.indexOf("0");if(f!=-1){i.Zero=1;h=h.replace("0"," ")}}f=h.indexOf("SURF");if(f!=-1){i.Scat=0;i.Surf=1;h=h.replace("SURF"," ");if(h[f+4]=="1"){i.Surf=11;h[f+4]=" "}if(h[f+4]=="2"){i.Surf=12;h[f+4]=" "}if(h[f+4]=="3"){i.Surf=13;h[f+4]=" "}if(h[f+4]=="4"){i.Surf=14;h[f+4]=" "}if(h[f+4]=="5"){i.Surf=15;h[f+4]=" "}if(h[f+4]=="6"){i.Surf=16;h[f+4]=" "}if(h[f+4]=="7"){i.Surf=17;h[f+4]=" "}f=h.indexOf("FB");if(f!=-1){i.FrontBox=0;h=h.replace("FB"," ")}f=h.indexOf("BB");if(f!=-1){i.BackBox=0;h=h.replace("BB"," ")}}f=h.indexOf("TF3");if(f!=-1){f=h.indexOf("FB");if(f!=-1){i.FrontBox=0;h=h.replace("FB"," ")}f=h.indexOf("BB");if(f!=-1){i.BackBox=0;h=h.replace("BB"," ")}}f=h.indexOf("ISO");if(f!=-1){f=h.indexOf("FB");if(f!=-1){i.FrontBox=0;h=h.replace("FB"," ")}f=h.indexOf("BB");if(f!=-1){i.BackBox=0;h=h.replace("BB"," ")}}f=h.indexOf("LIST");if(f!=-1){i.List=1;h=h.replace("LIST"," ")}f=h.indexOf("CONT");if(f!=-1){h=h.replace("CONT"," ");if(g>1){i.Scat=0;i.Contour=1;if(h[f+4]=="1"){i.Contour=11;h[f+4]=" "}if(h[f+4]=="2"){i.Contour=12;h[f+4]=" "}if(h[f+4]=="3"){i.Contour=13;h[f+4]=" "}if(h[f+4]=="4"){i.Contour=14;h[f+4]=" "}if(h[f+4]=="5"){i.Contour=15;h[f+4]=" "}}else{i.Hist=1}}f=h.indexOf("HBAR");if(f!=-1){i.Hist=0;i.Bar=20;h=h.replace("HBAR"," ");if(h[f+4]=="1"){i.Bar=21;h[f+4]=" "}if(h[f+4]=="2"){i.Bar=22;h[f+4]=" "}if(h[f+4]=="3"){i.Bar=23;h[f+4]=" "}if(h[f+4]=="4"){i.Bar=24;h[f+4]=" "}}f=h.indexOf("BAR");if(f!=-1){i.Hist=0;i.Bar=10;h=h.replace("BAR"," ");if(h[f+3]=="1"){i.Bar=11;h[f+3]=" "}if(h[f+3]=="2"){i.Bar=12;h[f+3]=" "}if(h[f+3]=="3"){i.Bar=13;h[f+3]=" "}if(h[f+3]=="4"){i.Bar=14;h[f+3]=" "}}f=h.indexOf("ARR");if(f!=-1){h=h.replace("ARR"," ");if(g>1){i.Arrow=1;i.Scat=0}else{i.Hist=1}}f=h.indexOf("BOX");if(f!=-1){h=h.replace("BOX"," ");if(g>1){Hoption.Scat=0;Hoption.Box=1;if(h[f+3]=="1"){i.Box=11;h[f+3]=" "}}else{i.Hist=1}}f=h.indexOf("COL");if(f!=-1){var c="COL";if(h.charAt(f+3)=="1"){i.Color=1;c+="1";f++}else{if(h.charAt(f+3)=="2"){i.Color=2;c+="2";f++}else{if(h.charAt(f+3)=="3"){i.Color=3;c+="3";f++}else{i.Color=a.gStyle.DefaultCol}}}if(h.charAt(f+4)=="Z"){i.Zscale=1;c+="Z"}h=h.replace(c,"");if(g==1){i.Hist=1}else{i.Scat=0}}if(h.indexOf("CHAR")!=-1){i.Char=1;h=h.replace("CHAR"," ");i.Scat=0}f=h.indexOf("FUNC");if(f!=-1){i.Func=2;h=h.replace("FUNC"," ");i.Hist=0}f=h.indexOf("HIST");if(f!=-1){i.Hist=2;h=h.replace("HIST"," ");i.Func=0;i.Error=0}if(h.indexOf("AXIS")!=-1){i.Axis=1;h=h.replace("AXIS"," ")}if(h.indexOf("AXIG")!=-1){i.Axis=2;h=h.replace("AXIG"," ")}if(h.indexOf("SCAT")!=-1){i.Scat=1;h=h.replace("SCAT"," ")}f=h.indexOf("TEXT");if(f!=-1){var e=parseInt(h);if(!isNaN(e)){if(e<0){e=0}if(e>90){e=90}i.Text=1000+e}else{i.Text=1}h=h.replace("TEXT"," ");f=h.indexOf("N");if(f!=-1&&this.IsTH2Poly()){i.Text+=3000}i.Scat=0}if(h.indexOf("POL")!=-1){i.System=a.Painter.Coord.kPOLAR;h=h.replace("POL"," ")}if(h.indexOf("CYL")!=-1){i.System=a.Painter.Coord.kCYLINDRICAL;h=h.replace("CYL"," ")}if(h.indexOf("SPH")!=-1){i.System=a.Painter.Coord.kSPHERICAL;h=h.replace("SPH"," ")}f=h.indexOf("PSR");if(f!=-1){i.System=a.Painter.Coord.kRAPIDITY;h=h.replace("PSR"," ")}f=h.indexOf("TRI");if(f!=-1){i.Scat=0;i.Color=0;i.Tri=1;h=h.replace("TRI"," ");f=h.indexOf("FB");if(f!=-1){i.FrontBox=0;h=h.replace("FB"," ")}f=h.indexOf("BB");if(f!=-1){i.BackBox=0;h=h.replace("BB"," ")}f=h.indexOf("ERR");if(f!=-1){h=h.replace("ERR"," ")}}f=h.indexOf("AITOFF");if(f!=-1){Hoption.Proj=1;h=h.replace("AITOFF"," ")}f=h.indexOf("MERCATOR");if(f!=-1){i.Proj=2;h=h.replace("MERCATOR"," ")}f=h.indexOf("SINUSOIDAL");if(f!=-1){i.Proj=3;h=h.replace("SINUSOIDAL"," ")}f=h.indexOf("PARABOLIC");if(f!=-1){i.Proj=4;h=h.replace("PARABOLIC"," ")}if(i.Proj>0){i.Scat=0;i.Contour=14}if(h.indexOf("A")!=-1){i.Axis=-1}if(h.indexOf("B")!=-1){i.Bar=1}if(h.indexOf("C")!=-1){i.Curve=1;i.Hist=-1}if(h.indexOf("F")!=-1){i.Fill=1}if(h.indexOf("][")!=-1){i.Off=1;i.Hist=1}if(h.indexOf("F2")!=-1){i.Fill=2}if(h.indexOf("L")!=-1){i.Line=1;i.Hist=-1}if(h.indexOf("P")!=-1){i.Mark=1;i.Hist=-1}if(h.indexOf("Z")!=-1){i.Zscale=1}if(h.indexOf("*")!=-1){i.Star=1}if(h.indexOf("H")!=-1){i.Hist=2}if(h.indexOf("P0")!=-1){i.Mark=10}if(this.IsTH2Poly()){if(i.Fill+i.Line+i.Mark!=0){i.Scat=0}}if(h.indexOf("E")!=-1){if(g==1){i.Error=1;if(h.indexOf("E0")!=-1){i.Error=10}if(h.indexOf("E1")!=-1){i.Error=11}if(h.indexOf("E2")!=-1){i.Error=12}if(h.indexOf("E3")!=-1){i.Error=13}if(h.indexOf("E4")!=-1){i.Error=14}if(h.indexOf("E5")!=-1){i.Error=15}if(h.indexOf("E6")!=-1){i.Error=16}if(h.indexOf("X0")!=-1){if(i.Error==1){i.Error+=20}i.Error+=10}if(i.Text&&this.IsTProfile()){i.Text+=2000;i.Error=0}}else{if(i.Error==0){i.Error=100;i.Scat=0}if(i.Text){i.Text+=2000;i.Error=0}}}if(h.indexOf("9")!=-1){i.HighRes=1}if(i.Surf==15){if(i.System==a.Painter.Coord.kPOLAR||i.System==a.Painter.Coord.kCARTESIAN){i.Surf=13}}if(i.Bar==1){i.Hist=-1}return i};a.THistPainter.prototype.GetAutoColor=function(c){if(this.options.AutoColor<=0){return c}var d=this.options.AutoColor;this.options.AutoColor=d%8+1;return a.Painter.root_colors[d]};a.THistPainter.prototype.ScanContent=function(){alert("HistPainter.prototype.ScanContent not implemented")};a.THistPainter.prototype.CheckPadOptions=function(){var c=this.root_pad();if(c!=null){this.options.Logx=c.fLogx;this.options.Logy=c.fLogy;this.options.Logz=c.fLogz;this.options.Gridx=c.fGridx;this.options.Gridy=c.fGridy}if(this.main_painter()!==this){return}this["zoom_xmin"]=0;this["zoom_xmax"]=0;this["zoom_ymin"]=0;this["zoom_ymax"]=0;this["zoom_zmin"]=0;this["zoom_zmax"]=0;if((c!=null)&&("fUxmin" in c)&&!this.create_canvas){this["zoom_xmin"]=c.fUxmin;this["zoom_xmax"]=c.fUxmax;this["zoom_ymin"]=c.fUymin;this["zoom_ymax"]=c.fUymax;if(c.fLogx>0){this["zoom_xmin"]=Math.exp(this["zoom_xmin"]*Math.log(10));this["zoom_xmax"]=Math.exp(this["zoom_xmax"]*Math.log(10))}if(c.fLogy>0){this["zoom_ymin"]=Math.exp(this["zoom_ymin"]*Math.log(10));this["zoom_ymax"]=Math.exp(this["zoom_ymax"]*Math.log(10))}}};a.THistPainter.prototype.UpdateObject=function(c){if(c._typename!=this.histo._typename){alert("JSROOT.THistPainter.UpdateObject - wrong class "+c._typename+" expected "+this.histo._typename);return false}this.histo.fArray=c.fArray;this.histo.fNcells=c.fNcells;this.histo.fTitle=c.fTitle;this.histo.fMinimum=c.fMinimum;this.histo.fMaximum=c.fMaximum;this.histo.fXaxis["fNbins"]=c.fXaxis["fNbins"];this.histo.fXaxis["fXmin"]=c.fXaxis["fXmin"];this.histo.fXaxis["fXmax"]=c.fXaxis["fXmax"];this.histo.fYaxis["fXmin"]=c.fYaxis["fXmin"];this.histo.fYaxis["fXmax"]=c.fYaxis["fXmax"];if(this.IsTProfile()){this.histo.fBinEntries=c.fBinEntries;this.histo.fSumw2=c.fSumw2}this.ScanContent();return true};a.THistPainter.prototype.CreateXY=function(){if(!this.is_main_painter()){this["x"]=this.main_painter()["x"];this["y"]=this.main_painter()["y"];return}var c=this.frame_width(),e=this.frame_height();if(this.histo.fXaxis["fTimeDisplay"]){this.x_kind="time";this["timeoffsetx"]=a.Painter.getTimeOffset(this.histo.fXaxis);this["ConvertX"]=function(h){return new Date(this.timeoffsetx+h*1000)};this["RevertX"]=function(h){return(this.x.invert(h)-this.timeoffsetx)/1000}}else{this.x_kind=this.histo.fXaxis.fLabels==null?"normal":"labels";this["ConvertX"]=function(h){return h};this["RevertX"]=function(h){return this.x.invert(h)}}this["scale_xmin"]=this.xmin;this["scale_xmax"]=this.xmax;if(this.zoom_xmin!=this.zoom_xmax){this["scale_xmin"]=this.zoom_xmin;this["scale_xmax"]=this.zoom_xmax}if(this.x_kind=="time"){this["x"]=b.time.scale()}else{if(this.options.Logx){if(this.scale_xmax<=0){this.scale_xmax=0}if((this.scale_xmin<=0)&&(this.nbinsx>0)){for(var d=0;d0){this.scale_xmin=f;break}}}if((this.scale_xmin<=0)||(this.scale_xmin>=this.scale_xmax)){this.scale_xmin=this.scale_xmax*0.0001}this["x"]=b.scale.log()}else{this["x"]=b.scale.linear()}}this.x.domain([this.ConvertX(this.scale_xmin),this.ConvertX(this.scale_xmax)]).range([0,c]);if(this.x_kind=="time"){this["grx"]=function(h){return this.x(this.ConvertX(h))}}else{if(this.options.Logx){this["grx"]=function(h){return(h0)){for(var d=0;d0){this.scale_ymin=g;break}}}if((this.scale_ymin<=0)&&("ymin_nz" in this)&&(this.ymin_nz>0)){this.scale_ymin=0.3*this.ymin_nz}if((this.scale_ymin<=0)||(this.scale_ymin>=this.scale_ymax)){this.scale_ymin=0.000001*this.scale_ymax}this["y"]=b.scale.log()}else{if(this.y_time){this["y"]=b.time.scale()}else{this["y"]=b.scale.linear()}}this["y"].domain([this.ConvertY(this.scale_ymin),this.ConvertY(this.scale_ymax)]).range([e,0]);if(this.y_time){this["gry"]=function(h){return this.y(this.ConvertY(h))}}else{if(this.options.Logy){this["gry"]=function(h){return(hthis.histo.fXaxis.fNbins)){return null}for(var d in this.histo.fXaxis.fLabels.arr){var c=this.histo.fXaxis.fLabels.arr[d];if(c.fUniqueID==f){return c.fString}}}if(Math.abs(g)<1e-14){if(Math.abs(this.xmax-this.xmin)>0.00001){g=0}}return g.toPrecision(4)}if(e=="y"){if("dfy" in this){return this.dfy(new Date(this.timeoffsety+g*1000))}if(Math.abs(g)<1e-14){if(Math.abs(this.ymax-this.ymin)>0.00001){g=0}}return g.toPrecision(4)}return g.toPrecision(4)};a.THistPainter.prototype.DrawAxes=function(j){if(!this.is_main_painter()){return}var K=this.frame_width(),M=this.frame_height();var O=this.svg_frame().selectAll(".xaxis_container");if(O.empty()){O=this.svg_frame().select(".axis_layer").append("svg:g").attr("class","xaxis_container")}O.selectAll("*").remove();O.attr("transform","translate(0,"+M+")");var I=this.svg_frame().selectAll(".yaxis_container");if(I.empty()){I=this.svg_frame().select(".axis_layer").append("svg:g").attr("class","yaxis_container")}I.selectAll("*").remove();var d=this.histo.fXaxis["fNdivisions"];this["x_nticks"]=d%100;var v=(d%10000-this.x_nticks)/100;var p=d/10000;var c=this.histo.fYaxis["fNdivisions"];this["y_nticks"]=c%100;var t=(c%10000-this.y_nticks)/100;var o=c/10000;var k=a.Painter.getFontDetails(this.histo.fXaxis["fLabelFont"],this.histo.fXaxis["fLabelSize"]*M);var G=3+(this.histo.fXaxis["fLabelOffset"]*M);if(this.histo.fXaxis["fTitle"].length>0){this.StartTextDrawing(this.histo.fXaxis["fTitleFont"],this.histo.fXaxis["fTitleSize"]*M,O);var E=this.DrawText("end",K,G+k.size*(1+this.histo.fXaxis["fTitleOffset"]),0,0,this.histo.fXaxis["fTitle"],null,1,O);if(E<=0){j=true}this.FinishTextDrawing(O)}var D=3+(this.histo.fYaxis["fLabelOffset"]*K);var u=a.Painter.getFontDetails(this.histo.fYaxis["fLabelFont"],this.histo.fYaxis["fLabelSize"]*M);if(this.histo.fYaxis["fTitle"].length>0){this.StartTextDrawing(this.histo.fYaxis["fTitleFont"],this.histo.fYaxis["fTitleSize"]*M,I);var E=this.DrawText("end",0,-D-(1+this.histo.fYaxis["fTitleOffset"])*u.size-I.property("text_font").size,0,-270,this.histo.fYaxis["fTitle"],null,1,I);if(E<=0){j=true}this.FinishTextDrawing(I)}var N=this.histo.fXaxis["fAxisColor"];var l=this.histo.fXaxis["fTickLength"]*M;var f=this.histo.fYaxis["fAxisColor"];var z=this.histo.fYaxis["fTickLength"]*K;var x=this;delete this["formatx"];if(this.x_kind=="time"){if(this.x_nticks>8){this.x_nticks=8}var F=this.scale_xmax-this.scale_xmin;var C=a.Painter.getTimeFormat(this.histo.fXaxis);if((C.length==0)||(F<0.1*(this.xmax-this.xmin))){C=a.Painter.chooseTimeFormat(F,this.x_nticks)}if(C.length>0){this["formatx"]=b.time.format(C)}}else{if(this.options.Logx){var i=this.histo.fXaxis.TestBit(a.EAxisBits.kNoExponent);if(this.scale_xmax<100&&this.scale_xmin>0&&this.scale_xmax/this.scale_xmin<100){i=true}var n=this.histo.fXaxis.TestBit(a.EAxisBits.kMoreLogLabels);this["formatx"]=function(P){var w=parseFloat(P);var h=Math.abs(a.Math.log10(w));if(n){if(h%1<0.7||h%1>0.9999){if(i){return w.toFixed()}else{return a.Painter.formatExp(w.toExponential(0))}}else{return null}}else{if(h%1<0.0001||h%1>0.9999){if(i){return w.toFixed()}else{return a.Painter.formatExp(w.toExponential(0))}}else{return null}}}}else{if(this.x_kind=="labels"){if(this.x_nticks>8){this.x_nticks=8}var F=this.scale_xmax-this.scale_xmin;if(this.x_nticks>F){this.x_nticks=parseInt(F)}}this["formatx"]=function(h){if(this.x_kind=="labels"){return this.AxisAsText("x",h)}if((Math.abs(h)<1e-14)&&(Math.abs(this.xmax-this.xmin)>0.00001)){h=0}return parseFloat(h.toPrecision(12))}}}var q=b.svg.axis().scale(this.x).orient("bottom").tickPadding(G).tickSize(-l,-l/2,-l/4).ticks(this.x_nticks);if("formatx" in this){q.tickFormat(function(h){return x.formatx(h)})}delete this["formaty"];if(this.y_time){if(this.y_nticks>8){this.y_nticks=8}var B=a.Painter.getTimeFormat(this.histo.fYaxis);if((B.length==0)||(scale_yrange<0.1*(this.ymax-this.ymin))){B=a.Painter.chooseTimeFormat(scale_yrange,this.y_nticks)}if(B.length>0){this["formaty"]=b.time.format(B)}}else{if(this.options.Logy){var g=this.histo.fYaxis.TestBit(a.EAxisBits.kNoExponent);var m=this.histo.fYaxis.TestBit(a.EAxisBits.kMoreLogLabels);if(this.scale_ymax<100&&this.scale_ymin>0&&this.scale_ymax/this.scale_ymin<100){g=true}this["formaty"]=function(P){var w=parseFloat(P);var h=Math.abs(a.Math.log10(w));if(m){if(h%1<0.7||h%1>0.9999){if(g){return w.toFixed()}else{return a.Painter.formatExp(w.toExponential(0))}}else{return null}}else{if(h%1<0.0001||h%1>0.9999){if(g){return w.toFixed()}else{return a.Painter.formatExp(w.toExponential(0))}}else{return null}}}}else{if(this.y_nticks>=10){this.y_nticks-=2}this["formaty"]=function(h){if((Math.abs(h)<1e-14)&&(Math.abs(x.ymax-x.ymin)>0.00001)){h=0}return parseFloat(h.toPrecision(12))}}}var L=b.svg.axis().scale(this.y).orient("left").tickPadding(D).tickSize(-z,-z/2,-z/4).ticks(this.y_nticks);if("formaty" in this){L.tickFormat(function(h){return x.formaty(h)})}var e=O.append("svg:g").attr("class","xaxis").call(q);if(this.x_kind=="labels"){e.selectAll(".tick text").style("text-anchor","start").attr("x",10).attr("y",6)}else{if((v>0)&&!this.options.Logx){var y=b.svg.axis().scale(this.x).orient("bottom").tickPadding(G).innerTickSize(-l/2).tickFormat(function(h){return}).ticks(this.x.ticks(this.x_nticks).length*v);O.append("svg:g").attr("class","xaxis").call(y)}}I.append("svg:g").attr("class","yaxis").call(L);if((t>0)&&!this.options.Logy){var H=b.svg.axis().scale(this.y).orient("left").tickPadding(D).innerTickSize(-z/2).tickFormat(function(h){return}).ticks(this.y.ticks(this.y_nticks).length*t);I.append("svg:g").attr("class","yaxis").call(H)}O.call(k.func);I.call(u.func);if(a.gStyle.Zooming){O.append("svg:rect").attr("x",0).attr("y",0).attr("width",K).attr("height",k.size+3).style("opacity","0").style("cursor","crosshair");I.append("svg:rect").attr("x",-2*u.size-3).attr("y",0).attr("width",2*u.size+3).attr("height",M).style("opacity","0").style("cursor","crosshair")}if((j==null)&&typeof I.node()["getBoundingClientRect"]=="function"){var s=I.node().getBoundingClientRect();var r=this.svg_pad().node().getBoundingClientRect();var J=s.left-r.left;var A=0;if(J<0){A=-J/K+0.001;this.shrink_frame_left+=A}else{if((this.shrink_frame_left>0)&&(J/K>this.shrink_frame_left)){A=-this.shrink_frame_left;this.shrink_frame_left=0}}if(A!=0){this.svg_frame().property("frame_painter").Shrink(A,0);this.svg_frame().property("frame_painter").Redraw();this.CreateXY();this.DrawAxes(true)}}};a.THistPainter.prototype.DrawTitle=function(){var c=this.FindPainterFor(null,"title");if(c!=null){c.pavetext.Clear();c.pavetext.AddText(this.histo.fTitle)}else{var d=a.Create("TPaveText");a.extend(d,{fName:"title",fX1NDC:0.2809483,fY1NDC:0.9339831,fX2NDC:0.7190517,fY2NDC:0.995});d.AddText(this.histo.fTitle);c=a.Painter.drawPaveText(this.divid,d)}};a.THistPainter.prototype.ToggleStat=function(){var c=this.FindStat();if(c==null){c=this.CreateStat();this.Redraw();return}var d=this.FindPainterFor(c);if(d==null){alert("Did not found painter for existing stat??");return}d.Enabled=!d.Enabled;d.Redraw()};a.THistPainter.prototype.IsAxisZoomed=function(c){var d=this.main_painter();if(d==null){d=this}if(c=="x"){return d.zoom_xmin!=d.zoom_xmax}if(c=="y"){return d.zoom_ymin!=d.zoom_ymax}return false};a.THistPainter.prototype.GetSelectIndex=function(e,d,h){var f=0;var g=this.main_painter();if(g==null){g=this}var c=0;if(!h){h=0}if(e=="x"){c=this.nbinsx;if(g.zoom_xmin!=g.zoom_xmax){if(d=="left"){f=Math.floor((g.zoom_xmin-this.xmin)/this.binwidthx+h)}else{f=Math.round((g.zoom_xmax-this.xmin)/this.binwidthx+0.5+h)}}else{f=(d=="left")?0:c}}else{if(e=="y"){c=this.nbinsy;if(g.zoom_ymin!=g.zoom_ymax){if(d=="left"){f=Math.floor((g.zoom_ymin-this.ymin)/this.binwidthy+h)}else{f=Math.round((g.zoom_ymax-this.ymin)/this.binwidthy+0.5+h)}}else{f=(d=="left")?0:c}}}if(d=="left"){if(f<0){f=0}}else{if(f>c){f=c}}return f};a.THistPainter.prototype.FindStat=function(){if("fFunctions" in this.histo){for(var c in this.histo.fFunctions.arr){var d=this.histo.fFunctions.arr[c];if(d._typename=="TPaveText"||d._typename=="TPaveStats"){return d}}}return null};a.THistPainter.prototype.CreateStat=function(){if(!this.draw_content){return null}if(this.FindStat()!=null){return null}var c=a.Create("TPaveStats");a.extend(c,{_AutoCreated:true,fName:"stats",fOptStat:a.gStyle.OptStat,fOptFit:a.gStyle.OptFit,fBorderSize:1});a.extend(c,a.gStyle.StatNDC);a.extend(c,a.gStyle.StatText);a.extend(c,a.gStyle.StatFill);if(this.histo._typename&&(this.histo._typename.match(/^TProfile/)||this.histo._typename.match(/^TH2/))){c.fY1NDC=0.67}c.AddText(this.histo.fName);if(!"fFunctions" in this.histo){this.histo.fFunctions=a.Create("TList")}this.histo.fFunctions.arr.push(c);return c};a.THistPainter.prototype.FindF1=function(){if(!("fFunctions" in this.histo)){return null}for(var c in this.histo.fFunctions.arr){var d=this.histo.fFunctions.arr[c];if(d._typename=="TF1"){return d}}return null};a.THistPainter.prototype.DrawFunctions=function(){if(!("fFunctions" in this.histo)){return}if(this.options.Same){return}var d=this.histo.TestBit(a.TH1StatusBits.kNoStats)||(this.options.NoStat==1);var k=this;var h=a.BIT(9);var c={kCanDelete:a.BIT(0),kMustCleanup:a.BIT(3),kObjInCanvas:a.BIT(3),kIsReferenced:a.BIT(4),kHasUUID:a.BIT(5),kCannotPick:a.BIT(6),kNoContextMenu:a.BIT(8),kInvalidObject:a.BIT(13)};for(var f in this.histo.fFunctions.arr){var j=this.histo.fFunctions.arr[f];var e=this.histo.fFunctions.opt[f];var g=this.FindPainterFor(j);if(g!=null){continue}if(j._typename=="TPaveText"||j._typename=="TPaveStats"){if(!d){g=a.Painter.drawPaveText(this.divid,j,e)}}else{if(j._typename=="TF1"){if(!j.TestBit(h)){g=a.Painter.drawFunction(this.divid,j,e)}}else{g=a.draw(this.divid,j,e)}}}};a.THistPainter.prototype.Redraw=function(){this.CreateXY();this.DrawAxes();this.DrawGrids();this.DrawBins();if(this.create_canvas){this.DrawTitle()}};a.THistPainter.prototype.Unzoom=function(g,e,c){var d=this.main_painter();if(!d){d=this}var f=false;if(g){if(d.zoom_xmin!=d.zoom_xmax){f=true}d.zoom_xmin=d.zoom_xmax=0}if(e){if(d.zoom_ymin!=d.zoom_ymax){f=true}d.zoom_ymin=d.zoom_ymax=0}if(c){if(d.zoom_zmin!=d.zoom_zmax){f=true}d.zoom_zmin=d.zoom_zmax=0}if(f){this.RedrawPad()}};a.THistPainter.prototype.Zoom=function(h,e,f,c,d,j){var i=this.main_painter();if(!i){i=this}var g=false;if((h!=e)&&(Math.abs(e-h)>i.binwidthx*2)){i.zoom_xmin=h;i.zoom_xmax=e;g=true}if((f!=c)&&(Math.abs(c-f)>(("binwidthy" in i)?(i.binwidthy*2):Math.abs(i.ymax-i.ymin)*0.000001))){i.zoom_ymin=f;i.zoom_ymax=c;g=true}if((d!=j)&&(d!=null)&&(j!=null)){i.zoom_zmin=d;i.zoom_zmax=j;g=true}if(g){this.RedrawPad()}};a.THistPainter.prototype.AddInteractive=function(){if(!a.gStyle.Zooming||!this.is_main_painter()){return}var r=this.frame_width(),p=this.frame_height();var u,v,t=null,d=null;var o=new Date(0);var j=0;var m=false;var i=this;function h(){a.Painter.closeMenu();if(d!=null){d.remove();d=null}j=0;if(m){a.gStyle.Tooltip=true;m=false}}function q(){b.event.preventDefault();if(j>100){return}var e=b.event;h();a.Painter.createMenu(function(w){w.painter=i;w.add("header:"+i.histo.fName);i.FillContextMenu(w);w.show(e)})}function g(){if(j!=0){b.event.preventDefault();b.event.stopPropagation();return}r=Number(i.svg_frame().attr("width"));p=Number(i.svg_frame().attr("height"));u=this;var w=b.touches(u);if(w.length==1){var x=new Date();var y=x.getTime()-o.getTime();if((y<300)&&(t!=null)&&(Math.abs(t[0]-w[0][0])<30)&&(Math.abs(t[1]-w[0][1])<30)){b.event.preventDefault();b.event.stopPropagation();h();i.Unzoom(true,true,true)}else{o=x;t=w[0]}}if(w.length!=2){return}b.event.preventDefault();h();var e=w[0];var z=w[1];t=new Array;v=new Array;t.push(Math.min(e[0],z[0]));t.push(Math.min(e[1],z[1]));v.push(Math.max(e[0],z[0]));v.push(Math.max(e[1],z[1]));if(t[0]<0){j=103;t[0]=0;v[0]=r}else{if(v[1]>p){j=102;t[1]=0;v[1]=p}else{j=101}}d=i.svg_frame().append("rect").attr("class","zoom").attr("id","zoomRect").attr("x",t[0]).attr("y",t[1]).attr("width",v[0]-t[0]).attr("height",v[1]-t[1]);b.select(window).on("touchmove.zoomRect",f).on("touchcancel.zoomRect",k).on("touchend.zoomRect",k,true);b.event.stopPropagation()}function f(){if(j<100){return}b.event.preventDefault();var w=b.touches(u);if(w.length!=2){h();j=0;return}var e=w[0];var x=w[1];if(j!=103){t[0]=Math.min(e[0],x[0]);v[0]=Math.max(e[0],x[0])}if(j!=102){t[1]=Math.min(e[1],x[1]);v[1]=Math.max(e[1],x[1])}d.attr("x",t[0]).attr("y",t[1]).attr("width",v[0]-t[0]).attr("height",v[1]-t[1]);if(a.gStyle.Tooltip&&((v[0]-t[0]>10)||(v[1]-t[1]>10))){a.gStyle.Tooltip=false;m=true}b.event.stopPropagation()}function k(){if(j<100){return}b.event.preventDefault();b.select(window).on("touchmove.zoomRect",null).on("touchend.zoomRect",null).on("touchcancel.zoomRect",null);b.select("body").classed("noselect",false);var z=0,w=0,x=0,e=0;var y=false;if((j!=103)&&(Math.abs(t[0]-v[0])>10)){z=Math.min(i.RevertX(v[0]),i.RevertX(t[0]));w=Math.max(i.RevertX(v[0]),i.RevertX(t[0]));y=true}if((j!=102)&&(Math.abs(t[1]-v[1])>10)){x=Math.min(i.y.invert(v[1]),i.y.invert(t[1]));e=Math.max(i.y.invert(v[1]),i.y.invert(t[1]));y=true}b.select("body").style("-webkit-user-select","auto");if(m){a.gStyle.Tooltip=true}d.remove();d=null;j=0;if(y){i.Zoom(z,w,x,e)}b.event.stopPropagation()}function s(){if(j>100){return}b.event.preventDefault();r=Number(i.svg_frame().attr("width"));p=Number(i.svg_frame().attr("height"));h();u=this;v=b.mouse(u);t=new Array;t.push(Math.max(0,Math.min(r,v[0])));t.push(Math.max(0,Math.min(p,v[1])));if(v[0]<0){j=3;v[0]=0;v[1]=t[1];t[0]=r;t[1]+=1}else{if(v[1]>p){j=2;v[0]=t[0];v[1]=0;t[0]+=1;t[1]=p}else{j=1;v[0]=t[0];v[1]=t[1]}}d=i.svg_frame().append("rect").attr("class","zoom").attr("id","zoomRect");i.svg_frame().on("dblclick",n);b.select(window).on("mousemove.zoomRect",l).on("mouseup.zoomRect",c,true);b.event.stopPropagation()}function n(){b.event.preventDefault();var e=b.mouse(u);h();if(e[0]<0){i.Unzoom(false,true,false)}else{if(e[1]>p){i.Unzoom(true,false,false)}else{i.Unzoom(true,true,true);i.svg_frame().on("dblclick",null)}}}function l(){if((j==0)||(j>100)){return}b.event.preventDefault();var e=b.mouse(u);e[0]=Math.max(0,Math.min(r,e[0]));e[1]=Math.max(0,Math.min(p,e[1]));switch(j){case 1:t[0]=e[0];t[1]=e[1];break;case 2:t[0]=e[0];break;case 3:t[1]=e[1];break}d.attr("x",Math.min(v[0],t[0])).attr("y",Math.min(v[1],t[1])).attr("width",Math.abs(t[0]-v[0])).attr("height",Math.abs(t[1]-v[1]));if(a.gStyle.Tooltip&&((Math.abs(t[0]-v[0])>10)||(Math.abs(t[1]-v[1])>10))){a.gStyle.Tooltip=false;m=true}}function c(){if((j==0)||(j>100)){return}b.event.preventDefault();b.select(window).on("mousemove.zoomRect",null).on("mouseup.zoomRect",null);b.select("body").classed("noselect",false);var w=b.mouse(u);w[0]=Math.max(0,Math.min(r,w[0]));w[1]=Math.max(0,Math.min(p,w[1]));switch(j){case 1:t[0]=w[0];t[1]=w[1];break;case 2:t[0]=w[0];break;case 3:t[1]=w[1];break}var A=0,x=0,y=0,e=0;var z=false;if((j!=3)&&(Math.abs(t[0]-v[0])>10)){A=Math.min(i.RevertX(v[0]),i.RevertX(t[0]));x=Math.max(i.RevertX(v[0]),i.RevertX(t[0]));z=true}if((j!=2)&&(Math.abs(t[1]-v[1])>10)){y=Math.min(i.y.invert(v[1]),i.y.invert(t[1]));e=Math.max(i.y.invert(v[1]),i.y.invert(t[1]));z=true}b.select("body").style("-webkit-user-select","auto");if(m){a.gStyle.Tooltip=true;m=false}d.remove();d=null;j=0;if(z){i.Zoom(A,x,y,e)}}this.svg_frame().on("mousedown",s);this.svg_frame().on("touchstart",g);if(a.gStyle.ContextMenu){this.svg_frame().on("contextmenu",q)}};a.THistPainter.prototype.FillContextMenu=function(d){if(this.zoom_xmin!=this.zoom_xmax){d.add("Unzoom X",function(){d.painter.Unzoom(true,false,false)})}if(this.zoom_ymin!=this.zoom_ymax){d.add("Unzoom Y",function(){d.painter.Unzoom(false,true,false)})}if(this.zoom_zmin!=this.zoom_zmax){d.add("Unzoom Z",function(){d.painter.Unzoom(false,false,true)})}d.add("Unzoom",function(){d.painter.Unzoom(true,true,true)});d.add(a.gStyle.Tooltip?"Disable tooltip":"Enable tooltip",function(){a.gStyle.Tooltip=!a.gStyle.Tooltip;d.painter.RedrawPad()});if(this.options){var c=this.options.Logx>0?"Linear X":"Log X";d.add(c,function(){d.painter.options.Logx=1-d.painter.options.Logx;d.painter.RedrawPad()});c=this.options.Logy>0?"Linear Y":"Log Y";d.add(c,function(){d.painter.options.Logy=1-d.painter.options.Logy;d.painter.RedrawPad()});if(this.Dimension()==2){c=this.options.Logz>0?"Linear Z":"Log Z";d.add(c,function(){d.painter.options.Logz=1-d.painter.options.Logz;d.painter.RedrawPad()})}}if(this.draw_content){d.add("Toggle stat",function(){d.painter.ToggleStat()})}};a.TH1Painter=function(c){a.THistPainter.call(this,c)};a.TH1Painter.prototype=Object.create(a.THistPainter.prototype);a.TH1Painter.prototype.ScanContent=function(){this.fill=this.createAttFill(this.histo);if(this.fill.color=="white"){this.fill.color="none"}this.attline=a.Painter.createAttLine(this.histo);var f=this.main_painter();if(f!=null){this.attline.color=f.GetAutoColor(this.attline.color)}var e=0,c=0,j=0,h=0;var d=this.IsTProfile();this.nbinsx=this.histo.fXaxis["fNbins"];for(var g=0;g0){if((c==0)||(k0){k+=this.histo.getBinError(g+1)}if(g==0){e=j=k}if(kj){j=k}}}if(d){h+=this.histo.fBinEntries[0]+this.histo.fBinEntries[this.nbinsx+1]}else{h+=this.histo.getBinContent(0)+this.histo.getBinContent(this.nbinsx+1)}this.stat_entries=h;this.xmin=this.histo.fXaxis["fXmin"];this.xmax=this.histo.fXaxis["fXmax"];this.binwidthx=(this.xmax-this.xmin);if(this.nbinsx>0){this.binwidthx=this.binwidthx/this.nbinsx}this["GetBinX"]=function(i){return this.xmin+i*this.binwidthx};this.ymin=this.histo.fYaxis["fXmin"];this.ymax=this.histo.fYaxis["fXmax"];this.ymin_nz=c;if((this.nbinsx==0)||((Math.abs(e)<1e-300&&Math.abs(j)<1e-300))){if(this.histo.fMinimum!=-1111){this.ymin=this.histo.fMinimum}if(this.histo.fMaximum!=-1111){this.ymax=this.histo.fMaximum}this.draw_content=false}else{if(this.histo.fMinimum!=-1111){e=this.histo.fMinimum}if(this.histo.fMaximum!=-1111){j=this.histo.fMaximum}if(e>=j){if(e==0){this.ymax=0;this.ymax=1}else{if(e<0){this.ymin=2*e;this.ymax=0}else{this.ymin=0;this.ymax=e*2}}}else{var l=(j-e)*0.1;this.ymin=e-l;if((this.ymin<0)&&(e>=0)){this.ymin=0}this.ymax=j+l}this.draw_content=true}if(this.options.Bar==0&&this.options.Hist==0&&this.options.Error==0&&this.options.Same==0){this.draw_content=false}if(this.options.Axis>0){this.draw_content=false}};a.TH1Painter.prototype.CountStat=function(o){var e=this.IsTProfile();var f=0,l=0,r=0,k=0,j=0;var d=this.GetSelectIndex("x","left");var q=this.GetSelectIndex("x","right");var c=0,p=0,h=null,n=null;for(var g=d;gn)){h=c;n=p}f+=p;l+=p*c;r+=p*c*c}if(!this.IsAxisZoomed("x")&&(this.histo.fTsumw>0)){f=this.histo.fTsumw;l=this.histo.fTsumwx;r=this.histo.fTsumwx2}var m={meanx:0,meany:0,rmsx:0,rmsy:0,integral:f,entries:this.stat_entries,xmax:0,wmax:0};if(f>0){m.meanx=l/f;m.meany=k/f;m.rmsx=Math.sqrt(r/f-m.meanx*m.meanx);m.rmsy=Math.sqrt(j/f-m.meany*m.meany)}if(h!=null){m.xmax=h;m.wmax=n}return m};a.TH1Painter.prototype.FillStatistic=function(v,j,w){if(!this.histo){return false}var z=this.CountStat();var s=Math.floor(j%10);var f=Math.floor(j/10)%10;var l=Math.floor(j/100)%10;var x=Math.floor(j/1000)%10;var g=Math.floor(j/10000)%10;var k=Math.floor(j/100000)%10;var q=Math.floor(j/1000000)%10;var B=Math.floor(j/10000000)%10;var t=Math.floor(j/100000000)%10;if(s>0){v.AddLine(this.histo.fName)}if(this.IsTProfile()){if(f>0){v.AddLine("Entries = "+v.Format(z.entries,"entries"))}if(l>0){v.AddLine("Mean = "+v.Format(z.meanx));v.AddLine("Mean y = "+v.Format(z.meany))}if(x>0){v.AddLine("RMS = "+v.Format(z.rmsx));v.AddLine("RMS y = "+v.Format(z.rmsy))}}else{if(f>0){v.AddLine("Entries = "+v.Format(z.entries,"entries"))}if(l>0){v.AddLine("Mean = "+v.Format(z.meanx))}if(x>0){v.AddLine("RMS = "+v.Format(z.rmsx))}if(g>0){var A=0;if(this.histo.fArray.length>0){A=this.histo.fArray[0]}v.AddLine("Underflow = "+v.Format(A))}if(k>0){var A=0;if(this.histo.fArray.length>0){A=this.histo.fArray[this.histo.fArray.length-1]}v.AddLine("Overflow = "+v.Format(A))}if(q>0){v.AddLine("Integral = "+v.Format(z.integral,"entries"))}if(B>0){v.AddLine("Skew = ")}if(t>0){v.AddLine("Kurt = ")}}if(w!=0){var o=this.FindF1();if(o!=null){var c=w%10;var p=(w/10)%10;var d=(w/100)%10;var i=(w/1000)%10;if(d>0){v.AddLine("#chi^2 / ndf = "+v.Format(o.fChisquare,"fit")+" / "+o.fNDF)}if(i>0){v.AddLine("Prob = ")}if((c>0)||(p>0)){for(var m=0;m"}var r="";if(o.fParErrors!=null){r=v.Format(o.fParErrors[m],"last");if((Number(r)==0)&&(o.fParErrors[m]!=0)){r=v.Format(o.fParErrors[m],"4.2g")}}if((p>0)&&(r.length>0)){v.AddLine(y+" = "+u+" #pm "+r)}else{v.AddLine(y+" = "+u)}}}}}var h=v.pavetext.fLines.arr.length;var e=h*a.gStyle.StatFontSize;if(e<=0||3==(a.gStyle.StatFont%10)){e=0.25*h*a.gStyle.StatH;v.pavetext.fY1NDC=0.93-e;v.pavetext.fY2NDC=0.93}return true};a.TH1Painter.prototype.CreateDrawBins=function(p,n,r){var g=this.GetSelectIndex("x","left",-1);var v=this.GetSelectIndex("x","right",2);var d=new Array;var w=((a.gStyle.OptimizeDraw>0)&&(v-g>5000))||((a.gStyle.OptimizeDraw>1)&&(v-g>2*p));var u,t=this.GetBinX(g);var h=-1111,e=-1111,f;var q=null;var j=false;var l=this.main_painter();var x=this.GetItemName();if((x==null)||(x=="")){x=this.histo.fName}for(var s=g;sc:k0){q.xerr=(e-h)/2;q.yerr=f-l.gry(c+this.histo.getBinError(m+1))}if(this.options.Error>0){q.x=(h+e)/2;q.tip=x+"\nx = "+this.AxisAsText("x",(u+t)/2)+"\ny = "+this.AxisAsText("y",c)+"\nerror x = "+((t-u)/2).toPrecision(4)+"\nerror y = "+this.histo.getBinError(m+1).toPrecision(4)}else{q.width=e-h;q.tip=x+"\nbin = "+(m+1)+"\n";if(l.x_kind=="labels"){q.tip+=("x = "+this.AxisAsText("x",u)+"\n")}else{q.tip+=("x = ["+this.AxisAsText("x",u)+", "+this.AxisAsText("x",t)+"]\n")}q.tip+=("entries = "+c)}d.push(q)}if((v==this.nbinsx)&&(this.options.Error==0)&&(q!=null)){var o=a.extend({},q);o.x=e;d.push(o)}return d};a.TH1Painter.prototype.DrawAsMarkers=function(g,d,f){var g=this.CreateDrawBins(d,f,this.IsTProfile()||(this.Mark==10));var e=this.draw_g.selectAll("g").data(g).enter().append("svg:g").attr("transform",function(h){return"translate("+h.x.toFixed(1)+","+h.y.toFixed(1)+")"});if(a.gStyle.Tooltip){e.append("svg:title").text(function(h){return h.tip})}if(this.options.Error==12){e.append("svg:rect").attr("x",function(h){return(-h.xerr).toFixed(1)}).attr("y",function(h){return(-h.yerr).toFixed(1)}).attr("width",function(h){return(2*h.xerr).toFixed(1)}).attr("height",function(h){return(2*h.yerr).toFixed(1)}).call(this.attline.func).call(this.fill.func).style("pointer-events","visibleFill").property("fill0",this.fill.color).on("mouseover",function(){if(a.gStyle.Tooltip){b.select(this).transition().duration(100).style("fill","grey")}}).on("mouseout",function(){b.select(this).transition().duration(100).style("fill",this["fill0"])})}else{if(this.options.Error>0){e.append("svg:line").attr("x1",function(h){return(-h.xerr).toFixed(1)}).attr("y1",0).attr("x2",function(h){return h.xerr.toFixed(1)}).attr("y2",0).call(this.attline.func);e.append("svg:line").attr("x1",0).attr("y1",function(h){return(-h.yerr).toFixed(1)}).attr("x2",0).attr("y2",function(h){return h.yerr.toFixed(1)}).call(this.attline.func)}}if(this.options.Error==11){e.append("svg:line").attr("y1",-3).attr("x1",function(h){return(-h.xerr).toFixed(1)}).attr("y2",3).attr("x2",function(h){return(-h.xerr).toFixed(1)}).call(this.attline.func);e.append("svg:line").attr("y1",-3).attr("x1",function(h){return h.xerr.toFixed(1)}).attr("y2",3).attr("x2",function(h){return h.xerr.toFixed(1)}).call(this.attline.func);e.append("svg:line").attr("x1",-3).attr("y1",function(h){return(-h.yerr).toFixed(1)}).attr("x2",3).attr("y2",function(h){return(-h.yerr).toFixed(1)}).call(this.attline.func);e.append("svg:line").attr("x1",-3).attr("y1",function(h){return h.yerr.toFixed(1)}).attr("x2",3).attr("y2",function(h){return h.yerr.toFixed(1)}).call(this.attline.func)}if((this.options.Mark>0)||(this.options.Error==12)){var c=a.Painter.createAttMarker(this.histo);e.append("svg:path").call(c.func)}};a.TH1Painter.prototype.DrawBins=function(){var e=this.frame_width(),c=this.frame_height();if(!this.draw_content||(e<=0)||(c<=0)){this.RemoveDrawG();return}this.RecreateDrawG();if(this.IsTProfile()||(this.options.Error>0)||(this.options.Mark>0)){return this.DrawAsMarkers(e,c)}var g=this.CreateDrawBins(e,c);if(this.fill.color!="none"){var f=b.svg.area().x(function(h){return h.x.toFixed(1)}).y0(function(h){return h.y.toFixed(1)}).y1(function(h){return c}).interpolate("step-after");this.draw_g.append("svg:path").attr("d",f(g)).style("pointer-events","none").call(this.attline.func).call(this.fill.func)}else{var d=b.svg.line().x(function(h){return h.x.toFixed(1)}).y(function(h){return h.y.toFixed(1)}).interpolate("step-after");this.draw_g.append("svg:path").attr("d",d(g)).call(this.attline.func).style("fill","none")}if(a.gStyle.Tooltip){this.draw_g.selectAll("selections").data(g).enter().append("svg:line").attr("x1",function(h){return h.x+h.width/2}).attr("y1",function(h){return Math.max(0,h.y)}).attr("x2",function(h){return h.x+h.width/2}).attr("y2",function(h){return c}).style("opacity",0).style("stroke","#4572A7").style("stroke-width",function(h){return h.width}).on("mouseover",function(){if(a.gStyle.Tooltip&&(b.select(this).style("opacity")=="0")){b.select(this).transition().duration(100).style("opacity","0.3")}}).on("mouseout",function(){b.select(this).transition().duration(100).style("opacity","0")}).append("svg:title").text(function(h){return h.tip})}};a.TH1Painter.prototype.FillContextMenu=function(c){a.THistPainter.prototype.FillContextMenu.call(this,c);if(this.draw_content){c.add("Auto zoom-in",function(){c.painter.AutoZoom()})}};a.TH1Painter.prototype.AutoZoom=function(){var f=this.GetSelectIndex("x","left",-1);var d=this.GetSelectIndex("x","right",1);var g=(d-f);if(g==0){return}var c=this.histo.getBinContent(f+1);for(var e=f;e0){return}while((f0){c.add("Toggle colz",function(){c.painter.ToggleColz()})}};a.TH2Painter.prototype.FindPalette=function(c){if("fFunctions" in this.histo){for(var d in this.histo.fFunctions.arr){var e=this.histo.fFunctions.arr[d];if(e._typename!="TPaletteAxis"){continue}if(c){this.histo.fFunctions.RemoveAt(d);return null}return e}}return null};a.TH2Painter.prototype.ToggleColz=function(){if(this.FindPalette()==null){var c=this.CreatePalette(0.04);this.svg_frame().property("frame_painter").Shrink(0,c);this.options.Zscale=1;a.Painter.drawPaletteAxis(this.divid,this.FindPalette())}else{if(this.options.Zscale>0){this.options.Zscale=0}else{this.options.Zscale=1}}this.RedrawPad()};a.TH2Painter.prototype.AutoZoom=function(){var k=this.GetSelectIndex("x","left",-1);var h=this.GetSelectIndex("x","right",1);var s=this.GetSelectIndex("y","left",-1);var r=this.GetSelectIndex("y","right",1);if((k==h)||(s==r)){return}var m=this.histo.getBinContent(k+1,s+1);for(var p=k;p0){return}var f=h,e=k,c=r,l=s;for(var p=k;pm){if(p=e){e=p+1}if(n=l){l=n+1}}}}var d=0,o=0,q=0,g=0;if((f>k||es||lf){f=k}}var r=(f+l)/d;if(p.fX2NDC+r>0.98){var e=p.fX2NDC+r-0.98;p.fX1NDC-=e;p.fX2NDC-=e;o+=e}return o+0.01};a.TH2Painter.prototype.ScanContent=function(){this.fillcolor=a.Painter.root_colors[this.histo.fFillColor];this.attline=a.Painter.createAttLine(this.histo);if(this.attline.color=="none"){this.attline.color="#4572A7"}this.nbinsx=this.histo.fXaxis["fNbins"];this.nbinsy=this.histo.fYaxis["fNbins"];this.xmin=this.histo.fXaxis["fXmin"];this.xmax=this.histo.fXaxis["fXmax"];this.ymin=this.histo.fYaxis["fXmin"];this.ymax=this.histo.fYaxis["fXmax"];this.binwidthx=(this.xmax-this.xmin);if(this.nbinsx>0){this.binwidthx=this.binwidthx/this.nbinsx}this["GetBinX"]=function(f){return this.xmin+f*this.binwidthx};this.binwidthy=(this.ymax-this.ymin);if(this.nbinsy>0){this.binwidthy=this.binwidthy/this.nbinsy}this["GetBinY"]=function(f){return this.ymin+f*this.binwidthy};this.gmaxbin=this.histo.getBinContent(1,1);this.gminbin=this.gmaxbin;for(var d=0;dthis.gmaxbin){this.gmaxbin=e}}}}this.draw_content=this.gmaxbin>0};a.TH2Painter.prototype.CountStat=function(i){var e=0,h=0,p=0,g=0,o=0,s=0;var w={entries:0,integral:0,meanx:0,meany:0,rmsx:0,rmsy:0,matrix:[],xmax:0,ymax:0,wmax:null};for(var m=0;m<9;m++){w.matrix.push(0)}var d=this.GetSelectIndex("x","left");var l=this.GetSelectIndex("x","right");var t=this.GetSelectIndex("y","left");var r=this.GetSelectIndex("y","right");for(var k=0;k<=this.nbinsx+1;k++){var c=(k<=d)?0:(k>l?2:1);var f=this.GetBinX(k-0.5);for(var v=0;v<=this.nbinsx+1;v++){var q=(v<=t)?0:(v>r?2:1);var j=this.ymin+(v-0.5)*this.binwidthy;var u=this.histo.getBinContent(k,v);w.entries+=u;w.matrix[q*3+c]+=u;if((c!=1)||(q!=1)){continue}if((i!=null)&&!i(f,j)){continue}if((w.wmax==null)||(u>w.wmax)){w.wmax=u;w.xmax=f;w.ymax=j}e+=u;h+=f*u;p+=j*u;g+=f*f*u;o+=j*j*u;s+=f*j*u}}if(!this.IsAxisZoomed("x")&&!this.IsAxisZoomed("y")&&(this.histo.fTsumw>0)){e=this.histo.fTsumw;h=this.histo.fTsumwx;g=this.histo.fTsumwx2;p=this.histo.fTsumwy;o=this.histo.fTsumwy2;s=this.histo.fTsumwxy}if(e>0){w.meanx=h/e;w.meany=p/e;w.rmsx=Math.sqrt(g/e-w.meanx*w.meanx);w.rmsy=Math.sqrt(o/e-w.meany*w.meany)}if(w.wmax==null){w.wmax=0}w.integral=e;return w};a.TH2Painter.prototype.FillStatistic=function(i,j,s){if(!this.histo){return false}var h=this.CountStat();var n=Math.floor(j%10);var p=Math.floor(j/10)%10;var l=Math.floor(j/100)%10;var q=Math.floor(j/1000)%10;var c=Math.floor(j/10000)%10;var d=Math.floor(j/100000)%10;var f=Math.floor(j/1000000)%10;var k=Math.floor(j/10000000)%10;var g=Math.floor(j/100000000)%10;if(n>0){i.AddLine(this.histo.fName)}if(p>0){i.AddLine("Entries = "+i.Format(h.entries,"entries"))}if(l>0){i.AddLine("Mean x = "+i.Format(h.meanx));i.AddLine("Mean y = "+i.Format(h.meany))}if(q>0){i.AddLine("RMS x = "+i.Format(h.rmsx));i.AddLine("RMS y = "+i.Format(h.rmsy))}if(f>0){i.AddLine("Integral = "+i.Format(h.matrix[4],"entries"))}if(k>0){i.AddLine("Skewness x = ");i.AddLine("Skewness y = ")}if(g>0){i.AddLine("Kurt = ")}if((c>0)||(d>0)){var e=h.matrix;i.AddLine(""+e[6].toFixed(0)+" | "+e[7].toFixed(0)+" | "+e[7].toFixed(0));i.AddLine(""+e[3].toFixed(0)+" | "+e[4].toFixed(0)+" | "+e[5].toFixed(0));i.AddLine(""+e[0].toFixed(0)+" | "+e[1].toFixed(0)+" | "+e[2].toFixed(0))}var o=i.pavetext.fLines.arr.length;var r=o*a.gStyle.StatFontSize;if(r<=0||3==(a.gStyle.StatFont%10)){r=0.25*o*a.gStyle.StatH;i.pavetext.fY1NDC=0.93-r;i.pavetext.fY2NDC=0.93}return true};a.TH2Painter.prototype.getValueColor=function(e){if(this.fContour==null){this.fUserContour=false;if((this.histo.fContour!=null)&&(this.histo.fContour.length>0)&&this.histo.TestBit(a.TH1StatusBits.kUserContour)){this.fContour=a.clone(this.histo.fContour);this.fUserContour=true}else{var i=20;if(this.histo.fContour!=null){i=this.histo.fContour.length}if(i<1){i=20}this.fContour=[];this.zmin=this.minbin;this.zmax=this.maxbin;if(this.zoom_zmin!=this.zoom_zmax){this.zmin=this.zoom_zmin;this.zmax=this.zoom_zmax}if(this.options.Logz){if(this.zmax<=0){this.zmax=1}if(this.zmin<=0){this.zmin=0.001*this.zmax}var m=Math.log(this.zmin)/Math.log(10);var f=Math.log(this.zmax)/Math.log(10);var l=(f-m)/i;this.fContour.push(this.zmin);for(var c=1;c=this.fContour[h]){g++}}}else{g=Math.floor(0.01+(e-this.zmin)*(this.fContour.length-1)/(this.zmax-this.zmin))}if(g<0){return null}var d=a.gStyle.GetColorPalette();var j=Math.floor((g+0.99)*d.length/(this.fContour.length-1));if(j>d.length-1){j=d.length-1}return d[j]};a.TH2Painter.prototype.CreateDrawBins=function(o,A,k,C){var u=this.GetSelectIndex("x","left",0);var s=this.GetSelectIndex("x","right",0);var d=this.GetSelectIndex("y","left",0);var c=this.GetSelectIndex("y","right",0);var D,f,B,e,l,r,g,q,m,F,E,p,t,H,G;this.maxbin=this.minbin=this.histo.getBinContent(u+1,d+1);for(var x=u;xthis.maxbin){this.maxbin=p}else{if(pthis.maxbin){this.maxbin=binz}else{if(binz=e;v--){for(var x=u;xthis.minbin?this.getValueColor(r):"white";var z=b.rgb(k);q.data[++s]=z.r;q.data[++s]=z.g;q.data[++s]=z.b;q.data[++s]=255}}f.putImageData(q,0,0)};a.TH2Painter.prototype.DrawNormalCanvas=function(d,l){var k=this.CreateDrawBins(d,l,0,0);var j=this.draw_g.append("foreignObject").attr("width",d).attr("height",l);this.SetForeignObjectPosition(j,0,0);var e=j.append("xhtml:canvas").attr("width",d).attr("height",l);var c=e.node().getContext("2d");for(var g in k){var f=k[g];c.fillStyle=f.fill;c.fillRect(f.x,f.y,f.width,f.height)}c.stroke()};a.TH2Painter.prototype.DrawBins=function(){this.RecreateDrawG();var l=this.frame_width(),j=this.frame_height();if((this.options.Color==2)&&!a.browser.isIE){return this.DrawSimpleCanvas(l,j)}if((this.options.Color==3)&&!a.browser.isIE){return this.DrawNormalCanvas(l,j)}var g=(this.options.Scat>0&&this.histo.fMarkerStyle>1);var e=(this.options.Color>0)||g;var k=0;if(a.gStyle.Tooltip){k=g?2:1}var d=this.CreateDrawBins(l,j,e?0:1,k);if(g){var i=a.Painter.createAttMarker(this.histo);var f=this.draw_g.selectAll(".marker").data(d).enter().append("svg:path").attr("class","marker").attr("transform",function(h){return"translate("+h.x.toFixed(1)+","+h.y.toFixed(1)+")"}).call(i.func);if(a.gStyle.Tooltip){f.append("svg:title").text(function(h){return h.tip})}}else{var c=this.draw_g.selectAll(".bins").data(d).enter().append("svg:rect").attr("class","bins").attr("x",function(h){return h.x.toFixed(1)}).attr("y",function(h){return h.y.toFixed(1)}).attr("width",function(h){return h.width.toFixed(1)}).attr("height",function(h){return h.height.toFixed(1)}).style("stroke",function(h){return h.stroke}).style("fill",function(h){this["f0"]=h.fill;this["f1"]=h.tipcolor;return h.fill});if(a.gStyle.Tooltip){c.on("mouseover",function(){if(a.gStyle.Tooltip){b.select(this).transition().duration(100).style("fill",this["f1"])}}).on("mouseout",function(){b.select(this).transition().duration(100).style("fill",this["f0"])}).append("svg:title").text(function(h){return h.tip})}}delete d};a.TH2Painter.prototype.Draw2D=function(){if(this.options.Lego>0){this.options.Lego=0}if(this["done2d"]){return}if((this.FindPalette()==null)&&this.create_canvas&&(this.options.Zscale>0)){var c=this.CreatePalette(0.04);this.svg_frame().property("frame_painter").Shrink(0,c);this.svg_frame().property("frame_painter").Redraw();this.CreateXY()}else{if(this.options.Zscale==0){this.FindPalette(true)}}if(a.gStyle.AutoStat&&this.create_canvas){this.CreateStat()}this.DrawAxes();this.DrawGrids();this.DrawBins();if(this.create_canvas){this.DrawTitle()}this.DrawFunctions();this.AddInteractive();if(this.options.AutoZoom){this.AutoZoom()}this["done2d"]=true};a.TH2Painter.prototype.Draw3D=function(){if(this.options.Lego<=0){this.options.Lego=1}var c=this;a.AssertPrerequisites("3d",function(){a.Painter.real_drawHistogram2D(c)})};a.Painter.drawHistogram2D=function(f,d,e){var c=new a.TH2Painter(d);c.SetDivId(f,1);c.options=c.DecodeOptions(e);c.CheckPadOptions();c.ScanContent();c.CreateXY();if(c.options.Lego>0){c.Draw3D()}else{c.Draw2D()}return c.DrawingReady()};a.THStackPainter=function(c){a.TObjectPainter.call(this,c);this.stack=c;this.nostack=false;this.firstpainter=null;this.painters=new Array};a.THStackPainter.prototype=Object.create(a.TObjectPainter.prototype);a.THStackPainter.prototype.GetObject=function(){return this.stack};a.THStackPainter.prototype.drawStack=function(d){var g=this.root_pad();var l=this.stack.fHists;var s=l.arr.length;if(d==null){d=""}else{d=d.toLowerCase()}var k=false;if(d.indexOf("same")!=-1){k=true;d.replace("same","")}var n,o;var c=0,m=0,q=0,f=0;for(var n=0;nm){m=o.fXaxis["fXmax"]}if(n==0||o.fYaxis["fXmin"]f){f=o.fYaxis["fXmax"]}}this.nostack=d.indexOf("nostack")==-1?false:true;if(!this.nostack){this.stack.buildStack()}var p,r;if(this.stack.fMaximum==-1111){r=this.stack.getMaximum(d)}else{r=this.stack.fMaximum}if(this.stack.fMinimum==-1111){p=this.stack.getMinimum(d);if(g&&g.fLogy){if(p>0){p*=0.9}else{p=r*0.001}}else{if(p>0){p=0}}}else{p=this.stack.fMinimum}if(!("fHistogram" in this.stack)){o=this.stack.fHists.arr[0];this.stack.fHistogram=a.Create("TH1I");this.stack.fHistogram["fName"]="unnamed";this.stack.fHistogram["fXaxis"]=a.clone(o.fXaxis);this.stack.fHistogram["fYaxis"]=a.clone(o.fYaxis);this.stack.fHistogram["fXaxis"]["fXmin"]=c;this.stack.fHistogram["fXaxis"]["fXmax"]=m;this.stack.fHistogram["fYaxis"]["fXmin"]=q;this.stack.fHistogram["fYaxis"]["fXmax"]=f}this.stack.fHistogram["fTitle"]=this.stack.fTitle;var j=this.stack.fHistogram;if(!j.TestBit(a.TH1StatusBits.kIsZoomed)){if(this.nostack&&this.stack.fMaximum!=-1111){j.fMaximum=this.stack.fMaximum}else{if(g&&g.fLogy){j.fMaximum=r*(1+0.2*a.Math.log10(r/p))}else{j.fMaximum=1.05*r}}if(this.nostack&&this.stack.fMinimum!=-1111){j.fMinimum=this.stack.fMinimum}else{if(g&&g.fLogy){j.fMinimum=p/(1+0.5*a.Math.log10(r/p))}else{j.fMinimum=p}}}if(!k){var t=j.fOption;if((d!="")&&(t.indexOf(d)==-1)){t+=d}if(j._typename.match(/^TH1/)){this.firstpainter=a.Painter.drawHistogram1D(this.divid,j,t)}else{if(j._typename.match(/^TH2/)){this.firstpainter=a.Painter.drawHistogram2D(this.divid,j,t)}}}for(var n=0;n=0)||(f.length==0)){d=t}this.DrawText("start",d,c,r-d-t,q,E.fLabel,I)}this.FinishTextDrawing();if(D&&D>1){this.draw_g.append("svg:line").attr("x1",r+(D/2)).attr("y1",D+1).attr("x2",r+(D/2)).attr("y2",C+D-1).call(G.func);this.draw_g.append("svg:line").attr("x1",D+1).attr("y1",C+(D/2)).attr("x2",r+D-1).attr("y2",C+(D/2)).call(G.func)}this.AddDrag({obj:m,redraw:"drawLegend"})};a.TLegendPainter.prototype.Redraw=function(){this.drawLegend()};a.Painter.drawLegend=function(f,e,d){var c=new a.TLegendPainter(e);c.SetDivId(f);c.Redraw();return c.DrawingReady()};a.TMultiGraphPainter=function(c){a.TObjectPainter.call(this,c);this.mgraph=c;this.firstpainter=null;this.painters=new Array};a.TMultiGraphPainter.prototype=Object.create(a.TObjectPainter.prototype);a.TMultiGraphPainter.prototype.GetObject=function(){return this.mgraph};a.TMultiGraphPainter.prototype.UpdateObject=function(g){if((g==null)||(g._typename!="TMultiGraph")){return false}var d=g.fHistogram;var c=g.fGraphs;var f=false;if(this.firstpainter&&d){if(this.firstpainter.UpdateObject(d)){f=true}}for(var e in c.arr){if(e>=this.painters.length){break}if(this.painters[e].UpdateObject(c.arr[e])){f=true}}return f};a.TMultiGraphPainter.prototype.drawMultiGraph=function(c){var u,q,z=0,d=0,g=0,h=0,t=0,v=0,n,m;var o=this.mgraph.fHistogram;var l=this.mgraph.fGraphs;var k=1,j=1;var y=false,x=false;var e=true;var w=this.root_pad();if(w!=null){z=w.fUxmin;d=w.fUxmax;g=w.fUymin;h=w.fUymax;y=w.fLogx;x=w.fLogy}if(o!=null){q=o.fYaxis["fXmin"];u=o.fYaxis["fXmax"];if(w){t=a.Painter.padtoX(w,z);v=a.Painter.padtoX(w,d)}}else{for(var s=0;sd)){d=p.xmax}if((s==0)||(p.ymax>h)){h=p.ymax}}if(z==d){d+=1}if(g==h){h+=1}n=0.05*(d-z);m=0.05*(h-g);t=z-n;v=d+n;if(x){if(g<=0){g=0.001*h}q=g/(1+0.5*a.Math.log10(h/g));u=h*(1+0.2*a.Math.log10(h/g))}else{q=g-m;u=h+m}if(q<0&&g>=0){q=0}if(u>0&&h<=0){u=0}}if(this.mgraph.fMinimum!=-1111){g=q=this.mgraph.fMinimum}if(this.mgraph.fMaximum!=-1111){h=u=this.mgraph.fMaximum}if(t<0&&z>=0){if(y){t=0.9*z}}if(v>0&&d<=0){if(y){v=1.1*d}}if(q<0&&g>=0){if(x){q=0.9*g}}if(u>0&&h<=0){if(x){u=1.1*h}}if(q<=0&&x){q=0.001*u}if(t<=0&&y){if(v>1000){t=1}else{t=0.001*v}}g=q;h=u;if(o!=null){o.fYaxis["fXmin"]=g;o.fYaxis["fXmax"]=h}if(!o){o=a.Create("TH1I");o.fXaxis["fXmin"]=z;o.fXaxis["fXmax"]=d;o.fYaxis["fXmin"]=g;o.fYaxis["fXmax"]=h}this.firstpainter=a.Painter.drawHistogram1D(this.divid,o);for(var s in l.arr){var f=a.Painter.drawGraph(this.divid,l.arr[s]);this.painters.push(f)}};a.Painter.drawMultiGraph=function(f,e,d){var c=new a.TMultiGraphPainter(e);c.SetDivId(f);c.drawMultiGraph(d);return c.DrawingReady()};a.TTextPainter=function(c){a.TObjectPainter.call(this,c);this.text=c};a.TTextPainter.prototype=Object.create(a.TObjectPainter.prototype);a.TTextPainter.prototype.GetObject=function(){return this.text};a.TTextPainter.prototype.drawPaveLabel=function(){this.RecreateDrawG(true,".text_layer");var i=this.text;var j=this.pad_width(),q=this.pad_height();var d=i.fX1NDC*j;var c=(1-i.fY1NDC)*q;var o=Math.abs(i.fX2NDC-i.fX1NDC)*j;var m=Math.abs(i.fY2NDC-i.fY1NDC)*q;c-=m;var e=this.createAttFill(i);var u=a.Painter.root_colors[i.fTextColor];var r=a.Painter.root_colors[i.fShadowColor];var p="start",k=Math.round(i.fTextAlign/10);var l="bottom",f=i.fTextAlign%10;if(k==1){p="start"}else{if(k==2){p="middle"}else{if(k==3){p="end"}}}if(f==1){l="bottom"}else{if(f==2){l="middle"}else{if(f==3){l="top"}}}var s=i.fBorderSize?i.fBorderSize:0;var t=a.Painter.createAttLine(i,s);var g=this.draw_g.attr("x",d).attr("y",c).attr("width",o).attr("height",m).attr("transform","translate("+d+","+c+")");g.append("svg:rect").attr("x",0).attr("y",0).attr("width",o).attr("height",m).call(e.func).style("stroke-width",s?1:0).style("stroke",t.color);this.StartTextDrawing(i.fTextFont,m/1.7);this.DrawText(p,0.02*o,0,0.96*o,m,i.fLabel,u);this.FinishTextDrawing();if(s&&s>1){g.append("svg:line").attr("x1",o+(s/2)).attr("y1",s+1).attr("x2",o+(s/2)).attr("y2",m+s-1).call(t.func);g.append("svg:line").attr("x1",s+1).attr("y1",m+(s/2)).attr("x2",o+s-1).attr("y2",m+(s/2)).call(t.func)}var n=this;this.AddDrag({obj:i,redraw:"drawPaveLabel"})};a.TTextPainter.prototype.drawText=function(){var k=a.BIT(14);var i=this.pad_width(),g=this.pad_height(),f=true;var d=this.text.fX,m=this.text.fY;if(this.text.TestBit(k)){d=d*i;m=(1-m)*g}else{if(this.main_painter()!=null){i=this.frame_width();g=this.frame_height();f=false;d=this.main_painter().grx(d);m=this.main_painter().gry(m)}else{if(this.root_pad()!=null){var e=this.root_pad();if(e.fLogx){d=(d>0)?a.Math.log10(d):e.fUxmin}if(e.fLogy){m=(m>0)?a.Math.log10(m):e.fUymin}d=((Math.abs(e.fX1)+d)/(e.fX2-e.fX1))*i;m=(1-((Math.abs(e.fY1)+m)/(e.fY2-e.fY1)))*g}else{a.console("Cannot draw text at x/y coordinates without real TPad object");d=i/2;m=g/2}}}this.RecreateDrawG(f,f?".text_layer":".upper_layer",true);var j=a.Painter.root_colors[this.text.fTextColor];var c=0,l=1;if(this.text._typename=="TLatex"){c=1;l=0.9}else{if(this.text._typename=="TMathText"){c=2;l=0.8}}this.StartTextDrawing(this.text.fTextFont,this.text.fTextSize*Math.min(i,g)*l);this.DrawText(this.text.fTextAlign,d,m,0,0,this.text.fTitle,j,c);this.FinishTextDrawing()};a.TTextPainter.prototype.UpdateObject=function(c){if(this.text._typename!=c._typename){return false}if(this.text._typename=="TPaveLabel"){this.text.fLabel=c.fLabel}else{this.text.fTitle=c.fTitle}return true};a.TTextPainter.prototype.Redraw=function(){if(this.text._typename=="TPaveLabel"){this.drawPaveLabel()}else{this.drawText()}};a.Painter.drawText=function(e,d){var c=new a.TTextPainter(d);c.SetDivId(e);c.Redraw();return c.DrawingReady()};a.Painter.drawStreamerInfo=function(e,d){b.select("#"+e).style("overflow","auto");var c=new a.HierarchyPainter("sinfo",e);c.ShowStreamerInfo(d);return c.DrawingReady()};a.RawTextPainter=function(c){a.TBasePainter.call(this);this.txt=c;return this};a.RawTextPainter.prototype=Object.create(a.TBasePainter.prototype);a.RawTextPainter.prototype.RedrawObject=function(c){this.txt=c;this.Draw();return true};a.RawTextPainter.prototype.Draw=function(){var e=this.txt.value;if(e==null){e=""}var h="mathjax" in this.txt;if(!h&&!("as_is" in this.txt)){var d=e.split("\n");e="";for(var g in d){e+="
    "+d[g]+"
    "}}var j=b.select("#"+this.divid);var c=j.select("div");if(c.empty()){c=j.append("div").style("max-width","100%").style("max-height","100%").style("overflow","auto")}c.html(e);this.SetDivId(this.divid);if(h){if(this["loading_mathjax"]){return}this["loading_mathjax"]=true;var f=this;a.AssertPrerequisites("mathjax",function(){f.loading_mathjax=false;if(typeof MathJax=="object"){MathJax.Hub.Queue(["Typeset",MathJax.Hub,j.node()])}})}};a.Painter.drawRawText=function(f,c,e){var d=new a.RawTextPainter(c);d.SetDivId(f);d.Draw();return d.DrawingReady()};a.hpainter=null;a.HierarchyPainter=function(c,d){a.TBasePainter.call(this);this.name=c;this.frameid=d;this.h=null;this.files_monitoring=(d==null);if(a.hpainter==null){a.hpainter=this}};a.HierarchyPainter.prototype=Object.create(a.TBasePainter.prototype);a.HierarchyPainter.prototype.Cleanup=function(){this.clear(true)};a.HierarchyPainter.prototype.ListHierarchy=function(f,c){f._childs=[];for(var d in c.arr){var g=c.arr[d];var e={_name:g.fName,_kind:"ROOT."+g._typename,_readobj:g};f._childs.push(e)}};a.HierarchyPainter.prototype.StreamerInfoHierarchy=function(j,c){j._childs=[];for(var e in c.arr){var h=c.arr[e];if(typeof(h.fName)=="undefined"){a.console("strange element in StreamerInfo with name "+h.fName);continue}var g={_name:h.fName,_kind:"",_childs:[]};j._childs.push(g);g._childs.push({_name:"Checksum: "+h.fCheckSum});g._childs.push({_name:"Class version: "+h.fClassVersion});if(h.fTitle!=""){g._childs.push({_name:"Title: "+h.fTitle})}if(typeof h.fElements=="undefined"){continue}for(var d in h.fElements["arr"]){var f=h.fElements["arr"][d];if((f==null)||(typeof(f.fName)=="undefined")){continue}var k=f.fTypeName+" "+f.fName+";";if(f.fTitle!=""){k+=" // "+f.fTitle}g._childs.push({_name:k})}}};a.HierarchyPainter.prototype.TreeHierarchy=function(h,l){h._childs=[];for(var f in l.fBranches.arr){var g=l.fBranches.arr[f];var c=g.fLeaves.arr.length;if(c==1&&g.fLeaves.arr[0]["fName"]==g.fName){c=0}var d={_name:g.fName,_kind:c>0?"ROOT.TBranch":"ROOT.TLeafF"};h._childs.push(d);if(c>0){d._childs=[];for(var e=0;e0);return("last_exists" in c)?k:null}var e=this.h;var f="";if(typeof c=="string"){f=c;c={}}else{if(typeof c=="object"){f=c.name;if("top" in c){e=c.top}}else{return null}}return d(e,f)};a.HierarchyPainter.prototype.itemFullName=function(d,e){var c="";while("_parent" in d){if(c.length>0){c="/"+c}c=d._name+c;d=d._parent;if((e!=null)&&(d==e)){break}}return c};a.HierarchyPainter.prototype.ExecuteCommand=function(f,i){var k=this.Find(f);var c=f+"/cmd.json";var d=this;if("_numargs" in k){for(var e=0;e0){i=i.substr(c.length+1)}break}if(!("_parent" in e)){e=null;break}e=e._parent}if(e==null){e=this.h}if("_get" in e){return e._get(null,i,h,d)}}var g=f;while(g!=null){if(("_get" in g)&&(typeof(g._get)=="function")){return g._get(f,null,h,d)}g=("_parent" in g)?g._parent:null}a.CallBack(h,f,null)};a.HierarchyPainter.prototype.draw=function(e,d,c){return a.draw(e,d,c)};a.HierarchyPainter.prototype.player=function(h,d,g){var e=this.Find(h);if(!e||!("_player" in e)){return a.CallBack(g,null)}var f=this;var c=("_prereq" in e)?e._prereq:"";a.AssertPrerequisites(c,function(){var i=a.findFunction(e._player);if(i==null){return a.CallBack(g,null)}f.CreateDisplay(function(k){var j=null;if(k){j=i(f,h,d)}a.CallBack(g,j)})})};a.HierarchyPainter.prototype.display=function(i,d,g){var e=this;var c=null;function f(){a.CallBack(g,c,i)}e.CreateDisplay(function(l){if(!l){return f()}var h=(typeof(d)=="string")&&(d.indexOf("update:")==0);var j=e.Find(i);if((j!=null)&&("_player" in j)){return e.player(i,d,f)}if(h){d=d.substr(7);if((j==null)||("_doing_update" in j)){return f()}j._doing_update=true}if(j!=null){var k=a.getDrawHandle(j._kind,d);if((k==null)||!("func" in k)){return f()}}e.get(i,function(m,n){if(h&&m){delete m._doing_update}if(n==null){return f()}var q=d?d.indexOf("divid:"):-1;if(q>=0){var p=d.slice(q+6);d=d.slice(0,q);c=e.draw(p,n,d)}else{l.ForEachPainter(function(r,s){if(r.GetItemName()!=i){return}if(!h&&(d!=null)&&(r.GetItemDrawOpt()!=d)){return}c=r;l.ActivateFrame(s);c.RedrawObject(n)})}if(c==null){if(h){a.console("something went wrong - did not found painter when doing update of "+i)}else{var o=l.FindFrame(i,true);b.select(o).html("");l.ActivateFrame(o);c=e.draw(b.select(o).attr("id"),n,d);e.enable_dropping(o,i)}}if(c){c.SetItemName(i,h?null:d)}f()},d)})};a.HierarchyPainter.prototype.enable_dropping=function(c,d){};a.HierarchyPainter.prototype.dropitem=function(g,f,d){var c=this;var e=c.disp;c.get(g,function(i,j){if(j!=null){var h=c.draw(f,j,"same");if(h){h.SetItemName(g)}}a.CallBack(d)});return true};a.HierarchyPainter.prototype.updateItems=function(c){var f=this["disp"];if((f==null)||(c==null)){return}var d=[],e=[];f.ForEachPainter(function(g){var h=g.GetItemName();if((h==null)||(d.indexOf(h)>=0)){return}if(typeof c=="array"){if(c.indexOf(h)<0){return}}else{if(c!=h){return}}d.push(h);e.push("update:"+g.GetItemDrawOpt())},true);if(d.length>0){this.displayAll(d,e)}};a.HierarchyPainter.prototype.updateAll=function(e,f){var i=this["disp"];if(i==null){return}var h=[],d=[],g=this;i.ForEachPainter(function(n){var o=n.GetItemName();var j=n.GetItemDrawOpt();if((o==null)||(h.indexOf(o)>=0)){return}var l=g.Find(o);if((l==null)||("_not_monitor" in l)||("_player" in l)){return}var k=false;if("_always_monitor" in l){k=true}else{var m=a.getDrawHandle(l._kind);if(m&&("monitor" in m)){if((m.monitor===false)||(m.monitor=="never")){return}if(m.monitor==="always"){k=true}}}if(k||!e){h.push(o);d.push("update:"+j)}},true);var c=this;if(this.files_monitoring){this.ForEachRootFile(function(j){c.ForEach(function(k){delete k._readobj},j);delete j._file})}this.displayAll(h,d)};a.HierarchyPainter.prototype.displayAll=function(c,d,f){if((c==null)||(c.length==0)){return a.CallBack(f)}var e=this;e.CreateDisplay(function(m){if(!m){return a.CallBack(f)}if(d==null){d=[]}while(d.length0){k[h]=c[h].split("+");c[h]=k[h].shift();for(var g in k[h]){var l=k[h][g].indexOf("_same_");if((l>0)&&(e.Find(k[h][g])==null)){k[h][g]=k[h][g].substr(0,l)+c[h].substr(l)}}}var l=c[h].indexOf("_same_");if((l>0)&&!e.Find(c[h])&&(h>0)){c[h]=c[h].substr(0,l)+c[0].substr(l)}}for(var h in c){if(d[h].indexOf("update:")!=0){m.CreateFrame(c[h])}}for(var h in c){e.display(c[h],d[h],function(i,o){var n=c.indexOf(o);if(n<0){return a.console("did not found item "+o)}c[n]="---";function j(){if((i!=null)&&(k[n]!=null)&&(k[n].length>0)){return e.dropitem(k[n].shift(),i.divid,j)}var q=false;for(var p in c){if(c[p]!="---"){q=true}}if(!q){a.CallBack(f)}}j()})}})};a.HierarchyPainter.prototype.reload=function(){var c=this;if("_online" in this.h){this.OpenOnline(this.h._online,function(){c.RefreshHtml()})}};a.HierarchyPainter.prototype.expand=function(c){alert("expand "+c+" can be used only jquery part loaded")};a.HierarchyPainter.prototype.GetTopOnlineItem=function(){if(this.h==null){return null}if("_online" in this.h){return this.h}if((this.h._childs!=null)&&("_online" in this.h._childs[0])){return this.h._childs[0]}return null};a.HierarchyPainter.prototype.ForEachJsonFile=function(d){if(this.h==null){return}if("_jsonfile" in this.h){return a.CallBack(d,this.h)}if(this.h._childs!=null){for(var e in this.h._childs){var c=this.h._childs[e];if("_jsonfile" in c){a.CallBack(d,c)}}}};a.HierarchyPainter.prototype.OpenJsonFile=function(f,e){var d=false;this.ForEachJsonFile(function(g){if(g._jsonfile==f){d=true}});if(d){return a.CallBack(e)}var c=this;a.NewHttpRequest(f,"object",function(i){if(i==null){return a.CallBack(e)}var h={_jsonfile:f,_kind:"ROOT."+i._typename,_jsontmp:i,_name:f.split("/").pop()};if("fTitle" in i){h._title=i.fTitle}h._get=function(l,n,m){if("_jsontmp" in l){var k=l._jsontmp;delete l._jsontmp;return a.CallBack(m,l,k)}a.NewHttpRequest(l._jsonfile,"object",function(o){return a.CallBack(m,l,o)}).send(null)};if(c.h==null){c.h=h}else{if(c.h._kind=="TopFolder"){c.h._childs.push(h)}else{var j=c.h;var g=("_jsonfile" in j)?"Files":"Items";c.h={_name:g,_kind:"TopFolder",_childs:[j,h]}}}c.RefreshHtml(e)}).send(null)};a.HierarchyPainter.prototype.ForEachRootFile=function(d){if(this.h==null){return}if((this.h._kind=="ROOT.TFile")&&(this.h._file!=null)){return a.CallBack(d,this.h)}if(this.h._childs!=null){for(var e in this.h._childs){var c=this.h._childs[e];if((c._kind=="ROOT.TFile")&&("_fullurl" in c)){a.CallBack(d,c)}}}};a.HierarchyPainter.prototype.OpenRootFile=function(f,e){var d=false;this.ForEachRootFile(function(g){if(g._fullurl==f){d=true}});if(d){return a.CallBack(e)}var c=this;a.AssertPrerequisites("io",function(){new a.TFile(f,function(i){if(i==null){return a.CallBack(e)}var h=c.FileHierarchy(i);h._isopen=true;if(c.h==null){c.h=h}else{if(c.h._kind=="TopFolder"){c.h._childs.push(h)}else{var j=c.h;var g=(j._kind=="ROOT.TFile")?"Files":"Items";c.h={_name:g,_kind:"TopFolder",_childs:[j,h]}}}c.RefreshHtml(e)})})};a.HierarchyPainter.prototype.GetFileProp=function(e){var c=this.Find(e);if(c==null){return null}var d=c._name;while(c._parent!=null){c=c._parent;if("_file" in c){return{fileurl:c._file.fURL,itemname:d}}d=c._name+"/"+d}return null};a.MarkAsStreamerInfo=function(c,d,e){if((e!=null)&&(e._typename=="TList")){e._typename="TStreamerInfoList"}};a.HierarchyPainter.prototype.GetOnlineItemUrl=function(c){if((c!=null)&&(typeof c=="string")){c=this.Find(c)}if(c==null){return null}var d=c;while((d!=null)&&(!("_online" in d))){d=d._parent}return this.itemFullName(c,d)};a.HierarchyPainter.prototype.GetOnlineItem=function(o,k,m,i){var d=k,g=false,l="",p="object",c=this,f=null;if(o!=null){d=this.GetOnlineItemUrl(o);var e=null;if("_kind" in o){f=a.getDrawHandle(o._kind)}if("_doing_expand" in o){g=true;l="h.json?compact=3"}else{if("_make_request" in o){e=a.findFunction(o._make_request)}else{if((f!=null)&&("make_request" in f)){e=f.make_request}}}if(typeof e=="function"){var j=e(c,o,d,i);if(j!=null){if(typeof j=="string"){l=j}else{if("req" in j){l=j.req}if("kind" in j){p=j.kind}}}}if((l.length==0)&&(o._kind.indexOf("ROOT.")!=0)){l="item.json.gz?compact=3"}}if((k==null)&&(o!=null)&&("_cached_draw_object" in this)&&(l.length==0)){var h=this["_cached_draw_object"];delete this["_cached_draw_object"];return a.CallBack(m,o,h)}if(l.length==0){l="root.json.gz?compact=3"}if(d.length>0){d+="/"}d+=l;var n=a.NewHttpRequest(d,p,function(s){var r=null;if(!g&&(o!=null)&&("_after_request" in o)){r=a.findFunction(o._after_request)}else{if((f!=null)&&("after_request" in f)){r=f.after_request}}if(typeof r=="function"){var q=r(c,o,s,i,n);if((q!=null)&&(typeof q=="object")){s=q}}a.CallBack(m,o,s)});n.send(null)};a.HierarchyPainter.prototype.OpenOnline=function(e,f){var c=this;function g(i){c.h=i;if(c.h==null){return}if(("_title" in c.h)&&(c.h._title!="")){document.title=c.h._title}i._isopen=true;c.h._online=e;c.h._get=function(l,n,m,k){c.GetOnlineItem(l,n,m,k)};c.h._expand=function(k,l){if((l!=null)&&(k!=null)&&("_childs" in l)){k._childs=l._childs;l._childs=null;return true}return false};var h="",j="";c.ForEach(function(l){if("_autoload" in l){var k=l._autoload.split(";");for(var m in k){if((k[m].length>3)&&((k[m].lastIndexOf(".js")==k[m].length-3)||(k[m].lastIndexOf(".css")==k[m].length-4))){if(h.indexOf(k[m])<0){h+=k[m]+";"}}else{if(j.indexOf(k[m])<0){j+=k[m]+";"}}}}});if(h.length>0){h="user:"+h}a.AssertPrerequisites(j+h,function(){c.ForEach(function(m){if(!("_drawfunc" in m)||!("_kind" in m)){return}var l="kind:"+m._kind;if(m._kind.indexOf("ROOT.")==0){l=m._kind.slice(5)}var k=m._drawopt;if(!a.canDraw(l)||(k!=null)){a.addDrawFunc({name:l,func:m._drawfunc,script:m._drawscript,opt:k})}});a.CallBack(f,c)})}if(!e){e=""}if(typeof e=="object"){var d=e;e="";return g(d)}a.NewHttpRequest(e+"h.json?compact=3","object",g).send(null)};a.HierarchyPainter.prototype.GetOnlineProp=function(e){var c=this.Find(e);if(c==null){return null}var d=c._name;while(c._parent!=null){c=c._parent;if("_online" in c){return{server:c._online,itemname:d}}d=c._name+"/"+d}return null};a.HierarchyPainter.prototype.FillOnlineMenu=function(d,k,i){var l=this;var e=this.Find(i);var c=a.getDrawOptions(e._kind,"nosame");var g=a.getDrawHandle(e._kind);var h=e._kind.indexOf("ROOT.")==0;if(c!=null){d.addDrawMenu("Draw",c,function(m){l.display(i,m)})}if((e._childs==null)&&(("_more" in e)||h)){d.add("Expand",function(){l.expand(i)})}if(g&&("execute" in g)){d.add("Execute",function(){l.ExecuteCommand(i,d.tree_node)})}var j=k.server+k.itemname+"/draw.htm";var f="?";if(this.IsMonitoring()){j+=f+"monitoring="+this.MonitoringInterval();f="&"}if(c!=null){d.addDrawMenu("Draw in new window",c,function(m){window.open(j+f+"opt="+m)})}if((c!=null)&&(c.length>0)&&h){d.addDrawMenu("Draw as png",c,function(m){window.open(k.server+k.itemname+"/root.png?w=400&h=300&opt="+m)})}if("_player" in e){d.add("Player",function(){l.player(i)})}};a.HierarchyPainter.prototype.ShowStreamerInfo=function(c){this.h={_name:"StreamerInfo"};this.StreamerInfoHierarchy(this.h,c);this.RefreshHtml()};a.HierarchyPainter.prototype.Adopt=function(c){this.h=c;this.RefreshHtml()};a.HierarchyPainter.prototype.SetMonitoring=function(c){this["_monitoring_on"]=false;this["_monitoring_interval"]=3000;if((c!=null)&&(c!="0")){this["_monitoring_on"]=true;this["_monitoring_interval"]=parseInt(c);if((this["_monitoring_interval"]==NaN)||(this["_monitoring_interval"]<100)){this["_monitoring_interval"]=3000}}};a.HierarchyPainter.prototype.MonitoringInterval=function(c){return("_monitoring_interval" in this)?this["_monitoring_interval"]:3000};a.HierarchyPainter.prototype.EnableMonitoring=function(c){this["_monitoring_on"]=c};a.HierarchyPainter.prototype.IsMonitoring=function(){return this["_monitoring_on"]};a.HierarchyPainter.prototype.SetDisplay=function(d,c){this["disp_kind"]=d;this["disp_frameid"]=c};a.HierarchyPainter.prototype.GetLayout=function(){return this["disp_kind"]};a.HierarchyPainter.prototype.clear=function(c){if("disp" in this){this["disp"].Reset();delete this["disp"]}if(c){b.select("#"+this.frameid).html("");delete this.h}else{this.ForEach(function(d){if(("clear" in d)&&(typeof d.clear=="function")){d.clear()}})}};a.HierarchyPainter.prototype.GetDisplay=function(){return("disp" in this)?this["disp"]:null};a.HierarchyPainter.prototype.CreateDisplay=function(d){var c=this;if("disp" in this){if(c.disp.NumDraw()>0){return a.CallBack(d,c.disp)}c.disp.Reset();delete c.disp}if(document.getElementById(this["disp_frameid"])==null){return a.CallBack(d,null)}if(c.disp_kind=="simple"){c.disp=new a.SimpleDisplay(c.disp_frameid)}else{if(c.disp_kind.search("grid")==0){c.disp=new a.GridDisplay(c.disp_frameid,c.disp_kind)}}if(c.disp!=null){a.CallBack(d,c.disp)}else{a.AssertPrerequisites("jq2d",function(){c.CreateDisplay(d)})}};a.HierarchyPainter.prototype.updateOnOtherFrames=function(c,e){var f=this["disp"];if(f==null){return false}var d=false;f.ForEachPainter(function(g,h){if((g===c)||(g.GetItemName()!=c.GetItemName())){return}f.ActivateFrame(h);g.RedrawObject(e);d=true});return d};a.HierarchyPainter.prototype.CheckResize=function(c){if("disp" in this){this["disp"].CheckResize()}};a.HierarchyPainter.prototype.StartGUI=function(n,h){var g=this;var j=a.GetUrlOptionAsArray("file;files");var p=a.GetUrlOptionAsArray("json");var f=a.GetUrlOption("path");if(f!=null){for(var k in j){j[k]=f+j[k]}for(var k in p){p[k]=f+p[k]}}var c=a.GetUrlOptionAsArray("item;items");var e=a.GetUrlOptionAsArray("opt;opts");var o=a.GetUrlOption("monitoring");if((p.length>0)&&(c.length==0)){c.push("")}var l=a.GetUrlOption("layout");if(!this["disp_kind"]||(l!=null)){this["disp_kind"]=(l&&l.length>0)?l:"simple"}if(a.GetUrlOption("files_monitoring")!=null){this.files_monitoring=true}a.RegisterForResize(this);this.SetMonitoring(o);function m(){if(p.length>0){g.OpenJsonFile(p.shift(),m)}else{if(j.length>0){g.OpenRootFile(j.shift(),m)}else{g.displayAll(c,e,function(){g.RefreshHtml();a.RegisterForResize(g);setInterval(function(){g.updateAll(!g.IsMonitoring())},g.MonitoringInterval());a.CallBack(h)})}}}function d(){if(("_monitoring" in g.h)&&(o==null)){g.SetMonitoring(g.h._monitoring)}if(("_layout" in g.h)&&(l==null)){g.disp_kind=g.h._layout}if(("_loadfile" in g.h)&&(j.length==0)){j=a.ParseAsArray(g.h._loadfile)}if(("_drawitem" in g.h)&&(c.length==0)){c=a.ParseAsArray(g.h._drawitem);e=a.ParseAsArray(g.h._drawopt)}m()}if(n!=null){g.OpenOnline(n,d)}else{m()}};a.BuildNobrowserGUI=function(){var c=b.select("#simpleGUI");var d=false,e=false;if(c.empty()){d=true;c=b.select("#onlineGUI");if(c.empty()){c=b.select("#drawGUI");e=true}if(c.empty()){return alert("no div for simple nobrowser gui found")}}a.Painter.readStyleFromURL();b.select("html").style("height","100%");b.select("body").style({"min-height":"100%",margin:"0px",overflow:"hidden"});c.style({position:"absolute",left:"1px",top:"1px",bottom:"1px",right:"1px"});var h=new a.HierarchyPainter("root",null);h.SetDisplay("simple",c.attr("id"));var f=null;if(d){var g=a.findFunction("GetCachedHierarchy");if(typeof g=="function"){f=g()}if(typeof f!="object"){f=""}}h.StartGUI(f,function(){if(!e){return}var j=a.findFunction("GetCachedObject");var k=(typeof j=="function")?a.JSONR_unref(j()):null;if(k!=null){h._cached_draw_object=k}var i=a.GetUrlOption("opt");h.display("",i)})};a.MDIDisplay=function(c){this.frameid=c;b.select("#"+this.frameid).property("mdi",this)};a.MDIDisplay.prototype.ForEachFrame=function(c,d){alert("ForEachFrame not implemented")};a.MDIDisplay.prototype.ForEachPainter=function(c,d){this.ForEachFrame(function(f){var e=new a.TObjectPainter();e.SetDivId(b.select(f).attr("id"),-1);e.ForEachPainter(function(g){c(g,f)})},d)};a.MDIDisplay.prototype.NumDraw=function(){var c=0;this.ForEachFrame(function(){c++});return c};a.MDIDisplay.prototype.FindFrame=function(d,e){var c=null;this.ForEachFrame(function(f){if(b.select(f).attr("title")==d){c=f}});if((c==null)&&e){c=this.CreateFrame(d)}return c};a.MDIDisplay.prototype.ActivateFrame=function(c){};a.MDIDisplay.prototype.CheckResize=function(d){var c=null;this.ForEachPainter(function(e,f){if((d!=null)&&(b.select(f).attr("id")!=d)){return}if((e.GetItemName()!=null)&&(typeof e.CheckResize=="function")){if(c===f){return}e.CheckResize();c=f}})};a.MDIDisplay.prototype.Reset=function(){this.ForEachPainter(function(c){if((c.GetItemName()!=null)&&(typeof c.Clenaup=="function")){c.Clenaup()}});b.select("#"+this.frameid).html("").property("mdi",null)};a.MDIDisplay.prototype.Draw=function(f,d,c){if(!d){return}if(!a.canDraw(d._typename,c)){return}var e=this.FindFrame(f,true);this.ActivateFrame(e);return a.redraw(b.select(e).attr("id"),d,c)};a.SimpleDisplay=function(c){a.MDIDisplay.call(this,c)};a.SimpleDisplay.prototype=Object.create(a.MDIDisplay.prototype);a.SimpleDisplay.prototype.ForEachFrame=function(c,e){var d=b.select("#"+this.frameid+"_simple_display");if(!d.empty()){a.CallBack(c,d.node())}};a.SimpleDisplay.prototype.CreateFrame=function(c){return b.select("#"+this.frameid).html("").append("div").attr("id",this.frameid+"_simple_display").style("width","100%").style("height","100%").style("overflow","hidden").property("title",c).node()};a.SimpleDisplay.prototype.Reset=function(){a.MDIDisplay.prototype.Reset.call(this);b.select("#"+this.frameid).html("")};a.GridDisplay=function(e,d,c){a.MDIDisplay.call(this,e);this.cnt=0;if(typeof d=="string"){if(d.search("grid")==0){d=d.slice(4).trim()}var f=d.search("x");if(f>0){c=parseInt(d.slice(f+1));d=parseInt(d.slice(0,f))}else{d=parseInt(d);c=d}if(d==NaN){d=3}if(c==NaN){c=3}}if(!d){d=3}if(!c){c=d}this.sizex=d;this.sizey=c};a.GridDisplay.prototype=Object.create(a.MDIDisplay.prototype);a.GridDisplay.prototype.IsSingle=function(){return(this.sizex==1)&&(this.sizey==1)};a.GridDisplay.prototype.ForEachFrame=function(c,f){for(var d=0;d";var c=0;for(var f=0;f";for(var e=0;e
    "}l+=""}l+="
    ";d.html(l);d.selectAll(".grid_cell").style({width:o+"px",height:k+"px",overflow:"hidden"})}d=b.select("#"+g+"_"+this.cnt);if(++this.cnt>=this.sizex*this.sizey){this.cnt=0}}return d.html("").property("title",n).node()};a.GridDisplay.prototype.Reset=function(){a.MDIDisplay.prototype.Reset.call(this);if(this.IsSingle()){b.select("#"+this.frameid).property("title",null)}this.cnt=0};a.GridDisplay.prototype.CheckResize=function(){if(!this.IsSingle()){var c=b.select("#"+this.frameid);var f=c.node().getBoundingClientRect();var e=Math.floor(f.height/this.sizey)-1;var d=Math.floor(f.width/this.sizex)-1;c.selectAll(".grid_cell").style({width:d+"px",height:e+"px"})}a.MDIDisplay.prototype.CheckResize.call(this)};a.RegisterForResize=function(f,d){var g=null;var i=-1;var c=d?d/2.5:100;if(c<20){c=20}function e(){if(i<0){return}i+=1;if(i<3){return}if(g!=null){clearInterval(g);g=null}i=-1;if(f==null){return}document.body.style.cursor="wait";if(typeof f=="function"){f()}else{if((typeof f=="object")&&(typeof f.CheckResize=="function")){f.CheckResize()}else{if(typeof f=="string"){var j=b.select("#"+f);if(!j.empty()){var m=j.property("mdi");if(m){m.CheckResize()}else{var k=new a.TObjectPainter();var l=true;k.SetDivId(f,-1);k.ForEachPainter(function(n){if(l&&(typeof n.CheckResize=="function")){l=false;n.CheckResize()}})}}}}}document.body.style.cursor="auto"}function h(){if(g==null){g=setInterval(e,c)}i=0}window.addEventListener("resize",h)};a.addDrawFunc({name:"TCanvas",icon:"img_canvas",func:a.Painter.drawCanvas});a.addDrawFunc({name:"TPad",func:a.Painter.drawPad});a.addDrawFunc({name:"TFrame",func:a.Painter.drawFrame});a.addDrawFunc({name:"TLegend",func:a.Painter.drawLegend});a.addDrawFunc({name:"TPaveText",func:a.Painter.drawPaveText});a.addDrawFunc({name:"TPaveStats",func:a.Painter.drawPaveText});a.addDrawFunc({name:"TLatex",func:a.Painter.drawText});a.addDrawFunc({name:"TMathText",func:a.Painter.drawText});a.addDrawFunc({name:"TText",func:a.Painter.drawText});a.addDrawFunc({name:"TPaveLabel",func:a.Painter.drawText});a.addDrawFunc({name:/^TH1/,icon:"img_histo1d",func:a.Painter.drawHistogram1D,opt:";P;P0;E;E1;E2;same"});a.addDrawFunc({name:"TProfile",icon:"img_profile",func:a.Painter.drawHistogram1D,opt:";E1;E2"});a.addDrawFunc({name:/^TH2/,icon:"img_histo2d",func:a.Painter.drawHistogram2D,opt:";COL;COLZ;COL3;LEGO;same"});a.addDrawFunc({name:/^TH3/,icon:"img_histo3d",prereq:"3d",func:"JSROOT.Painter.drawHistogram3D"});a.addDrawFunc({name:"THStack",func:a.Painter.drawHStack});a.addDrawFunc({name:"TF1",icon:"img_graph",func:a.Painter.drawFunction});a.addDrawFunc({name:/^TGraph/,icon:"img_graph",func:a.Painter.drawGraph,opt:";L;P"});a.addDrawFunc({name:"TCutG",icon:"img_graph",func:a.Painter.drawGraph,opt:";L;P"});a.addDrawFunc({name:/^RooHist/,icon:"img_graph",func:a.Painter.drawGraph,opt:";L;P"});a.addDrawFunc({name:/^RooCurve/,icon:"img_graph",func:a.Painter.drawGraph,opt:";L;P"});a.addDrawFunc({name:"TMultiGraph",func:a.Painter.drawMultiGraph});a.addDrawFunc({name:"TStreamerInfoList",icon:"img_question",func:a.Painter.drawStreamerInfo});a.addDrawFunc({name:"TPaletteAxis",func:a.Painter.drawPaletteAxis});a.addDrawFunc({name:"kind:Text",icon:"img_text",func:a.Painter.drawRawText});a.addDrawFunc({name:"kind:Command",icon:"img_execute",execute:true});a.addDrawFunc({name:"TFolder",icon:"img_folder",icon2:"img_folderopen"});a.addDrawFunc({name:"TTree",icon:"img_tree"});a.addDrawFunc({name:"TNtuple",icon:"img_tree"});a.addDrawFunc({name:"TBranch",icon:"img_branch"});a.addDrawFunc({name:/^TLeaf/,icon:"img_leaf"});a.addDrawFunc({name:"TFile",icon:"img_file"});a.addDrawFunc({name:"TMemFile",icon:"img_file"});a.addDrawFunc({name:"Session",icon:"img_globe"});a.addDrawFunc({name:"kind:TopFolder",icon:"img_base"});a.getDrawHandle=function(e,f){if(typeof e!="string"){return null}if(f===""){f=null}var l=null;if((f==null)&&(e in a.DrawFuncs.cache)){return a.DrawFuncs.cache[e]}var n=(e.indexOf("ROOT.")==0)?e.substr(5):"kind:"+e;var d=0;for(var k in a.DrawFuncs.lst){var m=a.DrawFuncs.lst[k];if(typeof m.name=="string"){if(m.name!=n){continue}}else{if(!n.match(m.name)){continue}}if(f==null){if(!(e in a.DrawFuncs.cache)){a.DrawFuncs.cache[e]=m}return m}else{if(typeof f=="string"){if(l==null){l=m}if("opt" in m){var c=m.opt.split(";");for(var g in c){c[g]=c[g].toLowerCase()}if(c.indexOf(f.toLowerCase())>=0){return m}}}else{if(f===d){return m}}}d++}return l};a.getDrawOptions=function(g,c){if(typeof g!="string"){return null}var l=null,k=false;for(var e=0;e<1000;e++){var f=a.getDrawHandle(g,e);if(f==null){break}k=true;if(!("opt" in f)){continue}var j=f.opt.split(";");for(var d in j){j[d]=j[d].toLowerCase();if((c=="nosame")&&(j[d].indexOf("same")==0)){continue}if(l==null){l=[]}if(l.indexOf(j[d])<0){l.push(j[d])}}}if(k&&(l==null)){l=new Array;l.push("")}return l};a.canDraw=function(c){return a.getDrawHandle("ROOT."+c)!=null};a.draw=function(j,i,f){if((i==null)||(typeof i!="object")){return null}var h=null;if("_typename" in i){h=a.getDrawHandle("ROOT."+i._typename,f)}else{if("_kind" in i){h=a.getDrawHandle(i._kind,f)}}if((h==null)||!("func" in h)){return null}if(typeof h.func=="function"){return h.func(j,i,f)}var c="",e="";if(typeof h.func=="object"){if("func" in h.func){c=h.func.func}if("script" in h.func){e="user:"+h.func.script}}else{if(typeof h.func=="string"){c=h.func;if(("prereq" in h)&&(typeof h.prereq=="string")){e=h.prereq}if(("script" in h)&&(typeof h.script=="string")){e+=";user:"+h.script}}}if(c.length==0){return null}if(e.length>0){var d=(c.indexOf("JSROOT.Painter")==0)?new a.TObjectPainter():new a.TBasePainter();a.AssertPrerequisites(e,function(){var l=a.findFunction(c);if(l==null){alert("Fail to find function "+c+" after loading "+e);return null}var k=l(j,i,f,d);if(k!==d){alert("Painter function "+c+" do not follow rules of dynamicaly loaded painters")}});return d}var g=a.findFunction(c);if(g!=null){return g(j,i,f)}return null};a.redraw=function(j,g,e){if(g==null){return}var f=b.select("#"+j+" .root_canvas");var c=f.empty()?null:f.property("pad_painter");if(c!=null){if(g._typename=="TCanvas"){c.RedrawObject(g);return c}for(var d in c.painters){var h=c.painters[d].GetObject();if((h!=null)&&(h._typename==g._typename)){if(c.painters[d].UpdateObject(g)){c.RedrawPad();return c.painters[d]}}}}if(c){a.console("Cannot find painter to update object of type "+g._typename)}b.select("#"+j).html("");return a.draw(j,g,e)};return a})); \ No newline at end of file diff --git a/js/scripts/d3.v3.min.js b/js/scripts/d3.v3.min.js new file mode 100755 index 0000000..f17ee15 --- /dev/null +++ b/js/scripts/d3.v3.min.js @@ -0,0 +1,5 @@ +!function(){function n(n,t){return t>n?-1:n>t?1:n>=t?0:0/0}function t(n){return null!=n&&!isNaN(n)}function e(n){return{left:function(t,e,r,u){for(arguments.length<3&&(r=0),arguments.length<4&&(u=t.length);u>r;){var i=r+u>>>1;n(t[i],e)<0?r=i+1:u=i}return r},right:function(t,e,r,u){for(arguments.length<3&&(r=0),arguments.length<4&&(u=t.length);u>r;){var i=r+u>>>1;n(t[i],e)>0?u=i:r=i+1}return r}}}function r(n){return n.length}function u(n){for(var t=1;n*t%1;)t*=10;return t}function i(n,t){try{for(var e in t)Object.defineProperty(n.prototype,e,{value:t[e],enumerable:!1})}catch(r){n.prototype=t}}function o(){}function a(n){return ia+n in this}function c(n){return n=ia+n,n in this&&delete this[n]}function s(){var n=[];return this.forEach(function(t){n.push(t)}),n}function l(){var n=0;for(var t in this)t.charCodeAt(0)===oa&&++n;return n}function f(){for(var n in this)if(n.charCodeAt(0)===oa)return!1;return!0}function h(){}function g(n,t,e){return function(){var r=e.apply(t,arguments);return r===t?n:r}}function p(n,t){if(t in n)return t;t=t.charAt(0).toUpperCase()+t.substring(1);for(var e=0,r=aa.length;r>e;++e){var u=aa[e]+t;if(u in n)return u}}function v(){}function d(){}function m(n){function t(){for(var t,r=e,u=-1,i=r.length;++ue;e++)for(var u,i=n[e],o=0,a=i.length;a>o;o++)(u=i[o])&&t(u,o,e);return n}function U(n){return sa(n,da),n}function j(n){var t,e;return function(r,u,i){var o,a=n[i].update,c=a.length;for(i!=e&&(e=i,t=0),u>=t&&(t=u+1);!(o=a[t])&&++t0&&(n=n.substring(0,a));var s=ya.get(n);return s&&(n=s,c=Y),a?t?u:r:t?v:i}function O(n,t){return function(e){var r=Zo.event;Zo.event=e,t[0]=this.__data__;try{n.apply(this,t)}finally{Zo.event=r}}}function Y(n,t){var e=O(n,t);return function(n){var t=this,r=n.relatedTarget;r&&(r===t||8&r.compareDocumentPosition(t))||e.call(t,n)}}function I(){var n=".dragsuppress-"+ ++Ma,t="click"+n,e=Zo.select(Wo).on("touchmove"+n,y).on("dragstart"+n,y).on("selectstart"+n,y);if(xa){var r=Bo.style,u=r[xa];r[xa]="none"}return function(i){function o(){e.on(t,null)}e.on(n,null),xa&&(r[xa]=u),i&&(e.on(t,function(){y(),o()},!0),setTimeout(o,0))}}function Z(n,t){t.changedTouches&&(t=t.changedTouches[0]);var e=n.ownerSVGElement||n;if(e.createSVGPoint){var r=e.createSVGPoint();if(0>_a&&(Wo.scrollX||Wo.scrollY)){e=Zo.select("body").append("svg").style({position:"absolute",top:0,left:0,margin:0,padding:0,border:"none"},"important");var u=e[0][0].getScreenCTM();_a=!(u.f||u.e),e.remove()}return _a?(r.x=t.pageX,r.y=t.pageY):(r.x=t.clientX,r.y=t.clientY),r=r.matrixTransform(n.getScreenCTM().inverse()),[r.x,r.y]}var i=n.getBoundingClientRect();return[t.clientX-i.left-n.clientLeft,t.clientY-i.top-n.clientTop]}function V(){return Zo.event.changedTouches[0].identifier}function X(){return Zo.event.target}function $(){return Wo}function B(n){return n>0?1:0>n?-1:0}function W(n,t,e){return(t[0]-n[0])*(e[1]-n[1])-(t[1]-n[1])*(e[0]-n[0])}function J(n){return n>1?0:-1>n?ba:Math.acos(n)}function G(n){return n>1?Sa:-1>n?-Sa:Math.asin(n)}function K(n){return((n=Math.exp(n))-1/n)/2}function Q(n){return((n=Math.exp(n))+1/n)/2}function nt(n){return((n=Math.exp(2*n))-1)/(n+1)}function tt(n){return(n=Math.sin(n/2))*n}function et(){}function rt(n,t,e){return this instanceof rt?(this.h=+n,this.s=+t,void(this.l=+e)):arguments.length<2?n instanceof rt?new rt(n.h,n.s,n.l):mt(""+n,yt,rt):new rt(n,t,e)}function ut(n,t,e){function r(n){return n>360?n-=360:0>n&&(n+=360),60>n?i+(o-i)*n/60:180>n?o:240>n?i+(o-i)*(240-n)/60:i}function u(n){return Math.round(255*r(n))}var i,o;return n=isNaN(n)?0:(n%=360)<0?n+360:n,t=isNaN(t)?0:0>t?0:t>1?1:t,e=0>e?0:e>1?1:e,o=.5>=e?e*(1+t):e+t-e*t,i=2*e-o,new gt(u(n+120),u(n),u(n-120))}function it(n,t,e){return this instanceof it?(this.h=+n,this.c=+t,void(this.l=+e)):arguments.length<2?n instanceof it?new it(n.h,n.c,n.l):n instanceof at?st(n.l,n.a,n.b):st((n=xt((n=Zo.rgb(n)).r,n.g,n.b)).l,n.a,n.b):new it(n,t,e)}function ot(n,t,e){return isNaN(n)&&(n=0),isNaN(t)&&(t=0),new at(e,Math.cos(n*=Aa)*t,Math.sin(n)*t)}function at(n,t,e){return this instanceof at?(this.l=+n,this.a=+t,void(this.b=+e)):arguments.length<2?n instanceof at?new at(n.l,n.a,n.b):n instanceof it?ot(n.l,n.c,n.h):xt((n=gt(n)).r,n.g,n.b):new at(n,t,e)}function ct(n,t,e){var r=(n+16)/116,u=r+t/500,i=r-e/200;return u=lt(u)*ja,r=lt(r)*Ha,i=lt(i)*Fa,new gt(ht(3.2404542*u-1.5371385*r-.4985314*i),ht(-.969266*u+1.8760108*r+.041556*i),ht(.0556434*u-.2040259*r+1.0572252*i))}function st(n,t,e){return n>0?new it(Math.atan2(e,t)*Ca,Math.sqrt(t*t+e*e),n):new it(0/0,0/0,n)}function lt(n){return n>.206893034?n*n*n:(n-4/29)/7.787037}function ft(n){return n>.008856?Math.pow(n,1/3):7.787037*n+4/29}function ht(n){return Math.round(255*(.00304>=n?12.92*n:1.055*Math.pow(n,1/2.4)-.055))}function gt(n,t,e){return this instanceof gt?(this.r=~~n,this.g=~~t,void(this.b=~~e)):arguments.length<2?n instanceof gt?new gt(n.r,n.g,n.b):mt(""+n,gt,ut):new gt(n,t,e)}function pt(n){return new gt(n>>16,255&n>>8,255&n)}function vt(n){return pt(n)+""}function dt(n){return 16>n?"0"+Math.max(0,n).toString(16):Math.min(255,n).toString(16)}function mt(n,t,e){var r,u,i,o=0,a=0,c=0;if(r=/([a-z]+)\((.*)\)/i.exec(n))switch(u=r[2].split(","),r[1]){case"hsl":return e(parseFloat(u[0]),parseFloat(u[1])/100,parseFloat(u[2])/100);case"rgb":return t(_t(u[0]),_t(u[1]),_t(u[2]))}return(i=Ia.get(n))?t(i.r,i.g,i.b):(null==n||"#"!==n.charAt(0)||isNaN(i=parseInt(n.substring(1),16))||(4===n.length?(o=(3840&i)>>4,o=o>>4|o,a=240&i,a=a>>4|a,c=15&i,c=c<<4|c):7===n.length&&(o=(16711680&i)>>16,a=(65280&i)>>8,c=255&i)),t(o,a,c))}function yt(n,t,e){var r,u,i=Math.min(n/=255,t/=255,e/=255),o=Math.max(n,t,e),a=o-i,c=(o+i)/2;return a?(u=.5>c?a/(o+i):a/(2-o-i),r=n==o?(t-e)/a+(e>t?6:0):t==o?(e-n)/a+2:(n-t)/a+4,r*=60):(r=0/0,u=c>0&&1>c?0:r),new rt(r,u,c)}function xt(n,t,e){n=Mt(n),t=Mt(t),e=Mt(e);var r=ft((.4124564*n+.3575761*t+.1804375*e)/ja),u=ft((.2126729*n+.7151522*t+.072175*e)/Ha),i=ft((.0193339*n+.119192*t+.9503041*e)/Fa);return at(116*u-16,500*(r-u),200*(u-i))}function Mt(n){return(n/=255)<=.04045?n/12.92:Math.pow((n+.055)/1.055,2.4)}function _t(n){var t=parseFloat(n);return"%"===n.charAt(n.length-1)?Math.round(2.55*t):t}function bt(n){return"function"==typeof n?n:function(){return n}}function wt(n){return n}function St(n){return function(t,e,r){return 2===arguments.length&&"function"==typeof e&&(r=e,e=null),kt(t,e,n,r)}}function kt(n,t,e,r){function u(){var n,t=c.status;if(!t&&c.responseText||t>=200&&300>t||304===t){try{n=e.call(i,c)}catch(r){return o.error.call(i,r),void 0}o.load.call(i,n)}else o.error.call(i,c)}var i={},o=Zo.dispatch("beforesend","progress","load","error"),a={},c=new XMLHttpRequest,s=null;return!Wo.XDomainRequest||"withCredentials"in c||!/^(http(s)?:)?\/\//.test(n)||(c=new XDomainRequest),"onload"in c?c.onload=c.onerror=u:c.onreadystatechange=function(){c.readyState>3&&u()},c.onprogress=function(n){var t=Zo.event;Zo.event=n;try{o.progress.call(i,c)}finally{Zo.event=t}},i.header=function(n,t){return n=(n+"").toLowerCase(),arguments.length<2?a[n]:(null==t?delete a[n]:a[n]=t+"",i)},i.mimeType=function(n){return arguments.length?(t=null==n?null:n+"",i):t},i.responseType=function(n){return arguments.length?(s=n,i):s},i.response=function(n){return e=n,i},["get","post"].forEach(function(n){i[n]=function(){return i.send.apply(i,[n].concat(Xo(arguments)))}}),i.send=function(e,r,u){if(2===arguments.length&&"function"==typeof r&&(u=r,r=null),c.open(e,n,!0),null==t||"accept"in a||(a.accept=t+",*/*"),c.setRequestHeader)for(var l in a)c.setRequestHeader(l,a[l]);return null!=t&&c.overrideMimeType&&c.overrideMimeType(t),null!=s&&(c.responseType=s),null!=u&&i.on("error",u).on("load",function(n){u(null,n)}),o.beforesend.call(i,c),c.send(null==r?null:r),i},i.abort=function(){return c.abort(),i},Zo.rebind(i,o,"on"),null==r?i:i.get(Et(r))}function Et(n){return 1===n.length?function(t,e){n(null==t?e:null)}:n}function At(){var n=Ct(),t=Nt()-n;t>24?(isFinite(t)&&(clearTimeout($a),$a=setTimeout(At,t)),Xa=0):(Xa=1,Wa(At))}function Ct(){var n=Date.now();for(Ba=Za;Ba;)n>=Ba.t&&(Ba.f=Ba.c(n-Ba.t)),Ba=Ba.n;return n}function Nt(){for(var n,t=Za,e=1/0;t;)t.f?t=n?n.n=t.n:Za=t.n:(t.t8?function(n){return n/e}:function(n){return n*e},symbol:n}}function Tt(n){var t=n.decimal,e=n.thousands,r=n.grouping,u=n.currency,i=r?function(n){for(var t=n.length,u=[],i=0,o=r[0];t>0&&o>0;)u.push(n.substring(t-=o,t+o)),o=r[i=(i+1)%r.length];return u.reverse().join(e)}:wt;return function(n){var e=Ga.exec(n),r=e[1]||" ",o=e[2]||">",a=e[3]||"",c=e[4]||"",s=e[5],l=+e[6],f=e[7],h=e[8],g=e[9],p=1,v="",d="",m=!1;switch(h&&(h=+h.substring(1)),(s||"0"===r&&"="===o)&&(s=r="0",o="=",f&&(l-=Math.floor((l-1)/4))),g){case"n":f=!0,g="g";break;case"%":p=100,d="%",g="f";break;case"p":p=100,d="%",g="r";break;case"b":case"o":case"x":case"X":"#"===c&&(v="0"+g.toLowerCase());case"c":case"d":m=!0,h=0;break;case"s":p=-1,g="r"}"$"===c&&(v=u[0],d=u[1]),"r"!=g||h||(g="g"),null!=h&&("g"==g?h=Math.max(1,Math.min(21,h)):("e"==g||"f"==g)&&(h=Math.max(0,Math.min(20,h)))),g=Ka.get(g)||qt;var y=s&&f;return function(n){var e=d;if(m&&n%1)return"";var u=0>n||0===n&&0>1/n?(n=-n,"-"):a;if(0>p){var c=Zo.formatPrefix(n,h);n=c.scale(n),e=c.symbol+d}else n*=p;n=g(n,h);var x=n.lastIndexOf("."),M=0>x?n:n.substring(0,x),_=0>x?"":t+n.substring(x+1);!s&&f&&(M=i(M));var b=v.length+M.length+_.length+(y?0:u.length),w=l>b?new Array(b=l-b+1).join(r):"";return y&&(M=i(w+M)),u+=v,n=M+_,("<"===o?u+n+w:">"===o?w+u+n:"^"===o?w.substring(0,b>>=1)+u+n+w.substring(b):u+(y?n:w+n))+e}}}function qt(n){return n+""}function Rt(){this._=new Date(arguments.length>1?Date.UTC.apply(this,arguments):arguments[0])}function Dt(n,t,e){function r(t){var e=n(t),r=i(e,1);return r-t>t-e?e:r}function u(e){return t(e=n(new nc(e-1)),1),e}function i(n,e){return t(n=new nc(+n),e),n}function o(n,r,i){var o=u(n),a=[];if(i>1)for(;r>o;)e(o)%i||a.push(new Date(+o)),t(o,1);else for(;r>o;)a.push(new Date(+o)),t(o,1);return a}function a(n,t,e){try{nc=Rt;var r=new Rt;return r._=n,o(r,t,e)}finally{nc=Date}}n.floor=n,n.round=r,n.ceil=u,n.offset=i,n.range=o;var c=n.utc=Pt(n);return c.floor=c,c.round=Pt(r),c.ceil=Pt(u),c.offset=Pt(i),c.range=a,n}function Pt(n){return function(t,e){try{nc=Rt;var r=new Rt;return r._=t,n(r,e)._}finally{nc=Date}}}function Ut(n){function t(n){function t(t){for(var e,u,i,o=[],a=-1,c=0;++aa;){if(r>=s)return-1;if(u=t.charCodeAt(a++),37===u){if(o=t.charAt(a++),i=N[o in ec?t.charAt(a++):o],!i||(r=i(n,e,r))<0)return-1}else if(u!=e.charCodeAt(r++))return-1}return r}function r(n,t,e){b.lastIndex=0;var r=b.exec(t.substring(e));return r?(n.w=w.get(r[0].toLowerCase()),e+r[0].length):-1}function u(n,t,e){M.lastIndex=0;var r=M.exec(t.substring(e));return r?(n.w=_.get(r[0].toLowerCase()),e+r[0].length):-1}function i(n,t,e){E.lastIndex=0;var r=E.exec(t.substring(e));return r?(n.m=A.get(r[0].toLowerCase()),e+r[0].length):-1}function o(n,t,e){S.lastIndex=0;var r=S.exec(t.substring(e));return r?(n.m=k.get(r[0].toLowerCase()),e+r[0].length):-1}function a(n,t,r){return e(n,C.c.toString(),t,r)}function c(n,t,r){return e(n,C.x.toString(),t,r)}function s(n,t,r){return e(n,C.X.toString(),t,r)}function l(n,t,e){var r=x.get(t.substring(e,e+=2).toLowerCase());return null==r?-1:(n.p=r,e)}var f=n.dateTime,h=n.date,g=n.time,p=n.periods,v=n.days,d=n.shortDays,m=n.months,y=n.shortMonths;t.utc=function(n){function e(n){try{nc=Rt;var t=new nc;return t._=n,r(t)}finally{nc=Date}}var r=t(n);return e.parse=function(n){try{nc=Rt;var t=r.parse(n);return t&&t._}finally{nc=Date}},e.toString=r.toString,e},t.multi=t.utc.multi=re;var x=Zo.map(),M=Ht(v),_=Ft(v),b=Ht(d),w=Ft(d),S=Ht(m),k=Ft(m),E=Ht(y),A=Ft(y);p.forEach(function(n,t){x.set(n.toLowerCase(),t)});var C={a:function(n){return d[n.getDay()]},A:function(n){return v[n.getDay()]},b:function(n){return y[n.getMonth()]},B:function(n){return m[n.getMonth()]},c:t(f),d:function(n,t){return jt(n.getDate(),t,2)},e:function(n,t){return jt(n.getDate(),t,2)},H:function(n,t){return jt(n.getHours(),t,2)},I:function(n,t){return jt(n.getHours()%12||12,t,2)},j:function(n,t){return jt(1+Qa.dayOfYear(n),t,3)},L:function(n,t){return jt(n.getMilliseconds(),t,3)},m:function(n,t){return jt(n.getMonth()+1,t,2)},M:function(n,t){return jt(n.getMinutes(),t,2)},p:function(n){return p[+(n.getHours()>=12)]},S:function(n,t){return jt(n.getSeconds(),t,2)},U:function(n,t){return jt(Qa.sundayOfYear(n),t,2)},w:function(n){return n.getDay()},W:function(n,t){return jt(Qa.mondayOfYear(n),t,2)},x:t(h),X:t(g),y:function(n,t){return jt(n.getFullYear()%100,t,2)},Y:function(n,t){return jt(n.getFullYear()%1e4,t,4)},Z:te,"%":function(){return"%"}},N={a:r,A:u,b:i,B:o,c:a,d:Wt,e:Wt,H:Gt,I:Gt,j:Jt,L:ne,m:Bt,M:Kt,p:l,S:Qt,U:Yt,w:Ot,W:It,x:c,X:s,y:Vt,Y:Zt,Z:Xt,"%":ee};return t}function jt(n,t,e){var r=0>n?"-":"",u=(r?-n:n)+"",i=u.length;return r+(e>i?new Array(e-i+1).join(t)+u:u)}function Ht(n){return new RegExp("^(?:"+n.map(Zo.requote).join("|")+")","i")}function Ft(n){for(var t=new o,e=-1,r=n.length;++e68?1900:2e3)}function Bt(n,t,e){rc.lastIndex=0;var r=rc.exec(t.substring(e,e+2));return r?(n.m=r[0]-1,e+r[0].length):-1}function Wt(n,t,e){rc.lastIndex=0;var r=rc.exec(t.substring(e,e+2));return r?(n.d=+r[0],e+r[0].length):-1}function Jt(n,t,e){rc.lastIndex=0;var r=rc.exec(t.substring(e,e+3));return r?(n.j=+r[0],e+r[0].length):-1}function Gt(n,t,e){rc.lastIndex=0;var r=rc.exec(t.substring(e,e+2));return r?(n.H=+r[0],e+r[0].length):-1}function Kt(n,t,e){rc.lastIndex=0;var r=rc.exec(t.substring(e,e+2));return r?(n.M=+r[0],e+r[0].length):-1}function Qt(n,t,e){rc.lastIndex=0;var r=rc.exec(t.substring(e,e+2));return r?(n.S=+r[0],e+r[0].length):-1}function ne(n,t,e){rc.lastIndex=0;var r=rc.exec(t.substring(e,e+3));return r?(n.L=+r[0],e+r[0].length):-1}function te(n){var t=n.getTimezoneOffset(),e=t>0?"-":"+",r=~~(ua(t)/60),u=ua(t)%60;return e+jt(r,"0",2)+jt(u,"0",2)}function ee(n,t,e){uc.lastIndex=0;var r=uc.exec(t.substring(e,e+1));return r?e+r[0].length:-1}function re(n){for(var t=n.length,e=-1;++e=0?1:-1,a=o*e,c=Math.cos(t),s=Math.sin(t),l=i*s,f=u*c+l*Math.cos(a),h=l*o*Math.sin(a);lc.add(Math.atan2(h,f)),r=n,u=c,i=s}var t,e,r,u,i;fc.point=function(o,a){fc.point=n,r=(t=o)*Aa,u=Math.cos(a=(e=a)*Aa/2+ba/4),i=Math.sin(a)},fc.lineEnd=function(){n(t,e)}}function le(n){var t=n[0],e=n[1],r=Math.cos(e);return[r*Math.cos(t),r*Math.sin(t),Math.sin(e)]}function fe(n,t){return n[0]*t[0]+n[1]*t[1]+n[2]*t[2]}function he(n,t){return[n[1]*t[2]-n[2]*t[1],n[2]*t[0]-n[0]*t[2],n[0]*t[1]-n[1]*t[0]]}function ge(n,t){n[0]+=t[0],n[1]+=t[1],n[2]+=t[2]}function pe(n,t){return[n[0]*t,n[1]*t,n[2]*t]}function ve(n){var t=Math.sqrt(n[0]*n[0]+n[1]*n[1]+n[2]*n[2]);n[0]/=t,n[1]/=t,n[2]/=t}function de(n){return[Math.atan2(n[1],n[0]),G(n[2])]}function me(n,t){return ua(n[0]-t[0])a;++a)u.point((e=n[a])[0],e[1]);return u.lineEnd(),void 0}var c=new Ee(e,n,null,!0),s=new Ee(e,null,c,!1);c.o=s,i.push(c),o.push(s),c=new Ee(r,n,null,!1),s=new Ee(r,null,c,!0),c.o=s,i.push(c),o.push(s)}}),o.sort(t),ke(i),ke(o),i.length){for(var a=0,c=e,s=o.length;s>a;++a)o[a].e=c=!c;for(var l,f,h=i[0];;){for(var g=h,p=!0;g.v;)if((g=g.n)===h)return;l=g.z,u.lineStart();do{if(g.v=g.o.v=!0,g.e){if(p)for(var a=0,s=l.length;s>a;++a)u.point((f=l[a])[0],f[1]);else r(g.x,g.n.x,1,u);g=g.n}else{if(p){l=g.p.z;for(var a=l.length-1;a>=0;--a)u.point((f=l[a])[0],f[1])}else r(g.x,g.p.x,-1,u);g=g.p}g=g.o,l=g.z,p=!p}while(!g.v);u.lineEnd()}}}function ke(n){if(t=n.length){for(var t,e,r=0,u=n[0];++r0){for(_||(i.polygonStart(),_=!0),i.lineStart();++o1&&2&t&&e.push(e.pop().concat(e.shift())),g.push(e.filter(Ce))}var g,p,v,d=t(i),m=u.invert(r[0],r[1]),y={point:o,lineStart:c,lineEnd:s,polygonStart:function(){y.point=l,y.lineStart=f,y.lineEnd=h,g=[],p=[]},polygonEnd:function(){y.point=o,y.lineStart=c,y.lineEnd=s,g=Zo.merge(g);var n=Le(m,p);g.length?(_||(i.polygonStart(),_=!0),Se(g,ze,n,e,i)):n&&(_||(i.polygonStart(),_=!0),i.lineStart(),e(null,null,1,i),i.lineEnd()),_&&(i.polygonEnd(),_=!1),g=p=null},sphere:function(){i.polygonStart(),i.lineStart(),e(null,null,1,i),i.lineEnd(),i.polygonEnd()}},x=Ne(),M=t(x),_=!1;return y}}function Ce(n){return n.length>1}function Ne(){var n,t=[];return{lineStart:function(){t.push(n=[])},point:function(t,e){n.push([t,e])},lineEnd:v,buffer:function(){var e=t;return t=[],n=null,e},rejoin:function(){t.length>1&&t.push(t.pop().concat(t.shift()))}}}function ze(n,t){return((n=n.x)[0]<0?n[1]-Sa-ka:Sa-n[1])-((t=t.x)[0]<0?t[1]-Sa-ka:Sa-t[1])}function Le(n,t){var e=n[0],r=n[1],u=[Math.sin(e),-Math.cos(e),0],i=0,o=0;lc.reset();for(var a=0,c=t.length;c>a;++a){var s=t[a],l=s.length;if(l)for(var f=s[0],h=f[0],g=f[1]/2+ba/4,p=Math.sin(g),v=Math.cos(g),d=1;;){d===l&&(d=0),n=s[d];var m=n[0],y=n[1]/2+ba/4,x=Math.sin(y),M=Math.cos(y),_=m-h,b=_>=0?1:-1,w=b*_,S=w>ba,k=p*x;if(lc.add(Math.atan2(k*b*Math.sin(w),v*M+k*Math.cos(w))),i+=S?_+b*wa:_,S^h>=e^m>=e){var E=he(le(f),le(n));ve(E);var A=he(u,E);ve(A);var C=(S^_>=0?-1:1)*G(A[2]);(r>C||r===C&&(E[0]||E[1]))&&(o+=S^_>=0?1:-1)}if(!d++)break;h=m,p=x,v=M,f=n}}return(-ka>i||ka>i&&0>lc)^1&o}function Te(n){var t,e=0/0,r=0/0,u=0/0;return{lineStart:function(){n.lineStart(),t=1},point:function(i,o){var a=i>0?ba:-ba,c=ua(i-e);ua(c-ba)0?Sa:-Sa),n.point(u,r),n.lineEnd(),n.lineStart(),n.point(a,r),n.point(i,r),t=0):u!==a&&c>=ba&&(ua(e-u)ka?Math.atan((Math.sin(t)*(i=Math.cos(r))*Math.sin(e)-Math.sin(r)*(u=Math.cos(t))*Math.sin(n))/(u*i*o)):(t+r)/2}function Re(n,t,e,r){var u;if(null==n)u=e*Sa,r.point(-ba,u),r.point(0,u),r.point(ba,u),r.point(ba,0),r.point(ba,-u),r.point(0,-u),r.point(-ba,-u),r.point(-ba,0),r.point(-ba,u);else if(ua(n[0]-t[0])>ka){var i=n[0]i}function e(n){var e,i,c,s,l;return{lineStart:function(){s=c=!1,l=1},point:function(f,h){var g,p=[f,h],v=t(f,h),d=o?v?0:u(f,h):v?u(f+(0>f?ba:-ba),h):0;if(!e&&(s=c=v)&&n.lineStart(),v!==c&&(g=r(e,p),(me(e,g)||me(p,g))&&(p[0]+=ka,p[1]+=ka,v=t(p[0],p[1]))),v!==c)l=0,v?(n.lineStart(),g=r(p,e),n.point(g[0],g[1])):(g=r(e,p),n.point(g[0],g[1]),n.lineEnd()),e=g;else if(a&&e&&o^v){var m;d&i||!(m=r(p,e,!0))||(l=0,o?(n.lineStart(),n.point(m[0][0],m[0][1]),n.point(m[1][0],m[1][1]),n.lineEnd()):(n.point(m[1][0],m[1][1]),n.lineEnd(),n.lineStart(),n.point(m[0][0],m[0][1])))}!v||e&&me(e,p)||n.point(p[0],p[1]),e=p,c=v,i=d},lineEnd:function(){c&&n.lineEnd(),e=null},clean:function(){return l|(s&&c)<<1}}}function r(n,t,e){var r=le(n),u=le(t),o=[1,0,0],a=he(r,u),c=fe(a,a),s=a[0],l=c-s*s;if(!l)return!e&&n;var f=i*c/l,h=-i*s/l,g=he(o,a),p=pe(o,f),v=pe(a,h);ge(p,v);var d=g,m=fe(p,d),y=fe(d,d),x=m*m-y*(fe(p,p)-1);if(!(0>x)){var M=Math.sqrt(x),_=pe(d,(-m-M)/y);if(ge(_,p),_=de(_),!e)return _;var b,w=n[0],S=t[0],k=n[1],E=t[1];w>S&&(b=w,w=S,S=b);var A=S-w,C=ua(A-ba)A;if(!C&&k>E&&(b=k,k=E,E=b),N?C?k+E>0^_[1]<(ua(_[0]-w)ba^(w<=_[0]&&_[0]<=S)){var z=pe(d,(-m+M)/y);return ge(z,p),[_,de(z)]}}}function u(t,e){var r=o?n:ba-n,u=0;return-r>t?u|=1:t>r&&(u|=2),-r>e?u|=4:e>r&&(u|=8),u}var i=Math.cos(n),o=i>0,a=ua(i)>ka,c=sr(n,6*Aa);return Ae(t,e,c,o?[0,-n]:[-ba,n-ba])}function Pe(n,t,e,r){return function(u){var i,o=u.a,a=u.b,c=o.x,s=o.y,l=a.x,f=a.y,h=0,g=1,p=l-c,v=f-s;if(i=n-c,p||!(i>0)){if(i/=p,0>p){if(h>i)return;g>i&&(g=i)}else if(p>0){if(i>g)return;i>h&&(h=i)}if(i=e-c,p||!(0>i)){if(i/=p,0>p){if(i>g)return;i>h&&(h=i)}else if(p>0){if(h>i)return;g>i&&(g=i)}if(i=t-s,v||!(i>0)){if(i/=v,0>v){if(h>i)return;g>i&&(g=i)}else if(v>0){if(i>g)return;i>h&&(h=i)}if(i=r-s,v||!(0>i)){if(i/=v,0>v){if(i>g)return;i>h&&(h=i)}else if(v>0){if(h>i)return;g>i&&(g=i)}return h>0&&(u.a={x:c+h*p,y:s+h*v}),1>g&&(u.b={x:c+g*p,y:s+g*v}),u}}}}}}function Ue(n,t,e,r){function u(r,u){return ua(r[0]-n)0?0:3:ua(r[0]-e)0?2:1:ua(r[1]-t)0?1:0:u>0?3:2}function i(n,t){return o(n.x,t.x)}function o(n,t){var e=u(n,1),r=u(t,1);return e!==r?e-r:0===e?t[1]-n[1]:1===e?n[0]-t[0]:2===e?n[1]-t[1]:t[0]-n[0]}return function(a){function c(n){for(var t=0,e=d.length,r=n[1],u=0;e>u;++u)for(var i,o=1,a=d[u],c=a.length,s=a[0];c>o;++o)i=a[o],s[1]<=r?i[1]>r&&W(s,i,n)>0&&++t:i[1]<=r&&W(s,i,n)<0&&--t,s=i;return 0!==t}function s(i,a,c,s){var l=0,f=0;if(null==i||(l=u(i,c))!==(f=u(a,c))||o(i,a)<0^c>0){do s.point(0===l||3===l?n:e,l>1?r:t);while((l=(l+c+4)%4)!==f)}else s.point(a[0],a[1])}function l(u,i){return u>=n&&e>=u&&i>=t&&r>=i}function f(n,t){l(n,t)&&a.point(n,t)}function h(){N.point=p,d&&d.push(m=[]),S=!0,w=!1,_=b=0/0}function g(){v&&(p(y,x),M&&w&&A.rejoin(),v.push(A.buffer())),N.point=f,w&&a.lineEnd()}function p(n,t){n=Math.max(-kc,Math.min(kc,n)),t=Math.max(-kc,Math.min(kc,t));var e=l(n,t);if(d&&m.push([n,t]),S)y=n,x=t,M=e,S=!1,e&&(a.lineStart(),a.point(n,t));else if(e&&w)a.point(n,t);else{var r={a:{x:_,y:b},b:{x:n,y:t}};C(r)?(w||(a.lineStart(),a.point(r.a.x,r.a.y)),a.point(r.b.x,r.b.y),e||a.lineEnd(),k=!1):e&&(a.lineStart(),a.point(n,t),k=!1)}_=n,b=t,w=e}var v,d,m,y,x,M,_,b,w,S,k,E=a,A=Ne(),C=Pe(n,t,e,r),N={point:f,lineStart:h,lineEnd:g,polygonStart:function(){a=A,v=[],d=[],k=!0},polygonEnd:function(){a=E,v=Zo.merge(v);var t=c([n,r]),e=k&&t,u=v.length;(e||u)&&(a.polygonStart(),e&&(a.lineStart(),s(null,null,1,a),a.lineEnd()),u&&Se(v,i,t,s,a),a.polygonEnd()),v=d=m=null}};return N}}function je(n,t){function e(e,r){return e=n(e,r),t(e[0],e[1])}return n.invert&&t.invert&&(e.invert=function(e,r){return e=t.invert(e,r),e&&n.invert(e[0],e[1])}),e}function He(n){var t=0,e=ba/3,r=tr(n),u=r(t,e);return u.parallels=function(n){return arguments.length?r(t=n[0]*ba/180,e=n[1]*ba/180):[180*(t/ba),180*(e/ba)]},u}function Fe(n,t){function e(n,t){var e=Math.sqrt(i-2*u*Math.sin(t))/u;return[e*Math.sin(n*=u),o-e*Math.cos(n)]}var r=Math.sin(n),u=(r+Math.sin(t))/2,i=1+r*(2*u-r),o=Math.sqrt(i)/u;return e.invert=function(n,t){var e=o-t;return[Math.atan2(n,e)/u,G((i-(n*n+e*e)*u*u)/(2*u))]},e}function Oe(){function n(n,t){Ac+=u*n-r*t,r=n,u=t}var t,e,r,u;Tc.point=function(i,o){Tc.point=n,t=r=i,e=u=o},Tc.lineEnd=function(){n(t,e)}}function Ye(n,t){Cc>n&&(Cc=n),n>zc&&(zc=n),Nc>t&&(Nc=t),t>Lc&&(Lc=t)}function Ie(){function n(n,t){o.push("M",n,",",t,i)}function t(n,t){o.push("M",n,",",t),a.point=e}function e(n,t){o.push("L",n,",",t)}function r(){a.point=n}function u(){o.push("Z")}var i=Ze(4.5),o=[],a={point:n,lineStart:function(){a.point=t},lineEnd:r,polygonStart:function(){a.lineEnd=u},polygonEnd:function(){a.lineEnd=r,a.point=n},pointRadius:function(n){return i=Ze(n),a},result:function(){if(o.length){var n=o.join("");return o=[],n}}};return a}function Ze(n){return"m0,"+n+"a"+n+","+n+" 0 1,1 0,"+-2*n+"a"+n+","+n+" 0 1,1 0,"+2*n+"z"}function Ve(n,t){pc+=n,vc+=t,++dc}function Xe(){function n(n,r){var u=n-t,i=r-e,o=Math.sqrt(u*u+i*i);mc+=o*(t+n)/2,yc+=o*(e+r)/2,xc+=o,Ve(t=n,e=r)}var t,e;Rc.point=function(r,u){Rc.point=n,Ve(t=r,e=u)}}function $e(){Rc.point=Ve}function Be(){function n(n,t){var e=n-r,i=t-u,o=Math.sqrt(e*e+i*i);mc+=o*(r+n)/2,yc+=o*(u+t)/2,xc+=o,o=u*n-r*t,Mc+=o*(r+n),_c+=o*(u+t),bc+=3*o,Ve(r=n,u=t)}var t,e,r,u;Rc.point=function(i,o){Rc.point=n,Ve(t=r=i,e=u=o)},Rc.lineEnd=function(){n(t,e)}}function We(n){function t(t,e){n.moveTo(t,e),n.arc(t,e,o,0,wa)}function e(t,e){n.moveTo(t,e),a.point=r}function r(t,e){n.lineTo(t,e)}function u(){a.point=t}function i(){n.closePath()}var o=4.5,a={point:t,lineStart:function(){a.point=e},lineEnd:u,polygonStart:function(){a.lineEnd=i},polygonEnd:function(){a.lineEnd=u,a.point=t},pointRadius:function(n){return o=n,a},result:v};return a}function Je(n){function t(n){return(a?r:e)(n)}function e(t){return Qe(t,function(e,r){e=n(e,r),t.point(e[0],e[1])})}function r(t){function e(e,r){e=n(e,r),t.point(e[0],e[1])}function r(){x=0/0,S.point=i,t.lineStart()}function i(e,r){var i=le([e,r]),o=n(e,r);u(x,M,y,_,b,w,x=o[0],M=o[1],y=e,_=i[0],b=i[1],w=i[2],a,t),t.point(x,M)}function o(){S.point=e,t.lineEnd()}function c(){r(),S.point=s,S.lineEnd=l}function s(n,t){i(f=n,h=t),g=x,p=M,v=_,d=b,m=w,S.point=i}function l(){u(x,M,y,_,b,w,g,p,f,v,d,m,a,t),S.lineEnd=o,o()}var f,h,g,p,v,d,m,y,x,M,_,b,w,S={point:e,lineStart:r,lineEnd:o,polygonStart:function(){t.polygonStart(),S.lineStart=c},polygonEnd:function(){t.polygonEnd(),S.lineStart=r}};return S}function u(t,e,r,a,c,s,l,f,h,g,p,v,d,m){var y=l-t,x=f-e,M=y*y+x*x;if(M>4*i&&d--){var _=a+g,b=c+p,w=s+v,S=Math.sqrt(_*_+b*b+w*w),k=Math.asin(w/=S),E=ua(ua(w)-1)i||ua((y*z+x*L)/M-.5)>.3||o>a*g+c*p+s*v)&&(u(t,e,r,a,c,s,C,N,E,_/=S,b/=S,w,d,m),m.point(C,N),u(C,N,E,_,b,w,l,f,h,g,p,v,d,m))}}var i=.5,o=Math.cos(30*Aa),a=16; +return t.precision=function(n){return arguments.length?(a=(i=n*n)>0&&16,t):Math.sqrt(i)},t}function Ge(n){var t=Je(function(t,e){return n([t*Ca,e*Ca])});return function(n){return er(t(n))}}function Ke(n){this.stream=n}function Qe(n,t){return{point:t,sphere:function(){n.sphere()},lineStart:function(){n.lineStart()},lineEnd:function(){n.lineEnd()},polygonStart:function(){n.polygonStart()},polygonEnd:function(){n.polygonEnd()}}}function nr(n){return tr(function(){return n})()}function tr(n){function t(n){return n=a(n[0]*Aa,n[1]*Aa),[n[0]*h+c,s-n[1]*h]}function e(n){return n=a.invert((n[0]-c)/h,(s-n[1])/h),n&&[n[0]*Ca,n[1]*Ca]}function r(){a=je(o=ir(m,y,x),i);var n=i(v,d);return c=g-n[0]*h,s=p+n[1]*h,u()}function u(){return l&&(l.valid=!1,l=null),t}var i,o,a,c,s,l,f=Je(function(n,t){return n=i(n,t),[n[0]*h+c,s-n[1]*h]}),h=150,g=480,p=250,v=0,d=0,m=0,y=0,x=0,M=Sc,_=wt,b=null,w=null;return t.stream=function(n){return l&&(l.valid=!1),l=er(M(o,f(_(n)))),l.valid=!0,l},t.clipAngle=function(n){return arguments.length?(M=null==n?(b=n,Sc):De((b=+n)*Aa),u()):b},t.clipExtent=function(n){return arguments.length?(w=n,_=n?Ue(n[0][0],n[0][1],n[1][0],n[1][1]):wt,u()):w},t.scale=function(n){return arguments.length?(h=+n,r()):h},t.translate=function(n){return arguments.length?(g=+n[0],p=+n[1],r()):[g,p]},t.center=function(n){return arguments.length?(v=n[0]%360*Aa,d=n[1]%360*Aa,r()):[v*Ca,d*Ca]},t.rotate=function(n){return arguments.length?(m=n[0]%360*Aa,y=n[1]%360*Aa,x=n.length>2?n[2]%360*Aa:0,r()):[m*Ca,y*Ca,x*Ca]},Zo.rebind(t,f,"precision"),function(){return i=n.apply(this,arguments),t.invert=i.invert&&e,r()}}function er(n){return Qe(n,function(t,e){n.point(t*Aa,e*Aa)})}function rr(n,t){return[n,t]}function ur(n,t){return[n>ba?n-wa:-ba>n?n+wa:n,t]}function ir(n,t,e){return n?t||e?je(ar(n),cr(t,e)):ar(n):t||e?cr(t,e):ur}function or(n){return function(t,e){return t+=n,[t>ba?t-wa:-ba>t?t+wa:t,e]}}function ar(n){var t=or(n);return t.invert=or(-n),t}function cr(n,t){function e(n,t){var e=Math.cos(t),a=Math.cos(n)*e,c=Math.sin(n)*e,s=Math.sin(t),l=s*r+a*u;return[Math.atan2(c*i-l*o,a*r-s*u),G(l*i+c*o)]}var r=Math.cos(n),u=Math.sin(n),i=Math.cos(t),o=Math.sin(t);return e.invert=function(n,t){var e=Math.cos(t),a=Math.cos(n)*e,c=Math.sin(n)*e,s=Math.sin(t),l=s*i-c*o;return[Math.atan2(c*i+s*o,a*r+l*u),G(l*r-a*u)]},e}function sr(n,t){var e=Math.cos(n),r=Math.sin(n);return function(u,i,o,a){var c=o*t;null!=u?(u=lr(e,u),i=lr(e,i),(o>0?i>u:u>i)&&(u+=o*wa)):(u=n+o*wa,i=n-.5*c);for(var s,l=u;o>0?l>i:i>l;l-=c)a.point((s=de([e,-r*Math.cos(l),-r*Math.sin(l)]))[0],s[1])}}function lr(n,t){var e=le(t);e[0]-=n,ve(e);var r=J(-e[1]);return((-e[2]<0?-r:r)+2*Math.PI-ka)%(2*Math.PI)}function fr(n,t,e){var r=Zo.range(n,t-ka,e).concat(t);return function(n){return r.map(function(t){return[n,t]})}}function hr(n,t,e){var r=Zo.range(n,t-ka,e).concat(t);return function(n){return r.map(function(t){return[t,n]})}}function gr(n){return n.source}function pr(n){return n.target}function vr(n,t,e,r){var u=Math.cos(t),i=Math.sin(t),o=Math.cos(r),a=Math.sin(r),c=u*Math.cos(n),s=u*Math.sin(n),l=o*Math.cos(e),f=o*Math.sin(e),h=2*Math.asin(Math.sqrt(tt(r-t)+u*o*tt(e-n))),g=1/Math.sin(h),p=h?function(n){var t=Math.sin(n*=h)*g,e=Math.sin(h-n)*g,r=e*c+t*l,u=e*s+t*f,o=e*i+t*a;return[Math.atan2(u,r)*Ca,Math.atan2(o,Math.sqrt(r*r+u*u))*Ca]}:function(){return[n*Ca,t*Ca]};return p.distance=h,p}function dr(){function n(n,u){var i=Math.sin(u*=Aa),o=Math.cos(u),a=ua((n*=Aa)-t),c=Math.cos(a);Dc+=Math.atan2(Math.sqrt((a=o*Math.sin(a))*a+(a=r*i-e*o*c)*a),e*i+r*o*c),t=n,e=i,r=o}var t,e,r;Pc.point=function(u,i){t=u*Aa,e=Math.sin(i*=Aa),r=Math.cos(i),Pc.point=n},Pc.lineEnd=function(){Pc.point=Pc.lineEnd=v}}function mr(n,t){function e(t,e){var r=Math.cos(t),u=Math.cos(e),i=n(r*u);return[i*u*Math.sin(t),i*Math.sin(e)]}return e.invert=function(n,e){var r=Math.sqrt(n*n+e*e),u=t(r),i=Math.sin(u),o=Math.cos(u);return[Math.atan2(n*i,r*o),Math.asin(r&&e*i/r)]},e}function yr(n,t){function e(n,t){o>0?-Sa+ka>t&&(t=-Sa+ka):t>Sa-ka&&(t=Sa-ka);var e=o/Math.pow(u(t),i);return[e*Math.sin(i*n),o-e*Math.cos(i*n)]}var r=Math.cos(n),u=function(n){return Math.tan(ba/4+n/2)},i=n===t?Math.sin(n):Math.log(r/Math.cos(t))/Math.log(u(t)/u(n)),o=r*Math.pow(u(n),i)/i;return i?(e.invert=function(n,t){var e=o-t,r=B(i)*Math.sqrt(n*n+e*e);return[Math.atan2(n,e)/i,2*Math.atan(Math.pow(o/r,1/i))-Sa]},e):Mr}function xr(n,t){function e(n,t){var e=i-t;return[e*Math.sin(u*n),i-e*Math.cos(u*n)]}var r=Math.cos(n),u=n===t?Math.sin(n):(r-Math.cos(t))/(t-n),i=r/u+n;return ua(u)u;u++){for(;r>1&&W(n[e[r-2]],n[e[r-1]],n[u])<=0;)--r;e[r++]=u}return e.slice(0,r)}function Er(n,t){return n[0]-t[0]||n[1]-t[1]}function Ar(n,t,e){return(e[0]-t[0])*(n[1]-t[1])<(e[1]-t[1])*(n[0]-t[0])}function Cr(n,t,e,r){var u=n[0],i=e[0],o=t[0]-u,a=r[0]-i,c=n[1],s=e[1],l=t[1]-c,f=r[1]-s,h=(a*(c-s)-f*(u-i))/(f*o-a*l);return[u+h*o,c+h*l]}function Nr(n){var t=n[0],e=n[n.length-1];return!(t[0]-e[0]||t[1]-e[1])}function zr(){Gr(this),this.edge=this.site=this.circle=null}function Lr(n){var t=Bc.pop()||new zr;return t.site=n,t}function Tr(n){Yr(n),Vc.remove(n),Bc.push(n),Gr(n)}function qr(n){var t=n.circle,e=t.x,r=t.cy,u={x:e,y:r},i=n.P,o=n.N,a=[n];Tr(n);for(var c=i;c.circle&&ua(e-c.circle.x)l;++l)s=a[l],c=a[l-1],Br(s.edge,c.site,s.site,u);c=a[0],s=a[f-1],s.edge=Xr(c.site,s.site,null,u),Or(c),Or(s)}function Rr(n){for(var t,e,r,u,i=n.x,o=n.y,a=Vc._;a;)if(r=Dr(a,o)-i,r>ka)a=a.L;else{if(u=i-Pr(a,o),!(u>ka)){r>-ka?(t=a.P,e=a):u>-ka?(t=a,e=a.N):t=e=a;break}if(!a.R){t=a;break}a=a.R}var c=Lr(n);if(Vc.insert(t,c),t||e){if(t===e)return Yr(t),e=Lr(t.site),Vc.insert(c,e),c.edge=e.edge=Xr(t.site,c.site),Or(t),Or(e),void 0;if(!e)return c.edge=Xr(t.site,c.site),void 0;Yr(t),Yr(e);var s=t.site,l=s.x,f=s.y,h=n.x-l,g=n.y-f,p=e.site,v=p.x-l,d=p.y-f,m=2*(h*d-g*v),y=h*h+g*g,x=v*v+d*d,M={x:(d*y-g*x)/m+l,y:(h*x-v*y)/m+f};Br(e.edge,s,p,M),c.edge=Xr(s,n,null,M),e.edge=Xr(n,p,null,M),Or(t),Or(e)}}function Dr(n,t){var e=n.site,r=e.x,u=e.y,i=u-t;if(!i)return r;var o=n.P;if(!o)return-1/0;e=o.site;var a=e.x,c=e.y,s=c-t;if(!s)return a;var l=a-r,f=1/i-1/s,h=l/s;return f?(-h+Math.sqrt(h*h-2*f*(l*l/(-2*s)-c+s/2+u-i/2)))/f+r:(r+a)/2}function Pr(n,t){var e=n.N;if(e)return Dr(e,t);var r=n.site;return r.y===t?r.x:1/0}function Ur(n){this.site=n,this.edges=[]}function jr(n){for(var t,e,r,u,i,o,a,c,s,l,f=n[0][0],h=n[1][0],g=n[0][1],p=n[1][1],v=Zc,d=v.length;d--;)if(i=v[d],i&&i.prepare())for(a=i.edges,c=a.length,o=0;c>o;)l=a[o].end(),r=l.x,u=l.y,s=a[++o%c].start(),t=s.x,e=s.y,(ua(r-t)>ka||ua(u-e)>ka)&&(a.splice(o,0,new Wr($r(i.site,l,ua(r-f)ka?{x:f,y:ua(t-f)ka?{x:ua(e-p)ka?{x:h,y:ua(t-h)ka?{x:ua(e-g)=-Ea)){var g=c*c+s*s,p=l*l+f*f,v=(f*g-s*p)/h,d=(c*p-l*g)/h,f=d+a,m=Wc.pop()||new Fr;m.arc=n,m.site=u,m.x=v+o,m.y=f+Math.sqrt(v*v+d*d),m.cy=f,n.circle=m;for(var y=null,x=$c._;x;)if(m.yd||d>=a)return;if(h>p){if(i){if(i.y>=s)return}else i={x:d,y:c};e={x:d,y:s}}else{if(i){if(i.yr||r>1)if(h>p){if(i){if(i.y>=s)return}else i={x:(c-u)/r,y:c};e={x:(s-u)/r,y:s}}else{if(i){if(i.yg){if(i){if(i.x>=a)return}else i={x:o,y:r*o+u};e={x:a,y:r*a+u}}else{if(i){if(i.xi&&(u=t.substring(i,u),a[o]?a[o]+=u:a[++o]=u),(e=e[0])===(r=r[0])?a[o]?a[o]+=r:a[++o]=r:(a[++o]=null,c.push({i:o,x:lu(e,r)})),i=Kc.lastIndex;return ir;++r)a[(e=c[r]).i]=e.x(n);return a.join("")})}function hu(n,t){for(var e,r=Zo.interpolators.length;--r>=0&&!(e=Zo.interpolators[r](n,t)););return e}function gu(n,t){var e,r=[],u=[],i=n.length,o=t.length,a=Math.min(n.length,t.length);for(e=0;a>e;++e)r.push(hu(n[e],t[e]));for(;i>e;++e)u[e]=n[e];for(;o>e;++e)u[e]=t[e];return function(n){for(e=0;a>e;++e)u[e]=r[e](n);return u}}function pu(n){return function(t){return 0>=t?0:t>=1?1:n(t)}}function vu(n){return function(t){return 1-n(1-t)}}function du(n){return function(t){return.5*(.5>t?n(2*t):2-n(2-2*t))}}function mu(n){return n*n}function yu(n){return n*n*n}function xu(n){if(0>=n)return 0;if(n>=1)return 1;var t=n*n,e=t*n;return 4*(.5>n?e:3*(n-t)+e-.75)}function Mu(n){return function(t){return Math.pow(t,n)}}function _u(n){return 1-Math.cos(n*Sa)}function bu(n){return Math.pow(2,10*(n-1))}function wu(n){return 1-Math.sqrt(1-n*n)}function Su(n,t){var e;return arguments.length<2&&(t=.45),arguments.length?e=t/wa*Math.asin(1/n):(n=1,e=t/4),function(r){return 1+n*Math.pow(2,-10*r)*Math.sin((r-e)*wa/t)}}function ku(n){return n||(n=1.70158),function(t){return t*t*((n+1)*t-n)}}function Eu(n){return 1/2.75>n?7.5625*n*n:2/2.75>n?7.5625*(n-=1.5/2.75)*n+.75:2.5/2.75>n?7.5625*(n-=2.25/2.75)*n+.9375:7.5625*(n-=2.625/2.75)*n+.984375}function Au(n,t){n=Zo.hcl(n),t=Zo.hcl(t);var e=n.h,r=n.c,u=n.l,i=t.h-e,o=t.c-r,a=t.l-u;return isNaN(o)&&(o=0,r=isNaN(r)?t.c:r),isNaN(i)?(i=0,e=isNaN(e)?t.h:e):i>180?i-=360:-180>i&&(i+=360),function(n){return ot(e+i*n,r+o*n,u+a*n)+""}}function Cu(n,t){n=Zo.hsl(n),t=Zo.hsl(t);var e=n.h,r=n.s,u=n.l,i=t.h-e,o=t.s-r,a=t.l-u;return isNaN(o)&&(o=0,r=isNaN(r)?t.s:r),isNaN(i)?(i=0,e=isNaN(e)?t.h:e):i>180?i-=360:-180>i&&(i+=360),function(n){return ut(e+i*n,r+o*n,u+a*n)+""}}function Nu(n,t){n=Zo.lab(n),t=Zo.lab(t);var e=n.l,r=n.a,u=n.b,i=t.l-e,o=t.a-r,a=t.b-u;return function(n){return ct(e+i*n,r+o*n,u+a*n)+""}}function zu(n,t){return t-=n,function(e){return Math.round(n+t*e)}}function Lu(n){var t=[n.a,n.b],e=[n.c,n.d],r=qu(t),u=Tu(t,e),i=qu(Ru(e,t,-u))||0;t[0]*e[1]180?l+=360:l-s>180&&(s+=360),u.push({i:r.push(r.pop()+"rotate(",null,")")-2,x:lu(s,l)})):l&&r.push(r.pop()+"rotate("+l+")"),f!=h?u.push({i:r.push(r.pop()+"skewX(",null,")")-2,x:lu(f,h)}):h&&r.push(r.pop()+"skewX("+h+")"),g[0]!=p[0]||g[1]!=p[1]?(e=r.push(r.pop()+"scale(",null,",",null,")"),u.push({i:e-4,x:lu(g[0],p[0])},{i:e-2,x:lu(g[1],p[1])})):(1!=p[0]||1!=p[1])&&r.push(r.pop()+"scale("+p+")"),e=u.length,function(n){for(var t,i=-1;++i=0;)e.push(u[r])}function Bu(n,t){for(var e=[n],r=[];null!=(n=e.pop());)if(r.push(n),(i=n.children)&&(u=i.length))for(var u,i,o=-1;++oe;++e)(t=n[e][1])>u&&(r=e,u=t);return r}function ii(n){return n.reduce(oi,0)}function oi(n,t){return n+t[1]}function ai(n,t){return ci(n,Math.ceil(Math.log(t.length)/Math.LN2+1))}function ci(n,t){for(var e=-1,r=+n[0],u=(n[1]-r)/t,i=[];++e<=t;)i[e]=u*e+r;return i}function si(n){return[Zo.min(n),Zo.max(n)]}function li(n,t){return n.value-t.value}function fi(n,t){var e=n._pack_next;n._pack_next=t,t._pack_prev=n,t._pack_next=e,e._pack_prev=t}function hi(n,t){n._pack_next=t,t._pack_prev=n}function gi(n,t){var e=t.x-n.x,r=t.y-n.y,u=n.r+t.r;return.999*u*u>e*e+r*r}function pi(n){function t(n){l=Math.min(n.x-n.r,l),f=Math.max(n.x+n.r,f),h=Math.min(n.y-n.r,h),g=Math.max(n.y+n.r,g)}if((e=n.children)&&(s=e.length)){var e,r,u,i,o,a,c,s,l=1/0,f=-1/0,h=1/0,g=-1/0;if(e.forEach(vi),r=e[0],r.x=-r.r,r.y=0,t(r),s>1&&(u=e[1],u.x=u.r,u.y=0,t(u),s>2))for(i=e[2],yi(r,u,i),t(i),fi(r,i),r._pack_prev=i,fi(i,u),u=r._pack_next,o=3;s>o;o++){yi(r,u,i=e[o]);var p=0,v=1,d=1;for(a=u._pack_next;a!==u;a=a._pack_next,v++)if(gi(a,i)){p=1;break}if(1==p)for(c=r._pack_prev;c!==a._pack_prev&&!gi(c,i);c=c._pack_prev,d++);p?(d>v||v==d&&u.ro;o++)i=e[o],i.x-=m,i.y-=y,x=Math.max(x,i.r+Math.sqrt(i.x*i.x+i.y*i.y));n.r=x,e.forEach(di)}}function vi(n){n._pack_next=n._pack_prev=n}function di(n){delete n._pack_next,delete n._pack_prev}function mi(n,t,e,r){var u=n.children;if(n.x=t+=r*n.x,n.y=e+=r*n.y,n.r*=r,u)for(var i=-1,o=u.length;++i=0;)t=u[i],t.z+=e,t.m+=e,e+=t.s+(r+=t.c)}function Si(n,t,e){return n.a.parent===t.parent?n.a:e}function ki(n){return 1+Zo.max(n,function(n){return n.y})}function Ei(n){return n.reduce(function(n,t){return n+t.x},0)/n.length}function Ai(n){var t=n.children;return t&&t.length?Ai(t[0]):n}function Ci(n){var t,e=n.children;return e&&(t=e.length)?Ci(e[t-1]):n}function Ni(n){return{x:n.x,y:n.y,dx:n.dx,dy:n.dy}}function zi(n,t){var e=n.x+t[3],r=n.y+t[0],u=n.dx-t[1]-t[3],i=n.dy-t[0]-t[2];return 0>u&&(e+=u/2,u=0),0>i&&(r+=i/2,i=0),{x:e,y:r,dx:u,dy:i}}function Li(n){var t=n[0],e=n[n.length-1];return e>t?[t,e]:[e,t]}function Ti(n){return n.rangeExtent?n.rangeExtent():Li(n.range())}function qi(n,t,e,r){var u=e(n[0],n[1]),i=r(t[0],t[1]);return function(n){return i(u(n))}}function Ri(n,t){var e,r=0,u=n.length-1,i=n[r],o=n[u];return i>o&&(e=r,r=u,u=e,e=i,i=o,o=e),n[r]=t.floor(i),n[u]=t.ceil(o),n}function Di(n){return n?{floor:function(t){return Math.floor(t/n)*n},ceil:function(t){return Math.ceil(t/n)*n}}:ss}function Pi(n,t,e,r){var u=[],i=[],o=0,a=Math.min(n.length,t.length)-1;for(n[a]2?Pi:qi,c=r?Uu:Pu;return o=u(n,t,c,e),a=u(t,n,c,hu),i}function i(n){return o(n)}var o,a;return i.invert=function(n){return a(n)},i.domain=function(t){return arguments.length?(n=t.map(Number),u()):n},i.range=function(n){return arguments.length?(t=n,u()):t},i.rangeRound=function(n){return i.range(n).interpolate(zu)},i.clamp=function(n){return arguments.length?(r=n,u()):r},i.interpolate=function(n){return arguments.length?(e=n,u()):e},i.ticks=function(t){return Oi(n,t)},i.tickFormat=function(t,e){return Yi(n,t,e)},i.nice=function(t){return Hi(n,t),u()},i.copy=function(){return Ui(n,t,e,r)},u()}function ji(n,t){return Zo.rebind(n,t,"range","rangeRound","interpolate","clamp")}function Hi(n,t){return Ri(n,Di(Fi(n,t)[2]))}function Fi(n,t){null==t&&(t=10);var e=Li(n),r=e[1]-e[0],u=Math.pow(10,Math.floor(Math.log(r/t)/Math.LN10)),i=t/r*u;return.15>=i?u*=10:.35>=i?u*=5:.75>=i&&(u*=2),e[0]=Math.ceil(e[0]/u)*u,e[1]=Math.floor(e[1]/u)*u+.5*u,e[2]=u,e}function Oi(n,t){return Zo.range.apply(Zo,Fi(n,t))}function Yi(n,t,e){var r=Fi(n,t);if(e){var u=Ga.exec(e);if(u.shift(),"s"===u[8]){var i=Zo.formatPrefix(Math.max(ua(r[0]),ua(r[1])));return u[7]||(u[7]="."+Ii(i.scale(r[2]))),u[8]="f",e=Zo.format(u.join("")),function(n){return e(i.scale(n))+i.symbol}}u[7]||(u[7]="."+Zi(u[8],r)),e=u.join("")}else e=",."+Ii(r[2])+"f";return Zo.format(e)}function Ii(n){return-Math.floor(Math.log(n)/Math.LN10+.01)}function Zi(n,t){var e=Ii(t[2]);return n in ls?Math.abs(e-Ii(Math.max(ua(t[0]),ua(t[1]))))+ +("e"!==n):e-2*("%"===n)}function Vi(n,t,e,r){function u(n){return(e?Math.log(0>n?0:n):-Math.log(n>0?0:-n))/Math.log(t)}function i(n){return e?Math.pow(t,n):-Math.pow(t,-n)}function o(t){return n(u(t))}return o.invert=function(t){return i(n.invert(t))},o.domain=function(t){return arguments.length?(e=t[0]>=0,n.domain((r=t.map(Number)).map(u)),o):r},o.base=function(e){return arguments.length?(t=+e,n.domain(r.map(u)),o):t},o.nice=function(){var t=Ri(r.map(u),e?Math:hs);return n.domain(t),r=t.map(i),o},o.ticks=function(){var n=Li(r),o=[],a=n[0],c=n[1],s=Math.floor(u(a)),l=Math.ceil(u(c)),f=t%1?2:t;if(isFinite(l-s)){if(e){for(;l>s;s++)for(var h=1;f>h;h++)o.push(i(s)*h);o.push(i(s))}else for(o.push(i(s));s++0;h--)o.push(i(s)*h);for(s=0;o[s]c;l--);o=o.slice(s,l)}return o},o.tickFormat=function(n,t){if(!arguments.length)return fs;arguments.length<2?t=fs:"function"!=typeof t&&(t=Zo.format(t));var r,a=Math.max(.1,n/o.ticks().length),c=e?(r=1e-12,Math.ceil):(r=-1e-12,Math.floor);return function(n){return n/i(c(u(n)+r))<=a?t(n):""}},o.copy=function(){return Vi(n.copy(),t,e,r)},ji(o,n)}function Xi(n,t,e){function r(t){return n(u(t))}var u=$i(t),i=$i(1/t);return r.invert=function(t){return i(n.invert(t))},r.domain=function(t){return arguments.length?(n.domain((e=t.map(Number)).map(u)),r):e},r.ticks=function(n){return Oi(e,n)},r.tickFormat=function(n,t){return Yi(e,n,t)},r.nice=function(n){return r.domain(Hi(e,n))},r.exponent=function(o){return arguments.length?(u=$i(t=o),i=$i(1/t),n.domain(e.map(u)),r):t},r.copy=function(){return Xi(n.copy(),t,e)},ji(r,n)}function $i(n){return function(t){return 0>t?-Math.pow(-t,n):Math.pow(t,n)}}function Bi(n,t){function e(e){return i[((u.get(e)||("range"===t.t?u.set(e,n.push(e)):0/0))-1)%i.length]}function r(t,e){return Zo.range(n.length).map(function(n){return t+e*n})}var u,i,a;return e.domain=function(r){if(!arguments.length)return n;n=[],u=new o;for(var i,a=-1,c=r.length;++an?[0/0,0/0]:[n>0?o[n-1]:e[0],nt?0/0:t/i+n,[t,t+1/i]},r.copy=function(){return Ji(n,t,e)},u()}function Gi(n,t){function e(e){return e>=e?t[Zo.bisect(n,e)]:void 0}return e.domain=function(t){return arguments.length?(n=t,e):n},e.range=function(n){return arguments.length?(t=n,e):t},e.invertExtent=function(e){return e=t.indexOf(e),[n[e-1],n[e]]},e.copy=function(){return Gi(n,t)},e}function Ki(n){function t(n){return+n}return t.invert=t,t.domain=t.range=function(e){return arguments.length?(n=e.map(t),t):n},t.ticks=function(t){return Oi(n,t)},t.tickFormat=function(t,e){return Yi(n,t,e)},t.copy=function(){return Ki(n)},t}function Qi(n){return n.innerRadius}function no(n){return n.outerRadius}function to(n){return n.startAngle}function eo(n){return n.endAngle}function ro(n){function t(t){function o(){s.push("M",i(n(l),a))}for(var c,s=[],l=[],f=-1,h=t.length,g=bt(e),p=bt(r);++f1&&u.push("H",r[0]),u.join("")}function ao(n){for(var t=0,e=n.length,r=n[0],u=[r[0],",",r[1]];++t1){a=t[1],i=n[c],c++,r+="C"+(u[0]+o[0])+","+(u[1]+o[1])+","+(i[0]-a[0])+","+(i[1]-a[1])+","+i[0]+","+i[1];for(var s=2;s9&&(u=3*t/Math.sqrt(u),o[a]=u*e,o[a+1]=u*r));for(a=-1;++a<=c;)u=(n[Math.min(c,a+1)][0]-n[Math.max(0,a-1)][0])/(6*(1+o[a]*o[a])),i.push([u||0,o[a]*u||0]);return i}function So(n){return n.length<3?uo(n):n[0]+ho(n,wo(n))}function ko(n){for(var t,e,r,u=-1,i=n.length;++ue?s():(u.active=e,i.event&&i.event.start.call(n,l,t),i.tween.forEach(function(e,r){(r=r.call(n,l,t))&&v.push(r)}),Zo.timer(function(){return p.c=c(r||1)?we:c,1},0,a),void 0)}function c(r){if(u.active!==e)return s();for(var o=r/g,a=f(o),c=v.length;c>0;)v[--c].call(n,a); +return o>=1?(i.event&&i.event.end.call(n,l,t),s()):void 0}function s(){return--u.count?delete u[e]:delete n.__transition__,1}var l=n.__data__,f=i.ease,h=i.delay,g=i.duration,p=Ba,v=[];return p.t=h+a,r>=h?o(r-h):(p.c=o,void 0)},0,a)}}function Uo(n,t){n.attr("transform",function(n){return"translate("+t(n)+",0)"})}function jo(n,t){n.attr("transform",function(n){return"translate(0,"+t(n)+")"})}function Ho(n){return n.toISOString()}function Fo(n,t,e){function r(t){return n(t)}function u(n,e){var r=n[1]-n[0],u=r/e,i=Zo.bisect(Us,u);return i==Us.length?[t.year,Fi(n.map(function(n){return n/31536e6}),e)[2]]:i?t[u/Us[i-1]1?{floor:function(t){for(;e(t=n.floor(t));)t=Oo(t-1);return t},ceil:function(t){for(;e(t=n.ceil(t));)t=Oo(+t+1);return t}}:n))},r.ticks=function(n,t){var e=Li(r.domain()),i=null==n?u(e,10):"number"==typeof n?u(e,n):!n.range&&[{range:n},t];return i&&(n=i[0],t=i[1]),n.range(e[0],Oo(+e[1]+1),1>t?1:t)},r.tickFormat=function(){return e},r.copy=function(){return Fo(n.copy(),t,e)},ji(r,n)}function Oo(n){return new Date(n)}function Yo(n){return JSON.parse(n.responseText)}function Io(n){var t=$o.createRange();return t.selectNode($o.body),t.createContextualFragment(n.responseText)}var Zo={version:"3.4.10"};Date.now||(Date.now=function(){return+new Date});var Vo=[].slice,Xo=function(n){return Vo.call(n)},$o=document,Bo=$o.documentElement,Wo=window;try{Xo(Bo.childNodes)[0].nodeType}catch(Jo){Xo=function(n){for(var t=n.length,e=new Array(t);t--;)e[t]=n[t];return e}}try{$o.createElement("div").style.setProperty("opacity",0,"")}catch(Go){var Ko=Wo.Element.prototype,Qo=Ko.setAttribute,na=Ko.setAttributeNS,ta=Wo.CSSStyleDeclaration.prototype,ea=ta.setProperty;Ko.setAttribute=function(n,t){Qo.call(this,n,t+"")},Ko.setAttributeNS=function(n,t,e){na.call(this,n,t,e+"")},ta.setProperty=function(n,t,e){ea.call(this,n,t+"",e)}}Zo.ascending=n,Zo.descending=function(n,t){return n>t?-1:t>n?1:t>=n?0:0/0},Zo.min=function(n,t){var e,r,u=-1,i=n.length;if(1===arguments.length){for(;++u=e);)e=void 0;for(;++ur&&(e=r)}else{for(;++u=e);)e=void 0;for(;++ur&&(e=r)}return e},Zo.max=function(n,t){var e,r,u=-1,i=n.length;if(1===arguments.length){for(;++u=e);)e=void 0;for(;++ue&&(e=r)}else{for(;++u=e);)e=void 0;for(;++ue&&(e=r)}return e},Zo.extent=function(n,t){var e,r,u,i=-1,o=n.length;if(1===arguments.length){for(;++i=e);)e=u=void 0;for(;++ir&&(e=r),r>u&&(u=r))}else{for(;++i=e);)e=void 0;for(;++ir&&(e=r),r>u&&(u=r))}return[e,u]},Zo.sum=function(n,t){var e,r=0,u=n.length,i=-1;if(1===arguments.length)for(;++i1&&(e=e.map(r)),e=e.filter(t),e.length?Zo.quantile(e.sort(n),.5):void 0};var ra=e(n);Zo.bisectLeft=ra.left,Zo.bisect=Zo.bisectRight=ra.right,Zo.bisector=function(t){return e(1===t.length?function(e,r){return n(t(e),r)}:t)},Zo.shuffle=function(n){for(var t,e,r=n.length;r;)e=0|Math.random()*r--,t=n[r],n[r]=n[e],n[e]=t;return n},Zo.permute=function(n,t){for(var e=t.length,r=new Array(e);e--;)r[e]=n[t[e]];return r},Zo.pairs=function(n){for(var t,e=0,r=n.length-1,u=n[0],i=new Array(0>r?0:r);r>e;)i[e]=[t=u,u=n[++e]];return i},Zo.zip=function(){if(!(u=arguments.length))return[];for(var n=-1,t=Zo.min(arguments,r),e=new Array(t);++n=0;)for(r=n[u],t=r.length;--t>=0;)e[--o]=r[t];return e};var ua=Math.abs;Zo.range=function(n,t,e){if(arguments.length<3&&(e=1,arguments.length<2&&(t=n,n=0)),1/0===(t-n)/e)throw new Error("infinite range");var r,i=[],o=u(ua(e)),a=-1;if(n*=o,t*=o,e*=o,0>e)for(;(r=n+e*++a)>t;)i.push(r/o);else for(;(r=n+e*++a)=i.length)return r?r.call(u,a):e?a.sort(e):a;for(var s,l,f,h,g=-1,p=a.length,v=i[c++],d=new o;++g=i.length)return n;var r=[],u=a[e++];return n.forEach(function(n,u){r.push({key:n,values:t(u,e)})}),u?r.sort(function(n,t){return u(n.key,t.key)}):r}var e,r,u={},i=[],a=[];return u.map=function(t,e){return n(e,t,0)},u.entries=function(e){return t(n(Zo.map,e,0),0)},u.key=function(n){return i.push(n),u},u.sortKeys=function(n){return a[i.length-1]=n,u},u.sortValues=function(n){return e=n,u},u.rollup=function(n){return r=n,u},u},Zo.set=function(n){var t=new h;if(n)for(var e=0,r=n.length;r>e;++e)t.add(n[e]);return t},i(h,{has:a,add:function(n){return this[ia+n]=!0,n},remove:function(n){return n=ia+n,n in this&&delete this[n]},values:s,size:l,empty:f,forEach:function(n){for(var t in this)t.charCodeAt(0)===oa&&n.call(this,t.substring(1))}}),Zo.behavior={},Zo.rebind=function(n,t){for(var e,r=1,u=arguments.length;++r=0&&(r=n.substring(e+1),n=n.substring(0,e)),n)return arguments.length<2?this[n].on(r):this[n].on(r,t);if(2===arguments.length){if(null==t)for(n in this)this.hasOwnProperty(n)&&this[n].on(r,null);return this}},Zo.event=null,Zo.requote=function(n){return n.replace(ca,"\\$&")};var ca=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g,sa={}.__proto__?function(n,t){n.__proto__=t}:function(n,t){for(var e in t)n[e]=t[e]},la=function(n,t){return t.querySelector(n)},fa=function(n,t){return t.querySelectorAll(n)},ha=Bo.matches||Bo[p(Bo,"matchesSelector")],ga=function(n,t){return ha.call(n,t)};"function"==typeof Sizzle&&(la=function(n,t){return Sizzle(n,t)[0]||null},fa=Sizzle,ga=Sizzle.matchesSelector),Zo.selection=function(){return ma};var pa=Zo.selection.prototype=[];pa.select=function(n){var t,e,r,u,i=[];n=b(n);for(var o=-1,a=this.length;++o=0&&(e=n.substring(0,t),n=n.substring(t+1)),va.hasOwnProperty(e)?{space:va[e],local:n}:n}},pa.attr=function(n,t){if(arguments.length<2){if("string"==typeof n){var e=this.node();return n=Zo.ns.qualify(n),n.local?e.getAttributeNS(n.space,n.local):e.getAttribute(n)}for(t in n)this.each(S(t,n[t]));return this}return this.each(S(n,t))},pa.classed=function(n,t){if(arguments.length<2){if("string"==typeof n){var e=this.node(),r=(n=A(n)).length,u=-1;if(t=e.classList){for(;++ur){if("string"!=typeof n){2>r&&(t="");for(e in n)this.each(z(e,n[e],t));return this}if(2>r)return Wo.getComputedStyle(this.node(),null).getPropertyValue(n);e=""}return this.each(z(n,t,e))},pa.property=function(n,t){if(arguments.length<2){if("string"==typeof n)return this.node()[n];for(t in n)this.each(L(t,n[t]));return this}return this.each(L(n,t))},pa.text=function(n){return arguments.length?this.each("function"==typeof n?function(){var t=n.apply(this,arguments);this.textContent=null==t?"":t}:null==n?function(){this.textContent=""}:function(){this.textContent=n}):this.node().textContent},pa.html=function(n){return arguments.length?this.each("function"==typeof n?function(){var t=n.apply(this,arguments);this.innerHTML=null==t?"":t}:null==n?function(){this.innerHTML=""}:function(){this.innerHTML=n}):this.node().innerHTML},pa.append=function(n){return n=T(n),this.select(function(){return this.appendChild(n.apply(this,arguments))})},pa.insert=function(n,t){return n=T(n),t=b(t),this.select(function(){return this.insertBefore(n.apply(this,arguments),t.apply(this,arguments)||null)})},pa.remove=function(){return this.each(function(){var n=this.parentNode;n&&n.removeChild(this)})},pa.data=function(n,t){function e(n,e){var r,u,i,a=n.length,f=e.length,h=Math.min(a,f),g=new Array(f),p=new Array(f),v=new Array(a);if(t){var d,m=new o,y=new o,x=[];for(r=-1;++rr;++r)p[r]=q(e[r]);for(;a>r;++r)v[r]=n[r]}p.update=g,p.parentNode=g.parentNode=v.parentNode=n.parentNode,c.push(p),s.push(g),l.push(v)}var r,u,i=-1,a=this.length;if(!arguments.length){for(n=new Array(a=(r=this[0]).length);++ii;i++){u.push(t=[]),t.parentNode=(e=this[i]).parentNode;for(var a=0,c=e.length;c>a;a++)(r=e[a])&&n.call(r,r.__data__,a,i)&&t.push(r)}return _(u)},pa.order=function(){for(var n=-1,t=this.length;++n=0;)(e=r[u])&&(i&&i!==e.nextSibling&&i.parentNode.insertBefore(e,i),i=e);return this},pa.sort=function(n){n=D.apply(this,arguments);for(var t=-1,e=this.length;++tn;n++)for(var e=this[n],r=0,u=e.length;u>r;r++){var i=e[r];if(i)return i}return null},pa.size=function(){var n=0;return this.each(function(){++n}),n};var da=[];Zo.selection.enter=U,Zo.selection.enter.prototype=da,da.append=pa.append,da.empty=pa.empty,da.node=pa.node,da.call=pa.call,da.size=pa.size,da.select=function(n){for(var t,e,r,u,i,o=[],a=-1,c=this.length;++ar){if("string"!=typeof n){2>r&&(t=!1);for(e in n)this.each(F(e,n[e],t));return this}if(2>r)return(r=this.node()["__on"+n])&&r._;e=!1}return this.each(F(n,t,e))};var ya=Zo.map({mouseenter:"mouseover",mouseleave:"mouseout"});ya.forEach(function(n){"on"+n in $o&&ya.remove(n)});var xa="onselectstart"in $o?null:p(Bo.style,"userSelect"),Ma=0;Zo.mouse=function(n){return Z(n,x())};var _a=/WebKit/.test(Wo.navigator.userAgent)?-1:0;Zo.touches=function(n,t){return arguments.length<2&&(t=x().touches),t?Xo(t).map(function(t){var e=Z(n,t);return e.identifier=t.identifier,e}):[]},Zo.behavior.drag=function(){function n(){this.on("mousedown.drag",u).on("touchstart.drag",i)}function t(n,t,u,i,o){return function(){function a(){var n,e,r=t(h,v);r&&(n=r[0]-x[0],e=r[1]-x[1],p|=n|e,x=r,g({type:"drag",x:r[0]+s[0],y:r[1]+s[1],dx:n,dy:e}))}function c(){t(h,v)&&(m.on(i+d,null).on(o+d,null),y(p&&Zo.event.target===f),g({type:"dragend"}))}var s,l=this,f=Zo.event.target,h=l.parentNode,g=e.of(l,arguments),p=0,v=n(),d=".drag"+(null==v?"":"-"+v),m=Zo.select(u()).on(i+d,a).on(o+d,c),y=I(),x=t(h,v);r?(s=r.apply(l,arguments),s=[s.x-x[0],s.y-x[1]]):s=[0,0],g({type:"dragstart"})}}var e=M(n,"drag","dragstart","dragend"),r=null,u=t(v,Zo.mouse,$,"mousemove","mouseup"),i=t(V,Zo.touch,X,"touchmove","touchend");return n.origin=function(t){return arguments.length?(r=t,n):r},Zo.rebind(n,e,"on")};var ba=Math.PI,wa=2*ba,Sa=ba/2,ka=1e-6,Ea=ka*ka,Aa=ba/180,Ca=180/ba,Na=Math.SQRT2,za=2,La=4;Zo.interpolateZoom=function(n,t){function e(n){var t=n*y;if(m){var e=Q(v),o=i/(za*h)*(e*nt(Na*t+v)-K(v));return[r+o*s,u+o*l,i*e/Q(Na*t+v)]}return[r+n*s,u+n*l,i*Math.exp(Na*t)]}var r=n[0],u=n[1],i=n[2],o=t[0],a=t[1],c=t[2],s=o-r,l=a-u,f=s*s+l*l,h=Math.sqrt(f),g=(c*c-i*i+La*f)/(2*i*za*h),p=(c*c-i*i-La*f)/(2*c*za*h),v=Math.log(Math.sqrt(g*g+1)-g),d=Math.log(Math.sqrt(p*p+1)-p),m=d-v,y=(m||Math.log(c/i))/Na;return e.duration=1e3*y,e},Zo.behavior.zoom=function(){function n(n){n.on(A,s).on(Ra+".zoom",f).on("dblclick.zoom",h).on(z,l)}function t(n){return[(n[0]-S.x)/S.k,(n[1]-S.y)/S.k]}function e(n){return[n[0]*S.k+S.x,n[1]*S.k+S.y]}function r(n){S.k=Math.max(E[0],Math.min(E[1],n))}function u(n,t){t=e(t),S.x+=n[0]-t[0],S.y+=n[1]-t[1]}function i(){_&&_.domain(x.range().map(function(n){return(n-S.x)/S.k}).map(x.invert)),w&&w.domain(b.range().map(function(n){return(n-S.y)/S.k}).map(b.invert))}function o(n){n({type:"zoomstart"})}function a(n){i(),n({type:"zoom",scale:S.k,translate:[S.x,S.y]})}function c(n){n({type:"zoomend"})}function s(){function n(){l=1,u(Zo.mouse(r),h),a(s)}function e(){f.on(C,null).on(N,null),g(l&&Zo.event.target===i),c(s)}var r=this,i=Zo.event.target,s=L.of(r,arguments),l=0,f=Zo.select(Wo).on(C,n).on(N,e),h=t(Zo.mouse(r)),g=I();H.call(r),o(s)}function l(){function n(){var n=Zo.touches(g);return h=S.k,n.forEach(function(n){n.identifier in v&&(v[n.identifier]=t(n))}),n}function e(){var t=Zo.event.target;Zo.select(t).on(M,i).on(_,f),b.push(t);for(var e=Zo.event.changedTouches,o=0,c=e.length;c>o;++o)v[e[o].identifier]=null;var s=n(),l=Date.now();if(1===s.length){if(500>l-m){var h=s[0],g=v[h.identifier];r(2*S.k),u(h,g),y(),a(p)}m=l}else if(s.length>1){var h=s[0],x=s[1],w=h[0]-x[0],k=h[1]-x[1];d=w*w+k*k}}function i(){for(var n,t,e,i,o=Zo.touches(g),c=0,s=o.length;s>c;++c,i=null)if(e=o[c],i=v[e.identifier]){if(t)break;n=e,t=i}if(i){var l=(l=e[0]-n[0])*l+(l=e[1]-n[1])*l,f=d&&Math.sqrt(l/d);n=[(n[0]+e[0])/2,(n[1]+e[1])/2],t=[(t[0]+i[0])/2,(t[1]+i[1])/2],r(f*h)}m=null,u(n,t),a(p)}function f(){if(Zo.event.touches.length){for(var t=Zo.event.changedTouches,e=0,r=t.length;r>e;++e)delete v[t[e].identifier];for(var u in v)return void n()}Zo.selectAll(b).on(x,null),w.on(A,s).on(z,l),k(),c(p)}var h,g=this,p=L.of(g,arguments),v={},d=0,x=".zoom-"+Zo.event.changedTouches[0].identifier,M="touchmove"+x,_="touchend"+x,b=[],w=Zo.select(g).on(A,null).on(z,e),k=I();H.call(g),e(),o(p)}function f(){var n=L.of(this,arguments);d?clearTimeout(d):(g=t(p=v||Zo.mouse(this)),H.call(this),o(n)),d=setTimeout(function(){d=null,c(n)},50),y(),r(Math.pow(2,.002*Ta())*S.k),u(p,g),a(n)}function h(){var n=L.of(this,arguments),e=Zo.mouse(this),i=t(e),s=Math.log(S.k)/Math.LN2;o(n),r(Math.pow(2,Zo.event.shiftKey?Math.ceil(s)-1:Math.floor(s)+1)),u(e,i),a(n),c(n)}var g,p,v,d,m,x,_,b,w,S={x:0,y:0,k:1},k=[960,500],E=qa,A="mousedown.zoom",C="mousemove.zoom",N="mouseup.zoom",z="touchstart.zoom",L=M(n,"zoomstart","zoom","zoomend");return n.event=function(n){n.each(function(){var n=L.of(this,arguments),t=S;Ss?Zo.select(this).transition().each("start.zoom",function(){S=this.__chart__||{x:0,y:0,k:1},o(n)}).tween("zoom:zoom",function(){var e=k[0],r=k[1],u=e/2,i=r/2,o=Zo.interpolateZoom([(u-S.x)/S.k,(i-S.y)/S.k,e/S.k],[(u-t.x)/t.k,(i-t.y)/t.k,e/t.k]);return function(t){var r=o(t),c=e/r[2];this.__chart__=S={x:u-r[0]*c,y:i-r[1]*c,k:c},a(n)}}).each("end.zoom",function(){c(n)}):(this.__chart__=S,o(n),a(n),c(n))})},n.translate=function(t){return arguments.length?(S={x:+t[0],y:+t[1],k:S.k},i(),n):[S.x,S.y]},n.scale=function(t){return arguments.length?(S={x:S.x,y:S.y,k:+t},i(),n):S.k},n.scaleExtent=function(t){return arguments.length?(E=null==t?qa:[+t[0],+t[1]],n):E},n.center=function(t){return arguments.length?(v=t&&[+t[0],+t[1]],n):v},n.size=function(t){return arguments.length?(k=t&&[+t[0],+t[1]],n):k},n.x=function(t){return arguments.length?(_=t,x=t.copy(),S={x:0,y:0,k:1},n):_},n.y=function(t){return arguments.length?(w=t,b=t.copy(),S={x:0,y:0,k:1},n):w},Zo.rebind(n,L,"on")};var Ta,qa=[0,1/0],Ra="onwheel"in $o?(Ta=function(){return-Zo.event.deltaY*(Zo.event.deltaMode?120:1)},"wheel"):"onmousewheel"in $o?(Ta=function(){return Zo.event.wheelDelta},"mousewheel"):(Ta=function(){return-Zo.event.detail},"MozMousePixelScroll");Zo.color=et,et.prototype.toString=function(){return this.rgb()+""},Zo.hsl=rt;var Da=rt.prototype=new et;Da.brighter=function(n){return n=Math.pow(.7,arguments.length?n:1),new rt(this.h,this.s,this.l/n)},Da.darker=function(n){return n=Math.pow(.7,arguments.length?n:1),new rt(this.h,this.s,n*this.l)},Da.rgb=function(){return ut(this.h,this.s,this.l)},Zo.hcl=it;var Pa=it.prototype=new et;Pa.brighter=function(n){return new it(this.h,this.c,Math.min(100,this.l+Ua*(arguments.length?n:1)))},Pa.darker=function(n){return new it(this.h,this.c,Math.max(0,this.l-Ua*(arguments.length?n:1)))},Pa.rgb=function(){return ot(this.h,this.c,this.l).rgb()},Zo.lab=at;var Ua=18,ja=.95047,Ha=1,Fa=1.08883,Oa=at.prototype=new et;Oa.brighter=function(n){return new at(Math.min(100,this.l+Ua*(arguments.length?n:1)),this.a,this.b)},Oa.darker=function(n){return new at(Math.max(0,this.l-Ua*(arguments.length?n:1)),this.a,this.b)},Oa.rgb=function(){return ct(this.l,this.a,this.b)},Zo.rgb=gt;var Ya=gt.prototype=new et;Ya.brighter=function(n){n=Math.pow(.7,arguments.length?n:1);var t=this.r,e=this.g,r=this.b,u=30;return t||e||r?(t&&u>t&&(t=u),e&&u>e&&(e=u),r&&u>r&&(r=u),new gt(Math.min(255,t/n),Math.min(255,e/n),Math.min(255,r/n))):new gt(u,u,u)},Ya.darker=function(n){return n=Math.pow(.7,arguments.length?n:1),new gt(n*this.r,n*this.g,n*this.b)},Ya.hsl=function(){return yt(this.r,this.g,this.b)},Ya.toString=function(){return"#"+dt(this.r)+dt(this.g)+dt(this.b)};var Ia=Zo.map({aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074});Ia.forEach(function(n,t){Ia.set(n,pt(t))}),Zo.functor=bt,Zo.xhr=St(wt),Zo.dsv=function(n,t){function e(n,e,i){arguments.length<3&&(i=e,e=null);var o=kt(n,t,null==e?r:u(e),i);return o.row=function(n){return arguments.length?o.response(null==(e=n)?r:u(n)):e},o}function r(n){return e.parse(n.responseText)}function u(n){return function(t){return e.parse(t.responseText,n)}}function i(t){return t.map(o).join(n)}function o(n){return a.test(n)?'"'+n.replace(/\"/g,'""')+'"':n}var a=new RegExp('["'+n+"\n]"),c=n.charCodeAt(0);return e.parse=function(n,t){var r;return e.parseRows(n,function(n,e){if(r)return r(n,e-1);var u=new Function("d","return {"+n.map(function(n,t){return JSON.stringify(n)+": d["+t+"]"}).join(",")+"}");r=t?function(n,e){return t(u(n),e)}:u})},e.parseRows=function(n,t){function e(){if(l>=s)return o;if(u)return u=!1,i;var t=l;if(34===n.charCodeAt(t)){for(var e=t;e++l;){var r=n.charCodeAt(l++),a=1;if(10===r)u=!0;else if(13===r)u=!0,10===n.charCodeAt(l)&&(++l,++a);else if(r!==c)continue;return n.substring(t,l-a)}return n.substring(t)}for(var r,u,i={},o={},a=[],s=n.length,l=0,f=0;(r=e())!==o;){for(var h=[];r!==i&&r!==o;)h.push(r),r=e();(!t||(h=t(h,f++)))&&a.push(h)}return a},e.format=function(t){if(Array.isArray(t[0]))return e.formatRows(t);var r=new h,u=[];return t.forEach(function(n){for(var t in n)r.has(t)||u.push(r.add(t))}),[u.map(o).join(n)].concat(t.map(function(t){return u.map(function(n){return o(t[n])}).join(n)})).join("\n")},e.formatRows=function(n){return n.map(i).join("\n")},e},Zo.csv=Zo.dsv(",","text/csv"),Zo.tsv=Zo.dsv(" ","text/tab-separated-values"),Zo.touch=function(n,t,e){if(arguments.length<3&&(e=t,t=x().changedTouches),t)for(var r,u=0,i=t.length;i>u;++u)if((r=t[u]).identifier===e)return Z(n,r)};var Za,Va,Xa,$a,Ba,Wa=Wo[p(Wo,"requestAnimationFrame")]||function(n){setTimeout(n,17)};Zo.timer=function(n,t,e){var r=arguments.length;2>r&&(t=0),3>r&&(e=Date.now());var u=e+t,i={c:n,t:u,f:!1,n:null};Va?Va.n=i:Za=i,Va=i,Xa||($a=clearTimeout($a),Xa=1,Wa(At))},Zo.timer.flush=function(){Ct(),Nt()},Zo.round=function(n,t){return t?Math.round(n*(t=Math.pow(10,t)))/t:Math.round(n)};var Ja=["y","z","a","f","p","n","\xb5","m","","k","M","G","T","P","E","Z","Y"].map(Lt);Zo.formatPrefix=function(n,t){var e=0;return n&&(0>n&&(n*=-1),t&&(n=Zo.round(n,zt(n,t))),e=1+Math.floor(1e-12+Math.log(n)/Math.LN10),e=Math.max(-24,Math.min(24,3*Math.floor((e-1)/3)))),Ja[8+e/3]};var Ga=/(?:([^{])?([<>=^]))?([+\- ])?([$#])?(0)?(\d+)?(,)?(\.-?\d+)?([a-z%])?/i,Ka=Zo.map({b:function(n){return n.toString(2)},c:function(n){return String.fromCharCode(n)},o:function(n){return n.toString(8)},x:function(n){return n.toString(16)},X:function(n){return n.toString(16).toUpperCase()},g:function(n,t){return n.toPrecision(t)},e:function(n,t){return n.toExponential(t)},f:function(n,t){return n.toFixed(t)},r:function(n,t){return(n=Zo.round(n,zt(n,t))).toFixed(Math.max(0,Math.min(20,zt(n*(1+1e-15),t))))}}),Qa=Zo.time={},nc=Date;Rt.prototype={getDate:function(){return this._.getUTCDate()},getDay:function(){return this._.getUTCDay()},getFullYear:function(){return this._.getUTCFullYear()},getHours:function(){return this._.getUTCHours()},getMilliseconds:function(){return this._.getUTCMilliseconds()},getMinutes:function(){return this._.getUTCMinutes()},getMonth:function(){return this._.getUTCMonth()},getSeconds:function(){return this._.getUTCSeconds()},getTime:function(){return this._.getTime()},getTimezoneOffset:function(){return 0},valueOf:function(){return this._.valueOf()},setDate:function(){tc.setUTCDate.apply(this._,arguments)},setDay:function(){tc.setUTCDay.apply(this._,arguments)},setFullYear:function(){tc.setUTCFullYear.apply(this._,arguments)},setHours:function(){tc.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){tc.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){tc.setUTCMinutes.apply(this._,arguments)},setMonth:function(){tc.setUTCMonth.apply(this._,arguments)},setSeconds:function(){tc.setUTCSeconds.apply(this._,arguments)},setTime:function(){tc.setTime.apply(this._,arguments)}};var tc=Date.prototype;Qa.year=Dt(function(n){return n=Qa.day(n),n.setMonth(0,1),n},function(n,t){n.setFullYear(n.getFullYear()+t)},function(n){return n.getFullYear()}),Qa.years=Qa.year.range,Qa.years.utc=Qa.year.utc.range,Qa.day=Dt(function(n){var t=new nc(2e3,0);return t.setFullYear(n.getFullYear(),n.getMonth(),n.getDate()),t},function(n,t){n.setDate(n.getDate()+t)},function(n){return n.getDate()-1}),Qa.days=Qa.day.range,Qa.days.utc=Qa.day.utc.range,Qa.dayOfYear=function(n){var t=Qa.year(n);return Math.floor((n-t-6e4*(n.getTimezoneOffset()-t.getTimezoneOffset()))/864e5)},["sunday","monday","tuesday","wednesday","thursday","friday","saturday"].forEach(function(n,t){t=7-t;var e=Qa[n]=Dt(function(n){return(n=Qa.day(n)).setDate(n.getDate()-(n.getDay()+t)%7),n},function(n,t){n.setDate(n.getDate()+7*Math.floor(t))},function(n){var e=Qa.year(n).getDay();return Math.floor((Qa.dayOfYear(n)+(e+t)%7)/7)-(e!==t)});Qa[n+"s"]=e.range,Qa[n+"s"].utc=e.utc.range,Qa[n+"OfYear"]=function(n){var e=Qa.year(n).getDay();return Math.floor((Qa.dayOfYear(n)+(e+t)%7)/7)}}),Qa.week=Qa.sunday,Qa.weeks=Qa.sunday.range,Qa.weeks.utc=Qa.sunday.utc.range,Qa.weekOfYear=Qa.sundayOfYear;var ec={"-":"",_:" ",0:"0"},rc=/^\s*\d+/,uc=/^%/;Zo.locale=function(n){return{numberFormat:Tt(n),timeFormat:Ut(n)}};var ic=Zo.locale({decimal:".",thousands:",",grouping:[3],currency:["$",""],dateTime:"%a %b %e %X %Y",date:"%m/%d/%Y",time:"%H:%M:%S",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});Zo.format=ic.numberFormat,Zo.geo={},ue.prototype={s:0,t:0,add:function(n){ie(n,this.t,oc),ie(oc.s,this.s,this),this.s?this.t+=oc.t:this.s=oc.t},reset:function(){this.s=this.t=0},valueOf:function(){return this.s}};var oc=new ue;Zo.geo.stream=function(n,t){n&&ac.hasOwnProperty(n.type)?ac[n.type](n,t):oe(n,t)};var ac={Feature:function(n,t){oe(n.geometry,t)},FeatureCollection:function(n,t){for(var e=n.features,r=-1,u=e.length;++rn?4*ba+n:n,fc.lineStart=fc.lineEnd=fc.point=v}};Zo.geo.bounds=function(){function n(n,t){x.push(M=[l=n,h=n]),f>t&&(f=t),t>g&&(g=t)}function t(t,e){var r=le([t*Aa,e*Aa]);if(m){var u=he(m,r),i=[u[1],-u[0],0],o=he(i,u);ve(o),o=de(o);var c=t-p,s=c>0?1:-1,v=o[0]*Ca*s,d=ua(c)>180;if(d^(v>s*p&&s*t>v)){var y=o[1]*Ca;y>g&&(g=y)}else if(v=(v+360)%360-180,d^(v>s*p&&s*t>v)){var y=-o[1]*Ca;f>y&&(f=y)}else f>e&&(f=e),e>g&&(g=e);d?p>t?a(l,t)>a(l,h)&&(h=t):a(t,h)>a(l,h)&&(l=t):h>=l?(l>t&&(l=t),t>h&&(h=t)):t>p?a(l,t)>a(l,h)&&(h=t):a(t,h)>a(l,h)&&(l=t)}else n(t,e);m=r,p=t}function e(){_.point=t}function r(){M[0]=l,M[1]=h,_.point=n,m=null}function u(n,e){if(m){var r=n-p;y+=ua(r)>180?r+(r>0?360:-360):r}else v=n,d=e;fc.point(n,e),t(n,e)}function i(){fc.lineStart()}function o(){u(v,d),fc.lineEnd(),ua(y)>ka&&(l=-(h=180)),M[0]=l,M[1]=h,m=null}function a(n,t){return(t-=n)<0?t+360:t}function c(n,t){return n[0]-t[0]}function s(n,t){return t[0]<=t[1]?t[0]<=n&&n<=t[1]:nlc?(l=-(h=180),f=-(g=90)):y>ka?g=90:-ka>y&&(f=-90),M[0]=l,M[1]=h}};return function(n){g=h=-(l=f=1/0),x=[],Zo.geo.stream(n,_);var t=x.length;if(t){x.sort(c);for(var e,r=1,u=x[0],i=[u];t>r;++r)e=x[r],s(e[0],u)||s(e[1],u)?(a(u[0],e[1])>a(u[0],u[1])&&(u[1]=e[1]),a(e[0],u[1])>a(u[0],u[1])&&(u[0]=e[0])):i.push(u=e); +for(var o,e,p=-1/0,t=i.length-1,r=0,u=i[t];t>=r;u=e,++r)e=i[r],(o=a(u[1],e[0]))>p&&(p=o,l=e[0],h=u[1])}return x=M=null,1/0===l||1/0===f?[[0/0,0/0],[0/0,0/0]]:[[l,f],[h,g]]}}(),Zo.geo.centroid=function(n){hc=gc=pc=vc=dc=mc=yc=xc=Mc=_c=bc=0,Zo.geo.stream(n,wc);var t=Mc,e=_c,r=bc,u=t*t+e*e+r*r;return Ea>u&&(t=mc,e=yc,r=xc,ka>gc&&(t=pc,e=vc,r=dc),u=t*t+e*e+r*r,Ea>u)?[0/0,0/0]:[Math.atan2(e,t)*Ca,G(r/Math.sqrt(u))*Ca]};var hc,gc,pc,vc,dc,mc,yc,xc,Mc,_c,bc,wc={sphere:v,point:ye,lineStart:Me,lineEnd:_e,polygonStart:function(){wc.lineStart=be},polygonEnd:function(){wc.lineStart=Me}},Sc=Ae(we,Te,Re,[-ba,-ba/2]),kc=1e9;Zo.geo.clipExtent=function(){var n,t,e,r,u,i,o={stream:function(n){return u&&(u.valid=!1),u=i(n),u.valid=!0,u},extent:function(a){return arguments.length?(i=Ue(n=+a[0][0],t=+a[0][1],e=+a[1][0],r=+a[1][1]),u&&(u.valid=!1,u=null),o):[[n,t],[e,r]]}};return o.extent([[0,0],[960,500]])},(Zo.geo.conicEqualArea=function(){return He(Fe)}).raw=Fe,Zo.geo.albers=function(){return Zo.geo.conicEqualArea().rotate([96,0]).center([-.6,38.7]).parallels([29.5,45.5]).scale(1070)},Zo.geo.albersUsa=function(){function n(n){var i=n[0],o=n[1];return t=null,e(i,o),t||(r(i,o),t)||u(i,o),t}var t,e,r,u,i=Zo.geo.albers(),o=Zo.geo.conicEqualArea().rotate([154,0]).center([-2,58.5]).parallels([55,65]),a=Zo.geo.conicEqualArea().rotate([157,0]).center([-3,19.9]).parallels([8,18]),c={point:function(n,e){t=[n,e]}};return n.invert=function(n){var t=i.scale(),e=i.translate(),r=(n[0]-e[0])/t,u=(n[1]-e[1])/t;return(u>=.12&&.234>u&&r>=-.425&&-.214>r?o:u>=.166&&.234>u&&r>=-.214&&-.115>r?a:i).invert(n)},n.stream=function(n){var t=i.stream(n),e=o.stream(n),r=a.stream(n);return{point:function(n,u){t.point(n,u),e.point(n,u),r.point(n,u)},sphere:function(){t.sphere(),e.sphere(),r.sphere()},lineStart:function(){t.lineStart(),e.lineStart(),r.lineStart()},lineEnd:function(){t.lineEnd(),e.lineEnd(),r.lineEnd()},polygonStart:function(){t.polygonStart(),e.polygonStart(),r.polygonStart()},polygonEnd:function(){t.polygonEnd(),e.polygonEnd(),r.polygonEnd()}}},n.precision=function(t){return arguments.length?(i.precision(t),o.precision(t),a.precision(t),n):i.precision()},n.scale=function(t){return arguments.length?(i.scale(t),o.scale(.35*t),a.scale(t),n.translate(i.translate())):i.scale()},n.translate=function(t){if(!arguments.length)return i.translate();var s=i.scale(),l=+t[0],f=+t[1];return e=i.translate(t).clipExtent([[l-.455*s,f-.238*s],[l+.455*s,f+.238*s]]).stream(c).point,r=o.translate([l-.307*s,f+.201*s]).clipExtent([[l-.425*s+ka,f+.12*s+ka],[l-.214*s-ka,f+.234*s-ka]]).stream(c).point,u=a.translate([l-.205*s,f+.212*s]).clipExtent([[l-.214*s+ka,f+.166*s+ka],[l-.115*s-ka,f+.234*s-ka]]).stream(c).point,n},n.scale(1070)};var Ec,Ac,Cc,Nc,zc,Lc,Tc={point:v,lineStart:v,lineEnd:v,polygonStart:function(){Ac=0,Tc.lineStart=Oe},polygonEnd:function(){Tc.lineStart=Tc.lineEnd=Tc.point=v,Ec+=ua(Ac/2)}},qc={point:Ye,lineStart:v,lineEnd:v,polygonStart:v,polygonEnd:v},Rc={point:Ve,lineStart:Xe,lineEnd:$e,polygonStart:function(){Rc.lineStart=Be},polygonEnd:function(){Rc.point=Ve,Rc.lineStart=Xe,Rc.lineEnd=$e}};Zo.geo.path=function(){function n(n){return n&&("function"==typeof a&&i.pointRadius(+a.apply(this,arguments)),o&&o.valid||(o=u(i)),Zo.geo.stream(n,o)),i.result()}function t(){return o=null,n}var e,r,u,i,o,a=4.5;return n.area=function(n){return Ec=0,Zo.geo.stream(n,u(Tc)),Ec},n.centroid=function(n){return pc=vc=dc=mc=yc=xc=Mc=_c=bc=0,Zo.geo.stream(n,u(Rc)),bc?[Mc/bc,_c/bc]:xc?[mc/xc,yc/xc]:dc?[pc/dc,vc/dc]:[0/0,0/0]},n.bounds=function(n){return zc=Lc=-(Cc=Nc=1/0),Zo.geo.stream(n,u(qc)),[[Cc,Nc],[zc,Lc]]},n.projection=function(n){return arguments.length?(u=(e=n)?n.stream||Ge(n):wt,t()):e},n.context=function(n){return arguments.length?(i=null==(r=n)?new Ie:new We(n),"function"!=typeof a&&i.pointRadius(a),t()):r},n.pointRadius=function(t){return arguments.length?(a="function"==typeof t?t:(i.pointRadius(+t),+t),n):a},n.projection(Zo.geo.albersUsa()).context(null)},Zo.geo.transform=function(n){return{stream:function(t){var e=new Ke(t);for(var r in n)e[r]=n[r];return e}}},Ke.prototype={point:function(n,t){this.stream.point(n,t)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}},Zo.geo.projection=nr,Zo.geo.projectionMutator=tr,(Zo.geo.equirectangular=function(){return nr(rr)}).raw=rr.invert=rr,Zo.geo.rotation=function(n){function t(t){return t=n(t[0]*Aa,t[1]*Aa),t[0]*=Ca,t[1]*=Ca,t}return n=ir(n[0]%360*Aa,n[1]*Aa,n.length>2?n[2]*Aa:0),t.invert=function(t){return t=n.invert(t[0]*Aa,t[1]*Aa),t[0]*=Ca,t[1]*=Ca,t},t},ur.invert=rr,Zo.geo.circle=function(){function n(){var n="function"==typeof r?r.apply(this,arguments):r,t=ir(-n[0]*Aa,-n[1]*Aa,0).invert,u=[];return e(null,null,1,{point:function(n,e){u.push(n=t(n,e)),n[0]*=Ca,n[1]*=Ca}}),{type:"Polygon",coordinates:[u]}}var t,e,r=[0,0],u=6;return n.origin=function(t){return arguments.length?(r=t,n):r},n.angle=function(r){return arguments.length?(e=sr((t=+r)*Aa,u*Aa),n):t},n.precision=function(r){return arguments.length?(e=sr(t*Aa,(u=+r)*Aa),n):u},n.angle(90)},Zo.geo.distance=function(n,t){var e,r=(t[0]-n[0])*Aa,u=n[1]*Aa,i=t[1]*Aa,o=Math.sin(r),a=Math.cos(r),c=Math.sin(u),s=Math.cos(u),l=Math.sin(i),f=Math.cos(i);return Math.atan2(Math.sqrt((e=f*o)*e+(e=s*l-c*f*a)*e),c*l+s*f*a)},Zo.geo.graticule=function(){function n(){return{type:"MultiLineString",coordinates:t()}}function t(){return Zo.range(Math.ceil(i/d)*d,u,d).map(h).concat(Zo.range(Math.ceil(s/m)*m,c,m).map(g)).concat(Zo.range(Math.ceil(r/p)*p,e,p).filter(function(n){return ua(n%d)>ka}).map(l)).concat(Zo.range(Math.ceil(a/v)*v,o,v).filter(function(n){return ua(n%m)>ka}).map(f))}var e,r,u,i,o,a,c,s,l,f,h,g,p=10,v=p,d=90,m=360,y=2.5;return n.lines=function(){return t().map(function(n){return{type:"LineString",coordinates:n}})},n.outline=function(){return{type:"Polygon",coordinates:[h(i).concat(g(c).slice(1),h(u).reverse().slice(1),g(s).reverse().slice(1))]}},n.extent=function(t){return arguments.length?n.majorExtent(t).minorExtent(t):n.minorExtent()},n.majorExtent=function(t){return arguments.length?(i=+t[0][0],u=+t[1][0],s=+t[0][1],c=+t[1][1],i>u&&(t=i,i=u,u=t),s>c&&(t=s,s=c,c=t),n.precision(y)):[[i,s],[u,c]]},n.minorExtent=function(t){return arguments.length?(r=+t[0][0],e=+t[1][0],a=+t[0][1],o=+t[1][1],r>e&&(t=r,r=e,e=t),a>o&&(t=a,a=o,o=t),n.precision(y)):[[r,a],[e,o]]},n.step=function(t){return arguments.length?n.majorStep(t).minorStep(t):n.minorStep()},n.majorStep=function(t){return arguments.length?(d=+t[0],m=+t[1],n):[d,m]},n.minorStep=function(t){return arguments.length?(p=+t[0],v=+t[1],n):[p,v]},n.precision=function(t){return arguments.length?(y=+t,l=fr(a,o,90),f=hr(r,e,y),h=fr(s,c,90),g=hr(i,u,y),n):y},n.majorExtent([[-180,-90+ka],[180,90-ka]]).minorExtent([[-180,-80-ka],[180,80+ka]])},Zo.geo.greatArc=function(){function n(){return{type:"LineString",coordinates:[t||r.apply(this,arguments),e||u.apply(this,arguments)]}}var t,e,r=gr,u=pr;return n.distance=function(){return Zo.geo.distance(t||r.apply(this,arguments),e||u.apply(this,arguments))},n.source=function(e){return arguments.length?(r=e,t="function"==typeof e?null:e,n):r},n.target=function(t){return arguments.length?(u=t,e="function"==typeof t?null:t,n):u},n.precision=function(){return arguments.length?n:0},n},Zo.geo.interpolate=function(n,t){return vr(n[0]*Aa,n[1]*Aa,t[0]*Aa,t[1]*Aa)},Zo.geo.length=function(n){return Dc=0,Zo.geo.stream(n,Pc),Dc};var Dc,Pc={sphere:v,point:v,lineStart:dr,lineEnd:v,polygonStart:v,polygonEnd:v},Uc=mr(function(n){return Math.sqrt(2/(1+n))},function(n){return 2*Math.asin(n/2)});(Zo.geo.azimuthalEqualArea=function(){return nr(Uc)}).raw=Uc;var jc=mr(function(n){var t=Math.acos(n);return t&&t/Math.sin(t)},wt);(Zo.geo.azimuthalEquidistant=function(){return nr(jc)}).raw=jc,(Zo.geo.conicConformal=function(){return He(yr)}).raw=yr,(Zo.geo.conicEquidistant=function(){return He(xr)}).raw=xr;var Hc=mr(function(n){return 1/n},Math.atan);(Zo.geo.gnomonic=function(){return nr(Hc)}).raw=Hc,Mr.invert=function(n,t){return[n,2*Math.atan(Math.exp(t))-Sa]},(Zo.geo.mercator=function(){return _r(Mr)}).raw=Mr;var Fc=mr(function(){return 1},Math.asin);(Zo.geo.orthographic=function(){return nr(Fc)}).raw=Fc;var Oc=mr(function(n){return 1/(1+n)},function(n){return 2*Math.atan(n)});(Zo.geo.stereographic=function(){return nr(Oc)}).raw=Oc,br.invert=function(n,t){return[-t,2*Math.atan(Math.exp(n))-Sa]},(Zo.geo.transverseMercator=function(){var n=_r(br),t=n.center,e=n.rotate;return n.center=function(n){return n?t([-n[1],n[0]]):(n=t(),[-n[1],n[0]])},n.rotate=function(n){return n?e([n[0],n[1],n.length>2?n[2]+90:90]):(n=e(),[n[0],n[1],n[2]-90])},n.rotate([0,0])}).raw=br,Zo.geom={},Zo.geom.hull=function(n){function t(n){if(n.length<3)return[];var t,u=bt(e),i=bt(r),o=n.length,a=[],c=[];for(t=0;o>t;t++)a.push([+u.call(this,n[t],t),+i.call(this,n[t],t),t]);for(a.sort(Er),t=0;o>t;t++)c.push([a[t][0],-a[t][1]]);var s=kr(a),l=kr(c),f=l[0]===s[0],h=l[l.length-1]===s[s.length-1],g=[];for(t=s.length-1;t>=0;--t)g.push(n[a[s[t]][2]]);for(t=+f;t=r&&s.x<=i&&s.y>=u&&s.y<=o?[[r,o],[i,o],[i,u],[r,u]]:[];l.point=n[a]}),t}function e(n){return n.map(function(n,t){return{x:Math.round(i(n,t)/ka)*ka,y:Math.round(o(n,t)/ka)*ka,i:t}})}var r=wr,u=Sr,i=r,o=u,a=Jc;return n?t(n):(t.links=function(n){return tu(e(n)).edges.filter(function(n){return n.l&&n.r}).map(function(t){return{source:n[t.l.i],target:n[t.r.i]}})},t.triangles=function(n){var t=[];return tu(e(n)).cells.forEach(function(e,r){for(var u,i,o=e.site,a=e.edges.sort(Hr),c=-1,s=a.length,l=a[s-1].edge,f=l.l===o?l.r:l.l;++c=s,h=r>=l,g=(h<<1)+f;n.leaf=!1,n=n.nodes[g]||(n.nodes[g]=ou()),f?u=s:a=s,h?o=l:c=l,i(n,t,e,r,u,o,a,c)}var l,f,h,g,p,v,d,m,y,x=bt(a),M=bt(c);if(null!=t)v=t,d=e,m=r,y=u;else if(m=y=-(v=d=1/0),f=[],h=[],p=n.length,o)for(g=0;p>g;++g)l=n[g],l.xm&&(m=l.x),l.y>y&&(y=l.y),f.push(l.x),h.push(l.y);else for(g=0;p>g;++g){var _=+x(l=n[g],g),b=+M(l,g);v>_&&(v=_),d>b&&(d=b),_>m&&(m=_),b>y&&(y=b),f.push(_),h.push(b)}var w=m-v,S=y-d;w>S?y=d+w:m=v+S;var k=ou();if(k.add=function(n){i(k,n,+x(n,++g),+M(n,g),v,d,m,y)},k.visit=function(n){au(n,k,v,d,m,y)},g=-1,null==t){for(;++g=0?n.substring(0,t):n,r=t>=0?n.substring(t+1):"in";return e=ns.get(e)||Qc,r=ts.get(r)||wt,pu(r(e.apply(null,Vo.call(arguments,1))))},Zo.interpolateHcl=Au,Zo.interpolateHsl=Cu,Zo.interpolateLab=Nu,Zo.interpolateRound=zu,Zo.transform=function(n){var t=$o.createElementNS(Zo.ns.prefix.svg,"g");return(Zo.transform=function(n){if(null!=n){t.setAttribute("transform",n);var e=t.transform.baseVal.consolidate()}return new Lu(e?e.matrix:es)})(n)},Lu.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var es={a:1,b:0,c:0,d:1,e:0,f:0};Zo.interpolateTransform=Du,Zo.layout={},Zo.layout.bundle=function(){return function(n){for(var t=[],e=-1,r=n.length;++ea*a/d){if(p>c){var s=t.charge/c;n.px-=i*s,n.py-=o*s}return!0}if(t.point&&c&&p>c){var s=t.pointCharge/c;n.px-=i*s,n.py-=o*s}}return!t.charge}}function t(n){n.px=Zo.event.x,n.py=Zo.event.y,a.resume()}var e,r,u,i,o,a={},c=Zo.dispatch("start","tick","end"),s=[1,1],l=.9,f=rs,h=us,g=-30,p=is,v=.1,d=.64,m=[],y=[];return a.tick=function(){if((r*=.99)<.005)return c.end({type:"end",alpha:r=0}),!0;var t,e,a,f,h,p,d,x,M,_=m.length,b=y.length;for(e=0;b>e;++e)a=y[e],f=a.source,h=a.target,x=h.x-f.x,M=h.y-f.y,(p=x*x+M*M)&&(p=r*i[e]*((p=Math.sqrt(p))-u[e])/p,x*=p,M*=p,h.x-=x*(d=f.weight/(h.weight+f.weight)),h.y-=M*d,f.x+=x*(d=1-d),f.y+=M*d);if((d=r*v)&&(x=s[0]/2,M=s[1]/2,e=-1,d))for(;++e<_;)a=m[e],a.x+=(x-a.x)*d,a.y+=(M-a.y)*d;if(g)for(Vu(t=Zo.geom.quadtree(m),r,o),e=-1;++e<_;)(a=m[e]).fixed||t.visit(n(a));for(e=-1;++e<_;)a=m[e],a.fixed?(a.x=a.px,a.y=a.py):(a.x-=(a.px-(a.px=a.x))*l,a.y-=(a.py-(a.py=a.y))*l);c.tick({type:"tick",alpha:r})},a.nodes=function(n){return arguments.length?(m=n,a):m},a.links=function(n){return arguments.length?(y=n,a):y},a.size=function(n){return arguments.length?(s=n,a):s},a.linkDistance=function(n){return arguments.length?(f="function"==typeof n?n:+n,a):f},a.distance=a.linkDistance,a.linkStrength=function(n){return arguments.length?(h="function"==typeof n?n:+n,a):h},a.friction=function(n){return arguments.length?(l=+n,a):l},a.charge=function(n){return arguments.length?(g="function"==typeof n?n:+n,a):g},a.chargeDistance=function(n){return arguments.length?(p=n*n,a):Math.sqrt(p)},a.gravity=function(n){return arguments.length?(v=+n,a):v},a.theta=function(n){return arguments.length?(d=n*n,a):Math.sqrt(d)},a.alpha=function(n){return arguments.length?(n=+n,r?r=n>0?n:0:n>0&&(c.start({type:"start",alpha:r=n}),Zo.timer(a.tick)),a):r},a.start=function(){function n(n,r){if(!e){for(e=new Array(c),a=0;c>a;++a)e[a]=[];for(a=0;s>a;++a){var u=y[a];e[u.source.index].push(u.target),e[u.target.index].push(u.source)}}for(var i,o=e[t],a=-1,s=o.length;++at;++t)(r=m[t]).index=t,r.weight=0;for(t=0;l>t;++t)r=y[t],"number"==typeof r.source&&(r.source=m[r.source]),"number"==typeof r.target&&(r.target=m[r.target]),++r.source.weight,++r.target.weight;for(t=0;c>t;++t)r=m[t],isNaN(r.x)&&(r.x=n("x",p)),isNaN(r.y)&&(r.y=n("y",v)),isNaN(r.px)&&(r.px=r.x),isNaN(r.py)&&(r.py=r.y);if(u=[],"function"==typeof f)for(t=0;l>t;++t)u[t]=+f.call(this,y[t],t);else for(t=0;l>t;++t)u[t]=f;if(i=[],"function"==typeof h)for(t=0;l>t;++t)i[t]=+h.call(this,y[t],t);else for(t=0;l>t;++t)i[t]=h;if(o=[],"function"==typeof g)for(t=0;c>t;++t)o[t]=+g.call(this,m[t],t);else for(t=0;c>t;++t)o[t]=g;return a.resume()},a.resume=function(){return a.alpha(.1)},a.stop=function(){return a.alpha(0)},a.drag=function(){return e||(e=Zo.behavior.drag().origin(wt).on("dragstart.force",Ou).on("drag.force",t).on("dragend.force",Yu)),arguments.length?(this.on("mouseover.force",Iu).on("mouseout.force",Zu).call(e),void 0):e},Zo.rebind(a,c,"on")};var rs=20,us=1,is=1/0;Zo.layout.hierarchy=function(){function n(u){var i,o=[u],a=[];for(u.depth=0;null!=(i=o.pop());)if(a.push(i),(s=e.call(n,i,i.depth))&&(c=s.length)){for(var c,s,l;--c>=0;)o.push(l=s[c]),l.parent=i,l.depth=i.depth+1;r&&(i.value=0),i.children=s}else r&&(i.value=+r.call(n,i,i.depth)||0),delete i.children;return Bu(u,function(n){var e,u;t&&(e=n.children)&&e.sort(t),r&&(u=n.parent)&&(u.value+=n.value)}),a}var t=Gu,e=Wu,r=Ju;return n.sort=function(e){return arguments.length?(t=e,n):t},n.children=function(t){return arguments.length?(e=t,n):e},n.value=function(t){return arguments.length?(r=t,n):r},n.revalue=function(t){return r&&($u(t,function(n){n.children&&(n.value=0)}),Bu(t,function(t){var e;t.children||(t.value=+r.call(n,t,t.depth)||0),(e=t.parent)&&(e.value+=t.value)})),t},n},Zo.layout.partition=function(){function n(t,e,r,u){var i=t.children;if(t.x=e,t.y=t.depth*u,t.dx=r,t.dy=u,i&&(o=i.length)){var o,a,c,s=-1;for(r=t.value?r/t.value:0;++sg;++g)for(u.call(n,s[0][g],p=v[g],l[0][g][1]),h=1;d>h;++h)u.call(n,s[h][g],p+=l[h-1][g][1],l[h][g][1]);return a}var t=wt,e=ei,r=ri,u=ti,i=Qu,o=ni;return n.values=function(e){return arguments.length?(t=e,n):t},n.order=function(t){return arguments.length?(e="function"==typeof t?t:as.get(t)||ei,n):e},n.offset=function(t){return arguments.length?(r="function"==typeof t?t:cs.get(t)||ri,n):r},n.x=function(t){return arguments.length?(i=t,n):i},n.y=function(t){return arguments.length?(o=t,n):o},n.out=function(t){return arguments.length?(u=t,n):u},n};var as=Zo.map({"inside-out":function(n){var t,e,r=n.length,u=n.map(ui),i=n.map(ii),o=Zo.range(r).sort(function(n,t){return u[n]-u[t]}),a=0,c=0,s=[],l=[];for(t=0;r>t;++t)e=o[t],c>a?(a+=i[e],s.push(e)):(c+=i[e],l.push(e));return l.reverse().concat(s)},reverse:function(n){return Zo.range(n.length).reverse()},"default":ei}),cs=Zo.map({silhouette:function(n){var t,e,r,u=n.length,i=n[0].length,o=[],a=0,c=[];for(e=0;i>e;++e){for(t=0,r=0;u>t;t++)r+=n[t][e][1];r>a&&(a=r),o.push(r)}for(e=0;i>e;++e)c[e]=(a-o[e])/2;return c},wiggle:function(n){var t,e,r,u,i,o,a,c,s,l=n.length,f=n[0],h=f.length,g=[];for(g[0]=c=s=0,e=1;h>e;++e){for(t=0,u=0;l>t;++t)u+=n[t][e][1];for(t=0,i=0,a=f[e][0]-f[e-1][0];l>t;++t){for(r=0,o=(n[t][e][1]-n[t][e-1][1])/(2*a);t>r;++r)o+=(n[r][e][1]-n[r][e-1][1])/a;i+=o*n[t][e][1]}g[e]=c-=u?i/u*a:0,s>c&&(s=c)}for(e=0;h>e;++e)g[e]-=s;return g},expand:function(n){var t,e,r,u=n.length,i=n[0].length,o=1/u,a=[];for(e=0;i>e;++e){for(t=0,r=0;u>t;t++)r+=n[t][e][1];if(r)for(t=0;u>t;t++)n[t][e][1]/=r;else for(t=0;u>t;t++)n[t][e][1]=o}for(e=0;i>e;++e)a[e]=0;return a},zero:ri});Zo.layout.histogram=function(){function n(n,i){for(var o,a,c=[],s=n.map(e,this),l=r.call(this,s,i),f=u.call(this,l,s,i),i=-1,h=s.length,g=f.length-1,p=t?1:1/h;++i0)for(i=-1;++i=l[0]&&a<=l[1]&&(o=c[Zo.bisect(f,a,1,g)-1],o.y+=p,o.push(n[i]));return c}var t=!0,e=Number,r=si,u=ai;return n.value=function(t){return arguments.length?(e=t,n):e},n.range=function(t){return arguments.length?(r=bt(t),n):r},n.bins=function(t){return arguments.length?(u="number"==typeof t?function(n){return ci(n,t)}:bt(t),n):u},n.frequency=function(e){return arguments.length?(t=!!e,n):t},n},Zo.layout.pack=function(){function n(n,i){var o=e.call(this,n,i),a=o[0],c=u[0],s=u[1],l=null==t?Math.sqrt:"function"==typeof t?t:function(){return t};if(a.x=a.y=0,Bu(a,function(n){n.r=+l(n.value)}),Bu(a,pi),r){var f=r*(t?1:Math.max(2*a.r/c,2*a.r/s))/2;Bu(a,function(n){n.r+=f}),Bu(a,pi),Bu(a,function(n){n.r-=f})}return mi(a,c/2,s/2,t?1:1/Math.max(2*a.r/c,2*a.r/s)),o}var t,e=Zo.layout.hierarchy().sort(li),r=0,u=[1,1];return n.size=function(t){return arguments.length?(u=t,n):u},n.radius=function(e){return arguments.length?(t=null==e||"function"==typeof e?e:+e,n):t},n.padding=function(t){return arguments.length?(r=+t,n):r},Xu(n,e)},Zo.layout.tree=function(){function n(n,u){var l=o.call(this,n,u),f=l[0],h=t(f);if(Bu(h,e),h.parent.m=-h.z,$u(h,r),s)$u(f,i);else{var g=f,p=f,v=f;$u(f,function(n){n.xp.x&&(p=n),n.depth>v.depth&&(v=n)});var d=a(g,p)/2-g.x,m=c[0]/(p.x+a(p,g)/2+d),y=c[1]/(v.depth||1);$u(f,function(n){n.x=(n.x+d)*m,n.y=n.depth*y})}return l}function t(n){for(var t,e={A:null,children:[n]},r=[e];null!=(t=r.pop());)for(var u,i=t.children,o=0,a=i.length;a>o;++o)r.push((i[o]=u={_:i[o],parent:t,children:(u=i[o].children)&&u.slice()||[],A:null,a:null,z:0,m:0,c:0,s:0,t:null,i:o}).a=u);return e.children[0]}function e(n){var t=n.children,e=n.parent.children,r=n.i?e[n.i-1]:null;if(t.length){wi(n);var i=(t[0].z+t[t.length-1].z)/2;r?(n.z=r.z+a(n._,r._),n.m=n.z-i):n.z=i}else r&&(n.z=r.z+a(n._,r._));n.parent.A=u(n,r,n.parent.A||e[0])}function r(n){n._.x=n.z+n.parent.m,n.m+=n.parent.m}function u(n,t,e){if(t){for(var r,u=n,i=n,o=t,c=u.parent.children[0],s=u.m,l=i.m,f=o.m,h=c.m;o=_i(o),u=Mi(u),o&&u;)c=Mi(c),i=_i(i),i.a=n,r=o.z+f-u.z-s+a(o._,u._),r>0&&(bi(Si(o,n,e),n,r),s+=r,l+=r),f+=o.m,s+=u.m,h+=c.m,l+=i.m;o&&!_i(i)&&(i.t=o,i.m+=f-l),u&&!Mi(c)&&(c.t=u,c.m+=s-h,e=n)}return e}function i(n){n.x*=c[0],n.y=n.depth*c[1]}var o=Zo.layout.hierarchy().sort(null).value(null),a=xi,c=[1,1],s=null;return n.separation=function(t){return arguments.length?(a=t,n):a},n.size=function(t){return arguments.length?(s=null==(c=t)?i:null,n):s?null:c},n.nodeSize=function(t){return arguments.length?(s=null==(c=t)?null:i,n):s?c:null},Xu(n,o)},Zo.layout.cluster=function(){function n(n,i){var o,a=t.call(this,n,i),c=a[0],s=0;Bu(c,function(n){var t=n.children;t&&t.length?(n.x=Ei(t),n.y=ki(t)):(n.x=o?s+=e(n,o):0,n.y=0,o=n)});var l=Ai(c),f=Ci(c),h=l.x-e(l,f)/2,g=f.x+e(f,l)/2;return Bu(c,u?function(n){n.x=(n.x-c.x)*r[0],n.y=(c.y-n.y)*r[1]}:function(n){n.x=(n.x-h)/(g-h)*r[0],n.y=(1-(c.y?n.y/c.y:1))*r[1]}),a}var t=Zo.layout.hierarchy().sort(null).value(null),e=xi,r=[1,1],u=!1;return n.separation=function(t){return arguments.length?(e=t,n):e},n.size=function(t){return arguments.length?(u=null==(r=t),n):u?null:r},n.nodeSize=function(t){return arguments.length?(u=null!=(r=t),n):u?r:null},Xu(n,t)},Zo.layout.treemap=function(){function n(n,t){for(var e,r,u=-1,i=n.length;++ut?0:t),e.area=isNaN(r)||0>=r?0:r}function t(e){var i=e.children;if(i&&i.length){var o,a,c,s=f(e),l=[],h=i.slice(),p=1/0,v="slice"===g?s.dx:"dice"===g?s.dy:"slice-dice"===g?1&e.depth?s.dy:s.dx:Math.min(s.dx,s.dy);for(n(h,s.dx*s.dy/e.value),l.area=0;(c=h.length)>0;)l.push(o=h[c-1]),l.area+=o.area,"squarify"!==g||(a=r(l,v))<=p?(h.pop(),p=a):(l.area-=l.pop().area,u(l,v,s,!1),v=Math.min(s.dx,s.dy),l.length=l.area=0,p=1/0);l.length&&(u(l,v,s,!0),l.length=l.area=0),i.forEach(t)}}function e(t){var r=t.children;if(r&&r.length){var i,o=f(t),a=r.slice(),c=[];for(n(a,o.dx*o.dy/t.value),c.area=0;i=a.pop();)c.push(i),c.area+=i.area,null!=i.z&&(u(c,i.z?o.dx:o.dy,o,!a.length),c.length=c.area=0);r.forEach(e)}}function r(n,t){for(var e,r=n.area,u=0,i=1/0,o=-1,a=n.length;++oe&&(i=e),e>u&&(u=e));return r*=r,t*=t,r?Math.max(t*u*p/r,r/(t*i*p)):1/0}function u(n,t,e,r){var u,i=-1,o=n.length,a=e.x,s=e.y,l=t?c(n.area/t):0;if(t==e.dx){for((r||l>e.dy)&&(l=e.dy);++ie.dx)&&(l=e.dx);++ie&&(t=1),1>e&&(n=0),function(){var e,r,u;do e=2*Math.random()-1,r=2*Math.random()-1,u=e*e+r*r;while(!u||u>1);return n+t*e*Math.sqrt(-2*Math.log(u)/u)}},logNormal:function(){var n=Zo.random.normal.apply(Zo,arguments);return function(){return Math.exp(n())}},bates:function(n){var t=Zo.random.irwinHall(n);return function(){return t()/n}},irwinHall:function(n){return function(){for(var t=0,e=0;n>e;e++)t+=Math.random();return t}}},Zo.scale={};var ss={floor:wt,ceil:wt};Zo.scale.linear=function(){return Ui([0,1],[0,1],hu,!1)};var ls={s:1,g:1,p:1,r:1,e:1};Zo.scale.log=function(){return Vi(Zo.scale.linear().domain([0,1]),10,!0,[1,10])};var fs=Zo.format(".0e"),hs={floor:function(n){return-Math.ceil(-n)},ceil:function(n){return-Math.floor(-n)}};Zo.scale.pow=function(){return Xi(Zo.scale.linear(),1,[0,1])},Zo.scale.sqrt=function(){return Zo.scale.pow().exponent(.5)},Zo.scale.ordinal=function(){return Bi([],{t:"range",a:[[]]})},Zo.scale.category10=function(){return Zo.scale.ordinal().range(gs)},Zo.scale.category20=function(){return Zo.scale.ordinal().range(ps)},Zo.scale.category20b=function(){return Zo.scale.ordinal().range(vs)},Zo.scale.category20c=function(){return Zo.scale.ordinal().range(ds)};var gs=[2062260,16744206,2924588,14034728,9725885,9197131,14907330,8355711,12369186,1556175].map(vt),ps=[2062260,11454440,16744206,16759672,2924588,10018698,14034728,16750742,9725885,12955861,9197131,12885140,14907330,16234194,8355711,13092807,12369186,14408589,1556175,10410725].map(vt),vs=[3750777,5395619,7040719,10264286,6519097,9216594,11915115,13556636,9202993,12426809,15186514,15190932,8666169,11356490,14049643,15177372,8077683,10834324,13528509,14589654].map(vt),ds=[3244733,7057110,10406625,13032431,15095053,16616764,16625259,16634018,3253076,7652470,10607003,13101504,7695281,10394312,12369372,14342891,6513507,9868950,12434877,14277081].map(vt);Zo.scale.quantile=function(){return Wi([],[])},Zo.scale.quantize=function(){return Ji(0,1,[0,1])},Zo.scale.threshold=function(){return Gi([.5],[0,1])},Zo.scale.identity=function(){return Ki([0,1])},Zo.svg={},Zo.svg.arc=function(){function n(){var n=t.apply(this,arguments),i=e.apply(this,arguments),o=r.apply(this,arguments)+ms,a=u.apply(this,arguments)+ms,c=(o>a&&(c=o,o=a,a=c),a-o),s=ba>c?"0":"1",l=Math.cos(o),f=Math.sin(o),h=Math.cos(a),g=Math.sin(a); +return c>=ys?n?"M0,"+i+"A"+i+","+i+" 0 1,1 0,"+-i+"A"+i+","+i+" 0 1,1 0,"+i+"M0,"+n+"A"+n+","+n+" 0 1,0 0,"+-n+"A"+n+","+n+" 0 1,0 0,"+n+"Z":"M0,"+i+"A"+i+","+i+" 0 1,1 0,"+-i+"A"+i+","+i+" 0 1,1 0,"+i+"Z":n?"M"+i*l+","+i*f+"A"+i+","+i+" 0 "+s+",1 "+i*h+","+i*g+"L"+n*h+","+n*g+"A"+n+","+n+" 0 "+s+",0 "+n*l+","+n*f+"Z":"M"+i*l+","+i*f+"A"+i+","+i+" 0 "+s+",1 "+i*h+","+i*g+"L0,0"+"Z"}var t=Qi,e=no,r=to,u=eo;return n.innerRadius=function(e){return arguments.length?(t=bt(e),n):t},n.outerRadius=function(t){return arguments.length?(e=bt(t),n):e},n.startAngle=function(t){return arguments.length?(r=bt(t),n):r},n.endAngle=function(t){return arguments.length?(u=bt(t),n):u},n.centroid=function(){var n=(t.apply(this,arguments)+e.apply(this,arguments))/2,i=(r.apply(this,arguments)+u.apply(this,arguments))/2+ms;return[Math.cos(i)*n,Math.sin(i)*n]},n};var ms=-Sa,ys=wa-ka;Zo.svg.line=function(){return ro(wt)};var xs=Zo.map({linear:uo,"linear-closed":io,step:oo,"step-before":ao,"step-after":co,basis:po,"basis-open":vo,"basis-closed":mo,bundle:yo,cardinal:fo,"cardinal-open":so,"cardinal-closed":lo,monotone:So});xs.forEach(function(n,t){t.key=n,t.closed=/-closed$/.test(n)});var Ms=[0,2/3,1/3,0],_s=[0,1/3,2/3,0],bs=[0,1/6,2/3,1/6];Zo.svg.line.radial=function(){var n=ro(ko);return n.radius=n.x,delete n.x,n.angle=n.y,delete n.y,n},ao.reverse=co,co.reverse=ao,Zo.svg.area=function(){return Eo(wt)},Zo.svg.area.radial=function(){var n=Eo(ko);return n.radius=n.x,delete n.x,n.innerRadius=n.x0,delete n.x0,n.outerRadius=n.x1,delete n.x1,n.angle=n.y,delete n.y,n.startAngle=n.y0,delete n.y0,n.endAngle=n.y1,delete n.y1,n},Zo.svg.chord=function(){function n(n,a){var c=t(this,i,n,a),s=t(this,o,n,a);return"M"+c.p0+r(c.r,c.p1,c.a1-c.a0)+(e(c,s)?u(c.r,c.p1,c.r,c.p0):u(c.r,c.p1,s.r,s.p0)+r(s.r,s.p1,s.a1-s.a0)+u(s.r,s.p1,c.r,c.p0))+"Z"}function t(n,t,e,r){var u=t.call(n,e,r),i=a.call(n,u,r),o=c.call(n,u,r)+ms,l=s.call(n,u,r)+ms;return{r:i,a0:o,a1:l,p0:[i*Math.cos(o),i*Math.sin(o)],p1:[i*Math.cos(l),i*Math.sin(l)]}}function e(n,t){return n.a0==t.a0&&n.a1==t.a1}function r(n,t,e){return"A"+n+","+n+" 0 "+ +(e>ba)+",1 "+t}function u(n,t,e,r){return"Q 0,0 "+r}var i=gr,o=pr,a=Ao,c=to,s=eo;return n.radius=function(t){return arguments.length?(a=bt(t),n):a},n.source=function(t){return arguments.length?(i=bt(t),n):i},n.target=function(t){return arguments.length?(o=bt(t),n):o},n.startAngle=function(t){return arguments.length?(c=bt(t),n):c},n.endAngle=function(t){return arguments.length?(s=bt(t),n):s},n},Zo.svg.diagonal=function(){function n(n,u){var i=t.call(this,n,u),o=e.call(this,n,u),a=(i.y+o.y)/2,c=[i,{x:i.x,y:a},{x:o.x,y:a},o];return c=c.map(r),"M"+c[0]+"C"+c[1]+" "+c[2]+" "+c[3]}var t=gr,e=pr,r=Co;return n.source=function(e){return arguments.length?(t=bt(e),n):t},n.target=function(t){return arguments.length?(e=bt(t),n):e},n.projection=function(t){return arguments.length?(r=t,n):r},n},Zo.svg.diagonal.radial=function(){var n=Zo.svg.diagonal(),t=Co,e=n.projection;return n.projection=function(n){return arguments.length?e(No(t=n)):t},n},Zo.svg.symbol=function(){function n(n,r){return(ws.get(t.call(this,n,r))||To)(e.call(this,n,r))}var t=Lo,e=zo;return n.type=function(e){return arguments.length?(t=bt(e),n):t},n.size=function(t){return arguments.length?(e=bt(t),n):e},n};var ws=Zo.map({circle:To,cross:function(n){var t=Math.sqrt(n/5)/2;return"M"+-3*t+","+-t+"H"+-t+"V"+-3*t+"H"+t+"V"+-t+"H"+3*t+"V"+t+"H"+t+"V"+3*t+"H"+-t+"V"+t+"H"+-3*t+"Z"},diamond:function(n){var t=Math.sqrt(n/(2*As)),e=t*As;return"M0,"+-t+"L"+e+",0"+" 0,"+t+" "+-e+",0"+"Z"},square:function(n){var t=Math.sqrt(n)/2;return"M"+-t+","+-t+"L"+t+","+-t+" "+t+","+t+" "+-t+","+t+"Z"},"triangle-down":function(n){var t=Math.sqrt(n/Es),e=t*Es/2;return"M0,"+e+"L"+t+","+-e+" "+-t+","+-e+"Z"},"triangle-up":function(n){var t=Math.sqrt(n/Es),e=t*Es/2;return"M0,"+-e+"L"+t+","+e+" "+-t+","+e+"Z"}});Zo.svg.symbolTypes=ws.keys();var Ss,ks,Es=Math.sqrt(3),As=Math.tan(30*Aa),Cs=[],Ns=0;Cs.call=pa.call,Cs.empty=pa.empty,Cs.node=pa.node,Cs.size=pa.size,Zo.transition=function(n){return arguments.length?Ss?n.transition():n:ma.transition()},Zo.transition.prototype=Cs,Cs.select=function(n){var t,e,r,u=this.id,i=[];n=b(n);for(var o=-1,a=this.length;++oi;i++){u.push(t=[]);for(var e=this[i],a=0,c=e.length;c>a;a++)(r=e[a])&&n.call(r,r.__data__,a,i)&&t.push(r)}return qo(u,this.id)},Cs.tween=function(n,t){var e=this.id;return arguments.length<2?this.node().__transition__[e].tween.get(n):P(this,null==t?function(t){t.__transition__[e].tween.remove(n)}:function(r){r.__transition__[e].tween.set(n,t)})},Cs.attr=function(n,t){function e(){this.removeAttribute(a)}function r(){this.removeAttributeNS(a.space,a.local)}function u(n){return null==n?e:(n+="",function(){var t,e=this.getAttribute(a);return e!==n&&(t=o(e,n),function(n){this.setAttribute(a,t(n))})})}function i(n){return null==n?r:(n+="",function(){var t,e=this.getAttributeNS(a.space,a.local);return e!==n&&(t=o(e,n),function(n){this.setAttributeNS(a.space,a.local,t(n))})})}if(arguments.length<2){for(t in n)this.attr(t,n[t]);return this}var o="transform"==n?Du:hu,a=Zo.ns.qualify(n);return Ro(this,"attr."+n,t,a.local?i:u)},Cs.attrTween=function(n,t){function e(n,e){var r=t.call(this,n,e,this.getAttribute(u));return r&&function(n){this.setAttribute(u,r(n))}}function r(n,e){var r=t.call(this,n,e,this.getAttributeNS(u.space,u.local));return r&&function(n){this.setAttributeNS(u.space,u.local,r(n))}}var u=Zo.ns.qualify(n);return this.tween("attr."+n,u.local?r:e)},Cs.style=function(n,t,e){function r(){this.style.removeProperty(n)}function u(t){return null==t?r:(t+="",function(){var r,u=Wo.getComputedStyle(this,null).getPropertyValue(n);return u!==t&&(r=hu(u,t),function(t){this.style.setProperty(n,r(t),e)})})}var i=arguments.length;if(3>i){if("string"!=typeof n){2>i&&(t="");for(e in n)this.style(e,n[e],t);return this}e=""}return Ro(this,"style."+n,t,u)},Cs.styleTween=function(n,t,e){function r(r,u){var i=t.call(this,r,u,Wo.getComputedStyle(this,null).getPropertyValue(n));return i&&function(t){this.style.setProperty(n,i(t),e)}}return arguments.length<3&&(e=""),this.tween("style."+n,r)},Cs.text=function(n){return Ro(this,"text",n,Do)},Cs.remove=function(){return this.each("end.transition",function(){var n;this.__transition__.count<2&&(n=this.parentNode)&&n.removeChild(this)})},Cs.ease=function(n){var t=this.id;return arguments.length<1?this.node().__transition__[t].ease:("function"!=typeof n&&(n=Zo.ease.apply(Zo,arguments)),P(this,function(e){e.__transition__[t].ease=n}))},Cs.delay=function(n){var t=this.id;return arguments.length<1?this.node().__transition__[t].delay:P(this,"function"==typeof n?function(e,r,u){e.__transition__[t].delay=+n.call(e,e.__data__,r,u)}:(n=+n,function(e){e.__transition__[t].delay=n}))},Cs.duration=function(n){var t=this.id;return arguments.length<1?this.node().__transition__[t].duration:P(this,"function"==typeof n?function(e,r,u){e.__transition__[t].duration=Math.max(1,n.call(e,e.__data__,r,u))}:(n=Math.max(1,n),function(e){e.__transition__[t].duration=n}))},Cs.each=function(n,t){var e=this.id;if(arguments.length<2){var r=ks,u=Ss;Ss=e,P(this,function(t,r,u){ks=t.__transition__[e],n.call(t,t.__data__,r,u)}),ks=r,Ss=u}else P(this,function(r){var u=r.__transition__[e];(u.event||(u.event=Zo.dispatch("start","end"))).on(n,t)});return this},Cs.transition=function(){for(var n,t,e,r,u=this.id,i=++Ns,o=[],a=0,c=this.length;c>a;a++){o.push(n=[]);for(var t=this[a],s=0,l=t.length;l>s;s++)(e=t[s])&&(r=Object.create(e.__transition__[u]),r.delay+=r.duration,Po(e,s,i,r)),n.push(e)}return qo(o,i)},Zo.svg.axis=function(){function n(n){n.each(function(){var n,s=Zo.select(this),l=this.__chart__||e,f=this.__chart__=e.copy(),h=null==c?f.ticks?f.ticks.apply(f,a):f.domain():c,g=null==t?f.tickFormat?f.tickFormat.apply(f,a):wt:t,p=s.selectAll(".tick").data(h,f),v=p.enter().insert("g",".domain").attr("class","tick").style("opacity",ka),d=Zo.transition(p.exit()).style("opacity",ka).remove(),m=Zo.transition(p.order()).style("opacity",1),y=Ti(f),x=s.selectAll(".domain").data([0]),M=(x.enter().append("path").attr("class","domain"),Zo.transition(x));v.append("line"),v.append("text");var _=v.select("line"),b=m.select("line"),w=p.select("text").text(g),S=v.select("text"),k=m.select("text");switch(r){case"bottom":n=Uo,_.attr("y2",u),S.attr("y",Math.max(u,0)+o),b.attr("x2",0).attr("y2",u),k.attr("x",0).attr("y",Math.max(u,0)+o),w.attr("dy",".71em").style("text-anchor","middle"),M.attr("d","M"+y[0]+","+i+"V0H"+y[1]+"V"+i);break;case"top":n=Uo,_.attr("y2",-u),S.attr("y",-(Math.max(u,0)+o)),b.attr("x2",0).attr("y2",-u),k.attr("x",0).attr("y",-(Math.max(u,0)+o)),w.attr("dy","0em").style("text-anchor","middle"),M.attr("d","M"+y[0]+","+-i+"V0H"+y[1]+"V"+-i);break;case"left":n=jo,_.attr("x2",-u),S.attr("x",-(Math.max(u,0)+o)),b.attr("x2",-u).attr("y2",0),k.attr("x",-(Math.max(u,0)+o)).attr("y",0),w.attr("dy",".32em").style("text-anchor","end"),M.attr("d","M"+-i+","+y[0]+"H0V"+y[1]+"H"+-i);break;case"right":n=jo,_.attr("x2",u),S.attr("x",Math.max(u,0)+o),b.attr("x2",u).attr("y2",0),k.attr("x",Math.max(u,0)+o).attr("y",0),w.attr("dy",".32em").style("text-anchor","start"),M.attr("d","M"+i+","+y[0]+"H0V"+y[1]+"H"+i)}if(f.rangeBand){var E=f,A=E.rangeBand()/2;l=f=function(n){return E(n)+A}}else l.rangeBand?l=f:d.call(n,f);v.call(n,l),m.call(n,f)})}var t,e=Zo.scale.linear(),r=zs,u=6,i=6,o=3,a=[10],c=null;return n.scale=function(t){return arguments.length?(e=t,n):e},n.orient=function(t){return arguments.length?(r=t in Ls?t+"":zs,n):r},n.ticks=function(){return arguments.length?(a=arguments,n):a},n.tickValues=function(t){return arguments.length?(c=t,n):c},n.tickFormat=function(e){return arguments.length?(t=e,n):t},n.tickSize=function(t){var e=arguments.length;return e?(u=+t,i=+arguments[e-1],n):u},n.innerTickSize=function(t){return arguments.length?(u=+t,n):u},n.outerTickSize=function(t){return arguments.length?(i=+t,n):i},n.tickPadding=function(t){return arguments.length?(o=+t,n):o},n.tickSubdivide=function(){return arguments.length&&n},n};var zs="bottom",Ls={top:1,right:1,bottom:1,left:1};Zo.svg.brush=function(){function n(i){i.each(function(){var i=Zo.select(this).style("pointer-events","all").style("-webkit-tap-highlight-color","rgba(0,0,0,0)").on("mousedown.brush",u).on("touchstart.brush",u),o=i.selectAll(".background").data([0]);o.enter().append("rect").attr("class","background").style("visibility","hidden").style("cursor","crosshair"),i.selectAll(".extent").data([0]).enter().append("rect").attr("class","extent").style("cursor","move");var a=i.selectAll(".resize").data(p,wt);a.exit().remove(),a.enter().append("g").attr("class",function(n){return"resize "+n}).style("cursor",function(n){return Ts[n]}).append("rect").attr("x",function(n){return/[ew]$/.test(n)?-3:null}).attr("y",function(n){return/^[ns]/.test(n)?-3:null}).attr("width",6).attr("height",6).style("visibility","hidden"),a.style("display",n.empty()?"none":null);var l,f=Zo.transition(i),h=Zo.transition(o);c&&(l=Ti(c),h.attr("x",l[0]).attr("width",l[1]-l[0]),e(f)),s&&(l=Ti(s),h.attr("y",l[0]).attr("height",l[1]-l[0]),r(f)),t(f)})}function t(n){n.selectAll(".resize").attr("transform",function(n){return"translate("+l[+/e$/.test(n)]+","+f[+/^s/.test(n)]+")"})}function e(n){n.select(".extent").attr("x",l[0]),n.selectAll(".extent,.n>rect,.s>rect").attr("width",l[1]-l[0])}function r(n){n.select(".extent").attr("y",f[0]),n.selectAll(".extent,.e>rect,.w>rect").attr("height",f[1]-f[0])}function u(){function u(){32==Zo.event.keyCode&&(C||(x=null,z[0]-=l[1],z[1]-=f[1],C=2),y())}function p(){32==Zo.event.keyCode&&2==C&&(z[0]+=l[1],z[1]+=f[1],C=0,y())}function v(){var n=Zo.mouse(_),u=!1;M&&(n[0]+=M[0],n[1]+=M[1]),C||(Zo.event.altKey?(x||(x=[(l[0]+l[1])/2,(f[0]+f[1])/2]),z[0]=l[+(n[0]p?(u=r,r=p):u=p),v[0]!=r||v[1]!=u?(e?o=null:i=null,v[0]=r,v[1]=u,!0):void 0}function m(){v(),S.style("pointer-events","all").selectAll(".resize").style("display",n.empty()?"none":null),Zo.select("body").style("cursor",null),L.on("mousemove.brush",null).on("mouseup.brush",null).on("touchmove.brush",null).on("touchend.brush",null).on("keydown.brush",null).on("keyup.brush",null),N(),w({type:"brushend"})}var x,M,_=this,b=Zo.select(Zo.event.target),w=a.of(_,arguments),S=Zo.select(_),k=b.datum(),E=!/^(n|s)$/.test(k)&&c,A=!/^(e|w)$/.test(k)&&s,C=b.classed("extent"),N=I(),z=Zo.mouse(_),L=Zo.select(Wo).on("keydown.brush",u).on("keyup.brush",p);if(Zo.event.changedTouches?L.on("touchmove.brush",v).on("touchend.brush",m):L.on("mousemove.brush",v).on("mouseup.brush",m),S.interrupt().selectAll("*").interrupt(),C)z[0]=l[0]-z[0],z[1]=f[0]-z[1];else if(k){var T=+/w$/.test(k),q=+/^n/.test(k);M=[l[1-T]-z[0],f[1-q]-z[1]],z[0]=l[T],z[1]=f[q]}else Zo.event.altKey&&(x=z.slice());S.style("pointer-events","none").selectAll(".resize").style("display",null),Zo.select("body").style("cursor",b.style("cursor")),w({type:"brushstart"}),v()}var i,o,a=M(n,"brushstart","brush","brushend"),c=null,s=null,l=[0,0],f=[0,0],h=!0,g=!0,p=qs[0];return n.event=function(n){n.each(function(){var n=a.of(this,arguments),t={x:l,y:f,i:i,j:o},e=this.__chart__||t;this.__chart__=t,Ss?Zo.select(this).transition().each("start.brush",function(){i=e.i,o=e.j,l=e.x,f=e.y,n({type:"brushstart"})}).tween("brush:brush",function(){var e=gu(l,t.x),r=gu(f,t.y);return i=o=null,function(u){l=t.x=e(u),f=t.y=r(u),n({type:"brush",mode:"resize"})}}).each("end.brush",function(){i=t.i,o=t.j,n({type:"brush",mode:"resize"}),n({type:"brushend"})}):(n({type:"brushstart"}),n({type:"brush",mode:"resize"}),n({type:"brushend"}))})},n.x=function(t){return arguments.length?(c=t,p=qs[!c<<1|!s],n):c},n.y=function(t){return arguments.length?(s=t,p=qs[!c<<1|!s],n):s},n.clamp=function(t){return arguments.length?(c&&s?(h=!!t[0],g=!!t[1]):c?h=!!t:s&&(g=!!t),n):c&&s?[h,g]:c?h:s?g:null},n.extent=function(t){var e,r,u,a,h;return arguments.length?(c&&(e=t[0],r=t[1],s&&(e=e[0],r=r[0]),i=[e,r],c.invert&&(e=c(e),r=c(r)),e>r&&(h=e,e=r,r=h),(e!=l[0]||r!=l[1])&&(l=[e,r])),s&&(u=t[0],a=t[1],c&&(u=u[1],a=a[1]),o=[u,a],s.invert&&(u=s(u),a=s(a)),u>a&&(h=u,u=a,a=h),(u!=f[0]||a!=f[1])&&(f=[u,a])),n):(c&&(i?(e=i[0],r=i[1]):(e=l[0],r=l[1],c.invert&&(e=c.invert(e),r=c.invert(r)),e>r&&(h=e,e=r,r=h))),s&&(o?(u=o[0],a=o[1]):(u=f[0],a=f[1],s.invert&&(u=s.invert(u),a=s.invert(a)),u>a&&(h=u,u=a,a=h))),c&&s?[[e,u],[r,a]]:c?[e,r]:s&&[u,a])},n.clear=function(){return n.empty()||(l=[0,0],f=[0,0],i=o=null),n},n.empty=function(){return!!c&&l[0]==l[1]||!!s&&f[0]==f[1]},Zo.rebind(n,a,"on")};var Ts={n:"ns-resize",e:"ew-resize",s:"ns-resize",w:"ew-resize",nw:"nwse-resize",ne:"nesw-resize",se:"nwse-resize",sw:"nesw-resize"},qs=[["n","e","s","w","nw","ne","se","sw"],["e","w"],["n","s"],[]],Rs=Qa.format=ic.timeFormat,Ds=Rs.utc,Ps=Ds("%Y-%m-%dT%H:%M:%S.%LZ");Rs.iso=Date.prototype.toISOString&&+new Date("2000-01-01T00:00:00.000Z")?Ho:Ps,Ho.parse=function(n){var t=new Date(n);return isNaN(t)?null:t},Ho.toString=Ps.toString,Qa.second=Dt(function(n){return new nc(1e3*Math.floor(n/1e3))},function(n,t){n.setTime(n.getTime()+1e3*Math.floor(t))},function(n){return n.getSeconds()}),Qa.seconds=Qa.second.range,Qa.seconds.utc=Qa.second.utc.range,Qa.minute=Dt(function(n){return new nc(6e4*Math.floor(n/6e4))},function(n,t){n.setTime(n.getTime()+6e4*Math.floor(t))},function(n){return n.getMinutes()}),Qa.minutes=Qa.minute.range,Qa.minutes.utc=Qa.minute.utc.range,Qa.hour=Dt(function(n){var t=n.getTimezoneOffset()/60;return new nc(36e5*(Math.floor(n/36e5-t)+t))},function(n,t){n.setTime(n.getTime()+36e5*Math.floor(t))},function(n){return n.getHours()}),Qa.hours=Qa.hour.range,Qa.hours.utc=Qa.hour.utc.range,Qa.month=Dt(function(n){return n=Qa.day(n),n.setDate(1),n},function(n,t){n.setMonth(n.getMonth()+t)},function(n){return n.getMonth()}),Qa.months=Qa.month.range,Qa.months.utc=Qa.month.utc.range;var Us=[1e3,5e3,15e3,3e4,6e4,3e5,9e5,18e5,36e5,108e5,216e5,432e5,864e5,1728e5,6048e5,2592e6,7776e6,31536e6],js=[[Qa.second,1],[Qa.second,5],[Qa.second,15],[Qa.second,30],[Qa.minute,1],[Qa.minute,5],[Qa.minute,15],[Qa.minute,30],[Qa.hour,1],[Qa.hour,3],[Qa.hour,6],[Qa.hour,12],[Qa.day,1],[Qa.day,2],[Qa.week,1],[Qa.month,1],[Qa.month,3],[Qa.year,1]],Hs=Rs.multi([[".%L",function(n){return n.getMilliseconds()}],[":%S",function(n){return n.getSeconds()}],["%I:%M",function(n){return n.getMinutes()}],["%I %p",function(n){return n.getHours()}],["%a %d",function(n){return n.getDay()&&1!=n.getDate()}],["%b %d",function(n){return 1!=n.getDate()}],["%B",function(n){return n.getMonth()}],["%Y",we]]),Fs={range:function(n,t,e){return Zo.range(Math.ceil(n/e)*e,+t,e).map(Oo)},floor:wt,ceil:wt};js.year=Qa.year,Qa.scale=function(){return Fo(Zo.scale.linear(),js,Hs)};var Os=js.map(function(n){return[n[0].utc,n[1]]}),Ys=Ds.multi([[".%L",function(n){return n.getUTCMilliseconds()}],[":%S",function(n){return n.getUTCSeconds()}],["%I:%M",function(n){return n.getUTCMinutes()}],["%I %p",function(n){return n.getUTCHours()}],["%a %d",function(n){return n.getUTCDay()&&1!=n.getUTCDate()}],["%b %d",function(n){return 1!=n.getUTCDate()}],["%B",function(n){return n.getUTCMonth()}],["%Y",we]]);Os.year=Qa.year.utc,Qa.scale.utc=function(){return Fo(Zo.scale.linear(),Os,Ys)},Zo.text=St(function(n){return n.responseText}),Zo.json=function(n,t){return kt(n,"application/json",Yo,t)},Zo.html=function(n,t){return kt(n,"text/html",Io,t)},Zo.xml=St(function(n){return n.responseXML}),"function"==typeof define&&define.amd?define(Zo):"object"==typeof module&&module.exports&&(module.exports=Zo),this.d3=Zo}(); \ No newline at end of file diff --git a/js/scripts/helvetiker_bold.typeface.js b/js/scripts/helvetiker_bold.typeface.js new file mode 100755 index 0000000..c526cec --- /dev/null +++ b/js/scripts/helvetiker_bold.typeface.js @@ -0,0 +1 @@ +if (_typeface_js && _typeface_js.loadFace) _typeface_js.loadFace({"glyphs":{"ο":{"x_min":0,"x_max":764,"ha":863,"o":"m 380 -25 q 105 87 211 -25 q 0 372 0 200 q 104 660 0 545 q 380 775 209 775 q 658 659 552 775 q 764 372 764 544 q 658 87 764 200 q 380 -25 552 -25 m 379 142 q 515 216 466 142 q 557 373 557 280 q 515 530 557 465 q 379 607 466 607 q 245 530 294 607 q 204 373 204 465 q 245 218 204 283 q 379 142 294 142 "},"S":{"x_min":0,"x_max":826,"ha":915,"o":"m 826 306 q 701 55 826 148 q 423 -29 587 -29 q 138 60 255 -29 q 0 318 13 154 l 208 318 q 288 192 216 238 q 437 152 352 152 q 559 181 506 152 q 623 282 623 217 q 466 411 623 372 q 176 487 197 478 q 18 719 18 557 q 136 958 18 869 q 399 1040 244 1040 q 670 956 561 1040 q 791 713 791 864 l 591 713 q 526 826 583 786 q 393 866 469 866 q 277 838 326 866 q 218 742 218 804 q 374 617 218 655 q 667 542 646 552 q 826 306 826 471 "},"¦":{"x_min":0,"x_max":143,"ha":240,"o":"m 143 462 l 0 462 l 0 984 l 143 984 l 143 462 m 143 -242 l 0 -242 l 0 280 l 143 280 l 143 -242 "},"/":{"x_min":196.109375,"x_max":632.5625,"ha":828,"o":"m 632 1040 l 289 -128 l 196 -128 l 538 1040 l 632 1040 "},"Τ":{"x_min":-0.609375,"x_max":808,"ha":878,"o":"m 808 831 l 508 831 l 508 0 l 298 0 l 298 831 l 0 831 l 0 1013 l 808 1013 l 808 831 "},"y":{"x_min":0,"x_max":738.890625,"ha":828,"o":"m 738 749 l 444 -107 q 361 -238 413 -199 q 213 -277 308 -277 q 156 -275 176 -277 q 120 -271 131 -271 l 120 -110 q 147 -113 134 -111 q 179 -116 161 -116 q 247 -91 226 -116 q 269 -17 269 -67 q 206 173 269 -4 q 84 515 162 301 q 0 749 41 632 l 218 749 l 376 207 l 529 749 l 738 749 "},"Π":{"x_min":0,"x_max":809,"ha":922,"o":"m 809 0 l 598 0 l 598 836 l 208 836 l 208 0 l 0 0 l 0 1012 l 809 1012 l 809 0 "},"ΐ":{"x_min":-162,"x_max":364,"ha":364,"o":"m 364 810 l 235 810 l 235 952 l 364 952 l 364 810 m 301 1064 l 86 810 l -12 810 l 123 1064 l 301 1064 m -33 810 l -162 810 l -162 952 l -33 952 l -33 810 m 200 0 l 0 0 l 0 748 l 200 748 l 200 0 "},"g":{"x_min":0,"x_max":724,"ha":839,"o":"m 724 48 q 637 -223 724 -142 q 357 -304 551 -304 q 140 -253 226 -304 q 23 -72 36 -192 l 243 -72 q 290 -127 255 -110 q 368 -144 324 -144 q 504 -82 470 -144 q 530 71 530 -38 l 530 105 q 441 25 496 51 q 319 0 386 0 q 79 115 166 0 q 0 377 0 219 q 77 647 0 534 q 317 775 166 775 q 534 656 456 775 l 534 748 l 724 748 l 724 48 m 368 167 q 492 237 447 167 q 530 382 530 297 q 490 529 530 466 q 364 603 444 603 q 240 532 284 603 q 201 386 201 471 q 240 239 201 300 q 368 167 286 167 "},"²":{"x_min":0,"x_max":463,"ha":560,"o":"m 463 791 q 365 627 463 706 q 151 483 258 555 l 455 483 l 455 382 l 0 382 q 84 565 0 488 q 244 672 97 576 q 331 784 331 727 q 299 850 331 824 q 228 876 268 876 q 159 848 187 876 q 132 762 132 820 l 10 762 q 78 924 10 866 q 228 976 137 976 q 392 925 322 976 q 463 791 463 874 "},"–":{"x_min":0,"x_max":704.171875,"ha":801,"o":"m 704 297 l 0 297 l 0 450 l 704 450 l 704 297 "},"Κ":{"x_min":0,"x_max":899.671875,"ha":969,"o":"m 899 0 l 646 0 l 316 462 l 208 355 l 208 0 l 0 0 l 0 1013 l 208 1013 l 208 596 l 603 1013 l 863 1013 l 460 603 l 899 0 "},"ƒ":{"x_min":-46,"x_max":440,"ha":525,"o":"m 440 609 l 316 609 l 149 -277 l -46 -277 l 121 609 l 14 609 l 14 749 l 121 749 q 159 949 121 894 q 344 1019 208 1019 l 440 1015 l 440 855 l 377 855 q 326 841 338 855 q 314 797 314 827 q 314 773 314 786 q 314 749 314 761 l 440 749 l 440 609 "},"e":{"x_min":0,"x_max":708,"ha":808,"o":"m 708 321 l 207 321 q 254 186 207 236 q 362 141 298 141 q 501 227 453 141 l 700 227 q 566 36 662 104 q 362 -26 477 -26 q 112 72 213 -26 q 0 369 0 182 q 95 683 0 573 q 358 793 191 793 q 619 677 531 793 q 708 321 708 561 m 501 453 q 460 571 501 531 q 353 612 420 612 q 247 570 287 612 q 207 453 207 529 l 501 453 "},"ό":{"x_min":0,"x_max":764,"ha":863,"o":"m 380 -25 q 105 87 211 -25 q 0 372 0 200 q 104 660 0 545 q 380 775 209 775 q 658 659 552 775 q 764 372 764 544 q 658 87 764 200 q 380 -25 552 -25 m 379 142 q 515 216 466 142 q 557 373 557 280 q 515 530 557 465 q 379 607 466 607 q 245 530 294 607 q 204 373 204 465 q 245 218 204 283 q 379 142 294 142 m 593 1039 l 391 823 l 293 823 l 415 1039 l 593 1039 "},"J":{"x_min":0,"x_max":649,"ha":760,"o":"m 649 294 q 573 48 649 125 q 327 -29 497 -29 q 61 82 136 -29 q 0 375 0 173 l 200 375 l 199 309 q 219 194 199 230 q 321 145 249 145 q 418 193 390 145 q 441 307 441 232 l 441 1013 l 649 1013 l 649 294 "},"»":{"x_min":-0.234375,"x_max":526,"ha":624,"o":"m 526 286 l 297 87 l 296 250 l 437 373 l 297 495 l 297 660 l 526 461 l 526 286 m 229 286 l 0 87 l 0 250 l 140 373 l 0 495 l 0 660 l 229 461 l 229 286 "},"©":{"x_min":3,"x_max":1007,"ha":1104,"o":"m 507 -6 q 129 153 269 -6 q 3 506 3 298 q 127 857 3 713 q 502 1017 266 1017 q 880 855 740 1017 q 1007 502 1007 711 q 882 152 1007 295 q 507 -6 743 -6 m 502 934 q 184 800 302 934 q 79 505 79 680 q 184 210 79 331 q 501 76 302 76 q 819 210 701 76 q 925 507 925 331 q 820 800 925 682 q 502 934 704 934 m 758 410 q 676 255 748 313 q 506 197 605 197 q 298 291 374 197 q 229 499 229 377 q 297 713 229 624 q 494 811 372 811 q 666 760 593 811 q 752 616 739 710 l 621 616 q 587 688 621 658 q 509 719 554 719 q 404 658 441 719 q 368 511 368 598 q 403 362 368 427 q 498 298 438 298 q 624 410 606 298 l 758 410 "},"ώ":{"x_min":0,"x_max":945,"ha":1051,"o":"m 566 528 l 372 528 l 372 323 q 372 298 372 311 q 373 271 372 285 q 360 183 373 211 q 292 142 342 142 q 219 222 243 142 q 203 365 203 279 q 241 565 203 461 q 334 748 273 650 l 130 748 q 36 552 68 650 q 0 337 0 444 q 69 96 0 204 q 276 -29 149 -29 q 390 0 337 -29 q 470 78 444 28 q 551 0 495 30 q 668 -29 608 -29 q 874 96 793 -29 q 945 337 945 205 q 910 547 945 444 q 814 748 876 650 l 610 748 q 703 565 671 650 q 742 365 742 462 q 718 189 742 237 q 651 142 694 142 q 577 190 597 142 q 565 289 565 221 l 565 323 l 566 528 m 718 1039 l 516 823 l 417 823 l 540 1039 l 718 1039 "},"^":{"x_min":197.21875,"x_max":630.5625,"ha":828,"o":"m 630 836 l 536 836 l 413 987 l 294 836 l 197 836 l 331 1090 l 493 1090 l 630 836 "},"«":{"x_min":0,"x_max":526.546875,"ha":624,"o":"m 526 87 l 297 286 l 297 461 l 526 660 l 526 495 l 385 373 l 526 250 l 526 87 m 229 87 l 0 286 l 0 461 l 229 660 l 229 495 l 88 373 l 229 250 l 229 87 "},"D":{"x_min":0,"x_max":864,"ha":968,"o":"m 400 1013 q 736 874 608 1013 q 864 523 864 735 q 717 146 864 293 q 340 0 570 0 l 0 0 l 0 1013 l 400 1013 m 398 837 l 206 837 l 206 182 l 372 182 q 584 276 507 182 q 657 504 657 365 q 594 727 657 632 q 398 837 522 837 "},"∙":{"x_min":0,"x_max":207,"ha":304,"o":"m 207 528 l 0 528 l 0 735 l 207 735 l 207 528 "},"ÿ":{"x_min":0,"x_max":47,"ha":125,"o":"m 47 3 q 37 -7 47 -7 q 28 0 30 -7 q 39 -4 32 -4 q 45 3 45 -1 l 37 0 q 28 9 28 0 q 39 19 28 19 l 47 16 l 47 19 l 47 3 m 37 1 q 44 8 44 1 q 37 16 44 16 q 30 8 30 16 q 37 1 30 1 m 26 1 l 23 22 l 14 0 l 3 22 l 3 3 l 0 25 l 13 1 l 22 25 l 26 1 "},"w":{"x_min":0,"x_max":1056.953125,"ha":1150,"o":"m 1056 749 l 848 0 l 647 0 l 527 536 l 412 0 l 211 0 l 0 749 l 202 749 l 325 226 l 429 748 l 633 748 l 740 229 l 864 749 l 1056 749 "},"$":{"x_min":0,"x_max":704,"ha":800,"o":"m 682 693 l 495 693 q 468 782 491 749 q 391 831 441 824 l 391 579 q 633 462 562 534 q 704 259 704 389 q 616 57 704 136 q 391 -22 528 -22 l 391 -156 l 308 -156 l 308 -22 q 76 69 152 -7 q 0 300 0 147 l 183 300 q 215 191 190 230 q 308 128 245 143 l 308 414 q 84 505 157 432 q 12 700 12 578 q 89 902 12 824 q 308 981 166 981 l 308 1069 l 391 1069 l 391 981 q 595 905 521 981 q 682 693 670 829 m 308 599 l 308 831 q 228 796 256 831 q 200 712 200 762 q 225 642 200 668 q 308 599 251 617 m 391 128 q 476 174 449 140 q 504 258 504 207 q 391 388 504 354 l 391 128 "},"\\":{"x_min":-0.03125,"x_max":434.765625,"ha":532,"o":"m 434 -128 l 341 -128 l 0 1039 l 91 1040 l 434 -128 "},"µ":{"x_min":0,"x_max":647,"ha":754,"o":"m 647 0 l 478 0 l 478 68 q 412 9 448 30 q 330 -11 375 -11 q 261 3 296 -11 q 199 43 226 18 l 199 -277 l 0 -277 l 0 749 l 199 749 l 199 358 q 216 221 199 267 q 322 151 244 151 q 435 240 410 151 q 448 401 448 283 l 448 749 l 647 749 l 647 0 "},"Ι":{"x_min":42,"x_max":250,"ha":413,"o":"m 250 0 l 42 0 l 42 1013 l 250 1013 l 250 0 "},"Ύ":{"x_min":0,"x_max":1211.15625,"ha":1289,"o":"m 1211 1012 l 907 376 l 907 0 l 697 0 l 697 376 l 374 1012 l 583 1012 l 802 576 l 1001 1012 l 1211 1012 m 313 1035 l 98 780 l 0 780 l 136 1035 l 313 1035 "},"’":{"x_min":0,"x_max":192,"ha":289,"o":"m 192 834 q 137 692 192 751 q 0 626 83 634 l 0 697 q 101 831 101 723 l 0 831 l 0 1013 l 192 1013 l 192 834 "},"Ν":{"x_min":0,"x_max":833,"ha":946,"o":"m 833 0 l 617 0 l 206 696 l 206 0 l 0 0 l 0 1013 l 216 1013 l 629 315 l 629 1013 l 833 1013 l 833 0 "},"-":{"x_min":27.78125,"x_max":413.890625,"ha":525,"o":"m 413 279 l 27 279 l 27 468 l 413 468 l 413 279 "},"Q":{"x_min":0,"x_max":995.59375,"ha":1096,"o":"m 995 49 l 885 -70 l 762 42 q 641 -12 709 4 q 497 -29 572 -29 q 135 123 271 -29 q 0 504 0 276 q 131 881 0 731 q 497 1040 270 1040 q 859 883 719 1040 q 994 506 994 731 q 966 321 994 413 q 884 152 938 229 l 995 49 m 730 299 q 767 395 755 344 q 779 504 779 446 q 713 743 779 644 q 505 857 638 857 q 284 745 366 857 q 210 501 210 644 q 279 265 210 361 q 492 157 357 157 q 615 181 557 157 l 508 287 l 620 405 l 730 299 "},"ς":{"x_min":0,"x_max":731.78125,"ha":768,"o":"m 731 448 l 547 448 q 485 571 531 533 q 369 610 440 610 q 245 537 292 610 q 204 394 204 473 q 322 186 204 238 q 540 133 430 159 q 659 -15 659 98 q 643 -141 659 -80 q 595 -278 627 -202 l 423 -278 q 458 -186 448 -215 q 474 -88 474 -133 q 352 0 474 -27 q 123 80 181 38 q 0 382 0 170 q 98 660 0 549 q 367 777 202 777 q 622 683 513 777 q 731 448 731 589 "},"M":{"x_min":0,"x_max":1019,"ha":1135,"o":"m 1019 0 l 823 0 l 823 819 l 618 0 l 402 0 l 194 818 l 194 0 l 0 0 l 0 1013 l 309 1012 l 510 241 l 707 1013 l 1019 1013 l 1019 0 "},"Ψ":{"x_min":0,"x_max":995,"ha":1085,"o":"m 995 698 q 924 340 995 437 q 590 200 841 227 l 590 0 l 404 0 l 404 200 q 70 340 152 227 q 0 698 0 437 l 0 1013 l 188 1013 l 188 694 q 212 472 188 525 q 404 383 254 383 l 404 1013 l 590 1013 l 590 383 q 781 472 740 383 q 807 694 807 525 l 807 1013 l 995 1013 l 995 698 "},"C":{"x_min":0,"x_max":970.828125,"ha":1043,"o":"m 970 345 q 802 70 933 169 q 490 -29 672 -29 q 130 130 268 -29 q 0 506 0 281 q 134 885 0 737 q 502 1040 275 1040 q 802 939 668 1040 q 965 679 936 838 l 745 679 q 649 809 716 761 q 495 857 582 857 q 283 747 361 857 q 214 508 214 648 q 282 267 214 367 q 493 154 359 154 q 651 204 584 154 q 752 345 718 255 l 970 345 "},"!":{"x_min":0,"x_max":204,"ha":307,"o":"m 204 739 q 182 515 204 686 q 152 282 167 398 l 52 282 q 13 589 27 473 q 0 739 0 704 l 0 1013 l 204 1013 l 204 739 m 204 0 l 0 0 l 0 203 l 204 203 l 204 0 "},"{":{"x_min":0,"x_max":501.390625,"ha":599,"o":"m 501 -285 q 229 -209 301 -285 q 176 -35 176 -155 q 182 47 176 -8 q 189 126 189 103 q 156 245 189 209 q 0 294 112 294 l 0 438 q 154 485 111 438 q 189 603 189 522 q 186 666 189 636 q 176 783 176 772 q 231 945 176 894 q 501 1015 306 1015 l 501 872 q 370 833 408 872 q 340 737 340 801 q 342 677 340 705 q 353 569 353 579 q 326 451 353 496 q 207 366 291 393 q 327 289 294 346 q 353 164 353 246 q 348 79 353 132 q 344 17 344 26 q 372 -95 344 -58 q 501 -141 408 -141 l 501 -285 "},"X":{"x_min":0,"x_max":894.453125,"ha":999,"o":"m 894 0 l 654 0 l 445 351 l 238 0 l 0 0 l 316 516 l 0 1013 l 238 1013 l 445 659 l 652 1013 l 894 1013 l 577 519 l 894 0 "},"#":{"x_min":0,"x_max":1019.453125,"ha":1117,"o":"m 1019 722 l 969 582 l 776 581 l 717 417 l 919 417 l 868 279 l 668 278 l 566 -6 l 413 -5 l 516 279 l 348 279 l 247 -6 l 94 -6 l 196 278 l 0 279 l 49 417 l 245 417 l 304 581 l 98 582 l 150 722 l 354 721 l 455 1006 l 606 1006 l 507 721 l 673 722 l 776 1006 l 927 1006 l 826 721 l 1019 722 m 627 581 l 454 581 l 394 417 l 567 417 l 627 581 "},"ι":{"x_min":42,"x_max":242,"ha":389,"o":"m 242 0 l 42 0 l 42 749 l 242 749 l 242 0 "},"Ά":{"x_min":0,"x_max":995.828125,"ha":1072,"o":"m 313 1035 l 98 780 l 0 780 l 136 1035 l 313 1035 m 995 0 l 776 0 l 708 208 l 315 208 l 247 0 l 29 0 l 390 1012 l 629 1012 l 995 0 m 652 376 l 509 809 l 369 376 l 652 376 "},")":{"x_min":0,"x_max":389,"ha":486,"o":"m 389 357 q 319 14 389 187 q 145 -293 259 -134 l 0 -293 q 139 22 90 -142 q 189 358 189 187 q 139 689 189 525 q 0 1013 90 853 l 145 1013 q 319 703 258 857 q 389 357 389 528 "},"ε":{"x_min":16.671875,"x_max":652.78125,"ha":742,"o":"m 652 259 q 565 49 652 123 q 340 -25 479 -25 q 102 39 188 -25 q 16 197 16 104 q 45 299 16 249 q 134 390 75 348 q 58 456 86 419 q 25 552 25 502 q 120 717 25 653 q 322 776 208 776 q 537 710 456 776 q 625 508 625 639 l 445 508 q 415 585 445 563 q 327 608 386 608 q 254 590 293 608 q 215 544 215 573 q 252 469 215 490 q 336 453 280 453 q 369 455 347 453 q 400 456 391 456 l 400 308 l 329 308 q 247 291 280 308 q 204 223 204 269 q 255 154 204 172 q 345 143 286 143 q 426 174 398 143 q 454 259 454 206 l 652 259 "},"Δ":{"x_min":0,"x_max":981.953125,"ha":1057,"o":"m 981 0 l 0 0 l 386 1013 l 594 1013 l 981 0 m 715 175 l 490 765 l 266 175 l 715 175 "},"}":{"x_min":0,"x_max":500,"ha":597,"o":"m 500 294 q 348 246 390 294 q 315 128 315 209 q 320 42 315 101 q 326 -48 326 -17 q 270 -214 326 -161 q 0 -285 196 -285 l 0 -141 q 126 -97 90 -141 q 154 8 154 -64 q 150 91 154 37 q 146 157 146 145 q 172 281 146 235 q 294 366 206 339 q 173 451 208 390 q 146 576 146 500 q 150 655 146 603 q 154 731 154 708 q 126 831 154 799 q 0 872 90 872 l 0 1015 q 270 944 196 1015 q 326 777 326 891 q 322 707 326 747 q 313 593 313 612 q 347 482 313 518 q 500 438 390 438 l 500 294 "},"‰":{"x_min":0,"x_max":1681,"ha":1775,"o":"m 861 484 q 1048 404 979 484 q 1111 228 1111 332 q 1048 51 1111 123 q 859 -29 979 -29 q 672 50 740 -29 q 610 227 610 122 q 672 403 610 331 q 861 484 741 484 m 861 120 q 939 151 911 120 q 967 226 967 183 q 942 299 967 270 q 861 333 912 333 q 783 301 811 333 q 756 226 756 269 q 783 151 756 182 q 861 120 810 120 m 904 984 l 316 -28 l 205 -29 l 793 983 l 904 984 m 250 984 q 436 904 366 984 q 499 730 499 832 q 436 552 499 626 q 248 472 366 472 q 62 552 132 472 q 0 728 0 624 q 62 903 0 831 q 250 984 132 984 m 249 835 q 169 801 198 835 q 140 725 140 768 q 167 652 140 683 q 247 621 195 621 q 327 654 298 621 q 357 730 357 687 q 329 803 357 772 q 249 835 301 835 m 1430 484 q 1618 404 1548 484 q 1681 228 1681 332 q 1618 51 1681 123 q 1429 -29 1548 -29 q 1241 50 1309 -29 q 1179 227 1179 122 q 1241 403 1179 331 q 1430 484 1311 484 m 1431 120 q 1509 151 1481 120 q 1537 226 1537 183 q 1511 299 1537 270 q 1431 333 1482 333 q 1352 301 1380 333 q 1325 226 1325 269 q 1352 151 1325 182 q 1431 120 1379 120 "},"a":{"x_min":0,"x_max":700,"ha":786,"o":"m 700 0 l 488 0 q 465 93 469 45 q 365 5 427 37 q 233 -26 303 -26 q 65 37 130 -26 q 0 205 0 101 q 120 409 0 355 q 343 452 168 431 q 465 522 465 468 q 424 588 465 565 q 337 611 384 611 q 250 581 285 611 q 215 503 215 552 l 26 503 q 113 707 26 633 q 328 775 194 775 q 538 723 444 775 q 657 554 657 659 l 657 137 q 666 73 657 101 q 700 33 675 45 l 700 0 m 465 297 l 465 367 q 299 322 358 340 q 193 217 193 287 q 223 150 193 174 q 298 127 254 127 q 417 175 370 127 q 465 297 465 224 "},"—":{"x_min":0,"x_max":941.671875,"ha":1039,"o":"m 941 297 l 0 297 l 0 450 l 941 450 l 941 297 "},"=":{"x_min":29.171875,"x_max":798.609375,"ha":828,"o":"m 798 502 l 29 502 l 29 635 l 798 635 l 798 502 m 798 204 l 29 204 l 29 339 l 798 339 l 798 204 "},"N":{"x_min":0,"x_max":833,"ha":949,"o":"m 833 0 l 617 0 l 206 695 l 206 0 l 0 0 l 0 1013 l 216 1013 l 629 315 l 629 1013 l 833 1013 l 833 0 "},"ρ":{"x_min":0,"x_max":722,"ha":810,"o":"m 364 -17 q 271 0 313 -17 q 194 48 230 16 l 194 -278 l 0 -278 l 0 370 q 87 656 0 548 q 358 775 183 775 q 626 655 524 775 q 722 372 722 541 q 621 95 722 208 q 364 -17 520 -17 m 360 607 q 237 529 280 607 q 201 377 201 463 q 234 229 201 292 q 355 147 277 147 q 467 210 419 147 q 515 374 515 273 q 471 537 515 468 q 360 607 428 607 "},"2":{"x_min":64,"x_max":764,"ha":828,"o":"m 764 685 q 675 452 764 541 q 484 325 637 415 q 307 168 357 250 l 754 168 l 754 0 l 64 0 q 193 301 64 175 q 433 480 202 311 q 564 673 564 576 q 519 780 564 737 q 416 824 475 824 q 318 780 358 824 q 262 633 270 730 l 80 633 q 184 903 80 807 q 415 988 276 988 q 654 907 552 988 q 764 685 764 819 "},"¯":{"x_min":0,"x_max":775,"ha":771,"o":"m 775 958 l 0 958 l 0 1111 l 775 1111 l 775 958 "},"Z":{"x_min":0,"x_max":804.171875,"ha":906,"o":"m 804 836 l 251 182 l 793 182 l 793 0 l 0 0 l 0 176 l 551 830 l 11 830 l 11 1013 l 804 1013 l 804 836 "},"u":{"x_min":0,"x_max":668,"ha":782,"o":"m 668 0 l 474 0 l 474 89 q 363 9 425 37 q 233 -19 301 -19 q 61 53 123 -19 q 0 239 0 126 l 0 749 l 199 749 l 199 296 q 225 193 199 233 q 316 146 257 146 q 424 193 380 146 q 469 304 469 240 l 469 749 l 668 749 l 668 0 "},"k":{"x_min":0,"x_max":688.890625,"ha":771,"o":"m 688 0 l 450 0 l 270 316 l 196 237 l 196 0 l 0 0 l 0 1013 l 196 1013 l 196 483 l 433 748 l 675 748 l 413 469 l 688 0 "},"Η":{"x_min":0,"x_max":837,"ha":950,"o":"m 837 0 l 627 0 l 627 450 l 210 450 l 210 0 l 0 0 l 0 1013 l 210 1013 l 210 635 l 627 635 l 627 1013 l 837 1013 l 837 0 "},"Α":{"x_min":0,"x_max":966.671875,"ha":1043,"o":"m 966 0 l 747 0 l 679 208 l 286 208 l 218 0 l 0 0 l 361 1013 l 600 1013 l 966 0 m 623 376 l 480 809 l 340 376 l 623 376 "},"s":{"x_min":0,"x_max":681,"ha":775,"o":"m 681 229 q 568 33 681 105 q 340 -29 471 -29 q 107 39 202 -29 q 0 245 0 114 l 201 245 q 252 155 201 189 q 358 128 295 128 q 436 144 401 128 q 482 205 482 166 q 363 284 482 255 q 143 348 181 329 q 25 533 25 408 q 129 716 25 647 q 340 778 220 778 q 554 710 465 778 q 658 522 643 643 l 463 522 q 419 596 458 570 q 327 622 380 622 q 255 606 290 622 q 221 556 221 590 q 339 473 221 506 q 561 404 528 420 q 681 229 681 344 "},"B":{"x_min":0,"x_max":835,"ha":938,"o":"m 674 547 q 791 450 747 518 q 835 304 835 383 q 718 75 835 158 q 461 0 612 0 l 0 0 l 0 1013 l 477 1013 q 697 951 609 1013 q 797 754 797 880 q 765 630 797 686 q 674 547 734 575 m 438 621 q 538 646 495 621 q 590 730 590 676 q 537 814 590 785 q 436 838 494 838 l 199 838 l 199 621 l 438 621 m 445 182 q 561 211 513 182 q 618 311 618 247 q 565 410 618 375 q 444 446 512 446 l 199 446 l 199 182 l 445 182 "},"…":{"x_min":0,"x_max":819,"ha":963,"o":"m 206 0 l 0 0 l 0 207 l 206 207 l 206 0 m 512 0 l 306 0 l 306 207 l 512 207 l 512 0 m 819 0 l 613 0 l 613 207 l 819 207 l 819 0 "},"?":{"x_min":1,"x_max":687,"ha":785,"o":"m 687 734 q 621 563 687 634 q 501 454 560 508 q 436 293 436 386 l 251 293 l 251 391 q 363 557 251 462 q 476 724 476 653 q 432 827 476 788 q 332 866 389 866 q 238 827 275 866 q 195 699 195 781 l 1 699 q 110 955 1 861 q 352 1040 210 1040 q 582 963 489 1040 q 687 734 687 878 m 446 0 l 243 0 l 243 203 l 446 203 l 446 0 "},"H":{"x_min":0,"x_max":838,"ha":953,"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 "},"ν":{"x_min":0,"x_max":740.28125,"ha":828,"o":"m 740 749 l 473 0 l 266 0 l 0 749 l 222 749 l 373 211 l 529 749 l 740 749 "},"c":{"x_min":0,"x_max":751.390625,"ha":828,"o":"m 751 282 q 625 58 725 142 q 384 -26 526 -26 q 107 84 215 -26 q 0 366 0 195 q 98 651 0 536 q 370 774 204 774 q 616 700 518 774 q 751 486 715 626 l 536 486 q 477 570 516 538 q 380 607 434 607 q 248 533 298 607 q 204 378 204 466 q 242 219 204 285 q 377 139 290 139 q 483 179 438 139 q 543 282 527 220 l 751 282 "},"¶":{"x_min":0,"x_max":566.671875,"ha":678,"o":"m 21 892 l 52 892 l 98 761 l 145 892 l 176 892 l 178 741 l 157 741 l 157 867 l 108 741 l 88 741 l 40 871 l 40 741 l 21 741 l 21 892 m 308 854 l 308 731 q 252 691 308 691 q 227 691 240 691 q 207 696 213 695 l 207 712 l 253 706 q 288 733 288 706 l 288 763 q 244 741 279 741 q 193 797 193 741 q 261 860 193 860 q 287 860 273 860 q 308 854 302 855 m 288 842 l 263 843 q 213 796 213 843 q 248 756 213 756 q 288 796 288 756 l 288 842 m 566 988 l 502 988 l 502 -1 l 439 -1 l 439 988 l 317 988 l 317 -1 l 252 -1 l 252 602 q 81 653 155 602 q 0 805 0 711 q 101 989 0 918 q 309 1053 194 1053 l 566 1053 l 566 988 "},"β":{"x_min":0,"x_max":703,"ha":789,"o":"m 510 539 q 651 429 600 501 q 703 262 703 357 q 617 53 703 136 q 404 -29 532 -29 q 199 51 279 -29 l 199 -278 l 0 -278 l 0 627 q 77 911 0 812 q 343 1021 163 1021 q 551 957 464 1021 q 649 769 649 886 q 613 638 649 697 q 510 539 577 579 m 344 136 q 452 181 408 136 q 497 291 497 227 q 435 409 497 369 q 299 444 381 444 l 299 600 q 407 634 363 600 q 452 731 452 669 q 417 820 452 784 q 329 857 382 857 q 217 775 246 857 q 199 622 199 725 l 199 393 q 221 226 199 284 q 344 136 254 136 "},"Μ":{"x_min":0,"x_max":1019,"ha":1132,"o":"m 1019 0 l 823 0 l 823 818 l 617 0 l 402 0 l 194 818 l 194 0 l 0 0 l 0 1013 l 309 1013 l 509 241 l 708 1013 l 1019 1013 l 1019 0 "},"Ό":{"x_min":0.15625,"x_max":1174,"ha":1271,"o":"m 676 -29 q 312 127 451 -29 q 179 505 179 277 q 311 883 179 733 q 676 1040 449 1040 q 1040 883 901 1040 q 1174 505 1174 733 q 1041 127 1174 277 q 676 -29 903 -29 m 676 154 q 890 266 811 154 q 961 506 961 366 q 891 745 961 648 q 676 857 812 857 q 462 747 541 857 q 392 506 392 648 q 461 266 392 365 q 676 154 540 154 m 314 1034 l 98 779 l 0 779 l 136 1034 l 314 1034 "},"Ή":{"x_min":0,"x_max":1248,"ha":1361,"o":"m 1248 0 l 1038 0 l 1038 450 l 621 450 l 621 0 l 411 0 l 411 1012 l 621 1012 l 621 635 l 1038 635 l 1038 1012 l 1248 1012 l 1248 0 m 313 1035 l 98 780 l 0 780 l 136 1035 l 313 1035 "},"•":{"x_min":-27.78125,"x_max":691.671875,"ha":775,"o":"m 691 508 q 588 252 691 358 q 331 147 486 147 q 77 251 183 147 q -27 508 -27 355 q 75 761 -27 655 q 331 868 179 868 q 585 763 479 868 q 691 508 691 658 "},"¥":{"x_min":0,"x_max":836,"ha":931,"o":"m 195 625 l 0 1013 l 208 1013 l 427 576 l 626 1013 l 836 1013 l 650 625 l 777 625 l 777 472 l 578 472 l 538 389 l 777 389 l 777 236 l 532 236 l 532 0 l 322 0 l 322 236 l 79 236 l 79 389 l 315 389 l 273 472 l 79 472 l 79 625 l 195 625 "},"(":{"x_min":0,"x_max":388.890625,"ha":486,"o":"m 388 -293 l 243 -293 q 70 14 130 -134 q 0 357 0 189 q 69 703 0 526 q 243 1013 129 856 l 388 1013 q 248 695 297 860 q 200 358 200 530 q 248 24 200 187 q 388 -293 297 -138 "},"U":{"x_min":0,"x_max":813,"ha":926,"o":"m 813 362 q 697 79 813 187 q 405 -29 582 -29 q 114 78 229 -29 q 0 362 0 186 l 0 1013 l 210 1013 l 210 387 q 260 226 210 291 q 408 154 315 154 q 554 226 500 154 q 603 387 603 291 l 603 1013 l 813 1013 l 813 362 "},"γ":{"x_min":0.0625,"x_max":729.234375,"ha":815,"o":"m 729 749 l 457 37 l 457 -278 l 257 -278 l 257 37 q 218 155 243 95 q 170 275 194 215 l 0 749 l 207 749 l 363 284 l 522 749 l 729 749 "},"α":{"x_min":-1,"x_max":722,"ha":835,"o":"m 722 0 l 531 0 l 530 101 q 433 8 491 41 q 304 -25 375 -25 q 72 104 157 -25 q -1 372 -1 216 q 72 643 -1 530 q 308 775 158 775 q 433 744 375 775 q 528 656 491 713 l 528 749 l 722 749 l 722 0 m 361 601 q 233 527 277 601 q 196 375 196 464 q 232 224 196 288 q 358 144 277 144 q 487 217 441 144 q 528 370 528 281 q 489 523 528 457 q 361 601 443 601 "},"F":{"x_min":0,"x_max":706.953125,"ha":778,"o":"m 706 837 l 206 837 l 206 606 l 645 606 l 645 431 l 206 431 l 206 0 l 0 0 l 0 1013 l 706 1013 l 706 837 "},"­":{"x_min":0,"x_max":704.171875,"ha":801,"o":"m 704 297 l 0 297 l 0 450 l 704 450 l 704 297 "},":":{"x_min":0,"x_max":207,"ha":304,"o":"m 207 528 l 0 528 l 0 735 l 207 735 l 207 528 m 207 0 l 0 0 l 0 207 l 207 207 l 207 0 "},"Χ":{"x_min":0,"x_max":894.453125,"ha":978,"o":"m 894 0 l 654 0 l 445 351 l 238 0 l 0 0 l 316 516 l 0 1013 l 238 1013 l 445 660 l 652 1013 l 894 1013 l 577 519 l 894 0 "},"*":{"x_min":115,"x_max":713,"ha":828,"o":"m 713 740 l 518 688 l 651 525 l 531 438 l 412 612 l 290 439 l 173 523 l 308 688 l 115 741 l 159 880 l 342 816 l 343 1013 l 482 1013 l 481 816 l 664 880 l 713 740 "},"†":{"x_min":0,"x_max":809,"ha":894,"o":"m 509 804 l 809 804 l 809 621 l 509 621 l 509 0 l 299 0 l 299 621 l 0 621 l 0 804 l 299 804 l 299 1011 l 509 1011 l 509 804 "},"°":{"x_min":-1,"x_max":363,"ha":460,"o":"m 181 808 q 46 862 94 808 q -1 992 -1 917 q 44 1118 -1 1066 q 181 1175 96 1175 q 317 1118 265 1175 q 363 991 363 1066 q 315 862 363 917 q 181 808 267 808 m 181 908 q 240 933 218 908 q 263 992 263 958 q 242 1051 263 1027 q 181 1075 221 1075 q 120 1050 142 1075 q 99 991 99 1026 q 120 933 99 958 q 181 908 142 908 "},"V":{"x_min":0,"x_max":895.828125,"ha":997,"o":"m 895 1013 l 550 0 l 347 0 l 0 1013 l 231 1013 l 447 256 l 666 1013 l 895 1013 "},"Ξ":{"x_min":0,"x_max":751.390625,"ha":800,"o":"m 733 826 l 5 826 l 5 1012 l 733 1012 l 733 826 m 681 432 l 65 432 l 65 617 l 681 617 l 681 432 m 751 0 l 0 0 l 0 183 l 751 183 l 751 0 "}," ":{"x_min":0,"x_max":0,"ha":853},"Ϋ":{"x_min":-0.21875,"x_max":836.171875,"ha":914,"o":"m 610 1046 l 454 1046 l 454 1215 l 610 1215 l 610 1046 m 369 1046 l 212 1046 l 212 1215 l 369 1215 l 369 1046 m 836 1012 l 532 376 l 532 0 l 322 0 l 322 376 l 0 1012 l 208 1012 l 427 576 l 626 1012 l 836 1012 "},"0":{"x_min":51,"x_max":779,"ha":828,"o":"m 415 -26 q 142 129 242 -26 q 51 476 51 271 q 141 825 51 683 q 415 984 242 984 q 687 825 585 984 q 779 476 779 682 q 688 131 779 271 q 415 -26 587 -26 m 415 137 q 529 242 485 137 q 568 477 568 338 q 530 713 568 619 q 415 821 488 821 q 303 718 344 821 q 262 477 262 616 q 301 237 262 337 q 415 137 341 137 "},"”":{"x_min":0,"x_max":469,"ha":567,"o":"m 192 834 q 137 692 192 751 q 0 626 83 634 l 0 697 q 101 831 101 723 l 0 831 l 0 1013 l 192 1013 l 192 834 m 469 834 q 414 692 469 751 q 277 626 360 634 l 277 697 q 379 831 379 723 l 277 831 l 277 1013 l 469 1013 l 469 834 "},"@":{"x_min":0,"x_max":1276,"ha":1374,"o":"m 1115 -52 q 895 -170 1015 -130 q 647 -211 776 -211 q 158 -34 334 -211 q 0 360 0 123 q 179 810 0 621 q 698 1019 377 1019 q 1138 859 981 1019 q 1276 514 1276 720 q 1173 210 1276 335 q 884 75 1062 75 q 784 90 810 75 q 737 186 749 112 q 647 104 698 133 q 532 75 596 75 q 360 144 420 75 q 308 308 308 205 q 398 568 308 451 q 638 696 497 696 q 731 671 690 696 q 805 604 772 647 l 840 673 l 964 673 q 886 373 915 490 q 856 239 856 257 q 876 201 856 214 q 920 188 895 188 q 1084 284 1019 188 q 1150 511 1150 380 q 1051 779 1150 672 q 715 905 934 905 q 272 734 439 905 q 121 363 121 580 q 250 41 121 170 q 647 -103 394 -103 q 863 -67 751 -103 q 1061 26 975 -32 l 1115 -52 m 769 483 q 770 500 770 489 q 733 567 770 539 q 651 596 695 596 q 508 504 566 596 q 457 322 457 422 q 483 215 457 256 q 561 175 509 175 q 671 221 625 175 q 733 333 718 268 l 769 483 "},"Ί":{"x_min":0,"x_max":619,"ha":732,"o":"m 313 1035 l 98 780 l 0 780 l 136 1035 l 313 1035 m 619 0 l 411 0 l 411 1012 l 619 1012 l 619 0 "},"i":{"x_min":14,"x_max":214,"ha":326,"o":"m 214 830 l 14 830 l 14 1013 l 214 1013 l 214 830 m 214 0 l 14 0 l 14 748 l 214 748 l 214 0 "},"Β":{"x_min":0,"x_max":835,"ha":961,"o":"m 675 547 q 791 450 747 518 q 835 304 835 383 q 718 75 835 158 q 461 0 612 0 l 0 0 l 0 1013 l 477 1013 q 697 951 609 1013 q 797 754 797 880 q 766 630 797 686 q 675 547 734 575 m 439 621 q 539 646 496 621 q 590 730 590 676 q 537 814 590 785 q 436 838 494 838 l 199 838 l 199 621 l 439 621 m 445 182 q 561 211 513 182 q 618 311 618 247 q 565 410 618 375 q 444 446 512 446 l 199 446 l 199 182 l 445 182 "},"υ":{"x_min":0,"x_max":656,"ha":767,"o":"m 656 416 q 568 55 656 145 q 326 -25 490 -25 q 59 97 137 -25 q 0 369 0 191 l 0 749 l 200 749 l 200 369 q 216 222 200 268 q 326 142 245 142 q 440 247 411 142 q 456 422 456 304 l 456 749 l 656 749 l 656 416 "},"]":{"x_min":0,"x_max":349,"ha":446,"o":"m 349 -300 l 0 -300 l 0 -154 l 163 -154 l 163 866 l 0 866 l 0 1013 l 349 1013 l 349 -300 "},"m":{"x_min":0,"x_max":1065,"ha":1174,"o":"m 1065 0 l 866 0 l 866 483 q 836 564 866 532 q 759 596 807 596 q 663 555 700 596 q 627 454 627 514 l 627 0 l 433 0 l 433 481 q 403 563 433 531 q 323 596 374 596 q 231 554 265 596 q 197 453 197 513 l 197 0 l 0 0 l 0 748 l 189 748 l 189 665 q 279 745 226 715 q 392 775 333 775 q 509 744 455 775 q 606 659 563 713 q 695 744 640 713 q 814 775 749 775 q 992 702 920 775 q 1065 523 1065 630 l 1065 0 "},"χ":{"x_min":0,"x_max":759.71875,"ha":847,"o":"m 759 -299 l 548 -299 l 379 66 l 215 -299 l 0 -299 l 261 233 l 13 749 l 230 749 l 379 400 l 527 749 l 738 749 l 500 238 l 759 -299 "},"8":{"x_min":57,"x_max":770,"ha":828,"o":"m 625 516 q 733 416 697 477 q 770 284 770 355 q 675 69 770 161 q 415 -29 574 -29 q 145 65 244 -29 q 57 273 57 150 q 93 413 57 350 q 204 516 130 477 q 112 609 142 556 q 83 718 83 662 q 177 905 83 824 q 414 986 272 986 q 650 904 555 986 q 745 715 745 822 q 716 608 745 658 q 625 516 688 558 m 414 590 q 516 624 479 590 q 553 706 553 659 q 516 791 553 755 q 414 828 480 828 q 311 792 348 828 q 275 706 275 757 q 310 624 275 658 q 414 590 345 590 m 413 135 q 527 179 487 135 q 564 279 564 218 q 525 386 564 341 q 411 436 482 436 q 298 387 341 436 q 261 282 261 344 q 300 178 261 222 q 413 135 340 135 "},"ί":{"x_min":42,"x_max":371.171875,"ha":389,"o":"m 242 0 l 42 0 l 42 748 l 242 748 l 242 0 m 371 1039 l 169 823 l 71 823 l 193 1039 l 371 1039 "},"Ζ":{"x_min":0,"x_max":804.171875,"ha":886,"o":"m 804 835 l 251 182 l 793 182 l 793 0 l 0 0 l 0 176 l 551 829 l 11 829 l 11 1012 l 804 1012 l 804 835 "},"R":{"x_min":0,"x_max":836.109375,"ha":947,"o":"m 836 0 l 608 0 q 588 53 596 20 q 581 144 581 86 q 581 179 581 162 q 581 215 581 197 q 553 345 581 306 q 428 393 518 393 l 208 393 l 208 0 l 0 0 l 0 1013 l 491 1013 q 720 944 630 1013 q 819 734 819 869 q 778 584 819 654 q 664 485 738 513 q 757 415 727 463 q 794 231 794 358 l 794 170 q 800 84 794 116 q 836 31 806 51 l 836 0 m 462 838 l 208 838 l 208 572 l 452 572 q 562 604 517 572 q 612 704 612 640 q 568 801 612 765 q 462 838 525 838 "},"o":{"x_min":0,"x_max":764,"ha":871,"o":"m 380 -26 q 105 86 211 -26 q 0 371 0 199 q 104 660 0 545 q 380 775 209 775 q 658 659 552 775 q 764 371 764 544 q 658 86 764 199 q 380 -26 552 -26 m 379 141 q 515 216 466 141 q 557 373 557 280 q 515 530 557 465 q 379 607 466 607 q 245 530 294 607 q 204 373 204 465 q 245 217 204 282 q 379 141 294 141 "},"5":{"x_min":59,"x_max":767,"ha":828,"o":"m 767 319 q 644 59 767 158 q 382 -29 533 -29 q 158 43 247 -29 q 59 264 59 123 l 252 264 q 295 165 252 201 q 400 129 339 129 q 512 172 466 129 q 564 308 564 220 q 514 437 564 387 q 398 488 464 488 q 329 472 361 488 q 271 420 297 456 l 93 428 l 157 958 l 722 958 l 722 790 l 295 790 l 271 593 q 348 635 306 621 q 431 649 389 649 q 663 551 560 649 q 767 319 767 453 "},"7":{"x_min":65.28125,"x_max":762.5,"ha":828,"o":"m 762 808 q 521 435 604 626 q 409 0 438 244 l 205 0 q 313 422 227 234 q 548 789 387 583 l 65 789 l 65 958 l 762 958 l 762 808 "},"K":{"x_min":0,"x_max":900,"ha":996,"o":"m 900 0 l 647 0 l 316 462 l 208 355 l 208 0 l 0 0 l 0 1013 l 208 1013 l 208 595 l 604 1013 l 863 1013 l 461 603 l 900 0 "},",":{"x_min":0,"x_max":206,"ha":303,"o":"m 206 5 q 150 -151 206 -88 q 0 -238 94 -213 l 0 -159 q 84 -100 56 -137 q 111 -2 111 -62 l 0 -2 l 0 205 l 206 205 l 206 5 "},"d":{"x_min":0,"x_max":722,"ha":836,"o":"m 722 0 l 530 0 l 530 101 q 303 -26 449 -26 q 72 103 155 -26 q 0 373 0 214 q 72 642 0 528 q 305 775 156 775 q 433 743 373 775 q 530 656 492 712 l 530 1013 l 722 1013 l 722 0 m 361 600 q 234 523 280 600 q 196 372 196 458 q 233 220 196 286 q 358 143 278 143 q 489 216 442 143 q 530 369 530 280 q 491 522 530 456 q 361 600 443 600 "},"¨":{"x_min":212,"x_max":609,"ha":933,"o":"m 609 1046 l 453 1046 l 453 1216 l 609 1216 l 609 1046 m 369 1046 l 212 1046 l 212 1216 l 369 1216 l 369 1046 "},"E":{"x_min":0,"x_max":761.109375,"ha":824,"o":"m 761 0 l 0 0 l 0 1013 l 734 1013 l 734 837 l 206 837 l 206 621 l 690 621 l 690 446 l 206 446 l 206 186 l 761 186 l 761 0 "},"Y":{"x_min":0,"x_max":836,"ha":931,"o":"m 836 1013 l 532 376 l 532 0 l 322 0 l 322 376 l 0 1013 l 208 1013 l 427 576 l 626 1013 l 836 1013 "},"\"":{"x_min":0,"x_max":357,"ha":454,"o":"m 357 604 l 225 604 l 225 988 l 357 988 l 357 604 m 132 604 l 0 604 l 0 988 l 132 988 l 132 604 "},"‹":{"x_min":35.984375,"x_max":791.671875,"ha":828,"o":"m 791 17 l 36 352 l 35 487 l 791 823 l 791 672 l 229 421 l 791 168 l 791 17 "},"„":{"x_min":0,"x_max":483,"ha":588,"o":"m 206 5 q 150 -151 206 -88 q 0 -238 94 -213 l 0 -159 q 84 -100 56 -137 q 111 -2 111 -62 l 0 -2 l 0 205 l 206 205 l 206 5 m 483 5 q 427 -151 483 -88 q 277 -238 371 -213 l 277 -159 q 361 -100 334 -137 q 388 -2 388 -62 l 277 -2 l 277 205 l 483 205 l 483 5 "},"δ":{"x_min":6,"x_max":732,"ha":835,"o":"m 732 352 q 630 76 732 177 q 354 -25 529 -25 q 101 74 197 -25 q 6 333 6 174 q 89 581 6 480 q 323 690 178 690 q 66 864 201 787 l 66 1013 l 669 1013 l 669 856 l 348 856 q 532 729 461 789 q 673 566 625 651 q 732 352 732 465 m 419 551 q 259 496 321 551 q 198 344 198 441 q 238 208 198 267 q 357 140 283 140 q 484 203 437 140 q 526 344 526 260 q 499 466 526 410 q 419 551 473 521 "},"έ":{"x_min":16.671875,"x_max":652.78125,"ha":742,"o":"m 652 259 q 565 49 652 123 q 340 -25 479 -25 q 102 39 188 -25 q 16 197 16 104 q 45 299 16 250 q 134 390 75 348 q 58 456 86 419 q 25 552 25 502 q 120 717 25 653 q 322 776 208 776 q 537 710 456 776 q 625 508 625 639 l 445 508 q 415 585 445 563 q 327 608 386 608 q 254 590 293 608 q 215 544 215 573 q 252 469 215 490 q 336 453 280 453 q 369 455 347 453 q 400 456 391 456 l 400 308 l 329 308 q 247 291 280 308 q 204 223 204 269 q 255 154 204 172 q 345 143 286 143 q 426 174 398 143 q 454 259 454 206 l 652 259 m 579 1039 l 377 823 l 279 823 l 401 1039 l 579 1039 "},"ω":{"x_min":0,"x_max":945,"ha":1051,"o":"m 565 323 l 565 289 q 577 190 565 221 q 651 142 597 142 q 718 189 694 142 q 742 365 742 237 q 703 565 742 462 q 610 749 671 650 l 814 749 q 910 547 876 650 q 945 337 945 444 q 874 96 945 205 q 668 -29 793 -29 q 551 0 608 -29 q 470 78 495 30 q 390 0 444 28 q 276 -29 337 -29 q 69 96 149 -29 q 0 337 0 204 q 36 553 0 444 q 130 749 68 650 l 334 749 q 241 565 273 650 q 203 365 203 461 q 219 222 203 279 q 292 142 243 142 q 360 183 342 142 q 373 271 373 211 q 372 298 372 285 q 372 323 372 311 l 372 528 l 566 528 l 565 323 "},"´":{"x_min":0,"x_max":132,"ha":299,"o":"m 132 604 l 0 604 l 0 988 l 132 988 l 132 604 "},"±":{"x_min":29,"x_max":798,"ha":828,"o":"m 798 480 l 484 480 l 484 254 l 344 254 l 344 480 l 29 480 l 29 615 l 344 615 l 344 842 l 484 842 l 484 615 l 798 615 l 798 480 m 798 0 l 29 0 l 29 136 l 798 136 l 798 0 "},"|":{"x_min":0,"x_max":143,"ha":240,"o":"m 143 462 l 0 462 l 0 984 l 143 984 l 143 462 m 143 -242 l 0 -242 l 0 280 l 143 280 l 143 -242 "},"ϋ":{"x_min":0,"x_max":656,"ha":767,"o":"m 535 810 l 406 810 l 406 952 l 535 952 l 535 810 m 271 810 l 142 810 l 142 952 l 271 952 l 271 810 m 656 417 q 568 55 656 146 q 326 -25 490 -25 q 59 97 137 -25 q 0 369 0 192 l 0 748 l 200 748 l 200 369 q 216 222 200 268 q 326 142 245 142 q 440 247 411 142 q 456 422 456 304 l 456 748 l 656 748 l 656 417 "},"§":{"x_min":0,"x_max":633,"ha":731,"o":"m 633 469 q 601 356 633 406 q 512 274 569 305 q 570 197 548 242 q 593 105 593 152 q 501 -76 593 -5 q 301 -142 416 -142 q 122 -82 193 -142 q 43 108 43 -15 l 212 108 q 251 27 220 53 q 321 1 283 1 q 389 23 360 1 q 419 83 419 46 q 310 194 419 139 q 108 297 111 295 q 0 476 0 372 q 33 584 0 537 q 120 659 62 626 q 72 720 91 686 q 53 790 53 755 q 133 978 53 908 q 312 1042 207 1042 q 483 984 412 1042 q 574 807 562 921 l 409 807 q 379 875 409 851 q 307 900 349 900 q 244 881 270 900 q 218 829 218 862 q 324 731 218 781 q 524 636 506 647 q 633 469 633 565 m 419 334 q 473 411 473 372 q 451 459 473 436 q 390 502 430 481 l 209 595 q 167 557 182 577 q 153 520 153 537 q 187 461 153 491 q 263 413 212 440 l 419 334 "},"b":{"x_min":0,"x_max":722,"ha":822,"o":"m 416 -26 q 289 6 346 -26 q 192 101 232 39 l 192 0 l 0 0 l 0 1013 l 192 1013 l 192 656 q 286 743 226 712 q 415 775 346 775 q 649 644 564 775 q 722 374 722 533 q 649 106 722 218 q 416 -26 565 -26 m 361 600 q 232 524 279 600 q 192 371 192 459 q 229 221 192 284 q 357 145 275 145 q 487 221 441 145 q 526 374 526 285 q 488 523 526 460 q 361 600 442 600 "},"q":{"x_min":0,"x_max":722,"ha":833,"o":"m 722 -298 l 530 -298 l 530 97 q 306 -25 449 -25 q 73 104 159 -25 q 0 372 0 216 q 72 643 0 529 q 305 775 156 775 q 430 742 371 775 q 530 654 488 709 l 530 750 l 722 750 l 722 -298 m 360 601 q 234 527 278 601 q 197 378 197 466 q 233 225 197 291 q 357 144 277 144 q 488 217 441 144 q 530 370 530 282 q 491 523 530 459 q 360 601 443 601 "},"Ω":{"x_min":-0.03125,"x_max":1008.53125,"ha":1108,"o":"m 1008 0 l 589 0 l 589 199 q 717 368 670 265 q 764 580 764 471 q 698 778 764 706 q 504 855 629 855 q 311 773 380 855 q 243 563 243 691 q 289 360 243 458 q 419 199 336 262 l 419 0 l 0 0 l 0 176 l 202 176 q 77 355 123 251 q 32 569 32 459 q 165 908 32 776 q 505 1040 298 1040 q 844 912 711 1040 q 977 578 977 785 q 931 362 977 467 q 805 176 886 256 l 1008 176 l 1008 0 "},"ύ":{"x_min":0,"x_max":656,"ha":767,"o":"m 656 417 q 568 55 656 146 q 326 -25 490 -25 q 59 97 137 -25 q 0 369 0 192 l 0 748 l 200 748 l 201 369 q 218 222 201 269 q 326 142 245 142 q 440 247 411 142 q 456 422 456 304 l 456 748 l 656 748 l 656 417 m 579 1039 l 378 823 l 279 823 l 401 1039 l 579 1039 "},"z":{"x_min":0,"x_max":663.890625,"ha":753,"o":"m 663 0 l 0 0 l 0 154 l 411 591 l 25 591 l 25 749 l 650 749 l 650 584 l 245 165 l 663 165 l 663 0 "},"™":{"x_min":0,"x_max":951,"ha":1063,"o":"m 405 921 l 255 921 l 255 506 l 149 506 l 149 921 l 0 921 l 0 1013 l 405 1013 l 405 921 m 951 506 l 852 506 l 852 916 l 750 506 l 643 506 l 539 915 l 539 506 l 442 506 l 442 1013 l 595 1012 l 695 625 l 794 1013 l 951 1013 l 951 506 "},"ή":{"x_min":0,"x_max":669,"ha":779,"o":"m 669 -278 l 469 -278 l 469 390 q 448 526 469 473 q 348 606 417 606 q 244 553 288 606 q 201 441 201 501 l 201 0 l 0 0 l 0 749 l 201 749 l 201 665 q 301 744 244 715 q 423 774 359 774 q 606 685 538 774 q 669 484 669 603 l 669 -278 m 495 1039 l 293 823 l 195 823 l 317 1039 l 495 1039 "},"Θ":{"x_min":0,"x_max":993,"ha":1092,"o":"m 497 -29 q 133 127 272 -29 q 0 505 0 277 q 133 883 0 733 q 497 1040 272 1040 q 861 883 722 1040 q 993 505 993 733 q 861 127 993 277 q 497 -29 722 -29 m 497 154 q 711 266 631 154 q 782 506 782 367 q 712 746 782 648 q 497 858 634 858 q 281 746 361 858 q 211 506 211 648 q 280 266 211 365 q 497 154 359 154 m 676 430 l 316 430 l 316 593 l 676 593 l 676 430 "},"®":{"x_min":3,"x_max":1007,"ha":1104,"o":"m 507 -6 q 129 153 269 -6 q 3 506 3 298 q 127 857 3 713 q 502 1017 266 1017 q 880 855 740 1017 q 1007 502 1007 711 q 882 152 1007 295 q 507 -6 743 -6 m 502 934 q 184 800 302 934 q 79 505 79 680 q 184 210 79 331 q 501 76 302 76 q 819 210 701 76 q 925 507 925 331 q 820 800 925 682 q 502 934 704 934 m 782 190 l 639 190 q 627 225 632 202 q 623 285 623 248 l 623 326 q 603 411 623 384 q 527 439 584 439 l 388 439 l 388 190 l 257 190 l 257 829 l 566 829 q 709 787 654 829 q 772 654 772 740 q 746 559 772 604 q 675 497 720 514 q 735 451 714 483 q 756 341 756 419 l 756 299 q 760 244 756 265 q 782 212 764 223 l 782 190 m 546 718 l 388 718 l 388 552 l 541 552 q 612 572 584 552 q 641 635 641 593 q 614 695 641 672 q 546 718 587 718 "},"~":{"x_min":0,"x_max":851,"ha":949,"o":"m 851 968 q 795 750 851 831 q 599 656 730 656 q 406 744 506 656 q 259 832 305 832 q 162 775 193 832 q 139 656 139 730 l 0 656 q 58 871 0 787 q 251 968 124 968 q 442 879 341 968 q 596 791 544 791 q 691 849 663 791 q 712 968 712 892 l 851 968 "},"Ε":{"x_min":0,"x_max":761.546875,"ha":824,"o":"m 761 0 l 0 0 l 0 1012 l 735 1012 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 "},"³":{"x_min":0,"x_max":467,"ha":564,"o":"m 467 555 q 393 413 467 466 q 229 365 325 365 q 70 413 134 365 q 0 565 0 467 l 123 565 q 163 484 131 512 q 229 461 190 461 q 299 486 269 461 q 329 553 329 512 q 281 627 329 607 q 187 641 248 641 l 187 722 q 268 737 237 722 q 312 804 312 758 q 285 859 312 837 q 224 882 259 882 q 165 858 189 882 q 135 783 140 834 l 12 783 q 86 930 20 878 q 230 976 145 976 q 379 931 314 976 q 444 813 444 887 q 423 744 444 773 q 365 695 402 716 q 439 640 412 676 q 467 555 467 605 "},"[":{"x_min":0,"x_max":347.21875,"ha":444,"o":"m 347 -300 l 0 -300 l 0 1013 l 347 1013 l 347 866 l 188 866 l 188 -154 l 347 -154 l 347 -300 "},"L":{"x_min":0,"x_max":704.171875,"ha":763,"o":"m 704 0 l 0 0 l 0 1013 l 208 1013 l 208 186 l 704 186 l 704 0 "},"σ":{"x_min":0,"x_max":851.3125,"ha":940,"o":"m 851 594 l 712 594 q 761 369 761 485 q 658 83 761 191 q 379 -25 555 -25 q 104 87 208 -25 q 0 372 0 200 q 103 659 0 544 q 378 775 207 775 q 464 762 407 775 q 549 750 521 750 l 851 750 l 851 594 m 379 142 q 515 216 466 142 q 557 373 557 280 q 515 530 557 465 q 379 608 465 608 q 244 530 293 608 q 203 373 203 465 q 244 218 203 283 q 379 142 293 142 "},"ζ":{"x_min":0,"x_max":622,"ha":701,"o":"m 622 -32 q 604 -158 622 -98 q 551 -278 587 -218 l 373 -278 q 426 -180 406 -229 q 446 -80 446 -131 q 421 -22 446 -37 q 354 -8 397 -8 q 316 -9 341 -8 q 280 -11 291 -11 q 75 69 150 -11 q 0 283 0 150 q 87 596 0 437 q 291 856 162 730 l 47 856 l 47 1013 l 592 1013 l 592 904 q 317 660 422 800 q 197 318 197 497 q 306 141 197 169 q 510 123 408 131 q 622 -32 622 102 "},"θ":{"x_min":0,"x_max":714,"ha":817,"o":"m 357 1022 q 633 833 534 1022 q 714 486 714 679 q 634 148 714 288 q 354 -25 536 -25 q 79 147 175 -25 q 0 481 0 288 q 79 831 0 679 q 357 1022 177 1022 m 510 590 q 475 763 510 687 q 351 862 430 862 q 233 763 272 862 q 204 590 204 689 l 510 590 m 510 440 l 204 440 q 233 251 204 337 q 355 131 274 131 q 478 248 434 131 q 510 440 510 337 "},"Ο":{"x_min":0,"x_max":995,"ha":1092,"o":"m 497 -29 q 133 127 272 -29 q 0 505 0 277 q 132 883 0 733 q 497 1040 270 1040 q 861 883 722 1040 q 995 505 995 733 q 862 127 995 277 q 497 -29 724 -29 m 497 154 q 711 266 632 154 q 781 506 781 365 q 711 745 781 647 q 497 857 632 857 q 283 747 361 857 q 213 506 213 647 q 282 266 213 365 q 497 154 361 154 "},"Γ":{"x_min":0,"x_max":703.84375,"ha":742,"o":"m 703 836 l 208 836 l 208 0 l 0 0 l 0 1012 l 703 1012 l 703 836 "}," ":{"x_min":0,"x_max":0,"ha":375},"%":{"x_min":0,"x_max":1111,"ha":1213,"o":"m 861 484 q 1048 404 979 484 q 1111 228 1111 332 q 1048 51 1111 123 q 859 -29 979 -29 q 672 50 740 -29 q 610 227 610 122 q 672 403 610 331 q 861 484 741 484 m 861 120 q 939 151 911 120 q 967 226 967 183 q 942 299 967 270 q 861 333 912 333 q 783 301 811 333 q 756 226 756 269 q 783 151 756 182 q 861 120 810 120 m 904 984 l 316 -28 l 205 -29 l 793 983 l 904 984 m 250 984 q 436 904 366 984 q 499 730 499 832 q 436 552 499 626 q 248 472 366 472 q 62 552 132 472 q 0 728 0 624 q 62 903 0 831 q 250 984 132 984 m 249 835 q 169 801 198 835 q 140 725 140 768 q 167 652 140 683 q 247 621 195 621 q 327 654 298 621 q 357 730 357 687 q 329 803 357 772 q 249 835 301 835 "},"P":{"x_min":0,"x_max":771,"ha":838,"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 687 452 771 544 q 466 361 604 361 l 208 361 m 421 837 l 208 837 l 208 544 l 410 544 q 525 579 480 544 q 571 683 571 615 q 527 792 571 747 q 421 837 484 837 "},"Έ":{"x_min":0,"x_max":1172.546875,"ha":1235,"o":"m 1172 0 l 411 0 l 411 1012 l 1146 1012 l 1146 836 l 617 836 l 617 621 l 1101 621 l 1101 446 l 617 446 l 617 186 l 1172 186 l 1172 0 m 313 1035 l 98 780 l 0 780 l 136 1035 l 313 1035 "},"Ώ":{"x_min":0.4375,"x_max":1189.546875,"ha":1289,"o":"m 1189 0 l 770 0 l 770 199 q 897 369 849 263 q 945 580 945 474 q 879 778 945 706 q 685 855 810 855 q 492 773 561 855 q 424 563 424 691 q 470 360 424 458 q 600 199 517 262 l 600 0 l 180 0 l 180 176 l 383 176 q 258 355 304 251 q 213 569 213 459 q 346 908 213 776 q 686 1040 479 1040 q 1025 912 892 1040 q 1158 578 1158 785 q 1112 362 1158 467 q 986 176 1067 256 l 1189 176 l 1189 0 m 314 1092 l 99 837 l 0 837 l 136 1092 l 314 1092 "},"_":{"x_min":61.109375,"x_max":766.671875,"ha":828,"o":"m 766 -333 l 61 -333 l 61 -190 l 766 -190 l 766 -333 "},"Ϊ":{"x_min":-56,"x_max":342,"ha":503,"o":"m 342 1046 l 186 1046 l 186 1215 l 342 1215 l 342 1046 m 101 1046 l -56 1046 l -56 1215 l 101 1215 l 101 1046 m 249 0 l 41 0 l 41 1012 l 249 1012 l 249 0 "},"+":{"x_min":43,"x_max":784,"ha":828,"o":"m 784 353 l 483 353 l 483 0 l 343 0 l 343 353 l 43 353 l 43 489 l 343 489 l 343 840 l 483 840 l 483 489 l 784 489 l 784 353 "},"½":{"x_min":0,"x_max":1090,"ha":1188,"o":"m 1090 380 q 992 230 1090 301 q 779 101 886 165 q 822 94 784 95 q 924 93 859 93 l 951 93 l 973 93 l 992 93 l 1009 93 q 1046 93 1027 93 q 1085 93 1066 93 l 1085 0 l 650 0 l 654 38 q 815 233 665 137 q 965 376 965 330 q 936 436 965 412 q 869 461 908 461 q 806 435 831 461 q 774 354 780 409 l 659 354 q 724 505 659 451 q 870 554 783 554 q 1024 506 958 554 q 1090 380 1090 459 m 868 998 l 268 -28 l 154 -27 l 757 999 l 868 998 m 272 422 l 147 422 l 147 799 l 0 799 l 0 875 q 126 900 91 875 q 170 973 162 926 l 272 973 l 272 422 "},"Ρ":{"x_min":0,"x_max":771,"ha":838,"o":"m 208 361 l 208 0 l 0 0 l 0 1012 l 450 1012 q 682 919 593 1012 q 771 681 771 826 q 687 452 771 544 q 466 361 604 361 l 208 361 m 422 836 l 209 836 l 209 544 l 410 544 q 525 579 480 544 q 571 683 571 614 q 527 791 571 747 q 422 836 484 836 "},"'":{"x_min":0,"x_max":192,"ha":289,"o":"m 192 834 q 137 692 192 751 q 0 626 82 632 l 0 697 q 101 830 101 726 l 0 830 l 0 1013 l 192 1013 l 192 834 "},"ª":{"x_min":0,"x_max":350,"ha":393,"o":"m 350 625 l 245 625 q 237 648 241 636 q 233 672 233 661 q 117 611 192 611 q 33 643 66 611 q 0 727 0 675 q 116 846 0 828 q 233 886 233 864 q 211 919 233 907 q 168 931 190 931 q 108 877 108 931 l 14 877 q 56 977 14 942 q 165 1013 98 1013 q 270 987 224 1013 q 329 903 329 955 l 329 694 q 332 661 329 675 q 350 641 336 648 l 350 625 m 233 774 l 233 809 q 151 786 180 796 q 97 733 97 768 q 111 700 97 712 q 149 689 126 689 q 210 713 187 689 q 233 774 233 737 "},"΅":{"x_min":57,"x_max":584,"ha":753,"o":"m 584 810 l 455 810 l 455 952 l 584 952 l 584 810 m 521 1064 l 305 810 l 207 810 l 343 1064 l 521 1064 m 186 810 l 57 810 l 57 952 l 186 952 l 186 810 "},"T":{"x_min":0,"x_max":809,"ha":894,"o":"m 809 831 l 509 831 l 509 0 l 299 0 l 299 831 l 0 831 l 0 1013 l 809 1013 l 809 831 "},"Φ":{"x_min":0,"x_max":949,"ha":1032,"o":"m 566 0 l 385 0 l 385 121 q 111 230 222 121 q 0 508 0 340 q 112 775 0 669 q 385 892 219 875 l 385 1013 l 566 1013 l 566 892 q 836 776 732 875 q 949 507 949 671 q 838 231 949 341 q 566 121 728 121 l 566 0 m 566 285 q 701 352 650 285 q 753 508 753 419 q 703 658 753 597 q 566 729 653 720 l 566 285 m 385 285 l 385 729 q 245 661 297 717 q 193 516 193 604 q 246 356 193 427 q 385 285 300 285 "},"j":{"x_min":-45.828125,"x_max":242,"ha":361,"o":"m 242 830 l 42 830 l 42 1013 l 242 1013 l 242 830 m 242 -119 q 180 -267 242 -221 q 20 -308 127 -308 l -45 -308 l -45 -140 l -24 -140 q 25 -130 8 -140 q 42 -88 42 -120 l 42 748 l 242 748 l 242 -119 "},"Σ":{"x_min":0,"x_max":772.21875,"ha":849,"o":"m 772 0 l 0 0 l 0 140 l 368 526 l 18 862 l 18 1012 l 740 1012 l 740 836 l 315 836 l 619 523 l 298 175 l 772 175 l 772 0 "},"1":{"x_min":197.609375,"x_max":628,"ha":828,"o":"m 628 0 l 434 0 l 434 674 l 197 674 l 197 810 q 373 837 318 810 q 468 984 450 876 l 628 984 l 628 0 "},"›":{"x_min":36.109375,"x_max":792,"ha":828,"o":"m 792 352 l 36 17 l 36 168 l 594 420 l 36 672 l 36 823 l 792 487 l 792 352 "},"<":{"x_min":35.984375,"x_max":791.671875,"ha":828,"o":"m 791 17 l 36 352 l 35 487 l 791 823 l 791 672 l 229 421 l 791 168 l 791 17 "},"£":{"x_min":0,"x_max":716.546875,"ha":814,"o":"m 716 38 q 603 -9 658 5 q 502 -24 548 -24 q 398 -10 451 -24 q 239 25 266 25 q 161 12 200 25 q 77 -29 122 0 l 0 113 q 110 211 81 174 q 151 315 151 259 q 117 440 151 365 l 0 440 l 0 515 l 73 515 q 35 610 52 560 q 15 710 15 671 q 119 910 15 831 q 349 984 216 984 q 570 910 480 984 q 693 668 674 826 l 501 668 q 455 791 501 746 q 353 830 414 830 q 256 795 298 830 q 215 705 215 760 q 249 583 215 655 q 283 515 266 548 l 479 515 l 479 440 l 309 440 q 316 394 313 413 q 319 355 319 374 q 287 241 319 291 q 188 135 263 205 q 262 160 225 152 q 332 168 298 168 q 455 151 368 168 q 523 143 500 143 q 588 152 558 143 q 654 189 617 162 l 716 38 "},"t":{"x_min":0,"x_max":412,"ha":511,"o":"m 412 -6 q 349 -8 391 -6 q 287 -11 307 -11 q 137 38 177 -11 q 97 203 97 87 l 97 609 l 0 609 l 0 749 l 97 749 l 97 951 l 297 951 l 297 749 l 412 749 l 412 609 l 297 609 l 297 191 q 315 152 297 162 q 366 143 334 143 q 389 143 378 143 q 412 143 400 143 l 412 -6 "},"¬":{"x_min":0,"x_max":704,"ha":801,"o":"m 704 93 l 551 93 l 551 297 l 0 297 l 0 450 l 704 450 l 704 93 "},"λ":{"x_min":0,"x_max":701.390625,"ha":775,"o":"m 701 0 l 491 0 l 345 444 l 195 0 l 0 0 l 238 697 l 131 1013 l 334 1013 l 701 0 "},"W":{"x_min":0,"x_max":1291.671875,"ha":1399,"o":"m 1291 1013 l 1002 0 l 802 0 l 645 777 l 490 0 l 288 0 l 0 1013 l 215 1013 l 388 298 l 534 1012 l 757 1013 l 904 299 l 1076 1013 l 1291 1013 "},">":{"x_min":36.109375,"x_max":792,"ha":828,"o":"m 792 352 l 36 17 l 36 168 l 594 420 l 36 672 l 36 823 l 792 487 l 792 352 "},"v":{"x_min":0,"x_max":740.28125,"ha":828,"o":"m 740 749 l 473 0 l 266 0 l 0 749 l 222 749 l 373 211 l 529 749 l 740 749 "},"τ":{"x_min":0.28125,"x_max":618.734375,"ha":699,"o":"m 618 593 l 409 593 l 409 0 l 210 0 l 210 593 l 0 593 l 0 749 l 618 749 l 618 593 "},"ξ":{"x_min":0,"x_max":640,"ha":715,"o":"m 640 -14 q 619 -157 640 -84 q 563 -299 599 -230 l 399 -299 q 442 -194 433 -223 q 468 -85 468 -126 q 440 -25 468 -41 q 368 -10 412 -10 q 333 -11 355 -10 q 302 -13 311 -13 q 91 60 179 -13 q 0 259 0 138 q 56 426 0 354 q 201 530 109 493 q 106 594 144 553 q 65 699 65 642 q 94 787 65 747 q 169 856 123 828 l 22 856 l 22 1013 l 597 1013 l 597 856 l 497 857 q 345 840 398 857 q 257 736 257 812 q 366 614 257 642 q 552 602 416 602 l 552 446 l 513 446 q 313 425 379 446 q 199 284 199 389 q 312 162 199 184 q 524 136 418 148 q 640 -14 640 105 "},"&":{"x_min":-1,"x_max":910.109375,"ha":1007,"o":"m 910 -1 l 676 -1 l 607 83 q 291 -47 439 -47 q 50 100 135 -47 q -1 273 -1 190 q 51 431 -1 357 q 218 568 104 505 q 151 661 169 629 q 120 769 120 717 q 201 951 120 885 q 382 1013 276 1013 q 555 957 485 1013 q 635 789 635 894 q 584 644 635 709 q 468 539 548 597 l 615 359 q 664 527 654 440 l 844 527 q 725 223 824 359 l 910 -1 m 461 787 q 436 848 461 826 q 381 870 412 870 q 325 849 349 870 q 301 792 301 829 q 324 719 301 757 q 372 660 335 703 q 430 714 405 680 q 461 787 461 753 m 500 214 l 318 441 q 198 286 198 363 q 225 204 198 248 q 347 135 268 135 q 425 153 388 135 q 500 214 462 172 "},"Λ":{"x_min":0,"x_max":894.453125,"ha":974,"o":"m 894 0 l 666 0 l 447 757 l 225 0 l 0 0 l 344 1013 l 547 1013 l 894 0 "},"I":{"x_min":41,"x_max":249,"ha":365,"o":"m 249 0 l 41 0 l 41 1013 l 249 1013 l 249 0 "},"G":{"x_min":0,"x_max":971,"ha":1057,"o":"m 971 -1 l 829 -1 l 805 118 q 479 -29 670 -29 q 126 133 261 -29 q 0 509 0 286 q 130 884 0 737 q 493 1040 268 1040 q 790 948 659 1040 q 961 698 920 857 l 736 698 q 643 813 709 769 q 500 857 578 857 q 285 746 364 857 q 213 504 213 644 q 285 263 213 361 q 505 154 365 154 q 667 217 598 154 q 761 374 736 280 l 548 374 l 548 548 l 971 548 l 971 -1 "},"ΰ":{"x_min":0,"x_max":655,"ha":767,"o":"m 583 810 l 454 810 l 454 952 l 583 952 l 583 810 m 186 810 l 57 809 l 57 952 l 186 952 l 186 810 m 516 1039 l 315 823 l 216 823 l 338 1039 l 516 1039 m 655 417 q 567 55 655 146 q 326 -25 489 -25 q 59 97 137 -25 q 0 369 0 192 l 0 748 l 200 748 l 201 369 q 218 222 201 269 q 326 142 245 142 q 439 247 410 142 q 455 422 455 304 l 455 748 l 655 748 l 655 417 "},"`":{"x_min":0,"x_max":190,"ha":288,"o":"m 190 654 l 0 654 l 0 830 q 55 970 0 909 q 190 1040 110 1031 l 190 969 q 111 922 134 952 q 88 836 88 892 l 190 836 l 190 654 "},"·":{"x_min":0,"x_max":207,"ha":304,"o":"m 207 528 l 0 528 l 0 735 l 207 735 l 207 528 "},"Υ":{"x_min":-0.21875,"x_max":836.171875,"ha":914,"o":"m 836 1013 l 532 376 l 532 0 l 322 0 l 322 376 l 0 1013 l 208 1013 l 427 576 l 626 1013 l 836 1013 "},"r":{"x_min":0,"x_max":431.9375,"ha":513,"o":"m 431 564 q 269 536 320 564 q 200 395 200 498 l 200 0 l 0 0 l 0 748 l 183 748 l 183 618 q 285 731 224 694 q 431 768 345 768 l 431 564 "},"x":{"x_min":0,"x_max":738.890625,"ha":826,"o":"m 738 0 l 504 0 l 366 238 l 230 0 l 0 0 l 252 382 l 11 749 l 238 749 l 372 522 l 502 749 l 725 749 l 488 384 l 738 0 "},"μ":{"x_min":0,"x_max":647,"ha":754,"o":"m 647 0 l 477 0 l 477 68 q 411 9 448 30 q 330 -11 374 -11 q 261 3 295 -11 q 199 43 226 18 l 199 -278 l 0 -278 l 0 749 l 199 749 l 199 358 q 216 222 199 268 q 322 152 244 152 q 435 240 410 152 q 448 401 448 283 l 448 749 l 647 749 l 647 0 "},"h":{"x_min":0,"x_max":669,"ha":782,"o":"m 669 0 l 469 0 l 469 390 q 449 526 469 472 q 353 607 420 607 q 248 554 295 607 q 201 441 201 501 l 201 0 l 0 0 l 0 1013 l 201 1013 l 201 665 q 303 743 245 715 q 425 772 362 772 q 609 684 542 772 q 669 484 669 605 l 669 0 "},".":{"x_min":0,"x_max":206,"ha":303,"o":"m 206 0 l 0 0 l 0 207 l 206 207 l 206 0 "},"φ":{"x_min":-1,"x_max":921,"ha":990,"o":"m 542 -278 l 367 -278 l 367 -22 q 99 92 200 -22 q -1 376 -1 206 q 72 627 -1 520 q 288 769 151 742 l 288 581 q 222 495 243 550 q 202 378 202 439 q 240 228 202 291 q 367 145 285 157 l 367 776 l 515 776 q 807 667 694 776 q 921 379 921 558 q 815 93 921 209 q 542 -22 709 -22 l 542 -278 m 542 145 q 672 225 625 145 q 713 381 713 291 q 671 536 713 470 q 542 611 624 611 l 542 145 "},";":{"x_min":0,"x_max":208,"ha":306,"o":"m 208 528 l 0 528 l 0 735 l 208 735 l 208 528 m 208 6 q 152 -151 208 -89 q 0 -238 96 -212 l 0 -158 q 87 -100 61 -136 q 113 0 113 -65 l 0 0 l 0 207 l 208 207 l 208 6 "},"f":{"x_min":0,"x_max":424,"ha":525,"o":"m 424 609 l 300 609 l 300 0 l 107 0 l 107 609 l 0 609 l 0 749 l 107 749 q 145 949 107 894 q 328 1019 193 1019 l 424 1015 l 424 855 l 362 855 q 312 841 324 855 q 300 797 300 827 q 300 773 300 786 q 300 749 300 761 l 424 749 l 424 609 "},"“":{"x_min":0,"x_max":468,"ha":567,"o":"m 190 631 l 0 631 l 0 807 q 55 947 0 885 q 190 1017 110 1010 l 190 947 q 88 813 88 921 l 190 813 l 190 631 m 468 631 l 278 631 l 278 807 q 333 947 278 885 q 468 1017 388 1010 l 468 947 q 366 813 366 921 l 468 813 l 468 631 "},"A":{"x_min":0,"x_max":966.671875,"ha":1069,"o":"m 966 0 l 747 0 l 679 208 l 286 208 l 218 0 l 0 0 l 361 1013 l 600 1013 l 966 0 m 623 376 l 480 810 l 340 376 l 623 376 "},"6":{"x_min":57,"x_max":771,"ha":828,"o":"m 744 734 l 544 734 q 500 802 533 776 q 425 828 466 828 q 315 769 359 828 q 264 571 264 701 q 451 638 343 638 q 691 537 602 638 q 771 315 771 449 q 683 79 771 176 q 420 -29 586 -29 q 134 123 227 -29 q 57 455 57 250 q 184 865 57 721 q 452 988 293 988 q 657 916 570 988 q 744 734 744 845 m 426 128 q 538 178 498 128 q 578 300 578 229 q 538 422 578 372 q 415 479 493 479 q 303 430 342 479 q 264 313 264 381 q 308 184 264 240 q 426 128 352 128 "},"‘":{"x_min":0,"x_max":190,"ha":289,"o":"m 190 631 l 0 631 l 0 807 q 55 947 0 885 q 190 1017 110 1010 l 190 947 q 88 813 88 921 l 190 813 l 190 631 "},"ϊ":{"x_min":-55,"x_max":337,"ha":389,"o":"m 337 810 l 208 810 l 208 952 l 337 952 l 337 810 m 74 810 l -55 810 l -55 952 l 74 952 l 74 810 m 242 0 l 42 0 l 42 748 l 242 748 l 242 0 "},"π":{"x_min":0.5,"x_max":838.890625,"ha":938,"o":"m 838 593 l 750 593 l 750 0 l 549 0 l 549 593 l 287 593 l 287 0 l 88 0 l 88 593 l 0 593 l 0 749 l 838 749 l 838 593 "},"ά":{"x_min":-1,"x_max":722,"ha":835,"o":"m 722 0 l 531 0 l 530 101 q 433 8 491 41 q 304 -25 375 -25 q 72 104 157 -25 q -1 372 -1 216 q 72 643 -1 530 q 308 775 158 775 q 433 744 375 775 q 528 656 491 713 l 528 749 l 722 749 l 722 0 m 361 601 q 233 527 277 601 q 196 375 196 464 q 232 224 196 288 q 358 144 277 144 q 487 217 441 144 q 528 370 528 281 q 489 523 528 457 q 361 601 443 601 m 579 1039 l 377 823 l 279 823 l 401 1039 l 579 1039 "},"O":{"x_min":0,"x_max":994,"ha":1094,"o":"m 497 -29 q 133 127 272 -29 q 0 505 0 277 q 131 883 0 733 q 497 1040 270 1040 q 860 883 721 1040 q 994 505 994 733 q 862 127 994 277 q 497 -29 723 -29 m 497 154 q 710 266 631 154 q 780 506 780 365 q 710 745 780 647 q 497 857 631 857 q 283 747 361 857 q 213 506 213 647 q 282 266 213 365 q 497 154 361 154 "},"n":{"x_min":0,"x_max":669,"ha":782,"o":"m 669 0 l 469 0 l 469 452 q 442 553 469 513 q 352 601 412 601 q 245 553 290 601 q 200 441 200 505 l 200 0 l 0 0 l 0 748 l 194 748 l 194 659 q 289 744 230 713 q 416 775 349 775 q 600 700 531 775 q 669 509 669 626 l 669 0 "},"3":{"x_min":61,"x_max":767,"ha":828,"o":"m 767 290 q 653 51 767 143 q 402 -32 548 -32 q 168 48 262 -32 q 61 300 61 140 l 250 300 q 298 173 250 219 q 405 132 343 132 q 514 169 471 132 q 563 282 563 211 q 491 405 563 369 q 343 432 439 432 l 343 568 q 472 592 425 568 q 534 701 534 626 q 493 793 534 758 q 398 829 453 829 q 306 789 344 829 q 268 669 268 749 l 80 669 q 182 909 80 823 q 410 986 274 986 q 633 916 540 986 q 735 719 735 840 q 703 608 735 656 q 615 522 672 561 q 727 427 687 486 q 767 290 767 369 "},"9":{"x_min":58,"x_max":769,"ha":828,"o":"m 769 492 q 646 90 769 232 q 384 -33 539 -33 q 187 35 271 -33 q 83 224 98 107 l 282 224 q 323 154 286 182 q 404 127 359 127 q 513 182 471 127 q 563 384 563 248 q 475 335 532 355 q 372 315 418 315 q 137 416 224 315 q 58 642 58 507 q 144 877 58 781 q 407 984 239 984 q 694 827 602 984 q 769 492 769 699 m 416 476 q 525 521 488 476 q 563 632 563 566 q 521 764 563 709 q 403 826 474 826 q 297 773 337 826 q 258 649 258 720 q 295 530 258 577 q 416 476 339 476 "},"l":{"x_min":41,"x_max":240,"ha":363,"o":"m 240 0 l 41 0 l 41 1013 l 240 1013 l 240 0 "},"¤":{"x_min":40.265625,"x_max":727.203125,"ha":825,"o":"m 727 792 l 594 659 q 620 552 620 609 q 598 459 620 504 l 725 331 l 620 224 l 491 352 q 382 331 443 331 q 273 352 322 331 l 144 224 l 40 330 l 167 459 q 147 552 147 501 q 172 658 147 608 l 40 794 l 147 898 l 283 759 q 383 776 330 776 q 482 759 434 776 l 620 898 l 727 792 m 383 644 q 308 617 334 644 q 283 551 283 590 q 309 489 283 517 q 381 462 335 462 q 456 488 430 462 q 482 554 482 515 q 455 616 482 588 q 383 644 429 644 "},"κ":{"x_min":0,"x_max":691.84375,"ha":779,"o":"m 691 0 l 479 0 l 284 343 l 196 252 l 196 0 l 0 0 l 0 749 l 196 749 l 196 490 l 440 749 l 677 749 l 416 479 l 691 0 "},"4":{"x_min":53,"x_max":775.21875,"ha":828,"o":"m 775 213 l 660 213 l 660 0 l 470 0 l 470 213 l 53 213 l 53 384 l 416 958 l 660 958 l 660 370 l 775 370 l 775 213 m 474 364 l 474 786 l 204 363 l 474 364 "},"p":{"x_min":0,"x_max":722,"ha":824,"o":"m 415 -26 q 287 4 346 -26 q 192 92 228 34 l 192 -298 l 0 -298 l 0 750 l 192 750 l 192 647 q 289 740 230 706 q 416 775 347 775 q 649 645 566 775 q 722 375 722 534 q 649 106 722 218 q 415 -26 564 -26 m 363 603 q 232 529 278 603 q 192 375 192 465 q 230 222 192 286 q 360 146 276 146 q 487 221 441 146 q 526 371 526 285 q 488 523 526 458 q 363 603 443 603 "},"‡":{"x_min":0,"x_max":809,"ha":894,"o":"m 299 621 l 0 621 l 0 804 l 299 804 l 299 1011 l 509 1011 l 509 804 l 809 804 l 809 621 l 509 621 l 509 387 l 809 387 l 809 205 l 509 205 l 509 0 l 299 0 l 299 205 l 0 205 l 0 387 l 299 387 l 299 621 "},"ψ":{"x_min":0,"x_max":875,"ha":979,"o":"m 522 142 q 657 274 620 163 q 671 352 671 316 l 671 748 l 875 748 l 875 402 q 806 134 875 240 q 525 -22 719 -1 l 525 -278 l 349 -278 l 349 -22 q 65 135 152 -1 q 0 402 0 238 l 0 748 l 204 748 l 204 352 q 231 240 204 295 q 353 142 272 159 l 353 922 l 524 922 l 522 142 "},"η":{"x_min":0,"x_max":669,"ha":779,"o":"m 669 -278 l 469 -278 l 469 390 q 448 526 469 473 q 348 606 417 606 q 244 553 288 606 q 201 441 201 501 l 201 0 l 0 0 l 0 749 l 201 749 l 201 665 q 301 744 244 715 q 423 774 359 774 q 606 685 538 774 q 669 484 669 603 l 669 -278 "}},"cssFontWeight":"bold","ascender":1216,"underlinePosition":-100,"cssFontStyle":"normal","boundingBox":{"yMin":-333,"xMin":-162,"yMax":1216,"xMax":1681},"resolution":1000,"original_font_information":{"postscript_name":"Helvetiker-Bold","version_string":"Version 1.00 2004 initial release","vendor_url":"http://www.magenta.gr","full_font_name":"Helvetiker Bold","font_family_name":"Helvetiker","copyright":"Copyright (c) Magenta ltd, 2004.","description":"","trademark":"","designer":"","designer_url":"","unique_font_identifier":"Magenta ltd:Helvetiker Bold:22-10-104","license_url":"http://www.ellak.gr/fonts/MgOpen/license.html","license_description":"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.","manufacturer_name":"Magenta ltd","font_sub_family_name":"Bold"},"descender":-334,"familyName":"Helvetiker","lineHeight":1549,"underlineThickness":50}); \ No newline at end of file diff --git a/js/scripts/helvetiker_regular.typeface.js b/js/scripts/helvetiker_regular.typeface.js new file mode 100755 index 0000000..3823b6a --- /dev/null +++ b/js/scripts/helvetiker_regular.typeface.js @@ -0,0 +1 @@ +if (_typeface_js && _typeface_js.loadFace) _typeface_js.loadFace({"glyphs":{"ο":{"x_min":0,"x_max":712,"ha":815,"o":"m 356 -25 q 96 88 192 -25 q 0 368 0 201 q 92 642 0 533 q 356 761 192 761 q 617 644 517 761 q 712 368 712 533 q 619 91 712 201 q 356 -25 520 -25 m 356 85 q 527 175 465 85 q 583 369 583 255 q 528 562 583 484 q 356 651 466 651 q 189 560 250 651 q 135 369 135 481 q 187 177 135 257 q 356 85 250 85 "},"S":{"x_min":0,"x_max":788,"ha":890,"o":"m 788 291 q 662 54 788 144 q 397 -26 550 -26 q 116 68 226 -26 q 0 337 0 168 l 131 337 q 200 152 131 220 q 384 85 269 85 q 557 129 479 85 q 650 270 650 183 q 490 429 650 379 q 194 513 341 470 q 33 739 33 584 q 142 964 33 881 q 388 1041 242 1041 q 644 957 543 1041 q 756 716 756 867 l 625 716 q 561 874 625 816 q 395 933 497 933 q 243 891 309 933 q 164 759 164 841 q 325 609 164 656 q 625 526 475 568 q 788 291 788 454 "},"¦":{"x_min":343,"x_max":449,"ha":792,"o":"m 449 462 l 343 462 l 343 986 l 449 986 l 449 462 m 449 -242 l 343 -242 l 343 280 l 449 280 l 449 -242 "},"/":{"x_min":183.25,"x_max":608.328125,"ha":792,"o":"m 608 1041 l 266 -129 l 183 -129 l 520 1041 l 608 1041 "},"Τ":{"x_min":-0.4375,"x_max":777.453125,"ha":839,"o":"m 777 893 l 458 893 l 458 0 l 319 0 l 319 892 l 0 892 l 0 1013 l 777 1013 l 777 893 "},"y":{"x_min":0,"x_max":684.78125,"ha":771,"o":"m 684 738 l 388 -83 q 311 -216 356 -167 q 173 -279 252 -279 q 97 -266 133 -279 l 97 -149 q 132 -155 109 -151 q 168 -160 155 -160 q 240 -114 213 -160 q 274 -26 248 -98 l 0 738 l 137 737 l 341 139 l 548 737 l 684 738 "},"Π":{"x_min":0,"x_max":803,"ha":917,"o":"m 803 0 l 667 0 l 667 886 l 140 886 l 140 0 l 0 0 l 0 1012 l 803 1012 l 803 0 "},"ΐ":{"x_min":-111,"x_max":339,"ha":361,"o":"m 339 800 l 229 800 l 229 925 l 339 925 l 339 800 m -1 800 l -111 800 l -111 925 l -1 925 l -1 800 m 284 3 q 233 -10 258 -5 q 182 -15 207 -15 q 85 26 119 -15 q 42 200 42 79 l 42 737 l 167 737 l 168 215 q 172 141 168 157 q 226 101 183 101 q 248 103 239 101 q 284 112 257 104 l 284 3 m 302 1040 l 113 819 l 30 819 l 165 1040 l 302 1040 "},"g":{"x_min":0,"x_max":686,"ha":838,"o":"m 686 34 q 586 -213 686 -121 q 331 -306 487 -306 q 131 -252 216 -306 q 31 -84 31 -190 l 155 -84 q 228 -174 166 -138 q 345 -207 284 -207 q 514 -109 454 -207 q 564 89 564 -27 q 461 6 521 36 q 335 -23 401 -23 q 88 100 184 -23 q 0 370 0 215 q 87 634 0 522 q 330 758 183 758 q 457 728 398 758 q 564 644 515 699 l 564 737 l 686 737 l 686 34 m 582 367 q 529 560 582 481 q 358 652 468 652 q 189 561 250 652 q 135 369 135 482 q 189 176 135 255 q 361 85 251 85 q 529 176 468 85 q 582 367 582 255 "},"²":{"x_min":0,"x_max":442,"ha":539,"o":"m 442 383 l 0 383 q 91 566 0 492 q 260 668 176 617 q 354 798 354 727 q 315 875 354 845 q 227 905 277 905 q 136 869 173 905 q 99 761 99 833 l 14 761 q 82 922 14 864 q 232 974 141 974 q 379 926 316 974 q 442 797 442 878 q 351 635 442 704 q 183 539 321 611 q 92 455 92 491 l 442 455 l 442 383 "},"–":{"x_min":0,"x_max":705.5625,"ha":803,"o":"m 705 334 l 0 334 l 0 410 l 705 410 l 705 334 "},"Κ":{"x_min":0,"x_max":819.5625,"ha":893,"o":"m 819 0 l 650 0 l 294 509 l 139 356 l 139 0 l 0 0 l 0 1013 l 139 1013 l 139 526 l 626 1013 l 809 1013 l 395 600 l 819 0 "},"ƒ":{"x_min":-46.265625,"x_max":392,"ha":513,"o":"m 392 651 l 259 651 l 79 -279 l -46 -278 l 134 651 l 14 651 l 14 751 l 135 751 q 151 948 135 900 q 304 1041 185 1041 q 334 1040 319 1041 q 392 1034 348 1039 l 392 922 q 337 931 360 931 q 271 883 287 931 q 260 793 260 853 l 260 751 l 392 751 l 392 651 "},"e":{"x_min":0,"x_max":714,"ha":813,"o":"m 714 326 l 140 326 q 200 157 140 227 q 359 87 260 87 q 488 130 431 87 q 561 245 545 174 l 697 245 q 577 48 670 123 q 358 -26 484 -26 q 97 85 195 -26 q 0 363 0 197 q 94 642 0 529 q 358 765 195 765 q 626 627 529 765 q 714 326 714 503 m 576 429 q 507 583 564 522 q 355 650 445 650 q 206 583 266 650 q 140 429 152 522 l 576 429 "},"ό":{"x_min":0,"x_max":712,"ha":815,"o":"m 356 -25 q 94 91 194 -25 q 0 368 0 202 q 92 642 0 533 q 356 761 192 761 q 617 644 517 761 q 712 368 712 533 q 619 91 712 201 q 356 -25 520 -25 m 356 85 q 527 175 465 85 q 583 369 583 255 q 528 562 583 484 q 356 651 466 651 q 189 560 250 651 q 135 369 135 481 q 187 177 135 257 q 356 85 250 85 m 576 1040 l 387 819 l 303 819 l 438 1040 l 576 1040 "},"J":{"x_min":0,"x_max":588,"ha":699,"o":"m 588 279 q 287 -26 588 -26 q 58 73 126 -26 q 0 327 0 158 l 133 327 q 160 172 133 227 q 288 96 198 96 q 426 171 391 96 q 449 336 449 219 l 449 1013 l 588 1013 l 588 279 "},"»":{"x_min":-1,"x_max":503,"ha":601,"o":"m 503 302 l 280 136 l 281 256 l 429 373 l 281 486 l 280 608 l 503 440 l 503 302 m 221 302 l 0 136 l 0 255 l 145 372 l 0 486 l -1 608 l 221 440 l 221 302 "},"©":{"x_min":-3,"x_max":1008,"ha":1106,"o":"m 502 -7 q 123 151 263 -7 q -3 501 -3 294 q 123 851 -3 706 q 502 1011 263 1011 q 881 851 739 1011 q 1008 501 1008 708 q 883 151 1008 292 q 502 -7 744 -7 m 502 60 q 830 197 709 60 q 940 501 940 322 q 831 805 940 681 q 502 944 709 944 q 174 805 296 944 q 65 501 65 680 q 173 197 65 320 q 502 60 294 60 m 741 394 q 661 246 731 302 q 496 190 591 190 q 294 285 369 190 q 228 497 228 370 q 295 714 228 625 q 499 813 370 813 q 656 762 588 813 q 733 625 724 711 l 634 625 q 589 704 629 673 q 498 735 550 735 q 377 666 421 735 q 334 504 334 597 q 374 340 334 408 q 490 272 415 272 q 589 304 549 272 q 638 394 628 337 l 741 394 "},"ώ":{"x_min":0,"x_max":922,"ha":1030,"o":"m 687 1040 l 498 819 l 415 819 l 549 1040 l 687 1040 m 922 339 q 856 97 922 203 q 650 -26 780 -26 q 538 9 587 -26 q 461 103 489 44 q 387 12 436 46 q 277 -22 339 -22 q 69 97 147 -22 q 0 338 0 202 q 45 551 0 444 q 161 737 84 643 l 302 737 q 175 552 219 647 q 124 336 124 446 q 155 179 124 248 q 275 88 197 88 q 375 163 341 88 q 400 294 400 219 l 400 572 l 524 572 l 524 294 q 561 135 524 192 q 643 88 591 88 q 762 182 719 88 q 797 341 797 257 q 745 555 797 450 q 619 737 705 637 l 760 737 q 874 551 835 640 q 922 339 922 444 "},"^":{"x_min":193.0625,"x_max":598.609375,"ha":792,"o":"m 598 772 l 515 772 l 395 931 l 277 772 l 193 772 l 326 1013 l 462 1013 l 598 772 "},"«":{"x_min":0,"x_max":507.203125,"ha":604,"o":"m 506 136 l 284 302 l 284 440 l 506 608 l 507 485 l 360 371 l 506 255 l 506 136 m 222 136 l 0 302 l 0 440 l 222 608 l 221 486 l 73 373 l 222 256 l 222 136 "},"D":{"x_min":0,"x_max":828,"ha":935,"o":"m 389 1013 q 714 867 593 1013 q 828 521 828 729 q 712 161 828 309 q 382 0 587 0 l 0 0 l 0 1013 l 389 1013 m 376 124 q 607 247 523 124 q 681 510 681 355 q 607 771 681 662 q 376 896 522 896 l 139 896 l 139 124 l 376 124 "},"∙":{"x_min":0,"x_max":142,"ha":239,"o":"m 142 585 l 0 585 l 0 738 l 142 738 l 142 585 "},"ÿ":{"x_min":0,"x_max":47,"ha":125,"o":"m 47 3 q 37 -7 47 -7 q 28 0 30 -7 q 39 -4 32 -4 q 45 3 45 -1 l 37 0 q 28 9 28 0 q 39 19 28 19 l 47 16 l 47 19 l 47 3 m 37 1 q 44 8 44 1 q 37 16 44 16 q 30 8 30 16 q 37 1 30 1 m 26 1 l 23 22 l 14 0 l 3 22 l 3 3 l 0 25 l 13 1 l 22 25 l 26 1 "},"w":{"x_min":0,"x_max":1009.71875,"ha":1100,"o":"m 1009 738 l 783 0 l 658 0 l 501 567 l 345 0 l 222 0 l 0 738 l 130 738 l 284 174 l 432 737 l 576 738 l 721 173 l 881 737 l 1009 738 "},"$":{"x_min":0,"x_max":700,"ha":793,"o":"m 664 717 l 542 717 q 490 825 531 785 q 381 872 450 865 l 381 551 q 620 446 540 522 q 700 241 700 370 q 618 45 700 116 q 381 -25 536 -25 l 381 -152 l 307 -152 l 307 -25 q 81 62 162 -25 q 0 297 0 149 l 124 297 q 169 146 124 204 q 307 81 215 89 l 307 441 q 80 536 148 469 q 13 725 13 603 q 96 910 13 839 q 307 982 180 982 l 307 1077 l 381 1077 l 381 982 q 574 917 494 982 q 664 717 664 845 m 307 565 l 307 872 q 187 831 233 872 q 142 724 142 791 q 180 618 142 656 q 307 565 218 580 m 381 76 q 562 237 562 96 q 517 361 562 313 q 381 423 472 409 l 381 76 "},"\\":{"x_min":-0.015625,"x_max":425.0625,"ha":522,"o":"m 425 -129 l 337 -129 l 0 1041 l 83 1041 l 425 -129 "},"µ":{"x_min":0,"x_max":697.21875,"ha":747,"o":"m 697 -4 q 629 -14 658 -14 q 498 97 513 -14 q 422 9 470 41 q 313 -23 374 -23 q 207 4 258 -23 q 119 81 156 32 l 119 -278 l 0 -278 l 0 738 l 124 738 l 124 343 q 165 173 124 246 q 308 83 216 83 q 452 178 402 83 q 493 359 493 255 l 493 738 l 617 738 l 617 214 q 623 136 617 160 q 673 92 637 92 q 697 96 684 92 l 697 -4 "},"Ι":{"x_min":42,"x_max":181,"ha":297,"o":"m 181 0 l 42 0 l 42 1013 l 181 1013 l 181 0 "},"Ύ":{"x_min":0,"x_max":1144.5,"ha":1214,"o":"m 1144 1012 l 807 416 l 807 0 l 667 0 l 667 416 l 325 1012 l 465 1012 l 736 533 l 1004 1012 l 1144 1012 m 277 1040 l 83 799 l 0 799 l 140 1040 l 277 1040 "},"’":{"x_min":0,"x_max":139,"ha":236,"o":"m 139 851 q 102 737 139 784 q 0 669 65 690 l 0 734 q 59 787 42 741 q 72 873 72 821 l 0 873 l 0 1013 l 139 1013 l 139 851 "},"Ν":{"x_min":0,"x_max":801,"ha":915,"o":"m 801 0 l 651 0 l 131 822 l 131 0 l 0 0 l 0 1013 l 151 1013 l 670 191 l 670 1013 l 801 1013 l 801 0 "},"-":{"x_min":8.71875,"x_max":350.390625,"ha":478,"o":"m 350 317 l 8 317 l 8 428 l 350 428 l 350 317 "},"Q":{"x_min":0,"x_max":968,"ha":1072,"o":"m 954 5 l 887 -79 l 744 35 q 622 -11 687 2 q 483 -26 556 -26 q 127 130 262 -26 q 0 504 0 279 q 127 880 0 728 q 484 1041 262 1041 q 841 884 708 1041 q 968 507 968 735 q 933 293 968 398 q 832 104 899 188 l 954 5 m 723 191 q 802 330 777 248 q 828 499 828 412 q 744 790 828 673 q 483 922 650 922 q 228 791 322 922 q 142 505 142 673 q 227 221 142 337 q 487 91 323 91 q 632 123 566 91 l 520 215 l 587 301 l 723 191 "},"ς":{"x_min":1,"x_max":676.28125,"ha":740,"o":"m 676 460 l 551 460 q 498 595 542 546 q 365 651 448 651 q 199 578 263 651 q 136 401 136 505 q 266 178 136 241 q 508 106 387 142 q 640 -50 640 62 q 625 -158 640 -105 q 583 -278 611 -211 l 465 -278 q 498 -182 490 -211 q 515 -80 515 -126 q 381 12 515 -15 q 134 91 197 51 q 1 388 1 179 q 100 651 1 542 q 354 761 199 761 q 587 680 498 761 q 676 460 676 599 "},"M":{"x_min":0,"x_max":954,"ha":1067,"o":"m 954 0 l 819 0 l 819 869 l 537 0 l 405 0 l 128 866 l 128 0 l 0 0 l 0 1013 l 200 1013 l 472 160 l 757 1013 l 954 1013 l 954 0 "},"Ψ":{"x_min":0,"x_max":1006,"ha":1094,"o":"m 1006 678 q 914 319 1006 429 q 571 200 814 200 l 571 0 l 433 0 l 433 200 q 92 319 194 200 q 0 678 0 429 l 0 1013 l 139 1013 l 139 679 q 191 417 139 492 q 433 326 255 326 l 433 1013 l 571 1013 l 571 326 l 580 326 q 813 423 747 326 q 868 679 868 502 l 868 1013 l 1006 1013 l 1006 678 "},"C":{"x_min":0,"x_max":886,"ha":944,"o":"m 886 379 q 760 87 886 201 q 455 -26 634 -26 q 112 136 236 -26 q 0 509 0 283 q 118 882 0 737 q 469 1041 245 1041 q 748 955 630 1041 q 879 708 879 859 l 745 708 q 649 862 724 805 q 473 920 573 920 q 219 791 312 920 q 136 509 136 675 q 217 229 136 344 q 470 99 311 99 q 672 179 591 99 q 753 379 753 259 l 886 379 "},"!":{"x_min":0,"x_max":138,"ha":236,"o":"m 138 684 q 116 409 138 629 q 105 244 105 299 l 33 244 q 16 465 33 313 q 0 684 0 616 l 0 1013 l 138 1013 l 138 684 m 138 0 l 0 0 l 0 151 l 138 151 l 138 0 "},"{":{"x_min":0,"x_max":480.5625,"ha":578,"o":"m 480 -286 q 237 -213 303 -286 q 187 -45 187 -159 q 194 48 187 -15 q 201 141 201 112 q 164 264 201 225 q 0 314 118 314 l 0 417 q 164 471 119 417 q 201 605 201 514 q 199 665 201 644 q 193 772 193 769 q 241 941 193 887 q 480 1015 308 1015 l 480 915 q 336 866 375 915 q 306 742 306 828 q 310 662 306 717 q 314 577 314 606 q 288 452 314 500 q 176 365 256 391 q 289 275 257 337 q 314 143 314 226 q 313 84 314 107 q 310 -11 310 -5 q 339 -131 310 -94 q 480 -182 377 -182 l 480 -286 "},"X":{"x_min":-0.015625,"x_max":854.15625,"ha":940,"o":"m 854 0 l 683 0 l 423 409 l 166 0 l 0 0 l 347 519 l 18 1013 l 186 1013 l 428 637 l 675 1013 l 836 1013 l 504 520 l 854 0 "},"#":{"x_min":0,"x_max":963.890625,"ha":1061,"o":"m 963 690 l 927 590 l 719 590 l 655 410 l 876 410 l 840 310 l 618 310 l 508 -3 l 393 -2 l 506 309 l 329 310 l 215 -2 l 102 -3 l 212 310 l 0 310 l 36 410 l 248 409 l 312 590 l 86 590 l 120 690 l 347 690 l 459 1006 l 573 1006 l 462 690 l 640 690 l 751 1006 l 865 1006 l 754 690 l 963 690 m 606 590 l 425 590 l 362 410 l 543 410 l 606 590 "},"ι":{"x_min":42,"x_max":284,"ha":361,"o":"m 284 3 q 233 -10 258 -5 q 182 -15 207 -15 q 85 26 119 -15 q 42 200 42 79 l 42 738 l 167 738 l 168 215 q 172 141 168 157 q 226 101 183 101 q 248 103 239 101 q 284 112 257 104 l 284 3 "},"Ά":{"x_min":0,"x_max":906.953125,"ha":982,"o":"m 283 1040 l 88 799 l 5 799 l 145 1040 l 283 1040 m 906 0 l 756 0 l 650 303 l 251 303 l 143 0 l 0 0 l 376 1012 l 529 1012 l 906 0 m 609 421 l 452 866 l 293 421 l 609 421 "},")":{"x_min":0,"x_max":318,"ha":415,"o":"m 318 365 q 257 25 318 191 q 87 -290 197 -141 l 0 -290 q 140 21 93 -128 q 193 360 193 189 q 141 704 193 537 q 0 1024 97 850 l 87 1024 q 257 706 197 871 q 318 365 318 542 "},"ε":{"x_min":0,"x_max":634.71875,"ha":714,"o":"m 634 234 q 527 38 634 110 q 300 -25 433 -25 q 98 29 183 -25 q 0 204 0 93 q 37 314 0 265 q 128 390 67 353 q 56 460 82 419 q 26 555 26 505 q 114 712 26 654 q 295 763 191 763 q 499 700 416 763 q 589 515 589 631 l 478 515 q 419 618 464 580 q 307 657 374 657 q 207 630 253 657 q 151 547 151 598 q 238 445 151 469 q 389 434 280 434 l 389 331 l 349 331 q 206 315 255 331 q 125 210 125 287 q 183 107 125 145 q 302 76 233 76 q 436 117 379 76 q 509 234 493 159 l 634 234 "},"Δ":{"x_min":0,"x_max":952.78125,"ha":1028,"o":"m 952 0 l 0 0 l 400 1013 l 551 1013 l 952 0 m 762 124 l 476 867 l 187 124 l 762 124 "},"}":{"x_min":0,"x_max":481,"ha":578,"o":"m 481 314 q 318 262 364 314 q 282 136 282 222 q 284 65 282 97 q 293 -58 293 -48 q 241 -217 293 -166 q 0 -286 174 -286 l 0 -182 q 143 -130 105 -182 q 171 -2 171 -93 q 168 81 171 22 q 165 144 165 140 q 188 275 165 229 q 306 365 220 339 q 191 455 224 391 q 165 588 165 505 q 168 681 165 624 q 171 742 171 737 q 141 865 171 827 q 0 915 102 915 l 0 1015 q 243 942 176 1015 q 293 773 293 888 q 287 675 293 741 q 282 590 282 608 q 318 466 282 505 q 481 417 364 417 l 481 314 "},"‰":{"x_min":-3,"x_max":1672,"ha":1821,"o":"m 846 0 q 664 76 732 0 q 603 244 603 145 q 662 412 603 344 q 846 489 729 489 q 1027 412 959 489 q 1089 244 1089 343 q 1029 76 1089 144 q 846 0 962 0 m 845 103 q 945 143 910 103 q 981 243 981 184 q 947 340 981 301 q 845 385 910 385 q 745 342 782 385 q 709 243 709 300 q 742 147 709 186 q 845 103 781 103 m 888 986 l 284 -25 l 199 -25 l 803 986 l 888 986 m 241 468 q 58 545 126 468 q -3 715 -3 615 q 56 881 -3 813 q 238 958 124 958 q 421 881 353 958 q 483 712 483 813 q 423 544 483 612 q 241 468 356 468 m 241 855 q 137 811 175 855 q 100 710 100 768 q 136 612 100 653 q 240 572 172 572 q 344 614 306 572 q 382 713 382 656 q 347 810 382 771 q 241 855 308 855 m 1428 0 q 1246 76 1314 0 q 1185 244 1185 145 q 1244 412 1185 344 q 1428 489 1311 489 q 1610 412 1542 489 q 1672 244 1672 343 q 1612 76 1672 144 q 1428 0 1545 0 m 1427 103 q 1528 143 1492 103 q 1564 243 1564 184 q 1530 340 1564 301 q 1427 385 1492 385 q 1327 342 1364 385 q 1291 243 1291 300 q 1324 147 1291 186 q 1427 103 1363 103 "},"a":{"x_min":0,"x_max":698.609375,"ha":794,"o":"m 698 0 q 661 -12 679 -7 q 615 -17 643 -17 q 536 12 564 -17 q 500 96 508 41 q 384 6 456 37 q 236 -25 312 -25 q 65 31 130 -25 q 0 194 0 88 q 118 390 0 334 q 328 435 180 420 q 488 483 476 451 q 495 523 495 504 q 442 619 495 584 q 325 654 389 654 q 209 617 257 654 q 152 513 161 580 l 33 513 q 123 705 33 633 q 332 772 207 772 q 528 712 448 772 q 617 531 617 645 l 617 163 q 624 108 617 126 q 664 90 632 90 l 698 94 l 698 0 m 491 262 l 491 372 q 272 329 350 347 q 128 201 128 294 q 166 113 128 144 q 264 83 205 83 q 414 130 346 83 q 491 262 491 183 "},"—":{"x_min":0,"x_max":941.671875,"ha":1039,"o":"m 941 334 l 0 334 l 0 410 l 941 410 l 941 334 "},"=":{"x_min":8.71875,"x_max":780.953125,"ha":792,"o":"m 780 510 l 8 510 l 8 606 l 780 606 l 780 510 m 780 235 l 8 235 l 8 332 l 780 332 l 780 235 "},"N":{"x_min":0,"x_max":801,"ha":914,"o":"m 801 0 l 651 0 l 131 823 l 131 0 l 0 0 l 0 1013 l 151 1013 l 670 193 l 670 1013 l 801 1013 l 801 0 "},"ρ":{"x_min":0,"x_max":712,"ha":797,"o":"m 712 369 q 620 94 712 207 q 362 -26 521 -26 q 230 2 292 -26 q 119 83 167 30 l 119 -278 l 0 -278 l 0 362 q 91 643 0 531 q 355 764 190 764 q 617 647 517 764 q 712 369 712 536 m 583 366 q 530 559 583 480 q 359 651 469 651 q 190 562 252 651 q 135 370 135 483 q 189 176 135 257 q 359 85 250 85 q 528 175 466 85 q 583 366 583 254 "},"2":{"x_min":59,"x_max":731,"ha":792,"o":"m 731 0 l 59 0 q 197 314 59 188 q 457 487 199 315 q 598 691 598 580 q 543 819 598 772 q 411 867 488 867 q 272 811 328 867 q 209 630 209 747 l 81 630 q 182 901 81 805 q 408 986 271 986 q 629 909 536 986 q 731 694 731 826 q 613 449 731 541 q 378 316 495 383 q 201 122 235 234 l 731 122 l 731 0 "},"¯":{"x_min":0,"x_max":941.671875,"ha":938,"o":"m 941 1033 l 0 1033 l 0 1109 l 941 1109 l 941 1033 "},"Z":{"x_min":0,"x_max":779,"ha":849,"o":"m 779 0 l 0 0 l 0 113 l 621 896 l 40 896 l 40 1013 l 779 1013 l 778 887 l 171 124 l 779 124 l 779 0 "},"u":{"x_min":0,"x_max":617,"ha":729,"o":"m 617 0 l 499 0 l 499 110 q 391 10 460 45 q 246 -25 322 -25 q 61 58 127 -25 q 0 258 0 136 l 0 738 l 125 738 l 125 284 q 156 148 125 202 q 273 82 197 82 q 433 165 369 82 q 493 340 493 243 l 493 738 l 617 738 l 617 0 "},"k":{"x_min":0,"x_max":612.484375,"ha":697,"o":"m 612 738 l 338 465 l 608 0 l 469 0 l 251 382 l 121 251 l 121 0 l 0 0 l 0 1013 l 121 1013 l 121 402 l 456 738 l 612 738 "},"Η":{"x_min":0,"x_max":803,"ha":917,"o":"m 803 0 l 667 0 l 667 475 l 140 475 l 140 0 l 0 0 l 0 1013 l 140 1013 l 140 599 l 667 599 l 667 1013 l 803 1013 l 803 0 "},"Α":{"x_min":0,"x_max":906.953125,"ha":985,"o":"m 906 0 l 756 0 l 650 303 l 251 303 l 143 0 l 0 0 l 376 1013 l 529 1013 l 906 0 m 609 421 l 452 866 l 293 421 l 609 421 "},"s":{"x_min":0,"x_max":604,"ha":697,"o":"m 604 217 q 501 36 604 104 q 292 -23 411 -23 q 86 43 166 -23 q 0 238 0 114 l 121 237 q 175 122 121 164 q 300 85 223 85 q 415 112 363 85 q 479 207 479 147 q 361 309 479 276 q 140 372 141 370 q 21 544 21 426 q 111 708 21 647 q 298 761 190 761 q 492 705 413 761 q 583 531 583 643 l 462 531 q 412 625 462 594 q 298 657 363 657 q 199 636 242 657 q 143 558 143 608 q 262 454 143 486 q 484 394 479 397 q 604 217 604 341 "},"B":{"x_min":0,"x_max":778,"ha":876,"o":"m 580 546 q 724 469 670 535 q 778 311 778 403 q 673 83 778 171 q 432 0 575 0 l 0 0 l 0 1013 l 411 1013 q 629 957 541 1013 q 732 768 732 892 q 691 633 732 693 q 580 546 650 572 m 393 899 l 139 899 l 139 588 l 379 588 q 521 624 462 588 q 592 744 592 667 q 531 859 592 819 q 393 899 471 899 m 419 124 q 566 169 504 124 q 635 303 635 219 q 559 436 635 389 q 402 477 494 477 l 139 477 l 139 124 l 419 124 "},"…":{"x_min":0,"x_max":614,"ha":708,"o":"m 142 0 l 0 0 l 0 151 l 142 151 l 142 0 m 378 0 l 236 0 l 236 151 l 378 151 l 378 0 m 614 0 l 472 0 l 472 151 l 614 151 l 614 0 "},"?":{"x_min":0,"x_max":607,"ha":704,"o":"m 607 777 q 543 599 607 674 q 422 474 482 537 q 357 272 357 391 l 236 272 q 297 487 236 395 q 411 619 298 490 q 474 762 474 691 q 422 885 474 838 q 301 933 371 933 q 179 880 228 933 q 124 706 124 819 l 0 706 q 94 963 0 872 q 302 1044 177 1044 q 511 973 423 1044 q 607 777 607 895 m 370 0 l 230 0 l 230 151 l 370 151 l 370 0 "},"H":{"x_min":0,"x_max":803,"ha":915,"o":"m 803 0 l 667 0 l 667 475 l 140 475 l 140 0 l 0 0 l 0 1013 l 140 1013 l 140 599 l 667 599 l 667 1013 l 803 1013 l 803 0 "},"ν":{"x_min":0,"x_max":675,"ha":761,"o":"m 675 738 l 404 0 l 272 0 l 0 738 l 133 738 l 340 147 l 541 738 l 675 738 "},"c":{"x_min":1,"x_max":701.390625,"ha":775,"o":"m 701 264 q 584 53 681 133 q 353 -26 487 -26 q 91 91 188 -26 q 1 370 1 201 q 92 645 1 537 q 353 761 190 761 q 572 688 479 761 q 690 493 666 615 l 556 493 q 487 606 545 562 q 356 650 428 650 q 186 563 246 650 q 134 372 134 487 q 188 179 134 258 q 359 88 250 88 q 492 136 437 88 q 566 264 548 185 l 701 264 "},"¶":{"x_min":0,"x_max":566.671875,"ha":678,"o":"m 21 892 l 52 892 l 98 761 l 145 892 l 176 892 l 178 741 l 157 741 l 157 867 l 108 741 l 88 741 l 40 871 l 40 741 l 21 741 l 21 892 m 308 854 l 308 731 q 252 691 308 691 q 227 691 240 691 q 207 696 213 695 l 207 712 l 253 706 q 288 733 288 706 l 288 763 q 244 741 279 741 q 193 797 193 741 q 261 860 193 860 q 287 860 273 860 q 308 854 302 855 m 288 842 l 263 843 q 213 796 213 843 q 248 756 213 756 q 288 796 288 756 l 288 842 m 566 988 l 502 988 l 502 -1 l 439 -1 l 439 988 l 317 988 l 317 -1 l 252 -1 l 252 602 q 81 653 155 602 q 0 805 0 711 q 101 989 0 918 q 309 1053 194 1053 l 566 1053 l 566 988 "},"β":{"x_min":0,"x_max":660,"ha":745,"o":"m 471 550 q 610 450 561 522 q 660 280 660 378 q 578 64 660 151 q 367 -22 497 -22 q 239 5 299 -22 q 126 82 178 32 l 126 -278 l 0 -278 l 0 593 q 54 903 0 801 q 318 1042 127 1042 q 519 964 436 1042 q 603 771 603 887 q 567 644 603 701 q 471 550 532 586 m 337 79 q 476 138 418 79 q 535 279 535 198 q 427 437 535 386 q 226 477 344 477 l 226 583 q 398 620 329 583 q 486 762 486 668 q 435 884 486 833 q 312 935 384 935 q 169 861 219 935 q 126 698 126 797 l 126 362 q 170 169 126 242 q 337 79 224 79 "},"Μ":{"x_min":0,"x_max":954,"ha":1068,"o":"m 954 0 l 819 0 l 819 868 l 537 0 l 405 0 l 128 865 l 128 0 l 0 0 l 0 1013 l 199 1013 l 472 158 l 758 1013 l 954 1013 l 954 0 "},"Ό":{"x_min":0.109375,"x_max":1120,"ha":1217,"o":"m 1120 505 q 994 132 1120 282 q 642 -29 861 -29 q 290 130 422 -29 q 167 505 167 280 q 294 883 167 730 q 650 1046 430 1046 q 999 882 868 1046 q 1120 505 1120 730 m 977 504 q 896 784 977 669 q 644 915 804 915 q 391 785 484 915 q 307 504 307 669 q 391 224 307 339 q 644 95 486 95 q 894 224 803 95 q 977 504 977 339 m 277 1040 l 83 799 l 0 799 l 140 1040 l 277 1040 "},"Ή":{"x_min":0,"x_max":1158,"ha":1275,"o":"m 1158 0 l 1022 0 l 1022 475 l 496 475 l 496 0 l 356 0 l 356 1012 l 496 1012 l 496 599 l 1022 599 l 1022 1012 l 1158 1012 l 1158 0 m 277 1040 l 83 799 l 0 799 l 140 1040 l 277 1040 "},"•":{"x_min":0,"x_max":663.890625,"ha":775,"o":"m 663 529 q 566 293 663 391 q 331 196 469 196 q 97 294 194 196 q 0 529 0 393 q 96 763 0 665 q 331 861 193 861 q 566 763 469 861 q 663 529 663 665 "},"¥":{"x_min":0.1875,"x_max":819.546875,"ha":886,"o":"m 563 561 l 697 561 l 696 487 l 520 487 l 482 416 l 482 380 l 697 380 l 695 308 l 482 308 l 482 0 l 342 0 l 342 308 l 125 308 l 125 380 l 342 380 l 342 417 l 303 487 l 125 487 l 125 561 l 258 561 l 0 1013 l 140 1013 l 411 533 l 679 1013 l 819 1013 l 563 561 "},"(":{"x_min":0,"x_max":318.0625,"ha":415,"o":"m 318 -290 l 230 -290 q 61 23 122 -142 q 0 365 0 190 q 62 712 0 540 q 230 1024 119 869 l 318 1024 q 175 705 219 853 q 125 360 125 542 q 176 22 125 187 q 318 -290 223 -127 "},"U":{"x_min":0,"x_max":796,"ha":904,"o":"m 796 393 q 681 93 796 212 q 386 -25 566 -25 q 101 95 208 -25 q 0 393 0 211 l 0 1013 l 138 1013 l 138 391 q 204 191 138 270 q 394 107 276 107 q 586 191 512 107 q 656 391 656 270 l 656 1013 l 796 1013 l 796 393 "},"γ":{"x_min":0.5,"x_max":744.953125,"ha":822,"o":"m 744 737 l 463 54 l 463 -278 l 338 -278 l 338 54 l 154 495 q 104 597 124 569 q 13 651 67 651 l 0 651 l 0 751 l 39 753 q 168 711 121 753 q 242 594 207 676 l 403 208 l 617 737 l 744 737 "},"α":{"x_min":0,"x_max":765.5625,"ha":809,"o":"m 765 -4 q 698 -14 726 -14 q 564 97 586 -14 q 466 7 525 40 q 337 -26 407 -26 q 88 98 186 -26 q 0 369 0 212 q 88 637 0 525 q 337 760 184 760 q 465 728 407 760 q 563 637 524 696 l 563 739 l 685 739 l 685 222 q 693 141 685 168 q 748 94 708 94 q 765 96 760 94 l 765 -4 m 584 371 q 531 562 584 485 q 360 653 470 653 q 192 566 254 653 q 135 379 135 489 q 186 181 135 261 q 358 84 247 84 q 528 176 465 84 q 584 371 584 260 "},"F":{"x_min":0,"x_max":683.328125,"ha":717,"o":"m 683 888 l 140 888 l 140 583 l 613 583 l 613 458 l 140 458 l 140 0 l 0 0 l 0 1013 l 683 1013 l 683 888 "},"­":{"x_min":0,"x_max":705.5625,"ha":803,"o":"m 705 334 l 0 334 l 0 410 l 705 410 l 705 334 "},":":{"x_min":0,"x_max":142,"ha":239,"o":"m 142 585 l 0 585 l 0 738 l 142 738 l 142 585 m 142 0 l 0 0 l 0 151 l 142 151 l 142 0 "},"Χ":{"x_min":0,"x_max":854.171875,"ha":935,"o":"m 854 0 l 683 0 l 423 409 l 166 0 l 0 0 l 347 519 l 18 1013 l 186 1013 l 427 637 l 675 1013 l 836 1013 l 504 521 l 854 0 "},"*":{"x_min":116,"x_max":674,"ha":792,"o":"m 674 768 l 475 713 l 610 544 l 517 477 l 394 652 l 272 478 l 178 544 l 314 713 l 116 766 l 153 876 l 341 812 l 342 1013 l 446 1013 l 446 811 l 635 874 l 674 768 "},"†":{"x_min":0,"x_max":777,"ha":835,"o":"m 458 804 l 777 804 l 777 683 l 458 683 l 458 0 l 319 0 l 319 681 l 0 683 l 0 804 l 319 804 l 319 1015 l 458 1013 l 458 804 "},"°":{"x_min":0,"x_max":347,"ha":444,"o":"m 173 802 q 43 856 91 802 q 0 977 0 905 q 45 1101 0 1049 q 173 1153 90 1153 q 303 1098 255 1153 q 347 977 347 1049 q 303 856 347 905 q 173 802 256 802 m 173 884 q 238 910 214 884 q 262 973 262 937 q 239 1038 262 1012 q 173 1064 217 1064 q 108 1037 132 1064 q 85 973 85 1010 q 108 910 85 937 q 173 884 132 884 "},"V":{"x_min":0,"x_max":862.71875,"ha":940,"o":"m 862 1013 l 505 0 l 361 0 l 0 1013 l 143 1013 l 434 165 l 718 1012 l 862 1013 "},"Ξ":{"x_min":0,"x_max":734.71875,"ha":763,"o":"m 723 889 l 9 889 l 9 1013 l 723 1013 l 723 889 m 673 463 l 61 463 l 61 589 l 673 589 l 673 463 m 734 0 l 0 0 l 0 124 l 734 124 l 734 0 "}," ":{"x_min":0,"x_max":0,"ha":853},"Ϋ":{"x_min":0.328125,"x_max":819.515625,"ha":889,"o":"m 588 1046 l 460 1046 l 460 1189 l 588 1189 l 588 1046 m 360 1046 l 232 1046 l 232 1189 l 360 1189 l 360 1046 m 819 1012 l 482 416 l 482 0 l 342 0 l 342 416 l 0 1012 l 140 1012 l 411 533 l 679 1012 l 819 1012 "},"0":{"x_min":73,"x_max":715,"ha":792,"o":"m 394 -29 q 153 129 242 -29 q 73 479 73 272 q 152 829 73 687 q 394 989 241 989 q 634 829 545 989 q 715 479 715 684 q 635 129 715 270 q 394 -29 546 -29 m 394 89 q 546 211 489 89 q 598 479 598 322 q 548 748 598 640 q 394 871 491 871 q 241 748 298 871 q 190 479 190 637 q 239 211 190 319 q 394 89 296 89 "},"”":{"x_min":0,"x_max":347,"ha":454,"o":"m 139 851 q 102 737 139 784 q 0 669 65 690 l 0 734 q 59 787 42 741 q 72 873 72 821 l 0 873 l 0 1013 l 139 1013 l 139 851 m 347 851 q 310 737 347 784 q 208 669 273 690 l 208 734 q 267 787 250 741 q 280 873 280 821 l 208 873 l 208 1013 l 347 1013 l 347 851 "},"@":{"x_min":0,"x_max":1260,"ha":1357,"o":"m 1098 -45 q 877 -160 1001 -117 q 633 -203 752 -203 q 155 -29 327 -203 q 0 360 0 127 q 176 802 0 616 q 687 1008 372 1008 q 1123 854 969 1008 q 1260 517 1260 718 q 1155 216 1260 341 q 868 82 1044 82 q 772 106 801 82 q 737 202 737 135 q 647 113 700 144 q 527 82 594 82 q 367 147 420 82 q 314 312 314 212 q 401 565 314 452 q 639 690 498 690 q 810 588 760 690 l 849 668 l 938 668 q 877 441 900 532 q 833 226 833 268 q 853 182 833 198 q 902 167 873 167 q 1088 272 1012 167 q 1159 512 1159 372 q 1051 793 1159 681 q 687 925 925 925 q 248 747 415 925 q 97 361 97 586 q 226 26 97 159 q 627 -122 370 -122 q 856 -87 737 -122 q 1061 8 976 -53 l 1098 -45 m 786 488 q 738 580 777 545 q 643 615 700 615 q 483 517 548 615 q 425 322 425 430 q 457 203 425 250 q 552 156 490 156 q 722 273 665 156 q 786 488 738 309 "},"Ί":{"x_min":0,"x_max":499,"ha":613,"o":"m 277 1040 l 83 799 l 0 799 l 140 1040 l 277 1040 m 499 0 l 360 0 l 360 1012 l 499 1012 l 499 0 "},"i":{"x_min":14,"x_max":136,"ha":275,"o":"m 136 873 l 14 873 l 14 1013 l 136 1013 l 136 873 m 136 0 l 14 0 l 14 737 l 136 737 l 136 0 "},"Β":{"x_min":0,"x_max":778,"ha":877,"o":"m 580 545 q 724 468 671 534 q 778 310 778 402 q 673 83 778 170 q 432 0 575 0 l 0 0 l 0 1013 l 411 1013 q 629 957 541 1013 q 732 768 732 891 q 691 632 732 692 q 580 545 650 571 m 393 899 l 139 899 l 139 587 l 379 587 q 521 623 462 587 q 592 744 592 666 q 531 859 592 819 q 393 899 471 899 m 419 124 q 566 169 504 124 q 635 302 635 219 q 559 435 635 388 q 402 476 494 476 l 139 476 l 139 124 l 419 124 "},"υ":{"x_min":0,"x_max":617,"ha":725,"o":"m 617 352 q 540 94 617 199 q 308 -24 455 -24 q 76 94 161 -24 q 0 352 0 199 l 0 739 l 126 739 l 126 355 q 169 185 126 257 q 312 98 220 98 q 451 185 402 98 q 492 355 492 257 l 492 739 l 617 739 l 617 352 "},"]":{"x_min":0,"x_max":275,"ha":372,"o":"m 275 -281 l 0 -281 l 0 -187 l 151 -187 l 151 920 l 0 920 l 0 1013 l 275 1013 l 275 -281 "},"m":{"x_min":0,"x_max":1019,"ha":1128,"o":"m 1019 0 l 897 0 l 897 454 q 860 591 897 536 q 739 660 816 660 q 613 586 659 660 q 573 436 573 522 l 573 0 l 447 0 l 447 455 q 412 591 447 535 q 294 657 372 657 q 165 586 213 657 q 122 437 122 521 l 122 0 l 0 0 l 0 738 l 117 738 l 117 640 q 202 730 150 697 q 316 763 254 763 q 437 730 381 763 q 525 642 494 697 q 621 731 559 700 q 753 763 682 763 q 943 694 867 763 q 1019 512 1019 625 l 1019 0 "},"χ":{"x_min":8.328125,"x_max":780.5625,"ha":815,"o":"m 780 -278 q 715 -294 747 -294 q 616 -257 663 -294 q 548 -175 576 -227 l 379 133 l 143 -277 l 9 -277 l 313 254 l 163 522 q 127 586 131 580 q 36 640 91 640 q 8 637 27 640 l 8 752 l 52 757 q 162 719 113 757 q 236 627 200 690 l 383 372 l 594 737 l 726 737 l 448 250 l 625 -69 q 670 -153 647 -110 q 743 -188 695 -188 q 780 -184 759 -188 l 780 -278 "},"8":{"x_min":55,"x_max":736,"ha":792,"o":"m 571 527 q 694 424 652 491 q 736 280 736 358 q 648 71 736 158 q 395 -26 551 -26 q 142 69 238 -26 q 55 279 55 157 q 96 425 55 359 q 220 527 138 491 q 120 615 153 562 q 88 726 88 668 q 171 904 88 827 q 395 986 261 986 q 618 905 529 986 q 702 727 702 830 q 670 616 702 667 q 571 527 638 565 m 394 565 q 519 610 475 565 q 563 717 563 655 q 521 823 563 781 q 392 872 474 872 q 265 824 312 872 q 224 720 224 783 q 265 613 224 656 q 394 565 312 565 m 395 91 q 545 150 488 91 q 597 280 597 204 q 546 408 597 355 q 395 465 492 465 q 244 408 299 465 q 194 280 194 356 q 244 150 194 203 q 395 91 299 91 "},"ί":{"x_min":42,"x_max":326.71875,"ha":361,"o":"m 284 3 q 233 -10 258 -5 q 182 -15 207 -15 q 85 26 119 -15 q 42 200 42 79 l 42 737 l 167 737 l 168 215 q 172 141 168 157 q 226 101 183 101 q 248 102 239 101 q 284 112 257 104 l 284 3 m 326 1040 l 137 819 l 54 819 l 189 1040 l 326 1040 "},"Ζ":{"x_min":0,"x_max":779.171875,"ha":850,"o":"m 779 0 l 0 0 l 0 113 l 620 896 l 40 896 l 40 1013 l 779 1013 l 779 887 l 170 124 l 779 124 l 779 0 "},"R":{"x_min":0,"x_max":781.953125,"ha":907,"o":"m 781 0 l 623 0 q 587 242 590 52 q 407 433 585 433 l 138 433 l 138 0 l 0 0 l 0 1013 l 396 1013 q 636 946 539 1013 q 749 731 749 868 q 711 597 749 659 q 608 502 674 534 q 718 370 696 474 q 729 207 722 352 q 781 26 736 62 l 781 0 m 373 551 q 533 594 465 551 q 614 731 614 645 q 532 859 614 815 q 373 896 465 896 l 138 896 l 138 551 l 373 551 "},"o":{"x_min":0,"x_max":713,"ha":821,"o":"m 357 -25 q 94 91 194 -25 q 0 368 0 202 q 93 642 0 533 q 357 761 193 761 q 618 644 518 761 q 713 368 713 533 q 619 91 713 201 q 357 -25 521 -25 m 357 85 q 528 175 465 85 q 584 369 584 255 q 529 562 584 484 q 357 651 467 651 q 189 560 250 651 q 135 369 135 481 q 187 177 135 257 q 357 85 250 85 "},"5":{"x_min":54.171875,"x_max":738,"ha":792,"o":"m 738 314 q 626 60 738 153 q 382 -23 526 -23 q 155 47 248 -23 q 54 256 54 125 l 183 256 q 259 132 204 174 q 382 91 314 91 q 533 149 471 91 q 602 314 602 213 q 538 469 602 411 q 386 528 475 528 q 284 506 332 528 q 197 439 237 484 l 81 439 l 159 958 l 684 958 l 684 840 l 254 840 l 214 579 q 306 627 258 612 q 407 643 354 643 q 636 552 540 643 q 738 314 738 457 "},"7":{"x_min":58.71875,"x_max":730.953125,"ha":792,"o":"m 730 839 q 469 448 560 641 q 335 0 378 255 l 192 0 q 328 441 235 252 q 593 830 421 630 l 58 830 l 58 958 l 730 958 l 730 839 "},"K":{"x_min":0,"x_max":819.46875,"ha":906,"o":"m 819 0 l 649 0 l 294 509 l 139 355 l 139 0 l 0 0 l 0 1013 l 139 1013 l 139 526 l 626 1013 l 809 1013 l 395 600 l 819 0 "},",":{"x_min":0,"x_max":142,"ha":239,"o":"m 142 -12 q 105 -132 142 -82 q 0 -205 68 -182 l 0 -138 q 57 -82 40 -124 q 70 0 70 -51 l 0 0 l 0 151 l 142 151 l 142 -12 "},"d":{"x_min":0,"x_max":683,"ha":796,"o":"m 683 0 l 564 0 l 564 93 q 456 6 516 38 q 327 -25 395 -25 q 87 100 181 -25 q 0 365 0 215 q 90 639 0 525 q 343 763 187 763 q 564 647 486 763 l 564 1013 l 683 1013 l 683 0 m 582 373 q 529 562 582 484 q 361 653 468 653 q 190 561 253 653 q 135 365 135 479 q 189 175 135 254 q 358 85 251 85 q 529 178 468 85 q 582 373 582 258 "},"¨":{"x_min":-109,"x_max":247,"ha":232,"o":"m 247 1046 l 119 1046 l 119 1189 l 247 1189 l 247 1046 m 19 1046 l -109 1046 l -109 1189 l 19 1189 l 19 1046 "},"E":{"x_min":0,"x_max":736.109375,"ha":789,"o":"m 736 0 l 0 0 l 0 1013 l 725 1013 l 725 889 l 139 889 l 139 585 l 677 585 l 677 467 l 139 467 l 139 125 l 736 125 l 736 0 "},"Y":{"x_min":0,"x_max":820,"ha":886,"o":"m 820 1013 l 482 416 l 482 0 l 342 0 l 342 416 l 0 1013 l 140 1013 l 411 534 l 679 1012 l 820 1013 "},"\"":{"x_min":0,"x_max":299,"ha":396,"o":"m 299 606 l 203 606 l 203 988 l 299 988 l 299 606 m 96 606 l 0 606 l 0 988 l 96 988 l 96 606 "},"‹":{"x_min":17.984375,"x_max":773.609375,"ha":792,"o":"m 773 40 l 18 376 l 17 465 l 773 799 l 773 692 l 159 420 l 773 149 l 773 40 "},"„":{"x_min":0,"x_max":364,"ha":467,"o":"m 141 -12 q 104 -132 141 -82 q 0 -205 67 -182 l 0 -138 q 56 -82 40 -124 q 69 0 69 -51 l 0 0 l 0 151 l 141 151 l 141 -12 m 364 -12 q 327 -132 364 -82 q 222 -205 290 -182 l 222 -138 q 279 -82 262 -124 q 292 0 292 -51 l 222 0 l 222 151 l 364 151 l 364 -12 "},"δ":{"x_min":1,"x_max":710,"ha":810,"o":"m 710 360 q 616 87 710 196 q 356 -28 518 -28 q 99 82 197 -28 q 1 356 1 192 q 100 606 1 509 q 355 703 199 703 q 180 829 288 754 q 70 903 124 866 l 70 1012 l 643 1012 l 643 901 l 258 901 q 462 763 422 794 q 636 592 577 677 q 710 360 710 485 m 584 365 q 552 501 584 447 q 451 602 521 555 q 372 611 411 611 q 197 541 258 611 q 136 355 136 472 q 190 171 136 245 q 358 85 252 85 q 528 173 465 85 q 584 365 584 252 "},"έ":{"x_min":0,"x_max":634.71875,"ha":714,"o":"m 634 234 q 527 38 634 110 q 300 -25 433 -25 q 98 29 183 -25 q 0 204 0 93 q 37 313 0 265 q 128 390 67 352 q 56 459 82 419 q 26 555 26 505 q 114 712 26 654 q 295 763 191 763 q 499 700 416 763 q 589 515 589 631 l 478 515 q 419 618 464 580 q 307 657 374 657 q 207 630 253 657 q 151 547 151 598 q 238 445 151 469 q 389 434 280 434 l 389 331 l 349 331 q 206 315 255 331 q 125 210 125 287 q 183 107 125 145 q 302 76 233 76 q 436 117 379 76 q 509 234 493 159 l 634 234 m 520 1040 l 331 819 l 248 819 l 383 1040 l 520 1040 "},"ω":{"x_min":0,"x_max":922,"ha":1031,"o":"m 922 339 q 856 97 922 203 q 650 -26 780 -26 q 538 9 587 -26 q 461 103 489 44 q 387 12 436 46 q 277 -22 339 -22 q 69 97 147 -22 q 0 339 0 203 q 45 551 0 444 q 161 738 84 643 l 302 738 q 175 553 219 647 q 124 336 124 446 q 155 179 124 249 q 275 88 197 88 q 375 163 341 88 q 400 294 400 219 l 400 572 l 524 572 l 524 294 q 561 135 524 192 q 643 88 591 88 q 762 182 719 88 q 797 342 797 257 q 745 556 797 450 q 619 738 705 638 l 760 738 q 874 551 835 640 q 922 339 922 444 "},"´":{"x_min":0,"x_max":96,"ha":251,"o":"m 96 606 l 0 606 l 0 988 l 96 988 l 96 606 "},"±":{"x_min":11,"x_max":781,"ha":792,"o":"m 781 490 l 446 490 l 446 255 l 349 255 l 349 490 l 11 490 l 11 586 l 349 586 l 349 819 l 446 819 l 446 586 l 781 586 l 781 490 m 781 21 l 11 21 l 11 115 l 781 115 l 781 21 "},"|":{"x_min":343,"x_max":449,"ha":792,"o":"m 449 462 l 343 462 l 343 986 l 449 986 l 449 462 m 449 -242 l 343 -242 l 343 280 l 449 280 l 449 -242 "},"ϋ":{"x_min":0,"x_max":617,"ha":725,"o":"m 482 800 l 372 800 l 372 925 l 482 925 l 482 800 m 239 800 l 129 800 l 129 925 l 239 925 l 239 800 m 617 352 q 540 93 617 199 q 308 -24 455 -24 q 76 93 161 -24 q 0 352 0 199 l 0 738 l 126 738 l 126 354 q 169 185 126 257 q 312 98 220 98 q 451 185 402 98 q 492 354 492 257 l 492 738 l 617 738 l 617 352 "},"§":{"x_min":0,"x_max":593,"ha":690,"o":"m 593 425 q 554 312 593 369 q 467 233 516 254 q 537 83 537 172 q 459 -74 537 -12 q 288 -133 387 -133 q 115 -69 184 -133 q 47 96 47 -6 l 166 96 q 199 7 166 40 q 288 -26 232 -26 q 371 -5 332 -26 q 420 60 420 21 q 311 201 420 139 q 108 309 210 255 q 0 490 0 383 q 33 602 0 551 q 124 687 66 654 q 75 743 93 712 q 58 812 58 773 q 133 984 58 920 q 300 1043 201 1043 q 458 987 394 1043 q 529 814 529 925 l 411 814 q 370 908 404 877 q 289 939 336 939 q 213 911 246 939 q 180 841 180 883 q 286 720 180 779 q 484 612 480 615 q 593 425 593 534 m 467 409 q 355 544 467 473 q 196 630 228 612 q 146 587 162 609 q 124 525 124 558 q 239 387 124 462 q 398 298 369 315 q 448 345 429 316 q 467 409 467 375 "},"b":{"x_min":0,"x_max":685,"ha":783,"o":"m 685 372 q 597 99 685 213 q 347 -25 501 -25 q 219 5 277 -25 q 121 93 161 36 l 121 0 l 0 0 l 0 1013 l 121 1013 l 121 634 q 214 723 157 692 q 341 754 272 754 q 591 637 493 754 q 685 372 685 526 m 554 356 q 499 550 554 470 q 328 644 437 644 q 162 556 223 644 q 108 369 108 478 q 160 176 108 256 q 330 83 221 83 q 498 169 435 83 q 554 356 554 245 "},"q":{"x_min":0,"x_max":683,"ha":876,"o":"m 683 -278 l 564 -278 l 564 97 q 474 8 533 39 q 345 -23 415 -23 q 91 93 188 -23 q 0 364 0 203 q 87 635 0 522 q 337 760 184 760 q 466 727 408 760 q 564 637 523 695 l 564 737 l 683 737 l 683 -278 m 582 375 q 527 564 582 488 q 358 652 466 652 q 190 565 253 652 q 135 377 135 488 q 189 179 135 261 q 361 84 251 84 q 530 179 469 84 q 582 375 582 260 "},"Ω":{"x_min":-0.171875,"x_max":969.5625,"ha":1068,"o":"m 969 0 l 555 0 l 555 123 q 744 308 675 194 q 814 558 814 423 q 726 812 814 709 q 484 922 633 922 q 244 820 334 922 q 154 567 154 719 q 223 316 154 433 q 412 123 292 199 l 412 0 l 0 0 l 0 124 l 217 124 q 68 327 122 210 q 15 572 15 444 q 144 911 15 781 q 484 1041 274 1041 q 822 909 691 1041 q 953 569 953 777 q 899 326 953 443 q 750 124 846 210 l 969 124 l 969 0 "},"ύ":{"x_min":0,"x_max":617,"ha":725,"o":"m 617 352 q 540 93 617 199 q 308 -24 455 -24 q 76 93 161 -24 q 0 352 0 199 l 0 738 l 126 738 l 126 354 q 169 185 126 257 q 312 98 220 98 q 451 185 402 98 q 492 354 492 257 l 492 738 l 617 738 l 617 352 m 535 1040 l 346 819 l 262 819 l 397 1040 l 535 1040 "},"z":{"x_min":-0.015625,"x_max":613.890625,"ha":697,"o":"m 613 0 l 0 0 l 0 100 l 433 630 l 20 630 l 20 738 l 594 738 l 593 636 l 163 110 l 613 110 l 613 0 "},"™":{"x_min":0,"x_max":894,"ha":1000,"o":"m 389 951 l 229 951 l 229 503 l 160 503 l 160 951 l 0 951 l 0 1011 l 389 1011 l 389 951 m 894 503 l 827 503 l 827 939 l 685 503 l 620 503 l 481 937 l 481 503 l 417 503 l 417 1011 l 517 1011 l 653 580 l 796 1010 l 894 1011 l 894 503 "},"ή":{"x_min":0.78125,"x_max":697,"ha":810,"o":"m 697 -278 l 572 -278 l 572 454 q 540 587 572 536 q 425 650 501 650 q 271 579 337 650 q 206 420 206 509 l 206 0 l 81 0 l 81 489 q 73 588 81 562 q 0 644 56 644 l 0 741 q 68 755 38 755 q 158 721 124 755 q 200 630 193 687 q 297 726 234 692 q 434 761 359 761 q 620 692 544 761 q 697 516 697 624 l 697 -278 m 479 1040 l 290 819 l 207 819 l 341 1040 l 479 1040 "},"Θ":{"x_min":0,"x_max":960,"ha":1056,"o":"m 960 507 q 833 129 960 280 q 476 -32 698 -32 q 123 129 255 -32 q 0 507 0 280 q 123 883 0 732 q 476 1045 255 1045 q 832 883 696 1045 q 960 507 960 732 m 817 500 q 733 789 817 669 q 476 924 639 924 q 223 792 317 924 q 142 507 142 675 q 222 222 142 339 q 476 89 315 89 q 730 218 636 89 q 817 500 817 334 m 716 449 l 243 449 l 243 571 l 716 571 l 716 449 "},"®":{"x_min":-3,"x_max":1008,"ha":1106,"o":"m 503 532 q 614 562 566 532 q 672 658 672 598 q 614 747 672 716 q 503 772 569 772 l 338 772 l 338 532 l 503 532 m 502 -7 q 123 151 263 -7 q -3 501 -3 294 q 123 851 -3 706 q 502 1011 263 1011 q 881 851 739 1011 q 1008 501 1008 708 q 883 151 1008 292 q 502 -7 744 -7 m 502 60 q 830 197 709 60 q 940 501 940 322 q 831 805 940 681 q 502 944 709 944 q 174 805 296 944 q 65 501 65 680 q 173 197 65 320 q 502 60 294 60 m 788 146 l 678 146 q 653 316 655 183 q 527 449 652 449 l 338 449 l 338 146 l 241 146 l 241 854 l 518 854 q 688 808 621 854 q 766 658 766 755 q 739 563 766 607 q 668 497 713 519 q 751 331 747 472 q 788 164 756 190 l 788 146 "},"~":{"x_min":0,"x_max":833,"ha":931,"o":"m 833 958 q 778 753 833 831 q 594 665 716 665 q 402 761 502 665 q 240 857 302 857 q 131 795 166 857 q 104 665 104 745 l 0 665 q 54 867 0 789 q 237 958 116 958 q 429 861 331 958 q 594 765 527 765 q 704 827 670 765 q 729 958 729 874 l 833 958 "},"Ε":{"x_min":0,"x_max":736.21875,"ha":778,"o":"m 736 0 l 0 0 l 0 1013 l 725 1013 l 725 889 l 139 889 l 139 585 l 677 585 l 677 467 l 139 467 l 139 125 l 736 125 l 736 0 "},"³":{"x_min":0,"x_max":450,"ha":547,"o":"m 450 552 q 379 413 450 464 q 220 366 313 366 q 69 414 130 366 q 0 567 0 470 l 85 567 q 126 470 85 504 q 225 437 168 437 q 320 467 280 437 q 360 552 360 498 q 318 632 360 608 q 213 657 276 657 q 195 657 203 657 q 176 657 181 657 l 176 722 q 279 733 249 722 q 334 815 334 752 q 300 881 334 856 q 220 907 267 907 q 133 875 169 907 q 97 781 97 844 l 15 781 q 78 926 15 875 q 220 972 135 972 q 364 930 303 972 q 426 817 426 888 q 344 697 426 733 q 421 642 392 681 q 450 552 450 603 "},"[":{"x_min":0,"x_max":273.609375,"ha":371,"o":"m 273 -281 l 0 -281 l 0 1013 l 273 1013 l 273 920 l 124 920 l 124 -187 l 273 -187 l 273 -281 "},"L":{"x_min":0,"x_max":645.828125,"ha":696,"o":"m 645 0 l 0 0 l 0 1013 l 140 1013 l 140 126 l 645 126 l 645 0 "},"σ":{"x_min":0,"x_max":803.390625,"ha":894,"o":"m 803 628 l 633 628 q 713 368 713 512 q 618 93 713 204 q 357 -25 518 -25 q 94 91 194 -25 q 0 368 0 201 q 94 644 0 533 q 356 761 194 761 q 481 750 398 761 q 608 739 564 739 l 803 739 l 803 628 m 360 85 q 529 180 467 85 q 584 374 584 262 q 527 566 584 490 q 352 651 463 651 q 187 559 247 651 q 135 368 135 478 q 189 175 135 254 q 360 85 251 85 "},"ζ":{"x_min":0,"x_max":573,"ha":642,"o":"m 573 -40 q 553 -162 573 -97 q 510 -278 543 -193 l 400 -278 q 441 -187 428 -219 q 462 -90 462 -132 q 378 -14 462 -14 q 108 45 197 -14 q 0 290 0 117 q 108 631 0 462 q 353 901 194 767 l 55 901 l 55 1012 l 561 1012 l 561 924 q 261 669 382 831 q 128 301 128 489 q 243 117 128 149 q 458 98 350 108 q 573 -40 573 80 "},"θ":{"x_min":0,"x_max":674,"ha":778,"o":"m 674 496 q 601 160 674 304 q 336 -26 508 -26 q 73 153 165 -26 q 0 485 0 296 q 72 840 0 683 q 343 1045 166 1045 q 605 844 516 1045 q 674 496 674 692 m 546 579 q 498 798 546 691 q 336 935 437 935 q 178 798 237 935 q 126 579 137 701 l 546 579 m 546 475 l 126 475 q 170 233 126 348 q 338 80 230 80 q 504 233 447 80 q 546 475 546 346 "},"Ο":{"x_min":0,"x_max":958,"ha":1054,"o":"m 485 1042 q 834 883 703 1042 q 958 511 958 735 q 834 136 958 287 q 481 -26 701 -26 q 126 130 261 -26 q 0 504 0 279 q 127 880 0 729 q 485 1042 263 1042 m 480 98 q 731 225 638 98 q 815 504 815 340 q 733 783 815 670 q 480 913 640 913 q 226 785 321 913 q 142 504 142 671 q 226 224 142 339 q 480 98 319 98 "},"Γ":{"x_min":0,"x_max":705.28125,"ha":749,"o":"m 705 886 l 140 886 l 140 0 l 0 0 l 0 1012 l 705 1012 l 705 886 "}," ":{"x_min":0,"x_max":0,"ha":375},"%":{"x_min":-3,"x_max":1089,"ha":1186,"o":"m 845 0 q 663 76 731 0 q 602 244 602 145 q 661 412 602 344 q 845 489 728 489 q 1027 412 959 489 q 1089 244 1089 343 q 1029 76 1089 144 q 845 0 962 0 m 844 103 q 945 143 909 103 q 981 243 981 184 q 947 340 981 301 q 844 385 909 385 q 744 342 781 385 q 708 243 708 300 q 741 147 708 186 q 844 103 780 103 m 888 986 l 284 -25 l 199 -25 l 803 986 l 888 986 m 241 468 q 58 545 126 468 q -3 715 -3 615 q 56 881 -3 813 q 238 958 124 958 q 421 881 353 958 q 483 712 483 813 q 423 544 483 612 q 241 468 356 468 m 241 855 q 137 811 175 855 q 100 710 100 768 q 136 612 100 653 q 240 572 172 572 q 344 614 306 572 q 382 713 382 656 q 347 810 382 771 q 241 855 308 855 "},"P":{"x_min":0,"x_max":726,"ha":806,"o":"m 424 1013 q 640 931 555 1013 q 726 719 726 850 q 637 506 726 587 q 413 426 548 426 l 140 426 l 140 0 l 0 0 l 0 1013 l 424 1013 m 379 889 l 140 889 l 140 548 l 372 548 q 522 589 459 548 q 593 720 593 637 q 528 845 593 801 q 379 889 463 889 "},"Έ":{"x_min":0,"x_max":1078.21875,"ha":1118,"o":"m 1078 0 l 342 0 l 342 1013 l 1067 1013 l 1067 889 l 481 889 l 481 585 l 1019 585 l 1019 467 l 481 467 l 481 125 l 1078 125 l 1078 0 m 277 1040 l 83 799 l 0 799 l 140 1040 l 277 1040 "},"Ώ":{"x_min":0.125,"x_max":1136.546875,"ha":1235,"o":"m 1136 0 l 722 0 l 722 123 q 911 309 842 194 q 981 558 981 423 q 893 813 981 710 q 651 923 800 923 q 411 821 501 923 q 321 568 321 720 q 390 316 321 433 q 579 123 459 200 l 579 0 l 166 0 l 166 124 l 384 124 q 235 327 289 210 q 182 572 182 444 q 311 912 182 782 q 651 1042 441 1042 q 989 910 858 1042 q 1120 569 1120 778 q 1066 326 1120 443 q 917 124 1013 210 l 1136 124 l 1136 0 m 277 1040 l 83 800 l 0 800 l 140 1041 l 277 1040 "},"_":{"x_min":0,"x_max":705.5625,"ha":803,"o":"m 705 -334 l 0 -334 l 0 -234 l 705 -234 l 705 -334 "},"Ϊ":{"x_min":-110,"x_max":246,"ha":275,"o":"m 246 1046 l 118 1046 l 118 1189 l 246 1189 l 246 1046 m 18 1046 l -110 1046 l -110 1189 l 18 1189 l 18 1046 m 136 0 l 0 0 l 0 1012 l 136 1012 l 136 0 "},"+":{"x_min":23,"x_max":768,"ha":792,"o":"m 768 372 l 444 372 l 444 0 l 347 0 l 347 372 l 23 372 l 23 468 l 347 468 l 347 840 l 444 840 l 444 468 l 768 468 l 768 372 "},"½":{"x_min":0,"x_max":1050,"ha":1149,"o":"m 1050 0 l 625 0 q 712 178 625 108 q 878 277 722 187 q 967 385 967 328 q 932 456 967 429 q 850 484 897 484 q 759 450 798 484 q 721 352 721 416 l 640 352 q 706 502 640 448 q 851 551 766 551 q 987 509 931 551 q 1050 385 1050 462 q 976 251 1050 301 q 829 179 902 215 q 717 68 740 133 l 1050 68 l 1050 0 m 834 985 l 215 -28 l 130 -28 l 750 984 l 834 985 m 224 422 l 142 422 l 142 811 l 0 811 l 0 867 q 104 889 62 867 q 164 973 157 916 l 224 973 l 224 422 "},"Ρ":{"x_min":0,"x_max":720,"ha":783,"o":"m 424 1013 q 637 933 554 1013 q 720 723 720 853 q 633 508 720 591 q 413 426 546 426 l 140 426 l 140 0 l 0 0 l 0 1013 l 424 1013 m 378 889 l 140 889 l 140 548 l 371 548 q 521 589 458 548 q 592 720 592 637 q 527 845 592 801 q 378 889 463 889 "},"'":{"x_min":0,"x_max":139,"ha":236,"o":"m 139 851 q 102 737 139 784 q 0 669 65 690 l 0 734 q 59 787 42 741 q 72 873 72 821 l 0 873 l 0 1013 l 139 1013 l 139 851 "},"ª":{"x_min":0,"x_max":350,"ha":397,"o":"m 350 625 q 307 616 328 616 q 266 631 281 616 q 247 673 251 645 q 190 628 225 644 q 116 613 156 613 q 32 641 64 613 q 0 722 0 669 q 72 826 0 800 q 247 866 159 846 l 247 887 q 220 934 247 916 q 162 953 194 953 q 104 934 129 953 q 76 882 80 915 l 16 882 q 60 976 16 941 q 166 1011 104 1011 q 266 979 224 1011 q 308 891 308 948 l 308 706 q 311 679 308 688 q 331 670 315 670 l 350 672 l 350 625 m 247 757 l 247 811 q 136 790 175 798 q 64 726 64 773 q 83 682 64 697 q 132 667 103 667 q 207 690 174 667 q 247 757 247 718 "},"΅":{"x_min":0,"x_max":450,"ha":553,"o":"m 450 800 l 340 800 l 340 925 l 450 925 l 450 800 m 406 1040 l 212 800 l 129 800 l 269 1040 l 406 1040 m 110 800 l 0 800 l 0 925 l 110 925 l 110 800 "},"T":{"x_min":0,"x_max":777,"ha":835,"o":"m 777 894 l 458 894 l 458 0 l 319 0 l 319 894 l 0 894 l 0 1013 l 777 1013 l 777 894 "},"Φ":{"x_min":0,"x_max":915,"ha":997,"o":"m 527 0 l 389 0 l 389 122 q 110 231 220 122 q 0 509 0 340 q 110 785 0 677 q 389 893 220 893 l 389 1013 l 527 1013 l 527 893 q 804 786 693 893 q 915 509 915 679 q 805 231 915 341 q 527 122 696 122 l 527 0 m 527 226 q 712 310 641 226 q 779 507 779 389 q 712 705 779 627 q 527 787 641 787 l 527 226 m 389 226 l 389 787 q 205 698 275 775 q 136 505 136 620 q 206 308 136 391 q 389 226 276 226 "},"⁋":{"x_min":0,"x_max":0,"ha":694},"j":{"x_min":-77.78125,"x_max":167,"ha":349,"o":"m 167 871 l 42 871 l 42 1013 l 167 1013 l 167 871 m 167 -80 q 121 -231 167 -184 q -26 -278 76 -278 l -77 -278 l -77 -164 l -41 -164 q 26 -143 11 -164 q 42 -65 42 -122 l 42 737 l 167 737 l 167 -80 "},"Σ":{"x_min":0,"x_max":756.953125,"ha":819,"o":"m 756 0 l 0 0 l 0 107 l 395 523 l 22 904 l 22 1013 l 745 1013 l 745 889 l 209 889 l 566 523 l 187 125 l 756 125 l 756 0 "},"1":{"x_min":215.671875,"x_max":574,"ha":792,"o":"m 574 0 l 442 0 l 442 697 l 215 697 l 215 796 q 386 833 330 796 q 475 986 447 875 l 574 986 l 574 0 "},"›":{"x_min":18.0625,"x_max":774,"ha":792,"o":"m 774 376 l 18 40 l 18 149 l 631 421 l 18 692 l 18 799 l 774 465 l 774 376 "},"<":{"x_min":17.984375,"x_max":773.609375,"ha":792,"o":"m 773 40 l 18 376 l 17 465 l 773 799 l 773 692 l 159 420 l 773 149 l 773 40 "},"£":{"x_min":0,"x_max":704.484375,"ha":801,"o":"m 704 41 q 623 -10 664 5 q 543 -26 583 -26 q 359 15 501 -26 q 243 36 288 36 q 158 23 197 36 q 73 -21 119 10 l 6 76 q 125 195 90 150 q 175 331 175 262 q 147 443 175 383 l 0 443 l 0 512 l 108 512 q 43 734 43 623 q 120 929 43 854 q 358 1010 204 1010 q 579 936 487 1010 q 678 729 678 857 l 678 684 l 552 684 q 504 838 552 780 q 362 896 457 896 q 216 852 263 896 q 176 747 176 815 q 199 627 176 697 q 248 512 217 574 l 468 512 l 468 443 l 279 443 q 297 356 297 398 q 230 194 297 279 q 153 107 211 170 q 227 133 190 125 q 293 142 264 142 q 410 119 339 142 q 516 96 482 96 q 579 105 550 96 q 648 142 608 115 l 704 41 "},"t":{"x_min":0,"x_max":367,"ha":458,"o":"m 367 0 q 312 -5 339 -2 q 262 -8 284 -8 q 145 28 183 -8 q 108 143 108 64 l 108 638 l 0 638 l 0 738 l 108 738 l 108 944 l 232 944 l 232 738 l 367 738 l 367 638 l 232 638 l 232 185 q 248 121 232 140 q 307 102 264 102 q 345 104 330 102 q 367 107 360 107 l 367 0 "},"¬":{"x_min":0,"x_max":706,"ha":803,"o":"m 706 411 l 706 158 l 630 158 l 630 335 l 0 335 l 0 411 l 706 411 "},"λ":{"x_min":0,"x_max":750,"ha":803,"o":"m 750 -7 q 679 -15 716 -15 q 538 59 591 -15 q 466 214 512 97 l 336 551 l 126 0 l 0 0 l 270 705 q 223 837 247 770 q 116 899 190 899 q 90 898 100 899 l 90 1004 q 152 1011 125 1011 q 298 938 244 1011 q 373 783 326 901 l 605 192 q 649 115 629 136 q 716 95 669 95 l 736 95 q 750 97 745 97 l 750 -7 "},"W":{"x_min":0,"x_max":1263.890625,"ha":1351,"o":"m 1263 1013 l 995 0 l 859 0 l 627 837 l 405 0 l 265 0 l 0 1013 l 136 1013 l 342 202 l 556 1013 l 701 1013 l 921 207 l 1133 1012 l 1263 1013 "},">":{"x_min":18.0625,"x_max":774,"ha":792,"o":"m 774 376 l 18 40 l 18 149 l 631 421 l 18 692 l 18 799 l 774 465 l 774 376 "},"v":{"x_min":0,"x_max":675.15625,"ha":761,"o":"m 675 738 l 404 0 l 272 0 l 0 738 l 133 737 l 340 147 l 541 737 l 675 738 "},"τ":{"x_min":0.28125,"x_max":644.5,"ha":703,"o":"m 644 628 l 382 628 l 382 179 q 388 120 382 137 q 436 91 401 91 q 474 94 447 91 q 504 97 501 97 l 504 0 q 454 -9 482 -5 q 401 -14 426 -14 q 278 67 308 -14 q 260 233 260 118 l 260 628 l 0 628 l 0 739 l 644 739 l 644 628 "},"ξ":{"x_min":0,"x_max":624.9375,"ha":699,"o":"m 624 -37 q 608 -153 624 -96 q 563 -278 593 -211 l 454 -278 q 491 -183 486 -200 q 511 -83 511 -126 q 484 -23 511 -44 q 370 1 452 1 q 323 0 354 1 q 283 -1 293 -1 q 84 76 169 -1 q 0 266 0 154 q 56 431 0 358 q 197 538 108 498 q 94 613 134 562 q 54 730 54 665 q 77 823 54 780 q 143 901 101 867 l 27 901 l 27 1012 l 576 1012 l 576 901 l 380 901 q 244 863 303 901 q 178 745 178 820 q 312 600 178 636 q 532 582 380 582 l 532 479 q 276 455 361 479 q 118 281 118 410 q 165 173 118 217 q 274 120 208 133 q 494 101 384 110 q 624 -37 624 76 "},"&":{"x_min":-3,"x_max":894.25,"ha":992,"o":"m 894 0 l 725 0 l 624 123 q 471 0 553 40 q 306 -41 390 -41 q 168 -7 231 -41 q 62 92 105 26 q 14 187 31 139 q -3 276 -3 235 q 55 433 -3 358 q 248 581 114 508 q 170 689 196 640 q 137 817 137 751 q 214 985 137 922 q 384 1041 284 1041 q 548 988 483 1041 q 622 824 622 928 q 563 666 622 739 q 431 556 516 608 l 621 326 q 649 407 639 361 q 663 493 653 426 l 781 493 q 703 229 781 352 l 894 0 m 504 818 q 468 908 504 877 q 384 940 433 940 q 293 907 331 940 q 255 818 255 875 q 289 714 255 767 q 363 628 313 678 q 477 729 446 682 q 504 818 504 771 m 556 209 l 314 499 q 179 395 223 449 q 135 283 135 341 q 146 222 135 253 q 183 158 158 192 q 333 80 241 80 q 556 209 448 80 "},"Λ":{"x_min":0,"x_max":862.5,"ha":942,"o":"m 862 0 l 719 0 l 426 847 l 143 0 l 0 0 l 356 1013 l 501 1013 l 862 0 "},"I":{"x_min":41,"x_max":180,"ha":293,"o":"m 180 0 l 41 0 l 41 1013 l 180 1013 l 180 0 "},"G":{"x_min":0,"x_max":921,"ha":1011,"o":"m 921 0 l 832 0 l 801 136 q 655 15 741 58 q 470 -28 568 -28 q 126 133 259 -28 q 0 499 0 284 q 125 881 0 731 q 486 1043 259 1043 q 763 957 647 1043 q 905 709 890 864 l 772 709 q 668 866 747 807 q 486 926 589 926 q 228 795 322 926 q 142 507 142 677 q 228 224 142 342 q 483 94 323 94 q 712 195 625 94 q 796 435 796 291 l 477 435 l 477 549 l 921 549 l 921 0 "},"ΰ":{"x_min":0,"x_max":617,"ha":725,"o":"m 524 800 l 414 800 l 414 925 l 524 925 l 524 800 m 183 800 l 73 800 l 73 925 l 183 925 l 183 800 m 617 352 q 540 93 617 199 q 308 -24 455 -24 q 76 93 161 -24 q 0 352 0 199 l 0 738 l 126 738 l 126 354 q 169 185 126 257 q 312 98 220 98 q 451 185 402 98 q 492 354 492 257 l 492 738 l 617 738 l 617 352 m 489 1040 l 300 819 l 216 819 l 351 1040 l 489 1040 "},"`":{"x_min":0,"x_max":138.890625,"ha":236,"o":"m 138 699 l 0 699 l 0 861 q 36 974 0 929 q 138 1041 72 1020 l 138 977 q 82 931 95 969 q 69 839 69 893 l 138 839 l 138 699 "},"·":{"x_min":0,"x_max":142,"ha":239,"o":"m 142 585 l 0 585 l 0 738 l 142 738 l 142 585 "},"Υ":{"x_min":0.328125,"x_max":819.515625,"ha":889,"o":"m 819 1013 l 482 416 l 482 0 l 342 0 l 342 416 l 0 1013 l 140 1013 l 411 533 l 679 1013 l 819 1013 "},"r":{"x_min":0,"x_max":355.5625,"ha":432,"o":"m 355 621 l 343 621 q 179 569 236 621 q 122 411 122 518 l 122 0 l 0 0 l 0 737 l 117 737 l 117 604 q 204 719 146 686 q 355 753 262 753 l 355 621 "},"x":{"x_min":0,"x_max":675,"ha":764,"o":"m 675 0 l 525 0 l 331 286 l 144 0 l 0 0 l 256 379 l 12 738 l 157 737 l 336 473 l 516 738 l 661 738 l 412 380 l 675 0 "},"μ":{"x_min":0,"x_max":696.609375,"ha":747,"o":"m 696 -4 q 628 -14 657 -14 q 498 97 513 -14 q 422 8 470 41 q 313 -24 374 -24 q 207 3 258 -24 q 120 80 157 31 l 120 -278 l 0 -278 l 0 738 l 124 738 l 124 343 q 165 172 124 246 q 308 82 216 82 q 451 177 402 82 q 492 358 492 254 l 492 738 l 616 738 l 616 214 q 623 136 616 160 q 673 92 636 92 q 696 95 684 92 l 696 -4 "},"h":{"x_min":0,"x_max":615,"ha":724,"o":"m 615 472 l 615 0 l 490 0 l 490 454 q 456 590 490 535 q 338 654 416 654 q 186 588 251 654 q 122 436 122 522 l 122 0 l 0 0 l 0 1013 l 122 1013 l 122 633 q 218 727 149 694 q 362 760 287 760 q 552 676 484 760 q 615 472 615 600 "},".":{"x_min":0,"x_max":142,"ha":239,"o":"m 142 0 l 0 0 l 0 151 l 142 151 l 142 0 "},"φ":{"x_min":-2,"x_max":878,"ha":974,"o":"m 496 -279 l 378 -279 l 378 -17 q 101 88 204 -17 q -2 367 -2 194 q 68 626 -2 510 q 283 758 151 758 l 283 646 q 167 537 209 626 q 133 373 133 462 q 192 177 133 254 q 378 93 259 93 l 378 758 q 445 764 426 763 q 476 765 464 765 q 765 659 653 765 q 878 377 878 553 q 771 96 878 209 q 496 -17 665 -17 l 496 -279 m 496 93 l 514 93 q 687 183 623 93 q 746 380 746 265 q 691 569 746 491 q 522 658 629 658 l 496 656 l 496 93 "},";":{"x_min":0,"x_max":142,"ha":239,"o":"m 142 585 l 0 585 l 0 738 l 142 738 l 142 585 m 142 -12 q 105 -132 142 -82 q 0 -206 68 -182 l 0 -138 q 58 -82 43 -123 q 68 0 68 -56 l 0 0 l 0 151 l 142 151 l 142 -12 "},"f":{"x_min":0,"x_max":378,"ha":472,"o":"m 378 638 l 246 638 l 246 0 l 121 0 l 121 638 l 0 638 l 0 738 l 121 738 q 137 935 121 887 q 290 1028 171 1028 q 320 1027 305 1028 q 378 1021 334 1026 l 378 908 q 323 918 346 918 q 257 870 273 918 q 246 780 246 840 l 246 738 l 378 738 l 378 638 "},"“":{"x_min":1,"x_max":348.21875,"ha":454,"o":"m 140 670 l 1 670 l 1 830 q 37 943 1 897 q 140 1011 74 990 l 140 947 q 82 900 97 940 q 68 810 68 861 l 140 810 l 140 670 m 348 670 l 209 670 l 209 830 q 245 943 209 897 q 348 1011 282 990 l 348 947 q 290 900 305 940 q 276 810 276 861 l 348 810 l 348 670 "},"A":{"x_min":0.03125,"x_max":906.953125,"ha":1008,"o":"m 906 0 l 756 0 l 648 303 l 251 303 l 142 0 l 0 0 l 376 1013 l 529 1013 l 906 0 m 610 421 l 452 867 l 293 421 l 610 421 "},"6":{"x_min":53,"x_max":739,"ha":792,"o":"m 739 312 q 633 62 739 162 q 400 -31 534 -31 q 162 78 257 -31 q 53 439 53 206 q 178 859 53 712 q 441 986 284 986 q 643 912 559 986 q 732 713 732 833 l 601 713 q 544 830 594 786 q 426 875 494 875 q 268 793 331 875 q 193 517 193 697 q 301 597 240 570 q 427 624 362 624 q 643 540 552 624 q 739 312 739 451 m 603 298 q 540 461 603 400 q 404 516 484 516 q 268 461 323 516 q 207 300 207 401 q 269 137 207 198 q 405 83 325 83 q 541 137 486 83 q 603 298 603 197 "},"‘":{"x_min":1,"x_max":139.890625,"ha":236,"o":"m 139 670 l 1 670 l 1 830 q 37 943 1 897 q 139 1011 74 990 l 139 947 q 82 900 97 940 q 68 810 68 861 l 139 810 l 139 670 "},"ϊ":{"x_min":-70,"x_max":283,"ha":361,"o":"m 283 800 l 173 800 l 173 925 l 283 925 l 283 800 m 40 800 l -70 800 l -70 925 l 40 925 l 40 800 m 283 3 q 232 -10 257 -5 q 181 -15 206 -15 q 84 26 118 -15 q 41 200 41 79 l 41 737 l 166 737 l 167 215 q 171 141 167 157 q 225 101 182 101 q 247 103 238 101 q 283 112 256 104 l 283 3 "},"π":{"x_min":-0.21875,"x_max":773.21875,"ha":857,"o":"m 773 -7 l 707 -11 q 575 40 607 -11 q 552 174 552 77 l 552 226 l 552 626 l 222 626 l 222 0 l 97 0 l 97 626 l 0 626 l 0 737 l 773 737 l 773 626 l 676 626 l 676 171 q 695 103 676 117 q 773 90 714 90 l 773 -7 "},"ά":{"x_min":0,"x_max":765.5625,"ha":809,"o":"m 765 -4 q 698 -14 726 -14 q 564 97 586 -14 q 466 7 525 40 q 337 -26 407 -26 q 88 98 186 -26 q 0 369 0 212 q 88 637 0 525 q 337 760 184 760 q 465 727 407 760 q 563 637 524 695 l 563 738 l 685 738 l 685 222 q 693 141 685 168 q 748 94 708 94 q 765 95 760 94 l 765 -4 m 584 371 q 531 562 584 485 q 360 653 470 653 q 192 566 254 653 q 135 379 135 489 q 186 181 135 261 q 358 84 247 84 q 528 176 465 84 q 584 371 584 260 m 604 1040 l 415 819 l 332 819 l 466 1040 l 604 1040 "},"O":{"x_min":0,"x_max":958,"ha":1057,"o":"m 485 1041 q 834 882 702 1041 q 958 512 958 734 q 834 136 958 287 q 481 -26 702 -26 q 126 130 261 -26 q 0 504 0 279 q 127 880 0 728 q 485 1041 263 1041 m 480 98 q 731 225 638 98 q 815 504 815 340 q 733 783 815 669 q 480 912 640 912 q 226 784 321 912 q 142 504 142 670 q 226 224 142 339 q 480 98 319 98 "},"n":{"x_min":0,"x_max":615,"ha":724,"o":"m 615 463 l 615 0 l 490 0 l 490 454 q 453 592 490 537 q 331 656 410 656 q 178 585 240 656 q 117 421 117 514 l 117 0 l 0 0 l 0 738 l 117 738 l 117 630 q 218 728 150 693 q 359 764 286 764 q 552 675 484 764 q 615 463 615 593 "},"3":{"x_min":54,"x_max":737,"ha":792,"o":"m 737 284 q 635 55 737 141 q 399 -25 541 -25 q 156 52 248 -25 q 54 308 54 140 l 185 308 q 245 147 185 202 q 395 96 302 96 q 539 140 484 96 q 602 280 602 190 q 510 429 602 390 q 324 454 451 454 l 324 565 q 487 584 441 565 q 565 719 565 617 q 515 835 565 791 q 395 879 466 879 q 255 824 307 879 q 203 661 203 769 l 78 661 q 166 909 78 822 q 387 992 250 992 q 603 921 513 992 q 701 723 701 844 q 669 607 701 656 q 578 524 637 558 q 696 434 655 499 q 737 284 737 369 "},"9":{"x_min":53,"x_max":739,"ha":792,"o":"m 739 524 q 619 94 739 241 q 362 -32 516 -32 q 150 47 242 -32 q 59 244 59 126 l 191 244 q 246 129 191 176 q 373 82 301 82 q 526 161 466 82 q 597 440 597 255 q 363 334 501 334 q 130 432 216 334 q 53 650 53 521 q 134 880 53 786 q 383 986 226 986 q 659 841 566 986 q 739 524 739 719 m 388 449 q 535 514 480 449 q 585 658 585 573 q 535 805 585 744 q 388 873 480 873 q 242 809 294 873 q 191 658 191 745 q 239 514 191 572 q 388 449 292 449 "},"l":{"x_min":41,"x_max":166,"ha":279,"o":"m 166 0 l 41 0 l 41 1013 l 166 1013 l 166 0 "},"¤":{"x_min":40.09375,"x_max":728.796875,"ha":825,"o":"m 728 304 l 649 224 l 512 363 q 383 331 458 331 q 256 363 310 331 l 119 224 l 40 304 l 177 441 q 150 553 150 493 q 184 673 150 621 l 40 818 l 119 898 l 267 749 q 321 766 291 759 q 384 773 351 773 q 447 766 417 773 q 501 749 477 759 l 649 898 l 728 818 l 585 675 q 612 618 604 648 q 621 553 621 587 q 591 441 621 491 l 728 304 m 384 682 q 280 643 318 682 q 243 551 243 604 q 279 461 243 499 q 383 423 316 423 q 487 461 449 423 q 525 553 525 500 q 490 641 525 605 q 384 682 451 682 "},"κ":{"x_min":0,"x_max":632.328125,"ha":679,"o":"m 632 0 l 482 0 l 225 384 l 124 288 l 124 0 l 0 0 l 0 738 l 124 738 l 124 446 l 433 738 l 596 738 l 312 466 l 632 0 "},"4":{"x_min":48,"x_max":742.453125,"ha":792,"o":"m 742 243 l 602 243 l 602 0 l 476 0 l 476 243 l 48 243 l 48 368 l 476 958 l 602 958 l 602 354 l 742 354 l 742 243 m 476 354 l 476 792 l 162 354 l 476 354 "},"p":{"x_min":0,"x_max":685,"ha":786,"o":"m 685 364 q 598 96 685 205 q 350 -23 504 -23 q 121 89 205 -23 l 121 -278 l 0 -278 l 0 738 l 121 738 l 121 633 q 220 726 159 691 q 351 761 280 761 q 598 636 504 761 q 685 364 685 522 m 557 371 q 501 560 557 481 q 330 651 437 651 q 162 559 223 651 q 108 366 108 479 q 162 177 108 254 q 333 87 224 87 q 502 178 441 87 q 557 371 557 258 "},"‡":{"x_min":0,"x_max":777,"ha":835,"o":"m 458 238 l 458 0 l 319 0 l 319 238 l 0 238 l 0 360 l 319 360 l 319 681 l 0 683 l 0 804 l 319 804 l 319 1015 l 458 1013 l 458 804 l 777 804 l 777 683 l 458 683 l 458 360 l 777 360 l 777 238 l 458 238 "},"ψ":{"x_min":0,"x_max":808,"ha":907,"o":"m 465 -278 l 341 -278 l 341 -15 q 87 102 180 -15 q 0 378 0 210 l 0 739 l 133 739 l 133 379 q 182 195 133 275 q 341 98 242 98 l 341 922 l 465 922 l 465 98 q 623 195 563 98 q 675 382 675 278 l 675 742 l 808 742 l 808 381 q 720 104 808 213 q 466 -13 627 -13 l 465 -278 "},"η":{"x_min":0.78125,"x_max":697,"ha":810,"o":"m 697 -278 l 572 -278 l 572 454 q 540 587 572 536 q 425 650 501 650 q 271 579 337 650 q 206 420 206 509 l 206 0 l 81 0 l 81 489 q 73 588 81 562 q 0 644 56 644 l 0 741 q 68 755 38 755 q 158 720 124 755 q 200 630 193 686 q 297 726 234 692 q 434 761 359 761 q 620 692 544 761 q 697 516 697 624 l 697 -278 "}},"cssFontWeight":"normal","ascender":1189,"underlinePosition":-100,"cssFontStyle":"normal","boundingBox":{"yMin":-334,"xMin":-111,"yMax":1189,"xMax":1672},"resolution":1000,"original_font_information":{"postscript_name":"Helvetiker-Regular","version_string":"Version 1.00 2004 initial release","vendor_url":"http://www.magenta.gr/","full_font_name":"Helvetiker","font_family_name":"Helvetiker","copyright":"Copyright (c) Μagenta ltd, 2004","description":"","trademark":"","designer":"","designer_url":"","unique_font_identifier":"Μagenta ltd:Helvetiker:22-10-104","license_url":"http://www.ellak.gr/fonts/MgOpen/license.html","license_description":"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.","manufacturer_name":"Μagenta ltd","font_sub_family_name":"Regular"},"descender":-334,"familyName":"Helvetiker","lineHeight":1522,"underlineThickness":50}); \ No newline at end of file diff --git a/js/scripts/jquery-ui.min.js b/js/scripts/jquery-ui.min.js new file mode 100755 index 0000000..42e8684 --- /dev/null +++ b/js/scripts/jquery-ui.min.js @@ -0,0 +1,13 @@ +/*! jQuery UI - v1.11.0 - 2014-06-26 +* http://jqueryui.com +* Includes: core.js, widget.js, mouse.js, position.js, draggable.js, droppable.js, resizable.js, selectable.js, sortable.js, accordion.js, autocomplete.js, button.js, datepicker.js, dialog.js, menu.js, progressbar.js, selectmenu.js, slider.js, spinner.js, tabs.js, tooltip.js, effect.js, effect-blind.js, effect-bounce.js, effect-clip.js, effect-drop.js, effect-explode.js, effect-fade.js, effect-fold.js, effect-highlight.js, effect-puff.js, effect-pulsate.js, effect-scale.js, effect-shake.js, effect-size.js, effect-slide.js, effect-transfer.js +* Copyright 2014 jQuery Foundation and other contributors; Licensed MIT */ + +(function(e){"function"==typeof define&&define.amd?define(["jquery"],e):e(jQuery)})(function(e){function t(t,s){var a,n,r,o=t.nodeName.toLowerCase();return"area"===o?(a=t.parentNode,n=a.name,t.href&&n&&"map"===a.nodeName.toLowerCase()?(r=e("img[usemap=#"+n+"]")[0],!!r&&i(r)):!1):(/input|select|textarea|button|object/.test(o)?!t.disabled:"a"===o?t.href||s:s)&&i(t)}function i(t){return e.expr.filters.visible(t)&&!e(t).parents().addBack().filter(function(){return"hidden"===e.css(this,"visibility")}).length}function s(e){for(var t,i;e.length&&e[0]!==document;){if(t=e.css("position"),("absolute"===t||"relative"===t||"fixed"===t)&&(i=parseInt(e.css("zIndex"),10),!isNaN(i)&&0!==i))return i;e=e.parent()}return 0}function a(){this._curInst=null,this._keyEvent=!1,this._disabledInputs=[],this._datepickerShowing=!1,this._inDialog=!1,this._mainDivId="ui-datepicker-div",this._inlineClass="ui-datepicker-inline",this._appendClass="ui-datepicker-append",this._triggerClass="ui-datepicker-trigger",this._dialogClass="ui-datepicker-dialog",this._disableClass="ui-datepicker-disabled",this._unselectableClass="ui-datepicker-unselectable",this._currentClass="ui-datepicker-current-day",this._dayOverClass="ui-datepicker-days-cell-over",this.regional=[],this.regional[""]={closeText:"Done",prevText:"Prev",nextText:"Next",currentText:"Today",monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],weekHeader:"Wk",dateFormat:"mm/dd/yy",firstDay:0,isRTL:!1,showMonthAfterYear:!1,yearSuffix:""},this._defaults={showOn:"focus",showAnim:"fadeIn",showOptions:{},defaultDate:null,appendText:"",buttonText:"...",buttonImage:"",buttonImageOnly:!1,hideIfNoPrevNext:!1,navigationAsDateFormat:!1,gotoCurrent:!1,changeMonth:!1,changeYear:!1,yearRange:"c-10:c+10",showOtherMonths:!1,selectOtherMonths:!1,showWeek:!1,calculateWeek:this.iso8601Week,shortYearCutoff:"+10",minDate:null,maxDate:null,duration:"fast",beforeShowDay:null,beforeShow:null,onSelect:null,onChangeMonthYear:null,onClose:null,numberOfMonths:1,showCurrentAtPos:0,stepMonths:1,stepBigMonths:12,altField:"",altFormat:"",constrainInput:!0,showButtonPanel:!1,autoSize:!1,disabled:!1},e.extend(this._defaults,this.regional[""]),this.regional.en=e.extend(!0,{},this.regional[""]),this.regional["en-US"]=e.extend(!0,{},this.regional.en),this.dpDiv=n(e("
    "))}function n(t){var i="button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a";return t.delegate(i,"mouseout",function(){e(this).removeClass("ui-state-hover"),-1!==this.className.indexOf("ui-datepicker-prev")&&e(this).removeClass("ui-datepicker-prev-hover"),-1!==this.className.indexOf("ui-datepicker-next")&&e(this).removeClass("ui-datepicker-next-hover")}).delegate(i,"mouseover",function(){e.datepicker._isDisabledDatepicker(g.inline?t.parent()[0]:g.input[0])||(e(this).parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover"),e(this).addClass("ui-state-hover"),-1!==this.className.indexOf("ui-datepicker-prev")&&e(this).addClass("ui-datepicker-prev-hover"),-1!==this.className.indexOf("ui-datepicker-next")&&e(this).addClass("ui-datepicker-next-hover"))})}function r(t,i){e.extend(t,i);for(var s in i)null==i[s]&&(t[s]=i[s]);return t}function o(e){return function(){var t=this.element.val();e.apply(this,arguments),this._refresh(),t!==this.element.val()&&this._trigger("change")}}e.ui=e.ui||{},e.extend(e.ui,{version:"1.11.0",keyCode:{BACKSPACE:8,COMMA:188,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SPACE:32,TAB:9,UP:38}}),e.fn.extend({scrollParent:function(){var t=this.css("position"),i="absolute"===t,s=this.parents().filter(function(){var t=e(this);return i&&"static"===t.css("position")?!1:/(auto|scroll)/.test(t.css("overflow")+t.css("overflow-y")+t.css("overflow-x"))}).eq(0);return"fixed"!==t&&s.length?s:e(this[0].ownerDocument||document)},uniqueId:function(){var e=0;return function(){return this.each(function(){this.id||(this.id="ui-id-"+ ++e)})}}(),removeUniqueId:function(){return this.each(function(){/^ui-id-\d+$/.test(this.id)&&e(this).removeAttr("id")})}}),e.extend(e.expr[":"],{data:e.expr.createPseudo?e.expr.createPseudo(function(t){return function(i){return!!e.data(i,t)}}):function(t,i,s){return!!e.data(t,s[3])},focusable:function(i){return t(i,!isNaN(e.attr(i,"tabindex")))},tabbable:function(i){var s=e.attr(i,"tabindex"),a=isNaN(s);return(a||s>=0)&&t(i,!a)}}),e("").outerWidth(1).jquery||e.each(["Width","Height"],function(t,i){function s(t,i,s,n){return e.each(a,function(){i-=parseFloat(e.css(t,"padding"+this))||0,s&&(i-=parseFloat(e.css(t,"border"+this+"Width"))||0),n&&(i-=parseFloat(e.css(t,"margin"+this))||0)}),i}var a="Width"===i?["Left","Right"]:["Top","Bottom"],n=i.toLowerCase(),r={innerWidth:e.fn.innerWidth,innerHeight:e.fn.innerHeight,outerWidth:e.fn.outerWidth,outerHeight:e.fn.outerHeight};e.fn["inner"+i]=function(t){return void 0===t?r["inner"+i].call(this):this.each(function(){e(this).css(n,s(this,t)+"px")})},e.fn["outer"+i]=function(t,a){return"number"!=typeof t?r["outer"+i].call(this,t):this.each(function(){e(this).css(n,s(this,t,!0,a)+"px")})}}),e.fn.addBack||(e.fn.addBack=function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}),e("").data("a-b","a").removeData("a-b").data("a-b")&&(e.fn.removeData=function(t){return function(i){return arguments.length?t.call(this,e.camelCase(i)):t.call(this)}}(e.fn.removeData)),e.ui.ie=!!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase()),e.fn.extend({focus:function(t){return function(i,s){return"number"==typeof i?this.each(function(){var t=this;setTimeout(function(){e(t).focus(),s&&s.call(t)},i)}):t.apply(this,arguments)}}(e.fn.focus),disableSelection:function(){var e="onselectstart"in document.createElement("div")?"selectstart":"mousedown";return function(){return this.bind(e+".ui-disableSelection",function(e){e.preventDefault()})}}(),enableSelection:function(){return this.unbind(".ui-disableSelection")},zIndex:function(t){if(void 0!==t)return this.css("zIndex",t);if(this.length)for(var i,s,a=e(this[0]);a.length&&a[0]!==document;){if(i=a.css("position"),("absolute"===i||"relative"===i||"fixed"===i)&&(s=parseInt(a.css("zIndex"),10),!isNaN(s)&&0!==s))return s;a=a.parent()}return 0}}),e.ui.plugin={add:function(t,i,s){var a,n=e.ui[t].prototype;for(a in s)n.plugins[a]=n.plugins[a]||[],n.plugins[a].push([i,s[a]])},call:function(e,t,i,s){var a,n=e.plugins[t];if(n&&(s||e.element[0].parentNode&&11!==e.element[0].parentNode.nodeType))for(a=0;n.length>a;a++)e.options[n[a][0]]&&n[a][1].apply(e.element,i)}};var h=0,l=Array.prototype.slice;e.cleanData=function(t){return function(i){for(var s,a=0;null!=(s=i[a]);a++)try{e(s).triggerHandler("remove")}catch(n){}t(i)}}(e.cleanData),e.widget=function(t,i,s){var a,n,r,o,h={},l=t.split(".")[0];return t=t.split(".")[1],a=l+"-"+t,s||(s=i,i=e.Widget),e.expr[":"][a.toLowerCase()]=function(t){return!!e.data(t,a)},e[l]=e[l]||{},n=e[l][t],r=e[l][t]=function(e,t){return this._createWidget?(arguments.length&&this._createWidget(e,t),void 0):new r(e,t)},e.extend(r,n,{version:s.version,_proto:e.extend({},s),_childConstructors:[]}),o=new i,o.options=e.widget.extend({},o.options),e.each(s,function(t,s){return e.isFunction(s)?(h[t]=function(){var e=function(){return i.prototype[t].apply(this,arguments)},a=function(e){return i.prototype[t].apply(this,e)};return function(){var t,i=this._super,n=this._superApply;return this._super=e,this._superApply=a,t=s.apply(this,arguments),this._super=i,this._superApply=n,t}}(),void 0):(h[t]=s,void 0)}),r.prototype=e.widget.extend(o,{widgetEventPrefix:n?o.widgetEventPrefix||t:t},h,{constructor:r,namespace:l,widgetName:t,widgetFullName:a}),n?(e.each(n._childConstructors,function(t,i){var s=i.prototype;e.widget(s.namespace+"."+s.widgetName,r,i._proto)}),delete n._childConstructors):i._childConstructors.push(r),e.widget.bridge(t,r),r},e.widget.extend=function(t){for(var i,s,a=l.call(arguments,1),n=0,r=a.length;r>n;n++)for(i in a[n])s=a[n][i],a[n].hasOwnProperty(i)&&void 0!==s&&(t[i]=e.isPlainObject(s)?e.isPlainObject(t[i])?e.widget.extend({},t[i],s):e.widget.extend({},s):s);return t},e.widget.bridge=function(t,i){var s=i.prototype.widgetFullName||t;e.fn[t]=function(a){var n="string"==typeof a,r=l.call(arguments,1),o=this;return a=!n&&r.length?e.widget.extend.apply(null,[a].concat(r)):a,n?this.each(function(){var i,n=e.data(this,s);return"instance"===a?(o=n,!1):n?e.isFunction(n[a])&&"_"!==a.charAt(0)?(i=n[a].apply(n,r),i!==n&&void 0!==i?(o=i&&i.jquery?o.pushStack(i.get()):i,!1):void 0):e.error("no such method '"+a+"' for "+t+" widget instance"):e.error("cannot call methods on "+t+" prior to initialization; "+"attempted to call method '"+a+"'")}):this.each(function(){var t=e.data(this,s);t?(t.option(a||{}),t._init&&t._init()):e.data(this,s,new i(a,this))}),o}},e.Widget=function(){},e.Widget._childConstructors=[],e.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:"
    ",options:{disabled:!1,create:null},_createWidget:function(t,i){i=e(i||this.defaultElement||this)[0],this.element=e(i),this.uuid=h++,this.eventNamespace="."+this.widgetName+this.uuid,this.options=e.widget.extend({},this.options,this._getCreateOptions(),t),this.bindings=e(),this.hoverable=e(),this.focusable=e(),i!==this&&(e.data(i,this.widgetFullName,this),this._on(!0,this.element,{remove:function(e){e.target===i&&this.destroy()}}),this.document=e(i.style?i.ownerDocument:i.document||i),this.window=e(this.document[0].defaultView||this.document[0].parentWindow)),this._create(),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:e.noop,_getCreateEventData:e.noop,_create:e.noop,_init:e.noop,destroy:function(){this._destroy(),this.element.unbind(this.eventNamespace).removeData(this.widgetFullName).removeData(e.camelCase(this.widgetFullName)),this.widget().unbind(this.eventNamespace).removeAttr("aria-disabled").removeClass(this.widgetFullName+"-disabled "+"ui-state-disabled"),this.bindings.unbind(this.eventNamespace),this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus")},_destroy:e.noop,widget:function(){return this.element},option:function(t,i){var s,a,n,r=t;if(0===arguments.length)return e.widget.extend({},this.options);if("string"==typeof t)if(r={},s=t.split("."),t=s.shift(),s.length){for(a=r[t]=e.widget.extend({},this.options[t]),n=0;s.length-1>n;n++)a[s[n]]=a[s[n]]||{},a=a[s[n]];if(t=s.pop(),1===arguments.length)return void 0===a[t]?null:a[t];a[t]=i}else{if(1===arguments.length)return void 0===this.options[t]?null:this.options[t];r[t]=i}return this._setOptions(r),this},_setOptions:function(e){var t;for(t in e)this._setOption(t,e[t]);return this},_setOption:function(e,t){return this.options[e]=t,"disabled"===e&&(this.widget().toggleClass(this.widgetFullName+"-disabled",!!t),t&&(this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus"))),this},enable:function(){return this._setOptions({disabled:!1})},disable:function(){return this._setOptions({disabled:!0})},_on:function(t,i,s){var a,n=this;"boolean"!=typeof t&&(s=i,i=t,t=!1),s?(i=a=e(i),this.bindings=this.bindings.add(i)):(s=i,i=this.element,a=this.widget()),e.each(s,function(s,r){function o(){return t||n.options.disabled!==!0&&!e(this).hasClass("ui-state-disabled")?("string"==typeof r?n[r]:r).apply(n,arguments):void 0}"string"!=typeof r&&(o.guid=r.guid=r.guid||o.guid||e.guid++);var h=s.match(/^([\w:-]*)\s*(.*)$/),l=h[1]+n.eventNamespace,u=h[2];u?a.delegate(u,l,o):i.bind(l,o)})},_off:function(e,t){t=(t||"").split(" ").join(this.eventNamespace+" ")+this.eventNamespace,e.unbind(t).undelegate(t)},_delay:function(e,t){function i(){return("string"==typeof e?s[e]:e).apply(s,arguments)}var s=this;return setTimeout(i,t||0)},_hoverable:function(t){this.hoverable=this.hoverable.add(t),this._on(t,{mouseenter:function(t){e(t.currentTarget).addClass("ui-state-hover")},mouseleave:function(t){e(t.currentTarget).removeClass("ui-state-hover")}})},_focusable:function(t){this.focusable=this.focusable.add(t),this._on(t,{focusin:function(t){e(t.currentTarget).addClass("ui-state-focus")},focusout:function(t){e(t.currentTarget).removeClass("ui-state-focus")}})},_trigger:function(t,i,s){var a,n,r=this.options[t];if(s=s||{},i=e.Event(i),i.type=(t===this.widgetEventPrefix?t:this.widgetEventPrefix+t).toLowerCase(),i.target=this.element[0],n=i.originalEvent)for(a in n)a in i||(i[a]=n[a]);return this.element.trigger(i,s),!(e.isFunction(r)&&r.apply(this.element[0],[i].concat(s))===!1||i.isDefaultPrevented())}},e.each({show:"fadeIn",hide:"fadeOut"},function(t,i){e.Widget.prototype["_"+t]=function(s,a,n){"string"==typeof a&&(a={effect:a});var r,o=a?a===!0||"number"==typeof a?i:a.effect||i:t;a=a||{},"number"==typeof a&&(a={duration:a}),r=!e.isEmptyObject(a),a.complete=n,a.delay&&s.delay(a.delay),r&&e.effects&&e.effects.effect[o]?s[t](a):o!==t&&s[o]?s[o](a.duration,a.easing,n):s.queue(function(i){e(this)[t](),n&&n.call(s[0]),i()})}}),e.widget;var u=!1;e(document).mouseup(function(){u=!1}),e.widget("ui.mouse",{version:"1.11.0",options:{cancel:"input,textarea,button,select,option",distance:1,delay:0},_mouseInit:function(){var t=this;this.element.bind("mousedown."+this.widgetName,function(e){return t._mouseDown(e)}).bind("click."+this.widgetName,function(i){return!0===e.data(i.target,t.widgetName+".preventClickEvent")?(e.removeData(i.target,t.widgetName+".preventClickEvent"),i.stopImmediatePropagation(),!1):void 0}),this.started=!1},_mouseDestroy:function(){this.element.unbind("."+this.widgetName),this._mouseMoveDelegate&&this.document.unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate)},_mouseDown:function(t){if(!u){this._mouseStarted&&this._mouseUp(t),this._mouseDownEvent=t;var i=this,s=1===t.which,a="string"==typeof this.options.cancel&&t.target.nodeName?e(t.target).closest(this.options.cancel).length:!1;return s&&!a&&this._mouseCapture(t)?(this.mouseDelayMet=!this.options.delay,this.mouseDelayMet||(this._mouseDelayTimer=setTimeout(function(){i.mouseDelayMet=!0},this.options.delay)),this._mouseDistanceMet(t)&&this._mouseDelayMet(t)&&(this._mouseStarted=this._mouseStart(t)!==!1,!this._mouseStarted)?(t.preventDefault(),!0):(!0===e.data(t.target,this.widgetName+".preventClickEvent")&&e.removeData(t.target,this.widgetName+".preventClickEvent"),this._mouseMoveDelegate=function(e){return i._mouseMove(e)},this._mouseUpDelegate=function(e){return i._mouseUp(e)},this.document.bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate),t.preventDefault(),u=!0,!0)):!0}},_mouseMove:function(t){return e.ui.ie&&(!document.documentMode||9>document.documentMode)&&!t.button?this._mouseUp(t):t.which?this._mouseStarted?(this._mouseDrag(t),t.preventDefault()):(this._mouseDistanceMet(t)&&this._mouseDelayMet(t)&&(this._mouseStarted=this._mouseStart(this._mouseDownEvent,t)!==!1,this._mouseStarted?this._mouseDrag(t):this._mouseUp(t)),!this._mouseStarted):this._mouseUp(t)},_mouseUp:function(t){return this.document.unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate),this._mouseStarted&&(this._mouseStarted=!1,t.target===this._mouseDownEvent.target&&e.data(t.target,this.widgetName+".preventClickEvent",!0),this._mouseStop(t)),u=!1,!1},_mouseDistanceMet:function(e){return Math.max(Math.abs(this._mouseDownEvent.pageX-e.pageX),Math.abs(this._mouseDownEvent.pageY-e.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return!0}}),function(){function t(e,t,i){return[parseFloat(e[0])*(p.test(e[0])?t/100:1),parseFloat(e[1])*(p.test(e[1])?i/100:1)]}function i(t,i){return parseInt(e.css(t,i),10)||0}function s(t){var i=t[0];return 9===i.nodeType?{width:t.width(),height:t.height(),offset:{top:0,left:0}}:e.isWindow(i)?{width:t.width(),height:t.height(),offset:{top:t.scrollTop(),left:t.scrollLeft()}}:i.preventDefault?{width:0,height:0,offset:{top:i.pageY,left:i.pageX}}:{width:t.outerWidth(),height:t.outerHeight(),offset:t.offset()}}e.ui=e.ui||{};var a,n,r=Math.max,o=Math.abs,h=Math.round,l=/left|center|right/,u=/top|center|bottom/,d=/[\+\-]\d+(\.[\d]+)?%?/,c=/^\w+/,p=/%$/,f=e.fn.position;e.position={scrollbarWidth:function(){if(void 0!==a)return a;var t,i,s=e("
    "),n=s.children()[0];return e("body").append(s),t=n.offsetWidth,s.css("overflow","scroll"),i=n.offsetWidth,t===i&&(i=s[0].clientWidth),s.remove(),a=t-i},getScrollInfo:function(t){var i=t.isWindow||t.isDocument?"":t.element.css("overflow-x"),s=t.isWindow||t.isDocument?"":t.element.css("overflow-y"),a="scroll"===i||"auto"===i&&t.widthi?"left":t>0?"right":"center",vertical:0>n?"top":s>0?"bottom":"middle"};d>m&&m>o(t+i)&&(h.horizontal="center"),c>g&&g>o(s+n)&&(h.vertical="middle"),h.important=r(o(t),o(i))>r(o(s),o(n))?"horizontal":"vertical",a.using.call(this,e,h)}),u.offset(e.extend(M,{using:l}))})},e.ui.position={fit:{left:function(e,t){var i,s=t.within,a=s.isWindow?s.scrollLeft:s.offset.left,n=s.width,o=e.left-t.collisionPosition.marginLeft,h=a-o,l=o+t.collisionWidth-n-a;t.collisionWidth>n?h>0&&0>=l?(i=e.left+h+t.collisionWidth-n-a,e.left+=h-i):e.left=l>0&&0>=h?a:h>l?a+n-t.collisionWidth:a:h>0?e.left+=h:l>0?e.left-=l:e.left=r(e.left-o,e.left)},top:function(e,t){var i,s=t.within,a=s.isWindow?s.scrollTop:s.offset.top,n=t.within.height,o=e.top-t.collisionPosition.marginTop,h=a-o,l=o+t.collisionHeight-n-a;t.collisionHeight>n?h>0&&0>=l?(i=e.top+h+t.collisionHeight-n-a,e.top+=h-i):e.top=l>0&&0>=h?a:h>l?a+n-t.collisionHeight:a:h>0?e.top+=h:l>0?e.top-=l:e.top=r(e.top-o,e.top)}},flip:{left:function(e,t){var i,s,a=t.within,n=a.offset.left+a.scrollLeft,r=a.width,h=a.isWindow?a.scrollLeft:a.offset.left,l=e.left-t.collisionPosition.marginLeft,u=l-h,d=l+t.collisionWidth-r-h,c="left"===t.my[0]?-t.elemWidth:"right"===t.my[0]?t.elemWidth:0,p="left"===t.at[0]?t.targetWidth:"right"===t.at[0]?-t.targetWidth:0,f=-2*t.offset[0];0>u?(i=e.left+c+p+f+t.collisionWidth-r-n,(0>i||o(u)>i)&&(e.left+=c+p+f)):d>0&&(s=e.left-t.collisionPosition.marginLeft+c+p+f-h,(s>0||d>o(s))&&(e.left+=c+p+f))},top:function(e,t){var i,s,a=t.within,n=a.offset.top+a.scrollTop,r=a.height,h=a.isWindow?a.scrollTop:a.offset.top,l=e.top-t.collisionPosition.marginTop,u=l-h,d=l+t.collisionHeight-r-h,c="top"===t.my[1],p=c?-t.elemHeight:"bottom"===t.my[1]?t.elemHeight:0,f="top"===t.at[1]?t.targetHeight:"bottom"===t.at[1]?-t.targetHeight:0,m=-2*t.offset[1];0>u?(s=e.top+p+f+m+t.collisionHeight-r-n,e.top+p+f+m>u&&(0>s||o(u)>s)&&(e.top+=p+f+m)):d>0&&(i=e.top-t.collisionPosition.marginTop+p+f+m-h,e.top+p+f+m>d&&(i>0||d>o(i))&&(e.top+=p+f+m))}},flipfit:{left:function(){e.ui.position.flip.left.apply(this,arguments),e.ui.position.fit.left.apply(this,arguments)},top:function(){e.ui.position.flip.top.apply(this,arguments),e.ui.position.fit.top.apply(this,arguments)}}},function(){var t,i,s,a,r,o=document.getElementsByTagName("body")[0],h=document.createElement("div");t=document.createElement(o?"div":"body"),s={visibility:"hidden",width:0,height:0,border:0,margin:0,background:"none"},o&&e.extend(s,{position:"absolute",left:"-1000px",top:"-1000px"});for(r in s)t.style[r]=s[r];t.appendChild(h),i=o||document.documentElement,i.insertBefore(t,i.firstChild),h.style.cssText="position: absolute; left: 10.7432222px;",a=e(h).offset().left,n=a>10&&11>a,t.innerHTML="",i.removeChild(t)}()}(),e.ui.position,e.widget("ui.draggable",e.ui.mouse,{version:"1.11.0",widgetEventPrefix:"drag",options:{addClasses:!0,appendTo:"parent",axis:!1,connectToSortable:!1,containment:!1,cursor:"auto",cursorAt:!1,grid:!1,handle:!1,helper:"original",iframeFix:!1,opacity:!1,refreshPositions:!1,revert:!1,revertDuration:500,scope:"default",scroll:!0,scrollSensitivity:20,scrollSpeed:20,snap:!1,snapMode:"both",snapTolerance:20,stack:!1,zIndex:!1,drag:null,start:null,stop:null},_create:function(){"original"!==this.options.helper||/^(?:r|a|f)/.test(this.element.css("position"))||(this.element[0].style.position="relative"),this.options.addClasses&&this.element.addClass("ui-draggable"),this.options.disabled&&this.element.addClass("ui-draggable-disabled"),this._setHandleClassName(),this._mouseInit()},_setOption:function(e,t){this._super(e,t),"handle"===e&&this._setHandleClassName()},_destroy:function(){return(this.helper||this.element).is(".ui-draggable-dragging")?(this.destroyOnClear=!0,void 0):(this.element.removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled"),this._removeHandleClassName(),this._mouseDestroy(),void 0)},_mouseCapture:function(t){var i=this.document[0],s=this.options;try{i.activeElement&&"body"!==i.activeElement.nodeName.toLowerCase()&&e(i.activeElement).blur()}catch(a){}return this.helper||s.disabled||e(t.target).closest(".ui-resizable-handle").length>0?!1:(this.handle=this._getHandle(t),this.handle?(e(s.iframeFix===!0?"iframe":s.iframeFix).each(function(){e("
    ").css({width:this.offsetWidth+"px",height:this.offsetHeight+"px",position:"absolute",opacity:"0.001",zIndex:1e3}).css(e(this).offset()).appendTo("body")}),!0):!1)},_mouseStart:function(t){var i=this.options;return this.helper=this._createHelper(t),this.helper.addClass("ui-draggable-dragging"),this._cacheHelperProportions(),e.ui.ddmanager&&(e.ui.ddmanager.current=this),this._cacheMargins(),this.cssPosition=this.helper.css("position"),this.scrollParent=this.helper.scrollParent(),this.offsetParent=this.helper.offsetParent(),this.offsetParentCssPosition=this.offsetParent.css("position"),this.offset=this.positionAbs=this.element.offset(),this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left},this.offset.scroll=!1,e.extend(this.offset,{click:{left:t.pageX-this.offset.left,top:t.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()}),this.originalPosition=this.position=this._generatePosition(t,!1),this.originalPageX=t.pageX,this.originalPageY=t.pageY,i.cursorAt&&this._adjustOffsetFromHelper(i.cursorAt),this._setContainment(),this._trigger("start",t)===!1?(this._clear(),!1):(this._cacheHelperProportions(),e.ui.ddmanager&&!i.dropBehaviour&&e.ui.ddmanager.prepareOffsets(this,t),this._mouseDrag(t,!0),e.ui.ddmanager&&e.ui.ddmanager.dragStart(this,t),!0)},_mouseDrag:function(t,i){if("fixed"===this.offsetParentCssPosition&&(this.offset.parent=this._getParentOffset()),this.position=this._generatePosition(t,!0),this.positionAbs=this._convertPositionTo("absolute"),!i){var s=this._uiHash();if(this._trigger("drag",t,s)===!1)return this._mouseUp({}),!1;this.position=s.position}return this.helper[0].style.left=this.position.left+"px",this.helper[0].style.top=this.position.top+"px",e.ui.ddmanager&&e.ui.ddmanager.drag(this,t),!1},_mouseStop:function(t){var i=this,s=!1;return e.ui.ddmanager&&!this.options.dropBehaviour&&(s=e.ui.ddmanager.drop(this,t)),this.dropped&&(s=this.dropped,this.dropped=!1),"invalid"===this.options.revert&&!s||"valid"===this.options.revert&&s||this.options.revert===!0||e.isFunction(this.options.revert)&&this.options.revert.call(this.element,s)?e(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){i._trigger("stop",t)!==!1&&i._clear()}):this._trigger("stop",t)!==!1&&this._clear(),!1},_mouseUp:function(t){return e("div.ui-draggable-iframeFix").each(function(){this.parentNode.removeChild(this)}),e.ui.ddmanager&&e.ui.ddmanager.dragStop(this,t),this.element.focus(),e.ui.mouse.prototype._mouseUp.call(this,t)},cancel:function(){return this.helper.is(".ui-draggable-dragging")?this._mouseUp({}):this._clear(),this},_getHandle:function(t){return this.options.handle?!!e(t.target).closest(this.element.find(this.options.handle)).length:!0},_setHandleClassName:function(){this._removeHandleClassName(),e(this.options.handle||this.element).addClass("ui-draggable-handle")},_removeHandleClassName:function(){this.element.find(".ui-draggable-handle").addBack().removeClass("ui-draggable-handle")},_createHelper:function(t){var i=this.options,s=e.isFunction(i.helper)?e(i.helper.apply(this.element[0],[t])):"clone"===i.helper?this.element.clone().removeAttr("id"):this.element;return s.parents("body").length||s.appendTo("parent"===i.appendTo?this.element[0].parentNode:i.appendTo),s[0]===this.element[0]||/(fixed|absolute)/.test(s.css("position"))||s.css("position","absolute"),s},_adjustOffsetFromHelper:function(t){"string"==typeof t&&(t=t.split(" ")),e.isArray(t)&&(t={left:+t[0],top:+t[1]||0}),"left"in t&&(this.offset.click.left=t.left+this.margins.left),"right"in t&&(this.offset.click.left=this.helperProportions.width-t.right+this.margins.left),"top"in t&&(this.offset.click.top=t.top+this.margins.top),"bottom"in t&&(this.offset.click.top=this.helperProportions.height-t.bottom+this.margins.top)},_isRootNode:function(e){return/(html|body)/i.test(e.tagName)||e===this.document[0]},_getParentOffset:function(){var t=this.offsetParent.offset(),i=this.document[0];return"absolute"===this.cssPosition&&this.scrollParent[0]!==i&&e.contains(this.scrollParent[0],this.offsetParent[0])&&(t.left+=this.scrollParent.scrollLeft(),t.top+=this.scrollParent.scrollTop()),this._isRootNode(this.offsetParent[0])&&(t={top:0,left:0}),{top:t.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:t.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if("relative"!==this.cssPosition)return{top:0,left:0};var e=this.element.position(),t=this._isRootNode(this.scrollParent[0]);return{top:e.top-(parseInt(this.helper.css("top"),10)||0)+(t?0:this.scrollParent.scrollTop()),left:e.left-(parseInt(this.helper.css("left"),10)||0)+(t?0:this.scrollParent.scrollLeft())}},_cacheMargins:function(){this.margins={left:parseInt(this.element.css("marginLeft"),10)||0,top:parseInt(this.element.css("marginTop"),10)||0,right:parseInt(this.element.css("marginRight"),10)||0,bottom:parseInt(this.element.css("marginBottom"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var t,i,s,a=this.options,n=this.document[0];return this.relative_container=null,a.containment?"window"===a.containment?(this.containment=[e(window).scrollLeft()-this.offset.relative.left-this.offset.parent.left,e(window).scrollTop()-this.offset.relative.top-this.offset.parent.top,e(window).scrollLeft()+e(window).width()-this.helperProportions.width-this.margins.left,e(window).scrollTop()+(e(window).height()||n.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top],void 0):"document"===a.containment?(this.containment=[0,0,e(n).width()-this.helperProportions.width-this.margins.left,(e(n).height()||n.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top],void 0):a.containment.constructor===Array?(this.containment=a.containment,void 0):("parent"===a.containment&&(a.containment=this.helper[0].parentNode),i=e(a.containment),s=i[0],s&&(t="hidden"!==i.css("overflow"),this.containment=[(parseInt(i.css("borderLeftWidth"),10)||0)+(parseInt(i.css("paddingLeft"),10)||0),(parseInt(i.css("borderTopWidth"),10)||0)+(parseInt(i.css("paddingTop"),10)||0),(t?Math.max(s.scrollWidth,s.offsetWidth):s.offsetWidth)-(parseInt(i.css("borderRightWidth"),10)||0)-(parseInt(i.css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left-this.margins.right,(t?Math.max(s.scrollHeight,s.offsetHeight):s.offsetHeight)-(parseInt(i.css("borderBottomWidth"),10)||0)-(parseInt(i.css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top-this.margins.bottom],this.relative_container=i),void 0):(this.containment=null,void 0)},_convertPositionTo:function(e,t){t||(t=this.position);var i="absolute"===e?1:-1,s=this._isRootNode(this.scrollParent[0]);return{top:t.top+this.offset.relative.top*i+this.offset.parent.top*i-("fixed"===this.cssPosition?-this.offset.scroll.top:s?0:this.offset.scroll.top)*i,left:t.left+this.offset.relative.left*i+this.offset.parent.left*i-("fixed"===this.cssPosition?-this.offset.scroll.left:s?0:this.offset.scroll.left)*i}},_generatePosition:function(e,t){var i,s,a,n,r=this.options,o=this._isRootNode(this.scrollParent[0]),h=e.pageX,l=e.pageY;return o&&this.offset.scroll||(this.offset.scroll={top:this.scrollParent.scrollTop(),left:this.scrollParent.scrollLeft()}),t&&(this.containment&&(this.relative_container?(s=this.relative_container.offset(),i=[this.containment[0]+s.left,this.containment[1]+s.top,this.containment[2]+s.left,this.containment[3]+s.top]):i=this.containment,e.pageX-this.offset.click.lefti[2]&&(h=i[2]+this.offset.click.left),e.pageY-this.offset.click.top>i[3]&&(l=i[3]+this.offset.click.top)),r.grid&&(a=r.grid[1]?this.originalPageY+Math.round((l-this.originalPageY)/r.grid[1])*r.grid[1]:this.originalPageY,l=i?a-this.offset.click.top>=i[1]||a-this.offset.click.top>i[3]?a:a-this.offset.click.top>=i[1]?a-r.grid[1]:a+r.grid[1]:a,n=r.grid[0]?this.originalPageX+Math.round((h-this.originalPageX)/r.grid[0])*r.grid[0]:this.originalPageX,h=i?n-this.offset.click.left>=i[0]||n-this.offset.click.left>i[2]?n:n-this.offset.click.left>=i[0]?n-r.grid[0]:n+r.grid[0]:n),"y"===r.axis&&(h=this.originalPageX),"x"===r.axis&&(l=this.originalPageY)),{top:l-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"===this.cssPosition?-this.offset.scroll.top:o?0:this.offset.scroll.top),left:h-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"===this.cssPosition?-this.offset.scroll.left:o?0:this.offset.scroll.left)} +},_clear:function(){this.helper.removeClass("ui-draggable-dragging"),this.helper[0]===this.element[0]||this.cancelHelperRemoval||this.helper.remove(),this.helper=null,this.cancelHelperRemoval=!1,this.destroyOnClear&&this.destroy()},_trigger:function(t,i,s){return s=s||this._uiHash(),e.ui.plugin.call(this,t,[i,s,this],!0),"drag"===t&&(this.positionAbs=this._convertPositionTo("absolute")),e.Widget.prototype._trigger.call(this,t,i,s)},plugins:{},_uiHash:function(){return{helper:this.helper,position:this.position,originalPosition:this.originalPosition,offset:this.positionAbs}}}),e.ui.plugin.add("draggable","connectToSortable",{start:function(t,i,s){var a=s.options,n=e.extend({},i,{item:s.element});s.sortables=[],e(a.connectToSortable).each(function(){var i=e(this).sortable("instance");i&&!i.options.disabled&&(s.sortables.push({instance:i,shouldRevert:i.options.revert}),i.refreshPositions(),i._trigger("activate",t,n))})},stop:function(t,i,s){var a=e.extend({},i,{item:s.element});e.each(s.sortables,function(){this.instance.isOver?(this.instance.isOver=0,s.cancelHelperRemoval=!0,this.instance.cancelHelperRemoval=!1,this.shouldRevert&&(this.instance.options.revert=this.shouldRevert),this.instance._mouseStop(t),this.instance.options.helper=this.instance.options._helper,"original"===s.options.helper&&this.instance.currentItem.css({top:"auto",left:"auto"})):(this.instance.cancelHelperRemoval=!1,this.instance._trigger("deactivate",t,a))})},drag:function(t,i,s){var a=this;e.each(s.sortables,function(){var n=!1,r=this;this.instance.positionAbs=s.positionAbs,this.instance.helperProportions=s.helperProportions,this.instance.offset.click=s.offset.click,this.instance._intersectsWith(this.instance.containerCache)&&(n=!0,e.each(s.sortables,function(){return this.instance.positionAbs=s.positionAbs,this.instance.helperProportions=s.helperProportions,this.instance.offset.click=s.offset.click,this!==r&&this.instance._intersectsWith(this.instance.containerCache)&&e.contains(r.instance.element[0],this.instance.element[0])&&(n=!1),n})),n?(this.instance.isOver||(this.instance.isOver=1,this.instance.currentItem=e(a).clone().removeAttr("id").appendTo(this.instance.element).data("ui-sortable-item",!0),this.instance.options._helper=this.instance.options.helper,this.instance.options.helper=function(){return i.helper[0]},t.target=this.instance.currentItem[0],this.instance._mouseCapture(t,!0),this.instance._mouseStart(t,!0,!0),this.instance.offset.click.top=s.offset.click.top,this.instance.offset.click.left=s.offset.click.left,this.instance.offset.parent.left-=s.offset.parent.left-this.instance.offset.parent.left,this.instance.offset.parent.top-=s.offset.parent.top-this.instance.offset.parent.top,s._trigger("toSortable",t),s.dropped=this.instance.element,s.currentItem=s.element,this.instance.fromOutside=s),this.instance.currentItem&&this.instance._mouseDrag(t)):this.instance.isOver&&(this.instance.isOver=0,this.instance.cancelHelperRemoval=!0,this.instance.options.revert=!1,this.instance._trigger("out",t,this.instance._uiHash(this.instance)),this.instance._mouseStop(t,!0),this.instance.options.helper=this.instance.options._helper,this.instance.currentItem.remove(),this.instance.placeholder&&this.instance.placeholder.remove(),s._trigger("fromSortable",t),s.dropped=!1)})}}),e.ui.plugin.add("draggable","cursor",{start:function(t,i,s){var a=e("body"),n=s.options;a.css("cursor")&&(n._cursor=a.css("cursor")),a.css("cursor",n.cursor)},stop:function(t,i,s){var a=s.options;a._cursor&&e("body").css("cursor",a._cursor)}}),e.ui.plugin.add("draggable","opacity",{start:function(t,i,s){var a=e(i.helper),n=s.options;a.css("opacity")&&(n._opacity=a.css("opacity")),a.css("opacity",n.opacity)},stop:function(t,i,s){var a=s.options;a._opacity&&e(i.helper).css("opacity",a._opacity)}}),e.ui.plugin.add("draggable","scroll",{start:function(e,t,i){i.scrollParent[0]!==i.document[0]&&"HTML"!==i.scrollParent[0].tagName&&(i.overflowOffset=i.scrollParent.offset())},drag:function(t,i,s){var a=s.options,n=!1,r=s.document[0];s.scrollParent[0]!==r&&"HTML"!==s.scrollParent[0].tagName?(a.axis&&"x"===a.axis||(s.overflowOffset.top+s.scrollParent[0].offsetHeight-t.pageY=0;c--)h=s.snapElements[c].left,l=h+s.snapElements[c].width,u=s.snapElements[c].top,d=u+s.snapElements[c].height,h-m>v||g>l+m||u-m>b||y>d+m||!e.contains(s.snapElements[c].item.ownerDocument,s.snapElements[c].item)?(s.snapElements[c].snapping&&s.options.snap.release&&s.options.snap.release.call(s.element,t,e.extend(s._uiHash(),{snapItem:s.snapElements[c].item})),s.snapElements[c].snapping=!1):("inner"!==f.snapMode&&(a=m>=Math.abs(u-b),n=m>=Math.abs(d-y),r=m>=Math.abs(h-v),o=m>=Math.abs(l-g),a&&(i.position.top=s._convertPositionTo("relative",{top:u-s.helperProportions.height,left:0}).top-s.margins.top),n&&(i.position.top=s._convertPositionTo("relative",{top:d,left:0}).top-s.margins.top),r&&(i.position.left=s._convertPositionTo("relative",{top:0,left:h-s.helperProportions.width}).left-s.margins.left),o&&(i.position.left=s._convertPositionTo("relative",{top:0,left:l}).left-s.margins.left)),p=a||n||r||o,"outer"!==f.snapMode&&(a=m>=Math.abs(u-y),n=m>=Math.abs(d-b),r=m>=Math.abs(h-g),o=m>=Math.abs(l-v),a&&(i.position.top=s._convertPositionTo("relative",{top:u,left:0}).top-s.margins.top),n&&(i.position.top=s._convertPositionTo("relative",{top:d-s.helperProportions.height,left:0}).top-s.margins.top),r&&(i.position.left=s._convertPositionTo("relative",{top:0,left:h}).left-s.margins.left),o&&(i.position.left=s._convertPositionTo("relative",{top:0,left:l-s.helperProportions.width}).left-s.margins.left)),!s.snapElements[c].snapping&&(a||n||r||o||p)&&s.options.snap.snap&&s.options.snap.snap.call(s.element,t,e.extend(s._uiHash(),{snapItem:s.snapElements[c].item})),s.snapElements[c].snapping=a||n||r||o||p)}}),e.ui.plugin.add("draggable","stack",{start:function(t,i,s){var a,n=s.options,r=e.makeArray(e(n.stack)).sort(function(t,i){return(parseInt(e(t).css("zIndex"),10)||0)-(parseInt(e(i).css("zIndex"),10)||0)});r.length&&(a=parseInt(e(r[0]).css("zIndex"),10)||0,e(r).each(function(t){e(this).css("zIndex",a+t)}),this.css("zIndex",a+r.length))}}),e.ui.plugin.add("draggable","zIndex",{start:function(t,i,s){var a=e(i.helper),n=s.options;a.css("zIndex")&&(n._zIndex=a.css("zIndex")),a.css("zIndex",n.zIndex)},stop:function(t,i,s){var a=s.options;a._zIndex&&e(i.helper).css("zIndex",a._zIndex)}}),e.ui.draggable,e.widget("ui.droppable",{version:"1.11.0",widgetEventPrefix:"drop",options:{accept:"*",activeClass:!1,addClasses:!0,greedy:!1,hoverClass:!1,scope:"default",tolerance:"intersect",activate:null,deactivate:null,drop:null,out:null,over:null},_create:function(){var t,i=this.options,s=i.accept;this.isover=!1,this.isout=!0,this.accept=e.isFunction(s)?s:function(e){return e.is(s)},this.proportions=function(){return arguments.length?(t=arguments[0],void 0):t?t:t={width:this.element[0].offsetWidth,height:this.element[0].offsetHeight}},this._addToManager(i.scope),i.addClasses&&this.element.addClass("ui-droppable")},_addToManager:function(t){e.ui.ddmanager.droppables[t]=e.ui.ddmanager.droppables[t]||[],e.ui.ddmanager.droppables[t].push(this)},_splice:function(e){for(var t=0;e.length>t;t++)e[t]===this&&e.splice(t,1)},_destroy:function(){var t=e.ui.ddmanager.droppables[this.options.scope];this._splice(t),this.element.removeClass("ui-droppable ui-droppable-disabled")},_setOption:function(t,i){if("accept"===t)this.accept=e.isFunction(i)?i:function(e){return e.is(i)};else if("scope"===t){var s=e.ui.ddmanager.droppables[this.options.scope];this._splice(s),this._addToManager(i)}this._super(t,i)},_activate:function(t){var i=e.ui.ddmanager.current;this.options.activeClass&&this.element.addClass(this.options.activeClass),i&&this._trigger("activate",t,this.ui(i))},_deactivate:function(t){var i=e.ui.ddmanager.current;this.options.activeClass&&this.element.removeClass(this.options.activeClass),i&&this._trigger("deactivate",t,this.ui(i))},_over:function(t){var i=e.ui.ddmanager.current;i&&(i.currentItem||i.element)[0]!==this.element[0]&&this.accept.call(this.element[0],i.currentItem||i.element)&&(this.options.hoverClass&&this.element.addClass(this.options.hoverClass),this._trigger("over",t,this.ui(i)))},_out:function(t){var i=e.ui.ddmanager.current;i&&(i.currentItem||i.element)[0]!==this.element[0]&&this.accept.call(this.element[0],i.currentItem||i.element)&&(this.options.hoverClass&&this.element.removeClass(this.options.hoverClass),this._trigger("out",t,this.ui(i)))},_drop:function(t,i){var s=i||e.ui.ddmanager.current,a=!1;return s&&(s.currentItem||s.element)[0]!==this.element[0]?(this.element.find(":data(ui-droppable)").not(".ui-draggable-dragging").each(function(){var t=e(this).droppable("instance");return t.options.greedy&&!t.options.disabled&&t.options.scope===s.options.scope&&t.accept.call(t.element[0],s.currentItem||s.element)&&e.ui.intersect(s,e.extend(t,{offset:t.element.offset()}),t.options.tolerance)?(a=!0,!1):void 0}),a?!1:this.accept.call(this.element[0],s.currentItem||s.element)?(this.options.activeClass&&this.element.removeClass(this.options.activeClass),this.options.hoverClass&&this.element.removeClass(this.options.hoverClass),this._trigger("drop",t,this.ui(s)),this.element):!1):!1},ui:function(e){return{draggable:e.currentItem||e.element,helper:e.helper,position:e.position,offset:e.positionAbs}}}),e.ui.intersect=function(){function e(e,t,i){return e>=t&&t+i>e}return function(t,i,s){if(!i.offset)return!1;var a,n,r=(t.positionAbs||t.position.absolute).left,o=(t.positionAbs||t.position.absolute).top,h=r+t.helperProportions.width,l=o+t.helperProportions.height,u=i.offset.left,d=i.offset.top,c=u+i.proportions().width,p=d+i.proportions().height;switch(s){case"fit":return r>=u&&c>=h&&o>=d&&p>=l;case"intersect":return r+t.helperProportions.width/2>u&&c>h-t.helperProportions.width/2&&o+t.helperProportions.height/2>d&&p>l-t.helperProportions.height/2;case"pointer":return a=(t.positionAbs||t.position.absolute).left+(t.clickOffset||t.offset.click).left,n=(t.positionAbs||t.position.absolute).top+(t.clickOffset||t.offset.click).top,e(n,d,i.proportions().height)&&e(a,u,i.proportions().width);case"touch":return(o>=d&&p>=o||l>=d&&p>=l||d>o&&l>p)&&(r>=u&&c>=r||h>=u&&c>=h||u>r&&h>c);default:return!1}}}(),e.ui.ddmanager={current:null,droppables:{"default":[]},prepareOffsets:function(t,i){var s,a,n=e.ui.ddmanager.droppables[t.options.scope]||[],r=i?i.type:null,o=(t.currentItem||t.element).find(":data(ui-droppable)").addBack();e:for(s=0;n.length>s;s++)if(!(n[s].options.disabled||t&&!n[s].accept.call(n[s].element[0],t.currentItem||t.element))){for(a=0;o.length>a;a++)if(o[a]===n[s].element[0]){n[s].proportions().height=0;continue e}n[s].visible="none"!==n[s].element.css("display"),n[s].visible&&("mousedown"===r&&n[s]._activate.call(n[s],i),n[s].offset=n[s].element.offset(),n[s].proportions({width:n[s].element[0].offsetWidth,height:n[s].element[0].offsetHeight}))}},drop:function(t,i){var s=!1;return e.each((e.ui.ddmanager.droppables[t.options.scope]||[]).slice(),function(){this.options&&(!this.options.disabled&&this.visible&&e.ui.intersect(t,this,this.options.tolerance)&&(s=this._drop.call(this,i)||s),!this.options.disabled&&this.visible&&this.accept.call(this.element[0],t.currentItem||t.element)&&(this.isout=!0,this.isover=!1,this._deactivate.call(this,i)))}),s},dragStart:function(t,i){t.element.parentsUntil("body").bind("scroll.droppable",function(){t.options.refreshPositions||e.ui.ddmanager.prepareOffsets(t,i)})},drag:function(t,i){t.options.refreshPositions&&e.ui.ddmanager.prepareOffsets(t,i),e.each(e.ui.ddmanager.droppables[t.options.scope]||[],function(){if(!this.options.disabled&&!this.greedyChild&&this.visible){var s,a,n,r=e.ui.intersect(t,this,this.options.tolerance),o=!r&&this.isover?"isout":r&&!this.isover?"isover":null;o&&(this.options.greedy&&(a=this.options.scope,n=this.element.parents(":data(ui-droppable)").filter(function(){return e(this).droppable("instance").options.scope===a}),n.length&&(s=e(n[0]).droppable("instance"),s.greedyChild="isover"===o)),s&&"isover"===o&&(s.isover=!1,s.isout=!0,s._out.call(s,i)),this[o]=!0,this["isout"===o?"isover":"isout"]=!1,this["isover"===o?"_over":"_out"].call(this,i),s&&"isout"===o&&(s.isout=!1,s.isover=!0,s._over.call(s,i)))}})},dragStop:function(t,i){t.element.parentsUntil("body").unbind("scroll.droppable"),t.options.refreshPositions||e.ui.ddmanager.prepareOffsets(t,i)}},e.ui.droppable,e.widget("ui.resizable",e.ui.mouse,{version:"1.11.0",widgetEventPrefix:"resize",options:{alsoResize:!1,animate:!1,animateDuration:"slow",animateEasing:"swing",aspectRatio:!1,autoHide:!1,containment:!1,ghost:!1,grid:!1,handles:"e,s,se",helper:!1,maxHeight:null,maxWidth:null,minHeight:10,minWidth:10,zIndex:90,resize:null,start:null,stop:null},_num:function(e){return parseInt(e,10)||0},_isNumber:function(e){return!isNaN(parseInt(e,10))},_hasScroll:function(t,i){if("hidden"===e(t).css("overflow"))return!1;var s=i&&"left"===i?"scrollLeft":"scrollTop",a=!1;return t[s]>0?!0:(t[s]=1,a=t[s]>0,t[s]=0,a)},_create:function(){var t,i,s,a,n,r=this,o=this.options;if(this.element.addClass("ui-resizable"),e.extend(this,{_aspectRatio:!!o.aspectRatio,aspectRatio:o.aspectRatio,originalElement:this.element,_proportionallyResizeElements:[],_helper:o.helper||o.ghost||o.animate?o.helper||"ui-resizable-helper":null}),this.element[0].nodeName.match(/canvas|textarea|input|select|button|img/i)&&(this.element.wrap(e("
    ").css({position:this.element.css("position"),width:this.element.outerWidth(),height:this.element.outerHeight(),top:this.element.css("top"),left:this.element.css("left")})),this.element=this.element.parent().data("ui-resizable",this.element.resizable("instance")),this.elementIsWrapper=!0,this.element.css({marginLeft:this.originalElement.css("marginLeft"),marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom")}),this.originalElement.css({marginLeft:0,marginTop:0,marginRight:0,marginBottom:0}),this.originalResizeStyle=this.originalElement.css("resize"),this.originalElement.css("resize","none"),this._proportionallyResizeElements.push(this.originalElement.css({position:"static",zoom:1,display:"block"})),this.originalElement.css({margin:this.originalElement.css("margin")}),this._proportionallyResize()),this.handles=o.handles||(e(".ui-resizable-handle",this.element).length?{n:".ui-resizable-n",e:".ui-resizable-e",s:".ui-resizable-s",w:".ui-resizable-w",se:".ui-resizable-se",sw:".ui-resizable-sw",ne:".ui-resizable-ne",nw:".ui-resizable-nw"}:"e,s,se"),this.handles.constructor===String)for("all"===this.handles&&(this.handles="n,e,s,w,se,sw,ne,nw"),t=this.handles.split(","),this.handles={},i=0;t.length>i;i++)s=e.trim(t[i]),n="ui-resizable-"+s,a=e("
    "),a.css({zIndex:o.zIndex}),"se"===s&&a.addClass("ui-icon ui-icon-gripsmall-diagonal-se"),this.handles[s]=".ui-resizable-"+s,this.element.append(a);this._renderAxis=function(t){var i,s,a,n;t=t||this.element;for(i in this.handles)this.handles[i].constructor===String&&(this.handles[i]=this.element.children(this.handles[i]).first().show()),this.elementIsWrapper&&this.originalElement[0].nodeName.match(/textarea|input|select|button/i)&&(s=e(this.handles[i],this.element),n=/sw|ne|nw|se|n|s/.test(i)?s.outerHeight():s.outerWidth(),a=["padding",/ne|nw|n/.test(i)?"Top":/se|sw|s/.test(i)?"Bottom":/^e$/.test(i)?"Right":"Left"].join(""),t.css(a,n),this._proportionallyResize()),e(this.handles[i]).length},this._renderAxis(this.element),this._handles=e(".ui-resizable-handle",this.element).disableSelection(),this._handles.mouseover(function(){r.resizing||(this.className&&(a=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i)),r.axis=a&&a[1]?a[1]:"se")}),o.autoHide&&(this._handles.hide(),e(this.element).addClass("ui-resizable-autohide").mouseenter(function(){o.disabled||(e(this).removeClass("ui-resizable-autohide"),r._handles.show())}).mouseleave(function(){o.disabled||r.resizing||(e(this).addClass("ui-resizable-autohide"),r._handles.hide())})),this._mouseInit()},_destroy:function(){this._mouseDestroy();var t,i=function(t){e(t).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing").removeData("resizable").removeData("ui-resizable").unbind(".resizable").find(".ui-resizable-handle").remove()};return this.elementIsWrapper&&(i(this.element),t=this.element,this.originalElement.css({position:t.css("position"),width:t.outerWidth(),height:t.outerHeight(),top:t.css("top"),left:t.css("left")}).insertAfter(t),t.remove()),this.originalElement.css("resize",this.originalResizeStyle),i(this.originalElement),this},_mouseCapture:function(t){var i,s,a=!1;for(i in this.handles)s=e(this.handles[i])[0],(s===t.target||e.contains(s,t.target))&&(a=!0);return!this.options.disabled&&a},_mouseStart:function(t){var i,s,a,n=this.options,r=this.element;return this.resizing=!0,this._renderProxy(),i=this._num(this.helper.css("left")),s=this._num(this.helper.css("top")),n.containment&&(i+=e(n.containment).scrollLeft()||0,s+=e(n.containment).scrollTop()||0),this.offset=this.helper.offset(),this.position={left:i,top:s},this.size=this._helper?{width:this.helper.width(),height:this.helper.height()}:{width:r.width(),height:r.height()},this.originalSize=this._helper?{width:r.outerWidth(),height:r.outerHeight()}:{width:r.width(),height:r.height()},this.originalPosition={left:i,top:s},this.sizeDiff={width:r.outerWidth()-r.width(),height:r.outerHeight()-r.height()},this.originalMousePosition={left:t.pageX,top:t.pageY},this.aspectRatio="number"==typeof n.aspectRatio?n.aspectRatio:this.originalSize.width/this.originalSize.height||1,a=e(".ui-resizable-"+this.axis).css("cursor"),e("body").css("cursor","auto"===a?this.axis+"-resize":a),r.addClass("ui-resizable-resizing"),this._propagate("start",t),!0},_mouseDrag:function(t){var i,s=this.helper,a={},n=this.originalMousePosition,r=this.axis,o=t.pageX-n.left||0,h=t.pageY-n.top||0,l=this._change[r];return this.prevPosition={top:this.position.top,left:this.position.left},this.prevSize={width:this.size.width,height:this.size.height},l?(i=l.apply(this,[t,o,h]),this._updateVirtualBoundaries(t.shiftKey),(this._aspectRatio||t.shiftKey)&&(i=this._updateRatio(i,t)),i=this._respectSize(i,t),this._updateCache(i),this._propagate("resize",t),this.position.top!==this.prevPosition.top&&(a.top=this.position.top+"px"),this.position.left!==this.prevPosition.left&&(a.left=this.position.left+"px"),this.size.width!==this.prevSize.width&&(a.width=this.size.width+"px"),this.size.height!==this.prevSize.height&&(a.height=this.size.height+"px"),s.css(a),!this._helper&&this._proportionallyResizeElements.length&&this._proportionallyResize(),e.isEmptyObject(a)||this._trigger("resize",t,this.ui()),!1):!1},_mouseStop:function(t){this.resizing=!1;var i,s,a,n,r,o,h,l=this.options,u=this;return this._helper&&(i=this._proportionallyResizeElements,s=i.length&&/textarea/i.test(i[0].nodeName),a=s&&this._hasScroll(i[0],"left")?0:u.sizeDiff.height,n=s?0:u.sizeDiff.width,r={width:u.helper.width()-n,height:u.helper.height()-a},o=parseInt(u.element.css("left"),10)+(u.position.left-u.originalPosition.left)||null,h=parseInt(u.element.css("top"),10)+(u.position.top-u.originalPosition.top)||null,l.animate||this.element.css(e.extend(r,{top:h,left:o})),u.helper.height(u.size.height),u.helper.width(u.size.width),this._helper&&!l.animate&&this._proportionallyResize()),e("body").css("cursor","auto"),this.element.removeClass("ui-resizable-resizing"),this._propagate("stop",t),this._helper&&this.helper.remove(),!1},_updateVirtualBoundaries:function(e){var t,i,s,a,n,r=this.options;n={minWidth:this._isNumber(r.minWidth)?r.minWidth:0,maxWidth:this._isNumber(r.maxWidth)?r.maxWidth:1/0,minHeight:this._isNumber(r.minHeight)?r.minHeight:0,maxHeight:this._isNumber(r.maxHeight)?r.maxHeight:1/0},(this._aspectRatio||e)&&(t=n.minHeight*this.aspectRatio,s=n.minWidth/this.aspectRatio,i=n.maxHeight*this.aspectRatio,a=n.maxWidth/this.aspectRatio,t>n.minWidth&&(n.minWidth=t),s>n.minHeight&&(n.minHeight=s),n.maxWidth>i&&(n.maxWidth=i),n.maxHeight>a&&(n.maxHeight=a)),this._vBoundaries=n},_updateCache:function(e){this.offset=this.helper.offset(),this._isNumber(e.left)&&(this.position.left=e.left),this._isNumber(e.top)&&(this.position.top=e.top),this._isNumber(e.height)&&(this.size.height=e.height),this._isNumber(e.width)&&(this.size.width=e.width)},_updateRatio:function(e){var t=this.position,i=this.size,s=this.axis;return this._isNumber(e.height)?e.width=e.height*this.aspectRatio:this._isNumber(e.width)&&(e.height=e.width/this.aspectRatio),"sw"===s&&(e.left=t.left+(i.width-e.width),e.top=null),"nw"===s&&(e.top=t.top+(i.height-e.height),e.left=t.left+(i.width-e.width)),e},_respectSize:function(e){var t=this._vBoundaries,i=this.axis,s=this._isNumber(e.width)&&t.maxWidth&&t.maxWidthe.width,r=this._isNumber(e.height)&&t.minHeight&&t.minHeight>e.height,o=this.originalPosition.left+this.originalSize.width,h=this.position.top+this.size.height,l=/sw|nw|w/.test(i),u=/nw|ne|n/.test(i);return n&&(e.width=t.minWidth),r&&(e.height=t.minHeight),s&&(e.width=t.maxWidth),a&&(e.height=t.maxHeight),n&&l&&(e.left=o-t.minWidth),s&&l&&(e.left=o-t.maxWidth),r&&u&&(e.top=h-t.minHeight),a&&u&&(e.top=h-t.maxHeight),e.width||e.height||e.left||!e.top?e.width||e.height||e.top||!e.left||(e.left=null):e.top=null,e},_proportionallyResize:function(){if(this._proportionallyResizeElements.length){var e,t,i,s,a,n=this.helper||this.element;for(e=0;this._proportionallyResizeElements.length>e;e++){if(a=this._proportionallyResizeElements[e],!this.borderDif)for(this.borderDif=[],i=[a.css("borderTopWidth"),a.css("borderRightWidth"),a.css("borderBottomWidth"),a.css("borderLeftWidth")],s=[a.css("paddingTop"),a.css("paddingRight"),a.css("paddingBottom"),a.css("paddingLeft")],t=0;i.length>t;t++)this.borderDif[t]=(parseInt(i[t],10)||0)+(parseInt(s[t],10)||0);a.css({height:n.height()-this.borderDif[0]-this.borderDif[2]||0,width:n.width()-this.borderDif[1]-this.borderDif[3]||0})}}},_renderProxy:function(){var t=this.element,i=this.options;this.elementOffset=t.offset(),this._helper?(this.helper=this.helper||e("
    "),this.helper.addClass(this._helper).css({width:this.element.outerWidth()-1,height:this.element.outerHeight()-1,position:"absolute",left:this.elementOffset.left+"px",top:this.elementOffset.top+"px",zIndex:++i.zIndex}),this.helper.appendTo("body").disableSelection()):this.helper=this.element},_change:{e:function(e,t){return{width:this.originalSize.width+t}},w:function(e,t){var i=this.originalSize,s=this.originalPosition;return{left:s.left+t,width:i.width-t}},n:function(e,t,i){var s=this.originalSize,a=this.originalPosition;return{top:a.top+i,height:s.height-i}},s:function(e,t,i){return{height:this.originalSize.height+i}},se:function(t,i,s){return e.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[t,i,s]))},sw:function(t,i,s){return e.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[t,i,s]))},ne:function(t,i,s){return e.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[t,i,s]))},nw:function(t,i,s){return e.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[t,i,s]))}},_propagate:function(t,i){e.ui.plugin.call(this,t,[i,this.ui()]),"resize"!==t&&this._trigger(t,i,this.ui())},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,originalSize:this.originalSize,originalPosition:this.originalPosition,prevSize:this.prevSize,prevPosition:this.prevPosition}}}),e.ui.plugin.add("resizable","animate",{stop:function(t){var i=e(this).resizable("instance"),s=i.options,a=i._proportionallyResizeElements,n=a.length&&/textarea/i.test(a[0].nodeName),r=n&&i._hasScroll(a[0],"left")?0:i.sizeDiff.height,o=n?0:i.sizeDiff.width,h={width:i.size.width-o,height:i.size.height-r},l=parseInt(i.element.css("left"),10)+(i.position.left-i.originalPosition.left)||null,u=parseInt(i.element.css("top"),10)+(i.position.top-i.originalPosition.top)||null;i.element.animate(e.extend(h,u&&l?{top:u,left:l}:{}),{duration:s.animateDuration,easing:s.animateEasing,step:function(){var s={width:parseInt(i.element.css("width"),10),height:parseInt(i.element.css("height"),10),top:parseInt(i.element.css("top"),10),left:parseInt(i.element.css("left"),10)};a&&a.length&&e(a[0]).css({width:s.width,height:s.height}),i._updateCache(s),i._propagate("resize",t)}})}}),e.ui.plugin.add("resizable","containment",{start:function(){var t,i,s,a,n,r,o,h=e(this).resizable("instance"),l=h.options,u=h.element,d=l.containment,c=d instanceof e?d.get(0):/parent/.test(d)?u.parent().get(0):d;c&&(h.containerElement=e(c),/document/.test(d)||d===document?(h.containerOffset={left:0,top:0},h.containerPosition={left:0,top:0},h.parentData={element:e(document),left:0,top:0,width:e(document).width(),height:e(document).height()||document.body.parentNode.scrollHeight}):(t=e(c),i=[],e(["Top","Right","Left","Bottom"]).each(function(e,s){i[e]=h._num(t.css("padding"+s))}),h.containerOffset=t.offset(),h.containerPosition=t.position(),h.containerSize={height:t.innerHeight()-i[3],width:t.innerWidth()-i[1]},s=h.containerOffset,a=h.containerSize.height,n=h.containerSize.width,r=h._hasScroll(c,"left")?c.scrollWidth:n,o=h._hasScroll(c)?c.scrollHeight:a,h.parentData={element:c,left:s.left,top:s.top,width:r,height:o}))},resize:function(t,i){var s,a,n,r,o=e(this).resizable("instance"),h=o.options,l=o.containerOffset,u=o.position,d=o._aspectRatio||t.shiftKey,c={top:0,left:0},p=o.containerElement,f=!0;p[0]!==document&&/static/.test(p.css("position"))&&(c=l),u.left<(o._helper?l.left:0)&&(o.size.width=o.size.width+(o._helper?o.position.left-l.left:o.position.left-c.left),d&&(o.size.height=o.size.width/o.aspectRatio,f=!1),o.position.left=h.helper?l.left:0),u.top<(o._helper?l.top:0)&&(o.size.height=o.size.height+(o._helper?o.position.top-l.top:o.position.top),d&&(o.size.width=o.size.height*o.aspectRatio,f=!1),o.position.top=o._helper?l.top:0),o.offset.left=o.parentData.left+o.position.left,o.offset.top=o.parentData.top+o.position.top,s=Math.abs((o._helper?o.offset.left-c.left:o.offset.left-l.left)+o.sizeDiff.width),a=Math.abs((o._helper?o.offset.top-c.top:o.offset.top-l.top)+o.sizeDiff.height),n=o.containerElement.get(0)===o.element.parent().get(0),r=/relative|absolute/.test(o.containerElement.css("position")),n&&r&&(s-=Math.abs(o.parentData.left)),s+o.size.width>=o.parentData.width&&(o.size.width=o.parentData.width-s,d&&(o.size.height=o.size.width/o.aspectRatio,f=!1)),a+o.size.height>=o.parentData.height&&(o.size.height=o.parentData.height-a,d&&(o.size.width=o.size.height*o.aspectRatio,f=!1)),f||(o.position.left=i.prevPosition.left,o.position.top=i.prevPosition.top,o.size.width=i.prevSize.width,o.size.height=i.prevSize.height)},stop:function(){var t=e(this).resizable("instance"),i=t.options,s=t.containerOffset,a=t.containerPosition,n=t.containerElement,r=e(t.helper),o=r.offset(),h=r.outerWidth()-t.sizeDiff.width,l=r.outerHeight()-t.sizeDiff.height;t._helper&&!i.animate&&/relative/.test(n.css("position"))&&e(this).css({left:o.left-a.left-s.left,width:h,height:l}),t._helper&&!i.animate&&/static/.test(n.css("position"))&&e(this).css({left:o.left-a.left-s.left,width:h,height:l})}}),e.ui.plugin.add("resizable","alsoResize",{start:function(){var t=e(this).resizable("instance"),i=t.options,s=function(t){e(t).each(function(){var t=e(this);t.data("ui-resizable-alsoresize",{width:parseInt(t.width(),10),height:parseInt(t.height(),10),left:parseInt(t.css("left"),10),top:parseInt(t.css("top"),10)})})};"object"!=typeof i.alsoResize||i.alsoResize.parentNode?s(i.alsoResize):i.alsoResize.length?(i.alsoResize=i.alsoResize[0],s(i.alsoResize)):e.each(i.alsoResize,function(e){s(e)})},resize:function(t,i){var s=e(this).resizable("instance"),a=s.options,n=s.originalSize,r=s.originalPosition,o={height:s.size.height-n.height||0,width:s.size.width-n.width||0,top:s.position.top-r.top||0,left:s.position.left-r.left||0},h=function(t,s){e(t).each(function(){var t=e(this),a=e(this).data("ui-resizable-alsoresize"),n={},r=s&&s.length?s:t.parents(i.originalElement[0]).length?["width","height"]:["width","height","top","left"];e.each(r,function(e,t){var i=(a[t]||0)+(o[t]||0);i&&i>=0&&(n[t]=i||null)}),t.css(n)})};"object"!=typeof a.alsoResize||a.alsoResize.nodeType?h(a.alsoResize):e.each(a.alsoResize,function(e,t){h(e,t)})},stop:function(){e(this).removeData("resizable-alsoresize")}}),e.ui.plugin.add("resizable","ghost",{start:function(){var t=e(this).resizable("instance"),i=t.options,s=t.size;t.ghost=t.originalElement.clone(),t.ghost.css({opacity:.25,display:"block",position:"relative",height:s.height,width:s.width,margin:0,left:0,top:0}).addClass("ui-resizable-ghost").addClass("string"==typeof i.ghost?i.ghost:""),t.ghost.appendTo(t.helper)},resize:function(){var t=e(this).resizable("instance");t.ghost&&t.ghost.css({position:"relative",height:t.size.height,width:t.size.width})},stop:function(){var t=e(this).resizable("instance");t.ghost&&t.helper&&t.helper.get(0).removeChild(t.ghost.get(0))}}),e.ui.plugin.add("resizable","grid",{resize:function(){var t=e(this).resizable("instance"),i=t.options,s=t.size,a=t.originalSize,n=t.originalPosition,r=t.axis,o="number"==typeof i.grid?[i.grid,i.grid]:i.grid,h=o[0]||1,l=o[1]||1,u=Math.round((s.width-a.width)/h)*h,d=Math.round((s.height-a.height)/l)*l,c=a.width+u,p=a.height+d,f=i.maxWidth&&c>i.maxWidth,m=i.maxHeight&&p>i.maxHeight,g=i.minWidth&&i.minWidth>c,v=i.minHeight&&i.minHeight>p;i.grid=o,g&&(c+=h),v&&(p+=l),f&&(c-=h),m&&(p-=l),/^(se|s|e)$/.test(r)?(t.size.width=c,t.size.height=p):/^(ne)$/.test(r)?(t.size.width=c,t.size.height=p,t.position.top=n.top-d):/^(sw)$/.test(r)?(t.size.width=c,t.size.height=p,t.position.left=n.left-u):(p-l>0?(t.size.height=p,t.position.top=n.top-d):(t.size.height=l,t.position.top=n.top+a.height-l),c-h>0?(t.size.width=c,t.position.left=n.left-u):(t.size.width=h,t.position.left=n.left+a.width-h))}}),e.ui.resizable,e.widget("ui.selectable",e.ui.mouse,{version:"1.11.0",options:{appendTo:"body",autoRefresh:!0,distance:0,filter:"*",tolerance:"touch",selected:null,selecting:null,start:null,stop:null,unselected:null,unselecting:null},_create:function(){var t,i=this; +this.element.addClass("ui-selectable"),this.dragged=!1,this.refresh=function(){t=e(i.options.filter,i.element[0]),t.addClass("ui-selectee"),t.each(function(){var t=e(this),i=t.offset();e.data(this,"selectable-item",{element:this,$element:t,left:i.left,top:i.top,right:i.left+t.outerWidth(),bottom:i.top+t.outerHeight(),startselected:!1,selected:t.hasClass("ui-selected"),selecting:t.hasClass("ui-selecting"),unselecting:t.hasClass("ui-unselecting")})})},this.refresh(),this.selectees=t.addClass("ui-selectee"),this._mouseInit(),this.helper=e("
    ")},_destroy:function(){this.selectees.removeClass("ui-selectee").removeData("selectable-item"),this.element.removeClass("ui-selectable ui-selectable-disabled"),this._mouseDestroy()},_mouseStart:function(t){var i=this,s=this.options;this.opos=[t.pageX,t.pageY],this.options.disabled||(this.selectees=e(s.filter,this.element[0]),this._trigger("start",t),e(s.appendTo).append(this.helper),this.helper.css({left:t.pageX,top:t.pageY,width:0,height:0}),s.autoRefresh&&this.refresh(),this.selectees.filter(".ui-selected").each(function(){var s=e.data(this,"selectable-item");s.startselected=!0,t.metaKey||t.ctrlKey||(s.$element.removeClass("ui-selected"),s.selected=!1,s.$element.addClass("ui-unselecting"),s.unselecting=!0,i._trigger("unselecting",t,{unselecting:s.element}))}),e(t.target).parents().addBack().each(function(){var s,a=e.data(this,"selectable-item");return a?(s=!t.metaKey&&!t.ctrlKey||!a.$element.hasClass("ui-selected"),a.$element.removeClass(s?"ui-unselecting":"ui-selected").addClass(s?"ui-selecting":"ui-unselecting"),a.unselecting=!s,a.selecting=s,a.selected=s,s?i._trigger("selecting",t,{selecting:a.element}):i._trigger("unselecting",t,{unselecting:a.element}),!1):void 0}))},_mouseDrag:function(t){if(this.dragged=!0,!this.options.disabled){var i,s=this,a=this.options,n=this.opos[0],r=this.opos[1],o=t.pageX,h=t.pageY;return n>o&&(i=o,o=n,n=i),r>h&&(i=h,h=r,r=i),this.helper.css({left:n,top:r,width:o-n,height:h-r}),this.selectees.each(function(){var i=e.data(this,"selectable-item"),l=!1;i&&i.element!==s.element[0]&&("touch"===a.tolerance?l=!(i.left>o||n>i.right||i.top>h||r>i.bottom):"fit"===a.tolerance&&(l=i.left>n&&o>i.right&&i.top>r&&h>i.bottom),l?(i.selected&&(i.$element.removeClass("ui-selected"),i.selected=!1),i.unselecting&&(i.$element.removeClass("ui-unselecting"),i.unselecting=!1),i.selecting||(i.$element.addClass("ui-selecting"),i.selecting=!0,s._trigger("selecting",t,{selecting:i.element}))):(i.selecting&&((t.metaKey||t.ctrlKey)&&i.startselected?(i.$element.removeClass("ui-selecting"),i.selecting=!1,i.$element.addClass("ui-selected"),i.selected=!0):(i.$element.removeClass("ui-selecting"),i.selecting=!1,i.startselected&&(i.$element.addClass("ui-unselecting"),i.unselecting=!0),s._trigger("unselecting",t,{unselecting:i.element}))),i.selected&&(t.metaKey||t.ctrlKey||i.startselected||(i.$element.removeClass("ui-selected"),i.selected=!1,i.$element.addClass("ui-unselecting"),i.unselecting=!0,s._trigger("unselecting",t,{unselecting:i.element})))))}),!1}},_mouseStop:function(t){var i=this;return this.dragged=!1,e(".ui-unselecting",this.element[0]).each(function(){var s=e.data(this,"selectable-item");s.$element.removeClass("ui-unselecting"),s.unselecting=!1,s.startselected=!1,i._trigger("unselected",t,{unselected:s.element})}),e(".ui-selecting",this.element[0]).each(function(){var s=e.data(this,"selectable-item");s.$element.removeClass("ui-selecting").addClass("ui-selected"),s.selecting=!1,s.selected=!0,s.startselected=!0,i._trigger("selected",t,{selected:s.element})}),this._trigger("stop",t),this.helper.remove(),!1}}),e.widget("ui.sortable",e.ui.mouse,{version:"1.11.0",widgetEventPrefix:"sort",ready:!1,options:{appendTo:"parent",axis:!1,connectWith:!1,containment:!1,cursor:"auto",cursorAt:!1,dropOnEmpty:!0,forcePlaceholderSize:!1,forceHelperSize:!1,grid:!1,handle:!1,helper:"original",items:"> *",opacity:!1,placeholder:!1,revert:!1,scroll:!0,scrollSensitivity:20,scrollSpeed:20,scope:"default",tolerance:"intersect",zIndex:1e3,activate:null,beforeStop:null,change:null,deactivate:null,out:null,over:null,receive:null,remove:null,sort:null,start:null,stop:null,update:null},_isOverAxis:function(e,t,i){return e>=t&&t+i>e},_isFloating:function(e){return/left|right/.test(e.css("float"))||/inline|table-cell/.test(e.css("display"))},_create:function(){var e=this.options;this.containerCache={},this.element.addClass("ui-sortable"),this.refresh(),this.floating=this.items.length?"x"===e.axis||this._isFloating(this.items[0].item):!1,this.offset=this.element.offset(),this._mouseInit(),this._setHandleClassName(),this.ready=!0},_setOption:function(e,t){this._super(e,t),"handle"===e&&this._setHandleClassName()},_setHandleClassName:function(){this.element.find(".ui-sortable-handle").removeClass("ui-sortable-handle"),e.each(this.items,function(){(this.instance.options.handle?this.item.find(this.instance.options.handle):this.item).addClass("ui-sortable-handle")})},_destroy:function(){this.element.removeClass("ui-sortable ui-sortable-disabled").find(".ui-sortable-handle").removeClass("ui-sortable-handle"),this._mouseDestroy();for(var e=this.items.length-1;e>=0;e--)this.items[e].item.removeData(this.widgetName+"-item");return this},_mouseCapture:function(t,i){var s=null,a=!1,n=this;return this.reverting?!1:this.options.disabled||"static"===this.options.type?!1:(this._refreshItems(t),e(t.target).parents().each(function(){return e.data(this,n.widgetName+"-item")===n?(s=e(this),!1):void 0}),e.data(t.target,n.widgetName+"-item")===n&&(s=e(t.target)),s?!this.options.handle||i||(e(this.options.handle,s).find("*").addBack().each(function(){this===t.target&&(a=!0)}),a)?(this.currentItem=s,this._removeCurrentsFromItems(),!0):!1:!1)},_mouseStart:function(t,i,s){var a,n,r=this.options;if(this.currentContainer=this,this.refreshPositions(),this.helper=this._createHelper(t),this._cacheHelperProportions(),this._cacheMargins(),this.scrollParent=this.helper.scrollParent(),this.offset=this.currentItem.offset(),this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left},e.extend(this.offset,{click:{left:t.pageX-this.offset.left,top:t.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()}),this.helper.css("position","absolute"),this.cssPosition=this.helper.css("position"),this.originalPosition=this._generatePosition(t),this.originalPageX=t.pageX,this.originalPageY=t.pageY,r.cursorAt&&this._adjustOffsetFromHelper(r.cursorAt),this.domPosition={prev:this.currentItem.prev()[0],parent:this.currentItem.parent()[0]},this.helper[0]!==this.currentItem[0]&&this.currentItem.hide(),this._createPlaceholder(),r.containment&&this._setContainment(),r.cursor&&"auto"!==r.cursor&&(n=this.document.find("body"),this.storedCursor=n.css("cursor"),n.css("cursor",r.cursor),this.storedStylesheet=e("").appendTo(n)),r.opacity&&(this.helper.css("opacity")&&(this._storedOpacity=this.helper.css("opacity")),this.helper.css("opacity",r.opacity)),r.zIndex&&(this.helper.css("zIndex")&&(this._storedZIndex=this.helper.css("zIndex")),this.helper.css("zIndex",r.zIndex)),this.scrollParent[0]!==document&&"HTML"!==this.scrollParent[0].tagName&&(this.overflowOffset=this.scrollParent.offset()),this._trigger("start",t,this._uiHash()),this._preserveHelperProportions||this._cacheHelperProportions(),!s)for(a=this.containers.length-1;a>=0;a--)this.containers[a]._trigger("activate",t,this._uiHash(this));return e.ui.ddmanager&&(e.ui.ddmanager.current=this),e.ui.ddmanager&&!r.dropBehaviour&&e.ui.ddmanager.prepareOffsets(this,t),this.dragging=!0,this.helper.addClass("ui-sortable-helper"),this._mouseDrag(t),!0},_mouseDrag:function(t){var i,s,a,n,r=this.options,o=!1;for(this.position=this._generatePosition(t),this.positionAbs=this._convertPositionTo("absolute"),this.lastPositionAbs||(this.lastPositionAbs=this.positionAbs),this.options.scroll&&(this.scrollParent[0]!==document&&"HTML"!==this.scrollParent[0].tagName?(this.overflowOffset.top+this.scrollParent[0].offsetHeight-t.pageY=0;i--)if(s=this.items[i],a=s.item[0],n=this._intersectsWithPointer(s),n&&s.instance===this.currentContainer&&a!==this.currentItem[0]&&this.placeholder[1===n?"next":"prev"]()[0]!==a&&!e.contains(this.placeholder[0],a)&&("semi-dynamic"===this.options.type?!e.contains(this.element[0],a):!0)){if(this.direction=1===n?"down":"up","pointer"!==this.options.tolerance&&!this._intersectsWithSides(s))break;this._rearrange(t,s),this._trigger("change",t,this._uiHash());break}return this._contactContainers(t),e.ui.ddmanager&&e.ui.ddmanager.drag(this,t),this._trigger("sort",t,this._uiHash()),this.lastPositionAbs=this.positionAbs,!1},_mouseStop:function(t,i){if(t){if(e.ui.ddmanager&&!this.options.dropBehaviour&&e.ui.ddmanager.drop(this,t),this.options.revert){var s=this,a=this.placeholder.offset(),n=this.options.axis,r={};n&&"x"!==n||(r.left=a.left-this.offset.parent.left-this.margins.left+(this.offsetParent[0]===document.body?0:this.offsetParent[0].scrollLeft)),n&&"y"!==n||(r.top=a.top-this.offset.parent.top-this.margins.top+(this.offsetParent[0]===document.body?0:this.offsetParent[0].scrollTop)),this.reverting=!0,e(this.helper).animate(r,parseInt(this.options.revert,10)||500,function(){s._clear(t)})}else this._clear(t,i);return!1}},cancel:function(){if(this.dragging){this._mouseUp({target:null}),"original"===this.options.helper?this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper"):this.currentItem.show();for(var t=this.containers.length-1;t>=0;t--)this.containers[t]._trigger("deactivate",null,this._uiHash(this)),this.containers[t].containerCache.over&&(this.containers[t]._trigger("out",null,this._uiHash(this)),this.containers[t].containerCache.over=0)}return this.placeholder&&(this.placeholder[0].parentNode&&this.placeholder[0].parentNode.removeChild(this.placeholder[0]),"original"!==this.options.helper&&this.helper&&this.helper[0].parentNode&&this.helper.remove(),e.extend(this,{helper:null,dragging:!1,reverting:!1,_noFinalSort:null}),this.domPosition.prev?e(this.domPosition.prev).after(this.currentItem):e(this.domPosition.parent).prepend(this.currentItem)),this},serialize:function(t){var i=this._getItemsAsjQuery(t&&t.connected),s=[];return t=t||{},e(i).each(function(){var i=(e(t.item||this).attr(t.attribute||"id")||"").match(t.expression||/(.+)[\-=_](.+)/);i&&s.push((t.key||i[1]+"[]")+"="+(t.key&&t.expression?i[1]:i[2]))}),!s.length&&t.key&&s.push(t.key+"="),s.join("&")},toArray:function(t){var i=this._getItemsAsjQuery(t&&t.connected),s=[];return t=t||{},i.each(function(){s.push(e(t.item||this).attr(t.attribute||"id")||"")}),s},_intersectsWith:function(e){var t=this.positionAbs.left,i=t+this.helperProportions.width,s=this.positionAbs.top,a=s+this.helperProportions.height,n=e.left,r=n+e.width,o=e.top,h=o+e.height,l=this.offset.click.top,u=this.offset.click.left,d="x"===this.options.axis||s+l>o&&h>s+l,c="y"===this.options.axis||t+u>n&&r>t+u,p=d&&c;return"pointer"===this.options.tolerance||this.options.forcePointerForContainers||"pointer"!==this.options.tolerance&&this.helperProportions[this.floating?"width":"height"]>e[this.floating?"width":"height"]?p:t+this.helperProportions.width/2>n&&r>i-this.helperProportions.width/2&&s+this.helperProportions.height/2>o&&h>a-this.helperProportions.height/2},_intersectsWithPointer:function(e){var t="x"===this.options.axis||this._isOverAxis(this.positionAbs.top+this.offset.click.top,e.top,e.height),i="y"===this.options.axis||this._isOverAxis(this.positionAbs.left+this.offset.click.left,e.left,e.width),s=t&&i,a=this._getDragVerticalDirection(),n=this._getDragHorizontalDirection();return s?this.floating?n&&"right"===n||"down"===a?2:1:a&&("down"===a?2:1):!1},_intersectsWithSides:function(e){var t=this._isOverAxis(this.positionAbs.top+this.offset.click.top,e.top+e.height/2,e.height),i=this._isOverAxis(this.positionAbs.left+this.offset.click.left,e.left+e.width/2,e.width),s=this._getDragVerticalDirection(),a=this._getDragHorizontalDirection();return this.floating&&a?"right"===a&&i||"left"===a&&!i:s&&("down"===s&&t||"up"===s&&!t)},_getDragVerticalDirection:function(){var e=this.positionAbs.top-this.lastPositionAbs.top;return 0!==e&&(e>0?"down":"up")},_getDragHorizontalDirection:function(){var e=this.positionAbs.left-this.lastPositionAbs.left;return 0!==e&&(e>0?"right":"left")},refresh:function(e){return this._refreshItems(e),this._setHandleClassName(),this.refreshPositions(),this},_connectWith:function(){var e=this.options;return e.connectWith.constructor===String?[e.connectWith]:e.connectWith},_getItemsAsjQuery:function(t){function i(){o.push(this)}var s,a,n,r,o=[],h=[],l=this._connectWith();if(l&&t)for(s=l.length-1;s>=0;s--)for(n=e(l[s]),a=n.length-1;a>=0;a--)r=e.data(n[a],this.widgetFullName),r&&r!==this&&!r.options.disabled&&h.push([e.isFunction(r.options.items)?r.options.items.call(r.element):e(r.options.items,r.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),r]);for(h.push([e.isFunction(this.options.items)?this.options.items.call(this.element,null,{options:this.options,item:this.currentItem}):e(this.options.items,this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),this]),s=h.length-1;s>=0;s--)h[s][0].each(i);return e(o)},_removeCurrentsFromItems:function(){var t=this.currentItem.find(":data("+this.widgetName+"-item)");this.items=e.grep(this.items,function(e){for(var i=0;t.length>i;i++)if(t[i]===e.item[0])return!1;return!0})},_refreshItems:function(t){this.items=[],this.containers=[this];var i,s,a,n,r,o,h,l,u=this.items,d=[[e.isFunction(this.options.items)?this.options.items.call(this.element[0],t,{item:this.currentItem}):e(this.options.items,this.element),this]],c=this._connectWith();if(c&&this.ready)for(i=c.length-1;i>=0;i--)for(a=e(c[i]),s=a.length-1;s>=0;s--)n=e.data(a[s],this.widgetFullName),n&&n!==this&&!n.options.disabled&&(d.push([e.isFunction(n.options.items)?n.options.items.call(n.element[0],t,{item:this.currentItem}):e(n.options.items,n.element),n]),this.containers.push(n));for(i=d.length-1;i>=0;i--)for(r=d[i][1],o=d[i][0],s=0,l=o.length;l>s;s++)h=e(o[s]),h.data(this.widgetName+"-item",r),u.push({item:h,instance:r,width:0,height:0,left:0,top:0})},refreshPositions:function(t){this.offsetParent&&this.helper&&(this.offset.parent=this._getParentOffset());var i,s,a,n;for(i=this.items.length-1;i>=0;i--)s=this.items[i],s.instance!==this.currentContainer&&this.currentContainer&&s.item[0]!==this.currentItem[0]||(a=this.options.toleranceElement?e(this.options.toleranceElement,s.item):s.item,t||(s.width=a.outerWidth(),s.height=a.outerHeight()),n=a.offset(),s.left=n.left,s.top=n.top);if(this.options.custom&&this.options.custom.refreshContainers)this.options.custom.refreshContainers.call(this);else for(i=this.containers.length-1;i>=0;i--)n=this.containers[i].element.offset(),this.containers[i].containerCache.left=n.left,this.containers[i].containerCache.top=n.top,this.containers[i].containerCache.width=this.containers[i].element.outerWidth(),this.containers[i].containerCache.height=this.containers[i].element.outerHeight();return this},_createPlaceholder:function(t){t=t||this;var i,s=t.options;s.placeholder&&s.placeholder.constructor!==String||(i=s.placeholder,s.placeholder={element:function(){var s=t.currentItem[0].nodeName.toLowerCase(),a=e("<"+s+">",t.document[0]).addClass(i||t.currentItem[0].className+" ui-sortable-placeholder").removeClass("ui-sortable-helper");return"tr"===s?t.currentItem.children().each(function(){e(" ",t.document[0]).attr("colspan",e(this).attr("colspan")||1).appendTo(a)}):"img"===s&&a.attr("src",t.currentItem.attr("src")),i||a.css("visibility","hidden"),a},update:function(e,a){(!i||s.forcePlaceholderSize)&&(a.height()||a.height(t.currentItem.innerHeight()-parseInt(t.currentItem.css("paddingTop")||0,10)-parseInt(t.currentItem.css("paddingBottom")||0,10)),a.width()||a.width(t.currentItem.innerWidth()-parseInt(t.currentItem.css("paddingLeft")||0,10)-parseInt(t.currentItem.css("paddingRight")||0,10)))}}),t.placeholder=e(s.placeholder.element.call(t.element,t.currentItem)),t.currentItem.after(t.placeholder),s.placeholder.update(t,t.placeholder)},_contactContainers:function(t){var i,s,a,n,r,o,h,l,u,d,c=null,p=null;for(i=this.containers.length-1;i>=0;i--)if(!e.contains(this.currentItem[0],this.containers[i].element[0]))if(this._intersectsWith(this.containers[i].containerCache)){if(c&&e.contains(this.containers[i].element[0],c.element[0]))continue;c=this.containers[i],p=i}else this.containers[i].containerCache.over&&(this.containers[i]._trigger("out",t,this._uiHash(this)),this.containers[i].containerCache.over=0);if(c)if(1===this.containers.length)this.containers[p].containerCache.over||(this.containers[p]._trigger("over",t,this._uiHash(this)),this.containers[p].containerCache.over=1);else{for(a=1e4,n=null,u=c.floating||this._isFloating(this.currentItem),r=u?"left":"top",o=u?"width":"height",d=u?"clientX":"clientY",s=this.items.length-1;s>=0;s--)e.contains(this.containers[p].element[0],this.items[s].item[0])&&this.items[s].item[0]!==this.currentItem[0]&&(h=this.items[s].item.offset()[r],l=!1,t[d]-h>this.items[s][o]/2&&(l=!0),a>Math.abs(t[d]-h)&&(a=Math.abs(t[d]-h),n=this.items[s],this.direction=l?"up":"down"));if(!n&&!this.options.dropOnEmpty)return;if(this.currentContainer===this.containers[p])return;n?this._rearrange(t,n,null,!0):this._rearrange(t,null,this.containers[p].element,!0),this._trigger("change",t,this._uiHash()),this.containers[p]._trigger("change",t,this._uiHash(this)),this.currentContainer=this.containers[p],this.options.placeholder.update(this.currentContainer,this.placeholder),this.containers[p]._trigger("over",t,this._uiHash(this)),this.containers[p].containerCache.over=1}},_createHelper:function(t){var i=this.options,s=e.isFunction(i.helper)?e(i.helper.apply(this.element[0],[t,this.currentItem])):"clone"===i.helper?this.currentItem.clone():this.currentItem;return s.parents("body").length||e("parent"!==i.appendTo?i.appendTo:this.currentItem[0].parentNode)[0].appendChild(s[0]),s[0]===this.currentItem[0]&&(this._storedCSS={width:this.currentItem[0].style.width,height:this.currentItem[0].style.height,position:this.currentItem.css("position"),top:this.currentItem.css("top"),left:this.currentItem.css("left")}),(!s[0].style.width||i.forceHelperSize)&&s.width(this.currentItem.width()),(!s[0].style.height||i.forceHelperSize)&&s.height(this.currentItem.height()),s},_adjustOffsetFromHelper:function(t){"string"==typeof t&&(t=t.split(" ")),e.isArray(t)&&(t={left:+t[0],top:+t[1]||0}),"left"in t&&(this.offset.click.left=t.left+this.margins.left),"right"in t&&(this.offset.click.left=this.helperProportions.width-t.right+this.margins.left),"top"in t&&(this.offset.click.top=t.top+this.margins.top),"bottom"in t&&(this.offset.click.top=this.helperProportions.height-t.bottom+this.margins.top)},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var t=this.offsetParent.offset();return"absolute"===this.cssPosition&&this.scrollParent[0]!==document&&e.contains(this.scrollParent[0],this.offsetParent[0])&&(t.left+=this.scrollParent.scrollLeft(),t.top+=this.scrollParent.scrollTop()),(this.offsetParent[0]===document.body||this.offsetParent[0].tagName&&"html"===this.offsetParent[0].tagName.toLowerCase()&&e.ui.ie)&&(t={top:0,left:0}),{top:t.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:t.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if("relative"===this.cssPosition){var e=this.currentItem.position();return{top:e.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:e.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}return{top:0,left:0}},_cacheMargins:function(){this.margins={left:parseInt(this.currentItem.css("marginLeft"),10)||0,top:parseInt(this.currentItem.css("marginTop"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var t,i,s,a=this.options;"parent"===a.containment&&(a.containment=this.helper[0].parentNode),("document"===a.containment||"window"===a.containment)&&(this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,e("document"===a.containment?document:window).width()-this.helperProportions.width-this.margins.left,(e("document"===a.containment?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top]),/^(document|window|parent)$/.test(a.containment)||(t=e(a.containment)[0],i=e(a.containment).offset(),s="hidden"!==e(t).css("overflow"),this.containment=[i.left+(parseInt(e(t).css("borderLeftWidth"),10)||0)+(parseInt(e(t).css("paddingLeft"),10)||0)-this.margins.left,i.top+(parseInt(e(t).css("borderTopWidth"),10)||0)+(parseInt(e(t).css("paddingTop"),10)||0)-this.margins.top,i.left+(s?Math.max(t.scrollWidth,t.offsetWidth):t.offsetWidth)-(parseInt(e(t).css("borderLeftWidth"),10)||0)-(parseInt(e(t).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left,i.top+(s?Math.max(t.scrollHeight,t.offsetHeight):t.offsetHeight)-(parseInt(e(t).css("borderTopWidth"),10)||0)-(parseInt(e(t).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top])},_convertPositionTo:function(t,i){i||(i=this.position);var s="absolute"===t?1:-1,a="absolute"!==this.cssPosition||this.scrollParent[0]!==document&&e.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,n=/(html|body)/i.test(a[0].tagName);return{top:i.top+this.offset.relative.top*s+this.offset.parent.top*s-("fixed"===this.cssPosition?-this.scrollParent.scrollTop():n?0:a.scrollTop())*s,left:i.left+this.offset.relative.left*s+this.offset.parent.left*s-("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():n?0:a.scrollLeft())*s}},_generatePosition:function(t){var i,s,a=this.options,n=t.pageX,r=t.pageY,o="absolute"!==this.cssPosition||this.scrollParent[0]!==document&&e.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,h=/(html|body)/i.test(o[0].tagName);return"relative"!==this.cssPosition||this.scrollParent[0]!==document&&this.scrollParent[0]!==this.offsetParent[0]||(this.offset.relative=this._getRelativeOffset()),this.originalPosition&&(this.containment&&(t.pageX-this.offset.click.leftthis.containment[2]&&(n=this.containment[2]+this.offset.click.left),t.pageY-this.offset.click.top>this.containment[3]&&(r=this.containment[3]+this.offset.click.top)),a.grid&&(i=this.originalPageY+Math.round((r-this.originalPageY)/a.grid[1])*a.grid[1],r=this.containment?i-this.offset.click.top>=this.containment[1]&&i-this.offset.click.top<=this.containment[3]?i:i-this.offset.click.top>=this.containment[1]?i-a.grid[1]:i+a.grid[1]:i,s=this.originalPageX+Math.round((n-this.originalPageX)/a.grid[0])*a.grid[0],n=this.containment?s-this.offset.click.left>=this.containment[0]&&s-this.offset.click.left<=this.containment[2]?s:s-this.offset.click.left>=this.containment[0]?s-a.grid[0]:s+a.grid[0]:s)),{top:r-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"===this.cssPosition?-this.scrollParent.scrollTop():h?0:o.scrollTop()),left:n-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():h?0:o.scrollLeft())}},_rearrange:function(e,t,i,s){i?i[0].appendChild(this.placeholder[0]):t.item[0].parentNode.insertBefore(this.placeholder[0],"down"===this.direction?t.item[0]:t.item[0].nextSibling),this.counter=this.counter?++this.counter:1;var a=this.counter;this._delay(function(){a===this.counter&&this.refreshPositions(!s)})},_clear:function(e,t){function i(e,t,i){return function(s){i._trigger(e,s,t._uiHash(t))}}this.reverting=!1;var s,a=[];if(!this._noFinalSort&&this.currentItem.parent().length&&this.placeholder.before(this.currentItem),this._noFinalSort=null,this.helper[0]===this.currentItem[0]){for(s in this._storedCSS)("auto"===this._storedCSS[s]||"static"===this._storedCSS[s])&&(this._storedCSS[s]="");this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper")}else this.currentItem.show();for(this.fromOutside&&!t&&a.push(function(e){this._trigger("receive",e,this._uiHash(this.fromOutside))}),!this.fromOutside&&this.domPosition.prev===this.currentItem.prev().not(".ui-sortable-helper")[0]&&this.domPosition.parent===this.currentItem.parent()[0]||t||a.push(function(e){this._trigger("update",e,this._uiHash())}),this!==this.currentContainer&&(t||(a.push(function(e){this._trigger("remove",e,this._uiHash())}),a.push(function(e){return function(t){e._trigger("receive",t,this._uiHash(this))}}.call(this,this.currentContainer)),a.push(function(e){return function(t){e._trigger("update",t,this._uiHash(this))}}.call(this,this.currentContainer)))),s=this.containers.length-1;s>=0;s--)t||a.push(i("deactivate",this,this.containers[s])),this.containers[s].containerCache.over&&(a.push(i("out",this,this.containers[s])),this.containers[s].containerCache.over=0);if(this.storedCursor&&(this.document.find("body").css("cursor",this.storedCursor),this.storedStylesheet.remove()),this._storedOpacity&&this.helper.css("opacity",this._storedOpacity),this._storedZIndex&&this.helper.css("zIndex","auto"===this._storedZIndex?"":this._storedZIndex),this.dragging=!1,this.cancelHelperRemoval){if(!t){for(this._trigger("beforeStop",e,this._uiHash()),s=0;a.length>s;s++)a[s].call(this,e);this._trigger("stop",e,this._uiHash())}return this.fromOutside=!1,!1}if(t||this._trigger("beforeStop",e,this._uiHash()),this.placeholder[0].parentNode.removeChild(this.placeholder[0]),this.helper[0]!==this.currentItem[0]&&this.helper.remove(),this.helper=null,!t){for(s=0;a.length>s;s++)a[s].call(this,e);this._trigger("stop",e,this._uiHash())}return this.fromOutside=!1,!0},_trigger:function(){e.Widget.prototype._trigger.apply(this,arguments)===!1&&this.cancel()},_uiHash:function(t){var i=t||this;return{helper:i.helper,placeholder:i.placeholder||e([]),position:i.position,originalPosition:i.originalPosition,offset:i.positionAbs,item:i.currentItem,sender:t?t.element:null}}}),e.widget("ui.accordion",{version:"1.11.0",options:{active:0,animate:{},collapsible:!1,event:"click",header:"> li > :first-child,> :not(li):even",heightStyle:"auto",icons:{activeHeader:"ui-icon-triangle-1-s",header:"ui-icon-triangle-1-e"},activate:null,beforeActivate:null},hideProps:{borderTopWidth:"hide",borderBottomWidth:"hide",paddingTop:"hide",paddingBottom:"hide",height:"hide"},showProps:{borderTopWidth:"show",borderBottomWidth:"show",paddingTop:"show",paddingBottom:"show",height:"show"},_create:function(){var t=this.options;this.prevShow=this.prevHide=e(),this.element.addClass("ui-accordion ui-widget ui-helper-reset").attr("role","tablist"),t.collapsible||t.active!==!1&&null!=t.active||(t.active=0),this._processPanels(),0>t.active&&(t.active+=this.headers.length),this._refresh()},_getCreateEventData:function(){return{header:this.active,panel:this.active.length?this.active.next():e()}},_createIcons:function(){var t=this.options.icons;t&&(e("").addClass("ui-accordion-header-icon ui-icon "+t.header).prependTo(this.headers),this.active.children(".ui-accordion-header-icon").removeClass(t.header).addClass(t.activeHeader),this.headers.addClass("ui-accordion-icons"))},_destroyIcons:function(){this.headers.removeClass("ui-accordion-icons").children(".ui-accordion-header-icon").remove()},_destroy:function(){var e;this.element.removeClass("ui-accordion ui-widget ui-helper-reset").removeAttr("role"),this.headers.removeClass("ui-accordion-header ui-accordion-header-active ui-state-default ui-corner-all ui-state-active ui-state-disabled ui-corner-top").removeAttr("role").removeAttr("aria-expanded").removeAttr("aria-selected").removeAttr("aria-controls").removeAttr("tabIndex").removeUniqueId(),this._destroyIcons(),e=this.headers.next().removeClass("ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content ui-accordion-content-active ui-state-disabled").css("display","").removeAttr("role").removeAttr("aria-hidden").removeAttr("aria-labelledby").removeUniqueId(),"content"!==this.options.heightStyle&&e.css("height","")},_setOption:function(e,t){return"active"===e?(this._activate(t),void 0):("event"===e&&(this.options.event&&this._off(this.headers,this.options.event),this._setupEvents(t)),this._super(e,t),"collapsible"!==e||t||this.options.active!==!1||this._activate(0),"icons"===e&&(this._destroyIcons(),t&&this._createIcons()),"disabled"===e&&(this.element.toggleClass("ui-state-disabled",!!t).attr("aria-disabled",t),this.headers.add(this.headers.next()).toggleClass("ui-state-disabled",!!t)),void 0)},_keydown:function(t){if(!t.altKey&&!t.ctrlKey){var i=e.ui.keyCode,s=this.headers.length,a=this.headers.index(t.target),n=!1;switch(t.keyCode){case i.RIGHT:case i.DOWN:n=this.headers[(a+1)%s];break;case i.LEFT:case i.UP:n=this.headers[(a-1+s)%s];break;case i.SPACE:case i.ENTER:this._eventHandler(t);break;case i.HOME:n=this.headers[0];break;case i.END:n=this.headers[s-1]}n&&(e(t.target).attr("tabIndex",-1),e(n).attr("tabIndex",0),n.focus(),t.preventDefault())}},_panelKeyDown:function(t){t.keyCode===e.ui.keyCode.UP&&t.ctrlKey&&e(t.currentTarget).prev().focus()},refresh:function(){var t=this.options;this._processPanels(),t.active===!1&&t.collapsible===!0||!this.headers.length?(t.active=!1,this.active=e()):t.active===!1?this._activate(0):this.active.length&&!e.contains(this.element[0],this.active[0])?this.headers.length===this.headers.find(".ui-state-disabled").length?(t.active=!1,this.active=e()):this._activate(Math.max(0,t.active-1)):t.active=this.headers.index(this.active),this._destroyIcons(),this._refresh()},_processPanels:function(){this.headers=this.element.find(this.options.header).addClass("ui-accordion-header ui-state-default ui-corner-all"),this.headers.next().addClass("ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom").filter(":not(.ui-accordion-content-active)").hide()},_refresh:function(){var t,i=this.options,s=i.heightStyle,a=this.element.parent();this.active=this._findActive(i.active).addClass("ui-accordion-header-active ui-state-active ui-corner-top").removeClass("ui-corner-all"),this.active.next().addClass("ui-accordion-content-active").show(),this.headers.attr("role","tab").each(function(){var t=e(this),i=t.uniqueId().attr("id"),s=t.next(),a=s.uniqueId().attr("id"); +t.attr("aria-controls",a),s.attr("aria-labelledby",i)}).next().attr("role","tabpanel"),this.headers.not(this.active).attr({"aria-selected":"false","aria-expanded":"false",tabIndex:-1}).next().attr({"aria-hidden":"true"}).hide(),this.active.length?this.active.attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0}).next().attr({"aria-hidden":"false"}):this.headers.eq(0).attr("tabIndex",0),this._createIcons(),this._setupEvents(i.event),"fill"===s?(t=a.height(),this.element.siblings(":visible").each(function(){var i=e(this),s=i.css("position");"absolute"!==s&&"fixed"!==s&&(t-=i.outerHeight(!0))}),this.headers.each(function(){t-=e(this).outerHeight(!0)}),this.headers.next().each(function(){e(this).height(Math.max(0,t-e(this).innerHeight()+e(this).height()))}).css("overflow","auto")):"auto"===s&&(t=0,this.headers.next().each(function(){t=Math.max(t,e(this).css("height","").height())}).height(t))},_activate:function(t){var i=this._findActive(t)[0];i!==this.active[0]&&(i=i||this.active[0],this._eventHandler({target:i,currentTarget:i,preventDefault:e.noop}))},_findActive:function(t){return"number"==typeof t?this.headers.eq(t):e()},_setupEvents:function(t){var i={keydown:"_keydown"};t&&e.each(t.split(" "),function(e,t){i[t]="_eventHandler"}),this._off(this.headers.add(this.headers.next())),this._on(this.headers,i),this._on(this.headers.next(),{keydown:"_panelKeyDown"}),this._hoverable(this.headers),this._focusable(this.headers)},_eventHandler:function(t){var i=this.options,s=this.active,a=e(t.currentTarget),n=a[0]===s[0],r=n&&i.collapsible,o=r?e():a.next(),h=s.next(),l={oldHeader:s,oldPanel:h,newHeader:r?e():a,newPanel:o};t.preventDefault(),n&&!i.collapsible||this._trigger("beforeActivate",t,l)===!1||(i.active=r?!1:this.headers.index(a),this.active=n?e():a,this._toggle(l),s.removeClass("ui-accordion-header-active ui-state-active"),i.icons&&s.children(".ui-accordion-header-icon").removeClass(i.icons.activeHeader).addClass(i.icons.header),n||(a.removeClass("ui-corner-all").addClass("ui-accordion-header-active ui-state-active ui-corner-top"),i.icons&&a.children(".ui-accordion-header-icon").removeClass(i.icons.header).addClass(i.icons.activeHeader),a.next().addClass("ui-accordion-content-active")))},_toggle:function(t){var i=t.newPanel,s=this.prevShow.length?this.prevShow:t.oldPanel;this.prevShow.add(this.prevHide).stop(!0,!0),this.prevShow=i,this.prevHide=s,this.options.animate?this._animate(i,s,t):(s.hide(),i.show(),this._toggleComplete(t)),s.attr({"aria-hidden":"true"}),s.prev().attr("aria-selected","false"),i.length&&s.length?s.prev().attr({tabIndex:-1,"aria-expanded":"false"}):i.length&&this.headers.filter(function(){return 0===e(this).attr("tabIndex")}).attr("tabIndex",-1),i.attr("aria-hidden","false").prev().attr({"aria-selected":"true",tabIndex:0,"aria-expanded":"true"})},_animate:function(e,t,i){var s,a,n,r=this,o=0,h=e.length&&(!t.length||e.index()",delay:300,options:{icons:{submenu:"ui-icon-carat-1-e"},items:"> *",menus:"ul",position:{my:"left-1 top",at:"right top"},role:"menu",blur:null,focus:null,select:null},_create:function(){this.activeMenu=this.element,this.mouseHandled=!1,this.element.uniqueId().addClass("ui-menu ui-widget ui-widget-content").toggleClass("ui-menu-icons",!!this.element.find(".ui-icon").length).attr({role:this.options.role,tabIndex:0}),this.options.disabled&&this.element.addClass("ui-state-disabled").attr("aria-disabled","true"),this._on({"mousedown .ui-menu-item":function(e){e.preventDefault()},"click .ui-menu-item":function(t){var i=e(t.target);!this.mouseHandled&&i.not(".ui-state-disabled").length&&(this.select(t),t.isPropagationStopped()||(this.mouseHandled=!0),i.has(".ui-menu").length?this.expand(t):!this.element.is(":focus")&&e(this.document[0].activeElement).closest(".ui-menu").length&&(this.element.trigger("focus",[!0]),this.active&&1===this.active.parents(".ui-menu").length&&clearTimeout(this.timer)))},"mouseenter .ui-menu-item":function(t){var i=e(t.currentTarget);i.siblings(".ui-state-active").removeClass("ui-state-active"),this.focus(t,i)},mouseleave:"collapseAll","mouseleave .ui-menu":"collapseAll",focus:function(e,t){var i=this.active||this.element.find(this.options.items).eq(0);t||this.focus(e,i)},blur:function(t){this._delay(function(){e.contains(this.element[0],this.document[0].activeElement)||this.collapseAll(t)})},keydown:"_keydown"}),this.refresh(),this._on(this.document,{click:function(e){this._closeOnDocumentClick(e)&&this.collapseAll(e),this.mouseHandled=!1}})},_destroy:function(){this.element.removeAttr("aria-activedescendant").find(".ui-menu").addBack().removeClass("ui-menu ui-widget ui-widget-content ui-menu-icons ui-front").removeAttr("role").removeAttr("tabIndex").removeAttr("aria-labelledby").removeAttr("aria-expanded").removeAttr("aria-hidden").removeAttr("aria-disabled").removeUniqueId().show(),this.element.find(".ui-menu-item").removeClass("ui-menu-item").removeAttr("role").removeAttr("aria-disabled").removeUniqueId().removeClass("ui-state-hover").removeAttr("tabIndex").removeAttr("role").removeAttr("aria-haspopup").children().each(function(){var t=e(this);t.data("ui-menu-submenu-carat")&&t.remove()}),this.element.find(".ui-menu-divider").removeClass("ui-menu-divider ui-widget-content")},_keydown:function(t){function i(e){return e.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}var s,a,n,r,o,h=!0;switch(t.keyCode){case e.ui.keyCode.PAGE_UP:this.previousPage(t);break;case e.ui.keyCode.PAGE_DOWN:this.nextPage(t);break;case e.ui.keyCode.HOME:this._move("first","first",t);break;case e.ui.keyCode.END:this._move("last","last",t);break;case e.ui.keyCode.UP:this.previous(t);break;case e.ui.keyCode.DOWN:this.next(t);break;case e.ui.keyCode.LEFT:this.collapse(t);break;case e.ui.keyCode.RIGHT:this.active&&!this.active.is(".ui-state-disabled")&&this.expand(t);break;case e.ui.keyCode.ENTER:case e.ui.keyCode.SPACE:this._activate(t);break;case e.ui.keyCode.ESCAPE:this.collapse(t);break;default:h=!1,a=this.previousFilter||"",n=String.fromCharCode(t.keyCode),r=!1,clearTimeout(this.filterTimer),n===a?r=!0:n=a+n,o=RegExp("^"+i(n),"i"),s=this.activeMenu.find(this.options.items).filter(function(){return o.test(e(this).text())}),s=r&&-1!==s.index(this.active.next())?this.active.nextAll(".ui-menu-item"):s,s.length||(n=String.fromCharCode(t.keyCode),o=RegExp("^"+i(n),"i"),s=this.activeMenu.find(this.options.items).filter(function(){return o.test(e(this).text())})),s.length?(this.focus(t,s),s.length>1?(this.previousFilter=n,this.filterTimer=this._delay(function(){delete this.previousFilter},1e3)):delete this.previousFilter):delete this.previousFilter}h&&t.preventDefault()},_activate:function(e){this.active.is(".ui-state-disabled")||(this.active.is("[aria-haspopup='true']")?this.expand(e):this.select(e))},refresh:function(){var t,i,s=this,a=this.options.icons.submenu,n=this.element.find(this.options.menus);this.element.toggleClass("ui-menu-icons",!!this.element.find(".ui-icon").length),n.filter(":not(.ui-menu)").addClass("ui-menu ui-widget ui-widget-content ui-front").hide().attr({role:this.options.role,"aria-hidden":"true","aria-expanded":"false"}).each(function(){var t=e(this),i=t.parent(),s=e("").addClass("ui-menu-icon ui-icon "+a).data("ui-menu-submenu-carat",!0);i.attr("aria-haspopup","true").prepend(s),t.attr("aria-labelledby",i.attr("id"))}),t=n.add(this.element),i=t.find(this.options.items),i.not(".ui-menu-item").each(function(){var t=e(this);s._isDivider(t)&&t.addClass("ui-widget-content ui-menu-divider")}),i.not(".ui-menu-item, .ui-menu-divider").addClass("ui-menu-item").uniqueId().attr({tabIndex:-1,role:this._itemRole()}),i.filter(".ui-state-disabled").attr("aria-disabled","true"),this.active&&!e.contains(this.element[0],this.active[0])&&this.blur()},_itemRole:function(){return{menu:"menuitem",listbox:"option"}[this.options.role]},_setOption:function(e,t){"icons"===e&&this.element.find(".ui-menu-icon").removeClass(this.options.icons.submenu).addClass(t.submenu),"disabled"===e&&this.element.toggleClass("ui-state-disabled",!!t).attr("aria-disabled",t),this._super(e,t)},focus:function(e,t){var i,s;this.blur(e,e&&"focus"===e.type),this._scrollIntoView(t),this.active=t.first(),s=this.active.addClass("ui-state-focus").removeClass("ui-state-active"),this.options.role&&this.element.attr("aria-activedescendant",s.attr("id")),this.active.parent().closest(".ui-menu-item").addClass("ui-state-active"),e&&"keydown"===e.type?this._close():this.timer=this._delay(function(){this._close()},this.delay),i=t.children(".ui-menu"),i.length&&e&&/^mouse/.test(e.type)&&this._startOpening(i),this.activeMenu=t.parent(),this._trigger("focus",e,{item:t})},_scrollIntoView:function(t){var i,s,a,n,r,o;this._hasScroll()&&(i=parseFloat(e.css(this.activeMenu[0],"borderTopWidth"))||0,s=parseFloat(e.css(this.activeMenu[0],"paddingTop"))||0,a=t.offset().top-this.activeMenu.offset().top-i-s,n=this.activeMenu.scrollTop(),r=this.activeMenu.height(),o=t.outerHeight(),0>a?this.activeMenu.scrollTop(n+a):a+o>r&&this.activeMenu.scrollTop(n+a-r+o))},blur:function(e,t){t||clearTimeout(this.timer),this.active&&(this.active.removeClass("ui-state-focus"),this.active=null,this._trigger("blur",e,{item:this.active}))},_startOpening:function(e){clearTimeout(this.timer),"true"===e.attr("aria-hidden")&&(this.timer=this._delay(function(){this._close(),this._open(e)},this.delay))},_open:function(t){var i=e.extend({of:this.active},this.options.position);clearTimeout(this.timer),this.element.find(".ui-menu").not(t.parents(".ui-menu")).hide().attr("aria-hidden","true"),t.show().removeAttr("aria-hidden").attr("aria-expanded","true").position(i)},collapseAll:function(t,i){clearTimeout(this.timer),this.timer=this._delay(function(){var s=i?this.element:e(t&&t.target).closest(this.element.find(".ui-menu"));s.length||(s=this.element),this._close(s),this.blur(t),this.activeMenu=s},this.delay)},_close:function(e){e||(e=this.active?this.active.parent():this.element),e.find(".ui-menu").hide().attr("aria-hidden","true").attr("aria-expanded","false").end().find(".ui-state-active").not(".ui-state-focus").removeClass("ui-state-active")},_closeOnDocumentClick:function(t){return!e(t.target).closest(".ui-menu").length},_isDivider:function(e){return!/[^\-\u2014\u2013\s]/.test(e.text())},collapse:function(e){var t=this.active&&this.active.parent().closest(".ui-menu-item",this.element);t&&t.length&&(this._close(),this.focus(e,t))},expand:function(e){var t=this.active&&this.active.children(".ui-menu ").find(this.options.items).first();t&&t.length&&(this._open(t.parent()),this._delay(function(){this.focus(e,t)}))},next:function(e){this._move("next","first",e)},previous:function(e){this._move("prev","last",e)},isFirstItem:function(){return this.active&&!this.active.prevAll(".ui-menu-item").length},isLastItem:function(){return this.active&&!this.active.nextAll(".ui-menu-item").length},_move:function(e,t,i){var s;this.active&&(s="first"===e||"last"===e?this.active["first"===e?"prevAll":"nextAll"](".ui-menu-item").eq(-1):this.active[e+"All"](".ui-menu-item").eq(0)),s&&s.length&&this.active||(s=this.activeMenu.find(this.options.items)[t]()),this.focus(i,s)},nextPage:function(t){var i,s,a;return this.active?(this.isLastItem()||(this._hasScroll()?(s=this.active.offset().top,a=this.element.height(),this.active.nextAll(".ui-menu-item").each(function(){return i=e(this),0>i.offset().top-s-a}),this.focus(t,i)):this.focus(t,this.activeMenu.find(this.options.items)[this.active?"last":"first"]())),void 0):(this.next(t),void 0)},previousPage:function(t){var i,s,a;return this.active?(this.isFirstItem()||(this._hasScroll()?(s=this.active.offset().top,a=this.element.height(),this.active.prevAll(".ui-menu-item").each(function(){return i=e(this),i.offset().top-s+a>0}),this.focus(t,i)):this.focus(t,this.activeMenu.find(this.options.items).first())),void 0):(this.next(t),void 0)},_hasScroll:function(){return this.element.outerHeight()",options:{appendTo:null,autoFocus:!1,delay:300,minLength:1,position:{my:"left top",at:"left bottom",collision:"none"},source:null,change:null,close:null,focus:null,open:null,response:null,search:null,select:null},requestIndex:0,pending:0,_create:function(){var t,i,s,a=this.element[0].nodeName.toLowerCase(),n="textarea"===a,r="input"===a;this.isMultiLine=n?!0:r?!1:this.element.prop("isContentEditable"),this.valueMethod=this.element[n||r?"val":"text"],this.isNewMenu=!0,this.element.addClass("ui-autocomplete-input").attr("autocomplete","off"),this._on(this.element,{keydown:function(a){if(this.element.prop("readOnly"))return t=!0,s=!0,i=!0,void 0;t=!1,s=!1,i=!1;var n=e.ui.keyCode;switch(a.keyCode){case n.PAGE_UP:t=!0,this._move("previousPage",a);break;case n.PAGE_DOWN:t=!0,this._move("nextPage",a);break;case n.UP:t=!0,this._keyEvent("previous",a);break;case n.DOWN:t=!0,this._keyEvent("next",a);break;case n.ENTER:this.menu.active&&(t=!0,a.preventDefault(),this.menu.select(a));break;case n.TAB:this.menu.active&&this.menu.select(a);break;case n.ESCAPE:this.menu.element.is(":visible")&&(this._value(this.term),this.close(a),a.preventDefault());break;default:i=!0,this._searchTimeout(a)}},keypress:function(s){if(t)return t=!1,(!this.isMultiLine||this.menu.element.is(":visible"))&&s.preventDefault(),void 0;if(!i){var a=e.ui.keyCode;switch(s.keyCode){case a.PAGE_UP:this._move("previousPage",s);break;case a.PAGE_DOWN:this._move("nextPage",s);break;case a.UP:this._keyEvent("previous",s);break;case a.DOWN:this._keyEvent("next",s)}}},input:function(e){return s?(s=!1,e.preventDefault(),void 0):(this._searchTimeout(e),void 0)},focus:function(){this.selectedItem=null,this.previous=this._value()},blur:function(e){return this.cancelBlur?(delete this.cancelBlur,void 0):(clearTimeout(this.searching),this.close(e),this._change(e),void 0)}}),this._initSource(),this.menu=e("
      ").addClass("ui-autocomplete ui-front").appendTo(this._appendTo()).menu({role:null}).hide().menu("instance"),this._on(this.menu.element,{mousedown:function(t){t.preventDefault(),this.cancelBlur=!0,this._delay(function(){delete this.cancelBlur});var i=this.menu.element[0];e(t.target).closest(".ui-menu-item").length||this._delay(function(){var t=this;this.document.one("mousedown",function(s){s.target===t.element[0]||s.target===i||e.contains(i,s.target)||t.close()})})},menufocus:function(t,i){var s,a;return this.isNewMenu&&(this.isNewMenu=!1,t.originalEvent&&/^mouse/.test(t.originalEvent.type))?(this.menu.blur(),this.document.one("mousemove",function(){e(t.target).trigger(t.originalEvent)}),void 0):(a=i.item.data("ui-autocomplete-item"),!1!==this._trigger("focus",t,{item:a})&&t.originalEvent&&/^key/.test(t.originalEvent.type)&&this._value(a.value),s=i.item.attr("aria-label")||a.value,s&&jQuery.trim(s).length&&(this.liveRegion.children().hide(),e("
      ").text(s).appendTo(this.liveRegion)),void 0)},menuselect:function(e,t){var i=t.item.data("ui-autocomplete-item"),s=this.previous;this.element[0]!==this.document[0].activeElement&&(this.element.focus(),this.previous=s,this._delay(function(){this.previous=s,this.selectedItem=i})),!1!==this._trigger("select",e,{item:i})&&this._value(i.value),this.term=this._value(),this.close(e),this.selectedItem=i}}),this.liveRegion=e("",{role:"status","aria-live":"assertive","aria-relevant":"additions"}).addClass("ui-helper-hidden-accessible").appendTo(this.document[0].body),this._on(this.window,{beforeunload:function(){this.element.removeAttr("autocomplete")}})},_destroy:function(){clearTimeout(this.searching),this.element.removeClass("ui-autocomplete-input").removeAttr("autocomplete"),this.menu.element.remove(),this.liveRegion.remove()},_setOption:function(e,t){this._super(e,t),"source"===e&&this._initSource(),"appendTo"===e&&this.menu.element.appendTo(this._appendTo()),"disabled"===e&&t&&this.xhr&&this.xhr.abort()},_appendTo:function(){var t=this.options.appendTo;return t&&(t=t.jquery||t.nodeType?e(t):this.document.find(t).eq(0)),t&&t[0]||(t=this.element.closest(".ui-front")),t.length||(t=this.document[0].body),t},_initSource:function(){var t,i,s=this;e.isArray(this.options.source)?(t=this.options.source,this.source=function(i,s){s(e.ui.autocomplete.filter(t,i.term))}):"string"==typeof this.options.source?(i=this.options.source,this.source=function(t,a){s.xhr&&s.xhr.abort(),s.xhr=e.ajax({url:i,data:t,dataType:"json",success:function(e){a(e)},error:function(){a([])}})}):this.source=this.options.source},_searchTimeout:function(e){clearTimeout(this.searching),this.searching=this._delay(function(){var t=this.term===this._value(),i=this.menu.element.is(":visible"),s=e.altKey||e.ctrlKey||e.metaKey||e.shiftKey;(!t||t&&!i&&!s)&&(this.selectedItem=null,this.search(null,e))},this.options.delay)},search:function(e,t){return e=null!=e?e:this._value(),this.term=this._value(),e.length").text(i.label).appendTo(t)},_move:function(e,t){return this.menu.element.is(":visible")?this.menu.isFirstItem()&&/^previous/.test(e)||this.menu.isLastItem()&&/^next/.test(e)?(this.isMultiLine||this._value(this.term),this.menu.blur(),void 0):(this.menu[e](t),void 0):(this.search(null,t),void 0)},widget:function(){return this.menu.element},_value:function(){return this.valueMethod.apply(this.element,arguments)},_keyEvent:function(e,t){(!this.isMultiLine||this.menu.element.is(":visible"))&&(this._move(e,t),t.preventDefault())}}),e.extend(e.ui.autocomplete,{escapeRegex:function(e){return e.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")},filter:function(t,i){var s=RegExp(e.ui.autocomplete.escapeRegex(i),"i");return e.grep(t,function(e){return s.test(e.label||e.value||e)})}}),e.widget("ui.autocomplete",e.ui.autocomplete,{options:{messages:{noResults:"No search results.",results:function(e){return e+(e>1?" results are":" result is")+" available, use up and down arrow keys to navigate."}}},__response:function(t){var i;this._superApply(arguments),this.options.disabled||this.cancelSearch||(i=t&&t.length?this.options.messages.results(t.length):this.options.messages.noResults,this.liveRegion.children().hide(),e("
      ").text(i).appendTo(this.liveRegion))}}),e.ui.autocomplete;var d,c="ui-button ui-widget ui-state-default ui-corner-all",p="ui-button-icons-only ui-button-icon-only ui-button-text-icons ui-button-text-icon-primary ui-button-text-icon-secondary ui-button-text-only",f=function(){var t=e(this);setTimeout(function(){t.find(":ui-button").button("refresh")},1)},m=function(t){var i=t.name,s=t.form,a=e([]);return i&&(i=i.replace(/'/g,"\\'"),a=s?e(s).find("[name='"+i+"'][type=radio]"):e("[name='"+i+"'][type=radio]",t.ownerDocument).filter(function(){return!this.form})),a};e.widget("ui.button",{version:"1.11.0",defaultElement:"").addClass(this._triggerClass).html(n?e("").attr({src:n,alt:a,title:a}):a)),t[o?"before":"after"](i.trigger),i.trigger.click(function(){return e.datepicker._datepickerShowing&&e.datepicker._lastInput===t[0]?e.datepicker._hideDatepicker():e.datepicker._datepickerShowing&&e.datepicker._lastInput!==t[0]?(e.datepicker._hideDatepicker(),e.datepicker._showDatepicker(t[0])):e.datepicker._showDatepicker(t[0]),!1}))},_autoSize:function(e){if(this._get(e,"autoSize")&&!e.inline){var t,i,s,a,n=new Date(2009,11,20),r=this._get(e,"dateFormat");r.match(/[DM]/)&&(t=function(e){for(i=0,s=0,a=0;e.length>a;a++)e[a].length>i&&(i=e[a].length,s=a);return s},n.setMonth(t(this._get(e,r.match(/MM/)?"monthNames":"monthNamesShort"))),n.setDate(t(this._get(e,r.match(/DD/)?"dayNames":"dayNamesShort"))+20-n.getDay())),e.input.attr("size",this._formatDate(e,n).length)}},_inlineDatepicker:function(t,i){var s=e(t);s.hasClass(this.markerClassName)||(s.addClass(this.markerClassName).append(i.dpDiv),e.data(t,"datepicker",i),this._setDate(i,this._getDefaultDate(i),!0),this._updateDatepicker(i),this._updateAlternate(i),i.settings.disabled&&this._disableDatepicker(t),i.dpDiv.css("display","block"))},_dialogDatepicker:function(t,i,s,a,n){var o,h,l,u,d,c=this._dialogInst;return c||(this.uuid+=1,o="dp"+this.uuid,this._dialogInput=e(""),this._dialogInput.keydown(this._doKeyDown),e("body").append(this._dialogInput),c=this._dialogInst=this._newInst(this._dialogInput,!1),c.settings={},e.data(this._dialogInput[0],"datepicker",c)),r(c.settings,a||{}),i=i&&i.constructor===Date?this._formatDate(c,i):i,this._dialogInput.val(i),this._pos=n?n.length?n:[n.pageX,n.pageY]:null,this._pos||(h=document.documentElement.clientWidth,l=document.documentElement.clientHeight,u=document.documentElement.scrollLeft||document.body.scrollLeft,d=document.documentElement.scrollTop||document.body.scrollTop,this._pos=[h/2-100+u,l/2-150+d]),this._dialogInput.css("left",this._pos[0]+20+"px").css("top",this._pos[1]+"px"),c.settings.onSelect=s,this._inDialog=!0,this.dpDiv.addClass(this._dialogClass),this._showDatepicker(this._dialogInput[0]),e.blockUI&&e.blockUI(this.dpDiv),e.data(this._dialogInput[0],"datepicker",c),this},_destroyDatepicker:function(t){var i,s=e(t),a=e.data(t,"datepicker");s.hasClass(this.markerClassName)&&(i=t.nodeName.toLowerCase(),e.removeData(t,"datepicker"),"input"===i?(a.append.remove(),a.trigger.remove(),s.removeClass(this.markerClassName).unbind("focus",this._showDatepicker).unbind("keydown",this._doKeyDown).unbind("keypress",this._doKeyPress).unbind("keyup",this._doKeyUp)):("div"===i||"span"===i)&&s.removeClass(this.markerClassName).empty()) +},_enableDatepicker:function(t){var i,s,a=e(t),n=e.data(t,"datepicker");a.hasClass(this.markerClassName)&&(i=t.nodeName.toLowerCase(),"input"===i?(t.disabled=!1,n.trigger.filter("button").each(function(){this.disabled=!1}).end().filter("img").css({opacity:"1.0",cursor:""})):("div"===i||"span"===i)&&(s=a.children("."+this._inlineClass),s.children().removeClass("ui-state-disabled"),s.find("select.ui-datepicker-month, select.ui-datepicker-year").prop("disabled",!1)),this._disabledInputs=e.map(this._disabledInputs,function(e){return e===t?null:e}))},_disableDatepicker:function(t){var i,s,a=e(t),n=e.data(t,"datepicker");a.hasClass(this.markerClassName)&&(i=t.nodeName.toLowerCase(),"input"===i?(t.disabled=!0,n.trigger.filter("button").each(function(){this.disabled=!0}).end().filter("img").css({opacity:"0.5",cursor:"default"})):("div"===i||"span"===i)&&(s=a.children("."+this._inlineClass),s.children().addClass("ui-state-disabled"),s.find("select.ui-datepicker-month, select.ui-datepicker-year").prop("disabled",!0)),this._disabledInputs=e.map(this._disabledInputs,function(e){return e===t?null:e}),this._disabledInputs[this._disabledInputs.length]=t)},_isDisabledDatepicker:function(e){if(!e)return!1;for(var t=0;this._disabledInputs.length>t;t++)if(this._disabledInputs[t]===e)return!0;return!1},_getInst:function(t){try{return e.data(t,"datepicker")}catch(i){throw"Missing instance data for this datepicker"}},_optionDatepicker:function(t,i,s){var a,n,o,h,l=this._getInst(t);return 2===arguments.length&&"string"==typeof i?"defaults"===i?e.extend({},e.datepicker._defaults):l?"all"===i?e.extend({},l.settings):this._get(l,i):null:(a=i||{},"string"==typeof i&&(a={},a[i]=s),l&&(this._curInst===l&&this._hideDatepicker(),n=this._getDateDatepicker(t,!0),o=this._getMinMaxDate(l,"min"),h=this._getMinMaxDate(l,"max"),r(l.settings,a),null!==o&&void 0!==a.dateFormat&&void 0===a.minDate&&(l.settings.minDate=this._formatDate(l,o)),null!==h&&void 0!==a.dateFormat&&void 0===a.maxDate&&(l.settings.maxDate=this._formatDate(l,h)),"disabled"in a&&(a.disabled?this._disableDatepicker(t):this._enableDatepicker(t)),this._attachments(e(t),l),this._autoSize(l),this._setDate(l,n),this._updateAlternate(l),this._updateDatepicker(l)),void 0)},_changeDatepicker:function(e,t,i){this._optionDatepicker(e,t,i)},_refreshDatepicker:function(e){var t=this._getInst(e);t&&this._updateDatepicker(t)},_setDateDatepicker:function(e,t){var i=this._getInst(e);i&&(this._setDate(i,t),this._updateDatepicker(i),this._updateAlternate(i))},_getDateDatepicker:function(e,t){var i=this._getInst(e);return i&&!i.inline&&this._setDateFromField(i,t),i?this._getDate(i):null},_doKeyDown:function(t){var i,s,a,n=e.datepicker._getInst(t.target),r=!0,o=n.dpDiv.is(".ui-datepicker-rtl");if(n._keyEvent=!0,e.datepicker._datepickerShowing)switch(t.keyCode){case 9:e.datepicker._hideDatepicker(),r=!1;break;case 13:return a=e("td."+e.datepicker._dayOverClass+":not(."+e.datepicker._currentClass+")",n.dpDiv),a[0]&&e.datepicker._selectDay(t.target,n.selectedMonth,n.selectedYear,a[0]),i=e.datepicker._get(n,"onSelect"),i?(s=e.datepicker._formatDate(n),i.apply(n.input?n.input[0]:null,[s,n])):e.datepicker._hideDatepicker(),!1;case 27:e.datepicker._hideDatepicker();break;case 33:e.datepicker._adjustDate(t.target,t.ctrlKey?-e.datepicker._get(n,"stepBigMonths"):-e.datepicker._get(n,"stepMonths"),"M");break;case 34:e.datepicker._adjustDate(t.target,t.ctrlKey?+e.datepicker._get(n,"stepBigMonths"):+e.datepicker._get(n,"stepMonths"),"M");break;case 35:(t.ctrlKey||t.metaKey)&&e.datepicker._clearDate(t.target),r=t.ctrlKey||t.metaKey;break;case 36:(t.ctrlKey||t.metaKey)&&e.datepicker._gotoToday(t.target),r=t.ctrlKey||t.metaKey;break;case 37:(t.ctrlKey||t.metaKey)&&e.datepicker._adjustDate(t.target,o?1:-1,"D"),r=t.ctrlKey||t.metaKey,t.originalEvent.altKey&&e.datepicker._adjustDate(t.target,t.ctrlKey?-e.datepicker._get(n,"stepBigMonths"):-e.datepicker._get(n,"stepMonths"),"M");break;case 38:(t.ctrlKey||t.metaKey)&&e.datepicker._adjustDate(t.target,-7,"D"),r=t.ctrlKey||t.metaKey;break;case 39:(t.ctrlKey||t.metaKey)&&e.datepicker._adjustDate(t.target,o?-1:1,"D"),r=t.ctrlKey||t.metaKey,t.originalEvent.altKey&&e.datepicker._adjustDate(t.target,t.ctrlKey?+e.datepicker._get(n,"stepBigMonths"):+e.datepicker._get(n,"stepMonths"),"M");break;case 40:(t.ctrlKey||t.metaKey)&&e.datepicker._adjustDate(t.target,7,"D"),r=t.ctrlKey||t.metaKey;break;default:r=!1}else 36===t.keyCode&&t.ctrlKey?e.datepicker._showDatepicker(this):r=!1;r&&(t.preventDefault(),t.stopPropagation())},_doKeyPress:function(t){var i,s,a=e.datepicker._getInst(t.target);return e.datepicker._get(a,"constrainInput")?(i=e.datepicker._possibleChars(e.datepicker._get(a,"dateFormat")),s=String.fromCharCode(null==t.charCode?t.keyCode:t.charCode),t.ctrlKey||t.metaKey||" ">s||!i||i.indexOf(s)>-1):void 0},_doKeyUp:function(t){var i,s=e.datepicker._getInst(t.target);if(s.input.val()!==s.lastVal)try{i=e.datepicker.parseDate(e.datepicker._get(s,"dateFormat"),s.input?s.input.val():null,e.datepicker._getFormatConfig(s)),i&&(e.datepicker._setDateFromField(s),e.datepicker._updateAlternate(s),e.datepicker._updateDatepicker(s))}catch(a){}return!0},_showDatepicker:function(t){if(t=t.target||t,"input"!==t.nodeName.toLowerCase()&&(t=e("input",t.parentNode)[0]),!e.datepicker._isDisabledDatepicker(t)&&e.datepicker._lastInput!==t){var i,a,n,o,h,l,u;i=e.datepicker._getInst(t),e.datepicker._curInst&&e.datepicker._curInst!==i&&(e.datepicker._curInst.dpDiv.stop(!0,!0),i&&e.datepicker._datepickerShowing&&e.datepicker._hideDatepicker(e.datepicker._curInst.input[0])),a=e.datepicker._get(i,"beforeShow"),n=a?a.apply(t,[t,i]):{},n!==!1&&(r(i.settings,n),i.lastVal=null,e.datepicker._lastInput=t,e.datepicker._setDateFromField(i),e.datepicker._inDialog&&(t.value=""),e.datepicker._pos||(e.datepicker._pos=e.datepicker._findPos(t),e.datepicker._pos[1]+=t.offsetHeight),o=!1,e(t).parents().each(function(){return o|="fixed"===e(this).css("position"),!o}),h={left:e.datepicker._pos[0],top:e.datepicker._pos[1]},e.datepicker._pos=null,i.dpDiv.empty(),i.dpDiv.css({position:"absolute",display:"block",top:"-1000px"}),e.datepicker._updateDatepicker(i),h=e.datepicker._checkOffset(i,h,o),i.dpDiv.css({position:e.datepicker._inDialog&&e.blockUI?"static":o?"fixed":"absolute",display:"none",left:h.left+"px",top:h.top+"px"}),i.inline||(l=e.datepicker._get(i,"showAnim"),u=e.datepicker._get(i,"duration"),i.dpDiv.css("z-index",s(e(t))+1),e.datepicker._datepickerShowing=!0,e.effects&&e.effects.effect[l]?i.dpDiv.show(l,e.datepicker._get(i,"showOptions"),u):i.dpDiv[l||"show"](l?u:null),e.datepicker._shouldFocusInput(i)&&i.input.focus(),e.datepicker._curInst=i))}},_updateDatepicker:function(t){this.maxRows=4,g=t,t.dpDiv.empty().append(this._generateHTML(t)),this._attachHandlers(t),t.dpDiv.find("."+this._dayOverClass+" a");var i,s=this._getNumberOfMonths(t),a=s[1],n=17;t.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width(""),a>1&&t.dpDiv.addClass("ui-datepicker-multi-"+a).css("width",n*a+"em"),t.dpDiv[(1!==s[0]||1!==s[1]?"add":"remove")+"Class"]("ui-datepicker-multi"),t.dpDiv[(this._get(t,"isRTL")?"add":"remove")+"Class"]("ui-datepicker-rtl"),t===e.datepicker._curInst&&e.datepicker._datepickerShowing&&e.datepicker._shouldFocusInput(t)&&t.input.focus(),t.yearshtml&&(i=t.yearshtml,setTimeout(function(){i===t.yearshtml&&t.yearshtml&&t.dpDiv.find("select.ui-datepicker-year:first").replaceWith(t.yearshtml),i=t.yearshtml=null},0))},_shouldFocusInput:function(e){return e.input&&e.input.is(":visible")&&!e.input.is(":disabled")&&!e.input.is(":focus")},_checkOffset:function(t,i,s){var a=t.dpDiv.outerWidth(),n=t.dpDiv.outerHeight(),r=t.input?t.input.outerWidth():0,o=t.input?t.input.outerHeight():0,h=document.documentElement.clientWidth+(s?0:e(document).scrollLeft()),l=document.documentElement.clientHeight+(s?0:e(document).scrollTop());return i.left-=this._get(t,"isRTL")?a-r:0,i.left-=s&&i.left===t.input.offset().left?e(document).scrollLeft():0,i.top-=s&&i.top===t.input.offset().top+o?e(document).scrollTop():0,i.left-=Math.min(i.left,i.left+a>h&&h>a?Math.abs(i.left+a-h):0),i.top-=Math.min(i.top,i.top+n>l&&l>n?Math.abs(n+o):0),i},_findPos:function(t){for(var i,s=this._getInst(t),a=this._get(s,"isRTL");t&&("hidden"===t.type||1!==t.nodeType||e.expr.filters.hidden(t));)t=t[a?"previousSibling":"nextSibling"];return i=e(t).offset(),[i.left,i.top]},_hideDatepicker:function(t){var i,s,a,n,r=this._curInst;!r||t&&r!==e.data(t,"datepicker")||this._datepickerShowing&&(i=this._get(r,"showAnim"),s=this._get(r,"duration"),a=function(){e.datepicker._tidyDialog(r)},e.effects&&(e.effects.effect[i]||e.effects[i])?r.dpDiv.hide(i,e.datepicker._get(r,"showOptions"),s,a):r.dpDiv["slideDown"===i?"slideUp":"fadeIn"===i?"fadeOut":"hide"](i?s:null,a),i||a(),this._datepickerShowing=!1,n=this._get(r,"onClose"),n&&n.apply(r.input?r.input[0]:null,[r.input?r.input.val():"",r]),this._lastInput=null,this._inDialog&&(this._dialogInput.css({position:"absolute",left:"0",top:"-100px"}),e.blockUI&&(e.unblockUI(),e("body").append(this.dpDiv))),this._inDialog=!1)},_tidyDialog:function(e){e.dpDiv.removeClass(this._dialogClass).unbind(".ui-datepicker-calendar")},_checkExternalClick:function(t){if(e.datepicker._curInst){var i=e(t.target),s=e.datepicker._getInst(i[0]);(i[0].id!==e.datepicker._mainDivId&&0===i.parents("#"+e.datepicker._mainDivId).length&&!i.hasClass(e.datepicker.markerClassName)&&!i.closest("."+e.datepicker._triggerClass).length&&e.datepicker._datepickerShowing&&(!e.datepicker._inDialog||!e.blockUI)||i.hasClass(e.datepicker.markerClassName)&&e.datepicker._curInst!==s)&&e.datepicker._hideDatepicker()}},_adjustDate:function(t,i,s){var a=e(t),n=this._getInst(a[0]);this._isDisabledDatepicker(a[0])||(this._adjustInstDate(n,i+("M"===s?this._get(n,"showCurrentAtPos"):0),s),this._updateDatepicker(n))},_gotoToday:function(t){var i,s=e(t),a=this._getInst(s[0]);this._get(a,"gotoCurrent")&&a.currentDay?(a.selectedDay=a.currentDay,a.drawMonth=a.selectedMonth=a.currentMonth,a.drawYear=a.selectedYear=a.currentYear):(i=new Date,a.selectedDay=i.getDate(),a.drawMonth=a.selectedMonth=i.getMonth(),a.drawYear=a.selectedYear=i.getFullYear()),this._notifyChange(a),this._adjustDate(s)},_selectMonthYear:function(t,i,s){var a=e(t),n=this._getInst(a[0]);n["selected"+("M"===s?"Month":"Year")]=n["draw"+("M"===s?"Month":"Year")]=parseInt(i.options[i.selectedIndex].value,10),this._notifyChange(n),this._adjustDate(a)},_selectDay:function(t,i,s,a){var n,r=e(t);e(a).hasClass(this._unselectableClass)||this._isDisabledDatepicker(r[0])||(n=this._getInst(r[0]),n.selectedDay=n.currentDay=e("a",a).html(),n.selectedMonth=n.currentMonth=i,n.selectedYear=n.currentYear=s,this._selectDate(t,this._formatDate(n,n.currentDay,n.currentMonth,n.currentYear)))},_clearDate:function(t){var i=e(t);this._selectDate(i,"")},_selectDate:function(t,i){var s,a=e(t),n=this._getInst(a[0]);i=null!=i?i:this._formatDate(n),n.input&&n.input.val(i),this._updateAlternate(n),s=this._get(n,"onSelect"),s?s.apply(n.input?n.input[0]:null,[i,n]):n.input&&n.input.trigger("change"),n.inline?this._updateDatepicker(n):(this._hideDatepicker(),this._lastInput=n.input[0],"object"!=typeof n.input[0]&&n.input.focus(),this._lastInput=null)},_updateAlternate:function(t){var i,s,a,n=this._get(t,"altField");n&&(i=this._get(t,"altFormat")||this._get(t,"dateFormat"),s=this._getDate(t),a=this.formatDate(i,s,this._getFormatConfig(t)),e(n).each(function(){e(this).val(a)}))},noWeekends:function(e){var t=e.getDay();return[t>0&&6>t,""]},iso8601Week:function(e){var t,i=new Date(e.getTime());return i.setDate(i.getDate()+4-(i.getDay()||7)),t=i.getTime(),i.setMonth(0),i.setDate(1),Math.floor(Math.round((t-i)/864e5)/7)+1},parseDate:function(t,i,s){if(null==t||null==i)throw"Invalid arguments";if(i="object"==typeof i?""+i:i+"",""===i)return null;var a,n,r,o,h=0,l=(s?s.shortYearCutoff:null)||this._defaults.shortYearCutoff,u="string"!=typeof l?l:(new Date).getFullYear()%100+parseInt(l,10),d=(s?s.dayNamesShort:null)||this._defaults.dayNamesShort,c=(s?s.dayNames:null)||this._defaults.dayNames,p=(s?s.monthNamesShort:null)||this._defaults.monthNamesShort,f=(s?s.monthNames:null)||this._defaults.monthNames,m=-1,g=-1,v=-1,y=-1,b=!1,_=function(e){var i=t.length>a+1&&t.charAt(a+1)===e;return i&&a++,i},x=function(e){var t=_(e),s="@"===e?14:"!"===e?20:"y"===e&&t?4:"o"===e?3:2,a=RegExp("^\\d{1,"+s+"}"),n=i.substring(h).match(a);if(!n)throw"Missing number at position "+h;return h+=n[0].length,parseInt(n[0],10)},k=function(t,s,a){var n=-1,r=e.map(_(t)?a:s,function(e,t){return[[t,e]]}).sort(function(e,t){return-(e[1].length-t[1].length)});if(e.each(r,function(e,t){var s=t[1];return i.substr(h,s.length).toLowerCase()===s.toLowerCase()?(n=t[0],h+=s.length,!1):void 0}),-1!==n)return n+1;throw"Unknown name at position "+h},w=function(){if(i.charAt(h)!==t.charAt(a))throw"Unexpected literal at position "+h;h++};for(a=0;t.length>a;a++)if(b)"'"!==t.charAt(a)||_("'")?w():b=!1;else switch(t.charAt(a)){case"d":v=x("d");break;case"D":k("D",d,c);break;case"o":y=x("o");break;case"m":g=x("m");break;case"M":g=k("M",p,f);break;case"y":m=x("y");break;case"@":o=new Date(x("@")),m=o.getFullYear(),g=o.getMonth()+1,v=o.getDate();break;case"!":o=new Date((x("!")-this._ticksTo1970)/1e4),m=o.getFullYear(),g=o.getMonth()+1,v=o.getDate();break;case"'":_("'")?w():b=!0;break;default:w()}if(i.length>h&&(r=i.substr(h),!/^\s+/.test(r)))throw"Extra/unparsed characters found in date: "+r;if(-1===m?m=(new Date).getFullYear():100>m&&(m+=(new Date).getFullYear()-(new Date).getFullYear()%100+(u>=m?0:-100)),y>-1)for(g=1,v=y;;){if(n=this._getDaysInMonth(m,g-1),n>=v)break;g++,v-=n}if(o=this._daylightSavingAdjust(new Date(m,g-1,v)),o.getFullYear()!==m||o.getMonth()+1!==g||o.getDate()!==v)throw"Invalid date";return o},ATOM:"yy-mm-dd",COOKIE:"D, dd M yy",ISO_8601:"yy-mm-dd",RFC_822:"D, d M y",RFC_850:"DD, dd-M-y",RFC_1036:"D, d M y",RFC_1123:"D, d M yy",RFC_2822:"D, d M yy",RSS:"D, d M y",TICKS:"!",TIMESTAMP:"@",W3C:"yy-mm-dd",_ticksTo1970:1e7*60*60*24*(718685+Math.floor(492.5)-Math.floor(19.7)+Math.floor(4.925)),formatDate:function(e,t,i){if(!t)return"";var s,a=(i?i.dayNamesShort:null)||this._defaults.dayNamesShort,n=(i?i.dayNames:null)||this._defaults.dayNames,r=(i?i.monthNamesShort:null)||this._defaults.monthNamesShort,o=(i?i.monthNames:null)||this._defaults.monthNames,h=function(t){var i=e.length>s+1&&e.charAt(s+1)===t;return i&&s++,i},l=function(e,t,i){var s=""+t;if(h(e))for(;i>s.length;)s="0"+s;return s},u=function(e,t,i,s){return h(e)?s[t]:i[t]},d="",c=!1;if(t)for(s=0;e.length>s;s++)if(c)"'"!==e.charAt(s)||h("'")?d+=e.charAt(s):c=!1;else switch(e.charAt(s)){case"d":d+=l("d",t.getDate(),2);break;case"D":d+=u("D",t.getDay(),a,n);break;case"o":d+=l("o",Math.round((new Date(t.getFullYear(),t.getMonth(),t.getDate()).getTime()-new Date(t.getFullYear(),0,0).getTime())/864e5),3);break;case"m":d+=l("m",t.getMonth()+1,2);break;case"M":d+=u("M",t.getMonth(),r,o);break;case"y":d+=h("y")?t.getFullYear():(10>t.getYear()%100?"0":"")+t.getYear()%100;break;case"@":d+=t.getTime();break;case"!":d+=1e4*t.getTime()+this._ticksTo1970;break;case"'":h("'")?d+="'":c=!0;break;default:d+=e.charAt(s)}return d},_possibleChars:function(e){var t,i="",s=!1,a=function(i){var s=e.length>t+1&&e.charAt(t+1)===i;return s&&t++,s};for(t=0;e.length>t;t++)if(s)"'"!==e.charAt(t)||a("'")?i+=e.charAt(t):s=!1;else switch(e.charAt(t)){case"d":case"m":case"y":case"@":i+="0123456789";break;case"D":case"M":return null;case"'":a("'")?i+="'":s=!0;break;default:i+=e.charAt(t)}return i},_get:function(e,t){return void 0!==e.settings[t]?e.settings[t]:this._defaults[t]},_setDateFromField:function(e,t){if(e.input.val()!==e.lastVal){var i=this._get(e,"dateFormat"),s=e.lastVal=e.input?e.input.val():null,a=this._getDefaultDate(e),n=a,r=this._getFormatConfig(e);try{n=this.parseDate(i,s,r)||a}catch(o){s=t?"":s}e.selectedDay=n.getDate(),e.drawMonth=e.selectedMonth=n.getMonth(),e.drawYear=e.selectedYear=n.getFullYear(),e.currentDay=s?n.getDate():0,e.currentMonth=s?n.getMonth():0,e.currentYear=s?n.getFullYear():0,this._adjustInstDate(e)}},_getDefaultDate:function(e){return this._restrictMinMax(e,this._determineDate(e,this._get(e,"defaultDate"),new Date))},_determineDate:function(t,i,s){var a=function(e){var t=new Date;return t.setDate(t.getDate()+e),t},n=function(i){try{return e.datepicker.parseDate(e.datepicker._get(t,"dateFormat"),i,e.datepicker._getFormatConfig(t))}catch(s){}for(var a=(i.toLowerCase().match(/^c/)?e.datepicker._getDate(t):null)||new Date,n=a.getFullYear(),r=a.getMonth(),o=a.getDate(),h=/([+\-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g,l=h.exec(i);l;){switch(l[2]||"d"){case"d":case"D":o+=parseInt(l[1],10);break;case"w":case"W":o+=7*parseInt(l[1],10);break;case"m":case"M":r+=parseInt(l[1],10),o=Math.min(o,e.datepicker._getDaysInMonth(n,r));break;case"y":case"Y":n+=parseInt(l[1],10),o=Math.min(o,e.datepicker._getDaysInMonth(n,r))}l=h.exec(i)}return new Date(n,r,o)},r=null==i||""===i?s:"string"==typeof i?n(i):"number"==typeof i?isNaN(i)?s:a(i):new Date(i.getTime());return r=r&&"Invalid Date"==""+r?s:r,r&&(r.setHours(0),r.setMinutes(0),r.setSeconds(0),r.setMilliseconds(0)),this._daylightSavingAdjust(r)},_daylightSavingAdjust:function(e){return e?(e.setHours(e.getHours()>12?e.getHours()+2:0),e):null},_setDate:function(e,t,i){var s=!t,a=e.selectedMonth,n=e.selectedYear,r=this._restrictMinMax(e,this._determineDate(e,t,new Date));e.selectedDay=e.currentDay=r.getDate(),e.drawMonth=e.selectedMonth=e.currentMonth=r.getMonth(),e.drawYear=e.selectedYear=e.currentYear=r.getFullYear(),a===e.selectedMonth&&n===e.selectedYear||i||this._notifyChange(e),this._adjustInstDate(e),e.input&&e.input.val(s?"":this._formatDate(e))},_getDate:function(e){var t=!e.currentYear||e.input&&""===e.input.val()?null:this._daylightSavingAdjust(new Date(e.currentYear,e.currentMonth,e.currentDay));return t},_attachHandlers:function(t){var i=this._get(t,"stepMonths"),s="#"+t.id.replace(/\\\\/g,"\\");t.dpDiv.find("[data-handler]").map(function(){var t={prev:function(){e.datepicker._adjustDate(s,-i,"M")},next:function(){e.datepicker._adjustDate(s,+i,"M")},hide:function(){e.datepicker._hideDatepicker()},today:function(){e.datepicker._gotoToday(s)},selectDay:function(){return e.datepicker._selectDay(s,+this.getAttribute("data-month"),+this.getAttribute("data-year"),this),!1},selectMonth:function(){return e.datepicker._selectMonthYear(s,this,"M"),!1},selectYear:function(){return e.datepicker._selectMonthYear(s,this,"Y"),!1}};e(this).bind(this.getAttribute("data-event"),t[this.getAttribute("data-handler")])})},_generateHTML:function(e){var t,i,s,a,n,r,o,h,l,u,d,c,p,f,m,g,v,y,b,_,x,k,w,D,T,S,M,N,C,A,I,P,F,H,z,j,E,O,L,W=new Date,R=this._daylightSavingAdjust(new Date(W.getFullYear(),W.getMonth(),W.getDate())),Y=this._get(e,"isRTL"),J=this._get(e,"showButtonPanel"),B=this._get(e,"hideIfNoPrevNext"),K=this._get(e,"navigationAsDateFormat"),V=this._getNumberOfMonths(e),q=this._get(e,"showCurrentAtPos"),U=this._get(e,"stepMonths"),G=1!==V[0]||1!==V[1],Q=this._daylightSavingAdjust(e.currentDay?new Date(e.currentYear,e.currentMonth,e.currentDay):new Date(9999,9,9)),X=this._getMinMaxDate(e,"min"),$=this._getMinMaxDate(e,"max"),Z=e.drawMonth-q,et=e.drawYear;if(0>Z&&(Z+=12,et--),$)for(t=this._daylightSavingAdjust(new Date($.getFullYear(),$.getMonth()-V[0]*V[1]+1,$.getDate())),t=X&&X>t?X:t;this._daylightSavingAdjust(new Date(et,Z,1))>t;)Z--,0>Z&&(Z=11,et--);for(e.drawMonth=Z,e.drawYear=et,i=this._get(e,"prevText"),i=K?this.formatDate(i,this._daylightSavingAdjust(new Date(et,Z-U,1)),this._getFormatConfig(e)):i,s=this._canAdjustMonth(e,-1,et,Z)?""+i+"":B?"":""+i+"",a=this._get(e,"nextText"),a=K?this.formatDate(a,this._daylightSavingAdjust(new Date(et,Z+U,1)),this._getFormatConfig(e)):a,n=this._canAdjustMonth(e,1,et,Z)?""+a+"":B?"":""+a+"",r=this._get(e,"currentText"),o=this._get(e,"gotoCurrent")&&e.currentDay?Q:R,r=K?this.formatDate(r,o,this._getFormatConfig(e)):r,h=e.inline?"":"",l=J?"
      "+(Y?h:"")+(this._isInRange(e,o)?"":"")+(Y?"":h)+"
      ":"",u=parseInt(this._get(e,"firstDay"),10),u=isNaN(u)?0:u,d=this._get(e,"showWeek"),c=this._get(e,"dayNames"),p=this._get(e,"dayNamesMin"),f=this._get(e,"monthNames"),m=this._get(e,"monthNamesShort"),g=this._get(e,"beforeShowDay"),v=this._get(e,"showOtherMonths"),y=this._get(e,"selectOtherMonths"),b=this._getDefaultDate(e),_="",k=0;V[0]>k;k++){for(w="",this.maxRows=4,D=0;V[1]>D;D++){if(T=this._daylightSavingAdjust(new Date(et,Z,e.selectedDay)),S=" ui-corner-all",M="",G){if(M+="
      "}for(M+="
      "+(/all|left/.test(S)&&0===k?Y?n:s:"")+(/all|right/.test(S)&&0===k?Y?s:n:"")+this._generateMonthYearHeader(e,Z,et,X,$,k>0||D>0,f,m)+"
      "+"",N=d?"":"",x=0;7>x;x++)C=(x+u)%7,N+="";for(M+=N+"",A=this._getDaysInMonth(et,Z),et===e.selectedYear&&Z===e.selectedMonth&&(e.selectedDay=Math.min(e.selectedDay,A)),I=(this._getFirstDayOfMonth(et,Z)-u+7)%7,P=Math.ceil((I+A)/7),F=G?this.maxRows>P?this.maxRows:P:P,this.maxRows=F,H=this._daylightSavingAdjust(new Date(et,Z,1-I)),z=0;F>z;z++){for(M+="",j=d?"":"",x=0;7>x;x++)E=g?g.apply(e.input?e.input[0]:null,[H]):[!0,""],O=H.getMonth()!==Z,L=O&&!y||!E[0]||X&&X>H||$&&H>$,j+="",H.setDate(H.getDate()+1),H=this._daylightSavingAdjust(H);M+=j+""}Z++,Z>11&&(Z=0,et++),M+="
      "+this._get(e,"weekHeader")+"=5?" class='ui-datepicker-week-end'":"")+">"+""+p[C]+"
      "+this._get(e,"calculateWeek")(H)+""+(O&&!v?" ":L?""+H.getDate()+"":""+H.getDate()+"")+"
      "+(G?"
      "+(V[0]>0&&D===V[1]-1?"
      ":""):""),w+=M}_+=w}return _+=l,e._keyEvent=!1,_},_generateMonthYearHeader:function(e,t,i,s,a,n,r,o){var h,l,u,d,c,p,f,m,g=this._get(e,"changeMonth"),v=this._get(e,"changeYear"),y=this._get(e,"showMonthAfterYear"),b="
      ",_="";if(n||!g)_+=""+r[t]+"";else{for(h=s&&s.getFullYear()===i,l=a&&a.getFullYear()===i,_+=""}if(y||(b+=_+(!n&&g&&v?"":" ")),!e.yearshtml)if(e.yearshtml="",n||!v)b+=""+i+"";else{for(d=this._get(e,"yearRange").split(":"),c=(new Date).getFullYear(),p=function(e){var t=e.match(/c[+\-].*/)?i+parseInt(e.substring(1),10):e.match(/[+\-].*/)?c+parseInt(e,10):parseInt(e,10);return isNaN(t)?c:t},f=p(d[0]),m=Math.max(f,p(d[1]||"")),f=s?Math.max(f,s.getFullYear()):f,m=a?Math.min(m,a.getFullYear()):m,e.yearshtml+="",b+=e.yearshtml,e.yearshtml=null}return b+=this._get(e,"yearSuffix"),y&&(b+=(!n&&g&&v?"":" ")+_),b+="
      "},_adjustInstDate:function(e,t,i){var s=e.drawYear+("Y"===i?t:0),a=e.drawMonth+("M"===i?t:0),n=Math.min(e.selectedDay,this._getDaysInMonth(s,a))+("D"===i?t:0),r=this._restrictMinMax(e,this._daylightSavingAdjust(new Date(s,a,n)));e.selectedDay=r.getDate(),e.drawMonth=e.selectedMonth=r.getMonth(),e.drawYear=e.selectedYear=r.getFullYear(),("M"===i||"Y"===i)&&this._notifyChange(e)},_restrictMinMax:function(e,t){var i=this._getMinMaxDate(e,"min"),s=this._getMinMaxDate(e,"max"),a=i&&i>t?i:t;return s&&a>s?s:a},_notifyChange:function(e){var t=this._get(e,"onChangeMonthYear");t&&t.apply(e.input?e.input[0]:null,[e.selectedYear,e.selectedMonth+1,e])},_getNumberOfMonths:function(e){var t=this._get(e,"numberOfMonths");return null==t?[1,1]:"number"==typeof t?[1,t]:t},_getMinMaxDate:function(e,t){return this._determineDate(e,this._get(e,t+"Date"),null)},_getDaysInMonth:function(e,t){return 32-this._daylightSavingAdjust(new Date(e,t,32)).getDate()},_getFirstDayOfMonth:function(e,t){return new Date(e,t,1).getDay()},_canAdjustMonth:function(e,t,i,s){var a=this._getNumberOfMonths(e),n=this._daylightSavingAdjust(new Date(i,s+(0>t?t:a[0]*a[1]),1));return 0>t&&n.setDate(this._getDaysInMonth(n.getFullYear(),n.getMonth())),this._isInRange(e,n)},_isInRange:function(e,t){var i,s,a=this._getMinMaxDate(e,"min"),n=this._getMinMaxDate(e,"max"),r=null,o=null,h=this._get(e,"yearRange");return h&&(i=h.split(":"),s=(new Date).getFullYear(),r=parseInt(i[0],10),o=parseInt(i[1],10),i[0].match(/[+\-].*/)&&(r+=s),i[1].match(/[+\-].*/)&&(o+=s)),(!a||t.getTime()>=a.getTime())&&(!n||t.getTime()<=n.getTime())&&(!r||t.getFullYear()>=r)&&(!o||o>=t.getFullYear())},_getFormatConfig:function(e){var t=this._get(e,"shortYearCutoff");return t="string"!=typeof t?t:(new Date).getFullYear()%100+parseInt(t,10),{shortYearCutoff:t,dayNamesShort:this._get(e,"dayNamesShort"),dayNames:this._get(e,"dayNames"),monthNamesShort:this._get(e,"monthNamesShort"),monthNames:this._get(e,"monthNames")}},_formatDate:function(e,t,i,s){t||(e.currentDay=e.selectedDay,e.currentMonth=e.selectedMonth,e.currentYear=e.selectedYear);var a=t?"object"==typeof t?t:this._daylightSavingAdjust(new Date(s,i,t)):this._daylightSavingAdjust(new Date(e.currentYear,e.currentMonth,e.currentDay));return this.formatDate(this._get(e,"dateFormat"),a,this._getFormatConfig(e))}}),e.fn.datepicker=function(t){if(!this.length)return this;e.datepicker.initialized||(e(document).mousedown(e.datepicker._checkExternalClick),e.datepicker.initialized=!0),0===e("#"+e.datepicker._mainDivId).length&&e("body").append(e.datepicker.dpDiv);var i=Array.prototype.slice.call(arguments,1);return"string"!=typeof t||"isDisabled"!==t&&"getDate"!==t&&"widget"!==t?"option"===t&&2===arguments.length&&"string"==typeof arguments[1]?e.datepicker["_"+t+"Datepicker"].apply(e.datepicker,[this[0]].concat(i)):this.each(function(){"string"==typeof t?e.datepicker["_"+t+"Datepicker"].apply(e.datepicker,[this].concat(i)):e.datepicker._attachDatepicker(this,t)}):e.datepicker["_"+t+"Datepicker"].apply(e.datepicker,[this[0]].concat(i))},e.datepicker=new a,e.datepicker.initialized=!1,e.datepicker.uuid=(new Date).getTime(),e.datepicker.version="1.11.0",e.datepicker,e.widget("ui.dialog",{version:"1.11.0",options:{appendTo:"body",autoOpen:!0,buttons:[],closeOnEscape:!0,closeText:"Close",dialogClass:"",draggable:!0,hide:null,height:"auto",maxHeight:null,maxWidth:null,minHeight:150,minWidth:150,modal:!1,position:{my:"center",at:"center",of:window,collision:"fit",using:function(t){var i=e(this).css(t).offset().top;0>i&&e(this).css("top",t.top-i)}},resizable:!0,show:null,title:null,width:300,beforeClose:null,close:null,drag:null,dragStart:null,dragStop:null,focus:null,open:null,resize:null,resizeStart:null,resizeStop:null},sizeRelatedOptions:{buttons:!0,height:!0,maxHeight:!0,maxWidth:!0,minHeight:!0,minWidth:!0,width:!0},resizableRelatedOptions:{maxHeight:!0,maxWidth:!0,minHeight:!0,minWidth:!0},_create:function(){this.originalCss={display:this.element[0].style.display,width:this.element[0].style.width,minHeight:this.element[0].style.minHeight,maxHeight:this.element[0].style.maxHeight,height:this.element[0].style.height},this.originalPosition={parent:this.element.parent(),index:this.element.parent().children().index(this.element)},this.originalTitle=this.element.attr("title"),this.options.title=this.options.title||this.originalTitle,this._createWrapper(),this.element.show().removeAttr("title").addClass("ui-dialog-content ui-widget-content").appendTo(this.uiDialog),this._createTitlebar(),this._createButtonPane(),this.options.draggable&&e.fn.draggable&&this._makeDraggable(),this.options.resizable&&e.fn.resizable&&this._makeResizable(),this._isOpen=!1,this._trackFocus()},_init:function(){this.options.autoOpen&&this.open()},_appendTo:function(){var t=this.options.appendTo;return t&&(t.jquery||t.nodeType)?e(t):this.document.find(t||"body").eq(0)},_destroy:function(){var e,t=this.originalPosition;this._destroyOverlay(),this.element.removeUniqueId().removeClass("ui-dialog-content ui-widget-content").css(this.originalCss).detach(),this.uiDialog.stop(!0,!0).remove(),this.originalTitle&&this.element.attr("title",this.originalTitle),e=t.parent.children().eq(t.index),e.length&&e[0]!==this.element[0]?e.before(this.element):t.parent.append(this.element)},widget:function(){return this.uiDialog},disable:e.noop,enable:e.noop,close:function(t){var i,s=this;if(this._isOpen&&this._trigger("beforeClose",t)!==!1){if(this._isOpen=!1,this._focusedElement=null,this._destroyOverlay(),this._untrackInstance(),!this.opener.filter(":focusable").focus().length)try{i=this.document[0].activeElement,i&&"body"!==i.nodeName.toLowerCase()&&e(i).blur()}catch(a){}this._hide(this.uiDialog,this.options.hide,function(){s._trigger("close",t)})}},isOpen:function(){return this._isOpen},moveToTop:function(){this._moveToTop()},_moveToTop:function(t,i){var s=!1,a=this.uiDialog.siblings(".ui-front:visible").map(function(){return+e(this).css("z-index")}).get(),n=Math.max.apply(null,a);return n>=+this.uiDialog.css("z-index")&&(this.uiDialog.css("z-index",n+1),s=!0),s&&!i&&this._trigger("focus",t),s},open:function(){var t=this;return this._isOpen?(this._moveToTop()&&this._focusTabbable(),void 0):(this._isOpen=!0,this.opener=e(this.document[0].activeElement),this._size(),this._position(),this._createOverlay(),this._moveToTop(null,!0),this._show(this.uiDialog,this.options.show,function(){t._focusTabbable(),t._trigger("focus")}),this._trigger("open"),void 0)},_focusTabbable:function(){var e=this._focusedElement;e||(e=this.element.find("[autofocus]")),e.length||(e=this.element.find(":tabbable")),e.length||(e=this.uiDialogButtonPane.find(":tabbable")),e.length||(e=this.uiDialogTitlebarClose.filter(":tabbable")),e.length||(e=this.uiDialog),e.eq(0).focus() +},_keepFocus:function(t){function i(){var t=this.document[0].activeElement,i=this.uiDialog[0]===t||e.contains(this.uiDialog[0],t);i||this._focusTabbable()}t.preventDefault(),i.call(this),this._delay(i)},_createWrapper:function(){this.uiDialog=e("
      ").addClass("ui-dialog ui-widget ui-widget-content ui-corner-all ui-front "+this.options.dialogClass).hide().attr({tabIndex:-1,role:"dialog"}).appendTo(this._appendTo()),this._on(this.uiDialog,{keydown:function(t){if(this.options.closeOnEscape&&!t.isDefaultPrevented()&&t.keyCode&&t.keyCode===e.ui.keyCode.ESCAPE)return t.preventDefault(),this.close(t),void 0;if(t.keyCode===e.ui.keyCode.TAB&&!t.isDefaultPrevented()){var i=this.uiDialog.find(":tabbable"),s=i.filter(":first"),a=i.filter(":last");t.target!==a[0]&&t.target!==this.uiDialog[0]||t.shiftKey?t.target!==s[0]&&t.target!==this.uiDialog[0]||!t.shiftKey||(this._delay(function(){a.focus()}),t.preventDefault()):(this._delay(function(){s.focus()}),t.preventDefault())}},mousedown:function(e){this._moveToTop(e)&&this._focusTabbable()}}),this.element.find("[aria-describedby]").length||this.uiDialog.attr({"aria-describedby":this.element.uniqueId().attr("id")})},_createTitlebar:function(){var t;this.uiDialogTitlebar=e("
      ").addClass("ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix").prependTo(this.uiDialog),this._on(this.uiDialogTitlebar,{mousedown:function(t){e(t.target).closest(".ui-dialog-titlebar-close")||this.uiDialog.focus()}}),this.uiDialogTitlebarClose=e("").button({label:this.options.closeText,icons:{primary:"ui-icon-closethick"},text:!1}).addClass("ui-dialog-titlebar-close").appendTo(this.uiDialogTitlebar),this._on(this.uiDialogTitlebarClose,{click:function(e){e.preventDefault(),this.close(e)}}),t=e("").uniqueId().addClass("ui-dialog-title").prependTo(this.uiDialogTitlebar),this._title(t),this.uiDialog.attr({"aria-labelledby":t.attr("id")})},_title:function(e){this.options.title||e.html(" "),e.text(this.options.title)},_createButtonPane:function(){this.uiDialogButtonPane=e("
      ").addClass("ui-dialog-buttonpane ui-widget-content ui-helper-clearfix"),this.uiButtonSet=e("
      ").addClass("ui-dialog-buttonset").appendTo(this.uiDialogButtonPane),this._createButtons()},_createButtons:function(){var t=this,i=this.options.buttons;return this.uiDialogButtonPane.remove(),this.uiButtonSet.empty(),e.isEmptyObject(i)||e.isArray(i)&&!i.length?(this.uiDialog.removeClass("ui-dialog-buttons"),void 0):(e.each(i,function(i,s){var a,n;s=e.isFunction(s)?{click:s,text:i}:s,s=e.extend({type:"button"},s),a=s.click,s.click=function(){a.apply(t.element[0],arguments)},n={icons:s.icons,text:s.showText},delete s.icons,delete s.showText,e("",s).button(n).appendTo(t.uiButtonSet)}),this.uiDialog.addClass("ui-dialog-buttons"),this.uiDialogButtonPane.appendTo(this.uiDialog),void 0)},_makeDraggable:function(){function t(e){return{position:e.position,offset:e.offset}}var i=this,s=this.options;this.uiDialog.draggable({cancel:".ui-dialog-content, .ui-dialog-titlebar-close",handle:".ui-dialog-titlebar",containment:"document",start:function(s,a){e(this).addClass("ui-dialog-dragging"),i._blockFrames(),i._trigger("dragStart",s,t(a))},drag:function(e,s){i._trigger("drag",e,t(s))},stop:function(a,n){var r=n.offset.left-i.document.scrollLeft(),o=n.offset.top-i.document.scrollTop();s.position={my:"left top",at:"left"+(r>=0?"+":"")+r+" "+"top"+(o>=0?"+":"")+o,of:i.window},e(this).removeClass("ui-dialog-dragging"),i._unblockFrames(),i._trigger("dragStop",a,t(n))}})},_makeResizable:function(){function t(e){return{originalPosition:e.originalPosition,originalSize:e.originalSize,position:e.position,size:e.size}}var i=this,s=this.options,a=s.resizable,n=this.uiDialog.css("position"),r="string"==typeof a?a:"n,e,s,w,se,sw,ne,nw";this.uiDialog.resizable({cancel:".ui-dialog-content",containment:"document",alsoResize:this.element,maxWidth:s.maxWidth,maxHeight:s.maxHeight,minWidth:s.minWidth,minHeight:this._minHeight(),handles:r,start:function(s,a){e(this).addClass("ui-dialog-resizing"),i._blockFrames(),i._trigger("resizeStart",s,t(a))},resize:function(e,s){i._trigger("resize",e,t(s))},stop:function(a,n){var r=i.uiDialog.offset(),o=r.left-i.document.scrollLeft(),h=r.top-i.document.scrollTop();s.height=i.uiDialog.height(),s.width=i.uiDialog.width(),s.position={my:"left top",at:"left"+(o>=0?"+":"")+o+" "+"top"+(h>=0?"+":"")+h,of:i.window},e(this).removeClass("ui-dialog-resizing"),i._unblockFrames(),i._trigger("resizeStop",a,t(n))}}).css("position",n)},_trackFocus:function(){this._on(this.widget(),{focusin:function(t){this._untrackInstance(),this._trackingInstances().unshift(this),this._focusedElement=e(t.target)}})},_untrackInstance:function(){var t=this._trackingInstances(),i=e.inArray(this,t);-1!==i&&t.splice(i,1)},_trackingInstances:function(){var e=this.document.data("ui-dialog-instances");return e||(e=[],this.document.data("ui-dialog-instances",e)),e},_minHeight:function(){var e=this.options;return"auto"===e.height?e.minHeight:Math.min(e.minHeight,e.height)},_position:function(){var e=this.uiDialog.is(":visible");e||this.uiDialog.show(),this.uiDialog.position(this.options.position),e||this.uiDialog.hide()},_setOptions:function(t){var i=this,s=!1,a={};e.each(t,function(e,t){i._setOption(e,t),e in i.sizeRelatedOptions&&(s=!0),e in i.resizableRelatedOptions&&(a[e]=t)}),s&&(this._size(),this._position()),this.uiDialog.is(":data(ui-resizable)")&&this.uiDialog.resizable("option",a)},_setOption:function(e,t){var i,s,a=this.uiDialog;"dialogClass"===e&&a.removeClass(this.options.dialogClass).addClass(t),"disabled"!==e&&(this._super(e,t),"appendTo"===e&&this.uiDialog.appendTo(this._appendTo()),"buttons"===e&&this._createButtons(),"closeText"===e&&this.uiDialogTitlebarClose.button({label:""+t}),"draggable"===e&&(i=a.is(":data(ui-draggable)"),i&&!t&&a.draggable("destroy"),!i&&t&&this._makeDraggable()),"position"===e&&this._position(),"resizable"===e&&(s=a.is(":data(ui-resizable)"),s&&!t&&a.resizable("destroy"),s&&"string"==typeof t&&a.resizable("option","handles",t),s||t===!1||this._makeResizable()),"title"===e&&this._title(this.uiDialogTitlebar.find(".ui-dialog-title")))},_size:function(){var e,t,i,s=this.options;this.element.show().css({width:"auto",minHeight:0,maxHeight:"none",height:0}),s.minWidth>s.width&&(s.width=s.minWidth),e=this.uiDialog.css({height:"auto",width:s.width}).outerHeight(),t=Math.max(0,s.minHeight-e),i="number"==typeof s.maxHeight?Math.max(0,s.maxHeight-e):"none","auto"===s.height?this.element.css({minHeight:t,maxHeight:i,height:"auto"}):this.element.height(Math.max(0,s.height-e)),this.uiDialog.is(":data(ui-resizable)")&&this.uiDialog.resizable("option","minHeight",this._minHeight())},_blockFrames:function(){this.iframeBlocks=this.document.find("iframe").map(function(){var t=e(this);return e("
      ").css({position:"absolute",width:t.outerWidth(),height:t.outerHeight()}).appendTo(t.parent()).offset(t.offset())[0]})},_unblockFrames:function(){this.iframeBlocks&&(this.iframeBlocks.remove(),delete this.iframeBlocks)},_allowInteraction:function(t){return e(t.target).closest(".ui-dialog").length?!0:!!e(t.target).closest(".ui-datepicker").length},_createOverlay:function(){if(this.options.modal){var t=!0;this._delay(function(){t=!1}),this.document.data("ui-dialog-overlays")||this._on(this.document,{focusin:function(e){t||this._allowInteraction(e)||(e.preventDefault(),this._trackingInstances()[0]._focusTabbable())}}),this.overlay=e("
      ").addClass("ui-widget-overlay ui-front").appendTo(this._appendTo()),this._on(this.overlay,{mousedown:"_keepFocus"}),this.document.data("ui-dialog-overlays",(this.document.data("ui-dialog-overlays")||0)+1)}},_destroyOverlay:function(){if(this.options.modal&&this.overlay){var e=this.document.data("ui-dialog-overlays")-1;e?this.document.data("ui-dialog-overlays",e):this.document.unbind("focusin").removeData("ui-dialog-overlays"),this.overlay.remove(),this.overlay=null}}}),e.widget("ui.progressbar",{version:"1.11.0",options:{max:100,value:0,change:null,complete:null},min:0,_create:function(){this.oldValue=this.options.value=this._constrainedValue(),this.element.addClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").attr({role:"progressbar","aria-valuemin":this.min}),this.valueDiv=e("
      ").appendTo(this.element),this._refreshValue()},_destroy:function(){this.element.removeClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").removeAttr("role").removeAttr("aria-valuemin").removeAttr("aria-valuemax").removeAttr("aria-valuenow"),this.valueDiv.remove()},value:function(e){return void 0===e?this.options.value:(this.options.value=this._constrainedValue(e),this._refreshValue(),void 0)},_constrainedValue:function(e){return void 0===e&&(e=this.options.value),this.indeterminate=e===!1,"number"!=typeof e&&(e=0),this.indeterminate?!1:Math.min(this.options.max,Math.max(this.min,e))},_setOptions:function(e){var t=e.value;delete e.value,this._super(e),this.options.value=this._constrainedValue(t),this._refreshValue()},_setOption:function(e,t){"max"===e&&(t=Math.max(this.min,t)),"disabled"===e&&this.element.toggleClass("ui-state-disabled",!!t).attr("aria-disabled",t),this._super(e,t)},_percentage:function(){return this.indeterminate?100:100*(this.options.value-this.min)/(this.options.max-this.min)},_refreshValue:function(){var t=this.options.value,i=this._percentage();this.valueDiv.toggle(this.indeterminate||t>this.min).toggleClass("ui-corner-right",t===this.options.max).width(i.toFixed(0)+"%"),this.element.toggleClass("ui-progressbar-indeterminate",this.indeterminate),this.indeterminate?(this.element.removeAttr("aria-valuenow"),this.overlayDiv||(this.overlayDiv=e("
      ").appendTo(this.valueDiv))):(this.element.attr({"aria-valuemax":this.options.max,"aria-valuenow":t}),this.overlayDiv&&(this.overlayDiv.remove(),this.overlayDiv=null)),this.oldValue!==t&&(this.oldValue=t,this._trigger("change")),t===this.options.max&&this._trigger("complete")}}),e.widget("ui.selectmenu",{version:"1.11.0",defaultElement:"",widgetEventPrefix:"spin",options:{culture:null,icons:{down:"ui-icon-triangle-1-s",up:"ui-icon-triangle-1-n"},incremental:!0,max:null,min:null,numberFormat:null,page:10,step:1,change:null,spin:null,start:null,stop:null},_create:function(){this._setOption("max",this.options.max),this._setOption("min",this.options.min),this._setOption("step",this.options.step),""!==this.value()&&this._value(this.element.val(),!0),this._draw(),this._on(this._events),this._refresh(),this._on(this.window,{beforeunload:function(){this.element.removeAttr("autocomplete")}})},_getCreateOptions:function(){var t={},i=this.element;return e.each(["min","max","step"],function(e,s){var a=i.attr(s);void 0!==a&&a.length&&(t[s]=a)}),t},_events:{keydown:function(e){this._start(e)&&this._keydown(e)&&e.preventDefault()},keyup:"_stop",focus:function(){this.previous=this.element.val()},blur:function(e){return this.cancelBlur?(delete this.cancelBlur,void 0):(this._stop(),this._refresh(),this.previous!==this.element.val()&&this._trigger("change",e),void 0)},mousewheel:function(e,t){if(t){if(!this.spinning&&!this._start(e))return!1;this._spin((t>0?1:-1)*this.options.step,e),clearTimeout(this.mousewheelTimer),this.mousewheelTimer=this._delay(function(){this.spinning&&this._stop(e)},100),e.preventDefault()}},"mousedown .ui-spinner-button":function(t){function i(){var e=this.element[0]===this.document[0].activeElement;e||(this.element.focus(),this.previous=s,this._delay(function(){this.previous=s}))}var s;s=this.element[0]===this.document[0].activeElement?this.previous:this.element.val(),t.preventDefault(),i.call(this),this.cancelBlur=!0,this._delay(function(){delete this.cancelBlur,i.call(this)}),this._start(t)!==!1&&this._repeat(null,e(t.currentTarget).hasClass("ui-spinner-up")?1:-1,t)},"mouseup .ui-spinner-button":"_stop","mouseenter .ui-spinner-button":function(t){return e(t.currentTarget).hasClass("ui-state-active")?this._start(t)===!1?!1:(this._repeat(null,e(t.currentTarget).hasClass("ui-spinner-up")?1:-1,t),void 0):void 0},"mouseleave .ui-spinner-button":"_stop"},_draw:function(){var e=this.uiSpinner=this.element.addClass("ui-spinner-input").attr("autocomplete","off").wrap(this._uiSpinnerHtml()).parent().append(this._buttonHtml());this.element.attr("role","spinbutton"),this.buttons=e.find(".ui-spinner-button").attr("tabIndex",-1).button().removeClass("ui-corner-all"),this.buttons.height()>Math.ceil(.5*e.height())&&e.height()>0&&e.height(e.height()),this.options.disabled&&this.disable()},_keydown:function(t){var i=this.options,s=e.ui.keyCode;switch(t.keyCode){case s.UP:return this._repeat(null,1,t),!0;case s.DOWN:return this._repeat(null,-1,t),!0;case s.PAGE_UP:return this._repeat(null,i.page,t),!0;case s.PAGE_DOWN:return this._repeat(null,-i.page,t),!0}return!1},_uiSpinnerHtml:function(){return""},_buttonHtml:function(){return""+""+""+""+""},_start:function(e){return this.spinning||this._trigger("start",e)!==!1?(this.counter||(this.counter=1),this.spinning=!0,!0):!1},_repeat:function(e,t,i){e=e||500,clearTimeout(this.timer),this.timer=this._delay(function(){this._repeat(40,t,i)},e),this._spin(t*this.options.step,i)},_spin:function(e,t){var i=this.value()||0;this.counter||(this.counter=1),i=this._adjustValue(i+e*this._increment(this.counter)),this.spinning&&this._trigger("spin",t,{value:i})===!1||(this._value(i),this.counter++)},_increment:function(t){var i=this.options.incremental;return i?e.isFunction(i)?i(t):Math.floor(t*t*t/5e4-t*t/500+17*t/200+1):1},_precision:function(){var e=this._precisionOf(this.options.step);return null!==this.options.min&&(e=Math.max(e,this._precisionOf(this.options.min))),e},_precisionOf:function(e){var t=""+e,i=t.indexOf(".");return-1===i?0:t.length-i-1},_adjustValue:function(e){var t,i,s=this.options;return t=null!==s.min?s.min:0,i=e-t,i=Math.round(i/s.step)*s.step,e=t+i,e=parseFloat(e.toFixed(this._precision())),null!==s.max&&e>s.max?s.max:null!==s.min&&s.min>e?s.min:e +},_stop:function(e){this.spinning&&(clearTimeout(this.timer),clearTimeout(this.mousewheelTimer),this.counter=0,this.spinning=!1,this._trigger("stop",e))},_setOption:function(e,t){if("culture"===e||"numberFormat"===e){var i=this._parse(this.element.val());return this.options[e]=t,this.element.val(this._format(i)),void 0}("max"===e||"min"===e||"step"===e)&&"string"==typeof t&&(t=this._parse(t)),"icons"===e&&(this.buttons.first().find(".ui-icon").removeClass(this.options.icons.up).addClass(t.up),this.buttons.last().find(".ui-icon").removeClass(this.options.icons.down).addClass(t.down)),this._super(e,t),"disabled"===e&&(this.widget().toggleClass("ui-state-disabled",!!t),this.element.prop("disabled",!!t),this.buttons.button(t?"disable":"enable"))},_setOptions:o(function(e){this._super(e)}),_parse:function(e){return"string"==typeof e&&""!==e&&(e=window.Globalize&&this.options.numberFormat?Globalize.parseFloat(e,10,this.options.culture):+e),""===e||isNaN(e)?null:e},_format:function(e){return""===e?"":window.Globalize&&this.options.numberFormat?Globalize.format(e,this.options.numberFormat,this.options.culture):e},_refresh:function(){this.element.attr({"aria-valuemin":this.options.min,"aria-valuemax":this.options.max,"aria-valuenow":this._parse(this.element.val())})},isValid:function(){var e=this.value();return null===e?!1:e===this._adjustValue(e)},_value:function(e,t){var i;""!==e&&(i=this._parse(e),null!==i&&(t||(i=this._adjustValue(i)),e=this._format(i))),this.element.val(e),this._refresh()},_destroy:function(){this.element.removeClass("ui-spinner-input").prop("disabled",!1).removeAttr("autocomplete").removeAttr("role").removeAttr("aria-valuemin").removeAttr("aria-valuemax").removeAttr("aria-valuenow"),this.uiSpinner.replaceWith(this.element)},stepUp:o(function(e){this._stepUp(e)}),_stepUp:function(e){this._start()&&(this._spin((e||1)*this.options.step),this._stop())},stepDown:o(function(e){this._stepDown(e)}),_stepDown:function(e){this._start()&&(this._spin((e||1)*-this.options.step),this._stop())},pageUp:o(function(e){this._stepUp((e||1)*this.options.page)}),pageDown:o(function(e){this._stepDown((e||1)*this.options.page)}),value:function(e){return arguments.length?(o(this._value).call(this,e),void 0):this._parse(this.element.val())},widget:function(){return this.uiSpinner}}),e.widget("ui.tabs",{version:"1.11.0",delay:300,options:{active:null,collapsible:!1,event:"click",heightStyle:"content",hide:null,show:null,activate:null,beforeActivate:null,beforeLoad:null,load:null},_isLocal:function(){var e=/#.*$/;return function(t){var i,s;t=t.cloneNode(!1),i=t.href.replace(e,""),s=location.href.replace(e,"");try{i=decodeURIComponent(i)}catch(a){}try{s=decodeURIComponent(s)}catch(a){}return t.hash.length>1&&i===s}}(),_create:function(){var t=this,i=this.options;this.running=!1,this.element.addClass("ui-tabs ui-widget ui-widget-content ui-corner-all").toggleClass("ui-tabs-collapsible",i.collapsible).delegate(".ui-tabs-nav > li","mousedown"+this.eventNamespace,function(t){e(this).is(".ui-state-disabled")&&t.preventDefault()}).delegate(".ui-tabs-anchor","focus"+this.eventNamespace,function(){e(this).closest("li").is(".ui-state-disabled")&&this.blur()}),this._processTabs(),i.active=this._initialActive(),e.isArray(i.disabled)&&(i.disabled=e.unique(i.disabled.concat(e.map(this.tabs.filter(".ui-state-disabled"),function(e){return t.tabs.index(e)}))).sort()),this.active=this.options.active!==!1&&this.anchors.length?this._findActive(i.active):e(),this._refresh(),this.active.length&&this.load(i.active)},_initialActive:function(){var t=this.options.active,i=this.options.collapsible,s=location.hash.substring(1);return null===t&&(s&&this.tabs.each(function(i,a){return e(a).attr("aria-controls")===s?(t=i,!1):void 0}),null===t&&(t=this.tabs.index(this.tabs.filter(".ui-tabs-active"))),(null===t||-1===t)&&(t=this.tabs.length?0:!1)),t!==!1&&(t=this.tabs.index(this.tabs.eq(t)),-1===t&&(t=i?!1:0)),!i&&t===!1&&this.anchors.length&&(t=0),t},_getCreateEventData:function(){return{tab:this.active,panel:this.active.length?this._getPanelForTab(this.active):e()}},_tabKeydown:function(t){var i=e(this.document[0].activeElement).closest("li"),s=this.tabs.index(i),a=!0;if(!this._handlePageNav(t)){switch(t.keyCode){case e.ui.keyCode.RIGHT:case e.ui.keyCode.DOWN:s++;break;case e.ui.keyCode.UP:case e.ui.keyCode.LEFT:a=!1,s--;break;case e.ui.keyCode.END:s=this.anchors.length-1;break;case e.ui.keyCode.HOME:s=0;break;case e.ui.keyCode.SPACE:return t.preventDefault(),clearTimeout(this.activating),this._activate(s),void 0;case e.ui.keyCode.ENTER:return t.preventDefault(),clearTimeout(this.activating),this._activate(s===this.options.active?!1:s),void 0;default:return}t.preventDefault(),clearTimeout(this.activating),s=this._focusNextTab(s,a),t.ctrlKey||(i.attr("aria-selected","false"),this.tabs.eq(s).attr("aria-selected","true"),this.activating=this._delay(function(){this.option("active",s)},this.delay))}},_panelKeydown:function(t){this._handlePageNav(t)||t.ctrlKey&&t.keyCode===e.ui.keyCode.UP&&(t.preventDefault(),this.active.focus())},_handlePageNav:function(t){return t.altKey&&t.keyCode===e.ui.keyCode.PAGE_UP?(this._activate(this._focusNextTab(this.options.active-1,!1)),!0):t.altKey&&t.keyCode===e.ui.keyCode.PAGE_DOWN?(this._activate(this._focusNextTab(this.options.active+1,!0)),!0):void 0},_findNextTab:function(t,i){function s(){return t>a&&(t=0),0>t&&(t=a),t}for(var a=this.tabs.length-1;-1!==e.inArray(s(),this.options.disabled);)t=i?t+1:t-1;return t},_focusNextTab:function(e,t){return e=this._findNextTab(e,t),this.tabs.eq(e).focus(),e},_setOption:function(e,t){return"active"===e?(this._activate(t),void 0):"disabled"===e?(this._setupDisabled(t),void 0):(this._super(e,t),"collapsible"===e&&(this.element.toggleClass("ui-tabs-collapsible",t),t||this.options.active!==!1||this._activate(0)),"event"===e&&this._setupEvents(t),"heightStyle"===e&&this._setupHeightStyle(t),void 0)},_sanitizeSelector:function(e){return e?e.replace(/[!"$%&'()*+,.\/:;<=>?@\[\]\^`{|}~]/g,"\\$&"):""},refresh:function(){var t=this.options,i=this.tablist.children(":has(a[href])");t.disabled=e.map(i.filter(".ui-state-disabled"),function(e){return i.index(e)}),this._processTabs(),t.active!==!1&&this.anchors.length?this.active.length&&!e.contains(this.tablist[0],this.active[0])?this.tabs.length===t.disabled.length?(t.active=!1,this.active=e()):this._activate(this._findNextTab(Math.max(0,t.active-1),!1)):t.active=this.tabs.index(this.active):(t.active=!1,this.active=e()),this._refresh()},_refresh:function(){this._setupDisabled(this.options.disabled),this._setupEvents(this.options.event),this._setupHeightStyle(this.options.heightStyle),this.tabs.not(this.active).attr({"aria-selected":"false","aria-expanded":"false",tabIndex:-1}),this.panels.not(this._getPanelForTab(this.active)).hide().attr({"aria-hidden":"true"}),this.active.length?(this.active.addClass("ui-tabs-active ui-state-active").attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0}),this._getPanelForTab(this.active).show().attr({"aria-hidden":"false"})):this.tabs.eq(0).attr("tabIndex",0)},_processTabs:function(){var t=this;this.tablist=this._getList().addClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all").attr("role","tablist"),this.tabs=this.tablist.find("> li:has(a[href])").addClass("ui-state-default ui-corner-top").attr({role:"tab",tabIndex:-1}),this.anchors=this.tabs.map(function(){return e("a",this)[0]}).addClass("ui-tabs-anchor").attr({role:"presentation",tabIndex:-1}),this.panels=e(),this.anchors.each(function(i,s){var a,n,r,o=e(s).uniqueId().attr("id"),h=e(s).closest("li"),l=h.attr("aria-controls");t._isLocal(s)?(a=s.hash,r=a.substring(1),n=t.element.find(t._sanitizeSelector(a))):(r=h.attr("aria-controls")||e({}).uniqueId()[0].id,a="#"+r,n=t.element.find(a),n.length||(n=t._createPanel(r),n.insertAfter(t.panels[i-1]||t.tablist)),n.attr("aria-live","polite")),n.length&&(t.panels=t.panels.add(n)),l&&h.data("ui-tabs-aria-controls",l),h.attr({"aria-controls":r,"aria-labelledby":o}),n.attr("aria-labelledby",o)}),this.panels.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").attr("role","tabpanel")},_getList:function(){return this.tablist||this.element.find("ol,ul").eq(0)},_createPanel:function(t){return e("
      ").attr("id",t).addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").data("ui-tabs-destroy",!0)},_setupDisabled:function(t){e.isArray(t)&&(t.length?t.length===this.anchors.length&&(t=!0):t=!1);for(var i,s=0;i=this.tabs[s];s++)t===!0||-1!==e.inArray(s,t)?e(i).addClass("ui-state-disabled").attr("aria-disabled","true"):e(i).removeClass("ui-state-disabled").removeAttr("aria-disabled");this.options.disabled=t},_setupEvents:function(t){var i={};t&&e.each(t.split(" "),function(e,t){i[t]="_eventHandler"}),this._off(this.anchors.add(this.tabs).add(this.panels)),this._on(!0,this.anchors,{click:function(e){e.preventDefault()}}),this._on(this.anchors,i),this._on(this.tabs,{keydown:"_tabKeydown"}),this._on(this.panels,{keydown:"_panelKeydown"}),this._focusable(this.tabs),this._hoverable(this.tabs)},_setupHeightStyle:function(t){var i,s=this.element.parent();"fill"===t?(i=s.height(),i-=this.element.outerHeight()-this.element.height(),this.element.siblings(":visible").each(function(){var t=e(this),s=t.css("position");"absolute"!==s&&"fixed"!==s&&(i-=t.outerHeight(!0))}),this.element.children().not(this.panels).each(function(){i-=e(this).outerHeight(!0)}),this.panels.each(function(){e(this).height(Math.max(0,i-e(this).innerHeight()+e(this).height()))}).css("overflow","auto")):"auto"===t&&(i=0,this.panels.each(function(){i=Math.max(i,e(this).height("").height())}).height(i))},_eventHandler:function(t){var i=this.options,s=this.active,a=e(t.currentTarget),n=a.closest("li"),r=n[0]===s[0],o=r&&i.collapsible,h=o?e():this._getPanelForTab(n),l=s.length?this._getPanelForTab(s):e(),u={oldTab:s,oldPanel:l,newTab:o?e():n,newPanel:h};t.preventDefault(),n.hasClass("ui-state-disabled")||n.hasClass("ui-tabs-loading")||this.running||r&&!i.collapsible||this._trigger("beforeActivate",t,u)===!1||(i.active=o?!1:this.tabs.index(n),this.active=r?e():n,this.xhr&&this.xhr.abort(),l.length||h.length||e.error("jQuery UI Tabs: Mismatching fragment identifier."),h.length&&this.load(this.tabs.index(n),t),this._toggle(t,u))},_toggle:function(t,i){function s(){n.running=!1,n._trigger("activate",t,i)}function a(){i.newTab.closest("li").addClass("ui-tabs-active ui-state-active"),r.length&&n.options.show?n._show(r,n.options.show,s):(r.show(),s())}var n=this,r=i.newPanel,o=i.oldPanel;this.running=!0,o.length&&this.options.hide?this._hide(o,this.options.hide,function(){i.oldTab.closest("li").removeClass("ui-tabs-active ui-state-active"),a()}):(i.oldTab.closest("li").removeClass("ui-tabs-active ui-state-active"),o.hide(),a()),o.attr("aria-hidden","true"),i.oldTab.attr({"aria-selected":"false","aria-expanded":"false"}),r.length&&o.length?i.oldTab.attr("tabIndex",-1):r.length&&this.tabs.filter(function(){return 0===e(this).attr("tabIndex")}).attr("tabIndex",-1),r.attr("aria-hidden","false"),i.newTab.attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0})},_activate:function(t){var i,s=this._findActive(t);s[0]!==this.active[0]&&(s.length||(s=this.active),i=s.find(".ui-tabs-anchor")[0],this._eventHandler({target:i,currentTarget:i,preventDefault:e.noop}))},_findActive:function(t){return t===!1?e():this.tabs.eq(t)},_getIndex:function(e){return"string"==typeof e&&(e=this.anchors.index(this.anchors.filter("[href$='"+e+"']"))),e},_destroy:function(){this.xhr&&this.xhr.abort(),this.element.removeClass("ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible"),this.tablist.removeClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all").removeAttr("role"),this.anchors.removeClass("ui-tabs-anchor").removeAttr("role").removeAttr("tabIndex").removeUniqueId(),this.tabs.add(this.panels).each(function(){e.data(this,"ui-tabs-destroy")?e(this).remove():e(this).removeClass("ui-state-default ui-state-active ui-state-disabled ui-corner-top ui-corner-bottom ui-widget-content ui-tabs-active ui-tabs-panel").removeAttr("tabIndex").removeAttr("aria-live").removeAttr("aria-busy").removeAttr("aria-selected").removeAttr("aria-labelledby").removeAttr("aria-hidden").removeAttr("aria-expanded").removeAttr("role")}),this.tabs.each(function(){var t=e(this),i=t.data("ui-tabs-aria-controls");i?t.attr("aria-controls",i).removeData("ui-tabs-aria-controls"):t.removeAttr("aria-controls")}),this.panels.show(),"content"!==this.options.heightStyle&&this.panels.css("height","")},enable:function(t){var i=this.options.disabled;i!==!1&&(void 0===t?i=!1:(t=this._getIndex(t),i=e.isArray(i)?e.map(i,function(e){return e!==t?e:null}):e.map(this.tabs,function(e,i){return i!==t?i:null})),this._setupDisabled(i))},disable:function(t){var i=this.options.disabled;if(i!==!0){if(void 0===t)i=!0;else{if(t=this._getIndex(t),-1!==e.inArray(t,i))return;i=e.isArray(i)?e.merge([t],i).sort():[t]}this._setupDisabled(i)}},load:function(t,i){t=this._getIndex(t);var s=this,a=this.tabs.eq(t),n=a.find(".ui-tabs-anchor"),r=this._getPanelForTab(a),o={tab:a,panel:r};this._isLocal(n[0])||(this.xhr=e.ajax(this._ajaxSettings(n,i,o)),this.xhr&&"canceled"!==this.xhr.statusText&&(a.addClass("ui-tabs-loading"),r.attr("aria-busy","true"),this.xhr.success(function(e){setTimeout(function(){r.html(e),s._trigger("load",i,o)},1)}).complete(function(e,t){setTimeout(function(){"abort"===t&&s.panels.stop(!1,!0),a.removeClass("ui-tabs-loading"),r.removeAttr("aria-busy"),e===s.xhr&&delete s.xhr},1)})))},_ajaxSettings:function(t,i,s){var a=this;return{url:t.attr("href"),beforeSend:function(t,n){return a._trigger("beforeLoad",i,e.extend({jqXHR:t,ajaxSettings:n},s))}}},_getPanelForTab:function(t){var i=e(t).attr("aria-controls");return this.element.find(this._sanitizeSelector("#"+i))}}),e.widget("ui.tooltip",{version:"1.11.0",options:{content:function(){var t=e(this).attr("title")||"";return e("").text(t).html()},hide:!0,items:"[title]:not([disabled])",position:{my:"left top+15",at:"left bottom",collision:"flipfit flip"},show:!0,tooltipClass:null,track:!1,close:null,open:null},_addDescribedBy:function(t,i){var s=(t.attr("aria-describedby")||"").split(/\s+/);s.push(i),t.data("ui-tooltip-id",i).attr("aria-describedby",e.trim(s.join(" ")))},_removeDescribedBy:function(t){var i=t.data("ui-tooltip-id"),s=(t.attr("aria-describedby")||"").split(/\s+/),a=e.inArray(i,s);-1!==a&&s.splice(a,1),t.removeData("ui-tooltip-id"),s=e.trim(s.join(" ")),s?t.attr("aria-describedby",s):t.removeAttr("aria-describedby")},_create:function(){this._on({mouseover:"open",focusin:"open"}),this.tooltips={},this.parents={},this.options.disabled&&this._disable(),this.liveRegion=e("
      ").attr({role:"log","aria-live":"assertive","aria-relevant":"additions"}).addClass("ui-helper-hidden-accessible").appendTo(this.document[0].body)},_setOption:function(t,i){var s=this;return"disabled"===t?(this[i?"_disable":"_enable"](),this.options[t]=i,void 0):(this._super(t,i),"content"===t&&e.each(this.tooltips,function(e,t){s._updateContent(t)}),void 0)},_disable:function(){var t=this;e.each(this.tooltips,function(i,s){var a=e.Event("blur");a.target=a.currentTarget=s[0],t.close(a,!0)}),this.element.find(this.options.items).addBack().each(function(){var t=e(this);t.is("[title]")&&t.data("ui-tooltip-title",t.attr("title")).removeAttr("title")})},_enable:function(){this.element.find(this.options.items).addBack().each(function(){var t=e(this);t.data("ui-tooltip-title")&&t.attr("title",t.data("ui-tooltip-title"))})},open:function(t){var i=this,s=e(t?t.target:this.element).closest(this.options.items);s.length&&!s.data("ui-tooltip-id")&&(s.attr("title")&&s.data("ui-tooltip-title",s.attr("title")),s.data("ui-tooltip-open",!0),t&&"mouseover"===t.type&&s.parents().each(function(){var t,s=e(this);s.data("ui-tooltip-open")&&(t=e.Event("blur"),t.target=t.currentTarget=this,i.close(t,!0)),s.attr("title")&&(s.uniqueId(),i.parents[this.id]={element:this,title:s.attr("title")},s.attr("title",""))}),this._updateContent(s,t))},_updateContent:function(e,t){var i,s=this.options.content,a=this,n=t?t.type:null;return"string"==typeof s?this._open(t,e,s):(i=s.call(e[0],function(i){e.data("ui-tooltip-open")&&a._delay(function(){t&&(t.type=n),this._open(t,e,i)})}),i&&this._open(t,e,i),void 0)},_open:function(t,i,s){function a(e){l.of=e,n.is(":hidden")||n.position(l)}var n,r,o,h,l=e.extend({},this.options.position);if(s){if(n=this._find(i),n.length)return n.find(".ui-tooltip-content").html(s),void 0;i.is("[title]")&&(t&&"mouseover"===t.type?i.attr("title",""):i.removeAttr("title")),n=this._tooltip(i),this._addDescribedBy(i,n.attr("id")),n.find(".ui-tooltip-content").html(s),this.liveRegion.children().hide(),s.clone?(h=s.clone(),h.removeAttr("id").find("[id]").removeAttr("id")):h=s,e("
      ").html(h).appendTo(this.liveRegion),this.options.track&&t&&/^mouse/.test(t.type)?(this._on(this.document,{mousemove:a}),a(t)):n.position(e.extend({of:i},this.options.position)),n.hide(),this._show(n,this.options.show),this.options.show&&this.options.show.delay&&(o=this.delayedShow=setInterval(function(){n.is(":visible")&&(a(l.of),clearInterval(o))},e.fx.interval)),this._trigger("open",t,{tooltip:n}),r={keyup:function(t){if(t.keyCode===e.ui.keyCode.ESCAPE){var s=e.Event(t);s.currentTarget=i[0],this.close(s,!0)}}},i[0]!==this.element[0]&&(r.remove=function(){this._removeTooltip(n)}),t&&"mouseover"!==t.type||(r.mouseleave="close"),t&&"focusin"!==t.type||(r.focusout="close"),this._on(!0,i,r)}},close:function(t){var i=this,s=e(t?t.currentTarget:this.element),a=this._find(s);this.closing||(clearInterval(this.delayedShow),s.data("ui-tooltip-title")&&!s.attr("title")&&s.attr("title",s.data("ui-tooltip-title")),this._removeDescribedBy(s),a.stop(!0),this._hide(a,this.options.hide,function(){i._removeTooltip(e(this))}),s.removeData("ui-tooltip-open"),this._off(s,"mouseleave focusout keyup"),s[0]!==this.element[0]&&this._off(s,"remove"),this._off(this.document,"mousemove"),t&&"mouseleave"===t.type&&e.each(this.parents,function(t,s){e(s.element).attr("title",s.title),delete i.parents[t]}),this.closing=!0,this._trigger("close",t,{tooltip:a}),this.closing=!1)},_tooltip:function(t){var i=e("
      ").attr("role","tooltip").addClass("ui-tooltip ui-widget ui-corner-all ui-widget-content "+(this.options.tooltipClass||"")),s=i.uniqueId().attr("id");return e("
      ").addClass("ui-tooltip-content").appendTo(i),i.appendTo(this.document[0].body),this.tooltips[s]=t,i},_find:function(t){var i=t.data("ui-tooltip-id");return i?e("#"+i):e()},_removeTooltip:function(e){e.remove(),delete this.tooltips[e.attr("id")]},_destroy:function(){var t=this;e.each(this.tooltips,function(i,s){var a=e.Event("blur");a.target=a.currentTarget=s[0],t.close(a,!0),e("#"+i).remove(),s.data("ui-tooltip-title")&&(s.attr("title")||s.attr("title",s.data("ui-tooltip-title")),s.removeData("ui-tooltip-title"))}),this.liveRegion.remove()}});var v="ui-effects-";e.effects={effect:{}},function(e,t){function i(e,t,i){var s=d[t.type]||{};return null==e?i||!t.def?null:t.def:(e=s.floor?~~e:parseFloat(e),isNaN(e)?t.def:s.mod?(e+s.mod)%s.mod:0>e?0:e>s.max?s.max:e)}function s(i){var s=l(),a=s._rgba=[];return i=i.toLowerCase(),f(h,function(e,n){var r,o=n.re.exec(i),h=o&&n.parse(o),l=n.space||"rgba";return h?(r=s[l](h),s[u[l].cache]=r[u[l].cache],a=s._rgba=r._rgba,!1):t}),a.length?("0,0,0,0"===a.join()&&e.extend(a,n.transparent),s):n[i]}function a(e,t,i){return i=(i+1)%1,1>6*i?e+6*(t-e)*i:1>2*i?t:2>3*i?e+6*(t-e)*(2/3-i):e}var n,r="backgroundColor borderBottomColor borderLeftColor borderRightColor borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor",o=/^([\-+])=\s*(\d+\.?\d*)/,h=[{re:/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,parse:function(e){return[e[1],e[2],e[3],e[4]]}},{re:/rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,parse:function(e){return[2.55*e[1],2.55*e[2],2.55*e[3],e[4]]}},{re:/#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})/,parse:function(e){return[parseInt(e[1],16),parseInt(e[2],16),parseInt(e[3],16)]}},{re:/#([a-f0-9])([a-f0-9])([a-f0-9])/,parse:function(e){return[parseInt(e[1]+e[1],16),parseInt(e[2]+e[2],16),parseInt(e[3]+e[3],16)]}},{re:/hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,space:"hsla",parse:function(e){return[e[1],e[2]/100,e[3]/100,e[4]]}}],l=e.Color=function(t,i,s,a){return new e.Color.fn.parse(t,i,s,a)},u={rgba:{props:{red:{idx:0,type:"byte"},green:{idx:1,type:"byte"},blue:{idx:2,type:"byte"}}},hsla:{props:{hue:{idx:0,type:"degrees"},saturation:{idx:1,type:"percent"},lightness:{idx:2,type:"percent"}}}},d={"byte":{floor:!0,max:255},percent:{max:1},degrees:{mod:360,floor:!0}},c=l.support={},p=e("

      ")[0],f=e.each;p.style.cssText="background-color:rgba(1,1,1,.5)",c.rgba=p.style.backgroundColor.indexOf("rgba")>-1,f(u,function(e,t){t.cache="_"+e,t.props.alpha={idx:3,type:"percent",def:1}}),l.fn=e.extend(l.prototype,{parse:function(a,r,o,h){if(a===t)return this._rgba=[null,null,null,null],this;(a.jquery||a.nodeType)&&(a=e(a).css(r),r=t);var d=this,c=e.type(a),p=this._rgba=[];return r!==t&&(a=[a,r,o,h],c="array"),"string"===c?this.parse(s(a)||n._default):"array"===c?(f(u.rgba.props,function(e,t){p[t.idx]=i(a[t.idx],t)}),this):"object"===c?(a instanceof l?f(u,function(e,t){a[t.cache]&&(d[t.cache]=a[t.cache].slice())}):f(u,function(t,s){var n=s.cache;f(s.props,function(e,t){if(!d[n]&&s.to){if("alpha"===e||null==a[e])return;d[n]=s.to(d._rgba)}d[n][t.idx]=i(a[e],t,!0)}),d[n]&&0>e.inArray(null,d[n].slice(0,3))&&(d[n][3]=1,s.from&&(d._rgba=s.from(d[n])))}),this):t},is:function(e){var i=l(e),s=!0,a=this;return f(u,function(e,n){var r,o=i[n.cache];return o&&(r=a[n.cache]||n.to&&n.to(a._rgba)||[],f(n.props,function(e,i){return null!=o[i.idx]?s=o[i.idx]===r[i.idx]:t})),s}),s},_space:function(){var e=[],t=this;return f(u,function(i,s){t[s.cache]&&e.push(i)}),e.pop()},transition:function(e,t){var s=l(e),a=s._space(),n=u[a],r=0===this.alpha()?l("transparent"):this,o=r[n.cache]||n.to(r._rgba),h=o.slice();return s=s[n.cache],f(n.props,function(e,a){var n=a.idx,r=o[n],l=s[n],u=d[a.type]||{};null!==l&&(null===r?h[n]=l:(u.mod&&(l-r>u.mod/2?r+=u.mod:r-l>u.mod/2&&(r-=u.mod)),h[n]=i((l-r)*t+r,a)))}),this[a](h)},blend:function(t){if(1===this._rgba[3])return this;var i=this._rgba.slice(),s=i.pop(),a=l(t)._rgba;return l(e.map(i,function(e,t){return(1-s)*a[t]+s*e}))},toRgbaString:function(){var t="rgba(",i=e.map(this._rgba,function(e,t){return null==e?t>2?1:0:e});return 1===i[3]&&(i.pop(),t="rgb("),t+i.join()+")"},toHslaString:function(){var t="hsla(",i=e.map(this.hsla(),function(e,t){return null==e&&(e=t>2?1:0),t&&3>t&&(e=Math.round(100*e)+"%"),e});return 1===i[3]&&(i.pop(),t="hsl("),t+i.join()+")"},toHexString:function(t){var i=this._rgba.slice(),s=i.pop();return t&&i.push(~~(255*s)),"#"+e.map(i,function(e){return e=(e||0).toString(16),1===e.length?"0"+e:e}).join("")},toString:function(){return 0===this._rgba[3]?"transparent":this.toRgbaString()}}),l.fn.parse.prototype=l.fn,u.hsla.to=function(e){if(null==e[0]||null==e[1]||null==e[2])return[null,null,null,e[3]];var t,i,s=e[0]/255,a=e[1]/255,n=e[2]/255,r=e[3],o=Math.max(s,a,n),h=Math.min(s,a,n),l=o-h,u=o+h,d=.5*u;return t=h===o?0:s===o?60*(a-n)/l+360:a===o?60*(n-s)/l+120:60*(s-a)/l+240,i=0===l?0:.5>=d?l/u:l/(2-u),[Math.round(t)%360,i,d,null==r?1:r]},u.hsla.from=function(e){if(null==e[0]||null==e[1]||null==e[2])return[null,null,null,e[3]];var t=e[0]/360,i=e[1],s=e[2],n=e[3],r=.5>=s?s*(1+i):s+i-s*i,o=2*s-r;return[Math.round(255*a(o,r,t+1/3)),Math.round(255*a(o,r,t)),Math.round(255*a(o,r,t-1/3)),n]},f(u,function(s,a){var n=a.props,r=a.cache,h=a.to,u=a.from;l.fn[s]=function(s){if(h&&!this[r]&&(this[r]=h(this._rgba)),s===t)return this[r].slice();var a,o=e.type(s),d="array"===o||"object"===o?s:arguments,c=this[r].slice();return f(n,function(e,t){var s=d["object"===o?e:t.idx];null==s&&(s=c[t.idx]),c[t.idx]=i(s,t)}),u?(a=l(u(c)),a[r]=c,a):l(c)},f(n,function(t,i){l.fn[t]||(l.fn[t]=function(a){var n,r=e.type(a),h="alpha"===t?this._hsla?"hsla":"rgba":s,l=this[h](),u=l[i.idx];return"undefined"===r?u:("function"===r&&(a=a.call(this,u),r=e.type(a)),null==a&&i.empty?this:("string"===r&&(n=o.exec(a),n&&(a=u+parseFloat(n[2])*("+"===n[1]?1:-1))),l[i.idx]=a,this[h](l)))})})}),l.hook=function(t){var i=t.split(" ");f(i,function(t,i){e.cssHooks[i]={set:function(t,a){var n,r,o="";if("transparent"!==a&&("string"!==e.type(a)||(n=s(a)))){if(a=l(n||a),!c.rgba&&1!==a._rgba[3]){for(r="backgroundColor"===i?t.parentNode:t;(""===o||"transparent"===o)&&r&&r.style;)try{o=e.css(r,"backgroundColor"),r=r.parentNode}catch(h){}a=a.blend(o&&"transparent"!==o?o:"_default")}a=a.toRgbaString()}try{t.style[i]=a}catch(h){}}},e.fx.step[i]=function(t){t.colorInit||(t.start=l(t.elem,i),t.end=l(t.end),t.colorInit=!0),e.cssHooks[i].set(t.elem,t.start.transition(t.end,t.pos))}})},l.hook(r),e.cssHooks.borderColor={expand:function(e){var t={};return f(["Top","Right","Bottom","Left"],function(i,s){t["border"+s+"Color"]=e}),t}},n=e.Color.names={aqua:"#00ffff",black:"#000000",blue:"#0000ff",fuchsia:"#ff00ff",gray:"#808080",green:"#008000",lime:"#00ff00",maroon:"#800000",navy:"#000080",olive:"#808000",purple:"#800080",red:"#ff0000",silver:"#c0c0c0",teal:"#008080",white:"#ffffff",yellow:"#ffff00",transparent:[null,null,null,0],_default:"#ffffff"}}(jQuery),function(){function t(t){var i,s,a=t.ownerDocument.defaultView?t.ownerDocument.defaultView.getComputedStyle(t,null):t.currentStyle,n={};if(a&&a.length&&a[0]&&a[a[0]])for(s=a.length;s--;)i=a[s],"string"==typeof a[i]&&(n[e.camelCase(i)]=a[i]);else for(i in a)"string"==typeof a[i]&&(n[i]=a[i]);return n}function i(t,i){var s,n,r={};for(s in i)n=i[s],t[s]!==n&&(a[s]||(e.fx.step[s]||!isNaN(parseFloat(n)))&&(r[s]=n));return r}var s=["add","remove","toggle"],a={border:1,borderBottom:1,borderColor:1,borderLeft:1,borderRight:1,borderTop:1,borderWidth:1,margin:1,padding:1};e.each(["borderLeftStyle","borderRightStyle","borderBottomStyle","borderTopStyle"],function(t,i){e.fx.step[i]=function(e){("none"!==e.end&&!e.setAttr||1===e.pos&&!e.setAttr)&&(jQuery.style(e.elem,i,e.end),e.setAttr=!0)}}),e.fn.addBack||(e.fn.addBack=function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}),e.effects.animateClass=function(a,n,r,o){var h=e.speed(n,r,o);return this.queue(function(){var n,r=e(this),o=r.attr("class")||"",l=h.children?r.find("*").addBack():r;l=l.map(function(){var i=e(this);return{el:i,start:t(this)}}),n=function(){e.each(s,function(e,t){a[t]&&r[t+"Class"](a[t])})},n(),l=l.map(function(){return this.end=t(this.el[0]),this.diff=i(this.start,this.end),this}),r.attr("class",o),l=l.map(function(){var t=this,i=e.Deferred(),s=e.extend({},h,{queue:!1,complete:function(){i.resolve(t)}});return this.el.animate(this.diff,s),i.promise()}),e.when.apply(e,l.get()).done(function(){n(),e.each(arguments,function(){var t=this.el;e.each(this.diff,function(e){t.css(e,"")})}),h.complete.call(r[0])})})},e.fn.extend({addClass:function(t){return function(i,s,a,n){return s?e.effects.animateClass.call(this,{add:i},s,a,n):t.apply(this,arguments)}}(e.fn.addClass),removeClass:function(t){return function(i,s,a,n){return arguments.length>1?e.effects.animateClass.call(this,{remove:i},s,a,n):t.apply(this,arguments)}}(e.fn.removeClass),toggleClass:function(t){return function(i,s,a,n,r){return"boolean"==typeof s||void 0===s?a?e.effects.animateClass.call(this,s?{add:i}:{remove:i},a,n,r):t.apply(this,arguments):e.effects.animateClass.call(this,{toggle:i},s,a,n)}}(e.fn.toggleClass),switchClass:function(t,i,s,a,n){return e.effects.animateClass.call(this,{add:i,remove:t},s,a,n)}})}(),function(){function t(t,i,s,a){return e.isPlainObject(t)&&(i=t,t=t.effect),t={effect:t},null==i&&(i={}),e.isFunction(i)&&(a=i,s=null,i={}),("number"==typeof i||e.fx.speeds[i])&&(a=s,s=i,i={}),e.isFunction(s)&&(a=s,s=null),i&&e.extend(t,i),s=s||i.duration,t.duration=e.fx.off?0:"number"==typeof s?s:s in e.fx.speeds?e.fx.speeds[s]:e.fx.speeds._default,t.complete=a||i.complete,t}function i(t){return!t||"number"==typeof t||e.fx.speeds[t]?!0:"string"!=typeof t||e.effects.effect[t]?e.isFunction(t)?!0:"object"!=typeof t||t.effect?!1:!0:!0}e.extend(e.effects,{version:"1.11.0",save:function(e,t){for(var i=0;t.length>i;i++)null!==t[i]&&e.data(v+t[i],e[0].style[t[i]])},restore:function(e,t){var i,s;for(s=0;t.length>s;s++)null!==t[s]&&(i=e.data(v+t[s]),void 0===i&&(i=""),e.css(t[s],i))},setMode:function(e,t){return"toggle"===t&&(t=e.is(":hidden")?"show":"hide"),t},getBaseline:function(e,t){var i,s;switch(e[0]){case"top":i=0;break;case"middle":i=.5;break;case"bottom":i=1;break;default:i=e[0]/t.height}switch(e[1]){case"left":s=0;break;case"center":s=.5;break;case"right":s=1;break;default:s=e[1]/t.width}return{x:s,y:i}},createWrapper:function(t){if(t.parent().is(".ui-effects-wrapper"))return t.parent();var i={width:t.outerWidth(!0),height:t.outerHeight(!0),"float":t.css("float")},s=e("

      ").addClass("ui-effects-wrapper").css({fontSize:"100%",background:"transparent",border:"none",margin:0,padding:0}),a={width:t.width(),height:t.height()},n=document.activeElement;try{n.id}catch(r){n=document.body}return t.wrap(s),(t[0]===n||e.contains(t[0],n))&&e(n).focus(),s=t.parent(),"static"===t.css("position")?(s.css({position:"relative"}),t.css({position:"relative"})):(e.extend(i,{position:t.css("position"),zIndex:t.css("z-index")}),e.each(["top","left","bottom","right"],function(e,s){i[s]=t.css(s),isNaN(parseInt(i[s],10))&&(i[s]="auto")}),t.css({position:"relative",top:0,left:0,right:"auto",bottom:"auto"})),t.css(a),s.css(i).show()},removeWrapper:function(t){var i=document.activeElement;return t.parent().is(".ui-effects-wrapper")&&(t.parent().replaceWith(t),(t[0]===i||e.contains(t[0],i))&&e(i).focus()),t},setTransition:function(t,i,s,a){return a=a||{},e.each(i,function(e,i){var n=t.cssUnit(i);n[0]>0&&(a[i]=n[0]*s+n[1])}),a}}),e.fn.extend({effect:function(){function i(t){function i(){e.isFunction(n)&&n.call(a[0]),e.isFunction(t)&&t()}var a=e(this),n=s.complete,o=s.mode;(a.is(":hidden")?"hide"===o:"show"===o)?(a[o](),i()):r.call(a[0],s,i)}var s=t.apply(this,arguments),a=s.mode,n=s.queue,r=e.effects.effect[s.effect];return e.fx.off||!r?a?this[a](s.duration,s.complete):this.each(function(){s.complete&&s.complete.call(this)}):n===!1?this.each(i):this.queue(n||"fx",i)},show:function(e){return function(s){if(i(s))return e.apply(this,arguments);var a=t.apply(this,arguments);return a.mode="show",this.effect.call(this,a)}}(e.fn.show),hide:function(e){return function(s){if(i(s))return e.apply(this,arguments);var a=t.apply(this,arguments);return a.mode="hide",this.effect.call(this,a)}}(e.fn.hide),toggle:function(e){return function(s){if(i(s)||"boolean"==typeof s)return e.apply(this,arguments);var a=t.apply(this,arguments);return a.mode="toggle",this.effect.call(this,a)}}(e.fn.toggle),cssUnit:function(t){var i=this.css(t),s=[];return e.each(["em","px","%","pt"],function(e,t){i.indexOf(t)>0&&(s=[parseFloat(i),t])}),s}})}(),function(){var t={};e.each(["Quad","Cubic","Quart","Quint","Expo"],function(e,i){t[i]=function(t){return Math.pow(t,e+2)}}),e.extend(t,{Sine:function(e){return 1-Math.cos(e*Math.PI/2)},Circ:function(e){return 1-Math.sqrt(1-e*e)},Elastic:function(e){return 0===e||1===e?e:-Math.pow(2,8*(e-1))*Math.sin((80*(e-1)-7.5)*Math.PI/15)},Back:function(e){return e*e*(3*e-2)},Bounce:function(e){for(var t,i=4;((t=Math.pow(2,--i))-1)/11>e;);return 1/Math.pow(4,3-i)-7.5625*Math.pow((3*t-2)/22-e,2)}}),e.each(t,function(t,i){e.easing["easeIn"+t]=i,e.easing["easeOut"+t]=function(e){return 1-i(1-e)},e.easing["easeInOut"+t]=function(e){return.5>e?i(2*e)/2:1-i(-2*e+2)/2}})}(),e.effects,e.effects.effect.blind=function(t,i){var s,a,n,r=e(this),o=/up|down|vertical/,h=/up|left|vertical|horizontal/,l=["position","top","bottom","left","right","height","width"],u=e.effects.setMode(r,t.mode||"hide"),d=t.direction||"up",c=o.test(d),p=c?"height":"width",f=c?"top":"left",m=h.test(d),g={},v="show"===u; +r.parent().is(".ui-effects-wrapper")?e.effects.save(r.parent(),l):e.effects.save(r,l),r.show(),s=e.effects.createWrapper(r).css({overflow:"hidden"}),a=s[p](),n=parseFloat(s.css(f))||0,g[p]=v?a:0,m||(r.css(c?"bottom":"right",0).css(c?"top":"left","auto").css({position:"absolute"}),g[f]=v?n:a+n),v&&(s.css(p,0),m||s.css(f,n+a)),s.animate(g,{duration:t.duration,easing:t.easing,queue:!1,complete:function(){"hide"===u&&r.hide(),e.effects.restore(r,l),e.effects.removeWrapper(r),i()}})},e.effects.effect.bounce=function(t,i){var s,a,n,r=e(this),o=["position","top","bottom","left","right","height","width"],h=e.effects.setMode(r,t.mode||"effect"),l="hide"===h,u="show"===h,d=t.direction||"up",c=t.distance,p=t.times||5,f=2*p+(u||l?1:0),m=t.duration/f,g=t.easing,v="up"===d||"down"===d?"top":"left",y="up"===d||"left"===d,b=r.queue(),_=b.length;for((u||l)&&o.push("opacity"),e.effects.save(r,o),r.show(),e.effects.createWrapper(r),c||(c=r["top"===v?"outerHeight":"outerWidth"]()/3),u&&(n={opacity:1},n[v]=0,r.css("opacity",0).css(v,y?2*-c:2*c).animate(n,m,g)),l&&(c/=Math.pow(2,p-1)),n={},n[v]=0,s=0;p>s;s++)a={},a[v]=(y?"-=":"+=")+c,r.animate(a,m,g).animate(n,m,g),c=l?2*c:c/2;l&&(a={opacity:0},a[v]=(y?"-=":"+=")+c,r.animate(a,m,g)),r.queue(function(){l&&r.hide(),e.effects.restore(r,o),e.effects.removeWrapper(r),i()}),_>1&&b.splice.apply(b,[1,0].concat(b.splice(_,f+1))),r.dequeue()},e.effects.effect.clip=function(t,i){var s,a,n,r=e(this),o=["position","top","bottom","left","right","height","width"],h=e.effects.setMode(r,t.mode||"hide"),l="show"===h,u=t.direction||"vertical",d="vertical"===u,c=d?"height":"width",p=d?"top":"left",f={};e.effects.save(r,o),r.show(),s=e.effects.createWrapper(r).css({overflow:"hidden"}),a="IMG"===r[0].tagName?s:r,n=a[c](),l&&(a.css(c,0),a.css(p,n/2)),f[c]=l?n:0,f[p]=l?0:n/2,a.animate(f,{queue:!1,duration:t.duration,easing:t.easing,complete:function(){l||r.hide(),e.effects.restore(r,o),e.effects.removeWrapper(r),i()}})},e.effects.effect.drop=function(t,i){var s,a=e(this),n=["position","top","bottom","left","right","opacity","height","width"],r=e.effects.setMode(a,t.mode||"hide"),o="show"===r,h=t.direction||"left",l="up"===h||"down"===h?"top":"left",u="up"===h||"left"===h?"pos":"neg",d={opacity:o?1:0};e.effects.save(a,n),a.show(),e.effects.createWrapper(a),s=t.distance||a["top"===l?"outerHeight":"outerWidth"](!0)/2,o&&a.css("opacity",0).css(l,"pos"===u?-s:s),d[l]=(o?"pos"===u?"+=":"-=":"pos"===u?"-=":"+=")+s,a.animate(d,{queue:!1,duration:t.duration,easing:t.easing,complete:function(){"hide"===r&&a.hide(),e.effects.restore(a,n),e.effects.removeWrapper(a),i()}})},e.effects.effect.explode=function(t,i){function s(){b.push(this),b.length===d*c&&a()}function a(){p.css({visibility:"visible"}),e(b).remove(),m||p.hide(),i()}var n,r,o,h,l,u,d=t.pieces?Math.round(Math.sqrt(t.pieces)):3,c=d,p=e(this),f=e.effects.setMode(p,t.mode||"hide"),m="show"===f,g=p.show().css("visibility","hidden").offset(),v=Math.ceil(p.outerWidth()/c),y=Math.ceil(p.outerHeight()/d),b=[];for(n=0;d>n;n++)for(h=g.top+n*y,u=n-(d-1)/2,r=0;c>r;r++)o=g.left+r*v,l=r-(c-1)/2,p.clone().appendTo("body").wrap("
      ").css({position:"absolute",visibility:"visible",left:-r*v,top:-n*y}).parent().addClass("ui-effects-explode").css({position:"absolute",overflow:"hidden",width:v,height:y,left:o+(m?l*v:0),top:h+(m?u*y:0),opacity:m?0:1}).animate({left:o+(m?0:l*v),top:h+(m?0:u*y),opacity:m?1:0},t.duration||500,t.easing,s)},e.effects.effect.fade=function(t,i){var s=e(this),a=e.effects.setMode(s,t.mode||"toggle");s.animate({opacity:a},{queue:!1,duration:t.duration,easing:t.easing,complete:i})},e.effects.effect.fold=function(t,i){var s,a,n=e(this),r=["position","top","bottom","left","right","height","width"],o=e.effects.setMode(n,t.mode||"hide"),h="show"===o,l="hide"===o,u=t.size||15,d=/([0-9]+)%/.exec(u),c=!!t.horizFirst,p=h!==c,f=p?["width","height"]:["height","width"],m=t.duration/2,g={},v={};e.effects.save(n,r),n.show(),s=e.effects.createWrapper(n).css({overflow:"hidden"}),a=p?[s.width(),s.height()]:[s.height(),s.width()],d&&(u=parseInt(d[1],10)/100*a[l?0:1]),h&&s.css(c?{height:0,width:u}:{height:u,width:0}),g[f[0]]=h?a[0]:u,v[f[1]]=h?a[1]:0,s.animate(g,m,t.easing).animate(v,m,t.easing,function(){l&&n.hide(),e.effects.restore(n,r),e.effects.removeWrapper(n),i()})},e.effects.effect.highlight=function(t,i){var s=e(this),a=["backgroundImage","backgroundColor","opacity"],n=e.effects.setMode(s,t.mode||"show"),r={backgroundColor:s.css("backgroundColor")};"hide"===n&&(r.opacity=0),e.effects.save(s,a),s.show().css({backgroundImage:"none",backgroundColor:t.color||"#ffff99"}).animate(r,{queue:!1,duration:t.duration,easing:t.easing,complete:function(){"hide"===n&&s.hide(),e.effects.restore(s,a),i()}})},e.effects.effect.size=function(t,i){var s,a,n,r=e(this),o=["position","top","bottom","left","right","width","height","overflow","opacity"],h=["position","top","bottom","left","right","overflow","opacity"],l=["width","height","overflow"],u=["fontSize"],d=["borderTopWidth","borderBottomWidth","paddingTop","paddingBottom"],c=["borderLeftWidth","borderRightWidth","paddingLeft","paddingRight"],p=e.effects.setMode(r,t.mode||"effect"),f=t.restore||"effect"!==p,m=t.scale||"both",g=t.origin||["middle","center"],v=r.css("position"),y=f?o:h,b={height:0,width:0,outerHeight:0,outerWidth:0};"show"===p&&r.show(),s={height:r.height(),width:r.width(),outerHeight:r.outerHeight(),outerWidth:r.outerWidth()},"toggle"===t.mode&&"show"===p?(r.from=t.to||b,r.to=t.from||s):(r.from=t.from||("show"===p?b:s),r.to=t.to||("hide"===p?b:s)),n={from:{y:r.from.height/s.height,x:r.from.width/s.width},to:{y:r.to.height/s.height,x:r.to.width/s.width}},("box"===m||"both"===m)&&(n.from.y!==n.to.y&&(y=y.concat(d),r.from=e.effects.setTransition(r,d,n.from.y,r.from),r.to=e.effects.setTransition(r,d,n.to.y,r.to)),n.from.x!==n.to.x&&(y=y.concat(c),r.from=e.effects.setTransition(r,c,n.from.x,r.from),r.to=e.effects.setTransition(r,c,n.to.x,r.to))),("content"===m||"both"===m)&&n.from.y!==n.to.y&&(y=y.concat(u).concat(l),r.from=e.effects.setTransition(r,u,n.from.y,r.from),r.to=e.effects.setTransition(r,u,n.to.y,r.to)),e.effects.save(r,y),r.show(),e.effects.createWrapper(r),r.css("overflow","hidden").css(r.from),g&&(a=e.effects.getBaseline(g,s),r.from.top=(s.outerHeight-r.outerHeight())*a.y,r.from.left=(s.outerWidth-r.outerWidth())*a.x,r.to.top=(s.outerHeight-r.to.outerHeight)*a.y,r.to.left=(s.outerWidth-r.to.outerWidth)*a.x),r.css(r.from),("content"===m||"both"===m)&&(d=d.concat(["marginTop","marginBottom"]).concat(u),c=c.concat(["marginLeft","marginRight"]),l=o.concat(d).concat(c),r.find("*[width]").each(function(){var i=e(this),s={height:i.height(),width:i.width(),outerHeight:i.outerHeight(),outerWidth:i.outerWidth()};f&&e.effects.save(i,l),i.from={height:s.height*n.from.y,width:s.width*n.from.x,outerHeight:s.outerHeight*n.from.y,outerWidth:s.outerWidth*n.from.x},i.to={height:s.height*n.to.y,width:s.width*n.to.x,outerHeight:s.height*n.to.y,outerWidth:s.width*n.to.x},n.from.y!==n.to.y&&(i.from=e.effects.setTransition(i,d,n.from.y,i.from),i.to=e.effects.setTransition(i,d,n.to.y,i.to)),n.from.x!==n.to.x&&(i.from=e.effects.setTransition(i,c,n.from.x,i.from),i.to=e.effects.setTransition(i,c,n.to.x,i.to)),i.css(i.from),i.animate(i.to,t.duration,t.easing,function(){f&&e.effects.restore(i,l)})})),r.animate(r.to,{queue:!1,duration:t.duration,easing:t.easing,complete:function(){0===r.to.opacity&&r.css("opacity",r.from.opacity),"hide"===p&&r.hide(),e.effects.restore(r,y),f||("static"===v?r.css({position:"relative",top:r.to.top,left:r.to.left}):e.each(["top","left"],function(e,t){r.css(t,function(t,i){var s=parseInt(i,10),a=e?r.to.left:r.to.top;return"auto"===i?a+"px":s+a+"px"})})),e.effects.removeWrapper(r),i()}})},e.effects.effect.scale=function(t,i){var s=e(this),a=e.extend(!0,{},t),n=e.effects.setMode(s,t.mode||"effect"),r=parseInt(t.percent,10)||(0===parseInt(t.percent,10)?0:"hide"===n?0:100),o=t.direction||"both",h=t.origin,l={height:s.height(),width:s.width(),outerHeight:s.outerHeight(),outerWidth:s.outerWidth()},u={y:"horizontal"!==o?r/100:1,x:"vertical"!==o?r/100:1};a.effect="size",a.queue=!1,a.complete=i,"effect"!==n&&(a.origin=h||["middle","center"],a.restore=!0),a.from=t.from||("show"===n?{height:0,width:0,outerHeight:0,outerWidth:0}:l),a.to={height:l.height*u.y,width:l.width*u.x,outerHeight:l.outerHeight*u.y,outerWidth:l.outerWidth*u.x},a.fade&&("show"===n&&(a.from.opacity=0,a.to.opacity=1),"hide"===n&&(a.from.opacity=1,a.to.opacity=0)),s.effect(a)},e.effects.effect.puff=function(t,i){var s=e(this),a=e.effects.setMode(s,t.mode||"hide"),n="hide"===a,r=parseInt(t.percent,10)||150,o=r/100,h={height:s.height(),width:s.width(),outerHeight:s.outerHeight(),outerWidth:s.outerWidth()};e.extend(t,{effect:"scale",queue:!1,fade:!0,mode:a,complete:i,percent:n?r:100,from:n?h:{height:h.height*o,width:h.width*o,outerHeight:h.outerHeight*o,outerWidth:h.outerWidth*o}}),s.effect(t)},e.effects.effect.pulsate=function(t,i){var s,a=e(this),n=e.effects.setMode(a,t.mode||"show"),r="show"===n,o="hide"===n,h=r||"hide"===n,l=2*(t.times||5)+(h?1:0),u=t.duration/l,d=0,c=a.queue(),p=c.length;for((r||!a.is(":visible"))&&(a.css("opacity",0).show(),d=1),s=1;l>s;s++)a.animate({opacity:d},u,t.easing),d=1-d;a.animate({opacity:d},u,t.easing),a.queue(function(){o&&a.hide(),i()}),p>1&&c.splice.apply(c,[1,0].concat(c.splice(p,l+1))),a.dequeue()},e.effects.effect.shake=function(t,i){var s,a=e(this),n=["position","top","bottom","left","right","height","width"],r=e.effects.setMode(a,t.mode||"effect"),o=t.direction||"left",h=t.distance||20,l=t.times||3,u=2*l+1,d=Math.round(t.duration/u),c="up"===o||"down"===o?"top":"left",p="up"===o||"left"===o,f={},m={},g={},v=a.queue(),y=v.length;for(e.effects.save(a,n),a.show(),e.effects.createWrapper(a),f[c]=(p?"-=":"+=")+h,m[c]=(p?"+=":"-=")+2*h,g[c]=(p?"-=":"+=")+2*h,a.animate(f,d,t.easing),s=1;l>s;s++)a.animate(m,d,t.easing).animate(g,d,t.easing);a.animate(m,d,t.easing).animate(f,d/2,t.easing).queue(function(){"hide"===r&&a.hide(),e.effects.restore(a,n),e.effects.removeWrapper(a),i()}),y>1&&v.splice.apply(v,[1,0].concat(v.splice(y,u+1))),a.dequeue()},e.effects.effect.slide=function(t,i){var s,a=e(this),n=["position","top","bottom","left","right","width","height"],r=e.effects.setMode(a,t.mode||"show"),o="show"===r,h=t.direction||"left",l="up"===h||"down"===h?"top":"left",u="up"===h||"left"===h,d={};e.effects.save(a,n),a.show(),s=t.distance||a["top"===l?"outerHeight":"outerWidth"](!0),e.effects.createWrapper(a).css({overflow:"hidden"}),o&&a.css(l,u?isNaN(s)?"-"+s:-s:s),d[l]=(o?u?"+=":"-=":u?"-=":"+=")+s,a.animate(d,{queue:!1,duration:t.duration,easing:t.easing,complete:function(){"hide"===r&&a.hide(),e.effects.restore(a,n),e.effects.removeWrapper(a),i()}})},e.effects.effect.transfer=function(t,i){var s=e(this),a=e(t.to),n="fixed"===a.css("position"),r=e("body"),o=n?r.scrollTop():0,h=n?r.scrollLeft():0,l=a.offset(),u={top:l.top-o,left:l.left-h,height:a.innerHeight(),width:a.innerWidth()},d=s.offset(),c=e("
      ").appendTo(document.body).addClass(t.className).css({top:d.top-o,left:d.left-h,height:s.innerHeight(),width:s.innerWidth(),position:n?"fixed":"absolute"}).animate(u,t.duration,t.easing,function(){c.remove(),i()})}}); \ No newline at end of file diff --git a/js/scripts/jquery.min.js b/js/scripts/jquery.min.js new file mode 100755 index 0000000..e5ace11 --- /dev/null +++ b/js/scripts/jquery.min.js @@ -0,0 +1,4 @@ +/*! jQuery v2.1.1 | (c) 2005, 2014 jQuery Foundation, Inc. | jquery.org/license */ +!function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){var c=[],d=c.slice,e=c.concat,f=c.push,g=c.indexOf,h={},i=h.toString,j=h.hasOwnProperty,k={},l=a.document,m="2.1.1",n=function(a,b){return new n.fn.init(a,b)},o=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,p=/^-ms-/,q=/-([\da-z])/gi,r=function(a,b){return b.toUpperCase()};n.fn=n.prototype={jquery:m,constructor:n,selector:"",length:0,toArray:function(){return d.call(this)},get:function(a){return null!=a?0>a?this[a+this.length]:this[a]:d.call(this)},pushStack:function(a){var b=n.merge(this.constructor(),a);return b.prevObject=this,b.context=this.context,b},each:function(a,b){return n.each(this,a,b)},map:function(a){return this.pushStack(n.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(d.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(0>a?b:0);return this.pushStack(c>=0&&b>c?[this[c]]:[])},end:function(){return this.prevObject||this.constructor(null)},push:f,sort:c.sort,splice:c.splice},n.extend=n.fn.extend=function(){var a,b,c,d,e,f,g=arguments[0]||{},h=1,i=arguments.length,j=!1;for("boolean"==typeof g&&(j=g,g=arguments[h]||{},h++),"object"==typeof g||n.isFunction(g)||(g={}),h===i&&(g=this,h--);i>h;h++)if(null!=(a=arguments[h]))for(b in a)c=g[b],d=a[b],g!==d&&(j&&d&&(n.isPlainObject(d)||(e=n.isArray(d)))?(e?(e=!1,f=c&&n.isArray(c)?c:[]):f=c&&n.isPlainObject(c)?c:{},g[b]=n.extend(j,f,d)):void 0!==d&&(g[b]=d));return g},n.extend({expando:"jQuery"+(m+Math.random()).replace(/\D/g,""),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFunction:function(a){return"function"===n.type(a)},isArray:Array.isArray,isWindow:function(a){return null!=a&&a===a.window},isNumeric:function(a){return!n.isArray(a)&&a-parseFloat(a)>=0},isPlainObject:function(a){return"object"!==n.type(a)||a.nodeType||n.isWindow(a)?!1:a.constructor&&!j.call(a.constructor.prototype,"isPrototypeOf")?!1:!0},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},type:function(a){return null==a?a+"":"object"==typeof a||"function"==typeof a?h[i.call(a)]||"object":typeof a},globalEval:function(a){var b,c=eval;a=n.trim(a),a&&(1===a.indexOf("use strict")?(b=l.createElement("script"),b.text=a,l.head.appendChild(b).parentNode.removeChild(b)):c(a))},camelCase:function(a){return a.replace(p,"ms-").replace(q,r)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b,c){var d,e=0,f=a.length,g=s(a);if(c){if(g){for(;f>e;e++)if(d=b.apply(a[e],c),d===!1)break}else for(e in a)if(d=b.apply(a[e],c),d===!1)break}else if(g){for(;f>e;e++)if(d=b.call(a[e],e,a[e]),d===!1)break}else for(e in a)if(d=b.call(a[e],e,a[e]),d===!1)break;return a},trim:function(a){return null==a?"":(a+"").replace(o,"")},makeArray:function(a,b){var c=b||[];return null!=a&&(s(Object(a))?n.merge(c,"string"==typeof a?[a]:a):f.call(c,a)),c},inArray:function(a,b,c){return null==b?-1:g.call(b,a,c)},merge:function(a,b){for(var c=+b.length,d=0,e=a.length;c>d;d++)a[e++]=b[d];return a.length=e,a},grep:function(a,b,c){for(var d,e=[],f=0,g=a.length,h=!c;g>f;f++)d=!b(a[f],f),d!==h&&e.push(a[f]);return e},map:function(a,b,c){var d,f=0,g=a.length,h=s(a),i=[];if(h)for(;g>f;f++)d=b(a[f],f,c),null!=d&&i.push(d);else for(f in a)d=b(a[f],f,c),null!=d&&i.push(d);return e.apply([],i)},guid:1,proxy:function(a,b){var c,e,f;return"string"==typeof b&&(c=a[b],b=a,a=c),n.isFunction(a)?(e=d.call(arguments,2),f=function(){return a.apply(b||this,e.concat(d.call(arguments)))},f.guid=a.guid=a.guid||n.guid++,f):void 0},now:Date.now,support:k}),n.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(a,b){h["[object "+b+"]"]=b.toLowerCase()});function s(a){var b=a.length,c=n.type(a);return"function"===c||n.isWindow(a)?!1:1===a.nodeType&&b?!0:"array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a}var t=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u="sizzle"+-new Date,v=a.document,w=0,x=0,y=gb(),z=gb(),A=gb(),B=function(a,b){return a===b&&(l=!0),0},C="undefined",D=1<<31,E={}.hasOwnProperty,F=[],G=F.pop,H=F.push,I=F.push,J=F.slice,K=F.indexOf||function(a){for(var b=0,c=this.length;c>b;b++)if(this[b]===a)return b;return-1},L="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",M="[\\x20\\t\\r\\n\\f]",N="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",O=N.replace("w","w#"),P="\\["+M+"*("+N+")(?:"+M+"*([*^$|!~]?=)"+M+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+O+"))|)"+M+"*\\]",Q=":("+N+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+P+")*)|.*)\\)|)",R=new RegExp("^"+M+"+|((?:^|[^\\\\])(?:\\\\.)*)"+M+"+$","g"),S=new RegExp("^"+M+"*,"+M+"*"),T=new RegExp("^"+M+"*([>+~]|"+M+")"+M+"*"),U=new RegExp("="+M+"*([^\\]'\"]*?)"+M+"*\\]","g"),V=new RegExp(Q),W=new RegExp("^"+O+"$"),X={ID:new RegExp("^#("+N+")"),CLASS:new RegExp("^\\.("+N+")"),TAG:new RegExp("^("+N.replace("w","w*")+")"),ATTR:new RegExp("^"+P),PSEUDO:new RegExp("^"+Q),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+M+"*(even|odd|(([+-]|)(\\d*)n|)"+M+"*(?:([+-]|)"+M+"*(\\d+)|))"+M+"*\\)|)","i"),bool:new RegExp("^(?:"+L+")$","i"),needsContext:new RegExp("^"+M+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+M+"*((?:-\\d)?\\d*)"+M+"*\\)|)(?=[^-]|$)","i")},Y=/^(?:input|select|textarea|button)$/i,Z=/^h\d$/i,$=/^[^{]+\{\s*\[native \w/,_=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ab=/[+~]/,bb=/'|\\/g,cb=new RegExp("\\\\([\\da-f]{1,6}"+M+"?|("+M+")|.)","ig"),db=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:0>d?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)};try{I.apply(F=J.call(v.childNodes),v.childNodes),F[v.childNodes.length].nodeType}catch(eb){I={apply:F.length?function(a,b){H.apply(a,J.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function fb(a,b,d,e){var f,h,j,k,l,o,r,s,w,x;if((b?b.ownerDocument||b:v)!==n&&m(b),b=b||n,d=d||[],!a||"string"!=typeof a)return d;if(1!==(k=b.nodeType)&&9!==k)return[];if(p&&!e){if(f=_.exec(a))if(j=f[1]){if(9===k){if(h=b.getElementById(j),!h||!h.parentNode)return d;if(h.id===j)return d.push(h),d}else if(b.ownerDocument&&(h=b.ownerDocument.getElementById(j))&&t(b,h)&&h.id===j)return d.push(h),d}else{if(f[2])return I.apply(d,b.getElementsByTagName(a)),d;if((j=f[3])&&c.getElementsByClassName&&b.getElementsByClassName)return I.apply(d,b.getElementsByClassName(j)),d}if(c.qsa&&(!q||!q.test(a))){if(s=r=u,w=b,x=9===k&&a,1===k&&"object"!==b.nodeName.toLowerCase()){o=g(a),(r=b.getAttribute("id"))?s=r.replace(bb,"\\$&"):b.setAttribute("id",s),s="[id='"+s+"'] ",l=o.length;while(l--)o[l]=s+qb(o[l]);w=ab.test(a)&&ob(b.parentNode)||b,x=o.join(",")}if(x)try{return I.apply(d,w.querySelectorAll(x)),d}catch(y){}finally{r||b.removeAttribute("id")}}}return i(a.replace(R,"$1"),b,d,e)}function gb(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function hb(a){return a[u]=!0,a}function ib(a){var b=n.createElement("div");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function jb(a,b){var c=a.split("|"),e=a.length;while(e--)d.attrHandle[c[e]]=b}function kb(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&(~b.sourceIndex||D)-(~a.sourceIndex||D);if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function lb(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function mb(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function nb(a){return hb(function(b){return b=+b,hb(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function ob(a){return a&&typeof a.getElementsByTagName!==C&&a}c=fb.support={},f=fb.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?"HTML"!==b.nodeName:!1},m=fb.setDocument=function(a){var b,e=a?a.ownerDocument||a:v,g=e.defaultView;return e!==n&&9===e.nodeType&&e.documentElement?(n=e,o=e.documentElement,p=!f(e),g&&g!==g.top&&(g.addEventListener?g.addEventListener("unload",function(){m()},!1):g.attachEvent&&g.attachEvent("onunload",function(){m()})),c.attributes=ib(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=ib(function(a){return a.appendChild(e.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=$.test(e.getElementsByClassName)&&ib(function(a){return a.innerHTML="
      ",a.firstChild.className="i",2===a.getElementsByClassName("i").length}),c.getById=ib(function(a){return o.appendChild(a).id=u,!e.getElementsByName||!e.getElementsByName(u).length}),c.getById?(d.find.ID=function(a,b){if(typeof b.getElementById!==C&&p){var c=b.getElementById(a);return c&&c.parentNode?[c]:[]}},d.filter.ID=function(a){var b=a.replace(cb,db);return function(a){return a.getAttribute("id")===b}}):(delete d.find.ID,d.filter.ID=function(a){var b=a.replace(cb,db);return function(a){var c=typeof a.getAttributeNode!==C&&a.getAttributeNode("id");return c&&c.value===b}}),d.find.TAG=c.getElementsByTagName?function(a,b){return typeof b.getElementsByTagName!==C?b.getElementsByTagName(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){while(c=f[e++])1===c.nodeType&&d.push(c);return d}return f},d.find.CLASS=c.getElementsByClassName&&function(a,b){return typeof b.getElementsByClassName!==C&&p?b.getElementsByClassName(a):void 0},r=[],q=[],(c.qsa=$.test(e.querySelectorAll))&&(ib(function(a){a.innerHTML="",a.querySelectorAll("[msallowclip^='']").length&&q.push("[*^$]="+M+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||q.push("\\["+M+"*(?:value|"+L+")"),a.querySelectorAll(":checked").length||q.push(":checked")}),ib(function(a){var b=e.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&q.push("name"+M+"*[*^$|!~]?="),a.querySelectorAll(":enabled").length||q.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),q.push(",.*:")})),(c.matchesSelector=$.test(s=o.matches||o.webkitMatchesSelector||o.mozMatchesSelector||o.oMatchesSelector||o.msMatchesSelector))&&ib(function(a){c.disconnectedMatch=s.call(a,"div"),s.call(a,"[s!='']:x"),r.push("!=",Q)}),q=q.length&&new RegExp(q.join("|")),r=r.length&&new RegExp(r.join("|")),b=$.test(o.compareDocumentPosition),t=b||$.test(o.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)while(b=b.parentNode)if(b===a)return!0;return!1},B=b?function(a,b){if(a===b)return l=!0,0;var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!c.sortDetached&&b.compareDocumentPosition(a)===d?a===e||a.ownerDocument===v&&t(v,a)?-1:b===e||b.ownerDocument===v&&t(v,b)?1:k?K.call(k,a)-K.call(k,b):0:4&d?-1:1)}:function(a,b){if(a===b)return l=!0,0;var c,d=0,f=a.parentNode,g=b.parentNode,h=[a],i=[b];if(!f||!g)return a===e?-1:b===e?1:f?-1:g?1:k?K.call(k,a)-K.call(k,b):0;if(f===g)return kb(a,b);c=a;while(c=c.parentNode)h.unshift(c);c=b;while(c=c.parentNode)i.unshift(c);while(h[d]===i[d])d++;return d?kb(h[d],i[d]):h[d]===v?-1:i[d]===v?1:0},e):n},fb.matches=function(a,b){return fb(a,null,null,b)},fb.matchesSelector=function(a,b){if((a.ownerDocument||a)!==n&&m(a),b=b.replace(U,"='$1']"),!(!c.matchesSelector||!p||r&&r.test(b)||q&&q.test(b)))try{var d=s.call(a,b);if(d||c.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return fb(b,n,null,[a]).length>0},fb.contains=function(a,b){return(a.ownerDocument||a)!==n&&m(a),t(a,b)},fb.attr=function(a,b){(a.ownerDocument||a)!==n&&m(a);var e=d.attrHandle[b.toLowerCase()],f=e&&E.call(d.attrHandle,b.toLowerCase())?e(a,b,!p):void 0;return void 0!==f?f:c.attributes||!p?a.getAttribute(b):(f=a.getAttributeNode(b))&&f.specified?f.value:null},fb.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},fb.uniqueSort=function(a){var b,d=[],e=0,f=0;if(l=!c.detectDuplicates,k=!c.sortStable&&a.slice(0),a.sort(B),l){while(b=a[f++])b===a[f]&&(e=d.push(f));while(e--)a.splice(d[e],1)}return k=null,a},e=fb.getText=function(a){var b,c="",d=0,f=a.nodeType;if(f){if(1===f||9===f||11===f){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=e(a)}else if(3===f||4===f)return a.nodeValue}else while(b=a[d++])c+=e(b);return c},d=fb.selectors={cacheLength:50,createPseudo:hb,match:X,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(cb,db),a[3]=(a[3]||a[4]||a[5]||"").replace(cb,db),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||fb.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&fb.error(a[0]),a},PSEUDO:function(a){var b,c=!a[6]&&a[2];return X.CHILD.test(a[0])?null:(a[3]?a[2]=a[4]||a[5]||"":c&&V.test(c)&&(b=g(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(cb,db).toLowerCase();return"*"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=y[a+" "];return b||(b=new RegExp("(^|"+M+")"+a+"("+M+"|$)"))&&y(a,function(a){return b.test("string"==typeof a.className&&a.className||typeof a.getAttribute!==C&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=fb.attr(d,a);return null==e?"!="===b:b?(e+="","="===b?e===c:"!="===b?e!==c:"^="===b?c&&0===e.indexOf(c):"*="===b?c&&e.indexOf(c)>-1:"$="===b?c&&e.slice(-c.length)===c:"~="===b?(" "+e+" ").indexOf(c)>-1:"|="===b?e===c||e.slice(0,c.length+1)===c+"-":!1):!0}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),s=!i&&!h;if(q){if(f){while(p){l=b;while(l=l[p])if(h?l.nodeName.toLowerCase()===r:1===l.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&s){k=q[u]||(q[u]={}),j=k[a]||[],n=j[0]===w&&j[1],m=j[0]===w&&j[2],l=n&&q.childNodes[n];while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if(1===l.nodeType&&++m&&l===b){k[a]=[w,n,m];break}}else if(s&&(j=(b[u]||(b[u]={}))[a])&&j[0]===w)m=j[1];else while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if((h?l.nodeName.toLowerCase()===r:1===l.nodeType)&&++m&&(s&&((l[u]||(l[u]={}))[a]=[w,m]),l===b))break;return m-=e,m===d||m%d===0&&m/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||fb.error("unsupported pseudo: "+a);return e[u]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?hb(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=K.call(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:hb(function(a){var b=[],c=[],d=h(a.replace(R,"$1"));return d[u]?hb(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),!c.pop()}}),has:hb(function(a){return function(b){return fb(a,b).length>0}}),contains:hb(function(a){return function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:hb(function(a){return W.test(a||"")||fb.error("unsupported lang: "+a),a=a.replace(cb,db).toLowerCase(),function(b){var c;do if(c=p?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang"))return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===o},focus:function(a){return a===n.activeElement&&(!n.hasFocus||n.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:function(a){return a.disabled===!1},disabled:function(a){return a.disabled===!0},checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeType<6)return!1;return!0},parent:function(a){return!d.pseudos.empty(a)},header:function(a){return Z.test(a.nodeName)},input:function(a){return Y.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||"text"===b.toLowerCase())},first:nb(function(){return[0]}),last:nb(function(a,b){return[b-1]}),eq:nb(function(a,b,c){return[0>c?c+b:c]}),even:nb(function(a,b){for(var c=0;b>c;c+=2)a.push(c);return a}),odd:nb(function(a,b){for(var c=1;b>c;c+=2)a.push(c);return a}),lt:nb(function(a,b,c){for(var d=0>c?c+b:c;--d>=0;)a.push(d);return a}),gt:nb(function(a,b,c){for(var d=0>c?c+b:c;++db;b++)d+=a[b].value;return d}function rb(a,b,c){var d=b.dir,e=c&&"parentNode"===d,f=x++;return b.first?function(b,c,f){while(b=b[d])if(1===b.nodeType||e)return a(b,c,f)}:function(b,c,g){var h,i,j=[w,f];if(g){while(b=b[d])if((1===b.nodeType||e)&&a(b,c,g))return!0}else while(b=b[d])if(1===b.nodeType||e){if(i=b[u]||(b[u]={}),(h=i[d])&&h[0]===w&&h[1]===f)return j[2]=h[2];if(i[d]=j,j[2]=a(b,c,g))return!0}}}function sb(a){return a.length>1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function tb(a,b,c){for(var d=0,e=b.length;e>d;d++)fb(a,b[d],c);return c}function ub(a,b,c,d,e){for(var f,g=[],h=0,i=a.length,j=null!=b;i>h;h++)(f=a[h])&&(!c||c(f,d,e))&&(g.push(f),j&&b.push(h));return g}function vb(a,b,c,d,e,f){return d&&!d[u]&&(d=vb(d)),e&&!e[u]&&(e=vb(e,f)),hb(function(f,g,h,i){var j,k,l,m=[],n=[],o=g.length,p=f||tb(b||"*",h.nodeType?[h]:h,[]),q=!a||!f&&b?p:ub(p,m,a,h,i),r=c?e||(f?a:o||d)?[]:g:q;if(c&&c(q,r,h,i),d){j=ub(r,n),d(j,[],h,i),k=j.length;while(k--)(l=j[k])&&(r[n[k]]=!(q[n[k]]=l))}if(f){if(e||a){if(e){j=[],k=r.length;while(k--)(l=r[k])&&j.push(q[k]=l);e(null,r=[],j,i)}k=r.length;while(k--)(l=r[k])&&(j=e?K.call(f,l):m[k])>-1&&(f[j]=!(g[j]=l))}}else r=ub(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):I.apply(g,r)})}function wb(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],h=g||d.relative[" "],i=g?1:0,k=rb(function(a){return a===b},h,!0),l=rb(function(a){return K.call(b,a)>-1},h,!0),m=[function(a,c,d){return!g&&(d||c!==j)||((b=c).nodeType?k(a,c,d):l(a,c,d))}];f>i;i++)if(c=d.relative[a[i].type])m=[rb(sb(m),c)];else{if(c=d.filter[a[i].type].apply(null,a[i].matches),c[u]){for(e=++i;f>e;e++)if(d.relative[a[e].type])break;return vb(i>1&&sb(m),i>1&&qb(a.slice(0,i-1).concat({value:" "===a[i-2].type?"*":""})).replace(R,"$1"),c,e>i&&wb(a.slice(i,e)),f>e&&wb(a=a.slice(e)),f>e&&qb(a))}m.push(c)}return sb(m)}function xb(a,b){var c=b.length>0,e=a.length>0,f=function(f,g,h,i,k){var l,m,o,p=0,q="0",r=f&&[],s=[],t=j,u=f||e&&d.find.TAG("*",k),v=w+=null==t?1:Math.random()||.1,x=u.length;for(k&&(j=g!==n&&g);q!==x&&null!=(l=u[q]);q++){if(e&&l){m=0;while(o=a[m++])if(o(l,g,h)){i.push(l);break}k&&(w=v)}c&&((l=!o&&l)&&p--,f&&r.push(l))}if(p+=q,c&&q!==p){m=0;while(o=b[m++])o(r,s,g,h);if(f){if(p>0)while(q--)r[q]||s[q]||(s[q]=G.call(i));s=ub(s)}I.apply(i,s),k&&!f&&s.length>0&&p+b.length>1&&fb.uniqueSort(i)}return k&&(w=v,j=t),r};return c?hb(f):f}return h=fb.compile=function(a,b){var c,d=[],e=[],f=A[a+" "];if(!f){b||(b=g(a)),c=b.length;while(c--)f=wb(b[c]),f[u]?d.push(f):e.push(f);f=A(a,xb(e,d)),f.selector=a}return f},i=fb.select=function(a,b,e,f){var i,j,k,l,m,n="function"==typeof a&&a,o=!f&&g(a=n.selector||a);if(e=e||[],1===o.length){if(j=o[0]=o[0].slice(0),j.length>2&&"ID"===(k=j[0]).type&&c.getById&&9===b.nodeType&&p&&d.relative[j[1].type]){if(b=(d.find.ID(k.matches[0].replace(cb,db),b)||[])[0],!b)return e;n&&(b=b.parentNode),a=a.slice(j.shift().value.length)}i=X.needsContext.test(a)?0:j.length;while(i--){if(k=j[i],d.relative[l=k.type])break;if((m=d.find[l])&&(f=m(k.matches[0].replace(cb,db),ab.test(j[0].type)&&ob(b.parentNode)||b))){if(j.splice(i,1),a=f.length&&qb(j),!a)return I.apply(e,f),e;break}}}return(n||h(a,o))(f,b,!p,e,ab.test(a)&&ob(b.parentNode)||b),e},c.sortStable=u.split("").sort(B).join("")===u,c.detectDuplicates=!!l,m(),c.sortDetached=ib(function(a){return 1&a.compareDocumentPosition(n.createElement("div"))}),ib(function(a){return a.innerHTML="
      ","#"===a.firstChild.getAttribute("href")})||jb("type|href|height|width",function(a,b,c){return c?void 0:a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&ib(function(a){return a.innerHTML="",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||jb("value",function(a,b,c){return c||"input"!==a.nodeName.toLowerCase()?void 0:a.defaultValue}),ib(function(a){return null==a.getAttribute("disabled")})||jb(L,function(a,b,c){var d;return c?void 0:a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),fb}(a);n.find=t,n.expr=t.selectors,n.expr[":"]=n.expr.pseudos,n.unique=t.uniqueSort,n.text=t.getText,n.isXMLDoc=t.isXML,n.contains=t.contains;var u=n.expr.match.needsContext,v=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,w=/^.[^:#\[\.,]*$/;function x(a,b,c){if(n.isFunction(b))return n.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return n.grep(a,function(a){return a===b!==c});if("string"==typeof b){if(w.test(b))return n.filter(b,a,c);b=n.filter(b,a)}return n.grep(a,function(a){return g.call(b,a)>=0!==c})}n.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?n.find.matchesSelector(d,a)?[d]:[]:n.find.matches(a,n.grep(b,function(a){return 1===a.nodeType}))},n.fn.extend({find:function(a){var b,c=this.length,d=[],e=this;if("string"!=typeof a)return this.pushStack(n(a).filter(function(){for(b=0;c>b;b++)if(n.contains(e[b],this))return!0}));for(b=0;c>b;b++)n.find(a,e[b],d);return d=this.pushStack(c>1?n.unique(d):d),d.selector=this.selector?this.selector+" "+a:a,d},filter:function(a){return this.pushStack(x(this,a||[],!1))},not:function(a){return this.pushStack(x(this,a||[],!0))},is:function(a){return!!x(this,"string"==typeof a&&u.test(a)?n(a):a||[],!1).length}});var y,z=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,A=n.fn.init=function(a,b){var c,d;if(!a)return this;if("string"==typeof a){if(c="<"===a[0]&&">"===a[a.length-1]&&a.length>=3?[null,a,null]:z.exec(a),!c||!c[1]&&b)return!b||b.jquery?(b||y).find(a):this.constructor(b).find(a);if(c[1]){if(b=b instanceof n?b[0]:b,n.merge(this,n.parseHTML(c[1],b&&b.nodeType?b.ownerDocument||b:l,!0)),v.test(c[1])&&n.isPlainObject(b))for(c in b)n.isFunction(this[c])?this[c](b[c]):this.attr(c,b[c]);return this}return d=l.getElementById(c[2]),d&&d.parentNode&&(this.length=1,this[0]=d),this.context=l,this.selector=a,this}return a.nodeType?(this.context=this[0]=a,this.length=1,this):n.isFunction(a)?"undefined"!=typeof y.ready?y.ready(a):a(n):(void 0!==a.selector&&(this.selector=a.selector,this.context=a.context),n.makeArray(a,this))};A.prototype=n.fn,y=n(l);var B=/^(?:parents|prev(?:Until|All))/,C={children:!0,contents:!0,next:!0,prev:!0};n.extend({dir:function(a,b,c){var d=[],e=void 0!==c;while((a=a[b])&&9!==a.nodeType)if(1===a.nodeType){if(e&&n(a).is(c))break;d.push(a)}return d},sibling:function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c}}),n.fn.extend({has:function(a){var b=n(a,this),c=b.length;return this.filter(function(){for(var a=0;c>a;a++)if(n.contains(this,b[a]))return!0})},closest:function(a,b){for(var c,d=0,e=this.length,f=[],g=u.test(a)||"string"!=typeof a?n(a,b||this.context):0;e>d;d++)for(c=this[d];c&&c!==b;c=c.parentNode)if(c.nodeType<11&&(g?g.index(c)>-1:1===c.nodeType&&n.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?n.unique(f):f)},index:function(a){return a?"string"==typeof a?g.call(n(a),this[0]):g.call(this,a.jquery?a[0]:a):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(n.unique(n.merge(this.get(),n(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function D(a,b){while((a=a[b])&&1!==a.nodeType);return a}n.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return n.dir(a,"parentNode")},parentsUntil:function(a,b,c){return n.dir(a,"parentNode",c)},next:function(a){return D(a,"nextSibling")},prev:function(a){return D(a,"previousSibling")},nextAll:function(a){return n.dir(a,"nextSibling")},prevAll:function(a){return n.dir(a,"previousSibling")},nextUntil:function(a,b,c){return n.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return n.dir(a,"previousSibling",c)},siblings:function(a){return n.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return n.sibling(a.firstChild)},contents:function(a){return a.contentDocument||n.merge([],a.childNodes)}},function(a,b){n.fn[a]=function(c,d){var e=n.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=n.filter(d,e)),this.length>1&&(C[a]||n.unique(e),B.test(a)&&e.reverse()),this.pushStack(e)}});var E=/\S+/g,F={};function G(a){var b=F[a]={};return n.each(a.match(E)||[],function(a,c){b[c]=!0}),b}n.Callbacks=function(a){a="string"==typeof a?F[a]||G(a):n.extend({},a);var b,c,d,e,f,g,h=[],i=!a.once&&[],j=function(l){for(b=a.memory&&l,c=!0,g=e||0,e=0,f=h.length,d=!0;h&&f>g;g++)if(h[g].apply(l[0],l[1])===!1&&a.stopOnFalse){b=!1;break}d=!1,h&&(i?i.length&&j(i.shift()):b?h=[]:k.disable())},k={add:function(){if(h){var c=h.length;!function g(b){n.each(b,function(b,c){var d=n.type(c);"function"===d?a.unique&&k.has(c)||h.push(c):c&&c.length&&"string"!==d&&g(c)})}(arguments),d?f=h.length:b&&(e=c,j(b))}return this},remove:function(){return h&&n.each(arguments,function(a,b){var c;while((c=n.inArray(b,h,c))>-1)h.splice(c,1),d&&(f>=c&&f--,g>=c&&g--)}),this},has:function(a){return a?n.inArray(a,h)>-1:!(!h||!h.length)},empty:function(){return h=[],f=0,this},disable:function(){return h=i=b=void 0,this},disabled:function(){return!h},lock:function(){return i=void 0,b||k.disable(),this},locked:function(){return!i},fireWith:function(a,b){return!h||c&&!i||(b=b||[],b=[a,b.slice?b.slice():b],d?i.push(b):j(b)),this},fire:function(){return k.fireWith(this,arguments),this},fired:function(){return!!c}};return k},n.extend({Deferred:function(a){var b=[["resolve","done",n.Callbacks("once memory"),"resolved"],["reject","fail",n.Callbacks("once memory"),"rejected"],["notify","progress",n.Callbacks("memory")]],c="pending",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return n.Deferred(function(c){n.each(b,function(b,f){var g=n.isFunction(a[b])&&a[b];e[f[1]](function(){var a=g&&g.apply(this,arguments);a&&n.isFunction(a.promise)?a.promise().done(c.resolve).fail(c.reject).progress(c.notify):c[f[0]+"With"](this===d?c.promise():this,g?[a]:arguments)})}),a=null}).promise()},promise:function(a){return null!=a?n.extend(a,d):d}},e={};return d.pipe=d.then,n.each(b,function(a,f){var g=f[2],h=f[3];d[f[1]]=g.add,h&&g.add(function(){c=h},b[1^a][2].disable,b[2][2].lock),e[f[0]]=function(){return e[f[0]+"With"](this===e?d:this,arguments),this},e[f[0]+"With"]=g.fireWith}),d.promise(e),a&&a.call(e,e),e},when:function(a){var b=0,c=d.call(arguments),e=c.length,f=1!==e||a&&n.isFunction(a.promise)?e:0,g=1===f?a:n.Deferred(),h=function(a,b,c){return function(e){b[a]=this,c[a]=arguments.length>1?d.call(arguments):e,c===i?g.notifyWith(b,c):--f||g.resolveWith(b,c)}},i,j,k;if(e>1)for(i=new Array(e),j=new Array(e),k=new Array(e);e>b;b++)c[b]&&n.isFunction(c[b].promise)?c[b].promise().done(h(b,k,c)).fail(g.reject).progress(h(b,j,i)):--f;return f||g.resolveWith(k,c),g.promise()}});var H;n.fn.ready=function(a){return n.ready.promise().done(a),this},n.extend({isReady:!1,readyWait:1,holdReady:function(a){a?n.readyWait++:n.ready(!0)},ready:function(a){(a===!0?--n.readyWait:n.isReady)||(n.isReady=!0,a!==!0&&--n.readyWait>0||(H.resolveWith(l,[n]),n.fn.triggerHandler&&(n(l).triggerHandler("ready"),n(l).off("ready"))))}});function I(){l.removeEventListener("DOMContentLoaded",I,!1),a.removeEventListener("load",I,!1),n.ready()}n.ready.promise=function(b){return H||(H=n.Deferred(),"complete"===l.readyState?setTimeout(n.ready):(l.addEventListener("DOMContentLoaded",I,!1),a.addEventListener("load",I,!1))),H.promise(b)},n.ready.promise();var J=n.access=function(a,b,c,d,e,f,g){var h=0,i=a.length,j=null==c;if("object"===n.type(c)){e=!0;for(h in c)n.access(a,b,h,c[h],!0,f,g)}else if(void 0!==d&&(e=!0,n.isFunction(d)||(g=!0),j&&(g?(b.call(a,d),b=null):(j=b,b=function(a,b,c){return j.call(n(a),c)})),b))for(;i>h;h++)b(a[h],c,g?d:d.call(a[h],h,b(a[h],c)));return e?a:j?b.call(a):i?b(a[0],c):f};n.acceptData=function(a){return 1===a.nodeType||9===a.nodeType||!+a.nodeType};function K(){Object.defineProperty(this.cache={},0,{get:function(){return{}}}),this.expando=n.expando+Math.random()}K.uid=1,K.accepts=n.acceptData,K.prototype={key:function(a){if(!K.accepts(a))return 0;var b={},c=a[this.expando];if(!c){c=K.uid++;try{b[this.expando]={value:c},Object.defineProperties(a,b)}catch(d){b[this.expando]=c,n.extend(a,b)}}return this.cache[c]||(this.cache[c]={}),c},set:function(a,b,c){var d,e=this.key(a),f=this.cache[e];if("string"==typeof b)f[b]=c;else if(n.isEmptyObject(f))n.extend(this.cache[e],b);else for(d in b)f[d]=b[d];return f},get:function(a,b){var c=this.cache[this.key(a)];return void 0===b?c:c[b]},access:function(a,b,c){var d;return void 0===b||b&&"string"==typeof b&&void 0===c?(d=this.get(a,b),void 0!==d?d:this.get(a,n.camelCase(b))):(this.set(a,b,c),void 0!==c?c:b)},remove:function(a,b){var c,d,e,f=this.key(a),g=this.cache[f];if(void 0===b)this.cache[f]={};else{n.isArray(b)?d=b.concat(b.map(n.camelCase)):(e=n.camelCase(b),b in g?d=[b,e]:(d=e,d=d in g?[d]:d.match(E)||[])),c=d.length;while(c--)delete g[d[c]]}},hasData:function(a){return!n.isEmptyObject(this.cache[a[this.expando]]||{})},discard:function(a){a[this.expando]&&delete this.cache[a[this.expando]]}};var L=new K,M=new K,N=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,O=/([A-Z])/g;function P(a,b,c){var d;if(void 0===c&&1===a.nodeType)if(d="data-"+b.replace(O,"-$1").toLowerCase(),c=a.getAttribute(d),"string"==typeof c){try{c="true"===c?!0:"false"===c?!1:"null"===c?null:+c+""===c?+c:N.test(c)?n.parseJSON(c):c}catch(e){}M.set(a,b,c)}else c=void 0;return c}n.extend({hasData:function(a){return M.hasData(a)||L.hasData(a)},data:function(a,b,c){return M.access(a,b,c)},removeData:function(a,b){M.remove(a,b) +},_data:function(a,b,c){return L.access(a,b,c)},_removeData:function(a,b){L.remove(a,b)}}),n.fn.extend({data:function(a,b){var c,d,e,f=this[0],g=f&&f.attributes;if(void 0===a){if(this.length&&(e=M.get(f),1===f.nodeType&&!L.get(f,"hasDataAttrs"))){c=g.length;while(c--)g[c]&&(d=g[c].name,0===d.indexOf("data-")&&(d=n.camelCase(d.slice(5)),P(f,d,e[d])));L.set(f,"hasDataAttrs",!0)}return e}return"object"==typeof a?this.each(function(){M.set(this,a)}):J(this,function(b){var c,d=n.camelCase(a);if(f&&void 0===b){if(c=M.get(f,a),void 0!==c)return c;if(c=M.get(f,d),void 0!==c)return c;if(c=P(f,d,void 0),void 0!==c)return c}else this.each(function(){var c=M.get(this,d);M.set(this,d,b),-1!==a.indexOf("-")&&void 0!==c&&M.set(this,a,b)})},null,b,arguments.length>1,null,!0)},removeData:function(a){return this.each(function(){M.remove(this,a)})}}),n.extend({queue:function(a,b,c){var d;return a?(b=(b||"fx")+"queue",d=L.get(a,b),c&&(!d||n.isArray(c)?d=L.access(a,b,n.makeArray(c)):d.push(c)),d||[]):void 0},dequeue:function(a,b){b=b||"fx";var c=n.queue(a,b),d=c.length,e=c.shift(),f=n._queueHooks(a,b),g=function(){n.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return L.get(a,c)||L.access(a,c,{empty:n.Callbacks("once memory").add(function(){L.remove(a,[b+"queue",c])})})}}),n.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.lengthx",k.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue}();var U="undefined";k.focusinBubbles="onfocusin"in a;var V=/^key/,W=/^(?:mouse|pointer|contextmenu)|click/,X=/^(?:focusinfocus|focusoutblur)$/,Y=/^([^.]*)(?:\.(.+)|)$/;function Z(){return!0}function $(){return!1}function _(){try{return l.activeElement}catch(a){}}n.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,o,p,q,r=L.get(a);if(r){c.handler&&(f=c,c=f.handler,e=f.selector),c.guid||(c.guid=n.guid++),(i=r.events)||(i=r.events={}),(g=r.handle)||(g=r.handle=function(b){return typeof n!==U&&n.event.triggered!==b.type?n.event.dispatch.apply(a,arguments):void 0}),b=(b||"").match(E)||[""],j=b.length;while(j--)h=Y.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o&&(l=n.event.special[o]||{},o=(e?l.delegateType:l.bindType)||o,l=n.event.special[o]||{},k=n.extend({type:o,origType:q,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&n.expr.match.needsContext.test(e),namespace:p.join(".")},f),(m=i[o])||(m=i[o]=[],m.delegateCount=0,l.setup&&l.setup.call(a,d,p,g)!==!1||a.addEventListener&&a.addEventListener(o,g,!1)),l.add&&(l.add.call(a,k),k.handler.guid||(k.handler.guid=c.guid)),e?m.splice(m.delegateCount++,0,k):m.push(k),n.event.global[o]=!0)}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,o,p,q,r=L.hasData(a)&&L.get(a);if(r&&(i=r.events)){b=(b||"").match(E)||[""],j=b.length;while(j--)if(h=Y.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o){l=n.event.special[o]||{},o=(d?l.delegateType:l.bindType)||o,m=i[o]||[],h=h[2]&&new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"),g=f=m.length;while(f--)k=m[f],!e&&q!==k.origType||c&&c.guid!==k.guid||h&&!h.test(k.namespace)||d&&d!==k.selector&&("**"!==d||!k.selector)||(m.splice(f,1),k.selector&&m.delegateCount--,l.remove&&l.remove.call(a,k));g&&!m.length&&(l.teardown&&l.teardown.call(a,p,r.handle)!==!1||n.removeEvent(a,o,r.handle),delete i[o])}else for(o in i)n.event.remove(a,o+b[j],c,d,!0);n.isEmptyObject(i)&&(delete r.handle,L.remove(a,"events"))}},trigger:function(b,c,d,e){var f,g,h,i,k,m,o,p=[d||l],q=j.call(b,"type")?b.type:b,r=j.call(b,"namespace")?b.namespace.split("."):[];if(g=h=d=d||l,3!==d.nodeType&&8!==d.nodeType&&!X.test(q+n.event.triggered)&&(q.indexOf(".")>=0&&(r=q.split("."),q=r.shift(),r.sort()),k=q.indexOf(":")<0&&"on"+q,b=b[n.expando]?b:new n.Event(q,"object"==typeof b&&b),b.isTrigger=e?2:3,b.namespace=r.join("."),b.namespace_re=b.namespace?new RegExp("(^|\\.)"+r.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,b.result=void 0,b.target||(b.target=d),c=null==c?[b]:n.makeArray(c,[b]),o=n.event.special[q]||{},e||!o.trigger||o.trigger.apply(d,c)!==!1)){if(!e&&!o.noBubble&&!n.isWindow(d)){for(i=o.delegateType||q,X.test(i+q)||(g=g.parentNode);g;g=g.parentNode)p.push(g),h=g;h===(d.ownerDocument||l)&&p.push(h.defaultView||h.parentWindow||a)}f=0;while((g=p[f++])&&!b.isPropagationStopped())b.type=f>1?i:o.bindType||q,m=(L.get(g,"events")||{})[b.type]&&L.get(g,"handle"),m&&m.apply(g,c),m=k&&g[k],m&&m.apply&&n.acceptData(g)&&(b.result=m.apply(g,c),b.result===!1&&b.preventDefault());return b.type=q,e||b.isDefaultPrevented()||o._default&&o._default.apply(p.pop(),c)!==!1||!n.acceptData(d)||k&&n.isFunction(d[q])&&!n.isWindow(d)&&(h=d[k],h&&(d[k]=null),n.event.triggered=q,d[q](),n.event.triggered=void 0,h&&(d[k]=h)),b.result}},dispatch:function(a){a=n.event.fix(a);var b,c,e,f,g,h=[],i=d.call(arguments),j=(L.get(this,"events")||{})[a.type]||[],k=n.event.special[a.type]||{};if(i[0]=a,a.delegateTarget=this,!k.preDispatch||k.preDispatch.call(this,a)!==!1){h=n.event.handlers.call(this,a,j),b=0;while((f=h[b++])&&!a.isPropagationStopped()){a.currentTarget=f.elem,c=0;while((g=f.handlers[c++])&&!a.isImmediatePropagationStopped())(!a.namespace_re||a.namespace_re.test(g.namespace))&&(a.handleObj=g,a.data=g.data,e=((n.event.special[g.origType]||{}).handle||g.handler).apply(f.elem,i),void 0!==e&&(a.result=e)===!1&&(a.preventDefault(),a.stopPropagation()))}return k.postDispatch&&k.postDispatch.call(this,a),a.result}},handlers:function(a,b){var c,d,e,f,g=[],h=b.delegateCount,i=a.target;if(h&&i.nodeType&&(!a.button||"click"!==a.type))for(;i!==this;i=i.parentNode||this)if(i.disabled!==!0||"click"!==a.type){for(d=[],c=0;h>c;c++)f=b[c],e=f.selector+" ",void 0===d[e]&&(d[e]=f.needsContext?n(e,this).index(i)>=0:n.find(e,this,null,[i]).length),d[e]&&d.push(f);d.length&&g.push({elem:i,handlers:d})}return h]*)\/>/gi,bb=/<([\w:]+)/,cb=/<|&#?\w+;/,db=/<(?:script|style|link)/i,eb=/checked\s*(?:[^=]|=\s*.checked.)/i,fb=/^$|\/(?:java|ecma)script/i,gb=/^true\/(.*)/,hb=/^\s*\s*$/g,ib={option:[1,""],thead:[1,"","
      "],col:[2,"","
      "],tr:[2,"","
      "],td:[3,"","
      "],_default:[0,"",""]};ib.optgroup=ib.option,ib.tbody=ib.tfoot=ib.colgroup=ib.caption=ib.thead,ib.th=ib.td;function jb(a,b){return n.nodeName(a,"table")&&n.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function kb(a){return a.type=(null!==a.getAttribute("type"))+"/"+a.type,a}function lb(a){var b=gb.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function mb(a,b){for(var c=0,d=a.length;d>c;c++)L.set(a[c],"globalEval",!b||L.get(b[c],"globalEval"))}function nb(a,b){var c,d,e,f,g,h,i,j;if(1===b.nodeType){if(L.hasData(a)&&(f=L.access(a),g=L.set(b,f),j=f.events)){delete g.handle,g.events={};for(e in j)for(c=0,d=j[e].length;d>c;c++)n.event.add(b,e,j[e][c])}M.hasData(a)&&(h=M.access(a),i=n.extend({},h),M.set(b,i))}}function ob(a,b){var c=a.getElementsByTagName?a.getElementsByTagName(b||"*"):a.querySelectorAll?a.querySelectorAll(b||"*"):[];return void 0===b||b&&n.nodeName(a,b)?n.merge([a],c):c}function pb(a,b){var c=b.nodeName.toLowerCase();"input"===c&&T.test(a.type)?b.checked=a.checked:("input"===c||"textarea"===c)&&(b.defaultValue=a.defaultValue)}n.extend({clone:function(a,b,c){var d,e,f,g,h=a.cloneNode(!0),i=n.contains(a.ownerDocument,a);if(!(k.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||n.isXMLDoc(a)))for(g=ob(h),f=ob(a),d=0,e=f.length;e>d;d++)pb(f[d],g[d]);if(b)if(c)for(f=f||ob(a),g=g||ob(h),d=0,e=f.length;e>d;d++)nb(f[d],g[d]);else nb(a,h);return g=ob(h,"script"),g.length>0&&mb(g,!i&&ob(a,"script")),h},buildFragment:function(a,b,c,d){for(var e,f,g,h,i,j,k=b.createDocumentFragment(),l=[],m=0,o=a.length;o>m;m++)if(e=a[m],e||0===e)if("object"===n.type(e))n.merge(l,e.nodeType?[e]:e);else if(cb.test(e)){f=f||k.appendChild(b.createElement("div")),g=(bb.exec(e)||["",""])[1].toLowerCase(),h=ib[g]||ib._default,f.innerHTML=h[1]+e.replace(ab,"<$1>")+h[2],j=h[0];while(j--)f=f.lastChild;n.merge(l,f.childNodes),f=k.firstChild,f.textContent=""}else l.push(b.createTextNode(e));k.textContent="",m=0;while(e=l[m++])if((!d||-1===n.inArray(e,d))&&(i=n.contains(e.ownerDocument,e),f=ob(k.appendChild(e),"script"),i&&mb(f),c)){j=0;while(e=f[j++])fb.test(e.type||"")&&c.push(e)}return k},cleanData:function(a){for(var b,c,d,e,f=n.event.special,g=0;void 0!==(c=a[g]);g++){if(n.acceptData(c)&&(e=c[L.expando],e&&(b=L.cache[e]))){if(b.events)for(d in b.events)f[d]?n.event.remove(c,d):n.removeEvent(c,d,b.handle);L.cache[e]&&delete L.cache[e]}delete M.cache[c[M.expando]]}}}),n.fn.extend({text:function(a){return J(this,function(a){return void 0===a?n.text(this):this.empty().each(function(){(1===this.nodeType||11===this.nodeType||9===this.nodeType)&&(this.textContent=a)})},null,a,arguments.length)},append:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=jb(this,a);b.appendChild(a)}})},prepend:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=jb(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},remove:function(a,b){for(var c,d=a?n.filter(a,this):this,e=0;null!=(c=d[e]);e++)b||1!==c.nodeType||n.cleanData(ob(c)),c.parentNode&&(b&&n.contains(c.ownerDocument,c)&&mb(ob(c,"script")),c.parentNode.removeChild(c));return this},empty:function(){for(var a,b=0;null!=(a=this[b]);b++)1===a.nodeType&&(n.cleanData(ob(a,!1)),a.textContent="");return this},clone:function(a,b){return a=null==a?!1:a,b=null==b?a:b,this.map(function(){return n.clone(this,a,b)})},html:function(a){return J(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a&&1===b.nodeType)return b.innerHTML;if("string"==typeof a&&!db.test(a)&&!ib[(bb.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(ab,"<$1>");try{for(;d>c;c++)b=this[c]||{},1===b.nodeType&&(n.cleanData(ob(b,!1)),b.innerHTML=a);b=0}catch(e){}}b&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(){var a=arguments[0];return this.domManip(arguments,function(b){a=this.parentNode,n.cleanData(ob(this)),a&&a.replaceChild(b,this)}),a&&(a.length||a.nodeType)?this:this.remove()},detach:function(a){return this.remove(a,!0)},domManip:function(a,b){a=e.apply([],a);var c,d,f,g,h,i,j=0,l=this.length,m=this,o=l-1,p=a[0],q=n.isFunction(p);if(q||l>1&&"string"==typeof p&&!k.checkClone&&eb.test(p))return this.each(function(c){var d=m.eq(c);q&&(a[0]=p.call(this,c,d.html())),d.domManip(a,b)});if(l&&(c=n.buildFragment(a,this[0].ownerDocument,!1,this),d=c.firstChild,1===c.childNodes.length&&(c=d),d)){for(f=n.map(ob(c,"script"),kb),g=f.length;l>j;j++)h=c,j!==o&&(h=n.clone(h,!0,!0),g&&n.merge(f,ob(h,"script"))),b.call(this[j],h,j);if(g)for(i=f[f.length-1].ownerDocument,n.map(f,lb),j=0;g>j;j++)h=f[j],fb.test(h.type||"")&&!L.access(h,"globalEval")&&n.contains(i,h)&&(h.src?n._evalUrl&&n._evalUrl(h.src):n.globalEval(h.textContent.replace(hb,"")))}return this}}),n.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){n.fn[a]=function(a){for(var c,d=[],e=n(a),g=e.length-1,h=0;g>=h;h++)c=h===g?this:this.clone(!0),n(e[h])[b](c),f.apply(d,c.get());return this.pushStack(d)}});var qb,rb={};function sb(b,c){var d,e=n(c.createElement(b)).appendTo(c.body),f=a.getDefaultComputedStyle&&(d=a.getDefaultComputedStyle(e[0]))?d.display:n.css(e[0],"display");return e.detach(),f}function tb(a){var b=l,c=rb[a];return c||(c=sb(a,b),"none"!==c&&c||(qb=(qb||n("