From ab6c25812a9126a3ab9cdefff8604cfa9d8eb4ad Mon Sep 17 00:00:00 2001 From: Motion Team Date: Fri, 4 Dec 2015 11:09:15 +0100 Subject: [PATCH] Built motion from commit 06df96e on branch develop. --- package.json | 137 + public/.htaccess | 543 + public/app/0e6d6720.vendor.js | 84 + public/app/16e12937.vendor.css | 27 + public/app/5c053d28.app.js | 43 + public/app/808268be.app.css | 1 + public/assets/css/common.css | 25 + public/assets/css/global/components.css |12681 ++++++ public/assets/css/global/custom-whirly.css | 57 + public/assets/css/global/custom.css | 291 + public/assets/css/global/darkblue.css | 921 + public/assets/css/global/google-open-sans.css | 284 + public/assets/css/global/layout.css | 2630 ++ public/assets/css/global/plugins.css | 2320 ++ public/assets/css/global/strap-docs.min.css | 9 + public/assets/css/global/strap.min.css | 18 + public/assets/css/inbox.css | 487 + public/assets/css/login-soft.css | 171 + public/assets/css/login.css | 242 + public/assets/css/portfolio.css | 123 + public/assets/css/profile-old.css | 332 + public/assets/css/profile.css | 175 + public/assets/css/smart_table.css | 36 + public/assets/css/tasks.css | 81 + public/assets/css/timeline.css | 189 + public/assets/css/todo.css | 307 + public/assets/fonts/FontAwesome.otf | Bin 0 -> 106260 bytes public/assets/fonts/Simple-Line-Icons.eot | Bin 0 -> 53572 bytes public/assets/fonts/Simple-Line-Icons.svg | 211 + public/assets/fonts/Simple-Line-Icons.ttf | Bin 0 -> 53368 bytes public/assets/fonts/Simple-Line-Icons.woff | Bin 0 -> 53444 bytes public/assets/fonts/Simple-Line-Icons.woff2 | Bin 0 -> 26384 bytes public/assets/fonts/fontawesome-webfont.eot | Bin 0 -> 68875 bytes public/assets/fonts/fontawesome-webfont.svg | 640 + public/assets/fonts/fontawesome-webfont.ttf | Bin 0 -> 138204 bytes public/assets/fonts/fontawesome-webfont.woff | Bin 0 -> 81284 bytes public/assets/fonts/fontawesome-webfont.woff2 | Bin 0 -> 64464 bytes .../assets/fonts/glyphicons-halflings-regular.eot | Bin 0 -> 20127 bytes .../assets/fonts/glyphicons-halflings-regular.svg | 288 + .../assets/fonts/glyphicons-halflings-regular.ttf | Bin 0 -> 45404 bytes .../assets/fonts/glyphicons-halflings-regular.woff | Bin 0 -> 23424 bytes .../fonts/glyphicons-halflings-regular.woff2 | Bin 0 -> 18028 bytes .../apple/apple-touch-icon-114x114-precomposed.png | Bin 0 -> 13581 bytes .../apple/apple-touch-icon-144x144-precomposed.png | Bin 0 -> 13580 bytes .../apple/apple-touch-icon-57x57-precomposed.png | Bin 0 -> 13599 bytes .../apple/apple-touch-icon-72x72-precomposed.png | Bin 0 -> 13547 bytes .../images/apple/apple-touch-icon-precomposed.png | Bin 0 -> 13558 bytes public/assets/images/apple/apple-touch-icon.png | Bin 0 -> 13606 bytes public/assets/images/apple/splash.png | Bin 0 -> 32559 bytes public/assets/images/apple/splash2x.png | Bin 0 -> 73469 bytes public/assets/images/avatars/avatar.png | Bin 0 -> 2016 bytes public/assets/images/bg-white-lock.png | Bin 0 -> 137 bytes .../assets/images/browsers/chrome/chrome_16x16.png | Bin 0 -> 930 bytes .../images/browsers/firefox/firefox_16x16.png | Bin 0 -> 960 bytes .../internet-explorer/internet-explorer_16x16.png | Bin 0 -> 914 bytes .../assets/images/browsers/safari/safari_16x16.png | Bin 0 -> 925 bytes public/assets/images/clarotech_original.jpg | Bin 0 -> 75977 bytes public/assets/images/flags/en_EN.png | Bin 0 -> 599 bytes public/assets/images/flags/it.png | Bin 0 -> 420 bytes public/assets/images/flags/us.png | Bin 0 -> 609 bytes public/assets/images/icon-color-close.png | Bin 0 -> 1031 bytes public/assets/images/icon-color.png | Bin 0 -> 1240 bytes public/assets/images/icons/facebook.png | Bin 0 -> 8825 bytes public/assets/images/icons/github.png | Bin 0 -> 10410 bytes public/assets/images/icons/google.png | Bin 0 -> 7968 bytes public/assets/images/icons/twitter.png | Bin 0 -> 8340 bytes public/assets/images/loaders/loader.gif | Bin 0 -> 9315 bytes public/assets/images/loading-spinner-blue.gif | Bin 0 -> 5200 bytes public/assets/images/loading-spinner-grey.gif | Bin 0 -> 5203 bytes public/assets/images/loading.gif | Bin 0 -> 2906 bytes public/assets/images/logo-big.png | Bin 0 -> 9967 bytes public/assets/images/logo.png | Bin 0 -> 2754 bytes public/assets/images/mCSB_buttons.png | Bin 0 -> 2998 bytes public/assets/images/media/account.png | Bin 0 -> 20593 bytes public/assets/images/media/automation.png | Bin 0 -> 16093 bytes public/assets/images/media/channels/chat64.png | Bin 0 -> 1312 bytes public/assets/images/media/channels/mail64.png | Bin 0 -> 1481 bytes .../images/media/channels/screen_monitor_64.png | Bin 0 -> 430 bytes .../assets/images/media/channels/telephone124.png | Bin 0 -> 1092 bytes public/assets/images/media/context.png | Bin 0 -> 12545 bytes public/assets/images/media/dashboard.png | Bin 0 -> 8730 bytes public/assets/images/media/inboundroute.png | Bin 0 -> 3943 bytes public/assets/images/media/internalroute.png | Bin 0 -> 14978 bytes public/assets/images/media/interval.png | Bin 0 -> 17427 bytes public/assets/images/media/moh.png | Bin 0 -> 12712 bytes public/assets/images/media/no-pic.png | Bin 0 -> 3595 bytes public/assets/images/media/odbc.png | Bin 0 -> 20192 bytes public/assets/images/media/outboundroute.png | Bin 0 -> 3999 bytes public/assets/images/media/queue.png | Bin 0 -> 24648 bytes public/assets/images/media/realtime.png | Bin 0 -> 12740 bytes public/assets/images/media/stage.png | Bin 0 -> 11360 bytes public/assets/images/media/statistics.png | Bin 0 -> 24292 bytes public/assets/images/media/team.png | Bin 0 -> 26479 bytes public/assets/images/media/template.png | Bin 0 -> 14035 bytes public/assets/images/media/trigger.png | Bin 0 -> 16383 bytes public/assets/images/media/trunk.png | Bin 0 -> 15684 bytes public/assets/images/media/variable.png | Bin 0 -> 14636 bytes public/assets/images/media/voicemail.png | Bin 0 -> 16330 bytes public/assets/images/media/website.png | Bin 0 -> 17639 bytes public/assets/images/media/zendesk.png | Bin 0 -> 11964 bytes public/assets/images/note_placeholder.png | Bin 0 -> 33879 bytes .../assets/images/portlet-collapse-icon-white.png | Bin 0 -> 240 bytes public/assets/images/portlet-collapse-icon.png | Bin 0 -> 269 bytes public/assets/images/portlet-config-icon-white.png | Bin 0 -> 320 bytes public/assets/images/portlet-config-icon.png | Bin 0 -> 330 bytes public/assets/images/portlet-expand-icon.png | Bin 0 -> 256 bytes public/assets/images/portlet-reload-icon-white.png | Bin 0 -> 324 bytes public/assets/images/portlet-reload-icon.png | Bin 0 -> 345 bytes public/assets/images/portlet-remove-icon-white.png | Bin 0 -> 260 bytes public/assets/images/portlet-remove-icon.png | Bin 0 -> 312 bytes public/assets/images/preview_snippet.png | Bin 0 -> 21233 bytes public/assets/images/profile_user.jpg | Bin 0 -> 79986 bytes public/assets/images/remove-icon-small.png | Bin 0 -> 193 bytes .../sidebar_inline_toggler_icon_darkblue.jpg | Bin 0 -> 1084 bytes .../images/sidebar_toggler_icon_darkblue.png | Bin 0 -> 135 bytes public/assets/images/social/facebook.png | Bin 0 -> 2973 bytes public/assets/images/social/googleplus.png | Bin 0 -> 1236 bytes public/assets/images/social/linkedin.png | Bin 0 -> 3004 bytes public/assets/images/social/twitter.png | Bin 0 -> 3055 bytes public/assets/images/social/youtube.png | Bin 0 -> 3300 bytes public/assets/images/sort_asc.png | Bin 0 -> 1118 bytes public/assets/images/sort_desc.png | Bin 0 -> 1127 bytes .../images/sprites/glyphicons-halflings-white.png | Bin 0 -> 8777 bytes .../assets/images/sprites/glyphicons-halflings.png | Bin 0 -> 12799 bytes public/assets/images/syncfusion-icons-white.png | Bin 0 -> 5550 bytes public/assets/images/syncfusion-icons.png | Bin 0 -> 8143 bytes public/assets/images/xcally.png | Bin 0 -> 26191 bytes public/assets/languages/locale-en_EN.json | 744 + public/assets/languages/locale-it.json | 746 + .../angular-elastic-builder-back/.bower.json | 32 + .../angular-elastic-builder-back/LICENSE.md | 9 + .../plugins/angular-elastic-builder-back/README.md | 141 + .../angular-elastic-builder-back/bower.json | 21 + .../dist/angular-elastic-builder.js | 608 + .../dist/angular-elastic-builder.min.js | 1 + .../examples/index.html | 32 + .../angular-elastic-builder-back/examples/index.js | 12 + .../examples/js/exampleApp.js | 76 + .../angular-elastic-builder-back/gulpfile.js | 76 + .../angular-elastic-builder-back/package.json | 30 + .../angular-elastic-builder-back/screenshot.png | Bin 0 -> 46022 bytes .../src/directives/BuilderDirective.js | 84 + .../src/directives/Chooser.js | 49 + .../src/directives/Group.js | 57 + .../src/directives/Rule.js | 45 + .../src/directives/RuleTypes.js | 61 + .../angular-elastic-builder-back/src/module.js | 16 + .../src/services/GroupClassHelper.js | 28 + .../src/services/QueryService.js | 240 + .../src/tmpl/BuilderDirective.html | 20 + .../src/tmpl/ChooserDirective.html | 11 + .../src/tmpl/ElasticBuilderTemplates.js | 10 + .../src/tmpl/GroupDirective.html | 35 + .../src/tmpl/RuleDirective.html | 14 + .../src/tmpl/types/Boolean.html | 10 + .../src/tmpl/types/Date.html | 10 + .../src/tmpl/types/Multi.html | 8 + .../src/tmpl/types/Number.html | 24 + .../src/tmpl/types/Select.html | 35 + .../src/tmpl/types/Term.html | 21 + .../plugins/angular-elastic-builder/.bower.json | 32 + .../plugins/angular-elastic-builder/LICENSE.md | 9 + .../plugins/angular-elastic-builder/README.md | 141 + .../plugins/angular-elastic-builder/bower.json | 21 + .../dist/angular-elastic-builder.js | 590 + .../dist/angular-elastic-builder.min.js | 1 + .../dist/angular-elastic-builder_old.js | 589 + .../angular-elastic-builder/examples/index.html | 32 + .../angular-elastic-builder/examples/index.js | 12 + .../examples/js/exampleApp.js | 76 + .../plugins/angular-elastic-builder/gulpfile.js | 76 + .../plugins/angular-elastic-builder/package.json | 30 + .../plugins/angular-elastic-builder/screenshot.png | Bin 0 -> 46022 bytes .../src/directives/BuilderDirective.js | 84 + .../src/directives/Chooser.js | 47 + .../src/directives/Group.js | 57 + .../angular-elastic-builder/src/directives/Rule.js | 45 + .../src/directives/RuleTypes.js | 59 + .../plugins/angular-elastic-builder/src/module.js | 16 + .../src/services/GroupClassHelper.js | 28 + .../src/services/QueryService.js | 226 + .../src/tmpl/BuilderDirective.html | 52 + .../src/tmpl/ChooserDirective.html | 29 + .../src/tmpl/ElasticBuilderTemplates.js | 10 + .../src/tmpl/GroupDirective.html | 65 + .../src/tmpl/RuleDirective.html | 34 + .../src/tmpl/types/Boolean.html | 10 + .../src/tmpl/types/Date.html | 10 + .../src/tmpl/types/Multi.html | 31 + .../src/tmpl/types/Multiterm.html | 9 + .../src/tmpl/types/Number.html | 27 + .../src/tmpl/types/Term.html | 44 + public/assets/plugins/angular-pdf/.bower.json | 26 + public/assets/plugins/angular-pdf/CONTRIBUTING.md | 25 + public/assets/plugins/angular-pdf/Gruntfile.js | 144 + public/assets/plugins/angular-pdf/LICENSE | 21 + public/assets/plugins/angular-pdf/bower.json | 16 + .../assets/plugins/angular-pdf/dist/angular-pdf.js | 142 + .../plugins/angular-pdf/dist/angular-pdf.min.js | 2 + .../assets/plugins/angular-pdf/example/index.html | 29 + .../angular-pdf/example/js/controllers/docCtrl.js | 25 + .../example/js/directives/angular-pdf.js | 137 + .../angular-pdf/example/js/lib/angular.min.js | 251 + .../angular-pdf/example/js/lib/angular.min.js.map | 8 + .../plugins/angular-pdf/example/js/lib/pdf.js | 8021 ++++ .../angular-pdf/example/js/lib/pdf.worker.js |39372 +++++++++++++++++++ .../angular-pdf/example/partials/viewer.html | 13 + .../pdf/4e99fa5a-1d29-4bf8-a083-48ab91f9a623.pdf | Bin 0 -> 12350 bytes .../plugins/angular-pdf/example/pdf/relativity.pdf | Bin 0 -> 409413 bytes .../assets/plugins/angular-pdf/example/style.css | 8 + public/assets/plugins/angular-pdf/ng-pdf.gif | Bin 0 -> 1458242 bytes public/assets/plugins/angular-pdf/readme.md | 219 + .../bootstrap-fileinput/bootstrap-fileinput.css | 110 + .../bootstrap-fileinput/bootstrap-fileinput.js | 198 + .../assets/plugins/jquery-multi-select/LICENSE.txt | 13 + .../plugins/jquery-multi-select/README.markdown | 3 + .../jquery-multi-select/css/multi-select.css | 98 + .../plugins/jquery-multi-select/img/switch.png | Bin 0 -> 236 bytes .../jquery-multi-select/img/switch_original.png | Bin 0 -> 3080 bytes .../jquery-multi-select/js/jquery.multi-select.js | 532 + public/assets/plugins/jquery.sparkline.min.js | 5 + public/assets/plugins/mxgraph/css/common.css | 152 + public/assets/plugins/mxgraph/css/explorer.css | 15 + public/assets/plugins/mxgraph/images/1x1.png | Bin 0 -> 95 bytes public/assets/plugins/mxgraph/images/checkmark.gif | Bin 0 -> 1253 bytes public/assets/plugins/mxgraph/images/clear.gif | Bin 0 -> 1114 bytes public/assets/plugins/mxgraph/images/close.png | Bin 0 -> 118 bytes public/assets/plugins/mxgraph/images/collapsed.gif | Bin 0 -> 67 bytes public/assets/plugins/mxgraph/images/connector.png | Bin 0 -> 250 bytes public/assets/plugins/mxgraph/images/expanded.gif | Bin 0 -> 64 bytes .../plugins/mxgraph/images/google-drive-20x20.png | Bin 0 -> 1736 bytes public/assets/plugins/mxgraph/images/grid.gif | Bin 0 -> 56 bytes .../assets/plugins/mxgraph/images/logo-small.gif | Bin 0 -> 1340 bytes public/assets/plugins/mxgraph/images/logo.png | Bin 0 -> 2935 bytes public/assets/plugins/mxgraph/images/nocolor.png | Bin 0 -> 948 bytes public/assets/plugins/mxgraph/images/submenu.gif | Bin 0 -> 56 bytes public/assets/plugins/mxgraph/images/tooltip.png | Bin 0 -> 1006 bytes .../plugins/mxgraph/images/touch-connector.png | Bin 0 -> 2489 bytes .../assets/plugins/mxgraph/images/touch-handle.png | Bin 0 -> 1617 bytes .../plugins/mxgraph/images/touch-submenu.png | Bin 0 -> 1046 bytes .../assets/plugins/mxgraph/images/transparent.gif | Bin 0 -> 90 bytes .../mxgraph/images/web/drawio-cloud-edit.png | Bin 0 -> 57767 bytes .../plugins/mxgraph/images/web/drawio-drive.png | Bin 0 -> 26388 bytes .../mxgraph/images/web/drawio-free-edit.png | Bin 0 -> 25466 bytes .../plugins/mxgraph/images/web/drawio-github.png | Bin 0 -> 23387 bytes .../plugins/mxgraph/images/web/drawio-menu.png | Bin 0 -> 22691 bytes .../mxgraph/images/web/drawio-puzzle-edit.png | Bin 0 -> 19961 bytes .../mxgraph/images/web/drawio-source-edit.png | Bin 0 -> 50031 bytes .../plugins/mxgraph/images/web/drawioscreen.png | Bin 0 -> 196129 bytes .../images/web/glyphicons_362_google+_alt.png | Bin 0 -> 1165 bytes .../mxgraph/images/web/glyphicons_381_github.png | Bin 0 -> 1085 bytes .../mxgraph/images/web/glyphicons_390_facebook.png | Bin 0 -> 1024 bytes .../mxgraph/images/web/glyphicons_392_twitter.png | Bin 0 -> 1126 bytes public/assets/plugins/mxgraph/js/Actions.js | 631 + public/assets/plugins/mxgraph/js/Dialogs.js | 949 + public/assets/plugins/mxgraph/js/Editor.js | 1033 + public/assets/plugins/mxgraph/js/EditorUi.js | 1317 + public/assets/plugins/mxgraph/js/Graph.js | 748 + public/assets/plugins/mxgraph/js/Menus.js | 716 + public/assets/plugins/mxgraph/js/Shapes.js | 1234 + public/assets/plugins/mxgraph/js/Sidebar.js | 903 + public/assets/plugins/mxgraph/js/Toolbar.js | 407 + public/assets/plugins/mxgraph/js/custom.js | 270 + public/assets/plugins/mxgraph/js/mxClient.js |18397 +++++++++ public/assets/plugins/mxgraph/resources/dia.txt | 255 + public/assets/plugins/mxgraph/resources/dia_am.txt | 255 + public/assets/plugins/mxgraph/resources/dia_ar.txt | 255 + public/assets/plugins/mxgraph/resources/dia_bg.txt | 255 + public/assets/plugins/mxgraph/resources/dia_bn.txt | 255 + public/assets/plugins/mxgraph/resources/dia_bs.txt | 255 + public/assets/plugins/mxgraph/resources/dia_ca.txt | 255 + public/assets/plugins/mxgraph/resources/dia_cs.txt | 255 + public/assets/plugins/mxgraph/resources/dia_da.txt | 255 + public/assets/plugins/mxgraph/resources/dia_de.txt | 255 + public/assets/plugins/mxgraph/resources/dia_el.txt | 255 + .../assets/plugins/mxgraph/resources/dia_es-AR.txt | 255 + public/assets/plugins/mxgraph/resources/dia_es.txt | 255 + public/assets/plugins/mxgraph/resources/dia_et.txt | 255 + public/assets/plugins/mxgraph/resources/dia_fa.txt | 255 + public/assets/plugins/mxgraph/resources/dia_fi.txt | 255 + .../assets/plugins/mxgraph/resources/dia_fil.txt | 255 + public/assets/plugins/mxgraph/resources/dia_fr.txt | 255 + public/assets/plugins/mxgraph/resources/dia_gu.txt | 255 + public/assets/plugins/mxgraph/resources/dia_he.txt | 255 + public/assets/plugins/mxgraph/resources/dia_hi.txt | 255 + public/assets/plugins/mxgraph/resources/dia_hr.txt | 255 + public/assets/plugins/mxgraph/resources/dia_hu.txt | 255 + public/assets/plugins/mxgraph/resources/dia_id.txt | 255 + public/assets/plugins/mxgraph/resources/dia_it.txt | 385 + public/assets/plugins/mxgraph/resources/dia_ja.txt | 255 + public/assets/plugins/mxgraph/resources/dia_kn.txt | 255 + public/assets/plugins/mxgraph/resources/dia_ko.txt | 255 + public/assets/plugins/mxgraph/resources/dia_lt.txt | 255 + public/assets/plugins/mxgraph/resources/dia_lv.txt | 255 + public/assets/plugins/mxgraph/resources/dia_ml.txt | 255 + public/assets/plugins/mxgraph/resources/dia_mr.txt | 255 + public/assets/plugins/mxgraph/resources/dia_ms.txt | 255 + public/assets/plugins/mxgraph/resources/dia_nl.txt | 255 + public/assets/plugins/mxgraph/resources/dia_no.txt | 255 + public/assets/plugins/mxgraph/resources/dia_pl.txt | 255 + .../assets/plugins/mxgraph/resources/dia_pt-br.txt | 255 + public/assets/plugins/mxgraph/resources/dia_pt.txt | 255 + public/assets/plugins/mxgraph/resources/dia_ro.txt | 255 + public/assets/plugins/mxgraph/resources/dia_ru.txt | 255 + public/assets/plugins/mxgraph/resources/dia_sk.txt | 255 + public/assets/plugins/mxgraph/resources/dia_sl.txt | 255 + public/assets/plugins/mxgraph/resources/dia_sr.txt | 255 + public/assets/plugins/mxgraph/resources/dia_sv.txt | 255 + public/assets/plugins/mxgraph/resources/dia_sw.txt | 255 + public/assets/plugins/mxgraph/resources/dia_ta.txt | 255 + public/assets/plugins/mxgraph/resources/dia_te.txt | 255 + public/assets/plugins/mxgraph/resources/dia_th.txt | 255 + public/assets/plugins/mxgraph/resources/dia_tr.txt | 255 + public/assets/plugins/mxgraph/resources/dia_uk.txt | 255 + public/assets/plugins/mxgraph/resources/dia_zh.txt | 255 + .../assets/plugins/mxgraph/resources/help_it.html | 10 + .../stencils/call_management/answer_128x128.png | Bin 0 -> 5966 bytes .../stencils/call_management/callback_128x128.png | Bin 0 -> 2377 bytes .../stencils/call_management/dial_128x128.png | Bin 0 -> 5782 bytes .../stencils/call_management/ext_dial_128x128.png | Bin 0 -> 5385 bytes .../stencils/call_management/hangup_128x128.png | Bin 0 -> 7477 bytes .../stencils/call_management/queue_128x128.png | Bin 0 -> 6290 bytes .../stencils/call_management/voicemail_128x128.png | Bin 0 -> 7469 bytes .../mxgraph/stencils/callflow/gotoc_128x128.png | Bin 0 -> 5581 bytes .../mxgraph/stencils/callflow/gotoif_128x128.png | Bin 0 -> 7130 bytes .../stencils/callflow/gotoifmultitime_128x128.png | Bin 0 -> 9851 bytes .../stencils/callflow/gotoiftime_128x128.png | Bin 0 -> 7388 bytes .../mxgraph/stencils/callflow/vswitch_128x128.png | Bin 0 -> 5410 bytes .../plugins/mxgraph/stencils/entry/end_128x128.png | Bin 0 -> 6551 bytes .../mxgraph/stencils/entry/finally_128x128.png | Bin 0 -> 7568 bytes .../mxgraph/stencils/entry/start_128x128.png | Bin 0 -> 5631 bytes public/assets/plugins/mxgraph/stencils/general.xml | 58 + .../mxgraph/stencils/general/agi_128x128.png | Bin 0 -> 4113 bytes .../stencils/general/custom_app_128x128.png | Bin 0 -> 5273 bytes .../mxgraph/stencils/general/noop_128x128.png | Bin 0 -> 5933 bytes .../stencils/general/subproject_128x128.png | Bin 0 -> 5143 bytes .../mxgraph/stencils/general/system_128x128.png | Bin 0 -> 5866 bytes .../stencils/integration_server/asr_128x128.png | Bin 0 -> 9355 bytes .../integration_server/database_128x128.png | Bin 0 -> 5900 bytes .../integration_server/ispeechasr_128x128.png | Bin 0 -> 4918 bytes .../stencils/playback/background_128x128.png | Bin 0 -> 6874 bytes .../stencils/playback/getdigits_128x128.png | Bin 0 -> 4864 bytes .../stencils/playback/ispeechtts_128x128.png | Bin 0 -> 4830 bytes .../mxgraph/stencils/playback/menu_128x128.png | Bin 0 -> 5010 bytes .../mxgraph/stencils/playback/playback_128x128.png | Bin 0 -> 4903 bytes .../stencils/playback/saydigits_128x128.png | Bin 0 -> 6105 bytes .../stencils/playback/saynumber_128x128.png | Bin 0 -> 7097 bytes .../stencils/playback/sayphonetic_128x128.png | Bin 0 -> 6642 bytes .../mxgraph/stencils/playback/tts_128x128.png | Bin 0 -> 5600 bytes .../mxgraph/stencils/recording/record_128x128.png | Bin 0 -> 5155 bytes .../mxgraph/stencils/stats/goal_128x128.png | Bin 0 -> 5807 bytes .../mxgraph/stencils/stats/queuelog_128x128.png | Bin 0 -> 4347 bytes .../mxgraph/stencils/variable/math_128x128.png | Bin 0 -> 6286 bytes .../mxgraph/stencils/variable/set_128x128.png | Bin 0 -> 5854 bytes public/assets/plugins/mxgraph/styles/custom.css | 45 + .../assets/plugins/mxgraph/styles/default-old.xml | 109 + public/assets/plugins/mxgraph/styles/default.xml | 230 + .../plugins/mxgraph/styles/grapheditor-ie6.css | 23 + .../assets/plugins/mxgraph/styles/grapheditor.css | 382 + public/assets/plugins/mxgraph/styles/ie6.min.css | 1 + .../plugins/mxgraph/styles/manual-colors.css | 69 + .../plugins/mxgraph/styles/manual-styles.css | 255 + public/assets/plugins/mxgraph/styles/sprites.png | Bin 0 -> 6286 bytes .../assets/plugins/mxgraph/styles/thumb_horz.png | Bin 0 -> 113 bytes .../plugins/mxgraph/styles/thumb_vertical.png | Bin 0 -> 122 bytes .../plugins/mxgraph/styles/web/bootstrap-extra.css | 510 + .../mxgraph/styles/web/bootstrap-responsive.css | 808 + .../styles/web/bootstrap-responsive.min.css | 9 + .../plugins/mxgraph/styles/web/bootstrap.css | 4960 +++ .../plugins/mxgraph/styles/web/bootstrap.min.css | 9 + .../styles/web/font-awesome/font-awesome-ie7.css | 645 + .../styles/web/font-awesome/font-awesome.css | 303 + .../styles/web/font-awesome/font/README.TXT | 8 + .../web/font-awesome/font/fontawesome-webfont.eot | Bin 0 -> 38708 bytes .../web/font-awesome/font/fontawesome-webfont.svg | 255 + .../web/font-awesome/font/fontawesome-webfont.ttf | Bin 0 -> 68476 bytes .../web/font-awesome/font/fontawesome-webfont.woff | Bin 0 -> 41752 bytes .../plugins/mxgraph/styles/web/static.min.css | 1 + .../mxgraph/styles/web/static.uncompressed.css | 107 + .../plugins/mxgraph/templates/images/aws1.png | Bin 0 -> 14950 bytes .../plugins/mxgraph/templates/images/bpmn1.png | Bin 0 -> 12907 bytes .../plugins/mxgraph/templates/images/compare1.png | Bin 0 -> 11640 bytes .../mxgraph/templates/images/flowchart1.png | Bin 0 -> 13007 bytes .../mxgraph/templates/images/flowchart2.png | Bin 0 -> 6606 bytes .../plugins/mxgraph/templates/images/gantt1.png | Bin 0 -> 15699 bytes .../plugins/mxgraph/templates/images/lean1.png | Bin 0 -> 17148 bytes .../plugins/mxgraph/templates/images/mindmap1.png | Bin 0 -> 30976 bytes .../plugins/mxgraph/templates/images/orgchart1.png | Bin 0 -> 17824 bytes .../plugins/mxgraph/templates/images/orgchart2.png | Bin 0 -> 14114 bytes .../plugins/mxgraph/templates/images/package1.png | Bin 0 -> 12484 bytes .../plugins/mxgraph/templates/images/pid1.png | Bin 0 -> 12276 bytes .../mxgraph/templates/images/plcladder1.png | Bin 0 -> 3315 bytes .../plugins/mxgraph/templates/images/seqdiag1.png | Bin 0 -> 10392 bytes .../plugins/mxgraph/templates/images/sitemap1.png | Bin 0 -> 18466 bytes .../plugins/mxgraph/templates/images/socnet1.png | Bin 0 -> 19817 bytes .../plugins/mxgraph/templates/images/stardelta.png | Bin 0 -> 7197 bytes .../mxgraph/templates/images/statemachine1.png | Bin 0 -> 15022 bytes .../plugins/mxgraph/templates/images/uml1.png | Bin 0 -> 6388 bytes .../plugins/mxgraph/templates/images/usecase1.png | Bin 0 -> 25313 bytes .../plugins/mxgraph/templates/images/venn1.png | Bin 0 -> 9761 bytes .../plugins/mxgraph/templates/images/wf1.png | Bin 0 -> 7413 bytes .../assets/plugins/mxgraph/templates/xml/aws1.xml | 1 + .../assets/plugins/mxgraph/templates/xml/bpmn1.xml | 1 + .../plugins/mxgraph/templates/xml/compare1.xml | 1 + .../plugins/mxgraph/templates/xml/flowchart1.xml | 1 + .../plugins/mxgraph/templates/xml/flowchart2.xml | 1 + .../plugins/mxgraph/templates/xml/gantt1.xml | 1 + .../assets/plugins/mxgraph/templates/xml/lean1.xml | 1 + .../plugins/mxgraph/templates/xml/mindmap1.xml | 1 + .../plugins/mxgraph/templates/xml/orgchart1.xml | 1 + .../plugins/mxgraph/templates/xml/orgchart2.xml | 1 + .../plugins/mxgraph/templates/xml/package1.xml | 1 + .../assets/plugins/mxgraph/templates/xml/pid1.xml | 1 + .../plugins/mxgraph/templates/xml/plcladder1.xml | 1 + .../plugins/mxgraph/templates/xml/seqdiag1.xml | 1 + .../plugins/mxgraph/templates/xml/sitemap1.xml | 1 + .../plugins/mxgraph/templates/xml/socnet1.xml | 1 + .../plugins/mxgraph/templates/xml/stardelta.xml | 1 + .../mxgraph/templates/xml/statemachine1.xml | 1 + .../assets/plugins/mxgraph/templates/xml/uml1.xml | 1 + .../plugins/mxgraph/templates/xml/usecase1.xml | 1 + .../assets/plugins/mxgraph/templates/xml/venn1.xml | 1 + .../assets/plugins/mxgraph/templates/xml/wf1.xml | 1 + public/assets/plugins/ui-select/select.min.css | 221 + public/assets/plugins/ui-select/select.min.js | 2050 + public/assets/scripts/charts-flotcharts.js | 899 + public/assets/scripts/components-dropdowns.js | 464 + public/assets/scripts/datatable.js | 318 + public/assets/scripts/form-wizard-agent.js | 254 + public/assets/scripts/global/layout.js | 608 + public/assets/scripts/global/metronic.js | 953 + public/assets/scripts/inbox-fax.js | 332 + public/assets/scripts/inbox.js | 335 + public/assets/scripts/index.js | 645 + .../assets/scripts/jquery-ui-1.10.3.custom.min.js | 7 + public/assets/scripts/jquery.cokie.min.js | 9 + public/assets/scripts/jquery.sparkline.min.js | 5 + public/assets/scripts/login-soft.js | 249 + public/assets/scripts/portfolio.js | 12 + public/assets/scripts/profile.js | 77 + public/assets/scripts/table-ajax.js | 82 + public/assets/scripts/tasks.js | 19 + public/bower_components/Chart.js/Chart.js | 3477 ++ public/bower_components/Sortable/Sortable.js | 1144 + .../bower_components/Sortable/knockout-sortable.js | 161 + public/bower_components/Sortable/ng-sortable.js | 185 + .../Sortable/react-sortable-mixin.js | 157 + .../adf-structures-base/adf-structures-base.js | 116 + .../adf-widget-clock/adf-widget-clock.css | 11 + .../adf-widget-clock/adf-widget-clock.js | 67 + .../adf-widget-iframe/adf-widget-iframe.css | 6 + .../adf-widget-iframe/adf-widget-iframe.js | 28 + .../angular-animate/angular-animate.js | 3930 ++ .../angular-audio/angular.audio.js | 490 + .../bootstrap-colorpicker-module.js | 567 + .../angular-bootstrap-colorpicker/colorpicker.css | 169 + .../angular-bootstrap-contextmenu/contextMenu.js | 89 + .../angular-bootstrap-switch.js | 252 + .../angular-bootstrap/ui-bootstrap-tpls.js | 8503 ++++ .../angular-chart.js/angular-chart.css | 49 + .../angular-chart.js/angular-chart.js | 360 + .../angular-cookies/angular-cookies.js | 321 + .../angular-dashboard-framework.css | 83 + .../angular-dashboard-framework.js | 1241 + .../angular-file-upload/angular-file-upload.min.js | 7 + .../angular-filter/angular-filter.min.js | 6 + .../angular-local-storage/angular-local-storage.js | 449 + public/bower_components/angular-md5/angular-md5.js | 208 + .../angular-mocks/angular-mocks.js | 2471 ++ .../angular-notification/angular-notification.js | 170 + .../angular-resource/angular-resource.js | 684 + .../angular-sanitize/angular-sanitize.js | 683 + .../angular-scenario/angular-scenario.js |40439 ++++++++++++++++++++ .../angular-smart-table/smart-table.js | 527 + .../bower_components/angular-socket-io/socket.js | 103 + .../angular-toastr/angular-toastr.css | 203 + .../angular-toastr/angular-toastr.tpls.js | 485 + .../angular-touch/angular-touch.js | 628 + .../angular-translate-loader-static-files.js | 114 + .../angular-translate-storage-cookie.js | 97 + .../angular-translate-storage-local.js | 123 + .../angular-translate/angular-translate.js | 2904 ++ .../bower_components/angular-truncate/truncate.js | 49 + .../angular-ui-notification.min.css | 8 + .../angular-ui-notification.min.js | 8 + .../angular-ui-router/angular-ui-router.js | 4370 +++ .../angular-ui-sortable/sortable.js | 361 + .../angular-wizard/angular-wizard.min.css | 1 + .../angular-wizard/angular-wizard.min.js | 7 + .../angular-xeditable/xeditable.css | 7 + .../angular-xeditable/xeditable.js | 2227 ++ public/bower_components/angular/angular.js |29018 ++++++++++++++ public/bower_components/animate.css/animate.css | 3272 ++ public/bower_components/blockUI/jquery.blockUI.js | 620 + .../bootstrap-hover-dropdown.js | 124 + .../bootstrap-select/bootstrap-select.css | 272 + .../bootstrap-select/bootstrap-select.js | 1660 + .../bootstrap-select/bootstrap-select.less | 343 + .../bootstrap-switch/bootstrap-switch.css | 196 + .../bootstrap-switch/bootstrap-switch.js | 710 + public/bower_components/bootstrap/bootstrap.js | 2363 ++ public/bower_components/bootstrap/bootstrap.less | 56 + .../checklist-model/checklist-model.js | 134 + public/bower_components/css-spinners/atebits.css | 306 + public/bower_components/css-spinners/ball.css | 373 + public/bower_components/css-spinners/circles.css | 71 + public/bower_components/css-spinners/dots.css | 196 + public/bower_components/css-spinners/flower.css | 69 + public/bower_components/css-spinners/gauge.css | 277 + public/bower_components/css-spinners/heartbeat.css | 125 + public/bower_components/css-spinners/hexdots.css | 196 + .../bower_components/css-spinners/hole-pulse.css | 60 + .../css-spinners/inner-circles.css | 97 + .../bower_components/css-spinners/plus-loader.css | 69 + public/bower_components/css-spinners/plus.css | 671 + public/bower_components/css-spinners/pong.css | 274 + public/bower_components/css-spinners/pulse.css | 60 + .../bower_components/css-spinners/refreshing.css | 64 + public/bower_components/css-spinners/spinner.css | 53 + public/bower_components/css-spinners/spinners.css | 3382 ++ public/bower_components/css-spinners/spinners.scss | 19 + .../css-spinners/three-quarters.css | 50 + public/bower_components/css-spinners/throbber.css | 67 + public/bower_components/css-spinners/timer.css | 90 + public/bower_components/css-spinners/whirly.css | 57 + public/bower_components/css-spinners/wobblebar.css | 269 + public/bower_components/es5-shim/es5-shim.js | 1613 + .../font-awesome/font-awesome.less | 17 + .../font-awesome/font-awesome.scss | 17 + public/bower_components/highlightjs/default.css | 155 + .../bower_components/highlightjs/highlight.pack.js |13562 +++++++ .../jquery-backstretch/jquery.backstretch.js | 377 + .../jquery-cookie/jquery.cookie.js | 117 + public/bower_components/jquery-migrate/.bower.json | 14 + public/bower_components/jquery-migrate/README.md | 12 + .../bower_components/jquery-migrate/component.json | 4 + .../jquery-migrate/jquery-migrate.js | 521 + .../jquery-migrate/jquery-migrate.min.js | 2 + .../jquery-mousewheel/jquery.mousewheel.js | 221 + .../bower_components/jquery-slimscroll/.bower.json | 14 + .../bower_components/jquery-slimscroll/README.md | 8 + .../examples/allow-page-scroll.html | 94 + .../jquery-slimscroll/examples/chaining.html | 80 + .../examples/disable-fade-out.html | 94 + .../examples/dynamic-content.html | 81 + .../jquery-slimscroll/examples/height-width.html | 125 + .../jquery-slimscroll/examples/index.html | 9 + .../examples/libs/prettify/prettify.css | 52 + .../examples/libs/prettify/prettify.js | 1477 + .../jquery-slimscroll/examples/mouse-wheel.html | 99 + .../examples/multiple-elements.html | 120 + .../jquery-slimscroll/examples/navigation.html | 30 + .../jquery-slimscroll/examples/nested.html | 82 + .../examples/programmatic-scrolling.html | 138 + .../jquery-slimscroll/examples/rail.html | 190 + .../jquery-slimscroll/examples/scroll-events.html | 88 + .../jquery-slimscroll/examples/scrollbar.html | 189 + .../jquery-slimscroll/examples/start-position.html | 100 + .../jquery-slimscroll/examples/style.css | 13 + .../jquery-slimscroll/jquery.slimscroll.js | 474 + .../jquery-slimscroll/jquery.slimscroll.min.js | 16 + .../jquery-slimscroll/package.json | 31 + public/bower_components/jquery-ui/jquery-ui.js |16617 ++++++++ .../jquery-validation/jquery.validate.js | 1398 + .../jquery.actual/jquery.actual.js | 107 + public/bower_components/jquery/jquery.js | 9210 +++++ public/bower_components/json3/json3.js | 902 + public/bower_components/lodash/lodash.js |12352 ++++++ .../jquery.mCustomScrollbar.css | 1267 + .../jquery.mCustomScrollbar.js | 2425 ++ .../mCSB_buttons.png | Bin 0 -> 2998 bytes public/bower_components/moment/moment.js | 3195 ++ public/bower_components/ng-csv/ng-csv.min.js | 2 + public/bower_components/ng-emoticons/emojis.png | Bin 0 -> 792641 bytes public/bower_components/ng-emoticons/emojis@2x.png | Bin 0 -> 2366542 bytes public/bower_components/ng-emoticons/emoticons.eot | Bin 0 -> 13168 bytes public/bower_components/ng-emoticons/emoticons.svg | 44 + public/bower_components/ng-emoticons/emoticons.ttf | Bin 0 -> 13004 bytes .../bower_components/ng-emoticons/emoticons.woff | Bin 0 -> 13080 bytes public/bower_components/ng-emoticons/loader.svg | 17 + .../bower_components/ng-emoticons/ng-emoticons.css | 3843 ++ .../bower_components/ng-emoticons/ng-emoticons.js | 547 + .../ng-remote-validate/ngRemoteValidate.js | 165 + .../ng-scrollbars/scrollbars.min.js | 1 + .../ng-slide-down/ng-slide-down.js | 109 + .../ngInfiniteScroll/ng-infinite-scroll.js | 61 + public/bower_components/ngmap/ng-map.js | 2776 ++ public/bower_components/oclazyload/ocLazyLoad.js | 1338 + public/bower_components/pdfjs-dist/pdf.js | 8268 ++++ public/bower_components/pdfjs-dist/pdf.worker.js |39826 +++++++++++++++++++ .../bower_components/rangy/rangy-classapplier.js | 1103 + public/bower_components/rangy/rangy-core.js | 3845 ++ public/bower_components/rangy/rangy-highlighter.js | 620 + .../rangy/rangy-selectionsaverestore.js | 252 + public/bower_components/rangy/rangy-serializer.js | 314 + public/bower_components/rangy/rangy-textrange.js | 1930 + public/bower_components/select2/core.scss | 48 + public/bower_components/select2/select2.js | 5570 +++ .../simple-line-icons/Simple-Line-Icons.eot | Bin 0 -> 53572 bytes .../simple-line-icons/Simple-Line-Icons.svg | 211 + .../simple-line-icons/Simple-Line-Icons.ttf | Bin 0 -> 53368 bytes .../simple-line-icons/Simple-Line-Icons.woff | Bin 0 -> 53444 bytes .../simple-line-icons/Simple-Line-Icons.woff2 | Bin 0 -> 26384 bytes .../simple-line-icons/simple-line-icons.css | 758 + .../simple-line-icons/simple-line-icons.less | 952 + .../simple-line-icons/simple-line-icons.scss | 949 + public/bower_components/sprintf/sprintf.js | 208 + .../textAngular/textAngular-sanitize.js | 783 + .../bower_components/textAngular/textAngular.css | 193 + public/bower_components/textAngular/textAngular.js | 3068 ++ .../textAngular/textAngularSetup.js | 834 + .../time-elements/time-elements.js | 525 + public/bower_components/ui-navbar/ui-navbar.js | 63 + public/bower_components/ui-select/select.css | 267 + public/bower_components/ui-select/select.js | 1926 + .../webcomponentsjs/webcomponents.js | 7177 ++++ public/favicon.ico | Bin 0 -> 1150 bytes public/index.html | 74 + public/robots.txt | 3 + release-notes/changelog_0.0.1.txt | 57 + server/api/agent/agent.controller.js | 279 + server/api/agent/agent.socket.js | 33 + server/api/agent/agent.spec.js | 20 + server/api/agent/index.js | 21 + server/api/ami/ami.ami.js | 37 + server/api/ami/ami.controller.js | 101 + server/api/ami/ami.socket.js | 24 + server/api/ami/ami.spec.js | 20 + server/api/ami/index.js | 16 + server/api/automation/automation.controller.js | 168 + server/api/automation/automation.socket.js | 24 + server/api/automation/automation.spec.js | 20 + server/api/automation/index.js | 17 + .../business_action/business_action.controller.js | 94 + .../api/business_action/business_action.socket.js | 24 + server/api/business_action/business_action.spec.js | 20 + server/api/business_action/index.js | 15 + .../business_condition.controller.js | 93 + .../business_condition.socket.js | 24 + .../business_condition/business_condition.spec.js | 20 + server/api/business_condition/index.js | 15 + .../chat_application.controller.js | 105 + .../chat_application/chat_application.socket.js | 24 + .../api/chat_application/chat_application.spec.js | 20 + server/api/chat_application/index.js | 15 + server/api/chat_enquiry/enquiry.controller.js | 99 + server/api/chat_enquiry/enquiry.socket.js | 24 + server/api/chat_enquiry/enquiry.spec.js | 20 + server/api/chat_enquiry/index.js | 15 + server/api/chat_message/chat_message.controller.js | 269 + server/api/chat_message/chat_message.socket.js | 77 + server/api/chat_message/chat_message.spec.js | 20 + server/api/chat_message/index.js | 16 + server/api/chat_queue/chat_queue.controller.js | 240 + server/api/chat_queue/chat_queue.socket.js | 24 + server/api/chat_queue/chat_queue.spec.js | 20 + server/api/chat_queue/index.js | 20 + server/api/chat_room/chat_room.controller.js | 459 + server/api/chat_room/chat_room.controller.js.back | 286 + server/api/chat_room/chat_room.socket.js | 30 + server/api/chat_room/chat_room.spec.js | 20 + server/api/chat_room/index.js | 20 + server/api/chat_visitor/chat_visitor.controller.js | 94 + server/api/chat_visitor/chat_visitor.socket.js | 27 + server/api/chat_visitor/chat_visitor.spec.js | 20 + server/api/chat_visitor/index.js | 15 + server/api/chat_website/chat_website.controller.js | 281 + server/api/chat_website/chat_website.socket.js | 24 + server/api/chat_website/chat_website.spec.js | 20 + server/api/chat_website/index.js | 19 + server/api/contact/contact.controller.js | 85 + server/api/contact/contact.model.js | 13 + server/api/contact/contact.socket.js | 24 + server/api/contact/contact.spec.js | 20 + server/api/contact/index.js | 15 + server/api/dashboard/dashboard.controller.js | 178 + server/api/dashboard/dashboard.socket.js | 27 + server/api/dashboard/dashboard.spec.js | 20 + server/api/dashboard/index.js | 18 + server/api/event/event.controller.js | 119 + server/api/event/event.socket.js | 36 + server/api/event/event.spec.js | 20 + server/api/event/index.js | 16 + server/api/fax_account/fax_account.controller.js | 374 + server/api/fax_account/fax_account.socket.js | 24 + server/api/fax_account/fax_account.spec.js | 20 + server/api/fax_account/index.js | 17 + .../fax_application/fax_application.controller.js | 94 + .../api/fax_application/fax_application.socket.js | 24 + server/api/fax_application/fax_application.spec.js | 20 + server/api/fax_application/index.js | 15 + .../fax_business_automation.controller.js | 204 + .../fax_business_automation.socket.js | 27 + .../fax_business_automation.spec.js | 20 + server/api/fax_business_automation/index.js | 15 + server/api/fax_message/fax_message.ami.js | 64 + server/api/fax_message/fax_message.controller.js | 422 + server/api/fax_message/fax_message.socket.js | 85 + server/api/fax_message/fax_message.spec.js | 20 + server/api/fax_message/index.js | 16 + server/api/fax_queue/fax_queue.controller.js | 222 + server/api/fax_queue/fax_queue.socket.js | 24 + server/api/fax_queue/fax_queue.spec.js | 20 + server/api/fax_queue/index.js | 18 + server/api/fax_room/fax_room.controller.js | 151 + server/api/fax_room/fax_room.kue.js | 64 + server/api/fax_room/fax_room.socket.js | 24 + server/api/fax_room/fax_room.spec.js | 20 + server/api/fax_room/index.js | 16 + server/api/integration/index.js | 15 + server/api/integration/integration.controller.js | 177 + server/api/integration/integration.socket.js | 24 + server/api/integration/integration.spec.js | 20 + server/api/interval/index.js | 18 + server/api/interval/interval.controller.js | 324 + server/api/interval/interval.socket.js | 31 + server/api/interval/interval.spec.js | 20 + server/api/mail_account/index.js | 18 + server/api/mail_account/mail_account.controller.js | 327 + server/api/mail_account/mail_account.socket.js | 27 + server/api/mail_account/mail_account.spec.js | 20 + server/api/mail_application/index.js | 15 + .../mail_application.controller.js | 111 + .../mail_application/mail_application.socket.js | 24 + .../api/mail_application/mail_application.spec.js | 20 + server/api/mail_attachment/index.js | 15 + .../mail_attachment/mail_attachment.controller.js | 87 + .../api/mail_attachment/mail_attachment.socket.js | 24 + server/api/mail_attachment/mail_attachment.spec.js | 20 + server/api/mail_business_automation/index.js | 16 + .../mail_business_automation.controller.js | 218 + .../mail_business_automation.socket.js | 28 + .../mail_business_automation.spec.js | 20 + server/api/mail_message/index.js | 20 + server/api/mail_message/mail_message.controller.js | 271 + server/api/mail_message/mail_message.socket.js | 34 + server/api/mail_message/mail_message.spec.js | 20 + server/api/mail_queue/index.js | 18 + server/api/mail_queue/mail_queue.controller.js | 216 + server/api/mail_queue/mail_queue.socket.js | 30 + server/api/mail_queue/mail_queue.spec.js | 20 + server/api/mail_room/index.js | 17 + server/api/mail_room/mail_room.controller.js | 205 + server/api/mail_room/mail_room.kue.js | 66 + server/api/mail_room/mail_room.socket.js | 48 + server/api/mail_room/mail_room.spec.js | 20 + server/api/mail_server_in/index.js | 15 + .../mail_server_in/mail_server_in.controller.js | 85 + server/api/mail_server_in/mail_server_in.socket.js | 27 + server/api/mail_server_in/mail_server_in.spec.js | 20 + server/api/mail_server_out/index.js | 15 + .../mail_server_out/mail_server_out.controller.js | 96 + .../api/mail_server_out/mail_server_out.socket.js | 26 + server/api/mail_server_out/mail_server_out.spec.js | 20 + server/api/mail_template/index.js | 15 + .../api/mail_template/mail_template.controller.js | 158 + server/api/mail_template/mail_template.socket.js | 24 + server/api/mail_template/mail_template.spec.js | 20 + server/api/module/index.js | 15 + server/api/module/module.controller.js | 92 + server/api/module/module.socket.js | 24 + server/api/module/module.spec.js | 20 + server/api/module/setting/index.js | 15 + server/api/module/setting/setting.controller.js | 110 + server/api/module/setting/setting.socket.js | 24 + server/api/module/setting/setting.spec.js | 20 + server/api/motionbar/index.js | 11 + server/api/motionbar/motionbar.controller.js | 32 + server/api/motionbar/motionbar.socket.js | 27 + server/api/motionbar/motionbar.spec.js | 20 + server/api/report_agent/index.js | 15 + server/api/report_agent/report_agent.controller.js | 93 + server/api/report_agent/report_agent.socket.js | 50 + server/api/report_chat/index.js | 15 + server/api/report_chat/report_chat.controller.js | 98 + server/api/report_chat/report_chat.socket.js | 35 + server/api/report_chat/report_chat.spec.js | 20 + server/api/report_chat_session/index.js | 15 + .../report_chat_session.controller.js | 93 + .../report_chat_session.socket.js | 27 + .../report_chat_session.spec.js | 20 + server/api/report_mail/index.js | 15 + server/api/report_mail/report_mail.controller.js | 93 + server/api/report_mail/report_mail.socket.js | 35 + server/api/report_mail/report_mail.spec.js | 20 + server/api/report_mail_session/index.js | 15 + .../report_mail_session.controller.js | 93 + .../report_mail_session.socket.js | 27 + .../report_mail_session.spec.js | 20 + server/api/report_queue/index.js | 15 + server/api/report_queue/report_queue.controller.js | 93 + server/api/report_queue/report_queue.socket.js | 29 + server/api/setting/index.js | 17 + server/api/setting/setting.controller.js | 140 + server/api/setting/setting.socket.js | 24 + server/api/setting/setting.spec.js | 20 + server/api/square_odbc/index.js | 17 + server/api/square_odbc/square_odbc.controller.js | 209 + server/api/square_odbc/square_odbc.socket.js | 24 + server/api/square_odbc/square_odbc.spec.js | 20 + server/api/square_project/index.js | 19 + .../square_project/square_project.controller.js | 211 + server/api/square_project/square_project.socket.js | 27 + server/api/square_project/square_project.spec.js | 20 + server/api/team/index.js | 19 + server/api/team/team.controller.js | 232 + server/api/team/team.socket.js | 27 + server/api/team/team.spec.js | 20 + server/api/thing/index.js | 15 + server/api/thing/thing.controller.js | 98 + server/api/thing/thing.socket.js | 27 + server/api/thing/thing.spec.js | 20 + server/api/trigger/index.js | 17 + server/api/trigger/trigger.controller.js | 168 + server/api/trigger/trigger.socket.js | 24 + server/api/trigger/trigger.spec.js | 20 + server/api/trunk/index.js | 18 + server/api/trunk/trunk.ami.js | 90 + server/api/trunk/trunk.controller.js | 298 + server/api/trunk/trunk.socket.js | 24 + server/api/trunk/trunk.spec.js | 20 + server/api/upload/index.js | 17 + server/api/upload/upload.controller.js | 269 + server/api/upload/upload.socket.js | 24 + server/api/upload/upload.spec.js | 20 + server/api/user/index.js | 25 + server/api/user/user.ami.js | 71 + server/api/user/user.controller.js | 447 + server/api/user/user.socket.js | 31 + server/api/user/user.spec.js | 20 + server/api/user_has_chat_queue/index.js | 15 + .../user_has_chat_queue.controller.js | 103 + .../user_has_chat_queue.socket.js | 24 + .../user_has_chat_queue.spec.js | 20 + server/api/user_has_chat_room/index.js | 16 + .../user_has_chat_room.controller.js | 96 + .../user_has_chat_room.socket.js | 48 + .../user_has_chat_room/user_has_chat_room.spec.js | 20 + server/api/user_has_fax_queue/index.js | 15 + .../user_has_fax_queue.controller.js | 103 + .../user_has_fax_queue.socket.js | 30 + .../user_has_fax_queue/user_has_fax_queue.spec.js | 20 + server/api/user_has_mail_queue/index.js | 15 + .../user_has_mail_queue.controller.js | 95 + .../user_has_mail_queue.socket.js | 34 + .../user_has_mail_queue.spec.js | 20 + server/api/user_has_team/index.js | 15 + .../api/user_has_team/user_has_team.controller.js | 96 + server/api/user_has_team/user_has_team.model.js | 13 + server/api/user_has_team/user_has_team.socket.js | 24 + server/api/user_has_team/user_has_team.spec.js | 20 + server/api/user_has_voice_queue/index.js | 15 + .../user_has_voice_queue.controller.js | 98 + .../user_has_voice_queue.socket.js | 41 + .../user_has_voice_queue.spec.js | 20 + server/api/variable/index.js | 18 + server/api/variable/variable.controller.js | 220 + server/api/variable/variable.socket.js | 24 + server/api/variable/variable.spec.js | 20 + server/api/voice_context/index.js | 16 + server/api/voice_context/voice_context.ami.js | 71 + .../api/voice_context/voice_context.controller.js | 282 + server/api/voice_context/voice_context.socket.js | 24 + server/api/voice_context/voice_context.spec.js | 20 + server/api/voice_extension/index.js | 22 + .../voice_extension/voice_extension.controller.js | 1382 + .../api/voice_extension/voice_extension.socket.js | 34 + server/api/voice_extension/voice_extension.spec.js | 20 + server/api/voice_musiconhold/index.js | 21 + .../voice_musiconhold.controller.js | 357 + .../voice_musiconhold/voice_musiconhold.socket.js | 24 + .../voice_musiconhold/voice_musiconhold.spec.js | 20 + server/api/voice_queue/index.js | 19 + server/api/voice_queue/voice_queue.controller.js | 339 + server/api/voice_queue/voice_queue.socket.js | 24 + server/api/voice_queue/voice_queue.spec.js | 20 + server/api/voice_voicemail/index.js | 21 + .../voice_voicemail/voice_voicemail.controller.js | 298 + .../api/voice_voicemail/voice_voicemail.socket.js | 39 + server/api/voice_voicemail/voice_voicemail.spec.js | 20 + server/api/widget/index.js | 19 + server/api/widget/widget.controller.js | 181 + server/api/widget/widget.spec.js | 20 + server/api/xchatty/index.js | 29 + server/api/xchatty/xchatty.controller.js | 548 + server/api/xchatty/xchatty.socket.js | 24 + server/api/xchatty/xchatty.spec.js | 20 + server/api/zendesk_account/index.js | 19 + .../zendesk_account/zendesk_account.controller.js | 225 + .../api/zendesk_account/zendesk_account.socket.js | 24 + server/api/zendesk_account/zendesk_account.spec.js | 20 + server/api/zendesk_configuration/index.js | 16 + .../zendesk_configuration.controller.js | 129 + .../zendesk_configuration.socket.js | 24 + .../zendesk_configuration.spec.js | 20 + server/api/zendesk_field/index.js | 18 + .../api/zendesk_field/zendesk_field.controller.js | 121 + server/api/zendesk_field/zendesk_field.socket.js | 24 + server/api/zendesk_field/zendesk_field.spec.js | 20 + server/api/zendesk_text/index.js | 15 + server/api/zendesk_text/zendesk_text.controller.js | 93 + server/api/zendesk_text/zendesk_text.socket.js | 24 + server/api/zendesk_text/zendesk_text.spec.js | 20 + server/app.js | 177 + server/auth/auth.service.js | 90 + server/auth/facebook/index.js | 21 + server/auth/facebook/passport.js | 37 + server/auth/google/index.js | 24 + server/auth/google/passport.js | 33 + server/auth/index.js | 22 + server/auth/local/index.js | 92 + server/auth/local/local.ami.js | 51 + server/auth/local/passport.js | 96 + server/auth/twitter/index.js | 20 + server/auth/twitter/passport.js | 35 + server/components/errors/index.js | 20 + .../xchatty/assets/common/in_progress.gif | Bin 0 -> 404 bytes .../components/xchatty/assets/common/loading.gif | Bin 0 -> 673 bytes .../assets/common/logo-clientengage-large.png | Bin 0 -> 12368 bytes .../xchatty/assets/common/logo-clientengage.png | Bin 0 -> 2177 bytes server/components/xchatty/assets/icons/accept.png | Bin 0 -> 781 bytes server/components/xchatty/assets/icons/add.png | Bin 0 -> 733 bytes .../xchatty/assets/icons/arrow_refresh.png | Bin 0 -> 685 bytes server/components/xchatty/assets/icons/attach.png | Bin 0 -> 391 bytes server/components/xchatty/assets/icons/bell.png | Bin 0 -> 789 bytes .../components/xchatty/assets/icons/bin_closed.png | Bin 0 -> 363 bytes .../xchatty/assets/icons/bullet_arrow_down.png | Bin 0 -> 201 bytes .../xchatty/assets/icons/bullet_arrow_up.png | Bin 0 -> 201 bytes .../xchatty/assets/icons/bullet_green.png | Bin 0 -> 295 bytes .../components/xchatty/assets/icons/bullet_red.png | Bin 0 -> 287 bytes .../xchatty/assets/icons/bullet_star.png | Bin 0 -> 331 bytes .../xchatty/assets/icons/bullet_toggle_minus.png | Bin 0 -> 207 bytes .../xchatty/assets/icons/bullet_toggle_plus.png | Bin 0 -> 209 bytes server/components/xchatty/assets/icons/cancel.png | Bin 0 -> 587 bytes .../xchatty/assets/icons/chart_curve.png | Bin 0 -> 710 bytes server/components/xchatty/assets/icons/clock.png | Bin 0 -> 882 bytes server/components/xchatty/assets/icons/cog.png | Bin 0 -> 512 bytes server/components/xchatty/assets/icons/comment.png | Bin 0 -> 413 bytes .../xchatty/assets/icons/comment_add.png | Bin 0 -> 530 bytes .../xchatty/assets/icons/comments_add.png | Bin 0 -> 648 bytes .../xchatty/assets/icons/control_pause.png | Bin 0 -> 598 bytes .../xchatty/assets/icons/database_key.png | Bin 0 -> 764 bytes server/components/xchatty/assets/icons/date.png | Bin 0 -> 626 bytes .../components/xchatty/assets/icons/date_next.png | Bin 0 -> 688 bytes .../xchatty/assets/icons/date_previous.png | Bin 0 -> 720 bytes server/components/xchatty/assets/icons/delete.png | Bin 0 -> 715 bytes server/components/xchatty/assets/icons/disk.png | Bin 0 -> 620 bytes .../components/xchatty/assets/icons/door_out.png | Bin 0 -> 688 bytes server/components/xchatty/assets/icons/email.png | Bin 0 -> 641 bytes server/components/xchatty/assets/icons/error.png | Bin 0 -> 666 bytes .../xchatty/assets/icons/exclamation.png | Bin 0 -> 701 bytes server/components/xchatty/assets/icons/eye.png | Bin 0 -> 750 bytes server/components/xchatty/assets/icons/film.png | Bin 0 -> 653 bytes .../components/xchatty/assets/icons/folder_go.png | Bin 0 -> 694 bytes .../xchatty/assets/icons/folder_user.png | Bin 0 -> 730 bytes .../xchatty/assets/icons/folder_wrench.png | Bin 0 -> 740 bytes server/components/xchatty/assets/icons/group.png | Bin 0 -> 753 bytes server/components/xchatty/assets/icons/help.png | Bin 0 -> 786 bytes .../xchatty/assets/icons/information.png | Bin 0 -> 778 bytes server/components/xchatty/assets/icons/key.png | Bin 0 -> 612 bytes server/components/xchatty/assets/icons/layout.png | Bin 0 -> 480 bytes .../xchatty/assets/icons/layout_content.png | Bin 0 -> 519 bytes .../xchatty/assets/icons/layout_link.png | Bin 0 -> 660 bytes .../components/xchatty/assets/icons/lightning.png | Bin 0 -> 634 bytes server/components/xchatty/assets/icons/link_go.png | Bin 0 -> 655 bytes server/components/xchatty/assets/icons/lock.png | Bin 0 -> 749 bytes .../components/xchatty/assets/icons/magnifier.png | Bin 0 -> 615 bytes server/components/xchatty/assets/icons/music.png | Bin 0 -> 385 bytes server/components/xchatty/assets/icons/new.png | Bin 0 -> 378 bytes .../components/xchatty/assets/icons/page_white.png | Bin 0 -> 294 bytes .../xchatty/assets/icons/page_white_acrobat.png | Bin 0 -> 591 bytes .../xchatty/assets/icons/page_white_camera.png | Bin 0 -> 656 bytes .../xchatty/assets/icons/page_white_compressed.png | Bin 0 -> 724 bytes .../xchatty/assets/icons/page_white_excel.png | Bin 0 -> 663 bytes .../xchatty/assets/icons/page_white_picture.png | Bin 0 -> 650 bytes .../xchatty/assets/icons/page_white_powerpoint.png | Bin 0 -> 588 bytes .../xchatty/assets/icons/page_white_text.png | Bin 0 -> 342 bytes .../xchatty/assets/icons/page_white_word.png | Bin 0 -> 651 bytes server/components/xchatty/assets/icons/pencil.png | Bin 0 -> 450 bytes server/components/xchatty/assets/icons/readme.txt | 22 + server/components/xchatty/assets/icons/report.png | Bin 0 -> 649 bytes .../components/xchatty/assets/icons/report_add.png | Bin 0 -> 714 bytes .../components/xchatty/assets/icons/report_go.png | Bin 0 -> 756 bytes .../xchatty/assets/icons/script_code.png | Bin 0 -> 859 bytes server/components/xchatty/assets/icons/star.png | Bin 0 -> 670 bytes server/components/xchatty/assets/icons/table.png | Bin 0 -> 566 bytes .../components/xchatty/assets/icons/table_gear.png | Bin 0 -> 714 bytes .../components/xchatty/assets/icons/table_go.png | Bin 0 -> 683 bytes .../xchatty/assets/icons/textfield_delete.png | Bin 0 -> 335 bytes server/components/xchatty/assets/icons/tick.png | Bin 0 -> 537 bytes server/components/xchatty/assets/icons/time.png | Bin 0 -> 793 bytes .../xchatty/assets/icons/timeline_marker.png | Bin 0 -> 327 bytes server/components/xchatty/assets/icons/vcard.png | Bin 0 -> 533 bytes .../xchatty/assets/icons/wrench_orange.png | Bin 0 -> 584 bytes .../xchatty/assets/images/bullet_clock.png | Bin 0 -> 413 bytes .../xchatty/assets/images/bullet_pencil.png | Bin 0 -> 458 bytes .../xchatty/assets/images/bullet_tick.png | Bin 0 -> 252 bytes .../xchatty/assets/images/icon_visitorchat.png | Bin 0 -> 432 bytes .../components/xchatty/assets/images/loading.gif | Bin 0 -> 2906 bytes server/components/xchatty/assets/js/jquery.min.js | 5 + .../xchatty/assets/notification/xc_blubb.mp3 | Bin 0 -> 5913 bytes .../xchatty/assets/notification/xc_blubb.ogg | Bin 0 -> 9616 bytes .../xchatty/assets/notification/xc_blubb.wav | Bin 0 -> 53294 bytes .../components/xchatty/assets/smilies/biggrin.png | Bin 0 -> 1983 bytes .../components/xchatty/assets/smilies/confused.png | Bin 0 -> 1988 bytes server/components/xchatty/assets/smilies/cool.png | Bin 0 -> 1942 bytes server/components/xchatty/assets/smilies/cry.png | Bin 0 -> 2058 bytes server/components/xchatty/assets/smilies/eek.png | Bin 0 -> 1722 bytes server/components/xchatty/assets/smilies/evil.png | Bin 0 -> 1999 bytes server/components/xchatty/assets/smilies/like.png | Bin 0 -> 1894 bytes server/components/xchatty/assets/smilies/lol.png | Bin 0 -> 1993 bytes server/components/xchatty/assets/smilies/love.png | Bin 0 -> 1963 bytes server/components/xchatty/assets/smilies/mad.png | Bin 0 -> 1985 bytes .../components/xchatty/assets/smilies/mrgreen.png | Bin 0 -> 1965 bytes .../components/xchatty/assets/smilies/neutral.png | Bin 0 -> 1977 bytes .../components/xchatty/assets/smilies/question.png | Bin 0 -> 1956 bytes server/components/xchatty/assets/smilies/razz.png | Bin 0 -> 1982 bytes .../components/xchatty/assets/smilies/redface.png | Bin 0 -> 1890 bytes .../components/xchatty/assets/smilies/rolleyes.png | Bin 0 -> 1976 bytes server/components/xchatty/assets/smilies/sad.png | Bin 0 -> 1987 bytes server/components/xchatty/assets/smilies/smile.png | Bin 0 -> 1984 bytes .../xchatty/assets/smilies/surprised.png | Bin 0 -> 1976 bytes .../xchatty/assets/smilies/thumbdown.png | Bin 0 -> 1693 bytes .../components/xchatty/assets/smilies/thumbup.png | Bin 0 -> 1680 bytes .../components/xchatty/assets/smilies/twisted.png | Bin 0 -> 1985 bytes server/components/xchatty/assets/smilies/wink.png | Bin 0 -> 1989 bytes .../styles/backgrounds/vc_background_black.png | Bin 0 -> 4379 bytes .../styles/backgrounds/vc_background_blue.png | Bin 0 -> 3746 bytes .../styles/backgrounds/vc_background_green.png | Bin 0 -> 3701 bytes .../styles/backgrounds/vc_background_red.png | Bin 0 -> 3712 bytes .../components/xchatty/assets/styles/loading.gif | Bin 0 -> 579 bytes server/components/xchatty/index.js | 14 + server/components/xchatty/snippet.html | 12 + server/components/xchatty/xchatty.css | 495 + server/components/xchatty/xchatty.js | 1455 + server/config/agi.js | 1175 + server/config/agi_scripts/googletts.agi | 315 + server/config/agi_scripts/ispeech-asr.agi | 317 + server/config/agi_scripts/ispeech-tts.agi | 252 + server/config/ami/acw.js | 118 + server/config/ami/agent.js | 95 + server/config/ami/call.js | 21 + server/config/ami/dial.js | 41 + server/config/ami/index.js | 171 + server/config/ami/member.js | 106 + server/config/ami/queue_caller.js | 57 + server/config/ami/queue_member.js | 59 + server/config/autodialer/index.js | 125 + server/config/autodialer/process.js | 26 + server/config/automations/fax.js | 171 + server/config/automations/mail.js | 171 + server/config/environment/config.json | 26 + server/config/environment/development.js | 18 + server/config/environment/index.js | 80 + server/config/environment/production.js | 22 + server/config/environment/test.js | 16 + server/config/express.js | 72 + server/config/fax.js | 240 + server/config/history.js | 234 + server/config/imap.js | 387 + server/config/integration.js | 24 + server/config/kue.chat.js | 559 + server/config/kue.fax.js | 316 + server/config/kue.mail.js | 501 + server/config/local.env.sample.js | 23 + server/config/logger.js | 120 + server/config/seed.js | 1073 + server/config/smtp.js | 349 + server/config/socketio.js | 174 + server/config/triggers/mail.js | 156 + server/files/asterisk/sip_xcally_contexts.conf | 8 + server/files/asterisk/sip_xcally_trunks.conf | 24 + server/files/geoip/17monipdb.dat | Bin 0 -> 1556587 bytes server/files/geoip/IP.class.php | 109 + server/files/geoip/readme.txt | 232 + server/files/images/avatar5.png | Bin 0 -> 106631 bytes server/files/images/customer.png | Bin 0 -> 2016 bytes server/files/images/userpic.png | Bin 0 -> 26191 bytes server/files/images/userpic.png.old.png | Bin 0 -> 64555 bytes server/files/integrations/zendesk/app.js | 5 + server/files/integrations/zendesk/manifest.json | 6 + server/files/sounds/converted/8dml2nHgdylpQdAb.wav | Bin 0 -> 658604 bytes server/files/sounds/converted/DqcAGJTcbebQu5PW.wav | Bin 0 -> 658604 bytes server/files/sounds/original/8dml2nHgdylpQdAb.wav | Bin 0 -> 658604 bytes server/files/sounds/original/DqcAGJTcbebQu5PW.wav | Bin 0 -> 658604 bytes server/migrations/20151202190300-test.js | 34 + server/models/asterisk_manager.js | 19 + server/models/asterisk_manager_interface.js | 24 + server/models/autodialer_contact.js | 15 + server/models/autodialer_process.js | 53 + server/models/automation.js | 24 + server/models/business_action.js | 29 + server/models/business_condition.js | 35 + server/models/channel.js | 46 + server/models/chat_application.js | 30 + server/models/chat_enquiry.js | 22 + server/models/chat_message.js | 29 + server/models/chat_queue.js | 30 + server/models/chat_room.js | 38 + server/models/chat_visitor.js | 40 + server/models/chat_website.js | 87 + server/models/contact.js | 23 + server/models/dashboard.js | 62 + server/models/event.js | 45 + server/models/fax_account.js | 40 + server/models/fax_application.js | 33 + server/models/fax_business_automation.js | 32 + server/models/fax_message.js | 63 + server/models/fax_queue.js | 32 + server/models/fax_room.js | 25 + server/models/history/report_agent_history.js | 67 + server/models/history/report_call_history.js | 41 + server/models/history/report_dial_history.js | 42 + server/models/history/report_member_history.js | 23 + server/models/history/report_queue_history.js | 39 + server/models/index.js | 67 + server/models/integration.js | 55 + server/models/interval.js | 661 + server/models/mail_account.js | 32 + server/models/mail_application.js | 30 + server/models/mail_attachment.js | 30 + server/models/mail_automation.js | 23 + server/models/mail_business_automation.js | 32 + server/models/mail_message.js | 53 + server/models/mail_queue.js | 30 + server/models/mail_room.js | 32 + server/models/mail_server_in.js | 45 + server/models/mail_server_out.js | 26 + server/models/mail_template.js | 24 + server/models/mail_trigger.js | 23 + server/models/module.js | 27 + server/models/motionbar.js | 32 + server/models/report_agent.js | 71 + server/models/report_call.js | 40 + server/models/report_chat.js | 48 + server/models/report_chat_session.js | 32 + server/models/report_dial.js | 44 + server/models/report_mail.js | 47 + server/models/report_mail_session.js | 31 + server/models/report_member.js | 25 + server/models/report_queue.js | 41 + server/models/report_square.js | 89 + server/models/report_square_detail.js | 25 + server/models/settings.js | 52 + server/models/square_odbc.js | 23 + server/models/square_project.js | 28 + server/models/team.js | 32 + server/models/trigger.js | 24 + server/models/trunk.js | 341 + server/models/upload.js | 38 + server/models/user.js | 575 + server/models/user_has_chat_queue.js | 14 + server/models/user_has_chat_room.js | 19 + server/models/user_has_fax_queue.js | 14 + server/models/user_has_mail_queue.js | 14 + server/models/user_has_team.js | 14 + server/models/user_has_voice_queue.js | 116 + server/models/variable.js | 23 + server/models/voice_context.js | 25 + server/models/voice_extension.js | 164 + server/models/voice_musiconhold.js | 64 + server/models/voice_queue.js | 294 + server/models/voice_voicemail.js | 144 + server/models/voice_voicemail_messages.js | 67 + server/models/zendesk_account.js | 32 + server/models/zendesk_configuration.js | 20 + server/models/zendesk_field.js | 18 + server/models/zendesk_text.js | 20 + server/routes.js | 122 + server/views/404.html | 157 + 1170 files changed, 451007 insertions(+), 0 deletions(-) delete mode 100644 README.md create mode 100644 package.json create mode 100644 public/.htaccess create mode 100644 public/app/0e6d6720.vendor.js create mode 100644 public/app/16e12937.vendor.css create mode 100644 public/app/5c053d28.app.js create mode 100644 public/app/808268be.app.css create mode 100644 public/assets/css/common.css create mode 100644 public/assets/css/global/components.css create mode 100644 public/assets/css/global/custom-whirly.css create mode 100644 public/assets/css/global/custom.css create mode 100644 public/assets/css/global/darkblue.css create mode 100644 public/assets/css/global/google-open-sans.css create mode 100644 public/assets/css/global/layout.css create mode 100644 public/assets/css/global/plugins.css create mode 100644 public/assets/css/global/strap-docs.min.css create mode 100644 public/assets/css/global/strap.min.css create mode 100644 public/assets/css/inbox.css create mode 100644 public/assets/css/login-soft.css create mode 100644 public/assets/css/login.css create mode 100644 public/assets/css/portfolio.css create mode 100644 public/assets/css/profile-old.css create mode 100644 public/assets/css/profile.css create mode 100644 public/assets/css/smart_table.css create mode 100644 public/assets/css/tasks.css create mode 100644 public/assets/css/timeline.css create mode 100644 public/assets/css/todo.css create mode 100644 public/assets/fonts/FontAwesome.otf create mode 100644 public/assets/fonts/Simple-Line-Icons.eot create mode 100644 public/assets/fonts/Simple-Line-Icons.svg create mode 100644 public/assets/fonts/Simple-Line-Icons.ttf create mode 100644 public/assets/fonts/Simple-Line-Icons.woff create mode 100644 public/assets/fonts/Simple-Line-Icons.woff2 create mode 100644 public/assets/fonts/fontawesome-webfont.eot create mode 100644 public/assets/fonts/fontawesome-webfont.svg create mode 100644 public/assets/fonts/fontawesome-webfont.ttf create mode 100644 public/assets/fonts/fontawesome-webfont.woff create mode 100644 public/assets/fonts/fontawesome-webfont.woff2 create mode 100644 public/assets/fonts/glyphicons-halflings-regular.eot create mode 100644 public/assets/fonts/glyphicons-halflings-regular.svg create mode 100644 public/assets/fonts/glyphicons-halflings-regular.ttf create mode 100644 public/assets/fonts/glyphicons-halflings-regular.woff create mode 100644 public/assets/fonts/glyphicons-halflings-regular.woff2 create mode 100644 public/assets/images/apple/apple-touch-icon-114x114-precomposed.png create mode 100644 public/assets/images/apple/apple-touch-icon-144x144-precomposed.png create mode 100644 public/assets/images/apple/apple-touch-icon-57x57-precomposed.png create mode 100644 public/assets/images/apple/apple-touch-icon-72x72-precomposed.png create mode 100644 public/assets/images/apple/apple-touch-icon-precomposed.png create mode 100644 public/assets/images/apple/apple-touch-icon.png create mode 100644 public/assets/images/apple/splash.png create mode 100644 public/assets/images/apple/splash2x.png create mode 100644 public/assets/images/avatars/avatar.png create mode 100644 public/assets/images/bg-white-lock.png create mode 100644 public/assets/images/browsers/chrome/chrome_16x16.png create mode 100644 public/assets/images/browsers/firefox/firefox_16x16.png create mode 100644 public/assets/images/browsers/internet-explorer/internet-explorer_16x16.png create mode 100644 public/assets/images/browsers/safari/safari_16x16.png create mode 100644 public/assets/images/clarotech_original.jpg create mode 100644 public/assets/images/flags/en_EN.png create mode 100644 public/assets/images/flags/it.png create mode 100644 public/assets/images/flags/us.png create mode 100644 public/assets/images/icon-color-close.png create mode 100644 public/assets/images/icon-color.png create mode 100644 public/assets/images/icons/facebook.png create mode 100644 public/assets/images/icons/github.png create mode 100644 public/assets/images/icons/google.png create mode 100644 public/assets/images/icons/twitter.png create mode 100644 public/assets/images/loaders/loader.gif create mode 100644 public/assets/images/loading-spinner-blue.gif create mode 100644 public/assets/images/loading-spinner-grey.gif create mode 100644 public/assets/images/loading.gif create mode 100644 public/assets/images/logo-big.png create mode 100644 public/assets/images/logo.png create mode 100644 public/assets/images/mCSB_buttons.png create mode 100644 public/assets/images/media/account.png create mode 100644 public/assets/images/media/automation.png create mode 100644 public/assets/images/media/channels/chat64.png create mode 100644 public/assets/images/media/channels/mail64.png create mode 100644 public/assets/images/media/channels/screen_monitor_64.png create mode 100644 public/assets/images/media/channels/telephone124.png create mode 100644 public/assets/images/media/context.png create mode 100644 public/assets/images/media/dashboard.png create mode 100644 public/assets/images/media/inboundroute.png create mode 100644 public/assets/images/media/internalroute.png create mode 100644 public/assets/images/media/interval.png create mode 100644 public/assets/images/media/moh.png create mode 100644 public/assets/images/media/no-pic.png create mode 100644 public/assets/images/media/odbc.png create mode 100644 public/assets/images/media/outboundroute.png create mode 100644 public/assets/images/media/queue.png create mode 100644 public/assets/images/media/realtime.png create mode 100644 public/assets/images/media/stage.png create mode 100644 public/assets/images/media/statistics.png create mode 100644 public/assets/images/media/team.png create mode 100644 public/assets/images/media/template.png create mode 100644 public/assets/images/media/trigger.png create mode 100644 public/assets/images/media/trunk.png create mode 100644 public/assets/images/media/variable.png create mode 100644 public/assets/images/media/voicemail.png create mode 100644 public/assets/images/media/website.png create mode 100644 public/assets/images/media/zendesk.png create mode 100644 public/assets/images/note_placeholder.png create mode 100644 public/assets/images/portlet-collapse-icon-white.png create mode 100644 public/assets/images/portlet-collapse-icon.png create mode 100644 public/assets/images/portlet-config-icon-white.png create mode 100644 public/assets/images/portlet-config-icon.png create mode 100644 public/assets/images/portlet-expand-icon.png create mode 100644 public/assets/images/portlet-reload-icon-white.png create mode 100644 public/assets/images/portlet-reload-icon.png create mode 100644 public/assets/images/portlet-remove-icon-white.png create mode 100644 public/assets/images/portlet-remove-icon.png create mode 100644 public/assets/images/preview_snippet.png create mode 100644 public/assets/images/profile_user.jpg create mode 100644 public/assets/images/remove-icon-small.png create mode 100644 public/assets/images/sidebar_inline_toggler_icon_darkblue.jpg create mode 100644 public/assets/images/sidebar_toggler_icon_darkblue.png create mode 100644 public/assets/images/social/facebook.png create mode 100644 public/assets/images/social/googleplus.png create mode 100644 public/assets/images/social/linkedin.png create mode 100644 public/assets/images/social/twitter.png create mode 100644 public/assets/images/social/youtube.png create mode 100644 public/assets/images/sort_asc.png create mode 100644 public/assets/images/sort_desc.png create mode 100644 public/assets/images/sprites/glyphicons-halflings-white.png create mode 100644 public/assets/images/sprites/glyphicons-halflings.png create mode 100644 public/assets/images/syncfusion-icons-white.png create mode 100644 public/assets/images/syncfusion-icons.png create mode 100644 public/assets/images/xcally.png create mode 100644 public/assets/languages/locale-en_EN.json create mode 100644 public/assets/languages/locale-it.json create mode 100644 public/assets/plugins/angular-elastic-builder-back/.bower.json create mode 100644 public/assets/plugins/angular-elastic-builder-back/LICENSE.md create mode 100644 public/assets/plugins/angular-elastic-builder-back/README.md create mode 100644 public/assets/plugins/angular-elastic-builder-back/bower.json create mode 100644 public/assets/plugins/angular-elastic-builder-back/dist/angular-elastic-builder.js create mode 100644 public/assets/plugins/angular-elastic-builder-back/dist/angular-elastic-builder.min.js create mode 100644 public/assets/plugins/angular-elastic-builder-back/examples/index.html create mode 100644 public/assets/plugins/angular-elastic-builder-back/examples/index.js create mode 100644 public/assets/plugins/angular-elastic-builder-back/examples/js/exampleApp.js create mode 100644 public/assets/plugins/angular-elastic-builder-back/gulpfile.js create mode 100644 public/assets/plugins/angular-elastic-builder-back/package.json create mode 100644 public/assets/plugins/angular-elastic-builder-back/screenshot.png create mode 100644 public/assets/plugins/angular-elastic-builder-back/src/directives/BuilderDirective.js create mode 100644 public/assets/plugins/angular-elastic-builder-back/src/directives/Chooser.js create mode 100644 public/assets/plugins/angular-elastic-builder-back/src/directives/Group.js create mode 100644 public/assets/plugins/angular-elastic-builder-back/src/directives/Rule.js create mode 100644 public/assets/plugins/angular-elastic-builder-back/src/directives/RuleTypes.js create mode 100644 public/assets/plugins/angular-elastic-builder-back/src/module.js create mode 100644 public/assets/plugins/angular-elastic-builder-back/src/services/GroupClassHelper.js create mode 100644 public/assets/plugins/angular-elastic-builder-back/src/services/QueryService.js create mode 100644 public/assets/plugins/angular-elastic-builder-back/src/tmpl/BuilderDirective.html create mode 100644 public/assets/plugins/angular-elastic-builder-back/src/tmpl/ChooserDirective.html create mode 100644 public/assets/plugins/angular-elastic-builder-back/src/tmpl/ElasticBuilderTemplates.js create mode 100644 public/assets/plugins/angular-elastic-builder-back/src/tmpl/GroupDirective.html create mode 100644 public/assets/plugins/angular-elastic-builder-back/src/tmpl/RuleDirective.html create mode 100644 public/assets/plugins/angular-elastic-builder-back/src/tmpl/types/Boolean.html create mode 100644 public/assets/plugins/angular-elastic-builder-back/src/tmpl/types/Date.html create mode 100644 public/assets/plugins/angular-elastic-builder-back/src/tmpl/types/Multi.html create mode 100644 public/assets/plugins/angular-elastic-builder-back/src/tmpl/types/Number.html create mode 100644 public/assets/plugins/angular-elastic-builder-back/src/tmpl/types/Select.html create mode 100644 public/assets/plugins/angular-elastic-builder-back/src/tmpl/types/Term.html create mode 100644 public/assets/plugins/angular-elastic-builder/.bower.json create mode 100644 public/assets/plugins/angular-elastic-builder/LICENSE.md create mode 100644 public/assets/plugins/angular-elastic-builder/README.md create mode 100644 public/assets/plugins/angular-elastic-builder/bower.json create mode 100644 public/assets/plugins/angular-elastic-builder/dist/angular-elastic-builder.js create mode 100644 public/assets/plugins/angular-elastic-builder/dist/angular-elastic-builder.min.js create mode 100644 public/assets/plugins/angular-elastic-builder/dist/angular-elastic-builder_old.js create mode 100644 public/assets/plugins/angular-elastic-builder/examples/index.html create mode 100644 public/assets/plugins/angular-elastic-builder/examples/index.js create mode 100644 public/assets/plugins/angular-elastic-builder/examples/js/exampleApp.js create mode 100644 public/assets/plugins/angular-elastic-builder/gulpfile.js create mode 100644 public/assets/plugins/angular-elastic-builder/package.json create mode 100644 public/assets/plugins/angular-elastic-builder/screenshot.png create mode 100644 public/assets/plugins/angular-elastic-builder/src/directives/BuilderDirective.js create mode 100644 public/assets/plugins/angular-elastic-builder/src/directives/Chooser.js create mode 100644 public/assets/plugins/angular-elastic-builder/src/directives/Group.js create mode 100644 public/assets/plugins/angular-elastic-builder/src/directives/Rule.js create mode 100644 public/assets/plugins/angular-elastic-builder/src/directives/RuleTypes.js create mode 100644 public/assets/plugins/angular-elastic-builder/src/module.js create mode 100644 public/assets/plugins/angular-elastic-builder/src/services/GroupClassHelper.js create mode 100644 public/assets/plugins/angular-elastic-builder/src/services/QueryService.js create mode 100644 public/assets/plugins/angular-elastic-builder/src/tmpl/BuilderDirective.html create mode 100644 public/assets/plugins/angular-elastic-builder/src/tmpl/ChooserDirective.html create mode 100644 public/assets/plugins/angular-elastic-builder/src/tmpl/ElasticBuilderTemplates.js create mode 100644 public/assets/plugins/angular-elastic-builder/src/tmpl/GroupDirective.html create mode 100644 public/assets/plugins/angular-elastic-builder/src/tmpl/RuleDirective.html create mode 100644 public/assets/plugins/angular-elastic-builder/src/tmpl/types/Boolean.html create mode 100644 public/assets/plugins/angular-elastic-builder/src/tmpl/types/Date.html create mode 100644 public/assets/plugins/angular-elastic-builder/src/tmpl/types/Multi.html create mode 100644 public/assets/plugins/angular-elastic-builder/src/tmpl/types/Multiterm.html create mode 100644 public/assets/plugins/angular-elastic-builder/src/tmpl/types/Number.html create mode 100644 public/assets/plugins/angular-elastic-builder/src/tmpl/types/Term.html create mode 100644 public/assets/plugins/angular-pdf/.bower.json create mode 100644 public/assets/plugins/angular-pdf/CONTRIBUTING.md create mode 100644 public/assets/plugins/angular-pdf/Gruntfile.js create mode 100644 public/assets/plugins/angular-pdf/LICENSE create mode 100644 public/assets/plugins/angular-pdf/bower.json create mode 100644 public/assets/plugins/angular-pdf/dist/angular-pdf.js create mode 100644 public/assets/plugins/angular-pdf/dist/angular-pdf.min.js create mode 100644 public/assets/plugins/angular-pdf/example/index.html create mode 100644 public/assets/plugins/angular-pdf/example/js/controllers/docCtrl.js create mode 100644 public/assets/plugins/angular-pdf/example/js/directives/angular-pdf.js create mode 100644 public/assets/plugins/angular-pdf/example/js/lib/angular.min.js create mode 100644 public/assets/plugins/angular-pdf/example/js/lib/angular.min.js.map create mode 100644 public/assets/plugins/angular-pdf/example/js/lib/pdf.js create mode 100644 public/assets/plugins/angular-pdf/example/js/lib/pdf.worker.js create mode 100644 public/assets/plugins/angular-pdf/example/partials/viewer.html create mode 100644 public/assets/plugins/angular-pdf/example/pdf/4e99fa5a-1d29-4bf8-a083-48ab91f9a623.pdf create mode 100644 public/assets/plugins/angular-pdf/example/pdf/relativity.pdf create mode 100644 public/assets/plugins/angular-pdf/example/style.css create mode 100644 public/assets/plugins/angular-pdf/ng-pdf.gif create mode 100644 public/assets/plugins/angular-pdf/readme.md create mode 100644 public/assets/plugins/bootstrap-fileinput/bootstrap-fileinput.css create mode 100644 public/assets/plugins/bootstrap-fileinput/bootstrap-fileinput.js create mode 100644 public/assets/plugins/jquery-multi-select/LICENSE.txt create mode 100644 public/assets/plugins/jquery-multi-select/README.markdown create mode 100644 public/assets/plugins/jquery-multi-select/css/multi-select.css create mode 100644 public/assets/plugins/jquery-multi-select/img/switch.png create mode 100644 public/assets/plugins/jquery-multi-select/img/switch_original.png create mode 100644 public/assets/plugins/jquery-multi-select/js/jquery.multi-select.js create mode 100644 public/assets/plugins/jquery.sparkline.min.js create mode 100644 public/assets/plugins/mxgraph/css/common.css create mode 100644 public/assets/plugins/mxgraph/css/explorer.css create mode 100644 public/assets/plugins/mxgraph/images/1x1.png create mode 100644 public/assets/plugins/mxgraph/images/checkmark.gif create mode 100644 public/assets/plugins/mxgraph/images/clear.gif create mode 100644 public/assets/plugins/mxgraph/images/close.png create mode 100644 public/assets/plugins/mxgraph/images/collapsed.gif create mode 100644 public/assets/plugins/mxgraph/images/connector.png create mode 100644 public/assets/plugins/mxgraph/images/expanded.gif create mode 100644 public/assets/plugins/mxgraph/images/google-drive-20x20.png create mode 100644 public/assets/plugins/mxgraph/images/grid.gif create mode 100644 public/assets/plugins/mxgraph/images/logo-small.gif create mode 100644 public/assets/plugins/mxgraph/images/logo.png create mode 100644 public/assets/plugins/mxgraph/images/nocolor.png create mode 100644 public/assets/plugins/mxgraph/images/submenu.gif create mode 100644 public/assets/plugins/mxgraph/images/tooltip.png create mode 100644 public/assets/plugins/mxgraph/images/touch-connector.png create mode 100644 public/assets/plugins/mxgraph/images/touch-handle.png create mode 100644 public/assets/plugins/mxgraph/images/touch-submenu.png create mode 100644 public/assets/plugins/mxgraph/images/transparent.gif create mode 100644 public/assets/plugins/mxgraph/images/web/drawio-cloud-edit.png create mode 100644 public/assets/plugins/mxgraph/images/web/drawio-drive.png create mode 100644 public/assets/plugins/mxgraph/images/web/drawio-free-edit.png create mode 100644 public/assets/plugins/mxgraph/images/web/drawio-github.png create mode 100644 public/assets/plugins/mxgraph/images/web/drawio-menu.png create mode 100644 public/assets/plugins/mxgraph/images/web/drawio-puzzle-edit.png create mode 100644 public/assets/plugins/mxgraph/images/web/drawio-source-edit.png create mode 100644 public/assets/plugins/mxgraph/images/web/drawioscreen.png create mode 100644 public/assets/plugins/mxgraph/images/web/glyphicons_362_google+_alt.png create mode 100644 public/assets/plugins/mxgraph/images/web/glyphicons_381_github.png create mode 100644 public/assets/plugins/mxgraph/images/web/glyphicons_390_facebook.png create mode 100644 public/assets/plugins/mxgraph/images/web/glyphicons_392_twitter.png create mode 100644 public/assets/plugins/mxgraph/js/Actions.js create mode 100644 public/assets/plugins/mxgraph/js/Dialogs.js create mode 100644 public/assets/plugins/mxgraph/js/Editor.js create mode 100644 public/assets/plugins/mxgraph/js/EditorUi.js create mode 100644 public/assets/plugins/mxgraph/js/Graph.js create mode 100644 public/assets/plugins/mxgraph/js/Menus.js create mode 100644 public/assets/plugins/mxgraph/js/Shapes.js create mode 100644 public/assets/plugins/mxgraph/js/Sidebar.js create mode 100644 public/assets/plugins/mxgraph/js/Toolbar.js create mode 100644 public/assets/plugins/mxgraph/js/custom.js create mode 100644 public/assets/plugins/mxgraph/js/mxClient.js create mode 100644 public/assets/plugins/mxgraph/resources/dia.txt create mode 100644 public/assets/plugins/mxgraph/resources/dia_am.txt create mode 100644 public/assets/plugins/mxgraph/resources/dia_ar.txt create mode 100644 public/assets/plugins/mxgraph/resources/dia_bg.txt create mode 100644 public/assets/plugins/mxgraph/resources/dia_bn.txt create mode 100644 public/assets/plugins/mxgraph/resources/dia_bs.txt create mode 100644 public/assets/plugins/mxgraph/resources/dia_ca.txt create mode 100644 public/assets/plugins/mxgraph/resources/dia_cs.txt create mode 100644 public/assets/plugins/mxgraph/resources/dia_da.txt create mode 100644 public/assets/plugins/mxgraph/resources/dia_de.txt create mode 100644 public/assets/plugins/mxgraph/resources/dia_el.txt create mode 100644 public/assets/plugins/mxgraph/resources/dia_es-AR.txt create mode 100644 public/assets/plugins/mxgraph/resources/dia_es.txt create mode 100644 public/assets/plugins/mxgraph/resources/dia_et.txt create mode 100644 public/assets/plugins/mxgraph/resources/dia_fa.txt create mode 100644 public/assets/plugins/mxgraph/resources/dia_fi.txt create mode 100644 public/assets/plugins/mxgraph/resources/dia_fil.txt create mode 100644 public/assets/plugins/mxgraph/resources/dia_fr.txt create mode 100644 public/assets/plugins/mxgraph/resources/dia_gu.txt create mode 100644 public/assets/plugins/mxgraph/resources/dia_he.txt create mode 100644 public/assets/plugins/mxgraph/resources/dia_hi.txt create mode 100644 public/assets/plugins/mxgraph/resources/dia_hr.txt create mode 100644 public/assets/plugins/mxgraph/resources/dia_hu.txt create mode 100644 public/assets/plugins/mxgraph/resources/dia_id.txt create mode 100644 public/assets/plugins/mxgraph/resources/dia_it.txt create mode 100644 public/assets/plugins/mxgraph/resources/dia_ja.txt create mode 100644 public/assets/plugins/mxgraph/resources/dia_kn.txt create mode 100644 public/assets/plugins/mxgraph/resources/dia_ko.txt create mode 100644 public/assets/plugins/mxgraph/resources/dia_lt.txt create mode 100644 public/assets/plugins/mxgraph/resources/dia_lv.txt create mode 100644 public/assets/plugins/mxgraph/resources/dia_ml.txt create mode 100644 public/assets/plugins/mxgraph/resources/dia_mr.txt create mode 100644 public/assets/plugins/mxgraph/resources/dia_ms.txt create mode 100644 public/assets/plugins/mxgraph/resources/dia_nl.txt create mode 100644 public/assets/plugins/mxgraph/resources/dia_no.txt create mode 100644 public/assets/plugins/mxgraph/resources/dia_pl.txt create mode 100644 public/assets/plugins/mxgraph/resources/dia_pt-br.txt create mode 100644 public/assets/plugins/mxgraph/resources/dia_pt.txt create mode 100644 public/assets/plugins/mxgraph/resources/dia_ro.txt create mode 100644 public/assets/plugins/mxgraph/resources/dia_ru.txt create mode 100644 public/assets/plugins/mxgraph/resources/dia_sk.txt create mode 100644 public/assets/plugins/mxgraph/resources/dia_sl.txt create mode 100644 public/assets/plugins/mxgraph/resources/dia_sr.txt create mode 100644 public/assets/plugins/mxgraph/resources/dia_sv.txt create mode 100644 public/assets/plugins/mxgraph/resources/dia_sw.txt create mode 100644 public/assets/plugins/mxgraph/resources/dia_ta.txt create mode 100644 public/assets/plugins/mxgraph/resources/dia_te.txt create mode 100644 public/assets/plugins/mxgraph/resources/dia_th.txt create mode 100644 public/assets/plugins/mxgraph/resources/dia_tr.txt create mode 100644 public/assets/plugins/mxgraph/resources/dia_uk.txt create mode 100644 public/assets/plugins/mxgraph/resources/dia_zh.txt create mode 100644 public/assets/plugins/mxgraph/resources/help_it.html create mode 100644 public/assets/plugins/mxgraph/stencils/call_management/answer_128x128.png create mode 100644 public/assets/plugins/mxgraph/stencils/call_management/callback_128x128.png create mode 100644 public/assets/plugins/mxgraph/stencils/call_management/dial_128x128.png create mode 100644 public/assets/plugins/mxgraph/stencils/call_management/ext_dial_128x128.png create mode 100644 public/assets/plugins/mxgraph/stencils/call_management/hangup_128x128.png create mode 100644 public/assets/plugins/mxgraph/stencils/call_management/queue_128x128.png create mode 100644 public/assets/plugins/mxgraph/stencils/call_management/voicemail_128x128.png create mode 100644 public/assets/plugins/mxgraph/stencils/callflow/gotoc_128x128.png create mode 100644 public/assets/plugins/mxgraph/stencils/callflow/gotoif_128x128.png create mode 100644 public/assets/plugins/mxgraph/stencils/callflow/gotoifmultitime_128x128.png create mode 100644 public/assets/plugins/mxgraph/stencils/callflow/gotoiftime_128x128.png create mode 100644 public/assets/plugins/mxgraph/stencils/callflow/vswitch_128x128.png create mode 100644 public/assets/plugins/mxgraph/stencils/entry/end_128x128.png create mode 100644 public/assets/plugins/mxgraph/stencils/entry/finally_128x128.png create mode 100644 public/assets/plugins/mxgraph/stencils/entry/start_128x128.png create mode 100644 public/assets/plugins/mxgraph/stencils/general.xml create mode 100644 public/assets/plugins/mxgraph/stencils/general/agi_128x128.png create mode 100644 public/assets/plugins/mxgraph/stencils/general/custom_app_128x128.png create mode 100644 public/assets/plugins/mxgraph/stencils/general/noop_128x128.png create mode 100644 public/assets/plugins/mxgraph/stencils/general/subproject_128x128.png create mode 100644 public/assets/plugins/mxgraph/stencils/general/system_128x128.png create mode 100644 public/assets/plugins/mxgraph/stencils/integration_server/asr_128x128.png create mode 100644 public/assets/plugins/mxgraph/stencils/integration_server/database_128x128.png create mode 100644 public/assets/plugins/mxgraph/stencils/integration_server/ispeechasr_128x128.png create mode 100644 public/assets/plugins/mxgraph/stencils/playback/background_128x128.png create mode 100644 public/assets/plugins/mxgraph/stencils/playback/getdigits_128x128.png create mode 100644 public/assets/plugins/mxgraph/stencils/playback/ispeechtts_128x128.png create mode 100644 public/assets/plugins/mxgraph/stencils/playback/menu_128x128.png create mode 100644 public/assets/plugins/mxgraph/stencils/playback/playback_128x128.png create mode 100644 public/assets/plugins/mxgraph/stencils/playback/saydigits_128x128.png create mode 100644 public/assets/plugins/mxgraph/stencils/playback/saynumber_128x128.png create mode 100644 public/assets/plugins/mxgraph/stencils/playback/sayphonetic_128x128.png create mode 100644 public/assets/plugins/mxgraph/stencils/playback/tts_128x128.png create mode 100644 public/assets/plugins/mxgraph/stencils/recording/record_128x128.png create mode 100644 public/assets/plugins/mxgraph/stencils/stats/goal_128x128.png create mode 100644 public/assets/plugins/mxgraph/stencils/stats/queuelog_128x128.png create mode 100644 public/assets/plugins/mxgraph/stencils/variable/math_128x128.png create mode 100644 public/assets/plugins/mxgraph/stencils/variable/set_128x128.png create mode 100644 public/assets/plugins/mxgraph/styles/custom.css create mode 100644 public/assets/plugins/mxgraph/styles/default-old.xml create mode 100644 public/assets/plugins/mxgraph/styles/default.xml create mode 100644 public/assets/plugins/mxgraph/styles/grapheditor-ie6.css create mode 100644 public/assets/plugins/mxgraph/styles/grapheditor.css create mode 100644 public/assets/plugins/mxgraph/styles/ie6.min.css create mode 100644 public/assets/plugins/mxgraph/styles/manual-colors.css create mode 100644 public/assets/plugins/mxgraph/styles/manual-styles.css create mode 100644 public/assets/plugins/mxgraph/styles/sprites.png create mode 100644 public/assets/plugins/mxgraph/styles/thumb_horz.png create mode 100644 public/assets/plugins/mxgraph/styles/thumb_vertical.png create mode 100644 public/assets/plugins/mxgraph/styles/web/bootstrap-extra.css create mode 100644 public/assets/plugins/mxgraph/styles/web/bootstrap-responsive.css create mode 100644 public/assets/plugins/mxgraph/styles/web/bootstrap-responsive.min.css create mode 100644 public/assets/plugins/mxgraph/styles/web/bootstrap.css create mode 100644 public/assets/plugins/mxgraph/styles/web/bootstrap.min.css create mode 100644 public/assets/plugins/mxgraph/styles/web/font-awesome/font-awesome-ie7.css create mode 100644 public/assets/plugins/mxgraph/styles/web/font-awesome/font-awesome.css create mode 100644 public/assets/plugins/mxgraph/styles/web/font-awesome/font/README.TXT create mode 100644 public/assets/plugins/mxgraph/styles/web/font-awesome/font/fontawesome-webfont.eot create mode 100644 public/assets/plugins/mxgraph/styles/web/font-awesome/font/fontawesome-webfont.svg create mode 100644 public/assets/plugins/mxgraph/styles/web/font-awesome/font/fontawesome-webfont.ttf create mode 100644 public/assets/plugins/mxgraph/styles/web/font-awesome/font/fontawesome-webfont.woff create mode 100644 public/assets/plugins/mxgraph/styles/web/static.min.css create mode 100644 public/assets/plugins/mxgraph/styles/web/static.uncompressed.css create mode 100644 public/assets/plugins/mxgraph/templates/images/aws1.png create mode 100644 public/assets/plugins/mxgraph/templates/images/bpmn1.png create mode 100644 public/assets/plugins/mxgraph/templates/images/compare1.png create mode 100644 public/assets/plugins/mxgraph/templates/images/flowchart1.png create mode 100644 public/assets/plugins/mxgraph/templates/images/flowchart2.png create mode 100644 public/assets/plugins/mxgraph/templates/images/gantt1.png create mode 100644 public/assets/plugins/mxgraph/templates/images/lean1.png create mode 100644 public/assets/plugins/mxgraph/templates/images/mindmap1.png create mode 100644 public/assets/plugins/mxgraph/templates/images/orgchart1.png create mode 100644 public/assets/plugins/mxgraph/templates/images/orgchart2.png create mode 100644 public/assets/plugins/mxgraph/templates/images/package1.png create mode 100644 public/assets/plugins/mxgraph/templates/images/pid1.png create mode 100644 public/assets/plugins/mxgraph/templates/images/plcladder1.png create mode 100644 public/assets/plugins/mxgraph/templates/images/seqdiag1.png create mode 100644 public/assets/plugins/mxgraph/templates/images/sitemap1.png create mode 100644 public/assets/plugins/mxgraph/templates/images/socnet1.png create mode 100644 public/assets/plugins/mxgraph/templates/images/stardelta.png create mode 100644 public/assets/plugins/mxgraph/templates/images/statemachine1.png create mode 100644 public/assets/plugins/mxgraph/templates/images/uml1.png create mode 100644 public/assets/plugins/mxgraph/templates/images/usecase1.png create mode 100644 public/assets/plugins/mxgraph/templates/images/venn1.png create mode 100644 public/assets/plugins/mxgraph/templates/images/wf1.png create mode 100644 public/assets/plugins/mxgraph/templates/xml/aws1.xml create mode 100644 public/assets/plugins/mxgraph/templates/xml/bpmn1.xml create mode 100644 public/assets/plugins/mxgraph/templates/xml/compare1.xml create mode 100644 public/assets/plugins/mxgraph/templates/xml/flowchart1.xml create mode 100644 public/assets/plugins/mxgraph/templates/xml/flowchart2.xml create mode 100644 public/assets/plugins/mxgraph/templates/xml/gantt1.xml create mode 100644 public/assets/plugins/mxgraph/templates/xml/lean1.xml create mode 100644 public/assets/plugins/mxgraph/templates/xml/mindmap1.xml create mode 100644 public/assets/plugins/mxgraph/templates/xml/orgchart1.xml create mode 100644 public/assets/plugins/mxgraph/templates/xml/orgchart2.xml create mode 100644 public/assets/plugins/mxgraph/templates/xml/package1.xml create mode 100644 public/assets/plugins/mxgraph/templates/xml/pid1.xml create mode 100644 public/assets/plugins/mxgraph/templates/xml/plcladder1.xml create mode 100644 public/assets/plugins/mxgraph/templates/xml/seqdiag1.xml create mode 100644 public/assets/plugins/mxgraph/templates/xml/sitemap1.xml create mode 100644 public/assets/plugins/mxgraph/templates/xml/socnet1.xml create mode 100644 public/assets/plugins/mxgraph/templates/xml/stardelta.xml create mode 100644 public/assets/plugins/mxgraph/templates/xml/statemachine1.xml create mode 100644 public/assets/plugins/mxgraph/templates/xml/uml1.xml create mode 100644 public/assets/plugins/mxgraph/templates/xml/usecase1.xml create mode 100644 public/assets/plugins/mxgraph/templates/xml/venn1.xml create mode 100644 public/assets/plugins/mxgraph/templates/xml/wf1.xml create mode 100644 public/assets/plugins/ui-select/select.min.css create mode 100644 public/assets/plugins/ui-select/select.min.js create mode 100644 public/assets/scripts/charts-flotcharts.js create mode 100644 public/assets/scripts/components-dropdowns.js create mode 100644 public/assets/scripts/datatable.js create mode 100644 public/assets/scripts/form-wizard-agent.js create mode 100644 public/assets/scripts/global/layout.js create mode 100644 public/assets/scripts/global/metronic.js create mode 100644 public/assets/scripts/inbox-fax.js create mode 100644 public/assets/scripts/inbox.js create mode 100644 public/assets/scripts/index.js create mode 100644 public/assets/scripts/jquery-ui-1.10.3.custom.min.js create mode 100644 public/assets/scripts/jquery.cokie.min.js create mode 100644 public/assets/scripts/jquery.sparkline.min.js create mode 100644 public/assets/scripts/login-soft.js create mode 100644 public/assets/scripts/portfolio.js create mode 100644 public/assets/scripts/profile.js create mode 100644 public/assets/scripts/table-ajax.js create mode 100644 public/assets/scripts/tasks.js create mode 100644 public/bower_components/Chart.js/Chart.js create mode 100644 public/bower_components/Sortable/Sortable.js create mode 100644 public/bower_components/Sortable/knockout-sortable.js create mode 100644 public/bower_components/Sortable/ng-sortable.js create mode 100644 public/bower_components/Sortable/react-sortable-mixin.js create mode 100644 public/bower_components/adf-structures-base/adf-structures-base.js create mode 100644 public/bower_components/adf-widget-clock/adf-widget-clock.css create mode 100644 public/bower_components/adf-widget-clock/adf-widget-clock.js create mode 100644 public/bower_components/adf-widget-iframe/adf-widget-iframe.css create mode 100644 public/bower_components/adf-widget-iframe/adf-widget-iframe.js create mode 100644 public/bower_components/angular-animate/angular-animate.js create mode 100644 public/bower_components/angular-audio/angular.audio.js create mode 100644 public/bower_components/angular-bootstrap-colorpicker/bootstrap-colorpicker-module.js create mode 100644 public/bower_components/angular-bootstrap-colorpicker/colorpicker.css create mode 100644 public/bower_components/angular-bootstrap-contextmenu/contextMenu.js create mode 100644 public/bower_components/angular-bootstrap-switch/angular-bootstrap-switch.js create mode 100644 public/bower_components/angular-bootstrap/ui-bootstrap-tpls.js create mode 100644 public/bower_components/angular-chart.js/angular-chart.css create mode 100644 public/bower_components/angular-chart.js/angular-chart.js create mode 100644 public/bower_components/angular-cookies/angular-cookies.js create mode 100644 public/bower_components/angular-dashboard-framework/angular-dashboard-framework.css create mode 100644 public/bower_components/angular-dashboard-framework/angular-dashboard-framework.js create mode 100644 public/bower_components/angular-file-upload/angular-file-upload.min.js create mode 100644 public/bower_components/angular-filter/angular-filter.min.js create mode 100644 public/bower_components/angular-local-storage/angular-local-storage.js create mode 100644 public/bower_components/angular-md5/angular-md5.js create mode 100644 public/bower_components/angular-mocks/angular-mocks.js create mode 100644 public/bower_components/angular-notification/angular-notification.js create mode 100644 public/bower_components/angular-resource/angular-resource.js create mode 100644 public/bower_components/angular-sanitize/angular-sanitize.js create mode 100644 public/bower_components/angular-scenario/angular-scenario.js create mode 100644 public/bower_components/angular-smart-table/smart-table.js create mode 100644 public/bower_components/angular-socket-io/socket.js create mode 100644 public/bower_components/angular-toastr/angular-toastr.css create mode 100644 public/bower_components/angular-toastr/angular-toastr.tpls.js create mode 100644 public/bower_components/angular-touch/angular-touch.js create mode 100644 public/bower_components/angular-translate-loader-static-files/angular-translate-loader-static-files.js create mode 100644 public/bower_components/angular-translate-storage-cookie/angular-translate-storage-cookie.js create mode 100644 public/bower_components/angular-translate-storage-local/angular-translate-storage-local.js create mode 100644 public/bower_components/angular-translate/angular-translate.js create mode 100644 public/bower_components/angular-truncate/truncate.js create mode 100644 public/bower_components/angular-ui-notification/angular-ui-notification.min.css create mode 100644 public/bower_components/angular-ui-notification/angular-ui-notification.min.js create mode 100644 public/bower_components/angular-ui-router/angular-ui-router.js create mode 100644 public/bower_components/angular-ui-sortable/sortable.js create mode 100644 public/bower_components/angular-wizard/angular-wizard.min.css create mode 100644 public/bower_components/angular-wizard/angular-wizard.min.js create mode 100644 public/bower_components/angular-xeditable/xeditable.css create mode 100644 public/bower_components/angular-xeditable/xeditable.js create mode 100644 public/bower_components/angular/angular.js create mode 100644 public/bower_components/animate.css/animate.css create mode 100644 public/bower_components/blockUI/jquery.blockUI.js create mode 100644 public/bower_components/bootstrap-hover-dropdown/bootstrap-hover-dropdown.js create mode 100644 public/bower_components/bootstrap-select/bootstrap-select.css create mode 100644 public/bower_components/bootstrap-select/bootstrap-select.js create mode 100644 public/bower_components/bootstrap-select/bootstrap-select.less create mode 100644 public/bower_components/bootstrap-switch/bootstrap-switch.css create mode 100644 public/bower_components/bootstrap-switch/bootstrap-switch.js create mode 100644 public/bower_components/bootstrap/bootstrap.js create mode 100644 public/bower_components/bootstrap/bootstrap.less create mode 100644 public/bower_components/checklist-model/checklist-model.js create mode 100644 public/bower_components/css-spinners/atebits.css create mode 100644 public/bower_components/css-spinners/ball.css create mode 100644 public/bower_components/css-spinners/circles.css create mode 100644 public/bower_components/css-spinners/dots.css create mode 100644 public/bower_components/css-spinners/flower.css create mode 100644 public/bower_components/css-spinners/gauge.css create mode 100644 public/bower_components/css-spinners/heartbeat.css create mode 100644 public/bower_components/css-spinners/hexdots.css create mode 100644 public/bower_components/css-spinners/hole-pulse.css create mode 100644 public/bower_components/css-spinners/inner-circles.css create mode 100644 public/bower_components/css-spinners/plus-loader.css create mode 100644 public/bower_components/css-spinners/plus.css create mode 100644 public/bower_components/css-spinners/pong.css create mode 100644 public/bower_components/css-spinners/pulse.css create mode 100644 public/bower_components/css-spinners/refreshing.css create mode 100644 public/bower_components/css-spinners/spinner.css create mode 100644 public/bower_components/css-spinners/spinners.css create mode 100644 public/bower_components/css-spinners/spinners.scss create mode 100644 public/bower_components/css-spinners/three-quarters.css create mode 100644 public/bower_components/css-spinners/throbber.css create mode 100644 public/bower_components/css-spinners/timer.css create mode 100644 public/bower_components/css-spinners/whirly.css create mode 100644 public/bower_components/css-spinners/wobblebar.css create mode 100644 public/bower_components/es5-shim/es5-shim.js create mode 100644 public/bower_components/font-awesome/font-awesome.less create mode 100644 public/bower_components/font-awesome/font-awesome.scss create mode 100644 public/bower_components/highlightjs/default.css create mode 100644 public/bower_components/highlightjs/highlight.pack.js create mode 100644 public/bower_components/jquery-backstretch/jquery.backstretch.js create mode 100644 public/bower_components/jquery-cookie/jquery.cookie.js create mode 100644 public/bower_components/jquery-migrate/.bower.json create mode 100644 public/bower_components/jquery-migrate/README.md create mode 100644 public/bower_components/jquery-migrate/component.json create mode 100644 public/bower_components/jquery-migrate/jquery-migrate.js create mode 100644 public/bower_components/jquery-migrate/jquery-migrate.min.js create mode 100644 public/bower_components/jquery-mousewheel/jquery.mousewheel.js create mode 100644 public/bower_components/jquery-slimscroll/.bower.json create mode 100644 public/bower_components/jquery-slimscroll/README.md create mode 100644 public/bower_components/jquery-slimscroll/examples/allow-page-scroll.html create mode 100644 public/bower_components/jquery-slimscroll/examples/chaining.html create mode 100644 public/bower_components/jquery-slimscroll/examples/disable-fade-out.html create mode 100644 public/bower_components/jquery-slimscroll/examples/dynamic-content.html create mode 100644 public/bower_components/jquery-slimscroll/examples/height-width.html create mode 100644 public/bower_components/jquery-slimscroll/examples/index.html create mode 100644 public/bower_components/jquery-slimscroll/examples/libs/prettify/prettify.css create mode 100644 public/bower_components/jquery-slimscroll/examples/libs/prettify/prettify.js create mode 100644 public/bower_components/jquery-slimscroll/examples/mouse-wheel.html create mode 100644 public/bower_components/jquery-slimscroll/examples/multiple-elements.html create mode 100644 public/bower_components/jquery-slimscroll/examples/navigation.html create mode 100644 public/bower_components/jquery-slimscroll/examples/nested.html create mode 100644 public/bower_components/jquery-slimscroll/examples/programmatic-scrolling.html create mode 100644 public/bower_components/jquery-slimscroll/examples/rail.html create mode 100644 public/bower_components/jquery-slimscroll/examples/scroll-events.html create mode 100644 public/bower_components/jquery-slimscroll/examples/scrollbar.html create mode 100644 public/bower_components/jquery-slimscroll/examples/start-position.html create mode 100644 public/bower_components/jquery-slimscroll/examples/style.css create mode 100644 public/bower_components/jquery-slimscroll/jquery.slimscroll.js create mode 100644 public/bower_components/jquery-slimscroll/jquery.slimscroll.min.js create mode 100644 public/bower_components/jquery-slimscroll/package.json create mode 100644 public/bower_components/jquery-ui/jquery-ui.js create mode 100644 public/bower_components/jquery-validation/jquery.validate.js create mode 100644 public/bower_components/jquery.actual/jquery.actual.js create mode 100644 public/bower_components/jquery/jquery.js create mode 100644 public/bower_components/json3/json3.js create mode 100644 public/bower_components/lodash/lodash.js create mode 100644 public/bower_components/malihu-custom-scrollbar-plugin/jquery.mCustomScrollbar.css create mode 100644 public/bower_components/malihu-custom-scrollbar-plugin/jquery.mCustomScrollbar.js create mode 100644 public/bower_components/malihu-custom-scrollbar-plugin/mCSB_buttons.png create mode 100644 public/bower_components/moment/moment.js create mode 100644 public/bower_components/ng-csv/ng-csv.min.js create mode 100644 public/bower_components/ng-emoticons/emojis.png create mode 100644 public/bower_components/ng-emoticons/emojis@2x.png create mode 100644 public/bower_components/ng-emoticons/emoticons.eot create mode 100644 public/bower_components/ng-emoticons/emoticons.svg create mode 100644 public/bower_components/ng-emoticons/emoticons.ttf create mode 100644 public/bower_components/ng-emoticons/emoticons.woff create mode 100644 public/bower_components/ng-emoticons/loader.svg create mode 100644 public/bower_components/ng-emoticons/ng-emoticons.css create mode 100644 public/bower_components/ng-emoticons/ng-emoticons.js create mode 100644 public/bower_components/ng-remote-validate/ngRemoteValidate.js create mode 100644 public/bower_components/ng-scrollbars/scrollbars.min.js create mode 100644 public/bower_components/ng-slide-down/ng-slide-down.js create mode 100644 public/bower_components/ngInfiniteScroll/ng-infinite-scroll.js create mode 100644 public/bower_components/ngmap/ng-map.js create mode 100644 public/bower_components/oclazyload/ocLazyLoad.js create mode 100644 public/bower_components/pdfjs-dist/pdf.js create mode 100644 public/bower_components/pdfjs-dist/pdf.worker.js create mode 100644 public/bower_components/rangy/rangy-classapplier.js create mode 100644 public/bower_components/rangy/rangy-core.js create mode 100644 public/bower_components/rangy/rangy-highlighter.js create mode 100644 public/bower_components/rangy/rangy-selectionsaverestore.js create mode 100644 public/bower_components/rangy/rangy-serializer.js create mode 100644 public/bower_components/rangy/rangy-textrange.js create mode 100644 public/bower_components/select2/core.scss create mode 100644 public/bower_components/select2/select2.js create mode 100644 public/bower_components/simple-line-icons/Simple-Line-Icons.eot create mode 100644 public/bower_components/simple-line-icons/Simple-Line-Icons.svg create mode 100644 public/bower_components/simple-line-icons/Simple-Line-Icons.ttf create mode 100644 public/bower_components/simple-line-icons/Simple-Line-Icons.woff create mode 100644 public/bower_components/simple-line-icons/Simple-Line-Icons.woff2 create mode 100644 public/bower_components/simple-line-icons/simple-line-icons.css create mode 100644 public/bower_components/simple-line-icons/simple-line-icons.less create mode 100644 public/bower_components/simple-line-icons/simple-line-icons.scss create mode 100644 public/bower_components/sprintf/sprintf.js create mode 100644 public/bower_components/textAngular/textAngular-sanitize.js create mode 100644 public/bower_components/textAngular/textAngular.css create mode 100644 public/bower_components/textAngular/textAngular.js create mode 100644 public/bower_components/textAngular/textAngularSetup.js create mode 100644 public/bower_components/time-elements/time-elements.js create mode 100644 public/bower_components/ui-navbar/ui-navbar.js create mode 100644 public/bower_components/ui-select/select.css create mode 100644 public/bower_components/ui-select/select.js create mode 100644 public/bower_components/webcomponentsjs/webcomponents.js create mode 100644 public/favicon.ico create mode 100644 public/index.html create mode 100644 public/robots.txt create mode 100644 release-notes/changelog_0.0.1.txt create mode 100644 server/api/agent/agent.controller.js create mode 100644 server/api/agent/agent.socket.js create mode 100644 server/api/agent/agent.spec.js create mode 100644 server/api/agent/index.js create mode 100644 server/api/ami/ami.ami.js create mode 100644 server/api/ami/ami.controller.js create mode 100644 server/api/ami/ami.socket.js create mode 100644 server/api/ami/ami.spec.js create mode 100644 server/api/ami/index.js create mode 100644 server/api/automation/automation.controller.js create mode 100644 server/api/automation/automation.socket.js create mode 100644 server/api/automation/automation.spec.js create mode 100644 server/api/automation/index.js create mode 100644 server/api/business_action/business_action.controller.js create mode 100644 server/api/business_action/business_action.socket.js create mode 100644 server/api/business_action/business_action.spec.js create mode 100644 server/api/business_action/index.js create mode 100644 server/api/business_condition/business_condition.controller.js create mode 100644 server/api/business_condition/business_condition.socket.js create mode 100644 server/api/business_condition/business_condition.spec.js create mode 100644 server/api/business_condition/index.js create mode 100644 server/api/chat_application/chat_application.controller.js create mode 100644 server/api/chat_application/chat_application.socket.js create mode 100644 server/api/chat_application/chat_application.spec.js create mode 100644 server/api/chat_application/index.js create mode 100644 server/api/chat_enquiry/enquiry.controller.js create mode 100644 server/api/chat_enquiry/enquiry.socket.js create mode 100644 server/api/chat_enquiry/enquiry.spec.js create mode 100644 server/api/chat_enquiry/index.js create mode 100644 server/api/chat_message/chat_message.controller.js create mode 100644 server/api/chat_message/chat_message.socket.js create mode 100644 server/api/chat_message/chat_message.spec.js create mode 100644 server/api/chat_message/index.js create mode 100644 server/api/chat_queue/chat_queue.controller.js create mode 100644 server/api/chat_queue/chat_queue.socket.js create mode 100644 server/api/chat_queue/chat_queue.spec.js create mode 100644 server/api/chat_queue/index.js create mode 100644 server/api/chat_room/chat_room.controller.js create mode 100644 server/api/chat_room/chat_room.controller.js.back create mode 100644 server/api/chat_room/chat_room.socket.js create mode 100644 server/api/chat_room/chat_room.spec.js create mode 100644 server/api/chat_room/index.js create mode 100644 server/api/chat_visitor/chat_visitor.controller.js create mode 100644 server/api/chat_visitor/chat_visitor.socket.js create mode 100644 server/api/chat_visitor/chat_visitor.spec.js create mode 100644 server/api/chat_visitor/index.js create mode 100644 server/api/chat_website/chat_website.controller.js create mode 100644 server/api/chat_website/chat_website.socket.js create mode 100644 server/api/chat_website/chat_website.spec.js create mode 100644 server/api/chat_website/index.js create mode 100644 server/api/contact/contact.controller.js create mode 100644 server/api/contact/contact.model.js create mode 100644 server/api/contact/contact.socket.js create mode 100644 server/api/contact/contact.spec.js create mode 100644 server/api/contact/index.js create mode 100644 server/api/dashboard/dashboard.controller.js create mode 100644 server/api/dashboard/dashboard.socket.js create mode 100644 server/api/dashboard/dashboard.spec.js create mode 100644 server/api/dashboard/index.js create mode 100644 server/api/event/event.controller.js create mode 100644 server/api/event/event.socket.js create mode 100644 server/api/event/event.spec.js create mode 100644 server/api/event/index.js create mode 100644 server/api/fax_account/fax_account.controller.js create mode 100644 server/api/fax_account/fax_account.socket.js create mode 100644 server/api/fax_account/fax_account.spec.js create mode 100644 server/api/fax_account/index.js create mode 100644 server/api/fax_application/fax_application.controller.js create mode 100644 server/api/fax_application/fax_application.socket.js create mode 100644 server/api/fax_application/fax_application.spec.js create mode 100644 server/api/fax_application/index.js create mode 100644 server/api/fax_business_automation/fax_business_automation.controller.js create mode 100644 server/api/fax_business_automation/fax_business_automation.socket.js create mode 100644 server/api/fax_business_automation/fax_business_automation.spec.js create mode 100644 server/api/fax_business_automation/index.js create mode 100644 server/api/fax_message/fax_message.ami.js create mode 100644 server/api/fax_message/fax_message.controller.js create mode 100644 server/api/fax_message/fax_message.socket.js create mode 100644 server/api/fax_message/fax_message.spec.js create mode 100644 server/api/fax_message/index.js create mode 100644 server/api/fax_queue/fax_queue.controller.js create mode 100644 server/api/fax_queue/fax_queue.socket.js create mode 100644 server/api/fax_queue/fax_queue.spec.js create mode 100644 server/api/fax_queue/index.js create mode 100644 server/api/fax_room/fax_room.controller.js create mode 100644 server/api/fax_room/fax_room.kue.js create mode 100644 server/api/fax_room/fax_room.socket.js create mode 100644 server/api/fax_room/fax_room.spec.js create mode 100644 server/api/fax_room/index.js create mode 100644 server/api/integration/index.js create mode 100644 server/api/integration/integration.controller.js create mode 100644 server/api/integration/integration.socket.js create mode 100644 server/api/integration/integration.spec.js create mode 100644 server/api/interval/index.js create mode 100644 server/api/interval/interval.controller.js create mode 100644 server/api/interval/interval.socket.js create mode 100644 server/api/interval/interval.spec.js create mode 100644 server/api/mail_account/index.js create mode 100644 server/api/mail_account/mail_account.controller.js create mode 100644 server/api/mail_account/mail_account.socket.js create mode 100644 server/api/mail_account/mail_account.spec.js create mode 100644 server/api/mail_application/index.js create mode 100644 server/api/mail_application/mail_application.controller.js create mode 100644 server/api/mail_application/mail_application.socket.js create mode 100644 server/api/mail_application/mail_application.spec.js create mode 100644 server/api/mail_attachment/index.js create mode 100644 server/api/mail_attachment/mail_attachment.controller.js create mode 100644 server/api/mail_attachment/mail_attachment.socket.js create mode 100644 server/api/mail_attachment/mail_attachment.spec.js create mode 100644 server/api/mail_business_automation/index.js create mode 100644 server/api/mail_business_automation/mail_business_automation.controller.js create mode 100644 server/api/mail_business_automation/mail_business_automation.socket.js create mode 100644 server/api/mail_business_automation/mail_business_automation.spec.js create mode 100644 server/api/mail_message/index.js create mode 100644 server/api/mail_message/mail_message.controller.js create mode 100644 server/api/mail_message/mail_message.socket.js create mode 100644 server/api/mail_message/mail_message.spec.js create mode 100644 server/api/mail_queue/index.js create mode 100644 server/api/mail_queue/mail_queue.controller.js create mode 100644 server/api/mail_queue/mail_queue.socket.js create mode 100644 server/api/mail_queue/mail_queue.spec.js create mode 100644 server/api/mail_room/index.js create mode 100644 server/api/mail_room/mail_room.controller.js create mode 100644 server/api/mail_room/mail_room.kue.js create mode 100644 server/api/mail_room/mail_room.socket.js create mode 100644 server/api/mail_room/mail_room.spec.js create mode 100644 server/api/mail_server_in/index.js create mode 100644 server/api/mail_server_in/mail_server_in.controller.js create mode 100644 server/api/mail_server_in/mail_server_in.socket.js create mode 100644 server/api/mail_server_in/mail_server_in.spec.js create mode 100644 server/api/mail_server_out/index.js create mode 100644 server/api/mail_server_out/mail_server_out.controller.js create mode 100644 server/api/mail_server_out/mail_server_out.socket.js create mode 100644 server/api/mail_server_out/mail_server_out.spec.js create mode 100644 server/api/mail_template/index.js create mode 100644 server/api/mail_template/mail_template.controller.js create mode 100644 server/api/mail_template/mail_template.socket.js create mode 100644 server/api/mail_template/mail_template.spec.js create mode 100644 server/api/module/index.js create mode 100644 server/api/module/module.controller.js create mode 100644 server/api/module/module.socket.js create mode 100644 server/api/module/module.spec.js create mode 100644 server/api/module/setting/index.js create mode 100644 server/api/module/setting/setting.controller.js create mode 100644 server/api/module/setting/setting.socket.js create mode 100644 server/api/module/setting/setting.spec.js create mode 100644 server/api/motionbar/index.js create mode 100644 server/api/motionbar/motionbar.controller.js create mode 100644 server/api/motionbar/motionbar.socket.js create mode 100644 server/api/motionbar/motionbar.spec.js create mode 100644 server/api/report_agent/index.js create mode 100644 server/api/report_agent/report_agent.controller.js create mode 100644 server/api/report_agent/report_agent.socket.js create mode 100644 server/api/report_chat/index.js create mode 100644 server/api/report_chat/report_chat.controller.js create mode 100644 server/api/report_chat/report_chat.socket.js create mode 100644 server/api/report_chat/report_chat.spec.js create mode 100644 server/api/report_chat_session/index.js create mode 100644 server/api/report_chat_session/report_chat_session.controller.js create mode 100644 server/api/report_chat_session/report_chat_session.socket.js create mode 100644 server/api/report_chat_session/report_chat_session.spec.js create mode 100644 server/api/report_mail/index.js create mode 100644 server/api/report_mail/report_mail.controller.js create mode 100644 server/api/report_mail/report_mail.socket.js create mode 100644 server/api/report_mail/report_mail.spec.js create mode 100644 server/api/report_mail_session/index.js create mode 100644 server/api/report_mail_session/report_mail_session.controller.js create mode 100644 server/api/report_mail_session/report_mail_session.socket.js create mode 100644 server/api/report_mail_session/report_mail_session.spec.js create mode 100644 server/api/report_queue/index.js create mode 100644 server/api/report_queue/report_queue.controller.js create mode 100644 server/api/report_queue/report_queue.socket.js create mode 100644 server/api/setting/index.js create mode 100644 server/api/setting/setting.controller.js create mode 100644 server/api/setting/setting.socket.js create mode 100644 server/api/setting/setting.spec.js create mode 100644 server/api/square_odbc/index.js create mode 100644 server/api/square_odbc/square_odbc.controller.js create mode 100644 server/api/square_odbc/square_odbc.socket.js create mode 100644 server/api/square_odbc/square_odbc.spec.js create mode 100644 server/api/square_project/index.js create mode 100644 server/api/square_project/square_project.controller.js create mode 100644 server/api/square_project/square_project.socket.js create mode 100644 server/api/square_project/square_project.spec.js create mode 100644 server/api/team/index.js create mode 100644 server/api/team/team.controller.js create mode 100644 server/api/team/team.socket.js create mode 100644 server/api/team/team.spec.js create mode 100644 server/api/thing/index.js create mode 100644 server/api/thing/thing.controller.js create mode 100644 server/api/thing/thing.socket.js create mode 100644 server/api/thing/thing.spec.js create mode 100644 server/api/trigger/index.js create mode 100644 server/api/trigger/trigger.controller.js create mode 100644 server/api/trigger/trigger.socket.js create mode 100644 server/api/trigger/trigger.spec.js create mode 100644 server/api/trunk/index.js create mode 100644 server/api/trunk/trunk.ami.js create mode 100644 server/api/trunk/trunk.controller.js create mode 100644 server/api/trunk/trunk.socket.js create mode 100644 server/api/trunk/trunk.spec.js create mode 100644 server/api/upload/index.js create mode 100644 server/api/upload/upload.controller.js create mode 100644 server/api/upload/upload.socket.js create mode 100644 server/api/upload/upload.spec.js create mode 100644 server/api/user/index.js create mode 100644 server/api/user/user.ami.js create mode 100644 server/api/user/user.controller.js create mode 100644 server/api/user/user.socket.js create mode 100644 server/api/user/user.spec.js create mode 100644 server/api/user_has_chat_queue/index.js create mode 100644 server/api/user_has_chat_queue/user_has_chat_queue.controller.js create mode 100644 server/api/user_has_chat_queue/user_has_chat_queue.socket.js create mode 100644 server/api/user_has_chat_queue/user_has_chat_queue.spec.js create mode 100644 server/api/user_has_chat_room/index.js create mode 100644 server/api/user_has_chat_room/user_has_chat_room.controller.js create mode 100644 server/api/user_has_chat_room/user_has_chat_room.socket.js create mode 100644 server/api/user_has_chat_room/user_has_chat_room.spec.js create mode 100644 server/api/user_has_fax_queue/index.js create mode 100644 server/api/user_has_fax_queue/user_has_fax_queue.controller.js create mode 100644 server/api/user_has_fax_queue/user_has_fax_queue.socket.js create mode 100644 server/api/user_has_fax_queue/user_has_fax_queue.spec.js create mode 100644 server/api/user_has_mail_queue/index.js create mode 100644 server/api/user_has_mail_queue/user_has_mail_queue.controller.js create mode 100644 server/api/user_has_mail_queue/user_has_mail_queue.socket.js create mode 100644 server/api/user_has_mail_queue/user_has_mail_queue.spec.js create mode 100644 server/api/user_has_team/index.js create mode 100644 server/api/user_has_team/user_has_team.controller.js create mode 100644 server/api/user_has_team/user_has_team.model.js create mode 100644 server/api/user_has_team/user_has_team.socket.js create mode 100644 server/api/user_has_team/user_has_team.spec.js create mode 100644 server/api/user_has_voice_queue/index.js create mode 100644 server/api/user_has_voice_queue/user_has_voice_queue.controller.js create mode 100644 server/api/user_has_voice_queue/user_has_voice_queue.socket.js create mode 100644 server/api/user_has_voice_queue/user_has_voice_queue.spec.js create mode 100644 server/api/variable/index.js create mode 100644 server/api/variable/variable.controller.js create mode 100644 server/api/variable/variable.socket.js create mode 100644 server/api/variable/variable.spec.js create mode 100644 server/api/voice_context/index.js create mode 100644 server/api/voice_context/voice_context.ami.js create mode 100644 server/api/voice_context/voice_context.controller.js create mode 100644 server/api/voice_context/voice_context.socket.js create mode 100644 server/api/voice_context/voice_context.spec.js create mode 100644 server/api/voice_extension/index.js create mode 100644 server/api/voice_extension/voice_extension.controller.js create mode 100644 server/api/voice_extension/voice_extension.socket.js create mode 100644 server/api/voice_extension/voice_extension.spec.js create mode 100644 server/api/voice_musiconhold/index.js create mode 100644 server/api/voice_musiconhold/voice_musiconhold.controller.js create mode 100644 server/api/voice_musiconhold/voice_musiconhold.socket.js create mode 100644 server/api/voice_musiconhold/voice_musiconhold.spec.js create mode 100644 server/api/voice_queue/index.js create mode 100644 server/api/voice_queue/voice_queue.controller.js create mode 100644 server/api/voice_queue/voice_queue.socket.js create mode 100644 server/api/voice_queue/voice_queue.spec.js create mode 100644 server/api/voice_voicemail/index.js create mode 100644 server/api/voice_voicemail/voice_voicemail.controller.js create mode 100644 server/api/voice_voicemail/voice_voicemail.socket.js create mode 100644 server/api/voice_voicemail/voice_voicemail.spec.js create mode 100644 server/api/widget/index.js create mode 100644 server/api/widget/widget.controller.js create mode 100644 server/api/widget/widget.spec.js create mode 100644 server/api/xchatty/index.js create mode 100644 server/api/xchatty/xchatty.controller.js create mode 100644 server/api/xchatty/xchatty.socket.js create mode 100644 server/api/xchatty/xchatty.spec.js create mode 100644 server/api/zendesk_account/index.js create mode 100644 server/api/zendesk_account/zendesk_account.controller.js create mode 100644 server/api/zendesk_account/zendesk_account.socket.js create mode 100644 server/api/zendesk_account/zendesk_account.spec.js create mode 100644 server/api/zendesk_configuration/index.js create mode 100644 server/api/zendesk_configuration/zendesk_configuration.controller.js create mode 100644 server/api/zendesk_configuration/zendesk_configuration.socket.js create mode 100644 server/api/zendesk_configuration/zendesk_configuration.spec.js create mode 100644 server/api/zendesk_field/index.js create mode 100644 server/api/zendesk_field/zendesk_field.controller.js create mode 100644 server/api/zendesk_field/zendesk_field.socket.js create mode 100644 server/api/zendesk_field/zendesk_field.spec.js create mode 100644 server/api/zendesk_text/index.js create mode 100644 server/api/zendesk_text/zendesk_text.controller.js create mode 100644 server/api/zendesk_text/zendesk_text.socket.js create mode 100644 server/api/zendesk_text/zendesk_text.spec.js create mode 100644 server/app.js create mode 100644 server/auth/auth.service.js create mode 100644 server/auth/facebook/index.js create mode 100644 server/auth/facebook/passport.js create mode 100644 server/auth/google/index.js create mode 100644 server/auth/google/passport.js create mode 100644 server/auth/index.js create mode 100644 server/auth/local/index.js create mode 100644 server/auth/local/local.ami.js create mode 100644 server/auth/local/passport.js create mode 100644 server/auth/twitter/index.js create mode 100644 server/auth/twitter/passport.js create mode 100644 server/components/errors/index.js create mode 100644 server/components/xchatty/assets/common/in_progress.gif create mode 100644 server/components/xchatty/assets/common/loading.gif create mode 100644 server/components/xchatty/assets/common/logo-clientengage-large.png create mode 100644 server/components/xchatty/assets/common/logo-clientengage.png create mode 100644 server/components/xchatty/assets/icons/accept.png create mode 100644 server/components/xchatty/assets/icons/add.png create mode 100644 server/components/xchatty/assets/icons/arrow_refresh.png create mode 100644 server/components/xchatty/assets/icons/attach.png create mode 100644 server/components/xchatty/assets/icons/bell.png create mode 100644 server/components/xchatty/assets/icons/bin_closed.png create mode 100644 server/components/xchatty/assets/icons/bullet_arrow_down.png create mode 100644 server/components/xchatty/assets/icons/bullet_arrow_up.png create mode 100644 server/components/xchatty/assets/icons/bullet_green.png create mode 100644 server/components/xchatty/assets/icons/bullet_red.png create mode 100644 server/components/xchatty/assets/icons/bullet_star.png create mode 100644 server/components/xchatty/assets/icons/bullet_toggle_minus.png create mode 100644 server/components/xchatty/assets/icons/bullet_toggle_plus.png create mode 100644 server/components/xchatty/assets/icons/cancel.png create mode 100644 server/components/xchatty/assets/icons/chart_curve.png create mode 100644 server/components/xchatty/assets/icons/clock.png create mode 100644 server/components/xchatty/assets/icons/cog.png create mode 100644 server/components/xchatty/assets/icons/comment.png create mode 100644 server/components/xchatty/assets/icons/comment_add.png create mode 100644 server/components/xchatty/assets/icons/comments_add.png create mode 100644 server/components/xchatty/assets/icons/control_pause.png create mode 100644 server/components/xchatty/assets/icons/database_key.png create mode 100644 server/components/xchatty/assets/icons/date.png create mode 100644 server/components/xchatty/assets/icons/date_next.png create mode 100644 server/components/xchatty/assets/icons/date_previous.png create mode 100644 server/components/xchatty/assets/icons/delete.png create mode 100644 server/components/xchatty/assets/icons/disk.png create mode 100644 server/components/xchatty/assets/icons/door_out.png create mode 100644 server/components/xchatty/assets/icons/email.png create mode 100644 server/components/xchatty/assets/icons/error.png create mode 100644 server/components/xchatty/assets/icons/exclamation.png create mode 100644 server/components/xchatty/assets/icons/eye.png create mode 100644 server/components/xchatty/assets/icons/film.png create mode 100644 server/components/xchatty/assets/icons/folder_go.png create mode 100644 server/components/xchatty/assets/icons/folder_user.png create mode 100644 server/components/xchatty/assets/icons/folder_wrench.png create mode 100644 server/components/xchatty/assets/icons/group.png create mode 100644 server/components/xchatty/assets/icons/help.png create mode 100644 server/components/xchatty/assets/icons/information.png create mode 100644 server/components/xchatty/assets/icons/key.png create mode 100644 server/components/xchatty/assets/icons/layout.png create mode 100644 server/components/xchatty/assets/icons/layout_content.png create mode 100644 server/components/xchatty/assets/icons/layout_link.png create mode 100644 server/components/xchatty/assets/icons/lightning.png create mode 100644 server/components/xchatty/assets/icons/link_go.png create mode 100644 server/components/xchatty/assets/icons/lock.png create mode 100644 server/components/xchatty/assets/icons/magnifier.png create mode 100644 server/components/xchatty/assets/icons/music.png create mode 100644 server/components/xchatty/assets/icons/new.png create mode 100644 server/components/xchatty/assets/icons/page_white.png create mode 100644 server/components/xchatty/assets/icons/page_white_acrobat.png create mode 100644 server/components/xchatty/assets/icons/page_white_camera.png create mode 100644 server/components/xchatty/assets/icons/page_white_compressed.png create mode 100644 server/components/xchatty/assets/icons/page_white_excel.png create mode 100644 server/components/xchatty/assets/icons/page_white_picture.png create mode 100644 server/components/xchatty/assets/icons/page_white_powerpoint.png create mode 100644 server/components/xchatty/assets/icons/page_white_text.png create mode 100644 server/components/xchatty/assets/icons/page_white_word.png create mode 100644 server/components/xchatty/assets/icons/pencil.png create mode 100644 server/components/xchatty/assets/icons/readme.txt create mode 100644 server/components/xchatty/assets/icons/report.png create mode 100644 server/components/xchatty/assets/icons/report_add.png create mode 100644 server/components/xchatty/assets/icons/report_go.png create mode 100644 server/components/xchatty/assets/icons/script_code.png create mode 100644 server/components/xchatty/assets/icons/star.png create mode 100644 server/components/xchatty/assets/icons/table.png create mode 100644 server/components/xchatty/assets/icons/table_gear.png create mode 100644 server/components/xchatty/assets/icons/table_go.png create mode 100644 server/components/xchatty/assets/icons/textfield_delete.png create mode 100644 server/components/xchatty/assets/icons/tick.png create mode 100644 server/components/xchatty/assets/icons/time.png create mode 100644 server/components/xchatty/assets/icons/timeline_marker.png create mode 100644 server/components/xchatty/assets/icons/vcard.png create mode 100644 server/components/xchatty/assets/icons/wrench_orange.png create mode 100644 server/components/xchatty/assets/images/bullet_clock.png create mode 100644 server/components/xchatty/assets/images/bullet_pencil.png create mode 100644 server/components/xchatty/assets/images/bullet_tick.png create mode 100644 server/components/xchatty/assets/images/icon_visitorchat.png create mode 100644 server/components/xchatty/assets/images/loading.gif create mode 100644 server/components/xchatty/assets/js/jquery.min.js create mode 100644 server/components/xchatty/assets/notification/xc_blubb.mp3 create mode 100644 server/components/xchatty/assets/notification/xc_blubb.ogg create mode 100644 server/components/xchatty/assets/notification/xc_blubb.wav create mode 100644 server/components/xchatty/assets/smilies/biggrin.png create mode 100644 server/components/xchatty/assets/smilies/confused.png create mode 100644 server/components/xchatty/assets/smilies/cool.png create mode 100644 server/components/xchatty/assets/smilies/cry.png create mode 100644 server/components/xchatty/assets/smilies/eek.png create mode 100644 server/components/xchatty/assets/smilies/evil.png create mode 100644 server/components/xchatty/assets/smilies/like.png create mode 100644 server/components/xchatty/assets/smilies/lol.png create mode 100644 server/components/xchatty/assets/smilies/love.png create mode 100644 server/components/xchatty/assets/smilies/mad.png create mode 100644 server/components/xchatty/assets/smilies/mrgreen.png create mode 100644 server/components/xchatty/assets/smilies/neutral.png create mode 100644 server/components/xchatty/assets/smilies/question.png create mode 100644 server/components/xchatty/assets/smilies/razz.png create mode 100644 server/components/xchatty/assets/smilies/redface.png create mode 100644 server/components/xchatty/assets/smilies/rolleyes.png create mode 100644 server/components/xchatty/assets/smilies/sad.png create mode 100644 server/components/xchatty/assets/smilies/smile.png create mode 100644 server/components/xchatty/assets/smilies/surprised.png create mode 100644 server/components/xchatty/assets/smilies/thumbdown.png create mode 100644 server/components/xchatty/assets/smilies/thumbup.png create mode 100644 server/components/xchatty/assets/smilies/twisted.png create mode 100644 server/components/xchatty/assets/smilies/wink.png create mode 100644 server/components/xchatty/assets/styles/backgrounds/vc_background_black.png create mode 100644 server/components/xchatty/assets/styles/backgrounds/vc_background_blue.png create mode 100644 server/components/xchatty/assets/styles/backgrounds/vc_background_green.png create mode 100644 server/components/xchatty/assets/styles/backgrounds/vc_background_red.png create mode 100644 server/components/xchatty/assets/styles/loading.gif create mode 100644 server/components/xchatty/index.js create mode 100644 server/components/xchatty/snippet.html create mode 100644 server/components/xchatty/xchatty.css create mode 100644 server/components/xchatty/xchatty.js create mode 100644 server/config/agi.js create mode 100644 server/config/agi_scripts/googletts.agi create mode 100644 server/config/agi_scripts/ispeech-asr.agi create mode 100644 server/config/agi_scripts/ispeech-tts.agi create mode 100644 server/config/ami/acw.js create mode 100644 server/config/ami/agent.js create mode 100644 server/config/ami/call.js create mode 100644 server/config/ami/dial.js create mode 100644 server/config/ami/index.js create mode 100644 server/config/ami/member.js create mode 100644 server/config/ami/queue_caller.js create mode 100644 server/config/ami/queue_member.js create mode 100644 server/config/analytics.js create mode 100644 server/config/autodialer/index.js create mode 100644 server/config/autodialer/process.js create mode 100644 server/config/automations/fax.js create mode 100644 server/config/automations/mail.js create mode 100644 server/config/environment/config.json create mode 100644 server/config/environment/development.js create mode 100644 server/config/environment/index.js create mode 100644 server/config/environment/production.js create mode 100644 server/config/environment/test.js create mode 100644 server/config/express.js create mode 100644 server/config/fax.js create mode 100644 server/config/history.js create mode 100644 server/config/imap.js create mode 100644 server/config/integration.js create mode 100644 server/config/kue.chat.js create mode 100644 server/config/kue.fax.js create mode 100644 server/config/kue.mail.js create mode 100644 server/config/local.env.sample.js create mode 100644 server/config/logger.js create mode 100644 server/config/seed.js create mode 100644 server/config/smtp.js create mode 100644 server/config/socketio.js create mode 100644 server/config/triggers/mail.js create mode 100644 server/files/asterisk/sip_xcally_contexts.conf create mode 100644 server/files/asterisk/sip_xcally_registers.conf create mode 100644 server/files/asterisk/sip_xcally_trunks.conf create mode 100644 server/files/geoip/17monipdb.dat create mode 100644 server/files/geoip/IP.class.php create mode 100644 server/files/geoip/readme.txt create mode 100644 server/files/images/avatar5.png create mode 100644 server/files/images/customer.png create mode 100644 server/files/images/userpic.png create mode 100644 server/files/images/userpic.png.old.png create mode 100644 server/files/integrations/zendesk/app.js create mode 100644 server/files/integrations/zendesk/manifest.json create mode 100644 server/files/sounds/converted/8dml2nHgdylpQdAb.wav create mode 100644 server/files/sounds/converted/DqcAGJTcbebQu5PW.wav create mode 100644 server/files/sounds/original/8dml2nHgdylpQdAb.wav create mode 100644 server/files/sounds/original/DqcAGJTcbebQu5PW.wav create mode 100644 server/migrations/20151202190300-test.js create mode 100644 server/models/asterisk_manager.js create mode 100644 server/models/asterisk_manager_interface.js create mode 100644 server/models/autodialer_contact.js create mode 100644 server/models/autodialer_process.js create mode 100644 server/models/automation.js create mode 100644 server/models/business_action.js create mode 100644 server/models/business_condition.js create mode 100644 server/models/channel.js create mode 100644 server/models/chat_application.js create mode 100644 server/models/chat_enquiry.js create mode 100644 server/models/chat_message.js create mode 100644 server/models/chat_queue.js create mode 100644 server/models/chat_room.js create mode 100644 server/models/chat_visitor.js create mode 100644 server/models/chat_website.js create mode 100644 server/models/contact.js create mode 100644 server/models/dashboard.js create mode 100644 server/models/event.js create mode 100644 server/models/fax_account.js create mode 100644 server/models/fax_application.js create mode 100644 server/models/fax_business_automation.js create mode 100644 server/models/fax_message.js create mode 100644 server/models/fax_queue.js create mode 100644 server/models/fax_room.js create mode 100644 server/models/history/report_agent_history.js create mode 100644 server/models/history/report_call_history.js create mode 100644 server/models/history/report_dial_history.js create mode 100644 server/models/history/report_member_history.js create mode 100644 server/models/history/report_queue_history.js create mode 100644 server/models/index.js create mode 100644 server/models/integration.js create mode 100644 server/models/interval.js create mode 100644 server/models/mail_account.js create mode 100644 server/models/mail_application.js create mode 100644 server/models/mail_attachment.js create mode 100644 server/models/mail_automation.js create mode 100644 server/models/mail_business_automation.js create mode 100644 server/models/mail_message.js create mode 100644 server/models/mail_queue.js create mode 100644 server/models/mail_room.js create mode 100644 server/models/mail_server_in.js create mode 100644 server/models/mail_server_out.js create mode 100644 server/models/mail_template.js create mode 100644 server/models/mail_trigger.js create mode 100644 server/models/module.js create mode 100644 server/models/motionbar.js create mode 100644 server/models/report_agent.js create mode 100644 server/models/report_call.js create mode 100644 server/models/report_chat.js create mode 100644 server/models/report_chat_session.js create mode 100644 server/models/report_dial.js create mode 100644 server/models/report_mail.js create mode 100644 server/models/report_mail_session.js create mode 100644 server/models/report_member.js create mode 100644 server/models/report_queue.js create mode 100644 server/models/report_square.js create mode 100644 server/models/report_square_detail.js create mode 100644 server/models/settings.js create mode 100644 server/models/square_odbc.js create mode 100644 server/models/square_project.js create mode 100644 server/models/team.js create mode 100644 server/models/trigger.js create mode 100644 server/models/trunk.js create mode 100644 server/models/upload.js create mode 100644 server/models/user.js create mode 100644 server/models/user_has_chat_queue.js create mode 100644 server/models/user_has_chat_room.js create mode 100644 server/models/user_has_fax_queue.js create mode 100644 server/models/user_has_mail_queue.js create mode 100644 server/models/user_has_team.js create mode 100644 server/models/user_has_voice_queue.js create mode 100644 server/models/variable.js create mode 100644 server/models/voice_context.js create mode 100644 server/models/voice_extension.js create mode 100644 server/models/voice_musiconhold.js create mode 100644 server/models/voice_queue.js create mode 100644 server/models/voice_voicemail.js create mode 100644 server/models/voice_voicemail_messages.js create mode 100644 server/models/zendesk_account.js create mode 100644 server/models/zendesk_configuration.js create mode 100644 server/models/zendesk_field.js create mode 100644 server/models/zendesk_text.js create mode 100644 server/routes.js create mode 100644 server/views/404.html diff --git a/README.md b/README.md deleted file mode 100644 index e69de29..0000000 diff --git a/package.json b/package.json new file mode 100644 index 0000000..5191bf8 --- /dev/null +++ b/package.json @@ -0,0 +1,137 @@ +{ + "name": "motion", + "version": "0.0.2", + "main": "server/app.js", + "dependencies": { + "accept-language-parser": "^1.0.2", + "adm-zip": "^0.4.7", + "agi": "0.0.4", + "asterisk-manager": "^0.1.15", + "async": "^1.5.0", + "body-parser": "~1.14.1", + "composable-middleware": "^0.3.0", + "compression": "~1.6.0", + "connect-flash": "^0.1.1", + "cookie-parser": "~1.4.0", + "cron": "^1.0.9", + "ejs": "^2.3.4", + "errorhandler": "~1.4.2", + "express": "^4.13.3", + "express-jwt": "^3.3.0", + "express-mysql-session": "^0.4.3", + "express-session": "~1.12.1", + "file-base64": "^1.0.0", + "formidable": "^1.0.17", + "fs-extra": "^0.26.2", + "generator-adf-widget": "^0.3.2", + "geoip-lite": "^1.1.6", + "html-pdf": "^1.4.0", + "html-to-text": "^1.5.0", + "ipaddr.js": "^1.0.4", + "jsmin": "^1.0.1", + "jsonwebtoken": "^5.4.1", + "kue": "^0.10.4", + "lodash": "^3.0.0", + "mail-listener2": "^0.1.8", + "md5": "2.x", + "method-override": "~2.3.5", + "moment": "^2.10.6", + "morgan": "~1.6.1", + "mustache": "^2.2.0", + "mysql": "^2.9.0", + "node-uuid": "^1.4.7", + "node-zendesk": "^1.1.5", + "nodemailer": "^1.10.0", + "nodemailer-smtp-transport": "^1.0.4", + "odbc": "^1.2.1", + "passport": "~0.3.2", + "passport-facebook": "latest", + "passport-google-oauth": "latest", + "passport-local": "~1.0.0", + "passport-twitter": "latest", + "phantomjs": "^1.9.19", + "remove": "^0.1.5", + "sequelize": "^3.14.1", + "serve-favicon": "~2.3.0", + "shelljs": "^0.5.3", + "simple-random": "^1.0.3", + "socket.io": "^1.3.7", + "socket.io-client": "^1.3.7", + "socketio-jwt": "^4.3.3", + "sox": "^0.1.0", + "spindrift": "0.0.6", + "string-to-json": "^0.1.0", + "tiff-to-png": "^1.0.2", + "to-csv": "^0.1.0", + "ua-parser-js": "^0.7.9", + "upload-file": "^1.2.0", + "wait.for": "^0.6.6", + "xml2js": "^0.4.15", + "yo": "^1.5.0" + }, + "devDependencies": { + "connect-livereload": "~0.5.3", + "grunt": "~0.4.5", + "grunt-angular-templates": "^0.5.7", + "grunt-asset-injector": "^0.1.0", + "grunt-autoprefixer": "3.0.0", + "grunt-build-control": "DaftMonk/grunt-build-control", + "grunt-changelog": "^0.3.1", + "grunt-concurrent": "~2.0.0", + "grunt-contrib-clean": "~0.6.0", + "grunt-contrib-concat": "~0.5.1", + "grunt-contrib-copy": "~0.8.0", + "grunt-contrib-cssmin": "~0.12.3", + "grunt-contrib-htmlmin": "~0.4.0", + "grunt-contrib-imagemin": "~0.9.4", + "grunt-contrib-jshint": "~0.11.2", + "grunt-contrib-uglify": "~0.9.1", + "grunt-contrib-watch": "~0.6.1", + "grunt-dom-munger": "^3.4.0", + "grunt-env": "~0.4.4", + "grunt-express-server": "~0.5.1", + "grunt-google-cdn": "~0.4.3", + "grunt-karma": "~0.12.0", + "grunt-mocha-test": "~0.12.7", + "grunt-newer": "~1.1.1", + "grunt-ng-annotate": "^1.0.1", + "grunt-node-inspector": ">=0.2.0", + "grunt-nodemon": "~0.4.0", + "grunt-open": "~0.2.3", + "grunt-protractor-runner": "^2.0.0", + "grunt-rev": "~0.1.0", + "grunt-svgmin": "~2.0.1", + "grunt-usemin": "~3.0.0", + "grunt-version": "^1.0.0", + "grunt-wiredep": "~2.0.0", + "jit-grunt": "^0.9.1", + "jshint-stylish": "~2.0.1", + "karma": "~0.13.2", + "karma-chrome-launcher": "~0.2.0", + "karma-coffee-preprocessor": "~0.3.0", + "karma-firefox-launcher": "~0.1.6", + "karma-html2js-preprocessor": "~0.1.0", + "karma-jade-preprocessor": "0.0.11", + "karma-jasmine": "~0.3.6", + "karma-ng-html2js-preprocessor": "~0.1.2", + "karma-ng-jade2js-preprocessor": "^0.2.0", + "karma-ng-scenario": "~0.1.0", + "karma-phantomjs-launcher": "~0.2.0", + "karma-requirejs": "~0.2.2", + "karma-script-launcher": "~0.1.0", + "open": "~0.0.5", + "requirejs": "~2.1.19", + "should": "~7.0.2", + "supertest": "~1.0.1", + "time-grunt": "~1.2.1" + }, + "engines": { + "node": ">=0.10.0" + }, + "scripts": { + "start": "node server/app.js", + "test": "grunt test", + "update-webdriver": "node node_modules/grunt-protractor-runner/node_modules/protractor/bin/webdriver-manager update" + }, + "private": true +} diff --git a/public/.htaccess b/public/.htaccess new file mode 100644 index 0000000..cb84cb9 --- /dev/null +++ b/public/.htaccess @@ -0,0 +1,543 @@ +# Apache Configuration File + +# (!) Using `.htaccess` files slows down Apache, therefore, if you have access +# to the main server config file (usually called `httpd.conf`), you should add +# this logic there: http://httpd.apache.org/docs/current/howto/htaccess.html. + +# ############################################################################## +# # CROSS-ORIGIN RESOURCE SHARING (CORS) # +# ############################################################################## + +# ------------------------------------------------------------------------------ +# | Cross-domain AJAX requests | +# ------------------------------------------------------------------------------ + +# Enable cross-origin AJAX requests. +# http://code.google.com/p/html5security/wiki/CrossOriginRequestSecurity +# http://enable-cors.org/ + +# +# Header set Access-Control-Allow-Origin "*" +# + +# ------------------------------------------------------------------------------ +# | CORS-enabled images | +# ------------------------------------------------------------------------------ + +# Send the CORS header for images when browsers request it. +# https://developer.mozilla.org/en/CORS_Enabled_Image +# http://blog.chromium.org/2011/07/using-cross-domain-images-in-webgl-and.html +# http://hacks.mozilla.org/2011/11/using-cors-to-load-webgl-textures-from-cross-domain-images/ + + + + + SetEnvIf Origin ":" IS_CORS + Header set Access-Control-Allow-Origin "*" env=IS_CORS + + + + +# ------------------------------------------------------------------------------ +# | Web fonts access | +# ------------------------------------------------------------------------------ + +# Allow access from all domains for web fonts + + + + Header set Access-Control-Allow-Origin "*" + + + + +# ############################################################################## +# # ERRORS # +# ############################################################################## + +# ------------------------------------------------------------------------------ +# | 404 error prevention for non-existing redirected folders | +# ------------------------------------------------------------------------------ + +# Prevent Apache from returning a 404 error for a rewrite if a directory +# with the same name does not exist. +# http://httpd.apache.org/docs/current/content-negotiation.html#multiviews +# http://www.webmasterworld.com/apache/3808792.htm + +Options -MultiViews + +# ------------------------------------------------------------------------------ +# | Custom error messages / pages | +# ------------------------------------------------------------------------------ + +# You can customize what Apache returns to the client in case of an error (see +# http://httpd.apache.org/docs/current/mod/core.html#errordocument), e.g.: + +ErrorDocument 404 /404.html + + +# ############################################################################## +# # INTERNET EXPLORER # +# ############################################################################## + +# ------------------------------------------------------------------------------ +# | Better website experience | +# ------------------------------------------------------------------------------ + +# Force IE to render pages in the highest available mode in the various +# cases when it may not: http://hsivonen.iki.fi/doctype/ie-mode.pdf. + + + Header set X-UA-Compatible "IE=edge" + # `mod_headers` can't match based on the content-type, however, we only + # want to send this header for HTML pages and not for the other resources + + Header unset X-UA-Compatible + + + +# ------------------------------------------------------------------------------ +# | Cookie setting from iframes | +# ------------------------------------------------------------------------------ + +# Allow cookies to be set from iframes in IE. + +# +# Header set P3P "policyref=\"/w3c/p3p.xml\", CP=\"IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT\"" +# + +# ------------------------------------------------------------------------------ +# | Screen flicker | +# ------------------------------------------------------------------------------ + +# Stop screen flicker in IE on CSS rollovers (this only works in +# combination with the `ExpiresByType` directives for images from below). + +# BrowserMatch "MSIE" brokenvary=1 +# BrowserMatch "Mozilla/4.[0-9]{2}" brokenvary=1 +# BrowserMatch "Opera" !brokenvary +# SetEnvIf brokenvary 1 force-no-vary + + +# ############################################################################## +# # MIME TYPES AND ENCODING # +# ############################################################################## + +# ------------------------------------------------------------------------------ +# | Proper MIME types for all files | +# ------------------------------------------------------------------------------ + + + + # Audio + AddType audio/mp4 m4a f4a f4b + AddType audio/ogg oga ogg + + # JavaScript + # Normalize to standard type (it's sniffed in IE anyways): + # http://tools.ietf.org/html/rfc4329#section-7.2 + AddType application/javascript js jsonp + AddType application/json json + + # Video + AddType video/mp4 mp4 m4v f4v f4p + AddType video/ogg ogv + AddType video/webm webm + AddType video/x-flv flv + + # Web fonts + AddType application/font-woff woff + AddType application/vnd.ms-fontobject eot + + # Browsers usually ignore the font MIME types and sniff the content, + # however, Chrome shows a warning if other MIME types are used for the + # following fonts. + AddType application/x-font-ttf ttc ttf + AddType font/opentype otf + + # Make SVGZ fonts work on iPad: + # https://twitter.com/FontSquirrel/status/14855840545 + AddType image/svg+xml svg svgz + AddEncoding gzip svgz + + # Other + AddType application/octet-stream safariextz + AddType application/x-chrome-extension crx + AddType application/x-opera-extension oex + AddType application/x-shockwave-flash swf + AddType application/x-web-app-manifest+json webapp + AddType application/x-xpinstall xpi + AddType application/xml atom rdf rss xml + AddType image/webp webp + AddType image/x-icon ico + AddType text/cache-manifest appcache manifest + AddType text/vtt vtt + AddType text/x-component htc + AddType text/x-vcard vcf + + + +# ------------------------------------------------------------------------------ +# | UTF-8 encoding | +# ------------------------------------------------------------------------------ + +# Use UTF-8 encoding for anything served as `text/html` or `text/plain`. +AddDefaultCharset utf-8 + +# Force UTF-8 for certain file formats. + + AddCharset utf-8 .atom .css .js .json .rss .vtt .webapp .xml + + + +# ############################################################################## +# # URL REWRITES # +# ############################################################################## + +# ------------------------------------------------------------------------------ +# | Rewrite engine | +# ------------------------------------------------------------------------------ + +# Turning on the rewrite engine and enabling the `FollowSymLinks` option is +# necessary for the following directives to work. + +# If your web host doesn't allow the `FollowSymlinks` option, you may need to +# comment it out and use `Options +SymLinksIfOwnerMatch` but, be aware of the +# performance impact: http://httpd.apache.org/docs/current/misc/perf-tuning.html#symlinks + +# Also, some cloud hosting services require `RewriteBase` to be set: +# http://www.rackspace.com/knowledge_center/frequently-asked-question/why-is-mod-rewrite-not-working-on-my-site + + + Options +FollowSymlinks + # Options +SymLinksIfOwnerMatch + RewriteEngine On + # RewriteBase / + + +# ------------------------------------------------------------------------------ +# | Suppressing / Forcing the "www." at the beginning of URLs | +# ------------------------------------------------------------------------------ + +# The same content should never be available under two different URLs especially +# not with and without "www." at the beginning. This can cause SEO problems +# (duplicate content), therefore, you should choose one of the alternatives and +# redirect the other one. + +# By default option 1 (no "www.") is activated: +# http://no-www.org/faq.php?q=class_b + +# If you'd prefer to use option 2, just comment out all the lines from option 1 +# and uncomment the ones from option 2. + +# IMPORTANT: NEVER USE BOTH RULES AT THE SAME TIME! + +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +# Option 1: rewrite www.example.com → example.com + + + RewriteCond %{HTTPS} !=on + RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC] + RewriteRule ^ http://%1%{REQUEST_URI} [R=301,L] + + +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +# Option 2: rewrite example.com → www.example.com + +# Be aware that the following might not be a good idea if you use "real" +# subdomains for certain parts of your website. + +# +# RewriteCond %{HTTPS} !=on +# RewriteCond %{HTTP_HOST} !^www\..+$ [NC] +# RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L] +# + + +# ############################################################################## +# # SECURITY # +# ############################################################################## + +# ------------------------------------------------------------------------------ +# | Content Security Policy (CSP) | +# ------------------------------------------------------------------------------ + +# You can mitigate the risk of cross-site scripting and other content-injection +# attacks by setting a Content Security Policy which whitelists trusted sources +# of content for your site. + +# The example header below allows ONLY scripts that are loaded from the current +# site's origin (no inline scripts, no CDN, etc). This almost certainly won't +# work as-is for your site! + +# To get all the details you'll need to craft a reasonable policy for your site, +# read: http://html5rocks.com/en/tutorials/security/content-security-policy (or +# see the specification: http://w3.org/TR/CSP). + +# +# Header set Content-Security-Policy "script-src 'self'; object-src 'self'" +# +# Header unset Content-Security-Policy +# +# + +# ------------------------------------------------------------------------------ +# | File access | +# ------------------------------------------------------------------------------ + +# Block access to directories without a default document. +# Usually you should leave this uncommented because you shouldn't allow anyone +# to surf through every directory on your server (which may includes rather +# private places like the CMS's directories). + + + Options -Indexes + + +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +# Block access to hidden files and directories. +# This includes directories used by version control systems such as Git and SVN. + + + RewriteCond %{SCRIPT_FILENAME} -d [OR] + RewriteCond %{SCRIPT_FILENAME} -f + RewriteRule "(^|/)\." - [F] + + +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +# Block access to backup and source files. +# These files may be left by some text editors and can pose a great security +# danger when anyone has access to them. + + + Order allow,deny + Deny from all + Satisfy All + + +# ------------------------------------------------------------------------------ +# | Secure Sockets Layer (SSL) | +# ------------------------------------------------------------------------------ + +# Rewrite secure requests properly to prevent SSL certificate warnings, e.g.: +# prevent `https://www.example.com` when your certificate only allows +# `https://secure.example.com`. + +# +# RewriteCond %{SERVER_PORT} !^443 +# RewriteRule ^ https://example-domain-please-change-me.com%{REQUEST_URI} [R=301,L] +# + +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +# Force client-side SSL redirection. + +# If a user types "example.com" in his browser, the above rule will redirect him +# to the secure version of the site. That still leaves a window of opportunity +# (the initial HTTP connection) for an attacker to downgrade or redirect the +# request. The following header ensures that browser will ONLY connect to your +# server via HTTPS, regardless of what the users type in the address bar. +# http://www.html5rocks.com/en/tutorials/security/transport-layer-security/ + +# +# Header set Strict-Transport-Security max-age=16070400; +# + +# ------------------------------------------------------------------------------ +# | Server software information | +# ------------------------------------------------------------------------------ + +# Avoid displaying the exact Apache version number, the description of the +# generic OS-type and the information about Apache's compiled-in modules. + +# ADD THIS DIRECTIVE IN THE `httpd.conf` AS IT WILL NOT WORK IN THE `.htaccess`! + +# ServerTokens Prod + + +# ############################################################################## +# # WEB PERFORMANCE # +# ############################################################################## + +# ------------------------------------------------------------------------------ +# | Compression | +# ------------------------------------------------------------------------------ + + + + # Force compression for mangled headers. + # http://developer.yahoo.com/blogs/ydn/posts/2010/12/pushing-beyond-gzipping + + + SetEnvIfNoCase ^(Accept-EncodXng|X-cept-Encoding|X{15}|~{15}|-{15})$ ^((gzip|deflate)\s*,?\s*)+|[X~-]{4,13}$ HAVE_Accept-Encoding + RequestHeader append Accept-Encoding "gzip,deflate" env=HAVE_Accept-Encoding + + + + # Compress all output labeled with one of the following MIME-types + # (for Apache versions below 2.3.7, you don't need to enable `mod_filter` + # and can remove the `` and `` lines + # as `AddOutputFilterByType` is still in the core directives). + + AddOutputFilterByType DEFLATE application/atom+xml \ + application/javascript \ + application/json \ + application/rss+xml \ + application/vnd.ms-fontobject \ + application/x-font-ttf \ + application/x-web-app-manifest+json \ + application/xhtml+xml \ + application/xml \ + font/opentype \ + image/svg+xml \ + image/x-icon \ + text/css \ + text/html \ + text/plain \ + text/x-component \ + text/xml + + + + +# ------------------------------------------------------------------------------ +# | Content transformations | +# ------------------------------------------------------------------------------ + +# Prevent some of the mobile network providers from modifying the content of +# your site: http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9.5. + +# +# Header set Cache-Control "no-transform" +# + +# ------------------------------------------------------------------------------ +# | ETag removal | +# ------------------------------------------------------------------------------ + +# Since we're sending far-future expires headers (see below), ETags can +# be removed: http://developer.yahoo.com/performance/rules.html#etags. + +# `FileETag None` is not enough for every server. + + Header unset ETag + + +FileETag None + +# ------------------------------------------------------------------------------ +# | Expires headers (for better cache control) | +# ------------------------------------------------------------------------------ + +# The following expires headers are set pretty far in the future. If you don't +# control versioning with filename-based cache busting, consider lowering the +# cache time for resources like CSS and JS to something like 1 week. + + + + ExpiresActive on + ExpiresDefault "access plus 1 month" + + # CSS + ExpiresByType text/css "access plus 1 year" + + # Data interchange + ExpiresByType application/json "access plus 0 seconds" + ExpiresByType application/xml "access plus 0 seconds" + ExpiresByType text/xml "access plus 0 seconds" + + # Favicon (cannot be renamed!) + ExpiresByType image/x-icon "access plus 1 week" + + # HTML components (HTCs) + ExpiresByType text/x-component "access plus 1 month" + + # HTML + ExpiresByType text/html "access plus 0 seconds" + + # JavaScript + ExpiresByType application/javascript "access plus 1 year" + + # Manifest files + ExpiresByType application/x-web-app-manifest+json "access plus 0 seconds" + ExpiresByType text/cache-manifest "access plus 0 seconds" + + # Media + ExpiresByType audio/ogg "access plus 1 month" + ExpiresByType image/gif "access plus 1 month" + ExpiresByType image/jpeg "access plus 1 month" + ExpiresByType image/png "access plus 1 month" + ExpiresByType video/mp4 "access plus 1 month" + ExpiresByType video/ogg "access plus 1 month" + ExpiresByType video/webm "access plus 1 month" + + # Web feeds + ExpiresByType application/atom+xml "access plus 1 hour" + ExpiresByType application/rss+xml "access plus 1 hour" + + # Web fonts + ExpiresByType application/font-woff "access plus 1 month" + ExpiresByType application/vnd.ms-fontobject "access plus 1 month" + ExpiresByType application/x-font-ttf "access plus 1 month" + ExpiresByType font/opentype "access plus 1 month" + ExpiresByType image/svg+xml "access plus 1 month" + + + +# ------------------------------------------------------------------------------ +# | Filename-based cache busting | +# ------------------------------------------------------------------------------ + +# If you're not using a build process to manage your filename version revving, +# you might want to consider enabling the following directives to route all +# requests such as `/css/style.12345.css` to `/css/style.css`. + +# To understand why this is important and a better idea than `*.css?v231`, read: +# http://stevesouders.com/blog/2008/08/23/revving-filenames-dont-use-querystring + +# +# RewriteCond %{REQUEST_FILENAME} !-f +# RewriteCond %{REQUEST_FILENAME} !-d +# RewriteRule ^(.+)\.(\d+)\.(js|css|png|jpg|gif)$ $1.$3 [L] +# + +# ------------------------------------------------------------------------------ +# | File concatenation | +# ------------------------------------------------------------------------------ + +# Allow concatenation from within specific CSS and JS files, e.g.: +# Inside of `script.combined.js` you could have +# +# +# and they would be included into this single file. + +# +# +# Options +Includes +# AddOutputFilterByType INCLUDES application/javascript application/json +# SetOutputFilter INCLUDES +# +# +# Options +Includes +# AddOutputFilterByType INCLUDES text/css +# SetOutputFilter INCLUDES +# +# + +# ------------------------------------------------------------------------------ +# | Persistent connections | +# ------------------------------------------------------------------------------ + +# Allow multiple requests to be sent over the same TCP connection: +# http://httpd.apache.org/docs/current/en/mod/core.html#keepalive. + +# Enable if you serve a lot of static content but, be aware of the +# possible disadvantages! + +# +# Header set Connection Keep-Alive +# diff --git a/public/app/0e6d6720.vendor.js b/public/app/0e6d6720.vendor.js new file mode 100644 index 0000000..34a55a5 --- /dev/null +++ b/public/app/0e6d6720.vendor.js @@ -0,0 +1,84 @@ +function $notificationProvider(){function a(a,c,d){function e(c,d){function f(){d=angular.extend({focusWindowOnClick:!0},b.options||{},d);try{g.baseNotification=new a.Notification(c,d)}catch(e){return}d.delay&&setTimeout(angular.bind(g,g.close),d.delay),d.focusWindowOnClick&&g.$on("click",function(){a.focus()}),g._events.forEach(function(a){g.$on.apply(g,a)}),g._events=[]}if(!a.Notification)return!1;d=d||{};var g=this;return this._events=[],"granted"===a.Notification.permission?f():void("denied"!==a.Notification.permission&&e.requestPermission().then(f))}function f(a,b){return new e(a,b)}return e.prototype.$on=function(a,b){function d(){var a=arguments;c.$apply(function(){b.apply(e,a)})}var e=this;return this.baseNotification?(this.baseNotification.addEventListener(a,d),function(){this.baseNotification.removeListener(event,d)}):this._events.push([a,b])},e.prototype.close=function(){this.baseNotification&&this.baseNotification.close()},e.requestPermission=function(){return d(function(b,c){return a.Notification?void a.Notification.requestPermission(function(c){a.Notification.permission=a.Notification.permission||c,b(a.Notification.permission)}):c()})},f.requestPermission=e.requestPermission,f}var b=this;this.$get=["$window","$rootScope","$q",a],this.setOptions=function(a){this.options=a}}function wizardButtonDirective(a){angular.module("mgo-angular-wizard").directive(a,function(){return{restrict:"A",replace:!1,require:"^wizard",link:function(b,c,d,e){c.on("click",function(c){c.preventDefault(),b.$apply(function(){b.$eval(d[a]),e[a.replace("wz","").toLowerCase()]()})})}}})}function validElementString(a){try{return 0!==angular.element(a).length}catch(b){return!1}}function registerTextAngularTool(a,b){if(!a||""===a||taTools.hasOwnProperty(a))throw"textAngular Error: A unique name is required for a Tool Definition";if(b.display&&(""===b.display||!validElementString(b.display))||!b.display&&!b.buttontext&&!b.iconclass)throw'textAngular Error: Tool Definition for "'+a+'" does not have a valid display/iconclass/buttontext value';taTools[a]=b}if(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){function c(a){var b="length"in a&&a.length,c=_.type(a);return"function"===c||_.isWindow(a)?!1:1===a.nodeType&&b?!0:"array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a}function d(a,b,c){if(_.isFunction(b))return _.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return _.grep(a,function(a){return a===b!==c});if("string"==typeof b){if(ha.test(b))return _.filter(b,a,c);b=_.filter(b,a)}return _.grep(a,function(a){return U.call(b,a)>=0!==c})}function e(a,b){for(;(a=a[b])&&1!==a.nodeType;);return a}function f(a){var b=oa[a]={};return _.each(a.match(na)||[],function(a,c){b[c]=!0}),b}function g(){Z.removeEventListener("DOMContentLoaded",g,!1),a.removeEventListener("load",g,!1),_.ready()}function h(){Object.defineProperty(this.cache={},0,{get:function(){return{}}}),this.expando=_.expando+h.uid++}function i(a,b,c){var d;if(void 0===c&&1===a.nodeType)if(d="data-"+b.replace(ua,"-$1").toLowerCase(),c=a.getAttribute(d),"string"==typeof c){try{c="true"===c?!0:"false"===c?!1:"null"===c?null:+c+""===c?+c:ta.test(c)?_.parseJSON(c):c}catch(e){}sa.set(a,b,c)}else c=void 0;return c}function j(){return!0}function k(){return!1}function l(){try{return Z.activeElement}catch(a){}}function m(a,b){return _.nodeName(a,"table")&&_.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function n(a){return a.type=(null!==a.getAttribute("type"))+"/"+a.type,a}function o(a){var b=Ka.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function p(a,b){for(var c=0,d=a.length;d>c;c++)ra.set(a[c],"globalEval",!b||ra.get(b[c],"globalEval"))}function q(a,b){var c,d,e,f,g,h,i,j;if(1===b.nodeType){if(ra.hasData(a)&&(f=ra.access(a),g=ra.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++)_.event.add(b,e,j[e][c])}sa.hasData(a)&&(h=sa.access(a),i=_.extend({},h),sa.set(b,i))}}function r(a,b){var c=a.getElementsByTagName?a.getElementsByTagName(b||"*"):a.querySelectorAll?a.querySelectorAll(b||"*"):[];return void 0===b||b&&_.nodeName(a,b)?_.merge([a],c):c}function s(a,b){var c=b.nodeName.toLowerCase();"input"===c&&ya.test(a.type)?b.checked=a.checked:("input"===c||"textarea"===c)&&(b.defaultValue=a.defaultValue)}function t(b,c){var d,e=_(c.createElement(b)).appendTo(c.body),f=a.getDefaultComputedStyle&&(d=a.getDefaultComputedStyle(e[0]))?d.display:_.css(e[0],"display");return e.detach(),f}function u(a){var b=Z,c=Oa[a];return c||(c=t(a,b),"none"!==c&&c||(Na=(Na||_("')}])}(window),function(a,b,c){"use strict";function d(a,b,c){if(!a)throw ngMinErr("areq","Argument '{0}' is {1}",b||"?",c||"required");return a}function e(a,b){return a||b?a?b?(Q(a)&&(a=a.join(" ")),Q(b)&&(b=b.join(" ")),a+" "+b):a:b:""}function f(a){var b={};return a&&(a.to||a.from)&&(b.to=a.to,b.from=a.from),b}function g(a,b,c){var d="";return a=Q(a)?a:a&&R(a)&&a.length?a.split(/\s+/):[],P(a,function(a,e){a&&a.length>0&&(d+=e>0?" ":"",d+=c?b+a:a+b)}),d}function h(a,b){var c=a.indexOf(b);b>=0&&a.splice(c,1)}function i(a){if(a instanceof O)switch(a.length){case 0:return[];case 1:if(a[0].nodeType===X)return a;break;default:return O(j(a))}return a.nodeType===X?O(a):void 0}function j(a){if(!a[0])return a;for(var b=0;b=0)&&(c=D(c)),0===c&&(c=null),d[b]=c}}),d}function D(a){var b=0,c=a.split(/\s*,\s*/);return P(c,function(a){"s"==a.charAt(a.length-1)&&(a=a.substring(0,a.length-1)),a=parseFloat(a)||0,b=b?Math.max(a,b):a}),b}function E(a){return 0===a||null!=a}function F(a,b){var c=I,d=a+"s";return b?c+=da:d+=" linear all",[c,d]}function G(){var a=Object.create(null);return{flush:function(){a=Object.create(null)},count:function(b){var c=a[b];return c?c.total:0},get:function(b){var c=a[b];return c&&c.value},put:function(b,c){a[b]?a[b].total++:a[b]={total:1,value:c}}}}function H(a,b,c){P(c,function(c){a[c]=U(a[c])?a[c]:b.style.getPropertyValue(c)})}var I,J,K,L,M=b.noop,N=b.extend,O=b.element,P=b.forEach,Q=b.isArray,R=b.isString,S=b.isObject,T=b.isUndefined,U=b.isDefined,V=b.isFunction,W=b.isElement,X=1,Y="-add",Z="-remove",$="ng-",_="-active",aa="ng-animate",ba="$$ngAnimateChildren",ca="";T(a.ontransitionend)&&U(a.onwebkittransitionend)?(ca="-webkit-",I="WebkitTransition",J="webkitTransitionEnd transitionend"):(I="transition",J="transitionend"),T(a.onanimationend)&&U(a.onwebkitanimationend)?(ca="-webkit-",K="WebkitAnimation",L="webkitAnimationEnd animationend"):(K="animation",L="animationend");var da="Duration",ea="Property",fa="Delay",ga="TimingFunction",ha="IterationCount",ia="PlayState",ja=9999,ka=K+fa,la=K+da,ma=I+fa,na=I+da,oa=["$$rAF",function(a){function b(a){d=d.concat(a),c()}function c(){if(d.length){for(var b=d.shift(),f=0;f0&&(j=c.get(h),!j)){var k=g(f,"-stagger");d.addClass(e,k),j=C(a,e,i),j.animationDuration=Math.max(j.animationDuration,0),j.transitionDuration=Math.max(j.transitionDuration,0),d.removeClass(e,k),c.put(h,j)}return j||{}}function z(a){O.push(a),l.waitUntilQuiet(function(){b.flush(),c.flush();for(var a=j(),d=0;d0,Ia.hasAnimations=Ga.animationDuration>0}if(Ia.applyAnimationDelay&&(Ha="boolean"!=typeof c.delay&&E(c.delay)?parseFloat(c.delay):Ha,X=Math.max(Ha,0),Ga.animationDelay=Ha,Ja=B(Ha,!0),da.push(Ja),R.style[Ja[0]]=Ja[1]),aa=X*ra,ca=ba*ra,c.easing){var b,h=c.easing;Ia.hasTransitions&&(b=I+ga,da.push([b,h]),R.style[b]=h),Ia.hasAnimations&&(b=K+ga,da.push([b,h]),R.style[b]=h)}Ga.transitionDuration&&j.push(J),Ga.animationDuration&&j.push(L),g=Date.now();var k=aa+ta*ca,l=g+k,n=a.data(qa)||[],o=!0;if(n.length){var p=n[0];o=l>p.expectedEndTime,o?i.cancel(p.timer):n.push(m)}if(o){var r=i(e,k,!1);n[0]={timer:r,expectedEndTime:l},n.push(m),a.data(qa,n)}a.on(j.join(" "),f),c.to&&(c.cleanupStyles&&H(O,R,Object.keys(c.to)),q(a,c))}}function e(){var b=a.data(qa);if(b){for(var c=1;c=aa&&d>=ba&&(U=!0,m())}if(!S){if(!R.parentNode)return void m();var g,j=[],k=function(a){if(U)T&&a&&(T=!1,m());else if(T=!a,Ga.animationDuration){var b=x(R,T);T?da.push(b):h(da,b)}},l=Ea>0&&(Ga.transitionDuration&&0===ya.transitionDuration||Ga.animationDuration&&0===ya.animationDuration)&&Math.max(ya.animationDelay,ya.transitionDelay);l?i(b,Math.floor(l*Ea*ra),!1):b(),W.resume=function(){k(!0)},W.pause=function(){k(!1)}}}var O={},R=t(a);if(!R||!R.parentNode||!r.enabled())return C();c=n(c);var S,T,U,V,W,X,aa,ba,ca,da=[],fa=a.attr("class"),ha=f(c);if(0===c.duration||!k.animations&&!k.transitions)return C();var ia=c.event&&Q(c.event)?c.event.join(" "):c.event,ka=ia&&c.structural,la="",ma="";ka?la=g(ia,$,!0):ia&&(la=ia),c.addClass&&(ma+=g(c.addClass,Y)),c.removeClass&&(ma.length&&(ma+=" "),ma+=g(c.removeClass,Z)),c.applyClassesEarly&&ma.length&&G(a,c);var na=[la,ma].join(" ").trim(),oa=fa+" "+na,pa=g(na,_),ua=ha.to&&Object.keys(ha.to).length>0,wa=(c.keyframeStyle||"").length>0;if(!wa&&!ua&&!na)return C();var xa,ya;if(c.stagger>0){var za=parseFloat(c.stagger);ya={transitionDelay:za,animationDelay:za,transitionDuration:0,animationDuration:0}}else xa=s(R,oa),ya=v(R,na,xa,va);c.$$skipPreparationClasses||d.addClass(a,na);var Aa;if(c.transitionStyle){var Ba=[I,c.transitionStyle];y(R,Ba),da.push(Ba)}if(c.duration>=0){Aa=R.style[I].length>0;var Ca=F(c.duration,Aa);y(R,Ca),da.push(Ca)}if(c.keyframeStyle){var Da=[K,c.keyframeStyle];y(R,Da),da.push(Da)}var Ea=ya?c.staggerIndex>=0?c.staggerIndex:b.count(xa):0,Fa=0===Ea;Fa&&!c.skipBlocking&&w(R,ja);var Ga=D(R,oa,xa),Ha=Ga.maxDelay;X=Math.max(Ha,0),ba=Ga.maxDuration;var Ia={};if(Ia.hasTransitions=Ga.transitionDuration>0,Ia.hasAnimations=Ga.animationDuration>0,Ia.hasTransitionAll=Ia.hasTransitions&&"all"==Ga.transitionProperty,Ia.applyTransitionDuration=ua&&(Ia.hasTransitions&&!Ia.hasTransitionAll||Ia.hasAnimations&&!Ia.hasTransitions),Ia.applyAnimationDuration=c.duration&&Ia.hasAnimations,Ia.applyTransitionDelay=E(c.delay)&&(Ia.applyTransitionDuration||Ia.hasTransitions),Ia.applyAnimationDelay=E(c.delay)&&Ia.hasAnimations,Ia.recalculateTimingStyles=ma.length>0,(Ia.applyTransitionDuration||Ia.applyAnimationDuration)&&(ba=c.duration?parseFloat(c.duration):ba,Ia.applyTransitionDuration&&(Ia.hasTransitions=!0,Ga.transitionDuration=ba,Aa=R.style[I+ea].length>0,da.push(F(ba,Aa))),Ia.applyAnimationDuration&&(Ia.hasAnimations=!0,Ga.animationDuration=ba,da.push(A(ba)))),0===ba&&!Ia.recalculateTimingStyles)return C();if(null!=c.delay){var Ja=parseFloat(c.delay);Ia.applyTransitionDelay&&da.push(B(Ja)),Ia.applyAnimationDelay&&da.push(B(Ja,!0))}return null==c.duration&&Ga.transitionDuration>0&&(Ia.recalculateTimingStyles=Ia.recalculateTimingStyles||Fa),aa=X*ra,ca=ba*ra,c.skipBlocking||(Ia.blockTransition=Ga.transitionDuration>0,Ia.blockKeyframeAnimation=Ga.animationDuration>0&&ya.animationDelay>0&&0===ya.animationDuration),c.from&&(c.cleanupStyles&&H(O,R,Object.keys(c.from)),p(a,c)),Ia.blockTransition||Ia.blockKeyframeAnimation?u(ba):c.skipBlocking||w(R,!1),{$$willAnimate:!0,end:j,start:function(){return S?void 0:(W={end:j,cancel:l,resume:null,pause:null},V=new e(W),z(N),V)}}}}]}],xa=["$$animationProvider",function(a){function b(a){return a.parentNode&&11===a.parentNode.nodeType}a.drivers.push("$$animateCssDriver");var c="ng-animate-shim",d="ng-anchor",e="ng-anchor-out",f="ng-anchor-in";this.$get=["$animateCss","$rootScope","$$AnimateRunner","$rootElement","$sniffer","$$jqLite","$document",function(a,g,h,i,j,k,l){function n(a){return a.replace(/\bng-\S+\b/g,"")}function o(a,b){return R(a)&&(a=a.split(" ")),R(b)&&(b=b.split(" ")),a.filter(function(a){return-1===b.indexOf(a)}).join(" ")}function p(b,g,i){function j(a){var b={},c=t(a).getBoundingClientRect();return P(["width","height","top","left"],function(a){var d=c[a];switch(a){case"top":d+=s.scrollTop;break;case"left":d+=s.scrollLeft}b[a]=Math.floor(d)+"px"}),b}function k(){var b=a(q,{addClass:e,delay:!0,from:j(g)});return b.$$willAnimate?b:null}function l(a){return a.attr("class")||""}function m(){var b=n(l(i)),c=o(b,r),d=o(r,b),g=a(q,{to:j(i),addClass:f+" "+c,removeClass:e+" "+d,delay:!0});return g.$$willAnimate?g:null}function p(){q.remove(),g.removeClass(c),i.removeClass(c)}var q=O(t(g).cloneNode(!0)),r=n(l(q));g.addClass(c),i.addClass(c),q.addClass(d),v.append(q);var u,w=k();if(!w&&(u=m(),!u))return p();var x=w||u;return{start:function(){function a(){c&&c.end()}var b,c=x.start();return c.done(function(){return c=null,!u&&(u=m())?(c=u.start(),c.done(function(){c=null,p(),b.complete()}),c):(p(),void b.complete())}),b=new h({end:a,cancel:a})}}}function q(a,b,c,d){var e=r(a,M),f=r(b,M),g=[];return P(d,function(a){var b=a.out,d=a["in"],e=p(c,b,d);e&&g.push(e)}),e||f||0!==g.length?{start:function(){function a(){P(b,function(a){a.end()})}var b=[];e&&b.push(e.start()),f&&b.push(f.start()),P(g,function(a){b.push(a.start())});var c=new h({end:a,cancel:a});return h.all(b,function(a){c.complete(a)}),c}}:void 0}function r(b){var c=b.element,d=b.options||{};b.structural&&(d.event=b.event,d.structural=!0,d.applyClassesEarly=!0,"leave"===b.event&&(d.onDone=d.domOperation)),d.preparationClasses&&(d.event=z(d.event,d.preparationClasses));var e=a(c,d);return e.$$willAnimate?e:null}if(!j.animations&&!j.transitions)return M;var s=l[0].body,u=t(i),v=O(b(u)||s.contains(u)?u:s);m(k);return function(a){return a.from&&a.to?q(a.from,a.to,a.classes,a.anchors):r(a)}}]}],ya=["$animateProvider",function(a){this.$get=["$injector","$$AnimateRunner","$$jqLite",function(b,c,d){function e(c){c=Q(c)?c:c.split(" ");for(var d=[],e={},f=0;f0,d=(a.removeClass||"").length>0;return b?c&&d:c||d}var e=1,f=2,g=this.rules={skip:[],cancel:[],join:[]};g.join.push(function(a,b,d){return!b.structural&&c(b.options)}),g.skip.push(function(a,b,d){return!b.structural&&!c(b.options)}),g.skip.push(function(a,b,c){return"leave"==c.event&&b.structural}),g.skip.push(function(a,b,c){return c.structural&&c.state===f&&!b.structural}),g.cancel.push(function(a,b,c){return c.structural&&b.structural}),g.cancel.push(function(a,b,c){return c.state===f&&b.structural}),g.cancel.push(function(a,b,c){var d=b.options,e=c.options;return d.addClass&&d.addClass===e.removeClass||d.removeClass&&d.removeClass===e.addClass}),this.$get=["$$rAF","$rootScope","$rootElement","$document","$$HashMap","$$animation","$$AnimateRunner","$templateRequest","$$jqLite","$$forceReflow",function(g,h,k,l,p,q,s,w,x,y){function z(){var a=!1;return function(b){a?b():h.$$postDigest(function(){a=!0,b()})}}function A(a,b){return r(a,b,{})}function B(a,b,c){var d=t(b),e=t(a),f=[],g=M[c];return g&&P(g,function(a){a.node.contains(d)?f.push(a.callback):"leave"===c&&a.node.contains(e)&&f.push(a.callback)}),f}function C(a,d,j){function k(b,c,d,e){x(function(){var b=B(p,a,c);b.length&&g(function(){P(b,function(b){b(a,d,e)})})}),b.progress(c,d,e)}function l(b){v(a,j),Z(a,j),o(a,j),j.domOperation(),w.complete(!b)}var m,p;a=i(a),a&&(m=t(a),p=a.parent()),j=n(j);var w=new s,x=z();if(Q(j.addClass)&&(j.addClass=j.addClass.join(" ")),j.addClass&&!R(j.addClass)&&(j.addClass=null),Q(j.removeClass)&&(j.removeClass=j.removeClass.join(" ")),j.removeClass&&!R(j.removeClass)&&(j.removeClass=null),j.from&&!S(j.from)&&(j.from=null),j.to&&!S(j.to)&&(j.to=null),!m)return l(),w;var y=[m.className,j.addClass,j.removeClass].join(" ");if(!Y(y))return l(),w;var C=["enter","move","leave"].indexOf(d)>=0,F=!K||J.get(m),L=!F&&I.get(m)||{},M=!!L.state;if(F||M&&L.state==e||(F=!G(a,p,d)),F)return l(),w;C&&D(a);var N={structural:C,element:a,event:d,close:l,options:j,runner:w};if(M){var O=b("skip",a,N,L);if(O)return L.state===f?(l(),w):(r(a,L.options,j),L.runner);var T=b("cancel",a,N,L);if(T)if(L.state===f)L.runner.end();else{if(!L.structural)return r(a,L.options,N.options),L.runner;L.close()}else{var U=b("join",a,N,L);if(U){if(L.state!==f)return u(a,C?d:null,j),d=N.event=L.event,j=r(a,L.options,N.options),L.runner;A(a,j)}}}else A(a,j);var V=N.structural;if(V||(V="animate"===N.event&&Object.keys(N.options.to||{}).length>0||c(N.options)),!V)return l(),E(a),w;var W=(L.counter||0)+1;return N.counter=W,H(a,e,N),h.$$postDigest(function(){var b=I.get(m),e=!b;b=b||{};var g=a.parent()||[],h=g.length>0&&("animate"===b.event||b.structural||c(b.options));if(e||b.counter!==W||!h)return e&&(Z(a,j),o(a,j)),(e||C&&b.event!==d)&&(j.domOperation(),w.end()),void(h||E(a));d=!b.structural&&c(b.options,!0)?"setClass":b.event,H(a,f);var i=q(a,d,b.options);i.done(function(b){l(!b);var c=I.get(m);c&&c.counter===W&&E(t(a)),k(w,d,"close",{})}),w.setHost(i),k(w,d,"start",{})}),w}function D(a){var b=t(a),c=b.querySelectorAll("["+Aa+"]");P(c,function(a){var b=parseInt(a.getAttribute(Aa)),c=I.get(a);switch(b){case f:c.runner.end();case e:c&&I.remove(a)}})}function E(a){var b=t(a);b.removeAttribute(Aa),I.remove(b)}function F(a,b){return t(a)===t(b)}function G(a,b,c){var d,e=O(l[0].body),f=F(a,e)||"HTML"===a[0].nodeName,g=F(a,k),h=!1,i=a.data(Ba);for(i&&(b=i);b&&b.length;){g||(g=F(b,k));var j=b[0];if(j.nodeType!==X)break;var m=I.get(j)||{};if(h||(h=m.structural||J.get(j)),T(d)||d===!0){var n=b.data(ba);U(n)&&(d=n)}if(h&&d===!1)break;g||(g=F(b,k),g||(i=b.data(Ba),i&&(b=i))),f||(f=F(b,e)),b=b.parent()}var o=!h||d;return o&&g&&f}function H(a,b,c){c=c||{},c.state=b;var d=t(a);d.setAttribute(Aa,b);var e=I.get(d),f=e?N(e,c):c;I.put(d,f)}var I=new p,J=new p,K=null,L=h.$watch(function(){return 0===w.totalPendingRequests},function(a){a&&(L(),h.$$postDigest(function(){h.$$postDigest(function(){null===K&&(K=!0)})}))}),M={},V=a.classNameFilter(),Y=V?function(a){return V.test(a)}:function(){return!0},Z=m(x);return{on:function(a,b,c){var d=j(b);M[a]=M[a]||[],M[a].push({node:d,callback:c})},off:function(a,b,c){function d(a,b,c){var d=j(b);return a.filter(function(a){var b=a.node===d&&(!c||a.callback===c);return!b})}var e=M[a];e&&(M[a]=1===arguments.length?null:d(e,b,c))},pin:function(a,b){d(W(a),"element","not an element"),d(W(b),"parentElement","not an element"),a.data(Ba,b)},push:function(a,b,c,d){return c=c||{},c.domOperation=d,C(a,b,c)},enabled:function(a,b){var c=arguments.length;if(0===c)b=!!K;else{var d=W(a);if(d){var e=t(a),f=J.get(e);1===c?b=!f:(b=!!b,b?f&&J.remove(e):J.put(e,!0))}else b=K=!!a}return b}}}]}],Da=["$$rAF",function(a){function b(b){c.push(b),c.length>1||a(function(){for(var a=0;a=e&&(e=f,f=0,c.push(g),g=[]),g.push(h.fn),h.children.forEach(function(a){f++,d.push(a)}),e--}return g.length&&c.push(g),c}var d,e={children:[]},f=new k;for(d=0;d=0,j=a.structural?u(g):[];if(j.length){var k=i?"to":"from";P(j,function(a){var b=a.getAttribute(f);c[b]=c[b]||{},c[b][k]={animationID:d,element:O(a)}})}else b.push(a)});var d={},e={};return P(c,function(c,f){var g=c.from,h=c.to;if(!g||!h){var i=g?g.animationID:h.animationID,j=i.toString();return void(d[j]||(d[j]=!0,b.push(a[i])))}var k=a[g.animationID],l=a[h.animationID],m=g.animationID.toString();if(!e[m]){var n=e[m]={structural:!0,beforeStart:function(){k.beforeStart(),l.beforeStart()},close:function(){k.close(),l.close()},classes:w(k.classes,l.classes),from:k,to:l,anchors:[]};n.classes.length?b.push(n):(b.push(k),b.push(l))}e[m].anchors.push({out:g.element,"in":h.element})}),b}function w(a,b){a=a.split(" "),b=b.split(" ");for(var c=[],d=0;d=0;b--){var c=g[b];if(i.has(c)){var d=i.get(c),e=d(a);if(e)return e}}}function y(){k.addClass(aa),F&&a.addClass(k,F)}function z(a,b){function c(a){d(a).setHost(b)}a.from&&a.to?(c(a.from.element),c(a.to.element)):c(a.element)}function A(){var a=d(k);!a||"leave"===m&&s.$$domOperationFired||a.end()}function B(b){k.off("$destroy",A),c(k),r(k,s),o(k,s),s.domOperation(),F&&a.removeClass(k,F),k.removeClass(aa),D.complete(!b)}s=n(s);var C=["enter","move","leave"].indexOf(m)>=0,D=new j({end:function(){B()},cancel:function(){B(!0)}});if(!g.length)return B(),D;b(k,D);var E=e(k.attr("class"),e(s.addClass,s.removeClass)),F=s.tempClasses;return F&&(E+=" "+F,s.tempClasses=null),q.push({element:k,classes:E,event:m,structural:C,options:s,beforeStart:y,close:B}),k.on("$destroy",A),q.length>1?D:(h.$$postDigest(function(){var a=[];P(q,function(b){d(b.element)?a.push(b):b.close()}),q.length=0;var b=v(a),c=[];P(b,function(a){c.push({domNode:t(a.from?a.from.element:a.element),fn:function(){a.beforeStart();var b,c=a.close,e=a.anchors?a.from.element||a.to.element:a.element;if(d(e)){var f=x(a);f&&(b=f.start)}if(b){var g=b();g.done(function(a){c(!a)}),z(a,g)}else c()}})}),l(p(c))}),D)}}]}];b.module("ngAnimate",[]).directive("ngAnimateChildren",pa).factory("$$rAFScheduler",oa).factory("$$AnimateRunner",Ea).factory("$$animateAsyncRun",Da).provider("$$animateQueue",Ca).provider("$$animation",Fa).provider("$animateCss",wa).provider("$$animateCssDriver",xa).provider("$$animateJs",ya).provider("$$animateJsDriver",za)}(window,window.angular),angular.module("colorpicker.module",[]).factory("Helper",function(){"use strict";return{closestSlider:function(a){var b=a.matches||a.webkitMatchesSelector||a.mozMatchesSelector||a.msMatchesSelector;return b.bind(a)("I")?a.parentNode:a},getOffset:function(a,b){for(var c=0,d=0,e=a.getBoundingClientRect();a&&!isNaN(a.offsetLeft)&&!isNaN(a.offsetTop);)b||"BODY"!==a.tagName?(c+=a.scrollLeft,d+=a.scrollTop):(c+=document.documentElement.scrollLeft||a.scrollLeft,d+=document.documentElement.scrollTop||a.scrollTop),a=a.offsetParent;return{top:e.top+window.pageYOffset,left:e.left+window.pageXOffset,scrollX:c,scrollY:d}},stringParsers:[{re:/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d+(?:\.\d+)?)\s*)?\)/,parse:function(a){return[a[1],a[2],a[3],a[4]]}},{re:/rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d+(?:\.\d+)?)\s*)?\)/,parse:function(a){return[2.55*a[1],2.55*a[2],2.55*a[3],a[4]]}},{re:/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/,parse:function(a){return[parseInt(a[1],16),parseInt(a[2],16),parseInt(a[3],16)]}},{re:/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/,parse:function(a){return[parseInt(a[1]+a[1],16),parseInt(a[2]+a[2],16),parseInt(a[3]+a[3],16)]}}]}}).factory("Color",["Helper",function(a){"use strict";return{value:{h:1,s:1,b:1,a:1},rgb:function(){var a=this.toRGB();return"rgb("+a.r+","+a.g+","+a.b+")"},rgba:function(){var a=this.toRGB();return"rgba("+a.r+","+a.g+","+a.b+","+a.a+")"},hex:function(){return this.toHex()},RGBtoHSB:function(a,b,c,d){a/=255,b/=255,c/=255;var e,f,g,h;return g=Math.max(a,b,c),h=g-Math.min(a,b,c),e=0===h?null:g===a?(b-c)/h:g===b?(c-a)/h+2:(a-b)/h+4,e=(e+360)%6*60/360,f=0===h?0:h/g,{h:e||1,s:f,b:g,a:d||1}},setColor:function(b){b=b.toLowerCase();for(var c in a.stringParsers)if(a.stringParsers.hasOwnProperty(c)){var d=a.stringParsers[c],e=d.re.exec(b),f=e&&d.parse(e);if(f)return this.value=this.RGBtoHSB.apply(null,f),!1}},setHue:function(a){this.value.h=1-a},setSaturation:function(a){this.value.s=a},setLightness:function(a){this.value.b=1-a},setAlpha:function(a){this.value.a=parseInt(100*(1-a),10)/100},toRGB:function(a,b,c,d){a||(a=this.value.h,b=this.value.s,c=this.value.b),a*=360;var e,f,g,h,i;return a=a%360/60,i=c*b,h=i*(1-Math.abs(a%2-1)),e=f=g=c-i,a=~~a,e+=[i,h,0,0,h,i][a],f+=[h,i,i,h,0,0][a],g+=[0,0,h,i,i,h][a],{r:Math.round(255*e),g:Math.round(255*f),b:Math.round(255*g),a:d||this.value.a}},toHex:function(a,b,c,d){var e=this.toRGB(a,b,c,d);return"#"+(1<<24|parseInt(e.r,10)<<16|parseInt(e.g,10)<<8|parseInt(e.b,10)).toString(16).substr(1)}}}]).factory("Slider",["Helper",function(a){"use strict";var b={maxLeft:0,maxTop:0,callLeft:null,callTop:null,knob:{top:0,left:0}},c={};return{getSlider:function(){return b},getLeftPosition:function(a){return Math.max(0,Math.min(b.maxLeft,b.left+((a.pageX||c.left)-c.left)))},getTopPosition:function(a){return Math.max(0,Math.min(b.maxTop,b.top+((a.pageY||c.top)-c.top)))},setSlider:function(d,e){var f=a.closestSlider(d.target),g=a.getOffset(f,e),h=f.getBoundingClientRect(),i=d.clientX-h.left,j=d.clientY-h.top;b.knob=f.children[0].style,b.left=d.pageX-g.left-window.pageXOffset+g.scrollX,b.top=d.pageY-g.top-window.pageYOffset+g.scrollY,c={left:d.pageX-(i-b.left),top:d.pageY-(j-b.top)}},setSaturation:function(a,c){b={maxLeft:100,maxTop:100,callLeft:"setSaturation",callTop:"setLightness"},this.setSlider(a,c)},setHue:function(a,c){b={maxLeft:0,maxTop:100,callLeft:!1,callTop:"setHue"},this.setSlider(a,c)},setAlpha:function(a,c){b={maxLeft:0,maxTop:100,callLeft:!1,callTop:"setAlpha"},this.setSlider(a,c)},setKnob:function(a,c){b.knob.top=a+"px",b.knob.left=c+"px"}}}]).directive("colorpicker",["$document","$compile","Color","Slider","Helper",function(a,b,c,d,e){"use strict";return{require:"?ngModel",restrict:"A",link:function(f,g,h,i){var j,k=h.colorpicker?h.colorpicker:"hex",l=angular.isDefined(h.colorpickerPosition)?h.colorpickerPosition:"bottom",m=angular.isDefined(h.colorpickerInline)?h.colorpickerInline:!1,n=angular.isDefined(h.colorpickerFixedPosition)?h.colorpickerFixedPosition:!1,o=angular.isDefined(h.colorpickerParent)?g.parent():angular.element(document.body),p=angular.isDefined(h.colorpickerWithInput)?h.colorpickerWithInput:!1,q=p?'':"",r=m?"":'',s='",t=angular.element(s),u=c,v=t.find("colorpicker-hue"),w=t.find("colorpicker-saturation"),x=t.find("colorpicker-preview"),y=t.find("i"); +if(b(t)(f),p){var z=t.find("input");z.on("mousedown",function(a){a.stopPropagation()}).on("keyup",function(){var a=this.value;g.val(a),i&&i.$modelValue!==a&&(f.$apply(i.$setViewValue(a)),E(!0))})}var A=function(){a.on("mousemove",C),a.on("mouseup",D)};"rgba"===k&&(t.addClass("alpha"),j=t.find("colorpicker-alpha"),j.on("click",function(a){d.setAlpha(a,n),C(a)}).on("mousedown",function(a){d.setAlpha(a,n),A()}).on("mouseup",function(a){I("colorpicker-selected-alpha")})),v.on("click",function(a){d.setHue(a,n),C(a)}).on("mousedown",function(a){d.setHue(a,n),A()}).on("mouseup",function(a){I("colorpicker-selected-hue")}),w.on("click",function(a){d.setSaturation(a,n),C(a),angular.isDefined(h.colorpickerCloseOnSelect)&&J()}).on("mousedown",function(a){d.setSaturation(a,n),A()}).on("mouseup",function(a){I("colorpicker-selected-saturation")}),n&&t.addClass("colorpicker-fixed-position"),t.addClass("colorpicker-position-"+l),"true"===m&&t.addClass("colorpicker-inline"),o.append(t),i&&(i.$render=function(){g.val(i.$viewValue)}),g.on("blur keyup change",function(){E()}),g.on("$destroy",function(){t.remove()});var B=function(){try{x.css("backgroundColor",u[k]())}catch(a){x.css("backgroundColor",u.toHex())}w.css("backgroundColor",u.toHex(u.value.h,1,1,1)),"rgba"===k&&(j.css.backgroundColor=u.toHex())},C=function(a){var b=d.getLeftPosition(a),c=d.getTopPosition(a),e=d.getSlider();d.setKnob(c,b),e.callLeft&&u[e.callLeft].call(u,b/100),e.callTop&&u[e.callTop].call(u,c/100),B();var h=u[k]();return g.val(h),i&&f.$apply(i.$setViewValue(h)),p&&z.val(h),!1},D=function(){I("colorpicker-selected"),a.off("mousemove",C),a.off("mouseup",D)},E=function(a){u.setColor(g.val()),p&&!a&&z.val(g.val()),y.eq(0).css({left:100*u.value.s+"px",top:100-100*u.value.b+"px"}),y.eq(1).css("top",100*(1-u.value.h)+"px"),y.eq(2).css("top",100*(1-u.value.a)+"px"),B()},F=function(){var a,b=e.getOffset(g[0]);return angular.isDefined(h.colorpickerParent)&&(b.left=0,b.top=0),"top"===l?a={top:b.top-147,left:b.left}:"right"===l?a={top:b.top,left:b.left+126}:"bottom"===l?a={top:b.top+g[0].offsetHeight+2,left:b.left}:"left"===l&&(a={top:b.top,left:b.left-150}),{top:a.top+"px",left:a.left+"px"}},G=function(){J()},H=function(){t.hasClass("colorpicker-visible")||(E(),t.addClass("colorpicker-visible").css(F()),I("colorpicker-shown"),m===!1&&a.on("mousedown",G),h.colorpickerIsOpen&&(f[h.colorpickerIsOpen]=!0,f.$$phase||f.$digest()))};m===!1?g.on("click",H):H(),t.on("mousedown",function(a){a.stopPropagation(),a.preventDefault()});var I=function(a){i&&f.$emit(a,{name:h.ngModel,value:i.$modelValue})},J=function(){t.hasClass("colorpicker-visible")&&(t.removeClass("colorpicker-visible"),I("colorpicker-closed"),a.off("mousedown",G),h.colorpickerIsOpen&&(f[h.colorpickerIsOpen]=!1,f.$$phase||f.$digest()))};t.find("button").on("click",function(){J()}),h.colorpickerIsOpen&&f.$watch(h.colorpickerIsOpen,function(a){a===!0?H():a===!1&&J()})}}}]),angular.module("ui.bootstrap.contextMenu",[]).directive("contextMenu",["$parse",function(a){var b=function(a,b,c,d){if(!e)var e=angular.element;e(b.currentTarget).addClass("context");var f=e("
");f.addClass("dropdown clearfix");var g=e("'};b.Type.extend({name:"Doughnut",defaults:d,initialize:function(a){this.segments=[],this.outerRadius=(c.min([this.chart.width,this.chart.height])-this.options.segmentStrokeWidth/2)/2,this.SegmentArc=b.Arc.extend({ctx:this.chart.ctx,x:this.chart.width/2,y:this.chart.height/2}),this.options.showTooltips&&c.bindEvents(this,this.options.tooltipEvents,function(a){var b="mouseout"!==a.type?this.getSegmentsAtEvent(a):[];c.each(this.segments,function(a){a.restore(["fillColor"])}),c.each(b,function(a){a.fillColor=a.highlightColor}),this.showTooltip(b)}),this.calculateTotal(a),c.each(a,function(a,b){this.addData(a,b,!0)},this),this.render()},getSegmentsAtEvent:function(a){var b=[],d=c.getRelativePosition(a);return c.each(this.segments,function(a){a.inRange(d.x,d.y)&&b.push(a)},this),b},addData:function(a,b,c){var d=b||this.segments.length;this.segments.splice(d,0,new this.SegmentArc({value:a.value,outerRadius:this.options.animateScale?0:this.outerRadius,innerRadius:this.options.animateScale?0:this.outerRadius/100*this.options.percentageInnerCutout,fillColor:a.color,highlightColor:a.highlight||a.color,showStroke:this.options.segmentShowStroke,strokeWidth:this.options.segmentStrokeWidth,strokeColor:this.options.segmentStrokeColor,startAngle:1.5*Math.PI,circumference:this.options.animateRotate?0:this.calculateCircumference(a.value),label:a.label})),c||(this.reflow(),this.update())},calculateCircumference:function(a){return 2*Math.PI*(Math.abs(a)/this.total)},calculateTotal:function(a){this.total=0,c.each(a,function(a){this.total+=Math.abs(a.value)},this)},update:function(){this.calculateTotal(this.segments),c.each(this.activeElements,function(a){a.restore(["fillColor"])}),c.each(this.segments,function(a){a.save()}),this.render()},removeData:function(a){var b=c.isNumber(a)?a:this.segments.length-1;this.segments.splice(b,1),this.reflow(),this.update()},reflow:function(){c.extend(this.SegmentArc.prototype,{x:this.chart.width/2,y:this.chart.height/2}),this.outerRadius=(c.min([this.chart.width,this.chart.height])-this.options.segmentStrokeWidth/2)/2,c.each(this.segments,function(a){a.update({outerRadius:this.outerRadius,innerRadius:this.outerRadius/100*this.options.percentageInnerCutout})},this)},draw:function(a){var b=a?a:1;this.clear(),c.each(this.segments,function(a,c){a.transition({circumference:this.calculateCircumference(a.value),outerRadius:this.outerRadius,innerRadius:this.outerRadius/100*this.options.percentageInnerCutout},b),a.endAngle=a.startAngle+a.circumference,a.draw(),0===c&&(a.startAngle=1.5*Math.PI),c<% for (var i=0; i
  • <%if(datasets[i].label){%><%=datasets[i].label%><%}%>
  • <%}%>'};b.Type.extend({name:"Line",defaults:d,initialize:function(a){this.PointClass=b.Point.extend({strokeWidth:this.options.pointDotStrokeWidth,radius:this.options.pointDotRadius,display:this.options.pointDot,hitDetectionRadius:this.options.pointHitDetectionRadius,ctx:this.chart.ctx,inRange:function(a){return Math.pow(a-this.x,2)0&&bthis.scale.endPoint?a.controlPoints.outer.y=this.scale.endPoint:a.controlPoints.outer.ythis.scale.endPoint?a.controlPoints.inner.y=this.scale.endPoint:a.controlPoints.inner.y0&&(d.lineTo(h[h.length-1].x,this.scale.endPoint),d.lineTo(h[0].x,this.scale.endPoint),d.fillStyle=a.fillColor,d.closePath(),d.fill()),c.each(h,function(a){a.draw()})},this)}})}.call(this),function(){"use strict";var a=this,b=a.Chart,c=b.helpers,d={scaleShowLabelBackdrop:!0,scaleBackdropColor:"rgba(255,255,255,0.75)",scaleBeginAtZero:!0,scaleBackdropPaddingY:2,scaleBackdropPaddingX:2,scaleShowLine:!0,segmentShowStroke:!0,segmentStrokeColor:"#fff",segmentStrokeWidth:2,animationSteps:100,animationEasing:"easeOutBounce",animateRotate:!0,animateScale:!1,legendTemplate:'
      <% for (var i=0; i
    • <%if(segments[i].label){%><%=segments[i].label%><%}%>
    • <%}%>
    '};b.Type.extend({name:"PolarArea",defaults:d,initialize:function(a){this.segments=[],this.SegmentArc=b.Arc.extend({showStroke:this.options.segmentShowStroke, +strokeWidth:this.options.segmentStrokeWidth,strokeColor:this.options.segmentStrokeColor,ctx:this.chart.ctx,innerRadius:0,x:this.chart.width/2,y:this.chart.height/2}),this.scale=new b.RadialScale({display:this.options.showScale,fontStyle:this.options.scaleFontStyle,fontSize:this.options.scaleFontSize,fontFamily:this.options.scaleFontFamily,fontColor:this.options.scaleFontColor,showLabels:this.options.scaleShowLabels,showLabelBackdrop:this.options.scaleShowLabelBackdrop,backdropColor:this.options.scaleBackdropColor,backdropPaddingY:this.options.scaleBackdropPaddingY,backdropPaddingX:this.options.scaleBackdropPaddingX,lineWidth:this.options.scaleShowLine?this.options.scaleLineWidth:0,lineColor:this.options.scaleLineColor,lineArc:!0,width:this.chart.width,height:this.chart.height,xCenter:this.chart.width/2,yCenter:this.chart.height/2,ctx:this.chart.ctx,templateString:this.options.scaleLabel,valuesCount:a.length}),this.updateScaleRange(a),this.scale.update(),c.each(a,function(a,b){this.addData(a,b,!0)},this),this.options.showTooltips&&c.bindEvents(this,this.options.tooltipEvents,function(a){var b="mouseout"!==a.type?this.getSegmentsAtEvent(a):[];c.each(this.segments,function(a){a.restore(["fillColor"])}),c.each(b,function(a){a.fillColor=a.highlightColor}),this.showTooltip(b)}),this.render()},getSegmentsAtEvent:function(a){var b=[],d=c.getRelativePosition(a);return c.each(this.segments,function(a){a.inRange(d.x,d.y)&&b.push(a)},this),b},addData:function(a,b,c){var d=b||this.segments.length;this.segments.splice(d,0,new this.SegmentArc({fillColor:a.color,highlightColor:a.highlight||a.color,label:a.label,value:a.value,outerRadius:this.options.animateScale?0:this.scale.calculateCenterOffset(a.value),circumference:this.options.animateRotate?0:this.scale.getCircumference(),startAngle:1.5*Math.PI})),c||(this.reflow(),this.update())},removeData:function(a){var b=c.isNumber(a)?a:this.segments.length-1;this.segments.splice(b,1),this.reflow(),this.update()},calculateTotal:function(a){this.total=0,c.each(a,function(a){this.total+=a.value},this),this.scale.valuesCount=this.segments.length},updateScaleRange:function(a){var b=[];c.each(a,function(a){b.push(a.value)});var d=this.options.scaleOverride?{steps:this.options.scaleSteps,stepValue:this.options.scaleStepWidth,min:this.options.scaleStartValue,max:this.options.scaleStartValue+this.options.scaleSteps*this.options.scaleStepWidth}:c.calculateScaleRange(b,c.min([this.chart.width,this.chart.height])/2,this.options.scaleFontSize,this.options.scaleBeginAtZero,this.options.scaleIntegersOnly);c.extend(this.scale,d,{size:c.min([this.chart.width,this.chart.height]),xCenter:this.chart.width/2,yCenter:this.chart.height/2})},update:function(){this.calculateTotal(this.segments),c.each(this.segments,function(a){a.save()}),this.reflow(),this.render()},reflow:function(){c.extend(this.SegmentArc.prototype,{x:this.chart.width/2,y:this.chart.height/2}),this.updateScaleRange(this.segments),this.scale.update(),c.extend(this.scale,{xCenter:this.chart.width/2,yCenter:this.chart.height/2}),c.each(this.segments,function(a){a.update({outerRadius:this.scale.calculateCenterOffset(a.value)})},this)},draw:function(a){var b=a||1;this.clear(),c.each(this.segments,function(a,c){a.transition({circumference:this.scale.getCircumference(),outerRadius:this.scale.calculateCenterOffset(a.value)},b),a.endAngle=a.startAngle+a.circumference,0===c&&(a.startAngle=1.5*Math.PI),c<% for (var i=0; i
  • <%if(datasets[i].label){%><%=datasets[i].label%><%}%>
  • <%}%>'},initialize:function(a){this.PointClass=b.Point.extend({strokeWidth:this.options.pointDotStrokeWidth,radius:this.options.pointDotRadius,display:this.options.pointDot,hitDetectionRadius:this.options.pointHitDetectionRadius,ctx:this.chart.ctx}),this.datasets=[],this.buildScale(a),this.options.showTooltips&&c.bindEvents(this,this.options.tooltipEvents,function(a){var b="mouseout"!==a.type?this.getPointsAtEvent(a):[];this.eachPoints(function(a){a.restore(["fillColor","strokeColor"])}),c.each(b,function(a){a.fillColor=a.highlightFill,a.strokeColor=a.highlightStroke}),this.showTooltip(b)}),c.each(a.datasets,function(b){var d={label:b.label||null,fillColor:b.fillColor,strokeColor:b.strokeColor,pointColor:b.pointColor,pointStrokeColor:b.pointStrokeColor,points:[]};this.datasets.push(d),c.each(b.data,function(c,e){var f;this.scale.animation||(f=this.scale.getPointPosition(e,this.scale.calculateCenterOffset(c))),d.points.push(new this.PointClass({value:c,label:a.labels[e],datasetLabel:b.label,x:this.options.animation?this.scale.xCenter:f.x,y:this.options.animation?this.scale.yCenter:f.y,strokeColor:b.pointStrokeColor,fillColor:b.pointColor,highlightFill:b.pointHighlightFill||b.pointColor,highlightStroke:b.pointHighlightStroke||b.pointStrokeColor}))},this)},this),this.render()},eachPoints:function(a){c.each(this.datasets,function(b){c.each(b.points,a,this)},this)},getPointsAtEvent:function(a){var b=c.getRelativePosition(a),d=c.getAngleFromPoint({x:this.scale.xCenter,y:this.scale.yCenter},b),e=2*Math.PI/this.scale.valuesCount,f=Math.round((d.angle-1.5*Math.PI)/e),g=[];return(f>=this.scale.valuesCount||0>f)&&(f=0),d.distance<=this.scale.drawingArea&&c.each(this.datasets,function(a){g.push(a.points[f])}),g},buildScale:function(a){this.scale=new b.RadialScale({display:this.options.showScale,fontStyle:this.options.scaleFontStyle,fontSize:this.options.scaleFontSize,fontFamily:this.options.scaleFontFamily,fontColor:this.options.scaleFontColor,showLabels:this.options.scaleShowLabels,showLabelBackdrop:this.options.scaleShowLabelBackdrop,backdropColor:this.options.scaleBackdropColor,backdropPaddingY:this.options.scaleBackdropPaddingY,backdropPaddingX:this.options.scaleBackdropPaddingX,lineWidth:this.options.scaleShowLine?this.options.scaleLineWidth:0,lineColor:this.options.scaleLineColor,angleLineColor:this.options.angleLineColor,angleLineWidth:this.options.angleShowLineOut?this.options.angleLineWidth:0,pointLabelFontColor:this.options.pointLabelFontColor,pointLabelFontSize:this.options.pointLabelFontSize,pointLabelFontFamily:this.options.pointLabelFontFamily,pointLabelFontStyle:this.options.pointLabelFontStyle,height:this.chart.height,width:this.chart.width,xCenter:this.chart.width/2,yCenter:this.chart.height/2,ctx:this.chart.ctx,templateString:this.options.scaleLabel,labels:a.labels,valuesCount:a.datasets[0].data.length}),this.scale.setScaleSize(),this.updateScaleRange(a.datasets),this.scale.buildYLabels()},updateScaleRange:function(a){var b=function(){var b=[];return c.each(a,function(a){a.data?b=b.concat(a.data):c.each(a.points,function(a){b.push(a.value)})}),b}(),d=this.options.scaleOverride?{steps:this.options.scaleSteps,stepValue:this.options.scaleStepWidth,min:this.options.scaleStartValue,max:this.options.scaleStartValue+this.options.scaleSteps*this.options.scaleStepWidth}:c.calculateScaleRange(b,c.min([this.chart.width,this.chart.height])/2,this.options.scaleFontSize,this.options.scaleBeginAtZero,this.options.scaleIntegersOnly);c.extend(this.scale,d)},addData:function(a,b){this.scale.valuesCount++,c.each(a,function(a,c){var d=this.scale.getPointPosition(this.scale.valuesCount,this.scale.calculateCenterOffset(a));this.datasets[c].points.push(new this.PointClass({value:a,label:b,x:d.x,y:d.y,strokeColor:this.datasets[c].pointStrokeColor,fillColor:this.datasets[c].pointColor}))},this),this.scale.labels.push(b),this.reflow(),this.update()},removeData:function(){this.scale.valuesCount--,this.scale.labels.shift(),c.each(this.datasets,function(a){a.points.shift()},this),this.reflow(),this.update()},update:function(){this.eachPoints(function(a){a.save()}),this.reflow(),this.render()},reflow:function(){c.extend(this.scale,{width:this.chart.width,height:this.chart.height,size:c.min([this.chart.width,this.chart.height]),xCenter:this.chart.width/2,yCenter:this.chart.height/2}),this.updateScaleRange(this.datasets),this.scale.setScaleSize(),this.scale.buildYLabels()},draw:function(a){var b=a||1,d=this.chart.ctx;this.clear(),this.scale.draw(),c.each(this.datasets,function(a){c.each(a.points,function(a,c){a.hasValue()&&a.transition(this.scale.getPointPosition(c,this.scale.calculateCenterOffset(a.value)),b)},this),d.lineWidth=this.options.datasetStrokeWidth,d.strokeStyle=a.strokeColor,d.beginPath(),c.each(a.points,function(a,b){0===b?d.moveTo(a.x,a.y):d.lineTo(a.x,a.y)},this),d.closePath(),d.stroke(),d.fillStyle=a.fillColor,d.fill(),c.each(a.points,function(a){a.hasValue()&&a.draw()})},this)}})}.call(this),function(a){"use strict";"object"==typeof exports?module.exports=a(angular,require("chart.js")):"function"==typeof define&&define.amd?define(["angular","chart"],a):a(angular,Chart)}(function(a,b){"use strict";function c(){var c={},d={Chart:b,getOptions:function(b){var d=b&&c[b]||{};return a.extend({},c,d)}};this.setOptions=function(b,d){return d?void(c[b]=a.extend(c[b]||{},d)):(d=b,void(c=a.extend(c,d)))},this.$get=function(){return d}}function d(c,d){function f(a,b){return a&&b&&a.length&&b.length?Array.isArray(a[0])?a.length===b.length&&a.every(function(a,c){return a.length===b[c].length}):b.reduce(g,0)>0?a.length===b.length:!1:!1}function g(a,b){return a+b}function h(b,c,d,e){var f=null;return function(g){var h=c.getPointsAtEvent||c.getBarsAtEvent||c.getSegmentsAtEvent;if(h){var i=h.call(c,g);(e===!1||a.equals(f,i)===!1)&&(f=i,b[d](i,g),b.$apply())}}}function i(d,e){for(var f=a.copy(e.colours||c.getOptions(d).colours||b.defaults.global.colours);f.length>16&255,d=b>>8&255,e=255&b;return[c,d,e]}function p(b,c,d,e){return{labels:b,datasets:c.map(function(b,c){return a.extend({},e[c],{label:d[c],data:b})})}}function q(b,c,d){return b.map(function(b,e){return a.extend({},d[e],{label:b,value:c[e],color:d[e].strokeColor,highlight:d[e].pointHighlightStroke})})}function r(a,b){var c=a.parent(),d=c.find("chart-legend"),e=""+b.generateLegend()+"";d.length?d.replaceWith(e):c.append(e)}function s(a,b,c,d){Array.isArray(c.data[0])?a.datasets.forEach(function(a,c){(a.points||a.bars).forEach(function(a,d){a.value=b[c][d]})}):a.segments.forEach(function(a,c){a.value=b[c]}),a.update(),c.$emit("update",a),c.legend&&"false"!==c.legend&&r(d,a)}function t(a){return!a||Array.isArray(a)&&!a.length||"object"==typeof a&&!Object.keys(a).length}function u(d,e){var f=a.extend({},b.defaults.global,c.getOptions(d),e.options);return f.responsive}return function(b){return{restrict:"CA",scope:{data:"=?",labels:"=?",options:"=?",series:"=?",colours:"=?",getColour:"=?",chartType:"=",legend:"@",click:"=?",hover:"=?",chartData:"=?",chartLabels:"=?",chartOptions:"=?",chartSeries:"=?",chartColours:"=?",chartLegend:"@",chartClick:"=?",chartHover:"=?"},link:function(g,j){function l(a,b){g.$watch(a,function(a){"undefined"!=typeof a&&(g[b]=a)})}function m(c,d){if(!t(c)&&!a.equals(c,d)){var e=b||g.chartType;e&&(v&&v.destroy(),n(e))}}function n(b){if(u(b,g)&&0===j[0].clientHeight&&0===w.clientHeight)return d(function(){n(b)},50,!1);if(g.data&&g.data.length){g.getColour="function"==typeof g.getColour?g.getColour:k,g.colours=i(b,g);var e=j[0],f=e.getContext("2d"),l=Array.isArray(g.data[0])?p(g.labels,g.data,g.series||[],g.colours):q(g.labels,g.data,g.colours),m=a.extend({},c.getOptions(b),g.options);v=new c.Chart(f)[b](l,m),g.$emit("create",v),e.onclick=g.click?h(g,v,"click",!1):a.noop,e.onmousemove=g.hover?h(g,v,"hover",!0):a.noop,g.legend&&"false"!==g.legend&&r(j,v)}}function o(a){if("undefined"!=typeof console&&"test"!==c.getOptions().env){var b="function"==typeof console.warn?console.warn:console.log;g[a]&&b.call(console,'"%s" is deprecated and will be removed in a future version. Please use "chart-%s" instead.',a,a)}}var v,w=document.createElement("div");w.className="chart-container",j.replaceWith(w),w.appendChild(j[0]),e&&window.G_vmlCanvasManager.initElement(j[0]),["data","labels","options","series","colours","legend","click","hover"].forEach(o),l("chartData","data"),l("chartLabels","labels"),l("chartOptions","options"),l("chartSeries","series"),l("chartColours","colours"),l("chartLegend","legend"),l("chartClick","click"),l("chartHover","hover"),g.$watch("data",function(a,c){if(a&&a.length&&(!Array.isArray(a[0])||a[0].length)){var d=b||g.chartType;if(d){if(v){if(f(a,c))return s(v,a,g,j);v.destroy()}n(d)}}},!0),g.$watch("series",m,!0),g.$watch("labels",m,!0),g.$watch("options",m,!0),g.$watch("colours",m,!0),g.$watch("chartType",function(b,c){t(b)||a.equals(b,c)||(v&&v.destroy(),n(b))}),g.$on("$destroy",function(){v&&v.destroy()})}}}}b.defaults.global.responsive=!0,b.defaults.global.multiTooltipTemplate="<%if (datasetLabel){%><%=datasetLabel%>: <%}%><%= value %>",b.defaults.global.colours=["#97BBCD","#DCDCDC","#F7464A","#46BFBD","#FDB45C","#949FB1","#4D5360"];var e="object"==typeof window.G_vmlCanvasManager&&null!==window.G_vmlCanvasManager&&"function"==typeof window.G_vmlCanvasManager.initElement;return e&&(b.defaults.global.animation=!1),a.module("chart.js",[]).provider("ChartJs",c).factory("ChartJsFactory",["ChartJs","$timeout",d]).directive("chartBase",["ChartJsFactory",function(a){return new a}]).directive("chartLine",["ChartJsFactory",function(a){return new a("Line")}]).directive("chartBar",["ChartJsFactory",function(a){return new a("Bar")}]).directive("chartRadar",["ChartJsFactory",function(a){return new a("Radar")}]).directive("chartDoughnut",["ChartJsFactory",function(a){return new a("Doughnut")}]).directive("chartPie",["ChartJsFactory",function(a){return new a("Pie")}]).directive("chartPolarArea",["ChartJsFactory",function(a){return new a("PolarArea")}])}),function(a,b,c){"use strict";function d(a,c,d){function e(a,d,e){var g,h;e=e||{},h=e.expires,g=b.isDefined(e.path)?e.path:f,b.isUndefined(d)&&(h="Thu, 01 Jan 1970 00:00:00 GMT",d=""),b.isString(h)&&(h=new Date(h));var i=encodeURIComponent(a)+"="+encodeURIComponent(d);i+=g?";path="+g:"",i+=e.domain?";domain="+e.domain:"",i+=h?";expires="+h.toUTCString():"",i+=e.secure?";secure":"";var j=i.length+1;return j>4096&&c.warn("Cookie '"+a+"' possibly not set or overflowed because it was too large ("+j+" > 4096 bytes)!"),i}var f=d.baseHref(),g=a[0];return function(a,b,c){g.cookie=e(a,b,c)}}b.module("ngCookies",["ng"]).provider("$cookies",[function(){function a(a){return a?b.extend({},d,a):d}var d=this.defaults={};this.$get=["$$cookieReader","$$cookieWriter",function(d,e){return{get:function(a){return d()[a]},getObject:function(a){var c=this.get(a);return c?b.fromJson(c):c},getAll:function(){return d()},put:function(b,c,d){e(b,c,a(d))},putObject:function(a,c,d){this.put(a,b.toJson(c),d)},remove:function(b,d){e(b,c,a(d))}}}]}]),b.module("ngCookies").factory("$cookieStore",["$cookies",function(a){return{get:function(b){return a.getObject(b)},put:function(b,c){a.putObject(b,c)},remove:function(b){a.remove(b)}}}]),d.$inject=["$document","$log","$browser"],b.module("ngCookies").provider("$$cookieWriter",function(){this.$get=d})}(window,window.angular),!function(a,b){"object"==typeof exports&&"object"==typeof module?module.exports=b():"function"==typeof define&&define.amd?define(b):"object"==typeof exports?exports["angular-file-upload"]=b():a["angular-file-upload"]=b()}(this,function(){return function(a){function b(d){if(c[d])return c[d].exports;var e=c[d]={exports:{},id:d,loaded:!1};return a[d].call(e.exports,e,e.exports,b),e.loaded=!0,e.exports}var c={};return b.m=a,b.c=c,b.p="",b(0)}([function(a,b,c){"use strict";var d=function(a){return a&&a.__esModule?a["default"]:a},e=d(c(2)),f=d(c(3)),g=d(c(4)),h=d(c(5)),i=d(c(6)),j=d(c(7)),k=d(c(1)),l=d(c(8)),m=d(c(9)),n=d(c(10)),o=d(c(11)),p=d(c(12));angular.module(e.name,[]).value("fileUploaderOptions",f).factory("FileUploader",g).factory("FileLikeObject",h).factory("FileItem",i).factory("FileDirective",j).factory("FileSelect",k).factory("FileDrop",l).factory("FileOver",m).directive("nvFileSelect",n).directive("nvFileDrop",o).directive("nvFileOver",p).run(["FileUploader","FileLikeObject","FileItem","FileDirective","FileSelect","FileDrop","FileOver",function(a,b,c,d,e,f,g){a.FileLikeObject=b,a.FileItem=c,a.FileDirective=d,a.FileSelect=e,a.FileDrop=f,a.FileOver=g}])},function(a,b,c){"use strict";var d=function(a){return a&&a.__esModule?a["default"]:a},e=function(){function a(a,b){for(var c in b){var d=b[c];d.configurable=!0,d.value&&(d.writable=!0)}Object.defineProperties(a,b)}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}(),f=function j(a,b,c){var d=Object.getOwnPropertyDescriptor(a,b);if(void 0===d){var e=Object.getPrototypeOf(a);return null===e?void 0:j(e,b,c)}if("value"in d&&d.writable)return d.value;var f=d.get;return void 0===f?void 0:f.call(c)},g=function(a,b){if("function"!=typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),b&&(a.__proto__=b)},h=function(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")},i=(d(c(2)),angular.extend);a.exports=function(a){var b=function(a){function b(a){h(this,b);var c=i(a,{events:{$destroy:"destroy",change:"onChange"},prop:"select"});f(Object.getPrototypeOf(b.prototype),"constructor",this).call(this,c),this.uploader.isHTML5||this.element.removeAttr("multiple"),this.element.prop("value",null)}return g(b,a),e(b,{getOptions:{value:function(){}},getFilters:{value:function(){}},isEmptyAfterSelection:{value:function(){return!!this.element.attr("multiple")}},onChange:{value:function(){var a=this.uploader.isHTML5?this.element[0].files:this.element[0],b=this.getOptions(),c=this.getFilters();this.uploader.isHTML5||this.destroy(),this.uploader.addToQueue(a,b,c),this.isEmptyAfterSelection()&&(this.element.prop("value",null),this.element.replaceWith(this.element=this.element.clone(!0)))}}}),b}(a);return b},a.exports.$inject=["FileDirective"]},function(a,b){a.exports={name:"angularFileUpload"}},function(a,b){"use strict";a.exports={url:"/",alias:"file",headers:{},queue:[],progress:0,autoUpload:!1,removeAfterUpload:!1,method:"POST",filters:[],formData:[],queueLimit:Number.MAX_VALUE,withCredentials:!1}},function(a,b,c){"use strict";var d=function(a){return a&&a.__esModule?a["default"]:a},e=function(){function a(a,b){for(var c in b){var d=b[c];d.configurable=!0,d.value&&(d.writable=!0)}Object.defineProperties(a,b)}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}(),f=function(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")},g=(d(c(2)),angular.copy),h=angular.extend,i=angular.forEach,j=angular.isObject,k=angular.isNumber,l=angular.isDefined,m=angular.isArray,n=angular.element;a.exports=function(a,b,c,d,o,p){var q=d.File,r=d.FormData,s=function(){function d(b){f(this,d);var c=g(a);h(this,c,b,{isUploading:!1,_nextIndex:0,_failFilterIndex:-1,_directives:{select:[],drop:[],over:[]}}),this.filters.unshift({name:"queueLimit",fn:this._queueLimitFilter}),this.filters.unshift({name:"folder",fn:this._folderFilter})}return e(d,{addToQueue:{value:function(a,b,c){var d=this,e=this.isArrayLikeObject(a)?a:[a],f=this._getFilters(c),g=this.queue.length,h=[];i(e,function(a){var c=new o(a);if(d._isValidFile(c,f,b)){var e=new p(d,a,b);h.push(e),d.queue.push(e),d._onAfterAddingFile(e)}else{var g=f[d._failFilterIndex];d._onWhenAddingFileFailed(c,g,b)}}),this.queue.length!==g&&(this._onAfterAddingAll(h),this.progress=this._getTotalProgress()),this._render(),this.autoUpload&&this.uploadAll()}},removeFromQueue:{value:function(a){var b=this.getIndexOfItem(a),c=this.queue[b];c.isUploading&&c.cancel(),this.queue.splice(b,1),c._destroy(),this.progress=this._getTotalProgress()}},clearQueue:{value:function(){for(;this.queue.length;)this.queue[0].remove();this.progress=0}},uploadItem:{value:function(a){var b=this.getIndexOfItem(a),c=this.queue[b],d=this.isHTML5?"_xhrTransport":"_iframeTransport";c._prepareToUploading(),this.isUploading||(this.isUploading=!0,this[d](c))}},cancelItem:{value:function(a){var b=this.getIndexOfItem(a),c=this.queue[b],d=this.isHTML5?"_xhr":"_form";c&&c.isUploading&&c[d].abort()}},uploadAll:{value:function(){var a=this.getNotUploadedItems().filter(function(a){return!a.isUploading});a.length&&(i(a,function(a){return a._prepareToUploading()}),a[0].upload())}},cancelAll:{value:function(){var a=this.getNotUploadedItems();i(a,function(a){return a.cancel()})}},isFile:{value:function(a){return this.constructor.isFile(a)}},isFileLikeObject:{value:function(a){return this.constructor.isFileLikeObject(a)}},isArrayLikeObject:{value:function(a){return this.constructor.isArrayLikeObject(a)}},getIndexOfItem:{value:function(a){return k(a)?a:this.queue.indexOf(a)}},getNotUploadedItems:{value:function(){return this.queue.filter(function(a){return!a.isUploaded})}},getReadyItems:{value:function(){return this.queue.filter(function(a){return a.isReady&&!a.isUploading}).sort(function(a,b){return a.index-b.index})}},destroy:{value:function(){var a=this;i(this._directives,function(b){i(a._directives[b],function(a){a.destroy()})})}},onAfterAddingAll:{value:function(a){}},onAfterAddingFile:{value:function(a){}},onWhenAddingFileFailed:{value:function(a,b,c){}},onBeforeUploadItem:{value:function(a){}},onProgressItem:{value:function(a,b){}},onProgressAll:{value:function(a){}},onSuccessItem:{value:function(a,b,c,d){}},onErrorItem:{value:function(a,b,c,d){}},onCancelItem:{value:function(a,b,c,d){}},onCompleteItem:{value:function(a,b,c,d){}},onCompleteAll:{value:function(){}},_getTotalProgress:{value:function(a){if(this.removeAfterUpload)return a||0;var b=this.getNotUploadedItems().length,c=b?this.queue.length-b:this.queue.length,d=100/this.queue.length,e=(a||0)*d/100;return Math.round(c*d+e)}},_getFilters:{value:function(a){if(!a)return this.filters;if(m(a))return a;var b=a.match(/[^\s,]+/g);return this.filters.filter(function(a){return-1!==b.indexOf(a.name)})}},_render:{value:function(){b.$$phase||b.$apply()}},_folderFilter:{value:function(a){return!(!a.size&&!a.type)}},_queueLimitFilter:{value:function(){return this.queue.length=200&&300>a||304===a}},_transformResponse:{value:function(a,b){var d=this._headersGetter(b);return i(c.defaults.transformResponse,function(b){a=b(a,d)}),a}},_parseHeaders:{value:function(a){var b,c,d,e={};return a?(i(a.split("\n"),function(a){d=a.indexOf(":"),b=a.slice(0,d).trim().toLowerCase(),c=a.slice(d+1).trim(),b&&(e[b]=e[b]?e[b]+", "+c:c)}),e):e}},_headersGetter:{value:function(a){return function(b){return b?a[b.toLowerCase()]||null:a}}},_xhrTransport:{value:function(a){var b=this,c=a._xhr=new XMLHttpRequest,d=new r;if(this._onBeforeUploadItem(a),i(a.formData,function(a){i(a,function(a,b){d.append(b,a)})}),"number"!=typeof a._file.size)throw new TypeError("The file specified is no longer valid");d.append(a.alias,a._file,a.file.name),c.upload.onprogress=function(c){var d=Math.round(c.lengthComputable?100*c.loaded/c.total:0);b._onProgressItem(a,d)},c.onload=function(){var d=b._parseHeaders(c.getAllResponseHeaders()),e=b._transformResponse(c.response,d),f=b._isSuccessCode(c.status)?"Success":"Error",g="_on"+f+"Item";b[g](a,e,c.status,d),b._onCompleteItem(a,e,c.status,d)},c.onerror=function(){var d=b._parseHeaders(c.getAllResponseHeaders()),e=b._transformResponse(c.response,d);b._onErrorItem(a,e,c.status,d),b._onCompleteItem(a,e,c.status,d)},c.onabort=function(){var d=b._parseHeaders(c.getAllResponseHeaders()),e=b._transformResponse(c.response,d);b._onCancelItem(a,e,c.status,d),b._onCompleteItem(a,e,c.status,d)},c.open(a.method,a.url,!0),c.withCredentials=a.withCredentials,i(a.headers,function(a,b){c.setRequestHeader(b,a)}),c.send(d),this._render()}},_iframeTransport:{value:function(a){var b=this,c=n('
    '),d=n('':''),v=a(d.theme?'':''),d.theme&&q?(x='"):d.theme?(x='"):x=q?'':'',w=a(x),r&&(d.theme?(w.css(p),w.addClass("ui-widget-content")):w.css(f)),d.theme||v.css(d.overlayCSS),v.css("position",q?"fixed":"absolute"),(k||d.forceIframe)&&u.css("opacity",0);var z=[u,v,w],A=a(q?"body":b);a.each(z,function(){this.appendTo(A)}),d.theme&&d.draggable&&a.fn.draggable&&w.draggable({handle:".ui-dialog-titlebar",cancel:"li"});var B=m&&(!a.support.boxModel||a("object,embed",q?null:b).length>0);if(l||B){if(q&&d.allowBodyStretch&&a.support.boxModel&&a("html,body").css("height","100%"),(l||!a.support.boxModel)&&!q)var C=i(b,"borderTopWidth"),D=i(b,"borderLeftWidth"),E=C?"(0 - "+C+")":0,F=D?"(0 - "+D+")":0;a.each(z,function(a,b){var c=b[0].style;if(c.position="absolute",2>a)q?c.setExpression("height","Math.max(document.body.scrollHeight, document.body.offsetHeight) - (jQuery.support.boxModel?0:"+d.quirksmodeOffsetHack+') + "px"'):c.setExpression("height",'this.parentNode.offsetHeight + "px"'),q?c.setExpression("width",'jQuery.support.boxModel && document.documentElement.clientWidth || document.body.clientWidth + "px"'):c.setExpression("width",'this.parentNode.offsetWidth + "px"'),F&&c.setExpression("left",F),E&&c.setExpression("top",E);else if(d.centerY)q&&c.setExpression("top",'(document.documentElement.clientHeight || document.body.clientHeight) / 2 - (this.offsetHeight / 2) + (blah = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "px"'),c.marginTop=0;else if(!d.centerY&&q){var e=d.css&&d.css.top?parseInt(d.css.top,10):0,f="((document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "+e+') + "px"';c.setExpression("top",f)}})}if(r&&(d.theme?w.find(".ui-widget-content").append(r):w.append(r),(r.jquery||r.nodeType)&&a(r).show()),(k||d.forceIframe)&&d.showOverlay&&u.show(),d.fadeIn){var G=d.onBlock?d.onBlock:j,H=d.showOverlay&&!r?G:j,I=r?G:j;d.showOverlay&&v._fadeIn(d.fadeIn,H),r&&w._fadeIn(d.fadeIn,I)}else d.showOverlay&&v.show(),r&&w.show(),d.onBlock&&d.onBlock.bind(w)();if(e(1,b,d),q?(n=w[0],o=a(d.focusableElements,n),d.focusInput&&setTimeout(g,20)):h(w[0],d.centerX,d.centerY),d.timeout){var J=setTimeout(function(){q?a.unblockUI(d):a(b).unblock(d)},d.timeout);a(b).data("blockUI.timeout",J)}}}function c(b,c){var f,g=b==window,h=a(b),i=h.data("blockUI.history"),j=h.data("blockUI.timeout");j&&(clearTimeout(j),h.removeData("blockUI.timeout")),c=a.extend({},a.blockUI.defaults,c||{}),e(0,b,c),null===c.onUnblock&&(c.onUnblock=h.data("blockUI.onUnblock"),h.removeData("blockUI.onUnblock"));var k;k=g?a("body").children().filter(".blockUI").add("body > .blockUI"):h.find(">.blockUI"), +c.cursorReset&&(k.length>1&&(k[1].style.cursor=c.cursorReset),k.length>2&&(k[2].style.cursor=c.cursorReset)),g&&(n=o=null),c.fadeOut?(f=k.length,k.stop().fadeOut(c.fadeOut,function(){0===--f&&d(k,i,c,b)})):d(k,i,c,b)}function d(b,c,d,e){var f=a(e);if(!f.data("blockUI.isBlocked")){b.each(function(a,b){this.parentNode&&this.parentNode.removeChild(this)}),c&&c.el&&(c.el.style.display=c.display,c.el.style.position=c.position,c.el.style.cursor="default",c.parent&&c.parent.appendChild(c.el),f.removeData("blockUI.history")),f.data("blockUI.static")&&f.css("position","static"),"function"==typeof d.onUnblock&&d.onUnblock(e,d);var g=a(document.body),h=g.width(),i=g[0].style.width;g.width(h-1).width(h),g[0].style.width=i}}function e(b,c,d){var e=c==window,g=a(c);if((b||(!e||n)&&(e||g.data("blockUI.isBlocked")))&&(g.data("blockUI.isBlocked",b),e&&d.bindEvents&&(!b||d.showOverlay))){var h="mousedown mouseup keydown keypress keyup touchstart touchend touchmove";b?a(document).bind(h,d,f):a(document).unbind(h,f)}}function f(b){if("keydown"===b.type&&b.keyCode&&9==b.keyCode&&n&&b.data.constrainTabKey){var c=o,d=!b.shiftKey&&b.target===c[c.length-1],e=b.shiftKey&&b.target===c[0];if(d||e)return setTimeout(function(){g(e)},10),!1}var f=b.data,h=a(b.target);return h.hasClass("blockOverlay")&&f.onOverlayClick&&f.onOverlayClick(b),h.parents("div."+f.blockMsgClass).length>0?!0:0===h.parents().children().filter("div.blockUI").length}function g(a){if(o){var b=o[a===!0?o.length-1:0];b&&b.focus()}}function h(a,b,c){var d=a.parentNode,e=a.style,f=(d.offsetWidth-a.offsetWidth)/2-i(d,"borderLeftWidth"),g=(d.offsetHeight-a.offsetHeight)/2-i(d,"borderTopWidth");b&&(e.left=f>0?f+"px":"0"),c&&(e.top=g>0?g+"px":"0")}function i(b,c){return parseInt(a.css(b,c),10)||0}a.fn._fadeIn=a.fn.fadeIn;var j=a.noop||function(){},k=/MSIE/.test(navigator.userAgent),l=/MSIE 6.0/.test(navigator.userAgent)&&!/MSIE 8.0/.test(navigator.userAgent),m=(document.documentMode||0,a.isFunction(document.createElement("div").style.setExpression));a.blockUI=function(a){b(window,a)},a.unblockUI=function(a){c(window,a)},a.growlUI=function(b,c,d,e){var f=a('
    ');b&&f.append("

    "+b+"

    "),c&&f.append("

    "+c+"

    "),void 0===d&&(d=3e3);var g=function(b){b=b||{},a.blockUI({message:f,fadeIn:"undefined"!=typeof b.fadeIn?b.fadeIn:700,fadeOut:"undefined"!=typeof b.fadeOut?b.fadeOut:1e3,timeout:"undefined"!=typeof b.timeout?b.timeout:d,centerY:!1,showOverlay:!1,onUnblock:e,css:a.blockUI.defaults.growlCSS})};g();f.css("opacity");f.mouseover(function(){g({fadeIn:0,timeout:3e4});var b=a(".blockMsg");b.stop(),b.fadeTo(300,1)}).mouseout(function(){a(".blockMsg").fadeOut(1e3)})},a.fn.block=function(c){if(this[0]===window)return a.blockUI(c),this;var d=a.extend({},a.blockUI.defaults,c||{});return this.each(function(){var b=a(this);d.ignoreIfBlocked&&b.data("blockUI.isBlocked")||b.unblock({fadeOut:0})}),this.each(function(){"static"==a.css(this,"position")&&(this.style.position="relative",a(this).data("blockUI.static",!0)),this.style.zoom=1,b(this,c)})},a.fn.unblock=function(b){return this[0]===window?(a.unblockUI(b),this):this.each(function(){c(this,b)})},a.blockUI.version=2.7,a.blockUI.defaults={message:"

    Please wait...

    ",title:null,draggable:!0,theme:!1,css:{padding:0,margin:0,width:"30%",top:"40%",left:"35%",textAlign:"center",color:"#000",border:"3px solid #aaa",backgroundColor:"#fff",cursor:"wait"},themedCSS:{width:"30%",top:"40%",left:"35%"},overlayCSS:{backgroundColor:"#000",opacity:.6,cursor:"wait"},cursorReset:"default",growlCSS:{width:"350px",top:"10px",left:"",right:"10px",border:"none",padding:"5px",opacity:.6,cursor:"default",color:"#fff",backgroundColor:"#000","-webkit-border-radius":"10px","-moz-border-radius":"10px","border-radius":"10px"},iframeSrc:/^https/i.test(window.location.href||"")?"javascript:false":"about:blank",forceIframe:!1,baseZ:1e3,centerX:!0,centerY:!0,allowBodyStretch:!0,bindEvents:!0,constrainTabKey:!0,fadeIn:200,fadeOut:400,timeout:0,showOverlay:!0,focusInput:!0,focusableElements:":input:enabled:visible",onBlock:null,onUnblock:null,onOverlayClick:null,quirksmodeOffsetHack:4,blockMsgClass:"blockMsg",ignoreIfBlocked:!1};var n=null,o=[]}"function"==typeof define&&define.amd&&define.amd.jQuery?define(["jquery"],a):a(jQuery)}(),function(a,b,c){var d=a();a.fn.dropdownHover=function(c){return"ontouchstart"in document?this:(d=d.add(this.parent()),this.each(function(){function e(a){b.clearTimeout(f),b.clearTimeout(g),g=b.setTimeout(function(){d.find(":focus").blur(),n.instantlyCloseOthers===!0&&d.removeClass("open"),b.clearTimeout(g),h.attr("aria-expanded","true"),i.addClass("open"),h.trigger(l)},n.hoverDelay)}var f,g,h=a(this),i=h.parent(),j={delay:500,hoverDelay:0,instantlyCloseOthers:!0},k={delay:a(this).data("delay"),hoverDelay:a(this).data("hover-delay"),instantlyCloseOthers:a(this).data("close-others")},l="show.bs.dropdown",m="hide.bs.dropdown",n=a.extend(!0,{},j,c,k);i.hover(function(a){return i.hasClass("open")||h.is(a.target)?void e(a):!0},function(){b.clearTimeout(g),f=b.setTimeout(function(){h.attr("aria-expanded","false"),i.removeClass("open"),h.trigger(m)},n.delay)}),h.hover(function(a){return i.hasClass("open")||i.is(a.target)?void e(a):!0}),i.find(".dropdown-submenu").each(function(){var c,d=a(this);d.hover(function(){b.clearTimeout(c),d.children(".dropdown-menu").show(),d.siblings().children(".dropdown-menu").hide()},function(){var a=d.children(".dropdown-menu");c=b.setTimeout(function(){a.hide()},n.delay)})})}))},a(document).ready(function(){a('[data-hover="dropdown"]').dropdownHover()})}(jQuery,window),function(a,b){"function"==typeof define&&define.amd?define(["jquery"],function(a){return b(a)}):"object"==typeof exports?module.exports=b(require("jquery")):b(jQuery)}(this,function(a){!function(a){"use strict";function b(b){var c=[{re:/[\xC0-\xC6]/g,ch:"A"},{re:/[\xE0-\xE6]/g,ch:"a"},{re:/[\xC8-\xCB]/g,ch:"E"},{re:/[\xE8-\xEB]/g,ch:"e"},{re:/[\xCC-\xCF]/g,ch:"I"},{re:/[\xEC-\xEF]/g,ch:"i"},{re:/[\xD2-\xD6]/g,ch:"O"},{re:/[\xF2-\xF6]/g,ch:"o"},{re:/[\xD9-\xDC]/g,ch:"U"},{re:/[\xF9-\xFC]/g,ch:"u"},{re:/[\xC7-\xE7]/g,ch:"c"},{re:/[\xD1]/g,ch:"N"},{re:/[\xF1]/g,ch:"n"}];return a.each(c,function(){b=b.replace(this.re,this.ch)}),b}function c(a){var b={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},c="(?:"+Object.keys(b).join("|")+")",d=new RegExp(c),e=new RegExp(c,"g"),f=null==a?"":""+a;return d.test(f)?f.replace(e,function(a){return b[a]}):f}function d(b,c){var d=arguments,f=b,g=c;[].shift.apply(d);var h,i=this.each(function(){var b=a(this);if(b.is("select")){var c=b.data("selectpicker"),i="object"==typeof f&&f;if(c){if(i)for(var j in i)i.hasOwnProperty(j)&&(c.options[j]=i[j])}else{var k=a.extend({},e.DEFAULTS,a.fn.selectpicker.defaults||{},b.data(),i);k.template=a.extend({},e.DEFAULTS.template,a.fn.selectpicker.defaults?a.fn.selectpicker.defaults.template:{},b.data().template,i.template),b.data("selectpicker",c=new e(this,k,g))}"string"==typeof f&&(h=c[f]instanceof Function?c[f].apply(c,d):c.options[f])}});return"undefined"!=typeof h?h:i}String.prototype.includes||!function(){var a={}.toString,b=function(){try{var a={},b=Object.defineProperty,c=b(a,a,a)&&b}catch(d){}return c}(),c="".indexOf,d=function(b){if(null==this)throw new TypeError;var d=String(this);if(b&&"[object RegExp]"==a.call(b))throw new TypeError;var e=d.length,f=String(b),g=f.length,h=arguments.length>1?arguments[1]:void 0,i=h?Number(h):0;i!=i&&(i=0);var j=Math.min(Math.max(i,0),e);return g+j>e?!1:-1!=c.call(d,f,i)};b?b(String.prototype,"includes",{value:d,configurable:!0,writable:!0}):String.prototype.includes=d}(),String.prototype.startsWith||!function(){var a=function(){try{var a={},b=Object.defineProperty,c=b(a,a,a)&&b}catch(d){}return c}(),b={}.toString,c=function(a){if(null==this)throw new TypeError;var c=String(this);if(a&&"[object RegExp]"==b.call(a))throw new TypeError;var d=c.length,e=String(a),f=e.length,g=arguments.length>1?arguments[1]:void 0,h=g?Number(g):0;h!=h&&(h=0);var i=Math.min(Math.max(h,0),d);if(f+i>d)return!1;for(var j=-1;++j'},maxOptions:!1,mobile:!1,selectOnTab:!1,dropdownAlignRight:!1},e.prototype={constructor:e,init:function(){var b=this,c=this.$element.attr("id");this.$element.addClass("bs-select-hidden"),this.liObj={},this.multiple=this.$element.prop("multiple"),this.autofocus=this.$element.prop("autofocus"),this.$newElement=this.createView(),this.$element.after(this.$newElement),this.$button=this.$newElement.children("button"),this.$menu=this.$newElement.children(".dropdown-menu"),this.$menuInner=this.$menu.children(".inner"),this.$searchbox=this.$menu.find("input"),this.options.dropdownAlignRight&&this.$menu.addClass("dropdown-menu-right"),"undefined"!=typeof c&&(this.$button.attr("data-id",c),a('label[for="'+c+'"]').click(function(a){a.preventDefault(),b.$button.focus()})),this.checkDisabled(),this.clickListener(),this.options.liveSearch&&this.liveSearchListener(),this.render(),this.setStyle(),this.setWidth(),this.options.container&&this.selectPosition(),this.$menu.data("this",this),this.$newElement.data("this",this),this.options.mobile&&this.mobile(),this.$newElement.on({"hide.bs.dropdown":function(a){b.$element.trigger("hide.bs.select",a)},"hidden.bs.dropdown":function(a){b.$element.trigger("hidden.bs.select",a)},"show.bs.dropdown":function(a){b.$element.trigger("show.bs.select",a)},"shown.bs.dropdown":function(a){b.$element.trigger("shown.bs.select",a)}}),setTimeout(function(){b.$element.trigger("loaded.bs.select")})},createDropdown:function(){var b=this.multiple?" show-tick":"",d=this.$element.parent().hasClass("input-group")?" input-group-btn":"",e=this.autofocus?" autofocus":"",f=this.options.header?'
    '+this.options.header+"
    ":"",g=this.options.liveSearch?'":"",h=this.multiple&&this.options.actionsBox?'
    ":"",i=this.multiple&&this.options.doneButton?'
    ":"",j='
    ";return a(j)},createView:function(){var a=this.createDropdown(),b=this.createLi();return a.find("ul")[0].innerHTML=b,a},reloadLi:function(){this.destroyLi();var a=this.createLi();this.$menuInner[0].innerHTML=a},destroyLi:function(){this.$menu.find("li").remove()},createLi:function(){var d=this,e=[],f=0,g=document.createElement("option"),h=-1,i=function(a,b,c,d){return""+a+""},j=function(a,e,f,g){return'
    "+a+''};if(this.options.title&&!this.multiple&&(h--,!this.$element.find(".bs-title-option").length)){var k=this.$element[0];g.className="bs-title-option",g.appendChild(document.createTextNode(this.options.title)),g.value="",k.insertBefore(g,k.firstChild),void 0===a(k.options[k.selectedIndex]).attr("selected")&&(g.selected=!0)}return this.$element.find("option").each(function(b){var c=a(this);if(h++,!c.hasClass("bs-title-option")){var g=this.className||"",k=this.style.cssText,l=c.data("content")?c.data("content"):c.html(),m=c.data("tokens")?c.data("tokens"):null,n="undefined"!=typeof c.data("subtext")?''+c.data("subtext")+"":"",o="undefined"!=typeof c.data("icon")?' ':"",p=this.disabled||"OPTGROUP"===this.parentNode.tagName&&this.parentNode.disabled;if(""!==o&&p&&(o=""+o+""),d.options.hideDisabled&&p)return void h--;if(c.data("content")||(l=o+''+l+n+""),"OPTGROUP"===this.parentNode.tagName&&c.data("divider")!==!0){var q=" "+this.parentNode.className||"";if(0===c.index()){f+=1;var r=this.parentNode.label,s="undefined"!=typeof c.parent().data("subtext")?''+c.parent().data("subtext")+"":"",t=c.parent().data("icon")?' ':"";r=t+''+r+s+"",0!==b&&e.length>0&&(h++,e.push(i("",null,"divider",f+"div"))),h++,e.push(i(r,null,"dropdown-header"+q,f))}e.push(i(j(l,"opt "+g+q,k,m),b,"",f))}else c.data("divider")===!0?e.push(i("",b,"divider")):c.data("hidden")===!0?e.push(i(j(l,g,k,m),b,"hidden is-hidden")):(this.previousElementSibling&&"OPTGROUP"===this.previousElementSibling.tagName&&(h++,e.push(i("",null,"divider",f+"div"))),e.push(i(j(l,g,k,m),b)));d.liObj[b]=h}}),this.multiple||0!==this.$element.find("option:selected").length||this.options.title||this.$element.find("option").eq(0).prop("selected",!0).attr("selected","selected"),e.join("")},findLis:function(){return null==this.$lis&&(this.$lis=this.$menu.find("li")),this.$lis},render:function(b){var c,d=this;b!==!1&&this.$element.find("option").each(function(a){var b=d.findLis().eq(d.liObj[a]);d.setDisabled(a,this.disabled||"OPTGROUP"===this.parentNode.tagName&&this.parentNode.disabled,b),d.setSelected(a,this.selected,b)}),this.tabIndex();var e=this.$element.find("option").map(function(){if(this.selected){if(d.options.hideDisabled&&(this.disabled||"OPTGROUP"===this.parentNode.tagName&&this.parentNode.disabled))return;var b,c=a(this),e=c.data("icon")&&d.options.showIcon?' ':"";return b=d.options.showSubtext&&c.data("subtext")&&!d.multiple?' '+c.data("subtext")+"":"","undefined"!=typeof c.attr("title")?c.attr("title"):c.data("content")&&d.options.showContent?c.data("content"):e+c.html()+b}}).toArray(),f=this.multiple?e.join(this.options.multipleSeparator):e[0];if(this.multiple&&this.options.selectedTextFormat.indexOf("count")>-1){var g=this.options.selectedTextFormat.split(">");if(g.length>1&&e.length>g[1]||1==g.length&&e.length>=2){c=this.options.hideDisabled?", [disabled]":"";var h=this.$element.find("option").not('[data-divider="true"], [data-hidden="true"]'+c).length,i="function"==typeof this.options.countSelectedText?this.options.countSelectedText(e.length,h):this.options.countSelectedText;f=i.replace("{0}",e.length.toString()).replace("{1}",h.toString())}}void 0==this.options.title&&(this.options.title=this.$element.attr("title")),"static"==this.options.selectedTextFormat&&(f=this.options.title),f||(f="undefined"!=typeof this.options.title?this.options.title:this.options.noneSelectedText),this.$button.attr("title",a.trim(f.replace(/<[^>]*>?/g,""))),this.$button.children(".filter-option").html(f),this.$element.trigger("rendered.bs.select")},setStyle:function(a,b){this.$element.attr("class")&&this.$newElement.addClass(this.$element.attr("class").replace(/selectpicker|mobile-device|bs-select-hidden|validate\[.*\]/gi,""));var c=a?a:this.options.style;"add"==b?this.$button.addClass(c):"remove"==b?this.$button.removeClass(c):(this.$button.removeClass(this.options.style),this.$button.addClass(c))},liHeight:function(b){if(b||this.options.size!==!1&&!this.sizeInfo){var c=document.createElement("div"),d=document.createElement("div"),e=document.createElement("ul"),f=document.createElement("li"),g=document.createElement("li"),h=document.createElement("a"),i=document.createElement("span"),j=this.options.header?this.$menu.find(".popover-title")[0].cloneNode(!0):null,k=this.options.liveSearch?document.createElement("div"):null,l=this.options.actionsBox&&this.multiple?this.$menu.find(".bs-actionsbox")[0].cloneNode(!0):null,m=this.options.doneButton&&this.multiple?this.$menu.find(".bs-donebutton")[0].cloneNode(!0):null;if(i.className="text",c.className=this.$menu[0].parentNode.className+" open",d.className="dropdown-menu open",e.className="dropdown-menu inner",f.className="divider",i.appendChild(document.createTextNode("Inner text")),h.appendChild(i),g.appendChild(h),e.appendChild(g),e.appendChild(f),j&&d.appendChild(j),k){var n=document.createElement("span");k.className="bs-searchbox",n.className="form-control",k.appendChild(n),d.appendChild(k)}l&&d.appendChild(l),d.appendChild(e),m&&d.appendChild(m),c.appendChild(d),document.body.appendChild(c);var o=h.offsetHeight,p=j?j.offsetHeight:0,q=k?k.offsetHeight:0,r=l?l.offsetHeight:0,s=m?m.offsetHeight:0,t=a(f).outerHeight(!0),u="function"==typeof getComputedStyle?getComputedStyle(d):!1,v=u?null:a(d),w=parseInt(u?u.paddingTop:v.css("paddingTop"))+parseInt(u?u.paddingBottom:v.css("paddingBottom"))+parseInt(u?u.borderTopWidth:v.css("borderTopWidth"))+parseInt(u?u.borderBottomWidth:v.css("borderBottomWidth")),x=w+parseInt(u?u.marginTop:v.css("marginTop"))+parseInt(u?u.marginBottom:v.css("marginBottom"))+2;document.body.removeChild(c),this.sizeInfo={liHeight:o,headerHeight:p,searchHeight:q,actionsHeight:r,doneButtonHeight:s,dividerHeight:t,menuPadding:w,menuExtras:x}}},setSize:function(){if(this.findLis(),this.liHeight(),this.options.header&&this.$menu.css("padding-top",0),this.options.size!==!1){var b,c,d,e,f=this,g=this.$menu,h=this.$menuInner,i=a(window),j=this.$newElement[0].offsetHeight,k=this.sizeInfo.liHeight,l=this.sizeInfo.headerHeight,m=this.sizeInfo.searchHeight,n=this.sizeInfo.actionsHeight,o=this.sizeInfo.doneButtonHeight,p=this.sizeInfo.dividerHeight,q=this.sizeInfo.menuPadding,r=this.sizeInfo.menuExtras,s=this.options.hideDisabled?".disabled":"",t=function(){d=f.$newElement.offset().top-i.scrollTop(),e=i.height()-d-j};if(t(),"auto"===this.options.size){var u=function(){var i,j=function(b,c){return function(d){return c?d.classList?d.classList.contains(b):a(d).hasClass(b):!(d.classList?d.classList.contains(b):a(d).hasClass(b))}},p=f.$menuInner[0].getElementsByTagName("li"),s=Array.prototype.filter?Array.prototype.filter.call(p,j("hidden",!1)):f.$lis.not(".hidden"),u=Array.prototype.filter?Array.prototype.filter.call(s,j("dropdown-header",!0)):s.filter(".dropdown-header");t(),b=e-r,f.options.container?(g.data("height")||g.data("height",g.height()),c=g.data("height")):c=g.height(),f.options.dropupAuto&&f.$newElement.toggleClass("dropup",d>e&&c>b-r),f.$newElement.hasClass("dropup")&&(b=d-r),i=s.length+u.length>3?3*k+r-2:0,g.css({"max-height":b+"px",overflow:"hidden","min-height":i+l+m+n+o+"px"}),h.css({"max-height":b-l-m-n-o-q+"px","overflow-y":"auto","min-height":Math.max(i-q,0)+"px"})};u(),this.$searchbox.off("input.getSize propertychange.getSize").on("input.getSize propertychange.getSize",u),i.off("resize.getSize scroll.getSize").on("resize.getSize scroll.getSize",u)}else if(this.options.size&&"auto"!=this.options.size&&this.$lis.not(s).length>this.options.size){var v=this.$lis.not(".divider").not(s).children().slice(0,this.options.size).last().parent().index(),w=this.$lis.slice(0,v+1).filter(".divider").length;b=k*this.options.size+w*p+q,f.options.container?(g.data("height")||g.data("height",g.height()),c=g.data("height")):c=g.height(),f.options.dropupAuto&&this.$newElement.toggleClass("dropup",d>e&&c>b-r),g.css({"max-height":b+l+m+n+o+"px",overflow:"hidden","min-height":""}),h.css({"max-height":b-q+"px","overflow-y":"auto","min-height":""})}}},setWidth:function(){if("auto"===this.options.width){this.$menu.css("min-width","0");var a=this.$menu.parent().clone().appendTo("body"),b=this.options.container?this.$newElement.clone().appendTo("body"):a,c=a.children(".dropdown-menu").outerWidth(),d=b.css("width","auto").children("button").outerWidth();a.remove(),b.remove(),this.$newElement.css("width",Math.max(c,d)+"px")}else"fit"===this.options.width?(this.$menu.css("min-width",""),this.$newElement.css("width","").addClass("fit-width")):this.options.width?(this.$menu.css("min-width",""),this.$newElement.css("width",this.options.width)):(this.$menu.css("min-width",""),this.$newElement.css("width",""));this.$newElement.hasClass("fit-width")&&"fit"!==this.options.width&&this.$newElement.removeClass("fit-width")},selectPosition:function(){var b,c,d=this,e=a('
    '),f=function(a){e.addClass(a.attr("class").replace(/form-control|fit-width/gi,"")).toggleClass("dropup",a.hasClass("dropup")),b=a.offset(),c=a.hasClass("dropup")?0:a[0].offsetHeight,e.css({top:b.top+c,left:b.left,width:a[0].offsetWidth})};this.$newElement.on("click",function(){d.isDisabled()||(f(a(this)),e.appendTo(d.options.container),e.toggleClass("open",!a(this).hasClass("open")),e.append(d.$menu))}),a(window).on("resize scroll",function(){f(d.$newElement)}),this.$element.on("hide.bs.select",function(){d.$menu.data("height",d.$menu.height()),e.detach()})},setSelected:function(a,b,c){c||(c=this.findLis().eq(this.liObj[a])),c.toggleClass("selected",b)},setDisabled:function(a,b,c){c||(c=this.findLis().eq(this.liObj[a])),b?c.addClass("disabled").children("a").attr("href","#").attr("tabindex",-1):c.removeClass("disabled").children("a").removeAttr("href").attr("tabindex",0)},isDisabled:function(){return this.$element[0].disabled},checkDisabled:function(){var a=this;this.isDisabled()?(this.$newElement.addClass("disabled"),this.$button.addClass("disabled").attr("tabindex",-1)):(this.$button.hasClass("disabled")&&(this.$newElement.removeClass("disabled"),this.$button.removeClass("disabled")),-1!=this.$button.attr("tabindex")||this.$element.data("tabindex")||this.$button.removeAttr("tabindex")),this.$button.click(function(){return!a.isDisabled()})},tabIndex:function(){this.$element.is("[tabindex]")&&(this.$element.data("tabindex",this.$element.attr("tabindex")),this.$button.attr("tabindex",this.$element.data("tabindex")))},clickListener:function(){var b=this,c=a(document);this.$newElement.on("touchstart.dropdown",".dropdown-menu",function(a){a.stopPropagation()}),c.data("spaceSelect",!1),this.$button.on("keyup",function(a){/(32)/.test(a.keyCode.toString(10))&&c.data("spaceSelect")&&(a.preventDefault(),c.data("spaceSelect",!1))}),this.$newElement.on("click",function(){b.setSize(),b.$element.on("shown.bs.select",function(){if(b.options.liveSearch||b.multiple){if(!b.multiple){var a=b.liObj[b.$element[0].selectedIndex];if("number"!=typeof a||b.options.size===!1)return;var c=b.$lis.eq(a)[0].offsetTop-b.$menuInner[0].offsetTop;c=c-b.$menuInner[0].offsetHeight/2+b.sizeInfo.liHeight/2,b.$menuInner[0].scrollTop=c}}else b.$menuInner.find(".selected a").focus()})}),this.$menuInner.on("click","li a",function(c){var d=a(this),e=d.parent().data("originalIndex"),f=b.$element.val(),g=b.$element.prop("selectedIndex");if(b.multiple&&c.stopPropagation(),c.preventDefault(),!b.isDisabled()&&!d.parent().hasClass("disabled")){var h=b.$element.find("option"),i=h.eq(e),j=i.prop("selected"),k=i.parent("optgroup"),l=b.options.maxOptions,m=k.data("maxOptions")||!1;if(b.multiple){if(i.prop("selected",!j),b.setSelected(e,!j),d.blur(),l!==!1||m!==!1){var n=l
    ');q[2]&&(r=r.replace("{var}",q[2][l>1?0:1]),s=s.replace("{var}",q[2][m>1?0:1])),i.prop("selected",!1),b.$menu.append(t),l&&n&&(t.append(a("
    "+r+"
    ")),b.$element.trigger("maxReached.bs.select")),m&&o&&(t.append(a("
    "+s+"
    ")),b.$element.trigger("maxReachedGrp.bs.select")),setTimeout(function(){b.setSelected(e,!1)},10),t.delay(750).fadeOut(300,function(){a(this).remove()})}}}else h.prop("selected",!1),i.prop("selected",!0),b.$menuInner.find(".selected").removeClass("selected"),b.setSelected(e,!0);b.multiple?b.options.liveSearch&&b.$searchbox.focus():b.$button.focus(),(f!=b.$element.val()&&b.multiple||g!=b.$element.prop("selectedIndex")&&!b.multiple)&&(b.$element.triggerNative("change"),b.$element.trigger("changed.bs.select",[e,i.prop("selected"),j]))}}),this.$menu.on("click","li.disabled a, .popover-title, .popover-title :not(.close)",function(c){c.currentTarget==this&&(c.preventDefault(),c.stopPropagation(),b.options.liveSearch&&!a(c.target).hasClass("close")?b.$searchbox.focus():b.$button.focus())}),this.$menuInner.on("click",".divider, .dropdown-header",function(a){a.preventDefault(),a.stopPropagation(),b.options.liveSearch?b.$searchbox.focus():b.$button.focus()}),this.$menu.on("click",".popover-title .close",function(){b.$button.click()}),this.$searchbox.on("click",function(a){a.stopPropagation()}),this.$menu.on("click",".actions-btn",function(c){b.options.liveSearch?b.$searchbox.focus():b.$button.focus(),c.preventDefault(),c.stopPropagation(),a(this).hasClass("bs-select-all")?b.selectAll():b.deselectAll(),b.$element.triggerNative("change")}),this.$element.change(function(){b.render(!1)})},liveSearchListener:function(){var d=this,e=a('
  • ');this.$newElement.on("click.dropdown.data-api touchstart.dropdown.data-api",function(){d.$menuInner.find(".active").removeClass("active"),d.$searchbox.val()&&(d.$searchbox.val(""),d.$lis.not(".is-hidden").removeClass("hidden"),e.parent().length&&e.remove()),d.multiple||d.$menuInner.find(".selected").addClass("active"),setTimeout(function(){d.$searchbox.focus()},10)}),this.$searchbox.on("click.dropdown.data-api focus.dropdown.data-api touchend.dropdown.data-api",function(a){a.stopPropagation()}),this.$searchbox.on("input propertychange",function(){if(d.$searchbox.val()){var f=d.$lis.not(".is-hidden").removeClass("hidden").children("a");f=d.options.liveSearchNormalize?f.not(":a"+d._searchStyle()+'("'+b(d.$searchbox.val())+'")'):f.not(":"+d._searchStyle()+'("'+d.$searchbox.val()+'")'),f.parent().addClass("hidden"),d.$lis.filter(".dropdown-header").each(function(){var b=a(this),c=b.data("optgroup");0===d.$lis.filter("[data-optgroup="+c+"]").not(b).not(".hidden").length&&(b.addClass("hidden"),d.$lis.filter("[data-optgroup="+c+"div]").addClass("hidden"))});var g=d.$lis.not(".hidden");g.each(function(b){var c=a(this);c.hasClass("divider")&&(c.index()===g.first().index()||c.index()===g.last().index()||g.eq(b+1).hasClass("divider"))&&c.addClass("hidden")}),d.$lis.not(".hidden, .no-results").length?e.parent().length&&e.remove():(e.parent().length&&e.remove(),e.html(d.options.noneResultsText.replace("{0}",'"'+c(d.$searchbox.val())+'"')).show(),d.$menuInner.append(e))}else d.$lis.not(".is-hidden").removeClass("hidden"),e.parent().length&&e.remove();d.$lis.filter(".active").removeClass("active"),d.$searchbox.val()&&d.$lis.not(".hidden, .divider, .dropdown-header").eq(0).addClass("active").children("a").focus(),a(this).focus()})},_searchStyle:function(){var a={begins:"ibegins",startsWith:"ibegins"};return a[this.options.liveSearchStyle]||"icontains"},val:function(a){return"undefined"!=typeof a?(this.$element.val(a),this.render(),this.$element):this.$element.val()},changeAll:function(b){"undefined"==typeof b&&(b=!0),this.findLis();for(var c=this.$element.find("option"),d=this.$lis.not(".divider, .dropdown-header, .disabled, .hidden").toggleClass("selected",b),e=d.length,f=[],g=0;e>g;g++){var h=d[g].getAttribute("data-original-index");f[f.length]=c.eq(h)[0]}a(f).prop("selected",b),this.render(!1)},selectAll:function(){return this.changeAll(!0)},deselectAll:function(){return this.changeAll(!1)},keydown:function(c){var d,e,f,g,h,i,j,k,l,m=a(this),n=m.is("input")?m.parent().parent():m.parent(),o=n.data("this"),p=":not(.disabled, .hidden, .dropdown-header, .divider)",q={32:" ",48:"0",49:"1",50:"2",51:"3",52:"4",53:"5",54:"6",55:"7",56:"8",57:"9",59:";",65:"a",66:"b",67:"c",68:"d",69:"e",70:"f",71:"g",72:"h",73:"i",74:"j",75:"k",76:"l",77:"m",78:"n",79:"o",80:"p",81:"q",82:"r",83:"s",84:"t",85:"u",86:"v",87:"w",88:"x",89:"y",90:"z",96:"0",97:"1",98:"2",99:"3",100:"4",101:"5",102:"6",103:"7",104:"8",105:"9"};if(o.options.liveSearch&&(n=m.parent().parent()),o.options.container&&(n=o.$menu),d=a("[role=menu] li",n),l=o.$menu.parent().hasClass("open"),!l&&(c.keyCode>=48&&c.keyCode<=57||c.keyCode>=96&&c.keyCode<=105||c.keyCode>=65&&c.keyCode<=90)&&(o.options.container?o.$newElement.trigger("click"):(o.setSize(), +o.$menu.parent().addClass("open"),l=!0),o.$searchbox.focus()),o.options.liveSearch&&(/(^9$|27)/.test(c.keyCode.toString(10))&&l&&0===o.$menu.find(".active").length&&(c.preventDefault(),o.$menu.parent().removeClass("open"),o.options.container&&o.$newElement.removeClass("open"),o.$button.focus()),d=a("[role=menu] li"+p,n),m.val()||/(38|40)/.test(c.keyCode.toString(10))||0===d.filter(".active").length&&(d=o.$menuInner.find("li"),d=o.options.liveSearchNormalize?d.filter(":a"+o._searchStyle()+"("+b(q[c.keyCode])+")"):d.filter(":"+o._searchStyle()+"("+q[c.keyCode]+")"))),d.length){if(/(38|40)/.test(c.keyCode.toString(10)))e=d.index(d.find("a").filter(":focus").parent()),g=d.filter(p).first().index(),h=d.filter(p).last().index(),f=d.eq(e).nextAll(p).eq(0).index(),i=d.eq(e).prevAll(p).eq(0).index(),j=d.eq(f).prevAll(p).eq(0).index(),o.options.liveSearch&&(d.each(function(b){a(this).hasClass("disabled")||a(this).data("index",b)}),e=d.index(d.filter(".active")),g=d.first().data("index"),h=d.last().data("index"),f=d.eq(e).nextAll().eq(0).data("index"),i=d.eq(e).prevAll().eq(0).data("index"),j=d.eq(f).prevAll().eq(0).data("index")),k=m.data("prevIndex"),38==c.keyCode?(o.options.liveSearch&&e--,e!=j&&e>i&&(e=i),g>e&&(e=g),e==k&&(e=h)):40==c.keyCode&&(o.options.liveSearch&&e++,-1==e&&(e=0),e!=j&&f>e&&(e=f),e>h&&(e=h),e==k&&(e=g)),m.data("prevIndex",e),o.options.liveSearch?(c.preventDefault(),m.hasClass("dropdown-toggle")||(d.removeClass("active").eq(e).addClass("active").children("a").focus(),m.focus())):d.eq(e).children("a").focus();else if(!m.is("input")){var r,s,t=[];d.each(function(){a(this).hasClass("disabled")||a.trim(a(this).children("a").text().toLowerCase()).substring(0,1)==q[c.keyCode]&&t.push(a(this).index())}),r=a(document).data("keycount"),r++,a(document).data("keycount",r),s=a.trim(a(":focus").text().toLowerCase()).substring(0,1),s!=q[c.keyCode]?(r=1,a(document).data("keycount",r)):r>=t.length&&(a(document).data("keycount",0),r>t.length&&(r=1)),d.eq(t[r-1]).children("a").focus()}if((/(13|32)/.test(c.keyCode.toString(10))||/(^9$)/.test(c.keyCode.toString(10))&&o.options.selectOnTab)&&l){if(/(32)/.test(c.keyCode.toString(10))||c.preventDefault(),o.options.liveSearch)/(32)/.test(c.keyCode.toString(10))||(o.$menuInner.find(".active a").click(),m.focus());else{var u=a(":focus");u.click(),u.focus(),c.preventDefault(),a(document).data("spaceSelect",!0)}a(document).data("keycount",0)}(/(^9$|27)/.test(c.keyCode.toString(10))&&l&&(o.multiple||o.options.liveSearch)||/(27)/.test(c.keyCode.toString(10))&&!l)&&(o.$menu.parent().removeClass("open"),o.options.container&&o.$newElement.removeClass("open"),o.$button.focus())}},mobile:function(){this.$element.addClass("mobile-device").appendTo(this.$newElement),this.options.container&&this.$menu.hide()},refresh:function(){this.$lis=null,this.liObj={},this.reloadLi(),this.render(),this.checkDisabled(),this.liHeight(!0),this.setStyle(),this.setWidth(),this.$lis&&this.$searchbox.trigger("propertychange"),this.$element.trigger("refreshed.bs.select")},hide:function(){this.$newElement.hide()},show:function(){this.$newElement.show()},remove:function(){this.$newElement.remove(),this.$element.remove()}};var f=a.fn.selectpicker;a.fn.selectpicker=d,a.fn.selectpicker.Constructor=e,a.fn.selectpicker.noConflict=function(){return a.fn.selectpicker=f,this},a(document).data("keycount",0).on("keydown",'.bootstrap-select [data-toggle=dropdown], .bootstrap-select [role="menu"], .bs-searchbox input',e.prototype.keydown).on("focusin.modal",'.bootstrap-select [data-toggle=dropdown], .bootstrap-select [role="menu"], .bs-searchbox input',function(a){a.stopPropagation()}),a(window).on("load.bs.select.data-api",function(){a(".selectpicker").each(function(){var b=a(this);d.call(b,b.data())})})}(a)}),angular.module("checklist-model",[]).directive("checklistModel",["$parse","$compile",function(a,b){function c(a,b,c){if(angular.isArray(a))for(var d=a.length;d--;)if(c(a[d],b))return!0;return!1}function d(a,b,d){return a=angular.isArray(a)?a:[],c(a,b,d)||a.push(b),a}function e(a,b,c){if(angular.isArray(a))for(var d=a.length;d--;)if(c(a[d],b)){a.splice(d,1);break}return a}function f(f,g,h){function i(a,b){f[h.ngModel]=c(a,n,o)}var j=h.checklistModel;h.$set("checklistModel",null),b(g)(f),h.$set("checklistModel",j);var k=a(j),l=k.assign,m=a(h.checklistChange),n=h.checklistValue?a(h.checklistValue)(f.$parent):h.value,o=angular.equals;if(h.hasOwnProperty("checklistComparator"))if("."==h.checklistComparator[0]){var p=h.checklistComparator.substring(1);o=function(a,b){return a[p]===b[p]}}else o=a(h.checklistComparator)(f.$parent);f.$watch(h.ngModel,function(a,b){if(a!==b){var c=k(f.$parent);angular.isFunction(l)&&(a===!0?l(f.$parent,d(c,n,o)):l(f.$parent,e(c,n,o))),m&&m(f)}}),angular.isFunction(f.$parent.$watchCollection)?f.$parent.$watchCollection(j,i):f.$parent.$watch(j,i,!0)}return{restrict:"A",priority:1e3,terminal:!0,scope:!0,compile:function(a,b){if(("INPUT"!==a[0].tagName||"checkbox"!==b.type)&&"MD-CHECKBOX"!==a[0].tagName&&!b.btnCheckbox)throw'checklist-model should be applied to `input[type="checkbox"]` or `md-checkbox`.';if(!b.checklistValue&&!b.value)throw"You should provide `value` or `checklist-value`.";return b.ngModel||b.$set("ngModel","checked"),f}}}]),function(a,b,c){"use strict";a.fn.backstretch=function(d,f){return(d===c||0===d.length)&&a.error("No images were supplied for Backstretch"),0===a(b).scrollTop()&&b.scrollTo(0,0),this.each(function(){var b=a(this),c=b.data("backstretch");if(c){if("string"==typeof d&&"function"==typeof c[d])return void c[d](f);f=a.extend(c.options,f),c.destroy(!0)}c=new e(this,d,f),b.data("backstretch",c)})},a.backstretch=function(b,c){return a("body").backstretch(b,c).data("backstretch")},a.expr[":"].backstretch=function(b){return a(b).data("backstretch")!==c},a.fn.backstretch.defaults={centeredX:!0,centeredY:!0,duration:5e3,fade:0};var d={wrap:{left:0,top:0,overflow:"hidden",margin:0,padding:0,height:"100%",width:"100%",zIndex:-999999},img:{position:"absolute",display:"none",margin:0,padding:0,border:"none",width:"auto",height:"auto",maxHeight:"none",maxWidth:"none",zIndex:-999999}},e=function(c,e,g){this.options=a.extend({},a.fn.backstretch.defaults,g||{}),this.images=a.isArray(e)?e:[e],a.each(this.images,function(){a("")[0].src=this}),this.isBody=c===document.body,this.$container=a(c),this.$root=this.isBody?a(f?b:document):this.$container;var h=this.$container.children(".backstretch").first();if(this.$wrap=h.length?h:a('
    ').css(d.wrap).appendTo(this.$container),!this.isBody){var i=this.$container.css("position"),j=this.$container.css("zIndex");this.$container.css({position:"static"===i?"relative":i,zIndex:"auto"===j?0:j,background:"none"}),this.$wrap.css({zIndex:-999998})}this.$wrap.css({position:this.isBody&&f?"fixed":"absolute"}),this.index=0,this.show(this.index),a(b).on("resize.backstretch",a.proxy(this.resize,this)).on("orientationchange.backstretch",a.proxy(function(){this.isBody&&0===b.pageYOffset&&(b.scrollTo(0,1),this.resize())},this))};e.prototype={resize:function(){try{var a,c={left:0,top:0},d=this.isBody?this.$root.width():this.$root.innerWidth(),e=d,f=this.isBody?b.innerHeight?b.innerHeight:this.$root.height():this.$root.innerHeight(),g=e/this.$img.data("ratio");g>=f?(a=(g-f)/2,this.options.centeredY&&(c.top="-"+a+"px")):(g=f,e=g*this.$img.data("ratio"),a=(e-d)/2,this.options.centeredX&&(c.left="-"+a+"px")),this.$wrap.css({width:d,height:f}).find("img:not(.deleteable)").css({width:e,height:g}).css(c)}catch(h){}return this},show:function(b){if(!(Math.abs(b)>this.images.length-1)){var c=this,e=c.$wrap.find("img").addClass("deleteable"),f={relatedTarget:c.$container[0]};return c.$container.trigger(a.Event("backstretch.before",f),[c,b]),this.index=b,clearInterval(c.interval),c.$img=a("").css(d.img).bind("load",function(d){var g=this.width||a(d.target).width(),h=this.height||a(d.target).height();a(this).data("ratio",g/h),a(this).fadeIn(c.options.speed||c.options.fade,function(){e.remove(),c.paused||c.cycle(),a(["after","show"]).each(function(){c.$container.trigger(a.Event("backstretch."+this,f),[c,b])})}),c.resize()}).appendTo(c.$wrap),c.$img.attr("src",c.images[b]),c}},next:function(){return this.show(this.index1&&(clearInterval(this.interval),this.interval=setInterval(a.proxy(function(){this.paused||this.next()},this),this.options.duration)),this},destroy:function(c){a(b).off("resize.backstretch orientationchange.backstretch"),clearInterval(this.interval),c||this.$wrap.remove(),this.$container.removeData("backstretch")}};var f=function(){var a=navigator.userAgent,c=navigator.platform,d=a.match(/AppleWebKit\/([0-9]+)/),e=!!d&&d[1],f=a.match(/Fennec\/([0-9]+)/),g=!!f&&f[1],h=a.match(/Opera Mobi\/([0-9]+)/),i=!!h&&h[1],j=a.match(/MSIE ([0-9]+)/),k=!!j&&j[1];return!((c.indexOf("iPhone")>-1||c.indexOf("iPad")>-1||c.indexOf("iPod")>-1)&&e&&534>e||b.operamini&&"[object OperaMini]"==={}.toString.call(b.operamini)||h&&7458>i||a.indexOf("Android")>-1&&e&&533>e||g&&6>g||"palmGetResource"in b&&e&&534>e||a.indexOf("MeeGo")>-1&&a.indexOf("NokiaBrowser/8.5.0")>-1||k&&6>=k)}()}(jQuery,window),function(a){"function"==typeof define&&define.amd?define(["jquery"],a):a("object"==typeof exports?require("jquery"):jQuery)}(function(a){function b(a){return h.raw?a:encodeURIComponent(a)}function c(a){return h.raw?a:decodeURIComponent(a)}function d(a){return b(h.json?JSON.stringify(a):String(a))}function e(a){0===a.indexOf('"')&&(a=a.slice(1,-1).replace(/\\"/g,'"').replace(/\\\\/g,"\\"));try{return a=decodeURIComponent(a.replace(g," ")),h.json?JSON.parse(a):a}catch(b){}}function f(b,c){var d=h.raw?b:e(b);return a.isFunction(c)?c(d):d}var g=/\+/g,h=a.cookie=function(e,g,i){if(void 0!==g&&!a.isFunction(g)){if(i=a.extend({},h.defaults,i),"number"==typeof i.expires){var j=i.expires,k=i.expires=new Date;k.setTime(+k+864e5*j)}return document.cookie=[b(e),"=",d(g),i.expires?"; expires="+i.expires.toUTCString():"",i.path?"; path="+i.path:"",i.domain?"; domain="+i.domain:"",i.secure?"; secure":""].join("")}for(var l=e?void 0:{},m=document.cookie?document.cookie.split("; "):[],n=0,o=m.length;o>n;n++){var p=m[n].split("="),q=c(p.shift()),r=p.join("=");if(e&&e===q){l=f(r,g);break}e||void 0===(r=f(r))||(l[q]=r)}return l};h.defaults={},a.removeCookie=function(b,c){return void 0===a.cookie(b)?!1:(a.cookie(b,"",a.extend({},c,{expires:-1})),!a.cookie(b))}}),function(a,b,c){function d(c){var d=b.console;f[c]||(f[c]=!0,a.migrateWarnings.push(c),d&&d.warn&&!a.migrateMute&&(d.warn("JQMIGRATE: "+c),a.migrateTrace&&d.trace&&d.trace()))}function e(b,c,e,f){if(Object.defineProperty)try{return void Object.defineProperty(b,c,{configurable:!0,enumerable:!0,get:function(){return d(f),e},set:function(a){d(f),e=a}})}catch(g){}a._definePropertyBroken=!0,b[c]=e}var f={};a.migrateWarnings=[],!a.migrateMute&&b.console&&b.console.log&&b.console.log("JQMIGRATE: Logging is active"),a.migrateTrace===c&&(a.migrateTrace=!0),a.migrateReset=function(){f={},a.migrateWarnings.length=0},"BackCompat"===document.compatMode&&d("jQuery is not compatible with Quirks Mode");var g=a("",{size:1}).attr("size")&&a.attrFn,h=a.attr,i=a.attrHooks.value&&a.attrHooks.value.get||function(){return null},j=a.attrHooks.value&&a.attrHooks.value.set||function(){return c},k=/^(?:input|button)$/i,l=/^[238]$/,m=/^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,n=/^(?:checked|selected)$/i;e(a,"attrFn",g||{},"jQuery.attrFn is deprecated"),a.attr=function(b,e,f,i){var j=e.toLowerCase(),o=b&&b.nodeType;return i&&(h.length<4&&d("jQuery.fn.attr( props, pass ) is deprecated"),b&&!l.test(o)&&(g?e in g:a.isFunction(a.fn[e])))?a(b)[e](f):("type"===e&&f!==c&&k.test(b.nodeName)&&b.parentNode&&d("Can't change the 'type' of an input or button in IE 6/7/8"),!a.attrHooks[j]&&m.test(j)&&(a.attrHooks[j]={get:function(b,d){var e,f=a.prop(b,d);return f===!0||"boolean"!=typeof f&&(e=b.getAttributeNode(d))&&e.nodeValue!==!1?d.toLowerCase():c},set:function(b,c,d){var e;return c===!1?a.removeAttr(b,d):(e=a.propFix[d]||d,e in b&&(b[e]=!0),b.setAttribute(d,d.toLowerCase())),d}},n.test(j)&&d("jQuery.fn.attr('"+j+"') may use property instead of attribute")),h.call(a,b,e,f))},a.attrHooks.value={get:function(a,b){var c=(a.nodeName||"").toLowerCase();return"button"===c?i.apply(this,arguments):("input"!==c&&"option"!==c&&d("jQuery.fn.attr('value') no longer gets properties"),b in a?a.value:null)},set:function(a,b){var c=(a.nodeName||"").toLowerCase();return"button"===c?j.apply(this,arguments):("input"!==c&&"option"!==c&&d("jQuery.fn.attr('value', val) no longer sets properties"),void(a.value=b))}};var o,p,q=a.fn.init,r=a.parseJSON,s=/^([^<]*)(<[\w\W]+>)([^>]*)$/;a.fn.init=function(b,c,e){var f;return b&&"string"==typeof b&&!a.isPlainObject(c)&&(f=s.exec(a.trim(b)))&&f[0]&&("<"!==b.charAt(0)&&d("$(html) HTML strings must start with '<' character"),f[3]&&d("$(html) HTML text after last tag is ignored"),"#"===f[0].charAt(0)&&(d("HTML string cannot start with a '#' character"),a.error("JQMIGRATE: Invalid selector string (XSS)")),c&&c.context&&(c=c.context),a.parseHTML)?q.call(this,a.parseHTML(f[2],c,!0),c,e):q.apply(this,arguments)},a.fn.init.prototype=a.fn,a.parseJSON=function(a){return a||null===a?r.apply(this,arguments):(d("jQuery.parseJSON requires a valid JSON string"),null)},a.uaMatch=function(a){a=a.toLowerCase();var b=/(chrome)[ \/]([\w.]+)/.exec(a)||/(webkit)[ \/]([\w.]+)/.exec(a)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(a)||/(msie) ([\w.]+)/.exec(a)||a.indexOf("compatible")<0&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(a)||[];return{browser:b[1]||"",version:b[2]||"0"}},a.browser||(o=a.uaMatch(navigator.userAgent),p={},o.browser&&(p[o.browser]=!0,p.version=o.version),p.chrome?p.webkit=!0:p.webkit&&(p.safari=!0),a.browser=p),e(a,"browser",a.browser,"jQuery.browser is deprecated"),a.sub=function(){function b(a,c){return new b.fn.init(a,c)}a.extend(!0,b,this),b.superclass=this,b.fn=b.prototype=this(),b.fn.constructor=b,b.sub=this.sub,b.fn.init=function(d,e){return e&&e instanceof a&&!(e instanceof b)&&(e=b(e)),a.fn.init.call(this,d,e,c)},b.fn.init.prototype=b.fn;var c=b(document);return d("jQuery.sub() is deprecated"),b},a.ajaxSetup({converters:{"text json":a.parseJSON}});var t=a.fn.data;a.fn.data=function(b){var e,f,g=this[0];return!g||"events"!==b||1!==arguments.length||(e=a.data(g,b),f=a._data(g,b),e!==c&&e!==f||f===c)?t.apply(this,arguments):(d("Use of jQuery.fn.data('events') is deprecated"),f)};var u=/\/(java|ecma)script/i,v=a.fn.andSelf||a.fn.addBack;a.fn.andSelf=function(){return d("jQuery.fn.andSelf() replaced by jQuery.fn.addBack()"),v.apply(this,arguments)},a.clean||(a.clean=function(b,c,e,f){c=c||document,c=!c.nodeType&&c[0]||c,c=c.ownerDocument||c,d("jQuery.clean() is deprecated");var g,h,i,j,k=[];if(a.merge(k,a.buildFragment(b,c).childNodes),e)for(i=function(a){return!a.type||u.test(a.type)?f?f.push(a.parentNode?a.parentNode.removeChild(a):a):e.appendChild(a):void 0},g=0;null!=(h=k[g]);g++)a.nodeName(h,"script")&&i(h)||(e.appendChild(h),"undefined"!=typeof h.getElementsByTagName&&(j=a.grep(a.merge([],h.getElementsByTagName("script")),i),k.splice.apply(k,[g+1,0].concat(j)),g+=j.length));return k});var w=a.event.add,x=a.event.remove,y=a.event.trigger,z=a.fn.toggle,A=a.fn.live,B=a.fn.die,C="ajaxStart|ajaxStop|ajaxSend|ajaxComplete|ajaxError|ajaxSuccess",D=new RegExp("\\b(?:"+C+")\\b"),E=/(?:^|\s)hover(\.\S+|)\b/,F=function(b){return"string"!=typeof b||a.event.special.hover?b:(E.test(b)&&d("'hover' pseudo-event is deprecated, use 'mouseenter mouseleave'"),b&&b.replace(E,"mouseenter$1 mouseleave$1"))};a.event.props&&"attrChange"!==a.event.props[0]&&a.event.props.unshift("attrChange","attrName","relatedNode","srcElement"),a.event.dispatch&&e(a.event,"handle",a.event.dispatch,"jQuery.event.handle is undocumented and deprecated"),a.event.add=function(a,b,c,e,f){a!==document&&D.test(b)&&d("AJAX events should be attached to document: "+b),w.call(this,a,F(b||""),c,e,f)},a.event.remove=function(a,b,c,d,e){x.call(this,a,F(b)||"",c,d,e)},a.fn.error=function(){var a=Array.prototype.slice.call(arguments,0);return d("jQuery.fn.error() is deprecated"),a.splice(0,0,"error"),arguments.length?this.bind.apply(this,a):(this.triggerHandler.apply(this,a),this)},a.fn.toggle=function(b,c){if(!a.isFunction(b)||!a.isFunction(c))return z.apply(this,arguments);d("jQuery.fn.toggle(handler, handler...) is deprecated");var e=arguments,f=b.guid||a.guid++,g=0,h=function(c){var d=(a._data(this,"lastToggle"+b.guid)||0)%g;return a._data(this,"lastToggle"+b.guid,d+1),c.preventDefault(),e[d].apply(this,arguments)||!1};for(h.guid=f;g").attr("name",c.submitButton.name).val(a(c.submitButton).val()).appendTo(c.currentForm)),e=c.settings.submitHandler.call(c,c.currentForm,b),c.submitButton&&d.remove(),void 0!==e?e:!1):!0}return c.settings.debug&&b.preventDefault(),c.cancelSubmit?(c.cancelSubmit=!1,d()):c.form()?c.pendingRequest?(c.formSubmitted=!0,!1):d():(c.focusInvalid(),!1)})),c)},valid:function(){var b,c,d;return a(this[0]).is("form")?b=this.validate().form():(d=[],b=!0,c=a(this[0].form).validate(),this.each(function(){b=c.element(this)&&b,d=d.concat(c.errorList)}),c.errorList=d),b},rules:function(b,c){var d,e,f,g,h,i,j=this[0];if(b)switch(d=a.data(j.form,"validator").settings,e=d.rules,f=a.validator.staticRules(j),b){case"add":a.extend(f,a.validator.normalizeRule(c)),delete f.messages,e[j.name]=f,c.messages&&(d.messages[j.name]=a.extend(d.messages[j.name],c.messages));break;case"remove":return c?(i={},a.each(c.split(/\s/),function(b,c){i[c]=f[c],delete f[c],"required"===c&&a(j).removeAttr("aria-required")}),i):(delete e[j.name],f)}return g=a.validator.normalizeRules(a.extend({},a.validator.classRules(j),a.validator.attributeRules(j),a.validator.dataRules(j),a.validator.staticRules(j)),j),g.required&&(h=g.required,delete g.required,g=a.extend({required:h},g),a(j).attr("aria-required","true")),g.remote&&(h=g.remote,delete g.remote,g=a.extend(g,{remote:h})),g}}),a.extend(a.expr[":"],{blank:function(b){return!a.trim(""+a(b).val())},filled:function(b){return!!a.trim(""+a(b).val())},unchecked:function(b){return!a(b).prop("checked")}}),a.validator=function(b,c){this.settings=a.extend(!0,{},a.validator.defaults,b),this.currentForm=c,this.init()},a.validator.format=function(b,c){return 1===arguments.length?function(){var c=a.makeArray(arguments);return c.unshift(b),a.validator.format.apply(this,c)}:(arguments.length>2&&c.constructor!==Array&&(c=a.makeArray(arguments).slice(1)),c.constructor!==Array&&(c=[c]),a.each(c,function(a,c){b=b.replace(new RegExp("\\{"+a+"\\}","g"),function(){return c})}),b)},a.extend(a.validator,{defaults:{messages:{},groups:{},rules:{},errorClass:"error",validClass:"valid",errorElement:"label",focusCleanup:!1,focusInvalid:!0,errorContainer:a([]),errorLabelContainer:a([]),onsubmit:!0,ignore:":hidden",ignoreTitle:!1,onfocusin:function(a){this.lastActive=a,this.settings.focusCleanup&&(this.settings.unhighlight&&this.settings.unhighlight.call(this,a,this.settings.errorClass,this.settings.validClass),this.hideThese(this.errorsFor(a)))},onfocusout:function(a){this.checkable(a)||!(a.name in this.submitted)&&this.optional(a)||this.element(a)},onkeyup:function(b,c){var d=[16,17,18,20,35,36,37,38,39,40,45,144,225];9===c.which&&""===this.elementValue(b)||-1!==a.inArray(c.keyCode,d)||(b.name in this.submitted||b===this.lastElement)&&this.element(b)},onclick:function(a){a.name in this.submitted?this.element(a):a.parentNode.name in this.submitted&&this.element(a.parentNode)},highlight:function(b,c,d){"radio"===b.type?this.findByName(b.name).addClass(c).removeClass(d):a(b).addClass(c).removeClass(d)},unhighlight:function(b,c,d){"radio"===b.type?this.findByName(b.name).removeClass(c).addClass(d):a(b).removeClass(c).addClass(d)}},setDefaults:function(b){a.extend(a.validator.defaults,b)},messages:{required:"This field is required.",remote:"Please fix this field.",email:"Please enter a valid email address.",url:"Please enter a valid URL.",date:"Please enter a valid date.",dateISO:"Please enter a valid date ( ISO ).",number:"Please enter a valid number.",digits:"Please enter only digits.",creditcard:"Please enter a valid credit card number.",equalTo:"Please enter the same value again.",maxlength:a.validator.format("Please enter no more than {0} characters."),minlength:a.validator.format("Please enter at least {0} characters."),rangelength:a.validator.format("Please enter a value between {0} and {1} characters long."),range:a.validator.format("Please enter a value between {0} and {1}."),max:a.validator.format("Please enter a value less than or equal to {0}."),min:a.validator.format("Please enter a value greater than or equal to {0}.")},autoCreateRanges:!1,prototype:{init:function(){function b(b){var c=a.data(this.form,"validator"),d="on"+b.type.replace(/^validate/,""),e=c.settings;e[d]&&!a(this).is(e.ignore)&&e[d].call(c,this,b)}this.labelContainer=a(this.settings.errorLabelContainer),this.errorContext=this.labelContainer.length&&this.labelContainer||a(this.currentForm),this.containers=a(this.settings.errorContainer).add(this.settings.errorLabelContainer),this.submitted={},this.valueCache={},this.pendingRequest=0,this.pending={},this.invalid={},this.reset();var c,d=this.groups={};a.each(this.settings.groups,function(b,c){"string"==typeof c&&(c=c.split(/\s/)),a.each(c,function(a,c){d[c]=b})}),c=this.settings.rules,a.each(c,function(b,d){c[b]=a.validator.normalizeRule(d)}),a(this.currentForm).on("focusin.validate focusout.validate keyup.validate",":text, [type='password'], [type='file'], select, textarea, [type='number'], [type='search'], [type='tel'], [type='url'], [type='email'], [type='datetime'], [type='date'], [type='month'], [type='week'], [type='time'], [type='datetime-local'], [type='range'], [type='color'], [type='radio'], [type='checkbox']",b).on("click.validate","select, option, [type='radio'], [type='checkbox']",b),this.settings.invalidHandler&&a(this.currentForm).on("invalid-form.validate",this.settings.invalidHandler),a(this.currentForm).find("[required], [data-rule-required], .required").attr("aria-required","true")},form:function(){return this.checkForm(),a.extend(this.submitted,this.errorMap),this.invalid=a.extend({},this.errorMap),this.valid()||a(this.currentForm).triggerHandler("invalid-form",[this]),this.showErrors(),this.valid()},checkForm:function(){this.prepareForm();for(var a=0,b=this.currentElements=this.elements();b[a];a++)this.check(b[a]);return this.valid()},element:function(b){var c=this.clean(b),d=this.validationTargetFor(c),e=!0;return this.lastElement=d,void 0===d?delete this.invalid[c.name]:(this.prepareElement(d),this.currentElements=a(d),e=this.check(d)!==!1,e?delete this.invalid[d.name]:this.invalid[d.name]=!0),a(b).attr("aria-invalid",!e),this.numberOfInvalids()||(this.toHide=this.toHide.add(this.containers)),this.showErrors(),e},showErrors:function(b){if(b){a.extend(this.errorMap,b),this.errorList=[];for(var c in b)this.errorList.push({message:b[c],element:this.findByName(c)[0]});this.successList=a.grep(this.successList,function(a){return!(a.name in b)})}this.settings.showErrors?this.settings.showErrors.call(this,this.errorMap,this.errorList):this.defaultShowErrors()},resetForm:function(){a.fn.resetForm&&a(this.currentForm).resetForm(),this.submitted={},this.lastElement=null,this.prepareForm(),this.hideErrors();var b,c=this.elements().removeData("previousValue").removeAttr("aria-invalid");if(this.settings.unhighlight)for(b=0;c[b];b++)this.settings.unhighlight.call(this,c[b],this.settings.errorClass,"");else c.removeClass(this.settings.errorClass)},numberOfInvalids:function(){return this.objectLength(this.invalid)},objectLength:function(a){var b,c=0;for(b in a)c++;return c},hideErrors:function(){this.hideThese(this.toHide)},hideThese:function(a){a.not(this.containers).text(""),this.addWrapper(a).hide()},valid:function(){return 0===this.size()},size:function(){return this.errorList.length},focusInvalid:function(){if(this.settings.focusInvalid)try{a(this.findLastActive()||this.errorList.length&&this.errorList[0].element||[]).filter(":visible").focus().trigger("focusin")}catch(b){}},findLastActive:function(){var b=this.lastActive;return b&&1===a.grep(this.errorList,function(a){return a.element.name===b.name}).length&&b},elements:function(){var b=this,c={};return a(this.currentForm).find("input, select, textarea").not(":submit, :reset, :image, :disabled").not(this.settings.ignore).filter(function(){return!this.name&&b.settings.debug&&window.console&&console.error("%o has no name assigned",this),this.name in c||!b.objectLength(a(this).rules())?!1:(c[this.name]=!0,!0)})},clean:function(b){return a(b)[0]},errors:function(){var b=this.settings.errorClass.split(" ").join(".");return a(this.settings.errorElement+"."+b,this.errorContext)},reset:function(){this.successList=[],this.errorList=[],this.errorMap={},this.toShow=a([]),this.toHide=a([]),this.currentElements=a([])},prepareForm:function(){this.reset(),this.toHide=this.errors().add(this.containers)},prepareElement:function(a){this.reset(),this.toHide=this.errorsFor(a)},elementValue:function(b){var c,d=a(b),e=b.type;return"radio"===e||"checkbox"===e?this.findByName(b.name).filter(":checked").val():"number"===e&&"undefined"!=typeof b.validity?b.validity.badInput?!1:d.val():(c=d.val(),"string"==typeof c?c.replace(/\r/g,""):c)},check:function(b){b=this.validationTargetFor(this.clean(b));var c,d,e,f=a(b).rules(),g=a.map(f,function(a,b){return b}).length,h=!1,i=this.elementValue(b);for(d in f){e={method:d,parameters:f[d]};try{if(c=a.validator.methods[d].call(this,i,b,e.parameters),"dependency-mismatch"===c&&1===g){h=!0;continue}if(h=!1,"pending"===c)return void(this.toHide=this.toHide.not(this.errorsFor(b)));if(!c)return this.formatAndAdd(b,e),!1}catch(j){throw this.settings.debug&&window.console&&console.log("Exception occurred when checking element "+b.id+", check the '"+e.method+"' method.",j),j instanceof TypeError&&(j.message+=". Exception occurred when checking element "+b.id+", check the '"+e.method+"' method."),j}}if(!h)return this.objectLength(f)&&this.successList.push(b),!0},customDataMessage:function(b,c){return a(b).data("msg"+c.charAt(0).toUpperCase()+c.substring(1).toLowerCase())||a(b).data("msg")},customMessage:function(a,b){var c=this.settings.messages[a];return c&&(c.constructor===String?c:c[b])},findDefined:function(){for(var a=0;aWarning: No message defined for "+b.name+"")},formatAndAdd:function(b,c){var d=this.defaultMessage(b,c.method),e=/\$?\{(\d+)\}/g;"function"==typeof d?d=d.call(this,c.parameters,b):e.test(d)&&(d=a.validator.format(d.replace(e,"{$1}"),c.parameters)),this.errorList.push({message:d,element:b,method:c.method}),this.errorMap[b.name]=d,this.submitted[b.name]=d},addWrapper:function(a){return this.settings.wrapper&&(a=a.add(a.parent(this.settings.wrapper))),a},defaultShowErrors:function(){var a,b,c;for(a=0;this.errorList[a];a++)c=this.errorList[a],this.settings.highlight&&this.settings.highlight.call(this,c.element,this.settings.errorClass,this.settings.validClass),this.showLabel(c.element,c.message);if(this.errorList.length&&(this.toShow=this.toShow.add(this.containers)),this.settings.success)for(a=0;this.successList[a];a++)this.showLabel(this.successList[a]);if(this.settings.unhighlight)for(a=0,b=this.validElements();b[a];a++)this.settings.unhighlight.call(this,b[a],this.settings.errorClass,this.settings.validClass);this.toHide=this.toHide.not(this.toShow),this.hideErrors(),this.addWrapper(this.toShow).show()},validElements:function(){return this.currentElements.not(this.invalidElements())},invalidElements:function(){return a(this.errorList).map(function(){return this.element})},showLabel:function(b,c){var d,e,f,g=this.errorsFor(b),h=this.idOrName(b),i=a(b).attr("aria-describedby");g.length?(g.removeClass(this.settings.validClass).addClass(this.settings.errorClass),g.html(c)):(g=a("<"+this.settings.errorElement+">").attr("id",h+"-error").addClass(this.settings.errorClass).html(c||""),d=g,this.settings.wrapper&&(d=g.hide().show().wrap("<"+this.settings.wrapper+"/>").parent()),this.labelContainer.length?this.labelContainer.append(d):this.settings.errorPlacement?this.settings.errorPlacement(d,a(b)):d.insertAfter(b),g.is("label")?g.attr("for",h):0===g.parents("label[for='"+h+"']").length&&(f=g.attr("id").replace(/(:|\.|\[|\]|\$)/g,"\\$1"),i?i.match(new RegExp("\\b"+f+"\\b"))||(i+=" "+f):i=f,a(b).attr("aria-describedby",i),e=this.groups[b.name],e&&a.each(this.groups,function(b,c){c===e&&a("[name='"+b+"']",this.currentForm).attr("aria-describedby",g.attr("id"))}))),!c&&this.settings.success&&(g.text(""),"string"==typeof this.settings.success?g.addClass(this.settings.success):this.settings.success(g,b)),this.toShow=this.toShow.add(g)},errorsFor:function(b){var c=this.idOrName(b),d=a(b).attr("aria-describedby"),e="label[for='"+c+"'], label[for='"+c+"'] *";return d&&(e=e+", #"+d.replace(/\s+/g,", #")),this.errors().filter(e)},idOrName:function(a){return this.groups[a.name]||(this.checkable(a)?a.name:a.id||a.name)},validationTargetFor:function(b){return this.checkable(b)&&(b=this.findByName(b.name)),a(b).not(this.settings.ignore)[0]},checkable:function(a){return/radio|checkbox/i.test(a.type)},findByName:function(b){return a(this.currentForm).find("[name='"+b+"']")},getLength:function(b,c){switch(c.nodeName.toLowerCase()){case"select":return a("option:selected",c).length;case"input":if(this.checkable(c))return this.findByName(c.name).filter(":checked").length}return b.length},depend:function(a,b){return this.dependTypes[typeof a]?this.dependTypes[typeof a](a,b):!0},dependTypes:{"boolean":function(a){return a},string:function(b,c){return!!a(b,c.form).length},"function":function(a,b){return a(b)}},optional:function(b){var c=this.elementValue(b);return!a.validator.methods.required.call(this,c,b)&&"dependency-mismatch"; +},startRequest:function(a){this.pending[a.name]||(this.pendingRequest++,this.pending[a.name]=!0)},stopRequest:function(b,c){this.pendingRequest--,this.pendingRequest<0&&(this.pendingRequest=0),delete this.pending[b.name],c&&0===this.pendingRequest&&this.formSubmitted&&this.form()?(a(this.currentForm).submit(),this.formSubmitted=!1):!c&&0===this.pendingRequest&&this.formSubmitted&&(a(this.currentForm).triggerHandler("invalid-form",[this]),this.formSubmitted=!1)},previousValue:function(b){return a.data(b,"previousValue")||a.data(b,"previousValue",{old:null,valid:!0,message:this.defaultMessage(b,"remote")})},destroy:function(){this.resetForm(),a(this.currentForm).off(".validate").removeData("validator")}},classRuleSettings:{required:{required:!0},email:{email:!0},url:{url:!0},date:{date:!0},dateISO:{dateISO:!0},number:{number:!0},digits:{digits:!0},creditcard:{creditcard:!0}},addClassRules:function(b,c){b.constructor===String?this.classRuleSettings[b]=c:a.extend(this.classRuleSettings,b)},classRules:function(b){var c={},d=a(b).attr("class");return d&&a.each(d.split(" "),function(){this in a.validator.classRuleSettings&&a.extend(c,a.validator.classRuleSettings[this])}),c},normalizeAttributeRule:function(a,b,c,d){/min|max/.test(c)&&(null===b||/number|range|text/.test(b))&&(d=Number(d),isNaN(d)&&(d=void 0)),d||0===d?a[c]=d:b===c&&"range"!==b&&(a[c]=!0)},attributeRules:function(b){var c,d,e={},f=a(b),g=b.getAttribute("type");for(c in a.validator.methods)"required"===c?(d=b.getAttribute(c),""===d&&(d=!0),d=!!d):d=f.attr(c),this.normalizeAttributeRule(e,g,c,d);return e.maxlength&&/-1|2147483647|524288/.test(e.maxlength)&&delete e.maxlength,e},dataRules:function(b){var c,d,e={},f=a(b),g=b.getAttribute("type");for(c in a.validator.methods)d=f.data("rule"+c.charAt(0).toUpperCase()+c.substring(1).toLowerCase()),this.normalizeAttributeRule(e,g,c,d);return e},staticRules:function(b){var c={},d=a.data(b.form,"validator");return d.settings.rules&&(c=a.validator.normalizeRule(d.settings.rules[b.name])||{}),c},normalizeRules:function(b,c){return a.each(b,function(d,e){if(e===!1)return void delete b[d];if(e.param||e.depends){var f=!0;switch(typeof e.depends){case"string":f=!!a(e.depends,c.form).length;break;case"function":f=e.depends.call(c,c)}f?b[d]=void 0!==e.param?e.param:!0:delete b[d]}}),a.each(b,function(d,e){b[d]=a.isFunction(e)?e(c):e}),a.each(["minlength","maxlength"],function(){b[this]&&(b[this]=Number(b[this]))}),a.each(["rangelength","range"],function(){var c;b[this]&&(a.isArray(b[this])?b[this]=[Number(b[this][0]),Number(b[this][1])]:"string"==typeof b[this]&&(c=b[this].replace(/[\[\]]/g,"").split(/[\s,]+/),b[this]=[Number(c[0]),Number(c[1])]))}),a.validator.autoCreateRanges&&(null!=b.min&&null!=b.max&&(b.range=[b.min,b.max],delete b.min,delete b.max),null!=b.minlength&&null!=b.maxlength&&(b.rangelength=[b.minlength,b.maxlength],delete b.minlength,delete b.maxlength)),b},normalizeRule:function(b){if("string"==typeof b){var c={};a.each(b.split(/\s/),function(){c[this]=!0}),b=c}return b},addMethod:function(b,c,d){a.validator.methods[b]=c,a.validator.messages[b]=void 0!==d?d:a.validator.messages[b],c.length<3&&a.validator.addClassRules(b,a.validator.normalizeRule(b))},methods:{required:function(b,c,d){if(!this.depend(d,c))return"dependency-mismatch";if("select"===c.nodeName.toLowerCase()){var e=a(c).val();return e&&e.length>0}return this.checkable(c)?this.getLength(b,c)>0:b.length>0},email:function(a,b){return this.optional(b)||/^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/.test(a)},url:function(a,b){return this.optional(b)||/^(?:(?:(?:https?|ftp):)?\/\/)(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)(?:\.(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)*(?:\.(?:[a-z\u00a1-\uffff]{2,})).?)(?::\d{2,5})?(?:[\/?#]\S*)?$/i.test(a)},date:function(a,b){return this.optional(b)||!/Invalid|NaN/.test(new Date(a).toString())},dateISO:function(a,b){return this.optional(b)||/^\d{4}[\/\-](0?[1-9]|1[012])[\/\-](0?[1-9]|[12][0-9]|3[01])$/.test(a)},number:function(a,b){return this.optional(b)||/^(?:-?\d+|-?\d{1,3}(?:,\d{3})+)?(?:\.\d+)?$/.test(a)},digits:function(a,b){return this.optional(b)||/^\d+$/.test(a)},creditcard:function(a,b){if(this.optional(b))return"dependency-mismatch";if(/[^0-9 \-]+/.test(a))return!1;var c,d,e=0,f=0,g=!1;if(a=a.replace(/\D/g,""),a.length<13||a.length>19)return!1;for(c=a.length-1;c>=0;c--)d=a.charAt(c),f=parseInt(d,10),g&&(f*=2)>9&&(f-=9),e+=f,g=!g;return e%10===0},minlength:function(b,c,d){var e=a.isArray(b)?b.length:this.getLength(b,c);return this.optional(c)||e>=d},maxlength:function(b,c,d){var e=a.isArray(b)?b.length:this.getLength(b,c);return this.optional(c)||d>=e},rangelength:function(b,c,d){var e=a.isArray(b)?b.length:this.getLength(b,c);return this.optional(c)||e>=d[0]&&e<=d[1]},min:function(a,b,c){return this.optional(b)||a>=c},max:function(a,b,c){return this.optional(b)||c>=a},range:function(a,b,c){return this.optional(b)||a>=c[0]&&a<=c[1]},equalTo:function(b,c,d){var e=a(d);return this.settings.onfocusout&&e.off(".validate-equalTo").on("blur.validate-equalTo",function(){a(c).valid()}),b===e.val()},remote:function(b,c,d){if(this.optional(c))return"dependency-mismatch";var e,f,g=this.previousValue(c);return this.settings.messages[c.name]||(this.settings.messages[c.name]={}),g.originalMessage=this.settings.messages[c.name].remote,this.settings.messages[c.name].remote=g.message,d="string"==typeof d&&{url:d}||d,g.old===b?g.valid:(g.old=b,e=this,this.startRequest(c),f={},f[c.name]=b,a.ajax(a.extend(!0,{mode:"abort",port:"validate"+c.name,dataType:"json",data:f,context:e.currentForm,success:function(d){var f,h,i,j=d===!0||"true"===d;e.settings.messages[c.name].remote=g.originalMessage,j?(i=e.formSubmitted,e.prepareElement(c),e.formSubmitted=i,e.successList.push(c),delete e.invalid[c.name],e.showErrors()):(f={},h=d||e.defaultMessage(c,"remote"),f[c.name]=g.message=a.isFunction(h)?h(b):h,e.invalid[c.name]=!0,e.showErrors(f)),g.valid=j,e.stopRequest(c,j)}},d)),"pending")}}});var b,c={};a.ajaxPrefilter?a.ajaxPrefilter(function(a,b,d){var e=a.port;"abort"===a.mode&&(c[e]&&c[e].abort(),c[e]=d)}):(b=a.ajax,a.ajax=function(d){var e=("mode"in d?d:a.ajaxSettings).mode,f=("port"in d?d:a.ajaxSettings).port;return"abort"===e?(c[f]&&c[f].abort(),c[f]=b.apply(this,arguments),c[f]):b.apply(this,arguments)})}),function(a){"function"==typeof define&&define.amd?define(["jquery"],a):a(jQuery)}(function(a){a.fn.addBack=a.fn.addBack||a.fn.andSelf,a.fn.extend({actual:function(b,c){if(!this[b])throw'$.actual => The jQuery method "'+b+'" you called does not exist';var d,e,f={absolute:!1,clone:!1,includeMargin:!1,display:"block"},g=a.extend(f,c),h=this.eq(0);if(g.clone===!0)d=function(){var a="position: absolute !important; top: -1000 !important; ";h=h.clone().attr("style",a).appendTo("body")},e=function(){h.remove()};else{var i,j=[],k="";d=function(){i=h.parents().addBack().filter(":hidden"),k+="visibility: hidden !important; display: "+g.display+" !important; ",g.absolute===!0&&(k+="position: absolute !important; "),i.each(function(){var b=a(this),c=b.attr("style");j.push(c),b.attr("style",c?c+";"+k:k)})},e=function(){i.each(function(b){var c=a(this),d=j[b];void 0===d?c.removeAttr("style"):c.attr("style",d)})}}d();var l=/(outer)/.test(b)?h[b](g.includeMargin):h[b]();return e(),l}})}),!function(a){angular.module("ngCsv.config",[]).value("ngCsv.config",{debug:!0}).config(["$compileProvider",function(a){angular.isDefined(a.urlSanitizationWhitelist)?a.urlSanitizationWhitelist(/^\s*(https?|ftp|mailto|file|data):/):a.aHrefSanitizationWhitelist(/^\s*(https?|ftp|mailto|file|data):/)}]),angular.module("ngCsv.directives",["ngCsv.services"]),angular.module("ngCsv.services",[]),angular.module("ngCsv",["ngCsv.config","ngCsv.services","ngCsv.directives","ngSanitize"]),"undefined"!=typeof module&&"undefined"!=typeof exports&&module.exports===exports&&(module.exports="ngCsv"),angular.module("ngCsv.services").service("CSV",["$q",function(a){var b="\r\n",c="\ufeff",d={"\\t":" ","\\b":"\b","\\v":"\x0B","\\f":"\f","\\r":"\r"};this.stringifyField=function(a,b){return"locale"===b.decimalSep&&this.isFloat(a)?a.toLocaleString():"."!==b.decimalSep&&this.isFloat(a)?a.toString().replace(".",b.decimalSep):"string"==typeof a?(a=a.replace(/"/g,'""'),(b.quoteStrings||a.indexOf(",")>-1||a.indexOf("\n")>-1||a.indexOf("\r")>-1)&&(a=b.txtDelim+a+b.txtDelim),a):"boolean"==typeof a?a?"TRUE":"FALSE":a},this.isFloat=function(a){return+a===a&&(!isFinite(a)||Boolean(a%1))},this.stringify=function(d,e){var f=a.defer(),g=this,h="",i="",j=a.when(d).then(function(a){if(angular.isDefined(e.header)&&e.header){var d,j;d=[],angular.forEach(e.header,function(a){this.push(g.stringifyField(a,e))},d),j=d.join(e.fieldSep?e.fieldSep:","),i+=j+b}var k=[];if(angular.isArray(a)?k=a:angular.isFunction(a)&&(k=a()),angular.isDefined(e.label)&&e.label&&"boolean"==typeof e.label){var l,m;l=[],angular.forEach(k[0],function(a,b){this.push(g.stringifyField(b,e))},l),m=l.join(e.fieldSep?e.fieldSep:","),i+=m+b}angular.forEach(k,function(a,c){var d,f,h=angular.copy(k[c]);f=[];var j=e.columnOrder?e.columnOrder:h;angular.forEach(j,function(a){var b=e.columnOrder?h[a]:a;this.push(g.stringifyField(b,e))},f),d=f.join(e.fieldSep?e.fieldSep:","),i+=c
    '),h=angular.element(g.children()[0]);h.attr("href",a.URL.createObjectURL(d)),h.attr("download",b.getFilename()),h.attr("target","_blank"),e.find("body").append(g),f(function(){h[0].click(),h.remove()},null)}}c.bind("click",function(){b.buildCSV().then(function(){d()}),b.$apply()})}}}])}(window,document),function(angular){"use strict";if(!angular)throw"Missing something? Please add angular.js to your project or move this script below the angular.js reference";var directiveId="ngRemoteValidate",remoteValidate=function($http,$timeout,$q){return{restrict:"A",require:["^form","ngModel"],scope:{ngRemoteInterceptors:"=?"},link:function(scope,el,attrs,ctrls){var cache={},handleChange,setValidation,addToCache,request,shouldProcess,ngForm=ctrls[0],ngModel=ctrls[1],options={ngRemoteThrottle:400,ngRemoteMethod:"POST"};angular.extend(options,attrs),"["===options.ngRemoteValidate.charAt(0)?options.urls=eval(options.ngRemoteValidate):"{"===options.ngRemoteValidate.charAt(0)?(options.keys=eval("("+options.ngRemoteValidate+")"),options.urls=Object.keys(options.keys)):options.urls=[options.ngRemoteValidate],addToCache=function(a){var b=a[0].data.value;return cache[b]?cache[b]:void(cache[b]=a)},shouldProcess=function(a){var b=!1;for(var c in ngModel.$error){var d=!options.hasOwnProperty("keys")||!Object.keys(options.keys).filter(function(a){return options.keys[a]===c})[0];if(ngModel.$error[c]&&c!=directiveId&&d){b=!0;break}}return!(ngModel.$pristine||b)},setValidation=function(a,b){for(var c=0,d=a.length,e=options.hasOwnProperty("keys"),f=!0;d>c&&(scope.ngRemoteInterceptors&&scope.ngRemoteInterceptors.response&&(a[c]=scope.ngRemoteInterceptors.response(a[c])),a[c].data.isValid||(f=!1,e));c++){var g=e&&a[c].hasOwnProperty("config")&&options.keys[a[c].config.url];if(g){var h=options.keys[a[c].config.url];ngModel.$setValidity(h,a[c].data.isValid)}}b||addToCache(a),ngModel.$setValidity(directiveId,f),ngModel.$processing=ngModel.$pending=ngForm.$pending=!1},handleChange=function(a){return"undefined"==typeof a||""===a?void ngModel.$setPristine():shouldProcess(a)?cache[a]?setValidation(cache[a],!0):(ngModel.$pending||(ngModel.$processing=ngModel.$pending=ngForm.$pending=!0),request&&$timeout.cancel(request),request=$timeout(function(){var b=[],c=0,d=options.urls.length,e={value:a},f={method:options.ngRemoteMethod};for(scope[el[0].name+"SetArgs"]&&(e=scope[el[0].name+"SetArgs"](a,el,attrs,ngModel)),"POST"==options.ngRemoteMethod?f.data=e:f.params=e;d>c;c++)f.url=options.urls[c],scope.ngRemoteInterceptors&&scope.ngRemoteInterceptors.request&&(f=scope.ngRemoteInterceptors.request(f)),b.push($http(f));$q.all(b).then(setValidation)},options.ngRemoteThrottle),!0):setValidation([{data:{isValid:!0,value:a}}],!0)},scope.$watch(function(){return ngModel.$viewValue},handleChange)}}};angular.module("remoteValidation",[]).constant("MODULE_VERSION","0.6.1").directive(directiveId,["$http","$timeout","$q",remoteValidate])}(this.angular),function(a){"function"==typeof define&&define.amd?define(["jquery"],a):"object"==typeof exports?module.exports=a:a(jQuery)}(function(a){function b(b){var g=b||window.event,h=i.call(arguments,1),j=0,l=0,m=0,n=0,o=0,p=0;if(b=a.event.fix(g),b.type="mousewheel","detail"in g&&(m=-1*g.detail),"wheelDelta"in g&&(m=g.wheelDelta),"wheelDeltaY"in g&&(m=g.wheelDeltaY),"wheelDeltaX"in g&&(l=-1*g.wheelDeltaX),"axis"in g&&g.axis===g.HORIZONTAL_AXIS&&(l=-1*m,m=0),j=0===m?l:m,"deltaY"in g&&(m=-1*g.deltaY,j=m),"deltaX"in g&&(l=g.deltaX,0===m&&(j=-1*l)),0!==m||0!==l){if(1===g.deltaMode){var q=a.data(this,"mousewheel-line-height");j*=q,m*=q,l*=q}else if(2===g.deltaMode){var r=a.data(this,"mousewheel-page-height");j*=r,m*=r,l*=r}if(n=Math.max(Math.abs(m),Math.abs(l)),(!f||f>n)&&(f=n,d(g,n)&&(f/=40)),d(g,n)&&(j/=40,l/=40,m/=40),j=Math[j>=1?"floor":"ceil"](j/f),l=Math[l>=1?"floor":"ceil"](l/f),m=Math[m>=1?"floor":"ceil"](m/f),k.settings.normalizeOffset&&this.getBoundingClientRect){var s=this.getBoundingClientRect();o=b.clientX-s.left,p=b.clientY-s.top}return b.deltaX=l,b.deltaY=m,b.deltaFactor=f,b.offsetX=o,b.offsetY=p,b.deltaMode=0,h.unshift(b,j,l,m),e&&clearTimeout(e),e=setTimeout(c,200),(a.event.dispatch||a.event.handle).apply(this,h)}}function c(){f=null}function d(a,b){return k.settings.adjustOldDeltas&&"mousewheel"===a.type&&b%120===0}var e,f,g=["wheel","mousewheel","DOMMouseScroll","MozMousePixelScroll"],h="onwheel"in document||document.documentMode>=9?["wheel"]:["mousewheel","DomMouseScroll","MozMousePixelScroll"],i=Array.prototype.slice;if(a.event.fixHooks)for(var j=g.length;j;)a.event.fixHooks[g[--j]]=a.event.mouseHooks;var k=a.event.special.mousewheel={version:"3.1.12",setup:function(){if(this.addEventListener)for(var c=h.length;c;)this.addEventListener(h[--c],b,!1);else this.onmousewheel=b;a.data(this,"mousewheel-line-height",k.getLineHeight(this)),a.data(this,"mousewheel-page-height",k.getPageHeight(this))},teardown:function(){if(this.removeEventListener)for(var c=h.length;c;)this.removeEventListener(h[--c],b,!1);else this.onmousewheel=null;a.removeData(this,"mousewheel-line-height"),a.removeData(this,"mousewheel-page-height")},getLineHeight:function(b){var c=a(b),d=c["offsetParent"in a.fn?"offsetParent":"parent"]();return d.length||(d=a("body")),parseInt(d.css("fontSize"),10)||parseInt(c.css("fontSize"),10)||16},getPageHeight:function(b){return a(b).height()},settings:{adjustOldDeltas:!0,normalizeOffset:!0}};a.fn.extend({mousewheel:function(a){return a?this.bind("mousewheel",a):this.trigger("mousewheel")},unmousewheel:function(a){return this.unbind("mousewheel",a)}})}),function(a){"undefined"!=typeof module&&module.exports?module.exports=a:a(jQuery,window,document)}(function(a){!function(b){var c="function"==typeof define&&define.amd,d="undefined"!=typeof module&&module.exports,e="https:"==document.location.protocol?"https:":"http:",f="cdnjs.cloudflare.com/ajax/libs/jquery-mousewheel/3.1.13/jquery.mousewheel.min.js";c||(d?require("jquery-mousewheel")(a):a.event.special.mousewheel||a("head").append(decodeURI("%3Cscript src="+e+"//"+f+"%3E%3C/script%3E"))),b()}(function(){var b,c="mCustomScrollbar",d="mCS",e=".mCustomScrollbar",f={setTop:0,setLeft:0,axis:"y",scrollbarPosition:"inside",scrollInertia:950,autoDraggerLength:!0,alwaysShowScrollbar:0,snapOffset:0,mouseWheel:{enable:!0,scrollAmount:"auto",axis:"y",deltaFactor:"auto",disableOver:["select","option","keygen","datalist","textarea"]},scrollButtons:{scrollType:"stepless",scrollAmount:"auto"},keyboard:{enable:!0,scrollType:"stepless",scrollAmount:"auto"},contentTouchScroll:25,documentTouchScroll:!0,advanced:{autoScrollOnFocus:"input,textarea,select,button,datalist,keygen,a[tabindex],area,object,[contenteditable='true']",updateOnContentResize:!0,updateOnImageLoad:"auto",autoUpdateTimeout:60},theme:"light",callbacks:{onTotalScrollOffset:0,onTotalScrollBackOffset:0,alwaysTriggerOffsets:!0}},g=0,h={},i=window.attachEvent&&!window.addEventListener?1:0,j=!1,k=["mCSB_dragger_onDrag","mCSB_scrollTools_onDrag","mCS_img_loaded","mCS_disabled","mCS_destroyed","mCS_no_scrollbar","mCS-autoHide","mCS-dir-rtl","mCS_no_scrollbar_y","mCS_no_scrollbar_x","mCS_y_hidden","mCS_x_hidden","mCSB_draggerContainer","mCSB_buttonUp","mCSB_buttonDown","mCSB_buttonLeft","mCSB_buttonRight"],l={init:function(b){var b=a.extend(!0,{},f,b),c=m.call(this);if(b.live){var i=b.liveSelector||this.selector||e,j=a(i);if("off"===b.live)return void o(i);h[i]=setTimeout(function(){j.mCustomScrollbar(b),"once"===b.live&&j.length&&o(i)},500)}else o(i);return b.setWidth=b.set_width?b.set_width:b.setWidth,b.setHeight=b.set_height?b.set_height:b.setHeight,b.axis=b.horizontalScroll?"x":p(b.axis),b.scrollInertia=b.scrollInertia>0&&b.scrollInertia<17?17:b.scrollInertia,"object"!=typeof b.mouseWheel&&1==b.mouseWheel&&(b.mouseWheel={enable:!0,scrollAmount:"auto",axis:"y",preventDefault:!1,deltaFactor:"auto",normalizeDelta:!1,invert:!1}),b.mouseWheel.scrollAmount=b.mouseWheelPixels?b.mouseWheelPixels:b.mouseWheel.scrollAmount,b.mouseWheel.normalizeDelta=b.advanced.normalizeMouseWheelDelta?b.advanced.normalizeMouseWheelDelta:b.mouseWheel.normalizeDelta,b.scrollButtons.scrollType=q(b.scrollButtons.scrollType),n(b),a(c).each(function(){var c=a(this);if(!c.data(d)){c.data(d,{idx:++g,opt:b,scrollRatio:{y:null,x:null},overflowed:null,contentReset:{y:null,x:null},bindEvents:!1,tweenRunning:!1,sequential:{},langDir:c.css("direction"),cbOffsets:null,trigger:null,poll:{size:{o:0,n:0},img:{o:0,n:0},change:{o:0,n:0}}});var e=c.data(d),f=e.opt,h=c.data("mcs-axis"),i=c.data("mcs-scrollbar-position"),j=c.data("mcs-theme");h&&(f.axis=h),i&&(f.scrollbarPosition=i),j&&(f.theme=j,n(f)),r.call(this),e&&f.callbacks.onCreate&&"function"==typeof f.callbacks.onCreate&&f.callbacks.onCreate.call(this),a("#mCSB_"+e.idx+"_container img:not(."+k[2]+")").addClass(k[2]),l.update.call(null,c)}})},update:function(b,c){var e=b||m.call(this);return a(e).each(function(){var b=a(this);if(b.data(d)){var e=b.data(d),f=e.opt,g=a("#mCSB_"+e.idx+"_container"),h=a("#mCSB_"+e.idx),i=[a("#mCSB_"+e.idx+"_dragger_vertical"),a("#mCSB_"+e.idx+"_dragger_horizontal")];if(!g.length)return;e.tweenRunning&&U(b),c&&e&&f.callbacks.onBeforeUpdate&&"function"==typeof f.callbacks.onBeforeUpdate&&f.callbacks.onBeforeUpdate.call(this),b.hasClass(k[3])&&b.removeClass(k[3]),b.hasClass(k[4])&&b.removeClass(k[4]),h.css("max-height","none"),h.height()!==b.height()&&h.css("max-height",b.height()),t.call(this),"y"===f.axis||f.advanced.autoExpandHorizontalScroll||g.css("width",s(g)),e.overflowed=y.call(this),C.call(this),f.autoDraggerLength&&v.call(this),w.call(this),A.call(this);var j=[Math.abs(g[0].offsetTop),Math.abs(g[0].offsetLeft)];"x"!==f.axis&&(e.overflowed[0]?i[0].height()>i[0].parent().height()?z.call(this):(V(b,j[0].toString(),{dir:"y",dur:0,overwrite:"none"}),e.contentReset.y=null):(z.call(this),"y"===f.axis?B.call(this):"yx"===f.axis&&e.overflowed[1]&&V(b,j[1].toString(),{dir:"x",dur:0,overwrite:"none"}))),"y"!==f.axis&&(e.overflowed[1]?i[1].width()>i[1].parent().width()?z.call(this):(V(b,j[1].toString(),{dir:"x",dur:0,overwrite:"none"}),e.contentReset.x=null):(z.call(this),"x"===f.axis?B.call(this):"yx"===f.axis&&e.overflowed[0]&&V(b,j[0].toString(),{dir:"y",dur:0,overwrite:"none"}))),c&&e&&(2===c&&f.callbacks.onImageLoad&&"function"==typeof f.callbacks.onImageLoad?f.callbacks.onImageLoad.call(this):3===c&&f.callbacks.onSelectorChange&&"function"==typeof f.callbacks.onSelectorChange?f.callbacks.onSelectorChange.call(this):f.callbacks.onUpdate&&"function"==typeof f.callbacks.onUpdate&&f.callbacks.onUpdate.call(this)),S.call(this)}})},scrollTo:function(b,c){if("undefined"!=typeof b&&null!=b){var e=m.call(this);return a(e).each(function(){var e=a(this);if(e.data(d)){var f=e.data(d),g=f.opt,h={trigger:"external",scrollInertia:g.scrollInertia,scrollEasing:"mcsEaseInOut",moveDragger:!1,timeout:60,callbacks:!0,onStart:!0,onUpdate:!0,onComplete:!0},i=a.extend(!0,{},h,c),j=Q.call(this,b),k=i.scrollInertia>0&&i.scrollInertia<17?17:i.scrollInertia;j[0]=R.call(this,j[0],"y"),j[1]=R.call(this,j[1],"x"),i.moveDragger&&(j[0]*=f.scrollRatio.y,j[1]*=f.scrollRatio.x),i.dur=ca()?0:k,setTimeout(function(){null!==j[0]&&"undefined"!=typeof j[0]&&"x"!==g.axis&&f.overflowed[0]&&(i.dir="y",i.overwrite="all",V(e,j[0].toString(),i)),null!==j[1]&&"undefined"!=typeof j[1]&&"y"!==g.axis&&f.overflowed[1]&&(i.dir="x",i.overwrite="none",V(e,j[1].toString(),i))},i.timeout)}})}},stop:function(){var b=m.call(this);return a(b).each(function(){var b=a(this);b.data(d)&&U(b)})},disable:function(b){var c=m.call(this);return a(c).each(function(){var c=a(this);if(c.data(d)){c.data(d);S.call(this,"remove"),B.call(this),b&&z.call(this),C.call(this,!0),c.addClass(k[3])}})},destroy:function(){var b=m.call(this);return a(b).each(function(){var e=a(this);if(e.data(d)){var f=e.data(d),g=f.opt,h=a("#mCSB_"+f.idx),i=a("#mCSB_"+f.idx+"_container"),j=a(".mCSB_"+f.idx+"_scrollbar");g.live&&o(g.liveSelector||a(b).selector),S.call(this,"remove"),B.call(this),z.call(this),e.removeData(d),Z(this,"mcs"),j.remove(),i.find("img."+k[2]).removeClass(k[2]),h.replaceWith(i.contents()),e.removeClass(c+" _"+d+"_"+f.idx+" "+k[6]+" "+k[7]+" "+k[5]+" "+k[3]).addClass(k[4])}})}},m=function(){return"object"!=typeof a(this)||a(this).length<1?e:this},n=function(b){var c=["rounded","rounded-dark","rounded-dots","rounded-dots-dark"],d=["rounded-dots","rounded-dots-dark","3d","3d-dark","3d-thick","3d-thick-dark","inset","inset-dark","inset-2","inset-2-dark","inset-3","inset-3-dark"],e=["minimal","minimal-dark"],f=["minimal","minimal-dark"],g=["minimal","minimal-dark"];b.autoDraggerLength=a.inArray(b.theme,c)>-1?!1:b.autoDraggerLength,b.autoExpandScrollbar=a.inArray(b.theme,d)>-1?!1:b.autoExpandScrollbar,b.scrollButtons.enable=a.inArray(b.theme,e)>-1?!1:b.scrollButtons.enable,b.autoHideScrollbar=a.inArray(b.theme,f)>-1?!0:b.autoHideScrollbar,b.scrollbarPosition=a.inArray(b.theme,g)>-1?"outside":b.scrollbarPosition},o=function(a){h[a]&&(clearTimeout(h[a]),Z(h,a))},p=function(a){return"yx"===a||"xy"===a||"auto"===a?"yx":"x"===a||"horizontal"===a?"x":"y"},q=function(a){return"stepped"===a||"pixels"===a||"step"===a||"click"===a?"stepped":"stepless"},r=function(){var b=a(this),e=b.data(d),f=e.opt,g=f.autoExpandScrollbar?" "+k[1]+"_expand":"",h=["
    ","
    "],i="yx"===f.axis?"mCSB_vertical_horizontal":"x"===f.axis?"mCSB_horizontal":"mCSB_vertical",j="yx"===f.axis?h[0]+h[1]:"x"===f.axis?h[1]:h[0],l="yx"===f.axis?"
    ":"",m=f.autoHideScrollbar?" "+k[6]:"",n="x"!==f.axis&&"rtl"===e.langDir?" "+k[7]:"";f.setWidth&&b.css("width",f.setWidth),f.setHeight&&b.css("height",f.setHeight),f.setLeft="y"!==f.axis&&"rtl"===e.langDir?"989999px":f.setLeft,b.addClass(c+" _"+d+"_"+e.idx+m+n).wrapInner("
    ");var o=a("#mCSB_"+e.idx),p=a("#mCSB_"+e.idx+"_container");"y"===f.axis||f.advanced.autoExpandHorizontalScroll||p.css("width",s(p)),"outside"===f.scrollbarPosition?("static"===b.css("position")&&b.css("position","relative"),b.css("overflow","visible"),o.addClass("mCSB_outside").after(j)):(o.addClass("mCSB_inside").append(j),p.wrap(l)),u.call(this);var q=[a("#mCSB_"+e.idx+"_dragger_vertical"),a("#mCSB_"+e.idx+"_dragger_horizontal")];q[0].css("min-height",q[0].height()),q[1].css("min-width",q[1].width())},s=function(b){var c=[b[0].scrollWidth,Math.max.apply(Math,b.children().map(function(){return a(this).outerWidth(!0)}).get())],d=b.parent().width();return c[0]>d?c[0]:c[1]>d?c[1]:"100%"},t=function(){var b=a(this),c=b.data(d),e=c.opt,f=a("#mCSB_"+c.idx+"_container");if(e.advanced.autoExpandHorizontalScroll&&"y"!==e.axis){f.css({width:"auto","min-width":0,"overflow-x":"scroll"});var g=Math.ceil(f[0].scrollWidth);3===e.advanced.autoExpandHorizontalScroll||2!==e.advanced.autoExpandHorizontalScroll&&g>f.parent().width()?f.css({width:g,"min-width":"100%","overflow-x":"inherit"}):f.css({"overflow-x":"inherit",position:"absolute"}).wrap("
    ").css({width:Math.ceil(f[0].getBoundingClientRect().right+.4)-Math.floor(f[0].getBoundingClientRect().left),"min-width":"100%",position:"relative"}).unwrap()}},u=function(){var b=a(this),c=b.data(d),e=c.opt,f=a(".mCSB_"+c.idx+"_scrollbar:first"),g=aa(e.scrollButtons.tabindex)?"tabindex='"+e.scrollButtons.tabindex+"'":"",h=["","","",""],i=["x"===e.axis?h[2]:h[0],"x"===e.axis?h[3]:h[1],h[2],h[3]];e.scrollButtons.enable&&f.prepend(i[0]).append(i[1]).next(".mCSB_scrollTools").prepend(i[2]).append(i[3])},v=function(){var b=a(this),c=b.data(d),e=a("#mCSB_"+c.idx),f=a("#mCSB_"+c.idx+"_container"),g=[a("#mCSB_"+c.idx+"_dragger_vertical"),a("#mCSB_"+c.idx+"_dragger_horizontal")],h=[e.height()/f.outerHeight(!1),e.width()/f.outerWidth(!1)],j=[parseInt(g[0].css("min-height")),Math.round(h[0]*g[0].parent().height()),parseInt(g[1].css("min-width")),Math.round(h[1]*g[1].parent().width())],k=i&&j[1]g&&(g=i),j>h&&(h=j),[g>e.height(),h>e.width()]},z=function(){var b=a(this),c=b.data(d),e=c.opt,f=a("#mCSB_"+c.idx),g=a("#mCSB_"+c.idx+"_container"),h=[a("#mCSB_"+c.idx+"_dragger_vertical"),a("#mCSB_"+c.idx+"_dragger_horizontal")];if(U(b),("x"!==e.axis&&!c.overflowed[0]||"y"===e.axis&&c.overflowed[0])&&(h[0].add(g).css("top",0),V(b,"_resetY")),"y"!==e.axis&&!c.overflowed[1]||"x"===e.axis&&c.overflowed[1]){var i=dx=0;"rtl"===c.langDir&&(i=f.width()-g.outerWidth(!1),dx=Math.abs(i/c.scrollRatio.x)),g.css("left",i),h[1].css("left",dx),V(b,"_resetX")}},A=function(){function b(){g=setTimeout(function(){a.event.special.mousewheel?(clearTimeout(g),H.call(c[0])):b()},100)}var c=a(this),e=c.data(d),f=e.opt;if(!e.bindEvents){if(E.call(this),f.contentTouchScroll&&F.call(this),G.call(this),f.mouseWheel.enable){var g;b()}K.call(this),M.call(this),f.advanced.autoScrollOnFocus&&L.call(this),f.scrollButtons.enable&&N.call(this),f.keyboard.enable&&O.call(this),e.bindEvents=!0}},B=function(){var b=a(this),c=b.data(d),e=c.opt,f=d+"_"+c.idx,g=".mCSB_"+c.idx+"_scrollbar",h=a("#mCSB_"+c.idx+",#mCSB_"+c.idx+"_container,#mCSB_"+c.idx+"_container_wrapper,"+g+" ."+k[12]+",#mCSB_"+c.idx+"_dragger_vertical,#mCSB_"+c.idx+"_dragger_horizontal,"+g+">a"),i=a("#mCSB_"+c.idx+"_container");e.advanced.releaseDraggableSelectors&&h.add(a(e.advanced.releaseDraggableSelectors)),e.advanced.extraDraggableSelectors&&h.add(a(e.advanced.extraDraggableSelectors)),c.bindEvents&&(a(document).add(a(!I()||top.document)).unbind("."+f),h.each(function(){a(this).unbind("."+f)}),clearTimeout(b[0]._focusTimeout),Z(b[0],"_focusTimeout"),clearTimeout(c.sequential.step),Z(c.sequential,"step"),clearTimeout(i[0].onCompleteTimeout),Z(i[0],"onCompleteTimeout"),c.bindEvents=!1)},C=function(b){var c=a(this),e=c.data(d),f=e.opt,g=a("#mCSB_"+e.idx+"_container_wrapper"),h=g.length?g:a("#mCSB_"+e.idx+"_container"),i=[a("#mCSB_"+e.idx+"_scrollbar_vertical"),a("#mCSB_"+e.idx+"_scrollbar_horizontal")],j=[i[0].find(".mCSB_dragger"),i[1].find(".mCSB_dragger")];"x"!==f.axis&&(e.overflowed[0]&&!b?(i[0].add(j[0]).add(i[0].children("a")).css("display","block"),h.removeClass(k[8]+" "+k[10])):(f.alwaysShowScrollbar?(2!==f.alwaysShowScrollbar&&j[0].css("display","none"),h.removeClass(k[10])):(i[0].css("display","none"), +h.addClass(k[10])),h.addClass(k[8]))),"y"!==f.axis&&(e.overflowed[1]&&!b?(i[1].add(j[1]).add(i[1].children("a")).css("display","block"),h.removeClass(k[9]+" "+k[11])):(f.alwaysShowScrollbar?(2!==f.alwaysShowScrollbar&&j[1].css("display","none"),h.removeClass(k[11])):(i[1].css("display","none"),h.addClass(k[11])),h.addClass(k[9]))),e.overflowed[0]||e.overflowed[1]?c.removeClass(k[5]):c.addClass(k[5])},D=function(b){var c=b.type,d=b.target.ownerDocument!==document?[a(frameElement).offset().top,a(frameElement).offset().left]:null,e=I()&&b.target.ownerDocument!==top.document?[a(b.view.frameElement).offset().top,a(b.view.frameElement).offset().left]:[0,0];switch(c){case"pointerdown":case"MSPointerDown":case"pointermove":case"MSPointerMove":case"pointerup":case"MSPointerUp":return d?[b.originalEvent.pageY-d[0]+e[0],b.originalEvent.pageX-d[1]+e[1],!1]:[b.originalEvent.pageY,b.originalEvent.pageX,!1];case"touchstart":case"touchmove":case"touchend":var f=b.originalEvent.touches[0]||b.originalEvent.changedTouches[0],g=b.originalEvent.touches.length||b.originalEvent.changedTouches.length;return b.target.ownerDocument!==document?[f.screenY,f.screenX,g>1]:[f.pageY,f.pageX,g>1];default:return d?[b.pageY-d[0]+e[0],b.pageX-d[1]+e[1],!1]:[b.pageY,b.pageX,!1]}},E=function(){function b(a){var b=o.find("iframe");if(b.length){var c=a?"auto":"none";b.css("pointer-events",c)}}function c(a,b,c,d){if(o[0].idleTimer=l.scrollInertia<233?250:0,e.attr("id")===n[1])var f="x",g=(e[0].offsetLeft-b+d)*k.scrollRatio.x;else var f="y",g=(e[0].offsetTop-a+c)*k.scrollRatio.y;V(h,g.toString(),{dir:f,drag:!0})}var e,f,g,h=a(this),k=h.data(d),l=k.opt,m=d+"_"+k.idx,n=["mCSB_"+k.idx+"_dragger_vertical","mCSB_"+k.idx+"_dragger_horizontal"],o=a("#mCSB_"+k.idx+"_container"),p=a("#"+n[0]+",#"+n[1]),q=l.advanced.releaseDraggableSelectors?p.add(a(l.advanced.releaseDraggableSelectors)):p,r=l.advanced.extraDraggableSelectors?a(!I()||top.document).add(a(l.advanced.extraDraggableSelectors)):a(!I()||top.document);p.bind("mousedown."+m+" touchstart."+m+" pointerdown."+m+" MSPointerDown."+m,function(c){if(c.stopImmediatePropagation(),c.preventDefault(),$(c)){j=!0,i&&(document.onselectstart=function(){return!1}),b(!1),U(h),e=a(this);var d=e.offset(),k=D(c)[0]-d.top,m=D(c)[1]-d.left,n=e.height()+d.top,o=e.width()+d.left;n>k&&k>0&&o>m&&m>0&&(f=k,g=m),x(e,"active",l.autoExpandScrollbar)}}).bind("touchmove."+m,function(a){a.stopImmediatePropagation(),a.preventDefault();var b=e.offset(),d=D(a)[0]-b.top,h=D(a)[1]-b.left;c(f,g,d,h)}),a(document).add(r).bind("mousemove."+m+" pointermove."+m+" MSPointerMove."+m,function(a){if(e){var b=e.offset(),d=D(a)[0]-b.top,h=D(a)[1]-b.left;if(f===d&&g===h)return;c(f,g,d,h)}}).add(q).bind("mouseup."+m+" touchend."+m+" pointerup."+m+" MSPointerUp."+m,function(a){e&&(x(e,"active",l.autoExpandScrollbar),e=null),j=!1,i&&(document.onselectstart=null),b(!0)})},F=function(){function c(a){if(!_(a)||j||D(a)[2])return void(b=0);b=1,w=0,x=0,k=1,y.removeClass("mCS_touch_action");var c=E.offset();l=D(a)[0]-c.top,m=D(a)[1]-c.left,L=[D(a)[0],D(a)[1]]}function e(a){if(_(a)&&!j&&!D(a)[2]&&(A.documentTouchScroll||a.preventDefault(),a.stopImmediatePropagation(),(!x||w)&&k)){q=X();var b=C.offset(),c=D(a)[0]-b.top,d=D(a)[1]-b.left,e="mcsLinearOut";if(G.push(c),H.push(d),L[2]=Math.abs(D(a)[0]-L[0]),L[3]=Math.abs(D(a)[1]-L[1]),z.overflowed[0])var f=F[0].parent().height()-F[0].height(),g=l-c>0&&c-l>-(f*z.scrollRatio.y)&&(2*L[3]0&&d-m>-(h*z.scrollRatio.x)&&(2*L[2]30)){t=1e3/(r-p);var e="mcsEaseOut",f=2.5>t,g=f?[G[G.length-2],H[H.length-2]]:[0,0];s=f?[c-g[0],d-g[1]]:[c-n,d-o];var l=[Math.abs(s[0]),Math.abs(s[1])];t=f?[Math.abs(s[0]/4),Math.abs(s[1]/4)]:[t,t];var m=[Math.abs(E[0].offsetTop)-s[0]*h(l[0]/t[0],t[0]),Math.abs(E[0].offsetLeft)-s[1]*h(l[1]/t[1],t[1])];u="yx"===A.axis?[m[0],m[1]]:"x"===A.axis?[null,m[1]]:[m[0],null],v=[4*l[0]+A.scrollInertia,4*l[1]+A.scrollInertia];var y=parseInt(A.contentTouchScroll)||0;u[0]=l[0]>y?u[0]:0,u[1]=l[1]>y?u[1]:0,z.overflowed[0]&&i(u[0],v[0],e,"y",K,!1),z.overflowed[1]&&i(u[1],v[1],e,"x",K,!1)}}}function h(a,b){var c=[1.5*b,2*b,b/1.5,b/2];return a>90?b>4?c[0]:c[3]:a>60?b>3?c[3]:c[2]:a>30?b>8?c[1]:b>6?c[0]:b>4?b:c[2]:b>8?b:c[3]}function i(a,b,c,d,e,f){a&&V(y,a.toString(),{dur:b,scrollEasing:c,dir:d,overwrite:e,drag:f})}var k,l,m,n,o,p,q,r,s,t,u,v,w,x,y=a(this),z=y.data(d),A=z.opt,B=d+"_"+z.idx,C=a("#mCSB_"+z.idx),E=a("#mCSB_"+z.idx+"_container"),F=[a("#mCSB_"+z.idx+"_dragger_vertical"),a("#mCSB_"+z.idx+"_dragger_horizontal")],G=[],H=[],J=0,K="yx"===A.axis?"none":"all",L=[],M=E.find("iframe"),N=["touchstart."+B+" pointerdown."+B+" MSPointerDown."+B,"touchmove."+B+" pointermove."+B+" MSPointerMove."+B,"touchend."+B+" pointerup."+B+" MSPointerUp."+B],O=void 0!==document.body.style.touchAction;E.bind(N[0],function(a){c(a)}).bind(N[1],function(a){e(a)}),C.bind(N[0],function(a){f(a)}).bind(N[2],function(a){g(a)}),M.length&&M.each(function(){a(this).load(function(){I(this)&&a(this.contentDocument||this.contentWindow.document).bind(N[0],function(a){c(a),f(a)}).bind(N[1],function(a){e(a)}).bind(N[2],function(a){g(a)})})})},G=function(){function c(){return window.getSelection?window.getSelection().toString():document.selection&&"Control"!=document.selection.type?document.selection.createRange().text:0}function e(a,b,c){k.type=c&&f?"stepped":"stepless",k.scrollAmount=10,P(g,a,b,"mcsLinearOut",c?60:null)}var f,g=a(this),h=g.data(d),i=h.opt,k=h.sequential,l=d+"_"+h.idx,m=a("#mCSB_"+h.idx+"_container"),n=m.parent();m.bind("mousedown."+l,function(a){b||f||(f=1,j=!0)}).add(document).bind("mousemove."+l,function(a){if(!b&&f&&c()){var d=m.offset(),g=D(a)[0]-d.top+m[0].offsetTop,j=D(a)[1]-d.left+m[0].offsetLeft;g>0&&g0&&jg?e("on",38):g>n.height()&&e("on",40)),"y"!==i.axis&&h.overflowed[1]&&(0>j?e("on",37):j>n.width()&&e("on",39)))}}).bind("mouseup."+l+" dragend."+l,function(a){b||(f&&(f=0,e("off",null)),j=!1)})},H=function(){function b(b,d){if(U(c),!J(c,b.target)){var g="auto"!==f.mouseWheel.deltaFactor?parseInt(f.mouseWheel.deltaFactor):i&&b.deltaFactor<100?100:b.deltaFactor||100,k=f.scrollInertia;if("x"===f.axis||"x"===f.mouseWheel.axis)var l="x",m=[Math.round(g*e.scrollRatio.x),parseInt(f.mouseWheel.scrollAmount)],n="auto"!==f.mouseWheel.scrollAmount?m[1]:m[0]>=h.width()?.9*h.width():m[0],o=Math.abs(a("#mCSB_"+e.idx+"_container")[0].offsetLeft),p=j[1][0].offsetLeft,q=j[1].parent().width()-j[1].width(),r=b.deltaX||b.deltaY||d;else var l="y",m=[Math.round(g*e.scrollRatio.y),parseInt(f.mouseWheel.scrollAmount)],n="auto"!==f.mouseWheel.scrollAmount?m[1]:m[0]>=h.height()?.9*h.height():m[0],o=Math.abs(a("#mCSB_"+e.idx+"_container")[0].offsetTop),p=j[0][0].offsetTop,q=j[0].parent().height()-j[0].height(),r=b.deltaY||d;"y"===l&&!e.overflowed[0]||"x"===l&&!e.overflowed[1]||((f.mouseWheel.invert||b.webkitDirectionInvertedFromDevice)&&(r=-r),f.mouseWheel.normalizeDelta&&(r=0>r?-1:1),(r>0&&0!==p||0>r&&p!==q||f.mouseWheel.preventDefault)&&(b.stopImmediatePropagation(),b.preventDefault()),b.deltaFactor<2&&!f.mouseWheel.normalizeDelta&&(n=b.deltaFactor,k=17),V(c,(o-r*n).toString(),{dir:l,dur:k}))}}if(a(this).data(d)){var c=a(this),e=c.data(d),f=e.opt,g=d+"_"+e.idx,h=a("#mCSB_"+e.idx),j=[a("#mCSB_"+e.idx+"_dragger_vertical"),a("#mCSB_"+e.idx+"_dragger_horizontal")],k=a("#mCSB_"+e.idx+"_container").find("iframe");k.length&&k.each(function(){a(this).load(function(){I(this)&&a(this.contentDocument||this.contentWindow.document).bind("mousewheel."+g,function(a,c){b(a,c)})})}),h.bind("mousewheel."+g,function(a,c){b(a,c)})}},I=function(a){var b=null;if(a){try{var c=a.contentDocument||a.contentWindow.document;b=c.body.innerHTML}catch(d){}return null!==b}try{var c=top.document;b=c.body.innerHTML}catch(d){}return null!==b},J=function(b,c){var e=c.nodeName.toLowerCase(),f=b.data(d).opt.mouseWheel.disableOver,g=["select","textarea"];return a.inArray(e,f)>-1&&!(a.inArray(e,g)>-1&&!a(c).is(":focus"))},K=function(){var b,c=a(this),e=c.data(d),f=d+"_"+e.idx,g=a("#mCSB_"+e.idx+"_container"),h=g.parent(),i=a(".mCSB_"+e.idx+"_scrollbar ."+k[12]);i.bind("mousedown."+f+" touchstart."+f+" pointerdown."+f+" MSPointerDown."+f,function(c){j=!0,a(c.target).hasClass("mCSB_dragger")||(b=1)}).bind("touchend."+f+" pointerup."+f+" MSPointerUp."+f,function(a){j=!1}).bind("click."+f,function(d){if(b&&(b=0,a(d.target).hasClass(k[12])||a(d.target).hasClass("mCSB_draggerRail"))){U(c);var f=a(this),i=f.find(".mCSB_dragger");if(f.parent(".mCSB_scrollTools_horizontal").length>0){if(!e.overflowed[1])return;var j="x",l=d.pageX>i.offset().left?-1:1,m=Math.abs(g[0].offsetLeft)-l*(.9*h.width())}else{if(!e.overflowed[0])return;var j="y",l=d.pageY>i.offset().top?-1:1,m=Math.abs(g[0].offsetTop)-l*(.9*h.height())}V(c,m.toString(),{dir:j,scrollEasing:"mcsEaseInOut"})}})},L=function(){var b=a(this),c=b.data(d),e=c.opt,f=d+"_"+c.idx,g=a("#mCSB_"+c.idx+"_container"),h=g.parent();g.bind("focusin."+f,function(c){var d=a(document.activeElement),f=g.find(".mCustomScrollBox").length,i=0;d.is(e.advanced.autoScrollOnFocus)&&(U(b),clearTimeout(b[0]._focusTimeout),b[0]._focusTimer=f?(i+17)*f:0,b[0]._focusTimeout=setTimeout(function(){var a=[ba(d)[0],ba(d)[1]],c=[g[0].offsetTop,g[0].offsetLeft],f=[c[0]+a[0]>=0&&c[0]+a[0]=0&&c[0]+a[1]a");i.bind("mousedown."+g+" touchstart."+g+" pointerdown."+g+" MSPointerDown."+g+" mouseup."+g+" touchend."+g+" pointerup."+g+" MSPointerUp."+g+" mouseout."+g+" pointerout."+g+" MSPointerOut."+g+" click."+g,function(d){function g(a,c){f.scrollAmount=e.scrollButtons.scrollAmount,P(b,a,c)}if(d.preventDefault(),$(d)){var h=a(this).attr("class");switch(f.type=e.scrollButtons.scrollType,d.type){case"mousedown":case"touchstart":case"pointerdown":case"MSPointerDown":if("stepped"===f.type)return;j=!0,c.tweenRunning=!1,g("on",h);break;case"mouseup":case"touchend":case"pointerup":case"MSPointerUp":case"mouseout":case"pointerout":case"MSPointerOut":if("stepped"===f.type)return;j=!1,f.dir&&g("off",h);break;case"click":if("stepped"!==f.type||c.tweenRunning)return;g("on",h)}}})},O=function(){function b(b){function d(a,b){g.type=f.keyboard.scrollType,g.scrollAmount=f.keyboard.scrollAmount,"stepped"===g.type&&e.tweenRunning||P(c,a,b)}switch(b.type){case"blur":e.tweenRunning&&g.dir&&d("off",null);break;case"keydown":case"keyup":var h=b.keyCode?b.keyCode:b.which,i="on";if("x"!==f.axis&&(38===h||40===h)||"y"!==f.axis&&(37===h||39===h)){if((38===h||40===h)&&!e.overflowed[0]||(37===h||39===h)&&!e.overflowed[1])return;"keyup"===b.type&&(i="off"),a(document.activeElement).is(l)||(b.preventDefault(),b.stopImmediatePropagation(),d(i,h))}else if(33===h||34===h){if((e.overflowed[0]||e.overflowed[1])&&(b.preventDefault(),b.stopImmediatePropagation()),"keyup"===b.type){U(c);var m=34===h?-1:1;if("x"===f.axis||"yx"===f.axis&&e.overflowed[1]&&!e.overflowed[0])var n="x",o=Math.abs(j[0].offsetLeft)-m*(.9*k.width());else var n="y",o=Math.abs(j[0].offsetTop)-m*(.9*k.height());V(c,o.toString(),{dir:n,scrollEasing:"mcsEaseInOut"})}}else if((35===h||36===h)&&!a(document.activeElement).is(l)&&((e.overflowed[0]||e.overflowed[1])&&(b.preventDefault(),b.stopImmediatePropagation()),"keyup"===b.type)){if("x"===f.axis||"yx"===f.axis&&e.overflowed[1]&&!e.overflowed[0])var n="x",o=35===h?Math.abs(k.width()-j.outerWidth(!1)):0;else var n="y",o=35===h?Math.abs(k.height()-j.outerHeight(!1)):0;V(c,o.toString(),{dir:n,scrollEasing:"mcsEaseInOut"})}}}var c=a(this),e=c.data(d),f=e.opt,g=e.sequential,h=d+"_"+e.idx,i=a("#mCSB_"+e.idx),j=a("#mCSB_"+e.idx+"_container"),k=j.parent(),l="input,textarea,select,datalist,keygen,[contenteditable='true']",m=j.find("iframe"),n=["blur."+h+" keydown."+h+" keyup."+h];m.length&&m.each(function(){a(this).load(function(){I(this)&&a(this.contentDocument||this.contentWindow.document).bind(n[0],function(a){b(a)})})}),i.attr("tabindex","0").bind(n[0],function(a){b(a)})},P=function(b,c,e,f,g){function h(a){l.snapAmount&&(m.scrollAmount=l.snapAmount instanceof Array?"x"===m.dir[0]?l.snapAmount[1]:l.snapAmount[0]:l.snapAmount);var c="stepped"!==m.type,d=g?g:a?c?p/1.5:q:1e3/60,e=a?c?7.5:40:2.5,i=[Math.abs(n[0].offsetTop),Math.abs(n[0].offsetLeft)],k=[j.scrollRatio.y>10?10:j.scrollRatio.y,j.scrollRatio.x>10?10:j.scrollRatio.x],o="x"===m.dir[0]?i[1]+m.dir[1]*(k[1]*e):i[0]+m.dir[1]*(k[0]*e),r="x"===m.dir[0]?i[1]+m.dir[1]*parseInt(m.scrollAmount):i[0]+m.dir[1]*parseInt(m.scrollAmount),s="auto"!==m.scrollAmount?r:o,t=f?f:a?c?"mcsLinearOut":"mcsEaseInOut":"mcsLinear",u=a?!0:!1;return a&&17>d&&(s="x"===m.dir[0]?i[1]:i[0]),V(b,s.toString(),{dir:m.dir[0],scrollEasing:t,dur:d,onComplete:u}),a?void(m.dir=!1):(clearTimeout(m.step),void(m.step=setTimeout(function(){h()},d)))}function i(){clearTimeout(m.step),Z(m,"step"),U(b)}var j=b.data(d),l=j.opt,m=j.sequential,n=a("#mCSB_"+j.idx+"_container"),o="stepped"===m.type?!0:!1,p=l.scrollInertia<26?26:l.scrollInertia,q=l.scrollInertia<1?17:l.scrollInertia;switch(c){case"on":if(m.dir=[e===k[16]||e===k[15]||39===e||37===e?"x":"y",e===k[13]||e===k[15]||38===e||37===e?-1:1],U(b),aa(e)&&"stepped"===m.type)return;h(o);break;case"off":i(),(o||j.tweenRunning&&m.dir)&&h(!0)}},Q=function(b){var c=a(this).data(d).opt,e=[];return"function"==typeof b&&(b=b()),b instanceof Array?e=b.length>1?[b[0],b[1]]:"x"===c.axis?[null,b[0]]:[b[0],null]:(e[0]=b.y?b.y:b.x||"x"===c.axis?null:b,e[1]=b.x?b.x:b.y||"y"===c.axis?null:b),"function"==typeof e[0]&&(e[0]=e[0]()),"function"==typeof e[1]&&(e[1]=e[1]()),e},R=function(b,c){if(null!=b&&"undefined"!=typeof b){var e=a(this),f=e.data(d),g=f.opt,h=a("#mCSB_"+f.idx+"_container"),i=h.parent(),j=typeof b;c||(c="x"===g.axis?"x":"y");var k="x"===c?h.outerWidth(!1):h.outerHeight(!1),m="x"===c?h[0].offsetLeft:h[0].offsetTop,n="x"===c?"left":"top";switch(j){case"function":return b();case"object":var o=b.jquery?b:a(b);if(!o.length)return;return"x"===c?ba(o)[1]:ba(o)[0];case"string":case"number":if(aa(b))return Math.abs(b);if(-1!==b.indexOf("%"))return Math.abs(k*parseInt(b)/100);if(-1!==b.indexOf("-="))return Math.abs(m-parseInt(b.split("-=")[1]));if(-1!==b.indexOf("+=")){var p=m+parseInt(b.split("+=")[1]);return p>=0?0:Math.abs(p)}if(-1!==b.indexOf("px")&&aa(b.split("px")[0]))return Math.abs(b.split("px")[0]);if("top"===b||"left"===b)return 0;if("bottom"===b)return Math.abs(i.height()-h.outerHeight(!1));if("right"===b)return Math.abs(i.width()-h.outerWidth(!1));if("first"===b||"last"===b){var o=h.find(":"+b);return"x"===c?ba(o)[1]:ba(o)[0]}return a(b).length?"x"===c?ba(a(b))[1]:ba(a(b))[0]:(h.css(n,b),void l.update.call(null,e[0]))}}},S=function(b){function c(){return clearTimeout(m[0].autoUpdate),0===h.parents("html").length?void(h=null):void(m[0].autoUpdate=setTimeout(function(){return j.advanced.updateOnSelectorChange&&(i.poll.change.n=f(),i.poll.change.n!==i.poll.change.o)?(i.poll.change.o=i.poll.change.n,void g(3)):j.advanced.updateOnContentResize&&(i.poll.size.n=h[0].scrollHeight+h[0].scrollWidth+m[0].offsetHeight+h[0].offsetHeight+h[0].offsetWidth,i.poll.size.n!==i.poll.size.o)?(i.poll.size.o=i.poll.size.n,void g(1)):!j.advanced.updateOnImageLoad||"auto"===j.advanced.updateOnImageLoad&&"y"===j.axis||(i.poll.img.n=m.find("img").length,i.poll.img.n===i.poll.img.o)?void((j.advanced.updateOnSelectorChange||j.advanced.updateOnContentResize||j.advanced.updateOnImageLoad)&&c()):(i.poll.img.o=i.poll.img.n,void m.find("img").each(function(){e(this)}))},j.advanced.autoUpdateTimeout))}function e(b){function c(a,b){return function(){return b.apply(a,arguments)}}function d(){this.onload=null,a(b).addClass(k[2]),g(2)}if(a(b).hasClass(k[2]))return void g();var e=new Image;e.onload=c(e,d),e.src=b.src}function f(){j.advanced.updateOnSelectorChange===!0&&(j.advanced.updateOnSelectorChange="*");var a=0,b=m.find(j.advanced.updateOnSelectorChange);return j.advanced.updateOnSelectorChange&&b.length>0&&b.each(function(){a+=this.offsetHeight+this.offsetWidth}),a}function g(a){clearTimeout(m[0].autoUpdate),l.update.call(null,h[0],a)}var h=a(this),i=h.data(d),j=i.opt,m=a("#mCSB_"+i.idx+"_container");return b?(clearTimeout(m[0].autoUpdate),void Z(m[0],"autoUpdate")):void c()},T=function(a,b,c){return Math.round(a/b)*b-c},U=function(b){var c=b.data(d),e=a("#mCSB_"+c.idx+"_container,#mCSB_"+c.idx+"_container_wrapper,#mCSB_"+c.idx+"_dragger_vertical,#mCSB_"+c.idx+"_dragger_horizontal");e.each(function(){Y.call(this)})},V=function(b,c,e){function f(a){return i&&j.callbacks[a]&&"function"==typeof j.callbacks[a]}function g(){return[j.callbacks.alwaysTriggerOffsets||u>=v[0]+y,j.callbacks.alwaysTriggerOffsets||-z>=u]}function h(){var a=[n[0].offsetTop,n[0].offsetLeft],c=[s[0].offsetTop,s[0].offsetLeft],d=[n.outerHeight(!1),n.outerWidth(!1)],f=[m.height(),m.width()];b[0].mcs={content:n,top:a[0],left:a[1],draggerTop:c[0],draggerLeft:c[1],topPct:Math.round(100*Math.abs(a[0])/(Math.abs(d[0])-f[0])),leftPct:Math.round(100*Math.abs(a[1])/(Math.abs(d[1])-f[1])),direction:e.dir}}var i=b.data(d),j=i.opt,k={trigger:"internal",dir:"y",scrollEasing:"mcsEaseOut",drag:!1,dur:j.scrollInertia,overwrite:"all",callbacks:!0,onStart:!0,onUpdate:!0,onComplete:!0},e=a.extend(k,e),l=[e.dur,e.drag?0:e.dur],m=a("#mCSB_"+i.idx),n=a("#mCSB_"+i.idx+"_container"),o=n.parent(),p=j.callbacks.onTotalScrollOffset?Q.call(b,j.callbacks.onTotalScrollOffset):[0,0],q=j.callbacks.onTotalScrollBackOffset?Q.call(b,j.callbacks.onTotalScrollBackOffset):[0,0];if(i.trigger=e.trigger,(0!==o.scrollTop()||0!==o.scrollLeft())&&(a(".mCSB_"+i.idx+"_scrollbar").css("visibility","visible"),o.scrollTop(0).scrollLeft(0)),"_resetY"!==c||i.contentReset.y||(f("onOverflowYNone")&&j.callbacks.onOverflowYNone.call(b[0]),i.contentReset.y=1),"_resetX"!==c||i.contentReset.x||(f("onOverflowXNone")&&j.callbacks.onOverflowXNone.call(b[0]),i.contentReset.x=1),"_resetY"!==c&&"_resetX"!==c){if(!i.contentReset.y&&b[0].mcs||!i.overflowed[0]||(f("onOverflowY")&&j.callbacks.onOverflowY.call(b[0]),i.contentReset.x=null),!i.contentReset.x&&b[0].mcs||!i.overflowed[1]||(f("onOverflowX")&&j.callbacks.onOverflowX.call(b[0]),i.contentReset.x=null),j.snapAmount){var r=j.snapAmount instanceof Array?"x"===e.dir?j.snapAmount[1]:j.snapAmount[0]:j.snapAmount;c=T(c,r,j.snapOffset)}switch(e.dir){case"x":var s=a("#mCSB_"+i.idx+"_dragger_horizontal"),t="left",u=n[0].offsetLeft,v=[m.width()-n.outerWidth(!1),s.parent().width()-s.width()],w=[c,0===c?0:c/i.scrollRatio.x],y=p[1],z=q[1],A=y>0?y/i.scrollRatio.x:0,B=z>0?z/i.scrollRatio.x:0;break;case"y":var s=a("#mCSB_"+i.idx+"_dragger_vertical"),t="top",u=n[0].offsetTop,v=[m.height()-n.outerHeight(!1),s.parent().height()-s.height()],w=[c,0===c?0:c/i.scrollRatio.y],y=p[0],z=q[0],A=y>0?y/i.scrollRatio.y:0,B=z>0?z/i.scrollRatio.y:0}w[1]<0||0===w[0]&&0===w[1]?w=[0,0]:w[1]>=v[1]?w=[v[0],v[1]]:w[0]=-w[0],b[0].mcs||(h(),f("onInit")&&j.callbacks.onInit.call(b[0])),clearTimeout(n[0].onCompleteTimeout),W(s[0],t,Math.round(w[1]),l[1],e.scrollEasing),(i.tweenRunning||!(0===u&&w[0]>=0||u===v[0]&&w[0]<=v[0]))&&W(n[0],t,Math.round(w[0]),l[0],e.scrollEasing,e.overwrite,{onStart:function(){e.callbacks&&e.onStart&&!i.tweenRunning&&(f("onScrollStart")&&(h(),j.callbacks.onScrollStart.call(b[0])),i.tweenRunning=!0,x(s),i.cbOffsets=g())},onUpdate:function(){e.callbacks&&e.onUpdate&&f("whileScrolling")&&(h(),j.callbacks.whileScrolling.call(b[0]))},onComplete:function(){if(e.callbacks&&e.onComplete){"yx"===j.axis&&clearTimeout(n[0].onCompleteTimeout);var a=n[0].idleTimer||0;n[0].onCompleteTimeout=setTimeout(function(){f("onScroll")&&(h(),j.callbacks.onScroll.call(b[0])),f("onTotalScroll")&&w[1]>=v[1]-A&&i.cbOffsets[0]&&(h(),j.callbacks.onTotalScroll.call(b[0])),f("onTotalScrollBack")&&w[1]<=B&&i.cbOffsets[1]&&(h(),j.callbacks.onTotalScrollBack.call(b[0])),i.tweenRunning=!1,n[0].idleTimer=0,x(s,"hide")},a)}}})}},W=function(a,b,c,d,e,f,g){function h(){v.stop||(s||o.call(),s=X()-r,i(),s>=v.time&&(v.time=s>v.time?s+m-(s-v.time):s+m-1,v.time0?(v.currVal=l(v.time,t,w,d,e),u[b]=Math.round(v.currVal)+"px"):u[b]=c+"px",p.call()}function j(){m=1e3/60,v.time=s+m,n=window.requestAnimationFrame?window.requestAnimationFrame:function(a){return i(),setTimeout(a,.01)},v.id=n(h)}function k(){null!=v.id&&(window.requestAnimationFrame?window.cancelAnimationFrame(v.id):clearTimeout(v.id),v.id=null)}function l(a,b,c,d,e){switch(e){case"linear":case"mcsLinear":return c*a/d+b;case"mcsLinearOut":return a/=d,a--,c*Math.sqrt(1-a*a)+b;case"easeInOutSmooth":return a/=d/2,1>a?c/2*a*a+b:(a--,-c/2*(a*(a-2)-1)+b);case"easeInOutStrong":return a/=d/2,1>a?c/2*Math.pow(2,10*(a-1))+b:(a--,c/2*(-Math.pow(2,-10*a)+2)+b);case"easeInOut":case"mcsEaseInOut":return a/=d/2,1>a?c/2*a*a*a+b:(a-=2,c/2*(a*a*a+2)+b);case"easeOutSmooth":return a/=d,a--,-c*(a*a*a*a-1)+b;case"easeOutStrong":return c*(-Math.pow(2,-10*a/d)+1)+b;case"easeOut":case"mcsEaseOut":default:var f=(a/=d)*a,g=f*a;return b+c*(.499999999999997*g*f+-2.5*f*f+5.5*g+-6.5*f+4*a)}}a._mTween||(a._mTween={top:{},left:{}});var m,n,g=g||{},o=g.onStart||function(){},p=g.onUpdate||function(){},q=g.onComplete||function(){},r=X(),s=0,t=a.offsetTop,u=a.style,v=a._mTween[b];"left"===b&&(t=a.offsetLeft);var w=c-t;v.stop=0,"none"!==f&&k(),j()},X=function(){return window.performance&&window.performance.now?window.performance.now():window.performance&&window.performance.webkitNow?window.performance.webkitNow():Date.now?Date.now():(new Date).getTime()},Y=function(){var a=this;a._mTween||(a._mTween={top:{},left:{}});for(var b=["top","left"],c=0;c=0&&d[0]+ba(e)[0]=0&&d[1]+ba(e)[1]
    ":"
    "},c=function(b,c,d,e,f){var g,h,i,j,k,l,m,n,o,p,q;return h=d.duration||1,q=d.timingFunction||"ease-in-out",i=c.scope(),j=d.emitOnClose,n=d.onClose,m=void 0!==d.lazyRender,g=null,o=null,k=function(a){var b,d,e,f,g;for(e=0,d=c.children(),f=0,g=d.length;g>f;f++)b=d[f],e+=b.clientHeight;return""+e+"px"},p=function(){return g&&a.cancel(g),m&&(b.lazyRender=!0),a(function(){return o&&a.cancel(o),c.css({overflow:"hidden",transitionProperty:"height",transitionDuration:""+h+"s",transitionTimingFunction:q,height:k()}),o=a(function(){return c.css({overflow:"visible",transition:"none",height:"auto"})},1e3*h)})},l=function(){return o&&a.cancel(o),c.css({overflow:"hidden",transitionProperty:"height",transitionDuration:""+h+"s",transitionTimingFunction:q,height:"0px"}),j||n||m?g=a(function(){return j&&b.$emit(j,{}),n&&i.$eval(n),m?b.lazyRender=!1:void 0},1e3*h):void 0},b.$watch("expanded",function(b,d){return b?a(p):(null!=b&&(c.css({height:k()}),c[0].clientHeight),a(l))})},{restrict:"A",scope:{expanded:"=ngSlideDown"},transclude:!0,link:c,template:function(a,c){return b(a,c)}}}])}.call(this);var mod;mod=angular.module("infinite-scroll",[]),mod.directive("infiniteScroll",["$rootScope","$window","$timeout",function(a,b,c){return{link:function(d,e,f){var g,h,i,j;return b=angular.element(b),i=0,null!=f.infiniteScrollDistance&&d.$watch(f.infiniteScrollDistance,function(a){return i=parseInt(a,10)}),j=!0,g=!1,null!=f.infiniteScrollDisabled&&d.$watch(f.infiniteScrollDisabled,function(a){return j=!a,j&&g?(g=!1,h()):void 0}),h=function(){var c,h,k,l;return l=b.height()+b.scrollTop(),c=e.offset().top+e.height(),h=c-l,k=h<=b.height()*i,k&&j?a.$$phase?d.$eval(f.infiniteScroll):d.$apply(f.infiniteScroll):k?g=!0:void 0},b.on("scroll",h),d.$on("$destroy",function(){return b.off("scroll",h)}),c(function(){return f.infiniteScrollImmediateCheck?d.$eval(f.infiniteScrollImmediateCheck)?h():void 0:h()},0)}}}]),angular.module("ngMap",[]),function(){"use strict";function camelCase(a){return a.replace(SPECIAL_CHARS_REGEXP,function(a,b,c,d){return d?c.toUpperCase():c}).replace(MOZ_HACK_REGEXP,"Moz$1")}function JSONize(a){try{return JSON.parse(a),a}catch(b){return a.replace(/([\$\w]+)\s*:/g,function(a,b){return'"'+b+'":'}).replace(/'([^']+)'/g,function(a,b){return'"'+b+'"'})}}var SPECIAL_CHARS_REGEXP=/([\:\-\_]+(.))/g,MOZ_HACK_REGEXP=/^moz([A-Z])/,Attr2Options=function($parse,$timeout,$log,NavigatorGeolocation,GeoCoder){var orgAttributes=function(a){a.length>0&&(a=a[0]);for(var b={},c=0;c-1&&b.splice(c,1),this.el.className=b.join(" ")},d.prototype.onAdd=function(){this.getPanes().overlayMouseTarget.appendChild(this.el)},d.prototype.draw=function(){this.setPosition(),this.setZIndex(this.zIndex),this.setVisible(this.visible)},d.prototype.onRemove=function(){this.el.parentNode.removeChild(this.el),this.el=null}},f=function(c,e){return function(f,g,h,i){var j=(a.orgAttributes(g),a.filter(h)),k=a.getOptions(j,f),l=a.getEvents(f,j),m=g[0].parentElement.removeChild(g[0]),n=new d(k);b(function(){f.$watch("["+e.join(",")+"]",function(a){n.setContent(c,f)}),n.setContent(m.innerHTML,f);var a=m.firstElementChild.className;n.addClass("custom-marker"),n.addClass(a),k.position instanceof google.maps.LatLng||i.getGeoLocation(k.position).then(function(a){n.setPosition(a)})});for(var o in l)google.maps.event.addDomListener(n.el,o,l[o]);i.addObject("customMarkers",n),g.bind("$destroy",function(){i.deleteObject("customMarkers",n)})}},g=function(d,g,h){return a=d,b=g,c=h,e(),{restrict:"E",require:"^map",compile:function(a){var b=a.html(),c=b.match(/{{([^}]+)}}/g),d=[];return(c||[]).forEach(function(a){var b=a.replace("{{","").replace("}}","");-1==a.indexOf("::")&&-1==a.indexOf("this.")&&-1==d.indexOf(b)&&d.push(a.replace("{{","").replace("}}",""))}),f(b,d)}}};g.$inject=["Attr2Options","$timeout","$compile"],angular.module("ngMap").directive("customMarker",g)}(),function(){"use strict";var a=function(a,b){a.panel&&(a.panel=document.getElementById(a.panel)||document.querySelector(a.panel));var c=new google.maps.DirectionsRenderer(a);for(var d in b)google.maps.event.addListener(c,d,b[d]);return c},b=function(b,c,d){var e=b,f=new google.maps.DirectionsService,g=function(a,b){var e=b;e.travelMode=e.travelMode||"DRIVING";var g=["origin","destination","travelMode","transitOptions","unitSystem","durationInTraffic","waypoints","optimizeWaypoints","provideRouteAlternatives","avoidHighways","avoidTolls","region"];for(var h in e)-1===g.indexOf(h)&&delete e[h];e.waypoints&&("[]"==e.waypoints||""==e.waypoints)&&delete e.waypoints;var i=function(b){f.route(b,function(b,d){d==google.maps.DirectionsStatus.OK&&c(function(){a.setDirections(b)})})};e.origin&&e.destination&&("current-location"==e.origin?d.getCurrentPosition().then(function(a){e.origin=new google.maps.LatLng(a.coords.latitude,a.coords.longitude),i(e)}):"current-location"==e.destination?d.getCurrentPosition().then(function(a){e.destination=new google.maps.LatLng(a.coords.latitude,a.coords.longitude),i(e)}):i(e))},h=function(b,d,f,h){var i=e.orgAttributes(d),j=e.filter(f),k=e.getOptions(j),l=e.getEvents(b,j),m=e.getAttrsToObserve(i),n=a(k,l);h.addObject("directionsRenderers",n),m.forEach(function(a){!function(a){f.$observe(a,function(b){if("panel"==a)c(function(){var a=document.getElementById(b)||document.querySelector(b);a&&n.setPanel(a)});else if(k[a]!==b){var d=e.toOptionValue(b,{key:a});k[a]=d,g(n,k)}})}(a)}),b.$on("mapInitialized",function(a,b){g(n,k)}),b.$on("$destroy",function(a,b){h.deleteObject("directionsRenderers",n)})};return{restrict:"E",require:"^map",link:h}};b.$inject=["Attr2Options","$timeout","NavigatorGeolocation"],angular.module("ngMap").directive("directions",b)}(),function(){"use strict";angular.module("ngMap").directive("drawingManager",["Attr2Options",function(a){var b=a;return{restrict:"E",require:"^map",link:function(a,c,d,e){var f=(b.orgAttributes(c),b.filter(d)),g=b.getOptions(f),h=b.getControlOptions(f),i=b.getEvents(a,f),j=new google.maps.drawing.DrawingManager({drawingMode:g.drawingmode,drawingControl:g.drawingcontrol,drawingControlOptions:h.drawingControlOptions,circleOptions:g.circleoptions,markerOptions:g.markeroptions,polygonOptions:g.polygonoptions,polylineOptions:g.polylineoptions,rectangleOptions:g.rectangleoptions}),i=b.getEvents(a,f);for(var k in i)google.maps.event.addListener(j,k,i[k]);e.addObject("mapDrawingManager",j)}}}])}(),function(){"use strict";angular.module("ngMap").directive("dynamicMapsEngineLayer",["Attr2Options",function(a){var b=a,c=function(a,b){var c=new google.maps.visualization.DynamicMapsEngineLayer(a);for(var d in b)google.maps.event.addListener(c,d,b[d]);return c};return{restrict:"E",require:"^map",link:function(a,d,e,f){var g=b.filter(e),h=b.getOptions(g),i=b.getEvents(a,g,i),j=c(h,i);f.addObject("mapsEngineLayers",j)}}}])}(),function(){"use strict";angular.module("ngMap").directive("fusionTablesLayer",["Attr2Options",function(a){var b=a,c=function(a,b){var c=new google.maps.FusionTablesLayer(a);for(var d in b)google.maps.event.addListener(c,d,b[d]);return c};return{restrict:"E",require:"^map",link:function(a,d,e,f){var g=b.filter(e),h=b.getOptions(g),i=b.getEvents(a,g,i),j=c(h,i);f.addObject("fusionTablesLayers",j)}}}])}(),function(){"use strict";angular.module("ngMap").directive("heatmapLayer",["Attr2Options","$window",function(a,b){var c=a;return{restrict:"E",require:"^map",link:function(a,d,e,f){var g=c.filter(e),h=c.getOptions(g);if(h.data=b[e.data]||a[e.data],!(h.data instanceof Array))throw"invalid heatmap data";h.data=new google.maps.MVCArray(h.data);var i=new google.maps.visualization.HeatmapLayer(h);c.getEvents(a,g);f.addObject("heatmapLayers",i)}}}])}(),function(){"use strict";var a=function(a,b,c,d){var e=a,f=function(a,d,e){var f;!a.position||a.position instanceof google.maps.LatLng||delete a.position,f=new google.maps.InfoWindow(a),Object.keys(d).length>0;for(var g in d)g&&google.maps.event.addListener(f,g,d[g]);var h=e.html().trim();if(1!=angular.element(h).length)throw"info-window working as a template must have a container";return f.__template=h.replace(/\s?ng-non-bindable[='"]+/,""),f.__compile=function(a,c){c&&(a["this"]=c);var d=b(f.__template)(a);f.setContent(d[0]),a.$apply()},f.__open=function(a,b,d){c(function(){f.__compile(b,d),d&&d.getPosition?f.open(a,d):d&&d instanceof google.maps.LatLng?(f.open(a),f.setPosition(d)):f.open(a)})},f},g=function(a,b,c,g){b.css("display","none");var h,i=e.orgAttributes(b),j=e.filter(c),k=e.getOptions(j,a),l=e.getEvents(a,j);!k.position||k.position instanceof google.maps.LatLng||(h=k.position);var m=f(k,l,b);h&&g.getGeoLocation(h).then(function(b){m.setPosition(b),m.__open(g.map,a,b);var e=c.geoCallback;e&&d(e)(a)}),g.addObject("infoWindows",m),g.observeAttrSetObj(i,c,m),a.$on("mapInitialized",function(b,c){if(m.visible&&m.__open(c,a),m.visibleOnMarker){var d=m.visibleOnMarker;m.__open(c,a,c.markers[d])}}),a.showInfoWindow=function(b,c,d){var e=g.map.infoWindows[c],f=d?d:this.getPosition?this:null;e.__open(g.map,a,f),g.singleInfoWindow&&(g.lastInfoWindow&&a.hideInfoWindow(b,g.lastInfoWindow),g.lastInfoWindow=c)},a.hideInfoWindow=a.hideInfoWindow||function(a,b){var c=g.map.infoWindows[b];c.close()}};return{restrict:"E",require:"^map",link:g}};a.$inject=["Attr2Options","$compile","$timeout","$parse"],angular.module("ngMap").directive("infoWindow",a)}(),function(){"use strict";angular.module("ngMap").directive("kmlLayer",["Attr2Options",function(a){var b=a,c=function(a,b){var c=new google.maps.KmlLayer(a);for(var d in b)google.maps.event.addListener(c,d,b[d]);return c};return{restrict:"E",require:"^map",link:function(a,d,e,f){var g=b.orgAttributes(d),h=b.filter(e),i=b.getOptions(h),j=b.getEvents(a,h),k=c(i,j);f.addObject("kmlLayers",k),f.observeAttrSetObj(g,e,k),d.bind("$destroy",function(){f.deleteObject("kmlLayers",k)})}}}])}(),function(){"use strict";angular.module("ngMap").directive("mapData",["Attr2Options",function(a){var b=a;return{restrict:"E",require:"^map",link:function(a,c,d,e){var f=b.filter(d),g=b.getOptions(f),h=b.getEvents(a,f,h);a.$on("mapInitialized",function(b,c){for(var d in g)if(d){var e=g[d];"function"==typeof a[e]?c.data[d](a[e]):c.data[d](e)}for(var f in h)h[f]&&c.data.addListener(f,h[f])})}}}])}(),function(){"use strict";var a,b,c,d,e=function(c,e,f){var g=f.mapLazyLoadParams||f.mapLazyLoad;if(window.lazyLoadCallback=function(){a(function(){e.html(d),b(e.contents())(c)},100)},void 0===window.google||void 0===window.google.maps){var h=document.createElement("script");h.src=g+(g.indexOf("?")>-1?"&":"?")+"callback=lazyLoadCallback",document.body.appendChild(h)}else e.html(d),b(e.contents())(c)},f=function(a,b){return!b.mapLazyLoad&&void 0,d=a.html(),c=b.mapLazyLoad,document.querySelector('script[src="'+c+(c.indexOf("?")>-1?"&":"?")+'callback=lazyLoadCallback"]')?!1:(a.html(""),{pre:e})},g=function(c,d){return b=c,a=d,{compile:f}};g.$inject=["$compile","$timeout"],angular.module("ngMap").directive("mapLazyLoad",g)}(),function(){"use strict";angular.module("ngMap").directive("mapType",["Attr2Options","$window",function(a,b){return{restrict:"E",require:"^map",link:function(a,c,d,e){var f,g=d.name;if(!g)throw"invalid map-type name";if(d.object){var h=a[d.object]?a:b;f=h[d.object],"function"==typeof f&&(f=new f)}if(!f)throw"invalid map-type object";a.$on("mapInitialized",function(a,b){b.mapTypes.set(g,f)}),e.addObject("mapTypes",f)}}}])}(),function(){"use strict";function a(a,b){var c;return a.currentStyle?c=a.currentStyle[b]:window.getComputedStyle&&(c=document.defaultView.getComputedStyle(a,null).getPropertyValue(b)),c}var b=function(b,c,d){var e=b,f=function(b,f,g,h){var i=e.orgAttributes(f);b.google=google;var j=document.createElement("div");j.style.width="100%",j.style.height="100%",f.prepend(j),"false"!==g.defaultStyle&&("block"!=a(f[0],"display")&&f.css("display","block"),a(f[0],"height").match(/^(0|auto)/)&&f.css("height","300px")),f[0].addEventListener("dragstart",function(a){return a.preventDefault(),!1});var k=function(a,e){var f=new google.maps.Map(j,{});f.markers={},f.shapes={},c(function(){google.maps.event.trigger(f,"resize")}),a.zoom=a.zoom||15;var k=a.center;k?k instanceof google.maps.LatLng||(delete a.center,h.getGeoLocation(k,m.geoLocationOptions).then(function(a){f.setCenter(a);var c=g.geoCallback;c&&d(c)(b)},function(a){f.setCenter(m.geoFallbackCenter)})):a.center=new google.maps.LatLng(0,0),f.setOptions(a),h.singleInfoWindow=a.singleInfoWindow;for(var l in e)l&&google.maps.event.addListener(f,l,e[l]);h.observeAttrSetObj(i,g,f),h.map=f,h.addObjects(h._objects),b.map=f,b.map.scope=b,google.maps.event.addListenerOnce(f,"idle",function(){b.$emit("mapInitialized",f),g.zoomToIncludeMarkers&&(h.zoomToIncludeMarkers(),"auto"==g.zoomToIncludeMarkers&&b.$on("objectChanged",function(a,b){"markers"==b[0]&&h.zoomToIncludeMarkers()}))})},l=e.filter(g),m=e.getOptions(l,b),n=e.getControlOptions(l),o=angular.extend(m,n),p=e.getEvents(b,l);g.initEvent?b.$on(g.initEvent,function(){!h.map&&k(o,p)}):k(o,p)};return{restrict:"AE",controller:"MapController",link:f}};angular.module("ngMap").directive("map",["Attr2Options","$timeout","$parse",b])}(),function(){"use strict";var a=function(a,b,c,d,e){var f=e,g=this,h=function(a,b,c){a.$observe(b,function(a){if(a){var d=f.camelCase("set-"+b),e=f.toOptionValue(a,{key:b});c[d]&&(b.match(/center|position/)&&"string"==typeof e?g.getGeoLocation(e).then(function(a){c[d](a)}):c[d](e))}})};this.map=null,this._objects=[],this.addObject=function(b,c){if(this.map){this.map[b]=this.map[b]||{};var d=Object.keys(this.map[b]).length;this.map[b][c.id||d]=c,"infoWindows"!=b&&c.setMap&&c.setMap&&c.setMap(this.map),c.centered&&c.position&&this.map.setCenter(c.position),a.$emit("objectChanged",[b,this.map[b]])}else c.groupName=b,this._objects.push(c)},this.deleteObject=function(b,c){if(c.map){var d=c.map[b];for(var e in d)d[e]===c&&delete d[e];c.map&&c.setMap&&c.setMap(null),a.$emit("objectChanged",[b,this.map[b]])}},this.addObjects=function(a){for(var b=0;b0;for(var d in b)d&&google.maps.event.addListener(c,d,b[d]);return c},b=function(b,c){var d=b,e=function(b,e,f,g){var h,i=d.orgAttributes(e),j=d.filter(f),k=d.getOptions(j,b),l=d.getEvents(b,j);k.position instanceof google.maps.LatLng||(h=k.position);var m=a(k,l);g.addObject("markers",m),h&&g.getGeoLocation(h).then(function(a){m.setPosition(a),k.centered&&m.map.setCenter(a);var d=f.geoCallback;d&&c(d)(b)}),k.noWatcher||g.observeAttrSetObj(i,f,m),e.bind("$destroy",function(){g.deleteObject("markers",m)})};return{restrict:"E",require:"^map",link:e}};b.$inject=["Attr2Options","$parse"],angular.module("ngMap").directive("marker",b)}(),function(){"use strict";angular.module("ngMap").directive("overlayMapType",["Attr2Options","$window",function(a,b){return{restrict:"E",require:"^map",link:function(a,c,d,e){var f,g=d.initMethod||"insertAt";if(d.object){var h=a[d.object]?a:b;f=h[d.object],"function"==typeof f&&(f=new f)}if(!f)throw"invalid map-type object";a.$on("mapInitialized",function(a,b){if("insertAt"==g){var c=parseInt(d.index,10);b.overlayMapTypes.insertAt(c,f)}else"push"==g&&b.overlayMapTypes.push(f)}),e.addObject("overlayMapTypes",f)}}}])}(),function(){"use strict";var a=function(a,b){var c=a,d=function(a,d,e,f){if("false"===e.placesAutoComplete)return!1;var g=c.filter(e),h=c.getOptions(g),i=c.getEvents(a,g),j=new google.maps.places.Autocomplete(d[0],h);for(var k in i)google.maps.event.addListener(j,k,i[k]);var l=function(){b(function(){f&&f.$setViewValue(d.val())},100)};google.maps.event.addListener(j,"place_changed",l),d[0].addEventListener("change",l),e.$observe("types",function(a){if(a){var b=c.toOptionValue(a,{key:"types"});j.setTypes(b)}})};return{restrict:"A",require:"?ngModel",link:d}};a.$inject=["Attr2Options","$timeout"],angular.module("ngMap").directive("placesAutoComplete",a)}(),function(){"use strict";var a=function(a,b){var c,d=a.name;switch(delete a.name,d){case"circle":a.center instanceof google.maps.LatLng||(a.center=new google.maps.LatLng(0,0)),c=new google.maps.Circle(a);break;case"polygon":c=new google.maps.Polygon(a);break;case"polyline":c=new google.maps.Polyline(a);break;case"rectangle":c=new google.maps.Rectangle(a);break;case"groundOverlay":case"image":var e=a.url,f={opacity:a.opacity,clickable:a.clickable,id:a.id};c=new google.maps.GroundOverlay(e,a.bounds,f)}for(var g in b)b[g]&&google.maps.event.addListener(c,g,b[g]);return c},b=function(b,c){var d=b,e=function(b,e,f,g){var h,i,j=d.orgAttributes(e),k=d.filter(f),l=d.getOptions(k),m=d.getEvents(b,k);i=l.name,l.center instanceof google.maps.LatLng||(h=l.center);var n=a(l,m);g.addObject("shapes",n),h&&"circle"==i&&g.getGeoLocation(h).then(function(a){n.setCenter(a),n.centered&&n.map.setCenter(a);var d=f.geoCallback;d&&c(d)(b)}),g.observeAttrSetObj(j,f,n),e.bind("$destroy",function(){g.deleteObject("shapes",n)})};return{restrict:"E",require:"^map",link:e}};b.$inject=["Attr2Options","$parse"],angular.module("ngMap").directive("shape",b)}(),function(){"use strict";var a=function(a){var b=a,c=function(a,b,c){var d,e;b.container&&(e=document.getElementById(b.container),e=e||document.querySelector(b.container)),e?d=new google.maps.StreetViewPanorama(e,b):(d=a.getStreetView(),d.setOptions(b));for(var f in c)f&&google.maps.event.addListener(d,f,c[f]);return d},d=function(a,d,e,f){var g=(b.orgAttributes(d),b.filter(e)),h=b.getOptions(g),i=b.getControlOptions(g),j=angular.extend(h,i),k=b.getEvents(a,g);a.$on("mapInitialized",function(a,b){var d=c(b,j,k);b.setStreetView(d),!d.getPosition()&&d.setPosition(b.getCenter()),google.maps.event.addListener(d,"position_changed",function(){d.getPosition()!==b.getCenter()&&b.setCenter(d.getPosition())});var e=google.maps.event.addListener(b,"center_changed",function(){d.setPosition(b.getCenter()),google.maps.event.removeListener(e)})})};return{restrict:"E",require:"^map",link:d}};a.$inject=["Attr2Options"],angular.module("ngMap").directive("streetViewPanorama",a)}(),function(){"use strict";angular.module("ngMap").directive("trafficLayer",["Attr2Options",function(a){var b=a,c=function(a,b){var c=new google.maps.TrafficLayer(a);for(var d in b)google.maps.event.addListener(c,d,b[d]);return c};return{restrict:"E",require:"^map",link:function(a,d,e,f){var g=b.orgAttributes(d),h=b.filter(e),i=b.getOptions(h),j=b.getEvents(a,h),k=c(i,j);f.addObject("trafficLayers",k),f.observeAttrSetObj(g,e,k),d.bind("$destroy",function(){f.deleteObject("trafficLayers",k)})}}}])}(),function(){"use strict";angular.module("ngMap").directive("transitLayer",["Attr2Options",function(a){var b=a,c=function(a,b){var c=new google.maps.TransitLayer(a);for(var d in b)google.maps.event.addListener(c,d,b[d]);return c};return{restrict:"E",require:"^map",link:function(a,d,e,f){var g=b.orgAttributes(d),h=b.filter(e),i=b.getOptions(h),j=b.getEvents(a,h),k=c(i,j);f.addObject("transitLayers",k),f.observeAttrSetObj(g,e,k),d.bind("$destroy",function(){f.deleteObject("transitLayers",k)})}}}])}(),function(){"use strict";angular.module("ngMap").directive("weatherLayer",["Attr2Options",function(a){var b=a,c=function(a,b){var c=new google.maps.weather.WeatherLayer(a);for(var d in b)google.maps.event.addListener(c,d,b[d]);return c};return{restrict:"E",require:"^map",link:function(a,d,e,f){var g=b.orgAttributes(d),h=b.filter(e),i=b.getOptions(h),j=b.getEvents(a,h),k=c(i,j);f.addObject("weatherLayers",k),f.observeAttrSetObj(g,e,k),d.bind("$destroy",function(){f.deleteObject("weatherLayers",k)})}}}])}(),function(a,b){"use strict";var c=["ng","oc.lazyLoad"],d={},e=[],f=[],g=[],h=[],i=a.noop,j={},k=[],l=a.module("oc.lazyLoad",["ng"]);l.provider("$ocLazyLoad",["$controllerProvider","$provide","$compileProvider","$filterProvider","$injector","$animateProvider",function(l,m,p,q,r,s){function t(b,d,e){if(d){var f,h,l,m=[];for(f=d.length-1;f>=0;f--)if(h=d[f],a.isString(h)||(h=w(h)),h&&-1===k.indexOf(h)&&(!y[h]||-1!==g.indexOf(h))){var n=-1===c.indexOf(h);if(l=o(h),n&&(c.push(h),t(b,l.requires,e)),l._runBlocks.length>0)for(j[h]=[];l._runBlocks.length>0;)j[h].push(l._runBlocks.shift());a.isDefined(j[h])&&(n||e.rerun)&&(m=m.concat(j[h])),v(b,l._invokeQueue,h,e.reconfig),v(b,l._configBlocks,h,e.reconfig),i(n?"ocLazyLoad.moduleLoaded":"ocLazyLoad.moduleReloaded",h),d.pop(),k.push(h)}var p=b.getInstanceInjector();a.forEach(m,function(a){p.invoke(a)})}}function u(b,c){function e(b,c){var d,e=!0;return c.length&&(d=f(b),a.forEach(c,function(a){e=e&&f(a)!==d})),e}function f(b){return a.isArray(b)?F(b.toString()):a.isObject(b)?F(E(b)):a.isDefined(b)&&null!==b?F(b.toString()):b}var g=b[2][0],h=b[1],j=!1;a.isUndefined(d[c])&&(d[c]={}),a.isUndefined(d[c][h])&&(d[c][h]={});var k=function(a,b){d[c][h].hasOwnProperty(a)||(d[c][h][a]=[]),e(b,d[c][h][a])&&(j=!0,d[c][h][a].push(b),i("ocLazyLoad.componentLoaded",[c,h,a]))};if(a.isString(g))k(g,b[2][1]);else{if(!a.isObject(g))return!1;a.forEach(g,function(b,c){a.isString(b)?k(b,g[1]):k(c,b)})}return j}function v(b,c,d,f){if(c){var g,h,i,j;for(g=0,h=c.length;h>g;g++)if(i=c[g],a.isArray(i)){if(null!==b){if(!b.hasOwnProperty(i[0]))throw new Error("unsupported provider "+i[0]);j=b[i[0]]}var k=u(i,d);if("invoke"!==i[1])k&&a.isDefined(j)&&j[i[1]].apply(j,i[2]);else{var l=function(b){var c=e.indexOf(d+"-"+b);(-1===c||f)&&(-1===c&&e.push(d+"-"+b),a.isDefined(j)&&j[i[1]].apply(j,i[2]))};if(a.isFunction(i[2][0]))l(i[2][0]);else if(a.isArray(i[2][0]))for(var m=0,n=i[2][0].length;n>m;m++)a.isFunction(i[2][0][m])&&l(i[2][0][m])}}}}function w(b){var c=null;return a.isString(b)?c=b:a.isObject(b)&&b.hasOwnProperty("name")&&a.isString(b.name)&&(c=b.name),c}function x(b){if(!a.isString(b))return!1;try{return o(b)}catch(c){if(/No module/.test(c)||c.message.indexOf("$injector:nomod")>-1)return!1}}var y={},z={$controllerProvider:l,$compileProvider:p,$filterProvider:q,$provide:m,$injector:r,$animateProvider:s},A=!1,B=!1,C=[],D={};C.push=function(a){-1===this.indexOf(a)&&Array.prototype.push.apply(this,arguments)},this.config=function(b){a.isDefined(b.modules)&&(a.isArray(b.modules)?a.forEach(b.modules,function(a){y[a.name]=a}):y[b.modules.name]=b.modules),a.isDefined(b.debug)&&(A=b.debug),a.isDefined(b.events)&&(B=b.events)},this._init=function(d){if(0===f.length){var e=[d],g=["ng:app","ng-app","x-ng-app","data-ng-app"],i=/\sng[:\-]app(:\s*([\w\d_]+);?)?\s/,j=function(a){return a&&e.push(a)};a.forEach(g,function(b){g[b]=!0,j(document.getElementById(b)),b=b.replace(":","\\:"),"undefined"!=typeof d[0]&&d[0].querySelectorAll&&(a.forEach(d[0].querySelectorAll("."+b),j),a.forEach(d[0].querySelectorAll("."+b+"\\:"),j),a.forEach(d[0].querySelectorAll("["+b+"]"),j))}),a.forEach(e,function(b){if(0===f.length){var c=" "+d.className+" ",e=i.exec(c);e?f.push((e[2]||"").replace(/\s+/g,",")):a.forEach(b.attributes,function(a){0===f.length&&g[a.name]&&f.push(a.value)})}})}0!==f.length||(b.jasmine||b.mocha)&&a.isDefined(a.mock)||console.error("No module found during bootstrap, unable to init ocLazyLoad. You should always use the ng-app directive or angular.boostrap when you use ocLazyLoad.");var k=function l(b){if(-1===c.indexOf(b)){c.push(b);var d=a.module(b);v(null,d._invokeQueue,b),v(null,d._configBlocks,b),a.forEach(d.requires,l)}};a.forEach(f,function(a){k(a)}),f=[],h.pop()};var E=function(b){try{return JSON.stringify(b)}catch(c){var d=[];return JSON.stringify(b,function(b,c){if(a.isObject(c)&&null!==c){if(-1!==d.indexOf(c))return;d.push(c)}return c})}},F=function(a){var b,c,d,e=0;if(0==a.length)return e;for(b=0,d=a.length;d>b;b++)c=a.charCodeAt(b),e=(e<<5)-e+c,e|=0;return e};this.$get=["$log","$rootElement","$rootScope","$cacheFactory","$q",function(b,e,g,j,l){function m(a){var c=l.defer();return b.error(a.message),c.reject(a),c.promise}var p,q=j("ocLazyLoad");return A||(b={},b.error=a.noop,b.warn=a.noop,b.info=a.noop),z.getInstanceInjector=function(){return p?p:p=e.data("$injector")||a.injector()},i=function(a,c){B&&g.$broadcast(a,c),A&&b.info(a,c)},{_broadcast:i,_$log:b,_getFilesCache:function(){return q},toggleWatch:function(a){a?h.push(!0):h.pop()},getModuleConfig:function(b){if(!a.isString(b))throw new Error("You need to give the name of the module to get");return y[b]?a.copy(y[b]):null},setModuleConfig:function(b){if(!a.isObject(b))throw new Error("You need to give the module config object to set");return y[b.name]=b,b},getModules:function(){return c},isLoaded:function(b){var d=function(a){var b=c.indexOf(a)>-1;return b||(b=!!x(a)),b};if(a.isString(b)&&(b=[b]),a.isArray(b)){var e,f;for(e=0,f=b.length;f>e;e++)if(!d(b[e]))return!1;return!0}throw new Error("You need to define the module(s) name(s)")},_getModuleName:w,_getModule:function(a){try{return o(a)}catch(b){throw(/No module/.test(b)||b.message.indexOf("$injector:nomod")>-1)&&(b.message='The module "'+E(a)+'" that you are trying to load does not exist. '+b.message),b}},moduleExists:x,_loadDependencies:function(b,c){var d,e,f,g=[],h=this;if(b=h._getModuleName(b),null===b)return l.when();try{d=h._getModule(b)}catch(i){return m(i)}return e=h.getRequires(d),a.forEach(e,function(d){if(a.isString(d)){var e=h.getModuleConfig(d);if(null===e)return void C.push(d);d=e,e.name=void 0}if(h.moduleExists(d.name))return f=d.files.filter(function(a){return h.getModuleConfig(d.name).files.indexOf(a)<0}),0!==f.length&&h._$log.warn('Module "',b,'" attempted to redefine configuration for dependency. "',d.name,'"\n Additional Files Loaded:',f),a.isDefined(h.filesLoader)?void g.push(h.filesLoader(d,c).then(function(){return h._loadDependencies(d)})):m(new Error("Error: New dependencies need to be loaded from external files ("+d.files+"), but no loader has been defined."));if(a.isArray(d)){var i=[];a.forEach(d,function(a){var b=h.getModuleConfig(a);null===b?i.push(a):b.files&&(i=i.concat(b.files))}),i.length>0&&(d={files:i})}else a.isObject(d)&&d.hasOwnProperty("name")&&d.name&&(h.setModuleConfig(d),C.push(d.name));if(a.isDefined(d.files)&&0!==d.files.length){if(!a.isDefined(h.filesLoader))return m(new Error('Error: the module "'+d.name+'" is defined in external files ('+d.files+"), but no loader has been defined."));g.push(h.filesLoader(d,c).then(function(){return h._loadDependencies(d)}))}}),l.all(g)},inject:function(b){var c=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],d=arguments.length<=2||void 0===arguments[2]?!1:arguments[2],e=this,g=l.defer();if(a.isDefined(b)&&null!==b){if(a.isArray(b)){var h=[];return a.forEach(b,function(a){h.push(e.inject(a,c,d))}),l.all(h)}e._addToLoadList(e._getModuleName(b),!0,d)}if(f.length>0){var i=f.slice(),j=function m(a){C.push(a),D[a]=g.promise,e._loadDependencies(a,c).then(function(){try{k=[],t(z,C,c)}catch(a){return e._$log.error(a.message),void g.reject(a)}f.length>0?m(f.shift()):g.resolve(i)},function(a){g.reject(a)})};j(f.shift())}else{if(c&&c.name&&D[c.name])return D[c.name];g.resolve()}return g.promise},getRequires:function(b){var d=[];return a.forEach(b.requires,function(a){-1===c.indexOf(a)&&d.push(a)}),d},_invokeQueue:v,_registerInvokeList:u,_register:t,_addToLoadList:n,_unregister:function(b){a.isDefined(b)&&a.isArray(b)&&a.forEach(b,function(a){d[a]=void 0})}}}],this._init(a.element(b.document))}]);var m=a.bootstrap;a.bootstrap=function(b,c,d){return a.forEach(c.slice(),function(a){n(a,!0,!0)}),m(b,c,d)};var n=function(b,c,d){(h.length>0||c)&&a.isString(b)&&-1===f.indexOf(b)&&(f.push(b),d&&g.push(b))},o=a.module;a.module=function(a,b,c){return n(a,!1,!0),o(a,b,c)},"undefined"!=typeof module&&"undefined"!=typeof exports&&module.exports===exports&&(module.exports="oc.lazyLoad")}(angular,window),function(a){"use strict";a.module("oc.lazyLoad").directive("ocLazyLoad",["$ocLazyLoad","$compile","$animate","$parse","$timeout",function(b,c,d,e,f){return{restrict:"A",terminal:!0,priority:1e3,compile:function(f,g){var h=f[0].innerHTML;return f.html(""),function(f,g,i){var j=e(i.ocLazyLoad);f.$watch(function(){return j(f)||i.ocLazyLoad},function(e){a.isDefined(e)&&b.load(e).then(function(){d.enter(h,g),c(g.contents())(f)})},!0)}}}}])}(angular),function(a){"use strict";a.module("oc.lazyLoad").config(["$provide",function(b){b.decorator("$ocLazyLoad",["$delegate","$q","$window","$interval",function(b,c,d,e){var f=!1,g=!1,h=d.document.getElementsByTagName("head")[0]||d.document.getElementsByTagName("body")[0];return b.buildElement=function(i,j,k){var l,m,n=c.defer(),o=b._getFilesCache(),p=function(a){var b=(new Date).getTime();return a.indexOf("?")>=0?"&"===a.substring(0,a.length-1)?a+"_dc="+b:a+"&_dc="+b:a+"?_dc="+b};switch(a.isUndefined(o.get(j))&&o.put(j,n.promise),i){case"css":l=d.document.createElement("link"),l.type="text/css",l.rel="stylesheet",l.href=k.cache===!1?p(j):j;break;case"js":l=d.document.createElement("script"),l.src=k.cache===!1?p(j):j;break;default:o.remove(j),n.reject(new Error('Requested type "'+i+'" is not known. Could not inject "'+j+'"')); +}l.onload=l.onreadystatechange=function(a){l.readyState&&!/^c|loade/.test(l.readyState)||m||(l.onload=l.onreadystatechange=null,m=1,b._broadcast("ocLazyLoad.fileLoaded",j),n.resolve())},l.onerror=function(){o.remove(j),n.reject(new Error("Unable to load "+j))},l.async=k.serie?0:1;var q=h.lastChild;if(k.insertBefore){var r=a.element(a.isDefined(window.jQuery)?k.insertBefore:document.querySelector(k.insertBefore));r&&r.length>0&&(q=r[0])}if(q.parentNode.insertBefore(l,q),"css"==i){if(!f){var s=d.navigator.userAgent.toLowerCase();if(/iP(hone|od|ad)/.test(d.navigator.platform)){var t=d.navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/),u=parseFloat([parseInt(t[1],10),parseInt(t[2],10),parseInt(t[3]||0,10)].join("."));g=6>u}else if(s.indexOf("android")>-1){var v=parseFloat(s.slice(s.indexOf("android")+8));g=4.4>v}else if(s.indexOf("safari")>-1){var w=s.match(/version\/([\.\d]+)/i);g=w&&w[1]&&parseFloat(w[1])<6}}if(g)var x=1e3,y=e(function(){try{l.sheet.cssRules,e.cancel(y),l.onload()}catch(a){--x<=0&&l.onerror()}},20)}return n.promise},b}])}])}(angular),function(a){"use strict";a.module("oc.lazyLoad").config(["$provide",function(b){b.decorator("$ocLazyLoad",["$delegate","$q",function(b,c){return b.filesLoader=function(d){var e=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],f=[],g=[],h=[],i=[],j=null,k=b._getFilesCache();b.toggleWatch(!0),a.extend(e,d);var l=function(c){var d,l=null;if(a.isObject(c)&&(l=c.type,c=c.path),j=k.get(c),a.isUndefined(j)||e.cache===!1){if(null!==(d=/^(css|less|html|htm|js)?(?=!)/.exec(c))&&(l=d[1],c=c.substr(d[1].length+1,c.length)),!l)if(null!==(d=/[.](css|less|html|htm|js)?((\?|#).*)?$/.exec(c)))l=d[1];else{if(b.jsLoader.hasOwnProperty("ocLazyLoadLoader")||!b.jsLoader.hasOwnProperty("requirejs"))return void b._$log.error("File type could not be determined. "+c);l="js"}"css"!==l&&"less"!==l||-1!==f.indexOf(c)?"html"!==l&&"htm"!==l||-1!==g.indexOf(c)?"js"===l||-1===h.indexOf(c)?h.push(c):b._$log.error("File type is not valid. "+c):g.push(c):f.push(c)}else j&&i.push(j)};if(e.serie?l(e.files.shift()):a.forEach(e.files,function(a){l(a)}),f.length>0){var m=c.defer();b.cssLoader(f,function(c){a.isDefined(c)&&b.cssLoader.hasOwnProperty("ocLazyLoadLoader")?(b._$log.error(c),m.reject(c)):m.resolve()},e),i.push(m.promise)}if(g.length>0){var n=c.defer();b.templatesLoader(g,function(c){a.isDefined(c)&&b.templatesLoader.hasOwnProperty("ocLazyLoadLoader")?(b._$log.error(c),n.reject(c)):n.resolve()},e),i.push(n.promise)}if(h.length>0){var o=c.defer();b.jsLoader(h,function(c){a.isDefined(c)&&(b.jsLoader.hasOwnProperty("ocLazyLoadLoader")||b.jsLoader.hasOwnProperty("requirejs"))?(b._$log.error(c),o.reject(c)):o.resolve()},e),i.push(o.promise)}if(0===i.length){var p=c.defer(),q="Error: no file to load has been found, if you're trying to load an existing module you should use the 'inject' method instead of 'load'.";return b._$log.error(q),p.reject(q),p.promise}return e.serie&&e.files.length>0?c.all(i).then(function(){return b.filesLoader(d,e)}):c.all(i)["finally"](function(a){return b.toggleWatch(!1),a})},b.load=function(d){var e,f=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],g=this,h=null,i=[],j=c.defer(),k=a.copy(d),l=a.copy(f);if(a.isArray(k))return a.forEach(k,function(a){i.push(g.load(a,l))}),c.all(i).then(function(a){j.resolve(a)},function(a){j.reject(a)}),j.promise;if(a.isString(k)?(h=g.getModuleConfig(k),h||(h={files:[k]})):a.isObject(k)&&(h=a.isDefined(k.path)&&a.isDefined(k.type)?{files:[k]}:g.setModuleConfig(k)),null===h){var m=g._getModuleName(k);return e='Module "'+(m||"unknown")+'" is not configured, cannot load.',b._$log.error(e),j.reject(new Error(e)),j.promise}a.isDefined(h.template)&&(a.isUndefined(h.files)&&(h.files=[]),a.isString(h.template)?h.files.push(h.template):a.isArray(h.template)&&h.files.concat(h.template));var n=a.extend({},l,h);return a.isUndefined(h.files)&&a.isDefined(h.name)&&b.moduleExists(h.name)?b.inject(h.name,n,!0):(b.filesLoader(h,n).then(function(){b.inject(null,n).then(function(a){j.resolve(a)},function(a){j.reject(a)})},function(a){j.reject(a)}),j.promise)},b}])}])}(angular),function(a){"use strict";a.module("oc.lazyLoad").config(["$provide",function(b){b.decorator("$ocLazyLoad",["$delegate","$q",function(b,c){return b.cssLoader=function(d,e,f){var g=[];a.forEach(d,function(a){g.push(b.buildElement("css",a,f))}),c.all(g).then(function(){e()},function(a){e(a)})},b.cssLoader.ocLazyLoadLoader=!0,b}])}])}(angular),function(a){"use strict";a.module("oc.lazyLoad").config(["$provide",function(b){b.decorator("$ocLazyLoad",["$delegate","$q",function(b,c){return b.jsLoader=function(d,e,f){var g=[];a.forEach(d,function(a){g.push(b.buildElement("js",a,f))}),c.all(g).then(function(){e()},function(a){e(a)})},b.jsLoader.ocLazyLoadLoader=!0,b}])}])}(angular),function(a){"use strict";a.module("oc.lazyLoad").config(["$provide",function(b){b.decorator("$ocLazyLoad",["$delegate","$templateCache","$q","$http",function(b,c,d,e){return b.templatesLoader=function(f,g,h){var i=[],j=b._getFilesCache();return a.forEach(f,function(b){var f=d.defer();i.push(f.promise),e.get(b,h).success(function(d){a.isString(d)&&d.length>0&&a.forEach(a.element(d),function(a){"SCRIPT"===a.nodeName&&"text/ng-template"===a.type&&c.put(a.id,a.innerHTML)}),a.isUndefined(j.get(b))&&j.put(b,!0),f.resolve()}).error(function(a){f.reject(new Error('Unable to load template file "'+b+'": '+a))})}),d.all(i).then(function(){g()},function(a){g(a)})},b.templatesLoader.ocLazyLoadLoader=!0,b}])}])}(angular),Array.prototype.indexOf||(Array.prototype.indexOf=function(a,b){var c;if(null==this)throw new TypeError('"this" is null or not defined');var d=Object(this),e=d.length>>>0;if(0===e)return-1;var f=+b||0;if(Math.abs(f)===1/0&&(f=0),f>=e)return-1;for(c=Math.max(f>=0?f:e-Math.abs(f),0);e>c;){if(c in d&&d[c]===a)return c;c++}return-1}),"undefined"==typeof PDFJS&&(("undefined"!=typeof window?window:this).PDFJS={}),PDFJS.version="1.1.551",PDFJS.build="2a5616c",function(){"use strict";function a(a){PDFJS.verbosity>=PDFJS.VERBOSITY_LEVELS.infos&&console.log("Info: "+a)}function b(a){PDFJS.verbosity>=PDFJS.VERBOSITY_LEVELS.warnings&&console.log("Warning: "+a)}function c(a){b("Deprecated API usage: "+a)}function d(a){throw PDFJS.verbosity>=PDFJS.VERBOSITY_LEVELS.errors&&(console.log("Error: "+a),console.log(e())),I.notify(H.unknown),new Error(a)}function e(){try{throw new Error}catch(a){return a.stack?a.stack.split("\n").slice(2).join("\n"):""}}function f(a,b){a||d(b)}function g(a,b){if(!b)return a;if(/^[a-z][a-z0-9+\-.]*:/i.test(b))return b;var c;if("/"===b.charAt(0))return c=a.indexOf("://"),"/"===b.charAt(1)?++c:c=a.indexOf("/",c+3),a.substring(0,c)+b;var d=a.length;c=a.lastIndexOf("#"),d=c>=0?c:d,c=a.lastIndexOf("?",d),d=c>=0?c:d;var e=a.lastIndexOf("/",d);return a.substring(0,e+1)+b}function h(a,b){if(!a)return!1;var c=/^[a-z][a-z0-9+\-.]*(?=:)/i.exec(a);if(!c)return b;switch(c=c[0].toLowerCase()){case"http":case"https":case"ftp":case"mailto":case"tel":return!0;default:return!1}}function i(a,b,c){return Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!1}),c}function j(){switch(PDFJS.openExternalLinksInNewWindow&&(b("PDFJS.openExternalLinksInNewWindow is deprecated, use PDFJS.externalLinkTarget instead."),PDFJS.externalLinkTarget===J.NONE&&(PDFJS.externalLinkTarget=J.BLANK),PDFJS.openExternalLinksInNewWindow=!1),PDFJS.externalLinkTarget){case J.NONE:return!1;case J.SELF:case J.BLANK:case J.PARENT:case J.TOP:return!0}return b("PDFJS.externalLinkTarget is invalid: "+PDFJS.externalLinkTarget),PDFJS.externalLinkTarget=J.NONE,!1}function k(a){f(null!==a&&"object"==typeof a&&void 0!==a.length,"Invalid argument for bytesToString");var b=a.length,c=8192;if(c>b)return String.fromCharCode.apply(null,a);for(var d=[],e=0;b>e;e+=c){var g=Math.min(e+c,b),h=a.subarray(e,g);d.push(String.fromCharCode.apply(null,h))}return d.join("")}function l(a){f("string"==typeof a,"Invalid argument for stringToBytes");for(var b=a.length,c=new Uint8Array(b),d=0;b>d;++d)c[d]=255&a.charCodeAt(d);return c}function m(a){return String.fromCharCode(a>>24&255,a>>16&255,a>>8&255,255&a)}function n(){var a=new Uint8Array(2);a[0]=1;var b=new Uint16Array(a.buffer);return 1===b[0]}function o(){var a=document.createElement("canvas");a.width=a.height=1;var b=a.getContext("2d"),c=b.createImageData(1,1);return"undefined"!=typeof c.data.buffer}function p(a){return"number"==typeof a}function q(a){return a instanceof Array}function r(a){return"object"==typeof a&&null!==a&&void 0!==a.byteLength}function s(){var a={};return a.promise=new Promise(function(b,c){a.resolve=b,a.reject=c}),a}function t(a,b){this.name=a,this.comObj=b,this.callbackIndex=1,this.postMessageTransfers=!0;var c=this.callbacksCapabilities={},e=this.actionHandler={};e.console_log=[function(a){console.log.apply(console,a)}],e.console_error=[function(a){console.error.apply(console,a)}],e._unsupported_feature=[function(a){I.notify(a)}],b.onmessage=function(a){var f=a.data;if(f.isReply){var g=f.callbackId;if(f.callbackId in c){var h=c[g];delete c[g],"error"in f?h.reject(f.error):h.resolve(f.data)}else d("Cannot resolve callback "+g)}else if(f.action in e){var i=e[f.action];f.callbackId?Promise.resolve().then(function(){return i[0].call(i[1],f.data)}).then(function(a){b.postMessage({isReply:!0,callbackId:f.callbackId,data:a})},function(a){a instanceof Error&&(a+=""),b.postMessage({isReply:!0,callbackId:f.callbackId,error:a})}):i[0].call(i[1],f.data)}else d("Unknown action from worker: "+f.action)}}function u(a,c,d){var e=new Image;e.onload=function(){d.resolve(a,e)},e.onerror=function(){d.resolve(a,null),b("Error during JPEG image loading")},e.src=c}function v(a,b){var c=document.createElement("canvas");return c.width=a,c.height=b,c}function w(a){a.mozCurrentTransform||(a._originalSave=a.save,a._originalRestore=a.restore,a._originalRotate=a.rotate,a._originalScale=a.scale,a._originalTranslate=a.translate,a._originalTransform=a.transform,a._originalSetTransform=a.setTransform,a._transformMatrix=a._transformMatrix||[1,0,0,1,0,0],a._transformStack=[],Object.defineProperty(a,"mozCurrentTransform",{get:function(){return this._transformMatrix}}),Object.defineProperty(a,"mozCurrentTransformInverse",{get:function(){var a=this._transformMatrix,b=a[0],c=a[1],d=a[2],e=a[3],f=a[4],g=a[5],h=b*e-c*d,i=c*d-b*e;return[e/h,c/i,d/i,b/h,(e*f-d*g)/i,(c*f-b*g)/h]}}),a.save=function(){var a=this._transformMatrix;this._transformStack.push(a),this._transformMatrix=a.slice(0,6),this._originalSave()},a.restore=function(){var a=this._transformStack.pop();a&&(this._transformMatrix=a,this._originalRestore())},a.translate=function(a,b){var c=this._transformMatrix;c[4]=c[0]*a+c[2]*b+c[4],c[5]=c[1]*a+c[3]*b+c[5],this._originalTranslate(a,b)},a.scale=function(a,b){var c=this._transformMatrix;c[0]=c[0]*a,c[1]=c[1]*a,c[2]=c[2]*b,c[3]=c[3]*b,this._originalScale(a,b)},a.transform=function(b,c,d,e,f,g){var h=this._transformMatrix;this._transformMatrix=[h[0]*b+h[2]*c,h[1]*b+h[3]*c,h[0]*d+h[2]*e,h[1]*d+h[3]*e,h[0]*f+h[2]*g+h[4],h[1]*f+h[3]*g+h[5]],a._originalTransform(b,c,d,e,f,g)},a.setTransform=function(b,c,d,e,f,g){this._transformMatrix=[b,c,d,e,f,g],a._originalSetTransform(b,c,d,e,f,g)},a.rotate=function(a){var b=Math.cos(a),c=Math.sin(a),d=this._transformMatrix;this._transformMatrix=[d[0]*b+d[2]*c,d[1]*b+d[3]*c,d[0]*-c+d[2]*b,d[1]*-c+d[3]*b,d[4],d[5]],this._originalRotate(a)})}function x(a){var b,c,d,e,f=1e3,g=a.width,h=a.height,i=g+1,j=new Uint8Array(i*(h+1)),k=new Uint8Array([0,2,4,0,1,0,5,4,8,10,0,8,0,2,1,0]),l=g+7&-8,m=a.data,n=new Uint8Array(l*h),o=0;for(b=0,e=m.length;e>b;b++)for(var p=128,q=m[b];p>0;)n[o++]=q&p?0:255,p>>=1;var r=0;for(o=0,0!==n[o]&&(j[0]=1,++r),c=1;g>c;c++)n[o]!==n[o+1]&&(j[c]=n[o]?2:1,++r),o++;for(0!==n[o]&&(j[c]=2,++r),b=1;h>b;b++){o=b*l,d=b*i,n[o-l]!==n[o]&&(j[d]=n[o]?1:8,++r);var s=(n[o]?4:0)+(n[o-l]?8:0);for(c=1;g>c;c++)s=(s>>2)+(n[o+1]?4:0)+(n[o-l+1]?8:0),k[s]&&(j[d+c]=k[s],++r),o++;if(n[o-l]!==n[o]&&(j[d+c]=n[o]?2:4,++r),r>f)return null}for(o=l*(h-1),d=b*i,0!==n[o]&&(j[d]=8,++r),c=1;g>c;c++)n[o]!==n[o+1]&&(j[d+c]=n[o]?4:8,++r),o++;if(0!==n[o]&&(j[d+c]=4,++r),r>f)return null;var t=new Int32Array([0,i,-1,0,-i,0,0,0,1]),u=[];for(b=0;r&&h>=b;b++){for(var v=b*i,w=v+g;w>v&&!j[v];)v++;if(v!==w){var x,y=[v%i,b],z=j[v],A=v;do{var B=t[z];do v+=B;while(!j[v]);x=j[v],5!==x&&10!==x?(z=x,j[v]=0):(z=x&51*z>>4,j[v]&=z>>2|z<<2),y.push(v%i),y.push(v/i|0),--r}while(A!==v);u.push(y),--b}}var C=function(a){a.save(),a.scale(1/g,-1/h),a.translate(0,-h),a.beginPath();for(var b=0,c=u.length;c>b;b++){var d=u[b];a.moveTo(d[0],d[1]);for(var e=2,f=d.length;f>e;e+=2)a.lineTo(d[e],d[e+1])}a.fill(),a.beginPath(),a.restore()};return C}function y(a){var b=ma[a[0]];return b||d("Unknown IR type: "+a[0]),b.fromIR(a)}var z="undefined"==typeof window?this:window,A="undefined"==typeof window,B=[.001,0,0,.001,0,0],C={FILL:0,STROKE:1,FILL_STROKE:2,INVISIBLE:3,FILL_ADD_TO_PATH:4,STROKE_ADD_TO_PATH:5,FILL_STROKE_ADD_TO_PATH:6,ADD_TO_PATH:7,FILL_STROKE_MASK:3,ADD_TO_PATH_FLAG:4},D={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3},E={WIDGET:1,TEXT:2,LINK:3},F={SOLID:1,DASHED:2,BEVELED:3,INSET:4,UNDERLINE:5};z.PDFJS||(z.PDFJS={}),z.PDFJS.pdfBug=!1,PDFJS.VERBOSITY_LEVELS={errors:0,warnings:1,infos:5};var G=PDFJS.OPS={dependency:1,setLineWidth:2,setLineCap:3,setLineJoin:4,setMiterLimit:5,setDash:6,setRenderingIntent:7,setFlatness:8,setGState:9,save:10,restore:11,transform:12,moveTo:13,lineTo:14,curveTo:15,curveTo2:16,curveTo3:17,closePath:18,rectangle:19,stroke:20,closeStroke:21,fill:22,eoFill:23,fillStroke:24,eoFillStroke:25,closeFillStroke:26,closeEOFillStroke:27,endPath:28,clip:29,eoClip:30,beginText:31,endText:32,setCharSpacing:33,setWordSpacing:34,setHScale:35,setLeading:36,setFont:37,setTextRenderingMode:38,setTextRise:39,moveText:40,setLeadingMoveText:41,setTextMatrix:42,nextLine:43,showText:44,showSpacedText:45,nextLineShowText:46,nextLineSetSpacingShowText:47,setCharWidth:48,setCharWidthAndBounds:49,setStrokeColorSpace:50,setFillColorSpace:51,setStrokeColor:52,setStrokeColorN:53,setFillColor:54,setFillColorN:55,setStrokeGray:56,setFillGray:57,setStrokeRGBColor:58,setFillRGBColor:59,setStrokeCMYKColor:60,setFillCMYKColor:61,shadingFill:62,beginInlineImage:63,beginImageData:64,endInlineImage:65,paintXObject:66,markPoint:67,markPointProps:68,beginMarkedContent:69,beginMarkedContentProps:70,endMarkedContent:71,beginCompat:72,endCompat:73,paintFormXObjectBegin:74,paintFormXObjectEnd:75,beginGroup:76,endGroup:77,beginAnnotations:78,endAnnotations:79,beginAnnotation:80,endAnnotation:81,paintJpegXObject:82,paintImageMaskXObject:83,paintImageMaskXObjectGroup:84,paintImageXObject:85,paintInlineImageXObject:86,paintInlineImageXObjectGroup:87,paintImageXObjectRepeat:88,paintImageMaskXObjectRepeat:89,paintSolidColorImageMask:90,constructPath:91},H=PDFJS.UNSUPPORTED_FEATURES={unknown:"unknown",forms:"forms",javaScript:"javaScript",smask:"smask",shadingPattern:"shadingPattern",font:"font"},I=PDFJS.UnsupportedManager=function(){var a=[];return{listen:function(b){a.push(b)},notify:function(c){b('Unsupported feature "'+c+'"');for(var d=0,e=a.length;e>d;d++)a[d](c)}}}();PDFJS.isValidUrl=h,PDFJS.shadow=i;var J=PDFJS.LinkTarget={NONE:0,SELF:1,BLANK:2,PARENT:3,TOP:4},K=["","_self","_blank","_parent","_top"];PDFJS.isExternalLinkTargetSet=j;var L=PDFJS.PasswordResponses={NEED_PASSWORD:1,INCORRECT_PASSWORD:2},M=function(){function a(a,b){this.name="PasswordException",this.message=a,this.code=b}return a.prototype=new Error,a.constructor=a,a}();PDFJS.PasswordException=M;var N=function(){function a(a,b){this.name="UnknownErrorException",this.message=a,this.details=b}return a.prototype=new Error,a.constructor=a,a}();PDFJS.UnknownErrorException=N;var O=function(){function a(a){this.name="InvalidPDFException",this.message=a}return a.prototype=new Error,a.constructor=a,a}();PDFJS.InvalidPDFException=O;var P=function(){function a(a){this.name="MissingPDFException",this.message=a}return a.prototype=new Error,a.constructor=a,a}();PDFJS.MissingPDFException=P;var Q=function(){function a(a,b){this.name="UnexpectedResponseException",this.message=a,this.status=b}return a.prototype=new Error,a.constructor=a,a}();PDFJS.UnexpectedResponseException=Q;(function(){function a(a){this.message=a}return a.prototype=new Error,a.prototype.name="NotImplementedException",a.constructor=a,a})(),function(){function a(a,b){this.begin=a,this.end=b,this.message="Missing data ["+a+", "+b+")"}return a.prototype=new Error,a.prototype.name="MissingDataException",a.constructor=a,a}(),function(){function a(a){this.message=a}return a.prototype=new Error,a.prototype.name="XRefParseException",a.constructor=a,a}();Object.defineProperty(PDFJS,"isLittleEndian",{configurable:!0,get:function(){return i(PDFJS,"isLittleEndian",n())}}),Object.defineProperty(PDFJS,"hasCanvasTypedArrays",{configurable:!0,get:function(){return i(PDFJS,"hasCanvasTypedArrays",o())}});var R=function(){function a(a,b){this.buffer=a,this.byteLength=a.length,this.length=void 0===b?this.byteLength>>2:b,c(this.length)}function b(a){return{get:function(){var b=this.buffer,c=a<<2;return(b[c]|b[c+1]<<8|b[c+2]<<16|b[c+3]<<24)>>>0},set:function(b){var c=this.buffer,d=a<<2;c[d]=255&b,c[d+1]=b>>8&255,c[d+2]=b>>16&255,c[d+3]=b>>>24&255}}}function c(c){for(;c>d;)Object.defineProperty(a.prototype,d,b(d)),d++}a.prototype=Object.create(null);var d=0;return a}(),S=[1,0,0,1,0,0],T=PDFJS.Util=function(){function a(){}var b=["rgb(",0,",",0,",",0,")"];return a.makeCssRgb=function(a,c,d){return b[1]=a,b[3]=c,b[5]=d,b.join("")},a.transform=function(a,b){return[a[0]*b[0]+a[2]*b[1],a[1]*b[0]+a[3]*b[1],a[0]*b[2]+a[2]*b[3],a[1]*b[2]+a[3]*b[3],a[0]*b[4]+a[2]*b[5]+a[4],a[1]*b[4]+a[3]*b[5]+a[5]]},a.applyTransform=function(a,b){var c=a[0]*b[0]+a[1]*b[2]+b[4],d=a[0]*b[1]+a[1]*b[3]+b[5];return[c,d]},a.applyInverseTransform=function(a,b){var c=b[0]*b[3]-b[1]*b[2],d=(a[0]*b[3]-a[1]*b[2]+b[2]*b[5]-b[4]*b[3])/c,e=(-a[0]*b[1]+a[1]*b[0]+b[4]*b[1]-b[5]*b[0])/c;return[d,e]},a.getAxialAlignedBoundingBox=function(b,c){var d=a.applyTransform(b,c),e=a.applyTransform(b.slice(2,4),c),f=a.applyTransform([b[0],b[3]],c),g=a.applyTransform([b[2],b[1]],c);return[Math.min(d[0],e[0],f[0],g[0]),Math.min(d[1],e[1],f[1],g[1]),Math.max(d[0],e[0],f[0],g[0]),Math.max(d[1],e[1],f[1],g[1])]},a.inverseTransform=function(a){var b=a[0]*a[3]-a[1]*a[2];return[a[3]/b,-a[1]/b,-a[2]/b,a[0]/b,(a[2]*a[5]-a[4]*a[3])/b,(a[4]*a[1]-a[5]*a[0])/b]},a.apply3dTransform=function(a,b){return[a[0]*b[0]+a[1]*b[1]+a[2]*b[2],a[3]*b[0]+a[4]*b[1]+a[5]*b[2],a[6]*b[0]+a[7]*b[1]+a[8]*b[2]]},a.singularValueDecompose2dScale=function(a){var b=[a[0],a[2],a[1],a[3]],c=a[0]*b[0]+a[1]*b[2],d=a[0]*b[1]+a[1]*b[3],e=a[2]*b[0]+a[3]*b[2],f=a[2]*b[1]+a[3]*b[3],g=(c+f)/2,h=Math.sqrt((c+f)*(c+f)-4*(c*f-e*d))/2,i=g+h||1,j=g-h||1;return[Math.sqrt(i),Math.sqrt(j)]},a.normalizeRect=function(a){var b=a.slice(0);return a[0]>a[2]&&(b[0]=a[2],b[2]=a[0]),a[1]>a[3]&&(b[1]=a[3],b[3]=a[1]),b},a.intersect=function(b,c){function d(a,b){return a-b}var e=[b[0],b[2],c[0],c[2]].sort(d),f=[b[1],b[3],c[1],c[3]].sort(d),g=[];return b=a.normalizeRect(b),c=a.normalizeRect(c),e[0]===b[0]&&e[1]===c[0]||e[0]===c[0]&&e[1]===b[0]?(g[0]=e[1],g[2]=e[2],f[0]===b[1]&&f[1]===c[1]||f[0]===c[1]&&f[1]===b[1]?(g[1]=f[1],g[3]=f[2],g):!1):!1},a.sign=function(a){return 0>a?-1:1},a.appendToArray=function(a,b){Array.prototype.push.apply(a,b)},a.prependToArray=function(a,b){Array.prototype.unshift.apply(a,b)},a.extendObj=function(a,b){for(var c in b)a[c]=b[c]},a.getInheritableProperty=function(a,b){for(;a&&!a.has(b);)a=a.get("Parent");return a?a.get(b):null},a.inherit=function(a,b,c){a.prototype=Object.create(b.prototype),a.prototype.constructor=a;for(var d in c)a.prototype[d]=c[d]},a.loadScript=function(a,b){var c=document.createElement("script"),d=!1;c.setAttribute("src",a),b&&(c.onload=function(){d||b(),d=!0}),document.getElementsByTagName("head")[0].appendChild(c)},a}();PDFJS.PageViewport=function(){function a(a,b,c,d,e,f){this.viewBox=a,this.scale=b,this.rotation=c,this.offsetX=d,this.offsetY=e;var g,h,i,j,k=(a[2]+a[0])/2,l=(a[3]+a[1])/2;switch(c%=360,c=0>c?c+360:c){case 180:g=-1,h=0,i=0,j=1;break;case 90:g=0,h=1,i=1,j=0;break;case 270:g=0,h=-1,i=-1,j=0;break;default:g=1,h=0,i=0,j=-1}f&&(i=-i,j=-j);var m,n,o,p;0===g?(m=Math.abs(l-a[1])*b+d,n=Math.abs(k-a[0])*b+e,o=Math.abs(a[3]-a[1])*b,p=Math.abs(a[2]-a[0])*b):(m=Math.abs(k-a[0])*b+d,n=Math.abs(l-a[1])*b+e,o=Math.abs(a[2]-a[0])*b,p=Math.abs(a[3]-a[1])*b),this.transform=[g*b,h*b,i*b,j*b,m-g*b*k-i*b*l,n-h*b*k-j*b*l],this.width=o,this.height=p,this.fontScale=b}return a.prototype={clone:function(b){b=b||{};var c="scale"in b?b.scale:this.scale,d="rotation"in b?b.rotation:this.rotation;return new a(this.viewBox.slice(),c,d,this.offsetX,this.offsetY,b.dontFlip)},convertToViewportPoint:function(a,b){return T.applyTransform([a,b],this.transform)},convertToViewportRectangle:function(a){var b=T.applyTransform([a[0],a[1]],this.transform),c=T.applyTransform([a[2],a[3]],this.transform);return[b[0],b[1],c[0],c[1]]},convertToPdfPoint:function(a,b){return T.applyInverseTransform([a,b],this.transform)}},a}();PDFJS.createPromiseCapability=s,function(){function a(a){this._status=c,this._handlers=[];try{a.call(this,this._resolve.bind(this),this._reject.bind(this))}catch(b){this._reject(b)}}if(z.Promise)return"function"!=typeof z.Promise.all&&(z.Promise.all=function(a){var b,c,d=0,e=[],f=new z.Promise(function(a,d){b=a,c=d});return a.forEach(function(a,f){d++,a.then(function(a){e[f]=a,d--,0===d&&b(e)},c)}),0===d&&b(e),f}),"function"!=typeof z.Promise.resolve&&(z.Promise.resolve=function(a){return new z.Promise(function(b){b(a)})}),"function"!=typeof z.Promise.reject&&(z.Promise.reject=function(a){return new z.Promise(function(b,c){c(a)})}),void("function"!=typeof z.Promise.prototype["catch"]&&(z.Promise.prototype["catch"]=function(a){return z.Promise.prototype.then(void 0,a)}));var c=0,d=1,e=2,f=500,g={handlers:[],running:!1,unhandledRejections:[],pendingRejectionCheck:!1,scheduleHandlers:function(a){a._status!==c&&(this.handlers=this.handlers.concat(a._handlers),a._handlers=[],this.running||(this.running=!0,setTimeout(this.runHandlers.bind(this),0)))},runHandlers:function(){for(var a=1,b=Date.now()+a;this.handlers.length>0;){var c=this.handlers.shift(),f=c.thisPromise._status,g=c.thisPromise._value;try{f===d?"function"==typeof c.onResolve&&(g=c.onResolve(g)):"function"==typeof c.onReject&&(g=c.onReject(g),f=d,c.thisPromise._unhandledRejection&&this.removeUnhandeledRejection(c.thisPromise))}catch(h){f=e,g=h}if(c.nextPromise._updateStatus(f,g),Date.now()>=b)break}return this.handlers.length>0?void setTimeout(this.runHandlers.bind(this),0):void(this.running=!1)},addUnhandledRejection:function(a){this.unhandledRejections.push({promise:a,time:Date.now()}),this.scheduleRejectionCheck()},removeUnhandeledRejection:function(a){a._unhandledRejection=!1;for(var b=0;bf){var d=this.unhandledRejections[c].promise._value,e="Unhandled rejection: "+d;d.stack&&(e+="\n"+d.stack),b(e),this.unhandledRejections.splice(c),c--}this.unhandledRejections.length&&this.scheduleRejectionCheck()}.bind(this),f))}};a.all=function(b){function c(a){g._status!==e&&(i=[],f(a))}var d,f,g=new a(function(a,b){d=a,f=b}),h=b.length,i=[];if(0===h)return d(i),g;for(var j=0,k=b.length;k>j;++j){var l=b[j],m=function(a){return function(b){g._status!==e&&(i[a]=b,h--,0===h&&d(i))}}(j);a.isPromise(l)?l.then(m,c):m(l)}return g},a.isPromise=function(a){return a&&"function"==typeof a.then},a.resolve=function(b){return new a(function(a){a(b)})},a.reject=function(b){return new a(function(a,c){c(b)})},a.prototype={_status:null,_value:null,_handlers:null,_unhandledRejection:null,_updateStatus:function(b,c){if(this._status!==d&&this._status!==e){if(b===d&&a.isPromise(c))return void c.then(this._updateStatus.bind(this,d),this._updateStatus.bind(this,e));this._status=b,this._value=c,b===e&&0===this._handlers.length&&(this._unhandledRejection=!0,g.addUnhandledRejection(this)),g.scheduleHandlers(this)}},_resolve:function(a){this._updateStatus(d,a)},_reject:function(a){this._updateStatus(e,a)},then:function(b,c){var d=new a(function(a,b){this.resolve=a,this.reject=b});return this._handlers.push({thisPromise:this,onResolve:b,onReject:c,nextPromise:d}),g.scheduleHandlers(this),d},"catch":function(a){return this.then(void 0,a)}},z.Promise=a}();var U=function(){function a(a,b,c){for(;a.lengthb;++b){var g=d[b].name;g.length>f&&(f=g.length)}for(b=0,c=d.length;c>b;++b){var h=d[b],i=h.end-h.start;e+=a(h.name," ",f)+" "+i+"ms\n"}return e}},c}();PDFJS.createBlob=function(a,b){if("undefined"!=typeof Blob)return new Blob([a],{type:b});var c=new MozBlobBuilder;return c.append(a),c.getBlob(b)},PDFJS.createObjectURL=function(){var a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";return function(b,c){if(!PDFJS.disableCreateObjectURL&&"undefined"!=typeof URL&&URL.createObjectURL){var d=PDFJS.createBlob(b,c);return URL.createObjectURL(d)}for(var e="data:"+c+";base64,",f=0,g=b.length;g>f;f+=3){var h=255&b[f],i=255&b[f+1],j=255&b[f+2],k=h>>2,l=(3&h)<<4|i>>4,m=g>f+1?(15&i)<<2|j>>6:64,n=g>f+2?63&j:64;e+=a[k]+a[l]+a[m]+a[n]}return e}}(),t.prototype={on:function(a,b,c){var e=this.actionHandler;e[a]&&d('There is already an actionName called "'+a+'"'),e[a]=[b,c]},send:function(a,b,c){var d={action:a,data:b};this.postMessage(d,c)},sendWithPromise:function(a,b,c){var d=this.callbackIndex++,e={action:a,data:b,callbackId:d},f=s();this.callbacksCapabilities[d]=f;try{this.postMessage(e,c)}catch(g){f.reject(g)}return f.promise},postMessage:function(a,b){b&&this.postMessageTransfers?this.comObj.postMessage(a,b):this.comObj.postMessage(a)}},PDFJS.maxImageSize=void 0===PDFJS.maxImageSize?-1:PDFJS.maxImageSize,PDFJS.cMapUrl=void 0===PDFJS.cMapUrl?null:PDFJS.cMapUrl,PDFJS.cMapPacked=void 0===PDFJS.cMapPacked?!1:PDFJS.cMapPacked,PDFJS.disableFontFace=void 0===PDFJS.disableFontFace?!1:PDFJS.disableFontFace,PDFJS.imageResourcesPath=void 0===PDFJS.imageResourcesPath?"":PDFJS.imageResourcesPath,PDFJS.disableWorker=void 0===PDFJS.disableWorker?!1:PDFJS.disableWorker,PDFJS.workerSrc=void 0===PDFJS.workerSrc?null:PDFJS.workerSrc,PDFJS.disableRange=void 0===PDFJS.disableRange?!1:PDFJS.disableRange,PDFJS.disableStream=void 0===PDFJS.disableStream?!1:PDFJS.disableStream,PDFJS.disableAutoFetch=void 0===PDFJS.disableAutoFetch?!1:PDFJS.disableAutoFetch,PDFJS.pdfBug=void 0===PDFJS.pdfBug?!1:PDFJS.pdfBug,PDFJS.postMessageTransfers=void 0===PDFJS.postMessageTransfers?!0:PDFJS.postMessageTransfers,PDFJS.disableCreateObjectURL=void 0===PDFJS.disableCreateObjectURL?!1:PDFJS.disableCreateObjectURL,PDFJS.disableWebGL=void 0===PDFJS.disableWebGL?!0:PDFJS.disableWebGL,PDFJS.disableFullscreen=void 0===PDFJS.disableFullscreen?!1:PDFJS.disableFullscreen,PDFJS.useOnlyCssZoom=void 0===PDFJS.useOnlyCssZoom?!1:PDFJS.useOnlyCssZoom,PDFJS.verbosity=void 0===PDFJS.verbosity?PDFJS.VERBOSITY_LEVELS.warnings:PDFJS.verbosity,PDFJS.maxCanvasPixels=void 0===PDFJS.maxCanvasPixels?16777216:PDFJS.maxCanvasPixels,PDFJS.openExternalLinksInNewWindow=void 0===PDFJS.openExternalLinksInNewWindow?!1:PDFJS.openExternalLinksInNewWindow,PDFJS.externalLinkTarget=void 0===PDFJS.externalLinkTarget?PDFJS.LinkTarget.NONE:PDFJS.externalLinkTarget,PDFJS.isEvalSupported=void 0===PDFJS.isEvalSupported?!0:PDFJS.isEvalSupported,PDFJS.getDocument=function(a,b,e,f){var h=new V;arguments.length>1&&c("getDocument is called with pdfDataRangeTransport, passwordCallback or progressCallback argument"),b&&(b instanceof W||(b=Object.create(b),b.length=a.length,b.initialData=a.initialData,b.abort||(b.abort=function(){})),a=Object.create(a),a.range=b),h.onPassword=e||null,h.onProgress=f||null;var i,j,k;"string"==typeof a?k={url:a}:r(a)?k={data:a}:a instanceof W?k={range:a}:("object"!=typeof a&&d("Invalid parameter in getDocument, need either Uint8Array, string or a parameter object"),a.url||a.data||a.range||d("Invalid parameter object: need either .data, .range or .url"),k=a);var m={};for(var n in k)if("url"!==n||"undefined"==typeof window){if("range"!==n)if("data"!==n||k[n]instanceof Uint8Array)m[n]=k[n];else{var o=k[n];"string"==typeof o?m[n]=l(o):"object"!=typeof o||null===o||isNaN(o.length)?r(o)?m[n]=new Uint8Array(o):d("Invalid PDF binary data: either typed array, string or array-like object is expected in the data property."):m[n]=new Uint8Array(o)}}else m[n]=g(window.location.href,k[n]);return i=s(),j=new Z(i,k.range),i.promise.then(function(){j.fetchDocument(h,m)}),h._transport=j,h};var V=function(){function a(){this._capability=s(),this._transport=null,this.onPassword=null,this.onProgress=null}return a.prototype={get promise(){return this._capability.promise},destroy:function(){return this._transport.destroy()},then:function(a,b){return this.promise.then.apply(this.promise,arguments)}},a}(),W=function(){function a(a,b){this.length=a,this.initialData=b,this._rangeListeners=[],this._progressListeners=[],this._progressiveReadListeners=[],this._readyCapability=s()}return a.prototype={addRangeListener:function(a){this._rangeListeners.push(a)},addProgressListener:function(a){this._progressListeners.push(a)},addProgressiveReadListener:function(a){this._progressiveReadListeners.push(a)},onDataRange:function(a,b){for(var c=this._rangeListeners,d=0,e=c.length;e>d;++d)c[d](a,b)},onDataProgress:function(a){this._readyCapability.promise.then(function(){for(var b=this._progressListeners,c=0,d=b.length;d>c;++c)b[c](a)}.bind(this))},onDataProgressiveRead:function(a){this._readyCapability.promise.then(function(){for(var b=this._progressiveReadListeners,c=0,d=b.length;d>c;++c)b[c](a)}.bind(this))},transportReady:function(){this._readyCapability.resolve()},requestDataRange:function(a,b){throw new Error("Abstract method PDFDataRangeTransport.requestDataRange")},abort:function(){}},a}();PDFJS.PDFDataRangeTransport=W;var X=function(){function a(a,b,c){this.pdfInfo=a,this.transport=b,this.loadingTask=c}return a.prototype={get numPages(){return this.pdfInfo.numPages},get fingerprint(){return this.pdfInfo.fingerprint},getPage:function(a){return this.transport.getPage(a)},getPageIndex:function(a){return this.transport.getPageIndex(a)},getDestinations:function(){return this.transport.getDestinations()},getDestination:function(a){return this.transport.getDestination(a)},getAttachments:function(){return this.transport.getAttachments()},getJavaScript:function(){return this.transport.getJavaScript()},getOutline:function(){return this.transport.getOutline()},getMetadata:function(){return this.transport.getMetadata()},getData:function(){return this.transport.getData()},getDownloadInfo:function(){return this.transport.downloadInfoCapability.promise},getStats:function(){return this.transport.getStats()},cleanup:function(){this.transport.startCleanup()},destroy:function(){return this.transport.destroy()}},a}(),Y=function(){function a(a,b,c){this.pageIndex=a,this.pageInfo=b,this.transport=c,this.stats=new U,this.stats.enabled=!!z.PDFJS.enableStats,this.commonObjs=c.commonObjs,this.objs=new $,this.cleanupAfterRender=!1,this.pendingCleanup=!1,this.intentStates={},this.destroyed=!1}return a.prototype={get pageNumber(){return this.pageIndex+1},get rotate(){return this.pageInfo.rotate; +},get ref(){return this.pageInfo.ref},get view(){return this.pageInfo.view},getViewport:function(a,b){return arguments.length<2&&(b=this.rotate),new PDFJS.PageViewport(this.view,a,b,0,0)},getAnnotations:function(){return this.annotationsPromise||(this.annotationsPromise=this.transport.getAnnotations(this.pageIndex)),this.annotationsPromise},render:function(a){function b(a){var b=f.renderTasks.indexOf(g);b>=0&&f.renderTasks.splice(b,1),i.cleanupAfterRender&&(i.pendingCleanup=!0),i._tryCleanup(),a?g.capability.reject(a):g.capability.resolve(),d.timeEnd("Rendering"),d.timeEnd("Overall")}var d=this.stats;d.time("Overall"),this.pendingCleanup=!1;var e="print"===a.intent?"print":"display";this.intentStates[e]||(this.intentStates[e]={});var f=this.intentStates[e];f.displayReadyCapability||(f.receivingOperatorList=!0,f.displayReadyCapability=s(),f.operatorList={fnArray:[],argsArray:[],lastChunk:!1},this.stats.time("Page Request"),this.transport.messageHandler.send("RenderPageRequest",{pageIndex:this.pageNumber-1,intent:e}));var g=new aa(b,a,this.objs,this.commonObjs,f.operatorList,this.pageNumber);g.useRequestAnimationFrame="print"!==e,f.renderTasks||(f.renderTasks=[]),f.renderTasks.push(g);var h=g.task;a.continueCallback&&(c("render is used with continueCallback parameter"),h.onContinue=a.continueCallback);var i=this;return f.displayReadyCapability.promise.then(function(a){return i.pendingCleanup?void b():(d.time("Rendering"),g.initalizeGraphics(a),void g.operatorListChanged())},function(a){b(a)}),h},getOperatorList:function(){function a(){c.operatorList.lastChunk&&c.opListReadCapability.resolve(c.operatorList)}var b="oplist";this.intentStates[b]||(this.intentStates[b]={});var c=this.intentStates[b];if(!c.opListReadCapability){var d={};d.operatorListChanged=a,c.receivingOperatorList=!0,c.opListReadCapability=s(),c.renderTasks=[],c.renderTasks.push(d),c.operatorList={fnArray:[],argsArray:[],lastChunk:!1},this.transport.messageHandler.send("RenderPageRequest",{pageIndex:this.pageIndex,intent:b})}return c.opListReadCapability.promise},getTextContent:function(){return this.transport.messageHandler.sendWithPromise("GetTextContent",{pageIndex:this.pageNumber-1})},_destroy:function(){this.destroyed=!0,this.transport.pageCache[this.pageIndex]=null;var a=[];return Object.keys(this.intentStates).forEach(function(b){var c=this.intentStates[b];c.renderTasks.forEach(function(b){var c=b.capability.promise["catch"](function(){});a.push(c),b.cancel()})},this),this.objs.clear(),this.annotationsPromise=null,this.pendingCleanup=!1,Promise.all(a)},destroy:function(){c("page destroy method, use cleanup() instead"),this.cleanup()},cleanup:function(){this.pendingCleanup=!0,this._tryCleanup()},_tryCleanup:function(){this.pendingCleanup&&!Object.keys(this.intentStates).some(function(a){var b=this.intentStates[a];return 0!==b.renderTasks.length||b.receivingOperatorList},this)&&(Object.keys(this.intentStates).forEach(function(a){delete this.intentStates[a]},this),this.objs.clear(),this.annotationsPromise=null,this.pendingCleanup=!1)},_startRenderPage:function(a,b){var c=this.intentStates[b];c.displayReadyCapability&&c.displayReadyCapability.resolve(a)},_renderPageChunk:function(a,b){var c,d,e=this.intentStates[b];for(c=0,d=a.length;d>c;c++)e.operatorList.fnArray.push(a.fnArray[c]),e.operatorList.argsArray.push(a.argsArray[c]);for(e.operatorList.lastChunk=a.lastChunk,c=0;ch&&(g.cleanupAfterRender=!0);break;default:d("Got unknown object type "+f)}},this),a.on("DocProgress",function(a){var b=this.loadingTask;b.onProgress&&b.onProgress({loaded:a.loaded,total:a.total})},this),a.on("PageError",function(a){var b=this.pageCache[a.pageNum-1],c=b.intentStates[a.intent];c.displayReadyCapability?c.displayReadyCapability.reject(a.error):d(a.error)},this),a.on("JpegDecode",function(a){var b=a[0],c=a[1];return 3!==c&&1!==c?Promise.reject(new Error("Only 3 components or 1 component can be returned")):new Promise(function(a,d){var e=new Image;e.onload=function(){var b=e.width,d=e.height,f=b*d,g=4*f,h=new Uint8Array(f*c),i=v(b,d),j=i.getContext("2d");j.drawImage(e,0,0);var k,l,m=j.getImageData(0,0,b,d).data;if(3===c)for(k=0,l=0;g>k;k+=4,l+=3)h[l]=m[k],h[l+1]=m[k+1],h[l+2]=m[k+2];else if(1===c)for(k=0,l=0;g>k;k+=4,l++)h[l]=m[k];a({data:h,width:b,height:d})},e.onerror=function(){d(new Error("JpegDecode failed to load image"))},e.src=b})})},fetchDocument:function(a,b){return this.destroyed?(a._capability.reject(new Error("Loading aborted")),void this.destroyCapability.resolve()):(this.loadingTask=a,b.disableAutoFetch=PDFJS.disableAutoFetch,b.disableStream=PDFJS.disableStream,b.chunkedViewerLoading=!!this.pdfDataRangeTransport,this.pdfDataRangeTransport&&(b.length=this.pdfDataRangeTransport.length,b.initialData=this.pdfDataRangeTransport.initialData),void this.messageHandler.send("GetDocRequest",{source:b,disableRange:PDFJS.disableRange,maxImageSize:PDFJS.maxImageSize,cMapUrl:PDFJS.cMapUrl,cMapPacked:PDFJS.cMapPacked,disableFontFace:PDFJS.disableFontFace,disableCreateObjectURL:PDFJS.disableCreateObjectURL,verbosity:PDFJS.verbosity}))},getData:function(){return this.messageHandler.sendWithPromise("GetData",null)},getPage:function(a,b){if(0>=a||a>this.numPages||(0|a)!==a)return Promise.reject(new Error("Invalid page request"));var c=a-1;if(c in this.pagePromises)return this.pagePromises[c];var d=this.messageHandler.sendWithPromise("GetPage",{pageIndex:c}).then(function(a){if(this.destroyed)throw new Error("Transport destroyed");var b=new Y(c,a,this);return this.pageCache[c]=b,b}.bind(this));return this.pagePromises[c]=d,d},getPageIndex:function(a){return this.messageHandler.sendWithPromise("GetPageIndex",{ref:a})},getAnnotations:function(a){return this.messageHandler.sendWithPromise("GetAnnotations",{pageIndex:a})},getDestinations:function(){return this.messageHandler.sendWithPromise("GetDestinations",null)},getDestination:function(a){return this.messageHandler.sendWithPromise("GetDestination",{id:a})},getAttachments:function(){return this.messageHandler.sendWithPromise("GetAttachments",null)},getJavaScript:function(){return this.messageHandler.sendWithPromise("GetJavaScript",null)},getOutline:function(){return this.messageHandler.sendWithPromise("GetOutline",null)},getMetadata:function(){return this.messageHandler.sendWithPromise("GetMetadata",null).then(function(a){return{info:a[0],metadata:a[1]?new PDFJS.Metadata(a[1]):null}})},getStats:function(){return this.messageHandler.sendWithPromise("GetStats",null)},startCleanup:function(){this.messageHandler.sendWithPromise("Cleanup",null).then(function(){for(var a=0,b=this.pageCache.length;b>a;a++){var c=this.pageCache[a];c&&c.cleanup()}this.commonObjs.clear(),pa.clear()}.bind(this))}},c}(),$=function(){function a(){this.objs={}}return a.prototype={ensureObj:function(a){if(this.objs[a])return this.objs[a];var b={capability:s(),data:null,resolved:!1};return this.objs[a]=b,b},get:function(a,b){if(b)return this.ensureObj(a).capability.promise.then(b),null;var c=this.objs[a];return c&&c.resolved||d("Requesting object that isn't resolved yet "+a),c.data},resolve:function(a,b){var c=this.ensureObj(a);c.resolved=!0,c.data=b,c.capability.resolve(b)},isResolved:function(a){var b=this.objs;return b[a]?b[a].resolved:!1},hasData:function(a){return this.isResolved(a)},getData:function(a){var b=this.objs;return b[a]&&b[a].resolved?b[a].data:null},clear:function(){this.objs={}}},a}(),_=function(){function a(a){this._internalRenderTask=a,this.onContinue=null}return a.prototype={get promise(){return this._internalRenderTask.capability.promise},cancel:function(){this._internalRenderTask.cancel()},then:function(a,b){return this.promise.then.apply(this.promise,arguments)}},a}(),aa=function(){function a(a,b,c,d,e,f){this.callback=a,this.params=b,this.objs=c,this.commonObjs=d,this.operatorListIdx=null,this.operatorList=e,this.pageNumber=f,this.running=!1,this.graphicsReadyCallback=null,this.graphicsReady=!1,this.useRequestAnimationFrame=!1,this.cancelled=!1,this.capability=s(),this.task=new _(this),this._continueBound=this._continue.bind(this),this._scheduleNextBound=this._scheduleNext.bind(this),this._nextBound=this._next.bind(this)}return a.prototype={initalizeGraphics:function(a){if(!this.cancelled){PDFJS.pdfBug&&"StepperManager"in z&&z.StepperManager.enabled&&(this.stepper=z.StepperManager.create(this.pageNumber-1),this.stepper.init(this.operatorList),this.stepper.nextBreakPoint=this.stepper.getNextBreakPoint());var b=this.params;this.gfx=new ka(b.canvasContext,this.commonObjs,this.objs,b.imageLayer),this.gfx.beginDrawing(b.viewport,a),this.operatorListIdx=0,this.graphicsReady=!0,this.graphicsReadyCallback&&this.graphicsReadyCallback()}},cancel:function(){this.running=!1,this.cancelled=!0,this.callback("cancelled")},operatorListChanged:function(){return this.graphicsReady?(this.stepper&&this.stepper.updateOperatorList(this.operatorList),void(this.running||this._continue())):void(this.graphicsReadyCallback||(this.graphicsReadyCallback=this._continueBound))},_continue:function(){this.running=!0,this.cancelled||(this.task.onContinue?this.task.onContinue.call(this.task,this._scheduleNextBound):this._scheduleNext())},_scheduleNext:function(){this.useRequestAnimationFrame?window.requestAnimationFrame(this._nextBound):Promise.resolve(void 0).then(this._nextBound)},_next:function(){this.cancelled||(this.operatorListIdx=this.gfx.executeOperatorList(this.operatorList,this.operatorListIdx,this._continueBound,this.stepper),this.operatorListIdx===this.operatorList.argsArray.length&&(this.running=!1,this.operatorList.lastChunk&&(this.gfx.endDrawing(),this.callback())))}},a}(),ba=(PDFJS.Metadata=function(){function a(a){return a.replace(/>\\376\\377([^<]+)/g,function(a,b){for(var c=b.replace(/\\([0-3])([0-7])([0-7])/g,function(a,b,c,d){return String.fromCharCode(64*b+8*c+1*d)}),d="",e=0;e"+d})}function b(b){if("string"==typeof b){b=a(b);var c=new DOMParser;b=c.parseFromString(b,"application/xml")}else b instanceof Document||d("Metadata: Invalid metadata object");this.metaDocument=b,this.metadata={},this.parse()}return b.prototype={parse:function(){var a=this.metaDocument,b=a.documentElement;if("rdf:rdf"!==b.nodeName.toLowerCase())for(b=b.firstChild;b&&"rdf:rdf"!==b.nodeName.toLowerCase();)b=b.nextSibling;var c=b?b.nodeName.toLowerCase():null;if(b&&"rdf:rdf"===c&&b.hasChildNodes()){var d,e,f,g,h,i,j,k=b.childNodes;for(g=0,i=k.length;i>g;g++)if(d=k[g],"rdf:description"===d.nodeName.toLowerCase())for(h=0,j=d.childNodes.length;j>h;h++)"#text"!==d.childNodes[h].nodeName.toLowerCase()&&(e=d.childNodes[h],f=e.nodeName.toLowerCase(),this.metadata[f]=e.textContent.trim())}},get:function(a){return this.metadata[a]||null},has:function(a){return"undefined"!=typeof this.metadata[a]}},b}(),16),ca=100,da=4096,ea=.65,fa=!0,ga=1e3,ha=16,ia=function(){var a={};return{getCanvas:function(b,c,d,e){var f;if(void 0!==a[b])f=a[b],f.canvas.width=c,f.canvas.height=d,f.context.setTransform(1,0,0,1,0,0);else{var g=v(c,d),h=g.getContext("2d");e&&w(h),a[b]=f={canvas:g,context:h}}return f},clear:function(){for(var b in a){var c=a[b];c.canvas.width=0,c.canvas.height=0,delete a[b]}}}}(),ja=function(){function a(a){this.alphaIsShape=!1,this.fontSize=0,this.fontSizeScale=1,this.textMatrix=S,this.textMatrixScale=1,this.fontMatrix=B,this.leading=0,this.x=0,this.y=0,this.lineX=0,this.lineY=0,this.charSpacing=0,this.wordSpacing=0,this.textHScale=1,this.textRenderingMode=C.FILL,this.textRise=0,this.fillColor="#000000",this.strokeColor="#000000",this.patternFill=!1,this.fillAlpha=1,this.strokeAlpha=1,this.lineWidth=1,this.activeSMask=null,this.old=a}return a.prototype={clone:function(){return Object.create(this)},setCurrentPoint:function(a,b){this.x=a,this.y=b}},a}(),ka=function(){function c(a,b,c,d){this.ctx=a,this.current=new ja,this.stateStack=[],this.pendingClip=null,this.pendingEOFill=!1,this.res=null,this.xobjs=null,this.commonObjs=b,this.objs=c,this.imageLayer=d,this.groupStack=[],this.processingType3=null,this.baseTransform=null,this.baseTransformStack=[],this.groupLevel=0,this.smaskStack=[],this.smaskCounter=0,this.tempSMask=null,a&&w(a),this.cachedGetSinglePixelWidth=null}function e(a,b){if("undefined"!=typeof ImageData&&b instanceof ImageData)return void a.putImageData(b,0,0);var c,e,f,g,h,i=b.height,j=b.width,k=i%ha,l=(i-k)/ha,m=0===k?l:l+1,n=a.createImageData(j,ha),o=0,p=b.data,q=n.data;if(b.kind===D.GRAYSCALE_1BPP){var r=p.byteLength,s=PDFJS.hasCanvasTypedArrays?new Uint32Array(q.buffer):new R(q),t=s.length,u=j+7>>3,v=4294967295,w=PDFJS.isLittleEndian||!PDFJS.hasCanvasTypedArrays?4278190080:255;for(e=0;m>e;e++){for(g=l>e?ha:k,c=0,f=0;g>f;f++){for(var x=r-o,y=0,z=x>u?j:8*x-7,A=-8&z,B=0,C=0;A>y;y+=8)C=p[o++],s[c++]=128&C?v:w,s[c++]=64&C?v:w,s[c++]=32&C?v:w,s[c++]=16&C?v:w,s[c++]=8&C?v:w,s[c++]=4&C?v:w,s[c++]=2&C?v:w,s[c++]=1&C?v:w;for(;z>y;y++)0===B&&(C=p[o++],B=128),s[c++]=C&B?v:w,B>>=1}for(;t>c;)s[c++]=0;a.putImageData(n,0,e*ha)}}else if(b.kind===D.RGBA_32BPP){for(f=0,h=j*ha*4,e=0;l>e;e++)q.set(p.subarray(o,o+h)),o+=h,a.putImageData(n,0,f),f+=ha;m>e&&(h=j*k*4,q.set(p.subarray(o,o+h)),a.putImageData(n,0,f))}else if(b.kind===D.RGB_24BPP)for(g=ha,h=j*g,e=0;m>e;e++){for(e>=l&&(g=k,h=j*g),c=0,f=h;f--;)q[c++]=p[o++],q[c++]=p[o++],q[c++]=p[o++],q[c++]=255;a.putImageData(n,0,e*ha)}else d("bad image kind: "+b.kind)}function g(a,b){for(var c=b.height,d=b.width,e=c%ha,f=(c-e)/ha,g=0===e?f:f+1,h=a.createImageData(d,ha),i=0,j=b.data,k=h.data,l=0;g>l;l++){for(var m=f>l?ha:e,n=3,o=0;m>o;o++)for(var p=0,q=0;d>q;q++){if(!p){var r=j[i++];p=128}k[n]=r&p?0:255,n+=4,p>>=1}a.putImageData(h,0,l*ha)}}function h(a,b){for(var c=["strokeStyle","fillStyle","fillRule","globalAlpha","lineWidth","lineCap","lineJoin","miterLimit","globalCompositeOperation","font"],d=0,e=c.length;e>d;d++){var f=c[d];void 0!==a[f]&&(b[f]=a[f])}void 0!==a.setLineDash?(b.setLineDash(a.getLineDash()),b.lineDashOffset=a.lineDashOffset):void 0!==a.mozDashOffset&&(b.mozDash=a.mozDash,b.mozDashOffset=a.mozDashOffset)}function j(a,b,c,d){for(var e=a.length,f=3;e>f;f+=4){var g=a[f];if(0===g)a[f-3]=b,a[f-2]=c,a[f-1]=d;else if(255>g){var h=255-g;a[f-3]=a[f-3]*g+b*h>>8,a[f-2]=a[f-2]*g+c*h>>8,a[f-1]=a[f-1]*g+d*h>>8}}}function k(a,b){for(var c=a.length,d=1/255,e=3;c>e;e+=4){var f=a[e];b[e]=b[e]*f*d|0}}function l(a,b){for(var c=a.length,d=3;c>d;d+=4){var e=77*a[d-3]+152*a[d-2]+28*a[d-1];b[d]=b[d]*e>>16}}function m(a,b,c,d,e,f){var g,h=!!f,i=h?f[0]:0,m=h?f[1]:0,n=h?f[2]:0;g="Luminosity"===e?l:k;for(var o=1048576,p=Math.min(d,Math.ceil(o/c)),q=0;d>q;q+=p){var r=Math.min(p,d-q),s=a.getImageData(0,q,c,r),t=b.getImageData(0,q,c,r);h&&j(s.data,i,m,n),g(s.data,t.data),a.putImageData(t,0,q)}}function n(a,b,c){var d=b.canvas,e=b.context;a.setTransform(b.scaleX,0,0,b.scaleY,b.offsetX,b.offsetY);var f=b.backdrop||null;if(la.isEnabled){var g=la.composeSMask(c.canvas,d,{subtype:b.subtype,backdrop:f});return a.setTransform(1,0,0,1,0,0),void a.drawImage(g,b.offsetX,b.offsetY)}m(e,c,d.width,d.height,b.subtype,f),a.drawImage(d,0,0)}var o=15,r=10,s=["butt","round","square"],t=["miter","round","bevel"],u={},v={};c.prototype={beginDrawing:function(a,b){var c=this.ctx.canvas.width,d=this.ctx.canvas.height;b?this.ctx.clearRect(0,0,c,d):(this.ctx.mozOpaque=!0,this.ctx.save(),this.ctx.fillStyle="rgb(255, 255, 255)",this.ctx.fillRect(0,0,c,d),this.ctx.restore());var e=a.transform;this.ctx.save(),this.ctx.transform.apply(this.ctx,e),this.baseTransform=this.ctx.mozCurrentTransform.slice(),this.imageLayer&&this.imageLayer.beginLayout()},executeOperatorList:function(a,b,c,d){var e=a.argsArray,f=a.fnArray,g=b||0,h=e.length;if(h===g)return g;for(var i,j=h-g>r&&"function"==typeof c,k=j?Date.now()+o:0,l=0,m=this.commonObjs,n=this.objs;;){if(void 0!==d&&g===d.nextBreakPoint)return d.breakIt(g,c),g;if(i=f[g],i!==G.dependency)this[i].apply(this,e[g]);else for(var p=e[g],q=0,s=p.length;s>q;q++){var t=p[q],u="g"===t[0]&&"_"===t[1],v=u?m:n;if(!v.isResolved(t))return v.get(t,c),g}if(g++,g===h)return g;if(j&&++l>r){if(Date.now()>k)return c(),g;l=0}}},endDrawing:function(){this.ctx.restore(),ia.clear(),la.clear(),this.imageLayer&&this.imageLayer.endLayout()},setLineWidth:function(a){this.current.lineWidth=a,this.ctx.lineWidth=a},setLineCap:function(a){this.ctx.lineCap=s[a]},setLineJoin:function(a){this.ctx.lineJoin=t[a]},setMiterLimit:function(a){this.ctx.miterLimit=a},setDash:function(a,b){var c=this.ctx;void 0!==c.setLineDash?(c.setLineDash(a),c.lineDashOffset=b):(c.mozDash=a,c.mozDashOffset=b)},setRenderingIntent:function(a){},setFlatness:function(a){},setGState:function(a){for(var c=0,d=a.length;d>c;c++){var e=a[c],f=e[0],g=e[1];switch(f){case"LW":this.setLineWidth(g);break;case"LC":this.setLineCap(g);break;case"LJ":this.setLineJoin(g);break;case"ML":this.setMiterLimit(g);break;case"D":this.setDash(g[0],g[1]);break;case"RI":this.setRenderingIntent(g);break;case"FL":this.setFlatness(g);break;case"Font":this.setFont(g[0],g[1]);break;case"CA":this.current.strokeAlpha=e[1];break;case"ca":this.current.fillAlpha=e[1],this.ctx.globalAlpha=e[1];break;case"BM":if(g&&g.name&&"Normal"!==g.name){var h=g.name.replace(/([A-Z])/g,function(a){return"-"+a.toLowerCase()}).substring(1);this.ctx.globalCompositeOperation=h,this.ctx.globalCompositeOperation!==h&&b('globalCompositeOperation "'+h+'" is not supported')}else this.ctx.globalCompositeOperation="source-over";break;case"SMask":this.current.activeSMask&&this.endSMaskGroup(),this.current.activeSMask=g?this.tempSMask:null,this.current.activeSMask&&this.beginSMaskGroup(),this.tempSMask=null}}},beginSMaskGroup:function(){var a=this.current.activeSMask,b=a.canvas.width,c=a.canvas.height,d="smaskGroupAt"+this.groupLevel,e=ia.getCanvas(d,b,c,!0),f=this.ctx,g=f.mozCurrentTransform;this.ctx.save();var i=e.context;i.scale(1/a.scaleX,1/a.scaleY),i.translate(-a.offsetX,-a.offsetY),i.transform.apply(i,g),h(f,i),this.ctx=i,this.setGState([["BM","Normal"],["ca",1],["CA",1]]),this.groupStack.push(f),this.groupLevel++},endSMaskGroup:function(){var a=this.ctx;this.groupLevel--,this.ctx=this.groupStack.pop(),n(this.ctx,this.current.activeSMask,a),this.ctx.restore()},save:function(){this.ctx.save();var a=this.current;this.stateStack.push(a),this.current=a.clone(),this.current.activeSMask=null},restore:function(){0!==this.stateStack.length&&(null!==this.current.activeSMask&&this.endSMaskGroup(),this.current=this.stateStack.pop(),this.ctx.restore(),this.pendingClip=null,this.cachedGetSinglePixelWidth=null)},transform:function(a,b,c,d,e,f){this.ctx.transform(a,b,c,d,e,f),this.cachedGetSinglePixelWidth=null},constructPath:function(a,b){for(var c=this.ctx,d=this.current,e=d.x,f=d.y,g=0,h=0,i=a.length;i>g;g++)switch(0|a[g]){case G.rectangle:e=b[h++],f=b[h++];var j=b[h++],k=b[h++];0===j&&(j=this.getSinglePixelWidth()),0===k&&(k=this.getSinglePixelWidth());var l=e+j,m=f+k;this.ctx.moveTo(e,f),this.ctx.lineTo(l,f),this.ctx.lineTo(l,m),this.ctx.lineTo(e,m),this.ctx.lineTo(e,f),this.ctx.closePath();break;case G.moveTo:e=b[h++],f=b[h++],c.moveTo(e,f);break;case G.lineTo:e=b[h++],f=b[h++],c.lineTo(e,f);break;case G.curveTo:e=b[h+4],f=b[h+5],c.bezierCurveTo(b[h],b[h+1],b[h+2],b[h+3],e,f),h+=6;break;case G.curveTo2:c.bezierCurveTo(e,f,b[h],b[h+1],b[h+2],b[h+3]),e=b[h+2],f=b[h+3],h+=4;break;case G.curveTo3:e=b[h+2],f=b[h+3],c.bezierCurveTo(b[h],b[h+1],e,f,e,f),h+=4;break;case G.closePath:c.closePath()}d.setCurrentPoint(e,f)},closePath:function(){this.ctx.closePath()},stroke:function(a){a="undefined"!=typeof a?a:!0;var b=this.ctx,c=this.current.strokeColor;b.lineWidth=Math.max(this.getSinglePixelWidth()*ea,this.current.lineWidth),b.globalAlpha=this.current.strokeAlpha,c&&c.hasOwnProperty("type")&&"Pattern"===c.type?(b.save(),b.strokeStyle=c.getPattern(b,this),b.stroke(),b.restore()):b.stroke(),a&&this.consumePath(),b.globalAlpha=this.current.fillAlpha},closeStroke:function(){this.closePath(),this.stroke()},fill:function(a){a="undefined"!=typeof a?a:!0;var b=this.ctx,c=this.current.fillColor,d=this.current.patternFill,e=!1;d&&(b.save(),b.fillStyle=c.getPattern(b,this),e=!0),this.pendingEOFill?(void 0!==b.mozFillRule?(b.mozFillRule="evenodd",b.fill(),b.mozFillRule="nonzero"):b.fill("evenodd"),this.pendingEOFill=!1):b.fill(),e&&b.restore(),a&&this.consumePath()},eoFill:function(){this.pendingEOFill=!0,this.fill()},fillStroke:function(){this.fill(!1),this.stroke(!1),this.consumePath()},eoFillStroke:function(){this.pendingEOFill=!0,this.fillStroke()},closeFillStroke:function(){this.closePath(),this.fillStroke()},closeEOFillStroke:function(){this.pendingEOFill=!0,this.closePath(),this.fillStroke()},endPath:function(){this.consumePath()},clip:function(){this.pendingClip=u},eoClip:function(){this.pendingClip=v},beginText:function(){this.current.textMatrix=S,this.current.textMatrixScale=1,this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0},endText:function(){var a=this.pendingTextPaths,b=this.ctx;if(void 0===a)return void b.beginPath();b.save(),b.beginPath();for(var c=0;cc?(c=-c,f.fontDirection=-1):f.fontDirection=1,this.current.font=e,this.current.fontSize=c,!e.isType3Font){var g=e.loadedName||"sans-serif",h=e.black?e.bold?"900":"bold":e.bold?"bold":"normal",i=e.italic?"italic":"normal",j='"'+g+'", '+e.fallbackName,k=ba>c?ba:c>ca?ca:c;this.current.fontSizeScale=c/k;var l=i+" "+h+" "+k+"px "+j;this.ctx.font=l}},setTextRenderingMode:function(a){this.current.textRenderingMode=a},setTextRise:function(a){this.current.textRise=a},moveText:function(a,b){this.current.x=this.current.lineX+=a,this.current.y=this.current.lineY+=b},setLeadingMoveText:function(a,b){this.setLeading(-b),this.moveText(a,b)},setTextMatrix:function(a,b,c,d,e,f){this.current.textMatrix=[a,b,c,d,e,f],this.current.textMatrixScale=Math.sqrt(a*a+b*b),this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0},nextLine:function(){this.moveText(0,this.current.leading)},paintChar:function(a,b,c){var d,e=this.ctx,f=this.current,g=f.font,h=f.textRenderingMode,i=f.fontSize/f.fontSizeScale,j=h&C.FILL_STROKE_MASK,k=!!(h&C.ADD_TO_PATH_FLAG);if((g.disableFontFace||k)&&(d=g.getPathGenerator(this.commonObjs,a)),g.disableFontFace?(e.save(),e.translate(b,c),e.beginPath(),d(e,i),(j===C.FILL||j===C.FILL_STROKE)&&e.fill(),(j===C.STROKE||j===C.FILL_STROKE)&&e.stroke(),e.restore()):((j===C.FILL||j===C.FILL_STROKE)&&e.fillText(a,b,c),(j===C.STROKE||j===C.FILL_STROKE)&&e.strokeText(a,b,c)),k){var l=this.pendingTextPaths||(this.pendingTextPaths=[]);l.push({transform:e.mozCurrentTransform,x:b,y:c,fontSize:i,addToPath:d})}},get isFontSubpixelAAEnabled(){var a=document.createElement("canvas").getContext("2d");a.scale(1.5,1),a.fillText("I",0,10);for(var b=a.getImageData(0,0,10,10).data,c=!1,d=3;d0&&b[d]<255){c=!0;break}return i(this,"isFontSubpixelAAEnabled",c)},showText:function(a){var b=this.current,c=b.font;if(c.isType3Font)return this.showType3Text(a);var d=b.fontSize;if(0!==d){var e=this.ctx,f=b.fontSizeScale,g=b.charSpacing,h=b.wordSpacing,i=b.fontDirection,j=b.textHScale*i,k=a.length,l=c.vertical,m=l?1:-1,n=c.defaultVMetrics,o=d*b.fontMatrix[0],q=b.textRenderingMode===C.FILL&&!c.disableFontFace;e.save(),e.transform.apply(e,b.textMatrix),e.translate(b.x,b.y+b.textRise),i>0?e.scale(j,-1):e.scale(j,1);var r=b.lineWidth,s=b.textMatrixScale;if(0===s||0===r){var t=b.textRenderingMode&C.FILL_STROKE_MASK;(t===C.STROKE||t===C.FILL_STROKE)&&(this.cachedGetSinglePixelWidth=null,r=this.getSinglePixelWidth()*ea)}else r/=s;1!==f&&(e.scale(f,f),r/=f),e.lineWidth=r;var u,v=0;for(u=0;k>u;++u){var w=a[u];if(null!==w)if(p(w))v+=m*w*d/1e3;else{var x,y,z,A,B=!1,D=w.fontChar,E=w.accent,F=w.width;if(l){var G,H,I;G=w.vmetric||n,H=w.vmetric?G[1]:.5*F,H=-H*o,I=G[2]*o,F=G?-G[0]:F,x=H/f,y=(v+I)/f}else x=v/f,y=0;if(c.remeasure&&F>0&&this.isFontSubpixelAAEnabled){var J=1e3*e.measureText(D).width/d*f,K=F/J;B=!0,e.save(),e.scale(K,1),x/=K}q&&!E?e.fillText(D,x,y):(this.paintChar(D,x,y),E&&(z=x+E.offset.x/f,A=y-E.offset.y/f,this.paintChar(E.fontChar,z,A)));var L=F*o+g*i;v+=L,B&&e.restore()}else v+=i*h}l?b.y-=v*j:b.x+=v*j,e.restore()}},showType3Text:function(a){var c,d,e,f,g=this.ctx,h=this.current,i=h.font,j=h.fontSize,k=h.fontDirection,l=i.vertical?1:-1,m=h.charSpacing,n=h.wordSpacing,o=h.textHScale*k,q=h.fontMatrix||B,r=a.length,s=h.textRenderingMode===C.INVISIBLE;if(!s&&0!==j){for(this.cachedGetSinglePixelWidth=null,g.save(),g.transform.apply(g,h.textMatrix),g.translate(h.x,h.y),g.scale(o,k),c=0;r>c;++c)if(d=a[c],null!==d)if(p(d))f=l*d*j/1e3,this.ctx.translate(f,0),h.x+=f*o;else{var t=i.charProcOperatorList[d.operatorListId];if(t){this.processingType3=d,this.save(),g.scale(j,j),g.transform.apply(g,q),this.executeOperatorList(t),this.restore();var u=T.applyTransform([d.width,0],q);e=u[0]*j+m,g.translate(e,0),h.x+=e*o}else b('Type3 character "'+d.operatorListId+'" is not available')}else this.ctx.translate(n,0),h.x+=n*o;g.restore(),this.processingType3=null}},setCharWidth:function(a,b){},setCharWidthAndBounds:function(a,b,c,d,e,f){this.ctx.rect(c,d,e-c,f-d),this.clip(),this.endPath()},getColorN_Pattern:function(a){var b;if("TilingPattern"===a[0]){var c=a[1],d=this.baseTransform||this.ctx.mozCurrentTransform.slice();b=new oa(a,c,this.ctx,this.objs,this.commonObjs,d)}else b=y(a);return b},setStrokeColorN:function(){this.current.strokeColor=this.getColorN_Pattern(arguments)},setFillColorN:function(){this.current.fillColor=this.getColorN_Pattern(arguments),this.current.patternFill=!0},setStrokeRGBColor:function(a,b,c){var d=T.makeCssRgb(a,b,c);this.ctx.strokeStyle=d,this.current.strokeColor=d},setFillRGBColor:function(a,b,c){var d=T.makeCssRgb(a,b,c);this.ctx.fillStyle=d,this.current.fillColor=d,this.current.patternFill=!1},shadingFill:function(a){var b=this.ctx;this.save();var c=y(a);b.fillStyle=c.getPattern(b,this,!0);var d=b.mozCurrentTransformInverse;if(d){var e=b.canvas,f=e.width,g=e.height,h=T.applyTransform([0,0],d),i=T.applyTransform([0,g],d),j=T.applyTransform([f,0],d),k=T.applyTransform([f,g],d),l=Math.min(h[0],i[0],j[0],k[0]),m=Math.min(h[1],i[1],j[1],k[1]),n=Math.max(h[0],i[0],j[0],k[0]),o=Math.max(h[1],i[1],j[1],k[1]);this.ctx.fillRect(l,m,n-l,o-m)}else this.ctx.fillRect(-1e10,-1e10,2e10,2e10);this.restore()},beginInlineImage:function(){d("Should not call beginInlineImage")},beginImageData:function(){d("Should not call beginImageData")},paintFormXObjectBegin:function(a,b){if(this.save(),this.baseTransformStack.push(this.baseTransform),q(a)&&6===a.length&&this.transform.apply(this,a),this.baseTransform=this.ctx.mozCurrentTransform,q(b)&&4===b.length){var c=b[2]-b[0],d=b[3]-b[1];this.ctx.rect(b[0],b[1],c,d),this.clip(),this.endPath()}},paintFormXObjectEnd:function(){this.restore(),this.baseTransform=this.baseTransformStack.pop()},beginGroup:function(c){this.save();var d=this.ctx;c.isolated||a("TODO: Support non-isolated groups."), +c.knockout&&b("Knockout groups not supported.");var e=d.mozCurrentTransform;c.matrix&&d.transform.apply(d,c.matrix),f(c.bbox,"Bounding box is required.");var g=T.getAxialAlignedBoundingBox(c.bbox,d.mozCurrentTransform),i=[0,0,d.canvas.width,d.canvas.height];g=T.intersect(g,i)||[0,0,0,0];var j=Math.floor(g[0]),k=Math.floor(g[1]),l=Math.max(Math.ceil(g[2])-j,1),m=Math.max(Math.ceil(g[3])-k,1),n=1,o=1;l>da&&(n=l/da,l=da),m>da&&(o=m/da,m=da);var p="groupAt"+this.groupLevel;c.smask&&(p+="_smask_"+this.smaskCounter++%2);var q=ia.getCanvas(p,l,m,!0),r=q.context;r.scale(1/n,1/o),r.translate(-j,-k),r.transform.apply(r,e),c.smask?this.smaskStack.push({canvas:q.canvas,context:r,offsetX:j,offsetY:k,scaleX:n,scaleY:o,subtype:c.smask.subtype,backdrop:c.smask.backdrop}):(d.setTransform(1,0,0,1,0,0),d.translate(j,k),d.scale(n,o)),h(d,r),this.ctx=r,this.setGState([["BM","Normal"],["ca",1],["CA",1]]),this.groupStack.push(d),this.groupLevel++},endGroup:function(a){this.groupLevel--;var b=this.ctx;this.ctx=this.groupStack.pop(),void 0!==this.ctx.imageSmoothingEnabled?this.ctx.imageSmoothingEnabled=!1:this.ctx.mozImageSmoothingEnabled=!1,a.smask?this.tempSMask=this.smaskStack.pop():this.ctx.drawImage(b.canvas,0,0),this.restore()},beginAnnotations:function(){this.save(),this.current=new ja},endAnnotations:function(){this.restore()},beginAnnotation:function(a,b,c){if(this.save(),q(a)&&4===a.length){var d=a[2]-a[0],e=a[3]-a[1];this.ctx.rect(a[0],a[1],d,e),this.clip(),this.endPath()}this.transform.apply(this,b),this.transform.apply(this,c)},endAnnotation:function(){this.restore()},paintJpegXObject:function(a,c,d){var e=this.objs.get(a);if(!e)return void b("Dependent image isn't ready yet");this.save();var f=this.ctx;if(f.scale(1/c,-1/d),f.drawImage(e,0,0,e.width,e.height,0,-d,c,d),this.imageLayer){var g=f.mozCurrentTransformInverse,h=this.getCanvasPosition(0,0);this.imageLayer.appendImage({objId:a,left:h[0],top:h[1],width:c/g[0],height:d/g[3]})}this.restore()},paintImageMaskXObject:function(a){var b=this.ctx,c=a.width,d=a.height,e=this.current.fillColor,f=this.current.patternFill,h=this.processingType3;if(fa&&h&&void 0===h.compiled&&(ga>=c&&ga>=d?h.compiled=x({data:a.data,width:c,height:d}):h.compiled=null),h&&h.compiled)return void h.compiled(b);var i=ia.getCanvas("maskCanvas",c,d),j=i.context;j.save(),g(j,a),j.globalCompositeOperation="source-in",j.fillStyle=f?e.getPattern(j,this):e,j.fillRect(0,0,c,d),j.restore(),this.paintInlineImageXObject(i.canvas)},paintImageMaskXObjectRepeat:function(a,b,c,d){var e=a.width,f=a.height,h=this.current.fillColor,i=this.current.patternFill,j=ia.getCanvas("maskCanvas",e,f),k=j.context;k.save(),g(k,a),k.globalCompositeOperation="source-in",k.fillStyle=i?h.getPattern(k,this):h,k.fillRect(0,0,e,f),k.restore();for(var l=this.ctx,m=0,n=d.length;n>m;m+=2)l.save(),l.transform(b,0,0,c,d[m],d[m+1]),l.scale(1,-1),l.drawImage(j.canvas,0,0,e,f,0,-1,1,1),l.restore()},paintImageMaskXObjectGroup:function(a){for(var b=this.ctx,c=this.current.fillColor,d=this.current.patternFill,e=0,f=a.length;f>e;e++){var h=a[e],i=h.width,j=h.height,k=ia.getCanvas("maskCanvas",i,j),l=k.context;l.save(),g(l,h),l.globalCompositeOperation="source-in",l.fillStyle=d?c.getPattern(l,this):c,l.fillRect(0,0,i,j),l.restore(),b.save(),b.transform.apply(b,h.transform),b.scale(1,-1),b.drawImage(k.canvas,0,0,i,j,0,-1,1,1),b.restore()}},paintImageXObject:function(a){var c=this.objs.get(a);return c?void this.paintInlineImageXObject(c):void b("Dependent image isn't ready yet")},paintImageXObjectRepeat:function(a,c,d,e){var f=this.objs.get(a);if(!f)return void b("Dependent image isn't ready yet");for(var g=f.width,h=f.height,i=[],j=0,k=e.length;k>j;j+=2)i.push({transform:[c,0,0,d,e[j],e[j+1]],x:0,y:0,w:g,h:h});this.paintInlineImageXObjectGroup(f,i)},paintInlineImageXObject:function(a){var b=a.width,c=a.height,d=this.ctx;this.save(),d.scale(1/b,-1/c);var f,g,h=d.mozCurrentTransformInverse,i=h[0],j=h[1],k=Math.max(Math.sqrt(i*i+j*j),1),l=h[2],m=h[3],n=Math.max(Math.sqrt(l*l+m*m),1);if(a instanceof HTMLElement||!a.data)f=a;else{g=ia.getCanvas("inlineImage",b,c);var o=g.context;e(o,a),f=g.canvas}for(var p=b,q=c,r="prescale1";k>2&&p>1||n>2&&q>1;){var s=p,t=q;k>2&&p>1&&(s=Math.ceil(p/2),k/=p/s),n>2&&q>1&&(t=Math.ceil(q/2),n/=q/t),g=ia.getCanvas(r,s,t),o=g.context,o.clearRect(0,0,s,t),o.drawImage(f,0,0,p,q,0,0,s,t),f=g.canvas,p=s,q=t,r="prescale1"===r?"prescale2":"prescale1"}if(d.drawImage(f,0,0,p,q,0,-c,b,c),this.imageLayer){var u=this.getCanvasPosition(0,-c);this.imageLayer.appendImage({imgData:a,left:u[0],top:u[1],width:b/h[0],height:c/h[3]})}this.restore()},paintInlineImageXObjectGroup:function(a,b){var c=this.ctx,d=a.width,f=a.height,g=ia.getCanvas("inlineImage",d,f),h=g.context;e(h,a);for(var i=0,j=b.length;j>i;i++){var k=b[i];if(c.save(),c.transform.apply(c,k.transform),c.scale(1,-1),c.drawImage(g.canvas,k.x,k.y,k.w,k.h,0,-1,1,1),this.imageLayer){var l=this.getCanvasPosition(k.x,k.y);this.imageLayer.appendImage({imgData:a,left:l[0],top:l[1],width:d,height:f})}c.restore()}},paintSolidColorImageMask:function(){this.ctx.fillRect(0,0,1,1)},paintXObject:function(){I.notify(H.unknown),b("Unsupported 'paintXObject' command.")},markPoint:function(a){},markPointProps:function(a,b){},beginMarkedContent:function(a){},beginMarkedContentProps:function(a,b){},endMarkedContent:function(){},beginCompat:function(){},endCompat:function(){},consumePath:function(){var a=this.ctx;this.pendingClip&&(this.pendingClip===v?void 0!==a.mozFillRule?(a.mozFillRule="evenodd",a.clip(),a.mozFillRule="nonzero"):a.clip("evenodd"):a.clip(),this.pendingClip=null),a.beginPath()},getSinglePixelWidth:function(a){if(null===this.cachedGetSinglePixelWidth){var b=this.ctx.mozCurrentTransformInverse;this.cachedGetSinglePixelWidth=Math.sqrt(Math.max(b[0]*b[0]+b[1]*b[1],b[2]*b[2]+b[3]*b[3]))}return this.cachedGetSinglePixelWidth},getCanvasPosition:function(a,b){var c=this.ctx.mozCurrentTransform;return[c[0]*a+c[2]*b+c[4],c[1]*a+c[3]*b+c[5]]}};for(var z in G)c.prototype[G[z]]=c.prototype[z];return c}(),la=function(){function a(a,b,c){var d=a.createShader(c);a.shaderSource(d,b),a.compileShader(d);var e=a.getShaderParameter(d,a.COMPILE_STATUS);if(!e){var f=a.getShaderInfoLog(d);throw new Error("Error during shader compilation: "+f)}return d}function b(b,c){return a(b,c,b.VERTEX_SHADER)}function c(b,c){return a(b,c,b.FRAGMENT_SHADER)}function d(a,b){for(var c=a.createProgram(),d=0,e=b.length;e>d;++d)a.attachShader(c,b[d]);a.linkProgram(c);var f=a.getProgramParameter(c,a.LINK_STATUS);if(!f){var g=a.getProgramInfoLog(c);throw new Error("Error during program linking: "+g)}return c}function e(a,b,c){a.activeTexture(c);var d=a.createTexture();return a.bindTexture(a.TEXTURE_2D,d),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_S,a.CLAMP_TO_EDGE),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_T,a.CLAMP_TO_EDGE),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,a.NEAREST),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,a.NEAREST),a.texImage2D(a.TEXTURE_2D,0,a.RGBA,a.RGBA,a.UNSIGNED_BYTE,b),d}function f(){m||(n=document.createElement("canvas"),m=n.getContext("webgl",{premultipliedalpha:!1}))}function g(){var a,e;f(),a=n,n=null,e=m,m=null;var g=b(e,o),h=c(e,p),i=d(e,[g,h]);e.useProgram(i);var j={};j.gl=e,j.canvas=a,j.resolutionLocation=e.getUniformLocation(i,"u_resolution"),j.positionLocation=e.getAttribLocation(i,"a_position"),j.backdropLocation=e.getUniformLocation(i,"u_backdrop"),j.subtypeLocation=e.getUniformLocation(i,"u_subtype");var k=e.getAttribLocation(i,"a_texCoord"),l=e.getUniformLocation(i,"u_image"),r=e.getUniformLocation(i,"u_mask"),s=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,s),e.bufferData(e.ARRAY_BUFFER,new Float32Array([0,0,1,0,0,1,0,1,1,0,1,1]),e.STATIC_DRAW),e.enableVertexAttribArray(k),e.vertexAttribPointer(k,2,e.FLOAT,!1,0,0),e.uniform1i(l,0),e.uniform1i(r,1),q=j}function h(a,b,c){var d=a.width,f=a.height;q||g();var h=q,i=h.canvas,j=h.gl;i.width=d,i.height=f,j.viewport(0,0,j.drawingBufferWidth,j.drawingBufferHeight),j.uniform2f(h.resolutionLocation,d,f),c.backdrop?j.uniform4f(h.resolutionLocation,c.backdrop[0],c.backdrop[1],c.backdrop[2],1):j.uniform4f(h.resolutionLocation,0,0,0,0),j.uniform1i(h.subtypeLocation,"Luminosity"===c.subtype?1:0);var k=e(j,a,j.TEXTURE0),l=e(j,b,j.TEXTURE1),m=j.createBuffer();return j.bindBuffer(j.ARRAY_BUFFER,m),j.bufferData(j.ARRAY_BUFFER,new Float32Array([0,0,d,0,0,f,0,f,d,0,d,f]),j.STATIC_DRAW),j.enableVertexAttribArray(h.positionLocation),j.vertexAttribPointer(h.positionLocation,2,j.FLOAT,!1,0,0),j.clearColor(0,0,0,0),j.enable(j.BLEND),j.blendFunc(j.ONE,j.ONE_MINUS_SRC_ALPHA),j.clear(j.COLOR_BUFFER_BIT),j.drawArrays(j.TRIANGLES,0,6),j.flush(),j.deleteTexture(k),j.deleteTexture(l),j.deleteBuffer(m),i}function j(){var a,e;f(),a=n,n=null,e=m,m=null;var g=b(e,r),h=c(e,s),i=d(e,[g,h]);e.useProgram(i);var j={};j.gl=e,j.canvas=a,j.resolutionLocation=e.getUniformLocation(i,"u_resolution"),j.scaleLocation=e.getUniformLocation(i,"u_scale"),j.offsetLocation=e.getUniformLocation(i,"u_offset"),j.positionLocation=e.getAttribLocation(i,"a_position"),j.colorLocation=e.getAttribLocation(i,"a_color"),t=j}function k(a,b,c,d,e){t||j();var f=t,g=f.canvas,h=f.gl;g.width=a,g.height=b,h.viewport(0,0,h.drawingBufferWidth,h.drawingBufferHeight),h.uniform2f(f.resolutionLocation,a,b);var i,k,l,m=0;for(i=0,k=d.length;k>i;i++)switch(d[i].type){case"lattice":l=d[i].coords.length/d[i].verticesPerRow|0,m+=(l-1)*(d[i].verticesPerRow-1)*6;break;case"triangles":m+=d[i].coords.length}var n=new Float32Array(2*m),o=new Uint8Array(3*m),p=e.coords,q=e.colors,r=0,s=0;for(i=0,k=d.length;k>i;i++){var u=d[i],v=u.coords,w=u.colors;switch(u.type){case"lattice":var x=u.verticesPerRow;l=v.length/x|0;for(var y=1;l>y;y++)for(var z=y*x+1,A=1;x>A;A++,z++)n[r]=p[v[z-x-1]],n[r+1]=p[v[z-x-1]+1],n[r+2]=p[v[z-x]],n[r+3]=p[v[z-x]+1],n[r+4]=p[v[z-1]],n[r+5]=p[v[z-1]+1],o[s]=q[w[z-x-1]],o[s+1]=q[w[z-x-1]+1],o[s+2]=q[w[z-x-1]+2],o[s+3]=q[w[z-x]],o[s+4]=q[w[z-x]+1],o[s+5]=q[w[z-x]+2],o[s+6]=q[w[z-1]],o[s+7]=q[w[z-1]+1],o[s+8]=q[w[z-1]+2],n[r+6]=n[r+2],n[r+7]=n[r+3],n[r+8]=n[r+4],n[r+9]=n[r+5],n[r+10]=p[v[z]],n[r+11]=p[v[z]+1],o[s+9]=o[s+3],o[s+10]=o[s+4],o[s+11]=o[s+5],o[s+12]=o[s+6],o[s+13]=o[s+7],o[s+14]=o[s+8],o[s+15]=q[w[z]],o[s+16]=q[w[z]+1],o[s+17]=q[w[z]+2],r+=12,s+=18;break;case"triangles":for(var B=0,C=v.length;C>B;B++)n[r]=p[v[B]],n[r+1]=p[v[B]+1],o[s]=q[w[B]],o[s+1]=q[w[B]+1],o[s+2]=q[w[B]+2],r+=2,s+=3}}c?h.clearColor(c[0]/255,c[1]/255,c[2]/255,1):h.clearColor(0,0,0,0),h.clear(h.COLOR_BUFFER_BIT);var D=h.createBuffer();h.bindBuffer(h.ARRAY_BUFFER,D),h.bufferData(h.ARRAY_BUFFER,n,h.STATIC_DRAW),h.enableVertexAttribArray(f.positionLocation),h.vertexAttribPointer(f.positionLocation,2,h.FLOAT,!1,0,0);var E=h.createBuffer();return h.bindBuffer(h.ARRAY_BUFFER,E),h.bufferData(h.ARRAY_BUFFER,o,h.STATIC_DRAW),h.enableVertexAttribArray(f.colorLocation),h.vertexAttribPointer(f.colorLocation,3,h.UNSIGNED_BYTE,!1,0,0),h.uniform2f(f.scaleLocation,e.scaleX,e.scaleY),h.uniform2f(f.offsetLocation,e.offsetX,e.offsetY),h.drawArrays(h.TRIANGLES,0,m),h.flush(),h.deleteBuffer(D),h.deleteBuffer(E),g}function l(){q&&q.canvas&&(q.canvas.width=0,q.canvas.height=0),t&&t.canvas&&(t.canvas.width=0,t.canvas.height=0),q=null,t=null}var m,n,o=" attribute vec2 a_position; attribute vec2 a_texCoord; uniform vec2 u_resolution; varying vec2 v_texCoord; void main() { vec2 clipSpace = (a_position / u_resolution) * 2.0 - 1.0; gl_Position = vec4(clipSpace * vec2(1, -1), 0, 1); v_texCoord = a_texCoord; } ",p=" precision mediump float; uniform vec4 u_backdrop; uniform int u_subtype; uniform sampler2D u_image; uniform sampler2D u_mask; varying vec2 v_texCoord; void main() { vec4 imageColor = texture2D(u_image, v_texCoord); vec4 maskColor = texture2D(u_mask, v_texCoord); if (u_backdrop.a > 0.0) { maskColor.rgb = maskColor.rgb * maskColor.a + u_backdrop.rgb * (1.0 - maskColor.a); } float lum; if (u_subtype == 0) { lum = maskColor.a; } else { lum = maskColor.r * 0.3 + maskColor.g * 0.59 + maskColor.b * 0.11; } imageColor.a *= lum; imageColor.rgb *= imageColor.a; gl_FragColor = imageColor; } ",q=null,r=" attribute vec2 a_position; attribute vec3 a_color; uniform vec2 u_resolution; uniform vec2 u_scale; uniform vec2 u_offset; varying vec4 v_color; void main() { vec2 position = (a_position + u_offset) * u_scale; vec2 clipSpace = (position / u_resolution) * 2.0 - 1.0; gl_Position = vec4(clipSpace * vec2(1, -1), 0, 1); v_color = vec4(a_color / 255.0, 1.0); } ",s=" precision mediump float; varying vec4 v_color; void main() { gl_FragColor = v_color; } ",t=null;return{get isEnabled(){if(PDFJS.disableWebGL)return!1;var a=!1;try{f(),a=!!m}catch(b){}return i(this,"isEnabled",a)},composeSMask:h,drawFigures:k,clear:l}}(),ma={};ma.RadialAxial={fromIR:function(a){var b=a[1],c=a[2],d=a[3],e=a[4],f=a[5],g=a[6];return{type:"Pattern",getPattern:function(a){var h;"axial"===b?h=a.createLinearGradient(d[0],d[1],e[0],e[1]):"radial"===b&&(h=a.createRadialGradient(d[0],d[1],f,e[0],e[1],g));for(var i=0,j=c.length;j>i;++i){var k=c[i];h.addColorStop(k[0],k[1])}return h}}}};var na=function(){function a(a,b,c,d,e,f,g,h){var i,j=b.coords,k=b.colors,l=a.data,m=4*a.width;j[c+1]>j[d+1]&&(i=c,c=d,d=i,i=f,f=g,g=i),j[d+1]>j[e+1]&&(i=d,d=e,e=i,i=g,g=h,h=i),j[c+1]>j[d+1]&&(i=c,c=d,d=i,i=f,f=g,g=i);var n=(j[c]+b.offsetX)*b.scaleX,o=(j[c+1]+b.offsetY)*b.scaleY,p=(j[d]+b.offsetX)*b.scaleX,q=(j[d+1]+b.offsetY)*b.scaleY,r=(j[e]+b.offsetX)*b.scaleX,s=(j[e+1]+b.offsetY)*b.scaleY;if(!(o>=s))for(var t,u,v,w,x,y,z,A,B,C=k[f],D=k[f+1],E=k[f+2],F=k[g],G=k[g+1],H=k[g+2],I=k[h],J=k[h+1],K=k[h+2],L=Math.round(o),M=Math.round(s),N=L;M>=N;N++){q>N?(B=o>N?0:o===q?1:(o-N)/(o-q),t=n-(n-p)*B,u=C-(C-F)*B,v=D-(D-G)*B,w=E-(E-H)*B):(B=N>s?1:q===s?0:(q-N)/(q-s),t=p-(p-r)*B,u=F-(F-I)*B,v=G-(G-J)*B,w=H-(H-K)*B),B=o>N?0:N>s?1:(o-N)/(o-s),x=n-(n-r)*B,y=C-(C-I)*B,z=D-(D-J)*B,A=E-(E-K)*B;for(var O=Math.round(Math.min(t,x)),P=Math.round(Math.max(t,x)),Q=m*N+4*O,R=O;P>=R;R++)B=(t-R)/(t-x),B=0>B?0:B>1?1:B,l[Q++]=u-(u-y)*B|0,l[Q++]=v-(v-z)*B|0,l[Q++]=w-(w-A)*B|0,l[Q++]=255}}function b(b,c,e){var f,g,h=c.coords,i=c.colors;switch(c.type){case"lattice":var j=c.verticesPerRow,k=Math.floor(h.length/j)-1,l=j-1;for(f=0;k>f;f++)for(var m=f*j,n=0;l>n;n++,m++)a(b,e,h[m],h[m+1],h[m+j],i[m],i[m+1],i[m+j]),a(b,e,h[m+j+1],h[m+1],h[m+j],i[m+j+1],i[m+1],i[m+j]);break;case"triangles":for(f=0,g=h.length;g>f;f+=3)a(b,e,h[f],h[f+1],h[f+2],i[f],i[f+1],i[f+2]);break;default:d("illigal figure")}}function c(a,c,d,e,f,g){var h,i,j,k,l=1.1,m=3e3,n=Math.floor(a[0]),o=Math.floor(a[1]),p=Math.ceil(a[2])-n,q=Math.ceil(a[3])-o,r=Math.min(Math.ceil(Math.abs(p*c[0]*l)),m),s=Math.min(Math.ceil(Math.abs(q*c[1]*l)),m),t=p/r,u=q/s,v={coords:d,colors:e,offsetX:-n,offsetY:-o,scaleX:1/t,scaleY:1/u};if(la.isEnabled)h=la.drawFigures(r,s,g,f,v),i=ia.getCanvas("mesh",r,s,!1),i.context.drawImage(h,0,0),h=i.canvas;else{i=ia.getCanvas("mesh",r,s,!1);var w=i.context,x=w.createImageData(r,s);if(g){var y=x.data;for(j=0,k=y.length;k>j;j+=4)y[j]=g[0],y[j+1]=g[1],y[j+2]=g[2],y[j+3]=255}for(j=0;j=14?!0:"node"===a?!0:!1}(),nativeFontFaces:[],isFontLoadingAPISupported:!A&&"undefined"!=typeof document&&!!document.fonts,addNativeFontFace:function(a){this.nativeFontFaces.push(a),document.fonts.add(a)},bind:function(a,c){f(!A,"bind() shall be called from main thread");for(var d=[],e=[],g=[],h=function(a){return a.loaded["catch"](function(c){b('Failed to load font "'+a.family+'": '+c)})},i=0,j=a.length;j>i;i++){var k=a[i];if(!k.attached&&k.loading!==!1)if(k.attached=!0,this.isFontLoadingAPISupported){var l=k.createNativeFontFace();l&&g.push(h(l))}else{var m=k.bindDOM();m&&(d.push(m),e.push(k))}}var n=pa.queueLoadingCallback(c);this.isFontLoadingAPISupported?Promise.all(g).then(function(){n.complete()}):d.length>0&&!this.isSyncFontLoadingSupported?pa.prepareFontLoadEvent(d,e,n):n.complete()},queueLoadingCallback:function(a){function b(){for(f(!e.end,"completeRequest() cannot be called twice"),e.end=Date.now();c.requests.length>0&&c.requests[0].end;){var a=c.requests.shift();setTimeout(a.callback,0)}}var c=pa.loadingContext,d="pdfjs-font-loading-"+c.nextRequestId++,e={id:d,complete:b,callback:a,started:Date.now()};return c.requests.push(e),e},prepareFontLoadEvent:function(a,c,d){function e(a,b){return a.charCodeAt(b)<<24|a.charCodeAt(b+1)<<16|a.charCodeAt(b+2)<<8|255&a.charCodeAt(b+3)}function f(a,b,c,d){var e=a.substr(0,b),f=a.substr(b+c);return e+d+f}function g(a,c){if(l++,l>30)return b("Load test font never loaded."),void c();k.font="30px "+a,k.fillText(".",0,20);var d=k.getImageData(0,0,1,1);return d.data[3]>0?void c():void setTimeout(g.bind(null,a,c))}var h,i,j=document.createElement("canvas");j.width=1,j.height=1;var k=j.getContext("2d"),l=0,n="lt"+Date.now()+this.loadTestFontId++,o=this.loadTestFont,p=976;o=f(o,p,n.length,n);var q=16,r=1482184792,s=e(o,q);for(h=0,i=n.length-3;i>h;h+=4)s=s-r+e(n,h)|0;hh;h++)v.push(c[h].loadedName);v.push(n);var w=document.createElement("div");for(w.setAttribute("style","visibility: hidden;width: 10px; height: 10px;position: absolute; top: 0px; left: 0px;"),h=0,i=v.length;i>h;++h){var x=document.createElement("span");x.textContent="Hi",x.style.fontFamily=v[h],w.appendChild(x)}document.body.appendChild(w),g(n,function(){document.body.removeChild(w),d.complete()})}},qa=function(){function a(a,b,c){if(this.compiledGlyphs={},1!==arguments.length);else{var d=arguments[0];for(var e in d)this[e]=d[e]}}return a.prototype={createNativeFontFace:function(){if(!this.data)return null;if(PDFJS.disableFontFace)return this.disableFontFace=!0,null;var a=new FontFace(this.loadedName,this.data,{});return pa.addNativeFontFace(a),PDFJS.pdfBug&&"FontInspector"in z&&z.FontInspector.enabled&&z.FontInspector.fontAdded(this),a},bindDOM:function(){if(!this.data)return null;if(PDFJS.disableFontFace)return this.disableFontFace=!0,null;var a=k(new Uint8Array(this.data)),b=this.loadedName,c="url(data:"+this.mimetype+";base64,"+window.btoa(a)+");",d='@font-face { font-family:"'+b+'";src:'+c+"}";return pa.insertRule(d),PDFJS.pdfBug&&"FontInspector"in z&&z.FontInspector.enabled&&z.FontInspector.fontAdded(this,c),d},getPathGenerator:function(a,b){if(!(b in this.compiledGlyphs)){var c,d,e,f=a.get(this.loadedName+"_path_"+b);if(pa.isEvalSupported){var g,h="";for(d=0,e=f.length;e>d;d++)c=f[d],g=void 0!==c.args?c.args.join(","):"",h+="c."+c.cmd+"("+g+");\n";this.compiledGlyphs[b]=new Function("c","size",h)}else this.compiledGlyphs[b]=function(a,b){for(d=0,e=f.length;e>d;d++)c=f[d],"scale"===c.cmd&&(c.args=[b,-b]),a[c.cmd].apply(a,c.args)}}return this.compiledGlyphs[b]}},a}(),ra=10,sa=function(){function a(a,b,c){var d=a.style;if(d.fontSize=b.fontSize+"px",d.direction=b.fontDirection<0?"rtl":"ltr",c){d.fontWeight=c.black?c.bold?"bolder":"bold":c.bold?"bold":"normal",d.fontStyle=c.italic?"italic":"normal";var e=c.loadedName,f=e?'"'+e+'", ':"",g=c.fallbackName||"Helvetica, sans-serif";d.fontFamily=f+g}}function c(a){var c=document.createElement("section"),d=c.style,e=a.rect[2]-a.rect[0],f=a.rect[3]-a.rect[1];if(a.borderStyle.width>0){c.style.borderWidth=a.borderStyle.width+"px",a.borderStyle.style!==F.UNDERLINE&&(e-=2*a.borderStyle.width,f-=2*a.borderStyle.width);var g=a.borderStyle.horizontalCornerRadius,h=a.borderStyle.verticalCornerRadius;if(g>0||h>0){var i=g+"px / "+h+"px";CustomStyle.setProp("borderRadius",c,i)}switch(a.borderStyle.style){case F.SOLID:c.style.borderStyle="solid";break;case F.DASHED:c.style.borderStyle="dashed";break;case F.BEVELED:b("Unimplemented border style: beveled");break;case F.INSET:b("Unimplemented border style: inset");break;case F.UNDERLINE:c.style.borderBottomStyle="solid"}a.color?c.style.borderColor=T.makeCssRgb(0|a.color[0],0|a.color[1],0|a.color[2]):c.style.borderWidth=0}return d.width=e+"px",d.height=f+"px",c}function d(b,c){var d=document.createElement("div"),e=b.rect[2]-b.rect[0],f=b.rect[3]-b.rect[1];d.style.width=e+"px",d.style.height=f+"px",d.style.display="table";var g=document.createElement("div");g.textContent=b.fieldValue;var h=b.textAlignment;g.style.textAlign=["left","center","right"][h],g.style.verticalAlign="middle",g.style.display="table-cell";var i=b.fontRefName?c.getData(b.fontRefName):null;return a(g,b,i),d.appendChild(g),d}function e(a){var b=a.rect;b[3]-b[1]i;++i){var t=s[i];r.appendChild(document.createTextNode(t)),j-1>i&&r.appendChild(document.createElement("br"))}q.appendChild(r);var u=!1,v=function(a){a&&(u=!0),h.hasAttribute("hidden")&&(d.style.zIndex+=1,h.removeAttribute("hidden"))},w=function(a){a&&(u=!1),h.hasAttribute("hidden")||u||(d.style.zIndex-=1,h.setAttribute("hidden",!0))},x=function(){u?w(!0):v(!0)};e.addEventListener("click",function(){x()},!1),e.addEventListener("mouseover",function(){v()},!1),e.addEventListener("mouseout",function(){w()},!1),h.addEventListener("click",function(){w(!0)},!1)}else h.setAttribute("hidden",!0);return h.appendChild(p),h.appendChild(q),g.appendChild(h),d.appendChild(e),d.appendChild(g),d}function f(a){var b=c(a);b.className="annotLink";var d=document.createElement("a");return d.href=d.title=a.url||"",a.url&&j()&&(d.target=K[PDFJS.externalLinkTarget]),b.appendChild(d),b}function g(a,b){switch(a.annotationType){case E.WIDGET:return d(a,b);case E.TEXT:return e(a);case E.LINK:return f(a);default:throw new Error("Unsupported annotationType: "+a.annotationType)}}return{getHtmlElement:g}}();PDFJS.AnnotationUtils=sa;var ta={fontStyle:"normal",fontWeight:"normal",fillColor:"#000000"},ua=function(){function a(a,b,c){for(var d=-1,e=b;c>e;e++){var f=255&(d^a[e]),h=g[f];d=d>>>8^h}return-1^d}function b(b,c,d,e){var f=e,g=c.length;d[f]=g>>24&255,d[f+1]=g>>16&255,d[f+2]=g>>8&255,d[f+3]=255&g,f+=4,d[f]=255&b.charCodeAt(0),d[f+1]=255&b.charCodeAt(1),d[f+2]=255&b.charCodeAt(2),d[f+3]=255&b.charCodeAt(3),f+=4,d.set(c,f),f+=c.length;var h=a(d,e+4,f);d[f]=h>>24&255,d[f+1]=h>>16&255,d[f+2]=h>>8&255,d[f+3]=255&h}function c(a,b,c){for(var d=1,e=0,f=b;c>f;++f)d=(d+(255&a[f]))%65521,e=(e+d)%65521;return e<<16|d}function d(a,d){var g,h,i,j=a.width,k=a.height,l=a.data;switch(d){case D.GRAYSCALE_1BPP:h=0,g=1,i=j+7>>3;break;case D.RGB_24BPP:h=2,g=8,i=3*j;break;case D.RGBA_32BPP:h=6,g=8,i=4*j;break;default:throw new Error("invalid format")}var m,n,o=new Uint8Array((1+i)*k),p=0,q=0;for(m=0;k>m;++m)o[p++]=0,o.set(l.subarray(q,q+i),p),q+=i,p+=i;if(d===D.GRAYSCALE_1BPP)for(p=0,m=0;k>m;m++)for(p++,n=0;i>n;n++)o[p++]^=255;var r=new Uint8Array([j>>24&255,j>>16&255,j>>8&255,255&j,k>>24&255,k>>16&255,k>>8&255,255&k,g,h,0,0,0]),s=o.length,t=65535,u=Math.ceil(s/t),v=new Uint8Array(2+s+5*u+4),w=0;v[w++]=120,v[w++]=156;for(var x=0;s>t;)v[w++]=0,v[w++]=255,v[w++]=255,v[w++]=0,v[w++]=0,v.set(o.subarray(x,x+t),w),w+=t,x+=t,s-=t;v[w++]=1,v[w++]=255&s,v[w++]=s>>8&255,v[w++]=65535&~s&255,v[w++]=(65535&~s)>>8&255,v.set(o.subarray(x),w),w+=o.length-x;var y=c(o,0,o.length);v[w++]=y>>24&255,v[w++]=y>>16&255,v[w++]=y>>8&255,v[w++]=255&y;var z=e.length+3*f+r.length+v.length,A=new Uint8Array(z),B=0;return A.set(e,B),B+=e.length,b("IHDR",r,A,B),B+=f+r.length,b("IDATA",v,A,B),B+=f+v.length,b("IEND",new Uint8Array(0),A,B), +PDFJS.createObjectURL(A,"image/png")}for(var e=new Uint8Array([137,80,78,71,13,10,26,10]),f=12,g=new Int32Array(256),h=0;256>h;h++){for(var i=h,j=0;8>j;j++)i=1&i?3988292384^i>>1&2147483647:i>>1&2147483647;g[h]=i}return function(a){var b=void 0===a.kind?D.GRAYSCALE_1BPP:a.kind;return d(a,b)}}(),va=function(){function a(){this.fontSizeScale=1,this.fontWeight=ta.fontWeight,this.fontSize=0,this.textMatrix=S,this.fontMatrix=B,this.leading=0,this.x=0,this.y=0,this.lineX=0,this.lineY=0,this.charSpacing=0,this.wordSpacing=0,this.textHScale=1,this.textRise=0,this.fillColor=ta.fillColor,this.strokeColor="#000000",this.fillAlpha=1,this.strokeAlpha=1,this.lineWidth=1,this.lineJoin="",this.lineCap="",this.miterLimit=0,this.dashArray=[],this.dashPhase=0,this.dependencies=[],this.clipId="",this.pendingClip=!1,this.maskId=""}return a.prototype={clone:function(){return Object.create(this)},setCurrentPoint:function(a,b){this.x=a,this.y=b}},a}(),wa=function(){function a(a,b){var c="http://www.w3.org/2000/svg",d=document.createElementNS(c,"svg:svg");return d.setAttributeNS(null,"version","1.1"),d.setAttributeNS(null,"width",a+"px"),d.setAttributeNS(null,"height",b+"px"),d.setAttributeNS(null,"viewBox","0 0 "+a+" "+b),d}function c(a){for(var b=[],c=[],d=a.length,e=0;d>e;e++)"save"!==a[e].fn?"restore"===a[e].fn?b=c.pop():b.push(a[e]):(b.push({fnId:92,fn:"group",items:[]}),c.push(b),b=b[b.length-1].items);return b}function d(a){if(a===(0|a))return a.toString();var b=a.toFixed(10),c=b.length-1;if("0"!==b[c])return b;do c--;while("0"===b[c]);return b.substr(0,"."===b[c]?c:c+1)}function e(a){if(0===a[4]&&0===a[5]){if(0===a[1]&&0===a[2])return 1===a[0]&&1===a[3]?"":"scale("+d(a[0])+" "+d(a[3])+")";if(a[0]===a[3]&&a[1]===-a[2]){var b=180*Math.acos(a[0])/Math.PI;return"rotate("+d(b)+")"}}else if(1===a[0]&&0===a[1]&&0===a[2]&&1===a[3])return"translate("+d(a[4])+" "+d(a[5])+")";return"matrix("+d(a[0])+" "+d(a[1])+" "+d(a[2])+" "+d(a[3])+" "+d(a[4])+" "+d(a[5])+")"}function f(a,b){this.current=new va,this.transformMatrix=S,this.transformStack=[],this.extraStack=[],this.commonObjs=a,this.objs=b,this.pendingEOFill=!1,this.embedFonts=!1,this.embeddedFonts={},this.cssStyle=null}var g="http://www.w3.org/2000/svg",h="http://www.w3.org/XML/1998/namespace",i="http://www.w3.org/1999/xlink",j=["butt","round","square"],k=["miter","round","bevel"],l=0,m=0;return f.prototype={save:function(){this.transformStack.push(this.transformMatrix);var a=this.current;this.extraStack.push(a),this.current=a.clone()},restore:function(){this.transformMatrix=this.transformStack.pop(),this.current=this.extraStack.pop(),this.tgrp=document.createElementNS(g,"svg:g"),this.tgrp.setAttributeNS(null,"transform",e(this.transformMatrix)),this.pgrp.appendChild(this.tgrp)},group:function(a){this.save(),this.executeOpTree(a),this.restore()},loadDependencies:function(a){for(var b=a.fnArray,c=b.length,d=a.argsArray,e=this,f=0;c>f;f++)if(G.dependency===b[f])for(var g=d[f],h=0,i=g.length;i>h;h++){var j,k=g[h],l="g_"===k.substring(0,2);j=l?new Promise(function(a){e.commonObjs.get(k,a)}):new Promise(function(a){e.objs.get(k,a)}),this.current.dependencies.push(j)}return Promise.all(this.current.dependencies)},transform:function(a,b,c,d,f,h){var i=[a,b,c,d,f,h];this.transformMatrix=PDFJS.Util.transform(this.transformMatrix,i),this.tgrp=document.createElementNS(g,"svg:g"),this.tgrp.setAttributeNS(null,"transform",e(this.transformMatrix))},getSVG:function(b,c){return this.svg=a(c.width,c.height),this.viewport=c,this.loadDependencies(b).then(function(){this.transformMatrix=S,this.pgrp=document.createElementNS(g,"svg:g"),this.pgrp.setAttributeNS(null,"transform",e(c.transform)),this.tgrp=document.createElementNS(g,"svg:g"),this.tgrp.setAttributeNS(null,"transform",e(this.transformMatrix)),this.defs=document.createElementNS(g,"svg:defs"),this.pgrp.appendChild(this.defs),this.pgrp.appendChild(this.tgrp),this.svg.appendChild(this.pgrp);var a=this.convertOpList(b);return this.executeOpTree(a),this.svg}.bind(this))},convertOpList:function(a){var b=a.argsArray,d=a.fnArray,e=d.length,f=[],g=[];for(var h in G)f[G[h]]=h;for(var i=0;e>i;i++){var j=d[i];g.push({fnId:j,fn:f[j],args:b[i]})}return c(g)},executeOpTree:function(a){for(var c=a.length,d=0;c>d;d++){var e=a[d].fn,f=a[d].fnId,g=a[d].args;switch(0|f){case G.beginText:this.beginText();break;case G.setLeading:this.setLeading(g);break;case G.setLeadingMoveText:this.setLeadingMoveText(g[0],g[1]);break;case G.setFont:this.setFont(g);break;case G.showText:this.showText(g[0]);break;case G.showSpacedText:this.showText(g[0]);break;case G.endText:this.endText();break;case G.moveText:this.moveText(g[0],g[1]);break;case G.setCharSpacing:this.setCharSpacing(g[0]);break;case G.setWordSpacing:this.setWordSpacing(g[0]);break;case G.setHScale:this.setHScale(g[0]);break;case G.setTextMatrix:this.setTextMatrix(g[0],g[1],g[2],g[3],g[4],g[5]);break;case G.setLineWidth:this.setLineWidth(g[0]);break;case G.setLineJoin:this.setLineJoin(g[0]);break;case G.setLineCap:this.setLineCap(g[0]);break;case G.setMiterLimit:this.setMiterLimit(g[0]);break;case G.setFillRGBColor:this.setFillRGBColor(g[0],g[1],g[2]);break;case G.setStrokeRGBColor:this.setStrokeRGBColor(g[0],g[1],g[2]);break;case G.setDash:this.setDash(g[0],g[1]);break;case G.setGState:this.setGState(g[0]);break;case G.fill:this.fill();break;case G.eoFill:this.eoFill();break;case G.stroke:this.stroke();break;case G.fillStroke:this.fillStroke();break;case G.eoFillStroke:this.eoFillStroke();break;case G.clip:this.clip("nonzero");break;case G.eoClip:this.clip("evenodd");break;case G.paintSolidColorImageMask:this.paintSolidColorImageMask();break;case G.paintJpegXObject:this.paintJpegXObject(g[0],g[1],g[2]);break;case G.paintImageXObject:this.paintImageXObject(g[0]);break;case G.paintInlineImageXObject:this.paintInlineImageXObject(g[0]);break;case G.paintImageMaskXObject:this.paintImageMaskXObject(g[0]);break;case G.paintFormXObjectBegin:this.paintFormXObjectBegin(g[0],g[1]);break;case G.paintFormXObjectEnd:this.paintFormXObjectEnd();break;case G.closePath:this.closePath();break;case G.closeStroke:this.closeStroke();break;case G.closeFillStroke:this.closeFillStroke();break;case G.nextLine:this.nextLine();break;case G.transform:this.transform(g[0],g[1],g[2],g[3],g[4],g[5]);break;case G.constructPath:this.constructPath(g[0],g[1]);break;case G.endPath:this.endPath();break;case 92:this.group(a[d].items);break;default:b("Unimplemented method "+e)}}},setWordSpacing:function(a){this.current.wordSpacing=a},setCharSpacing:function(a){this.current.charSpacing=a},nextLine:function(){this.moveText(0,this.current.leading)},setTextMatrix:function(a,b,c,e,f,h){var i=this.current;this.current.textMatrix=this.current.lineMatrix=[a,b,c,e,f,h],this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0,i.xcoords=[],i.tspan=document.createElementNS(g,"svg:tspan"),i.tspan.setAttributeNS(null,"font-family",i.fontFamily),i.tspan.setAttributeNS(null,"font-size",d(i.fontSize)+"px"),i.tspan.setAttributeNS(null,"y",d(-i.y)),i.txtElement=document.createElementNS(g,"svg:text"),i.txtElement.appendChild(i.tspan)},beginText:function(){this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0,this.current.textMatrix=S,this.current.lineMatrix=S,this.current.tspan=document.createElementNS(g,"svg:tspan"),this.current.txtElement=document.createElementNS(g,"svg:text"),this.current.txtgrp=document.createElementNS(g,"svg:g"),this.current.xcoords=[]},moveText:function(a,b){var c=this.current;this.current.x=this.current.lineX+=a,this.current.y=this.current.lineY+=b,c.xcoords=[],c.tspan=document.createElementNS(g,"svg:tspan"),c.tspan.setAttributeNS(null,"font-family",c.fontFamily),c.tspan.setAttributeNS(null,"font-size",d(c.fontSize)+"px"),c.tspan.setAttributeNS(null,"y",d(-c.y))},showText:function(a){var b=this.current,c=b.font,f=b.fontSize;if(0!==f){var g,i=b.charSpacing,j=b.wordSpacing,k=b.fontDirection,l=b.textHScale*k,m=a.length,n=c.vertical,o=f*b.fontMatrix[0],q=0;for(g=0;m>g;++g){var r=a[g];if(null!==r)if(p(r))q+=-r*f*.001;else{b.xcoords.push(b.x+q*l);var s=r.width,t=r.fontChar,u=s*o+i*k;q+=u,b.tspan.textContent+=t}else q+=k*j}n?b.y-=q*l:b.x+=q*l,b.tspan.setAttributeNS(null,"x",b.xcoords.map(d).join(" ")),b.tspan.setAttributeNS(null,"y",d(-b.y)),b.tspan.setAttributeNS(null,"font-family",b.fontFamily),b.tspan.setAttributeNS(null,"font-size",d(b.fontSize)+"px"),b.fontStyle!==ta.fontStyle&&b.tspan.setAttributeNS(null,"font-style",b.fontStyle),b.fontWeight!==ta.fontWeight&&b.tspan.setAttributeNS(null,"font-weight",b.fontWeight),b.fillColor!==ta.fillColor&&b.tspan.setAttributeNS(null,"fill",b.fillColor),b.txtElement.setAttributeNS(null,"transform",e(b.textMatrix)+" scale(1, -1)"),b.txtElement.setAttributeNS(h,"xml:space","preserve"),b.txtElement.appendChild(b.tspan),b.txtgrp.appendChild(b.txtElement),this.tgrp.appendChild(b.txtElement)}},setLeadingMoveText:function(a,b){this.setLeading(-b),this.moveText(a,b)},addFontStyle:function(a){this.cssStyle||(this.cssStyle=document.createElementNS(g,"svg:style"),this.cssStyle.setAttributeNS(null,"type","text/css"),this.defs.appendChild(this.cssStyle));var b=PDFJS.createObjectURL(a.data,a.mimetype);this.cssStyle.textContent+='@font-face { font-family: "'+a.loadedName+'"; src: url('+b+"); }\n"},setFont:function(a){var b=this.current,c=this.commonObjs.get(a[0]),e=a[1];this.current.font=c,this.embedFonts&&c.data&&!this.embeddedFonts[c.loadedName]&&(this.addFontStyle(c),this.embeddedFonts[c.loadedName]=c),b.fontMatrix=c.fontMatrix?c.fontMatrix:B;var f=c.black?c.bold?"bolder":"bold":c.bold?"bold":"normal",h=c.italic?"italic":"normal";0>e?(e=-e,b.fontDirection=-1):b.fontDirection=1,b.fontSize=e,b.fontFamily=c.loadedName,b.fontWeight=f,b.fontStyle=h,b.tspan=document.createElementNS(g,"svg:tspan"),b.tspan.setAttributeNS(null,"y",d(-b.y)),b.xcoords=[]},endText:function(){this.current.pendingClip?(this.cgrp.appendChild(this.tgrp),this.pgrp.appendChild(this.cgrp)):this.pgrp.appendChild(this.tgrp),this.tgrp=document.createElementNS(g,"svg:g"),this.tgrp.setAttributeNS(null,"transform",e(this.transformMatrix))},setLineWidth:function(a){this.current.lineWidth=a},setLineCap:function(a){this.current.lineCap=j[a]},setLineJoin:function(a){this.current.lineJoin=k[a]},setMiterLimit:function(a){this.current.miterLimit=a},setStrokeRGBColor:function(a,b,c){var d=T.makeCssRgb(a,b,c);this.current.strokeColor=d},setFillRGBColor:function(a,b,c){var d=T.makeCssRgb(a,b,c);this.current.fillColor=d,this.current.tspan=document.createElementNS(g,"svg:tspan"),this.current.xcoords=[]},setDash:function(a,b){this.current.dashArray=a,this.current.dashPhase=b},constructPath:function(a,b){var c=this.current,e=c.x,f=c.y;c.path=document.createElementNS(g,"svg:path");for(var h=[],i=a.length,j=0,k=0;i>j;j++)switch(0|a[j]){case G.rectangle:e=b[k++],f=b[k++];var l=b[k++],m=b[k++],n=e+l,o=f+m;h.push("M",d(e),d(f),"L",d(n),d(f),"L",d(n),d(o),"L",d(e),d(o),"Z");break;case G.moveTo:e=b[k++],f=b[k++],h.push("M",d(e),d(f));break;case G.lineTo:e=b[k++],f=b[k++],h.push("L",d(e),d(f));break;case G.curveTo:e=b[k+4],f=b[k+5],h.push("C",d(b[k]),d(b[k+1]),d(b[k+2]),d(b[k+3]),d(e),d(f)),k+=6;break;case G.curveTo2:e=b[k+2],f=b[k+3],h.push("C",d(e),d(f),d(b[k]),d(b[k+1]),d(b[k+2]),d(b[k+3])),k+=4;break;case G.curveTo3:e=b[k+2],f=b[k+3],h.push("C",d(b[k]),d(b[k+1]),d(e),d(f),d(e),d(f)),k+=4;break;case G.closePath:h.push("Z")}c.path.setAttributeNS(null,"d",h.join(" ")),c.path.setAttributeNS(null,"stroke-miterlimit",d(c.miterLimit)),c.path.setAttributeNS(null,"stroke-linecap",c.lineCap),c.path.setAttributeNS(null,"stroke-linejoin",c.lineJoin),c.path.setAttributeNS(null,"stroke-width",d(c.lineWidth)+"px"),c.path.setAttributeNS(null,"stroke-dasharray",c.dashArray.map(d).join(" ")),c.path.setAttributeNS(null,"stroke-dashoffset",d(c.dashPhase)+"px"),c.path.setAttributeNS(null,"fill","none"),this.tgrp.appendChild(c.path),c.pendingClip?(this.cgrp.appendChild(this.tgrp),this.pgrp.appendChild(this.cgrp)):this.pgrp.appendChild(this.tgrp),c.element=c.path,c.setCurrentPoint(e,f)},endPath:function(){var a=this.current;a.pendingClip?(this.cgrp.appendChild(this.tgrp),this.pgrp.appendChild(this.cgrp)):this.pgrp.appendChild(this.tgrp),this.tgrp=document.createElementNS(g,"svg:g"),this.tgrp.setAttributeNS(null,"transform",e(this.transformMatrix))},clip:function(a){var b=this.current;b.clipId="clippath"+l,l++,this.clippath=document.createElementNS(g,"svg:clipPath"),this.clippath.setAttributeNS(null,"id",b.clipId);var c=b.element.cloneNode();"evenodd"===a?c.setAttributeNS(null,"clip-rule","evenodd"):c.setAttributeNS(null,"clip-rule","nonzero"),this.clippath.setAttributeNS(null,"transform",e(this.transformMatrix)),this.clippath.appendChild(c),this.defs.appendChild(this.clippath),b.pendingClip=!0,this.cgrp=document.createElementNS(g,"svg:g"),this.cgrp.setAttributeNS(null,"clip-path","url(#"+b.clipId+")"),this.pgrp.appendChild(this.cgrp)},closePath:function(){var a=this.current,b=a.path.getAttributeNS(null,"d");b+="Z",a.path.setAttributeNS(null,"d",b)},setLeading:function(a){this.current.leading=-a},setTextRise:function(a){this.current.textRise=a},setHScale:function(a){this.current.textHScale=a/100},setGState:function(a){for(var b=0,c=a.length;c>b;b++){var d=a[b],e=d[0],f=d[1];switch(e){case"LW":this.setLineWidth(f);break;case"LC":this.setLineCap(f);break;case"LJ":this.setLineJoin(f);break;case"ML":this.setMiterLimit(f);break;case"D":this.setDash(f[0],f[1]);break;case"RI":break;case"FL":break;case"Font":this.setFont(f);break;case"CA":break;case"ca":break;case"BM":break;case"SMask":}}},fill:function(){var a=this.current;a.element.setAttributeNS(null,"fill",a.fillColor)},stroke:function(){var a=this.current;a.element.setAttributeNS(null,"stroke",a.strokeColor),a.element.setAttributeNS(null,"fill","none")},eoFill:function(){var a=this.current;a.element.setAttributeNS(null,"fill",a.fillColor),a.element.setAttributeNS(null,"fill-rule","evenodd")},fillStroke:function(){this.stroke(),this.fill()},eoFillStroke:function(){this.current.element.setAttributeNS(null,"fill-rule","evenodd"),this.fillStroke()},closeStroke:function(){this.closePath(),this.stroke()},closeFillStroke:function(){this.closePath(),this.fillStroke()},paintSolidColorImageMask:function(){var a=this.current,b=document.createElementNS(g,"svg:rect");b.setAttributeNS(null,"x","0"),b.setAttributeNS(null,"y","0"),b.setAttributeNS(null,"width","1px"),b.setAttributeNS(null,"height","1px"),b.setAttributeNS(null,"fill",a.fillColor),this.tgrp.appendChild(b)},paintJpegXObject:function(a,b,c){var e=this.current,f=this.objs.get(a),h=document.createElementNS(g,"svg:image");h.setAttributeNS(i,"xlink:href",f.src),h.setAttributeNS(null,"width",f.width+"px"),h.setAttributeNS(null,"height",f.height+"px"),h.setAttributeNS(null,"x","0"),h.setAttributeNS(null,"y",d(-c)),h.setAttributeNS(null,"transform","scale("+d(1/b)+" "+d(-1/c)+")"),this.tgrp.appendChild(h),e.pendingClip?(this.cgrp.appendChild(this.tgrp),this.pgrp.appendChild(this.cgrp)):this.pgrp.appendChild(this.tgrp)},paintImageXObject:function(a){var c=this.objs.get(a);return c?void this.paintInlineImageXObject(c):void b("Dependent image isn't ready yet")},paintInlineImageXObject:function(a,b){var c=this.current,e=a.width,f=a.height,h=ua(a),j=document.createElementNS(g,"svg:rect");j.setAttributeNS(null,"x","0"),j.setAttributeNS(null,"y","0"),j.setAttributeNS(null,"width",d(e)),j.setAttributeNS(null,"height",d(f)),c.element=j,this.clip("nonzero");var k=document.createElementNS(g,"svg:image");k.setAttributeNS(i,"xlink:href",h),k.setAttributeNS(null,"x","0"),k.setAttributeNS(null,"y",d(-f)),k.setAttributeNS(null,"width",d(e)+"px"),k.setAttributeNS(null,"height",d(f)+"px"),k.setAttributeNS(null,"transform","scale("+d(1/e)+" "+d(-1/f)+")"),b?b.appendChild(k):this.tgrp.appendChild(k),c.pendingClip?(this.cgrp.appendChild(this.tgrp),this.pgrp.appendChild(this.cgrp)):this.pgrp.appendChild(this.tgrp)},paintImageMaskXObject:function(a){var b=this.current,c=a.width,e=a.height,f=b.fillColor;b.maskId="mask"+m++;var h=document.createElementNS(g,"svg:mask");h.setAttributeNS(null,"id",b.maskId);var i=document.createElementNS(g,"svg:rect");i.setAttributeNS(null,"x","0"),i.setAttributeNS(null,"y","0"),i.setAttributeNS(null,"width",d(c)),i.setAttributeNS(null,"height",d(e)),i.setAttributeNS(null,"fill",f),i.setAttributeNS(null,"mask","url(#"+b.maskId+")"),this.defs.appendChild(h),this.tgrp.appendChild(i),this.paintInlineImageXObject(a,h)},paintFormXObjectBegin:function(a,b){if(this.save(),q(a)&&6===a.length&&this.transform(a[0],a[1],a[2],a[3],a[4],a[5]),q(b)&&4===b.length){var c=b[2]-b[0],e=b[3]-b[1],f=document.createElementNS(g,"svg:rect");f.setAttributeNS(null,"x",b[0]),f.setAttributeNS(null,"y",b[1]),f.setAttributeNS(null,"width",d(c)),f.setAttributeNS(null,"height",d(e)),this.current.element=f,this.clip("nonzero"),this.endPath()}},paintFormXObjectEnd:function(){this.restore()}},f}();PDFJS.SVGGraphics=wa}.call("undefined"==typeof window?this:window),PDFJS.workerSrc||"undefined"==typeof document||(PDFJS.workerSrc=function(){"use strict";var a=document.body||document.getElementsByTagName("head")[0],b=a.lastChild.src;return b&&b.replace(/\.js$/i,".worker.js")}()),"undefined"==typeof PDFJS&&(("undefined"!=typeof window?window:this).PDFJS={}),PDFJS.version="1.1.551",PDFJS.build="2a5616c",function(){"use strict";function a(a){PDFJS.verbosity>=PDFJS.VERBOSITY_LEVELS.infos&&console.log("Info: "+a)}function b(a){PDFJS.verbosity>=PDFJS.VERBOSITY_LEVELS.warnings&&console.log("Warning: "+a)}function c(a){throw PDFJS.verbosity>=PDFJS.VERBOSITY_LEVELS.errors&&(console.log("Error: "+a),console.log(d())),aa.notify(_.unknown),new Error(a)}function d(){try{throw new Error}catch(a){return a.stack?a.stack.split("\n").slice(2).join("\n"):""}}function e(a,b){a||c(b)}function f(a,b){if(!a)return!1;var c=/^[a-z][a-z0-9+\-.]*(?=:)/i.exec(a);if(!c)return b;switch(c=c[0].toLowerCase()){case"http":case"https":case"ftp":case"mailto":case"tel":return!0;default:return!1}}function g(a,b,c){return Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!1}),c}function h(){switch(PDFJS.openExternalLinksInNewWindow&&(b("PDFJS.openExternalLinksInNewWindow is deprecated, use PDFJS.externalLinkTarget instead."),PDFJS.externalLinkTarget===ba.NONE&&(PDFJS.externalLinkTarget=ba.BLANK),PDFJS.openExternalLinksInNewWindow=!1),PDFJS.externalLinkTarget){case ba.NONE:return!1;case ba.SELF:case ba.BLANK:case ba.PARENT:case ba.TOP:return!0}return b("PDFJS.externalLinkTarget is invalid: "+PDFJS.externalLinkTarget),PDFJS.externalLinkTarget=ba.NONE,!1}function i(a){e(null!==a&&"object"==typeof a&&void 0!==a.length,"Invalid argument for bytesToString");var b=a.length,c=8192;if(c>b)return String.fromCharCode.apply(null,a);for(var d=[],f=0;b>f;f+=c){var g=Math.min(f+c,b),h=a.subarray(f,g);d.push(String.fromCharCode.apply(null,h))}return d.join("")}function j(a){e("string"==typeof a,"Invalid argument for stringToBytes");for(var b=a.length,c=new Uint8Array(b),d=0;b>d;++d)c[d]=255&a.charCodeAt(d);return c}function k(a){return String.fromCharCode(a>>24&255,a>>16&255,a>>8&255,255&a)}function l(a){for(var b=1,c=0;a>b;)b<<=1,c++;return c}function m(a,b){return a[b]<<24>>24}function n(a,b){return a[b]<<8|a[b+1]}function o(a,b){return(a[b]<<24|a[b+1]<<16|a[b+2]<<8|a[b+3])>>>0}function p(){var a=new Uint8Array(2);a[0]=1;var b=new Uint16Array(a.buffer);return 1===b[0]}function q(){var a=document.createElement("canvas");a.width=a.height=1;var b=a.getContext("2d"),c=b.createImageData(1,1);return"undefined"!=typeof c.data.buffer}function r(a){var b,c=a.length,d=[];if("þ"===a[0]&&"ÿ"===a[1])for(b=2;c>b;b+=2)d.push(String.fromCharCode(a.charCodeAt(b)<<8|a.charCodeAt(b+1)));else for(b=0;c>b;++b){var e=oa[a.charCodeAt(b)];d.push(e?String.fromCharCode(e):a.charAt(b))}return d.join("")}function s(a){return decodeURIComponent(escape(a))}function t(a){return unescape(encodeURIComponent(a))}function u(a){for(var b in a)return!1;return!0}function v(a){return"boolean"==typeof a}function w(a){return"number"==typeof a&&(0|a)===a}function x(a){return"number"==typeof a}function y(a){return"string"==typeof a}function z(a){return a instanceof ya}function A(a,b){return a instanceof za&&(void 0===b||a.cmd===b)}function B(a,b){if(!(a instanceof Aa))return!1;if(!b)return!0;var c=a.get("Type");return z(c)&&c.name===b}function C(a){return a instanceof Array}function D(a){return"object"==typeof a&&null!==a&&void 0!==a.getBytes}function E(a){return"object"==typeof a&&null!==a&&void 0!==a.byteLength}function F(a){return a instanceof Ba}function G(){var a={};return a.promise=new Promise(function(b,c){a.resolve=b,a.reject=c}),a}function H(a,b){this.name=a,this.comObj=b,this.callbackIndex=1,this.postMessageTransfers=!0;var d=this.callbacksCapabilities={},e=this.actionHandler={};e.console_log=[function(a){console.log.apply(console,a)}],e.console_error=[function(a){console.error.apply(console,a)}],e._unsupported_feature=[function(a){aa.notify(a)}],b.onmessage=function(a){var f=a.data;if(f.isReply){var g=f.callbackId;if(f.callbackId in d){var h=d[g];delete d[g],"error"in f?h.reject(f.error):h.resolve(f.data)}else c("Cannot resolve callback "+g)}else if(f.action in e){var i=e[f.action];f.callbackId?Promise.resolve().then(function(){return i[0].call(i[1],f.data)}).then(function(a){b.postMessage({isReply:!0,callbackId:f.callbackId,data:a})},function(a){a instanceof Error&&(a+=""),b.postMessage({isReply:!0,callbackId:f.callbackId,error:a})}):i[0].call(i[1],f.data)}else c("Unknown action from worker: "+f.action)}}function I(){}function J(a,b,c){var d=b.get("Matrix"),e=b.get("BBox"),f=b.get("XStep"),g=b.get("YStep"),h=b.get("PaintType"),i=b.get("TilingType");return["TilingPattern",c,a,d,e,f,g,h,i]}function K(a){return a>=65520&&65535>=a?0:a>=62976&&63743>=a?Wb[a]||a:a}function L(a){for(var b=0,c=Xb.length;c>b;b++){var d=Xb[b];if(a>=d.begin&&a=b.begin&&a=b.begin&&a=b||!M(a.charCodeAt(0)))return a;for(var c="",d=b-1;d>=0;d--)c+=a[d];return c}function O(a){if(a.fontMatrix[0]!==T[0]){var b=.001/a.fontMatrix[0],c=a.widths;for(var d in c)c[d]*=b;a.defaultWidth*=b}}function P(a,b){switch(a){case"Type1":return"Type1C"===b?Z.TYPE1C:Z.TYPE1;case"CIDFontType0":return"CIDFontType0C"===b?Z.CIDFONTTYPE0C:Z.CIDFONTTYPE0;case"OpenType":return Z.OPENTYPE;case"TrueType":return Z.TRUETYPE;case"CIDFontType2":return Z.CIDFONTTYPE2;case"MMType1":return Z.MMTYPE1;case"Type0":return Z.TYPE0;default:return Z.UNKNOWN}}function Q(a,b,c){var d,e,f,g=Object.create(null);if(a.baseEncodingName)for(f=Pb[a.baseEncodingName],e=0;e=0?g[e]=d:g[e]=0;else if(a.flags&Ob.Symbolic)for(e in b)g[e]=b[e];else for(f=Pb.StandardEncoding,e=0;e=0?g[e]=d:g[e]=0;var h=a.differences;if(h)for(e in h){var i=h[e];d=c.indexOf(i),d>=0?g[e]=d:g[e]=0}return g}function R(a){return a===Dc}var S="undefined"==typeof window?this:window,T=("undefined"==typeof window,[.001,0,0,.001,0,0]),U={FILL:0,STROKE:1,FILL_STROKE:2,INVISIBLE:3,FILL_ADD_TO_PATH:4,STROKE_ADD_TO_PATH:5,FILL_STROKE_ADD_TO_PATH:6,ADD_TO_PATH:7,FILL_STROKE_MASK:3,ADD_TO_PATH_FLAG:4},V={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3},W={WIDGET:1,TEXT:2,LINK:3},X={SOLID:1,DASHED:2,BEVELED:3,INSET:4,UNDERLINE:5},Y={UNKNOWN:0,FLATE:1,LZW:2,DCT:3,JPX:4,JBIG:5,A85:6,AHX:7,CCF:8,RL:9},Z={UNKNOWN:0,TYPE1:1,TYPE1C:2,CIDFONTTYPE0:3,CIDFONTTYPE0C:4,TRUETYPE:5,CIDFONTTYPE2:6,TYPE3:7,OPENTYPE:8,TYPE0:9,MMTYPE1:10};S.PDFJS||(S.PDFJS={}),S.PDFJS.pdfBug=!1,PDFJS.VERBOSITY_LEVELS={errors:0,warnings:1,infos:5};var $=PDFJS.OPS={dependency:1,setLineWidth:2,setLineCap:3,setLineJoin:4,setMiterLimit:5,setDash:6,setRenderingIntent:7,setFlatness:8,setGState:9,save:10,restore:11,transform:12,moveTo:13,lineTo:14,curveTo:15,curveTo2:16,curveTo3:17,closePath:18,rectangle:19,stroke:20,closeStroke:21,fill:22,eoFill:23,fillStroke:24,eoFillStroke:25,closeFillStroke:26,closeEOFillStroke:27,endPath:28,clip:29,eoClip:30,beginText:31,endText:32,setCharSpacing:33,setWordSpacing:34,setHScale:35,setLeading:36,setFont:37,setTextRenderingMode:38,setTextRise:39,moveText:40,setLeadingMoveText:41,setTextMatrix:42,nextLine:43,showText:44,showSpacedText:45,nextLineShowText:46,nextLineSetSpacingShowText:47,setCharWidth:48,setCharWidthAndBounds:49,setStrokeColorSpace:50,setFillColorSpace:51,setStrokeColor:52,setStrokeColorN:53,setFillColor:54,setFillColorN:55,setStrokeGray:56,setFillGray:57,setStrokeRGBColor:58,setFillRGBColor:59,setStrokeCMYKColor:60,setFillCMYKColor:61,shadingFill:62,beginInlineImage:63,beginImageData:64,endInlineImage:65,paintXObject:66,markPoint:67,markPointProps:68,beginMarkedContent:69,beginMarkedContentProps:70,endMarkedContent:71,beginCompat:72,endCompat:73,paintFormXObjectBegin:74,paintFormXObjectEnd:75,beginGroup:76,endGroup:77,beginAnnotations:78,endAnnotations:79,beginAnnotation:80,endAnnotation:81,paintJpegXObject:82,paintImageMaskXObject:83,paintImageMaskXObjectGroup:84,paintImageXObject:85,paintInlineImageXObject:86,paintInlineImageXObjectGroup:87,paintImageXObjectRepeat:88,paintImageMaskXObjectRepeat:89,paintSolidColorImageMask:90,constructPath:91},_=PDFJS.UNSUPPORTED_FEATURES={unknown:"unknown",forms:"forms",javaScript:"javaScript",smask:"smask",shadingPattern:"shadingPattern",font:"font"},aa=PDFJS.UnsupportedManager=function(){var a=[];return{listen:function(b){a.push(b)},notify:function(c){b('Unsupported feature "'+c+'"');for(var d=0,e=a.length;e>d;d++)a[d](c)}}}();PDFJS.isValidUrl=f,PDFJS.shadow=g;var ba=PDFJS.LinkTarget={NONE:0,SELF:1,BLANK:2,PARENT:3,TOP:4};PDFJS.isExternalLinkTargetSet=h;var ca=PDFJS.PasswordResponses={NEED_PASSWORD:1,INCORRECT_PASSWORD:2},da=function(){function a(a,b){this.name="PasswordException",this.message=a,this.code=b}return a.prototype=new Error,a.constructor=a,a}();PDFJS.PasswordException=da;var ea=function(){function a(a,b){this.name="UnknownErrorException",this.message=a,this.details=b}return a.prototype=new Error,a.constructor=a,a}();PDFJS.UnknownErrorException=ea;var fa=function(){function a(a){this.name="InvalidPDFException",this.message=a}return a.prototype=new Error,a.constructor=a,a}();PDFJS.InvalidPDFException=fa;var ga=function(){function a(a){this.name="MissingPDFException",this.message=a}return a.prototype=new Error,a.constructor=a,a}();PDFJS.MissingPDFException=ga;var ha=function(){function a(a,b){this.name="UnexpectedResponseException",this.message=a,this.status=b}return a.prototype=new Error,a.constructor=a,a}();PDFJS.UnexpectedResponseException=ha;var ia=function(){function a(a){this.message=a}return a.prototype=new Error,a.prototype.name="NotImplementedException",a.constructor=a,a}(),ja=function(){function a(a,b){this.begin=a,this.end=b,this.message="Missing data ["+a+", "+b+")"}return a.prototype=new Error,a.prototype.name="MissingDataException",a.constructor=a,a}(),ka=function(){function a(a){this.message=a}return a.prototype=new Error,a.prototype.name="XRefParseException",a.constructor=a,a}();Object.defineProperty(PDFJS,"isLittleEndian",{configurable:!0,get:function(){return g(PDFJS,"isLittleEndian",p())}}),Object.defineProperty(PDFJS,"hasCanvasTypedArrays",{configurable:!0,get:function(){return g(PDFJS,"hasCanvasTypedArrays",q())}});var la=function(){function a(a,b){this.buffer=a,this.byteLength=a.length,this.length=void 0===b?this.byteLength>>2:b,c(this.length)}function b(a){return{get:function(){var b=this.buffer,c=a<<2;return(b[c]|b[c+1]<<8|b[c+2]<<16|b[c+3]<<24)>>>0},set:function(b){var c=this.buffer,d=a<<2;c[d]=255&b,c[d+1]=b>>8&255,c[d+2]=b>>16&255,c[d+3]=b>>>24&255}}}function c(c){for(;c>d;)Object.defineProperty(a.prototype,d,b(d)),d++}a.prototype=Object.create(null);var d=0;return a}(),ma=[1,0,0,1,0,0],na=PDFJS.Util=function(){function a(){}var b=["rgb(",0,",",0,",",0,")"];return a.makeCssRgb=function(a,c,d){return b[1]=a,b[3]=c,b[5]=d,b.join("")},a.transform=function(a,b){return[a[0]*b[0]+a[2]*b[1],a[1]*b[0]+a[3]*b[1],a[0]*b[2]+a[2]*b[3],a[1]*b[2]+a[3]*b[3],a[0]*b[4]+a[2]*b[5]+a[4],a[1]*b[4]+a[3]*b[5]+a[5]]},a.applyTransform=function(a,b){var c=a[0]*b[0]+a[1]*b[2]+b[4],d=a[0]*b[1]+a[1]*b[3]+b[5];return[c,d]},a.applyInverseTransform=function(a,b){var c=b[0]*b[3]-b[1]*b[2],d=(a[0]*b[3]-a[1]*b[2]+b[2]*b[5]-b[4]*b[3])/c,e=(-a[0]*b[1]+a[1]*b[0]+b[4]*b[1]-b[5]*b[0])/c;return[d,e]},a.getAxialAlignedBoundingBox=function(b,c){var d=a.applyTransform(b,c),e=a.applyTransform(b.slice(2,4),c),f=a.applyTransform([b[0],b[3]],c),g=a.applyTransform([b[2],b[1]],c);return[Math.min(d[0],e[0],f[0],g[0]),Math.min(d[1],e[1],f[1],g[1]),Math.max(d[0],e[0],f[0],g[0]),Math.max(d[1],e[1],f[1],g[1])]},a.inverseTransform=function(a){var b=a[0]*a[3]-a[1]*a[2];return[a[3]/b,-a[1]/b,-a[2]/b,a[0]/b,(a[2]*a[5]-a[4]*a[3])/b,(a[4]*a[1]-a[5]*a[0])/b]},a.apply3dTransform=function(a,b){return[a[0]*b[0]+a[1]*b[1]+a[2]*b[2],a[3]*b[0]+a[4]*b[1]+a[5]*b[2],a[6]*b[0]+a[7]*b[1]+a[8]*b[2]]},a.singularValueDecompose2dScale=function(a){var b=[a[0],a[2],a[1],a[3]],c=a[0]*b[0]+a[1]*b[2],d=a[0]*b[1]+a[1]*b[3],e=a[2]*b[0]+a[3]*b[2],f=a[2]*b[1]+a[3]*b[3],g=(c+f)/2,h=Math.sqrt((c+f)*(c+f)-4*(c*f-e*d))/2,i=g+h||1,j=g-h||1;return[Math.sqrt(i),Math.sqrt(j)]},a.normalizeRect=function(a){var b=a.slice(0);return a[0]>a[2]&&(b[0]=a[2],b[2]=a[0]),a[1]>a[3]&&(b[1]=a[3],b[3]=a[1]),b},a.intersect=function(b,c){function d(a,b){return a-b}var e=[b[0],b[2],c[0],c[2]].sort(d),f=[b[1],b[3],c[1],c[3]].sort(d),g=[];return b=a.normalizeRect(b),c=a.normalizeRect(c),e[0]===b[0]&&e[1]===c[0]||e[0]===c[0]&&e[1]===b[0]?(g[0]=e[1],g[2]=e[2],f[0]===b[1]&&f[1]===c[1]||f[0]===c[1]&&f[1]===b[1]?(g[1]=f[1],g[3]=f[2],g):!1):!1},a.sign=function(a){return 0>a?-1:1},a.appendToArray=function(a,b){Array.prototype.push.apply(a,b)},a.prependToArray=function(a,b){Array.prototype.unshift.apply(a,b)},a.extendObj=function(a,b){for(var c in b)a[c]=b[c]},a.getInheritableProperty=function(a,b){for(;a&&!a.has(b);)a=a.get("Parent");return a?a.get(b):null},a.inherit=function(a,b,c){a.prototype=Object.create(b.prototype),a.prototype.constructor=a;for(var d in c)a.prototype[d]=c[d]},a.loadScript=function(a,b){var c=document.createElement("script"),d=!1;c.setAttribute("src",a),b&&(c.onload=function(){d||b(),d=!0}),document.getElementsByTagName("head")[0].appendChild(c)},a}(),oa=(PDFJS.PageViewport=function(){function a(a,b,c,d,e,f){this.viewBox=a,this.scale=b,this.rotation=c,this.offsetX=d,this.offsetY=e;var g,h,i,j,k=(a[2]+a[0])/2,l=(a[3]+a[1])/2;switch(c%=360,c=0>c?c+360:c){case 180:g=-1,h=0,i=0,j=1;break;case 90:g=0,h=1,i=1,j=0;break;case 270:g=0,h=-1,i=-1,j=0;break;default:g=1,h=0,i=0,j=-1}f&&(i=-i,j=-j);var m,n,o,p;0===g?(m=Math.abs(l-a[1])*b+d,n=Math.abs(k-a[0])*b+e,o=Math.abs(a[3]-a[1])*b,p=Math.abs(a[2]-a[0])*b):(m=Math.abs(k-a[0])*b+d,n=Math.abs(l-a[1])*b+e,o=Math.abs(a[2]-a[0])*b,p=Math.abs(a[3]-a[1])*b),this.transform=[g*b,h*b,i*b,j*b,m-g*b*k-i*b*l,n-h*b*k-j*b*l],this.width=o,this.height=p,this.fontScale=b}return a.prototype={clone:function(b){b=b||{};var c="scale"in b?b.scale:this.scale,d="rotation"in b?b.rotation:this.rotation;return new a(this.viewBox.slice(),c,d,this.offsetX,this.offsetY,b.dontFlip)},convertToViewportPoint:function(a,b){return na.applyTransform([a,b],this.transform)},convertToViewportRectangle:function(a){var b=na.applyTransform([a[0],a[1]],this.transform),c=na.applyTransform([a[2],a[3]],this.transform);return[b[0],b[1],c[0],c[1]]},convertToPdfPoint:function(a,b){return na.applyInverseTransform([a,b],this.transform)}},a}(),[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,728,711,710,729,733,731,730,732,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8226,8224,8225,8230,8212,8211,402,8260,8249,8250,8722,8240,8222,8220,8221,8216,8217,8218,8482,64257,64258,321,338,352,376,381,305,322,339,353,382,0,8364]);PDFJS.createPromiseCapability=G,function(){function a(a){this._status=c, +this._handlers=[];try{a.call(this,this._resolve.bind(this),this._reject.bind(this))}catch(b){this._reject(b)}}if(S.Promise)return"function"!=typeof S.Promise.all&&(S.Promise.all=function(a){var b,c,d=0,e=[],f=new S.Promise(function(a,d){b=a,c=d});return a.forEach(function(a,f){d++,a.then(function(a){e[f]=a,d--,0===d&&b(e)},c)}),0===d&&b(e),f}),"function"!=typeof S.Promise.resolve&&(S.Promise.resolve=function(a){return new S.Promise(function(b){b(a)})}),"function"!=typeof S.Promise.reject&&(S.Promise.reject=function(a){return new S.Promise(function(b,c){c(a)})}),void("function"!=typeof S.Promise.prototype["catch"]&&(S.Promise.prototype["catch"]=function(a){return S.Promise.prototype.then(void 0,a)}));var c=0,d=1,e=2,f=500,g={handlers:[],running:!1,unhandledRejections:[],pendingRejectionCheck:!1,scheduleHandlers:function(a){a._status!==c&&(this.handlers=this.handlers.concat(a._handlers),a._handlers=[],this.running||(this.running=!0,setTimeout(this.runHandlers.bind(this),0)))},runHandlers:function(){for(var a=1,b=Date.now()+a;this.handlers.length>0;){var c=this.handlers.shift(),f=c.thisPromise._status,g=c.thisPromise._value;try{f===d?"function"==typeof c.onResolve&&(g=c.onResolve(g)):"function"==typeof c.onReject&&(g=c.onReject(g),f=d,c.thisPromise._unhandledRejection&&this.removeUnhandeledRejection(c.thisPromise))}catch(h){f=e,g=h}if(c.nextPromise._updateStatus(f,g),Date.now()>=b)break}return this.handlers.length>0?void setTimeout(this.runHandlers.bind(this),0):void(this.running=!1)},addUnhandledRejection:function(a){this.unhandledRejections.push({promise:a,time:Date.now()}),this.scheduleRejectionCheck()},removeUnhandeledRejection:function(a){a._unhandledRejection=!1;for(var b=0;bf){var d=this.unhandledRejections[c].promise._value,e="Unhandled rejection: "+d;d.stack&&(e+="\n"+d.stack),b(e),this.unhandledRejections.splice(c),c--}this.unhandledRejections.length&&this.scheduleRejectionCheck()}.bind(this),f))}};a.all=function(b){function c(a){g._status!==e&&(i=[],f(a))}var d,f,g=new a(function(a,b){d=a,f=b}),h=b.length,i=[];if(0===h)return d(i),g;for(var j=0,k=b.length;k>j;++j){var l=b[j],m=function(a){return function(b){g._status!==e&&(i[a]=b,h--,0===h&&d(i))}}(j);a.isPromise(l)?l.then(m,c):m(l)}return g},a.isPromise=function(a){return a&&"function"==typeof a.then},a.resolve=function(b){return new a(function(a){a(b)})},a.reject=function(b){return new a(function(a,c){c(b)})},a.prototype={_status:null,_value:null,_handlers:null,_unhandledRejection:null,_updateStatus:function(b,c){if(this._status!==d&&this._status!==e){if(b===d&&a.isPromise(c))return void c.then(this._updateStatus.bind(this,d),this._updateStatus.bind(this,e));this._status=b,this._value=c,b===e&&0===this._handlers.length&&(this._unhandledRejection=!0,g.addUnhandledRejection(this)),g.scheduleHandlers(this)}},_resolve:function(a){this._updateStatus(d,a)},_reject:function(a){this._updateStatus(e,a)},then:function(b,c){var d=new a(function(a,b){this.resolve=a,this.reject=b});return this._handlers.push({thisPromise:this,onResolve:b,onReject:c,nextPromise:d}),g.scheduleHandlers(this),d},"catch":function(a){return this.then(void 0,a)}},S.Promise=a}();(function(){function a(a,b,c){for(;a.lengthb;++b){var g=d[b].name;g.length>f&&(f=g.length)}for(b=0,c=d.length;c>b;++b){var h=d[b],i=h.end-h.start;e+=a(h.name," ",f)+" "+i+"ms\n"}return e}},c})();PDFJS.createBlob=function(a,b){if("undefined"!=typeof Blob)return new Blob([a],{type:b});var c=new MozBlobBuilder;return c.append(a),c.getBlob(b)},PDFJS.createObjectURL=function(){var a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";return function(b,c){if(!PDFJS.disableCreateObjectURL&&"undefined"!=typeof URL&&URL.createObjectURL){var d=PDFJS.createBlob(b,c);return URL.createObjectURL(d)}for(var e="data:"+c+";base64,",f=0,g=b.length;g>f;f+=3){var h=255&b[f],i=255&b[f+1],j=255&b[f+2],k=h>>2,l=(3&h)<<4|i>>4,m=g>f+1?(15&i)<<2|j>>6:64,n=g>f+2?63&j:64;e+=a[k]+a[l]+a[m]+a[n]}return e}}(),H.prototype={on:function(a,b,d){var e=this.actionHandler;e[a]&&c('There is already an actionName called "'+a+'"'),e[a]=[b,d]},send:function(a,b,c){var d={action:a,data:b};this.postMessage(d,c)},sendWithPromise:function(a,b,c){var d=this.callbackIndex++,e={action:a,data:b,callbackId:d},f=G();this.callbacksCapabilities[d]=f;try{this.postMessage(e,c)}catch(g){f.reject(g)}return f.promise},postMessage:function(a,b){b&&this.postMessageTransfers?this.comObj.postMessage(a,b):this.comObj.postMessage(a)}};var pa=function(){function a(a,b){this.url=a,b=b||{},this.isHttp=/^https?:/i.test(a),this.httpHeaders=this.isHttp&&b.httpHeaders||{},this.withCredentials=b.withCredentials||!1,this.getXhr=b.getXhr||function(){return new XMLHttpRequest},this.currXhrId=0,this.pendingRequests={},this.loadedRequests={}}function b(a){var b=a.response;if("string"!=typeof b)return b;for(var c=b.length,d=new Uint8Array(c),e=0;c>e;e++)d[e]=255&b.charCodeAt(e);return d.buffer}var c=200,d=206,e=function(){try{var a=new XMLHttpRequest;return a.open("GET","https://example.com"),a.responseType="moz-chunked-arraybuffer","moz-chunked-arraybuffer"===a.responseType}catch(b){return!1}}();return a.prototype={requestRange:function(a,b,c){var d={begin:a,end:b};for(var e in c)d[e]=c[e];return this.request(d)},requestFull:function(a){return this.request(a)},request:function(a){var b=this.getXhr(),c=this.currXhrId++,d=this.pendingRequests[c]={xhr:b};b.open("GET",this.url),b.withCredentials=this.withCredentials;for(var f in this.httpHeaders){var g=this.httpHeaders[f];"undefined"!=typeof g&&b.setRequestHeader(f,g)}if(this.isHttp&&"begin"in a&&"end"in a){var h=a.begin+"-"+(a.end-1);b.setRequestHeader("Range","bytes="+h),d.expectedStatus=206}else d.expectedStatus=200;var i=e&&!!a.onProgressiveData;return i?(b.responseType="moz-chunked-arraybuffer",d.onProgressiveData=a.onProgressiveData,d.mozChunked=!0):b.responseType="arraybuffer",a.onError&&(b.onerror=function(c){a.onError(b.status)}),b.onreadystatechange=this.onStateChange.bind(this,c),b.onprogress=this.onProgress.bind(this,c),d.onHeadersReceived=a.onHeadersReceived,d.onDone=a.onDone,d.onError=a.onError,d.onProgress=a.onProgress,b.send(null),c},onProgress:function(a,c){var d=this.pendingRequests[a];if(d){if(d.mozChunked){var e=b(d.xhr);d.onProgressiveData(e)}var f=d.onProgress;f&&f(c)}},onStateChange:function(a,e){var f=this.pendingRequests[a];if(f){var g=f.xhr;if(g.readyState>=2&&f.onHeadersReceived&&(f.onHeadersReceived(),delete f.onHeadersReceived),4===g.readyState&&a in this.pendingRequests){if(delete this.pendingRequests[a],0===g.status&&this.isHttp)return void(f.onError&&f.onError(g.status));var h=g.status||c,i=h===c&&f.expectedStatus===d;if(!i&&h!==f.expectedStatus)return void(f.onError&&f.onError(g.status));this.loadedRequests[a]=!0;var j=b(g);if(h===d){var k=g.getResponseHeader("Content-Range"),l=/bytes (\d+)-(\d+)\/(\d+)/.exec(k),m=parseInt(l[1],10);f.onDone({begin:m,chunk:j})}else f.onProgressiveData?f.onDone(null):f.onDone({begin:0,chunk:j})}}},hasPendingRequests:function(){for(var a in this.pendingRequests)return!0;return!1},getRequestXhr:function(a){return this.pendingRequests[a].xhr},isStreamingRequest:function(a){return!!this.pendingRequests[a].onProgressiveData},isPendingRequest:function(a){return a in this.pendingRequests},isLoadedRequest:function(a){return a in this.loadedRequests},abortAllRequests:function(){for(var a in this.pendingRequests)this.abortRequest(0|a)},abortRequest:function(a){var b=this.pendingRequests[a].xhr;delete this.pendingRequests[a],b.abort()}},a}(),qa=function(){function a(a,b,c){this.bytes=new Uint8Array(a),this.start=0,this.pos=0,this.end=a,this.chunkSize=b,this.loadedChunks=[],this.numChunksLoaded=0,this.numChunks=Math.ceil(a/b),this.manager=c,this.progressiveDataLength=0,this.lastSuccessfulEnsureByteChunk=-1}return a.prototype={getMissingChunks:function(){for(var a=[],b=0,c=this.numChunks;c>b;++b)this.loadedChunks[b]||a.push(b);return a},getBaseStreams:function(){return[this]},allChunksLoaded:function(){return this.numChunksLoaded===this.numChunks},onReceiveData:function(a,b){var c=a+b.byteLength;e(a%this.chunkSize===0,"Bad begin offset: "+a);var d=this.bytes.length;e(c%this.chunkSize===0||c===d,"Bad end offset: "+c),this.bytes.set(new Uint8Array(b),a);var f,g=this.chunkSize,h=Math.floor(a/g),i=Math.floor((c-1)/g)+1;for(f=h;i>f;++f)this.loadedChunks[f]||(this.loadedChunks[f]=!0,++this.numChunksLoaded)},onReceiveProgressiveData:function(a){var b=this.progressiveDataLength,c=Math.floor(b/this.chunkSize);this.bytes.set(new Uint8Array(a),b),b+=a.byteLength,this.progressiveDataLength=b;var d,e=b>=this.end?this.numChunks:Math.floor(b/this.chunkSize);for(d=c;e>d;++d)this.loadedChunks[d]||(this.loadedChunks[d]=!0,++this.numChunksLoaded)},ensureByte:function(a){var b=Math.floor(a/this.chunkSize);if(b!==this.lastSuccessfulEnsureByteChunk){if(!this.loadedChunks[b])throw new ja(a,a+1);this.lastSuccessfulEnsureByteChunk=b}},ensureRange:function(a,b){if(!(a>=b||b<=this.progressiveDataLength))for(var c=this.chunkSize,d=Math.floor(a/c),e=Math.floor((b-1)/c)+1,f=d;e>f;++f)if(!this.loadedChunks[f])throw new ja(a,b)},nextEmptyChunk:function(a){for(var b,c=this.numChunks,d=0;c>d;++d)if(b=(a+d)%c,!this.loadedChunks[b])return b;return null},hasChunk:function(a){return!!this.loadedChunks[a]},get length(){return this.end-this.start},get isEmpty(){return 0===this.length},getByte:function(){var a=this.pos;return a>=this.end?-1:(this.ensureByte(a),this.bytes[this.pos++])},getUint16:function(){var a=this.getByte(),b=this.getByte();return-1===a||-1===b?-1:(a<<8)+b},getInt32:function(){var a=this.getByte(),b=this.getByte(),c=this.getByte(),d=this.getByte();return(a<<24)+(b<<16)+(c<<8)+d},getBytes:function(a){var b=this.bytes,c=this.pos,d=this.end;if(!a)return this.ensureRange(c,d),b.subarray(c,d);var e=c+a;return e>d&&(e=d),this.ensureRange(c,e),this.pos=e,b.subarray(c,e)},peekByte:function(){var a=this.getByte();return this.pos--,a},peekBytes:function(a){var b=this.getBytes(a);return this.pos-=b.length,b},getByteRange:function(a,b){return this.ensureRange(a,b),this.bytes.subarray(a,b)},skip:function(a){a||(a=1),this.pos+=a},reset:function(){this.pos=this.start},moveStart:function(){this.start=this.pos},makeSubStream:function(a,b,c){function d(){}this.ensureRange(a,a+b),d.prototype=Object.create(this),d.prototype.getMissingChunks=function(){for(var a=this.chunkSize,b=Math.floor(this.start/a),c=Math.floor((this.end-1)/a)+1,d=[],e=b;c>e;++e)this.loadedChunks[e]||d.push(e);return d};var e=new d;return e.pos=e.start=a,e.end=a+b||this.end,e.dict=c,e},isStream:!0},a}(),ra=function(){function a(a,b,c,d){this.stream=new qa(a,b,this),this.length=a,this.chunkSize=b,this.url=c,this.disableAutoFetch=d.disableAutoFetch;var e=this.msgHandler=d.msgHandler;if(d.chunkedViewerLoading)e.on("OnDataRange",this.onReceiveData.bind(this)),e.on("OnDataProgress",this.onProgress.bind(this)),this.sendRequest=function(a,b){e.send("RequestDataRange",{begin:a,end:b})};else{var f=function(){return new XMLHttpRequest};this.networkManager=new pa(this.url,{getXhr:f,httpHeaders:d.httpHeaders,withCredentials:d.withCredentials}),this.sendRequest=function(a,b){this.networkManager.requestRange(a,b,{onDone:this.onReceiveData.bind(this),onProgress:this.onProgress.bind(this)})}}this.currRequestId=0,this.chunksNeededByRequest={},this.requestsByChunk={},this.promisesByRequest={},this.progressiveDataLength=0,this._loadedStreamCapability=G(),d.initialData&&this.onReceiveData({chunk:d.initialData})}return a.prototype={onLoadedStream:function(){return this._loadedStreamCapability.promise},requestAllChunks:function(){var a=this.stream.getMissingChunks();return this._requestChunks(a),this._loadedStreamCapability.promise},_requestChunks:function(a){var b,c,d,e=this.currRequestId++;for(this.chunksNeededByRequest[e]=b={},c=0,d=a.length;d>c;c++)this.stream.hasChunk(a[c])||(b[a[c]]=!0);if(u(b))return Promise.resolve();var f=G();this.promisesByRequest[e]=f;var g=[];for(var h in b)h=0|h,h in this.requestsByChunk||(this.requestsByChunk[h]=[],g.push(h)),this.requestsByChunk[h].push(e);if(!g.length)return f.promise;var i=this.groupChunks(g);for(c=0;cf;++f)e.push(f);return this._requestChunks(e)},requestRanges:function(a){a=a||[];for(var b=[],c=0;cf;++f)b.indexOf(f)<0&&b.push(f);return b.sort(function(a,b){return a-b}),this._requestChunks(b)},groupChunks:function(a){for(var b=[],c=-1,d=-1,e=0;ec&&(c=f),d>=0&&d+1!==f&&(b.push({beginChunk:c,endChunk:d+1}),c=f),e+1===a.length&&b.push({beginChunk:c,endChunk:f+1}),d=f}return b},onProgress:function(a){var b=this.stream.numChunksLoaded*this.chunkSize+a.loaded;this.msgHandler.send("DocProgress",{loaded:b,total:this.length})},onReceiveData:function(a){var b=a.chunk,c=void 0===a.begin,d=c?this.progressiveDataLength:a.begin,e=d+b.byteLength,f=Math.floor(d/this.chunkSize),g=eb;++b){var k=this.requestsByChunk[b]||[];for(delete this.requestsByChunk[b],h=0;hf){b("Page_getInheritedPageProp: maximum loop count exceeded.");break}c=c.get("Parent")}return d?1===d.length||!B(d[0])||e>f?d[0]:Aa.merge(this.xref,d):Aa.empty},get content(){return this.getPageProp("Contents")},get resources(){return g(this,"resources",this.getInheritedPageProp("Resources"))},get mediaBox(){var a=this.getInheritedPageProp("MediaBox");return C(a)&&4===a.length||(a=c),g(this,"mediaBox",a)},get view(){var a=this.mediaBox,b=this.getInheritedPageProp("CropBox");return C(b)&&4===b.length?(b=na.intersect(b,a),b?g(this,"view",b):g(this,"view",a)):g(this,"view",a)},get rotate(){var a=this.getInheritedPageProp("Rotate")||0;return a%90!==0?a=0:a>=360?a%=360:0>a&&(a=(a%360+360)%360),g(this,"rotate",a)},getContentStream:function(){var a,b=this.content;if(C(b)){var c,d=this.xref,e=b.length,f=[];for(c=0;e>c;++c)f.push(d.fetchIfRef(b[c]));a=new Pc(f)}else a=D(b)?b:new _c;return a},loadResources:function(a){return this.resourcesPromise||(this.resourcesPromise=this.pdfManager.ensure(this,"resources")),this.resourcesPromise.then(function(){var b=new Ia(this.resources.map,a,this.xref);return b.load()}.bind(this))},getOperatorList:function(a,b,c){var d=this,e=this.pdfManager,f=e.ensure(this,"getContentStream",[]),g=this.loadResources(["ExtGState","ColorSpace","Pattern","Shading","XObject","Font"]),h=new vb(e,this.xref,a,this.pageIndex,"p"+this.pageIndex+"_",this.idCounters,this.fontCache),i=Promise.all([f,g]),j=i.then(function(e){var f=e[0],g=new xb(c,a,d.pageIndex);return a.send("StartRenderPage",{transparency:h.hasBlendModes(d.resources),pageIndex:d.pageIndex,intent:c}),h.getOperatorList(f,b,d.resources,g).then(function(){return g})}),k=e.ensure(this,"annotations");return Promise.all([j,k]).then(function(a){var d=a[0],f=a[1];if(0===f.length)return d.flush(!0),d;var g=Na.appendToOperatorList(f,d,e,h,b,c);return g.then(function(){return d.flush(!0),d})})},extractTextContent:function(a){var b={on:function(){},send:function(){}},c=this,d=this.pdfManager,e=d.ensure(this,"getContentStream",[]),f=this.loadResources(["ExtGState","XObject","Font"]),g=Promise.all([e,f]);return g.then(function(e){var f=e[0],g=new vb(d,c.xref,b,c.pageIndex,"p"+c.pageIndex+"_",c.idCounters,c.fontCache);return g.getTextContent(f,a,c.resources)})},getAnnotationsData:function(){for(var a=this.annotations,b=[],c=0,d=a.length;d>c;++c)b.push(a[c].data);return b},get annotations(){for(var a=[],b=this.getInheritedPageProp("Annots")||[],c=new I,d=0,e=b.length;e>d;++d){var f=b[d],h=c.create(this.xref,f);h&&(h.isViewable()||h.isPrintable())&&a.push(h)}return g(this,"annotations",a)}},a}(),xa=function(){function b(a,b,e){D(b)?d.call(this,a,b,e):E(b)?d.call(this,a,new Mc(b),e):c("PDFDocument: Unknown argument type")}function d(a,b,c){e(b.length>0,"stream must have data"),this.pdfManager=a,this.stream=b;var d=new Fa(this.stream,c,a);this.xref=d}function f(a,b,c,d){var e=a.pos,f=a.end,g=[];e+c>f&&(c=f-e);for(var h=0;c>h;++h)g.push(String.fromCharCode(a.getByte()));var i=g.join("");a.pos=e;var j=d?i.lastIndexOf(b):i.indexOf(b);return-1===j?!1:(a.pos+=j,!0)}var h=1024,i="\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",k={get entries(){return g(this,"entries",{Title:y,Author:y,Subject:y,Keywords:y,Creator:y,Producer:y,CreationDate:y,ModDate:y,Trapped:z})}};return b.prototype={parse:function(b){this.setup(b);var c=this.catalog.catDict.get("Version");z(c)&&(this.pdfFormatVersion=c.name);try{if(this.acroForm=this.catalog.catDict.get("AcroForm"),this.acroForm){this.xfa=this.acroForm.get("XFA");var d=this.acroForm.get("Fields");d&&C(d)&&0!==d.length||this.xfa||(this.acroForm=null)}}catch(e){a("Something wrong with AcroForm entry"),this.acroForm=null}},get linearization(){var b=null;if(this.stream.length)try{b=Hc.create(this.stream)}catch(c){if(c instanceof ja)throw c;a(c)}return g(this,"linearization",b)},get startXRef(){var a=this.stream,b=0,c=this.linearization;if(c)a.reset(),f(a,"endobj",1024)&&(b=a.pos+6);else{for(var d=1024,e=!1,h=a.end;!e&&h>0;)h-=d-"startxref".length,0>h&&(h=0),a.pos=h,e=f(a,"startxref",d,!0);if(e){a.skip(9);var i;do i=a.getByte();while(Gc.isSpace(i));for(var j="";i>=32&&57>=i;)j+=String.fromCharCode(i),i=a.getByte();b=parseInt(j,10),isNaN(b)&&(b=0)}}return g(this,"startXRef",b)},get mainXRefEntriesOffset(){var a=0,b=this.linearization;return b&&(a=b.mainXRefEntriesOffset),g(this,"mainXRefEntriesOffset",a)},checkHeader:function(){var a=this.stream;if(a.reset(),f(a,"%PDF-",1024)){a.moveStart();for(var b,c=12,d="";(b=a.getByte())>32&&!(d.length>=c);)d+=String.fromCharCode(b);return void(this.pdfFormatVersion||(this.pdfFormatVersion=d.substring(5)))}},parseStartXRef:function(){var a=this.startXRef;this.xref.setStartXRef(a)},setup:function(a){this.xref.parse(a),this.catalog=new Ea(this.pdfManager,this.xref)},get numPages(){var a=this.linearization,b=a?a.numPages:this.catalog.numPages;return g(this,"numPages",b)},get documentInfo(){var b,c={PDFFormatVersion:this.pdfFormatVersion,IsAcroFormPresent:!!this.acroForm,IsXFAPresent:!!this.xfa};try{b=this.xref.trailer.get("Info")}catch(d){a("The document information dictionary is invalid.")}if(b){var e=k.entries;for(var f in e)if(b.has(f)){var h=b.get(f);e[f](h)?c[f]="string"!=typeof h?h:r(h):a('Bad value in document info for "'+f+'"')}}return g(this,"documentInfo",c)},get fingerprint(){var a,b=this.xref,c="",d=b.trailer.get("ID");d&&C(d)&&d[0]&&y(d[0])&&d[0]!==i?a=j(d[0]):(this.stream.ensureRange&&this.stream.ensureRange(0,Math.min(h,this.stream.end)),a=gb(this.stream.bytes.subarray(0,h),0,h));for(var e=0,f=a.length;f>e;e++){var k=a[e].toString(16);c+=1===k.length?"0"+k:k}return g(this,"fingerprint",c)},getPage:function(a){return this.catalog.getPage(a)},cleanup:function(){return this.catalog.cleanup()}},b}(),ya=function(){function a(a){this.name=a}a.prototype={};var b={};return a.get=function(c){var d=b[c];return d?d:b[c]=new a(c)},a}(),za=function(){function a(a){this.cmd=a}a.prototype={};var b={};return a.get=function(c){var d=b[c];return d?d:b[c]=new a(c)},a}(),Aa=function(){function a(a){if(!z(a.Type))return!0;var b=a.Type.name;return d[b]===!0}function b(a){this.map=Object.create(null),this.xref=a,this.objId=null,this.__nonSerializable__=c}var c=function(){return c},d={Background:!0,ExtGState:!0,Halftone:!0,Layout:!0,Mask:!0,Pagination:!0,Printing:!0};return b.prototype={assignXref:function(a){this.xref=a},get:function(a,b,c){var d,e=this.xref;return"undefined"!=typeof(d=this.map[a])||a in this.map||"undefined"==typeof b?e?e.fetchIfRef(d):d:"undefined"!=typeof(d=this.map[b])||b in this.map||"undefined"==typeof c?e?e.fetchIfRef(d):d:(d=this.map[c]||null,e?e.fetchIfRef(d):d)},getAsync:function(a,b,c){var d,e=this.xref;return"undefined"!=typeof(d=this.map[a])||a in this.map||"undefined"==typeof b?e?e.fetchIfRefAsync(d):Promise.resolve(d):"undefined"!=typeof(d=this.map[b])||b in this.map||"undefined"==typeof c?e?e.fetchIfRefAsync(d):Promise.resolve(d):(d=this.map[c]||null,e?e.fetchIfRefAsync(d):Promise.resolve(d))},getArray:function(a,b,c){var d=this.get(a,b,c),e=this.xref;if(!C(d)||!e)return d;d=d.slice();for(var f=0,g=d.length;g>f;f++)F(d[f])&&(d[f]=e.fetch(d[f]));return d},getRaw:function(a){return this.map[a]},getAll:function(){var c,d,e=Object.create(null),f=null;for(c in this.map)d=this.get(c),d instanceof b?a(d)?(f||(f=[])).push({target:e,key:c,obj:d}):e[c]=this.getRaw(c):e[c]=d;if(!f)return e;for(var g=Object.create(null);f.length>0;){var h=f.shift(),i=h.obj,j=i.objId;if(j&&j in g)h.target[h.key]=g[j];else{var k=Object.create(null);for(c in i.map)d=i.get(c),d instanceof b?a(d)?f.push({target:k,key:c,obj:d}):k[c]=i.getRaw(c):k[c]=d;j&&(g[j]=k),h.target[h.key]=k}}return e},getKeys:function(){return Object.keys(this.map)},set:function(a,b){this.map[a]=b},has:function(a){return a in this.map},forEach:function(a){for(var b in this.map)a(b,this.get(b))}},b.empty=new b(null),b.merge=function(a,c){for(var d=new b(a),e=0,f=c.length;f>e;e++){var g=c[e];if(B(g))for(var h in g.map)d.map[h]||(d.map[h]=g.map[h])}return d},b}(),Ba=function(){function a(a,b){this.num=a,this.gen=b}return a.prototype={toString:function(){var a=this.num+"R";return 0!==this.gen&&(a+=this.gen),a}},a}(),Ca=function(){function a(){this.dict={}}return a.prototype={has:function(a){return a.toString()in this.dict},put:function(a){this.dict[a.toString()]=!0},remove:function(a){delete this.dict[a.toString()]}},a}(),Da=function(){function a(){this.dict=Object.create(null)}return a.prototype={get:function(a){return this.dict[a.toString()]},has:function(a){return a.toString()in this.dict},put:function(a,b){this.dict[a.toString()]=b},putAlias:function(a,b){this.dict[a.toString()]=this.get(b)},forEach:function(a,b){for(var c in this.dict)a.call(b,this.dict[c])},clear:function(){this.dict=Object.create(null)}},a}(),Ea=function(){function d(a,b){this.pdfManager=a,this.xref=b,this.catDict=b.getCatalogObj(),this.fontCache=new Da,e(B(this.catDict),"catalog object is not a dictionary"),this.pagePromises=[]}return d.prototype={get metadata(){var b=this.catDict.getRaw("Metadata");if(!F(b))return g(this,"metadata",null);var c,d=this.xref.encrypt?this.xref.encrypt.encryptMetadata:!1,e=this.xref.fetch(b,!d);if(e&&B(e.dict)){var f=e.dict.get("Type"),h=e.dict.get("Subtype");if(z(f)&&z(h)&&"Metadata"===f.name&&"XML"===h.name)try{c=s(i(e.getBytes()))}catch(j){a("Skipping invalid metadata.")}}return g(this,"metadata",c)},get toplevelPagesDict(){var a=this.catDict.get("Pages");return e(B(a),"invalid top-level pages dictionary"),g(this,"toplevelPagesDict",a)},get documentOutline(){var a=null;try{a=this.readDocumentOutline()}catch(c){if(c instanceof ja)throw c;b("Unable to read document outline")}return g(this,"documentOutline",a)},readDocumentOutline:function(){var a=this.xref,b=this.catDict.get("Outlines"),d={items:[]};if(B(b)){b=b.getRaw("First");var e=new Ca;if(F(b)){var f=[{obj:b,parent:d}];for(e.put(b);f.length>0;){var g=f.shift(),h=a.fetchIfRef(g.obj);if(null!==h){h.has("Title")||c("Invalid outline item");var i=h.get("A");i?i=i.get("D"):h.has("Dest")&&(i=h.getRaw("Dest"),z(i)&&(i=i.name));var j=h.get("Title"),k={dest:i,title:r(j),color:h.get("C")||[0,0,0],count:h.get("Count"),bold:!!(2&h.get("F")),italic:!!(1&h.get("F")),items:[]};g.parent.items.push(k),b=h.getRaw("First"),F(b)&&!e.has(b)&&(f.push({obj:b,parent:k}),e.put(b)),b=h.getRaw("Next"),F(b)&&!e.has(b)&&(f.push({obj:b,parent:g.parent}),e.put(b))}}}}return d.items.length>0?d.items:null},get numPages(){var a=this.toplevelPagesDict.get("Count");return e(w(a),"page count in top level pages object is not an integer"),g(this,"num",a)},get destinations(){function a(a){return B(a)?a.get("D"):a}var b,c,d=this.xref,e={},f=this.catDict.get("Names");if(f&&f.has("Dests")?b=f.getRaw("Dests"):this.catDict.has("Dests")&&(c=this.catDict.get("Dests")),c&&(f=c,f.forEach(function(b,c){c&&(e[b]=a(c))})),b){var h=new Ga(b,d),i=h.getAll();for(var j in i)i.hasOwnProperty(j)&&(e[j]=a(i[j]))}return g(this,"destinations",e)},getDestination:function(a){function b(a){return B(a)?a.get("D"):a}var c,d,e=this.xref,f=null,g=this.catDict.get("Names");if(g&&g.has("Dests")?c=g.getRaw("Dests"):this.catDict.has("Dests")&&(d=this.catDict.get("Dests")),d){var h=d.get(a);h&&(f=b(h))}if(c){var i=new Ga(c,e);f=b(i.get(a))}return f},get attachments(){var a,b=this.xref,c=null,d=this.catDict.get("Names");if(d&&(a=d.getRaw("EmbeddedFiles")),a){var e=new Ga(a,b),f=e.getAll();for(var h in f)if(f.hasOwnProperty(h)){var i=new Ha(f[h],b);c||(c={}),c[r(h)]=i.serializable}}return g(this,"attachments",c)},get javaScript(){function a(a){var b=a.get("S");if(z(b)&&"JavaScript"===b.name){var c=a.get("JS");if(D(c))c=i(c.getBytes());else if(!y(c))return;d.push(r(c))}}var b=this.xref,c=this.catDict.get("Names"),d=[];if(c&&c.has("JavaScript")){var e=new Ga(c.getRaw("JavaScript"),b),f=e.getAll();for(var h in f)if(f.hasOwnProperty(h)){var j=f[h];B(j)&&a(j)}}var k=this.catDict.get("OpenAction");if(B(k,"Action")){var l=k.get("S");if(z(l)&&"Named"===l.name){var m=k.get("N");z(m)&&"Print"===m.name&&d.push("print({});")}else a(k)}return g(this,"javaScript",d)},cleanup:function(){var a=[];return this.fontCache.forEach(function(b){a.push(b)}),Promise.all(a).then(function(a){for(var b=0,c=a.length;c>b;b++){var d=a[b].dict;delete d.translated}this.fontCache.clear()}.bind(this))},getPage:function(a){return a in this.pagePromises||(this.pagePromises[a]=this.getPageDict(a).then(function(b){var c=b[0],d=b[1];return new wa(this.pdfManager,this.xref,a,c,d,this.fontCache)}.bind(this))),this.pagePromises[a]},getPageDict:function(a){function b(){for(;d.length;){var i=d.pop();if(F(i))return void g.fetchAsync(i).then(function(e){return B(e,"Page")||B(e)&&!e.has("Kids")?void(a===f?c.resolve([e,i]):(f++,b())):(d.push(e),void b())},c.reject);e(B(i),"page dictionary kid reference points to wrong type of object");var j=i.get("Count");if(0===j&&(h=!0),a>=f+j)f+=j;else{var k=i.get("Kids");if(e(C(k),"page dictionary kids object is not an array"),h||j!==k.length)for(var l=k.length-1;l>=0;l--)d.push(k[l]);else d=[k[a-f]],f=a}}c.reject("Page index "+a+" not found.")}var c=G(),d=[this.catDict.getRaw("Pages")],f=0,g=this.xref,h=!1;return b(),c.promise},getPageIndex:function(a){function b(a){var b,d=0;return f.fetchAsync(a).then(function(a){return a?(b=a.getRaw("Parent"),a.getAsync("Parent")):null}).then(function(a){return a?a.getAsync("Kids"):null}).then(function(g){if(!g)return null;for(var h=[],i=!1,j=0;jh;h++){d.streamPos=b.pos,d.entryNum=h,d.parserBuf1=a.buf1,d.parserBuf2=a.buf2;var i={};i.offset=a.getObj(),i.gen=a.getObj();var j=a.getObj();A(j,"f")?i.free=!0:A(j,"n")&&(i.uncompressed=!0),w(i.offset)&&w(i.gen)&&(i.free||i.uncompressed)||c("Invalid entry in XRef subsection: "+f+", "+g),this.entries[h+f]||(this.entries[h+f]=i)}d.entryNum=0,d.streamPos=b.pos,d.parserBuf1=a.buf1,d.parserBuf2=a.buf2,delete d.firstEntryNum,delete d.entryCount}return 1===f&&this.entries[1]&&this.entries[1].free&&this.entries.shift(),this.entries[0]&&!this.entries[0].free&&c("Invalid XRef table: unexpected first object"),e},processXRefStream:function(a){if(!("streamState"in this)){var b=a.dict,c=b.get("W"),d=b.get("Index");d||(d=[0,b.get("Size")]),this.streamState={entryRanges:d,byteWidths:c,entryNum:0,streamPos:a.pos}}return this.readXRefStream(a),delete this.streamState,a.dict},readXRefStream:function(a){var b,d,e=this.streamState;a.pos=e.streamPos;for(var f=e.byteWidths,g=f[0],h=f[1],i=f[2],j=e.entryRanges;j.length>0;){var k=j[0],l=j[1];for(w(k)&&w(l)||c("Invalid XRef range fields: "+k+", "+l),w(g)&&w(h)&&w(i)||c("Invalid XRef entry fields length: "+k+", "+l),b=e.entryNum;l>b;++b){e.entryNum=b,e.streamPos=a.pos;var m=0,n=0,o=0;for(d=0;g>d;++d)m=m<<8|a.getByte();for(0===g&&(m=1),d=0;h>d;++d)n=n<<8|a.getByte();for(d=0;i>d;++d)o=o<<8|a.getByte();var p={};switch(p.offset=n,p.gen=o,m){case 0:p.free=!0;break;case 1:p.uncompressed=!0;break;case 2:break;default:c("Invalid XRef entry type: "+m)}this.entries[k+b]||(this.entries[k+b]=p)}e.entryNum=0,e.streamPos=a.pos,j.splice(0,2)}},indexObjects:function(){function a(a,b){for(var c="",f=a[b];f!==d&&f!==e&&f!==h&&!(++b>=a.length);)c+=String.fromCharCode(f),f=a[b];return c}function b(a,b,c){for(var d=c.length,e=a.length,f=0;e>b;){for(var g=0;d>g&&a[b+g]===c[g];)++g;if(g>=d)break;b++,f++}return f}var c=9,d=10,e=13,f=32,g=37,h=60,i=/^(\d+)\s+(\d+)\s+obj\b/,j=new Uint8Array([116,114,97,105,108,101,114]),k=new Uint8Array([115,116,97,114,116,120,114,101,102]),l=new Uint8Array([101,110,100,111,98,106]),m=new Uint8Array([47,88,82,101,102]);this.entries.length=0;var n=this.stream;n.pos=0;for(var o=n.getBytes(),p=n.start,q=o.length,r=[],s=[];q>p;){var t=o[p];if(t!==c&&t!==d&&t!==e&&t!==f)if(t!==g){var u,v=a(o,p);if(0!==v.indexOf("xref")||4!==v.length&&!/\s/.test(v[4]))if(u=i.exec(v)){"undefined"==typeof this.entries[u[1]]&&(this.entries[u[1]]={offset:p-n.start,gen:0|u[2],uncompressed:!0});var w=b(o,p,l)+7,x=o.subarray(p,p+w),y=b(x,0,m);w>y&&x[y+5]<64&&(s.push(p-n.start),this.xrefstms[p-n.start]=1),p+=w}else 0!==v.indexOf("trailer")||7!==v.length&&!/\s/.test(v[7])?p+=v.length+1:(r.push(p),p+=b(o,p,k));else p+=b(o,p,j),r.push(p),p+=b(o,p,k)}else do{if(++p,p>=q)break;t=o[p]}while(t!==d&&t!==e);else++p}var z,C;for(z=0,C=s.length;C>z;++z)this.startXRefQueue.push(s[z]),this.readXRef(!0);var D;for(z=0,C=r.length;C>z;++z){n.pos=r[z];var E=new Fc(new Gc(n),!0,this),F=E.getObj();if(A(F,"trailer")&&B(D=E.getObj())&&D.has("ID"))return D}if(D)return D;throw new fa("Invalid PDF structure")},readXRef:function(b){var d=this.stream;try{for(;this.startXRefQueue.length;){var e=this.startXRefQueue[0];d.pos=e+d.start;var f,g=new Fc(new Gc(d),!0,this),h=g.getObj();if(A(h,"xref")){if(f=this.processXRefTable(g),this.topDict||(this.topDict=f),h=f.get("XRefStm"),w(h)){var i=h;i in this.xrefstms||(this.xrefstms[i]=1,this.startXRefQueue.push(i))}}else w(h)?(w(g.getObj())&&A(g.getObj(),"obj")&&D(h=g.getObj())||c("Invalid XRef stream"),f=this.processXRefStream(h),this.topDict||(this.topDict=f),f||c("Failed to read XRef stream")):c("Invalid XRef stream header");h=f.get("Prev"),w(h)?this.startXRefQueue.push(h):F(h)&&this.startXRefQueue.push(h.num),this.startXRefQueue.shift()}return this.topDict}catch(j){if(j instanceof ja)throw j;a("(while reading XRef): "+j)}if(!b)throw new ka},getEntry:function(a){var b=this.entries[a];return b&&!b.free&&b.offset?b:null},fetchIfRef:function(a){return F(a)?this.fetch(a):a},fetch:function(a,b){e(F(a),"ref object is not a reference");var c=a.num;if(c in this.cache){var d=this.cache[c];return d}var f=this.getEntry(c);return null===f?this.cache[c]=null:(f=f.uncompressed?this.fetchUncompressed(a,f,b):this.fetchCompressed(f,b),B(f)?f.objId=a.toString():D(f)&&(f.dict.objId=a.toString()),f)},fetchUncompressed:function(a,b,d){var e=a.gen,f=a.num;b.gen!==e&&c("inconsistent generation in XRef");var g=this.stream.makeSubStream(b.offset+this.stream.start),h=new Fc(new Gc(g),!0,this),i=h.getObj(),j=h.getObj(),k=h.getObj();if(w(i)&&parseInt(i,10)===f&&w(j)&&parseInt(j,10)===e&&A(k)||c("bad XRef entry"),!A(k,"obj")){if(0===k.cmd.indexOf("obj")&&(f=parseInt(k.cmd.substring(3),10),!isNaN(f)))return f;c("bad XRef entry")}return b=this.encrypt&&!d?h.getObj(this.encrypt.createCipherTransform(f,e)):h.getObj(),D(b)||(this.cache[f]=b),b},fetchCompressed:function(a,b){var d=a.offset,e=this.fetch(new Ba(d,0));D(e)||c("bad ObjStm stream");var f=e.dict.get("First"),g=e.dict.get("N");w(f)&&w(g)||c("invalid first and n parameters for ObjStm stream");var h=new Fc(new Gc(e),!1,this);h.allowStreams=!0;var i,j,k=[],l=[];for(i=0;g>i;++i){j=h.getObj(),w(j)||c("invalid object number in the ObjStm stream: "+j),l.push(j);var m=h.getObj();w(m)||c("invalid object offset in the ObjStm stream: "+m)}for(i=0;g>i;++i){k.push(h.getObj()),j=l[i];var n=this.entries[j];n&&n.offset===d&&n.gen===i&&(this.cache[j]=k[i])}return a=k[a.gen],void 0===a&&c("bad XRef entry for compressed object"),a},fetchIfRefAsync:function(a){return F(a)?this.fetchAsync(a):Promise.resolve(a)},fetchAsync:function(a,b){var c=this.stream.manager,d=this;return new Promise(function e(f,g){try{f(d.fetch(a,b))}catch(h){if(h instanceof ja)return void c.requestRange(h.begin,h.end).then(function(){e(f,g)},g);g(h)}})},getCatalogObj:function(){return this.root}},d}(),Ga=function(){function a(a,b){this.root=a,this.xref=b}return a.prototype={getAll:function(){var a={};if(!this.root)return a;var b=this.xref,d=new Ca;d.put(this.root);for(var e=[this.root];e.length>0;){var f,g,h=b.fetchIfRef(e.shift());if(B(h))if(h.has("Kids")){var i=h.get("Kids");for(f=0,g=i.length;g>f;f++){var j=i[f];d.has(j)&&c("invalid destinations"),e.push(j),d.put(j)}}else{var k=h.get("Names");if(k)for(f=0,g=k.length;g>f;f+=2)a[b.fetchIfRef(k[f])]=b.fetchIfRef(k[f+1])}}return a},get:function(a){if(!this.root)return null;for(var c,d,e,f=this.xref,g=f.fetchIfRef(this.root),h=0,i=10;g.has("Kids");){if(h++,h>i)return b("Search depth limit for named destionations has been reached."),null;var j=g.get("Kids");if(!C(j))return null;for(c=0,d=j.length-1;d>=c;){e=c+d>>1;var k=f.fetchIfRef(j[e]),l=k.get("Limits");if(af.fetchIfRef(l[1]))){g=f.fetchIfRef(j[e]);break}c=e+1}}if(c>d)return null}var m=g.get("Names");if(C(m))for(c=0,d=m.length-2;d>=c;)if(e=c+d&-2,af.fetchIfRef(m[e])))return f.fetchIfRef(m[e+1]);c=e+2}return null}},a}(),Ha=function(){function a(a,c){a&&B(a)&&(this.xref=c,this.root=a,a.has("FS")&&(this.fs=a.get("FS")),this.description=a.has("Desc")?r(a.get("Desc")):"",a.has("RF")&&b("Related file specifications are not supported"),this.contentAvailable=!0,a.has("EF")||(this.contentAvailable=!1,b("Non-embedded file specifications are not supported")))}function c(a){return a.has("UF")?a.get("UF"):a.has("F")?a.get("F"):a.has("Unix")?a.get("Unix"):a.has("Mac")?a.get("Mac"):a.has("DOS")?a.get("DOS"):null}return a.prototype={get filename(){if(!this._filename&&this.root){var a=c(this.root)||"unnamed";this._filename=r(a).replace(/\\\\/g,"\\").replace(/\\\//g,"/").replace(/\\/g,"/")}return this._filename},get content(){if(!this.contentAvailable)return null;!this.contentRef&&this.root&&(this.contentRef=c(this.root.get("EF")));var a=null;if(this.contentRef){var d=this.xref,e=d.fetchIfRef(this.contentRef);e&&D(e)?a=e.getBytes():b("Embedded file specification points to non-existing/invalid content")}else b("Embedded file specification does not have a content");return a},get serializable(){return{filename:this.filename,content:this.content}}},a}(),Ia=function(){function a(a){return F(a)||B(a)||C(a)||D(a)}function b(b,c){var d;if(B(b)||D(b)){var e;e=B(b)?b.map:b.dict.map;for(var f in e)d=e[f],a(d)&&c.push(d)}else if(C(b))for(var g=0,h=b.length;h>g;g++)d=b[g],a(d)&&c.push(d)}function c(a,b,c){this.obj=a,this.keys=b,this.xref=c,this.refSet=null,this.capability=null}return c.prototype={load:function(){var a=this.keys;if(this.capability=G(),!(this.xref.stream instanceof qa)||0===this.xref.stream.getMissingChunks().length)return this.capability.resolve(),this.capability.promise;this.refSet=new Ca;for(var b=[],c=0;c=3&&(this.borderStyle.setHorizontalCornerRadius(d[0]),this.borderStyle.setVerticalCornerRadius(d[1]),this.borderStyle.setWidth(d[2]),4===d.length&&this.borderStyle.setDashArray(d[3]))}else this.borderStyle.setWidth(0)},isInvisible:function(){var a=this.data;return!!(a&&a.annotationFlags&&1&a.annotationFlags)},isViewable:function(){var a=this.data;return!(this.isInvisible()||!a||a.annotationFlags&&34&a.annotationFlags||!a.rect)},isPrintable:function(){var a=this.data;return!(!(!this.isInvisible()&&a&&a.annotationFlags&&4&a.annotationFlags)||2&a.annotationFlags||!a.rect)},loadResources:function(a){return new Promise(function(b,c){this.appearance.dict.getAsync("Resources").then(function(d){if(!d)return void b();var e=new Ia(d.map,a,d.xref);e.load().then(function(){b(d)},c)},c)}.bind(this))},getOperatorList:function(b,c){if(!this.appearance)return Promise.resolve(new xb);var d=this.data,e=this.appearance.dict,f=this.loadResources(["ExtGState","ColorSpace","Pattern","Shading","XObject","Font"]),g=e.get("BBox")||[0,0,1,1],h=e.get("Matrix")||[1,0,0,1,0,0],i=a(d.rect,g,h),j=this;return f.then(function(a){var e=new xb;return e.addOp($.beginAnnotation,[d.rect,i,h]),b.getOperatorList(j.appearance,c,a,e).then(function(){return e.addOp($.endAnnotation,[]),j.appearance.reset(),e})})}},c.appendToOperatorList=function(a,b,c,d,e,f){function g(a){h.reject(a)}for(var h=G(),i=[],j=0,k=a.length;k>j;++j)("display"===f&&a[j].isViewable()||"print"===f&&a[j].isPrintable())&&i.push(a[j].getOperatorList(d,e));return Promise.all(i).then(function(a){b.addOp($.beginAnnotations,[]);for(var c=0,d=a.length;d>c;++c){var e=a[c];b.addOpList(e)}b.addOp($.endAnnotations,[]),h.resolve()},g),h.promise},c}(),Oa=function(){function a(){this.width=1,this.style=X.SOLID,this.dashArray=[3],this.horizontalCornerRadius=0,this.verticalCornerRadius=0}return a.prototype={setWidth:function(a){a===(0|a)&&(this.width=a)},setStyle:function(a){if(a)switch(a.name){case"S":this.style=X.SOLID;break;case"D":this.style=X.DASHED;break;case"B":this.style=X.BEVELED;break;case"I":this.style=X.INSET;break;case"U":this.style=X.UNDERLINE}},setDashArray:function(a){if(C(a)&&a.length>0){for(var b=!0,c=!0,d=0,e=a.length;e>d;d++){var f=a[d],g=+f>=0;if(!g){b=!1;break}f>0&&(c=!1)}b&&!c?this.dashArray=a:this.width=0}else a&&(this.width=0)},setHorizontalCornerRadius:function(a){a===(0|a)&&(this.horizontalCornerRadius=a)},setVerticalCornerRadius:function(a){a===(0|a)&&(this.verticalCornerRadius=a)}},a}(),Pa=function(){function a(a){Na.call(this,a);var b=a.dict,c=this.data;c.fieldValue=r(na.getInheritableProperty(b,"V")||""),c.alternativeText=r(b.get("TU")||""),c.defaultAppearance=na.getInheritableProperty(b,"DA")||"";var d=na.getInheritableProperty(b,"FT");c.fieldType=z(d)?d.name:"",c.fieldFlags=na.getInheritableProperty(b,"Ff")||0,this.fieldResources=na.getInheritableProperty(b,"DR")||Aa.empty;for(var e=[],f=b,g=a.ref;f;){var h=f.get("Parent"),i=f.getRaw("Parent"),j=f.get("T");if(j)e.unshift(r(j));else if(h&&g){var k,l,m=h.get("Kids");for(k=0,l=m.length;l>k;k++){var n=m[k];if(n.num===g.num&&n.gen===g.gen)break}e.unshift("`"+k)}f=h,g=i}c.fullName=e.join(".")}var c=Na.prototype;return na.inherit(a,Na,{isViewable:function(){return"Sig"===this.data.fieldType?(b("unimplemented annotation type: Widget signature"),!1):c.isViewable.call(this)}}),a}(),Qa=function(){function a(a){Pa.call(this,a),this.data.textAlignment=na.getInheritableProperty(a.dict,"Q"),this.data.annotationType=W.WIDGET,this.data.hasHtml=!this.data.hasAppearance&&!!this.data.fieldValue}return na.inherit(a,Pa,{getOperatorList:function(a,b){if(this.appearance)return Na.prototype.getOperatorList.call(this,a,b);var c=new xb,d=this.data;if(!d.defaultAppearance)return Promise.resolve(c);var e=new Mc(j(d.defaultAppearance));return a.getOperatorList(e,b,this.fieldResources,c).then(function(){return c})}}),a}(),Ra=function(){function a(a){Na.call(this,a);var b=a.dict,c=this.data,d=b.get("Contents"),e=b.get("T");c.annotationType=W.TEXT,c.content=r(d||""),c.title=r(e||""),c.hasHtml=!0,c.hasAppearance?c.name="NoIcon":(c.rect[1]=c.rect[3]-Ma,c.rect[2]=c.rect[0]+Ma,c.name=b.has("Name")?b.get("Name").name:"Note"),b.has("C")&&(c.hasBgColor=!0)}return na.inherit(a,Na,{}),a}(),Sa=function(){function a(a){Na.call(this,a);var d=a.dict,e=this.data;e.annotationType=W.LINK,e.hasHtml=!0;var g=d.get("A");if(g&&B(g)){var h=g.get("S").name;if("URI"===h){var i=g.get("URI");z(i)?i="/"+i.name:i&&(i=c(i)),f(i,!1)||(i="");try{e.url=s(i)}catch(j){e.url=i}}else if("GoTo"===h)e.dest=g.get("D");else if("GoToR"===h){var k=g.get("F");B(k)&&(i=k.get("F")||""),f(i,!1)||(i=""),e.url=i,e.dest=g.get("D")}else"Named"===h?e.action=g.get("N").name:b("unrecognized link type: "+h)}else if(d.has("Dest")){var l=d.get("Dest");e.dest=z(l)?l.name:l}}function c(a){return a&&0===a.indexOf("www.")?"http://"+a:a}return na.inherit(a,Na,{}),a}(),Ta=function(){var b=0,d=2,e=3,f=4;return{getSampleArray:function(a,b,c,d){var e,f,g=1;for(e=0,f=a.length;f>e;e++)g*=a[e];g*=b;var h=new Array(g),i=0,j=0,k=1/(Math.pow(2,c)-1),l=d.getBytes((g*c+7)/8),m=0;for(e=0;g>e;e++){for(;c>i;)j<<=8,j|=l[m++],i+=8;i-=c,h[e]=(j>>i)*k,j&=(1<d;d++){var f=a.fetchIfRef(b[d]);c.push(Ta.parse(a,f))}return function(a,b,d,e){for(var f=0,g=c.length;g>f;f++)c[f](a,b,d,e+f)}},constructSampled:function(d,e){function f(a){for(var b=a.length,c=[],d=0,e=0;b>e;e+=2)c[d]=[a[e],a[e+1]],++d;return c}var g=e.get("Domain"),h=e.get("Range");g&&h||c("No domain or range");var i=g.length/2,j=h.length/2;g=f(g),h=f(h);var k=e.get("Size"),l=e.get("BitsPerSample"),m=e.get("Order")||1;1!==m&&a("No support for cubic spline interpolation: "+m);var n=e.get("Encode");if(!n){n=[];for(var o=0;i>o;++o)n.push(0),n.push(k[o]-1)}n=f(n);var p=e.get("Decode");p=p?f(p):h;var q=this.getSampleArray(k,j,l,d);return[b,i,g,n,p,q,k,j,Math.pow(2,l)-1,h]},constructSampledFromIR:function(a){function b(a,b,c,d,e){return d+(a-b)*((e-d)/(c-b))}return function(c,d,e,f){var g,h,i=a[1],j=a[2],k=a[3],l=a[4],m=a[5],n=a[6],o=a[7],p=a[9],q=1<h;h++)r[h]=1;var t=o,u=1;for(g=0;i>g;++g){var v=j[g][0],w=j[g][1],x=Math.min(Math.max(c[d+g],v),w),y=b(x,v,w,k[g][0],k[g][1]),z=n[g];y=Math.min(Math.max(y,0),z-1);var A=z-1>y?Math.floor(y):y-1,B=A+1-y,C=y-A,D=A*t,E=D+t;for(h=0;q>h;h++)h&u?(r[h]*=C,s[h]+=E):(r[h]*=B,s[h]+=D);t*=z,u<<=1}for(h=0;o>h;++h){var F=0;for(g=0;q>g;g++)F+=m[s[g]+h]*r[g];F=b(F,0,1,l[h][0],l[h][1]),e[f+h]=Math.min(Math.max(F,p[h][0]),p[h][1])}}},constructInterpolated:function(a,b){var e=b.get("C0")||[0],f=b.get("C1")||[1],g=b.get("N");C(e)&&C(f)||c("Illegal dictionary for interpolated function");for(var h=e.length,i=[],j=0;h>j;++j)i.push(f[j]-e[j]);return[d,e,i,g]},constructInterpolatedFromIR:function(a){var b=a[1],c=a[2],d=a[3],e=c.length;return function(a,f,g,h){for(var i=1===d?a[f]:Math.pow(a[f],d),j=0;e>j;++j)g[h+j]=b[j]+i*c[j]}},constructStiched:function(a,b,d){var f=b.get("Domain");f||c("No domain");var g=f.length/2;1!==g&&c("Bad domain for stiched function");for(var h=b.get("Functions"),i=[],j=0,k=h.length;k>j;++j)i.push(Ta.getIR(d,d.fetchIfRef(h[j])));var l=b.get("Bounds"),m=b.get("Encode");return[e,f,l,m,i]},constructStichedFromIR:function(a){for(var b=a[1],c=a[2],d=a[3],e=a[4],f=[],g=new Float32Array(1),h=0,i=e.length;i>h;h++)f.push(Ta.fromIR(e[h]));return function(a,e,h,i){for(var j=function(a,b,c){return a>c?a=c:b>a&&(a=b),a},k=j(a[e],b[0],b[1]),l=0,m=c.length;m>l&&!(k0&&(n=c[l-1]);var o=b[1];l>1,h=c.length>>1,i=new Va(e),j={},k=8192,l=k,m=new Float32Array(h);return function(a,b,c,e){var f,k,n="",o=m;for(f=0;h>f;f++)k=a[b+f],o[f]=k,n+=k+"_";var p=j[n];if(void 0!==p)return void c.set(p,e);var q=new Float32Array(g),r=i.execute(o),s=r.length-g;for(f=0;g>f;f++){k=r[s+f];var t=d[2*f];t>k?k=t:(t=d[2*f+1],k>t&&(k=t)),q[f]=k}l>0&&(l--,j[n]=q),c.set(q,e)}}}}(),Ua=function(){function a(a){this.stack=a?Array.prototype.slice.call(a,0):[]}var b=100;return a.prototype={push:function(a){this.stack.length>=b&&c("PostScript function stack overflow."),this.stack.push(a)},pop:function(){return this.stack.length<=0&&c("PostScript function stack underflow."),this.stack.pop()},copy:function(a){this.stack.length+a>=b&&c("PostScript function stack overflow.");for(var d=this.stack,e=d.length-a,f=a-1;f>=0;f--,e++)d.push(d[e])},index:function(a){this.push(this.stack[this.stack.length-a-1])},roll:function(a,b){var c,d,e,f=this.stack,g=f.length-a,h=f.length-1,i=g+(b-Math.floor(b/a)*a);for(c=g,d=h;d>c;c++,d--)e=f[c],f[c]=f[d],f[d]=e;for(c=g,d=i-1;d>c;c++,d--)e=f[c],f[c]=f[d],f[d]=e;for(c=i,d=h;d>c;c++,d--)e=f[c],f[c]=f[d],f[d]=e}},a}(),Va=function(){function a(a){this.operators=a}return a.prototype={execute:function(a){for(var b,d,e,f=new Ua(a),g=0,h=this.operators,i=h.length;i>g;)if(b=h[g++],"number"!=typeof b)switch(b){case"jz":e=f.pop(),d=f.pop(),d||(g=e);break;case"j":d=f.pop(),g=d;break;case"abs":d=f.pop(),f.push(Math.abs(d));break;case"add":e=f.pop(),d=f.pop(),f.push(d+e);break;case"and":e=f.pop(),d=f.pop(),v(d)&&v(e)?f.push(d&&e):f.push(d&e);break;case"atan":d=f.pop(),f.push(Math.atan(d));break;case"bitshift":e=f.pop(),d=f.pop(),d>0?f.push(d<>e);break;case"ceiling":d=f.pop(),f.push(Math.ceil(d));break;case"copy":d=f.pop(),f.copy(d);break;case"cos":d=f.pop(),f.push(Math.cos(d));break;case"cvi":d=0|f.pop(),f.push(d);break;case"cvr":break;case"div":e=f.pop(),d=f.pop(),f.push(d/e);break;case"dup":f.copy(1);break;case"eq":e=f.pop(),d=f.pop(),f.push(d===e);break;case"exch":f.roll(2,1);break;case"exp":e=f.pop(),d=f.pop(),f.push(Math.pow(d,e));break;case"false":f.push(!1);break;case"floor":d=f.pop(),f.push(Math.floor(d));break;case"ge":e=f.pop(),d=f.pop(),f.push(d>=e);break;case"gt":e=f.pop(),d=f.pop(),f.push(d>e);break;case"idiv":e=f.pop(),d=f.pop(),f.push(d/e|0);break;case"index":d=f.pop(),f.index(d);break;case"le":e=f.pop(),d=f.pop(),f.push(e>=d);break;case"ln":d=f.pop(),f.push(Math.log(d));break;case"log":d=f.pop(),f.push(Math.log(d)/Math.LN10);break;case"lt":e=f.pop(),d=f.pop(),f.push(e>d);break;case"mod":e=f.pop(),d=f.pop(),f.push(d%e);break;case"mul":e=f.pop(),d=f.pop(),f.push(d*e);break;case"ne":e=f.pop(),d=f.pop(),f.push(d!==e);break;case"neg":d=f.pop(),f.push(-d);break;case"not":d=f.pop(),v(d)?f.push(!d):f.push(~d);break;case"or":e=f.pop(),d=f.pop(),v(d)&&v(e)?f.push(d||e):f.push(d|e);break;case"pop":f.pop();break;case"roll":e=f.pop(),d=f.pop(),f.roll(d,e);break;case"round":d=f.pop(),f.push(Math.round(d));break;case"sin":d=f.pop(),f.push(Math.sin(d));break;case"sqrt":d=f.pop(),f.push(Math.sqrt(d));break;case"sub":e=f.pop(),d=f.pop(),f.push(d-e);break;case"true":f.push(!0);break;case"truncate":d=f.pop(),d=0>d?Math.ceil(d):Math.floor(d),f.push(d);break;case"xor":e=f.pop(),d=f.pop(),v(d)&&v(e)?f.push(d!==e):f.push(d^e);break;default:c("Unknown operator "+b)}else f.push(b);return f.stack}},a}(),Wa=function(){function a(a){this.type=a}function b(b,c,d){a.call(this,"args"),this.index=b,this.min=c,this.max=d}function c(b){a.call(this,"literal"),this.number=b,this.min=b,this.max=b}function d(b,c,d,e,f){a.call(this,"binary"),this.op=b,this.arg1=c,this.arg2=d,this.min=e,this.max=f}function e(b,c){a.call(this,"max"),this.arg=b,this.min=b.min,this.max=c}function f(b,c,d){a.call(this,"var"),this.index=b,this.min=c,this.max=d}function g(b,c){a.call(this,"definition"),this.variable=b,this.arg=c}function h(){this.parts=[]}function i(a,b){return"literal"===b.type&&0===b.number?a:"literal"===a.type&&0===a.number?b:"literal"===b.type&&"literal"===a.type?new c(a.number+b.number):new d("+",a,b,a.min+b.min,a.max+b.max)}function j(a,b){if("literal"===b.type){if(0===b.number)return new c(0);if(1===b.number)return a;if("literal"===a.type)return new c(a.number*b.number)}if("literal"===a.type){if(0===a.number)return new c(0);if(1===a.number)return b}var e=Math.min(a.min*b.min,a.min*b.max,a.max*b.min,a.max*b.max),f=Math.max(a.min*b.min,a.min*b.max,a.max*b.min,a.max*b.max);return new d("*",a,b,e,f)}function k(a,b){if("literal"===b.type){if(0===b.number)return a;if("literal"===a.type)return new c(a.number-b.number)}return"binary"===b.type&&"-"===b.op&&"literal"===a.type&&1===a.number&&"literal"===b.arg1.type&&1===b.arg1.number?b.arg2:new d("-",a,b,a.min-b.max,a.max-b.min)}function l(a,b){return a.min>=b?new c(b):a.max<=b?a:new e(a,b)}function m(){}return a.prototype.visit=function(a){throw new Error("abstract method")},b.prototype=Object.create(a.prototype),b.prototype.visit=function(a){a.visitArgument(this)},c.prototype=Object.create(a.prototype),c.prototype.visit=function(a){a.visitLiteral(this)},d.prototype=Object.create(a.prototype),d.prototype.visit=function(a){a.visitBinaryOperation(this); +},e.prototype=Object.create(a.prototype),e.prototype.visit=function(a){a.visitMin(this)},f.prototype=Object.create(a.prototype),f.prototype.visit=function(a){a.visitVariable(this)},g.prototype=Object.create(a.prototype),g.prototype.visit=function(a){a.visitVariableDefinition(this)},h.prototype={visitArgument:function(a){this.parts.push("Math.max(",a.min,", Math.min(",a.max,", src[srcOffset + ",a.index,"]))")},visitVariable:function(a){this.parts.push("v",a.index)},visitLiteral:function(a){this.parts.push(a.number)},visitBinaryOperation:function(a){this.parts.push("("),a.arg1.visit(this),this.parts.push(" ",a.op," "),a.arg2.visit(this),this.parts.push(")")},visitVariableDefinition:function(a){this.parts.push("var "),a.variable.visit(this),this.parts.push(" = "),a.arg.visit(this),this.parts.push(";")},visitMin:function(a){this.parts.push("Math.min("),a.arg.visit(this),this.parts.push(", ",a.max,")")},toString:function(){return this.parts.join("")}},m.prototype={compile:function(a,d,e){var m,n,o,p,q,r,s,t,u,v,w=[],x=[],y=d.length>>1,z=e.length>>1,A=0;for(m=0;y>m;m++)w.push(new b(m,d[2*m],d[2*m+1]));for(m=0,n=a.length;n>m;m++)if(v=a[m],"number"!=typeof v)switch(v){case"add":if(w.length<2)return null;r=w.pop(),q=w.pop(),w.push(i(q,r));break;case"cvr":if(w.length<1)return null;break;case"mul":if(w.length<2)return null;r=w.pop(),q=w.pop(),w.push(j(q,r));break;case"sub":if(w.length<2)return null;r=w.pop(),q=w.pop(),w.push(k(q,r));break;case"exch":if(w.length<2)return null;s=w.pop(),t=w.pop(),w.push(s,t);break;case"pop":if(w.length<1)return null;w.pop();break;case"index":if(w.length<1)return null;if(q=w.pop(),"literal"!==q.type)return null;if(o=q.number,0>o||(0|o)!==o||w.length=o||(0|o)!==o||(0|p)!==p||w.lengtha.min&&(g.unshift("Math.max(",d,", "),g.push(")")),fn&&"DeviceGray"!==this.name&&"DeviceRGB"!==this.name){var p,q=8>=g?new Uint8Array(n):new Uint16Array(n);for(j=0;n>j;j++)q[j]=j;var r=new Uint8Array(3*n);this.getRgbBuffer(q,0,n,r,0,g,0);var s,t;if(o)for(m=new Uint8Array(3*l),t=0,j=0;l>j;++j)p=3*h[j],m[t++]=r[p],m[t++]=r[p+1],m[t++]=r[p+2];else for(s=0,j=0;l>j;++j)p=3*h[j],a[s++]=r[p],a[s++]=r[p+1],a[s++]=r[p+2],s+=i}else o?(m=new Uint8Array(3*l),this.getRgbBuffer(h,0,l,m,0,g,0)):this.getRgbBuffer(h,0,d*f,a,0,g,i);if(m)if(o)Bc.resize(m,g,3,b,c,d,e,a,i);else for(t=0,s=0,j=0,k=d*f;k>j;j++)a[s++]=m[t++],a[s++]=m[t++],a[s++]=m[t++],s+=i},usesZeroToOneRange:!0},a.parse=function(b,c,d){var e=a.parseToIR(b,c,d);return e instanceof Ya?e:a.fromIR(e)},a.fromIR=function(b){var d,e,f,g=C(b)?b[0]:b;switch(g){case"DeviceGrayCS":return this.singletons.gray;case"DeviceRgbCS":return this.singletons.rgb;case"DeviceCmykCS":return this.singletons.cmyk;case"CalGrayCS":return d=b[1].WhitePoint,e=b[1].BlackPoint,f=b[1].Gamma,new cb(d,e,f);case"CalRGBCS":d=b[1].WhitePoint,e=b[1].BlackPoint,f=b[1].Gamma;var h=b[1].Matrix;return new db(d,e,f,h);case"PatternCS":var i=b[1];return i&&(i=a.fromIR(i)),new Za(i);case"IndexedCS":var j=b[1],k=b[2],l=b[3];return new $a(a.fromIR(j),k,l);case"AlternateCS":var m=b[1],n=b[2],o=b[3];return new Ya(m,a.fromIR(n),Ta.fromIR(o));case"LabCS":d=b[1].WhitePoint,e=b[1].BlackPoint;var p=b[1].Range;return new eb(d,e,p);default:c("Unknown name "+g)}return null},a.parseToIR=function(d,e,f){if(z(d)){var g=f.get("ColorSpace");if(B(g)){var h=g.get(d.name);h&&(d=h)}}d=e.fetchIfRef(d);var i;if(z(d))switch(i=d.name,this.mode=i,i){case"DeviceGray":case"G":return"DeviceGrayCS";case"DeviceRGB":case"RGB":return"DeviceRgbCS";case"DeviceCMYK":case"CMYK":return"DeviceCmykCS";case"Pattern":return["PatternCS",null];default:c("unrecognized colorspace "+i)}else if(C(d)){i=e.fetchIfRef(d[0]).name,this.mode=i;var j,k,l;switch(i){case"DeviceGray":case"G":return"DeviceGrayCS";case"DeviceRGB":case"RGB":return"DeviceRgbCS";case"DeviceCMYK":case"CMYK":return"DeviceCmykCS";case"CalGray":return k=e.fetchIfRef(d[1]).getAll(),["CalGrayCS",k];case"CalRGB":return k=e.fetchIfRef(d[1]).getAll(),["CalRGBCS",k];case"ICCBased":var m=e.fetchIfRef(d[1]),n=m.dict;if(j=n.get("N"),l=n.get("Alternate")){var o=a.parseToIR(l,e,f),p=a.fromIR(o);if(p.numComps===j)return o;b("ICCBased color space: Ignoring incorrect /Alternate entry.")}if(1===j)return"DeviceGrayCS";if(3===j)return"DeviceRgbCS";if(4===j)return"DeviceCmykCS";break;case"Pattern":var q=d[1]||null;return q&&(q=a.parseToIR(q,e,f)),["PatternCS",q];case"Indexed":case"I":var r=a.parseToIR(d[1],e,f),s=e.fetchIfRef(d[2])+1,t=e.fetchIfRef(d[3]);return D(t)&&(t=t.getBytes()),["IndexedCS",r,s,t];case"Separation":case"DeviceN":var u=e.fetchIfRef(d[1]);j=1,z(u)?j=1:C(u)&&(j=u.length),l=a.parseToIR(d[2],e,f);var v=Ta.getIR(e,e.fetchIfRef(d[3]));return["AlternateCS",j,l,v];case"Lab":return k=e.fetchIfRef(d[1]).getAll(),["LabCS",k];default:c('unimplemented color space object "'+i+'"')}}else c('unrecognized color space object: "'+d+'"');return null},a.isDefaultDecode=function(a,c){if(!C(a))return!0;if(2*c!==a.length)return b("The decode map is not the correct length"),!0;for(var d=0,e=a.length;e>d;d+=2)if(0!==a[d]||1!==a[d+1])return!1;return!0},a.singletons={get gray(){return g(this,"gray",new _a)},get rgb(){return g(this,"rgb",new ab)},get cmyk(){return g(this,"cmyk",new bb)}},a}(),Ya=function(){function a(a,b,c){this.name="Alternate",this.numComps=a,this.defaultColor=new Float32Array(a);for(var d=0;a>d;++d)this.defaultColor[d]=1;this.base=b,this.tintFn=c,this.tmpBuf=new Float32Array(b.numComps)}return a.prototype={getRgb:Xa.prototype.getRgb,getRgbItem:function(a,b,c,d){var e=this.tmpBuf;this.tintFn(a,b,e,0),this.base.getRgbItem(e,0,c,d)},getRgbBuffer:function(a,b,c,d,e,f,g){var h,i,j=this.tintFn,k=this.base,l=1/((1<h;h++){for(i=0;r>i;i++)s[i]=a[b++]*l;for(j(s,0,t,0),i=0;m>i;i++)q[p++]=255*t[i]}else for(h=0;c>h;h++){for(i=0;r>i;i++)s[i]=a[b++]*l;j(s,0,t,0),k.getRgbItem(t,0,q,p),p+=m}o||k.getRgbBuffer(q,0,c,d,e,8,g)},getOutputLength:function(a,b){return this.base.getOutputLength(a*this.base.numComps/this.numComps,b)},isPassthrough:Xa.prototype.isPassthrough,fillRgb:Xa.prototype.fillRgb,isDefaultDecode:function(a){return Xa.isDefaultDecode(a,this.numComps)},usesZeroToOneRange:!0},a}(),Za=function(){function a(a){this.name="Pattern",this.base=a}return a.prototype={},a}(),$a=function(){function a(a,b,d){this.name="Indexed",this.numComps=1,this.defaultColor=new Uint8Array([0]),this.base=a,this.highVal=b;var e,f=a.numComps,g=f*b;if(D(d)){e=new Uint8Array(g);var h=d.getBytes(g);e.set(h)}else if(y(d)){e=new Uint8Array(g);for(var i=0;g>i;++i)e[i]=d.charCodeAt(i)}else d instanceof Uint8Array||d instanceof Array?e=d:c("Unrecognized lookup table: "+d);this.lookup=e}return a.prototype={getRgb:Xa.prototype.getRgb,getRgbItem:function(a,b,c,d){var e=this.base.numComps,f=a[b]*e;this.base.getRgbItem(this.lookup,f,c,d)},getRgbBuffer:function(a,b,c,d,e,f,g){for(var h=this.base,i=h.numComps,j=h.getOutputLength(i,g),k=this.lookup,l=0;c>l;++l){var m=a[b++]*i;h.getRgbBuffer(k,m,1,d,e,8,g),e+=j}},getOutputLength:function(a,b){return this.base.getOutputLength(a*this.base.numComps,b)},isPassthrough:Xa.prototype.isPassthrough,fillRgb:Xa.prototype.fillRgb,isDefaultDecode:function(a){return!0},usesZeroToOneRange:!0},a}(),_a=function(){function a(){this.name="DeviceGray",this.numComps=1,this.defaultColor=new Float32Array([0])}return a.prototype={getRgb:Xa.prototype.getRgb,getRgbItem:function(a,b,c,d){var e=255*a[b]|0;e=0>e?0:e>255?255:e,c[d]=c[d+1]=c[d+2]=e},getRgbBuffer:function(a,b,c,d,e,f,g){for(var h=255/((1<k;++k){var l=h*a[i++]|0;d[j++]=l,d[j++]=l,d[j++]=l,j+=g}},getOutputLength:function(a,b){return a*(3+b)},isPassthrough:Xa.prototype.isPassthrough,fillRgb:Xa.prototype.fillRgb,isDefaultDecode:function(a){return Xa.isDefaultDecode(a,this.numComps)},usesZeroToOneRange:!0},a}(),ab=function(){function a(){this.name="DeviceRGB",this.numComps=3,this.defaultColor=new Float32Array([0,0,0])}return a.prototype={getRgb:Xa.prototype.getRgb,getRgbItem:function(a,b,c,d){var e=255*a[b]|0,f=255*a[b+1]|0,g=255*a[b+2]|0;c[d]=0>e?0:e>255?255:e,c[d+1]=0>f?0:f>255?255:f,c[d+2]=0>g?0:g>255?255:g},getRgbBuffer:function(a,b,c,d,e,f,g){if(8===f&&0===g)return void d.set(a.subarray(b,b+3*c),e);for(var h=255/((1<k;++k)d[j++]=h*a[i++]|0,d[j++]=h*a[i++]|0,d[j++]=h*a[i++]|0,j+=g},getOutputLength:function(a,b){return a*(3+b)/3|0},isPassthrough:function(a){return 8===a},fillRgb:Xa.prototype.fillRgb,isDefaultDecode:function(a){return Xa.isDefaultDecode(a,this.numComps)},usesZeroToOneRange:!0},a}(),bb=function(){function a(a,b,c,d,e){var f=a[b+0]*c,g=a[b+1]*c,h=a[b+2]*c,i=a[b+3]*c,j=f*(-4.387332384609988*f+54.48615194189176*g+18.82290502165302*h+212.25662451639585*i+-285.2331026137004)+g*(1.7149763477362134*g-5.6096736904047315*h+-17.873870861415444*i-5.497006427196366)+h*(-2.5217340131683033*h-21.248923337353073*i+17.5119270841813)+i*(-21.86122147463605*i-189.48180835922747)+255|0,k=f*(8.841041422036149*f+60.118027045597366*g+6.871425592049007*h+31.159100130055922*i+-79.2970844816548)+g*(-15.310361306967817*g+17.575251261109482*h+131.35250912493976*i-190.9453302588951)+h*(4.444339102852739*h+9.8632861493405*i-24.86741582555878)+i*(-20.737325471181034*i-187.80453709719578)+255|0,l=f*(.8842522430003296*f+8.078677503112928*g+30.89978309703729*h-.23883238689178934*i+-14.183576799673286)+g*(10.49593273432072*g+63.02378494754052*h+50.606957656360734*i-112.23884253719248)+h*(.03296041114873217*h+115.60384449646641*i+-193.58209356861505)+i*(-22.33816807309886*i-180.12613974708367)+255|0;d[e]=j>255?255:0>j?0:j,d[e+1]=k>255?255:0>k?0:k,d[e+2]=l>255?255:0>l?0:l}function b(){this.name="DeviceCMYK",this.numComps=4,this.defaultColor=new Float32Array([0,0,0,1])}return b.prototype={getRgb:Xa.prototype.getRgb,getRgbItem:function(b,c,d,e){a(b,c,1,d,e)},getRgbBuffer:function(b,c,d,e,f,g,h){for(var i=1/((1<j;j++)a(b,c,i,e,f),c+=4,f+=3+h},getOutputLength:function(a,b){return a/4*(3+b)|0},isPassthrough:Xa.prototype.isPassthrough,fillRgb:Xa.prototype.fillRgb,isDefaultDecode:function(a){return Xa.isDefaultDecode(a,this.numComps)},usesZeroToOneRange:!0},b}(),cb=function(){function d(d,e,f){this.name="CalGray",this.numComps=1,this.defaultColor=new Float32Array([0]),d||c("WhitePoint missing - required for color space CalGray"),e=e||[0,0,0],f=f||1,this.XW=d[0],this.YW=d[1],this.ZW=d[2],this.XB=e[0],this.YB=e[1],this.ZB=e[2],this.G=f,(this.XW<0||this.ZW<0||1!==this.YW)&&c("Invalid WhitePoint components for "+this.name+", no fallback available"),(this.XB<0||this.YB<0||this.ZB<0)&&(a("Invalid BlackPoint for "+this.name+", falling back to default"),this.XB=this.YB=this.ZB=0),(0!==this.XB||0!==this.YB||0!==this.ZB)&&b(this.name+", BlackPoint: XB: "+this.XB+", YB: "+this.YB+", ZB: "+this.ZB+", only default values are supported."),this.G<1&&(a("Invalid Gamma: "+this.G+" for "+this.name+", falling back to default"),this.G=1)}function e(a,b,c,d,e,f){var g=b[c]*f,h=Math.pow(g,a.G),i=a.YW*h,j=0|Math.max(295.8*Math.pow(i,.3333333333333333)-40.8,0);d[e]=j,d[e+1]=j,d[e+2]=j}return d.prototype={getRgb:Xa.prototype.getRgb,getRgbItem:function(a,b,c,d){e(this,a,b,c,d,1)},getRgbBuffer:function(a,b,c,d,f,g,h){for(var i=1/((1<j;++j)e(this,a,b,d,f,i),b+=1,f+=3+h},getOutputLength:function(a,b){return a*(3+b)},isPassthrough:Xa.prototype.isPassthrough,fillRgb:Xa.prototype.fillRgb,isDefaultDecode:function(a){return Xa.isDefaultDecode(a,this.numComps)},usesZeroToOneRange:!0},d}(),db=function(){function b(b,d,e,f){this.name="CalRGB",this.numComps=3,this.defaultColor=new Float32Array(3),b||c("WhitePoint missing - required for color space CalRGB"),d=d||new Float32Array(3),e=e||new Float32Array([1,1,1]),f=f||new Float32Array([1,0,0,0,1,0,0,0,1]);var g=b[0],h=b[1],i=b[2];this.whitePoint=b;var j=d[0],k=d[1],l=d[2];this.blackPoint=d,this.GR=e[0],this.GG=e[1],this.GB=e[2],this.MXA=f[0],this.MYA=f[1],this.MZA=f[2],this.MXB=f[3],this.MYB=f[4],this.MZB=f[5],this.MXC=f[6],this.MYC=f[7],this.MZC=f[8],(0>g||0>i||1!==h)&&c("Invalid WhitePoint components for "+this.name+", no fallback available"),(0>j||0>k||0>l)&&(a("Invalid BlackPoint for "+this.name+" ["+j+", "+k+", "+l+"], falling back to default"),this.blackPoint=new Float32Array(3)),(this.GR<0||this.GG<0||this.GB<0)&&(a("Invalid Gamma ["+this.GR+", "+this.GG+", "+this.GB+"] for "+this.name+", falling back to default"),this.GR=this.GG=this.GB=1),(this.MXA<0||this.MYA<0||this.MZA<0||this.MXB<0||this.MYB<0||this.MZB<0||this.MXC<0||this.MYC<0||this.MZC<0)&&(a("Invalid Matrix for "+this.name+" ["+this.MXA+", "+this.MYA+", "+this.MZA+this.MXB+", "+this.MYB+", "+this.MZB+this.MXC+", "+this.MYC+", "+this.MZC+"], falling back to default"),this.MXA=this.MYB=this.MZC=1,this.MXB=this.MYA=this.MZA=this.MXC=this.MYC=this.MZB=0)}function d(a,b,c){c[0]=a[0]*b[0]+a[1]*b[1]+a[2]*b[2],c[1]=a[3]*b[0]+a[4]*b[1]+a[5]*b[2],c[2]=a[6]*b[0]+a[7]*b[1]+a[8]*b[2]}function e(a,b,c){c[0]=1*b[0]/a[0],c[1]=1*b[1]/a[1],c[2]=1*b[2]/a[2]}function f(a,b,c){var d=.95047,e=1,f=1.08883;c[0]=b[0]*d/a[0],c[1]=b[1]*e/a[1],c[2]=b[2]*f/a[2]}function g(a){return.0031308>=a?h(0,1,12.92*a):h(0,1,1.055*Math.pow(a,1/2.4)-.055)}function h(a,b,c){return Math.max(a,Math.min(b,c))}function i(a){return 0>a?-i(-a):a>8?Math.pow((a+16)/116,3):a*u}function j(a,b,c){if(0===a[0]&&0===a[1]&&0===a[2])return c[0]=b[0],c[1]=b[1],void(c[2]=b[2]);var d=i(0),e=d,f=i(a[0]),g=d,h=i(a[1]),j=d,k=i(a[2]),l=(1-e)/(1-f),m=1-l,n=(1-g)/(1-h),o=1-n,p=(1-j)/(1-k),q=1-p;c[0]=b[0]*l+m,c[1]=b[1]*n+o,c[2]=b[2]*p+q}function k(a,b,c){if(1===a[0]&&1===a[2])return c[0]=b[0],c[1]=b[1],void(c[2]=b[2]);var f=c;d(n,b,f);var g=r;e(a,f,g),d(o,g,c)}function l(a,b,c){var e=c;d(n,b,e);var g=r;f(a,e,g),d(o,g,c)}function m(a,b,c,e,f,i){var m=h(0,1,b[c]*i),n=h(0,1,b[c+1]*i),o=h(0,1,b[c+2]*i),r=Math.pow(m,a.GR),u=Math.pow(n,a.GG),v=Math.pow(o,a.GB),w=a.MXA*r+a.MXB*u+a.MXC*v,x=a.MYA*r+a.MYB*u+a.MYC*v,y=a.MZA*r+a.MZB*u+a.MZC*v,z=s;z[0]=w,z[1]=x,z[2]=y;var A=t;k(a.whitePoint,z,A);var B=s;j(a.blackPoint,A,B);var C=t;l(q,B,C);var D=s;d(p,C,D);var E=g(D[0]),F=g(D[1]),G=g(D[2]);e[f]=Math.round(255*E),e[f+1]=Math.round(255*F),e[f+2]=Math.round(255*G)}var n=new Float32Array([.8951,.2664,-.1614,-.7502,1.7135,.0367,.0389,-.0685,1.0296]),o=new Float32Array([.9869929,-.1470543,.1599627,.4323053,.5183603,.0492912,-.0085287,.0400428,.9684867]),p=new Float32Array([3.2404542,-1.5371385,-.4985314,-.969266,1.8760108,.041556,.0556434,-.2040259,1.0572252]),q=new Float32Array([1,1,1]),r=new Float32Array(3),s=new Float32Array(3),t=new Float32Array(3),u=Math.pow(24/116,3)/8;return b.prototype={getRgb:function(a,b){var c=new Uint8Array(3);return this.getRgbItem(a,b,c,0),c},getRgbItem:function(a,b,c,d){m(this,a,b,c,d,1)},getRgbBuffer:function(a,b,c,d,e,f,g){for(var h=1/((1<i;++i)m(this,a,b,d,e,h),b+=3,e+=3+g},getOutputLength:function(a,b){return a*(3+b)/3|0},isPassthrough:Xa.prototype.isPassthrough,fillRgb:Xa.prototype.fillRgb,isDefaultDecode:function(a){return Xa.isDefaultDecode(a,this.numComps)},usesZeroToOneRange:!0},b}(),eb=function(){function b(b,d,e){this.name="Lab",this.numComps=3,this.defaultColor=new Float32Array([0,0,0]),b||c("WhitePoint missing - required for color space Lab"),d=d||[0,0,0],e=e||[-100,100,-100,100],this.XW=b[0],this.YW=b[1],this.ZW=b[2],this.amin=e[0],this.amax=e[1],this.bmin=e[2],this.bmax=e[3],this.XB=d[0],this.YB=d[1],this.ZB=d[2],(this.XW<0||this.ZW<0||1!==this.YW)&&c("Invalid WhitePoint components, no fallback available"),(this.XB<0||this.YB<0||this.ZB<0)&&(a("Invalid BlackPoint, falling back to default"),this.XB=this.YB=this.ZB=0),(this.amin>this.amax||this.bmin>this.bmax)&&(a("Invalid Range, falling back to defaults"),this.amin=-100,this.amax=100,this.bmin=-100,this.bmax=100)}function d(a){return a>=6/29?a*a*a:108/841*(a-4/29)}function e(a,b,c,d){return c+a*(d-c)/b}function f(a,b,c,f,g,h){var i=b[c],j=b[c+1],k=b[c+2];f!==!1&&(i=e(i,f,0,100),j=e(j,f,a.amin,a.amax),k=e(k,f,a.bmin,a.bmax)),j=j>a.amax?a.amax:ja.bmax?a.bmax:k=l?0:l>=1?255:255*Math.sqrt(l)|0,g[h+1]=0>=m?0:m>=1?255:255*Math.sqrt(m)|0,g[h+2]=0>=n?0:n>=1?255:255*Math.sqrt(n)|0}return b.prototype={getRgb:Xa.prototype.getRgb,getRgbItem:function(a,b,c,d){f(this,a,b,!1,c,d)},getRgbBuffer:function(a,b,c,d,e,g,h){for(var i=(1<j;j++)f(this,a,b,i,d,e),b+=3,e+=3+h},getOutputLength:function(a,b){return a*(3+b)/3|0},isPassthrough:Xa.prototype.isPassthrough,fillRgb:Xa.prototype.fillRgb,isDefaultDecode:function(a){return!0},usesZeroToOneRange:!1},b}(),fb=function(){function a(a){this.a=0,this.b=0;var b,c,d=new Uint8Array(256),e=0,f=a.length;for(b=0;256>b;++b)d[b]=b;for(b=0;256>b;++b)c=d[b],e=e+c+a[b%f]&255,d[b]=d[e],d[e]=c;this.s=d}return a.prototype={encryptBlock:function(a){var b,c,d,e=a.length,f=this.a,g=this.b,h=this.s,i=new Uint8Array(e);for(b=0;e>b;++b)f=f+1&255,c=h[f],g=g+c&255,d=h[g],h[f]=d,h[g]=c,i[b]=a[b]^h[c+d&255];return this.a=f,this.b=g,i}},a.prototype.decryptBlock=a.prototype.encryptBlock,a}(),gb=function(){function a(a,d,e){var f,g,h,i=1732584193,j=-271733879,k=-1732584194,l=271733878,m=e+72&-64,n=new Uint8Array(m);for(f=0;e>f;++f)n[f]=a[d++];for(n[f++]=128,h=m-8;h>f;)n[f++]=0;n[f++]=e<<3&255,n[f++]=e>>5&255,n[f++]=e>>13&255,n[f++]=e>>21&255,n[f++]=e>>>29&255,n[f++]=0,n[f++]=0,n[f++]=0;var o=new Int32Array(16);for(f=0;m>f;){for(g=0;16>g;++g,f+=4)o[g]=n[f]|n[f+1]<<8|n[f+2]<<16|n[f+3]<<24;var p,q,r=i,s=j,t=k,u=l;for(g=0;64>g;++g){16>g?(p=s&t|~s&u,q=g):32>g?(p=u&s|~u&t,q=5*g+1&15):48>g?(p=s^t^u,q=3*g+5&15):(p=t^(s|~u),q=7*g&15);var v=u,w=r+p+c[g]+o[q]|0,x=b[g];u=t,t=s,s=s+(w<>>32-x)|0,r=v}i=i+r|0,j=j+s|0,k=k+t|0,l=l+u|0}return new Uint8Array([255&i,i>>8&255,i>>16&255,i>>>24&255,255&j,j>>8&255,j>>16&255,j>>>24&255,255&k,k>>8&255,k>>16&255,k>>>24&255,255&l,l>>8&255,l>>16&255,l>>>24&255])}var b=new Uint8Array([7,12,17,22,7,12,17,22,7,12,17,22,7,12,17,22,5,9,14,20,5,9,14,20,5,9,14,20,5,9,14,20,4,11,16,23,4,11,16,23,4,11,16,23,4,11,16,23,6,10,15,21,6,10,15,21,6,10,15,21,6,10,15,21]),c=new Int32Array([-680876936,-389564586,606105819,-1044525330,-176418897,1200080426,-1473231341,-45705983,1770035416,-1958414417,-42063,-1990404162,1804603682,-40341101,-1502002290,1236535329,-165796510,-1069501632,643717713,-373897302,-701558691,38016083,-660478335,-405537848,568446438,-1019803690,-187363961,1163531501,-1444681467,-51403784,1735328473,-1926607734,-378558,-2022574463,1839030562,-35309556,-1530992060,1272893353,-155497632,-1094730640,681279174,-358537222,-722521979,76029189,-640364487,-421815835,530742520,-995338651,-198630844,1126891415,-1416354905,-57434055,1700485571,-1894986606,-1051523,-2054922799,1873313359,-30611744,-1560198380,1309151649,-145523070,-1120210379,718787259,-343485551]);return a}(),hb=function(){function a(a,b){this.high=0|a,this.low=0|b}return a.prototype={and:function(a){this.high&=a.high,this.low&=a.low},xor:function(a){this.high^=a.high,this.low^=a.low},or:function(a){this.high|=a.high,this.low|=a.low},shiftRight:function(a){a>=32?(this.low=this.high>>>a-32|0,this.high=0):(this.low=this.low>>>a|this.high<<32-a,this.high=this.high>>>a|0)},shiftLeft:function(a){a>=32?(this.high=this.low<>>32-a,this.low=this.low<>>a|c<<32-a,this.high=c>>>a|b<<32-a},not:function(){this.high=~this.high,this.low=~this.low},add:function(a){var b=(this.low>>>0)+(a.low>>>0),c=(this.high>>>0)+(a.high>>>0);b>4294967295&&(c+=1),this.low=0|b,this.high=0|c},copyTo:function(a,b){a[b]=this.high>>>24&255,a[b+1]=this.high>>16&255,a[b+2]=this.high>>8&255,a[b+3]=255&this.high,a[b+4]=this.low>>>24&255,a[b+5]=this.low>>16&255,a[b+6]=this.low>>8&255,a[b+7]=255&this.low},assign:function(a){this.high=a.high,this.low=a.low}},a}(),ib=function(){function a(a,b){return a>>>b|a<<32-b}function b(a,b,c){return a&b^~a&c}function c(a,b,c){return a&b^a&c^b&c}function d(b){return a(b,2)^a(b,13)^a(b,22)}function e(b){return a(b,6)^a(b,11)^a(b,25)}function f(b){return a(b,7)^a(b,18)^b>>>3}function g(b){return a(b,17)^a(b,19)^b>>>10}function h(a,h,j){var k,l,m,n=1779033703,o=3144134277,p=1013904242,q=2773480762,r=1359893119,s=2600822924,t=528734635,u=1541459225,v=64*Math.ceil((j+9)/64),w=new Uint8Array(v);for(k=0;j>k;++k)w[k]=a[h++];for(w[k++]=128,m=v-8;m>k;)w[k++]=0;w[k++]=0,w[k++]=0,w[k++]=0,w[k++]=j>>>29&255,w[k++]=j>>21&255,w[k++]=j>>13&255,w[k++]=j>>5&255,w[k++]=j<<3&255;var x=new Uint32Array(64);for(k=0;v>k;){for(l=0;16>l;++l)x[l]=w[k]<<24|w[k+1]<<16|w[k+2]<<8|w[k+3],k+=4;for(l=16;64>l;++l)x[l]=g(x[l-2])+x[l-7]+f(x[l-15])+x[l-16]|0;var y,z,A=n,B=o,C=p,D=q,E=r,F=s,G=t,H=u;for(l=0;64>l;++l)y=H+e(E)+b(E,F,G)+i[l]+x[l],z=d(A)+c(A,B,C),H=G,G=F,F=E,E=D+y|0,D=C,C=B,B=A,A=y+z|0;n=n+A|0,o=o+B|0,p=p+C|0,q=q+D|0,r=r+E|0,s=s+F|0,t=t+G|0,u=u+H|0}return new Uint8Array([n>>24&255,n>>16&255,n>>8&255,255&n,o>>24&255,o>>16&255,o>>8&255,255&o,p>>24&255,p>>16&255,p>>8&255,255&p,q>>24&255,q>>16&255,q>>8&255,255&q,r>>24&255,r>>16&255,r>>8&255,255&r,s>>24&255,s>>16&255,s>>8&255,255&s,t>>24&255,t>>16&255,t>>8&255,255&t,u>>24&255,u>>16&255,u>>8&255,255&u])}var i=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];return h}(),jb=function(){function a(a,b,c,d,e){a.assign(b),a.and(c),e.assign(b),e.not(),e.and(d),a.xor(e)}function b(a,b,c,d,e){a.assign(b),a.and(c),e.assign(b),e.and(d),a.xor(e),e.assign(c),e.and(d),a.xor(e)}function c(a,b,c){a.assign(b),a.rotateRight(28),c.assign(b),c.rotateRight(34),a.xor(c),c.assign(b),c.rotateRight(39),a.xor(c)}function d(a,b,c){a.assign(b),a.rotateRight(14),c.assign(b),c.rotateRight(18),a.xor(c),c.assign(b),c.rotateRight(41),a.xor(c)}function e(a,b,c){a.assign(b),a.rotateRight(1),c.assign(b),c.rotateRight(8),a.xor(c),c.assign(b),c.shiftRight(7),a.xor(c)}function f(a,b,c){a.assign(b),a.rotateRight(19),c.assign(b),c.rotateRight(61),a.xor(c),c.assign(b),c.shiftRight(6),a.xor(c)}function g(g,i,j,k){k=!!k;var l,m,n,o,p,q,r,s;k?(l=new hb(3418070365,3238371032),m=new hb(1654270250,914150663),n=new hb(2438529370,812702999),o=new hb(355462360,4144912697),p=new hb(1731405415,4290775857),q=new hb(2394180231,1750603025),r=new hb(3675008525,1694076839),s=new hb(1203062813,3204075428)):(l=new hb(1779033703,4089235720),m=new hb(3144134277,2227873595),n=new hb(1013904242,4271175723),o=new hb(2773480762,1595750129),p=new hb(1359893119,2917565137),q=new hb(2600822924,725511199),r=new hb(528734635,4215389547),s=new hb(1541459225,327033209));var t,u,v,w=128*Math.ceil((j+17)/128),x=new Uint8Array(w);for(t=0;j>t;++t)x[t]=g[i++];for(x[t++]=128,v=w-16;v>t;)x[t++]=0;x[t++]=0,x[t++]=0,x[t++]=0,x[t++]=0,x[t++]=0,x[t++]=0,x[t++]=0,x[t++]=0,x[t++]=0,x[t++]=0,x[t++]=0,x[t++]=j>>>29&255,x[t++]=j>>21&255,x[t++]=j>>13&255,x[t++]=j>>5&255,x[t++]=j<<3&255;var y=new Array(80);for(t=0;80>t;t++)y[t]=new hb(0,0);var z,A=new hb(0,0),B=new hb(0,0),C=new hb(0,0),D=new hb(0,0),E=new hb(0,0),F=new hb(0,0),G=new hb(0,0),H=new hb(0,0),I=new hb(0,0),J=new hb(0,0),K=new hb(0,0),L=new hb(0,0);for(t=0;w>t;){for(u=0;16>u;++u)y[u].high=x[t]<<24|x[t+1]<<16|x[t+2]<<8|x[t+3],y[u].low=x[t+4]<<24|x[t+5]<<16|x[t+6]<<8|x[t+7],t+=8;for(u=16;80>u;++u)z=y[u],f(z,y[u-2],L),z.add(y[u-7]),e(K,y[u-15],L),z.add(K),z.add(y[u-16]);for(A.assign(l),B.assign(m),C.assign(n),D.assign(o),E.assign(p),F.assign(q),G.assign(r),H.assign(s),u=0;80>u;++u)I.assign(H),d(K,E,L),I.add(K),a(K,E,F,G,L),I.add(K),I.add(h[u]),I.add(y[u]),c(J,A,L),b(K,A,B,C,L),J.add(K),z=H,H=G,G=F,F=E,D.add(I),E=D,D=C,C=B,B=A,z.assign(I),z.add(J),A=z;l.add(A),m.add(B),n.add(C),o.add(D),p.add(E),q.add(F),r.add(G),s.add(H)}var M;return k?(M=new Uint8Array(48),l.copyTo(M,0),m.copyTo(M,8),n.copyTo(M,16),o.copyTo(M,24),p.copyTo(M,32),q.copyTo(M,40)):(M=new Uint8Array(64),l.copyTo(M,0),m.copyTo(M,8),n.copyTo(M,16),o.copyTo(M,24),p.copyTo(M,32),q.copyTo(M,40),r.copyTo(M,48),s.copyTo(M,56)),M}var h=[new hb(1116352408,3609767458),new hb(1899447441,602891725),new hb(3049323471,3964484399),new hb(3921009573,2173295548),new hb(961987163,4081628472),new hb(1508970993,3053834265),new hb(2453635748,2937671579),new hb(2870763221,3664609560),new hb(3624381080,2734883394),new hb(310598401,1164996542),new hb(607225278,1323610764),new hb(1426881987,3590304994),new hb(1925078388,4068182383),new hb(2162078206,991336113),new hb(2614888103,633803317),new hb(3248222580,3479774868),new hb(3835390401,2666613458),new hb(4022224774,944711139),new hb(264347078,2341262773),new hb(604807628,2007800933),new hb(770255983,1495990901),new hb(1249150122,1856431235),new hb(1555081692,3175218132),new hb(1996064986,2198950837),new hb(2554220882,3999719339),new hb(2821834349,766784016),new hb(2952996808,2566594879),new hb(3210313671,3203337956),new hb(3336571891,1034457026),new hb(3584528711,2466948901),new hb(113926993,3758326383),new hb(338241895,168717936),new hb(666307205,1188179964),new hb(773529912,1546045734),new hb(1294757372,1522805485),new hb(1396182291,2643833823),new hb(1695183700,2343527390),new hb(1986661051,1014477480),new hb(2177026350,1206759142),new hb(2456956037,344077627),new hb(2730485921,1290863460),new hb(2820302411,3158454273),new hb(3259730800,3505952657),new hb(3345764771,106217008),new hb(3516065817,3606008344),new hb(3600352804,1432725776),new hb(4094571909,1467031594),new hb(275423344,851169720),new hb(430227734,3100823752),new hb(506948616,1363258195),new hb(659060556,3750685593),new hb(883997877,3785050280),new hb(958139571,3318307427),new hb(1322822218,3812723403),new hb(1537002063,2003034995),new hb(1747873779,3602036899),new hb(1955562222,1575990012),new hb(2024104815,1125592928),new hb(2227730452,2716904306),new hb(2361852424,442776044),new hb(2428436474,593698344),new hb(2756734187,3733110249),new hb(3204031479,2999351573),new hb(3329325298,3815920427),new hb(3391569614,3928383900),new hb(3515267271,566280711),new hb(3940187606,3454069534),new hb(4118630271,4000239992),new hb(116418474,1914138554),new hb(174292421,2731055270),new hb(289380356,3203993006),new hb(460393269,320620315),new hb(685471733,587496836),new hb(852142971,1086792851),new hb(1017036298,365543100),new hb(1126000580,2618297676),new hb(1288033470,3409855158),new hb(1501505948,4234509866),new hb(1607167915,987167468),new hb(1816402316,1246189591)];return g}(),kb=function(){function a(a,b,c){return jb(a,b,c,!0)}return a}(),lb=function(){function a(){}return a.prototype={decryptBlock:function(a){return a}},a}(),mb=function(){function a(a){var b=176,c=new Uint8Array(b);c.set(a);for(var d=16,e=1;b>d;++e){var h=c[d-3],i=c[d-2],j=c[d-1],k=c[d-4];h=g[h],i=g[i],j=g[j],k=g[k],h^=f[e];for(var l=0;4>l;++l)c[d]=h^=c[d-16],d++,c[d]=i^=c[d-16],d++,c[d]=j^=c[d-16],d++,c[d]=k^=c[d-16],d++}return c}function b(a,b){var c=new Uint8Array(16);c.set(a);var d,e,f,g,i,j;for(e=0,f=160;16>e;++e,++f)c[e]^=b[f];for(d=9;d>=1;--d){for(g=c[13],c[13]=c[9],c[9]=c[5],c[5]=c[1],c[1]=g,g=c[14],i=c[10],c[14]=c[6],c[10]=c[2],c[6]=g,c[2]=i,g=c[15],i=c[11],j=c[7],c[15]=c[3],c[11]=g,c[7]=i,c[3]=j,e=0;16>e;++e)c[e]=h[c[e]];for(e=0,f=16*d;16>e;++e,++f)c[e]^=b[f];for(e=0;16>e;e+=4){var l=k[c[e]],m=k[c[e+1]],n=k[c[e+2]],o=k[c[e+3]];g=l^m>>>8^m<<24^n>>>16^n<<16^o>>>24^o<<8,c[e]=g>>>24&255,c[e+1]=g>>16&255,c[e+2]=g>>8&255,c[e+3]=255&g}}for(g=c[13],c[13]=c[9],c[9]=c[5],c[5]=c[1],c[1]=g,g=c[14],i=c[10],c[14]=c[6],c[10]=c[2],c[6]=g,c[2]=i,g=c[15],i=c[11],j=c[7],c[15]=c[3],c[11]=g,c[7]=i,c[3]=j,e=0;16>e;++e)c[e]=h[c[e]],c[e]^=b[e];return c}function c(a,b){var c,d,e,f,h=new Uint8Array(16);for(h.set(a),k=0;16>k;++k)h[k]^=b[k];for(j=1;10>j;j++){for(k=0;16>k;++k)h[k]=g[h[k]];e=h[1],h[1]=h[5],h[5]=h[9],h[9]=h[13],h[13]=e,e=h[2],d=h[6],h[2]=h[10],h[6]=h[14],h[10]=e,h[14]=d,e=h[3],d=h[7],c=h[11],h[3]=h[15],h[7]=e,h[11]=d,h[15]=c;for(var k=0;16>k;k+=4){var l=h[k+0],m=h[k+1],n=h[k+2],o=h[k+3];c=l^m^n^o,h[k+0]^=c^i[l^m],h[k+1]^=c^i[m^n],h[k+2]^=c^i[n^o],h[k+3]^=c^i[o^l]}for(k=0,f=16*j;16>k;++k,++f)h[k]^=b[f]}for(k=0;16>k;++k)h[k]=g[h[k]];for(e=h[1],h[1]=h[5],h[5]=h[9],h[9]=h[13],h[13]=e,e=h[2],d=h[6],h[2]=h[10],h[6]=h[14],h[10]=e,h[14]=d,e=h[3],d=h[7],c=h[11],h[3]=h[15],h[7]=e,h[11]=d,h[15]=c,k=0,f=160;16>k;++k,++f)h[k]^=b[f];return h}function d(b){this.key=a(b),this.buffer=new Uint8Array(16),this.bufferPosition=0}function e(a,c){var d,e,f,g=a.length,h=this.buffer,i=this.bufferPosition,j=[],k=this.iv;for(d=0;g>d;++d)if(h[i]=a[d],++i,!(16>i)){var l=b(h,this.key);for(e=0;16>e;++e)l[e]^=k[e];k=h,j.push(l),h=new Uint8Array(16),i=0}if(this.buffer=h,this.bufferLength=i,this.iv=k,0===j.length)return new Uint8Array([]);var m=16*j.length;if(c){var n=j[j.length-1],o=n[15];if(16>=o){for(d=15,f=16-o;d>=f;--d)if(n[d]!==o){o=0;break}m-=o,j[j.length-1]=n.subarray(0,16-o)}}var p=new Uint8Array(m);for(d=0,e=0,f=j.length;f>d;++d,e+=16)p.set(j[d],e);return p}for(var f=new Uint8Array([141,1,2,4,8,16,32,64,128,27,54,108,216,171,77,154,47,94,188,99,198,151,53,106,212,179,125,250,239,197,145,57,114,228,211,189,97,194,159,37,74,148,51,102,204,131,29,58,116,232,203,141,1,2,4,8,16,32,64,128,27,54,108,216,171,77,154,47,94,188,99,198,151,53,106,212,179,125,250,239,197,145,57,114,228,211,189,97,194,159,37,74,148,51,102,204,131,29,58,116,232,203,141,1,2,4,8,16,32,64,128,27,54,108,216,171,77,154,47,94,188,99,198,151,53,106,212,179,125,250,239,197,145,57,114,228,211,189,97,194,159,37,74,148,51,102,204,131,29,58,116,232,203,141,1,2,4,8,16,32,64,128,27,54,108,216,171,77,154,47,94,188,99,198,151,53,106,212,179,125,250,239,197,145,57,114,228,211,189,97,194,159,37,74,148,51,102,204,131,29,58,116,232,203,141,1,2,4,8,16,32,64,128,27,54,108,216,171,77,154,47,94,188,99,198,151,53,106,212,179,125,250,239,197,145,57,114,228,211,189,97,194,159,37,74,148,51,102,204,131,29,58,116,232,203,141]),g=new Uint8Array([99,124,119,123,242,107,111,197,48,1,103,43,254,215,171,118,202,130,201,125,250,89,71,240,173,212,162,175,156,164,114,192,183,253,147,38,54,63,247,204,52,165,229,241,113,216,49,21,4,199,35,195,24,150,5,154,7,18,128,226,235,39,178,117,9,131,44,26,27,110,90,160,82,59,214,179,41,227,47,132,83,209,0,237,32,252,177,91,106,203,190,57,74,76,88,207,208,239,170,251,67,77,51,133,69,249,2,127,80,60,159,168,81,163,64,143,146,157,56,245,188,182,218,33,16,255,243,210,205,12,19,236,95,151,68,23,196,167,126,61,100,93,25,115,96,129,79,220,34,42,144,136,70,238,184,20,222,94,11,219,224,50,58,10,73,6,36,92,194,211,172,98,145,149,228,121,231,200,55,109,141,213,78,169,108,86,244,234,101,122,174,8,186,120,37,46,28,166,180,198,232,221,116,31,75,189,139,138,112,62,181,102,72,3,246,14,97,53,87,185,134,193,29,158,225,248,152,17,105,217,142,148,155,30,135,233,206,85,40,223,140,161,137,13,191,230,66,104,65,153,45,15,176,84,187,22]),h=new Uint8Array([82,9,106,213,48,54,165,56,191,64,163,158,129,243,215,251,124,227,57,130,155,47,255,135,52,142,67,68,196,222,233,203,84,123,148,50,166,194,35,61,238,76,149,11,66,250,195,78,8,46,161,102,40,217,36,178,118,91,162,73,109,139,209,37,114,248,246,100,134,104,152,22,212,164,92,204,93,101,182,146,108,112,72,80,253,237,185,218,94,21,70,87,167,141,157,132,144,216,171,0,140,188,211,10,247,228,88,5,184,179,69,6,208,44,30,143,202,63,15,2,193,175,189,3,1,19,138,107,58,145,17,65,79,103,220,234,151,242,207,206,240,180,230,115,150,172,116,34,231,173,53,133,226,249,55,232,28,117,223,110,71,241,26,113,29,41,197,137,111,183,98,14,170,24,190,27,252,86,62,75,198,210,121,32,154,219,192,254,120,205,90,244,31,221,168,51,136,7,199,49,177,18,16,89,39,128,236,95,96,81,127,169,25,181,74,13,45,229,122,159,147,201,156,239,160,224,59,77,174,42,245,176,200,235,187,60,131,83,153,97,23,43,4,126,186,119,214,38,225,105,20,99,85,33,12,125]),i=new Uint8Array(256),j=0;256>j;j++)128>j?i[j]=j<<1:i[j]=j<<1^27; +var k=new Uint32Array([0,235474187,470948374,303765277,941896748,908933415,607530554,708780849,1883793496,2118214995,1817866830,1649639237,1215061108,1181045119,1417561698,1517767529,3767586992,4003061179,4236429990,4069246893,3635733660,3602770327,3299278474,3400528769,2430122216,2664543715,2362090238,2193862645,2835123396,2801107407,3035535058,3135740889,3678124923,3576870512,3341394285,3374361702,3810496343,3977675356,4279080257,4043610186,2876494627,2776292904,3076639029,3110650942,2472011535,2640243204,2403728665,2169303058,1001089995,899835584,666464733,699432150,59727847,226906860,530400753,294930682,1273168787,1172967064,1475418501,1509430414,1942435775,2110667444,1876241833,1641816226,2910219766,2743034109,2976151520,3211623147,2505202138,2606453969,2302690252,2269728455,3711829422,3543599269,3240894392,3475313331,3843699074,3943906441,4178062228,4144047775,1306967366,1139781709,1374988112,1610459739,1975683434,2076935265,1775276924,1742315127,1034867998,866637845,566021896,800440835,92987698,193195065,429456164,395441711,1984812685,2017778566,1784663195,1683407248,1315562145,1080094634,1383856311,1551037884,101039829,135050206,437757123,337553864,1042385657,807962610,573804783,742039012,2531067453,2564033334,2328828971,2227573024,2935566865,2700099354,3001755655,3168937228,3868552805,3902563182,4203181171,4102977912,3736164937,3501741890,3265478751,3433712980,1106041591,1340463100,1576976609,1408749034,2043211483,2009195472,1708848333,1809054150,832877231,1068351396,766945465,599762354,159417987,126454664,361929877,463180190,2709260871,2943682380,3178106961,3009879386,2572697195,2538681184,2236228733,2336434550,3509871135,3745345300,3441850377,3274667266,3910161971,3877198648,4110568485,4211818798,2597806476,2497604743,2261089178,2295101073,2733856160,2902087851,3202437046,2968011453,3936291284,3835036895,4136440770,4169408201,3535486456,3702665459,3467192302,3231722213,2051518780,1951317047,1716890410,1750902305,1113818384,1282050075,1584504582,1350078989,168810852,67556463,371049330,404016761,841739592,1008918595,775550814,540080725,3969562369,3801332234,4035489047,4269907996,3569255213,3669462566,3366754619,3332740144,2631065433,2463879762,2160117071,2395588676,2767645557,2868897406,3102011747,3069049960,202008497,33778362,270040487,504459436,875451293,975658646,675039627,641025152,2084704233,1917518562,1615861247,1851332852,1147550661,1248802510,1484005843,1451044056,933301370,967311729,733156972,632953703,260388950,25965917,328671808,496906059,1206477858,1239443753,1543208500,1441952575,2144161806,1908694277,1675577880,1842759443,3610369226,3644379585,3408119516,3307916247,4011190502,3776767469,4077384432,4245618683,2809771154,2842737049,3144396420,3043140495,2673705150,2438237621,2203032232,2370213795]);return d.prototype={decryptBlock:function(a,b){var c,d=a.length,f=this.buffer,g=this.bufferPosition;for(c=0;16>g&&d>c;++c,++g)f[g]=a[c];return 16>g?(this.bufferLength=g,new Uint8Array([])):(this.iv=f,this.buffer=new Uint8Array(16),this.bufferLength=0,this.decryptBlock=e,this.decryptBlock(a.subarray(16),b))},encrypt:function(a,b){var d,e,f,g=a.length,h=this.buffer,i=this.bufferPosition,j=[];for(b||(b=new Uint8Array(16)),d=0;g>d;++d)if(h[i]=a[d],++i,!(16>i)){for(e=0;16>e;++e)h[e]^=b[e];var k=c(h,this.key);b=k,j.push(k),h=new Uint8Array(16),i=0}if(this.buffer=h,this.bufferLength=i,this.iv=b,0===j.length)return new Uint8Array([]);var l=16*j.length,m=new Uint8Array(l);for(d=0,e=0,f=j.length;f>d;++d,e+=16)m.set(j[d],e);return m}},d}(),nb=function(){function a(a){var b=240,c=new Uint8Array(b),d=1;c.set(a);for(var e=32,g=1;b>e;++g){if(e%32===16)h=f[h],i=f[i],j=f[j],k=f[k];else if(e%32===0){var h=c[e-3],i=c[e-2],j=c[e-1],k=c[e-4];h=f[h],i=f[i],j=f[j],k=f[k],h^=d,(d<<=1)>=256&&(d=255&(27^d))}for(var l=0;4>l;++l)c[e]=h^=c[e-32],e++,c[e]=i^=c[e-32],e++,c[e]=j^=c[e-32],e++,c[e]=k^=c[e-32],e++}return c}function b(a,b){var c=new Uint8Array(16);c.set(a);var d,e,f,h,i,k;for(e=0,f=224;16>e;++e,++f)c[e]^=b[f];for(d=13;d>=1;--d){for(h=c[13],c[13]=c[9],c[9]=c[5],c[5]=c[1],c[1]=h,h=c[14],i=c[10],c[14]=c[6],c[10]=c[2],c[6]=h,c[2]=i,h=c[15],i=c[11],k=c[7],c[15]=c[3],c[11]=h,c[7]=i,c[3]=k,e=0;16>e;++e)c[e]=g[c[e]];for(e=0,f=16*d;16>e;++e,++f)c[e]^=b[f];for(e=0;16>e;e+=4){var l=j[c[e]],m=j[c[e+1]],n=j[c[e+2]],o=j[c[e+3]];h=l^m>>>8^m<<24^n>>>16^n<<16^o>>>24^o<<8,c[e]=h>>>24&255,c[e+1]=h>>16&255,c[e+2]=h>>8&255,c[e+3]=255&h}}for(h=c[13],c[13]=c[9],c[9]=c[5],c[5]=c[1],c[1]=h,h=c[14],i=c[10],c[14]=c[6],c[10]=c[2],c[6]=h,c[2]=i,h=c[15],i=c[11],k=c[7],c[15]=c[3],c[11]=h,c[7]=i,c[3]=k,e=0;16>e;++e)c[e]=g[c[e]],c[e]^=b[e];return c}function c(a,b){var c,d,e,g,j=new Uint8Array(16);for(j.set(a),k=0;16>k;++k)j[k]^=b[k];for(i=1;14>i;i++){for(k=0;16>k;++k)j[k]=f[j[k]];e=j[1],j[1]=j[5],j[5]=j[9],j[9]=j[13],j[13]=e,e=j[2],d=j[6],j[2]=j[10],j[6]=j[14],j[10]=e,j[14]=d,e=j[3],d=j[7],c=j[11],j[3]=j[15],j[7]=e,j[11]=d,j[15]=c;for(var k=0;16>k;k+=4){var l=j[k+0],m=j[k+1],n=j[k+2],o=j[k+3];c=l^m^n^o,j[k+0]^=c^h[l^m],j[k+1]^=c^h[m^n],j[k+2]^=c^h[n^o],j[k+3]^=c^h[o^l]}for(k=0,g=16*i;16>k;++k,++g)j[k]^=b[g]}for(k=0;16>k;++k)j[k]=f[j[k]];for(e=j[1],j[1]=j[5],j[5]=j[9],j[9]=j[13],j[13]=e,e=j[2],d=j[6],j[2]=j[10],j[6]=j[14],j[10]=e,j[14]=d,e=j[3],d=j[7],c=j[11],j[3]=j[15],j[7]=e,j[11]=d,j[15]=c,k=0,g=224;16>k;++k,++g)j[k]^=b[g];return j}function d(b){this.key=a(b),this.buffer=new Uint8Array(16),this.bufferPosition=0}function e(a,c){var d,e,f,g=a.length,h=this.buffer,i=this.bufferPosition,j=[],k=this.iv;for(d=0;g>d;++d)if(h[i]=a[d],++i,!(16>i)){var l=b(h,this.key);for(e=0;16>e;++e)l[e]^=k[e];k=h,j.push(l),h=new Uint8Array(16),i=0}if(this.buffer=h,this.bufferLength=i,this.iv=k,0===j.length)return new Uint8Array([]);var m=16*j.length;if(c){var n=j[j.length-1],o=n[15];if(16>=o){for(d=15,f=16-o;d>=f;--d)if(n[d]!==o){o=0;break}m-=o,j[j.length-1]=n.subarray(0,16-o)}}var p=new Uint8Array(m);for(d=0,e=0,f=j.length;f>d;++d,e+=16)p.set(j[d],e);return p}for(var f=(new Uint8Array([141,1,2,4,8,16,32,64,128,27,54,108,216,171,77,154,47,94,188,99,198,151,53,106,212,179,125,250,239,197,145,57,114,228,211,189,97,194,159,37,74,148,51,102,204,131,29,58,116,232,203,141,1,2,4,8,16,32,64,128,27,54,108,216,171,77,154,47,94,188,99,198,151,53,106,212,179,125,250,239,197,145,57,114,228,211,189,97,194,159,37,74,148,51,102,204,131,29,58,116,232,203,141,1,2,4,8,16,32,64,128,27,54,108,216,171,77,154,47,94,188,99,198,151,53,106,212,179,125,250,239,197,145,57,114,228,211,189,97,194,159,37,74,148,51,102,204,131,29,58,116,232,203,141,1,2,4,8,16,32,64,128,27,54,108,216,171,77,154,47,94,188,99,198,151,53,106,212,179,125,250,239,197,145,57,114,228,211,189,97,194,159,37,74,148,51,102,204,131,29,58,116,232,203,141,1,2,4,8,16,32,64,128,27,54,108,216,171,77,154,47,94,188,99,198,151,53,106,212,179,125,250,239,197,145,57,114,228,211,189,97,194,159,37,74,148,51,102,204,131,29,58,116,232,203,141]),new Uint8Array([99,124,119,123,242,107,111,197,48,1,103,43,254,215,171,118,202,130,201,125,250,89,71,240,173,212,162,175,156,164,114,192,183,253,147,38,54,63,247,204,52,165,229,241,113,216,49,21,4,199,35,195,24,150,5,154,7,18,128,226,235,39,178,117,9,131,44,26,27,110,90,160,82,59,214,179,41,227,47,132,83,209,0,237,32,252,177,91,106,203,190,57,74,76,88,207,208,239,170,251,67,77,51,133,69,249,2,127,80,60,159,168,81,163,64,143,146,157,56,245,188,182,218,33,16,255,243,210,205,12,19,236,95,151,68,23,196,167,126,61,100,93,25,115,96,129,79,220,34,42,144,136,70,238,184,20,222,94,11,219,224,50,58,10,73,6,36,92,194,211,172,98,145,149,228,121,231,200,55,109,141,213,78,169,108,86,244,234,101,122,174,8,186,120,37,46,28,166,180,198,232,221,116,31,75,189,139,138,112,62,181,102,72,3,246,14,97,53,87,185,134,193,29,158,225,248,152,17,105,217,142,148,155,30,135,233,206,85,40,223,140,161,137,13,191,230,66,104,65,153,45,15,176,84,187,22])),g=new Uint8Array([82,9,106,213,48,54,165,56,191,64,163,158,129,243,215,251,124,227,57,130,155,47,255,135,52,142,67,68,196,222,233,203,84,123,148,50,166,194,35,61,238,76,149,11,66,250,195,78,8,46,161,102,40,217,36,178,118,91,162,73,109,139,209,37,114,248,246,100,134,104,152,22,212,164,92,204,93,101,182,146,108,112,72,80,253,237,185,218,94,21,70,87,167,141,157,132,144,216,171,0,140,188,211,10,247,228,88,5,184,179,69,6,208,44,30,143,202,63,15,2,193,175,189,3,1,19,138,107,58,145,17,65,79,103,220,234,151,242,207,206,240,180,230,115,150,172,116,34,231,173,53,133,226,249,55,232,28,117,223,110,71,241,26,113,29,41,197,137,111,183,98,14,170,24,190,27,252,86,62,75,198,210,121,32,154,219,192,254,120,205,90,244,31,221,168,51,136,7,199,49,177,18,16,89,39,128,236,95,96,81,127,169,25,181,74,13,45,229,122,159,147,201,156,239,160,224,59,77,174,42,245,176,200,235,187,60,131,83,153,97,23,43,4,126,186,119,214,38,225,105,20,99,85,33,12,125]),h=new Uint8Array(256),i=0;256>i;i++)128>i?h[i]=i<<1:h[i]=i<<1^27;var j=new Uint32Array([0,235474187,470948374,303765277,941896748,908933415,607530554,708780849,1883793496,2118214995,1817866830,1649639237,1215061108,1181045119,1417561698,1517767529,3767586992,4003061179,4236429990,4069246893,3635733660,3602770327,3299278474,3400528769,2430122216,2664543715,2362090238,2193862645,2835123396,2801107407,3035535058,3135740889,3678124923,3576870512,3341394285,3374361702,3810496343,3977675356,4279080257,4043610186,2876494627,2776292904,3076639029,3110650942,2472011535,2640243204,2403728665,2169303058,1001089995,899835584,666464733,699432150,59727847,226906860,530400753,294930682,1273168787,1172967064,1475418501,1509430414,1942435775,2110667444,1876241833,1641816226,2910219766,2743034109,2976151520,3211623147,2505202138,2606453969,2302690252,2269728455,3711829422,3543599269,3240894392,3475313331,3843699074,3943906441,4178062228,4144047775,1306967366,1139781709,1374988112,1610459739,1975683434,2076935265,1775276924,1742315127,1034867998,866637845,566021896,800440835,92987698,193195065,429456164,395441711,1984812685,2017778566,1784663195,1683407248,1315562145,1080094634,1383856311,1551037884,101039829,135050206,437757123,337553864,1042385657,807962610,573804783,742039012,2531067453,2564033334,2328828971,2227573024,2935566865,2700099354,3001755655,3168937228,3868552805,3902563182,4203181171,4102977912,3736164937,3501741890,3265478751,3433712980,1106041591,1340463100,1576976609,1408749034,2043211483,2009195472,1708848333,1809054150,832877231,1068351396,766945465,599762354,159417987,126454664,361929877,463180190,2709260871,2943682380,3178106961,3009879386,2572697195,2538681184,2236228733,2336434550,3509871135,3745345300,3441850377,3274667266,3910161971,3877198648,4110568485,4211818798,2597806476,2497604743,2261089178,2295101073,2733856160,2902087851,3202437046,2968011453,3936291284,3835036895,4136440770,4169408201,3535486456,3702665459,3467192302,3231722213,2051518780,1951317047,1716890410,1750902305,1113818384,1282050075,1584504582,1350078989,168810852,67556463,371049330,404016761,841739592,1008918595,775550814,540080725,3969562369,3801332234,4035489047,4269907996,3569255213,3669462566,3366754619,3332740144,2631065433,2463879762,2160117071,2395588676,2767645557,2868897406,3102011747,3069049960,202008497,33778362,270040487,504459436,875451293,975658646,675039627,641025152,2084704233,1917518562,1615861247,1851332852,1147550661,1248802510,1484005843,1451044056,933301370,967311729,733156972,632953703,260388950,25965917,328671808,496906059,1206477858,1239443753,1543208500,1441952575,2144161806,1908694277,1675577880,1842759443,3610369226,3644379585,3408119516,3307916247,4011190502,3776767469,4077384432,4245618683,2809771154,2842737049,3144396420,3043140495,2673705150,2438237621,2203032232,2370213795]);return d.prototype={decryptBlock:function(a,b,c){var d,f=a.length,g=this.buffer,h=this.bufferPosition;if(c)this.iv=c;else{for(d=0;16>h&&f>d;++d,++h)g[h]=a[d];if(16>h)return this.bufferLength=h,new Uint8Array([]);this.iv=g,a=a.subarray(16)}return this.buffer=new Uint8Array(16),this.bufferLength=0,this.decryptBlock=e,this.decryptBlock(a,b)},encrypt:function(a,b){var d,e,f,g=a.length,h=this.buffer,i=this.bufferPosition,j=[];for(b||(b=new Uint8Array(16)),d=0;g>d;++d)if(h[i]=a[d],++i,!(16>i)){for(e=0;16>e;++e)h[e]^=b[e];var k=c(h,this.key);this.iv=k,j.push(k),h=new Uint8Array(16),i=0}if(this.buffer=h,this.bufferLength=i,this.iv=b,0===j.length)return new Uint8Array([]);var l=16*j.length,m=new Uint8Array(l);for(d=0,e=0,f=j.length;f>d;++d,e+=16)m.set(j[d],e);return m}},d}(),ob=function(){function a(a,b){if(a.length!==b.length)return!1;for(var c=0;cg||f[f.length-1]>g-32;){var h=b.length+e.length+d.length,i=new Uint8Array(64*h),j=a(b,e);j=a(j,d);for(var k=0,l=0;64>k;k++,l+=h)i.set(j,l);var m=new mb(e.subarray(0,16));f=m.encrypt(i,e.subarray(16,32));for(var n=0,o=0;16>o;o++)n*=1,n%=3,n+=(f[o]>>>0)%3,n%=3;0===n?e=ib(f,0,f.length):1===n?e=kb(f,0,f.length):2===n&&(e=jb(f,0,f.length)),g++}return e.subarray(0,32)}function c(){}function d(a,b){if(a.length!==b.length)return!1;for(var c=0;cn;++n)m[n]=b[n];for(j=0;32>n;)m[n++]=i[j++];for(j=0,k=c.length;k>j;++j)m[n++]=c[j];for(m[n++]=255&e,m[n++]=e>>8&255,m[n++]=e>>16&255,m[n++]=e>>>24&255,j=0,k=a.length;k>j;++j)m[n++]=a[j];f>=4&&!h&&(m[n++]=255,m[n++]=255,m[n++]=255,m[n++]=255);var o=gb(m,0,n),p=g>>3;if(f>=3)for(j=0;50>j;++j)o=gb(o,0,p);var q,r,s=o.subarray(0,p);if(f>=3){for(n=0;32>n;++n)m[n]=i[n];for(j=0,k=a.length;k>j;++j)m[n++]=a[j];q=new fb(s),r=q.encryptBlock(gb(m,0,n)),k=s.length;var t,u=new Uint8Array(k);for(j=1;19>=j;++j){for(t=0;k>t;++t)u[t]=s[t]^j;q=new fb(u),r=q.encryptBlock(r)}for(j=0,k=r.length;k>j;++j)if(d[j]!==r[j])return null}else for(q=new fb(s),r=q.encryptBlock(i),j=0,k=r.length;k>j;++j)if(d[j]!==r[j])return null;return s}function e(a,b,c,d){var e,f,g=new Uint8Array(32),h=0;for(f=Math.min(32,a.length);f>h;++h)g[h]=a[h];for(e=0;32>h;)g[h++]=i[e++];var j=gb(g,0,h),k=d>>3;if(c>=3)for(e=0;50>e;++e)j=gb(j,0,j.length);var l,m;if(c>=3){m=b;var n,o=new Uint8Array(k);for(e=19;e>=0;e--){for(n=0;k>n;++n)o[n]=j[n]^e;l=new fb(o),m=l.encryptBlock(m)}}else l=new fb(j.subarray(0,k)),m=l.encryptBlock(b);return m}function f(f,g,h){var i=f.get("Filter");z(i)&&"Standard"===i.name||c("unknown encryption method"),this.dict=f;var l=f.get("V");(!w(l)||1!==l&&2!==l&&4!==l&&5!==l)&&c("unsupported encryption algorithm"),this.algorithm=l;var m=f.get("Length")||40;(!w(m)||40>m||m%8!==0)&&c("invalid key length");var n=j(f.get("O")).subarray(0,32),o=j(f.get("U")).subarray(0,32),p=f.get("P"),q=f.get("R"),r=(4===l||5===l)&&f.get("EncryptMetadata")!==!1;this.encryptMetadata=r;var s,u=j(g);if(h){if(6===q)try{h=t(h)}catch(v){b("CipherTransformFactory: Unable to convert UTF8 encoded password.")}s=j(h)}var x;if(5!==l)x=d(u,s,n,o,p,q,m,r);else{var y=j(f.get("O")).subarray(32,40),A=j(f.get("O")).subarray(40,48),B=j(f.get("U")).subarray(0,48),C=j(f.get("U")).subarray(32,40),D=j(f.get("U")).subarray(40,48),E=j(f.get("OE")),F=j(f.get("UE")),G=j(f.get("Perms"));x=a(q,s,n,y,A,B,o,C,D,E,F,G)}if(!x&&!h)throw new da("No password given",ca.NEED_PASSWORD);if(!x&&h){var H=e(s,n,q,m);x=d(u,H,n,o,p,q,m,r)}if(!x)throw new da("Incorrect Password",ca.INCORRECT_PASSWORD);this.encryptionKey=x,l>=4&&(this.cf=f.get("CF"),this.stmf=f.get("StmF")||k,this.strf=f.get("StrF")||k,this.eff=f.get("EFF")||this.stmf)}function g(a,b,c,d){var e,f,g=new Uint8Array(c.length+9);for(e=0,f=c.length;f>e;++e)g[e]=c[e];g[e++]=255&a,g[e++]=a>>8&255,g[e++]=a>>16&255,g[e++]=255&b,g[e++]=b>>8&255,d&&(g[e++]=115,g[e++]=65,g[e++]=108,g[e++]=84);var h=gb(g,0,e);return h.subarray(0,Math.min(c.length+5,16))}function h(a,b,d,e,f){var h,i=a.get(b.name);return null!==i&&void 0!==i&&(h=i.get("CFM")),h&&"None"!==h.name?"V2"===h.name?function(){return new fb(g(d,e,f,!1))}:"AESV2"===h.name?function(){return new mb(g(d,e,f,!0))}:"AESV3"===h.name?function(){return new nb(f)}:void c("Unknown crypto method"):function(){return new lb}}var i=new Uint8Array([40,191,78,94,78,117,138,65,100,0,78,86,255,250,1,8,46,46,0,182,208,104,62,128,47,12,169,254,100,83,105,122]),k=ya.get("Identity");return f.prototype={createCipherTransform:function(a,b){if(4===this.algorithm||5===this.algorithm)return new qb(h(this.cf,this.stmf,a,b,this.encryptionKey),h(this.cf,this.strf,a,b,this.encryptionKey));var c=g(a,b,this.encryptionKey,!1),d=function(){return new fb(c)};return new qb(d,d)}},f}(),sb={FUNCTION_BASED:1,AXIAL:2,RADIAL:3,FREE_FORM_MESH:4,LATTICE_FORM_MESH:5,COONS_PATCH_MESH:6,TENSOR_PATCH_MESH:7},tb=function(){function a(){c("should not call Pattern constructor")}return a.prototype={getPattern:function(a){c("Should not call Pattern.getStyle: "+a)}},a.parseShading=function(a,c,d,e){var f=D(a)?a.dict:a,g=f.get("ShadingType");try{switch(g){case sb.AXIAL:case sb.RADIAL:return new ub.RadialAxial(f,c,d,e);case sb.FREE_FORM_MESH:case sb.LATTICE_FORM_MESH:case sb.COONS_PATCH_MESH:case sb.TENSOR_PATCH_MESH:return new ub.Mesh(a,c,d,e);default:throw new Error("Unsupported ShadingType: "+g)}}catch(h){if(h instanceof ja)throw h;return aa.notify(_.shadingPattern),b(h),new ub.Dummy}},a}(),ub={};ub.SMALL_NUMBER=.01,ub.RadialAxial=function(){function d(c,d,e,f){this.matrix=d,this.coordsArr=c.get("Coords"),this.shadingType=c.get("ShadingType"),this.type="Pattern";var g=c.get("ColorSpace","CS");g=Xa.parse(g,e,f),this.cs=g;var h=0,i=1;if(c.has("Domain")){var j=c.get("Domain");h=j[0],i=j[1]}var k=!1,l=!1;if(c.has("Extend")){var m=c.get("Extend");k=m[0],l=m[1]}if(!(this.shadingType!==sb.RADIAL||k&&l)){var n=this.coordsArr[0],o=this.coordsArr[1],p=this.coordsArr[2],q=this.coordsArr[3],r=this.coordsArr[4],s=this.coordsArr[5],t=Math.sqrt((n-q)*(n-q)+(o-r)*(o-r));s+t>=p&&p+t>=s&&b("Unsupported radial gradient.")}this.extendStart=k,this.extendEnd=l;var u=c.get("Function"),v=Ta.parseArray(e,u),w=i-h,x=w/10,y=this.colorStops=[];if(h>=i||0>=x)return void a("Bad shading domain.");for(var z,A=new Float32Array(g.numComps),B=new Float32Array(1),C=h;i>=C;C+=x){B[0]=C,v(B,0,A,0),z=g.getRgb(A,0);var D=na.makeCssRgb(z[0],z[1],z[2]);y.push([(C-h)/w,D])}var E="transparent";c.has("Background")&&(z=g.getRgb(c.get("Background"),0),E=na.makeCssRgb(z[0],z[1],z[2])),k||(y.unshift([0,E]),y[1][0]+=ub.SMALL_NUMBER),l||(y[y.length-1][0]-=ub.SMALL_NUMBER,y.push([1,E])),this.colorStops=y}return d.prototype={getIR:function(){var a,b,d,e,f,g=this.coordsArr,h=this.shadingType;h===sb.AXIAL?(b=[g[0],g[1]],d=[g[2],g[3]],e=null,f=null,a="axial"):h===sb.RADIAL?(b=[g[0],g[1]],d=[g[3],g[4]],e=g[2],f=g[5],a="radial"):c("getPattern type unknown: "+h);var i=this.matrix;return i&&(b=na.applyTransform(b,i),d=na.applyTransform(d,i)),["RadialAxial",a,this.colorStops,b,d,e,f]}},d}(),ub.Mesh=function(){function a(a,b){this.stream=a,this.context=b,this.buffer=0,this.bufferLength=0;var c=b.numComps;this.tmpCompsBuf=new Float32Array(c);var d=b.colorSpace.numComps;this.tmpCsCompsBuf=b.colorFn?new Float32Array(d):this.tmpCompsBuf}function b(a,b){for(var c=a.coords,d=a.colors,f=[],g=[],h=0;b.hasData;){var i=b.readFlag(),j=b.readCoordinate(),k=b.readComponents();if(0===h){switch(e(i>=0&&2>=i,"Unknown type4 flag"),i){case 0:h=3;break;case 1:g.push(g[g.length-2],g[g.length-1]),h=1;break;case 2:g.push(g[g.length-3],g[g.length-1]),h=1}f.push(i)}g.push(c.length),c.push(j),d.push(k),h--,b.align()}a.figures.push({type:"triangles",coords:new Int32Array(g),colors:new Int32Array(g)})}function d(a,b,c){for(var d=a.coords,e=a.colors,f=[];b.hasData;){var g=b.readCoordinate(),h=b.readComponents();f.push(d.length),d.push(g),e.push(h)}a.figures.push({type:"lattice",coords:new Int32Array(f),colors:new Int32Array(f),verticesPerRow:c})}function f(a,b){var c=a.figures[b];e("patch"===c.type,"Unexpected patch mesh figure");var d=a.coords,f=a.colors,g=c.coords,h=c.colors,i=Math.min(d[g[0]][0],d[g[3]][0],d[g[12]][0],d[g[15]][0]),j=Math.min(d[g[0]][1],d[g[3]][1],d[g[12]][1],d[g[15]][1]),k=Math.max(d[g[0]][0],d[g[3]][0],d[g[12]][0],d[g[15]][0]),p=Math.max(d[g[0]][1],d[g[3]][1],d[g[12]][1],d[g[15]][1]),q=Math.ceil((k-i)*n/(a.bounds[2]-a.bounds[0]));q=Math.max(l,Math.min(m,q));var r=Math.ceil((p-j)*n/(a.bounds[3]-a.bounds[1]));r=Math.max(l,Math.min(m,r));for(var s=q+1,t=new Int32Array((r+1)*s),u=new Int32Array((r+1)*s),v=0,w=new Uint8Array(3),x=new Uint8Array(3),y=f[h[0]],z=f[h[1]],A=f[h[2]],B=f[h[3]],C=o(r),D=o(q),E=0;r>=E;E++){w[0]=(y[0]*(r-E)+A[0]*E)/r|0,w[1]=(y[1]*(r-E)+A[1]*E)/r|0,w[2]=(y[2]*(r-E)+A[2]*E)/r|0,x[0]=(z[0]*(r-E)+B[0]*E)/r|0,x[1]=(z[1]*(r-E)+B[1]*E)/r|0,x[2]=(z[2]*(r-E)+B[2]*E)/r|0;for(var F=0;q>=F;F++,v++)if(0!==E&&E!==r||0!==F&&F!==q){for(var G=0,H=0,I=0,J=0;3>=J;J++)for(var K=0;3>=K;K++,I++){var L=C[E][J]*D[F][K];G+=d[g[I]][0]*L,H+=d[g[I]][1]*L}t[v]=d.length,d.push([G,H]),u[v]=f.length;var M=new Uint8Array(3);M[0]=(w[0]*(q-F)+x[0]*F)/q|0,M[1]=(w[1]*(q-F)+x[1]*F)/q|0,M[2]=(w[2]*(q-F)+x[2]*F)/q|0,f.push(M)}}t[0]=g[0],u[0]=h[0],t[q]=g[3],u[q]=h[1],t[s*r]=g[12],u[s*r]=h[2],t[s*r+q]=g[15],u[s*r+q]=h[3],a.figures[b]={type:"lattice",coords:t,colors:u,verticesPerRow:s}}function g(a,b){for(var c=a.coords,d=a.colors,f=new Int32Array(16),g=new Int32Array(4);b.hasData;){var h=b.readFlag();e(h>=0&&3>=h,"Unknown type6 flag");var i,j,k=c.length;for(i=0,j=0!==h?8:12;j>i;i++)c.push(b.readCoordinate());var l=d.length;for(i=0,j=0!==h?2:4;j>i;i++)d.push(b.readComponents());var m,n,o,p;switch(h){case 0:f[12]=k+3,f[13]=k+4,f[14]=k+5,f[15]=k+6,f[8]=k+2,f[11]=k+7,f[4]=k+1,f[7]=k+8,f[0]=k,f[1]=k+11,f[2]=k+10,f[3]=k+9,g[2]=l+1,g[3]=l+2,g[0]=l,g[1]=l+3;break;case 1:m=f[12],n=f[13],o=f[14],p=f[15],f[12]=p,f[13]=k+0,f[14]=k+1,f[15]=k+2,f[8]=o,f[11]=k+3,f[4]=n,f[7]=k+4,f[0]=m,f[1]=k+7,f[2]=k+6,f[3]=k+5,m=g[2],n=g[3],g[2]=n,g[3]=l,g[0]=m,g[1]=l+1;break;case 2:m=f[15],n=f[11],f[12]=f[3],f[13]=k+0,f[14]=k+1,f[15]=k+2,f[8]=f[7],f[11]=k+3,f[4]=n,f[7]=k+4,f[0]=m,f[1]=k+7,f[2]=k+6,f[3]=k+5,m=g[3],g[2]=g[1],g[3]=l,g[0]=m,g[1]=l+1;break;case 3:f[12]=f[0],f[13]=k+0,f[14]=k+1,f[15]=k+2,f[8]=f[1],f[11]=k+3,f[4]=f[2],f[7]=k+4,f[0]=f[3],f[1]=k+7,f[2]=k+6,f[3]=k+5,g[2]=g[0],g[3]=l,g[0]=g[1],g[1]=l+1}f[5]=c.length,c.push([(-4*c[f[0]][0]-c[f[15]][0]+6*(c[f[4]][0]+c[f[1]][0])-2*(c[f[12]][0]+c[f[3]][0])+3*(c[f[13]][0]+c[f[7]][0]))/9,(-4*c[f[0]][1]-c[f[15]][1]+6*(c[f[4]][1]+c[f[1]][1])-2*(c[f[12]][1]+c[f[3]][1])+3*(c[f[13]][1]+c[f[7]][1]))/9]),f[6]=c.length,c.push([(-4*c[f[3]][0]-c[f[12]][0]+6*(c[f[2]][0]+c[f[7]][0])-2*(c[f[0]][0]+c[f[15]][0])+3*(c[f[4]][0]+c[f[14]][0]))/9,(-4*c[f[3]][1]-c[f[12]][1]+6*(c[f[2]][1]+c[f[7]][1])-2*(c[f[0]][1]+c[f[15]][1])+3*(c[f[4]][1]+c[f[14]][1]))/9]),f[9]=c.length,c.push([(-4*c[f[12]][0]-c[f[3]][0]+6*(c[f[8]][0]+c[f[13]][0])-2*(c[f[0]][0]+c[f[15]][0])+3*(c[f[11]][0]+c[f[1]][0]))/9,(-4*c[f[12]][1]-c[f[3]][1]+6*(c[f[8]][1]+c[f[13]][1])-2*(c[f[0]][1]+c[f[15]][1])+3*(c[f[11]][1]+c[f[1]][1]))/9]),f[10]=c.length,c.push([(-4*c[f[15]][0]-c[f[0]][0]+6*(c[f[11]][0]+c[f[14]][0])-2*(c[f[12]][0]+c[f[3]][0])+3*(c[f[2]][0]+c[f[8]][0]))/9,(-4*c[f[15]][1]-c[f[0]][1]+6*(c[f[11]][1]+c[f[14]][1])-2*(c[f[12]][1]+c[f[3]][1])+3*(c[f[2]][1]+c[f[8]][1]))/9]),a.figures.push({type:"patch",coords:new Int32Array(f),colors:new Int32Array(g)})}}function h(a,b){for(var c=a.coords,d=a.colors,f=new Int32Array(16),g=new Int32Array(4);b.hasData;){var h=b.readFlag();e(h>=0&&3>=h,"Unknown type7 flag");var i,j,k=c.length;for(i=0,j=0!==h?12:16;j>i;i++)c.push(b.readCoordinate());var l=d.length;for(i=0,j=0!==h?2:4;j>i;i++)d.push(b.readComponents());var m,n,o,p;switch(h){case 0:f[12]=k+3,f[13]=k+4,f[14]=k+5,f[15]=k+6,f[8]=k+2,f[9]=k+13,f[10]=k+14,f[11]=k+7,f[4]=k+1,f[5]=k+12,f[6]=k+15,f[7]=k+8,f[0]=k,f[1]=k+11,f[2]=k+10,f[3]=k+9,g[2]=l+1,g[3]=l+2,g[0]=l,g[1]=l+3;break;case 1:m=f[12],n=f[13],o=f[14],p=f[15],f[12]=p,f[13]=k+0,f[14]=k+1,f[15]=k+2,f[8]=o,f[9]=k+9,f[10]=k+10,f[11]=k+3,f[4]=n,f[5]=k+8,f[6]=k+11,f[7]=k+4,f[0]=m,f[1]=k+7,f[2]=k+6,f[3]=k+5,m=g[2],n=g[3],g[2]=n,g[3]=l,g[0]=m,g[1]=l+1;break;case 2:m=f[15],n=f[11],f[12]=f[3],f[13]=k+0,f[14]=k+1,f[15]=k+2,f[8]=f[7],f[9]=k+9,f[10]=k+10,f[11]=k+3,f[4]=n,f[5]=k+8,f[6]=k+11,f[7]=k+4,f[0]=m,f[1]=k+7,f[2]=k+6,f[3]=k+5,m=g[3],g[2]=g[1],g[3]=l,g[0]=m,g[1]=l+1;break;case 3:f[12]=f[0],f[13]=k+0,f[14]=k+1,f[15]=k+2,f[8]=f[1],f[9]=k+9,f[10]=k+10,f[11]=k+3,f[4]=f[2],f[5]=k+8,f[6]=k+11,f[7]=k+4,f[0]=f[3],f[1]=k+7,f[2]=k+6,f[3]=k+5,g[2]=g[0],g[3]=l,g[0]=g[1],g[1]=l+1}a.figures.push({type:"patch",coords:new Int32Array(f),colors:new Int32Array(g)})}}function i(a){for(var b=a.coords[0][0],c=a.coords[0][1],d=b,e=c,f=1,g=a.coords.length;g>f;f++){var h=a.coords[f][0],i=a.coords[f][1];b=b>h?h:b,c=c>i?i:c,d=h>d?h:d,e=i>e?i:e}a.bounds=[b,c,d,e]}function j(a){var b,c,d,e,f=a.coords,g=new Float32Array(2*f.length);for(b=0,d=0,c=f.length;c>b;b++){var h=f[b];g[d++]=h[0],g[d++]=h[1]}a.coords=g;var i=a.colors,j=new Uint8Array(3*i.length);for(b=0,d=0,c=i.length;c>b;b++){var k=i[b];j[d++]=k[0],j[d++]=k[1],j[d++]=k[2]}a.colors=j;var l=a.figures;for(b=0,c=l.length;c>b;b++){var m=l[b],n=m.coords,o=m.colors;for(d=0,e=n.length;e>d;d++)n[d]*=2,o[d]*=3}}function k(k,l,m,n){e(D(k),"Mesh data is not a stream");var o=k.dict;this.matrix=l,this.shadingType=o.get("ShadingType"),this.type="Pattern",this.bbox=o.get("BBox");var p=o.get("ColorSpace","CS");p=Xa.parse(p,m,n),this.cs=p,this.background=o.has("Background")?p.getRgb(o.get("Background"),0):null;var q=o.get("Function"),r=q?Ta.parseArray(m,q):null;this.coords=[],this.colors=[],this.figures=[];var s={bitsPerCoordinate:o.get("BitsPerCoordinate"),bitsPerComponent:o.get("BitsPerComponent"),bitsPerFlag:o.get("BitsPerFlag"),decode:o.get("Decode"),colorFn:r,colorSpace:p,numComps:r?1:p.numComps},t=new a(k,s),u=!1;switch(this.shadingType){case sb.FREE_FORM_MESH:b(this,t);break;case sb.LATTICE_FORM_MESH:var v=0|o.get("VerticesPerRow");e(v>=2,"Invalid VerticesPerRow"),d(this,t,v);break;case sb.COONS_PATCH_MESH:g(this,t),u=!0;break;case sb.TENSOR_PATCH_MESH:h(this,t),u=!0;break;default:c("Unsupported mesh type.")}if(u){i(this);for(var w=0,x=this.figures.length;x>w;w++)f(this,w)}i(this),j(this)}a.prototype={get hasData(){if(this.stream.end)return this.stream.pos0)return!0;var a=this.stream.getByte();return 0>a?!1:(this.buffer=a,this.bufferLength=8,!0)},readBits:function(a){var b=this.buffer,c=this.bufferLength;if(32===a){if(0===c)return(this.stream.getByte()<<24|this.stream.getByte()<<16|this.stream.getByte()<<8|this.stream.getByte())>>>0;b=b<<24|this.stream.getByte()<<16|this.stream.getByte()<<8|this.stream.getByte();var d=this.stream.getByte();return this.buffer=d&(1<>c)>>>0}if(8===a&&0===c)return this.stream.getByte();for(;a>c;)b=b<<8|this.stream.getByte(),c+=8;return c-=a,this.bufferLength=c,this.buffer=b&(1<>c},align:function(){this.buffer=0,this.bufferLength=0},readFlag:function(){return this.readBits(this.context.bitsPerFlag)},readCoordinate:function(){var a=this.context.bitsPerCoordinate,b=this.readBits(a),c=this.readBits(a),d=this.context.decode,e=32>a?1/((1<b?1/((1<f;f++,g+=2){var h=this.readBits(b);e[f]=h*c*(d[g+1]-d[g])+d[g]}var i=this.tmpCsCompsBuf;return this.context.colorFn&&this.context.colorFn(e,0,i,0),this.context.colorSpace.getRgb(i,0)}};var l=3,m=20,n=20,o=function(){function a(a){for(var b=[],c=0;a>=c;c++){var d=c/a,e=1-d;b.push(new Float32Array([e*e*e,3*d*e*e,3*d*d*e,d*d*d]))}return b}var b=[];return function(c){return b[c]||(b[c]=a(c)),b[c]}}();return k.prototype={getIR:function(){return["Mesh",this.shadingType,this.coords,this.colors,this.figures,this.bounds,this.matrix,this.bbox,this.background]}},k}(),ub.Dummy=function(){function a(){this.type="Pattern"}return a.prototype={getIR:function(){return["Dummy"]}},a}();var vb=function(){function d(a,b,c,d,e,f,g){this.pdfManager=a,this.xref=b,this.handler=c,this.pageIndex=d,this.uniquePrefix=e,this.idCounters=f,this.fontCache=g}function f(){this.reset()}var g=20,h=100;f.prototype={check:function(){return++this.checkedPDFJS.maxImageSize)return void b("Image exceeded maximum allowed size and was removed.");var l,m,n=i.get("ImageMask","IM")||!1;if(n){var o=i.get("Width","W"),p=i.get("Height","H"),q=o+7>>3,r=c.getBytes(q*p),s=i.get("Decode","D"),t=!!s&&s[0]>0; +return l=Bc.createMask(r,o,p,c instanceof Oc,t),l.cached=!0,m=[l],e.addOp($.paintImageMaskXObject,m),void(f&&(g[f]={fn:$.paintImageMaskXObject,args:m}))}var u=i.get("SMask","SM")||!1,v=i.get("Mask")||!1,w=200;if(d&&!u&&!v&&!(c instanceof Sc)&&w>j+k){var y=new Bc(this.xref,a,c,d,null,null);return l=y.createImageData(!0),void e.addOp($.paintInlineImageXObject,[l])}var z=this.uniquePrefix||"",A="img_"+z+ ++this.idCounters.obj;return e.addDependency(A),m=[A,j,k],!u&&!v&&c instanceof Sc&&c.isNativelySupported(this.xref,a)?(e.addOp($.paintJpegXObject,m),void this.handler.send("obj",[A,this.pageIndex,"JpegStream",c.getIR()])):(Bc.buildImage(h.handler,h.xref,a,c,d).then(function(a){var b=a.createImageData(!1);h.handler.send("obj",[A,h.pageIndex,"Image",b],[b.data.buffer])}).then(void 0,function(a){b("Unable to decode image: "+a),h.handler.send("obj",[A,h.pageIndex,"Image",null])}),e.addOp($.paintImageXObject,m),void(f&&(g[f]={fn:$.paintImageXObject,args:m})))},handleSMask:function(a,b,c,d,e){var f=a.get("G"),g={subtype:a.get("S").name,backdrop:a.get("BC")};return this.buildFormXObject(b,f,g,c,d,e.state.clone())},handleTilingType:function(a,b,c,d,e,f,g){var h=new xb,i=[e.get("Resources"),c],j=Aa.merge(this.xref,i);return this.getOperatorList(d,g,j,h).then(function(){f.addDependencies(h.dependencies),f.addOp(a,J({fnArray:h.fnArray,argsArray:h.argsArray},e,b))})},handleSetFont:function(a,b,c,d,e,f){var g;b&&(b=b.slice(),g=b[0].name);var h=this;return this.loadFont(g,c,this.xref,a).then(function(b){return b.font.isType3Font?b.loadType3Data(h,a,d,e).then(function(){return b}):b}).then(function(a){return f.font=a.font,a.send(h.handler),a.loadedName})},handleText:function(a,b){var c=b.font,d=c.charsToGlyphs(a),e=!!(b.textRenderingMode&U.ADD_TO_PATH_FLAG);if(c.data&&(e||PDFJS.disableFontFace))for(var f=function(a){if(!c.renderer.hasBuiltPath(a)){var b=c.renderer.getPathJs(a);this.handler.send("commonobj",[c.loadedName+"_path_"+a,"FontPath",b])}}.bind(this),g=0,h=d.length;h>g;g++){var i=d[g];if(null!==i){f(i.fontChar);var j=i.accent;j&&j.fontChar&&f(j.fontChar)}}return d},setGState:function(c,d,e,f,g,h){var i=[],j=d.map,k=this,l=Promise.resolve();for(var m in j){var n=j[m];switch(m){case"Type":break;case"LW":case"LC":case"LJ":case"ML":case"D":case"RI":case"FL":case"CA":case"ca":i.push([m,n]);break;case"Font":l=l.then(function(){return k.handleSetFont(c,null,n[0],e,f,h.state).then(function(a){e.addDependency(a),i.push([m,[a,n[1]]])})});break;case"BM":i.push([m,n]);break;case"SMask":if(z(n)&&"None"===n.name){i.push([m,!1]);break}var o=g.fetchIfRef(n);B(o)?(l=l.then(function(){return k.handleSMask(o,c,e,f,h)}),i.push([m,!0])):b("Unsupported SMask type");break;case"OP":case"op":case"OPM":case"BG":case"BG2":case"UCR":case"UCR2":case"TR":case"TR2":case"HT":case"SM":case"SA":case"AIS":case"TK":a("graphic state operator "+m);break;default:a("Unknown graphic state operator "+m)}}return l.then(function(){i.length>=0&&e.addOp($.setGState,[i])})},loadFont:function(a,c,d,f){function g(){return Promise.resolve(new wb("g_font_error",new ec("Font "+a+" is not available"),c))}var h;if(c)e(F(c)),h=c;else{var i=f.get("Font");if(!i)return b("fontRes not available"),g();h=i.getRaw(a)}if(!h)return b("fontRef not available"),g();if(this.fontCache.has(h))return this.fontCache.get(h);if(c=d.fetchIfRef(h),!B(c))return g();if(c.translated)return c.translated;var j=G(),k=this.preEvaluateFont(c,d),l=k.descriptor,m=h.num+"_"+h.gen;if(B(l)){l.fontAliases||(l.fontAliases=Object.create(null));var n=l.fontAliases,o=k.hash;if(n[o]){var p=n[o].aliasRef;if(p&&this.fontCache.has(p))return this.fontCache.putAlias(h,p),this.fontCache.get(h)}n[o]||(n[o]={fontID:dc.getFontID()}),n[o].aliasRef=h,m=n[o].fontID}var q=B(h);q||this.fontCache.put(h,j.promise),c.loadedName="g_font_"+(q?a.replace(/\W/g,""):m),c.translated=j.promise;var r;try{r=Promise.resolve(this.translateFont(k,d))}catch(s){r=Promise.reject(s)}return r.then(function(a){if(void 0!==a.fontType){var b=d.stats.fontTypes;b[a.fontType]=!0}j.resolve(new wb(c.loadedName,a,c))},function(a){aa.notify(_.font);try{var b=k.descriptor,e=b&&b.get("FontFile3"),f=e&&e.get("Subtype"),g=P(k.type,f&&f.name),h=d.stats.fontTypes;h[g]=!0}catch(i){}j.resolve(new wb(c.loadedName,new ec(a instanceof Error?a.message:a),c))}),j.promise},buildPath:function(a,b,c){var d=a.length-1;if(c||(c=[]),0>d||a.fnArray[d]!==$.constructPath)a.addOp($.constructPath,[[b],c]);else{var e=a.argsArray[d];e[0].push(b),Array.prototype.push.apply(e[1],c)}},handleColorN:function(a,b,c,d,e,f,g,h){var i,l=c[c.length-1];if(z(l)&&(i=e.get(l.name))){var m=D(i)?i.dict:i,n=m.get("PatternType");if(n===j){var o=d.base?d.base.getRgb(c,0):null;return this.handleTilingType(b,o,f,i,m,a,g)}if(n===k){var p=m.get("Shading"),q=m.get("Matrix");return i=tb.parseShading(p,q,h,f),a.addOp(b,i.getIR()),Promise.resolve()}return Promise.reject("Unknown PatternType: "+n)}return a.addOp(b,c),Promise.resolve()},getOperatorList:function(d,g,h,j,k){var l=this,m=this.xref,n={};e(j),h=h||Aa.empty;var o=h.get("XObject")||Aa.empty,p=h.get("Pattern")||Aa.empty,q=new yb(k||new Ab),r=new Bb(d,m,q),s=new f;return new Promise(function t(d,f){g.ensureNotTerminated(),s.reset();for(var k,u,v,w,A={};!(k=s.check())&&(A.args=null,r.read(A));){var C=A.args,E=A.fn;switch(0|E){case $.paintXObject:if(C[0].code)break;var F=C[0].name;if(!F){b("XObject must be referred to by name.");continue}if(void 0!==n[F]){j.addOp(n[F].fn,n[F].args),C=null;continue}var G=o.get(F);if(G){e(D(G),"XObject should be a stream");var H=G.dict.get("Subtype");if(e(z(H),"XObject should have a Name subtype"),"Form"===H.name)return q.save(),l.buildFormXObject(h,G,null,j,g,q.state.clone()).then(function(){q.restore(),t(d,f)},f);if("Image"===H.name){l.buildPaintImageXObject(h,G,!1,j,F,n),C=null;continue}if("PS"===H.name){a("Ignored XObject subtype PS");continue}c("Unhandled XObject subtype "+H.name)}break;case $.setFont:var I=C[1];return l.handleSetFont(h,C,null,j,g,q.state).then(function(a){j.addDependency(a),j.addOp($.setFont,[a,I]),t(d,f)},f);case $.endInlineImage:var J=C[0].cacheKey;if(J){var K=n[J];if(void 0!==K){j.addOp(K.fn,K.args),C=null;continue}}l.buildPaintImageXObject(h,C[0],!0,j,J,n),C=null;continue;case $.showText:C[0]=l.handleText(C[0],q.state);break;case $.showSpacedText:var L=C[0],M=[],N=L.length,O=q.state;for(u=0;N>u;++u){var P=L[u];y(P)?Array.prototype.push.apply(M,l.handleText(P,O)):x(P)&&M.push(P)}C[0]=M,E=$.showText;break;case $.nextLineShowText:j.addOp($.nextLine),C[0]=l.handleText(C[0],q.state),E=$.showText;break;case $.nextLineSetSpacingShowText:j.addOp($.nextLine),j.addOp($.setWordSpacing,[C.shift()]),j.addOp($.setCharSpacing,[C.shift()]),C[0]=l.handleText(C[0],q.state),E=$.showText;break;case $.setTextRenderingMode:q.state.textRenderingMode=C[0];break;case $.setFillColorSpace:q.state.fillColorSpace=Xa.parse(C[0],m,h);continue;case $.setStrokeColorSpace:q.state.strokeColorSpace=Xa.parse(C[0],m,h);continue;case $.setFillColor:w=q.state.fillColorSpace,C=w.getRgb(C,0),E=$.setFillRGBColor;break;case $.setStrokeColor:w=q.state.strokeColorSpace,C=w.getRgb(C,0),E=$.setStrokeRGBColor;break;case $.setFillGray:q.state.fillColorSpace=Xa.singletons.gray,C=Xa.singletons.gray.getRgb(C,0),E=$.setFillRGBColor;break;case $.setStrokeGray:q.state.strokeColorSpace=Xa.singletons.gray,C=Xa.singletons.gray.getRgb(C,0),E=$.setStrokeRGBColor;break;case $.setFillCMYKColor:q.state.fillColorSpace=Xa.singletons.cmyk,C=Xa.singletons.cmyk.getRgb(C,0),E=$.setFillRGBColor;break;case $.setStrokeCMYKColor:q.state.strokeColorSpace=Xa.singletons.cmyk,C=Xa.singletons.cmyk.getRgb(C,0),E=$.setStrokeRGBColor;break;case $.setFillRGBColor:q.state.fillColorSpace=Xa.singletons.rgb,C=Xa.singletons.rgb.getRgb(C,0);break;case $.setStrokeRGBColor:q.state.strokeColorSpace=Xa.singletons.rgb,C=Xa.singletons.rgb.getRgb(C,0);break;case $.setFillColorN:if(w=q.state.fillColorSpace,"Pattern"===w.name)return l.handleColorN(j,$.setFillColorN,C,w,p,h,g,m).then(function(){t(d,f)},f);C=w.getRgb(C,0),E=$.setFillRGBColor;break;case $.setStrokeColorN:if(w=q.state.strokeColorSpace,"Pattern"===w.name)return l.handleColorN(j,$.setStrokeColorN,C,w,p,h,g,m).then(function(){t(d,f)},f);C=w.getRgb(C,0),E=$.setStrokeRGBColor;break;case $.shadingFill:var Q=h.get("Shading");Q||c("No shading resource found");var R=Q.get(C[0].name);R||c("No shading object found");var S=tb.parseShading(R,null,m,h),T=S.getIR();C=[T],E=$.shadingFill;break;case $.setGState:var U=C[0],V=h.get("ExtGState");if(!B(V)||!V.has(U.name))break;var W=V.get(U.name);return l.setGState(h,W,j,g,m,q).then(function(){t(d,f)},f);case $.moveTo:case $.lineTo:case $.curveTo:case $.curveTo2:case $.curveTo3:case $.closePath:l.buildPath(j,E,C);continue;case $.rectangle:l.buildPath(j,E,C);continue;case $.markPoint:case $.markPointProps:case $.beginMarkedContent:case $.beginMarkedContentProps:case $.endMarkedContent:case $.beginCompat:case $.endCompat:continue}j.addOp(E,C)}if(k)return void i.then(function(){t(d,f)},f);for(u=0,v=r.savedStatesDepth;v>u;u++)j.addOp($.restore,[]);d()})},getTextContent:function(a,b,c,d){function g(){var a=r.font;return a.loadedName in l.styles||(l.styles[a.loadedName]={fontFamily:a.fallbackName,ascent:a.ascent,descent:a.descent,vertical:a.vertical}),{str:[],dir:null,width:0,height:0,transform:null,fontName:a.loadedName}}function h(a){var b=a.str.join(""),c=PDFJS.bidi(b,-1,r.font.vertical);return a.str=c.str,a.dir=c.dir,a}function j(a,b){return p.loadFont(a,b,q,c).then(function(a){r.font=a.font,r.fontMatrix=a.font.fontMatrix||T})}function k(a,b){var c=r.font;if(b=b||g(),!b.transform){var d=[r.fontSize*r.textHScale,0,0,r.fontSize,0,r.textRise];if(c.isType3Font&&r.fontMatrix!==T&&1===r.fontSize){var e=c.bbox[3]-c.bbox[1];e>0&&(e*=r.fontMatrix[3],d[3]*=e)}var f=b.transform=na.transform(r.ctm,na.transform(r.textMatrix,d));c.vertical?b.width=Math.sqrt(f[0]*f[0]+f[1]*f[1]):b.height=Math.sqrt(f[2]*f[2]+f[3]*f[3])}for(var h=0,i=0,j=c.charsToGlyphs(a),k=c.defaultVMetrics,l=0;l0&&(s=r.charSpacing);var t=0,u=0;if(c.vertical){var v=p*r.fontMatrix[0];u=v*r.fontSize+s,i+=u}else{var w=p*r.fontMatrix[0];t=(w*r.fontSize+s)*r.textHScale,h+=t}r.translateTextMatrix(t,u),b.str.push(q)}else h+=r.wordSpacing*r.textHScale}var x=r.textLineMatrix[0],y=r.textLineMatrix[1],z=Math.sqrt(x*x+y*y);x=r.ctm[0],y=r.ctm[1];var A=Math.sqrt(x*x+y*y);return c.vertical?b.height+=Math.abs(i*A*z):b.width+=h*A*z,b}d=d||new yb(new zb);var l={items:[],styles:Object.create(null)},m=l.items,n=.3,o=1.5,p=this,q=this.xref;c=q.fetchIfRef(c)||Aa.empty;var r,s=null,t={},u=new Bb(a,q,d),v=new f;return new Promise(function w(a,f){b.ensureNotTerminated(),v.reset();for(var q,x={},y=[];!(q=v.check())&&(y.length=0,x.args=y,u.read(x));){r=d.state;var A=x.fn;switch(y=x.args,0|A){case $.setFont:return r.fontSize=y[1],j(y[0].name).then(function(){w(a,f)},f);case $.setTextRise:r.textRise=y[0];break;case $.setHScale:r.textHScale=y[0]/100;break;case $.setLeading:r.leading=y[0];break;case $.moveText:r.translateTextLineMatrix(y[0],y[1]),r.textMatrix=r.textLineMatrix.slice();break;case $.setLeadingMoveText:r.leading=-y[1],r.translateTextLineMatrix(y[0],y[1]),r.textMatrix=r.textLineMatrix.slice();break;case $.nextLine:r.carriageReturn();break;case $.setTextMatrix:r.setTextMatrix(y[0],y[1],y[2],y[3],y[4],y[5]),r.setTextLineMatrix(y[0],y[1],y[2],y[3],y[4],y[5]);break;case $.setCharSpacing:r.charSpacing=y[0];break;case $.setWordSpacing:r.wordSpacing=y[0];break;case $.beginText:r.textMatrix=ma.slice(),r.textLineMatrix=ma.slice();break;case $.showSpacedText:for(var E,F=y[0],G=g(),H=0,I=F.length;I>H;H++)if("string"==typeof F[H])k(F[H],G);else{var J=F[H]*r.fontSize/1e3;if(r.font.vertical?(E=J*r.textMatrix[3],r.translateTextMatrix(0,E),G.height+=E):(E=J*r.textHScale*r.textMatrix[0],r.translateTextMatrix(E,0),G.width-=E),F[H]<0&&r.font.spaceWidth>0){var K=-F[H]/r.font.spaceWidth;if(K>o)for(K=Math.round(K);K--;)G.str.push(" ");else K>n&&G.str.push(" ")}}m.push(h(G));break;case $.showText:m.push(h(k(y[0])));break;case $.nextLineShowText:r.carriageReturn(),m.push(h(k(y[0])));break;case $.nextLineSetSpacingShowText:r.wordSpacing=y[0],r.charSpacing=y[1],r.carriageReturn(),m.push(h(k(y[2])));break;case $.paintXObject:if(y[0].code)break;s||(s=c.get("XObject")||Aa.empty);var L=y[0].name;if(t.key===L){t.texts&&(na.appendToArray(m,t.texts.items),na.extendObj(l.styles,t.texts.styles));break}var M=s.get(L);if(!M)break;e(D(M),"XObject should be a stream");var N=M.dict.get("Subtype");if(e(z(N),"XObject should have a Name subtype"),"Form"!==N.name){t.key=L,t.texts=null;break}d.save();var O=M.dict.get("Matrix");return C(O)&&6===O.length&&d.transform(O),p.getTextContent(M,b,M.dict.get("Resources")||c,d).then(function(b){na.appendToArray(m,b.items),na.extendObj(l.styles,b.styles),d.restore(),t.key=L,t.texts=b,w(a,f)},f);case $.setGState:var P=y[0],Q=c.get("ExtGState");if(!B(Q)||!Q.has(P.name))break;var R=Q.get(P.name),S=null;for(var T in R)"Font"===T&&(e(!S),S=R[T]);if(S)return r.fontSize=S[1],j(S[0]).then(function(){w(a,f)},f)}}return q?void i.then(function(){w(a,f)},f):void a(l)})},extractDataStructures:function(a,b,d,e){var f=a.get("ToUnicode")||b.get("ToUnicode");if(f&&(e.toUnicode=this.readToUnicode(f)),e.composite){var g=a.get("CIDSystemInfo");B(g)&&(e.cidSystemInfo={registry:g.get("Registry"),ordering:g.get("Ordering"),supplement:g.get("Supplement")});var h=a.get("CIDToGIDMap");D(h)&&(e.cidToGidMap=this.readCidToGidMap(h))}var i,j=[],k=null;if(a.has("Encoding")){if(i=a.get("Encoding"),B(i)){if(k=i.get("BaseEncoding"),k=z(k)?k.name:null,i.has("Differences"))for(var l=i.get("Differences"),m=0,n=0,o=l.length;o>n;n++){var p=l[n];if(x(p))m=p;else if(z(p))j[m++]=p.name;else{if(F(p)){l[n--]=d.fetch(p);continue}c("Invalid entry in 'Differences' array: "+p)}}}else z(i)?k=i.name:c("Encoding is not a Name nor a Dict");"MacRomanEncoding"!==k&&"MacExpertEncoding"!==k&&"WinAnsiEncoding"!==k&&(k=null)}k?e.defaultEncoding=Pb[k].slice():(i="TrueType"===e.type?Pb.WinAnsiEncoding:Pb.StandardEncoding,e.flags&Ob.Symbolic&&(i=Pb.MacRomanEncoding,e.file||(/Symbol/i.test(e.name)?i=Pb.SymbolSetEncoding:/Dingbats/i.test(e.name)&&(i=Pb.ZapfDingbatsEncoding))),e.defaultEncoding=i),e.differences=j,e.baseEncodingName=k,e.dict=a},readToUnicode:function(a){var b,c=a;if(z(c))return b=Hb.create(c,{url:PDFJS.cMapUrl,packed:PDFJS.cMapPacked},null),b instanceof Fb?new ac(0,65535):new _b(b.getMap());if(D(c)){if(b=Hb.create(c,{url:PDFJS.cMapUrl,packed:PDFJS.cMapPacked},null),b instanceof Fb)return new ac(0,65535);var d=new Array(b.length);return b.forEach(function(a,b){for(var c=[],e=0;ed;d++){var f=b[d++]<<8|b[d];if(0!==f){var g=d>>1;c[g]=f}}return c},extractWidths:function(a,b,c,d){var e,f,g,h,i,j,k,l,m=[],n=0,o=[];if(d.composite){if(n=a.get("DW")||1e3,l=a.get("W"))for(f=0,g=l.length;g>f;f++)if(j=l[f++],k=b.fetchIfRef(l[f]),C(k))for(h=0,i=k.length;i>h;h++)m[j++]=k[h];else{var p=l[++f];for(h=j;k>=h;h++)m[h]=p}if(d.vertical){var q=a.get("DW2")||[880,-1e3];if(e=[q[1],.5*n,q[0]],q=a.get("W2"))for(f=0,g=q.length;g>f;f++)if(j=q[f++],k=b.fetchIfRef(q[f]),C(k))for(h=0,i=k.length;i>h;h++)o[j++]=[k[h++],k[h++],k[h]];else{var r=[q[++f],q[++f],q[++f]];for(h=j;k>=h;h++)o[h]=r}}}else{var s=d.firstChar;if(l=a.get("Widths")){for(h=s,f=0,g=l.length;g>f;f++)m[h++]=l[f];n=parseFloat(c.get("MissingWidth"))||0}else{var t=a.get("BaseFont");if(z(t)){var u=this.getBaseFontMetrics(t.name);m=this.buildCharCodeToWidth(u.widths,d),n=u.defaultWidth}}}var v=!0,w=n;for(var x in m){var y=m[x];if(y)if(w){if(w!==y){v=!1;break}}else w=y}v&&(d.flags|=Ob.FixedPitch),d.defaultWidth=n,d.widths=m,d.defaultVMetrics=e,d.vmetrics=o},isSerifFont:function(a){var b=a.split("-")[0];return b in Sb||-1!==b.search(/serif/gi)},getBaseFontMetrics:function(a){var b=0,c=[],d=!1,e=Qb[a]||a;e in Cc||(e=this.isSerifFont(a)?"Times-Roman":"Helvetica");var f=Cc[e];return x(f)?(b=f,d=!0):c=f,{defaultWidth:b,monospace:d,widths:c}},buildCharCodeToWidth:function(a,b){for(var c=Object.create(null),d=b.differences,e=b.defaultEncoding,f=0;256>f;f++)f in d&&a[d[f]]?c[f]=a[d[f]]:f in e&&a[e[f]]&&(c[f]=a[e[f]]);return c},preEvaluateFont:function(a,b){var d=a,f=a.get("Subtype");e(z(f),"invalid font Subtype");var g,h=!1;if("Type0"===f.name){var i=a.get("DescendantFonts");i||c("Descendant fonts are not specified"),a=C(i)?b.fetchIfRef(i[0]):i,f=a.get("Subtype"),e(z(f),"invalid font Subtype"),h=!0}var j=a.get("FontDescriptor");if(j){var k=new jd,l=d.getRaw("Encoding");if(z(l))k.update(l.name);else if(F(l))k.update(l.num+"_"+l.gen);else if(B(l))for(var m=l.getKeys(),n=0,o=m.length;o>n;n++){var p=l.getRaw(m[n]);z(p)?k.update(p.name):F(p)?k.update(p.num+"_"+p.gen):C(p)&&k.update(p.length.toString())}var q=a.get("ToUnicode")||d.get("ToUnicode");if(D(q)){var r=q.str||q;g=r.buffer?new Uint8Array(r.buffer.buffer,0,r.bufferLength):new Uint8Array(r.bytes.buffer,r.start,r.end-r.start),k.update(g)}else z(q)&&k.update(q.name);var s=a.get("Widths")||d.get("Widths");s&&(g=new Uint8Array(new Uint32Array(s).buffer),k.update(g))}return{descriptor:j,dict:a,baseDict:d,composite:h,type:f.name,hash:k?k.hexdigest():""}},translateFont:function(b,d){var f,g=b.baseDict,h=b.dict,i=b.composite,j=b.descriptor,k=b.type,l=i?65535:255;if(!j){if("Type3"!==k){var m=h.get("BaseFont");z(m)||c("Base font is not specified"),m=m.name.replace(/[,_]/g,"-");var n=this.getBaseFontMetrics(m),o=m.split("-")[0],p=(this.isSerifFont(o)?Ob.Serif:0)|(n.monospace?Ob.FixedPitch:0)|(Tb[o]?Ob.Symbolic:Ob.Nonsymbolic);return f={type:k,name:m,widths:n.widths,defaultWidth:n.defaultWidth,flags:p,firstChar:0,lastChar:l},this.extractDataStructures(h,h,d,f),f.widths=this.buildCharCodeToWidth(n.widths,f),new dc(m,null,f)}j=new Aa(null),j.set("FontName",ya.get(k)),j.set("FontBBox",h.get("FontBBox"))}var q=h.get("FirstChar")||0,r=h.get("LastChar")||l,s=j.get("FontName"),t=h.get("BaseFont");if(y(s)&&(s=ya.get(s)),y(t)&&(t=ya.get(t)),"Type3"!==k){var u=s&&s.name,v=t&&t.name;u!==v&&(a("The FontDescriptor's FontName is \""+u+'" but should be the same as the Font\'s BaseFont "'+v+'"'),u&&v&&0===v.indexOf(u)&&(s=t))}s=s||t,e(z(s),"invalid font name");var w=j.get("FontFile","FontFile2","FontFile3");if(w&&w.dict){var x=w.dict.get("Subtype");x&&(x=x.name);var A=w.dict.get("Length1"),B=w.dict.get("Length2")}if(f={type:k,name:s.name,subtype:x,file:w,length1:A,length2:B,loadedName:g.loadedName,composite:i,wideChars:i,fixedPitch:!1,fontMatrix:h.get("FontMatrix")||T,firstChar:q||0,lastChar:r||l,bbox:j.get("FontBBox"),ascent:j.get("Ascent"),descent:j.get("Descent"),xHeight:j.get("XHeight"),capHeight:j.get("CapHeight"),flags:j.get("Flags"),italicAngle:j.get("ItalicAngle"),coded:!1},i){var C=g.get("Encoding");z(C)&&(f.cidEncoding=C.name),f.cMap=Hb.create(C,{url:PDFJS.cMapUrl,packed:PDFJS.cMapPacked},null),f.vertical=f.cMap.vertical}return this.extractDataStructures(h,g,d,f),this.extractWidths(h,d,j,f),"Type3"===k&&(f.isType3Font=!0),new dc(s.name,w,f)}},d}(),wb=function(){function a(a,b,c){this.loadedName=a,this.font=b,this.dict=c,this.type3Loaded=null,this.sent=!1}return a.prototype={send:function(a){if(!this.sent){var b=this.font.exportData();a.send("commonobj",[this.loadedName,"Font",b]),this.sent=!0}},loadType3Data:function(a,c,d,f){if(e(this.font.isType3Font),this.type3Loaded)return this.type3Loaded;for(var g=this.font,h=Promise.resolve(),i=this.dict.get("CharProcs").getAll(),j=this.dict.get("Resources")||c,k=Object.keys(i),l={},m=0,n=k.length;n>m;++m)h=h.then(function(c){var e=i[c],g=new xb;return a.getOperatorList(e,f,j,g).then(function(){l[c]=g.getIR(),d.addDependencies(g.dependencies)},function(a){b('Type3 font resource "'+c+'" is not available');var d=new xb;l[c]=d.getIR()})}.bind(this,k[m]));return this.type3Loaded=h.then(function(){g.charProcOperatorList=l}),this.type3Loaded}},a}(),xb=function(){function a(a){for(var b=[],c=a.fnArray,d=a.argsArray,e=0,f=a.length;f>e;e++)switch(c[e]){case $.paintInlineImageXObject:case $.paintInlineImageXObjectGroup:case $.paintImageMaskXObject:var g=d[e][0];g.cached||b.push(g.data.buffer)}return b}function b(a,b,c){this.messageHandler=b,this.fnArray=[],this.argsArray=[],this.dependencies={},this.pageIndex=c,this.intent=a}var c=1e3,d=c-5;return b.prototype={get length(){return this.argsArray.length},addOp:function(a,b){this.fnArray.push(a),this.argsArray.push(b),this.messageHandler&&(this.fnArray.length>=c?this.flush():this.fnArray.length>=d&&(a===$.restore||a===$.endText)&&this.flush())},addDependency:function(a){a in this.dependencies||(this.dependencies[a]=!0,this.addOp($.dependency,[a]))},addDependencies:function(a){for(var b in a)this.addDependency(b)},addOpList:function(a){na.extendObj(this.dependencies,a.dependencies);for(var b=0,c=a.length;c>b;b++)this.addOp(a.fnArray[b],a.argsArray[b])},getIR:function(){return{fnArray:this.fnArray,argsArray:this.argsArray,length:this.length}},flush:function(b){"oplist"!==this.intent&&(new Cb).optimize(this);var c=a(this);this.messageHandler.send("RenderPageChunk",{operatorList:{fnArray:this.fnArray,argsArray:this.argsArray,lastChunk:b,length:this.length},pageIndex:this.pageIndex,intent:this.intent},c),this.dependencies={},this.fnArray.length=0,this.argsArray.length=0}},b}(),yb=function(){function a(a){this.state=a,this.stateStack=[]}return a.prototype={save:function(){var a=this.state;this.stateStack.push(this.state),this.state=a.clone()},restore:function(){var a=this.stateStack.pop();a&&(this.state=a)},transform:function(a){this.state.ctm=na.transform(this.state.ctm,a)}},a}(),zb=function(){function a(){this.ctm=new Float32Array(ma),this.fontSize=0,this.font=null,this.fontMatrix=T,this.textMatrix=ma.slice(),this.textLineMatrix=ma.slice(),this.charSpacing=0,this.wordSpacing=0,this.leading=0,this.textHScale=1,this.textRise=0}return a.prototype={setTextMatrix:function(a,b,c,d,e,f){var g=this.textMatrix;g[0]=a,g[1]=b,g[2]=c,g[3]=d,g[4]=e,g[5]=f},setTextLineMatrix:function(a,b,c,d,e,f){var g=this.textLineMatrix;g[0]=a,g[1]=b,g[2]=c,g[3]=d,g[4]=e,g[5]=f},translateTextMatrix:function(a,b){var c=this.textMatrix;c[4]=c[0]*a+c[2]*b+c[4],c[5]=c[1]*a+c[3]*b+c[5]},translateTextLineMatrix:function(a,b){var c=this.textLineMatrix;c[4]=c[0]*a+c[2]*b+c[4],c[5]=c[1]*a+c[3]*b+c[5]},calcRenderMatrix:function(a){var b=[this.fontSize*this.textHScale,0,0,this.fontSize,0,this.textRise];return na.transform(a,na.transform(this.textMatrix,b))},carriageReturn:function(){this.translateTextLineMatrix(0,-this.leading),this.textMatrix=this.textLineMatrix.slice()},clone:function(){var a=Object.create(this);return a.textMatrix=this.textMatrix.slice(),a.textLineMatrix=this.textLineMatrix.slice(),a.fontMatrix=this.fontMatrix.slice(),a}},a}(),Ab=function(){function a(){this.ctm=new Float32Array(ma),this.font=null,this.textRenderingMode=U.FILL,this.fillColorSpace=Xa.singletons.gray,this.strokeColorSpace=Xa.singletons.gray}return a.prototype={clone:function(){return Object.create(this)}},a}(),Bb=function(){function c(a,b,c){this.parser=new Fc(new Gc(a,d),!1,b),this.stateManager=c,this.nonProcessedArgs=[]}var d={w:{id:$.setLineWidth,numArgs:1,variableArgs:!1},J:{id:$.setLineCap,numArgs:1,variableArgs:!1},j:{id:$.setLineJoin,numArgs:1,variableArgs:!1},M:{id:$.setMiterLimit,numArgs:1,variableArgs:!1},d:{id:$.setDash,numArgs:2,variableArgs:!1},ri:{id:$.setRenderingIntent,numArgs:1,variableArgs:!1},i:{id:$.setFlatness,numArgs:1,variableArgs:!1},gs:{id:$.setGState,numArgs:1,variableArgs:!1},q:{id:$.save,numArgs:0,variableArgs:!1},Q:{id:$.restore,numArgs:0,variableArgs:!1},cm:{id:$.transform,numArgs:6,variableArgs:!1},m:{id:$.moveTo,numArgs:2,variableArgs:!1},l:{id:$.lineTo,numArgs:2,variableArgs:!1},c:{id:$.curveTo,numArgs:6,variableArgs:!1},v:{id:$.curveTo2,numArgs:4,variableArgs:!1},y:{id:$.curveTo3,numArgs:4,variableArgs:!1},h:{id:$.closePath,numArgs:0,variableArgs:!1},re:{id:$.rectangle,numArgs:4,variableArgs:!1},S:{id:$.stroke,numArgs:0,variableArgs:!1},s:{id:$.closeStroke,numArgs:0,variableArgs:!1},f:{id:$.fill,numArgs:0,variableArgs:!1},F:{id:$.fill,numArgs:0,variableArgs:!1},"f*":{id:$.eoFill,numArgs:0,variableArgs:!1},B:{id:$.fillStroke,numArgs:0,variableArgs:!1},"B*":{id:$.eoFillStroke,numArgs:0,variableArgs:!1},b:{id:$.closeFillStroke,numArgs:0,variableArgs:!1},"b*":{id:$.closeEOFillStroke,numArgs:0,variableArgs:!1},n:{id:$.endPath,numArgs:0,variableArgs:!1},W:{id:$.clip,numArgs:0,variableArgs:!1},"W*":{id:$.eoClip,numArgs:0,variableArgs:!1},BT:{id:$.beginText,numArgs:0,variableArgs:!1},ET:{id:$.endText,numArgs:0,variableArgs:!1},Tc:{id:$.setCharSpacing,numArgs:1,variableArgs:!1},Tw:{id:$.setWordSpacing,numArgs:1,variableArgs:!1},Tz:{id:$.setHScale,numArgs:1,variableArgs:!1},TL:{id:$.setLeading,numArgs:1,variableArgs:!1},Tf:{id:$.setFont,numArgs:2,variableArgs:!1},Tr:{id:$.setTextRenderingMode,numArgs:1,variableArgs:!1},Ts:{id:$.setTextRise,numArgs:1,variableArgs:!1},Td:{id:$.moveText,numArgs:2,variableArgs:!1},TD:{id:$.setLeadingMoveText,numArgs:2,variableArgs:!1},Tm:{id:$.setTextMatrix,numArgs:6,variableArgs:!1},"T*":{id:$.nextLine,numArgs:0,variableArgs:!1},Tj:{id:$.showText,numArgs:1,variableArgs:!1},TJ:{id:$.showSpacedText,numArgs:1,variableArgs:!1},"'":{id:$.nextLineShowText,numArgs:1,variableArgs:!1},'"':{id:$.nextLineSetSpacingShowText,numArgs:3,variableArgs:!1},d0:{id:$.setCharWidth,numArgs:2,variableArgs:!1},d1:{id:$.setCharWidthAndBounds,numArgs:6,variableArgs:!1},CS:{id:$.setStrokeColorSpace,numArgs:1,variableArgs:!1},cs:{id:$.setFillColorSpace,numArgs:1,variableArgs:!1},SC:{id:$.setStrokeColor,numArgs:4,variableArgs:!0},SCN:{id:$.setStrokeColorN,numArgs:33,variableArgs:!0},sc:{id:$.setFillColor,numArgs:4,variableArgs:!0},scn:{id:$.setFillColorN,numArgs:33,variableArgs:!0},G:{id:$.setStrokeGray,numArgs:1,variableArgs:!1},g:{id:$.setFillGray,numArgs:1,variableArgs:!1},RG:{id:$.setStrokeRGBColor,numArgs:3,variableArgs:!1},rg:{id:$.setFillRGBColor,numArgs:3,variableArgs:!1},K:{id:$.setStrokeCMYKColor,numArgs:4,variableArgs:!1},k:{id:$.setFillCMYKColor,numArgs:4,variableArgs:!1},sh:{id:$.shadingFill,numArgs:1,variableArgs:!1},BI:{id:$.beginInlineImage,numArgs:0,variableArgs:!1},ID:{id:$.beginImageData,numArgs:0,variableArgs:!1},EI:{id:$.endInlineImage,numArgs:1,variableArgs:!1},Do:{id:$.paintXObject,numArgs:1,variableArgs:!1},MP:{id:$.markPoint,numArgs:1,variableArgs:!1},DP:{id:$.markPointProps,numArgs:2,variableArgs:!1},BMC:{id:$.beginMarkedContent,numArgs:1,variableArgs:!1},BDC:{id:$.beginMarkedContentProps,numArgs:2,variableArgs:!1},EMC:{id:$.endMarkedContent,numArgs:0,variableArgs:!1},BX:{id:$.beginCompat,numArgs:0,variableArgs:!1},EX:{id:$.endCompat,numArgs:0,variableArgs:!1},BM:null,BD:null,"true":null,fa:null,fal:null,fals:null,"false":null,nu:null,nul:null,"null":null};return c.prototype={get savedStatesDepth(){return this.stateManager.stateStack.length},read:function(c){for(var f=c.args;;){var g=this.parser.getObj();if(A(g)){var h=g.cmd,i=d[h];if(!i){b('Unknown command "'+h+'"');continue}var j=i.id,k=i.numArgs,l=null!==f?f.length:0;if(i.variableArgs)l>k&&a("Command "+j+": expected [0,"+k+"] args, but received "+l+" args");else{if(l!==k){for(var m=this.nonProcessedArgs;l>k;)m.push(f.shift()),l--;for(;k>l&&0!==m.length;)f||(f=[]),f.unshift(m.pop()),l++}if(k>l){a("Command "+j+": because expected "+k+" args, but received "+l+" args; skipping"),f=null;continue}}return this.preprocessCommand(j,f),c.fn=j,c.args=f,!0}if(R(g))return!1;null!==g&&(f||(f=[]),f.push(g instanceof Aa?g.getAll():g),e(f.length<=33,"Too many arguments"))}},preprocessCommand:function(a,b){switch(0|a){case $.save:this.stateManager.save();break;case $.restore:this.stateManager.restore();break;case $.transform:this.stateManager.transform(b)}}},c}(),Cb=function(){function a(a,b,c){for(var d=a,e=0,f=b.length-1;f>e;e++){var g=b[e];d=d[g]||(d[g]=[])}d[b[b.length-1]]=c}function b(a,b,c,d){for(var e=a+2,f=0;b>f;f++){var g=d[e+4*f],h=1===g.length&&g[0];if(!h||1!==h.width||1!==h.height||h.data.length&&(1!==h.data.length||0!==h.data[0]))break;c[e+4*f]=$.paintSolidColorImageMask}return b-f}function c(){}var d=[];return a(d,[$.save,$.transform,$.paintInlineImageXObject,$.restore],function(a){for(var b=10,c=200,d=1e3,e=1,f=a.fnArray,g=a.argsArray,h=a.iCurr,i=h-3,j=h-2,k=h-1,l=i+4,m=f.length;m>l+3&&f[l]===$.save&&f[l+1]===$.transform&&f[l+2]===$.paintInlineImageXObject&&f[l+3]===$.restore;)l+=4;var n=Math.min((l-i)/4,c);if(b>n)return l;var o,p=0,q=[],r=0,s=e,t=e;for(o=0;n>o;o++){var u=g[j+(o<<2)],v=g[k+(o<<2)][0];s+v.width>d&&(p=Math.max(p,s),t+=r+2*e,s=0,r=0),q.push({transform:u,x:s,y:t,w:v.width,h:v.height}),s+=v.width+2*e,r=Math.max(r,v.height)}var w=Math.max(p,s)+e,x=t+r+e,y=new Uint8Array(w*x*4),z=w<<2;for(o=0;n>o;o++){var A=g[k+(o<<2)][0].data,B=q[o].w<<2,C=0,D=q[o].x+q[o].y*w<<2;y.set(A.subarray(0,B),D-z);for(var E=0,F=q[o].h;F>E;E++)y.set(A.subarray(C,C+B),D),C+=B,D+=z;for(y.set(A.subarray(C-B,C),D);D>=0;)A[D-4]=A[D],A[D-3]=A[D+1],A[D-2]=A[D+2],A[D-1]=A[D+3],A[D+B]=A[D+B-4],A[D+B+1]=A[D+B-3],A[D+B+2]=A[D+B-2],A[D+B+3]=A[D+B-1],D-=z}return f.splice(i,4*n,$.paintInlineImageXObjectGroup),g.splice(i,4*n,[{width:w,height:x,kind:V.RGBA_32BPP,data:y},q]),i+1}),a(d,[$.save,$.transform,$.paintImageMaskXObject,$.restore],function(a){for(var c=10,d=100,e=1e3,f=a.fnArray,g=a.argsArray,h=a.iCurr,i=h-3,j=h-2,k=h-1,l=i+4,m=f.length;m>l+3&&f[l]===$.save&&f[l+1]===$.transform&&f[l+2]===$.paintImageMaskXObject&&f[l+3]===$.restore;)l+=4;var n=(l-i)/4;if(n=b(i,n,f,g),c>n)return l;var o,p,q,r=!1,s=g[k][0];if(0===g[j][1]&&0===g[j][2]){r=!0;var t=g[j][0],u=g[j][3];p=j+4;var v=k+4;for(o=1;n>o;o++,p+=4,v+=4)if(q=g[p],g[v][0]!==s||q[0]!==t||0!==q[1]||0!==q[2]||q[3]!==u){c>o?r=!1:n=o;break}}if(r){n=Math.min(n,e);var w=new Float32Array(2*n);for(p=j,o=0;n>o;o++,p+=4)q=g[p],w[o<<1]=q[4],w[(o<<1)+1]=q[5];f.splice(i,4*n,$.paintImageMaskXObjectRepeat),g.splice(i,4*n,[s,t,u,w])}else{n=Math.min(n,d);var x=[];for(o=0;n>o;o++){q=g[j+(o<<2)];var y=g[k+(o<<2)][0];x.push({data:y.data,width:y.width,height:y.height,transform:q})}f.splice(i,4*n,$.paintImageMaskXObjectGroup),g.splice(i,4*n,[x])}return i+1}),a(d,[$.save,$.transform,$.paintImageXObject,$.restore],function(a){var b=3,c=1e3,d=a.fnArray,e=a.argsArray,f=a.iCurr,g=f-3,h=f-2,i=f-1,j=f;if(0!==e[h][1]||0!==e[h][2])return j+1;for(var k=e[i][0],l=e[h][0],m=e[h][3],n=g+4,o=d.length;o>n+3&&d[n]===$.save&&d[n+1]===$.transform&&d[n+2]===$.paintImageXObject&&d[n+3]===$.restore&&e[n+1][0]===l&&0===e[n+1][1]&&0===e[n+1][2]&&e[n+1][3]===m&&e[n+2][0]===k;)n+=4;var p=Math.min((n-g)/4,c);if(b>p)return n;for(var q=new Float32Array(2*p),r=h,s=0;p>s;s++,r+=4){var t=e[r];q[s<<1]=t[4],q[(s<<1)+1]=t[5]}var u=[k,l,m,q];return d.splice(g,4*p,$.paintImageXObjectRepeat),e.splice(g,4*p,u),g+1}),a(d,[$.beginText,$.setFont,$.setTextMatrix,$.showText,$.endText],function(a){for(var b=3,c=1e3,d=a.fnArray,e=a.argsArray,f=a.iCurr,g=f-4,h=f-3,i=f-2,j=f-1,k=f,l=e[h][0],m=e[h][1],n=g+5,o=d.length;o>n+4&&d[n]===$.beginText&&d[n+1]===$.setFont&&d[n+2]===$.setTextMatrix&&d[n+3]===$.showText&&d[n+4]===$.endText&&e[n+1][0]===l&&e[n+1][1]===m;)n+=5;var p=Math.min((n-g)/5,c);if(b>p)return n;var q=g;g>=4&&d[g-4]===d[h]&&d[g-3]===d[i]&&d[g-2]===d[j]&&d[g-1]===d[k]&&e[g-4][0]===l&&e[g-4][1]===m&&(p++,q-=5);for(var r=q+4,s=1;p>s;s++)d.splice(r,3),e.splice(r,3),r+=2;return r+1}),c.prototype={optimize:function(a){for(var b,c=a.fnArray,e=a.argsArray,f={iCurr:0,fnArray:c,argsArray:e},g=0,h=c.length;h>g;)b=(b||d)[c[g]],"function"==typeof b?(f.iCurr=g,g=b(f),b=void 0,h=f.fnArray.length):g++}},c}(),Db=["Adobe-GB1-UCS2","Adobe-CNS1-UCS2","Adobe-Japan1-UCS2","Adobe-Korea1-UCS2","78-EUC-H","78-EUC-V","78-H","78-RKSJ-H","78-RKSJ-V","78-V","78ms-RKSJ-H","78ms-RKSJ-V","83pv-RKSJ-H","90ms-RKSJ-H","90ms-RKSJ-V","90msp-RKSJ-H","90msp-RKSJ-V","90pv-RKSJ-H","90pv-RKSJ-V","Add-H","Add-RKSJ-H","Add-RKSJ-V","Add-V","Adobe-CNS1-0","Adobe-CNS1-1","Adobe-CNS1-2","Adobe-CNS1-3","Adobe-CNS1-4","Adobe-CNS1-5","Adobe-CNS1-6","Adobe-GB1-0","Adobe-GB1-1","Adobe-GB1-2","Adobe-GB1-3","Adobe-GB1-4","Adobe-GB1-5","Adobe-Japan1-0","Adobe-Japan1-1","Adobe-Japan1-2","Adobe-Japan1-3","Adobe-Japan1-4","Adobe-Japan1-5","Adobe-Japan1-6","Adobe-Korea1-0","Adobe-Korea1-1","Adobe-Korea1-2","B5-H","B5-V","B5pc-H","B5pc-V","CNS-EUC-H","CNS-EUC-V","CNS1-H","CNS1-V","CNS2-H","CNS2-V","ETHK-B5-H","ETHK-B5-V","ETen-B5-H","ETen-B5-V","ETenms-B5-H","ETenms-B5-V","EUC-H","EUC-V","Ext-H","Ext-RKSJ-H","Ext-RKSJ-V","Ext-V","GB-EUC-H","GB-EUC-V","GB-H","GB-V","GBK-EUC-H","GBK-EUC-V","GBK2K-H","GBK2K-V","GBKp-EUC-H","GBKp-EUC-V","GBT-EUC-H","GBT-EUC-V","GBT-H","GBT-V","GBTpc-EUC-H","GBTpc-EUC-V","GBpc-EUC-H","GBpc-EUC-V","H","HKdla-B5-H","HKdla-B5-V","HKdlb-B5-H","HKdlb-B5-V","HKgccs-B5-H","HKgccs-B5-V","HKm314-B5-H","HKm314-B5-V","HKm471-B5-H","HKm471-B5-V","HKscs-B5-H","HKscs-B5-V","Hankaku","Hiragana","KSC-EUC-H","KSC-EUC-V","KSC-H","KSC-Johab-H","KSC-Johab-V","KSC-V","KSCms-UHC-H","KSCms-UHC-HW-H","KSCms-UHC-HW-V","KSCms-UHC-V","KSCpc-EUC-H","KSCpc-EUC-V","Katakana","NWP-H","NWP-V","RKSJ-H","RKSJ-V","Roman","UniCNS-UCS2-H","UniCNS-UCS2-V","UniCNS-UTF16-H","UniCNS-UTF16-V","UniCNS-UTF32-H","UniCNS-UTF32-V","UniCNS-UTF8-H","UniCNS-UTF8-V","UniGB-UCS2-H","UniGB-UCS2-V","UniGB-UTF16-H","UniGB-UTF16-V","UniGB-UTF32-H","UniGB-UTF32-V","UniGB-UTF8-H","UniGB-UTF8-V","UniJIS-UCS2-H","UniJIS-UCS2-HW-H","UniJIS-UCS2-HW-V","UniJIS-UCS2-V","UniJIS-UTF16-H","UniJIS-UTF16-V","UniJIS-UTF32-H","UniJIS-UTF32-V","UniJIS-UTF8-H","UniJIS-UTF8-V","UniJIS2004-UTF16-H","UniJIS2004-UTF16-V","UniJIS2004-UTF32-H","UniJIS2004-UTF32-V","UniJIS2004-UTF8-H","UniJIS2004-UTF8-V","UniJISPro-UCS2-HW-V","UniJISPro-UCS2-V","UniJISPro-UTF8-V","UniJISX0213-UTF32-H","UniJISX0213-UTF32-V","UniJISX02132004-UTF32-H","UniJISX02132004-UTF32-V","UniKS-UCS2-H","UniKS-UCS2-V","UniKS-UTF16-H","UniKS-UTF16-V","UniKS-UTF32-H","UniKS-UTF32-V","UniKS-UTF8-H","UniKS-UTF8-V","V","WP-Symbol"],Eb=function(){ +function a(a){this.codespaceRanges=[[],[],[],[]],this.numCodespaceRanges=0,this._map=[],this.name="",this.vertical=!1,this.useCMap=null,this.builtInCMap=a}return a.prototype={addCodespaceRange:function(a,b,c){this.codespaceRanges[a-1].push(b,c),this.numCodespaceRanges++},mapCidRange:function(a,b,c){for(;b>=a;)this._map[a++]=c++},mapBfRange:function(a,b,c){for(var d=c.length-1;b>=a;)this._map[a++]=c,c=c.substr(0,d)+String.fromCharCode(c.charCodeAt(d)+1)},mapBfRangeToArray:function(a,b,c){for(var d=0,e=c.length;b>=a&&e>d;)this._map[a]=c[d++],++a},mapOne:function(a,b){this._map[a]=b},lookup:function(a){return this._map[a]},contains:function(a){return void 0!==this._map[a]},forEach:function(a){var b,c=this._map,d=c.length;if(65536>=d)for(b=0;d>b;b++)void 0!==c[b]&&a(b,c[b]);else for(b in this._map)a(b,c[b])},charCodeOf:function(a){return this._map.indexOf(a)},getMap:function(){return this._map},readCharCode:function(a,b,c){for(var d=0,e=this.codespaceRanges,f=this.codespaceRanges.length,g=0;f>g;g++){d=(d<<8|a.charCodeAt(b+g))>>>0;for(var h=e[g],i=0,j=h.length;j>i;){var k=h[i++],l=h[i++];if(d>=k&&l>=d)return c.charcode=d,void(c.length=g+1)}}c.charcode=0,c.length=1},get length(){return this._map.length},get isIdentityCMap(){if("Identity-H"!==this.name&&"Identity-V"!==this.name)return!1;if(65536!==this._map.length)return!1;for(var a=0;65536>a;a++)if(this._map[a]!==a)return!1;return!0}},a}(),Fb=function(){function a(a,b){Eb.call(this),this.vertical=a,this.addCodespaceRange(b,0,65535)}return na.inherit(a,Eb,{}),a.prototype={addCodespaceRange:Eb.prototype.addCodespaceRange,mapCidRange:function(a,b,d){c("should not call mapCidRange")},mapBfRange:function(a,b,d){c("should not call mapBfRange")},mapBfRangeToArray:function(a,b,d){c("should not call mapBfRangeToArray")},mapOne:function(a,b){c("should not call mapCidOne")},lookup:function(a){return w(a)&&65535>=a?a:void 0},contains:function(a){return w(a)&&65535>=a},forEach:function(a){for(var b=0;65535>=b;b++)a(b,b)},charCodeOf:function(a){return w(a)&&65535>=a?a:-1},getMap:function(){for(var a=new Array(65536),b=0;65535>=b;b++)a[b]=b;return a},readCharCode:Eb.prototype.readCharCode,get length(){return 65536},get isIdentityCMap(){c("should not access .isIdentityCMap")}},a}(),Gb=function(){function a(a){var b=PDFJS.disableWorker,d=new XMLHttpRequest;if(d.open("GET",a,!1),!b)try{d.responseType="arraybuffer",b="arraybuffer"!==d.responseType}catch(e){b=!0}if(b&&d.overrideMimeType&&d.overrideMimeType("text/plain; charset=x-user-defined"),d.send(null),(b?d.responseText:d.response)||c("Unable to get binary cMap at: "+a),b){var f=Array.prototype.map.call(d.responseText,function(a){return 255&a.charCodeAt(0)});return new Uint8Array(f)}return new Uint8Array(d.response)}function b(a,b){for(var c=0,d=0;b>=d;d++)c=c<<8|a[d];return c>>>0}function d(a,b){return 1===b?String.fromCharCode(a[0],a[1]):3===b?String.fromCharCode(a[0],a[1],a[2],a[3]):String.fromCharCode.apply(null,a.subarray(0,b+1))}function f(a,b,c){for(var d=0,e=c;e>=0;e--)d+=a[e]+b[e],a[e]=255&d,d>>=8}function g(a,b){for(var c=1,d=b;d>=0&&c>0;d--)c+=a[d],a[d]=255&c,c>>=8}function h(a){this.buffer=a,this.pos=0,this.end=a.length,this.tmpBuf=new Uint8Array(l)}function i(i,j,l){var m=a(i),n=new h(m),o=n.readByte();j.vertical=!!(1&o);for(var p,q,r=null,s=new Uint8Array(k),t=new Uint8Array(k),u=new Uint8Array(k),v=new Uint8Array(k),w=new Uint8Array(k);(q=n.readByte())>=0;){var x=q>>5;if(7!==x){var y=!!(16&q),z=15&q;e(k>=z+1);var A,B=1,C=n.readNumber();switch(x){case 0:for(n.readHex(s,z),n.readHexNumber(t,z),f(t,s,z),j.addCodespaceRange(z+1,b(s,z),b(t,z)),A=1;C>A;A++)g(t,z),n.readHexNumber(s,z),f(s,t,z),n.readHexNumber(t,z),f(t,s,z),j.addCodespaceRange(z+1,b(s,z),b(t,z));break;case 1:for(n.readHex(s,z),n.readHexNumber(t,z),f(t,s,z),p=n.readNumber(),A=1;C>A;A++)g(t,z),n.readHexNumber(s,z),f(s,t,z),n.readHexNumber(t,z),f(t,s,z),p=n.readNumber();break;case 2:for(n.readHex(u,z),p=n.readNumber(),j.mapOne(b(u,z),p),A=1;C>A;A++)g(u,z),y||(n.readHexNumber(w,z),f(u,w,z)),p=n.readSigned()+(p+1),j.mapOne(b(u,z),p);break;case 3:for(n.readHex(s,z),n.readHexNumber(t,z),f(t,s,z),p=n.readNumber(),j.mapCidRange(b(s,z),b(t,z),p),A=1;C>A;A++)g(t,z),y?s.set(t):(n.readHexNumber(s,z),f(s,t,z)),n.readHexNumber(t,z),f(t,s,z),p=n.readNumber(),j.mapCidRange(b(s,z),b(t,z),p);break;case 4:for(n.readHex(u,B),n.readHex(v,z),j.mapOne(b(u,B),d(v,z)),A=1;C>A;A++)g(u,B),y||(n.readHexNumber(w,B),f(u,w,B)),g(v,z),n.readHexSigned(w,z),f(v,w,z),j.mapOne(b(u,B),d(v,z));break;case 5:for(n.readHex(s,B),n.readHexNumber(t,B),f(t,s,B),n.readHex(v,z),j.mapBfRange(b(s,B),b(t,B),d(v,z)),A=1;C>A;A++)g(t,B),y?s.set(t):(n.readHexNumber(s,B),f(s,t,B)),n.readHexNumber(t,B),f(t,s,B),n.readHex(v,z),j.mapBfRange(b(s,B),b(t,B),d(v,z));break;default:c("Unknown type: "+x)}}else switch(31&q){case 0:n.readString();break;case 1:r=n.readString()}}return r&&l(r),j}function j(){}var k=16,l=19;return h.prototype={readByte:function(){return this.pos>=this.end?-1:this.buffer[this.pos++]},readNumber:function(){var a,b=0;do{var d=this.readByte();0>d&&c("unexpected EOF in bcmap"),a=!(128&d),b=b<<7|127&d}while(!a);return b},readSigned:function(){var a=this.readNumber();return 1&a?~(a>>>1):a>>>1},readHex:function(a,b){a.set(this.buffer.subarray(this.pos,this.pos+b+1)),this.pos+=b+1},readHexNumber:function(a,b){var d,e=this.tmpBuf,f=0;do{var g=this.readByte();0>g&&c("unexpected EOF in bcmap"),d=!(128&g),e[f++]=127&g}while(!d);for(var h=b,i=0,j=0;h>=0;){for(;8>j&&e.length>0;)i=e[--f]<>=8,j-=8}},readHexSigned:function(a,b){this.readHexNumber(a,b);for(var c=1&a[b]?255:0,d=0,e=0;b>=e;e++)d=(1&d)<<8|a[e],a[e]=d>>1^c},readString:function(){for(var a=this.readNumber(),b="",c=0;a>c;c++)b+=String.fromCharCode(this.readNumber());return b}},j.prototype={read:i},j}(),Hb=function(){function a(a){for(var b=0,c=0;c>>0}function d(a){y(a)||c("Malformed CMap: expected string.")}function f(a){w(a)||c("Malformed CMap: expected int.")}function g(b,c){for(;;){var e=c.getObj();if(R(e))break;if(A(e,"endbfchar"))return;d(e);var f=a(e);e=c.getObj(),d(e);var g=e;b.mapOne(f,g)}}function h(b,e){for(;;){var f=e.getObj();if(R(f))break;if(A(f,"endbfrange"))return;d(f);var g=a(f);f=e.getObj(),d(f);var h=a(f);if(f=e.getObj(),w(f)||y(f)){var i=w(f)?String.fromCharCode(f):f;b.mapBfRange(g,h,i)}else{if(!A(f,"["))break;f=e.getObj();for(var j=[];!A(f,"]")&&!R(f);)j.push(f),f=e.getObj();b.mapBfRangeToArray(g,h,j)}}c("Invalid bf range.")}function i(b,c){for(;;){var e=c.getObj();if(R(e))break;if(A(e,"endcidchar"))return;d(e);var g=a(e);e=c.getObj(),f(e);var h=e;b.mapOne(g,h)}}function j(b,c){for(;;){var e=c.getObj();if(R(e))break;if(A(e,"endcidrange"))return;d(e);var g=a(e);e=c.getObj(),d(e);var h=a(e);e=c.getObj(),f(e);var i=e;b.mapCidRange(g,h,i)}}function k(b,d){for(;;){var e=d.getObj();if(R(e))break;if(A(e,"endcodespacerange"))return;if(!y(e))break;var f=a(e);if(e=d.getObj(),!y(e))break;var g=a(e);b.addCodespaceRange(e.length,f,g)}c("Invalid codespace range.")}function l(a,b){var c=b.getObj();w(c)&&(a.vertical=!!c)}function m(a,b){var c=b.getObj();z(c)&&y(c.name)&&(a.name=c.name)}function n(a,b,c,d){var e,f;a:for(;;){var n=b.getObj();if(R(n))break;if(z(n))"WMode"===n.name?l(a,b):"CMapName"===n.name&&m(a,b),e=n;else if(A(n))switch(n.cmd){case"endcmap":break a;case"usecmap":z(e)&&(f=e.name);break;case"begincodespacerange":k(a,b);break;case"beginbfchar":g(a,b);break;case"begincidchar":i(a,b);break;case"beginbfrange":h(a,b);break;case"begincidrange":j(a,b)}}!d&&f&&(d=f),d&&o(a,c,d)}function o(a,b,c){if(a.useCMap=q(c,b),0===a.numCodespaceRanges){for(var d=a.useCMap.codespaceRanges,e=0;e=b;b++)a(b,b)},has:function(a){return this.firstChar<=a&&a<=this.lastChar},get:function(a){return this.firstChar<=a&&a<=this.lastChar?String.fromCharCode(a):void 0},charCodeOf:function(a){c("should not call .charCodeOf")}},a}(),bc=function(){function a(a,b,c){a[b]=c>>8&255,a[b+1]=255&c}function b(a,b,c){a[b]=c>>24&255,a[b+1]=c>>16&255,a[b+2]=c>>8&255,a[b+3]=255&c}function c(a,b,c){var d,e;if(c instanceof Uint8Array)a.set(c,b);else if("string"==typeof c)for(d=0,e=c.length;e>d;d++)a[b++]=255&c.charCodeAt(d);else for(d=0,e=c.length;e>d;d++)a[b++]=255&c[d]}function d(a){this.sfnt=a,this.tables=Object.create(null)}d.getSearchParams=function(a,b){for(var c=1,d=0;(c^a)>c;)c<<=1,d++;var e=c*b;return{range:e,entry:d,rangeShift:b*a-e}};var e=12,f=16;return d.prototype={toArray:function(){var g=this.sfnt,h=this.tables,i=Object.keys(h);i.sort();var j,l,m,n,o,p=i.length,q=e+p*f,r=[q];for(j=0;p>j;j++){n=h[i[j]];var s=(n.length+3&-4)>>>0;q+=s,r.push(q)}var t=new Uint8Array(q);for(j=0;p>j;j++)n=h[i[j]],c(t,r[j],n);"true"===g&&(g=k(65536)),t[0]=255&g.charCodeAt(0),t[1]=255&g.charCodeAt(1),t[2]=255&g.charCodeAt(2),t[3]=255&g.charCodeAt(3),a(t,4,p);var u=d.getSearchParams(p,16);for(a(t,6,u.range),a(t,8,u.entry),a(t,10,u.rangeShift),q=e,j=0;p>j;j++){o=i[j],t[q]=255&o.charCodeAt(0),t[q+1]=255&o.charCodeAt(1),t[q+2]=255&o.charCodeAt(2),t[q+3]=255&o.charCodeAt(3);var v=0;for(l=r[j],m=r[j+1];m>l;l+=4){var w=(t[l]<<24)+(t[l+1]<<16)+(t[l+2]<<8)+t[l+3];v=v+w|0}b(t,q+4,v),b(t,q+8,r[j]),b(t,q+12,h[o].length),q+=f}return t},addTable:function(a,b){if(a in this.tables)throw new Error("Table "+a+" already exists");this.tables[a]=b}},d}(),cc=new Int32Array([0,32,127,161,173,174,1536,1920,2208,4256,6016,6144,8192,8208,8209,8210,8232,8240,8287,8304,9676,9677,43616,43648,65520,65536]),dc=function(){function d(d,e,f){var g,h,i;this.name=d,this.loadedName=f.loadedName,this.isType3Font=f.isType3Font,this.sizes=[],this.glyphCache={};var j=d.split("+");j=j.length>1?j[1]:j[0],j=j.split(/[-,_]/g)[0],this.isSerifFont=!!(f.flags&Ob.Serif),this.isSymbolicFont=!!(f.flags&Ob.Symbolic),this.isMonospace=!!(f.flags&Ob.FixedPitch);var k=f.type,l=f.subtype;if(this.type=k,this.fallbackName=this.isMonospace?"monospace":this.isSerifFont?"serif":"sans-serif",this.differences=f.differences,this.widths=f.widths,this.defaultWidth=f.defaultWidth,this.composite=f.composite,this.wideChars=f.wideChars,this.cMap=f.cMap,this.ascent=f.ascent/Lb,this.descent=f.descent/Lb,this.fontMatrix=f.fontMatrix,this.bbox=f.bbox,this.toUnicode=f.toUnicode=this.buildToUnicode(f),this.toFontChar=[],"Type3"===f.type){for(g=0;256>g;g++)this.toFontChar[g]=this.differences[g]||f.defaultEncoding[g];return void(this.fontType=Z.TYPE3)}if(this.cidEncoding=f.cidEncoding,this.vertical=f.vertical,this.vertical&&(this.vmetrics=f.vmetrics,this.defaultVMetrics=f.defaultVMetrics),!e||e.isEmpty){e&&b('Font file is empty in "'+d+'" ('+this.loadedName+")"),this.missingFile=!0;var o=d.replace(/[,_]/g,"-"),p=!!Qb[o]||!(!Rb[o]||!Qb[Rb[o]]);if(o=Qb[o]||Rb[o]||o,this.bold=-1!==o.search(/bold/gi),this.italic=-1!==o.search(/oblique/gi)||-1!==o.search(/italic/gi),this.black=-1!==d.search(/Black/g),this.remeasure=Object.keys(this.widths).length>0,p&&"CIDFontType2"===k&&0===f.cidEncoding.indexOf("Identity-")){var q=[];for(g in Ub)q[+g]=Ub[g];if(/ArialBlack/i.test(d))for(g in Vb)q[+g]=Vb[g];var r=this.toUnicode instanceof ac;r||this.toUnicode.forEach(function(a,b){q[+a]=b}),this.toFontChar=q,this.toUnicode=new _b(q)}else if(/Symbol/i.test(o)){var s=Pb.SymbolSetEncoding;for(g in s)i=zc[s[g]],i&&(this.toFontChar[g]=i);for(g in f.differences)i=zc[f.differences[g]],i&&(this.toFontChar[g]=i)}else if(/Dingbats/i.test(o)){/Wingdings/i.test(d)&&b("Wingdings font without embedded font file, falling back to the ZapfDingbats encoding.");var t=Pb.ZapfDingbatsEncoding;for(g in t)i=Ac[t[g]],i&&(this.toFontChar[g]=i);for(g in f.differences)i=Ac[f.differences[g]],i&&(this.toFontChar[g]=i)}else if(p){this.toFontChar=[];for(g in f.defaultEncoding)h=f.differences[g]||f.defaultEncoding[g],this.toFontChar[g]=zc[h]}else{var u=-1===k.indexOf("CIDFontType");this.toUnicode.forEach(function(a,b){u&&(h=f.differences[a]||f.defaultEncoding[a],b=zc[h]||b),this.toFontChar[a]=b}.bind(this))}return this.loadedName=o.split("-")[0],this.loading=!1,void(this.fontType=P(k,l))}"Type1C"===l&&"Type1"!==k&&"MMType1"!==k&&(m(e)?l="TrueType":k="Type1"),"CIDFontType0C"===l&&"CIDFontType0"!==k&&(k="CIDFontType0"),"OpenType"===l&&(k="OpenType"),"CIDFontType0"===k&&(l=n(e)?"CIDFontType0":"CIDFontType0C");var v;switch(k){case"MMType1":a("MMType1 font ("+d+"), falling back to Type1.");case"Type1":case"CIDFontType0":this.mimetype="font/opentype";var w="Type1C"===l||"CIDFontType0C"===l?new jc(e,f):new ic(d,e,f);O(f),v=this.convert(d,w,f);break;case"OpenType":case"TrueType":case"CIDFontType2":this.mimetype="font/opentype",v=this.checkAndRepair(d,e,f),this.isOpenType&&(k="OpenType");break;default:c("Font "+k+" is not supported")}this.data=v,this.fontType=P(k,l),this.fontMatrix=f.fontMatrix,this.widths=f.widths,this.defaultWidth=f.defaultWidth,this.encoding=f.baseEncoding,this.seacMap=f.seacMap,this.loading=!0}function f(a,b){return(a<<8)+b}function h(a,b,c,d){return(a<<24)+(b<<16)+(c<<8)+d}function j(a){return String.fromCharCode(a>>8&255,255&a)}function l(a){return a=a>32767?32767:-32768>a?-32768:a,String.fromCharCode(a>>8&255,255&a)}function m(a){var b=a.peekBytes(4);return 65536===o(b,0)}function n(a){var b=a.peekBytes(2);return 37===b[0]&&33===b[1]?!0:128===b[0]&&1===b[1]?!0:!1}function p(a){for(var b=0,c=cc.length-1;c>b;){var d=b+c+1>>1;a=i)do l=i++,Kb&&61440===l&&(l=61472,i=l+1);while(void 0!==h[l]&&Jb>=i);f[l]=k,g[j]=l,h[l]=!0}return{toFontChar:g,charCodeToGlyphId:f,nextAvailableFontCharCode:i}}function r(a){var b=[];for(var c in a)b.push({fontCharCode:0|c,glyphId:a[c]});b.sort(function(a,b){return a.fontCharCode-b.fontCharCode});for(var d=[],e=b.length,f=0;e>f;){var g=b[f].fontCharCode,h=[b[f].glyphId];++f;for(var i=g;e>f&&i+1===b[f].fontCharCode&&(h.push(b[f].glyphId),++i,++f,65535!==i););d.push([g,i,h])}return d}function s(a){var b,c,d,e,f=r(a),g=f[f.length-1][1]>65535?2:1,h="\x00\x00"+j(g)+"\x00\x00"+k(4+8*g);for(b=f.length-1;b>=0&&!(f[b][0]<=65535);--b);var i=b+1;f[b][0]<65535&&65535===f[b][1]&&(f[b][1]=65534);var l,m,n,o,p=f[b][1]<65535?1:0,q=i+p,s=bc.getSearchParams(q,2),t="",u="",v="",w="",x="",y=0;for(b=0,c=i;c>b;b++){l=f[b],m=l[0],n=l[1],t+=j(m),u+=j(n),o=l[2];var z=!0;for(d=1,e=o.length;e>d;++d)if(o[d]!==o[d-1]+1){z=!1;break}if(z){var A=o[0];v+=j(A-m&65535),w+=j(0)}else{var B=2*(q-b)+2*y;for(y+=n-m+1,v+=j(0),w+=j(B),d=0,e=o.length;e>d;++d)x+=j(o[d])}}p>0&&(u+="ÿÿ",t+="ÿÿ",v+="\x00",w+="\x00\x00");var C="\x00\x00"+j(2*q)+j(s.range)+j(s.entry)+j(s.rangeShift)+u+"\x00\x00"+t+v+w+x,D="",E="";if(g>1){for(h+="\x00\x00\n"+k(4+8*g+4+C.length),D="",b=0,c=f.length;c>b;b++){l=f[b],m=l[0],o=l[2];var F=o[0];for(d=1,e=o.length;e>d;++d)o[d]!==o[d-1]+1&&(n=l[0]+d-1,D+=k(m)+k(n)+k(F),m=n+1,F=o[d]);D+=k(m)+k(l[1])+k(F)}E="\x00\f\x00\x00"+k(D.length+16)+"\x00\x00\x00\x00"+k(D.length/12)}return h+"\x00"+j(C.length+4)+C+E+D}function t(a){var b=new Mc(a.data),c=b.getUint16();b.getBytes(60);var d=b.getUint16();if(4>c&&768&d)return!1;var e=b.getUint16(),f=b.getUint16();if(e>f)return!1;b.getBytes(6);var g=b.getUint16();return 0===g?!1:(a.data[8]=a.data[9]=0,!0)}function u(a,b,d){d=d||{unitsPerEm:0,yMax:0,yMin:0,ascent:0,descent:0};var e=0,f=0,g=0,h=0,i=null,l=0;if(b)for(var m in b){m|=0,(i>m||!i)&&(i=m),m>l&&(l=m);var n=L(m);32>n?e|=1<n?f|=1<n?g|=1<n?h|=1< 123 are reserved for internal usage")}else i=0,l=255;var o=a.bbox||[0,0,0,0],p=d.unitsPerEm||1/(a.fontMatrix||T)[0],q=a.ascentScaled?1:p/Lb,r=d.ascent||Math.round(q*(a.ascent||o[3])),s=d.descent||Math.round(q*(a.descent||o[1]));s>0&&a.descent>0&&o[1]<0&&(s=-s);var t=d.yMax||r,u=-d.yMin||-s;return"\x00$ô\x00\x00\x00Š»\x00\x00\x00ŒŠ»\x00\x00ß\x001\x00\x00\x00\x00"+String.fromCharCode(a.fixedPitch?9:0)+"\x00\x00\x00\x00\x00\x00"+k(e)+k(f)+k(g)+k(h)+"*21*"+j(a.italicAngle?1:0)+j(i||a.firstChar)+j(l||a.lastChar)+j(r)+j(s)+"\x00d"+j(t)+j(u)+"\x00\x00\x00\x00\x00\x00\x00\x00"+j(a.xHeight)+j(a.capHeight)+j(0)+j(i||a.firstChar)+"\x00"}function v(a){var b=Math.floor(a.italicAngle*Math.pow(2,16));return"\x00\x00\x00"+k(b)+"\x00\x00\x00\x00"+k(a.fixedPitch)+"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"}function w(a,b){b||(b=[[],[]]);var c,d,e,f,g,h=[b[0][0]||"Original licence",b[0][1]||a,b[0][2]||"Unknown",b[0][3]||"uniqueID",b[0][4]||a,b[0][5]||"Version 0.11",b[0][6]||"",b[0][7]||"Unknown",b[0][8]||"Unknown",b[0][9]||"Unknown"],i=[];for(c=0,d=h.length;d>c;c++){g=b[1][c]||h[c];var k=[];for(e=0,f=g.length;f>e;e++)k.push(j(g.charCodeAt(e)));i.push(k.join(""))}var l=[h,i],m=["\x00","\x00"],n=["\x00\x00","\x00"],o=["\x00\x00"," "],p=h.length*m.length,q="\x00\x00"+j(p)+j(12*p+6),r=0;for(c=0,d=m.length;d>c;c++){var s=l[c];for(e=0,f=s.length;f>e;e++){g=s[e];var t=m[c]+n[c]+o[c]+j(e)+j(g.length)+j(r);q+=t,r+=g.length}}return q+=h.join("")+i.join("")}return d.getFontID=function(){var a=1;return function(){return String(a++)}}(),d.prototype={name:null,font:null,mimetype:null,encoding:null,get renderer(){var a=yc.create(this);return g(this,"renderer",a)},exportData:function(){var a={};for(var b in this)this.hasOwnProperty(b)&&(a[b]=this[b]);return a},checkAndRepair:function(d,g,j){function k(a){var b=i(a.getBytes(4)),c=a.getInt32(),d=a.getInt32()>>>0,e=a.getInt32()>>>0,f=a.pos;a.pos=a.start?a.start:0,a.skip(d);var g=a.getBytes(e);return a.pos=f,"head"===b&&(g[8]=g[9]=g[10]=g[11]=0,g[17]|=32),{tag:b,checksum:c,length:e,offset:d,data:g}}function l(a){return{version:i(a.getBytes(4)),numTables:a.getUint16(),searchRange:a.getUint16(),entrySelector:a.getUint16(),rangeShift:a.getUint16()}}function m(a,c,d,e){var f,g=(c.start?c.start:0)+a.offset;c.pos=g;for(var h,i=(c.getUint16(),c.getUint16()),j=!1,k=0;i>k;k++){var l=c.getUint16(),m=c.getUint16(),n=c.getInt32()>>>0,o=!1;if(0===l&&0===m?o=!0:1===l&&0===m?o=!0:3!==l||1!==m||(d||!e)&&h?d&&3===l&&0===m&&(o=!0,j=!0):(o=!0,d||(j=!0)),o&&(h={platformId:l,encodingId:m,offset:n}),j)break}if(h&&(c.pos=g+h.offset),!h||-1===c.peekByte())return b("Could not find a preferred cmap table."),{platformId:-1,encodingId:-1,mappings:[],hasShortCmap:!1};var p,q,r=c.getUint16(),s=(c.getUint16(),c.getUint16(),!1),t=[];if(0===r){for(p=0;256>p;p++){var u=c.getByte();u&&t.push({charCode:p,glyphId:u})}s=!0}else if(4===r){var v=c.getUint16()>>1;c.getBytes(6);var w,x=[];for(w=0;v>w;w++)x.push({end:c.getUint16()});for(c.getUint16(),w=0;v>w;w++)x[w].start=c.getUint16();for(w=0;v>w;w++)x[w].delta=c.getUint16();var y=0;for(w=0;v>w;w++){f=x[w];var z=c.getUint16();if(z){var A=(z>>1)-(v-w);f.offsetIndex=A,y=Math.max(y,A+f.end-f.start+1)}else f.offsetIndex=-1}var B=[];for(p=0;y>p;p++)B.push(c.getUint16());for(w=0;v>w;w++){f=x[w],g=f.start;var C=f.end,D=f.delta;for(A=f.offsetIndex,p=g;C>=p;p++)65535!==p&&(q=0>A?p:B[A+p-g],q=q+D&65535,0!==q&&t.push({charCode:p,glyphId:q}))}}else{if(6!==r)return b("cmap table has unsupported format: "+r),{platformId:-1,encodingId:-1,mappings:[],hasShortCmap:!1};var E=c.getUint16(),F=c.getUint16();for(p=0;F>p;p++){q=c.getUint16();var G=E+p;t.push({charCode:G,glyphId:q})}}for(t.sort(function(a,b){return a.charCode-b.charCode}),k=1;ke&&(a("The numOfMetrics ("+f+") should not be greater than the numGlyphs ("+e+")"),f=e,c.data[34]=(65280&f)>>8,c.data[35]=255&f);var g=e-f,h=g-(d.length-4*f>>1);if(h>0){var i=new Uint8Array(d.length+2*h);i.set(d.data),d.data=i}}function o(a,b,c,d,e,f){if(12>=c-b)return 0;var g=a.subarray(b,c),h=g[0]<<8|g[1];if(32768&h)return d.set(g,e),g.length;var i,j=10,k=0;for(i=0;h>i;i++){var l=g[j]<<8|g[j+1];k=l+1,j+=2}var m=j,n=g[j]<<8|g[j+1];j+=2+n;var o=j,p=0;for(i=0;k>i;i++){var q=g[j++];192&q&&(g[j-1]=63&q);var r=(2&q?1:16&q?0:2)+(4&q?1:32&q?0:2);if(p+=r,8&q){var s=g[j++];i+=s,p+=s*r}}if(0===p)return 0;var t=j+p;return t>g.length?0:!f&&n>0?(d.set(g.subarray(0,m),e),d.set([0,0],e+m),d.set(g.subarray(o,t),e+m+2),t-=n,g.length-t>3&&(t=t+3&-4),t):g.length-t>3?(t=t+3&-4,d.set(g.subarray(0,t),e),t):(d.set(g,e),g.length)}function p(c,d,e){var g=c.data,i=h(g[0],g[1],g[2],g[3]);i>>16!==1&&(a("Attempting to fix invalid version in head table: "+i),g[0]=0,g[1]=1,g[2]=0,g[3]=0);var j=f(g[50],g[51]);if(0>j||j>1){a("Attempting to fix invalid indexToLocFormat in head table: "+j);var k=d+1;e===k<<1?(g[50]=0,g[51]=0):e===k<<2?(g[50]=0,g[51]=1):b("Could not fix indexToLocFormat: "+j)}}function r(a,b,c,d,e,f){var g,h,i;d?(g=4,h=function(a,b){return a[b]<<24|a[b+1]<<16|a[b+2]<<8|a[b+3]},i=function(a,b,c){a[b]=c>>>24&255,a[b+1]=c>>16&255,a[b+2]=c>>8&255,a[b+3]=255&c}):(g=2,h=function(a,b){return a[b]<<9|a[b+1]<<1},i=function(a,b,c){a[b]=c>>9&255,a[b+1]=c>>1&255});var j=a.data,k=g*(1+c);j.length!==k&&(j=new Uint8Array(k),j.set(a.data.subarray(0,k)),a.data=j);var l=b.data,m=l.length,n=new Uint8Array(m),p=h(j,0),q=0,r={};i(j,0,q);var s,t;for(s=0,t=g;c>s;s++,t+=g){var u=h(j,t);if(u>m&&(m+3&-4)===u&&(u=m),u>m)i(j,t,q),p=u;else{p===u&&(r[s]=!0);var v=o(l,p,u,n,q,e);q+=v,i(j,t,q),p=u}}if(0===q){var w=new Uint8Array([0,1,0,0,0,0,0,0,0,0,0,0,0,0,49,0]);for(s=0,t=g;c>s;s++,t+=g)i(j,t,w.length);return b.data=w,r}if(f){var x=h(j,g);n.length>x+q?b.data=n.subarray(0,x+q):(b.data=new Uint8Array(x+q),b.data.set(n.subarray(0,q))),b.data.set(n.subarray(0,x),q),i(a.data,j.length-g,q+x)}else b.data=n.subarray(0,q);return r}function y(a,c,d){var e=(g.start?g.start:0)+a.offset;g.pos=e;var f=a.length,h=e+f,i=g.getInt32(); +g.getBytes(28);var j,k,l=!0;switch(i){case 65536:j=Yb;break;case 131072:var m=g.getUint16();if(m!==d){l=!1;break}var n=[];for(k=0;m>k;++k){var o=g.getUint16();if(o>=32768){l=!1;break}n.push(o)}if(!l)break;for(var p=[],q=[];g.posk;++k)q[k]=String.fromCharCode(g.getByte());p.push(q.join(""))}for(j=[],k=0;m>k;++k){var s=n[k];258>s?j.push(Yb[s]):j.push(p[s-258])}break;case 196608:break;default:b("Unknown/unsupported post table version "+i),l=!1,c.defaultEncoding&&(j=c.defaultEncoding)}return c.glyphNames=j,l}function z(a){var b=(g.start?g.start:0)+a.offset;g.pos=b;var c=[[],[]],d=a.length,e=b+d,f=g.getUint16(),h=6;if(0!==f||h>d)return c;var j,k,l=g.getUint16(),m=g.getUint16(),n=[],o=12;for(j=0;l>j&&g.pos+o<=e;j++){var p={platform:g.getUint16(),encoding:g.getUint16(),language:g.getUint16(),name:g.getUint16(),length:g.getUint16(),offset:g.getUint16()};(1===p.platform&&0===p.encoding&&0===p.language||3===p.platform&&1===p.encoding&&1033===p.language)&&n.push(p)}for(j=0,k=n.length;k>j;j++){var q=n[j],r=b+m+q.offset;if(!(r+q.length>e)){g.pos=r;var s=q.name;if(q.encoding){for(var t="",u=0,v=q.length;v>u;u+=2)t+=String.fromCharCode(g.getUint16());c[1][s]=t}else c[0][s]=i(g.getBytes(q.length))}}return c}function A(a,c){for(var d,e,f,g,h,i=a.data,j=0,k=0,l=0,m=[],n=[],o=[],p=c.tooComplexToFollowFunctions,q=!1,r=0,s=0,t=i.length;t>j;){var u=i[j++];if(64===u)if(e=i[j++],q||s)j+=e;else for(d=0;e>d;d++)m.push(i[j++]);else if(65===u)if(e=i[j++],q||s)j+=2*e;else for(d=0;e>d;d++)f=i[j++],m.push(f<<8|i[j++]);else if(176===(248&u))if(e=u-176+1,q||s)j+=e;else for(d=0;e>d;d++)m.push(i[j++]);else if(184===(248&u))if(e=u-184+1,q||s)j+=2*e;else for(d=0;e>d;d++)f=i[j++],m.push(f<<8|i[j++]);else if(43!==u||p)if(44!==u||p){if(45===u)if(q)q=!1,k=j;else{if(h=n.pop(),!h)return b("TT: ENDF bad stack"),void(c.hintsValid=!1);g=o.pop(),i=h.data,j=h.i,c.functionsStackDeltas[g]=m.length-h.stackTop}else if(137===u)(q||s)&&(b("TT: nested IDEFs not allowed"),p=!0),q=!0,l=j;else if(88===u)++r;else if(27===u)s=r;else if(89===u)s===r&&(s=0),--r;else if(28===u&&!q&&!s){var v=m[m.length-1];v>0&&(j+=v-1)}}else(q||s)&&(b("TT: nested FDEFs not allowed"),p=!0),q=!0,l=j,g=m.pop(),c.functionsDefined[g]={data:i,i:j};else if(!q&&!s)if(g=m[m.length-1],c.functionsUsed[g]=!0,g in c.functionsStackDeltas)m.length+=c.functionsStackDeltas[g];else if(g in c.functionsDefined&&o.indexOf(g)<0){if(n.push({data:i,i:j,stackTop:m.length-1}),o.push(g),h=c.functionsDefined[g],!h)return b("TT: CALL non-existent function"),void(c.hintsValid=!1);i=h.data,j=h.i}if(!q&&!s){var w=142>=u?F[u]:u>=192&&223>=u?-1:u>=224?-2:0;for(u>=113&&117>=u&&(e=m.pop(),e===e&&(w=2*-e));0>w&&m.length>0;)m.pop(),w++;for(;w>0;)m.push(NaN),w--}}c.tooComplexToFollowFunctions=p;var x=[i];j>i.length&&x.push(new Uint8Array(j-i.length)),l>k&&(b("TT: complementing a missing function tail"),x.push(new Uint8Array([34,45]))),C(a,x)}function B(a,c){if(!a.tooComplexToFollowFunctions){if(a.functionsDefined.length>c)return b("TT: more functions defined than expected"),void(a.hintsValid=!1);for(var d=0,e=a.functionsUsed.length;e>d;d++){if(d>c)return b("TT: invalid function id: "+d),void(a.hintsValid=!1);if(a.functionsUsed[d]&&!a.functionsDefined[d])return b("TT: undefined function: "+d),void(a.hintsValid=!1)}}}function C(a,b){if(b.length>1){var c,d,e=0;for(c=0,d=b.length;d>c;c++)e+=b[c].length;e=e+3&-4;var f=new Uint8Array(e),g=0;for(c=0,d=b.length;d>c;c++)f.set(b[c],g),g+=b[c].length;a.data=f,a.length=e}}function D(a,b,c){var d={functionsDefined:[],functionsUsed:[],functionsStackDeltas:[],tooComplexToFollowFunctions:!1,hintsValid:!0};if(a&&A(a,d),b&&A(b,d),a&&B(d,R),c&&1&c.length){var e=new Uint8Array(c.length+1);e.set(c.data),c.data=e}return d.hintsValid}function E(a,b,c){return V[a]?!aa&&b>=0&&$.has(b)?!0:_&&c>=0&&x(_[c])?!0:!1:!0}var F=[0,0,0,0,0,0,0,0,-2,-2,-2,-2,0,0,-2,-5,-1,-1,-1,-1,-1,-1,-1,-1,0,0,-1,0,-1,-1,-1,-1,1,-1,-999,0,1,0,-1,-2,0,-1,-2,-1,-1,0,-1,-1,0,0,-999,-999,-1,-1,-1,-1,-2,-999,-2,-2,-999,0,-2,-2,0,0,-2,0,-2,0,0,0,-2,-1,-1,1,1,0,0,-1,-1,-1,-1,-1,-1,-1,0,0,-1,0,-1,-1,0,-999,-1,-1,-1,-1,-1,-1,0,0,0,0,0,0,0,0,0,0,0,0,-2,-999,-999,-999,-999,-999,-1,-1,-2,-2,0,0,0,0,-1,-1,-999,-2,-2,0,0,-1,-2,-2,0,0,0,-1,-1,-1,-2];g=new Mc(new Uint8Array(g.getBytes()));for(var G,H,I,J=["OS/2","cmap","head","hhea","hmtx","maxp","name","post","loca","glyf","fpgm","prep","cvt ","CFF "],K=l(g),L=K.numTables,M={"OS/2":null,cmap:null,head:null,hhea:null,hmtx:null,maxp:null,name:null,post:null},N=0;L>N;N++)I=k(g),J.indexOf(I.tag)<0||0!==I.length&&(M[I.tag]=I);var O=!M["CFF "];if(O)M.glyf&&M.loca||c('Required "glyf" or "loca" tables are not found'),this.isOpenType=!1;else{if("OTTO"===K.version&&"CIDFontType2"!==j.type||!M.head||!M.hhea||!M.maxp||!M.post)return H=new Mc(M["CFF "].data),G=new jc(H,j),this.convert(d,G,j);delete M.glyf,delete M.loca,delete M.fpgm,delete M.prep,delete M["cvt "],this.isOpenType=!0}M.maxp||c('Required "maxp" table is not found'),g.pos=(g.start||0)+M.maxp.offset;var P=g.getInt32(),Q=g.getUint16(),R=0;if(P>=65536&&M.maxp.length>=22){g.pos+=8;var S=g.getUint16();S>2&&(M.maxp.data[14]=0,M.maxp.data[15]=2),g.pos+=4,R=g.getUint16()}var T=!1;"CIDFontType2"===j.type&&j.toUnicode&&j.toUnicode.get(0)>"\x00"&&(T=!0,Q++,M.maxp.data[4]=Q>>8,M.maxp.data[5]=255&Q);var U=D(M.fpgm,M.prep,M["cvt "],R);U||(delete M.fpgm,delete M.prep,delete M["cvt "]),n(g,M.hhea,M.hmtx,Q),M.head||c('Required "head" table is not found'),p(M.head,Q,O?M.loca.length:0);var V={};if(O){var W=f(M.head.data[50],M.head.data[51]);V=r(M.loca,M.glyf,Q,W,U,T)}if(M.hhea||c('Required "hhea" table is not found'),0===M.hhea.data[10]&&0===M.hhea.data[11]&&(M.hhea.data[10]=255,M.hhea.data[11]=255),M.post){var X=y(M.post,j,Q);X||(M.post=null)}var Y,Z=[],$=j.toUnicode,_=j.widths,aa=$ instanceof ac||65536===$.length;if("CIDFontType2"===j.type){var ba=j.cidToGidMap||[],ca=0===ba.length;j.cMap.forEach(function(a,b){e(65535>=b,"Max size of CID is 65,535");var c=-1;ca?c=a:void 0!==ba[b]&&(c=ba[b]),c>=0&&Q>c&&E(c,a,b)&&(Z[a]=c)}),T&&(Z[0]=Q-1)}else{var da=j.differences.length>0||!!j.baseEncodingName,ea=m(M.cmap,g,this.isSymbolicFont,da),fa=ea.platformId,ga=ea.encodingId,ha=ea.mappings,ia=ha.length;if(da&&(3===fa&&1===ga||1===fa&&0===ga)||-1===fa&&-1===ga&&Pb[j.baseEncodingName]){var ja=[];for(("MacRomanEncoding"===j.baseEncodingName||"WinAnsiEncoding"===j.baseEncodingName)&&(ja=Pb[j.baseEncodingName]),Y=0;256>Y;Y++){var ka;if(ka=this.differences&&Y in this.differences?this.differences[Y]:Y in ja&&""!==ja[Y]?ja[Y]:Pb.StandardEncoding[Y]){var la,ma=!1;3===fa&&1===ga?(la=zc[ka],ma=!0):1===fa&&0===ga&&(la=Pb.MacRomanEncoding.indexOf(ka));var na=!1;for(N=0;ia>N;++N)if(ha[N].charCode===la){var oa=ma?Y:la;if(E(ha[N].glyphId,oa,-1)){Z[Y]=ha[N].glyphId,na=!0;break}}if(!na&&j.glyphNames){var pa=j.glyphNames.indexOf(ka);pa>0&&E(pa,-1,-1)?Z[Y]=pa:Z[Y]=0}}}}else if(0===fa&&0===ga)for(N=0;ia>N;++N)Z[ha[N].charCode]=ha[N].glyphId;else for(N=0;ia>N;++N)Y=255&ha[N].charCode,Z[Y]=ha[N].glyphId}0===Z.length&&(Z[0]=0);var qa=q(Z,j);if(this.toFontChar=qa.toFontChar,M.cmap={tag:"cmap",data:s(qa.charCodeToGlyphId)},!M["OS/2"]||!t(M["OS/2"])){var ra={unitsPerEm:f(M.head.data[18],M.head.data[19]),yMax:f(M.head.data[42],M.head.data[43]),yMin:f(M.head.data[38],M.head.data[39])-65536,ascent:f(M.hhea.data[4],M.hhea.data[5]),descent:f(M.hhea.data[6],M.hhea.data[7])-65536};M["OS/2"]={tag:"OS/2",data:u(j,qa.charCodeToGlyphId,ra)}}if(M.post||(M.post={tag:"post",data:v(j)}),!O)try{H=new Mc(M["CFF "].data);var sa=new kc(H,j);G=sa.parse();var ta=new xc(G);M["CFF "].data=ta.compile()}catch(ua){b("Failed to compile font "+j.loadedName)}if(M.name){var va=z(M.name);M.name.data=w(d,va)}else M.name={tag:"name",data:w(this.name)};var wa=new bc(K.version);for(var xa in M)wa.addTable(xa,M[xa].data);return wa.toArray()},convert:function(a,b,c){function d(a,b){var c=null;for(var d in a)b===a[d]&&(c||(c=[]),c.push(0|d));return c}function e(a,b){for(var c in a)if(b===a[c])return 0|c;return g.charCodeToGlyphId[g.nextAvailableFontCharCode]=b,g.nextAvailableFontCharCode++}c.fixedPitch=!1;var f=b.getGlyphMapping(c),g=q(f,c);this.toFontChar=g.toFontChar;var h=b.numGlyphs,i=b.seacs;if(Nb&&i&&i.length){var k=c.fontMatrix||T,m=b.getCharset(),n=Object.create(null);for(var o in i){o|=0;var p=i[o],r=Pb.StandardEncoding[p[2]],t=Pb.StandardEncoding[p[3]],x=m.indexOf(r),y=m.indexOf(t);if(!(0>x||0>y)){var z={x:p[0]*k[0]+p[1]*k[2]+k[4],y:p[0]*k[1]+p[1]*k[3]+k[5]},A=d(f,o);if(A)for(var B=0,C=A.length;C>B;B++){var D=A[B],E=g.charCodeToGlyphId,F=e(E,x),G=e(E,y);n[D]={baseFontCharCode:F,accentFontCharCode:G,accentOffset:z}}}}c.seacMap=n}var H=1/(c.fontMatrix||T)[0],I=new bc("OTTO");return I.addTable("CFF ",b.data),I.addTable("OS/2",u(c,g.charCodeToGlyphId)),I.addTable("cmap",s(g.charCodeToGlyphId)),I.addTable("head","\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00_<õ\x00\x00"+l(H)+"\x00\x00\x00\x00ž\x0B~'\x00\x00\x00\x00ž\x0B~'\x00\x00"+l(c.descent)+"ÿ"+l(c.ascent)+j(c.italicAngle?2:0)+"\x00\x00\x00\x00\x00\x00\x00"),I.addTable("hhea","\x00\x00\x00"+l(c.ascent)+l(c.descent)+"\x00\x00ÿÿ\x00\x00\x00\x00\x00\x00"+l(c.capHeight)+l(Math.tan(c.italicAngle)*c.xHeight)+"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"+j(h)),I.addTable("hmtx",function(){for(var a=b.charstrings,c=b.cff?b.cff.widths:null,d="\x00\x00\x00\x00",e=1,f=h;f>e;e++){var g=0;if(a){var i=a[e-1];g="width"in i?i.width:0}else c&&(g=Math.ceil(c[e]||0));d+=j(g)+j(0)}return d}()),I.addTable("maxp","\x00\x00P\x00"+j(h)),I.addTable("name",w(a)),I.addTable("post",v(c)),I.toArray()},buildToUnicode:function(a){if(a.toUnicode&&0!==a.toUnicode.length)return a.toUnicode;var b,c;if(!a.composite){b=[];var d=a.defaultEncoding.slice(),f=a.baseEncodingName,g=a.differences;for(c in g)d[c]=g[c];for(c in d){var h=d[c];if(""!==h)if(void 0!==zc[h])b[c]=String.fromCharCode(zc[h]);else{var i=0;switch(h[0]){case"G":3===h.length&&(i=parseInt(h.substr(1),16));break;case"g":5===h.length&&(i=parseInt(h.substr(1),16));break;case"C":case"c":h.length>=3&&(i=+h.substr(1))}if(i){if(f&&i===+c){var j=Pb[f];if(j&&(h=j[c])){b[c]=String.fromCharCode(zc[h]);continue}}b[c]=String.fromCharCode(i)}}}return new _b(b)}if(a.composite&&(a.cMap.builtInCMap&&!(a.cMap instanceof Fb)||"Adobe"===a.cidSystemInfo.registry&&("GB1"===a.cidSystemInfo.ordering||"CNS1"===a.cidSystemInfo.ordering||"Japan1"===a.cidSystemInfo.ordering||"Korea1"===a.cidSystemInfo.ordering))){var k=a.cidSystemInfo.registry,l=a.cidSystemInfo.ordering,m=new ya(k+"-"+l+"-UCS2"),n=Hb.create(m,{url:PDFJS.cMapUrl,packed:PDFJS.cMapPacked},null),o=a.cMap;return b=[],o.forEach(function(a,c){e(65535>=c,"Max size of CID is 65,535");var d=n.lookup(c);d&&(b[a]=String.fromCharCode((d.charCodeAt(0)<<8)+d.charCodeAt(1)))}),new _b(b)}return new ac(a.firstChar,a.lastChar)},get spaceWidth(){if("_shadowWidth"in this)return this._shadowWidth;for(var a,b=["space","minus","one","i"],c=0,d=b.length;d>c;c++){var e=b[c];if(e in this.widths){a=this.widths[e];break}var f=zc[e],g=0;if(this.composite&&this.cMap.contains(f)&&(g=this.cMap.lookup(f)),!g&&"toUnicode"in this&&(g=this.toUnicode.charCodeOf(f)),0>=g&&(g=f),a=this.widths[g])break}return a=a||this.defaultWidth,this._shadowWidth=a,a},charToGlyph:function(a){var b,c,d,e=a;this.cMap&&this.cMap.contains(a)&&(e=this.cMap.lookup(a)),c=this.widths[e],c=x(c)?c:this.defaultWidth;var f=this.vmetrics&&this.vmetrics[e],g=this.toUnicode.get(a)||a;"number"==typeof g&&(g=String.fromCharCode(g)),b=this.toFontChar[a]||a,this.missingFile&&(b=K(b)),this.isType3Font&&(d=b);var h=null;if(this.seacMap&&this.seacMap[a]){var i=this.seacMap[a];b=i.baseFontCharCode,h={fontChar:String.fromCharCode(i.accentFontCharCode),offset:i.accentOffset}}var j=String.fromCharCode(b),k=this.glyphCache[a];return k&&k.matchesForCache(j,g,h,c,f,d)||(k=new $b(j,g,h,c,f,d),this.glyphCache[a]=k),k},charsToGlyphs:function(a){var b,c,d,e=this.charsCache;if(e&&(b=e[a]))return b;e||(e=this.charsCache=Object.create(null)),b=[];var f,g=a,h=0;if(this.cMap)for(var i={};hh;++h)d=a.charCodeAt(h),c=this.charToGlyph(d),b.push(c),32===d&&b.push(null);return e[g]=b}},d}(),ec=function(){function a(a){this.error=a,this.loadedName="g_font_error",this.loading=!1}return a.prototype={charsToGlyphs:function(){return[]},exportData:function(){return{error:this.error}}},a}(),fc=function(){function a(){this.width=0,this.lsb=0,this.flexing=!1,this.output=[],this.stack=[]}var c={hstem:[1],vstem:[3],vmoveto:[4],rlineto:[5],hlineto:[6],vlineto:[7],rrcurveto:[8],callsubr:[10],flex:[12,35],drop:[12,18],endchar:[14],rmoveto:[21],hmoveto:[22],vhcurveto:[30],hvcurveto:[31]};return a.prototype={convert:function(a,d){for(var e,f,g,h=a.length,i=!1,j=0;h>j;j++){var k=a[j];if(32>k){switch(12===k&&(k=(k<<8)+a[++j]),k){case 1:if(!Mb){this.stack=[];break}i=this.executeCommand(2,c.hstem);break;case 3:if(!Mb){this.stack=[];break}i=this.executeCommand(2,c.vstem);break;case 4:if(this.flexing){if(this.stack.length<1){i=!0;break}var l=this.stack.pop();this.stack.push(0,l);break}i=this.executeCommand(1,c.vmoveto);break;case 5:i=this.executeCommand(2,c.rlineto);break;case 6:i=this.executeCommand(1,c.hlineto);break;case 7:i=this.executeCommand(1,c.vlineto);break;case 8:i=this.executeCommand(6,c.rrcurveto);break;case 9:this.stack=[];break;case 10:if(this.stack.length<1){i=!0;break}g=this.stack.pop(),i=this.convert(d[g],d);break;case 11:return i;case 13:if(this.stack.length<2){i=!0;break}e=this.stack.pop(),f=this.stack.pop(),this.lsb=f,this.width=e,this.stack.push(e,f),i=this.executeCommand(2,c.hmoveto);break;case 14:this.output.push(c.endchar[0]);break;case 21:if(this.flexing)break;i=this.executeCommand(2,c.rmoveto);break;case 22:if(this.flexing){this.stack.push(0);break}i=this.executeCommand(1,c.hmoveto);break;case 30:i=this.executeCommand(4,c.vhcurveto);break;case 31:i=this.executeCommand(4,c.hvcurveto);break;case 3072:this.stack=[];break;case 3073:if(!Mb){this.stack=[];break}i=this.executeCommand(2,c.vstem);break;case 3074:if(!Mb){this.stack=[];break}i=this.executeCommand(2,c.hstem);break;case 3078:Nb?(this.seac=this.stack.splice(-4,4),i=this.executeCommand(0,c.endchar)):i=this.executeCommand(4,c.endchar);break;case 3079:if(this.stack.length<4){i=!0;break}this.stack.pop();e=this.stack.pop();var m=this.stack.pop();f=this.stack.pop(),this.lsb=f,this.width=e,this.stack.push(e,f,m),i=this.executeCommand(3,c.rmoveto);break;case 3084:if(this.stack.length<2){i=!0;break}var n=this.stack.pop(),o=this.stack.pop();this.stack.push(o/n);break;case 3088:if(this.stack.length<2){i=!0;break}g=this.stack.pop();var p=this.stack.pop();if(0===g&&3===p){var q=this.stack.splice(this.stack.length-17,17);this.stack.push(q[2]+q[0],q[3]+q[1],q[4],q[5],q[6],q[7],q[8],q[9],q[10],q[11],q[12],q[13],q[14]),i=this.executeCommand(13,c.flex,!0),this.flexing=!1,this.stack.push(q[15],q[16])}else 1===g&&0===p&&(this.flexing=!0);break;case 3089:break;case 3105:this.stack=[];break;default:b('Unknown type 1 charstring command of "'+k+'"')}if(i)break}else 246>=k?k-=139:k=250>=k?256*(k-247)+a[++j]+108:254>=k?-(256*(k-251))-a[++j]-108:(255&a[++j])<<24|(255&a[++j])<<16|(255&a[++j])<<8|(255&a[++j])<<0,this.stack.push(k)}return i},executeCommand:function(a,b,c){var d=this.stack.length;if(a>d)return!0;for(var e=d-a,f=e;d>f;f++){var g=this.stack[f];g===(0|g)?this.output.push(28,g>>8&255,255&g):(g=65536*g|0,this.output.push(255,g>>24&255,g>>16&255,g>>8&255,255&g))}return this.output.push.apply(this.output,b),c?this.stack.splice(e,a):this.stack.length=0,!1}},a}(),gc=function(){function a(a){return a>=48&&57>=a||a>=65&&70>=a||a>=97&&102>=a}function b(a,b,c){for(var d=0|b,e=52845,f=22719,g=a.length,h=new Uint8Array(g),i=0;g>i;i++){var j=a[i];h[i]=j^d>>8,d=(j+d)*e+f&65535}return Array.prototype.slice.call(h,c)}function c(b,c,d){var e,f,g=0|c,h=52845,i=22719,j=b.length,k=j>>>1,l=new Uint8Array(k);for(e=0,f=0;j>e;e++){var m=b[e];if(a(m)){e++;for(var n;j>e&&!a(n=b[e]);)e++;if(j>e){var o=parseInt(String.fromCharCode(m,n),16);l[f++]=o^g>>8,g=(o+g)*h+i&65535}}}return Array.prototype.slice.call(l,d,f)}function d(a){return 47===a||91===a||93===a||123===a||125===a||40===a||41===a}function e(d,e){if(e){var g=d.getBytes(),h=!(a(g[0])&&a(g[1])&&a(g[2])&&a(g[3]));d=new Mc(h?b(g,f,4):c(g,f,4))}this.stream=d,this.nextChar()}var f=55665,g=4330;return e.prototype={readNumberArray:function(){this.getToken();for(var a=[];;){var b=this.getToken();if(null===b||"]"===b||"}"===b)break;a.push(parseFloat(b||0))}return a},readNumber:function(){var a=this.getToken();return parseFloat(a||0)},readInt:function(){var a=this.getToken();return 0|parseInt(a||0,10)},readBoolean:function(){var a=this.getToken();return"true"===a?1:0},nextChar:function(){return this.currentChar=this.stream.getByte()},getToken:function(){for(var a=!1,b=this.currentChar;;){if(-1===b)return null;if(a)(10===b||13===b)&&(a=!1);else if(37===b)a=!0;else if(!Gc.isSpace(b))break;b=this.nextChar()}if(d(b))return this.nextChar(),String.fromCharCode(b);var c="";do c+=String.fromCharCode(b),b=this.nextChar();while(b>=0&&!Gc.isSpace(b)&&!d(b));return c},extractFontProgram:function(){for(var a,c,d,e,f,h=this.stream,i=[],j=[],k={subrs:[],charstrings:[],properties:{privateData:{lenIV:4}}};null!==(a=this.getToken());)if("/"===a)switch(a=this.getToken()){case"CharStrings":for(this.getToken(),this.getToken(),this.getToken(),this.getToken();;){if(a=this.getToken(),null===a||"end"===a)break;if("/"===a){var l=this.getToken();c=this.readInt(),this.getToken(),d=h.makeSubStream(h.pos,c),e=k.properties.privateData.lenIV,f=b(d.getBytes(),g,e),h.skip(c),this.nextChar(),a=this.getToken(),"noaccess"===a&&this.getToken(),j.push({glyph:l,encoded:f})}}break;case"Subrs":this.readInt();for(this.getToken();"dup"===(a=this.getToken());){var m=this.readInt();c=this.readInt(),this.getToken(),d=h.makeSubStream(h.pos,c),e=k.properties.privateData.lenIV,f=b(d.getBytes(),g,e),h.skip(c),this.nextChar(),a=this.getToken(),"noaccess"===a&&this.getToken(),i[m]=f}break;case"BlueValues":case"OtherBlues":case"FamilyBlues":case"FamilyOtherBlues":var n=this.readNumberArray();n.length>0&&n.length%2===0&&Mb&&(k.properties.privateData[a]=n);break;case"StemSnapH":case"StemSnapV":k.properties.privateData[a]=this.readNumberArray();break;case"StdHW":case"StdVW":k.properties.privateData[a]=this.readNumberArray()[0];break;case"BlueShift":case"lenIV":case"BlueFuzz":case"BlueScale":case"LanguageGroup":case"ExpansionFactor":k.properties.privateData[a]=this.readNumber();break;case"ForceBold":k.properties.privateData[a]=this.readBoolean()}for(var o=0;og;g++){for(b=this.getToken();"dup"!==b&&"def"!==b;)if(b=this.getToken(),null===b)return;if("def"===b)break;var h=this.readInt();this.getToken();var i=this.getToken();d[h]=i,this.getToken()}}else d=Pb[e];a.builtInEncoding=d;break;case"FontBBox":var j=this.readNumberArray();a.ascent=j[3],a.descent=j[1],a.ascentScaled=!0}}},e}(),hc=[".notdef","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quoteright","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","quoteleft","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","exclamdown","cent","sterling","fraction","yen","florin","section","currency","quotesingle","quotedblleft","guillemotleft","guilsinglleft","guilsinglright","fi","fl","endash","dagger","daggerdbl","periodcentered","paragraph","bullet","quotesinglbase","quotedblbase","quotedblright","guillemotright","ellipsis","perthousand","questiondown","grave","acute","circumflex","tilde","macron","breve","dotaccent","dieresis","ring","cedilla","hungarumlaut","ogonek","caron","emdash","AE","ordfeminine","Lslash","Oslash","OE","ordmasculine","ae","dotlessi","lslash","oslash","oe","germandbls","onesuperior","logicalnot","mu","trademark","Eth","onehalf","plusminus","Thorn","onequarter","divide","brokenbar","degree","thorn","threequarters","twosuperior","registered","minus","eth","multiply","threesuperior","copyright","Aacute","Acircumflex","Adieresis","Agrave","Aring","Atilde","Ccedilla","Eacute","Ecircumflex","Edieresis","Egrave","Iacute","Icircumflex","Idieresis","Igrave","Ntilde","Oacute","Ocircumflex","Odieresis","Ograve","Otilde","Scaron","Uacute","Ucircumflex","Udieresis","Ugrave","Yacute","Ydieresis","Zcaron","aacute","acircumflex","adieresis","agrave","aring","atilde","ccedilla","eacute","ecircumflex","edieresis","egrave","iacute","icircumflex","idieresis","igrave","ntilde","oacute","ocircumflex","odieresis","ograve","otilde","scaron","uacute","ucircumflex","udieresis","ugrave","yacute","ydieresis","zcaron","exclamsmall","Hungarumlautsmall","dollaroldstyle","dollarsuperior","ampersandsmall","Acutesmall","parenleftsuperior","parenrightsuperior","twodotenleader","onedotenleader","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","commasuperior","threequartersemdash","periodsuperior","questionsmall","asuperior","bsuperior","centsuperior","dsuperior","esuperior","isuperior","lsuperior","msuperior","nsuperior","osuperior","rsuperior","ssuperior","tsuperior","ff","ffi","ffl","parenleftinferior","parenrightinferior","Circumflexsmall","hyphensuperior","Gravesmall","Asmall","Bsmall","Csmall","Dsmall","Esmall","Fsmall","Gsmall","Hsmall","Ismall","Jsmall","Ksmall","Lsmall","Msmall","Nsmall","Osmall","Psmall","Qsmall","Rsmall","Ssmall","Tsmall","Usmall","Vsmall","Wsmall","Xsmall","Ysmall","Zsmall","colonmonetary","onefitted","rupiah","Tildesmall","exclamdownsmall","centoldstyle","Lslashsmall","Scaronsmall","Zcaronsmall","Dieresissmall","Brevesmall","Caronsmall","Dotaccentsmall","Macronsmall","figuredash","hypheninferior","Ogoneksmall","Ringsmall","Cedillasmall","questiondownsmall","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","zerosuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior","Agravesmall","Aacutesmall","Acircumflexsmall","Atildesmall","Adieresissmall","Aringsmall","AEsmall","Ccedillasmall","Egravesmall","Eacutesmall","Ecircumflexsmall","Edieresissmall","Igravesmall","Iacutesmall","Icircumflexsmall","Idieresissmall","Ethsmall","Ntildesmall","Ogravesmall","Oacutesmall","Ocircumflexsmall","Otildesmall","Odieresissmall","OEsmall","Oslashsmall","Ugravesmall","Uacutesmall","Ucircumflexsmall","Udieresissmall","Yacutesmall","Thornsmall","Ydieresissmall","001.000","001.001","001.002","001.003","Black","Bold","Book","Light","Medium","Regular","Roman","Semibold"],ic=function(a,b,c){var d=6,e=c.length1,f=c.length2,g=b.peekBytes(d),h=128===g[0]&&1===g[1];h&&(b.skip(d),e=g[5]<<24|g[4]<<16|g[3]<<8|g[2]);var i=new Mc(b.getBytes(e)),j=new gc(i);j.extractFontHeader(c),h&&(g=b.getBytes(d),f=g[5]<<24|g[4]<<16|g[3]<<8|g[2]);var k=new Mc(b.getBytes(f)),l=new gc(k,!0),m=l.extractFontProgram();for(var n in m.properties)c[n]=m.properties[n];var o=m.charstrings,p=this.getType2Charstrings(o),q=this.getType2Subrs(m.subrs);this.charstrings=o,this.data=this.wrap(a,p,this.charstrings,q,c),this.seacs=this.getSeacs(m.charstrings)};ic.prototype={get numGlyphs(){return this.charstrings.length+1},getCharset:function(){for(var a=[".notdef"],b=this.charstrings,c=0;c=0&&(f[g]=b)}return Q(a,f,d)},getSeacs:function(a){var b,c,d=[];for(b=0,c=a.length;c>b;b++){var e=a[b];e.seac&&(d[b+1]=e.seac)}return d},getType2Charstrings:function(a){for(var b=[],c=0,d=a.length;d>c;c++)b.push(a[c].charstring);return b},getType2Subrs:function(a){var b=0,c=a.length;b=1133>c?107:33769>c?1131:32768;var d,e=[];for(d=0;b>d;d++)e.push([11]);for(d=0;c>d;d++)e.push(a[d]);return e},wrap:function(a,b,c,d,e){var f=new lc;f.header=new mc(1,0,4,4),f.names=[a];var g=new qc;g.setByName("version",391),g.setByName("Notice",392),g.setByName("FullName",393),g.setByName("FamilyName",394),g.setByName("Weight",395),g.setByName("Encoding",null),g.setByName("FontMatrix",e.fontMatrix),g.setByName("FontBBox",e.bbox),g.setByName("charset",null),g.setByName("CharStrings",null),g.setByName("Private",null),f.topDict=g;var h=new nc;h.add("Version 0.11"),h.add("See original notice"),h.add(a),h.add(a),h.add("Medium"),f.strings=h,f.globalSubrIndex=new oc;var i,j,k=b.length,l=[0];for(i=0;k>i;i++){var m=hc.indexOf(c[i].glyphName);-1===m&&(m=0),l.push(m>>8&255,255&m)}f.charset=new tc(!1,0,[],l);var n=new oc;for(n.add([139,14]),i=0;k>i;i++)n.add(b[i]);f.charStrings=n;var o=new rc;o.setByName("Subrs",null);var p=["BlueValues","OtherBlues","FamilyBlues","FamilyOtherBlues","StemSnapH","StemSnapV","BlueShift","BlueFuzz","BlueScale","LanguageGroup","ExpansionFactor","ForceBold","StdHW","StdVW"];for(i=0,j=p.length;j>i;i++){var q=p[i];if(e.privateData.hasOwnProperty(q)){var r=e.privateData[q];if(C(r))for(var s=r.length-1;s>0;s--)r[s]-=r[s-1];o.setByName(q,r)}}f.topDict.privateDict=o;var t=new oc;for(i=0,j=d.length;j>i;i++)t.add(d[i]);o.subrsIndex=t;var u=new xc(f);return u.compile()}};var jc=function(){function a(a,c){this.properties=c;var d=new kc(a,c);this.cff=d.parse();var e=new xc(this.cff);this.seacs=this.cff.seacs;try{this.data=e.compile()}catch(f){b("Failed to compile font "+c.loadedName),this.data=a}}return a.prototype={get numGlyphs(){return this.cff.charStrings.count},getCharset:function(){return this.cff.charset.charset},getGlyphMapping:function(){var a,b,c=this.cff,d=this.properties,e=c.charset.charset;if(d.composite){if(a=Object.create(null),c.isCIDFont)for(b=0;bq;++q){var s=p.get(q),t=this.createDict(qc,this.parseDict(s),b.strings);this.parsePrivateDict(t),b.fdArray.push(t)}o=null,n=this.parseCharsets(i.getByName("charset"),b.charStrings.count,b.strings,!0),b.fdSelect=this.parseFDSelect(i.getByName("FDSelect"),b.charStrings.count)}else n=this.parseCharsets(i.getByName("charset"),b.charStrings.count,b.strings,!1),o=this.parseEncoding(i.getByName("Encoding"),a,b.strings,n.charset);return b.charset=n,b.encoding=o,b},parseHeader:function(){for(var b=this.bytes,d=b.length,e=0;d>e&&1!==b[e];)++e;e>=d?c("Invalid CFF header"):0!==e&&(a("cff data is shifted"),b=b.subarray(e),this.bytes=b);var f=b[0],g=b[1],h=b[2],i=b[3],j=new mc(f,g,h,i);return{obj:j,endPos:h}},parseDict:function(a){function b(){var b=a[e++];return 30===b?d(e):28===b?(b=a[e++],b=(b<<24|a[e++]<<16)>>16):29===b?(b=a[e++],b=b<<8|a[e++],b=b<<8|a[e++],b=b<<8|a[e++]):b>=32&&246>=b?b-139:b>=247&&250>=b?256*(b-247)+a[e++]+108:b>=251&&254>=b?-(256*(b-251))-a[e++]-108:(c("255 is not a valid DICT command"),-1)}function d(){for(var b="",c=15,d=["0","1","2","3","4","5","6","7","8","9",".","E","E-",null,"-"],f=a.length;f>e;){var g=a[e++],h=g>>4,i=15&g;if(h===c)break;if(b+=d[h],i===c)break;b+=d[i]}return parseFloat(b)}var e=0,f=[],g=[];e=0;for(var h=a.length;h>e;){var i=a[e];21>=i?(12===i&&(i=i<<8|a[++e]),g.push([i,f]),f=[],++e):f.push(b())}return g},parseIndex:function(a){var b,c,d=new oc,e=this.bytes,f=e[a++]<<8|e[a++],g=[],h=a;if(0!==f){var i=e[a++],j=a+(f+1)*i-1;for(b=0,c=f+1;c>b;++b){for(var k=0,l=0;i>l;++l)k<<=8,k+=e[a++];g.push(j+k)}h=g[f]}for(b=0,c=g.length-1;c>b;++b){var m=g[b],n=g[b+1];d.add(e.subarray(m,n))}return{obj:d,endPos:h}},parseNameIndex:function(a){for(var b=[],c=0,d=a.count;d>c;++c){for(var e=a.get(c),f=Math.min(e.length,127),g=[],h=0;f>h;++h){var j=e[h];(0!==h||0!==j)&&(33>j||j>126||91===j||93===j||40===j||41===j||123===j||125===j||60===j||62===j||47===j||37===j||35===j)?g[h]=95:g[h]=j}b.push(i(g))}return b},parseStringIndex:function(a){for(var b=new nc,c=0,d=a.count;d>c;++c){var e=a.get(c);b.add(i(e))}return b},createDict:function(a,b,c){for(var d=new a(c),e=0,f=b.length;f>e;++e){var g=b[e],h=g[0],i=g[1];d.setByKey(h,i); +}return d},parseCharStrings:function(a){for(var c=this.parseIndex(a).obj,d=[],g=[],h=c.count,i=0;h>i;i++){for(var j=c.get(i),k=0,l=[],m=!0,n=0,o=!0,p=j,q=p.length,r=!0,s=0;q>s;){var t=p[s++],u=null;if(12===t){var v=p[s++];0===v?(p[s-2]=139,p[s-1]=22,k=0):u=f[v]}else 28===t?(l[k]=(p[s]<<24|p[s+1]<<16)>>16,s+=2,k++):14===t?(k>=4&&(k-=4,Nb&&(d[i]=l.slice(k,k+4),o=!1)),u=e[t]):t>=32&&246>=t?(l[k]=t-139,k++):t>=247&&254>=t?(l[k]=251>t?(t-247<<8)+p[s]+108:-(t-251<<8)-p[s]-108,s++,k++):255===t?(l[k]=(p[s]<<24|p[s+1]<<16|p[s+2]<<8|p[s+3])/65536,s+=4,k++):19===t||20===t?(n+=k>>1,s+=n+7>>3,k%=2,u=e[t]):u=e[t];if(u){if(u.stem&&(n+=k>>1),"min"in u&&!m&&k=2&&u.stem?k%=2:k>1&&b("Found too many parameters for stack-clearing command"),k>0&&l[k-1]>=0&&(g[i]=l[k-1])),"stackDelta"in u?("stackFn"in u&&u.stackFn(l,k),k+=u.stackDelta):u.stackClearing?k=0:u.resetStack?(k=0,m=!1):u.undefStack&&(k=0,m=!0,r=!1)}}o||c.set(i,new Uint8Array([14]))}return{charStrings:c,seacs:d,widths:g}},emptyPrivateDictionary:function(a){var b=this.createDict(rc,[],a.strings);a.setByKey(18,[0,0]),a.privateDict=b},parsePrivateDict:function(a){if(!a.hasName("Private"))return void this.emptyPrivateDictionary(a);var b=a.getByName("Private");if(!C(b)||2!==b.length)return void a.removeByName("Private");var c=b[0],d=b[1];if(0===c||d>=this.bytes.length)return void this.emptyPrivateDictionary(a);var e=d+c,f=this.bytes.subarray(d,e),g=this.parseDict(f),h=this.createDict(rc,g,a.strings);if(a.privateDict=h,h.getByName("Subrs")){var i=h.getByName("Subrs"),j=d+i;if(0===i||j>=this.bytes.length)return void this.emptyPrivateDictionary(a);var k=this.parseIndex(j);h.subrsIndex=k.obj}},parseCharsets:function(a,b,d,e){if(0===a)return new tc(!0,sc.ISO_ADOBE,Ja);if(1===a)return new tc(!0,sc.EXPERT,Ka);if(2===a)return new tc(!0,sc.EXPERT_SUBSET,La);var f,g,h,i=this.bytes,j=a,k=i[a++],l=[".notdef"];switch(b-=1,k){case 0:for(h=0;b>h;h++)f=i[a++]<<8|i[a++],l.push(e?f:d.get(f));break;case 1:for(;l.length<=b;)for(f=i[a++]<<8|i[a++],g=i[a++],h=0;g>=h;h++)l.push(e?f++:d.get(f++));break;case 2:for(;l.length<=b;)for(f=i[a++]<<8|i[a++],g=i[a++]<<8|i[a++],h=0;g>=h;h++)l.push(e?f++:d.get(f++));break;default:c("Unknown charset format")}var m=a,n=i.subarray(j,m);return new tc(!1,k,l,n)},parseEncoding:function(a,b,d,e){function f(){var b=k[a++];for(h=0;b>h;h++){var c=k[a++],f=(k[a++]<<8)+(255&k[a++]);j[c]=e.indexOf(d.get(f))}}var g,h,i,j={},k=this.bytes,l=!1,m=!1,n=null;if(0===a||1===a){l=!0,g=a;var o=a?Pb.ExpertEncoding:Pb.StandardEncoding;for(h=0,i=e.length;i>h;h++){var p=o.indexOf(e[h]);-1!==p&&(j[p]=h)}}else{var q=a;switch(g=k[a++],127&g){case 0:var r=k[a++];for(h=1;r>=h;h++)j[k[a++]]=h;break;case 1:var s=k[a++],t=1;for(h=0;s>h;h++)for(var u=k[a++],v=k[a++],w=u;u+v>=w;w++)j[w]=t++;break;default:c("Unknow encoding format: "+g+" in CFF")}var x=a;128&g&&(k[q]&=127,f(),m=!0),n=k.subarray(q,x)}return g=127&g,new uc(l,g,j,n)},parseFDSelect:function(a,b){var d,e=a,f=this.bytes,g=f[a++],h=[];switch(g){case 0:for(d=0;b>d;++d){var i=f[a++];h.push(i)}break;case 3:var j=f[a++]<<8|f[a++];for(d=0;j>d;++d)for(var k=f[a++]<<8|f[a++],l=f[a++],m=f[a]<<8|f[a+1],n=k;m>n;++n)h.push(l);a+=2;break;default:c("Unknown fdselect format "+g)}var o=a;return new vc(h,f.subarray(e,o))}},d}(),lc=function(){function a(){this.header=null,this.names=[],this.topDict=null,this.strings=new nc,this.globalSubrIndex=null,this.encoding=null,this.charset=null,this.charStrings=null,this.fdArray=[],this.fdSelect=null,this.isCIDFont=!1}return a}(),mc=function(){function a(a,b,c,d){this.major=a,this.minor=b,this.hdrSize=c,this.offSize=d}return a}(),nc=function(){function a(){this.strings=[]}return a.prototype={get:function(a){return a>=0&&390>=a?hc[a]:a-391<=this.strings.length?this.strings[a-391]:hc[0]},add:function(a){this.strings.push(a)},get count(){return this.strings.length}},a}(),oc=function(){function a(){this.objects=[],this.length=0}return a.prototype={add:function(a){this.length+=a.length,this.objects.push(a)},set:function(a,b){this.length+=b.length-this.objects[a].length,this.objects[a]=b},get:function(a){return this.objects[a]},get count(){return this.objects.length}},a}(),pc=function(){function a(a,b){this.keyToNameMap=a.keyToNameMap,this.nameToKeyMap=a.nameToKeyMap,this.defaults=a.defaults,this.types=a.types,this.opcodes=a.opcodes,this.order=a.order,this.strings=b,this.values={}}return a.prototype={setByKey:function(a,b){if(!(a in this.keyToNameMap))return!1;if(0===b.length)return!0;var c=this.types[a];return("num"===c||"sid"===c||"offset"===c)&&(b=b[0]),this.values[a]=b,!0},setByName:function(a,b){a in this.nameToKeyMap||c('Invalid dictionary name "'+a+'"'),this.values[this.nameToKeyMap[a]]=b},hasName:function(a){return this.nameToKeyMap[a]in this.values},getByName:function(a){a in this.nameToKeyMap||c('Invalid dictionary name "'+a+'"');var b=this.nameToKeyMap[a];return b in this.values?this.values[b]:this.defaults[b]},removeByName:function(a){delete this.values[this.nameToKeyMap[a]]}},a.createTables=function(a){for(var b={keyToNameMap:{},nameToKeyMap:{},defaults:{},types:{},opcodes:{},order:[]},c=0,d=a.length;d>c;++c){var e=a[c],f=C(e[0])?(e[0][0]<<8)+e[0][1]:e[0];b.keyToNameMap[f]=e[1],b.nameToKeyMap[e[1]]=f,b.types[f]=e[2],b.defaults[f]=e[3],b.opcodes[f]=C(e[0])?e[0]:[e[0]],b.order.push(f)}return b},a}(),qc=function(){function a(a){null===c&&(c=pc.createTables(b)),pc.call(this,c,a),this.privateDict=null}var b=[[[12,30],"ROS",["sid","sid","num"],null],[[12,20],"SyntheticBase","num",null],[0,"version","sid",null],[1,"Notice","sid",null],[[12,0],"Copyright","sid",null],[2,"FullName","sid",null],[3,"FamilyName","sid",null],[4,"Weight","sid",null],[[12,1],"isFixedPitch","num",0],[[12,2],"ItalicAngle","num",0],[[12,3],"UnderlinePosition","num",-100],[[12,4],"UnderlineThickness","num",50],[[12,5],"PaintType","num",0],[[12,6],"CharstringType","num",2],[[12,7],"FontMatrix",["num","num","num","num","num","num"],[.001,0,0,.001,0,0]],[13,"UniqueID","num",null],[5,"FontBBox",["num","num","num","num"],[0,0,0,0]],[[12,8],"StrokeWidth","num",0],[14,"XUID","array",null],[15,"charset","offset",0],[16,"Encoding","offset",0],[17,"CharStrings","offset",0],[18,"Private",["offset","offset"],null],[[12,21],"PostScript","sid",null],[[12,22],"BaseFontName","sid",null],[[12,23],"BaseFontBlend","delta",null],[[12,31],"CIDFontVersion","num",0],[[12,32],"CIDFontRevision","num",0],[[12,33],"CIDFontType","num",0],[[12,34],"CIDCount","num",8720],[[12,35],"UIDBase","num",null],[[12,37],"FDSelect","offset",null],[[12,36],"FDArray","offset",null],[[12,38],"FontName","sid",null]],c=null;return a.prototype=Object.create(pc.prototype),a}(),rc=function(){function a(a){null===c&&(c=pc.createTables(b)),pc.call(this,c,a),this.subrsIndex=null}var b=[[6,"BlueValues","delta",null],[7,"OtherBlues","delta",null],[8,"FamilyBlues","delta",null],[9,"FamilyOtherBlues","delta",null],[[12,9],"BlueScale","num",.039625],[[12,10],"BlueShift","num",7],[[12,11],"BlueFuzz","num",1],[10,"StdHW","num",null],[11,"StdVW","num",null],[[12,12],"StemSnapH","delta",null],[[12,13],"StemSnapV","delta",null],[[12,14],"ForceBold","num",0],[[12,17],"LanguageGroup","num",0],[[12,18],"ExpansionFactor","num",.06],[[12,19],"initialRandomSeed","num",0],[20,"defaultWidthX","num",0],[21,"nominalWidthX","num",0],[19,"Subrs","offset",null]],c=null;return a.prototype=Object.create(pc.prototype),a}(),sc={ISO_ADOBE:0,EXPERT:1,EXPERT_SUBSET:2},tc=function(){function a(a,b,c,d){this.predefined=a,this.format=b,this.charset=c,this.raw=d}return a}(),uc=function(){function a(a,b,c,d){this.predefined=a,this.format=b,this.encoding=c,this.raw=d}return a}(),vc=function(){function a(a,b){this.fdSelect=a,this.raw=b}return a}(),wc=function(){function a(){this.offsets={}}return a.prototype={isTracking:function(a){return a in this.offsets},track:function(a,b){a in this.offsets&&c("Already tracking location of "+a),this.offsets[a]=b},offset:function(a){for(var b in this.offsets)this.offsets[b]+=a},setEntryLocation:function(a,b,d){a in this.offsets||c("Not tracking location of "+a);for(var e=d.data,f=this.offsets[a],g=5,h=0,i=b.length;i>h;++h){var j=h*g+f,k=j+1,l=j+2,m=j+3,n=j+4;(29!==e[j]||0!==e[k]||0!==e[l]||0!==e[m]||0!==e[n])&&c("writing to an offset that is not empty");var o=b[h];e[j]=29,e[k]=o>>24&255,e[l]=o>>16&255,e[m]=o>>8&255,e[n]=255&o}}},a}(),xc=function(){function a(a){this.cff=a}return a.prototype={compile:function(){var a=this.cff,b={data:[],length:0,add:function(a){this.data=this.data.concat(a),this.length=this.data.length}},c=this.compileHeader(a.header);b.add(c);var d=this.compileNameIndex(a.names);if(b.add(d),a.isCIDFont&&a.topDict.hasName("FontMatrix")){var e=a.topDict.getByName("FontMatrix");a.topDict.removeByName("FontMatrix");for(var f=0,g=a.fdArray.length;g>f;f++){var h=a.fdArray[f],i=e.slice(0);h.hasName("FontMatrix")&&(i=na.transform(i,h.getByName("FontMatrix"))),h.setByName("FontMatrix",i)}}var j=this.compileTopDicts([a.topDict],b.length,a.isCIDFont);b.add(j.output);var k=j.trackers[0],l=this.compileStringIndex(a.strings.strings);b.add(l);var m=this.compileIndex(a.globalSubrIndex);if(b.add(m),a.encoding&&a.topDict.hasName("Encoding"))if(a.encoding.predefined)k.setEntryLocation("Encoding",[a.encoding.format],b);else{var n=this.compileEncoding(a.encoding);k.setEntryLocation("Encoding",[b.length],b),b.add(n)}if(a.charset&&a.topDict.hasName("charset"))if(a.charset.predefined)k.setEntryLocation("charset",[a.charset.format],b);else{var o=this.compileCharset(a.charset);k.setEntryLocation("charset",[b.length],b),b.add(o)}var p=this.compileCharStrings(a.charStrings);if(k.setEntryLocation("CharStrings",[b.length],b),b.add(p),a.isCIDFont){k.setEntryLocation("FDSelect",[b.length],b);var q=this.compileFDSelect(a.fdSelect.raw);b.add(q),j=this.compileTopDicts(a.fdArray,b.length,!0),k.setEntryLocation("FDArray",[b.length],b),b.add(j.output);var r=j.trackers;this.compilePrivateDicts(a.fdArray,r,b)}return this.compilePrivateDicts([a.topDict],[k],b),b.add([0]),b.data},encodeNumber:function(a){return parseFloat(a)!==parseInt(a,10)||isNaN(a)?this.encodeFloat(a):this.encodeInteger(a)},encodeFloat:function(a){var b=a.toString(),c=/\.(\d*?)(?:9{5,20}|0{5,20})\d{0,2}(?:e(.+)|$)/.exec(b);if(c){var d=parseFloat("1e"+((c[2]?+c[2]:0)+c[1].length));b=(Math.round(a*d)/d).toString()}var e,f,g="";for(e=0,f=b.length;f>e;++e){var h=b[e];g+="e"===h?"-"===b[++e]?"c":"b":"."===h?"a":"-"===h?"e":h}g+=1&g.length?"f":"ff";var i=[30];for(e=0,f=g.length;f>e;e+=2)i.push(parseInt(g.substr(e,2),16));return i},encodeInteger:function(a){var b;return a>=-107&&107>=a?b=[a+139]:a>=108&&1131>=a?(a=[a-108],b=[(a>>8)+247,255&a]):a>=-1131&&-108>=a?(a=-a-108,b=[(a>>8)+251,255&a]):b=a>=-32768&&32767>=a?[28,a>>8&255,255&a]:[29,a>>24&255,a>>16&255,a>>8&255,255&a],b},compileHeader:function(a){return[a.major,a.minor,a.hdrSize,a.offSize]},compileNameIndex:function(a){for(var b=new oc,c=0,d=a.length;d>c;++c)b.add(j(a[c]));return this.compileIndex(b)},compileTopDicts:function(a,b,c){for(var d=[],e=new oc,f=0,g=a.length;g>f;++f){var h=a[f];c&&(h.removeByName("CIDFontVersion"),h.removeByName("CIDFontRevision"),h.removeByName("CIDFontType"),h.removeByName("CIDCount"),h.removeByName("UIDBase"));var i=new wc,j=this.compileDict(h,i);d.push(i),e.add(j),i.offset(b)}return e=this.compileIndex(e,d),{trackers:d,output:e}},compilePrivateDicts:function(a,b,c){for(var d=0,f=a.length;f>d;++d){var g=a[d];e(g.privateDict&&g.hasName("Private"),"There must be an private dictionary.");var h=g.privateDict,i=new wc,j=this.compileDict(h,i),k=c.length;if(i.offset(k),j.length||(k=0),b[d].setEntryLocation("Private",[j.length,k],c),c.add(j),h.subrsIndex&&h.hasName("Subrs")){var l=this.compileIndex(h.subrsIndex);i.setEntryLocation("Subrs",[j.length],c),c.add(l)}}},compileDict:function(a,b){for(var d=[],e=a.order,f=0;fj;++j){var l=i[j],m=h[j];switch(l){case"num":case"sid":d=d.concat(this.encodeNumber(m));break;case"offset":var n=a.keyToNameMap[g];b.isTracking(n)||b.track(n,d.length),d=d.concat([29,0,0,0,0]);break;case"array":case"delta":d=d.concat(this.encodeNumber(m));for(var o=1,p=h.length;p>o;++o)d=d.concat(this.encodeNumber(h[o]));break;default:c("Unknown data type of "+l)}}d=d.concat(a.opcodes[g])}}}return d},compileStringIndex:function(a){for(var b=new oc,c=0,d=a.length;d>c;++c)b.add(j(a[c]));return this.compileIndex(b)},compileGlobalSubrIndex:function(){var a=this.cff.globalSubrIndex;this.out.writeByteArray(this.compileIndex(a))},compileCharStrings:function(a){return this.compileIndex(a)},compileCharset:function(a){return this.compileTypedArray(a.raw)},compileEncoding:function(a){return this.compileTypedArray(a.raw)},compileFDSelect:function(a){return this.compileTypedArray(a)},compileTypedArray:function(a){for(var b=[],c=0,d=a.length;d>c;++c)b[c]=a[c];return b},compileIndex:function(a,b){b=b||[];var c=a.objects,d=c.length;if(0===d)return[0,0,0];var e,f=[d>>8&255,255&d],g=1;for(e=0;d>e;++e)g+=c[e].length;var h;h=256>g?1:65536>g?2:16777216>g?3:4,f.push(h);var i=1;for(e=0;d+1>e;e++)1===h?f.push(255&i):2===h?f.push(i>>8&255,255&i):3===h?f.push(i>>16&255,i>>8&255,255&i):f.push(i>>>24&255,i>>16&255,i>>8&255,255&i),c[e]&&(i+=c[e].length);for(e=0;d>e;e++){b[e]&&b[e].offset(f.length);for(var j=0,k=c[e].length;k>j;j++)f.push(c[e][j])}return f}},a}();!function(){/Windows/.test(navigator.userAgent)&&(Nb=!0)}(),function(){/Windows.*Chrome/.test(navigator.userAgent)&&(Kb=!0)}();var yc=function(){function a(a,b){return a[b]<<24|a[b+1]<<16|a[b+2]<<8|a[b+3]}function b(a,b){return a[b]<<8|a[b+1]}function d(d,e,f){var g,h,i,j,k=1===b(d,e+2)?a(d,e+8):a(d,e+16),l=b(d,e+k);if(4===l){g=b(d,e+k+2);var m=b(d,e+k+6)>>1;for(i=e+k+14,h=[],j=0;m>j;j++,i+=2)h[j]={end:b(d,i)};for(i+=2,j=0;m>j;j++,i+=2)h[j].start=b(d,i);for(j=0;m>j;j++,i+=2)h[j].idDelta=b(d,i);for(j=0;m>j;j++,i+=2){var n=b(d,i);if(0!==n){h[j].ids=[];for(var o=0,p=h[j].end-h[j].start+1;p>o;o++)h[j].ids[o]=b(d,i+n),n+=2}}return h}if(12===l){g=a(d,e+k+4);var q=a(d,e+k+12);for(i=e+k+16,h=[],j=0;q>j;j++)h.push({start:a(d,i),end:a(d,i+4),idDelta:a(d,i+8)-a(d,i)}),i+=12;return h}c("not supported cmap: "+l)}function e(a,b,c){var d={},e=new kc(new Mc(a,b,c-b),d),f=e.parse();return{glyphs:f.charStrings.objects,subrs:f.topDict.privateDict&&f.topDict.privateDict.subrsIndex&&f.topDict.privateDict.subrsIndex.objects,gsubrs:f.globalSubrIndex&&f.globalSubrIndex.objects}}function f(a,b,c){var d,e;c?(d=4,e=function(a,b){return a[b]<<24|a[b+1]<<16|a[b+2]<<8|a[b+3]}):(d=2,e=function(a,b){return a[b]<<9|a[b+1]<<1});for(var f=[],g=e(b,0),h=d;hd;){var f=d+e+1>>1;c>16,k=0,l=0;if(i+=10,0>j){do{g=a[i]<<8|a[i+1];var m=a[i+2]<<8|a[i+3];i+=4;var n,o;1&g?(n=(a[i]<<24|a[i+1]<<16)>>16,o=(a[i+2]<<24|a[i+3]<<16)>>16,i+=4):(n=a[i++],o=a[i++]),2&g?(k=n,l=o):(k=0,l=0);var p=1,q=1,r=0,s=0;8&g?(p=q=(a[i]<<24|a[i+1]<<16)/1073741824,i+=2):64&g?(p=(a[i]<<24|a[i+1]<<16)/1073741824,q=(a[i+2]<<24|a[i+3]<<16)/1073741824,i+=4):128&g&&(p=(a[i]<<24|a[i+1]<<16)/1073741824,r=(a[i+2]<<24|a[i+3]<<16)/1073741824,s=(a[i+4]<<24|a[i+5]<<16)/1073741824,q=(a[i+6]<<24|a[i+7]<<16)/1073741824,i+=8);var t=c.glyphs[m];t&&(b.push({cmd:"save"}),b.push({cmd:"transform",args:[p,r,s,q,k,l]}),h(t,b,c),b.push({cmd:"restore"}))}while(32&g)}else{var u,v,w=[];for(u=0;j>u;u++)w.push(a[i]<<8|a[i+1]),i+=2;var x=a[i]<<8|a[i+1];i+=2+x;for(var y=w[w.length-1]+1,z=[];z.length0;)z.push({flags:g})}for(u=0;y>u;u++){switch(18&z[u].flags){case 0:k+=(a[i]<<24|a[i+1]<<16)>>16,i+=2;break;case 2:k-=a[i++];break;case 18:k+=a[i++]}z[u].x=k}for(u=0;y>u;u++){switch(36&z[u].flags){case 0:l+=(a[i]<<24|a[i+1]<<16)>>16,i+=2;break;case 4:l-=a[i++];break;case 36:l+=a[i++]}z[u].y=l}var B=0;for(i=0;j>i;i++){var C=w[i],D=z.slice(B,C+1);if(1&D[0].flags)D.push(D[0]);else if(1&D[D.length-1].flags)D.unshift(D[D.length-1]);else{var E={flags:1,x:(D[0].x+D[D.length-1].x)/2,y:(D[0].y+D[D.length-1].y)/2};D.unshift(E),D.push(E)}for(d(D[0].x,D[0].y),u=1,v=D.length;v>u;u++)1&D[u].flags?e(D[u].x,D[u].y):1&D[u+1].flags?(f(D[u].x,D[u].y,D[u+1].x,D[u+1].y),u++):f(D[u].x,D[u].y,(D[u].x+D[u+1].x)/2,(D[u].y+D[u+1].y)/2);B=C+1}}}function j(a,b,d){function e(a,c){b.push({cmd:"moveTo",args:[a,c]})}function f(a,c){b.push({cmd:"lineTo",args:[a,c]})}function h(a,c,d,e,f,g){b.push({cmd:"bezierCurveTo",args:[a,c,d,e,f,g]})}function i(a){for(var o=0;o>1,y=!0;break;case 3:n+=k.length>>1,y=!0;break;case 4:m+=k.pop(),e(l,m),y=!0;break;case 5:for(;k.length>0;)l+=k.shift(),m+=k.shift(),f(l,m);break;case 6:for(;k.length>0&&(l+=k.shift(),f(l,m),0!==k.length);)m+=k.shift(),f(l,m);break;case 7:for(;k.length>0&&(m+=k.shift(),f(l,m),0!==k.length);)l+=k.shift(),f(l,m);break;case 8:for(;k.length>0;)p=l+k.shift(),r=m+k.shift(),q=p+k.shift(),s=r+k.shift(),l=q+k.shift(),m=s+k.shift(),h(p,r,q,s,l,m);break;case 10:w=k.pop()+d.subrsBias,x=d.subrs[w],x&&i(x);break;case 11:return;case 12:switch(z=a[o++]){case 34:p=l+k.shift(),q=p+k.shift(),t=m+k.shift(),l=q+k.shift(),h(p,m,q,t,l,t),p=l+k.shift(),q=p+k.shift(),l=q+k.shift(),h(p,t,q,m,l,m);break;case 35:p=l+k.shift(),r=m+k.shift(),q=p+k.shift(),s=r+k.shift(),l=q+k.shift(),m=s+k.shift(),h(p,r,q,s,l,m),p=l+k.shift(),r=m+k.shift(),q=p+k.shift(),s=r+k.shift(),l=q+k.shift(),m=s+k.shift(),h(p,r,q,s,l,m),k.pop();break;case 36:p=l+k.shift(),t=m+k.shift(),q=p+k.shift(),u=t+k.shift(),l=q+k.shift(),h(p,t,q,u,l,u),p=l+k.shift(),q=p+k.shift(),v=u+k.shift(),l=q+k.shift(),h(p,u,q,v,l,m);break;case 37:var A=l,B=m;p=l+k.shift(),r=m+k.shift(),q=p+k.shift(),s=r+k.shift(),l=q+k.shift(),m=s+k.shift(),h(p,r,q,s,l,m),p=l+k.shift(),r=m+k.shift(),q=p+k.shift(),s=r+k.shift(),l=q,m=s,Math.abs(l-A)>Math.abs(m-B)?l+=k.shift():m+=k.shift(),h(p,r,q,s,l,m);break;default:c("unknown operator: 12 "+z)}break;case 14:if(k.length>=4){var C=k.pop(),D=k.pop();m=k.pop(),l=k.pop(),b.push({cmd:"save"}),b.push({cmd:"translate",args:[l,m]});var E=g(d.cmap,String.fromCharCode(d.glyphNameMap[Pb.StandardEncoding[C]]));j(d.glyphs[E],b,d),b.push({cmd:"restore"}),E=g(d.cmap,String.fromCharCode(d.glyphNameMap[Pb.StandardEncoding[D]])),j(d.glyphs[E],b,d)}return;case 18:n+=k.length>>1,y=!0;break;case 19:n+=k.length>>1,o+=n+7>>3,y=!0;break;case 20:n+=k.length>>1,o+=n+7>>3,y=!0;break;case 21:m+=k.pop(),l+=k.pop(),e(l,m),y=!0;break;case 22:l+=k.pop(),e(l,m),y=!0;break;case 23:n+=k.length>>1,y=!0;break;case 24:for(;k.length>2;)p=l+k.shift(),r=m+k.shift(),q=p+k.shift(),s=r+k.shift(),l=q+k.shift(),m=s+k.shift(),h(p,r,q,s,l,m);l+=k.shift(),m+=k.shift(),f(l,m);break;case 25:for(;k.length>6;)l+=k.shift(),m+=k.shift(),f(l,m);p=l+k.shift(),r=m+k.shift(),q=p+k.shift(),s=r+k.shift(),l=q+k.shift(),m=s+k.shift(),h(p,r,q,s,l,m);break;case 26:for(k.length%2&&(l+=k.shift());k.length>0;)p=l,r=m+k.shift(),q=p+k.shift(),s=r+k.shift(),l=q,m=s+k.shift(),h(p,r,q,s,l,m);break;case 27:for(k.length%2&&(m+=k.shift());k.length>0;)p=l+k.shift(),r=m,q=p+k.shift(),s=r+k.shift(),l=q+k.shift(),m=s,h(p,r,q,s,l,m);break;case 28:k.push((a[o]<<24|a[o+1]<<16)>>16),o+=2;break;case 29:w=k.pop()+d.gsubrsBias,x=d.gsubrs[w],x&&i(x);break;case 30:for(;k.length>0&&(p=l,r=m+k.shift(),q=p+k.shift(),s=r+k.shift(),l=q+k.shift(),m=s+(1===k.length?k.shift():0),h(p,r,q,s,l,m),0!==k.length);)p=l+k.shift(),r=m,q=p+k.shift(),s=r+k.shift(),m=s+k.shift(),l=q+(1===k.length?k.shift():0),h(p,r,q,s,l,m);break;case 31:for(;k.length>0&&(p=l+k.shift(),r=m,q=p+k.shift(),s=r+k.shift(),m=s+k.shift(),l=q+(1===k.length?k.shift():0),h(p,r,q,s,l,m),0!==k.length);)p=l,r=m+k.shift(),q=p+k.shift(),s=r+k.shift(),l=q+k.shift(),m=s+(1===k.length?k.shift():0),h(p,r,q,s,l,m);break;default:32>z&&c("unknown operator: "+z),247>z?k.push(z-139):251>z?k.push(256*(z-247)+a[o++]+108):255>z?k.push(256*-(z-251)-a[o++]-108):(k.push((a[o]<<24|a[o+1]<<16|a[o+2]<<8|a[o+3])/65536),o+=4)}y&&(k.length=0)}}var k=[],l=0,m=0,n=0;i(a)}function k(a){this.compiledGlyphs={},this.fontMatrix=a}function l(a,b,c){c=c||[488e-6,0,0,488e-6,0,0],k.call(this,c),this.glyphs=a,this.cmap=b,this.compiledGlyphs=[]}function m(a,b,c,d){c=c||[.001,0,0,.001,0,0],k.call(this,c),this.glyphs=a.glyphs,this.gsubrs=a.gsubrs||[],this.subrs=a.subrs||[],this.cmap=b,this.glyphNameMap=d||zc,this.compiledGlyphs=[],this.gsubrsBias=this.gsubrs.length<1240?107:this.gsubrs.length<33900?1131:32768,this.subrsBias=this.subrs.length<1240?107:this.subrs.length<33900?1131:32768}var n="";return k.prototype={getPathJs:function(a){var b=g(this.cmap,a),c=this.compiledGlyphs[b];return c||(this.compiledGlyphs[b]=c=this.compileGlyph(this.glyphs[b])),c},compileGlyph:function(a){if(!a||0===a.length||14===a[0])return n;var b=[];return b.push({cmd:"save"}),b.push({cmd:"transform",args:this.fontMatrix.slice()}),b.push({cmd:"scale",args:["size","-size"]}),this.compileGlyphImpl(a,b),b.push({cmd:"restore"}),b},compileGlyphImpl:function(){c("Children classes should implement this.")},hasBuiltPath:function(a){var b=g(this.cmap,a);return b in this.compiledGlyphs}},na.inherit(l,k,{compileGlyphImpl:function(a,b){h(a,b,this)}}),na.inherit(m,k,{compileGlyphImpl:function(a,b){j(a,b,this)}}),{create:function(c){for(var g,h,j,k,n,o,p=new Uint8Array(c.data),q=b(p,4),r=0,s=12;q>r;r++,s+=16){var t=i(p.subarray(s,s+4)),u=a(p,s+8),v=a(p,s+12);switch(t){case"cmap":g=d(p,u,u+v);break;case"glyf":h=p.subarray(u,u+v);break;case"loca":j=p.subarray(u,u+v);break;case"head":o=b(p,u+18),n=b(p,u+50);break;case"CFF ":k=e(p,u,u+v)}}if(h){var w=o?[1/o,0,0,1/o,0,0]:c.fontMatrix;return new l(f(h,j,n),g,w)}return new m(k,g,c.fontMatrix,c.glyphNameMap)}}}(),zc={A:65,AE:198,AEacute:508,AEmacron:482,AEsmall:63462,Aacute:193,Aacutesmall:63457,Abreve:258,Abreveacute:7854,Abrevecyrillic:1232,Abrevedotbelow:7862,Abrevegrave:7856,Abrevehookabove:7858,Abrevetilde:7860,Acaron:461,Acircle:9398,Acircumflex:194,Acircumflexacute:7844,Acircumflexdotbelow:7852,Acircumflexgrave:7846,Acircumflexhookabove:7848,Acircumflexsmall:63458,Acircumflextilde:7850,Acute:63177,Acutesmall:63412,Acyrillic:1040,Adblgrave:512,Adieresis:196,Adieresiscyrillic:1234,Adieresismacron:478,Adieresissmall:63460,Adotbelow:7840,Adotmacron:480,Agrave:192,Agravesmall:63456,Ahookabove:7842,Aiecyrillic:1236,Ainvertedbreve:514,Alpha:913,Alphatonos:902,Amacron:256,Amonospace:65313,Aogonek:260,Aring:197,Aringacute:506,Aringbelow:7680,Aringsmall:63461,Asmall:63329,Atilde:195,Atildesmall:63459,Aybarmenian:1329,B:66,Bcircle:9399,Bdotaccent:7682,Bdotbelow:7684,Becyrillic:1041,Benarmenian:1330,Beta:914,Bhook:385,Blinebelow:7686,Bmonospace:65314,Brevesmall:63220,Bsmall:63330,Btopbar:386,C:67,Caarmenian:1342,Cacute:262,Caron:63178,Caronsmall:63221,Ccaron:268,Ccedilla:199,Ccedillaacute:7688,Ccedillasmall:63463,Ccircle:9400,Ccircumflex:264,Cdot:266,Cdotaccent:266,Cedillasmall:63416,Chaarmenian:1353,Cheabkhasiancyrillic:1212,Checyrillic:1063,Chedescenderabkhasiancyrillic:1214,Chedescendercyrillic:1206,Chedieresiscyrillic:1268,Cheharmenian:1347,Chekhakassiancyrillic:1227,Cheverticalstrokecyrillic:1208,Chi:935,Chook:391,Circumflexsmall:63222,Cmonospace:65315,Coarmenian:1361,Csmall:63331,D:68,DZ:497,DZcaron:452,Daarmenian:1332,Dafrican:393,Dcaron:270,Dcedilla:7696,Dcircle:9401,Dcircumflexbelow:7698,Dcroat:272,Ddotaccent:7690,Ddotbelow:7692,Decyrillic:1044,Deicoptic:1006,Delta:8710,Deltagreek:916,Dhook:394,Dieresis:63179,DieresisAcute:63180,DieresisGrave:63181,Dieresissmall:63400,Digammagreek:988,Djecyrillic:1026,Dlinebelow:7694,Dmonospace:65316,Dotaccentsmall:63223,Dslash:272,Dsmall:63332,Dtopbar:395,Dz:498,Dzcaron:453,Dzeabkhasiancyrillic:1248,Dzecyrillic:1029,Dzhecyrillic:1039,E:69,Eacute:201,Eacutesmall:63465,Ebreve:276,Ecaron:282,Ecedillabreve:7708,Echarmenian:1333,Ecircle:9402,Ecircumflex:202,Ecircumflexacute:7870,Ecircumflexbelow:7704,Ecircumflexdotbelow:7878,Ecircumflexgrave:7872,Ecircumflexhookabove:7874,Ecircumflexsmall:63466,Ecircumflextilde:7876,Ecyrillic:1028,Edblgrave:516,Edieresis:203,Edieresissmall:63467,Edot:278,Edotaccent:278,Edotbelow:7864,Efcyrillic:1060,Egrave:200,Egravesmall:63464,Eharmenian:1335,Ehookabove:7866,Eightroman:8551,Einvertedbreve:518,Eiotifiedcyrillic:1124,Elcyrillic:1051,Elevenroman:8554,Emacron:274,Emacronacute:7702,Emacrongrave:7700,Emcyrillic:1052,Emonospace:65317,Encyrillic:1053,Endescendercyrillic:1186,Eng:330,Enghecyrillic:1188,Enhookcyrillic:1223,Eogonek:280,Eopen:400,Epsilon:917,Epsilontonos:904,Ercyrillic:1056,Ereversed:398,Ereversedcyrillic:1069,Escyrillic:1057,Esdescendercyrillic:1194,Esh:425,Esmall:63333,Eta:919,Etarmenian:1336,Etatonos:905,Eth:208,Ethsmall:63472,Etilde:7868,Etildebelow:7706,Euro:8364,Ezh:439,Ezhcaron:494,Ezhreversed:440,F:70,Fcircle:9403,Fdotaccent:7710,Feharmenian:1366,Feicoptic:996,Fhook:401,Fitacyrillic:1138,Fiveroman:8548,Fmonospace:65318,Fourroman:8547,Fsmall:63334,G:71,GBsquare:13191,Gacute:500,Gamma:915,Gammaafrican:404,Gangiacoptic:1002,Gbreve:286,Gcaron:486,Gcedilla:290,Gcircle:9404,Gcircumflex:284,Gcommaaccent:290,Gdot:288,Gdotaccent:288,Gecyrillic:1043,Ghadarmenian:1346,Ghemiddlehookcyrillic:1172,Ghestrokecyrillic:1170,Gheupturncyrillic:1168,Ghook:403,Gimarmenian:1331,Gjecyrillic:1027,Gmacron:7712,Gmonospace:65319,Grave:63182,Gravesmall:63328,Gsmall:63335,Gsmallhook:667,Gstroke:484,H:72,H18533:9679,H18543:9642,H18551:9643,H22073:9633,HPsquare:13259,Haabkhasiancyrillic:1192,Hadescendercyrillic:1202,Hardsigncyrillic:1066,Hbar:294,Hbrevebelow:7722,Hcedilla:7720,Hcircle:9405,Hcircumflex:292,Hdieresis:7718,Hdotaccent:7714,Hdotbelow:7716,Hmonospace:65320,Hoarmenian:1344,Horicoptic:1e3,Hsmall:63336,Hungarumlaut:63183,Hungarumlautsmall:63224,Hzsquare:13200,I:73,IAcyrillic:1071,IJ:306,IUcyrillic:1070,Iacute:205,Iacutesmall:63469,Ibreve:300,Icaron:463,Icircle:9406,Icircumflex:206,Icircumflexsmall:63470,Icyrillic:1030,Idblgrave:520,Idieresis:207,Idieresisacute:7726,Idieresiscyrillic:1252,Idieresissmall:63471,Idot:304,Idotaccent:304,Idotbelow:7882,Iebrevecyrillic:1238,Iecyrillic:1045,Ifraktur:8465,Igrave:204,Igravesmall:63468,Ihookabove:7880,Iicyrillic:1048,Iinvertedbreve:522,Iishortcyrillic:1049,Imacron:298,Imacroncyrillic:1250,Imonospace:65321,Iniarmenian:1339,Iocyrillic:1025,Iogonek:302,Iota:921,Iotaafrican:406,Iotadieresis:938,Iotatonos:906,Ismall:63337,Istroke:407,Itilde:296,Itildebelow:7724,Izhitsacyrillic:1140,Izhitsadblgravecyrillic:1142,J:74,Jaarmenian:1345,Jcircle:9407,Jcircumflex:308,Jecyrillic:1032,Jheharmenian:1355,Jmonospace:65322,Jsmall:63338,K:75,KBsquare:13189,KKsquare:13261,Kabashkircyrillic:1184,Kacute:7728,Kacyrillic:1050,Kadescendercyrillic:1178,Kahookcyrillic:1219,Kappa:922,Kastrokecyrillic:1182,Kaverticalstrokecyrillic:1180,Kcaron:488,Kcedilla:310,Kcircle:9408,Kcommaaccent:310,Kdotbelow:7730,Keharmenian:1364,Kenarmenian:1343,Khacyrillic:1061,Kheicoptic:998,Khook:408,Kjecyrillic:1036,Klinebelow:7732,Kmonospace:65323,Koppacyrillic:1152,Koppagreek:990,Ksicyrillic:1134,Ksmall:63339,L:76,LJ:455,LL:63167,Lacute:313,Lambda:923,Lcaron:317,Lcedilla:315,Lcircle:9409,Lcircumflexbelow:7740,Lcommaaccent:315,Ldot:319,Ldotaccent:319,Ldotbelow:7734,Ldotbelowmacron:7736,Liwnarmenian:1340,Lj:456,Ljecyrillic:1033,Llinebelow:7738,Lmonospace:65324,Lslash:321,Lslashsmall:63225,Lsmall:63340,M:77,MBsquare:13190,Macron:63184,Macronsmall:63407,Macute:7742,Mcircle:9410,Mdotaccent:7744,Mdotbelow:7746,Menarmenian:1348,Mmonospace:65325,Msmall:63341,Mturned:412,Mu:924,N:78,NJ:458,Nacute:323,Ncaron:327,Ncedilla:325,Ncircle:9411,Ncircumflexbelow:7754,Ncommaaccent:325,Ndotaccent:7748,Ndotbelow:7750,Nhookleft:413,Nineroman:8552,Nj:459,Njecyrillic:1034,Nlinebelow:7752,Nmonospace:65326,Nowarmenian:1350,Nsmall:63342,Ntilde:209,Ntildesmall:63473,Nu:925,O:79,OE:338,OEsmall:63226,Oacute:211,Oacutesmall:63475,Obarredcyrillic:1256,Obarreddieresiscyrillic:1258,Obreve:334,Ocaron:465,Ocenteredtilde:415,Ocircle:9412,Ocircumflex:212,Ocircumflexacute:7888,Ocircumflexdotbelow:7896,Ocircumflexgrave:7890,Ocircumflexhookabove:7892,Ocircumflexsmall:63476,Ocircumflextilde:7894,Ocyrillic:1054,Odblacute:336,Odblgrave:524,Odieresis:214,Odieresiscyrillic:1254,Odieresissmall:63478,Odotbelow:7884,Ogoneksmall:63227,Ograve:210,Ogravesmall:63474,Oharmenian:1365,Ohm:8486,Ohookabove:7886,Ohorn:416,Ohornacute:7898,Ohorndotbelow:7906,Ohorngrave:7900,Ohornhookabove:7902,Ohorntilde:7904,Ohungarumlaut:336,Oi:418,Oinvertedbreve:526,Omacron:332,Omacronacute:7762,Omacrongrave:7760,Omega:8486,Omegacyrillic:1120,Omegagreek:937,Omegaroundcyrillic:1146,Omegatitlocyrillic:1148,Omegatonos:911,Omicron:927,Omicrontonos:908,Omonospace:65327,Oneroman:8544,Oogonek:490,Oogonekmacron:492,Oopen:390,Oslash:216,Oslashacute:510,Oslashsmall:63480,Osmall:63343,Ostrokeacute:510,Otcyrillic:1150,Otilde:213,Otildeacute:7756,Otildedieresis:7758,Otildesmall:63477,P:80,Pacute:7764,Pcircle:9413,Pdotaccent:7766,Pecyrillic:1055,Peharmenian:1354,Pemiddlehookcyrillic:1190,Phi:934,Phook:420,Pi:928,Piwrarmenian:1363,Pmonospace:65328,Psi:936,Psicyrillic:1136,Psmall:63344,Q:81,Qcircle:9414,Qmonospace:65329,Qsmall:63345,R:82,Raarmenian:1356,Racute:340,Rcaron:344,Rcedilla:342,Rcircle:9415,Rcommaaccent:342,Rdblgrave:528,Rdotaccent:7768,Rdotbelow:7770,Rdotbelowmacron:7772,Reharmenian:1360,Rfraktur:8476,Rho:929,Ringsmall:63228,Rinvertedbreve:530,Rlinebelow:7774,Rmonospace:65330,Rsmall:63346,Rsmallinverted:641,Rsmallinvertedsuperior:694,S:83,SF010000:9484,SF020000:9492,SF030000:9488,SF040000:9496,SF050000:9532,SF060000:9516,SF070000:9524,SF080000:9500,SF090000:9508,SF100000:9472,SF110000:9474,SF190000:9569,SF200000:9570,SF210000:9558,SF220000:9557,SF230000:9571,SF240000:9553,SF250000:9559,SF260000:9565,SF270000:9564,SF280000:9563,SF360000:9566,SF370000:9567,SF380000:9562,SF390000:9556,SF400000:9577,SF410000:9574,SF420000:9568,SF430000:9552,SF440000:9580,SF450000:9575,SF460000:9576,SF470000:9572,SF480000:9573,SF490000:9561,SF500000:9560,SF510000:9554,SF520000:9555,SF530000:9579,SF540000:9578,Sacute:346,Sacutedotaccent:7780,Sampigreek:992,Scaron:352,Scarondotaccent:7782,Scaronsmall:63229,Scedilla:350,Schwa:399,Schwacyrillic:1240,Schwadieresiscyrillic:1242,Scircle:9416,Scircumflex:348,Scommaaccent:536,Sdotaccent:7776,Sdotbelow:7778,Sdotbelowdotaccent:7784,Seharmenian:1357,Sevenroman:8550,Shaarmenian:1351,Shacyrillic:1064,Shchacyrillic:1065,Sheicoptic:994,Shhacyrillic:1210,Shimacoptic:1004,Sigma:931,Sixroman:8549,Smonospace:65331,Softsigncyrillic:1068,Ssmall:63347,Stigmagreek:986,T:84,Tau:932,Tbar:358,Tcaron:356,Tcedilla:354,Tcircle:9417,Tcircumflexbelow:7792,Tcommaaccent:354,Tdotaccent:7786,Tdotbelow:7788,Tecyrillic:1058,Tedescendercyrillic:1196,Tenroman:8553,Tetsecyrillic:1204,Theta:920,Thook:428,Thorn:222,Thornsmall:63486,Threeroman:8546,Tildesmall:63230,Tiwnarmenian:1359,Tlinebelow:7790,Tmonospace:65332,Toarmenian:1337,Tonefive:444,Tonesix:388,Tonetwo:423,Tretroflexhook:430,Tsecyrillic:1062,Tshecyrillic:1035,Tsmall:63348,Twelveroman:8555,Tworoman:8545,U:85,Uacute:218,Uacutesmall:63482,Ubreve:364,Ucaron:467,Ucircle:9418,Ucircumflex:219,Ucircumflexbelow:7798,Ucircumflexsmall:63483,Ucyrillic:1059,Udblacute:368,Udblgrave:532,Udieresis:220,Udieresisacute:471,Udieresisbelow:7794,Udieresiscaron:473,Udieresiscyrillic:1264,Udieresisgrave:475,Udieresismacron:469,Udieresissmall:63484,Udotbelow:7908,Ugrave:217,Ugravesmall:63481,Uhookabove:7910,Uhorn:431,Uhornacute:7912,Uhorndotbelow:7920,Uhorngrave:7914,Uhornhookabove:7916,Uhorntilde:7918,Uhungarumlaut:368,Uhungarumlautcyrillic:1266,Uinvertedbreve:534,Ukcyrillic:1144,Umacron:362,Umacroncyrillic:1262,Umacrondieresis:7802,Umonospace:65333,Uogonek:370,Upsilon:933, +Upsilon1:978,Upsilonacutehooksymbolgreek:979,Upsilonafrican:433,Upsilondieresis:939,Upsilondieresishooksymbolgreek:980,Upsilonhooksymbol:978,Upsilontonos:910,Uring:366,Ushortcyrillic:1038,Usmall:63349,Ustraightcyrillic:1198,Ustraightstrokecyrillic:1200,Utilde:360,Utildeacute:7800,Utildebelow:7796,V:86,Vcircle:9419,Vdotbelow:7806,Vecyrillic:1042,Vewarmenian:1358,Vhook:434,Vmonospace:65334,Voarmenian:1352,Vsmall:63350,Vtilde:7804,W:87,Wacute:7810,Wcircle:9420,Wcircumflex:372,Wdieresis:7812,Wdotaccent:7814,Wdotbelow:7816,Wgrave:7808,Wmonospace:65335,Wsmall:63351,X:88,Xcircle:9421,Xdieresis:7820,Xdotaccent:7818,Xeharmenian:1341,Xi:926,Xmonospace:65336,Xsmall:63352,Y:89,Yacute:221,Yacutesmall:63485,Yatcyrillic:1122,Ycircle:9422,Ycircumflex:374,Ydieresis:376,Ydieresissmall:63487,Ydotaccent:7822,Ydotbelow:7924,Yericyrillic:1067,Yerudieresiscyrillic:1272,Ygrave:7922,Yhook:435,Yhookabove:7926,Yiarmenian:1349,Yicyrillic:1031,Yiwnarmenian:1362,Ymonospace:65337,Ysmall:63353,Ytilde:7928,Yusbigcyrillic:1130,Yusbigiotifiedcyrillic:1132,Yuslittlecyrillic:1126,Yuslittleiotifiedcyrillic:1128,Z:90,Zaarmenian:1334,Zacute:377,Zcaron:381,Zcaronsmall:63231,Zcircle:9423,Zcircumflex:7824,Zdot:379,Zdotaccent:379,Zdotbelow:7826,Zecyrillic:1047,Zedescendercyrillic:1176,Zedieresiscyrillic:1246,Zeta:918,Zhearmenian:1338,Zhebrevecyrillic:1217,Zhecyrillic:1046,Zhedescendercyrillic:1174,Zhedieresiscyrillic:1244,Zlinebelow:7828,Zmonospace:65338,Zsmall:63354,Zstroke:437,a:97,aabengali:2438,aacute:225,aadeva:2310,aagujarati:2694,aagurmukhi:2566,aamatragurmukhi:2622,aarusquare:13059,aavowelsignbengali:2494,aavowelsigndeva:2366,aavowelsigngujarati:2750,abbreviationmarkarmenian:1375,abbreviationsigndeva:2416,abengali:2437,abopomofo:12570,abreve:259,abreveacute:7855,abrevecyrillic:1233,abrevedotbelow:7863,abrevegrave:7857,abrevehookabove:7859,abrevetilde:7861,acaron:462,acircle:9424,acircumflex:226,acircumflexacute:7845,acircumflexdotbelow:7853,acircumflexgrave:7847,acircumflexhookabove:7849,acircumflextilde:7851,acute:180,acutebelowcmb:791,acutecmb:769,acutecomb:769,acutedeva:2388,acutelowmod:719,acutetonecmb:833,acyrillic:1072,adblgrave:513,addakgurmukhi:2673,adeva:2309,adieresis:228,adieresiscyrillic:1235,adieresismacron:479,adotbelow:7841,adotmacron:481,ae:230,aeacute:509,aekorean:12624,aemacron:483,afii00208:8213,afii08941:8356,afii10017:1040,afii10018:1041,afii10019:1042,afii10020:1043,afii10021:1044,afii10022:1045,afii10023:1025,afii10024:1046,afii10025:1047,afii10026:1048,afii10027:1049,afii10028:1050,afii10029:1051,afii10030:1052,afii10031:1053,afii10032:1054,afii10033:1055,afii10034:1056,afii10035:1057,afii10036:1058,afii10037:1059,afii10038:1060,afii10039:1061,afii10040:1062,afii10041:1063,afii10042:1064,afii10043:1065,afii10044:1066,afii10045:1067,afii10046:1068,afii10047:1069,afii10048:1070,afii10049:1071,afii10050:1168,afii10051:1026,afii10052:1027,afii10053:1028,afii10054:1029,afii10055:1030,afii10056:1031,afii10057:1032,afii10058:1033,afii10059:1034,afii10060:1035,afii10061:1036,afii10062:1038,afii10063:63172,afii10064:63173,afii10065:1072,afii10066:1073,afii10067:1074,afii10068:1075,afii10069:1076,afii10070:1077,afii10071:1105,afii10072:1078,afii10073:1079,afii10074:1080,afii10075:1081,afii10076:1082,afii10077:1083,afii10078:1084,afii10079:1085,afii10080:1086,afii10081:1087,afii10082:1088,afii10083:1089,afii10084:1090,afii10085:1091,afii10086:1092,afii10087:1093,afii10088:1094,afii10089:1095,afii10090:1096,afii10091:1097,afii10092:1098,afii10093:1099,afii10094:1100,afii10095:1101,afii10096:1102,afii10097:1103,afii10098:1169,afii10099:1106,afii10100:1107,afii10101:1108,afii10102:1109,afii10103:1110,afii10104:1111,afii10105:1112,afii10106:1113,afii10107:1114,afii10108:1115,afii10109:1116,afii10110:1118,afii10145:1039,afii10146:1122,afii10147:1138,afii10148:1140,afii10192:63174,afii10193:1119,afii10194:1123,afii10195:1139,afii10196:1141,afii10831:63175,afii10832:63176,afii10846:1241,afii299:8206,afii300:8207,afii301:8205,afii57381:1642,afii57388:1548,afii57392:1632,afii57393:1633,afii57394:1634,afii57395:1635,afii57396:1636,afii57397:1637,afii57398:1638,afii57399:1639,afii57400:1640,afii57401:1641,afii57403:1563,afii57407:1567,afii57409:1569,afii57410:1570,afii57411:1571,afii57412:1572,afii57413:1573,afii57414:1574,afii57415:1575,afii57416:1576,afii57417:1577,afii57418:1578,afii57419:1579,afii57420:1580,afii57421:1581,afii57422:1582,afii57423:1583,afii57424:1584,afii57425:1585,afii57426:1586,afii57427:1587,afii57428:1588,afii57429:1589,afii57430:1590,afii57431:1591,afii57432:1592,afii57433:1593,afii57434:1594,afii57440:1600,afii57441:1601,afii57442:1602,afii57443:1603,afii57444:1604,afii57445:1605,afii57446:1606,afii57448:1608,afii57449:1609,afii57450:1610,afii57451:1611,afii57452:1612,afii57453:1613,afii57454:1614,afii57455:1615,afii57456:1616,afii57457:1617,afii57458:1618,afii57470:1607,afii57505:1700,afii57506:1662,afii57507:1670,afii57508:1688,afii57509:1711,afii57511:1657,afii57512:1672,afii57513:1681,afii57514:1722,afii57519:1746,afii57534:1749,afii57636:8362,afii57645:1470,afii57658:1475,afii57664:1488,afii57665:1489,afii57666:1490,afii57667:1491,afii57668:1492,afii57669:1493,afii57670:1494,afii57671:1495,afii57672:1496,afii57673:1497,afii57674:1498,afii57675:1499,afii57676:1500,afii57677:1501,afii57678:1502,afii57679:1503,afii57680:1504,afii57681:1505,afii57682:1506,afii57683:1507,afii57684:1508,afii57685:1509,afii57686:1510,afii57687:1511,afii57688:1512,afii57689:1513,afii57690:1514,afii57694:64298,afii57695:64299,afii57700:64331,afii57705:64287,afii57716:1520,afii57717:1521,afii57718:1522,afii57723:64309,afii57793:1460,afii57794:1461,afii57795:1462,afii57796:1467,afii57797:1464,afii57798:1463,afii57799:1456,afii57800:1458,afii57801:1457,afii57802:1459,afii57803:1474,afii57804:1473,afii57806:1465,afii57807:1468,afii57839:1469,afii57841:1471,afii57842:1472,afii57929:700,afii61248:8453,afii61289:8467,afii61352:8470,afii61573:8236,afii61574:8237,afii61575:8238,afii61664:8204,afii63167:1645,afii64937:701,agrave:224,agujarati:2693,agurmukhi:2565,ahiragana:12354,ahookabove:7843,aibengali:2448,aibopomofo:12574,aideva:2320,aiecyrillic:1237,aigujarati:2704,aigurmukhi:2576,aimatragurmukhi:2632,ainarabic:1593,ainfinalarabic:65226,aininitialarabic:65227,ainmedialarabic:65228,ainvertedbreve:515,aivowelsignbengali:2504,aivowelsigndeva:2376,aivowelsigngujarati:2760,akatakana:12450,akatakanahalfwidth:65393,akorean:12623,alef:1488,alefarabic:1575,alefdageshhebrew:64304,aleffinalarabic:65166,alefhamzaabovearabic:1571,alefhamzaabovefinalarabic:65156,alefhamzabelowarabic:1573,alefhamzabelowfinalarabic:65160,alefhebrew:1488,aleflamedhebrew:64335,alefmaddaabovearabic:1570,alefmaddaabovefinalarabic:65154,alefmaksuraarabic:1609,alefmaksurafinalarabic:65264,alefmaksurainitialarabic:65267,alefmaksuramedialarabic:65268,alefpatahhebrew:64302,alefqamatshebrew:64303,aleph:8501,allequal:8780,alpha:945,alphatonos:940,amacron:257,amonospace:65345,ampersand:38,ampersandmonospace:65286,ampersandsmall:63270,amsquare:13250,anbopomofo:12578,angbopomofo:12580,angbracketleft:12296,angbracketright:12297,angkhankhuthai:3674,angle:8736,anglebracketleft:12296,anglebracketleftvertical:65087,anglebracketright:12297,anglebracketrightvertical:65088,angleleft:9001,angleright:9002,angstrom:8491,anoteleia:903,anudattadeva:2386,anusvarabengali:2434,anusvaradeva:2306,anusvaragujarati:2690,aogonek:261,apaatosquare:13056,aparen:9372,apostrophearmenian:1370,apostrophemod:700,apple:63743,approaches:8784,approxequal:8776,approxequalorimage:8786,approximatelyequal:8773,araeaekorean:12686,araeakorean:12685,arc:8978,arighthalfring:7834,aring:229,aringacute:507,aringbelow:7681,arrowboth:8596,arrowdashdown:8675,arrowdashleft:8672,arrowdashright:8674,arrowdashup:8673,arrowdblboth:8660,arrowdbldown:8659,arrowdblleft:8656,arrowdblright:8658,arrowdblup:8657,arrowdown:8595,arrowdownleft:8601,arrowdownright:8600,arrowdownwhite:8681,arrowheaddownmod:709,arrowheadleftmod:706,arrowheadrightmod:707,arrowheadupmod:708,arrowhorizex:63719,arrowleft:8592,arrowleftdbl:8656,arrowleftdblstroke:8653,arrowleftoverright:8646,arrowleftwhite:8678,arrowright:8594,arrowrightdblstroke:8655,arrowrightheavy:10142,arrowrightoverleft:8644,arrowrightwhite:8680,arrowtableft:8676,arrowtabright:8677,arrowup:8593,arrowupdn:8597,arrowupdnbse:8616,arrowupdownbase:8616,arrowupleft:8598,arrowupleftofdown:8645,arrowupright:8599,arrowupwhite:8679,arrowvertex:63718,asciicircum:94,asciicircummonospace:65342,asciitilde:126,asciitildemonospace:65374,ascript:593,ascriptturned:594,asmallhiragana:12353,asmallkatakana:12449,asmallkatakanahalfwidth:65383,asterisk:42,asteriskaltonearabic:1645,asteriskarabic:1645,asteriskmath:8727,asteriskmonospace:65290,asterisksmall:65121,asterism:8258,asuperior:63209,asymptoticallyequal:8771,at:64,atilde:227,atmonospace:65312,atsmall:65131,aturned:592,aubengali:2452,aubopomofo:12576,audeva:2324,augujarati:2708,augurmukhi:2580,aulengthmarkbengali:2519,aumatragurmukhi:2636,auvowelsignbengali:2508,auvowelsigndeva:2380,auvowelsigngujarati:2764,avagrahadeva:2365,aybarmenian:1377,ayin:1506,ayinaltonehebrew:64288,ayinhebrew:1506,b:98,babengali:2476,backslash:92,backslashmonospace:65340,badeva:2348,bagujarati:2732,bagurmukhi:2604,bahiragana:12400,bahtthai:3647,bakatakana:12496,bar:124,barmonospace:65372,bbopomofo:12549,bcircle:9425,bdotaccent:7683,bdotbelow:7685,beamedsixteenthnotes:9836,because:8757,becyrillic:1073,beharabic:1576,behfinalarabic:65168,behinitialarabic:65169,behiragana:12409,behmedialarabic:65170,behmeeminitialarabic:64671,behmeemisolatedarabic:64520,behnoonfinalarabic:64621,bekatakana:12505,benarmenian:1378,bet:1489,beta:946,betasymbolgreek:976,betdagesh:64305,betdageshhebrew:64305,bethebrew:1489,betrafehebrew:64332,bhabengali:2477,bhadeva:2349,bhagujarati:2733,bhagurmukhi:2605,bhook:595,bihiragana:12403,bikatakana:12499,bilabialclick:664,bindigurmukhi:2562,birusquare:13105,blackcircle:9679,blackdiamond:9670,blackdownpointingtriangle:9660,blackleftpointingpointer:9668,blackleftpointingtriangle:9664,blacklenticularbracketleft:12304,blacklenticularbracketleftvertical:65083,blacklenticularbracketright:12305,blacklenticularbracketrightvertical:65084,blacklowerlefttriangle:9699,blacklowerrighttriangle:9698,blackrectangle:9644,blackrightpointingpointer:9658,blackrightpointingtriangle:9654,blacksmallsquare:9642,blacksmilingface:9787,blacksquare:9632,blackstar:9733,blackupperlefttriangle:9700,blackupperrighttriangle:9701,blackuppointingsmalltriangle:9652,blackuppointingtriangle:9650,blank:9251,blinebelow:7687,block:9608,bmonospace:65346,bobaimaithai:3610,bohiragana:12412,bokatakana:12508,bparen:9373,bqsquare:13251,braceex:63732,braceleft:123,braceleftbt:63731,braceleftmid:63730,braceleftmonospace:65371,braceleftsmall:65115,bracelefttp:63729,braceleftvertical:65079,braceright:125,bracerightbt:63742,bracerightmid:63741,bracerightmonospace:65373,bracerightsmall:65116,bracerighttp:63740,bracerightvertical:65080,bracketleft:91,bracketleftbt:63728,bracketleftex:63727,bracketleftmonospace:65339,bracketlefttp:63726,bracketright:93,bracketrightbt:63739,bracketrightex:63738,bracketrightmonospace:65341,bracketrighttp:63737,breve:728,brevebelowcmb:814,brevecmb:774,breveinvertedbelowcmb:815,breveinvertedcmb:785,breveinverteddoublecmb:865,bridgebelowcmb:810,bridgeinvertedbelowcmb:826,brokenbar:166,bstroke:384,bsuperior:63210,btopbar:387,buhiragana:12406,bukatakana:12502,bullet:8226,bulletinverse:9688,bulletoperator:8729,bullseye:9678,c:99,caarmenian:1390,cabengali:2458,cacute:263,cadeva:2330,cagujarati:2714,cagurmukhi:2586,calsquare:13192,candrabindubengali:2433,candrabinducmb:784,candrabindudeva:2305,candrabindugujarati:2689,capslock:8682,careof:8453,caron:711,caronbelowcmb:812,caroncmb:780,carriagereturn:8629,cbopomofo:12568,ccaron:269,ccedilla:231,ccedillaacute:7689,ccircle:9426,ccircumflex:265,ccurl:597,cdot:267,cdotaccent:267,cdsquare:13253,cedilla:184,cedillacmb:807,cent:162,centigrade:8451,centinferior:63199,centmonospace:65504,centoldstyle:63394,centsuperior:63200,chaarmenian:1401,chabengali:2459,chadeva:2331,chagujarati:2715,chagurmukhi:2587,chbopomofo:12564,cheabkhasiancyrillic:1213,checkmark:10003,checyrillic:1095,chedescenderabkhasiancyrillic:1215,chedescendercyrillic:1207,chedieresiscyrillic:1269,cheharmenian:1395,chekhakassiancyrillic:1228,cheverticalstrokecyrillic:1209,chi:967,chieuchacirclekorean:12919,chieuchaparenkorean:12823,chieuchcirclekorean:12905,chieuchkorean:12618,chieuchparenkorean:12809,chochangthai:3594,chochanthai:3592,chochingthai:3593,chochoethai:3596,chook:392,cieucacirclekorean:12918,cieucaparenkorean:12822,cieuccirclekorean:12904,cieuckorean:12616,cieucparenkorean:12808,cieucuparenkorean:12828,circle:9675,circlecopyrt:169,circlemultiply:8855,circleot:8857,circleplus:8853,circlepostalmark:12342,circlewithlefthalfblack:9680,circlewithrighthalfblack:9681,circumflex:710,circumflexbelowcmb:813,circumflexcmb:770,clear:8999,clickalveolar:450,clickdental:448,clicklateral:449,clickretroflex:451,club:9827,clubsuitblack:9827,clubsuitwhite:9831,cmcubedsquare:13220,cmonospace:65347,cmsquaredsquare:13216,coarmenian:1409,colon:58,colonmonetary:8353,colonmonospace:65306,colonsign:8353,colonsmall:65109,colontriangularhalfmod:721,colontriangularmod:720,comma:44,commaabovecmb:787,commaaboverightcmb:789,commaaccent:63171,commaarabic:1548,commaarmenian:1373,commainferior:63201,commamonospace:65292,commareversedabovecmb:788,commareversedmod:701,commasmall:65104,commasuperior:63202,commaturnedabovecmb:786,commaturnedmod:699,compass:9788,congruent:8773,contourintegral:8750,control:8963,controlACK:6,controlBEL:7,controlBS:8,controlCAN:24,controlCR:13,controlDC1:17,controlDC2:18,controlDC3:19,controlDC4:20,controlDEL:127,controlDLE:16,controlEM:25,controlENQ:5,controlEOT:4,controlESC:27,controlETB:23,controlETX:3,controlFF:12,controlFS:28,controlGS:29,controlHT:9,controlLF:10,controlNAK:21,controlRS:30,controlSI:15,controlSO:14,controlSOT:2,controlSTX:1,controlSUB:26,controlSYN:22,controlUS:31,controlVT:11,copyright:169,copyrightsans:63721,copyrightserif:63193,cornerbracketleft:12300,cornerbracketlefthalfwidth:65378,cornerbracketleftvertical:65089,cornerbracketright:12301,cornerbracketrighthalfwidth:65379,cornerbracketrightvertical:65090,corporationsquare:13183,cosquare:13255,coverkgsquare:13254,cparen:9374,cruzeiro:8354,cstretched:663,curlyand:8911,curlyor:8910,currency:164,cyrBreve:63185,cyrFlex:63186,cyrbreve:63188,cyrflex:63189,d:100,daarmenian:1380,dabengali:2470,dadarabic:1590,dadeva:2342,dadfinalarabic:65214,dadinitialarabic:65215,dadmedialarabic:65216,dagesh:1468,dageshhebrew:1468,dagger:8224,daggerdbl:8225,dagujarati:2726,dagurmukhi:2598,dahiragana:12384,dakatakana:12480,dalarabic:1583,dalet:1491,daletdagesh:64307,daletdageshhebrew:64307,dalethebrew:1491,dalfinalarabic:65194,dammaarabic:1615,dammalowarabic:1615,dammatanaltonearabic:1612,dammatanarabic:1612,danda:2404,dargahebrew:1447,dargalefthebrew:1447,dasiapneumatacyrilliccmb:1157,dblGrave:63187,dblanglebracketleft:12298,dblanglebracketleftvertical:65085,dblanglebracketright:12299,dblanglebracketrightvertical:65086,dblarchinvertedbelowcmb:811,dblarrowleft:8660,dblarrowright:8658,dbldanda:2405,dblgrave:63190,dblgravecmb:783,dblintegral:8748,dbllowline:8215,dbllowlinecmb:819,dbloverlinecmb:831,dblprimemod:698,dblverticalbar:8214,dblverticallineabovecmb:782,dbopomofo:12553,dbsquare:13256,dcaron:271,dcedilla:7697,dcircle:9427,dcircumflexbelow:7699,dcroat:273,ddabengali:2465,ddadeva:2337,ddagujarati:2721,ddagurmukhi:2593,ddalarabic:1672,ddalfinalarabic:64393,dddhadeva:2396,ddhabengali:2466,ddhadeva:2338,ddhagujarati:2722,ddhagurmukhi:2594,ddotaccent:7691,ddotbelow:7693,decimalseparatorarabic:1643,decimalseparatorpersian:1643,decyrillic:1076,degree:176,dehihebrew:1453,dehiragana:12391,deicoptic:1007,dekatakana:12487,deleteleft:9003,deleteright:8998,delta:948,deltaturned:397,denominatorminusonenumeratorbengali:2552,dezh:676,dhabengali:2471,dhadeva:2343,dhagujarati:2727,dhagurmukhi:2599,dhook:599,dialytikatonos:901,dialytikatonoscmb:836,diamond:9830,diamondsuitwhite:9826,dieresis:168,dieresisacute:63191,dieresisbelowcmb:804,dieresiscmb:776,dieresisgrave:63192,dieresistonos:901,dihiragana:12386,dikatakana:12482,dittomark:12291,divide:247,divides:8739,divisionslash:8725,djecyrillic:1106,dkshade:9619,dlinebelow:7695,dlsquare:13207,dmacron:273,dmonospace:65348,dnblock:9604,dochadathai:3598,dodekthai:3604,dohiragana:12393,dokatakana:12489,dollar:36,dollarinferior:63203,dollarmonospace:65284,dollaroldstyle:63268,dollarsmall:65129,dollarsuperior:63204,dong:8363,dorusquare:13094,dotaccent:729,dotaccentcmb:775,dotbelowcmb:803,dotbelowcomb:803,dotkatakana:12539,dotlessi:305,dotlessj:63166,dotlessjstrokehook:644,dotmath:8901,dottedcircle:9676,doubleyodpatah:64287,doubleyodpatahhebrew:64287,downtackbelowcmb:798,downtackmod:725,dparen:9375,dsuperior:63211,dtail:598,dtopbar:396,duhiragana:12389,dukatakana:12485,dz:499,dzaltone:675,dzcaron:454,dzcurl:677,dzeabkhasiancyrillic:1249,dzecyrillic:1109,dzhecyrillic:1119,e:101,eacute:233,earth:9793,ebengali:2447,ebopomofo:12572,ebreve:277,ecandradeva:2317,ecandragujarati:2701,ecandravowelsigndeva:2373,ecandravowelsigngujarati:2757,ecaron:283,ecedillabreve:7709,echarmenian:1381,echyiwnarmenian:1415,ecircle:9428,ecircumflex:234,ecircumflexacute:7871,ecircumflexbelow:7705,ecircumflexdotbelow:7879,ecircumflexgrave:7873,ecircumflexhookabove:7875,ecircumflextilde:7877,ecyrillic:1108,edblgrave:517,edeva:2319,edieresis:235,edot:279,edotaccent:279,edotbelow:7865,eegurmukhi:2575,eematragurmukhi:2631,efcyrillic:1092,egrave:232,egujarati:2703,eharmenian:1383,ehbopomofo:12573,ehiragana:12360,ehookabove:7867,eibopomofo:12575,eight:56,eightarabic:1640,eightbengali:2542,eightcircle:9319,eightcircleinversesansserif:10129,eightdeva:2414,eighteencircle:9329,eighteenparen:9349,eighteenperiod:9369,eightgujarati:2798,eightgurmukhi:2670,eighthackarabic:1640,eighthangzhou:12328,eighthnotebeamed:9835,eightideographicparen:12839,eightinferior:8328,eightmonospace:65304,eightoldstyle:63288,eightparen:9339,eightperiod:9359,eightpersian:1784,eightroman:8567,eightsuperior:8312,eightthai:3672,einvertedbreve:519,eiotifiedcyrillic:1125,ekatakana:12456,ekatakanahalfwidth:65396,ekonkargurmukhi:2676,ekorean:12628,elcyrillic:1083,element:8712,elevencircle:9322,elevenparen:9342,elevenperiod:9362,elevenroman:8570,ellipsis:8230,ellipsisvertical:8942,emacron:275,emacronacute:7703,emacrongrave:7701,emcyrillic:1084,emdash:8212,emdashvertical:65073,emonospace:65349,emphasismarkarmenian:1371,emptyset:8709,enbopomofo:12579,encyrillic:1085,endash:8211,endashvertical:65074,endescendercyrillic:1187,eng:331,engbopomofo:12581,enghecyrillic:1189,enhookcyrillic:1224,enspace:8194,eogonek:281,eokorean:12627,eopen:603,eopenclosed:666,eopenreversed:604,eopenreversedclosed:606,eopenreversedhook:605,eparen:9376,epsilon:949,epsilontonos:941,equal:61,equalmonospace:65309,equalsmall:65126,equalsuperior:8316,equivalence:8801,erbopomofo:12582,ercyrillic:1088,ereversed:600,ereversedcyrillic:1101,escyrillic:1089,esdescendercyrillic:1195,esh:643,eshcurl:646,eshortdeva:2318,eshortvowelsigndeva:2374,eshreversedloop:426,eshsquatreversed:645,esmallhiragana:12359,esmallkatakana:12455,esmallkatakanahalfwidth:65386,estimated:8494,esuperior:63212,eta:951,etarmenian:1384,etatonos:942,eth:240,etilde:7869,etildebelow:7707,etnahtafoukhhebrew:1425,etnahtafoukhlefthebrew:1425,etnahtahebrew:1425,etnahtalefthebrew:1425,eturned:477,eukorean:12641,euro:8364,evowelsignbengali:2503,evowelsigndeva:2375,evowelsigngujarati:2759,exclam:33,exclamarmenian:1372,exclamdbl:8252,exclamdown:161,exclamdownsmall:63393,exclammonospace:65281,exclamsmall:63265,existential:8707,ezh:658,ezhcaron:495,ezhcurl:659,ezhreversed:441,ezhtail:442,f:102,fadeva:2398,fagurmukhi:2654,fahrenheit:8457,fathaarabic:1614,fathalowarabic:1614,fathatanarabic:1611,fbopomofo:12552,fcircle:9429,fdotaccent:7711,feharabic:1601,feharmenian:1414,fehfinalarabic:65234,fehinitialarabic:65235,fehmedialarabic:65236,feicoptic:997,female:9792,ff:64256,ffi:64259,ffl:64260,fi:64257,fifteencircle:9326,fifteenparen:9346,fifteenperiod:9366,figuredash:8210,filledbox:9632,filledrect:9644,finalkaf:1498,finalkafdagesh:64314,finalkafdageshhebrew:64314,finalkafhebrew:1498,finalmem:1501,finalmemhebrew:1501,finalnun:1503,finalnunhebrew:1503,finalpe:1507,finalpehebrew:1507,finaltsadi:1509,finaltsadihebrew:1509,firsttonechinese:713,fisheye:9673,fitacyrillic:1139,five:53,fivearabic:1637,fivebengali:2539,fivecircle:9316,fivecircleinversesansserif:10126,fivedeva:2411,fiveeighths:8541,fivegujarati:2795,fivegurmukhi:2667,fivehackarabic:1637,fivehangzhou:12325,fiveideographicparen:12836,fiveinferior:8325,fivemonospace:65301,fiveoldstyle:63285,fiveparen:9336,fiveperiod:9356,fivepersian:1781,fiveroman:8564,fivesuperior:8309,fivethai:3669,fl:64258,florin:402,fmonospace:65350,fmsquare:13209,fofanthai:3615,fofathai:3613,fongmanthai:3663,forall:8704,four:52,fourarabic:1636,fourbengali:2538,fourcircle:9315,fourcircleinversesansserif:10125,fourdeva:2410,fourgujarati:2794,fourgurmukhi:2666,fourhackarabic:1636,fourhangzhou:12324,fourideographicparen:12835,fourinferior:8324,fourmonospace:65300,fournumeratorbengali:2551,fouroldstyle:63284,fourparen:9335,fourperiod:9355,fourpersian:1780,fourroman:8563,foursuperior:8308,fourteencircle:9325,fourteenparen:9345,fourteenperiod:9365,fourthai:3668,fourthtonechinese:715,fparen:9377,fraction:8260,franc:8355,g:103,gabengali:2455,gacute:501,gadeva:2327,gafarabic:1711,gaffinalarabic:64403,gafinitialarabic:64404,gafmedialarabic:64405,gagujarati:2711,gagurmukhi:2583,gahiragana:12364,gakatakana:12460,gamma:947,gammalatinsmall:611,gammasuperior:736,gangiacoptic:1003,gbopomofo:12557,gbreve:287,gcaron:487,gcedilla:291,gcircle:9430,gcircumflex:285,gcommaaccent:291,gdot:289,gdotaccent:289,gecyrillic:1075,gehiragana:12370,gekatakana:12466,geometricallyequal:8785,gereshaccenthebrew:1436,gereshhebrew:1523,gereshmuqdamhebrew:1437,germandbls:223,gershayimaccenthebrew:1438,gershayimhebrew:1524,getamark:12307,ghabengali:2456,ghadarmenian:1394,ghadeva:2328,ghagujarati:2712,ghagurmukhi:2584,ghainarabic:1594,ghainfinalarabic:65230,ghaininitialarabic:65231,ghainmedialarabic:65232,ghemiddlehookcyrillic:1173,ghestrokecyrillic:1171,gheupturncyrillic:1169,ghhadeva:2394,ghhagurmukhi:2650,ghook:608,ghzsquare:13203,gihiragana:12366,gikatakana:12462,gimarmenian:1379,gimel:1490,gimeldagesh:64306,gimeldageshhebrew:64306,gimelhebrew:1490,gjecyrillic:1107,glottalinvertedstroke:446,glottalstop:660,glottalstopinverted:662,glottalstopmod:704,glottalstopreversed:661,glottalstopreversedmod:705,glottalstopreversedsuperior:740,glottalstopstroke:673,glottalstopstrokereversed:674,gmacron:7713,gmonospace:65351,gohiragana:12372,gokatakana:12468,gparen:9378,gpasquare:13228,gradient:8711,grave:96,gravebelowcmb:790,gravecmb:768,gravecomb:768,gravedeva:2387,gravelowmod:718,gravemonospace:65344,gravetonecmb:832,greater:62,greaterequal:8805,greaterequalorless:8923,greatermonospace:65310,greaterorequivalent:8819,greaterorless:8823,greateroverequal:8807,greatersmall:65125,gscript:609,gstroke:485,guhiragana:12368,guillemotleft:171,guillemotright:187,guilsinglleft:8249,guilsinglright:8250,gukatakana:12464,guramusquare:13080,gysquare:13257,h:104,haabkhasiancyrillic:1193,haaltonearabic:1729,habengali:2489,hadescendercyrillic:1203,hadeva:2361,hagujarati:2745,hagurmukhi:2617,haharabic:1581,hahfinalarabic:65186,hahinitialarabic:65187,hahiragana:12399,hahmedialarabic:65188,haitusquare:13098,hakatakana:12495,hakatakanahalfwidth:65418,halantgurmukhi:2637,hamzaarabic:1569,hamzalowarabic:1569,hangulfiller:12644,hardsigncyrillic:1098,harpoonleftbarbup:8636,harpoonrightbarbup:8640,hasquare:13258,hatafpatah:1458,hatafpatah16:1458,hatafpatah23:1458,hatafpatah2f:1458,hatafpatahhebrew:1458,hatafpatahnarrowhebrew:1458,hatafpatahquarterhebrew:1458,hatafpatahwidehebrew:1458,hatafqamats:1459,hatafqamats1b:1459,hatafqamats28:1459,hatafqamats34:1459,hatafqamatshebrew:1459,hatafqamatsnarrowhebrew:1459,hatafqamatsquarterhebrew:1459,hatafqamatswidehebrew:1459,hatafsegol:1457,hatafsegol17:1457,hatafsegol24:1457,hatafsegol30:1457,hatafsegolhebrew:1457,hatafsegolnarrowhebrew:1457,hatafsegolquarterhebrew:1457,hatafsegolwidehebrew:1457,hbar:295,hbopomofo:12559,hbrevebelow:7723,hcedilla:7721,hcircle:9431,hcircumflex:293,hdieresis:7719,hdotaccent:7715,hdotbelow:7717,he:1492,heart:9829,heartsuitblack:9829,heartsuitwhite:9825,hedagesh:64308,hedageshhebrew:64308,hehaltonearabic:1729,heharabic:1607,hehebrew:1492,hehfinalaltonearabic:64423,hehfinalalttwoarabic:65258,hehfinalarabic:65258,hehhamzaabovefinalarabic:64421,hehhamzaaboveisolatedarabic:64420,hehinitialaltonearabic:64424,hehinitialarabic:65259,hehiragana:12408,hehmedialaltonearabic:64425,hehmedialarabic:65260,heiseierasquare:13179,hekatakana:12504,hekatakanahalfwidth:65421,hekutaarusquare:13110,henghook:615,herutusquare:13113,het:1495,hethebrew:1495,hhook:614,hhooksuperior:689,hieuhacirclekorean:12923,hieuhaparenkorean:12827,hieuhcirclekorean:12909,hieuhkorean:12622,hieuhparenkorean:12813,hihiragana:12402,hikatakana:12498,hikatakanahalfwidth:65419,hiriq:1460,hiriq14:1460,hiriq21:1460,hiriq2d:1460,hiriqhebrew:1460,hiriqnarrowhebrew:1460,hiriqquarterhebrew:1460,hiriqwidehebrew:1460,hlinebelow:7830,hmonospace:65352,hoarmenian:1392,hohipthai:3627,hohiragana:12411,hokatakana:12507,hokatakanahalfwidth:65422,holam:1465,holam19:1465,holam26:1465,holam32:1465,holamhebrew:1465,holamnarrowhebrew:1465,holamquarterhebrew:1465,holamwidehebrew:1465,honokhukthai:3630,hookabovecomb:777,hookcmb:777,hookpalatalizedbelowcmb:801,hookretroflexbelowcmb:802,hoonsquare:13122,horicoptic:1001,horizontalbar:8213,horncmb:795,hotsprings:9832,house:8962,hparen:9379,hsuperior:688,hturned:613,huhiragana:12405,huiitosquare:13107,hukatakana:12501,hukatakanahalfwidth:65420,hungarumlaut:733,hungarumlautcmb:779,hv:405,hyphen:45,hypheninferior:63205,hyphenmonospace:65293,hyphensmall:65123,hyphensuperior:63206,hyphentwo:8208,i:105,iacute:237,iacyrillic:1103,ibengali:2439,ibopomofo:12583,ibreve:301,icaron:464,icircle:9432,icircumflex:238,icyrillic:1110,idblgrave:521,ideographearthcircle:12943,ideographfirecircle:12939,ideographicallianceparen:12863,ideographiccallparen:12858,ideographiccentrecircle:12965,ideographicclose:12294,ideographiccomma:12289,ideographiccommaleft:65380,ideographiccongratulationparen:12855,ideographiccorrectcircle:12963,ideographicearthparen:12847,ideographicenterpriseparen:12861,ideographicexcellentcircle:12957,ideographicfestivalparen:12864,ideographicfinancialcircle:12950,ideographicfinancialparen:12854,ideographicfireparen:12843,ideographichaveparen:12850,ideographichighcircle:12964,ideographiciterationmark:12293,ideographiclaborcircle:12952,ideographiclaborparen:12856,ideographicleftcircle:12967,ideographiclowcircle:12966,ideographicmedicinecircle:12969,ideographicmetalparen:12846,ideographicmoonparen:12842,ideographicnameparen:12852,ideographicperiod:12290,ideographicprintcircle:12958,ideographicreachparen:12867,ideographicrepresentparen:12857,ideographicresourceparen:12862,ideographicrightcircle:12968,ideographicsecretcircle:12953,ideographicselfparen:12866,ideographicsocietyparen:12851,ideographicspace:12288,ideographicspecialparen:12853,ideographicstockparen:12849,ideographicstudyparen:12859,ideographicsunparen:12848,ideographicsuperviseparen:12860,ideographicwaterparen:12844,ideographicwoodparen:12845,ideographiczero:12295,ideographmetalcircle:12942,ideographmooncircle:12938,ideographnamecircle:12948,ideographsuncircle:12944,ideographwatercircle:12940,ideographwoodcircle:12941,ideva:2311,idieresis:239,idieresisacute:7727,idieresiscyrillic:1253,idotbelow:7883,iebrevecyrillic:1239,iecyrillic:1077,ieungacirclekorean:12917,ieungaparenkorean:12821,ieungcirclekorean:12903,ieungkorean:12615,ieungparenkorean:12807,igrave:236,igujarati:2695,igurmukhi:2567,ihiragana:12356,ihookabove:7881,iibengali:2440,iicyrillic:1080,iideva:2312,iigujarati:2696,iigurmukhi:2568,iimatragurmukhi:2624,iinvertedbreve:523,iishortcyrillic:1081,iivowelsignbengali:2496,iivowelsigndeva:2368,iivowelsigngujarati:2752,ij:307,ikatakana:12452,ikatakanahalfwidth:65394,ikorean:12643,ilde:732,iluyhebrew:1452,imacron:299,imacroncyrillic:1251,imageorapproximatelyequal:8787,imatragurmukhi:2623,imonospace:65353,increment:8710,infinity:8734,iniarmenian:1387,integral:8747,integralbottom:8993,integralbt:8993,integralex:63733,integraltop:8992,integraltp:8992,intersection:8745,intisquare:13061,invbullet:9688,invcircle:9689,invsmileface:9787,iocyrillic:1105,iogonek:303,iota:953,iotadieresis:970,iotadieresistonos:912,iotalatin:617,iotatonos:943,iparen:9380,irigurmukhi:2674,ismallhiragana:12355,ismallkatakana:12451,ismallkatakanahalfwidth:65384,issharbengali:2554,istroke:616,isuperior:63213,iterationhiragana:12445,iterationkatakana:12541,itilde:297,itildebelow:7725,iubopomofo:12585,iucyrillic:1102,ivowelsignbengali:2495,ivowelsigndeva:2367,ivowelsigngujarati:2751,izhitsacyrillic:1141,izhitsadblgravecyrillic:1143,j:106,jaarmenian:1393,jabengali:2460,jadeva:2332,jagujarati:2716,jagurmukhi:2588,jbopomofo:12560,jcaron:496,jcircle:9433,jcircumflex:309,jcrossedtail:669,jdotlessstroke:607,jecyrillic:1112,jeemarabic:1580,jeemfinalarabic:65182,jeeminitialarabic:65183,jeemmedialarabic:65184,jeharabic:1688,jehfinalarabic:64395,jhabengali:2461,jhadeva:2333,jhagujarati:2717,jhagurmukhi:2589,jheharmenian:1403,jis:12292,jmonospace:65354,jparen:9381,jsuperior:690,k:107,kabashkircyrillic:1185,kabengali:2453,kacute:7729,kacyrillic:1082,kadescendercyrillic:1179,kadeva:2325,kaf:1499,kafarabic:1603,kafdagesh:64315,kafdageshhebrew:64315,kaffinalarabic:65242,kafhebrew:1499,kafinitialarabic:65243,kafmedialarabic:65244,kafrafehebrew:64333,kagujarati:2709,kagurmukhi:2581,kahiragana:12363,kahookcyrillic:1220,kakatakana:12459,kakatakanahalfwidth:65398,kappa:954,kappasymbolgreek:1008,kapyeounmieumkorean:12657,kapyeounphieuphkorean:12676,kapyeounpieupkorean:12664,kapyeounssangpieupkorean:12665,karoriisquare:13069,kashidaautoarabic:1600,kashidaautonosidebearingarabic:1600,kasmallkatakana:12533,kasquare:13188,kasraarabic:1616,kasratanarabic:1613,kastrokecyrillic:1183,katahiraprolongmarkhalfwidth:65392,kaverticalstrokecyrillic:1181,kbopomofo:12558,kcalsquare:13193,kcaron:489,kcedilla:311,kcircle:9434,kcommaaccent:311,kdotbelow:7731,keharmenian:1412,kehiragana:12369,kekatakana:12465,kekatakanahalfwidth:65401,kenarmenian:1391,kesmallkatakana:12534,kgreenlandic:312,khabengali:2454,khacyrillic:1093,khadeva:2326,khagujarati:2710,khagurmukhi:2582,khaharabic:1582,khahfinalarabic:65190,khahinitialarabic:65191,khahmedialarabic:65192,kheicoptic:999,khhadeva:2393,khhagurmukhi:2649,khieukhacirclekorean:12920,khieukhaparenkorean:12824,khieukhcirclekorean:12906,khieukhkorean:12619,khieukhparenkorean:12810,khokhaithai:3586,khokhonthai:3589,khokhuatthai:3587,khokhwaithai:3588,khomutthai:3675,khook:409,khorakhangthai:3590,khzsquare:13201,kihiragana:12365,kikatakana:12461,kikatakanahalfwidth:65399,kiroguramusquare:13077,kiromeetorusquare:13078,kirosquare:13076,kiyeokacirclekorean:12910,kiyeokaparenkorean:12814,kiyeokcirclekorean:12896,kiyeokkorean:12593,kiyeokparenkorean:12800,kiyeoksioskorean:12595,kjecyrillic:1116,klinebelow:7733,klsquare:13208,kmcubedsquare:13222,kmonospace:65355,kmsquaredsquare:13218,kohiragana:12371,kohmsquare:13248,kokaithai:3585,kokatakana:12467,kokatakanahalfwidth:65402,kooposquare:13086,koppacyrillic:1153,koreanstandardsymbol:12927,koroniscmb:835,kparen:9382,kpasquare:13226,ksicyrillic:1135,ktsquare:13263,kturned:670,kuhiragana:12367,kukatakana:12463,kukatakanahalfwidth:65400,kvsquare:13240,kwsquare:13246,l:108,labengali:2482,lacute:314,ladeva:2354,lagujarati:2738,lagurmukhi:2610,lakkhangyaothai:3653,lamaleffinalarabic:65276,lamalefhamzaabovefinalarabic:65272,lamalefhamzaaboveisolatedarabic:65271,lamalefhamzabelowfinalarabic:65274,lamalefhamzabelowisolatedarabic:65273,lamalefisolatedarabic:65275,lamalefmaddaabovefinalarabic:65270,lamalefmaddaaboveisolatedarabic:65269,lamarabic:1604,lambda:955,lambdastroke:411,lamed:1500,lameddagesh:64316,lameddageshhebrew:64316, +lamedhebrew:1500,lamfinalarabic:65246,lamhahinitialarabic:64714,laminitialarabic:65247,lamjeeminitialarabic:64713,lamkhahinitialarabic:64715,lamlamhehisolatedarabic:65010,lammedialarabic:65248,lammeemhahinitialarabic:64904,lammeeminitialarabic:64716,largecircle:9711,lbar:410,lbelt:620,lbopomofo:12556,lcaron:318,lcedilla:316,lcircle:9435,lcircumflexbelow:7741,lcommaaccent:316,ldot:320,ldotaccent:320,ldotbelow:7735,ldotbelowmacron:7737,leftangleabovecmb:794,lefttackbelowcmb:792,less:60,lessequal:8804,lessequalorgreater:8922,lessmonospace:65308,lessorequivalent:8818,lessorgreater:8822,lessoverequal:8806,lesssmall:65124,lezh:622,lfblock:9612,lhookretroflex:621,lira:8356,liwnarmenian:1388,lj:457,ljecyrillic:1113,ll:63168,lladeva:2355,llagujarati:2739,llinebelow:7739,llladeva:2356,llvocalicbengali:2529,llvocalicdeva:2401,llvocalicvowelsignbengali:2531,llvocalicvowelsigndeva:2403,lmiddletilde:619,lmonospace:65356,lmsquare:13264,lochulathai:3628,logicaland:8743,logicalnot:172,logicalnotreversed:8976,logicalor:8744,lolingthai:3621,longs:383,lowlinecenterline:65102,lowlinecmb:818,lowlinedashed:65101,lozenge:9674,lparen:9383,lslash:322,lsquare:8467,lsuperior:63214,ltshade:9617,luthai:3622,lvocalicbengali:2444,lvocalicdeva:2316,lvocalicvowelsignbengali:2530,lvocalicvowelsigndeva:2402,lxsquare:13267,m:109,mabengali:2478,macron:175,macronbelowcmb:817,macroncmb:772,macronlowmod:717,macronmonospace:65507,macute:7743,madeva:2350,magujarati:2734,magurmukhi:2606,mahapakhhebrew:1444,mahapakhlefthebrew:1444,mahiragana:12414,maichattawalowleftthai:63637,maichattawalowrightthai:63636,maichattawathai:3659,maichattawaupperleftthai:63635,maieklowleftthai:63628,maieklowrightthai:63627,maiekthai:3656,maiekupperleftthai:63626,maihanakatleftthai:63620,maihanakatthai:3633,maitaikhuleftthai:63625,maitaikhuthai:3655,maitholowleftthai:63631,maitholowrightthai:63630,maithothai:3657,maithoupperleftthai:63629,maitrilowleftthai:63634,maitrilowrightthai:63633,maitrithai:3658,maitriupperleftthai:63632,maiyamokthai:3654,makatakana:12510,makatakanahalfwidth:65423,male:9794,mansyonsquare:13127,maqafhebrew:1470,mars:9794,masoracirclehebrew:1455,masquare:13187,mbopomofo:12551,mbsquare:13268,mcircle:9436,mcubedsquare:13221,mdotaccent:7745,mdotbelow:7747,meemarabic:1605,meemfinalarabic:65250,meeminitialarabic:65251,meemmedialarabic:65252,meemmeeminitialarabic:64721,meemmeemisolatedarabic:64584,meetorusquare:13133,mehiragana:12417,meizierasquare:13182,mekatakana:12513,mekatakanahalfwidth:65426,mem:1502,memdagesh:64318,memdageshhebrew:64318,memhebrew:1502,menarmenian:1396,merkhahebrew:1445,merkhakefulahebrew:1446,merkhakefulalefthebrew:1446,merkhalefthebrew:1445,mhook:625,mhzsquare:13202,middledotkatakanahalfwidth:65381,middot:183,mieumacirclekorean:12914,mieumaparenkorean:12818,mieumcirclekorean:12900,mieumkorean:12609,mieumpansioskorean:12656,mieumparenkorean:12804,mieumpieupkorean:12654,mieumsioskorean:12655,mihiragana:12415,mikatakana:12511,mikatakanahalfwidth:65424,minus:8722,minusbelowcmb:800,minuscircle:8854,minusmod:727,minusplus:8723,minute:8242,miribaarusquare:13130,mirisquare:13129,mlonglegturned:624,mlsquare:13206,mmcubedsquare:13219,mmonospace:65357,mmsquaredsquare:13215,mohiragana:12418,mohmsquare:13249,mokatakana:12514,mokatakanahalfwidth:65427,molsquare:13270,momathai:3617,moverssquare:13223,moverssquaredsquare:13224,mparen:9384,mpasquare:13227,mssquare:13235,msuperior:63215,mturned:623,mu:181,mu1:181,muasquare:13186,muchgreater:8811,muchless:8810,mufsquare:13196,mugreek:956,mugsquare:13197,muhiragana:12416,mukatakana:12512,mukatakanahalfwidth:65425,mulsquare:13205,multiply:215,mumsquare:13211,munahhebrew:1443,munahlefthebrew:1443,musicalnote:9834,musicalnotedbl:9835,musicflatsign:9837,musicsharpsign:9839,mussquare:13234,muvsquare:13238,muwsquare:13244,mvmegasquare:13241,mvsquare:13239,mwmegasquare:13247,mwsquare:13245,n:110,nabengali:2472,nabla:8711,nacute:324,nadeva:2344,nagujarati:2728,nagurmukhi:2600,nahiragana:12394,nakatakana:12490,nakatakanahalfwidth:65413,napostrophe:329,nasquare:13185,nbopomofo:12555,nbspace:160,ncaron:328,ncedilla:326,ncircle:9437,ncircumflexbelow:7755,ncommaaccent:326,ndotaccent:7749,ndotbelow:7751,nehiragana:12397,nekatakana:12493,nekatakanahalfwidth:65416,newsheqelsign:8362,nfsquare:13195,ngabengali:2457,ngadeva:2329,ngagujarati:2713,ngagurmukhi:2585,ngonguthai:3591,nhiragana:12435,nhookleft:626,nhookretroflex:627,nieunacirclekorean:12911,nieunaparenkorean:12815,nieuncieuckorean:12597,nieuncirclekorean:12897,nieunhieuhkorean:12598,nieunkorean:12596,nieunpansioskorean:12648,nieunparenkorean:12801,nieunsioskorean:12647,nieuntikeutkorean:12646,nihiragana:12395,nikatakana:12491,nikatakanahalfwidth:65414,nikhahitleftthai:63641,nikhahitthai:3661,nine:57,ninearabic:1641,ninebengali:2543,ninecircle:9320,ninecircleinversesansserif:10130,ninedeva:2415,ninegujarati:2799,ninegurmukhi:2671,ninehackarabic:1641,ninehangzhou:12329,nineideographicparen:12840,nineinferior:8329,ninemonospace:65305,nineoldstyle:63289,nineparen:9340,nineperiod:9360,ninepersian:1785,nineroman:8568,ninesuperior:8313,nineteencircle:9330,nineteenparen:9350,nineteenperiod:9370,ninethai:3673,nj:460,njecyrillic:1114,nkatakana:12531,nkatakanahalfwidth:65437,nlegrightlong:414,nlinebelow:7753,nmonospace:65358,nmsquare:13210,nnabengali:2467,nnadeva:2339,nnagujarati:2723,nnagurmukhi:2595,nnnadeva:2345,nohiragana:12398,nokatakana:12494,nokatakanahalfwidth:65417,nonbreakingspace:160,nonenthai:3603,nonuthai:3609,noonarabic:1606,noonfinalarabic:65254,noonghunnaarabic:1722,noonghunnafinalarabic:64415,nooninitialarabic:65255,noonjeeminitialarabic:64722,noonjeemisolatedarabic:64587,noonmedialarabic:65256,noonmeeminitialarabic:64725,noonmeemisolatedarabic:64590,noonnoonfinalarabic:64653,notcontains:8716,notelement:8713,notelementof:8713,notequal:8800,notgreater:8815,notgreaternorequal:8817,notgreaternorless:8825,notidentical:8802,notless:8814,notlessnorequal:8816,notparallel:8742,notprecedes:8832,notsubset:8836,notsucceeds:8833,notsuperset:8837,nowarmenian:1398,nparen:9385,nssquare:13233,nsuperior:8319,ntilde:241,nu:957,nuhiragana:12396,nukatakana:12492,nukatakanahalfwidth:65415,nuktabengali:2492,nuktadeva:2364,nuktagujarati:2748,nuktagurmukhi:2620,numbersign:35,numbersignmonospace:65283,numbersignsmall:65119,numeralsigngreek:884,numeralsignlowergreek:885,numero:8470,nun:1504,nundagesh:64320,nundageshhebrew:64320,nunhebrew:1504,nvsquare:13237,nwsquare:13243,nyabengali:2462,nyadeva:2334,nyagujarati:2718,nyagurmukhi:2590,o:111,oacute:243,oangthai:3629,obarred:629,obarredcyrillic:1257,obarreddieresiscyrillic:1259,obengali:2451,obopomofo:12571,obreve:335,ocandradeva:2321,ocandragujarati:2705,ocandravowelsigndeva:2377,ocandravowelsigngujarati:2761,ocaron:466,ocircle:9438,ocircumflex:244,ocircumflexacute:7889,ocircumflexdotbelow:7897,ocircumflexgrave:7891,ocircumflexhookabove:7893,ocircumflextilde:7895,ocyrillic:1086,odblacute:337,odblgrave:525,odeva:2323,odieresis:246,odieresiscyrillic:1255,odotbelow:7885,oe:339,oekorean:12634,ogonek:731,ogonekcmb:808,ograve:242,ogujarati:2707,oharmenian:1413,ohiragana:12362,ohookabove:7887,ohorn:417,ohornacute:7899,ohorndotbelow:7907,ohorngrave:7901,ohornhookabove:7903,ohorntilde:7905,ohungarumlaut:337,oi:419,oinvertedbreve:527,okatakana:12458,okatakanahalfwidth:65397,okorean:12631,olehebrew:1451,omacron:333,omacronacute:7763,omacrongrave:7761,omdeva:2384,omega:969,omega1:982,omegacyrillic:1121,omegalatinclosed:631,omegaroundcyrillic:1147,omegatitlocyrillic:1149,omegatonos:974,omgujarati:2768,omicron:959,omicrontonos:972,omonospace:65359,one:49,onearabic:1633,onebengali:2535,onecircle:9312,onecircleinversesansserif:10122,onedeva:2407,onedotenleader:8228,oneeighth:8539,onefitted:63196,onegujarati:2791,onegurmukhi:2663,onehackarabic:1633,onehalf:189,onehangzhou:12321,oneideographicparen:12832,oneinferior:8321,onemonospace:65297,onenumeratorbengali:2548,oneoldstyle:63281,oneparen:9332,oneperiod:9352,onepersian:1777,onequarter:188,oneroman:8560,onesuperior:185,onethai:3665,onethird:8531,oogonek:491,oogonekmacron:493,oogurmukhi:2579,oomatragurmukhi:2635,oopen:596,oparen:9386,openbullet:9702,option:8997,ordfeminine:170,ordmasculine:186,orthogonal:8735,oshortdeva:2322,oshortvowelsigndeva:2378,oslash:248,oslashacute:511,osmallhiragana:12361,osmallkatakana:12457,osmallkatakanahalfwidth:65387,ostrokeacute:511,osuperior:63216,otcyrillic:1151,otilde:245,otildeacute:7757,otildedieresis:7759,oubopomofo:12577,overline:8254,overlinecenterline:65098,overlinecmb:773,overlinedashed:65097,overlinedblwavy:65100,overlinewavy:65099,overscore:175,ovowelsignbengali:2507,ovowelsigndeva:2379,ovowelsigngujarati:2763,p:112,paampssquare:13184,paasentosquare:13099,pabengali:2474,pacute:7765,padeva:2346,pagedown:8671,pageup:8670,pagujarati:2730,pagurmukhi:2602,pahiragana:12401,paiyannoithai:3631,pakatakana:12497,palatalizationcyrilliccmb:1156,palochkacyrillic:1216,pansioskorean:12671,paragraph:182,parallel:8741,parenleft:40,parenleftaltonearabic:64830,parenleftbt:63725,parenleftex:63724,parenleftinferior:8333,parenleftmonospace:65288,parenleftsmall:65113,parenleftsuperior:8317,parenlefttp:63723,parenleftvertical:65077,parenright:41,parenrightaltonearabic:64831,parenrightbt:63736,parenrightex:63735,parenrightinferior:8334,parenrightmonospace:65289,parenrightsmall:65114,parenrightsuperior:8318,parenrighttp:63734,parenrightvertical:65078,partialdiff:8706,paseqhebrew:1472,pashtahebrew:1433,pasquare:13225,patah:1463,patah11:1463,patah1d:1463,patah2a:1463,patahhebrew:1463,patahnarrowhebrew:1463,patahquarterhebrew:1463,patahwidehebrew:1463,pazerhebrew:1441,pbopomofo:12550,pcircle:9439,pdotaccent:7767,pe:1508,pecyrillic:1087,pedagesh:64324,pedageshhebrew:64324,peezisquare:13115,pefinaldageshhebrew:64323,peharabic:1662,peharmenian:1402,pehebrew:1508,pehfinalarabic:64343,pehinitialarabic:64344,pehiragana:12410,pehmedialarabic:64345,pekatakana:12506,pemiddlehookcyrillic:1191,perafehebrew:64334,percent:37,percentarabic:1642,percentmonospace:65285,percentsmall:65130,period:46,periodarmenian:1417,periodcentered:183,periodhalfwidth:65377,periodinferior:63207,periodmonospace:65294,periodsmall:65106,periodsuperior:63208,perispomenigreekcmb:834,perpendicular:8869,perthousand:8240,peseta:8359,pfsquare:13194,phabengali:2475,phadeva:2347,phagujarati:2731,phagurmukhi:2603,phi:966,phi1:981,phieuphacirclekorean:12922,phieuphaparenkorean:12826,phieuphcirclekorean:12908,phieuphkorean:12621,phieuphparenkorean:12812,philatin:632,phinthuthai:3642,phisymbolgreek:981,phook:421,phophanthai:3614,phophungthai:3612,phosamphaothai:3616,pi:960,pieupacirclekorean:12915,pieupaparenkorean:12819,pieupcieuckorean:12662,pieupcirclekorean:12901,pieupkiyeokkorean:12658,pieupkorean:12610,pieupparenkorean:12805,pieupsioskiyeokkorean:12660,pieupsioskorean:12612,pieupsiostikeutkorean:12661,pieupthieuthkorean:12663,pieuptikeutkorean:12659,pihiragana:12404,pikatakana:12500,pisymbolgreek:982,piwrarmenian:1411,plus:43,plusbelowcmb:799,pluscircle:8853,plusminus:177,plusmod:726,plusmonospace:65291,plussmall:65122,plussuperior:8314,pmonospace:65360,pmsquare:13272,pohiragana:12413,pointingindexdownwhite:9759,pointingindexleftwhite:9756,pointingindexrightwhite:9758,pointingindexupwhite:9757,pokatakana:12509,poplathai:3611,postalmark:12306,postalmarkface:12320,pparen:9387,precedes:8826,prescription:8478,primemod:697,primereversed:8245,product:8719,projective:8965,prolongedkana:12540,propellor:8984,propersubset:8834,propersuperset:8835,proportion:8759,proportional:8733,psi:968,psicyrillic:1137,psilipneumatacyrilliccmb:1158,pssquare:13232,puhiragana:12407,pukatakana:12503,pvsquare:13236,pwsquare:13242,q:113,qadeva:2392,qadmahebrew:1448,qafarabic:1602,qaffinalarabic:65238,qafinitialarabic:65239,qafmedialarabic:65240,qamats:1464,qamats10:1464,qamats1a:1464,qamats1c:1464,qamats27:1464,qamats29:1464,qamats33:1464,qamatsde:1464,qamatshebrew:1464,qamatsnarrowhebrew:1464,qamatsqatanhebrew:1464,qamatsqatannarrowhebrew:1464,qamatsqatanquarterhebrew:1464,qamatsqatanwidehebrew:1464,qamatsquarterhebrew:1464,qamatswidehebrew:1464,qarneyparahebrew:1439,qbopomofo:12561,qcircle:9440,qhook:672,qmonospace:65361,qof:1511,qofdagesh:64327,qofdageshhebrew:64327,qofhebrew:1511,qparen:9388,quarternote:9833,qubuts:1467,qubuts18:1467,qubuts25:1467,qubuts31:1467,qubutshebrew:1467,qubutsnarrowhebrew:1467,qubutsquarterhebrew:1467,qubutswidehebrew:1467,question:63,questionarabic:1567,questionarmenian:1374,questiondown:191,questiondownsmall:63423,questiongreek:894,questionmonospace:65311,questionsmall:63295,quotedbl:34,quotedblbase:8222,quotedblleft:8220,quotedblmonospace:65282,quotedblprime:12318,quotedblprimereversed:12317,quotedblright:8221,quoteleft:8216,quoteleftreversed:8219,quotereversed:8219,quoteright:8217,quoterightn:329,quotesinglbase:8218,quotesingle:39,quotesinglemonospace:65287,r:114,raarmenian:1404,rabengali:2480,racute:341,radeva:2352,radical:8730,radicalex:63717,radoverssquare:13230,radoverssquaredsquare:13231,radsquare:13229,rafe:1471,rafehebrew:1471,ragujarati:2736,ragurmukhi:2608,rahiragana:12425,rakatakana:12521,rakatakanahalfwidth:65431,ralowerdiagonalbengali:2545,ramiddlediagonalbengali:2544,ramshorn:612,ratio:8758,rbopomofo:12566,rcaron:345,rcedilla:343,rcircle:9441,rcommaaccent:343,rdblgrave:529,rdotaccent:7769,rdotbelow:7771,rdotbelowmacron:7773,referencemark:8251,reflexsubset:8838,reflexsuperset:8839,registered:174,registersans:63720,registerserif:63194,reharabic:1585,reharmenian:1408,rehfinalarabic:65198,rehiragana:12428,rekatakana:12524,rekatakanahalfwidth:65434,resh:1512,reshdageshhebrew:64328,reshhebrew:1512,reversedtilde:8765,reviahebrew:1431,reviamugrashhebrew:1431,revlogicalnot:8976,rfishhook:638,rfishhookreversed:639,rhabengali:2525,rhadeva:2397,rho:961,rhook:637,rhookturned:635,rhookturnedsuperior:693,rhosymbolgreek:1009,rhotichookmod:734,rieulacirclekorean:12913,rieulaparenkorean:12817,rieulcirclekorean:12899,rieulhieuhkorean:12608,rieulkiyeokkorean:12602,rieulkiyeoksioskorean:12649,rieulkorean:12601,rieulmieumkorean:12603,rieulpansioskorean:12652,rieulparenkorean:12803,rieulphieuphkorean:12607,rieulpieupkorean:12604,rieulpieupsioskorean:12651,rieulsioskorean:12605,rieulthieuthkorean:12606,rieultikeutkorean:12650,rieulyeorinhieuhkorean:12653,rightangle:8735,righttackbelowcmb:793,righttriangle:8895,rihiragana:12426,rikatakana:12522,rikatakanahalfwidth:65432,ring:730,ringbelowcmb:805,ringcmb:778,ringhalfleft:703,ringhalfleftarmenian:1369,ringhalfleftbelowcmb:796,ringhalfleftcentered:723,ringhalfright:702,ringhalfrightbelowcmb:825,ringhalfrightcentered:722,rinvertedbreve:531,rittorusquare:13137,rlinebelow:7775,rlongleg:636,rlonglegturned:634,rmonospace:65362,rohiragana:12429,rokatakana:12525,rokatakanahalfwidth:65435,roruathai:3619,rparen:9389,rrabengali:2524,rradeva:2353,rragurmukhi:2652,rreharabic:1681,rrehfinalarabic:64397,rrvocalicbengali:2528,rrvocalicdeva:2400,rrvocalicgujarati:2784,rrvocalicvowelsignbengali:2500,rrvocalicvowelsigndeva:2372,rrvocalicvowelsigngujarati:2756,rsuperior:63217,rtblock:9616,rturned:633,rturnedsuperior:692,ruhiragana:12427,rukatakana:12523,rukatakanahalfwidth:65433,rupeemarkbengali:2546,rupeesignbengali:2547,rupiah:63197,ruthai:3620,rvocalicbengali:2443,rvocalicdeva:2315,rvocalicgujarati:2699,rvocalicvowelsignbengali:2499,rvocalicvowelsigndeva:2371,rvocalicvowelsigngujarati:2755,s:115,sabengali:2488,sacute:347,sacutedotaccent:7781,sadarabic:1589,sadeva:2360,sadfinalarabic:65210,sadinitialarabic:65211,sadmedialarabic:65212,sagujarati:2744,sagurmukhi:2616,sahiragana:12373,sakatakana:12469,sakatakanahalfwidth:65403,sallallahoualayhewasallamarabic:65018,samekh:1505,samekhdagesh:64321,samekhdageshhebrew:64321,samekhhebrew:1505,saraaathai:3634,saraaethai:3649,saraaimaimalaithai:3652,saraaimaimuanthai:3651,saraamthai:3635,saraathai:3632,saraethai:3648,saraiileftthai:63622,saraiithai:3637,saraileftthai:63621,saraithai:3636,saraothai:3650,saraueeleftthai:63624,saraueethai:3639,saraueleftthai:63623,sarauethai:3638,sarauthai:3640,sarauuthai:3641,sbopomofo:12569,scaron:353,scarondotaccent:7783,scedilla:351,schwa:601,schwacyrillic:1241,schwadieresiscyrillic:1243,schwahook:602,scircle:9442,scircumflex:349,scommaaccent:537,sdotaccent:7777,sdotbelow:7779,sdotbelowdotaccent:7785,seagullbelowcmb:828,second:8243,secondtonechinese:714,section:167,seenarabic:1587,seenfinalarabic:65202,seeninitialarabic:65203,seenmedialarabic:65204,segol:1462,segol13:1462,segol1f:1462,segol2c:1462,segolhebrew:1462,segolnarrowhebrew:1462,segolquarterhebrew:1462,segoltahebrew:1426,segolwidehebrew:1462,seharmenian:1405,sehiragana:12379,sekatakana:12475,sekatakanahalfwidth:65406,semicolon:59,semicolonarabic:1563,semicolonmonospace:65307,semicolonsmall:65108,semivoicedmarkkana:12444,semivoicedmarkkanahalfwidth:65439,sentisquare:13090,sentosquare:13091,seven:55,sevenarabic:1639,sevenbengali:2541,sevencircle:9318,sevencircleinversesansserif:10128,sevendeva:2413,seveneighths:8542,sevengujarati:2797,sevengurmukhi:2669,sevenhackarabic:1639,sevenhangzhou:12327,sevenideographicparen:12838,seveninferior:8327,sevenmonospace:65303,sevenoldstyle:63287,sevenparen:9338,sevenperiod:9358,sevenpersian:1783,sevenroman:8566,sevensuperior:8311,seventeencircle:9328,seventeenparen:9348,seventeenperiod:9368,seventhai:3671,sfthyphen:173,shaarmenian:1399,shabengali:2486,shacyrillic:1096,shaddaarabic:1617,shaddadammaarabic:64609,shaddadammatanarabic:64606,shaddafathaarabic:64608,shaddakasraarabic:64610,shaddakasratanarabic:64607,shade:9618,shadedark:9619,shadelight:9617,shademedium:9618,shadeva:2358,shagujarati:2742,shagurmukhi:2614,shalshelethebrew:1427,shbopomofo:12565,shchacyrillic:1097,sheenarabic:1588,sheenfinalarabic:65206,sheeninitialarabic:65207,sheenmedialarabic:65208,sheicoptic:995,sheqel:8362,sheqelhebrew:8362,sheva:1456,sheva115:1456,sheva15:1456,sheva22:1456,sheva2e:1456,shevahebrew:1456,shevanarrowhebrew:1456,shevaquarterhebrew:1456,shevawidehebrew:1456,shhacyrillic:1211,shimacoptic:1005,shin:1513,shindagesh:64329,shindageshhebrew:64329,shindageshshindot:64300,shindageshshindothebrew:64300,shindageshsindot:64301,shindageshsindothebrew:64301,shindothebrew:1473,shinhebrew:1513,shinshindot:64298,shinshindothebrew:64298,shinsindot:64299,shinsindothebrew:64299,shook:642,sigma:963,sigma1:962,sigmafinal:962,sigmalunatesymbolgreek:1010,sihiragana:12375,sikatakana:12471,sikatakanahalfwidth:65404,siluqhebrew:1469,siluqlefthebrew:1469,similar:8764,sindothebrew:1474,siosacirclekorean:12916,siosaparenkorean:12820,sioscieuckorean:12670,sioscirclekorean:12902,sioskiyeokkorean:12666,sioskorean:12613,siosnieunkorean:12667,siosparenkorean:12806,siospieupkorean:12669,siostikeutkorean:12668,six:54,sixarabic:1638,sixbengali:2540,sixcircle:9317,sixcircleinversesansserif:10127,sixdeva:2412,sixgujarati:2796,sixgurmukhi:2668,sixhackarabic:1638,sixhangzhou:12326,sixideographicparen:12837,sixinferior:8326,sixmonospace:65302,sixoldstyle:63286,sixparen:9337,sixperiod:9357,sixpersian:1782,sixroman:8565,sixsuperior:8310,sixteencircle:9327,sixteencurrencydenominatorbengali:2553,sixteenparen:9347,sixteenperiod:9367,sixthai:3670,slash:47,slashmonospace:65295,slong:383,slongdotaccent:7835,smileface:9786,smonospace:65363,sofpasuqhebrew:1475,softhyphen:173,softsigncyrillic:1100,sohiragana:12381,sokatakana:12477,sokatakanahalfwidth:65407,soliduslongoverlaycmb:824,solidusshortoverlaycmb:823,sorusithai:3625,sosalathai:3624,sosothai:3595,sosuathai:3626,space:32,spacehackarabic:32,spade:9824,spadesuitblack:9824,spadesuitwhite:9828,sparen:9390,squarebelowcmb:827,squarecc:13252,squarecm:13213,squarediagonalcrosshatchfill:9641,squarehorizontalfill:9636,squarekg:13199,squarekm:13214,squarekmcapital:13262,squareln:13265,squarelog:13266,squaremg:13198,squaremil:13269,squaremm:13212,squaremsquared:13217,squareorthogonalcrosshatchfill:9638,squareupperlefttolowerrightfill:9639,squareupperrighttolowerleftfill:9640,squareverticalfill:9637,squarewhitewithsmallblack:9635,srsquare:13275,ssabengali:2487,ssadeva:2359,ssagujarati:2743,ssangcieuckorean:12617,ssanghieuhkorean:12677,ssangieungkorean:12672,ssangkiyeokkorean:12594,ssangnieunkorean:12645,ssangpieupkorean:12611,ssangsioskorean:12614,ssangtikeutkorean:12600,ssuperior:63218,sterling:163,sterlingmonospace:65505,strokelongoverlaycmb:822,strokeshortoverlaycmb:821,subset:8834,subsetnotequal:8842,subsetorequal:8838,succeeds:8827,suchthat:8715,suhiragana:12377,sukatakana:12473,sukatakanahalfwidth:65405,sukunarabic:1618,summation:8721,sun:9788,superset:8835,supersetnotequal:8843,supersetorequal:8839,svsquare:13276,syouwaerasquare:13180,t:116,tabengali:2468,tackdown:8868,tackleft:8867,tadeva:2340,tagujarati:2724,tagurmukhi:2596,taharabic:1591,tahfinalarabic:65218,tahinitialarabic:65219,tahiragana:12383,tahmedialarabic:65220,taisyouerasquare:13181,takatakana:12479,takatakanahalfwidth:65408,tatweelarabic:1600,tau:964,tav:1514,tavdages:64330,tavdagesh:64330,tavdageshhebrew:64330,tavhebrew:1514,tbar:359,tbopomofo:12554,tcaron:357,tccurl:680,tcedilla:355,tcheharabic:1670,tchehfinalarabic:64379,tchehinitialarabic:64380,tchehmedialarabic:64381,tcircle:9443,tcircumflexbelow:7793,tcommaaccent:355,tdieresis:7831,tdotaccent:7787,tdotbelow:7789,tecyrillic:1090,tedescendercyrillic:1197,teharabic:1578,tehfinalarabic:65174,tehhahinitialarabic:64674,tehhahisolatedarabic:64524,tehinitialarabic:65175,tehiragana:12390,tehjeeminitialarabic:64673,tehjeemisolatedarabic:64523,tehmarbutaarabic:1577,tehmarbutafinalarabic:65172,tehmedialarabic:65176,tehmeeminitialarabic:64676,tehmeemisolatedarabic:64526,tehnoonfinalarabic:64627,tekatakana:12486,tekatakanahalfwidth:65411,telephone:8481,telephoneblack:9742,telishagedolahebrew:1440,telishaqetanahebrew:1449,tencircle:9321,tenideographicparen:12841,tenparen:9341,tenperiod:9361,tenroman:8569,tesh:679,tet:1496,tetdagesh:64312,tetdageshhebrew:64312,tethebrew:1496,tetsecyrillic:1205,tevirhebrew:1435,tevirlefthebrew:1435,thabengali:2469,thadeva:2341,thagujarati:2725,thagurmukhi:2597,thalarabic:1584,thalfinalarabic:65196,thanthakhatlowleftthai:63640,thanthakhatlowrightthai:63639,thanthakhatthai:3660,thanthakhatupperleftthai:63638,theharabic:1579,thehfinalarabic:65178,thehinitialarabic:65179,thehmedialarabic:65180,thereexists:8707,therefore:8756,theta:952,theta1:977,thetasymbolgreek:977,thieuthacirclekorean:12921,thieuthaparenkorean:12825,thieuthcirclekorean:12907,thieuthkorean:12620,thieuthparenkorean:12811,thirteencircle:9324,thirteenparen:9344,thirteenperiod:9364,thonangmonthothai:3601,thook:429,thophuthaothai:3602,thorn:254,thothahanthai:3607,thothanthai:3600,thothongthai:3608,thothungthai:3606,thousandcyrillic:1154,thousandsseparatorarabic:1644,thousandsseparatorpersian:1644,three:51,threearabic:1635,threebengali:2537,threecircle:9314,threecircleinversesansserif:10124,threedeva:2409,threeeighths:8540,threegujarati:2793,threegurmukhi:2665,threehackarabic:1635,threehangzhou:12323,threeideographicparen:12834,threeinferior:8323,threemonospace:65299,threenumeratorbengali:2550,threeoldstyle:63283,threeparen:9334,threeperiod:9354,threepersian:1779,threequarters:190,threequartersemdash:63198,threeroman:8562,threesuperior:179,threethai:3667,thzsquare:13204,tihiragana:12385,tikatakana:12481,tikatakanahalfwidth:65409,tikeutacirclekorean:12912,tikeutaparenkorean:12816,tikeutcirclekorean:12898,tikeutkorean:12599,tikeutparenkorean:12802,tilde:732,tildebelowcmb:816,tildecmb:771,tildecomb:771,tildedoublecmb:864,tildeoperator:8764,tildeoverlaycmb:820,tildeverticalcmb:830,timescircle:8855,tipehahebrew:1430,tipehalefthebrew:1430,tippigurmukhi:2672,titlocyrilliccmb:1155,tiwnarmenian:1407,tlinebelow:7791,tmonospace:65364,toarmenian:1385,tohiragana:12392,tokatakana:12488,tokatakanahalfwidth:65412,tonebarextrahighmod:741,tonebarextralowmod:745,tonebarhighmod:742,tonebarlowmod:744,tonebarmidmod:743,tonefive:445,tonesix:389,tonetwo:424,tonos:900,tonsquare:13095,topatakthai:3599,tortoiseshellbracketleft:12308,tortoiseshellbracketleftsmall:65117,tortoiseshellbracketleftvertical:65081,tortoiseshellbracketright:12309,tortoiseshellbracketrightsmall:65118,tortoiseshellbracketrightvertical:65082,totaothai:3605,tpalatalhook:427,tparen:9391,trademark:8482,trademarksans:63722,trademarkserif:63195,tretroflexhook:648,triagdn:9660,triaglf:9668,triagrt:9658,triagup:9650,ts:678,tsadi:1510,tsadidagesh:64326,tsadidageshhebrew:64326,tsadihebrew:1510,tsecyrillic:1094,tsere:1461,tsere12:1461,tsere1e:1461,tsere2b:1461,tserehebrew:1461,tserenarrowhebrew:1461,tserequarterhebrew:1461,tserewidehebrew:1461,tshecyrillic:1115,tsuperior:63219,ttabengali:2463,ttadeva:2335,ttagujarati:2719,ttagurmukhi:2591,tteharabic:1657,ttehfinalarabic:64359,ttehinitialarabic:64360,ttehmedialarabic:64361,tthabengali:2464,tthadeva:2336,tthagujarati:2720,tthagurmukhi:2592,tturned:647,tuhiragana:12388,tukatakana:12484,tukatakanahalfwidth:65410,tusmallhiragana:12387,tusmallkatakana:12483,tusmallkatakanahalfwidth:65391,twelvecircle:9323,twelveparen:9343,twelveperiod:9363,twelveroman:8571,twentycircle:9331,twentyhangzhou:21316,twentyparen:9351,twentyperiod:9371,two:50,twoarabic:1634,twobengali:2536,twocircle:9313,twocircleinversesansserif:10123,twodeva:2408,twodotenleader:8229,twodotleader:8229,twodotleadervertical:65072,twogujarati:2792,twogurmukhi:2664,twohackarabic:1634,twohangzhou:12322,twoideographicparen:12833,twoinferior:8322,twomonospace:65298,twonumeratorbengali:2549,twooldstyle:63282,twoparen:9333,twoperiod:9353,twopersian:1778,tworoman:8561,twostroke:443,twosuperior:178,twothai:3666,twothirds:8532,u:117,uacute:250,ubar:649,ubengali:2441,ubopomofo:12584,ubreve:365,ucaron:468,ucircle:9444,ucircumflex:251,ucircumflexbelow:7799,ucyrillic:1091,udattadeva:2385,udblacute:369,udblgrave:533,udeva:2313,udieresis:252,udieresisacute:472,udieresisbelow:7795,udieresiscaron:474,udieresiscyrillic:1265,udieresisgrave:476,udieresismacron:470,udotbelow:7909,ugrave:249,ugujarati:2697,ugurmukhi:2569,uhiragana:12358,uhookabove:7911,uhorn:432,uhornacute:7913,uhorndotbelow:7921,uhorngrave:7915,uhornhookabove:7917,uhorntilde:7919,uhungarumlaut:369,uhungarumlautcyrillic:1267,uinvertedbreve:535,ukatakana:12454,ukatakanahalfwidth:65395,ukcyrillic:1145,ukorean:12636,umacron:363,umacroncyrillic:1263,umacrondieresis:7803,umatragurmukhi:2625,umonospace:65365,underscore:95,underscoredbl:8215,underscoremonospace:65343,underscorevertical:65075,underscorewavy:65103,union:8746,universal:8704,uogonek:371,uparen:9392,upblock:9600,upperdothebrew:1476,upsilon:965,upsilondieresis:971,upsilondieresistonos:944,upsilonlatin:650,upsilontonos:973,uptackbelowcmb:797,uptackmod:724,uragurmukhi:2675,uring:367,ushortcyrillic:1118,usmallhiragana:12357,usmallkatakana:12453,usmallkatakanahalfwidth:65385,ustraightcyrillic:1199,ustraightstrokecyrillic:1201,utilde:361,utildeacute:7801,utildebelow:7797,uubengali:2442,uudeva:2314,uugujarati:2698,uugurmukhi:2570,uumatragurmukhi:2626,uuvowelsignbengali:2498,uuvowelsigndeva:2370,uuvowelsigngujarati:2754,uvowelsignbengali:2497,uvowelsigndeva:2369,uvowelsigngujarati:2753,v:118,vadeva:2357,vagujarati:2741,vagurmukhi:2613,vakatakana:12535,vav:1493,vavdagesh:64309,vavdagesh65:64309,vavdageshhebrew:64309,vavhebrew:1493,vavholam:64331,vavholamhebrew:64331,vavvavhebrew:1520,vavyodhebrew:1521,vcircle:9445,vdotbelow:7807,vecyrillic:1074,veharabic:1700,vehfinalarabic:64363,vehinitialarabic:64364,vehmedialarabic:64365,vekatakana:12537,venus:9792,verticalbar:124,verticallineabovecmb:781,verticallinebelowcmb:809,verticallinelowmod:716,verticallinemod:712,vewarmenian:1406,vhook:651,vikatakana:12536,viramabengali:2509,viramadeva:2381,viramagujarati:2765,visargabengali:2435,visargadeva:2307,visargagujarati:2691,vmonospace:65366,voarmenian:1400,voicediterationhiragana:12446,voicediterationkatakana:12542,voicedmarkkana:12443,voicedmarkkanahalfwidth:65438,vokatakana:12538,vparen:9393,vtilde:7805,vturned:652,vuhiragana:12436,vukatakana:12532,w:119,wacute:7811,waekorean:12633,wahiragana:12431,wakatakana:12527,wakatakanahalfwidth:65436,wakorean:12632,wasmallhiragana:12430,wasmallkatakana:12526,wattosquare:13143,wavedash:12316,wavyunderscorevertical:65076,wawarabic:1608,wawfinalarabic:65262,wawhamzaabovearabic:1572,wawhamzaabovefinalarabic:65158,wbsquare:13277,wcircle:9446,wcircumflex:373,wdieresis:7813,wdotaccent:7815,wdotbelow:7817,wehiragana:12433,weierstrass:8472,wekatakana:12529,wekorean:12638,weokorean:12637,wgrave:7809,whitebullet:9702,whitecircle:9675,whitecircleinverse:9689,whitecornerbracketleft:12302,whitecornerbracketleftvertical:65091,whitecornerbracketright:12303,whitecornerbracketrightvertical:65092,whitediamond:9671,whitediamondcontainingblacksmalldiamond:9672,whitedownpointingsmalltriangle:9663,whitedownpointingtriangle:9661,whiteleftpointingsmalltriangle:9667,whiteleftpointingtriangle:9665,whitelenticularbracketleft:12310,whitelenticularbracketright:12311,whiterightpointingsmalltriangle:9657,whiterightpointingtriangle:9655,whitesmallsquare:9643,whitesmilingface:9786,whitesquare:9633,whitestar:9734,whitetelephone:9743,whitetortoiseshellbracketleft:12312,whitetortoiseshellbracketright:12313,whiteuppointingsmalltriangle:9653,whiteuppointingtriangle:9651,wihiragana:12432,wikatakana:12528,wikorean:12639,wmonospace:65367,wohiragana:12434,wokatakana:12530,wokatakanahalfwidth:65382,won:8361,wonmonospace:65510,wowaenthai:3623,wparen:9394,wring:7832,wsuperior:695,wturned:653,wynn:447,x:120,xabovecmb:829,xbopomofo:12562,xcircle:9447,xdieresis:7821,xdotaccent:7819,xeharmenian:1389,xi:958,xmonospace:65368,xparen:9395,xsuperior:739,y:121,yaadosquare:13134,yabengali:2479,yacute:253,yadeva:2351,yaekorean:12626,yagujarati:2735,yagurmukhi:2607,yahiragana:12420,yakatakana:12516,yakatakanahalfwidth:65428,yakorean:12625,yamakkanthai:3662,yasmallhiragana:12419,yasmallkatakana:12515,yasmallkatakanahalfwidth:65388,yatcyrillic:1123,ycircle:9448,ycircumflex:375,ydieresis:255,ydotaccent:7823,ydotbelow:7925,yeharabic:1610,yehbarreearabic:1746,yehbarreefinalarabic:64431,yehfinalarabic:65266,yehhamzaabovearabic:1574,yehhamzaabovefinalarabic:65162,yehhamzaaboveinitialarabic:65163,yehhamzaabovemedialarabic:65164,yehinitialarabic:65267,yehmedialarabic:65268,yehmeeminitialarabic:64733,yehmeemisolatedarabic:64600,yehnoonfinalarabic:64660,yehthreedotsbelowarabic:1745,yekorean:12630,yen:165,yenmonospace:65509,yeokorean:12629,yeorinhieuhkorean:12678,yerahbenyomohebrew:1450,yerahbenyomolefthebrew:1450,yericyrillic:1099,yerudieresiscyrillic:1273,yesieungkorean:12673,yesieungpansioskorean:12675,yesieungsioskorean:12674,yetivhebrew:1434,ygrave:7923,yhook:436,yhookabove:7927,yiarmenian:1397,yicyrillic:1111,yikorean:12642,yinyang:9775,yiwnarmenian:1410,ymonospace:65369,yod:1497,yoddagesh:64313,yoddageshhebrew:64313,yodhebrew:1497,yodyodhebrew:1522,yodyodpatahhebrew:64287,yohiragana:12424,yoikorean:12681,yokatakana:12520,yokatakanahalfwidth:65430,yokorean:12635,yosmallhiragana:12423,yosmallkatakana:12519,yosmallkatakanahalfwidth:65390,yotgreek:1011,yoyaekorean:12680,yoyakorean:12679,yoyakthai:3618,yoyingthai:3597,yparen:9396,ypogegrammeni:890,ypogegrammenigreekcmb:837,yr:422,yring:7833,ysuperior:696,ytilde:7929,yturned:654,yuhiragana:12422,yuikorean:12684,yukatakana:12518,yukatakanahalfwidth:65429,yukorean:12640,yusbigcyrillic:1131,yusbigiotifiedcyrillic:1133,yuslittlecyrillic:1127,yuslittleiotifiedcyrillic:1129,yusmallhiragana:12421,yusmallkatakana:12517,yusmallkatakanahalfwidth:65389,yuyekorean:12683,yuyeokorean:12682,yyabengali:2527,yyadeva:2399,z:122,zaarmenian:1382,zacute:378,zadeva:2395,zagurmukhi:2651,zaharabic:1592,zahfinalarabic:65222,zahinitialarabic:65223,zahiragana:12374,zahmedialarabic:65224,zainarabic:1586,zainfinalarabic:65200,zakatakana:12470,zaqefgadolhebrew:1429,zaqefqatanhebrew:1428,zarqahebrew:1432,zayin:1494,zayindagesh:64310,zayindageshhebrew:64310,zayinhebrew:1494,zbopomofo:12567,zcaron:382,zcircle:9449,zcircumflex:7825,zcurl:657,zdot:380,zdotaccent:380,zdotbelow:7827,zecyrillic:1079,zedescendercyrillic:1177,zedieresiscyrillic:1247,zehiragana:12380,zekatakana:12476,zero:48,zeroarabic:1632,zerobengali:2534,zerodeva:2406,zerogujarati:2790,zerogurmukhi:2662,zerohackarabic:1632,zeroinferior:8320,zeromonospace:65296,zerooldstyle:63280, +zeropersian:1776,zerosuperior:8304,zerothai:3664,zerowidthjoiner:65279,zerowidthnonjoiner:8204,zerowidthspace:8203,zeta:950,zhbopomofo:12563,zhearmenian:1386,zhebrevecyrillic:1218,zhecyrillic:1078,zhedescendercyrillic:1175,zhedieresiscyrillic:1245,zihiragana:12376,zikatakana:12472,zinorhebrew:1454,zlinebelow:7829,zmonospace:65370,zohiragana:12382,zokatakana:12478,zparen:9397,zretroflexhook:656,zstroke:438,zuhiragana:12378,zukatakana:12474,".notdef":0},Ac={space:32,a1:9985,a2:9986,a202:9987,a3:9988,a4:9742,a5:9990,a119:9991,a118:9992,a117:9993,a11:9755,a12:9758,a13:9996,a14:9997,a15:9998,a16:9999,a105:1e4,a17:10001,a18:10002,a19:10003,a20:10004,a21:10005,a22:10006,a23:10007,a24:10008,a25:10009,a26:10010,a27:10011,a28:10012,a6:10013,a7:10014,a8:10015,a9:10016,a10:10017,a29:10018,a30:10019,a31:10020,a32:10021,a33:10022,a34:10023,a35:9733,a36:10025,a37:10026,a38:10027,a39:10028,a40:10029,a41:10030,a42:10031,a43:10032,a44:10033,a45:10034,a46:10035,a47:10036,a48:10037,a49:10038,a50:10039,a51:10040,a52:10041,a53:10042,a54:10043,a55:10044,a56:10045,a57:10046,a58:10047,a59:10048,a60:10049,a61:10050,a62:10051,a63:10052,a64:10053,a65:10054,a66:10055,a67:10056,a68:10057,a69:10058,a70:10059,a71:9679,a72:10061,a73:9632,a74:10063,a203:10064,a75:10065,a204:10066,a76:9650,a77:9660,a78:9670,a79:10070,a81:9687,a82:10072,a83:10073,a84:10074,a97:10075,a98:10076,a99:10077,a100:10078,a101:10081,a102:10082,a103:10083,a104:10084,a106:10085,a107:10086,a108:10087,a112:9827,a111:9830,a110:9829,a109:9824,a120:9312,a121:9313,a122:9314,a123:9315,a124:9316,a125:9317,a126:9318,a127:9319,a128:9320,a129:9321,a130:10102,a131:10103,a132:10104,a133:10105,a134:10106,a135:10107,a136:10108,a137:10109,a138:10110,a139:10111,a140:10112,a141:10113,a142:10114,a143:10115,a144:10116,a145:10117,a146:10118,a147:10119,a148:10120,a149:10121,a150:10122,a151:10123,a152:10124,a153:10125,a154:10126,a155:10127,a156:10128,a157:10129,a158:10130,a159:10131,a160:10132,a161:8594,a163:8596,a164:8597,a196:10136,a165:10137,a192:10138,a166:10139,a167:10140,a168:10141,a169:10142,a170:10143,a171:10144,a172:10145,a173:10146,a162:10147,a174:10148,a175:10149,a176:10150,a177:10151,a178:10152,a179:10153,a193:10154,a180:10155,a199:10156,a181:10157,a200:10158,a182:10159,a201:10161,a183:10162,a184:10163,a197:10164,a185:10165,a194:10166,a198:10167,a186:10168,a195:10169,a187:10170,a188:10171,a189:10172,a190:10173,a191:10174,a89:10088,a90:10089,a93:10090,a94:10091,a91:10092,a92:10093,a205:10094,a85:10095,a206:10096,a86:10097,a87:10098,a88:10099,a95:10100,a96:10101,".notdef":0},Bc=function(){function d(a,b,c,d){if(d instanceof Sc&&d.isNativelyDecodable(b,c)){var e=d.dict,f=e.get("ColorSpace","CS");f=Xa.parse(f,b,c);var g=f.numComps,h=a.sendWithPromise("JpegDecode",[d.getIR(),g]);return h.then(function(a){var b=a.data;return new Mc(b,0,b.length,d.dict)})}return Promise.resolve(d)}function f(a,b,c,d){return a=b+a*c,0>a?0:a>d?d:a}function g(b,d,e,f,h,i,j){this.image=e;var k=e.dict;if(k.has("Filter")){var l=k.get("Filter").name;if("JPXDecode"===l){var m=new hd;m.parseImageProperties(e.stream),e.stream.reset(),e.bitsPerComponent=m.bitsPerComponent,e.numComps=m.componentsCount}else"JBIG2Decode"===l&&(e.bitsPerComponent=1,e.numComps=1)}this.width=k.get("Width","W"),this.height=k.get("Height","H"),(this.width<1||this.height<1)&&c("Invalid image width: "+this.width+" or height: "+this.height),this.interpolate=k.get("Interpolate","I")||!1,this.imageMask=k.get("ImageMask","IM")||!1,this.matte=k.get("Matte")||!1;var n=e.bitsPerComponent;if(n||(n=k.get("BitsPerComponent","BPC"),n||(this.imageMask?n=1:c("Bits per component missing in image: "+this.imageMask))),this.bpc=n,!this.imageMask){var o=k.get("ColorSpace","CS");if(!o)switch(a("JPX images (which do not require color spaces)"),e.numComps){case 1:o=ya.get("DeviceGray");break;case 3:o=ya.get("DeviceRGB");break;case 4:o=ya.get("DeviceCMYK");break;default:c("JPX images with "+this.numComps+" color components not supported.")}this.colorSpace=Xa.parse(o,b,d),this.numComps=this.colorSpace.numComps}if(this.decode=k.get("Decode","D"),this.needsDecode=!1,this.decode&&(this.colorSpace&&!this.colorSpace.isDefaultDecode(this.decode)||j&&!Xa.isDefaultDecode(this.decode,1))){this.needsDecode=!0;var p=(1<=b?new Uint8Array(o):16>=b?new Uint16Array(o):new Uint32Array(o),q=e/g,r=f/h,s=0,t=new Uint16Array(g),u=e*d;for(1!==j&&(j=0),l=0;g>l;l++)t[l]=Math.floor(l*q)*d;if(1===d)for(k=0;h>k;k++)for(m=Math.floor(k*r)*u,l=0;g>l;l++)n=m+t[l],p[s++]=a[n];else if(3===d)for(k=0;h>k;k++)for(m=Math.floor(k*r)*u,l=0;g>l;l++)n=m+t[l],p[s++]=a[n++],p[s++]=a[n++],p[s++]=a[n++],s+=j;return p},g.createMask=function(a,b,c,d,e){var f,g,h=(b+7>>3)*c,i=a.byteLength,j=h===i;if(!d||e&&!j)if(e)for(f=new Uint8Array(h),f.set(a),g=i;h>g;g++)f[g]=255;else f=new Uint8Array(i),f.set(a);else f=a;if(e)for(g=0;i>g;g++)f[g]=~f[g];return{data:f,width:b,height:c}},g.prototype={get drawWidth(){return Math.max(this.width,this.smask&&this.smask.width||0,this.mask&&this.mask.width||0)},get drawHeight(){return Math.max(this.height,this.smask&&this.smask.height||0,this.mask&&this.mask.height||0)},decodeBuffer:function(a){var b,c,d=this.bpc,e=this.numComps,g=this.decodeAddends,h=this.decodeCoefficients,i=(1<b;b++)for(var k=0;e>k;k++)a[j]=f(a[j],g[k],h[k],i),j++}else for(b=0,c=a.length;c>b;b++)a[b]=+!a[b]},getComponents:function(a){var b=this.bpc;if(8===b)return a;var c,d,e=this.width,f=this.height,g=this.numComps,h=e*f*g,i=0,j=8>=b?new Uint8Array(h):16>=b?new Uint16Array(h):new Uint32Array(h),k=e*g,l=(1<q;q++){for(o=m+(-8&k),p=m+k;o>m;)d=a[i++],j[m]=d>>7&1,j[m+1]=d>>6&1,j[m+2]=d>>5&1,j[m+3]=d>>4&1,j[m+4]=d>>3&1,j[m+5]=d>>2&1,j[m+6]=d>>1&1,j[m+7]=1&d,m+=8;if(p>m)for(d=a[i++],n=128;p>m;)j[m++]=+!!(d&n),n>>=1}else{var r=0;for(d=0,m=0,c=h;c>m;++m){for(m%k===0&&(d=0,r=0);b>r;)d=d<<8|a[i++],r+=8;var s=r-b,t=d>>s;j[m]=0>t?0:t>l?l:t,d&=(1<k;++k)h[k]=255-h[k];(i!==b||j!==d)&&(h=g.resize(h,o.bpc,1,i,j,b,d))}else if(C(o)){h=new Uint8Array(b*d);var p=this.numComps;for(k=0,l=b*d;l>k;++k){var q=0,r=k*p;for(m=0;p>m;++m){var s=f[r+m],t=2*m;if(so[t+1]){q=255;break}}h[k]=q}}else c("Unknown mask format.");if(h)for(k=0,m=3,l=b*e;l>k;++k,m+=4)a[m]=h[k];else for(k=0,m=3,l=b*e;l>k;++k,m+=4)a[m]=255},undoPreblend:function(a,b,c){var d=this.smask&&this.smask.matte;if(d)for(var e,f,g,h=this.colorSpace.getRgb(d,0),i=h[0],j=h[1],k=h[2],l=b*c*4,m=0;l>m;m+=4){var n=a[m+3];if(0!==n){var o=255/n;e=(a[m]-i)*o+i,f=(a[m+1]-j)*o+j,g=(a[m+2]-k)*o+k,a[m]=0>=e?0:e>=255?255:0|e,a[m+1]=0>=f?0:f>=255?255:0|f,a[m+2]=0>=g?0:g>=255?255:0|g}else a[m]=255,a[m+1]=255,a[m+2]=255}},createImageData:function(a){var b,c=this.drawWidth,d=this.drawHeight,f={width:c,height:d},g=this.numComps,h=this.width,i=this.height,j=this.bpc,k=h*g*j+7>>3;if(!a){var l;if("DeviceGray"===this.colorSpace.name&&1===j?l=V.GRAYSCALE_1BPP:"DeviceRGB"!==this.colorSpace.name||8!==j||this.needsDecode||(l=V.RGB_24BPP),l&&!this.smask&&!this.mask&&c===h&&d===i){if(f.kind=l,b=this.getImageBytes(i*k),this.image instanceof Oc)f.data=b;else{var m=new Uint8Array(b.length);m.set(b),f.data=m}if(this.needsDecode){e(l===V.GRAYSCALE_1BPP);for(var n=f.data,o=0,p=n.length;p>o;o++)n[o]^=255}return f}if(this.image instanceof Sc&&!this.smask&&!this.mask&&("DeviceGray"===this.colorSpace.name||"DeviceRGB"===this.colorSpace.name||"DeviceCMYK"===this.colorSpace.name))return f.kind=V.RGB_24BPP,f.data=this.getImageBytes(i*k,c,d,!0),f}b=this.getImageBytes(i*k);var q,r,s=0|b.length/k*d/i,t=this.getComponents(b);return a||this.smask||this.mask?(f.kind=V.RGBA_32BPP,f.data=new Uint8Array(c*d*4),q=1,r=!0,this.fillOpacity(f.data,c,d,s,t)):(f.kind=V.RGB_24BPP,f.data=new Uint8Array(c*d*3),q=0,r=!1),this.needsDecode&&this.decodeBuffer(t),this.colorSpace.fillRgb(f.data,h,i,c,d,s,j,t,q),r&&this.undoPreblend(f.data,c,s),f},fillGrayBuffer:function(a){var b=this.numComps;1!==b&&c("Reading gray scale from a color image: "+b);var d,e,f=this.width,g=this.height,h=this.bpc,i=f*b*h+7>>3,j=this.getImageBytes(g*i),k=this.getComponents(j);if(1!==h){this.needsDecode&&this.decodeBuffer(k),e=f*g;var l=255/((1<d;++d)a[d]=l*k[d]|0}else if(e=f*g,this.needsDecode)for(d=0;e>d;++d)a[d]=k[d]-1&255;else for(d=0;e>d;++d)a[d]=255&-k[d]},getImageBytes:function(a,b,c,d){return this.image.reset(),this.image.drawWidth=b||this.width,this.image.drawHeight=c||this.height,this.image.forceRGB=!!d,this.image.getBytes(a)}},g}(),Cc={Courier:600,"Courier-Bold":600,"Courier-BoldOblique":600,"Courier-Oblique":600,Helvetica:{space:278,exclam:278,quotedbl:355,numbersign:556,dollar:556,percent:889,ampersand:667,quoteright:222,parenleft:333,parenright:333,asterisk:389,plus:584,comma:278,hyphen:333,period:278,slash:278,zero:556,one:556,two:556,three:556,four:556,five:556,six:556,seven:556,eight:556,nine:556,colon:278,semicolon:278,less:584,equal:584,greater:584,question:556,at:1015,A:667,B:667,C:722,D:722,E:667,F:611,G:778,H:722,I:278,J:500,K:667,L:556,M:833,N:722,O:778,P:667,Q:778,R:722,S:667,T:611,U:722,V:667,W:944,X:667,Y:667,Z:611,bracketleft:278,backslash:278,bracketright:278,asciicircum:469,underscore:556,quoteleft:222,a:556,b:556,c:500,d:556,e:556,f:278,g:556,h:556,i:222,j:222,k:500,l:222,m:833,n:556,o:556,p:556,q:556,r:333,s:500,t:278,u:556,v:500,w:722,x:500,y:500,z:500,braceleft:334,bar:260,braceright:334,asciitilde:584,exclamdown:333,cent:556,sterling:556,fraction:167,yen:556,florin:556,section:556,currency:556,quotesingle:191,quotedblleft:333,guillemotleft:556,guilsinglleft:333,guilsinglright:333,fi:500,fl:500,endash:556,dagger:556,daggerdbl:556,periodcentered:278,paragraph:537,bullet:350,quotesinglbase:222,quotedblbase:333,quotedblright:333,guillemotright:556,ellipsis:1e3,perthousand:1e3,questiondown:611,grave:333,acute:333,circumflex:333,tilde:333,macron:333,breve:333,dotaccent:333,dieresis:333,ring:333,cedilla:333,hungarumlaut:333,ogonek:333,caron:333,emdash:1e3,AE:1e3,ordfeminine:370,Lslash:556,Oslash:778,OE:1e3,ordmasculine:365,ae:889,dotlessi:278,lslash:222,oslash:611,oe:944,germandbls:611,Idieresis:278,eacute:556,abreve:556,uhungarumlaut:556,ecaron:556,Ydieresis:667,divide:584,Yacute:667,Acircumflex:667,aacute:556,Ucircumflex:722,yacute:500,scommaaccent:500,ecircumflex:556,Uring:722,Udieresis:722,aogonek:556,Uacute:722,uogonek:556,Edieresis:667,Dcroat:722,commaaccent:250,copyright:737,Emacron:667,ccaron:500,aring:556,Ncommaaccent:722,lacute:222,agrave:556,Tcommaaccent:611,Cacute:722,atilde:556,Edotaccent:667,scaron:500,scedilla:500,iacute:278,lozenge:471,Rcaron:722,Gcommaaccent:778,ucircumflex:556,acircumflex:556,Amacron:667,rcaron:333,ccedilla:500,Zdotaccent:611,Thorn:667,Omacron:778,Racute:722,Sacute:667,dcaron:643,Umacron:722,uring:556,threesuperior:333,Ograve:778,Agrave:667,Abreve:667,multiply:584,uacute:556,Tcaron:611,partialdiff:476,ydieresis:500,Nacute:722,icircumflex:278,Ecircumflex:667,adieresis:556,edieresis:556,cacute:500,nacute:556,umacron:556,Ncaron:722,Iacute:278,plusminus:584,brokenbar:260,registered:737,Gbreve:778,Idotaccent:278,summation:600,Egrave:667,racute:333,omacron:556,Zacute:611,Zcaron:611,greaterequal:549,Eth:722,Ccedilla:722,lcommaaccent:222,tcaron:317,eogonek:556,Uogonek:722,Aacute:667,Adieresis:667,egrave:556,zacute:500,iogonek:222,Oacute:778,oacute:556,amacron:556,sacute:500,idieresis:278,Ocircumflex:778,Ugrave:722,Delta:612,thorn:556,twosuperior:333,Odieresis:778,mu:556,igrave:278,ohungarumlaut:556,Eogonek:667,dcroat:556,threequarters:834,Scedilla:667,lcaron:299,Kcommaaccent:667,Lacute:556,trademark:1e3,edotaccent:556,Igrave:278,Imacron:278,Lcaron:556,onehalf:834,lessequal:549,ocircumflex:556,ntilde:556,Uhungarumlaut:722,Eacute:667,emacron:556,gbreve:556,onequarter:834,Scaron:667,Scommaaccent:667,Ohungarumlaut:778,degree:400,ograve:556,Ccaron:722,ugrave:556,radical:453,Dcaron:722,rcommaaccent:333,Ntilde:722,otilde:556,Rcommaaccent:722,Lcommaaccent:556,Atilde:667,Aogonek:667,Aring:667,Otilde:778,zdotaccent:500,Ecaron:667,Iogonek:278,kcommaaccent:500,minus:584,Icircumflex:278,ncaron:556,tcommaaccent:278,logicalnot:584,odieresis:556,udieresis:556,notequal:549,gcommaaccent:556,eth:556,zcaron:500,ncommaaccent:556,onesuperior:333,imacron:278,Euro:556},"Helvetica-Bold":{space:278,exclam:333,quotedbl:474,numbersign:556,dollar:556,percent:889,ampersand:722,quoteright:278,parenleft:333,parenright:333,asterisk:389,plus:584,comma:278,hyphen:333,period:278,slash:278,zero:556,one:556,two:556,three:556,four:556,five:556,six:556,seven:556,eight:556,nine:556,colon:333,semicolon:333,less:584,equal:584,greater:584,question:611,at:975,A:722,B:722,C:722,D:722,E:667,F:611,G:778,H:722,I:278,J:556,K:722,L:611,M:833,N:722,O:778,P:667,Q:778,R:722,S:667,T:611,U:722,V:667,W:944,X:667,Y:667,Z:611,bracketleft:333,backslash:278,bracketright:333,asciicircum:584,underscore:556,quoteleft:278,a:556,b:611,c:556,d:611,e:556,f:333,g:611,h:611,i:278,j:278,k:556,l:278,m:889,n:611,o:611,p:611,q:611,r:389,s:556,t:333,u:611,v:556,w:778,x:556,y:556,z:500,braceleft:389,bar:280,braceright:389,asciitilde:584,exclamdown:333,cent:556,sterling:556,fraction:167,yen:556,florin:556,section:556,currency:556,quotesingle:238,quotedblleft:500,guillemotleft:556,guilsinglleft:333,guilsinglright:333,fi:611,fl:611,endash:556,dagger:556,daggerdbl:556,periodcentered:278,paragraph:556,bullet:350,quotesinglbase:278,quotedblbase:500,quotedblright:500,guillemotright:556,ellipsis:1e3,perthousand:1e3,questiondown:611,grave:333,acute:333,circumflex:333,tilde:333,macron:333,breve:333,dotaccent:333,dieresis:333,ring:333,cedilla:333,hungarumlaut:333,ogonek:333,caron:333,emdash:1e3,AE:1e3,ordfeminine:370,Lslash:611,Oslash:778,OE:1e3,ordmasculine:365,ae:889,dotlessi:278,lslash:278,oslash:611,oe:944,germandbls:611,Idieresis:278,eacute:556,abreve:556,uhungarumlaut:611,ecaron:556,Ydieresis:667,divide:584,Yacute:667,Acircumflex:722,aacute:556,Ucircumflex:722,yacute:556,scommaaccent:556,ecircumflex:556,Uring:722,Udieresis:722,aogonek:556,Uacute:722,uogonek:611,Edieresis:667,Dcroat:722,commaaccent:250,copyright:737,Emacron:667,ccaron:556,aring:556,Ncommaaccent:722,lacute:278,agrave:556,Tcommaaccent:611,Cacute:722,atilde:556,Edotaccent:667,scaron:556,scedilla:556,iacute:278,lozenge:494,Rcaron:722,Gcommaaccent:778,ucircumflex:611,acircumflex:556,Amacron:722,rcaron:389,ccedilla:556,Zdotaccent:611,Thorn:667,Omacron:778,Racute:722,Sacute:667,dcaron:743,Umacron:722,uring:611,threesuperior:333,Ograve:778,Agrave:722,Abreve:722,multiply:584,uacute:611,Tcaron:611,partialdiff:494,ydieresis:556,Nacute:722,icircumflex:278,Ecircumflex:667,adieresis:556,edieresis:556,cacute:556,nacute:611,umacron:611,Ncaron:722,Iacute:278,plusminus:584,brokenbar:280,registered:737,Gbreve:778,Idotaccent:278,summation:600,Egrave:667,racute:389,omacron:611,Zacute:611,Zcaron:611,greaterequal:549,Eth:722,Ccedilla:722,lcommaaccent:278,tcaron:389,eogonek:556,Uogonek:722,Aacute:722,Adieresis:722,egrave:556,zacute:500,iogonek:278,Oacute:778,oacute:611,amacron:556,sacute:556,idieresis:278,Ocircumflex:778,Ugrave:722,Delta:612,thorn:611,twosuperior:333,Odieresis:778,mu:611,igrave:278,ohungarumlaut:611,Eogonek:667,dcroat:611,threequarters:834,Scedilla:667,lcaron:400,Kcommaaccent:722,Lacute:611,trademark:1e3,edotaccent:556,Igrave:278,Imacron:278,Lcaron:611,onehalf:834,lessequal:549,ocircumflex:611,ntilde:611,Uhungarumlaut:722,Eacute:667,emacron:556,gbreve:611,onequarter:834,Scaron:667,Scommaaccent:667,Ohungarumlaut:778,degree:400,ograve:611,Ccaron:722,ugrave:611,radical:549,Dcaron:722,rcommaaccent:389,Ntilde:722,otilde:611,Rcommaaccent:722,Lcommaaccent:611,Atilde:722,Aogonek:722,Aring:722,Otilde:778,zdotaccent:500,Ecaron:667,Iogonek:278,kcommaaccent:556,minus:584,Icircumflex:278,ncaron:611,tcommaaccent:333,logicalnot:584,odieresis:611,udieresis:611,notequal:549,gcommaaccent:611,eth:611,zcaron:500,ncommaaccent:611,onesuperior:333,imacron:278,Euro:556},"Helvetica-BoldOblique":{space:278,exclam:333,quotedbl:474,numbersign:556,dollar:556,percent:889,ampersand:722,quoteright:278,parenleft:333,parenright:333,asterisk:389,plus:584,comma:278,hyphen:333,period:278,slash:278,zero:556,one:556,two:556,three:556,four:556,five:556,six:556,seven:556,eight:556,nine:556,colon:333,semicolon:333,less:584,equal:584,greater:584,question:611,at:975,A:722,B:722,C:722,D:722,E:667,F:611,G:778,H:722,I:278,J:556,K:722,L:611,M:833,N:722,O:778,P:667,Q:778,R:722,S:667,T:611,U:722,V:667,W:944,X:667,Y:667,Z:611,bracketleft:333,backslash:278,bracketright:333,asciicircum:584,underscore:556,quoteleft:278,a:556,b:611,c:556,d:611,e:556,f:333,g:611,h:611,i:278,j:278,k:556,l:278,m:889,n:611,o:611,p:611,q:611,r:389,s:556,t:333,u:611,v:556,w:778,x:556,y:556,z:500,braceleft:389,bar:280,braceright:389,asciitilde:584,exclamdown:333,cent:556,sterling:556,fraction:167,yen:556,florin:556,section:556,currency:556,quotesingle:238,quotedblleft:500,guillemotleft:556,guilsinglleft:333,guilsinglright:333,fi:611,fl:611,endash:556,dagger:556,daggerdbl:556,periodcentered:278,paragraph:556,bullet:350,quotesinglbase:278,quotedblbase:500,quotedblright:500,guillemotright:556,ellipsis:1e3,perthousand:1e3,questiondown:611,grave:333,acute:333,circumflex:333,tilde:333,macron:333,breve:333,dotaccent:333,dieresis:333,ring:333,cedilla:333,hungarumlaut:333,ogonek:333,caron:333,emdash:1e3,AE:1e3,ordfeminine:370,Lslash:611,Oslash:778,OE:1e3,ordmasculine:365,ae:889,dotlessi:278,lslash:278,oslash:611,oe:944,germandbls:611,Idieresis:278,eacute:556,abreve:556,uhungarumlaut:611,ecaron:556,Ydieresis:667,divide:584,Yacute:667,Acircumflex:722,aacute:556,Ucircumflex:722,yacute:556,scommaaccent:556,ecircumflex:556,Uring:722,Udieresis:722,aogonek:556,Uacute:722,uogonek:611,Edieresis:667,Dcroat:722,commaaccent:250,copyright:737,Emacron:667,ccaron:556,aring:556,Ncommaaccent:722,lacute:278,agrave:556,Tcommaaccent:611,Cacute:722,atilde:556,Edotaccent:667,scaron:556,scedilla:556,iacute:278,lozenge:494,Rcaron:722,Gcommaaccent:778,ucircumflex:611,acircumflex:556,Amacron:722,rcaron:389,ccedilla:556,Zdotaccent:611,Thorn:667,Omacron:778,Racute:722,Sacute:667,dcaron:743,Umacron:722,uring:611,threesuperior:333,Ograve:778,Agrave:722,Abreve:722,multiply:584,uacute:611,Tcaron:611,partialdiff:494,ydieresis:556,Nacute:722,icircumflex:278,Ecircumflex:667,adieresis:556,edieresis:556,cacute:556,nacute:611,umacron:611,Ncaron:722,Iacute:278,plusminus:584,brokenbar:280,registered:737,Gbreve:778,Idotaccent:278,summation:600,Egrave:667,racute:389,omacron:611,Zacute:611,Zcaron:611,greaterequal:549,Eth:722,Ccedilla:722,lcommaaccent:278,tcaron:389,eogonek:556,Uogonek:722,Aacute:722,Adieresis:722,egrave:556,zacute:500,iogonek:278,Oacute:778,oacute:611,amacron:556,sacute:556,idieresis:278,Ocircumflex:778,Ugrave:722,Delta:612,thorn:611,twosuperior:333,Odieresis:778,mu:611,igrave:278,ohungarumlaut:611,Eogonek:667,dcroat:611,threequarters:834,Scedilla:667,lcaron:400,Kcommaaccent:722,Lacute:611,trademark:1e3,edotaccent:556,Igrave:278,Imacron:278,Lcaron:611,onehalf:834,lessequal:549,ocircumflex:611,ntilde:611,Uhungarumlaut:722,Eacute:667,emacron:556,gbreve:611,onequarter:834,Scaron:667,Scommaaccent:667,Ohungarumlaut:778,degree:400,ograve:611,Ccaron:722,ugrave:611,radical:549,Dcaron:722,rcommaaccent:389,Ntilde:722,otilde:611,Rcommaaccent:722,Lcommaaccent:611,Atilde:722,Aogonek:722,Aring:722,Otilde:778,zdotaccent:500,Ecaron:667,Iogonek:278,kcommaaccent:556,minus:584,Icircumflex:278,ncaron:611,tcommaaccent:333,logicalnot:584,odieresis:611,udieresis:611,notequal:549,gcommaaccent:611,eth:611,zcaron:500,ncommaaccent:611,onesuperior:333,imacron:278,Euro:556},"Helvetica-Oblique":{space:278,exclam:278,quotedbl:355,numbersign:556,dollar:556,percent:889,ampersand:667,quoteright:222,parenleft:333,parenright:333,asterisk:389,plus:584,comma:278,hyphen:333,period:278,slash:278,zero:556,one:556,two:556,three:556,four:556,five:556,six:556,seven:556,eight:556,nine:556,colon:278,semicolon:278,less:584,equal:584,greater:584,question:556,at:1015,A:667,B:667,C:722,D:722,E:667,F:611,G:778,H:722,I:278,J:500,K:667,L:556,M:833,N:722,O:778,P:667,Q:778,R:722,S:667,T:611,U:722,V:667,W:944,X:667,Y:667,Z:611,bracketleft:278,backslash:278,bracketright:278,asciicircum:469,underscore:556,quoteleft:222,a:556,b:556,c:500,d:556,e:556,f:278,g:556,h:556,i:222,j:222,k:500,l:222,m:833,n:556,o:556,p:556,q:556,r:333,s:500,t:278,u:556,v:500,w:722,x:500,y:500,z:500,braceleft:334,bar:260,braceright:334,asciitilde:584,exclamdown:333,cent:556,sterling:556,fraction:167,yen:556,florin:556,section:556,currency:556,quotesingle:191,quotedblleft:333,guillemotleft:556,guilsinglleft:333,guilsinglright:333,fi:500,fl:500,endash:556,dagger:556,daggerdbl:556,periodcentered:278,paragraph:537,bullet:350,quotesinglbase:222,quotedblbase:333,quotedblright:333,guillemotright:556,ellipsis:1e3,perthousand:1e3,questiondown:611,grave:333,acute:333,circumflex:333,tilde:333,macron:333,breve:333,dotaccent:333,dieresis:333,ring:333,cedilla:333,hungarumlaut:333,ogonek:333,caron:333,emdash:1e3,AE:1e3,ordfeminine:370,Lslash:556,Oslash:778,OE:1e3,ordmasculine:365,ae:889,dotlessi:278,lslash:222,oslash:611,oe:944,germandbls:611,Idieresis:278,eacute:556,abreve:556,uhungarumlaut:556,ecaron:556,Ydieresis:667,divide:584,Yacute:667,Acircumflex:667,aacute:556,Ucircumflex:722,yacute:500,scommaaccent:500,ecircumflex:556,Uring:722,Udieresis:722,aogonek:556,Uacute:722,uogonek:556,Edieresis:667,Dcroat:722,commaaccent:250,copyright:737,Emacron:667,ccaron:500,aring:556,Ncommaaccent:722,lacute:222,agrave:556,Tcommaaccent:611,Cacute:722,atilde:556,Edotaccent:667,scaron:500,scedilla:500,iacute:278,lozenge:471,Rcaron:722,Gcommaaccent:778,ucircumflex:556,acircumflex:556,Amacron:667,rcaron:333,ccedilla:500,Zdotaccent:611,Thorn:667,Omacron:778,Racute:722,Sacute:667,dcaron:643,Umacron:722,uring:556,threesuperior:333,Ograve:778,Agrave:667,Abreve:667,multiply:584,uacute:556,Tcaron:611,partialdiff:476,ydieresis:500,Nacute:722,icircumflex:278,Ecircumflex:667,adieresis:556,edieresis:556,cacute:500,nacute:556,umacron:556,Ncaron:722,Iacute:278,plusminus:584,brokenbar:260,registered:737,Gbreve:778,Idotaccent:278,summation:600,Egrave:667,racute:333,omacron:556,Zacute:611,Zcaron:611,greaterequal:549,Eth:722,Ccedilla:722,lcommaaccent:222,tcaron:317,eogonek:556,Uogonek:722,Aacute:667,Adieresis:667,egrave:556,zacute:500,iogonek:222,Oacute:778,oacute:556,amacron:556,sacute:500,idieresis:278,Ocircumflex:778,Ugrave:722,Delta:612,thorn:556,twosuperior:333,Odieresis:778,mu:556,igrave:278,ohungarumlaut:556,Eogonek:667,dcroat:556,threequarters:834,Scedilla:667,lcaron:299,Kcommaaccent:667,Lacute:556,trademark:1e3,edotaccent:556,Igrave:278,Imacron:278,Lcaron:556,onehalf:834,lessequal:549,ocircumflex:556,ntilde:556,Uhungarumlaut:722,Eacute:667,emacron:556,gbreve:556,onequarter:834,Scaron:667,Scommaaccent:667,Ohungarumlaut:778,degree:400,ograve:556,Ccaron:722,ugrave:556,radical:453,Dcaron:722,rcommaaccent:333,Ntilde:722,otilde:556,Rcommaaccent:722,Lcommaaccent:556,Atilde:667,Aogonek:667,Aring:667,Otilde:778,zdotaccent:500,Ecaron:667,Iogonek:278,kcommaaccent:500,minus:584,Icircumflex:278,ncaron:556,tcommaaccent:278,logicalnot:584,odieresis:556,udieresis:556,notequal:549,gcommaaccent:556,eth:556,zcaron:500,ncommaaccent:556,onesuperior:333,imacron:278,Euro:556},Symbol:{space:250,exclam:333,universal:713,numbersign:500,existential:549,percent:833,ampersand:778,suchthat:439,parenleft:333,parenright:333,asteriskmath:500,plus:549,comma:250,minus:549,period:250,slash:278,zero:500,one:500,two:500,three:500,four:500,five:500,six:500,seven:500,eight:500,nine:500,colon:278,semicolon:278,less:549,equal:549,greater:549,question:444,congruent:549,Alpha:722,Beta:667,Chi:722,Delta:612,Epsilon:611,Phi:763,Gamma:603,Eta:722,Iota:333,theta1:631,Kappa:722,Lambda:686,Mu:889,Nu:722,Omicron:722,Pi:768,Theta:741,Rho:556,Sigma:592,Tau:611,Upsilon:690,sigma1:439,Omega:768,Xi:645,Psi:795,Zeta:611,bracketleft:333,therefore:863,bracketright:333,perpendicular:658,underscore:500,radicalex:500,alpha:631,beta:549,chi:549,delta:494,epsilon:439,phi:521,gamma:411,eta:603,iota:329,phi1:603,kappa:549,lambda:549,mu:576,nu:521,omicron:549,pi:549,theta:521,rho:549,sigma:603,tau:439,upsilon:576,omega1:713,omega:686,xi:493,psi:686,zeta:494,braceleft:480,bar:200,braceright:480,similar:549,Euro:750,Upsilon1:620,minute:247,lessequal:549,fraction:167,infinity:713,florin:500,club:753,diamond:753,heart:753,spade:753,arrowboth:1042,arrowleft:987,arrowup:603,arrowright:987,arrowdown:603,degree:400,plusminus:549,second:411,greaterequal:549,multiply:549,proportional:713,partialdiff:494,bullet:460,divide:549,notequal:549,equivalence:549,approxequal:549,ellipsis:1e3,arrowvertex:603,arrowhorizex:1e3,carriagereturn:658,aleph:823,Ifraktur:686,Rfraktur:795,weierstrass:987,circlemultiply:768,circleplus:768,emptyset:823,intersection:768,union:768,propersuperset:713,reflexsuperset:713,notsubset:713,propersubset:713,reflexsubset:713,element:713,notelement:713,angle:768,gradient:713,registerserif:790,copyrightserif:790,trademarkserif:890,product:823,radical:549,dotmath:250,logicalnot:713,logicaland:603,logicalor:603,arrowdblboth:1042,arrowdblleft:987,arrowdblup:603,arrowdblright:987,arrowdbldown:603,lozenge:494,angleleft:329,registersans:790,copyrightsans:790,trademarksans:786,summation:713,parenlefttp:384,parenleftex:384,parenleftbt:384,bracketlefttp:384,bracketleftex:384,bracketleftbt:384,bracelefttp:494,braceleftmid:494,braceleftbt:494,braceex:494,angleright:329,integral:274,integraltp:686,integralex:686,integralbt:686,parenrighttp:384,parenrightex:384,parenrightbt:384,bracketrighttp:384,bracketrightex:384,bracketrightbt:384,bracerighttp:494,bracerightmid:494,bracerightbt:494,apple:790},"Times-Roman":{space:250,exclam:333,quotedbl:408,numbersign:500,dollar:500,percent:833,ampersand:778,quoteright:333,parenleft:333,parenright:333,asterisk:500,plus:564,comma:250,hyphen:333,period:250,slash:278,zero:500,one:500,two:500,three:500,four:500,five:500,six:500,seven:500,eight:500,nine:500,colon:278,semicolon:278,less:564,equal:564,greater:564,question:444,at:921,A:722,B:667,C:667,D:722,E:611,F:556,G:722,H:722,I:333,J:389,K:722,L:611,M:889,N:722,O:722,P:556,Q:722,R:667,S:556,T:611,U:722,V:722,W:944,X:722,Y:722,Z:611,bracketleft:333,backslash:278,bracketright:333,asciicircum:469,underscore:500,quoteleft:333,a:444,b:500,c:444,d:500,e:444,f:333,g:500,h:500,i:278,j:278,k:500,l:278,m:778,n:500,o:500,p:500,q:500,r:333,s:389,t:278,u:500,v:500,w:722,x:500,y:500,z:444,braceleft:480,bar:200,braceright:480,asciitilde:541,exclamdown:333,cent:500,sterling:500,fraction:167,yen:500,florin:500,section:500,currency:500,quotesingle:180,quotedblleft:444,guillemotleft:500,guilsinglleft:333,guilsinglright:333,fi:556,fl:556,endash:500,dagger:500,daggerdbl:500,periodcentered:250,paragraph:453,bullet:350,quotesinglbase:333,quotedblbase:444,quotedblright:444,guillemotright:500,ellipsis:1e3,perthousand:1e3,questiondown:444,grave:333,acute:333,circumflex:333,tilde:333,macron:333,breve:333,dotaccent:333,dieresis:333,ring:333,cedilla:333,hungarumlaut:333,ogonek:333,caron:333,emdash:1e3,AE:889,ordfeminine:276,Lslash:611,Oslash:722,OE:889,ordmasculine:310,ae:667,dotlessi:278,lslash:278,oslash:500,oe:722,germandbls:500,Idieresis:333,eacute:444,abreve:444,uhungarumlaut:500,ecaron:444,Ydieresis:722,divide:564,Yacute:722,Acircumflex:722,aacute:444,Ucircumflex:722,yacute:500,scommaaccent:389,ecircumflex:444,Uring:722,Udieresis:722,aogonek:444,Uacute:722,uogonek:500,Edieresis:611,Dcroat:722,commaaccent:250,copyright:760,Emacron:611,ccaron:444,aring:444,Ncommaaccent:722,lacute:278,agrave:444,Tcommaaccent:611,Cacute:667,atilde:444,Edotaccent:611,scaron:389,scedilla:389,iacute:278,lozenge:471,Rcaron:667,Gcommaaccent:722,ucircumflex:500,acircumflex:444,Amacron:722,rcaron:333,ccedilla:444,Zdotaccent:611,Thorn:556,Omacron:722,Racute:667,Sacute:556,dcaron:588,Umacron:722,uring:500,threesuperior:300,Ograve:722,Agrave:722,Abreve:722,multiply:564,uacute:500,Tcaron:611,partialdiff:476,ydieresis:500,Nacute:722,icircumflex:278,Ecircumflex:611,adieresis:444,edieresis:444,cacute:444,nacute:500,umacron:500,Ncaron:722,Iacute:333,plusminus:564,brokenbar:200,registered:760,Gbreve:722,Idotaccent:333,summation:600,Egrave:611,racute:333,omacron:500,Zacute:611,Zcaron:611,greaterequal:549,Eth:722,Ccedilla:667,lcommaaccent:278,tcaron:326,eogonek:444,Uogonek:722,Aacute:722,Adieresis:722,egrave:444,zacute:444,iogonek:278,Oacute:722,oacute:500,amacron:444,sacute:389,idieresis:278,Ocircumflex:722,Ugrave:722,Delta:612,thorn:500,twosuperior:300,Odieresis:722,mu:500,igrave:278,ohungarumlaut:500,Eogonek:611,dcroat:500,threequarters:750,Scedilla:556,lcaron:344,Kcommaaccent:722,Lacute:611,trademark:980,edotaccent:444,Igrave:333,Imacron:333,Lcaron:611,onehalf:750,lessequal:549,ocircumflex:500,ntilde:500,Uhungarumlaut:722,Eacute:611,emacron:444,gbreve:500,onequarter:750,Scaron:556,Scommaaccent:556,Ohungarumlaut:722,degree:400,ograve:500,Ccaron:667,ugrave:500,radical:453,Dcaron:722,rcommaaccent:333,Ntilde:722,otilde:500,Rcommaaccent:667,Lcommaaccent:611,Atilde:722,Aogonek:722,Aring:722,Otilde:722,zdotaccent:444,Ecaron:611,Iogonek:333,kcommaaccent:500,minus:564,Icircumflex:333,ncaron:500,tcommaaccent:278,logicalnot:564,odieresis:500,udieresis:500,notequal:549,gcommaaccent:500,eth:500,zcaron:444,ncommaaccent:500,onesuperior:300,imacron:278,Euro:500},"Times-Bold":{space:250,exclam:333,quotedbl:555,numbersign:500,dollar:500,percent:1e3,ampersand:833,quoteright:333,parenleft:333,parenright:333,asterisk:500,plus:570,comma:250,hyphen:333,period:250,slash:278,zero:500,one:500,two:500,three:500,four:500,five:500,six:500,seven:500,eight:500,nine:500,colon:333,semicolon:333,less:570,equal:570,greater:570,question:500,at:930,A:722,B:667,C:722,D:722,E:667,F:611,G:778,H:778,I:389,J:500,K:778,L:667,M:944,N:722,O:778,P:611,Q:778,R:722,S:556,T:667,U:722,V:722,W:1e3,X:722,Y:722,Z:667,bracketleft:333,backslash:278,bracketright:333,asciicircum:581,underscore:500,quoteleft:333,a:500,b:556,c:444,d:556,e:444,f:333,g:500,h:556,i:278,j:333,k:556,l:278,m:833,n:556,o:500,p:556,q:556,r:444,s:389,t:333,u:556,v:500,w:722,x:500,y:500,z:444,braceleft:394,bar:220,braceright:394,asciitilde:520,exclamdown:333,cent:500,sterling:500,fraction:167,yen:500,florin:500,section:500,currency:500,quotesingle:278,quotedblleft:500,guillemotleft:500,guilsinglleft:333,guilsinglright:333,fi:556,fl:556,endash:500,dagger:500,daggerdbl:500,periodcentered:250,paragraph:540,bullet:350,quotesinglbase:333,quotedblbase:500,quotedblright:500,guillemotright:500,ellipsis:1e3,perthousand:1e3,questiondown:500,grave:333,acute:333,circumflex:333,tilde:333,macron:333,breve:333,dotaccent:333,dieresis:333,ring:333,cedilla:333,hungarumlaut:333,ogonek:333,caron:333,emdash:1e3,AE:1e3,ordfeminine:300,Lslash:667,Oslash:778,OE:1e3,ordmasculine:330,ae:722,dotlessi:278,lslash:278,oslash:500,oe:722,germandbls:556,Idieresis:389,eacute:444,abreve:500,uhungarumlaut:556,ecaron:444,Ydieresis:722,divide:570,Yacute:722,Acircumflex:722, +aacute:500,Ucircumflex:722,yacute:500,scommaaccent:389,ecircumflex:444,Uring:722,Udieresis:722,aogonek:500,Uacute:722,uogonek:556,Edieresis:667,Dcroat:722,commaaccent:250,copyright:747,Emacron:667,ccaron:444,aring:500,Ncommaaccent:722,lacute:278,agrave:500,Tcommaaccent:667,Cacute:722,atilde:500,Edotaccent:667,scaron:389,scedilla:389,iacute:278,lozenge:494,Rcaron:722,Gcommaaccent:778,ucircumflex:556,acircumflex:500,Amacron:722,rcaron:444,ccedilla:444,Zdotaccent:667,Thorn:611,Omacron:778,Racute:722,Sacute:556,dcaron:672,Umacron:722,uring:556,threesuperior:300,Ograve:778,Agrave:722,Abreve:722,multiply:570,uacute:556,Tcaron:667,partialdiff:494,ydieresis:500,Nacute:722,icircumflex:278,Ecircumflex:667,adieresis:500,edieresis:444,cacute:444,nacute:556,umacron:556,Ncaron:722,Iacute:389,plusminus:570,brokenbar:220,registered:747,Gbreve:778,Idotaccent:389,summation:600,Egrave:667,racute:444,omacron:500,Zacute:667,Zcaron:667,greaterequal:549,Eth:722,Ccedilla:722,lcommaaccent:278,tcaron:416,eogonek:444,Uogonek:722,Aacute:722,Adieresis:722,egrave:444,zacute:444,iogonek:278,Oacute:778,oacute:500,amacron:500,sacute:389,idieresis:278,Ocircumflex:778,Ugrave:722,Delta:612,thorn:556,twosuperior:300,Odieresis:778,mu:556,igrave:278,ohungarumlaut:500,Eogonek:667,dcroat:556,threequarters:750,Scedilla:556,lcaron:394,Kcommaaccent:778,Lacute:667,trademark:1e3,edotaccent:444,Igrave:389,Imacron:389,Lcaron:667,onehalf:750,lessequal:549,ocircumflex:500,ntilde:556,Uhungarumlaut:722,Eacute:667,emacron:444,gbreve:500,onequarter:750,Scaron:556,Scommaaccent:556,Ohungarumlaut:778,degree:400,ograve:500,Ccaron:722,ugrave:556,radical:549,Dcaron:722,rcommaaccent:444,Ntilde:722,otilde:500,Rcommaaccent:722,Lcommaaccent:667,Atilde:722,Aogonek:722,Aring:722,Otilde:778,zdotaccent:444,Ecaron:667,Iogonek:389,kcommaaccent:556,minus:570,Icircumflex:389,ncaron:556,tcommaaccent:333,logicalnot:570,odieresis:500,udieresis:556,notequal:549,gcommaaccent:500,eth:500,zcaron:444,ncommaaccent:556,onesuperior:300,imacron:278,Euro:500},"Times-BoldItalic":{space:250,exclam:389,quotedbl:555,numbersign:500,dollar:500,percent:833,ampersand:778,quoteright:333,parenleft:333,parenright:333,asterisk:500,plus:570,comma:250,hyphen:333,period:250,slash:278,zero:500,one:500,two:500,three:500,four:500,five:500,six:500,seven:500,eight:500,nine:500,colon:333,semicolon:333,less:570,equal:570,greater:570,question:500,at:832,A:667,B:667,C:667,D:722,E:667,F:667,G:722,H:778,I:389,J:500,K:667,L:611,M:889,N:722,O:722,P:611,Q:722,R:667,S:556,T:611,U:722,V:667,W:889,X:667,Y:611,Z:611,bracketleft:333,backslash:278,bracketright:333,asciicircum:570,underscore:500,quoteleft:333,a:500,b:500,c:444,d:500,e:444,f:333,g:500,h:556,i:278,j:278,k:500,l:278,m:778,n:556,o:500,p:500,q:500,r:389,s:389,t:278,u:556,v:444,w:667,x:500,y:444,z:389,braceleft:348,bar:220,braceright:348,asciitilde:570,exclamdown:389,cent:500,sterling:500,fraction:167,yen:500,florin:500,section:500,currency:500,quotesingle:278,quotedblleft:500,guillemotleft:500,guilsinglleft:333,guilsinglright:333,fi:556,fl:556,endash:500,dagger:500,daggerdbl:500,periodcentered:250,paragraph:500,bullet:350,quotesinglbase:333,quotedblbase:500,quotedblright:500,guillemotright:500,ellipsis:1e3,perthousand:1e3,questiondown:500,grave:333,acute:333,circumflex:333,tilde:333,macron:333,breve:333,dotaccent:333,dieresis:333,ring:333,cedilla:333,hungarumlaut:333,ogonek:333,caron:333,emdash:1e3,AE:944,ordfeminine:266,Lslash:611,Oslash:722,OE:944,ordmasculine:300,ae:722,dotlessi:278,lslash:278,oslash:500,oe:722,germandbls:500,Idieresis:389,eacute:444,abreve:500,uhungarumlaut:556,ecaron:444,Ydieresis:611,divide:570,Yacute:611,Acircumflex:667,aacute:500,Ucircumflex:722,yacute:444,scommaaccent:389,ecircumflex:444,Uring:722,Udieresis:722,aogonek:500,Uacute:722,uogonek:556,Edieresis:667,Dcroat:722,commaaccent:250,copyright:747,Emacron:667,ccaron:444,aring:500,Ncommaaccent:722,lacute:278,agrave:500,Tcommaaccent:611,Cacute:667,atilde:500,Edotaccent:667,scaron:389,scedilla:389,iacute:278,lozenge:494,Rcaron:667,Gcommaaccent:722,ucircumflex:556,acircumflex:500,Amacron:667,rcaron:389,ccedilla:444,Zdotaccent:611,Thorn:611,Omacron:722,Racute:667,Sacute:556,dcaron:608,Umacron:722,uring:556,threesuperior:300,Ograve:722,Agrave:667,Abreve:667,multiply:570,uacute:556,Tcaron:611,partialdiff:494,ydieresis:444,Nacute:722,icircumflex:278,Ecircumflex:667,adieresis:500,edieresis:444,cacute:444,nacute:556,umacron:556,Ncaron:722,Iacute:389,plusminus:570,brokenbar:220,registered:747,Gbreve:722,Idotaccent:389,summation:600,Egrave:667,racute:389,omacron:500,Zacute:611,Zcaron:611,greaterequal:549,Eth:722,Ccedilla:667,lcommaaccent:278,tcaron:366,eogonek:444,Uogonek:722,Aacute:667,Adieresis:667,egrave:444,zacute:389,iogonek:278,Oacute:722,oacute:500,amacron:500,sacute:389,idieresis:278,Ocircumflex:722,Ugrave:722,Delta:612,thorn:500,twosuperior:300,Odieresis:722,mu:576,igrave:278,ohungarumlaut:500,Eogonek:667,dcroat:500,threequarters:750,Scedilla:556,lcaron:382,Kcommaaccent:667,Lacute:611,trademark:1e3,edotaccent:444,Igrave:389,Imacron:389,Lcaron:611,onehalf:750,lessequal:549,ocircumflex:500,ntilde:556,Uhungarumlaut:722,Eacute:667,emacron:444,gbreve:500,onequarter:750,Scaron:556,Scommaaccent:556,Ohungarumlaut:722,degree:400,ograve:500,Ccaron:667,ugrave:556,radical:549,Dcaron:722,rcommaaccent:389,Ntilde:722,otilde:500,Rcommaaccent:667,Lcommaaccent:611,Atilde:667,Aogonek:667,Aring:667,Otilde:722,zdotaccent:389,Ecaron:667,Iogonek:389,kcommaaccent:500,minus:606,Icircumflex:389,ncaron:556,tcommaaccent:278,logicalnot:606,odieresis:500,udieresis:556,notequal:549,gcommaaccent:500,eth:500,zcaron:389,ncommaaccent:556,onesuperior:300,imacron:278,Euro:500},"Times-Italic":{space:250,exclam:333,quotedbl:420,numbersign:500,dollar:500,percent:833,ampersand:778,quoteright:333,parenleft:333,parenright:333,asterisk:500,plus:675,comma:250,hyphen:333,period:250,slash:278,zero:500,one:500,two:500,three:500,four:500,five:500,six:500,seven:500,eight:500,nine:500,colon:333,semicolon:333,less:675,equal:675,greater:675,question:500,at:920,A:611,B:611,C:667,D:722,E:611,F:611,G:722,H:722,I:333,J:444,K:667,L:556,M:833,N:667,O:722,P:611,Q:722,R:611,S:500,T:556,U:722,V:611,W:833,X:611,Y:556,Z:556,bracketleft:389,backslash:278,bracketright:389,asciicircum:422,underscore:500,quoteleft:333,a:500,b:500,c:444,d:500,e:444,f:278,g:500,h:500,i:278,j:278,k:444,l:278,m:722,n:500,o:500,p:500,q:500,r:389,s:389,t:278,u:500,v:444,w:667,x:444,y:444,z:389,braceleft:400,bar:275,braceright:400,asciitilde:541,exclamdown:389,cent:500,sterling:500,fraction:167,yen:500,florin:500,section:500,currency:500,quotesingle:214,quotedblleft:556,guillemotleft:500,guilsinglleft:333,guilsinglright:333,fi:500,fl:500,endash:500,dagger:500,daggerdbl:500,periodcentered:250,paragraph:523,bullet:350,quotesinglbase:333,quotedblbase:556,quotedblright:556,guillemotright:500,ellipsis:889,perthousand:1e3,questiondown:500,grave:333,acute:333,circumflex:333,tilde:333,macron:333,breve:333,dotaccent:333,dieresis:333,ring:333,cedilla:333,hungarumlaut:333,ogonek:333,caron:333,emdash:889,AE:889,ordfeminine:276,Lslash:556,Oslash:722,OE:944,ordmasculine:310,ae:667,dotlessi:278,lslash:278,oslash:500,oe:667,germandbls:500,Idieresis:333,eacute:444,abreve:500,uhungarumlaut:500,ecaron:444,Ydieresis:556,divide:675,Yacute:556,Acircumflex:611,aacute:500,Ucircumflex:722,yacute:444,scommaaccent:389,ecircumflex:444,Uring:722,Udieresis:722,aogonek:500,Uacute:722,uogonek:500,Edieresis:611,Dcroat:722,commaaccent:250,copyright:760,Emacron:611,ccaron:444,aring:500,Ncommaaccent:667,lacute:278,agrave:500,Tcommaaccent:556,Cacute:667,atilde:500,Edotaccent:611,scaron:389,scedilla:389,iacute:278,lozenge:471,Rcaron:611,Gcommaaccent:722,ucircumflex:500,acircumflex:500,Amacron:611,rcaron:389,ccedilla:444,Zdotaccent:556,Thorn:611,Omacron:722,Racute:611,Sacute:500,dcaron:544,Umacron:722,uring:500,threesuperior:300,Ograve:722,Agrave:611,Abreve:611,multiply:675,uacute:500,Tcaron:556,partialdiff:476,ydieresis:444,Nacute:667,icircumflex:278,Ecircumflex:611,adieresis:500,edieresis:444,cacute:444,nacute:500,umacron:500,Ncaron:667,Iacute:333,plusminus:675,brokenbar:275,registered:760,Gbreve:722,Idotaccent:333,summation:600,Egrave:611,racute:389,omacron:500,Zacute:556,Zcaron:556,greaterequal:549,Eth:722,Ccedilla:667,lcommaaccent:278,tcaron:300,eogonek:444,Uogonek:722,Aacute:611,Adieresis:611,egrave:444,zacute:389,iogonek:278,Oacute:722,oacute:500,amacron:500,sacute:389,idieresis:278,Ocircumflex:722,Ugrave:722,Delta:612,thorn:500,twosuperior:300,Odieresis:722,mu:500,igrave:278,ohungarumlaut:500,Eogonek:611,dcroat:500,threequarters:750,Scedilla:500,lcaron:300,Kcommaaccent:667,Lacute:556,trademark:980,edotaccent:444,Igrave:333,Imacron:333,Lcaron:611,onehalf:750,lessequal:549,ocircumflex:500,ntilde:500,Uhungarumlaut:722,Eacute:611,emacron:444,gbreve:500,onequarter:750,Scaron:500,Scommaaccent:500,Ohungarumlaut:722,degree:400,ograve:500,Ccaron:667,ugrave:500,radical:453,Dcaron:722,rcommaaccent:389,Ntilde:667,otilde:500,Rcommaaccent:611,Lcommaaccent:556,Atilde:611,Aogonek:611,Aring:611,Otilde:722,zdotaccent:389,Ecaron:611,Iogonek:333,kcommaaccent:444,minus:675,Icircumflex:333,ncaron:500,tcommaaccent:278,logicalnot:675,odieresis:500,udieresis:500,notequal:549,gcommaaccent:500,eth:500,zcaron:389,ncommaaccent:500,onesuperior:300,imacron:278,Euro:500},ZapfDingbats:{space:278,a1:974,a2:961,a202:974,a3:980,a4:719,a5:789,a119:790,a118:791,a117:690,a11:960,a12:939,a13:549,a14:855,a15:911,a16:933,a105:911,a17:945,a18:974,a19:755,a20:846,a21:762,a22:761,a23:571,a24:677,a25:763,a26:760,a27:759,a28:754,a6:494,a7:552,a8:537,a9:577,a10:692,a29:786,a30:788,a31:788,a32:790,a33:793,a34:794,a35:816,a36:823,a37:789,a38:841,a39:823,a40:833,a41:816,a42:831,a43:923,a44:744,a45:723,a46:749,a47:790,a48:792,a49:695,a50:776,a51:768,a52:792,a53:759,a54:707,a55:708,a56:682,a57:701,a58:826,a59:815,a60:789,a61:789,a62:707,a63:687,a64:696,a65:689,a66:786,a67:787,a68:713,a69:791,a70:785,a71:791,a72:873,a73:761,a74:762,a203:762,a75:759,a204:759,a76:892,a77:892,a78:788,a79:784,a81:438,a82:138,a83:277,a84:415,a97:392,a98:392,a99:668,a100:668,a89:390,a90:390,a93:317,a94:317,a91:276,a92:276,a205:509,a85:509,a206:410,a86:410,a87:234,a88:234,a95:334,a96:334,a101:732,a102:544,a103:544,a104:910,a106:667,a107:760,a108:760,a112:776,a111:595,a110:694,a109:626,a120:788,a121:788,a122:788,a123:788,a124:788,a125:788,a126:788,a127:788,a128:788,a129:788,a130:788,a131:788,a132:788,a133:788,a134:788,a135:788,a136:788,a137:788,a138:788,a139:788,a140:788,a141:788,a142:788,a143:788,a144:788,a145:788,a146:788,a147:788,a148:788,a149:788,a150:788,a151:788,a152:788,a153:788,a154:788,a155:788,a156:788,a157:788,a158:788,a159:788,a160:894,a161:838,a163:1016,a164:458,a196:748,a165:924,a192:748,a166:918,a167:927,a168:928,a169:928,a170:834,a171:873,a172:828,a173:924,a162:924,a174:917,a175:930,a176:931,a177:463,a178:883,a179:836,a193:836,a180:867,a199:867,a181:696,a200:696,a182:874,a201:874,a183:760,a184:946,a197:771,a185:865,a194:771,a198:888,a186:967,a195:888,a187:831,a188:873,a189:927,a190:970,a191:918}},Dc={},Ec=1e3,Fc=function(){function d(a,b,c){this.lexer=a,this.allowStreams=b,this.xref=c,this.imageCache={},this.refill()}return d.prototype={refill:function(){this.buf1=this.lexer.getObj(),this.buf2=this.lexer.getObj()},shift:function(){A(this.buf2,"ID")?(this.buf1=this.buf2,this.buf2=null):(this.buf1=this.buf2,this.buf2=this.lexer.getObj())},tryShift:function(){try{return this.shift(),!0}catch(a){if(a instanceof ja)throw a;return!1}},getObj:function(b){var d=this.buf1;if(this.shift(),d instanceof za)switch(d.cmd){case"BI":return this.makeInlineImage(b);case"[":for(var e=[];!A(this.buf1,"]")&&!R(this.buf1);)e.push(this.getObj(b));return R(this.buf1)&&c("End of file inside array"),this.shift(),e;case"<<":for(var f=new Aa(this.xref);!A(this.buf1,">>")&&!R(this.buf1);)if(z(this.buf1)){var g=this.buf1.name;if(this.shift(),R(this.buf1))break;f.set(g,this.getObj(b))}else a("Malformed dictionary: key must be a name object"),this.shift();return R(this.buf1)&&c("End of file inside dictionary"),A(this.buf2,"stream")?this.allowStreams?this.makeStream(f,b):f:(this.shift(),f);default:return d}if(w(d)){var h=d;if(w(this.buf1)&&A(this.buf2,"R")){var i=new Ba(h,this.buf1);return this.shift(),this.shift(),i}return h}if(y(d)){var j=d;return b&&(j=b.decryptString(j)),j}return d},findDefaultInlineStreamEnd:function(a){for(var b,c,d,f,g=69,h=73,i=32,j=10,k=13,l=a.pos,m=0;-1!==(b=a.getByte());)if(0===m)m=b===g?1:0;else if(1===m)m=b===h?2:0;else if(e(2===m),b===i||b===j||b===k){for(d=5,f=a.peekBytes(d),c=0;d>c;c++)if(b=f[c],b!==j&&b!==k&&(i>b||b>127)){m=0;break}if(2===m)break}else m=0;return a.pos-4-l},findDCTDecodeInlineStreamEnd:function(a){for(var c,d,e,f=a.pos,g=!1;-1!==(c=a.getByte());)if(255===c){switch(a.getByte()){case 0:break;case 255:a.skip(-1);break;case 217:g=!0;break;case 192:case 193:case 194:case 195:case 197:case 198:case 199:case 201:case 202:case 203:case 205:case 206:case 207:case 196:case 204:case 218:case 219:case 220:case 221:case 222:case 223:case 224:case 225:case 226:case 227:case 228:case 229:case 230:case 231:case 232:case 233:case 234:case 235:case 236:case 237:case 238:case 239:case 254:d=a.getUint16(),d>2?a.skip(d-2):a.skip(-2)}if(g)break}return e=a.pos-f,-1===c?(b("Inline DCTDecode image stream: EOI marker not found, searching for /EI/ instead."),a.skip(-e),this.findDefaultInlineStreamEnd(a)):(this.inlineStreamSkipEI(a),e)},findASCII85DecodeInlineStreamEnd:function(a){for(var c,d,e=126,f=62,g=a.pos;-1!==(c=a.getByte());)if(c===e&&a.peekByte()===f){a.skip();break}return d=a.pos-g,-1===c?(b("Inline ASCII85Decode image stream: EOD marker not found, searching for /EI/ instead."),a.skip(-d),this.findDefaultInlineStreamEnd(a)):(this.inlineStreamSkipEI(a),d)},findASCIIHexDecodeInlineStreamEnd:function(a){for(var c,d,e=62,f=a.pos;-1!==(c=a.getByte())&&c!==e;);return d=a.pos-f,-1===c?(b("Inline ASCIIHexDecode image stream: EOD marker not found, searching for /EI/ instead."),a.skip(-d),this.findDefaultInlineStreamEnd(a)):(this.inlineStreamSkipEI(a),d)},inlineStreamSkipEI:function(a){for(var b,c=69,d=73,e=0;-1!==(b=a.getByte());)if(0===e)e=b===c?1:0;else if(1===e)e=b===d?2:0;else if(2===e)break},makeInlineImage:function(a){for(var b=this.lexer,d=b.stream,e=new Aa(this.xref);!A(this.buf1,"ID")&&!R(this.buf1);){z(this.buf1)||c("Dictionary key must be a name object");var f=this.buf1.name;if(this.shift(),R(this.buf1))break;e.set(f,this.getObj(a))}var g,h=e.get("Filter","F");z(h)?g=h.name:C(h)&&z(h[0])&&(g=h[0].name);var i,j,k,l=d.pos;i="DCTDecode"===g||"DCT"===g?this.findDCTDecodeInlineStreamEnd(d):"ASCII85Decide"===g||"A85"===g?this.findASCII85DecodeInlineStreamEnd(d):"ASCIIHexDecode"===g||"AHx"===g?this.findASCIIHexDecodeInlineStreamEnd(d):this.findDefaultInlineStreamEnd(d);var m,n=d.makeSubStream(l,i,e);if(Ec>i){var o=n.getBytes();n.reset();var p=1,q=0;for(j=0,k=o.length;k>j;++j)p+=255&o[j],q+=p;if(m=q%65521<<16|p%65521,this.imageCache.adler32===m)return this.buf2=za.get("EI"),this.shift(),this.imageCache[m].reset(),this.imageCache[m]}return a&&(n=a.createStream(n,i)),n=this.filter(n,e,i),n.dict=e,void 0!==m&&(n.cacheKey="inline_"+i+"_"+m,this.imageCache[m]=n),this.buf2=za.get("EI"),this.shift(),n},makeStream:function(b,d){var e=this.lexer,f=e.stream;e.skipToNextLine();var g=f.pos-1,h=b.get("Length");if(w(h)||(a("Bad "+h+" attribute in stream"),h=0),f.pos=g+h,e.nextChar(),this.tryShift()&&A(this.buf2,"endstream"))this.shift();else{f.pos=g;for(var i,j,k=2048,l=9,m=[101,110,100,115,116,114,101,97,109],n=0,o=!1;f.pos=q)break;for(o=!1,i=0,j=0;q>i;i++){var r=p[i];if(r!==m[j])i-=j,j=0;else if(j++,j>=l){i++,o=!0;break}}if(o){n+=i-l,f.pos+=i-l;break}n+=q,f.pos+=q}o||c("Missing endstream"),h=n,e.nextChar(),this.shift(),this.shift()}return this.shift(),f=f.makeSubStream(g,h,b),d&&(f=d.createStream(f,h)),f=this.filter(f,b,h),f.dict=b,f},filter:function(a,b,d){var e=b.get("Filter","F"),f=b.get("DecodeParms","DP");if(z(e))return this.makeFilter(a,e.name,d,f);var g=d;if(C(e))for(var h=e,i=f,j=0,k=h.length;k>j;++j)e=h[j],z(e)||c("Bad filter name: "+e),f=null,C(i)&&j in i&&(f=i[j]),a=this.makeFilter(a,e.name,g,f),g=null;return a},makeFilter:function(a,c,d,e){if(0===a.dict.get("Length")&&!d)return b('Empty "'+c+'" stream.'),new _c(a);try{e&&this.xref&&(e=this.xref.fetchIfRef(e));var f=this.xref.stats.streamTypes;if("FlateDecode"===c||"Fl"===c)return f[Y.FLATE]=!0,e?new Rc(new Qc(a,d),d,e):new Qc(a,d);if("LZWDecode"===c||"LZW"===c){f[Y.LZW]=!0;var g=1;return e?(e.has("EarlyChange")&&(g=e.get("EarlyChange")),new Rc(new $c(a,d,g),d,e)):new $c(a,d,g)}return"DCTDecode"===c||"DCT"===c?(f[Y.DCT]=!0,new Sc(a,d,a.dict,this.xref)):"JPXDecode"===c||"JPX"===c?(f[Y.JPX]=!0,new Tc(a,d,a.dict)):"ASCII85Decode"===c||"A85"===c?(f[Y.A85]=!0,new Wc(a,d)):"ASCIIHexDecode"===c||"AHx"===c?(f[Y.AHX]=!0,new Xc(a,d)):"CCITTFaxDecode"===c||"CCF"===c?(f[Y.CCF]=!0,new Zc(a,d,e)):"RunLengthDecode"===c||"RL"===c?(f[Y.RL]=!0,new Yc(a,d)):"JBIG2Decode"===c?(f[Y.JBIG]=!0,new Uc(a,d,a.dict)):(b('filter "'+c+'" not supported yet'),a)}catch(h){if(h instanceof ja)throw h;return b('Invalid stream: "'+h+'"'),new _c(a)}}},d}(),Gc=function(){function a(a,b){this.stream=a,this.nextChar(),this.strBuf=[],this.knownCommands=b}function d(a){return a>=48&&57>=a?15&a:a>=65&&70>=a||a>=97&&102>=a?(15&a)+9:-1}a.isSpace=function(a){return 32===a||9===a||13===a||10===a};var e=[1,0,0,0,0,0,0,0,0,1,1,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,2,0,0,2,2,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,2,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];return a.prototype={nextChar:function(){return this.currentChar=this.stream.getByte()},peekChar:function(){return this.stream.peekByte()},getNumber:function(){var a=this.currentChar,d=!1,e=0,f=1;if(45===a?(f=-1,a=this.nextChar(),45===a&&(a=this.nextChar())):43===a&&(a=this.nextChar()),46===a&&(e=10,a=this.nextChar()),48>a||a>57)return c("Invalid number: "+String.fromCharCode(a)),0;for(var g=a-48,h=0,i=1;(a=this.nextChar())>=0;)if(a>=48&&57>=a){var j=a-48;d?h=10*h+j:(0!==e&&(e*=10),g=10*g+j)}else if(46===a){if(0!==e)break;e=1}else if(45===a)b("Badly formated number");else{if(69!==a&&101!==a)break;if(a=this.peekChar(),43===a||45===a)i=45===a?-1:1,this.nextChar();else if(48>a||a>57)break;d=!0}return 0!==e&&(g/=e),d&&(g*=Math.pow(10,i*h)),f*g},getString:function(){var a=1,c=!1,d=this.strBuf;d.length=0;for(var e=this.nextChar();;){var f=!1;switch(0|e){case-1:b("Unterminated string"),c=!0;break;case 40:++a,d.push("(");break;case 41:0===--a?(this.nextChar(),c=!0):d.push(")");break;case 92:switch(e=this.nextChar()){case-1:b("Unterminated string"),c=!0;break;case 110:d.push("\n");break;case 114:d.push("\r");break;case 116:d.push(" ");break;case 98:d.push("\b");break;case 102:d.push("\f");break;case 92:case 40:case 41:d.push(String.fromCharCode(e));break;case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:var g=15&e;e=this.nextChar(),f=!0,e>=48&&55>=e&&(g=(g<<3)+(15&e),e=this.nextChar(),e>=48&&55>=e&&(f=!1,g=(g<<3)+(15&e))),d.push(String.fromCharCode(g));break;case 13:10===this.peekChar()&&this.nextChar();break;case 10:break;default:d.push(String.fromCharCode(e))}break;default:d.push(String.fromCharCode(e))}if(c)break;f||(e=this.nextChar())}return d.join("")},getName:function(){var a,f=this.strBuf;for(f.length=0;(a=this.nextChar())>=0&&!e[a];)if(35===a){a=this.nextChar();var g=d(a);if(-1!==g){var h=d(this.nextChar());-1===h&&c("Illegal digit in hex char in name: "+h),f.push(String.fromCharCode(g<<4|h))}else f.push("#",String.fromCharCode(a))}else f.push(String.fromCharCode(a));return f.length>127&&b("name token is longer than allowed by the spec: "+f.length),ya.get(f.join(""))},getHexString:function(){var a=this.strBuf;a.length=0;for(var c,f,g=this.currentChar,h=!0;;){if(0>g){b("Unterminated hex string");break}if(62===g){this.nextChar();break}if(1!==e[g]){if(h){if(c=d(g),-1===c){b('Ignoring invalid character "'+g+'" in hex string'),g=this.nextChar();continue}}else{if(f=d(g),-1===f){b('Ignoring invalid character "'+g+'" in hex string'),g=this.nextChar();continue}a.push(String.fromCharCode(c<<4|f))}h=!h,g=this.nextChar()}else g=this.nextChar()}return a.join("")},getObj:function(){for(var a=!1,b=this.currentChar;;){if(0>b)return Dc;if(a)(10===b||13===b)&&(a=!1);else if(37===b)a=!0;else if(1!==e[b])break;b=this.nextChar()}switch(0|b){case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:case 43:case 45:case 46:return this.getNumber();case 40:return this.getString();case 47:return this.getName();case 91:return this.nextChar(),za.get("[");case 93:return this.nextChar(),za.get("]");case 60:return b=this.nextChar(),60===b?(this.nextChar(),za.get("<<")):this.getHexString();case 62:return b=this.nextChar(),62===b?(this.nextChar(),za.get(">>")):za.get(">");case 123:return this.nextChar(),za.get("{");case 125:return this.nextChar(),za.get("}");case 41:c("Illegal character: "+b)}for(var d=String.fromCharCode(b),f=this.knownCommands,g=f&&void 0!==f[d];(b=this.nextChar())>=0&&!e[b];){var h=d+String.fromCharCode(b);if(g&&void 0===f[h])break;128===d.length&&c("Command token too long: "+d.length),d=h,g=f&&void 0!==f[d]}return"true"===d?!0:"false"===d?!1:"null"===d?null:za.get(d)},skipToNextLine:function(){for(var a=this.currentChar;a>=0;){if(13===a){a=this.nextChar(),10===a&&this.nextChar();break}if(10===a){this.nextChar();break}a=this.nextChar()}}},a}(),Hc={create:function(a){function b(a,b){var c=j.get(a);if(w(c)&&(b?c>=0:c>0))return c;throw new Error('The "'+a+'" parameter in the linearization dictionary is invalid.')}function c(){var a,b,c=j.get("H");if(C(c)&&(2===(a=c.length)||4===a)){for(var d=0;a>d;d++)if(!(w(b=c[d])&&b>0))throw new Error("Hint ("+d+") in the linearization dictionary is invalid.");return c}throw new Error("Hint array in the linearization dictionary is invalid.")}var d,e,f=new Fc(new Gc(a),!1,null),g=f.getObj(),h=f.getObj(),i=f.getObj(),j=f.getObj();if(!(w(g)&&w(h)&&A(i,"obj")&&B(j)&&x(d=j.get("Linearized"))&&d>0))return null;if((e=b("L"))!==a.length)throw new Error('The "L" parameter in the linearization dictionary does not equal the stream length.');return{length:e,hints:c(),objectNumberFirst:b("O"),endFirst:b("E"),numPages:b("N"),mainXRefEntriesOffset:b("T"),pageFirst:j.has("P")?b("P",!0):0}}},Ic=function(){function a(a){this.lexer=a,this.operators=[],this.token=null,this.prev=null}return a.prototype={nextToken:function(){this.prev=this.token,this.token=this.lexer.getToken()},accept:function(a){return this.token.type===a?(this.nextToken(),!0):!1},expect:function(a){return this.accept(a)?!0:void c("Unexpected symbol: found "+this.token.type+" expected "+a+".")},parse:function(){return this.nextToken(),this.expect(Jc.LBRACE),this.parseBlock(),this.expect(Jc.RBRACE),this.operators},parseBlock:function(){for(;;)if(this.accept(Jc.NUMBER))this.operators.push(this.prev.value);else if(this.accept(Jc.OPERATOR))this.operators.push(this.prev.value);else{if(!this.accept(Jc.LBRACE))return;this.parseCondition()}},parseCondition:function(){var a=this.operators.length;if(this.operators.push(null,null),this.parseBlock(),this.expect(Jc.RBRACE),this.accept(Jc.IF))this.operators[a]=this.operators.length,this.operators[a+1]="jz";else if(this.accept(Jc.LBRACE)){var b=this.operators.length;this.operators.push(null,null);var d=this.operators.length;this.parseBlock(),this.expect(Jc.RBRACE),this.expect(Jc.IFELSE),this.operators[b]=this.operators.length,this.operators[b+1]="j",this.operators[a]=d,this.operators[a+1]="jz"}else c("PS Function: error parsing conditional.")}},a}(),Jc={LBRACE:0,RBRACE:1,NUMBER:2,OPERATOR:3,IF:4,IFELSE:5},Kc=function(){function a(a,b){this.type=a,this.value=b}var b={};return a.getOperator=function(c){var d=b[c];return d?d:b[c]=new a(Jc.OPERATOR,c)},a.LBRACE=new a(Jc.LBRACE,"{"),a.RBRACE=new a(Jc.RBRACE,"}"),a.IF=new a(Jc.IF,"IF"),a.IFELSE=new a(Jc.IFELSE,"IFELSE"),a}(),Lc=function(){function a(a){this.stream=a,this.nextChar(),this.strBuf=[]}return a.prototype={nextChar:function(){return this.currentChar=this.stream.getByte()},getToken:function(){for(var a=!1,b=this.currentChar;;){if(0>b)return Dc;if(a)(10===b||13===b)&&(a=!1);else if(37===b)a=!0;else if(!Gc.isSpace(b))break;b=this.nextChar()}switch(0|b){case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:case 43:case 45:case 46:return new Kc(Jc.NUMBER,this.getNumber());case 123:return this.nextChar(),Kc.LBRACE;case 125:return this.nextChar(),Kc.RBRACE}var c=this.strBuf;for(c.length=0,c[0]=String.fromCharCode(b);(b=this.nextChar())>=0&&(b>=65&&90>=b||b>=97&&122>=b);)c.push(String.fromCharCode(b));var d=c.join("");switch(d.toLowerCase()){case"if":return Kc.IF;case"ifelse":return Kc.IFELSE;default:return Kc.getOperator(d)}},getNumber:function(){var a=this.currentChar,b=this.strBuf;for(b.length=0,b[0]=String.fromCharCode(a);(a=this.nextChar())>=0&&(a>=48&&57>=a||45===a||46===a);)b.push(String.fromCharCode(a));var d=parseFloat(b.join(""));return isNaN(d)&&c("Invalid floating point number: "+d),d}},a}(),Mc=function(){function a(a,b,c,d){this.bytes=a instanceof Uint8Array?a:new Uint8Array(a),this.start=b||0,this.pos=this.start,this.end=b+c||this.bytes.length,this.dict=d}return a.prototype={get length(){return this.end-this.start},get isEmpty(){return 0===this.length},getByte:function(){return this.pos>=this.end?-1:this.bytes[this.pos++]},getUint16:function(){var a=this.getByte(),b=this.getByte();return-1===a||-1===b?-1:(a<<8)+b},getInt32:function(){var a=this.getByte(),b=this.getByte(),c=this.getByte(),d=this.getByte();return(a<<24)+(b<<16)+(c<<8)+d},getBytes:function(a){var b=this.bytes,c=this.pos,d=this.end;if(!a)return b.subarray(c,d);var e=c+a;return e>d&&(e=d),this.pos=e,b.subarray(c,e)},peekByte:function(){var a=this.getByte();return this.pos--,a},peekBytes:function(a){var b=this.getBytes(a);return this.pos-=b.length,b},skip:function(a){a||(a=1),this.pos+=a},reset:function(){this.pos=this.start},moveStart:function(){this.start=this.pos},makeSubStream:function(b,c,d){return new a(this.bytes.buffer,b,c,d)},isStream:!0},a}(),Nc=function(){function a(a){for(var b=a.length,c=new Uint8Array(b),d=0;b>d;++d)c[d]=a.charCodeAt(d);Mc.call(this,c)}return a.prototype=Mc.prototype,a}(),Oc=function(){function a(a){if(this.pos=0,this.bufferLength=0,this.eof=!1,this.buffer=b,this.minBufferLength=512,a)for(;this.minBufferLengthc;)c*=2;var d=new Uint8Array(c);return d.set(b),this.buffer=d},getByte:function(){for(var a=this.pos;this.bufferLength<=a;){if(this.eof)return-1;this.readBlock()}return this.buffer[this.pos++]},getUint16:function(){var a=this.getByte(),b=this.getByte();return-1===a||-1===b?-1:(a<<8)+b},getInt32:function(){var a=this.getByte(),b=this.getByte(),c=this.getByte(),d=this.getByte();return(a<<24)+(b<<16)+(c<<8)+d},getBytes:function(a){var b,c=this.pos;if(a){for(this.ensureBuffer(c+a),b=c+a;!this.eof&&this.bufferLengthd&&(b=d)}else{for(;!this.eof;)this.readBlock();b=this.bufferLength}return this.pos=b,this.buffer.subarray(c,b)},peekByte:function(){var a=this.getByte();return this.pos--,a},peekBytes:function(a){var b=this.getBytes(a);return this.pos-=b.length,b},makeSubStream:function(a,b,c){for(var d=a+b;this.bufferLength<=d&&!this.eof;)this.readBlock();return new Mc(this.buffer,a,b,c)},skip:function(a){a||(a=1),this.pos+=a},reset:function(){this.pos=0},getBaseStreams:function(){return this.str&&this.str.getBaseStreams?this.str.getBaseStreams():[]}},a}(),Pc=function(){function a(a){this.streams=a,Oc.call(this,null)}return a.prototype=Object.create(Oc.prototype),a.prototype.readBlock=function(){var a=this.streams;if(0===a.length)return void(this.eof=!0);var b=a.shift(),c=b.getBytes(),d=this.bufferLength,e=d+c.length,f=this.ensureBuffer(e);f.set(c,d),this.bufferLength=e},a.prototype.getBaseStreams=function(){for(var a=[],b=0,c=this.streams.length;c>b;b++){var d=this.streams[b];d.getBaseStreams&&na.appendToArray(a,d.getBaseStreams())}return a},a}(),Qc=function(){function a(a,b){this.str=a,this.dict=a.dict;var d=a.getByte(),e=a.getByte();(-1===d||-1===e)&&c("Invalid header in flate stream: "+d+", "+e),8!==(15&d)&&c("Unknown compression method in flate stream: "+d+", "+e),((d<<8)+e)%31!==0&&c("Bad FCHECK in flate stream: "+d+", "+e),32&e&&c("FDICT bit set in flate stream: "+d+", "+e),this.codeSize=0,this.codeBuf=0,Oc.call(this,b)}var b=new Int32Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),d=new Int32Array([3,4,5,6,7,8,9,10,65547,65549,65551,65553,131091,131095,131099,131103,196643,196651,196659,196667,262211,262227,262243,262259,327811,327843,327875,327907,258,258,258]),e=new Int32Array([1,2,3,4,65541,65543,131081,131085,196625,196633,262177,262193,327745,327777,393345,393409,459009,459137,524801,525057,590849,591361,657409,658433,724993,727041,794625,798721,868353,876545]),f=[new Int32Array([459008,524368,524304,524568,459024,524400,524336,590016,459016,524384,524320,589984,524288,524416,524352,590048,459012,524376,524312,589968,459028,524408,524344,590032,459020,524392,524328,59e4,524296,524424,524360,590064,459010,524372,524308,524572,459026,524404,524340,590024,459018,524388,524324,589992,524292,524420,524356,590056,459014,524380,524316,589976,459030,524412,524348,590040,459022,524396,524332,590008,524300,524428,524364,590072,459009,524370,524306,524570,459025,524402,524338,590020,459017,524386,524322,589988,524290,524418,524354,590052,459013,524378,524314,589972,459029,524410,524346,590036,459021,524394,524330,590004,524298,524426,524362,590068,459011,524374,524310,524574,459027,524406,524342,590028,459019,524390,524326,589996,524294,524422,524358,590060,459015,524382,524318,589980,459031,524414,524350,590044,459023,524398,524334,590012,524302,524430,524366,590076,459008,524369,524305,524569,459024,524401,524337,590018,459016,524385,524321,589986,524289,524417,524353,590050,459012,524377,524313,589970,459028,524409,524345,590034,459020,524393,524329,590002,524297,524425,524361,590066,459010,524373,524309,524573,459026,524405,524341,590026,459018,524389,524325,589994,524293,524421,524357,590058,459014,524381,524317,589978,459030,524413,524349,590042,459022,524397,524333,590010,524301,524429,524365,590074,459009,524371,524307,524571,459025,524403,524339,590022,459017,524387,524323,589990,524291,524419,524355,590054,459013,524379,524315,589974,459029,524411,524347,590038,459021,524395,524331,590006,524299,524427,524363,590070,459011,524375,524311,524575,459027,524407,524343,590030,459019,524391,524327,589998,524295,524423,524359,590062,459015,524383,524319,589982,459031,524415,524351,590046,459023,524399,524335,590014,524303,524431,524367,590078,459008,524368,524304,524568,459024,524400,524336,590017,459016,524384,524320,589985,524288,524416,524352,590049,459012,524376,524312,589969,459028,524408,524344,590033,459020,524392,524328,590001,524296,524424,524360,590065,459010,524372,524308,524572,459026,524404,524340,590025,459018,524388,524324,589993,524292,524420,524356,590057,459014,524380,524316,589977,459030,524412,524348,590041,459022,524396,524332,590009,524300,524428,524364,590073,459009,524370,524306,524570,459025,524402,524338,590021,459017,524386,524322,589989,524290,524418,524354,590053,459013,524378,524314,589973,459029,524410,524346,590037,459021,524394,524330,590005,524298,524426,524362,590069,459011,524374,524310,524574,459027,524406,524342,590029,459019,524390,524326,589997,524294,524422,524358,590061,459015,524382,524318,589981,459031,524414,524350,590045,459023,524398,524334,590013,524302,524430,524366,590077,459008,524369,524305,524569,459024,524401,524337,590019,459016,524385,524321,589987,524289,524417,524353,590051,459012,524377,524313,589971,459028,524409,524345,590035,459020,524393,524329,590003,524297,524425,524361,590067,459010,524373,524309,524573,459026,524405,524341,590027,459018,524389,524325,589995,524293,524421,524357,590059,459014,524381,524317,589979,459030,524413,524349,590043,459022,524397,524333,590011,524301,524429,524365,590075,459009,524371,524307,524571,459025,524403,524339,590023,459017,524387,524323,589991,524291,524419,524355,590055,459013,524379,524315,589975,459029,524411,524347,590039,459021,524395,524331,590007,524299,524427,524363,590071,459011,524375,524311,524575,459027,524407,524343,590031,459019,524391,524327,589999,524295,524423,524359,590063,459015,524383,524319,589983,459031,524415,524351,590047,459023,524399,524335,590015,524303,524431,524367,590079]),9],g=[new Int32Array([327680,327696,327688,327704,327684,327700,327692,327708,327682,327698,327690,327706,327686,327702,327694,0,327681,327697,327689,327705,327685,327701,327693,327709,327683,327699,327691,327707,327687,327703,327695,0]),5]; +return a.prototype=Object.create(Oc.prototype),a.prototype.getBits=function(a){for(var b,d=this.str,e=this.codeSize,f=this.codeBuf;a>e;)-1===(b=d.getByte())&&c("Bad encoding in flate stream"),f|=b<>a,this.codeSize=e-=a,b},a.prototype.getCode=function(a){for(var b,d=this.str,e=a[0],f=a[1],g=this.codeSize,h=this.codeBuf;f>g&&-1!==(b=d.getByte());)h|=b<>16,k=65535&i;return(1>j||j>g)&&c("Bad encoding in flate stream"),this.codeBuf=h>>j,this.codeSize=g-j,k},a.prototype.generateHuffmanTable=function(a){var b,c=a.length,d=0;for(b=0;c>b;++b)a[b]>d&&(d=a[b]);for(var e=1<=g;++g,h<<=1,i<<=1)for(var j=0;c>j;++j)if(a[j]===g){var k=0,l=h;for(b=0;g>b;++b)k=k<<1|1&l,l>>=1;for(b=k;e>b;b+=i)f[b]=g<<16|j;++h}return[f,d]},a.prototype.readBlock=function(){var a,h,i=this.str,j=this.getBits(3);if(1&j&&(this.eof=!0),j>>=1,0!==j){var k,l;if(1===j)k=f,l=g;else if(2===j){var m,n=this.getBits(5)+257,o=this.getBits(5)+1,p=this.getBits(4)+4,q=new Uint8Array(b.length);for(m=0;p>m;++m)q[b[m]]=this.getBits(3);var r=this.generateHuffmanTable(q);h=0,m=0;for(var s,t,u,v=n+o,w=new Uint8Array(v);v>m;){var x=this.getCode(r);if(16===x)s=2,t=3,u=h;else if(17===x)s=3,t=3,u=h=0;else{if(18!==x){w[m++]=h=x;continue}s=7,t=11,u=h=0}for(var y=this.getBits(s)+t;y-- >0;)w[m++]=u}k=this.generateHuffmanTable(w.subarray(0,n)),l=this.generateHuffmanTable(w.subarray(n,v))}else c("Unknown block type in flate stream");a=this.buffer;for(var z=a?a.length:0,A=this.bufferLength;;){var B=this.getCode(k);if(256>B)A+1>=z&&(a=this.ensureBuffer(A+1),z=a.length),a[A++]=B;else{if(256===B)return void(this.bufferLength=A);B-=257,B=d[B];var C=B>>16;C>0&&(C=this.getBits(C)),h=(65535&B)+C,B=this.getCode(l),B=e[B],C=B>>16,C>0&&(C=this.getBits(C));var D=(65535&B)+C;A+h>=z&&(a=this.ensureBuffer(A+h),z=a.length);for(var E=0;h>E;++E,++A)a[A]=a[A-D]}}}else{var F;-1===(F=i.getByte())&&c("Bad block header in flate stream");var G=F;-1===(F=i.getByte())&&c("Bad block header in flate stream"),G|=F<<8,-1===(F=i.getByte())&&c("Bad block header in flate stream");var H=F;-1===(F=i.getByte())&&c("Bad block header in flate stream"),H|=F<<8,H===(65535&~G)||0===G&&0===H||c("Bad uncompressed block length in flate stream"),this.codeBuf=0,this.codeSize=0;var I=this.bufferLength;a=this.ensureBuffer(I+G);var J=I+G;if(this.bufferLength=J,0===G)-1===i.peekByte()&&(this.eof=!0);else for(var K=I;J>K;++K){if(-1===(F=i.getByte())){this.eof=!0;break}a[K]=F}}},a}(),Rc=function(){function a(a,b,d){var e=this.predictor=d.get("Predictor")||1;if(1>=e)return a;2!==e&&(10>e||e>15)&&c("Unsupported predictor: "+e),2===e?this.readBlock=this.readBlockTiff:this.readBlock=this.readBlockPng,this.str=a,this.dict=a.dict;var f=this.colors=d.get("Colors")||1,g=this.bits=d.get("BitsPerComponent")||8,h=this.columns=d.get("Columns")||1;return this.pixBytes=f*g+7>>3,this.rowBytes=h*f*g+7>>3,Oc.call(this,b),this}return a.prototype=Object.create(Oc.prototype),a.prototype.readBlockTiff=function(){var a=this.rowBytes,b=this.bufferLength,c=this.ensureBuffer(b+a),d=this.bits,e=this.colors,f=this.str.getBytes(a);if(this.eof=!f.length,!this.eof){var g,h=0,i=0,j=0,k=0,l=b;if(1===d)for(g=0;a>g;++g){var m=f[g];h=h<<8|m,c[l++]=255&(m^h>>e),h&=65535}else if(8===d){for(g=0;e>g;++g)c[l++]=f[g];for(;a>g;++g)c[l]=c[l-e]+f[g],l++}else{var n=new Uint8Array(e+1),o=(1<g;++g)for(var s=0;e>s;++s)d>j&&(h=h<<8|255&f[p++],j+=8),n[s]=n[s]+(h>>j-d)&o,j-=d,i=i<=8&&(c[q++]=i>>k-8&255,k-=8);k>0&&(c[q++]=(i<<8-k)+(h&(1<<8-k)-1))}this.bufferLength+=a}},a.prototype.readBlockPng=function(){var a=this.rowBytes,b=this.pixBytes,d=this.str.getByte(),e=this.str.getBytes(a);if(this.eof=!e.length,!this.eof){var f=this.bufferLength,g=this.ensureBuffer(f+a),h=g.subarray(f-a,f);0===h.length&&(h=new Uint8Array(a));var i,j,k,l=f;switch(d){case 0:for(i=0;a>i;++i)g[l++]=e[i];break;case 1:for(i=0;b>i;++i)g[l++]=e[i];for(;a>i;++i)g[l]=g[l-b]+e[i]&255,l++;break;case 2:for(i=0;a>i;++i)g[l++]=h[i]+e[i]&255;break;case 3:for(i=0;b>i;++i)g[l++]=(h[i]>>1)+e[i];for(;a>i;++i)g[l]=(h[i]+g[l-b]>>1)+e[i]&255,l++;break;case 4:for(i=0;b>i;++i)j=h[i],k=e[i],g[l++]=j+k;for(;a>i;++i){j=h[i];var m=h[i-b],n=g[l-b],o=n+j-m,p=o-n;0>p&&(p=-p);var q=o-j;0>q&&(q=-q);var r=o-m;0>r&&(r=-r),k=e[i],q>=p&&r>=p?g[l++]=n+k:r>=q?g[l++]=j+k:g[l++]=m+k}break;default:c("Unsupported predictor: "+d)}this.bufferLength+=a}},a}(),Sc=function(){function a(a,b,c,d){for(var e;-1!==(e=a.getByte());)if(255===e){a.skip(-1);break}this.stream=a,this.maybeLength=b,this.dict=c,Oc.call(this,b)}return a.prototype=Object.create(Oc.prototype),Object.defineProperty(a.prototype,"bytes",{get:function(){return g(this,"bytes",this.stream.getBytes(this.maybeLength))},configurable:!0}),a.prototype.ensureBuffer=function(a){if(!this.bufferLength)try{var b=new gd;if(this.forceRGB&&this.dict&&C(this.dict.get("Decode"))){for(var d=this.dict.get("Decode"),e=this.dict.get("BitsPerComponent")||8,f=d.length,g=new Int32Array(f),h=!1,i=(1<j;j+=2)g[j]=256*(d[j+1]-d[j])|0,g[j+1]=d[j]*i|0,(256!==g[j]||0!==g[j+1])&&(h=!0);h&&(b.decodeTransform=g)}b.parse(this.bytes);var k=b.getData(this.drawWidth,this.drawHeight,this.forceRGB);this.buffer=k,this.bufferLength=k.length,this.eof=!0}catch(l){c("JPEG error: "+l)}},a.prototype.getBytes=function(a){return this.ensureBuffer(),this.buffer},a.prototype.getIR=function(){return PDFJS.createObjectURL(this.bytes,"image/jpeg")},a.prototype.isNativelySupported=function(a,b){var c=Xa.parse(this.dict.get("ColorSpace","CS"),a,b);return("DeviceGray"===c.name||"DeviceRGB"===c.name)&&c.isDefaultDecode(this.dict.get("Decode","D"))},a.prototype.isNativelyDecodable=function(a,b){var c=Xa.parse(this.dict.get("ColorSpace","CS"),a,b);return(1===c.numComps||3===c.numComps)&&c.isDefaultDecode(this.dict.get("Decode","D"))},a}(),Tc=function(){function a(a,b,c){this.stream=a,this.maybeLength=b,this.dict=c,Oc.call(this,b)}return a.prototype=Object.create(Oc.prototype),Object.defineProperty(a.prototype,"bytes",{get:function(){return g(this,"bytes",this.stream.getBytes(this.maybeLength))},configurable:!0}),a.prototype.ensureBuffer=function(a){if(!this.bufferLength){var b=new hd;b.parse(this.bytes);var c=b.width,d=b.height,e=b.componentsCount,f=b.tiles.length;if(1===f)this.buffer=b.tiles[0].items;else{for(var g=new Uint8Array(c*d*e),h=0;f>h;h++)for(var i=b.tiles[h],j=i.width,k=i.height,l=i.left,m=i.top,n=i.items,o=0,p=(c*m+l)*e,q=c*e,r=j*e,s=0;k>s;s++){var t=n.subarray(o,o+r);g.set(t,p),o+=r,p+=q}this.buffer=g}this.bufferLength=this.buffer.length,this.eof=!0}},a}(),Uc=function(){function a(a,b,c){this.stream=a,this.maybeLength=b,this.dict=c,Oc.call(this,b)}return a.prototype=Object.create(Oc.prototype),Object.defineProperty(a.prototype,"bytes",{get:function(){return g(this,"bytes",this.stream.getBytes(this.maybeLength))},configurable:!0}),a.prototype.ensureBuffer=function(a){if(!this.bufferLength){var c=new id,d=[],e=this.dict.xref,f=e.fetchIfRef(this.dict.get("DecodeParms"));if(C(f)&&(f.length>1&&b("JBIG2 - 'DecodeParms' array with multiple elements not supported."),f=e.fetchIfRef(f[0])),f&&f.has("JBIG2Globals")){var g=f.get("JBIG2Globals"),h=g.getBytes();d.push({data:h,start:0,end:h.length})}d.push({data:this.bytes,start:0,end:this.bytes.length});for(var i=c.parseChunks(d),j=i.length,k=0;j>k;k++)i[k]^=255;this.buffer=i,this.bufferLength=j,this.eof=!0}},a}(),Vc=function(){function a(a,b,c){this.str=a,this.dict=a.dict,this.decrypt=c,this.nextChunk=null,this.initialized=!1,Oc.call(this,b)}var b=512;return a.prototype=Object.create(Oc.prototype),a.prototype.readBlock=function(){var a;if(this.initialized?a=this.nextChunk:(a=this.str.getBytes(b),this.initialized=!0),!a||0===a.length)return void(this.eof=!0);this.nextChunk=this.str.getBytes(b);var c=this.nextChunk&&this.nextChunk.length>0,d=this.decrypt;a=d(a,!c);var e,f=this.bufferLength,g=a.length,h=this.ensureBuffer(f+g);for(e=0;g>e;e++)h[f++]=a[e];this.bufferLength=f},a}(),Wc=function(){function a(a,b){this.str=a,this.dict=a.dict,this.input=new Uint8Array(5),b&&(b=.8*b),Oc.call(this,b)}return a.prototype=Object.create(Oc.prototype),a.prototype.readBlock=function(){for(var a=126,b=122,c=-1,d=this.str,e=d.getByte();Gc.isSpace(e);)e=d.getByte();if(e===c||e===a)return void(this.eof=!0);var f,g,h=this.bufferLength;if(e===b){for(f=this.ensureBuffer(h+4),g=0;4>g;++g)f[h+g]=0;this.bufferLength+=4}else{var i=this.input;for(i[0]=e,g=1;5>g;++g){for(e=d.getByte();Gc.isSpace(e);)e=d.getByte();if(i[g]=e,e===c||e===a)break}if(f=this.ensureBuffer(h+g-1),this.bufferLength+=g-1,5>g){for(;5>g;++g)i[g]=117;this.eof=!0}var j=0;for(g=0;5>g;++g)j=85*j+(i[g]-33);for(g=3;g>=0;--g)f[h+g]=255&j,j>>=8}},a}(),Xc=function(){function a(a,b){this.str=a,this.dict=a.dict,this.firstDigit=-1,b&&(b=.5*b),Oc.call(this,b)}return a.prototype=Object.create(Oc.prototype),a.prototype.readBlock=function(){var a=8e3,b=this.str.getBytes(a);if(!b.length)return void(this.eof=!0);for(var c=b.length+1>>1,d=this.ensureBuffer(this.bufferLength+c),e=this.bufferLength,f=this.firstDigit,g=0,h=b.length;h>g;g++){var i,j=b[g];if(j>=48&&57>=j)i=15&j;else{if(!(j>=65&&70>=j||j>=97&&102>=j)){if(62===j){this.eof=!0;break}continue}i=(15&j)+9}0>f?f=i:(d[e++]=f<<4|i,f=-1)}f>=0&&this.eof&&(d[e++]=f<<4,f=-1),this.firstDigit=f,this.bufferLength=e},a}(),Yc=function(){function a(a,b){this.str=a,this.dict=a.dict,Oc.call(this,b)}return a.prototype=Object.create(Oc.prototype),a.prototype.readBlock=function(){var a=this.str.getBytes(2);if(!a||a.length<2||128===a[0])return void(this.eof=!0);var b,c=this.bufferLength,d=a[0];if(128>d){if(b=this.ensureBuffer(c+d+1),b[c++]=a[1],d>0){var e=this.str.getBytes(d);b.set(e,c),c+=d}}else{d=257-d;var f=a[1];b=this.ensureBuffer(c+d+1);for(var g=0;d>g;g++)b[c++]=f}this.bufferLength=c},a}(),Zc=function(){function b(a,b,c){this.str=a,this.dict=a.dict,c=c||Aa.empty,this.encoding=c.get("K")||0,this.eoline=c.get("EndOfLine")||!1,this.byteAlign=c.get("EncodedByteAlign")||!1,this.columns=c.get("Columns")||1728,this.rows=c.get("Rows")||0;var d=c.get("EndOfBlock");(null===d||void 0===d)&&(d=!0),this.eoblock=d,this.black=c.get("BlackIs1")||!1,this.codingLine=new Uint32Array(this.columns+1),this.refLine=new Uint32Array(this.columns+2),this.codingLine[0]=this.columns,this.codingPos=0,this.row=0,this.nextLine2D=this.encoding<0,this.inputBits=0,this.inputBuf=0,this.outputBits=0;for(var e;0===(e=this.lookBits(12));)this.eatBits(1);1===e&&this.eatBits(12),this.encoding>0&&(this.nextLine2D=!this.lookBits(1),this.eatBits(1)),Oc.call(this,b)}var c=-2,d=0,e=1,f=2,g=3,h=4,i=5,j=6,k=7,l=8,m=[[-1,-1],[-1,-1],[7,l],[7,k],[6,j],[6,j],[6,i],[6,i],[4,d],[4,d],[4,d],[4,d],[4,d],[4,d],[4,d],[4,d],[3,e],[3,e],[3,e],[3,e],[3,e],[3,e],[3,e],[3,e],[3,e],[3,e],[3,e],[3,e],[3,e],[3,e],[3,e],[3,e],[3,h],[3,h],[3,h],[3,h],[3,h],[3,h],[3,h],[3,h],[3,h],[3,h],[3,h],[3,h],[3,h],[3,h],[3,h],[3,h],[3,g],[3,g],[3,g],[3,g],[3,g],[3,g],[3,g],[3,g],[3,g],[3,g],[3,g],[3,g],[3,g],[3,g],[3,g],[3,g],[1,f],[1,f],[1,f],[1,f],[1,f],[1,f],[1,f],[1,f],[1,f],[1,f],[1,f],[1,f],[1,f],[1,f],[1,f],[1,f],[1,f],[1,f],[1,f],[1,f],[1,f],[1,f],[1,f],[1,f],[1,f],[1,f],[1,f],[1,f],[1,f],[1,f],[1,f],[1,f],[1,f],[1,f],[1,f],[1,f],[1,f],[1,f],[1,f],[1,f],[1,f],[1,f],[1,f],[1,f],[1,f],[1,f],[1,f],[1,f],[1,f],[1,f],[1,f],[1,f],[1,f],[1,f],[1,f],[1,f],[1,f],[1,f],[1,f],[1,f],[1,f],[1,f],[1,f],[1,f]],n=[[-1,-1],[12,c],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[11,1792],[11,1792],[12,1984],[12,2048],[12,2112],[12,2176],[12,2240],[12,2304],[11,1856],[11,1856],[11,1920],[11,1920],[12,2368],[12,2432],[12,2496],[12,2560]],o=[[-1,-1],[-1,-1],[-1,-1],[-1,-1],[8,29],[8,29],[8,30],[8,30],[8,45],[8,45],[8,46],[8,46],[7,22],[7,22],[7,22],[7,22],[7,23],[7,23],[7,23],[7,23],[8,47],[8,47],[8,48],[8,48],[6,13],[6,13],[6,13],[6,13],[6,13],[6,13],[6,13],[6,13],[7,20],[7,20],[7,20],[7,20],[8,33],[8,33],[8,34],[8,34],[8,35],[8,35],[8,36],[8,36],[8,37],[8,37],[8,38],[8,38],[7,19],[7,19],[7,19],[7,19],[8,31],[8,31],[8,32],[8,32],[6,1],[6,1],[6,1],[6,1],[6,1],[6,1],[6,1],[6,1],[6,12],[6,12],[6,12],[6,12],[6,12],[6,12],[6,12],[6,12],[8,53],[8,53],[8,54],[8,54],[7,26],[7,26],[7,26],[7,26],[8,39],[8,39],[8,40],[8,40],[8,41],[8,41],[8,42],[8,42],[8,43],[8,43],[8,44],[8,44],[7,21],[7,21],[7,21],[7,21],[7,28],[7,28],[7,28],[7,28],[8,61],[8,61],[8,62],[8,62],[8,63],[8,63],[8,0],[8,0],[8,320],[8,320],[8,384],[8,384],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[7,27],[7,27],[7,27],[7,27],[8,59],[8,59],[8,60],[8,60],[9,1472],[9,1536],[9,1600],[9,1728],[7,18],[7,18],[7,18],[7,18],[7,24],[7,24],[7,24],[7,24],[8,49],[8,49],[8,50],[8,50],[8,51],[8,51],[8,52],[8,52],[7,25],[7,25],[7,25],[7,25],[8,55],[8,55],[8,56],[8,56],[8,57],[8,57],[8,58],[8,58],[6,192],[6,192],[6,192],[6,192],[6,192],[6,192],[6,192],[6,192],[6,1664],[6,1664],[6,1664],[6,1664],[6,1664],[6,1664],[6,1664],[6,1664],[8,448],[8,448],[8,512],[8,512],[9,704],[9,768],[8,640],[8,640],[8,576],[8,576],[9,832],[9,896],[9,960],[9,1024],[9,1088],[9,1152],[9,1216],[9,1280],[9,1344],[9,1408],[7,256],[7,256],[7,256],[7,256],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[6,16],[6,16],[6,16],[6,16],[6,16],[6,16],[6,16],[6,16],[6,17],[6,17],[6,17],[6,17],[6,17],[6,17],[6,17],[6,17],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[6,14],[6,14],[6,14],[6,14],[6,14],[6,14],[6,14],[6,14],[6,15],[6,15],[6,15],[6,15],[6,15],[6,15],[6,15],[6,15],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7]],p=[[-1,-1],[-1,-1],[12,c],[12,c],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[11,1792],[11,1792],[11,1792],[11,1792],[12,1984],[12,1984],[12,2048],[12,2048],[12,2112],[12,2112],[12,2176],[12,2176],[12,2240],[12,2240],[12,2304],[12,2304],[11,1856],[11,1856],[11,1856],[11,1856],[11,1920],[11,1920],[11,1920],[11,1920],[12,2368],[12,2368],[12,2432],[12,2432],[12,2496],[12,2496],[12,2560],[12,2560],[10,18],[10,18],[10,18],[10,18],[10,18],[10,18],[10,18],[10,18],[12,52],[12,52],[13,640],[13,704],[13,768],[13,832],[12,55],[12,55],[12,56],[12,56],[13,1280],[13,1344],[13,1408],[13,1472],[12,59],[12,59],[12,60],[12,60],[13,1536],[13,1600],[11,24],[11,24],[11,24],[11,24],[11,25],[11,25],[11,25],[11,25],[13,1664],[13,1728],[12,320],[12,320],[12,384],[12,384],[12,448],[12,448],[13,512],[13,576],[12,53],[12,53],[12,54],[12,54],[13,896],[13,960],[13,1024],[13,1088],[13,1152],[13,1216],[10,64],[10,64],[10,64],[10,64],[10,64],[10,64],[10,64],[10,64]],q=[[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[11,23],[11,23],[12,50],[12,51],[12,44],[12,45],[12,46],[12,47],[12,57],[12,58],[12,61],[12,256],[10,16],[10,16],[10,16],[10,16],[10,17],[10,17],[10,17],[10,17],[12,48],[12,49],[12,62],[12,63],[12,30],[12,31],[12,32],[12,33],[12,40],[12,41],[11,22],[11,22],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[9,15],[9,15],[9,15],[9,15],[9,15],[9,15],[9,15],[9,15],[12,128],[12,192],[12,26],[12,27],[12,28],[12,29],[11,19],[11,19],[11,20],[11,20],[12,34],[12,35],[12,36],[12,37],[12,38],[12,39],[11,21],[11,21],[12,42],[12,43],[10,0],[10,0],[10,0],[10,0],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12]],r=[[-1,-1],[-1,-1],[-1,-1],[-1,-1],[6,9],[6,8],[5,7],[5,7],[4,6],[4,6],[4,6],[4,6],[4,5],[4,5],[4,5],[4,5],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2]];return b.prototype=Object.create(Oc.prototype),b.prototype.readBlock=function(){for(;!this.eof;){var a=this.lookChar();this.ensureBuffer(this.bufferLength+1),this.buffer[this.bufferLength++]=a}},b.prototype.addPixels=function(b,c){var d=this.codingLine,e=this.codingPos;b>d[e]&&(b>this.columns&&(a("row is wrong length"),this.err=!0,b=this.columns),1&e^c&&++e,d[e]=b),this.codingPos=e},b.prototype.addPixelsNeg=function(b,c){var d=this.codingLine,e=this.codingPos;if(b>d[e])b>this.columns&&(a("row is wrong length"),this.err=!0,b=this.columns),1&e^c&&++e,d[e]=b;else if(bb&&(a("invalid code"),this.err=!0,b=0);e>0&&b=64);do s+=t=this.getWhiteCode();while(t>=64)}else{do r+=t=this.getWhiteCode();while(t>=64);do s+=t=this.getBlackCode();while(t>=64)}for(this.addPixels(p[this.codingPos]+r,c),p[this.codingPos]0?--b:++b;o[b]<=p[this.codingPos]&&o[b]0?--b:++b;o[b]<=p[this.codingPos]&&o[b]0?--b:++b;o[b]<=p[this.codingPos]&&o[b]=64)}else do r+=t=this.getWhiteCode();while(t>=64);this.addPixels(p[this.codingPos]+r,c),c^=1}var u=!1;if(this.byteAlign&&(this.inputBits&=-8),this.eoblock||this.row!==this.rows-1){if(r=this.lookBits(12),this.eoline)for(;r!==Dc&&1!==r;)this.eatBits(1),r=this.lookBits(12);else for(;0===r;)this.eatBits(1),r=this.lookBits(12);1===r?(this.eatBits(12),u=!0):r===Dc&&(this.eof=!0)}else this.eof=!0;if(!this.eof&&this.encoding>0&&(this.nextLine2D=!this.lookBits(1),this.eatBits(1)),this.eoblock&&u&&this.byteAlign){if(r=this.lookBits(12),1===r){if(this.eatBits(12),this.encoding>0&&(this.lookBits(1),this.eatBits(1)),this.encoding>=0)for(n=0;4>n;++n)r=this.lookBits(12),1!==r&&a("bad rtc code: "+r),this.eatBits(12),this.encoding>0&&(this.lookBits(1),this.eatBits(1));this.eof=!0}}else if(this.err&&this.eoline){for(;;){if(r=this.lookBits(13),r===Dc)return this.eof=!0,null;if(r>>1===1)break;this.eatBits(1)}this.eatBits(12),this.encoding>0&&(this.eatBits(1),this.nextLine2D=!(1&r))}p[0]>0?this.outputBits=p[this.codingPos=0]:this.outputBits=p[this.codingPos=1],this.row++}var v;if(this.outputBits>=8)v=1&this.codingPos?0:255,this.outputBits-=8,0===this.outputBits&&p[this.codingPos]m?(v<<=m,1&this.codingPos||(v|=255>>8-m),this.outputBits-=m,m=0):(v<<=this.outputBits,1&this.codingPos||(v|=255>>8-this.outputBits),m-=this.outputBits,this.outputBits=0,p[this.codingPos]0&&(v<<=m,m=0));while(m)}return this.black&&(v^=255),v},b.prototype.findTableCode=function(a,b,c,d){for(var e=d||0,f=a;b>=f;++f){var g=this.lookBits(f);if(g===Dc)return[!0,1,!1];if(b>f&&(g<<=b-f),!e||g>=e){var h=c[g-e];if(h[0]===f)return this.eatBits(f),[!0,h[1],!0]}}return[!1,0,!1]},b.prototype.getTwoDimCode=function(){var b,c=0;if(this.eoblock){if(c=this.lookBits(7),b=m[c],b&&b[0]>0)return this.eatBits(b[0]),b[1]}else{var d=this.findTableCode(1,7,m);if(d[0]&&d[2])return d[1]}return a("Bad two dim code"),Dc},b.prototype.getWhiteCode=function(){var b,c=0;if(this.eoblock){if(c=this.lookBits(12),c===Dc)return 1;if(b=c>>5===0?n[c]:o[c>>3],b[0]>0)return this.eatBits(b[0]),b[1]}else{var d=this.findTableCode(1,9,o);if(d[0])return d[1];if(d=this.findTableCode(11,12,n),d[0])return d[1]}return a("bad white code"),this.eatBits(1),1},b.prototype.getBlackCode=function(){var b,c;if(this.eoblock){if(b=this.lookBits(13),b===Dc)return 1;if(c=b>>7===0?p[b]:b>>9===0&&b>>7!==0?q[(b>>1)-64]:r[b>>7],c[0]>0)return this.eatBits(c[0]),c[1]}else{var d=this.findTableCode(2,6,r);if(d[0])return d[1];if(d=this.findTableCode(7,12,q,64),d[0])return d[1];if(d=this.findTableCode(10,13,p),d[0])return d[1]}return a("bad black code"),this.eatBits(1),1},b.prototype.lookBits=function(a){for(var b;this.inputBits>16-a;this.inputBuf=(this.inputBuf<<8)+b,this.inputBits+=8}return this.inputBuf>>this.inputBits-a&65535>>16-a},b.prototype.eatBits=function(a){(this.inputBits-=a)<0&&(this.inputBits=0)},b}(),$c=function(){function a(a,b,c){this.str=a,this.dict=a.dict,this.cachedData=0,this.bitsCached=0;for(var d=4096,e={earlyChange:c,codeLength:9,nextCode:258,dictionaryValues:new Uint8Array(d),dictionaryLengths:new Uint16Array(d),dictionaryPrevCodes:new Uint16Array(d),currentSequence:new Uint8Array(d),currentSequenceLength:0},f=0;256>f;++f)e.dictionaryValues[f]=f,e.dictionaryLengths[f]=1;this.lzwState=e,Oc.call(this,b)}return a.prototype=Object.create(Oc.prototype),a.prototype.readBits=function(a){for(var b=this.bitsCached,c=this.cachedData;a>b;){var d=this.str.getByte();if(-1===d)return this.eof=!0,null;c=c<<8|d,b+=8}return this.bitsCached=b-=a,this.cachedData=c,this.lastCode=null,c>>>b&(1<a;a++){var t=this.readBits(m),u=p>0;if(256>t)o[0]=t,p=1;else{if(!(t>=258)){if(256===t){m=9,i=258,p=0;continue}this.eof=!0,delete this.lzwState;break}if(i>t)for(p=k[t],b=p-1,c=t;b>=0;b--)o[b]=j[c],c=l[c];else o[p++]=o[0]}if(u&&(l[i]=n,k[i]=k[n]+1,j[i]=o[0],i++,m=i+h&i+h-1?m:0|Math.min(Math.log(i+h)/.6931471805599453+1,12)),n=t,q+=p,q>e){do e+=f;while(q>e);s=this.ensureBuffer(this.bufferLength+e)}for(b=0;p>b;b++)s[r++]=o[b]}g.nextCode=i,g.codeLength=m,g.prevCode=n,g.currentSequenceLength=p,this.bufferLength=r}},a}(),_c=function(){function a(){Mc.call(this,new Uint8Array(0))}return a.prototype=Mc.prototype,a}(),ad=function(){function a(a){this.name=a,this.terminated=!1,this._capability=G()}return a.prototype={get finished(){return this._capability.promise},finish:function(){this._capability.resolve()},terminate:function(){this.terminated=!0},ensureNotTerminated:function(){if(this.terminated)throw new Error("Worker task was terminated")}},a}(),bd=PDFJS.WorkerMessageHandler={setup:function(c){function d(){if(j)throw new Error("Worker was terminated")}function e(a){l.push(a)}function f(a){a.finish();var b=l.indexOf(a);l.splice(b,1)}function g(a){var b=G(),c=function(){var a=i.ensureDoc("numPages"),c=i.ensureDoc("fingerprint"),e=i.ensureXRef("encrypt");Promise.all([a,c,e]).then(function(a){var c={numPages:a[0],fingerprint:a[1],encrypted:!!a[2]};b.resolve(c)},d)},d=function(a){b.reject(a)};return i.ensureDoc("checkHeader",[]).then(function(){i.ensureDoc("parseStartXRef",[]).then(function(){i.ensureDoc("parse",[a]).then(c,d)},d)},d),b.promise}function h(a){var d,e=G(),f=a.source,g=a.disableRange;if(f.data){try{d=new ua(f.data,f.password),e.resolve(d)}catch(h){e.reject(h)}return e.promise}if(f.chunkedViewerLoading){try{d=new va(f,c),e.resolve(d)}catch(h){e.reject(h)}return e.promise}var i=new pa(f.url,{httpHeaders:f.httpHeaders,withCredentials:f.withCredentials}),j=[],l=i.requestFull({onHeadersReceived:function(){if(!g){var a=i.getRequestXhr(l);if("bytes"===a.getResponseHeader("Accept-Ranges")){var b=a.getResponseHeader("Content-Encoding")||"identity";if("identity"===b){var h=a.getResponseHeader("Content-Length");if(h=parseInt(h,10),w(h)&&(f.length=h,!(2*sa>=h))){i.isStreamingRequest(l)?f.disableAutoFetch=!0:i.abortRequest(l);try{d=new va(f,c),e.resolve(d)}catch(j){e.reject(j)}k=null}}}}},onProgressiveData:f.disableStream?null:function(a){return d?void d.sendProgressiveData(a):void j.push(a)},onDone:function(a){if(!d){var c;if(null===a){var g=0,h=0;j.forEach(function(a){g+=a.byteLength}),f.length&&g!==f.length&&b("reported HTTP length is different from actual");var i=new Uint8Array(g);j.forEach(function(a){i.set(new Uint8Array(a),h),h+=a.byteLength}),c=i.buffer}else c=a.chunk;try{d=new ua(c,f.password),e.resolve(d)}catch(l){e.reject(l)}k=null}},onError:function(a){var b;404===a?(b=new ga('Missing PDF "'+f.url+'".'),c.send("MissingPDF",b)):(b=new ha("Unexpected server response ("+a+') while retrieving PDF "'+f.url+'".',a),c.send("UnexpectedResponse",b)),k=null},onProgress:function(a){c.send("DocProgress",{loaded:a.loaded,total:a.lengthComputable?a.total:f.length})}});return k=function(){i.abortRequest(l)},e.promise}var i,j=!1,k=null,l=[];c.on("test",function(a){if(!(a instanceof Uint8Array))return void c.send("test",!1);var b=255===a[0];c.postMessageTransfers=b;var d=new XMLHttpRequest,e="response"in d;try{d.responseType}catch(f){e=!1}return e?void c.send("test",{supportTypedArray:!0,supportTransfers:b}):void c.send("test",!1)}),c.on("GetDocRequest",function(a){var b=function(a){d(),c.send("GetDoc",{pdfInfo:a})},e=function(a){a instanceof da?a.code===ca.NEED_PASSWORD?c.send("NeedPassword",a):a.code===ca.INCORRECT_PASSWORD&&c.send("IncorrectPassword",a):a instanceof fa?c.send("InvalidPDF",a):a instanceof ga?c.send("MissingPDF",a):a instanceof ha?c.send("UnexpectedResponse",a):c.send("UnknownError",new ea(a.message,a.toString()))};d(),PDFJS.maxImageSize=void 0===a.maxImageSize?-1:a.maxImageSize,PDFJS.disableFontFace=a.disableFontFace,PDFJS.disableCreateObjectURL=a.disableCreateObjectURL,PDFJS.verbosity=a.verbosity,PDFJS.cMapUrl=void 0===a.cMapUrl?null:a.cMapUrl,PDFJS.cMapPacked=a.cMapPacked===!0,h(a).then(function(a){if(j)throw a.terminate(),new Error("Worker was terminated");i=a,c.send("PDFManagerReady",null),i.onLoadedStream().then(function(a){c.send("DataLoaded",{length:a.bytes.byteLength})})}).then(function f(){d(),g(!1).then(b,function(a){return d(),a instanceof ka?(i.requestLoadedStream(),void i.onLoadedStream().then(function(){d(),g(!0).then(b,e)})):(a instanceof da&&i.passwordChanged().then(f),void e(a))},e)},e)}),c.on("GetPage",function(a){return i.getPage(a.pageIndex).then(function(a){var b=i.ensure(a,"rotate"),c=i.ensure(a,"ref"),d=i.ensure(a,"view");return Promise.all([b,c,d]).then(function(a){return{rotate:a[0],ref:a[1],view:a[2]}})})}),c.on("GetPageIndex",function(a){var b=new Ba(a.ref.num,a.ref.gen),c=i.pdfDocument.catalog;return c.getPageIndex(b)}),c.on("GetDestinations",function(a){return i.ensureCatalog("destinations")}),c.on("GetDestination",function(a){return i.ensureCatalog("getDestination",[a.id])}),c.on("GetAttachments",function(a){return i.ensureCatalog("attachments")}),c.on("GetJavaScript",function(a){return i.ensureCatalog("javaScript")}),c.on("GetOutline",function(a){return i.ensureCatalog("documentOutline")}),c.on("GetMetadata",function(a){return Promise.all([i.ensureDoc("documentInfo"),i.ensureCatalog("metadata")])}),c.on("GetData",function(a){return i.requestLoadedStream(),i.onLoadedStream().then(function(a){return a.bytes})}),c.on("GetStats",function(a){return i.pdfDocument.xref.stats}),c.on("UpdatePassword",function(a){i.updatePassword(a)}),c.on("GetAnnotations",function(a){return i.getPage(a.pageIndex).then(function(a){return i.ensure(a,"getAnnotationsData",[])})}),c.on("RenderPageRequest",function(b){var d=b.pageIndex;i.getPage(d).then(function(g){var h=new ad("RenderPageRequest: page "+d);e(h);var i=d+1,j=Date.now();g.getOperatorList(c,h,b.intent).then(function(b){f(h),a("page="+i+" - getOperatorList: time="+(Date.now()-j)+"ms, len="+b.fnArray.length)},function(a){if(f(h),!h.terminated){var d,e="worker.js: while trying to getPage() and getOperatorList()";d="string"==typeof a?{message:a,stack:e}:"object"==typeof a?{message:a.message||a.toString(),stack:a.stack||e}:{message:"Unknown exception type: "+typeof a,stack:e},c.send("PageError",{pageNum:i,error:d,intent:b.intent})}})})},this),c.on("GetTextContent",function(b){var c=b.pageIndex;return i.getPage(c).then(function(b){var d=new ad("GetTextContent: page "+c);e(d);var g=c+1,h=Date.now();return b.extractTextContent(d).then(function(b){return f(d),a("text indexing: page="+g+" - time="+(Date.now()-h)+"ms"),b},function(a){if(f(d),!d.terminated)throw a})})}),c.on("Cleanup",function(a){return i.cleanup()}),c.on("Terminate",function(a){j=!0,i&&(i.terminate(),i=null),k&&k();var b=[];return l.forEach(function(a){b.push(a.finished),a.terminate()}),Promise.all(b).then(function(){})})}},cd={},dd={log:function(){var a=Array.prototype.slice.call(arguments);S.postMessage({action:"console_log",data:a})},error:function(){var a=Array.prototype.slice.call(arguments);throw S.postMessage({action:"console_error",data:a}),"pdf.js execution error"},time:function(a){cd[a]=Date.now()},timeEnd:function(a){var b=cd[a];b||c("Unknown timer name "+a),this.log("Timer:",a,Date.now()-b)}};if("undefined"==typeof window){ +"console"in S||(S.console=dd),PDFJS.UnsupportedManager.listen(function(a){S.postMessage({action:"_unsupported_feature",data:a})});var ed=new H("worker_processor",this);bd.setup(ed)}var fd=function(){function a(a,b,c){this.data=a,this.bp=b,this.dataEnd=c,this.chigh=a[b],this.clow=0,this.byteIn(),this.chigh=this.chigh<<7&65535|this.clow>>9&127,this.clow=this.clow<<7&65535,this.ct-=7,this.a=32768}var b=[{qe:22017,nmps:1,nlps:1,switchFlag:1},{qe:13313,nmps:2,nlps:6,switchFlag:0},{qe:6145,nmps:3,nlps:9,switchFlag:0},{qe:2753,nmps:4,nlps:12,switchFlag:0},{qe:1313,nmps:5,nlps:29,switchFlag:0},{qe:545,nmps:38,nlps:33,switchFlag:0},{qe:22017,nmps:7,nlps:6,switchFlag:1},{qe:21505,nmps:8,nlps:14,switchFlag:0},{qe:18433,nmps:9,nlps:14,switchFlag:0},{qe:14337,nmps:10,nlps:14,switchFlag:0},{qe:12289,nmps:11,nlps:17,switchFlag:0},{qe:9217,nmps:12,nlps:18,switchFlag:0},{qe:7169,nmps:13,nlps:20,switchFlag:0},{qe:5633,nmps:29,nlps:21,switchFlag:0},{qe:22017,nmps:15,nlps:14,switchFlag:1},{qe:21505,nmps:16,nlps:14,switchFlag:0},{qe:20737,nmps:17,nlps:15,switchFlag:0},{qe:18433,nmps:18,nlps:16,switchFlag:0},{qe:14337,nmps:19,nlps:17,switchFlag:0},{qe:13313,nmps:20,nlps:18,switchFlag:0},{qe:12289,nmps:21,nlps:19,switchFlag:0},{qe:10241,nmps:22,nlps:19,switchFlag:0},{qe:9217,nmps:23,nlps:20,switchFlag:0},{qe:8705,nmps:24,nlps:21,switchFlag:0},{qe:7169,nmps:25,nlps:22,switchFlag:0},{qe:6145,nmps:26,nlps:23,switchFlag:0},{qe:5633,nmps:27,nlps:24,switchFlag:0},{qe:5121,nmps:28,nlps:25,switchFlag:0},{qe:4609,nmps:29,nlps:26,switchFlag:0},{qe:4353,nmps:30,nlps:27,switchFlag:0},{qe:2753,nmps:31,nlps:28,switchFlag:0},{qe:2497,nmps:32,nlps:29,switchFlag:0},{qe:2209,nmps:33,nlps:30,switchFlag:0},{qe:1313,nmps:34,nlps:31,switchFlag:0},{qe:1089,nmps:35,nlps:32,switchFlag:0},{qe:673,nmps:36,nlps:33,switchFlag:0},{qe:545,nmps:37,nlps:34,switchFlag:0},{qe:321,nmps:38,nlps:35,switchFlag:0},{qe:273,nmps:39,nlps:36,switchFlag:0},{qe:133,nmps:40,nlps:37,switchFlag:0},{qe:73,nmps:41,nlps:38,switchFlag:0},{qe:37,nmps:42,nlps:39,switchFlag:0},{qe:21,nmps:43,nlps:40,switchFlag:0},{qe:9,nmps:44,nlps:41,switchFlag:0},{qe:5,nmps:45,nlps:42,switchFlag:0},{qe:1,nmps:45,nlps:43,switchFlag:0},{qe:22017,nmps:46,nlps:46,switchFlag:0}];return a.prototype={byteIn:function(){var a=this.data,b=this.bp;if(255===a[b]){var c=a[b+1];c>143?(this.clow+=65280,this.ct=8):(b++,this.clow+=a[b]<<9,this.ct=7,this.bp=b)}else b++,this.clow+=b65535&&(this.chigh+=this.clow>>16,this.clow&=65535)},readBit:function(a,c){var d,e=a[c]>>1,f=1&a[c],g=b[e],h=g.qe,i=this.a-h;if(this.chighi?(i=h,d=f,e=g.nmps):(i=h,d=1^f,1===g.switchFlag&&(f=d),e=g.nlps);else{if(this.chigh-=h,0!==(32768&i))return this.a=i,f;h>i?(d=1^f,1===g.switchFlag&&(f=d),e=g.nlps):(d=f,e=g.nmps)}do 0===this.ct&&this.byteIn(),i<<=1,this.chigh=this.chigh<<1&65535|this.clow>>15&1,this.clow=this.clow<<1&65535,this.ct--;while(0===(32768&i));return this.a=i,a[c]=e<<1|f,d}},a}(),gd=function(){function a(){}function b(a,b){for(var c,d,e=0,f=[],g=16;g>0&&!a[g-1];)g--;f.push({children:[],index:0});var h,i=f[0];for(c=0;g>c;c++){for(d=0;d0;)i=f.pop();for(i.index++,f.push(i);f.length<=c;)f.push(h={children:[],index:0}),i.children[i.index]=h.children,i=h;e++}g>c+1&&(f.push(h={children:[],index:0}),i.children[i.index]=h.children,i=h)}return f[0].children}function c(a,b,c){return 64*((a.blocksPerLine+1)*b+c)}function d(a,b,d,e,f,g,i,j,k){function l(){if(H>0)return H--,G>>H&1;if(G=a[b++],255===G){var c=a[b++];if(c)throw"unexpected marker: "+(G<<8|c).toString(16)}return H=7,G>>>7}function m(a){for(var b=a;;){if(b=b[l()],"number"==typeof b)return b;if("object"!=typeof b)throw"invalid huffman sequence"}}function n(a){for(var b=0;a>0;)b=b<<1|l(),a--;return b}function o(a){if(1===a)return 1===l()?1:-1;var b=n(a);return b>=1<e;){var f=m(a.huffmanTableAC),g=15&f,i=f>>4;if(0!==g){e+=i;var j=h[e];a.blockData[b+j]=o(g),e++}else{if(15>i)break;e+=16}}}function q(a,b){var c=m(a.huffmanTableDC),d=0===c?0:o(c)<0)return void I--;for(var c=g,d=i;d>=c;){var e=m(a.huffmanTableAC),f=15&e,j=e>>4;if(0!==f){c+=j;var l=h[c];a.blockData[b+l]=o(f)*(1<j){I=n(j)+(1<=e;){var p=h[e];switch(J){case 0:if(d=m(a.huffmanTableAC),c=15&d,j=d>>4,0===c)15>j?(I=n(j)+(1<N;){for(y=0;K>y;y++)e[y].pred=0;if(I=0,1===K)for(x=e[0],B=0;f>B;B++)v(x,C,N),N++;else for(B=0;f>B;B++){for(y=0;K>y;y++)for(x=e[y],O=x.h,P=x.v,z=0;P>z;z++)for(A=0;O>A;A++)u(x,C,N,z,A);N++}if(H=0,L=a[b]<<8|a[b+1],65280>=L)throw"marker was not found";if(!(L>=65488&&65495>=L))break;b+=2}return b-F}function e(a,b,c){for(var d,e,f,g,h,q,r,s,t,u,v,w,x,y,z,A,B,C=a.quantizationTable,D=a.blockData,E=0;64>E;E+=8)t=D[b+E],u=D[b+E+1],v=D[b+E+2],w=D[b+E+3],x=D[b+E+4],y=D[b+E+5],z=D[b+E+6],A=D[b+E+7],t*=C[E],0!==(u|v|w|x|y|z|A)?(u*=C[E+1],v*=C[E+2],w*=C[E+3],x*=C[E+4],y*=C[E+5],z*=C[E+6],A*=C[E+7],d=o*t+128>>8,e=o*x+128>>8,f=v,g=z,h=p*(u-A)+128>>8,s=p*(u+A)+128>>8,q=w<<4,r=y<<4,d=d+e+1>>1,e=d-e,B=f*n+g*m+128>>8,f=f*m-g*n+128>>8,g=B,h=h+r+1>>1,r=h-r,s=s+q+1>>1,q=s-q,d=d+g+1>>1,g=d-g,e=e+f+1>>1,f=e-f,B=h*l+s*k+2048>>12,h=h*k-s*l+2048>>12,s=B,B=q*j+r*i+2048>>12,q=q*i-r*j+2048>>12,r=B,c[E]=d+s,c[E+7]=d-s,c[E+1]=e+r,c[E+6]=e-r,c[E+2]=f+q,c[E+5]=f-q,c[E+3]=g+h,c[E+4]=g-h):(B=o*t+512>>10,c[E]=B,c[E+1]=B,c[E+2]=B,c[E+3]=B,c[E+4]=B,c[E+5]=B,c[E+6]=B,c[E+7]=B);for(var F=0;8>F;++F)t=c[F],u=c[F+8],v=c[F+16],w=c[F+24],x=c[F+32],y=c[F+40],z=c[F+48],A=c[F+56],0!==(u|v|w|x|y|z|A)?(d=o*t+2048>>12,e=o*x+2048>>12,f=v,g=z,h=p*(u-A)+2048>>12,s=p*(u+A)+2048>>12,q=w,r=y,d=(d+e+1>>1)+4112,e=d-e,B=f*n+g*m+2048>>12,f=f*m-g*n+2048>>12,g=B,h=h+r+1>>1,r=h-r,s=s+q+1>>1,q=s-q,d=d+g+1>>1,g=d-g,e=e+f+1>>1,f=e-f,B=h*l+s*k+2048>>12,h=h*k-s*l+2048>>12,s=B,B=q*j+r*i+2048>>12,q=q*i-r*j+2048>>12,r=B,t=d+s,A=d-s,u=e+r,z=e-r,v=f+q,y=f-q,w=g+h,x=g-h,t=16>t?0:t>=4080?255:t>>4,u=16>u?0:u>=4080?255:u>>4,v=16>v?0:v>=4080?255:v>>4,w=16>w?0:w>=4080?255:w>>4,x=16>x?0:x>=4080?255:x>>4,y=16>y?0:y>=4080?255:y>>4,z=16>z?0:z>=4080?255:z>>4,A=16>A?0:A>=4080?255:A>>4,D[b+F]=t,D[b+F+8]=u,D[b+F+16]=v,D[b+F+24]=w,D[b+F+32]=x,D[b+F+40]=y,D[b+F+48]=z,D[b+F+56]=A):(B=o*t+8192>>14,B=-2040>B?0:B>=2024?255:B+2056>>4,D[b+F]=B,D[b+F+8]=B,D[b+F+16]=B,D[b+F+24]=B,D[b+F+32]=B,D[b+F+40]=B,D[b+F+48]=B,D[b+F+56]=B)}function f(a,b){for(var d=b.blocksPerLine,f=b.blocksPerColumn,g=new Int16Array(64),h=0;f>h;h++)for(var i=0;d>i;i++){var j=c(b,h,i);e(b,j,g)}return b.blockData}function g(a){return 0>=a?0:a>=255?255:a}var h=new Uint8Array([0,1,8,16,9,2,3,10,17,24,32,25,18,11,4,5,12,19,26,33,40,48,41,34,27,20,13,6,7,14,21,28,35,42,49,56,57,50,43,36,29,22,15,23,30,37,44,51,58,59,52,45,38,31,39,46,53,60,61,54,47,55,62,63]),i=4017,j=799,k=3406,l=2276,m=1567,n=3784,o=5793,p=2896;return a.prototype={parse:function(a){function c(){var b=a[k]<<8|a[k+1];return k+=2,b}function e(){var b=c(),d=a.subarray(k,k+b-2);return k+=d.length,d}function g(a){for(var b=Math.ceil(a.samplesPerLine/8/a.maxH),c=Math.ceil(a.scanLines/8/a.maxV),d=0;dk;){var y=a[k++],z=new Uint16Array(64);if(y>>4===0)for(s=0;64>s;s++)v=h[s],z[v]=a[k++];else{if(y>>4!==1)throw"DQT: invalid table spec";for(s=0;64>s;s++)v=h[s],z[v]=c()}n[15&y]=z}break;case 65472:case 65473:case 65474:if(i)throw"Only single frame JPEGs supported";c(),i={},i.extended=65473===q,i.progressive=65474===q,i.precision=a[k++],i.scanLines=c(),i.samplesPerLine=c(),i.components=[],i.componentIds={};var A,B=a[k++],C=0,D=0;for(r=0;B>r;r++){A=a[k];var E=a[k+1]>>4,F=15&a[k+1];E>C&&(C=E),F>D&&(D=F);var G=a[k+2];t=i.components.push({h:E,v:F,quantizationTable:n[G]}),i.componentIds[A]=t-1,k+=3}i.maxH=C,i.maxV=D,g(i);break;case 65476:var H=c();for(r=2;H>r;){var I=a[k++],J=new Uint8Array(16),K=0;for(s=0;16>s;s++,k++)K+=J[s]=a[k];var L=new Uint8Array(K);for(s=0;K>s;s++,k++)L[s]=a[k];r+=17+K,(I>>4===0?p:o)[15&I]=b(J,L)}break;case 65501:c(),j=c();break;case 65498:var M,N=(c(),a[k++]),O=[];for(r=0;N>r;r++){var P=i.componentIds[a[k++]];M=i.components[P];var Q=a[k++];M.huffmanTableDC=p[Q>>4],M.huffmanTableAC=o[15&Q],O.push(M)}var R=a[k++],S=a[k++],T=a[k++],U=d(a,k,i,O,j,R,S,T>>4,15&T);k+=U;break;case 65535:255!==a[k]&&k--;break;default:if(255===a[k-3]&&a[k-2]>=192&&a[k-2]<=254){k-=3;break}throw"unknown JPEG marker "+q.toString(16)}q=c()}for(this.width=i.samplesPerLine,this.height=i.scanLines,this.jfif=l,this.adobe=m,this.components=[],r=0;ri;i++){for(c=this.components[i],d=c.scaleX*n,e=c.scaleY*o,p=i,m=c.output,f=c.blocksPerLine+1<<3,g=0;a>g;g++)j=0|g*d,t[g]=(j&u)<<3|7&j;for(h=0;b>h;h++)for(j=0|h*e,l=f*(j&u)|(7&j)<<3,g=0;a>g;g++)s[p]=m[l+t[g]],p+=q}var v=this.decodeTransform;if(v)for(i=0;r>i;)for(j=0,k=0;q>j;j++,i++,k+=2)s[i]=(s[i]*v[k]>>8)+v[k+1];return s},_isColorConversionNeeded:function(){return this.adobe&&this.adobe.transformCode?!0:3===this.numComponents?!0:!1},_convertYccToRgb:function(a){for(var b,c,d,e=0,f=a.length;f>e;e+=3)b=a[e],c=a[e+1],d=a[e+2],a[e]=g(b-179.456+1.402*d),a[e+1]=g(b+135.459-.344*c-.714*d),a[e+2]=g(b-226.816+1.772*c);return a},_convertYcckToRgb:function(a){for(var b,c,d,e,f=0,h=0,i=a.length;i>h;h+=4){b=a[h],c=a[h+1],d=a[h+2],e=a[h+3];var j=-122.67195406894+c*(-660635669420364e-19*c+.000437130475926232*d-54080610064599e-18*b+.00048449797120281*e-.154362151871126)+d*(-.000957964378445773*d+.000817076911346625*b-.00477271405408747*e+1.53380253221734)+b*(.000961250184130688*b-.00266257332283933*e+.48357088451265)+e*(-.000336197177618394*e+.484791561490776),k=107.268039397724+c*(219927104525741e-19*c-.000640992018297945*d+.000659397001245577*b+.000426105652938837*e-.176491792462875)+d*(-.000778269941513683*d+.00130872261408275*b+.000770482631801132*e-.151051492775562)+b*(.00126935368114843*b-.00265090189010898*e+.25802910206845)+e*(-.000318913117588328*e-.213742400323665),l=-20.810012546947+c*(-.000570115196973677*c-263409051004589e-19*d+.0020741088115012*b-.00288260236853442*e+.814272968359295)+d*(-153496057440975e-19*d-.000132689043961446*b+.000560833691242812*e-.195152027534049)+b*(.00174418132927582*b-.00255243321439347*e+.116935020465145)+e*(-.000343531996510555*e+.24165260232407);a[f++]=g(j),a[f++]=g(k),a[f++]=g(l)}return a},_convertYcckToCmyk:function(a){for(var b,c,d,e=0,f=a.length;f>e;e+=4)b=a[e],c=a[e+1],d=a[e+2],a[e]=g(434.456-b-1.402*d),a[e+1]=g(119.541-b+.344*c+.714*d),a[e+2]=g(481.816-b-1.772*c);return a},_convertCmykToRgb:function(a){for(var b,c,d,e,f=0,g=-16581375,h=1/255/255,i=0,j=a.length;j>i;i+=4){b=a[i],c=a[i+1],d=a[i+2],e=a[i+3];var k=b*(-4.387332384609988*b+54.48615194189176*c+18.82290502165302*d+212.25662451639585*e-72734.4411664936)+c*(1.7149763477362134*c-5.6096736904047315*d-17.873870861415444*e-1401.7366389350734)+d*(-2.5217340131683033*d-21.248923337353073*e+4465.541406466231)-e*(21.86122147463605*e+48317.86113160301),l=b*(8.841041422036149*b+60.118027045597366*c+6.871425592049007*d+31.159100130055922*e-20220.756542821975)+c*(-15.310361306967817*c+17.575251261109482*d+131.35250912493976*e-48691.05921601825)+d*(4.444339102852739*d+9.8632861493405*e-6341.191035517494)-e*(20.737325471181034*e+47890.15695978492),m=b*(.8842522430003296*b+8.078677503112928*c+30.89978309703729*d-.23883238689178934*e-3616.812083916688)+c*(10.49593273432072*c+63.02378494754052*d+50.606957656360734*e-28620.90484698408)+d*(.03296041114873217*d+115.60384449646641*e-49363.43385999684)-e*(22.33816807309886*e+45932.16563550634);a[f++]=k>=0?255:g>=k?0:255+k*h|0,a[f++]=l>=0?255:g>=l?0:255+l*h|0,a[f++]=m>=0?255:g>=m?0:255+m*h|0}return a},getData:function(a,b,c){if(this.numComponents>4)throw"Unsupported color mode";var d=this._getLinearizedBlockData(a,b);if(3===this.numComponents)return this._convertYccToRgb(d);if(4===this.numComponents){if(this._isColorConversionNeeded())return c?this._convertYcckToRgb(d):this._convertYcckToCmyk(d);if(c)return this._convertCmykToRgb(d)}return d}},a}(),hd=function(){function c(){this.failOnCorruptedImage=!1}function d(a,b){a.x0=Math.ceil(b.XOsiz/a.XRsiz),a.x1=Math.ceil(b.Xsiz/a.XRsiz),a.y0=Math.ceil(b.YOsiz/a.YRsiz),a.y1=Math.ceil(b.Ysiz/a.YRsiz),a.width=a.x1-a.x0,a.height=a.y1-a.y0}function e(a,b){for(var c,d=a.SIZ,e=[],f=Math.ceil((d.Xsiz-d.XTOsiz)/d.XTsiz),g=Math.ceil((d.Ysiz-d.YTOsiz)/d.YTsiz),h=0;g>h;h++)for(var i=0;f>i;i++)c={},c.tx0=Math.max(d.XTOsiz+i*d.XTsiz,d.XOsiz),c.ty0=Math.max(d.YTOsiz+h*d.YTsiz,d.YOsiz),c.tx1=Math.min(d.XTOsiz+(i+1)*d.XTsiz,d.Xsiz),c.ty1=Math.min(d.YTOsiz+(h+1)*d.YTsiz,d.Ysiz),c.width=c.tx1-c.tx0,c.height=c.ty1-c.ty0,c.components=[],e.push(c);a.tiles=e;for(var j=d.Csiz,k=0,l=j;l>k;k++)for(var m=b[k],n=0,o=e.length;o>n;n++){var p={};c=e[n],p.tcx0=Math.ceil(c.tx0/m.XRsiz),p.tcy0=Math.ceil(c.ty0/m.YRsiz),p.tcx1=Math.ceil(c.tx1/m.XRsiz),p.tcy1=Math.ceil(c.ty1/m.YRsiz),p.width=p.tcx1-p.tcx0,p.height=p.tcy1-p.tcy0,c.components[k]=p}}function f(a,b,c){var d=b.codingStyleParameters,e={};return d.entropyCoderWithCustomPrecincts?(e.PPx=d.precinctsSizes[c].PPx,e.PPy=d.precinctsSizes[c].PPy):(e.PPx=15,e.PPy=15),e.xcb_=c>0?Math.min(d.xcb,e.PPx-1):Math.min(d.xcb,e.PPx),e.ycb_=c>0?Math.min(d.ycb,e.PPy-1):Math.min(d.ycb,e.PPy),e}function g(a,b,c){var d=1<b.trx0?Math.ceil(b.trx1/d)-Math.floor(b.trx0/d):0,j=b.try1>b.try0?Math.ceil(b.try1/e)-Math.floor(b.try0/e):0,k=i*j;b.precinctParameters={precinctWidth:d,precinctHeight:e,numprecinctswide:i,numprecinctshigh:j,numprecincts:k,precinctWidthInSubband:g,precinctHeightInSubband:h}}function h(a,b,c){var d,e,f,g,h=c.xcb_,i=c.ycb_,j=1<>h,m=b.tby0>>i,n=b.tbx1+j-1>>h,o=b.tby1+k-1>>i,p=b.resolution.precinctParameters,q=[],r=[];for(e=m;o>e;e++)for(d=l;n>d;d++){f={cbx:d,cby:e,tbx0:j*d,tby0:k*e,tbx1:j*(d+1),tby1:k*(e+1)},f.tbx0_=Math.max(b.tbx0,f.tbx0),f.tby0_=Math.max(b.tby0,f.tby0),f.tbx1_=Math.min(b.tbx1,f.tbx1),f.tby1_=Math.min(b.tby1,f.tby1);var s=Math.floor((f.tbx0_-b.tbx0)/p.precinctWidthInSubband),t=Math.floor((f.tby0_-b.tby0)/p.precinctHeightInSubband);if(g=s+t*p.numprecinctswide,f.precinctNumber=g,f.subbandType=b.type,f.Lblock=3,!(f.tbx1_<=f.tbx0_||f.tby1_<=f.tby0_)){q.push(f);var u=r[g];void 0!==u?(du.cbxMax&&(u.cbxMax=d),eu.cbyMax&&(u.cbyMax=e)):r[g]=u={cbxMin:d,cbyMin:e,cbxMax:d,cbyMax:e},f.precinct=u}}b.codeblockParameters={codeblockWidth:h,codeblockHeight:i,numcodeblockwide:n-l+1,numcodeblockhigh:o-m+1},b.codeblocks=q,b.precincts=r}function i(a,b,c){for(var d=[],e=a.subbands,f=0,g=e.length;g>f;f++)for(var h=e[f],i=h.codeblocks,j=0,k=i.length;k>j;j++){var l=i[j];l.precinctNumber===b&&d.push(l)}return{layerNumber:c,codeblocks:d}}function j(a){for(var b=a.SIZ,c=a.currentTile.index,d=a.tiles[c],e=d.codingStyleDefaultParameters.layersCount,f=b.Csiz,g=0,h=0;f>h;h++)g=Math.max(g,d.components[h].codingStyleParameters.decompositionLevelsCount);var j=0,k=0,l=0,m=0;this.nextPacket=function(){for(;e>j;j++){for(;g>=k;k++){for(;f>l;l++){var a=d.components[l];if(!(k>a.codingStyleParameters.decompositionLevelsCount)){for(var b=a.resolutions[k],c=b.precinctParameters.numprecincts;c>m;){var h=i(b,m,j);return m++,h}m=0}}l=0}k=0}throw new Error("JPX Error: Out of packets")}}function k(a){for(var b=a.SIZ,c=a.currentTile.index,d=a.tiles[c],e=d.codingStyleDefaultParameters.layersCount,f=b.Csiz,g=0,h=0;f>h;h++)g=Math.max(g,d.components[h].codingStyleParameters.decompositionLevelsCount);var j=0,k=0,l=0,m=0;this.nextPacket=function(){for(;g>=j;j++){for(;e>k;k++){for(;f>l;l++){var a=d.components[l];if(!(j>a.codingStyleParameters.decompositionLevelsCount)){for(var b=a.resolutions[j],c=b.precinctParameters.numprecincts;c>m;){var h=i(b,m,k);return m++,h}m=0}}l=0}k=0}throw new Error("JPX Error: Out of packets")}}function m(a){var b,c,d,e,f=a.SIZ,g=a.currentTile.index,h=a.tiles[g],j=h.codingStyleDefaultParameters.layersCount,k=f.Csiz,l=0;for(d=0;k>d;d++){var m=h.components[d];l=Math.max(l,m.codingStyleParameters.decompositionLevelsCount)}var n=new Int32Array(l+1);for(c=0;l>=c;++c){var o=0;for(d=0;k>d;++d){var p=h.components[d].resolutions;c=c;c++){for(;ed;d++){var a=h.components[d];if(!(c>a.codingStyleParameters.decompositionLevelsCount)){var f=a.resolutions[c],g=f.precinctParameters.numprecincts;if(!(e>=g)){for(;j>b;){var m=i(f,e,b);return b++,m}b=0}}}d=0}e=0}throw new Error("JPX Error: Out of packets")}}function p(a){var b=a.SIZ,c=a.currentTile.index,d=a.tiles[c],e=d.codingStyleDefaultParameters.layersCount,f=b.Csiz,g=s(d),h=g,j=0,k=0,l=0,m=0,n=0;this.nextPacket=function(){for(;nl;l++){for(var a=d.components[l],b=a.codingStyleParameters.decompositionLevelsCount;b>=k;k++){var c=a.resolutions[k],o=g.components[l].resolutions[k],p=r(m,n,o,h,c);if(null!==p){for(;e>j;){var q=i(c,p,j);return j++,q}j=0}}k=0}l=0}m=0}throw new Error("JPX Error: Out of packets")}}function q(a){var b=a.SIZ,c=a.currentTile.index,d=a.tiles[c],e=d.codingStyleDefaultParameters.layersCount,f=b.Csiz,g=s(d),h=0,j=0,k=0,l=0,m=0;this.nextPacket=function(){for(;f>k;++k){for(var a=d.components[k],b=g.components[k],c=a.codingStyleParameters.decompositionLevelsCount;m=j;j++){var n=a.resolutions[j],o=b.resolutions[j],p=r(l,m,o,b,n);if(null!==p){for(;e>h;){var q=i(n,p,h);return h++,q}h=0}}j=0}l=0}m=0}throw new Error("JPX Error: Out of packets")}}function r(a,b,c,d,e){var f=a*d.minWidth,g=b*d.minHeight;if(f%c.width!==0||g%c.height!==0)return null;var h=g/c.width*e.precinctParameters.numprecinctswide;return f/c.height+h}function s(a){for(var b=a.components.length,c=Number.MAX_VALUE,d=Number.MAX_VALUE,e=0,f=0,g=new Array(b),h=0;b>h;h++){for(var i=a.components[h],j=i.codingStyleParameters.decompositionLevelsCount,k=new Array(j+1),l=Number.MAX_VALUE,m=Number.MAX_VALUE,n=0,o=0,p=1,q=j;q>=0;--q){var r=i.resolutions[q],s=p*r.precinctParameters.precinctWidth,t=p*r.precinctParameters.precinctHeight;l=Math.min(l,s),m=Math.min(m,t),n=Math.max(n,r.precinctParameters.numprecinctswide),o=Math.max(o,r.precinctParameters.numprecinctshigh),k[q]={width:s,height:t},p<<=1}c=Math.min(c,l),d=Math.min(d,m),e=Math.max(e,n),f=Math.max(f,o),g[h]={resolutions:k,minWidth:l,minHeight:m,maxNumWide:n,maxNumHigh:o}}return{components:g,minWidth:c,minHeight:d,maxNumWide:e,maxNumHigh:f}}function t(a){for(var b=a.SIZ,c=a.currentTile.index,d=a.tiles[c],e=b.Csiz,i=0;e>i;i++){for(var l=d.components[i],n=l.codingStyleParameters.decompositionLevelsCount,o=[],r=[],s=0;n>=s;s++){var t=f(a,l,s),u={},v=1<m;){var d=b[c+k];k++,n?(j=j<<7|d,m+=7,n=!1):(j=j<<8|d,m+=8),255===d&&(n=!0)}return m-=a,j>>>m&(1<a?a+3:(a=e(5),31>a?a+6:(a=e(7),a+37))}for(var j,k=0,m=0,n=!1,o=a.currentTile.index,p=a.tiles[o],q=a.COD.sopMarkerUsed,r=a.COD.ephMarkerUsed,s=p.packetsIterator;d>k;){h(),q&&f(145)&&g(4);var t=s.nextPacket();if(e(1)){for(var u,v=t.layerNumber,w=[],x=0,y=t.codeblocks.length;y>x;x++){u=t.codeblocks[x];var z,C=u.precinct,D=u.cbx-C.cbxMin,E=u.cby-C.cbyMin,F=!1,G=!1;if(void 0!==u.included)F=!!e(1);else{C=u.precinct;var H,I;if(void 0!==C.inclusionTree)H=C.inclusionTree;else{var J=C.cbxMax-C.cbxMin+1,K=C.cbyMax-C.cbyMin+1;H=new B(J,K,v),I=new A(J,K),C.inclusionTree=H,C.zeroBitPlanesTree=I}if(H.reset(D,E,v))for(;;){if(!e(1)){H.incrementValue(v);break}if(z=!H.nextLevel()){u.included=!0,F=G=!0;break}}}if(F){if(G){for(I=C.zeroBitPlanesTree,I.reset(D,E);;)if(e(1)){if(z=!I.nextLevel())break}else I.incrementValue();u.zeroBitPlanes=I.value}for(var L=i();e(1);)u.Lblock++;var M=l(L),N=(1<L?M-1:M)+u.Lblock,O=e(N);w.push({codeblock:u,codingpasses:L,dataLength:O})}}for(h(),r&&f(146);w.length>0;){var P=w.shift();u=P.codeblock,void 0===u.data&&(u.data=[]),u.data.push({data:b,start:c+k,end:c+k+P.dataLength,codingpasses:P.codingpasses}),k+=P.dataLength}}}return k}function v(a,b,c,d,e,f,g,h){for(var i=d.tbx0,j=d.tby0,k=d.tbx1-d.tbx0,l=d.codeblocks,m="H"===d.type.charAt(0)?1:0,n="H"===d.type.charAt(1)?b:0,o=0,p=l.length;p>o;++o){var q=l[o],r=q.tbx1_-q.tbx0_,s=q.tby1_-q.tby0_;if(0!==r&&0!==s&&void 0!==q.data){var t,u;t=new C(r,s,q.subbandType,q.zeroBitPlanes,f),u=2;var v,w,x,y=q.data,z=0,A=0;for(v=0,w=y.length;w>v;v++)x=y[v],z+=x.end-x.start,A+=x.codingpasses;var B=new Uint8Array(z),D=0;for(v=0,w=y.length;w>v;v++){x=y[v];var E=x.data.subarray(x.start,x.end);B.set(E,D),D+=E.length}var F=new fd(B,0,z);for(t.setDecoder(F),v=0;A>v;v++){switch(u){case 0:t.runSignificancePropogationPass();break;case 1:t.runMagnitudeRefinementPass();break;case 2:t.runCleanupPass(),h&&t.checkSegmentationSymbol()}u=(u+1)%3}var G,H,I,J=q.tbx0_-i+(q.tby0_-j)*k,K=t.coefficentsSign,L=t.coefficentsMagnitude,M=t.bitsDecoded,N=g?0:.5;D=0;var O="LL"!==d.type;for(v=0;s>v;v++){var P=J/k|0,Q=2*P*(b-k)+m+n;for(G=0;r>G;G++){if(H=L[D],0!==H){H=(H+N)*e,0!==K[D]&&(H=-H),I=M[D];var R=O?Q+(J<<1):J;g&&I>=f?a[R]=H:a[R]=H*(1<=q;q++){for(var r=d.resolutions[q],s=r.trx1-r.trx0,t=r.try1-r.try0,u=new Float32Array(s*t),w=0,x=r.subbands.length;x>w;w++){var y,A;i?(y=h[p].mu,A=h[p].epsilon,p++):(y=h[0].mu,A=h[0].epsilon+(q>0?1-q:0));var B=r.subbands[w],C=z[B.type],D=m?1:Math.pow(2,l+C-A)*(1+y/2048),G=j+A-1;v(u,s,t,B,D,G,m,k)}o.push({width:s,height:t,items:u})}var H=n.calculate(o,d.tcx0,d.tcy0);return{left:d.tcx0,top:d.tcy0,width:H.width,height:H.height,items:H.items}}function x(a){for(var b=a.SIZ,c=a.components,d=b.Csiz,e=[],f=0,g=a.tiles.length;g>f;f++){var h,i=a.tiles[f],j=[];for(h=0;d>h;h++)j[h]=w(a,i,h);var k,l,m,n,o,p,q,r,s,t,u,v,x,y,z,A=j[0],B=new Uint8Array(A.items.length*d),C={left:A.left,top:A.top,width:A.width,height:A.height,items:B},D=0;if(i.codingStyleDefaultParameters.multipleComponentTransform){var E=4===d,F=j[0].items,G=j[1].items,H=j[2].items,I=E?j[3].items:null;k=c[0].precision-8,l=(128<p;p++,D+=K)r=F[p]+l,s=G[p],t=H[p],v=r-(t+s>>2),u=v+t,x=v+s,B[D++]=0>=u?0:u>=m?255:u>>k,B[D++]=0>=v?0:v>=m?255:v>>k,B[D++]=0>=x?0:x>=m?255:x>>k;else for(p=0;q>p;p++,D+=K)r=F[p]+l,s=G[p],t=H[p],u=r+1.402*t,v=r-.34413*s-.71414*t,x=r+1.772*s,B[D++]=0>=u?0:u>=m?255:u>>k,B[D++]=0>=v?0:v>=m?255:v>>k,B[D++]=0>=x?0:x>=m?255:x>>k;if(E)for(p=0,D=3;q>p;p++,D+=4)y=I[p],B[D]=n>=y?0:y>=o?255:y+l>>k}else for(h=0;d>h;h++){var L=j[h].items;for(k=c[h].precision-8,l=(128<p;p++)z=L[p],B[D]=n>=z?0:z>=m?255:z+l>>k,D+=d}e.push(C)}return e}function y(a,b){for(var c=a.SIZ,d=c.Csiz,e=a.tiles[b],f=0;d>f;f++){var g=e.components[f],h=void 0!==a.currentTile.QCC[f]?a.currentTile.QCC[f]:a.currentTile.QCD;g.quantizationParameters=h;var i=void 0!==a.currentTile.COC[f]?a.currentTile.COC[f]:a.currentTile.COD;g.codingStyleParameters=i}e.codingStyleDefaultParameters=a.currentTile.COD}var z={LL:0,LH:1,HL:1,HH:2};c.prototype={parse:function(c){var d=n(c,0);if(65359===d)return void this.parseCodestream(c,0,c.length);for(var e=0,f=c.length;f>e;){var g=8,h=o(c,e),i=o(c,e+4);if(e+=g,1===h&&(h=4294967296*o(c,e)+o(c,e+4),e+=8,g+=8),0===h&&(h=f-e+g),g>h)throw new Error("JPX Error: Invalid box field size");var j=h-g,k=!0;switch(i){case 1785737832:k=!1;break;case 1668246642:var l=c[e];c[e+1],c[e+2];if(1===l){var m=o(c,e+3);switch(m){case 16:case 17:case 18:break;default:b("Unknown colorspace "+m)}}else 2===l&&a("ICC profile not supported");break;case 1785737827:this.parseCodestream(c,e,e+j);break;case 1783636e3:218793738!==o(c,e)&&b("Invalid JP2 signature");break;case 1783634458:case 1718909296:case 1920099697:case 1919251232:case 1768449138:break;default:var p=String.fromCharCode(i>>24&255,i>>16&255,i>>8&255,255&i);b("Unsupported header type "+i+" ("+p+")")}k&&(e+=j)}},parseImageProperties:function(a){for(var b=a.getByte();b>=0;){var c=b;b=a.getByte();var d=c<<8|b;if(65361===d){a.skip(4);var e=a.getInt32()>>>0,f=a.getInt32()>>>0,g=a.getInt32()>>>0,h=a.getInt32()>>>0;a.skip(16);var i=a.getUint16();return this.width=e-g,this.height=f-h,this.componentsCount=i,void(this.bitsPerComponent=8)}}throw new Error("JPX Error: No size marker found in JPX stream")},parseCodestream:function(a,c,f){var g={};try{for(var h=!1,i=c;f>i+1;){var j=n(a,i);i+=2;var k,l,m,p,q,r,s=0;switch(j){case 65359:g.mainHeader=!0;break;case 65497:break;case 65361:s=n(a,i);var v={};v.Xsiz=o(a,i+4),v.Ysiz=o(a,i+8),v.XOsiz=o(a,i+12),v.YOsiz=o(a,i+16),v.XTsiz=o(a,i+20),v.YTsiz=o(a,i+24),v.XTOsiz=o(a,i+28),v.YTOsiz=o(a,i+32);var w=n(a,i+36);v.Csiz=w;var z=[];k=i+38;for(var A=0;w>A;A++){var B={precision:(127&a[k])+1,isSigned:!!(128&a[k]),XRsiz:a[k+1],YRsiz:a[k+1]};d(B,v),z.push(B)}g.SIZ=v,g.components=z,e(g,z),g.QCC=[],g.COC=[];break;case 65372:s=n(a,i);var C={};switch(k=i+2,l=a[k++],31&l){case 0:p=8,q=!0;break;case 1:p=16,q=!1;break;case 2:p=16,q=!0;break;default:throw new Error("JPX Error: Invalid SQcd value "+l)}for(C.noQuantization=8===p,C.scalarExpounded=q,C.guardBits=l>>5,m=[];s+i>k;){var D={};8===p?(D.epsilon=a[k++]>>3,D.mu=0):(D.epsilon=a[k]>>3,D.mu=(7&a[k])<<8|a[k+1],k+=2),m.push(D)}C.SPqcds=m,g.mainHeader?g.QCD=C:(g.currentTile.QCD=C,g.currentTile.QCC=[]);break;case 65373:s=n(a,i);var E={};k=i+2;var F;switch(g.SIZ.Csiz<257?F=a[k++]:(F=n(a,k),k+=2),l=a[k++],31&l){case 0:p=8,q=!0;break;case 1:p=16,q=!1;break;case 2:p=16,q=!0;break;default:throw new Error("JPX Error: Invalid SQcd value "+l)}for(E.noQuantization=8===p,E.scalarExpounded=q,E.guardBits=l>>5,m=[];s+i>k;)D={},8===p?(D.epsilon=a[k++]>>3,D.mu=0):(D.epsilon=a[k]>>3,D.mu=(7&a[k])<<8|a[k+1],k+=2),m.push(D);E.SPqcds=m,g.mainHeader?g.QCC[F]=E:g.currentTile.QCC[F]=E;break;case 65362:s=n(a,i);var G={};k=i+2;var H=a[k++];G.entropyCoderWithCustomPrecincts=!!(1&H),G.sopMarkerUsed=!!(2&H),G.ephMarkerUsed=!!(4&H),G.progressionOrder=a[k++],G.layersCount=n(a,k),k+=2,G.multipleComponentTransform=a[k++],G.decompositionLevelsCount=a[k++],G.xcb=(15&a[k++])+2,G.ycb=(15&a[k++])+2;var I=a[k++];if(G.selectiveArithmeticCodingBypass=!!(1&I),G.resetContextProbabilities=!!(2&I),G.terminationOnEachCodingPass=!!(4&I),G.verticalyStripe=!!(8&I),G.predictableTermination=!!(16&I),G.segmentationSymbolUsed=!!(32&I),G.reversibleTransformation=a[k++],G.entropyCoderWithCustomPrecincts){for(var J=[];s+i>k;){var K=a[k++];J.push({PPx:15&K,PPy:K>>4})}G.precinctsSizes=J}var L=[];if(G.selectiveArithmeticCodingBypass&&L.push("selectiveArithmeticCodingBypass"),G.resetContextProbabilities&&L.push("resetContextProbabilities"),G.terminationOnEachCodingPass&&L.push("terminationOnEachCodingPass"),G.verticalyStripe&&L.push("verticalyStripe"),G.predictableTermination&&L.push("predictableTermination"),L.length>0)throw h=!0,new Error("JPX Error: Unsupported COD options ("+L.join(", ")+")");g.mainHeader?g.COD=G:(g.currentTile.COD=G,g.currentTile.COC=[]);break;case 65424:s=n(a,i),r={},r.index=n(a,i+2),r.length=o(a,i+4),r.dataEnd=r.length+i-2,r.partIndex=a[i+8],r.partsCount=a[i+9],g.mainHeader=!1,0===r.partIndex&&(r.COD=g.COD,r.COC=g.COC.slice(0),r.QCD=g.QCD,r.QCC=g.QCC.slice(0)),g.currentTile=r;break;case 65427:r=g.currentTile,0===r.partIndex&&(y(g,r.index),t(g)),s=r.dataEnd-i,u(g,a,i,s);break;case 65365:case 65367:case 65368:case 65380:s=n(a,i);break;case 65363:throw new Error("JPX Error: Codestream code 0xFF53 (COC) is not implemented");default:throw new Error("JPX Error: Unknown codestream code: "+j.toString(16))}i+=s}}catch(M){if(h||this.failOnCorruptedImage)throw M;b("Trying to recover from "+M.message)}this.tiles=x(g),this.width=g.SIZ.Xsiz-g.SIZ.XOsiz,this.height=g.SIZ.Ysiz-g.SIZ.YOsiz,this.componentsCount=g.SIZ.Csiz}};var A=function(){function a(a,b){var c=l(Math.max(a,b))+1;this.levels=[];for(var d=0;c>d;d++){var e={width:a,height:b,items:[]};this.levels.push(e),a=Math.ceil(a/2),b=Math.ceil(b/2)}}return a.prototype={reset:function(a,b){for(var c,d=0,e=0;d>=1,b>>=1,d++}d--,c=this.levels[d],c.items[c.index]=e,this.currentLevel=d,delete this.value},incrementValue:function(){var a=this.levels[this.currentLevel];a.items[a.index]++},nextLevel:function(){var a=this.currentLevel,b=this.levels[a],c=b.items[b.index];return a--,0>a?(this.value=c,!1):(this.currentLevel=a,b=this.levels[a],b.items[b.index]=c,!0)}},a}(),B=function(){function a(a,b,c){var d=l(Math.max(a,b))+1;this.levels=[];for(var e=0;d>e;e++){for(var f=new Uint8Array(a*b),g=0,h=f.length;h>g;g++)f[g]=c;var i={width:a,height:b,items:f};this.levels.push(i),a=Math.ceil(a/2),b=Math.ceil(b/2)}}return a.prototype={reset:function(a,b,c){for(var d=0;dc)return this.currentLevel=d,this.propagateValues(),!1;a>>=1,b>>=1,d++}return this.currentLevel=d-1,!0},incrementValue:function(a){var b=this.levels[this.currentLevel];b.items[b.index]=a+1,this.propagateValues()},propagateValues:function(){for(var a=this.currentLevel,b=this.levels[a],c=b.items[b.index];--a>=0;)b=this.levels[a],b.items[b.index]=c},nextLevel:function(){var a=this.currentLevel,b=this.levels[a],c=b.items[b.index];return b.items[b.index]=255,a--,0>a?!1:(this.currentLevel=a,b=this.levels[a],b.items[b.index]=c,!0)}},a}(),C=function(){function a(a,b,c,g,h){this.width=a,this.height=b,this.contextLabelTable="HH"===c?f:"HL"===c?e:d;var i=a*b;this.neighborsSignificance=new Uint8Array(i),this.coefficentsSign=new Uint8Array(i),this.coefficentsMagnitude=h>14?new Uint32Array(i):h>6?new Uint16Array(i):new Uint8Array(i),this.processingFlags=new Uint8Array(i);var j=new Uint8Array(i);if(0!==g)for(var k=0;i>k;k++)j[k]=g;this.bitsDecoded=j,this.reset()}var b=17,c=18,d=new Uint8Array([0,5,8,0,3,7,8,0,4,7,8,0,0,0,0,0,1,6,8,0,3,7,8,0,4,7,8,0,0,0,0,0,2,6,8,0,3,7,8,0,4,7,8,0,0,0,0,0,2,6,8,0,3,7,8,0,4,7,8,0,0,0,0,0,2,6,8,0,3,7,8,0,4,7,8]),e=new Uint8Array([0,3,4,0,5,7,7,0,8,8,8,0,0,0,0,0,1,3,4,0,6,7,7,0,8,8,8,0,0,0,0,0,2,3,4,0,6,7,7,0,8,8,8,0,0,0,0,0,2,3,4,0,6,7,7,0,8,8,8,0,0,0,0,0,2,3,4,0,6,7,7,0,8,8,8]),f=new Uint8Array([0,1,2,0,1,2,2,0,2,2,2,0,0,0,0,0,3,4,5,0,4,5,5,0,5,5,5,0,0,0,0,0,6,7,7,0,7,7,7,0,7,7,7,0,0,0,0,0,8,8,8,0,8,8,8,0,8,8,8,0,0,0,0,0,8,8,8,0,8,8,8,0,8,8,8]);return a.prototype={setDecoder:function(a){this.decoder=a},reset:function(){this.contexts=new Int8Array(19),this.contexts[0]=8,this.contexts[b]=92,this.contexts[c]=6},setNeighborsSignificance:function(a,b,c){var d,e=this.neighborsSignificance,f=this.width,g=this.height,h=b>0,i=f>b+1;a>0&&(d=c-f,h&&(e[d-1]+=16),i&&(e[d+1]+=16),e[d]+=4),g>a+1&&(d=c+f,h&&(e[d-1]+=16),i&&(e[d+1]+=16),e[d]+=4),h&&(e[c-1]+=1),i&&(e[c+1]+=1),e[c]|=128},runSignificancePropogationPass:function(){for(var a=this.decoder,b=this.width,c=this.height,d=this.coefficentsMagnitude,e=this.coefficentsSign,f=this.neighborsSignificance,g=this.processingFlags,h=this.contexts,i=this.contextLabelTable,j=this.bitsDecoded,k=-2,l=1,m=2,n=0;c>n;n+=4)for(var o=0;b>o;o++)for(var p=n*b+o,q=0;4>q;q++,p+=b){var r=n+q;if(r>=c)break;if(g[p]&=k,!d[p]&&f[p]){var s=i[f[p]],t=a.readBit(h,s);if(t){var u=this.decodeSignBit(r,o,p);e[p]=u,d[p]=1,this.setNeighborsSignificance(r,o,p),g[p]|=m}j[p]++,g[p]|=l}}},decodeSignBit:function(a,b,c){var d,e,f,g,h,i,j=this.width,k=this.height,l=this.coefficentsMagnitude,m=this.coefficentsSign;g=b>0&&0!==l[c-1],j>b+1&&0!==l[c+1]?(f=m[c+1],g?(e=m[c-1],d=1-f-e):d=1-f-f):g?(e=m[c-1],d=1-e-e):d=0;var n=3*d;return g=a>0&&0!==l[c-j],k>a+1&&0!==l[c+j]?(f=m[c+j],g?(e=m[c-j],d=1-f-e+n):d=1-f-f+n):g?(e=m[c-j],d=1-e-e+n):d=n,d>=0?(h=9+d,i=this.decoder.readBit(this.contexts,h)):(h=9-d,i=1^this.decoder.readBit(this.contexts,h)),i},runMagnitudeRefinementPass:function(){for(var a,b=this.decoder,c=this.width,d=this.height,e=this.coefficentsMagnitude,f=this.neighborsSignificance,g=this.contexts,h=this.bitsDecoded,i=this.processingFlags,j=1,k=2,l=c*d,m=4*c,n=0;l>n;n=a){a=Math.min(l,n+m);for(var o=0;c>o;o++)for(var p=n+o;a>p;p+=c)if(e[p]&&0===(i[p]&j)){var q=16;if(0!==(i[p]&k)){i[p]^=k;var r=127&f[p];q=0===r?15:14}var s=b.readBit(g,q);e[p]=e[p]<<1|s,h[p]++,i[p]|=j}}},runCleanupPass:function(){for(var a,d=this.decoder,e=this.width,f=this.height,g=this.neighborsSignificance,h=this.coefficentsMagnitude,i=this.coefficentsSign,j=this.contexts,k=this.contextLabelTable,l=this.bitsDecoded,m=this.processingFlags,n=1,o=2,p=e,q=2*e,r=3*e,s=0;f>s;s=a){a=Math.min(s+4,f);for(var t=s*e,u=f>s+3,v=0;e>v;v++){var w,x=t+v,y=u&&0===m[x]&&0===m[x+p]&&0===m[x+q]&&0===m[x+r]&&0===g[x]&&0===g[x+p]&&0===g[x+q]&&0===g[x+r],z=0,A=x,B=s;if(y){var C=d.readBit(j,c);if(!C){l[x]++,l[x+p]++,l[x+q]++,l[x+r]++;continue}z=d.readBit(j,b)<<1|d.readBit(j,b),0!==z&&(B=s+z,A+=z*e),w=this.decodeSignBit(B,v,A),i[A]=w,h[A]=1,this.setNeighborsSignificance(B,v,A),m[A]|=o,A=x;for(var D=s;B>=D;D++,A+=e)l[A]++;z++}for(B=s+z;a>B;B++,A+=e)if(!h[A]&&0===(m[A]&n)){var E=k[g[A]],F=d.readBit(j,E);1===F&&(w=this.decodeSignBit(B,v,A),i[A]=w,h[A]=1,this.setNeighborsSignificance(B,v,A),m[A]|=o),l[A]++}}}},checkSegmentationSymbol:function(){var a=this.decoder,c=this.contexts,d=a.readBit(c,b)<<3|a.readBit(c,b)<<2|a.readBit(c,b)<<1|a.readBit(c,b);if(10!==d)throw new Error("JPX Error: Invalid segmentation symbol")}},a}(),D=function(){function a(){}return a.prototype.calculate=function(a,b,c){for(var d=a[0],e=1,f=a.length;f>e;e++)d=this.iterate(d,a[e],b,c);return d},a.prototype.extend=function(a,b,c){var d=b-1,e=b+1,f=b+c-2,g=b+c;a[d--]=a[e++],a[g++]=a[f--],a[d--]=a[e++],a[g++]=a[f--],a[d--]=a[e++],a[g++]=a[f--],a[d]=a[e],a[g]=a[f]},a.prototype.iterate=function(a,b,c,d){var e,f,g,h,i,j,k=a.width,l=a.height,m=a.items,n=b.width,o=b.height,p=b.items;for(g=0,e=0;l>e;e++)for(h=2*e*n,f=0;k>f;f++,g++,h+=2)p[h]=m[g];m=a.items=null;var q=4,r=new Float32Array(n+2*q);if(1===n){if(0!==(1&c))for(j=0,g=0;o>j;j++,g+=n)p[g]*=.5}else for(j=0,g=0;o>j;j++,g+=n)r.set(p.subarray(g,g+n),q),this.extend(r,q,n),this.filter(r,q,n),p.set(r.subarray(q,q+n),g);var s=16,t=[];for(e=0;s>e;e++)t.push(new Float32Array(o+2*q));var u,v=0;if(a=q+o,1===o){if(0!==(1&d))for(i=0;n>i;i++)p[i]*=.5}else for(i=0;n>i;i++){if(0===v){for(s=Math.min(n-i,s),g=i,h=q;a>h;g+=n,h++)for(u=0;s>u;u++)t[u][h]=p[g+u];v=s}v--;var w=t[v];if(this.extend(w,q,o),this.filter(w,q,o),0===v)for(g=i-s+1,h=q;a>h;g+=n,h++)for(u=0;s>u;u++)p[g+u]=t[u][h]}return{width:n,height:o,items:p}},a}(),E=function(){function a(){D.call(this)}return a.prototype=Object.create(D.prototype),a.prototype.filter=function(a,b,c){var d=c>>1;b=0|b;var e,f,g,h,i=-1.586134342059924,j=-.052980118572961,k=.882911075530934,l=.443506852043971,m=1.230174104914001,n=1/m;for(e=b-3,f=d+4;f--;e+=2)a[e]*=n;for(e=b-2,g=l*a[e-1],f=d+3;f--&&(h=l*a[e+1],a[e]=m*a[e]-g-h,f--);e+=2)e+=2,g=l*a[e+1],a[e]=m*a[e]-g-h;for(e=b-1,g=k*a[e-1],f=d+2;f--&&(h=k*a[e+1],a[e]-=g+h,f--);e+=2)e+=2,g=k*a[e+1],a[e]-=g+h;for(e=b,g=j*a[e-1],f=d+1;f--&&(h=j*a[e+1],a[e]-=g+h,f--);e+=2)e+=2,g=j*a[e+1],a[e]-=g+h;if(0!==d)for(e=b+1,g=i*a[e-1],f=d;f--&&(h=i*a[e+1],a[e]-=g+h,f--);e+=2)e+=2,g=i*a[e+1],a[e]-=g+h},a}(),F=function(){function a(){D.call(this)}return a.prototype=Object.create(D.prototype),a.prototype.filter=function(a,b,c){var d=c>>1;b=0|b;var e,f;for(e=b,f=d+1;f--;e+=2)a[e]-=a[e-1]+a[e+1]+2>>2;for(e=b+1,f=d;f--;e+=2)a[e]+=a[e-1]+a[e+1]>>1},a}();return c}(),id=function(){function a(){}function b(a,b,c){this.data=a,this.start=b,this.end=c}function d(a,b,c){function d(a){for(var b=0,d=0;a>d;d++){var g=c.readBit(e,f);f=256>f?f<<1|g:511&(f<<1|g)|256,b=b<<1|g}return b>>>0}var e=a.getContexts(b),f=1,g=d(1),h=d(1)?d(1)?d(1)?d(1)?d(1)?d(32)+4436:d(12)+340:d(8)+84:d(6)+20:d(4)+4:d(2);return 0===g?h:h>0?-h:null}function e(a,b,c){for(var d=a.getContexts("IAID"),e=1,f=0;c>f;f++){var g=b.readBit(d,e);e=e<<1|g}return 31>c?e&(1<e;e++)for(h=m[e]=new Uint8Array(a),i=1>e?h:m[e-1],j=2>e?h:m[e-2],d=j[0]<<13|j[1]<<12|j[2]<<11|i[0]<<7|i[1]<<6|i[2]<<5|i[3]<<4,f=0;a>f;f++)h[f]=g=k.readBit(l,d),d=(d&n)<<1|(a>f+3?j[f+3]<<11:0)|(a>f+4?i[f+4]<<4:0)|g;return m}function h(a,b,d,e,g,h,i,j){if(a&&c("JBIG2 error: MMR encoding is not supported"),0===e&&!h&&!g&&4===i.length&&3===i[0].x&&-1===i[0].y&&-3===i[1].x&&-1===i[1].y&&2===i[2].x&&-2===i[2].y&&-2===i[3].x&&-2===i[3].y)return f(b,d,j);var k=!!h,l=y[e].concat(i);l.sort(function(a,b){return a.y-b.y||a.x-b.x});var m,n,o=l.length,p=new Int8Array(o),q=new Int8Array(o),r=[],s=0,t=0,u=0,v=0;for(n=0;o>n;n++)p[n]=l[n].x,q[n]=l[n].y,t=Math.min(t,l[n].x),u=Math.max(u,l[n].x),v=Math.min(v,l[n].y),o-1>n&&l[n].y===l[n+1].y&&l[n].x===l[n+1].x-1?s|=1<m;m++)n=r[m],x[m]=l[n].x,z[m]=l[n].y,B[m]=1<R;R++){if(g){var S=N.readBit(O,K);if(P^=S){M.push(L);continue}}for(L=new Uint8Array(L),M.push(L),C=0;b>C;C++)if(k&&h[R][C])L[C]=0;else{if(C>=H&&J>C&&R>=I)for(Q=Q<<1&s,n=0;w>n;n++)D=R+z[n],E=C+x[n],F=M[D][E],F&&(F=B[n],Q|=F);else for(Q=0,G=o-1,n=0;o>n;n++,G--)E=C+p[n],E>=0&&b>E&&(D=R+q[n],D>=0&&(F=M[D][E],F&&(Q|=F<l;l++)n[l]=k[l].x,o[l]=k[l].y;var p=z[d].reference;0===d&&(p=p.concat([i[1]]));var q=p.length,r=new Int32Array(q),s=new Int32Array(q);for(l=0;q>l;l++)r[l]=p[l].x,s[l]=p[l].y;for(var t=e[0].length,u=e.length,v=B[d],w=[],x=j.decoder,y=j.contextCache.getContexts("GR"),A=0,C=0;b>C;C++){if(h){var D=x.readBit(y,v);A^=D,A&&c("JBIG2 error: prediction is not supported")}var E=new Uint8Array(a);w.push(E);for(var F=0;a>F;F++){var G,H,I=0;for(l=0;m>l;l++)G=C+o[l],H=F+n[l],0>G||0>H||H>=a?I<<=1:I=I<<1|w[G][H];for(l=0;q>l;l++)G=C+s[l]+g,H=F+r[l]+f,0>G||G>=u||0>H||H>=t?I<<=1:I=I<<1|e[G][H];var J=x.readBit(y,I);E[F]=J}}return w}function j(a,b,f,g,j,m,n,o,p,q,r){a&&c("JBIG2 error: huffman is not supported");for(var s=[],t=0,u=l(f.length+g),v=r.decoder,w=r.contextCache;s.length1)B=k(a,b,y,t,0,C,1,f.concat(s),u,0,0,1,0,m,p,q,r);else{var D=e(w,v,u),E=d(w,"IARDX",v),F=d(w,"IARDY",v),G=DM;M++)I[M]&&H.push(f[M]);for(var O=0;g>O;M++,O++)I[M]&&H.push(s[O]);return H}function k(a,b,f,g,h,j,k,l,m,n,o,p,q,r,s,t,u){a&&c("JBIG2 error: huffman is not supported");var v,w,x=[];for(v=0;g>v;v++){if(w=new Uint8Array(f),h)for(var y=0;f>y;y++)w[y]=h;x.push(w)}var z=u.decoder,A=u.contextCache,B=-d(A,"IADT",z),C=0;for(v=0;j>v;){var D=d(A,"IADT",z);B+=D;var E=d(A,"IAFS",z);C+=E;for(var F=C;;){var G=1===k?0:d(A,"IAIT",z),H=k*B+G,I=e(A,z,m),J=b&&d(A,"IARI",z),K=l[I],L=K[0].length,M=K.length;if(J){var N=d(A,"IARDW",z),O=d(A,"IARDH",z),P=d(A,"IARDX",z),Q=d(A,"IARDY",z);L+=N,M+=O,K=i(L,M,s,K,(N>>1)+P,(O>>1)+Q,!1,t,u)}var R,S,T,U=H-(1&p?0:M),V=F-(2&p?L:0);if(n){for(R=0;M>R;R++)if(w=x[V+R]){T=K[R];var W=Math.min(f-U,L);switch(q){case 0:for(S=0;W>S;S++)w[U+S]|=T[S];break;case 2:for(S=0;W>S;S++)w[U+S]^=T[S];break;default:c("JBIG2 error: operator "+q+" is not supported")}}F+=M-1}else{for(S=0;M>S;S++)if(w=x[U+S])switch(T=K[S],q){case 0:for(R=0;L>R;R++)w[V+R]|=T[R];break;case 2:for(R=0;L>R;R++)w[V+R]^=T[R];break;default:c("JBIG2 error: operator "+q+" is not supported")}F+=L-1}v++;var X=d(A,"IADS",z);if(null===X)break;F+=X+o}}return x}function p(a,b){var d={};d.number=o(a,b);var e=a[b+4],f=63&e;x[f]||c("JBIG2 error: invalid segment type: "+f),d.type=f,d.typeName=x[f],d.deferredNonRetain=!!(128&e);var g=!!(64&e),h=a[b+5],i=h>>5&7,j=[31&h],k=b+6;if(7===h){i=536870911&o(a,k-1),k+=3;var l=i+7>>3;for(j[0]=a[k++];--l>0;)j.push(a[k++])}else(5===h||6===h)&&c("JBIG2 error: invalid referred-to flags");d.retainBits=j;var m,p,q=d.number<=256?1:d.number<=65536?2:4,s=[];for(m=0;i>m;m++){var t=1===q?a[k]:2===q?n(a,k):o(a,k);s.push(t),k+=q}if(d.referredTo=s,g?(d.pageAssociation=o(a,k),k+=4):d.pageAssociation=a[k++],d.length=o(a,k),k+=4,4294967295===d.length)if(38===f){var u=r(a,k),v=a[k+C],w=!!(1&v),y=6,z=new Uint8Array(y);for(w||(z[0]=255,z[1]=172),z[2]=u.height>>>24&255,z[3]=u.height>>16&255,z[4]=u.height>>8&255,z[5]=255&u.height,m=k,p=a.length;p>m;m++){for(var A=0;y>A&&z[A]===a[m+A];)A++;if(A===y){d.length=m+y;break}}4294967295===d.length&&c("JBIG2 error: segment end was not found")}else c("JBIG2 error: invalid unknown segment length");return d.headerEnd=k,d}function q(a,b,c,d){for(var e=[],f=c;d>f;){var g=p(b,f);f=g.headerEnd;var h={header:g,data:b};if(a.randomAccess||(h.start=f,f+=g.length,h.end=f),e.push(h),51===g.type)break}if(a.randomAccess)for(var i=0,j=e.length;j>i;i++)e[i].start=f,f+=e[i].header.length,e[i].end=f;return e}function r(a,b){return{width:o(a,b),height:o(a,b+4),x:o(a,b+8),y:o(a,b+12),combinationOperator:7&a[b+16]}}function s(a,b){var d,e,f,g,h=a.header,i=a.data,j=a.start,k=a.end;switch(h.type){case 0:var l={},p=n(i,j);if(l.huffman=!!(1&p),l.refinement=!!(2&p),l.huffmanDHSelector=p>>2&3,l.huffmanDWSelector=p>>4&3,l.bitmapSizeSelector=p>>6&1,l.aggregationInstancesSelector=p>>7&1,l.bitmapCodingContextUsed=!!(256&p),l.bitmapCodingContextRetained=!!(512&p),l.template=p>>10&3,l.refinementTemplate=p>>12&1,j+=2,!l.huffman){for(g=0===l.template?4:1,e=[],f=0;g>f;f++)e.push({x:m(i,j),y:m(i,j+1)}),j+=2;l.at=e}if(l.refinement&&!l.refinementTemplate){for(e=[],f=0;2>f;f++)e.push({x:m(i,j),y:m(i,j+1)}),j+=2;l.refinementAt=e}l.numberOfExportedSymbols=o(i,j),j+=4,l.numberOfNewSymbols=o(i,j),j+=4,d=[l,h.number,h.referredTo,i,j,k];break;case 6:case 7:var q={};q.info=r(i,j),j+=C;var s=n(i,j);if(j+=2,q.huffman=!!(1&s),q.refinement=!!(2&s),q.stripSize=1<<(s>>2&3),q.referenceCorner=s>>4&3,q.transposed=!!(64&s),q.combinationOperator=s>>7&3,q.defaultPixelValue=s>>9&1,q.dsOffset=s<<17>>27,q.refinementTemplate=s>>15&1,q.huffman){var t=n(i,j);j+=2,q.huffmanFS=3&t,q.huffmanDS=t>>2&3,q.huffmanDT=t>>4&3,q.huffmanRefinementDW=t>>6&3,q.huffmanRefinementDH=t>>8&3,q.huffmanRefinementDX=t>>10&3,q.huffmanRefinementDY=t>>12&3,q.huffmanRefinementSizeSelector=!!(14&t)}if(q.refinement&&!q.refinementTemplate){for(e=[],f=0;2>f;f++)e.push({x:m(i,j),y:m(i,j+1)}),j+=2;q.refinementAt=e}q.numberOfSymbolInstances=o(i,j),j+=4,q.huffman&&c("JBIG2 error: huffman is not supported"),d=[q,h.referredTo,i,j,k];break;case 38:case 39:var u={};u.info=r(i,j),j+=C;var v=i[j++];if(u.mmr=!!(1&v),u.template=v>>1&3,u.prediction=!!(8&v),!u.mmr){for(g=0===u.template?4:1,e=[],f=0;g>f;f++)e.push({x:m(i,j),y:m(i,j+1)}),j+=2;u.at=e}d=[u,i,j,k];break;case 48:var w={width:o(i,j),height:o(i,j+4),resolutionX:o(i,j+8),resolutionY:o(i,j+12)};4294967295===w.height&&delete w.height;var x=i[j+16];n(i,j+17);w.lossless=!!(1&x),w.refinement=!!(2&x),w.defaultPixelValue=x>>2&1,w.combinationOperator=x>>3&3,w.requiresBuffer=!!(32&x),w.combinationOperatorOverride=!!(64&x),d=[w];break;case 49:break;case 50:break;case 51:break;case 62:break;default:c("JBIG2 error: segment type "+h.typeName+"("+h.type+") is not implemented")}var y="on"+h.typeName;y in b&&b[y].apply(b,d)}function t(a,b){for(var c=0,d=a.length;d>c;c++)s(a[c],b)}function u(a){for(var b=new v,c=0,d=a.length;d>c;c++){var e=a[c],f=q({},e.data,e.start,e.end);t(f,b)}return b.buffer}function v(){}function w(){}a.prototype={getContexts:function(a){return a in this?this[a]:this[a]=new Int8Array(65536)}},b.prototype={get decoder(){var a=new fd(this.data,this.start,this.end);return g(this,"decoder",a)},get contextCache(){var b=new a;return g(this,"contextCache",b)}};var x=["SymbolDictionary",null,null,null,"IntermediateTextRegion",null,"ImmediateTextRegion","ImmediateLosslessTextRegion",null,null,null,null,null,null,null,null,"patternDictionary",null,null,null,"IntermediateHalftoneRegion",null,"ImmediateHalftoneRegion","ImmediateLosslessHalftoneRegion",null,null,null,null,null,null,null,null,null,null,null,null,"IntermediateGenericRegion",null,"ImmediateGenericRegion","ImmediateLosslessGenericRegion","IntermediateGenericRefinementRegion",null,"ImmediateGenericRefinementRegion","ImmediateLosslessGenericRefinementRegion",null,null,null,null,"PageInformation","EndOfPage","EndOfStripe","EndOfFile","Profiles","Tables",null,null,null,null,null,null,null,null,"Extension"],y=[[{x:-1,y:-2},{x:0,y:-2},{x:1,y:-2},{x:-2,y:-1},{x:-1,y:-1},{x:0,y:-1},{x:1,y:-1},{x:2,y:-1},{x:-4,y:0},{x:-3,y:0},{x:-2,y:0},{x:-1,y:0}],[{x:-1,y:-2},{x:0,y:-2},{x:1,y:-2},{x:2,y:-2},{x:-2,y:-1},{x:-1,y:-1},{x:0,y:-1},{x:1,y:-1},{x:2,y:-1},{x:-3,y:0},{x:-2,y:0},{x:-1,y:0}],[{x:-1,y:-2},{x:0,y:-2},{x:1,y:-2},{x:-2,y:-1},{x:-1,y:-1},{x:0,y:-1},{x:1,y:-1},{x:-2,y:0},{x:-1,y:0}],[{x:-3,y:-1},{x:-2,y:-1},{x:-1,y:-1},{x:0,y:-1},{x:1,y:-1},{x:-4,y:0},{x:-3,y:0},{x:-2,y:0},{x:-1,y:0}]],z=[{coding:[{x:0,y:-1},{x:1,y:-1},{x:-1,y:0}],reference:[{x:0,y:-1},{x:1,y:-1},{x:-1,y:0},{x:0,y:0},{x:1,y:0},{x:-1,y:1},{x:0,y:1},{x:1,y:1}]},{coding:[{x:-1,y:-1},{x:0,y:-1},{x:1,y:-1},{x:-1,y:0}],reference:[{x:0,y:-1},{x:-1,y:0},{x:0,y:0},{x:1,y:0},{x:0,y:1},{x:1,y:1}]}],A=[39717,1941,229,405],B=[32,8],C=17;return v.prototype={onPageInformation:function(a){this.currentPageInfo=a;var b=a.width+7>>3,c=new Uint8Array(b*a.height);if(a.defaultPixelValue)for(var d=0,e=c.length;e>d;d++)c[d]=255;this.buffer=c},drawBitmap:function(a,b){var d,e,f,g,h=this.currentPageInfo,i=a.width,j=a.height,k=h.width+7>>3,l=h.combinationOperatorOverride?a.combinationOperator:h.combinationOperator,m=this.buffer,n=128>>(7&a.x),o=a.y*k+(a.x>>3);switch(l){case 0:for(d=0;j>d;d++){for(f=n,g=o,e=0;i>e;e++)b[d][e]&&(m[g]|=f),f>>=1,f||(f=128,g++);o+=k}break;case 2:for(d=0;j>d;d++){for(f=n,g=o,e=0;i>e;e++)b[d][e]&&(m[g]^=f),f>>=1,f||(f=128,g++);o+=k}break;default:c("JBIG2 error: operator "+l+" is not supported")}},onImmediateGenericRegion:function(a,c,d,e){var f=a.info,g=new b(c,d,e),i=h(a.mmr,f.width,f.height,a.template,a.prediction,null,a.at,g);this.drawBitmap(f,i)},onImmediateLosslessGenericRegion:function(){this.onImmediateGenericRegion.apply(this,arguments)},onSymbolDictionary:function(a,d,e,f,g,h){var i;a.huffman&&c("JBIG2 error: huffman is not supported");var k=this.symbols;k||(this.symbols=k={});for(var l=[],m=0,n=e.length;n>m;m++)l=l.concat(k[e[m]]);var o=new b(f,g,h);k[d]=j(a.huffman,a.refinement,l,a.numberOfNewSymbols,a.numberOfExportedSymbols,i,a.template,a.at,a.refinementTemplate,a.refinementAt,o)},onImmediateTextRegion:function(a,c,d,e,f){for(var g,h=a.info,i=this.symbols,j=[],m=0,n=c.length;n>m;m++)j=j.concat(i[c[m]]);var o=l(j.length),p=new b(d,e,f),q=k(a.huffman,a.refinement,h.width,h.height,a.defaultPixelValue,a.numberOfSymbolInstances,a.stripSize,j,o,a.transposed,a.dsOffset,a.referenceCorner,a.combinationOperator,g,a.refinementTemplate,a.refinementAt,p);this.drawBitmap(h,q)},onImmediateLosslessTextRegion:function(){this.onImmediateTextRegion.apply(this,arguments)}},w.prototype={parseChunks:function(a){return u(a)}},w}(),jd=(PDFJS.bidi=function(){function a(a){return 0!==(1&a)}function b(a){return 0===(1&a)}function c(a,b,c){for(var d=b,e=a.length;e>d;++d)if(a[d]!==c)return d;return d}function d(a,b,c,d){for(var e=b;c>e;++e)a[e]=d}function e(a,b,c){for(var d=b,e=c-1;e>d;++d,--e){var f=a[d];a[d]=a[e],a[e]=f}}function f(a,b,c){return{str:a,dir:c?"ttb":b?"ltr":"rtl"}}function g(g,l,m){var n=!0,o=g.length;if(0===o||m)return f(g,n,m);j.length=o,k.length=o;var p,q,r=0;for(p=0;o>p;++p){j[p]=g.charAt(p);var s=g.charCodeAt(p),t="L";255>=s?t=h[s]:s>=1424&&1524>=s?t="R":s>=1536&&1791>=s?t=i[255&s]:s>=1792&&2220>=s&&(t="AL"),("R"===t||"AL"===t||"AN"===t)&&r++,k[p]=t}if(0===r)return n=!0,f(g,n);-1===l&&(.3>o/r?(n=!0,l=0):(n=!1,l=1));var u=[];for(p=0;o>p;++p)u[p]=l;var v=a(l)?"R":"L",w=v,x=w,y=w;for(p=0;o>p;++p)"NSM"===k[p]?k[p]=y:y=k[p];y=w;var z;for(p=0;o>p;++p)z=k[p],"EN"===z?k[p]="AL"===y?"AN":"EN":("R"===z||"L"===z||"AL"===z)&&(y=z);for(p=0;o>p;++p)z=k[p],"AL"===z&&(k[p]="R");for(p=1;o-1>p;++p)"ES"===k[p]&&"EN"===k[p-1]&&"EN"===k[p+1]&&(k[p]="EN"),"CS"!==k[p]||"EN"!==k[p-1]&&"AN"!==k[p-1]||k[p+1]!==k[p-1]||(k[p]=k[p-1]);for(p=0;o>p;++p)if("EN"===k[p]){var A;for(A=p-1;A>=0&&"ET"===k[A];--A)k[A]="EN";for(A=p+1;o>A&&"ET"===k[A];--A)k[A]="EN"}for(p=0;o>p;++p)z=k[p],("WS"===z||"ES"===z||"ET"===z||"CS"===z)&&(k[p]="ON");for(y=w,p=0;o>p;++p)z=k[p],"EN"===z?k[p]="L"===y?"L":"EN":("R"===z||"L"===z)&&(y=z);for(p=0;o>p;++p)if("ON"===k[p]){var B=c(k,p+1,"ON"),C=w;p>0&&(C=k[p-1]);var D=x;o>B+1&&(D=k[B+1]),"L"!==C&&(C="R"),"L"!==D&&(D="R"),C===D&&d(k,p,B,C),p=B-1}for(p=0;o>p;++p)"ON"===k[p]&&(k[p]=v);for(p=0;o>p;++p)z=k[p],b(u[p])?"R"===z?u[p]+=1:("AN"===z||"EN"===z)&&(u[p]+=2):("L"===z||"AN"===z||"EN"===z)&&(u[p]+=1);var E,F=-1,G=99;for(p=0,q=u.length;q>p;++p)E=u[p],E>F&&(F=E),G>E&&a(E)&&(G=E);for(E=F;E>=G;--E){var H=-1;for(p=0,q=u.length;q>p;++p)u[p]=0&&(e(j,H,p),H=-1):0>H&&(H=p);H>=0&&e(j,H,u.length)}for(p=0,q=j.length;q>p;++p){var I=j[p];("<"===I||">"===I)&&(j[p]="")}return f(j.join(""),n)}var h=["BN","BN","BN","BN","BN","BN","BN","BN","BN","S","B","S","WS","B","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","B","B","B","S","WS","ON","ON","ET","ET","ET","ON","ON","ON","ON","ON","ON","CS","ON","CS","ON","EN","EN","EN","EN","EN","EN","EN","EN","EN","EN","ON","ON","ON","ON","ON","ON","ON","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","ON","ON","ON","ON","ON","ON","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","ON","ON","ON","ON","BN","BN","BN","BN","BN","BN","B","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","CS","ON","ET","ET","ET","ET","ON","ON","ON","ON","L","ON","ON","ON","ON","ON","ET","ET","EN","EN","ON","L","ON","ON","ON","EN","L","ON","ON","ON","ON","ON","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","ON","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","ON","L","L","L","L","L","L","L","L"],i=["AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","CS","AL","ON","ON","NSM","NSM","NSM","NSM","NSM","NSM","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","AL","AL","AL","AL","AL","AL","AL","AN","AN","AN","AN","AN","AN","AN","AN","AN","AN","ET","AN","AN","AL","AL","AL","NSM","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","ON","NSM","NSM","NSM","NSM","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL"],j=[],k=[];return g}(),function(a){function b(a){var b=3285377520;this.h1=a?4294967295&a:b,this.h2=a?4294967295&a:b}var c=4294901760,d=65535,e=!1;try{new Uint32Array(new Uint8Array(5).buffer,0,1)}catch(f){e=!0}return b.prototype={update:function(a){var b,f=e;if("string"==typeof a){var g=new Uint8Array(2*a.length),h=0;for(b=0;b=i?g[h++]=i:(g[h++]=i>>>8,g[h++]=255&i)}}else if(a instanceof Uint8Array)g=a,h=g.length;else{if(!("object"==typeof a&&"length"in a))throw new Error("Wrong data format in MurmurHash3_64_update. Input must be a string or array.");g=a,h=g.length,f=!0}var j=h>>2,k=h-4*j,l=f?new la(g,j):new Uint32Array(g.buffer,0,j),m=0,n=0,o=this.h1,p=this.h2,q=3432918353,r=461845907,s=q&d,t=r&d;for(b=0;j>b;b++)1&b?(m=l[b],m=m*q&c|m*s&d,m=m<<15|m>>>17,m=m*r&c|m*t&d,o^=m,o=o<<13|o>>>19,o=5*o+3864292196):(n=l[b],n=n*q&c|n*s&d,n=n<<15|n>>>17,n=n*r&c|n*t&d,p^=n,p=p<<13|p>>>19,p=5*p+3864292196);switch(m=0,k){case 3:m^=g[4*j+2]<<16;case 2:m^=g[4*j+1]<<8;case 1:m^=g[4*j],m=m*q&c|m*s&d,m=m<<15|m>>>17,m=m*r&c|m*t&d,1&j?o^=m:p^=m}return this.h1=o,this.h2=p,this},hexdigest:function(){var a=this.h1,b=this.h2;a^=b>>>1,a=3981806797*a&c|36045*a&d,b=4283543511*b&c|(2950163797*(b<<16|a>>>16)&c)>>>16,a^=b>>>1,a=444984403*a&c|60499*a&d,b=3301882366*b&c|(3120437893*(b<<16|a>>>16)&c)>>>16,a^=b>>>1;for(var e=0,f=[a,b],g="";e>>0).toString(16);h.length<8;)h="0"+h;g+=h}return g}},b}())}.call("undefined"==typeof window?this:window),PDFJS.workerSrc||"undefined"==typeof document||(PDFJS.workerSrc=function(){"use strict";var a=document.body||document.getElementsByTagName("head")[0],b=a.lastChild.src;return b&&b.replace(/\.js$/i,".worker.js")}()),function(a){"function"==typeof define&&define.amd?define(["jquery"],a):a("object"==typeof exports?require("jquery"):jQuery)}(function(a){var b=function(){if(a&&a.fn&&a.fn.select2&&a.fn.select2.amd)var b=a.fn.select2.amd;var b;return function(){if(!b||!b.requirejs){b?c=b:b={};var a,c,d;!function(b){function e(a,b){return u.call(a,b)}function f(a,b){var c,d,e,f,g,h,i,j,k,l,m,n=b&&b.split("/"),o=s.map,p=o&&o["*"]||{};if(a&&"."===a.charAt(0))if(b){for(a=a.split("/"),g=a.length-1,s.nodeIdCompat&&w.test(a[g])&&(a[g]=a[g].replace(w,"")),a=n.slice(0,n.length-1).concat(a),k=0;k0&&(a.splice(k-1,2),k-=2)}a=a.join("/")}else 0===a.indexOf("./")&&(a=a.substring(2));if((n||p)&&o){for(c=a.split("/"),k=c.length;k>0;k-=1){if(d=c.slice(0,k).join("/"),n)for(l=n.length;l>0;l-=1)if(e=o[n.slice(0,l).join("/")],e&&(e=e[d])){f=e,h=k;break}if(f)break;!i&&p&&p[d]&&(i=p[d],j=k)}!f&&i&&(f=i,h=j),f&&(c.splice(0,h,f),a=c.join("/"))}return a}function g(a,c){return function(){var d=v.call(arguments,0);return"string"!=typeof d[0]&&1===d.length&&d.push(null),n.apply(b,d.concat([a,c]))}}function h(a){return function(b){return f(b,a)}}function i(a){return function(b){q[a]=b}}function j(a){if(e(r,a)){var c=r[a];delete r[a],t[a]=!0,m.apply(b,c)}if(!e(q,a)&&!e(t,a))throw new Error("No "+a);return q[a]}function k(a){var b,c=a?a.indexOf("!"):-1;return c>-1&&(b=a.substring(0,c),a=a.substring(c+1,a.length)),[b,a]}function l(a){return function(){return s&&s.config&&s.config[a]||{}}}var m,n,o,p,q={},r={},s={},t={},u=Object.prototype.hasOwnProperty,v=[].slice,w=/\.js$/;o=function(a,b){var c,d=k(a),e=d[0];return a=d[1],e&&(e=f(e,b),c=j(e)),e?a=c&&c.normalize?c.normalize(a,h(b)):f(a,b):(a=f(a,b),d=k(a),e=d[0],a=d[1],e&&(c=j(e))),{f:e?e+"!"+a:a,n:a,pr:e,p:c}},p={require:function(a){return g(a)},exports:function(a){var b=q[a];return"undefined"!=typeof b?b:q[a]={}},module:function(a){return{id:a,uri:"",exports:q[a],config:l(a)}}},m=function(a,c,d,f){var h,k,l,m,n,s,u=[],v=typeof d;if(f=f||a,"undefined"===v||"function"===v){for(c=!c.length&&d.length?["require","exports","module"]:c,n=0;n0&&(b.call(arguments,a.prototype.constructor),e=c.prototype.constructor),e.apply(this,arguments)}function e(){this.constructor=d}var f=b(c),g=b(a);c.displayName=a.displayName,d.prototype=new e;for(var h=0;hc;c++)a[c].apply(this,b)},c.Observable=d,c.generateChars=function(a){for(var b="",c=0;a>c;c++){var d=Math.floor(36*Math.random());b+=d.toString(36)}return b},c.bind=function(a,b){return function(){a.apply(b,arguments)}},c._convertData=function(a){for(var b in a){var c=b.split("-"),d=a;if(1!==c.length){for(var e=0;e":">",'"':""","'":"'","/":"/"};return"string"!=typeof a?a:String(a).replace(/[&<>"'\/\\]/g,function(a){return b[a]})},c.appendMany=function(b,c){if("1.7"===a.fn.jquery.substr(0,3)){var d=a();a.map(c,function(a){d=d.add(a)}),c=d}b.append(c)},c}),b.define("select2/results",["jquery","./utils"],function(a,b){function c(a,b,d){this.$element=a,this.data=d,this.options=b,c.__super__.constructor.call(this)}return b.Extend(c,b.Observable),c.prototype.render=function(){var b=a('
      ');return this.options.get("multiple")&&b.attr("aria-multiselectable","true"),this.$results=b,b},c.prototype.clear=function(){this.$results.empty()},c.prototype.displayMessage=function(b){var c=this.options.get("escapeMarkup");this.clear(),this.hideLoading();var d=a('
    • '),e=this.options.get("translations").get(b.message); +d.append(c(e(b.args))),d[0].className+=" select2-results__message",this.$results.append(d)},c.prototype.hideMessages=function(){this.$results.find(".select2-results__message").remove()},c.prototype.append=function(a){this.hideLoading();var b=[];if(null==a.results||0===a.results.length)return void(0===this.$results.children().length&&this.trigger("results:message",{message:"noResults"}));a.results=this.sort(a.results);for(var c=0;c-1?b.attr("aria-selected","true"):b.attr("aria-selected","false")});var f=e.filter("[aria-selected=true]");f.length>0?f.first().trigger("mouseenter"):e.first().trigger("mouseenter")})},c.prototype.showLoading=function(a){this.hideLoading();var b=this.options.get("translations").get("searching"),c={disabled:!0,loading:!0,text:b(a)},d=this.option(c);d.className+=" loading-results",this.$results.prepend(d)},c.prototype.hideLoading=function(){this.$results.find(".loading-results").remove()},c.prototype.option=function(b){var c=document.createElement("li");c.className="select2-results__option";var d={role:"treeitem","aria-selected":"false"};b.disabled&&(delete d["aria-selected"],d["aria-disabled"]="true"),null==b.id&&delete d["aria-selected"],null!=b._resultId&&(c.id=b._resultId),b.title&&(c.title=b.title),b.children&&(d.role="group",d["aria-label"]=b.text,delete d["aria-selected"]);for(var e in d){var f=d[e];c.setAttribute(e,f)}if(b.children){var g=a(c),h=document.createElement("strong");h.className="select2-results__group";a(h);this.template(b,h);for(var i=[],j=0;j",{"class":"select2-results__options select2-results__options--nested"});m.append(i),g.append(h),g.append(m)}else this.template(b,c);return a.data(c,"data",b),c},c.prototype.bind=function(b,c){var d=this,e=b.id+"-results";this.$results.attr("id",e),b.on("results:all",function(a){d.clear(),d.append(a.data),b.isOpen()&&d.setClasses()}),b.on("results:append",function(a){d.append(a.data),b.isOpen()&&d.setClasses()}),b.on("query",function(a){d.hideMessages(),d.showLoading(a)}),b.on("select",function(){b.isOpen()&&d.setClasses()}),b.on("unselect",function(){b.isOpen()&&d.setClasses()}),b.on("open",function(){d.$results.attr("aria-expanded","true"),d.$results.attr("aria-hidden","false"),d.setClasses(),d.ensureHighlightVisible()}),b.on("close",function(){d.$results.attr("aria-expanded","false"),d.$results.attr("aria-hidden","true"),d.$results.removeAttr("aria-activedescendant")}),b.on("results:toggle",function(){var a=d.getHighlightedResults();0!==a.length&&a.trigger("mouseup")}),b.on("results:select",function(){var a=d.getHighlightedResults();if(0!==a.length){var b=a.data("data");"true"==a.attr("aria-selected")?d.trigger("close",{}):d.trigger("select",{data:b})}}),b.on("results:previous",function(){var a=d.getHighlightedResults(),b=d.$results.find("[aria-selected]"),c=b.index(a);if(0!==c){var e=c-1;0===a.length&&(e=0);var f=b.eq(e);f.trigger("mouseenter");var g=d.$results.offset().top,h=f.offset().top,i=d.$results.scrollTop()+(h-g);0===e?d.$results.scrollTop(0):0>h-g&&d.$results.scrollTop(i)}}),b.on("results:next",function(){var a=d.getHighlightedResults(),b=d.$results.find("[aria-selected]"),c=b.index(a),e=c+1;if(!(e>=b.length)){var f=b.eq(e);f.trigger("mouseenter");var g=d.$results.offset().top+d.$results.outerHeight(!1),h=f.offset().top+f.outerHeight(!1),i=d.$results.scrollTop()+h-g;0===e?d.$results.scrollTop(0):h>g&&d.$results.scrollTop(i)}}),b.on("results:focus",function(a){a.element.addClass("select2-results__option--highlighted")}),b.on("results:message",function(a){d.displayMessage(a)}),a.fn.mousewheel&&this.$results.on("mousewheel",function(a){var b=d.$results.scrollTop(),c=d.$results.get(0).scrollHeight-d.$results.scrollTop()+a.deltaY,e=a.deltaY>0&&b-a.deltaY<=0,f=a.deltaY<0&&c<=d.$results.height();e?(d.$results.scrollTop(0),a.preventDefault(),a.stopPropagation()):f&&(d.$results.scrollTop(d.$results.get(0).scrollHeight-d.$results.height()),a.preventDefault(),a.stopPropagation())}),this.$results.on("mouseup",".select2-results__option[aria-selected]",function(b){var c=a(this),e=c.data("data");return"true"===c.attr("aria-selected")?void(d.options.get("multiple")?d.trigger("unselect",{originalEvent:b,data:e}):d.trigger("close",{})):void d.trigger("select",{originalEvent:b,data:e})}),this.$results.on("mouseenter",".select2-results__option[aria-selected]",function(b){var c=a(this).data("data");d.getHighlightedResults().removeClass("select2-results__option--highlighted"),d.trigger("results:focus",{data:c,element:a(this)})})},c.prototype.getHighlightedResults=function(){var a=this.$results.find(".select2-results__option--highlighted");return a},c.prototype.destroy=function(){this.$results.remove()},c.prototype.ensureHighlightVisible=function(){var a=this.getHighlightedResults();if(0!==a.length){var b=this.$results.find("[aria-selected]"),c=b.index(a),d=this.$results.offset().top,e=a.offset().top,f=this.$results.scrollTop()+(e-d),g=e-d;f-=2*a.outerHeight(!1),2>=c?this.$results.scrollTop(0):(g>this.$results.outerHeight()||0>g)&&this.$results.scrollTop(f)}},c.prototype.template=function(b,c){var d=this.options.get("templateResult"),e=this.options.get("escapeMarkup"),f=d(b,c);null==f?c.style.display="none":"string"==typeof f?c.innerHTML=e(f):a(c).append(f)},c}),b.define("select2/keys",[],function(){var a={BACKSPACE:8,TAB:9,ENTER:13,SHIFT:16,CTRL:17,ALT:18,ESC:27,SPACE:32,PAGE_UP:33,PAGE_DOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,DELETE:46};return a}),b.define("select2/selection/base",["jquery","../utils","../keys"],function(a,b,c){function d(a,b){this.$element=a,this.options=b,d.__super__.constructor.call(this)}return b.Extend(d,b.Observable),d.prototype.render=function(){var b=a('');return this._tabindex=0,null!=this.$element.data("old-tabindex")?this._tabindex=this.$element.data("old-tabindex"):null!=this.$element.attr("tabindex")&&(this._tabindex=this.$element.attr("tabindex")),b.attr("title",this.$element.attr("title")),b.attr("tabindex",this._tabindex),this.$selection=b,b},d.prototype.bind=function(a,b){var d=this,e=(a.id+"-container",a.id+"-results");this.container=a,this.$selection.on("focus",function(a){d.trigger("focus",a)}),this.$selection.on("blur",function(a){d._handleBlur(a)}),this.$selection.on("keydown",function(a){d.trigger("keypress",a),a.which===c.SPACE&&a.preventDefault()}),a.on("results:focus",function(a){d.$selection.attr("aria-activedescendant",a.data._resultId)}),a.on("selection:update",function(a){d.update(a.data)}),a.on("open",function(){d.$selection.attr("aria-expanded","true"),d.$selection.attr("aria-owns",e),d._attachCloseHandler(a)}),a.on("close",function(){d.$selection.attr("aria-expanded","false"),d.$selection.removeAttr("aria-activedescendant"),d.$selection.removeAttr("aria-owns"),d.$selection.focus(),d._detachCloseHandler(a)}),a.on("enable",function(){d.$selection.attr("tabindex",d._tabindex)}),a.on("disable",function(){d.$selection.attr("tabindex","-1")})},d.prototype._handleBlur=function(b){var c=this;window.setTimeout(function(){document.activeElement==c.$selection[0]||a.contains(c.$selection[0],document.activeElement)||c.trigger("blur",b)},1)},d.prototype._attachCloseHandler=function(b){a(document.body).on("mousedown.select2."+b.id,function(b){var c=a(b.target),d=c.closest(".select2"),e=a(".select2.select2-container--open");e.each(function(){var b=a(this);if(this!=d[0]){var c=b.data("element");c.select2("close")}})})},d.prototype._detachCloseHandler=function(b){a(document.body).off("mousedown.select2."+b.id)},d.prototype.position=function(a,b){var c=b.find(".selection");c.append(a)},d.prototype.destroy=function(){this._detachCloseHandler(this.container)},d.prototype.update=function(a){throw new Error("The `update` method must be defined in child classes.")},d}),b.define("select2/selection/single",["jquery","./base","../utils","../keys"],function(a,b,c,d){function e(){e.__super__.constructor.apply(this,arguments)}return c.Extend(e,b),e.prototype.render=function(){var a=e.__super__.render.call(this);return a.addClass("select2-selection--single"),a.html(''),a},e.prototype.bind=function(a,b){var c=this;e.__super__.bind.apply(this,arguments);var d=a.id+"-container";this.$selection.find(".select2-selection__rendered").attr("id",d),this.$selection.attr("aria-labelledby",d),this.$selection.on("mousedown",function(a){1===a.which&&c.trigger("toggle",{originalEvent:a})}),this.$selection.on("focus",function(a){}),this.$selection.on("blur",function(a){}),a.on("selection:update",function(a){c.update(a.data)})},e.prototype.clear=function(){this.$selection.find(".select2-selection__rendered").empty()},e.prototype.display=function(a,b){var c=this.options.get("templateSelection"),d=this.options.get("escapeMarkup");return d(c(a,b))},e.prototype.selectionContainer=function(){return a("")},e.prototype.update=function(a){if(0===a.length)return void this.clear();var b=a[0],c=this.$selection.find(".select2-selection__rendered"),d=this.display(b,c);c.empty().append(d),c.prop("title",b.title||b.text)},e}),b.define("select2/selection/multiple",["jquery","./base","../utils"],function(a,b,c){function d(a,b){d.__super__.constructor.apply(this,arguments)}return c.Extend(d,b),d.prototype.render=function(){var a=d.__super__.render.call(this);return a.addClass("select2-selection--multiple"),a.html('
        '),a},d.prototype.bind=function(b,c){var e=this;d.__super__.bind.apply(this,arguments),this.$selection.on("click",function(a){e.trigger("toggle",{originalEvent:a})}),this.$selection.on("click",".select2-selection__choice__remove",function(b){if(!e.options.get("disabled")){var c=a(this),d=c.parent(),f=d.data("data");e.trigger("unselect",{originalEvent:b,data:f})}})},d.prototype.clear=function(){this.$selection.find(".select2-selection__rendered").empty()},d.prototype.display=function(a,b){var c=this.options.get("templateSelection"),d=this.options.get("escapeMarkup");return d(c(a,b))},d.prototype.selectionContainer=function(){var b=a('
      • ×
      • ');return b},d.prototype.update=function(a){if(this.clear(),0!==a.length){for(var b=[],d=0;d1;if(d||c)return a.call(this,b);this.clear();var e=this.createPlaceholder(this.placeholder);this.$selection.find(".select2-selection__rendered").append(e)},b}),b.define("select2/selection/allowClear",["jquery","../keys"],function(a,b){function c(){}return c.prototype.bind=function(a,b,c){var d=this;a.call(this,b,c),null==this.placeholder&&this.options.get("debug")&&window.console&&console.error&&console.error("Select2: The `allowClear` option should be used in combination with the `placeholder` option."),this.$selection.on("mousedown",".select2-selection__clear",function(a){d._handleClear(a)}),b.on("keypress",function(a){d._handleKeyboardClear(a,b)})},c.prototype._handleClear=function(a,b){if(!this.options.get("disabled")){var c=this.$selection.find(".select2-selection__clear");if(0!==c.length){b.stopPropagation();for(var d=c.data("data"),e=0;e0||0===c.length)){var d=a('×');d.data("data",c),this.$selection.find(".select2-selection__rendered").prepend(d)}},c}),b.define("select2/selection/search",["jquery","../utils","../keys"],function(a,b,c){function d(a,b,c){a.call(this,b,c)}return d.prototype.render=function(b){var c=a('');this.$searchContainer=c,this.$search=c.find("input");var d=b.call(this);return this._transferTabIndex(),d},d.prototype.bind=function(a,b,d){var e=this;a.call(this,b,d),b.on("open",function(){e.$search.trigger("focus")}),b.on("close",function(){e.$search.val(""),e.$search.removeAttr("aria-activedescendant"),e.$search.trigger("focus")}),b.on("enable",function(){e.$search.prop("disabled",!1),e._transferTabIndex()}),b.on("disable",function(){e.$search.prop("disabled",!0)}),b.on("focus",function(a){e.$search.trigger("focus")}),b.on("results:focus",function(a){e.$search.attr("aria-activedescendant",a.id)}),this.$selection.on("focusin",".select2-search--inline",function(a){e.trigger("focus",a)}),this.$selection.on("focusout",".select2-search--inline",function(a){e._handleBlur(a)}),this.$selection.on("keydown",".select2-search--inline",function(a){a.stopPropagation(),e.trigger("keypress",a),e._keyUpPrevented=a.isDefaultPrevented();var b=a.which;if(b===c.BACKSPACE&&""===e.$search.val()){var d=e.$searchContainer.prev(".select2-selection__choice");if(d.length>0){var f=d.data("data");e.searchRemoveChoice(f),a.preventDefault()}}});var f=document.documentMode,g=f&&11>=f;this.$selection.on("input.searchcheck",".select2-search--inline",function(a){return g?void e.$selection.off("input.search input.searchcheck"):void e.$selection.off("keyup.search")}),this.$selection.on("keyup.search input.search",".select2-search--inline",function(a){if(g&&"input"===a.type)return void e.$selection.off("input.search input.searchcheck");var b=a.which;b!=c.SHIFT&&b!=c.CTRL&&b!=c.ALT&&b!=c.TAB&&e.handleSearch(a)})},d.prototype._transferTabIndex=function(a){this.$search.attr("tabindex",this.$selection.attr("tabindex")),this.$selection.attr("tabindex","-1")},d.prototype.createPlaceholder=function(a,b){this.$search.attr("placeholder",b.text)},d.prototype.update=function(a,b){var c=this.$search[0]==document.activeElement;this.$search.attr("placeholder",""),a.call(this,b),this.$selection.find(".select2-selection__rendered").append(this.$searchContainer),this.resizeSearch(),c&&this.$search.focus()},d.prototype.handleSearch=function(){if(this.resizeSearch(),!this._keyUpPrevented){var a=this.$search.val();this.trigger("query",{term:a})}this._keyUpPrevented=!1},d.prototype.searchRemoveChoice=function(a,b){this.trigger("unselect",{data:b}),this.$search.val(b.text),this.handleSearch()},d.prototype.resizeSearch=function(){this.$search.css("width","25px");var a="";if(""!==this.$search.attr("placeholder"))a=this.$selection.find(".select2-selection__rendered").innerWidth();else{var b=this.$search.val().length+1;a=.75*b+"em"}this.$search.css("width",a)},d}),b.define("select2/selection/eventRelay",["jquery"],function(a){function b(){}return b.prototype.bind=function(b,c,d){var e=this,f=["open","opening","close","closing","select","selecting","unselect","unselecting"],g=["opening","closing","selecting","unselecting"];b.call(this,c,d),c.on("*",function(b,c){if(-1!==a.inArray(b,f)){c=c||{};var d=a.Event("select2:"+b,{params:c});e.$element.trigger(d),-1!==a.inArray(b,g)&&(c.prevented=d.isDefaultPrevented())}})},b}),b.define("select2/translation",["jquery","require"],function(a,b){function c(a){this.dict=a||{}}return c.prototype.all=function(){return this.dict},c.prototype.get=function(a){return this.dict[a]},c.prototype.extend=function(b){this.dict=a.extend({},b.all(),this.dict)},c._cache={},c.loadPath=function(a){if(!(a in c._cache)){var d=b(a);c._cache[a]=d}return new c(c._cache[a])},c}),b.define("select2/diacritics",[],function(){var a={"Ⓐ":"A","A":"A","À":"A","Á":"A","Â":"A","Ầ":"A","Ấ":"A","Ẫ":"A","Ẩ":"A","Ã":"A","Ā":"A","Ă":"A","Ằ":"A","Ắ":"A","Ẵ":"A","Ẳ":"A","Ȧ":"A","Ç ":"A","Ä":"A","Ǟ":"A","Ả":"A","Å":"A","Ǻ":"A","Ǎ":"A","Ȁ":"A","Ȃ":"A","Ạ":"A","Ậ":"A","Ặ":"A","Ḁ":"A","Ą":"A","Ⱥ":"A","Ɐ":"A","Ꜳ":"AA","Æ":"AE","Ǽ":"AE","Ç¢":"AE","Ꜵ":"AO","Ꜷ":"AU","Ꜹ":"AV","Ꜻ":"AV","Ꜽ":"AY","Ⓑ":"B","ï¼¢":"B","Ḃ":"B","Ḅ":"B","Ḇ":"B","Ƀ":"B","Ƃ":"B","Ɓ":"B","Ⓒ":"C","ï¼£":"C","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","Ç":"C","Ḉ":"C","Ƈ":"C","È»":"C","Ꜿ":"C","Ⓓ":"D","D":"D","Ḋ":"D","Ď":"D","Ḍ":"D","Ḑ":"D","Ḓ":"D","Ḏ":"D","Đ":"D","Ƌ":"D","Ɗ":"D","Ɖ":"D","Ꝺ":"D","DZ":"DZ","DŽ":"DZ","Dz":"Dz","Dž":"Dz","Ⓔ":"E","ï¼¥":"E","È":"E","É":"E","Ê":"E","Ề":"E","Ế":"E","Ễ":"E","Ể":"E","Ẽ":"E","Ē":"E","Ḕ":"E","Ḗ":"E","Ĕ":"E","Ė":"E","Ë":"E","Ẻ":"E","Ě":"E","Ȅ":"E","Ȇ":"E","Ẹ":"E","Ệ":"E","Ȩ":"E","Ḝ":"E","Ę":"E","Ḙ":"E","Ḛ":"E","Ɛ":"E","Ǝ":"E","Ⓕ":"F","F":"F","Ḟ":"F","Ƒ":"F","Ꝼ":"F","Ⓖ":"G","G":"G","Ç´":"G","Ĝ":"G","Ḡ":"G","Ğ":"G","Ä ":"G","Ǧ":"G","Ä¢":"G","Ǥ":"G","Ɠ":"G","Ꞡ":"G","Ᵹ":"G","Ꝿ":"G","Ⓗ":"H","H":"H","Ĥ":"H","Ḣ":"H","Ḧ":"H","Ȟ":"H","Ḥ":"H","Ḩ":"H","Ḫ":"H","Ħ":"H","Ⱨ":"H","â±µ":"H","Ɥ":"H","Ⓘ":"I","I":"I","Ì":"I","Í":"I","Î":"I","Ĩ":"I","Ī":"I","Ĭ":"I","Ä°":"I","Ï":"I","Ḯ":"I","Ỉ":"I","Ǐ":"I","Ȉ":"I","Ȋ":"I","Ị":"I","Ä®":"I","Ḭ":"I","Ɨ":"I","Ⓙ":"J","J":"J","Ä´":"J","Ɉ":"J","Ⓚ":"K","K":"K","Ḱ":"K","Ǩ":"K","Ḳ":"K","Ķ":"K","Ḵ":"K","Ƙ":"K","Ⱪ":"K","Ꝁ":"K","Ꝃ":"K","Ꝅ":"K","Ꞣ":"K","Ⓛ":"L","L":"L","Ä¿":"L","Ĺ":"L","Ľ":"L","Ḷ":"L","Ḹ":"L","Ä»":"L","Ḽ":"L","Ḻ":"L","Ł":"L","Ƚ":"L","â±¢":"L","â± ":"L","Ꝉ":"L","Ꝇ":"L","Ꞁ":"L","LJ":"LJ","Lj":"Lj","Ⓜ":"M","ï¼­":"M","Ḿ":"M","Ṁ":"M","Ṃ":"M","â±®":"M","Ɯ":"M","Ⓝ":"N","ï¼®":"N","Ǹ":"N","Ń":"N","Ñ":"N","Ṅ":"N","Ň":"N","Ṇ":"N","Ņ":"N","Ṋ":"N","Ṉ":"N","È ":"N","Ɲ":"N","Ꞑ":"N","Ꞥ":"N","NJ":"NJ","Nj":"Nj","Ⓞ":"O","O":"O","Ò":"O","Ó":"O","Ô":"O","Ồ":"O","Ố":"O","Ỗ":"O","Ổ":"O","Õ":"O","Ṍ":"O","Ȭ":"O","Ṏ":"O","Ō":"O","Ṑ":"O","Ṓ":"O","Ŏ":"O","È®":"O","È°":"O","Ö":"O","Ȫ":"O","Ỏ":"O","Ő":"O","Ǒ":"O","Ȍ":"O","Ȏ":"O","Æ ":"O","Ờ":"O","Ớ":"O","á» ":"O","Ở":"O","Ợ":"O","Ọ":"O","Ộ":"O","Ǫ":"O","Ǭ":"O","Ø":"O","Ǿ":"O","Ɔ":"O","Ɵ":"O","Ꝋ":"O","Ꝍ":"O","Æ¢":"OI","Ꝏ":"OO","È¢":"OU","Ⓟ":"P","ï¼°":"P","Ṕ":"P","Ṗ":"P","Ƥ":"P","â±£":"P","Ꝑ":"P","Ꝓ":"P","Ꝕ":"P","Ⓠ":"Q","ï¼±":"Q","Ꝗ":"Q","Ꝙ":"Q","Ɋ":"Q","Ⓡ":"R","ï¼²":"R","Ŕ":"R","Ṙ":"R","Ř":"R","Ȑ":"R","Ȓ":"R","Ṛ":"R","Ṝ":"R","Ŗ":"R","Ṟ":"R","Ɍ":"R","Ɽ":"R","Ꝛ":"R","Ꞧ":"R","Ꞃ":"R","Ⓢ":"S","ï¼³":"S","ẞ":"S","Ś":"S","Ṥ":"S","Ŝ":"S","á¹ ":"S","Å ":"S","Ṧ":"S","á¹¢":"S","Ṩ":"S","Ș":"S","Ş":"S","â±¾":"S","Ꞩ":"S","Ꞅ":"S","Ⓣ":"T","ï¼´":"T","Ṫ":"T","Ť":"T","Ṭ":"T","Ț":"T","Å¢":"T","á¹°":"T","á¹®":"T","Ŧ":"T","Ƭ":"T","Æ®":"T","Ⱦ":"T","Ꞇ":"T","Ꜩ":"TZ","Ⓤ":"U","ï¼µ":"U","Ù":"U","Ú":"U","Û":"U","Ũ":"U","Ṹ":"U","Ū":"U","Ṻ":"U","Ŭ":"U","Ü":"U","Ǜ":"U","Ǘ":"U","Ǖ":"U","Ǚ":"U","Ủ":"U","Å®":"U","Å°":"U","Ǔ":"U","Ȕ":"U","Ȗ":"U","Ư":"U","Ừ":"U","Ứ":"U","á»®":"U","Ử":"U","á»°":"U","Ụ":"U","á¹²":"U","Ų":"U","Ṷ":"U","á¹´":"U","Ʉ":"U","Ⓥ":"V","V":"V","á¹¼":"V","á¹¾":"V","Ʋ":"V","Ꝟ":"V","Ʌ":"V","Ꝡ":"VY","Ⓦ":"W","ï¼·":"W","Ẁ":"W","Ẃ":"W","Å´":"W","Ẇ":"W","Ẅ":"W","Ẉ":"W","â±²":"W","Ⓧ":"X","X":"X","Ẋ":"X","Ẍ":"X","Ⓨ":"Y","ï¼¹":"Y","Ỳ":"Y","Ý":"Y","Ŷ":"Y","Ỹ":"Y","Ȳ":"Y","Ẏ":"Y","Ÿ":"Y","Ỷ":"Y","á»´":"Y","Ƴ":"Y","Ɏ":"Y","Ỿ":"Y","Ⓩ":"Z","Z":"Z","Ź":"Z","Ẑ":"Z","Å»":"Z","Ž":"Z","Ẓ":"Z","Ẕ":"Z","Ƶ":"Z","Ȥ":"Z","Ɀ":"Z","Ⱬ":"Z","Ꝣ":"Z","ⓐ":"a","a":"a","ẚ":"a","à":"a","á":"a","â":"a","ầ":"a","ấ":"a","ẫ":"a","ẩ":"a","ã":"a","ā":"a","ă":"a","ằ":"a","ắ":"a","ẵ":"a","ẳ":"a","ȧ":"a","Ç¡":"a","ä":"a","ǟ":"a","ả":"a","Ã¥":"a","Ç»":"a","ǎ":"a","ȁ":"a","ȃ":"a","ạ":"a","ậ":"a","ặ":"a","ḁ":"a","ą":"a","â±¥":"a","ɐ":"a","ꜳ":"aa","æ":"ae","ǽ":"ae","Ç£":"ae","ꜵ":"ao","ꜷ":"au","ꜹ":"av","ꜻ":"av","ꜽ":"ay","ⓑ":"b","b":"b","ḃ":"b","ḅ":"b","ḇ":"b","ƀ":"b","ƃ":"b","ɓ":"b","ⓒ":"c","c":"c","ć":"c","ĉ":"c","ċ":"c","č":"c","ç":"c","ḉ":"c","ƈ":"c","ȼ":"c","ꜿ":"c","ↄ":"c","ⓓ":"d","d":"d","ḋ":"d","ď":"d","ḍ":"d","ḑ":"d","ḓ":"d","ḏ":"d","đ":"d","ƌ":"d","ɖ":"d","ɗ":"d","ꝺ":"d","dz":"dz","dž":"dz","ⓔ":"e","e":"e","è":"e","é":"e","ê":"e","ề":"e","ế":"e","ễ":"e","ể":"e","ẽ":"e","ē":"e","ḕ":"e","ḗ":"e","ĕ":"e","ė":"e","ë":"e","ẻ":"e","ě":"e","ȅ":"e","ȇ":"e","ẹ":"e","ệ":"e","È©":"e","ḝ":"e","ę":"e","ḙ":"e","ḛ":"e","ɇ":"e","ɛ":"e","ǝ":"e","ⓕ":"f","f":"f","ḟ":"f","ƒ":"f","ꝼ":"f","ⓖ":"g","g":"g","ǵ":"g","ĝ":"g","ḡ":"g","ğ":"g","Ä¡":"g","ǧ":"g","Ä£":"g","Ç¥":"g","É ":"g","ꞡ":"g","áµ¹":"g","ꝿ":"g","ⓗ":"h","h":"h","Ä¥":"h","ḣ":"h","ḧ":"h","ȟ":"h","ḥ":"h","ḩ":"h","ḫ":"h","ẖ":"h","ħ":"h","ⱨ":"h","ⱶ":"h","É¥":"h","ƕ":"hv","ⓘ":"i","i":"i","ì":"i","í":"i","î":"i","Ä©":"i","Ä«":"i","Ä­":"i","ï":"i","ḯ":"i","ỉ":"i","ǐ":"i","ȉ":"i","ȋ":"i","ị":"i","į":"i","ḭ":"i","ɨ":"i","ı":"i","ⓙ":"j","j":"j","ĵ":"j","Ç°":"j","ɉ":"j","ⓚ":"k","k":"k","ḱ":"k","Ç©":"k","ḳ":"k","Ä·":"k","ḵ":"k","ƙ":"k","ⱪ":"k","ꝁ":"k","ꝃ":"k","ꝅ":"k","ꞣ":"k","ⓛ":"l","l":"l","ŀ":"l","ĺ":"l","ľ":"l","ḷ":"l","ḹ":"l","ļ":"l","ḽ":"l","ḻ":"l","Å¿":"l","ł":"l","ƚ":"l","É«":"l","ⱡ":"l","ꝉ":"l","ꞁ":"l","ꝇ":"l","lj":"lj","ⓜ":"m","m":"m","ḿ":"m","ṁ":"m","ṃ":"m","ɱ":"m","ɯ":"m","ⓝ":"n","n":"n","ǹ":"n","ń":"n","ñ":"n","ṅ":"n","ň":"n","ṇ":"n","ņ":"n","ṋ":"n","ṉ":"n","ƞ":"n","ɲ":"n","ʼn":"n","ꞑ":"n","ꞥ":"n","nj":"nj","ⓞ":"o","o":"o","ò":"o","ó":"o","ô":"o","ồ":"o","ố":"o","ỗ":"o","ổ":"o","õ":"o","ṍ":"o","È­":"o","ṏ":"o","ō":"o","ṑ":"o","ṓ":"o","ŏ":"o","ȯ":"o","ȱ":"o","ö":"o","È«":"o","ỏ":"o","ő":"o","ǒ":"o","ȍ":"o","ȏ":"o","Æ¡":"o","ờ":"o","ớ":"o","ỡ":"o","ở":"o","ợ":"o","ọ":"o","ộ":"o","Ç«":"o","Ç­":"o","ø":"o","Ç¿":"o","ɔ":"o","ꝋ":"o","ꝍ":"o","ɵ":"o","Æ£":"oi","È£":"ou","ꝏ":"oo","ⓟ":"p","p":"p","ṕ":"p","ṗ":"p","Æ¥":"p","áµ½":"p","ꝑ":"p","ꝓ":"p","ꝕ":"p","ⓠ":"q","q":"q","ɋ":"q","ꝗ":"q","ꝙ":"q","ⓡ":"r","r":"r","ŕ":"r","ṙ":"r","ř":"r","ȑ":"r","ȓ":"r","ṛ":"r","ṝ":"r","ŗ":"r","ṟ":"r","ɍ":"r","ɽ":"r","ꝛ":"r","ꞧ":"r","ꞃ":"r","ⓢ":"s","s":"s","ß":"s","ś":"s","á¹¥":"s","ŝ":"s","ṡ":"s","Å¡":"s","ṧ":"s","á¹£":"s","ṩ":"s","ș":"s","ş":"s","È¿":"s","ꞩ":"s","ꞅ":"s","ẛ":"s","ⓣ":"t","t":"t","ṫ":"t","ẗ":"t","Å¥":"t","á¹­":"t","ț":"t","Å£":"t","á¹±":"t","ṯ":"t","ŧ":"t","Æ­":"t","ʈ":"t","ⱦ":"t","ꞇ":"t","ꜩ":"tz","ⓤ":"u","u":"u","ù":"u","ú":"u","û":"u","Å©":"u","á¹¹":"u","Å«":"u","á¹»":"u","Å­":"u","ü":"u","ǜ":"u","ǘ":"u","ǖ":"u","ǚ":"u","ủ":"u","ů":"u","ű":"u","ǔ":"u","ȕ":"u","ȗ":"u","Æ°":"u","ừ":"u","ứ":"u","ữ":"u","á»­":"u","á»±":"u","ụ":"u","á¹³":"u","ų":"u","á¹·":"u","á¹µ":"u","ʉ":"u","ⓥ":"v","v":"v","á¹½":"v","ṿ":"v","ʋ":"v","ꝟ":"v","ʌ":"v","ꝡ":"vy","ⓦ":"w","w":"w","ẁ":"w","ẃ":"w","ŵ":"w","ẇ":"w","ẅ":"w","ẘ":"w","ẉ":"w","â±³":"w","ⓧ":"x","x":"x","ẋ":"x","ẍ":"x","ⓨ":"y","y":"y","ỳ":"y","ý":"y","Å·":"y","ỹ":"y","ȳ":"y","ẏ":"y","ÿ":"y","á»·":"y","ẙ":"y","ỵ":"y","Æ´":"y","ɏ":"y","ỿ":"y","ⓩ":"z","z":"z","ź":"z","ẑ":"z","ż":"z","ž":"z","ẓ":"z","ẕ":"z","ƶ":"z","È¥":"z","ɀ":"z","ⱬ":"z","ꝣ":"z","Ά":"Α","Έ":"Ε","Ή":"Η","Ί":"Ι","Ϊ":"Ι","Ό":"Ο","Ύ":"Î¥","Ϋ":"Î¥","Ώ":"Ω","ά":"α","έ":"ε","ή":"η","ί":"ι","ϊ":"ι","ΐ":"ι","ό":"ο","ύ":"υ","ϋ":"υ","ΰ":"υ","ω":"ω","ς":"σ"};return a}),b.define("select2/data/base",["../utils"],function(a){function b(a,c){b.__super__.constructor.call(this)}return a.Extend(b,a.Observable),b.prototype.current=function(a){throw new Error("The `current` method must be defined in child classes.")},b.prototype.query=function(a,b){throw new Error("The `query` method must be defined in child classes.")},b.prototype.bind=function(a,b){},b.prototype.destroy=function(){},b.prototype.generateResultId=function(b,c){var d=b.id+"-result-";return d+=a.generateChars(4),d+=null!=c.id?"-"+c.id.toString():"-"+a.generateChars(4)},b}),b.define("select2/data/select",["./base","../utils","jquery"],function(a,b,c){function d(a,b){this.$element=a,this.options=b,d.__super__.constructor.call(this)}return b.Extend(d,a),d.prototype.current=function(a){var b=[],d=this;this.$element.find(":selected").each(function(){var a=c(this),e=d.item(a);b.push(e)}),a(b)},d.prototype.select=function(a){var b=this;if(a.selected=!0,c(a.element).is("option"))return a.element.selected=!0,void this.$element.trigger("change");if(this.$element.prop("multiple"))this.current(function(d){var e=[];a=[a],a.push.apply(a,d);for(var f=0;f=0){var k=f.filter(d(j)),l=this.item(k),m=c.extend(!0,{},l,j),n=this.option(m);k.replaceWith(n)}else{var o=this.option(j);if(j.children){var p=this.convertToOptions(j.children);b.appendMany(o,p)}h.push(o)}}return h},d}),b.define("select2/data/ajax",["./array","../utils","jquery"],function(a,b,c){function d(a,b){this.ajaxOptions=this._applyDefaults(b.get("ajax")),null!=this.ajaxOptions.processResults&&(this.processResults=this.ajaxOptions.processResults),d.__super__.constructor.call(this,a,b)}return b.Extend(d,a),d.prototype._applyDefaults=function(a){var b={data:function(a){return c.extend({},a,{q:a.term})},transport:function(a,b,d){var e=c.ajax(a);return e.then(b),e.fail(d),e}};return c.extend({},b,a,!0)},d.prototype.processResults=function(a){return a},d.prototype.query=function(a,b){function d(){var d=f.transport(f,function(d){var f=e.processResults(d,a);e.options.get("debug")&&window.console&&console.error&&(f&&f.results&&c.isArray(f.results)||console.error("Select2: The AJAX results did not return an array in the `results` key of the response.")),b(f)},function(){});e._request=d}var e=this;null!=this._request&&(c.isFunction(this._request.abort)&&this._request.abort(),this._request=null);var f=c.extend({type:"GET"},this.ajaxOptions);"function"==typeof f.url&&(f.url=f.url.call(this.$element,a)),"function"==typeof f.data&&(f.data=f.data.call(this.$element,a)),this.ajaxOptions.delay&&""!==a.term?(this._queryTimeout&&window.clearTimeout(this._queryTimeout),this._queryTimeout=window.setTimeout(d,this.ajaxOptions.delay)):d()},d}),b.define("select2/data/tags",["jquery"],function(a){function b(b,c,d){var e=d.get("tags"),f=d.get("createTag");if(void 0!==f&&(this.createTag=f),b.call(this,c,d),a.isArray(e))for(var g=0;g0&&b.term.length>this.maximumInputLength?void this.trigger("results:message",{message:"inputTooLong",args:{maximum:this.maximumInputLength,input:b.term,params:b}}):void a.call(this,b,c)},a}),b.define("select2/data/maximumSelectionLength",[],function(){function a(a,b,c){this.maximumSelectionLength=c.get("maximumSelectionLength"),a.call(this,b,c)}return a.prototype.query=function(a,b,c){var d=this;this.current(function(e){var f=null!=e?e.length:0;return d.maximumSelectionLength>0&&f>=d.maximumSelectionLength?void d.trigger("results:message",{message:"maximumSelected",args:{maximum:d.maximumSelectionLength}}):void a.call(d,b,c)})},a}),b.define("select2/dropdown",["jquery","./utils"],function(a,b){function c(a,b){this.$element=a,this.options=b,c.__super__.constructor.call(this)}return b.Extend(c,b.Observable),c.prototype.render=function(){var b=a('');return b.attr("dir",this.options.get("dir")),this.$dropdown=b,b},c.prototype.bind=function(){},c.prototype.position=function(a,b){},c.prototype.destroy=function(){this.$dropdown.remove()},c}),b.define("select2/dropdown/search",["jquery","../utils"],function(a,b){function c(){}return c.prototype.render=function(b){var c=b.call(this),d=a('');return this.$searchContainer=d,this.$search=d.find("input"),c.prepend(d),c},c.prototype.bind=function(b,c,d){var e=this;b.call(this,c,d),this.$search.on("keydown",function(a){e.trigger("keypress",a),e._keyUpPrevented=a.isDefaultPrevented()}),this.$search.on("input",function(b){a(this).off("keyup")}),this.$search.on("keyup input",function(a){e.handleSearch(a)}),c.on("open",function(){e.$search.attr("tabindex",0),e.$search.focus(),window.setTimeout(function(){e.$search.focus()},0)}),c.on("close",function(){e.$search.attr("tabindex",-1),e.$search.val("")}),c.on("results:all",function(a){if(null==a.query.term||""===a.query.term){var b=e.showSearch(a);b?e.$searchContainer.removeClass("select2-search--hide"):e.$searchContainer.addClass("select2-search--hide")}})},c.prototype.handleSearch=function(a){if(!this._keyUpPrevented){var b=this.$search.val();this.trigger("query",{term:b})}this._keyUpPrevented=!1},c.prototype.showSearch=function(a,b){return!0},c}),b.define("select2/dropdown/hidePlaceholder",[],function(){function a(a,b,c,d){this.placeholder=this.normalizePlaceholder(c.get("placeholder")),a.call(this,b,c,d)}return a.prototype.append=function(a,b){b.results=this.removePlaceholder(b.results),a.call(this,b)},a.prototype.normalizePlaceholder=function(a,b){return"string"==typeof b&&(b={id:"",text:b}),b},a.prototype.removePlaceholder=function(a,b){for(var c=b.slice(0),d=b.length-1;d>=0;d--){var e=b[d];this.placeholder.id===e.id&&c.splice(d,1)}return c},a}),b.define("select2/dropdown/infiniteScroll",["jquery"],function(a){function b(a,b,c,d){this.lastParams={},a.call(this,b,c,d),this.$loadingMore=this.createLoadingMore(),this.loading=!1}return b.prototype.append=function(a,b){this.$loadingMore.remove(),this.loading=!1,a.call(this,b),this.showLoadingMore(b)&&this.$results.append(this.$loadingMore)},b.prototype.bind=function(b,c,d){var e=this;b.call(this,c,d),c.on("query",function(a){e.lastParams=a,e.loading=!0}),c.on("query:append",function(a){e.lastParams=a,e.loading=!0}),this.$results.on("scroll",function(){var b=a.contains(document.documentElement,e.$loadingMore[0]);if(!e.loading&&b){var c=e.$results.offset().top+e.$results.outerHeight(!1),d=e.$loadingMore.offset().top+e.$loadingMore.outerHeight(!1);c+50>=d&&e.loadMore()}})},b.prototype.loadMore=function(){this.loading=!0;var b=a.extend({},{page:1},this.lastParams);b.page++,this.trigger("query:append",b)},b.prototype.showLoadingMore=function(a,b){return b.pagination&&b.pagination.more},b.prototype.createLoadingMore=function(){var b=a('
      • '),c=this.options.get("translations").get("loadingMore");return b.html(c(this.lastParams)),b},b}),b.define("select2/dropdown/attachBody",["jquery","../utils"],function(a,b){function c(b,c,d){this.$dropdownParent=d.get("dropdownParent")||a(document.body),b.call(this,c,d)}return c.prototype.bind=function(a,b,c){var d=this,e=!1;a.call(this,b,c),b.on("open",function(){d._showDropdown(),d._attachPositioningHandler(b),e||(e=!0,b.on("results:all",function(){d._positionDropdown(),d._resizeDropdown()}),b.on("results:append",function(){d._positionDropdown(),d._resizeDropdown()}))}),b.on("close",function(){d._hideDropdown(),d._detachPositioningHandler(b)}),this.$dropdownContainer.on("mousedown",function(a){a.stopPropagation()})},c.prototype.destroy=function(a){a.call(this),this.$dropdownContainer.remove()},c.prototype.position=function(a,b,c){b.attr("class",c.attr("class")),b.removeClass("select2"),b.addClass("select2-container--open"),b.css({position:"absolute",top:-999999}),this.$container=c},c.prototype.render=function(b){var c=a(""),d=b.call(this);return c.append(d),this.$dropdownContainer=c,c},c.prototype._hideDropdown=function(a){this.$dropdownContainer.detach()},c.prototype._attachPositioningHandler=function(c,d){var e=this,f="scroll.select2."+d.id,g="resize.select2."+d.id,h="orientationchange.select2."+d.id,i=this.$container.parents().filter(b.hasScroll);i.each(function(){a(this).data("select2-scroll-position",{x:a(this).scrollLeft(),y:a(this).scrollTop()})}),i.on(f,function(b){var c=a(this).data("select2-scroll-position");a(this).scrollTop(c.y)}),a(window).on(f+" "+g+" "+h,function(a){e._positionDropdown(),e._resizeDropdown()})},c.prototype._detachPositioningHandler=function(c,d){var e="scroll.select2."+d.id,f="resize.select2."+d.id,g="orientationchange.select2."+d.id,h=this.$container.parents().filter(b.hasScroll);h.off(e),a(window).off(e+" "+f+" "+g)},c.prototype._positionDropdown=function(){var b=a(window),c=this.$dropdown.hasClass("select2-dropdown--above"),d=this.$dropdown.hasClass("select2-dropdown--below"),e=null,f=(this.$container.position(),this.$container.offset());f.bottom=f.top+this.$container.outerHeight(!1);var g={height:this.$container.outerHeight(!1)};g.top=f.top,g.bottom=f.top+g.height;var h={height:this.$dropdown.outerHeight(!1)},i={top:b.scrollTop(),bottom:b.scrollTop()+b.height()},j=i.topf.bottom+h.height,l={left:f.left,top:g.bottom};if("static"!==this.$dropdownParent[0].style.position){var m=this.$dropdownParent.offset();l.top-=m.top,l.left-=m.left}c||d||(e="below"),k||!j||c?!j&&k&&c&&(e="below"):e="above",("above"==e||c&&"below"!==e)&&(l.top=g.top-h.height),null!=e&&(this.$dropdown.removeClass("select2-dropdown--below select2-dropdown--above").addClass("select2-dropdown--"+e),this.$container.removeClass("select2-container--below select2-container--above").addClass("select2-container--"+e)),this.$dropdownContainer.css(l)},c.prototype._resizeDropdown=function(){var a={width:this.$container.outerWidth(!1)+"px"};this.options.get("dropdownAutoWidth")&&(a.minWidth=a.width,a.width="auto"),this.$dropdown.css(a)},c.prototype._showDropdown=function(a){this.$dropdownContainer.appendTo(this.$dropdownParent),this._positionDropdown(),this._resizeDropdown()},c}),b.define("select2/dropdown/minimumResultsForSearch",[],function(){function a(b){for(var c=0,d=0;d0&&(l.dataAdapter=j.Decorate(l.dataAdapter,r)),l.maximumInputLength>0&&(l.dataAdapter=j.Decorate(l.dataAdapter,s)),l.maximumSelectionLength>0&&(l.dataAdapter=j.Decorate(l.dataAdapter,t)),l.tags&&(l.dataAdapter=j.Decorate(l.dataAdapter,p)),(null!=l.tokenSeparators||null!=l.tokenizer)&&(l.dataAdapter=j.Decorate(l.dataAdapter,q)),null!=l.query){var C=b(l.amdBase+"compat/query");l.dataAdapter=j.Decorate(l.dataAdapter,C)}if(null!=l.initSelection){var D=b(l.amdBase+"compat/initSelection");l.dataAdapter=j.Decorate(l.dataAdapter,D)}}if(null==l.resultsAdapter&&(l.resultsAdapter=c,null!=l.ajax&&(l.resultsAdapter=j.Decorate(l.resultsAdapter,x)),null!=l.placeholder&&(l.resultsAdapter=j.Decorate(l.resultsAdapter,w)),l.selectOnClose&&(l.resultsAdapter=j.Decorate(l.resultsAdapter,A))),null==l.dropdownAdapter){if(l.multiple)l.dropdownAdapter=u;else{var E=j.Decorate(u,v);l.dropdownAdapter=E}if(0!==l.minimumResultsForSearch&&(l.dropdownAdapter=j.Decorate(l.dropdownAdapter,z)),l.closeOnSelect&&(l.dropdownAdapter=j.Decorate(l.dropdownAdapter,B)),null!=l.dropdownCssClass||null!=l.dropdownCss||null!=l.adaptDropdownCssClass){var F=b(l.amdBase+"compat/dropdownCss");l.dropdownAdapter=j.Decorate(l.dropdownAdapter,F)}l.dropdownAdapter=j.Decorate(l.dropdownAdapter,y)}if(null==l.selectionAdapter){if(l.multiple?l.selectionAdapter=e:l.selectionAdapter=d,null!=l.placeholder&&(l.selectionAdapter=j.Decorate(l.selectionAdapter,f)),l.allowClear&&(l.selectionAdapter=j.Decorate(l.selectionAdapter,g)),l.multiple&&(l.selectionAdapter=j.Decorate(l.selectionAdapter,h)),null!=l.containerCssClass||null!=l.containerCss||null!=l.adaptContainerCssClass){var G=b(l.amdBase+"compat/containerCss");l.selectionAdapter=j.Decorate(l.selectionAdapter,G)}l.selectionAdapter=j.Decorate(l.selectionAdapter,i)}if("string"==typeof l.language)if(l.language.indexOf("-")>0){var H=l.language.split("-"),I=H[0];l.language=[l.language,I]}else l.language=[l.language];if(a.isArray(l.language)){var J=new k;l.language.push("en");for(var K=l.language,L=0;L0){for(var f=a.extend(!0,{},e),g=e.children.length-1;g>=0;g--){var h=e.children[g],i=c(d,h);null==i&&f.children.splice(g,1)}return f.children.length>0?f:c(d,f)}var j=b(e.text).toUpperCase(),k=b(d.term).toUpperCase();return j.indexOf(k)>-1?e:null}this.defaults={amdBase:"./",amdLanguageBase:"./i18n/",closeOnSelect:!0,debug:!1,dropdownAutoWidth:!1,escapeMarkup:j.escapeMarkup,language:C,matcher:c,minimumInputLength:0,maximumInputLength:0,maximumSelectionLength:0,minimumResultsForSearch:0,selectOnClose:!1,sorter:function(a){return a},templateResult:function(a){return a.text},templateSelection:function(a){return a.text},theme:"default",width:"resolve"}},D.prototype.set=function(b,c){var d=a.camelCase(b),e={};e[d]=c;var f=j._convertData(e);a.extend(this.defaults,f)};var E=new D;return E}),b.define("select2/options",["require","jquery","./defaults","./utils"],function(a,b,c,d){function e(b,e){if(this.options=b,null!=e&&this.fromElement(e),this.options=c.apply(this.options),e&&e.is("input")){var f=a(this.get("amdBase")+"compat/inputData");this.options.dataAdapter=d.Decorate(this.options.dataAdapter,f)}}return e.prototype.fromElement=function(a){var c=["select2"];null==this.options.multiple&&(this.options.multiple=a.prop("multiple")),null==this.options.disabled&&(this.options.disabled=a.prop("disabled")),null==this.options.language&&(a.prop("lang")?this.options.language=a.prop("lang").toLowerCase():a.closest("[lang]").prop("lang")&&(this.options.language=a.closest("[lang]").prop("lang"))),null==this.options.dir&&(a.prop("dir")?this.options.dir=a.prop("dir"):a.closest("[dir]").prop("dir")?this.options.dir=a.closest("[dir]").prop("dir"):this.options.dir="ltr"),a.prop("disabled",this.options.disabled),a.prop("multiple",this.options.multiple),a.data("select2Tags")&&(this.options.debug&&window.console&&console.warn&&console.warn('Select2: The `data-select2-tags` attribute has been changed to use the `data-data` and `data-tags="true"` attributes and will be removed in future versions of Select2.'),a.data("data",a.data("select2Tags")),a.data("tags",!0)),a.data("ajaxUrl")&&(this.options.debug&&window.console&&console.warn&&console.warn("Select2: The `data-ajax-url` attribute has been changed to `data-ajax--url` and support for the old attribute will be removed in future versions of Select2."),a.attr("ajax--url",a.data("ajaxUrl")),a.data("ajax--url",a.data("ajaxUrl")));var e={};e=b.fn.jquery&&"1."==b.fn.jquery.substr(0,2)&&a[0].dataset?b.extend(!0,{},a[0].dataset,a.data()):a.data();var f=b.extend(!0,{},e);f=d._convertData(f);for(var g in f)b.inArray(g,c)>-1||(b.isPlainObject(this.options[g])?b.extend(this.options[g],f[g]):this.options[g]=f[g]);return this},e.prototype.get=function(a){return this.options[a]},e.prototype.set=function(a,b){this.options[a]=b},e}),b.define("select2/core",["jquery","./options","./utils","./keys"],function(a,b,c,d){var e=function(a,c){null!=a.data("select2")&&a.data("select2").destroy(),this.$element=a,this.id=this._generateId(a),c=c||{},this.options=new b(c,a),e.__super__.constructor.call(this);var d=a.attr("tabindex")||0;a.data("old-tabindex",d),a.attr("tabindex","-1");var f=this.options.get("dataAdapter");this.dataAdapter=new f(a,this.options);var g=this.render();this._placeContainer(g);var h=this.options.get("selectionAdapter");this.selection=new h(a,this.options),this.$selection=this.selection.render(),this.selection.position(this.$selection,g);var i=this.options.get("dropdownAdapter");this.dropdown=new i(a,this.options),this.$dropdown=this.dropdown.render(),this.dropdown.position(this.$dropdown,g);var j=this.options.get("resultsAdapter");this.results=new j(a,this.options,this.dataAdapter),this.$results=this.results.render(),this.results.position(this.$results,this.$dropdown);var k=this;this._bindAdapters(),this._registerDomEvents(),this._registerDataEvents(),this._registerSelectionEvents(),this._registerDropdownEvents(),this._registerResultsEvents(),this._registerEvents(),this.dataAdapter.current(function(a){k.trigger("selection:update",{data:a})}),a.addClass("select2-hidden-accessible"),a.attr("aria-hidden","true"),this._syncAttributes(),a.data("select2",this)};return c.Extend(e,c.Observable),e.prototype._generateId=function(a){var b="";return b=null!=a.attr("id")?a.attr("id"):null!=a.attr("name")?a.attr("name")+"-"+c.generateChars(2):c.generateChars(4),b="select2-"+b},e.prototype._placeContainer=function(a){a.insertAfter(this.$element);var b=this._resolveWidth(this.$element,this.options.get("width"));null!=b&&a.css("width",b)},e.prototype._resolveWidth=function(a,b){var c=/^width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i;if("resolve"==b){var d=this._resolveWidth(a,"style");return null!=d?d:this._resolveWidth(a,"element")}if("element"==b){var e=a.outerWidth(!1);return 0>=e?"auto":e+"px"}if("style"==b){var f=a.attr("style");if("string"!=typeof f)return null;for(var g=f.split(";"),h=0,i=g.length;i>h;h+=1){var j=g[h].replace(/\s/g,""),k=j.match(c);if(null!==k&&k.length>=1)return k[1]}return null}return b},e.prototype._bindAdapters=function(){this.dataAdapter.bind(this,this.$container),this.selection.bind(this,this.$container),this.dropdown.bind(this,this.$container),this.results.bind(this,this.$container)},e.prototype._registerDomEvents=function(){var b=this;this.$element.on("change.select2",function(){b.dataAdapter.current(function(a){b.trigger("selection:update",{data:a})})}),this._sync=c.bind(this._syncAttributes,this),this.$element[0].attachEvent&&this.$element[0].attachEvent("onpropertychange",this._sync);var d=window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver;null!=d?(this._observer=new d(function(c){a.each(c,b._sync)}),this._observer.observe(this.$element[0],{attributes:!0,subtree:!1})):this.$element[0].addEventListener&&this.$element[0].addEventListener("DOMAttrModified",b._sync,!1)},e.prototype._registerDataEvents=function(){var a=this;this.dataAdapter.on("*",function(b,c){a.trigger(b,c)})},e.prototype._registerSelectionEvents=function(){var b=this,c=["toggle","focus"];this.selection.on("toggle",function(){b.toggleDropdown()}),this.selection.on("focus",function(a){b.focus(a)}),this.selection.on("*",function(d,e){-1===a.inArray(d,c)&&b.trigger(d,e)})},e.prototype._registerDropdownEvents=function(){var a=this;this.dropdown.on("*",function(b,c){a.trigger(b,c)})},e.prototype._registerResultsEvents=function(){var a=this;this.results.on("*",function(b,c){a.trigger(b,c)})},e.prototype._registerEvents=function(){var a=this;this.on("open",function(){a.$container.addClass("select2-container--open")}),this.on("close",function(){a.$container.removeClass("select2-container--open")}),this.on("enable",function(){a.$container.removeClass("select2-container--disabled")}),this.on("disable",function(){a.$container.addClass("select2-container--disabled")}),this.on("blur",function(){a.$container.removeClass("select2-container--focus")}),this.on("query",function(b){a.isOpen()||a.trigger("open",{}),this.dataAdapter.query(b,function(c){a.trigger("results:all",{data:c,query:b})})}),this.on("query:append",function(b){this.dataAdapter.query(b,function(c){a.trigger("results:append",{data:c,query:b})})}),this.on("keypress",function(b){var c=b.which;a.isOpen()?c===d.ESC||c===d.TAB||c===d.UP&&b.altKey?(a.close(),b.preventDefault()):c===d.ENTER?(a.trigger("results:select",{}),b.preventDefault()):c===d.SPACE&&b.ctrlKey?(a.trigger("results:toggle",{}),b.preventDefault()):c===d.UP?(a.trigger("results:previous",{}),b.preventDefault()):c===d.DOWN&&(a.trigger("results:next",{}),b.preventDefault()):(c===d.ENTER||c===d.SPACE||c===d.DOWN&&b.altKey)&&(a.open(),b.preventDefault())})},e.prototype._syncAttributes=function(){this.options.set("disabled",this.$element.prop("disabled")),this.options.get("disabled")?(this.isOpen()&&this.close(),this.trigger("disable",{})):this.trigger("enable",{})},e.prototype.trigger=function(a,b){var c=e.__super__.trigger,d={open:"opening",close:"closing",select:"selecting",unselect:"unselecting"};if(void 0===b&&(b={}),a in d){var f=d[a],g={prevented:!1,name:a,args:b};if(c.call(this,f,g),g.prevented)return void(b.prevented=!0)}c.call(this,a,b)},e.prototype.toggleDropdown=function(){this.options.get("disabled")||(this.isOpen()?this.close():this.open())},e.prototype.open=function(){this.isOpen()||this.trigger("query",{})},e.prototype.close=function(){this.isOpen()&&this.trigger("close",{})},e.prototype.isOpen=function(){return this.$container.hasClass("select2-container--open")},e.prototype.hasFocus=function(){return this.$container.hasClass("select2-container--focus")},e.prototype.focus=function(a){this.hasFocus()||(this.$container.addClass("select2-container--focus"),this.trigger("focus",{}))},e.prototype.enable=function(a){this.options.get("debug")&&window.console&&console.warn&&console.warn('Select2: The `select2("enable")` method has been deprecated and will be removed in later Select2 versions. Use $element.prop("disabled") instead.'),(null==a||0===a.length)&&(a=[!0]);var b=!a[0];this.$element.prop("disabled",b)},e.prototype.data=function(){this.options.get("debug")&&arguments.length>0&&window.console&&console.warn&&console.warn('Select2: Data can no longer be set using `select2("data")`. You should consider setting the value instead using `$element.val()`.');var a=[];return this.dataAdapter.current(function(b){a=b}),a},e.prototype.val=function(b){if(this.options.get("debug")&&window.console&&console.warn&&console.warn('Select2: The `select2("val")` method has been deprecated and will be removed in later Select2 versions. Use $element.val() instead.'),null==b||0===b.length)return this.$element.val();var c=b[0];a.isArray(c)&&(c=a.map(c,function(a){return a.toString()})),this.$element.val(c).trigger("change")},e.prototype.destroy=function(){this.$container.remove(),this.$element[0].detachEvent&&this.$element[0].detachEvent("onpropertychange",this._sync),null!=this._observer?(this._observer.disconnect(),this._observer=null):this.$element[0].removeEventListener&&this.$element[0].removeEventListener("DOMAttrModified",this._sync,!1),this._sync=null,this.$element.off(".select2"),this.$element.attr("tabindex",this.$element.data("old-tabindex")),this.$element.removeClass("select2-hidden-accessible"),this.$element.attr("aria-hidden","false"),this.$element.removeData("select2"),this.dataAdapter.destroy(),this.selection.destroy(),this.dropdown.destroy(),this.results.destroy(),this.dataAdapter=null,this.selection=null,this.dropdown=null,this.results=null},e.prototype.render=function(){var b=a('');return b.attr("dir",this.options.get("dir")),this.$container=b,this.$container.addClass("select2-container--"+this.options.get("theme")),b.data("element",this.$element),b},e}),b.define("jquery-mousewheel",["jquery"],function(a){return a}),b.define("jquery.select2",["jquery","jquery-mousewheel","./select2/core","./select2/defaults"],function(a,b,c,d){if(null==a.fn.select2){var e=["open","close","destroy"];a.fn.select2=function(b){if(b=b||{},"object"==typeof b)return this.each(function(){var d=a.extend(!0,{},b);new c(a(this),d)}),this;if("string"==typeof b){var d;return this.each(function(){var c=a(this).data("select2");null==c&&window.console&&console.error&&console.error("The select2('"+b+"') method was called on an element that is not using Select2.");var e=Array.prototype.slice.call(arguments,1);d=c[b].apply(c,e)}),a.inArray(b,e)>-1?this:d}throw new Error("Invalid arguments for Select2: "+b)}}return null==a.fn.select2.defaults&&(a.fn.select2.defaults=d),c}),{define:b.define,require:b.require}}(),c=b.require("jquery.select2");return a.fn.select2.amd=b,c}),angular.module("sprintf",[]).filter("sprintf",function(){return function(){return sprintf.apply(null,arguments)}}).filter("fmt",["$filter",function(a){return a("sprintf")}]).filter("vsprintf",function(){return function(a,b){return vsprintf(a,b)}}).filter("vfmt",["$filter",function(a){return a("vsprintf")}]),function(a,b){"function"==typeof define&&define.amd?define(a):"undefined"!=typeof module&&"object"==typeof exports?module.exports=a():b.rangy=a()}(function(){function a(a,b){var c=typeof a[b];return c==u||!(c!=t||!a[b])||"unknown"==c}function b(a,b){return!(typeof a[b]!=t||!a[b])}function c(a,b){return typeof a[b]!=v}function d(a){return function(b,c){for(var d=c.length;d--;)if(!a(b,c[d]))return!1;return!0}}function e(a){return a&&A(a,z)&&C(a,y)}function f(a){return b(a,"body")?a.body:a.getElementsByTagName("body")[0]}function g(b){typeof console!=v&&a(console,"log")&&console.log(b)}function h(a,b){F&&b?alert(a):g(a)}function i(a){H.initialized=!0,H.supported=!1,h("Rangy is not supported in this environment. Reason: "+a,H.config.alertOnFail)}function j(a){h("Rangy warning: "+a,H.config.alertOnWarn)}function k(a){return a.message||a.description||String(a)}function l(){if(F&&!H.initialized){var b,c=!1,d=!1;a(document,"createRange")&&(b=document.createRange(),A(b,x)&&C(b,w)&&(c=!0));var h=f(document);if(!h||"body"!=h.nodeName.toLowerCase())return void i("No body element found");if(h&&a(h,"createTextRange")&&(b=h.createTextRange(),e(b)&&(d=!0)),!c&&!d)return void i("Neither Range nor TextRange are available");H.initialized=!0,H.features={implementsDomRange:c,implementsTextRange:d};var j,l;for(var m in E)(j=E[m])instanceof p&&j.init(j,H);for(var n=0,o=K.length;o>n;++n)try{K[n](H)}catch(q){l="Rangy init listener threw an exception. Continuing. Detail: "+k(q),g(l)}}}function m(a,b,c){c&&(a+=" in module "+c.name),H.warn("DEPRECATED: "+a+" is deprecated. Please use "+b+" instead.")}function n(a,b,c,d){a[b]=function(){return m(b,c,d),a[c].apply(a,G.toArray(arguments))}}function o(a){a=a||window,l();for(var b=0,c=L.length;c>b;++b)L[b](a)}function p(a,b,c){this.name=a,this.dependencies=b,this.initialized=!1,this.supported=!1,this.initializer=c}function q(a,b,c){var d=new p(a,b,function(b){if(!b.initialized){b.initialized=!0;try{c(H,b),b.supported=!0}catch(d){var e="Module '"+a+"' failed to load: "+k(d);g(e),d.stack&&g(d.stack)}}});return E[a]=d,d}function r(){}function s(){}var t="object",u="function",v="undefined",w=["startContainer","startOffset","endContainer","endOffset","collapsed","commonAncestorContainer"],x=["setStart","setStartBefore","setStartAfter","setEnd","setEndBefore","setEndAfter","collapse","selectNode","selectNodeContents","compareBoundaryPoints","deleteContents","extractContents","cloneContents","insertNode","surroundContents","cloneRange","toString","detach"],y=["boundingHeight","boundingLeft","boundingTop","boundingWidth","htmlText","text"],z=["collapse","compareEndPoints","duplicate","moveToElementText","parentElement","select","setEndPoint","getBoundingClientRect"],A=d(a),B=d(b),C=d(c),D=[].forEach?function(a,b){a.forEach(b)}:function(a,b){for(var c=0,d=a.length;d>c;++c)b(a[c],c)},E={},F=typeof window!=v&&typeof document!=v,G={isHostMethod:a,isHostObject:b,isHostProperty:c,areHostMethods:A,areHostObjects:B,areHostProperties:C,isTextRange:e,getBody:f,forEach:D},H={version:"1.3.0",initialized:!1,isBrowser:F,supported:!0,util:G,features:{},modules:E,config:{alertOnFail:!1,alertOnWarn:!1,preferTextRange:!1,autoInitialize:typeof rangyAutoInitialize==v?!0:rangyAutoInitialize}};H.fail=i,H.warn=j;var I;({}).hasOwnProperty?(G.extend=I=function(a,b,c){var d,e;for(var f in b)b.hasOwnProperty(f)&&(d=a[f],e=b[f],c&&null!==d&&"object"==typeof d&&null!==e&&"object"==typeof e&&I(d,e,!0),a[f]=e);return b.hasOwnProperty("toString")&&(a.toString=b.toString),a},G.createOptions=function(a,b){var c={};return I(c,b),a&&I(c,a),c}):i("hasOwnProperty not supported"),F||i("Rangy can only run in a browser"),function(){var a;if(F){var b=document.createElement("div");b.appendChild(document.createElement("span"));var c=[].slice;try{1==c.call(b.childNodes,0)[0].nodeType&&(a=function(a){return c.call(a,0)})}catch(d){}}a||(a=function(a){for(var b=[],c=0,d=a.length;d>c;++c)b[c]=a[c];return b}),G.toArray=a}();var J;F&&(a(document,"addEventListener")?J=function(a,b,c){a.addEventListener(b,c,!1)}:a(document,"attachEvent")?J=function(a,b,c){a.attachEvent("on"+b,c)}:i("Document does not have required addEventListener or attachEvent method"),G.addListener=J);var K=[];G.deprecationNotice=m,G.createAliasForDeprecatedMethod=n,H.init=l,H.addInitListener=function(a){H.initialized?a(H):K.push(a)};var L=[];H.addShimListener=function(a){L.push(a)},F&&(H.shim=H.createMissingNativeApi=o,n(H,"createMissingNativeApi","shim")),p.prototype={init:function(){for(var a,b,c=this.dependencies||[],d=0,e=c.length;e>d;++d){if(b=c[d],a=E[b],!(a&&a instanceof p))throw new Error("required module '"+b+"' not found");if(a.init(),!a.supported)throw new Error("required module '"+b+"' not supported")}this.initializer(this)},fail:function(a){throw this.initialized=!0,this.supported=!1,new Error(a)},warn:function(a){H.warn("Module "+this.name+": "+a)},deprecationNotice:function(a,b){H.warn("DEPRECATED: "+a+" in module "+this.name+" is deprecated. Please use "+b+" instead")},createError:function(a){return new Error("Error in Rangy "+this.name+" module: "+a)}},H.createModule=function(a){var b,c;2==arguments.length?(b=arguments[1],c=[]):(b=arguments[2],c=arguments[1]);var d=q(a,c,b);H.initialized&&H.supported&&d.init()},H.createCoreModule=function(a,b,c){q(a,b,c)},H.RangePrototype=r,H.rangePrototype=new r,H.selectionPrototype=new s,H.createCoreModule("DomUtil",[],function(a,b){function c(a){var b;return typeof a.namespaceURI==F||null===(b=a.namespaceURI)||"http://www.w3.org/1999/xhtml"==b}function d(a){var b=a.parentNode;return 1==b.nodeType?b:null}function e(a){for(var b=0;a=a.previousSibling;)++b;return b}function f(a){switch(a.nodeType){case 7:case 10:return 0;case 3:case 8:return a.length;default:return a.childNodes.length}}function g(a,b){var c,d=[];for(c=a;c;c=c.parentNode)d.push(c);for(c=b;c;c=c.parentNode)if(K(d,c))return c;return null}function h(a,b,c){for(var d=c?b:b.parentNode;d;){if(d===a)return!0;d=d.parentNode}return!1}function i(a,b){return h(a,b,!0)}function j(a,b,c){for(var d,e=c?a:a.parentNode;e;){if(d=e.parentNode,d===b)return e;e=d}return null}function k(a){var b=a.nodeType;return 3==b||4==b||8==b}function l(a){if(!a)return!1;var b=a.nodeType;return 3==b||8==b}function m(a,b){var c=b.nextSibling,d=b.parentNode;return c?d.insertBefore(a,c):d.appendChild(a),a}function n(a,b,c){var d=a.cloneNode(!1);if(d.deleteData(0,b),a.deleteData(b,a.length-b),m(d,a),c)for(var f,g=0;f=c[g++];)f.node==a&&f.offset>b?(f.node=d,f.offset-=b):f.node==a.parentNode&&f.offset>e(a)&&++f.offset;return d}function o(a){if(9==a.nodeType)return a;if(typeof a.ownerDocument!=F)return a.ownerDocument;if(typeof a.document!=F)return a.document;if(a.parentNode)return o(a.parentNode);throw b.createError("getDocument: no document found for node")}function p(a){var c=o(a);if(typeof c.defaultView!=F)return c.defaultView; +if(typeof c.parentWindow!=F)return c.parentWindow;throw b.createError("Cannot get a window object for node")}function q(a){if(typeof a.contentDocument!=F)return a.contentDocument;if(typeof a.contentWindow!=F)return a.contentWindow.document;throw b.createError("getIframeDocument: No Document object found for iframe element")}function r(a){if(typeof a.contentWindow!=F)return a.contentWindow;if(typeof a.contentDocument!=F)return a.contentDocument.defaultView;throw b.createError("getIframeWindow: No Window object found for iframe element")}function s(a){return a&&G.isHostMethod(a,"setTimeout")&&G.isHostObject(a,"document")}function t(a,b,c){var d;if(a?G.isHostProperty(a,"nodeType")?d=1==a.nodeType&&"iframe"==a.tagName.toLowerCase()?q(a):o(a):s(a)&&(d=a.document):d=document,!d)throw b.createError(c+"(): Parameter must be a Window object or DOM node");return d}function u(a){for(var b;b=a.parentNode;)a=b;return a}function v(a,c,d,f){var h,i,k,l,m;if(a==d)return c===f?0:f>c?-1:1;if(h=j(d,a,!0))return c<=e(h)?-1:1;if(h=j(a,d,!0))return e(h)[index:"+e(a)+",length:"+a.childNodes.length+"]["+(a.innerHTML||"[innerHTML not supported]").slice(0,25)+"]"}return a.nodeName}function y(a){for(var b,c=o(a).createDocumentFragment();b=a.firstChild;)c.appendChild(b);return c}function z(a,b,c){var d=H(a),e=a.createElement("div");e.contentEditable=""+!!c,b&&(e.innerHTML=b);var f=d.firstChild;return f?d.insertBefore(e,f):d.appendChild(e),e}function A(a){return a.parentNode.removeChild(a)}function B(a){this.root=a,this._next=a}function C(a){return new B(a)}function D(a,b){this.node=a,this.offset=b}function E(a){this.code=this[a],this.codeName=a,this.message="DOMException: "+this.codeName}var F="undefined",G=a.util,H=G.getBody;G.areHostMethods(document,["createDocumentFragment","createElement","createTextNode"])||b.fail("document missing a Node creation method"),G.isHostMethod(document,"getElementsByTagName")||b.fail("document missing getElementsByTagName method");var I=document.createElement("div");G.areHostMethods(I,["insertBefore","appendChild","cloneNode"]||!G.areHostObjects(I,["previousSibling","nextSibling","childNodes","parentNode"]))||b.fail("Incomplete Element implementation"),G.isHostProperty(I,"innerHTML")||b.fail("Element is missing innerHTML property");var J=document.createTextNode("test");G.areHostMethods(J,["splitText","deleteData","insertData","appendData","cloneNode"]||!G.areHostObjects(I,["previousSibling","nextSibling","childNodes","parentNode"])||!G.areHostProperties(J,["data"]))||b.fail("Incomplete Text Node implementation");var K=function(a,b){for(var c=a.length;c--;)if(a[c]===b)return!0;return!1},L=!1;!function(){var b=document.createElement("b");b.innerHTML="1";var c=b.firstChild;b.innerHTML="
        ",L=w(c),a.features.crashyTextNodes=L}();var M;typeof window.getComputedStyle!=F?M=function(a,b){return p(a).getComputedStyle(a,null)[b]}:typeof document.documentElement.currentStyle!=F?M=function(a,b){return a.currentStyle?a.currentStyle[b]:""}:b.fail("No means of obtaining computed style properties found"),B.prototype={_current:null,hasNext:function(){return!!this._next},next:function(){var a,b,c=this._current=this._next;if(this._current)if(a=c.firstChild)this._next=a;else{for(b=null;c!==this.root&&!(b=c.nextSibling);)c=c.parentNode;this._next=b}return this._current},detach:function(){this._current=this._next=this.root=null}},D.prototype={equals:function(a){return!!a&&this.node===a.node&&this.offset==a.offset},inspect:function(){return"[DomPosition("+x(this.node)+":"+this.offset+")]"},toString:function(){return this.inspect()}},E.prototype={INDEX_SIZE_ERR:1,HIERARCHY_REQUEST_ERR:3,WRONG_DOCUMENT_ERR:4,NO_MODIFICATION_ALLOWED_ERR:7,NOT_FOUND_ERR:8,NOT_SUPPORTED_ERR:9,INVALID_STATE_ERR:11,INVALID_NODE_TYPE_ERR:24},E.prototype.toString=function(){return this.message},a.dom={arrayContains:K,isHtmlNamespace:c,parentElement:d,getNodeIndex:e,getNodeLength:f,getCommonAncestor:g,isAncestorOf:h,isOrIsAncestorOf:i,getClosestAncestorIn:j,isCharacterDataNode:k,isTextOrCommentNode:l,insertAfter:m,splitDataNode:n,getDocument:o,getWindow:p,getIframeWindow:r,getIframeDocument:q,getBody:H,isWindow:s,getContentDocument:t,getRootContainer:u,comparePoints:v,isBrokenNode:w,inspectNode:x,getComputedStyleProperty:M,createTestElement:z,removeNode:A,fragmentFromNodeChildren:y,createIterator:C,DomPosition:D},a.DOMException=E}),H.createCoreModule("DomRange",["DomUtil"],function(a,b){function c(a,b){return 3!=a.nodeType&&(P(a,b.startContainer)||P(a,b.endContainer))}function d(a){return a.document||Q(a.startContainer)}function e(a){return W(a.startContainer)}function f(a){return new L(a.parentNode,O(a))}function g(a){return new L(a.parentNode,O(a)+1)}function h(a,b,c){var d=11==a.nodeType?a.firstChild:a;return N(b)?c==b.length?J.insertAfter(a,b):b.parentNode.insertBefore(a,0==c?b:S(b,c)):c>=b.childNodes.length?b.appendChild(a):b.insertBefore(a,b.childNodes[c]),d}function i(a,b,c){if(z(a),z(b),d(b)!=d(a))throw new M("WRONG_DOCUMENT_ERR");var e=R(a.startContainer,a.startOffset,b.endContainer,b.endOffset),f=R(a.endContainer,a.endOffset,b.startContainer,b.startOffset);return c?0>=e&&f>=0:0>e&&f>0}function j(a){for(var b,c,e,f=d(a.range).createDocumentFragment();c=a.next();){if(b=a.isPartiallySelectedSubtree(),c=c.cloneNode(!b),b&&(e=a.getSubtreeIterator(),c.appendChild(j(e)),e.detach()),10==c.nodeType)throw new M("HIERARCHY_REQUEST_ERR");f.appendChild(c)}return f}function k(a,b,c){var d,e;c=c||{stop:!1};for(var f,g;f=a.next();)if(a.isPartiallySelectedSubtree()){if(b(f)===!1)return void(c.stop=!0);if(g=a.getSubtreeIterator(),k(g,b,c),g.detach(),c.stop)return}else for(d=J.createIterator(f);e=d.next();)if(b(e)===!1)return void(c.stop=!0)}function l(a){for(var b;a.next();)a.isPartiallySelectedSubtree()?(b=a.getSubtreeIterator(),l(b),b.detach()):a.remove()}function m(a){for(var b,c,e=d(a.range).createDocumentFragment();b=a.next();){if(a.isPartiallySelectedSubtree()?(b=b.cloneNode(!1),c=a.getSubtreeIterator(),b.appendChild(m(c)),c.detach()):a.remove(),10==b.nodeType)throw new M("HIERARCHY_REQUEST_ERR");e.appendChild(b)}return e}function n(a,b,c){var d,e=!(!b||!b.length),f=!!c;e&&(d=new RegExp("^("+b.join("|")+")$"));var g=[];return k(new p(a,!1),function(b){if((!e||d.test(b.nodeType))&&(!f||c(b))){var h=a.startContainer;if(b!=h||!N(h)||a.startOffset!=h.length){var i=a.endContainer;b==i&&N(i)&&0==a.endOffset||g.push(b)}}}),g}function o(a){var b="undefined"==typeof a.getName?"Range":a.getName();return"["+b+"("+J.inspectNode(a.startContainer)+":"+a.startOffset+", "+J.inspectNode(a.endContainer)+":"+a.endOffset+")]"}function p(a,b){if(this.range=a,this.clonePartiallySelectedTextNodes=b,!a.collapsed){this.sc=a.startContainer,this.so=a.startOffset,this.ec=a.endContainer,this.eo=a.endOffset;var c=a.commonAncestorContainer;this.sc===this.ec&&N(this.sc)?(this.isSingleCharacterDataNode=!0,this._first=this._last=this._next=this.sc):(this._first=this._next=this.sc!==c||N(this.sc)?T(this.sc,c,!0):this.sc.childNodes[this.so],this._last=this.ec!==c||N(this.ec)?T(this.ec,c,!0):this.ec.childNodes[this.eo-1])}}function q(a){return function(b,c){for(var d,e=c?b:b.parentNode;e;){if(d=e.nodeType,V(a,d))return e;e=e.parentNode}return null}}function r(a,b){if(ea(a,b))throw new M("INVALID_NODE_TYPE_ERR")}function s(a,b){if(!V(b,a.nodeType))throw new M("INVALID_NODE_TYPE_ERR")}function t(a,b){if(0>b||b>(N(a)?a.length:a.childNodes.length))throw new M("INDEX_SIZE_ERR")}function u(a,b){if(ca(a,!0)!==ca(b,!0))throw new M("WRONG_DOCUMENT_ERR")}function v(a){if(da(a,!0))throw new M("NO_MODIFICATION_ALLOWED_ERR")}function w(a,b){if(!a)throw new M(b)}function x(a,b){return b<=(N(a)?a.length:a.childNodes.length)}function y(a){return!!a.startContainer&&!!a.endContainer&&!(X&&(J.isBrokenNode(a.startContainer)||J.isBrokenNode(a.endContainer)))&&W(a.startContainer)==W(a.endContainer)&&x(a.startContainer,a.startOffset)&&x(a.endContainer,a.endOffset)}function z(a){if(!y(a))throw new Error("Range error: Range is not valid. This usually happens after DOM mutation. Range: ("+a.inspect()+")")}function A(a,b){z(a);var c=a.startContainer,d=a.startOffset,e=a.endContainer,f=a.endOffset,g=c===e;N(e)&&f>0&&f0&&d=O(c)&&f++,d=0),a.setStartAndEnd(c,d,e,f)}function B(a){z(a);var b=a.commonAncestorContainer.parentNode.cloneNode(!1);return b.appendChild(a.cloneContents()),b.innerHTML}function C(a){a.START_TO_START=ka,a.START_TO_END=la,a.END_TO_END=ma,a.END_TO_START=na,a.NODE_BEFORE=oa,a.NODE_AFTER=pa,a.NODE_BEFORE_AND_AFTER=qa,a.NODE_INSIDE=ra}function D(a){C(a),C(a.prototype)}function E(a,b){return function(){z(this);var c,d,e=this.startContainer,f=this.startOffset,h=this.commonAncestorContainer,i=new p(this,!0);e!==h&&(c=T(e,h,!0),d=g(c),e=d.node,f=d.offset),k(i,v),i.reset();var j=a(i);return i.detach(),b(this,e,f,e,f),j}}function F(b,d){function e(a,b){return function(c){s(c,Z),s(W(c),$);var d=(a?f:g)(c);(b?h:i)(this,d.node,d.offset)}}function h(a,b,c){var e=a.endContainer,f=a.endOffset;(b!==a.startContainer||c!==a.startOffset)&&((W(b)!=W(e)||1==R(b,c,e,f))&&(e=b,f=c),d(a,b,c,e,f))}function i(a,b,c){var e=a.startContainer,f=a.startOffset;(b!==a.endContainer||c!==a.endOffset)&&((W(b)!=W(e)||-1==R(b,c,e,f))&&(e=b,f=c),d(a,e,f,b,c))}var j=function(){};j.prototype=a.rangePrototype,b.prototype=new j,K.extend(b.prototype,{setStart:function(a,b){r(a,!0),t(a,b),h(this,a,b)},setEnd:function(a,b){r(a,!0),t(a,b),i(this,a,b)},setStartAndEnd:function(){var a=arguments,b=a[0],c=a[1],e=b,f=c;switch(a.length){case 3:f=a[2];break;case 4:e=a[2],f=a[3]}d(this,b,c,e,f)},setBoundary:function(a,b,c){this["set"+(c?"Start":"End")](a,b)},setStartBefore:e(!0,!0),setStartAfter:e(!1,!0),setEndBefore:e(!0,!1),setEndAfter:e(!1,!1),collapse:function(a){z(this),a?d(this,this.startContainer,this.startOffset,this.startContainer,this.startOffset):d(this,this.endContainer,this.endOffset,this.endContainer,this.endOffset)},selectNodeContents:function(a){r(a,!0),d(this,a,0,a,U(a))},selectNode:function(a){r(a,!1),s(a,Z);var b=f(a),c=g(a);d(this,b.node,b.offset,c.node,c.offset)},extractContents:E(m,d),deleteContents:E(l,d),canSurroundContents:function(){z(this),v(this.startContainer),v(this.endContainer);var a=new p(this,!0),b=a._first&&c(a._first,this)||a._last&&c(a._last,this);return a.detach(),!b},splitBoundaries:function(){A(this)},splitBoundariesPreservingPositions:function(a){A(this,a)},normalizeBoundaries:function(){z(this);var a,b=this.startContainer,c=this.startOffset,e=this.endContainer,f=this.endOffset,g=function(a){var b=a.nextSibling;b&&b.nodeType==a.nodeType&&(e=a,f=a.length,a.appendData(b.data),Y(b))},h=function(a){var d=a.previousSibling;if(d&&d.nodeType==a.nodeType){b=a;var g=a.length;if(c=d.length,a.insertData(0,d.data),Y(d),b==e)f+=c,e=b;else if(e==a.parentNode){var h=O(a);f==h?(e=a,f=g):f>h&&f--}}},i=!0;if(N(e))f==e.length?g(e):0==f&&(a=e.previousSibling,a&&a.nodeType==e.nodeType&&(f=a.length,b==e&&(i=!1),a.appendData(e.data),Y(e),e=a));else{if(f>0){var j=e.childNodes[f-1];j&&N(j)&&g(j)}i=!this.collapsed}if(i){if(N(b))0==c?h(b):c==b.length&&(a=b.nextSibling,a&&a.nodeType==b.nodeType&&(e==a&&(e=b,f+=b.length),b.appendData(a.data),Y(a)));else if(cx",ga=3==fa.firstChild.nodeType}catch(ha){}a.features.htmlParsingConforms=ga;var ia=ga?function(a){var b=this.startContainer,c=Q(b);if(!b)throw new M("INVALID_STATE_ERR");var d=null;return 1==b.nodeType?d=b:N(b)&&(d=J.parentElement(b)),d=null===d||"HTML"==d.nodeName&&J.isHtmlNamespace(Q(d).documentElement)&&J.isHtmlNamespace(d)?c.createElement("body"):d.cloneNode(!1),d.innerHTML=a,J.fragmentFromNodeChildren(d)}:function(a){var b=d(this),c=b.createElement("body");return c.innerHTML=a,J.fragmentFromNodeChildren(c)},ja=["startContainer","startOffset","endContainer","endOffset","collapsed","commonAncestorContainer"],ka=0,la=1,ma=2,na=3,oa=0,pa=1,qa=2,ra=3;K.extend(a.rangePrototype,{compareBoundaryPoints:function(a,b){z(this),u(this.startContainer,b.startContainer);var c,d,e,f,g=a==na||a==ka?"start":"end",h=a==la||a==ka?"start":"end";return c=this[g+"Container"],d=this[g+"Offset"],e=b[h+"Container"],f=b[h+"Offset"],R(c,d,e,f)},insertNode:function(a){if(z(this),s(a,aa),v(this.startContainer),P(a,this.startContainer))throw new M("HIERARCHY_REQUEST_ERR");var b=h(a,this.startContainer,this.startOffset);this.setStartBefore(b)},cloneContents:function(){z(this);var a,b;if(this.collapsed)return d(this).createDocumentFragment();if(this.startContainer===this.endContainer&&N(this.startContainer))return a=this.startContainer.cloneNode(!0),a.data=a.data.slice(this.startOffset,this.endOffset),b=d(this).createDocumentFragment(),b.appendChild(a),b;var c=new p(this,!0);return a=j(c),c.detach(),a},canSurroundContents:function(){z(this),v(this.startContainer),v(this.endContainer);var a=new p(this,!0),b=a._first&&c(a._first,this)||a._last&&c(a._last,this);return a.detach(),!b},surroundContents:function(a){if(s(a,ba),!this.canSurroundContents())throw new M("INVALID_STATE_ERR");var b=this.extractContents();if(a.hasChildNodes())for(;a.lastChild;)a.removeChild(a.lastChild);h(a,this.startContainer,this.startOffset),a.appendChild(b),this.selectNode(a)},cloneRange:function(){z(this);for(var a,b=new I(d(this)),c=ja.length;c--;)a=ja[c],b[a]=this[a];return b},toString:function(){z(this);var a=this.startContainer;if(a===this.endContainer&&N(a))return 3==a.nodeType||4==a.nodeType?a.data.slice(this.startOffset,this.endOffset):"";var b=[],c=new p(this,!0);return k(c,function(a){(3==a.nodeType||4==a.nodeType)&&b.push(a.data)}),c.detach(),b.join("")},compareNode:function(a){z(this);var b=a.parentNode,c=O(a);if(!b)throw new M("NOT_FOUND_ERR");var d=this.comparePoint(b,c),e=this.comparePoint(b,c+1);return 0>d?e>0?qa:oa:e>0?pa:ra},comparePoint:function(a,b){return z(this),w(a,"HIERARCHY_REQUEST_ERR"),u(a,this.startContainer),R(a,b,this.startContainer,this.startOffset)<0?-1:R(a,b,this.endContainer,this.endOffset)>0?1:0},createContextualFragment:ia,toHtml:function(){return B(this)},intersectsNode:function(a,b){if(z(this),W(a)!=e(this))return!1;var c=a.parentNode,d=O(a);if(!c)return!0;var f=R(c,d,this.endContainer,this.endOffset),g=R(c,d+1,this.startContainer,this.startOffset);return b?0>=f&&g>=0:0>f&&g>0},isPointInRange:function(a,b){return z(this),w(a,"HIERARCHY_REQUEST_ERR"),u(a,this.startContainer),R(a,b,this.startContainer,this.startOffset)>=0&&R(a,b,this.endContainer,this.endOffset)<=0},intersectsRange:function(a){return i(this,a,!1)},intersectsOrTouchesRange:function(a){return i(this,a,!0)},intersection:function(a){if(this.intersectsRange(a)){var b=R(this.startContainer,this.startOffset,a.startContainer,a.startOffset),c=R(this.endContainer,this.endOffset,a.endContainer,a.endOffset),d=this.cloneRange();return-1==b&&d.setStart(a.startContainer,a.startOffset),1==c&&d.setEnd(a.endContainer,a.endOffset),d}return null},union:function(a){if(this.intersectsOrTouchesRange(a)){var b=this.cloneRange();return-1==R(a.startContainer,a.startOffset,this.startContainer,this.startOffset)&&b.setStart(a.startContainer,a.startOffset),1==R(a.endContainer,a.endOffset,this.endContainer,this.endOffset)&&b.setEnd(a.endContainer,a.endOffset),b}throw new M("Ranges do not intersect")},containsNode:function(a,b){return b?this.intersectsNode(a,!1):this.compareNode(a)==ra},containsNodeContents:function(a){return this.comparePoint(a,0)>=0&&this.comparePoint(a,U(a))<=0},containsRange:function(a){var b=this.intersection(a);return null!==b&&a.equals(b)},containsNodeText:function(a){var b=this.cloneRange();b.selectNode(a);var c=b.getNodes([3]);if(c.length>0){b.setStart(c[0],0);var d=c.pop();return b.setEnd(d,d.length),this.containsRange(b)}return this.containsNodeContents(a)},getNodes:function(a,b){return z(this),n(this,a,b)},getDocument:function(){return d(this)},collapseBefore:function(a){this.setEndBefore(a),this.collapse(!1)},collapseAfter:function(a){this.setStartAfter(a),this.collapse(!0)},getBookmark:function(b){var c=d(this),e=a.createRange(c);b=b||J.getBody(c),e.selectNodeContents(b);var f=this.intersection(e),g=0,h=0;return f&&(e.setEnd(f.startContainer,f.startOffset),g=e.toString().length,h=g+f.toString().length),{start:g,end:h,containerNode:b}},moveToBookmark:function(a){var b=a.containerNode,c=0;this.setStart(b,0),this.collapse(!0);for(var d,e,f,g,h=[b],i=!1,j=!1;!j&&(d=h.pop());)if(3==d.nodeType)e=c+d.length,!i&&a.start>=c&&a.start<=e&&(this.setStart(d,a.start-c),i=!0),i&&a.end>=c&&a.end<=e&&(this.setEnd(d,a.end-c),j=!0),c=e;else for(g=d.childNodes,f=g.length;f--;)h.push(g[f])},getName:function(){return"DomRange"},equals:function(a){return I.rangesEqual(this,a)},isValid:function(){return y(this)},inspect:function(){return o(this)},detach:function(){}}),F(I,H),K.extend(I,{rangeProperties:ja,RangeIterator:p,copyComparisonConstants:D,createPrototypeRange:F,inspect:o,toHtml:B,getRangeDocument:d,rangesEqual:function(a,b){return a.startContainer===b.startContainer&&a.startOffset===b.startOffset&&a.endContainer===b.endContainer&&a.endOffset===b.endOffset}}),a.DomRange=I}),H.createCoreModule("WrappedRange",["DomRange"],function(a,b){var c,d,e=a.dom,f=a.util,g=e.DomPosition,h=a.DomRange,i=e.getBody,j=e.getContentDocument,k=e.isCharacterDataNode;if(a.features.implementsDomRange&&!function(){function d(a){for(var b,c=m.length;c--;)b=m[c],a[b]=a.nativeRange[b];a.collapsed=a.startContainer===a.endContainer&&a.startOffset===a.endOffset}function g(a,b,c,d,e){var f=a.startContainer!==b||a.startOffset!=c,g=a.endContainer!==d||a.endOffset!=e,h=!a.equals(a.nativeRange);(f||g||h)&&(a.setEnd(d,e),a.setStart(b,c))}var k,l,m=h.rangeProperties;c=function(a){if(!a)throw b.createError("WrappedRange: Range must be specified");this.nativeRange=a,d(this)},h.createPrototypeRange(c,g),k=c.prototype,k.selectNode=function(a){this.nativeRange.selectNode(a),d(this)},k.cloneContents=function(){return this.nativeRange.cloneContents()},k.surroundContents=function(a){this.nativeRange.surroundContents(a),d(this)},k.collapse=function(a){this.nativeRange.collapse(a),d(this)},k.cloneRange=function(){return new c(this.nativeRange.cloneRange())},k.refresh=function(){d(this)},k.toString=function(){return this.nativeRange.toString()};var n=document.createTextNode("test");i(document).appendChild(n);var o=document.createRange();o.setStart(n,0),o.setEnd(n,0);try{o.setStart(n,1),k.setStart=function(a,b){this.nativeRange.setStart(a,b),d(this)},k.setEnd=function(a,b){this.nativeRange.setEnd(a,b),d(this)},l=function(a){return function(b){this.nativeRange[a](b),d(this)}}}catch(p){k.setStart=function(a,b){try{this.nativeRange.setStart(a,b)}catch(c){this.nativeRange.setEnd(a,b),this.nativeRange.setStart(a,b)}d(this)},k.setEnd=function(a,b){try{this.nativeRange.setEnd(a,b)}catch(c){this.nativeRange.setStart(a,b),this.nativeRange.setEnd(a,b)}d(this)},l=function(a,b){return function(c){try{this.nativeRange[a](c)}catch(e){this.nativeRange[b](c),this.nativeRange[a](c)}d(this)}}}k.setStartBefore=l("setStartBefore","setEndBefore"),k.setStartAfter=l("setStartAfter","setEndAfter"),k.setEndBefore=l("setEndBefore","setStartBefore"),k.setEndAfter=l("setEndAfter","setStartAfter"),k.selectNodeContents=function(a){this.setStartAndEnd(a,0,e.getNodeLength(a))},o.selectNodeContents(n),o.setEnd(n,3);var q=document.createRange();q.selectNodeContents(n),q.setEnd(n,4),q.setStart(n,2),-1==o.compareBoundaryPoints(o.START_TO_END,q)&&1==o.compareBoundaryPoints(o.END_TO_START,q)?k.compareBoundaryPoints=function(a,b){return b=b.nativeRange||b,a==b.START_TO_END?a=b.END_TO_START:a==b.END_TO_START&&(a=b.START_TO_END),this.nativeRange.compareBoundaryPoints(a,b)}:k.compareBoundaryPoints=function(a,b){return this.nativeRange.compareBoundaryPoints(a,b.nativeRange||b)};var r=document.createElement("div");r.innerHTML="123";var s=r.firstChild,t=i(document);t.appendChild(r),o.setStart(s,1),o.setEnd(s,2),o.deleteContents(),"13"==s.data&&(k.deleteContents=function(){this.nativeRange.deleteContents(),d(this)},k.extractContents=function(){var a=this.nativeRange.extractContents();return d(this),a}),t.removeChild(r),t=null,f.isHostMethod(o,"createContextualFragment")&&(k.createContextualFragment=function(a){return this.nativeRange.createContextualFragment(a)}),i(document).removeChild(n),k.getName=function(){return"WrappedRange"},a.WrappedRange=c,a.createNativeRange=function(a){return a=j(a,b,"createNativeRange"),a.createRange()}}(),a.features.implementsTextRange){var l=function(a){var b=a.parentElement(),c=a.duplicate();c.collapse(!0);var d=c.parentElement();c=a.duplicate(),c.collapse(!1);var f=c.parentElement(),g=d==f?d:e.getCommonAncestor(d,f);return g==b?g:e.getCommonAncestor(b,g)},m=function(a){return 0==a.compareEndPoints("StartToEnd",a)},n=function(a,b,c,d,f){var h=a.duplicate();h.collapse(c);var i=h.parentElement();if(e.isOrIsAncestorOf(b,i)||(i=b),!i.canHaveHTML){var j=new g(i.parentNode,e.getNodeIndex(i));return{boundaryPosition:j,nodeInfo:{nodeIndex:j.offset,containerElement:j.node}}}var l=e.getDocument(i).createElement("span");l.parentNode&&e.removeNode(l);for(var m,n,o,p,q,r=c?"StartToStart":"StartToEnd",s=f&&f.containerElement==i?f.nodeIndex:0,t=i.childNodes.length,u=t,v=u;;){if(v==t?i.appendChild(l):i.insertBefore(l,i.childNodes[v]),h.moveToElementText(l),m=h.compareEndPoints(r,a),0==m||s==u)break;if(-1==m){if(u==s+1)break;s=v}else u=u==s+1?s:v;v=Math.floor((s+u)/2),i.removeChild(l)}if(q=l.nextSibling,-1==m&&q&&k(q)){h.setEndPoint(c?"EndToStart":"EndToEnd",a);var w;if(/[\r\n]/.test(q.data)){var x=h.duplicate(),y=x.text.replace(/\r\n/g,"\r").length;for(w=x.moveStart("character",y);-1==(m=x.compareEndPoints("StartToEnd",x));)w++,x.moveStart("character",1)}else w=h.text.length;p=new g(q,w)}else n=(d||!c)&&l.previousSibling,o=(d||c)&&l.nextSibling,p=o&&k(o)?new g(o,0):n&&k(n)?new g(n,n.data.length):new g(i,e.getNodeIndex(l));return e.removeNode(l),{boundaryPosition:p,nodeInfo:{nodeIndex:v,containerElement:i}}},o=function(a,b){var c,d,f,g,h=a.offset,j=e.getDocument(a.node),l=i(j).createTextRange(),m=k(a.node);return m?(c=a.node,d=c.parentNode):(g=a.node.childNodes,c=hb;++b)if(!C.isAncestorOf(a[0],a[b]))return!1;return!0}function m(a){var c=a.getNodes();if(!l(c))throw b.createError("getSingleElementFromRange: range "+a.inspect()+" did not consist of a single element");return c[0]}function n(a){return!!a&&"undefined"!=typeof a.text}function o(a,b){var c=new G(b);a._ranges=[c],h(a,c,!1),a.rangeCount=1,a.isCollapsed=c.collapsed}function p(b){if(b._ranges.length=0,"None"==b.docSelection.type)j(b);else{var c=b.docSelection.createRange();if(n(c))o(b,c);else{b.rangeCount=c.length;for(var d,e=L(c.item(0)),f=0;fh;++h)g.add(d.item(h));try{g.add(e)}catch(j){throw b.createError("addRange(): Element within the specified Range could not be added to control selection (does it have layout?)")}g.select(),p(a)}function r(a,b,c){this.nativeSelection=a,this.docSelection=b,this._ranges=[],this.win=c,this.refresh()}function s(a){a.win=a.anchorNode=a.focusNode=a._ranges=null,a.rangeCount=a.anchorOffset=a.focusOffset=0,a.detached=!0}function t(a,b){for(var c,d,e=ba.length;e--;)if(c=ba[e],d=c.selection,"deleteAll"==b)s(d);else if(c.win==a)return"delete"==b?(ba.splice(e,1),!0):d;return"deleteAll"==b&&(ba.length=0),null}function u(a,c){for(var d,e=L(c[0].startContainer),f=M(e).createControlRange(),g=0,h=c.length;h>g;++g){d=m(c[g]);try{f.add(d)}catch(i){throw b.createError("setRanges(): Element within one of the specified Ranges could not be added to control selection (does it have layout?)")}}f.select(),p(a)}function v(a,b){if(a.win.document!=L(b))throw new H("WRONG_DOCUMENT_ERR")}function w(b){return function(c,d){var e;this.rangeCount?(e=this.getRangeAt(0),e["set"+(b?"Start":"End")](c,d)):(e=a.createRange(this.win.document),e.setStartAndEnd(c,d)),this.setSingleRange(e,this.isBackward())}}function x(a){var b=[],c=new I(a.anchorNode,a.anchorOffset),d=new I(a.focusNode,a.focusOffset),e="function"==typeof a.getName?a.getName():"Selection";if("undefined"!=typeof a.rangeCount)for(var f=0,g=a.rangeCount;g>f;++f)b[f]=F.inspect(a.getRangeAt(f));return"["+e+"(Ranges: "+b.join(", ")+")(anchor: "+c.inspect()+", focus: "+d.inspect()+"]"}a.config.checkSelectionRanges=!0;var y,z,A="boolean",B="number",C=a.dom,D=a.util,E=D.isHostMethod,F=a.DomRange,G=a.WrappedRange,H=a.DOMException,I=C.DomPosition,J=a.features,K="Control",L=C.getDocument,M=C.getBody,N=F.rangesEqual,O=E(window,"getSelection"),P=D.isHostObject(document,"selection");J.implementsWinGetSelection=O,J.implementsDocSelection=P;var Q=P&&(!O||a.config.preferTextRange);if(Q)y=f,a.isSelectionValid=function(a){var b=d(a,"isSelectionValid").document,c=b.selection;return"None"!=c.type||L(c.createRange().parentElement())==b};else{if(!O)return b.fail("Neither document.selection or window.getSelection() detected."),!1;y=e,a.isSelectionValid=function(){return!0}}a.getNativeSelection=y;var R=y();if(!R)return b.fail("Native selection was null (possibly issue 138?)"),!1;var S=a.createNativeRange(document),T=M(document),U=D.areHostProperties(R,["anchorNode","focusNode","anchorOffset","focusOffset"]);J.selectionHasAnchorAndFocus=U;var V=E(R,"extend");J.selectionHasExtend=V;var W=typeof R.rangeCount==B;J.selectionHasRangeCount=W;var X=!1,Y=!0,Z=V?function(b,c){var d=F.getRangeDocument(c),e=a.createRange(d);e.collapseToPoint(c.endContainer,c.endOffset),b.addRange(k(e)),b.extend(c.startContainer,c.startOffset)}:null;D.areHostMethods(R,["addRange","getRangeAt","removeAllRanges"])&&typeof R.rangeCount==B&&J.implementsDomRange&&!function(){var b=window.getSelection();if(b){for(var c=b.rangeCount,d=c>1,e=[],f=g(b),h=0;c>h;++h)e[h]=b.getRangeAt(h);var i=C.createTestElement(document,"",!1),j=i.appendChild(document.createTextNode("   ")),k=document.createRange();if(k.setStart(j,1),k.collapse(!0),b.removeAllRanges(),b.addRange(k), +Y=1==b.rangeCount,b.removeAllRanges(),!d){var l=window.navigator.appVersion.match(/Chrome\/(.*?) /);if(l&&parseInt(l[1])>=36)X=!1;else{var m=k.cloneRange();k.setStart(j,0),m.setEnd(j,3),m.setStart(j,2),b.addRange(k),b.addRange(m),X=2==b.rangeCount}}for(C.removeNode(i),b.removeAllRanges(),h=0;c>h;++h)0==h&&f?Z?Z(b,e[h]):(a.warn("Rangy initialization: original selection was backwards but selection has been restored forwards because the browser does not support Selection.extend"),b.addRange(e[h])):b.addRange(e[h])}}(),J.selectionSupportsMultipleRanges=X,J.collapsedNonEditableSelectionsSupported=Y;var $,_=!1;T&&E(T,"createControlRange")&&($=T.createControlRange(),D.areHostProperties($,["item","add"])&&(_=!0)),J.implementsControlRange=_,z=U?function(a){return a.anchorNode===a.focusNode&&a.anchorOffset===a.focusOffset}:function(a){return a.rangeCount?a.getRangeAt(a.rangeCount-1).collapsed:!1};var aa;E(R,"getRangeAt")?aa=function(a,b){try{return a.getRangeAt(b)}catch(c){return null}}:U&&(aa=function(b){var c=L(b.anchorNode),d=a.createRange(c);return d.setStartAndEnd(b.anchorNode,b.anchorOffset,b.focusNode,b.focusOffset),d.collapsed!==this.isCollapsed&&d.setStartAndEnd(b.focusNode,b.focusOffset,b.anchorNode,b.anchorOffset),d}),r.prototype=a.selectionPrototype;var ba=[],ca=function(a){if(a&&a instanceof r)return a.refresh(),a;a=d(a,"getNativeSelection");var b=t(a),c=y(a),e=P?f(a):null;return b?(b.nativeSelection=c,b.docSelection=e,b.refresh()):(b=new r(c,e,a),ba.push({win:a,selection:b})),b};a.getSelection=ca,D.createAliasForDeprecatedMethod(a,"getIframeSelection","getSelection");var da=r.prototype;if(!Q&&U&&D.areHostMethods(R,["removeAllRanges","addRange"])){da.removeAllRanges=function(){this.nativeSelection.removeAllRanges(),j(this)};var ea=function(a,b){Z(a.nativeSelection,b),a.refresh()};W?da.addRange=function(b,d){if(_&&P&&this.docSelection.type==K)q(this,b);else if(c(d)&&V)ea(this,b);else{var e;X?e=this.rangeCount:(this.removeAllRanges(),e=0);var f=k(b).cloneRange();try{this.nativeSelection.addRange(f)}catch(g){}if(this.rangeCount=this.nativeSelection.rangeCount,this.rangeCount==e+1){if(a.config.checkSelectionRanges){var i=aa(this.nativeSelection,this.rangeCount-1);i&&!N(i,b)&&(b=new G(i))}this._ranges[this.rangeCount-1]=b,h(this,b,ha(this.nativeSelection)),this.isCollapsed=z(this)}else this.refresh()}}:da.addRange=function(a,b){c(b)&&V?ea(this,a):(this.nativeSelection.addRange(k(a)),this.refresh())},da.setRanges=function(a){if(_&&P&&a.length>1)u(this,a);else{this.removeAllRanges();for(var b=0,c=a.length;c>b;++b)this.addRange(a[b])}}}else{if(!(E(R,"empty")&&E(S,"select")&&_&&Q))return b.fail("No means of selecting a Range or TextRange was found"),!1;da.removeAllRanges=function(){try{if(this.docSelection.empty(),"None"!=this.docSelection.type){var a;if(this.anchorNode)a=L(this.anchorNode);else if(this.docSelection.type==K){var b=this.docSelection.createRange();b.length&&(a=L(b.item(0)))}if(a){var c=M(a).createTextRange();c.select(),this.docSelection.empty()}}}catch(d){}j(this)},da.addRange=function(b){this.docSelection.type==K?q(this,b):(a.WrappedTextRange.rangeToTextRange(b).select(),this._ranges[0]=b,this.rangeCount=1,this.isCollapsed=this._ranges[0].collapsed,h(this,b,!1))},da.setRanges=function(a){this.removeAllRanges();var b=a.length;b>1?u(this,a):b&&this.addRange(a[0])}}da.getRangeAt=function(a){if(0>a||a>=this.rangeCount)throw new H("INDEX_SIZE_ERR");return this._ranges[a].cloneRange()};var fa;if(Q)fa=function(b){var c;a.isSelectionValid(b.win)?c=b.docSelection.createRange():(c=M(b.win.document).createTextRange(),c.collapse(!0)),b.docSelection.type==K?p(b):n(c)?o(b,c):j(b)};else if(E(R,"getRangeAt")&&typeof R.rangeCount==B)fa=function(b){if(_&&P&&b.docSelection.type==K)p(b);else if(b._ranges.length=b.rangeCount=b.nativeSelection.rangeCount,b.rangeCount){for(var c=0,d=b.rangeCount;d>c;++c)b._ranges[c]=new a.WrappedRange(b.nativeSelection.getRangeAt(c));h(b,b._ranges[b.rangeCount-1],ha(b.nativeSelection)),b.isCollapsed=z(b)}else j(b)};else{if(!U||typeof R.isCollapsed!=A||typeof S.collapsed!=A||!J.implementsDomRange)return b.fail("No means of obtaining a Range or TextRange from the user's selection was found"),!1;fa=function(a){var b,c=a.nativeSelection;c.anchorNode?(b=aa(c,0),a._ranges=[b],a.rangeCount=1,i(a),a.isCollapsed=z(a)):j(a)}}da.refresh=function(a){var b=a?this._ranges.slice(0):null,c=this.anchorNode,d=this.anchorOffset;if(fa(this),a){var e=b.length;if(e!=this._ranges.length)return!0;if(this.anchorNode!=c||this.anchorOffset!=d)return!0;for(;e--;)if(!N(b[e],this._ranges[e]))return!0;return!1}};var ga=function(a,b){var c=a.getAllRanges();a.removeAllRanges();for(var d=0,e=c.length;e>d;++d)N(b,c[d])||a.addRange(c[d]);a.rangeCount||j(a)};_&&P?da.removeRange=function(a){if(this.docSelection.type==K){for(var b,c=this.docSelection.createRange(),d=m(a),e=L(c.item(0)),f=M(e).createControlRange(),g=!1,h=0,i=c.length;i>h;++h)b=c.item(h),b!==d||g?f.add(c.item(h)):g=!0;f.select(),p(this)}else ga(this,a)}:da.removeRange=function(a){ga(this,a)};var ha;!Q&&U&&J.implementsDomRange?(ha=g,da.isBackward=function(){return ha(this)}):ha=da.isBackward=function(){return!1},da.isBackwards=da.isBackward,da.toString=function(){for(var a=[],b=0,c=this.rangeCount;c>b;++b)a[b]=""+this._ranges[b];return a.join("")},da.collapse=function(b,c){v(this,b);var d=a.createRange(b);d.collapseToPoint(b,c),this.setSingleRange(d),this.isCollapsed=!0},da.collapseToStart=function(){if(!this.rangeCount)throw new H("INVALID_STATE_ERR");var a=this._ranges[0];this.collapse(a.startContainer,a.startOffset)},da.collapseToEnd=function(){if(!this.rangeCount)throw new H("INVALID_STATE_ERR");var a=this._ranges[this.rangeCount-1];this.collapse(a.endContainer,a.endOffset)},da.selectAllChildren=function(b){v(this,b);var c=a.createRange(b);c.selectNodeContents(b),this.setSingleRange(c)},da.deleteFromDocument=function(){if(_&&P&&this.docSelection.type==K){for(var a,b=this.docSelection.createRange();b.length;)a=b.item(0),b.remove(a),C.removeNode(a);this.refresh()}else if(this.rangeCount){var c=this.getAllRanges();if(c.length){this.removeAllRanges();for(var d=0,e=c.length;e>d;++d)c[d].deleteContents();this.addRange(c[e-1])}}},da.eachRange=function(a,b){for(var c=0,d=this._ranges.length;d>c;++c)if(a(this.getRangeAt(c)))return b},da.getAllRanges=function(){var a=[];return this.eachRange(function(b){a.push(b)}),a},da.setSingleRange=function(a,b){this.removeAllRanges(),this.addRange(a,b)},da.callMethodOnEachRange=function(a,b){var c=[];return this.eachRange(function(d){c.push(d[a].apply(d,b||[]))}),c},da.setStart=w(!0),da.setEnd=w(!1),a.rangePrototype.select=function(a){ca(this.getDocument()).setSingleRange(this,a)},da.changeEachRange=function(a){var b=[],c=this.isBackward();this.eachRange(function(c){a(c),b.push(c)}),this.removeAllRanges(),c&&1==b.length?this.addRange(b[0],"backward"):this.setRanges(b)},da.containsNode=function(a,b){return this.eachRange(function(c){return c.containsNode(a,b)},!0)||!1},da.getBookmark=function(a){return{backward:this.isBackward(),rangeBookmarks:this.callMethodOnEachRange("getBookmark",[a])}},da.moveToBookmark=function(b){for(var c,d,e=[],f=0;c=b.rangeBookmarks[f++];)d=a.createRange(this.win),d.moveToBookmark(c),e.push(d);b.backward?this.setSingleRange(e[0],"backward"):this.setRanges(e)},da.saveRanges=function(){return{backward:this.isBackward(),ranges:this.callMethodOnEachRange("cloneRange")}},da.restoreRanges=function(a){this.removeAllRanges();for(var b,c=0;b=a.ranges[c];++c)this.addRange(b,a.backward&&0==c)},da.toHtml=function(){var a=[];return this.eachRange(function(b){a.push(F.toHtml(b))}),a.join("")},J.implementsTextRange&&(da.getNativeTextRange=function(){var c;if(c=this.docSelection){var d=c.createRange();if(n(d))return d;throw b.createError("getNativeTextRange: selection is a control selection")}if(this.rangeCount>0)return a.WrappedTextRange.rangeToTextRange(this.getRangeAt(0));throw b.createError("getNativeTextRange: selection contains no range")}),da.getName=function(){return"WrappedSelection"},da.inspect=function(){return x(this)},da.detach=function(){t(this.win,"delete"),s(this)},r.detachAll=function(){t(null,"deleteAll")},r.inspect=x,r.isDirectionBackward=c,a.Selection=r,a.selectionPrototype=da,a.addShimListener(function(a){"undefined"==typeof a.getSelection&&(a.getSelection=function(){return ca(a)}),a=null})});var M=!1,N=function(a){M||(M=!0,!H.initialized&&H.config.autoInitialize&&l())};return F&&("complete"==document.readyState?N():(a(document,"addEventListener")&&document.addEventListener("DOMContentLoaded",N,!1),J(window,"load",N))),H},this),function(a,b){"function"==typeof define&&define.amd?define(["./rangy-core"],a):"undefined"!=typeof module&&"object"==typeof exports?module.exports=a(require("rangy")):a(b.rangy)}(function(a){return a.createModule("ClassApplier",["WrappedSelection"],function(a,b){function c(a,b){for(var c in a)if(a.hasOwnProperty(c)&&b(c,a[c])===!1)return!1;return!0}function d(a){return a.replace(/^\s\s*/,"").replace(/\s\s*$/,"")}function e(a,b){return!!a&&new RegExp("(?:^|\\s)"+b+"(?:\\s|$)").test(a)}function f(a,b){if("object"==typeof a.classList)return a.classList.contains(b);var c="string"==typeof a.className,d=c?a.className:a.getAttribute("class");return e(d,b)}function g(a,b){if("object"==typeof a.classList)a.classList.add(b);else{var c="string"==typeof a.className,d=c?a.className:a.getAttribute("class");d?e(d,b)||(d+=" "+b):d=b,c?a.className=d:a.setAttribute("class",d)}}function h(a){var b="string"==typeof a.className;return b?a.className:a.getAttribute("class")}function j(a){return a&&a.split(/\s+/).sort().join(" ")}function k(a){return j(h(a))}function l(a,b){return k(a)==k(b)}function m(a,b){for(var c=b.split(/\s+/),e=0,g=c.length;g>e;++e)if(!f(a,d(c[e])))return!1;return!0}function n(a){var b=a.parentNode;return b&&1==b.nodeType&&!/^(textarea|style|script|select|iframe)$/i.test(b.nodeName)}function o(a,b,c,d,e){var f=a.node,g=a.offset,h=f,i=g;f==d&&g>e&&++i,f!=b||g!=c&&g!=c+1||(h=d,i+=e-c),f==b&&g>c+1&&--i,a.node=h,a.offset=i}function p(a,b,c){a.node==b&&a.offset>c&&--a.offset}function q(a,b,c,d){-1==c&&(c=b.childNodes.length);var e=a.parentNode,f=L.getNodeIndex(a);P(d,function(a){o(a,e,f,b,c)}),b.childNodes.length==c?b.appendChild(a):b.insertBefore(a,b.childNodes[c])}function r(a,b){var c=a.parentNode,d=L.getNodeIndex(a);P(b,function(a){p(a,c,d)}),L.removeNode(a)}function s(a,b,c,d,e){for(var f,g=[];f=a.firstChild;)q(f,b,c++,e),g.push(f);return d&&r(a,e),g}function t(a,b){return s(a,a.parentNode,L.getNodeIndex(a),!0,b)}function u(a,b){var c=a.cloneRange();c.selectNodeContents(b);var d=c.intersection(a),e=d?d.toString():"";return""!=e}function v(a){for(var b,c=a.getNodes([3]),d=0;(b=c[d])&&!u(a,b);)++d;for(var e=c.length-1;(b=c[e])&&!u(a,b);)--e;return c.slice(d,e+1)}function w(a,b){if(a.attributes.length!=b.attributes.length)return!1;for(var c,d,e,f=0,g=a.attributes.length;g>f;++f)if(c=a.attributes[f],e=c.name,"class"!=e){if(d=b.attributes.getNamedItem(e),null===c!=(null===d))return!1;if(c.specified!=d.specified)return!1;if(c.specified&&c.nodeValue!==d.nodeValue)return!1}return!0}function x(a,b){for(var c,d=0,e=a.attributes.length;e>d;++d)if(c=a.attributes[d].name,(!b||!N(b,c))&&a.attributes[d].specified&&"class"!=c)return!0;return!1}function y(a){var b;return a&&1==a.nodeType&&((b=a.parentNode)&&9==b.nodeType&&"on"==b.designMode||U(a)&&!U(a.parentNode))}function z(a){return(U(a)||1!=a.nodeType&&U(a.parentNode))&&!y(a)}function A(a){return a&&1==a.nodeType&&!V.test(T(a,"display"))}function B(a){if(0==a.data.length)return!0;if(W.test(a.data))return!1;var b=T(a.parentNode,"whiteSpace");switch(b){case"pre":case"pre-wrap":case"-moz-pre-wrap":return!1;case"pre-line":if(/[\r\n]/.test(a.data))return!1}return A(a.previousSibling)||A(a.nextSibling)}function C(a){var b,c,d=[];for(b=0;c=a[b++];)d.push(new M(c.startContainer,c.startOffset),new M(c.endContainer,c.endOffset));return d}function D(a,b){for(var c,d,e,f=0,g=a.length;g>f;++f)c=a[f],d=b[2*f],e=b[2*f+1],c.setStartAndEnd(d.node,d.offset,e.node,e.offset)}function E(a,b){return L.isCharacterDataNode(a)?0==b?!!a.previousSibling:b==a.length?!!a.nextSibling:!0:b>0&&bg;++g)"*"==e[g]?k.applyToAnyTagName=!0:k.tagNames.push(e[g].toLowerCase());else k.tagNames=[k.elementTagName]}function K(a,b,c){return new J(a,b,c)}var L=a.dom,M=L.DomPosition,N=L.arrayContains,O=a.util,P=O.forEach,Q="span",R=O.isHostMethod(document,"createElementNS"),S=function(){function a(a,b,c){return b&&c?" ":""}return function(b,c){if("object"==typeof b.classList)b.classList.remove(c);else{var d="string"==typeof b.className,e=d?b.className:b.getAttribute("class");e=e.replace(new RegExp("(^|\\s)"+c+"(\\s|$)"),a),d?b.className=e:b.setAttribute("class",e)}}}(),T=L.getComputedStyleProperty,U=function(){var a=document.createElement("div");return"boolean"==typeof a.isContentEditable?function(a){return a&&1==a.nodeType&&a.isContentEditable}:function(a){return a&&1==a.nodeType&&"false"!=a.contentEditable?"true"==a.contentEditable||U(a.parentNode):!1}}(),V=/^inline(-block|-table)?$/i,W=/[^\r\n\t\f \u200B]/,X=H(!1),Y=H(!0);I.prototype={doMerge:function(a){var b=this.textNodes,c=b[0];if(b.length>1){var d,e=L.getNodeIndex(c),f=[],g=0;P(b,function(b,h){d=b.parentNode,h>0&&(d.removeChild(b),d.hasChildNodes()||L.removeNode(d),a&&P(a,function(a){a.node==b&&(a.node=c,a.offset+=g),a.node==d&&a.offset>e&&(--a.offset,a.offset==e+1&&hi;++i)e=g[i],f=c.getSelfOrAncestorWithClass(e),f&&c.isModifiable(e)&&c.undoToAncestor(f,d);a.setStartAndEnd(g[0],0,h,h.length),c.normalize&&c.postApply(g,a,d,!0),D(b,d)}var k=c.getEmptyElements(a);P(k,function(a){S(a,c.className)})},undoToRanges:function(a){for(var b=a.length;b--;)this.undoToRange(a[b],a);return a},undoToSelection:function(b){var c=a.getSelection(b),d=a.getSelection(b).getAllRanges();this.undoToRanges(d),c.setRanges(d)},isAppliedToRange:function(a){if(a.collapsed||""==a.toString())return!!this.getSelfOrAncestorWithClass(a.commonAncestorContainer);var b=a.getNodes([3]);if(b.length)for(var c,d=0;c=b[d++];)if(!this.isIgnorableWhiteSpaceNode(c)&&u(a,c)&&this.isModifiable(c)&&!this.getSelfOrAncestorWithClass(c))return!1;return!0},isAppliedToRanges:function(a){var b=a.length;if(0==b)return!1;for(;b--;)if(!this.isAppliedToRange(a[b]))return!1;return!0},isAppliedToSelection:function(b){var c=a.getSelection(b);return this.isAppliedToRanges(c.getAllRanges())},toggleRange:function(a){this.isAppliedToRange(a)?this.undoToRange(a):this.applyToRange(a)},toggleSelection:function(a){this.isAppliedToSelection(a)?this.undoToSelection(a):this.applyToSelection(a)},getElementsWithClassIntersectingRange:function(a){var b=[],c=this;return a.getNodes([3],function(a){var d=c.getSelfOrAncestorWithClass(a);d&&!N(b,d)&&b.push(d)}),b},detach:function(){}},J.util={hasClass:f,addClass:g,removeClass:S,getClass:h,hasSameClasses:l,hasAllClasses:m,replaceWithOwnChildren:t,elementsHaveSameNonClassAttributes:w,elementHasNonClassAttributes:x,splitNodeAt:F,isEditableElement:U,isEditingHost:y,isEditable:z},a.CssClassApplier=a.ClassApplier=J,a.createClassApplier=K,O.createAliasForDeprecatedMethod(a,"createCssClassApplier","createClassApplier",b)}),a},this),function(a,b){"function"==typeof define&&define.amd?define(["./rangy-core"],a):"undefined"!=typeof module&&"object"==typeof exports?module.exports=a(require("rangy")):a(b.rangy)}(function(a){return a.createModule("Highlighter",["ClassApplier"],function(a,b){function c(a,b){return a.characterRange.start-b.characterRange.start}function d(a,b){return b?a.getElementById(b):m(a)}function e(a,b){this.type=a,this.converterCreator=b}function f(a,b){q[a]=new e(a,b)}function g(a){var b=q[a];if(b instanceof e)return b.create();throw new Error("Highlighter type '"+a+"' is not valid")}function h(a,b){this.start=a,this.end=b}function i(a,b,c,d,e,f){e?(this.id=e,p=Math.max(p,e+1)):this.id=p++,this.characterRange=b,this.doc=a,this.classApplier=c,this.converter=d,this.containerElementId=f||null,this.applied=!1}function j(a,b){b=b||"textContent",this.doc=a||document,this.classAppliers={},this.highlights=[],this.converter=g(b)}var k=a.dom,l=k.arrayContains,m=k.getBody,n=a.util.createOptions,o=a.util.forEach,p=1,q={};e.prototype.create=function(){var a=this.converterCreator();return a.type=this.type,a},a.registerHighlighterType=f,h.prototype={intersects:function(a){return this.starta.start},isContiguousWith:function(a){return this.start==a.end||this.end==a.start},union:function(a){return new h(Math.min(this.start,a.start),Math.max(this.end,a.end))},intersection:function(a){return new h(Math.max(this.start,a.start),Math.min(this.end,a.end))},getComplements:function(a){var b=[];if(this.start>=a.start){if(this.end<=a.end)return[];b.push(new h(a.end,this.end))}else b.push(new h(this.start,Math.min(this.end,a.start))),this.end>a.end&&b.push(new h(a.end,this.end));return b},toString:function(){return"[CharacterRange("+this.start+", "+this.end+")]"}},h.fromCharacterRange=function(a){return new h(a.start,a.end)};var r={rangeToCharacterRange:function(a,b){var c=a.getBookmark(b);return new h(c.start,c.end)},characterRangeToRange:function(b,c,d){var e=a.createRange(b);return e.moveToBookmark({start:c.start,end:c.end,containerNode:d}),e},serializeSelection:function(a,b){for(var c=a.getAllRanges(),d=c.length,e=[],f=1==d&&a.isBackward(),g=0,h=c.length;h>g;++g)e[g]={characterRange:this.rangeToCharacterRange(c[g],b),backward:f};return e},restoreSelection:function(a,b,c){a.removeAllRanges();for(var d,e,f,g=a.win.document,h=0,i=b.length;i>h;++h)e=b[h],f=e.characterRange,d=this.characterRangeToRange(g,e.characterRange,c),a.addRange(d,e.backward)}};f("textContent",function(){return r}),f("TextRange",function(){var b;return function(){if(!b){var c=a.modules.TextRange;if(!c)throw new Error("TextRange module is missing.");if(!c.supported)throw new Error("TextRange module is present but not supported.");b={rangeToCharacterRange:function(a,b){return h.fromCharacterRange(a.toCharacterRange(b))},characterRangeToRange:function(b,c,d){var e=a.createRange(b);return e.selectCharacters(d,c.start,c.end),e},serializeSelection:function(a,b){return a.saveCharacterRanges(b)},restoreSelection:function(a,b,c){a.restoreCharacterRanges(c,b)}}}return b}}()),i.prototype={getContainerElement:function(){return d(this.doc,this.containerElementId)},getRange:function(){return this.converter.characterRangeToRange(this.doc,this.characterRange,this.getContainerElement())},fromRange:function(a){this.characterRange=this.converter.rangeToCharacterRange(a,this.getContainerElement())},getText:function(){return this.getRange().toString()},containsElement:function(a){return this.getRange().containsNodeContents(a.firstChild)},unapply:function(){this.classApplier.undoToRange(this.getRange()),this.applied=!1},apply:function(){this.classApplier.applyToRange(this.getRange()),this.applied=!0},getHighlightElements:function(){return this.classApplier.getElementsWithClassIntersectingRange(this.getRange())},toString:function(){return"[Highlight(ID: "+this.id+", class: "+this.classApplier.className+", character range: "+this.characterRange.start+" - "+this.characterRange.end+")]"}},j.prototype={addClassApplier:function(a){this.classAppliers[a.className]=a},getHighlightForElement:function(a){for(var b=this.highlights,c=0,d=b.length;d>c;++c)if(b[c].containsElement(a))return b[c];return null},removeHighlights:function(a){for(var b,c=0,d=this.highlights.length;d>c;++c)b=this.highlights[c],l(a,b)&&(b.unapply(),this.highlights.splice(c--,1))},removeAllHighlights:function(){this.removeHighlights(this.highlights)},getIntersectingHighlights:function(a){var b=[],c=this.highlights;return o(a,function(a){o(c,function(c){a.intersectsRange(c.getRange())&&!l(b,c)&&b.push(c)})}),b},highlightCharacterRanges:function(b,c,d){var e,f,g,j=this.highlights,k=this.converter,l=this.doc,m=[],p=b?this.classAppliers[b]:null;d=n(d,{containerElementId:null,exclusive:!0});var q,r,s,t=d.containerElementId,u=d.exclusive;t&&(q=this.doc.getElementById(t),q&&(r=a.createRange(this.doc),r.selectNodeContents(q),s=new h(0,r.toString().length)));var v,w,x,y,z,A;for(e=0,f=c.length;f>e;++e)if(v=c[e],z=[],s&&(v=v.intersection(s)),v.start!=v.end){for(g=0;g0},serialize:function(a){var b,d,e,f,h=this,i=h.highlights;return i.sort(c),a=n(a,{serializeHighlightText:!1,type:h.converter.type}),b=a.type,e=b!=h.converter.type,e&&(f=g(b)),d=["type:"+b],o(i,function(b){var c,g=b.characterRange;e&&(c=b.getContainerElement(),g=f.rangeToCharacterRange(h.converter.characterRangeToRange(h.doc,g,c),c));var i=[g.start,g.end,b.id,b.classApplier.className,b.containerElementId];a.serializeHighlightText&&i.push(b.getText()),d.push(i.join("$"))}),d.join("|")},deserialize:function(a){var b,c,e,f=a.split("|"),j=[],k=f[0],l=!1;if(!k||!(b=/^type:(\w+)$/.exec(k)))throw new Error("Serialized highlights are invalid.");c=b[1],c!=this.converter.type&&(e=g(c),l=!0),f.shift();for(var m,n,o,p,q,r,s=f.length;s-- >0;){if(r=f[s].split("$"),o=new h(+r[0],+r[1]),p=r[4]||null,l&&(q=d(this.doc,p),o=this.converter.rangeToCharacterRange(e.characterRangeToRange(this.doc,o,q),q)),m=this.classAppliers[r[3]],!m)throw new Error("No class applier found for class '"+r[3]+"'");n=new i(this.doc,o,m,this.converter,parseInt(r[2]),p),n.apply(),j.push(n)}this.highlights=j}},a.Highlighter=j,a.createHighlighter=function(a,b){return new j(a,b)}}),a},this),function(a,b){"function"==typeof define&&define.amd?define(["./rangy-core"],a):"undefined"!=typeof module&&"object"==typeof exports?module.exports=a(require("rangy")):a(b.rangy)}(function(a){return a.createModule("SaveRestore",["WrappedRange"],function(a,b){function c(a,b){return(b||document).getElementById(a)}function d(a,b){var c,d="selectionBoundary_"+ +new Date+"_"+(""+Math.random()).slice(2),e=o.getDocument(a.startContainer),f=a.cloneRange();return f.collapse(b),c=e.createElement("span"),c.id=d,c.style.lineHeight="0",c.style.display="none",c.className="rangySelectionBoundary",c.appendChild(e.createTextNode(r)),f.insertNode(c),c}function e(a,d,e,f){var g=c(e,a);g?(d[f?"setStartBefore":"setEndBefore"](g),p(g)):b.warn("Marker element has been removed. Cannot restore selection.")}function f(a,b){return b.compareBoundaryPoints(a.START_TO_START,a)}function g(b,c){var e,f,g=a.DomRange.getRangeDocument(b),h=b.toString(),i=q(c);return b.collapsed?(f=d(b,!1),{document:g,markerId:f.id,collapsed:!0}):(f=d(b,!1),e=d(b,!0),{document:g,startMarkerId:e.id,endMarkerId:f.id,collapsed:!1,backward:i,toString:function(){return"original text: '"+h+"', new text: '"+b.toString()+"'"}})}function h(d,f){var g=d.document;"undefined"==typeof f&&(f=!0);var h=a.createRange(g);if(d.collapsed){var i=c(d.markerId,g);if(i){i.style.display="inline";var j=i.previousSibling;j&&3==j.nodeType?(p(i),h.collapseToPoint(j,j.length)):(h.collapseBefore(i),p(i))}else b.warn("Marker element has been removed. Cannot restore selection.")}else e(g,h,d.startMarkerId,!0),e(g,h,d.endMarkerId,!1); +return f&&h.normalizeBoundaries(),h}function i(b,d){var e,h,i=[],j=q(d);b=b.slice(0),b.sort(f);for(var k=0,l=b.length;l>k;++k)i[k]=g(b[k],j);for(k=l-1;k>=0;--k)e=b[k],h=a.DomRange.getRangeDocument(e),e.collapsed?e.collapseAfter(c(i[k].markerId,h)):(e.setEndBefore(c(i[k].endMarkerId,h)),e.setStartAfter(c(i[k].startMarkerId,h)));return i}function j(c){if(!a.isSelectionValid(c))return b.warn("Cannot save selection. This usually happens when the selection is collapsed and the selection document has lost focus."),null;var d=a.getSelection(c),e=d.getAllRanges(),f=1==e.length&&d.isBackward(),g=i(e,f);return f?d.setSingleRange(e[0],f):d.setRanges(e),{win:c,rangeInfos:g,restored:!1}}function k(a){for(var b=[],c=a.length,d=c-1;d>=0;d--)b[d]=h(a[d],!0);return b}function l(b,c){if(!b.restored){var d=b.rangeInfos,e=a.getSelection(b.win),f=k(d),g=d.length;1==g&&c&&a.features.selectionHasExtend&&d[0].backward?(e.removeAllRanges(),e.addRange(f[0],!0)):e.setRanges(f),b.restored=!0}}function m(a,b){var d=c(b,a);d&&p(d)}function n(a){for(var b,c=a.rangeInfos,d=0,e=c.length;e>d;++d)b=c[d],b.collapsed?m(a.doc,b.markerId):(m(a.doc,b.startMarkerId),m(a.doc,b.endMarkerId))}var o=a.dom,p=o.removeNode,q=a.Selection.isDirectionBackward,r="\ufeff";a.util.extend(a,{saveRange:g,restoreRange:h,saveRanges:i,restoreRanges:k,saveSelection:j,restoreSelection:l,removeMarkerElement:m,removeMarkers:n})}),a},this),function(a,b){"function"==typeof define&&define.amd?define(["./rangy-core"],a):"undefined"!=typeof module&&"object"==typeof exports?module.exports=a(require("rangy")):a(b.rangy)}(function(a){return a.createModule("Serializer",["WrappedSelection"],function(a,b){function c(a){return a.replace(//g,">")}function d(a,b){b=b||[];var e=a.nodeType,f=a.childNodes,g=f.length,h=[e,a.nodeName,g].join(":"),i="",j="";switch(e){case 3:i=c(a.nodeValue);break;case 8:i="";break;default:i="<"+h+">",j=""}i&&b.push(i);for(var k=0;g>k;++k)d(f[k],b);return j&&b.push(j),b}function e(a){var b=d(a).join("");return s(b).toString(16)}function f(a,b,c){var d=[],e=a;for(c=c||t.getDocument(a).documentElement;e&&e!=c;)d.push(t.getNodeIndex(e,!0)),e=e.parentNode;return d.join("/")+":"+b}function g(a,c,d){c||(c=(d||document).documentElement);for(var e,f=a.split(":"),g=c,h=f[0]?f[0].split("/"):[],i=h.length;i--;){if(e=parseInt(h[i],10),!(eg;++g)f[g]=h(e[g],c,d);return f.join("|")}function l(b,c,d){c?d=d||t.getWindow(c):(d=d||window,c=d.document.documentElement);for(var e=b.split("|"),f=a.getSelection(d),g=[],h=0,j=e.length;j>h;++h)g[h]=i(e[h],c,d.document);return f.setRanges(g),f}function m(a,b,c){var d;b?d=c?c.document:t.getDocument(b):(c=c||window,b=c.document.documentElement);for(var e=a.split("|"),f=0,g=e.length;g>f;++f)if(!j(e[f],b,d))return!1;return!0}function n(a){for(var b,c,d=a.split(/[;,]/),e=0,f=d.length;f>e;++e)if(b=d[e].split("="),b[0].replace(/^\s+/,"")==v&&(c=b[1]))return decodeURIComponent(c.replace(/\s+$/,""));return null}function o(a){a=a||window;var b=n(a.document.cookie);b&&l(b,a.doc)}function p(b,c){b=b||window,c="object"==typeof c?c:{};var d=c.expires?";expires="+c.expires.toUTCString():"",e=c.path?";path="+c.path:"",f=c.domain?";domain="+c.domain:"",g=c.secure?";secure":"",h=k(a.getSelection(b));b.document.cookie=encodeURIComponent(v)+"="+encodeURIComponent(h)+d+e+f+g}var q="undefined",r=a.util;(typeof encodeURIComponent==q||typeof decodeURIComponent==q)&&b.fail("encodeURIComponent and/or decodeURIComponent method is missing");var s=function(){function a(a){for(var b,c=[],d=0,e=a.length;e>d;++d)b=a.charCodeAt(d),128>b?c.push(b):2048>b?c.push(b>>6|192,63&b|128):c.push(b>>12|224,b>>6&63|128,63&b|128);return c}function b(){for(var a,b,c=[],d=0;256>d;++d){for(b=d,a=8;a--;)1==(1&b)?b=b>>>1^3988292384:b>>>=1;c[d]=b>>>0}return c}function c(){return d||(d=b()),d}var d=null;return function(b){for(var d,e=a(b),f=-1,g=c(),h=0,i=e.length;i>h;++h)d=255&(f^e[h]),f=f>>>8^g[d];return(-1^f)>>>0}}(),t=a.dom,u=/^([^,]+),([^,\{]+)(\{([^}]+)\})?$/,v="rangySerializedSelection";r.extend(a,{serializePosition:f,deserializePosition:g,serializeRange:h,deserializeRange:i,canDeserializeRange:j,serializeSelection:k,deserializeSelection:l,canDeserializeSelection:m,restoreSelectionFromCookie:o,saveSelectionCookie:p,getElementChecksum:e,nodeToInfoString:d}),r.crc32=s}),a},this),function(a,b){"function"==typeof define&&define.amd?define(["./rangy-core"],a):"undefined"!=typeof module&&"object"==typeof exports?module.exports=a(require("rangy")):a(b.rangy)}(function(a){return a.createModule("TextRange",["WrappedSelection"],function(a,b){function c(a,b){function c(a,b,c){h.push({start:a,end:b,isWord:c})}for(var d,e,f,g=a.join(""),h=[],i=0;d=b.wordRegex.exec(g);){if(e=d.index,f=e+d[0].length,e>i&&c(i,e,!1),b.includeTrailingSpace)for(;$.test(a[f]);)++f;c(e,f,!0),i=f}return ie;++e)c[e].token=d;return d}function e(a,b,c){for(var e,f=c(a,b),g=[],h=0;e=f[h++];)g.push(d(a,e));return g}function f(a){var b=a||"",c="string"==typeof b?b.split(""):b;return c.sort(function(a,b){return a.charCodeAt(0)-b.charCodeAt(0)}),c.join("").replace(/(.)\1+/g,"$1")}function g(a){var b,c;return a?(b=a.language||_,c={},U(c,ia[b]||ia[_]),U(c,a),c):ia[_]}function h(a,b){var c=V(a,b);return b.hasOwnProperty("wordOptions")&&(c.wordOptions=g(c.wordOptions)),b.hasOwnProperty("characterOptions")&&(c.characterOptions=V(c.characterOptions,ga)),c}function i(a,b){var c=na(a,"display",b),d=a.tagName.toLowerCase();return"block"==c&&fa&&oa.hasOwnProperty(d)?oa[d]:c}function j(a){for(var b=o(a),c=0,d=b.length;d>c;++c)if(1==b[c].nodeType&&"none"==i(b[c]))return!0;return!1}function k(a){var b;return 3==a.nodeType&&(b=a.parentNode)&&"hidden"==na(b,"visibility")}function l(a){return a&&(1==a.nodeType&&!/^(inline(-block|-table)?|none)$/.test(i(a))||9==a.nodeType||11==a.nodeType)}function m(a){return S.isCharacterDataNode(a)||!/^(area|base|basefont|br|col|frame|hr|img|input|isindex|link|meta|param)$/i.test(a.nodeName)}function n(a){for(var b=[];a.parentNode;)b.unshift(a.parentNode),a=a.parentNode;return b}function o(a){return n(a).concat([a])}function p(a){for(;a&&!a.nextSibling;)a=a.parentNode;return a?a.nextSibling:null}function q(a,b){return!b&&a.hasChildNodes()?a.firstChild:p(a)}function r(a){var b=a.previousSibling;if(b){for(a=b;a.hasChildNodes();)a=a.lastChild;return a}var c=a.parentNode;return c&&1==c.nodeType?c:null}function s(a){if(!a||3!=a.nodeType)return!1;var b=a.data;if(""===b)return!0;var c=a.parentNode;if(!c||1!=c.nodeType)return!1;var d=na(a.parentNode,"whiteSpace");return/^[\t\n\r ]+$/.test(b)&&/^(normal|nowrap)$/.test(d)||/^[\t\r ]+$/.test(b)&&"pre-line"==d}function t(a){if(""===a.data)return!0;if(!s(a))return!1;var b=a.parentNode;return b?j(a)?!0:!1:!0}function u(a){var b=a.nodeType;return 7==b||8==b||j(a)||/^(script|style)$/i.test(a.nodeName)||k(a)||t(a)}function v(a,b){var c=a.nodeType;return 7==c||8==c||1==c&&"none"==i(a,b)}function w(){this.store={}}function x(a,b,c){return function(d){var e=this.cache;if(e.hasOwnProperty(a))return pa++,e[a];qa++;var f=b.call(this,c?this[c]:this,d);return e[a]=f,f}}function y(a,b){this.node=a,this.session=b,this.cache=new w,this.positions=new w}function z(a,b){this.offset=b,this.nodeWrapper=a,this.node=a.node,this.session=a.session,this.cache=new w}function A(){return"[Position("+S.inspectNode(this.node)+":"+this.offset+")]"}function B(){return D(),Da=new Ea}function C(){return Da||B()}function D(){Da&&Da.detach(),Da=null}function E(a,c,d,e){function f(){var a=null;return c?(a=h,i||(h=h.previousVisible(),i=!h||d&&h.equals(d))):i||(a=h=h.nextVisible(),i=!h||d&&h.equals(d)),i&&(h=null),a}d&&(c?u(d.node)&&(d=a.previousVisible()):u(d.node)&&(d=d.nextVisible()));var g,h=a,i=!1,j=!1;return{next:function(){if(j)return j=!1,g;for(var a,b;a=f();)if(b=a.getCharacter(e))return g=a,a;return null},rewind:function(){if(!g)throw b.createError("createCharacterIterator: cannot rewind. Only one position can be rewound.");j=!0},dispose:function(){a=d=null}}}function F(a,b,c){function d(a){for(var b,c,d=[],e=a?f:g,h=!1,i=!1;b=e.next();){if(c=b.character,Z.test(c))i&&(i=!1,h=!0);else{if(h){e.rewind();break}i=!0}d.push(b)}return d}var f=E(a,!1,null,b),g=E(a,!0,null,b),h=c.tokenizer,i=d(!0),j=d(!1).reverse(),k=e(j.concat(i),c,h),l=i.length?k.slice(Fa(k,i[0].token)):[],m=j.length?k.slice(0,Fa(k,j.pop().token)+1):[];return{nextEndToken:function(){for(var a,b;1==l.length&&!(a=l[0]).isWord&&(b=d(!0)).length>0;)l=e(a.chars.concat(b),c,h);return l.shift()},previousStartToken:function(){for(var a,b;1==m.length&&!(a=m[0]).isWord&&(b=d(!1)).length>0;)m=e(b.reverse().concat(a.chars),c,h);return m.pop()},dispose:function(){f.dispose(),g.dispose(),l=m=null}}}function G(a,b,c,d,e){var f,g,h,i,j=0,k=a,l=Math.abs(c);if(0!==c){var m=0>c;switch(b){case Q:for(g=E(a,m,null,d);(f=g.next())&&l>j;)++j,k=f;h=f,g.dispose();break;case R:for(var n=F(a,d,e),o=m?n.previousStartToken:n.nextEndToken;(i=o())&&l>j;)i.isWord&&(++j,k=m?i.chars[0]:i.chars[i.chars.length-1]);break;default:throw new Error("movePositionBy: unit '"+b+"' not implemented")}m?(k=k.previousVisible(),j=-j):k&&k.isLeadingSpace&&!k.isTrailingSpace&&(b==R&&(g=E(a,!1,null,d),h=g.next(),g.dispose()),h&&(k=h.previousVisible()))}return{position:k,unitsMoved:j}}function H(a,b,c,d){var e=a.getRangeBoundaryPosition(b,!0),f=a.getRangeBoundaryPosition(b,!1),g=d?f:e,h=d?e:f;return E(g,!!d,h,c)}function I(a,b,c){for(var d,e=[],f=H(a,b,c);d=f.next();)e.push(d);return f.dispose(),e}function J(b,c,d){var e=a.createRange(b.node);return e.setStartAndEnd(b.node,b.offset,c.node,c.offset),!e.expand("word",{wordOptions:d})}function K(a,b,c,d,e){function f(a,b){var c=p[a].previousVisible(),d=p[b-1],f=!e.wholeWordsOnly||J(c,d,e.wordOptions);return{startPos:c,endPos:d,valid:f}}for(var g,h,i,j,k,l,m=aa(e.direction),n=E(a,m,a.session.getRangeBoundaryPosition(d,m),e.characterOptions),o="",p=[],q=null;g=n.next();)if(h=g.character,c||e.caseSensitive||(h=h.toLowerCase()),m?(p.unshift(g),o=h+o):(p.push(g),o+=h),c){if(k=b.exec(o))if(i=k.index,j=i+k[0].length,l){if(!m&&j0){q=f(i,j);break}}else l=!0}else if(-1!=(i=o.indexOf(b))){q=f(i,i+b.length);break}return l&&(q=f(i,j)),n.dispose(),q}function L(a){return function(){var b=!!Da,c=C(),d=[c].concat(T.toArray(arguments)),e=a.apply(this,d);return b||D(),e}}function M(a,b){return L(function(c,d,e,f){typeof e==P&&(e=d,d=Q),f=h(f,ka);var g=a;b&&(g=e>=0,this.collapse(!g));var i=G(c.getRangeBoundaryPosition(this,g),d,e,f.characterOptions,f.wordOptions),j=i.position;return this[g?"setStart":"setEnd"](j.node,j.offset),i.unitsMoved})}function N(a){return L(function(b,c){c=V(c,ga);for(var d,e=H(b,this,c,!a),f=0;(d=e.next())&&Z.test(d.character);)++f;e.dispose();var g=f>0;return g&&this[a?"moveStart":"moveEnd"]("character",a?f:-f,{characterOptions:c}),g})}function O(a){return L(function(b,c){var d=!1;return this.changeEachRange(function(b){d=b[a](c)||d}),d})}var P="undefined",Q="character",R="word",S=a.dom,T=a.util,U=T.extend,V=T.createOptions,W=S.getBody,X=/^[ \t\f\r\n]+$/,Y=/^[ \t\f\r]+$/,Z=/^[\t-\r \u0085\u00A0\u1680\u180E\u2000-\u200B\u2028\u2029\u202F\u205F\u3000]+$/,$=/^[\t \u00A0\u1680\u180E\u2000-\u200B\u202F\u205F\u3000]+$/,_="en",aa=a.Selection.isDirectionBackward,ba=!1,ca=!1,da=!1,ea=!0;!function(){var b=S.createTestElement(document,"

        1

        ",!0),c=b.firstChild,d=a.getSelection();d.collapse(c.lastChild,2),d.setStart(c.firstChild,0),ba=1==(""+d).length,b.innerHTML="1
        ",d.collapse(b,2),d.setStart(b.firstChild,0),ca=1==(""+d).length,b.innerHTML="1

        1

        ",d.collapse(b,2),d.setStart(b.firstChild,0),da=1==(""+d).length,S.removeNode(b),d.removeAllRanges()}();var fa,ga={includeBlockContentTrailingSpace:!0,includeSpaceBeforeBr:!0,includeSpaceBeforeBlock:!0,includePreLineTrailingSpace:!0,ignoreCharacters:""},ha={includeBlockContentTrailingSpace:!ea,includeSpaceBeforeBr:!ca,includeSpaceBeforeBlock:!da,includePreLineTrailingSpace:!0},ia={en:{wordRegex:/[a-z0-9]+('[a-z0-9]+)*/gi,includeTrailingSpace:!1,tokenizer:c}},ja={caseSensitive:!1,withinRange:null,wholeWordsOnly:!1,wrap:!1,direction:"forward",wordOptions:null,characterOptions:null},ka={wordOptions:null,characterOptions:null},la={wordOptions:null,characterOptions:null,trim:!1,trimStart:!0,trimEnd:!0},ma={wordOptions:null,characterOptions:null,direction:"forward"},na=S.getComputedStyleProperty;!function(){var a=document.createElement("table"),b=W(document);b.appendChild(a),fa="block"==na(a,"display"),b.removeChild(a)}();var oa={table:"table",caption:"table-caption",colgroup:"table-column-group",col:"table-column",thead:"table-header-group",tbody:"table-row-group",tfoot:"table-footer-group",tr:"table-row",td:"table-cell",th:"table-cell"};w.prototype={get:function(a){return this.store.hasOwnProperty(a)?this.store[a]:null},set:function(a,b){return this.store[a]=b}};var pa=0,qa=0,ra={getPosition:function(a){var b=this.positions;return b.get(a)||b.set(a,new z(this,a))},toString:function(){return"[NodeWrapper("+S.inspectNode(this.node)+")]"}};y.prototype=ra;var sa="EMPTY",ta="NON_SPACE",ua="UNCOLLAPSIBLE_SPACE",va="COLLAPSIBLE_SPACE",wa="TRAILING_SPACE_BEFORE_BLOCK",xa="TRAILING_SPACE_IN_BLOCK",ya="TRAILING_SPACE_BEFORE_BR",za="PRE_LINE_TRAILING_SPACE_BEFORE_LINE_BREAK",Aa="TRAILING_LINE_BREAK_AFTER_BR",Ba="INCLUDED_TRAILING_LINE_BREAK_AFTER_BR";U(ra,{isCharacterDataNode:x("isCharacterDataNode",S.isCharacterDataNode,"node"),getNodeIndex:x("nodeIndex",S.getNodeIndex,"node"),getLength:x("nodeLength",S.getNodeLength,"node"),containsPositions:x("containsPositions",m,"node"),isWhitespace:x("isWhitespace",s,"node"),isCollapsedWhitespace:x("isCollapsedWhitespace",t,"node"),getComputedDisplay:x("computedDisplay",i,"node"),isCollapsed:x("collapsed",u,"node"),isIgnored:x("ignored",v,"node"),next:x("nextPos",q,"node"),previous:x("previous",r,"node"),getTextNodeInfo:x("textNodeInfo",function(a){var b=null,c=!1,d=na(a.parentNode,"whiteSpace"),e="pre-line"==d;return e?(b=Y,c=!0):("normal"==d||"nowrap"==d)&&(b=X,c=!0),{node:a,text:a.data,spaceRegex:b,collapseSpaces:c,preLine:e}},"node"),hasInnerText:x("hasInnerText",function(a,b){for(var c=this.session,d=c.getPosition(a.parentNode,this.getNodeIndex()+1),e=c.getPosition(a,0),f=b?d:e,g=b?e:d;f!==g;){if(f.prepopulateChar(),f.isDefinitelyNonEmpty())return!0;f=b?f.previousVisible():f.nextVisible()}return!1},"node"),isRenderedBlock:x("isRenderedBlock",function(a){for(var b=a.getElementsByTagName("br"),c=0,d=b.length;d>c;++c)if(!u(b[c]))return!0;return this.hasInnerText()},"node"),getTrailingSpace:x("trailingSpace",function(a){if("br"==a.tagName.toLowerCase())return"";switch(this.getComputedDisplay()){case"inline":for(var b=a.lastChild;b;){if(!v(b))return 1==b.nodeType?this.session.getNodeWrapper(b).getTrailingSpace():"";b=b.previousSibling}break;case"inline-block":case"inline-table":case"none":case"table-column":case"table-column-group":break;case"table-cell":return" ";default:return this.isRenderedBlock(!0)?"\n":""}return""},"node"),getLeadingSpace:x("leadingSpace",function(a){switch(this.getComputedDisplay()){case"inline":case"inline-block":case"inline-table":case"none":case"table-column":case"table-column-group":case"table-cell":break;default:return this.isRenderedBlock(!1)?"\n":""}return""},"node")});var Ca={character:"",characterType:sa,isBr:!1,prepopulateChar:function(){var a=this;if(!a.prepopulatedChar){var b=a.node,c=a.offset,d="",e=sa,f=!1;if(c>0)if(3==b.nodeType){var g=b.data,h=g.charAt(c-1),i=a.nodeWrapper.getTextNodeInfo(),j=i.spaceRegex;i.collapseSpaces?j.test(h)?c>1&&j.test(g.charAt(c-2))||(i.preLine&&"\n"===g.charAt(c)?(d=" ",e=za):(d=" ",e=va)):(d=h,e=ta,f=!0):(d=h,e=ua,f=!0)}else{var k=b.childNodes[c-1];if(k&&1==k.nodeType&&!u(k)&&("br"==k.tagName.toLowerCase()?(d="\n",a.isBr=!0,e=va,f=!1):a.checkForTrailingSpace=!0),!d){var l=b.childNodes[c];l&&1==l.nodeType&&!u(l)&&(a.checkForLeadingSpace=!0)}}a.prepopulatedChar=!0,a.character=d,a.characterType=e,a.isCharInvariant=f}},isDefinitelyNonEmpty:function(){var a=this.characterType;return a==ta||a==ua},resolveLeadingAndTrailingSpaces:function(){if(this.prepopulatedChar||this.prepopulateChar(),this.checkForTrailingSpace){var a=this.session.getNodeWrapper(this.node.childNodes[this.offset-1]).getTrailingSpace();a&&(this.isTrailingSpace=!0,this.character=a,this.characterType=va),this.checkForTrailingSpace=!1}if(this.checkForLeadingSpace){var b=this.session.getNodeWrapper(this.node.childNodes[this.offset]).getLeadingSpace();b&&(this.isLeadingSpace=!0,this.character=b,this.characterType=va),this.checkForLeadingSpace=!1}},getPrecedingUncollapsedPosition:function(a){for(var b,c=this;c=c.previousVisible();)if(b=c.getCharacter(a),""!==b)return c;return null},getCharacter:function(a){function b(){return n||(k=o.getPrecedingUncollapsedPosition(a),n=!0),k}this.resolveLeadingAndTrailingSpaces();var c,d=this.character,e=f(a.ignoreCharacters),g=""!==d&&e.indexOf(d)>-1;if(this.isCharInvariant)return c=g?"":d;var h=["character",a.includeSpaceBeforeBr,a.includeBlockContentTrailingSpace,a.includePreLineTrailingSpace,e].join("_"),i=this.cache.get(h);if(null!==i)return i;var j,k,l="",m=this.characterType==va,n=!1,o=this;return m&&(this.type==Ba?l="\n":" "==d&&(!b()||k.isTrailingSpace||"\n"==k.character||" "==k.character&&k.characterType==va)||("\n"==d&&this.isLeadingSpace?b()&&"\n"!=k.character&&(l="\n"):(j=this.nextUncollapsed(),j&&(j.isBr?this.type=ya:j.isTrailingSpace&&"\n"==j.character?this.type=xa:j.isLeadingSpace&&"\n"==j.character&&(this.type=wa),"\n"==j.character?(this.type!=ya||a.includeSpaceBeforeBr)&&(this.type!=wa||a.includeSpaceBeforeBlock)&&(this.type==xa&&j.isTrailingSpace&&!a.includeBlockContentTrailingSpace||(this.type!=za||j.type!=ta||a.includePreLineTrailingSpace)&&("\n"==d?j.isTrailingSpace?this.isTrailingSpace||this.isBr&&(j.type=Aa,b()&&k.isLeadingSpace&&!k.isTrailingSpace&&"\n"==k.character?j.character="":j.type=Ba):l="\n":" "==d&&(l=" "))):l=d)))),e.indexOf(l)>-1&&(l=""),this.cache.set(h,l),l},equals:function(a){return!!a&&this.node===a.node&&this.offset===a.offset},inspect:A,toString:function(){return this.character}};z.prototype=Ca,U(Ca,{next:x("nextPos",function(a){var b=a.nodeWrapper,c=a.node,d=a.offset,e=b.session;if(!c)return null;var f,g,h;return d==b.getLength()?(f=c.parentNode,g=f?b.getNodeIndex()+1:0):b.isCharacterDataNode()?(f=c,g=d+1):(h=c.childNodes[d],e.getNodeWrapper(h).containsPositions()?(f=h,g=0):(f=c,g=d+1)),f?e.getPosition(f,g):null}),previous:x("previous",function(a){var b,c,d,e=a.nodeWrapper,f=a.node,g=a.offset,h=e.session;return 0==g?(b=f.parentNode,c=b?e.getNodeIndex():0):e.isCharacterDataNode()?(b=f,c=g-1):(d=f.childNodes[g-1],h.getNodeWrapper(d).containsPositions()?(b=d,c=S.getNodeLength(d)):(b=f,c=g-1)),b?h.getPosition(b,c):null}),nextVisible:x("nextVisible",function(a){var b=a.next();if(!b)return null;var c=b.nodeWrapper,d=b.node,e=b;return c.isCollapsed()&&(e=c.session.getPosition(d.parentNode,c.getNodeIndex()+1)),e}),nextUncollapsed:x("nextUncollapsed",function(a){for(var b=a;b=b.nextVisible();)if(b.resolveLeadingAndTrailingSpaces(),""!==b.character)return b;return null}),previousVisible:x("previousVisible",function(a){var b=a.previous();if(!b)return null;var c=b.nodeWrapper,d=b.node,e=b;return c.isCollapsed()&&(e=c.session.getPosition(d.parentNode,c.getNodeIndex())),e})});var Da=null,Ea=function(){function a(a){var b=new w;return{get:function(c){var d=b.get(c[a]);if(d)for(var e,f=0;e=d[f++];)if(e.node===c)return e;return null},set:function(c){var d=c.node[a],e=b.get(d)||b.set(d,[]);e.push(c)}}}function b(){this.initCaches()}var c=T.isHostProperty(document.documentElement,"uniqueID");return b.prototype={initCaches:function(){this.elementCache=c?function(){var a=new w;return{get:function(b){return a.get(b.uniqueID)},set:function(b){a.set(b.node.uniqueID,b)}}}():a("tagName"),this.textNodeCache=a("data"),this.otherNodeCache=a("nodeName")},getNodeWrapper:function(a){var b;switch(a.nodeType){case 1:b=this.elementCache;break;case 3:b=this.textNodeCache;break;default:b=this.otherNodeCache}var c=b.get(a);return c||(c=new y(a,this),b.set(c)),c},getPosition:function(a,b){return this.getNodeWrapper(a).getPosition(b)},getRangeBoundaryPosition:function(a,b){var c=b?"start":"end";return this.getPosition(a[c+"Container"],a[c+"Offset"])},detach:function(){this.elementCache=this.textNodeCache=this.otherNodeCache=null}},b}();U(S,{nextNode:q,previousNode:r});var Fa=Array.prototype.indexOf?function(a,b){return a.indexOf(b)}:function(a,b){for(var c=0,d=a.length;d>c;++c)if(a[c]===b)return c;return-1};U(a.rangePrototype,{moveStart:M(!0,!1),moveEnd:M(!1,!1),move:M(!0,!0),trimStart:N(!0),trimEnd:N(!1),trim:L(function(a,b){var c=this.trimStart(b),d=this.trimEnd(b);return c||d}),expand:L(function(a,b,c){var d=!1;c=h(c,la);var e=c.characterOptions;if(b||(b=Q),b==R){var f,g,i=c.wordOptions,j=a.getRangeBoundaryPosition(this,!0),k=a.getRangeBoundaryPosition(this,!1),l=F(j,e,i),m=l.nextEndToken(),n=m.chars[0].previousVisible();if(this.collapsed)f=m;else{var o=F(k,e,i);f=o.previousStartToken()}return g=f.chars[f.chars.length-1],n.equals(j)||(this.setStart(n.node,n.offset),d=!0),g&&!g.equals(k)&&(this.setEnd(g.node,g.offset),d=!0),c.trim&&(c.trimStart&&(d=this.trimStart(e)||d),c.trimEnd&&(d=this.trimEnd(e)||d)),d}return this.moveEnd(Q,1,c)}),text:L(function(a,b){return this.collapsed?"":I(a,this,V(b,ga)).join("")}),selectCharacters:L(function(a,b,c,d,e){var f={characterOptions:e};b||(b=W(this.getDocument())),this.selectNodeContents(b),this.collapse(!0),this.moveStart("character",c,f),this.collapse(!0),this.moveEnd("character",d-c,f)}),toCharacterRange:L(function(a,b,c){b||(b=W(this.getDocument()));var d,e,f=b.parentNode,g=S.getNodeIndex(b),h=-1==S.comparePoints(this.startContainer,this.endContainer,f,g),i=this.cloneRange();return h?(i.setStartAndEnd(this.startContainer,this.startOffset,f,g),d=-i.text(c).length):(i.setStartAndEnd(f,g,this.startContainer,this.startOffset),d=i.text(c).length),e=d+this.text(c).length,{start:d,end:e}}),findText:L(function(b,c,d){d=h(d,ja),d.wholeWordsOnly&&(d.wordOptions.includeTrailingSpace=!1);var e=aa(d.direction),f=d.withinRange;f||(f=a.createRange(),f.selectNodeContents(this.getDocument()));var g=c,i=!1;"string"==typeof g?d.caseSensitive||(g=g.toLowerCase()):i=!0;var j=b.getRangeBoundaryPosition(this,!e),k=f.comparePoint(j.node,j.offset);-1===k?j=b.getRangeBoundaryPosition(f,!0):1===k&&(j=b.getRangeBoundaryPosition(f,!1));for(var l,m=j,n=!1;;)if(l=K(m,g,i,f,d)){if(l.valid)return this.setStartAndEnd(l.startPos.node,l.startPos.offset,l.endPos.node,l.endPos.offset),!0;m=e?l.startPos:l.endPos}else{if(!d.wrap||n)return!1;f=f.cloneRange(),m=b.getRangeBoundaryPosition(f,!e),f.setBoundary(j.node,j.offset,e),n=!0}}),pasteHtml:function(a){if(this.deleteContents(),a){var b=this.createContextualFragment(a),c=b.lastChild;this.insertNode(b),this.collapseAfter(c)}}}),U(a.selectionPrototype,{expand:L(function(a,b,c){this.changeEachRange(function(a){a.expand(b,c)})}),move:L(function(a,b,c,d){var e=0;if(this.focusNode){this.collapse(this.focusNode,this.focusOffset);var f=this.getRangeAt(0);d||(d={}),d.characterOptions=V(d.characterOptions,ha),e=f.move(b,c,d),this.setSingleRange(f)}return e}),trimStart:O("trimStart"),trimEnd:O("trimEnd"),trim:O("trim"),selectCharacters:L(function(b,c,d,e,f,g){var h=a.createRange(c);h.selectCharacters(c,d,e,g),this.setSingleRange(h,f)}),saveCharacterRanges:L(function(a,b,c){for(var d=this.getAllRanges(),e=d.length,f=[],g=1==e&&this.isBackward(),h=0,i=d.length;i>h;++h)f[h]={characterRange:d[h].toCharacterRange(b,c),backward:g,characterOptions:c};return f}),restoreCharacterRanges:L(function(b,c,d){this.removeAllRanges();for(var e,f,g,h=0,i=d.length;i>h;++h)f=d[h],g=f.characterRange,e=a.createRange(c),e.selectCharacters(c,g.start,g.end,f.characterOptions),this.addRange(e,f.backward)}),text:L(function(a,b){for(var c=[],d=0,e=this.rangeCount;e>d;++d)c[d]=this.getRangeAt(d).text(b);return c.join("")})}),a.innerText=function(b,c){var d=a.createRange(b);d.selectNodeContents(b);var e=d.text(c);return e},a.createWordIterator=function(a,b,c){var d=C();c=h(c,ma);var e=d.getPosition(a,b),f=F(e,c.characterOptions,c.wordOptions),g=aa(c.direction);return{next:function(){return g?f.previousStartToken():f.nextEndToken()},dispose:function(){f.dispose(),this.next=function(){}}}},a.noMutation=function(a){var b=C();a(b),D()},a.noMutation.createEntryPointFunction=L,a.textRange={isBlockNode:l,isCollapsedWhitespaceNode:t,createPosition:L(function(a,b,c){return a.getPosition(b,c)})}}),a},this),"undefined"!=typeof module&&"undefined"!=typeof exports&&module.exports===exports&&(module.exports="textAngular"),function(){"use strict";var a={ie:function(){for(var a,b=3,c=document.createElement("div"),d=c.getElementsByTagName("i");c.innerHTML="",d[0];);return b>4?b:a}(),webkit:/AppleWebKit\/([\d.]+)/i.test(navigator.userAgent)},b=!1;a.webkit&&(document.addEventListener("mousedown",function(a){var c=a||window.event,d=c.target;if(b&&null!==d){for(var e=!1,f=d;null!==f&&"html"!==f.tagName.toLowerCase()&&!e;)e="true"===f.contentEditable,f=f.parentNode;e||(document.getElementById("textAngular-editableFix-010203040506070809").setSelectionRange(0,0),d.focus(),d.select&&d.select())}b=!1},!1),angular.element(document).ready(function(){angular.element(document.body).append(angular.element(''))}));var c=/^(address|article|aside|audio|blockquote|canvas|dd|div|dl|fieldset|figcaption|figure|footer|form|h1|h2|h3|h4|h5|h6|header|hgroup|hr|noscript|ol|output|p|pre|section|table|tfoot|ul|video)$/i,d=/^(ul|li|ol)$/i,e=/^(address|article|aside|audio|blockquote|canvas|dd|div|dl|fieldset|figcaption|figure|footer|form|h1|h2|h3|h4|h5|h6|header|hgroup|hr|noscript|ol|output|p|pre|section|table|tfoot|ul|video|li)$/i;String.prototype.trim||(String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,"")});var f,g,h,i,j,k;if(a.ie>8||void 0===a.ie){for(var l=document.styleSheets,m=0;m
        ");return d[0].innerHTML=c,angular.forEach(a,function(a){var c=[];a.selector&&""!==a.selector?c=d.find(a.selector):a.customAttribute&&""!==a.customAttribute&&(c=b.getByAttribute(d,a.customAttribute)),angular.forEach(c,function(b){b=angular.element(b),a.selector&&""!==a.selector&&a.customAttribute&&""!==a.customAttribute?void 0!==b.attr(a.customAttribute)&&a.renderLogic(b):a.renderLogic(b)})}),d[0].innerHTML}}]).factory("taFixChrome",function(){var a=function(a){if(!a||!angular.isString(a)||a.length<=0)return a;for(var b,c,d,e=/<([^>\/]+?)style=("([^"]+)"|'([^']+)')([^>]*)>/gi,f="",g=0;b=e.exec(a);)c=b[3]||b[4],c&&c.match(/line-height: 1.[0-9]{3,12};|color: inherit; line-height: 1.1;/i)&&(c=c.replace(/( |)font-family: inherit;|( |)line-height: 1.[0-9]{3,12};|( |)color: inherit;/gi,""),d="<"+b[1].trim(),c.trim().length>0&&(d+=" style="+b[2].substring(0,1)+c+b[2].substring(0,1)),d+=b[5].trim()+">",f+=a.substring(g,b.index)+d,g=b.index+b[0].length);return f+=a.substring(g),g>0?f.replace(/(.*?)<\/span>(|)/gi,"$1"):a};return a}).factory("taSanitize",["$sanitize",function(a){function b(a,b){for(var c,d=0,e=0,f=/<[^>]*>/gi;c=f.exec(a);)if(e=c.index,"/"===c[0].substr(1,1)){if(0===d)break;d--}else d++;return b+a.substring(0,e)+angular.element(b)[0].outerHTML.substring(b.length)+a.substring(e)}function c(a){if(!a||!angular.isString(a)||a.length<=0)return a;for(var d,f,g,h,i,k,l=/<([^>\/]+?)style=("([^"]+)"|'([^']+)')([^>]*)>/gi,m="",n="",o=0;f=l.exec(a);){h=f[3]||f[4];var p=new RegExp(j,"i");if(angular.isString(h)&&p.test(h)){i="";for(var q=new RegExp(j,"ig");g=q.exec(h);)for(d=0;d");k=c(a.substring(o,f.index)),n+=m.length>0?b(k,m):k,h=h.replace(new RegExp(j,"ig"),""),n+="<"+f[1].trim(),h.length>0&&(n+=' style="'+h+'"'),n+=f[5]+">",o=f.index+f[0].length,m=i}}return n+=m.length>0?b(a.substring(o),m):a.substring(o)}function d(a){if(!a||!angular.isString(a)||a.length<=0)return a;for(var b,c=/<([^>\/]+?)align=("([^"]+)"|'([^']+)')([^>]*)>/gi,d="",e=0;b=c.exec(a);){d+=a.substring(e,b.index),e=b.index+b[0].length;var f="<"+b[1]+b[5];/style=("([^"]+)"|'([^']+)')/gi.test(f)?f=f.replace(/style=("([^"]+)"|'([^']+)')/i,'style="$2$3 text-align:'+(b[3]||b[4])+';"'):f+=' style="text-align:'+(b[3]||b[4])+';"',f+=">",d+=f}return d+a.substring(e)}for(var e=[{property:"font-weight",values:["bold"],tag:"b"},{property:"font-style",values:["italic"],tag:"i"}],f=[],g=0;g0&&(h+="|"),h+=e[g].values[i];h+=");)",f.push(h)}var j="("+f.join("|")+")";return function(b,e,f){if(!f)try{b=c(b)}catch(g){}b=d(b);var h;try{h=a(b),f&&(h=b)}catch(g){h=e||""}var i,j=h.match(/(]*>.*?<\/pre[^>]*>)/gi),k=h.replace(/(&#(9|10);)*/gi,""),l=/]*>.*?<\/pre[^>]*>/gi,m=0,n=0;for(h="";null!==(i=l.exec(k))&&m=0;e--)d=angular.element("<"+c+">"+f[e].innerHTML+""),b.after(d); +b.remove(),a.setSelectionToElementEnd(d[0])},g=function(b){/()$/i.test(b.innerHTML.trim())?a.setSelectionBeforeElement(angular.element(b).find("br")[0]):a.setSelectionToElementEnd(b)},h=function(a,b){var c=angular.element("<"+b+">"+a[0].innerHTML+"");a.after(c),a.remove(),g(c.find("li")[0])},i=function(a,c,d){for(var e="",f=0;f"+a[f].innerHTML+"";var h=angular.element("<"+d+">"+e+"");c.after(h),c.remove(),g(h.find("li")[0])};return function(g,j){return g=b(g),function(k,l,m,n){var o,p,q,r,s,t,u,v=angular.element("<"+g+">");try{u=a.getSelectionElement()}catch(w){}var x=angular.element(u);if(void 0!==u){var y=u.tagName.toLowerCase();if("insertorderedlist"===k.toLowerCase()||"insertunorderedlist"===k.toLowerCase()){var z=b("insertorderedlist"===k.toLowerCase()?"ol":"ul");if(y===z)return f(x,g);if("li"===y&&x.parent()[0].tagName.toLowerCase()===z&&1===x.parent().children().length)return f(x.parent(),g);if("li"===y&&x.parent()[0].tagName.toLowerCase()!==z&&1===x.parent().children().length)return h(x.parent(),z);if(y.match(c)&&!x.hasClass("ta-bind")){if("ol"===y||"ul"===y)return h(x,z);var A=!1;return angular.forEach(x.children(),function(a){a.tagName.match(c)&&(A=!0)}),A?i(x.children(),x,z):i([angular.element("
        "+u.innerHTML+"
        ")[0]],x,z)}if(y.match(c)){if(r=a.getOnlySelectedElements(),0===r.length)p=angular.element("<"+z+">
      • "+u.innerHTML+"
      • "),x.html(""),x.append(p);else{if(1===r.length&&("ol"===r[0].tagName.toLowerCase()||"ul"===r[0].tagName.toLowerCase()))return r[0].tagName.toLowerCase()===z?f(angular.element(r[0]),g):h(angular.element(r[0]),z);q="";var B=[];for(o=0;o"+C[0].innerHTML+"":C[0].childNodes[0].innerHTML,B.unshift(C)}p=angular.element("<"+z+">"+q+""),B.pop().replaceWith(p),angular.forEach(B,function(a){a.remove()})}return void a.setSelectionToElementEnd(p[0])}}else{if("formatblock"===k.toLowerCase()){for(t=m.toLowerCase().replace(/[<>]/gi,""),"default"===t.trim()&&(t=g,m="<"+g+">"),p="li"===y?x.parent():x;!p[0].tagName||!p[0].tagName.match(c)&&!p.parent().attr("contenteditable");)p=p.parent(),y=(p[0].tagName||"").toLowerCase();if(y===t){r=p.children();var D=!1;for(o=0;o=0;o--)r[o].parentNode&&r[o].parentNode.removeChild(r[o])}else for(o=0;o"),v[0].innerHTML=F[o].outerHTML,F[o]=v[0]),E.parent()[0].insertBefore(F[o],E[0]);E.remove()}return void a.setSelectionToElementEnd(p[0])}if("createlink"===k.toLowerCase()){var G='
        ',H="",I=a.getSelection();if(I.collapsed)a.insertHtml(G+m+H,j);else if(rangy.getSelection().getRangeAt(0).canSurroundContents()){var J=angular.element(G+H)[0];rangy.getSelection().getRangeAt(0).surroundContents(J)}return}if("inserthtml"===k.toLowerCase())return void a.insertHtml(m,j)}}try{e[0].execCommand(k,l,m)}catch(w){}}}}]).service("taSelection",["$window","$document","taDOM",function(a,b,d){var f=b[0],g=a.rangy,h=function(a,b){return a.tagName&&a.tagName.match(/^br$/i)&&0===b&&!a.previousSibling?{element:a.parentNode,offset:0}:{element:a,offset:b}},i={getSelection:function(){var a=g.getSelection().getRangeAt(0),b=a.commonAncestorContainer,c={start:h(a.startContainer,a.startOffset),end:h(a.endContainer,a.endOffset),collapsed:a.collapsed};return b=3===b.nodeType?b.parentNode:b,b.parentNode===c.start.element||b.parentNode===c.end.element?c.container=b.parentNode:c.container=b,c},getOnlySelectedElements:function(){var a=g.getSelection().getRangeAt(0),b=a.commonAncestorContainer;return b=3===b.nodeType?b.parentNode:b,a.getNodes([1],function(a){return a.parentNode===b})},getSelectionElement:function(){return i.getSelection().container},setSelection:function(a,b,c){var d=g.createRange();d.setStart(a,b),d.setEnd(a,c),g.getSelection().setSingleRange(d)},setSelectionBeforeElement:function(a){var b=g.createRange();b.selectNode(a),b.collapse(!0),g.getSelection().setSingleRange(b)},setSelectionAfterElement:function(a){var b=g.createRange();b.selectNode(a),b.collapse(!1),g.getSelection().setSingleRange(b)},setSelectionToElementStart:function(a){var b=g.createRange();b.selectNodeContents(a),b.collapse(!0),g.getSelection().setSingleRange(b)},setSelectionToElementEnd:function(a){var b=g.createRange();b.selectNodeContents(a),b.collapse(!1),a.childNodes&&a.childNodes[a.childNodes.length-1]&&"br"===a.childNodes[a.childNodes.length-1].nodeName&&(b.startOffset=b.endOffset=b.startOffset-1),g.getSelection().setSingleRange(b)},insertHtml:function(a,b){var h,j,k,l,m,n,o,p=angular.element("
        "+a+"
        "),q=g.getSelection().getRangeAt(0),r=f.createDocumentFragment(),s=p[0].childNodes,t=!0;if(s.length>0){for(l=[],k=0;k)$/i.test(q.startContainer.innerHTML)&&q.selectNode(q.startContainer)}else t=!0,n=r=f.createTextNode(a);if(t)q.deleteContents();else if(q.collapsed&&q.startContainer!==b)if(q.startContainer.innerHTML&&q.startContainer.innerHTML.match(/^<[^>]*>$/i))h=q.startContainer,1===q.startOffset?(q.setStartAfter(h),q.setEndAfter(h)):(q.setStartBefore(h),q.setEndBefore(h));else{if(3===q.startContainer.nodeType&&q.startContainer.parentNode!==b)for(h=q.startContainer.parentNode,j=h.cloneNode(),d.splitNodes(h.childNodes,h,j,q.startContainer,q.startOffset);!e.test(h.nodeName);){angular.element(h).after(j),h=h.parentNode;var v=j;j=h.cloneNode(),d.splitNodes(h.childNodes,h,j,v)}else h=q.startContainer,j=h.cloneNode(),d.splitNodes(h.childNodes,h,j,void 0,void 0,q.startOffset);if(angular.element(h).after(j),q.setStartAfter(h),q.setEndAfter(h),/^(|)$/i.test(h.innerHTML.trim())&&(q.setStartBefore(h),q.setEndBefore(h),angular.element(h).remove()),/^(|)$/i.test(j.innerHTML.trim())&&angular.element(j).remove(),"li"===h.nodeName.toLowerCase()){for(o=f.createDocumentFragment(),m=0;m"),d.transferChildNodes(r.childNodes[m],p[0]),d.transferNodeAttributes(r.childNodes[m],p[0]),o.appendChild(p[0]);r=o,n&&(n=r.childNodes[r.childNodes.length-1],n=n.childNodes[n.childNodes.length-1])}}else q.deleteContents();q.insertNode(r),n&&i.setSelectionToElementEnd(n)}};return i}]).service("taDOM",function(){var a={getByAttribute:function(b,c){var d=[],e=b.children();return e.length&&angular.forEach(e,function(b){d=d.concat(a.getByAttribute(angular.element(b),c))}),void 0!==b.attr(c)&&d.push(b),d},transferChildNodes:function(a,b){for(b.innerHTML="";a.childNodes.length>0;)b.appendChild(a.childNodes[0]);return b},splitNodes:function(b,c,d,e,f,g){if(!e&&isNaN(g))throw new Error("taDOM.splitNodes requires a splitNode or splitIndex");for(var h=document.createDocumentFragment(),i=document.createDocumentFragment(),j=0;b.length>0&&(isNaN(g)||g!==j)&&b[0]!==e;)h.appendChild(b[0]),j++;for(!isNaN(f)&&f>=0&&b[0]&&(h.appendChild(document.createTextNode(b[0].nodeValue.substring(0,f))),b[0].nodeValue=b[0].nodeValue.substring(f));b.length>0;)i.appendChild(b[0]);a.transferChildNodes(h,c),a.transferChildNodes(i,d)},transferNodeAttributes:function(a,b){for(var c=0;c");return b.html(a),b.text().length<=e}}}}).directive("taMinText",function(){return{restrict:"A",require:"ngModel",link:function(a,b,c,d){var e=parseInt(a.$eval(c.taMinText));if(isNaN(e))throw"Min text must be an integer";c.$observe("taMinText",function(a){if(e=parseInt(a),isNaN(e))throw"Min text must be an integer";d.$dirty&&d.$validate()}),d.$validators.taMinText=function(a){var b=angular.element("
        ");return b.html(a),!b.text().length||b.text().length>=e}}}}),angular.module("textAngular.taBind",["textAngular.factories","textAngular.DOM"]).service("_taBlankTest",[function(){var a=/<(a|abbr|acronym|bdi|bdo|big|cite|code|del|dfn|img|ins|kbd|label|map|mark|q|ruby|rp|rt|s|samp|time|tt|var)[^>]*(>|$)/i;return function(b){return function(c){if(!c)return!0;var d,e=/(^[^<]|>)[^<]/i.exec(c);return e?d=e.index:(c=c.toString().replace(/="[^"]*"/i,"").replace(/="[^"]*"/i,"").replace(/="[^"]*"/i,"").replace(/="[^"]*"/i,""),d=c.indexOf(">")),c=c.trim().substring(d,d+100),/^[^<>]+$/i.test(c)?!1:0===c.length||c===b||/^>(\s| )*<\/[^>]+>$/gi.test(c)?!0:/>\s*[^\s<]/i.test(c)||a.test(c)?!1:!0}}}]).directive("taButton",[function(){return{link:function(a,b,c){b.attr("unselectable","on"),b.on("mousedown",function(a,b){return b&&angular.extend(a,b),a.preventDefault(),!1})}}}]).directive("taBind",["taSanitize","$timeout","$window","$document","taFixChrome","taBrowserTag","taSelection","taSelectableElements","taApplyCustomRenderers","taOptions","_taBlankTest","$parse","taDOM","textAngularManager",function(d,f,i,j,k,l,m,o,p,q,r,s,t,u){return{priority:2,require:["ngModel","?ngModelOptions"],link:function(l,v,w,x){function y(a){var b;return R.forEach(function(c){if(c.keyCode===a.keyCode){var d=(a.metaKey?O:0)+(a.ctrlKey?N:0)+(a.shiftKey?Q:0)+(a.altKey?P:0);if(c.forbiddenModifiers&d)return;c.mustHaveModifiers.every(function(a){return d&a})&&(b=c.specialKey)}}),b}var z,A,B,C,D=x[0],E=x[1]||{},F=void 0!==v.attr("contenteditable")&&v.attr("contenteditable"),G=F||"textarea"===v[0].tagName.toLowerCase()||"input"===v[0].tagName.toLowerCase(),H=!1,I=!1,J=!1,K=w.taUnsafeSanitizer||q.disableSanitizer,L=/^(9|19|20|27|33|34|35|36|37|38|39|40|45|112|113|114|115|116|117|118|119|120|121|122|123|144|145)$/i,M=/^(8|13|32|46|59|61|107|109|173|186|187|188|189|190|191|192|219|220|221|222)$/i,N=1,O=2,P=4,Q=8,R=[{specialKey:"UndoKey",forbiddenModifiers:P+Q,mustHaveModifiers:[O+N],keyCode:90},{specialKey:"RedoKey",forbiddenModifiers:P,mustHaveModifiers:[O+N,Q],keyCode:90},{specialKey:"RedoKey",forbiddenModifiers:P+Q,mustHaveModifiers:[O+N],keyCode:89},{specialKey:"TabKey",forbiddenModifiers:O+Q+P+N,mustHaveModifiers:[],keyCode:9},{specialKey:"ShiftTabKey",forbiddenModifiers:O+P+N,mustHaveModifiers:[Q],keyCode:9}];void 0===w.taDefaultWrap&&(w.taDefaultWrap="p"),""===w.taDefaultWrap?(B="",C=void 0===a.ie?"

        ":a.ie>=11?"


        ":a.ie<=8?"

         

        ":"

         

        "):(B=void 0===a.ie||a.ie>=11?"<"+w.taDefaultWrap+">
        ":a.ie<=8?"<"+w.taDefaultWrap.toUpperCase()+">":"<"+w.taDefaultWrap+">",C=void 0===a.ie||a.ie>=11?"<"+w.taDefaultWrap+">
        ":a.ie<=8?"<"+w.taDefaultWrap.toUpperCase()+"> ":"<"+w.taDefaultWrap+"> "),E.$options||(E.$options={});var S=r(C),T=function(a){if(S(a))return a;var b=angular.element("
        "+a+"
        ");if(0===b.children().length)a="<"+w.taDefaultWrap+">"+a+"";else{var d,e=b[0].childNodes,f=!1;for(d=0;d";else if("#text"===h){var i=g.textContent;a+=i.trim()?"<"+w.taDefaultWrap+">"+i+"":i}else if(h.match(c))a+=g.outerHTML;else{var j=g.outerHTML||g.nodeValue;a+=""!==j.trim()?"<"+w.taDefaultWrap+">"+j+"":j}}else a="<"+w.taDefaultWrap+">"+a+""}return a};w.taPaste&&(A=s(w.taPaste)),v.addClass("ta-bind");var U;l["$undoManager"+(w.id||"")]=D.$undoManager={_stack:[],_index:0,_max:1e3,push:function(a){return"undefined"==typeof a||null===a||"undefined"!=typeof this.current()&&null!==this.current()&&a===this.current()?a:(this._indexthis._max&&this._stack.shift(),this._index=this._stack.length-1,a)},undo:function(){return this.setToIndex(this._index-1)},redo:function(){return this.setToIndex(this._index+1)},setToIndex:function(a){return 0>a||a>this._stack.length-1?void 0:(this._index=a,this.current())},current:function(){return this._stack[this._index]}};var V,W=l["$undoTaBind"+(w.id||"")]=function(){if(!H&&F){var a=D.$undoManager.undo();"undefined"!=typeof a&&null!==a&&(ka(a),Z(a,!1),V&&f.cancel(V),V=f(function(){v[0].focus(),m.setSelectionToElementEnd(v[0])},1))}},X=l["$redoTaBind"+(w.id||"")]=function(){if(!H&&F){var a=D.$undoManager.redo();"undefined"!=typeof a&&null!==a&&(ka(a),Z(a,!1),V&&f.cancel(V),V=f(function(){v[0].focus(),m.setSelectionToElementEnd(v[0])},1))}},Y=function(){if(F)return v[0].innerHTML;if(G)return v.val();throw"textAngular Error: attempting to update non-editable taBind"},Z=function(a,b,c){J=c||!1,("undefined"==typeof b||null===b)&&(b=F),("undefined"==typeof a||null===a)&&(a=Y()),S(a)?(""!==D.$viewValue&&D.$setViewValue(""),b&&""!==D.$undoManager.current()&&D.$undoManager.push("")):(ja(),D.$viewValue!==a&&(D.$setViewValue(a),b&&D.$undoManager.push(a))),D.$render()};l["updateTaBind"+(w.id||"")]=function(){H||Z(void 0,void 0,!0)};var $=function(a){return D.$oldViewValue=d(k(a),D.$oldViewValue,K)};if(v.attr("required")&&(D.$validators.required=function(a,b){return!S(a||b)}),D.$parsers.push($),D.$parsers.unshift(T),D.$formatters.push($),D.$formatters.unshift(T),D.$formatters.unshift(function(a){return D.$undoManager.push(a||"")}),G)if(l.events={},F){var _=!1,aa=function(a){if(a&&a.trim().length){if(a.match(/class=["']*Mso(Normal|List)/i)){var b=a.match(/([\s\S]*?)/i);b=b?b[1]:a,b=b.replace(/[\s\S]*?<\/o:p>/gi,"").replace(/class=(["']|)MsoNormal(["']|)/gi,"");var c=angular.element("
        "+b+"
        "),e=angular.element("
        "),g={element:null,lastIndent:[],lastLi:null,isUl:!1};g.lastIndent.peek=function(){var a=this.length;return a>0?this[a-1]:void 0};for(var h=function(a){g.isUl=a,g.element=angular.element(a?"
          ":"
            "),g.lastIndent=[],g.lastIndent.peek=function(){var a=this.length;return a>0?this[a-1]:void 0},g.lastLevelMatch=null},i=0;i<=c[0].childNodes.length;i++)if(c[0].childNodes[i]&&"#text"!==c[0].childNodes[i].nodeName&&"p"===c[0].childNodes[i].tagName.toLowerCase()){var j=angular.element(c[0].childNodes[i]),k=(j.attr("class")||"").match(/MsoList(Bullet|Number|Paragraph)(CxSp(First|Middle|Last)|)/i);if(k){if(j[0].childNodes.length<2||j[0].childNodes[1].childNodes.length<1)continue;var n="bullet"===k[1].toLowerCase()||"number"!==k[1].toLowerCase()&&!(/^[^0-9a-z<]*[0-9a-z]+[^0-9a-z<>]]":"
              "),g.lastLi.append(g.element);else if(null!=g.lastIndent.peek()&&g.lastIndent.peek()>p){for(;null!=g.lastIndent.peek()&&g.lastIndent.peek()>p;)if("li"!==g.element.parent()[0].tagName.toLowerCase()){if(!/[uo]l/i.test(g.element.parent()[0].tagName.toLowerCase()))break;g.element=g.element.parent(),g.lastIndent.pop()}else g.element=g.element.parent();g.isUl="ul"===g.element[0].tagName.toLowerCase(),n!==g.isUl&&(h(n),e.append(g.element))}g.lastLevelMatch=q,p!==g.lastIndent.peek()&&g.lastIndent.push(p),g.lastLi=angular.element("
            1. "),g.element.append(g.lastLi),g.lastLi.html(j.html().replace(/[\s\S]*?/gi,"")),j.remove()}else h(!1),e.append(j)}var r=function(a){a=angular.element(a);for(var b=a[0].childNodes.length-1;b>=0;b--)a.after(a[0].childNodes[b]);a.remove()};angular.forEach(e.find("span"),function(a){a.removeAttribute("lang"),a.attributes.length<=0&&r(a)}),angular.forEach(e.find("font"),r),a=e.html()}else{if(a=a.replace(/<(|\/)meta[^>]*?>/gi,""),a.match(/<[^>]*?(ta-bind)[^>]*?>/)){if(a.match(/<[^>]*?(text-angular)[^>]*?>/)){var s=angular.element("
              "+a+"
              ");s.find("textarea").remove();for(var u=t.getByAttribute(s,"ta-bind"),w=0;w',"")}}else a.match(/^.<\/span>/gi)||(a=a.replace(/<(|\/)span[^>]*?>/gi,"")));a=a.replace(/
              ]*?>/gi,"").replace(/( | )<\/span>/gi," ")}//i.test(a)&&/(|).*/i.test(a)===!1&&(a=a.replace(/.*<\/li(\s.*)?>/i,"
                $&
              ")),a=a.replace(/^[ |\u00A0]+/gm,function(a){for(var b="",c=0;c").replace(/\t/g,"    "),A&&(a=A(l,{$html:a})||a),a=d(a,"",K),m.insertHtml(a,v[0]),f(function(){D.$setViewValue(Y()),_=!1,v.removeClass("processing-paste")},0)}else _=!1,v.removeClass("processing-paste")};v.on("paste",l.events.paste=function(a,b){if(b&&angular.extend(a,b),H||_)return a.stopPropagation(),a.preventDefault(),!1;_=!0,v.addClass("processing-paste");var c,d=(a.originalEvent||a).clipboardData;if(d&&d.getData&&d.types.length>0){for(var e="",g=0;g
        ');j.find("body").append(k),k[0].focus(),f(function(){i.rangy.restoreSelection(h),aa(k[0].innerHTML),v[0].focus(),k.remove()},0)}),v.on("cut",l.events.cut=function(a){H?a.preventDefault():f(function(){D.$setViewValue(Y())},0)}),v.on("keydown",l.events.keydown=function(a,b){b&&angular.extend(a,b),a.specialKey=y(a);var c;if(q.keyMappings.forEach(function(b){a.specialKey===b.commandKeyCode&&(a.specialKey=void 0),b.testForKey(a)&&(c=b.commandKeyCode),("UndoKey"===b.commandKeyCode||"RedoKey"===b.commandKeyCode)&&(b.enablePropagation||a.preventDefault())}),"undefined"!=typeof c&&(a.specialKey=c),"undefined"==typeof a.specialKey||"UndoKey"===a.specialKey&&"RedoKey"===a.specialKey||(a.preventDefault(),u.sendKeyCommand(l,a)),!H&&("UndoKey"===a.specialKey&&(W(),a.preventDefault()),"RedoKey"===a.specialKey&&(X(),a.preventDefault()),13===a.keyCode&&!a.shiftKey)){var d,f=m.getSelectionElement();if(!f.tagName.match(e))return;var g=angular.element(B);if(/^$/i.test(f.innerHTML.trim())&&"blockquote"===f.parentNode.tagName.toLowerCase()&&!f.nextSibling){d=angular.element(f);var h=d.parent();h.after(g),d.remove(),0===h.children().length&&h.remove(),m.setSelectionToElementStart(g[0]),a.preventDefault()}else/^<[^>]+><\/[^>]+>$/i.test(f.innerHTML.trim())&&"blockquote"===f.tagName.toLowerCase()&&(d=angular.element(f),d.after(g),d.remove(),m.setSelectionToElementStart(g[0]),a.preventDefault())}});var ba;if(v.on("keyup",l.events.keyup=function(a,b){if(b&&angular.extend(a,b),9===a.keyCode){var c=m.getSelection();return void(c.start.element===v[0]&&v.children().length&&m.setSelectionToElementStart(v.children()[0]))}if(U&&f.cancel(U),!H&&!L.test(a.keyCode)){if(""!==B&&13===a.keyCode&&!a.shiftKey){for(var d=m.getSelectionElement();!d.tagName.match(e)&&d!==v[0];)d=d.parentNode;if(d.tagName.toLowerCase()!==w.taDefaultWrap&&"li"!==d.tagName.toLowerCase()&&(""===d.innerHTML.trim()||"
        "===d.innerHTML.trim())){var g=angular.element(B);angular.element(d).replaceWith(g),m.setSelectionToElementStart(g[0])}}var h=Y();""!==B&&""===h.trim()?(ka(B),m.setSelectionToElementStart(v.children()[0])):"<"!==h.substring(0,1)&&""!==w.taDefaultWrap;var i=z!==a.keyCode&&M.test(a.keyCode);ba&&f.cancel(ba),ba=f(function(){Z(h,i,!0)},E.$options.debounce||400),i||(U=f(function(){D.$undoManager.push(h)},250)),z=a.keyCode}}),v.on("blur",l.events.blur=function(){I=!1,H?(J=!0,D.$render()):Z(void 0,void 0,!0)}),w.placeholder&&(a.ie>8||void 0===a.ie)){var ca;if(!w.id)throw"textAngular Error: An unique ID is required for placeholders to work";ca=g("#"+w.id+".placeholder-text:before",'content: "'+w.placeholder+'"'),l.$on("$destroy",function(){h(ca)})}v.on("focus",l.events.focus=function(){I=!0,v.removeClass("placeholder-text"),ja()}),v.on("mouseup",l.events.mouseup=function(){var a=m.getSelection();a.start.element===v[0]&&v.children().length&&m.setSelectionToElementStart(v.children()[0])}),v.on("mousedown",l.events.mousedown=function(a,b){b&&angular.extend(a,b),a.stopPropagation()})}else{v.on("change blur",l.events.change=l.events.blur=function(){H||D.$setViewValue(Y())}),v.on("keydown",l.events.keydown=function(a,b){if(b&&angular.extend(a,b),9===a.keyCode){var c=this.selectionStart,d=this.selectionEnd,e=v.val();if(a.shiftKey){var f=e.lastIndexOf("\n",c),g=e.lastIndexOf(" ",c);-1!==g&&g>=f&&(v.val(e.substring(0,g)+e.substring(g+1)),this.selectionStart=this.selectionEnd=c-1)}else v.val(e.substring(0,c)+" "+e.substring(d)),this.selectionStart=this.selectionEnd=c+1;a.preventDefault()}});var da=function(a,b){for(var c="",d=0;b>d;d++)c+=a;return c},ea=function(a,b,c){for(var d=0;d"):"#text"===e?void(c+=d.textContent):void(d.outerHTML&&(c+="ul"===e||"ol"===e?"\n"+fa(d,b):"\n"+da(" ",b)+d.outerHTML))}),c+="\n"+da(" ",b-1)+a.outerHTML.substring(a.outerHTML.lastIndexOf("<"))};D.$formatters.unshift(function(a){var b=angular.element("
        "+a+"
        ")[0].childNodes;return b.length>0&&(a="",ea(b,function(b,c){var d=c.nodeName.toLowerCase();return"#comment"===d?void(a+=""):"#text"===d?void(a+=c.textContent):void(c.outerHTML&&(a.length>0&&(a+="\n"),a+="ul"===d||"ol"===d?""+fa(c,0):""+c.outerHTML))})),a})}var ga,ha=function(a){return l.$emit("ta-element-select",this),a.preventDefault(),!1},ia=function(a,b){if(b&&angular.extend(a,b),!n&&!H){n=!0;var c;c=a.originalEvent?a.originalEvent.dataTransfer:a.dataTransfer,l.$emit("ta-drop-event",this,a,c),f(function(){n=!1,Z(void 0,void 0,!0)},100)}},ja=l["reApplyOnSelectorHandlers"+(w.id||"")]=function(){H||angular.forEach(o,function(a){v.find(a).off("click",ha).on("click",ha)})},ka=function(a){v[0].innerHTML=a},la=!1;D.$render=function(){if(!la){la=!0;var a=D.$viewValue||"";J||(F&&I&&(v.removeClass("placeholder-text"),ga&&f.cancel(ga),ga=f(function(){I||(v[0].focus(),m.setSelectionToElementEnd(v.children()[v.children().length-1])),ga=void 0},1)),F?(ka(w.placeholder?""===a?B:a:""===a?B:a),H?v.off("drop",ia):(ja(),v.on("drop",ia))):"textarea"!==v[0].tagName.toLowerCase()&&"input"!==v[0].tagName.toLowerCase()?ka(p(a)):v.val(a)),F&&w.placeholder&&(""===a?I?v.removeClass("placeholder-text"):v.addClass("placeholder-text"):v.removeClass("placeholder-text")),la=J=!1}},w.taReadonly&&(H=l.$eval(w.taReadonly),H?(v.addClass("ta-readonly"),("textarea"===v[0].tagName.toLowerCase()||"input"===v[0].tagName.toLowerCase())&&v.attr("disabled","disabled"),void 0!==v.attr("contenteditable")&&v.attr("contenteditable")&&v.removeAttr("contenteditable")):(v.removeClass("ta-readonly"),"textarea"===v[0].tagName.toLowerCase()||"input"===v[0].tagName.toLowerCase()?v.removeAttr("disabled"):F&&v.attr("contenteditable","true")),l.$watch(w.taReadonly,function(a,b){b!==a&&(a?(v.addClass("ta-readonly"),("textarea"===v[0].tagName.toLowerCase()||"input"===v[0].tagName.toLowerCase())&&v.attr("disabled","disabled"),void 0!==v.attr("contenteditable")&&v.attr("contenteditable")&&v.removeAttr("contenteditable"),angular.forEach(o,function(a){v.find(a).on("click",ha)}),v.off("drop",ia)):(v.removeClass("ta-readonly"),"textarea"===v[0].tagName.toLowerCase()||"input"===v[0].tagName.toLowerCase()?v.removeAttr("disabled"):F&&v.attr("contenteditable","true"),angular.forEach(o,function(a){v.find(a).off("click",ha)}),v.on("drop",ia)),H=a)})),F&&!H&&(angular.forEach(o,function(a){v.find(a).on("click",ha)}),v.on("drop",ia),v.on("blur",function(){a.webkit&&(b=!0)}))}}}]);var n=!1,o=angular.module("textAngular",["ngSanitize","textAngularSetup","textAngular.factories","textAngular.DOM","textAngular.validators","textAngular.taBind"]);o.config([function(){angular.forEach(taTools,function(a,b){delete taTools[b]})}]),o.run([function(){if("function"==typeof define&&define.amd)define(function(a){window.rangy=a("rangy"),window.rangy.saveSelection=a("rangy/lib/rangy-selectionsaverestore")});else if("function"==typeof require&&"undefined"!=typeof module&&"object"==typeof exports)window.rangy=require("rangy"),window.rangy.saveSelection=require("rangy/lib/rangy-selectionsaverestore");else{if(!window.rangy)throw"rangy-core.js and rangy-selectionsaverestore.js are required for textAngular to work correctly, rangy-core is not yet loaded.";if(window.rangy.init(),!window.rangy.saveSelection)throw"rangy-selectionsaverestore.js is required for textAngular to work correctly."}}]),o.directive("textAngular",["$compile","$timeout","taOptions","taSelection","taExecCommand","textAngularManager","$window","$document","$animate","$log","$q","$parse",function(a,b,c,d,e,f,g,h,i,j,k,l){return{require:"?ngModel",scope:{},restrict:"EA",priority:2,link:function(m,n,o,p){var q,r,s,t,u,v,w,x,y,z,A,B=o.serial?o.serial:Math.floor(1e16*Math.random());m._name=o.name?o.name:"textAngularEditor"+B;var C=function(a,c,d){b(function(){var b=function(){a.off(c,b),d.apply(this,arguments)};a.on(c,b)},100)};if(y=e(o.taDefaultWrap),angular.extend(m,angular.copy(c),{wrapSelection:function(a,b,c){"undo"===a.toLowerCase()?m["$undoTaBindtaTextElement"+B]():"redo"===a.toLowerCase()?m["$redoTaBindtaTextElement"+B]():(y(a,!1,b,m.defaultTagAttributes),c&&m["reApplyOnSelectorHandlerstaTextElement"+B](),m.displayElements.text[0].focus())},showHtml:m.$eval(o.taShowHtml)||!1}),o.taFocussedClass&&(m.classes.focussed=o.taFocussedClass),o.taTextEditorClass&&(m.classes.textEditor=o.taTextEditorClass),o.taHtmlEditorClass&&(m.classes.htmlEditor=o.taHtmlEditorClass),o.taDefaultTagAttributes)try{angular.extend(m.defaultTagAttributes,angular.fromJson(o.taDefaultTagAttributes))}catch(D){j.error(D)}o.taTextEditorSetup&&(m.setup.textEditorSetup=m.$parent.$eval(o.taTextEditorSetup)),o.taHtmlEditorSetup&&(m.setup.htmlEditorSetup=m.$parent.$eval(o.taHtmlEditorSetup)),o.taFileDrop?m.fileDropHandler=m.$parent.$eval(o.taFileDrop):m.fileDropHandler=m.defaultFileDropHandler,w=n[0].innerHTML,n[0].innerHTML="",m.displayElements={forminput:angular.element(""),html:angular.element(""),text:angular.element("
        "),scrollWindow:angular.element("
        "),popover:angular.element('
        '),popoverArrow:angular.element('
        '),popoverContainer:angular.element('
        '),resize:{overlay:angular.element('
        '),background:angular.element('
        '),anchors:[angular.element('
        '),angular.element('
        '),angular.element('
        '),angular.element('
        ')],info:angular.element('
        ')}},m.displayElements.popover.append(m.displayElements.popoverArrow),m.displayElements.popover.append(m.displayElements.popoverContainer),m.displayElements.scrollWindow.append(m.displayElements.popover),m.displayElements.popover.on("mousedown",function(a,b){return b&&angular.extend(a,b),a.preventDefault(),!1}),m.showPopover=function(a){m.displayElements.popover.css("display","block"),m.reflowPopover(a),i.addClass(m.displayElements.popover,"in"),C(h.find("body"),"click keyup",function(){m.hidePopover()})},m.reflowPopover=function(a){m.displayElements.text[0].offsetHeight-51>a[0].offsetTop?(m.displayElements.popover.css("top",a[0].offsetTop+a[0].offsetHeight+m.displayElements.scrollWindow[0].scrollTop+"px"),m.displayElements.popover.removeClass("top").addClass("bottom")):(m.displayElements.popover.css("top",a[0].offsetTop-54+m.displayElements.scrollWindow[0].scrollTop+"px"),m.displayElements.popover.removeClass("bottom").addClass("top"));var b=m.displayElements.text[0].offsetWidth-m.displayElements.popover[0].offsetWidth,c=a[0].offsetLeft+a[0].offsetWidth/2-m.displayElements.popover[0].offsetWidth/2;m.displayElements.popover.css("left",Math.max(0,Math.min(b,c))+"px"),m.displayElements.popoverArrow.css("margin-left",Math.min(c,Math.max(0,c-b))-11+"px")},m.hidePopover=function(){m.displayElements.popover.css("display",""),m.displayElements.popoverContainer.attr("style",""),m.displayElements.popoverContainer.attr("class","popover-content"),m.displayElements.popover.removeClass("in")},m.displayElements.resize.overlay.append(m.displayElements.resize.background),angular.forEach(m.displayElements.resize.anchors,function(a){m.displayElements.resize.overlay.append(a)}),m.displayElements.resize.overlay.append(m.displayElements.resize.info),m.displayElements.scrollWindow.append(m.displayElements.resize.overlay),m.reflowResizeOverlay=function(a){a=angular.element(a)[0],m.displayElements.resize.overlay.css({display:"block",left:a.offsetLeft-5+"px",top:a.offsetTop-5+"px",width:a.offsetWidth+10+"px",height:a.offsetHeight+10+"px"}),m.displayElements.resize.info.text(a.offsetWidth+" x "+a.offsetHeight)},m.showResizeOverlay=function(a){var b=h.find("body");z=function(c){var d={width:parseInt(a.attr("width")),height:parseInt(a.attr("height")),x:c.clientX,y:c.clientY};(void 0===d.width||isNaN(d.width))&&(d.width=a[0].offsetWidth), +(void 0===d.height||isNaN(d.height))&&(d.height=a[0].offsetHeight),m.hidePopover();var e=d.height/d.width,f=function(b){function c(a){return Math.round(Math.max(0,a))}var f={x:Math.max(0,d.width+(b.clientX-d.x)),y:Math.max(0,d.height+(b.clientY-d.y))},g=void 0!==o.taResizeForceAspectRatio,h=o.taResizeMaintainAspectRatio,i=g||h&&!b.shiftKey;if(i){var j=f.y/f.x;f.x=e>j?f.x:f.y/e,f.y=e>j?f.x*e:f.y}var k=angular.element(a);k.css("height",c(f.y)+"px"),k.css("width",c(f.x)+"px"),m.reflowResizeOverlay(a)};b.on("mousemove",f),C(b,"mouseup",function(c){c.preventDefault(),c.stopPropagation(),b.off("mousemove",f),m.showPopover(a)}),c.stopPropagation(),c.preventDefault()},m.displayElements.resize.anchors[3].off("mousedown"),m.displayElements.resize.anchors[3].on("mousedown",z),m.reflowResizeOverlay(a),C(b,"click",function(){m.hideResizeOverlay()})},m.hideResizeOverlay=function(){m.displayElements.resize.anchors[3].off("mousedown",z),m.displayElements.resize.overlay.css("display","")},m.setup.htmlEditorSetup(m.displayElements.html),m.setup.textEditorSetup(m.displayElements.text),m.displayElements.html.attr({id:"taHtmlElement"+B,"ng-show":"showHtml","ta-bind":"ta-bind","ng-model":"html","ng-model-options":n.attr("ng-model-options")}),m.displayElements.text.attr({id:"taTextElement"+B,contentEditable:"true","ta-bind":"ta-bind","ng-model":"html","ng-model-options":n.attr("ng-model-options")}),m.displayElements.scrollWindow.attr({"ng-hide":"showHtml"}),o.taDefaultWrap&&m.displayElements.text.attr("ta-default-wrap",o.taDefaultWrap),o.taUnsafeSanitizer&&(m.displayElements.text.attr("ta-unsafe-sanitizer",o.taUnsafeSanitizer),m.displayElements.html.attr("ta-unsafe-sanitizer",o.taUnsafeSanitizer)),m.displayElements.scrollWindow.append(m.displayElements.text),n.append(m.displayElements.scrollWindow),n.append(m.displayElements.html),m.displayElements.forminput.attr("name",m._name),n.append(m.displayElements.forminput),o.tabindex&&(n.removeAttr("tabindex"),m.displayElements.text.attr("tabindex",o.tabindex),m.displayElements.html.attr("tabindex",o.tabindex)),o.placeholder&&(m.displayElements.text.attr("placeholder",o.placeholder),m.displayElements.html.attr("placeholder",o.placeholder)),o.taDisabled&&(m.displayElements.text.attr("ta-readonly","disabled"),m.displayElements.html.attr("ta-readonly","disabled"),m.disabled=m.$parent.$eval(o.taDisabled),m.$parent.$watch(o.taDisabled,function(a){m.disabled=a,m.disabled?n.addClass(m.classes.disabled):n.removeClass(m.classes.disabled)})),o.taPaste&&(m._pasteHandler=function(a){return l(o.taPaste)(m.$parent,{$html:a})},m.displayElements.text.attr("ta-paste","_pasteHandler($html)")),a(m.displayElements.scrollWindow)(m),a(m.displayElements.html)(m),m.updateTaBindtaTextElement=m["updateTaBindtaTextElement"+B],m.updateTaBindtaHtmlElement=m["updateTaBindtaHtmlElement"+B],n.addClass("ta-root"),m.displayElements.scrollWindow.addClass("ta-text ta-editor "+m.classes.textEditor),m.displayElements.html.addClass("ta-html ta-editor "+m.classes.htmlEditor),m._actionRunning=!1;var E=!1;if(m.startAction=function(){return m._actionRunning=!0,E=g.rangy.saveSelection(),function(){E&&g.rangy.restoreSelection(E)}},m.endAction=function(){m._actionRunning=!1,E&&(m.showHtml?m.displayElements.html[0].focus():m.displayElements.text[0].focus(),g.rangy.removeMarkers(E)),E=!1,m.updateSelectedStyles(),m.showHtml||m["updateTaBindtaTextElement"+B]()},u=function(){m.focussed=!0,n.addClass(m.classes.focussed),x.focus(),n.triggerHandler("focus")},m.displayElements.html.on("focus",u),m.displayElements.text.on("focus",u),v=function(a){return m._actionRunning||h[0].activeElement===m.displayElements.html[0]||h[0].activeElement===m.displayElements.text[0]||(n.removeClass(m.classes.focussed),x.unfocus(),b(function(){m._bUpdateSelectedStyles=!1,n.triggerHandler("blur"),m.focussed=!1},0)),a.preventDefault(),!1},m.displayElements.html.on("blur",v),m.displayElements.text.on("blur",v),m.displayElements.text.on("paste",function(a){n.triggerHandler("paste",a)}),m.queryFormatBlockState=function(a){return!m.showHtml&&a.toLowerCase()===h[0].queryCommandValue("formatBlock").toLowerCase()},m.queryCommandState=function(a){return m.showHtml?"":h[0].queryCommandState(a)},m.switchView=function(){m.showHtml=!m.showHtml,i.enabled(!1,m.displayElements.html),i.enabled(!1,m.displayElements.text),m.showHtml?b(function(){return i.enabled(!0,m.displayElements.html),i.enabled(!0,m.displayElements.text),m.displayElements.html[0].focus()},100):b(function(){return i.enabled(!0,m.displayElements.html),i.enabled(!0,m.displayElements.text),m.displayElements.text[0].focus()},100)},o.ngModel){var F=!0;p.$render=function(){if(F){F=!1;var a=m.$parent.$eval(o.ngModel);void 0!==a&&null!==a||!w||""===w||p.$setViewValue(w)}m.displayElements.forminput.val(p.$viewValue),m.html=p.$viewValue||""},n.attr("required")&&(p.$validators.required=function(a,b){var c=a||b;return!(!c||""===c.trim())})}else m.displayElements.forminput.val(w),m.html=w;if(m.$watch("html",function(a,b){a!==b&&(o.ngModel&&p.$viewValue!==a&&p.$setViewValue(a),m.displayElements.forminput.val(a))}),o.taTargetToolbars)x=f.registerEditor(m._name,m,o.taTargetToolbars.split(","));else{var G=angular.element('
        ');o.taToolbar&&G.attr("ta-toolbar",o.taToolbar),o.taToolbarClass&&G.attr("ta-toolbar-class",o.taToolbarClass),o.taToolbarGroupClass&&G.attr("ta-toolbar-group-class",o.taToolbarGroupClass),o.taToolbarButtonClass&&G.attr("ta-toolbar-button-class",o.taToolbarButtonClass),o.taToolbarActiveButtonClass&&G.attr("ta-toolbar-active-button-class",o.taToolbarActiveButtonClass),o.taFocussedClass&&G.attr("ta-focussed-class",o.taFocussedClass),n.prepend(G),a(G)(m.$parent),x=f.registerEditor(m._name,m,["textAngularToolbar"+B])}m.$on("$destroy",function(){f.unregisterEditor(m._name),angular.element(window).off("blur")}),m.$on("ta-element-select",function(a,b){x.triggerElementSelect(a,b)&&m["reApplyOnSelectorHandlerstaTextElement"+B]()}),m.$on("ta-drop-event",function(a,c,d,e){m.displayElements.text[0].focus(),e&&e.files&&e.files.length>0?(angular.forEach(e.files,function(a){try{k.when(m.fileDropHandler(a,m.wrapSelection)||m.fileDropHandler!==m.defaultFileDropHandler&&k.when(m.defaultFileDropHandler(a,m.wrapSelection))).then(function(){m["updateTaBindtaTextElement"+B]()})}catch(b){j.error(b)}}),d.preventDefault(),d.stopPropagation()):b(function(){m["updateTaBindtaTextElement"+B]()},0)}),m._bUpdateSelectedStyles=!1,angular.element(window).on("blur",function(){m._bUpdateSelectedStyles=!1,m.focussed=!1}),m.updateSelectedStyles=function(){var a;A&&b.cancel(A),void 0!==(a=d.getSelectionElement())&&a.parentNode!==m.displayElements.text[0]?x.updateSelectedStyles(angular.element(a)):x.updateSelectedStyles(),m._bUpdateSelectedStyles&&(A=b(m.updateSelectedStyles,200))},q=function(){return m.focussed?void(m._bUpdateSelectedStyles||(m._bUpdateSelectedStyles=!0,m.$apply(function(){m.updateSelectedStyles()}))):void(m._bUpdateSelectedStyles=!1)},m.displayElements.html.on("keydown",q),m.displayElements.text.on("keydown",q),r=function(){m._bUpdateSelectedStyles=!1},m.displayElements.html.on("keyup",r),m.displayElements.text.on("keyup",r),s=function(a,b){b&&angular.extend(a,b),m.$apply(function(){return x.sendKeyCommand(a)?(m._bUpdateSelectedStyles||m.updateSelectedStyles(),a.preventDefault(),!1):void 0})},m.displayElements.html.on("keypress",s),m.displayElements.text.on("keypress",s),t=function(){m._bUpdateSelectedStyles=!1,m.$apply(function(){m.updateSelectedStyles()})},m.displayElements.html.on("mouseup",t),m.displayElements.text.on("mouseup",t)}}}]),o.service("textAngularManager",["taToolExecuteAction","taTools","taRegisterTool",function(a,b,c){var d={},e={};return{registerEditor:function(c,f,g){if(!c||""===c)throw"textAngular Error: An editor requires a name";if(!f)throw"textAngular Error: An editor requires a scope";if(e[c])throw'textAngular Error: An Editor with name "'+c+'" already exists';var h=[];return angular.forEach(g,function(a){d[a]&&h.push(d[a])}),e[c]={scope:f,toolbars:g,_registerToolbar:function(a){this.toolbars.indexOf(a.name)>=0&&h.push(a)},editorFunctions:{disable:function(){angular.forEach(h,function(a){a.disabled=!0})},enable:function(){angular.forEach(h,function(a){a.disabled=!1})},focus:function(){angular.forEach(h,function(a){a._parent=f,a.disabled=!1,a.focussed=!0,f.focussed=!0})},unfocus:function(){angular.forEach(h,function(a){a.disabled=!0,a.focussed=!1}),f.focussed=!1},updateSelectedStyles:function(a){angular.forEach(h,function(b){angular.forEach(b.tools,function(c){c.activeState&&(b._parent=f,c.active=c.activeState(a))})})},sendKeyCommand:function(c){var d=!1;return(c.ctrlKey||c.metaKey||c.specialKey)&&angular.forEach(b,function(b,e){if(b.commandKeyCode&&(b.commandKeyCode===c.which||b.commandKeyCode===c.specialKey))for(var g=0;g0)for(var k=0;k"),b&&b["class"]?d.addClass(b["class"]):d.addClass(g.classes.toolbarButton),d.attr("name",c.name),d.attr("ta-button","ta-button"),d.attr("ng-disabled","isDisabled()"),d.attr("tabindex","-1"),d.attr("ng-click","executeAction()"),d.attr("ng-class","displayActiveToolClass(active)"),b&&b.tooltiptext&&d.attr("title",b.tooltiptext),b&&!b.display&&!c._display&&(d[0].innerHTML="",b.buttontext&&(d[0].innerHTML=b.buttontext),b.iconclass)){var e=angular.element(""),f=d[0].innerHTML;e.addClass(b.iconclass),d[0].innerHTML="",d.append(e),f&&""!==f&&d.append(" "+f)}return c._lastToolDefinition=angular.copy(b),a(d)(c)};g.tools={},g._parent={disabled:!0,showHtml:!1,queryFormatBlockState:function(){return!1},queryCommandState:function(){return!1}};var k={$window:f,$editor:function(){return g._parent},isDisabled:function(){return"function"!=typeof this.$eval("disabled")&&this.$eval("disabled")||this.$eval("disabled()")||"html"!==this.name&&this.$editor().showHtml||this.$parent.disabled||this.$editor().disabled},displayActiveToolClass:function(a){return a?g.classes.toolbarButtonActive:""},executeAction:e};angular.forEach(g.toolbar,function(a){var b=angular.element("
        ");b.addClass(g.classes.toolbarGroup),angular.forEach(a,function(a){g.tools[a]=angular.extend(g.$new(!0),d[a],k,{name:a}),g.tools[a].$element=j(d[a],g.tools[a]),b.append(g.tools[a].$element)}),h.append(b)}),g.updateToolDisplay=function(a,b,c){var d=g.tools[a];if(d){if(d._lastToolDefinition&&!c&&(b=angular.extend({},d._lastToolDefinition,b)),null===b.buttontext&&null===b.iconclass&&null===b.display)throw'textAngular Error: Tool Definition for updating "'+a+'" does not have a valid display/iconclass/buttontext value';null===b.buttontext&&delete b.buttontext,null===b.iconclass&&delete b.iconclass,null===b.display&&delete b.display;var e=j(b,d);d.$element.replaceWith(e),d.$element=e}},g.addTool=function(a,b,c,e){g.tools[a]=angular.extend(g.$new(!0),d[a],k,{name:a}),g.tools[a].$element=j(d[a],g.tools[a]);var f;void 0===c&&(c=g.toolbar.length-1),f=angular.element(h.children()[c]),void 0===e?(f.append(g.tools[a].$element),g.toolbar[c][g.toolbar[c].length-1]=a):(f.children().eq(e).after(g.tools[a].$element),g.toolbar[c][e]=a)},b.registerToolbar(g),g.$on("$destroy",function(){b.unregisterToolbar(g.name)})}}}])}(),function(a,b,c){"use strict";function d(){this.$get=["$$sanitizeUri",function(a){return function(b){"undefined"!=typeof arguments[1]&&(arguments[1].version="taSanitize");var c=[];return g(b,l(c,function(b,c){return!/^unsafe/.test(a(b,c))})),c.join("")}}]}function e(a){var c=[],d=l(c,b.noop);return d.chars(a),c.join("")}function f(a){var b,c={},d=a.split(",");for(b=0;b=0&&k[f]!=d;f--);if(f>=0){for(e=k.length-1;e>=f;e--)c.end&&c.end(k[e]);k.length=f}}"string"!=typeof a&&(a=null===a||"undefined"==typeof a?"":""+a);var f,g,i,j,k=[],l=a;for(k.last=function(){return k[k.length-1]};a;){if(j="",g=!0,k.last()&&G[k.last()])a=a.replace(new RegExp("([^]*)<\\s*\\/\\s*"+k.last()+"[^>]*>","i"),function(a,b){return b=b.replace(s,"$1").replace(v,"$1"),c.chars&&c.chars(h(b)),""}),e("",k.last());else{if(y.test(a)){if(i=a.match(y)){i[0];c.whitespace&&c.whitespace(i[0]),a=a.replace(i[0],""),g=!1}}else t.test(a)?(i=a.match(t),i&&(c.comment&&c.comment(i[1]),a=a.replace(i[0],""),g=!1)):u.test(a)?(i=a.match(u),i&&(a=a.replace(i[0],""),g=!1)):r.test(a)?(i=a.match(o),i&&(a=a.substring(i[0].length),i[0].replace(o,e),g=!1)):q.test(a)&&(i=a.match(n),i?(i[4]&&(a=a.substring(i[0].length),i[0].replace(n,d)),g=!1):(j+="<",a=a.substring(1)));g&&(f=a.indexOf("<"),j+=0>f?a:a.substring(0,f),a=0>f?"":a.substring(f),c.chars&&c.chars(h(j)))}if(a==l)throw m("badparse","The sanitizer was unable to parse the following block of html: {0}",a);l=a}e()}function h(a){if(!a)return"";var b=N.exec(a),c=b[1],d=b[3],e=b[2];return e&&(M.innerHTML=e.replace(/=b||173==b||b>=1536&&1540>=b||1807==b||6068==b||6069==b||b>=8204&&8207>=b||b>=8232&&8239>=b||b>=8288&&8303>=b||65279==b||b>=65520&&65535>=b?"&#"+b+";":a}).replace(//g,">")}function j(a){var c="",d=a.split(";");return b.forEach(d,function(a){var d=a.split(":");if(2==d.length){var e=O(b.lowercase(d[0])),a=O(b.lowercase(d[1]));(("color"===e||"background-color"===e)&&(a.match(/^rgb\([0-9%,\. ]*\)$/i)||a.match(/^rgba\([0-9%,\. ]*\)$/i)||a.match(/^hsl\([0-9%,\. ]*\)$/i)||a.match(/^hsla\([0-9%,\. ]*\)$/i)||a.match(/^#[0-9a-f]{3,6}$/i)||a.match(/^[a-z]*$/i))||"text-align"===e&&("left"===a||"right"===a||"center"===a||"justify"===a)||"float"===e&&("left"===a||"right"===a||"none"===a)||("width"===e||"height"===e)&&a.match(/[0-9\.]*(px|em|rem|%)/)||"direction"===e&&a.match(/^ltr|rtl|initial|inherit$/))&&(c+=e+": "+a+";")}}),c}function k(a,b,c,d){return"img"===a&&b["ta-insert-video"]&&("ta-insert-video"===c||"allowfullscreen"===c||"frameborder"===c||"contenteditable"===c&&"false"===d)?!0:!1}function l(a,c){var d=!1,e=b.bind(a,a.push);return{start:function(a,f,g){a=b.lowercase(a),!d&&G[a]&&(d=a),d||H[a]!==!0||(e("<"),e(a),b.forEach(f,function(d,g){var h=b.lowercase(g),l="img"===a&&"src"===h||"background"===h;("style"===h&&""!==(d=j(d))||k(a,f,h,d)||L[h]===!0&&(I[h]!==!0||c(d,l)))&&(e(" "),e(g),e('="'),e(i(d)),e('"'))}),e(g?"/>":">"))},comment:function(a){e(a)},whitespace:function(a){e(i(a))},end:function(a){a=b.lowercase(a),d||H[a]!==!0||(e("")),a==d&&(d=!1)},chars:function(a){d||e(i(a))}}}var m=b.$$minErr("$sanitize"),n=/^<((?:[a-zA-Z])[\w:-]*)((?:\s+[\w:-]+(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)\s*(>?)/,o=/^<\/\s*([\w:-]+)[^>]*>/,p=/([\w:-]+)(?:\s*=\s*(?:(?:"((?:[^"])*)")|(?:'((?:[^'])*)')|([^>\s]+)))?/g,q=/^/g,t=/(^)/,u=/]*?)>/i,v=//g,w=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,x=/([^\#-~| |!])/g,y=/^(\s+)/,z=f("area,br,col,hr,img,wbr,input"),A=f("colgroup,dd,dt,li,p,tbody,td,tfoot,th,thead,tr"),B=f("rp,rt"),C=b.extend({},B,A),D=b.extend({},A,f("address,article,aside,blockquote,caption,center,del,dir,div,dl,figure,figcaption,footer,h1,h2,h3,h4,h5,h6,header,hgroup,hr,ins,map,menu,nav,ol,pre,script,section,table,ul")),E=b.extend({},B,f("a,abbr,acronym,b,bdi,bdo,big,br,cite,code,del,dfn,em,font,i,img,ins,kbd,label,map,mark,q,ruby,rp,rt,s,samp,small,span,strike,strong,sub,sup,time,tt,u,var")),F=f("animate,animateColor,animateMotion,animateTransform,circle,defs,desc,ellipse,font-face,font-face-name,font-face-src,g,glyph,hkern,image,linearGradient,line,marker,metadata,missing-glyph,mpath,path,polygon,polyline,radialGradient,rect,set,stop,svg,switch,text,title,tspan,use"),G=f("script,style"),H=b.extend({},z,D,E,C,F),I=f("background,cite,href,longdesc,src,usemap,xlink:href"),J=f("abbr,align,alt,axis,bgcolor,border,cellpadding,cellspacing,class,clear,color,cols,colspan,compact,coords,dir,face,headers,height,hreflang,hspace,id,ismap,lang,language,nohref,nowrap,rel,rev,rows,rowspan,rules,scope,scrolling,shape,size,span,start,summary,target,title,type,valign,value,vspace,width"),K=f("accent-height,accumulate,additive,alphabetic,arabic-form,ascent,attributeName,attributeType,baseProfile,bbox,begin,by,calcMode,cap-height,class,color,color-rendering,content,cx,cy,d,dx,dy,descent,display,dur,end,fill,fill-rule,font-family,font-size,font-stretch,font-style,font-variant,font-weight,from,fx,fy,g1,g2,glyph-name,gradientUnits,hanging,height,horiz-adv-x,horiz-origin-x,ideographic,k,keyPoints,keySplines,keyTimes,lang,marker-end,marker-mid,marker-start,markerHeight,markerUnits,markerWidth,mathematical,max,min,offset,opacity,orient,origin,overline-position,overline-thickness,panose-1,path,pathLength,points,preserveAspectRatio,r,refX,refY,repeatCount,repeatDur,requiredExtensions,requiredFeatures,restart,rotate,rx,ry,slope,stemh,stemv,stop-color,stop-opacity,strikethrough-position,strikethrough-thickness,stroke,stroke-dasharray,stroke-dashoffset,stroke-linecap,stroke-linejoin,stroke-miterlimit,stroke-opacity,stroke-width,systemLanguage,target,text-anchor,to,transform,type,u1,u2,underline-position,underline-thickness,unicode,unicode-range,units-per-em,values,version,viewBox,visibility,width,widths,x,x-height,x1,x2,xlink:actuate,xlink:arcrole,xlink:role,xlink:show,xlink:title,xlink:type,xml:base,xml:lang,xml:space,xmlns,xmlns:xlink,y,y1,y2,zoomAndPan"),L=b.extend({},I,K,J),M=document.createElement("pre"),N=/^(\s*)([\s\S]*?)(\s*)$/,O=function(){return String.prototype.trim?function(a){return b.isString(a)?a.trim():a}:function(a){return b.isString(a)?a.replace(/^\s\s*/,"").replace(/\s\s*$/,""):a}}();b.module("ngSanitize",[]).provider("$sanitize",d),b.module("ngSanitize").filter("linky",["$sanitize",function(a){var c=/((ftp|https?):\/\/|(www\.)|(mailto:)?[A-Za-z0-9._%+-]+@)\S*[^\s.;,(){}<>"”’]/,d=/^mailto:/;return function(f,g){function h(a){a&&n.push(e(a))}function i(a,c){n.push("'),h(c),n.push("")}if(!f)return f;for(var j,k,l,m=f,n=[];j=m.match(c);)k=j[0],j[2]||j[4]||(k=(j[3]?"http://":"mailto:")+k),l=j.index,h(m.substr(0,l)),i(k,j[0].replace(d,"")),m=m.substring(l+j[0].length);return h(m),a(n.join(""))}}])}(window,window.angular);var taTools={};angular.module("textAngularSetup",[]).constant("taRegisterTool",registerTextAngularTool).value("taTools",taTools).value("taOptions",{forceTextAngularSanitize:!0,keyMappings:[],toolbar:[["h1","h2","h3","h4","h5","h6","p","pre","quote"],["bold","italics","underline","strikeThrough","ul","ol","redo","undo","clear"],["justifyLeft","justifyCenter","justifyRight","justifyFull","indent","outdent"],["html","insertImage","insertLink","insertVideo","wordcount","charcount"]],classes:{focussed:"focussed",toolbar:"btn-toolbar",toolbarGroup:"btn-group",toolbarButton:"btn btn-default",toolbarButtonActive:"active",disabled:"disabled",textEditor:"form-control",htmlEditor:"form-control"},defaultTagAttributes:{a:{target:""}},setup:{textEditorSetup:function(a){},htmlEditorSetup:function(a){}},defaultFileDropHandler:function(a,b){var c=new FileReader;return"image"===a.type.substring(0,5)?(c.onload=function(){""!==c.result&&b("insertImage",c.result,!0)},c.readAsDataURL(a),!0):!1}}).value("taSelectableElements",["a","img"]).value("taCustomRenderers",[{selector:"img",customAttribute:"ta-insert-video",renderLogic:function(a){var b=angular.element(""),c=a.prop("attributes");angular.forEach(c,function(a){b.attr(a.name,a.value)}),b.attr("src",b.attr("ta-insert-video")),a.replaceWith(b)}}]).value("taTranslations",{html:{tooltip:"Toggle html / Rich Text"},heading:{tooltip:"Heading "},p:{tooltip:"Paragraph"},pre:{tooltip:"Preformatted text"},ul:{tooltip:"Unordered List"},ol:{tooltip:"Ordered List"},quote:{tooltip:"Quote/unquote selection or paragraph"},undo:{tooltip:"Undo"},redo:{tooltip:"Redo"},bold:{tooltip:"Bold"},italic:{tooltip:"Italic"},underline:{tooltip:"Underline"},strikeThrough:{tooltip:"Strikethrough"},justifyLeft:{tooltip:"Align text left"},justifyRight:{tooltip:"Align text right"},justifyFull:{tooltip:"Justify text"},justifyCenter:{tooltip:"Center"},indent:{tooltip:"Increase indent"},outdent:{tooltip:"Decrease indent"},clear:{tooltip:"Clear formatting"},insertImage:{dialogPrompt:"Please enter an image URL to insert",tooltip:"Insert image",hotkey:"the - possibly language dependent hotkey ... for some future implementation"},insertVideo:{tooltip:"Insert video",dialogPrompt:"Please enter a youtube URL to embed"},insertLink:{tooltip:"Insert / edit link",dialogPrompt:"Please enter a URL to insert"},editLink:{reLinkButton:{tooltip:"Relink"},unLinkButton:{tooltip:"Unlink"},targetToggle:{buttontext:"Open in New Window"}},wordcount:{tooltip:"Display words Count"},charcount:{tooltip:"Display characters Count"}}).factory("taToolFunctions",["$window","taTranslations",function(a,b){return{imgOnSelectAction:function(a,b,c){var d=function(){c.updateTaBindtaTextElement(),c.hidePopover()};a.preventDefault(),c.displayElements.popover.css("width","375px");var e=c.displayElements.popoverContainer;e.empty();var f=angular.element('
        '),g=angular.element('');g.on("click",function(a){a.preventDefault(),b.css({width:"100%",height:""}),d()});var h=angular.element('');h.on("click",function(a){a.preventDefault(),b.css({width:"50%",height:""}),d()});var i=angular.element('');i.on("click",function(a){a.preventDefault(),b.css({width:"25%",height:""}),d()});var j=angular.element('');j.on("click",function(a){a.preventDefault(),b.css({width:"",height:""}),d()}),f.append(g),f.append(h),f.append(i),f.append(j),e.append(f),f=angular.element('
        ');var k=angular.element('');k.on("click",function(a){a.preventDefault(),b.css("float","left"),b.css("cssFloat","left"),b.css("styleFloat","left"),d()});var l=angular.element('');l.on("click",function(a){a.preventDefault(),b.css("float","right"),b.css("cssFloat","right"),b.css("styleFloat","right"),d()});var m=angular.element('');m.on("click",function(a){a.preventDefault(),b.css("float",""),b.css("cssFloat",""),b.css("styleFloat",""),d()}),f.append(k),f.append(m),f.append(l),e.append(f),f=angular.element('
        ');var n=angular.element('');n.on("click",function(a){a.preventDefault(),b.remove(),d()}),f.append(n),e.append(f),c.showPopover(b),c.showResizeOverlay(b)},aOnSelectAction:function(c,d,e){c.preventDefault(),e.displayElements.popover.css("width","436px");var f=e.displayElements.popoverContainer;f.empty(),f.css("line-height","28px");var g=angular.element(''+d.attr("href")+"");g.css({display:"inline-block","max-width":"200px",overflow:"hidden","text-overflow":"ellipsis","white-space":"nowrap","vertical-align":"middle"}),f.append(g);var h=angular.element('
        '),i=angular.element('');i.on("click",function(c){c.preventDefault();var f=a.prompt(b.insertLink.dialogPrompt,d.attr("href"));f&&""!==f&&"http://"!==f&&(d.attr("href",f),e.updateTaBindtaTextElement()),e.hidePopover()}),h.append(i);var j=angular.element('');j.on("click",function(a){a.preventDefault(),d.replaceWith(d.contents()),e.updateTaBindtaTextElement(),e.hidePopover()}),h.append(j);var k=angular.element('");"_blank"===d.attr("target")&&k.addClass("active"),k.on("click",function(a){a.preventDefault(),d.attr("target","_blank"===d.attr("target")?"":"_blank"),k.toggleClass("active"),e.updateTaBindtaTextElement()}),h.append(k),f.append(h),e.showPopover(d)},extractYoutubeVideoId:function(a){var b=/(?:youtube(?:-nocookie)?\.com\/(?:[^\/\n\s]+\/\S+\/|(?:v|e(?:mbed)?)\/|\S*?[?&]v=)|youtu\.be\/)([a-zA-Z0-9_-]{11})/i,c=a.match(b);return c&&c[1]||null}}}]).run(["taRegisterTool","$window","taTranslations","taSelection","taToolFunctions","$sanitize","taOptions",function(a,b,c,d,e,f,g){var h={};if(f("",h),g.forceTextAngularSanitize===!0&&"taSanitize"!==h.version)throw angular.$$minErr("textAngular")("textAngularSetup","The textAngular-sanitize provider has been replaced by another -- have you included angular-sanitize by mistake?");a("html",{iconclass:"fa fa-code",tooltiptext:c.html.tooltip,action:function(){this.$editor().switchView()},activeState:function(){return this.$editor().showHtml}});var i=function(a){return function(){return this.$editor().queryFormatBlockState(a)}},j=function(){return this.$editor().wrapSelection("formatBlock","<"+this.name.toUpperCase()+">")};angular.forEach(["h1","h2","h3","h4","h5","h6"],function(b){a(b.toLowerCase(),{buttontext:b.toUpperCase(),tooltiptext:c.heading.tooltip+b.charAt(1),action:j,activeState:i(b.toLowerCase())})}),a("p",{buttontext:"P",tooltiptext:c.p.tooltip,action:function(){return this.$editor().wrapSelection("formatBlock","

        ")},activeState:function(){return this.$editor().queryFormatBlockState("p")}}),a("pre",{buttontext:"pre",tooltiptext:c.pre.tooltip,action:function(){return this.$editor().wrapSelection("formatBlock","

        ")},activeState:function(){return this.$editor().queryFormatBlockState("pre")}}),a("ul",{iconclass:"fa fa-list-ul",tooltiptext:c.ul.tooltip,action:function(){return this.$editor().wrapSelection("insertUnorderedList",null)},activeState:function(){return this.$editor().queryCommandState("insertUnorderedList")}}),a("ol",{iconclass:"fa fa-list-ol",tooltiptext:c.ol.tooltip,action:function(){return this.$editor().wrapSelection("insertOrderedList",null)},activeState:function(){return this.$editor().queryCommandState("insertOrderedList")}}),a("quote",{iconclass:"fa fa-quote-right",tooltiptext:c.quote.tooltip,action:function(){return this.$editor().wrapSelection("formatBlock","
        ")},activeState:function(){return this.$editor().queryFormatBlockState("blockquote"); +}}),a("undo",{iconclass:"fa fa-undo",tooltiptext:c.undo.tooltip,action:function(){return this.$editor().wrapSelection("undo",null)}}),a("redo",{iconclass:"fa fa-repeat",tooltiptext:c.redo.tooltip,action:function(){return this.$editor().wrapSelection("redo",null)}}),a("bold",{iconclass:"fa fa-bold",tooltiptext:c.bold.tooltip,action:function(){return this.$editor().wrapSelection("bold",null)},activeState:function(){return this.$editor().queryCommandState("bold")},commandKeyCode:98}),a("justifyLeft",{iconclass:"fa fa-align-left",tooltiptext:c.justifyLeft.tooltip,action:function(){return this.$editor().wrapSelection("justifyLeft",null)},activeState:function(a){if(a&&"#document"===a.nodeName)return!1;var b=!1;return a&&(b="left"===a.css("text-align")||"left"===a.attr("align")||"right"!==a.css("text-align")&&"center"!==a.css("text-align")&&"justify"!==a.css("text-align")&&!this.$editor().queryCommandState("justifyRight")&&!this.$editor().queryCommandState("justifyCenter")&&!this.$editor().queryCommandState("justifyFull")),b=b||this.$editor().queryCommandState("justifyLeft")}}),a("justifyRight",{iconclass:"fa fa-align-right",tooltiptext:c.justifyRight.tooltip,action:function(){return this.$editor().wrapSelection("justifyRight",null)},activeState:function(a){if(a&&"#document"===a.nodeName)return!1;var b=!1;return a&&(b="right"===a.css("text-align")),b=b||this.$editor().queryCommandState("justifyRight")}}),a("justifyFull",{iconclass:"fa fa-align-justify",tooltiptext:c.justifyFull.tooltip,action:function(){return this.$editor().wrapSelection("justifyFull",null)},activeState:function(a){var b=!1;return a&&(b="justify"===a.css("text-align")),b=b||this.$editor().queryCommandState("justifyFull")}}),a("justifyCenter",{iconclass:"fa fa-align-center",tooltiptext:c.justifyCenter.tooltip,action:function(){return this.$editor().wrapSelection("justifyCenter",null)},activeState:function(a){if(a&&"#document"===a.nodeName)return!1;var b=!1;return a&&(b="center"===a.css("text-align")),b=b||this.$editor().queryCommandState("justifyCenter")}}),a("indent",{iconclass:"fa fa-indent",tooltiptext:c.indent.tooltip,action:function(){return this.$editor().wrapSelection("indent",null)},activeState:function(){return this.$editor().queryFormatBlockState("blockquote")},commandKeyCode:"TabKey"}),a("outdent",{iconclass:"fa fa-outdent",tooltiptext:c.outdent.tooltip,action:function(){return this.$editor().wrapSelection("outdent",null)},activeState:function(){return!1},commandKeyCode:"ShiftTabKey"}),a("italics",{iconclass:"fa fa-italic",tooltiptext:c.italic.tooltip,action:function(){return this.$editor().wrapSelection("italic",null)},activeState:function(){return this.$editor().queryCommandState("italic")},commandKeyCode:105}),a("underline",{iconclass:"fa fa-underline",tooltiptext:c.underline.tooltip,action:function(){return this.$editor().wrapSelection("underline",null)},activeState:function(){return this.$editor().queryCommandState("underline")},commandKeyCode:117}),a("strikeThrough",{iconclass:"fa fa-strikethrough",tooltiptext:c.strikeThrough.tooltip,action:function(){return this.$editor().wrapSelection("strikeThrough",null)},activeState:function(){return document.queryCommandState("strikeThrough")}}),a("clear",{iconclass:"fa fa-ban",tooltiptext:c.clear.tooltip,action:function(a,b){var c;this.$editor().wrapSelection("removeFormat",null);var e=angular.element(d.getSelectionElement()),f=function(a){a=angular.element(a);var b=a;angular.forEach(a.children(),function(a){var c=angular.element("

        ");c.html(angular.element(a).html()),b.after(c),b=c}),a.remove()};if(angular.forEach(e.find("ul"),f),angular.forEach(e.find("ol"),f),"li"===e[0].tagName.toLowerCase()){var g=e[0].parentNode.childNodes,h=[],i=[],j=!1;for(c=0;c

        ");if(l.html(angular.element(e[0]).html()),0===h.length||0===i.length)0===i.length?k.after(l):k[0].parentNode.insertBefore(l[0],k[0]),0===h.length&&0===i.length?k.remove():angular.element(e[0]).remove();else{var m=angular.element("<"+k[0].tagName+">"),n=angular.element("<"+k[0].tagName+">");for(c=0;c';return this.$editor().wrapSelection("insertHTML",f,!0)}},onElementSelect:{element:"img",onlyWithAttrs:["ta-insert-video"],action:e.imgOnSelectAction}}),a("insertLink",{tooltiptext:c.insertLink.tooltip,iconclass:"fa fa-link",action:function(){var a;return a=b.prompt(c.insertLink.dialogPrompt,"http://"),a&&""!==a&&"http://"!==a?this.$editor().wrapSelection("createLink",a,!0):void 0},activeState:function(a){return a?"A"===a[0].tagName:!1},onElementSelect:{element:"a",action:e.aOnSelectAction}}),a("wordcount",{display:'
        Words:
        ',disabled:!0,wordcount:0,activeState:function(){var a=this.$editor().displayElements.text,b=a[0].innerHTML||"",c=0;return""!==b.replace(/\s*<[^>]*?>\s*/g,"")&&(c=b.replace(/<\/?(b|i|em|strong|span|u|strikethrough|a|img|small|sub|sup|label)( [^>*?])?>/gi,"").replace(/(<[^>]*?>\s*<[^>]*?>)/gi," ").replace(/(<[^>]*?>)/gi,"").replace(/\s+/gi," ").match(/\S+/g).length),this.wordcount=c,this.$editor().wordcount=c,!1}}),a("charcount",{display:'
        Characters:
        ',disabled:!0,charcount:0,activeState:function(){var a=this.$editor().displayElements.text,b=a[0].innerText||a[0].textContent,c=b.replace(/(\r\n|\n|\r)/gm,"").replace(/^\s+/g," ").replace(/\s+$/g," ").length;return this.charcount=c,this.$editor().charcount=c,!1}})}]),function(){"use strict";function a(a){return("0"+a).slice(-2)}function b(c,d){var e=c.getDay(),f=c.getDate(),g=c.getMonth(),h=c.getFullYear(),i=c.getHours(),l=c.getMinutes(),m=c.getSeconds();return d.replace(/%([%aAbBcdeHIlmMpPSwyYZz])/g,function(d){var n,o=d[1];switch(o){case"%":return"%";case"a":return j[e].slice(0,3);case"A":return j[e];case"b":return k[g].slice(0,3);case"B":return k[g];case"c":return c.toString();case"d":return a(f);case"e":return f;case"H":return a(i);case"I":return a(b(c,"%l"));case"l":return 0===i||12===i?12:(i+12)%12;case"m":return a(g+1);case"M":return a(l);case"p":return i>11?"PM":"AM";case"P":return i>11?"pm":"am";case"S":return a(m);case"w":return e;case"y":return a(h%100);case"Y":return h;case"Z":return n=c.toString().match(/\((\w+)\)$/),n?n[1]:"";case"z":return n=c.toString().match(/\w([+-]\d\d\d\d) /),n?n[1]:""}})}function c(a){this.date=a}function d(){if(null!==l)return l;if(!("Intl"in window))return!1;var a={day:"numeric",month:"short"},b=new window.Intl.DateTimeFormat(void 0,a),c=b.format(new Date(0));return l=!!c.match(/^\d/)}function e(){if(null!==m)return m;if(!("Intl"in window))return!0;var a={day:"numeric",month:"short",year:"numeric"},b=new window.Intl.DateTimeFormat(void 0,a),c=b.format(new Date(0));return m=!!c.match(/\d,/)}function f(a){var b=new Date;return b.getUTCFullYear()===a.getUTCFullYear()}function g(){var a,b,c;for(b=0,c=p.length;c>b;b++)a=p[b],a.textContent=a.getFormattedDate()}function h(a){var c={weekday:{"short":"%a","long":"%A"},day:{numeric:"%e","2-digit":"%d"},month:{"short":"%b","long":"%B"},year:{numeric:"%Y","2-digit":"%y"}},e=d()?"weekday day month year":"weekday month day, year";for(var f in c){var g=c[f][a.getAttribute(f)];e=e.replace(f,g||"")}return e=e.replace(/(\s,)|(,\s$)/,""),b(a._date,e).replace(/\s+/," ").trim()}function i(a){var c={hour:a.getAttribute("hour"),minute:a.getAttribute("minute"),second:a.getAttribute("second")};for(var d in c)c[d]||delete c[d];if(0!==Object.keys(c).length){if("Intl"in window){var e=new window.Intl.DateTimeFormat(void 0,c);return e.format(a._date)}var f=c.second?"%H:%M:%S":"%H:%M";return b(a._date,f)}}var j=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],k=["January","February","March","April","May","June","July","August","September","October","November","December"];c.prototype.toString=function(){var a=this.timeElapsed();return a?a:"on "+this.formatDate()},c.prototype.timeElapsed=function(){var a=(new Date).getTime()-this.date.getTime(),b=Math.round(a/1e3),c=Math.round(b/60),d=Math.round(c/60),e=Math.round(d/24);return 0>a?"just now":10>b?"just now":45>b?b+" seconds ago":90>b?"a minute ago":45>c?c+" minutes ago":90>c?"an hour ago":24>d?d+" hours ago":36>d?"a day ago":30>e?e+" days ago":null},c.prototype.timeAgo=function(){var a=(new Date).getTime()-this.date.getTime(),b=Math.round(a/1e3),c=Math.round(b/60),d=Math.round(c/60),e=Math.round(d/24),f=Math.round(e/30),g=Math.round(f/12);return 0>a?"just now":10>b?"just now":45>b?b+" seconds ago":90>b?"a minute ago":45>c?c+" minutes ago":90>c?"an hour ago":24>d?d+" hours ago":36>d?"a day ago":30>e?e+" days ago":45>e?"a month ago":12>f?f+" months ago":18>f?"a year ago":g+" years ago"},c.prototype.microTimeAgo=function(){var a=(new Date).getTime()-this.date.getTime(),b=a/1e3,c=b/60,d=c/60,e=d/24,f=e/30,g=f/12;return 1>c?"1m":60>c?Math.round(c)+"m":24>d?Math.round(d)+"h":365>e?Math.round(e)+"d":Math.round(g)+"y"};var l=null,m=null;c.prototype.formatDate=function(){var a=d()?"%e %b":"%b %e";return f(this.date)||(a+=e()?", %Y":" %Y"),b(this.date,a)},c.prototype.formatTime=function(){if("Intl"in window){var a=new window.Intl.DateTimeFormat(void 0,{hour:"numeric",minute:"2-digit"});return a.format(this.date)}return b(this.date,"%l:%M%P")};var n,o,p=[];o="HTMLTimeElement"in window?Object.create(window.HTMLTimeElement.prototype):Object.create(window.HTMLElement.prototype),o.attributeChangedCallback=function(a,b,c){if("datetime"===a){var d=Date.parse(c);this._date=isNaN(d)?null:new Date(d)}var e=this.getFormattedTitle();e&&this.setAttribute("title",e);var f=this.getFormattedDate();f&&(this.textContent=f)},o.getFormattedTitle=function(){if(this._date){if(this.hasAttribute("title"))return this.getAttribute("title");if("Intl"in window){var a={day:"numeric",month:"short",year:"numeric",hour:"numeric",minute:"2-digit",timeZoneName:"short"},b=new window.Intl.DateTimeFormat(void 0,a);return b.format(this._date)}return this._date.toLocaleString()}};var q=Object.create(o);q.createdCallback=function(){var a=this.getAttribute("datetime");a&&this.attributeChangedCallback("datetime",null,a)},q.getFormattedDate=function(){return this._date?new c(this._date).toString():void 0},q.attachedCallback=function(){p.push(this),n||(g(),n=setInterval(g,6e4))},q.detachedCallback=function(){var a=p.indexOf(this);-1!==a&&p.splice(a,1),p.length||n&&(clearInterval(n),n=null)};var r=Object.create(q);r.getFormattedDate=function(){if(this._date){var a=this.getAttribute("format");return"micro"===a?new c(this._date).microTimeAgo():new c(this._date).timeAgo()}};var s=Object.create(o);s.createdCallback=function(){var a;(a=this.getAttribute("datetime"))&&this.attributeChangedCallback("datetime",null,a),(a=this.getAttribute("format"))&&this.attributeChangedCallback("format",null,a)},s.getFormattedDate=function(){if(this._date){var a=h(this)||"",b=i(this)||"";return(a+" "+b).trim()}},window.RelativeTimeElement=document.registerElement("relative-time",{prototype:q,"extends":"time"}),window.TimeAgoElement=document.registerElement("time-ago",{prototype:r,"extends":"time"}),window.LocalTimeElement=document.registerElement("local-time",{prototype:s,"extends":"time"})}(),angular.module("ui.navbar",["ui.bootstrap","template/navbar-ul.html","template/navbar-li.html"]).directive("tree",function(){return{restrict:"E",replace:!0,scope:{tree:"="},templateUrl:"template/navbar-ul.html"}}).directive("leaf",["$compile",function(a){return{restrict:"E",replace:!0,scope:{leaf:"="},templateUrl:"template/navbar-li.html",link:function(b,c,d){if(angular.isArray(b.leaf.subtree)){c.append('');for(var e=c.parent(),f=!1;e.length>0&&!f;)e.hasClass("navbar-right")&&(f=!0),e=e.parent();f?c.addClass("dropdown-submenu-right"):c.addClass("dropdown-submenu"),a(c.contents())(b)}}}}]),angular.module("template/navbar-li.html",[]).run(["$templateCache",function(a){a.put("template/navbar-li.html",'
      • \n {{leaf.name}}\n
      • ')}]),angular.module("template/navbar-ul.html",[]).run(["$templateCache",function(a){a.put("template/navbar-ul.html","")}]),function(){"use strict";var a={TAB:9,ENTER:13,ESC:27,SPACE:32,LEFT:37,UP:38,RIGHT:39,DOWN:40,SHIFT:16,CTRL:17,ALT:18,PAGE_UP:33,PAGE_DOWN:34,HOME:36,END:35,BACKSPACE:8,DELETE:46,COMMAND:91,MAP:{91:"COMMAND",8:"BACKSPACE",9:"TAB",13:"ENTER",16:"SHIFT",17:"CTRL",18:"ALT",19:"PAUSEBREAK",20:"CAPSLOCK",27:"ESC",32:"SPACE",33:"PAGE_UP",34:"PAGE_DOWN",35:"END",36:"HOME",37:"LEFT",38:"UP",39:"RIGHT",40:"DOWN",43:"+",44:"PRINTSCREEN",45:"INSERT",46:"DELETE",48:"0",49:"1",50:"2",51:"3",52:"4",53:"5",54:"6",55:"7",56:"8",57:"9",59:";",61:"=",65:"A",66:"B",67:"C",68:"D",69:"E",70:"F",71:"G",72:"H",73:"I",74:"J",75:"K",76:"L",77:"M",78:"N",79:"O",80:"P",81:"Q",82:"R",83:"S",84:"T",85:"U",86:"V",87:"W",88:"X",89:"Y",90:"Z",96:"0",97:"1",98:"2",99:"3",100:"4",101:"5",102:"6",103:"7",104:"8",105:"9",106:"*",107:"+",109:"-",110:".",111:"/",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NUMLOCK",145:"SCROLLLOCK",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},isControl:function(b){var c=b.which;switch(c){case a.COMMAND:case a.SHIFT:case a.CTRL:case a.ALT:return!0}return b.metaKey?!0:!1},isFunctionKey:function(a){return a=a.which?a.which:a,a>=112&&123>=a},isVerticalMovement:function(b){return~[a.UP,a.DOWN].indexOf(b)},isHorizontalMovement:function(b){return~[a.LEFT,a.RIGHT,a.BACKSPACE,a.DELETE].indexOf(b)}};void 0===angular.element.prototype.querySelectorAll&&(angular.element.prototype.querySelectorAll=function(a){return angular.element(this[0].querySelectorAll(a))}),void 0===angular.element.prototype.closest&&(angular.element.prototype.closest=function(a){for(var b=this[0],c=b.matches||b.webkitMatchesSelector||b.mozMatchesSelector||b.msMatchesSelector;b;){if(c.bind(b)(a))return b;b=b.parentElement}return!1});var b=0,c=angular.module("ui.select",[]).constant("uiSelectConfig",{theme:"bootstrap",searchEnabled:!0,sortable:!1,placeholder:"",refreshDelay:1e3,closeOnSelect:!0,dropdownPosition:"auto",generateId:function(){return b++},appendToBody:!1}).service("uiSelectMinErr",function(){var a=angular.$$minErr("ui.select");return function(){var b=a.apply(this,arguments),c=b.message.replace(new RegExp("\nhttp://errors.angularjs.org/.*"),"");return new Error(c)}}).directive("uisTranscludeAppend",function(){return{link:function(a,b,c,d,e){e(a,function(a){b.append(a)})}}}).filter("highlight",function(){function a(a){return a.replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1")}return function(b,c){return c&&b?b.replace(new RegExp(a(c),"gi"),'$&'):b}}).factory("uisOffset",["$document","$window",function(a,b){return function(c){var d=c[0].getBoundingClientRect();return{width:d.width||c.prop("offsetWidth"),height:d.height||c.prop("offsetHeight"),top:d.top+(b.pageYOffset||a[0].documentElement.scrollTop),left:d.left+(b.pageXOffset||a[0].documentElement.scrollLeft)}}}]);c.directive("uiSelectChoices",["uiSelectConfig","uisRepeatParser","uiSelectMinErr","$compile",function(a,b,c,d){return{restrict:"EA",require:"^uiSelect",replace:!0,transclude:!0,templateUrl:function(b){var c=b.parent().attr("theme")||a.theme;return c+"/choices.tpl.html"},compile:function(e,f){if(!f.repeat)throw c("repeat","Expected 'repeat' expression.");return function(e,f,g,h,i){var j=g.groupBy,k=g.groupFilter;if(h.parseRepeatAttr(g.repeat,j,k),h.disableChoiceExpression=g.uiDisableChoice,h.onHighlightCallback=g.onHighlight,h.dropdownPosition=g.position?g.position.toLowerCase():a.dropdownPosition,j){var l=f.querySelectorAll(".ui-select-choices-group");if(1!==l.length)throw c("rows","Expected 1 .ui-select-choices-group but got '{0}'.",l.length);l.attr("ng-repeat",b.getGroupNgRepeatExpression())}var m=f.querySelectorAll(".ui-select-choices-row");if(1!==m.length)throw c("rows","Expected 1 .ui-select-choices-row but got '{0}'.",m.length);m.attr("ng-repeat",h.parserResult.repeatExpression(j)).attr("ng-if","$select.open").attr("ng-click","$select.select("+h.parserResult.itemName+",false,$event)");var n=f.querySelectorAll(".ui-select-choices-row-inner");if(1!==n.length)throw c("rows","Expected 1 .ui-select-choices-row-inner but got '{0}'.",n.length);n.attr("uis-transclude-append",""),d(f,i)(e),e.$watch("$select.search",function(a){a&&!h.open&&h.multiple&&h.activate(!1,!0),h.activeIndex=h.tagging.isActivated?-1:0,h.refresh(g.refresh)}),g.$observe("refreshDelay",function(){var b=e.$eval(g.refreshDelay);h.refreshDelay=void 0!==b?b:a.refreshDelay})}}}}]),c.controller("uiSelectCtrl",["$scope","$element","$timeout","$filter","uisRepeatParser","uiSelectMinErr","uiSelectConfig","$parse",function(b,c,d,e,f,g,h,i){function j(){(n.resetSearchInput||void 0===n.resetSearchInput&&h.resetSearchInput)&&(n.search=o,n.selected&&n.items.length&&!n.multiple&&(n.activeIndex=n.items.indexOf(n.selected)))}function k(a,b){var c,d,e=[];for(c=0;c0||0===n.search.length&&n.tagging.isActivated&&n.activeIndex>-1)&&n.activeIndex--;break;case a.TAB:(!n.multiple||n.open)&&n.select(n.items[n.activeIndex],!0);break;case a.ENTER:n.open&&(n.tagging.isActivated||n.activeIndex>=0)?n.select(n.items[n.activeIndex]):n.activate(!1,!0);break;case a.ESC:n.close();break;default:c=!1}return c}function m(){var a=c.querySelectorAll(".ui-select-choices-content"),b=a.querySelectorAll(".ui-select-choices-row");if(b.length<1)throw g("choices","Expected multiple .ui-select-choices-row but got '{0}'.",b.length);if(!(n.activeIndex<0)){var d=b[n.activeIndex],e=d.offsetTop+d.clientHeight-a[0].scrollTop,f=a[0].offsetHeight;e>f?a[0].scrollTop+=e-f:e=n.items.length?0:n.activeIndex,-1===n.activeIndex&&n.taggingLabel!==!1&&(n.activeIndex=0),d(function(){n.search=a||n.search,n.searchInput[0].focus(),!n.tagging.isActivated&&n.items.length>1&&m()}))},n.findGroupByName=function(a){return n.groups&&n.groups.filter(function(b){return b.name===a})[0]},n.parseRepeatAttr=function(a,c,d){function e(a){var e=b.$eval(c);if(n.groups=[],angular.forEach(a,function(a){var b=angular.isFunction(e)?e(a):a[e],c=n.findGroupByName(b);c?c.items.push(a):n.groups.push({name:b,items:[a]})}),d){var f=b.$eval(d);angular.isFunction(f)?n.groups=f(n.groups):angular.isArray(f)&&(n.groups=k(n.groups,f))}n.items=[],n.groups.forEach(function(a){n.items=n.items.concat(a.items)})}function h(a){n.items=a}n.setItemsFn=c?e:h,n.parserResult=f.parse(a),n.isGrouped=!!c,n.itemProperty=n.parserResult.itemName;var j=n.parserResult.source,l=function(){var a=j(b);b.$uisSource=Object.keys(a).map(function(b){var c={};return c[n.parserResult.keyName]=b,c.value=a[b],c})};n.parserResult.keyName&&(l(),n.parserResult.source=i("$uisSource"+n.parserResult.filters),b.$watch(j,function(a,b){a!==b&&l()},!0)),n.refreshItems=function(a){a=a||n.parserResult.source(b);var c=n.selected;if(n.isEmpty()||angular.isArray(c)&&!c.length||!n.removeSelected)n.setItemsFn(a);else if(void 0!==a){var d=a.filter(function(a){return c&&c.indexOf(a)<0});n.setItemsFn(d)}("auto"===n.dropdownPosition||"up"===n.dropdownPosition)&&b.calculateDropdownPos()},b.$watchCollection(n.parserResult.source,function(a){if(void 0===a||null===a)n.items=[];else{if(!angular.isArray(a))throw g("items","Expected an array but got '{0}'.",a);n.refreshItems(a),n.ngModel.$modelValue=null}})};var p;n.refresh=function(a){void 0!==a&&(p&&d.cancel(p),p=d(function(){b.$eval(a)},n.refreshDelay))},n.isActive=function(a){if(!n.open)return!1;var b=n.items.indexOf(a[n.itemProperty]),c=b===n.activeIndex;return!c||0>b&&n.taggingLabel!==!1||0>b&&n.taggingLabel===!1?!1:(c&&!angular.isUndefined(n.onHighlightCallback)&&a.$eval(n.onHighlightCallback),c)},n.isDisabled=function(a){if(n.open){var b,c=n.items.indexOf(a[n.itemProperty]),d=!1;return c>=0&&!angular.isUndefined(n.disableChoiceExpression)&&(b=n.items[c],d=!!a.$eval(n.disableChoiceExpression),b._uiSelectChoiceDisabled=d),d}},n.select=function(a,c,e){if(void 0===a||!a._uiSelectChoiceDisabled){if(!n.items&&!n.search)return;if(!a||!a._uiSelectChoiceDisabled){if(n.tagging.isActivated){if(n.taggingLabel===!1)if(n.activeIndex<0){if(a=void 0!==n.tagging.fct?n.tagging.fct(n.search):n.search,!a||angular.equals(n.items[0],a))return}else a=n.items[n.activeIndex];else if(0===n.activeIndex){if(void 0===a)return;if(void 0!==n.tagging.fct&&"string"==typeof a){if(a=n.tagging.fct(n.search),!a)return}else"string"==typeof a&&(a=a.replace(n.taggingLabel,"").trim())}if(n.selected&&angular.isArray(n.selected)&&n.selected.filter(function(b){return angular.equals(b,a)}).length>0)return void n.close(c)}b.$broadcast("uis:select",a);var f={};f[n.parserResult.itemName]=a,d(function(){n.onSelectCallback(b,{$item:a,$model:n.parserResult.modelMapper(b,f)})}),n.closeOnSelect&&n.close(c),e&&"click"===e.type&&(n.clickTriggeredSelect=!0)}}},n.close=function(a){n.open&&(n.ngModel&&n.ngModel.$setTouched&&n.ngModel.$setTouched(),j(),n.open=!1,b.$broadcast("uis:close",a))},n.setFocus=function(){n.focus||n.focusInput[0].focus()},n.clear=function(a){n.select(void 0),a.stopPropagation(),d(function(){n.focusser[0].focus()},0,!1)},n.toggle=function(a){n.open?(n.close(),a.preventDefault(),a.stopPropagation()):n.activate()},n.isLocked=function(a,b){var c,d=n.selected[b];return d&&!angular.isUndefined(n.lockChoiceExpression)&&(c=!!a.$eval(n.lockChoiceExpression),d._uiSelectChoiceLocked=c),c};var q=null;n.sizeSearchInput=function(){var a=n.searchInput[0],c=n.searchInput.parent().parent()[0],e=function(){return c.clientWidth*!!a.offsetParent},f=function(b){if(0===b)return!1;var c=b-a.offsetLeft-10;return 50>c&&(c=b),n.searchInput.css("width",c+"px"),!0};n.searchInput.css("width","10px"),d(function(){null!==q||f(e())||(q=b.$watch(e,function(a){f(a)&&(q(),q=null)}))})},n.searchInput.on("keydown",function(c){var e=c.which;b.$apply(function(){var b=!1;if((n.items.length>0||n.tagging.isActivated)&&(l(e),n.taggingTokens.isActivated)){for(var f=0;f0&&(b=!0);b&&d(function(){n.searchInput.triggerHandler("tagged");var b=n.search.replace(a.MAP[c.keyCode],"").trim();n.tagging.fct&&(b=n.tagging.fct(b)),b&&n.select(b,!0)})}}),a.isVerticalMovement(e)&&n.items.length>0&&m(),(e===a.ENTER||e===a.ESC)&&(c.preventDefault(),c.stopPropagation())}),n.searchInput.on("paste",function(a){var b=a.originalEvent.clipboardData.getData("text/plain");if(b&&b.length>0&&n.taggingTokens.isActivated&&n.tagging.fct){var c=b.split(n.taggingTokens.tokens[0]);c&&c.length>0&&(angular.forEach(c,function(a){var b=n.tagging.fct(a);b&&n.select(b,!0)}),a.preventDefault(),a.stopPropagation())}}),n.searchInput.on("tagged",function(){d(function(){j()})}),b.$on("$destroy",function(){n.searchInput.off("keyup keydown tagged blur paste")})}]),c.directive("uiSelect",["$document","uiSelectConfig","uiSelectMinErr","uisOffset","$compile","$parse","$timeout",function(a,b,c,d,e,f,g){return{restrict:"EA",templateUrl:function(a,c){var d=c.theme||b.theme;return d+(angular.isDefined(c.multiple)?"/select-multiple.tpl.html":"/select.tpl.html")},replace:!0,transclude:!0,require:["uiSelect","^ngModel"],scope:!0,controller:"uiSelectCtrl",controllerAs:"$select",compile:function(e,h){return angular.isDefined(h.multiple)?e.append("").removeAttr("multiple"):e.append(""),h.inputId&&(e.querySelectorAll("input.ui-select-search")[0].id=h.inputId),function(e,h,i,j,k){function l(a){if(o.open){var b=!1;if(b=window.jQuery?window.jQuery.contains(h[0],a.target):h[0].contains(a.target),!b&&!o.clickTriggeredSelect){var c=["input","button","textarea"],d=angular.element(a.target).controller("uiSelect"),f=d&&d!==o;f||(f=~c.indexOf(a.target.tagName.toLowerCase())),o.close(f),e.$digest()}o.clickTriggeredSelect=!1}}function m(){var b=d(h);r=angular.element('
        '),r[0].style.width=b.width+"px",r[0].style.height=b.height+"px",h.after(r),s=h[0].style.width,a.find("body").append(h),h[0].style.position="absolute",h[0].style.left=b.left+"px",h[0].style.top=b.top+"px",h[0].style.width=b.width+"px"}function n(){null!==r&&(r.replaceWith(h),r=null,h[0].style.position="",h[0].style.left="",h[0].style.top="",h[0].style.width=s)}var o=j[0],p=j[1];o.generatedId=b.generateId(),o.baseTitle=i.title||"Select box",o.focusserTitle=o.baseTitle+" focus",o.focusserId="focusser-"+o.generatedId,o.closeOnSelect=function(){return angular.isDefined(i.closeOnSelect)?f(i.closeOnSelect)():b.closeOnSelect}(),o.onSelectCallback=f(i.onSelect),o.onRemoveCallback=f(i.onRemove),o.limit=angular.isDefined(i.limit)?parseInt(i.limit,10):void 0,o.ngModel=p,o.choiceGrouped=function(a){return o.isGrouped&&a&&a.name},i.tabindex&&i.$observe("tabindex",function(a){o.focusInput.attr("tabindex",a),h.removeAttr("tabindex")}),e.$watch("searchEnabled",function(){var a=e.$eval(i.searchEnabled);o.searchEnabled=void 0!==a?a:b.searchEnabled}),e.$watch("sortable",function(){var a=e.$eval(i.sortable);o.sortable=void 0!==a?a:b.sortable}),i.$observe("disabled",function(){o.disabled=void 0!==i.disabled?i.disabled:!1}),i.$observe("resetSearchInput",function(){var a=e.$eval(i.resetSearchInput);o.resetSearchInput=void 0!==a?a:!0}),i.$observe("tagging",function(){if(void 0!==i.tagging){var a=e.$eval(i.tagging);o.tagging={isActivated:!0,fct:a!==!0?a:void 0}}else o.tagging={isActivated:!1,fct:void 0}}),i.$observe("taggingLabel",function(){void 0!==i.tagging&&("false"===i.taggingLabel?o.taggingLabel=!1:o.taggingLabel=void 0!==i.taggingLabel?i.taggingLabel:"(new)")}),i.$observe("taggingTokens",function(){if(void 0!==i.tagging){var a=void 0!==i.taggingTokens?i.taggingTokens.split("|"):[",","ENTER"];o.taggingTokens={isActivated:!0,tokens:a}}}),angular.isDefined(i.autofocus)&&g(function(){o.setFocus()}),angular.isDefined(i.focusOn)&&e.$on(i.focusOn,function(){g(function(){o.setFocus()})}),a.on("click",l),e.$on("$destroy",function(){a.off("click",l)}),k(e,function(a){var b=angular.element("
        ").append(a),d=b.querySelectorAll(".ui-select-match");if(d.removeAttr("ui-select-match"),d.removeAttr("data-ui-select-match"),1!==d.length)throw c("transcluded","Expected 1 .ui-select-match but got '{0}'.",d.length);h.querySelectorAll(".ui-select-match").replaceWith(d);var e=b.querySelectorAll(".ui-select-choices");if(e.removeAttr("ui-select-choices"),e.removeAttr("data-ui-select-choices"),1!==e.length)throw c("transcluded","Expected 1 .ui-select-choices but got '{0}'.",e.length);h.querySelectorAll(".ui-select-choices").replaceWith(e)});var q=e.$eval(i.appendToBody);(void 0!==q?q:b.appendToBody)&&(e.$watch("$select.open",function(a){a?m():n()}),e.$on("$destroy",function(){n()}));var r=null,s="",t=null,u="direction-up";e.$watch("$select.open",function(){("auto"===o.dropdownPosition||"up"===o.dropdownPosition)&&e.calculateDropdownPos()});var v=function(a,b){a=a||d(h),b=b||d(t),t[0].style.position="absolute",t[0].style.top=-1*b.height+"px",h.addClass(u)},w=function(a,b){h.removeClass(u),a=a||d(h),b=b||d(t),t[0].style.position="",t[0].style.top=""};e.calculateDropdownPos=function(){if(o.open){if(t=angular.element(h).querySelectorAll(".ui-select-dropdown"),0===t.length)return;t[0].style.opacity=0,g(function(){if("up"===o.dropdownPosition)v(b,c);else{h.removeClass(u);var b=d(h),c=d(t),e=a[0].documentElement.scrollTop||a[0].body.scrollTop;b.top+b.height+c.height>e+a[0].documentElement.clientHeight?v(b,c):w(b,c)}t[0].style.opacity=1})}else{if(null===t||0===t.length)return;t[0].style.position="",t[0].style.top="",h.removeClass(u)}}}}}}]),c.directive("uiSelectMatch",["uiSelectConfig",function(a){return{restrict:"EA",require:"^uiSelect",replace:!0,transclude:!0,templateUrl:function(b){var c=b.parent().attr("theme")||a.theme,d=b.parent().attr("multiple");return c+(d?"/match-multiple.tpl.html":"/match.tpl.html")},link:function(b,c,d,e){function f(a){e.allowClear=angular.isDefined(a)?""===a?!0:"true"===a.toLowerCase():!1}e.lockChoiceExpression=d.uiLockChoice,d.$observe("placeholder",function(b){e.placeholder=void 0!==b?b:a.placeholder}),d.$observe("allowClear",f),f(d.allowClear),e.multiple&&e.sizeSearchInput()}}}]),c.directive("uiSelectMultiple",["uiSelectMinErr","$timeout",function(b,c){return{restrict:"EA",require:["^uiSelect","^ngModel"],controller:["$scope","$timeout",function(a,b){var c,d=this,e=a.$select;a.$evalAsync(function(){c=a.ngModel}),d.activeMatchIndex=-1,d.updateModel=function(){c.$setViewValue(Date.now()),d.refreshComponent()},d.refreshComponent=function(){e.refreshItems(),e.sizeSearchInput()},d.removeChoice=function(c){var f=e.selected[c];if(!f._uiSelectChoiceLocked){var g={};g[e.parserResult.itemName]=f,e.selected.splice(c,1),d.activeMatchIndex=-1,e.sizeSearchInput(),b(function(){e.onRemoveCallback(a,{$item:f,$model:e.parserResult.modelMapper(a,g)})}),d.updateModel()}},d.getPlaceholder=function(){return e.selected&&e.selected.length?void 0:e.placeholder}}],controllerAs:"$selectMultiple",link:function(d,e,f,g){function h(a){return angular.isNumber(a.selectionStart)?a.selectionStart:a.value.length}function i(b){function c(){switch(b){case a.LEFT:return~n.activeMatchIndex?k:g; +case a.RIGHT:return~n.activeMatchIndex&&i!==g?j:(l.activate(),!1);case a.BACKSPACE:return~n.activeMatchIndex?(n.removeChoice(i),k):g;case a.DELETE:return~n.activeMatchIndex?(n.removeChoice(n.activeMatchIndex),i):!1}}var d=h(l.searchInput[0]),e=l.selected.length,f=0,g=e-1,i=n.activeMatchIndex,j=n.activeMatchIndex+1,k=n.activeMatchIndex-1,m=i;return d>0||l.search.length&&b==a.RIGHT?!1:(l.close(),m=c(),l.selected.length&&m!==!1?n.activeMatchIndex=Math.min(g,Math.max(f,m)):n.activeMatchIndex=-1,!0)}function j(a){if(void 0===a||void 0===l.search)return!1;var b=a.filter(function(a){return void 0===l.search.toUpperCase()||void 0===a?!1:a.toUpperCase()===l.search.toUpperCase()}).length>0;return b}function k(a,b){var c=-1;if(angular.isArray(a))for(var d=angular.copy(a),e=0;e=0;e--)b={},b[l.parserResult.itemName]=l.selected[e],a=l.parserResult.modelMapper(d,b),c.unshift(a);return c}),m.$formatters.unshift(function(a){var b,c=l.parserResult.source(d,{$select:{search:""}}),e={};if(!c)return a;var f=[],g=function(a,c){if(a&&a.length){for(var g=a.length-1;g>=0;g--){if(e[l.parserResult.itemName]=a[g],b=l.parserResult.modelMapper(d,e),l.parserResult.trackByExp){var h=/\.(.+)/.exec(l.parserResult.trackByExp);if(h.length>0&&b[h[1]]==c[h[1]])return f.unshift(a[g]),!0}if(angular.equals(b,c))return f.unshift(a[g]),!0}return!1}};if(!a)return f;for(var h=a.length-1;h>=0;h--)g(l.selected,a[h])||g(c,a[h])||f.unshift(a[h]);return f}),d.$watchCollection(function(){return m.$modelValue},function(a,b){b!=a&&(m.$modelValue=null,n.refreshComponent())}),m.$render=function(){if(!angular.isArray(m.$viewValue)){if(!angular.isUndefined(m.$viewValue)&&null!==m.$viewValue)throw b("multiarr","Expected model value to be array but got '{0}'",m.$viewValue);l.selected=[]}l.selected=m.$viewValue,d.$evalAsync()},d.$on("uis:select",function(a,b){l.selected.length>=l.limit||(l.selected.push(b),n.updateModel())}),d.$on("uis:activate",function(){n.activeMatchIndex=-1}),d.$watch("$select.disabled",function(a,b){b&&!a&&l.sizeSearchInput()}),l.searchInput.on("keydown",function(b){var c=b.which;d.$apply(function(){var d=!1;a.isHorizontalMovement(c)&&(d=i(c)),d&&c!=a.TAB&&(b.preventDefault(),b.stopPropagation())})}),l.searchInput.on("keyup",function(b){if(a.isVerticalMovement(b.which)||d.$evalAsync(function(){l.activeIndex=l.taggingLabel===!1?-1:0}),l.tagging.isActivated&&l.search.length>0){if(b.which===a.TAB||a.isControl(b)||a.isFunctionKey(b)||b.which===a.ESC||a.isVerticalMovement(b.which))return;if(l.activeIndex=l.taggingLabel===!1?-1:0,l.taggingLabel===!1)return;var c,e,f,g,h=angular.copy(l.items),i=angular.copy(l.items),m=!1,n=-1;if(void 0!==l.tagging.fct){if(f=l.$filter("filter")(h,{isTag:!0}),f.length>0&&(g=f[0]),h.length>0&&g&&(m=!0,h=h.slice(1,h.length),i=i.slice(1,i.length)),c=l.tagging.fct(l.search),c.isTag=!0,i.filter(function(a){return angular.equals(a,l.tagging.fct(l.search))}).length>0)return;c.isTag=!0}else{if(f=l.$filter("filter")(h,function(a){return a.match(l.taggingLabel)}),f.length>0&&(g=f[0]),e=h[0],void 0!==e&&h.length>0&&g&&(m=!0,h=h.slice(1,h.length),i=i.slice(1,i.length)),c=l.search+" "+l.taggingLabel,k(l.selected,l.search)>-1)return;if(j(i.concat(l.selected)))return void(m&&(h=i,d.$evalAsync(function(){l.activeIndex=0,l.items=h})));if(j(i))return void(m&&(l.items=i.slice(1,i.length)))}m&&(n=k(l.selected,c)),n>-1?h=h.slice(n+1,h.length-1):(h=[],h.push(c),h=h.concat(i)),d.$evalAsync(function(){l.activeIndex=0,l.items=h})}}),l.searchInput.on("blur",function(){c(function(){n.activeMatchIndex=-1})})}}}]),c.directive("uiSelectSingle",["$timeout","$compile",function(b,c){return{restrict:"EA",require:["^uiSelect","^ngModel"],link:function(d,e,f,g){var h=g[0],i=g[1];i.$parsers.unshift(function(a){var b,c={};return c[h.parserResult.itemName]=a,b=h.parserResult.modelMapper(d,c)}),i.$formatters.unshift(function(a){var b,c=h.parserResult.source(d,{$select:{search:""}}),e={};if(c){var f=function(c){return e[h.parserResult.itemName]=c,b=h.parserResult.modelMapper(d,e),b==a};if(h.selected&&f(h.selected))return h.selected;for(var g=c.length-1;g>=0;g--)if(f(c[g]))return c[g]}return a}),d.$watch("$select.selected",function(a){i.$viewValue!==a&&i.$setViewValue(a)}),i.$render=function(){h.selected=i.$viewValue},d.$on("uis:select",function(a,b){h.selected=b}),d.$on("uis:close",function(a,c){b(function(){h.focusser.prop("disabled",!1),c||h.focusser[0].focus()},0,!1)}),d.$on("uis:activate",function(){j.prop("disabled",!0)});var j=angular.element("");c(j)(d),h.focusser=j,h.focusInput=j,e.parent().append(j),j.bind("focus",function(){d.$evalAsync(function(){h.focus=!0})}),j.bind("blur",function(){d.$evalAsync(function(){h.focus=!1})}),j.bind("keydown",function(b){return b.which===a.BACKSPACE?(b.preventDefault(),b.stopPropagation(),h.select(void 0),void d.$apply()):void(b.which===a.TAB||a.isControl(b)||a.isFunctionKey(b)||b.which===a.ESC||((b.which==a.DOWN||b.which==a.UP||b.which==a.ENTER||b.which==a.SPACE)&&(b.preventDefault(),b.stopPropagation(),h.activate()),d.$digest()))}),j.bind("keyup input",function(b){b.which===a.TAB||a.isControl(b)||a.isFunctionKey(b)||b.which===a.ESC||b.which==a.ENTER||b.which===a.BACKSPACE||(h.activate(j.val()),j.val(""),d.$digest())})}}}]),c.directive("uiSelectSort",["$timeout","uiSelectConfig","uiSelectMinErr",function(a,b,c){return{require:"^uiSelect",link:function(b,d,e,f){if(null===b[e.uiSelectSort])throw c("sort","Expected a list to sort");var g=angular.extend({axis:"horizontal"},b.$eval(e.uiSelectSortOptions)),h=g.axis,i="dragging",j="dropping",k="dropping-before",l="dropping-after";b.$watch(function(){return f.sortable},function(a){a?d.attr("draggable",!0):d.removeAttr("draggable")}),d.on("dragstart",function(a){d.addClass(i),(a.dataTransfer||a.originalEvent.dataTransfer).setData("text/plain",b.$index)}),d.on("dragend",function(){d.removeClass(i)});var m,n=function(a,b){this.splice(b,0,this.splice(a,1)[0])},o=function(a){a.preventDefault();var b="vertical"===h?a.offsetY||a.layerY||(a.originalEvent?a.originalEvent.offsetY:0):a.offsetX||a.layerX||(a.originalEvent?a.originalEvent.offsetX:0);b
      • '),a.put("bootstrap/match-multiple.tpl.html",' × '),a.put("bootstrap/match.tpl.html",'
        {{$select.placeholder}}
        '),a.put("bootstrap/select-multiple.tpl.html",''),a.put("bootstrap/select.tpl.html",''),a.put("selectize/choices.tpl.html",'
        '),a.put("selectize/match.tpl.html",'
        '),a.put("selectize/select.tpl.html",'
        '),a.put("select2/choices.tpl.html",'
        '),a.put("select2/match-multiple.tpl.html",'
      • '),a.put("select2/match.tpl.html",'{{$select.placeholder}} '),a.put("select2/select-multiple.tpl.html",'
        '),a.put("select2/select.tpl.html",'
        ')}]),function(){window.WebComponents=window.WebComponents||{flags:{}};var a="webcomponents.js",b=document.querySelector('script[src*="'+a+'"]'),c={};if(!c.noOpts){if(location.search.slice(1).split("&").forEach(function(a){var b,d=a.split("=");d[0]&&(b=d[0].match(/wc-(.+)/))&&(c[b[1]]=d[1]||!0)}),b)for(var d,e=0;d=b.attributes[e];e++)"src"!==d.name&&(c[d.name]=d.value||!0);if(c.log&&c.log.split){var f=c.log.split(",");c.log={},f.forEach(function(a){c.log[a]=!0})}else c.log={}}c.shadow=c.shadow||c.shadowdom||c.polyfill,"native"===c.shadow?c.shadow=!1:c.shadow=c.shadow||!HTMLElement.prototype.createShadowRoot,c.register&&(window.CustomElements=window.CustomElements||{flags:{}},window.CustomElements.flags.register=c.register),WebComponents.flags=c}(),WebComponents.flags.shadow&&("undefined"==typeof WeakMap&&!function(){var a=Object.defineProperty,b=Date.now()%1e9,c=function(){this.name="__st"+(1e9*Math.random()>>>0)+(b++ +"__")};c.prototype={set:function(b,c){var d=b[this.name];return d&&d[0]===b?d[1]=c:a(b,this.name,{value:[b,c],writable:!0}),this},get:function(a){var b;return(b=a[this.name])&&b[0]===a?b[1]:void 0},"delete":function(a){var b=a[this.name];return b&&b[0]===a?(b[0]=b[1]=void 0,!0):!1},has:function(a){var b=a[this.name];return b?b[0]===a:!1}},window.WeakMap=c}(),window.ShadowDOMPolyfill={},function(a){"use strict";function b(){if("undefined"!=typeof chrome&&chrome.app&&chrome.app.runtime)return!1;if(navigator.getDeviceStorage)return!1;try{var a=new Function("return true;");return a()}catch(b){return!1}}function c(a){if(!a)throw new Error("Assertion failed")}function d(a,b){for(var c=N(b),d=0;dj;j++)i[j]=new Array(h),i[j][0]=j;for(var k=0;h>k;k++)i[0][k]=k;for(var j=1;g>j;j++)for(var k=1;h>k;k++)if(this.equals(a[b+k-1],d[e+j-1]))i[j][k]=i[j-1][k-1];else{var l=i[j-1][k]+1,m=i[j][k-1]+1;i[j][k]=m>l?l:m}return i},spliceOperationsFromEditDistances:function(a){for(var b=a.length-1,c=a[0].length-1,h=a[b][c],i=[];b>0||c>0;)if(0!=b)if(0!=c){var j,k=a[b-1][c-1],l=a[b-1][c],m=a[b][c-1];j=m>l?k>l?l:k:k>m?m:k,j==k?(k==h?i.push(d):(i.push(e),h=k),b--,c--):j==l?(i.push(g),b--,h=l):(i.push(f),c--,h=m)}else i.push(g),b--;else i.push(f),c--;return i.reverse(),i},calcSplices:function(a,c,h,i,j,k){var l=0,m=0,n=Math.min(h-c,k-j);if(0==c&&0==j&&(l=this.sharedPrefix(a,i,n)),h==a.length&&k==i.length&&(m=this.sharedSuffix(a,i,n-l)),c+=l,j+=l,h-=m,k-=m,h-c==0&&k-j==0)return[];if(c==h){for(var o=b(c,[],0);k>j;)o.removed.push(i[j++]);return[o]}if(j==k)return[b(c,[],h-c)];for(var p=this.spliceOperationsFromEditDistances(this.calcEditDistances(a,c,h,i,j,k)),o=void 0,q=[],r=c,s=j,t=0;td;d++)if(!this.equals(a[d],b[d]))return d;return c},sharedSuffix:function(a,b,c){for(var d=a.length,e=b.length,f=0;c>f&&this.equals(a[--d],b[--e]);)f++;return f},calculateSplices:function(a,b){return this.calcSplices(a,0,a.length,b,0,b.length)},equals:function(a,b){return a===b}},a.ArraySplice=c}(window.ShadowDOMPolyfill),function(a){"use strict";function b(){g=!1;var a=f.slice(0);f=[];for(var b=0;b0){for(var k=0;k0&&d.length>0;){var f=c.pop(),g=d.pop();if(f!==g)break;e=f}return e}function k(a,b,c){b instanceof T.Window&&(b=b.document);var e,f=M(b),g=M(c),h=d(c,a),e=j(f,g);e||(e=g.root);for(var i=e;i;i=i.parent)for(var k=0;k0;f--)if(!s(b[f],a,e,b,d))return!1;return!0}function q(a,b,c,d){var e=fa,f=b[0]||c;return s(f,a,e,b,d)}function r(a,b,c,d){for(var e=ga,f=1;f0&&s(c,a,e,b,d)}function s(a,b,c,d,e){var f=U.get(a);if(!f)return!0;var g=e||h(d,a);if(g===a){if(c===ea)return!0; +c===ga&&(c=fa)}else if(c===ga&&!b.bubbles)return!0;if("relatedTarget"in b){var i=R(b),j=i.relatedTarget;if(j){if(j instanceof Object&&j.addEventListener){var l=S(j),m=k(b,a,l);if(m===g)return!0}else m=null;Z.set(b,m)}}$.set(b,c);var n=b.type,o=!1;X.set(b,g),Y.set(b,a),f.depth++;for(var p=0,q=f.length;q>p;p++){var r=f[p];if(r.removed)o=!0;else if(!(r.type!==n||!r.capture&&c===ea||r.capture&&c===ga))try{if("function"==typeof r.handler?r.handler.call(a,b):r.handler.handleEvent(b),aa.get(b))return!1}catch(s){K||(K=s)}}if(f.depth--,o&&0===f.depth){var t=f.slice();f.length=0;for(var p=0;pd;d++)b[d]=g(a[d]);return b.length=e,b}function e(a,b){a.prototype[b]=function(){return d(f(this)[b].apply(f(this),arguments))}}var f=a.unsafeUnwrap,g=a.wrap,h={enumerable:!1};c.prototype={item:function(a){return this[a]}},b(c.prototype,"item"),a.wrappers.NodeList=c,a.addWrapNodeListMethod=e,a.wrapNodeList=d}(window.ShadowDOMPolyfill),function(a){"use strict";a.wrapHTMLCollection=a.wrapNodeList,a.wrappers.HTMLCollection=a.wrappers.NodeList}(window.ShadowDOMPolyfill),function(a){"use strict";function b(a){A(a instanceof w)}function c(a){var b=new y;return b[0]=a,b.length=1,b}function d(a,b,c){C(b,"childList",{removedNodes:c,previousSibling:a.previousSibling,nextSibling:a.nextSibling})}function e(a,b){C(a,"childList",{removedNodes:b})}function f(a,b,d,e){if(a instanceof DocumentFragment){var f=h(a);P=!0;for(var g=f.length-1;g>=0;g--)a.removeChild(f[g]),f[g].parentNode_=b;P=!1;for(var g=0;ge;e++)d.appendChild(K(b[e]));return d}function q(a){if(void 0!==a.firstChild_)for(var b=a.firstChild_;b;){var c=b;b=b.nextSibling_,c.parentNode_=c.previousSibling_=c.nextSibling_=void 0}a.firstChild_=a.lastChild_=void 0}function r(a){if(a.invalidateShadowRenderer()){for(var b=a.firstChild;b;){A(b.parentNode===a);var c=b.nextSibling,d=K(b),e=d.parentNode;e&&X.call(e,d),b.previousSibling_=b.nextSibling_=b.parentNode_=null,b=c}a.firstChild_=a.lastChild_=null}else for(var c,f=K(a),g=f.firstChild;g;)c=g.nextSibling,X.call(f,g),g=c}function s(a){var b=a.parentNode;return b&&b.invalidateShadowRenderer()}function t(a){for(var b,c=0;ch;h++)f=t(b[h]),!e&&(g=r(f).root)&&g instanceof a.wrappers.ShadowRoot||(d[c++]=f);return c}function c(a){return String(a).replace(/\/deep\/|::shadow|>>>/g," ")}function d(a){return String(a).replace(/:host\(([^\s]+)\)/g,"$1").replace(/([^\s]):host/g,"$1").replace(":host","*").replace(/\^|\/shadow\/|\/shadow-deep\/|::shadow|\/deep\/|::content|>>>/g," ")}function e(a,b){for(var c,d=a.firstElementChild;d;){if(d.matches(b))return d;if(c=e(d,b))return c;d=d.nextElementSibling}return null}function f(a,b){return a.matches(b)}function g(a,b,c){var d=a.localName;return d===b||d===c&&a.namespaceURI===E}function h(){return!0}function i(a,b,c){return a.localName===c}function j(a,b){return a.namespaceURI===b}function k(a,b,c){return a.namespaceURI===b&&a.localName===c}function l(a,b,c,d,e,f){for(var g=a.firstElementChild;g;)d(g,e,f)&&(c[b++]=g),b=l(g,b,c,d,e,f),g=g.nextElementSibling;return b}function m(c,d,e,f,g){var h,i=s(this),j=r(this).root;if(j instanceof a.wrappers.ShadowRoot)return l(this,d,e,c,f,null);if(i instanceof C)h=x.call(i,f);else{if(!(i instanceof D))return l(this,d,e,c,f,null);h=w.call(i,f)}return b(h,d,e,g)}function n(c,d,e,f,g){var h,i=s(this),j=r(this).root;if(j instanceof a.wrappers.ShadowRoot)return l(this,d,e,c,f,g);if(i instanceof C)h=z.call(i,f,g);else{if(!(i instanceof D))return l(this,d,e,c,f,g);h=y.call(i,f,g)}return b(h,d,e,!1)}function o(c,d,e,f,g){var h,i=s(this),j=r(this).root;if(j instanceof a.wrappers.ShadowRoot)return l(this,d,e,c,f,g);if(i instanceof C)h=B.call(i,f,g);else{if(!(i instanceof D))return l(this,d,e,c,f,g);h=A.call(i,f,g)}return b(h,d,e,!1)}var p=a.wrappers.HTMLCollection,q=a.wrappers.NodeList,r=a.getTreeScope,s=a.unsafeUnwrap,t=a.wrap,u=document.querySelector,v=document.documentElement.querySelector,w=document.querySelectorAll,x=document.documentElement.querySelectorAll,y=document.getElementsByTagName,z=document.documentElement.getElementsByTagName,A=document.getElementsByTagNameNS,B=document.documentElement.getElementsByTagNameNS,C=window.Element,D=window.HTMLDocument||window.Document,E="http://www.w3.org/1999/xhtml",F={querySelector:function(b){var d=c(b),f=d!==b;b=d;var g,h=s(this),i=r(this).root;if(i instanceof a.wrappers.ShadowRoot)return e(this,b);if(h instanceof C)g=t(v.call(h,b));else{if(!(h instanceof D))return e(this,b);g=t(u.call(h,b))}return g&&!f&&(i=r(g).root)&&i instanceof a.wrappers.ShadowRoot?e(this,b):g},querySelectorAll:function(a){var b=c(a),d=b!==a;a=b;var e=new q;return e.length=m.call(this,f,0,e,a,d),e}},G={matches:function(b){return b=d(b),a.originalMatches.call(s(this),b)}},H={getElementsByTagName:function(a){var b=new p,c="*"===a?h:g;return b.length=n.call(this,c,0,b,a,a.toLowerCase()),b},getElementsByClassName:function(a){return this.querySelectorAll("."+a)},getElementsByTagNameNS:function(a,b){var c=new p,d=null;return d="*"===a?"*"===b?h:i:"*"===b?j:k,c.length=o.call(this,d,0,c,a||null,b),c}};a.GetElementsByInterface=H,a.SelectorsInterface=F,a.MatchesInterface=G}(window.ShadowDOMPolyfill),function(a){"use strict";function b(a){for(;a&&a.nodeType!==Node.ELEMENT_NODE;)a=a.nextSibling;return a}function c(a){for(;a&&a.nodeType!==Node.ELEMENT_NODE;)a=a.previousSibling;return a}var d=a.wrappers.NodeList,e={get firstElementChild(){return b(this.firstChild)},get lastElementChild(){return c(this.lastChild)},get childElementCount(){for(var a=0,b=this.firstElementChild;b;b=b.nextElementSibling)a++;return a},get children(){for(var a=new d,b=0,c=this.firstElementChild;c;c=c.nextElementSibling)a[b++]=c;return a.length=b,a},remove:function(){var a=this.parentNode;a&&a.removeChild(this)}},f={get nextElementSibling(){return b(this.nextSibling)},get previousElementSibling(){return c(this.previousSibling)}},g={getElementById:function(a){return/[ \t\n\r\f]/.test(a)?null:this.querySelector('[id="'+a+'"]')}};a.ChildNodeInterface=f,a.NonElementParentNodeInterface=g,a.ParentNodeInterface=e}(window.ShadowDOMPolyfill),function(a){"use strict";function b(a){d.call(this,a)}var c=a.ChildNodeInterface,d=a.wrappers.Node,e=a.enqueueMutation,f=a.mixin,g=a.registerWrapper,h=a.unsafeUnwrap,i=window.CharacterData;b.prototype=Object.create(d.prototype),f(b.prototype,{get nodeValue(){return this.data},set nodeValue(a){this.data=a},get textContent(){return this.data},set textContent(a){this.data=a},get data(){return h(this).data},set data(a){var b=h(this).data;e(this,"characterData",{oldValue:b}),h(this).data=a}}),f(b.prototype,c),g(i,b,document.createTextNode("")),a.wrappers.CharacterData=b}(window.ShadowDOMPolyfill),function(a){"use strict";function b(a){return a>>>0}function c(a){d.call(this,a)}var d=a.wrappers.CharacterData,e=(a.enqueueMutation,a.mixin),f=a.registerWrapper,g=window.Text;c.prototype=Object.create(d.prototype),e(c.prototype,{splitText:function(a){a=b(a);var c=this.data;if(a>c.length)throw new Error("IndexSizeError");var d=c.slice(0,a),e=c.slice(a);this.data=d;var f=this.ownerDocument.createTextNode(e);return this.parentNode&&this.parentNode.insertBefore(f,this.nextSibling),f}}),f(g,c,document.createTextNode("")),a.wrappers.Text=c}(window.ShadowDOMPolyfill),function(a){"use strict";function b(a){return f(a).getAttribute("class")}function c(a,b){g(a,"attributes",{name:"class",namespace:null,oldValue:b})}function d(b){a.invalidateRendererBasedOnAttribute(b,"class")}function e(a,e,f){var g=a.ownerElement_;if(null==g)return e.apply(a,f);var h=b(g),i=e.apply(a,f);return b(g)!==h&&(c(g,h),d(g)),i}if(!window.DOMTokenList)return void console.warn("Missing DOMTokenList prototype, please include a compatible classList polyfill such as http://goo.gl/uTcepH.");var f=a.unsafeUnwrap,g=a.enqueueMutation,h=DOMTokenList.prototype.add;DOMTokenList.prototype.add=function(){e(this,h,arguments)};var i=DOMTokenList.prototype.remove;DOMTokenList.prototype.remove=function(){e(this,i,arguments)};var j=DOMTokenList.prototype.toggle;DOMTokenList.prototype.toggle=function(){return e(this,j,arguments)}}(window.ShadowDOMPolyfill),function(a){"use strict";function b(b,c){var d=b.parentNode;if(d&&d.shadowRoot){var e=a.getRendererForHost(d);e.dependsOnAttribute(c)&&e.invalidate()}}function c(a,b,c){k(a,"attributes",{name:b,namespace:null,oldValue:c})}function d(a){g.call(this,a)}var e=a.ChildNodeInterface,f=a.GetElementsByInterface,g=a.wrappers.Node,h=a.ParentNodeInterface,i=a.SelectorsInterface,j=a.MatchesInterface,k=(a.addWrapNodeListMethod,a.enqueueMutation),l=a.mixin,m=(a.oneOf,a.registerWrapper),n=a.unsafeUnwrap,o=a.wrappers,p=window.Element,q=["matches","mozMatchesSelector","msMatchesSelector","webkitMatchesSelector"].filter(function(a){return p.prototype[a]}),r=q[0],s=p.prototype[r],t=new WeakMap;d.prototype=Object.create(g.prototype),l(d.prototype,{createShadowRoot:function(){var b=new o.ShadowRoot(this);n(this).polymerShadowRoot_=b;var c=a.getRendererForHost(this);return c.invalidate(),b},get shadowRoot(){return n(this).polymerShadowRoot_||null},setAttribute:function(a,d){var e=n(this).getAttribute(a);n(this).setAttribute(a,d),c(this,a,e),b(this,a)},removeAttribute:function(a){var d=n(this).getAttribute(a);n(this).removeAttribute(a),c(this,a,d),b(this,a)},get classList(){var a=t.get(this);if(!a){if(a=n(this).classList,!a)return;a.ownerElement_=this,t.set(this,a)}return a},get className(){return n(this).className},set className(a){this.setAttribute("class",a)},get id(){return n(this).id},set id(a){this.setAttribute("id",a)}}),q.forEach(function(a){"matches"!==a&&(d.prototype[a]=function(a){return this.matches(a)})}),p.prototype.webkitCreateShadowRoot&&(d.prototype.webkitCreateShadowRoot=d.prototype.createShadowRoot),l(d.prototype,e),l(d.prototype,f),l(d.prototype,h),l(d.prototype,i),l(d.prototype,j),m(p,d,document.createElementNS(null,"x")),a.invalidateRendererBasedOnAttribute=b,a.matchesNames=q,a.originalMatches=s,a.wrappers.Element=d}(window.ShadowDOMPolyfill),function(a){"use strict";function b(a){switch(a){case"&":return"&";case"<":return"<";case">":return">";case'"':return""";case" ":return" "}}function c(a){return a.replace(B,b)}function d(a){return a.replace(C,b)}function e(a){for(var b={},c=0;c"):i+">"+h(a)+"";case Node.TEXT_NODE:var l=a.data;return b&&E[b.localName]?l:d(l);case Node.COMMENT_NODE:return"";default:throw console.error(a),new Error("not implemented")}}function h(a){a instanceof A.HTMLTemplateElement&&(a=a.content);for(var b="",c=a.firstChild;c;c=c.nextSibling)b+=g(c,a);return b}function i(a,b,c){var d=c||"div";a.textContent="";var e=y(a.ownerDocument.createElement(d));e.innerHTML=b;for(var f;f=e.firstChild;)a.appendChild(z(f))}function j(a){p.call(this,a)}function k(a,b){var c=y(a.cloneNode(!1));c.innerHTML=b;for(var d,e=y(document.createDocumentFragment());d=c.firstChild;)e.appendChild(d);return z(e)}function l(b){return function(){return a.renderAllPending(),x(this)[b]}}function m(a){q(j,a,l(a))}function n(b){Object.defineProperty(j.prototype,b,{get:l(b),set:function(c){a.renderAllPending(),x(this)[b]=c},configurable:!0,enumerable:!0})}function o(b){Object.defineProperty(j.prototype,b,{value:function(){return a.renderAllPending(),x(this)[b].apply(x(this),arguments)},configurable:!0,enumerable:!0})}var p=a.wrappers.Element,q=a.defineGetter,r=a.enqueueMutation,s=a.mixin,t=a.nodesWereAdded,u=a.nodesWereRemoved,v=a.registerWrapper,w=a.snapshotNodeList,x=a.unsafeUnwrap,y=a.unwrap,z=a.wrap,A=a.wrappers,B=/[&\u00A0"]/g,C=/[&\u00A0<>]/g,D=e(["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"]),E=e(["style","script","xmp","iframe","noembed","noframes","plaintext","noscript"]),F="http://www.w3.org/1999/xhtml",G=/MSIE/.test(navigator.userAgent),H=window.HTMLElement,I=window.HTMLTemplateElement;j.prototype=Object.create(p.prototype),s(j.prototype,{get innerHTML(){return h(this)},set innerHTML(a){if(G&&E[this.localName])return void(this.textContent=a);var b=w(this.childNodes);this.invalidateShadowRenderer()?this instanceof A.HTMLTemplateElement?i(this.content,a):i(this,a,this.tagName):!I&&this instanceof A.HTMLTemplateElement?i(this.content,a):x(this).innerHTML=a;var c=w(this.childNodes);r(this,"childList",{addedNodes:c,removedNodes:b}),u(b),t(c,this)},get outerHTML(){return g(this,this.parentNode)},set outerHTML(a){var b=this.parentNode;if(b){b.invalidateShadowRenderer();var c=k(b,a);b.replaceChild(c,this)}},insertAdjacentHTML:function(a,b){var c,d;switch(String(a).toLowerCase()){case"beforebegin":c=this.parentNode,d=this;break;case"afterend":c=this.parentNode,d=this.nextSibling;break;case"afterbegin":c=this,d=this.firstChild;break;case"beforeend":c=this,d=null;break;default:return}var e=k(c,b);c.insertBefore(e,d)},get hidden(){return this.hasAttribute("hidden")},set hidden(a){a?this.setAttribute("hidden",""):this.removeAttribute("hidden")}}),["clientHeight","clientLeft","clientTop","clientWidth","offsetHeight","offsetLeft","offsetTop","offsetWidth","scrollHeight","scrollWidth"].forEach(m),["scrollLeft","scrollTop"].forEach(n),["getBoundingClientRect","getClientRects","scrollIntoView"].forEach(o),v(H,j,document.createElement("b")),a.wrappers.HTMLElement=j,a.getInnerHTML=h,a.setInnerHTML=i}(window.ShadowDOMPolyfill),function(a){"use strict";function b(a){c.call(this,a)}var c=a.wrappers.HTMLElement,d=a.mixin,e=a.registerWrapper,f=a.unsafeUnwrap,g=a.wrap,h=window.HTMLCanvasElement;b.prototype=Object.create(c.prototype),d(b.prototype,{getContext:function(){var a=f(this).getContext.apply(f(this),arguments);return a&&g(a)}}),e(h,b,document.createElement("canvas")),a.wrappers.HTMLCanvasElement=b}(window.ShadowDOMPolyfill),function(a){"use strict";function b(a){c.call(this,a)}var c=a.wrappers.HTMLElement,d=a.mixin,e=a.registerWrapper,f=window.HTMLContentElement;b.prototype=Object.create(c.prototype),d(b.prototype,{constructor:b,get select(){return this.getAttribute("select")},set select(a){this.setAttribute("select",a)},setAttribute:function(a,b){c.prototype.setAttribute.call(this,a,b),"select"===String(a).toLowerCase()&&this.invalidateShadowRenderer(!0)}}),f&&e(f,b),a.wrappers.HTMLContentElement=b}(window.ShadowDOMPolyfill),function(a){"use strict";function b(a){c.call(this,a)}var c=a.wrappers.HTMLElement,d=a.mixin,e=a.registerWrapper,f=a.wrapHTMLCollection,g=a.unwrap,h=window.HTMLFormElement;b.prototype=Object.create(c.prototype),d(b.prototype,{get elements(){return f(g(this).elements)}}),e(h,b,document.createElement("form")),a.wrappers.HTMLFormElement=b}(window.ShadowDOMPolyfill),function(a){"use strict";function b(a){d.call(this,a)}function c(a,b){if(!(this instanceof c))throw new TypeError("DOM object constructor cannot be called as a function.");var e=f(document.createElement("img"));d.call(this,e),g(e,this),void 0!==a&&(e.width=a),void 0!==b&&(e.height=b)}var d=a.wrappers.HTMLElement,e=a.registerWrapper,f=a.unwrap,g=a.rewrap,h=window.HTMLImageElement;b.prototype=Object.create(d.prototype),e(h,b,document.createElement("img")),c.prototype=b.prototype,a.wrappers.HTMLImageElement=b,a.wrappers.Image=c}(window.ShadowDOMPolyfill),function(a){"use strict";function b(a){c.call(this,a)}var c=a.wrappers.HTMLElement,d=(a.mixin,a.wrappers.NodeList,a.registerWrapper),e=window.HTMLShadowElement;b.prototype=Object.create(c.prototype),b.prototype.constructor=b,e&&d(e,b),a.wrappers.HTMLShadowElement=b}(window.ShadowDOMPolyfill),function(a){"use strict";function b(a){if(!a.defaultView)return a;var b=l.get(a);if(!b){for(b=a.implementation.createHTMLDocument("");b.lastChild;)b.removeChild(b.lastChild);l.set(a,b)}return b}function c(a){for(var c,d=b(a.ownerDocument),e=i(d.createDocumentFragment());c=a.firstChild;)e.appendChild(c);return e}function d(a){if(e.call(this,a),!m){var b=c(a);k.set(this,j(b))}}var e=a.wrappers.HTMLElement,f=a.mixin,g=a.registerWrapper,h=a.unsafeUnwrap,i=a.unwrap,j=a.wrap,k=new WeakMap,l=new WeakMap,m=window.HTMLTemplateElement;d.prototype=Object.create(e.prototype),f(d.prototype,{constructor:d,get content(){return m?j(h(this).content):k.get(this)}}),m&&g(m,d),a.wrappers.HTMLTemplateElement=d}(window.ShadowDOMPolyfill),function(a){"use strict";function b(a){c.call(this,a)}var c=a.wrappers.HTMLElement,d=a.registerWrapper,e=window.HTMLMediaElement;e&&(b.prototype=Object.create(c.prototype),d(e,b,document.createElement("audio")),a.wrappers.HTMLMediaElement=b)}(window.ShadowDOMPolyfill),function(a){"use strict";function b(a){d.call(this,a)}function c(a){if(!(this instanceof c))throw new TypeError("DOM object constructor cannot be called as a function.");var b=f(document.createElement("audio"));d.call(this,b),g(b,this),b.setAttribute("preload","auto"),void 0!==a&&b.setAttribute("src",a)}var d=a.wrappers.HTMLMediaElement,e=a.registerWrapper,f=a.unwrap,g=a.rewrap,h=window.HTMLAudioElement;h&&(b.prototype=Object.create(d.prototype),e(h,b,document.createElement("audio")),c.prototype=b.prototype,a.wrappers.HTMLAudioElement=b,a.wrappers.Audio=c)}(window.ShadowDOMPolyfill),function(a){"use strict";function b(a){return a.replace(/\s+/g," ").trim()}function c(a){e.call(this,a)}function d(a,b,c,f){if(!(this instanceof d))throw new TypeError("DOM object constructor cannot be called as a function.");var g=i(document.createElement("option"));e.call(this,g),h(g,this),void 0!==a&&(g.text=a),void 0!==b&&g.setAttribute("value",b),c===!0&&g.setAttribute("selected",""),g.selected=f===!0}var e=a.wrappers.HTMLElement,f=a.mixin,g=a.registerWrapper,h=a.rewrap,i=a.unwrap,j=a.wrap,k=window.HTMLOptionElement;c.prototype=Object.create(e.prototype),f(c.prototype,{get text(){return b(this.textContent)},set text(a){this.textContent=b(String(a))},get form(){return j(i(this).form)}}),g(k,c,document.createElement("option")),d.prototype=c.prototype,a.wrappers.HTMLOptionElement=c,a.wrappers.Option=d}(window.ShadowDOMPolyfill),function(a){"use strict";function b(a){c.call(this,a)}var c=a.wrappers.HTMLElement,d=a.mixin,e=a.registerWrapper,f=a.unwrap,g=a.wrap,h=window.HTMLSelectElement;b.prototype=Object.create(c.prototype), +d(b.prototype,{add:function(a,b){"object"==typeof b&&(b=f(b)),f(this).add(f(a),b)},remove:function(a){return void 0===a?void c.prototype.remove.call(this):("object"==typeof a&&(a=f(a)),void f(this).remove(a))},get form(){return g(f(this).form)}}),e(h,b,document.createElement("select")),a.wrappers.HTMLSelectElement=b}(window.ShadowDOMPolyfill),function(a){"use strict";function b(a){c.call(this,a)}var c=a.wrappers.HTMLElement,d=a.mixin,e=a.registerWrapper,f=a.unwrap,g=a.wrap,h=a.wrapHTMLCollection,i=window.HTMLTableElement;b.prototype=Object.create(c.prototype),d(b.prototype,{get caption(){return g(f(this).caption)},createCaption:function(){return g(f(this).createCaption())},get tHead(){return g(f(this).tHead)},createTHead:function(){return g(f(this).createTHead())},createTFoot:function(){return g(f(this).createTFoot())},get tFoot(){return g(f(this).tFoot)},get tBodies(){return h(f(this).tBodies)},createTBody:function(){return g(f(this).createTBody())},get rows(){return h(f(this).rows)},insertRow:function(a){return g(f(this).insertRow(a))}}),e(i,b,document.createElement("table")),a.wrappers.HTMLTableElement=b}(window.ShadowDOMPolyfill),function(a){"use strict";function b(a){c.call(this,a)}var c=a.wrappers.HTMLElement,d=a.mixin,e=a.registerWrapper,f=a.wrapHTMLCollection,g=a.unwrap,h=a.wrap,i=window.HTMLTableSectionElement;b.prototype=Object.create(c.prototype),d(b.prototype,{constructor:b,get rows(){return f(g(this).rows)},insertRow:function(a){return h(g(this).insertRow(a))}}),e(i,b,document.createElement("thead")),a.wrappers.HTMLTableSectionElement=b}(window.ShadowDOMPolyfill),function(a){"use strict";function b(a){c.call(this,a)}var c=a.wrappers.HTMLElement,d=a.mixin,e=a.registerWrapper,f=a.wrapHTMLCollection,g=a.unwrap,h=a.wrap,i=window.HTMLTableRowElement;b.prototype=Object.create(c.prototype),d(b.prototype,{get cells(){return f(g(this).cells)},insertCell:function(a){return h(g(this).insertCell(a))}}),e(i,b,document.createElement("tr")),a.wrappers.HTMLTableRowElement=b}(window.ShadowDOMPolyfill),function(a){"use strict";function b(a){switch(a.localName){case"content":return new c(a);case"shadow":return new e(a);case"template":return new f(a)}d.call(this,a)}var c=a.wrappers.HTMLContentElement,d=a.wrappers.HTMLElement,e=a.wrappers.HTMLShadowElement,f=a.wrappers.HTMLTemplateElement,g=(a.mixin,a.registerWrapper),h=window.HTMLUnknownElement;b.prototype=Object.create(d.prototype),g(h,b),a.wrappers.HTMLUnknownElement=b}(window.ShadowDOMPolyfill),function(a){"use strict";function b(a){c.call(this,a)}var c=a.wrappers.Element,d=a.wrappers.HTMLElement,e=a.registerWrapper,f=(a.defineWrapGetter,a.unsafeUnwrap),g=a.wrap,h=a.mixin,i="http://www.w3.org/2000/svg",j=window.SVGElement,k=document.createElementNS(i,"title");if(!("classList"in k)){var l=Object.getOwnPropertyDescriptor(c.prototype,"classList");Object.defineProperty(d.prototype,"classList",l),delete c.prototype.classList}b.prototype=Object.create(c.prototype),h(b.prototype,{get ownerSVGElement(){return g(f(this).ownerSVGElement)}}),e(j,b,document.createElementNS(i,"title")),a.wrappers.SVGElement=b}(window.ShadowDOMPolyfill),function(a){"use strict";function b(a){m.call(this,a)}var c=a.mixin,d=a.registerWrapper,e=a.unwrap,f=a.wrap,g=window.SVGUseElement,h="http://www.w3.org/2000/svg",i=f(document.createElementNS(h,"g")),j=document.createElementNS(h,"use"),k=i.constructor,l=Object.getPrototypeOf(k.prototype),m=l.constructor;b.prototype=Object.create(l),"instanceRoot"in j&&c(b.prototype,{get instanceRoot(){return f(e(this).instanceRoot)},get animatedInstanceRoot(){return f(e(this).animatedInstanceRoot)}}),d(g,b,j),a.wrappers.SVGUseElement=b}(window.ShadowDOMPolyfill),function(a){"use strict";function b(a){c.call(this,a)}var c=a.wrappers.EventTarget,d=a.mixin,e=a.registerWrapper,f=a.unsafeUnwrap,g=a.wrap,h=window.SVGElementInstance;h&&(b.prototype=Object.create(c.prototype),d(b.prototype,{get correspondingElement(){return g(f(this).correspondingElement)},get correspondingUseElement(){return g(f(this).correspondingUseElement)},get parentNode(){return g(f(this).parentNode)},get childNodes(){throw new Error("Not implemented")},get firstChild(){return g(f(this).firstChild)},get lastChild(){return g(f(this).lastChild)},get previousSibling(){return g(f(this).previousSibling)},get nextSibling(){return g(f(this).nextSibling)}}),e(h,b),a.wrappers.SVGElementInstance=b)}(window.ShadowDOMPolyfill),function(a){"use strict";function b(a){e(a,this)}var c=a.mixin,d=a.registerWrapper,e=a.setWrapper,f=a.unsafeUnwrap,g=a.unwrap,h=a.unwrapIfNeeded,i=a.wrap,j=window.CanvasRenderingContext2D;c(b.prototype,{get canvas(){return i(f(this).canvas)},drawImage:function(){arguments[0]=h(arguments[0]),f(this).drawImage.apply(f(this),arguments)},createPattern:function(){return arguments[0]=g(arguments[0]),f(this).createPattern.apply(f(this),arguments)}}),d(j,b,document.createElement("canvas").getContext("2d")),a.wrappers.CanvasRenderingContext2D=b}(window.ShadowDOMPolyfill),function(a){"use strict";function b(a){e(a,this)}var c=a.mixin,d=a.registerWrapper,e=a.setWrapper,f=a.unsafeUnwrap,g=a.unwrapIfNeeded,h=a.wrap,i=window.WebGLRenderingContext;if(i){c(b.prototype,{get canvas(){return h(f(this).canvas)},texImage2D:function(){arguments[5]=g(arguments[5]),f(this).texImage2D.apply(f(this),arguments)},texSubImage2D:function(){arguments[6]=g(arguments[6]),f(this).texSubImage2D.apply(f(this),arguments)}});var j=/WebKit/.test(navigator.userAgent)?{drawingBufferHeight:null,drawingBufferWidth:null}:{};d(i,b,j),a.wrappers.WebGLRenderingContext=b}}(window.ShadowDOMPolyfill),function(a){"use strict";function b(a){c.call(this,a)}var c=a.wrappers.Node,d=a.GetElementsByInterface,e=a.NonElementParentNodeInterface,f=a.ParentNodeInterface,g=a.SelectorsInterface,h=a.mixin,i=a.registerObject,j=a.registerWrapper,k=window.DocumentFragment;b.prototype=Object.create(c.prototype),h(b.prototype,f),h(b.prototype,g),h(b.prototype,d),h(b.prototype,e),j(k,b,document.createDocumentFragment()),a.wrappers.DocumentFragment=b;var l=i(document.createComment(""));a.wrappers.Comment=l}(window.ShadowDOMPolyfill),function(a){"use strict";function b(a){var b=l(k(a).ownerDocument.createDocumentFragment());c.call(this,b),i(b,this);var e=a.shadowRoot;n.set(this,e),this.treeScope_=new d(this,g(e||a)),m.set(this,a)}var c=a.wrappers.DocumentFragment,d=a.TreeScope,e=a.elementFromPoint,f=a.getInnerHTML,g=a.getTreeScope,h=a.mixin,i=a.rewrap,j=a.setInnerHTML,k=a.unsafeUnwrap,l=a.unwrap,m=new WeakMap,n=new WeakMap;b.prototype=Object.create(c.prototype),h(b.prototype,{constructor:b,get innerHTML(){return f(this)},set innerHTML(a){j(this,a),this.invalidateShadowRenderer()},get olderShadowRoot(){return n.get(this)||null},get host(){return m.get(this)||null},invalidateShadowRenderer:function(){return m.get(this).invalidateShadowRenderer()},elementFromPoint:function(a,b){return e(this,this.ownerDocument,a,b)},getSelection:function(){return document.getSelection()}}),a.wrappers.ShadowRoot=b}(window.ShadowDOMPolyfill),function(a){"use strict";function b(a){var b=l(a).root;return b instanceof n?b.host:null}function c(b,c){if(b.shadowRoot){c=Math.min(b.childNodes.length-1,c);var d=b.childNodes[c];if(d){var e=a.getDestinationInsertionPoints(d);if(e.length>0){var f=e[0].parentNode;f.nodeType==Node.ELEMENT_NODE&&(b=f)}}}return b}function d(a){return a=k(a),b(a)||a}function e(a){g(a,this)}var f=a.registerWrapper,g=a.setWrapper,h=a.unsafeUnwrap,i=a.unwrap,j=a.unwrapIfNeeded,k=a.wrap,l=a.getTreeScope,m=window.Range,n=a.wrappers.ShadowRoot;e.prototype={get startContainer(){return d(h(this).startContainer)},get endContainer(){return d(h(this).endContainer)},get commonAncestorContainer(){return d(h(this).commonAncestorContainer)},setStart:function(a,b){a=c(a,b),h(this).setStart(j(a),b)},setEnd:function(a,b){a=c(a,b),h(this).setEnd(j(a),b)},setStartBefore:function(a){h(this).setStartBefore(j(a))},setStartAfter:function(a){h(this).setStartAfter(j(a))},setEndBefore:function(a){h(this).setEndBefore(j(a))},setEndAfter:function(a){h(this).setEndAfter(j(a))},selectNode:function(a){h(this).selectNode(j(a))},selectNodeContents:function(a){h(this).selectNodeContents(j(a))},compareBoundaryPoints:function(a,b){return h(this).compareBoundaryPoints(a,i(b))},extractContents:function(){return k(h(this).extractContents())},cloneContents:function(){return k(h(this).cloneContents())},insertNode:function(a){h(this).insertNode(j(a))},surroundContents:function(a){h(this).surroundContents(j(a))},cloneRange:function(){return k(h(this).cloneRange())},isPointInRange:function(a,b){return h(this).isPointInRange(j(a),b)},comparePoint:function(a,b){return h(this).comparePoint(j(a),b)},intersectsNode:function(a){return h(this).intersectsNode(j(a))},toString:function(){return h(this).toString()}},m.prototype.createContextualFragment&&(e.prototype.createContextualFragment=function(a){return k(h(this).createContextualFragment(a))}),f(window.Range,e,document.createRange()),a.wrappers.Range=e}(window.ShadowDOMPolyfill),function(a){"use strict";function b(a){a.previousSibling_=a.previousSibling,a.nextSibling_=a.nextSibling,a.parentNode_=a.parentNode}function c(c,e,f){var g=H(c),h=H(e),i=f?H(f):null;if(d(e),b(e),f)c.firstChild===f&&(c.firstChild_=f),f.previousSibling_=f.previousSibling;else{c.lastChild_=c.lastChild,c.lastChild===c.firstChild&&(c.firstChild_=c.firstChild);var j=I(g.lastChild);j&&(j.nextSibling_=j.nextSibling)}a.originalInsertBefore.call(g,h,i)}function d(c){var d=H(c),e=d.parentNode;if(e){var f=I(e);b(c),c.previousSibling&&(c.previousSibling.nextSibling_=c),c.nextSibling&&(c.nextSibling.previousSibling_=c),f.lastChild===c&&(f.lastChild_=c),f.firstChild===c&&(f.firstChild_=c),a.originalRemoveChild.call(e,d)}}function e(a){K.set(a,[])}function f(a){var b=K.get(a);return b||K.set(a,b=[]),b}function g(a){for(var b=[],c=0,d=a.firstChild;d;d=d.nextSibling)b[c++]=d;return b}function h(){for(var a=0;ap;p++){var q=I(f[k++]);h.get(q)||d(q)}for(var r=n.addedCount,s=f[k]&&I(f[k]),p=0;r>p;p++){var t=e[j++],u=t.node;c(b,u,s),h.set(u,!0),t.sync(h)}l+=r}for(var m=l;m=0;e--){var f=d[e],g=p(f);if(g){var h=f.olderShadowRoot;h&&(c=o(h));for(var i=0;i=0;k--)j=Object.create(j);["createdCallback","attachedCallback","detachedCallback","attributeChangedCallback"].forEach(function(a){var b=e[a];b&&(j[a]=function(){D(this)instanceof d||z(this),b.apply(D(this),arguments)})});var l={prototype:j};f&&(l["extends"]=f),d.prototype=e,d.prototype.constructor=d,a.constructorTable.set(j,d),a.nativePrototypeTable.set(e,j);K.call(C(this),b,l);return d},u([window.HTMLDocument||window.Document],["registerElement"])}u([window.HTMLBodyElement,window.HTMLDocument||window.Document,window.HTMLHeadElement,window.HTMLHtmlElement],["appendChild","compareDocumentPosition","contains","getElementsByClassName","getElementsByTagName","getElementsByTagNameNS","insertBefore","querySelector","querySelectorAll","removeChild","replaceChild"]),u([window.HTMLBodyElement,window.HTMLHeadElement,window.HTMLHtmlElement],v),u([window.HTMLDocument||window.Document],["adoptNode","importNode","contains","createComment","createDocumentFragment","createElement","createElementNS","createEvent","createEventNS","createRange","createTextNode","createTreeWalker","elementFromPoint","getElementById","getElementsByName","getSelection"]),w(b.prototype,j),w(b.prototype,l),w(b.prototype,o),w(b.prototype,m),w(b.prototype,{get implementation(){var a=F.get(this);return a?a:(a=new g(C(this).implementation),F.set(this,a),a)},get defaultView(){return D(C(this).defaultView)}}),x(window.Document,b,document.implementation.createHTMLDocument("")),window.HTMLDocument&&x(window.HTMLDocument,b),E([window.HTMLBodyElement,window.HTMLDocument||window.Document,window.HTMLHeadElement]);var L=document.implementation.createDocument;g.prototype.createDocument=function(){return arguments[2]=C(arguments[2]),D(L.apply(B(this),arguments))},h(g,"createDocumentType"),h(g,"createHTMLDocument"),i(g,"hasFeature"),x(window.DOMImplementation,g),u([window.DOMImplementation],["createDocument","createDocumentType","createHTMLDocument","hasFeature"]),a.adoptNodeNoRemove=d,a.wrappers.DOMImplementation=g,a.wrappers.Document=b}(window.ShadowDOMPolyfill),function(a){"use strict";function b(a){c.call(this,a)}var c=a.wrappers.EventTarget,d=a.wrappers.Selection,e=a.mixin,f=a.registerWrapper,g=a.renderAllPending,h=a.unwrap,i=a.unwrapIfNeeded,j=a.wrap,k=window.Window,l=window.getComputedStyle,m=window.getDefaultComputedStyle,n=window.getSelection;b.prototype=Object.create(c.prototype),k.prototype.getComputedStyle=function(a,b){return j(this||window).getComputedStyle(i(a),b)},m&&(k.prototype.getDefaultComputedStyle=function(a,b){return j(this||window).getDefaultComputedStyle(i(a),b)}),k.prototype.getSelection=function(){return j(this||window).getSelection()},delete window.getComputedStyle,delete window.getDefaultComputedStyle,delete window.getSelection,["addEventListener","removeEventListener","dispatchEvent"].forEach(function(a){k.prototype[a]=function(){var b=j(this||window);return b[a].apply(b,arguments)},delete window[a]}),e(b.prototype,{getComputedStyle:function(a,b){return g(),l.call(h(this),i(a),b)},getSelection:function(){return g(),new d(n.call(h(this)))},get document(){return j(h(this).document)}}),m&&(b.prototype.getDefaultComputedStyle=function(a,b){return g(),m.call(h(this),i(a),b)}),f(k,b,window),a.wrappers.Window=b}(window.ShadowDOMPolyfill),function(a){"use strict";var b=a.unwrap,c=window.DataTransfer||window.Clipboard,d=c.prototype.setDragImage;d&&(c.prototype.setDragImage=function(a,c,e){d.call(this,b(a),c,e)})}(window.ShadowDOMPolyfill),function(a){"use strict";function b(a){var b;b=a instanceof f?a:new f(a&&e(a)),d(b,this)}var c=a.registerWrapper,d=a.setWrapper,e=a.unwrap,f=window.FormData;f&&(c(f,b,new f),a.wrappers.FormData=b)}(window.ShadowDOMPolyfill),function(a){"use strict";var b=a.unwrapIfNeeded,c=XMLHttpRequest.prototype.send;XMLHttpRequest.prototype.send=function(a){return c.call(this,b(a))}}(window.ShadowDOMPolyfill),function(a){"use strict";function b(a){var b=c[a],d=window[b];if(d){var e=document.createElement(a),f=e.constructor;window[b]=f}}var c=(a.isWrapperFor,{a:"HTMLAnchorElement",area:"HTMLAreaElement",audio:"HTMLAudioElement",base:"HTMLBaseElement",body:"HTMLBodyElement",br:"HTMLBRElement",button:"HTMLButtonElement",canvas:"HTMLCanvasElement",caption:"HTMLTableCaptionElement",col:"HTMLTableColElement",content:"HTMLContentElement",data:"HTMLDataElement",datalist:"HTMLDataListElement",del:"HTMLModElement",dir:"HTMLDirectoryElement",div:"HTMLDivElement",dl:"HTMLDListElement",embed:"HTMLEmbedElement",fieldset:"HTMLFieldSetElement",font:"HTMLFontElement",form:"HTMLFormElement",frame:"HTMLFrameElement",frameset:"HTMLFrameSetElement",h1:"HTMLHeadingElement",head:"HTMLHeadElement",hr:"HTMLHRElement",html:"HTMLHtmlElement",iframe:"HTMLIFrameElement",img:"HTMLImageElement",input:"HTMLInputElement",keygen:"HTMLKeygenElement",label:"HTMLLabelElement",legend:"HTMLLegendElement",li:"HTMLLIElement",link:"HTMLLinkElement",map:"HTMLMapElement",marquee:"HTMLMarqueeElement",menu:"HTMLMenuElement",menuitem:"HTMLMenuItemElement",meta:"HTMLMetaElement",meter:"HTMLMeterElement",object:"HTMLObjectElement",ol:"HTMLOListElement",optgroup:"HTMLOptGroupElement",option:"HTMLOptionElement",output:"HTMLOutputElement",p:"HTMLParagraphElement",param:"HTMLParamElement",pre:"HTMLPreElement",progress:"HTMLProgressElement",q:"HTMLQuoteElement",script:"HTMLScriptElement",select:"HTMLSelectElement",shadow:"HTMLShadowElement",source:"HTMLSourceElement",span:"HTMLSpanElement",style:"HTMLStyleElement",table:"HTMLTableElement",tbody:"HTMLTableSectionElement",template:"HTMLTemplateElement",textarea:"HTMLTextAreaElement",thead:"HTMLTableSectionElement",time:"HTMLTimeElement",title:"HTMLTitleElement",tr:"HTMLTableRowElement",track:"HTMLTrackElement",ul:"HTMLUListElement",video:"HTMLVideoElement"});Object.keys(c).forEach(b),Object.getOwnPropertyNames(a.wrappers).forEach(function(b){window[b]=a.wrappers[b]})}(window.ShadowDOMPolyfill),function(a){function b(a,b){var c="";return Array.prototype.forEach.call(a,function(a){c+=a.textContent+"\n\n"}),b||(c=c.replace(l,"")),c}function c(a){var b=document.createElement("style");return b.textContent=a,b}function d(a){var b=c(a);document.head.appendChild(b);var d=[];if(b.sheet)try{d=b.sheet.cssRules}catch(e){}else console.warn("sheet not found",b);return b.parentNode.removeChild(b),d}function e(){D.initialized=!0,document.body.appendChild(D);var a=D.contentDocument,b=a.createElement("base");b.href=document.baseURI,a.head.appendChild(b)}function f(a){D.initialized||e(),document.body.appendChild(D),a(D.contentDocument),document.body.removeChild(D)}function g(a,b){if(b){var e;if(a.match("@import")&&F){var g=c(a);f(function(a){a.head.appendChild(g.impl),e=Array.prototype.slice.call(g.sheet.cssRules,0),b(e)})}else e=d(a),b(e)}}function h(a){a&&j().appendChild(document.createTextNode(a))}function i(a,b){var d=c(a);d.setAttribute(b,""),d.setAttribute(H,""),document.head.appendChild(d)}function j(){return E||(E=document.createElement("style"),E.setAttribute(H,""),E[H]=!0),E}var k={strictStyling:!1,registry:{},shimStyling:function(a,c,d){var e=this.prepareRoot(a,c,d),f=this.isTypeExtension(d),g=this.makeScopeSelector(c,f),h=b(e,!0);h=this.scopeCssText(h,g),a&&(a.shimmedStyle=h),this.addCssToDocument(h,c)},shimStyle:function(a,b){return this.shimCssText(a.textContent,b)},shimCssText:function(a,b){return a=this.insertDirectives(a),this.scopeCssText(a,b)},makeScopeSelector:function(a,b){return a?b?"[is="+a+"]":a:""},isTypeExtension:function(a){return a&&a.indexOf("-")<0},prepareRoot:function(a,b,c){var d=this.registerRoot(a,b,c);return this.replaceTextInStyles(d.rootStyles,this.insertDirectives),this.removeStyles(a,d.rootStyles),this.strictStyling&&this.applyScopeToContent(a,b),d.scopeStyles},removeStyles:function(a,b){for(var c,d=0,e=b.length;e>d&&(c=b[d]);d++)c.parentNode.removeChild(c)},registerRoot:function(a,b,c){var d=this.registry[b]={root:a,name:b,extendsName:c},e=this.findStyles(a);d.rootStyles=e,d.scopeStyles=d.rootStyles;var f=this.registry[d.extendsName];return f&&(d.scopeStyles=f.scopeStyles.concat(d.scopeStyles)),d},findStyles:function(a){if(!a)return[];var b=a.querySelectorAll("style");return Array.prototype.filter.call(b,function(a){return!a.hasAttribute(I)})},applyScopeToContent:function(a,b){a&&(Array.prototype.forEach.call(a.querySelectorAll("*"),function(a){a.setAttribute(b,"")}),Array.prototype.forEach.call(a.querySelectorAll("template"),function(a){this.applyScopeToContent(a.content,b)},this))},insertDirectives:function(a){return a=this.insertPolyfillDirectivesInCssText(a),this.insertPolyfillRulesInCssText(a)},insertPolyfillDirectivesInCssText:function(a){return a=a.replace(m,function(a,b){return b.slice(0,-2)+"{"}),a.replace(n,function(a,b){return b+" {"})},insertPolyfillRulesInCssText:function(a){return a=a.replace(o,function(a,b){return b.slice(0,-1)}),a.replace(p,function(a,b,c,d){var e=a.replace(b,"").replace(c,"");return d+e})},scopeCssText:function(a,b){var c=this.extractUnscopedRulesFromCssText(a);if(a=this.insertPolyfillHostInCssText(a),a=this.convertColonHost(a),a=this.convertColonHostContext(a),a=this.convertShadowDOMSelectors(a),b){var a,d=this;g(a,function(c){a=d.scopeRules(c,b)})}return a=a+"\n"+c,a.trim()},extractUnscopedRulesFromCssText:function(a){for(var b,c="";b=q.exec(a);)c+=b[1].slice(0,-1)+"\n\n";for(;b=r.exec(a);)c+=b[0].replace(b[2],"").replace(b[1],b[3])+"\n\n";return c},convertColonHost:function(a){return this.convertColonRule(a,v,this.colonHostPartReplacer)},convertColonHostContext:function(a){return this.convertColonRule(a,w,this.colonHostContextPartReplacer)},convertColonRule:function(a,b,c){return a.replace(b,function(a,b,d,e){if(b=A,d){for(var f,g=d.split(","),h=[],i=0,j=g.length;j>i&&(f=g[i]);i++)f=f.trim(),h.push(c(b,f,e));return h.join(",")}return b+e})},colonHostContextPartReplacer:function(a,b,c){return b.match(s)?this.colonHostPartReplacer(a,b,c):a+b+c+", "+b+" "+a+c},colonHostPartReplacer:function(a,b,c){return a+b.replace(s,"")+c},convertShadowDOMSelectors:function(a){for(var b=0;b","+","~"],d=a,e="["+b+"]";return c.forEach(function(a){var b=d.split(a);d=b.map(function(a){var b=a.trim().replace(B,"");return b&&c.indexOf(b)<0&&b.indexOf(e)<0&&(a=b.replace(/([^:]*)(:*)(.*)/,"$1"+e+"$2$3")),a}).join(a)}),d},insertPolyfillHostInCssText:function(a){return a.replace(z,t).replace(y,s)},propertiesFromRule:function(a){var b=a.style.cssText;a.style.content&&!a.style.content.match(/['"]+|attr/)&&(b=b.replace(/content:[^;]*;/g,"content: '"+a.style.content+"';"));var c=a.style;for(var d in c)"initial"===c[d]&&(b+=d+": initial; ");return b},replaceTextInStyles:function(a,b){a&&b&&(a instanceof Array||(a=[a]),Array.prototype.forEach.call(a,function(a){a.textContent=b.call(this,a.textContent); +},this))},addCssToDocument:function(a,b){a.match("@import")?i(a,b):h(a)}},l=/\/\*[^*]*\*+([^\/*][^*]*\*+)*\//gim,m=/\/\*\s*@polyfill ([^*]*\*+([^\/*][^*]*\*+)*\/)([^{]*?){/gim,n=/polyfill-next-selector[^}]*content\:[\s]*?['"](.*?)['"][;\s]*}([^{]*?){/gim,o=/\/\*\s@polyfill-rule([^*]*\*+([^\/*][^*]*\*+)*)\//gim,p=/(polyfill-rule)[^}]*(content\:[\s]*['"](.*?)['"])[;\s]*[^}]*}/gim,q=/\/\*\s@polyfill-unscoped-rule([^*]*\*+([^\/*][^*]*\*+)*)\//gim,r=/(polyfill-unscoped-rule)[^}]*(content\:[\s]*['"](.*?)['"])[;\s]*[^}]*}/gim,s="-shadowcsshost",t="-shadowcsscontext",u=")(?:\\(((?:\\([^)(]*\\)|[^)(]*)+?)\\))?([^,{]*)",v=new RegExp("("+s+u,"gim"),w=new RegExp("("+t+u,"gim"),x="([>\\s~+[.,{:][\\s\\S]*)?$",y=/\:host/gim,z=/\:host-context/gim,A=s+"-no-combinator",B=new RegExp(s,"gim"),C=(new RegExp(t,"gim"),[/>>>/g,/::shadow/g,/::content/g,/\/deep\//g,/\/shadow\//g,/\/shadow-deep\//g,/\^\^/g,/\^/g]),D=document.createElement("iframe");D.style.display="none";var E,F=navigator.userAgent.match("Chrome"),G="shim-shadowdom",H="shim-shadowdom-css",I="no-shim";if(window.ShadowDOMPolyfill){h("style { display: none !important; }\n");var J=ShadowDOMPolyfill.wrap(document),K=J.querySelector("head");K.insertBefore(j(),K.childNodes[0]),document.addEventListener("DOMContentLoaded",function(){a.urlResolver;if(window.HTMLImports&&!HTMLImports.useNative){var b="link[rel=stylesheet]["+G+"]",c="style["+G+"]";HTMLImports.importer.documentPreloadSelectors+=","+b,HTMLImports.importer.importsPreloadSelectors+=","+b,HTMLImports.parser.documentSelectors=[HTMLImports.parser.documentSelectors,b,c].join(",");var d=HTMLImports.parser.parseGeneric;HTMLImports.parser.parseGeneric=function(a){if(!a[H]){var b=a.__importElement||a;if(!b.hasAttribute(G))return void d.call(this,a);a.__resource&&(b=a.ownerDocument.createElement("style"),b.textContent=a.__resource),HTMLImports.path.resolveUrlsInStyle(b,a.href),b.textContent=k.shimStyle(b),b.removeAttribute(G,""),b.setAttribute(H,""),b[H]=!0,b.parentNode!==K&&(a.parentNode===K?K.replaceChild(b,a):this.addElementToDocument(b)),b.__importParsed=!0,this.markParsingComplete(a),this.parseNext()}};var e=HTMLImports.parser.hasResource;HTMLImports.parser.hasResource=function(a){return"link"===a.localName&&"stylesheet"===a.rel&&a.hasAttribute(G)?a.__resource:e.call(this,a)}}})}a.ShadowCSS=k}(window.WebComponents)),function(a){window.ShadowDOMPolyfill?(window.wrap=ShadowDOMPolyfill.wrapIfNeeded,window.unwrap=ShadowDOMPolyfill.unwrapIfNeeded):window.wrap=window.unwrap=function(a){return a}}(window.WebComponents),function(a){"use strict";function b(a){return void 0!==m[a]}function c(){h.call(this),this._isInvalid=!0}function d(a){return""==a&&c.call(this),a.toLowerCase()}function e(a){var b=a.charCodeAt(0);return b>32&&127>b&&-1==[34,35,60,62,63,96].indexOf(b)?a:encodeURIComponent(a)}function f(a){var b=a.charCodeAt(0);return b>32&&127>b&&-1==[34,35,60,62,96].indexOf(b)?a:encodeURIComponent(a)}function g(a,g,h){function i(a){t.push(a)}var j=g||"scheme start",k=0,l="",r=!1,s=!1,t=[];a:for(;(a[k-1]!=o||0==k)&&!this._isInvalid;){var u=a[k];switch(j){case"scheme start":if(!u||!p.test(u)){if(g){i("Invalid scheme.");break a}l="",j="no scheme";continue}l+=u.toLowerCase(),j="scheme";break;case"scheme":if(u&&q.test(u))l+=u.toLowerCase();else{if(":"!=u){if(g){if(o==u)break a;i("Code point not allowed in scheme: "+u);break a}l="",k=0,j="no scheme";continue}if(this._scheme=l,l="",g)break a;b(this._scheme)&&(this._isRelative=!0),j="file"==this._scheme?"relative":this._isRelative&&h&&h._scheme==this._scheme?"relative or authority":this._isRelative?"authority first slash":"scheme data"}break;case"scheme data":"?"==u?(this._query="?",j="query"):"#"==u?(this._fragment="#",j="fragment"):o!=u&&" "!=u&&"\n"!=u&&"\r"!=u&&(this._schemeData+=e(u));break;case"no scheme":if(h&&b(h._scheme)){j="relative";continue}i("Missing scheme."),c.call(this);break;case"relative or authority":if("/"!=u||"/"!=a[k+1]){i("Expected /, got: "+u),j="relative";continue}j="authority ignore slashes";break;case"relative":if(this._isRelative=!0,"file"!=this._scheme&&(this._scheme=h._scheme),o==u){this._host=h._host,this._port=h._port,this._path=h._path.slice(),this._query=h._query,this._username=h._username,this._password=h._password;break a}if("/"==u||"\\"==u)"\\"==u&&i("\\ is an invalid code point."),j="relative slash";else if("?"==u)this._host=h._host,this._port=h._port,this._path=h._path.slice(),this._query="?",this._username=h._username,this._password=h._password,j="query";else{if("#"!=u){var v=a[k+1],w=a[k+2];("file"!=this._scheme||!p.test(u)||":"!=v&&"|"!=v||o!=w&&"/"!=w&&"\\"!=w&&"?"!=w&&"#"!=w)&&(this._host=h._host,this._port=h._port,this._username=h._username,this._password=h._password,this._path=h._path.slice(),this._path.pop()),j="relative path";continue}this._host=h._host,this._port=h._port,this._path=h._path.slice(),this._query=h._query,this._fragment="#",this._username=h._username,this._password=h._password,j="fragment"}break;case"relative slash":if("/"!=u&&"\\"!=u){"file"!=this._scheme&&(this._host=h._host,this._port=h._port,this._username=h._username,this._password=h._password),j="relative path";continue}"\\"==u&&i("\\ is an invalid code point."),j="file"==this._scheme?"file host":"authority ignore slashes";break;case"authority first slash":if("/"!=u){i("Expected '/', got: "+u),j="authority ignore slashes";continue}j="authority second slash";break;case"authority second slash":if(j="authority ignore slashes","/"!=u){i("Expected '/', got: "+u);continue}break;case"authority ignore slashes":if("/"!=u&&"\\"!=u){j="authority";continue}i("Expected authority, got: "+u);break;case"authority":if("@"==u){r&&(i("@ already seen."),l+="%40"),r=!0;for(var x=0;x0){var e=c[d-1],f=n(e,a);if(f)return void(c[d-1]=f)}else b(this.observer);c[d]=a},addListeners:function(){this.addListeners_(this.target)},addListeners_:function(a){var b=this.options;b.attributes&&a.addEventListener("DOMAttrModified",this,!0),b.characterData&&a.addEventListener("DOMCharacterDataModified",this,!0),b.childList&&a.addEventListener("DOMNodeInserted",this,!0),(b.childList||b.subtree)&&a.addEventListener("DOMNodeRemoved",this,!0)},removeListeners:function(){this.removeListeners_(this.target)},removeListeners_:function(a){var b=this.options;b.attributes&&a.removeEventListener("DOMAttrModified",this,!0),b.characterData&&a.removeEventListener("DOMCharacterDataModified",this,!0),b.childList&&a.removeEventListener("DOMNodeInserted",this,!0),(b.childList||b.subtree)&&a.removeEventListener("DOMNodeRemoved",this,!0)},addTransientObserver:function(a){if(a!==this.target){this.addListeners_(a),this.transientObservedNodes.push(a);var b=q.get(a);b||q.set(a,b=[]),b.push(this)}},removeTransientObservers:function(){var a=this.transientObservedNodes;this.transientObservedNodes=[],a.forEach(function(a){this.removeListeners_(a);for(var b=q.get(a),c=0;cn&&(m=h[n]);n++)g(m)?(i++,c()):(m.addEventListener("load",d),m.addEventListener("error",f));else c()}function g(a){return l?a.__loaded||a["import"]&&"loading"!==a["import"].readyState:a.__importParsed}function h(a){for(var b,c=0,d=a.length;d>c&&(b=a[c]);c++)i(b)&&j(b)}function i(a){return"link"===a.localName&&"import"===a.rel}function j(a){var b=a["import"];b?e({target:a}):(a.addEventListener("load",e),a.addEventListener("error",e))}var k="import",l=Boolean(k in document.createElement("link")),m=Boolean(window.ShadowDOMPolyfill),n=function(a){return m?window.ShadowDOMPolyfill.wrapIfNeeded(a):a},o=n(document),p={get:function(){var a=window.HTMLImports.currentScript||document.currentScript||("complete"!==document.readyState?document.scripts[document.scripts.length-1]:null);return n(a)},configurable:!0};Object.defineProperty(document,"_currentScript",p),Object.defineProperty(o,"_currentScript",p);var q=/Trident/.test(navigator.userAgent),r=q?"complete":"interactive",s="readystatechange";l&&(new MutationObserver(function(a){for(var b,c=0,d=a.length;d>c&&(b=a[c]);c++)b.addedNodes&&h(b.addedNodes)}).observe(document.head,{childList:!0}),function(){if("loading"===document.readyState)for(var a,b=document.querySelectorAll("link[rel=import]"),c=0,d=b.length;d>c&&(a=b[c]);c++)j(a)}()),b(function(a){window.HTMLImports.ready=!0,window.HTMLImports.readyTime=(new Date).getTime();var b=o.createEvent("CustomEvent");b.initCustomEvent("HTMLImportsLoaded",!0,!0,a),o.dispatchEvent(b)}),a.IMPORT_LINK_TYPE=k,a.useNative=l,a.rootDocument=o,a.whenReady=b,a.isIE=q}(window.HTMLImports),function(a){var b=[],c=function(a){b.push(a)},d=function(){b.forEach(function(b){b(a)})};a.addModule=c,a.initializeModules=d}(window.HTMLImports),window.HTMLImports.addModule(function(a){var b=/(url\()([^)]*)(\))/g,c=/(@import[\s]+(?!url\())([^;]*)(;)/g,d={resolveUrlsInStyle:function(a,b){var c=a.ownerDocument,d=c.createElement("a");return a.textContent=this.resolveUrlsInCssText(a.textContent,b,d),a},resolveUrlsInCssText:function(a,d,e){var f=this.replaceUrls(a,e,d,b);return f=this.replaceUrls(f,e,d,c)},replaceUrls:function(a,b,c,d){return a.replace(d,function(a,d,e,f){var g=e.replace(/["']/g,"");return c&&(g=new URL(g,c).href),b.href=g,g=b.href,d+"'"+g+"'"+f})}};a.path=d}),window.HTMLImports.addModule(function(a){var b={async:!0,ok:function(a){return a.status>=200&&a.status<300||304===a.status||0===a.status},load:function(c,d,e){var f=new XMLHttpRequest;return(a.flags.debug||a.flags.bust)&&(c+="?"+Math.random()),f.open("GET",c,b.async),f.addEventListener("readystatechange",function(a){if(4===f.readyState){var c=null;try{var g=f.getResponseHeader("Location");g&&(c="/"===g.substr(0,1)?location.origin+g:g)}catch(a){console.error(a.message)}d.call(e,!b.ok(f)&&f,f.response||f.responseText,c)}}),f.send(),f},loadDocument:function(a,b,c){this.load(a,b,c).responseType="document"}};a.xhr=b}),window.HTMLImports.addModule(function(a){var b=a.xhr,c=a.flags,d=function(a,b){this.cache={},this.onload=a,this.oncomplete=b,this.inflight=0,this.pending={}};d.prototype={addNodes:function(a){this.inflight+=a.length;for(var b,c=0,d=a.length;d>c&&(b=a[c]);c++)this.require(b);this.checkDone()},addNode:function(a){this.inflight++,this.require(a),this.checkDone()},require:function(a){var b=a.src||a.href;a.__nodeUrl=b,this.dedupe(b,a)||this.fetch(b,a)},dedupe:function(a,b){if(this.pending[a])return this.pending[a].push(b),!0;return this.cache[a]?(this.onload(a,b,this.cache[a]),this.tail(),!0):(this.pending[a]=[b],!1)},fetch:function(a,d){if(c.load&&console.log("fetch",a,d),a)if(a.match(/^data:/)){var e=a.split(","),f=e[0],g=e[1];g=f.indexOf(";base64")>-1?atob(g):decodeURIComponent(g),setTimeout(function(){this.receive(a,d,null,g)}.bind(this),0)}else{var h=function(b,c,e){this.receive(a,d,b,c,e)}.bind(this);b.load(a,h)}else setTimeout(function(){this.receive(a,d,{error:"href must be specified"},null)}.bind(this),0)},receive:function(a,b,c,d,e){this.cache[a]=d;for(var f,g=this.pending[a],h=0,i=g.length;i>h&&(f=g[h]);h++)this.onload(a,f,d,c,e),this.tail();this.pending[a]=null},tail:function(){--this.inflight,this.checkDone()},checkDone:function(){this.inflight||this.oncomplete()}},a.Loader=d}),window.HTMLImports.addModule(function(a){var b=function(a){this.addCallback=a,this.mo=new MutationObserver(this.handler.bind(this))};b.prototype={handler:function(a){for(var b,c=0,d=a.length;d>c&&(b=a[c]);c++)"childList"===b.type&&b.addedNodes.length&&this.addedNodes(b.addedNodes)},addedNodes:function(a){this.addCallback&&this.addCallback(a);for(var b,c=0,d=a.length;d>c&&(b=a[c]);c++)b.children&&b.children.length&&this.addedNodes(b.children)},observe:function(a){this.mo.observe(a,{childList:!0,subtree:!0})}},a.Observer=b}),window.HTMLImports.addModule(function(a){function b(a){return"link"===a.localName&&a.rel===k}function c(a){var b=d(a);return"data:text/javascript;charset=utf-8,"+encodeURIComponent(b)}function d(a){return a.textContent+e(a)}function e(a){var b=a.ownerDocument;b.__importedScripts=b.__importedScripts||0;var c=a.ownerDocument.baseURI,d=b.__importedScripts?"-"+b.__importedScripts:"";return b.__importedScripts++,"\n//# sourceURL="+c+d+".js\n"}function f(a){var b=a.ownerDocument.createElement("style");return b.textContent=a.textContent,g.resolveUrlsInStyle(b),b}var g=a.path,h=a.rootDocument,i=a.flags,j=a.isIE,k=a.IMPORT_LINK_TYPE,l="link[rel="+k+"]",m={documentSelectors:l,importsSelectors:[l,"link[rel=stylesheet]:not([type])","style:not([type])","script:not([type])",'script[type="application/javascript"]','script[type="text/javascript"]'].join(","),map:{link:"parseLink",script:"parseScript",style:"parseStyle"},dynamicElements:[],parseNext:function(){var a=this.nextToParse();a&&this.parse(a)},parse:function(a){if(this.isParsed(a))return void(i.parse&&console.log("[%s] is already parsed",a.localName));var b=this[this.map[a.localName]];b&&(this.markParsing(a),b.call(this,a))},parseDynamic:function(a,b){this.dynamicElements.push(a),b||this.parseNext()},markParsing:function(a){i.parse&&console.log("parsing",a),this.parsingElement=a},markParsingComplete:function(a){a.__importParsed=!0,this.markDynamicParsingComplete(a),a.__importElement&&(a.__importElement.__importParsed=!0,this.markDynamicParsingComplete(a.__importElement)),this.parsingElement=null,i.parse&&console.log("completed",a)},markDynamicParsingComplete:function(a){var b=this.dynamicElements.indexOf(a);b>=0&&this.dynamicElements.splice(b,1)},parseImport:function(a){if(a["import"]=a.__doc,window.HTMLImports.__importsParsingHook&&window.HTMLImports.__importsParsingHook(a),a["import"]&&(a["import"].__importParsed=!0),this.markParsingComplete(a),a.__resource&&!a.__error?a.dispatchEvent(new CustomEvent("load",{bubbles:!1})):a.dispatchEvent(new CustomEvent("error",{bubbles:!1})),a.__pending)for(var b;a.__pending.length;)b=a.__pending.shift(),b&&b({target:a});this.parseNext()},parseLink:function(a){b(a)?this.parseImport(a):(a.href=a.href,this.parseGeneric(a))},parseStyle:function(a){var b=a;a=f(a),b.__appliedElement=a,a.__importElement=b,this.parseGeneric(a)},parseGeneric:function(a){this.trackElement(a),this.addElementToDocument(a)},rootImportForElement:function(a){for(var b=a;b.ownerDocument.__importLink;)b=b.ownerDocument.__importLink;return b},addElementToDocument:function(a){var b=this.rootImportForElement(a.__importElement||a);b.parentNode.insertBefore(a,b)},trackElement:function(a,b){var c=this,d=function(e){a.removeEventListener("load",d),a.removeEventListener("error",d),b&&b(e),c.markParsingComplete(a),c.parseNext()};if(a.addEventListener("load",d),a.addEventListener("error",d),j&&"style"===a.localName){var e=!1;if(-1==a.textContent.indexOf("@import"))e=!0;else if(a.sheet){e=!0;for(var f,g=a.sheet.cssRules,h=g?g.length:0,i=0;h>i&&(f=g[i]);i++)f.type===CSSRule.IMPORT_RULE&&(e=e&&Boolean(f.styleSheet))}e&&setTimeout(function(){a.dispatchEvent(new CustomEvent("load",{bubbles:!1}))})}},parseScript:function(b){var d=document.createElement("script");d.__importElement=b,d.src=b.src?b.src:c(b),a.currentScript=b,this.trackElement(d,function(b){d.parentNode&&d.parentNode.removeChild(d),a.currentScript=null}),this.addElementToDocument(d)},nextToParse:function(){return this._mayParse=[],!this.parsingElement&&(this.nextToParseInDoc(h)||this.nextToParseDynamic())},nextToParseInDoc:function(a,c){if(a&&this._mayParse.indexOf(a)<0){this._mayParse.push(a);for(var d,e=a.querySelectorAll(this.parseSelectorsForNode(a)),f=0,g=e.length;g>f&&(d=e[f]);f++)if(!this.isParsed(d))return this.hasResource(d)?b(d)?this.nextToParseInDoc(d.__doc,d):d:void 0}return c},nextToParseDynamic:function(){return this.dynamicElements[0]},parseSelectorsForNode:function(a){var b=a.ownerDocument||a;return b===h?this.documentSelectors:this.importsSelectors},isParsed:function(a){return a.__importParsed},needsDynamicParsing:function(a){return this.dynamicElements.indexOf(a)>=0},hasResource:function(a){return b(a)&&void 0===a.__doc?!1:!0}};a.parser=m,a.IMPORT_SELECTOR=l}),window.HTMLImports.addModule(function(a){function b(a){return c(a,g)}function c(a,b){return"link"===a.localName&&a.getAttribute("rel")===b}function d(a){return!!Object.getOwnPropertyDescriptor(a,"baseURI")}function e(a,b){var c=document.implementation.createHTMLDocument(g);c._URL=b;var e=c.createElement("base");e.setAttribute("href",b),c.baseURI||d(c)||Object.defineProperty(c,"baseURI",{value:b});var f=c.createElement("meta");return f.setAttribute("charset","utf-8"),c.head.appendChild(f),c.head.appendChild(e),c.body.innerHTML=a,window.HTMLTemplateElement&&HTMLTemplateElement.bootstrap&&HTMLTemplateElement.bootstrap(c),c}var f=a.flags,g=a.IMPORT_LINK_TYPE,h=a.IMPORT_SELECTOR,i=a.rootDocument,j=a.Loader,k=a.Observer,l=a.parser,m={documents:{},documentPreloadSelectors:h,importsPreloadSelectors:[h].join(","),loadNode:function(a){n.addNode(a)},loadSubtree:function(a){var b=this.marshalNodes(a);n.addNodes(b)},marshalNodes:function(a){return a.querySelectorAll(this.loadSelectorsForNode(a))},loadSelectorsForNode:function(a){var b=a.ownerDocument||a;return b===i?this.documentPreloadSelectors:this.importsPreloadSelectors},loaded:function(a,c,d,g,h){if(f.load&&console.log("loaded",a,c),c.__resource=d,c.__error=g,b(c)){var i=this.documents[a];void 0===i&&(i=g?null:e(d,h||a),i&&(i.__importLink=c,this.bootDocument(i)),this.documents[a]=i),c.__doc=i}l.parseNext()},bootDocument:function(a){this.loadSubtree(a),this.observer.observe(a),l.parseNext()},loadedAll:function(){l.parseNext()}},n=new j(m.loaded.bind(m),m.loadedAll.bind(m));if(m.observer=new k,!document.baseURI){var o={get:function(){var a=document.querySelector("base");return a?a.href:window.location.href},configurable:!0};Object.defineProperty(document,"baseURI",o),Object.defineProperty(i,"baseURI",o)}a.importer=m,a.importLoader=n}),window.HTMLImports.addModule(function(a){var b=a.parser,c=a.importer,d={added:function(a){for(var d,e,f,g,h=0,i=a.length;i>h&&(g=a[h]);h++)d||(d=g.ownerDocument,e=b.isParsed(d)),f=this.shouldLoadNode(g),f&&c.loadNode(g),this.shouldParseNode(g)&&e&&b.parseDynamic(g,f)},shouldLoadNode:function(a){return 1===a.nodeType&&e.call(a,c.loadSelectorsForNode(a))},shouldParseNode:function(a){return 1===a.nodeType&&e.call(a,b.parseSelectorsForNode(a))}};c.observer.addCallback=d.added.bind(d);var e=HTMLElement.prototype.matches||HTMLElement.prototype.matchesSelector||HTMLElement.prototype.webkitMatchesSelector||HTMLElement.prototype.mozMatchesSelector||HTMLElement.prototype.msMatchesSelector}),function(a){function b(){window.HTMLImports.importer.bootDocument(d)}var c=a.initializeModules;a.isIE;if(!a.useNative){c();var d=a.rootDocument;"complete"===document.readyState||"interactive"===document.readyState&&!window.attachEvent?b():document.addEventListener("DOMContentLoaded",b)}}(window.HTMLImports),window.CustomElements=window.CustomElements||{flags:{}},function(a){var b=a.flags,c=[],d=function(a){c.push(a)},e=function(){c.forEach(function(b){b(a)})};a.addModule=d,a.initializeModules=e,a.hasNative=Boolean(document.registerElement),a.isIE=/Trident/.test(navigator.userAgent),a.useNative=!b.register&&a.hasNative&&!window.ShadowDOMPolyfill&&(!window.HTMLImports||window.HTMLImports.useNative)}(window.CustomElements),window.CustomElements.addModule(function(a){function b(a,b){c(a,function(a){return b(a)?!0:void d(a,b)}),d(a,b)}function c(a,b,d){var e=a.firstElementChild;if(!e)for(e=a.firstChild;e&&e.nodeType!==Node.ELEMENT_NODE;)e=e.nextSibling;for(;e;)b(e,d)!==!0&&c(e,b,d),e=e.nextElementSibling;return null}function d(a,c){for(var d=a.shadowRoot;d;)b(d,c),d=d.olderShadowRoot}function e(a,b){f(a,b,[])}function f(a,b,c){if(a=window.wrap(a),!(c.indexOf(a)>=0)){c.push(a);for(var d,e=a.querySelectorAll("link[rel="+g+"]"),h=0,i=e.length;i>h&&(d=e[h]);h++)d["import"]&&f(d["import"],b,c);b(a)}}var g=window.HTMLImports?window.HTMLImports.IMPORT_LINK_TYPE:"none";a.forDocumentTree=e,a.forSubtree=b}),window.CustomElements.addModule(function(a){function b(a,b){return c(a,b)||d(a,b)}function c(b,c){return a.upgrade(b,c)?!0:void(c&&g(b))}function d(a,b){t(a,function(a){return c(a,b)?!0:void 0})}function e(a){x.push(a),w||(w=!0,setTimeout(f))}function f(){w=!1;for(var a,b=x,c=0,d=b.length;d>c&&(a=b[c]);c++)a();x=[]}function g(a){v?e(function(){h(a)}):h(a)}function h(a){a.__upgraded__&&!a.__attached&&(a.__attached=!0,a.attachedCallback&&a.attachedCallback())}function i(a){j(a),t(a,function(a){j(a)})}function j(a){v?e(function(){k(a)}):k(a)}function k(a){a.__upgraded__&&a.__attached&&(a.__attached=!1,a.detachedCallback&&a.detachedCallback())}function l(a){for(var b=a,c=window.wrap(document);b;){if(b==c)return!0;b=b.parentNode||b.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&b.host}}function m(a){if(a.shadowRoot&&!a.shadowRoot.__watched){s.dom&&console.log("watching shadow-root for: ",a.localName);for(var b=a.shadowRoot;b;)p(b),b=b.olderShadowRoot}}function n(a,c){if(s.dom){var d=c[0];if(d&&"childList"===d.type&&d.addedNodes&&d.addedNodes){for(var e=d.addedNodes[0];e&&e!==document&&!e.host;)e=e.parentNode;var f=e&&(e.URL||e._URL||e.host&&e.host.localName)||"";f=f.split("/?").shift().split("/").pop()}console.group("mutations (%d) [%s]",c.length,f||"")}var g=l(a);c.forEach(function(a){"childList"===a.type&&(y(a.addedNodes,function(a){a.localName&&b(a,g)}),y(a.removedNodes,function(a){a.localName&&i(a)}))}),s.dom&&console.groupEnd()}function o(a){for(a=window.wrap(a),a||(a=window.wrap(document));a.parentNode;)a=a.parentNode;var b=a.__observer;b&&(n(a,b.takeRecords()),f())}function p(a){if(!a.__observer){var b=new MutationObserver(n.bind(this,a));b.observe(a,{childList:!0,subtree:!0}),a.__observer=b}}function q(a){a=window.wrap(a),s.dom&&console.group("upgradeDocument: ",a.baseURI.split("/").pop()); +var c=a===window.wrap(document);b(a,c),p(a),s.dom&&console.groupEnd()}function r(a){u(a,q)}var s=a.flags,t=a.forSubtree,u=a.forDocumentTree,v=window.MutationObserver._isPolyfilled&&s["throttle-attached"];a.hasPolyfillMutations=v,a.hasThrottledAttached=v;var w=!1,x=[],y=Array.prototype.forEach.call.bind(Array.prototype.forEach),z=Element.prototype.createShadowRoot;z&&(Element.prototype.createShadowRoot=function(){var a=z.call(this);return window.CustomElements.watchShadow(this),a}),a.watchShadow=m,a.upgradeDocumentTree=r,a.upgradeDocument=q,a.upgradeSubtree=d,a.upgradeAll=b,a.attached=g,a.takeRecords=o}),window.CustomElements.addModule(function(a){function b(b,d){if("template"===b.localName&&window.HTMLTemplateElement&&HTMLTemplateElement.decorate&&HTMLTemplateElement.decorate(b),!b.__upgraded__&&b.nodeType===Node.ELEMENT_NODE){var e=b.getAttribute("is"),f=a.getRegisteredDefinition(b.localName)||a.getRegisteredDefinition(e);if(f&&(e&&f.tag==b.localName||!e&&!f["extends"]))return c(b,f,d)}}function c(b,c,e){return g.upgrade&&console.group("upgrade:",b.localName),c.is&&b.setAttribute("is",c.is),d(b,c),b.__upgraded__=!0,f(b),e&&a.attached(b),a.upgradeSubtree(b,e),g.upgrade&&console.groupEnd(),b}function d(a,b){Object.__proto__?a.__proto__=b.prototype:(e(a,b.prototype,b["native"]),a.__proto__=b.prototype)}function e(a,b,c){for(var d={},e=b;e!==c&&e!==HTMLElement.prototype;){for(var f,g=Object.getOwnPropertyNames(e),h=0;f=g[h];h++)d[f]||(Object.defineProperty(a,f,Object.getOwnPropertyDescriptor(e,f)),d[f]=1);e=Object.getPrototypeOf(e)}}function f(a){a.createdCallback&&a.createdCallback()}var g=a.flags;a.upgrade=b,a.upgradeWithDefinition=c,a.implementPrototype=d}),window.CustomElements.addModule(function(a){function b(b,d){var i=d||{};if(!b)throw new Error("document.registerElement: first argument `name` must not be empty");if(b.indexOf("-")<0)throw new Error("document.registerElement: first argument ('name') must contain a dash ('-'). Argument provided was '"+String(b)+"'.");if(e(b))throw new Error("Failed to execute 'registerElement' on 'Document': Registration failed for type '"+String(b)+"'. The type name is invalid.");if(j(b))throw new Error("DuplicateDefinitionError: a type with name '"+String(b)+"' is already registered");return i.prototype||(i.prototype=Object.create(HTMLElement.prototype)),i.__name=b.toLowerCase(),i.lifecycle=i.lifecycle||{},i.ancestry=f(i["extends"]),g(i),h(i),c(i.prototype),k(i.__name,i),i.ctor=l(i),i.ctor.prototype=i.prototype,i.prototype.constructor=i.ctor,a.ready&&r(document),i.ctor}function c(a){if(!a.setAttribute._polyfilled){var b=a.setAttribute;a.setAttribute=function(a,c){d.call(this,a,c,b)};var c=a.removeAttribute;a.removeAttribute=function(a){d.call(this,a,null,c)},a.setAttribute._polyfilled=!0}}function d(a,b,c){a=a.toLowerCase();var d=this.getAttribute(a);c.apply(this,arguments);var e=this.getAttribute(a);this.attributeChangedCallback&&e!==d&&this.attributeChangedCallback(a,d,e)}function e(a){for(var b=0;b=0&&u(d,HTMLElement),d)}function o(a,b){var c=a[b];a[b]=function(){var a=c.apply(this,arguments);return s(a),a}}var p,q=a.isIE,r=a.upgradeDocumentTree,s=a.upgradeAll,t=a.upgradeWithDefinition,u=a.implementPrototype,v=a.useNative,w=["annotation-xml","color-profile","font-face","font-face-src","font-face-uri","font-face-format","font-face-name","missing-glyph"],x={},y="http://www.w3.org/1999/xhtml",z=document.createElement.bind(document),A=document.createElementNS.bind(document);p=Object.__proto__||v?function(a,b){return a instanceof b}:function(a,b){if(a instanceof b)return!0;for(var c=a;c;){if(c===b.prototype)return!0;c=c.__proto__}return!1},o(Node.prototype,"cloneNode"),o(document,"importNode"),q&&!function(){var a=document.importNode;document.importNode=function(){var b=a.apply(document,arguments);if(b.nodeType==b.DOCUMENT_FRAGMENT_NODE){var c=document.createDocumentFragment();return c.appendChild(b),c}return b}}(),document.registerElement=b,document.createElement=n,document.createElementNS=m,a.registry=x,a["instanceof"]=p,a.reservedTagList=w,a.getRegisteredDefinition=j,document.register=document.registerElement}),function(a){function b(){f(window.wrap(document)),window.CustomElements.ready=!0;var a=window.requestAnimationFrame||function(a){setTimeout(a,16)};a(function(){setTimeout(function(){window.CustomElements.readyTime=Date.now(),window.HTMLImports&&(window.CustomElements.elapsed=window.CustomElements.readyTime-window.HTMLImports.readyTime),document.dispatchEvent(new CustomEvent("WebComponentsReady",{bubbles:!0}))})})}var c=a.useNative,d=a.initializeModules;a.isIE;if(c){var e=function(){};a.watchShadow=e,a.upgrade=e,a.upgradeAll=e,a.upgradeDocumentTree=e,a.upgradeSubtree=e,a.takeRecords=e,a["instanceof"]=function(a,b){return a instanceof b}}else d();var f=a.upgradeDocumentTree,g=a.upgradeDocument;if(window.wrap||(window.ShadowDOMPolyfill?(window.wrap=window.ShadowDOMPolyfill.wrapIfNeeded,window.unwrap=window.ShadowDOMPolyfill.unwrapIfNeeded):window.wrap=window.unwrap=function(a){return a}),window.HTMLImports&&(window.HTMLImports.__importsParsingHook=function(a){a["import"]&&g(wrap(a["import"]))}),"complete"===document.readyState||a.flags.eager)b();else if("interactive"!==document.readyState||window.attachEvent||window.HTMLImports&&!window.HTMLImports.ready){var h=window.HTMLImports&&!window.HTMLImports.ready?"HTMLImportsLoaded":"DOMContentLoaded";window.addEventListener(h,b)}else b()}(window.CustomElements),function(a){Function.prototype.bind||(Function.prototype.bind=function(a){var b=this,c=Array.prototype.slice.call(arguments,1);return function(){var d=c.slice();return d.push.apply(d,arguments),b.apply(a,d)}})}(window.WebComponents),function(a){var b=document.createElement("style");b.textContent="body {transition: opacity ease-in 0.2s; } \nbody[unresolved] {opacity: 0; display: block; overflow: hidden; position: relative; } \n";var c=document.querySelector("head");c.insertBefore(b,c.firstChild)}(window.WebComponents),function(a){window.Platform=a}(window.WebComponents),angular.module("ngAudio",[]).directive("ngAudio",["$compile","$q","ngAudio",function(a,b,c){return{restrict:"AEC",scope:{volume:"=",start:"=",currentTime:"=",loop:"=",clickPlay:"=",disablePreload:"="},controller:["$scope","$attrs","$element","$timeout",function(a,b,d,e){function f(){g=c.load(b.ngAudio,a),a.$audio=g,g.unbind()}var g;a.disablePreload||f(),d.on("click",function(){a.clickPlay!==!1&&(a.disablePreload&&f(),g.audio.play(),g.volume=a.volume||g.volume,g.loop=a.loop,g.currentTime=a.start||0,e(function(){g.play()},5))}),d.on("$destroy",function(){g.destroy()})}]}}]).directive("ngAudioHover",["$compile","$q","ngAudio",function(a,b,c){return{restrict:"AEC",controller:["$scope","$attrs","$element","$timeout",function(a,b,d,e){var f=c.load(b.ngAudioHover,a);d.on("mouseover rollover hover",function(){f.audio.play(),f.volume=b.volumeHover||f.volume,f.loop=b.loop,f.currentTime=b.startHover||0}),d.on("$destroy",function(){f.destroy()})}]}}]).service("localAudioFindingService",["$q",function(a){this.find=function(b){var c=a.defer(),d=document.getElementById(b);return d?c.resolve(d):c.reject(b),c.promise}}]).service("remoteAudioFindingService",["$q",function(a){this.find=function(b){var c=a.defer(),d=new Audio;return d.addEventListener("error",function(){c.reject()}),d.addEventListener("loadstart",function(){c.resolve(d)}),setTimeout(function(){d.src=b},1),c.promise}}]).service("cleverAudioFindingService",["$q","localAudioFindingService","remoteAudioFindingService",function(a,b,c){this.find=function(d){var e=a.defer();return d=d.replace("|","/"),b.find(d).then(e.resolve,function(){return c.find(d)}).then(e.resolve,e.reject),e.promise}}]).value("ngAudioGlobals",{muting:!1,songmuting:!1,performance:25,unlock:!0}).factory("NgAudioObject",["cleverAudioFindingService","$rootScope","$interval","$timeout","ngAudioGlobals",function(a,b,c,d,e){return function(d,f){function g(){o.play(),o.pause(),window.removeEventListener("click",g)}function h(){w||(A&&c.cancel(A),l&&l(),k&&k(),w=!0)}function i(){w||(k=x.$watch(function(){return{volume:y.volume,currentTime:y.currentTime,progress:y.progress,muting:y.muting,loop:y.loop,playbackRate:y.playbackRate}},function(a,b){a.currentTime!==b.currentTime&&y.setCurrentTime(a.currentTime),a.progress!==b.progress&&y.setProgress(a.progress),a.volume!==b.volume&&y.setVolume(a.volume),a.playbackRate!==b.playbackRate&&y.setPlaybackRate(a.playbackRate),n=a.loop,a.muting!==b.muting&&y.setMuting(a.muting)},!0))}function j(){k&&k(),o&&(u||e.isMuting?o.volume=0:o.volume=void 0!==y.volume?y.volume:1,p&&(o.play(),p=!1),r&&(o.pause(),o.currentTime=0,r=!1),q&&(o.pause(),q=!1),s&&(o.playbackRate=t,s=!1),m&&(o.volume=m,m=void 0),v&&(y.currentTime=o.currentTime,y.duration=o.duration,y.remaining=o.duration-o.currentTime,y.progress=o.currentTime/o.duration,y.paused=o.paused,y.src=o.src,y.currentTime>=y.duration&&z.forEach(function(a){a(y)}),n&&y.currentTime>=y.duration&&(n!==!0&&(n--,y.loop--),y.setCurrentTime(0),y.play())),u||e.isMuting||(y.volume=o.volume),y.audio=o),i()}var k,l,m,n,o,p=!1,q=!1,r=!1,s=!1,t=!1,u=!1,v=!0,w=!1,x=f||b,y=this;this.id=d,this.safeId=d.replace("/","|"),this.loop=0,this.unbind=function(){v=!1},this.play=function(){return p=!0,this};var z=[];this.complete=function(a){z.push(a)},this.pause=function(){q=!0},this.restart=function(){r=!0},this.stop=function(){this.restart()},this.setVolume=function(a){m=a},this.setPlaybackRate=function(a){t=a,s=!0},this.setMuting=function(a){u=a},this.setProgress=function(a){o&&o.duration&&isFinite(a)&&(o.currentTime=o.duration*a)},this.setCurrentTime=function(a){o&&o.duration&&(o.currentTime=a)},this.destroy=h,x.$on("$destroy",function(){h()}),a.find(d).then(function(a){o=a,e.unlock&&(window.addEventListener("click",g),o.addEventListener("playing",function(){window.removeEventListener("click",g)})),o.addEventListener("canplay",function(){y.canPlay=!0})},function(a){y.error=!0,console.warn(a)});var A=c(j,e.performance);l=x.$watch(function(){return e.performance},function(){c.cancel(A),A=c(j,e.performance)})}}]).service("ngAudio",["NgAudioObject","ngAudioGlobals",function(a,b){this.play=function(b,c){var d=new a(b,c);return d.play(),d},this.load=function(b,c){return new a(b,c)},this.mute=function(){b.muting=!0},this.unmute=function(){b.muting=!1},this.toggleMute=function(){b.muting=!b.muting},this.setUnlock=function(a){b.unlock=a}}]).filter("trackTime",function(){return function(a){var b=Math.floor(0|a),c="",d=0,e=0,f=0;return b>3599?(d=Math.floor(b/3600),e=Math.floor((b-3600*d)/60),f=b-(60*e+3600*d),1==d.toString().length&&(d="0"+Math.floor(b/3600).toString()),1==e.toString().length&&(e="0"+Math.floor((b-3600*d)/60).toString()),1==f.toString().length&&(f="0"+(b-(60*e+3600*d)).toString()),c=d+":"+e+":"+f):b>59?(e=Math.floor(b/60),f=b-60*e,1==e.toString().length&&(e="0"+Math.floor(b/60).toString()),1==f.toString().length&&(f="0"+(b-60*e).toString()),c=e+":"+f):(f=b,1==f.toString().length&&(f="0"+b.toString()),c=b+"s"),"function"==typeof Number.isNaN&&Number.isNaN(c),c}}),function(){"use strict";angular.module("ngEmoticons",["ngSanitize"]).filter("emoticons",["$sce",function(a){var b=[{text:":)","class":"smiley",code:"e60a"},{text:":D","class":"happy",code:"e608"},{text:":d","class":"happy",code:"e608"},{text:":(","class":"sad",code:"e60e"},{text:":/","class":"wondering",code:"e620"},{text:":P","class":"tongue",code:"e60c"},{text:":p","class":"tongue",code:"e60c"},{text:"3:)","class":"evil",code:"e618"},{text:"(^)","class":"thumbsup2",code:"e607"},{text:";)","class":"wink",code:"e610"},{text:":o","class":"shocked",code:"e61a"},{text:"-_-","class":"neutral",code:"e61e"},{text:"(y)","class":"thumbs-up",code:"e606"},{text:":*","class":"heart",code:"e604"},{text:"<3","class":"heart",code:"e604"},{text:"<3","class":"heart",code:"e604"},{text:"</3","class":"heart-broken",code:"e605"},{text:"&#x'+a.code+"")}),c.join(" ")}function h(a){var b=/((href|src)=["']|)(\b(https?|ftp|file):\/\/[-A-Z0-9+()&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/gi,c=a.replace(b,function(a){return''+a+""});return c}function i(a){var b=new RegExp(":("+c.join("|")+"):","g");return a.replace(b,function(a,b){return""})}var j={link:!0,linkTarget:"_self"};return f(j,e),void 0!==d&&null!==d?"object"==typeof d?d:(d=g(d),d=i(d),j.link&&(d=h(d)),a.trustAsHtml(d)):void 0}}]).directive("ngEmoticons",["$filter","$sce","$http","$timeout","$templateCache",function(a,b,c,d,e){var f="",g='
        {{video.description}}
        {{video.views}} {{video.likes}}
        ';return e.put(f,g),{restrict:"AE",scope:!0,templateUrl:function(a,b){return b.emoticonsTemplateUrl||f},link:function(e,f,g){function h(a){return angular.forEach(arguments,function(b){b!==a&&angular.forEach(b,function(b,c){a[c]&&a[c].constructor&&a[c].constructor===Object?h(a[c],b):a[c]=b})}),a}var i=e.$eval(g.emoticonsData),j=e.$eval(g.emoticonsOptions);e.video={},e.image={},e.pdf={},e.audio={};var k={link:!0,linkTarget:"_self",pdf:{embed:!0},image:{embed:!1},audio:{embed:!0},code:{highlight:!0,lineNumbers:!1},basicVideo:!1,video:{embed:!1,width:null,height:null,ytTheme:"dark",details:!1,thumbnailQuality:"medium",ytAuthKey:null}};h(k,j),String.prototype.trunc=function(a,b){var c=this.length>a,d=c?this.substr(0,a-1):this;return d=b&&c?d.substr(0,d.lastIndexOf(" ")):d,c?d+"...":d};var l={calcDimensions:function(a){var b={width:null,height:null};return b.width=a.video.width,b.height=a.video.height,a.video.height&&a.video.width?b:a.video.height?(b.width=a.video.height/390*640,b):a.video.width?(b.height=b.width/640*390,b):(b.width=640,b.height=390,b)},embed:function(a,d){var f=/https?:\/\/(?:[0-9A-Z-]+\.)?(?:youtu\.be\/|youtube\.com(?:\/embed\/|\/v\/|\/watch\?v=|\/ytscreeningroom\?v=|\/feeds\/api\/videos\/|\/user\S*[^\w\-\s]|\S*[^\w\-\s]))([\w\-]{11})[?=&+%\w-]*/gi;if(a.match(f)){var g=this.calcDimensions(d);return e.video.id=RegExp.$1,d.video.details?c.get("https://www.googleapis.com/youtube/v3/videos?id="+RegExp.$1+"&key="+d.video.ytAuthKey+"&part=snippet,statistics").success(function(a){var c=a.items[0];e.video.host="youtube",e.video.title=c.snippet.title,e.video.thumbnail=c.snippet.thumbnails.medium.url,e.video.description=c.snippet.description.trunc(250,!0).replace(/\n/g," ").replace(/ /g," "),e.video.rawDescription=c.snippet.description,e.video.views=c.statistics.viewCount,e.video.likes=c.statistics.likeCount,e.video.uploader=c.snippet.channelTitle,e.video.uploaderPage="https://www.youtube.com/channel/"+c.snippet.channelId,e.video.uploadDate=c.snippet.publishedAt,e.video.url=b.trustAsResourceUrl("https://www.youtube.com/watch?v="+c.id),e.video.embedSrc=b.trustAsResourceUrl("https://www.youtube.com/embed/"+e.video.id+"?autoplay=1"),e.video.width=g.width,e.video.height=g.height}):(e.video.width=g.width,e.video.height=g.height,e.video.host="youtube",e.video.embedSrc=b.trustAsResourceUrl("https://www.youtube.com/embed/"+RegExp.$1+"?autoplay=0")),a}var h=/https?:\/\/(?:www\.)?vimeo.com\/(?:channels\/(?:\w+\/)?|groups\/([^\/]*)\/videos\/|album\/(\d+)\/video\/|)(\d+)(?:$|\/|\?)*/gi;if(a.match(h)){var i=this.calcDimensions(d);e.video.id=RegExp.$3,d.video.details?c.get("https://vimeo.com/api/v2/video/"+RegExp.$3+".json").success(function(a){e.video.host="vimeo",e.video.title=a[0].title,e.video.rawDescription=a[0].description.replace(/\n/g,"
        ").replace(/ /g,"
        "),e.video.description=a[0].description.replace(/((<|<)br\s*\/*(>|>)\r\n)/g," ").trunc(250,!0),e.video.thumbnail=a[0].thumbnail_medium,e.video.views=a[0].stats_number_of_plays,e.video.likes=a[0].stats_number_of_likes,e.video.uploader=a[0].user_name,e.video.uploaderPage=a[0].user_url,e.video.uploadDate=a[0].uploadDate,e.video.url=a[0].url,e.video.embedSrc=b.trustAsResourceUrl("//player.vimeo.com/video/"+a[0].id+"?title=0&byline=0&portrait=0&autoplay=1"),e.video.width=i.width,e.video.height=i.height}):(e.video.width=i.width,e.video.height=i.height,e.video.host="vimeo",e.video.embedSrc=b.trustAsResourceUrl("//player.vimeo.com/video/"+RegExp.$3+"?title=0&byline=0&portrait=0&autoplay=0"))}return a},embedBasic:function(a){var c=/((?:https?):\/\/\S*\.(?:ogv|webm|mp4))/gi;return a.match(c)&&(e.video.basic=b.trustAsResourceUrl(RegExp.$1)),a}},m={embed:function(a){var c=/((?:https?):\/\/\S*\.(?:wav|mp3|ogg))/gi;return a.match(c)&&(e.audio.url=b.trustAsResourceUrl(RegExp.$1)),a}},n={embed:function(a){var b=/((?:https?):\/\/\S*\.(?:gif|jpg|jpeg|tiff|png|svg|webp))/gi;return a.match(b)&&(e.image.url=RegExp.$1),a}},o={encodeCode:function(a){return a=a.replace(/\&/gm,"&"),a=a.replace(//gm,">")},getCode:function(a){var b=this;return a=a.replace(/(`+)(\s|[a-z]+)\s*([\s\S]*?[^`])\s*\1(?!`)/gm,function(a,c,d,e){var f=e;return f=f.replace(/^([ \t]*)/g,""),f=f.replace(/[ \t]*$/g,""),f=b.encodeCode(f),f=f.replace(/:\/\//g,"~P"),'
        '+f+"
        "})}},p={embed:function(a){var c=/((?:https?):\/\/\S*\.(?:pdf|PDF))/gi;return a.match(c)&&(e.pdf.url=b.trustAsResourceUrl(RegExp.$1)),a}};if(k.code.highlight){if(!window.hljs)throw"hlsj (Highlight JS is not defined.";i=o.getCode(i),d(function(){hljs.initHighlighting(),k.code.lineNumbers&&angular.element(".ne-code").each(function(){var a=1,b=$(this).text().split("\n").length,c=$("
          ").addClass("pre-numbering");for(angular.element(this).addClass("has-numbering").parent().append(c),a;b>=a;a++)c.append(angular.element("
        • ").text(a))})},0)}var q=a("emoticons")(i,k).$$unwrapTrustedValue();if(k.video.embed){if(!k.video.ytAuthKey)throw"Youtube authentication key is required to get data from youtube."; +q=l.embed(q,k)}k.basicVideo&&(q=l.embedBasic(q)),k.audio.embed&&(q=m.embed(q)),k.image.embed&&(q=n.embed(q)),k.pdf.embed&&(q=p.embed(q)),e.neText=b.trustAsHtml(q)}}}]).directive("neHljs",["$timeout",function(a){return{restrict:"AE",link:function(b,c){a(function(){c.find(".ne-code").each(function(){hljs.highlightBlock(this)})},0)}}}])}(),function(a){"undefined"!=typeof exports?a(exports):(window.hljs=a({}),"function"==typeof define&&define.amd&&define("hljs",[],function(){return window.hljs}))}(function(a){function b(a){return a.replace(/&/gm,"&").replace(//gm,">")}function c(a){return a.nodeName.toLowerCase()}function d(a,b){var c=a&&a.exec(b);return c&&0==c.index}function e(a){return/^(no-?highlight|plain|text)$/i.test(a)}function f(a){var b,c,d,f=a.className+" ";if(f+=a.parentNode?a.parentNode.className:"",c=/\blang(?:uage)?-([\w-]+)\b/i.exec(f))return u(c[1])?c[1]:"no-highlight";for(f=f.split(/\s+/),b=0,d=f.length;d>b;b++)if(u(f[b])||e(f[b]))return f[b]}function g(a,b){var c,d={};for(c in a)d[c]=a[c];if(b)for(c in b)d[c]=b[c];return d}function h(a){var b=[];return function d(a,e){for(var f=a.firstChild;f;f=f.nextSibling)3==f.nodeType?e+=f.nodeValue.length:1==f.nodeType&&(b.push({event:"start",offset:e,node:f}),e=d(f,e),c(f).match(/br|hr|img|input/)||b.push({event:"stop",offset:e,node:f}));return e}(a,0),b}function i(a,d,e){function f(){return a.length&&d.length?a[0].offset!=d[0].offset?a[0].offset"}function h(a){k+=""}function i(a){("start"==a.event?g:h)(a.node)}for(var j=0,k="",l=[];a.length||d.length;){var m=f();if(k+=b(e.substr(j,m[0].offset-j)),j=m[0].offset,m==a){l.reverse().forEach(h);do i(m.splice(0,1)[0]),m=f();while(m==a&&m.length&&m[0].offset==j);l.reverse().forEach(g)}else"start"==m[0].event?l.push(m[0].node):l.pop(),i(m.splice(0,1)[0])}return k+b(e.substr(j))}function j(a){function b(a){return a&&a.source||a}function c(c,d){return new RegExp(b(c),"m"+(a.case_insensitive?"i":"")+(d?"g":""))}function d(e,f){if(!e.compiled){if(e.compiled=!0,e.keywords=e.keywords||e.beginKeywords,e.keywords){var h={},i=function(b,c){a.case_insensitive&&(c=c.toLowerCase()),c.split(" ").forEach(function(a){var c=a.split("|");h[c[0]]=[b,c[1]?Number(c[1]):1]})};"string"==typeof e.keywords?i("keyword",e.keywords):Object.keys(e.keywords).forEach(function(a){i(a,e.keywords[a])}),e.keywords=h}e.lexemesRe=c(e.lexemes||/\b\w+\b/,!0),f&&(e.beginKeywords&&(e.begin="\\b("+e.beginKeywords.split(" ").join("|")+")\\b"),e.begin||(e.begin=/\B|\b/),e.beginRe=c(e.begin),e.end||e.endsWithParent||(e.end=/\B|\b/),e.end&&(e.endRe=c(e.end)),e.terminator_end=b(e.end)||"",e.endsWithParent&&f.terminator_end&&(e.terminator_end+=(e.end?"|":"")+f.terminator_end)),e.illegal&&(e.illegalRe=c(e.illegal)),void 0===e.relevance&&(e.relevance=1),e.contains||(e.contains=[]);var j=[];e.contains.forEach(function(a){a.variants?a.variants.forEach(function(b){j.push(g(a,b))}):j.push("self"==a?e:a)}),e.contains=j,e.contains.forEach(function(a){d(a,e)}),e.starts&&d(e.starts,f);var k=e.contains.map(function(a){return a.beginKeywords?"\\.?("+a.begin+")\\.?":a.begin}).concat([e.terminator_end,e.illegal]).map(b).filter(Boolean);e.terminators=k.length?c(k.join("|"),!0):{exec:function(){return null}}}}d(a)}function k(a,c,e,f){function g(a,b){for(var c=0;c";return f+=a+'">',f+b+g}function o(){if(!y.keywords)return b(B);var a="",c=0;y.lexemesRe.lastIndex=0;for(var d=y.lexemesRe.exec(B);d;){a+=b(B.substr(c,d.index-c));var e=m(y,d);e?(C+=e[1],a+=n(e[0],b(d[0]))):a+=b(d[0]),c=y.lexemesRe.lastIndex,d=y.lexemesRe.exec(B)}return a+b(B.substr(c))}function p(){var a="string"==typeof y.subLanguage;if(a&&!w[y.subLanguage])return b(B);var c=a?k(y.subLanguage,B,!0,z[y.subLanguage]):l(B,y.subLanguage.length?y.subLanguage:void 0);return y.relevance>0&&(C+=c.relevance),a&&(z[y.subLanguage]=c.top),n(c.language,c.value,!1,!0)}function q(){return void 0!==y.subLanguage?p():o()}function r(a,c){var d=a.className?n(a.className,"",!0):"";a.returnBegin?(A+=d,B=""):a.excludeBegin?(A+=b(c)+d,B=""):(A+=d,B=c),y=Object.create(a,{parent:{value:y}})}function s(a,c){if(B+=a,void 0===c)return A+=q(),0;var d=g(c,y);if(d)return A+=q(),r(d,c),d.returnBegin?0:c.length;var e=h(y,c);if(e){var f=y;f.returnEnd||f.excludeEnd||(B+=c),A+=q();do y.className&&(A+=""),C+=y.relevance,y=y.parent;while(y!=e.parent);return f.excludeEnd&&(A+=b(c)),B="",e.starts&&r(e.starts,""),f.returnEnd?0:c.length}if(i(c,y))throw new Error('Illegal lexeme "'+c+'" for mode "'+(y.className||"")+'"');return B+=c,c.length||1}var t=u(a);if(!t)throw new Error('Unknown language: "'+a+'"');j(t);var x,y=f||t,z={},A="";for(x=y;x!=t;x=x.parent)x.className&&(A=n(x.className,"",!0)+A);var B="",C=0;try{for(var D,E,F=0;;){if(y.terminators.lastIndex=F,D=y.terminators.exec(c),!D)break;E=s(c.substr(F,D.index-F),D[0]),F=D.index+E}for(s(c.substr(F)),x=y;x.parent;x=x.parent)x.className&&(A+="");return{relevance:C,value:A,language:a,top:y}}catch(G){if(-1!=G.message.indexOf("Illegal"))return{relevance:0,value:b(c)};throw G}}function l(a,c){c=c||v.languages||Object.keys(w);var d={relevance:0,value:b(a)},e=d;return c.forEach(function(b){if(u(b)){var c=k(b,a,!1);c.language=b,c.relevance>e.relevance&&(e=c),c.relevance>d.relevance&&(e=d,d=c)}}),e.language&&(d.second_best=e),d}function m(a){return v.tabReplace&&(a=a.replace(/^((<[^>]+>|\t)+)/gm,function(a,b){return b.replace(/\t/g,v.tabReplace)})),v.useBR&&(a=a.replace(/\n/g,"
          ")),a}function n(a,b,c){var d=b?x[b]:c,e=[a.trim()];return a.match(/\bhljs\b/)||e.push("hljs"),-1===a.indexOf(d)&&e.push(d),e.join(" ").trim()}function o(a){var b=f(a);if(!e(b)){var c;v.useBR?(c=document.createElementNS("http://www.w3.org/1999/xhtml","div"),c.innerHTML=a.innerHTML.replace(/\n/g,"").replace(//g,"\n")):c=a;var d=c.textContent,g=b?k(b,d,!0):l(d),j=h(c);if(j.length){var o=document.createElementNS("http://www.w3.org/1999/xhtml","div");o.innerHTML=g.value,g.value=i(j,h(o),d)}g.value=m(g.value),a.innerHTML=g.value,a.className=n(a.className,b,g.language),a.result={language:g.language,re:g.relevance},g.second_best&&(a.second_best={language:g.second_best.language,re:g.second_best.relevance})}}function p(a){v=g(v,a)}function q(){if(!q.called){q.called=!0;var a=document.querySelectorAll("pre code");Array.prototype.forEach.call(a,o)}}function r(){addEventListener("DOMContentLoaded",q,!1),addEventListener("load",q,!1)}function s(b,c){var d=w[b]=c(a);d.aliases&&d.aliases.forEach(function(a){x[a]=b})}function t(){return Object.keys(w)}function u(a){return a=(a||"").toLowerCase(),w[a]||w[x[a]]}var v={classPrefix:"hljs-",tabReplace:null,useBR:!1,languages:void 0},w={},x={};return a.highlight=k,a.highlightAuto=l,a.fixMarkup=m,a.highlightBlock=o,a.configure=p,a.initHighlighting=q,a.initHighlightingOnLoad=r,a.registerLanguage=s,a.listLanguages=t,a.getLanguage=u,a.inherit=g,a.IDENT_RE="[a-zA-Z]\\w*",a.UNDERSCORE_IDENT_RE="[a-zA-Z_]\\w*",a.NUMBER_RE="\\b\\d+(\\.\\d+)?",a.C_NUMBER_RE="(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",a.BINARY_NUMBER_RE="\\b(0b[01]+)",a.RE_STARTERS_RE="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",a.BACKSLASH_ESCAPE={begin:"\\\\[\\s\\S]",relevance:0},a.APOS_STRING_MODE={className:"string",begin:"'",end:"'",illegal:"\\n",contains:[a.BACKSLASH_ESCAPE]},a.QUOTE_STRING_MODE={className:"string",begin:'"',end:'"',illegal:"\\n",contains:[a.BACKSLASH_ESCAPE]},a.PHRASAL_WORDS_MODE={begin:/\b(a|an|the|are|I|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|like)\b/},a.COMMENT=function(b,c,d){var e=a.inherit({className:"comment",begin:b,end:c,contains:[]},d||{});return e.contains.push(a.PHRASAL_WORDS_MODE),e.contains.push({className:"doctag",begin:"(?:TODO|FIXME|NOTE|BUG|XXX):",relevance:0}),e},a.C_LINE_COMMENT_MODE=a.COMMENT("//","$"),a.C_BLOCK_COMMENT_MODE=a.COMMENT("/\\*","\\*/"),a.HASH_COMMENT_MODE=a.COMMENT("#","$"),a.NUMBER_MODE={className:"number",begin:a.NUMBER_RE,relevance:0},a.C_NUMBER_MODE={className:"number",begin:a.C_NUMBER_RE,relevance:0},a.BINARY_NUMBER_MODE={className:"number",begin:a.BINARY_NUMBER_RE,relevance:0},a.CSS_NUMBER_MODE={className:"number",begin:a.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},a.REGEXP_MODE={className:"regexp",begin:/\//,end:/\/[gimuy]*/,illegal:/\n/,contains:[a.BACKSLASH_ESCAPE,{begin:/\[/,end:/\]/,relevance:0,contains:[a.BACKSLASH_ESCAPE]}]},a.TITLE_MODE={className:"title",begin:a.IDENT_RE,relevance:0},a.UNDERSCORE_TITLE_MODE={className:"title",begin:a.UNDERSCORE_IDENT_RE,relevance:0},a.registerLanguage("1c",function(a){var b="[a-zA-Zа-яА-Я][a-zA-Z0-9_а-яА-Я]*",c="возврат дата для если и или иначе иначеесли исключение конецесли конецпопытки конецпроцедуры конецфункции конеццикла константа не перейти перем перечисление по пока попытка прервать продолжить процедура строка тогда фс функция цикл число экспорт",d="ansitooem oemtoansi ввестивидсубконто ввестидату ввестизначение ввестиперечисление ввестипериод ввестиплансчетов ввестистроку ввестичисло вопрос восстановитьзначение врег выбранныйплансчетов вызватьисключение датагод датамесяц датачисло добавитьмесяц завершитьработусистемы заголовоксистемы записьжурналарегистрации запуститьприложение зафиксироватьтранзакцию значениевстроку значениевстрокувнутр значениевфайл значениеизстроки значениеизстрокивнутр значениеизфайла имякомпьютера имяпользователя каталогвременныхфайлов каталогиб каталогпользователя каталогпрограммы кодсимв командасистемы конгода конецпериодаби конецрассчитанногопериодаби конецстандартногоинтервала конквартала конмесяца коннедели лев лог лог10 макс максимальноеколичествосубконто мин монопольныйрежим названиеинтерфейса названиенабораправ назначитьвид назначитьсчет найти найтипомеченныенаудаление найтиссылки началопериодаби началостандартногоинтервала начатьтранзакцию начгода начквартала начмесяца начнедели номерднягода номерднянедели номернеделигода нрег обработкаожидания окр описаниеошибки основнойжурналрасчетов основнойплансчетов основнойязык открытьформу открытьформумодально отменитьтранзакцию очиститьокносообщений периодстр полноеимяпользователя получитьвремята получитьдатута получитьдокументта получитьзначенияотбора получитьпозициюта получитьпустоезначение получитьта прав праводоступа предупреждение префиксавтонумерации пустаястрока пустоезначение рабочаядаттьпустоезначение рабочаядата разделительстраниц разделительстрок разм разобратьпозициюдокумента рассчитатьрегистрына рассчитатьрегистрыпо сигнал симв символтабуляции создатьобъект сокрл сокрлп сокрп сообщить состояние сохранитьзначение сред статусвозврата стрдлина стрзаменить стрколичествострок стрполучитьстроку стрчисловхождений сформироватьпозициюдокумента счетпокоду текущаядата текущеевремя типзначения типзначениястр удалитьобъекты установитьтана установитьтапо фиксшаблон формат цел шаблон",e={className:"dquote",begin:'""'},f={className:"string",begin:'"',end:'"|$',contains:[e]},g={className:"string",begin:"\\|",end:'"|$',contains:[e]};return{case_insensitive:!0,lexemes:b,keywords:{keyword:c,built_in:d},contains:[a.C_LINE_COMMENT_MODE,a.NUMBER_MODE,f,g,{className:"function",begin:"(процедура|функция)",end:"$",lexemes:b,keywords:"процедура функция",contains:[a.inherit(a.TITLE_MODE,{begin:b}),{className:"tail",endsWithParent:!0,contains:[{className:"params",begin:"\\(",end:"\\)",lexemes:b,keywords:"знач",contains:[f,g]},{className:"export",begin:"экспорт",endsWithParent:!0,lexemes:b,keywords:"экспорт",contains:[a.C_LINE_COMMENT_MODE]}]},a.C_LINE_COMMENT_MODE]},{className:"preprocessor",begin:"#",end:"$"},{className:"date",begin:"'\\d{2}\\.\\d{2}\\.(\\d{2}|\\d{4})'"}]}}),a.registerLanguage("accesslog",function(a){return{contains:[{className:"number",begin:"\\b\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}(:\\d{1,5})?\\b"},{className:"number",begin:"\\b\\d+\\b",relevance:0},{className:"string",begin:'"(GET|POST|HEAD|PUT|DELETE|CONNECT|OPTIONS|PATCH|TRACE)',end:'"',keywords:"GET POST HEAD PUT DELETE CONNECT OPTIONS PATCH TRACE",illegal:"\\n",relevance:10},{className:"string",begin:/\[/,end:/\]/,illegal:"\\n"},{className:"string",begin:'"',end:'"',illegal:"\\n"}]}}),a.registerLanguage("actionscript",function(a){var b="[a-zA-Z_$][a-zA-Z0-9_$]*",c="([*]|[a-zA-Z_$][a-zA-Z0-9_$]*)",d={className:"rest_arg",begin:"[.]{3}",end:b,relevance:10};return{aliases:["as"],keywords:{keyword:"as break case catch class const continue default delete do dynamic each else extends final finally for function get if implements import in include instanceof interface internal is namespace native new override package private protected public return set static super switch this throw try typeof use var void while with",literal:"true false null undefined"},contains:[a.APOS_STRING_MODE,a.QUOTE_STRING_MODE,a.C_LINE_COMMENT_MODE,a.C_BLOCK_COMMENT_MODE,a.C_NUMBER_MODE,{className:"package",beginKeywords:"package",end:"{",contains:[a.TITLE_MODE]},{className:"class",beginKeywords:"class interface",end:"{",excludeEnd:!0,contains:[{beginKeywords:"extends implements"},a.TITLE_MODE]},{className:"preprocessor",beginKeywords:"import include",end:";"},{className:"function",beginKeywords:"function",end:"[{;]",excludeEnd:!0,illegal:"\\S",contains:[a.TITLE_MODE,{className:"params",begin:"\\(",end:"\\)",contains:[a.APOS_STRING_MODE,a.QUOTE_STRING_MODE,a.C_LINE_COMMENT_MODE,a.C_BLOCK_COMMENT_MODE,d]},{className:"type",begin:":",end:c,relevance:10}]}],illegal:/#/}}),a.registerLanguage("apache",function(a){var b={className:"number",begin:"[\\$%]\\d+"};return{aliases:["apacheconf"],case_insensitive:!0,contains:[a.HASH_COMMENT_MODE,{className:"tag",begin:""},{className:"keyword",begin:/\w+/,relevance:0,keywords:{common:"order deny allow setenv rewriterule rewriteengine rewritecond documentroot sethandler errordocument loadmodule options header listen serverroot servername"},starts:{end:/$/,relevance:0,keywords:{literal:"on off all"},contains:[{className:"sqbracket",begin:"\\s\\[",end:"\\]$"},{className:"cbracket",begin:"[\\$%]\\{",end:"\\}",contains:["self",b]},b,a.QUOTE_STRING_MODE]}}],illegal:/\S/}}),a.registerLanguage("applescript",function(a){var b=a.inherit(a.QUOTE_STRING_MODE,{illegal:""}),c={className:"params",begin:"\\(",end:"\\)",contains:["self",a.C_NUMBER_MODE,b]},d=a.COMMENT("--","$"),e=a.COMMENT("\\(\\*","\\*\\)",{contains:["self",d]}),f=[d,e,a.HASH_COMMENT_MODE];return{aliases:["osascript"],keywords:{keyword:"about above after against and around as at back before beginning behind below beneath beside between but by considering contain contains continue copy div does eighth else end equal equals error every exit fifth first for fourth from front get given global if ignoring in into is it its last local me middle mod my ninth not of on onto or over prop property put ref reference repeat returning script second set seventh since sixth some tell tenth that the|0 then third through thru timeout times to transaction try until where while whose with without",constant:"AppleScript false linefeed return pi quote result space tab true",type:"alias application boolean class constant date file integer list number real record string text",command:"activate beep count delay launch log offset read round run say summarize write",property:"character characters contents day frontmost id item length month name paragraph paragraphs rest reverse running time version weekday word words year"},contains:[b,a.C_NUMBER_MODE,{className:"type",begin:"\\bPOSIX file\\b"},{className:"command",begin:"\\b(clipboard info|the clipboard|info for|list (disks|folder)|mount volume|path to|(close|open for) access|(get|set) eof|current date|do shell script|get volume settings|random number|set volume|system attribute|system info|time to GMT|(load|run|store) script|scripting components|ASCII (character|number)|localized string|choose (application|color|file|file name|folder|from list|remote application|URL)|display (alert|dialog))\\b|^\\s*return\\b"},{className:"constant",begin:"\\b(text item delimiters|current application|missing value)\\b"},{className:"keyword",begin:"\\b(apart from|aside from|instead of|out of|greater than|isn't|(doesn't|does not) (equal|come before|come after|contain)|(greater|less) than( or equal)?|(starts?|ends|begins?) with|contained by|comes (before|after)|a (ref|reference))\\b"},{className:"property",begin:"\\b(POSIX path|(date|time) string|quoted form)\\b"},{className:"function_start",beginKeywords:"on",illegal:"[${=;\\n]",contains:[a.UNDERSCORE_TITLE_MODE,c]}].concat(f),illegal:"//|->|=>|\\[\\["}}),a.registerLanguage("armasm",function(a){return{case_insensitive:!0,aliases:["arm"],lexemes:"\\.?"+a.IDENT_RE,keywords:{literal:"r0 r1 r2 r3 r4 r5 r6 r7 r8 r9 r10 r11 r12 r13 r14 r15 pc lr sp ip sl sb fp a1 a2 a3 a4 v1 v2 v3 v4 v5 v6 v7 v8 f0 f1 f2 f3 f4 f5 f6 f7 p0 p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 p11 p12 p13 p14 p15 c0 c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 q0 q1 q2 q3 q4 q5 q6 q7 q8 q9 q10 q11 q12 q13 q14 q15 cpsr_c cpsr_x cpsr_s cpsr_f cpsr_cx cpsr_cxs cpsr_xs cpsr_xsf cpsr_sf cpsr_cxsf spsr_c spsr_x spsr_s spsr_f spsr_cx spsr_cxs spsr_xs spsr_xsf spsr_sf spsr_cxsf s0 s1 s2 s3 s4 s5 s6 s7 s8 s9 s10 s11 s12 s13 s14 s15 s16 s17 s18 s19 s20 s21 s22 s23 s24 s25 s26 s27 s28 s29 s30 s31 d0 d1 d2 d3 d4 d5 d6 d7 d8 d9 d10 d11 d12 d13 d14 d15 d16 d17 d18 d19 d20 d21 d22 d23 d24 d25 d26 d27 d28 d29 d30 d31 ",preprocessor:".2byte .4byte .align .ascii .asciz .balign .byte .code .data .else .end .endif .endm .endr .equ .err .exitm .extern .global .hword .if .ifdef .ifndef .include .irp .long .macro .rept .req .section .set .skip .space .text .word .arm .thumb .code16 .code32 .force_thumb .thumb_func .ltorg ALIAS ALIGN ARM AREA ASSERT ATTR CN CODE CODE16 CODE32 COMMON CP DATA DCB DCD DCDU DCDO DCFD DCFDU DCI DCQ DCQU DCW DCWU DN ELIF ELSE END ENDFUNC ENDIF ENDP ENTRY EQU EXPORT EXPORTAS EXTERN FIELD FILL FUNCTION GBLA GBLL GBLS GET GLOBAL IF IMPORT INCBIN INCLUDE INFO KEEP LCLA LCLL LCLS LTORG MACRO MAP MEND MEXIT NOFP OPT PRESERVE8 PROC QN READONLY RELOC REQUIRE REQUIRE8 RLIST FN ROUT SETA SETL SETS SN SPACE SUBT THUMB THUMBX TTL WHILE WEND ",built_in:"{PC} {VAR} {TRUE} {FALSE} {OPT} {CONFIG} {ENDIAN} {CODESIZE} {CPU} {FPU} {ARCHITECTURE} {PCSTOREOFFSET} {ARMASM_VERSION} {INTER} {ROPI} {RWPI} {SWST} {NOSWST} . @ "},contains:[{className:"keyword",begin:"\\b(adc|(qd?|sh?|u[qh]?)?add(8|16)?|usada?8|(q|sh?|u[qh]?)?(as|sa)x|and|adrl?|sbc|rs[bc]|asr|b[lx]?|blx|bxj|cbn?z|tb[bh]|bic|bfc|bfi|[su]bfx|bkpt|cdp2?|clz|clrex|cmp|cmn|cpsi[ed]|cps|setend|dbg|dmb|dsb|eor|isb|it[te]{0,3}|lsl|lsr|ror|rrx|ldm(([id][ab])|f[ds])?|ldr((s|ex)?[bhd])?|movt?|mvn|mra|mar|mul|[us]mull|smul[bwt][bt]|smu[as]d|smmul|smmla|mla|umlaal|smlal?([wbt][bt]|d)|mls|smlsl?[ds]|smc|svc|sev|mia([bt]{2}|ph)?|mrr?c2?|mcrr2?|mrs|msr|orr|orn|pkh(tb|bt)|rbit|rev(16|sh)?|sel|[su]sat(16)?|nop|pop|push|rfe([id][ab])?|stm([id][ab])?|str(ex)?[bhd]?|(qd?)?sub|(sh?|q|u[qh]?)?sub(8|16)|[su]xt(a?h|a?b(16)?)|srs([id][ab])?|swpb?|swi|smi|tst|teq|wfe|wfi|yield)(eq|ne|cs|cc|mi|pl|vs|vc|hi|ls|ge|lt|gt|le|al|hs|lo)?[sptrx]?",end:"\\s"},a.COMMENT("[;@]","$",{relevance:0}),a.C_BLOCK_COMMENT_MODE,a.QUOTE_STRING_MODE,{className:"string",begin:"'",end:"[^\\\\]'",relevance:0},{className:"title",begin:"\\|",end:"\\|",illegal:"\\n",relevance:0},{className:"number",variants:[{begin:"[#$=]?0x[0-9a-f]+"},{begin:"[#$=]?0b[01]+"},{begin:"[#$=]\\d+"},{begin:"\\b\\d+"}],relevance:0},{className:"label",variants:[{begin:"^[a-z_\\.\\$][a-z0-9_\\.\\$]+"},{begin:"^\\s*[a-z_\\.\\$][a-z0-9_\\.\\$]+:"},{begin:"[=#]\\w+"}],relevance:0}]}}),a.registerLanguage("xml",function(a){var b="[A-Za-z0-9\\._:-]+",c={begin:/<\?(php)?(?!\w)/,end:/\?>/,subLanguage:"php"},d={endsWithParent:!0,illegal:/]+/}]}]}]};return{aliases:["html","xhtml","rss","atom","xsl","plist"],case_insensitive:!0,contains:[{className:"doctype",begin:"",relevance:10,contains:[{begin:"\\[",end:"\\]"}]},a.COMMENT("",{relevance:10}),{className:"cdata",begin:"<\\!\\[CDATA\\[",end:"\\]\\]>",relevance:10},{className:"tag",begin:"|$)",end:">",keywords:{title:"style"},contains:[d],starts:{end:"",returnEnd:!0,subLanguage:"css"}},{className:"tag",begin:"|$)",end:">",keywords:{title:"script"},contains:[d],starts:{end:"",returnEnd:!0,subLanguage:["actionscript","javascript","handlebars"]}},c,{className:"pi",begin:/<\?\w+/,end:/\?>/,relevance:10},{className:"tag",begin:"",contains:[{className:"title",begin:/[^ \/><\n\t]+/,relevance:0},d]}]}}),a.registerLanguage("asciidoc",function(a){return{aliases:["adoc"],contains:[a.COMMENT("^/{4,}\\n","\\n/{4,}$",{relevance:10}),a.COMMENT("^//","$",{relevance:0}),{className:"title",begin:"^\\.\\w.*$"},{begin:"^[=\\*]{4,}\\n",end:"\\n^[=\\*]{4,}$",relevance:10},{className:"header",begin:"^(={1,5}) .+?( \\1)?$",relevance:10},{className:"header",begin:"^[^\\[\\]\\n]+?\\n[=\\-~\\^\\+]{2,}$",relevance:10},{className:"attribute",begin:"^:.+?:",end:"\\s",excludeEnd:!0,relevance:10},{className:"attribute",begin:"^\\[.+?\\]$",relevance:0},{className:"blockquote",begin:"^_{4,}\\n",end:"\\n_{4,}$",relevance:10},{className:"code",begin:"^[\\-\\.]{4,}\\n",end:"\\n[\\-\\.]{4,}$",relevance:10},{begin:"^\\+{4,}\\n",end:"\\n\\+{4,}$",contains:[{begin:"<",end:">",subLanguage:"xml",relevance:0}],relevance:10},{className:"bullet",begin:"^(\\*+|\\-+|\\.+|[^\\n]+?::)\\s+"},{className:"label",begin:"^(NOTE|TIP|IMPORTANT|WARNING|CAUTION):\\s+",relevance:10},{className:"strong",begin:"\\B\\*(?![\\*\\s])",end:"(\\n{2}|\\*)",contains:[{begin:"\\\\*\\w",relevance:0}]},{className:"emphasis",begin:"\\B'(?!['\\s])",end:"(\\n{2}|')",contains:[{begin:"\\\\'\\w",relevance:0}],relevance:0},{className:"emphasis",begin:"_(?![_\\s])",end:"(\\n{2}|_)",relevance:0},{className:"smartquote",variants:[{begin:"``.+?''"},{begin:"`.+?'"}]},{className:"code",begin:"(`.+?`|\\+.+?\\+)",relevance:0},{className:"code",begin:"^[ \\t]",end:"$",relevance:0},{className:"horizontal_rule",begin:"^'{3,}[ \\t]*$",relevance:10},{begin:"(link:)?(http|https|ftp|file|irc|image:?):\\S+\\[.*?\\]",returnBegin:!0,contains:[{begin:"(link|image:?):",relevance:0},{className:"link_url",begin:"\\w",end:"[^\\[]+",relevance:0},{className:"link_label",begin:"\\[",end:"\\]",excludeBegin:!0,excludeEnd:!0,relevance:0}],relevance:10}]}}),a.registerLanguage("aspectj",function(a){var b="false synchronized int abstract float private char boolean static null if const for true while long throw strictfp finally protected import native final return void enum else extends implements break transient new catch instanceof byte super volatile case assert short package default double public try this switch continue throws privileged aspectOf adviceexecution proceed cflowbelow cflow initialization preinitialization staticinitialization withincode target within execution getWithinTypeName handler thisJoinPoint thisJoinPointStaticPart thisEnclosingJoinPointStaticPart declare parents warning error soft precedence thisAspectInstance",c="get set args call";return{keywords:b,illegal:/<\/|#/,contains:[a.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"}]}),a.C_LINE_COMMENT_MODE,a.C_BLOCK_COMMENT_MODE,a.APOS_STRING_MODE,a.QUOTE_STRING_MODE,{className:"aspect",beginKeywords:"aspect",end:/[{;=]/,excludeEnd:!0,illegal:/[:;"\[\]]/,contains:[{beginKeywords:"extends implements pertypewithin perthis pertarget percflowbelow percflow issingleton"},a.UNDERSCORE_TITLE_MODE,{begin:/\([^\)]*/,end:/[)]+/,keywords:b+" "+c,excludeEnd:!1}]},{className:"class",beginKeywords:"class interface",end:/[{;=]/,excludeEnd:!0,relevance:0,keywords:"class interface",illegal:/[:"\[\]]/,contains:[{beginKeywords:"extends implements"},a.UNDERSCORE_TITLE_MODE]},{beginKeywords:"pointcut after before around throwing returning",end:/[)]/,excludeEnd:!1,illegal:/["\[\]]/,contains:[{begin:a.UNDERSCORE_IDENT_RE+"\\s*\\(",returnBegin:!0,contains:[a.UNDERSCORE_TITLE_MODE]}]},{begin:/[:]/,returnBegin:!0,end:/[{;]/,relevance:0,excludeEnd:!1,keywords:b,illegal:/["\[\]]/,contains:[{begin:a.UNDERSCORE_IDENT_RE+"\\s*\\(",keywords:b+" "+c},a.QUOTE_STRING_MODE]},{beginKeywords:"new throw",relevance:0},{className:"function",begin:/\w+ +\w+(\.)?\w+\s*\([^\)]*\)\s*((throws)[\w\s,]+)?[\{;]/,returnBegin:!0,end:/[{;=]/,keywords:b,excludeEnd:!0,contains:[{begin:a.UNDERSCORE_IDENT_RE+"\\s*\\(",returnBegin:!0,relevance:0,contains:[a.UNDERSCORE_TITLE_MODE]},{className:"params",begin:/\(/,end:/\)/,relevance:0,keywords:b,contains:[a.APOS_STRING_MODE,a.QUOTE_STRING_MODE,a.C_NUMBER_MODE,a.C_BLOCK_COMMENT_MODE]},a.C_LINE_COMMENT_MODE,a.C_BLOCK_COMMENT_MODE]},a.C_NUMBER_MODE,{className:"annotation",begin:"@[A-Za-z]+"}]}}),a.registerLanguage("autohotkey",function(a){var b={className:"escape",begin:"`[\\s\\S]"},c=a.COMMENT(";","$",{relevance:0}),d=[{className:"built_in",begin:"A_[a-zA-Z0-9]+"},{className:"built_in",beginKeywords:"ComSpec Clipboard ClipboardAll ErrorLevel"}];return{case_insensitive:!0,keywords:{keyword:"Break Continue Else Gosub If Loop Return While",literal:"A true false NOT AND OR"},contains:d.concat([b,a.inherit(a.QUOTE_STRING_MODE,{contains:[b]}),c,{className:"number",begin:a.NUMBER_RE,relevance:0},{className:"var_expand",begin:"%",end:"%",illegal:"\\n",contains:[b]},{className:"label",contains:[b],variants:[{begin:'^[^\\n";]+::(?!=)'},{begin:'^[^\\n";]+:(?!=)',relevance:0}]},{begin:",\\s*,",relevance:10}])}}),a.registerLanguage("autoit",function(a){var b="ByRef Case Const ContinueCase ContinueLoop Default Dim Do Else ElseIf EndFunc EndIf EndSelect EndSwitch EndWith Enum Exit ExitLoop For Func Global If In Local Next ReDim Return Select Static Step Switch Then To Until Volatile WEnd While With",c="True False And Null Not Or",d="Abs ACos AdlibRegister AdlibUnRegister Asc AscW ASin Assign ATan AutoItSetOption AutoItWinGetTitle AutoItWinSetTitle Beep Binary BinaryLen BinaryMid BinaryToString BitAND BitNOT BitOR BitRotate BitShift BitXOR BlockInput Break Call CDTray Ceiling Chr ChrW ClipGet ClipPut ConsoleRead ConsoleWrite ConsoleWriteError ControlClick ControlCommand ControlDisable ControlEnable ControlFocus ControlGetFocus ControlGetHandle ControlGetPos ControlGetText ControlHide ControlListView ControlMove ControlSend ControlSetText ControlShow ControlTreeView Cos Dec DirCopy DirCreate DirGetSize DirMove DirRemove DllCall DllCallAddress DllCallbackFree DllCallbackGetPtr DllCallbackRegister DllClose DllOpen DllStructCreate DllStructGetData DllStructGetPtr DllStructGetSize DllStructSetData DriveGetDrive DriveGetFileSystem DriveGetLabel DriveGetSerial DriveGetType DriveMapAdd DriveMapDel DriveMapGet DriveSetLabel DriveSpaceFree DriveSpaceTotal DriveStatus EnvGet EnvSet EnvUpdate Eval Execute Exp FileChangeDir FileClose FileCopy FileCreateNTFSLink FileCreateShortcut FileDelete FileExists FileFindFirstFile FileFindNextFile FileFlush FileGetAttrib FileGetEncoding FileGetLongName FileGetPos FileGetShortcut FileGetShortName FileGetSize FileGetTime FileGetVersion FileInstall FileMove FileOpen FileOpenDialog FileRead FileReadLine FileReadToArray FileRecycle FileRecycleEmpty FileSaveDialog FileSelectFolder FileSetAttrib FileSetEnd FileSetPos FileSetTime FileWrite FileWriteLine Floor FtpSetProxy FuncName GUICreate GUICtrlCreateAvi GUICtrlCreateButton GUICtrlCreateCheckbox GUICtrlCreateCombo GUICtrlCreateContextMenu GUICtrlCreateDate GUICtrlCreateDummy GUICtrlCreateEdit GUICtrlCreateGraphic GUICtrlCreateGroup GUICtrlCreateIcon GUICtrlCreateInput GUICtrlCreateLabel GUICtrlCreateList GUICtrlCreateListView GUICtrlCreateListViewItem GUICtrlCreateMenu GUICtrlCreateMenuItem GUICtrlCreateMonthCal GUICtrlCreateObj GUICtrlCreatePic GUICtrlCreateProgress GUICtrlCreateRadio GUICtrlCreateSlider GUICtrlCreateTab GUICtrlCreateTabItem GUICtrlCreateTreeView GUICtrlCreateTreeViewItem GUICtrlCreateUpdown GUICtrlDelete GUICtrlGetHandle GUICtrlGetState GUICtrlRead GUICtrlRecvMsg GUICtrlRegisterListViewSort GUICtrlSendMsg GUICtrlSendToDummy GUICtrlSetBkColor GUICtrlSetColor GUICtrlSetCursor GUICtrlSetData GUICtrlSetDefBkColor GUICtrlSetDefColor GUICtrlSetFont GUICtrlSetGraphic GUICtrlSetImage GUICtrlSetLimit GUICtrlSetOnEvent GUICtrlSetPos GUICtrlSetResizing GUICtrlSetState GUICtrlSetStyle GUICtrlSetTip GUIDelete GUIGetCursorInfo GUIGetMsg GUIGetStyle GUIRegisterMsg GUISetAccelerators GUISetBkColor GUISetCoord GUISetCursor GUISetFont GUISetHelp GUISetIcon GUISetOnEvent GUISetState GUISetStyle GUIStartGroup GUISwitch Hex HotKeySet HttpSetProxy HttpSetUserAgent HWnd InetClose InetGet InetGetInfo InetGetSize InetRead IniDelete IniRead IniReadSection IniReadSectionNames IniRenameSection IniWrite IniWriteSection InputBox Int IsAdmin IsArray IsBinary IsBool IsDeclared IsDllStruct IsFloat IsFunc IsHWnd IsInt IsKeyword IsNumber IsObj IsPtr IsString Log MemGetStats Mod MouseClick MouseClickDrag MouseDown MouseGetCursor MouseGetPos MouseMove MouseUp MouseWheel MsgBox Number ObjCreate ObjCreateInterface ObjEvent ObjGet ObjName OnAutoItExitRegister OnAutoItExitUnRegister Opt Ping PixelChecksum PixelGetColor PixelSearch ProcessClose ProcessExists ProcessGetStats ProcessList ProcessSetPriority ProcessWait ProcessWaitClose ProgressOff ProgressOn ProgressSet Ptr Random RegDelete RegEnumKey RegEnumVal RegRead RegWrite Round Run RunAs RunAsWait RunWait Send SendKeepActive SetError SetExtended ShellExecute ShellExecuteWait Shutdown Sin Sleep SoundPlay SoundSetWaveVolume SplashImageOn SplashOff SplashTextOn Sqrt SRandom StatusbarGetText StderrRead StdinWrite StdioClose StdoutRead String StringAddCR StringCompare StringFormat StringFromASCIIArray StringInStr StringIsAlNum StringIsAlpha StringIsASCII StringIsDigit StringIsFloat StringIsInt StringIsLower StringIsSpace StringIsUpper StringIsXDigit StringLeft StringLen StringLower StringMid StringRegExp StringRegExpReplace StringReplace StringReverse StringRight StringSplit StringStripCR StringStripWS StringToASCIIArray StringToBinary StringTrimLeft StringTrimRight StringUpper Tan TCPAccept TCPCloseSocket TCPConnect TCPListen TCPNameToIP TCPRecv TCPSend TCPShutdown TCPStartup TimerDiff TimerInit ToolTip TrayCreateItem TrayCreateMenu TrayGetMsg TrayItemDelete TrayItemGetHandle TrayItemGetState TrayItemGetText TrayItemSetOnEvent TrayItemSetState TrayItemSetText TraySetClick TraySetIcon TraySetOnEvent TraySetPauseIcon TraySetState TraySetToolTip TrayTip UBound UDPBind UDPCloseSocket UDPOpen UDPRecv UDPSend UDPShutdown UDPStartup VarGetType WinActivate WinActive WinClose WinExists WinFlash WinGetCaretPos WinGetClassList WinGetClientSize WinGetHandle WinGetPos WinGetProcess WinGetState WinGetText WinGetTitle WinKill WinList WinMenuSelectItem WinMinimizeAll WinMinimizeAllUndo WinMove WinSetOnTop WinSetState WinSetTitle WinSetTrans WinWait WinWaitActive WinWaitClose WinWaitNotActive Array1DToHistogram ArrayAdd ArrayBinarySearch ArrayColDelete ArrayColInsert ArrayCombinations ArrayConcatenate ArrayDelete ArrayDisplay ArrayExtract ArrayFindAll ArrayInsert ArrayMax ArrayMaxIndex ArrayMin ArrayMinIndex ArrayPermute ArrayPop ArrayPush ArrayReverse ArraySearch ArrayShuffle ArraySort ArraySwap ArrayToClip ArrayToString ArrayTranspose ArrayTrim ArrayUnique Assert ChooseColor ChooseFont ClipBoard_ChangeChain ClipBoard_Close ClipBoard_CountFormats ClipBoard_Empty ClipBoard_EnumFormats ClipBoard_FormatStr ClipBoard_GetData ClipBoard_GetDataEx ClipBoard_GetFormatName ClipBoard_GetOpenWindow ClipBoard_GetOwner ClipBoard_GetPriorityFormat ClipBoard_GetSequenceNumber ClipBoard_GetViewer ClipBoard_IsFormatAvailable ClipBoard_Open ClipBoard_RegisterFormat ClipBoard_SetData ClipBoard_SetDataEx ClipBoard_SetViewer ClipPutFile ColorConvertHSLtoRGB ColorConvertRGBtoHSL ColorGetBlue ColorGetCOLORREF ColorGetGreen ColorGetRed ColorGetRGB ColorSetCOLORREF ColorSetRGB Crypt_DecryptData Crypt_DecryptFile Crypt_DeriveKey Crypt_DestroyKey Crypt_EncryptData Crypt_EncryptFile Crypt_GenRandom Crypt_HashData Crypt_HashFile Crypt_Shutdown Crypt_Startup DateAdd DateDayOfWeek DateDaysInMonth DateDiff DateIsLeapYear DateIsValid DateTimeFormat DateTimeSplit DateToDayOfWeek DateToDayOfWeekISO DateToDayValue DateToMonth Date_Time_CompareFileTime Date_Time_DOSDateTimeToArray Date_Time_DOSDateTimeToFileTime Date_Time_DOSDateTimeToStr Date_Time_DOSDateToArray Date_Time_DOSDateToStr Date_Time_DOSTimeToArray Date_Time_DOSTimeToStr Date_Time_EncodeFileTime Date_Time_EncodeSystemTime Date_Time_FileTimeToArray Date_Time_FileTimeToDOSDateTime Date_Time_FileTimeToLocalFileTime Date_Time_FileTimeToStr Date_Time_FileTimeToSystemTime Date_Time_GetFileTime Date_Time_GetLocalTime Date_Time_GetSystemTime Date_Time_GetSystemTimeAdjustment Date_Time_GetSystemTimeAsFileTime Date_Time_GetSystemTimes Date_Time_GetTickCount Date_Time_GetTimeZoneInformation Date_Time_LocalFileTimeToFileTime Date_Time_SetFileTime Date_Time_SetLocalTime Date_Time_SetSystemTime Date_Time_SetSystemTimeAdjustment Date_Time_SetTimeZoneInformation Date_Time_SystemTimeToArray Date_Time_SystemTimeToDateStr Date_Time_SystemTimeToDateTimeStr Date_Time_SystemTimeToFileTime Date_Time_SystemTimeToTimeStr Date_Time_SystemTimeToTzSpecificLocalTime Date_Time_TzSpecificLocalTimeToSystemTime DayValueToDate DebugBugReportEnv DebugCOMError DebugOut DebugReport DebugReportEx DebugReportVar DebugSetup Degree EventLog__Backup EventLog__Clear EventLog__Close EventLog__Count EventLog__DeregisterSource EventLog__Full EventLog__Notify EventLog__Oldest EventLog__Open EventLog__OpenBackup EventLog__Read EventLog__RegisterSource EventLog__Report Excel_BookAttach Excel_BookClose Excel_BookList Excel_BookNew Excel_BookOpen Excel_BookOpenText Excel_BookSave Excel_BookSaveAs Excel_Close Excel_ColumnToLetter Excel_ColumnToNumber Excel_ConvertFormula Excel_Export Excel_FilterGet Excel_FilterSet Excel_Open Excel_PictureAdd Excel_Print Excel_RangeCopyPaste Excel_RangeDelete Excel_RangeFind Excel_RangeInsert Excel_RangeLinkAddRemove Excel_RangeRead Excel_RangeReplace Excel_RangeSort Excel_RangeValidate Excel_RangeWrite Excel_SheetAdd Excel_SheetCopyMove Excel_SheetDelete Excel_SheetList FileCountLines FileCreate FileListToArray FileListToArrayRec FilePrint FileReadToArray FileWriteFromArray FileWriteLog FileWriteToLine FTP_Close FTP_Command FTP_Connect FTP_DecodeInternetStatus FTP_DirCreate FTP_DirDelete FTP_DirGetCurrent FTP_DirPutContents FTP_DirSetCurrent FTP_FileClose FTP_FileDelete FTP_FileGet FTP_FileGetSize FTP_FileOpen FTP_FilePut FTP_FileRead FTP_FileRename FTP_FileTimeLoHiToStr FTP_FindFileClose FTP_FindFileFirst FTP_FindFileNext FTP_GetLastResponseInfo FTP_ListToArray FTP_ListToArray2D FTP_ListToArrayEx FTP_Open FTP_ProgressDownload FTP_ProgressUpload FTP_SetStatusCallback GDIPlus_ArrowCapCreate GDIPlus_ArrowCapDispose GDIPlus_ArrowCapGetFillState GDIPlus_ArrowCapGetHeight GDIPlus_ArrowCapGetMiddleInset GDIPlus_ArrowCapGetWidth GDIPlus_ArrowCapSetFillState GDIPlus_ArrowCapSetHeight GDIPlus_ArrowCapSetMiddleInset GDIPlus_ArrowCapSetWidth GDIPlus_BitmapApplyEffect GDIPlus_BitmapApplyEffectEx GDIPlus_BitmapCloneArea GDIPlus_BitmapConvertFormat GDIPlus_BitmapCreateApplyEffect GDIPlus_BitmapCreateApplyEffectEx GDIPlus_BitmapCreateDIBFromBitmap GDIPlus_BitmapCreateFromFile GDIPlus_BitmapCreateFromGraphics GDIPlus_BitmapCreateFromHBITMAP GDIPlus_BitmapCreateFromHICON GDIPlus_BitmapCreateFromHICON32 GDIPlus_BitmapCreateFromMemory GDIPlus_BitmapCreateFromResource GDIPlus_BitmapCreateFromScan0 GDIPlus_BitmapCreateFromStream GDIPlus_BitmapCreateHBITMAPFromBitmap GDIPlus_BitmapDispose GDIPlus_BitmapGetHistogram GDIPlus_BitmapGetHistogramEx GDIPlus_BitmapGetHistogramSize GDIPlus_BitmapGetPixel GDIPlus_BitmapLockBits GDIPlus_BitmapSetPixel GDIPlus_BitmapUnlockBits GDIPlus_BrushClone GDIPlus_BrushCreateSolid GDIPlus_BrushDispose GDIPlus_BrushGetSolidColor GDIPlus_BrushGetType GDIPlus_BrushSetSolidColor GDIPlus_ColorMatrixCreate GDIPlus_ColorMatrixCreateGrayScale GDIPlus_ColorMatrixCreateNegative GDIPlus_ColorMatrixCreateSaturation GDIPlus_ColorMatrixCreateScale GDIPlus_ColorMatrixCreateTranslate GDIPlus_CustomLineCapClone GDIPlus_CustomLineCapCreate GDIPlus_CustomLineCapDispose GDIPlus_CustomLineCapGetStrokeCaps GDIPlus_CustomLineCapSetStrokeCaps GDIPlus_Decoders GDIPlus_DecodersGetCount GDIPlus_DecodersGetSize GDIPlus_DrawImageFX GDIPlus_DrawImageFXEx GDIPlus_DrawImagePoints GDIPlus_EffectCreate GDIPlus_EffectCreateBlur GDIPlus_EffectCreateBrightnessContrast GDIPlus_EffectCreateColorBalance GDIPlus_EffectCreateColorCurve GDIPlus_EffectCreateColorLUT GDIPlus_EffectCreateColorMatrix GDIPlus_EffectCreateHueSaturationLightness GDIPlus_EffectCreateLevels GDIPlus_EffectCreateRedEyeCorrection GDIPlus_EffectCreateSharpen GDIPlus_EffectCreateTint GDIPlus_EffectDispose GDIPlus_EffectGetParameters GDIPlus_EffectSetParameters GDIPlus_Encoders GDIPlus_EncodersGetCLSID GDIPlus_EncodersGetCount GDIPlus_EncodersGetParamList GDIPlus_EncodersGetParamListSize GDIPlus_EncodersGetSize GDIPlus_FontCreate GDIPlus_FontDispose GDIPlus_FontFamilyCreate GDIPlus_FontFamilyCreateFromCollection GDIPlus_FontFamilyDispose GDIPlus_FontFamilyGetCellAscent GDIPlus_FontFamilyGetCellDescent GDIPlus_FontFamilyGetEmHeight GDIPlus_FontFamilyGetLineSpacing GDIPlus_FontGetHeight GDIPlus_FontPrivateAddFont GDIPlus_FontPrivateAddMemoryFont GDIPlus_FontPrivateCollectionDispose GDIPlus_FontPrivateCreateCollection GDIPlus_GraphicsClear GDIPlus_GraphicsCreateFromHDC GDIPlus_GraphicsCreateFromHWND GDIPlus_GraphicsDispose GDIPlus_GraphicsDrawArc GDIPlus_GraphicsDrawBezier GDIPlus_GraphicsDrawClosedCurve GDIPlus_GraphicsDrawClosedCurve2 GDIPlus_GraphicsDrawCurve GDIPlus_GraphicsDrawCurve2 GDIPlus_GraphicsDrawEllipse GDIPlus_GraphicsDrawImage GDIPlus_GraphicsDrawImagePointsRect GDIPlus_GraphicsDrawImageRect GDIPlus_GraphicsDrawImageRectRect GDIPlus_GraphicsDrawLine GDIPlus_GraphicsDrawPath GDIPlus_GraphicsDrawPie GDIPlus_GraphicsDrawPolygon GDIPlus_GraphicsDrawRect GDIPlus_GraphicsDrawString GDIPlus_GraphicsDrawStringEx GDIPlus_GraphicsFillClosedCurve GDIPlus_GraphicsFillClosedCurve2 GDIPlus_GraphicsFillEllipse GDIPlus_GraphicsFillPath GDIPlus_GraphicsFillPie GDIPlus_GraphicsFillPolygon GDIPlus_GraphicsFillRect GDIPlus_GraphicsFillRegion GDIPlus_GraphicsGetCompositingMode GDIPlus_GraphicsGetCompositingQuality GDIPlus_GraphicsGetDC GDIPlus_GraphicsGetInterpolationMode GDIPlus_GraphicsGetSmoothingMode GDIPlus_GraphicsGetTransform GDIPlus_GraphicsMeasureCharacterRanges GDIPlus_GraphicsMeasureString GDIPlus_GraphicsReleaseDC GDIPlus_GraphicsResetClip GDIPlus_GraphicsResetTransform GDIPlus_GraphicsRestore GDIPlus_GraphicsRotateTransform GDIPlus_GraphicsSave GDIPlus_GraphicsScaleTransform GDIPlus_GraphicsSetClipPath GDIPlus_GraphicsSetClipRect GDIPlus_GraphicsSetClipRegion GDIPlus_GraphicsSetCompositingMode GDIPlus_GraphicsSetCompositingQuality GDIPlus_GraphicsSetInterpolationMode GDIPlus_GraphicsSetPixelOffsetMode GDIPlus_GraphicsSetSmoothingMode GDIPlus_GraphicsSetTextRenderingHint GDIPlus_GraphicsSetTransform GDIPlus_GraphicsTransformPoints GDIPlus_GraphicsTranslateTransform GDIPlus_HatchBrushCreate GDIPlus_HICONCreateFromBitmap GDIPlus_ImageAttributesCreate GDIPlus_ImageAttributesDispose GDIPlus_ImageAttributesSetColorKeys GDIPlus_ImageAttributesSetColorMatrix GDIPlus_ImageDispose GDIPlus_ImageGetDimension GDIPlus_ImageGetFlags GDIPlus_ImageGetGraphicsContext GDIPlus_ImageGetHeight GDIPlus_ImageGetHorizontalResolution GDIPlus_ImageGetPixelFormat GDIPlus_ImageGetRawFormat GDIPlus_ImageGetThumbnail GDIPlus_ImageGetType GDIPlus_ImageGetVerticalResolution GDIPlus_ImageGetWidth GDIPlus_ImageLoadFromFile GDIPlus_ImageLoadFromStream GDIPlus_ImageResize GDIPlus_ImageRotateFlip GDIPlus_ImageSaveToFile GDIPlus_ImageSaveToFileEx GDIPlus_ImageSaveToStream GDIPlus_ImageScale GDIPlus_LineBrushCreate GDIPlus_LineBrushCreateFromRect GDIPlus_LineBrushCreateFromRectWithAngle GDIPlus_LineBrushGetColors GDIPlus_LineBrushGetRect GDIPlus_LineBrushMultiplyTransform GDIPlus_LineBrushResetTransform GDIPlus_LineBrushSetBlend GDIPlus_LineBrushSetColors GDIPlus_LineBrushSetGammaCorrection GDIPlus_LineBrushSetLinearBlend GDIPlus_LineBrushSetPresetBlend GDIPlus_LineBrushSetSigmaBlend GDIPlus_LineBrushSetTransform GDIPlus_MatrixClone GDIPlus_MatrixCreate GDIPlus_MatrixDispose GDIPlus_MatrixGetElements GDIPlus_MatrixInvert GDIPlus_MatrixMultiply GDIPlus_MatrixRotate GDIPlus_MatrixScale GDIPlus_MatrixSetElements GDIPlus_MatrixShear GDIPlus_MatrixTransformPoints GDIPlus_MatrixTranslate GDIPlus_PaletteInitialize GDIPlus_ParamAdd GDIPlus_ParamInit GDIPlus_ParamSize GDIPlus_PathAddArc GDIPlus_PathAddBezier GDIPlus_PathAddClosedCurve GDIPlus_PathAddClosedCurve2 GDIPlus_PathAddCurve GDIPlus_PathAddCurve2 GDIPlus_PathAddCurve3 GDIPlus_PathAddEllipse GDIPlus_PathAddLine GDIPlus_PathAddLine2 GDIPlus_PathAddPath GDIPlus_PathAddPie GDIPlus_PathAddPolygon GDIPlus_PathAddRectangle GDIPlus_PathAddString GDIPlus_PathBrushCreate GDIPlus_PathBrushCreateFromPath GDIPlus_PathBrushGetCenterPoint GDIPlus_PathBrushGetFocusScales GDIPlus_PathBrushGetPointCount GDIPlus_PathBrushGetRect GDIPlus_PathBrushGetWrapMode GDIPlus_PathBrushMultiplyTransform GDIPlus_PathBrushResetTransform GDIPlus_PathBrushSetBlend GDIPlus_PathBrushSetCenterColor GDIPlus_PathBrushSetCenterPoint GDIPlus_PathBrushSetFocusScales GDIPlus_PathBrushSetGammaCorrection GDIPlus_PathBrushSetLinearBlend GDIPlus_PathBrushSetPresetBlend GDIPlus_PathBrushSetSigmaBlend GDIPlus_PathBrushSetSurroundColor GDIPlus_PathBrushSetSurroundColorsWithCount GDIPlus_PathBrushSetTransform GDIPlus_PathBrushSetWrapMode GDIPlus_PathClone GDIPlus_PathCloseFigure GDIPlus_PathCreate GDIPlus_PathCreate2 GDIPlus_PathDispose GDIPlus_PathFlatten GDIPlus_PathGetData GDIPlus_PathGetFillMode GDIPlus_PathGetLastPoint GDIPlus_PathGetPointCount GDIPlus_PathGetPoints GDIPlus_PathGetWorldBounds GDIPlus_PathIsOutlineVisiblePoint GDIPlus_PathIsVisiblePoint GDIPlus_PathIterCreate GDIPlus_PathIterDispose GDIPlus_PathIterGetSubpathCount GDIPlus_PathIterNextMarkerPath GDIPlus_PathIterNextSubpathPath GDIPlus_PathIterRewind GDIPlus_PathReset GDIPlus_PathReverse GDIPlus_PathSetFillMode GDIPlus_PathSetMarker GDIPlus_PathStartFigure GDIPlus_PathTransform GDIPlus_PathWarp GDIPlus_PathWiden GDIPlus_PathWindingModeOutline GDIPlus_PenCreate GDIPlus_PenCreate2 GDIPlus_PenDispose GDIPlus_PenGetAlignment GDIPlus_PenGetColor GDIPlus_PenGetCustomEndCap GDIPlus_PenGetDashCap GDIPlus_PenGetDashStyle GDIPlus_PenGetEndCap GDIPlus_PenGetMiterLimit GDIPlus_PenGetWidth GDIPlus_PenSetAlignment GDIPlus_PenSetColor GDIPlus_PenSetCustomEndCap GDIPlus_PenSetDashCap GDIPlus_PenSetDashStyle GDIPlus_PenSetEndCap GDIPlus_PenSetLineCap GDIPlus_PenSetLineJoin GDIPlus_PenSetMiterLimit GDIPlus_PenSetStartCap GDIPlus_PenSetWidth GDIPlus_RectFCreate GDIPlus_RegionClone GDIPlus_RegionCombinePath GDIPlus_RegionCombineRect GDIPlus_RegionCombineRegion GDIPlus_RegionCreate GDIPlus_RegionCreateFromPath GDIPlus_RegionCreateFromRect GDIPlus_RegionDispose GDIPlus_RegionGetBounds GDIPlus_RegionGetHRgn GDIPlus_RegionTransform GDIPlus_RegionTranslate GDIPlus_Shutdown GDIPlus_Startup GDIPlus_StringFormatCreate GDIPlus_StringFormatDispose GDIPlus_StringFormatGetMeasurableCharacterRangeCount GDIPlus_StringFormatSetAlign GDIPlus_StringFormatSetLineAlign GDIPlus_StringFormatSetMeasurableCharacterRanges GDIPlus_TextureCreate GDIPlus_TextureCreate2 GDIPlus_TextureCreateIA GetIP GUICtrlAVI_Close GUICtrlAVI_Create GUICtrlAVI_Destroy GUICtrlAVI_IsPlaying GUICtrlAVI_Open GUICtrlAVI_OpenEx GUICtrlAVI_Play GUICtrlAVI_Seek GUICtrlAVI_Show GUICtrlAVI_Stop GUICtrlButton_Click GUICtrlButton_Create GUICtrlButton_Destroy GUICtrlButton_Enable GUICtrlButton_GetCheck GUICtrlButton_GetFocus GUICtrlButton_GetIdealSize GUICtrlButton_GetImage GUICtrlButton_GetImageList GUICtrlButton_GetNote GUICtrlButton_GetNoteLength GUICtrlButton_GetSplitInfo GUICtrlButton_GetState GUICtrlButton_GetText GUICtrlButton_GetTextMargin GUICtrlButton_SetCheck GUICtrlButton_SetDontClick GUICtrlButton_SetFocus GUICtrlButton_SetImage GUICtrlButton_SetImageList GUICtrlButton_SetNote GUICtrlButton_SetShield GUICtrlButton_SetSize GUICtrlButton_SetSplitInfo GUICtrlButton_SetState GUICtrlButton_SetStyle GUICtrlButton_SetText GUICtrlButton_SetTextMargin GUICtrlButton_Show GUICtrlComboBoxEx_AddDir GUICtrlComboBoxEx_AddString GUICtrlComboBoxEx_BeginUpdate GUICtrlComboBoxEx_Create GUICtrlComboBoxEx_CreateSolidBitMap GUICtrlComboBoxEx_DeleteString GUICtrlComboBoxEx_Destroy GUICtrlComboBoxEx_EndUpdate GUICtrlComboBoxEx_FindStringExact GUICtrlComboBoxEx_GetComboBoxInfo GUICtrlComboBoxEx_GetComboControl GUICtrlComboBoxEx_GetCount GUICtrlComboBoxEx_GetCurSel GUICtrlComboBoxEx_GetDroppedControlRect GUICtrlComboBoxEx_GetDroppedControlRectEx GUICtrlComboBoxEx_GetDroppedState GUICtrlComboBoxEx_GetDroppedWidth GUICtrlComboBoxEx_GetEditControl GUICtrlComboBoxEx_GetEditSel GUICtrlComboBoxEx_GetEditText GUICtrlComboBoxEx_GetExtendedStyle GUICtrlComboBoxEx_GetExtendedUI GUICtrlComboBoxEx_GetImageList GUICtrlComboBoxEx_GetItem GUICtrlComboBoxEx_GetItemEx GUICtrlComboBoxEx_GetItemHeight GUICtrlComboBoxEx_GetItemImage GUICtrlComboBoxEx_GetItemIndent GUICtrlComboBoxEx_GetItemOverlayImage GUICtrlComboBoxEx_GetItemParam GUICtrlComboBoxEx_GetItemSelectedImage GUICtrlComboBoxEx_GetItemText GUICtrlComboBoxEx_GetItemTextLen GUICtrlComboBoxEx_GetList GUICtrlComboBoxEx_GetListArray GUICtrlComboBoxEx_GetLocale GUICtrlComboBoxEx_GetLocaleCountry GUICtrlComboBoxEx_GetLocaleLang GUICtrlComboBoxEx_GetLocalePrimLang GUICtrlComboBoxEx_GetLocaleSubLang GUICtrlComboBoxEx_GetMinVisible GUICtrlComboBoxEx_GetTopIndex GUICtrlComboBoxEx_GetUnicode GUICtrlComboBoxEx_InitStorage GUICtrlComboBoxEx_InsertString GUICtrlComboBoxEx_LimitText GUICtrlComboBoxEx_ReplaceEditSel GUICtrlComboBoxEx_ResetContent GUICtrlComboBoxEx_SetCurSel GUICtrlComboBoxEx_SetDroppedWidth GUICtrlComboBoxEx_SetEditSel GUICtrlComboBoxEx_SetEditText GUICtrlComboBoxEx_SetExtendedStyle GUICtrlComboBoxEx_SetExtendedUI GUICtrlComboBoxEx_SetImageList GUICtrlComboBoxEx_SetItem GUICtrlComboBoxEx_SetItemEx GUICtrlComboBoxEx_SetItemHeight GUICtrlComboBoxEx_SetItemImage GUICtrlComboBoxEx_SetItemIndent GUICtrlComboBoxEx_SetItemOverlayImage GUICtrlComboBoxEx_SetItemParam GUICtrlComboBoxEx_SetItemSelectedImage GUICtrlComboBoxEx_SetMinVisible GUICtrlComboBoxEx_SetTopIndex GUICtrlComboBoxEx_SetUnicode GUICtrlComboBoxEx_ShowDropDown GUICtrlComboBox_AddDir GUICtrlComboBox_AddString GUICtrlComboBox_AutoComplete GUICtrlComboBox_BeginUpdate GUICtrlComboBox_Create GUICtrlComboBox_DeleteString GUICtrlComboBox_Destroy GUICtrlComboBox_EndUpdate GUICtrlComboBox_FindString GUICtrlComboBox_FindStringExact GUICtrlComboBox_GetComboBoxInfo GUICtrlComboBox_GetCount GUICtrlComboBox_GetCueBanner GUICtrlComboBox_GetCurSel GUICtrlComboBox_GetDroppedControlRect GUICtrlComboBox_GetDroppedControlRectEx GUICtrlComboBox_GetDroppedState GUICtrlComboBox_GetDroppedWidth GUICtrlComboBox_GetEditSel GUICtrlComboBox_GetEditText GUICtrlComboBox_GetExtendedUI GUICtrlComboBox_GetHorizontalExtent GUICtrlComboBox_GetItemHeight GUICtrlComboBox_GetLBText GUICtrlComboBox_GetLBTextLen GUICtrlComboBox_GetList GUICtrlComboBox_GetListArray GUICtrlComboBox_GetLocale GUICtrlComboBox_GetLocaleCountry GUICtrlComboBox_GetLocaleLang GUICtrlComboBox_GetLocalePrimLang GUICtrlComboBox_GetLocaleSubLang GUICtrlComboBox_GetMinVisible GUICtrlComboBox_GetTopIndex GUICtrlComboBox_InitStorage GUICtrlComboBox_InsertString GUICtrlComboBox_LimitText GUICtrlComboBox_ReplaceEditSel GUICtrlComboBox_ResetContent GUICtrlComboBox_SelectString GUICtrlComboBox_SetCueBanner GUICtrlComboBox_SetCurSel GUICtrlComboBox_SetDroppedWidth GUICtrlComboBox_SetEditSel GUICtrlComboBox_SetEditText GUICtrlComboBox_SetExtendedUI GUICtrlComboBox_SetHorizontalExtent GUICtrlComboBox_SetItemHeight GUICtrlComboBox_SetMinVisible GUICtrlComboBox_SetTopIndex GUICtrlComboBox_ShowDropDown GUICtrlDTP_Create GUICtrlDTP_Destroy GUICtrlDTP_GetMCColor GUICtrlDTP_GetMCFont GUICtrlDTP_GetMonthCal GUICtrlDTP_GetRange GUICtrlDTP_GetRangeEx GUICtrlDTP_GetSystemTime GUICtrlDTP_GetSystemTimeEx GUICtrlDTP_SetFormat GUICtrlDTP_SetMCColor GUICtrlDTP_SetMCFont GUICtrlDTP_SetRange GUICtrlDTP_SetRangeEx GUICtrlDTP_SetSystemTime GUICtrlDTP_SetSystemTimeEx GUICtrlEdit_AppendText GUICtrlEdit_BeginUpdate GUICtrlEdit_CanUndo GUICtrlEdit_CharFromPos GUICtrlEdit_Create GUICtrlEdit_Destroy GUICtrlEdit_EmptyUndoBuffer GUICtrlEdit_EndUpdate GUICtrlEdit_Find GUICtrlEdit_FmtLines GUICtrlEdit_GetCueBanner GUICtrlEdit_GetFirstVisibleLine GUICtrlEdit_GetLimitText GUICtrlEdit_GetLine GUICtrlEdit_GetLineCount GUICtrlEdit_GetMargins GUICtrlEdit_GetModify GUICtrlEdit_GetPasswordChar GUICtrlEdit_GetRECT GUICtrlEdit_GetRECTEx GUICtrlEdit_GetSel GUICtrlEdit_GetText GUICtrlEdit_GetTextLen GUICtrlEdit_HideBalloonTip GUICtrlEdit_InsertText GUICtrlEdit_LineFromChar GUICtrlEdit_LineIndex GUICtrlEdit_LineLength GUICtrlEdit_LineScroll GUICtrlEdit_PosFromChar GUICtrlEdit_ReplaceSel GUICtrlEdit_Scroll GUICtrlEdit_SetCueBanner GUICtrlEdit_SetLimitText GUICtrlEdit_SetMargins GUICtrlEdit_SetModify GUICtrlEdit_SetPasswordChar GUICtrlEdit_SetReadOnly GUICtrlEdit_SetRECT GUICtrlEdit_SetRECTEx GUICtrlEdit_SetRECTNP GUICtrlEdit_SetRectNPEx GUICtrlEdit_SetSel GUICtrlEdit_SetTabStops GUICtrlEdit_SetText GUICtrlEdit_ShowBalloonTip GUICtrlEdit_Undo GUICtrlHeader_AddItem GUICtrlHeader_ClearFilter GUICtrlHeader_ClearFilterAll GUICtrlHeader_Create GUICtrlHeader_CreateDragImage GUICtrlHeader_DeleteItem GUICtrlHeader_Destroy GUICtrlHeader_EditFilter GUICtrlHeader_GetBitmapMargin GUICtrlHeader_GetImageList GUICtrlHeader_GetItem GUICtrlHeader_GetItemAlign GUICtrlHeader_GetItemBitmap GUICtrlHeader_GetItemCount GUICtrlHeader_GetItemDisplay GUICtrlHeader_GetItemFlags GUICtrlHeader_GetItemFormat GUICtrlHeader_GetItemImage GUICtrlHeader_GetItemOrder GUICtrlHeader_GetItemParam GUICtrlHeader_GetItemRect GUICtrlHeader_GetItemRectEx GUICtrlHeader_GetItemText GUICtrlHeader_GetItemWidth GUICtrlHeader_GetOrderArray GUICtrlHeader_GetUnicodeFormat GUICtrlHeader_HitTest GUICtrlHeader_InsertItem GUICtrlHeader_Layout GUICtrlHeader_OrderToIndex GUICtrlHeader_SetBitmapMargin GUICtrlHeader_SetFilterChangeTimeout GUICtrlHeader_SetHotDivider GUICtrlHeader_SetImageList GUICtrlHeader_SetItem GUICtrlHeader_SetItemAlign GUICtrlHeader_SetItemBitmap GUICtrlHeader_SetItemDisplay GUICtrlHeader_SetItemFlags GUICtrlHeader_SetItemFormat GUICtrlHeader_SetItemImage GUICtrlHeader_SetItemOrder GUICtrlHeader_SetItemParam GUICtrlHeader_SetItemText GUICtrlHeader_SetItemWidth GUICtrlHeader_SetOrderArray GUICtrlHeader_SetUnicodeFormat GUICtrlIpAddress_ClearAddress GUICtrlIpAddress_Create GUICtrlIpAddress_Destroy GUICtrlIpAddress_Get GUICtrlIpAddress_GetArray GUICtrlIpAddress_GetEx GUICtrlIpAddress_IsBlank GUICtrlIpAddress_Set GUICtrlIpAddress_SetArray GUICtrlIpAddress_SetEx GUICtrlIpAddress_SetFocus GUICtrlIpAddress_SetFont GUICtrlIpAddress_SetRange GUICtrlIpAddress_ShowHide GUICtrlListBox_AddFile GUICtrlListBox_AddString GUICtrlListBox_BeginUpdate GUICtrlListBox_ClickItem GUICtrlListBox_Create GUICtrlListBox_DeleteString GUICtrlListBox_Destroy GUICtrlListBox_Dir GUICtrlListBox_EndUpdate GUICtrlListBox_FindInText GUICtrlListBox_FindString GUICtrlListBox_GetAnchorIndex GUICtrlListBox_GetCaretIndex GUICtrlListBox_GetCount GUICtrlListBox_GetCurSel GUICtrlListBox_GetHorizontalExtent GUICtrlListBox_GetItemData GUICtrlListBox_GetItemHeight GUICtrlListBox_GetItemRect GUICtrlListBox_GetItemRectEx GUICtrlListBox_GetListBoxInfo GUICtrlListBox_GetLocale GUICtrlListBox_GetLocaleCountry GUICtrlListBox_GetLocaleLang GUICtrlListBox_GetLocalePrimLang GUICtrlListBox_GetLocaleSubLang GUICtrlListBox_GetSel GUICtrlListBox_GetSelCount GUICtrlListBox_GetSelItems GUICtrlListBox_GetSelItemsText GUICtrlListBox_GetText GUICtrlListBox_GetTextLen GUICtrlListBox_GetTopIndex GUICtrlListBox_InitStorage GUICtrlListBox_InsertString GUICtrlListBox_ItemFromPoint GUICtrlListBox_ReplaceString GUICtrlListBox_ResetContent GUICtrlListBox_SelectString GUICtrlListBox_SelItemRange GUICtrlListBox_SelItemRangeEx GUICtrlListBox_SetAnchorIndex GUICtrlListBox_SetCaretIndex GUICtrlListBox_SetColumnWidth GUICtrlListBox_SetCurSel GUICtrlListBox_SetHorizontalExtent GUICtrlListBox_SetItemData GUICtrlListBox_SetItemHeight GUICtrlListBox_SetLocale GUICtrlListBox_SetSel GUICtrlListBox_SetTabStops GUICtrlListBox_SetTopIndex GUICtrlListBox_Sort GUICtrlListBox_SwapString GUICtrlListBox_UpdateHScroll GUICtrlListView_AddArray GUICtrlListView_AddColumn GUICtrlListView_AddItem GUICtrlListView_AddSubItem GUICtrlListView_ApproximateViewHeight GUICtrlListView_ApproximateViewRect GUICtrlListView_ApproximateViewWidth GUICtrlListView_Arrange GUICtrlListView_BeginUpdate GUICtrlListView_CancelEditLabel GUICtrlListView_ClickItem GUICtrlListView_CopyItems GUICtrlListView_Create GUICtrlListView_CreateDragImage GUICtrlListView_CreateSolidBitMap GUICtrlListView_DeleteAllItems GUICtrlListView_DeleteColumn GUICtrlListView_DeleteItem GUICtrlListView_DeleteItemsSelected GUICtrlListView_Destroy GUICtrlListView_DrawDragImage GUICtrlListView_EditLabel GUICtrlListView_EnableGroupView GUICtrlListView_EndUpdate GUICtrlListView_EnsureVisible GUICtrlListView_FindInText GUICtrlListView_FindItem GUICtrlListView_FindNearest GUICtrlListView_FindParam GUICtrlListView_FindText GUICtrlListView_GetBkColor GUICtrlListView_GetBkImage GUICtrlListView_GetCallbackMask GUICtrlListView_GetColumn GUICtrlListView_GetColumnCount GUICtrlListView_GetColumnOrder GUICtrlListView_GetColumnOrderArray GUICtrlListView_GetColumnWidth GUICtrlListView_GetCounterPage GUICtrlListView_GetEditControl GUICtrlListView_GetExtendedListViewStyle GUICtrlListView_GetFocusedGroup GUICtrlListView_GetGroupCount GUICtrlListView_GetGroupInfo GUICtrlListView_GetGroupInfoByIndex GUICtrlListView_GetGroupRect GUICtrlListView_GetGroupViewEnabled GUICtrlListView_GetHeader GUICtrlListView_GetHotCursor GUICtrlListView_GetHotItem GUICtrlListView_GetHoverTime GUICtrlListView_GetImageList GUICtrlListView_GetISearchString GUICtrlListView_GetItem GUICtrlListView_GetItemChecked GUICtrlListView_GetItemCount GUICtrlListView_GetItemCut GUICtrlListView_GetItemDropHilited GUICtrlListView_GetItemEx GUICtrlListView_GetItemFocused GUICtrlListView_GetItemGroupID GUICtrlListView_GetItemImage GUICtrlListView_GetItemIndent GUICtrlListView_GetItemParam GUICtrlListView_GetItemPosition GUICtrlListView_GetItemPositionX GUICtrlListView_GetItemPositionY GUICtrlListView_GetItemRect GUICtrlListView_GetItemRectEx GUICtrlListView_GetItemSelected GUICtrlListView_GetItemSpacing GUICtrlListView_GetItemSpacingX GUICtrlListView_GetItemSpacingY GUICtrlListView_GetItemState GUICtrlListView_GetItemStateImage GUICtrlListView_GetItemText GUICtrlListView_GetItemTextArray GUICtrlListView_GetItemTextString GUICtrlListView_GetNextItem GUICtrlListView_GetNumberOfWorkAreas GUICtrlListView_GetOrigin GUICtrlListView_GetOriginX GUICtrlListView_GetOriginY GUICtrlListView_GetOutlineColor GUICtrlListView_GetSelectedColumn GUICtrlListView_GetSelectedCount GUICtrlListView_GetSelectedIndices GUICtrlListView_GetSelectionMark GUICtrlListView_GetStringWidth GUICtrlListView_GetSubItemRect GUICtrlListView_GetTextBkColor GUICtrlListView_GetTextColor GUICtrlListView_GetToolTips GUICtrlListView_GetTopIndex GUICtrlListView_GetUnicodeFormat GUICtrlListView_GetView GUICtrlListView_GetViewDetails GUICtrlListView_GetViewLarge GUICtrlListView_GetViewList GUICtrlListView_GetViewRect GUICtrlListView_GetViewSmall GUICtrlListView_GetViewTile GUICtrlListView_HideColumn GUICtrlListView_HitTest GUICtrlListView_InsertColumn GUICtrlListView_InsertGroup GUICtrlListView_InsertItem GUICtrlListView_JustifyColumn GUICtrlListView_MapIDToIndex GUICtrlListView_MapIndexToID GUICtrlListView_RedrawItems GUICtrlListView_RegisterSortCallBack GUICtrlListView_RemoveAllGroups GUICtrlListView_RemoveGroup GUICtrlListView_Scroll GUICtrlListView_SetBkColor GUICtrlListView_SetBkImage GUICtrlListView_SetCallBackMask GUICtrlListView_SetColumn GUICtrlListView_SetColumnOrder GUICtrlListView_SetColumnOrderArray GUICtrlListView_SetColumnWidth GUICtrlListView_SetExtendedListViewStyle GUICtrlListView_SetGroupInfo GUICtrlListView_SetHotItem GUICtrlListView_SetHoverTime GUICtrlListView_SetIconSpacing GUICtrlListView_SetImageList GUICtrlListView_SetItem GUICtrlListView_SetItemChecked GUICtrlListView_SetItemCount GUICtrlListView_SetItemCut GUICtrlListView_SetItemDropHilited GUICtrlListView_SetItemEx GUICtrlListView_SetItemFocused GUICtrlListView_SetItemGroupID GUICtrlListView_SetItemImage GUICtrlListView_SetItemIndent GUICtrlListView_SetItemParam GUICtrlListView_SetItemPosition GUICtrlListView_SetItemPosition32 GUICtrlListView_SetItemSelected GUICtrlListView_SetItemState GUICtrlListView_SetItemStateImage GUICtrlListView_SetItemText GUICtrlListView_SetOutlineColor GUICtrlListView_SetSelectedColumn GUICtrlListView_SetSelectionMark GUICtrlListView_SetTextBkColor GUICtrlListView_SetTextColor GUICtrlListView_SetToolTips GUICtrlListView_SetUnicodeFormat GUICtrlListView_SetView GUICtrlListView_SetWorkAreas GUICtrlListView_SimpleSort GUICtrlListView_SortItems GUICtrlListView_SubItemHitTest GUICtrlListView_UnRegisterSortCallBack GUICtrlMenu_AddMenuItem GUICtrlMenu_AppendMenu GUICtrlMenu_CalculatePopupWindowPosition GUICtrlMenu_CheckMenuItem GUICtrlMenu_CheckRadioItem GUICtrlMenu_CreateMenu GUICtrlMenu_CreatePopup GUICtrlMenu_DeleteMenu GUICtrlMenu_DestroyMenu GUICtrlMenu_DrawMenuBar GUICtrlMenu_EnableMenuItem GUICtrlMenu_FindItem GUICtrlMenu_FindParent GUICtrlMenu_GetItemBmp GUICtrlMenu_GetItemBmpChecked GUICtrlMenu_GetItemBmpUnchecked GUICtrlMenu_GetItemChecked GUICtrlMenu_GetItemCount GUICtrlMenu_GetItemData GUICtrlMenu_GetItemDefault GUICtrlMenu_GetItemDisabled GUICtrlMenu_GetItemEnabled GUICtrlMenu_GetItemGrayed GUICtrlMenu_GetItemHighlighted GUICtrlMenu_GetItemID GUICtrlMenu_GetItemInfo GUICtrlMenu_GetItemRect GUICtrlMenu_GetItemRectEx GUICtrlMenu_GetItemState GUICtrlMenu_GetItemStateEx GUICtrlMenu_GetItemSubMenu GUICtrlMenu_GetItemText GUICtrlMenu_GetItemType GUICtrlMenu_GetMenu GUICtrlMenu_GetMenuBackground GUICtrlMenu_GetMenuBarInfo GUICtrlMenu_GetMenuContextHelpID GUICtrlMenu_GetMenuData GUICtrlMenu_GetMenuDefaultItem GUICtrlMenu_GetMenuHeight GUICtrlMenu_GetMenuInfo GUICtrlMenu_GetMenuStyle GUICtrlMenu_GetSystemMenu GUICtrlMenu_InsertMenuItem GUICtrlMenu_InsertMenuItemEx GUICtrlMenu_IsMenu GUICtrlMenu_LoadMenu GUICtrlMenu_MapAccelerator GUICtrlMenu_MenuItemFromPoint GUICtrlMenu_RemoveMenu GUICtrlMenu_SetItemBitmaps GUICtrlMenu_SetItemBmp GUICtrlMenu_SetItemBmpChecked GUICtrlMenu_SetItemBmpUnchecked GUICtrlMenu_SetItemChecked GUICtrlMenu_SetItemData GUICtrlMenu_SetItemDefault GUICtrlMenu_SetItemDisabled GUICtrlMenu_SetItemEnabled GUICtrlMenu_SetItemGrayed GUICtrlMenu_SetItemHighlighted GUICtrlMenu_SetItemID GUICtrlMenu_SetItemInfo GUICtrlMenu_SetItemState GUICtrlMenu_SetItemSubMenu GUICtrlMenu_SetItemText GUICtrlMenu_SetItemType GUICtrlMenu_SetMenu GUICtrlMenu_SetMenuBackground GUICtrlMenu_SetMenuContextHelpID GUICtrlMenu_SetMenuData GUICtrlMenu_SetMenuDefaultItem GUICtrlMenu_SetMenuHeight GUICtrlMenu_SetMenuInfo GUICtrlMenu_SetMenuStyle GUICtrlMenu_TrackPopupMenu GUICtrlMonthCal_Create GUICtrlMonthCal_Destroy GUICtrlMonthCal_GetCalendarBorder GUICtrlMonthCal_GetCalendarCount GUICtrlMonthCal_GetColor GUICtrlMonthCal_GetColorArray GUICtrlMonthCal_GetCurSel GUICtrlMonthCal_GetCurSelStr GUICtrlMonthCal_GetFirstDOW GUICtrlMonthCal_GetFirstDOWStr GUICtrlMonthCal_GetMaxSelCount GUICtrlMonthCal_GetMaxTodayWidth GUICtrlMonthCal_GetMinReqHeight GUICtrlMonthCal_GetMinReqRect GUICtrlMonthCal_GetMinReqRectArray GUICtrlMonthCal_GetMinReqWidth GUICtrlMonthCal_GetMonthDelta GUICtrlMonthCal_GetMonthRange GUICtrlMonthCal_GetMonthRangeMax GUICtrlMonthCal_GetMonthRangeMaxStr GUICtrlMonthCal_GetMonthRangeMin GUICtrlMonthCal_GetMonthRangeMinStr GUICtrlMonthCal_GetMonthRangeSpan GUICtrlMonthCal_GetRange GUICtrlMonthCal_GetRangeMax GUICtrlMonthCal_GetRangeMaxStr GUICtrlMonthCal_GetRangeMin GUICtrlMonthCal_GetRangeMinStr GUICtrlMonthCal_GetSelRange GUICtrlMonthCal_GetSelRangeMax GUICtrlMonthCal_GetSelRangeMaxStr GUICtrlMonthCal_GetSelRangeMin GUICtrlMonthCal_GetSelRangeMinStr GUICtrlMonthCal_GetToday GUICtrlMonthCal_GetTodayStr GUICtrlMonthCal_GetUnicodeFormat GUICtrlMonthCal_HitTest GUICtrlMonthCal_SetCalendarBorder GUICtrlMonthCal_SetColor GUICtrlMonthCal_SetCurSel GUICtrlMonthCal_SetDayState GUICtrlMonthCal_SetFirstDOW GUICtrlMonthCal_SetMaxSelCount GUICtrlMonthCal_SetMonthDelta GUICtrlMonthCal_SetRange GUICtrlMonthCal_SetSelRange GUICtrlMonthCal_SetToday GUICtrlMonthCal_SetUnicodeFormat GUICtrlRebar_AddBand GUICtrlRebar_AddToolBarBand GUICtrlRebar_BeginDrag GUICtrlRebar_Create GUICtrlRebar_DeleteBand GUICtrlRebar_Destroy GUICtrlRebar_DragMove GUICtrlRebar_EndDrag GUICtrlRebar_GetBandBackColor GUICtrlRebar_GetBandBorders GUICtrlRebar_GetBandBordersEx GUICtrlRebar_GetBandChildHandle GUICtrlRebar_GetBandChildSize GUICtrlRebar_GetBandCount GUICtrlRebar_GetBandForeColor GUICtrlRebar_GetBandHeaderSize GUICtrlRebar_GetBandID GUICtrlRebar_GetBandIdealSize GUICtrlRebar_GetBandLength GUICtrlRebar_GetBandLParam GUICtrlRebar_GetBandMargins GUICtrlRebar_GetBandMarginsEx GUICtrlRebar_GetBandRect GUICtrlRebar_GetBandRectEx GUICtrlRebar_GetBandStyle GUICtrlRebar_GetBandStyleBreak GUICtrlRebar_GetBandStyleChildEdge GUICtrlRebar_GetBandStyleFixedBMP GUICtrlRebar_GetBandStyleFixedSize GUICtrlRebar_GetBandStyleGripperAlways GUICtrlRebar_GetBandStyleHidden GUICtrlRebar_GetBandStyleHideTitle GUICtrlRebar_GetBandStyleNoGripper GUICtrlRebar_GetBandStyleTopAlign GUICtrlRebar_GetBandStyleUseChevron GUICtrlRebar_GetBandStyleVariableHeight GUICtrlRebar_GetBandText GUICtrlRebar_GetBarHeight GUICtrlRebar_GetBarInfo GUICtrlRebar_GetBKColor GUICtrlRebar_GetColorScheme GUICtrlRebar_GetRowCount GUICtrlRebar_GetRowHeight GUICtrlRebar_GetTextColor GUICtrlRebar_GetToolTips GUICtrlRebar_GetUnicodeFormat GUICtrlRebar_HitTest GUICtrlRebar_IDToIndex GUICtrlRebar_MaximizeBand GUICtrlRebar_MinimizeBand GUICtrlRebar_MoveBand GUICtrlRebar_SetBandBackColor GUICtrlRebar_SetBandForeColor GUICtrlRebar_SetBandHeaderSize GUICtrlRebar_SetBandID GUICtrlRebar_SetBandIdealSize GUICtrlRebar_SetBandLength GUICtrlRebar_SetBandLParam GUICtrlRebar_SetBandStyle GUICtrlRebar_SetBandStyleBreak GUICtrlRebar_SetBandStyleChildEdge GUICtrlRebar_SetBandStyleFixedBMP GUICtrlRebar_SetBandStyleFixedSize GUICtrlRebar_SetBandStyleGripperAlways GUICtrlRebar_SetBandStyleHidden GUICtrlRebar_SetBandStyleHideTitle GUICtrlRebar_SetBandStyleNoGripper GUICtrlRebar_SetBandStyleTopAlign GUICtrlRebar_SetBandStyleUseChevron GUICtrlRebar_SetBandStyleVariableHeight GUICtrlRebar_SetBandText GUICtrlRebar_SetBarInfo GUICtrlRebar_SetBKColor GUICtrlRebar_SetColorScheme GUICtrlRebar_SetTextColor GUICtrlRebar_SetToolTips GUICtrlRebar_SetUnicodeFormat GUICtrlRebar_ShowBand GUICtrlRichEdit_AppendText GUICtrlRichEdit_AutoDetectURL GUICtrlRichEdit_CanPaste GUICtrlRichEdit_CanPasteSpecial GUICtrlRichEdit_CanRedo GUICtrlRichEdit_CanUndo GUICtrlRichEdit_ChangeFontSize GUICtrlRichEdit_Copy GUICtrlRichEdit_Create GUICtrlRichEdit_Cut GUICtrlRichEdit_Deselect GUICtrlRichEdit_Destroy GUICtrlRichEdit_EmptyUndoBuffer GUICtrlRichEdit_FindText GUICtrlRichEdit_FindTextInRange GUICtrlRichEdit_GetBkColor GUICtrlRichEdit_GetCharAttributes GUICtrlRichEdit_GetCharBkColor GUICtrlRichEdit_GetCharColor GUICtrlRichEdit_GetCharPosFromXY GUICtrlRichEdit_GetCharPosOfNextWord GUICtrlRichEdit_GetCharPosOfPreviousWord GUICtrlRichEdit_GetCharWordBreakInfo GUICtrlRichEdit_GetFirstCharPosOnLine GUICtrlRichEdit_GetFont GUICtrlRichEdit_GetLineCount GUICtrlRichEdit_GetLineLength GUICtrlRichEdit_GetLineNumberFromCharPos GUICtrlRichEdit_GetNextRedo GUICtrlRichEdit_GetNextUndo GUICtrlRichEdit_GetNumberOfFirstVisibleLine GUICtrlRichEdit_GetParaAlignment GUICtrlRichEdit_GetParaAttributes GUICtrlRichEdit_GetParaBorder GUICtrlRichEdit_GetParaIndents GUICtrlRichEdit_GetParaNumbering GUICtrlRichEdit_GetParaShading GUICtrlRichEdit_GetParaSpacing GUICtrlRichEdit_GetParaTabStops GUICtrlRichEdit_GetPasswordChar GUICtrlRichEdit_GetRECT GUICtrlRichEdit_GetScrollPos GUICtrlRichEdit_GetSel GUICtrlRichEdit_GetSelAA GUICtrlRichEdit_GetSelText GUICtrlRichEdit_GetSpaceUnit GUICtrlRichEdit_GetText GUICtrlRichEdit_GetTextInLine GUICtrlRichEdit_GetTextInRange GUICtrlRichEdit_GetTextLength GUICtrlRichEdit_GetVersion GUICtrlRichEdit_GetXYFromCharPos GUICtrlRichEdit_GetZoom GUICtrlRichEdit_GotoCharPos GUICtrlRichEdit_HideSelection GUICtrlRichEdit_InsertText GUICtrlRichEdit_IsModified GUICtrlRichEdit_IsTextSelected GUICtrlRichEdit_Paste GUICtrlRichEdit_PasteSpecial GUICtrlRichEdit_PauseRedraw GUICtrlRichEdit_Redo GUICtrlRichEdit_ReplaceText GUICtrlRichEdit_ResumeRedraw GUICtrlRichEdit_ScrollLineOrPage GUICtrlRichEdit_ScrollLines GUICtrlRichEdit_ScrollToCaret GUICtrlRichEdit_SetBkColor GUICtrlRichEdit_SetCharAttributes GUICtrlRichEdit_SetCharBkColor GUICtrlRichEdit_SetCharColor GUICtrlRichEdit_SetEventMask GUICtrlRichEdit_SetFont GUICtrlRichEdit_SetLimitOnText GUICtrlRichEdit_SetModified GUICtrlRichEdit_SetParaAlignment GUICtrlRichEdit_SetParaAttributes GUICtrlRichEdit_SetParaBorder GUICtrlRichEdit_SetParaIndents GUICtrlRichEdit_SetParaNumbering GUICtrlRichEdit_SetParaShading GUICtrlRichEdit_SetParaSpacing GUICtrlRichEdit_SetParaTabStops GUICtrlRichEdit_SetPasswordChar GUICtrlRichEdit_SetReadOnly GUICtrlRichEdit_SetRECT GUICtrlRichEdit_SetScrollPos GUICtrlRichEdit_SetSel GUICtrlRichEdit_SetSpaceUnit GUICtrlRichEdit_SetTabStops GUICtrlRichEdit_SetText GUICtrlRichEdit_SetUndoLimit GUICtrlRichEdit_SetZoom GUICtrlRichEdit_StreamFromFile GUICtrlRichEdit_StreamFromVar GUICtrlRichEdit_StreamToFile GUICtrlRichEdit_StreamToVar GUICtrlRichEdit_Undo GUICtrlSlider_ClearSel GUICtrlSlider_ClearTics GUICtrlSlider_Create GUICtrlSlider_Destroy GUICtrlSlider_GetBuddy GUICtrlSlider_GetChannelRect GUICtrlSlider_GetChannelRectEx GUICtrlSlider_GetLineSize GUICtrlSlider_GetLogicalTics GUICtrlSlider_GetNumTics GUICtrlSlider_GetPageSize GUICtrlSlider_GetPos GUICtrlSlider_GetRange GUICtrlSlider_GetRangeMax GUICtrlSlider_GetRangeMin GUICtrlSlider_GetSel GUICtrlSlider_GetSelEnd GUICtrlSlider_GetSelStart GUICtrlSlider_GetThumbLength GUICtrlSlider_GetThumbRect GUICtrlSlider_GetThumbRectEx GUICtrlSlider_GetTic GUICtrlSlider_GetTicPos GUICtrlSlider_GetToolTips GUICtrlSlider_GetUnicodeFormat GUICtrlSlider_SetBuddy GUICtrlSlider_SetLineSize GUICtrlSlider_SetPageSize GUICtrlSlider_SetPos GUICtrlSlider_SetRange GUICtrlSlider_SetRangeMax GUICtrlSlider_SetRangeMin GUICtrlSlider_SetSel GUICtrlSlider_SetSelEnd GUICtrlSlider_SetSelStart GUICtrlSlider_SetThumbLength GUICtrlSlider_SetTic GUICtrlSlider_SetTicFreq GUICtrlSlider_SetTipSide GUICtrlSlider_SetToolTips GUICtrlSlider_SetUnicodeFormat GUICtrlStatusBar_Create GUICtrlStatusBar_Destroy GUICtrlStatusBar_EmbedControl GUICtrlStatusBar_GetBorders GUICtrlStatusBar_GetBordersHorz GUICtrlStatusBar_GetBordersRect GUICtrlStatusBar_GetBordersVert GUICtrlStatusBar_GetCount GUICtrlStatusBar_GetHeight GUICtrlStatusBar_GetIcon GUICtrlStatusBar_GetParts GUICtrlStatusBar_GetRect GUICtrlStatusBar_GetRectEx GUICtrlStatusBar_GetText GUICtrlStatusBar_GetTextFlags GUICtrlStatusBar_GetTextLength GUICtrlStatusBar_GetTextLengthEx GUICtrlStatusBar_GetTipText GUICtrlStatusBar_GetUnicodeFormat GUICtrlStatusBar_GetWidth GUICtrlStatusBar_IsSimple GUICtrlStatusBar_Resize GUICtrlStatusBar_SetBkColor GUICtrlStatusBar_SetIcon GUICtrlStatusBar_SetMinHeight GUICtrlStatusBar_SetParts GUICtrlStatusBar_SetSimple GUICtrlStatusBar_SetText GUICtrlStatusBar_SetTipText GUICtrlStatusBar_SetUnicodeFormat GUICtrlStatusBar_ShowHide GUICtrlTab_ActivateTab GUICtrlTab_ClickTab GUICtrlTab_Create GUICtrlTab_DeleteAllItems GUICtrlTab_DeleteItem GUICtrlTab_DeselectAll GUICtrlTab_Destroy GUICtrlTab_FindTab GUICtrlTab_GetCurFocus GUICtrlTab_GetCurSel GUICtrlTab_GetDisplayRect GUICtrlTab_GetDisplayRectEx GUICtrlTab_GetExtendedStyle GUICtrlTab_GetImageList GUICtrlTab_GetItem GUICtrlTab_GetItemCount GUICtrlTab_GetItemImage GUICtrlTab_GetItemParam GUICtrlTab_GetItemRect GUICtrlTab_GetItemRectEx GUICtrlTab_GetItemState GUICtrlTab_GetItemText GUICtrlTab_GetRowCount GUICtrlTab_GetToolTips GUICtrlTab_GetUnicodeFormat GUICtrlTab_HighlightItem GUICtrlTab_HitTest GUICtrlTab_InsertItem GUICtrlTab_RemoveImage GUICtrlTab_SetCurFocus GUICtrlTab_SetCurSel GUICtrlTab_SetExtendedStyle GUICtrlTab_SetImageList GUICtrlTab_SetItem GUICtrlTab_SetItemImage GUICtrlTab_SetItemParam GUICtrlTab_SetItemSize GUICtrlTab_SetItemState GUICtrlTab_SetItemText GUICtrlTab_SetMinTabWidth GUICtrlTab_SetPadding GUICtrlTab_SetToolTips GUICtrlTab_SetUnicodeFormat GUICtrlToolbar_AddBitmap GUICtrlToolbar_AddButton GUICtrlToolbar_AddButtonSep GUICtrlToolbar_AddString GUICtrlToolbar_ButtonCount GUICtrlToolbar_CheckButton GUICtrlToolbar_ClickAccel GUICtrlToolbar_ClickButton GUICtrlToolbar_ClickIndex GUICtrlToolbar_CommandToIndex GUICtrlToolbar_Create GUICtrlToolbar_Customize GUICtrlToolbar_DeleteButton GUICtrlToolbar_Destroy GUICtrlToolbar_EnableButton GUICtrlToolbar_FindToolbar GUICtrlToolbar_GetAnchorHighlight GUICtrlToolbar_GetBitmapFlags GUICtrlToolbar_GetButtonBitmap GUICtrlToolbar_GetButtonInfo GUICtrlToolbar_GetButtonInfoEx GUICtrlToolbar_GetButtonParam GUICtrlToolbar_GetButtonRect GUICtrlToolbar_GetButtonRectEx GUICtrlToolbar_GetButtonSize GUICtrlToolbar_GetButtonState GUICtrlToolbar_GetButtonStyle GUICtrlToolbar_GetButtonText GUICtrlToolbar_GetColorScheme GUICtrlToolbar_GetDisabledImageList GUICtrlToolbar_GetExtendedStyle GUICtrlToolbar_GetHotImageList GUICtrlToolbar_GetHotItem GUICtrlToolbar_GetImageList GUICtrlToolbar_GetInsertMark GUICtrlToolbar_GetInsertMarkColor GUICtrlToolbar_GetMaxSize GUICtrlToolbar_GetMetrics GUICtrlToolbar_GetPadding GUICtrlToolbar_GetRows GUICtrlToolbar_GetString GUICtrlToolbar_GetStyle GUICtrlToolbar_GetStyleAltDrag GUICtrlToolbar_GetStyleCustomErase GUICtrlToolbar_GetStyleFlat GUICtrlToolbar_GetStyleList GUICtrlToolbar_GetStyleRegisterDrop GUICtrlToolbar_GetStyleToolTips GUICtrlToolbar_GetStyleTransparent GUICtrlToolbar_GetStyleWrapable GUICtrlToolbar_GetTextRows GUICtrlToolbar_GetToolTips GUICtrlToolbar_GetUnicodeFormat GUICtrlToolbar_HideButton GUICtrlToolbar_HighlightButton GUICtrlToolbar_HitTest GUICtrlToolbar_IndexToCommand GUICtrlToolbar_InsertButton GUICtrlToolbar_InsertMarkHitTest GUICtrlToolbar_IsButtonChecked GUICtrlToolbar_IsButtonEnabled GUICtrlToolbar_IsButtonHidden GUICtrlToolbar_IsButtonHighlighted GUICtrlToolbar_IsButtonIndeterminate GUICtrlToolbar_IsButtonPressed GUICtrlToolbar_LoadBitmap GUICtrlToolbar_LoadImages GUICtrlToolbar_MapAccelerator GUICtrlToolbar_MoveButton GUICtrlToolbar_PressButton GUICtrlToolbar_SetAnchorHighlight GUICtrlToolbar_SetBitmapSize GUICtrlToolbar_SetButtonBitMap GUICtrlToolbar_SetButtonInfo GUICtrlToolbar_SetButtonInfoEx GUICtrlToolbar_SetButtonParam GUICtrlToolbar_SetButtonSize GUICtrlToolbar_SetButtonState GUICtrlToolbar_SetButtonStyle GUICtrlToolbar_SetButtonText GUICtrlToolbar_SetButtonWidth GUICtrlToolbar_SetCmdID GUICtrlToolbar_SetColorScheme GUICtrlToolbar_SetDisabledImageList GUICtrlToolbar_SetDrawTextFlags GUICtrlToolbar_SetExtendedStyle GUICtrlToolbar_SetHotImageList GUICtrlToolbar_SetHotItem GUICtrlToolbar_SetImageList GUICtrlToolbar_SetIndent GUICtrlToolbar_SetIndeterminate GUICtrlToolbar_SetInsertMark GUICtrlToolbar_SetInsertMarkColor GUICtrlToolbar_SetMaxTextRows GUICtrlToolbar_SetMetrics GUICtrlToolbar_SetPadding GUICtrlToolbar_SetParent GUICtrlToolbar_SetRows GUICtrlToolbar_SetStyle GUICtrlToolbar_SetStyleAltDrag GUICtrlToolbar_SetStyleCustomErase GUICtrlToolbar_SetStyleFlat GUICtrlToolbar_SetStyleList GUICtrlToolbar_SetStyleRegisterDrop GUICtrlToolbar_SetStyleToolTips GUICtrlToolbar_SetStyleTransparent GUICtrlToolbar_SetStyleWrapable GUICtrlToolbar_SetToolTips GUICtrlToolbar_SetUnicodeFormat GUICtrlToolbar_SetWindowTheme GUICtrlTreeView_Add GUICtrlTreeView_AddChild GUICtrlTreeView_AddChildFirst GUICtrlTreeView_AddFirst GUICtrlTreeView_BeginUpdate GUICtrlTreeView_ClickItem GUICtrlTreeView_Create GUICtrlTreeView_CreateDragImage GUICtrlTreeView_CreateSolidBitMap GUICtrlTreeView_Delete GUICtrlTreeView_DeleteAll GUICtrlTreeView_DeleteChildren GUICtrlTreeView_Destroy GUICtrlTreeView_DisplayRect GUICtrlTreeView_DisplayRectEx GUICtrlTreeView_EditText GUICtrlTreeView_EndEdit GUICtrlTreeView_EndUpdate GUICtrlTreeView_EnsureVisible GUICtrlTreeView_Expand GUICtrlTreeView_ExpandedOnce GUICtrlTreeView_FindItem GUICtrlTreeView_FindItemEx GUICtrlTreeView_GetBkColor GUICtrlTreeView_GetBold GUICtrlTreeView_GetChecked GUICtrlTreeView_GetChildCount GUICtrlTreeView_GetChildren GUICtrlTreeView_GetCount GUICtrlTreeView_GetCut GUICtrlTreeView_GetDropTarget GUICtrlTreeView_GetEditControl GUICtrlTreeView_GetExpanded GUICtrlTreeView_GetFirstChild GUICtrlTreeView_GetFirstItem GUICtrlTreeView_GetFirstVisible GUICtrlTreeView_GetFocused GUICtrlTreeView_GetHeight GUICtrlTreeView_GetImageIndex GUICtrlTreeView_GetImageListIconHandle GUICtrlTreeView_GetIndent GUICtrlTreeView_GetInsertMarkColor GUICtrlTreeView_GetISearchString GUICtrlTreeView_GetItemByIndex GUICtrlTreeView_GetItemHandle GUICtrlTreeView_GetItemParam GUICtrlTreeView_GetLastChild GUICtrlTreeView_GetLineColor GUICtrlTreeView_GetNext GUICtrlTreeView_GetNextChild GUICtrlTreeView_GetNextSibling GUICtrlTreeView_GetNextVisible GUICtrlTreeView_GetNormalImageList GUICtrlTreeView_GetParentHandle GUICtrlTreeView_GetParentParam GUICtrlTreeView_GetPrev GUICtrlTreeView_GetPrevChild GUICtrlTreeView_GetPrevSibling GUICtrlTreeView_GetPrevVisible GUICtrlTreeView_GetScrollTime GUICtrlTreeView_GetSelected GUICtrlTreeView_GetSelectedImageIndex GUICtrlTreeView_GetSelection GUICtrlTreeView_GetSiblingCount GUICtrlTreeView_GetState GUICtrlTreeView_GetStateImageIndex GUICtrlTreeView_GetStateImageList GUICtrlTreeView_GetText GUICtrlTreeView_GetTextColor GUICtrlTreeView_GetToolTips GUICtrlTreeView_GetTree GUICtrlTreeView_GetUnicodeFormat GUICtrlTreeView_GetVisible GUICtrlTreeView_GetVisibleCount GUICtrlTreeView_HitTest GUICtrlTreeView_HitTestEx GUICtrlTreeView_HitTestItem GUICtrlTreeView_Index GUICtrlTreeView_InsertItem GUICtrlTreeView_IsFirstItem GUICtrlTreeView_IsParent GUICtrlTreeView_Level GUICtrlTreeView_SelectItem GUICtrlTreeView_SelectItemByIndex GUICtrlTreeView_SetBkColor GUICtrlTreeView_SetBold GUICtrlTreeView_SetChecked GUICtrlTreeView_SetCheckedByIndex GUICtrlTreeView_SetChildren GUICtrlTreeView_SetCut GUICtrlTreeView_SetDropTarget GUICtrlTreeView_SetFocused GUICtrlTreeView_SetHeight GUICtrlTreeView_SetIcon GUICtrlTreeView_SetImageIndex GUICtrlTreeView_SetIndent GUICtrlTreeView_SetInsertMark GUICtrlTreeView_SetInsertMarkColor GUICtrlTreeView_SetItemHeight GUICtrlTreeView_SetItemParam GUICtrlTreeView_SetLineColor GUICtrlTreeView_SetNormalImageList GUICtrlTreeView_SetScrollTime GUICtrlTreeView_SetSelected GUICtrlTreeView_SetSelectedImageIndex GUICtrlTreeView_SetState GUICtrlTreeView_SetStateImageIndex GUICtrlTreeView_SetStateImageList GUICtrlTreeView_SetText GUICtrlTreeView_SetTextColor GUICtrlTreeView_SetToolTips GUICtrlTreeView_SetUnicodeFormat GUICtrlTreeView_Sort GUIImageList_Add GUIImageList_AddBitmap GUIImageList_AddIcon GUIImageList_AddMasked GUIImageList_BeginDrag GUIImageList_Copy GUIImageList_Create GUIImageList_Destroy GUIImageList_DestroyIcon GUIImageList_DragEnter GUIImageList_DragLeave GUIImageList_DragMove GUIImageList_Draw GUIImageList_DrawEx GUIImageList_Duplicate GUIImageList_EndDrag GUIImageList_GetBkColor GUIImageList_GetIcon GUIImageList_GetIconHeight GUIImageList_GetIconSize GUIImageList_GetIconSizeEx GUIImageList_GetIconWidth GUIImageList_GetImageCount GUIImageList_GetImageInfoEx GUIImageList_Remove GUIImageList_ReplaceIcon GUIImageList_SetBkColor GUIImageList_SetIconSize GUIImageList_SetImageCount GUIImageList_Swap GUIScrollBars_EnableScrollBar GUIScrollBars_GetScrollBarInfoEx GUIScrollBars_GetScrollBarRect GUIScrollBars_GetScrollBarRGState GUIScrollBars_GetScrollBarXYLineButton GUIScrollBars_GetScrollBarXYThumbBottom GUIScrollBars_GetScrollBarXYThumbTop GUIScrollBars_GetScrollInfo GUIScrollBars_GetScrollInfoEx GUIScrollBars_GetScrollInfoMax GUIScrollBars_GetScrollInfoMin GUIScrollBars_GetScrollInfoPage GUIScrollBars_GetScrollInfoPos GUIScrollBars_GetScrollInfoTrackPos GUIScrollBars_GetScrollPos GUIScrollBars_GetScrollRange GUIScrollBars_Init GUIScrollBars_ScrollWindow GUIScrollBars_SetScrollInfo GUIScrollBars_SetScrollInfoMax GUIScrollBars_SetScrollInfoMin GUIScrollBars_SetScrollInfoPage GUIScrollBars_SetScrollInfoPos GUIScrollBars_SetScrollRange GUIScrollBars_ShowScrollBar GUIToolTip_Activate GUIToolTip_AddTool GUIToolTip_AdjustRect GUIToolTip_BitsToTTF GUIToolTip_Create GUIToolTip_Deactivate GUIToolTip_DelTool GUIToolTip_Destroy GUIToolTip_EnumTools GUIToolTip_GetBubbleHeight GUIToolTip_GetBubbleSize GUIToolTip_GetBubbleWidth GUIToolTip_GetCurrentTool GUIToolTip_GetDelayTime GUIToolTip_GetMargin GUIToolTip_GetMarginEx GUIToolTip_GetMaxTipWidth GUIToolTip_GetText GUIToolTip_GetTipBkColor GUIToolTip_GetTipTextColor GUIToolTip_GetTitleBitMap GUIToolTip_GetTitleText GUIToolTip_GetToolCount GUIToolTip_GetToolInfo GUIToolTip_HitTest GUIToolTip_NewToolRect GUIToolTip_Pop GUIToolTip_PopUp GUIToolTip_SetDelayTime GUIToolTip_SetMargin GUIToolTip_SetMaxTipWidth GUIToolTip_SetTipBkColor GUIToolTip_SetTipTextColor GUIToolTip_SetTitle GUIToolTip_SetToolInfo GUIToolTip_SetWindowTheme GUIToolTip_ToolExists GUIToolTip_ToolToArray GUIToolTip_TrackActivate GUIToolTip_TrackPosition GUIToolTip_Update GUIToolTip_UpdateTipText HexToString IEAction IEAttach IEBodyReadHTML IEBodyReadText IEBodyWriteHTML IECreate IECreateEmbedded IEDocGetObj IEDocInsertHTML IEDocInsertText IEDocReadHTML IEDocWriteHTML IEErrorNotify IEFormElementCheckBoxSelect IEFormElementGetCollection IEFormElementGetObjByName IEFormElementGetValue IEFormElementOptionSelect IEFormElementRadioSelect IEFormElementSetValue IEFormGetCollection IEFormGetObjByName IEFormImageClick IEFormReset IEFormSubmit IEFrameGetCollection IEFrameGetObjByName IEGetObjById IEGetObjByName IEHeadInsertEventScript IEImgClick IEImgGetCollection IEIsFrameSet IELinkClickByIndex IELinkClickByText IELinkGetCollection IELoadWait IELoadWaitTimeout IENavigate IEPropertyGet IEPropertySet IEQuit IETableGetCollection IETableWriteToArray IETagNameAllGetCollection IETagNameGetCollection IE_Example IE_Introduction IE_VersionInfo INetExplorerCapable INetGetSource INetMail INetSmtpMail IsPressed MathCheckDiv Max MemGlobalAlloc MemGlobalFree MemGlobalLock MemGlobalSize MemGlobalUnlock MemMoveMemory MemVirtualAlloc MemVirtualAllocEx MemVirtualFree MemVirtualFreeEx Min MouseTrap NamedPipes_CallNamedPipe NamedPipes_ConnectNamedPipe NamedPipes_CreateNamedPipe NamedPipes_CreatePipe NamedPipes_DisconnectNamedPipe NamedPipes_GetNamedPipeHandleState NamedPipes_GetNamedPipeInfo NamedPipes_PeekNamedPipe NamedPipes_SetNamedPipeHandleState NamedPipes_TransactNamedPipe NamedPipes_WaitNamedPipe Net_Share_ConnectionEnum Net_Share_FileClose Net_Share_FileEnum Net_Share_FileGetInfo Net_Share_PermStr Net_Share_ResourceStr Net_Share_SessionDel Net_Share_SessionEnum Net_Share_SessionGetInfo Net_Share_ShareAdd Net_Share_ShareCheck Net_Share_ShareDel Net_Share_ShareEnum Net_Share_ShareGetInfo Net_Share_ShareSetInfo Net_Share_StatisticsGetSvr Net_Share_StatisticsGetWrk Now NowCalc NowCalcDate NowDate NowTime PathFull PathGetRelative PathMake PathSplit ProcessGetName ProcessGetPriority Radian ReplaceStringInFile RunDos ScreenCapture_Capture ScreenCapture_CaptureWnd ScreenCapture_SaveImage ScreenCapture_SetBMPFormat ScreenCapture_SetJPGQuality ScreenCapture_SetTIFColorDepth ScreenCapture_SetTIFCompression Security__AdjustTokenPrivileges Security__CreateProcessWithToken Security__DuplicateTokenEx Security__GetAccountSid Security__GetLengthSid Security__GetTokenInformation Security__ImpersonateSelf Security__IsValidSid Security__LookupAccountName Security__LookupAccountSid Security__LookupPrivilegeValue Security__OpenProcessToken Security__OpenThreadToken Security__OpenThreadTokenEx Security__SetPrivilege Security__SetTokenInformation Security__SidToStringSid Security__SidTypeStr Security__StringSidToSid SendMessage SendMessageA SetDate SetTime Singleton SoundClose SoundLength SoundOpen SoundPause SoundPlay SoundPos SoundResume SoundSeek SoundStatus SoundStop SQLite_Changes SQLite_Close SQLite_Display2DResult SQLite_Encode SQLite_ErrCode SQLite_ErrMsg SQLite_Escape SQLite_Exec SQLite_FastEncode SQLite_FastEscape SQLite_FetchData SQLite_FetchNames SQLite_GetTable SQLite_GetTable2d SQLite_LastInsertRowID SQLite_LibVersion SQLite_Open SQLite_Query SQLite_QueryFinalize SQLite_QueryReset SQLite_QuerySingleRow SQLite_SafeMode SQLite_SetTimeout SQLite_Shutdown SQLite_SQLiteExe SQLite_Startup SQLite_TotalChanges StringBetween StringExplode StringInsert StringProper StringRepeat StringTitleCase StringToHex TCPIpToName TempFile TicksToTime Timer_Diff Timer_GetIdleTime Timer_GetTimerID Timer_Init Timer_KillAllTimers Timer_KillTimer Timer_SetTimer TimeToTicks VersionCompare viClose viExecCommand viFindGpib viGpibBusReset viGTL viInteractiveControl viOpen viSetAttribute viSetTimeout WeekNumberISO WinAPI_AbortPath WinAPI_ActivateKeyboardLayout WinAPI_AddClipboardFormatListener WinAPI_AddFontMemResourceEx WinAPI_AddFontResourceEx WinAPI_AddIconOverlay WinAPI_AddIconTransparency WinAPI_AddMRUString WinAPI_AdjustBitmap WinAPI_AdjustTokenPrivileges WinAPI_AdjustWindowRectEx WinAPI_AlphaBlend WinAPI_AngleArc WinAPI_AnimateWindow WinAPI_Arc WinAPI_ArcTo WinAPI_ArrayToStruct WinAPI_AssignProcessToJobObject WinAPI_AssocGetPerceivedType WinAPI_AssocQueryString WinAPI_AttachConsole WinAPI_AttachThreadInput WinAPI_BackupRead WinAPI_BackupReadAbort WinAPI_BackupSeek WinAPI_BackupWrite WinAPI_BackupWriteAbort WinAPI_Beep WinAPI_BeginBufferedPaint WinAPI_BeginDeferWindowPos WinAPI_BeginPaint WinAPI_BeginPath WinAPI_BeginUpdateResource WinAPI_BitBlt WinAPI_BringWindowToTop WinAPI_BroadcastSystemMessage WinAPI_BrowseForFolderDlg WinAPI_BufferedPaintClear WinAPI_BufferedPaintInit WinAPI_BufferedPaintSetAlpha WinAPI_BufferedPaintUnInit WinAPI_CallNextHookEx WinAPI_CallWindowProc WinAPI_CallWindowProcW WinAPI_CascadeWindows WinAPI_ChangeWindowMessageFilterEx WinAPI_CharToOem WinAPI_ChildWindowFromPointEx WinAPI_ClientToScreen WinAPI_ClipCursor WinAPI_CloseDesktop WinAPI_CloseEnhMetaFile WinAPI_CloseFigure WinAPI_CloseHandle WinAPI_CloseThemeData WinAPI_CloseWindow WinAPI_CloseWindowStation WinAPI_CLSIDFromProgID WinAPI_CoInitialize WinAPI_ColorAdjustLuma WinAPI_ColorHLSToRGB WinAPI_ColorRGBToHLS WinAPI_CombineRgn WinAPI_CombineTransform WinAPI_CommandLineToArgv WinAPI_CommDlgExtendedError WinAPI_CommDlgExtendedErrorEx WinAPI_CompareString WinAPI_CompressBitmapBits WinAPI_CompressBuffer WinAPI_ComputeCrc32 WinAPI_ConfirmCredentials WinAPI_CopyBitmap WinAPI_CopyCursor WinAPI_CopyEnhMetaFile WinAPI_CopyFileEx WinAPI_CopyIcon WinAPI_CopyImage WinAPI_CopyRect WinAPI_CopyStruct WinAPI_CoTaskMemAlloc WinAPI_CoTaskMemFree WinAPI_CoTaskMemRealloc WinAPI_CoUninitialize WinAPI_Create32BitHBITMAP WinAPI_Create32BitHICON WinAPI_CreateANDBitmap WinAPI_CreateBitmap WinAPI_CreateBitmapIndirect WinAPI_CreateBrushIndirect WinAPI_CreateBuffer WinAPI_CreateBufferFromStruct WinAPI_CreateCaret WinAPI_CreateColorAdjustment WinAPI_CreateCompatibleBitmap WinAPI_CreateCompatibleBitmapEx WinAPI_CreateCompatibleDC WinAPI_CreateDesktop WinAPI_CreateDIB WinAPI_CreateDIBColorTable WinAPI_CreateDIBitmap WinAPI_CreateDIBSection WinAPI_CreateDirectory WinAPI_CreateDirectoryEx WinAPI_CreateEllipticRgn WinAPI_CreateEmptyIcon WinAPI_CreateEnhMetaFile WinAPI_CreateEvent WinAPI_CreateFile WinAPI_CreateFileEx WinAPI_CreateFileMapping WinAPI_CreateFont WinAPI_CreateFontEx WinAPI_CreateFontIndirect WinAPI_CreateGUID WinAPI_CreateHardLink WinAPI_CreateIcon WinAPI_CreateIconFromResourceEx WinAPI_CreateIconIndirect WinAPI_CreateJobObject WinAPI_CreateMargins WinAPI_CreateMRUList WinAPI_CreateMutex WinAPI_CreateNullRgn WinAPI_CreateNumberFormatInfo WinAPI_CreateObjectID WinAPI_CreatePen WinAPI_CreatePoint WinAPI_CreatePolygonRgn WinAPI_CreateProcess WinAPI_CreateProcessWithToken WinAPI_CreateRect WinAPI_CreateRectEx WinAPI_CreateRectRgn WinAPI_CreateRectRgnIndirect WinAPI_CreateRoundRectRgn WinAPI_CreateSemaphore WinAPI_CreateSize WinAPI_CreateSolidBitmap WinAPI_CreateSolidBrush WinAPI_CreateStreamOnHGlobal WinAPI_CreateString WinAPI_CreateSymbolicLink WinAPI_CreateTransform WinAPI_CreateWindowEx WinAPI_CreateWindowStation WinAPI_DecompressBuffer WinAPI_DecryptFile WinAPI_DeferWindowPos WinAPI_DefineDosDevice WinAPI_DefRawInputProc WinAPI_DefSubclassProc WinAPI_DefWindowProc WinAPI_DefWindowProcW WinAPI_DeleteDC WinAPI_DeleteEnhMetaFile WinAPI_DeleteFile WinAPI_DeleteObject WinAPI_DeleteObjectID WinAPI_DeleteVolumeMountPoint WinAPI_DeregisterShellHookWindow WinAPI_DestroyCaret WinAPI_DestroyCursor WinAPI_DestroyIcon WinAPI_DestroyWindow WinAPI_DeviceIoControl WinAPI_DisplayStruct WinAPI_DllGetVersion WinAPI_DllInstall WinAPI_DllUninstall WinAPI_DPtoLP WinAPI_DragAcceptFiles WinAPI_DragFinish WinAPI_DragQueryFileEx WinAPI_DragQueryPoint WinAPI_DrawAnimatedRects WinAPI_DrawBitmap WinAPI_DrawEdge WinAPI_DrawFocusRect WinAPI_DrawFrameControl WinAPI_DrawIcon WinAPI_DrawIconEx WinAPI_DrawLine WinAPI_DrawShadowText WinAPI_DrawText WinAPI_DrawThemeBackground WinAPI_DrawThemeEdge WinAPI_DrawThemeIcon WinAPI_DrawThemeParentBackground WinAPI_DrawThemeText WinAPI_DrawThemeTextEx WinAPI_DuplicateEncryptionInfoFile WinAPI_DuplicateHandle WinAPI_DuplicateTokenEx WinAPI_DwmDefWindowProc WinAPI_DwmEnableBlurBehindWindow WinAPI_DwmEnableComposition WinAPI_DwmExtendFrameIntoClientArea WinAPI_DwmGetColorizationColor WinAPI_DwmGetColorizationParameters WinAPI_DwmGetWindowAttribute WinAPI_DwmInvalidateIconicBitmaps WinAPI_DwmIsCompositionEnabled WinAPI_DwmQueryThumbnailSourceSize WinAPI_DwmRegisterThumbnail WinAPI_DwmSetColorizationParameters WinAPI_DwmSetIconicLivePreviewBitmap WinAPI_DwmSetIconicThumbnail WinAPI_DwmSetWindowAttribute WinAPI_DwmUnregisterThumbnail WinAPI_DwmUpdateThumbnailProperties WinAPI_DWordToFloat WinAPI_DWordToInt WinAPI_EjectMedia WinAPI_Ellipse WinAPI_EmptyWorkingSet WinAPI_EnableWindow WinAPI_EncryptFile WinAPI_EncryptionDisable WinAPI_EndBufferedPaint WinAPI_EndDeferWindowPos WinAPI_EndPaint WinAPI_EndPath WinAPI_EndUpdateResource WinAPI_EnumChildProcess WinAPI_EnumChildWindows WinAPI_EnumDesktops WinAPI_EnumDesktopWindows WinAPI_EnumDeviceDrivers WinAPI_EnumDisplayDevices WinAPI_EnumDisplayMonitors WinAPI_EnumDisplaySettings WinAPI_EnumDllProc WinAPI_EnumFiles WinAPI_EnumFileStreams WinAPI_EnumFontFamilies WinAPI_EnumHardLinks WinAPI_EnumMRUList WinAPI_EnumPageFiles WinAPI_EnumProcessHandles WinAPI_EnumProcessModules WinAPI_EnumProcessThreads WinAPI_EnumProcessWindows WinAPI_EnumRawInputDevices WinAPI_EnumResourceLanguages WinAPI_EnumResourceNames WinAPI_EnumResourceTypes WinAPI_EnumSystemGeoID WinAPI_EnumSystemLocales WinAPI_EnumUILanguages WinAPI_EnumWindows WinAPI_EnumWindowsPopup WinAPI_EnumWindowStations WinAPI_EnumWindowsTop WinAPI_EqualMemory WinAPI_EqualRect WinAPI_EqualRgn WinAPI_ExcludeClipRect WinAPI_ExpandEnvironmentStrings WinAPI_ExtCreatePen WinAPI_ExtCreateRegion WinAPI_ExtFloodFill WinAPI_ExtractIcon WinAPI_ExtractIconEx WinAPI_ExtSelectClipRgn WinAPI_FatalAppExit WinAPI_FatalExit WinAPI_FileEncryptionStatus WinAPI_FileExists WinAPI_FileIconInit WinAPI_FileInUse WinAPI_FillMemory WinAPI_FillPath WinAPI_FillRect WinAPI_FillRgn WinAPI_FindClose WinAPI_FindCloseChangeNotification WinAPI_FindExecutable WinAPI_FindFirstChangeNotification WinAPI_FindFirstFile WinAPI_FindFirstFileName WinAPI_FindFirstStream WinAPI_FindNextChangeNotification WinAPI_FindNextFile WinAPI_FindNextFileName WinAPI_FindNextStream WinAPI_FindResource WinAPI_FindResourceEx WinAPI_FindTextDlg WinAPI_FindWindow WinAPI_FlashWindow WinAPI_FlashWindowEx WinAPI_FlattenPath WinAPI_FloatToDWord WinAPI_FloatToInt WinAPI_FlushFileBuffers WinAPI_FlushFRBuffer WinAPI_FlushViewOfFile WinAPI_FormatDriveDlg WinAPI_FormatMessage WinAPI_FrameRect WinAPI_FrameRgn WinAPI_FreeLibrary WinAPI_FreeMemory WinAPI_FreeMRUList WinAPI_FreeResource WinAPI_GdiComment WinAPI_GetActiveWindow WinAPI_GetAllUsersProfileDirectory WinAPI_GetAncestor WinAPI_GetApplicationRestartSettings WinAPI_GetArcDirection WinAPI_GetAsyncKeyState WinAPI_GetBinaryType WinAPI_GetBitmapBits WinAPI_GetBitmapDimension WinAPI_GetBitmapDimensionEx WinAPI_GetBkColor WinAPI_GetBkMode WinAPI_GetBoundsRect WinAPI_GetBrushOrg WinAPI_GetBufferedPaintBits WinAPI_GetBufferedPaintDC WinAPI_GetBufferedPaintTargetDC WinAPI_GetBufferedPaintTargetRect WinAPI_GetBValue WinAPI_GetCaretBlinkTime WinAPI_GetCaretPos WinAPI_GetCDType WinAPI_GetClassInfoEx WinAPI_GetClassLongEx WinAPI_GetClassName WinAPI_GetClientHeight WinAPI_GetClientRect WinAPI_GetClientWidth WinAPI_GetClipboardSequenceNumber WinAPI_GetClipBox WinAPI_GetClipCursor WinAPI_GetClipRgn WinAPI_GetColorAdjustment WinAPI_GetCompressedFileSize WinAPI_GetCompression WinAPI_GetConnectedDlg WinAPI_GetCurrentDirectory WinAPI_GetCurrentHwProfile WinAPI_GetCurrentObject WinAPI_GetCurrentPosition WinAPI_GetCurrentProcess WinAPI_GetCurrentProcessExplicitAppUserModelID WinAPI_GetCurrentProcessID WinAPI_GetCurrentThemeName WinAPI_GetCurrentThread WinAPI_GetCurrentThreadId WinAPI_GetCursor WinAPI_GetCursorInfo WinAPI_GetDateFormat WinAPI_GetDC WinAPI_GetDCEx WinAPI_GetDefaultPrinter WinAPI_GetDefaultUserProfileDirectory WinAPI_GetDesktopWindow WinAPI_GetDeviceCaps WinAPI_GetDeviceDriverBaseName WinAPI_GetDeviceDriverFileName WinAPI_GetDeviceGammaRamp WinAPI_GetDIBColorTable WinAPI_GetDIBits WinAPI_GetDiskFreeSpaceEx WinAPI_GetDlgCtrlID WinAPI_GetDlgItem WinAPI_GetDllDirectory WinAPI_GetDriveBusType WinAPI_GetDriveGeometryEx WinAPI_GetDriveNumber WinAPI_GetDriveType WinAPI_GetDurationFormat WinAPI_GetEffectiveClientRect WinAPI_GetEnhMetaFile WinAPI_GetEnhMetaFileBits WinAPI_GetEnhMetaFileDescription WinAPI_GetEnhMetaFileDimension WinAPI_GetEnhMetaFileHeader WinAPI_GetErrorMessage WinAPI_GetErrorMode WinAPI_GetExitCodeProcess WinAPI_GetExtended WinAPI_GetFileAttributes WinAPI_GetFileID WinAPI_GetFileInformationByHandle WinAPI_GetFileInformationByHandleEx WinAPI_GetFilePointerEx WinAPI_GetFileSizeEx WinAPI_GetFileSizeOnDisk WinAPI_GetFileTitle WinAPI_GetFileType WinAPI_GetFileVersionInfo WinAPI_GetFinalPathNameByHandle WinAPI_GetFinalPathNameByHandleEx WinAPI_GetFocus WinAPI_GetFontMemoryResourceInfo WinAPI_GetFontName WinAPI_GetFontResourceInfo WinAPI_GetForegroundWindow WinAPI_GetFRBuffer WinAPI_GetFullPathName WinAPI_GetGeoInfo WinAPI_GetGlyphOutline WinAPI_GetGraphicsMode WinAPI_GetGuiResources WinAPI_GetGUIThreadInfo WinAPI_GetGValue WinAPI_GetHandleInformation WinAPI_GetHGlobalFromStream WinAPI_GetIconDimension WinAPI_GetIconInfo WinAPI_GetIconInfoEx WinAPI_GetIdleTime WinAPI_GetKeyboardLayout WinAPI_GetKeyboardLayoutList WinAPI_GetKeyboardState WinAPI_GetKeyboardType WinAPI_GetKeyNameText WinAPI_GetKeyState WinAPI_GetLastActivePopup WinAPI_GetLastError WinAPI_GetLastErrorMessage WinAPI_GetLayeredWindowAttributes WinAPI_GetLocaleInfo WinAPI_GetLogicalDrives WinAPI_GetMapMode WinAPI_GetMemorySize WinAPI_GetMessageExtraInfo WinAPI_GetModuleFileNameEx WinAPI_GetModuleHandle WinAPI_GetModuleHandleEx WinAPI_GetModuleInformation WinAPI_GetMonitorInfo WinAPI_GetMousePos WinAPI_GetMousePosX WinAPI_GetMousePosY WinAPI_GetMUILanguage WinAPI_GetNumberFormat WinAPI_GetObject WinAPI_GetObjectID WinAPI_GetObjectInfoByHandle WinAPI_GetObjectNameByHandle WinAPI_GetObjectType WinAPI_GetOpenFileName WinAPI_GetOutlineTextMetrics WinAPI_GetOverlappedResult WinAPI_GetParent WinAPI_GetParentProcess WinAPI_GetPerformanceInfo WinAPI_GetPEType WinAPI_GetPhysicallyInstalledSystemMemory WinAPI_GetPixel WinAPI_GetPolyFillMode WinAPI_GetPosFromRect WinAPI_GetPriorityClass WinAPI_GetProcAddress WinAPI_GetProcessAffinityMask WinAPI_GetProcessCommandLine WinAPI_GetProcessFileName WinAPI_GetProcessHandleCount WinAPI_GetProcessID WinAPI_GetProcessIoCounters WinAPI_GetProcessMemoryInfo WinAPI_GetProcessName WinAPI_GetProcessShutdownParameters WinAPI_GetProcessTimes WinAPI_GetProcessUser WinAPI_GetProcessWindowStation WinAPI_GetProcessWorkingDirectory WinAPI_GetProfilesDirectory WinAPI_GetPwrCapabilities WinAPI_GetRawInputBuffer WinAPI_GetRawInputBufferLength WinAPI_GetRawInputData WinAPI_GetRawInputDeviceInfo WinAPI_GetRegionData WinAPI_GetRegisteredRawInputDevices WinAPI_GetRegKeyNameByHandle WinAPI_GetRgnBox WinAPI_GetROP2 WinAPI_GetRValue WinAPI_GetSaveFileName WinAPI_GetShellWindow WinAPI_GetStartupInfo WinAPI_GetStdHandle WinAPI_GetStockObject WinAPI_GetStretchBltMode WinAPI_GetString WinAPI_GetSysColor WinAPI_GetSysColorBrush WinAPI_GetSystemDefaultLangID WinAPI_GetSystemDefaultLCID WinAPI_GetSystemDefaultUILanguage WinAPI_GetSystemDEPPolicy WinAPI_GetSystemInfo WinAPI_GetSystemMetrics WinAPI_GetSystemPowerStatus WinAPI_GetSystemTimes WinAPI_GetSystemWow64Directory WinAPI_GetTabbedTextExtent WinAPI_GetTempFileName WinAPI_GetTextAlign WinAPI_GetTextCharacterExtra WinAPI_GetTextColor WinAPI_GetTextExtentPoint32 WinAPI_GetTextFace WinAPI_GetTextMetrics WinAPI_GetThemeAppProperties WinAPI_GetThemeBackgroundContentRect WinAPI_GetThemeBackgroundExtent WinAPI_GetThemeBackgroundRegion WinAPI_GetThemeBitmap WinAPI_GetThemeBool WinAPI_GetThemeColor WinAPI_GetThemeDocumentationProperty WinAPI_GetThemeEnumValue WinAPI_GetThemeFilename WinAPI_GetThemeFont WinAPI_GetThemeInt WinAPI_GetThemeMargins WinAPI_GetThemeMetric WinAPI_GetThemePartSize WinAPI_GetThemePosition WinAPI_GetThemePropertyOrigin WinAPI_GetThemeRect WinAPI_GetThemeString WinAPI_GetThemeSysBool WinAPI_GetThemeSysColor WinAPI_GetThemeSysColorBrush WinAPI_GetThemeSysFont WinAPI_GetThemeSysInt WinAPI_GetThemeSysSize WinAPI_GetThemeSysString WinAPI_GetThemeTextExtent WinAPI_GetThemeTextMetrics WinAPI_GetThemeTransitionDuration WinAPI_GetThreadDesktop WinAPI_GetThreadErrorMode WinAPI_GetThreadLocale WinAPI_GetThreadUILanguage WinAPI_GetTickCount WinAPI_GetTickCount64 WinAPI_GetTimeFormat WinAPI_GetTopWindow WinAPI_GetUDFColorMode WinAPI_GetUpdateRect WinAPI_GetUpdateRgn WinAPI_GetUserDefaultLangID WinAPI_GetUserDefaultLCID WinAPI_GetUserDefaultUILanguage WinAPI_GetUserGeoID WinAPI_GetUserObjectInformation WinAPI_GetVersion WinAPI_GetVersionEx WinAPI_GetVolumeInformation WinAPI_GetVolumeInformationByHandle WinAPI_GetVolumeNameForVolumeMountPoint WinAPI_GetWindow WinAPI_GetWindowDC WinAPI_GetWindowDisplayAffinity WinAPI_GetWindowExt WinAPI_GetWindowFileName WinAPI_GetWindowHeight WinAPI_GetWindowInfo WinAPI_GetWindowLong WinAPI_GetWindowOrg WinAPI_GetWindowPlacement WinAPI_GetWindowRect WinAPI_GetWindowRgn WinAPI_GetWindowRgnBox WinAPI_GetWindowSubclass WinAPI_GetWindowText WinAPI_GetWindowTheme WinAPI_GetWindowThreadProcessId WinAPI_GetWindowWidth WinAPI_GetWorkArea WinAPI_GetWorldTransform WinAPI_GetXYFromPoint WinAPI_GlobalMemoryStatus WinAPI_GradientFill WinAPI_GUIDFromString WinAPI_GUIDFromStringEx WinAPI_HashData WinAPI_HashString WinAPI_HiByte WinAPI_HideCaret WinAPI_HiDWord WinAPI_HiWord WinAPI_InflateRect WinAPI_InitMUILanguage WinAPI_InProcess WinAPI_IntersectClipRect WinAPI_IntersectRect WinAPI_IntToDWord WinAPI_IntToFloat WinAPI_InvalidateRect WinAPI_InvalidateRgn WinAPI_InvertANDBitmap WinAPI_InvertColor WinAPI_InvertRect WinAPI_InvertRgn WinAPI_IOCTL WinAPI_IsAlphaBitmap WinAPI_IsBadCodePtr WinAPI_IsBadReadPtr WinAPI_IsBadStringPtr WinAPI_IsBadWritePtr WinAPI_IsChild WinAPI_IsClassName WinAPI_IsDoorOpen WinAPI_IsElevated WinAPI_IsHungAppWindow WinAPI_IsIconic WinAPI_IsInternetConnected WinAPI_IsLoadKBLayout WinAPI_IsMemory WinAPI_IsNameInExpression WinAPI_IsNetworkAlive WinAPI_IsPathShared WinAPI_IsProcessInJob WinAPI_IsProcessorFeaturePresent WinAPI_IsRectEmpty WinAPI_IsThemeActive WinAPI_IsThemeBackgroundPartiallyTransparent WinAPI_IsThemePartDefined WinAPI_IsValidLocale WinAPI_IsWindow WinAPI_IsWindowEnabled WinAPI_IsWindowUnicode WinAPI_IsWindowVisible WinAPI_IsWow64Process WinAPI_IsWritable WinAPI_IsZoomed WinAPI_Keybd_Event WinAPI_KillTimer WinAPI_LineDDA WinAPI_LineTo WinAPI_LoadBitmap WinAPI_LoadCursor WinAPI_LoadCursorFromFile WinAPI_LoadIcon WinAPI_LoadIconMetric WinAPI_LoadIconWithScaleDown WinAPI_LoadImage WinAPI_LoadIndirectString WinAPI_LoadKeyboardLayout WinAPI_LoadLibrary WinAPI_LoadLibraryEx WinAPI_LoadMedia WinAPI_LoadResource WinAPI_LoadShell32Icon WinAPI_LoadString WinAPI_LoadStringEx WinAPI_LoByte WinAPI_LocalFree WinAPI_LockDevice WinAPI_LockFile WinAPI_LockResource WinAPI_LockWindowUpdate WinAPI_LockWorkStation WinAPI_LoDWord WinAPI_LongMid WinAPI_LookupIconIdFromDirectoryEx WinAPI_LoWord WinAPI_LPtoDP WinAPI_MAKELANGID WinAPI_MAKELCID WinAPI_MakeLong WinAPI_MakeQWord WinAPI_MakeWord WinAPI_MapViewOfFile WinAPI_MapVirtualKey WinAPI_MaskBlt WinAPI_MessageBeep WinAPI_MessageBoxCheck WinAPI_MessageBoxIndirect WinAPI_MirrorIcon WinAPI_ModifyWorldTransform WinAPI_MonitorFromPoint WinAPI_MonitorFromRect WinAPI_MonitorFromWindow WinAPI_Mouse_Event WinAPI_MoveFileEx WinAPI_MoveMemory WinAPI_MoveTo WinAPI_MoveToEx WinAPI_MoveWindow WinAPI_MsgBox WinAPI_MulDiv WinAPI_MultiByteToWideChar WinAPI_MultiByteToWideCharEx WinAPI_NtStatusToDosError WinAPI_OemToChar WinAPI_OffsetClipRgn WinAPI_OffsetPoints WinAPI_OffsetRect WinAPI_OffsetRgn WinAPI_OffsetWindowOrg WinAPI_OpenDesktop WinAPI_OpenFileById WinAPI_OpenFileDlg WinAPI_OpenFileMapping WinAPI_OpenIcon WinAPI_OpenInputDesktop WinAPI_OpenJobObject WinAPI_OpenMutex WinAPI_OpenProcess WinAPI_OpenProcessToken WinAPI_OpenSemaphore WinAPI_OpenThemeData WinAPI_OpenWindowStation WinAPI_PageSetupDlg WinAPI_PaintDesktop WinAPI_PaintRgn WinAPI_ParseURL WinAPI_ParseUserName WinAPI_PatBlt WinAPI_PathAddBackslash WinAPI_PathAddExtension WinAPI_PathAppend WinAPI_PathBuildRoot WinAPI_PathCanonicalize WinAPI_PathCommonPrefix WinAPI_PathCompactPath WinAPI_PathCompactPathEx WinAPI_PathCreateFromUrl WinAPI_PathFindExtension WinAPI_PathFindFileName WinAPI_PathFindNextComponent WinAPI_PathFindOnPath WinAPI_PathGetArgs WinAPI_PathGetCharType WinAPI_PathGetDriveNumber WinAPI_PathIsContentType WinAPI_PathIsDirectory WinAPI_PathIsDirectoryEmpty WinAPI_PathIsExe WinAPI_PathIsFileSpec WinAPI_PathIsLFNFileSpec WinAPI_PathIsRelative WinAPI_PathIsRoot WinAPI_PathIsSameRoot WinAPI_PathIsSystemFolder WinAPI_PathIsUNC WinAPI_PathIsUNCServer WinAPI_PathIsUNCServerShare WinAPI_PathMakeSystemFolder WinAPI_PathMatchSpec WinAPI_PathParseIconLocation WinAPI_PathRelativePathTo WinAPI_PathRemoveArgs WinAPI_PathRemoveBackslash WinAPI_PathRemoveExtension WinAPI_PathRemoveFileSpec WinAPI_PathRenameExtension WinAPI_PathSearchAndQualify WinAPI_PathSkipRoot WinAPI_PathStripPath WinAPI_PathStripToRoot WinAPI_PathToRegion WinAPI_PathUndecorate WinAPI_PathUnExpandEnvStrings WinAPI_PathUnmakeSystemFolder WinAPI_PathUnquoteSpaces WinAPI_PathYetAnotherMakeUniqueName WinAPI_PickIconDlg WinAPI_PlayEnhMetaFile WinAPI_PlaySound WinAPI_PlgBlt WinAPI_PointFromRect WinAPI_PolyBezier WinAPI_PolyBezierTo WinAPI_PolyDraw WinAPI_Polygon WinAPI_PostMessage WinAPI_PrimaryLangId WinAPI_PrintDlg WinAPI_PrintDlgEx WinAPI_PrintWindow WinAPI_ProgIDFromCLSID WinAPI_PtInRect WinAPI_PtInRectEx WinAPI_PtInRegion WinAPI_PtVisible WinAPI_QueryDosDevice WinAPI_QueryInformationJobObject WinAPI_QueryPerformanceCounter WinAPI_QueryPerformanceFrequency WinAPI_RadialGradientFill WinAPI_ReadDirectoryChanges WinAPI_ReadFile WinAPI_ReadProcessMemory WinAPI_Rectangle WinAPI_RectInRegion WinAPI_RectIsEmpty WinAPI_RectVisible WinAPI_RedrawWindow WinAPI_RegCloseKey WinAPI_RegConnectRegistry WinAPI_RegCopyTree WinAPI_RegCopyTreeEx WinAPI_RegCreateKey WinAPI_RegDeleteEmptyKey WinAPI_RegDeleteKey WinAPI_RegDeleteKeyValue WinAPI_RegDeleteTree WinAPI_RegDeleteTreeEx WinAPI_RegDeleteValue WinAPI_RegDisableReflectionKey WinAPI_RegDuplicateHKey WinAPI_RegEnableReflectionKey WinAPI_RegEnumKey WinAPI_RegEnumValue WinAPI_RegFlushKey WinAPI_RegisterApplicationRestart WinAPI_RegisterClass WinAPI_RegisterClassEx WinAPI_RegisterHotKey WinAPI_RegisterPowerSettingNotification WinAPI_RegisterRawInputDevices WinAPI_RegisterShellHookWindow WinAPI_RegisterWindowMessage WinAPI_RegLoadMUIString WinAPI_RegNotifyChangeKeyValue WinAPI_RegOpenKey WinAPI_RegQueryInfoKey WinAPI_RegQueryLastWriteTime WinAPI_RegQueryMultipleValues WinAPI_RegQueryReflectionKey WinAPI_RegQueryValue WinAPI_RegRestoreKey WinAPI_RegSaveKey WinAPI_RegSetValue WinAPI_ReleaseCapture WinAPI_ReleaseDC WinAPI_ReleaseMutex WinAPI_ReleaseSemaphore WinAPI_ReleaseStream WinAPI_RemoveClipboardFormatListener WinAPI_RemoveDirectory WinAPI_RemoveFontMemResourceEx WinAPI_RemoveFontResourceEx WinAPI_RemoveWindowSubclass WinAPI_ReOpenFile WinAPI_ReplaceFile WinAPI_ReplaceTextDlg WinAPI_ResetEvent WinAPI_RestartDlg WinAPI_RestoreDC WinAPI_RGB WinAPI_RotatePoints WinAPI_RoundRect WinAPI_SaveDC WinAPI_SaveFileDlg WinAPI_SaveHBITMAPToFile WinAPI_SaveHICONToFile WinAPI_ScaleWindowExt WinAPI_ScreenToClient WinAPI_SearchPath WinAPI_SelectClipPath WinAPI_SelectClipRgn WinAPI_SelectObject WinAPI_SendMessageTimeout WinAPI_SetActiveWindow WinAPI_SetArcDirection WinAPI_SetBitmapBits WinAPI_SetBitmapDimensionEx WinAPI_SetBkColor WinAPI_SetBkMode WinAPI_SetBoundsRect WinAPI_SetBrushOrg WinAPI_SetCapture WinAPI_SetCaretBlinkTime WinAPI_SetCaretPos WinAPI_SetClassLongEx WinAPI_SetColorAdjustment WinAPI_SetCompression WinAPI_SetCurrentDirectory WinAPI_SetCurrentProcessExplicitAppUserModelID WinAPI_SetCursor WinAPI_SetDCBrushColor WinAPI_SetDCPenColor WinAPI_SetDefaultPrinter WinAPI_SetDeviceGammaRamp WinAPI_SetDIBColorTable WinAPI_SetDIBits WinAPI_SetDIBitsToDevice WinAPI_SetDllDirectory WinAPI_SetEndOfFile WinAPI_SetEnhMetaFileBits WinAPI_SetErrorMode WinAPI_SetEvent WinAPI_SetFileAttributes WinAPI_SetFileInformationByHandleEx WinAPI_SetFilePointer WinAPI_SetFilePointerEx WinAPI_SetFileShortName WinAPI_SetFileValidData WinAPI_SetFocus WinAPI_SetFont WinAPI_SetForegroundWindow WinAPI_SetFRBuffer WinAPI_SetGraphicsMode WinAPI_SetHandleInformation WinAPI_SetInformationJobObject WinAPI_SetKeyboardLayout WinAPI_SetKeyboardState WinAPI_SetLastError WinAPI_SetLayeredWindowAttributes WinAPI_SetLocaleInfo WinAPI_SetMapMode WinAPI_SetMessageExtraInfo WinAPI_SetParent WinAPI_SetPixel WinAPI_SetPolyFillMode WinAPI_SetPriorityClass WinAPI_SetProcessAffinityMask WinAPI_SetProcessShutdownParameters WinAPI_SetProcessWindowStation WinAPI_SetRectRgn WinAPI_SetROP2 WinAPI_SetSearchPathMode WinAPI_SetStretchBltMode WinAPI_SetSysColors WinAPI_SetSystemCursor WinAPI_SetTextAlign WinAPI_SetTextCharacterExtra WinAPI_SetTextColor WinAPI_SetTextJustification WinAPI_SetThemeAppProperties WinAPI_SetThreadDesktop WinAPI_SetThreadErrorMode WinAPI_SetThreadExecutionState WinAPI_SetThreadLocale WinAPI_SetThreadUILanguage WinAPI_SetTimer WinAPI_SetUDFColorMode WinAPI_SetUserGeoID WinAPI_SetUserObjectInformation WinAPI_SetVolumeMountPoint WinAPI_SetWindowDisplayAffinity WinAPI_SetWindowExt WinAPI_SetWindowLong WinAPI_SetWindowOrg WinAPI_SetWindowPlacement WinAPI_SetWindowPos WinAPI_SetWindowRgn WinAPI_SetWindowsHookEx WinAPI_SetWindowSubclass WinAPI_SetWindowText WinAPI_SetWindowTheme WinAPI_SetWinEventHook WinAPI_SetWorldTransform WinAPI_SfcIsFileProtected WinAPI_SfcIsKeyProtected WinAPI_ShellAboutDlg WinAPI_ShellAddToRecentDocs WinAPI_ShellChangeNotify WinAPI_ShellChangeNotifyDeregister WinAPI_ShellChangeNotifyRegister WinAPI_ShellCreateDirectory WinAPI_ShellEmptyRecycleBin WinAPI_ShellExecute WinAPI_ShellExecuteEx WinAPI_ShellExtractAssociatedIcon WinAPI_ShellExtractIcon WinAPI_ShellFileOperation WinAPI_ShellFlushSFCache WinAPI_ShellGetFileInfo WinAPI_ShellGetIconOverlayIndex WinAPI_ShellGetImageList WinAPI_ShellGetKnownFolderIDList WinAPI_ShellGetKnownFolderPath WinAPI_ShellGetLocalizedName WinAPI_ShellGetPathFromIDList WinAPI_ShellGetSetFolderCustomSettings WinAPI_ShellGetSettings WinAPI_ShellGetSpecialFolderLocation WinAPI_ShellGetSpecialFolderPath WinAPI_ShellGetStockIconInfo WinAPI_ShellILCreateFromPath WinAPI_ShellNotifyIcon WinAPI_ShellNotifyIconGetRect WinAPI_ShellObjectProperties WinAPI_ShellOpenFolderAndSelectItems WinAPI_ShellOpenWithDlg WinAPI_ShellQueryRecycleBin WinAPI_ShellQueryUserNotificationState WinAPI_ShellRemoveLocalizedName WinAPI_ShellRestricted WinAPI_ShellSetKnownFolderPath WinAPI_ShellSetLocalizedName WinAPI_ShellSetSettings WinAPI_ShellStartNetConnectionDlg WinAPI_ShellUpdateImage WinAPI_ShellUserAuthenticationDlg WinAPI_ShellUserAuthenticationDlgEx WinAPI_ShortToWord WinAPI_ShowCaret WinAPI_ShowCursor WinAPI_ShowError WinAPI_ShowLastError WinAPI_ShowMsg WinAPI_ShowOwnedPopups WinAPI_ShowWindow WinAPI_ShutdownBlockReasonCreate WinAPI_ShutdownBlockReasonDestroy WinAPI_ShutdownBlockReasonQuery WinAPI_SizeOfResource WinAPI_StretchBlt WinAPI_StretchDIBits WinAPI_StrFormatByteSize WinAPI_StrFormatByteSizeEx WinAPI_StrFormatKBSize WinAPI_StrFromTimeInterval WinAPI_StringFromGUID WinAPI_StringLenA WinAPI_StringLenW WinAPI_StrLen WinAPI_StrokeAndFillPath WinAPI_StrokePath WinAPI_StructToArray WinAPI_SubLangId WinAPI_SubtractRect WinAPI_SwapDWord WinAPI_SwapQWord WinAPI_SwapWord WinAPI_SwitchColor WinAPI_SwitchDesktop WinAPI_SwitchToThisWindow WinAPI_SystemParametersInfo WinAPI_TabbedTextOut WinAPI_TerminateJobObject WinAPI_TerminateProcess WinAPI_TextOut WinAPI_TileWindows WinAPI_TrackMouseEvent WinAPI_TransparentBlt WinAPI_TwipsPerPixelX WinAPI_TwipsPerPixelY WinAPI_UnhookWindowsHookEx WinAPI_UnhookWinEvent WinAPI_UnionRect WinAPI_UnionStruct WinAPI_UniqueHardwareID WinAPI_UnloadKeyboardLayout WinAPI_UnlockFile WinAPI_UnmapViewOfFile WinAPI_UnregisterApplicationRestart WinAPI_UnregisterClass WinAPI_UnregisterHotKey WinAPI_UnregisterPowerSettingNotification WinAPI_UpdateLayeredWindow WinAPI_UpdateLayeredWindowEx WinAPI_UpdateLayeredWindowIndirect WinAPI_UpdateResource WinAPI_UpdateWindow WinAPI_UrlApplyScheme WinAPI_UrlCanonicalize WinAPI_UrlCombine WinAPI_UrlCompare WinAPI_UrlCreateFromPath WinAPI_UrlFixup WinAPI_UrlGetPart WinAPI_UrlHash WinAPI_UrlIs WinAPI_UserHandleGrantAccess WinAPI_ValidateRect WinAPI_ValidateRgn WinAPI_VerQueryRoot WinAPI_VerQueryValue WinAPI_VerQueryValueEx WinAPI_WaitForInputIdle WinAPI_WaitForMultipleObjects WinAPI_WaitForSingleObject WinAPI_WideCharToMultiByte WinAPI_WidenPath WinAPI_WindowFromDC WinAPI_WindowFromPoint WinAPI_WordToShort WinAPI_Wow64EnableWow64FsRedirection WinAPI_WriteConsole WinAPI_WriteFile WinAPI_WriteProcessMemory WinAPI_ZeroMemory WinNet_AddConnection WinNet_AddConnection2 WinNet_AddConnection3 WinNet_CancelConnection WinNet_CancelConnection2 WinNet_CloseEnum WinNet_ConnectionDialog WinNet_ConnectionDialog1 WinNet_DisconnectDialog WinNet_DisconnectDialog1 WinNet_EnumResource WinNet_GetConnection WinNet_GetConnectionPerformance WinNet_GetLastError WinNet_GetNetworkInformation WinNet_GetProviderName WinNet_GetResourceInformation WinNet_GetResourceParent WinNet_GetUniversalName WinNet_GetUser WinNet_OpenEnum WinNet_RestoreConnection WinNet_UseConnection Word_Create Word_DocAdd Word_DocAttach Word_DocClose Word_DocExport Word_DocFind Word_DocFindReplace Word_DocGet Word_DocLinkAdd Word_DocLinkGet Word_DocOpen Word_DocPictureAdd Word_DocPrint Word_DocRangeSet Word_DocSave Word_DocSaveAs Word_DocTableRead Word_DocTableWrite Word_Quit",e={ +variants:[a.COMMENT(";","$",{relevance:0}),a.COMMENT("#cs","#ce"),a.COMMENT("#comments-start","#comments-end")]},f={className:"variable",begin:"\\$[A-z0-9_]+"},g={className:"string",variants:[{begin:/"/,end:/"/,contains:[{begin:/""/,relevance:0}]},{begin:/'/,end:/'/,contains:[{begin:/''/,relevance:0}]}]},h={variants:[a.BINARY_NUMBER_MODE,a.C_NUMBER_MODE]},i={className:"preprocessor",begin:"#",end:"$",keywords:"include include-once NoTrayIcon OnAutoItStartRegister RequireAdmin pragma Au3Stripper_Ignore_Funcs Au3Stripper_Ignore_Variables Au3Stripper_Off Au3Stripper_On Au3Stripper_Parameters AutoIt3Wrapper_Add_Constants AutoIt3Wrapper_Au3Check_Parameters AutoIt3Wrapper_Au3Check_Stop_OnWarning AutoIt3Wrapper_Aut2Exe AutoIt3Wrapper_AutoIt3 AutoIt3Wrapper_AutoIt3Dir AutoIt3Wrapper_Change2CUI AutoIt3Wrapper_Compile_Both AutoIt3Wrapper_Compression AutoIt3Wrapper_EndIf AutoIt3Wrapper_Icon AutoIt3Wrapper_If_Compile AutoIt3Wrapper_If_Run AutoIt3Wrapper_Jump_To_First_Error AutoIt3Wrapper_OutFile AutoIt3Wrapper_OutFile_Type AutoIt3Wrapper_OutFile_X64 AutoIt3Wrapper_PlugIn_Funcs AutoIt3Wrapper_Res_Comment Autoit3Wrapper_Res_Compatibility AutoIt3Wrapper_Res_Description AutoIt3Wrapper_Res_Field AutoIt3Wrapper_Res_File_Add AutoIt3Wrapper_Res_FileVersion AutoIt3Wrapper_Res_FileVersion_AutoIncrement AutoIt3Wrapper_Res_Icon_Add AutoIt3Wrapper_Res_Language AutoIt3Wrapper_Res_LegalCopyright AutoIt3Wrapper_Res_ProductVersion AutoIt3Wrapper_Res_requestedExecutionLevel AutoIt3Wrapper_Res_SaveSource AutoIt3Wrapper_Run_After AutoIt3Wrapper_Run_Au3Check AutoIt3Wrapper_Run_Au3Stripper AutoIt3Wrapper_Run_Before AutoIt3Wrapper_Run_Debug_Mode AutoIt3Wrapper_Run_SciTE_Minimized AutoIt3Wrapper_Run_SciTE_OutputPane_Minimized AutoIt3Wrapper_Run_Tidy AutoIt3Wrapper_ShowProgress AutoIt3Wrapper_Testing AutoIt3Wrapper_Tidy_Stop_OnError AutoIt3Wrapper_UPX_Parameters AutoIt3Wrapper_UseUPX AutoIt3Wrapper_UseX64 AutoIt3Wrapper_Version AutoIt3Wrapper_Versioning AutoIt3Wrapper_Versioning_Parameters Tidy_Off Tidy_On Tidy_Parameters EndRegion Region",contains:[{begin:/\\\n/,relevance:0},{beginKeywords:"include",end:"$",contains:[g,{className:"string",variants:[{begin:"<",end:">"},{begin:/"/,end:/"/,contains:[{begin:/""/,relevance:0}]},{begin:/'/,end:/'/,contains:[{begin:/''/,relevance:0}]}]}]},g,e]},j={className:"constant",begin:"@[A-z0-9_]+"},k={className:"function",beginKeywords:"Func",end:"$",excludeEnd:!0,illegal:"\\$|\\[|%",contains:[a.UNDERSCORE_TITLE_MODE,{className:"params",begin:"\\(",end:"\\)",contains:[f,g,h]}]};return{case_insensitive:!0,illegal:/\/\*/,keywords:{keyword:b,built_in:d,literal:c},contains:[e,f,g,h,i,j,k]}}),a.registerLanguage("avrasm",function(a){return{case_insensitive:!0,lexemes:"\\.?"+a.IDENT_RE,keywords:{keyword:"adc add adiw and andi asr bclr bld brbc brbs brcc brcs break breq brge brhc brhs brid brie brlo brlt brmi brne brpl brsh brtc brts brvc brvs bset bst call cbi cbr clc clh cli cln clr cls clt clv clz com cp cpc cpi cpse dec eicall eijmp elpm eor fmul fmuls fmulsu icall ijmp in inc jmp ld ldd ldi lds lpm lsl lsr mov movw mul muls mulsu neg nop or ori out pop push rcall ret reti rjmp rol ror sbc sbr sbrc sbrs sec seh sbi sbci sbic sbis sbiw sei sen ser ses set sev sez sleep spm st std sts sub subi swap tst wdr",built_in:"r0 r1 r2 r3 r4 r5 r6 r7 r8 r9 r10 r11 r12 r13 r14 r15 r16 r17 r18 r19 r20 r21 r22 r23 r24 r25 r26 r27 r28 r29 r30 r31 x|0 xh xl y|0 yh yl z|0 zh zl ucsr1c udr1 ucsr1a ucsr1b ubrr1l ubrr1h ucsr0c ubrr0h tccr3c tccr3a tccr3b tcnt3h tcnt3l ocr3ah ocr3al ocr3bh ocr3bl ocr3ch ocr3cl icr3h icr3l etimsk etifr tccr1c ocr1ch ocr1cl twcr twdr twar twsr twbr osccal xmcra xmcrb eicra spmcsr spmcr portg ddrg ping portf ddrf sreg sph spl xdiv rampz eicrb eimsk gimsk gicr eifr gifr timsk tifr mcucr mcucsr tccr0 tcnt0 ocr0 assr tccr1a tccr1b tcnt1h tcnt1l ocr1ah ocr1al ocr1bh ocr1bl icr1h icr1l tccr2 tcnt2 ocr2 ocdr wdtcr sfior eearh eearl eedr eecr porta ddra pina portb ddrb pinb portc ddrc pinc portd ddrd pind spdr spsr spcr udr0 ucsr0a ucsr0b ubrr0l acsr admux adcsr adch adcl porte ddre pine pinf",preprocessor:".byte .cseg .db .def .device .dseg .dw .endmacro .equ .eseg .exit .include .list .listmac .macro .nolist .org .set"},contains:[a.C_BLOCK_COMMENT_MODE,a.COMMENT(";","$",{relevance:0}),a.C_NUMBER_MODE,a.BINARY_NUMBER_MODE,{className:"number",begin:"\\b(\\$[a-zA-Z0-9]+|0o[0-7]+)"},a.QUOTE_STRING_MODE,{className:"string",begin:"'",end:"[^\\\\]'",illegal:"[^\\\\][^']"},{className:"label",begin:"^[A-Za-z0-9_.$]+:"},{className:"preprocessor",begin:"#",end:"$"},{className:"localvars",begin:"@[0-9]+"}]}}),a.registerLanguage("axapta",function(a){return{keywords:"false int abstract private char boolean static null if for true while long throw finally protected final return void enum else break new catch byte super case short default double public try this switch continue reverse firstfast firstonly forupdate nofetch sum avg minof maxof count order group by asc desc index hint like dispaly edit client server ttsbegin ttscommit str real date container anytype common div mod",contains:[a.C_LINE_COMMENT_MODE,a.C_BLOCK_COMMENT_MODE,a.APOS_STRING_MODE,a.QUOTE_STRING_MODE,a.C_NUMBER_MODE,{className:"preprocessor",begin:"#",end:"$"},{className:"class",beginKeywords:"class interface",end:"{",excludeEnd:!0,illegal:":",contains:[{beginKeywords:"extends implements"},a.UNDERSCORE_TITLE_MODE]}]}}),a.registerLanguage("bash",function(a){var b={className:"variable",variants:[{begin:/\$[\w\d#@][\w\d_]*/},{begin:/\$\{(.*?)}/}]},c={className:"string",begin:/"/,end:/"/,contains:[a.BACKSLASH_ESCAPE,b,{className:"variable",begin:/\$\(/,end:/\)/,contains:[a.BACKSLASH_ESCAPE]}]},d={className:"string",begin:/'/,end:/'/};return{aliases:["sh","zsh"],lexemes:/-?[a-z\.]+/,keywords:{keyword:"if then else elif fi for while in do done case esac function",literal:"true false",built_in:"break cd continue eval exec exit export getopts hash pwd readonly return shift test times trap umask unset alias bind builtin caller command declare echo enable help let local logout mapfile printf read readarray source type typeset ulimit unalias set shopt autoload bg bindkey bye cap chdir clone comparguments compcall compctl compdescribe compfiles compgroups compquote comptags comptry compvalues dirs disable disown echotc echoti emulate fc fg float functions getcap getln history integer jobs kill limit log noglob popd print pushd pushln rehash sched setcap setopt stat suspend ttyctl unfunction unhash unlimit unsetopt vared wait whence where which zcompile zformat zftp zle zmodload zparseopts zprof zpty zregexparse zsocket zstyle ztcp",operator:"-ne -eq -lt -gt -f -d -e -s -l -a"},contains:[{className:"shebang",begin:/^#![^\n]+sh\s*$/,relevance:10},{className:"function",begin:/\w[\w\d_]*\s*\(\s*\)\s*\{/,returnBegin:!0,contains:[a.inherit(a.TITLE_MODE,{begin:/\w[\w\d_]*/})],relevance:0},a.HASH_COMMENT_MODE,a.NUMBER_MODE,c,d,b]}}),a.registerLanguage("brainfuck",function(a){var b={className:"literal",begin:"[\\+\\-]",relevance:0};return{aliases:["bf"],contains:[a.COMMENT("[^\\[\\]\\.,\\+\\-<> \r\n]","[\\[\\]\\.,\\+\\-<> \r\n]",{returnEnd:!0,relevance:0}),{className:"title",begin:"[\\[\\]]",relevance:0},{className:"string",begin:"[\\.,]",relevance:0},{begin:/\+\+|\-\-/,returnBegin:!0,contains:[b]},b]}}),a.registerLanguage("cal",function(a){var b="div mod in and or not xor asserterror begin case do downto else end exit for if of repeat then to until while with var",c="false true",d=[a.C_LINE_COMMENT_MODE,a.COMMENT(/\{/,/\}/,{relevance:0}),a.COMMENT(/\(\*/,/\*\)/,{relevance:10})],e={className:"string",begin:/'/,end:/'/,contains:[{begin:/''/}]},f={className:"string",begin:/(#\d+)+/},g={className:"date",begin:"\\b\\d+(\\.\\d+)?(DT|D|T)",relevance:0},h={className:"variable",begin:'"',end:'"'},i={className:"function",beginKeywords:"procedure",end:/[:;]/,keywords:"procedure|10",contains:[a.TITLE_MODE,{className:"params",begin:/\(/,end:/\)/,keywords:b,contains:[e,f]}].concat(d)},j={className:"class",begin:"OBJECT (Table|Form|Report|Dataport|Codeunit|XMLport|MenuSuite|Page|Query) (\\d+) ([^\\r\\n]+)",returnBegin:!0,contains:[a.TITLE_MODE,i]};return{case_insensitive:!0,keywords:{keyword:b,literal:c},illegal:/\/\*/,contains:[e,f,g,h,a.NUMBER_MODE,j,i]}}),a.registerLanguage("capnproto",function(a){return{aliases:["capnp"],keywords:{keyword:"struct enum interface union group import using const annotation extends in of on as with from fixed",built_in:"Void Bool Int8 Int16 Int32 Int64 UInt8 UInt16 UInt32 UInt64 Float32 Float64 Text Data AnyPointer AnyStruct Capability List",literal:"true false"},contains:[a.QUOTE_STRING_MODE,a.NUMBER_MODE,a.HASH_COMMENT_MODE,{className:"shebang",begin:/@0x[\w\d]{16};/,illegal:/\n/},{className:"number",begin:/@\d+\b/},{className:"class",beginKeywords:"struct enum",end:/\{/,illegal:/\n/,contains:[a.inherit(a.TITLE_MODE,{starts:{endsWithParent:!0,excludeEnd:!0}})]},{className:"class",beginKeywords:"interface",end:/\{/,illegal:/\n/,contains:[a.inherit(a.TITLE_MODE,{starts:{endsWithParent:!0,excludeEnd:!0}})]}]}}),a.registerLanguage("ceylon",function(a){var b="assembly module package import alias class interface object given value assign void function new of extends satisfies abstracts in out return break continue throw assert dynamic if else switch case for while try catch finally then let this outer super is exists nonempty",c="shared abstract formal default actual variable late native deprecatedfinal sealed annotation suppressWarnings small",d="doc by license see throws tagged",e=c+" "+d,f={className:"subst",excludeBegin:!0,excludeEnd:!0,begin:/``/,end:/``/,keywords:b,relevance:10},g=[{className:"string",begin:'"""',end:'"""',relevance:10},{className:"string",begin:'"',end:'"',contains:[f]},{className:"string",begin:"'",end:"'"},{className:"number",begin:"#[0-9a-fA-F_]+|\\$[01_]+|[0-9_]+(?:\\.[0-9_](?:[eE][+-]?\\d+)?)?[kMGTPmunpf]?",relevance:0}];return f.contains=g,{keywords:{keyword:b,annotation:e},illegal:"\\$[^01]|#[^0-9a-fA-F]",contains:[a.C_LINE_COMMENT_MODE,a.COMMENT("/\\*","\\*/",{contains:["self"]}),{className:"annotation",begin:'@[a-z]\\w*(?:\\:"[^"]*")?'}].concat(g)}}),a.registerLanguage("clojure",function(a){var b={built_in:"def defonce cond apply if-not if-let if not not= = < > <= >= == + / * - rem quot neg? pos? delay? symbol? keyword? true? false? integer? empty? coll? list? set? ifn? fn? associative? sequential? sorted? counted? reversible? number? decimal? class? distinct? isa? float? rational? reduced? ratio? odd? even? char? seq? vector? string? map? nil? contains? zero? instance? not-every? not-any? libspec? -> ->> .. . inc compare do dotimes mapcat take remove take-while drop letfn drop-last take-last drop-while while intern condp case reduced cycle split-at split-with repeat replicate iterate range merge zipmap declare line-seq sort comparator sort-by dorun doall nthnext nthrest partition eval doseq await await-for let agent atom send send-off release-pending-sends add-watch mapv filterv remove-watch agent-error restart-agent set-error-handler error-handler set-error-mode! error-mode shutdown-agents quote var fn loop recur throw try monitor-enter monitor-exit defmacro defn defn- macroexpand macroexpand-1 for dosync and or when when-not when-let comp juxt partial sequence memoize constantly complement identity assert peek pop doto proxy defstruct first rest cons defprotocol cast coll deftype defrecord last butlast sigs reify second ffirst fnext nfirst nnext defmulti defmethod meta with-meta ns in-ns create-ns import refer keys select-keys vals key val rseq name namespace promise into transient persistent! conj! assoc! dissoc! pop! disj! use class type num float double short byte boolean bigint biginteger bigdec print-method print-dup throw-if printf format load compile get-in update-in pr pr-on newline flush read slurp read-line subvec with-open memfn time re-find re-groups rand-int rand mod locking assert-valid-fdecl alias resolve ref deref refset swap! reset! set-validator! compare-and-set! alter-meta! reset-meta! commute get-validator alter ref-set ref-history-count ref-min-history ref-max-history ensure sync io! new next conj set! to-array future future-call into-array aset gen-class reduce map filter find empty hash-map hash-set sorted-map sorted-map-by sorted-set sorted-set-by vec vector seq flatten reverse assoc dissoc list disj get union difference intersection extend extend-type extend-protocol int nth delay count concat chunk chunk-buffer chunk-append chunk-first chunk-rest max min dec unchecked-inc-int unchecked-inc unchecked-dec-inc unchecked-dec unchecked-negate unchecked-add-int unchecked-add unchecked-subtract-int unchecked-subtract chunk-next chunk-cons chunked-seq? prn vary-meta lazy-seq spread list* str find-keyword keyword symbol gensym force rationalize"},c="a-zA-Z_\\-!.?+*=<>&#'",d="["+c+"]["+c+"0-9/;:]*",e="[-+]?\\d+(\\.\\d+)?",f={begin:d,relevance:0},g={className:"number",begin:e,relevance:0},h=a.inherit(a.QUOTE_STRING_MODE,{illegal:null}),i=a.COMMENT(";","$",{relevance:0}),j={className:"literal",begin:/\b(true|false|nil)\b/},k={className:"collection",begin:"[\\[\\{]",end:"[\\]\\}]"},l={className:"comment",begin:"\\^"+d},m=a.COMMENT("\\^\\{","\\}"),n={className:"attribute",begin:"[:]"+d},o={className:"list",begin:"\\(",end:"\\)"},p={endsWithParent:!0,relevance:0},q={keywords:b,lexemes:d,className:"keyword",begin:d,starts:p},r=[o,h,l,m,i,n,k,g,j,f];return o.contains=[a.COMMENT("comment",""),q,p],p.contains=r,k.contains=r,{aliases:["clj"],illegal:/\S/,contains:[o,h,l,m,i,n,k,g,j]}}),a.registerLanguage("clojure-repl",function(a){return{contains:[{className:"prompt",begin:/^([\w.-]+|\s*#_)=>/,starts:{end:/$/,subLanguage:"clojure"}}]}}),a.registerLanguage("cmake",function(a){return{aliases:["cmake.in"],case_insensitive:!0,keywords:{keyword:"add_custom_command add_custom_target add_definitions add_dependencies add_executable add_library add_subdirectory add_test aux_source_directory break build_command cmake_minimum_required cmake_policy configure_file create_test_sourcelist define_property else elseif enable_language enable_testing endforeach endfunction endif endmacro endwhile execute_process export find_file find_library find_package find_path find_program fltk_wrap_ui foreach function get_cmake_property get_directory_property get_filename_component get_property get_source_file_property get_target_property get_test_property if include include_directories include_external_msproject include_regular_expression install link_directories load_cache load_command macro mark_as_advanced message option output_required_files project qt_wrap_cpp qt_wrap_ui remove_definitions return separate_arguments set set_directory_properties set_property set_source_files_properties set_target_properties set_tests_properties site_name source_group string target_link_libraries try_compile try_run unset variable_watch while build_name exec_program export_library_dependencies install_files install_programs install_targets link_libraries make_directory remove subdir_depends subdirs use_mangled_mesa utility_source variable_requires write_file qt5_use_modules qt5_use_package qt5_wrap_cpp on off true false and or",operator:"equal less greater strless strgreater strequal matches"},contains:[{className:"envvar",begin:"\\${",end:"}"},a.HASH_COMMENT_MODE,a.QUOTE_STRING_MODE,a.NUMBER_MODE]}}),a.registerLanguage("coffeescript",function(a){var b={keyword:"in if for while finally new do return else break catch instanceof throw try this switch continue typeof delete debugger super then unless until loop of by when and or is isnt not",literal:"true false null undefined yes no on off",built_in:"npm require console print module global window document"},c="[A-Za-z$_][0-9A-Za-z$_]*",d={className:"subst",begin:/#\{/,end:/}/,keywords:b},e=[a.BINARY_NUMBER_MODE,a.inherit(a.C_NUMBER_MODE,{starts:{end:"(\\s*/)?",relevance:0}}),{className:"string",variants:[{begin:/'''/,end:/'''/,contains:[a.BACKSLASH_ESCAPE]},{begin:/'/,end:/'/,contains:[a.BACKSLASH_ESCAPE]},{begin:/"""/,end:/"""/,contains:[a.BACKSLASH_ESCAPE,d]},{begin:/"/,end:/"/,contains:[a.BACKSLASH_ESCAPE,d]}]},{className:"regexp",variants:[{begin:"///",end:"///",contains:[d,a.HASH_COMMENT_MODE]},{begin:"//[gim]*",relevance:0},{begin:/\/(?![ *])(\\\/|.)*?\/[gim]*(?=\W|$)/}]},{className:"property",begin:"@"+c},{begin:"`",end:"`",excludeBegin:!0,excludeEnd:!0,subLanguage:"javascript"}];d.contains=e;var f=a.inherit(a.TITLE_MODE,{begin:c}),g="(\\(.*\\))?\\s*\\B[-=]>",h={className:"params",begin:"\\([^\\(]",returnBegin:!0,contains:[{begin:/\(/,end:/\)/,keywords:b,contains:["self"].concat(e)}]};return{aliases:["coffee","cson","iced"],keywords:b,illegal:/\/\*/,contains:e.concat([a.COMMENT("###","###"),a.HASH_COMMENT_MODE,{className:"function",begin:"^\\s*"+c+"\\s*=\\s*"+g,end:"[-=]>",returnBegin:!0,contains:[f,h]},{begin:/[:\(,=]\s*/,relevance:0,contains:[{className:"function",begin:g,end:"[-=]>",returnBegin:!0,contains:[h]}]},{className:"class",beginKeywords:"class",end:"$",illegal:/[:="\[\]]/,contains:[{beginKeywords:"extends",endsWithParent:!0,illegal:/[:="\[\]]/,contains:[f]},f]},{className:"attribute",begin:c+":",end:":",returnBegin:!0,returnEnd:!0,relevance:0}])}}),a.registerLanguage("cpp",function(a){var b={className:"keyword",begin:"\\b[a-z\\d_]*_t\\b"},c={className:"string",variants:[a.inherit(a.QUOTE_STRING_MODE,{begin:'((u8?|U)|L)?"'}),{begin:'(u8?|U)?R"',end:'"',contains:[a.BACKSLASH_ESCAPE]},{begin:"'\\\\?.",end:"'",illegal:"."}]},d={className:"number",variants:[{begin:"\\b(\\d+(\\.\\d*)?|\\.\\d+)(u|U|l|L|ul|UL|f|F)"},{begin:a.C_NUMBER_RE}]},e={className:"preprocessor",begin:"#",end:"$",keywords:"if else elif endif define undef warning error line pragma ifdef ifndef",contains:[{begin:/\\\n/,relevance:0},{beginKeywords:"include",end:"$",contains:[c,{className:"string",begin:"<",end:">",illegal:"\\n"}]},c,d,a.C_LINE_COMMENT_MODE,a.C_BLOCK_COMMENT_MODE]},f=a.IDENT_RE+"\\s*\\(",g={keyword:"int float while private char catch export virtual operator sizeof dynamic_cast|10 typedef const_cast|10 const struct for static_cast|10 union namespace unsigned long volatile static protected bool template mutable if public friend do goto auto void enum else break extern using class asm case typeid short reinterpret_cast|10 default double register explicit signed typename try this switch continue inline delete alignof constexpr decltype noexcept static_assert thread_local restrict _Bool complex _Complex _Imaginary atomic_bool atomic_char atomic_schar atomic_uchar atomic_short atomic_ushort atomic_int atomic_uint atomic_long atomic_ulong atomic_llong atomic_ullong",built_in:"std string cin cout cerr clog stdin stdout stderr stringstream istringstream ostringstream auto_ptr deque list queue stack vector map set bitset multiset multimap unordered_set unordered_map unordered_multiset unordered_multimap array shared_ptr abort abs acos asin atan2 atan calloc ceil cosh cos exit exp fabs floor fmod fprintf fputs free frexp fscanf isalnum isalpha iscntrl isdigit isgraph islower isprint ispunct isspace isupper isxdigit tolower toupper labs ldexp log10 log malloc realloc memchr memcmp memcpy memset modf pow printf putchar puts scanf sinh sin snprintf sprintf sqrt sscanf strcat strchr strcmp strcpy strcspn strlen strncat strncmp strncpy strpbrk strrchr strspn strstr tanh tan vfprintf vprintf vsprintf",literal:"true false nullptr NULL"};return{aliases:["c","cc","h","c++","h++","hpp"],keywords:g,illegal:"",keywords:g,contains:["self",b]},{begin:a.IDENT_RE+"::",keywords:g},{beginKeywords:"new throw return else",relevance:0},{className:"function",begin:"("+a.IDENT_RE+"[\\*&\\s]+)+"+f,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:g,illegal:/[^\w\s\*&]/,contains:[{begin:f,returnBegin:!0,contains:[a.TITLE_MODE],relevance:0},{className:"params",begin:/\(/,end:/\)/,keywords:g,relevance:0,contains:[a.C_LINE_COMMENT_MODE,a.C_BLOCK_COMMENT_MODE,c,d]},a.C_LINE_COMMENT_MODE,a.C_BLOCK_COMMENT_MODE,e]}]}}),a.registerLanguage("crmsh",function(a){var b="primitive rsc_template",c="group clone ms master location colocation order fencing_topology rsc_ticket acl_target acl_group user role tag xml",d="property rsc_defaults op_defaults",e="params meta operations op rule attributes utilization",f="read write deny defined not_defined in_range date spec in ref reference attribute type xpath version and or lt gt tag lte gte eq ne \\",g="number string",h="Master Started Slave Stopped start promote demote stop monitor true false";return{aliases:["crm","pcmk"],case_insensitive:!0,keywords:{keyword:e,operator:f,type:g,literal:h},contains:[a.HASH_COMMENT_MODE,{beginKeywords:"node",starts:{className:"identifier",end:"\\s*([\\w_-]+:)?",starts:{className:"title",end:"\\s*[\\$\\w_][\\w_-]*"}}},{beginKeywords:b,starts:{className:"title",end:"\\s*[\\$\\w_][\\w_-]*",starts:{className:"pragma",end:"\\s*@?[\\w_][\\w_\\.:-]*"}}},{begin:"\\b("+c.split(" ").join("|")+")\\s+",keywords:c,starts:{className:"title",end:"[\\$\\w_][\\w_-]*"}},{beginKeywords:d,starts:{className:"title",end:"\\s*([\\w_-]+:)?"}},a.QUOTE_STRING_MODE,{className:"pragma",begin:"(ocf|systemd|service|lsb):[\\w_:-]+",relevance:0},{className:"number",begin:"\\b\\d+(\\.\\d+)?(ms|s|h|m)?",relevance:0},{className:"number",begin:"[-]?(infinity|inf)",relevance:0},{className:"variable",begin:/([A-Za-z\$_\#][\w_-]+)=/,relevance:0},{className:"tag",begin:"",relevance:0}]}}),a.registerLanguage("crystal",function(a){function b(a,b){var c=[{begin:a,end:b}];return c[0].contains=c,c}var c="(_[uif](8|16|32|64))?",d="[a-zA-Z_]\\w*[!?=]?",e="!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",f="[a-zA-Z_]\\w*[!?=]?|[-+~]\\@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\][=?]?",g={keyword:"abstract alias as asm begin break case class def do else elsif end ensure enum extend for fun if ifdef include instance_sizeof is_a? lib macro module next of out pointerof private protected rescue responds_to? return require self sizeof struct super then type typeof union unless until when while with yield __DIR__ __FILE__ __LINE__",literal:"false nil true"},h={className:"subst",begin:"#{",end:"}",keywords:g},i={className:"expansion",variants:[{begin:"\\{\\{",end:"\\}\\}"},{begin:"\\{%",end:"%\\}"}],keywords:g,relevance:10},j={className:"string",contains:[a.BACKSLASH_ESCAPE,h],variants:[{begin:/'/,end:/'/},{begin:/"/,end:/"/},{begin:/`/,end:/`/},{begin:"%w?\\(",end:"\\)",contains:b("\\(","\\)")},{begin:"%w?\\[",end:"\\]",contains:b("\\[","\\]")},{begin:"%w?{",end:"}",contains:b("{","}")},{begin:"%w?<",end:">",contains:b("<",">")},{begin:"%w?/",end:"/"},{begin:"%w?%",end:"%"},{begin:"%w?-",end:"-"},{begin:"%w?\\|",end:"\\|"}],relevance:0},k={begin:"("+e+")\\s*",contains:[{className:"regexp",contains:[a.BACKSLASH_ESCAPE,h],variants:[{begin:"/",end:"/[a-z]*"},{begin:"%r\\(",end:"\\)",contains:b("\\(","\\)")},{begin:"%r\\[",end:"\\]",contains:b("\\[","\\]")},{begin:"%r{",end:"}",contains:b("{","}")},{begin:"%r<",end:">",contains:b("<",">")},{begin:"%r/",end:"/"},{begin:"%r%",end:"%"},{begin:"%r-",end:"-"},{begin:"%r\\|",end:"\\|"}]}],relevance:0},l={className:"regexp",contains:[a.BACKSLASH_ESCAPE,h],variants:[{begin:"%r\\(",end:"\\)",contains:b("\\(","\\)")},{begin:"%r\\[",end:"\\]",contains:b("\\[","\\]")},{begin:"%r{",end:"}",contains:b("{","}")},{begin:"%r<",end:">",contains:b("<",">")},{begin:"%r/",end:"/"},{begin:"%r%",end:"%"},{begin:"%r-",end:"-"},{begin:"%r\\|",end:"\\|"}],relevance:0},m={className:"annotation",begin:"@\\[",end:"\\]",relevance:5},n=[i,j,k,l,m,a.HASH_COMMENT_MODE,{className:"class",beginKeywords:"class module struct",end:"$|;",illegal:/=/,contains:[a.HASH_COMMENT_MODE,a.inherit(a.TITLE_MODE,{begin:"[A-Za-z_]\\w*(::\\w+)*(\\?|\\!)?"}),{className:"inheritance",begin:"<\\s*",contains:[{className:"parent",begin:"("+a.IDENT_RE+"::)?"+a.IDENT_RE}]}]},{className:"class",beginKeywords:"lib enum union",end:"$|;",illegal:/=/,contains:[a.HASH_COMMENT_MODE,a.inherit(a.TITLE_MODE,{begin:"[A-Za-z_]\\w*(::\\w+)*(\\?|\\!)?"})],relevance:10},{className:"function",beginKeywords:"def",end:/\B\b/,contains:[a.inherit(a.TITLE_MODE,{begin:f,endsParent:!0})]},{className:"function",beginKeywords:"fun macro",end:/\B\b/,contains:[a.inherit(a.TITLE_MODE,{begin:f,endsParent:!0})],relevance:5},{className:"constant",begin:"(::)?(\\b[A-Z]\\w*(::)?)+",relevance:0},{className:"symbol",begin:a.UNDERSCORE_IDENT_RE+"(\\!|\\?)?:",relevance:0},{className:"symbol",begin:":",contains:[j,{begin:f}],relevance:0},{className:"number",variants:[{begin:"\\b0b([01_]*[01])"+c},{begin:"\\b0o([0-7_]*[0-7])"+c},{begin:"\\b0x([A-Fa-f0-9_]*[A-Fa-f0-9])"+c},{begin:"\\b(([0-9][0-9_]*[0-9]|[0-9])(\\.[0-9_]*[0-9])?([eE][+-]?[0-9_]*[0-9])?)"+c}],relevance:0},{className:"variable",begin:"(\\$\\W)|((\\$|\\@\\@?|%)(\\w+))"}];return h.contains=n,m.contains=n,i.contains=n.slice(1),{aliases:["cr"],lexemes:d,keywords:g,contains:n}}),a.registerLanguage("cs",function(a){var b="abstract as base bool break byte case catch char checked const continue decimal dynamic default delegate do double else enum event explicit extern false finally fixed float for foreach goto if implicit in int interface internal is lock long null when object operator out override params private protected public readonly ref sbyte sealed short sizeof stackalloc static string struct switch this true try typeof uint ulong unchecked unsafe ushort using virtual volatile void while async protected public private internal ascending descending from get group into join let orderby partial select set value var where yield",c=a.IDENT_RE+"(<"+a.IDENT_RE+">)?";return{aliases:["csharp"],keywords:b,illegal:/::/,contains:[a.COMMENT("///","$",{returnBegin:!0,contains:[{className:"xmlDocTag",variants:[{begin:"///",relevance:0},{begin:""},{begin:""}]}]}),a.C_LINE_COMMENT_MODE,a.C_BLOCK_COMMENT_MODE,{className:"preprocessor",begin:"#",end:"$",keywords:"if else elif endif define undef warning error line region endregion pragma checksum"},{className:"string",begin:'@"',end:'"',contains:[{begin:'""'}]},a.APOS_STRING_MODE,a.QUOTE_STRING_MODE,a.C_NUMBER_MODE,{beginKeywords:"class interface",end:/[{;=]/,illegal:/[^\s:]/,contains:[a.TITLE_MODE,a.C_LINE_COMMENT_MODE,a.C_BLOCK_COMMENT_MODE]},{beginKeywords:"namespace",end:/[{;=]/,illegal:/[^\s:]/,contains:[{className:"title",begin:"[a-zA-Z](\\.?\\w)*",relevance:0},a.C_LINE_COMMENT_MODE,a.C_BLOCK_COMMENT_MODE]},{beginKeywords:"new return throw await",relevance:0},{className:"function",begin:"("+c+"\\s+)+"+a.IDENT_RE+"\\s*\\(",returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:b,contains:[{begin:a.IDENT_RE+"\\s*\\(",returnBegin:!0,contains:[a.TITLE_MODE],relevance:0},{className:"params",begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:b,relevance:0,contains:[a.APOS_STRING_MODE,a.QUOTE_STRING_MODE,a.C_NUMBER_MODE,a.C_BLOCK_COMMENT_MODE]},a.C_LINE_COMMENT_MODE,a.C_BLOCK_COMMENT_MODE]}]}}),a.registerLanguage("css",function(a){var b="[a-zA-Z-][a-zA-Z0-9_-]*",c={className:"function",begin:b+"\\(",returnBegin:!0,excludeEnd:!0,end:"\\("},d={className:"rule",begin:/[A-Z\_\.\-]+\s*:/,returnBegin:!0,end:";",endsWithParent:!0,contains:[{className:"attribute",begin:/\S/,end:":",excludeEnd:!0,starts:{className:"value",endsWithParent:!0,excludeEnd:!0,contains:[c,a.CSS_NUMBER_MODE,a.QUOTE_STRING_MODE,a.APOS_STRING_MODE,a.C_BLOCK_COMMENT_MODE,{className:"hexcolor",begin:"#[0-9A-Fa-f]+"},{className:"important",begin:"!important"}]}}]};return{case_insensitive:!0,illegal:/[=\/|'\$]/,contains:[a.C_BLOCK_COMMENT_MODE,{className:"id",begin:/\#[A-Za-z0-9_-]+/},{className:"class",begin:/\.[A-Za-z0-9_-]+/},{className:"attr_selector",begin:/\[/,end:/\]/,illegal:"$"},{className:"pseudo",begin:/:(:)?[a-zA-Z0-9\_\-\+\(\)"']+/},{className:"at_rule",begin:"@(font-face|page)",lexemes:"[a-z-]+",keywords:"font-face page"},{className:"at_rule",begin:"@",end:"[{;]",contains:[{className:"keyword",begin:/\S+/},{begin:/\s/,endsWithParent:!0,excludeEnd:!0,relevance:0,contains:[c,a.APOS_STRING_MODE,a.QUOTE_STRING_MODE,a.CSS_NUMBER_MODE]}]},{className:"tag",begin:b,relevance:0},{className:"rules",begin:"{",end:"}",illegal:/\S/,contains:[a.C_BLOCK_COMMENT_MODE,d]}]}}),a.registerLanguage("d",function(a){var b={keyword:"abstract alias align asm assert auto body break byte case cast catch class const continue debug default delete deprecated do else enum export extern final finally for foreach foreach_reverse|10 goto if immutable import in inout int interface invariant is lazy macro mixin module new nothrow out override package pragma private protected public pure ref return scope shared static struct super switch synchronized template this throw try typedef typeid typeof union unittest version void volatile while with __FILE__ __LINE__ __gshared|10 __thread __traits __DATE__ __EOF__ __TIME__ __TIMESTAMP__ __VENDOR__ __VERSION__",built_in:"bool cdouble cent cfloat char creal dchar delegate double dstring float function idouble ifloat ireal long real short string ubyte ucent uint ulong ushort wchar wstring",literal:"false null true"},c="(0|[1-9][\\d_]*)",d="(0|[1-9][\\d_]*|\\d[\\d_]*|[\\d_]+?\\d)",e="0[bB][01_]+",f="([\\da-fA-F][\\da-fA-F_]*|_[\\da-fA-F][\\da-fA-F_]*)",g="0[xX]"+f,h="([eE][+-]?"+d+")",i="("+d+"(\\.\\d*|"+h+")|\\d+\\."+d+d+"|\\."+c+h+"?)",j="(0[xX]("+f+"\\."+f+"|\\.?"+f+")[pP][+-]?"+d+")",k="("+c+"|"+e+"|"+g+")",l="("+j+"|"+i+")",m="\\\\(['\"\\?\\\\abfnrtv]|u[\\dA-Fa-f]{4}|[0-7]{1,3}|x[\\dA-Fa-f]{2}|U[\\dA-Fa-f]{8})|&[a-zA-Z\\d]{2,};",n={className:"number",begin:"\\b"+k+"(L|u|U|Lu|LU|uL|UL)?",relevance:0},o={className:"number",begin:"\\b("+l+"([fF]|L|i|[fF]i|Li)?|"+k+"(i|[fF]i|Li))",relevance:0},p={className:"string",begin:"'("+m+"|.)",end:"'",illegal:"."},q={begin:m,relevance:0},r={className:"string",begin:'"',contains:[q],end:'"[cwd]?'},s={className:"string",begin:'[rq]"',end:'"[cwd]?',relevance:5},t={className:"string",begin:"`",end:"`[cwd]?"},u={className:"string",begin:'x"[\\da-fA-F\\s\\n\\r]*"[cwd]?',relevance:10},v={className:"string",begin:'q"\\{',end:'\\}"'},w={className:"shebang",begin:"^#!",end:"$",relevance:5},x={className:"preprocessor",begin:"#(line)",end:"$",relevance:5},y={className:"keyword",begin:"@[a-zA-Z_][a-zA-Z_\\d]*"},z=a.COMMENT("\\/\\+","\\+\\/",{contains:["self"],relevance:10});return{lexemes:a.UNDERSCORE_IDENT_RE,keywords:b,contains:[a.C_LINE_COMMENT_MODE,a.C_BLOCK_COMMENT_MODE,z,u,r,s,t,v,o,n,p,w,x,y]}}),a.registerLanguage("markdown",function(a){return{aliases:["md","mkdown","mkd"],contains:[{className:"header",variants:[{begin:"^#{1,6}",end:"$"},{begin:"^.+?\\n[=-]{2,}$"}]},{begin:"<",end:">",subLanguage:"xml",relevance:0},{className:"bullet",begin:"^([*+-]|(\\d+\\.))\\s+"},{className:"strong",begin:"[*_]{2}.+?[*_]{2}"},{className:"emphasis",variants:[{begin:"\\*.+?\\*"},{begin:"_.+?_",relevance:0}]},{className:"blockquote",begin:"^>\\s+",end:"$"},{className:"code",variants:[{begin:"`.+?`"},{begin:"^( {4}| )",end:"$",relevance:0}]},{className:"horizontal_rule",begin:"^[-\\*]{3,}",end:"$"},{begin:"\\[.+?\\][\\(\\[].*?[\\)\\]]",returnBegin:!0,contains:[{className:"link_label",begin:"\\[",end:"\\]",excludeBegin:!0,returnEnd:!0,relevance:0},{className:"link_url",begin:"\\]\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0},{className:"link_reference",begin:"\\]\\[",end:"\\]",excludeBegin:!0,excludeEnd:!0}],relevance:10},{begin:"^\\[.+\\]:",returnBegin:!0,contains:[{className:"link_reference",begin:"\\[",end:"\\]:",excludeBegin:!0,excludeEnd:!0,starts:{className:"link_url",end:"$"}}]}]}}),a.registerLanguage("dart",function(a){var b={className:"subst",begin:"\\$\\{",end:"}",keywords:"true false null this is new super"},c={className:"string",variants:[{begin:"r'''",end:"'''"},{begin:'r"""',end:'"""'},{begin:"r'",end:"'",illegal:"\\n"},{ +begin:'r"',end:'"',illegal:"\\n"},{begin:"'''",end:"'''",contains:[a.BACKSLASH_ESCAPE,b]},{begin:'"""',end:'"""',contains:[a.BACKSLASH_ESCAPE,b]},{begin:"'",end:"'",illegal:"\\n",contains:[a.BACKSLASH_ESCAPE,b]},{begin:'"',end:'"',illegal:"\\n",contains:[a.BACKSLASH_ESCAPE,b]}]};b.contains=[a.C_NUMBER_MODE,c];var d={keyword:"assert break case catch class const continue default do else enum extends false final finally for if in is new null rethrow return super switch this throw true try var void while with",literal:"abstract as dynamic export external factory get implements import library operator part set static typedef",built_in:"print Comparable DateTime Duration Function Iterable Iterator List Map Match Null Object Pattern RegExp Set Stopwatch String StringBuffer StringSink Symbol Type Uri bool double int num document window querySelector querySelectorAll Element ElementList"};return{keywords:d,contains:[c,a.COMMENT("/\\*\\*","\\*/",{subLanguage:"markdown"}),a.COMMENT("///","$",{subLanguage:"markdown"}),a.C_LINE_COMMENT_MODE,a.C_BLOCK_COMMENT_MODE,{className:"class",beginKeywords:"class interface",end:"{",excludeEnd:!0,contains:[{beginKeywords:"extends implements"},a.UNDERSCORE_TITLE_MODE]},a.C_NUMBER_MODE,{className:"annotation",begin:"@[A-Za-z]+"},{begin:"=>"}]}}),a.registerLanguage("delphi",function(a){var b="exports register file shl array record property for mod while set ally label uses raise not stored class safecall var interface or private static exit index inherited to else stdcall override shr asm far resourcestring finalization packed virtual out and protected library do xorwrite goto near function end div overload object unit begin string on inline repeat until destructor write message program with read initialization except default nil if case cdecl in downto threadvar of try pascal const external constructor type public then implementation finally published procedure",c=[a.C_LINE_COMMENT_MODE,a.COMMENT(/\{/,/\}/,{relevance:0}),a.COMMENT(/\(\*/,/\*\)/,{relevance:10})],d={className:"string",begin:/'/,end:/'/,contains:[{begin:/''/}]},e={className:"string",begin:/(#\d+)+/},f={begin:a.IDENT_RE+"\\s*=\\s*class\\s*\\(",returnBegin:!0,contains:[a.TITLE_MODE]},g={className:"function",beginKeywords:"function constructor destructor procedure",end:/[:;]/,keywords:"function constructor|10 destructor|10 procedure|10",contains:[a.TITLE_MODE,{className:"params",begin:/\(/,end:/\)/,keywords:b,contains:[d,e]}].concat(c)};return{case_insensitive:!0,keywords:b,illegal:/"|\$[G-Zg-z]|\/\*|<\/|\|/,contains:[d,e,a.NUMBER_MODE,f,g].concat(c)}}),a.registerLanguage("diff",function(a){return{aliases:["patch"],contains:[{className:"chunk",relevance:10,variants:[{begin:/^@@ +\-\d+,\d+ +\+\d+,\d+ +@@$/},{begin:/^\*\*\* +\d+,\d+ +\*\*\*\*$/},{begin:/^\-\-\- +\d+,\d+ +\-\-\-\-$/}]},{className:"header",variants:[{begin:/Index: /,end:/$/},{begin:/=====/,end:/=====$/},{begin:/^\-\-\-/,end:/$/},{begin:/^\*{3} /,end:/$/},{begin:/^\+\+\+/,end:/$/},{begin:/\*{5}/,end:/\*{5}$/}]},{className:"addition",begin:"^\\+",end:"$"},{className:"deletion",begin:"^\\-",end:"$"},{className:"change",begin:"^\\!",end:"$"}]}}),a.registerLanguage("django",function(a){var b={className:"filter",begin:/\|[A-Za-z]+:?/,keywords:"truncatewords removetags linebreaksbr yesno get_digit timesince random striptags filesizeformat escape linebreaks length_is ljust rjust cut urlize fix_ampersands title floatformat capfirst pprint divisibleby add make_list unordered_list urlencode timeuntil urlizetrunc wordcount stringformat linenumbers slice date dictsort dictsortreversed default_if_none pluralize lower join center default truncatewords_html upper length phone2numeric wordwrap time addslashes slugify first escapejs force_escape iriencode last safe safeseq truncatechars localize unlocalize localtime utc timezone",contains:[{className:"argument",begin:/"/,end:/"/},{className:"argument",begin:/'/,end:/'/}]};return{aliases:["jinja"],case_insensitive:!0,subLanguage:"xml",contains:[a.COMMENT(/\{%\s*comment\s*%}/,/\{%\s*endcomment\s*%}/),a.COMMENT(/\{#/,/#}/),{className:"template_tag",begin:/\{%/,end:/%}/,keywords:"comment endcomment load templatetag ifchanged endifchanged if endif firstof for endfor in ifnotequal endifnotequal widthratio extends include spaceless endspaceless regroup by as ifequal endifequal ssi now with cycle url filter endfilter debug block endblock else autoescape endautoescape csrf_token empty elif endwith static trans blocktrans endblocktrans get_static_prefix get_media_prefix plural get_current_language language get_available_languages get_current_language_bidi get_language_info get_language_info_list localize endlocalize localtime endlocaltime timezone endtimezone get_current_timezone verbatim",contains:[b]},{className:"variable",begin:/\{\{/,end:/}}/,contains:[b]}]}}),a.registerLanguage("dns",function(a){return{aliases:["bind","zone"],keywords:{keyword:"IN A AAAA AFSDB APL CAA CDNSKEY CDS CERT CNAME DHCID DLV DNAME DNSKEY DS HIP IPSECKEY KEY KX LOC MX NAPTR NS NSEC NSEC3 NSEC3PARAM PTR RRSIG RP SIG SOA SRV SSHFP TA TKEY TLSA TSIG TXT"},contains:[a.COMMENT(";","$"),{className:"operator",beginKeywords:"$TTL $GENERATE $INCLUDE $ORIGIN"},{className:"number",begin:"((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:)))"},{className:"number",begin:"((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]).){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])"}]}}),a.registerLanguage("dockerfile",function(a){return{aliases:["docker"],case_insensitive:!0,keywords:{built_ins:"from maintainer cmd expose add copy entrypoint volume user workdir onbuild run env label"},contains:[a.HASH_COMMENT_MODE,{keywords:{built_in:"run cmd entrypoint volume add copy workdir onbuild label"},begin:/^ *(onbuild +)?(run|cmd|entrypoint|volume|add|copy|workdir|label) +/,starts:{end:/[^\\]\n/,subLanguage:"bash"}},{keywords:{built_in:"from maintainer expose env user onbuild"},begin:/^ *(onbuild +)?(from|maintainer|expose|env|user|onbuild) +/,end:/[^\\]\n/,contains:[a.APOS_STRING_MODE,a.QUOTE_STRING_MODE,a.NUMBER_MODE,a.HASH_COMMENT_MODE]}]}}),a.registerLanguage("dos",function(a){var b=a.COMMENT(/@?rem\b/,/$/,{relevance:10}),c={className:"label",begin:"^\\s*[A-Za-z._?][A-Za-z0-9_$#@~.?]*(:|\\s+label)",relevance:0};return{aliases:["bat","cmd"],case_insensitive:!0,illegal:/\/\*/,keywords:{flow:"if else goto for in do call exit not exist errorlevel defined",operator:"equ neq lss leq gtr geq",keyword:"shift cd dir echo setlocal endlocal set pause copy",stream:"prn nul lpt3 lpt2 lpt1 con com4 com3 com2 com1 aux",winutils:"ping net ipconfig taskkill xcopy ren del",built_in:"append assoc at attrib break cacls cd chcp chdir chkdsk chkntfs cls cmd color comp compact convert date dir diskcomp diskcopy doskey erase fs find findstr format ftype graftabl help keyb label md mkdir mode more move path pause print popd pushd promt rd recover rem rename replace restore rmdir shiftsort start subst time title tree type ver verify vol"},contains:[{className:"envvar",begin:/%%[^ ]|%[^ ]+?%|![^ ]+?!/},{className:"function",begin:c.begin,end:"goto:eof",contains:[a.inherit(a.TITLE_MODE,{begin:"([_a-zA-Z]\\w*\\.)*([_a-zA-Z]\\w*:)?[_a-zA-Z]\\w*"}),b]},{className:"number",begin:"\\b\\d+",relevance:0},b]}}),a.registerLanguage("dust",function(a){var b="if eq ne lt lte gt gte select default math sep";return{aliases:["dst"],case_insensitive:!0,subLanguage:"xml",contains:[{className:"expression",begin:"{",end:"}",relevance:0,contains:[{className:"begin-block",begin:"#[a-zA-Z- .]+",keywords:b},{className:"string",begin:'"',end:'"'},{className:"end-block",begin:"\\/[a-zA-Z- .]+",keywords:b},{className:"variable",begin:"[a-zA-Z-.]+",keywords:b,relevance:0}]}]}}),a.registerLanguage("elixir",function(a){var b="[a-zA-Z_][a-zA-Z0-9_]*(\\!|\\?)?",c="[a-zA-Z_]\\w*[!?=]?|[-+~]\\@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?",d="and false then defined module in return redo retry end for true self when next until do begin unless nil break not case cond alias while ensure or include use alias fn quote",e={className:"subst",begin:"#\\{",end:"}",lexemes:b,keywords:d},f={className:"string",contains:[a.BACKSLASH_ESCAPE,e],variants:[{begin:/'/,end:/'/},{begin:/"/,end:/"/}]},g={className:"function",beginKeywords:"def defp defmacro",end:/\B\b/,contains:[a.inherit(a.TITLE_MODE,{begin:b,endsParent:!0})]},h=a.inherit(g,{className:"class",beginKeywords:"defmodule defrecord",end:/\bdo\b|$|;/}),i=[f,a.HASH_COMMENT_MODE,h,g,{className:"constant",begin:"(\\b[A-Z_]\\w*(.)?)+",relevance:0},{className:"symbol",begin:":",contains:[f,{begin:c}],relevance:0},{className:"symbol",begin:b+":",relevance:0},{className:"number",begin:"(\\b0[0-7_]+)|(\\b0x[0-9a-fA-F_]+)|(\\b[1-9][0-9_]*(\\.[0-9_]+)?)|[0_]\\b",relevance:0},{className:"variable",begin:"(\\$\\W)|((\\$|\\@\\@?)(\\w+))"},{begin:"->"},{begin:"("+a.RE_STARTERS_RE+")\\s*",contains:[a.HASH_COMMENT_MODE,{className:"regexp",illegal:"\\n",contains:[a.BACKSLASH_ESCAPE,e],variants:[{begin:"/",end:"/[a-z]*"},{begin:"%r\\[",end:"\\][a-z]*"}]}],relevance:0}];return e.contains=i,{lexemes:b,keywords:d,contains:i}}),a.registerLanguage("elm",function(a){var b=[a.COMMENT("--","$"),a.COMMENT("{-","-}",{contains:["self"]})],c={className:"type",begin:"\\b[A-Z][\\w']*",relevance:0},d={className:"container",begin:"\\(",end:"\\)",illegal:'"',contains:[{className:"type",begin:"\\b[A-Z][\\w]*(\\((\\.\\.|,|\\w+)\\))?"}].concat(b)},e={className:"container",begin:"{",end:"}",contains:d.contains};return{keywords:"let in if then else case of where module import exposing type alias as infix infixl infixr port",contains:[{className:"module",begin:"\\bmodule\\b",end:"where",keywords:"module where",contains:[d].concat(b),illegal:"\\W\\.|;"},{className:"import",begin:"\\bimport\\b",end:"$",keywords:"import|0 as exposing",contains:[d].concat(b),illegal:"\\W\\.|;"},{className:"typedef",begin:"\\btype\\b",end:"$",keywords:"type alias",contains:[c,d,e].concat(b)},{className:"infix",beginKeywords:"infix infixl infixr",end:"$",contains:[a.C_NUMBER_MODE].concat(b)},{className:"foreign",begin:"\\bport\\b",end:"$",keywords:"port",contains:b},a.QUOTE_STRING_MODE,a.C_NUMBER_MODE,c,a.inherit(a.TITLE_MODE,{begin:"^[_a-z][\\w']*"}),{begin:"->|<-"}].concat(b)}}),a.registerLanguage("ruby",function(a){var b="[a-zA-Z_]\\w*[!?=]?|[-+~]\\@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?",c="and false then defined module in return redo if BEGIN retry end for true self when next until do begin unless END rescue nil else break undef not super class case require yield alias while ensure elsif or include attr_reader attr_writer attr_accessor",d={className:"doctag",begin:"@[A-Za-z]+"},e={className:"value",begin:"#<",end:">"},f=[a.COMMENT("#","$",{contains:[d]}),a.COMMENT("^\\=begin","^\\=end",{contains:[d],relevance:10}),a.COMMENT("^__END__","\\n$")],g={className:"subst",begin:"#\\{",end:"}",keywords:c},h={className:"string",contains:[a.BACKSLASH_ESCAPE,g],variants:[{begin:/'/,end:/'/},{begin:/"/,end:/"/},{begin:/`/,end:/`/},{begin:"%[qQwWx]?\\(",end:"\\)"},{begin:"%[qQwWx]?\\[",end:"\\]"},{begin:"%[qQwWx]?{",end:"}"},{begin:"%[qQwWx]?<",end:">"},{begin:"%[qQwWx]?/",end:"/"},{begin:"%[qQwWx]?%",end:"%"},{begin:"%[qQwWx]?-",end:"-"},{begin:"%[qQwWx]?\\|",end:"\\|"},{begin:/\B\?(\\\d{1,3}|\\x[A-Fa-f0-9]{1,2}|\\u[A-Fa-f0-9]{4}|\\?\S)\b/}]},i={className:"params",begin:"\\(",end:"\\)",keywords:c},j=[h,e,{className:"class",beginKeywords:"class module",end:"$|;",illegal:/=/,contains:[a.inherit(a.TITLE_MODE,{begin:"[A-Za-z_]\\w*(::\\w+)*(\\?|\\!)?"}),{className:"inheritance",begin:"<\\s*",contains:[{className:"parent",begin:"("+a.IDENT_RE+"::)?"+a.IDENT_RE}]}].concat(f)},{className:"function",beginKeywords:"def",end:"$|;",contains:[a.inherit(a.TITLE_MODE,{begin:b}),i].concat(f)},{className:"constant",begin:"(::)?(\\b[A-Z]\\w*(::)?)+",relevance:0},{className:"symbol",begin:a.UNDERSCORE_IDENT_RE+"(\\!|\\?)?:",relevance:0},{className:"symbol",begin:":",contains:[h,{begin:b}],relevance:0},{className:"number",begin:"(\\b0[0-7_]+)|(\\b0x[0-9a-fA-F_]+)|(\\b[1-9][0-9_]*(\\.[0-9_]+)?)|[0_]\\b",relevance:0},{className:"variable",begin:"(\\$\\W)|((\\$|\\@\\@?)(\\w+))"},{begin:"("+a.RE_STARTERS_RE+")\\s*",contains:[e,{className:"regexp",contains:[a.BACKSLASH_ESCAPE,g],illegal:/\n/,variants:[{begin:"/",end:"/[a-z]*"},{begin:"%r{",end:"}[a-z]*"},{begin:"%r\\(",end:"\\)[a-z]*"},{begin:"%r!",end:"![a-z]*"},{begin:"%r\\[",end:"\\][a-z]*"}]}].concat(f),relevance:0}].concat(f);g.contains=j,i.contains=j;var k="[>?]>",l="[\\w#]+\\(\\w+\\):\\d+:\\d+>",m="(\\w+-)?\\d+\\.\\d+\\.\\d(p\\d+)?[^>]+>",n=[{begin:/^\s*=>/,className:"status",starts:{end:"$",contains:j}},{className:"prompt",begin:"^("+k+"|"+l+"|"+m+")",starts:{end:"$",contains:j}}];return{aliases:["rb","gemspec","podspec","thor","irb"],keywords:c,illegal:/\/\*/,contains:f.concat(n).concat(j)}}),a.registerLanguage("erb",function(a){return{subLanguage:"xml",contains:[a.COMMENT("<%#","%>"),{begin:"<%[%=-]?",end:"[%-]?%>",subLanguage:"ruby",excludeBegin:!0,excludeEnd:!0}]}}),a.registerLanguage("erlang-repl",function(a){return{keywords:{special_functions:"spawn spawn_link self",reserved:"after and andalso|10 band begin bnot bor bsl bsr bxor case catch cond div end fun if let not of or orelse|10 query receive rem try when xor"},contains:[{className:"prompt",begin:"^[0-9]+> ",relevance:10},a.COMMENT("%","$"),{className:"number",begin:"\\b(\\d+#[a-fA-F0-9]+|\\d+(\\.\\d+)?([eE][-+]?\\d+)?)",relevance:0},a.APOS_STRING_MODE,a.QUOTE_STRING_MODE,{className:"constant",begin:"\\?(::)?([A-Z]\\w*(::)?)+"},{className:"arrow",begin:"->"},{className:"ok",begin:"ok"},{className:"exclamation_mark",begin:"!"},{className:"function_or_atom",begin:"(\\b[a-z'][a-zA-Z0-9_']*:[a-z'][a-zA-Z0-9_']*)|(\\b[a-z'][a-zA-Z0-9_']*)",relevance:0},{className:"variable",begin:"[A-Z][a-zA-Z0-9_']*",relevance:0}]}}),a.registerLanguage("erlang",function(a){var b="[a-z'][a-zA-Z0-9_']*",c="("+b+":"+b+"|"+b+")",d={keyword:"after and andalso|10 band begin bnot bor bsl bzr bxor case catch cond div end fun if let not of orelse|10 query receive rem try when xor",literal:"false true"},e=a.COMMENT("%","$"),f={className:"number",begin:"\\b(\\d+#[a-fA-F0-9]+|\\d+(\\.\\d+)?([eE][-+]?\\d+)?)",relevance:0},g={begin:"fun\\s+"+b+"/\\d+"},h={begin:c+"\\(",end:"\\)",returnBegin:!0,relevance:0,contains:[{className:"function_name",begin:c,relevance:0},{begin:"\\(",end:"\\)",endsWithParent:!0,returnEnd:!0,relevance:0}]},i={className:"tuple",begin:"{",end:"}",relevance:0},j={className:"variable",begin:"\\b_([A-Z][A-Za-z0-9_]*)?",relevance:0},k={className:"variable",begin:"[A-Z][a-zA-Z0-9_]*",relevance:0},l={begin:"#"+a.UNDERSCORE_IDENT_RE,relevance:0,returnBegin:!0,contains:[{className:"record_name",begin:"#"+a.UNDERSCORE_IDENT_RE,relevance:0},{begin:"{",end:"}",relevance:0}]},m={beginKeywords:"fun receive if try case",end:"end",keywords:d};m.contains=[e,g,a.inherit(a.APOS_STRING_MODE,{className:""}),m,h,a.QUOTE_STRING_MODE,f,i,j,k,l];var n=[e,g,m,h,a.QUOTE_STRING_MODE,f,i,j,k,l];h.contains[1].contains=n,i.contains=n,l.contains[1].contains=n;var o={className:"params",begin:"\\(",end:"\\)",contains:n};return{aliases:["erl"],keywords:d,illegal:"(",returnBegin:!0,illegal:"\\(|#|//|/\\*|\\\\|:|;",contains:[o,a.inherit(a.TITLE_MODE,{begin:b})],starts:{end:";|\\.",keywords:d,contains:n}},e,{className:"pp",begin:"^-",end:"\\.",relevance:0,excludeEnd:!0,returnBegin:!0,lexemes:"-"+a.IDENT_RE,keywords:"-module -record -undef -export -ifdef -ifndef -author -copyright -doc -vsn -import -include -include_lib -compile -define -else -endif -file -behaviour -behavior -spec",contains:[o]},f,a.QUOTE_STRING_MODE,l,j,k,i,{begin:/\.$/}]}}),a.registerLanguage("fix",function(a){return{contains:[{begin:/[^\u2401\u0001]+/,end:/[\u2401\u0001]/,excludeEnd:!0,returnBegin:!0,returnEnd:!1,contains:[{begin:/([^\u2401\u0001=]+)/,end:/=([^\u2401\u0001=]+)/,returnEnd:!0,returnBegin:!1,className:"attribute"},{begin:/=/,end:/([\u2401\u0001])/,excludeEnd:!0,excludeBegin:!0,className:"string"}]}],case_insensitive:!0}}),a.registerLanguage("fortran",function(a){var b={className:"params",begin:"\\(",end:"\\)"},c={constant:".False. .True.",type:"integer real character complex logical dimension allocatable|10 parameter external implicit|10 none double precision assign intent optional pointer target in out common equivalence data",keyword:"kind do while private call intrinsic where elsewhere type endtype endmodule endselect endinterface end enddo endif if forall endforall only contains default return stop then public subroutine|10 function program .and. .or. .not. .le. .eq. .ge. .gt. .lt. goto save else use module select case access blank direct exist file fmt form formatted iostat name named nextrec number opened rec recl sequential status unformatted unit continue format pause cycle exit c_null_char c_alert c_backspace c_form_feed flush wait decimal round iomsg synchronous nopass non_overridable pass protected volatile abstract extends import non_intrinsic value deferred generic final enumerator class associate bind enum c_int c_short c_long c_long_long c_signed_char c_size_t c_int8_t c_int16_t c_int32_t c_int64_t c_int_least8_t c_int_least16_t c_int_least32_t c_int_least64_t c_int_fast8_t c_int_fast16_t c_int_fast32_t c_int_fast64_t c_intmax_t C_intptr_t c_float c_double c_long_double c_float_complex c_double_complex c_long_double_complex c_bool c_char c_null_ptr c_null_funptr c_new_line c_carriage_return c_horizontal_tab c_vertical_tab iso_c_binding c_loc c_funloc c_associated c_f_pointer c_ptr c_funptr iso_fortran_env character_storage_size error_unit file_storage_size input_unit iostat_end iostat_eor numeric_storage_size output_unit c_f_procpointer ieee_arithmetic ieee_support_underflow_control ieee_get_underflow_mode ieee_set_underflow_mode newunit contiguous recursive pad position action delim readwrite eor advance nml interface procedure namelist include sequence elemental pure",built_in:"alog alog10 amax0 amax1 amin0 amin1 amod cabs ccos cexp clog csin csqrt dabs dacos dasin datan datan2 dcos dcosh ddim dexp dint dlog dlog10 dmax1 dmin1 dmod dnint dsign dsin dsinh dsqrt dtan dtanh float iabs idim idint idnint ifix isign max0 max1 min0 min1 sngl algama cdabs cdcos cdexp cdlog cdsin cdsqrt cqabs cqcos cqexp cqlog cqsin cqsqrt dcmplx dconjg derf derfc dfloat dgamma dimag dlgama iqint qabs qacos qasin qatan qatan2 qcmplx qconjg qcos qcosh qdim qerf qerfc qexp qgamma qimag qlgama qlog qlog10 qmax1 qmin1 qmod qnint qsign qsin qsinh qsqrt qtan qtanh abs acos aimag aint anint asin atan atan2 char cmplx conjg cos cosh exp ichar index int log log10 max min nint sign sin sinh sqrt tan tanh print write dim lge lgt lle llt mod nullify allocate deallocate adjustl adjustr all allocated any associated bit_size btest ceiling count cshift date_and_time digits dot_product eoshift epsilon exponent floor fraction huge iand ibclr ibits ibset ieor ior ishft ishftc lbound len_trim matmul maxexponent maxloc maxval merge minexponent minloc minval modulo mvbits nearest pack present product radix random_number random_seed range repeat reshape rrspacing scale scan selected_int_kind selected_real_kind set_exponent shape size spacing spread sum system_clock tiny transpose trim ubound unpack verify achar iachar transfer dble entry dprod cpu_time command_argument_count get_command get_command_argument get_environment_variable is_iostat_end ieee_arithmetic ieee_support_underflow_control ieee_get_underflow_mode ieee_set_underflow_mode is_iostat_eor move_alloc new_line selected_char_kind same_type_as extends_type_ofacosh asinh atanh bessel_j0 bessel_j1 bessel_jn bessel_y0 bessel_y1 bessel_yn erf erfc erfc_scaled gamma log_gamma hypot norm2 atomic_define atomic_ref execute_command_line leadz trailz storage_size merge_bits bge bgt ble blt dshiftl dshiftr findloc iall iany iparity image_index lcobound ucobound maskl maskr num_images parity popcnt poppar shifta shiftl shiftr this_image"};return{case_insensitive:!0,aliases:["f90","f95"],keywords:c,illegal:/\/\*/,contains:[a.inherit(a.APOS_STRING_MODE,{className:"string",relevance:0}),a.inherit(a.QUOTE_STRING_MODE,{className:"string",relevance:0}),{className:"function",beginKeywords:"subroutine function program",illegal:"[${=\\n]",contains:[a.UNDERSCORE_TITLE_MODE,b]},a.COMMENT("!","$",{relevance:0}),{className:"number",begin:"(?=\\b|\\+|\\-|\\.)(?=\\.\\d|\\d)(?:\\d+)?(?:\\.?\\d*)(?:[de][+-]?\\d+)?\\b\\.?",relevance:0}]}}),a.registerLanguage("fsharp",function(a){var b={begin:"<",end:">",contains:[a.inherit(a.TITLE_MODE,{begin:/'[a-zA-Z0-9_]+/})]};return{aliases:["fs"],keywords:"abstract and as assert base begin class default delegate do done downcast downto elif else end exception extern false finally for fun function global if in inherit inline interface internal lazy let match member module mutable namespace new null of open or override private public rec return sig static struct then to true try type upcast use val void when while with yield",illegal:/\/\*/,contains:[{className:"keyword",begin:/\b(yield|return|let|do)!/},{className:"string",begin:'@"',end:'"',contains:[{begin:'""'}]},{className:"string",begin:'"""',end:'"""'},a.COMMENT("\\(\\*","\\*\\)"),{className:"class",beginKeywords:"type",end:"\\(|=|$",excludeEnd:!0,contains:[a.UNDERSCORE_TITLE_MODE,b]},{className:"annotation",begin:"\\[<",end:">\\]",relevance:10},{className:"attribute",begin:"\\B('[A-Za-z])\\b",contains:[a.BACKSLASH_ESCAPE]},a.C_LINE_COMMENT_MODE,a.inherit(a.QUOTE_STRING_MODE,{illegal:null}),a.C_NUMBER_MODE]}}),a.registerLanguage("gams",function(a){var b="abort acronym acronyms alias all and assign binary card diag display else1 eps eq equation equations file files for1 free ge gt if inf integer le loop lt maximizing minimizing model models na ne negative no not option options or ord parameter parameters positive prod putpage puttl repeat sameas scalar scalars semicont semiint set1 sets smax smin solve sos1 sos2 sum system table then until using variable variables while1 xor yes";return{aliases:["gms"],case_insensitive:!0,keywords:b,contains:[{className:"section",beginKeywords:"sets parameters variables equations",end:";",contains:[{begin:"/",end:"/",contains:[a.NUMBER_MODE]}]},{className:"string",begin:"\\*{3}",end:"\\*{3}"},a.NUMBER_MODE,{className:"number",begin:"\\$[a-zA-Z0-9]+"}]}}),a.registerLanguage("gcode",function(a){var b="[A-Z_][A-Z0-9_.]*",c="\\%",d={literal:"",built_in:"",keyword:"IF DO WHILE ENDWHILE CALL ENDIF SUB ENDSUB GOTO REPEAT ENDREPEAT EQ LT GT NE GE LE OR XOR"},e={className:"preprocessor",begin:"([O])([0-9]+)"},f=[a.C_LINE_COMMENT_MODE,a.C_BLOCK_COMMENT_MODE,a.COMMENT(/\(/,/\)/),a.inherit(a.C_NUMBER_MODE,{begin:"([-+]?([0-9]*\\.?[0-9]+\\.?))|"+a.C_NUMBER_RE}),a.inherit(a.APOS_STRING_MODE,{illegal:null}),a.inherit(a.QUOTE_STRING_MODE,{illegal:null}),{className:"keyword",begin:"([G])([0-9]+\\.?[0-9]?)"},{className:"title",begin:"([M])([0-9]+\\.?[0-9]?)"},{className:"title",begin:"(VC|VS|#)",end:"(\\d+)"},{className:"title",begin:"(VZOFX|VZOFY|VZOFZ)"},{className:"built_in",begin:"(ATAN|ABS|ACOS|ASIN|SIN|COS|EXP|FIX|FUP|ROUND|LN|TAN)(\\[)",end:"([-+]?([0-9]*\\.?[0-9]+\\.?))(\\])"},{className:"label",variants:[{begin:"N",end:"\\d+",illegal:"\\W"}]}];return{aliases:["nc"],case_insensitive:!0,lexemes:b,keywords:d,contains:[{className:"preprocessor",begin:c},e].concat(f)}}),a.registerLanguage("gherkin",function(a){return{aliases:["feature"],keywords:"Feature Background Ability Business Need Scenario Scenarios Scenario Outline Scenario Template Examples Given And Then But When",contains:[{className:"keyword",begin:"\\*"},a.COMMENT("@[^@\r\n ]+","$"),{begin:"\\|",end:"\\|\\w*$",contains:[{className:"string",begin:"[^|]+"}]},{className:"variable",begin:"<",end:">"},a.HASH_COMMENT_MODE,{className:"string",begin:'"""',end:'"""'},a.QUOTE_STRING_MODE]}}),a.registerLanguage("glsl",function(a){return{keywords:{keyword:"atomic_uint attribute bool break bvec2 bvec3 bvec4 case centroid coherent const continue default discard dmat2 dmat2x2 dmat2x3 dmat2x4 dmat3 dmat3x2 dmat3x3 dmat3x4 dmat4 dmat4x2 dmat4x3 dmat4x4 do double dvec2 dvec3 dvec4 else flat float for highp if iimage1D iimage1DArray iimage2D iimage2DArray iimage2DMS iimage2DMSArray iimage2DRect iimage3D iimageBuffer iimageCube iimageCubeArray image1D image1DArray image2D image2DArray image2DMS image2DMSArray image2DRect image3D imageBuffer imageCube imageCubeArray in inout int invariant isampler1D isampler1DArray isampler2D isampler2DArray isampler2DMS isampler2DMSArray isampler2DRect isampler3D isamplerBuffer isamplerCube isamplerCubeArray ivec2 ivec3 ivec4 layout lowp mat2 mat2x2 mat2x3 mat2x4 mat3 mat3x2 mat3x3 mat3x4 mat4 mat4x2 mat4x3 mat4x4 mediump noperspective out patch precision readonly restrict return sample sampler1D sampler1DArray sampler1DArrayShadow sampler1DShadow sampler2D sampler2DArray sampler2DArrayShadow sampler2DMS sampler2DMSArray sampler2DRect sampler2DRectShadow sampler2DShadow sampler3D samplerBuffer samplerCube samplerCubeArray samplerCubeArrayShadow samplerCubeShadow smooth struct subroutine switch uimage1D uimage1DArray uimage2D uimage2DArray uimage2DMS uimage2DMSArray uimage2DRect uimage3D uimageBuffer uimageCube uimageCubeArray uint uniform usampler1D usampler1DArray usampler2D usampler2DArray usampler2DMS usampler2DMSArray usampler2DRect usampler3D usamplerBuffer usamplerCube usamplerCubeArray uvec2 uvec3 uvec4 varying vec2 vec3 vec4 void volatile while writeonly",built_in:"gl_BackColor gl_BackLightModelProduct gl_BackLightProduct gl_BackMaterial gl_BackSecondaryColor gl_ClipDistance gl_ClipPlane gl_ClipVertex gl_Color gl_DepthRange gl_EyePlaneQ gl_EyePlaneR gl_EyePlaneS gl_EyePlaneT gl_Fog gl_FogCoord gl_FogFragCoord gl_FragColor gl_FragCoord gl_FragData gl_FragDepth gl_FrontColor gl_FrontFacing gl_FrontLightModelProduct gl_FrontLightProduct gl_FrontMaterial gl_FrontSecondaryColor gl_InstanceID gl_InvocationID gl_Layer gl_LightModel gl_LightSource gl_MaxAtomicCounterBindings gl_MaxAtomicCounterBufferSize gl_MaxClipDistances gl_MaxClipPlanes gl_MaxCombinedAtomicCounterBuffers gl_MaxCombinedAtomicCounters gl_MaxCombinedImageUniforms gl_MaxCombinedImageUnitsAndFragmentOutputs gl_MaxCombinedTextureImageUnits gl_MaxDrawBuffers gl_MaxFragmentAtomicCounterBuffers gl_MaxFragmentAtomicCounters gl_MaxFragmentImageUniforms gl_MaxFragmentInputComponents gl_MaxFragmentUniformComponents gl_MaxFragmentUniformVectors gl_MaxGeometryAtomicCounterBuffers gl_MaxGeometryAtomicCounters gl_MaxGeometryImageUniforms gl_MaxGeometryInputComponents gl_MaxGeometryOutputComponents gl_MaxGeometryOutputVertices gl_MaxGeometryTextureImageUnits gl_MaxGeometryTotalOutputComponents gl_MaxGeometryUniformComponents gl_MaxGeometryVaryingComponents gl_MaxImageSamples gl_MaxImageUnits gl_MaxLights gl_MaxPatchVertices gl_MaxProgramTexelOffset gl_MaxTessControlAtomicCounterBuffers gl_MaxTessControlAtomicCounters gl_MaxTessControlImageUniforms gl_MaxTessControlInputComponents gl_MaxTessControlOutputComponents gl_MaxTessControlTextureImageUnits gl_MaxTessControlTotalOutputComponents gl_MaxTessControlUniformComponents gl_MaxTessEvaluationAtomicCounterBuffers gl_MaxTessEvaluationAtomicCounters gl_MaxTessEvaluationImageUniforms gl_MaxTessEvaluationInputComponents gl_MaxTessEvaluationOutputComponents gl_MaxTessEvaluationTextureImageUnits gl_MaxTessEvaluationUniformComponents gl_MaxTessGenLevel gl_MaxTessPatchComponents gl_MaxTextureCoords gl_MaxTextureImageUnits gl_MaxTextureUnits gl_MaxVaryingComponents gl_MaxVaryingFloats gl_MaxVaryingVectors gl_MaxVertexAtomicCounterBuffers gl_MaxVertexAtomicCounters gl_MaxVertexAttribs gl_MaxVertexImageUniforms gl_MaxVertexOutputComponents gl_MaxVertexTextureImageUnits gl_MaxVertexUniformComponents gl_MaxVertexUniformVectors gl_MaxViewports gl_MinProgramTexelOffsetgl_ModelViewMatrix gl_ModelViewMatrixInverse gl_ModelViewMatrixInverseTranspose gl_ModelViewMatrixTranspose gl_ModelViewProjectionMatrix gl_ModelViewProjectionMatrixInverse gl_ModelViewProjectionMatrixInverseTranspose gl_ModelViewProjectionMatrixTranspose gl_MultiTexCoord0 gl_MultiTexCoord1 gl_MultiTexCoord2 gl_MultiTexCoord3 gl_MultiTexCoord4 gl_MultiTexCoord5 gl_MultiTexCoord6 gl_MultiTexCoord7 gl_Normal gl_NormalMatrix gl_NormalScale gl_ObjectPlaneQ gl_ObjectPlaneR gl_ObjectPlaneS gl_ObjectPlaneT gl_PatchVerticesIn gl_PerVertex gl_Point gl_PointCoord gl_PointSize gl_Position gl_PrimitiveID gl_PrimitiveIDIn gl_ProjectionMatrix gl_ProjectionMatrixInverse gl_ProjectionMatrixInverseTranspose gl_ProjectionMatrixTranspose gl_SampleID gl_SampleMask gl_SampleMaskIn gl_SamplePosition gl_SecondaryColor gl_TessCoord gl_TessLevelInner gl_TessLevelOuter gl_TexCoord gl_TextureEnvColor gl_TextureMatrixInverseTranspose gl_TextureMatrixTranspose gl_Vertex gl_VertexID gl_ViewportIndex gl_in gl_out EmitStreamVertex EmitVertex EndPrimitive EndStreamPrimitive abs acos acosh all any asin asinh atan atanh atomicCounter atomicCounterDecrement atomicCounterIncrement barrier bitCount bitfieldExtract bitfieldInsert bitfieldReverse ceil clamp cos cosh cross dFdx dFdy degrees determinant distance dot equal exp exp2 faceforward findLSB findMSB floatBitsToInt floatBitsToUint floor fma fract frexp ftransform fwidth greaterThan greaterThanEqual imageAtomicAdd imageAtomicAnd imageAtomicCompSwap imageAtomicExchange imageAtomicMax imageAtomicMin imageAtomicOr imageAtomicXor imageLoad imageStore imulExtended intBitsToFloat interpolateAtCentroid interpolateAtOffset interpolateAtSample inverse inversesqrt isinf isnan ldexp length lessThan lessThanEqual log log2 matrixCompMult max memoryBarrier min mix mod modf noise1 noise2 noise3 noise4 normalize not notEqual outerProduct packDouble2x32 packHalf2x16 packSnorm2x16 packSnorm4x8 packUnorm2x16 packUnorm4x8 pow radians reflect refract round roundEven shadow1D shadow1DLod shadow1DProj shadow1DProjLod shadow2D shadow2DLod shadow2DProj shadow2DProjLod sign sin sinh smoothstep sqrt step tan tanh texelFetch texelFetchOffset texture texture1D texture1DLod texture1DProj texture1DProjLod texture2D texture2DLod texture2DProj texture2DProjLod texture3D texture3DLod texture3DProj texture3DProjLod textureCube textureCubeLod textureGather textureGatherOffset textureGatherOffsets textureGrad textureGradOffset textureLod textureLodOffset textureOffset textureProj textureProjGrad textureProjGradOffset textureProjLod textureProjLodOffset textureProjOffset textureQueryLod textureSize transpose trunc uaddCarry uintBitsToFloat umulExtended unpackDouble2x32 unpackHalf2x16 unpackSnorm2x16 unpackSnorm4x8 unpackUnorm2x16 unpackUnorm4x8 usubBorrow gl_TextureMatrix gl_TextureMatrixInverse",literal:"true false"},illegal:'"',contains:[a.C_LINE_COMMENT_MODE,a.C_BLOCK_COMMENT_MODE,a.C_NUMBER_MODE,{className:"preprocessor",begin:"#",end:"$"}]}}),a.registerLanguage("go",function(a){var b={keyword:"break default func interface select case map struct chan else goto package switch const fallthrough if range type continue for import return var go defer", +constant:"true false iota nil",typename:"bool byte complex64 complex128 float32 float64 int8 int16 int32 int64 string uint8 uint16 uint32 uint64 int uint uintptr rune",built_in:"append cap close complex copy imag len make new panic print println real recover delete"};return{aliases:["golang"],keywords:b,illegal:"",end:",\\s+",returnBegin:!0,endsWithParent:!0,contains:[{className:"symbol",begin:":\\w+"},a.APOS_STRING_MODE,a.QUOTE_STRING_MODE,{begin:"\\w+",relevance:0}]}]},{begin:"\\(\\s*",end:"\\s*\\)",excludeEnd:!0,contains:[{begin:"\\w+\\s*=",end:"\\s+",returnBegin:!0,endsWithParent:!0,contains:[{className:"attribute",begin:"\\w+",relevance:0},a.APOS_STRING_MODE,a.QUOTE_STRING_MODE,{begin:"\\w+",relevance:0}]}]}]},{className:"bullet",begin:"^\\s*[=~]\\s*",relevance:0},{begin:"#{",starts:{end:"}",subLanguage:"ruby"}}]}}),a.registerLanguage("handlebars",function(a){var b="each in with if else unless bindattr action collection debugger log outlet template unbound view yield";return{aliases:["hbs","html.hbs","html.handlebars"],case_insensitive:!0,subLanguage:"xml",contains:[{className:"expression",begin:"{{",end:"}}",contains:[{className:"begin-block",begin:"#[a-zA-Z- .]+",keywords:b},{className:"string",begin:'"',end:'"'},{className:"end-block",begin:"\\/[a-zA-Z- .]+",keywords:b},{className:"variable",begin:"[a-zA-Z-.]+",keywords:b}]}]}}),a.registerLanguage("haskell",function(a){var b=[a.COMMENT("--","$"),a.COMMENT("{-","-}",{contains:["self"]})],c={className:"pragma",begin:"{-#",end:"#-}"},d={className:"preprocessor",begin:"^#",end:"$"},e={className:"type",begin:"\\b[A-Z][\\w']*",relevance:0},f={className:"container",begin:"\\(",end:"\\)",illegal:'"',contains:[c,d,{className:"type",begin:"\\b[A-Z][\\w]*(\\((\\.\\.|,|\\w+)\\))?"},a.inherit(a.TITLE_MODE,{begin:"[_a-z][\\w']*"})].concat(b)},g={className:"container",begin:"{",end:"}",contains:f.contains};return{aliases:["hs"],keywords:"let in if then else case of where do module import hiding qualified type data newtype deriving class instance as default infix infixl infixr foreign export ccall stdcall cplusplus jvm dotnet safe unsafe family forall mdo proc rec",contains:[{className:"module",begin:"\\bmodule\\b",end:"where",keywords:"module where",contains:[f].concat(b),illegal:"\\W\\.|;"},{className:"import",begin:"\\bimport\\b",end:"$",keywords:"import|0 qualified as hiding",contains:[f].concat(b),illegal:"\\W\\.|;"},{className:"class",begin:"^(\\s*)?(class|instance)\\b",end:"where",keywords:"class family instance where",contains:[e,f].concat(b)},{className:"typedef",begin:"\\b(data|(new)?type)\\b",end:"$",keywords:"data family type newtype deriving",contains:[c,e,f,g].concat(b)},{className:"default",beginKeywords:"default",end:"$",contains:[e,f].concat(b)},{className:"infix",beginKeywords:"infix infixl infixr",end:"$",contains:[a.C_NUMBER_MODE].concat(b)},{className:"foreign",begin:"\\bforeign\\b",end:"$",keywords:"foreign import export ccall stdcall cplusplus jvm dotnet safe unsafe",contains:[e,a.QUOTE_STRING_MODE].concat(b)},{className:"shebang",begin:"#!\\/usr\\/bin\\/env runhaskell",end:"$"},c,d,a.QUOTE_STRING_MODE,a.C_NUMBER_MODE,e,a.inherit(a.TITLE_MODE,{begin:"^[_a-z][\\w']*"}),{begin:"->|<-"}].concat(b)}}),a.registerLanguage("haxe",function(a){var b="([*]|[a-zA-Z_$][a-zA-Z0-9_$]*)";return{aliases:["hx"],keywords:{keyword:"break callback case cast catch class continue default do dynamic else enum extends extern for function here if implements import in inline interface never new override package private public return static super switch this throw trace try typedef untyped using var while",literal:"true false null"},contains:[a.APOS_STRING_MODE,a.QUOTE_STRING_MODE,a.C_LINE_COMMENT_MODE,a.C_BLOCK_COMMENT_MODE,a.C_NUMBER_MODE,{className:"class",beginKeywords:"class interface",end:"{",excludeEnd:!0,contains:[{beginKeywords:"extends implements"},a.TITLE_MODE]},{className:"preprocessor",begin:"#",end:"$",keywords:"if else elseif end error"},{className:"function",beginKeywords:"function",end:"[{;]",excludeEnd:!0,illegal:"\\S",contains:[a.TITLE_MODE,{className:"params",begin:"\\(",end:"\\)",contains:[a.APOS_STRING_MODE,a.QUOTE_STRING_MODE,a.C_LINE_COMMENT_MODE,a.C_BLOCK_COMMENT_MODE]},{className:"type",begin:":",end:b,relevance:10}]}]}}),a.registerLanguage("http",function(a){return{aliases:["https"],illegal:"\\S",contains:[{className:"status",begin:"^HTTP/[0-9\\.]+",end:"$",contains:[{className:"number",begin:"\\b\\d{3}\\b"}]},{className:"request",begin:"^[A-Z]+ (.*?) HTTP/[0-9\\.]+$",returnBegin:!0,end:"$",contains:[{className:"string",begin:" ",end:" ",excludeBegin:!0,excludeEnd:!0}]},{className:"attribute",begin:"^\\w",end:": ",excludeEnd:!0,illegal:"\\n|\\s|=",starts:{className:"string",end:"$"}},{begin:"\\n\\n",starts:{subLanguage:[],endsWithParent:!0}}]}}),a.registerLanguage("inform7",function(a){var b="\\[",c="\\]";return{aliases:["i7"],case_insensitive:!0,keywords:{keyword:"thing room person man woman animal container supporter backdrop door scenery open closed locked inside gender is are say understand kind of rule"},contains:[{className:"string",begin:'"',end:'"',relevance:0,contains:[{className:"subst",begin:b,end:c}]},{className:"title",begin:/^(Volume|Book|Part|Chapter|Section|Table)\b/,end:"$"},{begin:/^(Check|Carry out|Report|Instead of|To|Rule|When|Before|After)\b/,end:":",contains:[{begin:"\\b\\(This",end:"\\)"}]},{className:"comment",begin:b,end:c,contains:["self"]}]}}),a.registerLanguage("ini",function(a){var b={className:"string",contains:[a.BACKSLASH_ESCAPE],variants:[{begin:"'''",end:"'''",relevance:10},{begin:'"""',end:'"""',relevance:10},{begin:'"',end:'"'},{begin:"'",end:"'"}]};return{aliases:["toml"],case_insensitive:!0,illegal:/\S/,contains:[a.COMMENT(";","$"),a.HASH_COMMENT_MODE,{className:"title",begin:/^\s*\[+/,end:/\]+/},{className:"setting",begin:/^[a-z0-9\[\]_-]+\s*=\s*/,end:"$",contains:[{className:"value",endsWithParent:!0,keywords:"on off true false yes no",contains:[{className:"variable",variants:[{begin:/\$[\w\d"][\w\d_]*/},{begin:/\$\{(.*?)}/}]},b,{className:"number",begin:/([\+\-]+)?[\d]+_[\d_]+/},a.NUMBER_MODE],relevance:0}]}]}}),a.registerLanguage("irpf90",function(a){var b={className:"params",begin:"\\(",end:"\\)"},c={constant:".False. .True.",type:"integer real character complex logical dimension allocatable|10 parameter external implicit|10 none double precision assign intent optional pointer target in out common equivalence data",keyword:"kind do while private call intrinsic where elsewhere type endtype endmodule endselect endinterface end enddo endif if forall endforall only contains default return stop then public subroutine|10 function program .and. .or. .not. .le. .eq. .ge. .gt. .lt. goto save else use module select case access blank direct exist file fmt form formatted iostat name named nextrec number opened rec recl sequential status unformatted unit continue format pause cycle exit c_null_char c_alert c_backspace c_form_feed flush wait decimal round iomsg synchronous nopass non_overridable pass protected volatile abstract extends import non_intrinsic value deferred generic final enumerator class associate bind enum c_int c_short c_long c_long_long c_signed_char c_size_t c_int8_t c_int16_t c_int32_t c_int64_t c_int_least8_t c_int_least16_t c_int_least32_t c_int_least64_t c_int_fast8_t c_int_fast16_t c_int_fast32_t c_int_fast64_t c_intmax_t C_intptr_t c_float c_double c_long_double c_float_complex c_double_complex c_long_double_complex c_bool c_char c_null_ptr c_null_funptr c_new_line c_carriage_return c_horizontal_tab c_vertical_tab iso_c_binding c_loc c_funloc c_associated c_f_pointer c_ptr c_funptr iso_fortran_env character_storage_size error_unit file_storage_size input_unit iostat_end iostat_eor numeric_storage_size output_unit c_f_procpointer ieee_arithmetic ieee_support_underflow_control ieee_get_underflow_mode ieee_set_underflow_mode newunit contiguous recursive pad position action delim readwrite eor advance nml interface procedure namelist include sequence elemental pure begin_provider &begin_provider end_provider begin_shell end_shell begin_template end_template subst assert touch soft_touch provide no_dep free irp_if irp_else irp_endif irp_write irp_read",built_in:"alog alog10 amax0 amax1 amin0 amin1 amod cabs ccos cexp clog csin csqrt dabs dacos dasin datan datan2 dcos dcosh ddim dexp dint dlog dlog10 dmax1 dmin1 dmod dnint dsign dsin dsinh dsqrt dtan dtanh float iabs idim idint idnint ifix isign max0 max1 min0 min1 sngl algama cdabs cdcos cdexp cdlog cdsin cdsqrt cqabs cqcos cqexp cqlog cqsin cqsqrt dcmplx dconjg derf derfc dfloat dgamma dimag dlgama iqint qabs qacos qasin qatan qatan2 qcmplx qconjg qcos qcosh qdim qerf qerfc qexp qgamma qimag qlgama qlog qlog10 qmax1 qmin1 qmod qnint qsign qsin qsinh qsqrt qtan qtanh abs acos aimag aint anint asin atan atan2 char cmplx conjg cos cosh exp ichar index int log log10 max min nint sign sin sinh sqrt tan tanh print write dim lge lgt lle llt mod nullify allocate deallocate adjustl adjustr all allocated any associated bit_size btest ceiling count cshift date_and_time digits dot_product eoshift epsilon exponent floor fraction huge iand ibclr ibits ibset ieor ior ishft ishftc lbound len_trim matmul maxexponent maxloc maxval merge minexponent minloc minval modulo mvbits nearest pack present product radix random_number random_seed range repeat reshape rrspacing scale scan selected_int_kind selected_real_kind set_exponent shape size spacing spread sum system_clock tiny transpose trim ubound unpack verify achar iachar transfer dble entry dprod cpu_time command_argument_count get_command get_command_argument get_environment_variable is_iostat_end ieee_arithmetic ieee_support_underflow_control ieee_get_underflow_mode ieee_set_underflow_mode is_iostat_eor move_alloc new_line selected_char_kind same_type_as extends_type_ofacosh asinh atanh bessel_j0 bessel_j1 bessel_jn bessel_y0 bessel_y1 bessel_yn erf erfc erfc_scaled gamma log_gamma hypot norm2 atomic_define atomic_ref execute_command_line leadz trailz storage_size merge_bits bge bgt ble blt dshiftl dshiftr findloc iall iany iparity image_index lcobound ucobound maskl maskr num_images parity popcnt poppar shifta shiftl shiftr this_image IRP_ALIGN irp_here"};return{case_insensitive:!0,keywords:c,illegal:/\/\*/,contains:[a.inherit(a.APOS_STRING_MODE,{className:"string",relevance:0}),a.inherit(a.QUOTE_STRING_MODE,{className:"string",relevance:0}),{className:"function",beginKeywords:"subroutine function program",illegal:"[${=\\n]",contains:[a.UNDERSCORE_TITLE_MODE,b]},a.COMMENT("!","$",{relevance:0}),a.COMMENT("begin_doc","end_doc",{relevance:10}),{className:"number",begin:"(?=\\b|\\+|\\-|\\.)(?=\\.\\d|\\d)(?:\\d+)?(?:\\.?\\d*)(?:[de][+-]?\\d+)?\\b\\.?",relevance:0}]}}),a.registerLanguage("java",function(a){var b=a.UNDERSCORE_IDENT_RE+"(<"+a.UNDERSCORE_IDENT_RE+">)?",c="false synchronized int abstract float private char boolean static null if const for true while long strictfp finally protected import native final void enum else break transient catch instanceof byte super volatile case assert short package default double public try this switch continue throws protected public private",d="\\b(0[bB]([01]+[01_]+[01]+|[01]+)|0[xX]([a-fA-F0-9]+[a-fA-F0-9_]+[a-fA-F0-9]+|[a-fA-F0-9]+)|(([\\d]+[\\d_]+[\\d]+|[\\d]+)(\\.([\\d]+[\\d_]+[\\d]+|[\\d]+))?|\\.([\\d]+[\\d_]+[\\d]+|[\\d]+))([eE][-+]?\\d+)?)[lLfF]?",e={className:"number",begin:d,relevance:0};return{aliases:["jsp"],keywords:c,illegal:/<\/|#/,contains:[a.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"}]}),a.C_LINE_COMMENT_MODE,a.C_BLOCK_COMMENT_MODE,a.APOS_STRING_MODE,a.QUOTE_STRING_MODE,{className:"class",beginKeywords:"class interface",end:/[{;=]/,excludeEnd:!0,keywords:"class interface",illegal:/[:"\[\]]/,contains:[{beginKeywords:"extends implements"},a.UNDERSCORE_TITLE_MODE]},{beginKeywords:"new throw return else",relevance:0},{className:"function",begin:"("+b+"\\s+)+"+a.UNDERSCORE_IDENT_RE+"\\s*\\(",returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:c,contains:[{begin:a.UNDERSCORE_IDENT_RE+"\\s*\\(",returnBegin:!0,relevance:0,contains:[a.UNDERSCORE_TITLE_MODE]},{className:"params",begin:/\(/,end:/\)/,keywords:c,relevance:0,contains:[a.APOS_STRING_MODE,a.QUOTE_STRING_MODE,a.C_NUMBER_MODE,a.C_BLOCK_COMMENT_MODE]},a.C_LINE_COMMENT_MODE,a.C_BLOCK_COMMENT_MODE]},e,{className:"annotation",begin:"@[A-Za-z]+"}]}}),a.registerLanguage("javascript",function(a){return{aliases:["js"],keywords:{keyword:"in of if for while finally var new function do return void else break catch instanceof with throw case default try this switch continue typeof delete let yield const export super debugger as async await",literal:"true false null undefined NaN Infinity",built_in:"eval isFinite isNaN parseFloat parseInt decodeURI decodeURIComponent encodeURI encodeURIComponent escape unescape Object Function Boolean Error EvalError InternalError RangeError ReferenceError StopIteration SyntaxError TypeError URIError Number Math Date String RegExp Array Float32Array Float64Array Int16Array Int32Array Int8Array Uint16Array Uint32Array Uint8Array Uint8ClampedArray ArrayBuffer DataView JSON Intl arguments require module console window document Symbol Set Map WeakSet WeakMap Proxy Reflect Promise"},contains:[{className:"pi",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},a.APOS_STRING_MODE,a.QUOTE_STRING_MODE,{className:"string",begin:"`",end:"`",contains:[a.BACKSLASH_ESCAPE,{className:"subst",begin:"\\$\\{",end:"\\}"}]},a.C_LINE_COMMENT_MODE,a.C_BLOCK_COMMENT_MODE,{className:"number",variants:[{begin:"\\b(0[bB][01]+)"},{begin:"\\b(0[oO][0-7]+)"},{begin:a.C_NUMBER_RE}],relevance:0},{begin:"("+a.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",contains:[a.C_LINE_COMMENT_MODE,a.C_BLOCK_COMMENT_MODE,a.REGEXP_MODE,{begin:/\s*[);\]]/,relevance:0,subLanguage:"xml"}],relevance:0},{className:"function",beginKeywords:"function",end:/\{/,excludeEnd:!0,contains:[a.inherit(a.TITLE_MODE,{begin:/[A-Za-z$_][0-9A-Za-z$_]*/}),{className:"params",begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,contains:[a.C_LINE_COMMENT_MODE,a.C_BLOCK_COMMENT_MODE]}],illegal:/\[|%/},{begin:/\$[(.]/},{begin:"\\."+a.IDENT_RE,relevance:0},{beginKeywords:"import",end:"[;$]",keywords:"import from as",contains:[a.APOS_STRING_MODE,a.QUOTE_STRING_MODE]},{className:"class",beginKeywords:"class",end:/[{;=]/,excludeEnd:!0,illegal:/[:"\[\]]/,contains:[{beginKeywords:"extends"},a.UNDERSCORE_TITLE_MODE]}],illegal:/#/}}),a.registerLanguage("json",function(a){var b={literal:"true false null"},c=[a.QUOTE_STRING_MODE,a.C_NUMBER_MODE],d={className:"value",end:",",endsWithParent:!0,excludeEnd:!0,contains:c,keywords:b},e={begin:"{",end:"}",contains:[{className:"attribute",begin:'\\s*"',end:'"\\s*:\\s*',excludeBegin:!0,excludeEnd:!0,contains:[a.BACKSLASH_ESCAPE],illegal:"\\n",starts:d}],illegal:"\\S"},f={begin:"\\[",end:"\\]",contains:[a.inherit(d,{className:null})],illegal:"\\S"};return c.splice(c.length,0,e,f),{contains:c,keywords:b,illegal:"\\S"}}),a.registerLanguage("julia",function(a){var b={keyword:"in abstract baremodule begin bitstype break catch ccall const continue do else elseif end export finally for function global if immutable import importall let local macro module quote return try type typealias using while",literal:"true false ANY ARGS CPU_CORES C_NULL DL_LOAD_PATH DevNull ENDIAN_BOM ENV I|0 Inf Inf16 Inf32 InsertionSort JULIA_HOME LOAD_PATH MS_ASYNC MS_INVALIDATE MS_SYNC MergeSort NaN NaN16 NaN32 OS_NAME QuickSort RTLD_DEEPBIND RTLD_FIRST RTLD_GLOBAL RTLD_LAZY RTLD_LOCAL RTLD_NODELETE RTLD_NOLOAD RTLD_NOW RoundDown RoundFromZero RoundNearest RoundToZero RoundUp STDERR STDIN STDOUT VERSION WORD_SIZE catalan cglobal e|0 eu|0 eulergamma golden im nothing pi γ π φ",built_in:"ASCIIString AbstractArray AbstractRNG AbstractSparseArray Any ArgumentError Array Associative Base64Pipe Bidiagonal BigFloat BigInt BitArray BitMatrix BitVector Bool BoundsError Box CFILE Cchar Cdouble Cfloat Char CharString Cint Clong Clonglong ClusterManager Cmd Coff_t Colon Complex Complex128 Complex32 Complex64 Condition Cptrdiff_t Cshort Csize_t Cssize_t Cuchar Cuint Culong Culonglong Cushort Cwchar_t DArray DataType DenseArray Diagonal Dict DimensionMismatch DirectIndexString Display DivideError DomainError EOFError EachLine Enumerate ErrorException Exception Expr Factorization FileMonitor FileOffset Filter Float16 Float32 Float64 FloatRange FloatingPoint Function GetfieldNode GotoNode Hermitian IO IOBuffer IOStream IPv4 IPv6 InexactError Int Int128 Int16 Int32 Int64 Int8 IntSet Integer InterruptException IntrinsicFunction KeyError LabelNode LambdaStaticData LineNumberNode LoadError LocalProcess MIME MathConst MemoryError MersenneTwister Method MethodError MethodTable Module NTuple NewvarNode Nothing Number ObjectIdDict OrdinalRange OverflowError ParseError PollingFileWatcher ProcessExitedException ProcessGroup Ptr QuoteNode Range Range1 Ranges Rational RawFD Real Regex RegexMatch RemoteRef RepString RevString RopeString RoundingMode Set SharedArray Signed SparseMatrixCSC StackOverflowError Stat StatStruct StepRange String SubArray SubString SymTridiagonal Symbol SymbolNode Symmetric SystemError Task TextDisplay Timer TmStruct TopNode Triangular Tridiagonal Type TypeConstructor TypeError TypeName TypeVar UTF16String UTF32String UTF8String UdpSocket Uint Uint128 Uint16 Uint32 Uint64 Uint8 UndefRefError UndefVarError UniformScaling UnionType UnitRange Unsigned Vararg VersionNumber WString WeakKeyDict WeakRef Woodbury Zip"},c="[A-Za-z_\\u00A1-\\uFFFF][A-Za-z_0-9\\u00A1-\\uFFFF]*",d={lexemes:c,keywords:b},e={className:"type-annotation",begin:/::/},f={className:"subtype",begin:/<:/},g={className:"number",begin:/(\b0x[\d_]*(\.[\d_]*)?|0x\.\d[\d_]*)p[-+]?\d+|\b0[box][a-fA-F0-9][a-fA-F0-9_]*|(\b\d[\d_]*(\.[\d_]*)?|\.\d[\d_]*)([eEfF][-+]?\d+)?/,relevance:0},h={className:"char",begin:/'(.|\\[xXuU][a-zA-Z0-9]+)'/},i={className:"subst",begin:/\$\(/,end:/\)/,keywords:b},j={className:"variable",begin:"\\$"+c},k={className:"string",contains:[a.BACKSLASH_ESCAPE,i,j],variants:[{begin:/\w*"/,end:/"\w*/},{begin:/\w*"""/,end:/"""\w*/}]},l={className:"string",contains:[a.BACKSLASH_ESCAPE,i,j],begin:"`",end:"`"},m={className:"macrocall",begin:"@"+c},n={className:"comment",variants:[{begin:"#=",end:"=#",relevance:10},{begin:"#",end:"$"}]};return d.contains=[g,h,e,f,k,l,m,n,a.HASH_COMMENT_MODE],i.contains=d.contains,d}),a.registerLanguage("kotlin",function(a){var b="val var get set class trait object public open private protected final enum if else do while for when break continue throw try catch finally import package is as in return fun override default companion reified inline volatile transient native";return{keywords:{typename:"Byte Short Char Int Long Boolean Float Double Void Unit Nothing",literal:"true false null",keyword:b},contains:[a.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"}]}),a.C_LINE_COMMENT_MODE,a.C_BLOCK_COMMENT_MODE,{className:"type",begin://,returnBegin:!0,excludeEnd:!1,relevance:0},{className:"function",beginKeywords:"fun",end:"[(]|$",returnBegin:!0,excludeEnd:!0,keywords:b,illegal:/fun\s+(<.*>)?[^\s\(]+(\s+[^\s\(]+)\s*=/,relevance:5,contains:[{begin:a.UNDERSCORE_IDENT_RE+"\\s*\\(",returnBegin:!0,relevance:0,contains:[a.UNDERSCORE_TITLE_MODE]},{className:"type",begin://,keywords:"reified",relevance:0},{className:"params",begin:/\(/,end:/\)/,keywords:b,relevance:0,illegal:/\([^\(,\s:]+,/,contains:[{className:"typename",begin:/:\s*/,end:/\s*[=\)]/,excludeBegin:!0,returnEnd:!0,relevance:0}]},a.C_LINE_COMMENT_MODE,a.C_BLOCK_COMMENT_MODE]},{className:"class",beginKeywords:"class trait",end:/[:\{(]|$/,excludeEnd:!0,illegal:"extends implements",contains:[a.UNDERSCORE_TITLE_MODE,{className:"type",begin://,excludeBegin:!0,excludeEnd:!0,relevance:0},{className:"typename",begin:/[,:]\s*/,end:/[<\(,]|$/,excludeBegin:!0,returnEnd:!0}]},{className:"variable",beginKeywords:"var val",end:/\s*[=:$]/,excludeEnd:!0},a.QUOTE_STRING_MODE,{className:"shebang",begin:"^#!/usr/bin/env",end:"$",illegal:"\n"},a.C_NUMBER_MODE]}}),a.registerLanguage("lasso",function(a){var b="[a-zA-Z_][a-zA-Z0-9_.]*",c="<\\?(lasso(script)?|=)",d="\\]|\\?>",e={literal:"true false none minimal full all void bw nbw ew new cn ncn lt lte gt gte eq neq rx nrx ft",built_in:"array date decimal duration integer map pair string tag xml null boolean bytes keyword list locale queue set stack staticarray local var variable global data self inherited currentcapture givenblock",keyword:"error_code error_msg error_pop error_push error_reset cache database_names database_schemanames database_tablenames define_tag define_type email_batch encode_set html_comment handle handle_error header if inline iterate ljax_target link link_currentaction link_currentgroup link_currentrecord link_detail link_firstgroup link_firstrecord link_lastgroup link_lastrecord link_nextgroup link_nextrecord link_prevgroup link_prevrecord log loop namespace_using output_none portal private protect records referer referrer repeating resultset rows search_args search_arguments select sort_args sort_arguments thread_atomic value_list while abort case else if_empty if_false if_null if_true loop_abort loop_continue loop_count params params_up return return_value run_children soap_definetag soap_lastrequest soap_lastresponse tag_name ascending average by define descending do equals frozen group handle_failure import in into join let match max min on order parent protected provide public require returnhome skip split_thread sum take thread to trait type where with yield yieldhome"},f=a.COMMENT("",{relevance:0}),g={className:"preprocessor",begin:"\\[noprocess\\]",starts:{className:"markup",end:"\\[/noprocess\\]",returnEnd:!0,contains:[f]}},h={className:"preprocessor",begin:"\\[/noprocess|"+c},i={className:"variable",begin:"'"+b+"'"},j=[a.COMMENT("/\\*\\*!","\\*/"),a.C_LINE_COMMENT_MODE,a.C_BLOCK_COMMENT_MODE,a.inherit(a.C_NUMBER_MODE,{begin:a.C_NUMBER_RE+"|(infinity|nan)\\b"}),a.inherit(a.APOS_STRING_MODE,{illegal:null}),a.inherit(a.QUOTE_STRING_MODE,{illegal:null}),{className:"string",begin:"`",end:"`"},{className:"variable",variants:[{begin:"[#$]"+b},{begin:"#",end:"\\d+",illegal:"\\W"}]},{className:"tag",begin:"::\\s*",end:b,illegal:"\\W"},{className:"attribute",variants:[{begin:"-(?!infinity)"+a.UNDERSCORE_IDENT_RE,relevance:0},{begin:"(\\.\\.\\.)"}]},{className:"subst",variants:[{begin:"->\\s*",contains:[i]},{begin:"->|\\\\|&&?|\\|\\||!(?!=|>)|(and|or|not)\\b",relevance:0}]},{className:"built_in",begin:"\\.\\.?\\s*",relevance:0,contains:[i]},{className:"class",beginKeywords:"define",returnEnd:!0,end:"\\(|=>",contains:[a.inherit(a.TITLE_MODE,{begin:a.UNDERSCORE_IDENT_RE+"(=(?!>))?"})]}];return{aliases:["ls","lassoscript"],case_insensitive:!0,lexemes:b+"|&[lg]t;",keywords:e,contains:[{className:"preprocessor",begin:d,relevance:0,starts:{className:"markup",end:"\\[|"+c,returnEnd:!0,relevance:0,contains:[f]}},g,h,{className:"preprocessor",begin:"\\[no_square_brackets",starts:{end:"\\[/no_square_brackets\\]",lexemes:b+"|&[lg]t;",keywords:e,contains:[{className:"preprocessor",begin:d,relevance:0,starts:{className:"markup",end:"\\[noprocess\\]|"+c,returnEnd:!0,contains:[f]}},g,h].concat(j)}},{className:"preprocessor",begin:"\\[",relevance:0},{className:"shebang",begin:"^#!.+lasso9\\b",relevance:10}].concat(j)}}),a.registerLanguage("less",function(a){var b="[\\w-]+",c="("+b+"|@{"+b+"})",d=[],e=[],f=function(a){return{className:"string",begin:"~?"+a+".*?"+a}},g=function(a,b,c){return{className:a,begin:b,relevance:c}},h=function(b,c,d){return a.inherit({className:b,begin:c+"\\(",end:"\\(",returnBegin:!0,excludeEnd:!0,relevance:0},d)},i={begin:"\\(",end:"\\)",contains:e,relevance:0};e.push(a.C_LINE_COMMENT_MODE,a.C_BLOCK_COMMENT_MODE,f("'"),f('"'),a.CSS_NUMBER_MODE,g("hexcolor","#[0-9A-Fa-f]+\\b"),h("function","(url|data-uri)",{starts:{className:"string",end:"[\\)\\n]",excludeEnd:!0}}),h("function",b),i,g("variable","@@?"+b,10),g("variable","@{"+b+"}"),g("built_in","~?`[^`]*?`"),{className:"attribute",begin:b+"\\s*:",end:":",returnBegin:!0,excludeEnd:!0});var j=e.concat({begin:"{",end:"}",contains:d}),k={beginKeywords:"when",endsWithParent:!0,contains:[{beginKeywords:"and not"}].concat(e)},l={className:"attribute",begin:c,end:":",excludeEnd:!0,contains:[a.C_LINE_COMMENT_MODE,a.C_BLOCK_COMMENT_MODE],illegal:/\S/,starts:{end:"[;}]",returnEnd:!0,contains:e,illegal:"[<=$]"}},m={className:"at_rule",begin:"@(import|media|charset|font-face|(-[a-z]+-)?keyframes|supports|document|namespace|page|viewport|host)\\b",starts:{end:"[;{}]",returnEnd:!0,contains:e,relevance:0}},n={className:"variable",variants:[{begin:"@"+b+"\\s*:",relevance:15},{begin:"@"+b}],starts:{end:"[;}]",returnEnd:!0,contains:j}},o={variants:[{begin:"[\\.#:&\\[]",end:"[;{}]"},{begin:c+"[^;]*{",end:"{"}],returnBegin:!0,returnEnd:!0,illegal:"[<='$\"]",contains:[a.C_LINE_COMMENT_MODE,a.C_BLOCK_COMMENT_MODE,k,g("keyword","all\\b"),g("variable","@{"+b+"}"),g("tag",c+"%?",0),g("id","#"+c),g("class","\\."+c,0),g("keyword","&",0),h("pseudo",":not"),h("keyword",":extend"),g("pseudo","::?"+c),{className:"attr_selector",begin:"\\[",end:"\\]"},{begin:"\\(",end:"\\)",contains:j},{begin:"!important"}]};return d.push(a.C_LINE_COMMENT_MODE,a.C_BLOCK_COMMENT_MODE,m,n,o,l),{case_insensitive:!0,illegal:"[=>'/<($\"]",contains:d}}),a.registerLanguage("lisp",function(a){var b="[a-zA-Z_\\-\\+\\*\\/\\<\\=\\>\\&\\#][a-zA-Z0-9_\\-\\+\\*\\/\\<\\=\\>\\&\\#!]*",c="\\|[^]*?\\|",d="(\\-|\\+)?\\d+(\\.\\d+|\\/\\d+)?((d|e|f|l|s|D|E|F|L|S)(\\+|\\-)?\\d+)?",e={className:"shebang",begin:"^#!",end:"$"},f={className:"literal",begin:"\\b(t{1}|nil)\\b"},g={className:"number",variants:[{begin:d,relevance:0},{begin:"#(b|B)[0-1]+(/[0-1]+)?"},{begin:"#(o|O)[0-7]+(/[0-7]+)?"},{begin:"#(x|X)[0-9a-fA-F]+(/[0-9a-fA-F]+)?"},{begin:"#(c|C)\\("+d+" +"+d,end:"\\)"}]},h=a.inherit(a.QUOTE_STRING_MODE,{illegal:null}),i=a.COMMENT(";","$",{relevance:0}),j={className:"variable",begin:"\\*",end:"\\*"},k={className:"keyword",begin:"[:&]"+b},l={begin:b,relevance:0},m={begin:c},n={begin:"\\(",end:"\\)",contains:["self",f,h,g,l]},o={className:"quoted",contains:[g,h,j,k,n,l],variants:[{begin:"['`]\\(",end:"\\)"},{begin:"\\(quote ",end:"\\)",keywords:"quote"},{begin:"'"+c}]},p={className:"quoted",variants:[{begin:"'"+b},{begin:"#'"+b+"(::"+b+")*"}]},q={className:"list",begin:"\\(\\s*",end:"\\)"},r={endsWithParent:!0,relevance:0};return q.contains=[{className:"keyword",variants:[{begin:b},{begin:c}]},r],r.contains=[o,p,q,f,g,h,i,j,k,m,l],{illegal:/\S/,contains:[g,e,f,h,i,o,p,q,l]}}),a.registerLanguage("livecodeserver",function(a){var b={className:"variable",begin:"\\b[gtps][A-Z]+[A-Za-z0-9_\\-]*\\b|\\$_[A-Z]+",relevance:0},c=[a.C_BLOCK_COMMENT_MODE,a.HASH_COMMENT_MODE,a.COMMENT("--","$"),a.COMMENT("[^:]//","$")],d=a.inherit(a.TITLE_MODE,{variants:[{begin:"\\b_*rig[A-Z]+[A-Za-z0-9_\\-]*"},{begin:"\\b_[a-z0-9\\-]+"}]}),e=a.inherit(a.TITLE_MODE,{begin:"\\b([A-Za-z0-9_\\-]+)\\b"});return{case_insensitive:!1,keywords:{keyword:"$_COOKIE $_FILES $_GET $_GET_BINARY $_GET_RAW $_POST $_POST_BINARY $_POST_RAW $_SESSION $_SERVER codepoint codepoints segment segments codeunit codeunits sentence sentences trueWord trueWords paragraph after byte bytes english the until http forever descending using line real8 with seventh for stdout finally element word words fourth before black ninth sixth characters chars stderr uInt1 uInt1s uInt2 uInt2s stdin string lines relative rel any fifth items from middle mid at else of catch then third it file milliseconds seconds second secs sec int1 int1s int4 int4s internet int2 int2s normal text item last long detailed effective uInt4 uInt4s repeat end repeat URL in try into switch to words https token binfile each tenth as ticks tick system real4 by dateItems without char character ascending eighth whole dateTime numeric short first ftp integer abbreviated abbr abbrev private case while if", +constant:"SIX TEN FORMFEED NINE ZERO NONE SPACE FOUR FALSE COLON CRLF PI COMMA ENDOFFILE EOF EIGHT FIVE QUOTE EMPTY ONE TRUE RETURN CR LINEFEED RIGHT BACKSLASH NULL SEVEN TAB THREE TWO six ten formfeed nine zero none space four false colon crlf pi comma endoffile eof eight five quote empty one true return cr linefeed right backslash null seven tab three two RIVERSION RISTATE FILE_READ_MODE FILE_WRITE_MODE FILE_WRITE_MODE DIR_WRITE_MODE FILE_READ_UMASK FILE_WRITE_UMASK DIR_READ_UMASK DIR_WRITE_UMASK",operator:"div mod wrap and or bitAnd bitNot bitOr bitXor among not in a an within contains ends with begins the keys of keys",built_in:"put abs acos aliasReference annuity arrayDecode arrayEncode asin atan atan2 average avg avgDev base64Decode base64Encode baseConvert binaryDecode binaryEncode byteOffset byteToNum cachedURL cachedURLs charToNum cipherNames codepointOffset codepointProperty codepointToNum codeunitOffset commandNames compound compress constantNames cos date dateFormat decompress directories diskSpace DNSServers exp exp1 exp2 exp10 extents files flushEvents folders format functionNames geometricMean global globals hasMemory harmonicMean hostAddress hostAddressToName hostName hostNameToAddress isNumber ISOToMac itemOffset keys len length libURLErrorData libUrlFormData libURLftpCommand libURLLastHTTPHeaders libURLLastRHHeaders libUrlMultipartFormAddPart libUrlMultipartFormData libURLVersion lineOffset ln ln1 localNames log log2 log10 longFilePath lower macToISO matchChunk matchText matrixMultiply max md5Digest median merge millisec millisecs millisecond milliseconds min monthNames nativeCharToNum normalizeText num number numToByte numToChar numToCodepoint numToNativeChar offset open openfiles openProcesses openProcessIDs openSockets paragraphOffset paramCount param params peerAddress pendingMessages platform popStdDev populationStandardDeviation populationVariance popVariance processID random randomBytes replaceText result revCreateXMLTree revCreateXMLTreeFromFile revCurrentRecord revCurrentRecordIsFirst revCurrentRecordIsLast revDatabaseColumnCount revDatabaseColumnIsNull revDatabaseColumnLengths revDatabaseColumnNames revDatabaseColumnNamed revDatabaseColumnNumbered revDatabaseColumnTypes revDatabaseConnectResult revDatabaseCursors revDatabaseID revDatabaseTableNames revDatabaseType revDataFromQuery revdb_closeCursor revdb_columnbynumber revdb_columncount revdb_columnisnull revdb_columnlengths revdb_columnnames revdb_columntypes revdb_commit revdb_connect revdb_connections revdb_connectionerr revdb_currentrecord revdb_cursorconnection revdb_cursorerr revdb_cursors revdb_dbtype revdb_disconnect revdb_execute revdb_iseof revdb_isbof revdb_movefirst revdb_movelast revdb_movenext revdb_moveprev revdb_query revdb_querylist revdb_recordcount revdb_rollback revdb_tablenames revGetDatabaseDriverPath revNumberOfRecords revOpenDatabase revOpenDatabases revQueryDatabase revQueryDatabaseBlob revQueryResult revQueryIsAtStart revQueryIsAtEnd revUnixFromMacPath revXMLAttribute revXMLAttributes revXMLAttributeValues revXMLChildContents revXMLChildNames revXMLCreateTreeFromFileWithNamespaces revXMLCreateTreeWithNamespaces revXMLDataFromXPathQuery revXMLEvaluateXPath revXMLFirstChild revXMLMatchingNode revXMLNextSibling revXMLNodeContents revXMLNumberOfChildren revXMLParent revXMLPreviousSibling revXMLRootNode revXMLRPC_CreateRequest revXMLRPC_Documents revXMLRPC_Error revXMLRPC_GetHost revXMLRPC_GetMethod revXMLRPC_GetParam revXMLText revXMLRPC_Execute revXMLRPC_GetParamCount revXMLRPC_GetParamNode revXMLRPC_GetParamType revXMLRPC_GetPath revXMLRPC_GetPort revXMLRPC_GetProtocol revXMLRPC_GetRequest revXMLRPC_GetResponse revXMLRPC_GetSocket revXMLTree revXMLTrees revXMLValidateDTD revZipDescribeItem revZipEnumerateItems revZipOpenArchives round sampVariance sec secs seconds sentenceOffset sha1Digest shell shortFilePath sin specialFolderPath sqrt standardDeviation statRound stdDev sum sysError systemVersion tan tempName textDecode textEncode tick ticks time to tokenOffset toLower toUpper transpose truewordOffset trunc uniDecode uniEncode upper URLDecode URLEncode URLStatus uuid value variableNames variance version waitDepth weekdayNames wordOffset xsltApplyStylesheet xsltApplyStylesheetFromFile xsltLoadStylesheet xsltLoadStylesheetFromFile add breakpoint cancel clear local variable file word line folder directory URL close socket process combine constant convert create new alias folder directory decrypt delete variable word line folder directory URL dispatch divide do encrypt filter get include intersect kill libURLDownloadToFile libURLFollowHttpRedirects libURLftpUpload libURLftpUploadFile libURLresetAll libUrlSetAuthCallback libURLSetCustomHTTPHeaders libUrlSetExpect100 libURLSetFTPListCommand libURLSetFTPMode libURLSetFTPStopTime libURLSetStatusCallback load multiply socket prepare process post seek rel relative read from process rename replace require resetAll resolve revAddXMLNode revAppendXML revCloseCursor revCloseDatabase revCommitDatabase revCopyFile revCopyFolder revCopyXMLNode revDeleteFolder revDeleteXMLNode revDeleteAllXMLTrees revDeleteXMLTree revExecuteSQL revGoURL revInsertXMLNode revMoveFolder revMoveToFirstRecord revMoveToLastRecord revMoveToNextRecord revMoveToPreviousRecord revMoveToRecord revMoveXMLNode revPutIntoXMLNode revRollBackDatabase revSetDatabaseDriverPath revSetXMLAttribute revXMLRPC_AddParam revXMLRPC_DeleteAllDocuments revXMLAddDTD revXMLRPC_Free revXMLRPC_FreeAll revXMLRPC_DeleteDocument revXMLRPC_DeleteParam revXMLRPC_SetHost revXMLRPC_SetMethod revXMLRPC_SetPort revXMLRPC_SetProtocol revXMLRPC_SetSocket revZipAddItemWithData revZipAddItemWithFile revZipAddUncompressedItemWithData revZipAddUncompressedItemWithFile revZipCancel revZipCloseArchive revZipDeleteItem revZipExtractItemToFile revZipExtractItemToVariable revZipSetProgressCallback revZipRenameItem revZipReplaceItemWithData revZipReplaceItemWithFile revZipOpenArchive send set sort split start stop subtract union unload wait write"},contains:[b,{className:"keyword",begin:"\\bend\\sif\\b"},{className:"function",beginKeywords:"function",end:"$",contains:[b,e,a.APOS_STRING_MODE,a.QUOTE_STRING_MODE,a.BINARY_NUMBER_MODE,a.C_NUMBER_MODE,d]},{className:"function",begin:"\\bend\\s+",end:"$",keywords:"end",contains:[e,d]},{className:"command",beginKeywords:"command on",end:"$",contains:[b,e,a.APOS_STRING_MODE,a.QUOTE_STRING_MODE,a.BINARY_NUMBER_MODE,a.C_NUMBER_MODE,d]},{className:"preprocessor",variants:[{begin:"<\\?(rev|lc|livecode)",relevance:10},{begin:"<\\?"},{begin:"\\?>"}]},a.APOS_STRING_MODE,a.QUOTE_STRING_MODE,a.BINARY_NUMBER_MODE,a.C_NUMBER_MODE,d].concat(c),illegal:";$|^\\[|^="}}),a.registerLanguage("livescript",function(a){var b={keyword:"in if for while finally new do return else break catch instanceof throw try this switch continue typeof delete debugger case default function var with then unless until loop of by when and or is isnt not it that otherwise from to til fallthrough super case default function var void const let enum export import native __hasProp __extends __slice __bind __indexOf",literal:"true false null undefined yes no on off it that void",built_in:"npm require console print module global window document"},c="[A-Za-z$_](?:-[0-9A-Za-z$_]|[0-9A-Za-z$_])*",d=a.inherit(a.TITLE_MODE,{begin:c}),e={className:"subst",begin:/#\{/,end:/}/,keywords:b},f={className:"subst",begin:/#[A-Za-z$_]/,end:/(?:\-[0-9A-Za-z$_]|[0-9A-Za-z$_])*/,keywords:b},g=[a.BINARY_NUMBER_MODE,{className:"number",begin:"(\\b0[xX][a-fA-F0-9_]+)|(\\b\\d(\\d|_\\d)*(\\.(\\d(\\d|_\\d)*)?)?(_*[eE]([-+]\\d(_\\d|\\d)*)?)?[_a-z]*)",relevance:0,starts:{end:"(\\s*/)?",relevance:0}},{className:"string",variants:[{begin:/'''/,end:/'''/,contains:[a.BACKSLASH_ESCAPE]},{begin:/'/,end:/'/,contains:[a.BACKSLASH_ESCAPE]},{begin:/"""/,end:/"""/,contains:[a.BACKSLASH_ESCAPE,e,f]},{begin:/"/,end:/"/,contains:[a.BACKSLASH_ESCAPE,e,f]},{begin:/\\/,end:/(\s|$)/,excludeEnd:!0}]},{className:"pi",variants:[{begin:"//",end:"//[gim]*",contains:[e,a.HASH_COMMENT_MODE]},{begin:/\/(?![ *])(\\\/|.)*?\/[gim]*(?=\W|$)/}]},{className:"property",begin:"@"+c},{begin:"``",end:"``",excludeBegin:!0,excludeEnd:!0,subLanguage:"javascript"}];e.contains=g;var h={className:"params",begin:"\\(",returnBegin:!0,contains:[{begin:/\(/,end:/\)/,keywords:b,contains:["self"].concat(g)}]};return{aliases:["ls"],keywords:b,illegal:/\/\*/,contains:g.concat([a.COMMENT("\\/\\*","\\*\\/"),a.HASH_COMMENT_MODE,{className:"function",contains:[d,h],returnBegin:!0,variants:[{begin:"("+c+"\\s*(?:=|:=)\\s*)?(\\(.*\\))?\\s*\\B\\->\\*?",end:"\\->\\*?"},{begin:"("+c+"\\s*(?:=|:=)\\s*)?!?(\\(.*\\))?\\s*\\B[-~]{1,2}>\\*?",end:"[-~]{1,2}>\\*?"},{begin:"("+c+"\\s*(?:=|:=)\\s*)?(\\(.*\\))?\\s*\\B!?[-~]{1,2}>\\*?",end:"!?[-~]{1,2}>\\*?"}]},{className:"class",beginKeywords:"class",end:"$",illegal:/[:="\[\]]/,contains:[{beginKeywords:"extends",endsWithParent:!0,illegal:/[:="\[\]]/,contains:[d]},d]},{className:"attribute",begin:c+":",end:":",returnBegin:!0,returnEnd:!0,relevance:0}])}}),a.registerLanguage("lua",function(a){var b="\\[=*\\[",c="\\]=*\\]",d={begin:b,end:c,contains:["self"]},e=[a.COMMENT("--(?!"+b+")","$"),a.COMMENT("--"+b,c,{contains:[d],relevance:10})];return{lexemes:a.UNDERSCORE_IDENT_RE,keywords:{keyword:"and break do else elseif end false for if in local nil not or repeat return then true until while",built_in:"_G _VERSION assert collectgarbage dofile error getfenv getmetatable ipairs load loadfile loadstring module next pairs pcall print rawequal rawget rawset require select setfenv setmetatable tonumber tostring type unpack xpcall coroutine debug io math os package string table"},contains:e.concat([{className:"function",beginKeywords:"function",end:"\\)",contains:[a.inherit(a.TITLE_MODE,{begin:"([_a-zA-Z]\\w*\\.)*([_a-zA-Z]\\w*:)?[_a-zA-Z]\\w*"}),{className:"params",begin:"\\(",endsWithParent:!0,contains:e}].concat(e)},a.C_NUMBER_MODE,a.APOS_STRING_MODE,a.QUOTE_STRING_MODE,{className:"string",begin:b,end:c,contains:[d],relevance:5}])}}),a.registerLanguage("makefile",function(a){var b={className:"variable",begin:/\$\(/,end:/\)/,contains:[a.BACKSLASH_ESCAPE]};return{aliases:["mk","mak"],contains:[a.HASH_COMMENT_MODE,{begin:/^\w+\s*\W*=/,returnBegin:!0,relevance:0,starts:{className:"constant",end:/\s*\W*=/,excludeEnd:!0,starts:{end:/$/,relevance:0,contains:[b]}}},{className:"title",begin:/^[\w]+:\s*$/},{className:"phony",begin:/^\.PHONY:/,end:/$/,keywords:".PHONY",lexemes:/[\.\w]+/},{begin:/^\t+/,end:/$/,relevance:0,contains:[a.QUOTE_STRING_MODE,b]}]}}),a.registerLanguage("mathematica",function(a){return{aliases:["mma"],lexemes:"(\\$|\\b)"+a.IDENT_RE+"\\b",keywords:"AbelianGroup Abort AbortKernels AbortProtect Above Abs Absolute AbsoluteCorrelation AbsoluteCorrelationFunction AbsoluteCurrentValue AbsoluteDashing AbsoluteFileName AbsoluteOptions AbsolutePointSize AbsoluteThickness AbsoluteTime AbsoluteTiming AccountingForm Accumulate Accuracy AccuracyGoal ActionDelay ActionMenu ActionMenuBox ActionMenuBoxOptions Active ActiveItem ActiveStyle AcyclicGraphQ AddOnHelpPath AddTo AdjacencyGraph AdjacencyList AdjacencyMatrix AdjustmentBox AdjustmentBoxOptions AdjustTimeSeriesForecast AffineTransform After AiryAi AiryAiPrime AiryAiZero AiryBi AiryBiPrime AiryBiZero AlgebraicIntegerQ AlgebraicNumber AlgebraicNumberDenominator AlgebraicNumberNorm AlgebraicNumberPolynomial AlgebraicNumberTrace AlgebraicRules AlgebraicRulesData Algebraics AlgebraicUnitQ Alignment AlignmentMarker AlignmentPoint All AllowedDimensions AllowGroupClose AllowInlineCells AllowKernelInitialization AllowReverseGroupClose AllowScriptLevelChange AlphaChannel AlternatingGroup AlternativeHypothesis Alternatives AmbientLight Analytic AnchoredSearch And AndersonDarlingTest AngerJ AngleBracket AngularGauge Animate AnimationCycleOffset AnimationCycleRepetitions AnimationDirection AnimationDisplayTime AnimationRate AnimationRepetitions AnimationRunning Animator AnimatorBox AnimatorBoxOptions AnimatorElements Annotation Annuity AnnuityDue Antialiasing Antisymmetric Apart ApartSquareFree Appearance AppearanceElements AppellF1 Append AppendTo Apply ArcCos ArcCosh ArcCot ArcCoth ArcCsc ArcCsch ArcSec ArcSech ArcSin ArcSinDistribution ArcSinh ArcTan ArcTanh Arg ArgMax ArgMin ArgumentCountQ ARIMAProcess ArithmeticGeometricMean ARMAProcess ARProcess Array ArrayComponents ArrayDepth ArrayFlatten ArrayPad ArrayPlot ArrayQ ArrayReshape ArrayRules Arrays Arrow Arrow3DBox ArrowBox Arrowheads AspectRatio AspectRatioFixed Assert Assuming Assumptions AstronomicalData Asynchronous AsynchronousTaskObject AsynchronousTasks AtomQ Attributes AugmentedSymmetricPolynomial AutoAction AutoDelete AutoEvaluateEvents AutoGeneratedPackage AutoIndent AutoIndentSpacings AutoItalicWords AutoloadPath AutoMatch Automatic AutomaticImageSize AutoMultiplicationSymbol AutoNumberFormatting AutoOpenNotebooks AutoOpenPalettes AutorunSequencing AutoScaling AutoScroll AutoSpacing AutoStyleOptions AutoStyleWords Axes AxesEdge AxesLabel AxesOrigin AxesStyle Axis BabyMonsterGroupB Back Background BackgroundTasksSettings Backslash Backsubstitution Backward Band BandpassFilter BandstopFilter BarabasiAlbertGraphDistribution BarChart BarChart3D BarLegend BarlowProschanImportance BarnesG BarOrigin BarSpacing BartlettHannWindow BartlettWindow BaseForm Baseline BaselinePosition BaseStyle BatesDistribution BattleLemarieWavelet Because BeckmannDistribution Beep Before Begin BeginDialogPacket BeginFrontEndInteractionPacket BeginPackage BellB BellY Below BenfordDistribution BeniniDistribution BenktanderGibratDistribution BenktanderWeibullDistribution BernoulliB BernoulliDistribution BernoulliGraphDistribution BernoulliProcess BernsteinBasis BesselFilterModel BesselI BesselJ BesselJZero BesselK BesselY BesselYZero Beta BetaBinomialDistribution BetaDistribution BetaNegativeBinomialDistribution BetaPrimeDistribution BetaRegularized BetweennessCentrality BezierCurve BezierCurve3DBox BezierCurve3DBoxOptions BezierCurveBox BezierCurveBoxOptions BezierFunction BilateralFilter Binarize BinaryFormat BinaryImageQ BinaryRead BinaryReadList BinaryWrite BinCounts BinLists Binomial BinomialDistribution BinomialProcess BinormalDistribution BiorthogonalSplineWavelet BipartiteGraphQ BirnbaumImportance BirnbaumSaundersDistribution BitAnd BitClear BitGet BitLength BitNot BitOr BitSet BitShiftLeft BitShiftRight BitXor Black BlackmanHarrisWindow BlackmanNuttallWindow BlackmanWindow Blank BlankForm BlankNullSequence BlankSequence Blend Block BlockRandom BlomqvistBeta BlomqvistBetaTest Blue Blur BodePlot BohmanWindow Bold Bookmarks Boole BooleanConsecutiveFunction BooleanConvert BooleanCountingFunction BooleanFunction BooleanGraph BooleanMaxterms BooleanMinimize BooleanMinterms Booleans BooleanTable BooleanVariables BorderDimensions BorelTannerDistribution Bottom BottomHatTransform BoundaryStyle Bounds Box BoxBaselineShift BoxData BoxDimensions Boxed Boxes BoxForm BoxFormFormatTypes BoxFrame BoxID BoxMargins BoxMatrix BoxRatios BoxRotation BoxRotationPoint BoxStyle BoxWhiskerChart Bra BracketingBar BraKet BrayCurtisDistance BreadthFirstScan Break Brown BrownForsytheTest BrownianBridgeProcess BrowserCategory BSplineBasis BSplineCurve BSplineCurve3DBox BSplineCurveBox BSplineCurveBoxOptions BSplineFunction BSplineSurface BSplineSurface3DBox BubbleChart BubbleChart3D BubbleScale BubbleSizes BulletGauge BusinessDayQ ButterflyGraph ButterworthFilterModel Button ButtonBar ButtonBox ButtonBoxOptions ButtonCell ButtonContents ButtonData ButtonEvaluator ButtonExpandable ButtonFrame ButtonFunction ButtonMargins ButtonMinHeight ButtonNote ButtonNotebook ButtonSource ButtonStyle ButtonStyleMenuListing Byte ByteCount ByteOrdering C CachedValue CacheGraphics CalendarData CalendarType CallPacket CanberraDistance Cancel CancelButton CandlestickChart Cap CapForm CapitalDifferentialD CardinalBSplineBasis CarmichaelLambda Cases Cashflow Casoratian Catalan CatalanNumber Catch CauchyDistribution CauchyWindow CayleyGraph CDF CDFDeploy CDFInformation CDFWavelet Ceiling Cell CellAutoOverwrite CellBaseline CellBoundingBox CellBracketOptions CellChangeTimes CellContents CellContext CellDingbat CellDynamicExpression CellEditDuplicate CellElementsBoundingBox CellElementSpacings CellEpilog CellEvaluationDuplicate CellEvaluationFunction CellEventActions CellFrame CellFrameColor CellFrameLabelMargins CellFrameLabels CellFrameMargins CellGroup CellGroupData CellGrouping CellGroupingRules CellHorizontalScrolling CellID CellLabel CellLabelAutoDelete CellLabelMargins CellLabelPositioning CellMargins CellObject CellOpen CellPrint CellProlog Cells CellSize CellStyle CellTags CellularAutomaton CensoredDistribution Censoring Center CenterDot CentralMoment CentralMomentGeneratingFunction CForm ChampernowneNumber ChanVeseBinarize Character CharacterEncoding CharacterEncodingsPath CharacteristicFunction CharacteristicPolynomial CharacterRange Characters ChartBaseStyle ChartElementData ChartElementDataFunction ChartElementFunction ChartElements ChartLabels ChartLayout ChartLegends ChartStyle Chebyshev1FilterModel Chebyshev2FilterModel ChebyshevDistance ChebyshevT ChebyshevU Check CheckAbort CheckAll Checkbox CheckboxBar CheckboxBox CheckboxBoxOptions ChemicalData ChessboardDistance ChiDistribution ChineseRemainder ChiSquareDistribution ChoiceButtons ChoiceDialog CholeskyDecomposition Chop Circle CircleBox CircleDot CircleMinus CirclePlus CircleTimes CirculantGraph CityData Clear ClearAll ClearAttributes ClearSystemCache ClebschGordan ClickPane Clip ClipboardNotebook ClipFill ClippingStyle ClipPlanes ClipRange Clock ClockGauge ClockwiseContourIntegral Close Closed CloseKernels ClosenessCentrality Closing ClosingAutoSave ClosingEvent ClusteringComponents CMYKColor Coarse Coefficient CoefficientArrays CoefficientDomain CoefficientList CoefficientRules CoifletWavelet Collect Colon ColonForm ColorCombine ColorConvert ColorData ColorDataFunction ColorFunction ColorFunctionScaling Colorize ColorNegate ColorOutput ColorProfileData ColorQuantize ColorReplace ColorRules ColorSelectorSettings ColorSeparate ColorSetter ColorSetterBox ColorSetterBoxOptions ColorSlider ColorSpace Column ColumnAlignments ColumnBackgrounds ColumnForm ColumnLines ColumnsEqual ColumnSpacings ColumnWidths CommonDefaultFormatTypes Commonest CommonestFilter CommonUnits CommunityBoundaryStyle CommunityGraphPlot CommunityLabels CommunityRegionStyle CompatibleUnitQ CompilationOptions CompilationTarget Compile Compiled CompiledFunction Complement CompleteGraph CompleteGraphQ CompleteKaryTree CompletionsListPacket Complex Complexes ComplexExpand ComplexInfinity ComplexityFunction ComponentMeasurements ComponentwiseContextMenu Compose ComposeList ComposeSeries Composition CompoundExpression CompoundPoissonDistribution CompoundPoissonProcess CompoundRenewalProcess Compress CompressedData Condition ConditionalExpression Conditioned Cone ConeBox ConfidenceLevel ConfidenceRange ConfidenceTransform ConfigurationPath Congruent Conjugate ConjugateTranspose Conjunction Connect ConnectedComponents ConnectedGraphQ ConnesWindow ConoverTest ConsoleMessage ConsoleMessagePacket ConsolePrint Constant ConstantArray Constants ConstrainedMax ConstrainedMin ContentPadding ContentsBoundingBox ContentSelectable ContentSize Context ContextMenu Contexts ContextToFilename ContextToFileName Continuation Continue ContinuedFraction ContinuedFractionK ContinuousAction ContinuousMarkovProcess ContinuousTimeModelQ ContinuousWaveletData ContinuousWaveletTransform ContourDetect ContourGraphics ContourIntegral ContourLabels ContourLines ContourPlot ContourPlot3D Contours ContourShading ContourSmoothing ContourStyle ContraharmonicMean Control ControlActive ControlAlignment ControllabilityGramian ControllabilityMatrix ControllableDecomposition ControllableModelQ ControllerDuration ControllerInformation ControllerInformationData ControllerLinking ControllerManipulate ControllerMethod ControllerPath ControllerState ControlPlacement ControlsRendering ControlType Convergents ConversionOptions ConversionRules ConvertToBitmapPacket ConvertToPostScript ConvertToPostScriptPacket Convolve ConwayGroupCo1 ConwayGroupCo2 ConwayGroupCo3 CoordinateChartData CoordinatesToolOptions CoordinateTransform CoordinateTransformData CoprimeQ Coproduct CopulaDistribution Copyable CopyDirectory CopyFile CopyTag CopyToClipboard CornerFilter CornerNeighbors Correlation CorrelationDistance CorrelationFunction CorrelationTest Cos Cosh CoshIntegral CosineDistance CosineWindow CosIntegral Cot Coth Count CounterAssignments CounterBox CounterBoxOptions CounterClockwiseContourIntegral CounterEvaluator CounterFunction CounterIncrements CounterStyle CounterStyleMenuListing CountRoots CountryData Covariance CovarianceEstimatorFunction CovarianceFunction CoxianDistribution CoxIngersollRossProcess CoxModel CoxModelFit CramerVonMisesTest CreateArchive CreateDialog CreateDirectory CreateDocument CreateIntermediateDirectories CreatePalette CreatePalettePacket CreateScheduledTask CreateTemporary CreateWindow CriticalityFailureImportance CriticalitySuccessImportance CriticalSection Cross CrossingDetect CrossMatrix Csc Csch CubeRoot Cubics Cuboid CuboidBox Cumulant CumulantGeneratingFunction Cup CupCap Curl CurlyDoubleQuote CurlyQuote CurrentImage CurrentlySpeakingPacket CurrentValue CurvatureFlowFilter CurveClosed Cyan CycleGraph CycleIndexPolynomial Cycles CyclicGroup Cyclotomic Cylinder CylinderBox CylindricalDecomposition D DagumDistribution DamerauLevenshteinDistance DampingFactor Darker Dashed Dashing DataCompression DataDistribution DataRange DataReversed Date DateDelimiters DateDifference DateFunction DateList DateListLogPlot DateListPlot DatePattern DatePlus DateRange DateString DateTicksFormat DaubechiesWavelet DavisDistribution DawsonF DayCount DayCountConvention DayMatchQ DayName DayPlus DayRange DayRound DeBruijnGraph Debug DebugTag Decimal DeclareKnownSymbols DeclarePackage Decompose Decrement DedekindEta Default DefaultAxesStyle DefaultBaseStyle DefaultBoxStyle DefaultButton DefaultColor DefaultControlPlacement DefaultDuplicateCellStyle DefaultDuration DefaultElement DefaultFaceGridsStyle DefaultFieldHintStyle DefaultFont DefaultFontProperties DefaultFormatType DefaultFormatTypeForStyle DefaultFrameStyle DefaultFrameTicksStyle DefaultGridLinesStyle DefaultInlineFormatType DefaultInputFormatType DefaultLabelStyle DefaultMenuStyle DefaultNaturalLanguage DefaultNewCellStyle DefaultNewInlineCellStyle DefaultNotebook DefaultOptions DefaultOutputFormatType DefaultStyle DefaultStyleDefinitions DefaultTextFormatType DefaultTextInlineFormatType DefaultTicksStyle DefaultTooltipStyle DefaultValues Defer DefineExternal DefineInputStreamMethod DefineOutputStreamMethod Definition Degree DegreeCentrality DegreeGraphDistribution DegreeLexicographic DegreeReverseLexicographic Deinitialization Del Deletable Delete DeleteBorderComponents DeleteCases DeleteContents DeleteDirectory DeleteDuplicates DeleteFile DeleteSmallComponents DeleteWithContents DeletionWarning Delimiter DelimiterFlashTime DelimiterMatching Delimiters Denominator DensityGraphics DensityHistogram DensityPlot DependentVariables Deploy Deployed Depth DepthFirstScan Derivative DerivativeFilter DescriptorStateSpace DesignMatrix Det DGaussianWavelet DiacriticalPositioning Diagonal DiagonalMatrix Dialog DialogIndent DialogInput DialogLevel DialogNotebook DialogProlog DialogReturn DialogSymbols Diamond DiamondMatrix DiceDissimilarity DictionaryLookup DifferenceDelta DifferenceOrder DifferenceRoot DifferenceRootReduce Differences DifferentialD DifferentialRoot DifferentialRootReduce DifferentiatorFilter DigitBlock DigitBlockMinimum DigitCharacter DigitCount DigitQ DihedralGroup Dilation Dimensions DiracComb DiracDelta DirectedEdge DirectedEdges DirectedGraph DirectedGraphQ DirectedInfinity Direction Directive Directory DirectoryName DirectoryQ DirectoryStack DirichletCharacter DirichletConvolve DirichletDistribution DirichletL DirichletTransform DirichletWindow DisableConsolePrintPacket DiscreteChirpZTransform DiscreteConvolve DiscreteDelta DiscreteHadamardTransform DiscreteIndicator DiscreteLQEstimatorGains DiscreteLQRegulatorGains DiscreteLyapunovSolve DiscreteMarkovProcess DiscretePlot DiscretePlot3D DiscreteRatio DiscreteRiccatiSolve DiscreteShift DiscreteTimeModelQ DiscreteUniformDistribution DiscreteVariables DiscreteWaveletData DiscreteWaveletPacketTransform DiscreteWaveletTransform Discriminant Disjunction Disk DiskBox DiskMatrix Dispatch DispersionEstimatorFunction Display DisplayAllSteps DisplayEndPacket DisplayFlushImagePacket DisplayForm DisplayFunction DisplayPacket DisplayRules DisplaySetSizePacket DisplayString DisplayTemporary DisplayWith DisplayWithRef DisplayWithVariable DistanceFunction DistanceTransform Distribute Distributed DistributedContexts DistributeDefinitions DistributionChart DistributionDomain DistributionFitTest DistributionParameterAssumptions DistributionParameterQ Dithering Div Divergence Divide DivideBy Dividers Divisible Divisors DivisorSigma DivisorSum DMSList DMSString Do DockedCells DocumentNotebook DominantColors DOSTextFormat Dot DotDashed DotEqual Dotted DoubleBracketingBar DoubleContourIntegral DoubleDownArrow DoubleLeftArrow DoubleLeftRightArrow DoubleLeftTee DoubleLongLeftArrow DoubleLongLeftRightArrow DoubleLongRightArrow DoubleRightArrow DoubleRightTee DoubleUpArrow DoubleUpDownArrow DoubleVerticalBar DoublyInfinite Down DownArrow DownArrowBar DownArrowUpArrow DownLeftRightVector DownLeftTeeVector DownLeftVector DownLeftVectorBar DownRightTeeVector DownRightVector DownRightVectorBar Downsample DownTee DownTeeArrow DownValues DragAndDrop DrawEdges DrawFrontFaces DrawHighlighted Drop DSolve Dt DualLinearProgramming DualSystemsModel DumpGet DumpSave DuplicateFreeQ Dynamic DynamicBox DynamicBoxOptions DynamicEvaluationTimeout DynamicLocation DynamicModule DynamicModuleBox DynamicModuleBoxOptions DynamicModuleParent DynamicModuleValues DynamicName DynamicNamespace DynamicReference DynamicSetting DynamicUpdating DynamicWrapper DynamicWrapperBox DynamicWrapperBoxOptions E EccentricityCentrality EdgeAdd EdgeBetweennessCentrality EdgeCapacity EdgeCapForm EdgeColor EdgeConnectivity EdgeCost EdgeCount EdgeCoverQ EdgeDashing EdgeDelete EdgeDetect EdgeForm EdgeIndex EdgeJoinForm EdgeLabeling EdgeLabels EdgeLabelStyle EdgeList EdgeOpacity EdgeQ EdgeRenderingFunction EdgeRules EdgeShapeFunction EdgeStyle EdgeThickness EdgeWeight Editable EditButtonSettings EditCellTagsSettings EditDistance EffectiveInterest Eigensystem Eigenvalues EigenvectorCentrality Eigenvectors Element ElementData Eliminate EliminationOrder EllipticE EllipticExp EllipticExpPrime EllipticF EllipticFilterModel EllipticK EllipticLog EllipticNomeQ EllipticPi EllipticReducedHalfPeriods EllipticTheta EllipticThetaPrime EmitSound EmphasizeSyntaxErrors EmpiricalDistribution Empty EmptyGraphQ EnableConsolePrintPacket Enabled Encode End EndAdd EndDialogPacket EndFrontEndInteractionPacket EndOfFile EndOfLine EndOfString EndPackage EngineeringForm Enter EnterExpressionPacket EnterTextPacket Entropy EntropyFilter Environment Epilog Equal EqualColumns EqualRows EqualTilde EquatedTo Equilibrium EquirippleFilterKernel Equivalent Erf Erfc Erfi ErlangB ErlangC ErlangDistribution Erosion ErrorBox ErrorBoxOptions ErrorNorm ErrorPacket ErrorsDialogSettings EstimatedDistribution EstimatedProcess EstimatorGains EstimatorRegulator EuclideanDistance EulerE EulerGamma EulerianGraphQ EulerPhi Evaluatable Evaluate Evaluated EvaluatePacket EvaluationCell EvaluationCompletionAction EvaluationElements EvaluationMode EvaluationMonitor EvaluationNotebook EvaluationObject EvaluationOrder Evaluator EvaluatorNames EvenQ EventData EventEvaluator EventHandler EventHandlerTag EventLabels ExactBlackmanWindow ExactNumberQ ExactRootIsolation ExampleData Except ExcludedForms ExcludePods Exclusions ExclusionsStyle Exists Exit ExitDialog Exp Expand ExpandAll ExpandDenominator ExpandFileName ExpandNumerator Expectation ExpectationE ExpectedValue ExpGammaDistribution ExpIntegralE ExpIntegralEi Exponent ExponentFunction ExponentialDistribution ExponentialFamily ExponentialGeneratingFunction ExponentialMovingAverage ExponentialPowerDistribution ExponentPosition ExponentStep Export ExportAutoReplacements ExportPacket ExportString Expression ExpressionCell ExpressionPacket ExpToTrig ExtendedGCD Extension ExtentElementFunction ExtentMarkers ExtentSize ExternalCall ExternalDataCharacterEncoding Extract ExtractArchive ExtremeValueDistribution FaceForm FaceGrids FaceGridsStyle Factor FactorComplete Factorial Factorial2 FactorialMoment FactorialMomentGeneratingFunction FactorialPower FactorInteger FactorList FactorSquareFree FactorSquareFreeList FactorTerms FactorTermsList Fail FailureDistribution False FARIMAProcess FEDisableConsolePrintPacket FeedbackSector FeedbackSectorStyle FeedbackType FEEnableConsolePrintPacket Fibonacci FieldHint FieldHintStyle FieldMasked FieldSize File FileBaseName FileByteCount FileDate FileExistsQ FileExtension FileFormat FileHash FileInformation FileName FileNameDepth FileNameDialogSettings FileNameDrop FileNameJoin FileNames FileNameSetter FileNameSplit FileNameTake FilePrint FileType FilledCurve FilledCurveBox Filling FillingStyle FillingTransform FilterRules FinancialBond FinancialData FinancialDerivative FinancialIndicator Find FindArgMax FindArgMin FindClique FindClusters FindCurvePath FindDistributionParameters FindDivisions FindEdgeCover FindEdgeCut FindEulerianCycle FindFaces FindFile FindFit FindGeneratingFunction FindGeoLocation FindGeometricTransform FindGraphCommunities FindGraphIsomorphism FindGraphPartition FindHamiltonianCycle FindIndependentEdgeSet FindIndependentVertexSet FindInstance FindIntegerNullVector FindKClan FindKClique FindKClub FindKPlex FindLibrary FindLinearRecurrence FindList FindMaximum FindMaximumFlow FindMaxValue FindMinimum FindMinimumCostFlow FindMinimumCut FindMinValue FindPermutation FindPostmanTour FindProcessParameters FindRoot FindSequenceFunction FindSettings FindShortestPath FindShortestTour FindThreshold FindVertexCover FindVertexCut Fine FinishDynamic FiniteAbelianGroupCount FiniteGroupCount FiniteGroupData First FirstPassageTimeDistribution FischerGroupFi22 FischerGroupFi23 FischerGroupFi24Prime FisherHypergeometricDistribution FisherRatioTest FisherZDistribution Fit FitAll FittedModel FixedPoint FixedPointList FlashSelection Flat Flatten FlattenAt FlatTopWindow FlipView Floor FlushPrintOutputPacket Fold FoldList Font FontColor FontFamily FontForm FontName FontOpacity FontPostScriptName FontProperties FontReencoding FontSize FontSlant FontSubstitutions FontTracking FontVariations FontWeight For ForAll Format FormatRules FormatType FormatTypeAutoConvert FormatValues FormBox FormBoxOptions FortranForm Forward ForwardBackward Fourier FourierCoefficient FourierCosCoefficient FourierCosSeries FourierCosTransform FourierDCT FourierDCTFilter FourierDCTMatrix FourierDST FourierDSTMatrix FourierMatrix FourierParameters FourierSequenceTransform FourierSeries FourierSinCoefficient FourierSinSeries FourierSinTransform FourierTransform FourierTrigSeries FractionalBrownianMotionProcess FractionalPart FractionBox FractionBoxOptions FractionLine Frame FrameBox FrameBoxOptions Framed FrameInset FrameLabel Frameless FrameMargins FrameStyle FrameTicks FrameTicksStyle FRatioDistribution FrechetDistribution FreeQ FrequencySamplingFilterKernel FresnelC FresnelS Friday FrobeniusNumber FrobeniusSolve FromCharacterCode FromCoefficientRules FromContinuedFraction FromDate FromDigits FromDMS Front FrontEndDynamicExpression FrontEndEventActions FrontEndExecute FrontEndObject FrontEndResource FrontEndResourceString FrontEndStackSize FrontEndToken FrontEndTokenExecute FrontEndValueCache FrontEndVersion FrontFaceColor FrontFaceOpacity Full FullAxes FullDefinition FullForm FullGraphics FullOptions FullSimplify Function FunctionExpand FunctionInterpolation FunctionSpace FussellVeselyImportance GaborFilter GaborMatrix GaborWavelet GainMargins GainPhaseMargins Gamma GammaDistribution GammaRegularized GapPenalty Gather GatherBy GaugeFaceElementFunction GaugeFaceStyle GaugeFrameElementFunction GaugeFrameSize GaugeFrameStyle GaugeLabels GaugeMarkers GaugeStyle GaussianFilter GaussianIntegers GaussianMatrix GaussianWindow GCD GegenbauerC General GeneralizedLinearModelFit GenerateConditions GeneratedCell GeneratedParameters GeneratingFunction Generic GenericCylindricalDecomposition GenomeData GenomeLookup GeodesicClosing GeodesicDilation GeodesicErosion GeodesicOpening GeoDestination GeodesyData GeoDirection GeoDistance GeoGridPosition GeometricBrownianMotionProcess GeometricDistribution GeometricMean GeometricMeanFilter GeometricTransformation GeometricTransformation3DBox GeometricTransformation3DBoxOptions GeometricTransformationBox GeometricTransformationBoxOptions GeoPosition GeoPositionENU GeoPositionXYZ GeoProjectionData GestureHandler GestureHandlerTag Get GetBoundingBoxSizePacket GetContext GetEnvironment GetFileName GetFrontEndOptionsDataPacket GetLinebreakInformationPacket GetMenusPacket GetPageBreakInformationPacket Glaisher GlobalClusteringCoefficient GlobalPreferences GlobalSession Glow GoldenRatio GompertzMakehamDistribution GoodmanKruskalGamma GoodmanKruskalGammaTest Goto Grad Gradient GradientFilter GradientOrientationFilter Graph GraphAssortativity GraphCenter GraphComplement GraphData GraphDensity GraphDiameter GraphDifference GraphDisjointUnion GraphDistance GraphDistanceMatrix GraphElementData GraphEmbedding GraphHighlight GraphHighlightStyle GraphHub Graphics Graphics3D Graphics3DBox Graphics3DBoxOptions GraphicsArray GraphicsBaseline GraphicsBox GraphicsBoxOptions GraphicsColor GraphicsColumn GraphicsComplex GraphicsComplex3DBox GraphicsComplex3DBoxOptions GraphicsComplexBox GraphicsComplexBoxOptions GraphicsContents GraphicsData GraphicsGrid GraphicsGridBox GraphicsGroup GraphicsGroup3DBox GraphicsGroup3DBoxOptions GraphicsGroupBox GraphicsGroupBoxOptions GraphicsGrouping GraphicsHighlightColor GraphicsRow GraphicsSpacing GraphicsStyle GraphIntersection GraphLayout GraphLinkEfficiency GraphPeriphery GraphPlot GraphPlot3D GraphPower GraphPropertyDistribution GraphQ GraphRadius GraphReciprocity GraphRoot GraphStyle GraphUnion Gray GrayLevel GreatCircleDistance Greater GreaterEqual GreaterEqualLess GreaterFullEqual GreaterGreater GreaterLess GreaterSlantEqual GreaterTilde Green Grid GridBaseline GridBox GridBoxAlignment GridBoxBackground GridBoxDividers GridBoxFrame GridBoxItemSize GridBoxItemStyle GridBoxOptions GridBoxSpacings GridCreationSettings GridDefaultElement GridElementStyleOptions GridFrame GridFrameMargins GridGraph GridLines GridLinesStyle GroebnerBasis GroupActionBase GroupCentralizer GroupElementFromWord GroupElementPosition GroupElementQ GroupElements GroupElementToWord GroupGenerators GroupMultiplicationTable GroupOrbits GroupOrder GroupPageBreakWithin GroupSetwiseStabilizer GroupStabilizer GroupStabilizerChain Gudermannian GumbelDistribution HaarWavelet HadamardMatrix HalfNormalDistribution HamiltonianGraphQ HammingDistance HammingWindow HankelH1 HankelH2 HankelMatrix HannPoissonWindow HannWindow HaradaNortonGroupHN HararyGraph HarmonicMean HarmonicMeanFilter HarmonicNumber Hash HashTable Haversine HazardFunction Head HeadCompose Heads HeavisideLambda HeavisidePi HeavisideTheta HeldGroupHe HeldPart HelpBrowserLookup HelpBrowserNotebook HelpBrowserSettings HermiteDecomposition HermiteH HermitianMatrixQ HessenbergDecomposition Hessian HexadecimalCharacter Hexahedron HexahedronBox HexahedronBoxOptions HiddenSurface HighlightGraph HighlightImage HighpassFilter HigmanSimsGroupHS HilbertFilter HilbertMatrix Histogram Histogram3D HistogramDistribution HistogramList HistogramTransform HistogramTransformInterpolation HitMissTransform HITSCentrality HodgeDual HoeffdingD HoeffdingDTest Hold HoldAll HoldAllComplete HoldComplete HoldFirst HoldForm HoldPattern HoldRest HolidayCalendar HomeDirectory HomePage Horizontal HorizontalForm HorizontalGauge HorizontalScrollPosition HornerForm HotellingTSquareDistribution HoytDistribution HTMLSave Hue HumpDownHump HumpEqual HurwitzLerchPhi HurwitzZeta HyperbolicDistribution HypercubeGraph HyperexponentialDistribution Hyperfactorial Hypergeometric0F1 Hypergeometric0F1Regularized Hypergeometric1F1 Hypergeometric1F1Regularized Hypergeometric2F1 Hypergeometric2F1Regularized HypergeometricDistribution HypergeometricPFQ HypergeometricPFQRegularized HypergeometricU Hyperlink HyperlinkCreationSettings Hyphenation HyphenationOptions HypoexponentialDistribution HypothesisTestData I Identity IdentityMatrix If IgnoreCase Im Image Image3D Image3DSlices ImageAccumulate ImageAdd ImageAdjust ImageAlign ImageApply ImageAspectRatio ImageAssemble ImageCache ImageCacheValid ImageCapture ImageChannels ImageClip ImageColorSpace ImageCompose ImageConvolve ImageCooccurrence ImageCorners ImageCorrelate ImageCorrespondingPoints ImageCrop ImageData ImageDataPacket ImageDeconvolve ImageDemosaic ImageDifference ImageDimensions ImageDistance ImageEffect ImageFeatureTrack ImageFileApply ImageFileFilter ImageFileScan ImageFilter ImageForestingComponents ImageForwardTransformation ImageHistogram ImageKeypoints ImageLevels ImageLines ImageMargins ImageMarkers ImageMeasurements ImageMultiply ImageOffset ImagePad ImagePadding ImagePartition ImagePeriodogram ImagePerspectiveTransformation ImageQ ImageRangeCache ImageReflect ImageRegion ImageResize ImageResolution ImageRotate ImageRotated ImageScaled ImageScan ImageSize ImageSizeAction ImageSizeCache ImageSizeMultipliers ImageSizeRaw ImageSubtract ImageTake ImageTransformation ImageTrim ImageType ImageValue ImageValuePositions Implies Import ImportAutoReplacements ImportString ImprovementImportance In IncidenceGraph IncidenceList IncidenceMatrix IncludeConstantBasis IncludeFileExtension IncludePods IncludeSingularTerm Increment Indent IndentingNewlineSpacings IndentMaxFraction IndependenceTest IndependentEdgeSetQ IndependentUnit IndependentVertexSetQ Indeterminate IndexCreationOptions Indexed IndexGraph IndexTag Inequality InexactNumberQ InexactNumbers Infinity Infix Information Inherited InheritScope Initialization InitializationCell InitializationCellEvaluation InitializationCellWarning InlineCounterAssignments InlineCounterIncrements InlineRules Inner Inpaint Input InputAliases InputAssumptions InputAutoReplacements InputField InputFieldBox InputFieldBoxOptions InputForm InputGrouping InputNamePacket InputNotebook InputPacket InputSettings InputStream InputString InputStringPacket InputToBoxFormPacket Insert InsertionPointObject InsertResults Inset Inset3DBox Inset3DBoxOptions InsetBox InsetBoxOptions Install InstallService InString Integer IntegerDigits IntegerExponent IntegerLength IntegerPart IntegerPartitions IntegerQ Integers IntegerString Integral Integrate Interactive InteractiveTradingChart Interlaced Interleaving InternallyBalancedDecomposition InterpolatingFunction InterpolatingPolynomial Interpolation InterpolationOrder InterpolationPoints InterpolationPrecision Interpretation InterpretationBox InterpretationBoxOptions InterpretationFunction InterpretTemplate InterquartileRange Interrupt InterruptSettings Intersection Interval IntervalIntersection IntervalMemberQ IntervalUnion Inverse InverseBetaRegularized InverseCDF InverseChiSquareDistribution InverseContinuousWaveletTransform InverseDistanceTransform InverseEllipticNomeQ InverseErf InverseErfc InverseFourier InverseFourierCosTransform InverseFourierSequenceTransform InverseFourierSinTransform InverseFourierTransform InverseFunction InverseFunctions InverseGammaDistribution InverseGammaRegularized InverseGaussianDistribution InverseGudermannian InverseHaversine InverseJacobiCD InverseJacobiCN InverseJacobiCS InverseJacobiDC InverseJacobiDN InverseJacobiDS InverseJacobiNC InverseJacobiND InverseJacobiNS InverseJacobiSC InverseJacobiSD InverseJacobiSN InverseLaplaceTransform InversePermutation InverseRadon InverseSeries InverseSurvivalFunction InverseWaveletTransform InverseWeierstrassP InverseZTransform Invisible InvisibleApplication InvisibleTimes IrreduciblePolynomialQ IsolatingInterval IsomorphicGraphQ IsotopeData Italic Item ItemBox ItemBoxOptions ItemSize ItemStyle ItoProcess JaccardDissimilarity JacobiAmplitude Jacobian JacobiCD JacobiCN JacobiCS JacobiDC JacobiDN JacobiDS JacobiNC JacobiND JacobiNS JacobiP JacobiSC JacobiSD JacobiSN JacobiSymbol JacobiZeta JankoGroupJ1 JankoGroupJ2 JankoGroupJ3 JankoGroupJ4 JarqueBeraALMTest JohnsonDistribution Join Joined JoinedCurve JoinedCurveBox JoinForm JordanDecomposition JordanModelDecomposition K KagiChart KaiserBesselWindow KaiserWindow KalmanEstimator KalmanFilter KarhunenLoeveDecomposition KaryTree KatzCentrality KCoreComponents KDistribution KelvinBei KelvinBer KelvinKei KelvinKer KendallTau KendallTauTest KernelExecute KernelMixtureDistribution KernelObject Kernels Ket Khinchin KirchhoffGraph KirchhoffMatrix KleinInvariantJ KnightTourGraph KnotData KnownUnitQ KolmogorovSmirnovTest KroneckerDelta KroneckerModelDecomposition KroneckerProduct KroneckerSymbol KuiperTest KumaraswamyDistribution Kurtosis KuwaharaFilter Label Labeled LabeledSlider LabelingFunction LabelStyle LaguerreL LambdaComponents LambertW LanczosWindow LandauDistribution Language LanguageCategory LaplaceDistribution LaplaceTransform Laplacian LaplacianFilter LaplacianGaussianFilter Large Larger Last Latitude LatitudeLongitude LatticeData LatticeReduce Launch LaunchKernels LayeredGraphPlot LayerSizeFunction LayoutInformation LCM LeafCount LeapYearQ LeastSquares LeastSquaresFilterKernel Left LeftArrow LeftArrowBar LeftArrowRightArrow LeftDownTeeVector LeftDownVector LeftDownVectorBar LeftRightArrow LeftRightVector LeftTee LeftTeeArrow LeftTeeVector LeftTriangle LeftTriangleBar LeftTriangleEqual LeftUpDownVector LeftUpTeeVector LeftUpVector LeftUpVectorBar LeftVector LeftVectorBar LegendAppearance Legended LegendFunction LegendLabel LegendLayout LegendMargins LegendMarkers LegendMarkerSize LegendreP LegendreQ LegendreType Length LengthWhile LerchPhi Less LessEqual LessEqualGreater LessFullEqual LessGreater LessLess LessSlantEqual LessTilde LetterCharacter LetterQ Level LeveneTest LeviCivitaTensor LevyDistribution Lexicographic LibraryFunction LibraryFunctionError LibraryFunctionInformation LibraryFunctionLoad LibraryFunctionUnload LibraryLoad LibraryUnload LicenseID LiftingFilterData LiftingWaveletTransform LightBlue LightBrown LightCyan Lighter LightGray LightGreen Lighting LightingAngle LightMagenta LightOrange LightPink LightPurple LightRed LightSources LightYellow Likelihood Limit LimitsPositioning LimitsPositioningTokens LindleyDistribution Line Line3DBox LinearFilter LinearFractionalTransform LinearModelFit LinearOffsetFunction LinearProgramming LinearRecurrence LinearSolve LinearSolveFunction LineBox LineBreak LinebreakAdjustments LineBreakChart LineBreakWithin LineColor LineForm LineGraph LineIndent LineIndentMaxFraction LineIntegralConvolutionPlot LineIntegralConvolutionScale LineLegend LineOpacity LineSpacing LineWrapParts LinkActivate LinkClose LinkConnect LinkConnectedQ LinkCreate LinkError LinkFlush LinkFunction LinkHost LinkInterrupt LinkLaunch LinkMode LinkObject LinkOpen LinkOptions LinkPatterns LinkProtocol LinkRead LinkReadHeld LinkReadyQ Links LinkWrite LinkWriteHeld LiouvilleLambda List Listable ListAnimate ListContourPlot ListContourPlot3D ListConvolve ListCorrelate ListCurvePathPlot ListDeconvolve ListDensityPlot Listen ListFourierSequenceTransform ListInterpolation ListLineIntegralConvolutionPlot ListLinePlot ListLogLinearPlot ListLogLogPlot ListLogPlot ListPicker ListPickerBox ListPickerBoxBackground ListPickerBoxOptions ListPlay ListPlot ListPlot3D ListPointPlot3D ListPolarPlot ListQ ListStreamDensityPlot ListStreamPlot ListSurfacePlot3D ListVectorDensityPlot ListVectorPlot ListVectorPlot3D ListZTransform Literal LiteralSearch LocalClusteringCoefficient LocalizeVariables LocationEquivalenceTest LocationTest Locator LocatorAutoCreate LocatorBox LocatorBoxOptions LocatorCentering LocatorPane LocatorPaneBox LocatorPaneBoxOptions LocatorRegion Locked Log Log10 Log2 LogBarnesG LogGamma LogGammaDistribution LogicalExpand LogIntegral LogisticDistribution LogitModelFit LogLikelihood LogLinearPlot LogLogisticDistribution LogLogPlot LogMultinormalDistribution LogNormalDistribution LogPlot LogRankTest LogSeriesDistribution LongEqual Longest LongestAscendingSequence LongestCommonSequence LongestCommonSequencePositions LongestCommonSubsequence LongestCommonSubsequencePositions LongestMatch LongForm Longitude LongLeftArrow LongLeftRightArrow LongRightArrow Loopback LoopFreeGraphQ LowerCaseQ LowerLeftArrow LowerRightArrow LowerTriangularize LowpassFilter LQEstimatorGains LQGRegulator LQOutputRegulatorGains LQRegulatorGains LUBackSubstitution LucasL LuccioSamiComponents LUDecomposition LyapunovSolve LyonsGroupLy MachineID MachineName MachineNumberQ MachinePrecision MacintoshSystemPageSetup Magenta Magnification Magnify MainSolve MaintainDynamicCaches Majority MakeBoxes MakeExpression MakeRules MangoldtLambda ManhattanDistance Manipulate Manipulator MannWhitneyTest MantissaExponent Manual Map MapAll MapAt MapIndexed MAProcess MapThread MarcumQ MardiaCombinedTest MardiaKurtosisTest MardiaSkewnessTest MarginalDistribution MarkovProcessProperties Masking MatchingDissimilarity MatchLocalNameQ MatchLocalNames MatchQ Material MathematicaNotation MathieuC MathieuCharacteristicA MathieuCharacteristicB MathieuCharacteristicExponent MathieuCPrime MathieuGroupM11 MathieuGroupM12 MathieuGroupM22 MathieuGroupM23 MathieuGroupM24 MathieuS MathieuSPrime MathMLForm MathMLText Matrices MatrixExp MatrixForm MatrixFunction MatrixLog MatrixPlot MatrixPower MatrixQ MatrixRank Max MaxBend MaxDetect MaxExtraBandwidths MaxExtraConditions MaxFeatures MaxFilter Maximize MaxIterations MaxMemoryUsed MaxMixtureKernels MaxPlotPoints MaxPoints MaxRecursion MaxStableDistribution MaxStepFraction MaxSteps MaxStepSize MaxValue MaxwellDistribution McLaughlinGroupMcL Mean MeanClusteringCoefficient MeanDegreeConnectivity MeanDeviation MeanFilter MeanGraphDistance MeanNeighborDegree MeanShift MeanShiftFilter Median MedianDeviation MedianFilter Medium MeijerG MeixnerDistribution MemberQ MemoryConstrained MemoryInUse Menu MenuAppearance MenuCommandKey MenuEvaluator MenuItem MenuPacket MenuSortingValue MenuStyle MenuView MergeDifferences Mesh MeshFunctions MeshRange MeshShading MeshStyle Message MessageDialog MessageList MessageName MessageOptions MessagePacket Messages MessagesNotebook MetaCharacters MetaInformation Method MethodOptions MexicanHatWavelet MeyerWavelet Min MinDetect MinFilter MinimalPolynomial MinimalStateSpaceModel Minimize Minors MinRecursion MinSize MinStableDistribution Minus MinusPlus MinValue Missing MissingDataMethod MittagLefflerE MixedRadix MixedRadixQuantity MixtureDistribution Mod Modal Mode Modular ModularLambda Module Modulus MoebiusMu Moment Momentary MomentConvert MomentEvaluate MomentGeneratingFunction Monday Monitor MonomialList MonomialOrder MonsterGroupM MorletWavelet MorphologicalBinarize MorphologicalBranchPoints MorphologicalComponents MorphologicalEulerNumber MorphologicalGraph MorphologicalPerimeter MorphologicalTransform Most MouseAnnotation MouseAppearance MouseAppearanceTag MouseButtons Mouseover MousePointerNote MousePosition MovingAverage MovingMedian MoyalDistribution MultiedgeStyle MultilaunchWarning MultiLetterItalics MultiLetterStyle MultilineFunction Multinomial MultinomialDistribution MultinormalDistribution MultiplicativeOrder Multiplicity Multiselection MultivariateHypergeometricDistribution MultivariatePoissonDistribution MultivariateTDistribution N NakagamiDistribution NameQ Names NamespaceBox Nand NArgMax NArgMin NBernoulliB NCache NDSolve NDSolveValue Nearest NearestFunction NeedCurrentFrontEndPackagePacket NeedCurrentFrontEndSymbolsPacket NeedlemanWunschSimilarity Needs Negative NegativeBinomialDistribution NegativeMultinomialDistribution NeighborhoodGraph Nest NestedGreaterGreater NestedLessLess NestedScriptRules NestList NestWhile NestWhileList NevilleThetaC NevilleThetaD NevilleThetaN NevilleThetaS NewPrimitiveStyle NExpectation Next NextPrime NHoldAll NHoldFirst NHoldRest NicholsGridLines NicholsPlot NIntegrate NMaximize NMaxValue NMinimize NMinValue NominalVariables NonAssociative NoncentralBetaDistribution NoncentralChiSquareDistribution NoncentralFRatioDistribution NoncentralStudentTDistribution NonCommutativeMultiply NonConstants None NonlinearModelFit NonlocalMeansFilter NonNegative NonPositive Nor NorlundB Norm Normal NormalDistribution NormalGrouping Normalize NormalizedSquaredEuclideanDistance NormalsFunction NormFunction Not NotCongruent NotCupCap NotDoubleVerticalBar Notebook NotebookApply NotebookAutoSave NotebookClose NotebookConvertSettings NotebookCreate NotebookCreateReturnObject NotebookDefault NotebookDelete NotebookDirectory NotebookDynamicExpression NotebookEvaluate NotebookEventActions NotebookFileName NotebookFind NotebookFindReturnObject NotebookGet NotebookGetLayoutInformationPacket NotebookGetMisspellingsPacket NotebookInformation NotebookInterfaceObject NotebookLocate NotebookObject NotebookOpen NotebookOpenReturnObject NotebookPath NotebookPrint NotebookPut NotebookPutReturnObject NotebookRead NotebookResetGeneratedCells Notebooks NotebookSave NotebookSaveAs NotebookSelection NotebookSetupLayoutInformationPacket NotebooksMenu NotebookWrite NotElement NotEqualTilde NotExists NotGreater NotGreaterEqual NotGreaterFullEqual NotGreaterGreater NotGreaterLess NotGreaterSlantEqual NotGreaterTilde NotHumpDownHump NotHumpEqual NotLeftTriangle NotLeftTriangleBar NotLeftTriangleEqual NotLess NotLessEqual NotLessFullEqual NotLessGreater NotLessLess NotLessSlantEqual NotLessTilde NotNestedGreaterGreater NotNestedLessLess NotPrecedes NotPrecedesEqual NotPrecedesSlantEqual NotPrecedesTilde NotReverseElement NotRightTriangle NotRightTriangleBar NotRightTriangleEqual NotSquareSubset NotSquareSubsetEqual NotSquareSuperset NotSquareSupersetEqual NotSubset NotSubsetEqual NotSucceeds NotSucceedsEqual NotSucceedsSlantEqual NotSucceedsTilde NotSuperset NotSupersetEqual NotTilde NotTildeEqual NotTildeFullEqual NotTildeTilde NotVerticalBar NProbability NProduct NProductFactors NRoots NSolve NSum NSumTerms Null NullRecords NullSpace NullWords Number NumberFieldClassNumber NumberFieldDiscriminant NumberFieldFundamentalUnits NumberFieldIntegralBasis NumberFieldNormRepresentatives NumberFieldRegulator NumberFieldRootsOfUnity NumberFieldSignature NumberForm NumberFormat NumberMarks NumberMultiplier NumberPadding NumberPoint NumberQ NumberSeparator NumberSigns NumberString Numerator NumericFunction NumericQ NuttallWindow NValues NyquistGridLines NyquistPlot O ObservabilityGramian ObservabilityMatrix ObservableDecomposition ObservableModelQ OddQ Off Offset OLEData On ONanGroupON OneIdentity Opacity Open OpenAppend Opener OpenerBox OpenerBoxOptions OpenerView OpenFunctionInspectorPacket Opening OpenRead OpenSpecialOptions OpenTemporary OpenWrite Operate OperatingSystem OptimumFlowData Optional OptionInspectorSettings OptionQ Options OptionsPacket OptionsPattern OptionValue OptionValueBox OptionValueBoxOptions Or Orange Order OrderDistribution OrderedQ Ordering Orderless OrnsteinUhlenbeckProcess Orthogonalize Out Outer OutputAutoOverwrite OutputControllabilityMatrix OutputControllableModelQ OutputForm OutputFormData OutputGrouping OutputMathEditExpression OutputNamePacket OutputResponse OutputSizeLimit OutputStream Over OverBar OverDot Overflow OverHat Overlaps Overlay OverlayBox OverlayBoxOptions Overscript OverscriptBox OverscriptBoxOptions OverTilde OverVector OwenT OwnValues PackingMethod PaddedForm Padding PadeApproximant PadLeft PadRight PageBreakAbove PageBreakBelow PageBreakWithin PageFooterLines PageFooters PageHeaderLines PageHeaders PageHeight PageRankCentrality PageWidth PairedBarChart PairedHistogram PairedSmoothHistogram PairedTTest PairedZTest PaletteNotebook PalettePath Pane PaneBox PaneBoxOptions Panel PanelBox PanelBoxOptions Paneled PaneSelector PaneSelectorBox PaneSelectorBoxOptions PaperWidth ParabolicCylinderD ParagraphIndent ParagraphSpacing ParallelArray ParallelCombine ParallelDo ParallelEvaluate Parallelization Parallelize ParallelMap ParallelNeeds ParallelProduct ParallelSubmit ParallelSum ParallelTable ParallelTry Parameter ParameterEstimator ParameterMixtureDistribution ParameterVariables ParametricFunction ParametricNDSolve ParametricNDSolveValue ParametricPlot ParametricPlot3D ParentConnect ParentDirectory ParentForm Parenthesize ParentList ParetoDistribution Part PartialCorrelationFunction PartialD ParticleData Partition PartitionsP PartitionsQ ParzenWindow PascalDistribution PassEventsDown PassEventsUp Paste PasteBoxFormInlineCells PasteButton Path PathGraph PathGraphQ Pattern PatternSequence PatternTest PauliMatrix PaulWavelet Pause PausedTime PDF PearsonChiSquareTest PearsonCorrelationTest PearsonDistribution PerformanceGoal PeriodicInterpolation Periodogram PeriodogramArray PermutationCycles PermutationCyclesQ PermutationGroup PermutationLength PermutationList PermutationListQ PermutationMax PermutationMin PermutationOrder PermutationPower PermutationProduct PermutationReplace Permutations PermutationSupport Permute PeronaMalikFilter Perpendicular PERTDistribution PetersenGraph PhaseMargins Pi Pick PIDData PIDDerivativeFilter PIDFeedforward PIDTune Piecewise PiecewiseExpand PieChart PieChart3D PillaiTrace PillaiTraceTest Pink Pivoting PixelConstrained PixelValue PixelValuePositions Placed Placeholder PlaceholderReplace Plain PlanarGraphQ Play PlayRange Plot Plot3D Plot3Matrix PlotDivision PlotJoined PlotLabel PlotLayout PlotLegends PlotMarkers PlotPoints PlotRange PlotRangeClipping PlotRangePadding PlotRegion PlotStyle Plus PlusMinus Pochhammer PodStates PodWidth Point Point3DBox PointBox PointFigureChart PointForm PointLegend PointSize PoissonConsulDistribution PoissonDistribution PoissonProcess PoissonWindow PolarAxes PolarAxesOrigin PolarGridLines PolarPlot PolarTicks PoleZeroMarkers PolyaAeppliDistribution PolyGamma Polygon Polygon3DBox Polygon3DBoxOptions PolygonBox PolygonBoxOptions PolygonHoleScale PolygonIntersections PolygonScale PolyhedronData PolyLog PolynomialExtendedGCD PolynomialForm PolynomialGCD PolynomialLCM PolynomialMod PolynomialQ PolynomialQuotient PolynomialQuotientRemainder PolynomialReduce PolynomialRemainder Polynomials PopupMenu PopupMenuBox PopupMenuBoxOptions PopupView PopupWindow Position Positive PositiveDefiniteMatrixQ PossibleZeroQ Postfix PostScript Power PowerDistribution PowerExpand PowerMod PowerModList PowerSpectralDensity PowersRepresentations PowerSymmetricPolynomial Precedence PrecedenceForm Precedes PrecedesEqual PrecedesSlantEqual PrecedesTilde Precision PrecisionGoal PreDecrement PredictionRoot PreemptProtect PreferencesPath Prefix PreIncrement Prepend PrependTo PreserveImageOptions Previous PriceGraphDistribution PrimaryPlaceholder Prime PrimeNu PrimeOmega PrimePi PrimePowerQ PrimeQ Primes PrimeZetaP PrimitiveRoot PrincipalComponents PrincipalValue Print PrintAction PrintForm PrintingCopies PrintingOptions PrintingPageRange PrintingStartingPageNumber PrintingStyleEnvironment PrintPrecision PrintTemporary Prism PrismBox PrismBoxOptions PrivateCellOptions PrivateEvaluationOptions PrivateFontOptions PrivateFrontEndOptions PrivateNotebookOptions PrivatePaths Probability ProbabilityDistribution ProbabilityPlot ProbabilityPr ProbabilityScalePlot ProbitModelFit ProcessEstimator ProcessParameterAssumptions ProcessParameterQ ProcessStateDomain ProcessTimeDomain Product ProductDistribution ProductLog ProgressIndicator ProgressIndicatorBox ProgressIndicatorBoxOptions Projection Prolog PromptForm Properties Property PropertyList PropertyValue Proportion Proportional Protect Protected ProteinData Pruning PseudoInverse Purple Put PutAppend Pyramid PyramidBox PyramidBoxOptions QBinomial QFactorial QGamma QHypergeometricPFQ QPochhammer QPolyGamma QRDecomposition QuadraticIrrationalQ Quantile QuantilePlot Quantity QuantityForm QuantityMagnitude QuantityQ QuantityUnit Quartics QuartileDeviation Quartiles QuartileSkewness QueueingNetworkProcess QueueingProcess QueueProperties Quiet Quit Quotient QuotientRemainder RadialityCentrality RadicalBox RadicalBoxOptions RadioButton RadioButtonBar RadioButtonBox RadioButtonBoxOptions Radon RamanujanTau RamanujanTauL RamanujanTauTheta RamanujanTauZ Random RandomChoice RandomComplex RandomFunction RandomGraph RandomImage RandomInteger RandomPermutation RandomPrime RandomReal RandomSample RandomSeed RandomVariate RandomWalkProcess Range RangeFilter RangeSpecification RankedMax RankedMin Raster Raster3D Raster3DBox Raster3DBoxOptions RasterArray RasterBox RasterBoxOptions Rasterize RasterSize Rational RationalFunctions Rationalize Rationals Ratios Raw RawArray RawBoxes RawData RawMedium RayleighDistribution Re Read ReadList ReadProtected Real RealBlockDiagonalForm RealDigits RealExponent Reals Reap Record RecordLists RecordSeparators Rectangle RectangleBox RectangleBoxOptions RectangleChart RectangleChart3D RecurrenceFilter RecurrenceTable RecurringDigitsForm Red Reduce RefBox ReferenceLineStyle ReferenceMarkers ReferenceMarkerStyle Refine ReflectionMatrix ReflectionTransform Refresh RefreshRate RegionBinarize RegionFunction RegionPlot RegionPlot3D RegularExpression Regularization Reinstall Release ReleaseHold ReliabilityDistribution ReliefImage ReliefPlot Remove RemoveAlphaChannel RemoveAsynchronousTask Removed RemoveInputStreamMethod RemoveOutputStreamMethod RemoveProperty RemoveScheduledTask RenameDirectory RenameFile RenderAll RenderingOptions RenewalProcess RenkoChart Repeated RepeatedNull RepeatedString Replace ReplaceAll ReplaceHeldPart ReplaceImageValue ReplaceList ReplacePart ReplacePixelValue ReplaceRepeated Resampling Rescale RescalingTransform ResetDirectory ResetMenusPacket ResetScheduledTask Residue Resolve Rest Resultant ResumePacket Return ReturnExpressionPacket ReturnInputFormPacket ReturnPacket ReturnTextPacket Reverse ReverseBiorthogonalSplineWavelet ReverseElement ReverseEquilibrium ReverseGraph ReverseUpEquilibrium RevolutionAxis RevolutionPlot3D RGBColor RiccatiSolve RiceDistribution RidgeFilter RiemannR RiemannSiegelTheta RiemannSiegelZ Riffle Right RightArrow RightArrowBar RightArrowLeftArrow RightCosetRepresentative RightDownTeeVector RightDownVector RightDownVectorBar RightTee RightTeeArrow RightTeeVector RightTriangle RightTriangleBar RightTriangleEqual RightUpDownVector RightUpTeeVector RightUpVector RightUpVectorBar RightVector RightVectorBar RiskAchievementImportance RiskReductionImportance RogersTanimotoDissimilarity Root RootApproximant RootIntervals RootLocusPlot RootMeanSquare RootOfUnityQ RootReduce Roots RootSum Rotate RotateLabel RotateLeft RotateRight RotationAction RotationBox RotationBoxOptions RotationMatrix RotationTransform Round RoundImplies RoundingRadius Row RowAlignments RowBackgrounds RowBox RowHeights RowLines RowMinHeight RowReduce RowsEqual RowSpacings RSolve RudvalisGroupRu Rule RuleCondition RuleDelayed RuleForm RulerUnits Run RunScheduledTask RunThrough RuntimeAttributes RuntimeOptions RussellRaoDissimilarity SameQ SameTest SampleDepth SampledSoundFunction SampledSoundList SampleRate SamplingPeriod SARIMAProcess SARMAProcess SatisfiabilityCount SatisfiabilityInstances SatisfiableQ Saturday Save Saveable SaveAutoDelete SaveDefinitions SawtoothWave Scale Scaled ScaleDivisions ScaledMousePosition ScaleOrigin ScalePadding ScaleRanges ScaleRangeStyle ScalingFunctions ScalingMatrix ScalingTransform Scan ScheduledTaskActiveQ ScheduledTaskData ScheduledTaskObject ScheduledTasks SchurDecomposition ScientificForm ScreenRectangle ScreenStyleEnvironment ScriptBaselineShifts ScriptLevel ScriptMinSize ScriptRules ScriptSizeMultipliers Scrollbars ScrollingOptions ScrollPosition Sec Sech SechDistribution SectionGrouping SectorChart SectorChart3D SectorOrigin SectorSpacing SeedRandom Select Selectable SelectComponents SelectedCells SelectedNotebook Selection SelectionAnimate SelectionCell SelectionCellCreateCell SelectionCellDefaultStyle SelectionCellParentStyle SelectionCreateCell SelectionDebuggerTag SelectionDuplicateCell SelectionEvaluate SelectionEvaluateCreateCell SelectionMove SelectionPlaceholder SelectionSetStyle SelectWithContents SelfLoops SelfLoopStyle SemialgebraicComponentInstances SendMail Sequence SequenceAlignment SequenceForm SequenceHold SequenceLimit Series SeriesCoefficient SeriesData SessionTime Set SetAccuracy SetAlphaChannel SetAttributes Setbacks SetBoxFormNamesPacket SetDelayed SetDirectory SetEnvironment SetEvaluationNotebook SetFileDate SetFileLoadingContext SetNotebookStatusLine SetOptions SetOptionsPacket SetPrecision SetProperty SetSelectedNotebook SetSharedFunction SetSharedVariable SetSpeechParametersPacket SetStreamPosition SetSystemOptions Setter SetterBar SetterBox SetterBoxOptions Setting SetValue Shading Shallow ShannonWavelet ShapiroWilkTest Share Sharpen ShearingMatrix ShearingTransform ShenCastanMatrix Short ShortDownArrow Shortest ShortestMatch ShortestPathFunction ShortLeftArrow ShortRightArrow ShortUpArrow Show ShowAutoStyles ShowCellBracket ShowCellLabel ShowCellTags ShowClosedCellArea ShowContents ShowControls ShowCursorTracker ShowGroupOpenCloseIcon ShowGroupOpener ShowInvisibleCharacters ShowPageBreaks ShowPredictiveInterface ShowSelection ShowShortBoxForm ShowSpecialCharacters ShowStringCharacters ShowSyntaxStyles ShrinkingDelay ShrinkWrapBoundingBox SiegelTheta SiegelTukeyTest Sign Signature SignedRankTest SignificanceLevel SignPadding SignTest SimilarityRules SimpleGraph SimpleGraphQ Simplify Sin Sinc SinghMaddalaDistribution SingleEvaluation SingleLetterItalics SingleLetterStyle SingularValueDecomposition SingularValueList SingularValuePlot SingularValues Sinh SinhIntegral SinIntegral SixJSymbol Skeleton SkeletonTransform SkellamDistribution Skewness SkewNormalDistribution Skip SliceDistribution Slider Slider2D Slider2DBox Slider2DBoxOptions SliderBox SliderBoxOptions SlideView Slot SlotSequence Small SmallCircle Smaller SmithDelayCompensator SmithWatermanSimilarity SmoothDensityHistogram SmoothHistogram SmoothHistogram3D SmoothKernelDistribution SocialMediaData Socket SokalSneathDissimilarity Solve SolveAlways SolveDelayed Sort SortBy Sound SoundAndGraphics SoundNote SoundVolume Sow Space SpaceForm Spacer Spacings Span SpanAdjustments SpanCharacterRounding SpanFromAbove SpanFromBoth SpanFromLeft SpanLineThickness SpanMaxSize SpanMinSize SpanningCharacters SpanSymmetric SparseArray SpatialGraphDistribution Speak SpeakTextPacket SpearmanRankTest SpearmanRho Spectrogram SpectrogramArray Specularity SpellingCorrection SpellingDictionaries SpellingDictionariesPath SpellingOptions SpellingSuggestionsPacket Sphere SphereBox SphericalBesselJ SphericalBesselY SphericalHankelH1 SphericalHankelH2 SphericalHarmonicY SphericalPlot3D SphericalRegion SpheroidalEigenvalue SpheroidalJoiningFactor SpheroidalPS SpheroidalPSPrime SpheroidalQS SpheroidalQSPrime SpheroidalRadialFactor SpheroidalS1 SpheroidalS1Prime SpheroidalS2 SpheroidalS2Prime Splice SplicedDistribution SplineClosed SplineDegree SplineKnots SplineWeights Split SplitBy SpokenString Sqrt SqrtBox SqrtBoxOptions Square SquaredEuclideanDistance SquareFreeQ SquareIntersection SquaresR SquareSubset SquareSubsetEqual SquareSuperset SquareSupersetEqual SquareUnion SquareWave StabilityMargins StabilityMarginsStyle StableDistribution Stack StackBegin StackComplete StackInhibit StandardDeviation StandardDeviationFilter StandardForm Standardize StandbyDistribution Star StarGraph StartAsynchronousTask StartingStepSize StartOfLine StartOfString StartScheduledTask StartupSound StateDimensions StateFeedbackGains StateOutputEstimator StateResponse StateSpaceModel StateSpaceRealization StateSpaceTransform StationaryDistribution StationaryWaveletPacketTransform StationaryWaveletTransform StatusArea StatusCentrality StepMonitor StieltjesGamma StirlingS1 StirlingS2 StopAsynchronousTask StopScheduledTask StrataVariables StratonovichProcess StreamColorFunction StreamColorFunctionScaling StreamDensityPlot StreamPlot StreamPoints StreamPosition Streams StreamScale StreamStyle String StringBreak StringByteCount StringCases StringCount StringDrop StringExpression StringForm StringFormat StringFreeQ StringInsert StringJoin StringLength StringMatchQ StringPosition StringQ StringReplace StringReplaceList StringReplacePart StringReverse StringRotateLeft StringRotateRight StringSkeleton StringSplit StringTake StringToStream StringTrim StripBoxes StripOnInput StripWrapperBoxes StrokeForm StructuralImportance StructuredArray StructuredSelection StruveH StruveL Stub StudentTDistribution Style StyleBox StyleBoxAutoDelete StyleBoxOptions StyleData StyleDefinitions StyleForm StyleKeyMapping StyleMenuListing StyleNameDialogSettings StyleNames StylePrint StyleSheetPath Subfactorial Subgraph SubMinus SubPlus SubresultantPolynomialRemainders SubresultantPolynomials Subresultants Subscript SubscriptBox SubscriptBoxOptions Subscripted Subset SubsetEqual Subsets SubStar Subsuperscript SubsuperscriptBox SubsuperscriptBoxOptions Subtract SubtractFrom SubValues Succeeds SucceedsEqual SucceedsSlantEqual SucceedsTilde SuchThat Sum SumConvergence Sunday SuperDagger SuperMinus SuperPlus Superscript SuperscriptBox SuperscriptBoxOptions Superset SupersetEqual SuperStar Surd SurdForm SurfaceColor SurfaceGraphics SurvivalDistribution SurvivalFunction SurvivalModel SurvivalModelFit SuspendPacket SuzukiDistribution SuzukiGroupSuz SwatchLegend Switch Symbol SymbolName SymletWavelet Symmetric SymmetricGroup SymmetricMatrixQ SymmetricPolynomial SymmetricReduction Symmetrize SymmetrizedArray SymmetrizedArrayRules SymmetrizedDependentComponents SymmetrizedIndependentComponents SymmetrizedReplacePart SynchronousInitialization SynchronousUpdating Syntax SyntaxForm SyntaxInformation SyntaxLength SyntaxPacket SyntaxQ SystemDialogInput SystemException SystemHelpPath SystemInformation SystemInformationData SystemOpen SystemOptions SystemsModelDelay SystemsModelDelayApproximate SystemsModelDelete SystemsModelDimensions SystemsModelExtract SystemsModelFeedbackConnect SystemsModelLabels SystemsModelOrder SystemsModelParallelConnect SystemsModelSeriesConnect SystemsModelStateFeedbackConnect SystemStub Tab TabFilling Table TableAlignments TableDepth TableDirections TableForm TableHeadings TableSpacing TableView TableViewBox TabSpacings TabView TabViewBox TabViewBoxOptions TagBox TagBoxNote TagBoxOptions TaggingRules TagSet TagSetDelayed TagStyle TagUnset Take TakeWhile Tally Tan Tanh TargetFunctions TargetUnits TautologyQ TelegraphProcess TemplateBox TemplateBoxOptions TemplateSlotSequence TemporalData Temporary TemporaryVariable TensorContract TensorDimensions TensorExpand TensorProduct TensorQ TensorRank TensorReduce TensorSymmetry TensorTranspose TensorWedge Tetrahedron TetrahedronBox TetrahedronBoxOptions TeXForm TeXSave Text Text3DBox Text3DBoxOptions TextAlignment TextBand TextBoundingBox TextBox TextCell TextClipboardType TextData TextForm TextJustification TextLine TextPacket TextParagraph TextRecognize TextRendering TextStyle Texture TextureCoordinateFunction TextureCoordinateScaling Therefore ThermometerGauge Thick Thickness Thin Thinning ThisLink ThompsonGroupTh Thread ThreeJSymbol Threshold Through Throw Thumbnail Thursday Ticks TicksStyle Tilde TildeEqual TildeFullEqual TildeTilde TimeConstrained TimeConstraint Times TimesBy TimeSeriesForecast TimeSeriesInvertibility TimeUsed TimeValue TimeZone Timing Tiny TitleGrouping TitsGroupT ToBoxes ToCharacterCode ToColor ToContinuousTimeModel ToDate ToDiscreteTimeModel ToeplitzMatrix ToExpression ToFileName Together Toggle ToggleFalse Toggler TogglerBar TogglerBox TogglerBoxOptions ToHeldExpression ToInvertibleTimeSeries TokenWords Tolerance ToLowerCase ToNumberField TooBig Tooltip TooltipBox TooltipBoxOptions TooltipDelay TooltipStyle Top TopHatTransform TopologicalSort ToRadicals ToRules ToString Total TotalHeight TotalVariationFilter TotalWidth TouchscreenAutoZoom TouchscreenControlPlacement ToUpperCase Tr Trace TraceAbove TraceAction TraceBackward TraceDepth TraceDialog TraceForward TraceInternal TraceLevel TraceOff TraceOn TraceOriginal TracePrint TraceScan TrackedSymbols TradingChart TraditionalForm TraditionalFunctionNotation TraditionalNotation TraditionalOrder TransferFunctionCancel TransferFunctionExpand TransferFunctionFactor TransferFunctionModel TransferFunctionPoles TransferFunctionTransform TransferFunctionZeros TransformationFunction TransformationFunctions TransformationMatrix TransformedDistribution TransformedField Translate TranslationTransform TransparentColor Transpose TreeForm TreeGraph TreeGraphQ TreePlot TrendStyle TriangleWave TriangularDistribution Trig TrigExpand TrigFactor TrigFactorList Trigger TrigReduce TrigToExp TrimmedMean True TrueQ TruncatedDistribution TsallisQExponentialDistribution TsallisQGaussianDistribution TTest Tube TubeBezierCurveBox TubeBezierCurveBoxOptions TubeBox TubeBSplineCurveBox TubeBSplineCurveBoxOptions Tuesday TukeyLambdaDistribution TukeyWindow Tuples TuranGraph TuringMachine Transparent UnateQ Uncompress Undefined UnderBar Underflow Underlined Underoverscript UnderoverscriptBox UnderoverscriptBoxOptions Underscript UnderscriptBox UnderscriptBoxOptions UndirectedEdge UndirectedGraph UndirectedGraphQ UndocumentedTestFEParserPacket UndocumentedTestGetSelectionPacket Unequal Unevaluated UniformDistribution UniformGraphDistribution UniformSumDistribution Uninstall Union UnionPlus Unique UnitBox UnitConvert UnitDimensions Unitize UnitRootTest UnitSimplify UnitStep UnitTriangle UnitVector Unprotect UnsameQ UnsavedVariables Unset UnsetShared UntrackedVariables Up UpArrow UpArrowBar UpArrowDownArrow Update UpdateDynamicObjects UpdateDynamicObjectsSynchronous UpdateInterval UpDownArrow UpEquilibrium UpperCaseQ UpperLeftArrow UpperRightArrow UpperTriangularize Upsample UpSet UpSetDelayed UpTee UpTeeArrow UpValues URL URLFetch URLFetchAsynchronous URLSave URLSaveAsynchronous UseGraphicsRange Using UsingFrontEnd V2Get ValidationLength Value ValueBox ValueBoxOptions ValueForm ValueQ ValuesData Variables Variance VarianceEquivalenceTest VarianceEstimatorFunction VarianceGammaDistribution VarianceTest VectorAngle VectorColorFunction VectorColorFunctionScaling VectorDensityPlot VectorGlyphData VectorPlot VectorPlot3D VectorPoints VectorQ Vectors VectorScale VectorStyle Vee Verbatim Verbose VerboseConvertToPostScriptPacket VerifyConvergence VerifySolutions VerifyTestAssumptions Version VersionNumber VertexAdd VertexCapacity VertexColors VertexComponent VertexConnectivity VertexCoordinateRules VertexCoordinates VertexCorrelationSimilarity VertexCosineSimilarity VertexCount VertexCoverQ VertexDataCoordinates VertexDegree VertexDelete VertexDiceSimilarity VertexEccentricity VertexInComponent VertexInDegree VertexIndex VertexJaccardSimilarity VertexLabeling VertexLabels VertexLabelStyle VertexList VertexNormals VertexOutComponent VertexOutDegree VertexQ VertexRenderingFunction VertexReplace VertexShape VertexShapeFunction VertexSize VertexStyle VertexTextureCoordinates VertexWeight Vertical VerticalBar VerticalForm VerticalGauge VerticalSeparator VerticalSlider VerticalTilde ViewAngle ViewCenter ViewMatrix ViewPoint ViewPointSelectorSettings ViewPort ViewRange ViewVector ViewVertical VirtualGroupData Visible VisibleCell VoigtDistribution VonMisesDistribution WaitAll WaitAsynchronousTask WaitNext WaitUntil WakebyDistribution WalleniusHypergeometricDistribution WaringYuleDistribution WatershedComponents WatsonUSquareTest WattsStrogatzGraphDistribution WaveletBestBasis WaveletFilterCoefficients WaveletImagePlot WaveletListPlot WaveletMapIndexed WaveletMatrixPlot WaveletPhi WaveletPsi WaveletScale WaveletScalogram WaveletThreshold WeaklyConnectedComponents WeaklyConnectedGraphQ WeakStationarity WeatherData WeberE Wedge Wednesday WeibullDistribution WeierstrassHalfPeriods WeierstrassInvariants WeierstrassP WeierstrassPPrime WeierstrassSigma WeierstrassZeta WeightedAdjacencyGraph WeightedAdjacencyMatrix WeightedData WeightedGraphQ Weights WelchWindow WheelGraph WhenEvent Which While White Whitespace WhitespaceCharacter WhittakerM WhittakerW WienerFilter WienerProcess WignerD WignerSemicircleDistribution WilksW WilksWTest WindowClickSelect WindowElements WindowFloating WindowFrame WindowFrameElements WindowMargins WindowMovable WindowOpacity WindowSelected WindowSize WindowStatusArea WindowTitle WindowToolbars WindowWidth With WolframAlpha WolframAlphaDate WolframAlphaQuantity WolframAlphaResult Word WordBoundary WordCharacter WordData WordSearch WordSeparators WorkingPrecision Write WriteString Wronskian XMLElement XMLObject Xnor Xor Yellow YuleDissimilarity ZernikeR ZeroSymmetric ZeroTest ZeroWidthTimes Zeta ZetaZero ZipfDistribution ZTest ZTransform $Aborted $ActivationGroupID $ActivationKey $ActivationUserRegistered $AddOnsDirectory $AssertFunction $Assumptions $AsynchronousTask $BaseDirectory $BatchInput $BatchOutput $BoxForms $ByteOrdering $Canceled $CharacterEncoding $CharacterEncodings $CommandLine $CompilationTarget $ConditionHold $ConfiguredKernels $Context $ContextPath $ControlActiveSetting $CreationDate $CurrentLink $DateStringFormat $DefaultFont $DefaultFrontEnd $DefaultImagingDevice $DefaultPath $Display $DisplayFunction $DistributedContexts $DynamicEvaluation $Echo $Epilog $ExportFormats $Failed $FinancialDataSource $FormatType $FrontEnd $FrontEndSession $GeoLocation $HistoryLength $HomeDirectory $HTTPCookies $IgnoreEOF $ImagingDevices $ImportFormats $InitialDirectory $Input $InputFileName $InputStreamMethods $Inspector $InstallationDate $InstallationDirectory $InterfaceEnvironment $IterationLimit $KernelCount $KernelID $Language $LaunchDirectory $LibraryPath $LicenseExpirationDate $LicenseID $LicenseProcesses $LicenseServer $LicenseSubprocesses $LicenseType $Line $Linked $LinkSupported $LoadedFiles $MachineAddresses $MachineDomain $MachineDomains $MachineEpsilon $MachineID $MachineName $MachinePrecision $MachineType $MaxExtraPrecision $MaxLicenseProcesses $MaxLicenseSubprocesses $MaxMachineNumber $MaxNumber $MaxPiecewiseCases $MaxPrecision $MaxRootDegree $MessageGroups $MessageList $MessagePrePrint $Messages $MinMachineNumber $MinNumber $MinorReleaseNumber $MinPrecision $ModuleNumber $NetworkLicense $NewMessage $NewSymbol $Notebooks $NumberMarks $Off $OperatingSystem $Output $OutputForms $OutputSizeLimit $OutputStreamMethods $Packages $ParentLink $ParentProcessID $PasswordFile $PatchLevelID $Path $PathnameSeparator $PerformanceGoal $PipeSupported $Post $Pre $PreferencesDirectory $PrePrint $PreRead $PrintForms $PrintLiteral $ProcessID $ProcessorCount $ProcessorType $ProductInformation $ProgramName $RandomState $RecursionLimit $ReleaseNumber $RootDirectory $ScheduledTask $ScriptCommandLine $SessionID $SetParentLink $SharedFunctions $SharedVariables $SoundDisplay $SoundDisplayFunction $SuppressInputFormHeads $SynchronousEvaluation $SyntaxHandler $System $SystemCharacterEncoding $SystemID $SystemWordLength $TemporaryDirectory $TemporaryPrefix $TextStyle $TimedOut $TimeUnit $TimeZone $TopDirectory $TraceOff $TraceOn $TracePattern $TracePostAction $TracePreAction $Urgent $UserAddOnsDirectory $UserBaseDirectory $UserDocumentsDirectory $UserName $Version $VersionNumber", +contains:[{className:"comment",begin:/\(\*/,end:/\*\)/},a.APOS_STRING_MODE,a.QUOTE_STRING_MODE,a.C_NUMBER_MODE,{className:"list",begin:/\{/,end:/\}/,illegal:/:/}]}}),a.registerLanguage("matlab",function(a){var b=[a.C_NUMBER_MODE,{className:"string",begin:"'",end:"'",contains:[a.BACKSLASH_ESCAPE,{begin:"''"}]}],c={relevance:0,contains:[{className:"operator",begin:/'['\.]*/}]};return{keywords:{keyword:"break case catch classdef continue else elseif end enumerated events for function global if methods otherwise parfor persistent properties return spmd switch try while",built_in:"sin sind sinh asin asind asinh cos cosd cosh acos acosd acosh tan tand tanh atan atand atan2 atanh sec secd sech asec asecd asech csc cscd csch acsc acscd acsch cot cotd coth acot acotd acoth hypot exp expm1 log log1p log10 log2 pow2 realpow reallog realsqrt sqrt nthroot nextpow2 abs angle complex conj imag real unwrap isreal cplxpair fix floor ceil round mod rem sign airy besselj bessely besselh besseli besselk beta betainc betaln ellipj ellipke erf erfc erfcx erfinv expint gamma gammainc gammaln psi legendre cross dot factor isprime primes gcd lcm rat rats perms nchoosek factorial cart2sph cart2pol pol2cart sph2cart hsv2rgb rgb2hsv zeros ones eye repmat rand randn linspace logspace freqspace meshgrid accumarray size length ndims numel disp isempty isequal isequalwithequalnans cat reshape diag blkdiag tril triu fliplr flipud flipdim rot90 find sub2ind ind2sub bsxfun ndgrid permute ipermute shiftdim circshift squeeze isscalar isvector ans eps realmax realmin pi i inf nan isnan isinf isfinite j why compan gallery hadamard hankel hilb invhilb magic pascal rosser toeplitz vander wilkinson"},illegal:'(//|"|#|/\\*|\\s+/\\w+)',contains:[{className:"function",beginKeywords:"function",end:"$",contains:[a.UNDERSCORE_TITLE_MODE,{className:"params",begin:"\\(",end:"\\)"},{className:"params",begin:"\\[",end:"\\]"}]},{begin:/[a-zA-Z_][a-zA-Z_0-9]*'['\.]*/,returnBegin:!0,relevance:0,contains:[{begin:/[a-zA-Z_][a-zA-Z_0-9]*/,relevance:0},c.contains[0]]},{className:"matrix",begin:"\\[",end:"\\]",contains:b,relevance:0,starts:c},{className:"cell",begin:"\\{",end:/}/,contains:b,relevance:0,starts:c},{begin:/\)/,relevance:0,starts:c},a.COMMENT("^\\s*\\%\\{\\s*$","^\\s*\\%\\}\\s*$"),a.COMMENT("\\%","$")].concat(b)}}),a.registerLanguage("mel",function(a){return{keywords:"int float string vector matrix if else switch case default while do for in break continue global proc return about abs addAttr addAttributeEditorNodeHelp addDynamic addNewShelfTab addPP addPanelCategory addPrefixToName advanceToNextDrivenKey affectedNet affects aimConstraint air alias aliasAttr align alignCtx alignCurve alignSurface allViewFit ambientLight angle angleBetween animCone animCurveEditor animDisplay animView annotate appendStringArray applicationName applyAttrPreset applyTake arcLenDimContext arcLengthDimension arclen arrayMapper art3dPaintCtx artAttrCtx artAttrPaintVertexCtx artAttrSkinPaintCtx artAttrTool artBuildPaintMenu artFluidAttrCtx artPuttyCtx artSelectCtx artSetPaintCtx artUserPaintCtx assignCommand assignInputDevice assignViewportFactories attachCurve attachDeviceAttr attachSurface attrColorSliderGrp attrCompatibility attrControlGrp attrEnumOptionMenu attrEnumOptionMenuGrp attrFieldGrp attrFieldSliderGrp attrNavigationControlGrp attrPresetEditWin attributeExists attributeInfo attributeMenu attributeQuery autoKeyframe autoPlace bakeClip bakeFluidShading bakePartialHistory bakeResults bakeSimulation basename basenameEx batchRender bessel bevel bevelPlus binMembership bindSkin blend2 blendShape blendShapeEditor blendShapePanel blendTwoAttr blindDataType boneLattice boundary boxDollyCtx boxZoomCtx bufferCurve buildBookmarkMenu buildKeyframeMenu button buttonManip CBG cacheFile cacheFileCombine cacheFileMerge cacheFileTrack camera cameraView canCreateManip canvas capitalizeString catch catchQuiet ceil changeSubdivComponentDisplayLevel changeSubdivRegion channelBox character characterMap characterOutlineEditor characterize chdir checkBox checkBoxGrp checkDefaultRenderGlobals choice circle circularFillet clamp clear clearCache clip clipEditor clipEditorCurrentTimeCtx clipSchedule clipSchedulerOutliner clipTrimBefore closeCurve closeSurface cluster cmdFileOutput cmdScrollFieldExecuter cmdScrollFieldReporter cmdShell coarsenSubdivSelectionList collision color colorAtPoint colorEditor colorIndex colorIndexSliderGrp colorSliderButtonGrp colorSliderGrp columnLayout commandEcho commandLine commandPort compactHairSystem componentEditor compositingInterop computePolysetVolume condition cone confirmDialog connectAttr connectControl connectDynamic connectJoint connectionInfo constrain constrainValue constructionHistory container containsMultibyte contextInfo control convertFromOldLayers convertIffToPsd convertLightmap convertSolidTx convertTessellation convertUnit copyArray copyFlexor copyKey copySkinWeights cos cpButton cpCache cpClothSet cpCollision cpConstraint cpConvClothToMesh cpForces cpGetSolverAttr cpPanel cpProperty cpRigidCollisionFilter cpSeam cpSetEdit cpSetSolverAttr cpSolver cpSolverTypes cpTool cpUpdateClothUVs createDisplayLayer createDrawCtx createEditor createLayeredPsdFile createMotionField createNewShelf createNode createRenderLayer createSubdivRegion cross crossProduct ctxAbort ctxCompletion ctxEditMode ctxTraverse currentCtx currentTime currentTimeCtx currentUnit curve curveAddPtCtx curveCVCtx curveEPCtx curveEditorCtx curveIntersect curveMoveEPCtx curveOnSurface curveSketchCtx cutKey cycleCheck cylinder dagPose date defaultLightListCheckBox defaultNavigation defineDataServer defineVirtualDevice deformer deg_to_rad delete deleteAttr deleteShadingGroupsAndMaterials deleteShelfTab deleteUI deleteUnusedBrushes delrandstr detachCurve detachDeviceAttr detachSurface deviceEditor devicePanel dgInfo dgdirty dgeval dgtimer dimWhen directKeyCtx directionalLight dirmap dirname disable disconnectAttr disconnectJoint diskCache displacementToPoly displayAffected displayColor displayCull displayLevelOfDetail displayPref displayRGBColor displaySmoothness displayStats displayString displaySurface distanceDimContext distanceDimension doBlur dolly dollyCtx dopeSheetEditor dot dotProduct doubleProfileBirailSurface drag dragAttrContext draggerContext dropoffLocator duplicate duplicateCurve duplicateSurface dynCache dynControl dynExport dynExpression dynGlobals dynPaintEditor dynParticleCtx dynPref dynRelEdPanel dynRelEditor dynamicLoad editAttrLimits editDisplayLayerGlobals editDisplayLayerMembers editRenderLayerAdjustment editRenderLayerGlobals editRenderLayerMembers editor editorTemplate effector emit emitter enableDevice encodeString endString endsWith env equivalent equivalentTol erf error eval evalDeferred evalEcho event exactWorldBoundingBox exclusiveLightCheckBox exec executeForEachObject exists exp expression expressionEditorListen extendCurve extendSurface extrude fcheck fclose feof fflush fgetline fgetword file fileBrowserDialog fileDialog fileExtension fileInfo filetest filletCurve filter filterCurve filterExpand filterStudioImport findAllIntersections findAnimCurves findKeyframe findMenuItem findRelatedSkinCluster finder firstParentOf fitBspline flexor floatEq floatField floatFieldGrp floatScrollBar floatSlider floatSlider2 floatSliderButtonGrp floatSliderGrp floor flow fluidCacheInfo fluidEmitter fluidVoxelInfo flushUndo fmod fontDialog fopen formLayout format fprint frameLayout fread freeFormFillet frewind fromNativePath fwrite gamma gauss geometryConstraint getApplicationVersionAsFloat getAttr getClassification getDefaultBrush getFileList getFluidAttr getInputDeviceRange getMayaPanelTypes getModifiers getPanel getParticleAttr getPluginResource getenv getpid glRender glRenderEditor globalStitch gmatch goal gotoBindPose grabColor gradientControl gradientControlNoAttr graphDollyCtx graphSelectContext graphTrackCtx gravity grid gridLayout group groupObjectsByName HfAddAttractorToAS HfAssignAS HfBuildEqualMap HfBuildFurFiles HfBuildFurImages HfCancelAFR HfConnectASToHF HfCreateAttractor HfDeleteAS HfEditAS HfPerformCreateAS HfRemoveAttractorFromAS HfSelectAttached HfSelectAttractors HfUnAssignAS hardenPointCurve hardware hardwareRenderPanel headsUpDisplay headsUpMessage help helpLine hermite hide hilite hitTest hotBox hotkey hotkeyCheck hsv_to_rgb hudButton hudSlider hudSliderButton hwReflectionMap hwRender hwRenderLoad hyperGraph hyperPanel hyperShade hypot iconTextButton iconTextCheckBox iconTextRadioButton iconTextRadioCollection iconTextScrollList iconTextStaticLabel ikHandle ikHandleCtx ikHandleDisplayScale ikSolver ikSplineHandleCtx ikSystem ikSystemInfo ikfkDisplayMethod illustratorCurves image imfPlugins inheritTransform insertJoint insertJointCtx insertKeyCtx insertKnotCurve insertKnotSurface instance instanceable instancer intField intFieldGrp intScrollBar intSlider intSliderGrp interToUI internalVar intersect iprEngine isAnimCurve isConnected isDirty isParentOf isSameObject isTrue isValidObjectName isValidString isValidUiName isolateSelect itemFilter itemFilterAttr itemFilterRender itemFilterType joint jointCluster jointCtx jointDisplayScale jointLattice keyTangent keyframe keyframeOutliner keyframeRegionCurrentTimeCtx keyframeRegionDirectKeyCtx keyframeRegionDollyCtx keyframeRegionInsertKeyCtx keyframeRegionMoveKeyCtx keyframeRegionScaleKeyCtx keyframeRegionSelectKeyCtx keyframeRegionSetKeyCtx keyframeRegionTrackCtx keyframeStats lassoContext lattice latticeDeformKeyCtx launch launchImageEditor layerButton layeredShaderPort layeredTexturePort layout layoutDialog lightList lightListEditor lightListPanel lightlink lineIntersection linearPrecision linstep listAnimatable listAttr listCameras listConnections listDeviceAttachments listHistory listInputDeviceAxes listInputDeviceButtons listInputDevices listMenuAnnotation listNodeTypes listPanelCategories listRelatives listSets listTransforms listUnselected listerEditor loadFluid loadNewShelf loadPlugin loadPluginLanguageResources loadPrefObjects localizedPanelLabel lockNode loft log longNameOf lookThru ls lsThroughFilter lsType lsUI Mayatomr mag makeIdentity makeLive makePaintable makeRoll makeSingleSurface makeTubeOn makebot manipMoveContext manipMoveLimitsCtx manipOptions manipRotateContext manipRotateLimitsCtx manipScaleContext manipScaleLimitsCtx marker match max memory menu menuBarLayout menuEditor menuItem menuItemToShelf menuSet menuSetPref messageLine min minimizeApp mirrorJoint modelCurrentTimeCtx modelEditor modelPanel mouse movIn movOut move moveIKtoFK moveKeyCtx moveVertexAlongDirection multiProfileBirailSurface mute nParticle nameCommand nameField namespace namespaceInfo newPanelItems newton nodeCast nodeIconButton nodeOutliner nodePreset nodeType noise nonLinear normalConstraint normalize nurbsBoolean nurbsCopyUVSet nurbsCube nurbsEditUV nurbsPlane nurbsSelect nurbsSquare nurbsToPoly nurbsToPolygonsPref nurbsToSubdiv nurbsToSubdivPref nurbsUVSet nurbsViewDirectionVector objExists objectCenter objectLayer objectType objectTypeUI obsoleteProc oceanNurbsPreviewPlane offsetCurve offsetCurveOnSurface offsetSurface openGLExtension openMayaPref optionMenu optionMenuGrp optionVar orbit orbitCtx orientConstraint outlinerEditor outlinerPanel overrideModifier paintEffectsDisplay pairBlend palettePort paneLayout panel panelConfiguration panelHistory paramDimContext paramDimension paramLocator parent parentConstraint particle particleExists particleInstancer particleRenderInfo partition pasteKey pathAnimation pause pclose percent performanceOptions pfxstrokes pickWalk picture pixelMove planarSrf plane play playbackOptions playblast plugAttr plugNode pluginInfo pluginResourceUtil pointConstraint pointCurveConstraint pointLight pointMatrixMult pointOnCurve pointOnSurface pointPosition poleVectorConstraint polyAppend polyAppendFacetCtx polyAppendVertex polyAutoProjection polyAverageNormal polyAverageVertex polyBevel polyBlendColor polyBlindData polyBoolOp polyBridgeEdge polyCacheMonitor polyCheck polyChipOff polyClipboard polyCloseBorder polyCollapseEdge polyCollapseFacet polyColorBlindData polyColorDel polyColorPerVertex polyColorSet polyCompare polyCone polyCopyUV polyCrease polyCreaseCtx polyCreateFacet polyCreateFacetCtx polyCube polyCut polyCutCtx polyCylinder polyCylindricalProjection polyDelEdge polyDelFacet polyDelVertex polyDuplicateAndConnect polyDuplicateEdge polyEditUV polyEditUVShell polyEvaluate polyExtrudeEdge polyExtrudeFacet polyExtrudeVertex polyFlipEdge polyFlipUV polyForceUV polyGeoSampler polyHelix polyInfo polyInstallAction polyLayoutUV polyListComponentConversion polyMapCut polyMapDel polyMapSew polyMapSewMove polyMergeEdge polyMergeEdgeCtx polyMergeFacet polyMergeFacetCtx polyMergeUV polyMergeVertex polyMirrorFace polyMoveEdge polyMoveFacet polyMoveFacetUV polyMoveUV polyMoveVertex polyNormal polyNormalPerVertex polyNormalizeUV polyOptUvs polyOptions polyOutput polyPipe polyPlanarProjection polyPlane polyPlatonicSolid polyPoke polyPrimitive polyPrism polyProjection polyPyramid polyQuad polyQueryBlindData polyReduce polySelect polySelectConstraint polySelectConstraintMonitor polySelectCtx polySelectEditCtx polySeparate polySetToFaceNormal polySewEdge polyShortestPathCtx polySmooth polySoftEdge polySphere polySphericalProjection polySplit polySplitCtx polySplitEdge polySplitRing polySplitVertex polyStraightenUVBorder polySubdivideEdge polySubdivideFacet polyToSubdiv polyTorus polyTransfer polyTriangulate polyUVSet polyUnite polyWedgeFace popen popupMenu pose pow preloadRefEd print progressBar progressWindow projFileViewer projectCurve projectTangent projectionContext projectionManip promptDialog propModCtx propMove psdChannelOutliner psdEditTextureFile psdExport psdTextureFile putenv pwd python querySubdiv quit rad_to_deg radial radioButton radioButtonGrp radioCollection radioMenuItemCollection rampColorPort rand randomizeFollicles randstate rangeControl readTake rebuildCurve rebuildSurface recordAttr recordDevice redo reference referenceEdit referenceQuery refineSubdivSelectionList refresh refreshAE registerPluginResource rehash reloadImage removeJoint removeMultiInstance removePanelCategory rename renameAttr renameSelectionList renameUI render renderGlobalsNode renderInfo renderLayerButton renderLayerParent renderLayerPostProcess renderLayerUnparent renderManip renderPartition renderQualityNode renderSettings renderThumbnailUpdate renderWindowEditor renderWindowSelectContext renderer reorder reorderDeformers requires reroot resampleFluid resetAE resetPfxToPolyCamera resetTool resolutionNode retarget reverseCurve reverseSurface revolve rgb_to_hsv rigidBody rigidSolver roll rollCtx rootOf rot rotate rotationInterpolation roundConstantRadius rowColumnLayout rowLayout runTimeCommand runup sampleImage saveAllShelves saveAttrPreset saveFluid saveImage saveInitialState saveMenu savePrefObjects savePrefs saveShelf saveToolSettings scale scaleBrushBrightness scaleComponents scaleConstraint scaleKey scaleKeyCtx sceneEditor sceneUIReplacement scmh scriptCtx scriptEditorInfo scriptJob scriptNode scriptTable scriptToShelf scriptedPanel scriptedPanelType scrollField scrollLayout sculpt searchPathArray seed selLoadSettings select selectContext selectCurveCV selectKey selectKeyCtx selectKeyframeRegionCtx selectMode selectPref selectPriority selectType selectedNodes selectionConnection separator setAttr setAttrEnumResource setAttrMapping setAttrNiceNameResource setConstraintRestPosition setDefaultShadingGroup setDrivenKeyframe setDynamic setEditCtx setEditor setFluidAttr setFocus setInfinity setInputDeviceMapping setKeyCtx setKeyPath setKeyframe setKeyframeBlendshapeTargetWts setMenuMode setNodeNiceNameResource setNodeTypeFlag setParent setParticleAttr setPfxToPolyCamera setPluginResource setProject setStampDensity setStartupMessage setState setToolTo setUITemplate setXformManip sets shadingConnection shadingGeometryRelCtx shadingLightRelCtx shadingNetworkCompare shadingNode shapeCompare shelfButton shelfLayout shelfTabLayout shellField shortNameOf showHelp showHidden showManipCtx showSelectionInTitle showShadingGroupAttrEditor showWindow sign simplify sin singleProfileBirailSurface size sizeBytes skinCluster skinPercent smoothCurve smoothTangentSurface smoothstep snap2to2 snapKey snapMode snapTogetherCtx snapshot soft softMod softModCtx sort sound soundControl source spaceLocator sphere sphrand spotLight spotLightPreviewPort spreadSheetEditor spring sqrt squareSurface srtContext stackTrace startString startsWith stitchAndExplodeShell stitchSurface stitchSurfacePoints strcmp stringArrayCatenate stringArrayContains stringArrayCount stringArrayInsertAtIndex stringArrayIntersector stringArrayRemove stringArrayRemoveAtIndex stringArrayRemoveDuplicates stringArrayRemoveExact stringArrayToString stringToStringArray strip stripPrefixFromName stroke subdAutoProjection subdCleanTopology subdCollapse subdDuplicateAndConnect subdEditUV subdListComponentConversion subdMapCut subdMapSewMove subdMatchTopology subdMirror subdToBlind subdToPoly subdTransferUVsToCache subdiv subdivCrease subdivDisplaySmoothness substitute substituteAllString substituteGeometry substring surface surfaceSampler surfaceShaderList swatchDisplayPort switchTable symbolButton symbolCheckBox sysFile system tabLayout tan tangentConstraint texLatticeDeformContext texManipContext texMoveContext texMoveUVShellContext texRotateContext texScaleContext texSelectContext texSelectShortestPathCtx texSmudgeUVContext texWinToolCtx text textCurves textField textFieldButtonGrp textFieldGrp textManip textScrollList textToShelf textureDisplacePlane textureHairColor texturePlacementContext textureWindow threadCount threePointArcCtx timeControl timePort timerX toNativePath toggle toggleAxis toggleWindowVisibility tokenize tokenizeList tolerance tolower toolButton toolCollection toolDropped toolHasOptions toolPropertyWindow torus toupper trace track trackCtx transferAttributes transformCompare transformLimits translator trim trunc truncateFluidCache truncateHairCache tumble tumbleCtx turbulence twoPointArcCtx uiRes uiTemplate unassignInputDevice undo undoInfo ungroup uniform unit unloadPlugin untangleUV untitledFileName untrim upAxis updateAE userCtx uvLink uvSnapshot validateShelfName vectorize view2dToolCtx viewCamera viewClipPlane viewFit viewHeadOn viewLookAt viewManip viewPlace viewSet visor volumeAxis vortex waitCursor warning webBrowser webBrowserPrefs whatIs window windowPref wire wireContext workspace wrinkle wrinkleContext writeTake xbmLangPathList xform",illegal:""},{begin:"<=",relevance:0},{begin:"=>",relevance:0},{begin:"/\\\\"},{begin:"\\\\/"}]},k={className:"built_in",variants:[{begin:":-\\|-->"},{begin:"=",relevance:0}]};return{aliases:["m","moo"],keywords:b,contains:[j,k,d,e,f,a.NUMBER_MODE,g,h,{begin:/:-/}]}}),a.registerLanguage("mizar",function(a){return{keywords:"environ vocabularies notations constructors definitions registrations theorems schemes requirements begin end definition registration cluster existence pred func defpred deffunc theorem proof let take assume then thus hence ex for st holds consider reconsider such that and in provided of as from be being by means equals implies iff redefine define now not or attr is mode suppose per cases set thesis contradiction scheme reserve struct correctness compatibility coherence symmetry assymetry reflexivity irreflexivity connectedness uniqueness commutativity idempotence involutiveness projectivity",contains:[a.COMMENT("::","$")]}}),a.registerLanguage("perl",function(a){var b="getpwent getservent quotemeta msgrcv scalar kill dbmclose undef lc ma syswrite tr send umask sysopen shmwrite vec qx utime local oct semctl localtime readpipe do return format read sprintf dbmopen pop getpgrp not getpwnam rewinddir qqfileno qw endprotoent wait sethostent bless s|0 opendir continue each sleep endgrent shutdown dump chomp connect getsockname die socketpair close flock exists index shmgetsub for endpwent redo lstat msgctl setpgrp abs exit select print ref gethostbyaddr unshift fcntl syscall goto getnetbyaddr join gmtime symlink semget splice x|0 getpeername recv log setsockopt cos last reverse gethostbyname getgrnam study formline endhostent times chop length gethostent getnetent pack getprotoent getservbyname rand mkdir pos chmod y|0 substr endnetent printf next open msgsnd readdir use unlink getsockopt getpriority rindex wantarray hex system getservbyport endservent int chr untie rmdir prototype tell listen fork shmread ucfirst setprotoent else sysseek link getgrgid shmctl waitpid unpack getnetbyname reset chdir grep split require caller lcfirst until warn while values shift telldir getpwuid my getprotobynumber delete and sort uc defined srand accept package seekdir getprotobyname semop our rename seek if q|0 chroot sysread setpwent no crypt getc chown sqrt write setnetent setpriority foreach tie sin msgget map stat getlogin unless elsif truncate exec keys glob tied closedirioctl socket readlink eval xor readline binmode setservent eof ord bind alarm pipe atan2 getgrent exp time push setgrent gt lt or ne m|0 break given say state when",c={className:"subst",begin:"[$@]\\{",end:"\\}",keywords:b},d={begin:"->{",end:"}"},e={className:"variable",variants:[{begin:/\$\d/},{begin:/[\$%@](\^\w\b|#\w+(::\w+)*|{\w+}|\w+(::\w*)*)/},{begin:/[\$%@][^\s\w{]/,relevance:0}]},f=[a.BACKSLASH_ESCAPE,c,e],g=[e,a.HASH_COMMENT_MODE,a.COMMENT("^\\=\\w","\\=cut",{endsWithParent:!0}),d,{className:"string",contains:f,variants:[{begin:"q[qwxr]?\\s*\\(",end:"\\)",relevance:5},{begin:"q[qwxr]?\\s*\\[",end:"\\]",relevance:5},{begin:"q[qwxr]?\\s*\\{",end:"\\}",relevance:5},{begin:"q[qwxr]?\\s*\\|",end:"\\|",relevance:5},{begin:"q[qwxr]?\\s*\\<",end:"\\>",relevance:5},{begin:"qw\\s+q",end:"q",relevance:5},{begin:"'",end:"'",contains:[a.BACKSLASH_ESCAPE]},{begin:'"',end:'"'},{begin:"`",end:"`",contains:[a.BACKSLASH_ESCAPE]},{begin:"{\\w+}",contains:[],relevance:0},{begin:"-?\\w+\\s*\\=\\>",contains:[],relevance:0}]},{className:"number",begin:"(\\b0[0-7_]+)|(\\b0x[0-9a-fA-F_]+)|(\\b[1-9][0-9_]*(\\.[0-9_]+)?)|[0_]\\b",relevance:0},{begin:"(\\/\\/|"+a.RE_STARTERS_RE+"|\\b(split|return|print|reverse|grep)\\b)\\s*",keywords:"split return print reverse grep",relevance:0,contains:[a.HASH_COMMENT_MODE,{className:"regexp",begin:"(s|tr|y)/(\\\\.|[^/])*/(\\\\.|[^/])*/[a-z]*",relevance:10},{className:"regexp",begin:"(m|qr)?/",end:"/[a-z]*",contains:[a.BACKSLASH_ESCAPE],relevance:0}]},{className:"sub",beginKeywords:"sub",end:"(\\s*\\(.*?\\))?[;{]",relevance:5},{className:"operator",begin:"-\\w\\b",relevance:0},{begin:"^__DATA__$",end:"^__END__$",subLanguage:"mojolicious",contains:[{begin:"^@@.*",end:"$",className:"comment"}]}];return c.contains=g,d.contains=g,{aliases:["pl"],keywords:b,contains:g}}),a.registerLanguage("mojolicious",function(a){return{subLanguage:"xml",contains:[{className:"preprocessor",begin:"^__(END|DATA)__$"},{begin:"^\\s*%{1,2}={0,2}",end:"$",subLanguage:"perl"},{begin:"<%{1,2}={0,2}",end:"={0,1}%>",subLanguage:"perl",excludeBegin:!0,excludeEnd:!0}]}}),a.registerLanguage("monkey",function(a){var b={className:"number",relevance:0,variants:[{begin:"[$][a-fA-F0-9]+"},a.NUMBER_MODE]};return{case_insensitive:!0,keywords:{keyword:"public private property continue exit extern new try catch eachin not abstract final select case default const local global field end if then else elseif endif while wend repeat until forever for to step next return module inline throw",built_in:"DebugLog DebugStop Error Print ACos ACosr ASin ASinr ATan ATan2 ATan2r ATanr Abs Abs Ceil Clamp Clamp Cos Cosr Exp Floor Log Max Max Min Min Pow Sgn Sgn Sin Sinr Sqrt Tan Tanr Seed PI HALFPI TWOPI",literal:"true false null and or shl shr mod"},illegal:/\/\*/,contains:[a.COMMENT("#rem","#end"),a.COMMENT("'","$",{relevance:0}),{className:"function",beginKeywords:"function method",end:"[(=:]|$",illegal:/\n/,contains:[a.UNDERSCORE_TITLE_MODE]},{className:"class",beginKeywords:"class interface",end:"$",contains:[{beginKeywords:"extends implements"},a.UNDERSCORE_TITLE_MODE]},{className:"variable",begin:"\\b(self|super)\\b"},{className:"preprocessor",beginKeywords:"import",end:"$"},{className:"preprocessor",begin:"\\s*#",end:"$",keywords:"if else elseif endif end then"},{className:"pi",begin:"^\\s*strict\\b"},{beginKeywords:"alias",end:"=",contains:[a.UNDERSCORE_TITLE_MODE]},a.QUOTE_STRING_MODE,b]}}),a.registerLanguage("nginx",function(a){var b={className:"variable",variants:[{begin:/\$\d+/},{begin:/\$\{/,end:/}/},{begin:"[\\$\\@]"+a.UNDERSCORE_IDENT_RE}]},c={endsWithParent:!0,lexemes:"[a-z/_]+",keywords:{built_in:"on off yes no true false none blocked debug info notice warn error crit select break last permanent redirect kqueue rtsig epoll poll /dev/poll"},relevance:0,illegal:"=>",contains:[a.HASH_COMMENT_MODE,{className:"string",contains:[a.BACKSLASH_ESCAPE,b],variants:[{begin:/"/,end:/"/},{begin:/'/,end:/'/}]},{className:"url",begin:"([a-z]+):/",end:"\\s",endsWithParent:!0,excludeEnd:!0,contains:[b]},{className:"regexp",contains:[a.BACKSLASH_ESCAPE,b],variants:[{begin:"\\s\\^",end:"\\s|{|;",returnEnd:!0},{begin:"~\\*?\\s+",end:"\\s|{|;",returnEnd:!0},{begin:"\\*(\\.[a-z\\-]+)+"},{begin:"([a-z\\-]+\\.)+\\*"}]},{className:"number",begin:"\\b\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}(:\\d{1,5})?\\b"},{className:"number",begin:"\\b\\d+[kKmMgGdshdwy]*\\b",relevance:0},b]};return{aliases:["nginxconf"],contains:[a.HASH_COMMENT_MODE,{begin:a.UNDERSCORE_IDENT_RE+"\\s",end:";|{",returnBegin:!0,contains:[{className:"title",begin:a.UNDERSCORE_IDENT_RE,starts:c}],relevance:0}],illegal:"[^\\s\\}]"}}),a.registerLanguage("nimrod",function(a){return{aliases:["nim"],keywords:{keyword:"addr and as asm bind block break|0 case|0 cast const|0 continue|0 converter discard distinct|10 div do elif else|0 end|0 enum|0 except export finally for from generic if|0 import|0 in include|0 interface is isnot|10 iterator|10 let|0 macro method|10 mixin mod nil not notin|10 object|0 of or out proc|10 ptr raise ref|10 return shl shr static template try|0 tuple type|0 using|0 var|0 when while|0 with without xor yield",literal:"shared guarded stdin stdout stderr result|10 true false"},contains:[{className:"decorator",begin:/{\./,end:/\.}/,relevance:10},{className:"string",begin:/[a-zA-Z]\w*"/,end:/"/,contains:[{begin:/""/}]},{className:"string",begin:/([a-zA-Z]\w*)?"""/,end:/"""/},a.QUOTE_STRING_MODE,{className:"type",begin:/\b[A-Z]\w+\b/,relevance:0},{className:"type",begin:/\b(int|int8|int16|int32|int64|uint|uint8|uint16|uint32|uint64|float|float32|float64|bool|char|string|cstring|pointer|expr|stmt|void|auto|any|range|array|openarray|varargs|seq|set|clong|culong|cchar|cschar|cshort|cint|csize|clonglong|cfloat|cdouble|clongdouble|cuchar|cushort|cuint|culonglong|cstringarray|semistatic)\b/},{className:"number",begin:/\b(0[xX][0-9a-fA-F][_0-9a-fA-F]*)('?[iIuU](8|16|32|64))?/,relevance:0},{className:"number",begin:/\b(0o[0-7][_0-7]*)('?[iIuUfF](8|16|32|64))?/,relevance:0},{className:"number",begin:/\b(0(b|B)[01][_01]*)('?[iIuUfF](8|16|32|64))?/,relevance:0},{className:"number",begin:/\b(\d[_\d]*)('?[iIuUfF](8|16|32|64))?/,relevance:0},a.HASH_COMMENT_MODE]}}),a.registerLanguage("nix",function(a){var b={keyword:"rec with let in inherit assert if else then",constant:"true false or and null",built_in:"import abort baseNameOf dirOf isNull builtins map removeAttrs throw toString derivation"},c={className:"subst",begin:/\$\{/,end:/}/,keywords:b},d={className:"variable",begin:/[a-zA-Z0-9-_]+(\s*=)/,relevance:0},e={className:"string",begin:"''",end:"''",contains:[c]},f={className:"string",begin:'"',end:'"',contains:[c]},g=[a.NUMBER_MODE,a.HASH_COMMENT_MODE,a.C_BLOCK_COMMENT_MODE,e,f,d];return c.contains=g,{aliases:["nixos"],keywords:b,contains:g}}),a.registerLanguage("nsis",function(a){var b={className:"symbol",begin:"\\$(ADMINTOOLS|APPDATA|CDBURN_AREA|CMDLINE|COMMONFILES32|COMMONFILES64|COMMONFILES|COOKIES|DESKTOP|DOCUMENTS|EXEDIR|EXEFILE|EXEPATH|FAVORITES|FONTS|HISTORY|HWNDPARENT|INSTDIR|INTERNET_CACHE|LANGUAGE|LOCALAPPDATA|MUSIC|NETHOOD|OUTDIR|PICTURES|PLUGINSDIR|PRINTHOOD|PROFILE|PROGRAMFILES32|PROGRAMFILES64|PROGRAMFILES|QUICKLAUNCH|RECENT|RESOURCES_LOCALIZED|RESOURCES|SENDTO|SMPROGRAMS|SMSTARTUP|STARTMENU|SYSDIR|TEMP|TEMPLATES|VIDEOS|WINDIR)"},c={className:"constant",begin:"\\$+{[a-zA-Z0-9_]+}"},d={className:"variable",begin:"\\$+[a-zA-Z0-9_]+",illegal:"\\(\\){}"},e={className:"constant",begin:"\\$+\\([a-zA-Z0-9_]+\\)"},f={className:"params",begin:"(ARCHIVE|FILE_ATTRIBUTE_ARCHIVE|FILE_ATTRIBUTE_NORMAL|FILE_ATTRIBUTE_OFFLINE|FILE_ATTRIBUTE_READONLY|FILE_ATTRIBUTE_SYSTEM|FILE_ATTRIBUTE_TEMPORARY|HKCR|HKCU|HKDD|HKEY_CLASSES_ROOT|HKEY_CURRENT_CONFIG|HKEY_CURRENT_USER|HKEY_DYN_DATA|HKEY_LOCAL_MACHINE|HKEY_PERFORMANCE_DATA|HKEY_USERS|HKLM|HKPD|HKU|IDABORT|IDCANCEL|IDIGNORE|IDNO|IDOK|IDRETRY|IDYES|MB_ABORTRETRYIGNORE|MB_DEFBUTTON1|MB_DEFBUTTON2|MB_DEFBUTTON3|MB_DEFBUTTON4|MB_ICONEXCLAMATION|MB_ICONINFORMATION|MB_ICONQUESTION|MB_ICONSTOP|MB_OK|MB_OKCANCEL|MB_RETRYCANCEL|MB_RIGHT|MB_RTLREADING|MB_SETFOREGROUND|MB_TOPMOST|MB_USERICON|MB_YESNO|NORMAL|OFFLINE|READONLY|SHCTX|SHELL_CONTEXT|SYSTEM|TEMPORARY)"},g={className:"constant",begin:"\\!(addincludedir|addplugindir|appendfile|cd|define|delfile|echo|else|endif|error|execute|finalize|getdllversionsystem|ifdef|ifmacrodef|ifmacrondef|ifndef|if|include|insertmacro|macroend|macro|makensis|packhdr|searchparse|searchreplace|tempfile|undef|verbose|warning)"};return{case_insensitive:!1,keywords:{keyword:"Abort AddBrandingImage AddSize AllowRootDirInstall AllowSkipFiles AutoCloseWindow BGFont BGGradient BrandingText BringToFront Call CallInstDLL Caption ChangeUI CheckBitmap ClearErrors CompletedText ComponentText CopyFiles CRCCheck CreateDirectory CreateFont CreateShortCut Delete DeleteINISec DeleteINIStr DeleteRegKey DeleteRegValue DetailPrint DetailsButtonText DirText DirVar DirVerify EnableWindow EnumRegKey EnumRegValue Exch Exec ExecShell ExecWait ExpandEnvStrings File FileBufSize FileClose FileErrorText FileOpen FileRead FileReadByte FileReadUTF16LE FileReadWord FileSeek FileWrite FileWriteByte FileWriteUTF16LE FileWriteWord FindClose FindFirst FindNext FindWindow FlushINI FunctionEnd GetCurInstType GetCurrentAddress GetDlgItem GetDLLVersion GetDLLVersionLocal GetErrorLevel GetFileTime GetFileTimeLocal GetFullPathName GetFunctionAddress GetInstDirError GetLabelAddress GetTempFileName Goto HideWindow Icon IfAbort IfErrors IfFileExists IfRebootFlag IfSilent InitPluginsDir InstallButtonText InstallColors InstallDir InstallDirRegKey InstProgressFlags InstType InstTypeGetText InstTypeSetText IntCmp IntCmpU IntFmt IntOp IsWindow LangString LicenseBkColor LicenseData LicenseForceSelection LicenseLangString LicenseText LoadLanguageFile LockWindow LogSet LogText ManifestDPIAware ManifestSupportedOS MessageBox MiscButtonText Name Nop OutFile Page PageCallbacks PageExEnd Pop Push Quit ReadEnvStr ReadINIStr ReadRegDWORD ReadRegStr Reboot RegDLL Rename RequestExecutionLevel ReserveFile Return RMDir SearchPath SectionEnd SectionGetFlags SectionGetInstTypes SectionGetSize SectionGetText SectionGroupEnd SectionIn SectionSetFlags SectionSetInstTypes SectionSetSize SectionSetText SendMessage SetAutoClose SetBrandingImage SetCompress SetCompressor SetCompressorDictSize SetCtlColors SetCurInstType SetDatablockOptimize SetDateSave SetDetailsPrint SetDetailsView SetErrorLevel SetErrors SetFileAttributes SetFont SetOutPath SetOverwrite SetPluginUnload SetRebootFlag SetRegView SetShellVarContext SetSilent ShowInstDetails ShowUninstDetails ShowWindow SilentInstall SilentUnInstall Sleep SpaceTexts StrCmp StrCmpS StrCpy StrLen SubCaption SubSectionEnd Unicode UninstallButtonText UninstallCaption UninstallIcon UninstallSubCaption UninstallText UninstPage UnRegDLL Var VIAddVersionKey VIFileVersion VIProductVersion WindowIcon WriteINIStr WriteRegBin WriteRegDWORD WriteRegExpandStr WriteRegStr WriteUninstaller XPStyle", +literal:"admin all auto both colored current false force hide highest lastused leave listonly none normal notset off on open print show silent silentlog smooth textonly true user "},contains:[a.HASH_COMMENT_MODE,a.C_BLOCK_COMMENT_MODE,{className:"string",begin:'"',end:'"',illegal:"\\n",contains:[{className:"symbol",begin:"\\$(\\\\(n|r|t)|\\$)"},b,c,d,e]},a.COMMENT(";","$",{relevance:0}),{className:"function",beginKeywords:"Function PageEx Section SectionGroup SubSection",end:"$"},g,c,d,e,f,a.NUMBER_MODE,{className:"literal",begin:a.IDENT_RE+"::"+a.IDENT_RE}]}}),a.registerLanguage("objectivec",function(a){var b={className:"built_in",begin:"(AV|CA|CF|CG|CI|MK|MP|NS|UI)\\w+"},c={keyword:"int float while char export sizeof typedef const struct for union unsigned long volatile static bool mutable if do return goto void enum else break extern asm case short default double register explicit signed typename this switch continue wchar_t inline readonly assign readwrite self @synchronized id typeof nonatomic super unichar IBOutlet IBAction strong weak copy in out inout bycopy byref oneway __strong __weak __block __autoreleasing @private @protected @public @try @property @end @throw @catch @finally @autoreleasepool @synthesize @dynamic @selector @optional @required",literal:"false true FALSE TRUE nil YES NO NULL",built_in:"BOOL dispatch_once_t dispatch_queue_t dispatch_sync dispatch_async dispatch_once"},d=/[a-zA-Z@][a-zA-Z0-9_]*/,e="@interface @class @protocol @implementation";return{aliases:["mm","objc","obj-c"],keywords:c,lexemes:d,illegal:""}]}]},{className:"class",begin:"("+e.split(" ").join("|")+")\\b",end:"({|$)",excludeEnd:!0,keywords:e,lexemes:d,contains:[a.UNDERSCORE_TITLE_MODE]},{className:"variable",begin:"\\."+a.UNDERSCORE_IDENT_RE,relevance:0}]}}),a.registerLanguage("ocaml",function(a){return{aliases:["ml"],keywords:{keyword:"and as assert asr begin class constraint do done downto else end exception external for fun function functor if in include inherit! inherit initializer land lazy let lor lsl lsr lxor match method!|10 method mod module mutable new object of open! open or private rec sig struct then to try type val! val virtual when while with parser value",built_in:"array bool bytes char exn|5 float int int32 int64 list lazy_t|5 nativeint|5 string unit in_channel out_channel ref",literal:"true false"},illegal:/\/\/|>>/,lexemes:"[a-z_]\\w*!?",contains:[{className:"literal",begin:"\\[(\\|\\|)?\\]|\\(\\)",relevance:0},a.COMMENT("\\(\\*","\\*\\)",{contains:["self"]}),{className:"symbol",begin:"'[A-Za-z_](?!')[\\w']*"},{className:"tag",begin:"`[A-Z][\\w']*"},{className:"type",begin:"\\b[A-Z][\\w']*",relevance:0},{begin:"[a-z_]\\w*'[\\w']*"},a.inherit(a.APOS_STRING_MODE,{className:"char",relevance:0}),a.inherit(a.QUOTE_STRING_MODE,{illegal:null}),{className:"number",begin:"\\b(0[xX][a-fA-F0-9_]+[Lln]?|0[oO][0-7_]+[Lln]?|0[bB][01_]+[Lln]?|[0-9][0-9_]*([Lln]|(\\.[0-9_]*)?([eE][-+]?[0-9_]+)?)?)",relevance:0},{begin:/[-=]>/}]}}),a.registerLanguage("openscad",function(a){var b={className:"keyword",begin:"\\$(f[asn]|t|vp[rtd]|children)"},c={className:"literal",begin:"false|true|PI|undef"},d={className:"number",begin:"\\b\\d+(\\.\\d+)?(e-?\\d+)?",relevance:0},e=a.inherit(a.QUOTE_STRING_MODE,{illegal:null}),f={className:"preprocessor",keywords:"include use",begin:"include|use <",end:">"},g={className:"params",begin:"\\(",end:"\\)",contains:["self",d,e,b,c]},h={className:"built_in",begin:"[*!#%]",relevance:0},i={className:"function",beginKeywords:"module function",end:"\\=|\\{",contains:[g,a.UNDERSCORE_TITLE_MODE]};return{aliases:["scad"],keywords:{keyword:"function module include use for intersection_for if else \\%",literal:"false true PI undef",built_in:"circle square polygon text sphere cube cylinder polyhedron translate rotate scale resize mirror multmatrix color offset hull minkowski union difference intersection abs sign sin cos tan acos asin atan atan2 floor round ceil ln log pow sqrt exp rands min max concat lookup str chr search version version_num norm cross parent_module echo import import_dxf dxf_linear_extrude linear_extrude rotate_extrude surface projection render children dxf_cross dxf_dim let assign"},contains:[a.C_LINE_COMMENT_MODE,a.C_BLOCK_COMMENT_MODE,d,f,e,b,h,i]}}),a.registerLanguage("oxygene",function(a){var b="abstract add and array as asc aspect assembly async begin break block by case class concat const copy constructor continue create default delegate desc distinct div do downto dynamic each else empty end ensure enum equals event except exit extension external false final finalize finalizer finally flags for forward from function future global group has if implementation implements implies in index inherited inline interface into invariants is iterator join locked locking loop matching method mod module namespace nested new nil not notify nullable of old on operator or order out override parallel params partial pinned private procedure property protected public queryable raise read readonly record reintroduce remove repeat require result reverse sealed select self sequence set shl shr skip static step soft take then to true try tuple type union unit unsafe until uses using var virtual raises volatile where while with write xor yield await mapped deprecated stdcall cdecl pascal register safecall overload library platform reference packed strict published autoreleasepool selector strong weak unretained",c=a.COMMENT("{","}",{relevance:0}),d=a.COMMENT("\\(\\*","\\*\\)",{relevance:10}),e={className:"string",begin:"'",end:"'",contains:[{begin:"''"}]},f={className:"string",begin:"(#\\d+)+"},g={className:"function",beginKeywords:"function constructor destructor procedure method",end:"[:;]",keywords:"function constructor|10 destructor|10 procedure|10 method|10",contains:[a.TITLE_MODE,{className:"params",begin:"\\(",end:"\\)",keywords:b,contains:[e,f]},c,d]};return{case_insensitive:!0,keywords:b,illegal:'("|\\$[G-Zg-z]|\\/\\*||->)',contains:[c,d,a.C_LINE_COMMENT_MODE,e,f,a.NUMBER_MODE,g,{className:"class",begin:"=\\bclass\\b",end:"end;",keywords:b,contains:[e,f,c,d,a.C_LINE_COMMENT_MODE,g]}]}}),a.registerLanguage("parser3",function(a){var b=a.COMMENT("{","}",{contains:["self"]});return{subLanguage:"xml",relevance:0,contains:[a.COMMENT("^#","$"),a.COMMENT("\\^rem{","}",{relevance:10,contains:[b]}),{className:"preprocessor",begin:"^@(?:BASE|USE|CLASS|OPTIONS)$",relevance:10},{className:"title",begin:"@[\\w\\-]+\\[[\\w^;\\-]*\\](?:\\[[\\w^;\\-]*\\])?(?:.*)$"},{className:"variable",begin:"\\$\\{?[\\w\\-\\.\\:]+\\}?"},{className:"keyword",begin:"\\^[\\w\\-\\.\\:]+"},{className:"number",begin:"\\^#[0-9a-fA-F]+"},a.C_NUMBER_MODE]}}),a.registerLanguage("pf",function(a){var b={className:"variable",begin:/\$[\w\d#@][\w\d_]*/},c={className:"variable",begin://};return{aliases:["pf.conf"],lexemes:/[a-z0-9_<>-]+/,keywords:{built_in:"block match pass load anchor|5 antispoof|10 set table",keyword:"in out log quick on rdomain inet inet6 proto from port os to routeallow-opts divert-packet divert-reply divert-to flags group icmp-typeicmp6-type label once probability recieved-on rtable prio queuetos tag tagged user keep fragment for os dropaf-to|10 binat-to|10 nat-to|10 rdr-to|10 bitmask least-stats random round-robinsource-hash static-portdup-to reply-to route-toparent bandwidth default min max qlimitblock-policy debug fingerprints hostid limit loginterface optimizationreassemble ruleset-optimization basic none profile skip state-defaultsstate-policy timeoutconst counters persistno modulate synproxy state|5 floating if-bound no-sync pflow|10 sloppysource-track global rule max-src-nodes max-src-states max-src-connmax-src-conn-rate overload flushscrub|5 max-mss min-ttl no-df|10 random-id",literal:"all any no-route self urpf-failed egress|5 unknown"},contains:[a.HASH_COMMENT_MODE,a.NUMBER_MODE,a.QUOTE_STRING_MODE,b,c]}}),a.registerLanguage("php",function(a){var b={className:"variable",begin:"\\$+[a-zA-Z_-ÿ][a-zA-Z0-9_-ÿ]*"},c={className:"preprocessor",begin:/<\?(php)?|\?>/},d={className:"string",contains:[a.BACKSLASH_ESCAPE,c],variants:[{begin:'b"',end:'"'},{begin:"b'",end:"'"},a.inherit(a.APOS_STRING_MODE,{illegal:null}),a.inherit(a.QUOTE_STRING_MODE,{illegal:null})]},e={variants:[a.BINARY_NUMBER_MODE,a.C_NUMBER_MODE]};return{aliases:["php3","php4","php5","php6"],case_insensitive:!0,keywords:"and include_once list abstract global private echo interface as static endswitch array null if endwhile or const for endforeach self var while isset public protected exit foreach throw elseif include __FILE__ empty require_once do xor return parent clone use __CLASS__ __LINE__ else break print eval new catch __METHOD__ case exception default die require __FUNCTION__ enddeclare final try switch continue endfor endif declare unset true false trait goto instanceof insteadof __DIR__ __NAMESPACE__ yield finally",contains:[a.C_LINE_COMMENT_MODE,a.HASH_COMMENT_MODE,a.COMMENT("/\\*","\\*/",{contains:[{className:"doctag",begin:"@[A-Za-z]+"},c]}),a.COMMENT("__halt_compiler.+?;",!1,{endsWithParent:!0,keywords:"__halt_compiler",lexemes:a.UNDERSCORE_IDENT_RE}),{className:"string",begin:/<<<['"]?\w+['"]?$/,end:/^\w+;?$/,contains:[a.BACKSLASH_ESCAPE,{className:"subst",variants:[{begin:/\$\w+/},{begin:/\{\$/,end:/\}/}]}]},c,b,{begin:/(::|->)+[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/},{className:"function",beginKeywords:"function",end:/[;{]/,excludeEnd:!0,illegal:"\\$|\\[|%",contains:[a.UNDERSCORE_TITLE_MODE,{className:"params",begin:"\\(",end:"\\)",contains:["self",b,a.C_BLOCK_COMMENT_MODE,d,e]}]},{className:"class",beginKeywords:"class interface",end:"{",excludeEnd:!0,illegal:/[:\(\$"]/,contains:[{beginKeywords:"extends implements"},a.UNDERSCORE_TITLE_MODE]},{beginKeywords:"namespace",end:";",illegal:/[\.']/,contains:[a.UNDERSCORE_TITLE_MODE]},{beginKeywords:"use",end:";",contains:[a.UNDERSCORE_TITLE_MODE]},{begin:"=>"},d,e]}}),a.registerLanguage("powershell",function(a){var b={begin:"`[\\s\\S]",relevance:0},c={className:"variable",variants:[{begin:/\$[\w\d][\w\d_:]*/}]},d={className:"string",begin:/"/,end:/"/,contains:[b,c,{className:"variable",begin:/\$[A-z]/,end:/[^A-z]/}]},e={className:"string",begin:/'/,end:/'/};return{aliases:["ps"],lexemes:/-?[A-z\.\-]+/,case_insensitive:!0,keywords:{keyword:"if else foreach return function do while until elseif begin for trap data dynamicparam end break throw param continue finally in switch exit filter try process catch",literal:"$null $true $false",built_in:"Add-Content Add-History Add-Member Add-PSSnapin Clear-Content Clear-Item Clear-Item Property Clear-Variable Compare-Object ConvertFrom-SecureString Convert-Path ConvertTo-Html ConvertTo-SecureString Copy-Item Copy-ItemProperty Export-Alias Export-Clixml Export-Console Export-Csv ForEach-Object Format-Custom Format-List Format-Table Format-Wide Get-Acl Get-Alias Get-AuthenticodeSignature Get-ChildItem Get-Command Get-Content Get-Credential Get-Culture Get-Date Get-EventLog Get-ExecutionPolicy Get-Help Get-History Get-Host Get-Item Get-ItemProperty Get-Location Get-Member Get-PfxCertificate Get-Process Get-PSDrive Get-PSProvider Get-PSSnapin Get-Service Get-TraceSource Get-UICulture Get-Unique Get-Variable Get-WmiObject Group-Object Import-Alias Import-Clixml Import-Csv Invoke-Expression Invoke-History Invoke-Item Join-Path Measure-Command Measure-Object Move-Item Move-ItemProperty New-Alias New-Item New-ItemProperty New-Object New-PSDrive New-Service New-TimeSpan New-Variable Out-Default Out-File Out-Host Out-Null Out-Printer Out-String Pop-Location Push-Location Read-Host Remove-Item Remove-ItemProperty Remove-PSDrive Remove-PSSnapin Remove-Variable Rename-Item Rename-ItemProperty Resolve-Path Restart-Service Resume-Service Select-Object Select-String Set-Acl Set-Alias Set-AuthenticodeSignature Set-Content Set-Date Set-ExecutionPolicy Set-Item Set-ItemProperty Set-Location Set-PSDebug Set-Service Set-TraceSource Set-Variable Sort-Object Split-Path Start-Service Start-Sleep Start-Transcript Stop-Process Stop-Service Stop-Transcript Suspend-Service Tee-Object Test-Path Trace-Command Update-FormatData Update-TypeData Where-Object Write-Debug Write-Error Write-Host Write-Output Write-Progress Write-Verbose Write-Warning",operator:"-ne -eq -lt -gt -ge -le -not -like -notlike -match -notmatch -contains -notcontains -in -notin -replace"},contains:[a.HASH_COMMENT_MODE,a.NUMBER_MODE,d,e,c]}}),a.registerLanguage("processing",function(a){return{keywords:{keyword:"BufferedReader PVector PFont PImage PGraphics HashMap boolean byte char color double float int long String Array FloatDict FloatList IntDict IntList JSONArray JSONObject Object StringDict StringList Table TableRow XML false synchronized int abstract float private char boolean static null if const for true while long throw strictfp finally protected import native final return void enum else break transient new catch instanceof byte super volatile case assert short package default double public try this switch continue throws protected public private",constant:"P2D P3D HALF_PI PI QUARTER_PI TAU TWO_PI",variable:"displayHeight displayWidth mouseY mouseX mousePressed pmouseX pmouseY key keyCode pixels focused frameCount frameRate height width",title:"setup draw",built_in:"size createGraphics beginDraw createShape loadShape PShape arc ellipse line point quad rect triangle bezier bezierDetail bezierPoint bezierTangent curve curveDetail curvePoint curveTangent curveTightness shape shapeMode beginContour beginShape bezierVertex curveVertex endContour endShape quadraticVertex vertex ellipseMode noSmooth rectMode smooth strokeCap strokeJoin strokeWeight mouseClicked mouseDragged mouseMoved mousePressed mouseReleased mouseWheel keyPressed keyPressedkeyReleased keyTyped print println save saveFrame day hour millis minute month second year background clear colorMode fill noFill noStroke stroke alpha blue brightness color green hue lerpColor red saturation modelX modelY modelZ screenX screenY screenZ ambient emissive shininess specular add createImage beginCamera camera endCamera frustum ortho perspective printCamera printProjection cursor frameRate noCursor exit loop noLoop popStyle pushStyle redraw binary boolean byte char float hex int str unbinary unhex join match matchAll nf nfc nfp nfs split splitTokens trim append arrayCopy concat expand reverse shorten sort splice subset box sphere sphereDetail createInput createReader loadBytes loadJSONArray loadJSONObject loadStrings loadTable loadXML open parseXML saveTable selectFolder selectInput beginRaw beginRecord createOutput createWriter endRaw endRecord PrintWritersaveBytes saveJSONArray saveJSONObject saveStream saveStrings saveXML selectOutput popMatrix printMatrix pushMatrix resetMatrix rotate rotateX rotateY rotateZ scale shearX shearY translate ambientLight directionalLight lightFalloff lights lightSpecular noLights normal pointLight spotLight image imageMode loadImage noTint requestImage tint texture textureMode textureWrap blend copy filter get loadPixels set updatePixels blendMode loadShader PShaderresetShader shader createFont loadFont text textFont textAlign textLeading textMode textSize textWidth textAscent textDescent abs ceil constrain dist exp floor lerp log mag map max min norm pow round sq sqrt acos asin atan atan2 cos degrees radians sin tan noise noiseDetail noiseSeed random randomGaussian randomSeed"},contains:[a.C_LINE_COMMENT_MODE,a.C_BLOCK_COMMENT_MODE,a.APOS_STRING_MODE,a.QUOTE_STRING_MODE,a.C_NUMBER_MODE]}}),a.registerLanguage("profile",function(a){return{contains:[a.C_NUMBER_MODE,{className:"built_in",begin:"{",end:"}$",excludeBegin:!0,excludeEnd:!0,contains:[a.APOS_STRING_MODE,a.QUOTE_STRING_MODE],relevance:0},{className:"filename",begin:"[a-zA-Z_][\\da-zA-Z_]+\\.[\\da-zA-Z_]{1,3}",end:":",excludeEnd:!0},{className:"header",begin:"(ncalls|tottime|cumtime)",end:"$",keywords:"ncalls tottime|10 cumtime|10 filename",relevance:10},{className:"summary",begin:"function calls",end:"$",contains:[a.C_NUMBER_MODE],relevance:10},a.APOS_STRING_MODE,a.QUOTE_STRING_MODE,{className:"function",begin:"\\(",end:"\\)$",contains:[a.UNDERSCORE_TITLE_MODE],relevance:0}]}}),a.registerLanguage("prolog",function(a){var b={className:"atom",begin:/[a-z][A-Za-z0-9_]*/,relevance:0},c={className:"name",variants:[{begin:/[A-Z][a-zA-Z0-9_]*/},{begin:/_[A-Za-z0-9_]*/}],relevance:0},d={begin:/\(/,end:/\)/,relevance:0},e={begin:/\[/,end:/\]/},f={className:"comment",begin:/%/,end:/$/,contains:[a.PHRASAL_WORDS_MODE]},g={className:"string",begin:/`/,end:/`/,contains:[a.BACKSLASH_ESCAPE]},h={className:"string",begin:/0\'(\\\'|.)/},i={className:"string",begin:/0\'\\s/},j={begin:/:-/},k=[b,c,d,j,e,f,a.C_BLOCK_COMMENT_MODE,a.QUOTE_STRING_MODE,a.APOS_STRING_MODE,g,h,i,a.C_NUMBER_MODE];return d.contains=k,e.contains=k,{contains:k.concat([{begin:/\.$/}])}}),a.registerLanguage("protobuf",function(a){return{keywords:{keyword:"package import option optional required repeated group",built_in:"double float int32 int64 uint32 uint64 sint32 sint64 fixed32 fixed64 sfixed32 sfixed64 bool string bytes",literal:"true false"},contains:[a.QUOTE_STRING_MODE,a.NUMBER_MODE,a.C_LINE_COMMENT_MODE,{className:"class",beginKeywords:"message enum service",end:/\{/,illegal:/\n/,contains:[a.inherit(a.TITLE_MODE,{starts:{endsWithParent:!0,excludeEnd:!0}})]},{className:"function",beginKeywords:"rpc",end:/;/,excludeEnd:!0,keywords:"rpc returns"},{className:"constant",begin:/^\s*[A-Z_]+/,end:/\s*=/,excludeEnd:!0}]}}),a.registerLanguage("puppet",function(a){var b={keyword:"and case default else elsif false if in import enherits node or true undef unless main settings $string ",literal:"alias audit before loglevel noop require subscribe tag owner ensure group mode name|0 changes context force incl lens load_path onlyif provider returns root show_diff type_check en_address ip_address realname command environment hour monute month monthday special target weekday creates cwd ogoutput refresh refreshonly tries try_sleep umask backup checksum content ctime force ignore links mtime purge recurse recurselimit replace selinux_ignore_defaults selrange selrole seltype seluser source souirce_permissions sourceselect validate_cmd validate_replacement allowdupe attribute_membership auth_membership forcelocal gid ia_load_module members system host_aliases ip allowed_trunk_vlans description device_url duplex encapsulation etherchannel native_vlan speed principals allow_root auth_class auth_type authenticate_user k_of_n mechanisms rule session_owner shared options device fstype enable hasrestart directory present absent link atboot blockdevice device dump pass remounts poller_tag use message withpath adminfile allow_virtual allowcdrom category configfiles flavor install_options instance package_settings platform responsefile status uninstall_options vendor unless_system_user unless_uid binary control flags hasstatus manifest pattern restart running start stop allowdupe auths expiry gid groups home iterations key_membership keys managehome membership password password_max_age password_min_age profile_membership profiles project purge_ssh_keys role_membership roles salt shell uid baseurl cost descr enabled enablegroups exclude failovermethod gpgcheck gpgkey http_caching include includepkgs keepalive metadata_expire metalink mirrorlist priority protect proxy proxy_password proxy_username repo_gpgcheck s3_enabled skip_if_unavailable sslcacert sslclientcert sslclientkey sslverify mounted",built_in:"architecture augeasversion blockdevices boardmanufacturer boardproductname boardserialnumber cfkey dhcp_servers domain ec2_ ec2_userdata facterversion filesystems ldom fqdn gid hardwareisa hardwaremodel hostname id|0 interfaces ipaddress ipaddress_ ipaddress6 ipaddress6_ iphostnumber is_virtual kernel kernelmajversion kernelrelease kernelversion kernelrelease kernelversion lsbdistcodename lsbdistdescription lsbdistid lsbdistrelease lsbmajdistrelease lsbminordistrelease lsbrelease macaddress macaddress_ macosx_buildversion macosx_productname macosx_productversion macosx_productverson_major macosx_productversion_minor manufacturer memoryfree memorysize netmask metmask_ network_ operatingsystem operatingsystemmajrelease operatingsystemrelease osfamily partitions path physicalprocessorcount processor processorcount productname ps puppetversion rubysitedir rubyversion selinux selinux_config_mode selinux_config_policy selinux_current_mode selinux_current_mode selinux_enforced selinux_policyversion serialnumber sp_ sshdsakey sshecdsakey sshrsakey swapencrypted swapfree swapsize timezone type uniqueid uptime uptime_days uptime_hours uptime_seconds uuid virtual vlans xendomains zfs_version zonenae zones zpool_version"},c=a.COMMENT("#","$"),d="([A-Za-z_]|::)(\\w|::)*",e=a.inherit(a.TITLE_MODE,{begin:d}),f={className:"variable",begin:"\\$"+d},g={className:"string",contains:[a.BACKSLASH_ESCAPE,f],variants:[{begin:/'/,end:/'/},{begin:/"/,end:/"/}]};return{aliases:["pp"],contains:[c,f,g,{beginKeywords:"class",end:"\\{|;",illegal:/=/,contains:[e,c]},{beginKeywords:"define",end:/\{/,contains:[{className:"title",begin:a.IDENT_RE,endsParent:!0}]},{begin:a.IDENT_RE+"\\s+\\{",returnBegin:!0,end:/\S/,contains:[{className:"name",begin:a.IDENT_RE},{begin:/\{/,end:/\}/,keywords:b,relevance:0,contains:[g,c,{begin:"[a-zA-Z_]+\\s*=>"},{className:"number",begin:"(\\b0[0-7_]+)|(\\b0x[0-9a-fA-F_]+)|(\\b[1-9][0-9_]*(\\.[0-9_]+)?)|[0_]\\b",relevance:0},f]}],relevance:0}]}}),a.registerLanguage("python",function(a){var b={className:"prompt",begin:/^(>>>|\.\.\.) /},c={className:"string",contains:[a.BACKSLASH_ESCAPE],variants:[{begin:/(u|b)?r?'''/,end:/'''/,contains:[b],relevance:10},{begin:/(u|b)?r?"""/,end:/"""/,contains:[b],relevance:10},{begin:/(u|r|ur)'/,end:/'/,relevance:10},{begin:/(u|r|ur)"/,end:/"/,relevance:10},{begin:/(b|br)'/,end:/'/},{begin:/(b|br)"/,end:/"/},a.APOS_STRING_MODE,a.QUOTE_STRING_MODE]},d={className:"number",relevance:0,variants:[{begin:a.BINARY_NUMBER_RE+"[lLjJ]?"},{begin:"\\b(0o[0-7]+)[lLjJ]?"},{begin:a.C_NUMBER_RE+"[lLjJ]?"}]},e={className:"params",begin:/\(/,end:/\)/,contains:["self",b,d,c]};return{aliases:["py","gyp"],keywords:{keyword:"and elif is global as in if from raise for except finally print import pass return exec else break not with class assert yield try while continue del or def lambda async await nonlocal|10 None True False",built_in:"Ellipsis NotImplemented"},illegal:/(<\/|->|\?)/,contains:[b,d,c,a.HASH_COMMENT_MODE,{variants:[{className:"function",beginKeywords:"def",relevance:10},{className:"class",beginKeywords:"class"}],end:/:/,illegal:/[${=;\n,]/,contains:[a.UNDERSCORE_TITLE_MODE,e]},{className:"decorator",begin:/^[\t ]*@/,end:/$/},{begin:/\b(print|exec)\(/}]}}),a.registerLanguage("q",function(a){var b={keyword:"do while select delete by update from",constant:"0b 1b",built_in:"neg not null string reciprocal floor ceiling signum mod xbar xlog and or each scan over prior mmu lsq inv md5 ltime gtime count first var dev med cov cor all any rand sums prds mins maxs fills deltas ratios avgs differ prev next rank reverse iasc idesc asc desc msum mcount mavg mdev xrank mmin mmax xprev rotate distinct group where flip type key til get value attr cut set upsert raze union inter except cross sv vs sublist enlist read0 read1 hopen hclose hdel hsym hcount peach system ltrim rtrim trim lower upper ssr view tables views cols xcols keys xkey xcol xasc xdesc fkeys meta lj aj aj0 ij pj asof uj ww wj wj1 fby xgroup ungroup ej save load rsave rload show csv parse eval min max avg wavg wsum sin cos tan sum",typename:"`float `double int `timestamp `timespan `datetime `time `boolean `symbol `char `byte `short `long `real `month `date `minute `second `guid"};return{aliases:["k","kdb"],keywords:b,lexemes:/\b(`?)[A-Za-z0-9_]+\b/,contains:[a.C_LINE_COMMENT_MODE,a.QUOTE_STRING_MODE,a.C_NUMBER_MODE]}}),a.registerLanguage("r",function(a){var b="([a-zA-Z]|\\.[a-zA-Z.])[a-zA-Z0-9._]*";return{contains:[a.HASH_COMMENT_MODE,{begin:b,lexemes:b,keywords:{keyword:"function if in break next repeat else for return switch while try tryCatch stop warning require library attach detach source setMethod setGeneric setGroupGeneric setClass ...",literal:"NULL NA TRUE FALSE T F Inf NaN NA_integer_|10 NA_real_|10 NA_character_|10 NA_complex_|10"},relevance:0},{className:"number",begin:"0[xX][0-9a-fA-F]+[Li]?\\b",relevance:0},{className:"number",begin:"\\d+(?:[eE][+\\-]?\\d*)?L\\b",relevance:0},{className:"number",begin:"\\d+\\.(?!\\d)(?:i\\b)?",relevance:0},{className:"number",begin:"\\d+(?:\\.\\d*)?(?:[eE][+\\-]?\\d*)?i?\\b",relevance:0},{className:"number",begin:"\\.\\d+(?:[eE][+\\-]?\\d*)?i?\\b",relevance:0},{begin:"`",end:"`",relevance:0},{className:"string",contains:[a.BACKSLASH_ESCAPE],variants:[{begin:'"',end:'"'},{begin:"'",end:"'"}]}]}}),a.registerLanguage("rib",function(a){return{keywords:"ArchiveRecord AreaLightSource Atmosphere Attribute AttributeBegin AttributeEnd Basis Begin Blobby Bound Clipping ClippingPlane Color ColorSamples ConcatTransform Cone CoordinateSystem CoordSysTransform CropWindow Curves Cylinder DepthOfField Detail DetailRange Disk Displacement Display End ErrorHandler Exposure Exterior Format FrameAspectRatio FrameBegin FrameEnd GeneralPolygon GeometricApproximation Geometry Hider Hyperboloid Identity Illuminate Imager Interior LightSource MakeCubeFaceEnvironment MakeLatLongEnvironment MakeShadow MakeTexture Matte MotionBegin MotionEnd NuPatch ObjectBegin ObjectEnd ObjectInstance Opacity Option Orientation Paraboloid Patch PatchMesh Perspective PixelFilter PixelSamples PixelVariance Points PointsGeneralPolygons PointsPolygons Polygon Procedural Projection Quantize ReadArchive RelativeDetail ReverseOrientation Rotate Scale ScreenWindow ShadingInterpolation ShadingRate Shutter Sides Skew SolidBegin SolidEnd Sphere SubdivisionMesh Surface TextureCoordinates Torus Transform TransformBegin TransformEnd TransformPoints Translate TrimCurve WorldBegin WorldEnd",illegal:""}]}}),a.registerLanguage("scala",function(a){var b={className:"annotation",begin:"@[A-Za-z]+"},c={className:"string",begin:'u?r?"""',end:'"""',relevance:10},d={className:"symbol",begin:"'\\w[\\w\\d_]*(?!')"},e={className:"type",begin:"\\b[A-Z][A-Za-z0-9_]*",relevance:0},f={className:"title",begin:/[^0-9\n\t "'(),.`{}\[\]:;][^\n\t "'(),.`{}\[\]:;]+|[^0-9\n\t "'(),.`{}\[\]:;=]/,relevance:0},g={className:"class",beginKeywords:"class object trait type",end:/[:={\[(\n;]/,contains:[{className:"keyword",beginKeywords:"extends with",relevance:10},f]},h={className:"function",beginKeywords:"def",end:/[:={\[(\n;]/,contains:[f]};return{keywords:{literal:"true false null",keyword:"type yield lazy override def with val var sealed abstract private trait object if forSome for while throw finally protected extends import final return else break new catch super class case package default try this match continue throws implicit"},contains:[a.C_LINE_COMMENT_MODE,a.C_BLOCK_COMMENT_MODE,c,a.QUOTE_STRING_MODE,d,e,h,g,a.C_NUMBER_MODE,b]}}),a.registerLanguage("scheme",function(a){var b="[^\\(\\)\\[\\]\\{\\}\",'`;#|\\\\\\s]+",c="(\\-|\\+)?\\d+([./]\\d+)?",d=c+"[+\\-]"+c+"i",e={built_in:"case-lambda call/cc class define-class exit-handler field import inherit init-field interface let*-values let-values let/ec mixin opt-lambda override protect provide public rename require require-for-syntax syntax syntax-case syntax-error unit/sig unless when with-syntax and begin call-with-current-continuation call-with-input-file call-with-output-file case cond define define-syntax delay do dynamic-wind else for-each if lambda let let* let-syntax letrec letrec-syntax map or syntax-rules ' * + , ,@ - ... / ; < <= = => > >= ` abs acos angle append apply asin assoc assq assv atan boolean? caar cadr call-with-input-file call-with-output-file call-with-values car cdddar cddddr cdr ceiling char->integer char-alphabetic? char-ci<=? char-ci=? char-ci>? char-downcase char-lower-case? char-numeric? char-ready? char-upcase char-upper-case? char-whitespace? char<=? char=? char>? char? close-input-port close-output-port complex? cons cos current-input-port current-output-port denominator display eof-object? eq? equal? eqv? eval even? exact->inexact exact? exp expt floor force gcd imag-part inexact->exact inexact? input-port? integer->char integer? interaction-environment lcm length list list->string list->vector list-ref list-tail list? load log magnitude make-polar make-rectangular make-string make-vector max member memq memv min modulo negative? newline not null-environment null? number->string number? numerator odd? open-input-file open-output-file output-port? pair? peek-char port? positive? procedure? quasiquote quote quotient rational? rationalize read read-char real-part real? remainder reverse round scheme-report-environment set! set-car! set-cdr! sin sqrt string string->list string->number string->symbol string-append string-ci<=? string-ci=? string-ci>? string-copy string-fill! string-length string-ref string-set! string<=? string=? string>? string? substring symbol->string symbol? tan transcript-off transcript-on truncate values vector vector->list vector-fill! vector-length vector-ref vector-set! with-input-from-file with-output-to-file write write-char zero?"},f={className:"shebang",begin:"^#!",end:"$"},g={className:"literal",begin:"(#t|#f|#\\\\"+b+"|#\\\\.)"},h={className:"number",variants:[{begin:c,relevance:0},{begin:d,relevance:0},{begin:"#b[0-1]+(/[0-1]+)?"},{begin:"#o[0-7]+(/[0-7]+)?"},{begin:"#x[0-9a-f]+(/[0-9a-f]+)?"}]},i=a.QUOTE_STRING_MODE,j=[a.COMMENT(";","$",{relevance:0}),a.COMMENT("#\\|","\\|#")],k={begin:b,relevance:0},l={className:"variable",begin:"'"+b},m={endsWithParent:!0,relevance:0},n={className:"list",variants:[{begin:"\\(",end:"\\)"},{begin:"\\[",end:"\\]"}],contains:[{className:"keyword",begin:b,lexemes:b,keywords:e},m]};return m.contains=[g,h,i,k,l,n].concat(j),{illegal:/\S/,contains:[f,h,i,l,n].concat(j)}}),a.registerLanguage("scilab",function(a){var b=[a.C_NUMBER_MODE,{className:"string",begin:"'|\"",end:"'|\"",contains:[a.BACKSLASH_ESCAPE,{begin:"''"}]}];return{aliases:["sci"],keywords:{keyword:"abort break case clear catch continue do elseif else endfunction end for functionglobal if pause return resume select try then while%f %F %t %T %pi %eps %inf %nan %e %i %z %s",built_in:"abs and acos asin atan ceil cd chdir clearglobal cosh cos cumprod deff disp errorexec execstr exists exp eye gettext floor fprintf fread fsolve imag isdef isemptyisinfisnan isvector lasterror length load linspace list listfiles log10 log2 logmax min msprintf mclose mopen ones or pathconvert poly printf prod pwd rand realround sinh sin size gsort sprintf sqrt strcat strcmps tring sum system tanh tantype typename warning zeros matrix"},illegal:'("|#|/\\*|\\s+/\\w+)',contains:[{className:"function",beginKeywords:"function endfunction",end:"$",keywords:"function endfunction|10",contains:[a.UNDERSCORE_TITLE_MODE,{className:"params",begin:"\\(",end:"\\)"}]},{className:"transposed_variable",begin:"[a-zA-Z_][a-zA-Z_0-9]*('+[\\.']*|[\\.']+)",end:"",relevance:0},{className:"matrix",begin:"\\[",end:"\\]'*[\\.']*",relevance:0,contains:b},a.COMMENT("//","$")].concat(b)}}),a.registerLanguage("scss",function(a){var b="[a-zA-Z-][a-zA-Z0-9_-]*",c={className:"variable",begin:"(\\$"+b+")\\b"},d={className:"function",begin:b+"\\(",returnBegin:!0,excludeEnd:!0,end:"\\("},e={className:"hexcolor",begin:"#[0-9A-Fa-f]+"};({className:"attribute",begin:"[A-Z\\_\\.\\-]+",end:":",excludeEnd:!0,illegal:"[^\\s]",starts:{className:"value",endsWithParent:!0,excludeEnd:!0,contains:[d,e,a.CSS_NUMBER_MODE,a.QUOTE_STRING_MODE,a.APOS_STRING_MODE,a.C_BLOCK_COMMENT_MODE,{className:"important",begin:"!important"}]}});return{case_insensitive:!0,illegal:"[=/|']",contains:[a.C_LINE_COMMENT_MODE,a.C_BLOCK_COMMENT_MODE,d,{className:"id",begin:"\\#[A-Za-z0-9_-]+",relevance:0},{className:"class",begin:"\\.[A-Za-z0-9_-]+",relevance:0},{className:"attr_selector",begin:"\\[",end:"\\]",illegal:"$"},{className:"tag",begin:"\\b(a|abbr|acronym|address|area|article|aside|audio|b|base|big|blockquote|body|br|button|canvas|caption|cite|code|col|colgroup|command|datalist|dd|del|details|dfn|div|dl|dt|em|embed|fieldset|figcaption|figure|footer|form|frame|frameset|(h[1-6])|head|header|hgroup|hr|html|i|iframe|img|input|ins|kbd|keygen|label|legend|li|link|map|mark|meta|meter|nav|noframes|noscript|object|ol|optgroup|option|output|p|param|pre|progress|q|rp|rt|ruby|samp|script|section|select|small|span|strike|strong|style|sub|sup|table|tbody|td|textarea|tfoot|th|thead|time|title|tr|tt|ul|var|video)\\b",relevance:0},{className:"pseudo",begin:":(visited|valid|root|right|required|read-write|read-only|out-range|optional|only-of-type|only-child|nth-of-type|nth-last-of-type|nth-last-child|nth-child|not|link|left|last-of-type|last-child|lang|invalid|indeterminate|in-range|hover|focus|first-of-type|first-line|first-letter|first-child|first|enabled|empty|disabled|default|checked|before|after|active)"},{className:"pseudo",begin:"::(after|before|choices|first-letter|first-line|repeat-index|repeat-item|selection|value)"},c,{className:"attribute",begin:"\\b(z-index|word-wrap|word-spacing|word-break|width|widows|white-space|visibility|vertical-align|unicode-bidi|transition-timing-function|transition-property|transition-duration|transition-delay|transition|transform-style|transform-origin|transform|top|text-underline-position|text-transform|text-shadow|text-rendering|text-overflow|text-indent|text-decoration-style|text-decoration-line|text-decoration-color|text-decoration|text-align-last|text-align|tab-size|table-layout|right|resize|quotes|position|pointer-events|perspective-origin|perspective|page-break-inside|page-break-before|page-break-after|padding-top|padding-right|padding-left|padding-bottom|padding|overflow-y|overflow-x|overflow-wrap|overflow|outline-width|outline-style|outline-offset|outline-color|outline|orphans|order|opacity|object-position|object-fit|normal|none|nav-up|nav-right|nav-left|nav-index|nav-down|min-width|min-height|max-width|max-height|mask|marks|margin-top|margin-right|margin-left|margin-bottom|margin|list-style-type|list-style-position|list-style-image|list-style|line-height|letter-spacing|left|justify-content|initial|inherit|ime-mode|image-orientation|image-resolution|image-rendering|icon|hyphens|height|font-weight|font-variant-ligatures|font-variant|font-style|font-stretch|font-size-adjust|font-size|font-language-override|font-kerning|font-feature-settings|font-family|font|float|flex-wrap|flex-shrink|flex-grow|flex-flow|flex-direction|flex-basis|flex|filter|empty-cells|display|direction|cursor|counter-reset|counter-increment|content|column-width|column-span|column-rule-width|column-rule-style|column-rule-color|column-rule|column-gap|column-fill|column-count|columns|color|clip-path|clip|clear|caption-side|break-inside|break-before|break-after|box-sizing|box-shadow|box-decoration-break|bottom|border-width|border-top-width|border-top-style|border-top-right-radius|border-top-left-radius|border-top-color|border-top|border-style|border-spacing|border-right-width|border-right-style|border-right-color|border-right|border-radius|border-left-width|border-left-style|border-left-color|border-left|border-image-width|border-image-source|border-image-slice|border-image-repeat|border-image-outset|border-image|border-color|border-collapse|border-bottom-width|border-bottom-style|border-bottom-right-radius|border-bottom-left-radius|border-bottom-color|border-bottom|border|background-size|background-repeat|background-position|background-origin|background-image|background-color|background-clip|background-attachment|background-blend-mode|background|backface-visibility|auto|animation-timing-function|animation-play-state|animation-name|animation-iteration-count|animation-fill-mode|animation-duration|animation-direction|animation-delay|animation|align-self|align-items|align-content)\\b",illegal:"[^\\s]"},{className:"value",begin:"\\b(whitespace|wait|w-resize|visible|vertical-text|vertical-ideographic|uppercase|upper-roman|upper-alpha|underline|transparent|top|thin|thick|text|text-top|text-bottom|tb-rl|table-header-group|table-footer-group|sw-resize|super|strict|static|square|solid|small-caps|separate|se-resize|scroll|s-resize|rtl|row-resize|ridge|right|repeat|repeat-y|repeat-x|relative|progress|pointer|overline|outside|outset|oblique|nowrap|not-allowed|normal|none|nw-resize|no-repeat|no-drop|newspaper|ne-resize|n-resize|move|middle|medium|ltr|lr-tb|lowercase|lower-roman|lower-alpha|loose|list-item|line|line-through|line-edge|lighter|left|keep-all|justify|italic|inter-word|inter-ideograph|inside|inset|inline|inline-block|inherit|inactive|ideograph-space|ideograph-parenthesis|ideograph-numeric|ideograph-alpha|horizontal|hidden|help|hand|groove|fixed|ellipsis|e-resize|double|dotted|distribute|distribute-space|distribute-letter|distribute-all-lines|disc|disabled|default|decimal|dashed|crosshair|collapse|col-resize|circle|char|center|capitalize|break-word|break-all|bottom|both|bolder|bold|block|bidi-override|below|baseline|auto|always|all-scroll|absolute|table|table-cell)\\b"},{className:"value",begin:":",end:";",contains:[d,c,e,a.CSS_NUMBER_MODE,a.QUOTE_STRING_MODE,a.APOS_STRING_MODE,{className:"important",begin:"!important"}]},{className:"at_rule",begin:"@",end:"[{;]",keywords:"mixin include extend for if else each while charset import debug media page content font-face namespace warn",contains:[d,c,a.QUOTE_STRING_MODE,a.APOS_STRING_MODE,e,a.CSS_NUMBER_MODE,{className:"preprocessor",begin:"\\s[A-Za-z0-9_.-]+",relevance:0}]}]}}),a.registerLanguage("smali",function(a){var b=["add","and","cmp","cmpg","cmpl","const","div","double","float","goto","if","int","long","move","mul","neg","new","nop","not","or","rem","return","shl","shr","sput","sub","throw","ushr","xor"],c=["aget","aput","array","check","execute","fill","filled","goto/16","goto/32","iget","instance","invoke","iput","monitor","packed","sget","sparse"],d=["transient","constructor","abstract","final","synthetic","public","private","protected","static","bridge","system"];return{aliases:["smali"],contains:[{className:"string",begin:'"',end:'"',relevance:0},a.COMMENT("#","$",{relevance:0}),{className:"keyword",begin:"\\s*\\.end\\s[a-zA-Z0-9]*",relevance:1},{className:"keyword",begin:"^[ ]*\\.[a-zA-Z]*",relevance:0},{className:"keyword",begin:"\\s:[a-zA-Z_0-9]*",relevance:0},{className:"keyword",begin:"\\s("+d.join("|")+")",relevance:1},{className:"keyword",begin:"\\[",relevance:0},{className:"instruction",begin:"\\s("+b.join("|")+")\\s",relevance:1},{className:"instruction",begin:"\\s("+b.join("|")+")((\\-|/)[a-zA-Z0-9]+)+\\s",relevance:10},{className:"instruction",begin:"\\s("+c.join("|")+")((\\-|/)[a-zA-Z0-9]+)*\\s",relevance:10},{className:"class",begin:"L[^(;:\n]*;",relevance:0},{className:"function",begin:'( |->)[^(\n ;"]*\\(',relevance:0},{className:"function",begin:"\\)",relevance:0},{className:"variable",begin:"[vp][0-9]+",relevance:0}]}}),a.registerLanguage("smalltalk",function(a){var b="[a-z][a-zA-Z0-9_]*",c={className:"char",begin:"\\$.{1}"},d={className:"symbol",begin:"#"+a.UNDERSCORE_IDENT_RE};return{aliases:["st"],keywords:"self super nil true false thisContext",contains:[a.COMMENT('"','"'),a.APOS_STRING_MODE,{className:"class",begin:"\\b[A-Z][A-Za-z0-9_]*",relevance:0},{className:"method",begin:b+":",relevance:0},a.C_NUMBER_MODE,d,c,{className:"localvars",begin:"\\|[ ]*"+b+"([ ]+"+b+")*[ ]*\\|",returnBegin:!0,end:/\|/,illegal:/\S/,contains:[{begin:"(\\|[ ]*)?"+b}]},{className:"array",begin:"\\#\\(",end:"\\)",contains:[a.APOS_STRING_MODE,c,a.C_NUMBER_MODE,d]}]}}),a.registerLanguage("sml",function(a){return{aliases:["ml"],keywords:{keyword:"abstype and andalso as case datatype do else end eqtype exception fn fun functor handle if in include infix infixr let local nonfix of op open orelse raise rec sharing sig signature struct structure then type val with withtype where while",built_in:"array bool char exn int list option order real ref string substring vector unit word",literal:"true false NONE SOME LESS EQUAL GREATER nil"},illegal:/\/\/|>>/,lexemes:"[a-z_]\\w*!?",contains:[{className:"literal",begin:"\\[(\\|\\|)?\\]|\\(\\)"},a.COMMENT("\\(\\*","\\*\\)",{contains:["self"]}),{className:"symbol",begin:"'[A-Za-z_](?!')[\\w']*"},{className:"tag",begin:"`[A-Z][\\w']*"},{className:"type",begin:"\\b[A-Z][\\w']*",relevance:0},{begin:"[a-z_]\\w*'[\\w']*"},a.inherit(a.APOS_STRING_MODE,{className:"char",relevance:0}),a.inherit(a.QUOTE_STRING_MODE,{illegal:null}),{className:"number",begin:"\\b(0[xX][a-fA-F0-9_]+[Lln]?|0[oO][0-7_]+[Lln]?|0[bB][01_]+[Lln]?|[0-9][0-9_]*([Lln]|(\\.[0-9_]*)?([eE][-+]?[0-9_]+)?)?)",relevance:0},{begin:/[-=]>/}]}}),a.registerLanguage("sqf",function(a){var b=["!","-","+","!=","%","&&","*","/","=","==",">",">=","<","<=","or","plus","^",":",">>","abs","accTime","acos","action","actionKeys","actionKeysImages","actionKeysNames","actionKeysNamesArray","actionName","activateAddons","activatedAddons","activateKey","addAction","addBackpack","addBackpackCargo","addBackpackCargoGlobal","addBackpackGlobal","addCamShake","addCuratorAddons","addCuratorCameraArea","addCuratorEditableObjects","addCuratorEditingArea","addCuratorPoints","addEditorObject","addEventHandler","addGoggles","addGroupIcon","addHandgunItem","addHeadgear","addItem","addItemCargo","addItemCargoGlobal","addItemPool","addItemToBackpack","addItemToUniform","addItemToVest","addLiveStats","addMagazine","addMagazine array","addMagazineAmmoCargo","addMagazineCargo","addMagazineCargoGlobal","addMagazineGlobal","addMagazinePool","addMagazines","addMagazineTurret","addMenu","addMenuItem","addMissionEventHandler","addMPEventHandler","addMusicEventHandler","addPrimaryWeaponItem","addPublicVariableEventHandler","addRating","addResources","addScore","addScoreSide","addSecondaryWeaponItem","addSwitchableUnit","addTeamMember","addToRemainsCollector","addUniform","addVehicle","addVest","addWaypoint","addWeapon","addWeaponCargo","addWeaponCargoGlobal","addWeaponGlobal","addWeaponPool","addWeaponTurret","agent","agents","AGLToASL","aimedAtTarget","aimPos","airDensityRTD","airportSide","AISFinishHeal","alive","allControls","allCurators","allDead","allDeadMen","allDisplays","allGroups","allMapMarkers","allMines","allMissionObjects","allow3DMode","allowCrewInImmobile","allowCuratorLogicIgnoreAreas","allowDamage","allowDammage","allowFileOperations","allowFleeing","allowGetIn","allPlayers","allSites","allTurrets","allUnits","allUnitsUAV","allVariables","ammo","and","animate","animateDoor","animationPhase","animationState","append","armoryPoints","arrayIntersect","asin","ASLToAGL","ASLToATL","assert","assignAsCargo","assignAsCargoIndex","assignAsCommander","assignAsDriver","assignAsGunner","assignAsTurret","assignCurator","assignedCargo","assignedCommander","assignedDriver","assignedGunner","assignedItems","assignedTarget","assignedTeam","assignedVehicle","assignedVehicleRole","assignItem","assignTeam","assignToAirport","atan","atan2","atg","ATLToASL","attachedObject","attachedObjects","attachedTo","attachObject","attachTo","attackEnabled","backpack","backpackCargo","backpackContainer","backpackItems","backpackMagazines","backpackSpaceFor","behaviour","benchmark","binocular","blufor","boundingBox","boundingBoxReal","boundingCenter","breakOut","breakTo","briefingName","buildingExit","buildingPos","buttonAction","buttonSetAction","cadetMode","call","callExtension","camCommand","camCommit","camCommitPrepared","camCommitted","camConstuctionSetParams","camCreate","camDestroy","cameraEffect","cameraEffectEnableHUD","cameraInterest","cameraOn","cameraView","campaignConfigFile","camPreload","camPreloaded","camPrepareBank","camPrepareDir","camPrepareDive","camPrepareFocus","camPrepareFov","camPrepareFovRange","camPreparePos","camPrepareRelPos","camPrepareTarget","camSetBank","camSetDir","camSetDive","camSetFocus","camSetFov","camSetFovRange","camSetPos","camSetRelPos","camSetTarget","camTarget","camUseNVG","canAdd","canAddItemToBackpack","canAddItemToUniform","canAddItemToVest","cancelSimpleTaskDestination","canFire","canMove","canSlingLoad","canStand","canUnloadInCombat","captive","captiveNum","case","catch","cbChecked","cbSetChecked","ceil","cheatsEnabled","checkAIFeature","civilian","className","clearAllItemsFromBackpack","clearBackpackCargo","clearBackpackCargoGlobal","clearGroupIcons","clearItemCargo","clearItemCargoGlobal","clearItemPool","clearMagazineCargo","clearMagazineCargoGlobal","clearMagazinePool","clearOverlay","clearRadio","clearWeaponCargo","clearWeaponCargoGlobal","clearWeaponPool","closeDialog","closeDisplay","closeOverlay","collapseObjectTree","combatMode","commandArtilleryFire","commandChat","commander","commandFire","commandFollow","commandFSM","commandGetOut","commandingMenu","commandMove","commandRadio","commandStop","commandTarget","commandWatch","comment","commitOverlay","compile","compileFinal","completedFSM","composeText","configClasses","configFile","configHierarchy","configName","configProperties","configSourceMod","configSourceModList","connectTerminalToUAV","controlNull","controlsGroupCtrl","copyFromClipboard","copyToClipboard","copyWaypoints","cos","count","countEnemy","countFriendly","countSide","countType","countUnknown","createAgent","createCenter","createDialog","createDiaryLink","createDiaryRecord","createDiarySubject","createDisplay","createGearDialog","createGroup","createGuardedPoint","createLocation","createMarker","createMarkerLocal","createMenu","createMine","createMissionDisplay","createSimpleTask","createSite","createSoundSource","createTask","createTeam","createTrigger","createUnit","createUnit array","createVehicle","createVehicle array","createVehicleCrew","createVehicleLocal","crew","ctrlActivate","ctrlAddEventHandler","ctrlAutoScrollDelay","ctrlAutoScrollRewind","ctrlAutoScrollSpeed","ctrlChecked","ctrlClassName","ctrlCommit","ctrlCommitted","ctrlCreate","ctrlDelete","ctrlEnable","ctrlEnabled","ctrlFade","ctrlHTMLLoaded","ctrlIDC","ctrlIDD","ctrlMapAnimAdd","ctrlMapAnimClear","ctrlMapAnimCommit","ctrlMapAnimDone","ctrlMapCursor","ctrlMapMouseOver","ctrlMapScale","ctrlMapScreenToWorld","ctrlMapWorldToScreen","ctrlModel","ctrlModelDirAndUp","ctrlModelScale","ctrlParent","ctrlPosition","ctrlRemoveAllEventHandlers","ctrlRemoveEventHandler","ctrlScale","ctrlSetActiveColor","ctrlSetAutoScrollDelay","ctrlSetAutoScrollRewind","ctrlSetAutoScrollSpeed","ctrlSetBackgroundColor","ctrlSetChecked","ctrlSetEventHandler","ctrlSetFade","ctrlSetFocus","ctrlSetFont","ctrlSetFontH1","ctrlSetFontH1B","ctrlSetFontH2","ctrlSetFontH2B","ctrlSetFontH3","ctrlSetFontH3B","ctrlSetFontH4","ctrlSetFontH4B","ctrlSetFontH5","ctrlSetFontH5B","ctrlSetFontH6","ctrlSetFontH6B","ctrlSetFontHeight","ctrlSetFontHeightH1","ctrlSetFontHeightH2","ctrlSetFontHeightH3","ctrlSetFontHeightH4","ctrlSetFontHeightH5","ctrlSetFontHeightH6","ctrlSetFontP","ctrlSetFontPB","ctrlSetForegroundColor","ctrlSetModel","ctrlSetModelDirAndUp","ctrlSetModelScale","ctrlSetPosition","ctrlSetScale","ctrlSetStructuredText","ctrlSetText","ctrlSetTextColor","ctrlSetTooltip","ctrlSetTooltipColorBox","ctrlSetTooltipColorShade","ctrlSetTooltipColorText","ctrlShow","ctrlShown","ctrlText","ctrlTextHeight","ctrlType","ctrlVisible","curatorAddons","curatorCamera","curatorCameraArea","curatorCameraAreaCeiling","curatorCoef","curatorEditableObjects","curatorEditingArea","curatorEditingAreaType","curatorMouseOver","curatorPoints","curatorRegisteredObjects","curatorSelected","curatorWaypointCost","currentChannel","currentCommand","currentMagazine","currentMagazineDetail","currentMagazineDetailTurret","currentMagazineTurret","currentMuzzle","currentNamespace","currentTask","currentTasks","currentThrowable","currentVisionMode","currentWaypoint","currentWeapon","currentWeaponMode","currentWeaponTurret","currentZeroing","cursorTarget","customChat","customRadio","cutFadeOut","cutObj","cutRsc","cutText","damage","date","dateToNumber","daytime","deActivateKey","debriefingText","debugFSM","debugLog","default","deg","deleteAt","deleteCenter","deleteCollection","deleteEditorObject","deleteGroup","deleteIdentity","deleteLocation","deleteMarker","deleteMarkerLocal","deleteRange","deleteResources","deleteSite","deleteStatus","deleteTeam","deleteVehicle","deleteVehicleCrew","deleteWaypoint","detach","detectedMines","diag activeMissionFSMs","diag activeSQFScripts","diag activeSQSScripts","diag captureFrame","diag captureSlowFrame","diag fps","diag fpsMin","diag frameNo","diag log","diag logSlowFrame","diag tickTime","dialog","diarySubjectExists","didJIP","didJIPOwner","difficulty","difficultyEnabled","difficultyEnabledRTD","direction","directSay","disableAI","disableCollisionWith","disableConversation","disableDebriefingStats","disableSerialization","disableTIEquipment","disableUAVConnectability","disableUserInput","displayAddEventHandler","displayCtrl","displayNull","displayRemoveAllEventHandlers","displayRemoveEventHandler","displaySetEventHandler","dissolveTeam","distance","distance2D","distanceSqr","distributionRegion","do","doArtilleryFire","doFire","doFollow","doFSM","doGetOut","doMove","doorPhase","doStop","doTarget","doWatch","drawArrow","drawEllipse","drawIcon","drawIcon3D","drawLine","drawLine3D","drawLink","drawLocation","drawRectangle","driver","drop","east","echo","editObject","editorSetEventHandler","effectiveCommander","else","emptyPositions","enableAI","enableAIFeature","enableAttack","enableCamShake","enableCaustics","enableCollisionWith","enableCopilot","enableDebriefingStats","enableDiagLegend","enableEndDialog","enableEngineArtillery","enableEnvironment","enableFatigue","enableGunLights","enableIRLasers","enableMimics","enablePersonTurret","enableRadio","enableReload","enableRopeAttach","enableSatNormalOnDetail","enableSaving","enableSentences","enableSimulation","enableSimulationGlobal","enableTeamSwitch","enableUAVConnectability","enableUAVWaypoints","endLoadingScreen","endMission","engineOn","enginesIsOnRTD","enginesRpmRTD","enginesTorqueRTD","entities","estimatedEndServerTime","estimatedTimeLeft","evalObjectArgument","everyBackpack","everyContainer","exec","execEditorScript","execFSM","execVM","exit","exitWith","exp","expectedDestination","eyeDirection","eyePos","face","faction","fadeMusic","fadeRadio","fadeSound","fadeSpeech","failMission","false","fillWeaponsFromPool","find","findCover","findDisplay","findEditorObject","findEmptyPosition","findEmptyPositionReady","findNearestEnemy","finishMissionInit","finite","fire","fireAtTarget","firstBackpack","flag","flagOwner","fleeing","floor","flyInHeight","fog","fogForecast","fogParams","for","forceAddUniform","forceEnd","forceMap","forceRespawn","forceSpeed","forceWalk","forceWeaponFire","forceWeatherChange","forEach","forEachMember","forEachMemberAgent","forEachMemberTeam","format","formation","formationDirection","formationLeader","formationMembers","formationPosition","formationTask","formatText","formLeader","freeLook","from","fromEditor","fuel","fullCrew","gearSlotAmmoCount","gearSlotData","getAllHitPointsDamage","getAmmoCargo","getArray","getArtilleryAmmo","getArtilleryComputerSettings","getArtilleryETA","getAssignedCuratorLogic","getAssignedCuratorUnit","getBackpackCargo","getBleedingRemaining","getBurningValue","getCargoIndex","getCenterOfMass","getClientState","getConnectedUAV","getDammage","getDescription","getDir","getDirVisual","getDLCs","getEditorCamera","getEditorMode","getEditorObjectScope","getElevationOffset","getFatigue","getFriend","getFSMVariable","getFuelCargo","getGroupIcon","getGroupIconParams","getGroupIcons","getHideFrom","getHit","getHitIndex","getHitPointDamage","getItemCargo","getMagazineCargo","getMarkerColor","getMarkerPos","getMarkerSize","getMarkerType","getMass","getModelInfo","getNumber","getObjectArgument","getObjectChildren","getObjectDLC","getObjectMaterials","getObjectProxy","getObjectTextures","getObjectType","getObjectViewDistance","getOxygenRemaining","getPersonUsedDLCs","getPlayerChannel","getPlayerUID","getPos","getPosASL","getPosASLVisual","getPosASLW","getPosATL","getPosATLVisual","getPosVisual","getPosWorld","getRepairCargo","getResolution","getShadowDistance","getSlingLoad","getSpeed","getSuppression","getTerrainHeightASL","getText","getVariable","getWeaponCargo","getWPPos","glanceAt","globalChat","globalRadio","goggles","goto","group","groupChat","groupFromNetId","groupIconSelectable","groupIconsVisible","groupId","groupOwner","groupRadio","groupSelectedUnits","groupSelectUnit","grpNull","gunner","gusts","halt","handgunItems","handgunMagazine","handgunWeapon","handsHit","hasInterface","hasWeapon","hcAllGroups","hcGroupParams","hcLeader","hcRemoveAllGroups","hcRemoveGroup","hcSelected","hcSelectGroup","hcSetGroup","hcShowBar","hcShownBar","headgear","hideBody","hideObject","hideObjectGlobal","hint","hintC","hintCadet","hintSilent","hmd","hostMission","htmlLoad","HUDMovementLevels","humidity","if","image","importAllGroups","importance","in","incapacitatedState","independent","inflame","inflamed","inGameUISetEventHandler","inheritsFrom","initAmbientLife","inputAction","inRangeOfArtillery","insertEditorObject","intersect","isAbleToBreathe","isAgent","isArray","isAutoHoverOn","isAutonomous","isAutotest","isBleeding","isBurning","isClass","isCollisionLightOn","isCopilotEnabled","isDedicated","isDLCAvailable","isEngineOn","isEqualTo","isFlashlightOn","isFlatEmpty","isForcedWalk","isFormationLeader","isHidden","isInRemainsCollector","isInstructorFigureEnabled","isIRLaserOn","isKeyActive","isKindOf","isLightOn","isLocalized","isManualFire","isMarkedForCollection","isMultiplayer","isNil","isNull","isNumber","isObjectHidden","isObjectRTD","isOnRoad","isPipEnabled","isPlayer","isRealTime","isServer","isShowing3DIcons","isSteamMission","isStreamFriendlyUIEnabled","isText","isTouchingGround","isTurnedOut","isTutHintsEnabled","isUAVConnectable","isUAVConnected","isUniformAllowed","isWalking","isWeaponDeployed","isWeaponRested","itemCargo","items","itemsWithMagazines","join","joinAs","joinAsSilent","joinSilent","joinString","kbAddDatabase","kbAddDatabaseTargets","kbAddTopic","kbHasTopic","kbReact","kbRemoveTopic","kbTell","kbWasSaid","keyImage","keyName","knowsAbout","land","landAt","landResult","language","laserTarget","lbAdd","lbClear","lbColor","lbCurSel","lbData","lbDelete","lbIsSelected","lbPicture","lbSelection","lbSetColor","lbSetCurSel","lbSetData","lbSetPicture","lbSetPictureColor","lbSetPictureColorDisabled","lbSetPictureColorSelected","lbSetSelectColor","lbSetSelectColorRight","lbSetSelected","lbSetTooltip","lbSetValue","lbSize","lbSort","lbSortByValue","lbText","lbValue","leader","leaderboardDeInit","leaderboardGetRows","leaderboardInit","leaveVehicle","libraryCredits","libraryDisclaimers","lifeState","lightAttachObject","lightDetachObject","lightIsOn","lightnings","limitSpeed","linearConversion","lineBreak","lineIntersects","lineIntersectsObjs","lineIntersectsSurfaces","lineIntersectsWith","linkItem","list","listObjects","ln","lnbAddArray","lnbAddColumn","lnbAddRow","lnbClear","lnbColor","lnbCurSelRow","lnbData","lnbDeleteColumn","lnbDeleteRow","lnbGetColumnsPosition","lnbPicture","lnbSetColor","lnbSetColumnsPos","lnbSetCurSelRow","lnbSetData","lnbSetPicture","lnbSetText","lnbSetValue","lnbSize","lnbText","lnbValue","load","loadAbs","loadBackpack","loadFile","loadGame","loadIdentity","loadMagazine","loadOverlay","loadStatus","loadUniform","loadVest","local","localize","locationNull","locationPosition","lock","lockCameraTo","lockCargo","lockDriver","locked","lockedCargo","lockedDriver","lockedTurret","lockTurret","lockWP","log","logEntities","lookAt","lookAtPos","magazineCargo","magazines","magazinesAllTurrets","magazinesAmmo","magazinesAmmoCargo","magazinesAmmoFull","magazinesDetail","magazinesDetailBackpack","magazinesDetailUniform","magazinesDetailVest","magazinesTurret","magazineTurretAmmo","mapAnimAdd","mapAnimClear","mapAnimCommit","mapAnimDone","mapCenterOnCamera","mapGridPosition","markAsFinishedOnSteam","markerAlpha","markerBrush","markerColor","markerDir","markerPos","markerShape","markerSize","markerText","markerType","max","members","min","mineActive","mineDetectedBy","missionConfigFile","missionName","missionNamespace","missionStart","mod","modelToWorld","modelToWorldVisual","moonIntensity","morale","move","moveInAny","moveInCargo","moveInCommander","moveInDriver","moveInGunner","moveInTurret","moveObjectToEnd","moveOut","moveTime","moveTo","moveToCompleted","moveToFailed","musicVolume","name","name location","nameSound","nearEntities","nearestBuilding","nearestLocation","nearestLocations","nearestLocationWithDubbing","nearestObject","nearestObjects","nearObjects","nearObjectsReady","nearRoads","nearSupplies","nearTargets","needReload","netId","netObjNull","newOverlay","nextMenuItemIndex","nextWeatherChange","nil","nMenuItems","not","numberToDate","objectCurators","objectFromNetId","objectParent","objNull","objStatus","onBriefingGroup","onBriefingNotes","onBriefingPlan","onBriefingTeamSwitch","onCommandModeChanged","onDoubleClick","onEachFrame","onGroupIconClick","onGroupIconOverEnter","onGroupIconOverLeave","onHCGroupSelectionChanged","onMapSingleClick","onPlayerConnected","onPlayerDisconnected","onPreloadFinished","onPreloadStarted","onShowNewObject","onTeamSwitch","openCuratorInterface","openMap","openYoutubeVideo","opfor","or","orderGetIn","overcast","overcastForecast","owner","param","params","parseNumber","parseText","parsingNamespace","particlesQuality","pi","pickWeaponPool","pitch","playableSlotsNumber","playableUnits","playAction","playActionNow","player","playerRespawnTime","playerSide","playersNumber","playGesture","playMission","playMove","playMoveNow","playMusic","playScriptedMission","playSound","playSound3D","position","positionCameraToWorld","posScreenToWorld","posWorldToScreen","ppEffectAdjust","ppEffectCommit","ppEffectCommitted","ppEffectCreate","ppEffectDestroy","ppEffectEnable","ppEffectForceInNVG","precision","preloadCamera","preloadObject","preloadSound","preloadTitleObj","preloadTitleRsc","preprocessFile","preprocessFileLineNumbers","primaryWeapon","primaryWeaponItems","primaryWeaponMagazine","priority","private","processDiaryLink","productVersion","profileName","profileNamespace","profileNameSteam","progressLoadingScreen","progressPosition","progressSetPosition","publicVariable","publicVariableClient","publicVariableServer","pushBack","putWeaponPool","queryItemsPool","queryMagazinePool","queryWeaponPool","rad","radioChannelAdd","radioChannelCreate","radioChannelRemove","radioChannelSetCallSign","radioChannelSetLabel","radioVolume","rain","rainbow","random","rank","rankId","rating","rectangular","registeredTasks","registerTask","reload","reloadEnabled","remoteControl","remoteExec","remoteExecCall","removeAction","removeAllActions","removeAllAssignedItems","removeAllContainers","removeAllCuratorAddons","removeAllCuratorCameraAreas","removeAllCuratorEditingAreas","removeAllEventHandlers","removeAllHandgunItems","removeAllItems","removeAllItemsWithMagazines","removeAllMissionEventHandlers","removeAllMPEventHandlers","removeAllMusicEventHandlers","removeAllPrimaryWeaponItems","removeAllWeapons","removeBackpack","removeBackpackGlobal","removeCuratorAddons","removeCuratorCameraArea","removeCuratorEditableObjects","removeCuratorEditingArea","removeDrawIcon","removeDrawLinks","removeEventHandler","removeFromRemainsCollector","removeGoggles","removeGroupIcon","removeHandgunItem","removeHeadgear","removeItem","removeItemFromBackpack","removeItemFromUniform","removeItemFromVest","removeItems","removeMagazine","removeMagazineGlobal","removeMagazines","removeMagazinesTurret","removeMagazineTurret","removeMenuItem","removeMissionEventHandler","removeMPEventHandler","removeMusicEventHandler","removePrimaryWeaponItem","removeSecondaryWeaponItem","removeSimpleTask","removeSwitchableUnit","removeTeamMember","removeUniform","removeVest","removeWeapon","removeWeaponGlobal","removeWeaponTurret","requiredVersion","resetCamShake","resetSubgroupDirection","resistance","resize","resources","respawnVehicle","restartEditorCamera","reveal","revealMine","reverse","reversedMouseY","roadsConnectedTo","roleDescription","ropeAttachedObjects","ropeAttachedTo","ropeAttachEnabled","ropeAttachTo","ropeCreate","ropeCut","ropeEndPosition","ropeLength","ropes","ropeUnwind","ropeUnwound","rotorsForcesRTD","rotorsRpmRTD","round","runInitScript","safeZoneH","safeZoneW","safeZoneWAbs","safeZoneX","safeZoneXAbs","safeZoneY","saveGame","saveIdentity","saveJoysticks","saveOverlay","saveProfileNamespace","saveStatus","saveVar","savingEnabled","say","say2D","say3D","scopeName","score","scoreSide","screenToWorld","scriptDone","scriptName","scriptNull","scudState","secondaryWeapon","secondaryWeaponItems","secondaryWeaponMagazine","select","selectBestPlaces","selectDiarySubject","selectedEditorObjects","selectEditorObject","selectionPosition","selectLeader","selectNoPlayer","selectPlayer","selectWeapon","selectWeaponTurret","sendAUMessage","sendSimpleCommand","sendTask","sendTaskResult","sendUDPMessage","serverCommand","serverCommandAvailable","serverCommandExecutable","serverName","serverTime","set","setAccTime","setAirportSide","setAmmo","setAmmoCargo","setAperture","setApertureNew","setArmoryPoints","setAttributes","setAutonomous","setBehaviour","setBleedingRemaining","setCameraInterest","setCamShakeDefParams","setCamShakeParams","setCamUseTi","setCaptive","setCenterOfMass","setCollisionLight","setCombatMode","setCompassOscillation","setCuratorCameraAreaCeiling","setCuratorCoef","setCuratorEditingAreaType","setCuratorWaypointCost","setCurrentChannel","setCurrentTask","setCurrentWaypoint","setDamage","setDammage","setDate","setDebriefingText","setDefaultCamera","setDestination","setDetailMapBlendPars","setDir","setDirection","setDrawIcon","setDropInterval","setEditorMode","setEditorObjectScope","setEffectCondition","setFace","setFaceAnimation","setFatigue","setFlagOwner","setFlagSide","setFlagTexture","setFog","setFog array","setFormation","setFormationTask","setFormDir","setFriend","setFromEditor","setFSMVariable","setFuel","setFuelCargo","setGroupIcon","setGroupIconParams","setGroupIconsSelectable","setGroupIconsVisible","setGroupId","setGroupIdGlobal","setGroupOwner","setGusts","setHideBehind","setHit","setHitIndex","setHitPointDamage","setHorizonParallaxCoef","setHUDMovementLevels","setIdentity","setImportance","setLeader","setLightAmbient","setLightAttenuation","setLightBrightness","setLightColor","setLightDayLight","setLightFlareMaxDistance","setLightFlareSize","setLightIntensity","setLightnings","setLightUseFlare","setLocalWindParams","setMagazineTurretAmmo","setMarkerAlpha","setMarkerAlphaLocal","setMarkerBrush","setMarkerBrushLocal","setMarkerColor","setMarkerColorLocal","setMarkerDir","setMarkerDirLocal","setMarkerPos","setMarkerPosLocal","setMarkerShape","setMarkerShapeLocal","setMarkerSize","setMarkerSizeLocal","setMarkerText","setMarkerTextLocal","setMarkerType","setMarkerTypeLocal","setMass","setMimic","setMousePosition","setMusicEffect","setMusicEventHandler","setName","setNameSound","setObjectArguments","setObjectMaterial","setObjectProxy","setObjectTexture","setObjectTextureGlobal","setObjectViewDistance","setOvercast","setOwner","setOxygenRemaining","setParticleCircle","setParticleClass","setParticleFire","setParticleParams","setParticleRandom","setPilotLight","setPiPEffect","setPitch","setPlayable","setPlayerRespawnTime","setPos","setPosASL","setPosASL2","setPosASLW","setPosATL","setPosition","setPosWorld","setRadioMsg","setRain","setRainbow","setRandomLip","setRank","setRectangular","setRepairCargo","setShadowDistance","setSide","setSimpleTaskDescription","setSimpleTaskDestination","setSimpleTaskTarget","setSimulWeatherLayers","setSize","setSkill","setSkill array","setSlingLoad","setSoundEffect","setSpeaker","setSpeech","setSpeedMode","setStatValue","setSuppression","setSystemOfUnits","setTargetAge","setTaskResult","setTaskState","setTerrainGrid","setText","setTimeMultiplier","setTitleEffect","setTriggerActivation","setTriggerArea","setTriggerStatements","setTriggerText","setTriggerTimeout","setTriggerType","setType","setUnconscious","setUnitAbility","setUnitPos","setUnitPosWeak","setUnitRank","setUnitRecoilCoefficient","setUnloadInCombat","setUserActionText","setVariable","setVectorDir","setVectorDirAndUp","setVectorUp","setVehicleAmmo","setVehicleAmmoDef","setVehicleArmor","setVehicleId","setVehicleLock","setVehiclePosition","setVehicleTiPars","setVehicleVarName","setVelocity","setVelocityTransformation","setViewDistance","setVisibleIfTreeCollapsed","setWaves","setWaypointBehaviour","setWaypointCombatMode","setWaypointCompletionRadius","setWaypointDescription","setWaypointFormation","setWaypointHousePosition","setWaypointLoiterRadius","setWaypointLoiterType","setWaypointName","setWaypointPosition","setWaypointScript","setWaypointSpeed","setWaypointStatements","setWaypointTimeout","setWaypointType","setWaypointVisible","setWeaponReloadingTime","setWind","setWindDir","setWindForce","setWindStr","setWPPos","show3DIcons","showChat","showCinemaBorder","showCommandingMenu","showCompass","showCuratorCompass","showGPS","showHUD","showLegend","showMap","shownArtilleryComputer","shownChat","shownCompass","shownCuratorCompass","showNewEditorObject","shownGPS","shownHUD","shownMap","shownPad","shownRadio","shownUAVFeed","shownWarrant","shownWatch","showPad","showRadio","showSubtitles","showUAVFeed","showWarrant","showWatch","showWaypoint","side","sideChat","sideEnemy","sideFriendly","sideLogic","sideRadio","sideUnknown","simpleTasks","simulationEnabled","simulCloudDensity","simulCloudOcclusion","simulInClouds","simulWeatherSync","sin","size","sizeOf","skill","skillFinal","skipTime","sleep","sliderPosition","sliderRange","sliderSetPosition","sliderSetRange","sliderSetSpeed","sliderSpeed","slingLoadAssistantShown","soldierMagazines","someAmmo","sort","soundVolume","spawn","speaker","speed","speedMode","splitString","sqrt","squadParams","stance","startLoadingScreen","step","stop","stopped","str","sunOrMoon","supportInfo","suppressFor","surfaceIsWater","surfaceNormal","surfaceType","swimInDepth","switch","switchableUnits","switchAction","switchCamera","switchGesture","switchLight","switchMove","synchronizedObjects","synchronizedTriggers","synchronizedWaypoints","synchronizeObjectsAdd","synchronizeObjectsRemove","synchronizeTrigger","synchronizeWaypoint","synchronizeWaypoint trigger","systemChat","systemOfUnits","tan","targetKnowledge","targetsAggregate","targetsQuery","taskChildren","taskCompleted","taskDescription","taskDestination","taskHint","taskNull","taskParent","taskResult","taskState","teamMember","teamMemberNull","teamName","teams","teamSwitch","teamSwitchEnabled","teamType","terminate","terrainIntersect","terrainIntersectASL","text","text location","textLog","textLogFormat","tg","then","throw","time","timeMultiplier","titleCut","titleFadeOut","titleObj","titleRsc","titleText","to","toArray","toLower","toString","toUpper","triggerActivated","triggerActivation","triggerArea","triggerAttachedVehicle","triggerAttachObject","triggerAttachVehicle","triggerStatements","triggerText","triggerTimeout","triggerTimeoutCurrent","triggerType","true","try","turretLocal","turretOwner","turretUnit","tvAdd","tvClear","tvCollapse","tvCount","tvCurSel","tvData","tvDelete","tvExpand","tvPicture","tvSetCurSel","tvSetData","tvSetPicture","tvSetPictureColor","tvSetTooltip","tvSetValue","tvSort","tvSortByValue","tvText","tvValue","type","typeName","typeOf","UAVControl","uiNamespace","uiSleep","unassignCurator","unassignItem","unassignTeam","unassignVehicle","underwater","uniform","uniformContainer","uniformItems","uniformMagazines","unitAddons","unitBackpack","unitPos","unitReady","unitRecoilCoefficient","units","unitsBelowHeight","unlinkItem","unlockAchievement","unregisterTask","updateDrawIcon","updateMenuItem","updateObjectTree","useAudioTimeForMoves","vectorAdd","vectorCos","vectorCrossProduct","vectorDiff","vectorDir","vectorDirVisual","vectorDistance","vectorDistanceSqr","vectorDotProduct","vectorFromTo","vectorMagnitude","vectorMagnitudeSqr","vectorMultiply","vectorNormalized","vectorUp","vectorUpVisual","vehicle","vehicleChat","vehicleRadio","vehicles","vehicleVarName","velocity","velocityModelSpace","verifySignature","vest","vestContainer","vestItems","vestMagazines","viewDistance","visibleCompass","visibleGPS","visibleMap","visiblePosition","visiblePositionASL","visibleWatch","waitUntil","waves","waypointAttachedObject","waypointAttachedVehicle","waypointAttachObject","waypointAttachVehicle","waypointBehaviour","waypointCombatMode","waypointCompletionRadius","waypointDescription","waypointFormation","waypointHousePosition","waypointLoiterRadius","waypointLoiterType","waypointName","waypointPosition","waypoints","waypointScript","waypointsEnabledUAV","waypointShow","waypointSpeed","waypointStatements","waypointTimeout","waypointTimeoutCurrent","waypointType","waypointVisible","weaponAccessories","weaponCargo","weaponDirection","weaponLowered","weapons","weaponsItems","weaponsItemsCargo","weaponState","weaponsTurret","weightRTD","west","WFSideText","while","wind","windDir","windStr","wingsForcesRTD","with","worldName","worldSize","worldToModel","worldToModelVisual","worldToScreen"],c=["case","catch","default","do","else","exit","exitWith|5","for","forEach","from","if","switch","then","throw","to","try","while","with"],d=["!","-","+","!=","%","&&","*","/","=","==",">",">=","<","<=","^",":",">>"],e=["_forEachIndex|10","_this|10","_x|10"],f=["true","false","nil"],g=b.filter(function(a){ +return-1==c.indexOf(a)&&-1==f.indexOf(a)&&-1==d.indexOf(a)});g=g.concat(e);var h={className:"string",relevance:0,variants:[{begin:'"',end:'"',contains:[{begin:'""'}]},{begin:"'",end:"'",contains:[{begin:"''"}]}]},i={className:"number",begin:a.NUMBER_RE,relevance:0},j={className:"string",variants:[a.QUOTE_STRING_MODE,{begin:"'\\\\?.",end:"'",illegal:"."}]},k={className:"preprocessor",begin:"#",end:"$",keywords:"if else elif endif define undef warning error line pragma ifdef ifndef",contains:[{begin:/\\\n/,relevance:0},{beginKeywords:"include",end:"$",contains:[j,{className:"string",begin:"<",end:">",illegal:"\\n"}]},j,i,a.C_LINE_COMMENT_MODE,a.C_BLOCK_COMMENT_MODE]};return{aliases:["sqf"],case_insensitive:!0,keywords:{keyword:c.join(" "),built_in:g.join(" "),literal:f.join(" ")},contains:[a.C_LINE_COMMENT_MODE,a.C_BLOCK_COMMENT_MODE,i,h,k]}}),a.registerLanguage("sql",function(a){var b=a.COMMENT("--","$");return{case_insensitive:!0,illegal:/[<>{}*]/,contains:[{className:"operator",beginKeywords:"begin end start commit rollback savepoint lock alter create drop rename call delete do handler insert load replace select truncate update set show pragma grant merge describe use explain help declare prepare execute deallocate release unlock purge reset change stop analyze cache flush optimize repair kill install uninstall checksum restore check backup revoke",end:/;/,endsWithParent:!0,keywords:{keyword:"abort abs absolute acc acce accep accept access accessed accessible account acos action activate add addtime admin administer advanced advise aes_decrypt aes_encrypt after agent aggregate ali alia alias allocate allow alter always analyze ancillary and any anydata anydataset anyschema anytype apply archive archived archivelog are as asc ascii asin assembly assertion associate asynchronous at atan atn2 attr attri attrib attribu attribut attribute attributes audit authenticated authentication authid authors auto autoallocate autodblink autoextend automatic availability avg backup badfile basicfile before begin beginning benchmark between bfile bfile_base big bigfile bin binary_double binary_float binlog bit_and bit_count bit_length bit_or bit_xor bitmap blob_base block blocksize body both bound buffer_cache buffer_pool build bulk by byte byteordermark bytes c cache caching call calling cancel capacity cascade cascaded case cast catalog category ceil ceiling chain change changed char_base char_length character_length characters characterset charindex charset charsetform charsetid check checksum checksum_agg child choose chr chunk class cleanup clear client clob clob_base clone close cluster_id cluster_probability cluster_set clustering coalesce coercibility col collate collation collect colu colum column column_value columns columns_updated comment commit compact compatibility compiled complete composite_limit compound compress compute concat concat_ws concurrent confirm conn connec connect connect_by_iscycle connect_by_isleaf connect_by_root connect_time connection consider consistent constant constraint constraints constructor container content contents context contributors controlfile conv convert convert_tz corr corr_k corr_s corresponding corruption cos cost count count_big counted covar_pop covar_samp cpu_per_call cpu_per_session crc32 create creation critical cross cube cume_dist curdate current current_date current_time current_timestamp current_user cursor curtime customdatum cycle d data database databases datafile datafiles datalength date_add date_cache date_format date_sub dateadd datediff datefromparts datename datepart datetime2fromparts day day_to_second dayname dayofmonth dayofweek dayofyear days db_role_change dbtimezone ddl deallocate declare decode decompose decrement decrypt deduplicate def defa defau defaul default defaults deferred defi defin define degrees delayed delegate delete delete_all delimited demand dense_rank depth dequeue des_decrypt des_encrypt des_key_file desc descr descri describ describe descriptor deterministic diagnostics difference dimension direct_load directory disable disable_all disallow disassociate discardfile disconnect diskgroup distinct distinctrow distribute distributed div do document domain dotnet double downgrade drop dumpfile duplicate duration e each edition editionable editions element ellipsis else elsif elt empty enable enable_all enclosed encode encoding encrypt end end-exec endian enforced engine engines enqueue enterprise entityescaping eomonth error errors escaped evalname evaluate event eventdata events except exception exceptions exchange exclude excluding execu execut execute exempt exists exit exp expire explain export export_set extended extent external external_1 external_2 externally extract f failed failed_login_attempts failover failure far fast feature_set feature_value fetch field fields file file_name_convert filesystem_like_logging final finish first first_value fixed flash_cache flashback floor flush following follows for forall force form forma format found found_rows freelist freelists freepools fresh from from_base64 from_days ftp full function g general generated get get_format get_lock getdate getutcdate global global_name globally go goto grant grants greatest group group_concat group_id grouping grouping_id groups gtid_subtract guarantee guard handler hash hashkeys having hea head headi headin heading heap help hex hierarchy high high_priority hosts hour http i id ident_current ident_incr ident_seed identified identity idle_time if ifnull ignore iif ilike ilm immediate import in include including increment index indexes indexing indextype indicator indices inet6_aton inet6_ntoa inet_aton inet_ntoa infile initial initialized initially initrans inmemory inner innodb input insert install instance instantiable instr interface interleaved intersect into invalidate invisible is is_free_lock is_ipv4 is_ipv4_compat is_not is_not_null is_used_lock isdate isnull isolation iterate java join json json_exists k keep keep_duplicates key keys kill l language large last last_day last_insert_id last_value lax lcase lead leading least leaves left len lenght length less level levels library like like2 like4 likec limit lines link list listagg little ln load load_file lob lobs local localtime localtimestamp locate locator lock locked log log10 log2 logfile logfiles logging logical logical_reads_per_call logoff logon logs long loop low low_priority lower lpad lrtrim ltrim m main make_set makedate maketime managed management manual map mapping mask master master_pos_wait match matched materialized max maxextents maximize maxinstances maxlen maxlogfiles maxloghistory maxlogmembers maxsize maxtrans md5 measures median medium member memcompress memory merge microsecond mid migration min minextents minimum mining minus minute minvalue missing mod mode model modification modify module monitoring month months mount move movement multiset mutex n name name_const names nan national native natural nav nchar nclob nested never new newline next nextval no no_write_to_binlog noarchivelog noaudit nobadfile nocheck nocompress nocopy nocycle nodelay nodiscardfile noentityescaping noguarantee nokeep nologfile nomapping nomaxvalue nominimize nominvalue nomonitoring none noneditionable nonschema noorder nopr nopro noprom nopromp noprompt norely noresetlogs noreverse normal norowdependencies noschemacheck noswitch not nothing notice notrim novalidate now nowait nth_value nullif nulls num numb numbe nvarchar nvarchar2 object ocicoll ocidate ocidatetime ociduration ociinterval ociloblocator ocinumber ociref ocirefcursor ocirowid ocistring ocitype oct octet_length of off offline offset oid oidindex old on online only opaque open operations operator optimal optimize option optionally or oracle oracle_date oradata ord ordaudio orddicom orddoc order ordimage ordinality ordvideo organization orlany orlvary out outer outfile outline output over overflow overriding p package pad parallel parallel_enable parameters parent parse partial partition partitions pascal passing password password_grace_time password_lock_time password_reuse_max password_reuse_time password_verify_function patch path patindex pctincrease pctthreshold pctused pctversion percent percent_rank percentile_cont percentile_disc performance period period_add period_diff permanent physical pi pipe pipelined pivot pluggable plugin policy position post_transaction pow power pragma prebuilt precedes preceding precision prediction prediction_cost prediction_details prediction_probability prediction_set prepare present preserve prior priority private private_sga privileges procedural procedure procedure_analyze processlist profiles project prompt protection public publishingservername purge quarter query quick quiesce quota quotename radians raise rand range rank raw read reads readsize rebuild record records recover recovery recursive recycle redo reduced ref reference referenced references referencing refresh regexp_like register regr_avgx regr_avgy regr_count regr_intercept regr_r2 regr_slope regr_sxx regr_sxy reject rekey relational relative relaylog release release_lock relies_on relocate rely rem remainder rename repair repeat replace replicate replication required reset resetlogs resize resource respect restore restricted result result_cache resumable resume retention return returning returns reuse reverse revoke right rlike role roles rollback rolling rollup round row row_count rowdependencies rowid rownum rows rtrim rules safe salt sample save savepoint sb1 sb2 sb4 scan schema schemacheck scn scope scroll sdo_georaster sdo_topo_geometry search sec_to_time second section securefile security seed segment select self sequence sequential serializable server servererror session session_user sessions_per_user set sets settings sha sha1 sha2 share shared shared_pool short show shrink shutdown si_averagecolor si_colorhistogram si_featurelist si_positionalcolor si_stillimage si_texture siblings sid sign sin size size_t sizes skip slave sleep smalldatetimefromparts smallfile snapshot some soname sort soundex source space sparse spfile split sql sql_big_result sql_buffer_result sql_cache sql_calc_found_rows sql_small_result sql_variant_property sqlcode sqldata sqlerror sqlname sqlstate sqrt square standalone standby start starting startup statement static statistics stats_binomial_test stats_crosstab stats_ks_test stats_mode stats_mw_test stats_one_way_anova stats_t_test_ stats_t_test_indep stats_t_test_one stats_t_test_paired stats_wsr_test status std stddev stddev_pop stddev_samp stdev stop storage store stored str str_to_date straight_join strcmp strict string struct stuff style subdate subpartition subpartitions substitutable substr substring subtime subtring_index subtype success sum suspend switch switchoffset switchover sync synchronous synonym sys sys_xmlagg sysasm sysaux sysdate sysdatetimeoffset sysdba sysoper system system_user sysutcdatetime t table tables tablespace tan tdo template temporary terminated tertiary_weights test than then thread through tier ties time time_format time_zone timediff timefromparts timeout timestamp timestampadd timestampdiff timezone_abbr timezone_minute timezone_region to to_base64 to_date to_days to_seconds todatetimeoffset trace tracking transaction transactional translate translation treat trigger trigger_nestlevel triggers trim truncate try_cast try_convert try_parse type ub1 ub2 ub4 ucase unarchived unbounded uncompress under undo unhex unicode uniform uninstall union unique unix_timestamp unknown unlimited unlock unpivot unrecoverable unsafe unsigned until untrusted unusable unused update updated upgrade upped upper upsert url urowid usable usage use use_stored_outlines user user_data user_resources users using utc_date utc_timestamp uuid uuid_short validate validate_password_strength validation valist value values var var_samp varcharc vari varia variab variabl variable variables variance varp varraw varrawc varray verify version versions view virtual visible void wait wallet warning warnings week weekday weekofyear wellformed when whene whenev wheneve whenever where while whitespace with within without work wrapped xdb xml xmlagg xmlattributes xmlcast xmlcolattval xmlelement xmlexists xmlforest xmlindex xmlnamespaces xmlpi xmlquery xmlroot xmlschema xmlserialize xmltable xmltype xor year year_to_month years yearweek",literal:"true false null",built_in:"array bigint binary bit blob boolean char character date dec decimal float int int8 integer interval number numeric real record serial serial8 smallint text varchar varying void"},contains:[{className:"string",begin:"'",end:"'",contains:[a.BACKSLASH_ESCAPE,{begin:"''"}]},{className:"string",begin:'"',end:'"',contains:[a.BACKSLASH_ESCAPE,{begin:'""'}]},{className:"string",begin:"`",end:"`",contains:[a.BACKSLASH_ESCAPE]},a.C_NUMBER_MODE,a.C_BLOCK_COMMENT_MODE,b]},a.C_BLOCK_COMMENT_MODE,b]}}),a.registerLanguage("stata",function(a){return{aliases:["do","ado"],case_insensitive:!0,keywords:"if else in foreach for forv forva forval forvalu forvalue forvalues by bys bysort xi quietly qui capture about ac ac_7 acprplot acprplot_7 adjust ado adopath adoupdate alpha ameans an ano anov anova anova_estat anova_terms anovadef aorder ap app appe appen append arch arch_dr arch_estat arch_p archlm areg areg_p args arima arima_dr arima_estat arima_p as asmprobit asmprobit_estat asmprobit_lf asmprobit_mfx__dlg asmprobit_p ass asse asser assert avplot avplot_7 avplots avplots_7 bcskew0 bgodfrey binreg bip0_lf biplot bipp_lf bipr_lf bipr_p biprobit bitest bitesti bitowt blogit bmemsize boot bootsamp bootstrap bootstrap_8 boxco_l boxco_p boxcox boxcox_6 boxcox_p bprobit br break brier bro brow brows browse brr brrstat bs bs_7 bsampl_w bsample bsample_7 bsqreg bstat bstat_7 bstat_8 bstrap bstrap_7 ca ca_estat ca_p cabiplot camat canon canon_8 canon_8_p canon_estat canon_p cap caprojection capt captu captur capture cat cc cchart cchart_7 cci cd censobs_table centile cf char chdir checkdlgfiles checkestimationsample checkhlpfiles checksum chelp ci cii cl class classutil clear cli clis clist clo clog clog_lf clog_p clogi clogi_sw clogit clogit_lf clogit_p clogitp clogl_sw cloglog clonevar clslistarray cluster cluster_measures cluster_stop cluster_tree cluster_tree_8 clustermat cmdlog cnr cnre cnreg cnreg_p cnreg_sw cnsreg codebook collaps4 collapse colormult_nb colormult_nw compare compress conf confi confir confirm conren cons const constr constra constrai constrain constraint continue contract copy copyright copysource cor corc corr corr2data corr_anti corr_kmo corr_smc corre correl correla correlat correlate corrgram cou coun count cox cox_p cox_sw coxbase coxhaz coxvar cprplot cprplot_7 crc cret cretu cretur creturn cross cs cscript cscript_log csi ct ct_is ctset ctst_5 ctst_st cttost cumsp cumsp_7 cumul cusum cusum_7 cutil d datasig datasign datasigna datasignat datasignatu datasignatur datasignature datetof db dbeta de dec deco decod decode deff des desc descr descri describ describe destring dfbeta dfgls dfuller di di_g dir dirstats dis discard disp disp_res disp_s displ displa display distinct do doe doed doedi doedit dotplot dotplot_7 dprobit drawnorm drop ds ds_util dstdize duplicates durbina dwstat dydx e ed edi edit egen eivreg emdef en enc enco encod encode eq erase ereg ereg_lf ereg_p ereg_sw ereghet ereghet_glf ereghet_glf_sh ereghet_gp ereghet_ilf ereghet_ilf_sh ereghet_ip eret eretu eretur ereturn err erro error est est_cfexist est_cfname est_clickable est_expand est_hold est_table est_unhold est_unholdok estat estat_default estat_summ estat_vce_only esti estimates etodow etof etomdy ex exi exit expand expandcl fac fact facto factor factor_estat factor_p factor_pca_rotated factor_rotate factormat fcast fcast_compute fcast_graph fdades fdadesc fdadescr fdadescri fdadescrib fdadescribe fdasav fdasave fdause fh_st file open file read file close file filefilter fillin find_hlp_file findfile findit findit_7 fit fl fli flis flist for5_0 form forma format fpredict frac_154 frac_adj frac_chk frac_cox frac_ddp frac_dis frac_dv frac_in frac_mun frac_pp frac_pq frac_pv frac_wgt frac_xo fracgen fracplot fracplot_7 fracpoly fracpred fron_ex fron_hn fron_p fron_tn fron_tn2 frontier ftodate ftoe ftomdy ftowdate g gamhet_glf gamhet_gp gamhet_ilf gamhet_ip gamma gamma_d2 gamma_p gamma_sw gammahet gdi_hexagon gdi_spokes ge gen gene gener genera generat generate genrank genstd genvmean gettoken gl gladder gladder_7 glim_l01 glim_l02 glim_l03 glim_l04 glim_l05 glim_l06 glim_l07 glim_l08 glim_l09 glim_l10 glim_l11 glim_l12 glim_lf glim_mu glim_nw1 glim_nw2 glim_nw3 glim_p glim_v1 glim_v2 glim_v3 glim_v4 glim_v5 glim_v6 glim_v7 glm glm_6 glm_p glm_sw glmpred glo glob globa global glogit glogit_8 glogit_p gmeans gnbre_lf gnbreg gnbreg_5 gnbreg_p gomp_lf gompe_sw gomper_p gompertz gompertzhet gomphet_glf gomphet_glf_sh gomphet_gp gomphet_ilf gomphet_ilf_sh gomphet_ip gphdot gphpen gphprint gprefs gprobi_p gprobit gprobit_8 gr gr7 gr_copy gr_current gr_db gr_describe gr_dir gr_draw gr_draw_replay gr_drop gr_edit gr_editviewopts gr_example gr_example2 gr_export gr_print gr_qscheme gr_query gr_read gr_rename gr_replay gr_save gr_set gr_setscheme gr_table gr_undo gr_use graph graph7 grebar greigen greigen_7 greigen_8 grmeanby grmeanby_7 gs_fileinfo gs_filetype gs_graphinfo gs_stat gsort gwood h hadimvo hareg hausman haver he heck_d2 heckma_p heckman heckp_lf heckpr_p heckprob hel help hereg hetpr_lf hetpr_p hetprob hettest hexdump hilite hist hist_7 histogram hlogit hlu hmeans hotel hotelling hprobit hreg hsearch icd9 icd9_ff icd9p iis impute imtest inbase include inf infi infil infile infix inp inpu input ins insheet insp inspe inspec inspect integ inten intreg intreg_7 intreg_p intrg2_ll intrg_ll intrg_ll2 ipolate iqreg ir irf irf_create irfm iri is_svy is_svysum isid istdize ivprob_1_lf ivprob_lf ivprobit ivprobit_p ivreg ivreg_footnote ivtob_1_lf ivtob_lf ivtobit ivtobit_p jackknife jacknife jknife jknife_6 jknife_8 jkstat joinby kalarma1 kap kap_3 kapmeier kappa kapwgt kdensity kdensity_7 keep ksm ksmirnov ktau kwallis l la lab labe label labelbook ladder levels levelsof leverage lfit lfit_p li lincom line linktest lis list lloghet_glf lloghet_glf_sh lloghet_gp lloghet_ilf lloghet_ilf_sh lloghet_ip llogi_sw llogis_p llogist llogistic llogistichet lnorm_lf lnorm_sw lnorma_p lnormal lnormalhet lnormhet_glf lnormhet_glf_sh lnormhet_gp lnormhet_ilf lnormhet_ilf_sh lnormhet_ip lnskew0 loadingplot loc loca local log logi logis_lf logistic logistic_p logit logit_estat logit_p loglogs logrank loneway lookfor lookup lowess lowess_7 lpredict lrecomp lroc lroc_7 lrtest ls lsens lsens_7 lsens_x lstat ltable ltable_7 ltriang lv lvr2plot lvr2plot_7 m ma mac macr macro makecns man manova manova_estat manova_p manovatest mantel mark markin markout marksample mat mat_capp mat_order mat_put_rr mat_rapp mata mata_clear mata_describe mata_drop mata_matdescribe mata_matsave mata_matuse mata_memory mata_mlib mata_mosave mata_rename mata_which matalabel matcproc matlist matname matr matri matrix matrix_input__dlg matstrik mcc mcci md0_ md1_ md1debug_ md2_ md2debug_ mds mds_estat mds_p mdsconfig mdslong mdsmat mdsshepard mdytoe mdytof me_derd mean means median memory memsize meqparse mer merg merge mfp mfx mhelp mhodds minbound mixed_ll mixed_ll_reparm mkassert mkdir mkmat mkspline ml ml_5 ml_adjs ml_bhhhs ml_c_d ml_check ml_clear ml_cnt ml_debug ml_defd ml_e0 ml_e0_bfgs ml_e0_cycle ml_e0_dfp ml_e0i ml_e1 ml_e1_bfgs ml_e1_bhhh ml_e1_cycle ml_e1_dfp ml_e2 ml_e2_cycle ml_ebfg0 ml_ebfr0 ml_ebfr1 ml_ebh0q ml_ebhh0 ml_ebhr0 ml_ebr0i ml_ecr0i ml_edfp0 ml_edfr0 ml_edfr1 ml_edr0i ml_eds ml_eer0i ml_egr0i ml_elf ml_elf_bfgs ml_elf_bhhh ml_elf_cycle ml_elf_dfp ml_elfi ml_elfs ml_enr0i ml_enrr0 ml_erdu0 ml_erdu0_bfgs ml_erdu0_bhhh ml_erdu0_bhhhq ml_erdu0_cycle ml_erdu0_dfp ml_erdu0_nrbfgs ml_exde ml_footnote ml_geqnr ml_grad0 ml_graph ml_hbhhh ml_hd0 ml_hold ml_init ml_inv ml_log ml_max ml_mlout ml_mlout_8 ml_model ml_nb0 ml_opt ml_p ml_plot ml_query ml_rdgrd ml_repor ml_s_e ml_score ml_searc ml_technique ml_unhold mleval mlf_ mlmatbysum mlmatsum mlog mlogi mlogit mlogit_footnote mlogit_p mlopts mlsum mlvecsum mnl0_ mor more mov move mprobit mprobit_lf mprobit_p mrdu0_ mrdu1_ mvdecode mvencode mvreg mvreg_estat n nbreg nbreg_al nbreg_lf nbreg_p nbreg_sw nestreg net newey newey_7 newey_p news nl nl_7 nl_9 nl_9_p nl_p nl_p_7 nlcom nlcom_p nlexp2 nlexp2_7 nlexp2a nlexp2a_7 nlexp3 nlexp3_7 nlgom3 nlgom3_7 nlgom4 nlgom4_7 nlinit nllog3 nllog3_7 nllog4 nllog4_7 nlog_rd nlogit nlogit_p nlogitgen nlogittree nlpred no nobreak noi nois noisi noisil noisily note notes notes_dlg nptrend numlabel numlist odbc old_ver olo olog ologi ologi_sw ologit ologit_p ologitp on one onew onewa oneway op_colnm op_comp op_diff op_inv op_str opr opro oprob oprob_sw oprobi oprobi_p oprobit oprobitp opts_exclusive order orthog orthpoly ou out outf outfi outfil outfile outs outsh outshe outshee outsheet ovtest pac pac_7 palette parse parse_dissim pause pca pca_8 pca_display pca_estat pca_p pca_rotate pcamat pchart pchart_7 pchi pchi_7 pcorr pctile pentium pergram pergram_7 permute permute_8 personal peto_st pkcollapse pkcross pkequiv pkexamine pkexamine_7 pkshape pksumm pksumm_7 pl plo plot plugin pnorm pnorm_7 poisgof poiss_lf poiss_sw poisso_p poisson poisson_estat post postclose postfile postutil pperron pr prais prais_e prais_e2 prais_p predict predictnl preserve print pro prob probi probit probit_estat probit_p proc_time procoverlay procrustes procrustes_estat procrustes_p profiler prog progr progra program prop proportion prtest prtesti pwcorr pwd q\\s qby qbys qchi qchi_7 qladder qladder_7 qnorm qnorm_7 qqplot qqplot_7 qreg qreg_c qreg_p qreg_sw qu quadchk quantile quantile_7 que quer query range ranksum ratio rchart rchart_7 rcof recast reclink recode reg reg3 reg3_p regdw regr regre regre_p2 regres regres_p regress regress_estat regriv_p remap ren rena renam rename renpfix repeat replace report reshape restore ret retu retur return rm rmdir robvar roccomp roccomp_7 roccomp_8 rocf_lf rocfit rocfit_8 rocgold rocplot rocplot_7 roctab roctab_7 rolling rologit rologit_p rot rota rotat rotate rotatemat rreg rreg_p ru run runtest rvfplot rvfplot_7 rvpplot rvpplot_7 sa safesum sample sampsi sav save savedresults saveold sc sca scal scala scalar scatter scm_mine sco scob_lf scob_p scobi_sw scobit scor score scoreplot scoreplot_help scree screeplot screeplot_help sdtest sdtesti se search separate seperate serrbar serrbar_7 serset set set_defaults sfrancia sh she shel shell shewhart shewhart_7 signestimationsample signrank signtest simul simul_7 simulate simulate_8 sktest sleep slogit slogit_d2 slogit_p smooth snapspan so sor sort spearman spikeplot spikeplot_7 spikeplt spline_x split sqreg sqreg_p sret sretu sretur sreturn ssc st st_ct st_hc st_hcd st_hcd_sh st_is st_issys st_note st_promo st_set st_show st_smpl st_subid stack statsby statsby_8 stbase stci stci_7 stcox stcox_estat stcox_fr stcox_fr_ll stcox_p stcox_sw stcoxkm stcoxkm_7 stcstat stcurv stcurve stcurve_7 stdes stem stepwise stereg stfill stgen stir stjoin stmc stmh stphplot stphplot_7 stphtest stphtest_7 stptime strate strate_7 streg streg_sw streset sts sts_7 stset stsplit stsum sttocc sttoct stvary stweib su suest suest_8 sum summ summa summar summari summariz summarize sunflower sureg survcurv survsum svar svar_p svmat svy svy_disp svy_dreg svy_est svy_est_7 svy_estat svy_get svy_gnbreg_p svy_head svy_header svy_heckman_p svy_heckprob_p svy_intreg_p svy_ivreg_p svy_logistic_p svy_logit_p svy_mlogit_p svy_nbreg_p svy_ologit_p svy_oprobit_p svy_poisson_p svy_probit_p svy_regress_p svy_sub svy_sub_7 svy_x svy_x_7 svy_x_p svydes svydes_8 svygen svygnbreg svyheckman svyheckprob svyintreg svyintreg_7 svyintrg svyivreg svylc svylog_p svylogit svymarkout svymarkout_8 svymean svymlog svymlogit svynbreg svyolog svyologit svyoprob svyoprobit svyopts svypois svypois_7 svypoisson svyprobit svyprobt svyprop svyprop_7 svyratio svyreg svyreg_p svyregress svyset svyset_7 svyset_8 svytab svytab_7 svytest svytotal sw sw_8 swcnreg swcox swereg swilk swlogis swlogit swologit swoprbt swpois swprobit swqreg swtobit swweib symmetry symmi symplot symplot_7 syntax sysdescribe sysdir sysuse szroeter ta tab tab1 tab2 tab_or tabd tabdi tabdis tabdisp tabi table tabodds tabodds_7 tabstat tabu tabul tabula tabulat tabulate te tempfile tempname tempvar tes test testnl testparm teststd tetrachoric time_it timer tis tob tobi tobit tobit_p tobit_sw token tokeni tokeniz tokenize tostring total translate translator transmap treat_ll treatr_p treatreg trim trnb_cons trnb_mean trpoiss_d2 trunc_ll truncr_p truncreg tsappend tset tsfill tsline tsline_ex tsreport tsrevar tsrline tsset tssmooth tsunab ttest ttesti tut_chk tut_wait tutorial tw tware_st two twoway twoway__fpfit_serset twoway__function_gen twoway__histogram_gen twoway__ipoint_serset twoway__ipoints_serset twoway__kdensity_gen twoway__lfit_serset twoway__normgen_gen twoway__pci_serset twoway__qfit_serset twoway__scatteri_serset twoway__sunflower_gen twoway_ksm_serset ty typ type typeof u unab unabbrev unabcmd update us use uselabel var var_mkcompanion var_p varbasic varfcast vargranger varirf varirf_add varirf_cgraph varirf_create varirf_ctable varirf_describe varirf_dir varirf_drop varirf_erase varirf_graph varirf_ograph varirf_rename varirf_set varirf_table varlist varlmar varnorm varsoc varstable varstable_w varstable_w2 varwle vce vec vec_fevd vec_mkphi vec_p vec_p_w vecirf_create veclmar veclmar_w vecnorm vecnorm_w vecrank vecstable verinst vers versi versio version view viewsource vif vwls wdatetof webdescribe webseek webuse weib1_lf weib2_lf weib_lf weib_lf0 weibhet_glf weibhet_glf_sh weibhet_glfa weibhet_glfa_sh weibhet_gp weibhet_ilf weibhet_ilf_sh weibhet_ilfa weibhet_ilfa_sh weibhet_ip weibu_sw weibul_p weibull weibull_c weibull_s weibullhet wh whelp whi which whil while wilc_st wilcoxon win wind windo window winexec wntestb wntestb_7 wntestq xchart xchart_7 xcorr xcorr_7 xi xi_6 xmlsav xmlsave xmluse xpose xsh xshe xshel xshell xt_iis xt_tis xtab_p xtabond xtbin_p xtclog xtcloglog xtcloglog_8 xtcloglog_d2 xtcloglog_pa_p xtcloglog_re_p xtcnt_p xtcorr xtdata xtdes xtfront_p xtfrontier xtgee xtgee_elink xtgee_estat xtgee_makeivar xtgee_p xtgee_plink xtgls xtgls_p xthaus xthausman xtht_p xthtaylor xtile xtint_p xtintreg xtintreg_8 xtintreg_d2 xtintreg_p xtivp_1 xtivp_2 xtivreg xtline xtline_ex xtlogit xtlogit_8 xtlogit_d2 xtlogit_fe_p xtlogit_pa_p xtlogit_re_p xtmixed xtmixed_estat xtmixed_p xtnb_fe xtnb_lf xtnbreg xtnbreg_pa_p xtnbreg_refe_p xtpcse xtpcse_p xtpois xtpoisson xtpoisson_d2 xtpoisson_pa_p xtpoisson_refe_p xtpred xtprobit xtprobit_8 xtprobit_d2 xtprobit_re_p xtps_fe xtps_lf xtps_ren xtps_ren_8 xtrar_p xtrc xtrc_p xtrchh xtrefe_p xtreg xtreg_be xtreg_fe xtreg_ml xtreg_pa_p xtreg_re xtregar xtrere_p xtset xtsf_ll xtsf_llti xtsum xttab xttest0 xttobit xttobit_8 xttobit_p xttrans yx yxview__barlike_draw yxview_area_draw yxview_bar_draw yxview_dot_draw yxview_dropline_draw yxview_function_draw yxview_iarrow_draw yxview_ilabels_draw yxview_normal_draw yxview_pcarrow_draw yxview_pcbarrow_draw yxview_pccapsym_draw yxview_pcscatter_draw yxview_pcspike_draw yxview_rarea_draw yxview_rbar_draw yxview_rbarm_draw yxview_rcap_draw yxview_rcapsym_draw yxview_rconnected_draw yxview_rline_draw yxview_rscatter_draw yxview_rspike_draw yxview_spike_draw yxview_sunflower_draw zap_s zinb zinb_llf zinb_plf zip zip_llf zip_p zip_plf zt_ct_5 zt_hc_5 zt_hcd_5 zt_is_5 zt_iss_5 zt_sho_5 zt_smp_5 ztbase_5 ztcox_5 ztdes_5 ztereg_5 ztfill_5 ztgen_5 ztir_5 ztjoin_5 ztnb ztnb_p ztp ztp_p zts_5 ztset_5 ztspli_5 ztsum_5 zttoct_5 ztvary_5 ztweib_5",contains:[{className:"label",variants:[{begin:"\\$\\{?[a-zA-Z0-9_]+\\}?"},{begin:"`[a-zA-Z0-9_]+'"}]},{className:"string",variants:[{begin:'`"[^\r\n]*?"\''},{begin:'"[^\r\n"]*"'}]},{className:"literal",variants:[{begin:"\\b(abs|acos|asin|atan|atan2|atanh|ceil|cloglog|comb|cos|digamma|exp|floor|invcloglog|invlogit|ln|lnfact|lnfactorial|lngamma|log|log10|max|min|mod|reldif|round|sign|sin|sqrt|sum|tan|tanh|trigamma|trunc|betaden|Binomial|binorm|binormal|chi2|chi2tail|dgammapda|dgammapdada|dgammapdadx|dgammapdx|dgammapdxdx|F|Fden|Ftail|gammaden|gammap|ibeta|invbinomial|invchi2|invchi2tail|invF|invFtail|invgammap|invibeta|invnchi2|invnFtail|invnibeta|invnorm|invnormal|invttail|nbetaden|nchi2|nFden|nFtail|nibeta|norm|normal|normalden|normd|npnchi2|tden|ttail|uniform|abbrev|char|index|indexnot|length|lower|ltrim|match|plural|proper|real|regexm|regexr|regexs|reverse|rtrim|string|strlen|strlower|strltrim|strmatch|strofreal|strpos|strproper|strreverse|strrtrim|strtrim|strupper|subinstr|subinword|substr|trim|upper|word|wordcount|_caller|autocode|byteorder|chop|clip|cond|e|epsdouble|epsfloat|group|inlist|inrange|irecode|matrix|maxbyte|maxdouble|maxfloat|maxint|maxlong|mi|minbyte|mindouble|minfloat|minint|minlong|missing|r|recode|replay|return|s|scalar|d|date|day|dow|doy|halfyear|mdy|month|quarter|week|year|d|daily|dofd|dofh|dofm|dofq|dofw|dofy|h|halfyearly|hofd|m|mofd|monthly|q|qofd|quarterly|tin|twithin|w|weekly|wofd|y|yearly|yh|ym|yofd|yq|yw|cholesky|colnumb|colsof|corr|det|diag|diag0cnt|el|get|hadamard|I|inv|invsym|issym|issymmetric|J|matmissing|matuniform|mreldif|nullmat|rownumb|rowsof|sweep|syminv|trace|vec|vecdiag)(?=\\(|$)"}]},a.COMMENT("^[ ]*\\*.*$",!1),a.C_LINE_COMMENT_MODE,a.C_BLOCK_COMMENT_MODE]}}),a.registerLanguage("step21",function(a){var b="[A-Z_][A-Z0-9_.]*",c="END-ISO-10303-21;",d={literal:"",built_in:"",keyword:"HEADER ENDSEC DATA"},e={className:"preprocessor",begin:"ISO-10303-21;",relevance:10},f=[a.C_LINE_COMMENT_MODE,a.C_BLOCK_COMMENT_MODE,a.COMMENT("/\\*\\*!","\\*/"),a.C_NUMBER_MODE,a.inherit(a.APOS_STRING_MODE,{illegal:null}),a.inherit(a.QUOTE_STRING_MODE,{illegal:null}),{className:"string",begin:"'",end:"'"},{className:"label",variants:[{begin:"#",end:"\\d+",illegal:"\\W"}]}];return{aliases:["p21","step","stp"],case_insensitive:!0,lexemes:b,keywords:d,contains:[{className:"preprocessor",begin:c,relevance:10},e].concat(f)}}),a.registerLanguage("stylus",function(a){var b={className:"variable",begin:"\\$"+a.IDENT_RE},c={className:"hexcolor",begin:"#([a-fA-F0-9]{6}|[a-fA-F0-9]{3})",relevance:10},d=["charset","css","debug","extend","font-face","for","import","include","media","mixin","page","warn","while"],e=["after","before","first-letter","first-line","active","first-child","focus","hover","lang","link","visited"],f=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","mark","menu","nav","object","ol","p","q","quote","samp","section","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],g="[\\.\\s\\n\\[\\:,]",h=["align-content","align-items","align-self","animation","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-timing-function","auto","backface-visibility","background","background-attachment","background-clip","background-color","background-image","background-origin","background-position","background-repeat","background-size","border","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-decoration-break","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","clear","clip","clip-path","color","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","content","counter-increment","counter-reset","cursor","direction","display","empty-cells","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","font","font-family","font-feature-settings","font-kerning","font-language-override","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-variant-ligatures","font-weight","height","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","inherit","initial","justify-content","left","letter-spacing","line-height","list-style","list-style-image","list-style-position","list-style-type","margin","margin-bottom","margin-left","margin-right","margin-top","marks","mask","max-height","max-width","min-height","min-width","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-wrap","overflow-x","overflow-y","padding","padding-bottom","padding-left","padding-right","padding-top","page-break-after","page-break-before","page-break-inside","perspective","perspective-origin","pointer-events","position","quotes","resize","right","tab-size","table-layout","text-align","text-align-last","text-decoration","text-decoration-color","text-decoration-line","text-decoration-style","text-indent","text-overflow","text-rendering","text-shadow","text-transform","text-underline-position","top","transform","transform-origin","transform-style","transition","transition-delay","transition-duration","transition-property","transition-timing-function","unicode-bidi","vertical-align","visibility","white-space","widows","width","word-break","word-spacing","word-wrap","z-index"],i=["\\{","\\}","\\?","(\\bReturn\\b)","(\\bEnd\\b)","(\\bend\\b)",";","#\\s","\\*\\s","===\\s","\\|","%"]; +return{aliases:["styl"],case_insensitive:!1,illegal:"("+i.join("|")+")",keywords:"if else for in",contains:[a.QUOTE_STRING_MODE,a.APOS_STRING_MODE,a.C_LINE_COMMENT_MODE,a.C_BLOCK_COMMENT_MODE,c,{begin:"\\.[a-zA-Z][a-zA-Z0-9_-]*"+g,returnBegin:!0,contains:[{className:"class",begin:"\\.[a-zA-Z][a-zA-Z0-9_-]*"}]},{begin:"\\#[a-zA-Z][a-zA-Z0-9_-]*"+g,returnBegin:!0,contains:[{className:"id",begin:"\\#[a-zA-Z][a-zA-Z0-9_-]*"}]},{begin:"\\b("+f.join("|")+")"+g,returnBegin:!0,contains:[{className:"tag",begin:"\\b[a-zA-Z][a-zA-Z0-9_-]*"}]},{className:"pseudo",begin:"&?:?:\\b("+e.join("|")+")"+g},{className:"at_rule",begin:"@("+d.join("|")+")\\b"},b,a.CSS_NUMBER_MODE,a.NUMBER_MODE,{className:"function",begin:"\\b[a-zA-Z][a-zA-Z0-9_-]*\\(.*\\)",illegal:"[\\n]",returnBegin:!0,contains:[{className:"title",begin:"\\b[a-zA-Z][a-zA-Z0-9_-]*"},{className:"params",begin:/\(/,end:/\)/,contains:[c,b,a.APOS_STRING_MODE,a.CSS_NUMBER_MODE,a.NUMBER_MODE,a.QUOTE_STRING_MODE]}]},{className:"attribute",begin:"\\b("+h.reverse().join("|")+")\\b"}]}}),a.registerLanguage("swift",function(a){var b={keyword:"__COLUMN__ __FILE__ __FUNCTION__ __LINE__ as as! as? associativity break case catch class continue convenience default defer deinit didSet do dynamic dynamicType else enum extension fallthrough false final for func get guard if import in indirect infix init inout internal is lazy left let mutating nil none nonmutating operator optional override postfix precedence prefix private protocol Protocol public repeat required rethrows return right self Self set static struct subscript super switch throw throws true try try! try? Type typealias unowned var weak where while willSet",literal:"true false nil",built_in:"abs advance alignof alignofValue anyGenerator assert assertionFailure bridgeFromObjectiveC bridgeFromObjectiveCUnconditional bridgeToObjectiveC bridgeToObjectiveCUnconditional c contains count countElements countLeadingZeros debugPrint debugPrintln distance dropFirst dropLast dump encodeBitsAsWords enumerate equal fatalError filter find getBridgedObjectiveCType getVaList indices insertionSort isBridgedToObjectiveC isBridgedVerbatimToObjectiveC isUniquelyReferenced isUniquelyReferencedNonObjC join lazy lexicographicalCompare map max maxElement min minElement numericCast overlaps partition posix precondition preconditionFailure print println quickSort readLine reduce reflect reinterpretCast reverse roundUpToAlignment sizeof sizeofValue sort split startsWith stride strideof strideofValue swap toString transcode underestimateCount unsafeAddressOf unsafeBitCast unsafeDowncast unsafeUnwrap unsafeReflect withExtendedLifetime withObjectAtPlusZero withUnsafePointer withUnsafePointerToObject withUnsafeMutablePointer withUnsafeMutablePointers withUnsafePointer withUnsafePointers withVaList zip"},c={className:"type",begin:"\\b[A-Z][\\w']*",relevance:0},d=a.COMMENT("/\\*","\\*/",{contains:["self"]}),e={className:"subst",begin:/\\\(/,end:"\\)",keywords:b,contains:[]},f={className:"number",begin:"\\b([\\d_]+(\\.[\\deE_]+)?|0x[a-fA-F0-9_]+(\\.[a-fA-F0-9p_]+)?|0b[01_]+|0o[0-7_]+)\\b",relevance:0},g=a.inherit(a.QUOTE_STRING_MODE,{contains:[e,a.BACKSLASH_ESCAPE]});return e.contains=[f],{keywords:b,contains:[g,a.C_LINE_COMMENT_MODE,d,c,f,{className:"func",beginKeywords:"func",end:"{",excludeEnd:!0,contains:[a.inherit(a.TITLE_MODE,{begin:/[A-Za-z$_][0-9A-Za-z$_]*/,illegal:/\(/}),{className:"generics",begin://,illegal:/>/},{className:"params",begin:/\(/,end:/\)/,endsParent:!0,keywords:b,contains:["self",f,g,a.C_BLOCK_COMMENT_MODE,{begin:":"}],illegal:/["']/}],illegal:/\[|%/},{className:"class",beginKeywords:"struct protocol class extension enum",keywords:b,end:"\\{",excludeEnd:!0,contains:[a.inherit(a.TITLE_MODE,{begin:/[A-Za-z$_][0-9A-Za-z$_]*/})]},{className:"preprocessor",begin:"(@warn_unused_result|@exported|@lazy|@noescape|@NSCopying|@NSManaged|@objc|@convention|@required|@noreturn|@IBAction|@IBDesignable|@IBInspectable|@IBOutlet|@infix|@prefix|@postfix|@autoclosure|@testable|@available|@nonobjc|@NSApplicationMain|@UIApplicationMain)"},{beginKeywords:"import",end:/$/,contains:[a.C_LINE_COMMENT_MODE,d]}]}}),a.registerLanguage("tcl",function(a){return{aliases:["tk"],keywords:"after append apply array auto_execok auto_import auto_load auto_mkindex auto_mkindex_old auto_qualify auto_reset bgerror binary break catch cd chan clock close concat continue dde dict encoding eof error eval exec exit expr fblocked fconfigure fcopy file fileevent filename flush for foreach format gets glob global history http if incr info interp join lappend|10 lassign|10 lindex|10 linsert|10 list llength|10 load lrange|10 lrepeat|10 lreplace|10 lreverse|10 lsearch|10 lset|10 lsort|10 mathfunc mathop memory msgcat namespace open package parray pid pkg::create pkg_mkIndex platform platform::shell proc puts pwd read refchan regexp registry regsub|10 rename return safe scan seek set socket source split string subst switch tcl_endOfWord tcl_findLibrary tcl_startOfNextWord tcl_startOfPreviousWord tcl_wordBreakAfter tcl_wordBreakBefore tcltest tclvars tell time tm trace unknown unload unset update uplevel upvar variable vwait while",contains:[a.COMMENT(";[ \\t]*#","$"),a.COMMENT("^[ \\t]*#","$"),{beginKeywords:"proc",end:"[\\{]",excludeEnd:!0,contains:[{className:"symbol",begin:"[ \\t\\n\\r]+(::)?[a-zA-Z_]((::)?[a-zA-Z0-9_])*",end:"[ \\t\\n\\r]",endsWithParent:!0,excludeEnd:!0}]},{className:"variable",excludeEnd:!0,variants:[{begin:"\\$(\\{)?(::)?[a-zA-Z_]((::)?[a-zA-Z0-9_])*\\(([a-zA-Z0-9_])*\\)",end:"[^a-zA-Z0-9_\\}\\$]"},{begin:"\\$(\\{)?(::)?[a-zA-Z_]((::)?[a-zA-Z0-9_])*",end:"(\\))?[^a-zA-Z0-9_\\}\\$]"}]},{className:"string",contains:[a.BACKSLASH_ESCAPE],variants:[a.inherit(a.APOS_STRING_MODE,{illegal:null}),a.inherit(a.QUOTE_STRING_MODE,{illegal:null})]},{className:"number",variants:[a.BINARY_NUMBER_MODE,a.C_NUMBER_MODE]}]}}),a.registerLanguage("tex",function(a){var b={className:"command",begin:"\\\\[a-zA-Zа-яА-я]+[\\*]?"},c={className:"command",begin:"\\\\[^a-zA-Zа-яА-я0-9]"},d={className:"special",begin:"[{}\\[\\]\\&#~]",relevance:0};return{contains:[{begin:"\\\\[a-zA-Zа-яА-я]+[\\*]? *= *-?\\d*\\.?\\d+(pt|pc|mm|cm|in|dd|cc|ex|em)?",returnBegin:!0,contains:[b,c,{className:"number",begin:" *=",end:"-?\\d*\\.?\\d+(pt|pc|mm|cm|in|dd|cc|ex|em)?",excludeBegin:!0}],relevance:10},b,c,d,{className:"formula",begin:"\\$\\$",end:"\\$\\$",contains:[b,c,d],relevance:0},{className:"formula",begin:"\\$",end:"\\$",contains:[b,c,d],relevance:0},a.COMMENT("%","$",{relevance:0})]}}),a.registerLanguage("thrift",function(a){var b="bool byte i16 i32 i64 double string binary";return{keywords:{keyword:"namespace const typedef struct enum service exception void oneway set list map required optional",built_in:b,literal:"true false"},contains:[a.QUOTE_STRING_MODE,a.NUMBER_MODE,a.C_LINE_COMMENT_MODE,a.C_BLOCK_COMMENT_MODE,{className:"class",beginKeywords:"struct enum service exception",end:/\{/,illegal:/\n/,contains:[a.inherit(a.TITLE_MODE,{starts:{endsWithParent:!0,excludeEnd:!0}})]},{begin:"\\b(set|list|map)\\s*<",end:">",keywords:b,contains:["self"]}]}}),a.registerLanguage("tp",function(a){var b={className:"number",begin:"[1-9][0-9]*",relevance:0},c={className:"comment",begin:":[^\\]]+"},d={className:"built_in",begin:"(AR|P|PAYLOAD|PR|R|SR|RSR|LBL|VR|UALM|MESSAGE|UTOOL|UFRAME|TIMER| TIMER_OVERFLOW|JOINT_MAX_SPEED|RESUME_PROG|DIAG_REC)\\[",end:"\\]",contains:["self",b,c]},e={className:"built_in",begin:"(AI|AO|DI|DO|F|RI|RO|UI|UO|GI|GO|SI|SO)\\[",end:"\\]",contains:["self",b,a.QUOTE_STRING_MODE,c]};return{keywords:{keyword:"ABORT ACC ADJUST AND AP_LD BREAK CALL CNT COL CONDITION CONFIG DA DB DIV DETECT ELSE END ENDFOR ERR_NUM ERROR_PROG FINE FOR GP GUARD INC IF JMP LINEAR_MAX_SPEED LOCK MOD MONITOR OFFSET Offset OR OVERRIDE PAUSE PREG PTH RT_LD RUN SELECT SKIP Skip TA TB TO TOOL_OFFSET Tool_Offset UF UT UFRAME_NUM UTOOL_NUM UNLOCK WAIT X Y Z W P R STRLEN SUBSTR FINDSTR VOFFSET",constant:"ON OFF max_speed LPOS JPOS ENABLE DISABLE START STOP RESET"},contains:[d,e,{className:"keyword",begin:"/(PROG|ATTR|MN|POS|END)\\b"},{className:"keyword",begin:"(CALL|RUN|POINT_LOGIC|LBL)\\b"},{className:"keyword",begin:"\\b(ACC|CNT|Skip|Offset|PSPD|RT_LD|AP_LD|Tool_Offset)"},{className:"number",begin:"\\d+(sec|msec|mm/sec|cm/min|inch/min|deg/sec|mm|in|cm)?\\b",relevance:0},a.COMMENT("//","[;$]"),a.COMMENT("!","[;$]"),a.COMMENT("--eg:","$"),a.QUOTE_STRING_MODE,{className:"string",begin:"'",end:"'"},a.C_NUMBER_MODE,{className:"variable",begin:"\\$[A-Za-z0-9_]+"}]}}),a.registerLanguage("twig",function(a){var b={className:"params",begin:"\\(",end:"\\)"},c="attribute block constant cycle date dump include max min parent random range source template_from_string",d={className:"function",beginKeywords:c,relevance:0,contains:[b]},e={className:"filter",begin:/\|[A-Za-z_]+:?/,keywords:"abs batch capitalize convert_encoding date date_modify default escape first format join json_encode keys last length lower merge nl2br number_format raw replace reverse round slice sort split striptags title trim upper url_encode",contains:[d]},f="autoescape block do embed extends filter flush for if import include macro sandbox set spaceless use verbatim";return f=f+" "+f.split(" ").map(function(a){return"end"+a}).join(" "),{aliases:["craftcms"],case_insensitive:!0,subLanguage:"xml",contains:[a.COMMENT(/\{#/,/#}/),{className:"template_tag",begin:/\{%/,end:/%}/,keywords:f,contains:[e,d]},{className:"variable",begin:/\{\{/,end:/}}/,contains:[e,d]}]}}),a.registerLanguage("typescript",function(a){var b={keyword:"in if for while finally var new function|0 do return void else break catch instanceof with throw case default try this switch continue typeof delete let yield const class public private protected get set super static implements enum export import declare type namespace abstract",literal:"true false null undefined NaN Infinity",built_in:"eval isFinite isNaN parseFloat parseInt decodeURI decodeURIComponent encodeURI encodeURIComponent escape unescape Object Function Boolean Error EvalError InternalError RangeError ReferenceError StopIteration SyntaxError TypeError URIError Number Math Date String RegExp Array Float32Array Float64Array Int16Array Int32Array Int8Array Uint16Array Uint32Array Uint8Array Uint8ClampedArray ArrayBuffer DataView JSON Intl arguments require module console window document any number boolean string void"};return{aliases:["ts"],keywords:b,contains:[{className:"pi",begin:/^\s*['"]use strict['"]/,relevance:0},a.APOS_STRING_MODE,a.QUOTE_STRING_MODE,a.C_LINE_COMMENT_MODE,a.C_BLOCK_COMMENT_MODE,{className:"number",variants:[{begin:"\\b(0[bB][01]+)"},{begin:"\\b(0[oO][0-7]+)"},{begin:a.C_NUMBER_RE}],relevance:0},{begin:"("+a.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",contains:[a.C_LINE_COMMENT_MODE,a.C_BLOCK_COMMENT_MODE,a.REGEXP_MODE],relevance:0},{className:"function",begin:"function",end:/[\{;]/,excludeEnd:!0,keywords:b,contains:["self",a.inherit(a.TITLE_MODE,{begin:/[A-Za-z$_][0-9A-Za-z$_]*/}),{className:"params",begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:b,contains:[a.C_LINE_COMMENT_MODE,a.C_BLOCK_COMMENT_MODE],illegal:/["'\(]/}],illegal:/\[|%/,relevance:0},{className:"constructor",beginKeywords:"constructor",end:/\{/,excludeEnd:!0,relevance:10},{className:"module",beginKeywords:"module",end:/\{/,excludeEnd:!0},{className:"interface",beginKeywords:"interface",end:/\{/,excludeEnd:!0,keywords:"interface extends"},{begin:/\$[(.]/},{begin:"\\."+a.IDENT_RE,relevance:0}]}}),a.registerLanguage("vala",function(a){return{keywords:{keyword:"char uchar unichar int uint long ulong short ushort int8 int16 int32 int64 uint8 uint16 uint32 uint64 float double bool struct enum string void weak unowned owned async signal static abstract interface override while do for foreach else switch case break default return try catch public private protected internal using new this get set const stdout stdin stderr var",built_in:"DBus GLib CCode Gee Object",literal:"false true null"},contains:[{className:"class",beginKeywords:"class interface delegate namespace",end:"{",excludeEnd:!0,illegal:"[^,:\\n\\s\\.]",contains:[a.UNDERSCORE_TITLE_MODE]},a.C_LINE_COMMENT_MODE,a.C_BLOCK_COMMENT_MODE,{className:"string",begin:'"""',end:'"""',relevance:5},a.APOS_STRING_MODE,a.QUOTE_STRING_MODE,a.C_NUMBER_MODE,{className:"preprocessor",begin:"^#",end:"$",relevance:2},{className:"constant",begin:" [A-Z_]+ ",relevance:0}]}}),a.registerLanguage("vbnet",function(a){return{aliases:["vb"],case_insensitive:!0,keywords:{keyword:"addhandler addressof alias and andalso aggregate ansi as assembly auto binary by byref byval call case catch class compare const continue custom declare default delegate dim distinct do each equals else elseif end enum erase error event exit explicit finally for friend from function get global goto group handles if implements imports in inherits interface into is isfalse isnot istrue join key let lib like loop me mid mod module mustinherit mustoverride mybase myclass namespace narrowing new next not notinheritable notoverridable of off on operator option optional or order orelse overloads overridable overrides paramarray partial preserve private property protected public raiseevent readonly redim rem removehandler resume return select set shadows shared skip static step stop structure strict sub synclock take text then throw to try unicode until using when where while widening with withevents writeonly xor",built_in:"boolean byte cbool cbyte cchar cdate cdec cdbl char cint clng cobj csbyte cshort csng cstr ctype date decimal directcast double gettype getxmlnamespace iif integer long object sbyte short single string trycast typeof uinteger ulong ushort",literal:"true false nothing"},illegal:"//|{|}|endif|gosub|variant|wend",contains:[a.inherit(a.QUOTE_STRING_MODE,{contains:[{begin:'""'}]}),a.COMMENT("'","$",{returnBegin:!0,contains:[{className:"xmlDocTag",begin:"'''|",contains:[a.PHRASAL_WORDS_MODE]},{className:"xmlDocTag",begin:"",contains:[a.PHRASAL_WORDS_MODE]}]}),a.C_NUMBER_MODE,{className:"preprocessor",begin:"#",end:"$",keywords:"if else elseif end region externalsource"}]}}),a.registerLanguage("vbscript",function(a){return{aliases:["vbs"],case_insensitive:!0,keywords:{keyword:"call class const dim do loop erase execute executeglobal exit for each next function if then else on error option explicit new private property let get public randomize redim rem select case set stop sub while wend with end to elseif is or xor and not class_initialize class_terminate default preserve in me byval byref step resume goto",built_in:"lcase month vartype instrrev ubound setlocale getobject rgb getref string weekdayname rnd dateadd monthname now day minute isarray cbool round formatcurrency conversions csng timevalue second year space abs clng timeserial fixs len asc isempty maths dateserial atn timer isobject filter weekday datevalue ccur isdate instr datediff formatdatetime replace isnull right sgn array snumeric log cdbl hex chr lbound msgbox ucase getlocale cos cdate cbyte rtrim join hour oct typename trim strcomp int createobject loadpicture tan formatnumber mid scriptenginebuildversion scriptengine split scriptengineminorversion cint sin datepart ltrim sqr scriptenginemajorversion time derived eval date formatpercent exp inputbox left ascw chrw regexp server response request cstr err",literal:"true false null nothing empty"},illegal:"//",contains:[a.inherit(a.QUOTE_STRING_MODE,{contains:[{begin:'""'}]}),a.COMMENT(/'/,/$/,{relevance:0}),a.C_NUMBER_MODE]}}),a.registerLanguage("vbscript-html",function(a){return{subLanguage:"xml",contains:[{begin:"<%",end:"%>",subLanguage:"vbscript"}]}}),a.registerLanguage("verilog",function(a){return{aliases:["v"],case_insensitive:!0,keywords:{keyword:"always and assign begin buf bufif0 bufif1 case casex casez cmos deassign default defparam disable edge else end endcase endfunction endmodule endprimitive endspecify endtable endtask event for force forever fork function if ifnone initial inout input join macromodule module nand negedge nmos nor not notif0 notif1 or output parameter pmos posedge primitive pulldown pullup rcmos release repeat rnmos rpmos rtran rtranif0 rtranif1 specify specparam table task timescale tran tranif0 tranif1 wait while xnor xor",typename:"highz0 highz1 integer large medium pull0 pull1 real realtime reg scalared signed small strong0 strong1 supply0 supply0 supply1 supply1 time tri tri0 tri1 triand trior trireg vectored wand weak0 weak1 wire wor"},contains:[a.C_BLOCK_COMMENT_MODE,a.C_LINE_COMMENT_MODE,a.QUOTE_STRING_MODE,{className:"number",begin:"\\b(\\d+'(b|h|o|d|B|H|O|D))?[0-9xzXZ]+",contains:[a.BACKSLASH_ESCAPE],relevance:0},{className:"typename",begin:"\\.\\w+",relevance:0},{className:"value",begin:"#\\((?!parameter).+\\)"},{className:"keyword",begin:"\\+|-|\\*|/|%|<|>|=|#|`|\\!|&|\\||@|:|\\^|~|\\{|\\}",relevance:0}]}}),a.registerLanguage("vhdl",function(a){var b="\\d(_|\\d)*",c="[eE][-+]?"+b,d=b+"(\\."+b+")?("+c+")?",e="\\w+",f=b+"#"+e+"(\\."+e+")?#("+c+")?",g="\\b("+f+"|"+d+")";return{case_insensitive:!0,keywords:{keyword:"abs access after alias all and architecture array assert attribute begin block body buffer bus case component configuration constant context cover disconnect downto default else elsif end entity exit fairness file for force function generate generic group guarded if impure in inertial inout is label library linkage literal loop map mod nand new next nor not null of on open or others out package port postponed procedure process property protected pure range record register reject release rem report restrict restrict_guarantee return rol ror select sequence severity shared signal sla sll sra srl strong subtype then to transport type unaffected units until use variable vmode vprop vunit wait when while with xnor xor",typename:"boolean bit character severity_level integer time delay_length natural positive string bit_vector file_open_kind file_open_status std_ulogic std_ulogic_vector std_logic std_logic_vector unsigned signed boolean_vector integer_vector real_vector time_vector"},illegal:"{",contains:[a.C_BLOCK_COMMENT_MODE,a.COMMENT("--","$"),a.QUOTE_STRING_MODE,{className:"number",begin:g,relevance:0},{className:"literal",begin:"'(U|X|0|1|Z|W|L|H|-)'",contains:[a.BACKSLASH_ESCAPE]},{className:"attribute",begin:"'[A-Za-z](_?[A-Za-z0-9])*",contains:[a.BACKSLASH_ESCAPE]}]}}),a.registerLanguage("vim",function(a){return{lexemes:/[!#@\w]+/,keywords:{keyword:"N|0 P|0 X|0 a|0 ab abc abo al am an|0 ar arga argd arge argdo argg argl argu as au aug aun b|0 bN ba bad bd be bel bf bl bm bn bo bp br brea breaka breakd breakl bro bufdo buffers bun bw c|0 cN cNf ca cabc caddb cad caddf cal cat cb cc ccl cd ce cex cf cfir cgetb cgete cg changes chd che checkt cl cla clo cm cmapc cme cn cnew cnf cno cnorea cnoreme co col colo com comc comp con conf cope cp cpf cq cr cs cst cu cuna cunme cw d|0 delm deb debugg delc delf dif diffg diffo diffp diffpu diffs diffthis dig di dl dell dj dli do doautoa dp dr ds dsp e|0 ea ec echoe echoh echom echon el elsei em en endfo endf endt endw ene ex exe exi exu f|0 files filet fin fina fini fir fix fo foldc foldd folddoc foldo for fu g|0 go gr grepa gu gv ha h|0 helpf helpg helpt hi hid his i|0 ia iabc if ij il im imapc ime ino inorea inoreme int is isp iu iuna iunme j|0 ju k|0 keepa kee keepj lN lNf l|0 lad laddb laddf la lan lat lb lc lch lcl lcs le lefta let lex lf lfir lgetb lgete lg lgr lgrepa lh ll lla lli lmak lm lmapc lne lnew lnf ln loadk lo loc lockv lol lope lp lpf lr ls lt lu lua luad luaf lv lvimgrepa lw m|0 ma mak map mapc marks mat me menut mes mk mks mksp mkv mkvie mod mz mzf nbc nb nbs n|0 new nm nmapc nme nn nnoreme noa no noh norea noreme norm nu nun nunme ol o|0 om omapc ome on ono onoreme opt ou ounme ow p|0 profd prof pro promptr pc ped pe perld po popu pp pre prev ps pt ptN ptf ptj ptl ptn ptp ptr pts pu pw py3 python3 py3d py3f py pyd pyf q|0 quita qa r|0 rec red redi redr redraws reg res ret retu rew ri rightb rub rubyd rubyf rund ru rv s|0 sN san sa sal sav sb sbN sba sbf sbl sbm sbn sbp sbr scrip scripte scs se setf setg setl sf sfir sh sim sig sil sl sla sm smap smapc sme sn sni sno snor snoreme sor so spelld spe spelli spellr spellu spellw sp spr sre st sta startg startr star stopi stj sts sun sunm sunme sus sv sw sy synti sync t|0 tN tabN tabc tabdo tabe tabf tabfir tabl tabm tabnew tabn tabo tabp tabr tabs tab ta tags tc tcld tclf te tf th tj tl tm tn to tp tr try ts tu u|0 undoj undol una unh unl unlo unm unme uns up v|0 ve verb vert vim vimgrepa vi viu vie vm vmapc vme vne vn vnoreme vs vu vunme windo w|0 wN wa wh wi winc winp wn wp wq wqa ws wu wv x|0 xa xmapc xm xme xn xnoreme xu xunme y|0 z|0 ~ Next Print append abbreviate abclear aboveleft all amenu anoremenu args argadd argdelete argedit argglobal arglocal argument ascii autocmd augroup aunmenu buffer bNext ball badd bdelete behave belowright bfirst blast bmodified bnext botright bprevious brewind break breakadd breakdel breaklist browse bunload bwipeout change cNext cNfile cabbrev cabclear caddbuffer caddexpr caddfile call catch cbuffer cclose center cexpr cfile cfirst cgetbuffer cgetexpr cgetfile chdir checkpath checktime clist clast close cmap cmapclear cmenu cnext cnewer cnfile cnoremap cnoreabbrev cnoremenu copy colder colorscheme command comclear compiler continue confirm copen cprevious cpfile cquit crewind cscope cstag cunmap cunabbrev cunmenu cwindow delete delmarks debug debuggreedy delcommand delfunction diffupdate diffget diffoff diffpatch diffput diffsplit digraphs display deletel djump dlist doautocmd doautoall deletep drop dsearch dsplit edit earlier echo echoerr echohl echomsg else elseif emenu endif endfor endfunction endtry endwhile enew execute exit exusage file filetype find finally finish first fixdel fold foldclose folddoopen folddoclosed foldopen function global goto grep grepadd gui gvim hardcopy help helpfind helpgrep helptags highlight hide history insert iabbrev iabclear ijump ilist imap imapclear imenu inoremap inoreabbrev inoremenu intro isearch isplit iunmap iunabbrev iunmenu join jumps keepalt keepmarks keepjumps lNext lNfile list laddexpr laddbuffer laddfile last language later lbuffer lcd lchdir lclose lcscope left leftabove lexpr lfile lfirst lgetbuffer lgetexpr lgetfile lgrep lgrepadd lhelpgrep llast llist lmake lmap lmapclear lnext lnewer lnfile lnoremap loadkeymap loadview lockmarks lockvar lolder lopen lprevious lpfile lrewind ltag lunmap luado luafile lvimgrep lvimgrepadd lwindow move mark make mapclear match menu menutranslate messages mkexrc mksession mkspell mkvimrc mkview mode mzscheme mzfile nbclose nbkey nbsart next nmap nmapclear nmenu nnoremap nnoremenu noautocmd noremap nohlsearch noreabbrev noremenu normal number nunmap nunmenu oldfiles open omap omapclear omenu only onoremap onoremenu options ounmap ounmenu ownsyntax print profdel profile promptfind promptrepl pclose pedit perl perldo pop popup ppop preserve previous psearch ptag ptNext ptfirst ptjump ptlast ptnext ptprevious ptrewind ptselect put pwd py3do py3file python pydo pyfile quit quitall qall read recover redo redir redraw redrawstatus registers resize retab return rewind right rightbelow ruby rubydo rubyfile rundo runtime rviminfo substitute sNext sandbox sargument sall saveas sbuffer sbNext sball sbfirst sblast sbmodified sbnext sbprevious sbrewind scriptnames scriptencoding scscope set setfiletype setglobal setlocal sfind sfirst shell simalt sign silent sleep slast smagic smapclear smenu snext sniff snomagic snoremap snoremenu sort source spelldump spellgood spellinfo spellrepall spellundo spellwrong split sprevious srewind stop stag startgreplace startreplace startinsert stopinsert stjump stselect sunhide sunmap sunmenu suspend sview swapname syntax syntime syncbind tNext tabNext tabclose tabedit tabfind tabfirst tablast tabmove tabnext tabonly tabprevious tabrewind tag tcl tcldo tclfile tearoff tfirst throw tjump tlast tmenu tnext topleft tprevious trewind tselect tunmenu undo undojoin undolist unabbreviate unhide unlet unlockvar unmap unmenu unsilent update vglobal version verbose vertical vimgrep vimgrepadd visual viusage view vmap vmapclear vmenu vnew vnoremap vnoremenu vsplit vunmap vunmenu write wNext wall while winsize wincmd winpos wnext wprevious wqall wsverb wundo wviminfo xit xall xmapclear xmap xmenu xnoremap xnoremenu xunmap xunmenu yank",built_in:"abs acos add and append argc argidx argv asin atan atan2 browse browsedir bufexists buflisted bufloaded bufname bufnr bufwinnr byte2line byteidx call ceil changenr char2nr cindent clearmatches col complete complete_add complete_check confirm copy cos cosh count cscope_connection cursor deepcopy delete did_filetype diff_filler diff_hlID empty escape eval eventhandler executable exists exp expand extend feedkeys filereadable filewritable filter finddir findfile float2nr floor fmod fnameescape fnamemodify foldclosed foldclosedend foldlevel foldtext foldtextresult foreground function garbagecollect get getbufline getbufvar getchar getcharmod getcmdline getcmdpos getcmdtype getcwd getfontname getfperm getfsize getftime getftype getline getloclist getmatches getpid getpos getqflist getreg getregtype gettabvar gettabwinvar getwinposx getwinposy getwinvar glob globpath has has_key haslocaldir hasmapto histadd histdel histget histnr hlexists hlID hostname iconv indent index input inputdialog inputlist inputrestore inputsave inputsecret insert invert isdirectory islocked items join keys len libcall libcallnr line line2byte lispindent localtime log log10 luaeval map maparg mapcheck match matchadd matcharg matchdelete matchend matchlist matchstr max min mkdir mode mzeval nextnonblank nr2char or pathshorten pow prevnonblank printf pumvisible py3eval pyeval range readfile reltime reltimestr remote_expr remote_foreground remote_peek remote_read remote_send remove rename repeat resolve reverse round screenattr screenchar screencol screenrow search searchdecl searchpair searchpairpos searchpos server2client serverlist setbufvar setcmdpos setline setloclist setmatches setpos setqflist setreg settabvar settabwinvar setwinvar sha256 shellescape shiftwidth simplify sin sinh sort soundfold spellbadword spellsuggest split sqrt str2float str2nr strchars strdisplaywidth strftime stridx string strlen strpart strridx strtrans strwidth submatch substitute synconcealed synID synIDattr synIDtrans synstack system tabpagebuflist tabpagenr tabpagewinnr tagfiles taglist tan tanh tempname tolower toupper tr trunc type undofile undotree values virtcol visualmode wildmenumode winbufnr wincol winheight winline winnr winrestcmd winrestview winsaveview winwidth writefile xor"},illegal:/[{:]/,contains:[a.NUMBER_MODE,a.APOS_STRING_MODE,{className:"string",begin:/"((\\")|[^"\n])*("|\n)/},{className:"variable",begin:/[bwtglsav]:[\w\d_]*/},{className:"function",beginKeywords:"function function!",end:"$",relevance:0,contains:[a.TITLE_MODE,{className:"params",begin:"\\(",end:"\\)"}]}]}}),a.registerLanguage("x86asm",function(a){return{case_insensitive:!0,lexemes:"\\.?"+a.IDENT_RE,keywords:{keyword:"lock rep repe repz repne repnz xaquire xrelease bnd nobnd aaa aad aam aas adc add and arpl bb0_reset bb1_reset bound bsf bsr bswap bt btc btr bts call cbw cdq cdqe clc cld cli clts cmc cmp cmpsb cmpsd cmpsq cmpsw cmpxchg cmpxchg486 cmpxchg8b cmpxchg16b cpuid cpu_read cpu_write cqo cwd cwde daa das dec div dmint emms enter equ f2xm1 fabs fadd faddp fbld fbstp fchs fclex fcmovb fcmovbe fcmove fcmovnb fcmovnbe fcmovne fcmovnu fcmovu fcom fcomi fcomip fcomp fcompp fcos fdecstp fdisi fdiv fdivp fdivr fdivrp femms feni ffree ffreep fiadd ficom ficomp fidiv fidivr fild fimul fincstp finit fist fistp fisttp fisub fisubr fld fld1 fldcw fldenv fldl2e fldl2t fldlg2 fldln2 fldpi fldz fmul fmulp fnclex fndisi fneni fninit fnop fnsave fnstcw fnstenv fnstsw fpatan fprem fprem1 fptan frndint frstor fsave fscale fsetpm fsin fsincos fsqrt fst fstcw fstenv fstp fstsw fsub fsubp fsubr fsubrp ftst fucom fucomi fucomip fucomp fucompp fxam fxch fxtract fyl2x fyl2xp1 hlt ibts icebp idiv imul in inc incbin insb insd insw int int01 int1 int03 int3 into invd invpcid invlpg invlpga iret iretd iretq iretw jcxz jecxz jrcxz jmp jmpe lahf lar lds lea leave les lfence lfs lgdt lgs lidt lldt lmsw loadall loadall286 lodsb lodsd lodsq lodsw loop loope loopne loopnz loopz lsl lss ltr mfence monitor mov movd movq movsb movsd movsq movsw movsx movsxd movzx mul mwait neg nop not or out outsb outsd outsw packssdw packsswb packuswb paddb paddd paddsb paddsiw paddsw paddusb paddusw paddw pand pandn pause paveb pavgusb pcmpeqb pcmpeqd pcmpeqw pcmpgtb pcmpgtd pcmpgtw pdistib pf2id pfacc pfadd pfcmpeq pfcmpge pfcmpgt pfmax pfmin pfmul pfrcp pfrcpit1 pfrcpit2 pfrsqit1 pfrsqrt pfsub pfsubr pi2fd pmachriw pmaddwd pmagw pmulhriw pmulhrwa pmulhrwc pmulhw pmullw pmvgezb pmvlzb pmvnzb pmvzb pop popa popad popaw popf popfd popfq popfw por prefetch prefetchw pslld psllq psllw psrad psraw psrld psrlq psrlw psubb psubd psubsb psubsiw psubsw psubusb psubusw psubw punpckhbw punpckhdq punpckhwd punpcklbw punpckldq punpcklwd push pusha pushad pushaw pushf pushfd pushfq pushfw pxor rcl rcr rdshr rdmsr rdpmc rdtsc rdtscp ret retf retn rol ror rdm rsdc rsldt rsm rsts sahf sal salc sar sbb scasb scasd scasq scasw sfence sgdt shl shld shr shrd sidt sldt skinit smi smint smintold smsw stc std sti stosb stosd stosq stosw str sub svdc svldt svts swapgs syscall sysenter sysexit sysret test ud0 ud1 ud2b ud2 ud2a umov verr verw fwait wbinvd wrshr wrmsr xadd xbts xchg xlatb xlat xor cmove cmovz cmovne cmovnz cmova cmovnbe cmovae cmovnb cmovb cmovnae cmovbe cmovna cmovg cmovnle cmovge cmovnl cmovl cmovnge cmovle cmovng cmovc cmovnc cmovo cmovno cmovs cmovns cmovp cmovpe cmovnp cmovpo je jz jne jnz ja jnbe jae jnb jb jnae jbe jna jg jnle jge jnl jl jnge jle jng jc jnc jo jno js jns jpo jnp jpe jp sete setz setne setnz seta setnbe setae setnb setnc setb setnae setcset setbe setna setg setnle setge setnl setl setnge setle setng sets setns seto setno setpe setp setpo setnp addps addss andnps andps cmpeqps cmpeqss cmpleps cmpless cmpltps cmpltss cmpneqps cmpneqss cmpnleps cmpnless cmpnltps cmpnltss cmpordps cmpordss cmpunordps cmpunordss cmpps cmpss comiss cvtpi2ps cvtps2pi cvtsi2ss cvtss2si cvttps2pi cvttss2si divps divss ldmxcsr maxps maxss minps minss movaps movhps movlhps movlps movhlps movmskps movntps movss movups mulps mulss orps rcpps rcpss rsqrtps rsqrtss shufps sqrtps sqrtss stmxcsr subps subss ucomiss unpckhps unpcklps xorps fxrstor fxrstor64 fxsave fxsave64 xgetbv xsetbv xsave xsave64 xsaveopt xsaveopt64 xrstor xrstor64 prefetchnta prefetcht0 prefetcht1 prefetcht2 maskmovq movntq pavgb pavgw pextrw pinsrw pmaxsw pmaxub pminsw pminub pmovmskb pmulhuw psadbw pshufw pf2iw pfnacc pfpnacc pi2fw pswapd maskmovdqu clflush movntdq movnti movntpd movdqa movdqu movdq2q movq2dq paddq pmuludq pshufd pshufhw pshuflw pslldq psrldq psubq punpckhqdq punpcklqdq addpd addsd andnpd andpd cmpeqpd cmpeqsd cmplepd cmplesd cmpltpd cmpltsd cmpneqpd cmpneqsd cmpnlepd cmpnlesd cmpnltpd cmpnltsd cmpordpd cmpordsd cmpunordpd cmpunordsd cmppd comisd cvtdq2pd cvtdq2ps cvtpd2dq cvtpd2pi cvtpd2ps cvtpi2pd cvtps2dq cvtps2pd cvtsd2si cvtsd2ss cvtsi2sd cvtss2sd cvttpd2pi cvttpd2dq cvttps2dq cvttsd2si divpd divsd maxpd maxsd minpd minsd movapd movhpd movlpd movmskpd movupd mulpd mulsd orpd shufpd sqrtpd sqrtsd subpd subsd ucomisd unpckhpd unpcklpd xorpd addsubpd addsubps haddpd haddps hsubpd hsubps lddqu movddup movshdup movsldup clgi stgi vmcall vmclear vmfunc vmlaunch vmload vmmcall vmptrld vmptrst vmread vmresume vmrun vmsave vmwrite vmxoff vmxon invept invvpid pabsb pabsw pabsd palignr phaddw phaddd phaddsw phsubw phsubd phsubsw pmaddubsw pmulhrsw pshufb psignb psignw psignd extrq insertq movntsd movntss lzcnt blendpd blendps blendvpd blendvps dppd dpps extractps insertps movntdqa mpsadbw packusdw pblendvb pblendw pcmpeqq pextrb pextrd pextrq phminposuw pinsrb pinsrd pinsrq pmaxsb pmaxsd pmaxud pmaxuw pminsb pminsd pminud pminuw pmovsxbw pmovsxbd pmovsxbq pmovsxwd pmovsxwq pmovsxdq pmovzxbw pmovzxbd pmovzxbq pmovzxwd pmovzxwq pmovzxdq pmuldq pmulld ptest roundpd roundps roundsd roundss crc32 pcmpestri pcmpestrm pcmpistri pcmpistrm pcmpgtq popcnt getsec pfrcpv pfrsqrtv movbe aesenc aesenclast aesdec aesdeclast aesimc aeskeygenassist vaesenc vaesenclast vaesdec vaesdeclast vaesimc vaeskeygenassist vaddpd vaddps vaddsd vaddss vaddsubpd vaddsubps vandpd vandps vandnpd vandnps vblendpd vblendps vblendvpd vblendvps vbroadcastss vbroadcastsd vbroadcastf128 vcmpeq_ospd vcmpeqpd vcmplt_ospd vcmpltpd vcmple_ospd vcmplepd vcmpunord_qpd vcmpunordpd vcmpneq_uqpd vcmpneqpd vcmpnlt_uspd vcmpnltpd vcmpnle_uspd vcmpnlepd vcmpord_qpd vcmpordpd vcmpeq_uqpd vcmpnge_uspd vcmpngepd vcmpngt_uspd vcmpngtpd vcmpfalse_oqpd vcmpfalsepd vcmpneq_oqpd vcmpge_ospd vcmpgepd vcmpgt_ospd vcmpgtpd vcmptrue_uqpd vcmptruepd vcmplt_oqpd vcmple_oqpd vcmpunord_spd vcmpneq_uspd vcmpnlt_uqpd vcmpnle_uqpd vcmpord_spd vcmpeq_uspd vcmpnge_uqpd vcmpngt_uqpd vcmpfalse_ospd vcmpneq_ospd vcmpge_oqpd vcmpgt_oqpd vcmptrue_uspd vcmppd vcmpeq_osps vcmpeqps vcmplt_osps vcmpltps vcmple_osps vcmpleps vcmpunord_qps vcmpunordps vcmpneq_uqps vcmpneqps vcmpnlt_usps vcmpnltps vcmpnle_usps vcmpnleps vcmpord_qps vcmpordps vcmpeq_uqps vcmpnge_usps vcmpngeps vcmpngt_usps vcmpngtps vcmpfalse_oqps vcmpfalseps vcmpneq_oqps vcmpge_osps vcmpgeps vcmpgt_osps vcmpgtps vcmptrue_uqps vcmptrueps vcmplt_oqps vcmple_oqps vcmpunord_sps vcmpneq_usps vcmpnlt_uqps vcmpnle_uqps vcmpord_sps vcmpeq_usps vcmpnge_uqps vcmpngt_uqps vcmpfalse_osps vcmpneq_osps vcmpge_oqps vcmpgt_oqps vcmptrue_usps vcmpps vcmpeq_ossd vcmpeqsd vcmplt_ossd vcmpltsd vcmple_ossd vcmplesd vcmpunord_qsd vcmpunordsd vcmpneq_uqsd vcmpneqsd vcmpnlt_ussd vcmpnltsd vcmpnle_ussd vcmpnlesd vcmpord_qsd vcmpordsd vcmpeq_uqsd vcmpnge_ussd vcmpngesd vcmpngt_ussd vcmpngtsd vcmpfalse_oqsd vcmpfalsesd vcmpneq_oqsd vcmpge_ossd vcmpgesd vcmpgt_ossd vcmpgtsd vcmptrue_uqsd vcmptruesd vcmplt_oqsd vcmple_oqsd vcmpunord_ssd vcmpneq_ussd vcmpnlt_uqsd vcmpnle_uqsd vcmpord_ssd vcmpeq_ussd vcmpnge_uqsd vcmpngt_uqsd vcmpfalse_ossd vcmpneq_ossd vcmpge_oqsd vcmpgt_oqsd vcmptrue_ussd vcmpsd vcmpeq_osss vcmpeqss vcmplt_osss vcmpltss vcmple_osss vcmpless vcmpunord_qss vcmpunordss vcmpneq_uqss vcmpneqss vcmpnlt_usss vcmpnltss vcmpnle_usss vcmpnless vcmpord_qss vcmpordss vcmpeq_uqss vcmpnge_usss vcmpngess vcmpngt_usss vcmpngtss vcmpfalse_oqss vcmpfalsess vcmpneq_oqss vcmpge_osss vcmpgess vcmpgt_osss vcmpgtss vcmptrue_uqss vcmptruess vcmplt_oqss vcmple_oqss vcmpunord_sss vcmpneq_usss vcmpnlt_uqss vcmpnle_uqss vcmpord_sss vcmpeq_usss vcmpnge_uqss vcmpngt_uqss vcmpfalse_osss vcmpneq_osss vcmpge_oqss vcmpgt_oqss vcmptrue_usss vcmpss vcomisd vcomiss vcvtdq2pd vcvtdq2ps vcvtpd2dq vcvtpd2ps vcvtps2dq vcvtps2pd vcvtsd2si vcvtsd2ss vcvtsi2sd vcvtsi2ss vcvtss2sd vcvtss2si vcvttpd2dq vcvttps2dq vcvttsd2si vcvttss2si vdivpd vdivps vdivsd vdivss vdppd vdpps vextractf128 vextractps vhaddpd vhaddps vhsubpd vhsubps vinsertf128 vinsertps vlddqu vldqqu vldmxcsr vmaskmovdqu vmaskmovps vmaskmovpd vmaxpd vmaxps vmaxsd vmaxss vminpd vminps vminsd vminss vmovapd vmovaps vmovd vmovq vmovddup vmovdqa vmovqqa vmovdqu vmovqqu vmovhlps vmovhpd vmovhps vmovlhps vmovlpd vmovlps vmovmskpd vmovmskps vmovntdq vmovntqq vmovntdqa vmovntpd vmovntps vmovsd vmovshdup vmovsldup vmovss vmovupd vmovups vmpsadbw vmulpd vmulps vmulsd vmulss vorpd vorps vpabsb vpabsw vpabsd vpacksswb vpackssdw vpackuswb vpackusdw vpaddb vpaddw vpaddd vpaddq vpaddsb vpaddsw vpaddusb vpaddusw vpalignr vpand vpandn vpavgb vpavgw vpblendvb vpblendw vpcmpestri vpcmpestrm vpcmpistri vpcmpistrm vpcmpeqb vpcmpeqw vpcmpeqd vpcmpeqq vpcmpgtb vpcmpgtw vpcmpgtd vpcmpgtq vpermilpd vpermilps vperm2f128 vpextrb vpextrw vpextrd vpextrq vphaddw vphaddd vphaddsw vphminposuw vphsubw vphsubd vphsubsw vpinsrb vpinsrw vpinsrd vpinsrq vpmaddwd vpmaddubsw vpmaxsb vpmaxsw vpmaxsd vpmaxub vpmaxuw vpmaxud vpminsb vpminsw vpminsd vpminub vpminuw vpminud vpmovmskb vpmovsxbw vpmovsxbd vpmovsxbq vpmovsxwd vpmovsxwq vpmovsxdq vpmovzxbw vpmovzxbd vpmovzxbq vpmovzxwd vpmovzxwq vpmovzxdq vpmulhuw vpmulhrsw vpmulhw vpmullw vpmulld vpmuludq vpmuldq vpor vpsadbw vpshufb vpshufd vpshufhw vpshuflw vpsignb vpsignw vpsignd vpslldq vpsrldq vpsllw vpslld vpsllq vpsraw vpsrad vpsrlw vpsrld vpsrlq vptest vpsubb vpsubw vpsubd vpsubq vpsubsb vpsubsw vpsubusb vpsubusw vpunpckhbw vpunpckhwd vpunpckhdq vpunpckhqdq vpunpcklbw vpunpcklwd vpunpckldq vpunpcklqdq vpxor vrcpps vrcpss vrsqrtps vrsqrtss vroundpd vroundps vroundsd vroundss vshufpd vshufps vsqrtpd vsqrtps vsqrtsd vsqrtss vstmxcsr vsubpd vsubps vsubsd vsubss vtestps vtestpd vucomisd vucomiss vunpckhpd vunpckhps vunpcklpd vunpcklps vxorpd vxorps vzeroall vzeroupper pclmullqlqdq pclmulhqlqdq pclmullqhqdq pclmulhqhqdq pclmulqdq vpclmullqlqdq vpclmulhqlqdq vpclmullqhqdq vpclmulhqhqdq vpclmulqdq vfmadd132ps vfmadd132pd vfmadd312ps vfmadd312pd vfmadd213ps vfmadd213pd vfmadd123ps vfmadd123pd vfmadd231ps vfmadd231pd vfmadd321ps vfmadd321pd vfmaddsub132ps vfmaddsub132pd vfmaddsub312ps vfmaddsub312pd vfmaddsub213ps vfmaddsub213pd vfmaddsub123ps vfmaddsub123pd vfmaddsub231ps vfmaddsub231pd vfmaddsub321ps vfmaddsub321pd vfmsub132ps vfmsub132pd vfmsub312ps vfmsub312pd vfmsub213ps vfmsub213pd vfmsub123ps vfmsub123pd vfmsub231ps vfmsub231pd vfmsub321ps vfmsub321pd vfmsubadd132ps vfmsubadd132pd vfmsubadd312ps vfmsubadd312pd vfmsubadd213ps vfmsubadd213pd vfmsubadd123ps vfmsubadd123pd vfmsubadd231ps vfmsubadd231pd vfmsubadd321ps vfmsubadd321pd vfnmadd132ps vfnmadd132pd vfnmadd312ps vfnmadd312pd vfnmadd213ps vfnmadd213pd vfnmadd123ps vfnmadd123pd vfnmadd231ps vfnmadd231pd vfnmadd321ps vfnmadd321pd vfnmsub132ps vfnmsub132pd vfnmsub312ps vfnmsub312pd vfnmsub213ps vfnmsub213pd vfnmsub123ps vfnmsub123pd vfnmsub231ps vfnmsub231pd vfnmsub321ps vfnmsub321pd vfmadd132ss vfmadd132sd vfmadd312ss vfmadd312sd vfmadd213ss vfmadd213sd vfmadd123ss vfmadd123sd vfmadd231ss vfmadd231sd vfmadd321ss vfmadd321sd vfmsub132ss vfmsub132sd vfmsub312ss vfmsub312sd vfmsub213ss vfmsub213sd vfmsub123ss vfmsub123sd vfmsub231ss vfmsub231sd vfmsub321ss vfmsub321sd vfnmadd132ss vfnmadd132sd vfnmadd312ss vfnmadd312sd vfnmadd213ss vfnmadd213sd vfnmadd123ss vfnmadd123sd vfnmadd231ss vfnmadd231sd vfnmadd321ss vfnmadd321sd vfnmsub132ss vfnmsub132sd vfnmsub312ss vfnmsub312sd vfnmsub213ss vfnmsub213sd vfnmsub123ss vfnmsub123sd vfnmsub231ss vfnmsub231sd vfnmsub321ss vfnmsub321sd rdfsbase rdgsbase rdrand wrfsbase wrgsbase vcvtph2ps vcvtps2ph adcx adox rdseed clac stac xstore xcryptecb xcryptcbc xcryptctr xcryptcfb xcryptofb montmul xsha1 xsha256 llwpcb slwpcb lwpval lwpins vfmaddpd vfmaddps vfmaddsd vfmaddss vfmaddsubpd vfmaddsubps vfmsubaddpd vfmsubaddps vfmsubpd vfmsubps vfmsubsd vfmsubss vfnmaddpd vfnmaddps vfnmaddsd vfnmaddss vfnmsubpd vfnmsubps vfnmsubsd vfnmsubss vfrczpd vfrczps vfrczsd vfrczss vpcmov vpcomb vpcomd vpcomq vpcomub vpcomud vpcomuq vpcomuw vpcomw vphaddbd vphaddbq vphaddbw vphadddq vphaddubd vphaddubq vphaddubw vphaddudq vphadduwd vphadduwq vphaddwd vphaddwq vphsubbw vphsubdq vphsubwd vpmacsdd vpmacsdqh vpmacsdql vpmacssdd vpmacssdqh vpmacssdql vpmacsswd vpmacssww vpmacswd vpmacsww vpmadcsswd vpmadcswd vpperm vprotb vprotd vprotq vprotw vpshab vpshad vpshaq vpshaw vpshlb vpshld vpshlq vpshlw vbroadcasti128 vpblendd vpbroadcastb vpbroadcastw vpbroadcastd vpbroadcastq vpermd vpermpd vpermps vpermq vperm2i128 vextracti128 vinserti128 vpmaskmovd vpmaskmovq vpsllvd vpsllvq vpsravd vpsrlvd vpsrlvq vgatherdpd vgatherqpd vgatherdps vgatherqps vpgatherdd vpgatherqd vpgatherdq vpgatherqq xabort xbegin xend xtest andn bextr blci blcic blsi blsic blcfill blsfill blcmsk blsmsk blsr blcs bzhi mulx pdep pext rorx sarx shlx shrx tzcnt tzmsk t1mskc valignd valignq vblendmpd vblendmps vbroadcastf32x4 vbroadcastf64x4 vbroadcasti32x4 vbroadcasti64x4 vcompresspd vcompressps vcvtpd2udq vcvtps2udq vcvtsd2usi vcvtss2usi vcvttpd2udq vcvttps2udq vcvttsd2usi vcvttss2usi vcvtudq2pd vcvtudq2ps vcvtusi2sd vcvtusi2ss vexpandpd vexpandps vextractf32x4 vextractf64x4 vextracti32x4 vextracti64x4 vfixupimmpd vfixupimmps vfixupimmsd vfixupimmss vgetexppd vgetexpps vgetexpsd vgetexpss vgetmantpd vgetmantps vgetmantsd vgetmantss vinsertf32x4 vinsertf64x4 vinserti32x4 vinserti64x4 vmovdqa32 vmovdqa64 vmovdqu32 vmovdqu64 vpabsq vpandd vpandnd vpandnq vpandq vpblendmd vpblendmq vpcmpltd vpcmpled vpcmpneqd vpcmpnltd vpcmpnled vpcmpd vpcmpltq vpcmpleq vpcmpneqq vpcmpnltq vpcmpnleq vpcmpq vpcmpequd vpcmpltud vpcmpleud vpcmpnequd vpcmpnltud vpcmpnleud vpcmpud vpcmpequq vpcmpltuq vpcmpleuq vpcmpnequq vpcmpnltuq vpcmpnleuq vpcmpuq vpcompressd vpcompressq vpermi2d vpermi2pd vpermi2ps vpermi2q vpermt2d vpermt2pd vpermt2ps vpermt2q vpexpandd vpexpandq vpmaxsq vpmaxuq vpminsq vpminuq vpmovdb vpmovdw vpmovqb vpmovqd vpmovqw vpmovsdb vpmovsdw vpmovsqb vpmovsqd vpmovsqw vpmovusdb vpmovusdw vpmovusqb vpmovusqd vpmovusqw vpord vporq vprold vprolq vprolvd vprolvq vprord vprorq vprorvd vprorvq vpscatterdd vpscatterdq vpscatterqd vpscatterqq vpsraq vpsravq vpternlogd vpternlogq vptestmd vptestmq vptestnmd vptestnmq vpxord vpxorq vrcp14pd vrcp14ps vrcp14sd vrcp14ss vrndscalepd vrndscaleps vrndscalesd vrndscaless vrsqrt14pd vrsqrt14ps vrsqrt14sd vrsqrt14ss vscalefpd vscalefps vscalefsd vscalefss vscatterdpd vscatterdps vscatterqpd vscatterqps vshuff32x4 vshuff64x2 vshufi32x4 vshufi64x2 kandnw kandw kmovw knotw kortestw korw kshiftlw kshiftrw kunpckbw kxnorw kxorw vpbroadcastmb2q vpbroadcastmw2d vpconflictd vpconflictq vplzcntd vplzcntq vexp2pd vexp2ps vrcp28pd vrcp28ps vrcp28sd vrcp28ss vrsqrt28pd vrsqrt28ps vrsqrt28sd vrsqrt28ss vgatherpf0dpd vgatherpf0dps vgatherpf0qpd vgatherpf0qps vgatherpf1dpd vgatherpf1dps vgatherpf1qpd vgatherpf1qps vscatterpf0dpd vscatterpf0dps vscatterpf0qpd vscatterpf0qps vscatterpf1dpd vscatterpf1dps vscatterpf1qpd vscatterpf1qps prefetchwt1 bndmk bndcl bndcu bndcn bndmov bndldx bndstx sha1rnds4 sha1nexte sha1msg1 sha1msg2 sha256rnds2 sha256msg1 sha256msg2 hint_nop0 hint_nop1 hint_nop2 hint_nop3 hint_nop4 hint_nop5 hint_nop6 hint_nop7 hint_nop8 hint_nop9 hint_nop10 hint_nop11 hint_nop12 hint_nop13 hint_nop14 hint_nop15 hint_nop16 hint_nop17 hint_nop18 hint_nop19 hint_nop20 hint_nop21 hint_nop22 hint_nop23 hint_nop24 hint_nop25 hint_nop26 hint_nop27 hint_nop28 hint_nop29 hint_nop30 hint_nop31 hint_nop32 hint_nop33 hint_nop34 hint_nop35 hint_nop36 hint_nop37 hint_nop38 hint_nop39 hint_nop40 hint_nop41 hint_nop42 hint_nop43 hint_nop44 hint_nop45 hint_nop46 hint_nop47 hint_nop48 hint_nop49 hint_nop50 hint_nop51 hint_nop52 hint_nop53 hint_nop54 hint_nop55 hint_nop56 hint_nop57 hint_nop58 hint_nop59 hint_nop60 hint_nop61 hint_nop62 hint_nop63", +literal:"ip eip rip al ah bl bh cl ch dl dh sil dil bpl spl r8b r9b r10b r11b r12b r13b r14b r15b ax bx cx dx si di bp sp r8w r9w r10w r11w r12w r13w r14w r15w eax ebx ecx edx esi edi ebp esp eip r8d r9d r10d r11d r12d r13d r14d r15d rax rbx rcx rdx rsi rdi rbp rsp r8 r9 r10 r11 r12 r13 r14 r15 cs ds es fs gs ss st st0 st1 st2 st3 st4 st5 st6 st7 mm0 mm1 mm2 mm3 mm4 mm5 mm6 mm7 xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8 xmm9 xmm10 xmm11 xmm12 xmm13 xmm14 xmm15 xmm16 xmm17 xmm18 xmm19 xmm20 xmm21 xmm22 xmm23 xmm24 xmm25 xmm26 xmm27 xmm28 xmm29 xmm30 xmm31 ymm0 ymm1 ymm2 ymm3 ymm4 ymm5 ymm6 ymm7 ymm8 ymm9 ymm10 ymm11 ymm12 ymm13 ymm14 ymm15 ymm16 ymm17 ymm18 ymm19 ymm20 ymm21 ymm22 ymm23 ymm24 ymm25 ymm26 ymm27 ymm28 ymm29 ymm30 ymm31 zmm0 zmm1 zmm2 zmm3 zmm4 zmm5 zmm6 zmm7 zmm8 zmm9 zmm10 zmm11 zmm12 zmm13 zmm14 zmm15 zmm16 zmm17 zmm18 zmm19 zmm20 zmm21 zmm22 zmm23 zmm24 zmm25 zmm26 zmm27 zmm28 zmm29 zmm30 zmm31 k0 k1 k2 k3 k4 k5 k6 k7 bnd0 bnd1 bnd2 bnd3 cr0 cr1 cr2 cr3 cr4 cr8 dr0 dr1 dr2 dr3 dr8 tr3 tr4 tr5 tr6 tr7 r0 r1 r2 r3 r4 r5 r6 r7 r0b r1b r2b r3b r4b r5b r6b r7b r0w r1w r2w r3w r4w r5w r6w r7w r0d r1d r2d r3d r4d r5d r6d r7d r0h r1h r2h r3h r0l r1l r2l r3l r4l r5l r6l r7l r8l r9l r10l r11l r12l r13l r14l r15l",pseudo:"db dw dd dq dt ddq do dy dz resb resw resd resq rest resdq reso resy resz incbin equ times",preprocessor:"%define %xdefine %+ %undef %defstr %deftok %assign %strcat %strlen %substr %rotate %elif %else %endif %ifmacro %ifctx %ifidn %ifidni %ifid %ifnum %ifstr %iftoken %ifempty %ifenv %error %warning %fatal %rep %endrep %include %push %pop %repl %pathsearch %depend %use %arg %stacksize %local %line %comment %endcomment .nolist byte word dword qword nosplit rel abs seg wrt strict near far a32 ptr __FILE__ __LINE__ __SECT__ __BITS__ __OUTPUT_FORMAT__ __DATE__ __TIME__ __DATE_NUM__ __TIME_NUM__ __UTC_DATE__ __UTC_TIME__ __UTC_DATE_NUM__ __UTC_TIME_NUM__ __PASS__ struc endstruc istruc at iend align alignb sectalign daz nodaz up down zero default option assume public ",built_in:"bits use16 use32 use64 default section segment absolute extern global common cpu float __utf16__ __utf16le__ __utf16be__ __utf32__ __utf32le__ __utf32be__ __float8__ __float16__ __float32__ __float64__ __float80m__ __float80e__ __float128l__ __float128h__ __Infinity__ __QNaN__ __SNaN__ Inf NaN QNaN SNaN float8 float16 float32 float64 float80m float80e float128l float128h __FLOAT_DAZ__ __FLOAT_ROUND__ __FLOAT__"},contains:[a.COMMENT(";","$",{relevance:0}),{className:"number",variants:[{begin:"\\b(?:([0-9][0-9_]*)?\\.[0-9_]*(?:[eE][+-]?[0-9_]+)?|(0[Xx])?[0-9][0-9_]*\\.?[0-9_]*(?:[pP](?:[+-]?[0-9_]+)?)?)\\b",relevance:0},{begin:"\\$[0-9][0-9A-Fa-f]*",relevance:0},{begin:"\\b(?:[0-9A-Fa-f][0-9A-Fa-f_]*[Hh]|[0-9][0-9_]*[DdTt]?|[0-7][0-7_]*[QqOo]|[0-1][0-1_]*[BbYy])\\b"},{begin:"\\b(?:0[Xx][0-9A-Fa-f_]+|0[DdTt][0-9_]+|0[QqOo][0-7_]+|0[BbYy][0-1_]+)\\b"}]},a.QUOTE_STRING_MODE,{className:"string",variants:[{begin:"'",end:"[^\\\\]'"},{begin:"`",end:"[^\\\\]`"},{begin:"\\.[A-Za-z0-9]+"}],relevance:0},{className:"label",variants:[{begin:"^\\s*[A-Za-z._?][A-Za-z0-9_$#@~.?]*(:|\\s+label)"},{begin:"^\\s*%%[A-Za-z0-9_$#@~.?]*:"}],relevance:0},{className:"argument",begin:"%[0-9]+",relevance:0},{className:"built_in",begin:"%!S+",relevance:0}]}}),a.registerLanguage("xl",function(a){var b="ObjectLoader Animate MovieCredits Slides Filters Shading Materials LensFlare Mapping VLCAudioVideo StereoDecoder PointCloud NetworkAccess RemoteControl RegExp ChromaKey Snowfall NodeJS Speech Charts",c={keyword:"if then else do while until for loop import with is as where when by data constant",literal:"true false nil",type:"integer real text name boolean symbol infix prefix postfix block tree",built_in:"in mod rem and or xor not abs sign floor ceil sqrt sin cos tan asin acos atan exp expm1 log log2 log10 log1p pi at",module:b,id:"text_length text_range text_find text_replace contains page slide basic_slide title_slide title subtitle fade_in fade_out fade_at clear_color color line_color line_width texture_wrap texture_transform texture scale_?x scale_?y scale_?z? translate_?x translate_?y translate_?z? rotate_?x rotate_?y rotate_?z? rectangle circle ellipse sphere path line_to move_to quad_to curve_to theme background contents locally time mouse_?x mouse_?y mouse_buttons"},d={className:"constant",begin:"[A-Z][A-Z_0-9]+",relevance:0},e={className:"variable",begin:"([A-Z][a-z_0-9]+)+",relevance:0},f={className:"id",begin:"[a-z][a-z_0-9]+",relevance:0},g={className:"string",begin:'"',end:'"',illegal:"\\n"},h={className:"string",begin:"'",end:"'",illegal:"\\n"},i={className:"string",begin:"<<",end:">>"},j={className:"number",begin:"[0-9]+#[0-9A-Z_]+(\\.[0-9-A-Z_]+)?#?([Ee][+-]?[0-9]+)?",relevance:10},k={className:"import",beginKeywords:"import",end:"$",keywords:{keyword:"import",module:b},relevance:0,contains:[g]},l={className:"function",begin:"[a-z].*->"};return{aliases:["tao"],lexemes:/[a-zA-Z][a-zA-Z0-9_?]*/,keywords:c,contains:[a.C_LINE_COMMENT_MODE,a.C_BLOCK_COMMENT_MODE,g,h,i,l,k,d,e,f,j,a.NUMBER_MODE]}}),a.registerLanguage("xquery",function(a){var b="for let if while then else return where group by xquery encoding versionmodule namespace boundary-space preserve strip default collation base-uri orderingcopy-namespaces order declare import schema namespace function option in allowing emptyat tumbling window sliding window start when only end when previous next stable ascendingdescending empty greatest least some every satisfies switch case typeswitch try catch andor to union intersect instance of treat as castable cast map array delete insert intoreplace value rename copy modify update",c="false true xs:string xs:integer element item xs:date xs:datetime xs:float xs:double xs:decimal QName xs:anyURI xs:long xs:int xs:short xs:byte attribute",d={className:"variable",begin:/\$[a-zA-Z0-9\-]+/,relevance:5},e={className:"number",begin:"(\\b0[0-7_]+)|(\\b0x[0-9a-fA-F_]+)|(\\b[1-9][0-9_]*(\\.[0-9_]+)?)|[0_]\\b",relevance:0},f={className:"string",variants:[{begin:/"/,end:/"/,contains:[{begin:/""/,relevance:0}]},{begin:/'/,end:/'/,contains:[{begin:/''/,relevance:0}]}]},g={className:"decorator",begin:"%\\w+"},h={className:"comment",begin:"\\(:",end:":\\)",relevance:10,contains:[{className:"doc",begin:"@\\w+"}]},i={begin:"{",end:"}"},j=[d,f,e,h,g,i];return i.contains=j,{aliases:["xpath","xq"],case_insensitive:!1,lexemes:/[a-zA-Z\$][a-zA-Z0-9_:\-]*/,illegal:/(proc)|(abstract)|(extends)|(until)|(#)/,keywords:{keyword:b,literal:c},contains:j}}),a.registerLanguage("zephir",function(a){var b={className:"string",contains:[a.BACKSLASH_ESCAPE],variants:[{begin:'b"',end:'"'},{begin:"b'",end:"'"},a.inherit(a.APOS_STRING_MODE,{illegal:null}),a.inherit(a.QUOTE_STRING_MODE,{illegal:null})]},c={variants:[a.BINARY_NUMBER_MODE,a.C_NUMBER_MODE]};return{aliases:["zep"],case_insensitive:!0,keywords:"and include_once list abstract global private echo interface as static endswitch array null if endwhile or const for endforeach self var let while isset public protected exit foreach throw elseif include __FILE__ empty require_once do xor return parent clone use __CLASS__ __LINE__ else break print eval new catch __METHOD__ case exception default die require __FUNCTION__ enddeclare final try switch continue endfor endif declare unset true false trait goto instanceof insteadof __DIR__ __NAMESPACE__ yield finally int uint long ulong char uchar double float bool boolean stringlikely unlikely",contains:[a.C_LINE_COMMENT_MODE,a.HASH_COMMENT_MODE,a.COMMENT("/\\*","\\*/",{contains:[{className:"doctag",begin:"@[A-Za-z]+"}]}),a.COMMENT("__halt_compiler.+?;",!1,{endsWithParent:!0,keywords:"__halt_compiler",lexemes:a.UNDERSCORE_IDENT_RE}),{className:"string",begin:"<<<['\"]?\\w+['\"]?$",end:"^\\w+;",contains:[a.BACKSLASH_ESCAPE]},{begin:/(::|->)+[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/},{className:"function",beginKeywords:"function",end:/[;{]/,excludeEnd:!0,illegal:"\\$|\\[|%",contains:[a.UNDERSCORE_TITLE_MODE,{className:"params",begin:"\\(",end:"\\)",contains:["self",a.C_BLOCK_COMMENT_MODE,b,c]}]},{className:"class",beginKeywords:"class interface",end:"{",excludeEnd:!0,illegal:/[:\(\$"]/,contains:[{beginKeywords:"extends implements"},a.UNDERSCORE_TITLE_MODE]},{beginKeywords:"namespace",end:";",illegal:/[\.']/,contains:[a.UNDERSCORE_TITLE_MODE]},{beginKeywords:"use",end:";",contains:[a.UNDERSCORE_TITLE_MODE]},{begin:"=>"},b,c]}}),a}),!function(a){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=a();else if("function"==typeof define&&define.amd)define([],a);else{var b;"undefined"!=typeof window?b=window:"undefined"!=typeof global?b=global:"undefined"!=typeof self&&(b=self),b.io=a()}}(function(){var a;return function b(a,c,d){function e(g,h){if(!c[g]){if(!a[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);throw new Error("Cannot find module '"+g+"'")}var j=c[g]={exports:{}};a[g][0].call(j.exports,function(b){var c=a[g][1][b];return e(c?c:b)},j,j.exports,b,a,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g0&&!this.encoding){var a=this.packetBuffer.shift();this.packet(a)}},d.prototype.cleanup=function(){for(var a;a=this.subs.shift();)a.destroy();this.packetBuffer=[],this.encoding=!1,this.decoder.destroy()},d.prototype.close=d.prototype.disconnect=function(){this.skipReconnect=!0,this.backoff.reset(),this.readyState="closed",this.engine&&this.engine.close()},d.prototype.onclose=function(a){k("close"),this.cleanup(),this.backoff.reset(),this.readyState="closed",this.emit("close",a),this._reconnection&&!this.skipReconnect&&this.reconnect()},d.prototype.reconnect=function(){if(this.reconnecting||this.skipReconnect)return this;var a=this;if(this.backoff.attempts>=this._reconnectionAttempts)k("reconnect failed"),this.backoff.reset(),this.emitAll("reconnect_failed"),this.reconnecting=!1;else{var b=this.backoff.duration();k("will wait %dms before reconnect attempt",b),this.reconnecting=!0;var c=setTimeout(function(){a.skipReconnect||(k("attempting reconnect"),a.emitAll("reconnect_attempt",a.backoff.attempts),a.emitAll("reconnecting",a.backoff.attempts),a.skipReconnect||a.open(function(b){b?(k("reconnect attempt error"),a.reconnecting=!1,a.reconnect(),a.emitAll("reconnect_error",b.data)):(k("reconnect success"),a.onreconnect())}))},b);this.subs.push({destroy:function(){clearTimeout(c)}})}},d.prototype.onreconnect=function(){var a=this.backoff.attempts;this.reconnecting=!1,this.backoff.reset(),this.updateSocketIds(),this.emitAll("reconnect",a)}},{"./on":4,"./socket":5,"./url":6,backo2:7,"component-bind":8,"component-emitter":9,debug:10,"engine.io-client":11,indexof:40,"object-component":41,"socket.io-parser":44}],4:[function(a,b,c){function d(a,b,c){return a.on(b,c),{destroy:function(){a.removeListener(b,c)}}}b.exports=d},{}],5:[function(a,b,c){function d(a,b){this.io=a,this.nsp=b,this.json=this,this.ids=0,this.acks={},this.io.autoConnect&&this.open(),this.receiveBuffer=[],this.sendBuffer=[],this.connected=!1,this.disconnected=!0}var e=a("socket.io-parser"),f=a("component-emitter"),g=a("to-array"),h=a("./on"),i=a("component-bind"),j=a("debug")("socket.io-client:socket"),k=a("has-binary");b.exports=c=d;var l={connect:1,connect_error:1,connect_timeout:1,disconnect:1,error:1,reconnect:1,reconnect_attempt:1,reconnect_failed:1,reconnect_error:1,reconnecting:1},m=f.prototype.emit;f(d.prototype),d.prototype.subEvents=function(){if(!this.subs){var a=this.io;this.subs=[h(a,"open",i(this,"onopen")),h(a,"packet",i(this,"onpacket")),h(a,"close",i(this,"onclose"))]}},d.prototype.open=d.prototype.connect=function(){return this.connected?this:(this.subEvents(),this.io.open(),"open"==this.io.readyState&&this.onopen(),this)},d.prototype.send=function(){var a=g(arguments);return a.unshift("message"),this.emit.apply(this,a),this},d.prototype.emit=function(a){if(l.hasOwnProperty(a))return m.apply(this,arguments),this;var b=g(arguments),c=e.EVENT;k(b)&&(c=e.BINARY_EVENT);var d={type:c,data:b};return"function"==typeof b[b.length-1]&&(j("emitting packet with ack id %d",this.ids),this.acks[this.ids]=b.pop(),d.id=this.ids++),this.connected?this.packet(d):this.sendBuffer.push(d),this},d.prototype.packet=function(a){a.nsp=this.nsp,this.io.packet(a)},d.prototype.onopen=function(){j("transport is open - connecting"),"/"!=this.nsp&&this.packet({type:e.CONNECT})},d.prototype.onclose=function(a){j("close (%s)",a),this.connected=!1,this.disconnected=!0,delete this.id,this.emit("disconnect",a)},d.prototype.onpacket=function(a){if(a.nsp==this.nsp)switch(a.type){case e.CONNECT:this.onconnect();break;case e.EVENT:this.onevent(a);break;case e.BINARY_EVENT:this.onevent(a);break;case e.ACK:this.onack(a);break;case e.BINARY_ACK:this.onack(a);break;case e.DISCONNECT:this.ondisconnect();break;case e.ERROR:this.emit("error",a.data)}},d.prototype.onevent=function(a){var b=a.data||[];j("emitting event %j",b),null!=a.id&&(j("attaching ack callback to event"),b.push(this.ack(a.id))),this.connected?m.apply(this,b):this.receiveBuffer.push(b)},d.prototype.ack=function(a){var b=this,c=!1;return function(){if(!c){c=!0;var d=g(arguments);j("sending ack %j",d);var f=k(d)?e.BINARY_ACK:e.ACK;b.packet({type:f,id:a,data:d})}}},d.prototype.onack=function(a){j("calling ack %s with %j",a.id,a.data);var b=this.acks[a.id];b.apply(this,a.data),delete this.acks[a.id]},d.prototype.onconnect=function(){this.connected=!0,this.disconnected=!1,this.emit("connect"),this.emitBuffered()},d.prototype.emitBuffered=function(){var a;for(a=0;a0&&a.jitter<=1?a.jitter:0,this.attempts=0}b.exports=d,d.prototype.duration=function(){var a=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var b=Math.random(),c=Math.floor(b*this.jitter*a);a=0==(1&Math.floor(10*b))?a-c:a+c}return 0|Math.min(a,this.max)},d.prototype.reset=function(){this.attempts=0},d.prototype.setMin=function(a){this.ms=a},d.prototype.setMax=function(a){this.max=a},d.prototype.setJitter=function(a){this.jitter=a}},{}],8:[function(a,b,c){var d=[].slice;b.exports=function(a,b){if("string"==typeof b&&(b=a[b]),"function"!=typeof b)throw new Error("bind() requires a function");var c=d.call(arguments,2);return function(){return b.apply(a,c.concat(d.call(arguments)))}}},{}],9:[function(a,b,c){function d(a){return a?e(a):void 0}function e(a){for(var b in d.prototype)a[b]=d.prototype[b];return a}b.exports=d,d.prototype.on=d.prototype.addEventListener=function(a,b){return this._callbacks=this._callbacks||{},(this._callbacks[a]=this._callbacks[a]||[]).push(b),this},d.prototype.once=function(a,b){function c(){d.off(a,c),b.apply(this,arguments)}var d=this;return this._callbacks=this._callbacks||{},c.fn=b,this.on(a,c),this},d.prototype.off=d.prototype.removeListener=d.prototype.removeAllListeners=d.prototype.removeEventListener=function(a,b){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var c=this._callbacks[a];if(!c)return this;if(1==arguments.length)return delete this._callbacks[a],this;for(var d,e=0;ed;++d)c[d].apply(this,b)}return this},d.prototype.listeners=function(a){return this._callbacks=this._callbacks||{},this._callbacks[a]||[]},d.prototype.hasListeners=function(a){return!!this.listeners(a).length}},{}],10:[function(a,b,c){function d(a){return d.enabled(a)?function(b){b=e(b);var c=new Date,f=c-(d[a]||c);d[a]=c,b=a+" "+b+" +"+d.humanize(f),window.console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}:function(){}}function e(a){return a instanceof Error?a.stack||a.message:a}b.exports=d,d.names=[],d.skips=[],d.enable=function(a){try{localStorage.debug=a}catch(b){}for(var c=(a||"").split(/[\s,]+/),e=c.length,f=0;e>f;f++)a=c[f].replace("*",".*?"),"-"===a[0]?d.skips.push(new RegExp("^"+a.substr(1)+"$")):d.names.push(new RegExp("^"+a+"$"))},d.disable=function(){d.enable("")},d.humanize=function(a){var b=1e3,c=6e4,d=60*c;return a>=d?(a/d).toFixed(1)+"h":a>=c?(a/c).toFixed(1)+"m":a>=b?(a/b|0)+"s":a+"ms"},d.enabled=function(a){for(var b=0,c=d.skips.length;c>b;b++)if(d.skips[b].test(a))return!1;for(var b=0,c=d.names.length;c>b;b++)if(d.names[b].test(a))return!0;return!1};try{window.localStorage&&d.enable(localStorage.debug)}catch(f){}},{}],11:[function(a,b,c){b.exports=a("./lib/")},{"./lib/":12}],12:[function(a,b,c){b.exports=a("./socket"),b.exports.parser=a("engine.io-parser")},{"./socket":13,"engine.io-parser":25}],13:[function(a,b,c){(function(c){function d(a,b){if(!(this instanceof d))return new d(a,b);if(b=b||{},a&&"object"==typeof a&&(b=a,a=null),a&&(a=k(a),b.host=a.host,b.secure="https"==a.protocol||"wss"==a.protocol,b.port=a.port,a.query&&(b.query=a.query)),this.secure=null!=b.secure?b.secure:c.location&&"https:"==location.protocol,b.host){var e=b.host.split(":");b.hostname=e.shift(),e.length?b.port=e.pop():b.port||(b.port=this.secure?"443":"80")}this.agent=b.agent||!1,this.hostname=b.hostname||(c.location?location.hostname:"localhost"),this.port=b.port||(c.location&&location.port?location.port:this.secure?443:80),this.query=b.query||{},"string"==typeof this.query&&(this.query=m.decode(this.query)),this.upgrade=!1!==b.upgrade,this.path=(b.path||"/engine.io").replace(/\/$/,"")+"/",this.forceJSONP=!!b.forceJSONP,this.jsonp=!1!==b.jsonp,this.forceBase64=!!b.forceBase64,this.enablesXDR=!!b.enablesXDR,this.timestampParam=b.timestampParam||"t",this.timestampRequests=b.timestampRequests,this.transports=b.transports||["polling","websocket"],this.readyState="",this.writeBuffer=[],this.callbackBuffer=[],this.policyPort=b.policyPort||843,this.rememberUpgrade=b.rememberUpgrade||!1,this.binaryType=null,this.onlyBinaryUpgrades=b.onlyBinaryUpgrades,this.pfx=b.pfx||null,this.key=b.key||null,this.passphrase=b.passphrase||null,this.cert=b.cert||null,this.ca=b.ca||null,this.ciphers=b.ciphers||null,this.rejectUnauthorized=b.rejectUnauthorized||null,this.open()}function e(a){var b={};for(var c in a)a.hasOwnProperty(c)&&(b[c]=a[c]);return b}var f=a("./transports"),g=a("component-emitter"),h=a("debug")("engine.io-client:socket"),i=a("indexof"),j=a("engine.io-parser"),k=a("parseuri"),l=a("parsejson"),m=a("parseqs");b.exports=d,d.priorWebsocketSuccess=!1,g(d.prototype),d.protocol=j.protocol,d.Socket=d,d.Transport=a("./transport"),d.transports=a("./transports"),d.parser=a("engine.io-parser"),d.prototype.createTransport=function(a){h('creating transport "%s"',a);var b=e(this.query);b.EIO=j.protocol,b.transport=a,this.id&&(b.sid=this.id);var c=new f[a]({agent:this.agent,hostname:this.hostname,port:this.port,secure:this.secure,path:this.path,query:b,forceJSONP:this.forceJSONP,jsonp:this.jsonp,forceBase64:this.forceBase64,enablesXDR:this.enablesXDR,timestampRequests:this.timestampRequests,timestampParam:this.timestampParam,policyPort:this.policyPort,socket:this,pfx:this.pfx,key:this.key,passphrase:this.passphrase,cert:this.cert,ca:this.ca,ciphers:this.ciphers,rejectUnauthorized:this.rejectUnauthorized});return c},d.prototype.open=function(){var a;if(this.rememberUpgrade&&d.priorWebsocketSuccess&&-1!=this.transports.indexOf("websocket"))a="websocket";else{if(0==this.transports.length){var b=this;return void setTimeout(function(){b.emit("error","No transports available")},0)}a=this.transports[0]}this.readyState="opening";var a;try{a=this.createTransport(a)}catch(c){return this.transports.shift(),void this.open()}a.open(),this.setTransport(a)},d.prototype.setTransport=function(a){h("setting transport %s",a.name);var b=this;this.transport&&(h("clearing existing transport %s",this.transport.name),this.transport.removeAllListeners()),this.transport=a,a.on("drain",function(){b.onDrain()}).on("packet",function(a){b.onPacket(a)}).on("error",function(a){b.onError(a)}).on("close",function(){b.onClose("transport close")})},d.prototype.probe=function(a){function b(){if(m.onlyBinaryUpgrades){var b=!this.supportsBinary&&m.transport.supportsBinary;l=l||b}l||(h('probe transport "%s" opened',a),k.send([{type:"ping",data:"probe"}]),k.once("packet",function(b){if(!l)if("pong"==b.type&&"probe"==b.data){if(h('probe transport "%s" pong',a),m.upgrading=!0,m.emit("upgrading",k),!k)return;d.priorWebsocketSuccess="websocket"==k.name,h('pausing current transport "%s"',m.transport.name),m.transport.pause(function(){l||"closed"!=m.readyState&&(h("changing transport and sending upgrade packet"),j(),m.setTransport(k),k.send([{type:"upgrade"}]),m.emit("upgrade",k),k=null,m.upgrading=!1,m.flush())})}else{h('probe transport "%s" failed',a);var c=new Error("probe error");c.transport=k.name,m.emit("upgradeError",c)}}))}function c(){l||(l=!0,j(),k.close(),k=null)}function e(b){var d=new Error("probe error: "+b);d.transport=k.name,c(),h('probe transport "%s" failed because of error: %s',a,b),m.emit("upgradeError",d)}function f(){e("transport closed")}function g(){e("socket closed")}function i(a){k&&a.name!=k.name&&(h('"%s" works - aborting "%s"',a.name,k.name),c())}function j(){k.removeListener("open",b),k.removeListener("error",e),k.removeListener("close",f),m.removeListener("close",g),m.removeListener("upgrading",i)}h('probing transport "%s"',a);var k=this.createTransport(a,{probe:1}),l=!1,m=this;d.priorWebsocketSuccess=!1,k.once("open",b),k.once("error",e),k.once("close",f),this.once("close",g),this.once("upgrading",i),k.open()},d.prototype.onOpen=function(){if(h("socket open"),this.readyState="open",d.priorWebsocketSuccess="websocket"==this.transport.name,this.emit("open"),this.flush(),"open"==this.readyState&&this.upgrade&&this.transport.pause){h("starting upgrade probes");for(var a=0,b=this.upgrades.length;b>a;a++)this.probe(this.upgrades[a])}},d.prototype.onPacket=function(a){if("opening"==this.readyState||"open"==this.readyState)switch(h('socket receive: type "%s", data "%s"',a.type,a.data),this.emit("packet",a),this.emit("heartbeat"),a.type){case"open":this.onHandshake(l(a.data));break;case"pong":this.setPing();break;case"error":var b=new Error("server error");b.code=a.data,this.emit("error",b);break;case"message":this.emit("data",a.data),this.emit("message",a.data)}else h('packet received with socket readyState "%s"',this.readyState)},d.prototype.onHandshake=function(a){this.emit("handshake",a),this.id=a.sid,this.transport.query.sid=a.sid,this.upgrades=this.filterUpgrades(a.upgrades),this.pingInterval=a.pingInterval,this.pingTimeout=a.pingTimeout,this.onOpen(),"closed"!=this.readyState&&(this.setPing(),this.removeListener("heartbeat",this.onHeartbeat),this.on("heartbeat",this.onHeartbeat))},d.prototype.onHeartbeat=function(a){clearTimeout(this.pingTimeoutTimer);var b=this;b.pingTimeoutTimer=setTimeout(function(){"closed"!=b.readyState&&b.onClose("ping timeout")},a||b.pingInterval+b.pingTimeout)},d.prototype.setPing=function(){var a=this;clearTimeout(a.pingIntervalTimer),a.pingIntervalTimer=setTimeout(function(){h("writing ping packet - expecting pong within %sms",a.pingTimeout),a.ping(),a.onHeartbeat(a.pingTimeout)},a.pingInterval)},d.prototype.ping=function(){this.sendPacket("ping")},d.prototype.onDrain=function(){for(var a=0;ac;c++)~i(this.transports,a[c])&&b.push(a[c]);return b}}).call(this,"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./transport":14,"./transports":15,"component-emitter":9, +debug:22,"engine.io-parser":25,indexof:40,parsejson:32,parseqs:33,parseuri:34}],14:[function(a,b,c){function d(a){this.path=a.path,this.hostname=a.hostname,this.port=a.port,this.secure=a.secure,this.query=a.query,this.timestampParam=a.timestampParam,this.timestampRequests=a.timestampRequests,this.readyState="",this.agent=a.agent||!1,this.socket=a.socket,this.enablesXDR=a.enablesXDR,this.pfx=a.pfx,this.key=a.key,this.passphrase=a.passphrase,this.cert=a.cert,this.ca=a.ca,this.ciphers=a.ciphers,this.rejectUnauthorized=a.rejectUnauthorized}var e=a("engine.io-parser"),f=a("component-emitter");b.exports=d,f(d.prototype),d.timestamps=0,d.prototype.onError=function(a,b){var c=new Error(a);return c.type="TransportError",c.description=b,this.emit("error",c),this},d.prototype.open=function(){return("closed"==this.readyState||""==this.readyState)&&(this.readyState="opening",this.doOpen()),this},d.prototype.close=function(){return("opening"==this.readyState||"open"==this.readyState)&&(this.doClose(),this.onClose()),this},d.prototype.send=function(a){if("open"!=this.readyState)throw new Error("Transport not open");this.write(a)},d.prototype.onOpen=function(){this.readyState="open",this.writable=!0,this.emit("open")},d.prototype.onData=function(a){var b=e.decodePacket(a,this.socket.binaryType);this.onPacket(b)},d.prototype.onPacket=function(a){this.emit("packet",a)},d.prototype.onClose=function(){this.readyState="closed",this.emit("close")}},{"component-emitter":9,"engine.io-parser":25}],15:[function(a,b,c){(function(b){function d(a){var c,d=!1,h=!1,i=!1!==a.jsonp;if(b.location){var j="https:"==location.protocol,k=location.port;k||(k=j?443:80),d=a.hostname!=location.hostname||k!=a.port,h=a.secure!=j}if(a.xdomain=d,a.xscheme=h,c=new e(a),"open"in c&&!a.forceJSONP)return new f(a);if(!i)throw new Error("JSONP disabled");return new g(a)}var e=a("xmlhttprequest"),f=a("./polling-xhr"),g=a("./polling-jsonp"),h=a("./websocket");c.polling=d,c.websocket=h}).call(this,"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./polling-jsonp":16,"./polling-xhr":17,"./websocket":19,xmlhttprequest:20}],16:[function(a,b,c){(function(c){function d(){}function e(a){f.call(this,a),this.query=this.query||{},h||(c.___eio||(c.___eio=[]),h=c.___eio),this.index=h.length;var b=this;h.push(function(a){b.onData(a)}),this.query.j=this.index,c.document&&c.addEventListener&&c.addEventListener("beforeunload",function(){b.script&&(b.script.onerror=d)},!1)}var f=a("./polling"),g=a("component-inherit");b.exports=e;var h,i=/\n/g,j=/\\n/g;g(e,f),e.prototype.supportsBinary=!1,e.prototype.doClose=function(){this.script&&(this.script.parentNode.removeChild(this.script),this.script=null),this.form&&(this.form.parentNode.removeChild(this.form),this.form=null,this.iframe=null),f.prototype.doClose.call(this)},e.prototype.doPoll=function(){var a=this,b=document.createElement("script");this.script&&(this.script.parentNode.removeChild(this.script),this.script=null),b.async=!0,b.src=this.uri(),b.onerror=function(b){a.onError("jsonp poll error",b)};var c=document.getElementsByTagName("script")[0];c.parentNode.insertBefore(b,c),this.script=b;var d="undefined"!=typeof navigator&&/gecko/i.test(navigator.userAgent);d&&setTimeout(function(){var a=document.createElement("iframe");document.body.appendChild(a),document.body.removeChild(a)},100)},e.prototype.doWrite=function(a,b){function c(){d(),b()}function d(){if(e.iframe)try{e.form.removeChild(e.iframe)}catch(a){e.onError("jsonp polling iframe removal error",a)}try{var b='
        ");}]);})(window); \ No newline at end of file diff --git a/public/bower_components/angular-animate/angular-animate.js b/public/bower_components/angular-animate/angular-animate.js new file mode 100644 index 0000000..3061004 --- /dev/null +++ b/public/bower_components/angular-animate/angular-animate.js @@ -0,0 +1,3930 @@ +/** + * @license AngularJS v1.4.8 + * (c) 2010-2015 Google, Inc. http://angularjs.org + * License: MIT + */ +(function(window, angular, undefined) {'use strict'; + +/* jshint ignore:start */ +var noop = angular.noop; +var extend = angular.extend; +var jqLite = angular.element; +var forEach = angular.forEach; +var isArray = angular.isArray; +var isString = angular.isString; +var isObject = angular.isObject; +var isUndefined = angular.isUndefined; +var isDefined = angular.isDefined; +var isFunction = angular.isFunction; +var isElement = angular.isElement; + +var ELEMENT_NODE = 1; +var COMMENT_NODE = 8; + +var ADD_CLASS_SUFFIX = '-add'; +var REMOVE_CLASS_SUFFIX = '-remove'; +var EVENT_CLASS_PREFIX = 'ng-'; +var ACTIVE_CLASS_SUFFIX = '-active'; + +var NG_ANIMATE_CLASSNAME = 'ng-animate'; +var NG_ANIMATE_CHILDREN_DATA = '$$ngAnimateChildren'; + +// Detect proper transitionend/animationend event names. +var CSS_PREFIX = '', TRANSITION_PROP, TRANSITIONEND_EVENT, ANIMATION_PROP, ANIMATIONEND_EVENT; + +// If unprefixed events are not supported but webkit-prefixed are, use the latter. +// Otherwise, just use W3C names, browsers not supporting them at all will just ignore them. +// Note: Chrome implements `window.onwebkitanimationend` and doesn't implement `window.onanimationend` +// but at the same time dispatches the `animationend` event and not `webkitAnimationEnd`. +// Register both events in case `window.onanimationend` is not supported because of that, +// do the same for `transitionend` as Safari is likely to exhibit similar behavior. +// Also, the only modern browser that uses vendor prefixes for transitions/keyframes is webkit +// therefore there is no reason to test anymore for other vendor prefixes: +// http://caniuse.com/#search=transition +if (isUndefined(window.ontransitionend) && isDefined(window.onwebkittransitionend)) { + CSS_PREFIX = '-webkit-'; + TRANSITION_PROP = 'WebkitTransition'; + TRANSITIONEND_EVENT = 'webkitTransitionEnd transitionend'; +} else { + TRANSITION_PROP = 'transition'; + TRANSITIONEND_EVENT = 'transitionend'; +} + +if (isUndefined(window.onanimationend) && isDefined(window.onwebkitanimationend)) { + CSS_PREFIX = '-webkit-'; + ANIMATION_PROP = 'WebkitAnimation'; + ANIMATIONEND_EVENT = 'webkitAnimationEnd animationend'; +} else { + ANIMATION_PROP = 'animation'; + ANIMATIONEND_EVENT = 'animationend'; +} + +var DURATION_KEY = 'Duration'; +var PROPERTY_KEY = 'Property'; +var DELAY_KEY = 'Delay'; +var TIMING_KEY = 'TimingFunction'; +var ANIMATION_ITERATION_COUNT_KEY = 'IterationCount'; +var ANIMATION_PLAYSTATE_KEY = 'PlayState'; +var SAFE_FAST_FORWARD_DURATION_VALUE = 9999; + +var ANIMATION_DELAY_PROP = ANIMATION_PROP + DELAY_KEY; +var ANIMATION_DURATION_PROP = ANIMATION_PROP + DURATION_KEY; +var TRANSITION_DELAY_PROP = TRANSITION_PROP + DELAY_KEY; +var TRANSITION_DURATION_PROP = TRANSITION_PROP + DURATION_KEY; + +var isPromiseLike = function(p) { + return p && p.then ? true : false; +}; + +function assertArg(arg, name, reason) { + if (!arg) { + throw ngMinErr('areq', "Argument '{0}' is {1}", (name || '?'), (reason || "required")); + } + return arg; +} + +function mergeClasses(a,b) { + if (!a && !b) return ''; + if (!a) return b; + if (!b) return a; + if (isArray(a)) a = a.join(' '); + if (isArray(b)) b = b.join(' '); + return a + ' ' + b; +} + +function packageStyles(options) { + var styles = {}; + if (options && (options.to || options.from)) { + styles.to = options.to; + styles.from = options.from; + } + return styles; +} + +function pendClasses(classes, fix, isPrefix) { + var className = ''; + classes = isArray(classes) + ? classes + : classes && isString(classes) && classes.length + ? classes.split(/\s+/) + : []; + forEach(classes, function(klass, i) { + if (klass && klass.length > 0) { + className += (i > 0) ? ' ' : ''; + className += isPrefix ? fix + klass + : klass + fix; + } + }); + return className; +} + +function removeFromArray(arr, val) { + var index = arr.indexOf(val); + if (val >= 0) { + arr.splice(index, 1); + } +} + +function stripCommentsFromElement(element) { + if (element instanceof jqLite) { + switch (element.length) { + case 0: + return []; + break; + + case 1: + // there is no point of stripping anything if the element + // is the only element within the jqLite wrapper. + // (it's important that we retain the element instance.) + if (element[0].nodeType === ELEMENT_NODE) { + return element; + } + break; + + default: + return jqLite(extractElementNode(element)); + break; + } + } + + if (element.nodeType === ELEMENT_NODE) { + return jqLite(element); + } +} + +function extractElementNode(element) { + if (!element[0]) return element; + for (var i = 0; i < element.length; i++) { + var elm = element[i]; + if (elm.nodeType == ELEMENT_NODE) { + return elm; + } + } +} + +function $$addClass($$jqLite, element, className) { + forEach(element, function(elm) { + $$jqLite.addClass(elm, className); + }); +} + +function $$removeClass($$jqLite, element, className) { + forEach(element, function(elm) { + $$jqLite.removeClass(elm, className); + }); +} + +function applyAnimationClassesFactory($$jqLite) { + return function(element, options) { + if (options.addClass) { + $$addClass($$jqLite, element, options.addClass); + options.addClass = null; + } + if (options.removeClass) { + $$removeClass($$jqLite, element, options.removeClass); + options.removeClass = null; + } + } +} + +function prepareAnimationOptions(options) { + options = options || {}; + if (!options.$$prepared) { + var domOperation = options.domOperation || noop; + options.domOperation = function() { + options.$$domOperationFired = true; + domOperation(); + domOperation = noop; + }; + options.$$prepared = true; + } + return options; +} + +function applyAnimationStyles(element, options) { + applyAnimationFromStyles(element, options); + applyAnimationToStyles(element, options); +} + +function applyAnimationFromStyles(element, options) { + if (options.from) { + element.css(options.from); + options.from = null; + } +} + +function applyAnimationToStyles(element, options) { + if (options.to) { + element.css(options.to); + options.to = null; + } +} + +function mergeAnimationOptions(element, target, newOptions) { + var toAdd = (target.addClass || '') + ' ' + (newOptions.addClass || ''); + var toRemove = (target.removeClass || '') + ' ' + (newOptions.removeClass || ''); + var classes = resolveElementClasses(element.attr('class'), toAdd, toRemove); + + if (newOptions.preparationClasses) { + target.preparationClasses = concatWithSpace(newOptions.preparationClasses, target.preparationClasses); + delete newOptions.preparationClasses; + } + + // noop is basically when there is no callback; otherwise something has been set + var realDomOperation = target.domOperation !== noop ? target.domOperation : null; + + extend(target, newOptions); + + // TODO(matsko or sreeramu): proper fix is to maintain all animation callback in array and call at last,but now only leave has the callback so no issue with this. + if (realDomOperation) { + target.domOperation = realDomOperation; + } + + if (classes.addClass) { + target.addClass = classes.addClass; + } else { + target.addClass = null; + } + + if (classes.removeClass) { + target.removeClass = classes.removeClass; + } else { + target.removeClass = null; + } + + return target; +} + +function resolveElementClasses(existing, toAdd, toRemove) { + var ADD_CLASS = 1; + var REMOVE_CLASS = -1; + + var flags = {}; + existing = splitClassesToLookup(existing); + + toAdd = splitClassesToLookup(toAdd); + forEach(toAdd, function(value, key) { + flags[key] = ADD_CLASS; + }); + + toRemove = splitClassesToLookup(toRemove); + forEach(toRemove, function(value, key) { + flags[key] = flags[key] === ADD_CLASS ? null : REMOVE_CLASS; + }); + + var classes = { + addClass: '', + removeClass: '' + }; + + forEach(flags, function(val, klass) { + var prop, allow; + if (val === ADD_CLASS) { + prop = 'addClass'; + allow = !existing[klass]; + } else if (val === REMOVE_CLASS) { + prop = 'removeClass'; + allow = existing[klass]; + } + if (allow) { + if (classes[prop].length) { + classes[prop] += ' '; + } + classes[prop] += klass; + } + }); + + function splitClassesToLookup(classes) { + if (isString(classes)) { + classes = classes.split(' '); + } + + var obj = {}; + forEach(classes, function(klass) { + // sometimes the split leaves empty string values + // incase extra spaces were applied to the options + if (klass.length) { + obj[klass] = true; + } + }); + return obj; + } + + return classes; +} + +function getDomNode(element) { + return (element instanceof angular.element) ? element[0] : element; +} + +function applyGeneratedPreparationClasses(element, event, options) { + var classes = ''; + if (event) { + classes = pendClasses(event, EVENT_CLASS_PREFIX, true); + } + if (options.addClass) { + classes = concatWithSpace(classes, pendClasses(options.addClass, ADD_CLASS_SUFFIX)); + } + if (options.removeClass) { + classes = concatWithSpace(classes, pendClasses(options.removeClass, REMOVE_CLASS_SUFFIX)); + } + if (classes.length) { + options.preparationClasses = classes; + element.addClass(classes); + } +} + +function clearGeneratedClasses(element, options) { + if (options.preparationClasses) { + element.removeClass(options.preparationClasses); + options.preparationClasses = null; + } + if (options.activeClasses) { + element.removeClass(options.activeClasses); + options.activeClasses = null; + } +} + +function blockTransitions(node, duration) { + // we use a negative delay value since it performs blocking + // yet it doesn't kill any existing transitions running on the + // same element which makes this safe for class-based animations + var value = duration ? '-' + duration + 's' : ''; + applyInlineStyle(node, [TRANSITION_DELAY_PROP, value]); + return [TRANSITION_DELAY_PROP, value]; +} + +function blockKeyframeAnimations(node, applyBlock) { + var value = applyBlock ? 'paused' : ''; + var key = ANIMATION_PROP + ANIMATION_PLAYSTATE_KEY; + applyInlineStyle(node, [key, value]); + return [key, value]; +} + +function applyInlineStyle(node, styleTuple) { + var prop = styleTuple[0]; + var value = styleTuple[1]; + node.style[prop] = value; +} + +function concatWithSpace(a,b) { + if (!a) return b; + if (!b) return a; + return a + ' ' + b; +} + +var $$rAFSchedulerFactory = ['$$rAF', function($$rAF) { + var queue, cancelFn; + + function scheduler(tasks) { + // we make a copy since RAFScheduler mutates the state + // of the passed in array variable and this would be difficult + // to track down on the outside code + queue = queue.concat(tasks); + nextTick(); + } + + queue = scheduler.queue = []; + + /* waitUntilQuiet does two things: + * 1. It will run the FINAL `fn` value only when an uncancelled RAF has passed through + * 2. It will delay the next wave of tasks from running until the quiet `fn` has run. + * + * The motivation here is that animation code can request more time from the scheduler + * before the next wave runs. This allows for certain DOM properties such as classes to + * be resolved in time for the next animation to run. + */ + scheduler.waitUntilQuiet = function(fn) { + if (cancelFn) cancelFn(); + + cancelFn = $$rAF(function() { + cancelFn = null; + fn(); + nextTick(); + }); + }; + + return scheduler; + + function nextTick() { + if (!queue.length) return; + + var items = queue.shift(); + for (var i = 0; i < items.length; i++) { + items[i](); + } + + if (!cancelFn) { + $$rAF(function() { + if (!cancelFn) nextTick(); + }); + } + } +}]; + +var $$AnimateChildrenDirective = [function() { + return function(scope, element, attrs) { + var val = attrs.ngAnimateChildren; + if (angular.isString(val) && val.length === 0) { //empty attribute + element.data(NG_ANIMATE_CHILDREN_DATA, true); + } else { + attrs.$observe('ngAnimateChildren', function(value) { + value = value === 'on' || value === 'true'; + element.data(NG_ANIMATE_CHILDREN_DATA, value); + }); + } + }; +}]; + +var ANIMATE_TIMER_KEY = '$$animateCss'; + +/** + * @ngdoc service + * @name $animateCss + * @kind object + * + * @description + * The `$animateCss` service is a useful utility to trigger customized CSS-based transitions/keyframes + * from a JavaScript-based animation or directly from a directive. The purpose of `$animateCss` is NOT + * to side-step how `$animate` and ngAnimate work, but the goal is to allow pre-existing animations or + * directives to create more complex animations that can be purely driven using CSS code. + * + * Note that only browsers that support CSS transitions and/or keyframe animations are capable of + * rendering animations triggered via `$animateCss` (bad news for IE9 and lower). + * + * ## Usage + * Once again, `$animateCss` is designed to be used inside of a registered JavaScript animation that + * is powered by ngAnimate. It is possible to use `$animateCss` directly inside of a directive, however, + * any automatic control over cancelling animations and/or preventing animations from being run on + * child elements will not be handled by Angular. For this to work as expected, please use `$animate` to + * trigger the animation and then setup a JavaScript animation that injects `$animateCss` to trigger + * the CSS animation. + * + * The example below shows how we can create a folding animation on an element using `ng-if`: + * + * ```html + * + *
        + * This element will go BOOM + *
        + * + * ``` + * + * Now we create the **JavaScript animation** that will trigger the CSS transition: + * + * ```js + * ngModule.animation('.fold-animation', ['$animateCss', function($animateCss) { + * return { + * enter: function(element, doneFn) { + * var height = element[0].offsetHeight; + * return $animateCss(element, { + * from: { height:'0px' }, + * to: { height:height + 'px' }, + * duration: 1 // one second + * }); + * } + * } + * }]); + * ``` + * + * ## More Advanced Uses + * + * `$animateCss` is the underlying code that ngAnimate uses to power **CSS-based animations** behind the scenes. Therefore CSS hooks + * like `.ng-EVENT`, `.ng-EVENT-active`, `.ng-EVENT-stagger` are all features that can be triggered using `$animateCss` via JavaScript code. + * + * This also means that just about any combination of adding classes, removing classes, setting styles, dynamically setting a keyframe animation, + * applying a hardcoded duration or delay value, changing the animation easing or applying a stagger animation are all options that work with + * `$animateCss`. The service itself is smart enough to figure out the combination of options and examine the element styling properties in order + * to provide a working animation that will run in CSS. + * + * The example below showcases a more advanced version of the `.fold-animation` from the example above: + * + * ```js + * ngModule.animation('.fold-animation', ['$animateCss', function($animateCss) { + * return { + * enter: function(element, doneFn) { + * var height = element[0].offsetHeight; + * return $animateCss(element, { + * addClass: 'red large-text pulse-twice', + * easing: 'ease-out', + * from: { height:'0px' }, + * to: { height:height + 'px' }, + * duration: 1 // one second + * }); + * } + * } + * }]); + * ``` + * + * Since we're adding/removing CSS classes then the CSS transition will also pick those up: + * + * ```css + * /* since a hardcoded duration value of 1 was provided in the JavaScript animation code, + * the CSS classes below will be transitioned despite them being defined as regular CSS classes */ + * .red { background:red; } + * .large-text { font-size:20px; } + * + * /* we can also use a keyframe animation and $animateCss will make it work alongside the transition */ + * .pulse-twice { + * animation: 0.5s pulse linear 2; + * -webkit-animation: 0.5s pulse linear 2; + * } + * + * @keyframes pulse { + * from { transform: scale(0.5); } + * to { transform: scale(1.5); } + * } + * + * @-webkit-keyframes pulse { + * from { -webkit-transform: scale(0.5); } + * to { -webkit-transform: scale(1.5); } + * } + * ``` + * + * Given this complex combination of CSS classes, styles and options, `$animateCss` will figure everything out and make the animation happen. + * + * ## How the Options are handled + * + * `$animateCss` is very versatile and intelligent when it comes to figuring out what configurations to apply to the element to ensure the animation + * works with the options provided. Say for example we were adding a class that contained a keyframe value and we wanted to also animate some inline + * styles using the `from` and `to` properties. + * + * ```js + * var animator = $animateCss(element, { + * from: { background:'red' }, + * to: { background:'blue' } + * }); + * animator.start(); + * ``` + * + * ```css + * .rotating-animation { + * animation:0.5s rotate linear; + * -webkit-animation:0.5s rotate linear; + * } + * + * @keyframes rotate { + * from { transform: rotate(0deg); } + * to { transform: rotate(360deg); } + * } + * + * @-webkit-keyframes rotate { + * from { -webkit-transform: rotate(0deg); } + * to { -webkit-transform: rotate(360deg); } + * } + * ``` + * + * The missing pieces here are that we do not have a transition set (within the CSS code nor within the `$animateCss` options) and the duration of the animation is + * going to be detected from what the keyframe styles on the CSS class are. In this event, `$animateCss` will automatically create an inline transition + * style matching the duration detected from the keyframe style (which is present in the CSS class that is being added) and then prepare both the transition + * and keyframe animations to run in parallel on the element. Then when the animation is underway the provided `from` and `to` CSS styles will be applied + * and spread across the transition and keyframe animation. + * + * ## What is returned + * + * `$animateCss` works in two stages: a preparation phase and an animation phase. Therefore when `$animateCss` is first called it will NOT actually + * start the animation. All that is going on here is that the element is being prepared for the animation (which means that the generated CSS classes are + * added and removed on the element). Once `$animateCss` is called it will return an object with the following properties: + * + * ```js + * var animator = $animateCss(element, { ... }); + * ``` + * + * Now what do the contents of our `animator` variable look like: + * + * ```js + * { + * // starts the animation + * start: Function, + * + * // ends (aborts) the animation + * end: Function + * } + * ``` + * + * To actually start the animation we need to run `animation.start()` which will then return a promise that we can hook into to detect when the animation ends. + * If we choose not to run the animation then we MUST run `animation.end()` to perform a cleanup on the element (since some CSS classes and stlyes may have been + * applied to the element during the preparation phase). Note that all other properties such as duration, delay, transitions and keyframes are just properties + * and that changing them will not reconfigure the parameters of the animation. + * + * ### runner.done() vs runner.then() + * It is documented that `animation.start()` will return a promise object and this is true, however, there is also an additional method available on the + * runner called `.done(callbackFn)`. The done method works the same as `.finally(callbackFn)`, however, it does **not trigger a digest to occur**. + * Therefore, for performance reasons, it's always best to use `runner.done(callback)` instead of `runner.then()`, `runner.catch()` or `runner.finally()` + * unless you really need a digest to kick off afterwards. + * + * Keep in mind that, to make this easier, ngAnimate has tweaked the JS animations API to recognize when a runner instance is returned from $animateCss + * (so there is no need to call `runner.done(doneFn)` inside of your JavaScript animation code). + * Check the {@link ngAnimate.$animateCss#usage animation code above} to see how this works. + * + * @param {DOMElement} element the element that will be animated + * @param {object} options the animation-related options that will be applied during the animation + * + * * `event` - The DOM event (e.g. enter, leave, move). When used, a generated CSS class of `ng-EVENT` and `ng-EVENT-active` will be applied + * to the element during the animation. Multiple events can be provided when spaces are used as a separator. (Note that this will not perform any DOM operation.) + * * `structural` - Indicates that the `ng-` prefix will be added to the event class. Setting to `false` or omitting will turn `ng-EVENT` and + * `ng-EVENT-active` in `EVENT` and `EVENT-active`. Unused if `event` is omitted. + * * `easing` - The CSS easing value that will be applied to the transition or keyframe animation (or both). + * * `transitionStyle` - The raw CSS transition style that will be used (e.g. `1s linear all`). + * * `keyframeStyle` - The raw CSS keyframe animation style that will be used (e.g. `1s my_animation linear`). + * * `from` - The starting CSS styles (a key/value object) that will be applied at the start of the animation. + * * `to` - The ending CSS styles (a key/value object) that will be applied across the animation via a CSS transition. + * * `addClass` - A space separated list of CSS classes that will be added to the element and spread across the animation. + * * `removeClass` - A space separated list of CSS classes that will be removed from the element and spread across the animation. + * * `duration` - A number value representing the total duration of the transition and/or keyframe (note that a value of 1 is 1000ms). If a value of `0` + * is provided then the animation will be skipped entirely. + * * `delay` - A number value representing the total delay of the transition and/or keyframe (note that a value of 1 is 1000ms). If a value of `true` is + * used then whatever delay value is detected from the CSS classes will be mirrored on the elements styles (e.g. by setting delay true then the style value + * of the element will be `transition-delay: DETECTED_VALUE`). Using `true` is useful when you want the CSS classes and inline styles to all share the same + * CSS delay value. + * * `stagger` - A numeric time value representing the delay between successively animated elements + * ({@link ngAnimate#css-staggering-animations Click here to learn how CSS-based staggering works in ngAnimate.}) + * * `staggerIndex` - The numeric index representing the stagger item (e.g. a value of 5 is equal to the sixth item in the stagger; therefore when a + * * `stagger` option value of `0.1` is used then there will be a stagger delay of `600ms`) + * * `applyClassesEarly` - Whether or not the classes being added or removed will be used when detecting the animation. This is set by `$animate` when enter/leave/move animations are fired to ensure that the CSS classes are resolved in time. (Note that this will prevent any transitions from occuring on the classes being added and removed.) + * * `cleanupStyles` - Whether or not the provided `from` and `to` styles will be removed once + * the animation is closed. This is useful for when the styles are used purely for the sake of + * the animation and do not have a lasting visual effect on the element (e.g. a colapse and open animation). + * By default this value is set to `false`. + * + * @return {object} an object with start and end methods and details about the animation. + * + * * `start` - The method to start the animation. This will return a `Promise` when called. + * * `end` - This method will cancel the animation and remove all applied CSS classes and styles. + */ +var ONE_SECOND = 1000; +var BASE_TEN = 10; + +var ELAPSED_TIME_MAX_DECIMAL_PLACES = 3; +var CLOSING_TIME_BUFFER = 1.5; + +var DETECT_CSS_PROPERTIES = { + transitionDuration: TRANSITION_DURATION_PROP, + transitionDelay: TRANSITION_DELAY_PROP, + transitionProperty: TRANSITION_PROP + PROPERTY_KEY, + animationDuration: ANIMATION_DURATION_PROP, + animationDelay: ANIMATION_DELAY_PROP, + animationIterationCount: ANIMATION_PROP + ANIMATION_ITERATION_COUNT_KEY +}; + +var DETECT_STAGGER_CSS_PROPERTIES = { + transitionDuration: TRANSITION_DURATION_PROP, + transitionDelay: TRANSITION_DELAY_PROP, + animationDuration: ANIMATION_DURATION_PROP, + animationDelay: ANIMATION_DELAY_PROP +}; + +function getCssKeyframeDurationStyle(duration) { + return [ANIMATION_DURATION_PROP, duration + 's']; +} + +function getCssDelayStyle(delay, isKeyframeAnimation) { + var prop = isKeyframeAnimation ? ANIMATION_DELAY_PROP : TRANSITION_DELAY_PROP; + return [prop, delay + 's']; +} + +function computeCssStyles($window, element, properties) { + var styles = Object.create(null); + var detectedStyles = $window.getComputedStyle(element) || {}; + forEach(properties, function(formalStyleName, actualStyleName) { + var val = detectedStyles[formalStyleName]; + if (val) { + var c = val.charAt(0); + + // only numerical-based values have a negative sign or digit as the first value + if (c === '-' || c === '+' || c >= 0) { + val = parseMaxTime(val); + } + + // by setting this to null in the event that the delay is not set or is set directly as 0 + // then we can still allow for zegative values to be used later on and not mistake this + // value for being greater than any other negative value. + if (val === 0) { + val = null; + } + styles[actualStyleName] = val; + } + }); + + return styles; +} + +function parseMaxTime(str) { + var maxValue = 0; + var values = str.split(/\s*,\s*/); + forEach(values, function(value) { + // it's always safe to consider only second values and omit `ms` values since + // getComputedStyle will always handle the conversion for us + if (value.charAt(value.length - 1) == 's') { + value = value.substring(0, value.length - 1); + } + value = parseFloat(value) || 0; + maxValue = maxValue ? Math.max(value, maxValue) : value; + }); + return maxValue; +} + +function truthyTimingValue(val) { + return val === 0 || val != null; +} + +function getCssTransitionDurationStyle(duration, applyOnlyDuration) { + var style = TRANSITION_PROP; + var value = duration + 's'; + if (applyOnlyDuration) { + style += DURATION_KEY; + } else { + value += ' linear all'; + } + return [style, value]; +} + +function createLocalCacheLookup() { + var cache = Object.create(null); + return { + flush: function() { + cache = Object.create(null); + }, + + count: function(key) { + var entry = cache[key]; + return entry ? entry.total : 0; + }, + + get: function(key) { + var entry = cache[key]; + return entry && entry.value; + }, + + put: function(key, value) { + if (!cache[key]) { + cache[key] = { total: 1, value: value }; + } else { + cache[key].total++; + } + } + }; +} + +// we do not reassign an already present style value since +// if we detect the style property value again we may be +// detecting styles that were added via the `from` styles. +// We make use of `isDefined` here since an empty string +// or null value (which is what getPropertyValue will return +// for a non-existing style) will still be marked as a valid +// value for the style (a falsy value implies that the style +// is to be removed at the end of the animation). If we had a simple +// "OR" statement then it would not be enough to catch that. +function registerRestorableStyles(backup, node, properties) { + forEach(properties, function(prop) { + backup[prop] = isDefined(backup[prop]) + ? backup[prop] + : node.style.getPropertyValue(prop); + }); +} + +var $AnimateCssProvider = ['$animateProvider', function($animateProvider) { + var gcsLookup = createLocalCacheLookup(); + var gcsStaggerLookup = createLocalCacheLookup(); + + this.$get = ['$window', '$$jqLite', '$$AnimateRunner', '$timeout', + '$$forceReflow', '$sniffer', '$$rAFScheduler', '$animate', + function($window, $$jqLite, $$AnimateRunner, $timeout, + $$forceReflow, $sniffer, $$rAFScheduler, $animate) { + + var applyAnimationClasses = applyAnimationClassesFactory($$jqLite); + + var parentCounter = 0; + function gcsHashFn(node, extraClasses) { + var KEY = "$$ngAnimateParentKey"; + var parentNode = node.parentNode; + var parentID = parentNode[KEY] || (parentNode[KEY] = ++parentCounter); + return parentID + '-' + node.getAttribute('class') + '-' + extraClasses; + } + + function computeCachedCssStyles(node, className, cacheKey, properties) { + var timings = gcsLookup.get(cacheKey); + + if (!timings) { + timings = computeCssStyles($window, node, properties); + if (timings.animationIterationCount === 'infinite') { + timings.animationIterationCount = 1; + } + } + + // we keep putting this in multiple times even though the value and the cacheKey are the same + // because we're keeping an interal tally of how many duplicate animations are detected. + gcsLookup.put(cacheKey, timings); + return timings; + } + + function computeCachedCssStaggerStyles(node, className, cacheKey, properties) { + var stagger; + + // if we have one or more existing matches of matching elements + // containing the same parent + CSS styles (which is how cacheKey works) + // then staggering is possible + if (gcsLookup.count(cacheKey) > 0) { + stagger = gcsStaggerLookup.get(cacheKey); + + if (!stagger) { + var staggerClassName = pendClasses(className, '-stagger'); + + $$jqLite.addClass(node, staggerClassName); + + stagger = computeCssStyles($window, node, properties); + + // force the conversion of a null value to zero incase not set + stagger.animationDuration = Math.max(stagger.animationDuration, 0); + stagger.transitionDuration = Math.max(stagger.transitionDuration, 0); + + $$jqLite.removeClass(node, staggerClassName); + + gcsStaggerLookup.put(cacheKey, stagger); + } + } + + return stagger || {}; + } + + var cancelLastRAFRequest; + var rafWaitQueue = []; + function waitUntilQuiet(callback) { + rafWaitQueue.push(callback); + $$rAFScheduler.waitUntilQuiet(function() { + gcsLookup.flush(); + gcsStaggerLookup.flush(); + + // DO NOT REMOVE THIS LINE OR REFACTOR OUT THE `pageWidth` variable. + // PLEASE EXAMINE THE `$$forceReflow` service to understand why. + var pageWidth = $$forceReflow(); + + // we use a for loop to ensure that if the queue is changed + // during this looping then it will consider new requests + for (var i = 0; i < rafWaitQueue.length; i++) { + rafWaitQueue[i](pageWidth); + } + rafWaitQueue.length = 0; + }); + } + + function computeTimings(node, className, cacheKey) { + var timings = computeCachedCssStyles(node, className, cacheKey, DETECT_CSS_PROPERTIES); + var aD = timings.animationDelay; + var tD = timings.transitionDelay; + timings.maxDelay = aD && tD + ? Math.max(aD, tD) + : (aD || tD); + timings.maxDuration = Math.max( + timings.animationDuration * timings.animationIterationCount, + timings.transitionDuration); + + return timings; + } + + return function init(element, options) { + var restoreStyles = {}; + var node = getDomNode(element); + if (!node + || !node.parentNode + || !$animate.enabled()) { + return closeAndReturnNoopAnimator(); + } + + options = prepareAnimationOptions(options); + + var temporaryStyles = []; + var classes = element.attr('class'); + var styles = packageStyles(options); + var animationClosed; + var animationPaused; + var animationCompleted; + var runner; + var runnerHost; + var maxDelay; + var maxDelayTime; + var maxDuration; + var maxDurationTime; + + if (options.duration === 0 || (!$sniffer.animations && !$sniffer.transitions)) { + return closeAndReturnNoopAnimator(); + } + + var method = options.event && isArray(options.event) + ? options.event.join(' ') + : options.event; + + var isStructural = method && options.structural; + var structuralClassName = ''; + var addRemoveClassName = ''; + + if (isStructural) { + structuralClassName = pendClasses(method, EVENT_CLASS_PREFIX, true); + } else if (method) { + structuralClassName = method; + } + + if (options.addClass) { + addRemoveClassName += pendClasses(options.addClass, ADD_CLASS_SUFFIX); + } + + if (options.removeClass) { + if (addRemoveClassName.length) { + addRemoveClassName += ' '; + } + addRemoveClassName += pendClasses(options.removeClass, REMOVE_CLASS_SUFFIX); + } + + // there may be a situation where a structural animation is combined together + // with CSS classes that need to resolve before the animation is computed. + // However this means that there is no explicit CSS code to block the animation + // from happening (by setting 0s none in the class name). If this is the case + // we need to apply the classes before the first rAF so we know to continue if + // there actually is a detected transition or keyframe animation + if (options.applyClassesEarly && addRemoveClassName.length) { + applyAnimationClasses(element, options); + } + + var preparationClasses = [structuralClassName, addRemoveClassName].join(' ').trim(); + var fullClassName = classes + ' ' + preparationClasses; + var activeClasses = pendClasses(preparationClasses, ACTIVE_CLASS_SUFFIX); + var hasToStyles = styles.to && Object.keys(styles.to).length > 0; + var containsKeyframeAnimation = (options.keyframeStyle || '').length > 0; + + // there is no way we can trigger an animation if no styles and + // no classes are being applied which would then trigger a transition, + // unless there a is raw keyframe value that is applied to the element. + if (!containsKeyframeAnimation + && !hasToStyles + && !preparationClasses) { + return closeAndReturnNoopAnimator(); + } + + var cacheKey, stagger; + if (options.stagger > 0) { + var staggerVal = parseFloat(options.stagger); + stagger = { + transitionDelay: staggerVal, + animationDelay: staggerVal, + transitionDuration: 0, + animationDuration: 0 + }; + } else { + cacheKey = gcsHashFn(node, fullClassName); + stagger = computeCachedCssStaggerStyles(node, preparationClasses, cacheKey, DETECT_STAGGER_CSS_PROPERTIES); + } + + if (!options.$$skipPreparationClasses) { + $$jqLite.addClass(element, preparationClasses); + } + + var applyOnlyDuration; + + if (options.transitionStyle) { + var transitionStyle = [TRANSITION_PROP, options.transitionStyle]; + applyInlineStyle(node, transitionStyle); + temporaryStyles.push(transitionStyle); + } + + if (options.duration >= 0) { + applyOnlyDuration = node.style[TRANSITION_PROP].length > 0; + var durationStyle = getCssTransitionDurationStyle(options.duration, applyOnlyDuration); + + // we set the duration so that it will be picked up by getComputedStyle later + applyInlineStyle(node, durationStyle); + temporaryStyles.push(durationStyle); + } + + if (options.keyframeStyle) { + var keyframeStyle = [ANIMATION_PROP, options.keyframeStyle]; + applyInlineStyle(node, keyframeStyle); + temporaryStyles.push(keyframeStyle); + } + + var itemIndex = stagger + ? options.staggerIndex >= 0 + ? options.staggerIndex + : gcsLookup.count(cacheKey) + : 0; + + var isFirst = itemIndex === 0; + + // this is a pre-emptive way of forcing the setup classes to be added and applied INSTANTLY + // without causing any combination of transitions to kick in. By adding a negative delay value + // it forces the setup class' transition to end immediately. We later then remove the negative + // transition delay to allow for the transition to naturally do it's thing. The beauty here is + // that if there is no transition defined then nothing will happen and this will also allow + // other transitions to be stacked on top of each other without any chopping them out. + if (isFirst && !options.skipBlocking) { + blockTransitions(node, SAFE_FAST_FORWARD_DURATION_VALUE); + } + + var timings = computeTimings(node, fullClassName, cacheKey); + var relativeDelay = timings.maxDelay; + maxDelay = Math.max(relativeDelay, 0); + maxDuration = timings.maxDuration; + + var flags = {}; + flags.hasTransitions = timings.transitionDuration > 0; + flags.hasAnimations = timings.animationDuration > 0; + flags.hasTransitionAll = flags.hasTransitions && timings.transitionProperty == 'all'; + flags.applyTransitionDuration = hasToStyles && ( + (flags.hasTransitions && !flags.hasTransitionAll) + || (flags.hasAnimations && !flags.hasTransitions)); + flags.applyAnimationDuration = options.duration && flags.hasAnimations; + flags.applyTransitionDelay = truthyTimingValue(options.delay) && (flags.applyTransitionDuration || flags.hasTransitions); + flags.applyAnimationDelay = truthyTimingValue(options.delay) && flags.hasAnimations; + flags.recalculateTimingStyles = addRemoveClassName.length > 0; + + if (flags.applyTransitionDuration || flags.applyAnimationDuration) { + maxDuration = options.duration ? parseFloat(options.duration) : maxDuration; + + if (flags.applyTransitionDuration) { + flags.hasTransitions = true; + timings.transitionDuration = maxDuration; + applyOnlyDuration = node.style[TRANSITION_PROP + PROPERTY_KEY].length > 0; + temporaryStyles.push(getCssTransitionDurationStyle(maxDuration, applyOnlyDuration)); + } + + if (flags.applyAnimationDuration) { + flags.hasAnimations = true; + timings.animationDuration = maxDuration; + temporaryStyles.push(getCssKeyframeDurationStyle(maxDuration)); + } + } + + if (maxDuration === 0 && !flags.recalculateTimingStyles) { + return closeAndReturnNoopAnimator(); + } + + if (options.delay != null) { + var delayStyle = parseFloat(options.delay); + + if (flags.applyTransitionDelay) { + temporaryStyles.push(getCssDelayStyle(delayStyle)); + } + + if (flags.applyAnimationDelay) { + temporaryStyles.push(getCssDelayStyle(delayStyle, true)); + } + } + + // we need to recalculate the delay value since we used a pre-emptive negative + // delay value and the delay value is required for the final event checking. This + // property will ensure that this will happen after the RAF phase has passed. + if (options.duration == null && timings.transitionDuration > 0) { + flags.recalculateTimingStyles = flags.recalculateTimingStyles || isFirst; + } + + maxDelayTime = maxDelay * ONE_SECOND; + maxDurationTime = maxDuration * ONE_SECOND; + if (!options.skipBlocking) { + flags.blockTransition = timings.transitionDuration > 0; + flags.blockKeyframeAnimation = timings.animationDuration > 0 && + stagger.animationDelay > 0 && + stagger.animationDuration === 0; + } + + if (options.from) { + if (options.cleanupStyles) { + registerRestorableStyles(restoreStyles, node, Object.keys(options.from)); + } + applyAnimationFromStyles(element, options); + } + + if (flags.blockTransition || flags.blockKeyframeAnimation) { + applyBlocking(maxDuration); + } else if (!options.skipBlocking) { + blockTransitions(node, false); + } + + // TODO(matsko): for 1.5 change this code to have an animator object for better debugging + return { + $$willAnimate: true, + end: endFn, + start: function() { + if (animationClosed) return; + + runnerHost = { + end: endFn, + cancel: cancelFn, + resume: null, //this will be set during the start() phase + pause: null + }; + + runner = new $$AnimateRunner(runnerHost); + + waitUntilQuiet(start); + + // we don't have access to pause/resume the animation + // since it hasn't run yet. AnimateRunner will therefore + // set noop functions for resume and pause and they will + // later be overridden once the animation is triggered + return runner; + } + }; + + function endFn() { + close(); + } + + function cancelFn() { + close(true); + } + + function close(rejected) { // jshint ignore:line + // if the promise has been called already then we shouldn't close + // the animation again + if (animationClosed || (animationCompleted && animationPaused)) return; + animationClosed = true; + animationPaused = false; + + if (!options.$$skipPreparationClasses) { + $$jqLite.removeClass(element, preparationClasses); + } + $$jqLite.removeClass(element, activeClasses); + + blockKeyframeAnimations(node, false); + blockTransitions(node, false); + + forEach(temporaryStyles, function(entry) { + // There is only one way to remove inline style properties entirely from elements. + // By using `removeProperty` this works, but we need to convert camel-cased CSS + // styles down to hyphenated values. + node.style[entry[0]] = ''; + }); + + applyAnimationClasses(element, options); + applyAnimationStyles(element, options); + + if (Object.keys(restoreStyles).length) { + forEach(restoreStyles, function(value, prop) { + value ? node.style.setProperty(prop, value) + : node.style.removeProperty(prop); + }); + } + + // the reason why we have this option is to allow a synchronous closing callback + // that is fired as SOON as the animation ends (when the CSS is removed) or if + // the animation never takes off at all. A good example is a leave animation since + // the element must be removed just after the animation is over or else the element + // will appear on screen for one animation frame causing an overbearing flicker. + if (options.onDone) { + options.onDone(); + } + + // if the preparation function fails then the promise is not setup + if (runner) { + runner.complete(!rejected); + } + } + + function applyBlocking(duration) { + if (flags.blockTransition) { + blockTransitions(node, duration); + } + + if (flags.blockKeyframeAnimation) { + blockKeyframeAnimations(node, !!duration); + } + } + + function closeAndReturnNoopAnimator() { + runner = new $$AnimateRunner({ + end: endFn, + cancel: cancelFn + }); + + // should flush the cache animation + waitUntilQuiet(noop); + close(); + + return { + $$willAnimate: false, + start: function() { + return runner; + }, + end: endFn + }; + } + + function start() { + if (animationClosed) return; + if (!node.parentNode) { + close(); + return; + } + + var startTime, events = []; + + // even though we only pause keyframe animations here the pause flag + // will still happen when transitions are used. Only the transition will + // not be paused since that is not possible. If the animation ends when + // paused then it will not complete until unpaused or cancelled. + var playPause = function(playAnimation) { + if (!animationCompleted) { + animationPaused = !playAnimation; + if (timings.animationDuration) { + var value = blockKeyframeAnimations(node, animationPaused); + animationPaused + ? temporaryStyles.push(value) + : removeFromArray(temporaryStyles, value); + } + } else if (animationPaused && playAnimation) { + animationPaused = false; + close(); + } + }; + + // checking the stagger duration prevents an accidently cascade of the CSS delay style + // being inherited from the parent. If the transition duration is zero then we can safely + // rely that the delay value is an intential stagger delay style. + var maxStagger = itemIndex > 0 + && ((timings.transitionDuration && stagger.transitionDuration === 0) || + (timings.animationDuration && stagger.animationDuration === 0)) + && Math.max(stagger.animationDelay, stagger.transitionDelay); + if (maxStagger) { + $timeout(triggerAnimationStart, + Math.floor(maxStagger * itemIndex * ONE_SECOND), + false); + } else { + triggerAnimationStart(); + } + + // this will decorate the existing promise runner with pause/resume methods + runnerHost.resume = function() { + playPause(true); + }; + + runnerHost.pause = function() { + playPause(false); + }; + + function triggerAnimationStart() { + // just incase a stagger animation kicks in when the animation + // itself was cancelled entirely + if (animationClosed) return; + + applyBlocking(false); + + forEach(temporaryStyles, function(entry) { + var key = entry[0]; + var value = entry[1]; + node.style[key] = value; + }); + + applyAnimationClasses(element, options); + $$jqLite.addClass(element, activeClasses); + + if (flags.recalculateTimingStyles) { + fullClassName = node.className + ' ' + preparationClasses; + cacheKey = gcsHashFn(node, fullClassName); + + timings = computeTimings(node, fullClassName, cacheKey); + relativeDelay = timings.maxDelay; + maxDelay = Math.max(relativeDelay, 0); + maxDuration = timings.maxDuration; + + if (maxDuration === 0) { + close(); + return; + } + + flags.hasTransitions = timings.transitionDuration > 0; + flags.hasAnimations = timings.animationDuration > 0; + } + + if (flags.applyAnimationDelay) { + relativeDelay = typeof options.delay !== "boolean" && truthyTimingValue(options.delay) + ? parseFloat(options.delay) + : relativeDelay; + + maxDelay = Math.max(relativeDelay, 0); + timings.animationDelay = relativeDelay; + delayStyle = getCssDelayStyle(relativeDelay, true); + temporaryStyles.push(delayStyle); + node.style[delayStyle[0]] = delayStyle[1]; + } + + maxDelayTime = maxDelay * ONE_SECOND; + maxDurationTime = maxDuration * ONE_SECOND; + + if (options.easing) { + var easeProp, easeVal = options.easing; + if (flags.hasTransitions) { + easeProp = TRANSITION_PROP + TIMING_KEY; + temporaryStyles.push([easeProp, easeVal]); + node.style[easeProp] = easeVal; + } + if (flags.hasAnimations) { + easeProp = ANIMATION_PROP + TIMING_KEY; + temporaryStyles.push([easeProp, easeVal]); + node.style[easeProp] = easeVal; + } + } + + if (timings.transitionDuration) { + events.push(TRANSITIONEND_EVENT); + } + + if (timings.animationDuration) { + events.push(ANIMATIONEND_EVENT); + } + + startTime = Date.now(); + var timerTime = maxDelayTime + CLOSING_TIME_BUFFER * maxDurationTime; + var endTime = startTime + timerTime; + + var animationsData = element.data(ANIMATE_TIMER_KEY) || []; + var setupFallbackTimer = true; + if (animationsData.length) { + var currentTimerData = animationsData[0]; + setupFallbackTimer = endTime > currentTimerData.expectedEndTime; + if (setupFallbackTimer) { + $timeout.cancel(currentTimerData.timer); + } else { + animationsData.push(close); + } + } + + if (setupFallbackTimer) { + var timer = $timeout(onAnimationExpired, timerTime, false); + animationsData[0] = { + timer: timer, + expectedEndTime: endTime + }; + animationsData.push(close); + element.data(ANIMATE_TIMER_KEY, animationsData); + } + + element.on(events.join(' '), onAnimationProgress); + if (options.to) { + if (options.cleanupStyles) { + registerRestorableStyles(restoreStyles, node, Object.keys(options.to)); + } + applyAnimationToStyles(element, options); + } + } + + function onAnimationExpired() { + var animationsData = element.data(ANIMATE_TIMER_KEY); + + // this will be false in the event that the element was + // removed from the DOM (via a leave animation or something + // similar) + if (animationsData) { + for (var i = 1; i < animationsData.length; i++) { + animationsData[i](); + } + element.removeData(ANIMATE_TIMER_KEY); + } + } + + function onAnimationProgress(event) { + event.stopPropagation(); + var ev = event.originalEvent || event; + var timeStamp = ev.$manualTimeStamp || ev.timeStamp || Date.now(); + + /* Firefox (or possibly just Gecko) likes to not round values up + * when a ms measurement is used for the animation */ + var elapsedTime = parseFloat(ev.elapsedTime.toFixed(ELAPSED_TIME_MAX_DECIMAL_PLACES)); + + /* $manualTimeStamp is a mocked timeStamp value which is set + * within browserTrigger(). This is only here so that tests can + * mock animations properly. Real events fallback to event.timeStamp, + * or, if they don't, then a timeStamp is automatically created for them. + * We're checking to see if the timeStamp surpasses the expected delay, + * but we're using elapsedTime instead of the timeStamp on the 2nd + * pre-condition since animations sometimes close off early */ + if (Math.max(timeStamp - startTime, 0) >= maxDelayTime && elapsedTime >= maxDuration) { + // we set this flag to ensure that if the transition is paused then, when resumed, + // the animation will automatically close itself since transitions cannot be paused. + animationCompleted = true; + close(); + } + } + } + }; + }]; +}]; + +var $$AnimateCssDriverProvider = ['$$animationProvider', function($$animationProvider) { + $$animationProvider.drivers.push('$$animateCssDriver'); + + var NG_ANIMATE_SHIM_CLASS_NAME = 'ng-animate-shim'; + var NG_ANIMATE_ANCHOR_CLASS_NAME = 'ng-anchor'; + + var NG_OUT_ANCHOR_CLASS_NAME = 'ng-anchor-out'; + var NG_IN_ANCHOR_CLASS_NAME = 'ng-anchor-in'; + + function isDocumentFragment(node) { + return node.parentNode && node.parentNode.nodeType === 11; + } + + this.$get = ['$animateCss', '$rootScope', '$$AnimateRunner', '$rootElement', '$sniffer', '$$jqLite', '$document', + function($animateCss, $rootScope, $$AnimateRunner, $rootElement, $sniffer, $$jqLite, $document) { + + // only browsers that support these properties can render animations + if (!$sniffer.animations && !$sniffer.transitions) return noop; + + var bodyNode = $document[0].body; + var rootNode = getDomNode($rootElement); + + var rootBodyElement = jqLite( + // this is to avoid using something that exists outside of the body + // we also special case the doc fragement case because our unit test code + // appends the $rootElement to the body after the app has been bootstrapped + isDocumentFragment(rootNode) || bodyNode.contains(rootNode) ? rootNode : bodyNode + ); + + var applyAnimationClasses = applyAnimationClassesFactory($$jqLite); + + return function initDriverFn(animationDetails) { + return animationDetails.from && animationDetails.to + ? prepareFromToAnchorAnimation(animationDetails.from, + animationDetails.to, + animationDetails.classes, + animationDetails.anchors) + : prepareRegularAnimation(animationDetails); + }; + + function filterCssClasses(classes) { + //remove all the `ng-` stuff + return classes.replace(/\bng-\S+\b/g, ''); + } + + function getUniqueValues(a, b) { + if (isString(a)) a = a.split(' '); + if (isString(b)) b = b.split(' '); + return a.filter(function(val) { + return b.indexOf(val) === -1; + }).join(' '); + } + + function prepareAnchoredAnimation(classes, outAnchor, inAnchor) { + var clone = jqLite(getDomNode(outAnchor).cloneNode(true)); + var startingClasses = filterCssClasses(getClassVal(clone)); + + outAnchor.addClass(NG_ANIMATE_SHIM_CLASS_NAME); + inAnchor.addClass(NG_ANIMATE_SHIM_CLASS_NAME); + + clone.addClass(NG_ANIMATE_ANCHOR_CLASS_NAME); + + rootBodyElement.append(clone); + + var animatorIn, animatorOut = prepareOutAnimation(); + + // the user may not end up using the `out` animation and + // only making use of the `in` animation or vice-versa. + // In either case we should allow this and not assume the + // animation is over unless both animations are not used. + if (!animatorOut) { + animatorIn = prepareInAnimation(); + if (!animatorIn) { + return end(); + } + } + + var startingAnimator = animatorOut || animatorIn; + + return { + start: function() { + var runner; + + var currentAnimation = startingAnimator.start(); + currentAnimation.done(function() { + currentAnimation = null; + if (!animatorIn) { + animatorIn = prepareInAnimation(); + if (animatorIn) { + currentAnimation = animatorIn.start(); + currentAnimation.done(function() { + currentAnimation = null; + end(); + runner.complete(); + }); + return currentAnimation; + } + } + // in the event that there is no `in` animation + end(); + runner.complete(); + }); + + runner = new $$AnimateRunner({ + end: endFn, + cancel: endFn + }); + + return runner; + + function endFn() { + if (currentAnimation) { + currentAnimation.end(); + } + } + } + }; + + function calculateAnchorStyles(anchor) { + var styles = {}; + + var coords = getDomNode(anchor).getBoundingClientRect(); + + // we iterate directly since safari messes up and doesn't return + // all the keys for the coods object when iterated + forEach(['width','height','top','left'], function(key) { + var value = coords[key]; + switch (key) { + case 'top': + value += bodyNode.scrollTop; + break; + case 'left': + value += bodyNode.scrollLeft; + break; + } + styles[key] = Math.floor(value) + 'px'; + }); + return styles; + } + + function prepareOutAnimation() { + var animator = $animateCss(clone, { + addClass: NG_OUT_ANCHOR_CLASS_NAME, + delay: true, + from: calculateAnchorStyles(outAnchor) + }); + + // read the comment within `prepareRegularAnimation` to understand + // why this check is necessary + return animator.$$willAnimate ? animator : null; + } + + function getClassVal(element) { + return element.attr('class') || ''; + } + + function prepareInAnimation() { + var endingClasses = filterCssClasses(getClassVal(inAnchor)); + var toAdd = getUniqueValues(endingClasses, startingClasses); + var toRemove = getUniqueValues(startingClasses, endingClasses); + + var animator = $animateCss(clone, { + to: calculateAnchorStyles(inAnchor), + addClass: NG_IN_ANCHOR_CLASS_NAME + ' ' + toAdd, + removeClass: NG_OUT_ANCHOR_CLASS_NAME + ' ' + toRemove, + delay: true + }); + + // read the comment within `prepareRegularAnimation` to understand + // why this check is necessary + return animator.$$willAnimate ? animator : null; + } + + function end() { + clone.remove(); + outAnchor.removeClass(NG_ANIMATE_SHIM_CLASS_NAME); + inAnchor.removeClass(NG_ANIMATE_SHIM_CLASS_NAME); + } + } + + function prepareFromToAnchorAnimation(from, to, classes, anchors) { + var fromAnimation = prepareRegularAnimation(from, noop); + var toAnimation = prepareRegularAnimation(to, noop); + + var anchorAnimations = []; + forEach(anchors, function(anchor) { + var outElement = anchor['out']; + var inElement = anchor['in']; + var animator = prepareAnchoredAnimation(classes, outElement, inElement); + if (animator) { + anchorAnimations.push(animator); + } + }); + + // no point in doing anything when there are no elements to animate + if (!fromAnimation && !toAnimation && anchorAnimations.length === 0) return; + + return { + start: function() { + var animationRunners = []; + + if (fromAnimation) { + animationRunners.push(fromAnimation.start()); + } + + if (toAnimation) { + animationRunners.push(toAnimation.start()); + } + + forEach(anchorAnimations, function(animation) { + animationRunners.push(animation.start()); + }); + + var runner = new $$AnimateRunner({ + end: endFn, + cancel: endFn // CSS-driven animations cannot be cancelled, only ended + }); + + $$AnimateRunner.all(animationRunners, function(status) { + runner.complete(status); + }); + + return runner; + + function endFn() { + forEach(animationRunners, function(runner) { + runner.end(); + }); + } + } + }; + } + + function prepareRegularAnimation(animationDetails) { + var element = animationDetails.element; + var options = animationDetails.options || {}; + + if (animationDetails.structural) { + options.event = animationDetails.event; + options.structural = true; + options.applyClassesEarly = true; + + // we special case the leave animation since we want to ensure that + // the element is removed as soon as the animation is over. Otherwise + // a flicker might appear or the element may not be removed at all + if (animationDetails.event === 'leave') { + options.onDone = options.domOperation; + } + } + + // We assign the preparationClasses as the actual animation event since + // the internals of $animateCss will just suffix the event token values + // with `-active` to trigger the animation. + if (options.preparationClasses) { + options.event = concatWithSpace(options.event, options.preparationClasses); + } + + var animator = $animateCss(element, options); + + // the driver lookup code inside of $$animation attempts to spawn a + // driver one by one until a driver returns a.$$willAnimate animator object. + // $animateCss will always return an object, however, it will pass in + // a flag as a hint as to whether an animation was detected or not + return animator.$$willAnimate ? animator : null; + } + }]; +}]; + +// TODO(matsko): use caching here to speed things up for detection +// TODO(matsko): add documentation +// by the time... + +var $$AnimateJsProvider = ['$animateProvider', function($animateProvider) { + this.$get = ['$injector', '$$AnimateRunner', '$$jqLite', + function($injector, $$AnimateRunner, $$jqLite) { + + var applyAnimationClasses = applyAnimationClassesFactory($$jqLite); + // $animateJs(element, 'enter'); + return function(element, event, classes, options) { + // the `classes` argument is optional and if it is not used + // then the classes will be resolved from the element's className + // property as well as options.addClass/options.removeClass. + if (arguments.length === 3 && isObject(classes)) { + options = classes; + classes = null; + } + + options = prepareAnimationOptions(options); + if (!classes) { + classes = element.attr('class') || ''; + if (options.addClass) { + classes += ' ' + options.addClass; + } + if (options.removeClass) { + classes += ' ' + options.removeClass; + } + } + + var classesToAdd = options.addClass; + var classesToRemove = options.removeClass; + + // the lookupAnimations function returns a series of animation objects that are + // matched up with one or more of the CSS classes. These animation objects are + // defined via the module.animation factory function. If nothing is detected then + // we don't return anything which then makes $animation query the next driver. + var animations = lookupAnimations(classes); + var before, after; + if (animations.length) { + var afterFn, beforeFn; + if (event == 'leave') { + beforeFn = 'leave'; + afterFn = 'afterLeave'; // TODO(matsko): get rid of this + } else { + beforeFn = 'before' + event.charAt(0).toUpperCase() + event.substr(1); + afterFn = event; + } + + if (event !== 'enter' && event !== 'move') { + before = packageAnimations(element, event, options, animations, beforeFn); + } + after = packageAnimations(element, event, options, animations, afterFn); + } + + // no matching animations + if (!before && !after) return; + + function applyOptions() { + options.domOperation(); + applyAnimationClasses(element, options); + } + + return { + start: function() { + var closeActiveAnimations; + var chain = []; + + if (before) { + chain.push(function(fn) { + closeActiveAnimations = before(fn); + }); + } + + if (chain.length) { + chain.push(function(fn) { + applyOptions(); + fn(true); + }); + } else { + applyOptions(); + } + + if (after) { + chain.push(function(fn) { + closeActiveAnimations = after(fn); + }); + } + + var animationClosed = false; + var runner = new $$AnimateRunner({ + end: function() { + endAnimations(); + }, + cancel: function() { + endAnimations(true); + } + }); + + $$AnimateRunner.chain(chain, onComplete); + return runner; + + function onComplete(success) { + animationClosed = true; + applyOptions(); + applyAnimationStyles(element, options); + runner.complete(success); + } + + function endAnimations(cancelled) { + if (!animationClosed) { + (closeActiveAnimations || noop)(cancelled); + onComplete(cancelled); + } + } + } + }; + + function executeAnimationFn(fn, element, event, options, onDone) { + var args; + switch (event) { + case 'animate': + args = [element, options.from, options.to, onDone]; + break; + + case 'setClass': + args = [element, classesToAdd, classesToRemove, onDone]; + break; + + case 'addClass': + args = [element, classesToAdd, onDone]; + break; + + case 'removeClass': + args = [element, classesToRemove, onDone]; + break; + + default: + args = [element, onDone]; + break; + } + + args.push(options); + + var value = fn.apply(fn, args); + if (value) { + if (isFunction(value.start)) { + value = value.start(); + } + + if (value instanceof $$AnimateRunner) { + value.done(onDone); + } else if (isFunction(value)) { + // optional onEnd / onCancel callback + return value; + } + } + + return noop; + } + + function groupEventedAnimations(element, event, options, animations, fnName) { + var operations = []; + forEach(animations, function(ani) { + var animation = ani[fnName]; + if (!animation) return; + + // note that all of these animations will run in parallel + operations.push(function() { + var runner; + var endProgressCb; + + var resolved = false; + var onAnimationComplete = function(rejected) { + if (!resolved) { + resolved = true; + (endProgressCb || noop)(rejected); + runner.complete(!rejected); + } + }; + + runner = new $$AnimateRunner({ + end: function() { + onAnimationComplete(); + }, + cancel: function() { + onAnimationComplete(true); + } + }); + + endProgressCb = executeAnimationFn(animation, element, event, options, function(result) { + var cancelled = result === false; + onAnimationComplete(cancelled); + }); + + return runner; + }); + }); + + return operations; + } + + function packageAnimations(element, event, options, animations, fnName) { + var operations = groupEventedAnimations(element, event, options, animations, fnName); + if (operations.length === 0) { + var a,b; + if (fnName === 'beforeSetClass') { + a = groupEventedAnimations(element, 'removeClass', options, animations, 'beforeRemoveClass'); + b = groupEventedAnimations(element, 'addClass', options, animations, 'beforeAddClass'); + } else if (fnName === 'setClass') { + a = groupEventedAnimations(element, 'removeClass', options, animations, 'removeClass'); + b = groupEventedAnimations(element, 'addClass', options, animations, 'addClass'); + } + + if (a) { + operations = operations.concat(a); + } + if (b) { + operations = operations.concat(b); + } + } + + if (operations.length === 0) return; + + // TODO(matsko): add documentation + return function startAnimation(callback) { + var runners = []; + if (operations.length) { + forEach(operations, function(animateFn) { + runners.push(animateFn()); + }); + } + + runners.length ? $$AnimateRunner.all(runners, callback) : callback(); + + return function endFn(reject) { + forEach(runners, function(runner) { + reject ? runner.cancel() : runner.end(); + }); + }; + }; + } + }; + + function lookupAnimations(classes) { + classes = isArray(classes) ? classes : classes.split(' '); + var matches = [], flagMap = {}; + for (var i=0; i < classes.length; i++) { + var klass = classes[i], + animationFactory = $animateProvider.$$registeredAnimations[klass]; + if (animationFactory && !flagMap[klass]) { + matches.push($injector.get(animationFactory)); + flagMap[klass] = true; + } + } + return matches; + } + }]; +}]; + +var $$AnimateJsDriverProvider = ['$$animationProvider', function($$animationProvider) { + $$animationProvider.drivers.push('$$animateJsDriver'); + this.$get = ['$$animateJs', '$$AnimateRunner', function($$animateJs, $$AnimateRunner) { + return function initDriverFn(animationDetails) { + if (animationDetails.from && animationDetails.to) { + var fromAnimation = prepareAnimation(animationDetails.from); + var toAnimation = prepareAnimation(animationDetails.to); + if (!fromAnimation && !toAnimation) return; + + return { + start: function() { + var animationRunners = []; + + if (fromAnimation) { + animationRunners.push(fromAnimation.start()); + } + + if (toAnimation) { + animationRunners.push(toAnimation.start()); + } + + $$AnimateRunner.all(animationRunners, done); + + var runner = new $$AnimateRunner({ + end: endFnFactory(), + cancel: endFnFactory() + }); + + return runner; + + function endFnFactory() { + return function() { + forEach(animationRunners, function(runner) { + // at this point we cannot cancel animations for groups just yet. 1.5+ + runner.end(); + }); + }; + } + + function done(status) { + runner.complete(status); + } + } + }; + } else { + return prepareAnimation(animationDetails); + } + }; + + function prepareAnimation(animationDetails) { + // TODO(matsko): make sure to check for grouped animations and delegate down to normal animations + var element = animationDetails.element; + var event = animationDetails.event; + var options = animationDetails.options; + var classes = animationDetails.classes; + return $$animateJs(element, event, classes, options); + } + }]; +}]; + +var NG_ANIMATE_ATTR_NAME = 'data-ng-animate'; +var NG_ANIMATE_PIN_DATA = '$ngAnimatePin'; +var $$AnimateQueueProvider = ['$animateProvider', function($animateProvider) { + var PRE_DIGEST_STATE = 1; + var RUNNING_STATE = 2; + + var rules = this.rules = { + skip: [], + cancel: [], + join: [] + }; + + function isAllowed(ruleType, element, currentAnimation, previousAnimation) { + return rules[ruleType].some(function(fn) { + return fn(element, currentAnimation, previousAnimation); + }); + } + + function hasAnimationClasses(options, and) { + options = options || {}; + var a = (options.addClass || '').length > 0; + var b = (options.removeClass || '').length > 0; + return and ? a && b : a || b; + } + + rules.join.push(function(element, newAnimation, currentAnimation) { + // if the new animation is class-based then we can just tack that on + return !newAnimation.structural && hasAnimationClasses(newAnimation.options); + }); + + rules.skip.push(function(element, newAnimation, currentAnimation) { + // there is no need to animate anything if no classes are being added and + // there is no structural animation that will be triggered + return !newAnimation.structural && !hasAnimationClasses(newAnimation.options); + }); + + rules.skip.push(function(element, newAnimation, currentAnimation) { + // why should we trigger a new structural animation if the element will + // be removed from the DOM anyway? + return currentAnimation.event == 'leave' && newAnimation.structural; + }); + + rules.skip.push(function(element, newAnimation, currentAnimation) { + // if there is an ongoing current animation then don't even bother running the class-based animation + return currentAnimation.structural && currentAnimation.state === RUNNING_STATE && !newAnimation.structural; + }); + + rules.cancel.push(function(element, newAnimation, currentAnimation) { + // there can never be two structural animations running at the same time + return currentAnimation.structural && newAnimation.structural; + }); + + rules.cancel.push(function(element, newAnimation, currentAnimation) { + // if the previous animation is already running, but the new animation will + // be triggered, but the new animation is structural + return currentAnimation.state === RUNNING_STATE && newAnimation.structural; + }); + + rules.cancel.push(function(element, newAnimation, currentAnimation) { + var nO = newAnimation.options; + var cO = currentAnimation.options; + + // if the exact same CSS class is added/removed then it's safe to cancel it + return (nO.addClass && nO.addClass === cO.removeClass) || (nO.removeClass && nO.removeClass === cO.addClass); + }); + + this.$get = ['$$rAF', '$rootScope', '$rootElement', '$document', '$$HashMap', + '$$animation', '$$AnimateRunner', '$templateRequest', '$$jqLite', '$$forceReflow', + function($$rAF, $rootScope, $rootElement, $document, $$HashMap, + $$animation, $$AnimateRunner, $templateRequest, $$jqLite, $$forceReflow) { + + var activeAnimationsLookup = new $$HashMap(); + var disabledElementsLookup = new $$HashMap(); + var animationsEnabled = null; + + function postDigestTaskFactory() { + var postDigestCalled = false; + return function(fn) { + // we only issue a call to postDigest before + // it has first passed. This prevents any callbacks + // from not firing once the animation has completed + // since it will be out of the digest cycle. + if (postDigestCalled) { + fn(); + } else { + $rootScope.$$postDigest(function() { + postDigestCalled = true; + fn(); + }); + } + }; + } + + // Wait until all directive and route-related templates are downloaded and + // compiled. The $templateRequest.totalPendingRequests variable keeps track of + // all of the remote templates being currently downloaded. If there are no + // templates currently downloading then the watcher will still fire anyway. + var deregisterWatch = $rootScope.$watch( + function() { return $templateRequest.totalPendingRequests === 0; }, + function(isEmpty) { + if (!isEmpty) return; + deregisterWatch(); + + // Now that all templates have been downloaded, $animate will wait until + // the post digest queue is empty before enabling animations. By having two + // calls to $postDigest calls we can ensure that the flag is enabled at the + // very end of the post digest queue. Since all of the animations in $animate + // use $postDigest, it's important that the code below executes at the end. + // This basically means that the page is fully downloaded and compiled before + // any animations are triggered. + $rootScope.$$postDigest(function() { + $rootScope.$$postDigest(function() { + // we check for null directly in the event that the application already called + // .enabled() with whatever arguments that it provided it with + if (animationsEnabled === null) { + animationsEnabled = true; + } + }); + }); + } + ); + + var callbackRegistry = {}; + + // remember that the classNameFilter is set during the provider/config + // stage therefore we can optimize here and setup a helper function + var classNameFilter = $animateProvider.classNameFilter(); + var isAnimatableClassName = !classNameFilter + ? function() { return true; } + : function(className) { + return classNameFilter.test(className); + }; + + var applyAnimationClasses = applyAnimationClassesFactory($$jqLite); + + function normalizeAnimationOptions(element, options) { + return mergeAnimationOptions(element, options, {}); + } + + function findCallbacks(parent, element, event) { + var targetNode = getDomNode(element); + var targetParentNode = getDomNode(parent); + + var matches = []; + var entries = callbackRegistry[event]; + if (entries) { + forEach(entries, function(entry) { + if (entry.node.contains(targetNode)) { + matches.push(entry.callback); + } else if (event === 'leave' && entry.node.contains(targetParentNode)) { + matches.push(entry.callback); + } + }); + } + + return matches; + } + + return { + on: function(event, container, callback) { + var node = extractElementNode(container); + callbackRegistry[event] = callbackRegistry[event] || []; + callbackRegistry[event].push({ + node: node, + callback: callback + }); + }, + + off: function(event, container, callback) { + var entries = callbackRegistry[event]; + if (!entries) return; + + callbackRegistry[event] = arguments.length === 1 + ? null + : filterFromRegistry(entries, container, callback); + + function filterFromRegistry(list, matchContainer, matchCallback) { + var containerNode = extractElementNode(matchContainer); + return list.filter(function(entry) { + var isMatch = entry.node === containerNode && + (!matchCallback || entry.callback === matchCallback); + return !isMatch; + }); + } + }, + + pin: function(element, parentElement) { + assertArg(isElement(element), 'element', 'not an element'); + assertArg(isElement(parentElement), 'parentElement', 'not an element'); + element.data(NG_ANIMATE_PIN_DATA, parentElement); + }, + + push: function(element, event, options, domOperation) { + options = options || {}; + options.domOperation = domOperation; + return queueAnimation(element, event, options); + }, + + // this method has four signatures: + // () - global getter + // (bool) - global setter + // (element) - element getter + // (element, bool) - element setter + enabled: function(element, bool) { + var argCount = arguments.length; + + if (argCount === 0) { + // () - Global getter + bool = !!animationsEnabled; + } else { + var hasElement = isElement(element); + + if (!hasElement) { + // (bool) - Global setter + bool = animationsEnabled = !!element; + } else { + var node = getDomNode(element); + var recordExists = disabledElementsLookup.get(node); + + if (argCount === 1) { + // (element) - Element getter + bool = !recordExists; + } else { + // (element, bool) - Element setter + bool = !!bool; + if (!bool) { + disabledElementsLookup.put(node, true); + } else if (recordExists) { + disabledElementsLookup.remove(node); + } + } + } + } + + return bool; + } + }; + + function queueAnimation(element, event, options) { + var node, parent; + element = stripCommentsFromElement(element); + if (element) { + node = getDomNode(element); + parent = element.parent(); + } + + options = prepareAnimationOptions(options); + + // we create a fake runner with a working promise. + // These methods will become available after the digest has passed + var runner = new $$AnimateRunner(); + + // this is used to trigger callbacks in postDigest mode + var runInNextPostDigestOrNow = postDigestTaskFactory(); + + if (isArray(options.addClass)) { + options.addClass = options.addClass.join(' '); + } + + if (options.addClass && !isString(options.addClass)) { + options.addClass = null; + } + + if (isArray(options.removeClass)) { + options.removeClass = options.removeClass.join(' '); + } + + if (options.removeClass && !isString(options.removeClass)) { + options.removeClass = null; + } + + if (options.from && !isObject(options.from)) { + options.from = null; + } + + if (options.to && !isObject(options.to)) { + options.to = null; + } + + // there are situations where a directive issues an animation for + // a jqLite wrapper that contains only comment nodes... If this + // happens then there is no way we can perform an animation + if (!node) { + close(); + return runner; + } + + var className = [node.className, options.addClass, options.removeClass].join(' '); + if (!isAnimatableClassName(className)) { + close(); + return runner; + } + + var isStructural = ['enter', 'move', 'leave'].indexOf(event) >= 0; + + // this is a hard disable of all animations for the application or on + // the element itself, therefore there is no need to continue further + // past this point if not enabled + var skipAnimations = !animationsEnabled || disabledElementsLookup.get(node); + var existingAnimation = (!skipAnimations && activeAnimationsLookup.get(node)) || {}; + var hasExistingAnimation = !!existingAnimation.state; + + // there is no point in traversing the same collection of parent ancestors if a followup + // animation will be run on the same element that already did all that checking work + if (!skipAnimations && (!hasExistingAnimation || existingAnimation.state != PRE_DIGEST_STATE)) { + skipAnimations = !areAnimationsAllowed(element, parent, event); + } + + if (skipAnimations) { + close(); + return runner; + } + + if (isStructural) { + closeChildAnimations(element); + } + + var newAnimation = { + structural: isStructural, + element: element, + event: event, + close: close, + options: options, + runner: runner + }; + + if (hasExistingAnimation) { + var skipAnimationFlag = isAllowed('skip', element, newAnimation, existingAnimation); + if (skipAnimationFlag) { + if (existingAnimation.state === RUNNING_STATE) { + close(); + return runner; + } else { + mergeAnimationOptions(element, existingAnimation.options, options); + return existingAnimation.runner; + } + } + + var cancelAnimationFlag = isAllowed('cancel', element, newAnimation, existingAnimation); + if (cancelAnimationFlag) { + if (existingAnimation.state === RUNNING_STATE) { + // this will end the animation right away and it is safe + // to do so since the animation is already running and the + // runner callback code will run in async + existingAnimation.runner.end(); + } else if (existingAnimation.structural) { + // this means that the animation is queued into a digest, but + // hasn't started yet. Therefore it is safe to run the close + // method which will call the runner methods in async. + existingAnimation.close(); + } else { + // this will merge the new animation options into existing animation options + mergeAnimationOptions(element, existingAnimation.options, newAnimation.options); + return existingAnimation.runner; + } + } else { + // a joined animation means that this animation will take over the existing one + // so an example would involve a leave animation taking over an enter. Then when + // the postDigest kicks in the enter will be ignored. + var joinAnimationFlag = isAllowed('join', element, newAnimation, existingAnimation); + if (joinAnimationFlag) { + if (existingAnimation.state === RUNNING_STATE) { + normalizeAnimationOptions(element, options); + } else { + applyGeneratedPreparationClasses(element, isStructural ? event : null, options); + + event = newAnimation.event = existingAnimation.event; + options = mergeAnimationOptions(element, existingAnimation.options, newAnimation.options); + + //we return the same runner since only the option values of this animation will + //be fed into the `existingAnimation`. + return existingAnimation.runner; + } + } + } + } else { + // normalization in this case means that it removes redundant CSS classes that + // already exist (addClass) or do not exist (removeClass) on the element + normalizeAnimationOptions(element, options); + } + + // when the options are merged and cleaned up we may end up not having to do + // an animation at all, therefore we should check this before issuing a post + // digest callback. Structural animations will always run no matter what. + var isValidAnimation = newAnimation.structural; + if (!isValidAnimation) { + // animate (from/to) can be quickly checked first, otherwise we check if any classes are present + isValidAnimation = (newAnimation.event === 'animate' && Object.keys(newAnimation.options.to || {}).length > 0) + || hasAnimationClasses(newAnimation.options); + } + + if (!isValidAnimation) { + close(); + clearElementAnimationState(element); + return runner; + } + + // the counter keeps track of cancelled animations + var counter = (existingAnimation.counter || 0) + 1; + newAnimation.counter = counter; + + markElementAnimationState(element, PRE_DIGEST_STATE, newAnimation); + + $rootScope.$$postDigest(function() { + var animationDetails = activeAnimationsLookup.get(node); + var animationCancelled = !animationDetails; + animationDetails = animationDetails || {}; + + // if addClass/removeClass is called before something like enter then the + // registered parent element may not be present. The code below will ensure + // that a final value for parent element is obtained + var parentElement = element.parent() || []; + + // animate/structural/class-based animations all have requirements. Otherwise there + // is no point in performing an animation. The parent node must also be set. + var isValidAnimation = parentElement.length > 0 + && (animationDetails.event === 'animate' + || animationDetails.structural + || hasAnimationClasses(animationDetails.options)); + + // this means that the previous animation was cancelled + // even if the follow-up animation is the same event + if (animationCancelled || animationDetails.counter !== counter || !isValidAnimation) { + // if another animation did not take over then we need + // to make sure that the domOperation and options are + // handled accordingly + if (animationCancelled) { + applyAnimationClasses(element, options); + applyAnimationStyles(element, options); + } + + // if the event changed from something like enter to leave then we do + // it, otherwise if it's the same then the end result will be the same too + if (animationCancelled || (isStructural && animationDetails.event !== event)) { + options.domOperation(); + runner.end(); + } + + // in the event that the element animation was not cancelled or a follow-up animation + // isn't allowed to animate from here then we need to clear the state of the element + // so that any future animations won't read the expired animation data. + if (!isValidAnimation) { + clearElementAnimationState(element); + } + + return; + } + + // this combined multiple class to addClass / removeClass into a setClass event + // so long as a structural event did not take over the animation + event = !animationDetails.structural && hasAnimationClasses(animationDetails.options, true) + ? 'setClass' + : animationDetails.event; + + markElementAnimationState(element, RUNNING_STATE); + var realRunner = $$animation(element, event, animationDetails.options); + + realRunner.done(function(status) { + close(!status); + var animationDetails = activeAnimationsLookup.get(node); + if (animationDetails && animationDetails.counter === counter) { + clearElementAnimationState(getDomNode(element)); + } + notifyProgress(runner, event, 'close', {}); + }); + + // this will update the runner's flow-control events based on + // the `realRunner` object. + runner.setHost(realRunner); + notifyProgress(runner, event, 'start', {}); + }); + + return runner; + + function notifyProgress(runner, event, phase, data) { + runInNextPostDigestOrNow(function() { + var callbacks = findCallbacks(parent, element, event); + if (callbacks.length) { + // do not optimize this call here to RAF because + // we don't know how heavy the callback code here will + // be and if this code is buffered then this can + // lead to a performance regression. + $$rAF(function() { + forEach(callbacks, function(callback) { + callback(element, phase, data); + }); + }); + } + }); + runner.progress(event, phase, data); + } + + function close(reject) { // jshint ignore:line + clearGeneratedClasses(element, options); + applyAnimationClasses(element, options); + applyAnimationStyles(element, options); + options.domOperation(); + runner.complete(!reject); + } + } + + function closeChildAnimations(element) { + var node = getDomNode(element); + var children = node.querySelectorAll('[' + NG_ANIMATE_ATTR_NAME + ']'); + forEach(children, function(child) { + var state = parseInt(child.getAttribute(NG_ANIMATE_ATTR_NAME)); + var animationDetails = activeAnimationsLookup.get(child); + switch (state) { + case RUNNING_STATE: + animationDetails.runner.end(); + /* falls through */ + case PRE_DIGEST_STATE: + if (animationDetails) { + activeAnimationsLookup.remove(child); + } + break; + } + }); + } + + function clearElementAnimationState(element) { + var node = getDomNode(element); + node.removeAttribute(NG_ANIMATE_ATTR_NAME); + activeAnimationsLookup.remove(node); + } + + function isMatchingElement(nodeOrElmA, nodeOrElmB) { + return getDomNode(nodeOrElmA) === getDomNode(nodeOrElmB); + } + + function areAnimationsAllowed(element, parentElement, event) { + var bodyElement = jqLite($document[0].body); + var bodyElementDetected = isMatchingElement(element, bodyElement) || element[0].nodeName === 'HTML'; + var rootElementDetected = isMatchingElement(element, $rootElement); + var parentAnimationDetected = false; + var animateChildren; + + var parentHost = element.data(NG_ANIMATE_PIN_DATA); + if (parentHost) { + parentElement = parentHost; + } + + while (parentElement && parentElement.length) { + if (!rootElementDetected) { + // angular doesn't want to attempt to animate elements outside of the application + // therefore we need to ensure that the rootElement is an ancestor of the current element + rootElementDetected = isMatchingElement(parentElement, $rootElement); + } + + var parentNode = parentElement[0]; + if (parentNode.nodeType !== ELEMENT_NODE) { + // no point in inspecting the #document element + break; + } + + var details = activeAnimationsLookup.get(parentNode) || {}; + // either an enter, leave or move animation will commence + // therefore we can't allow any animations to take place + // but if a parent animation is class-based then that's ok + if (!parentAnimationDetected) { + parentAnimationDetected = details.structural || disabledElementsLookup.get(parentNode); + } + + if (isUndefined(animateChildren) || animateChildren === true) { + var value = parentElement.data(NG_ANIMATE_CHILDREN_DATA); + if (isDefined(value)) { + animateChildren = value; + } + } + + // there is no need to continue traversing at this point + if (parentAnimationDetected && animateChildren === false) break; + + if (!rootElementDetected) { + // angular doesn't want to attempt to animate elements outside of the application + // therefore we need to ensure that the rootElement is an ancestor of the current element + rootElementDetected = isMatchingElement(parentElement, $rootElement); + if (!rootElementDetected) { + parentHost = parentElement.data(NG_ANIMATE_PIN_DATA); + if (parentHost) { + parentElement = parentHost; + } + } + } + + if (!bodyElementDetected) { + // we also need to ensure that the element is or will be apart of the body element + // otherwise it is pointless to even issue an animation to be rendered + bodyElementDetected = isMatchingElement(parentElement, bodyElement); + } + + parentElement = parentElement.parent(); + } + + var allowAnimation = !parentAnimationDetected || animateChildren; + return allowAnimation && rootElementDetected && bodyElementDetected; + } + + function markElementAnimationState(element, state, details) { + details = details || {}; + details.state = state; + + var node = getDomNode(element); + node.setAttribute(NG_ANIMATE_ATTR_NAME, state); + + var oldValue = activeAnimationsLookup.get(node); + var newValue = oldValue + ? extend(oldValue, details) + : details; + activeAnimationsLookup.put(node, newValue); + } + }]; +}]; + +var $$AnimateAsyncRunFactory = ['$$rAF', function($$rAF) { + var waitQueue = []; + + function waitForTick(fn) { + waitQueue.push(fn); + if (waitQueue.length > 1) return; + $$rAF(function() { + for (var i = 0; i < waitQueue.length; i++) { + waitQueue[i](); + } + waitQueue = []; + }); + } + + return function() { + var passed = false; + waitForTick(function() { + passed = true; + }); + return function(callback) { + passed ? callback() : waitForTick(callback); + }; + }; +}]; + +var $$AnimateRunnerFactory = ['$q', '$sniffer', '$$animateAsyncRun', + function($q, $sniffer, $$animateAsyncRun) { + + var INITIAL_STATE = 0; + var DONE_PENDING_STATE = 1; + var DONE_COMPLETE_STATE = 2; + + AnimateRunner.chain = function(chain, callback) { + var index = 0; + + next(); + function next() { + if (index === chain.length) { + callback(true); + return; + } + + chain[index](function(response) { + if (response === false) { + callback(false); + return; + } + index++; + next(); + }); + } + }; + + AnimateRunner.all = function(runners, callback) { + var count = 0; + var status = true; + forEach(runners, function(runner) { + runner.done(onProgress); + }); + + function onProgress(response) { + status = status && response; + if (++count === runners.length) { + callback(status); + } + } + }; + + function AnimateRunner(host) { + this.setHost(host); + + this._doneCallbacks = []; + this._runInAnimationFrame = $$animateAsyncRun(); + this._state = 0; + } + + AnimateRunner.prototype = { + setHost: function(host) { + this.host = host || {}; + }, + + done: function(fn) { + if (this._state === DONE_COMPLETE_STATE) { + fn(); + } else { + this._doneCallbacks.push(fn); + } + }, + + progress: noop, + + getPromise: function() { + if (!this.promise) { + var self = this; + this.promise = $q(function(resolve, reject) { + self.done(function(status) { + status === false ? reject() : resolve(); + }); + }); + } + return this.promise; + }, + + then: function(resolveHandler, rejectHandler) { + return this.getPromise().then(resolveHandler, rejectHandler); + }, + + 'catch': function(handler) { + return this.getPromise()['catch'](handler); + }, + + 'finally': function(handler) { + return this.getPromise()['finally'](handler); + }, + + pause: function() { + if (this.host.pause) { + this.host.pause(); + } + }, + + resume: function() { + if (this.host.resume) { + this.host.resume(); + } + }, + + end: function() { + if (this.host.end) { + this.host.end(); + } + this._resolve(true); + }, + + cancel: function() { + if (this.host.cancel) { + this.host.cancel(); + } + this._resolve(false); + }, + + complete: function(response) { + var self = this; + if (self._state === INITIAL_STATE) { + self._state = DONE_PENDING_STATE; + self._runInAnimationFrame(function() { + self._resolve(response); + }); + } + }, + + _resolve: function(response) { + if (this._state !== DONE_COMPLETE_STATE) { + forEach(this._doneCallbacks, function(fn) { + fn(response); + }); + this._doneCallbacks.length = 0; + this._state = DONE_COMPLETE_STATE; + } + } + }; + + return AnimateRunner; +}]; + +var $$AnimationProvider = ['$animateProvider', function($animateProvider) { + var NG_ANIMATE_REF_ATTR = 'ng-animate-ref'; + + var drivers = this.drivers = []; + + var RUNNER_STORAGE_KEY = '$$animationRunner'; + + function setRunner(element, runner) { + element.data(RUNNER_STORAGE_KEY, runner); + } + + function removeRunner(element) { + element.removeData(RUNNER_STORAGE_KEY); + } + + function getRunner(element) { + return element.data(RUNNER_STORAGE_KEY); + } + + this.$get = ['$$jqLite', '$rootScope', '$injector', '$$AnimateRunner', '$$HashMap', '$$rAFScheduler', + function($$jqLite, $rootScope, $injector, $$AnimateRunner, $$HashMap, $$rAFScheduler) { + + var animationQueue = []; + var applyAnimationClasses = applyAnimationClassesFactory($$jqLite); + + function sortAnimations(animations) { + var tree = { children: [] }; + var i, lookup = new $$HashMap(); + + // this is done first beforehand so that the hashmap + // is filled with a list of the elements that will be animated + for (i = 0; i < animations.length; i++) { + var animation = animations[i]; + lookup.put(animation.domNode, animations[i] = { + domNode: animation.domNode, + fn: animation.fn, + children: [] + }); + } + + for (i = 0; i < animations.length; i++) { + processNode(animations[i]); + } + + return flatten(tree); + + function processNode(entry) { + if (entry.processed) return entry; + entry.processed = true; + + var elementNode = entry.domNode; + var parentNode = elementNode.parentNode; + lookup.put(elementNode, entry); + + var parentEntry; + while (parentNode) { + parentEntry = lookup.get(parentNode); + if (parentEntry) { + if (!parentEntry.processed) { + parentEntry = processNode(parentEntry); + } + break; + } + parentNode = parentNode.parentNode; + } + + (parentEntry || tree).children.push(entry); + return entry; + } + + function flatten(tree) { + var result = []; + var queue = []; + var i; + + for (i = 0; i < tree.children.length; i++) { + queue.push(tree.children[i]); + } + + var remainingLevelEntries = queue.length; + var nextLevelEntries = 0; + var row = []; + + for (i = 0; i < queue.length; i++) { + var entry = queue[i]; + if (remainingLevelEntries <= 0) { + remainingLevelEntries = nextLevelEntries; + nextLevelEntries = 0; + result.push(row); + row = []; + } + row.push(entry.fn); + entry.children.forEach(function(childEntry) { + nextLevelEntries++; + queue.push(childEntry); + }); + remainingLevelEntries--; + } + + if (row.length) { + result.push(row); + } + + return result; + } + } + + // TODO(matsko): document the signature in a better way + return function(element, event, options) { + options = prepareAnimationOptions(options); + var isStructural = ['enter', 'move', 'leave'].indexOf(event) >= 0; + + // there is no animation at the current moment, however + // these runner methods will get later updated with the + // methods leading into the driver's end/cancel methods + // for now they just stop the animation from starting + var runner = new $$AnimateRunner({ + end: function() { close(); }, + cancel: function() { close(true); } + }); + + if (!drivers.length) { + close(); + return runner; + } + + setRunner(element, runner); + + var classes = mergeClasses(element.attr('class'), mergeClasses(options.addClass, options.removeClass)); + var tempClasses = options.tempClasses; + if (tempClasses) { + classes += ' ' + tempClasses; + options.tempClasses = null; + } + + animationQueue.push({ + // this data is used by the postDigest code and passed into + // the driver step function + element: element, + classes: classes, + event: event, + structural: isStructural, + options: options, + beforeStart: beforeStart, + close: close + }); + + element.on('$destroy', handleDestroyedElement); + + // we only want there to be one function called within the post digest + // block. This way we can group animations for all the animations that + // were apart of the same postDigest flush call. + if (animationQueue.length > 1) return runner; + + $rootScope.$$postDigest(function() { + var animations = []; + forEach(animationQueue, function(entry) { + // the element was destroyed early on which removed the runner + // form its storage. This means we can't animate this element + // at all and it already has been closed due to destruction. + if (getRunner(entry.element)) { + animations.push(entry); + } else { + entry.close(); + } + }); + + // now any future animations will be in another postDigest + animationQueue.length = 0; + + var groupedAnimations = groupAnimations(animations); + var toBeSortedAnimations = []; + + forEach(groupedAnimations, function(animationEntry) { + toBeSortedAnimations.push({ + domNode: getDomNode(animationEntry.from ? animationEntry.from.element : animationEntry.element), + fn: function triggerAnimationStart() { + // it's important that we apply the `ng-animate` CSS class and the + // temporary classes before we do any driver invoking since these + // CSS classes may be required for proper CSS detection. + animationEntry.beforeStart(); + + var startAnimationFn, closeFn = animationEntry.close; + + // in the event that the element was removed before the digest runs or + // during the RAF sequencing then we should not trigger the animation. + var targetElement = animationEntry.anchors + ? (animationEntry.from.element || animationEntry.to.element) + : animationEntry.element; + + if (getRunner(targetElement)) { + var operation = invokeFirstDriver(animationEntry); + if (operation) { + startAnimationFn = operation.start; + } + } + + if (!startAnimationFn) { + closeFn(); + } else { + var animationRunner = startAnimationFn(); + animationRunner.done(function(status) { + closeFn(!status); + }); + updateAnimationRunners(animationEntry, animationRunner); + } + } + }); + }); + + // we need to sort each of the animations in order of parent to child + // relationships. This ensures that the child classes are applied at the + // right time. + $$rAFScheduler(sortAnimations(toBeSortedAnimations)); + }); + + return runner; + + // TODO(matsko): change to reference nodes + function getAnchorNodes(node) { + var SELECTOR = '[' + NG_ANIMATE_REF_ATTR + ']'; + var items = node.hasAttribute(NG_ANIMATE_REF_ATTR) + ? [node] + : node.querySelectorAll(SELECTOR); + var anchors = []; + forEach(items, function(node) { + var attr = node.getAttribute(NG_ANIMATE_REF_ATTR); + if (attr && attr.length) { + anchors.push(node); + } + }); + return anchors; + } + + function groupAnimations(animations) { + var preparedAnimations = []; + var refLookup = {}; + forEach(animations, function(animation, index) { + var element = animation.element; + var node = getDomNode(element); + var event = animation.event; + var enterOrMove = ['enter', 'move'].indexOf(event) >= 0; + var anchorNodes = animation.structural ? getAnchorNodes(node) : []; + + if (anchorNodes.length) { + var direction = enterOrMove ? 'to' : 'from'; + + forEach(anchorNodes, function(anchor) { + var key = anchor.getAttribute(NG_ANIMATE_REF_ATTR); + refLookup[key] = refLookup[key] || {}; + refLookup[key][direction] = { + animationID: index, + element: jqLite(anchor) + }; + }); + } else { + preparedAnimations.push(animation); + } + }); + + var usedIndicesLookup = {}; + var anchorGroups = {}; + forEach(refLookup, function(operations, key) { + var from = operations.from; + var to = operations.to; + + if (!from || !to) { + // only one of these is set therefore we can't have an + // anchor animation since all three pieces are required + var index = from ? from.animationID : to.animationID; + var indexKey = index.toString(); + if (!usedIndicesLookup[indexKey]) { + usedIndicesLookup[indexKey] = true; + preparedAnimations.push(animations[index]); + } + return; + } + + var fromAnimation = animations[from.animationID]; + var toAnimation = animations[to.animationID]; + var lookupKey = from.animationID.toString(); + if (!anchorGroups[lookupKey]) { + var group = anchorGroups[lookupKey] = { + structural: true, + beforeStart: function() { + fromAnimation.beforeStart(); + toAnimation.beforeStart(); + }, + close: function() { + fromAnimation.close(); + toAnimation.close(); + }, + classes: cssClassesIntersection(fromAnimation.classes, toAnimation.classes), + from: fromAnimation, + to: toAnimation, + anchors: [] // TODO(matsko): change to reference nodes + }; + + // the anchor animations require that the from and to elements both have at least + // one shared CSS class which effictively marries the two elements together to use + // the same animation driver and to properly sequence the anchor animation. + if (group.classes.length) { + preparedAnimations.push(group); + } else { + preparedAnimations.push(fromAnimation); + preparedAnimations.push(toAnimation); + } + } + + anchorGroups[lookupKey].anchors.push({ + 'out': from.element, 'in': to.element + }); + }); + + return preparedAnimations; + } + + function cssClassesIntersection(a,b) { + a = a.split(' '); + b = b.split(' '); + var matches = []; + + for (var i = 0; i < a.length; i++) { + var aa = a[i]; + if (aa.substring(0,3) === 'ng-') continue; + + for (var j = 0; j < b.length; j++) { + if (aa === b[j]) { + matches.push(aa); + break; + } + } + } + + return matches.join(' '); + } + + function invokeFirstDriver(animationDetails) { + // we loop in reverse order since the more general drivers (like CSS and JS) + // may attempt more elements, but custom drivers are more particular + for (var i = drivers.length - 1; i >= 0; i--) { + var driverName = drivers[i]; + if (!$injector.has(driverName)) continue; // TODO(matsko): remove this check + + var factory = $injector.get(driverName); + var driver = factory(animationDetails); + if (driver) { + return driver; + } + } + } + + function beforeStart() { + element.addClass(NG_ANIMATE_CLASSNAME); + if (tempClasses) { + $$jqLite.addClass(element, tempClasses); + } + } + + function updateAnimationRunners(animation, newRunner) { + if (animation.from && animation.to) { + update(animation.from.element); + update(animation.to.element); + } else { + update(animation.element); + } + + function update(element) { + getRunner(element).setHost(newRunner); + } + } + + function handleDestroyedElement() { + var runner = getRunner(element); + if (runner && (event !== 'leave' || !options.$$domOperationFired)) { + runner.end(); + } + } + + function close(rejected) { // jshint ignore:line + element.off('$destroy', handleDestroyedElement); + removeRunner(element); + + applyAnimationClasses(element, options); + applyAnimationStyles(element, options); + options.domOperation(); + + if (tempClasses) { + $$jqLite.removeClass(element, tempClasses); + } + + element.removeClass(NG_ANIMATE_CLASSNAME); + runner.complete(!rejected); + } + }; + }]; +}]; + +/* global angularAnimateModule: true, + + $$AnimateAsyncRunFactory, + $$rAFSchedulerFactory, + $$AnimateChildrenDirective, + $$AnimateRunnerFactory, + $$AnimateQueueProvider, + $$AnimationProvider, + $AnimateCssProvider, + $$AnimateCssDriverProvider, + $$AnimateJsProvider, + $$AnimateJsDriverProvider, +*/ + +/** + * @ngdoc module + * @name ngAnimate + * @description + * + * The `ngAnimate` module provides support for CSS-based animations (keyframes and transitions) as well as JavaScript-based animations via + * callback hooks. Animations are not enabled by default, however, by including `ngAnimate` the animation hooks are enabled for an Angular app. + * + *
        + * + * # Usage + * Simply put, there are two ways to make use of animations when ngAnimate is used: by using **CSS** and **JavaScript**. The former works purely based + * using CSS (by using matching CSS selectors/styles) and the latter triggers animations that are registered via `module.animation()`. For + * both CSS and JS animations the sole requirement is to have a matching `CSS class` that exists both in the registered animation and within + * the HTML element that the animation will be triggered on. + * + * ## Directive Support + * The following directives are "animation aware": + * + * | Directive | Supported Animations | + * |----------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------| + * | {@link ng.directive:ngRepeat#animations ngRepeat} | enter, leave and move | + * | {@link ngRoute.directive:ngView#animations ngView} | enter and leave | + * | {@link ng.directive:ngInclude#animations ngInclude} | enter and leave | + * | {@link ng.directive:ngSwitch#animations ngSwitch} | enter and leave | + * | {@link ng.directive:ngIf#animations ngIf} | enter and leave | + * | {@link ng.directive:ngClass#animations ngClass} | add and remove (the CSS class(es) present) | + * | {@link ng.directive:ngShow#animations ngShow} & {@link ng.directive:ngHide#animations ngHide} | add and remove (the ng-hide class value) | + * | {@link ng.directive:form#animation-hooks form} & {@link ng.directive:ngModel#animation-hooks ngModel} | add and remove (dirty, pristine, valid, invalid & all other validations) | + * | {@link module:ngMessages#animations ngMessages} | add and remove (ng-active & ng-inactive) | + * | {@link module:ngMessages#animations ngMessage} | enter and leave | + * + * (More information can be found by visiting each the documentation associated with each directive.) + * + * ## CSS-based Animations + * + * CSS-based animations with ngAnimate are unique since they require no JavaScript code at all. By using a CSS class that we reference between our HTML + * and CSS code we can create an animation that will be picked up by Angular when an the underlying directive performs an operation. + * + * The example below shows how an `enter` animation can be made possible on an element using `ng-if`: + * + * ```html + *
        + * Fade me in out + *
        + * + * + * ``` + * + * Notice the CSS class **fade**? We can now create the CSS transition code that references this class: + * + * ```css + * /* The starting CSS styles for the enter animation */ + * .fade.ng-enter { + * transition:0.5s linear all; + * opacity:0; + * } + * + * /* The finishing CSS styles for the enter animation */ + * .fade.ng-enter.ng-enter-active { + * opacity:1; + * } + * ``` + * + * The key thing to remember here is that, depending on the animation event (which each of the directives above trigger depending on what's going on) two + * generated CSS classes will be applied to the element; in the example above we have `.ng-enter` and `.ng-enter-active`. For CSS transitions, the transition + * code **must** be defined within the starting CSS class (in this case `.ng-enter`). The destination class is what the transition will animate towards. + * + * If for example we wanted to create animations for `leave` and `move` (ngRepeat triggers move) then we can do so using the same CSS naming conventions: + * + * ```css + * /* now the element will fade out before it is removed from the DOM */ + * .fade.ng-leave { + * transition:0.5s linear all; + * opacity:1; + * } + * .fade.ng-leave.ng-leave-active { + * opacity:0; + * } + * ``` + * + * We can also make use of **CSS Keyframes** by referencing the keyframe animation within the starting CSS class: + * + * ```css + * /* there is no need to define anything inside of the destination + * CSS class since the keyframe will take charge of the animation */ + * .fade.ng-leave { + * animation: my_fade_animation 0.5s linear; + * -webkit-animation: my_fade_animation 0.5s linear; + * } + * + * @keyframes my_fade_animation { + * from { opacity:1; } + * to { opacity:0; } + * } + * + * @-webkit-keyframes my_fade_animation { + * from { opacity:1; } + * to { opacity:0; } + * } + * ``` + * + * Feel free also mix transitions and keyframes together as well as any other CSS classes on the same element. + * + * ### CSS Class-based Animations + * + * Class-based animations (animations that are triggered via `ngClass`, `ngShow`, `ngHide` and some other directives) have a slightly different + * naming convention. Class-based animations are basic enough that a standard transition or keyframe can be referenced on the class being added + * and removed. + * + * For example if we wanted to do a CSS animation for `ngHide` then we place an animation on the `.ng-hide` CSS class: + * + * ```html + *
        + * Show and hide me + *
        + * + * + * + * ``` + * + * All that is going on here with ngShow/ngHide behind the scenes is the `.ng-hide` class is added/removed (when the hidden state is valid). Since + * ngShow and ngHide are animation aware then we can match up a transition and ngAnimate handles the rest. + * + * In addition the addition and removal of the CSS class, ngAnimate also provides two helper methods that we can use to further decorate the animation + * with CSS styles. + * + * ```html + *
        + * Highlight this box + *
        + * + * + * + * ``` + * + * We can also make use of CSS keyframes by placing them within the CSS classes. + * + * + * ### CSS Staggering Animations + * A Staggering animation is a collection of animations that are issued with a slight delay in between each successive operation resulting in a + * curtain-like effect. The ngAnimate module (versions >=1.2) supports staggering animations and the stagger effect can be + * performed by creating a **ng-EVENT-stagger** CSS class and attaching that class to the base CSS class used for + * the animation. The style property expected within the stagger class can either be a **transition-delay** or an + * **animation-delay** property (or both if your animation contains both transitions and keyframe animations). + * + * ```css + * .my-animation.ng-enter { + * /* standard transition code */ + * transition: 1s linear all; + * opacity:0; + * } + * .my-animation.ng-enter-stagger { + * /* this will have a 100ms delay between each successive leave animation */ + * transition-delay: 0.1s; + * + * /* As of 1.4.4, this must always be set: it signals ngAnimate + * to not accidentally inherit a delay property from another CSS class */ + * transition-duration: 0s; + * } + * .my-animation.ng-enter.ng-enter-active { + * /* standard transition styles */ + * opacity:1; + * } + * ``` + * + * Staggering animations work by default in ngRepeat (so long as the CSS class is defined). Outside of ngRepeat, to use staggering animations + * on your own, they can be triggered by firing multiple calls to the same event on $animate. However, the restrictions surrounding this + * are that each of the elements must have the same CSS className value as well as the same parent element. A stagger operation + * will also be reset if one or more animation frames have passed since the multiple calls to `$animate` were fired. + * + * The following code will issue the **ng-leave-stagger** event on the element provided: + * + * ```js + * var kids = parent.children(); + * + * $animate.leave(kids[0]); //stagger index=0 + * $animate.leave(kids[1]); //stagger index=1 + * $animate.leave(kids[2]); //stagger index=2 + * $animate.leave(kids[3]); //stagger index=3 + * $animate.leave(kids[4]); //stagger index=4 + * + * window.requestAnimationFrame(function() { + * //stagger has reset itself + * $animate.leave(kids[5]); //stagger index=0 + * $animate.leave(kids[6]); //stagger index=1 + * + * $scope.$digest(); + * }); + * ``` + * + * Stagger animations are currently only supported within CSS-defined animations. + * + * ### The `ng-animate` CSS class + * + * When ngAnimate is animating an element it will apply the `ng-animate` CSS class to the element for the duration of the animation. + * This is a temporary CSS class and it will be removed once the animation is over (for both JavaScript and CSS-based animations). + * + * Therefore, animations can be applied to an element using this temporary class directly via CSS. + * + * ```css + * .zipper.ng-animate { + * transition:0.5s linear all; + * } + * .zipper.ng-enter { + * opacity:0; + * } + * .zipper.ng-enter.ng-enter-active { + * opacity:1; + * } + * .zipper.ng-leave { + * opacity:1; + * } + * .zipper.ng-leave.ng-leave-active { + * opacity:0; + * } + * ``` + * + * (Note that the `ng-animate` CSS class is reserved and it cannot be applied on an element directly since ngAnimate will always remove + * the CSS class once an animation has completed.) + * + * + * ## JavaScript-based Animations + * + * ngAnimate also allows for animations to be consumed by JavaScript code. The approach is similar to CSS-based animations (where there is a shared + * CSS class that is referenced in our HTML code) but in addition we need to register the JavaScript animation on the module. By making use of the + * `module.animation()` module function we can register the ainmation. + * + * Let's see an example of a enter/leave animation using `ngRepeat`: + * + * ```html + *
        + * {{ item }} + *
        + * ``` + * + * See the **slide** CSS class? Let's use that class to define an animation that we'll structure in our module code by using `module.animation`: + * + * ```js + * myModule.animation('.slide', [function() { + * return { + * // make note that other events (like addClass/removeClass) + * // have different function input parameters + * enter: function(element, doneFn) { + * jQuery(element).fadeIn(1000, doneFn); + * + * // remember to call doneFn so that angular + * // knows that the animation has concluded + * }, + * + * move: function(element, doneFn) { + * jQuery(element).fadeIn(1000, doneFn); + * }, + * + * leave: function(element, doneFn) { + * jQuery(element).fadeOut(1000, doneFn); + * } + * } + * }]); + * ``` + * + * The nice thing about JS-based animations is that we can inject other services and make use of advanced animation libraries such as + * greensock.js and velocity.js. + * + * If our animation code class-based (meaning that something like `ngClass`, `ngHide` and `ngShow` triggers it) then we can still define + * our animations inside of the same registered animation, however, the function input arguments are a bit different: + * + * ```html + *
        + * this box is moody + *
        + * + * + * + * ``` + * + * ```js + * myModule.animation('.colorful', [function() { + * return { + * addClass: function(element, className, doneFn) { + * // do some cool animation and call the doneFn + * }, + * removeClass: function(element, className, doneFn) { + * // do some cool animation and call the doneFn + * }, + * setClass: function(element, addedClass, removedClass, doneFn) { + * // do some cool animation and call the doneFn + * } + * } + * }]); + * ``` + * + * ## CSS + JS Animations Together + * + * AngularJS 1.4 and higher has taken steps to make the amalgamation of CSS and JS animations more flexible. However, unlike earlier versions of Angular, + * defining CSS and JS animations to work off of the same CSS class will not work anymore. Therefore the example below will only result in **JS animations taking + * charge of the animation**: + * + * ```html + *
        + * Slide in and out + *
        + * ``` + * + * ```js + * myModule.animation('.slide', [function() { + * return { + * enter: function(element, doneFn) { + * jQuery(element).slideIn(1000, doneFn); + * } + * } + * }]); + * ``` + * + * ```css + * .slide.ng-enter { + * transition:0.5s linear all; + * transform:translateY(-100px); + * } + * .slide.ng-enter.ng-enter-active { + * transform:translateY(0); + * } + * ``` + * + * Does this mean that CSS and JS animations cannot be used together? Do JS-based animations always have higher priority? We can make up for the + * lack of CSS animations by using the `$animateCss` service to trigger our own tweaked-out, CSS-based animations directly from + * our own JS-based animation code: + * + * ```js + * myModule.animation('.slide', ['$animateCss', function($animateCss) { + * return { + * enter: function(element) { +* // this will trigger `.slide.ng-enter` and `.slide.ng-enter-active`. + * return $animateCss(element, { + * event: 'enter', + * structural: true + * }); + * } + * } + * }]); + * ``` + * + * The nice thing here is that we can save bandwidth by sticking to our CSS-based animation code and we don't need to rely on a 3rd-party animation framework. + * + * The `$animateCss` service is very powerful since we can feed in all kinds of extra properties that will be evaluated and fed into a CSS transition or + * keyframe animation. For example if we wanted to animate the height of an element while adding and removing classes then we can do so by providing that + * data into `$animateCss` directly: + * + * ```js + * myModule.animation('.slide', ['$animateCss', function($animateCss) { + * return { + * enter: function(element) { + * return $animateCss(element, { + * event: 'enter', + * structural: true, + * addClass: 'maroon-setting', + * from: { height:0 }, + * to: { height: 200 } + * }); + * } + * } + * }]); + * ``` + * + * Now we can fill in the rest via our transition CSS code: + * + * ```css + * /* the transition tells ngAnimate to make the animation happen */ + * .slide.ng-enter { transition:0.5s linear all; } + * + * /* this extra CSS class will be absorbed into the transition + * since the $animateCss code is adding the class */ + * .maroon-setting { background:red; } + * ``` + * + * And `$animateCss` will figure out the rest. Just make sure to have the `done()` callback fire the `doneFn` function to signal when the animation is over. + * + * To learn more about what's possible be sure to visit the {@link ngAnimate.$animateCss $animateCss service}. + * + * ## Animation Anchoring (via `ng-animate-ref`) + * + * ngAnimate in AngularJS 1.4 comes packed with the ability to cross-animate elements between + * structural areas of an application (like views) by pairing up elements using an attribute + * called `ng-animate-ref`. + * + * Let's say for example we have two views that are managed by `ng-view` and we want to show + * that there is a relationship between two components situated in within these views. By using the + * `ng-animate-ref` attribute we can identify that the two components are paired together and we + * can then attach an animation, which is triggered when the view changes. + * + * Say for example we have the following template code: + * + * ```html + * + *
        + *
        + * + * + * + * + * + * + * + * + * ``` + * + * Now, when the view changes (once the link is clicked), ngAnimate will examine the + * HTML contents to see if there is a match reference between any components in the view + * that is leaving and the view that is entering. It will scan both the view which is being + * removed (leave) and inserted (enter) to see if there are any paired DOM elements that + * contain a matching ref value. + * + * The two images match since they share the same ref value. ngAnimate will now create a + * transport element (which is a clone of the first image element) and it will then attempt + * to animate to the position of the second image element in the next view. For the animation to + * work a special CSS class called `ng-anchor` will be added to the transported element. + * + * We can now attach a transition onto the `.banner.ng-anchor` CSS class and then + * ngAnimate will handle the entire transition for us as well as the addition and removal of + * any changes of CSS classes between the elements: + * + * ```css + * .banner.ng-anchor { + * /* this animation will last for 1 second since there are + * two phases to the animation (an `in` and an `out` phase) */ + * transition:0.5s linear all; + * } + * ``` + * + * We also **must** include animations for the views that are being entered and removed + * (otherwise anchoring wouldn't be possible since the new view would be inserted right away). + * + * ```css + * .view-animation.ng-enter, .view-animation.ng-leave { + * transition:0.5s linear all; + * position:fixed; + * left:0; + * top:0; + * width:100%; + * } + * .view-animation.ng-enter { + * transform:translateX(100%); + * } + * .view-animation.ng-leave, + * .view-animation.ng-enter.ng-enter-active { + * transform:translateX(0%); + * } + * .view-animation.ng-leave.ng-leave-active { + * transform:translateX(-100%); + * } + * ``` + * + * Now we can jump back to the anchor animation. When the animation happens, there are two stages that occur: + * an `out` and an `in` stage. The `out` stage happens first and that is when the element is animated away + * from its origin. Once that animation is over then the `in` stage occurs which animates the + * element to its destination. The reason why there are two animations is to give enough time + * for the enter animation on the new element to be ready. + * + * The example above sets up a transition for both the in and out phases, but we can also target the out or + * in phases directly via `ng-anchor-out` and `ng-anchor-in`. + * + * ```css + * .banner.ng-anchor-out { + * transition: 0.5s linear all; + * + * /* the scale will be applied during the out animation, + * but will be animated away when the in animation runs */ + * transform: scale(1.2); + * } + * + * .banner.ng-anchor-in { + * transition: 1s linear all; + * } + * ``` + * + * + * + * + * ### Anchoring Demo + * + + + Home +
        +
        +
        +
        +
        + + angular.module('anchoringExample', ['ngAnimate', 'ngRoute']) + .config(['$routeProvider', function($routeProvider) { + $routeProvider.when('/', { + templateUrl: 'home.html', + controller: 'HomeController as home' + }); + $routeProvider.when('/profile/:id', { + templateUrl: 'profile.html', + controller: 'ProfileController as profile' + }); + }]) + .run(['$rootScope', function($rootScope) { + $rootScope.records = [ + { id:1, title: "Miss Beulah Roob" }, + { id:2, title: "Trent Morissette" }, + { id:3, title: "Miss Ava Pouros" }, + { id:4, title: "Rod Pouros" }, + { id:5, title: "Abdul Rice" }, + { id:6, title: "Laurie Rutherford Sr." }, + { id:7, title: "Nakia McLaughlin" }, + { id:8, title: "Jordon Blanda DVM" }, + { id:9, title: "Rhoda Hand" }, + { id:10, title: "Alexandrea Sauer" } + ]; + }]) + .controller('HomeController', [function() { + //empty + }]) + .controller('ProfileController', ['$rootScope', '$routeParams', function($rootScope, $routeParams) { + var index = parseInt($routeParams.id, 10); + var record = $rootScope.records[index - 1]; + + this.title = record.title; + this.id = record.id; + }]); + + +

        Welcome to the home page

        +

        Please click on an element

        + + {{ record.title }} + +
        + +
        + {{ profile.title }} +
        +
        + + .record { + display:block; + font-size:20px; + } + .profile { + background:black; + color:white; + font-size:100px; + } + .view-container { + position:relative; + } + .view-container > .view.ng-animate { + position:absolute; + top:0; + left:0; + width:100%; + min-height:500px; + } + .view.ng-enter, .view.ng-leave, + .record.ng-anchor { + transition:0.5s linear all; + } + .view.ng-enter { + transform:translateX(100%); + } + .view.ng-enter.ng-enter-active, .view.ng-leave { + transform:translateX(0%); + } + .view.ng-leave.ng-leave-active { + transform:translateX(-100%); + } + .record.ng-anchor-out { + background:red; + } + +
        + * + * ### How is the element transported? + * + * When an anchor animation occurs, ngAnimate will clone the starting element and position it exactly where the starting + * element is located on screen via absolute positioning. The cloned element will be placed inside of the root element + * of the application (where ng-app was defined) and all of the CSS classes of the starting element will be applied. The + * element will then animate into the `out` and `in` animations and will eventually reach the coordinates and match + * the dimensions of the destination element. During the entire animation a CSS class of `.ng-animate-shim` will be applied + * to both the starting and destination elements in order to hide them from being visible (the CSS styling for the class + * is: `visibility:hidden`). Once the anchor reaches its destination then it will be removed and the destination element + * will become visible since the shim class will be removed. + * + * ### How is the morphing handled? + * + * CSS Anchoring relies on transitions and keyframes and the internal code is intelligent enough to figure out + * what CSS classes differ between the starting element and the destination element. These different CSS classes + * will be added/removed on the anchor element and a transition will be applied (the transition that is provided + * in the anchor class). Long story short, ngAnimate will figure out what classes to add and remove which will + * make the transition of the element as smooth and automatic as possible. Be sure to use simple CSS classes that + * do not rely on DOM nesting structure so that the anchor element appears the same as the starting element (since + * the cloned element is placed inside of root element which is likely close to the body element). + * + * Note that if the root element is on the `` element then the cloned node will be placed inside of body. + * + * + * ## Using $animate in your directive code + * + * So far we've explored how to feed in animations into an Angular application, but how do we trigger animations within our own directives in our application? + * By injecting the `$animate` service into our directive code, we can trigger structural and class-based hooks which can then be consumed by animations. Let's + * imagine we have a greeting box that shows and hides itself when the data changes + * + * ```html + * Hi there + * ``` + * + * ```js + * ngModule.directive('greetingBox', ['$animate', function($animate) { + * return function(scope, element, attrs) { + * attrs.$observe('active', function(value) { + * value ? $animate.addClass(element, 'on') : $animate.removeClass(element, 'on'); + * }); + * }); + * }]); + * ``` + * + * Now the `on` CSS class is added and removed on the greeting box component. Now if we add a CSS class on top of the greeting box element + * in our HTML code then we can trigger a CSS or JS animation to happen. + * + * ```css + * /* normally we would create a CSS class to reference on the element */ + * greeting-box.on { transition:0.5s linear all; background:green; color:white; } + * ``` + * + * The `$animate` service contains a variety of other methods like `enter`, `leave`, `animate` and `setClass`. To learn more about what's + * possible be sure to visit the {@link ng.$animate $animate service API page}. + * + * + * ### Preventing Collisions With Third Party Libraries + * + * Some third-party frameworks place animation duration defaults across many element or className + * selectors in order to make their code small and reuseable. This can lead to issues with ngAnimate, which + * is expecting actual animations on these elements and has to wait for their completion. + * + * You can prevent this unwanted behavior by using a prefix on all your animation classes: + * + * ```css + * /* prefixed with animate- */ + * .animate-fade-add.animate-fade-add-active { + * transition:1s linear all; + * opacity:0; + * } + * ``` + * + * You then configure `$animate` to enforce this prefix: + * + * ```js + * $animateProvider.classNameFilter(/animate-/); + * ``` + * + * This also may provide your application with a speed boost since only specific elements containing CSS class prefix + * will be evaluated for animation when any DOM changes occur in the application. + * + * ## Callbacks and Promises + * + * When `$animate` is called it returns a promise that can be used to capture when the animation has ended. Therefore if we were to trigger + * an animation (within our directive code) then we can continue performing directive and scope related activities after the animation has + * ended by chaining onto the returned promise that animation method returns. + * + * ```js + * // somewhere within the depths of the directive + * $animate.enter(element, parent).then(function() { + * //the animation has completed + * }); + * ``` + * + * (Note that earlier versions of Angular prior to v1.4 required the promise code to be wrapped using `$scope.$apply(...)`. This is not the case + * anymore.) + * + * In addition to the animation promise, we can also make use of animation-related callbacks within our directives and controller code by registering + * an event listener using the `$animate` service. Let's say for example that an animation was triggered on our view + * routing controller to hook into that: + * + * ```js + * ngModule.controller('HomePageController', ['$animate', function($animate) { + * $animate.on('enter', ngViewElement, function(element) { + * // the animation for this route has completed + * }]); + * }]) + * ``` + * + * (Note that you will need to trigger a digest within the callback to get angular to notice any scope-related changes.) + */ + +/** + * @ngdoc service + * @name $animate + * @kind object + * + * @description + * The ngAnimate `$animate` service documentation is the same for the core `$animate` service. + * + * Click here {@link ng.$animate to learn more about animations with `$animate`}. + */ +angular.module('ngAnimate', []) + .directive('ngAnimateChildren', $$AnimateChildrenDirective) + .factory('$$rAFScheduler', $$rAFSchedulerFactory) + + .factory('$$AnimateRunner', $$AnimateRunnerFactory) + .factory('$$animateAsyncRun', $$AnimateAsyncRunFactory) + + .provider('$$animateQueue', $$AnimateQueueProvider) + .provider('$$animation', $$AnimationProvider) + + .provider('$animateCss', $AnimateCssProvider) + .provider('$$animateCssDriver', $$AnimateCssDriverProvider) + + .provider('$$animateJs', $$AnimateJsProvider) + .provider('$$animateJsDriver', $$AnimateJsDriverProvider); + + +})(window, window.angular); diff --git a/public/bower_components/angular-audio/angular.audio.js b/public/bower_components/angular-audio/angular.audio.js new file mode 100644 index 0000000..f2c40b8 --- /dev/null +++ b/public/bower_components/angular-audio/angular.audio.js @@ -0,0 +1,490 @@ +'use strict'; +angular.module('ngAudio', []) +.directive('ngAudio', ['$compile', '$q', 'ngAudio', function($compile, $q, ngAudio) { + return { + restrict: 'AEC', + scope: { + volume: '=', + start: '=', + currentTime: '=', + loop: '=', + clickPlay: '=', + disablePreload:'=' + //ngAudio:'=' + }, + controller: function($scope, $attrs, $element, $timeout) { + + /* Loads the sound from destination */ + var audio; + function initSound(){ + audio = ngAudio.load($attrs.ngAudio, $scope); + /* Add audio to local scope for modification with nested inputs */ + $scope.$audio = audio; + + /* Remove watching features for improved performance */ + audio.unbind(); + } + + if (!$scope.disablePreload){ + initSound(); + } + + + $element.on('click', function() { + if ($scope.clickPlay === false) { + return; + } + + if ($scope.disablePreload){ + initSound(); + } + + /* iOS workaround: Call the play method directly in listener function */ + audio.audio.play(); + + /* Set volume to $scope volume if it exists, or default to audio's current value */ + audio.volume = $scope.volume || audio.volume; + audio.loop = $scope.loop; + audio.currentTime = $scope.start || 0; + + /* Fixes a bug with Firefox (???) */ + $timeout(function() { + audio.play(); + }, 5); + }); + + $element.on('$destroy', function() { + audio.destroy(); + }); + } + }; +}]) + +.directive('ngAudioHover', ['$compile', '$q', 'ngAudio', function($compile, $q, ngAudio) { + return { + restrict: 'AEC', + controller: function($scope, $attrs, $element, $timeout) { + + var audio = ngAudio.load($attrs.ngAudioHover, $scope); + + $element.on('mouseover rollover hover', function() { + + /* iOS workaround: Call the play method directly in listener function */ + audio.audio.play(); + + audio.volume = $attrs.volumeHover || audio.volume; + audio.loop = $attrs.loop; + audio.currentTime = $attrs.startHover || 0; + + }); + + $element.on('$destroy', function() { + audio.destroy(); + }); + } + }; +}]) + +.service('localAudioFindingService', ['$q', function($q) { + + this.find = function(id) { + var deferred = $q.defer(); + var $sound = document.getElementById(id); + if ($sound) { + deferred.resolve($sound); + } else { + deferred.reject(id); + } + + return deferred.promise; + }; +}]) + +.service('remoteAudioFindingService', ['$q', function($q) { + + this.find = function(url) { + var deferred = $q.defer(); + var audio = new Audio(); + + audio.addEventListener('error', function() { + deferred.reject(); + }); + + audio.addEventListener('loadstart', function() { + deferred.resolve(audio); + }); + + // bugfix for chrome... + setTimeout(function() { + audio.src = url; + }, 1); + + return deferred.promise; + + }; +}]) + +.service('cleverAudioFindingService', ['$q', 'localAudioFindingService', 'remoteAudioFindingService', function($q, localAudioFindingService, remoteAudioFindingService) { + this.find = function(id) { + var deferred = $q.defer(); + + id = id.replace('|', '/'); + + localAudioFindingService.find(id) + .then(deferred.resolve, function() { + return remoteAudioFindingService.find(id); + }) + .then(deferred.resolve, deferred.reject); + + return deferred.promise; + }; +}]) + +.value('ngAudioGlobals', { + muting: false, + songmuting: false, + performance: 25, + unlock: true +}) + +.factory('NgAudioObject', ['cleverAudioFindingService', '$rootScope', '$interval', '$timeout', 'ngAudioGlobals', function(cleverAudioFindingService, $rootScope, $interval, $timeout, ngAudioGlobals) { + return function(id, scope) { + + function twiddle(){ + audio.play(); + audio.pause(); + window.removeEventListener("click",twiddle); + } + + var $audioWatch, + $intervalWatch, + $willPlay = false, + $willPause = false, + $willRestart = false, + $willChangePlaybackRate = false, + $newPlaybackRate = false, + $volumeToSet, + $looping, + $isMuting = false, + $observeProperties = true, + $destroyed = false, + $scope = scope || $rootScope, + audio, + audioObject = this; + + this.id = id; + this.safeId = id.replace('/', '|'); + this.loop = 0; + + this.unbind = function() { + $observeProperties = false; + }; + + this.play = function() { + $willPlay = true; + return this; + }; + + var completeListeners = []; + this.complete = function(callback){ + completeListeners.push(callback); + } + + this.pause = function() { + $willPause = true; + }; + + this.restart = function() { + $willRestart = true; + }; + + this.stop = function() { + this.restart(); + }; + + this.setVolume = function(volume) { + $volumeToSet = volume; + }; + + this.setPlaybackRate = function(rate) { + $newPlaybackRate = rate; + $willChangePlaybackRate = true; + }; + + this.setMuting = function(muting) { + $isMuting = muting; + }; + + this.setProgress = function(progress) { + if (audio && audio.duration && isFinite(progress)) { + audio.currentTime = audio.duration * progress; + } + }; + + this.setCurrentTime = function(currentTime) { + if (audio && audio.duration) { + audio.currentTime = currentTime; + } + }; + + this.destroy = $destroy; + + $scope.$on('$destroy', function() { + $destroy(); + }); + + function $destroy() { + if (!$destroyed) { + if (interval) { + $interval.cancel(interval); + } + if ($intervalWatch) { + $intervalWatch(); + } + if ($audioWatch) { + $audioWatch(); + } + $destroyed = true; + } + } + + function $setWatch() { + if ($destroyed) { + return; + } + $audioWatch = $scope.$watch(function() { + return { + volume: audioObject.volume, + currentTime: audioObject.currentTime, + progress: audioObject.progress, + muting: audioObject.muting, + loop: audioObject.loop, + playbackRate: audioObject.playbackRate + }; + }, function(newValue, oldValue) { + //console.log("ngaudio watch callback for: " + audioObject.id); + if (newValue.currentTime !== oldValue.currentTime) { + audioObject.setCurrentTime(newValue.currentTime); + } + + if (newValue.progress !== oldValue.progress) { + audioObject.setProgress(newValue.progress); + } + if (newValue.volume !== oldValue.volume) { + audioObject.setVolume(newValue.volume); + } + + if (newValue.playbackRate !== oldValue.playbackRate) { + audioObject.setPlaybackRate(newValue.playbackRate); + } + + + + $looping = newValue.loop; + + if (newValue.muting !== oldValue.muting) { + audioObject.setMuting(newValue.muting); + } + }, true); + } + + cleverAudioFindingService.find(id) + .then(function(nativeAudio) { + audio = nativeAudio; + if (ngAudioGlobals.unlock) { + + window.addEventListener("click", twiddle); + + audio.addEventListener('playing', function() { + window.removeEventListener("click",twiddle); + }); + + } + + audio.addEventListener('canplay', function() { + audioObject.canPlay = true; + }); + + }, function(error) { + audioObject.error = true; + console.warn(error); + }); + + + var interval = $interval(checkWatchers, ngAudioGlobals.performance); + $intervalWatch = $scope.$watch(function(){ + return ngAudioGlobals.performance; + },function(){ + $interval.cancel(interval); + interval = $interval(checkWatchers, ngAudioGlobals.performance); + }) + + function checkWatchers() { + if ($audioWatch) { + $audioWatch(); + } + if (audio) { + + if ($isMuting || ngAudioGlobals.isMuting) { + audio.volume = 0; + } else { + audio.volume = audioObject.volume !== undefined ? audioObject.volume : 1; + } + + if ($willPlay) { + audio.play(); + $willPlay = false; + } + + if ($willRestart) { + audio.pause(); + audio.currentTime = 0; + $willRestart = false; + } + + if ($willPause) { + audio.pause(); + $willPause = false; + } + + if ($willChangePlaybackRate) { + audio.playbackRate = $newPlaybackRate; + $willChangePlaybackRate = false; + } + + if ($volumeToSet) { + audio.volume = $volumeToSet; + $volumeToSet = undefined; + } + + if ($observeProperties) { + audioObject.currentTime = audio.currentTime; + audioObject.duration = audio.duration; + audioObject.remaining = audio.duration - audio.currentTime; + audioObject.progress = audio.currentTime / audio.duration; + audioObject.paused = audio.paused; + audioObject.src = audio.src; + + if (audioObject.currentTime >= audioObject.duration) { + completeListeners.forEach(function(listener){ + listener(audioObject); + }) + } + + if ($looping && audioObject.currentTime >= audioObject.duration) { + if ($looping !== true) { + $looping--; + audioObject.loop--; + // if (!$looping) return; + } + audioObject.setCurrentTime(0); + audioObject.play(); + + } + } + + if (!$isMuting && !ngAudioGlobals.isMuting) { + audioObject.volume = audio.volume; + } + + audioObject.audio = audio; + } + + $setWatch(); + } + }; +}]) +.service('ngAudio', ['NgAudioObject', 'ngAudioGlobals', function(NgAudioObject, ngAudioGlobals) { + this.play = function(id, scope) { + + var audio = new NgAudioObject(id, scope); + audio.play(); + return audio; + }; + + this.load = function(id, scope) { + return new NgAudioObject(id, scope); + }; + + this.mute = function() { + ngAudioGlobals.muting = true; + }; + + this.unmute = function() { + ngAudioGlobals.muting = false; + }; + + this.toggleMute = function() { + ngAudioGlobals.muting = !ngAudioGlobals.muting; + }; + + this.setUnlock = function(unlock) { + ngAudioGlobals.unlock = unlock; + }; +}]) +.filter("trackTime", function(){ + /* Conveniently takes a number and returns the track time */ + + return function(input){ + + var totalSec = Math.floor(input | 0); + + var output = ""; + var hours = 0; + var minutes = 0; + var seconds = 0; + + if (totalSec > 3599) { + + hours = Math.floor(totalSec / 3600); + minutes = Math.floor((totalSec - (hours * 3600)) / 60); + seconds = (totalSec - ((minutes * 60) + (hours * 3600))); + + if (hours.toString().length == 1) { + hours = "0" + (Math.floor(totalSec / 3600)).toString(); + } + + if (minutes.toString().length == 1) { + minutes = "0" + (Math.floor((totalSec - (hours * 3600)) / 60)).toString(); + } + + if (seconds.toString().length == 1) { + seconds = "0" + (totalSec - ((minutes * 60) + (hours * 3600))).toString(); + } + + output = hours + ":" + minutes + ":" + seconds; + + } else if (totalSec > 59) { + + minutes = Math.floor(totalSec / 60); + seconds = totalSec - (minutes * 60); + + if (minutes.toString().length == 1) { + minutes = "0" + (Math.floor(totalSec / 60)).toString(); + } + + if (seconds.toString().length == 1) { + seconds = "0" + (totalSec - (minutes * 60)).toString(); + } + + output = minutes + ":" + seconds; + + } else { + + seconds = totalSec; + + if (seconds.toString().length == 1) { + seconds = "0" + (totalSec).toString(); + } + + output = totalSec + "s"; + + } + + if (typeof Number.isNaN === "function" && Number.isNaN(output)){ + debugger; + } + + return output; + } +}); diff --git a/public/bower_components/angular-bootstrap-colorpicker/bootstrap-colorpicker-module.js b/public/bower_components/angular-bootstrap-colorpicker/bootstrap-colorpicker-module.js new file mode 100644 index 0000000..f7137c1 --- /dev/null +++ b/public/bower_components/angular-bootstrap-colorpicker/bootstrap-colorpicker-module.js @@ -0,0 +1,567 @@ +angular.module('colorpicker.module', []) + .factory('Helper', function () { + 'use strict'; + return { + closestSlider: function (elem) { + var matchesSelector = elem.matches || elem.webkitMatchesSelector || elem.mozMatchesSelector || elem.msMatchesSelector; + if (matchesSelector.bind(elem)('I')) { + return elem.parentNode; + } + return elem; + }, + getOffset: function (elem, fixedPosition) { + var + scrollX = 0, + scrollY = 0, + rect = elem.getBoundingClientRect(); + while (elem && !isNaN(elem.offsetLeft) && !isNaN(elem.offsetTop)) { + if (!fixedPosition && elem.tagName === 'BODY') { + scrollX += document.documentElement.scrollLeft || elem.scrollLeft; + scrollY += document.documentElement.scrollTop || elem.scrollTop; + } else { + scrollX += elem.scrollLeft; + scrollY += elem.scrollTop; + } + elem = elem.offsetParent; + } + return { + top: rect.top + window.pageYOffset, + left: rect.left + window.pageXOffset, + scrollX: scrollX, + scrollY: scrollY + }; + }, + // a set of RE's that can match strings and generate color tuples. https://github.com/jquery/jquery-color/ + stringParsers: [ + { + re: /rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d+(?:\.\d+)?)\s*)?\)/, + parse: function (execResult) { + return [ + execResult[1], + execResult[2], + execResult[3], + execResult[4] + ]; + } + }, + { + re: /rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d+(?:\.\d+)?)\s*)?\)/, + parse: function (execResult) { + return [ + 2.55 * execResult[1], + 2.55 * execResult[2], + 2.55 * execResult[3], + execResult[4] + ]; + } + }, + { + re: /#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/, + parse: function (execResult) { + return [ + parseInt(execResult[1], 16), + parseInt(execResult[2], 16), + parseInt(execResult[3], 16) + ]; + } + }, + { + re: /#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/, + parse: function (execResult) { + return [ + parseInt(execResult[1] + execResult[1], 16), + parseInt(execResult[2] + execResult[2], 16), + parseInt(execResult[3] + execResult[3], 16) + ]; + } + } + ] + }; + }) + .factory('Color', ['Helper', function (Helper) { + 'use strict'; + return { + value: { + h: 1, + s: 1, + b: 1, + a: 1 + }, + // translate a format from Color object to a string + 'rgb': function () { + var rgb = this.toRGB(); + return 'rgb(' + rgb.r + ',' + rgb.g + ',' + rgb.b + ')'; + }, + 'rgba': function () { + var rgb = this.toRGB(); + return 'rgba(' + rgb.r + ',' + rgb.g + ',' + rgb.b + ',' + rgb.a + ')'; + }, + 'hex': function () { + return this.toHex(); + }, + + // HSBtoRGB from RaphaelJS + RGBtoHSB: function (r, g, b, a) { + r /= 255; + g /= 255; + b /= 255; + + var H, S, V, C; + V = Math.max(r, g, b); + C = V - Math.min(r, g, b); + H = (C === 0 ? null : + V === r ? (g - b) / C : + V === g ? (b - r) / C + 2 : + (r - g) / C + 4 + ); + H = ((H + 360) % 6) * 60 / 360; + S = C === 0 ? 0 : C / V; + return {h: H || 1, s: S, b: V, a: a || 1}; + }, + + //parse a string to HSB + setColor: function (val) { + val = val.toLowerCase(); + for (var key in Helper.stringParsers) { + if (Helper.stringParsers.hasOwnProperty(key)) { + var parser = Helper.stringParsers[key]; + var match = parser.re.exec(val), + values = match && parser.parse(match); + if (values) { + this.value = this.RGBtoHSB.apply(null, values); + return false; + } + } + } + }, + + setHue: function (h) { + this.value.h = 1 - h; + }, + + setSaturation: function (s) { + this.value.s = s; + }, + + setLightness: function (b) { + this.value.b = 1 - b; + }, + + setAlpha: function (a) { + this.value.a = parseInt((1 - a) * 100, 10) / 100; + }, + + // HSBtoRGB from RaphaelJS + // https://github.com/DmitryBaranovskiy/raphael/ + toRGB: function (h, s, b, a) { + if (!h) { + h = this.value.h; + s = this.value.s; + b = this.value.b; + } + h *= 360; + var R, G, B, X, C; + h = (h % 360) / 60; + C = b * s; + X = C * (1 - Math.abs(h % 2 - 1)); + R = G = B = b - C; + + h = ~~h; + R += [C, X, 0, 0, X, C][h]; + G += [X, C, C, X, 0, 0][h]; + B += [0, 0, X, C, C, X][h]; + return { + r: Math.round(R * 255), + g: Math.round(G * 255), + b: Math.round(B * 255), + a: a || this.value.a + }; + }, + + toHex: function (h, s, b, a) { + var rgb = this.toRGB(h, s, b, a); + return '#' + ((1 << 24) | (parseInt(rgb.r, 10) << 16) | (parseInt(rgb.g, 10) << 8) | parseInt(rgb.b, 10)).toString(16).substr(1); + } + }; + }]) + .factory('Slider', ['Helper', function (Helper) { + 'use strict'; + var + slider = { + maxLeft: 0, + maxTop: 0, + callLeft: null, + callTop: null, + knob: { + top: 0, + left: 0 + } + }, + pointer = {}; + + return { + getSlider: function() { + return slider; + }, + getLeftPosition: function(event) { + return Math.max(0, Math.min(slider.maxLeft, slider.left + ((event.pageX || pointer.left) - pointer.left))); + }, + getTopPosition: function(event) { + return Math.max(0, Math.min(slider.maxTop, slider.top + ((event.pageY || pointer.top) - pointer.top))); + }, + setSlider: function (event, fixedPosition) { + var + target = Helper.closestSlider(event.target), + targetOffset = Helper.getOffset(target, fixedPosition), + rect = target.getBoundingClientRect(), + offsetX = event.clientX - rect.left, + offsetY = event.clientY - rect.top; + + slider.knob = target.children[0].style; + slider.left = event.pageX - targetOffset.left - window.pageXOffset + targetOffset.scrollX; + slider.top = event.pageY - targetOffset.top - window.pageYOffset + targetOffset.scrollY; + + pointer = { + left: event.pageX - (offsetX - slider.left), + top: event.pageY - (offsetY - slider.top) + }; + }, + setSaturation: function(event, fixedPosition) { + slider = { + maxLeft: 100, + maxTop: 100, + callLeft: 'setSaturation', + callTop: 'setLightness' + }; + this.setSlider(event, fixedPosition); + }, + setHue: function(event, fixedPosition) { + slider = { + maxLeft: 0, + maxTop: 100, + callLeft: false, + callTop: 'setHue' + }; + this.setSlider(event, fixedPosition); + }, + setAlpha: function(event, fixedPosition) { + slider = { + maxLeft: 0, + maxTop: 100, + callLeft: false, + callTop: 'setAlpha' + }; + this.setSlider(event, fixedPosition); + }, + setKnob: function(top, left) { + slider.knob.top = top + 'px'; + slider.knob.left = left + 'px'; + } + }; + }]) + .directive('colorpicker', ['$document', '$compile', 'Color', 'Slider', 'Helper', function ($document, $compile, Color, Slider, Helper) { + 'use strict'; + return { + require: '?ngModel', + restrict: 'A', + link: function ($scope, elem, attrs, ngModel) { + var + thisFormat = attrs.colorpicker ? attrs.colorpicker : 'hex', + position = angular.isDefined(attrs.colorpickerPosition) ? attrs.colorpickerPosition : 'bottom', + inline = angular.isDefined(attrs.colorpickerInline) ? attrs.colorpickerInline : false, + fixedPosition = angular.isDefined(attrs.colorpickerFixedPosition) ? attrs.colorpickerFixedPosition : false, + target = angular.isDefined(attrs.colorpickerParent) ? elem.parent() : angular.element(document.body), + withInput = angular.isDefined(attrs.colorpickerWithInput) ? attrs.colorpickerWithInput : false, + inputTemplate = withInput ? '' : '', + closeButton = !inline ? '' : '', + template = + '', + colorpickerTemplate = angular.element(template), + pickerColor = Color, + sliderAlpha, + sliderHue = colorpickerTemplate.find('colorpicker-hue'), + sliderSaturation = colorpickerTemplate.find('colorpicker-saturation'), + colorpickerPreview = colorpickerTemplate.find('colorpicker-preview'), + pickerColorPointers = colorpickerTemplate.find('i'); + + $compile(colorpickerTemplate)($scope); + + if (withInput) { + var pickerColorInput = colorpickerTemplate.find('input'); + pickerColorInput + .on('mousedown', function(event) { + event.stopPropagation(); + }) + .on('keyup', function() { + var newColor = this.value; + elem.val(newColor); + if (ngModel && ngModel.$modelValue !== newColor) { + $scope.$apply(ngModel.$setViewValue(newColor)); + update(true); + } + }); + } + + var bindMouseEvents = function() { + $document.on('mousemove', mousemove); + $document.on('mouseup', mouseup); + }; + + if (thisFormat === 'rgba') { + colorpickerTemplate.addClass('alpha'); + sliderAlpha = colorpickerTemplate.find('colorpicker-alpha'); + sliderAlpha + .on('click', function(event) { + Slider.setAlpha(event, fixedPosition); + mousemove(event); + }) + .on('mousedown', function(event) { + Slider.setAlpha(event, fixedPosition); + bindMouseEvents(); + }) + .on('mouseup', function(event){ + emitEvent('colorpicker-selected-alpha'); + }); + } + + sliderHue + .on('click', function(event) { + Slider.setHue(event, fixedPosition); + mousemove(event); + }) + .on('mousedown', function(event) { + Slider.setHue(event, fixedPosition); + bindMouseEvents(); + }) + .on('mouseup', function(event){ + emitEvent('colorpicker-selected-hue'); + }); + + sliderSaturation + .on('click', function(event) { + Slider.setSaturation(event, fixedPosition); + mousemove(event); + if (angular.isDefined(attrs.colorpickerCloseOnSelect)) { + hideColorpickerTemplate(); + } + }) + .on('mousedown', function(event) { + Slider.setSaturation(event, fixedPosition); + bindMouseEvents(); + }) + .on('mouseup', function(event){ + emitEvent('colorpicker-selected-saturation'); + }); + + if (fixedPosition) { + colorpickerTemplate.addClass('colorpicker-fixed-position'); + } + + colorpickerTemplate.addClass('colorpicker-position-' + position); + if (inline === 'true') { + colorpickerTemplate.addClass('colorpicker-inline'); + } + + target.append(colorpickerTemplate); + + if(ngModel) { + ngModel.$render = function () { + elem.val(ngModel.$viewValue); + }; + } + + elem.on('blur keyup change', function() { + update(); + }); + + elem.on('$destroy', function() { + colorpickerTemplate.remove(); + }); + + var previewColor = function () { + try { + colorpickerPreview.css('backgroundColor', pickerColor[thisFormat]()); + } catch (e) { + colorpickerPreview.css('backgroundColor', pickerColor.toHex()); + } + sliderSaturation.css('backgroundColor', pickerColor.toHex(pickerColor.value.h, 1, 1, 1)); + if (thisFormat === 'rgba') { + sliderAlpha.css.backgroundColor = pickerColor.toHex(); + } + }; + + var mousemove = function (event) { + var + left = Slider.getLeftPosition(event), + top = Slider.getTopPosition(event), + slider = Slider.getSlider(); + + Slider.setKnob(top, left); + + if (slider.callLeft) { + pickerColor[slider.callLeft].call(pickerColor, left / 100); + } + if (slider.callTop) { + pickerColor[slider.callTop].call(pickerColor, top / 100); + } + previewColor(); + var newColor = pickerColor[thisFormat](); + elem.val(newColor); + if(ngModel) { + $scope.$apply(ngModel.$setViewValue(newColor)); + } + if (withInput) { + pickerColorInput.val(newColor); + } + return false; + }; + + var mouseup = function () { + emitEvent('colorpicker-selected'); + $document.off('mousemove', mousemove); + $document.off('mouseup', mouseup); + }; + + var update = function (omitInnerInput) { + pickerColor.setColor(elem.val()); + if (withInput && !omitInnerInput) { + pickerColorInput.val(elem.val()); + } + pickerColorPointers.eq(0).css({ + left: pickerColor.value.s * 100 + 'px', + top: 100 - pickerColor.value.b * 100 + 'px' + }); + pickerColorPointers.eq(1).css('top', 100 * (1 - pickerColor.value.h) + 'px'); + pickerColorPointers.eq(2).css('top', 100 * (1 - pickerColor.value.a) + 'px'); + previewColor(); + }; + + var getColorpickerTemplatePosition = function() { + var + positionValue, + positionOffset = Helper.getOffset(elem[0]); + + if(angular.isDefined(attrs.colorpickerParent)) { + positionOffset.left = 0; + positionOffset.top = 0; + } + + if (position === 'top') { + positionValue = { + 'top': positionOffset.top - 147, + 'left': positionOffset.left + }; + } else if (position === 'right') { + positionValue = { + 'top': positionOffset.top, + 'left': positionOffset.left + 126 + }; + } else if (position === 'bottom') { + positionValue = { + 'top': positionOffset.top + elem[0].offsetHeight + 2, + 'left': positionOffset.left + }; + } else if (position === 'left') { + positionValue = { + 'top': positionOffset.top, + 'left': positionOffset.left - 150 + }; + } + return { + 'top': positionValue.top + 'px', + 'left': positionValue.left + 'px' + }; + }; + + var documentMousedownHandler = function() { + hideColorpickerTemplate(); + }; + + var showColorpickerTemplate = function() { + + if (!colorpickerTemplate.hasClass('colorpicker-visible')) { + update(); + colorpickerTemplate + .addClass('colorpicker-visible') + .css(getColorpickerTemplatePosition()); + emitEvent('colorpicker-shown'); + + if (inline === false) { + // register global mousedown event to hide the colorpicker + $document.on('mousedown', documentMousedownHandler); + } + + if (attrs.colorpickerIsOpen) { + $scope[attrs.colorpickerIsOpen] = true; + if (!$scope.$$phase) { + $scope.$digest(); //trigger the watcher to fire + } + } + } + + }; + + if(inline === false) { + elem.on('click', showColorpickerTemplate); + } else { + showColorpickerTemplate(); + } + + colorpickerTemplate.on('mousedown', function (event) { + event.stopPropagation(); + event.preventDefault(); + }); + + var emitEvent = function(name) { + if(ngModel) { + $scope.$emit(name, { + name: attrs.ngModel, + value: ngModel.$modelValue + }); + } + }; + + var hideColorpickerTemplate = function() { + if (colorpickerTemplate.hasClass('colorpicker-visible')) { + colorpickerTemplate.removeClass('colorpicker-visible'); + emitEvent('colorpicker-closed'); + // unregister the global mousedown event + $document.off('mousedown', documentMousedownHandler); + + if (attrs.colorpickerIsOpen) { + $scope[attrs.colorpickerIsOpen] = false; + if (!$scope.$$phase) { + $scope.$digest(); //trigger the watcher to fire + } + } + } + }; + + colorpickerTemplate.find('button').on('click', function () { + hideColorpickerTemplate(); + }); + + if (attrs.colorpickerIsOpen) { + $scope.$watch(attrs.colorpickerIsOpen, function(shouldBeOpen) { + + if (shouldBeOpen === true) { + showColorpickerTemplate(); + } else if (shouldBeOpen === false) { + hideColorpickerTemplate(); + } + + }); + } + + } + }; + }]); diff --git a/public/bower_components/angular-bootstrap-colorpicker/colorpicker.css b/public/bower_components/angular-bootstrap-colorpicker/colorpicker.css new file mode 100644 index 0000000..400162c --- /dev/null +++ b/public/bower_components/angular-bootstrap-colorpicker/colorpicker.css @@ -0,0 +1,169 @@ +.colorpicker-visible, +.colorpicker-visible .dropdown-menu { + display: block !important; +} +colorpicker-saturation { + display: block; + width: 100px; + height: 100px; + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAYAAABw4pVUAAAACXBIWXMAAAsTAAALEwEAmpwYAAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAHvgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCdmCZTAKAEAGDLY2LjAFAtAGAnf+bTAICd+Jl7AQBblCEVAaCRACATZYhEAGg7AKzPVopFAFgwABRmS8Q5ANgtADBJV2ZIALC3AMDOEAuyAAgMADBRiIUpAAR7AGDIIyN4AISZABRG8lc88SuuEOcqAAB4mbI8uSQ5RYFbCC1xB1dXLh4ozkkXKxQ2YQJhmkAuwnmZGTKBNA/g88wAAKCRFRHgg/P9eM4Ors7ONo62Dl8t6r8G/yJiYuP+5c+rcEAAAOF0ftH+LC+zGoA7BoBt/qIl7gRoXgugdfeLZrIPQLUAoOnaV/Nw+H48PEWhkLnZ2eXk5NhKxEJbYcpXff5nwl/AV/1s+X48/Pf14L7iJIEyXYFHBPjgwsz0TKUcz5IJhGLc5o9H/LcL//wd0yLESWK5WCoU41EScY5EmozzMqUiiUKSKcUl0v9k4t8s+wM+3zUAsGo+AXuRLahdYwP2SycQWHTA4vcAAPK7b8HUKAgDgGiD4c93/+8//UegJQCAZkmScQAAXkQkLlTKsz/HCAAARKCBKrBBG/TBGCzABhzBBdzBC/xgNoRCJMTCQhBCCmSAHHJgKayCQiiGzbAdKmAv1EAdNMBRaIaTcA4uwlW4Dj1wD/phCJ7BKLyBCQRByAgTYSHaiAFiilgjjggXmYX4IcFIBBKLJCDJiBRRIkuRNUgxUopUIFVIHfI9cgI5h1xGupE7yAAygvyGvEcxlIGyUT3UDLVDuag3GoRGogvQZHQxmo8WoJvQcrQaPYw2oefQq2gP2o8+Q8cwwOgYBzPEbDAuxsNCsTgsCZNjy7EirAyrxhqwVqwDu4n1Y8+xdwQSgUXACTYEd0IgYR5BSFhMWE7YSKggHCQ0EdoJNwkDhFHCJyKTqEu0JroR+cQYYjIxh1hILCPWEo8TLxB7iEPENyQSiUMyJ7mQAkmxpFTSEtJG0m5SI+ksqZs0SBojk8naZGuyBzmULCAryIXkneTD5DPkG+Qh8lsKnWJAcaT4U+IoUspqShnlEOU05QZlmDJBVaOaUt2ooVQRNY9aQq2htlKvUYeoEzR1mjnNgxZJS6WtopXTGmgXaPdpr+h0uhHdlR5Ol9BX0svpR+iX6AP0dwwNhhWDx4hnKBmbGAcYZxl3GK+YTKYZ04sZx1QwNzHrmOeZD5lvVVgqtip8FZHKCpVKlSaVGyovVKmqpqreqgtV81XLVI+pXlN9rkZVM1PjqQnUlqtVqp1Q61MbU2epO6iHqmeob1Q/pH5Z/YkGWcNMw09DpFGgsV/jvMYgC2MZs3gsIWsNq4Z1gTXEJrHN2Xx2KruY/R27iz2qqaE5QzNKM1ezUvOUZj8H45hx+Jx0TgnnKKeX836K3hTvKeIpG6Y0TLkxZVxrqpaXllirSKtRq0frvTau7aedpr1Fu1n7gQ5Bx0onXCdHZ4/OBZ3nU9lT3acKpxZNPTr1ri6qa6UbobtEd79up+6Ynr5egJ5Mb6feeb3n+hx9L/1U/W36p/VHDFgGswwkBtsMzhg8xTVxbzwdL8fb8VFDXcNAQ6VhlWGX4YSRudE8o9VGjUYPjGnGXOMk423GbcajJgYmISZLTepN7ppSTbmmKaY7TDtMx83MzaLN1pk1mz0x1zLnm+eb15vft2BaeFostqi2uGVJsuRaplnutrxuhVo5WaVYVVpds0atna0l1rutu6cRp7lOk06rntZnw7Dxtsm2qbcZsOXYBtuutm22fWFnYhdnt8Wuw+6TvZN9un2N/T0HDYfZDqsdWh1+c7RyFDpWOt6azpzuP33F9JbpL2dYzxDP2DPjthPLKcRpnVOb00dnF2e5c4PziIuJS4LLLpc+Lpsbxt3IveRKdPVxXeF60vWdm7Obwu2o26/uNu5p7ofcn8w0nymeWTNz0MPIQ+BR5dE/C5+VMGvfrH5PQ0+BZ7XnIy9jL5FXrdewt6V3qvdh7xc+9j5yn+M+4zw33jLeWV/MN8C3yLfLT8Nvnl+F30N/I/9k/3r/0QCngCUBZwOJgUGBWwL7+Hp8Ib+OPzrbZfay2e1BjKC5QRVBj4KtguXBrSFoyOyQrSH355jOkc5pDoVQfujW0Adh5mGLw34MJ4WHhVeGP45wiFga0TGXNXfR3ENz30T6RJZE3ptnMU85ry1KNSo+qi5qPNo3ujS6P8YuZlnM1VidWElsSxw5LiquNm5svt/87fOH4p3iC+N7F5gvyF1weaHOwvSFpxapLhIsOpZATIhOOJTwQRAqqBaMJfITdyWOCnnCHcJnIi/RNtGI2ENcKh5O8kgqTXqS7JG8NXkkxTOlLOW5hCepkLxMDUzdmzqeFpp2IG0yPTq9MYOSkZBxQqohTZO2Z+pn5mZ2y6xlhbL+xW6Lty8elQfJa7OQrAVZLQq2QqboVFoo1yoHsmdlV2a/zYnKOZarnivN7cyzytuQN5zvn//tEsIS4ZK2pYZLVy0dWOa9rGo5sjxxedsK4xUFK4ZWBqw8uIq2Km3VT6vtV5eufr0mek1rgV7ByoLBtQFr6wtVCuWFfevc1+1dT1gvWd+1YfqGnRs+FYmKrhTbF5cVf9go3HjlG4dvyr+Z3JS0qavEuWTPZtJm6ebeLZ5bDpaql+aXDm4N2dq0Dd9WtO319kXbL5fNKNu7g7ZDuaO/PLi8ZafJzs07P1SkVPRU+lQ27tLdtWHX+G7R7ht7vPY07NXbW7z3/T7JvttVAVVN1WbVZftJ+7P3P66Jqun4lvttXa1ObXHtxwPSA/0HIw6217nU1R3SPVRSj9Yr60cOxx++/p3vdy0NNg1VjZzG4iNwRHnk6fcJ3/ceDTradox7rOEH0x92HWcdL2pCmvKaRptTmvtbYlu6T8w+0dbq3nr8R9sfD5w0PFl5SvNUyWna6YLTk2fyz4ydlZ19fi753GDborZ752PO32oPb++6EHTh0kX/i+c7vDvOXPK4dPKy2+UTV7hXmq86X23qdOo8/pPTT8e7nLuarrlca7nuer21e2b36RueN87d9L158Rb/1tWeOT3dvfN6b/fF9/XfFt1+cif9zsu72Xcn7q28T7xf9EDtQdlD3YfVP1v+3Njv3H9qwHeg89HcR/cGhYPP/pH1jw9DBY+Zj8uGDYbrnjg+OTniP3L96fynQ89kzyaeF/6i/suuFxYvfvjV69fO0ZjRoZfyl5O/bXyl/erA6xmv28bCxh6+yXgzMV70VvvtwXfcdx3vo98PT+R8IH8o/2j5sfVT0Kf7kxmTk/8EA5jz/GMzLdsAAAAgY0hSTQAAeiUAAICDAAD5/wAAgOkAAHUwAADqYAAAOpgAABdvkl/FRgAAFJhJREFUeAGMU+/q4kAMzFYf4LgP96a+q4c+gSIqxf/r5maWDoTgz15gmM0kW5uMLa21v2b2G6jAG2iEzqUU6q5c/OlMuHtL/ULNd5TP6EJ1RP7NuXvKE397jmbg7MrzHI748T1UA3eopyGQV2qK1+vVHo/Hm1itVm0J7Q+afwGMmgeRphf7Noh6lCeuHJAvm/X8rAQNlw2VScoj6863OQjl2ZB3qkeu5Lh0RJ3qynuNjJA21FppQAHa8/l83263No5jOxwOttlsbL1e2xIXXpMZzzRsXoTw34bQgLiQbKh6M9SXDBSypn4XGOSkGUO1cJdn1Yh4/qYVgctmGSwXyARNcOSFRuBMHvA1GMzwy+Vix+PRdrvdYrvd2vl87oZYDCxBL9B/jEyopghzlNjL0DlB+gAoPNXyOfa3oA9puXonyVHzdH+g9MEISa5z0qUNkwkm6MJkxALg8mlMAxvNwBfhYLvf7w50vl6vBV9H2e/3BjYateQDY8gM5bmWovygdyEb87k/G5Zz9c/2zfEQFysO5nDJ6mMel91Z//pwFpygIWIaMXE3AoYssPBCI/B12DiONMT5VZxOJ0f+j/MyWo5chYGowfn/j03lNXBpl85Up8d46u6DChBMvKv2UePrrAsChtdLTi73oEBjFDYpmIp/KSgRhRw357sXuHLknRgI8d90F8QL761oI8iQeJqvUOGnAoEkgNblF13iiJASZCwhLkG+v7/Halvt5+enr7x+02lZOwKymJ7jMAXK32RxaXnNxfXzCOkCxTO2I3NiR0i9gAjQLLoVHkKG8pCi0UT4Q0h5xUFIlBJEYmg+1yg6TrUq+YfEWKK0lWsSS8+DkNvCWtvJXu0UbDyH/NYjoDHFybPd/cPeficiW5LvkVdBNY4UoIqOQMwPBXm9vUYIVCj3GkXCCo1tRS//uMhYoVG3q46HaBQtamESTs/+0o92hOTaBbqjBwpu8reCuzAP4rkXpQBzQwbhZxD7jNYEAS4CI2Rg4hLitPUor2hGh6j4hQ5FfWt8LQF+SwyJIpGUV05nu56VHqJhR8ybb+Q+/dnPYZYSigIICvY3xfYxCckz/qazprjDiFJ+5DWVwscaMpSDgkleI2uutaKk5kPFNTqO8pBDlBQZEqKvoJXp7+lxzx7Cuoqp2M7zlrm5JbH/9oZ/GLdzBGf9FNmmvPi+h2FXnm8L5WhdCMJNyr1D6yvKP1rFQYgSjWpteE0JMraEME8ykpzo/0/+wcg5yGHMooegQYIRyXU1i52tCSfn9oSQFH+Fe4jypxs3RHA+xNCcNUZ+BXRg7iu0lhgDAesisSfE6UA0iudz9sNHKChek5eBX9a+FwKkKQ+Nd6JljkLX6B4x2L8hhHOsVdhR4iHEEe1LeWJCSI2tCo9AU3OIKHGgbupv6NvyRciGgMzPPLP5LmhPdKTx8qgSWIXxVkZx8QJihmCvPP8nE6IRXniKT9GThhKF0QkZal3KQYcLgn+s8YwWJiNnLVL4mOz1b+4piM8/+YYb8xNlLoASXqC7c9DCOokhl4RAKgSkCNM9wklBOPL4BIJoblQggsb8Km9W/IlIJkKrPN4xEETPwtS3hczrp8//pxmzpoUIBfeSO8r8/OE59wgTIsnIb4yBj7Cft6pYI8Sbh5TBD749IANSlKPgJQQmrr0uUfjbCnlV/V9OCfLpDc9b0nw4x3bznAbWFAyfUeBLEIhA3uaCKifFyUBg8pg+Ro8nOCVOintKoy0xj5bFvhNCQMAfoUqgc8UwMRot8dWy/qPcDHQk5XkgOPD97//Gl/xC2kKlkhl2V4pMQmAON+22E+4XgIzMKYMSmp7S0ymTcpYEYM6eVjKlJV25HgYguZ6lD1hR4S4byoxRwMUQjm87MYVxrW19nCqbgTD4kSEde7FlxcF4tKDCPu41lBUKa7tjgGuHJuPCwpBPdcONuVTiMEMgbPpugJE0+GIRusL+yD9qGhrP05ClFHfOuppZeV4ZkgyJdJc3dkxh0+8YDBpbsyuxrXYzV4VfmJLFwxdAEq7azIj9Yw9AuUCjEL3I7pD1xgo0BPv5Y2U9MCBvegpGxq9/vK7BftOQssP3ueL+HfJwLkAqVLlgPH9CF7phgMoKj/X8EjiNCtGQHzFU9mM7gsR8W/5wkuZ9ZUKBcYuWdE3qU2YYqLIllfo5aog2m2haKnlsvP30YUHO+3f9Yu2GrNpW2rYV8id2bM/9KxBPc/QgZQT9AlotQRtgSls1pIDADvo+3hL0bXBU0yxqG4Fx2ZshdXSBaEjZYtIdh/uxQDOrpMV/Biatjj8nzRgq8p0Ud6w9fAwwe+9mSJPWUMWzPG+A21ZWG45nhoQp1RdaBZ1WYDteUQ4gffvH1jomTHlkxk9GTDi5AS0YAODxMoRjMiqsjq/MyqvFFJX9buv6+18Y8mwDyFRH7Dj+T1rBtYivRV1v9mHtiKhfD10QrRFdsxor9Z4bgChAtF22fLsv1sfsGL4B0grazi9DygpagZ0A2s2WBMBmLn0de15D11KG5WSAvh20rB92fEIVwk0jdV2qPdyWr4mYuw75NMua7FFtmZxbkN7qi4DSFgaqQjc75GwDwbgBMkMMAPfD6cR1wpl1o7GftDhMMSPaFmm05+Tv/HWW9aQXbMfiBAZ4cNLdnz6hyAyj7ki9oQYYqdYd4h405JRwXs4DhLKozKhzG65449eQ4i5nX2LKXYjCVDcWF58Y0uJvj2EpY2VN79NzjHlVF8E1M2JZxOzW62rIEhhlywoAMMhrS8dFBJhgMJx5aRxg/fv9rSW9WN7LeQxZPn4bo6ExYgppsWNkQIt2pOAU8DAK8Oh/yK7ECM8pCAboJDTRFNsJQ3ZkBdtFXgV+A5qAEasl4sk2WxjOzn9PY6sZ1ZxJD/p9FMwoc1pjLNhEbLd2eX2Kpv6Y+aSCn8OUxhqyGBOwS9fxUiwDPIXfZw2JeNs+hS2/2R6r2Lfv+S/ivt3PG7eHh3S/52EDDD0j5h9rStliJiQLc5/fW9wP0PNcfB77nmVpX6Js2WaOQwb9OrXLJ9UMz7UmuJaAQj7fjxi6V97wIGftsqVMwcGZN2ZTL30fr7IYkL4xpG/9Y9bV677pUYXfrHk5tzuvoS1aRPX9ScV+3+Mn1FU7YMR6GT8LEP38xs2OyzVZRjIz9mWrIV2lTYo6LLk3BKXGKCM47jycKCb4zb4GzBi0g3Ec0a9OsBVQQsp+YwTjo+Mr9C/MQluIJmIkYYvvzpL2RhuiKT1uttTrK+q74p8siUsR64/nlS3XedcfZgY6kfUsv/FOUZfOlwGTfjyPCxjrRDbCvMLr4vCc9kN26pBR7H8KuW0wHZrkYCzj2+z5WbPCoZM2rISeEwop48KRZdhiPtmYLXNSyZs91YAeH06dow/Vpg3o+W9a/hbgPI5jTnvdx5YxZUbrCY1V7De22qProHXrDL/9B8dlHIuM3QQqUxL7d/pLyyqrzKlV6/2O/F/GBXP6ochjYdiKvQ4saA1ddlTvY/bEkY9Wa1iLkEN2JVavOhxHRlvqMF/XAnEVOJgXy3fAhCgY0N8bC0Nnpl8Lw/bt2LnCnsENO6o5r7bMcn2hONzQswSK2WVbphBy2kcjGqqWNRJQfU6ALwFgHTlo41pWWaE+O4V2zuhYZ1jYinTnvVmcC0Oclck+MgTH1jZU9Ty/VWaUIS42JwFPpkiWyDiZafZDygiJTseTIrc/g5v1qYQ6kgVnT48A+bztNN774MD2U8kDphjxaP18nyGzZBGUh7Y9L1uGvIp6Mq3EePVl7Xxf2/pE9gWI2KTFX2J3xx8Z0jWvnv+VhaG6tr8vkccerdTfdvhaXzTlLUM8t6HNIa9a4DfuDYgCWEaUCQ5jBcz2YI43lgqsrRi21F+pRThPhW5NvqLDK0Nw5E7RV7DKjDreX69/ZVY14wGQ8+HN733OxHGci9MKTBlkMNCSMqJA/udFzgg5IWqXKW9pbwvDu9VxFIjREGtHAS1w7rs4bcXtpIEV1t7H9QdgfmPIGrTmKDAW+gmIFHxNaRl3iCKEvYcsjuPAgTEzQ5zO2SHY3q+FX98oqti8casANPRxL19nx34JWZ9XQJ4r+uOLpmwxZxGyZF8Bcb9lf+dUR0zZgjwCigMKmGltbXG/SzZmUzQlxzMzGCdcmVUDEH3OijXp7k5StNVSh7xnV6Nju98+MaTMaMjK+b7xCy2gD1vk+G54eVxM6PEzM2TLqjJk3IdR/4iG7RSF+y1klQk4jqGvb/h4n6TBQwHZ77GYE0alLzZOTOl1+ShiFvUyBYRJIvSC1PFPfYemMoW+EpWXtaznArCLitWSnX6BKnPOLkTWIT/3vB3SEFemqF+m0Bh7ZIoY13m7IfmhfyxNzsu90j/f65Bn5hSoMSHIvPE+nptWAKesbWRY6xJax/NG30AnvS4AAPkVEOuDmHBk3KJ+dsewIt41+3t8+kqRB85Sy82QAmZmpGrfGnfqejZrKlP8Rv+GIZ0nnWi/Ys74kWzs6Ly7INTfYvA4CshcGL6wpSJ8I1/GtLCs9ji0lQG+vgzBOkmInRh2a0Y1If0DYPmr5vTPwIv9hCWPXyBcjUGL+n+PhWEdL9Rhi390Wv2lxeHRjGZbYR0Os7DWgb0f15VVzPd5XVcgClAZ41se8uE/3efT7Eq7oQXk7xpSB3NcrfAYzGmFLUAL1MwYtabPjBeYXhcAAGolA3vSjJkZ88Zdx6+/pzrEaf35x9XeODgANYTlPox167cOfmJMAbnv4+1QGNA6pAwpg8qInhdAPa4GFTjrKQi5XSAsjrsf0qWSb3sjm+M4vQz5fNEaA1TGTMxo9vVu2wIATgWozlfavegXZJ7h/+3dYY7cOA7F8VQnu/e/5u4dtnqRwThD/KA/ywU0Jl9GQGCZkl0yHx9JSW4nGPRxKXuA8RzG/BygfJchBtujW5Ipzso9R5HGA998fC7MCMX2kYyrC+mrwd9z7+n5ZIMM9bODV8kYUjuEoeTPAyPemVxq0feB+cJ/xJYuKj3qFoL3r0khi4uHLEvLJwitTGlA4pz734whA7A+ElO05MEer2vLt9hPRgoQcVQmBUM6oNf7VxPlOXudyl7AYEI3Yk0z4TOYxXyEVDliCvOZp+NH8cmAEXNmevVk1p7fpr89MZyKP1l9xZIXzPmIdPmkkLlrqEL8bpbu8XUBJOTT+psdPAvPMV1LAnOlvgkIfyPoPsjxMxquUV2ncX/do65KmSvOriY70XSF2OecL0A7Yf08eYKMJeiHuFq7hE+A2V3WUGgE7sEKGHFjTuNKwAfp8HPGLRUA4N+GAv8QaOkqr91Yl9E+ActMDb059ktX92PIolQB+Hx9Ta9voeB8y/4A9mmCqjyzMvY5PhjHMchf7REHZNH15xSTIfafLss/R2hABEKmtPK5VwPszNms7xOwLB8VM5RrqZbprier+Ei/cncBZYzxQkCaIdv+uUvr9Mm3ViKmPIwBk0GAL7N0mRFjWh6z/+d0oRrAVGTMMSZwMwP9dOvW6077IcWUufB3cjnXUspxM2l+YvZwf2PHtFI+vEm/YMbhvGIJ/SI7Q4kyJGJVsk9mjIniD7Os27GEPjLiaLE323Nyimu85GXtMhM3kvs3F8BPsr+NISPNpR0WhKuaxvkSkIeu5PpW1rWqSrvnMqn+nvE4TxkymeA5zOnzcZnn34whtD281rb511sX+5mTPGVmrWWZP1vPd31Xix+gvMGcEwO9RycRvdFm7DH1TMB1VbqnQ1enDMYUWfNwtRelN1Nc32KVuIBA3qlxj6GMpZlhPYB4VIzyt4JhFyN+nXs/FH8vy5p7HlMZIjwyiGNGtCluDOrElNXKG+gEeAcw5j4HVygTbBf4qfTt/V7rP+YX5a7B+S1FFxFBvSeMs06/zfVk3f0Zf98gbJJge9WV6bKW9hP7vG8EeHcMUYxKOLkvY4D+WoDGMQO9TAt31oC2mysDAqhwaWBmf5iTACADEPZDZMJunYJG8NU9IburyOhztPgyjOt4igUE+3xW2SCYm7IFPQJ6z9SvclKKD6tchS0uyz4F/gocYDcjPLaRnTBIVzaex+Mp/pxiyXMAknvq5bZOR/vLBhX0oH8r/v6xx6d27x8FAgU3a2RixRCSooshjxUQPyV+zGooKD+PBUSwLmVfAWa09bOgZ9zQAwZMr/AcR1n10mWlHzaoNrv6WAogdazY9iXHUalOt+8FsJ8nt49rHYAMlxWAzBRYBWbATdkAVIujr22vLNd4Z+Z253pdh8quMQuMCp4NHUcA5PjWieDAjqByANJ1gRV0AcQ0yfioe6Rpldm2M6d/WuVHW7isUJ5lUV4yQ5mgC2y4SYGq/t5vjU8b4xmDynxo/TIi6iX7fgRk/ueQbrSMPY+rbrawAlfgFLA1nylSAHRbbjDj/n36ehk8ZBPome5eRZfV8w/lo+hK7Huso1TqgDkskvoat+L/X3QsGoDM2tHouKDcJmPWeT9kobMvXc+dwrkOhtJeK/Nm/XEXaCx01ssAWtc99rUOAJ6Uu/srhrQyWgn2g4K6GOvZL5TBwwSA742/x7ijZF3F7tfNUi7Lh5grvwbisoxwYReZamaf9VC8cWhVsAuV4Y5oYyaNcdAuoPa1TcPQZX3v/y16+N55kyFTGQIxNLcDpwIvFKe7cU7keHd2VMxrhR+Y+WXnx+xsrPbm4Mf+eTMn1mYGaFrjptDj/ZmkmjaXVWv19slxkTXJynCvnIdL8zdZOnn83A9ZFSTAB4VsSpGmyipunCjuGN9liwzZs8ddwQVEyzeyuGPYD7APuOS6o7aO9xWo/P3fbrnF8e5y2+7Lnamvyg8GKNeKog2m2NaW+SjwLCQhlr5/M6DamjnNlAbJLKtBaQZU226Ru2KbCe+Ph6Tk3THb/v5zaRQ7yz4M6usa1HywJU50n+7bgb4Z0sC2XIa8P56+JvvuWHTaa6kgbLn7ELvV9bU76A0+hpTKuh3PoryDwKvrflwx5F/1IMaK9wrK+h3ltf/+bb8d5d8/XdZ//txS/N9hxfdvGNg/ZQT1//4fih7V/hdi/qwAAAAASUVORK5CYII="); + cursor: crosshair; + float: left; +} +colorpicker-saturation i { + display: block; + height: 7px; + width: 7px; + border: 1px solid #000; + border-radius: 5px; + position: absolute; + top: 0; + left: 0; + margin: -4px 0 0 -4px; +} +colorpicker-saturation i::after { + content: ''; + display: block; + height: 7px; + width: 7px; + border: 1px solid #fff; + border-radius: 5px; +} +colorpicker-hue, +colorpicker-alpha { + width: 15px; + height: 100px; + float: left; + cursor: row-resize; + margin-left: 4px; + margin-bottom: 4px; +} +colorpicker-hue i, +colorpicker-alpha i { + display: block; + height: 2px; + background: #000; + border-top: 1px solid #fff; + position: absolute; + top: 0; + left: 0; + width: 100%; + margin-top: -1px; +} +colorpicker-hue { + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAABkCAMAAABw8qpSAAABLFBMVEUA/z8AuP//JAAA/33/3AAA/1ABAv8A/7r/AH7/jgD2AP8A//j/AEHmAP/XAP/HAP+4AP//ALyoAP+aAP+JAP97AP9rAP9cAP9MAP8+AP8tAP8fAP8PAP8ATv//AG7/cAD/vgD/APoAmv//ADH/AKwB/wMA5//4Eg4AL///AOr/UQD/nwAA/27/7AAA/+kAe/8Ayf8A/5sA/zEA/6z/ABEAEP8A/17/MgAA/9n/ACL/gAD/AJ0AXP8Aqv//AMoA/yHqFBb/zAD/AGD/ANsA9//1/wDk/wDV/wDF/wC3/wD/AI2m/wD/FACY/wCI/wB5/wBp/wD/YgBb/wBK/wA8/wAs/wAd/wAN/wAAPv8A/xH/AFAAi///rQAA/8r/+gAA1///QwAAH/8Abf8A/43c/JNGAAAAiUlEQVR4AQXBg2EDAAAAsMy2bds2ttp2+/8PTby79mDLsKJPq/oFPdk24dWXAxsGjRg1ZtykKdNmzJozb8GiJct63WjYl7fiWdOZkk0vOpyr2fVtyKl7FX2uXGjpcuxWDy69KdiRk5WRlpIUFxMVERLw78+vH1Unun1YV3ZkwKM1CYfq7nQK22sD03ITV2Aqp0IAAAAASUVORK5CYII="); +} +colorpicker-alpha { + display: none; +} +colorpicker-alpha, +.colorpicker-color { + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAABkCAMAAACIElGlAAADAFBMVEUAAADT09PT09P////T09P////e3t7q6urT09Px8fHT09P////////T09PT09P////////T09PT09P////////////T09PT09P////////////T09P////T09PT09PT09P////T09PT09P////////////////T09P////T09PT09P////T09PT09PT09PT09PT09PT09P////T09P////T09PT09P////////////T09P////T09P////////////T09PT09P////T09P////////////////////T09P////////T09PT09P////////////////////////T09PT09P////////////////////////T09PT09P////T09PT09P////////T09P////////////T09P////////T09P////T09P////T09P////T09PT09PT09PT09P////T09PT09PT09PT09PT09PT09P////T09P////T09PT09P////////////T09PT09PT09P////T09PT09PT09PT09PT09PT09PT09P////////////////T09PT09P////////////T09P////////T09P////T09PT09PT09P////////T09P////////T09P////T09PT09P////////////////T09PT09PT09PT09P////T09PT09PT09PT09PT09PT09PT09P////T09P////T09PT09PT09PT09PT09P////////////////////////////////////T09P////T09P////T09P////T09PT09P////////////T09P////T09P////T09P////////////T09PT09P////////////////T09PT09P////T09P////T09PT09P////T09P////T09PT09P////T09PT09PT09PT09P////T09PT09P////////////T09PT09P////T09P////////T09MQsm1FAAABAHRSTlMAgJN8/vcDAfcCnJyGaZmZlomGk4yJOmM/eTxs8wY0YDFC7HNdLx18n5/7aUvzCcW9+qKiK8P0ZiltRwfdw/n8Px3WduJjItj78ss5PDHUNELbwP5wplA2FglEVwvkqNarCs4Z7b2sDLgQ0xNdyLrr0eLLUeW1Vs5TWQLwjPI3ZvQGdvxFyFrAeevaLCLvGd0kpRskGyf4qK605xKvFrGyDRHnBYMEkJaDkIBvB/gpH99O6CrbIC4nH3Lg2SXp4A7Qul/GDEgPSlMQ6LjqFU0SjyCCj5V/gnBN7xglL3O70WBU7gjFFEfft0sPTo1ndRipwXr2yRemWRVENq+ytbGuxGaWGQAAAnpJREFUeNpNxmdcDHAAxvEHOWXvmXX23ntv2XvvMg/Z44x0KaRBSnfcKSqlnYZKp1QqGpT20KZh783/eePj+3vzw3/q/AM9iURPTy6XS+RwcXNzcZMQTE1dTE3bE7y9S0u9xxD600rCGtpI2ErOsbGxzoiMrIqscnaOi4vDdnp4XYSrguwxQSb7KpMllycnl2MFaTSaTxrY5NrY5BoKb2BnZ2doZ29vb2OPSdSd4Bcc7OcXGhqamgqrYCsrq+mEiEtC3gUBDg55Dg53IkQYSYG+gb6+GEqB5wV0o5D8/JAQdKK5hA40n3BS+L6c0JJmE+ZQW8JEak1YQJ0Jq+jbaQEPnotGE+IrK+Pj+xKqU6pTUrIDAgKysZ+WEY5QQkJxcQIO0WrCUbL4YmFhgZ3UlVAUHR1d1JEwjVoRRpDJKxMTE/ShBoRR1I6whLyyvLyyUFAQFhbWhTCFFArFawXOCu/bEHpQLYKnZ0aGZw2CR1qah0dmpqurK+pTU0ILakJoTi+PC7j5RHTrqQg1qRkh3T3d3b0xoSE1ItSleoSe1IswmIYQPl8UlhLWkaOj41tHbKENBLX6j1qt/KFUKnFN+Onk9NvJCQdJpfqlUqGiIjExcRthN91/JsJmGkhYRO/OCBhHwwgxMWUxZQMIu8j8o7m5OfbRLMJh2kTYQ1FRhYVR2EHzCOtpMmEG3SUsJEvLoKAg2Prb2tqOJYSH+/uH33shwlTaS1hLBwhX6AYX2tuiRwStVntOa5yUZJwEqbREKjUi5Bjl5BhZW1uXWOMYGRBOnNDX1zfoxz1FwwkfSJfgo6vr41P7soBBNJ7Qm2YSzHTMzMwmEHRoMf0Fm5mYOUrzNBYAAAAASUVORK5CYII="); +} +.colorpicker { + top: 0; + left: 0; + z-index: 9999; + display: none; +} +.colorpicker colorpicker-hue, +.colorpicker colorpicker-alpha, +.colorpicker colorpicker-saturation { + position: relative; +} +.colorpicker input { + width: 100px; + font-size: 11px; + color: #000; + background-color: #fff; +} +.colorpicker.alpha { + min-width: 140px; +} +.colorpicker.alpha colorpicker-alpha { + display: block; +} +.colorpicker.dropdown { + position: absolute; +} +.colorpicker.colorpicker-fixed-position { + position: fixed; +} +.colorpicker .dropdown-menu::after, +.colorpicker .dropdown-menu::before { + content: ''; + display: inline-block; + position: absolute; +} +.colorpicker .dropdown-menu::after { + clear: both; + border: 6px solid transparent; + top: -5px; + left: 7px; +} +.colorpicker .dropdown-menu::before { + border: 7px solid transparent; + top: -6px; + left: 6px; +} +.colorpicker .dropdown-menu { + position: static; + top: 0; + left: 0; + min-width: 129px; + padding: 4px; + margin-top: 0; +} +.colorpicker-position-top .dropdown-menu::after { + border-top: 6px solid #fff; + border-bottom: 0; + top: auto; + bottom: -5px; +} +.colorpicker-position-top .dropdown-menu::before { + border-top: 7px solid rgba(0, 0, 0, 0.2); + border-bottom: 0; + top: auto; + bottom: -6px; +} +.colorpicker-position-right .dropdown-menu::after { + border-right: 6px solid #fff; + border-left: 0; + top: 11px; + left: -5px; +} +.colorpicker-position-right .dropdown-menu::before { + border-right: 7px solid rgba(0, 0, 0, 0.2); + border-left: 0; + top: 10px; + left: -6px; +} +.colorpicker-position-bottom .dropdown-menu::after { + border-bottom: 6px solid #fff; + border-top: 0; +} +.colorpicker-position-bottom .dropdown-menu::before { + border-bottom: 7px solid rgba(0, 0, 0, 0.2); + border-top: 0; +} +.colorpicker-position-left .dropdown-menu::after { + border-left: 6px solid #fff; + border-right: 0; + top: 11px; + left: auto; + right: -5px; +} +.colorpicker-position-left .dropdown-menu::before { + border-left: 7px solid rgba(0, 0, 0, 0.2); + border-right: 0; + top: 10px; + left: auto; + right: -6px; +} +colorpicker-preview { + display: block; + height: 10px; + margin: 5px 0 3px 0; + clear: both; + background-position: 0 100%; +} diff --git a/public/bower_components/angular-bootstrap-contextmenu/contextMenu.js b/public/bower_components/angular-bootstrap-contextmenu/contextMenu.js new file mode 100644 index 0000000..9ff195b --- /dev/null +++ b/public/bower_components/angular-bootstrap-contextmenu/contextMenu.js @@ -0,0 +1,89 @@ +angular.module('ui.bootstrap.contextMenu', []) + +.directive('contextMenu', ["$parse", function ($parse) { + var renderContextMenu = function ($scope, event, options, model) { + if (!$) { var $ = angular.element; } + $(event.currentTarget).addClass('context'); + var $contextMenu = $('
        '); + $contextMenu.addClass('dropdown clearfix'); + var $ul = $('
        \n" + + ""); +}]); + +angular.module("template/tooltip/tooltip-popup.html", []).run(["$templateCache", function($templateCache) { + $templateCache.put("template/tooltip/tooltip-popup.html", + "\n" + + "
        \n" + + "
        \n" + + "
        \n" + + ""); +}]); + +angular.module("template/tooltip/tooltip-template-popup.html", []).run(["$templateCache", function($templateCache) { + $templateCache.put("template/tooltip/tooltip-template-popup.html", + "\n" + + "
        \n" + + "
        \n" + + "
        \n" + + ""); +}]); + +angular.module("template/popover/popover-html.html", []).run(["$templateCache", function($templateCache) { + $templateCache.put("template/popover/popover-html.html", + "
        \n" + + "
        \n" + + "\n" + + "
        \n" + + "

        \n" + + "
        \n" + + "
        \n" + + "
        \n" + + ""); +}]); + +angular.module("template/popover/popover-template.html", []).run(["$templateCache", function($templateCache) { + $templateCache.put("template/popover/popover-template.html", + "
        \n" + + "
        \n" + + "\n" + + "
        \n" + + "

        \n" + + "
        \n" + + "
        \n" + + "
        \n" + + ""); +}]); + +angular.module("template/popover/popover.html", []).run(["$templateCache", function($templateCache) { + $templateCache.put("template/popover/popover.html", + "
        \n" + + "
        \n" + + "\n" + + "
        \n" + + "

        \n" + + "
        \n" + + "
        \n" + + "
        \n" + + ""); +}]); + +angular.module("template/progressbar/bar.html", []).run(["$templateCache", function($templateCache) { + $templateCache.put("template/progressbar/bar.html", + "
        \n" + + ""); +}]); + +angular.module("template/progressbar/progress.html", []).run(["$templateCache", function($templateCache) { + $templateCache.put("template/progressbar/progress.html", + "
        "); +}]); + +angular.module("template/progressbar/progressbar.html", []).run(["$templateCache", function($templateCache) { + $templateCache.put("template/progressbar/progressbar.html", + "
        \n" + + "
        \n" + + "
        \n" + + ""); +}]); + +angular.module("template/rating/rating.html", []).run(["$templateCache", function($templateCache) { + $templateCache.put("template/rating/rating.html", + "\n" + + " ({{ $index < value ? '*' : ' ' }})\n" + + " \n" + + "\n" + + ""); +}]); + +angular.module("template/tabs/tab.html", []).run(["$templateCache", function($templateCache) { + $templateCache.put("template/tabs/tab.html", + "
      • \n" + + " {{heading}}\n" + + "
      • \n" + + ""); +}]); + +angular.module("template/tabs/tabset.html", []).run(["$templateCache", function($templateCache) { + $templateCache.put("template/tabs/tabset.html", + "
        \n" + + "
          \n" + + "
          \n" + + "
          \n" + + "
          \n" + + "
          \n" + + "
          \n" + + ""); +}]); + +angular.module("template/timepicker/timepicker.html", []).run(["$templateCache", function($templateCache) { + $templateCache.put("template/timepicker/timepicker.html", + "\n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + "
           
          \n" + + " \n" + + " :\n" + + " \n" + + "
           
          \n" + + ""); +}]); + +angular.module("template/typeahead/typeahead-match.html", []).run(["$templateCache", function($templateCache) { + $templateCache.put("template/typeahead/typeahead-match.html", + "\n" + + ""); +}]); + +angular.module("template/typeahead/typeahead-popup.html", []).run(["$templateCache", function($templateCache) { + $templateCache.put("template/typeahead/typeahead-popup.html", + "
            \n" + + "
          • \n" + + "
            \n" + + "
          • \n" + + "
          \n" + + ""); +}]); +!angular.$$csp() && angular.element(document).find('head').prepend(''); \ No newline at end of file diff --git a/public/bower_components/angular-chart.js/angular-chart.css b/public/bower_components/angular-chart.js/angular-chart.css new file mode 100644 index 0000000..e6598ee --- /dev/null +++ b/public/bower_components/angular-chart.js/angular-chart.css @@ -0,0 +1,49 @@ +.chart-legend, +.bar-legend, +.line-legend, +.pie-legend, +.radar-legend, +.polararea-legend, +.doughnut-legend { + list-style-type: none; + margin-top: 5px; + text-align: center; + /* NOTE: Browsers automatically add 40px of padding-left to all lists, so we should offset that, otherwise the legend is off-center */ + -webkit-padding-start: 0; + /* Webkit */ + -moz-padding-start: 0; + /* Mozilla */ + padding-left: 0; + /* IE (handles all cases, really, but we should also include the vendor-specific properties just to be safe) */ +} +.chart-legend li, +.bar-legend li, +.line-legend li, +.pie-legend li, +.radar-legend li, +.polararea-legend li, +.doughnut-legend li { + display: inline-block; + white-space: nowrap; + position: relative; + margin-bottom: 4px; + border-radius: 5px; + padding: 2px 8px 2px 28px; + font-size: smaller; + cursor: default; +} +.chart-legend li span, +.bar-legend li span, +.line-legend li span, +.pie-legend li span, +.radar-legend li span, +.polararea-legend li span, +.doughnut-legend li span { + display: block; + position: absolute; + left: 0; + top: 0; + width: 20px; + height: 20px; + border-radius: 5px; +} diff --git a/public/bower_components/angular-chart.js/angular-chart.js b/public/bower_components/angular-chart.js/angular-chart.js new file mode 100644 index 0000000..8375081 --- /dev/null +++ b/public/bower_components/angular-chart.js/angular-chart.js @@ -0,0 +1,360 @@ +(function (factory) { + 'use strict'; + if (typeof exports === 'object') { + // Node/CommonJS + module.exports = factory(typeof angular ? angular : require('angular'), require('chart.js')); + } else if (typeof define === 'function' && define.amd) { + // AMD. Register as an anonymous module. + define(['angular', 'chart'], factory); + } else { + // Browser globals + factory(angular, Chart); + } +}(function (angular, Chart) { + 'use strict'; + + Chart.defaults.global.responsive = true; + Chart.defaults.global.multiTooltipTemplate = '<%if (datasetLabel){%><%=datasetLabel%>: <%}%><%= value %>'; + + Chart.defaults.global.colours = [ + '#97BBCD', // blue + '#DCDCDC', // light grey + '#F7464A', // red + '#46BFBD', // green + '#FDB45C', // yellow + '#949FB1', // grey + '#4D5360' // dark grey + ]; + + var usingExcanvas = typeof window.G_vmlCanvasManager === 'object' && + window.G_vmlCanvasManager !== null && + typeof window.G_vmlCanvasManager.initElement === 'function'; + + if (usingExcanvas) Chart.defaults.global.animation = false; + + return angular.module('chart.js', []) + .provider('ChartJs', ChartJsProvider) + .factory('ChartJsFactory', ['ChartJs', '$timeout', ChartJsFactory]) + .directive('chartBase', ['ChartJsFactory', function (ChartJsFactory) { return new ChartJsFactory(); }]) + .directive('chartLine', ['ChartJsFactory', function (ChartJsFactory) { return new ChartJsFactory('Line'); }]) + .directive('chartBar', ['ChartJsFactory', function (ChartJsFactory) { return new ChartJsFactory('Bar'); }]) + .directive('chartRadar', ['ChartJsFactory', function (ChartJsFactory) { return new ChartJsFactory('Radar'); }]) + .directive('chartDoughnut', ['ChartJsFactory', function (ChartJsFactory) { return new ChartJsFactory('Doughnut'); }]) + .directive('chartPie', ['ChartJsFactory', function (ChartJsFactory) { return new ChartJsFactory('Pie'); }]) + .directive('chartPolarArea', ['ChartJsFactory', function (ChartJsFactory) { return new ChartJsFactory('PolarArea'); }]); + + /** + * Wrapper for chart.js + * Allows configuring chart js using the provider + * + * angular.module('myModule', ['chart.js']).config(function(ChartJsProvider) { + * ChartJsProvider.setOptions({ responsive: true }); + * ChartJsProvider.setOptions('Line', { responsive: false }); + * }))) + */ + function ChartJsProvider () { + var options = {}; + var ChartJs = { + Chart: Chart, + getOptions: function (type) { + var typeOptions = type && options[type] || {}; + return angular.extend({}, options, typeOptions); + } + }; + + /** + * Allow to set global options during configuration + */ + this.setOptions = function (type, customOptions) { + // If no type was specified set option for the global object + if (! customOptions) { + customOptions = type; + options = angular.extend(options, customOptions); + return; + } + // Set options for the specific chart + options[type] = angular.extend(options[type] || {}, customOptions); + }; + + this.$get = function () { + return ChartJs; + }; + } + + function ChartJsFactory (ChartJs, $timeout) { + return function chart (type) { + return { + restrict: 'CA', + scope: { + data: '=?', + labels: '=?', + options: '=?', + series: '=?', + colours: '=?', + getColour: '=?', + chartType: '=', + legend: '@', + click: '=?', + hover: '=?', + + chartData: '=?', + chartLabels: '=?', + chartOptions: '=?', + chartSeries: '=?', + chartColours: '=?', + chartLegend: '@', + chartClick: '=?', + chartHover: '=?' + }, + link: function (scope, elem/*, attrs */) { + var chart, container = document.createElement('div'); + container.className = 'chart-container'; + elem.replaceWith(container); + container.appendChild(elem[0]); + + if (usingExcanvas) window.G_vmlCanvasManager.initElement(elem[0]); + + ['data', 'labels', 'options', 'series', 'colours', 'legend', 'click', 'hover'].forEach(deprecated); + function aliasVar (fromName, toName) { + scope.$watch(fromName, function (newVal) { + if (typeof newVal === 'undefined') return; + scope[toName] = newVal; + }); + } + /* provide backward compatibility to "old" directive names, by + * having an alias point from the new names to the old names. */ + aliasVar('chartData', 'data'); + aliasVar('chartLabels', 'labels'); + aliasVar('chartOptions', 'options'); + aliasVar('chartSeries', 'series'); + aliasVar('chartColours', 'colours'); + aliasVar('chartLegend', 'legend'); + aliasVar('chartClick', 'click'); + aliasVar('chartHover', 'hover'); + + // Order of setting "watch" matter + + scope.$watch('data', function (newVal, oldVal) { + if (! newVal || ! newVal.length || (Array.isArray(newVal[0]) && ! newVal[0].length)) return; + var chartType = type || scope.chartType; + if (! chartType) return; + + if (chart) { + if (canUpdateChart(newVal, oldVal)) return updateChart(chart, newVal, scope, elem); + chart.destroy(); + } + + createChart(chartType); + }, true); + + scope.$watch('series', resetChart, true); + scope.$watch('labels', resetChart, true); + scope.$watch('options', resetChart, true); + scope.$watch('colours', resetChart, true); + + scope.$watch('chartType', function (newVal, oldVal) { + if (isEmpty(newVal)) return; + if (angular.equals(newVal, oldVal)) return; + if (chart) chart.destroy(); + createChart(newVal); + }); + + scope.$on('$destroy', function () { + if (chart) chart.destroy(); + }); + + function resetChart (newVal, oldVal) { + if (isEmpty(newVal)) return; + if (angular.equals(newVal, oldVal)) return; + var chartType = type || scope.chartType; + if (! chartType) return; + + // chart.update() doesn't work for series and labels + // so we have to re-create the chart entirely + if (chart) chart.destroy(); + + createChart(chartType); + } + + function createChart (type) { + if (isResponsive(type, scope) && elem[0].clientHeight === 0 && container.clientHeight === 0) { + return $timeout(function () { + createChart(type); + }, 50, false); + } + if (! scope.data || ! scope.data.length) return; + scope.getColour = typeof scope.getColour === 'function' ? scope.getColour : getRandomColour; + scope.colours = getColours(type, scope); + var cvs = elem[0], ctx = cvs.getContext('2d'); + var data = Array.isArray(scope.data[0]) ? + getDataSets(scope.labels, scope.data, scope.series || [], scope.colours) : + getData(scope.labels, scope.data, scope.colours); + var options = angular.extend({}, ChartJs.getOptions(type), scope.options); + chart = new ChartJs.Chart(ctx)[type](data, options); + scope.$emit('create', chart); + + // Bind events + cvs.onclick = scope.click ? getEventHandler(scope, chart, 'click', false) : angular.noop; + cvs.onmousemove = scope.hover ? getEventHandler(scope, chart, 'hover', true) : angular.noop; + + if (scope.legend && scope.legend !== 'false') setLegend(elem, chart); + } + + function deprecated (attr) { + if (typeof console !== 'undefined' && ChartJs.getOptions().env !== 'test') { + var warn = typeof console.warn === 'function' ? console.warn : console.log; + if (!! scope[attr]) { + warn.call(console, '"%s" is deprecated and will be removed in a future version. ' + + 'Please use "chart-%s" instead.', attr, attr); + } + } + } + } + }; + }; + + function canUpdateChart (newVal, oldVal) { + if (newVal && oldVal && newVal.length && oldVal.length) { + return Array.isArray(newVal[0]) ? + newVal.length === oldVal.length && newVal.every(function (element, index) { + return element.length === oldVal[index].length; }) : + oldVal.reduce(sum, 0) > 0 ? newVal.length === oldVal.length : false; + } + return false; + } + + function sum (carry, val) { + return carry + val; + } + + function getEventHandler (scope, chart, action, triggerOnlyOnChange) { + var lastState = null; + return function (evt) { + var atEvent = chart.getPointsAtEvent || chart.getBarsAtEvent || chart.getSegmentsAtEvent; + if (atEvent) { + var activePoints = atEvent.call(chart, evt); + if (triggerOnlyOnChange === false || angular.equals(lastState, activePoints) === false) { + lastState = activePoints; + scope[action](activePoints, evt); + scope.$apply(); + } + } + }; + } + + function getColours (type, scope) { + var colours = angular.copy(scope.colours || + ChartJs.getOptions(type).colours || + Chart.defaults.global.colours + ); + while (colours.length < scope.data.length) { + colours.push(scope.getColour()); + } + return colours.map(convertColour); + } + + function convertColour (colour) { + if (typeof colour === 'object' && colour !== null) return colour; + if (typeof colour === 'string' && colour[0] === '#') return getColour(hexToRgb(colour.substr(1))); + return getRandomColour(); + } + + function getRandomColour () { + var colour = [getRandomInt(0, 255), getRandomInt(0, 255), getRandomInt(0, 255)]; + return getColour(colour); + } + + function getColour (colour) { + return { + fillColor: rgba(colour, 0.2), + strokeColor: rgba(colour, 1), + pointColor: rgba(colour, 1), + pointStrokeColor: '#fff', + pointHighlightFill: '#fff', + pointHighlightStroke: rgba(colour, 0.8) + }; + } + + function getRandomInt (min, max) { + return Math.floor(Math.random() * (max - min + 1)) + min; + } + + function rgba (colour, alpha) { + if (usingExcanvas) { + // rgba not supported by IE8 + return 'rgb(' + colour.join(',') + ')'; + } else { + return 'rgba(' + colour.concat(alpha).join(',') + ')'; + } + } + + // Credit: http://stackoverflow.com/a/11508164/1190235 + function hexToRgb (hex) { + var bigint = parseInt(hex, 16), + r = (bigint >> 16) & 255, + g = (bigint >> 8) & 255, + b = bigint & 255; + + return [r, g, b]; + } + + function getDataSets (labels, data, series, colours) { + return { + labels: labels, + datasets: data.map(function (item, i) { + return angular.extend({}, colours[i], { + label: series[i], + data: item + }); + }) + }; + } + + function getData (labels, data, colours) { + return labels.map(function (label, i) { + return angular.extend({}, colours[i], { + label: label, + value: data[i], + color: colours[i].strokeColor, + highlight: colours[i].pointHighlightStroke + }); + }); + } + + function setLegend (elem, chart) { + var $parent = elem.parent(), + $oldLegend = $parent.find('chart-legend'), + legend = '' + chart.generateLegend() + ''; + if ($oldLegend.length) $oldLegend.replaceWith(legend); + else $parent.append(legend); + } + + function updateChart (chart, values, scope, elem) { + if (Array.isArray(scope.data[0])) { + chart.datasets.forEach(function (dataset, i) { + (dataset.points || dataset.bars).forEach(function (dataItem, j) { + dataItem.value = values[i][j]; + }); + }); + } else { + chart.segments.forEach(function (segment, i) { + segment.value = values[i]; + }); + } + chart.update(); + scope.$emit('update', chart); + if (scope.legend && scope.legend !== 'false') setLegend(elem, chart); + } + + function isEmpty (value) { + return ! value || + (Array.isArray(value) && ! value.length) || + (typeof value === 'object' && ! Object.keys(value).length); + } + + function isResponsive (type, scope) { + var options = angular.extend({}, Chart.defaults.global, ChartJs.getOptions(type), scope.options); + return options.responsive; + } + } +})); diff --git a/public/bower_components/angular-cookies/angular-cookies.js b/public/bower_components/angular-cookies/angular-cookies.js new file mode 100644 index 0000000..8a04e12 --- /dev/null +++ b/public/bower_components/angular-cookies/angular-cookies.js @@ -0,0 +1,321 @@ +/** + * @license AngularJS v1.4.8 + * (c) 2010-2015 Google, Inc. http://angularjs.org + * License: MIT + */ +(function(window, angular, undefined) {'use strict'; + +/** + * @ngdoc module + * @name ngCookies + * @description + * + * # ngCookies + * + * The `ngCookies` module provides a convenient wrapper for reading and writing browser cookies. + * + * + *
          + * + * See {@link ngCookies.$cookies `$cookies`} for usage. + */ + + +angular.module('ngCookies', ['ng']). + /** + * @ngdoc provider + * @name $cookiesProvider + * @description + * Use `$cookiesProvider` to change the default behavior of the {@link ngCookies.$cookies $cookies} service. + * */ + provider('$cookies', [function $CookiesProvider() { + /** + * @ngdoc property + * @name $cookiesProvider#defaults + * @description + * + * Object containing default options to pass when setting cookies. + * + * The object may have following properties: + * + * - **path** - `{string}` - The cookie will be available only for this path and its + * sub-paths. By default, this would be the URL that appears in your base tag. + * - **domain** - `{string}` - The cookie will be available only for this domain and + * its sub-domains. For obvious security reasons the user agent will not accept the + * cookie if the current domain is not a sub domain or equals to the requested domain. + * - **expires** - `{string|Date}` - String of the form "Wdy, DD Mon YYYY HH:MM:SS GMT" + * or a Date object indicating the exact date/time this cookie will expire. + * - **secure** - `{boolean}` - The cookie will be available only in secured connection. + * + * Note: by default the address that appears in your `` tag will be used as path. + * This is important so that cookies will be visible for all routes in case html5mode is enabled + * + **/ + var defaults = this.defaults = {}; + + function calcOptions(options) { + return options ? angular.extend({}, defaults, options) : defaults; + } + + /** + * @ngdoc service + * @name $cookies + * + * @description + * Provides read/write access to browser's cookies. + * + *
          + * Up until Angular 1.3, `$cookies` exposed properties that represented the + * current browser cookie values. In version 1.4, this behavior has changed, and + * `$cookies` now provides a standard api of getters, setters etc. + *
          + * + * Requires the {@link ngCookies `ngCookies`} module to be installed. + * + * @example + * + * ```js + * angular.module('cookiesExample', ['ngCookies']) + * .controller('ExampleController', ['$cookies', function($cookies) { + * // Retrieving a cookie + * var favoriteCookie = $cookies.get('myFavorite'); + * // Setting a cookie + * $cookies.put('myFavorite', 'oatmeal'); + * }]); + * ``` + */ + this.$get = ['$$cookieReader', '$$cookieWriter', function($$cookieReader, $$cookieWriter) { + return { + /** + * @ngdoc method + * @name $cookies#get + * + * @description + * Returns the value of given cookie key + * + * @param {string} key Id to use for lookup. + * @returns {string} Raw cookie value. + */ + get: function(key) { + return $$cookieReader()[key]; + }, + + /** + * @ngdoc method + * @name $cookies#getObject + * + * @description + * Returns the deserialized value of given cookie key + * + * @param {string} key Id to use for lookup. + * @returns {Object} Deserialized cookie value. + */ + getObject: function(key) { + var value = this.get(key); + return value ? angular.fromJson(value) : value; + }, + + /** + * @ngdoc method + * @name $cookies#getAll + * + * @description + * Returns a key value object with all the cookies + * + * @returns {Object} All cookies + */ + getAll: function() { + return $$cookieReader(); + }, + + /** + * @ngdoc method + * @name $cookies#put + * + * @description + * Sets a value for given cookie key + * + * @param {string} key Id for the `value`. + * @param {string} value Raw value to be stored. + * @param {Object=} options Options object. + * See {@link ngCookies.$cookiesProvider#defaults $cookiesProvider.defaults} + */ + put: function(key, value, options) { + $$cookieWriter(key, value, calcOptions(options)); + }, + + /** + * @ngdoc method + * @name $cookies#putObject + * + * @description + * Serializes and sets a value for given cookie key + * + * @param {string} key Id for the `value`. + * @param {Object} value Value to be stored. + * @param {Object=} options Options object. + * See {@link ngCookies.$cookiesProvider#defaults $cookiesProvider.defaults} + */ + putObject: function(key, value, options) { + this.put(key, angular.toJson(value), options); + }, + + /** + * @ngdoc method + * @name $cookies#remove + * + * @description + * Remove given cookie + * + * @param {string} key Id of the key-value pair to delete. + * @param {Object=} options Options object. + * See {@link ngCookies.$cookiesProvider#defaults $cookiesProvider.defaults} + */ + remove: function(key, options) { + $$cookieWriter(key, undefined, calcOptions(options)); + } + }; + }]; + }]); + +angular.module('ngCookies'). +/** + * @ngdoc service + * @name $cookieStore + * @deprecated + * @requires $cookies + * + * @description + * Provides a key-value (string-object) storage, that is backed by session cookies. + * Objects put or retrieved from this storage are automatically serialized or + * deserialized by angular's toJson/fromJson. + * + * Requires the {@link ngCookies `ngCookies`} module to be installed. + * + *
          + * **Note:** The $cookieStore service is **deprecated**. + * Please use the {@link ngCookies.$cookies `$cookies`} service instead. + *
          + * + * @example + * + * ```js + * angular.module('cookieStoreExample', ['ngCookies']) + * .controller('ExampleController', ['$cookieStore', function($cookieStore) { + * // Put cookie + * $cookieStore.put('myFavorite','oatmeal'); + * // Get cookie + * var favoriteCookie = $cookieStore.get('myFavorite'); + * // Removing a cookie + * $cookieStore.remove('myFavorite'); + * }]); + * ``` + */ + factory('$cookieStore', ['$cookies', function($cookies) { + + return { + /** + * @ngdoc method + * @name $cookieStore#get + * + * @description + * Returns the value of given cookie key + * + * @param {string} key Id to use for lookup. + * @returns {Object} Deserialized cookie value, undefined if the cookie does not exist. + */ + get: function(key) { + return $cookies.getObject(key); + }, + + /** + * @ngdoc method + * @name $cookieStore#put + * + * @description + * Sets a value for given cookie key + * + * @param {string} key Id for the `value`. + * @param {Object} value Value to be stored. + */ + put: function(key, value) { + $cookies.putObject(key, value); + }, + + /** + * @ngdoc method + * @name $cookieStore#remove + * + * @description + * Remove given cookie + * + * @param {string} key Id of the key-value pair to delete. + */ + remove: function(key) { + $cookies.remove(key); + } + }; + + }]); + +/** + * @name $$cookieWriter + * @requires $document + * + * @description + * This is a private service for writing cookies + * + * @param {string} name Cookie name + * @param {string=} value Cookie value (if undefined, cookie will be deleted) + * @param {Object=} options Object with options that need to be stored for the cookie. + */ +function $$CookieWriter($document, $log, $browser) { + var cookiePath = $browser.baseHref(); + var rawDocument = $document[0]; + + function buildCookieString(name, value, options) { + var path, expires; + options = options || {}; + expires = options.expires; + path = angular.isDefined(options.path) ? options.path : cookiePath; + if (angular.isUndefined(value)) { + expires = 'Thu, 01 Jan 1970 00:00:00 GMT'; + value = ''; + } + if (angular.isString(expires)) { + expires = new Date(expires); + } + + var str = encodeURIComponent(name) + '=' + encodeURIComponent(value); + str += path ? ';path=' + path : ''; + str += options.domain ? ';domain=' + options.domain : ''; + str += expires ? ';expires=' + expires.toUTCString() : ''; + str += options.secure ? ';secure' : ''; + + // per http://www.ietf.org/rfc/rfc2109.txt browser must allow at minimum: + // - 300 cookies + // - 20 cookies per unique domain + // - 4096 bytes per cookie + var cookieLength = str.length + 1; + if (cookieLength > 4096) { + $log.warn("Cookie '" + name + + "' possibly not set or overflowed because it was too large (" + + cookieLength + " > 4096 bytes)!"); + } + + return str; + } + + return function(name, value, options) { + rawDocument.cookie = buildCookieString(name, value, options); + }; +} + +$$CookieWriter.$inject = ['$document', '$log', '$browser']; + +angular.module('ngCookies').provider('$$cookieWriter', function $$CookieWriterProvider() { + this.$get = $$CookieWriter; +}); + + +})(window, window.angular); diff --git a/public/bower_components/angular-dashboard-framework/angular-dashboard-framework.css b/public/bower_components/angular-dashboard-framework/angular-dashboard-framework.css new file mode 100644 index 0000000..601bdf0 --- /dev/null +++ b/public/bower_components/angular-dashboard-framework/angular-dashboard-framework.css @@ -0,0 +1,83 @@ +/** + The MIT License + + Copyright (c) 2015, Sebastian Sdorra + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. +*/ + + +[ng\:cloak], [ng-cloak], [data-ng-cloak], [x-ng-cloak], .ng-cloak, .x-ng-cloak { + display: none !important; +} + +.adf-move { + cursor: move; + cursor: -webkit-grabbing; +} + +.edit .column { + min-height: 120px; + border: 1px #ccc dashed; + padding-top: 15px; + -webkit-border-radius: 5px; + -moz-border-radius: 5px; + border-radius: 5px; +} + +pre.edit { + margin-top: 15px; +} + +.column .placeholder { + opacity: 0.4; + background: #E8E8E8; + border: 1px dashed #505050; + margin-bottom: 15px; + -webkit-border-radius: 5px; + -moz-border-radius: 5px; + border-radius: 5px; +} + +.widget h3 a { + text-decoration: none; +} + +.dashboard-container h1 a { + text-decoration: none; +} + +.padding-bottom { + padding-bottom: 5px; +} + +.adf-flip { + -moz-transform: scaleX(-1); + -o-transform: scaleX(-1); + -webkit-transform: scaleX(-1); + transform: scaleX(-1); + filter: FlipH; + -ms-filter: "FlipH"; +} +/* + modal dialog in fullscreen +*/ +.dashboard-modal.widget-fullscreen .modal-dialog { + width: 98%; +} diff --git a/public/bower_components/angular-dashboard-framework/angular-dashboard-framework.js b/public/bower_components/angular-dashboard-framework/angular-dashboard-framework.js new file mode 100644 index 0000000..334f3cc --- /dev/null +++ b/public/bower_components/angular-dashboard-framework/angular-dashboard-framework.js @@ -0,0 +1,1241 @@ +(function(window, undefined) {'use strict'; +/* + * The MIT License + * + * Copyright (c) 2015, Sebastian Sdorra + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + + + +angular.module('adf', ['adf.provider', 'ui.bootstrap']) + .value('adfTemplatePath', '../src/templates/') + .value('rowTemplate', '') + .value('columnTemplate', '') + .value('adfVersion', '0.10.0'); + +/* +* The MIT License +* +* Copyright (c) 2015, Sebastian Sdorra +* +* Permission is hereby granted, free of charge, to any person obtaining a copy +* of this software and associated documentation files (the "Software"), to deal +* in the Software without restriction, including without limitation the rights +* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +* copies of the Software, and to permit persons to whom the Software is +* furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included in +* all copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +* SOFTWARE. +*/ + + +/* global angular */ +angular.module('adf') + .directive('adfDashboardColumn', ["$log", "$compile", "adfTemplatePath", "rowTemplate", "dashboard", function ($log, $compile, adfTemplatePath, rowTemplate, dashboard) { + + + /** + * moves a widget in between a column + */ + function moveWidgetInColumn($scope, column, evt){ + var widgets = column.widgets; + // move widget and apply to scope + $scope.$apply(function(){ + widgets.splice(evt.newIndex, 0, widgets.splice(evt.oldIndex, 1)[0]); + }); + } + + /** + * finds a widget by its id in the column + */ + function findWidget(column, index){ + var widget = null; + for (var i=0; i 0 ){ + var w = source.widgets.shift(); + while (w){ + target.widgets.push(w); + w = source.widgets.shift(); + } + } + } + + /** + * Copy widget from old columns to the new model + * @param object root the model + * @param array of columns + * @param counter + */ + function fillStructure(root, columns, counter) { + counter = counter || 0; + + if (angular.isDefined(root.rows)) { + angular.forEach(root.rows, function (row) { + angular.forEach(row.columns, function (column) { + // if the widgets prop doesn't exist, create a new array for it. + // this allows ui.sortable to do it's thing without error + if (!column.widgets) { + column.widgets = []; + } + + // if a column exist at the counter index, copy over the column + if (angular.isDefined(columns[counter])) { + // do not add widgets to a column, which uses nested rows + if (!angular.isDefined(column.rows)){ + copyWidgets(columns[counter], column); + counter++; + } + } + + // run fillStructure again for any sub rows/columns + counter = fillStructure(column, columns, counter); + }); + }); + } + return counter; + } + + /** + * Read Columns: recursively searches an object for the 'columns' property + * @param object model + * @param array an array of existing columns; used when recursion happens + */ + function readColumns(root, columns) { + columns = columns || []; + + if (angular.isDefined(root.rows)) { + angular.forEach(root.rows, function (row) { + angular.forEach(row.columns, function (col) { + columns.push(col); + // keep reading columns until we can't any more + readColumns(col, columns); + }); + }); + } + + return columns; + } + + function changeStructure(model, structure){ + var columns = readColumns(model); + var counter = 0; + + model.rows = angular.copy(structure.rows); + + while ( counter < columns.length ){ + counter = fillStructure(model, columns, counter); + } + } + + function createConfiguration(type){ + var cfg = {}; + var config = dashboard.widgets[type].config; + if (config){ + cfg = angular.copy(config); + } + return cfg; + } + + /** + * Find first widget column in model. + * + * @param dashboard model + */ + function findFirstWidgetColumn(model){ + var column = null; + if (!angular.isArray(model.rows)){ + $log.error('model does not have any rows'); + return null; + } + for (var i=0; i=}` - An optional map of dependencies which should + * be injected into the controller. If any of these dependencies are promises, the widget + * will wait for them all to be resolved or one to be rejected before the controller is + * instantiated. + * If all the promises are resolved successfully, the values of the resolved promises are + * injected. + * + * The map object is: + * - `key` – `{string}`: a name of a dependency to be injected into the controller. + * - `factory` - `{string|function}`: If `string` then it is an alias for a service. + * Otherwise if function, then it is {@link http://docs.angularjs.org/api/AUTO.$injector#invoke injected} + * and the return value is treated as the dependency. If the result is a promise, it is + * resolved before its value is injected into the controller. + * - `edit` - `{object}` - Edit modus of the widget. + * - `controller` - `{string=|function()=}` - Same as above, but for the edit mode of the widget. + * - `template` - `{string=|function()=}` - Same as above, but for the edit mode of the widget. + * - `templateUrl` - `{string=}` - Same as above, but for the edit mode of the widget. + * - `resolve` - `{Object.=}` - Same as above, but for the edit mode of the widget. + * - `reload` - {boolean} - true if the widget should be reloaded, after the edit mode is closed. + * Default is true. + * + * @returns {Object} self + */ + this.widget = function(name, widget){ + var w = angular.extend({reload: false}, widget); + if ( w.edit ){ + var edit = {reload: true}; + angular.extend(edit, w.edit); + w.edit = edit; + } + widgets[name] = w; + return this; + }; + + /** + * @ngdoc method + * @name adf.dashboardProvider#widgetsPath + * @methodOf adf.dashboardProvider + * @description + * + * Sets the path to the directory which contains the widgets. The widgets + * path is used for widgets with a templateUrl which contains the + * placeholder {widgetsPath}. The placeholder is replaced with the + * configured value, before the template is loaded, but the template is + * cached with the unmodified templateUrl (e.g.: {widgetPath}/src/widgets). + * The default value of widgetPaths is ''. + * + * + * @param {string} path to the directory which contains the widgets + * + * @returns {Object} self + */ + this.widgetsPath = function(path){ + widgetsPath = path; + return this; + }; + + /** + * @ngdoc method + * @name adf.dashboardProvider#structure + * @methodOf adf.dashboardProvider + * @description + * + * Registers a new structure. + * + * @param {string} name of the structure + * @param {object} structure to be registered. + * + * Object properties: + * + * - `rows` - `{Array.}` - Rows of the dashboard structure. + * - `styleClass` - `{string}` - CSS Class of the row. + * - `columns` - `{Array.}` - Columns of the row. + * - `styleClass` - `{string}` - CSS Class of the column. + * + * @returns {Object} self + */ + this.structure = function(name, structure){ + structures[name] = structure; + return this; + }; + + /** + * @ngdoc method + * @name adf.dashboardProvider#messageTemplate + * @methodOf adf.dashboardProvider + * @description + * + * Changes the template for messages. + * + * @param {string} template for messages. + * + * @returns {Object} self + */ + this.messageTemplate = function(template){ + messageTemplate = template; + return this; + }; + + /** + * @ngdoc method + * @name adf.dashboardProvider#loadingTemplate + * @methodOf adf.dashboardProvider + * @description + * + * Changes the template which is displayed as + * long as the widget resources are not resolved. + * + * @param {string} loading template + * + * @returns {Object} self + */ + this.loadingTemplate = function(template){ + loadingTemplate = template; + return this; + }; + + /** + * @ngdoc service + * @name adf.dashboard + * @description + * + * The dashboard holds all options, structures and widgets. + * + * @property {Array.} widgets Array of registered widgets. + * @property {string} widgetsPath Default path for widgets. + * @property {Array.} structures Array of registered structures. + * @property {string} messageTemplate Template for messages. + * @property {string} loadingTemplate Template for widget loading. + * + * @returns {Object} self + */ + this.$get = function(){ + var cid = 0; + + return { + widgets: widgets, + widgetsPath: widgetsPath, + structures: structures, + messageTemplate: messageTemplate, + loadingTemplate: loadingTemplate, + + /** + * @ngdoc method + * @name adf.dashboard#id + * @methodOf adf.dashboard + * @description + * + * Creates an ongoing numeric id. The method is used to create ids for + * columns and widgets in the dashboard. + */ + id: function(){ + return ++cid; + } + }; + }; + + }); + +/* +* The MIT License +* +* Copyright (c) 2015, Sebastian Sdorra +* +* Permission is hereby granted, free of charge, to any person obtaining a copy +* of this software and associated documentation files (the "Software"), to deal +* in the Software without restriction, including without limitation the rights +* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +* copies of the Software, and to permit persons to whom the Software is +* furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included in +* all copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +* SOFTWARE. +*/ + + +/* global angular */ +angular.module('adf') + .directive('adfDashboardRow', ["$compile", "adfTemplatePath", "columnTemplate", function ($compile, adfTemplatePath, columnTemplate) { + + + return { + restrict: 'E', + replace: true, + scope: { + row: '=', + adfModel: '=', + editMode: '=', + options: '=' + }, + templateUrl: adfTemplatePath + 'dashboard-row.html', + link: function ($scope, $element) { + if (angular.isDefined($scope.row.columns) && angular.isArray($scope.row.columns)) { + $compile(columnTemplate)($scope, function(cloned) { + $element.append(cloned); + }); + } + } + }; + }]); + +/* + * The MIT License + * + * Copyright (c) 2015, Sebastian Sdorra + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + + + +angular.module('adf') + .directive('adfWidgetContent', ["$log", "$q", "$sce", "$http", "$templateCache", "$compile", "$controller", "$injector", "dashboard", function($log, $q, $sce, $http, $templateCache, + $compile, $controller, $injector, dashboard) { + + function parseUrl(url){ + var parsedUrl = url; + if ( url.indexOf('{widgetsPath}') >= 0 ){ + parsedUrl = url.replace('{widgetsPath}', dashboard.widgetsPath) + .replace('//', '/'); + if (parsedUrl.indexOf('/') === 0){ + parsedUrl = parsedUrl.substring(1); + } + } + return parsedUrl; + } + + function getTemplate(widget){ + var deferred = $q.defer(); + + if ( widget.template ){ + deferred.resolve(widget.template); + } else if (widget.templateUrl) { + // try to fetch template from cache + var tpl = $templateCache.get(widget.templateUrl); + if (tpl){ + deferred.resolve(tpl); + } else { + var url = $sce.getTrustedResourceUrl(parseUrl(widget.templateUrl)); + $http.get(url) + .success(function(response){ + // put response to cache, with unmodified url as key + $templateCache.put(widget.templateUrl, response); + deferred.resolve(response); + }) + .error(function(){ + deferred.reject('could not load template'); + }); + } + } + + return deferred.promise; + } + + function compileWidget($scope, $element, currentScope) { + var model = $scope.model; + var content = $scope.content; + + // display loading template + $element.html(dashboard.loadingTemplate); + + // create new scope + var templateScope = $scope.$new(); + + // pass config object to scope + if (!model.config) { + model.config = {}; + } + + templateScope.config = model.config; + + // local injections + var base = { + $scope: templateScope, + widget: model, + config: model.config + }; + + // get resolve promises from content object + var resolvers = {}; + resolvers.$tpl = getTemplate(content); + if (content.resolve) { + angular.forEach(content.resolve, function(promise, key) { + if (angular.isString(promise)) { + resolvers[key] = $injector.get(promise); + } else { + resolvers[key] = $injector.invoke(promise, promise, base); + } + }); + } + + // resolve all resolvers + $q.all(resolvers).then(function(locals) { + angular.extend(locals, base); + + // compile & render template + var template = locals.$tpl; + $element.html(template); + if (content.controller) { + var templateCtrl = $controller(content.controller, locals); + if (content.controllerAs){ + templateScope[content.controllerAs] = templateCtrl; + } + $element.children().data('$ngControllerController', templateCtrl); + } + $compile($element.contents())(templateScope); + }, function(reason) { + // handle promise rejection + var msg = 'Could not resolve all promises'; + if (reason) { + msg += ': ' + reason; + } + $log.warn(msg); + $element.html(dashboard.messageTemplate.replace(/{}/g, msg)); + }); + + // destroy old scope + if (currentScope){ + currentScope.$destroy(); + } + + return templateScope; + } + + return { + replace: true, + restrict: 'EA', + transclude: false, + scope: { + model: '=', + content: '=' + }, + link: function($scope, $element) { + var currentScope = compileWidget($scope, $element, null); + $scope.$on('widgetConfigChanged', function(){ + currentScope = compileWidget($scope, $element, currentScope); + }); + $scope.$on('widgetReload', function(){ + currentScope = compileWidget($scope, $element, currentScope); + }); + } + }; + + }]); + +/* + * The MIT License + * + * Copyright (c) 2015, Sebastian Sdorra + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + + + +angular.module('adf') + .directive('adfWidget', ["$log", "$modal", "dashboard", "adfTemplatePath", function($log, $modal, dashboard, adfTemplatePath) { + + function preLink($scope){ + var definition = $scope.definition; + if (definition) { + var w = dashboard.widgets[definition.type]; + if (w) { + // pass title + if (!definition.title){ + definition.title = w.title; + } + + if (!definition.titleTemplateUrl) { + definition.titleTemplateUrl = adfTemplatePath + 'widget-title.html'; + } + + // set id for sortable + if (!definition.wid){ + definition.wid = dashboard.id(); + } + + // pass copy of widget to scope + $scope.widget = angular.copy(w); + + // create config object + var config = definition.config; + if (config) { + if (angular.isString(config)) { + config = angular.fromJson(config); + } + } else { + config = {}; + } + + // pass config to scope + $scope.config = config; + + // collapse exposed $scope.widgetState property + if(!$scope.widgetState){ + $scope.widgetState ={}; + $scope.widgetState.isCollapsed= false; + } + + } else { + $log.warn('could not find widget ' + definition.type); + } + } else { + $log.debug('definition not specified, widget was probably removed'); + } + } + + function postLink($scope, $element) { + var definition = $scope.definition; + if (definition) { + // bind close function + + var deleteWidget = function(){ + var column = $scope.col; + if (column) { + var index = column.widgets.indexOf(definition); + if (index >= 0) { + column.widgets.splice(index, 1); + } + } + $element.remove(); + } + $scope.remove = function() { + if($scope.options.enableConfirmDelete){ + var deleteScope= $scope.$new(); + var adfDeleteTemplatePath = adfTemplatePath + 'widget-delete.html'; + if (definition.deleteTemplateUrl) { + adfEditTemplatePath = definition.deleteTemplateUrl; + } + var opts = { + scope: deleteScope, + templateUrl: adfDeleteTemplatePath, + backdrop: 'static' + }; + var instance = $modal.open(opts); + + deleteScope.closeDialog = function() { + instance.close(); + deleteScope.$destroy(); + }; + deleteScope.deleteDialog = function() { + deleteWidget(); + deleteScope.closeDialog(); + }; + } + else { + deleteWidget(); + } + } + + // bind reload function + $scope.reload = function(){ + $scope.$broadcast('widgetReload'); + }; + + // bind edit function + $scope.edit = function() { + var editScope = $scope.$new(); + editScope.definition = angular.copy(definition); + var opts = { + scope: editScope, + templateUrl: adfTemplatePath + 'widget-edit.html', + backdrop: 'static' + }; + + var instance = $modal.open(opts); + editScope.closeDialog = function() { + instance.close(); + editScope.$destroy(); + + var widget = $scope.widget; + if (widget.edit && widget.edit.reload){ + // reload content after edit dialog is closed + $scope.$broadcast('widgetConfigChanged'); + } + }; + editScope.saveDialog = function() { + definition.title = editScope.definition.title; + angular.extend(definition.config,editScope.definition.config); + editScope.closeDialog(); + }; + }; + } else { + $log.debug('widget not found'); + } + } + + return { + replace: true, + restrict: 'EA', + transclude: false, + templateUrl: adfTemplatePath + 'widget.html', + scope: { + definition: '=', + col: '=column', + editMode: '=', + options: '=', + widgetState: '=' + }, + + controller: ["$scope", function ($scope) { + + $scope.$on("adfDashboardCollapseExapand",function(event,args){ + $scope.widgetState.isCollapsed = args.collapseExpandStatus; + }); + + $scope.openFullScreen = function() { + var definition = $scope.definition; + var fullScreenScope = $scope.$new(); + var opts = { + scope: fullScreenScope, + templateUrl: adfTemplatePath + 'widget-fullscreen.html', + size: definition.modalSize || 'lg', // 'sm', 'lg' + backdrop: 'static', + windowClass: (definition.fullScreen) ? 'dashboard-modal widget-fullscreen' : 'dashboard-modal' + }; + + var instance = $modal.open(opts); + fullScreenScope.closeDialog = function () { + instance.close(); + fullScreenScope.$destroy(); + }; + }; + }], + + compile: function compile(){ + + /** + * use pre link, because link of widget-content + * is executed before post link widget + */ + return { + pre: preLink, + post: postLink + }; + } + }; + + }]); + +angular.module("adf").run(["$templateCache", function($templateCache) {$templateCache.put("../src/templates/dashboard-column.html","
          "); +$templateCache.put("../src/templates/dashboard-edit.html"," "); +$templateCache.put("../src/templates/dashboard-row.html","
          "); +$templateCache.put("../src/templates/dashboard-title.html","

          {{model.title}}

          "); +$templateCache.put("../src/templates/dashboard.html","
          "); +$templateCache.put("../src/templates/widget-add.html"," "); +$templateCache.put("../src/templates/widget-delete.html"," "); +$templateCache.put("../src/templates/widget-edit.html"," "); +$templateCache.put("../src/templates/widget-fullscreen.html"," "); +$templateCache.put("../src/templates/widget-title.html","

          {{definition.title}}

          "); +$templateCache.put("../src/templates/widget.html","
          ");}]);})(window); \ No newline at end of file diff --git a/public/bower_components/angular-file-upload/angular-file-upload.min.js b/public/bower_components/angular-file-upload/angular-file-upload.min.js new file mode 100644 index 0000000..fa745d3 --- /dev/null +++ b/public/bower_components/angular-file-upload/angular-file-upload.min.js @@ -0,0 +1,7 @@ +/* + angular-file-upload v2.1.4 + https://github.com/nervgh/angular-file-upload +*/ + +!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):"object"==typeof exports?exports["angular-file-upload"]=t():e["angular-file-upload"]=t()}(this,function(){return function(e){function t(r){if(n[r])return n[r].exports;var i=n[r]={exports:{},id:r,loaded:!1};return e[r].call(i.exports,i,i.exports,t),i.loaded=!0,i.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){"use strict";var r=function(e){return e&&e.__esModule?e["default"]:e},i=r(n(2)),o=r(n(3)),s=r(n(4)),a=r(n(5)),u=r(n(6)),l=r(n(7)),c=r(n(1)),f=r(n(8)),p=r(n(9)),d=r(n(10)),v=r(n(11)),h=r(n(12));angular.module(i.name,[]).value("fileUploaderOptions",o).factory("FileUploader",s).factory("FileLikeObject",a).factory("FileItem",u).factory("FileDirective",l).factory("FileSelect",c).factory("FileDrop",f).factory("FileOver",p).directive("nvFileSelect",d).directive("nvFileDrop",v).directive("nvFileOver",h).run(["FileUploader","FileLikeObject","FileItem","FileDirective","FileSelect","FileDrop","FileOver",function(e,t,n,r,i,o,s){e.FileLikeObject=t,e.FileItem=n,e.FileDirective=r,e.FileSelect=i,e.FileDrop=o,e.FileOver=s}])},function(e,t,n){"use strict";var r=function(e){return e&&e.__esModule?e["default"]:e},i=function(){function e(e,t){for(var n in t){var r=t[n];r.configurable=!0,r.value&&(r.writable=!0)}Object.defineProperties(e,t)}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),o=function l(e,t,n){var r=Object.getOwnPropertyDescriptor(e,t);if(void 0===r){var i=Object.getPrototypeOf(e);return null===i?void 0:l(i,t,n)}if("value"in r&&r.writable)return r.value;var o=r.get;return void 0===o?void 0:o.call(n)},s=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(e.__proto__=t)},a=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},u=(r(n(2)),angular.extend);e.exports=function(e){var t=function(e){function t(e){a(this,t);var n=u(e,{events:{$destroy:"destroy",change:"onChange"},prop:"select"});o(Object.getPrototypeOf(t.prototype),"constructor",this).call(this,n),this.uploader.isHTML5||this.element.removeAttr("multiple"),this.element.prop("value",null)}return s(t,e),i(t,{getOptions:{value:function(){}},getFilters:{value:function(){}},isEmptyAfterSelection:{value:function(){return!!this.element.attr("multiple")}},onChange:{value:function(){var e=this.uploader.isHTML5?this.element[0].files:this.element[0],t=this.getOptions(),n=this.getFilters();this.uploader.isHTML5||this.destroy(),this.uploader.addToQueue(e,t,n),this.isEmptyAfterSelection()&&(this.element.prop("value",null),this.element.replaceWith(this.element=this.element.clone(!0)))}}}),t}(e);return t},e.exports.$inject=["FileDirective"]},function(e,t){e.exports={name:"angularFileUpload"}},function(e,t){"use strict";e.exports={url:"/",alias:"file",headers:{},queue:[],progress:0,autoUpload:!1,removeAfterUpload:!1,method:"POST",filters:[],formData:[],queueLimit:Number.MAX_VALUE,withCredentials:!1}},function(e,t,n){"use strict";var r=function(e){return e&&e.__esModule?e["default"]:e},i=function(){function e(e,t){for(var n in t){var r=t[n];r.configurable=!0,r.value&&(r.writable=!0)}Object.defineProperties(e,t)}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),o=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},s=(r(n(2)),angular.copy),a=angular.extend,u=angular.forEach,l=angular.isObject,c=angular.isNumber,f=angular.isDefined,p=angular.isArray,d=angular.element;e.exports=function(e,t,n,r,v,h){var m=r.File,g=r.FormData,_=function(){function r(t){o(this,r);var n=s(e);a(this,n,t,{isUploading:!1,_nextIndex:0,_failFilterIndex:-1,_directives:{select:[],drop:[],over:[]}}),this.filters.unshift({name:"queueLimit",fn:this._queueLimitFilter}),this.filters.unshift({name:"folder",fn:this._folderFilter})}return i(r,{addToQueue:{value:function(e,t,n){var r=this,i=this.isArrayLikeObject(e)?e:[e],o=this._getFilters(n),s=this.queue.length,a=[];u(i,function(e){var n=new v(e);if(r._isValidFile(n,o,t)){var i=new h(r,e,t);a.push(i),r.queue.push(i),r._onAfterAddingFile(i)}else{var s=o[r._failFilterIndex];r._onWhenAddingFileFailed(n,s,t)}}),this.queue.length!==s&&(this._onAfterAddingAll(a),this.progress=this._getTotalProgress()),this._render(),this.autoUpload&&this.uploadAll()}},removeFromQueue:{value:function(e){var t=this.getIndexOfItem(e),n=this.queue[t];n.isUploading&&n.cancel(),this.queue.splice(t,1),n._destroy(),this.progress=this._getTotalProgress()}},clearQueue:{value:function(){for(;this.queue.length;)this.queue[0].remove();this.progress=0}},uploadItem:{value:function(e){var t=this.getIndexOfItem(e),n=this.queue[t],r=this.isHTML5?"_xhrTransport":"_iframeTransport";n._prepareToUploading(),this.isUploading||(this.isUploading=!0,this[r](n))}},cancelItem:{value:function(e){var t=this.getIndexOfItem(e),n=this.queue[t],r=this.isHTML5?"_xhr":"_form";n&&n.isUploading&&n[r].abort()}},uploadAll:{value:function(){var e=this.getNotUploadedItems().filter(function(e){return!e.isUploading});e.length&&(u(e,function(e){return e._prepareToUploading()}),e[0].upload())}},cancelAll:{value:function(){var e=this.getNotUploadedItems();u(e,function(e){return e.cancel()})}},isFile:{value:function(e){return this.constructor.isFile(e)}},isFileLikeObject:{value:function(e){return this.constructor.isFileLikeObject(e)}},isArrayLikeObject:{value:function(e){return this.constructor.isArrayLikeObject(e)}},getIndexOfItem:{value:function(e){return c(e)?e:this.queue.indexOf(e)}},getNotUploadedItems:{value:function(){return this.queue.filter(function(e){return!e.isUploaded})}},getReadyItems:{value:function(){return this.queue.filter(function(e){return e.isReady&&!e.isUploading}).sort(function(e,t){return e.index-t.index})}},destroy:{value:function(){var e=this;u(this._directives,function(t){u(e._directives[t],function(e){e.destroy()})})}},onAfterAddingAll:{value:function(e){}},onAfterAddingFile:{value:function(e){}},onWhenAddingFileFailed:{value:function(e,t,n){}},onBeforeUploadItem:{value:function(e){}},onProgressItem:{value:function(e,t){}},onProgressAll:{value:function(e){}},onSuccessItem:{value:function(e,t,n,r){}},onErrorItem:{value:function(e,t,n,r){}},onCancelItem:{value:function(e,t,n,r){}},onCompleteItem:{value:function(e,t,n,r){}},onCompleteAll:{value:function(){}},_getTotalProgress:{value:function(e){if(this.removeAfterUpload)return e||0;var t=this.getNotUploadedItems().length,n=t?this.queue.length-t:this.queue.length,r=100/this.queue.length,i=(e||0)*r/100;return Math.round(n*r+i)}},_getFilters:{value:function(e){if(!e)return this.filters;if(p(e))return e;var t=e.match(/[^\s,]+/g);return this.filters.filter(function(e){return-1!==t.indexOf(e.name)})}},_render:{value:function(){t.$$phase||t.$apply()}},_folderFilter:{value:function(e){return!(!e.size&&!e.type)}},_queueLimitFilter:{value:function(){return this.queue.length=200&&300>e||304===e}},_transformResponse:{value:function(e,t){var r=this._headersGetter(t);return u(n.defaults.transformResponse,function(t){e=t(e,r)}),e}},_parseHeaders:{value:function(e){var t,n,r,i={};return e?(u(e.split("\n"),function(e){r=e.indexOf(":"),t=e.slice(0,r).trim().toLowerCase(),n=e.slice(r+1).trim(),t&&(i[t]=i[t]?i[t]+", "+n:n)}),i):i}},_headersGetter:{value:function(e){return function(t){return t?e[t.toLowerCase()]||null:e}}},_xhrTransport:{value:function(e){var t=this,n=e._xhr=new XMLHttpRequest,r=new g;if(this._onBeforeUploadItem(e),u(e.formData,function(e){u(e,function(e,t){r.append(t,e)})}),"number"!=typeof e._file.size)throw new TypeError("The file specified is no longer valid");r.append(e.alias,e._file,e.file.name),n.upload.onprogress=function(n){var r=Math.round(n.lengthComputable?100*n.loaded/n.total:0);t._onProgressItem(e,r)},n.onload=function(){var r=t._parseHeaders(n.getAllResponseHeaders()),i=t._transformResponse(n.response,r),o=t._isSuccessCode(n.status)?"Success":"Error",s="_on"+o+"Item";t[s](e,i,n.status,r),t._onCompleteItem(e,i,n.status,r)},n.onerror=function(){var r=t._parseHeaders(n.getAllResponseHeaders()),i=t._transformResponse(n.response,r);t._onErrorItem(e,i,n.status,r),t._onCompleteItem(e,i,n.status,r)},n.onabort=function(){var r=t._parseHeaders(n.getAllResponseHeaders()),i=t._transformResponse(n.response,r);t._onCancelItem(e,i,n.status,r),t._onCompleteItem(e,i,n.status,r)},n.open(e.method,e.url,!0),n.withCredentials=e.withCredentials,u(e.headers,function(e,t){n.setRequestHeader(t,e)}),n.send(r),this._render()}},_iframeTransport:{value:function(e){var t=this,n=d('
          '),r=d(''); + else + lyr1 = $(''); + + if (opts.theme) + lyr2 = $(''); + else + lyr2 = $(''); + + if (opts.theme && full) { + s = ''; + } + else if (opts.theme) { + s = ''; + } + else if (full) { + s = ''; + } + else { + s = ''; + } + lyr3 = $(s); + + // if we have a message, style it + if (msg) { + if (opts.theme) { + lyr3.css(themedCSS); + lyr3.addClass('ui-widget-content'); + } + else + lyr3.css(css); + } + + // style the overlay + if (!opts.theme /*&& (!opts.applyPlatformOpacityRules)*/) + lyr2.css(opts.overlayCSS); + lyr2.css('position', full ? 'fixed' : 'absolute'); + + // make iframe layer transparent in IE + if (msie || opts.forceIframe) + lyr1.css('opacity',0.0); + + //$([lyr1[0],lyr2[0],lyr3[0]]).appendTo(full ? 'body' : el); + var layers = [lyr1,lyr2,lyr3], $par = full ? $('body') : $(el); + $.each(layers, function() { + this.appendTo($par); + }); + + if (opts.theme && opts.draggable && $.fn.draggable) { + lyr3.draggable({ + handle: '.ui-dialog-titlebar', + cancel: 'li' + }); + } + + // ie7 must use absolute positioning in quirks mode and to account for activex issues (when scrolling) + var expr = setExpr && (!$.support.boxModel || $('object,embed', full ? null : el).length > 0); + if (ie6 || expr) { + // give body 100% height + if (full && opts.allowBodyStretch && $.support.boxModel) + $('html,body').css('height','100%'); + + // fix ie6 issue when blocked element has a border width + if ((ie6 || !$.support.boxModel) && !full) { + var t = sz(el,'borderTopWidth'), l = sz(el,'borderLeftWidth'); + var fixT = t ? '(0 - '+t+')' : 0; + var fixL = l ? '(0 - '+l+')' : 0; + } + + // simulate fixed position + $.each(layers, function(i,o) { + var s = o[0].style; + s.position = 'absolute'; + if (i < 2) { + if (full) + s.setExpression('height','Math.max(document.body.scrollHeight, document.body.offsetHeight) - (jQuery.support.boxModel?0:'+opts.quirksmodeOffsetHack+') + "px"'); + else + s.setExpression('height','this.parentNode.offsetHeight + "px"'); + if (full) + s.setExpression('width','jQuery.support.boxModel && document.documentElement.clientWidth || document.body.clientWidth + "px"'); + else + s.setExpression('width','this.parentNode.offsetWidth + "px"'); + if (fixL) s.setExpression('left', fixL); + if (fixT) s.setExpression('top', fixT); + } + else if (opts.centerY) { + if (full) s.setExpression('top','(document.documentElement.clientHeight || document.body.clientHeight) / 2 - (this.offsetHeight / 2) + (blah = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "px"'); + s.marginTop = 0; + } + else if (!opts.centerY && full) { + var top = (opts.css && opts.css.top) ? parseInt(opts.css.top, 10) : 0; + var expression = '((document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + '+top+') + "px"'; + s.setExpression('top',expression); + } + }); + } + + // show the message + if (msg) { + if (opts.theme) + lyr3.find('.ui-widget-content').append(msg); + else + lyr3.append(msg); + if (msg.jquery || msg.nodeType) + $(msg).show(); + } + + if ((msie || opts.forceIframe) && opts.showOverlay) + lyr1.show(); // opacity is zero + if (opts.fadeIn) { + var cb = opts.onBlock ? opts.onBlock : noOp; + var cb1 = (opts.showOverlay && !msg) ? cb : noOp; + var cb2 = msg ? cb : noOp; + if (opts.showOverlay) + lyr2._fadeIn(opts.fadeIn, cb1); + if (msg) + lyr3._fadeIn(opts.fadeIn, cb2); + } + else { + if (opts.showOverlay) + lyr2.show(); + if (msg) + lyr3.show(); + if (opts.onBlock) + opts.onBlock.bind(lyr3)(); + } + + // bind key and mouse events + bind(1, el, opts); + + if (full) { + pageBlock = lyr3[0]; + pageBlockEls = $(opts.focusableElements,pageBlock); + if (opts.focusInput) + setTimeout(focus, 20); + } + else + center(lyr3[0], opts.centerX, opts.centerY); + + if (opts.timeout) { + // auto-unblock + var to = setTimeout(function() { + if (full) + $.unblockUI(opts); + else + $(el).unblock(opts); + }, opts.timeout); + $(el).data('blockUI.timeout', to); + } + } + + // remove the block + function remove(el, opts) { + var count; + var full = (el == window); + var $el = $(el); + var data = $el.data('blockUI.history'); + var to = $el.data('blockUI.timeout'); + if (to) { + clearTimeout(to); + $el.removeData('blockUI.timeout'); + } + opts = $.extend({}, $.blockUI.defaults, opts || {}); + bind(0, el, opts); // unbind events + + if (opts.onUnblock === null) { + opts.onUnblock = $el.data('blockUI.onUnblock'); + $el.removeData('blockUI.onUnblock'); + } + + var els; + if (full) // crazy selector to handle odd field errors in ie6/7 + els = $('body').children().filter('.blockUI').add('body > .blockUI'); + else + els = $el.find('>.blockUI'); + + // fix cursor issue + if ( opts.cursorReset ) { + if ( els.length > 1 ) + els[1].style.cursor = opts.cursorReset; + if ( els.length > 2 ) + els[2].style.cursor = opts.cursorReset; + } + + if (full) + pageBlock = pageBlockEls = null; + + if (opts.fadeOut) { + count = els.length; + els.stop().fadeOut(opts.fadeOut, function() { + if ( --count === 0) + reset(els,data,opts,el); + }); + } + else + reset(els, data, opts, el); + } + + // move blocking element back into the DOM where it started + function reset(els,data,opts,el) { + var $el = $(el); + if ( $el.data('blockUI.isBlocked') ) + return; + + els.each(function(i,o) { + // remove via DOM calls so we don't lose event handlers + if (this.parentNode) + this.parentNode.removeChild(this); + }); + + if (data && data.el) { + data.el.style.display = data.display; + data.el.style.position = data.position; + data.el.style.cursor = 'default'; // #59 + if (data.parent) + data.parent.appendChild(data.el); + $el.removeData('blockUI.history'); + } + + if ($el.data('blockUI.static')) { + $el.css('position', 'static'); // #22 + } + + if (typeof opts.onUnblock == 'function') + opts.onUnblock(el,opts); + + // fix issue in Safari 6 where block artifacts remain until reflow + var body = $(document.body), w = body.width(), cssW = body[0].style.width; + body.width(w-1).width(w); + body[0].style.width = cssW; + } + + // bind/unbind the handler + function bind(b, el, opts) { + var full = el == window, $el = $(el); + + // don't bother unbinding if there is nothing to unbind + if (!b && (full && !pageBlock || !full && !$el.data('blockUI.isBlocked'))) + return; + + $el.data('blockUI.isBlocked', b); + + // don't bind events when overlay is not in use or if bindEvents is false + if (!full || !opts.bindEvents || (b && !opts.showOverlay)) + return; + + // bind anchors and inputs for mouse and key events + var events = 'mousedown mouseup keydown keypress keyup touchstart touchend touchmove'; + if (b) + $(document).bind(events, opts, handler); + else + $(document).unbind(events, handler); + + // former impl... + // var $e = $('a,:input'); + // b ? $e.bind(events, opts, handler) : $e.unbind(events, handler); + } + + // event handler to suppress keyboard/mouse events when blocking + function handler(e) { + // allow tab navigation (conditionally) + if (e.type === 'keydown' && e.keyCode && e.keyCode == 9) { + if (pageBlock && e.data.constrainTabKey) { + var els = pageBlockEls; + var fwd = !e.shiftKey && e.target === els[els.length-1]; + var back = e.shiftKey && e.target === els[0]; + if (fwd || back) { + setTimeout(function(){focus(back);},10); + return false; + } + } + } + var opts = e.data; + var target = $(e.target); + if (target.hasClass('blockOverlay') && opts.onOverlayClick) + opts.onOverlayClick(e); + + // allow events within the message content + if (target.parents('div.' + opts.blockMsgClass).length > 0) + return true; + + // allow events for content that is not being blocked + return target.parents().children().filter('div.blockUI').length === 0; + } + + function focus(back) { + if (!pageBlockEls) + return; + var e = pageBlockEls[back===true ? pageBlockEls.length-1 : 0]; + if (e) + e.focus(); + } + + function center(el, x, y) { + var p = el.parentNode, s = el.style; + var l = ((p.offsetWidth - el.offsetWidth)/2) - sz(p,'borderLeftWidth'); + var t = ((p.offsetHeight - el.offsetHeight)/2) - sz(p,'borderTopWidth'); + if (x) s.left = l > 0 ? (l+'px') : '0'; + if (y) s.top = t > 0 ? (t+'px') : '0'; + } + + function sz(el, p) { + return parseInt($.css(el,p),10)||0; + } + + } + + + /*global define:true */ + if (typeof define === 'function' && define.amd && define.amd.jQuery) { + define(['jquery'], setup); + } else { + setup(jQuery); + } + +})(); diff --git a/public/bower_components/bootstrap-hover-dropdown/bootstrap-hover-dropdown.js b/public/bower_components/bootstrap-hover-dropdown/bootstrap-hover-dropdown.js new file mode 100644 index 0000000..28b38b5 --- /dev/null +++ b/public/bower_components/bootstrap-hover-dropdown/bootstrap-hover-dropdown.js @@ -0,0 +1,124 @@ +/** + * @preserve + * Project: Bootstrap Hover Dropdown + * Author: Cameron Spear + * Version: v2.1.3 + * Contributors: Mattia Larentis + * Dependencies: Bootstrap's Dropdown plugin, jQuery + * Description: A simple plugin to enable Bootstrap dropdowns to active on hover and provide a nice user experience. + * License: MIT + * Homepage: http://cameronspear.com/blog/bootstrap-dropdown-on-hover-plugin/ + */ +;(function ($, window, undefined) { + // outside the scope of the jQuery plugin to + // keep track of all dropdowns + var $allDropdowns = $(); + + // if instantlyCloseOthers is true, then it will instantly + // shut other nav items when a new one is hovered over + $.fn.dropdownHover = function (options) { + // don't do anything if touch is supported + // (plugin causes some issues on mobile) + if('ontouchstart' in document) return this; // don't want to affect chaining + + // the element we really care about + // is the dropdown-toggle's parent + $allDropdowns = $allDropdowns.add(this.parent()); + + return this.each(function () { + var $this = $(this), + $parent = $this.parent(), + defaults = { + delay: 500, + hoverDelay: 0, + instantlyCloseOthers: true + }, + data = { + delay: $(this).data('delay'), + hoverDelay: $(this).data('hover-delay'), + instantlyCloseOthers: $(this).data('close-others') + }, + showEvent = 'show.bs.dropdown', + hideEvent = 'hide.bs.dropdown', + // shownEvent = 'shown.bs.dropdown', + // hiddenEvent = 'hidden.bs.dropdown', + settings = $.extend(true, {}, defaults, options, data), + timeout, timeoutHover; + + $parent.hover(function (event) { + // so a neighbor can't open the dropdown + if(!$parent.hasClass('open') && !$this.is(event.target)) { + // stop this event, stop executing any code + // in this callback but continue to propagate + return true; + } + + openDropdown(event); + }, function () { + // clear timer for hover event + window.clearTimeout(timeoutHover) + timeout = window.setTimeout(function () { + $this.attr('aria-expanded', 'false'); + $parent.removeClass('open'); + $this.trigger(hideEvent); + }, settings.delay); + }); + + // this helps with button groups! + $this.hover(function (event) { + // this helps prevent a double event from firing. + // see https://github.com/CWSpear/bootstrap-hover-dropdown/issues/55 + if(!$parent.hasClass('open') && !$parent.is(event.target)) { + // stop this event, stop executing any code + // in this callback but continue to propagate + return true; + } + + openDropdown(event); + }); + + // handle submenus + $parent.find('.dropdown-submenu').each(function (){ + var $this = $(this); + var subTimeout; + $this.hover(function () { + window.clearTimeout(subTimeout); + $this.children('.dropdown-menu').show(); + // always close submenu siblings instantly + $this.siblings().children('.dropdown-menu').hide(); + }, function () { + var $submenu = $this.children('.dropdown-menu'); + subTimeout = window.setTimeout(function () { + $submenu.hide(); + }, settings.delay); + }); + }); + + function openDropdown(event) { + // clear dropdown timeout here so it doesnt close before it should + window.clearTimeout(timeout); + // restart hover timer + window.clearTimeout(timeoutHover); + + // delay for hover event. + timeoutHover = window.setTimeout(function () { + $allDropdowns.find(':focus').blur(); + + if(settings.instantlyCloseOthers === true) + $allDropdowns.removeClass('open'); + + // clear timer for hover event + window.clearTimeout(timeoutHover); + $this.attr('aria-expanded', 'true'); + $parent.addClass('open'); + $this.trigger(showEvent); + }, settings.hoverDelay); + } + }); + }; + + $(document).ready(function () { + // apply dropdownHover to all elements with the data-hover="dropdown" attribute + $('[data-hover="dropdown"]').dropdownHover(); + }); +})(jQuery, window); diff --git a/public/bower_components/bootstrap-select/bootstrap-select.css b/public/bower_components/bootstrap-select/bootstrap-select.css new file mode 100644 index 0000000..c8a1a45 --- /dev/null +++ b/public/bower_components/bootstrap-select/bootstrap-select.css @@ -0,0 +1,272 @@ +/*! + * Bootstrap-select v1.7.5 (http://silviomoreto.github.io/bootstrap-select) + * + * Copyright 2013-2015 bootstrap-select + * Licensed under MIT (https://github.com/silviomoreto/bootstrap-select/blob/master/LICENSE) + */ + +.bootstrap-select { + width: 220px \0; + /*IE9 and below*/ +} +.bootstrap-select > .dropdown-toggle { + width: 100%; + padding-right: 25px; +} +.has-error .bootstrap-select .dropdown-toggle, +.error .bootstrap-select .dropdown-toggle { + border-color: #b94a48; +} +.bootstrap-select.fit-width { + width: auto !important; +} +.bootstrap-select:not([class*="col-"]):not([class*="form-control"]):not(.input-group-btn) { + width: 220px; +} +.bootstrap-select .dropdown-toggle:focus { + outline: thin dotted #333333 !important; + outline: 5px auto -webkit-focus-ring-color !important; + outline-offset: -2px; +} +.bootstrap-select.form-control { + margin-bottom: 0; + padding: 0; + border: none; +} +.bootstrap-select.form-control:not([class*="col-"]) { + width: 100%; +} +.bootstrap-select.form-control.input-group-btn { + z-index: auto; +} +.bootstrap-select.btn-group:not(.input-group-btn), +.bootstrap-select.btn-group[class*="col-"] { + float: none; + display: inline-block; + margin-left: 0; +} +.bootstrap-select.btn-group.dropdown-menu-right, +.bootstrap-select.btn-group[class*="col-"].dropdown-menu-right, +.row .bootstrap-select.btn-group[class*="col-"].dropdown-menu-right { + float: right; +} +.form-inline .bootstrap-select.btn-group, +.form-horizontal .bootstrap-select.btn-group, +.form-group .bootstrap-select.btn-group { + margin-bottom: 0; +} +.form-group-lg .bootstrap-select.btn-group.form-control, +.form-group-sm .bootstrap-select.btn-group.form-control { + padding: 0; +} +.form-inline .bootstrap-select.btn-group .form-control { + width: 100%; +} +.bootstrap-select.btn-group.disabled, +.bootstrap-select.btn-group > .disabled { + cursor: not-allowed; +} +.bootstrap-select.btn-group.disabled:focus, +.bootstrap-select.btn-group > .disabled:focus { + outline: none !important; +} +.bootstrap-select.btn-group.bs-container { + position: absolute; +} +.bootstrap-select.btn-group.bs-container .dropdown-menu { + z-index: 1060; +} +.bootstrap-select.btn-group .dropdown-toggle .filter-option { + display: inline-block; + overflow: hidden; + width: 100%; + text-align: left; +} +.bootstrap-select.btn-group .dropdown-toggle .caret { + position: absolute; + top: 50%; + right: 12px; + margin-top: -2px; + vertical-align: middle; +} +.bootstrap-select.btn-group[class*="col-"] .dropdown-toggle { + width: 100%; +} +.bootstrap-select.btn-group .dropdown-menu { + min-width: 100%; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; +} +.bootstrap-select.btn-group .dropdown-menu.inner { + position: static; + float: none; + border: 0; + padding: 0; + margin: 0; + border-radius: 0; + -webkit-box-shadow: none; + box-shadow: none; +} +.bootstrap-select.btn-group .dropdown-menu li { + position: relative; +} +.bootstrap-select.btn-group .dropdown-menu li.active small { + color: #fff; +} +.bootstrap-select.btn-group .dropdown-menu li.disabled a { + cursor: not-allowed; +} +.bootstrap-select.btn-group .dropdown-menu li a { + cursor: pointer; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; +} +.bootstrap-select.btn-group .dropdown-menu li a.opt { + position: relative; + padding-left: 2.25em; +} +.bootstrap-select.btn-group .dropdown-menu li a span.check-mark { + display: none; +} +.bootstrap-select.btn-group .dropdown-menu li a span.text { + display: inline-block; +} +.bootstrap-select.btn-group .dropdown-menu li small { + padding-left: 0.5em; +} +.bootstrap-select.btn-group .dropdown-menu .notify { + position: absolute; + bottom: 5px; + width: 96%; + margin: 0 2%; + min-height: 26px; + padding: 3px 5px; + background: #f5f5f5; + border: 1px solid #e3e3e3; + -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05); + box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05); + pointer-events: none; + opacity: 0.9; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; +} +.bootstrap-select.btn-group .no-results { + padding: 3px; + background: #f5f5f5; + margin: 0 5px; + white-space: nowrap; +} +.bootstrap-select.btn-group.fit-width .dropdown-toggle .filter-option { + position: static; +} +.bootstrap-select.btn-group.fit-width .dropdown-toggle .caret { + position: static; + top: auto; + margin-top: -1px; +} +.bootstrap-select.btn-group.show-tick .dropdown-menu li.selected a span.check-mark { + position: absolute; + display: inline-block; + right: 15px; + margin-top: 5px; +} +.bootstrap-select.btn-group.show-tick .dropdown-menu li a span.text { + margin-right: 34px; +} +.bootstrap-select.show-menu-arrow.open > .dropdown-toggle { + z-index: 1061; +} +.bootstrap-select.show-menu-arrow .dropdown-toggle:before { + content: ''; + border-left: 7px solid transparent; + border-right: 7px solid transparent; + border-bottom: 7px solid rgba(204, 204, 204, 0.2); + position: absolute; + bottom: -4px; + left: 9px; + display: none; +} +.bootstrap-select.show-menu-arrow .dropdown-toggle:after { + content: ''; + border-left: 6px solid transparent; + border-right: 6px solid transparent; + border-bottom: 6px solid white; + position: absolute; + bottom: -4px; + left: 10px; + display: none; +} +.bootstrap-select.show-menu-arrow.dropup .dropdown-toggle:before { + bottom: auto; + top: -3px; + border-top: 7px solid rgba(204, 204, 204, 0.2); + border-bottom: 0; +} +.bootstrap-select.show-menu-arrow.dropup .dropdown-toggle:after { + bottom: auto; + top: -3px; + border-top: 6px solid white; + border-bottom: 0; +} +.bootstrap-select.show-menu-arrow.pull-right .dropdown-toggle:before { + right: 12px; + left: auto; +} +.bootstrap-select.show-menu-arrow.pull-right .dropdown-toggle:after { + right: 13px; + left: auto; +} +.bootstrap-select.show-menu-arrow.open > .dropdown-toggle:before, +.bootstrap-select.show-menu-arrow.open > .dropdown-toggle:after { + display: block; +} +.bs-searchbox, +.bs-actionsbox, +.bs-donebutton { + padding: 4px 8px; +} +.bs-actionsbox { + width: 100%; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; +} +.bs-actionsbox .btn-group button { + width: 50%; +} +.bs-donebutton { + float: left; + width: 100%; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; +} +.bs-donebutton .btn-group button { + width: 100%; +} +.bs-searchbox + .bs-actionsbox { + padding: 0 8px 4px; +} +.bs-searchbox .form-control { + margin-bottom: 0; + width: 100%; + float: none; +} +select.bs-select-hidden, +select.selectpicker { + display: none !important; +} +select.mobile-device { + position: absolute !important; + top: 0; + left: 0; + display: block !important; + width: 100%; + height: 100% !important; + opacity: 0; +} +/*# sourceMappingURL=bootstrap-select.css.map */ \ No newline at end of file diff --git a/public/bower_components/bootstrap-select/bootstrap-select.js b/public/bower_components/bootstrap-select/bootstrap-select.js new file mode 100644 index 0000000..7d4b79f --- /dev/null +++ b/public/bower_components/bootstrap-select/bootstrap-select.js @@ -0,0 +1,1660 @@ +/*! + * Bootstrap-select v1.7.5 (http://silviomoreto.github.io/bootstrap-select) + * + * Copyright 2013-2015 bootstrap-select + * Licensed under MIT (https://github.com/silviomoreto/bootstrap-select/blob/master/LICENSE) + */ + +(function (root, factory) { + if (typeof define === 'function' && define.amd) { + // AMD. Register as an anonymous module unless amdModuleId is set + define(["jquery"], function (a0) { + return (factory(a0)); + }); + } else if (typeof exports === 'object') { + // Node. Does not work with strict CommonJS, but + // only CommonJS-like environments that support module.exports, + // like Node. + module.exports = factory(require("jquery")); + } else { + factory(jQuery); + } +}(this, function (jQuery) { + +(function ($) { + 'use strict'; + + // + if (!String.prototype.includes) { + (function () { + 'use strict'; // needed to support `apply`/`call` with `undefined`/`null` + var toString = {}.toString; + var defineProperty = (function () { + // IE 8 only supports `Object.defineProperty` on DOM elements + try { + var object = {}; + var $defineProperty = Object.defineProperty; + var result = $defineProperty(object, object, object) && $defineProperty; + } catch (error) { + } + return result; + }()); + var indexOf = ''.indexOf; + var includes = function (search) { + if (this == null) { + throw new TypeError(); + } + var string = String(this); + if (search && toString.call(search) == '[object RegExp]') { + throw new TypeError(); + } + var stringLength = string.length; + var searchString = String(search); + var searchLength = searchString.length; + var position = arguments.length > 1 ? arguments[1] : undefined; + // `ToInteger` + var pos = position ? Number(position) : 0; + if (pos != pos) { // better `isNaN` + pos = 0; + } + var start = Math.min(Math.max(pos, 0), stringLength); + // Avoid the `indexOf` call if no match is possible + if (searchLength + start > stringLength) { + return false; + } + return indexOf.call(string, searchString, pos) != -1; + }; + if (defineProperty) { + defineProperty(String.prototype, 'includes', { + 'value': includes, + 'configurable': true, + 'writable': true + }); + } else { + String.prototype.includes = includes; + } + }()); + } + + if (!String.prototype.startsWith) { + (function () { + 'use strict'; // needed to support `apply`/`call` with `undefined`/`null` + var defineProperty = (function () { + // IE 8 only supports `Object.defineProperty` on DOM elements + try { + var object = {}; + var $defineProperty = Object.defineProperty; + var result = $defineProperty(object, object, object) && $defineProperty; + } catch (error) { + } + return result; + }()); + var toString = {}.toString; + var startsWith = function (search) { + if (this == null) { + throw new TypeError(); + } + var string = String(this); + if (search && toString.call(search) == '[object RegExp]') { + throw new TypeError(); + } + var stringLength = string.length; + var searchString = String(search); + var searchLength = searchString.length; + var position = arguments.length > 1 ? arguments[1] : undefined; + // `ToInteger` + var pos = position ? Number(position) : 0; + if (pos != pos) { // better `isNaN` + pos = 0; + } + var start = Math.min(Math.max(pos, 0), stringLength); + // Avoid the `indexOf` call if no match is possible + if (searchLength + start > stringLength) { + return false; + } + var index = -1; + while (++index < searchLength) { + if (string.charCodeAt(start + index) != searchString.charCodeAt(index)) { + return false; + } + } + return true; + }; + if (defineProperty) { + defineProperty(String.prototype, 'startsWith', { + 'value': startsWith, + 'configurable': true, + 'writable': true + }); + } else { + String.prototype.startsWith = startsWith; + } + }()); + } + + if (!Object.keys) { + Object.keys = function ( + o, // object + k, // key + r // result array + ){ + // initialize object and result + r=[]; + // iterate over object keys + for (k in o) + // fill result array with non-prototypical keys + r.hasOwnProperty.call(o, k) && r.push(k); + // return result + return r; + }; + } + + $.fn.triggerNative = function (eventName) { + var el = this[0], + event; + + if (el.dispatchEvent) { + if (typeof Event === 'function') { + // For modern browsers + event = new Event(eventName, { + bubbles: true + }); + } else { + // For IE since it doesn't support Event constructor + event = document.createEvent('Event'); + event.initEvent(eventName, true, false); + } + + el.dispatchEvent(event); + } else { + if (el.fireEvent) { + event = document.createEventObject(); + event.eventType = eventName; + el.fireEvent('on' + eventName, event); + } + + this.trigger(eventName); + } + }; + // + + // Case insensitive contains search + $.expr[':'].icontains = function (obj, index, meta) { + var $obj = $(obj); + var haystack = ($obj.data('tokens') || $obj.text()).toUpperCase(); + return haystack.includes(meta[3].toUpperCase()); + }; + + // Case insensitive begins search + $.expr[':'].ibegins = function (obj, index, meta) { + var $obj = $(obj); + var haystack = ($obj.data('tokens') || $obj.text()).toUpperCase(); + return haystack.startsWith(meta[3].toUpperCase()); + }; + + // Case and accent insensitive contains search + $.expr[':'].aicontains = function (obj, index, meta) { + var $obj = $(obj); + var haystack = ($obj.data('tokens') || $obj.data('normalizedText') || $obj.text()).toUpperCase(); + return haystack.includes(meta[3].toUpperCase()); + }; + + // Case and accent insensitive begins search + $.expr[':'].aibegins = function (obj, index, meta) { + var $obj = $(obj); + var haystack = ($obj.data('tokens') || $obj.data('normalizedText') || $obj.text()).toUpperCase(); + return haystack.startsWith(meta[3].toUpperCase()); + }; + + /** + * Remove all diatrics from the given text. + * @access private + * @param {String} text + * @returns {String} + */ + function normalizeToBase(text) { + var rExps = [ + {re: /[\xC0-\xC6]/g, ch: "A"}, + {re: /[\xE0-\xE6]/g, ch: "a"}, + {re: /[\xC8-\xCB]/g, ch: "E"}, + {re: /[\xE8-\xEB]/g, ch: "e"}, + {re: /[\xCC-\xCF]/g, ch: "I"}, + {re: /[\xEC-\xEF]/g, ch: "i"}, + {re: /[\xD2-\xD6]/g, ch: "O"}, + {re: /[\xF2-\xF6]/g, ch: "o"}, + {re: /[\xD9-\xDC]/g, ch: "U"}, + {re: /[\xF9-\xFC]/g, ch: "u"}, + {re: /[\xC7-\xE7]/g, ch: "c"}, + {re: /[\xD1]/g, ch: "N"}, + {re: /[\xF1]/g, ch: "n"} + ]; + $.each(rExps, function () { + text = text.replace(this.re, this.ch); + }); + return text; + } + + + function htmlEscape(html) { + var escapeMap = { + '&': '&', + '<': '<', + '>': '>', + '"': '"', + "'": ''', + '`': '`' + }; + var source = '(?:' + Object.keys(escapeMap).join('|') + ')', + testRegexp = new RegExp(source), + replaceRegexp = new RegExp(source, 'g'), + string = html == null ? '' : '' + html; + return testRegexp.test(string) ? string.replace(replaceRegexp, function (match) { + return escapeMap[match]; + }) : string; + } + + var Selectpicker = function (element, options, e) { + if (e) { + e.stopPropagation(); + e.preventDefault(); + } + + this.$element = $(element); + this.$newElement = null; + this.$button = null; + this.$menu = null; + this.$lis = null; + this.options = options; + + // If we have no title yet, try to pull it from the html title attribute (jQuery doesnt' pick it up as it's not a + // data-attribute) + if (this.options.title === null) { + this.options.title = this.$element.attr('title'); + } + + //Expose public methods + this.val = Selectpicker.prototype.val; + this.render = Selectpicker.prototype.render; + this.refresh = Selectpicker.prototype.refresh; + this.setStyle = Selectpicker.prototype.setStyle; + this.selectAll = Selectpicker.prototype.selectAll; + this.deselectAll = Selectpicker.prototype.deselectAll; + this.destroy = Selectpicker.prototype.remove; + this.remove = Selectpicker.prototype.remove; + this.show = Selectpicker.prototype.show; + this.hide = Selectpicker.prototype.hide; + + this.init(); + }; + + Selectpicker.VERSION = '1.7.5'; + + // part of this is duplicated in i18n/defaults-en_US.js. Make sure to update both. + Selectpicker.DEFAULTS = { + noneSelectedText: 'Nothing selected', + noneResultsText: 'No results matched {0}', + countSelectedText: function (numSelected, numTotal) { + return (numSelected == 1) ? "{0} item selected" : "{0} items selected"; + }, + maxOptionsText: function (numAll, numGroup) { + return [ + (numAll == 1) ? 'Limit reached ({n} item max)' : 'Limit reached ({n} items max)', + (numGroup == 1) ? 'Group limit reached ({n} item max)' : 'Group limit reached ({n} items max)' + ]; + }, + selectAllText: 'Select All', + deselectAllText: 'Deselect All', + doneButton: false, + doneButtonText: 'Close', + multipleSeparator: ', ', + styleBase: 'btn', + style: 'btn-default', + size: 'auto', + title: null, + selectedTextFormat: 'values', + width: false, + container: false, + hideDisabled: false, + showSubtext: false, + showIcon: true, + showContent: true, + dropupAuto: true, + header: false, + liveSearch: false, + liveSearchPlaceholder: null, + liveSearchNormalize: false, + liveSearchStyle: 'contains', + actionsBox: false, + iconBase: 'glyphicon', + tickIcon: 'glyphicon-ok', + template: { + caret: '' + }, + maxOptions: false, + mobile: false, + selectOnTab: false, + dropdownAlignRight: false + }; + + Selectpicker.prototype = { + + constructor: Selectpicker, + + init: function () { + var that = this, + id = this.$element.attr('id'); + + this.$element.addClass('bs-select-hidden'); + // store originalIndex (key) and newIndex (value) in this.liObj for fast accessibility + // allows us to do this.$lis.eq(that.liObj[index]) instead of this.$lis.filter('[data-original-index="' + index + '"]') + this.liObj = {}; + this.multiple = this.$element.prop('multiple'); + this.autofocus = this.$element.prop('autofocus'); + this.$newElement = this.createView(); + this.$element.after(this.$newElement); + this.$button = this.$newElement.children('button'); + this.$menu = this.$newElement.children('.dropdown-menu'); + this.$menuInner = this.$menu.children('.inner'); + this.$searchbox = this.$menu.find('input'); + + if (this.options.dropdownAlignRight) + this.$menu.addClass('dropdown-menu-right'); + + if (typeof id !== 'undefined') { + this.$button.attr('data-id', id); + $('label[for="' + id + '"]').click(function (e) { + e.preventDefault(); + that.$button.focus(); + }); + } + + this.checkDisabled(); + this.clickListener(); + if (this.options.liveSearch) this.liveSearchListener(); + this.render(); + this.setStyle(); + this.setWidth(); + if (this.options.container) this.selectPosition(); + this.$menu.data('this', this); + this.$newElement.data('this', this); + if (this.options.mobile) this.mobile(); + + this.$newElement.on({ + 'hide.bs.dropdown': function (e) { + that.$element.trigger('hide.bs.select', e); + }, + 'hidden.bs.dropdown': function (e) { + that.$element.trigger('hidden.bs.select', e); + }, + 'show.bs.dropdown': function (e) { + that.$element.trigger('show.bs.select', e); + }, + 'shown.bs.dropdown': function (e) { + that.$element.trigger('shown.bs.select', e); + } + }); + + setTimeout(function () { + that.$element.trigger('loaded.bs.select'); + }); + }, + + createDropdown: function () { + // Options + // If we are multiple, then add the show-tick class by default + var multiple = this.multiple ? ' show-tick' : '', + inputGroup = this.$element.parent().hasClass('input-group') ? ' input-group-btn' : '', + autofocus = this.autofocus ? ' autofocus' : ''; + // Elements + var header = this.options.header ? '
          ' + this.options.header + '
          ' : ''; + var searchbox = this.options.liveSearch ? + '' + : ''; + var actionsbox = this.multiple && this.options.actionsBox ? + '
          ' + + '
          ' + + '' + + '' + + '
          ' + + '
          ' + : ''; + var donebutton = this.multiple && this.options.doneButton ? + '
          ' + + '
          ' + + '' + + '
          ' + + '
          ' + : ''; + var drop = + '
          ' + + '' + + '' + + '
          '; + + return $(drop); + }, + + createView: function () { + var $drop = this.createDropdown(), + li = this.createLi(); + + $drop.find('ul')[0].innerHTML = li; + return $drop; + }, + + reloadLi: function () { + //Remove all children. + this.destroyLi(); + //Re build + var li = this.createLi(); + this.$menuInner[0].innerHTML = li; + }, + + destroyLi: function () { + this.$menu.find('li').remove(); + }, + + createLi: function () { + var that = this, + _li = [], + optID = 0, + titleOption = document.createElement('option'), + liIndex = -1; // increment liIndex whenever a new
        • element is created to ensure liObj is correct + + // Helper functions + /** + * @param content + * @param [index] + * @param [classes] + * @param [optgroup] + * @returns {string} + */ + var generateLI = function (content, index, classes, optgroup) { + return '' + content + '
        • '; + }; + + /** + * @param text + * @param [classes] + * @param [inline] + * @param [tokens] + * @returns {string} + */ + var generateA = function (text, classes, inline, tokens) { + return '' + text + + '' + + ''; + }; + + if (this.options.title && !this.multiple) { + // this option doesn't create a new
        • element, but does add a new option, so liIndex is decreased + // since liObj is recalculated on every refresh, liIndex needs to be decreased even if the titleOption is already appended + liIndex--; + + if (!this.$element.find('.bs-title-option').length) { + // Use native JS to prepend option (faster) + var element = this.$element[0]; + titleOption.className = 'bs-title-option'; + titleOption.appendChild(document.createTextNode(this.options.title)); + titleOption.value = ''; + element.insertBefore(titleOption, element.firstChild); + // Check if selected attribute is already set on an option. If not, select the titleOption option. + if ($(element.options[element.selectedIndex]).attr('selected') === undefined) titleOption.selected = true; + } + } + + this.$element.find('option').each(function (index) { + var $this = $(this); + + liIndex++; + + if ($this.hasClass('bs-title-option')) return; + + // Get the class and text for the option + var optionClass = this.className || '', + inline = this.style.cssText, + text = $this.data('content') ? $this.data('content') : $this.html(), + tokens = $this.data('tokens') ? $this.data('tokens') : null, + subtext = typeof $this.data('subtext') !== 'undefined' ? '' + $this.data('subtext') + '' : '', + icon = typeof $this.data('icon') !== 'undefined' ? ' ' : '', + isDisabled = this.disabled || (this.parentNode.tagName === 'OPTGROUP' && this.parentNode.disabled); + + if (icon !== '' && isDisabled) { + icon = '' + icon + ''; + } + + if (that.options.hideDisabled && isDisabled) { + liIndex--; + return; + } + + if (!$this.data('content')) { + // Prepend any icon and append any subtext to the main text. + text = icon + '' + text + subtext + ''; + } + + if (this.parentNode.tagName === 'OPTGROUP' && $this.data('divider') !== true) { + var optGroupClass = ' ' + this.parentNode.className || ''; + + if ($this.index() === 0) { // Is it the first option of the optgroup? + optID += 1; + + // Get the opt group label + var label = this.parentNode.label, + labelSubtext = typeof $this.parent().data('subtext') !== 'undefined' ? '' + $this.parent().data('subtext') + '' : '', + labelIcon = $this.parent().data('icon') ? ' ' : ''; + + label = labelIcon + '' + label + labelSubtext + ''; + + if (index !== 0 && _li.length > 0) { // Is it NOT the first option of the select && are there elements in the dropdown? + liIndex++; + _li.push(generateLI('', null, 'divider', optID + 'div')); + } + liIndex++; + _li.push(generateLI(label, null, 'dropdown-header' + optGroupClass, optID)); + } + _li.push(generateLI(generateA(text, 'opt ' + optionClass + optGroupClass, inline, tokens), index, '', optID)); + } else if ($this.data('divider') === true) { + _li.push(generateLI('', index, 'divider')); + } else if ($this.data('hidden') === true) { + _li.push(generateLI(generateA(text, optionClass, inline, tokens), index, 'hidden is-hidden')); + } else { + if (this.previousElementSibling && this.previousElementSibling.tagName === 'OPTGROUP') { + liIndex++; + _li.push(generateLI('', null, 'divider', optID + 'div')); + } + _li.push(generateLI(generateA(text, optionClass, inline, tokens), index)); + } + + that.liObj[index] = liIndex; + }); + + //If we are not multiple, we don't have a selected item, and we don't have a title, select the first element so something is set in the button + if (!this.multiple && this.$element.find('option:selected').length === 0 && !this.options.title) { + this.$element.find('option').eq(0).prop('selected', true).attr('selected', 'selected'); + } + + return _li.join(''); + }, + + findLis: function () { + if (this.$lis == null) this.$lis = this.$menu.find('li'); + return this.$lis; + }, + + /** + * @param [updateLi] defaults to true + */ + render: function (updateLi) { + var that = this, + notDisabled; + + //Update the LI to match the SELECT + if (updateLi !== false) { + this.$element.find('option').each(function (index) { + var $lis = that.findLis().eq(that.liObj[index]); + + that.setDisabled(index, this.disabled || this.parentNode.tagName === 'OPTGROUP' && this.parentNode.disabled, $lis); + that.setSelected(index, this.selected, $lis); + }); + } + + this.tabIndex(); + + var selectedItems = this.$element.find('option').map(function () { + if (this.selected) { + if (that.options.hideDisabled && (this.disabled || this.parentNode.tagName === 'OPTGROUP' && this.parentNode.disabled)) return; + + var $this = $(this), + icon = $this.data('icon') && that.options.showIcon ? ' ' : '', + subtext; + + if (that.options.showSubtext && $this.data('subtext') && !that.multiple) { + subtext = ' ' + $this.data('subtext') + ''; + } else { + subtext = ''; + } + if (typeof $this.attr('title') !== 'undefined') { + return $this.attr('title'); + } else if ($this.data('content') && that.options.showContent) { + return $this.data('content'); + } else { + return icon + $this.html() + subtext; + } + } + }).toArray(); + + //Fixes issue in IE10 occurring when no default option is selected and at least one option is disabled + //Convert all the values into a comma delimited string + var title = !this.multiple ? selectedItems[0] : selectedItems.join(this.options.multipleSeparator); + + //If this is multi select, and the selectText type is count, the show 1 of 2 selected etc.. + if (this.multiple && this.options.selectedTextFormat.indexOf('count') > -1) { + var max = this.options.selectedTextFormat.split('>'); + if ((max.length > 1 && selectedItems.length > max[1]) || (max.length == 1 && selectedItems.length >= 2)) { + notDisabled = this.options.hideDisabled ? ', [disabled]' : ''; + var totalCount = this.$element.find('option').not('[data-divider="true"], [data-hidden="true"]' + notDisabled).length, + tr8nText = (typeof this.options.countSelectedText === 'function') ? this.options.countSelectedText(selectedItems.length, totalCount) : this.options.countSelectedText; + title = tr8nText.replace('{0}', selectedItems.length.toString()).replace('{1}', totalCount.toString()); + } + } + + if (this.options.title == undefined) { + this.options.title = this.$element.attr('title'); + } + + if (this.options.selectedTextFormat == 'static') { + title = this.options.title; + } + + //If we dont have a title, then use the default, or if nothing is set at all, use the not selected text + if (!title) { + title = typeof this.options.title !== 'undefined' ? this.options.title : this.options.noneSelectedText; + } + + //strip all html-tags and trim the result + this.$button.attr('title', $.trim(title.replace(/<[^>]*>?/g, ''))); + this.$button.children('.filter-option').html(title); + + this.$element.trigger('rendered.bs.select'); + }, + + /** + * @param [style] + * @param [status] + */ + setStyle: function (style, status) { + if (this.$element.attr('class')) { + this.$newElement.addClass(this.$element.attr('class').replace(/selectpicker|mobile-device|bs-select-hidden|validate\[.*\]/gi, '')); + } + + var buttonClass = style ? style : this.options.style; + + if (status == 'add') { + this.$button.addClass(buttonClass); + } else if (status == 'remove') { + this.$button.removeClass(buttonClass); + } else { + this.$button.removeClass(this.options.style); + this.$button.addClass(buttonClass); + } + }, + + liHeight: function (refresh) { + if (!refresh && (this.options.size === false || this.sizeInfo)) return; + + var newElement = document.createElement('div'), + menu = document.createElement('div'), + menuInner = document.createElement('ul'), + divider = document.createElement('li'), + li = document.createElement('li'), + a = document.createElement('a'), + text = document.createElement('span'), + header = this.options.header ? this.$menu.find('.popover-title')[0].cloneNode(true) : null, + search = this.options.liveSearch ? document.createElement('div') : null, + actions = this.options.actionsBox && this.multiple ? this.$menu.find('.bs-actionsbox')[0].cloneNode(true) : null, + doneButton = this.options.doneButton && this.multiple ? this.$menu.find('.bs-donebutton')[0].cloneNode(true) : null; + + text.className = 'text'; + newElement.className = this.$menu[0].parentNode.className + ' open'; + menu.className = 'dropdown-menu open'; + menuInner.className = 'dropdown-menu inner'; + divider.className = 'divider'; + + text.appendChild(document.createTextNode('Inner text')); + a.appendChild(text); + li.appendChild(a); + menuInner.appendChild(li); + menuInner.appendChild(divider); + if (header) menu.appendChild(header); + if (search) { + // create a span instead of input as creating an input element is slower + var input = document.createElement('span'); + search.className = 'bs-searchbox'; + input.className = 'form-control'; + search.appendChild(input); + menu.appendChild(search); + } + if (actions) menu.appendChild(actions); + menu.appendChild(menuInner); + if (doneButton) menu.appendChild(doneButton); + newElement.appendChild(menu); + + document.body.appendChild(newElement); + + var liHeight = a.offsetHeight, + headerHeight = header ? header.offsetHeight : 0, + searchHeight = search ? search.offsetHeight : 0, + actionsHeight = actions ? actions.offsetHeight : 0, + doneButtonHeight = doneButton ? doneButton.offsetHeight : 0, + dividerHeight = $(divider).outerHeight(true), + // fall back to jQuery if getComputedStyle is not supported + menuStyle = typeof getComputedStyle === 'function' ? getComputedStyle(menu) : false, + $menu = menuStyle ? null : $(menu), + menuPadding = parseInt(menuStyle ? menuStyle.paddingTop : $menu.css('paddingTop')) + + parseInt(menuStyle ? menuStyle.paddingBottom : $menu.css('paddingBottom')) + + parseInt(menuStyle ? menuStyle.borderTopWidth : $menu.css('borderTopWidth')) + + parseInt(menuStyle ? menuStyle.borderBottomWidth : $menu.css('borderBottomWidth')), + menuExtras = menuPadding + + parseInt(menuStyle ? menuStyle.marginTop : $menu.css('marginTop')) + + parseInt(menuStyle ? menuStyle.marginBottom : $menu.css('marginBottom')) + 2; + + document.body.removeChild(newElement); + + this.sizeInfo = { + liHeight: liHeight, + headerHeight: headerHeight, + searchHeight: searchHeight, + actionsHeight: actionsHeight, + doneButtonHeight: doneButtonHeight, + dividerHeight: dividerHeight, + menuPadding: menuPadding, + menuExtras: menuExtras + }; + }, + + setSize: function () { + this.findLis(); + this.liHeight(); + + if (this.options.header) this.$menu.css('padding-top', 0); + if (this.options.size === false) return; + + var that = this, + $menu = this.$menu, + $menuInner = this.$menuInner, + $window = $(window), + selectHeight = this.$newElement[0].offsetHeight, + liHeight = this.sizeInfo['liHeight'], + headerHeight = this.sizeInfo['headerHeight'], + searchHeight = this.sizeInfo['searchHeight'], + actionsHeight = this.sizeInfo['actionsHeight'], + doneButtonHeight = this.sizeInfo['doneButtonHeight'], + divHeight = this.sizeInfo['dividerHeight'], + menuPadding = this.sizeInfo['menuPadding'], + menuExtras = this.sizeInfo['menuExtras'], + notDisabled = this.options.hideDisabled ? '.disabled' : '', + menuHeight, + getHeight, + selectOffsetTop, + selectOffsetBot, + posVert = function () { + selectOffsetTop = that.$newElement.offset().top - $window.scrollTop(); + selectOffsetBot = $window.height() - selectOffsetTop - selectHeight; + }; + + posVert(); + + if (this.options.size === 'auto') { + var getSize = function () { + var minHeight, + hasClass = function (className, include) { + return function (element) { + if (include) { + return (element.classList ? element.classList.contains(className) : $(element).hasClass(className)); + } else { + return !(element.classList ? element.classList.contains(className) : $(element).hasClass(className)); + } + }; + }, + lis = that.$menuInner[0].getElementsByTagName('li'), + lisVisible = Array.prototype.filter ? Array.prototype.filter.call(lis, hasClass('hidden', false)) : that.$lis.not('.hidden'), + optGroup = Array.prototype.filter ? Array.prototype.filter.call(lisVisible, hasClass('dropdown-header', true)) : lisVisible.filter('.dropdown-header'); + + posVert(); + menuHeight = selectOffsetBot - menuExtras; + + if (that.options.container) { + if (!$menu.data('height')) $menu.data('height', $menu.height()); + getHeight = $menu.data('height'); + } else { + getHeight = $menu.height(); + } + + if (that.options.dropupAuto) { + that.$newElement.toggleClass('dropup', selectOffsetTop > selectOffsetBot && (menuHeight - menuExtras) < getHeight); + } + if (that.$newElement.hasClass('dropup')) { + menuHeight = selectOffsetTop - menuExtras; + } + + if ((lisVisible.length + optGroup.length) > 3) { + minHeight = liHeight * 3 + menuExtras - 2; + } else { + minHeight = 0; + } + + $menu.css({ + 'max-height': menuHeight + 'px', + 'overflow': 'hidden', + 'min-height': minHeight + headerHeight + searchHeight + actionsHeight + doneButtonHeight + 'px' + }); + $menuInner.css({ + 'max-height': menuHeight - headerHeight - searchHeight - actionsHeight - doneButtonHeight - menuPadding + 'px', + 'overflow-y': 'auto', + 'min-height': Math.max(minHeight - menuPadding, 0) + 'px' + }); + }; + getSize(); + this.$searchbox.off('input.getSize propertychange.getSize').on('input.getSize propertychange.getSize', getSize); + $window.off('resize.getSize scroll.getSize').on('resize.getSize scroll.getSize', getSize); + } else if (this.options.size && this.options.size != 'auto' && this.$lis.not(notDisabled).length > this.options.size) { + var optIndex = this.$lis.not('.divider').not(notDisabled).children().slice(0, this.options.size).last().parent().index(), + divLength = this.$lis.slice(0, optIndex + 1).filter('.divider').length; + menuHeight = liHeight * this.options.size + divLength * divHeight + menuPadding; + + if (that.options.container) { + if (!$menu.data('height')) $menu.data('height', $menu.height()); + getHeight = $menu.data('height'); + } else { + getHeight = $menu.height(); + } + + if (that.options.dropupAuto) { + //noinspection JSUnusedAssignment + this.$newElement.toggleClass('dropup', selectOffsetTop > selectOffsetBot && (menuHeight - menuExtras) < getHeight); + } + $menu.css({ + 'max-height': menuHeight + headerHeight + searchHeight + actionsHeight + doneButtonHeight + 'px', + 'overflow': 'hidden', + 'min-height': '' + }); + $menuInner.css({ + 'max-height': menuHeight - menuPadding + 'px', + 'overflow-y': 'auto', + 'min-height': '' + }); + } + }, + + setWidth: function () { + if (this.options.width === 'auto') { + this.$menu.css('min-width', '0'); + + // Get correct width if element is hidden + var $selectClone = this.$menu.parent().clone().appendTo('body'), + $selectClone2 = this.options.container ? this.$newElement.clone().appendTo('body') : $selectClone, + ulWidth = $selectClone.children('.dropdown-menu').outerWidth(), + btnWidth = $selectClone2.css('width', 'auto').children('button').outerWidth(); + + $selectClone.remove(); + $selectClone2.remove(); + + // Set width to whatever's larger, button title or longest option + this.$newElement.css('width', Math.max(ulWidth, btnWidth) + 'px'); + } else if (this.options.width === 'fit') { + // Remove inline min-width so width can be changed from 'auto' + this.$menu.css('min-width', ''); + this.$newElement.css('width', '').addClass('fit-width'); + } else if (this.options.width) { + // Remove inline min-width so width can be changed from 'auto' + this.$menu.css('min-width', ''); + this.$newElement.css('width', this.options.width); + } else { + // Remove inline min-width/width so width can be changed + this.$menu.css('min-width', ''); + this.$newElement.css('width', ''); + } + // Remove fit-width class if width is changed programmatically + if (this.$newElement.hasClass('fit-width') && this.options.width !== 'fit') { + this.$newElement.removeClass('fit-width'); + } + }, + + selectPosition: function () { + var that = this, + $drop = $('
          '), + pos, + actualHeight, + getPlacement = function ($element) { + $drop.addClass($element.attr('class').replace(/form-control|fit-width/gi, '')).toggleClass('dropup', $element.hasClass('dropup')); + pos = $element.offset(); + actualHeight = $element.hasClass('dropup') ? 0 : $element[0].offsetHeight; + $drop.css({ + 'top': pos.top + actualHeight, + 'left': pos.left, + 'width': $element[0].offsetWidth + }); + }; + + this.$newElement.on('click', function () { + if (that.isDisabled()) { + return; + } + getPlacement($(this)); + $drop.appendTo(that.options.container); + $drop.toggleClass('open', !$(this).hasClass('open')); + $drop.append(that.$menu); + }); + + $(window).on('resize scroll', function () { + getPlacement(that.$newElement); + }); + + this.$element.on('hide.bs.select', function () { + that.$menu.data('height', that.$menu.height()); + $drop.detach(); + }); + }, + + setSelected: function (index, selected, $lis) { + if (!$lis) { + $lis = this.findLis().eq(this.liObj[index]); + } + + $lis.toggleClass('selected', selected); + }, + + setDisabled: function (index, disabled, $lis) { + if (!$lis) { + $lis = this.findLis().eq(this.liObj[index]); + } + + if (disabled) { + $lis.addClass('disabled').children('a').attr('href', '#').attr('tabindex', -1); + } else { + $lis.removeClass('disabled').children('a').removeAttr('href').attr('tabindex', 0); + } + }, + + isDisabled: function () { + return this.$element[0].disabled; + }, + + checkDisabled: function () { + var that = this; + + if (this.isDisabled()) { + this.$newElement.addClass('disabled'); + this.$button.addClass('disabled').attr('tabindex', -1); + } else { + if (this.$button.hasClass('disabled')) { + this.$newElement.removeClass('disabled'); + this.$button.removeClass('disabled'); + } + + if (this.$button.attr('tabindex') == -1 && !this.$element.data('tabindex')) { + this.$button.removeAttr('tabindex'); + } + } + + this.$button.click(function () { + return !that.isDisabled(); + }); + }, + + tabIndex: function () { + if (this.$element.is('[tabindex]')) { + this.$element.data('tabindex', this.$element.attr('tabindex')); + this.$button.attr('tabindex', this.$element.data('tabindex')); + } + }, + + clickListener: function () { + var that = this, + $document = $(document); + + this.$newElement.on('touchstart.dropdown', '.dropdown-menu', function (e) { + e.stopPropagation(); + }); + + $document.data('spaceSelect', false); + + this.$button.on('keyup', function (e) { + if (/(32)/.test(e.keyCode.toString(10)) && $document.data('spaceSelect')) { + e.preventDefault(); + $document.data('spaceSelect', false); + } + }); + + this.$newElement.on('click', function () { + that.setSize(); + that.$element.on('shown.bs.select', function () { + if (!that.options.liveSearch && !that.multiple) { + that.$menuInner.find('.selected a').focus(); + } else if (!that.multiple) { + var selectedIndex = that.liObj[that.$element[0].selectedIndex]; + + if (typeof selectedIndex !== 'number' || that.options.size === false) return; + + // scroll to selected option + var offset = that.$lis.eq(selectedIndex)[0].offsetTop - that.$menuInner[0].offsetTop; + offset = offset - that.$menuInner[0].offsetHeight/2 + that.sizeInfo.liHeight/2; + that.$menuInner[0].scrollTop = offset; + } + }); + }); + + this.$menuInner.on('click', 'li a', function (e) { + var $this = $(this), + clickedIndex = $this.parent().data('originalIndex'), + prevValue = that.$element.val(), + prevIndex = that.$element.prop('selectedIndex'); + + // Don't close on multi choice menu + if (that.multiple) { + e.stopPropagation(); + } + + e.preventDefault(); + + //Don't run if we have been disabled + if (!that.isDisabled() && !$this.parent().hasClass('disabled')) { + var $options = that.$element.find('option'), + $option = $options.eq(clickedIndex), + state = $option.prop('selected'), + $optgroup = $option.parent('optgroup'), + maxOptions = that.options.maxOptions, + maxOptionsGrp = $optgroup.data('maxOptions') || false; + + if (!that.multiple) { // Deselect all others if not multi select box + $options.prop('selected', false); + $option.prop('selected', true); + that.$menuInner.find('.selected').removeClass('selected'); + that.setSelected(clickedIndex, true); + } else { // Toggle the one we have chosen if we are multi select. + $option.prop('selected', !state); + that.setSelected(clickedIndex, !state); + $this.blur(); + + if (maxOptions !== false || maxOptionsGrp !== false) { + var maxReached = maxOptions < $options.filter(':selected').length, + maxReachedGrp = maxOptionsGrp < $optgroup.find('option:selected').length; + + if ((maxOptions && maxReached) || (maxOptionsGrp && maxReachedGrp)) { + if (maxOptions && maxOptions == 1) { + $options.prop('selected', false); + $option.prop('selected', true); + that.$menuInner.find('.selected').removeClass('selected'); + that.setSelected(clickedIndex, true); + } else if (maxOptionsGrp && maxOptionsGrp == 1) { + $optgroup.find('option:selected').prop('selected', false); + $option.prop('selected', true); + var optgroupID = $this.parent().data('optgroup'); + that.$menuInner.find('[data-optgroup="' + optgroupID + '"]').removeClass('selected'); + that.setSelected(clickedIndex, true); + } else { + var maxOptionsArr = (typeof that.options.maxOptionsText === 'function') ? + that.options.maxOptionsText(maxOptions, maxOptionsGrp) : that.options.maxOptionsText, + maxTxt = maxOptionsArr[0].replace('{n}', maxOptions), + maxTxtGrp = maxOptionsArr[1].replace('{n}', maxOptionsGrp), + $notify = $('
          '); + // If {var} is set in array, replace it + /** @deprecated */ + if (maxOptionsArr[2]) { + maxTxt = maxTxt.replace('{var}', maxOptionsArr[2][maxOptions > 1 ? 0 : 1]); + maxTxtGrp = maxTxtGrp.replace('{var}', maxOptionsArr[2][maxOptionsGrp > 1 ? 0 : 1]); + } + + $option.prop('selected', false); + + that.$menu.append($notify); + + if (maxOptions && maxReached) { + $notify.append($('
          ' + maxTxt + '
          ')); + that.$element.trigger('maxReached.bs.select'); + } + + if (maxOptionsGrp && maxReachedGrp) { + $notify.append($('
          ' + maxTxtGrp + '
          ')); + that.$element.trigger('maxReachedGrp.bs.select'); + } + + setTimeout(function () { + that.setSelected(clickedIndex, false); + }, 10); + + $notify.delay(750).fadeOut(300, function () { + $(this).remove(); + }); + } + } + } + } + + if (!that.multiple) { + that.$button.focus(); + } else if (that.options.liveSearch) { + that.$searchbox.focus(); + } + + // Trigger select 'change' + if ((prevValue != that.$element.val() && that.multiple) || (prevIndex != that.$element.prop('selectedIndex') && !that.multiple)) { + that.$element.triggerNative('change'); + // $option.prop('selected') is current option state (selected/unselected). state is previous option state. + that.$element.trigger('changed.bs.select', [clickedIndex, $option.prop('selected'), state]); + } + } + }); + + this.$menu.on('click', 'li.disabled a, .popover-title, .popover-title :not(.close)', function (e) { + if (e.currentTarget == this) { + e.preventDefault(); + e.stopPropagation(); + if (that.options.liveSearch && !$(e.target).hasClass('close')) { + that.$searchbox.focus(); + } else { + that.$button.focus(); + } + } + }); + + this.$menuInner.on('click', '.divider, .dropdown-header', function (e) { + e.preventDefault(); + e.stopPropagation(); + if (that.options.liveSearch) { + that.$searchbox.focus(); + } else { + that.$button.focus(); + } + }); + + this.$menu.on('click', '.popover-title .close', function () { + that.$button.click(); + }); + + this.$searchbox.on('click', function (e) { + e.stopPropagation(); + }); + + this.$menu.on('click', '.actions-btn', function (e) { + if (that.options.liveSearch) { + that.$searchbox.focus(); + } else { + that.$button.focus(); + } + + e.preventDefault(); + e.stopPropagation(); + + if ($(this).hasClass('bs-select-all')) { + that.selectAll(); + } else { + that.deselectAll(); + } + that.$element.triggerNative('change'); + }); + + this.$element.change(function () { + that.render(false); + }); + }, + + liveSearchListener: function () { + var that = this, + $no_results = $('
        • '); + + this.$newElement.on('click.dropdown.data-api touchstart.dropdown.data-api', function () { + that.$menuInner.find('.active').removeClass('active'); + if (!!that.$searchbox.val()) { + that.$searchbox.val(''); + that.$lis.not('.is-hidden').removeClass('hidden'); + if (!!$no_results.parent().length) $no_results.remove(); + } + if (!that.multiple) that.$menuInner.find('.selected').addClass('active'); + setTimeout(function () { + that.$searchbox.focus(); + }, 10); + }); + + this.$searchbox.on('click.dropdown.data-api focus.dropdown.data-api touchend.dropdown.data-api', function (e) { + e.stopPropagation(); + }); + + this.$searchbox.on('input propertychange', function () { + if (that.$searchbox.val()) { + var $searchBase = that.$lis.not('.is-hidden').removeClass('hidden').children('a'); + if (that.options.liveSearchNormalize) { + $searchBase = $searchBase.not(':a' + that._searchStyle() + '("' + normalizeToBase(that.$searchbox.val()) + '")'); + } else { + $searchBase = $searchBase.not(':' + that._searchStyle() + '("' + that.$searchbox.val() + '")'); + } + $searchBase.parent().addClass('hidden'); + + that.$lis.filter('.dropdown-header').each(function () { + var $this = $(this), + optgroup = $this.data('optgroup'); + + if (that.$lis.filter('[data-optgroup=' + optgroup + ']').not($this).not('.hidden').length === 0) { + $this.addClass('hidden'); + that.$lis.filter('[data-optgroup=' + optgroup + 'div]').addClass('hidden'); + } + }); + + var $lisVisible = that.$lis.not('.hidden'); + + // hide divider if first or last visible, or if followed by another divider + $lisVisible.each(function (index) { + var $this = $(this); + + if ($this.hasClass('divider') && ( + $this.index() === $lisVisible.first().index() || + $this.index() === $lisVisible.last().index() || + $lisVisible.eq(index + 1).hasClass('divider'))) { + $this.addClass('hidden'); + } + }); + + if (!that.$lis.not('.hidden, .no-results').length) { + if (!!$no_results.parent().length) { + $no_results.remove(); + } + $no_results.html(that.options.noneResultsText.replace('{0}', '"' + htmlEscape(that.$searchbox.val()) + '"')).show(); + that.$menuInner.append($no_results); + } else if (!!$no_results.parent().length) { + $no_results.remove(); + } + } else { + that.$lis.not('.is-hidden').removeClass('hidden'); + if (!!$no_results.parent().length) { + $no_results.remove(); + } + } + + that.$lis.filter('.active').removeClass('active'); + if (that.$searchbox.val()) that.$lis.not('.hidden, .divider, .dropdown-header').eq(0).addClass('active').children('a').focus(); + $(this).focus(); + }); + }, + + _searchStyle: function () { + var styles = { + begins: 'ibegins', + startsWith: 'ibegins' + }; + + return styles[this.options.liveSearchStyle] || 'icontains'; + }, + + val: function (value) { + if (typeof value !== 'undefined') { + this.$element.val(value); + this.render(); + + return this.$element; + } else { + return this.$element.val(); + } + }, + + changeAll: function (status) { + if (typeof status === 'undefined') status = true; + + this.findLis(); + + var $options = this.$element.find('option'), + $lisVisible = this.$lis.not('.divider, .dropdown-header, .disabled, .hidden').toggleClass('selected', status), + lisVisLen = $lisVisible.length, + selectedOptions = []; + + for (var i = 0; i < lisVisLen; i++) { + var origIndex = $lisVisible[i].getAttribute('data-original-index'); + selectedOptions[selectedOptions.length] = $options.eq(origIndex)[0]; + } + + $(selectedOptions).prop('selected', status); + + this.render(false); + }, + + selectAll: function () { + return this.changeAll(true); + }, + + deselectAll: function () { + return this.changeAll(false); + }, + + keydown: function (e) { + var $this = $(this), + $parent = $this.is('input') ? $this.parent().parent() : $this.parent(), + $items, + that = $parent.data('this'), + index, + next, + first, + last, + prev, + nextPrev, + prevIndex, + isActive, + selector = ':not(.disabled, .hidden, .dropdown-header, .divider)', + keyCodeMap = { + 32: ' ', + 48: '0', + 49: '1', + 50: '2', + 51: '3', + 52: '4', + 53: '5', + 54: '6', + 55: '7', + 56: '8', + 57: '9', + 59: ';', + 65: 'a', + 66: 'b', + 67: 'c', + 68: 'd', + 69: 'e', + 70: 'f', + 71: 'g', + 72: 'h', + 73: 'i', + 74: 'j', + 75: 'k', + 76: 'l', + 77: 'm', + 78: 'n', + 79: 'o', + 80: 'p', + 81: 'q', + 82: 'r', + 83: 's', + 84: 't', + 85: 'u', + 86: 'v', + 87: 'w', + 88: 'x', + 89: 'y', + 90: 'z', + 96: '0', + 97: '1', + 98: '2', + 99: '3', + 100: '4', + 101: '5', + 102: '6', + 103: '7', + 104: '8', + 105: '9' + }; + + if (that.options.liveSearch) $parent = $this.parent().parent(); + + if (that.options.container) $parent = that.$menu; + + $items = $('[role=menu] li', $parent); + + isActive = that.$menu.parent().hasClass('open'); + + if (!isActive && (e.keyCode >= 48 && e.keyCode <= 57 || e.keyCode >= 96 && e.keyCode <= 105 || e.keyCode >= 65 && e.keyCode <= 90)) { + if (!that.options.container) { + that.setSize(); + that.$menu.parent().addClass('open'); + isActive = true; + } else { + that.$newElement.trigger('click'); + } + that.$searchbox.focus(); + } + + if (that.options.liveSearch) { + if (/(^9$|27)/.test(e.keyCode.toString(10)) && isActive && that.$menu.find('.active').length === 0) { + e.preventDefault(); + that.$menu.parent().removeClass('open'); + if (that.options.container) that.$newElement.removeClass('open'); + that.$button.focus(); + } + // $items contains li elements when liveSearch is enabled + $items = $('[role=menu] li' + selector, $parent); + if (!$this.val() && !/(38|40)/.test(e.keyCode.toString(10))) { + if ($items.filter('.active').length === 0) { + $items = that.$menuInner.find('li'); + if (that.options.liveSearchNormalize) { + $items = $items.filter(':a' + that._searchStyle() + '(' + normalizeToBase(keyCodeMap[e.keyCode]) + ')'); + } else { + $items = $items.filter(':' + that._searchStyle() + '(' + keyCodeMap[e.keyCode] + ')'); + } + } + } + } + + if (!$items.length) return; + + if (/(38|40)/.test(e.keyCode.toString(10))) { + index = $items.index($items.find('a').filter(':focus').parent()); + first = $items.filter(selector).first().index(); + last = $items.filter(selector).last().index(); + next = $items.eq(index).nextAll(selector).eq(0).index(); + prev = $items.eq(index).prevAll(selector).eq(0).index(); + nextPrev = $items.eq(next).prevAll(selector).eq(0).index(); + + if (that.options.liveSearch) { + $items.each(function (i) { + if (!$(this).hasClass('disabled')) { + $(this).data('index', i); + } + }); + index = $items.index($items.filter('.active')); + first = $items.first().data('index'); + last = $items.last().data('index'); + next = $items.eq(index).nextAll().eq(0).data('index'); + prev = $items.eq(index).prevAll().eq(0).data('index'); + nextPrev = $items.eq(next).prevAll().eq(0).data('index'); + } + + prevIndex = $this.data('prevIndex'); + + if (e.keyCode == 38) { + if (that.options.liveSearch) index--; + if (index != nextPrev && index > prev) index = prev; + if (index < first) index = first; + if (index == prevIndex) index = last; + } else if (e.keyCode == 40) { + if (that.options.liveSearch) index++; + if (index == -1) index = 0; + if (index != nextPrev && index < next) index = next; + if (index > last) index = last; + if (index == prevIndex) index = first; + } + + $this.data('prevIndex', index); + + if (!that.options.liveSearch) { + $items.eq(index).children('a').focus(); + } else { + e.preventDefault(); + if (!$this.hasClass('dropdown-toggle')) { + $items.removeClass('active').eq(index).addClass('active').children('a').focus(); + $this.focus(); + } + } + + } else if (!$this.is('input')) { + var keyIndex = [], + count, + prevKey; + + $items.each(function () { + if (!$(this).hasClass('disabled')) { + if ($.trim($(this).children('a').text().toLowerCase()).substring(0, 1) == keyCodeMap[e.keyCode]) { + keyIndex.push($(this).index()); + } + } + }); + + count = $(document).data('keycount'); + count++; + $(document).data('keycount', count); + + prevKey = $.trim($(':focus').text().toLowerCase()).substring(0, 1); + + if (prevKey != keyCodeMap[e.keyCode]) { + count = 1; + $(document).data('keycount', count); + } else if (count >= keyIndex.length) { + $(document).data('keycount', 0); + if (count > keyIndex.length) count = 1; + } + + $items.eq(keyIndex[count - 1]).children('a').focus(); + } + + // Select focused option if "Enter", "Spacebar" or "Tab" (when selectOnTab is true) are pressed inside the menu. + if ((/(13|32)/.test(e.keyCode.toString(10)) || (/(^9$)/.test(e.keyCode.toString(10)) && that.options.selectOnTab)) && isActive) { + if (!/(32)/.test(e.keyCode.toString(10))) e.preventDefault(); + if (!that.options.liveSearch) { + var elem = $(':focus'); + elem.click(); + // Bring back focus for multiselects + elem.focus(); + // Prevent screen from scrolling if the user hit the spacebar + e.preventDefault(); + // Fixes spacebar selection of dropdown items in FF & IE + $(document).data('spaceSelect', true); + } else if (!/(32)/.test(e.keyCode.toString(10))) { + that.$menuInner.find('.active a').click(); + $this.focus(); + } + $(document).data('keycount', 0); + } + + if ((/(^9$|27)/.test(e.keyCode.toString(10)) && isActive && (that.multiple || that.options.liveSearch)) || (/(27)/.test(e.keyCode.toString(10)) && !isActive)) { + that.$menu.parent().removeClass('open'); + if (that.options.container) that.$newElement.removeClass('open'); + that.$button.focus(); + } + }, + + mobile: function () { + this.$element.addClass('mobile-device').appendTo(this.$newElement); + if (this.options.container) this.$menu.hide(); + }, + + refresh: function () { + this.$lis = null; + this.liObj = {}; + this.reloadLi(); + this.render(); + this.checkDisabled(); + this.liHeight(true); + this.setStyle(); + this.setWidth(); + if (this.$lis) this.$searchbox.trigger('propertychange'); + + this.$element.trigger('refreshed.bs.select'); + }, + + hide: function () { + this.$newElement.hide(); + }, + + show: function () { + this.$newElement.show(); + }, + + remove: function () { + this.$newElement.remove(); + this.$element.remove(); + } + }; + + // SELECTPICKER PLUGIN DEFINITION + // ============================== + function Plugin(option, event) { + // get the args of the outer function.. + var args = arguments; + // The arguments of the function are explicitly re-defined from the argument list, because the shift causes them + // to get lost/corrupted in android 2.3 and IE9 #715 #775 + var _option = option, + _event = event; + [].shift.apply(args); + + var value; + var chain = this.each(function () { + var $this = $(this); + if ($this.is('select')) { + var data = $this.data('selectpicker'), + options = typeof _option == 'object' && _option; + + if (!data) { + var config = $.extend({}, Selectpicker.DEFAULTS, $.fn.selectpicker.defaults || {}, $this.data(), options); + config.template = $.extend({}, Selectpicker.DEFAULTS.template, ($.fn.selectpicker.defaults ? $.fn.selectpicker.defaults.template : {}), $this.data().template, options.template); + $this.data('selectpicker', (data = new Selectpicker(this, config, _event))); + } else if (options) { + for (var i in options) { + if (options.hasOwnProperty(i)) { + data.options[i] = options[i]; + } + } + } + + if (typeof _option == 'string') { + if (data[_option] instanceof Function) { + value = data[_option].apply(data, args); + } else { + value = data.options[_option]; + } + } + } + }); + + if (typeof value !== 'undefined') { + //noinspection JSUnusedAssignment + return value; + } else { + return chain; + } + } + + var old = $.fn.selectpicker; + $.fn.selectpicker = Plugin; + $.fn.selectpicker.Constructor = Selectpicker; + + // SELECTPICKER NO CONFLICT + // ======================== + $.fn.selectpicker.noConflict = function () { + $.fn.selectpicker = old; + return this; + }; + + $(document) + .data('keycount', 0) + .on('keydown', '.bootstrap-select [data-toggle=dropdown], .bootstrap-select [role="menu"], .bs-searchbox input', Selectpicker.prototype.keydown) + .on('focusin.modal', '.bootstrap-select [data-toggle=dropdown], .bootstrap-select [role="menu"], .bs-searchbox input', function (e) { + e.stopPropagation(); + }); + + // SELECTPICKER DATA-API + // ===================== + $(window).on('load.bs.select.data-api', function () { + $('.selectpicker').each(function () { + var $selectpicker = $(this); + Plugin.call($selectpicker, $selectpicker.data()); + }) + }); +})(jQuery); + + +})); diff --git a/public/bower_components/bootstrap-select/bootstrap-select.less b/public/bower_components/bootstrap-select/bootstrap-select.less new file mode 100644 index 0000000..dd0b1e6 --- /dev/null +++ b/public/bower_components/bootstrap-select/bootstrap-select.less @@ -0,0 +1,343 @@ +@import "variables"; + +// Mixins +.cursor-disabled() { + cursor: not-allowed; +} + +// Rules +.bootstrap-select { + width: 220px \0; /*IE9 and below*/ + + // The selectpicker button + > .dropdown-toggle { + width: 100%; + padding-right: 25px; + } + + // Error display + .has-error & .dropdown-toggle, + .error & .dropdown-toggle { + border-color: @color-red-error; + } + + &.fit-width { + width: auto !important; + } + + &:not([class*="col-"]):not([class*="form-control"]):not(.input-group-btn) { + width: @width-default; + } + + .dropdown-toggle:focus { + outline: thin dotted #333333 !important; + outline: 5px auto -webkit-focus-ring-color !important; + outline-offset: -2px; + } +} + +.bootstrap-select.form-control { + margin-bottom: 0; + padding: 0; + border: none; + + &:not([class*="col-"]) { + width: 100%; + } + + &.input-group-btn { + z-index: auto; + } +} + +// The selectpicker components +.bootstrap-select.btn-group { + &:not(.input-group-btn), + &[class*="col-"] { + float: none; + display: inline-block; + margin-left: 0; + } + + // Forces the pull to the right, if necessary + &, + &[class*="col-"], + .row &[class*="col-"] { + &.dropdown-menu-right { + float: right; + } + } + + .form-inline &, + .form-horizontal &, + .form-group & { + margin-bottom: 0; + } + + .form-group-lg &.form-control, + .form-group-sm &.form-control { + padding: 0; + } + + // Set the width of the live search (and any other form control within an inline form) + // see https://github.com/silviomoreto/bootstrap-select/issues/685 + .form-inline & .form-control { + width: 100%; + } + + &.disabled, + > .disabled { + .cursor-disabled(); + + &:focus { + outline: none !important; + } + } + + &.bs-container { + position: absolute; + + .dropdown-menu { + z-index: @zindex-select-dropdown; + } + } + + // The selectpicker button + .dropdown-toggle { + .filter-option { + display: inline-block; + overflow: hidden; + width: 100%; + text-align: left; + } + + .caret { + position: absolute; + top: 50%; + right: 12px; + margin-top: -2px; + vertical-align: middle; + } + } + + &[class*="col-"] .dropdown-toggle { + width: 100%; + } + + // The selectpicker dropdown + .dropdown-menu { + min-width: 100%; + box-sizing: border-box; + + &.inner { + position: static; + float: none; + border: 0; + padding: 0; + margin: 0; + border-radius: 0; + box-shadow: none; + } + + li { + position: relative; + + &.active small { + color: #fff; + } + + &.disabled a { + .cursor-disabled(); + } + + a { + cursor: pointer; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + + &.opt { + position: relative; + padding-left: 2.25em; + } + + span.check-mark { + display: none; + } + + span.text { + display: inline-block; + } + } + + small { + padding-left: 0.5em; + } + } + + .notify { + position: absolute; + bottom: 5px; + width: 96%; + margin: 0 2%; + min-height: 26px; + padding: 3px 5px; + background: rgb(245, 245, 245); + border: 1px solid rgb(227, 227, 227); + box-shadow: inset 0 1px 1px fade(rgb(0, 0, 0), 5%); + pointer-events: none; + opacity: 0.9; + box-sizing: border-box; + } + } + + .no-results { + padding: 3px; + background: #f5f5f5; + margin: 0 5px; + white-space: nowrap; + } + + &.fit-width .dropdown-toggle { + .filter-option { + position: static; + } + + .caret { + position: static; + top: auto; + margin-top: -1px; + } + } + + &.show-tick .dropdown-menu li { + &.selected a span.check-mark { + position: absolute; + display: inline-block; + right: 15px; + margin-top: 5px; + } + + a span.text { + margin-right: 34px; + } + } +} + +.bootstrap-select.show-menu-arrow { + &.open > .dropdown-toggle { + z-index: (@zindex-select-dropdown + 1); + } + + .dropdown-toggle { + &:before { + content: ''; + border-left: 7px solid transparent; + border-right: 7px solid transparent; + border-bottom: 7px solid @color-grey-arrow; + position: absolute; + bottom: -4px; + left: 9px; + display: none; + } + + &:after { + content: ''; + border-left: 6px solid transparent; + border-right: 6px solid transparent; + border-bottom: 6px solid white; + position: absolute; + bottom: -4px; + left: 10px; + display: none; + } + } + + &.dropup .dropdown-toggle { + &:before { + bottom: auto; + top: -3px; + border-top: 7px solid @color-grey-arrow; + border-bottom: 0; + } + + &:after { + bottom: auto; + top: -3px; + border-top: 6px solid white; + border-bottom: 0; + } + } + + &.pull-right .dropdown-toggle { + &:before { + right: 12px; + left: auto; + } + + &:after { + right: 13px; + left: auto; + } + } + + &.open > .dropdown-toggle { + &:before, + &:after { + display: block; + } + } +} + +.bs-searchbox, +.bs-actionsbox, +.bs-donebutton { + padding: 4px 8px; +} + +.bs-actionsbox { + width: 100%; + box-sizing: border-box; + + & .btn-group button { + width: 50%; + } +} + +.bs-donebutton { + float: left; + width: 100%; + box-sizing: border-box; + + & .btn-group button { + width: 100%; + } +} + +.bs-searchbox { + & + .bs-actionsbox { + padding: 0 8px 4px; + } + + & .form-control { + margin-bottom: 0; + width: 100%; + float: none; + } +} + +select.bs-select-hidden, +select.selectpicker { + display: none !important; +} + +select.mobile-device { + position: absolute !important; + top: 0; + left: 0; + display: block !important; + width: 100%; + height: 100% !important; + opacity: 0; +} diff --git a/public/bower_components/bootstrap-switch/bootstrap-switch.css b/public/bower_components/bootstrap-switch/bootstrap-switch.css new file mode 100644 index 0000000..cea4acb --- /dev/null +++ b/public/bower_components/bootstrap-switch/bootstrap-switch.css @@ -0,0 +1,196 @@ +/* ======================================================================== + * bootstrap-switch - v3.3.2 + * http://www.bootstrap-switch.org + * ======================================================================== + * Copyright 2012-2013 Mattia Larentis + * + * ======================================================================== + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ======================================================================== + */ + +.bootstrap-switch { + display: inline-block; + direction: ltr; + cursor: pointer; + border-radius: 4px; + border: 1px solid; + border-color: #cccccc; + position: relative; + text-align: left; + overflow: hidden; + line-height: 8px; + z-index: 0; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + vertical-align: middle; + -webkit-transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s; + transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s; +} +.bootstrap-switch .bootstrap-switch-container { + display: inline-block; + top: 0; + border-radius: 4px; + -webkit-transform: translate3d(0, 0, 0); + transform: translate3d(0, 0, 0); +} +.bootstrap-switch .bootstrap-switch-handle-on, +.bootstrap-switch .bootstrap-switch-handle-off, +.bootstrap-switch .bootstrap-switch-label { + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; + cursor: pointer; + display: inline-block !important; + height: 100%; + padding: 6px 12px; + font-size: 14px; + line-height: 20px; +} +.bootstrap-switch .bootstrap-switch-handle-on, +.bootstrap-switch .bootstrap-switch-handle-off { + text-align: center; + z-index: 1; +} +.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-primary, +.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-primary { + color: #fff; + background: #428bca; +} +.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-info, +.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-info { + color: #fff; + background: #5bc0de; +} +.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-success, +.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-success { + color: #fff; + background: #5cb85c; +} +.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-warning, +.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-warning { + background: #f0ad4e; + color: #fff; +} +.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-danger, +.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-danger { + color: #fff; + background: #d9534f; +} +.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-default, +.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-default { + color: #000; + background: #eeeeee; +} +.bootstrap-switch .bootstrap-switch-label { + text-align: center; + margin-top: -1px; + margin-bottom: -1px; + z-index: 100; + color: #333333; + background: #ffffff; +} +.bootstrap-switch .bootstrap-switch-handle-on { + border-bottom-left-radius: 3px; + border-top-left-radius: 3px; +} +.bootstrap-switch .bootstrap-switch-handle-off { + border-bottom-right-radius: 3px; + border-top-right-radius: 3px; +} +.bootstrap-switch input[type='radio'], +.bootstrap-switch input[type='checkbox'] { + position: absolute !important; + top: 0; + left: 0; + opacity: 0; + filter: alpha(opacity=0); + z-index: -1; +} +.bootstrap-switch input[type='radio'].form-control, +.bootstrap-switch input[type='checkbox'].form-control { + height: auto; +} +.bootstrap-switch.bootstrap-switch-mini .bootstrap-switch-handle-on, +.bootstrap-switch.bootstrap-switch-mini .bootstrap-switch-handle-off, +.bootstrap-switch.bootstrap-switch-mini .bootstrap-switch-label { + padding: 1px 5px; + font-size: 12px; + line-height: 1.5; +} +.bootstrap-switch.bootstrap-switch-small .bootstrap-switch-handle-on, +.bootstrap-switch.bootstrap-switch-small .bootstrap-switch-handle-off, +.bootstrap-switch.bootstrap-switch-small .bootstrap-switch-label { + padding: 5px 10px; + font-size: 12px; + line-height: 1.5; +} +.bootstrap-switch.bootstrap-switch-large .bootstrap-switch-handle-on, +.bootstrap-switch.bootstrap-switch-large .bootstrap-switch-handle-off, +.bootstrap-switch.bootstrap-switch-large .bootstrap-switch-label { + padding: 6px 16px; + font-size: 18px; + line-height: 1.33; +} +.bootstrap-switch.bootstrap-switch-disabled, +.bootstrap-switch.bootstrap-switch-readonly, +.bootstrap-switch.bootstrap-switch-indeterminate { + cursor: default !important; +} +.bootstrap-switch.bootstrap-switch-disabled .bootstrap-switch-handle-on, +.bootstrap-switch.bootstrap-switch-readonly .bootstrap-switch-handle-on, +.bootstrap-switch.bootstrap-switch-indeterminate .bootstrap-switch-handle-on, +.bootstrap-switch.bootstrap-switch-disabled .bootstrap-switch-handle-off, +.bootstrap-switch.bootstrap-switch-readonly .bootstrap-switch-handle-off, +.bootstrap-switch.bootstrap-switch-indeterminate .bootstrap-switch-handle-off, +.bootstrap-switch.bootstrap-switch-disabled .bootstrap-switch-label, +.bootstrap-switch.bootstrap-switch-readonly .bootstrap-switch-label, +.bootstrap-switch.bootstrap-switch-indeterminate .bootstrap-switch-label { + opacity: 0.5; + filter: alpha(opacity=50); + cursor: default !important; +} +.bootstrap-switch.bootstrap-switch-animate .bootstrap-switch-container { + -webkit-transition: margin-left 0.5s; + transition: margin-left 0.5s; +} +.bootstrap-switch.bootstrap-switch-inverse .bootstrap-switch-handle-on { + border-bottom-left-radius: 0; + border-top-left-radius: 0; + border-bottom-right-radius: 3px; + border-top-right-radius: 3px; +} +.bootstrap-switch.bootstrap-switch-inverse .bootstrap-switch-handle-off { + border-bottom-right-radius: 0; + border-top-right-radius: 0; + border-bottom-left-radius: 3px; + border-top-left-radius: 3px; +} +.bootstrap-switch.bootstrap-switch-focused { + border-color: #66afe9; + outline: 0; + -webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(102, 175, 233, 0.6); + box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(102, 175, 233, 0.6); +} +.bootstrap-switch.bootstrap-switch-on .bootstrap-switch-label, +.bootstrap-switch.bootstrap-switch-inverse.bootstrap-switch-off .bootstrap-switch-label { + border-bottom-right-radius: 3px; + border-top-right-radius: 3px; +} +.bootstrap-switch.bootstrap-switch-off .bootstrap-switch-label, +.bootstrap-switch.bootstrap-switch-inverse.bootstrap-switch-on .bootstrap-switch-label { + border-bottom-left-radius: 3px; + border-top-left-radius: 3px; +} diff --git a/public/bower_components/bootstrap-switch/bootstrap-switch.js b/public/bower_components/bootstrap-switch/bootstrap-switch.js new file mode 100644 index 0000000..4967048 --- /dev/null +++ b/public/bower_components/bootstrap-switch/bootstrap-switch.js @@ -0,0 +1,710 @@ +/* ======================================================================== + * bootstrap-switch - v3.3.2 + * http://www.bootstrap-switch.org + * ======================================================================== + * Copyright 2012-2013 Mattia Larentis + * + * ======================================================================== + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ======================================================================== + */ + +(function() { + var __slice = [].slice; + + (function($, window) { + "use strict"; + var BootstrapSwitch; + BootstrapSwitch = (function() { + function BootstrapSwitch(element, options) { + if (options == null) { + options = {}; + } + this.$element = $(element); + this.options = $.extend({}, $.fn.bootstrapSwitch.defaults, { + state: this.$element.is(":checked"), + size: this.$element.data("size"), + animate: this.$element.data("animate"), + disabled: this.$element.is(":disabled"), + readonly: this.$element.is("[readonly]"), + indeterminate: this.$element.data("indeterminate"), + inverse: this.$element.data("inverse"), + radioAllOff: this.$element.data("radio-all-off"), + onColor: this.$element.data("on-color"), + offColor: this.$element.data("off-color"), + onText: this.$element.data("on-text"), + offText: this.$element.data("off-text"), + labelText: this.$element.data("label-text"), + handleWidth: this.$element.data("handle-width"), + labelWidth: this.$element.data("label-width"), + baseClass: this.$element.data("base-class"), + wrapperClass: this.$element.data("wrapper-class") + }, options); + this.$wrapper = $("
          ", { + "class": (function(_this) { + return function() { + var classes; + classes = ["" + _this.options.baseClass].concat(_this._getClasses(_this.options.wrapperClass)); + classes.push(_this.options.state ? "" + _this.options.baseClass + "-on" : "" + _this.options.baseClass + "-off"); + if (_this.options.size != null) { + classes.push("" + _this.options.baseClass + "-" + _this.options.size); + } + if (_this.options.disabled) { + classes.push("" + _this.options.baseClass + "-disabled"); + } + if (_this.options.readonly) { + classes.push("" + _this.options.baseClass + "-readonly"); + } + if (_this.options.indeterminate) { + classes.push("" + _this.options.baseClass + "-indeterminate"); + } + if (_this.options.inverse) { + classes.push("" + _this.options.baseClass + "-inverse"); + } + if (_this.$element.attr("id")) { + classes.push("" + _this.options.baseClass + "-id-" + (_this.$element.attr("id"))); + } + return classes.join(" "); + }; + })(this)() + }); + this.$container = $("
          ", { + "class": "" + this.options.baseClass + "-container" + }); + this.$on = $("", { + html: this.options.onText, + "class": "" + this.options.baseClass + "-handle-on " + this.options.baseClass + "-" + this.options.onColor + }); + this.$off = $("", { + html: this.options.offText, + "class": "" + this.options.baseClass + "-handle-off " + this.options.baseClass + "-" + this.options.offColor + }); + this.$label = $("", { + html: this.options.labelText, + "class": "" + this.options.baseClass + "-label" + }); + this.$element.on("init.bootstrapSwitch", (function(_this) { + return function() { + return _this.options.onInit.apply(element, arguments); + }; + })(this)); + this.$element.on("switchChange.bootstrapSwitch", (function(_this) { + return function() { + return _this.options.onSwitchChange.apply(element, arguments); + }; + })(this)); + this.$container = this.$element.wrap(this.$container).parent(); + this.$wrapper = this.$container.wrap(this.$wrapper).parent(); + this.$element.before(this.options.inverse ? this.$off : this.$on).before(this.$label).before(this.options.inverse ? this.$on : this.$off); + if (this.options.indeterminate) { + this.$element.prop("indeterminate", true); + } + this._init(); + this._elementHandlers(); + this._handleHandlers(); + this._labelHandlers(); + this._formHandler(); + this._externalLabelHandler(); + this.$element.trigger("init.bootstrapSwitch"); + } + + BootstrapSwitch.prototype._constructor = BootstrapSwitch; + + BootstrapSwitch.prototype.state = function(value, skip) { + if (typeof value === "undefined") { + return this.options.state; + } + if (this.options.disabled || this.options.readonly) { + return this.$element; + } + if (this.options.state && !this.options.radioAllOff && this.$element.is(":radio")) { + return this.$element; + } + if (this.options.indeterminate) { + this.indeterminate(false); + } + value = !!value; + this.$element.prop("checked", value).trigger("change.bootstrapSwitch", skip); + return this.$element; + }; + + BootstrapSwitch.prototype.toggleState = function(skip) { + if (this.options.disabled || this.options.readonly) { + return this.$element; + } + if (this.options.indeterminate) { + this.indeterminate(false); + return this.state(true); + } else { + return this.$element.prop("checked", !this.options.state).trigger("change.bootstrapSwitch", skip); + } + }; + + BootstrapSwitch.prototype.size = function(value) { + if (typeof value === "undefined") { + return this.options.size; + } + if (this.options.size != null) { + this.$wrapper.removeClass("" + this.options.baseClass + "-" + this.options.size); + } + if (value) { + this.$wrapper.addClass("" + this.options.baseClass + "-" + value); + } + this._width(); + this._containerPosition(); + this.options.size = value; + return this.$element; + }; + + BootstrapSwitch.prototype.animate = function(value) { + if (typeof value === "undefined") { + return this.options.animate; + } + value = !!value; + if (value === this.options.animate) { + return this.$element; + } + return this.toggleAnimate(); + }; + + BootstrapSwitch.prototype.toggleAnimate = function() { + this.options.animate = !this.options.animate; + this.$wrapper.toggleClass("" + this.options.baseClass + "-animate"); + return this.$element; + }; + + BootstrapSwitch.prototype.disabled = function(value) { + if (typeof value === "undefined") { + return this.options.disabled; + } + value = !!value; + if (value === this.options.disabled) { + return this.$element; + } + return this.toggleDisabled(); + }; + + BootstrapSwitch.prototype.toggleDisabled = function() { + this.options.disabled = !this.options.disabled; + this.$element.prop("disabled", this.options.disabled); + this.$wrapper.toggleClass("" + this.options.baseClass + "-disabled"); + return this.$element; + }; + + BootstrapSwitch.prototype.readonly = function(value) { + if (typeof value === "undefined") { + return this.options.readonly; + } + value = !!value; + if (value === this.options.readonly) { + return this.$element; + } + return this.toggleReadonly(); + }; + + BootstrapSwitch.prototype.toggleReadonly = function() { + this.options.readonly = !this.options.readonly; + this.$element.prop("readonly", this.options.readonly); + this.$wrapper.toggleClass("" + this.options.baseClass + "-readonly"); + return this.$element; + }; + + BootstrapSwitch.prototype.indeterminate = function(value) { + if (typeof value === "undefined") { + return this.options.indeterminate; + } + value = !!value; + if (value === this.options.indeterminate) { + return this.$element; + } + return this.toggleIndeterminate(); + }; + + BootstrapSwitch.prototype.toggleIndeterminate = function() { + this.options.indeterminate = !this.options.indeterminate; + this.$element.prop("indeterminate", this.options.indeterminate); + this.$wrapper.toggleClass("" + this.options.baseClass + "-indeterminate"); + this._containerPosition(); + return this.$element; + }; + + BootstrapSwitch.prototype.inverse = function(value) { + if (typeof value === "undefined") { + return this.options.inverse; + } + value = !!value; + if (value === this.options.inverse) { + return this.$element; + } + return this.toggleInverse(); + }; + + BootstrapSwitch.prototype.toggleInverse = function() { + var $off, $on; + this.$wrapper.toggleClass("" + this.options.baseClass + "-inverse"); + $on = this.$on.clone(true); + $off = this.$off.clone(true); + this.$on.replaceWith($off); + this.$off.replaceWith($on); + this.$on = $off; + this.$off = $on; + this.options.inverse = !this.options.inverse; + return this.$element; + }; + + BootstrapSwitch.prototype.onColor = function(value) { + var color; + color = this.options.onColor; + if (typeof value === "undefined") { + return color; + } + if (color != null) { + this.$on.removeClass("" + this.options.baseClass + "-" + color); + } + this.$on.addClass("" + this.options.baseClass + "-" + value); + this.options.onColor = value; + return this.$element; + }; + + BootstrapSwitch.prototype.offColor = function(value) { + var color; + color = this.options.offColor; + if (typeof value === "undefined") { + return color; + } + if (color != null) { + this.$off.removeClass("" + this.options.baseClass + "-" + color); + } + this.$off.addClass("" + this.options.baseClass + "-" + value); + this.options.offColor = value; + return this.$element; + }; + + BootstrapSwitch.prototype.onText = function(value) { + if (typeof value === "undefined") { + return this.options.onText; + } + this.$on.html(value); + this._width(); + this._containerPosition(); + this.options.onText = value; + return this.$element; + }; + + BootstrapSwitch.prototype.offText = function(value) { + if (typeof value === "undefined") { + return this.options.offText; + } + this.$off.html(value); + this._width(); + this._containerPosition(); + this.options.offText = value; + return this.$element; + }; + + BootstrapSwitch.prototype.labelText = function(value) { + if (typeof value === "undefined") { + return this.options.labelText; + } + this.$label.html(value); + this._width(); + this.options.labelText = value; + return this.$element; + }; + + BootstrapSwitch.prototype.handleWidth = function(value) { + if (typeof value === "undefined") { + return this.options.handleWidth; + } + this.options.handleWidth = value; + this._width(); + this._containerPosition(); + return this.$element; + }; + + BootstrapSwitch.prototype.labelWidth = function(value) { + if (typeof value === "undefined") { + return this.options.labelWidth; + } + this.options.labelWidth = value; + this._width(); + this._containerPosition(); + return this.$element; + }; + + BootstrapSwitch.prototype.baseClass = function(value) { + return this.options.baseClass; + }; + + BootstrapSwitch.prototype.wrapperClass = function(value) { + if (typeof value === "undefined") { + return this.options.wrapperClass; + } + if (!value) { + value = $.fn.bootstrapSwitch.defaults.wrapperClass; + } + this.$wrapper.removeClass(this._getClasses(this.options.wrapperClass).join(" ")); + this.$wrapper.addClass(this._getClasses(value).join(" ")); + this.options.wrapperClass = value; + return this.$element; + }; + + BootstrapSwitch.prototype.radioAllOff = function(value) { + if (typeof value === "undefined") { + return this.options.radioAllOff; + } + value = !!value; + if (value === this.options.radioAllOff) { + return this.$element; + } + this.options.radioAllOff = value; + return this.$element; + }; + + BootstrapSwitch.prototype.onInit = function(value) { + if (typeof value === "undefined") { + return this.options.onInit; + } + if (!value) { + value = $.fn.bootstrapSwitch.defaults.onInit; + } + this.options.onInit = value; + return this.$element; + }; + + BootstrapSwitch.prototype.onSwitchChange = function(value) { + if (typeof value === "undefined") { + return this.options.onSwitchChange; + } + if (!value) { + value = $.fn.bootstrapSwitch.defaults.onSwitchChange; + } + this.options.onSwitchChange = value; + return this.$element; + }; + + BootstrapSwitch.prototype.destroy = function() { + var $form; + $form = this.$element.closest("form"); + if ($form.length) { + $form.off("reset.bootstrapSwitch").removeData("bootstrap-switch"); + } + this.$container.children().not(this.$element).remove(); + this.$element.unwrap().unwrap().off(".bootstrapSwitch").removeData("bootstrap-switch"); + return this.$element; + }; + + BootstrapSwitch.prototype._width = function() { + var $handles, handleWidth; + $handles = this.$on.add(this.$off); + $handles.add(this.$label).css("width", ""); + handleWidth = this.options.handleWidth === "auto" ? Math.max(this.$on.width(), this.$off.width()) : this.options.handleWidth; + $handles.width(handleWidth); + this.$label.width((function(_this) { + return function(index, width) { + if (_this.options.labelWidth !== "auto") { + return _this.options.labelWidth; + } + if (width < handleWidth) { + return handleWidth; + } else { + return width; + } + }; + })(this)); + this._handleWidth = this.$on.outerWidth(); + this._labelWidth = this.$label.outerWidth(); + this.$container.width((this._handleWidth * 2) + this._labelWidth); + return this.$wrapper.width(this._handleWidth + this._labelWidth); + }; + + BootstrapSwitch.prototype._containerPosition = function(state, callback) { + if (state == null) { + state = this.options.state; + } + this.$container.css("margin-left", (function(_this) { + return function() { + var values; + values = [0, "-" + _this._handleWidth + "px"]; + if (_this.options.indeterminate) { + return "-" + (_this._handleWidth / 2) + "px"; + } + if (state) { + if (_this.options.inverse) { + return values[1]; + } else { + return values[0]; + } + } else { + if (_this.options.inverse) { + return values[0]; + } else { + return values[1]; + } + } + }; + })(this)); + if (!callback) { + return; + } + return setTimeout(function() { + return callback(); + }, 50); + }; + + BootstrapSwitch.prototype._init = function() { + var init, initInterval; + init = (function(_this) { + return function() { + _this._width(); + return _this._containerPosition(null, function() { + if (_this.options.animate) { + return _this.$wrapper.addClass("" + _this.options.baseClass + "-animate"); + } + }); + }; + })(this); + if (this.$wrapper.is(":visible")) { + return init(); + } + return initInterval = window.setInterval((function(_this) { + return function() { + if (_this.$wrapper.is(":visible")) { + init(); + return window.clearInterval(initInterval); + } + }; + })(this), 50); + }; + + BootstrapSwitch.prototype._elementHandlers = function() { + return this.$element.on({ + "change.bootstrapSwitch": (function(_this) { + return function(e, skip) { + var state; + e.preventDefault(); + e.stopImmediatePropagation(); + state = _this.$element.is(":checked"); + _this._containerPosition(state); + if (state === _this.options.state) { + return; + } + _this.options.state = state; + _this.$wrapper.toggleClass("" + _this.options.baseClass + "-off").toggleClass("" + _this.options.baseClass + "-on"); + if (!skip) { + if (_this.$element.is(":radio")) { + $("[name='" + (_this.$element.attr('name')) + "']").not(_this.$element).prop("checked", false).trigger("change.bootstrapSwitch", true); + } + return _this.$element.trigger("switchChange.bootstrapSwitch", [state]); + } + }; + })(this), + "focus.bootstrapSwitch": (function(_this) { + return function(e) { + e.preventDefault(); + return _this.$wrapper.addClass("" + _this.options.baseClass + "-focused"); + }; + })(this), + "blur.bootstrapSwitch": (function(_this) { + return function(e) { + e.preventDefault(); + return _this.$wrapper.removeClass("" + _this.options.baseClass + "-focused"); + }; + })(this), + "keydown.bootstrapSwitch": (function(_this) { + return function(e) { + if (!e.which || _this.options.disabled || _this.options.readonly) { + return; + } + switch (e.which) { + case 37: + e.preventDefault(); + e.stopImmediatePropagation(); + return _this.state(false); + case 39: + e.preventDefault(); + e.stopImmediatePropagation(); + return _this.state(true); + } + }; + })(this) + }); + }; + + BootstrapSwitch.prototype._handleHandlers = function() { + this.$on.on("click.bootstrapSwitch", (function(_this) { + return function(event) { + event.preventDefault(); + event.stopPropagation(); + _this.state(false); + return _this.$element.trigger("focus.bootstrapSwitch"); + }; + })(this)); + return this.$off.on("click.bootstrapSwitch", (function(_this) { + return function(event) { + event.preventDefault(); + event.stopPropagation(); + _this.state(true); + return _this.$element.trigger("focus.bootstrapSwitch"); + }; + })(this)); + }; + + BootstrapSwitch.prototype._labelHandlers = function() { + return this.$label.on({ + "mousedown.bootstrapSwitch touchstart.bootstrapSwitch": (function(_this) { + return function(e) { + if (_this._dragStart || _this.options.disabled || _this.options.readonly) { + return; + } + e.preventDefault(); + e.stopPropagation(); + _this._dragStart = (e.pageX || e.originalEvent.touches[0].pageX) - parseInt(_this.$container.css("margin-left"), 10); + if (_this.options.animate) { + _this.$wrapper.removeClass("" + _this.options.baseClass + "-animate"); + } + return _this.$element.trigger("focus.bootstrapSwitch"); + }; + })(this), + "mousemove.bootstrapSwitch touchmove.bootstrapSwitch": (function(_this) { + return function(e) { + var difference; + if (_this._dragStart == null) { + return; + } + e.preventDefault(); + difference = (e.pageX || e.originalEvent.touches[0].pageX) - _this._dragStart; + if (difference < -_this._handleWidth || difference > 0) { + return; + } + _this._dragEnd = difference; + return _this.$container.css("margin-left", "" + _this._dragEnd + "px"); + }; + })(this), + "mouseup.bootstrapSwitch touchend.bootstrapSwitch": (function(_this) { + return function(e) { + var state; + if (!_this._dragStart) { + return; + } + e.preventDefault(); + if (_this.options.animate) { + _this.$wrapper.addClass("" + _this.options.baseClass + "-animate"); + } + if (_this._dragEnd) { + state = _this._dragEnd > -(_this._handleWidth / 2); + _this._dragEnd = false; + _this.state(_this.options.inverse ? !state : state); + } else { + _this.state(!_this.options.state); + } + return _this._dragStart = false; + }; + })(this), + "mouseleave.bootstrapSwitch": (function(_this) { + return function(e) { + return _this.$label.trigger("mouseup.bootstrapSwitch"); + }; + })(this) + }); + }; + + BootstrapSwitch.prototype._externalLabelHandler = function() { + var $externalLabel; + $externalLabel = this.$element.closest("label"); + return $externalLabel.on("click", (function(_this) { + return function(event) { + event.preventDefault(); + event.stopImmediatePropagation(); + if (event.target === $externalLabel[0]) { + return _this.toggleState(); + } + }; + })(this)); + }; + + BootstrapSwitch.prototype._formHandler = function() { + var $form; + $form = this.$element.closest("form"); + if ($form.data("bootstrap-switch")) { + return; + } + return $form.on("reset.bootstrapSwitch", function() { + return window.setTimeout(function() { + return $form.find("input").filter(function() { + return $(this).data("bootstrap-switch"); + }).each(function() { + return $(this).bootstrapSwitch("state", this.checked); + }); + }, 1); + }).data("bootstrap-switch", true); + }; + + BootstrapSwitch.prototype._getClasses = function(classes) { + var c, cls, _i, _len; + if (!$.isArray(classes)) { + return ["" + this.options.baseClass + "-" + classes]; + } + cls = []; + for (_i = 0, _len = classes.length; _i < _len; _i++) { + c = classes[_i]; + cls.push("" + this.options.baseClass + "-" + c); + } + return cls; + }; + + return BootstrapSwitch; + + })(); + $.fn.bootstrapSwitch = function() { + var args, option, ret; + option = arguments[0], args = 2 <= arguments.length ? __slice.call(arguments, 1) : []; + ret = this; + this.each(function() { + var $this, data; + $this = $(this); + data = $this.data("bootstrap-switch"); + if (!data) { + $this.data("bootstrap-switch", data = new BootstrapSwitch(this, option)); + } + if (typeof option === "string") { + return ret = data[option].apply(data, args); + } + }); + return ret; + }; + $.fn.bootstrapSwitch.Constructor = BootstrapSwitch; + return $.fn.bootstrapSwitch.defaults = { + state: true, + size: null, + animate: true, + disabled: false, + readonly: false, + indeterminate: false, + inverse: false, + radioAllOff: false, + onColor: "primary", + offColor: "default", + onText: "ON", + offText: "OFF", + labelText: " ", + handleWidth: "auto", + labelWidth: "auto", + baseClass: "bootstrap-switch", + wrapperClass: "wrapper", + onInit: function() {}, + onSwitchChange: function() {} + }; + })(window.jQuery, window); + +}).call(this); diff --git a/public/bower_components/bootstrap/bootstrap.js b/public/bower_components/bootstrap/bootstrap.js new file mode 100644 index 0000000..5debfd7 --- /dev/null +++ b/public/bower_components/bootstrap/bootstrap.js @@ -0,0 +1,2363 @@ +/*! + * Bootstrap v3.3.5 (http://getbootstrap.com) + * Copyright 2011-2015 Twitter, Inc. + * Licensed under the MIT license + */ + +if (typeof jQuery === 'undefined') { + throw new Error('Bootstrap\'s JavaScript requires jQuery') +} + ++function ($) { + 'use strict'; + var version = $.fn.jquery.split(' ')[0].split('.') + if ((version[0] < 2 && version[1] < 9) || (version[0] == 1 && version[1] == 9 && version[2] < 1)) { + throw new Error('Bootstrap\'s JavaScript requires jQuery version 1.9.1 or higher') + } +}(jQuery); + +/* ======================================================================== + * Bootstrap: transition.js v3.3.5 + * http://getbootstrap.com/javascript/#transitions + * ======================================================================== + * Copyright 2011-2015 Twitter, Inc. + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) + * ======================================================================== */ + + ++function ($) { + 'use strict'; + + // CSS TRANSITION SUPPORT (Shoutout: http://www.modernizr.com/) + // ============================================================ + + function transitionEnd() { + var el = document.createElement('bootstrap') + + var transEndEventNames = { + WebkitTransition : 'webkitTransitionEnd', + MozTransition : 'transitionend', + OTransition : 'oTransitionEnd otransitionend', + transition : 'transitionend' + } + + for (var name in transEndEventNames) { + if (el.style[name] !== undefined) { + return { end: transEndEventNames[name] } + } + } + + return false // explicit for ie8 ( ._.) + } + + // http://blog.alexmaccaw.com/css-transitions + $.fn.emulateTransitionEnd = function (duration) { + var called = false + var $el = this + $(this).one('bsTransitionEnd', function () { called = true }) + var callback = function () { if (!called) $($el).trigger($.support.transition.end) } + setTimeout(callback, duration) + return this + } + + $(function () { + $.support.transition = transitionEnd() + + if (!$.support.transition) return + + $.event.special.bsTransitionEnd = { + bindType: $.support.transition.end, + delegateType: $.support.transition.end, + handle: function (e) { + if ($(e.target).is(this)) return e.handleObj.handler.apply(this, arguments) + } + } + }) + +}(jQuery); + +/* ======================================================================== + * Bootstrap: alert.js v3.3.5 + * http://getbootstrap.com/javascript/#alerts + * ======================================================================== + * Copyright 2011-2015 Twitter, Inc. + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) + * ======================================================================== */ + + ++function ($) { + 'use strict'; + + // ALERT CLASS DEFINITION + // ====================== + + var dismiss = '[data-dismiss="alert"]' + var Alert = function (el) { + $(el).on('click', dismiss, this.close) + } + + Alert.VERSION = '3.3.5' + + Alert.TRANSITION_DURATION = 150 + + Alert.prototype.close = function (e) { + var $this = $(this) + var selector = $this.attr('data-target') + + if (!selector) { + selector = $this.attr('href') + selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7 + } + + var $parent = $(selector) + + if (e) e.preventDefault() + + if (!$parent.length) { + $parent = $this.closest('.alert') + } + + $parent.trigger(e = $.Event('close.bs.alert')) + + if (e.isDefaultPrevented()) return + + $parent.removeClass('in') + + function removeElement() { + // detach from parent, fire event then clean up data + $parent.detach().trigger('closed.bs.alert').remove() + } + + $.support.transition && $parent.hasClass('fade') ? + $parent + .one('bsTransitionEnd', removeElement) + .emulateTransitionEnd(Alert.TRANSITION_DURATION) : + removeElement() + } + + + // ALERT PLUGIN DEFINITION + // ======================= + + function Plugin(option) { + return this.each(function () { + var $this = $(this) + var data = $this.data('bs.alert') + + if (!data) $this.data('bs.alert', (data = new Alert(this))) + if (typeof option == 'string') data[option].call($this) + }) + } + + var old = $.fn.alert + + $.fn.alert = Plugin + $.fn.alert.Constructor = Alert + + + // ALERT NO CONFLICT + // ================= + + $.fn.alert.noConflict = function () { + $.fn.alert = old + return this + } + + + // ALERT DATA-API + // ============== + + $(document).on('click.bs.alert.data-api', dismiss, Alert.prototype.close) + +}(jQuery); + +/* ======================================================================== + * Bootstrap: button.js v3.3.5 + * http://getbootstrap.com/javascript/#buttons + * ======================================================================== + * Copyright 2011-2015 Twitter, Inc. + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) + * ======================================================================== */ + + ++function ($) { + 'use strict'; + + // BUTTON PUBLIC CLASS DEFINITION + // ============================== + + var Button = function (element, options) { + this.$element = $(element) + this.options = $.extend({}, Button.DEFAULTS, options) + this.isLoading = false + } + + Button.VERSION = '3.3.5' + + Button.DEFAULTS = { + loadingText: 'loading...' + } + + Button.prototype.setState = function (state) { + var d = 'disabled' + var $el = this.$element + var val = $el.is('input') ? 'val' : 'html' + var data = $el.data() + + state += 'Text' + + if (data.resetText == null) $el.data('resetText', $el[val]()) + + // push to event loop to allow forms to submit + setTimeout($.proxy(function () { + $el[val](data[state] == null ? this.options[state] : data[state]) + + if (state == 'loadingText') { + this.isLoading = true + $el.addClass(d).attr(d, d) + } else if (this.isLoading) { + this.isLoading = false + $el.removeClass(d).removeAttr(d) + } + }, this), 0) + } + + Button.prototype.toggle = function () { + var changed = true + var $parent = this.$element.closest('[data-toggle="buttons"]') + + if ($parent.length) { + var $input = this.$element.find('input') + if ($input.prop('type') == 'radio') { + if ($input.prop('checked')) changed = false + $parent.find('.active').removeClass('active') + this.$element.addClass('active') + } else if ($input.prop('type') == 'checkbox') { + if (($input.prop('checked')) !== this.$element.hasClass('active')) changed = false + this.$element.toggleClass('active') + } + $input.prop('checked', this.$element.hasClass('active')) + if (changed) $input.trigger('change') + } else { + this.$element.attr('aria-pressed', !this.$element.hasClass('active')) + this.$element.toggleClass('active') + } + } + + + // BUTTON PLUGIN DEFINITION + // ======================== + + function Plugin(option) { + return this.each(function () { + var $this = $(this) + var data = $this.data('bs.button') + var options = typeof option == 'object' && option + + if (!data) $this.data('bs.button', (data = new Button(this, options))) + + if (option == 'toggle') data.toggle() + else if (option) data.setState(option) + }) + } + + var old = $.fn.button + + $.fn.button = Plugin + $.fn.button.Constructor = Button + + + // BUTTON NO CONFLICT + // ================== + + $.fn.button.noConflict = function () { + $.fn.button = old + return this + } + + + // BUTTON DATA-API + // =============== + + $(document) + .on('click.bs.button.data-api', '[data-toggle^="button"]', function (e) { + var $btn = $(e.target) + if (!$btn.hasClass('btn')) $btn = $btn.closest('.btn') + Plugin.call($btn, 'toggle') + if (!($(e.target).is('input[type="radio"]') || $(e.target).is('input[type="checkbox"]'))) e.preventDefault() + }) + .on('focus.bs.button.data-api blur.bs.button.data-api', '[data-toggle^="button"]', function (e) { + $(e.target).closest('.btn').toggleClass('focus', /^focus(in)?$/.test(e.type)) + }) + +}(jQuery); + +/* ======================================================================== + * Bootstrap: carousel.js v3.3.5 + * http://getbootstrap.com/javascript/#carousel + * ======================================================================== + * Copyright 2011-2015 Twitter, Inc. + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) + * ======================================================================== */ + + ++function ($) { + 'use strict'; + + // CAROUSEL CLASS DEFINITION + // ========================= + + var Carousel = function (element, options) { + this.$element = $(element) + this.$indicators = this.$element.find('.carousel-indicators') + this.options = options + this.paused = null + this.sliding = null + this.interval = null + this.$active = null + this.$items = null + + this.options.keyboard && this.$element.on('keydown.bs.carousel', $.proxy(this.keydown, this)) + + this.options.pause == 'hover' && !('ontouchstart' in document.documentElement) && this.$element + .on('mouseenter.bs.carousel', $.proxy(this.pause, this)) + .on('mouseleave.bs.carousel', $.proxy(this.cycle, this)) + } + + Carousel.VERSION = '3.3.5' + + Carousel.TRANSITION_DURATION = 600 + + Carousel.DEFAULTS = { + interval: 5000, + pause: 'hover', + wrap: true, + keyboard: true + } + + Carousel.prototype.keydown = function (e) { + if (/input|textarea/i.test(e.target.tagName)) return + switch (e.which) { + case 37: this.prev(); break + case 39: this.next(); break + default: return + } + + e.preventDefault() + } + + Carousel.prototype.cycle = function (e) { + e || (this.paused = false) + + this.interval && clearInterval(this.interval) + + this.options.interval + && !this.paused + && (this.interval = setInterval($.proxy(this.next, this), this.options.interval)) + + return this + } + + Carousel.prototype.getItemIndex = function (item) { + this.$items = item.parent().children('.item') + return this.$items.index(item || this.$active) + } + + Carousel.prototype.getItemForDirection = function (direction, active) { + var activeIndex = this.getItemIndex(active) + var willWrap = (direction == 'prev' && activeIndex === 0) + || (direction == 'next' && activeIndex == (this.$items.length - 1)) + if (willWrap && !this.options.wrap) return active + var delta = direction == 'prev' ? -1 : 1 + var itemIndex = (activeIndex + delta) % this.$items.length + return this.$items.eq(itemIndex) + } + + Carousel.prototype.to = function (pos) { + var that = this + var activeIndex = this.getItemIndex(this.$active = this.$element.find('.item.active')) + + if (pos > (this.$items.length - 1) || pos < 0) return + + if (this.sliding) return this.$element.one('slid.bs.carousel', function () { that.to(pos) }) // yes, "slid" + if (activeIndex == pos) return this.pause().cycle() + + return this.slide(pos > activeIndex ? 'next' : 'prev', this.$items.eq(pos)) + } + + Carousel.prototype.pause = function (e) { + e || (this.paused = true) + + if (this.$element.find('.next, .prev').length && $.support.transition) { + this.$element.trigger($.support.transition.end) + this.cycle(true) + } + + this.interval = clearInterval(this.interval) + + return this + } + + Carousel.prototype.next = function () { + if (this.sliding) return + return this.slide('next') + } + + Carousel.prototype.prev = function () { + if (this.sliding) return + return this.slide('prev') + } + + Carousel.prototype.slide = function (type, next) { + var $active = this.$element.find('.item.active') + var $next = next || this.getItemForDirection(type, $active) + var isCycling = this.interval + var direction = type == 'next' ? 'left' : 'right' + var that = this + + if ($next.hasClass('active')) return (this.sliding = false) + + var relatedTarget = $next[0] + var slideEvent = $.Event('slide.bs.carousel', { + relatedTarget: relatedTarget, + direction: direction + }) + this.$element.trigger(slideEvent) + if (slideEvent.isDefaultPrevented()) return + + this.sliding = true + + isCycling && this.pause() + + if (this.$indicators.length) { + this.$indicators.find('.active').removeClass('active') + var $nextIndicator = $(this.$indicators.children()[this.getItemIndex($next)]) + $nextIndicator && $nextIndicator.addClass('active') + } + + var slidEvent = $.Event('slid.bs.carousel', { relatedTarget: relatedTarget, direction: direction }) // yes, "slid" + if ($.support.transition && this.$element.hasClass('slide')) { + $next.addClass(type) + $next[0].offsetWidth // force reflow + $active.addClass(direction) + $next.addClass(direction) + $active + .one('bsTransitionEnd', function () { + $next.removeClass([type, direction].join(' ')).addClass('active') + $active.removeClass(['active', direction].join(' ')) + that.sliding = false + setTimeout(function () { + that.$element.trigger(slidEvent) + }, 0) + }) + .emulateTransitionEnd(Carousel.TRANSITION_DURATION) + } else { + $active.removeClass('active') + $next.addClass('active') + this.sliding = false + this.$element.trigger(slidEvent) + } + + isCycling && this.cycle() + + return this + } + + + // CAROUSEL PLUGIN DEFINITION + // ========================== + + function Plugin(option) { + return this.each(function () { + var $this = $(this) + var data = $this.data('bs.carousel') + var options = $.extend({}, Carousel.DEFAULTS, $this.data(), typeof option == 'object' && option) + var action = typeof option == 'string' ? option : options.slide + + if (!data) $this.data('bs.carousel', (data = new Carousel(this, options))) + if (typeof option == 'number') data.to(option) + else if (action) data[action]() + else if (options.interval) data.pause().cycle() + }) + } + + var old = $.fn.carousel + + $.fn.carousel = Plugin + $.fn.carousel.Constructor = Carousel + + + // CAROUSEL NO CONFLICT + // ==================== + + $.fn.carousel.noConflict = function () { + $.fn.carousel = old + return this + } + + + // CAROUSEL DATA-API + // ================= + + var clickHandler = function (e) { + var href + var $this = $(this) + var $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) // strip for ie7 + if (!$target.hasClass('carousel')) return + var options = $.extend({}, $target.data(), $this.data()) + var slideIndex = $this.attr('data-slide-to') + if (slideIndex) options.interval = false + + Plugin.call($target, options) + + if (slideIndex) { + $target.data('bs.carousel').to(slideIndex) + } + + e.preventDefault() + } + + $(document) + .on('click.bs.carousel.data-api', '[data-slide]', clickHandler) + .on('click.bs.carousel.data-api', '[data-slide-to]', clickHandler) + + $(window).on('load', function () { + $('[data-ride="carousel"]').each(function () { + var $carousel = $(this) + Plugin.call($carousel, $carousel.data()) + }) + }) + +}(jQuery); + +/* ======================================================================== + * Bootstrap: collapse.js v3.3.5 + * http://getbootstrap.com/javascript/#collapse + * ======================================================================== + * Copyright 2011-2015 Twitter, Inc. + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) + * ======================================================================== */ + + ++function ($) { + 'use strict'; + + // COLLAPSE PUBLIC CLASS DEFINITION + // ================================ + + var Collapse = function (element, options) { + this.$element = $(element) + this.options = $.extend({}, Collapse.DEFAULTS, options) + this.$trigger = $('[data-toggle="collapse"][href="#' + element.id + '"],' + + '[data-toggle="collapse"][data-target="#' + element.id + '"]') + this.transitioning = null + + if (this.options.parent) { + this.$parent = this.getParent() + } else { + this.addAriaAndCollapsedClass(this.$element, this.$trigger) + } + + if (this.options.toggle) this.toggle() + } + + Collapse.VERSION = '3.3.5' + + Collapse.TRANSITION_DURATION = 350 + + Collapse.DEFAULTS = { + toggle: true + } + + Collapse.prototype.dimension = function () { + var hasWidth = this.$element.hasClass('width') + return hasWidth ? 'width' : 'height' + } + + Collapse.prototype.show = function () { + if (this.transitioning || this.$element.hasClass('in')) return + + var activesData + var actives = this.$parent && this.$parent.children('.panel').children('.in, .collapsing') + + if (actives && actives.length) { + activesData = actives.data('bs.collapse') + if (activesData && activesData.transitioning) return + } + + var startEvent = $.Event('show.bs.collapse') + this.$element.trigger(startEvent) + if (startEvent.isDefaultPrevented()) return + + if (actives && actives.length) { + Plugin.call(actives, 'hide') + activesData || actives.data('bs.collapse', null) + } + + var dimension = this.dimension() + + this.$element + .removeClass('collapse') + .addClass('collapsing')[dimension](0) + .attr('aria-expanded', true) + + this.$trigger + .removeClass('collapsed') + .attr('aria-expanded', true) + + this.transitioning = 1 + + var complete = function () { + this.$element + .removeClass('collapsing') + .addClass('collapse in')[dimension]('') + this.transitioning = 0 + this.$element + .trigger('shown.bs.collapse') + } + + if (!$.support.transition) return complete.call(this) + + var scrollSize = $.camelCase(['scroll', dimension].join('-')) + + this.$element + .one('bsTransitionEnd', $.proxy(complete, this)) + .emulateTransitionEnd(Collapse.TRANSITION_DURATION)[dimension](this.$element[0][scrollSize]) + } + + Collapse.prototype.hide = function () { + if (this.transitioning || !this.$element.hasClass('in')) return + + var startEvent = $.Event('hide.bs.collapse') + this.$element.trigger(startEvent) + if (startEvent.isDefaultPrevented()) return + + var dimension = this.dimension() + + this.$element[dimension](this.$element[dimension]())[0].offsetHeight + + this.$element + .addClass('collapsing') + .removeClass('collapse in') + .attr('aria-expanded', false) + + this.$trigger + .addClass('collapsed') + .attr('aria-expanded', false) + + this.transitioning = 1 + + var complete = function () { + this.transitioning = 0 + this.$element + .removeClass('collapsing') + .addClass('collapse') + .trigger('hidden.bs.collapse') + } + + if (!$.support.transition) return complete.call(this) + + this.$element + [dimension](0) + .one('bsTransitionEnd', $.proxy(complete, this)) + .emulateTransitionEnd(Collapse.TRANSITION_DURATION) + } + + Collapse.prototype.toggle = function () { + this[this.$element.hasClass('in') ? 'hide' : 'show']() + } + + Collapse.prototype.getParent = function () { + return $(this.options.parent) + .find('[data-toggle="collapse"][data-parent="' + this.options.parent + '"]') + .each($.proxy(function (i, element) { + var $element = $(element) + this.addAriaAndCollapsedClass(getTargetFromTrigger($element), $element) + }, this)) + .end() + } + + Collapse.prototype.addAriaAndCollapsedClass = function ($element, $trigger) { + var isOpen = $element.hasClass('in') + + $element.attr('aria-expanded', isOpen) + $trigger + .toggleClass('collapsed', !isOpen) + .attr('aria-expanded', isOpen) + } + + function getTargetFromTrigger($trigger) { + var href + var target = $trigger.attr('data-target') + || (href = $trigger.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') // strip for ie7 + + return $(target) + } + + + // COLLAPSE PLUGIN DEFINITION + // ========================== + + function Plugin(option) { + return this.each(function () { + var $this = $(this) + var data = $this.data('bs.collapse') + var options = $.extend({}, Collapse.DEFAULTS, $this.data(), typeof option == 'object' && option) + + if (!data && options.toggle && /show|hide/.test(option)) options.toggle = false + if (!data) $this.data('bs.collapse', (data = new Collapse(this, options))) + if (typeof option == 'string') data[option]() + }) + } + + var old = $.fn.collapse + + $.fn.collapse = Plugin + $.fn.collapse.Constructor = Collapse + + + // COLLAPSE NO CONFLICT + // ==================== + + $.fn.collapse.noConflict = function () { + $.fn.collapse = old + return this + } + + + // COLLAPSE DATA-API + // ================= + + $(document).on('click.bs.collapse.data-api', '[data-toggle="collapse"]', function (e) { + var $this = $(this) + + if (!$this.attr('data-target')) e.preventDefault() + + var $target = getTargetFromTrigger($this) + var data = $target.data('bs.collapse') + var option = data ? 'toggle' : $this.data() + + Plugin.call($target, option) + }) + +}(jQuery); + +/* ======================================================================== + * Bootstrap: dropdown.js v3.3.5 + * http://getbootstrap.com/javascript/#dropdowns + * ======================================================================== + * Copyright 2011-2015 Twitter, Inc. + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) + * ======================================================================== */ + + ++function ($) { + 'use strict'; + + // DROPDOWN CLASS DEFINITION + // ========================= + + var backdrop = '.dropdown-backdrop' + var toggle = '[data-toggle="dropdown"]' + var Dropdown = function (element) { + $(element).on('click.bs.dropdown', this.toggle) + } + + Dropdown.VERSION = '3.3.5' + + function getParent($this) { + var selector = $this.attr('data-target') + + if (!selector) { + selector = $this.attr('href') + selector = selector && /#[A-Za-z]/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7 + } + + var $parent = selector && $(selector) + + return $parent && $parent.length ? $parent : $this.parent() + } + + function clearMenus(e) { + if (e && e.which === 3) return + $(backdrop).remove() + $(toggle).each(function () { + var $this = $(this) + var $parent = getParent($this) + var relatedTarget = { relatedTarget: this } + + if (!$parent.hasClass('open')) return + + if (e && e.type == 'click' && /input|textarea/i.test(e.target.tagName) && $.contains($parent[0], e.target)) return + + $parent.trigger(e = $.Event('hide.bs.dropdown', relatedTarget)) + + if (e.isDefaultPrevented()) return + + $this.attr('aria-expanded', 'false') + $parent.removeClass('open').trigger('hidden.bs.dropdown', relatedTarget) + }) + } + + Dropdown.prototype.toggle = function (e) { + var $this = $(this) + + if ($this.is('.disabled, :disabled')) return + + var $parent = getParent($this) + var isActive = $parent.hasClass('open') + + clearMenus() + + if (!isActive) { + if ('ontouchstart' in document.documentElement && !$parent.closest('.navbar-nav').length) { + // if mobile we use a backdrop because click events don't delegate + $(document.createElement('div')) + .addClass('dropdown-backdrop') + .insertAfter($(this)) + .on('click', clearMenus) + } + + var relatedTarget = { relatedTarget: this } + $parent.trigger(e = $.Event('show.bs.dropdown', relatedTarget)) + + if (e.isDefaultPrevented()) return + + $this + .trigger('focus') + .attr('aria-expanded', 'true') + + $parent + .toggleClass('open') + .trigger('shown.bs.dropdown', relatedTarget) + } + + return false + } + + Dropdown.prototype.keydown = function (e) { + if (!/(38|40|27|32)/.test(e.which) || /input|textarea/i.test(e.target.tagName)) return + + var $this = $(this) + + e.preventDefault() + e.stopPropagation() + + if ($this.is('.disabled, :disabled')) return + + var $parent = getParent($this) + var isActive = $parent.hasClass('open') + + if (!isActive && e.which != 27 || isActive && e.which == 27) { + if (e.which == 27) $parent.find(toggle).trigger('focus') + return $this.trigger('click') + } + + var desc = ' li:not(.disabled):visible a' + var $items = $parent.find('.dropdown-menu' + desc) + + if (!$items.length) return + + var index = $items.index(e.target) + + if (e.which == 38 && index > 0) index-- // up + if (e.which == 40 && index < $items.length - 1) index++ // down + if (!~index) index = 0 + + $items.eq(index).trigger('focus') + } + + + // DROPDOWN PLUGIN DEFINITION + // ========================== + + function Plugin(option) { + return this.each(function () { + var $this = $(this) + var data = $this.data('bs.dropdown') + + if (!data) $this.data('bs.dropdown', (data = new Dropdown(this))) + if (typeof option == 'string') data[option].call($this) + }) + } + + var old = $.fn.dropdown + + $.fn.dropdown = Plugin + $.fn.dropdown.Constructor = Dropdown + + + // DROPDOWN NO CONFLICT + // ==================== + + $.fn.dropdown.noConflict = function () { + $.fn.dropdown = old + return this + } + + + // APPLY TO STANDARD DROPDOWN ELEMENTS + // =================================== + + $(document) + .on('click.bs.dropdown.data-api', clearMenus) + .on('click.bs.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() }) + .on('click.bs.dropdown.data-api', toggle, Dropdown.prototype.toggle) + .on('keydown.bs.dropdown.data-api', toggle, Dropdown.prototype.keydown) + .on('keydown.bs.dropdown.data-api', '.dropdown-menu', Dropdown.prototype.keydown) + +}(jQuery); + +/* ======================================================================== + * Bootstrap: modal.js v3.3.5 + * http://getbootstrap.com/javascript/#modals + * ======================================================================== + * Copyright 2011-2015 Twitter, Inc. + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) + * ======================================================================== */ + + ++function ($) { + 'use strict'; + + // MODAL CLASS DEFINITION + // ====================== + + var Modal = function (element, options) { + this.options = options + this.$body = $(document.body) + this.$element = $(element) + this.$dialog = this.$element.find('.modal-dialog') + this.$backdrop = null + this.isShown = null + this.originalBodyPad = null + this.scrollbarWidth = 0 + this.ignoreBackdropClick = false + + if (this.options.remote) { + this.$element + .find('.modal-content') + .load(this.options.remote, $.proxy(function () { + this.$element.trigger('loaded.bs.modal') + }, this)) + } + } + + Modal.VERSION = '3.3.5' + + Modal.TRANSITION_DURATION = 300 + Modal.BACKDROP_TRANSITION_DURATION = 150 + + Modal.DEFAULTS = { + backdrop: true, + keyboard: true, + show: true + } + + Modal.prototype.toggle = function (_relatedTarget) { + return this.isShown ? this.hide() : this.show(_relatedTarget) + } + + Modal.prototype.show = function (_relatedTarget) { + var that = this + var e = $.Event('show.bs.modal', { relatedTarget: _relatedTarget }) + + this.$element.trigger(e) + + if (this.isShown || e.isDefaultPrevented()) return + + this.isShown = true + + this.checkScrollbar() + this.setScrollbar() + this.$body.addClass('modal-open') + + this.escape() + this.resize() + + this.$element.on('click.dismiss.bs.modal', '[data-dismiss="modal"]', $.proxy(this.hide, this)) + + this.$dialog.on('mousedown.dismiss.bs.modal', function () { + that.$element.one('mouseup.dismiss.bs.modal', function (e) { + if ($(e.target).is(that.$element)) that.ignoreBackdropClick = true + }) + }) + + this.backdrop(function () { + var transition = $.support.transition && that.$element.hasClass('fade') + + if (!that.$element.parent().length) { + that.$element.appendTo(that.$body) // don't move modals dom position + } + + that.$element + .show() + .scrollTop(0) + + that.adjustDialog() + + if (transition) { + that.$element[0].offsetWidth // force reflow + } + + that.$element.addClass('in') + + that.enforceFocus() + + var e = $.Event('shown.bs.modal', { relatedTarget: _relatedTarget }) + + transition ? + that.$dialog // wait for modal to slide in + .one('bsTransitionEnd', function () { + that.$element.trigger('focus').trigger(e) + }) + .emulateTransitionEnd(Modal.TRANSITION_DURATION) : + that.$element.trigger('focus').trigger(e) + }) + } + + Modal.prototype.hide = function (e) { + if (e) e.preventDefault() + + e = $.Event('hide.bs.modal') + + this.$element.trigger(e) + + if (!this.isShown || e.isDefaultPrevented()) return + + this.isShown = false + + this.escape() + this.resize() + + $(document).off('focusin.bs.modal') + + this.$element + .removeClass('in') + .off('click.dismiss.bs.modal') + .off('mouseup.dismiss.bs.modal') + + this.$dialog.off('mousedown.dismiss.bs.modal') + + $.support.transition && this.$element.hasClass('fade') ? + this.$element + .one('bsTransitionEnd', $.proxy(this.hideModal, this)) + .emulateTransitionEnd(Modal.TRANSITION_DURATION) : + this.hideModal() + } + + Modal.prototype.enforceFocus = function () { + $(document) + .off('focusin.bs.modal') // guard against infinite focus loop + .on('focusin.bs.modal', $.proxy(function (e) { + if (this.$element[0] !== e.target && !this.$element.has(e.target).length) { + this.$element.trigger('focus') + } + }, this)) + } + + Modal.prototype.escape = function () { + if (this.isShown && this.options.keyboard) { + this.$element.on('keydown.dismiss.bs.modal', $.proxy(function (e) { + e.which == 27 && this.hide() + }, this)) + } else if (!this.isShown) { + this.$element.off('keydown.dismiss.bs.modal') + } + } + + Modal.prototype.resize = function () { + if (this.isShown) { + $(window).on('resize.bs.modal', $.proxy(this.handleUpdate, this)) + } else { + $(window).off('resize.bs.modal') + } + } + + Modal.prototype.hideModal = function () { + var that = this + this.$element.hide() + this.backdrop(function () { + that.$body.removeClass('modal-open') + that.resetAdjustments() + that.resetScrollbar() + that.$element.trigger('hidden.bs.modal') + }) + } + + Modal.prototype.removeBackdrop = function () { + this.$backdrop && this.$backdrop.remove() + this.$backdrop = null + } + + Modal.prototype.backdrop = function (callback) { + var that = this + var animate = this.$element.hasClass('fade') ? 'fade' : '' + + if (this.isShown && this.options.backdrop) { + var doAnimate = $.support.transition && animate + + this.$backdrop = $(document.createElement('div')) + .addClass('modal-backdrop ' + animate) + .appendTo(this.$body) + + this.$element.on('click.dismiss.bs.modal', $.proxy(function (e) { + if (this.ignoreBackdropClick) { + this.ignoreBackdropClick = false + return + } + if (e.target !== e.currentTarget) return + this.options.backdrop == 'static' + ? this.$element[0].focus() + : this.hide() + }, this)) + + if (doAnimate) this.$backdrop[0].offsetWidth // force reflow + + this.$backdrop.addClass('in') + + if (!callback) return + + doAnimate ? + this.$backdrop + .one('bsTransitionEnd', callback) + .emulateTransitionEnd(Modal.BACKDROP_TRANSITION_DURATION) : + callback() + + } else if (!this.isShown && this.$backdrop) { + this.$backdrop.removeClass('in') + + var callbackRemove = function () { + that.removeBackdrop() + callback && callback() + } + $.support.transition && this.$element.hasClass('fade') ? + this.$backdrop + .one('bsTransitionEnd', callbackRemove) + .emulateTransitionEnd(Modal.BACKDROP_TRANSITION_DURATION) : + callbackRemove() + + } else if (callback) { + callback() + } + } + + // these following methods are used to handle overflowing modals + + Modal.prototype.handleUpdate = function () { + this.adjustDialog() + } + + Modal.prototype.adjustDialog = function () { + var modalIsOverflowing = this.$element[0].scrollHeight > document.documentElement.clientHeight + + this.$element.css({ + paddingLeft: !this.bodyIsOverflowing && modalIsOverflowing ? this.scrollbarWidth : '', + paddingRight: this.bodyIsOverflowing && !modalIsOverflowing ? this.scrollbarWidth : '' + }) + } + + Modal.prototype.resetAdjustments = function () { + this.$element.css({ + paddingLeft: '', + paddingRight: '' + }) + } + + Modal.prototype.checkScrollbar = function () { + var fullWindowWidth = window.innerWidth + if (!fullWindowWidth) { // workaround for missing window.innerWidth in IE8 + var documentElementRect = document.documentElement.getBoundingClientRect() + fullWindowWidth = documentElementRect.right - Math.abs(documentElementRect.left) + } + this.bodyIsOverflowing = document.body.clientWidth < fullWindowWidth + this.scrollbarWidth = this.measureScrollbar() + } + + Modal.prototype.setScrollbar = function () { + var bodyPad = parseInt((this.$body.css('padding-right') || 0), 10) + this.originalBodyPad = document.body.style.paddingRight || '' + if (this.bodyIsOverflowing) this.$body.css('padding-right', bodyPad + this.scrollbarWidth) + } + + Modal.prototype.resetScrollbar = function () { + this.$body.css('padding-right', this.originalBodyPad) + } + + Modal.prototype.measureScrollbar = function () { // thx walsh + var scrollDiv = document.createElement('div') + scrollDiv.className = 'modal-scrollbar-measure' + this.$body.append(scrollDiv) + var scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth + this.$body[0].removeChild(scrollDiv) + return scrollbarWidth + } + + + // MODAL PLUGIN DEFINITION + // ======================= + + function Plugin(option, _relatedTarget) { + return this.each(function () { + var $this = $(this) + var data = $this.data('bs.modal') + var options = $.extend({}, Modal.DEFAULTS, $this.data(), typeof option == 'object' && option) + + if (!data) $this.data('bs.modal', (data = new Modal(this, options))) + if (typeof option == 'string') data[option](_relatedTarget) + else if (options.show) data.show(_relatedTarget) + }) + } + + var old = $.fn.modal + + $.fn.modal = Plugin + $.fn.modal.Constructor = Modal + + + // MODAL NO CONFLICT + // ================= + + $.fn.modal.noConflict = function () { + $.fn.modal = old + return this + } + + + // MODAL DATA-API + // ============== + + $(document).on('click.bs.modal.data-api', '[data-toggle="modal"]', function (e) { + var $this = $(this) + var href = $this.attr('href') + var $target = $($this.attr('data-target') || (href && href.replace(/.*(?=#[^\s]+$)/, ''))) // strip for ie7 + var option = $target.data('bs.modal') ? 'toggle' : $.extend({ remote: !/#/.test(href) && href }, $target.data(), $this.data()) + + if ($this.is('a')) e.preventDefault() + + $target.one('show.bs.modal', function (showEvent) { + if (showEvent.isDefaultPrevented()) return // only register focus restorer if modal will actually get shown + $target.one('hidden.bs.modal', function () { + $this.is(':visible') && $this.trigger('focus') + }) + }) + Plugin.call($target, option, this) + }) + +}(jQuery); + +/* ======================================================================== + * Bootstrap: tooltip.js v3.3.5 + * http://getbootstrap.com/javascript/#tooltip + * Inspired by the original jQuery.tipsy by Jason Frame + * ======================================================================== + * Copyright 2011-2015 Twitter, Inc. + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) + * ======================================================================== */ + + ++function ($) { + 'use strict'; + + // TOOLTIP PUBLIC CLASS DEFINITION + // =============================== + + var Tooltip = function (element, options) { + this.type = null + this.options = null + this.enabled = null + this.timeout = null + this.hoverState = null + this.$element = null + this.inState = null + + this.init('tooltip', element, options) + } + + Tooltip.VERSION = '3.3.5' + + Tooltip.TRANSITION_DURATION = 150 + + Tooltip.DEFAULTS = { + animation: true, + placement: 'top', + selector: false, + template: '', + trigger: 'hover focus', + title: '', + delay: 0, + html: false, + container: false, + viewport: { + selector: 'body', + padding: 0 + } + } + + Tooltip.prototype.init = function (type, element, options) { + this.enabled = true + this.type = type + this.$element = $(element) + this.options = this.getOptions(options) + this.$viewport = this.options.viewport && $($.isFunction(this.options.viewport) ? this.options.viewport.call(this, this.$element) : (this.options.viewport.selector || this.options.viewport)) + this.inState = { click: false, hover: false, focus: false } + + if (this.$element[0] instanceof document.constructor && !this.options.selector) { + throw new Error('`selector` option must be specified when initializing ' + this.type + ' on the window.document object!') + } + + var triggers = this.options.trigger.split(' ') + + for (var i = triggers.length; i--;) { + var trigger = triggers[i] + + if (trigger == 'click') { + this.$element.on('click.' + this.type, this.options.selector, $.proxy(this.toggle, this)) + } else if (trigger != 'manual') { + var eventIn = trigger == 'hover' ? 'mouseenter' : 'focusin' + var eventOut = trigger == 'hover' ? 'mouseleave' : 'focusout' + + this.$element.on(eventIn + '.' + this.type, this.options.selector, $.proxy(this.enter, this)) + this.$element.on(eventOut + '.' + this.type, this.options.selector, $.proxy(this.leave, this)) + } + } + + this.options.selector ? + (this._options = $.extend({}, this.options, { trigger: 'manual', selector: '' })) : + this.fixTitle() + } + + Tooltip.prototype.getDefaults = function () { + return Tooltip.DEFAULTS + } + + Tooltip.prototype.getOptions = function (options) { + options = $.extend({}, this.getDefaults(), this.$element.data(), options) + + if (options.delay && typeof options.delay == 'number') { + options.delay = { + show: options.delay, + hide: options.delay + } + } + + return options + } + + Tooltip.prototype.getDelegateOptions = function () { + var options = {} + var defaults = this.getDefaults() + + this._options && $.each(this._options, function (key, value) { + if (defaults[key] != value) options[key] = value + }) + + return options + } + + Tooltip.prototype.enter = function (obj) { + var self = obj instanceof this.constructor ? + obj : $(obj.currentTarget).data('bs.' + this.type) + + if (!self) { + self = new this.constructor(obj.currentTarget, this.getDelegateOptions()) + $(obj.currentTarget).data('bs.' + this.type, self) + } + + if (obj instanceof $.Event) { + self.inState[obj.type == 'focusin' ? 'focus' : 'hover'] = true + } + + if (self.tip().hasClass('in') || self.hoverState == 'in') { + self.hoverState = 'in' + return + } + + clearTimeout(self.timeout) + + self.hoverState = 'in' + + if (!self.options.delay || !self.options.delay.show) return self.show() + + self.timeout = setTimeout(function () { + if (self.hoverState == 'in') self.show() + }, self.options.delay.show) + } + + Tooltip.prototype.isInStateTrue = function () { + for (var key in this.inState) { + if (this.inState[key]) return true + } + + return false + } + + Tooltip.prototype.leave = function (obj) { + var self = obj instanceof this.constructor ? + obj : $(obj.currentTarget).data('bs.' + this.type) + + if (!self) { + self = new this.constructor(obj.currentTarget, this.getDelegateOptions()) + $(obj.currentTarget).data('bs.' + this.type, self) + } + + if (obj instanceof $.Event) { + self.inState[obj.type == 'focusout' ? 'focus' : 'hover'] = false + } + + if (self.isInStateTrue()) return + + clearTimeout(self.timeout) + + self.hoverState = 'out' + + if (!self.options.delay || !self.options.delay.hide) return self.hide() + + self.timeout = setTimeout(function () { + if (self.hoverState == 'out') self.hide() + }, self.options.delay.hide) + } + + Tooltip.prototype.show = function () { + var e = $.Event('show.bs.' + this.type) + + if (this.hasContent() && this.enabled) { + this.$element.trigger(e) + + var inDom = $.contains(this.$element[0].ownerDocument.documentElement, this.$element[0]) + if (e.isDefaultPrevented() || !inDom) return + var that = this + + var $tip = this.tip() + + var tipId = this.getUID(this.type) + + this.setContent() + $tip.attr('id', tipId) + this.$element.attr('aria-describedby', tipId) + + if (this.options.animation) $tip.addClass('fade') + + var placement = typeof this.options.placement == 'function' ? + this.options.placement.call(this, $tip[0], this.$element[0]) : + this.options.placement + + var autoToken = /\s?auto?\s?/i + var autoPlace = autoToken.test(placement) + if (autoPlace) placement = placement.replace(autoToken, '') || 'top' + + $tip + .detach() + .css({ top: 0, left: 0, display: 'block' }) + .addClass(placement) + .data('bs.' + this.type, this) + + this.options.container ? $tip.appendTo(this.options.container) : $tip.insertAfter(this.$element) + this.$element.trigger('inserted.bs.' + this.type) + + var pos = this.getPosition() + var actualWidth = $tip[0].offsetWidth + var actualHeight = $tip[0].offsetHeight + + if (autoPlace) { + var orgPlacement = placement + var viewportDim = this.getPosition(this.$viewport) + + placement = placement == 'bottom' && pos.bottom + actualHeight > viewportDim.bottom ? 'top' : + placement == 'top' && pos.top - actualHeight < viewportDim.top ? 'bottom' : + placement == 'right' && pos.right + actualWidth > viewportDim.width ? 'left' : + placement == 'left' && pos.left - actualWidth < viewportDim.left ? 'right' : + placement + + $tip + .removeClass(orgPlacement) + .addClass(placement) + } + + var calculatedOffset = this.getCalculatedOffset(placement, pos, actualWidth, actualHeight) + + this.applyPlacement(calculatedOffset, placement) + + var complete = function () { + var prevHoverState = that.hoverState + that.$element.trigger('shown.bs.' + that.type) + that.hoverState = null + + if (prevHoverState == 'out') that.leave(that) + } + + $.support.transition && this.$tip.hasClass('fade') ? + $tip + .one('bsTransitionEnd', complete) + .emulateTransitionEnd(Tooltip.TRANSITION_DURATION) : + complete() + } + } + + Tooltip.prototype.applyPlacement = function (offset, placement) { + var $tip = this.tip() + var width = $tip[0].offsetWidth + var height = $tip[0].offsetHeight + + // manually read margins because getBoundingClientRect includes difference + var marginTop = parseInt($tip.css('margin-top'), 10) + var marginLeft = parseInt($tip.css('margin-left'), 10) + + // we must check for NaN for ie 8/9 + if (isNaN(marginTop)) marginTop = 0 + if (isNaN(marginLeft)) marginLeft = 0 + + offset.top += marginTop + offset.left += marginLeft + + // $.fn.offset doesn't round pixel values + // so we use setOffset directly with our own function B-0 + $.offset.setOffset($tip[0], $.extend({ + using: function (props) { + $tip.css({ + top: Math.round(props.top), + left: Math.round(props.left) + }) + } + }, offset), 0) + + $tip.addClass('in') + + // check to see if placing tip in new offset caused the tip to resize itself + var actualWidth = $tip[0].offsetWidth + var actualHeight = $tip[0].offsetHeight + + if (placement == 'top' && actualHeight != height) { + offset.top = offset.top + height - actualHeight + } + + var delta = this.getViewportAdjustedDelta(placement, offset, actualWidth, actualHeight) + + if (delta.left) offset.left += delta.left + else offset.top += delta.top + + var isVertical = /top|bottom/.test(placement) + var arrowDelta = isVertical ? delta.left * 2 - width + actualWidth : delta.top * 2 - height + actualHeight + var arrowOffsetPosition = isVertical ? 'offsetWidth' : 'offsetHeight' + + $tip.offset(offset) + this.replaceArrow(arrowDelta, $tip[0][arrowOffsetPosition], isVertical) + } + + Tooltip.prototype.replaceArrow = function (delta, dimension, isVertical) { + this.arrow() + .css(isVertical ? 'left' : 'top', 50 * (1 - delta / dimension) + '%') + .css(isVertical ? 'top' : 'left', '') + } + + Tooltip.prototype.setContent = function () { + var $tip = this.tip() + var title = this.getTitle() + + $tip.find('.tooltip-inner')[this.options.html ? 'html' : 'text'](title) + $tip.removeClass('fade in top bottom left right') + } + + Tooltip.prototype.hide = function (callback) { + var that = this + var $tip = $(this.$tip) + var e = $.Event('hide.bs.' + this.type) + + function complete() { + if (that.hoverState != 'in') $tip.detach() + that.$element + .removeAttr('aria-describedby') + .trigger('hidden.bs.' + that.type) + callback && callback() + } + + this.$element.trigger(e) + + if (e.isDefaultPrevented()) return + + $tip.removeClass('in') + + $.support.transition && $tip.hasClass('fade') ? + $tip + .one('bsTransitionEnd', complete) + .emulateTransitionEnd(Tooltip.TRANSITION_DURATION) : + complete() + + this.hoverState = null + + return this + } + + Tooltip.prototype.fixTitle = function () { + var $e = this.$element + if ($e.attr('title') || typeof $e.attr('data-original-title') != 'string') { + $e.attr('data-original-title', $e.attr('title') || '').attr('title', '') + } + } + + Tooltip.prototype.hasContent = function () { + return this.getTitle() + } + + Tooltip.prototype.getPosition = function ($element) { + $element = $element || this.$element + + var el = $element[0] + var isBody = el.tagName == 'BODY' + + var elRect = el.getBoundingClientRect() + if (elRect.width == null) { + // width and height are missing in IE8, so compute them manually; see https://github.com/twbs/bootstrap/issues/14093 + elRect = $.extend({}, elRect, { width: elRect.right - elRect.left, height: elRect.bottom - elRect.top }) + } + var elOffset = isBody ? { top: 0, left: 0 } : $element.offset() + var scroll = { scroll: isBody ? document.documentElement.scrollTop || document.body.scrollTop : $element.scrollTop() } + var outerDims = isBody ? { width: $(window).width(), height: $(window).height() } : null + + return $.extend({}, elRect, scroll, outerDims, elOffset) + } + + Tooltip.prototype.getCalculatedOffset = function (placement, pos, actualWidth, actualHeight) { + return placement == 'bottom' ? { top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2 } : + placement == 'top' ? { top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2 } : + placement == 'left' ? { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth } : + /* placement == 'right' */ { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width } + + } + + Tooltip.prototype.getViewportAdjustedDelta = function (placement, pos, actualWidth, actualHeight) { + var delta = { top: 0, left: 0 } + if (!this.$viewport) return delta + + var viewportPadding = this.options.viewport && this.options.viewport.padding || 0 + var viewportDimensions = this.getPosition(this.$viewport) + + if (/right|left/.test(placement)) { + var topEdgeOffset = pos.top - viewportPadding - viewportDimensions.scroll + var bottomEdgeOffset = pos.top + viewportPadding - viewportDimensions.scroll + actualHeight + if (topEdgeOffset < viewportDimensions.top) { // top overflow + delta.top = viewportDimensions.top - topEdgeOffset + } else if (bottomEdgeOffset > viewportDimensions.top + viewportDimensions.height) { // bottom overflow + delta.top = viewportDimensions.top + viewportDimensions.height - bottomEdgeOffset + } + } else { + var leftEdgeOffset = pos.left - viewportPadding + var rightEdgeOffset = pos.left + viewportPadding + actualWidth + if (leftEdgeOffset < viewportDimensions.left) { // left overflow + delta.left = viewportDimensions.left - leftEdgeOffset + } else if (rightEdgeOffset > viewportDimensions.right) { // right overflow + delta.left = viewportDimensions.left + viewportDimensions.width - rightEdgeOffset + } + } + + return delta + } + + Tooltip.prototype.getTitle = function () { + var title + var $e = this.$element + var o = this.options + + title = $e.attr('data-original-title') + || (typeof o.title == 'function' ? o.title.call($e[0]) : o.title) + + return title + } + + Tooltip.prototype.getUID = function (prefix) { + do prefix += ~~(Math.random() * 1000000) + while (document.getElementById(prefix)) + return prefix + } + + Tooltip.prototype.tip = function () { + if (!this.$tip) { + this.$tip = $(this.options.template) + if (this.$tip.length != 1) { + throw new Error(this.type + ' `template` option must consist of exactly 1 top-level element!') + } + } + return this.$tip + } + + Tooltip.prototype.arrow = function () { + return (this.$arrow = this.$arrow || this.tip().find('.tooltip-arrow')) + } + + Tooltip.prototype.enable = function () { + this.enabled = true + } + + Tooltip.prototype.disable = function () { + this.enabled = false + } + + Tooltip.prototype.toggleEnabled = function () { + this.enabled = !this.enabled + } + + Tooltip.prototype.toggle = function (e) { + var self = this + if (e) { + self = $(e.currentTarget).data('bs.' + this.type) + if (!self) { + self = new this.constructor(e.currentTarget, this.getDelegateOptions()) + $(e.currentTarget).data('bs.' + this.type, self) + } + } + + if (e) { + self.inState.click = !self.inState.click + if (self.isInStateTrue()) self.enter(self) + else self.leave(self) + } else { + self.tip().hasClass('in') ? self.leave(self) : self.enter(self) + } + } + + Tooltip.prototype.destroy = function () { + var that = this + clearTimeout(this.timeout) + this.hide(function () { + that.$element.off('.' + that.type).removeData('bs.' + that.type) + if (that.$tip) { + that.$tip.detach() + } + that.$tip = null + that.$arrow = null + that.$viewport = null + }) + } + + + // TOOLTIP PLUGIN DEFINITION + // ========================= + + function Plugin(option) { + return this.each(function () { + var $this = $(this) + var data = $this.data('bs.tooltip') + var options = typeof option == 'object' && option + + if (!data && /destroy|hide/.test(option)) return + if (!data) $this.data('bs.tooltip', (data = new Tooltip(this, options))) + if (typeof option == 'string') data[option]() + }) + } + + var old = $.fn.tooltip + + $.fn.tooltip = Plugin + $.fn.tooltip.Constructor = Tooltip + + + // TOOLTIP NO CONFLICT + // =================== + + $.fn.tooltip.noConflict = function () { + $.fn.tooltip = old + return this + } + +}(jQuery); + +/* ======================================================================== + * Bootstrap: popover.js v3.3.5 + * http://getbootstrap.com/javascript/#popovers + * ======================================================================== + * Copyright 2011-2015 Twitter, Inc. + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) + * ======================================================================== */ + + ++function ($) { + 'use strict'; + + // POPOVER PUBLIC CLASS DEFINITION + // =============================== + + var Popover = function (element, options) { + this.init('popover', element, options) + } + + if (!$.fn.tooltip) throw new Error('Popover requires tooltip.js') + + Popover.VERSION = '3.3.5' + + Popover.DEFAULTS = $.extend({}, $.fn.tooltip.Constructor.DEFAULTS, { + placement: 'right', + trigger: 'click', + content: '', + template: '' + }) + + + // NOTE: POPOVER EXTENDS tooltip.js + // ================================ + + Popover.prototype = $.extend({}, $.fn.tooltip.Constructor.prototype) + + Popover.prototype.constructor = Popover + + Popover.prototype.getDefaults = function () { + return Popover.DEFAULTS + } + + Popover.prototype.setContent = function () { + var $tip = this.tip() + var title = this.getTitle() + var content = this.getContent() + + $tip.find('.popover-title')[this.options.html ? 'html' : 'text'](title) + $tip.find('.popover-content').children().detach().end()[ // we use append for html objects to maintain js events + this.options.html ? (typeof content == 'string' ? 'html' : 'append') : 'text' + ](content) + + $tip.removeClass('fade top bottom left right in') + + // IE8 doesn't accept hiding via the `:empty` pseudo selector, we have to do + // this manually by checking the contents. + if (!$tip.find('.popover-title').html()) $tip.find('.popover-title').hide() + } + + Popover.prototype.hasContent = function () { + return this.getTitle() || this.getContent() + } + + Popover.prototype.getContent = function () { + var $e = this.$element + var o = this.options + + return $e.attr('data-content') + || (typeof o.content == 'function' ? + o.content.call($e[0]) : + o.content) + } + + Popover.prototype.arrow = function () { + return (this.$arrow = this.$arrow || this.tip().find('.arrow')) + } + + + // POPOVER PLUGIN DEFINITION + // ========================= + + function Plugin(option) { + return this.each(function () { + var $this = $(this) + var data = $this.data('bs.popover') + var options = typeof option == 'object' && option + + if (!data && /destroy|hide/.test(option)) return + if (!data) $this.data('bs.popover', (data = new Popover(this, options))) + if (typeof option == 'string') data[option]() + }) + } + + var old = $.fn.popover + + $.fn.popover = Plugin + $.fn.popover.Constructor = Popover + + + // POPOVER NO CONFLICT + // =================== + + $.fn.popover.noConflict = function () { + $.fn.popover = old + return this + } + +}(jQuery); + +/* ======================================================================== + * Bootstrap: scrollspy.js v3.3.5 + * http://getbootstrap.com/javascript/#scrollspy + * ======================================================================== + * Copyright 2011-2015 Twitter, Inc. + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) + * ======================================================================== */ + + ++function ($) { + 'use strict'; + + // SCROLLSPY CLASS DEFINITION + // ========================== + + function ScrollSpy(element, options) { + this.$body = $(document.body) + this.$scrollElement = $(element).is(document.body) ? $(window) : $(element) + this.options = $.extend({}, ScrollSpy.DEFAULTS, options) + this.selector = (this.options.target || '') + ' .nav li > a' + this.offsets = [] + this.targets = [] + this.activeTarget = null + this.scrollHeight = 0 + + this.$scrollElement.on('scroll.bs.scrollspy', $.proxy(this.process, this)) + this.refresh() + this.process() + } + + ScrollSpy.VERSION = '3.3.5' + + ScrollSpy.DEFAULTS = { + offset: 10 + } + + ScrollSpy.prototype.getScrollHeight = function () { + return this.$scrollElement[0].scrollHeight || Math.max(this.$body[0].scrollHeight, document.documentElement.scrollHeight) + } + + ScrollSpy.prototype.refresh = function () { + var that = this + var offsetMethod = 'offset' + var offsetBase = 0 + + this.offsets = [] + this.targets = [] + this.scrollHeight = this.getScrollHeight() + + if (!$.isWindow(this.$scrollElement[0])) { + offsetMethod = 'position' + offsetBase = this.$scrollElement.scrollTop() + } + + this.$body + .find(this.selector) + .map(function () { + var $el = $(this) + var href = $el.data('target') || $el.attr('href') + var $href = /^#./.test(href) && $(href) + + return ($href + && $href.length + && $href.is(':visible') + && [[$href[offsetMethod]().top + offsetBase, href]]) || null + }) + .sort(function (a, b) { return a[0] - b[0] }) + .each(function () { + that.offsets.push(this[0]) + that.targets.push(this[1]) + }) + } + + ScrollSpy.prototype.process = function () { + var scrollTop = this.$scrollElement.scrollTop() + this.options.offset + var scrollHeight = this.getScrollHeight() + var maxScroll = this.options.offset + scrollHeight - this.$scrollElement.height() + var offsets = this.offsets + var targets = this.targets + var activeTarget = this.activeTarget + var i + + if (this.scrollHeight != scrollHeight) { + this.refresh() + } + + if (scrollTop >= maxScroll) { + return activeTarget != (i = targets[targets.length - 1]) && this.activate(i) + } + + if (activeTarget && scrollTop < offsets[0]) { + this.activeTarget = null + return this.clear() + } + + for (i = offsets.length; i--;) { + activeTarget != targets[i] + && scrollTop >= offsets[i] + && (offsets[i + 1] === undefined || scrollTop < offsets[i + 1]) + && this.activate(targets[i]) + } + } + + ScrollSpy.prototype.activate = function (target) { + this.activeTarget = target + + this.clear() + + var selector = this.selector + + '[data-target="' + target + '"],' + + this.selector + '[href="' + target + '"]' + + var active = $(selector) + .parents('li') + .addClass('active') + + if (active.parent('.dropdown-menu').length) { + active = active + .closest('li.dropdown') + .addClass('active') + } + + active.trigger('activate.bs.scrollspy') + } + + ScrollSpy.prototype.clear = function () { + $(this.selector) + .parentsUntil(this.options.target, '.active') + .removeClass('active') + } + + + // SCROLLSPY PLUGIN DEFINITION + // =========================== + + function Plugin(option) { + return this.each(function () { + var $this = $(this) + var data = $this.data('bs.scrollspy') + var options = typeof option == 'object' && option + + if (!data) $this.data('bs.scrollspy', (data = new ScrollSpy(this, options))) + if (typeof option == 'string') data[option]() + }) + } + + var old = $.fn.scrollspy + + $.fn.scrollspy = Plugin + $.fn.scrollspy.Constructor = ScrollSpy + + + // SCROLLSPY NO CONFLICT + // ===================== + + $.fn.scrollspy.noConflict = function () { + $.fn.scrollspy = old + return this + } + + + // SCROLLSPY DATA-API + // ================== + + $(window).on('load.bs.scrollspy.data-api', function () { + $('[data-spy="scroll"]').each(function () { + var $spy = $(this) + Plugin.call($spy, $spy.data()) + }) + }) + +}(jQuery); + +/* ======================================================================== + * Bootstrap: tab.js v3.3.5 + * http://getbootstrap.com/javascript/#tabs + * ======================================================================== + * Copyright 2011-2015 Twitter, Inc. + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) + * ======================================================================== */ + + ++function ($) { + 'use strict'; + + // TAB CLASS DEFINITION + // ==================== + + var Tab = function (element) { + // jscs:disable requireDollarBeforejQueryAssignment + this.element = $(element) + // jscs:enable requireDollarBeforejQueryAssignment + } + + Tab.VERSION = '3.3.5' + + Tab.TRANSITION_DURATION = 150 + + Tab.prototype.show = function () { + var $this = this.element + var $ul = $this.closest('ul:not(.dropdown-menu)') + var selector = $this.data('target') + + if (!selector) { + selector = $this.attr('href') + selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7 + } + + if ($this.parent('li').hasClass('active')) return + + var $previous = $ul.find('.active:last a') + var hideEvent = $.Event('hide.bs.tab', { + relatedTarget: $this[0] + }) + var showEvent = $.Event('show.bs.tab', { + relatedTarget: $previous[0] + }) + + $previous.trigger(hideEvent) + $this.trigger(showEvent) + + if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) return + + var $target = $(selector) + + this.activate($this.closest('li'), $ul) + this.activate($target, $target.parent(), function () { + $previous.trigger({ + type: 'hidden.bs.tab', + relatedTarget: $this[0] + }) + $this.trigger({ + type: 'shown.bs.tab', + relatedTarget: $previous[0] + }) + }) + } + + Tab.prototype.activate = function (element, container, callback) { + var $active = container.find('> .active') + var transition = callback + && $.support.transition + && ($active.length && $active.hasClass('fade') || !!container.find('> .fade').length) + + function next() { + $active + .removeClass('active') + .find('> .dropdown-menu > .active') + .removeClass('active') + .end() + .find('[data-toggle="tab"]') + .attr('aria-expanded', false) + + element + .addClass('active') + .find('[data-toggle="tab"]') + .attr('aria-expanded', true) + + if (transition) { + element[0].offsetWidth // reflow for transition + element.addClass('in') + } else { + element.removeClass('fade') + } + + if (element.parent('.dropdown-menu').length) { + element + .closest('li.dropdown') + .addClass('active') + .end() + .find('[data-toggle="tab"]') + .attr('aria-expanded', true) + } + + callback && callback() + } + + $active.length && transition ? + $active + .one('bsTransitionEnd', next) + .emulateTransitionEnd(Tab.TRANSITION_DURATION) : + next() + + $active.removeClass('in') + } + + + // TAB PLUGIN DEFINITION + // ===================== + + function Plugin(option) { + return this.each(function () { + var $this = $(this) + var data = $this.data('bs.tab') + + if (!data) $this.data('bs.tab', (data = new Tab(this))) + if (typeof option == 'string') data[option]() + }) + } + + var old = $.fn.tab + + $.fn.tab = Plugin + $.fn.tab.Constructor = Tab + + + // TAB NO CONFLICT + // =============== + + $.fn.tab.noConflict = function () { + $.fn.tab = old + return this + } + + + // TAB DATA-API + // ============ + + var clickHandler = function (e) { + e.preventDefault() + Plugin.call($(this), 'show') + } + + $(document) + .on('click.bs.tab.data-api', '[data-toggle="tab"]', clickHandler) + .on('click.bs.tab.data-api', '[data-toggle="pill"]', clickHandler) + +}(jQuery); + +/* ======================================================================== + * Bootstrap: affix.js v3.3.5 + * http://getbootstrap.com/javascript/#affix + * ======================================================================== + * Copyright 2011-2015 Twitter, Inc. + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) + * ======================================================================== */ + + ++function ($) { + 'use strict'; + + // AFFIX CLASS DEFINITION + // ====================== + + var Affix = function (element, options) { + this.options = $.extend({}, Affix.DEFAULTS, options) + + this.$target = $(this.options.target) + .on('scroll.bs.affix.data-api', $.proxy(this.checkPosition, this)) + .on('click.bs.affix.data-api', $.proxy(this.checkPositionWithEventLoop, this)) + + this.$element = $(element) + this.affixed = null + this.unpin = null + this.pinnedOffset = null + + this.checkPosition() + } + + Affix.VERSION = '3.3.5' + + Affix.RESET = 'affix affix-top affix-bottom' + + Affix.DEFAULTS = { + offset: 0, + target: window + } + + Affix.prototype.getState = function (scrollHeight, height, offsetTop, offsetBottom) { + var scrollTop = this.$target.scrollTop() + var position = this.$element.offset() + var targetHeight = this.$target.height() + + if (offsetTop != null && this.affixed == 'top') return scrollTop < offsetTop ? 'top' : false + + if (this.affixed == 'bottom') { + if (offsetTop != null) return (scrollTop + this.unpin <= position.top) ? false : 'bottom' + return (scrollTop + targetHeight <= scrollHeight - offsetBottom) ? false : 'bottom' + } + + var initializing = this.affixed == null + var colliderTop = initializing ? scrollTop : position.top + var colliderHeight = initializing ? targetHeight : height + + if (offsetTop != null && scrollTop <= offsetTop) return 'top' + if (offsetBottom != null && (colliderTop + colliderHeight >= scrollHeight - offsetBottom)) return 'bottom' + + return false + } + + Affix.prototype.getPinnedOffset = function () { + if (this.pinnedOffset) return this.pinnedOffset + this.$element.removeClass(Affix.RESET).addClass('affix') + var scrollTop = this.$target.scrollTop() + var position = this.$element.offset() + return (this.pinnedOffset = position.top - scrollTop) + } + + Affix.prototype.checkPositionWithEventLoop = function () { + setTimeout($.proxy(this.checkPosition, this), 1) + } + + Affix.prototype.checkPosition = function () { + if (!this.$element.is(':visible')) return + + var height = this.$element.height() + var offset = this.options.offset + var offsetTop = offset.top + var offsetBottom = offset.bottom + var scrollHeight = Math.max($(document).height(), $(document.body).height()) + + if (typeof offset != 'object') offsetBottom = offsetTop = offset + if (typeof offsetTop == 'function') offsetTop = offset.top(this.$element) + if (typeof offsetBottom == 'function') offsetBottom = offset.bottom(this.$element) + + var affix = this.getState(scrollHeight, height, offsetTop, offsetBottom) + + if (this.affixed != affix) { + if (this.unpin != null) this.$element.css('top', '') + + var affixType = 'affix' + (affix ? '-' + affix : '') + var e = $.Event(affixType + '.bs.affix') + + this.$element.trigger(e) + + if (e.isDefaultPrevented()) return + + this.affixed = affix + this.unpin = affix == 'bottom' ? this.getPinnedOffset() : null + + this.$element + .removeClass(Affix.RESET) + .addClass(affixType) + .trigger(affixType.replace('affix', 'affixed') + '.bs.affix') + } + + if (affix == 'bottom') { + this.$element.offset({ + top: scrollHeight - height - offsetBottom + }) + } + } + + + // AFFIX PLUGIN DEFINITION + // ======================= + + function Plugin(option) { + return this.each(function () { + var $this = $(this) + var data = $this.data('bs.affix') + var options = typeof option == 'object' && option + + if (!data) $this.data('bs.affix', (data = new Affix(this, options))) + if (typeof option == 'string') data[option]() + }) + } + + var old = $.fn.affix + + $.fn.affix = Plugin + $.fn.affix.Constructor = Affix + + + // AFFIX NO CONFLICT + // ================= + + $.fn.affix.noConflict = function () { + $.fn.affix = old + return this + } + + + // AFFIX DATA-API + // ============== + + $(window).on('load', function () { + $('[data-spy="affix"]').each(function () { + var $spy = $(this) + var data = $spy.data() + + data.offset = data.offset || {} + + if (data.offsetBottom != null) data.offset.bottom = data.offsetBottom + if (data.offsetTop != null) data.offset.top = data.offsetTop + + Plugin.call($spy, data) + }) + }) + +}(jQuery); diff --git a/public/bower_components/bootstrap/bootstrap.less b/public/bower_components/bootstrap/bootstrap.less new file mode 100644 index 0000000..4b9916e --- /dev/null +++ b/public/bower_components/bootstrap/bootstrap.less @@ -0,0 +1,56 @@ +/*! + * Bootstrap v3.3.5 (http://getbootstrap.com) + * Copyright 2011-2015 Twitter, Inc. + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) + */ + +// Core variables and mixins +@import "variables.less"; +@import "mixins.less"; + +// Reset and dependencies +@import "normalize.less"; +@import "print.less"; +@import "glyphicons.less"; + +// Core CSS +@import "scaffolding.less"; +@import "type.less"; +@import "code.less"; +@import "grid.less"; +@import "tables.less"; +@import "forms.less"; +@import "buttons.less"; + +// Components +@import "component-animations.less"; +@import "dropdowns.less"; +@import "button-groups.less"; +@import "input-groups.less"; +@import "navs.less"; +@import "navbar.less"; +@import "breadcrumbs.less"; +@import "pagination.less"; +@import "pager.less"; +@import "labels.less"; +@import "badges.less"; +@import "jumbotron.less"; +@import "thumbnails.less"; +@import "alerts.less"; +@import "progress-bars.less"; +@import "media.less"; +@import "list-group.less"; +@import "panels.less"; +@import "responsive-embed.less"; +@import "wells.less"; +@import "close.less"; + +// Components w/ JavaScript +@import "modals.less"; +@import "tooltip.less"; +@import "popovers.less"; +@import "carousel.less"; + +// Utility classes +@import "utilities.less"; +@import "responsive-utilities.less"; diff --git a/public/bower_components/checklist-model/checklist-model.js b/public/bower_components/checklist-model/checklist-model.js new file mode 100644 index 0000000..735ead8 --- /dev/null +++ b/public/bower_components/checklist-model/checklist-model.js @@ -0,0 +1,134 @@ +/** + * Checklist-model + * AngularJS directive for list of checkboxes + * https://github.com/vitalets/checklist-model + * License: MIT http://opensource.org/licenses/MIT + */ + +angular.module('checklist-model', []) +.directive('checklistModel', ['$parse', '$compile', function($parse, $compile) { + // contains + function contains(arr, item, comparator) { + if (angular.isArray(arr)) { + for (var i = arr.length; i--;) { + if (comparator(arr[i], item)) { + return true; + } + } + } + return false; + } + + // add + function add(arr, item, comparator) { + arr = angular.isArray(arr) ? arr : []; + if(!contains(arr, item, comparator)) { + arr.push(item); + } + return arr; + } + + // remove + function remove(arr, item, comparator) { + if (angular.isArray(arr)) { + for (var i = arr.length; i--;) { + if (comparator(arr[i], item)) { + arr.splice(i, 1); + break; + } + } + } + return arr; + } + + // http://stackoverflow.com/a/19228302/1458162 + function postLinkFn(scope, elem, attrs) { + // exclude recursion, but still keep the model + var checklistModel = attrs.checklistModel; + attrs.$set("checklistModel", null); + // compile with `ng-model` pointing to `checked` + $compile(elem)(scope); + attrs.$set("checklistModel", checklistModel); + + // getter / setter for original model + var getter = $parse(checklistModel); + var setter = getter.assign; + var checklistChange = $parse(attrs.checklistChange); + + // value added to list + var value = attrs.checklistValue ? $parse(attrs.checklistValue)(scope.$parent) : attrs.value; + + + var comparator = angular.equals; + + if (attrs.hasOwnProperty('checklistComparator')){ + if (attrs.checklistComparator[0] == '.') { + var comparatorExpression = attrs.checklistComparator.substring(1); + comparator = function (a, b) { + return a[comparatorExpression] === b[comparatorExpression]; + } + + } else { + comparator = $parse(attrs.checklistComparator)(scope.$parent); + } + } + + // watch UI checked change + scope.$watch(attrs.ngModel, function(newValue, oldValue) { + if (newValue === oldValue) { + return; + } + var current = getter(scope.$parent); + if (angular.isFunction(setter)) { + if (newValue === true) { + setter(scope.$parent, add(current, value, comparator)); + } else { + setter(scope.$parent, remove(current, value, comparator)); + } + } + + if (checklistChange) { + checklistChange(scope); + } + }); + + // declare one function to be used for both $watch functions + function setChecked(newArr, oldArr) { + scope[attrs.ngModel] = contains(newArr, value, comparator); + } + + // watch original model change + // use the faster $watchCollection method if it's available + if (angular.isFunction(scope.$parent.$watchCollection)) { + scope.$parent.$watchCollection(checklistModel, setChecked); + } else { + scope.$parent.$watch(checklistModel, setChecked, true); + } + } + + return { + restrict: 'A', + priority: 1000, + terminal: true, + scope: true, + compile: function(tElement, tAttrs) { + if ((tElement[0].tagName !== 'INPUT' || tAttrs.type !== 'checkbox') + && (tElement[0].tagName !== 'MD-CHECKBOX') + && (!tAttrs.btnCheckbox)) { + throw 'checklist-model should be applied to `input[type="checkbox"]` or `md-checkbox`.'; + } + + if (!tAttrs.checklistValue && !tAttrs.value) { + throw 'You should provide `value` or `checklist-value`.'; + } + + // by default ngModel is 'checked', so we set it if not specified + if (!tAttrs.ngModel) { + // local scope var storing individual checkbox model + tAttrs.$set("ngModel", "checked"); + } + + return postLinkFn; + } + }; +}]); diff --git a/public/bower_components/css-spinners/atebits.css b/public/bower_components/css-spinners/atebits.css new file mode 100644 index 0000000..a378bfa --- /dev/null +++ b/public/bower_components/css-spinners/atebits.css @@ -0,0 +1,306 @@ +@-moz-keyframes atebits-loader { + 0% { + -moz-transform: rotate(0deg); + transform: rotate(0deg); + } + 3% { + -moz-transform: rotate(90deg); + transform: rotate(90deg); + } + 10% { + -moz-transform: rotate(90deg); + transform: rotate(90deg); + } + 13% { + -moz-transform: rotate(180deg); + transform: rotate(180deg); + } + 20% { + -moz-transform: rotate(180deg); + transform: rotate(180deg); + } + 23% { + -moz-transform: rotate(90deg); + transform: rotate(90deg); + } + 30% { + -moz-transform: rotate(90deg); + transform: rotate(90deg); + } + 33% { + -moz-transform: rotate(180deg); + transform: rotate(180deg); + } + 40% { + -moz-transform: rotate(180deg); + transform: rotate(180deg); + } + 43% { + -moz-transform: rotate(270deg); + transform: rotate(270deg); + } + 50% { + -moz-transform: rotate(270deg); + transform: rotate(270deg); + } + 53% { + -moz-transform: rotate(180deg); + transform: rotate(180deg); + } + 60% { + -moz-transform: rotate(180deg); + transform: rotate(180deg); + } + 63% { + -moz-transform: rotate(90deg); + transform: rotate(90deg); + } + 70% { + -moz-transform: rotate(90deg); + transform: rotate(90deg); + } + 73% { + -moz-transform: rotate(0deg); + transform: rotate(0deg); + } + 80% { + -moz-transform: rotate(0deg); + transform: rotate(0deg); + } + 83% { + -moz-transform: rotate(-90deg); + transform: rotate(-90deg); + } + 90% { + -moz-transform: rotate(-90deg); + transform: rotate(-90deg); + } + 93% { + -moz-transform: rotate(0deg); + transform: rotate(0deg); + } +} +@-webkit-keyframes atebits-loader { + 0% { + -webkit-transform: rotate(0deg); + transform: rotate(0deg); + } + 3% { + -webkit-transform: rotate(90deg); + transform: rotate(90deg); + } + 10% { + -webkit-transform: rotate(90deg); + transform: rotate(90deg); + } + 13% { + -webkit-transform: rotate(180deg); + transform: rotate(180deg); + } + 20% { + -webkit-transform: rotate(180deg); + transform: rotate(180deg); + } + 23% { + -webkit-transform: rotate(90deg); + transform: rotate(90deg); + } + 30% { + -webkit-transform: rotate(90deg); + transform: rotate(90deg); + } + 33% { + -webkit-transform: rotate(180deg); + transform: rotate(180deg); + } + 40% { + -webkit-transform: rotate(180deg); + transform: rotate(180deg); + } + 43% { + -webkit-transform: rotate(270deg); + transform: rotate(270deg); + } + 50% { + -webkit-transform: rotate(270deg); + transform: rotate(270deg); + } + 53% { + -webkit-transform: rotate(180deg); + transform: rotate(180deg); + } + 60% { + -webkit-transform: rotate(180deg); + transform: rotate(180deg); + } + 63% { + -webkit-transform: rotate(90deg); + transform: rotate(90deg); + } + 70% { + -webkit-transform: rotate(90deg); + transform: rotate(90deg); + } + 73% { + -webkit-transform: rotate(0deg); + transform: rotate(0deg); + } + 80% { + -webkit-transform: rotate(0deg); + transform: rotate(0deg); + } + 83% { + -webkit-transform: rotate(-90deg); + transform: rotate(-90deg); + } + 90% { + -webkit-transform: rotate(-90deg); + transform: rotate(-90deg); + } + 93% { + -webkit-transform: rotate(0deg); + transform: rotate(0deg); + } +} +@keyframes atebits-loader { + 0% { + -moz-transform: rotate(0deg); + -ms-transform: rotate(0deg); + -webkit-transform: rotate(0deg); + transform: rotate(0deg); + } + 3% { + -moz-transform: rotate(90deg); + -ms-transform: rotate(90deg); + -webkit-transform: rotate(90deg); + transform: rotate(90deg); + } + 10% { + -moz-transform: rotate(90deg); + -ms-transform: rotate(90deg); + -webkit-transform: rotate(90deg); + transform: rotate(90deg); + } + 13% { + -moz-transform: rotate(180deg); + -ms-transform: rotate(180deg); + -webkit-transform: rotate(180deg); + transform: rotate(180deg); + } + 20% { + -moz-transform: rotate(180deg); + -ms-transform: rotate(180deg); + -webkit-transform: rotate(180deg); + transform: rotate(180deg); + } + 23% { + -moz-transform: rotate(90deg); + -ms-transform: rotate(90deg); + -webkit-transform: rotate(90deg); + transform: rotate(90deg); + } + 30% { + -moz-transform: rotate(90deg); + -ms-transform: rotate(90deg); + -webkit-transform: rotate(90deg); + transform: rotate(90deg); + } + 33% { + -moz-transform: rotate(180deg); + -ms-transform: rotate(180deg); + -webkit-transform: rotate(180deg); + transform: rotate(180deg); + } + 40% { + -moz-transform: rotate(180deg); + -ms-transform: rotate(180deg); + -webkit-transform: rotate(180deg); + transform: rotate(180deg); + } + 43% { + -moz-transform: rotate(270deg); + -ms-transform: rotate(270deg); + -webkit-transform: rotate(270deg); + transform: rotate(270deg); + } + 50% { + -moz-transform: rotate(270deg); + -ms-transform: rotate(270deg); + -webkit-transform: rotate(270deg); + transform: rotate(270deg); + } + 53% { + -moz-transform: rotate(180deg); + -ms-transform: rotate(180deg); + -webkit-transform: rotate(180deg); + transform: rotate(180deg); + } + 60% { + -moz-transform: rotate(180deg); + -ms-transform: rotate(180deg); + -webkit-transform: rotate(180deg); + transform: rotate(180deg); + } + 63% { + -moz-transform: rotate(90deg); + -ms-transform: rotate(90deg); + -webkit-transform: rotate(90deg); + transform: rotate(90deg); + } + 70% { + -moz-transform: rotate(90deg); + -ms-transform: rotate(90deg); + -webkit-transform: rotate(90deg); + transform: rotate(90deg); + } + 73% { + -moz-transform: rotate(0deg); + -ms-transform: rotate(0deg); + -webkit-transform: rotate(0deg); + transform: rotate(0deg); + } + 80% { + -moz-transform: rotate(0deg); + -ms-transform: rotate(0deg); + -webkit-transform: rotate(0deg); + transform: rotate(0deg); + } + 83% { + -moz-transform: rotate(-90deg); + -ms-transform: rotate(-90deg); + -webkit-transform: rotate(-90deg); + transform: rotate(-90deg); + } + 90% { + -moz-transform: rotate(-90deg); + -ms-transform: rotate(-90deg); + -webkit-transform: rotate(-90deg); + transform: rotate(-90deg); + } + 93% { + -moz-transform: rotate(0deg); + -ms-transform: rotate(0deg); + -webkit-transform: rotate(0deg); + transform: rotate(0deg); + } +} +/* :not(:required) hides this rule from IE9 and below */ +.atebits-loader:not(:required) { + background: rgba(0, 0, 0, 0.5); + display: inline-block; + width: 9px; + height: 9px; + overflow: hidden; + position: relative; + text-indent: -9999px; + -moz-box-shadow: rgba(0, 0, 0, 0.5) -12px -12px 0 0, rgba(0, 0, 0, 0.5) 12px -12px 0 0, rgba(0, 0, 0, 0.5) -12px 0 0 0, rgba(0, 0, 0, 0.5) 12px 0 0 0, rgba(0, 0, 0, 0.5) -12px 12px 0 0, rgba(0, 0, 0, 0.5) 0 12px 0 0, rgba(0, 0, 0, 0.5) 12px 12px 0 0; + -webkit-box-shadow: rgba(0, 0, 0, 0.5) -12px -12px 0 0, rgba(0, 0, 0, 0.5) 12px -12px 0 0, rgba(0, 0, 0, 0.5) -12px 0 0 0, rgba(0, 0, 0, 0.5) 12px 0 0 0, rgba(0, 0, 0, 0.5) -12px 12px 0 0, rgba(0, 0, 0, 0.5) 0 12px 0 0, rgba(0, 0, 0, 0.5) 12px 12px 0 0; + box-shadow: rgba(0, 0, 0, 0.5) -12px -12px 0 0, rgba(0, 0, 0, 0.5) 12px -12px 0 0, rgba(0, 0, 0, 0.5) -12px 0 0 0, rgba(0, 0, 0, 0.5) 12px 0 0 0, rgba(0, 0, 0, 0.5) -12px 12px 0 0, rgba(0, 0, 0, 0.5) 0 12px 0 0, rgba(0, 0, 0, 0.5) 12px 12px 0 0; + -moz-animation: atebits-loader 8s infinite ease-in-out; + -webkit-animation: atebits-loader 8s infinite ease-in-out; + animation: atebits-loader 8s infinite ease-in-out; + -moz-transform-origin: 50% 50%; + -ms-transform-origin: 50% 50%; + -webkit-transform-origin: 50% 50%; + transform-origin: 50% 50%; +} diff --git a/public/bower_components/css-spinners/ball.css b/public/bower_components/css-spinners/ball.css new file mode 100644 index 0000000..bf59e60 --- /dev/null +++ b/public/bower_components/css-spinners/ball.css @@ -0,0 +1,373 @@ +@-moz-keyframes ball-loader { + 0% { + -moz-transform: translate3d(0, 0, 0) scale3d(1, 1, 1); + transform: translate3d(0, 0, 0) scale3d(1, 1, 1); + -moz-animation-timing-function: ease-in; + animation-timing-function: ease-in; + } + 45% { + -moz-transform: translate3d(0, 150px, -10px) scale3d(1, 0.95, 1); + transform: translate3d(0, 150px, -10px) scale3d(1, 0.95, 1); + -moz-animation-timing-function: ease-in; + animation-timing-function: ease-in; + } + 50% { + -moz-transform: translate3d(0, 150px, -10px) scale3d(1, 0.5, 1); + transform: translate3d(0, 150px, -10px) scale3d(1, 0.5, 1); + -moz-animation-timing-function: linear; + animation-timing-function: linear; + } + 55% { + -moz-transform: translate3d(0, 150px, -10px) scale3d(1, 1.25, 1); + transform: translate3d(0, 150px, -10px) scale3d(1, 1.25, 1); + -moz-animation-timing-function: ease-out; + animation-timing-function: ease-out; + } +} +@-webkit-keyframes ball-loader { + 0% { + -webkit-transform: translate3d(0, 0, 0) scale3d(1, 1, 1); + transform: translate3d(0, 0, 0) scale3d(1, 1, 1); + -webkit-animation-timing-function: ease-in; + animation-timing-function: ease-in; + } + 45% { + -webkit-transform: translate3d(0, 150px, -10px) scale3d(1, 0.95, 1); + transform: translate3d(0, 150px, -10px) scale3d(1, 0.95, 1); + -webkit-animation-timing-function: ease-in; + animation-timing-function: ease-in; + } + 50% { + -webkit-transform: translate3d(0, 150px, -10px) scale3d(1, 0.5, 1); + transform: translate3d(0, 150px, -10px) scale3d(1, 0.5, 1); + -webkit-animation-timing-function: linear; + animation-timing-function: linear; + } + 55% { + -webkit-transform: translate3d(0, 150px, -10px) scale3d(1, 1.25, 1); + transform: translate3d(0, 150px, -10px) scale3d(1, 1.25, 1); + -webkit-animation-timing-function: ease-out; + animation-timing-function: ease-out; + } +} +@keyframes ball-loader { + 0% { + -moz-transform: translate3d(0, 0, 0) scale3d(1, 1, 1); + -ms-transform: translate3d(0, 0, 0) scale3d(1, 1, 1); + -webkit-transform: translate3d(0, 0, 0) scale3d(1, 1, 1); + transform: translate3d(0, 0, 0) scale3d(1, 1, 1); + -moz-animation-timing-function: ease-in; + -webkit-animation-timing-function: ease-in; + animation-timing-function: ease-in; + } + 45% { + -moz-transform: translate3d(0, 150px, -10px) scale3d(1, 0.95, 1); + -ms-transform: translate3d(0, 150px, -10px) scale3d(1, 0.95, 1); + -webkit-transform: translate3d(0, 150px, -10px) scale3d(1, 0.95, 1); + transform: translate3d(0, 150px, -10px) scale3d(1, 0.95, 1); + -moz-animation-timing-function: ease-in; + -webkit-animation-timing-function: ease-in; + animation-timing-function: ease-in; + } + 50% { + -moz-transform: translate3d(0, 150px, -10px) scale3d(1, 0.5, 1); + -ms-transform: translate3d(0, 150px, -10px) scale3d(1, 0.5, 1); + -webkit-transform: translate3d(0, 150px, -10px) scale3d(1, 0.5, 1); + transform: translate3d(0, 150px, -10px) scale3d(1, 0.5, 1); + -moz-animation-timing-function: linear; + -webkit-animation-timing-function: linear; + animation-timing-function: linear; + } + 55% { + -moz-transform: translate3d(0, 150px, -10px) scale3d(1, 1.25, 1); + -ms-transform: translate3d(0, 150px, -10px) scale3d(1, 1.25, 1); + -webkit-transform: translate3d(0, 150px, -10px) scale3d(1, 1.25, 1); + transform: translate3d(0, 150px, -10px) scale3d(1, 1.25, 1); + -moz-animation-timing-function: ease-out; + -webkit-animation-timing-function: ease-out; + animation-timing-function: ease-out; + } +} +@-moz-keyframes ball-loader-highlight { + 0% { + -moz-transform: skew(-20deg, 0) translate3d(0, 2.5px, 1px); + transform: skew(-20deg, 0) translate3d(0, 2.5px, 1px); + -moz-animation-timing-function: ease-in; + animation-timing-function: ease-in; + } + 45% { + -moz-transform: skew(-30deg, 0) translate3d(0, 0, 1px); + transform: skew(-30deg, 0) translate3d(0, 0, 1px); + -moz-animation-timing-function: ease-in; + animation-timing-function: ease-in; + } + 50% { + -moz-transform: skew(-30deg, 0) translate3d(0, 0, 1px); + transform: skew(-30deg, 0) translate3d(0, 0, 1px); + -moz-animation-timing-function: linear; + animation-timing-function: linear; + } + 55% { + -moz-transform: skew(-30deg, 0) translate3d(0, 0, 1px); + transform: skew(-30deg, 0) translate3d(0, 0, 1px); + -moz-animation-timing-function: ease-out; + animation-timing-function: ease-out; + } + 100% { + -moz-transform: skew(-20deg, 0) translate3d(0, 2.5px, 1px); + transform: skew(-20deg, 0) translate3d(0, 2.5px, 1px); + -moz-animation-timing-function: ease-in; + animation-timing-function: ease-in; + } +} +@-webkit-keyframes ball-loader-highlight { + 0% { + -webkit-transform: skew(-20deg, 0) translate3d(0, 2.5px, 1px); + transform: skew(-20deg, 0) translate3d(0, 2.5px, 1px); + -webkit-animation-timing-function: ease-in; + animation-timing-function: ease-in; + } + 45% { + -webkit-transform: skew(-30deg, 0) translate3d(0, 0, 1px); + transform: skew(-30deg, 0) translate3d(0, 0, 1px); + -webkit-animation-timing-function: ease-in; + animation-timing-function: ease-in; + } + 50% { + -webkit-transform: skew(-30deg, 0) translate3d(0, 0, 1px); + transform: skew(-30deg, 0) translate3d(0, 0, 1px); + -webkit-animation-timing-function: linear; + animation-timing-function: linear; + } + 55% { + -webkit-transform: skew(-30deg, 0) translate3d(0, 0, 1px); + transform: skew(-30deg, 0) translate3d(0, 0, 1px); + -webkit-animation-timing-function: ease-out; + animation-timing-function: ease-out; + } + 100% { + -webkit-transform: skew(-20deg, 0) translate3d(0, 2.5px, 1px); + transform: skew(-20deg, 0) translate3d(0, 2.5px, 1px); + -webkit-animation-timing-function: ease-in; + animation-timing-function: ease-in; + } +} +@keyframes ball-loader-highlight { + 0% { + -moz-transform: skew(-20deg, 0) translate3d(0, 2.5px, 1px); + -ms-transform: skew(-20deg, 0) translate3d(0, 2.5px, 1px); + -webkit-transform: skew(-20deg, 0) translate3d(0, 2.5px, 1px); + transform: skew(-20deg, 0) translate3d(0, 2.5px, 1px); + -moz-animation-timing-function: ease-in; + -webkit-animation-timing-function: ease-in; + animation-timing-function: ease-in; + } + 45% { + -moz-transform: skew(-30deg, 0) translate3d(0, 0, 1px); + -ms-transform: skew(-30deg, 0) translate3d(0, 0, 1px); + -webkit-transform: skew(-30deg, 0) translate3d(0, 0, 1px); + transform: skew(-30deg, 0) translate3d(0, 0, 1px); + -moz-animation-timing-function: ease-in; + -webkit-animation-timing-function: ease-in; + animation-timing-function: ease-in; + } + 50% { + -moz-transform: skew(-30deg, 0) translate3d(0, 0, 1px); + -ms-transform: skew(-30deg, 0) translate3d(0, 0, 1px); + -webkit-transform: skew(-30deg, 0) translate3d(0, 0, 1px); + transform: skew(-30deg, 0) translate3d(0, 0, 1px); + -moz-animation-timing-function: linear; + -webkit-animation-timing-function: linear; + animation-timing-function: linear; + } + 55% { + -moz-transform: skew(-30deg, 0) translate3d(0, 0, 1px); + -ms-transform: skew(-30deg, 0) translate3d(0, 0, 1px); + -webkit-transform: skew(-30deg, 0) translate3d(0, 0, 1px); + transform: skew(-30deg, 0) translate3d(0, 0, 1px); + -moz-animation-timing-function: ease-out; + -webkit-animation-timing-function: ease-out; + animation-timing-function: ease-out; + } + 100% { + -moz-transform: skew(-20deg, 0) translate3d(0, 2.5px, 1px); + -ms-transform: skew(-20deg, 0) translate3d(0, 2.5px, 1px); + -webkit-transform: skew(-20deg, 0) translate3d(0, 2.5px, 1px); + transform: skew(-20deg, 0) translate3d(0, 2.5px, 1px); + -moz-animation-timing-function: ease-in; + -webkit-animation-timing-function: ease-in; + animation-timing-function: ease-in; + } +} +@-moz-keyframes ball-loader-shadow { + 0% { + -moz-transform: translate3d(66.66667px, 66.66667px, -1px) scale3d(1.25, 1.25, 1); + transform: translate3d(66.66667px, 66.66667px, -1px) scale3d(1.25, 1.25, 1); + -moz-animation-timing-function: ease-in; + animation-timing-function: ease-in; + } + 45% { + -moz-transform: translate3d(12.5px, -15px, -1px); + transform: translate3d(12.5px, -15px, -1px); + -moz-animation-timing-function: ease-in; + animation-timing-function: ease-in; + } + 50% { + -moz-transform: translate3d(12.5px, -15px, -1px) scale3d(1, 1, 1); + transform: translate3d(12.5px, -15px, -1px) scale3d(1, 1, 1); + -moz-animation-timing-function: linear; + animation-timing-function: linear; + } + 55% { + -moz-transform: translate3d(12.5px, -15px, -1px); + transform: translate3d(12.5px, -15px, -1px); + -moz-animation-timing-function: ease-out; + animation-timing-function: ease-out; + } + 100% { + -moz-transform: translate3d(66.66667px, 66.66667px, -1px) scale3d(1.25, 1.25, 1); + transform: translate3d(66.66667px, 66.66667px, -1px) scale3d(1.25, 1.25, 1); + -moz-animation-timing-function: ease-in; + animation-timing-function: ease-in; + } +} +@-webkit-keyframes ball-loader-shadow { + 0% { + -webkit-transform: translate3d(66.66667px, 66.66667px, -1px) scale3d(1.25, 1.25, 1); + transform: translate3d(66.66667px, 66.66667px, -1px) scale3d(1.25, 1.25, 1); + -webkit-animation-timing-function: ease-in; + animation-timing-function: ease-in; + } + 45% { + -webkit-transform: translate3d(12.5px, -15px, -1px); + transform: translate3d(12.5px, -15px, -1px); + -webkit-animation-timing-function: ease-in; + animation-timing-function: ease-in; + } + 50% { + -webkit-transform: translate3d(12.5px, -15px, -1px) scale3d(1, 1, 1); + transform: translate3d(12.5px, -15px, -1px) scale3d(1, 1, 1); + -webkit-animation-timing-function: linear; + animation-timing-function: linear; + } + 55% { + -webkit-transform: translate3d(12.5px, -15px, -1px); + transform: translate3d(12.5px, -15px, -1px); + -webkit-animation-timing-function: ease-out; + animation-timing-function: ease-out; + } + 100% { + -webkit-transform: translate3d(66.66667px, 66.66667px, -1px) scale3d(1.25, 1.25, 1); + transform: translate3d(66.66667px, 66.66667px, -1px) scale3d(1.25, 1.25, 1); + -webkit-animation-timing-function: ease-in; + animation-timing-function: ease-in; + } +} +@keyframes ball-loader-shadow { + 0% { + -moz-transform: translate3d(66.66667px, 66.66667px, -1px) scale3d(1.25, 1.25, 1); + -ms-transform: translate3d(66.66667px, 66.66667px, -1px) scale3d(1.25, 1.25, 1); + -webkit-transform: translate3d(66.66667px, 66.66667px, -1px) scale3d(1.25, 1.25, 1); + transform: translate3d(66.66667px, 66.66667px, -1px) scale3d(1.25, 1.25, 1); + -moz-animation-timing-function: ease-in; + -webkit-animation-timing-function: ease-in; + animation-timing-function: ease-in; + } + 45% { + -moz-transform: translate3d(12.5px, -15px, -1px); + -ms-transform: translate3d(12.5px, -15px, -1px); + -webkit-transform: translate3d(12.5px, -15px, -1px); + transform: translate3d(12.5px, -15px, -1px); + -moz-animation-timing-function: ease-in; + -webkit-animation-timing-function: ease-in; + animation-timing-function: ease-in; + } + 50% { + -moz-transform: translate3d(12.5px, -15px, -1px) scale3d(1, 1, 1); + -ms-transform: translate3d(12.5px, -15px, -1px) scale3d(1, 1, 1); + -webkit-transform: translate3d(12.5px, -15px, -1px) scale3d(1, 1, 1); + transform: translate3d(12.5px, -15px, -1px) scale3d(1, 1, 1); + -moz-animation-timing-function: linear; + -webkit-animation-timing-function: linear; + animation-timing-function: linear; + } + 55% { + -moz-transform: translate3d(12.5px, -15px, -1px); + -ms-transform: translate3d(12.5px, -15px, -1px); + -webkit-transform: translate3d(12.5px, -15px, -1px); + transform: translate3d(12.5px, -15px, -1px); + -moz-animation-timing-function: ease-out; + -webkit-animation-timing-function: ease-out; + animation-timing-function: ease-out; + } + 100% { + -moz-transform: translate3d(66.66667px, 66.66667px, -1px) scale3d(1.25, 1.25, 1); + -ms-transform: translate3d(66.66667px, 66.66667px, -1px) scale3d(1.25, 1.25, 1); + -webkit-transform: translate3d(66.66667px, 66.66667px, -1px) scale3d(1.25, 1.25, 1); + transform: translate3d(66.66667px, 66.66667px, -1px) scale3d(1.25, 1.25, 1); + -moz-animation-timing-function: ease-in; + -webkit-animation-timing-function: ease-in; + animation-timing-function: ease-in; + } +} +/* :not(:required) hides this rule from IE9 and below */ +.ball-loader:not(:required) { + position: relative; + display: inline-block; + font-size: 0; + letter-spacing: -1px; + border-radius: 100%; + background: #f86; + width: 50px; + height: 50px; + -moz-transform-style: preserve-3d; + -webkit-transform-style: preserve-3d; + transform-style: preserve-3d; + -moz-transform: translate3d(0, 0, 0) scale3d(1, 1, 1); + -ms-transform: translate3d(0, 0, 0) scale3d(1, 1, 1); + -webkit-transform: translate3d(0, 0, 0) scale3d(1, 1, 1); + transform: translate3d(0, 0, 0) scale3d(1, 1, 1); + -moz-transform-origin: 0 100%; + -ms-transform-origin: 0 100%; + -webkit-transform-origin: 0 100%; + transform-origin: 0 100%; + -moz-animation: ball-loader 1500ms infinite linear; + -webkit-animation: ball-loader 1500ms infinite linear; + animation: ball-loader 1500ms infinite linear; +} +.ball-loader:not(:required)::after { + content: ''; + position: absolute; + top: 4.5px; + left: 5.5px; + width: 15px; + height: 15px; + background: #ffb099; + border-radius: 100%; + -moz-transform: skew(-20deg, 0) translate3d(0, 2.5px, 1px); + -ms-transform: skew(-20deg, 0) translate3d(0, 2.5px, 1px); + -webkit-transform: skew(-20deg, 0) translate3d(0, 2.5px, 1px); + transform: skew(-20deg, 0) translate3d(0, 2.5px, 1px); + -moz-animation: ball-loader-highlight 1500ms infinite linear; + -webkit-animation: ball-loader-highlight 1500ms infinite linear; + animation: ball-loader-highlight 1500ms infinite linear; +} +.ball-loader:not(:required)::before { + content: ''; + position: absolute; + top: 50px; + left: 5.5px; + width: 50px; + height: 15px; + background: rgba(0, 0, 0, 0.2); + border-radius: 100%; + -moz-transform: translate3d(66.66667px, 66.66667px, -1px) scale3d(1.25, 1.25, 1); + -ms-transform: translate3d(66.66667px, 66.66667px, -1px) scale3d(1.25, 1.25, 1); + -webkit-transform: translate3d(66.66667px, 66.66667px, -1px) scale3d(1.25, 1.25, 1); + transform: translate3d(66.66667px, 66.66667px, -1px) scale3d(1.25, 1.25, 1); + -moz-animation: ball-loader-shadow 1500ms infinite linear; + -webkit-animation: ball-loader-shadow 1500ms infinite linear; + animation: ball-loader-shadow 1500ms infinite linear; + -webkit-filter: blur(1px); + filter: blur(1px); +} diff --git a/public/bower_components/css-spinners/circles.css b/public/bower_components/css-spinners/circles.css new file mode 100644 index 0000000..f292d19 --- /dev/null +++ b/public/bower_components/css-spinners/circles.css @@ -0,0 +1,71 @@ +@-moz-keyframes circles-loader { + 0% { + -moz-transform: rotate(-720deg); + transform: rotate(-720deg); + } + 50% { + -moz-transform: rotate(720deg); + transform: rotate(720deg); + } +} +@-webkit-keyframes circles-loader { + 0% { + -webkit-transform: rotate(-720deg); + transform: rotate(-720deg); + } + 50% { + -webkit-transform: rotate(720deg); + transform: rotate(720deg); + } +} +@keyframes circles-loader { + 0% { + -moz-transform: rotate(-720deg); + -ms-transform: rotate(-720deg); + -webkit-transform: rotate(-720deg); + transform: rotate(-720deg); + } + 50% { + -moz-transform: rotate(720deg); + -ms-transform: rotate(720deg); + -webkit-transform: rotate(720deg); + transform: rotate(720deg); + } +} +/* :not(:required) hides this rule from IE9 and below */ +.circles-loader:not(:required) { + position: relative; + text-indent: -9999px; + display: inline-block; + width: 25px; + height: 25px; + background: rgba(255, 204, 51, 0.9); + border-radius: 100%; + -moz-animation: circles-loader 3s infinite ease-in-out; + -webkit-animation: circles-loader 3s infinite ease-in-out; + animation: circles-loader 3s infinite ease-in-out; + -moz-transform-origin: 50% 100%; + -ms-transform-origin: 50% 100%; + -webkit-transform-origin: 50% 100%; + transform-origin: 50% 100%; +} +.circles-loader:not(:required)::before { + background: rgba(255, 102, 0, 0.6); + border-radius: 100%; + content: ''; + position: absolute; + width: 25px; + height: 25px; + top: 18.75px; + left: -10.82532px; +} +.circles-loader:not(:required)::after { + background: rgba(255, 51, 0, 0.4); + border-radius: 100%; + content: ''; + position: absolute; + width: 25px; + height: 25px; + top: 18.75px; + left: 10.82532px; +} diff --git a/public/bower_components/css-spinners/dots.css b/public/bower_components/css-spinners/dots.css new file mode 100644 index 0000000..fcf10e4 --- /dev/null +++ b/public/bower_components/css-spinners/dots.css @@ -0,0 +1,196 @@ +@-moz-keyframes dots-loader { + 0% { + -moz-box-shadow: #f86 -14px -14px 0 7px, #fc6 14px -14px 0 7px, #6d7 14px 14px 0 7px, #4ae -14px 14px 0 7px; + box-shadow: #f86 -14px -14px 0 7px, #fc6 14px -14px 0 7px, #6d7 14px 14px 0 7px, #4ae -14px 14px 0 7px; + } + 8.33% { + -moz-box-shadow: #f86 14px -14px 0 7px, #fc6 14px -14px 0 7px, #6d7 14px 14px 0 7px, #4ae -14px 14px 0 7px; + box-shadow: #f86 14px -14px 0 7px, #fc6 14px -14px 0 7px, #6d7 14px 14px 0 7px, #4ae -14px 14px 0 7px; + } + 16.67% { + -moz-box-shadow: #f86 14px 14px 0 7px, #fc6 14px 14px 0 7px, #6d7 14px 14px 0 7px, #4ae -14px 14px 0 7px; + box-shadow: #f86 14px 14px 0 7px, #fc6 14px 14px 0 7px, #6d7 14px 14px 0 7px, #4ae -14px 14px 0 7px; + } + 25% { + -moz-box-shadow: #f86 -14px 14px 0 7px, #fc6 -14px 14px 0 7px, #6d7 -14px 14px 0 7px, #4ae -14px 14px 0 7px; + box-shadow: #f86 -14px 14px 0 7px, #fc6 -14px 14px 0 7px, #6d7 -14px 14px 0 7px, #4ae -14px 14px 0 7px; + } + 33.33% { + -moz-box-shadow: #f86 -14px -14px 0 7px, #fc6 -14px 14px 0 7px, #6d7 -14px -14px 0 7px, #4ae -14px -14px 0 7px; + box-shadow: #f86 -14px -14px 0 7px, #fc6 -14px 14px 0 7px, #6d7 -14px -14px 0 7px, #4ae -14px -14px 0 7px; + } + 41.67% { + -moz-box-shadow: #f86 14px -14px 0 7px, #fc6 -14px 14px 0 7px, #6d7 -14px -14px 0 7px, #4ae 14px -14px 0 7px; + box-shadow: #f86 14px -14px 0 7px, #fc6 -14px 14px 0 7px, #6d7 -14px -14px 0 7px, #4ae 14px -14px 0 7px; + } + 50% { + -moz-box-shadow: #f86 14px 14px 0 7px, #fc6 -14px 14px 0 7px, #6d7 -14px -14px 0 7px, #4ae 14px -14px 0 7px; + box-shadow: #f86 14px 14px 0 7px, #fc6 -14px 14px 0 7px, #6d7 -14px -14px 0 7px, #4ae 14px -14px 0 7px; + } + 58.33% { + -moz-box-shadow: #f86 -14px 14px 0 7px, #fc6 -14px 14px 0 7px, #6d7 -14px -14px 0 7px, #4ae 14px -14px 0 7px; + box-shadow: #f86 -14px 14px 0 7px, #fc6 -14px 14px 0 7px, #6d7 -14px -14px 0 7px, #4ae 14px -14px 0 7px; + } + 66.67% { + -moz-box-shadow: #f86 -14px -14px 0 7px, #fc6 -14px -14px 0 7px, #6d7 -14px -14px 0 7px, #4ae 14px -14px 0 7px; + box-shadow: #f86 -14px -14px 0 7px, #fc6 -14px -14px 0 7px, #6d7 -14px -14px 0 7px, #4ae 14px -14px 0 7px; + } + 75% { + -moz-box-shadow: #f86 14px -14px 0 7px, #fc6 14px -14px 0 7px, #6d7 14px -14px 0 7px, #4ae 14px -14px 0 7px; + box-shadow: #f86 14px -14px 0 7px, #fc6 14px -14px 0 7px, #6d7 14px -14px 0 7px, #4ae 14px -14px 0 7px; + } + 83.33% { + -moz-box-shadow: #f86 14px 14px 0 7px, #fc6 14px -14px 0 7px, #6d7 14px 14px 0 7px, #4ae 14px 14px 0 7px; + box-shadow: #f86 14px 14px 0 7px, #fc6 14px -14px 0 7px, #6d7 14px 14px 0 7px, #4ae 14px 14px 0 7px; + } + 91.67% { + -moz-box-shadow: #f86 -14px 14px 0 7px, #fc6 14px -14px 0 7px, #6d7 14px 14px 0 7px, #4ae -14px 14px 0 7px; + box-shadow: #f86 -14px 14px 0 7px, #fc6 14px -14px 0 7px, #6d7 14px 14px 0 7px, #4ae -14px 14px 0 7px; + } + 100% { + -moz-box-shadow: #f86 -14px -14px 0 7px, #fc6 14px -14px 0 7px, #6d7 14px 14px 0 7px, #4ae -14px 14px 0 7px; + box-shadow: #f86 -14px -14px 0 7px, #fc6 14px -14px 0 7px, #6d7 14px 14px 0 7px, #4ae -14px 14px 0 7px; + } +} +@-webkit-keyframes dots-loader { + 0% { + -webkit-box-shadow: #f86 -14px -14px 0 7px, #fc6 14px -14px 0 7px, #6d7 14px 14px 0 7px, #4ae -14px 14px 0 7px; + box-shadow: #f86 -14px -14px 0 7px, #fc6 14px -14px 0 7px, #6d7 14px 14px 0 7px, #4ae -14px 14px 0 7px; + } + 8.33% { + -webkit-box-shadow: #f86 14px -14px 0 7px, #fc6 14px -14px 0 7px, #6d7 14px 14px 0 7px, #4ae -14px 14px 0 7px; + box-shadow: #f86 14px -14px 0 7px, #fc6 14px -14px 0 7px, #6d7 14px 14px 0 7px, #4ae -14px 14px 0 7px; + } + 16.67% { + -webkit-box-shadow: #f86 14px 14px 0 7px, #fc6 14px 14px 0 7px, #6d7 14px 14px 0 7px, #4ae -14px 14px 0 7px; + box-shadow: #f86 14px 14px 0 7px, #fc6 14px 14px 0 7px, #6d7 14px 14px 0 7px, #4ae -14px 14px 0 7px; + } + 25% { + -webkit-box-shadow: #f86 -14px 14px 0 7px, #fc6 -14px 14px 0 7px, #6d7 -14px 14px 0 7px, #4ae -14px 14px 0 7px; + box-shadow: #f86 -14px 14px 0 7px, #fc6 -14px 14px 0 7px, #6d7 -14px 14px 0 7px, #4ae -14px 14px 0 7px; + } + 33.33% { + -webkit-box-shadow: #f86 -14px -14px 0 7px, #fc6 -14px 14px 0 7px, #6d7 -14px -14px 0 7px, #4ae -14px -14px 0 7px; + box-shadow: #f86 -14px -14px 0 7px, #fc6 -14px 14px 0 7px, #6d7 -14px -14px 0 7px, #4ae -14px -14px 0 7px; + } + 41.67% { + -webkit-box-shadow: #f86 14px -14px 0 7px, #fc6 -14px 14px 0 7px, #6d7 -14px -14px 0 7px, #4ae 14px -14px 0 7px; + box-shadow: #f86 14px -14px 0 7px, #fc6 -14px 14px 0 7px, #6d7 -14px -14px 0 7px, #4ae 14px -14px 0 7px; + } + 50% { + -webkit-box-shadow: #f86 14px 14px 0 7px, #fc6 -14px 14px 0 7px, #6d7 -14px -14px 0 7px, #4ae 14px -14px 0 7px; + box-shadow: #f86 14px 14px 0 7px, #fc6 -14px 14px 0 7px, #6d7 -14px -14px 0 7px, #4ae 14px -14px 0 7px; + } + 58.33% { + -webkit-box-shadow: #f86 -14px 14px 0 7px, #fc6 -14px 14px 0 7px, #6d7 -14px -14px 0 7px, #4ae 14px -14px 0 7px; + box-shadow: #f86 -14px 14px 0 7px, #fc6 -14px 14px 0 7px, #6d7 -14px -14px 0 7px, #4ae 14px -14px 0 7px; + } + 66.67% { + -webkit-box-shadow: #f86 -14px -14px 0 7px, #fc6 -14px -14px 0 7px, #6d7 -14px -14px 0 7px, #4ae 14px -14px 0 7px; + box-shadow: #f86 -14px -14px 0 7px, #fc6 -14px -14px 0 7px, #6d7 -14px -14px 0 7px, #4ae 14px -14px 0 7px; + } + 75% { + -webkit-box-shadow: #f86 14px -14px 0 7px, #fc6 14px -14px 0 7px, #6d7 14px -14px 0 7px, #4ae 14px -14px 0 7px; + box-shadow: #f86 14px -14px 0 7px, #fc6 14px -14px 0 7px, #6d7 14px -14px 0 7px, #4ae 14px -14px 0 7px; + } + 83.33% { + -webkit-box-shadow: #f86 14px 14px 0 7px, #fc6 14px -14px 0 7px, #6d7 14px 14px 0 7px, #4ae 14px 14px 0 7px; + box-shadow: #f86 14px 14px 0 7px, #fc6 14px -14px 0 7px, #6d7 14px 14px 0 7px, #4ae 14px 14px 0 7px; + } + 91.67% { + -webkit-box-shadow: #f86 -14px 14px 0 7px, #fc6 14px -14px 0 7px, #6d7 14px 14px 0 7px, #4ae -14px 14px 0 7px; + box-shadow: #f86 -14px 14px 0 7px, #fc6 14px -14px 0 7px, #6d7 14px 14px 0 7px, #4ae -14px 14px 0 7px; + } + 100% { + -webkit-box-shadow: #f86 -14px -14px 0 7px, #fc6 14px -14px 0 7px, #6d7 14px 14px 0 7px, #4ae -14px 14px 0 7px; + box-shadow: #f86 -14px -14px 0 7px, #fc6 14px -14px 0 7px, #6d7 14px 14px 0 7px, #4ae -14px 14px 0 7px; + } +} +@keyframes dots-loader { + 0% { + -moz-box-shadow: #f86 -14px -14px 0 7px, #fc6 14px -14px 0 7px, #6d7 14px 14px 0 7px, #4ae -14px 14px 0 7px; + -webkit-box-shadow: #f86 -14px -14px 0 7px, #fc6 14px -14px 0 7px, #6d7 14px 14px 0 7px, #4ae -14px 14px 0 7px; + box-shadow: #f86 -14px -14px 0 7px, #fc6 14px -14px 0 7px, #6d7 14px 14px 0 7px, #4ae -14px 14px 0 7px; + } + 8.33% { + -moz-box-shadow: #f86 14px -14px 0 7px, #fc6 14px -14px 0 7px, #6d7 14px 14px 0 7px, #4ae -14px 14px 0 7px; + -webkit-box-shadow: #f86 14px -14px 0 7px, #fc6 14px -14px 0 7px, #6d7 14px 14px 0 7px, #4ae -14px 14px 0 7px; + box-shadow: #f86 14px -14px 0 7px, #fc6 14px -14px 0 7px, #6d7 14px 14px 0 7px, #4ae -14px 14px 0 7px; + } + 16.67% { + -moz-box-shadow: #f86 14px 14px 0 7px, #fc6 14px 14px 0 7px, #6d7 14px 14px 0 7px, #4ae -14px 14px 0 7px; + -webkit-box-shadow: #f86 14px 14px 0 7px, #fc6 14px 14px 0 7px, #6d7 14px 14px 0 7px, #4ae -14px 14px 0 7px; + box-shadow: #f86 14px 14px 0 7px, #fc6 14px 14px 0 7px, #6d7 14px 14px 0 7px, #4ae -14px 14px 0 7px; + } + 25% { + -moz-box-shadow: #f86 -14px 14px 0 7px, #fc6 -14px 14px 0 7px, #6d7 -14px 14px 0 7px, #4ae -14px 14px 0 7px; + -webkit-box-shadow: #f86 -14px 14px 0 7px, #fc6 -14px 14px 0 7px, #6d7 -14px 14px 0 7px, #4ae -14px 14px 0 7px; + box-shadow: #f86 -14px 14px 0 7px, #fc6 -14px 14px 0 7px, #6d7 -14px 14px 0 7px, #4ae -14px 14px 0 7px; + } + 33.33% { + -moz-box-shadow: #f86 -14px -14px 0 7px, #fc6 -14px 14px 0 7px, #6d7 -14px -14px 0 7px, #4ae -14px -14px 0 7px; + -webkit-box-shadow: #f86 -14px -14px 0 7px, #fc6 -14px 14px 0 7px, #6d7 -14px -14px 0 7px, #4ae -14px -14px 0 7px; + box-shadow: #f86 -14px -14px 0 7px, #fc6 -14px 14px 0 7px, #6d7 -14px -14px 0 7px, #4ae -14px -14px 0 7px; + } + 41.67% { + -moz-box-shadow: #f86 14px -14px 0 7px, #fc6 -14px 14px 0 7px, #6d7 -14px -14px 0 7px, #4ae 14px -14px 0 7px; + -webkit-box-shadow: #f86 14px -14px 0 7px, #fc6 -14px 14px 0 7px, #6d7 -14px -14px 0 7px, #4ae 14px -14px 0 7px; + box-shadow: #f86 14px -14px 0 7px, #fc6 -14px 14px 0 7px, #6d7 -14px -14px 0 7px, #4ae 14px -14px 0 7px; + } + 50% { + -moz-box-shadow: #f86 14px 14px 0 7px, #fc6 -14px 14px 0 7px, #6d7 -14px -14px 0 7px, #4ae 14px -14px 0 7px; + -webkit-box-shadow: #f86 14px 14px 0 7px, #fc6 -14px 14px 0 7px, #6d7 -14px -14px 0 7px, #4ae 14px -14px 0 7px; + box-shadow: #f86 14px 14px 0 7px, #fc6 -14px 14px 0 7px, #6d7 -14px -14px 0 7px, #4ae 14px -14px 0 7px; + } + 58.33% { + -moz-box-shadow: #f86 -14px 14px 0 7px, #fc6 -14px 14px 0 7px, #6d7 -14px -14px 0 7px, #4ae 14px -14px 0 7px; + -webkit-box-shadow: #f86 -14px 14px 0 7px, #fc6 -14px 14px 0 7px, #6d7 -14px -14px 0 7px, #4ae 14px -14px 0 7px; + box-shadow: #f86 -14px 14px 0 7px, #fc6 -14px 14px 0 7px, #6d7 -14px -14px 0 7px, #4ae 14px -14px 0 7px; + } + 66.67% { + -moz-box-shadow: #f86 -14px -14px 0 7px, #fc6 -14px -14px 0 7px, #6d7 -14px -14px 0 7px, #4ae 14px -14px 0 7px; + -webkit-box-shadow: #f86 -14px -14px 0 7px, #fc6 -14px -14px 0 7px, #6d7 -14px -14px 0 7px, #4ae 14px -14px 0 7px; + box-shadow: #f86 -14px -14px 0 7px, #fc6 -14px -14px 0 7px, #6d7 -14px -14px 0 7px, #4ae 14px -14px 0 7px; + } + 75% { + -moz-box-shadow: #f86 14px -14px 0 7px, #fc6 14px -14px 0 7px, #6d7 14px -14px 0 7px, #4ae 14px -14px 0 7px; + -webkit-box-shadow: #f86 14px -14px 0 7px, #fc6 14px -14px 0 7px, #6d7 14px -14px 0 7px, #4ae 14px -14px 0 7px; + box-shadow: #f86 14px -14px 0 7px, #fc6 14px -14px 0 7px, #6d7 14px -14px 0 7px, #4ae 14px -14px 0 7px; + } + 83.33% { + -moz-box-shadow: #f86 14px 14px 0 7px, #fc6 14px -14px 0 7px, #6d7 14px 14px 0 7px, #4ae 14px 14px 0 7px; + -webkit-box-shadow: #f86 14px 14px 0 7px, #fc6 14px -14px 0 7px, #6d7 14px 14px 0 7px, #4ae 14px 14px 0 7px; + box-shadow: #f86 14px 14px 0 7px, #fc6 14px -14px 0 7px, #6d7 14px 14px 0 7px, #4ae 14px 14px 0 7px; + } + 91.67% { + -moz-box-shadow: #f86 -14px 14px 0 7px, #fc6 14px -14px 0 7px, #6d7 14px 14px 0 7px, #4ae -14px 14px 0 7px; + -webkit-box-shadow: #f86 -14px 14px 0 7px, #fc6 14px -14px 0 7px, #6d7 14px 14px 0 7px, #4ae -14px 14px 0 7px; + box-shadow: #f86 -14px 14px 0 7px, #fc6 14px -14px 0 7px, #6d7 14px 14px 0 7px, #4ae -14px 14px 0 7px; + } + 100% { + -moz-box-shadow: #f86 -14px -14px 0 7px, #fc6 14px -14px 0 7px, #6d7 14px 14px 0 7px, #4ae -14px 14px 0 7px; + -webkit-box-shadow: #f86 -14px -14px 0 7px, #fc6 14px -14px 0 7px, #6d7 14px 14px 0 7px, #4ae -14px 14px 0 7px; + box-shadow: #f86 -14px -14px 0 7px, #fc6 14px -14px 0 7px, #6d7 14px 14px 0 7px, #4ae -14px 14px 0 7px; + } +} +/* :not(:required) hides this rule from IE9 and below */ +.dots-loader:not(:required) { + overflow: hidden; + position: relative; + text-indent: -9999px; + display: inline-block; + width: 7px; + height: 7px; + background: transparent; + border-radius: 100%; + -moz-box-shadow: #f86 -14px -14px 0 7px, #fc6 14px -14px 0 7px, #6d7 14px 14px 0 7px, #4ae -14px 14px 0 7px; + -webkit-box-shadow: #f86 -14px -14px 0 7px, #fc6 14px -14px 0 7px, #6d7 14px 14px 0 7px, #4ae -14px 14px 0 7px; + box-shadow: #f86 -14px -14px 0 7px, #fc6 14px -14px 0 7px, #6d7 14px 14px 0 7px, #4ae -14px 14px 0 7px; + -moz-animation: dots-loader 5s infinite ease-in-out; + -webkit-animation: dots-loader 5s infinite ease-in-out; + animation: dots-loader 5s infinite ease-in-out; + -moz-transform-origin: 50% 50%; + -ms-transform-origin: 50% 50%; + -webkit-transform-origin: 50% 50%; + transform-origin: 50% 50%; +} diff --git a/public/bower_components/css-spinners/flower.css b/public/bower_components/css-spinners/flower.css new file mode 100644 index 0000000..433849e --- /dev/null +++ b/public/bower_components/css-spinners/flower.css @@ -0,0 +1,69 @@ +@-moz-keyframes flower-loader { + 0% { + -moz-transform: rotate(0deg); + transform: rotate(0deg); + -moz-box-shadow: white 0 0 15px 0, #fd8 -12px -12px 0 4px, #fd8 12px -12px 0 4px, #fd8 12px 12px 0 4px, #fd8 -12px 12px 0 4px; + box-shadow: white 0 0 15px 0, #fd8 -12px -12px 0 4px, #fd8 12px -12px 0 4px, #fd8 12px 12px 0 4px, #fd8 -12px 12px 0 4px; + } + 50% { + -moz-transform: rotate(1080deg); + transform: rotate(1080deg); + -moz-box-shadow: white 0 0 15px 0, #fd8 12px 12px 0 4px, #fd8 -12px 12px 0 4px, #fd8 -12px -12px 0 4px, #fd8 12px -12px 0 4px; + box-shadow: white 0 0 15px 0, #fd8 12px 12px 0 4px, #fd8 -12px 12px 0 4px, #fd8 -12px -12px 0 4px, #fd8 12px -12px 0 4px; + } +} +@-webkit-keyframes flower-loader { + 0% { + -webkit-transform: rotate(0deg); + transform: rotate(0deg); + -webkit-box-shadow: white 0 0 15px 0, #fd8 -12px -12px 0 4px, #fd8 12px -12px 0 4px, #fd8 12px 12px 0 4px, #fd8 -12px 12px 0 4px; + box-shadow: white 0 0 15px 0, #fd8 -12px -12px 0 4px, #fd8 12px -12px 0 4px, #fd8 12px 12px 0 4px, #fd8 -12px 12px 0 4px; + } + 50% { + -webkit-transform: rotate(1080deg); + transform: rotate(1080deg); + -webkit-box-shadow: white 0 0 15px 0, #fd8 12px 12px 0 4px, #fd8 -12px 12px 0 4px, #fd8 -12px -12px 0 4px, #fd8 12px -12px 0 4px; + box-shadow: white 0 0 15px 0, #fd8 12px 12px 0 4px, #fd8 -12px 12px 0 4px, #fd8 -12px -12px 0 4px, #fd8 12px -12px 0 4px; + } +} +@keyframes flower-loader { + 0% { + -moz-transform: rotate(0deg); + -ms-transform: rotate(0deg); + -webkit-transform: rotate(0deg); + transform: rotate(0deg); + -moz-box-shadow: white 0 0 15px 0, #fd8 -12px -12px 0 4px, #fd8 12px -12px 0 4px, #fd8 12px 12px 0 4px, #fd8 -12px 12px 0 4px; + -webkit-box-shadow: white 0 0 15px 0, #fd8 -12px -12px 0 4px, #fd8 12px -12px 0 4px, #fd8 12px 12px 0 4px, #fd8 -12px 12px 0 4px; + box-shadow: white 0 0 15px 0, #fd8 -12px -12px 0 4px, #fd8 12px -12px 0 4px, #fd8 12px 12px 0 4px, #fd8 -12px 12px 0 4px; + } + 50% { + -moz-transform: rotate(1080deg); + -ms-transform: rotate(1080deg); + -webkit-transform: rotate(1080deg); + transform: rotate(1080deg); + -moz-box-shadow: white 0 0 15px 0, #fd8 12px 12px 0 4px, #fd8 -12px 12px 0 4px, #fd8 -12px -12px 0 4px, #fd8 12px -12px 0 4px; + -webkit-box-shadow: white 0 0 15px 0, #fd8 12px 12px 0 4px, #fd8 -12px 12px 0 4px, #fd8 -12px -12px 0 4px, #fd8 12px -12px 0 4px; + box-shadow: white 0 0 15px 0, #fd8 12px 12px 0 4px, #fd8 -12px 12px 0 4px, #fd8 -12px -12px 0 4px, #fd8 12px -12px 0 4px; + } +} +/* :not(:required) hides this rule from IE9 and below */ +.flower-loader:not(:required) { + overflow: hidden; + position: relative; + text-indent: -9999px; + display: inline-block; + width: 16px; + height: 16px; + background: #e96; + border-radius: 100%; + -moz-box-shadow: white 0 0 15px 0, #fd8 -12px -12px 0 4px, #fd8 12px -12px 0 4px, #fd8 12px 12px 0 4px, #fd8 -12px 12px 0 4px; + -webkit-box-shadow: white 0 0 15px 0, #fd8 -12px -12px 0 4px, #fd8 12px -12px 0 4px, #fd8 12px 12px 0 4px, #fd8 -12px 12px 0 4px; + box-shadow: white 0 0 15px 0, #fd8 -12px -12px 0 4px, #fd8 12px -12px 0 4px, #fd8 12px 12px 0 4px, #fd8 -12px 12px 0 4px; + -moz-animation: flower-loader 5s infinite ease-in-out; + -webkit-animation: flower-loader 5s infinite ease-in-out; + animation: flower-loader 5s infinite ease-in-out; + -moz-transform-origin: 50% 50%; + -ms-transform-origin: 50% 50%; + -webkit-transform-origin: 50% 50%; + transform-origin: 50% 50%; +} diff --git a/public/bower_components/css-spinners/gauge.css b/public/bower_components/css-spinners/gauge.css new file mode 100644 index 0000000..0dad69f --- /dev/null +++ b/public/bower_components/css-spinners/gauge.css @@ -0,0 +1,277 @@ +@-moz-keyframes gauge-loader { + 0% { + -moz-transform: rotate(-50deg); + transform: rotate(-50deg); + } + 10% { + -moz-transform: rotate(20deg); + transform: rotate(20deg); + } + 20% { + -moz-transform: rotate(60deg); + transform: rotate(60deg); + } + 24% { + -moz-transform: rotate(60deg); + transform: rotate(60deg); + } + 40% { + -moz-transform: rotate(-20deg); + transform: rotate(-20deg); + } + 54% { + -moz-transform: rotate(70deg); + transform: rotate(70deg); + } + 56% { + -moz-transform: rotate(78deg); + transform: rotate(78deg); + } + 58% { + -moz-transform: rotate(73deg); + transform: rotate(73deg); + } + 60% { + -moz-transform: rotate(75deg); + transform: rotate(75deg); + } + 62% { + -moz-transform: rotate(70deg); + transform: rotate(70deg); + } + 70% { + -moz-transform: rotate(-20deg); + transform: rotate(-20deg); + } + 80% { + -moz-transform: rotate(20deg); + transform: rotate(20deg); + } + 83% { + -moz-transform: rotate(25deg); + transform: rotate(25deg); + } + 86% { + -moz-transform: rotate(20deg); + transform: rotate(20deg); + } + 89% { + -moz-transform: rotate(25deg); + transform: rotate(25deg); + } + 100% { + -moz-transform: rotate(-50deg); + transform: rotate(-50deg); + } +} +@-webkit-keyframes gauge-loader { + 0% { + -webkit-transform: rotate(-50deg); + transform: rotate(-50deg); + } + 10% { + -webkit-transform: rotate(20deg); + transform: rotate(20deg); + } + 20% { + -webkit-transform: rotate(60deg); + transform: rotate(60deg); + } + 24% { + -webkit-transform: rotate(60deg); + transform: rotate(60deg); + } + 40% { + -webkit-transform: rotate(-20deg); + transform: rotate(-20deg); + } + 54% { + -webkit-transform: rotate(70deg); + transform: rotate(70deg); + } + 56% { + -webkit-transform: rotate(78deg); + transform: rotate(78deg); + } + 58% { + -webkit-transform: rotate(73deg); + transform: rotate(73deg); + } + 60% { + -webkit-transform: rotate(75deg); + transform: rotate(75deg); + } + 62% { + -webkit-transform: rotate(70deg); + transform: rotate(70deg); + } + 70% { + -webkit-transform: rotate(-20deg); + transform: rotate(-20deg); + } + 80% { + -webkit-transform: rotate(20deg); + transform: rotate(20deg); + } + 83% { + -webkit-transform: rotate(25deg); + transform: rotate(25deg); + } + 86% { + -webkit-transform: rotate(20deg); + transform: rotate(20deg); + } + 89% { + -webkit-transform: rotate(25deg); + transform: rotate(25deg); + } + 100% { + -webkit-transform: rotate(-50deg); + transform: rotate(-50deg); + } +} +@keyframes gauge-loader { + 0% { + -moz-transform: rotate(-50deg); + -ms-transform: rotate(-50deg); + -webkit-transform: rotate(-50deg); + transform: rotate(-50deg); + } + 10% { + -moz-transform: rotate(20deg); + -ms-transform: rotate(20deg); + -webkit-transform: rotate(20deg); + transform: rotate(20deg); + } + 20% { + -moz-transform: rotate(60deg); + -ms-transform: rotate(60deg); + -webkit-transform: rotate(60deg); + transform: rotate(60deg); + } + 24% { + -moz-transform: rotate(60deg); + -ms-transform: rotate(60deg); + -webkit-transform: rotate(60deg); + transform: rotate(60deg); + } + 40% { + -moz-transform: rotate(-20deg); + -ms-transform: rotate(-20deg); + -webkit-transform: rotate(-20deg); + transform: rotate(-20deg); + } + 54% { + -moz-transform: rotate(70deg); + -ms-transform: rotate(70deg); + -webkit-transform: rotate(70deg); + transform: rotate(70deg); + } + 56% { + -moz-transform: rotate(78deg); + -ms-transform: rotate(78deg); + -webkit-transform: rotate(78deg); + transform: rotate(78deg); + } + 58% { + -moz-transform: rotate(73deg); + -ms-transform: rotate(73deg); + -webkit-transform: rotate(73deg); + transform: rotate(73deg); + } + 60% { + -moz-transform: rotate(75deg); + -ms-transform: rotate(75deg); + -webkit-transform: rotate(75deg); + transform: rotate(75deg); + } + 62% { + -moz-transform: rotate(70deg); + -ms-transform: rotate(70deg); + -webkit-transform: rotate(70deg); + transform: rotate(70deg); + } + 70% { + -moz-transform: rotate(-20deg); + -ms-transform: rotate(-20deg); + -webkit-transform: rotate(-20deg); + transform: rotate(-20deg); + } + 80% { + -moz-transform: rotate(20deg); + -ms-transform: rotate(20deg); + -webkit-transform: rotate(20deg); + transform: rotate(20deg); + } + 83% { + -moz-transform: rotate(25deg); + -ms-transform: rotate(25deg); + -webkit-transform: rotate(25deg); + transform: rotate(25deg); + } + 86% { + -moz-transform: rotate(20deg); + -ms-transform: rotate(20deg); + -webkit-transform: rotate(20deg); + transform: rotate(20deg); + } + 89% { + -moz-transform: rotate(25deg); + -ms-transform: rotate(25deg); + -webkit-transform: rotate(25deg); + transform: rotate(25deg); + } + 100% { + -moz-transform: rotate(-50deg); + -ms-transform: rotate(-50deg); + -webkit-transform: rotate(-50deg); + transform: rotate(-50deg); + } +} +/* :not(:required) hides this rule from IE9 and below */ +.gauge-loader:not(:required) { + background: #6ca; + -moz-border-radius-topleft: 32px; + -webkit-border-top-left-radius: 32px; + border-top-left-radius: 32px; + -moz-border-radius-topright: 32px; + -webkit-border-top-right-radius: 32px; + border-top-right-radius: 32px; + display: inline-block; + width: 64px; + height: 32px; + overflow: hidden; + position: relative; + text-indent: -9999px; +} +.gauge-loader:not(:required)::before { + -moz-animation: gauge-loader 4000ms infinite ease; + -webkit-animation: gauge-loader 4000ms infinite ease; + animation: gauge-loader 4000ms infinite ease; + background: white; + -moz-border-radius: 2px; + -webkit-border-radius: 2px; + border-radius: 2px; + content: ''; + position: absolute; + left: 30px; + top: 5.33333px; + width: 4px; + height: 26.66667px; + -moz-transform-origin: 50% 100%; + -ms-transform-origin: 50% 100%; + -webkit-transform-origin: 50% 100%; + transform-origin: 50% 100%; +} +.gauge-loader:not(:required)::after { + content: ''; + background: white; + -moz-border-radius: 8px; + -webkit-border-radius: 8px; + border-radius: 8px; + position: absolute; + left: 25.6px; + top: 25.6px; + width: 12.8px; + height: 12.8px; +} diff --git a/public/bower_components/css-spinners/heartbeat.css b/public/bower_components/css-spinners/heartbeat.css new file mode 100644 index 0000000..5a24069 --- /dev/null +++ b/public/bower_components/css-spinners/heartbeat.css @@ -0,0 +1,125 @@ +@-moz-keyframes heartbeat-loader { + 0% { + -moz-transform: rotate(45deg) scale(1); + transform: rotate(45deg) scale(1); + } + 14% { + -moz-transform: rotate(45deg) scale(1.3); + transform: rotate(45deg) scale(1.3); + } + 28% { + -moz-transform: rotate(45deg) scale(1); + transform: rotate(45deg) scale(1); + } + 42% { + -moz-transform: rotate(45deg) scale(1.3); + transform: rotate(45deg) scale(1.3); + } + 70% { + -moz-transform: rotate(45deg) scale(1); + transform: rotate(45deg) scale(1); + } +} +@-webkit-keyframes heartbeat-loader { + 0% { + -webkit-transform: rotate(45deg) scale(1); + transform: rotate(45deg) scale(1); + } + 14% { + -webkit-transform: rotate(45deg) scale(1.3); + transform: rotate(45deg) scale(1.3); + } + 28% { + -webkit-transform: rotate(45deg) scale(1); + transform: rotate(45deg) scale(1); + } + 42% { + -webkit-transform: rotate(45deg) scale(1.3); + transform: rotate(45deg) scale(1.3); + } + 70% { + -webkit-transform: rotate(45deg) scale(1); + transform: rotate(45deg) scale(1); + } +} +@keyframes heartbeat-loader { + 0% { + -moz-transform: rotate(45deg) scale(1); + -ms-transform: rotate(45deg) scale(1); + -webkit-transform: rotate(45deg) scale(1); + transform: rotate(45deg) scale(1); + } + 14% { + -moz-transform: rotate(45deg) scale(1.3); + -ms-transform: rotate(45deg) scale(1.3); + -webkit-transform: rotate(45deg) scale(1.3); + transform: rotate(45deg) scale(1.3); + } + 28% { + -moz-transform: rotate(45deg) scale(1); + -ms-transform: rotate(45deg) scale(1); + -webkit-transform: rotate(45deg) scale(1); + transform: rotate(45deg) scale(1); + } + 42% { + -moz-transform: rotate(45deg) scale(1.3); + -ms-transform: rotate(45deg) scale(1.3); + -webkit-transform: rotate(45deg) scale(1.3); + transform: rotate(45deg) scale(1.3); + } + 70% { + -moz-transform: rotate(45deg) scale(1); + -ms-transform: rotate(45deg) scale(1); + -webkit-transform: rotate(45deg) scale(1); + transform: rotate(45deg) scale(1); + } +} +/* :not(:required) hides this rule from IE9 and below */ +.heartbeat-loader:not(:required) { + -moz-animation: heartbeat-loader 1300ms ease 0s infinite normal; + -webkit-animation: heartbeat-loader 1300ms ease 0s infinite normal; + animation: heartbeat-loader 1300ms ease 0s infinite normal; + display: inline-block; + position: relative; + overflow: hidden; + text-indent: -9999px; + width: 36px; + height: 36px; + -moz-transform: rotate(45deg) scale(1); + -ms-transform: rotate(45deg) scale(1); + -webkit-transform: rotate(45deg) scale(1); + transform: rotate(45deg) scale(1); + -moz-transform-origin: 50% 50%; + -ms-transform-origin: 50% 50%; + -webkit-transform-origin: 50% 50%; + transform-origin: 50% 50%; +} +.heartbeat-loader:not(:required):after, .heartbeat-loader:not(:required):before { + position: absolute; + content: ""; + background: #e87; +} +.heartbeat-loader:not(:required):before { + -moz-border-radius-topleft: 12px; + -webkit-border-top-left-radius: 12px; + border-top-left-radius: 12px; + -moz-border-radius-bottomleft: 12px; + -webkit-border-bottom-left-radius: 12px; + border-bottom-left-radius: 12px; + top: 12px; + left: 0; + width: 36px; + height: 24px; +} +.heartbeat-loader:not(:required):after { + -moz-border-radius-topleft: 12px; + -webkit-border-top-left-radius: 12px; + border-top-left-radius: 12px; + -moz-border-radius-topright: 12px; + -webkit-border-top-right-radius: 12px; + border-top-right-radius: 12px; + top: 0; + left: 12px; + width: 24px; + height: 12px; +} diff --git a/public/bower_components/css-spinners/hexdots.css b/public/bower_components/css-spinners/hexdots.css new file mode 100644 index 0000000..2166486 --- /dev/null +++ b/public/bower_components/css-spinners/hexdots.css @@ -0,0 +1,196 @@ +@-moz-keyframes hexdots-loader { + 0% { + -moz-box-shadow: #666666 0 -30px 0 7px, #999 0 -30px 0 7px, #999 26px -15px 0 7px, #999 26px 15px 0 7px, #999 0 30px 0 7px, #999 -26px 15px 0 7px, #999 -26px -15px 0 7px; + box-shadow: #666666 0 -30px 0 7px, #999 0 -30px 0 7px, #999 26px -15px 0 7px, #999 26px 15px 0 7px, #999 0 30px 0 7px, #999 -26px 15px 0 7px, #999 -26px -15px 0 7px; + } + 8.33% { + -moz-box-shadow: #666666 26px -15px 0 7px, #999 26px -15px 0 7px, #999 26px -15px 0 7px, #999 26px 15px 0 7px, #999 0 30px 0 7px, #999 -26px 15px 0 7px, #999 -26px -15px 0 7px; + box-shadow: #666666 26px -15px 0 7px, #999 26px -15px 0 7px, #999 26px -15px 0 7px, #999 26px 15px 0 7px, #999 0 30px 0 7px, #999 -26px 15px 0 7px, #999 -26px -15px 0 7px; + } + 16.67% { + -moz-box-shadow: #666666 26px 15px 0 7px, #999 26px 15px 0 7px, #999 26px 15px 0 7px, #999 26px 15px 0 7px, #999 0 30px 0 7px, #999 -26px 15px 0 7px, #999 -26px -15px 0 7px; + box-shadow: #666666 26px 15px 0 7px, #999 26px 15px 0 7px, #999 26px 15px 0 7px, #999 26px 15px 0 7px, #999 0 30px 0 7px, #999 -26px 15px 0 7px, #999 -26px -15px 0 7px; + } + 25% { + -moz-box-shadow: #666666 0 30px 0 7px, #999 0 30px 0 7px, #999 0 30px 0 7px, #999 0 30px 0 7px, #999 0 30px 0 7px, #999 -26px 15px 0 7px, #999 -26px -15px 0 7px; + box-shadow: #666666 0 30px 0 7px, #999 0 30px 0 7px, #999 0 30px 0 7px, #999 0 30px 0 7px, #999 0 30px 0 7px, #999 -26px 15px 0 7px, #999 -26px -15px 0 7px; + } + 33.33% { + -moz-box-shadow: #666666 -26px 15px 0 7px, #999 -26px 15px 0 7px, #999 -26px 15px 0 7px, #999 -26px 15px 0 7px, #999 -26px 15px 0 7px, #999 -26px 15px 0 7px, #999 -26px -15px 0 7px; + box-shadow: #666666 -26px 15px 0 7px, #999 -26px 15px 0 7px, #999 -26px 15px 0 7px, #999 -26px 15px 0 7px, #999 -26px 15px 0 7px, #999 -26px 15px 0 7px, #999 -26px -15px 0 7px; + } + 41.67% { + -moz-box-shadow: #666666 -26px -15px 0 7px, #999 -26px -15px 0 7px, #999 -26px -15px 0 7px, #999 -26px -15px 0 7px, #999 -26px -15px 0 7px, #999 -26px -15px 0 7px, #999 -26px -15px 0 7px; + box-shadow: #666666 -26px -15px 0 7px, #999 -26px -15px 0 7px, #999 -26px -15px 0 7px, #999 -26px -15px 0 7px, #999 -26px -15px 0 7px, #999 -26px -15px 0 7px, #999 -26px -15px 0 7px; + } + 50% { + -moz-box-shadow: #666666 0 -30px 0 7px, #999 0 -30px 0 7px, #999 0 -30px 0 7px, #999 0 -30px 0 7px, #999 0 -30px 0 7px, #999 0 -30px 0 7px, #999 0 -30px 0 7px; + box-shadow: #666666 0 -30px 0 7px, #999 0 -30px 0 7px, #999 0 -30px 0 7px, #999 0 -30px 0 7px, #999 0 -30px 0 7px, #999 0 -30px 0 7px, #999 0 -30px 0 7px; + } + 58.33% { + -moz-box-shadow: #666666 26px -15px 0 7px, #999 0 -30px 0 7px, #999 26px -15px 0 7px, #999 26px -15px 0 7px, #999 26px -15px 0 7px, #999 26px -15px 0 7px, #999 26px -15px 0 7px; + box-shadow: #666666 26px -15px 0 7px, #999 0 -30px 0 7px, #999 26px -15px 0 7px, #999 26px -15px 0 7px, #999 26px -15px 0 7px, #999 26px -15px 0 7px, #999 26px -15px 0 7px; + } + 66.67% { + -moz-box-shadow: #666666 26px 15px 0 7px, #999 0 -30px 0 7px, #999 26px -15px 0 7px, #999 26px 15px 0 7px, #999 26px 15px 0 7px, #999 26px 15px 0 7px, #999 26px 15px 0 7px; + box-shadow: #666666 26px 15px 0 7px, #999 0 -30px 0 7px, #999 26px -15px 0 7px, #999 26px 15px 0 7px, #999 26px 15px 0 7px, #999 26px 15px 0 7px, #999 26px 15px 0 7px; + } + 75% { + -moz-box-shadow: #666666 0 30px 0 7px, #999 0 -30px 0 7px, #999 26px -15px 0 7px, #999 26px 15px 0 7px, #999 0 30px 0 7px, #999 0 30px 0 7px, #999 0 30px 0 7px; + box-shadow: #666666 0 30px 0 7px, #999 0 -30px 0 7px, #999 26px -15px 0 7px, #999 26px 15px 0 7px, #999 0 30px 0 7px, #999 0 30px 0 7px, #999 0 30px 0 7px; + } + 83.33% { + -moz-box-shadow: #666666 -26px 15px 0 7px, #999 0 -30px 0 7px, #999 26px -15px 0 7px, #999 26px 15px 0 7px, #999 0 30px 0 7px, #999 -26px 15px 0 7px, #999 -26px 15px 0 7px; + box-shadow: #666666 -26px 15px 0 7px, #999 0 -30px 0 7px, #999 26px -15px 0 7px, #999 26px 15px 0 7px, #999 0 30px 0 7px, #999 -26px 15px 0 7px, #999 -26px 15px 0 7px; + } + 91.67% { + -moz-box-shadow: #666666 -26px -15px 0 7px, #999 0 -30px 0 7px, #999 26px -15px 0 7px, #999 26px 15px 0 7px, #999 0 30px 0 7px, #999 -26px 15px 0 7px, #999 -26px -15px 0 7px; + box-shadow: #666666 -26px -15px 0 7px, #999 0 -30px 0 7px, #999 26px -15px 0 7px, #999 26px 15px 0 7px, #999 0 30px 0 7px, #999 -26px 15px 0 7px, #999 -26px -15px 0 7px; + } + 100% { + -moz-box-shadow: #666666 0 -30px 0 7px, #999 0 -30px 0 7px, #999 26px -15px 0 7px, #999 26px 15px 0 7px, #999 0 30px 0 7px, #999 -26px 15px 0 7px, #999 -26px -15px 0 7px; + box-shadow: #666666 0 -30px 0 7px, #999 0 -30px 0 7px, #999 26px -15px 0 7px, #999 26px 15px 0 7px, #999 0 30px 0 7px, #999 -26px 15px 0 7px, #999 -26px -15px 0 7px; + } +} +@-webkit-keyframes hexdots-loader { + 0% { + -webkit-box-shadow: #666666 0 -30px 0 7px, #999 0 -30px 0 7px, #999 26px -15px 0 7px, #999 26px 15px 0 7px, #999 0 30px 0 7px, #999 -26px 15px 0 7px, #999 -26px -15px 0 7px; + box-shadow: #666666 0 -30px 0 7px, #999 0 -30px 0 7px, #999 26px -15px 0 7px, #999 26px 15px 0 7px, #999 0 30px 0 7px, #999 -26px 15px 0 7px, #999 -26px -15px 0 7px; + } + 8.33% { + -webkit-box-shadow: #666666 26px -15px 0 7px, #999 26px -15px 0 7px, #999 26px -15px 0 7px, #999 26px 15px 0 7px, #999 0 30px 0 7px, #999 -26px 15px 0 7px, #999 -26px -15px 0 7px; + box-shadow: #666666 26px -15px 0 7px, #999 26px -15px 0 7px, #999 26px -15px 0 7px, #999 26px 15px 0 7px, #999 0 30px 0 7px, #999 -26px 15px 0 7px, #999 -26px -15px 0 7px; + } + 16.67% { + -webkit-box-shadow: #666666 26px 15px 0 7px, #999 26px 15px 0 7px, #999 26px 15px 0 7px, #999 26px 15px 0 7px, #999 0 30px 0 7px, #999 -26px 15px 0 7px, #999 -26px -15px 0 7px; + box-shadow: #666666 26px 15px 0 7px, #999 26px 15px 0 7px, #999 26px 15px 0 7px, #999 26px 15px 0 7px, #999 0 30px 0 7px, #999 -26px 15px 0 7px, #999 -26px -15px 0 7px; + } + 25% { + -webkit-box-shadow: #666666 0 30px 0 7px, #999 0 30px 0 7px, #999 0 30px 0 7px, #999 0 30px 0 7px, #999 0 30px 0 7px, #999 -26px 15px 0 7px, #999 -26px -15px 0 7px; + box-shadow: #666666 0 30px 0 7px, #999 0 30px 0 7px, #999 0 30px 0 7px, #999 0 30px 0 7px, #999 0 30px 0 7px, #999 -26px 15px 0 7px, #999 -26px -15px 0 7px; + } + 33.33% { + -webkit-box-shadow: #666666 -26px 15px 0 7px, #999 -26px 15px 0 7px, #999 -26px 15px 0 7px, #999 -26px 15px 0 7px, #999 -26px 15px 0 7px, #999 -26px 15px 0 7px, #999 -26px -15px 0 7px; + box-shadow: #666666 -26px 15px 0 7px, #999 -26px 15px 0 7px, #999 -26px 15px 0 7px, #999 -26px 15px 0 7px, #999 -26px 15px 0 7px, #999 -26px 15px 0 7px, #999 -26px -15px 0 7px; + } + 41.67% { + -webkit-box-shadow: #666666 -26px -15px 0 7px, #999 -26px -15px 0 7px, #999 -26px -15px 0 7px, #999 -26px -15px 0 7px, #999 -26px -15px 0 7px, #999 -26px -15px 0 7px, #999 -26px -15px 0 7px; + box-shadow: #666666 -26px -15px 0 7px, #999 -26px -15px 0 7px, #999 -26px -15px 0 7px, #999 -26px -15px 0 7px, #999 -26px -15px 0 7px, #999 -26px -15px 0 7px, #999 -26px -15px 0 7px; + } + 50% { + -webkit-box-shadow: #666666 0 -30px 0 7px, #999 0 -30px 0 7px, #999 0 -30px 0 7px, #999 0 -30px 0 7px, #999 0 -30px 0 7px, #999 0 -30px 0 7px, #999 0 -30px 0 7px; + box-shadow: #666666 0 -30px 0 7px, #999 0 -30px 0 7px, #999 0 -30px 0 7px, #999 0 -30px 0 7px, #999 0 -30px 0 7px, #999 0 -30px 0 7px, #999 0 -30px 0 7px; + } + 58.33% { + -webkit-box-shadow: #666666 26px -15px 0 7px, #999 0 -30px 0 7px, #999 26px -15px 0 7px, #999 26px -15px 0 7px, #999 26px -15px 0 7px, #999 26px -15px 0 7px, #999 26px -15px 0 7px; + box-shadow: #666666 26px -15px 0 7px, #999 0 -30px 0 7px, #999 26px -15px 0 7px, #999 26px -15px 0 7px, #999 26px -15px 0 7px, #999 26px -15px 0 7px, #999 26px -15px 0 7px; + } + 66.67% { + -webkit-box-shadow: #666666 26px 15px 0 7px, #999 0 -30px 0 7px, #999 26px -15px 0 7px, #999 26px 15px 0 7px, #999 26px 15px 0 7px, #999 26px 15px 0 7px, #999 26px 15px 0 7px; + box-shadow: #666666 26px 15px 0 7px, #999 0 -30px 0 7px, #999 26px -15px 0 7px, #999 26px 15px 0 7px, #999 26px 15px 0 7px, #999 26px 15px 0 7px, #999 26px 15px 0 7px; + } + 75% { + -webkit-box-shadow: #666666 0 30px 0 7px, #999 0 -30px 0 7px, #999 26px -15px 0 7px, #999 26px 15px 0 7px, #999 0 30px 0 7px, #999 0 30px 0 7px, #999 0 30px 0 7px; + box-shadow: #666666 0 30px 0 7px, #999 0 -30px 0 7px, #999 26px -15px 0 7px, #999 26px 15px 0 7px, #999 0 30px 0 7px, #999 0 30px 0 7px, #999 0 30px 0 7px; + } + 83.33% { + -webkit-box-shadow: #666666 -26px 15px 0 7px, #999 0 -30px 0 7px, #999 26px -15px 0 7px, #999 26px 15px 0 7px, #999 0 30px 0 7px, #999 -26px 15px 0 7px, #999 -26px 15px 0 7px; + box-shadow: #666666 -26px 15px 0 7px, #999 0 -30px 0 7px, #999 26px -15px 0 7px, #999 26px 15px 0 7px, #999 0 30px 0 7px, #999 -26px 15px 0 7px, #999 -26px 15px 0 7px; + } + 91.67% { + -webkit-box-shadow: #666666 -26px -15px 0 7px, #999 0 -30px 0 7px, #999 26px -15px 0 7px, #999 26px 15px 0 7px, #999 0 30px 0 7px, #999 -26px 15px 0 7px, #999 -26px -15px 0 7px; + box-shadow: #666666 -26px -15px 0 7px, #999 0 -30px 0 7px, #999 26px -15px 0 7px, #999 26px 15px 0 7px, #999 0 30px 0 7px, #999 -26px 15px 0 7px, #999 -26px -15px 0 7px; + } + 100% { + -webkit-box-shadow: #666666 0 -30px 0 7px, #999 0 -30px 0 7px, #999 26px -15px 0 7px, #999 26px 15px 0 7px, #999 0 30px 0 7px, #999 -26px 15px 0 7px, #999 -26px -15px 0 7px; + box-shadow: #666666 0 -30px 0 7px, #999 0 -30px 0 7px, #999 26px -15px 0 7px, #999 26px 15px 0 7px, #999 0 30px 0 7px, #999 -26px 15px 0 7px, #999 -26px -15px 0 7px; + } +} +@keyframes hexdots-loader { + 0% { + -moz-box-shadow: #666666 0 -30px 0 7px, #999 0 -30px 0 7px, #999 26px -15px 0 7px, #999 26px 15px 0 7px, #999 0 30px 0 7px, #999 -26px 15px 0 7px, #999 -26px -15px 0 7px; + -webkit-box-shadow: #666666 0 -30px 0 7px, #999 0 -30px 0 7px, #999 26px -15px 0 7px, #999 26px 15px 0 7px, #999 0 30px 0 7px, #999 -26px 15px 0 7px, #999 -26px -15px 0 7px; + box-shadow: #666666 0 -30px 0 7px, #999 0 -30px 0 7px, #999 26px -15px 0 7px, #999 26px 15px 0 7px, #999 0 30px 0 7px, #999 -26px 15px 0 7px, #999 -26px -15px 0 7px; + } + 8.33% { + -moz-box-shadow: #666666 26px -15px 0 7px, #999 26px -15px 0 7px, #999 26px -15px 0 7px, #999 26px 15px 0 7px, #999 0 30px 0 7px, #999 -26px 15px 0 7px, #999 -26px -15px 0 7px; + -webkit-box-shadow: #666666 26px -15px 0 7px, #999 26px -15px 0 7px, #999 26px -15px 0 7px, #999 26px 15px 0 7px, #999 0 30px 0 7px, #999 -26px 15px 0 7px, #999 -26px -15px 0 7px; + box-shadow: #666666 26px -15px 0 7px, #999 26px -15px 0 7px, #999 26px -15px 0 7px, #999 26px 15px 0 7px, #999 0 30px 0 7px, #999 -26px 15px 0 7px, #999 -26px -15px 0 7px; + } + 16.67% { + -moz-box-shadow: #666666 26px 15px 0 7px, #999 26px 15px 0 7px, #999 26px 15px 0 7px, #999 26px 15px 0 7px, #999 0 30px 0 7px, #999 -26px 15px 0 7px, #999 -26px -15px 0 7px; + -webkit-box-shadow: #666666 26px 15px 0 7px, #999 26px 15px 0 7px, #999 26px 15px 0 7px, #999 26px 15px 0 7px, #999 0 30px 0 7px, #999 -26px 15px 0 7px, #999 -26px -15px 0 7px; + box-shadow: #666666 26px 15px 0 7px, #999 26px 15px 0 7px, #999 26px 15px 0 7px, #999 26px 15px 0 7px, #999 0 30px 0 7px, #999 -26px 15px 0 7px, #999 -26px -15px 0 7px; + } + 25% { + -moz-box-shadow: #666666 0 30px 0 7px, #999 0 30px 0 7px, #999 0 30px 0 7px, #999 0 30px 0 7px, #999 0 30px 0 7px, #999 -26px 15px 0 7px, #999 -26px -15px 0 7px; + -webkit-box-shadow: #666666 0 30px 0 7px, #999 0 30px 0 7px, #999 0 30px 0 7px, #999 0 30px 0 7px, #999 0 30px 0 7px, #999 -26px 15px 0 7px, #999 -26px -15px 0 7px; + box-shadow: #666666 0 30px 0 7px, #999 0 30px 0 7px, #999 0 30px 0 7px, #999 0 30px 0 7px, #999 0 30px 0 7px, #999 -26px 15px 0 7px, #999 -26px -15px 0 7px; + } + 33.33% { + -moz-box-shadow: #666666 -26px 15px 0 7px, #999 -26px 15px 0 7px, #999 -26px 15px 0 7px, #999 -26px 15px 0 7px, #999 -26px 15px 0 7px, #999 -26px 15px 0 7px, #999 -26px -15px 0 7px; + -webkit-box-shadow: #666666 -26px 15px 0 7px, #999 -26px 15px 0 7px, #999 -26px 15px 0 7px, #999 -26px 15px 0 7px, #999 -26px 15px 0 7px, #999 -26px 15px 0 7px, #999 -26px -15px 0 7px; + box-shadow: #666666 -26px 15px 0 7px, #999 -26px 15px 0 7px, #999 -26px 15px 0 7px, #999 -26px 15px 0 7px, #999 -26px 15px 0 7px, #999 -26px 15px 0 7px, #999 -26px -15px 0 7px; + } + 41.67% { + -moz-box-shadow: #666666 -26px -15px 0 7px, #999 -26px -15px 0 7px, #999 -26px -15px 0 7px, #999 -26px -15px 0 7px, #999 -26px -15px 0 7px, #999 -26px -15px 0 7px, #999 -26px -15px 0 7px; + -webkit-box-shadow: #666666 -26px -15px 0 7px, #999 -26px -15px 0 7px, #999 -26px -15px 0 7px, #999 -26px -15px 0 7px, #999 -26px -15px 0 7px, #999 -26px -15px 0 7px, #999 -26px -15px 0 7px; + box-shadow: #666666 -26px -15px 0 7px, #999 -26px -15px 0 7px, #999 -26px -15px 0 7px, #999 -26px -15px 0 7px, #999 -26px -15px 0 7px, #999 -26px -15px 0 7px, #999 -26px -15px 0 7px; + } + 50% { + -moz-box-shadow: #666666 0 -30px 0 7px, #999 0 -30px 0 7px, #999 0 -30px 0 7px, #999 0 -30px 0 7px, #999 0 -30px 0 7px, #999 0 -30px 0 7px, #999 0 -30px 0 7px; + -webkit-box-shadow: #666666 0 -30px 0 7px, #999 0 -30px 0 7px, #999 0 -30px 0 7px, #999 0 -30px 0 7px, #999 0 -30px 0 7px, #999 0 -30px 0 7px, #999 0 -30px 0 7px; + box-shadow: #666666 0 -30px 0 7px, #999 0 -30px 0 7px, #999 0 -30px 0 7px, #999 0 -30px 0 7px, #999 0 -30px 0 7px, #999 0 -30px 0 7px, #999 0 -30px 0 7px; + } + 58.33% { + -moz-box-shadow: #666666 26px -15px 0 7px, #999 0 -30px 0 7px, #999 26px -15px 0 7px, #999 26px -15px 0 7px, #999 26px -15px 0 7px, #999 26px -15px 0 7px, #999 26px -15px 0 7px; + -webkit-box-shadow: #666666 26px -15px 0 7px, #999 0 -30px 0 7px, #999 26px -15px 0 7px, #999 26px -15px 0 7px, #999 26px -15px 0 7px, #999 26px -15px 0 7px, #999 26px -15px 0 7px; + box-shadow: #666666 26px -15px 0 7px, #999 0 -30px 0 7px, #999 26px -15px 0 7px, #999 26px -15px 0 7px, #999 26px -15px 0 7px, #999 26px -15px 0 7px, #999 26px -15px 0 7px; + } + 66.67% { + -moz-box-shadow: #666666 26px 15px 0 7px, #999 0 -30px 0 7px, #999 26px -15px 0 7px, #999 26px 15px 0 7px, #999 26px 15px 0 7px, #999 26px 15px 0 7px, #999 26px 15px 0 7px; + -webkit-box-shadow: #666666 26px 15px 0 7px, #999 0 -30px 0 7px, #999 26px -15px 0 7px, #999 26px 15px 0 7px, #999 26px 15px 0 7px, #999 26px 15px 0 7px, #999 26px 15px 0 7px; + box-shadow: #666666 26px 15px 0 7px, #999 0 -30px 0 7px, #999 26px -15px 0 7px, #999 26px 15px 0 7px, #999 26px 15px 0 7px, #999 26px 15px 0 7px, #999 26px 15px 0 7px; + } + 75% { + -moz-box-shadow: #666666 0 30px 0 7px, #999 0 -30px 0 7px, #999 26px -15px 0 7px, #999 26px 15px 0 7px, #999 0 30px 0 7px, #999 0 30px 0 7px, #999 0 30px 0 7px; + -webkit-box-shadow: #666666 0 30px 0 7px, #999 0 -30px 0 7px, #999 26px -15px 0 7px, #999 26px 15px 0 7px, #999 0 30px 0 7px, #999 0 30px 0 7px, #999 0 30px 0 7px; + box-shadow: #666666 0 30px 0 7px, #999 0 -30px 0 7px, #999 26px -15px 0 7px, #999 26px 15px 0 7px, #999 0 30px 0 7px, #999 0 30px 0 7px, #999 0 30px 0 7px; + } + 83.33% { + -moz-box-shadow: #666666 -26px 15px 0 7px, #999 0 -30px 0 7px, #999 26px -15px 0 7px, #999 26px 15px 0 7px, #999 0 30px 0 7px, #999 -26px 15px 0 7px, #999 -26px 15px 0 7px; + -webkit-box-shadow: #666666 -26px 15px 0 7px, #999 0 -30px 0 7px, #999 26px -15px 0 7px, #999 26px 15px 0 7px, #999 0 30px 0 7px, #999 -26px 15px 0 7px, #999 -26px 15px 0 7px; + box-shadow: #666666 -26px 15px 0 7px, #999 0 -30px 0 7px, #999 26px -15px 0 7px, #999 26px 15px 0 7px, #999 0 30px 0 7px, #999 -26px 15px 0 7px, #999 -26px 15px 0 7px; + } + 91.67% { + -moz-box-shadow: #666666 -26px -15px 0 7px, #999 0 -30px 0 7px, #999 26px -15px 0 7px, #999 26px 15px 0 7px, #999 0 30px 0 7px, #999 -26px 15px 0 7px, #999 -26px -15px 0 7px; + -webkit-box-shadow: #666666 -26px -15px 0 7px, #999 0 -30px 0 7px, #999 26px -15px 0 7px, #999 26px 15px 0 7px, #999 0 30px 0 7px, #999 -26px 15px 0 7px, #999 -26px -15px 0 7px; + box-shadow: #666666 -26px -15px 0 7px, #999 0 -30px 0 7px, #999 26px -15px 0 7px, #999 26px 15px 0 7px, #999 0 30px 0 7px, #999 -26px 15px 0 7px, #999 -26px -15px 0 7px; + } + 100% { + -moz-box-shadow: #666666 0 -30px 0 7px, #999 0 -30px 0 7px, #999 26px -15px 0 7px, #999 26px 15px 0 7px, #999 0 30px 0 7px, #999 -26px 15px 0 7px, #999 -26px -15px 0 7px; + -webkit-box-shadow: #666666 0 -30px 0 7px, #999 0 -30px 0 7px, #999 26px -15px 0 7px, #999 26px 15px 0 7px, #999 0 30px 0 7px, #999 -26px 15px 0 7px, #999 -26px -15px 0 7px; + box-shadow: #666666 0 -30px 0 7px, #999 0 -30px 0 7px, #999 26px -15px 0 7px, #999 26px 15px 0 7px, #999 0 30px 0 7px, #999 -26px 15px 0 7px, #999 -26px -15px 0 7px; + } +} +/* :not(:required) hides this rule from IE9 and below */ +.hexdots-loader:not(:required) { + overflow: hidden; + position: relative; + text-indent: -9999px; + display: inline-block; + width: 7px; + height: 7px; + background: transparent; + border-radius: 100%; + -moz-box-shadow: #666666 0 -30px 0 7px, #999 26px -15px 0 7px, #999 26px 15px 0 7px, #999 0 30px 0 7px, #999 0 30px 0 7px, #999 0 30px 0 7px; + -webkit-box-shadow: #666666 0 -30px 0 7px, #999 26px -15px 0 7px, #999 26px 15px 0 7px, #999 0 30px 0 7px, #999 0 30px 0 7px, #999 0 30px 0 7px; + box-shadow: #666666 0 -30px 0 7px, #999 26px -15px 0 7px, #999 26px 15px 0 7px, #999 0 30px 0 7px, #999 0 30px 0 7px, #999 0 30px 0 7px; + -moz-animation: hexdots-loader 5s infinite ease-in-out; + -webkit-animation: hexdots-loader 5s infinite ease-in-out; + animation: hexdots-loader 5s infinite ease-in-out; + -moz-transform-origin: 50% 50%; + -ms-transform-origin: 50% 50%; + -webkit-transform-origin: 50% 50%; + transform-origin: 50% 50%; +} diff --git a/public/bower_components/css-spinners/hole-pulse.css b/public/bower_components/css-spinners/hole-pulse.css new file mode 100644 index 0000000..9657b3a --- /dev/null +++ b/public/bower_components/css-spinners/hole-pulse.css @@ -0,0 +1,60 @@ +.hole-pulse-loader:not(:required) { + display: inline-block; + width: 50px; + height: 50px; + -moz-animation: pulse-loader 0.7s infinite alternate; + -webkit-animation: pulse-loader 0.7s infinite alternate; + animation: pulse-loader 0.7s infinite alternate; + border: 2px solid #e67e22; + -moz-border-radius: 50%; + -webkit-border-radius: 50%; + border-radius: 50%; + overflow: hidden; + text-indent: 50px; +} + +@-moz-keyframes pulse-loader { + 0% { + -moz-box-shadow: #e67e22 0 0 0px 20px; + box-shadow: #e67e22 0 0 0px 20px; + } + 40% { + -moz-box-shadow: none; + box-shadow: none; + } + 100% { + -moz-box-shadow: #e67e22 0 0 0px 25px inset; + box-shadow: #e67e22 0 0 0px 25px inset; + } +} +@-webkit-keyframes pulse-loader { + 0% { + -webkit-box-shadow: #e67e22 0 0 0px 20px; + box-shadow: #e67e22 0 0 0px 20px; + } + 40% { + -webkit-box-shadow: none; + box-shadow: none; + } + 100% { + -webkit-box-shadow: #e67e22 0 0 0px 25px inset; + box-shadow: #e67e22 0 0 0px 25px inset; + } +} +@keyframes pulse-loader { + 0% { + -moz-box-shadow: #e67e22 0 0 0px 20px; + -webkit-box-shadow: #e67e22 0 0 0px 20px; + box-shadow: #e67e22 0 0 0px 20px; + } + 40% { + -moz-box-shadow: none; + -webkit-box-shadow: none; + box-shadow: none; + } + 100% { + -moz-box-shadow: #e67e22 0 0 0px 25px inset; + -webkit-box-shadow: #e67e22 0 0 0px 25px inset; + box-shadow: #e67e22 0 0 0px 25px inset; + } +} diff --git a/public/bower_components/css-spinners/inner-circles.css b/public/bower_components/css-spinners/inner-circles.css new file mode 100644 index 0000000..5d01c4f --- /dev/null +++ b/public/bower_components/css-spinners/inner-circles.css @@ -0,0 +1,97 @@ +/* :not(:required) hides this rule from IE9 and below */ +.inner-circles-loader:not(:required) { + -moz-transform: translate3d(0, 0, 0); + -ms-transform: translate3d(0, 0, 0); + -webkit-transform: translate3d(0, 0, 0); + transform: translate3d(0, 0, 0); + position: relative; + display: inline-block; + width: 50px; + height: 50px; + background: rgba(25, 165, 152, 0.5); + border-radius: 50%; + overflow: hidden; + text-indent: -9999px; + /* Hides inner circles outside base circle at safari */ + -webkit-mask-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAIAAACQd1PeAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAA5JREFUeNpiYGBgAAgwAAAEAAGbA+oJAAAAAElFTkSuQmCC); +} +.inner-circles-loader:not(:required):before, .inner-circles-loader:not(:required):after { + content: ''; + position: absolute; + top: 0; + display: inline-block; + width: 50px; + height: 50px; + border-radius: 50%; +} +.inner-circles-loader:not(:required):before { + -moz-animation: inner-circles-loader 3s infinite; + -webkit-animation: inner-circles-loader 3s infinite; + animation: inner-circles-loader 3s infinite; + -moz-transform-origin: 0 50%; + -ms-transform-origin: 0 50%; + -webkit-transform-origin: 0 50%; + transform-origin: 0 50%; + left: 0; + background: #c7efcf; +} +.inner-circles-loader:not(:required):after { + -moz-animation: inner-circles-loader 3s 0.2s reverse infinite; + -webkit-animation: inner-circles-loader 3s 0.2s reverse infinite; + animation: inner-circles-loader 3s 0.2s reverse infinite; + -moz-transform-origin: 100% 50%; + -ms-transform-origin: 100% 50%; + -webkit-transform-origin: 100% 50%; + transform-origin: 100% 50%; + right: 0; + background: #eef5db; +} + +@-moz-keyframes inner-circles-loader { + 0% { + -moz-transform: rotate(0deg); + transform: rotate(0deg); + } + 50% { + -moz-transform: rotate(360deg); + transform: rotate(360deg); + } + 100% { + -moz-transform: rotate(0deg); + transform: rotate(0deg); + } +} +@-webkit-keyframes inner-circles-loader { + 0% { + -webkit-transform: rotate(0deg); + transform: rotate(0deg); + } + 50% { + -webkit-transform: rotate(360deg); + transform: rotate(360deg); + } + 100% { + -webkit-transform: rotate(0deg); + transform: rotate(0deg); + } +} +@keyframes inner-circles-loader { + 0% { + -moz-transform: rotate(0deg); + -ms-transform: rotate(0deg); + -webkit-transform: rotate(0deg); + transform: rotate(0deg); + } + 50% { + -moz-transform: rotate(360deg); + -ms-transform: rotate(360deg); + -webkit-transform: rotate(360deg); + transform: rotate(360deg); + } + 100% { + -moz-transform: rotate(0deg); + -ms-transform: rotate(0deg); + -webkit-transform: rotate(0deg); + transform: rotate(0deg); + } +} diff --git a/public/bower_components/css-spinners/plus-loader.css b/public/bower_components/css-spinners/plus-loader.css new file mode 100644 index 0000000..262a6ca --- /dev/null +++ b/public/bower_components/css-spinners/plus-loader.css @@ -0,0 +1,69 @@ +/* +Syntax error: Undefined mixin 'keyframes'. + on line 11 of /Users/jlong/Workspaces/spinners/sass/spinner/plus-loader.scss, in `keyframes' + from line 11 of /Users/jlong/Workspaces/spinners/sass/spinner/plus-loader.scss + +Backtrace: +/Users/jlong/Workspaces/spinners/sass/spinner/plus-loader.scss:11:in `keyframes' +/Users/jlong/Workspaces/spinners/sass/spinner/plus-loader.scss:11 +/Users/jlong/.rvm/gems/ruby-2.0.0-p0/gems/sass-3.2.8/lib/sass/tree/visitors/perform.rb:253:in `visit_mixin' +/Users/jlong/.rvm/gems/ruby-2.0.0-p0/gems/sass-3.2.8/lib/sass/tree/visitors/base.rb:37:in `visit' +/Users/jlong/.rvm/gems/ruby-2.0.0-p0/gems/sass-3.2.8/lib/sass/tree/visitors/perform.rb:100:in `visit' +/Users/jlong/.rvm/gems/ruby-2.0.0-p0/gems/sass-3.2.8/lib/sass/tree/visitors/base.rb:53:in `block in visit_children' +/Users/jlong/.rvm/gems/ruby-2.0.0-p0/gems/sass-3.2.8/lib/sass/tree/visitors/base.rb:53:in `map' +/Users/jlong/.rvm/gems/ruby-2.0.0-p0/gems/sass-3.2.8/lib/sass/tree/visitors/base.rb:53:in `visit_children' +/Users/jlong/.rvm/gems/ruby-2.0.0-p0/gems/sass-3.2.8/lib/sass/tree/visitors/perform.rb:109:in `block in visit_children' +/Users/jlong/.rvm/gems/ruby-2.0.0-p0/gems/sass-3.2.8/lib/sass/tree/visitors/perform.rb:121:in `with_environment' +/Users/jlong/.rvm/gems/ruby-2.0.0-p0/gems/sass-3.2.8/lib/sass/tree/visitors/perform.rb:108:in `visit_children' +/Users/jlong/.rvm/gems/ruby-2.0.0-p0/gems/sass-3.2.8/lib/sass/tree/visitors/base.rb:37:in `block in visit' +/Users/jlong/.rvm/gems/ruby-2.0.0-p0/gems/sass-3.2.8/lib/sass/tree/visitors/perform.rb:128:in `visit_root' +/Users/jlong/.rvm/gems/ruby-2.0.0-p0/gems/sass-3.2.8/lib/sass/tree/visitors/base.rb:37:in `visit' +/Users/jlong/.rvm/gems/ruby-2.0.0-p0/gems/sass-3.2.8/lib/sass/tree/visitors/perform.rb:100:in `visit' +/Users/jlong/.rvm/gems/ruby-2.0.0-p0/gems/sass-3.2.8/lib/sass/tree/visitors/perform.rb:7:in `visit' +/Users/jlong/.rvm/gems/ruby-2.0.0-p0/gems/sass-3.2.8/lib/sass/tree/root_node.rb:20:in `render' +/Users/jlong/.rvm/gems/ruby-2.0.0-p0/gems/sass-3.2.8/lib/sass/engine.rb:315:in `_render' +/Users/jlong/.rvm/gems/ruby-2.0.0-p0/gems/sass-3.2.8/lib/sass/engine.rb:262:in `render' +/Users/jlong/.rvm/gems/ruby-2.0.0-p0/gems/compass-0.12.2/lib/compass/compiler.rb:140:in `block (2 levels) in compile' +/Users/jlong/.rvm/gems/ruby-2.0.0-p0/gems/compass-0.12.2/lib/compass/compiler.rb:126:in `timed' +/Users/jlong/.rvm/gems/ruby-2.0.0-p0/gems/compass-0.12.2/lib/compass/compiler.rb:139:in `block in compile' +/Users/jlong/.rvm/gems/ruby-2.0.0-p0/gems/compass-0.12.2/lib/compass/logger.rb:45:in `red' +/Users/jlong/.rvm/gems/ruby-2.0.0-p0/gems/compass-0.12.2/lib/compass/compiler.rb:138:in `compile' +/Users/jlong/.rvm/gems/ruby-2.0.0-p0/gems/compass-0.12.2/lib/compass/compiler.rb:118:in `compile_if_required' +/Users/jlong/.rvm/gems/ruby-2.0.0-p0/gems/compass-0.12.2/lib/compass/compiler.rb:103:in `block (2 levels) in run' +/Users/jlong/.rvm/gems/ruby-2.0.0-p0/gems/compass-0.12.2/lib/compass/compiler.rb:101:in `each' +/Users/jlong/.rvm/gems/ruby-2.0.0-p0/gems/compass-0.12.2/lib/compass/compiler.rb:101:in `block in run' +/Users/jlong/.rvm/gems/ruby-2.0.0-p0/gems/compass-0.12.2/lib/compass/compiler.rb:126:in `timed' +/Users/jlong/.rvm/gems/ruby-2.0.0-p0/gems/compass-0.12.2/lib/compass/compiler.rb:100:in `run' +/Users/jlong/.rvm/gems/ruby-2.0.0-p0/gems/compass-0.12.2/lib/compass/commands/watch_project.rb:147:in `recompile' +/Users/jlong/.rvm/gems/ruby-2.0.0-p0/gems/fssm-0.2.10/lib/fssm/path.rb:73:in `call' +/Users/jlong/.rvm/gems/ruby-2.0.0-p0/gems/fssm-0.2.10/lib/fssm/path.rb:73:in `run_callback' +/Users/jlong/.rvm/gems/ruby-2.0.0-p0/gems/fssm-0.2.10/lib/fssm/path.rb:55:in `callback_action' +/Users/jlong/.rvm/gems/ruby-2.0.0-p0/gems/fssm-0.2.10/lib/fssm/path.rb:35:in `update' +/Users/jlong/.rvm/gems/ruby-2.0.0-p0/gems/fssm-0.2.10/lib/fssm/state/directory.rb:39:in `block in modified' +/Users/jlong/.rvm/gems/ruby-2.0.0-p0/gems/fssm-0.2.10/lib/fssm/state/directory.rb:37:in `each' +/Users/jlong/.rvm/gems/ruby-2.0.0-p0/gems/fssm-0.2.10/lib/fssm/state/directory.rb:37:in `modified' +/Users/jlong/.rvm/gems/ruby-2.0.0-p0/gems/fssm-0.2.10/lib/fssm/state/directory.rb:18:in `refresh' +/Users/jlong/.rvm/gems/ruby-2.0.0-p0/gems/fssm-0.2.10/lib/fssm/backends/polling.rb:17:in `block (2 levels) in run' +/Users/jlong/.rvm/gems/ruby-2.0.0-p0/gems/fssm-0.2.10/lib/fssm/backends/polling.rb:17:in `each' +/Users/jlong/.rvm/gems/ruby-2.0.0-p0/gems/fssm-0.2.10/lib/fssm/backends/polling.rb:17:in `block in run' +/Users/jlong/.rvm/gems/ruby-2.0.0-p0/gems/fssm-0.2.10/lib/fssm/backends/polling.rb:15:in `loop' +/Users/jlong/.rvm/gems/ruby-2.0.0-p0/gems/fssm-0.2.10/lib/fssm/backends/polling.rb:15:in `run' +/Users/jlong/.rvm/gems/ruby-2.0.0-p0/gems/fssm-0.2.10/lib/fssm/monitor.rb:26:in `run' +/Users/jlong/.rvm/gems/ruby-2.0.0-p0/gems/fssm-0.2.10/lib/fssm.rb:70:in `monitor' +/Users/jlong/.rvm/gems/ruby-2.0.0-p0/gems/compass-0.12.2/lib/compass/commands/watch_project.rb:87:in `perform' +/Users/jlong/.rvm/gems/ruby-2.0.0-p0/gems/compass-0.12.2/lib/compass/commands/base.rb:18:in `execute' +/Users/jlong/.rvm/gems/ruby-2.0.0-p0/gems/compass-0.12.2/lib/compass/commands/project_base.rb:19:in `execute' +/Users/jlong/.rvm/gems/ruby-2.0.0-p0/gems/compass-0.12.2/lib/compass/exec/sub_command_ui.rb:43:in `perform!' +/Users/jlong/.rvm/gems/ruby-2.0.0-p0/gems/compass-0.12.2/lib/compass/exec/sub_command_ui.rb:15:in `run!' +/Users/jlong/.rvm/gems/ruby-2.0.0-p0/gems/compass-0.12.2/bin/compass:30:in `block in ' +/Users/jlong/.rvm/gems/ruby-2.0.0-p0/gems/compass-0.12.2/bin/compass:44:in `call' +/Users/jlong/.rvm/gems/ruby-2.0.0-p0/gems/compass-0.12.2/bin/compass:44:in `' +/Users/jlong/.rvm/gems/ruby-2.0.0-p0/bin/compass:23:in `load' +/Users/jlong/.rvm/gems/ruby-2.0.0-p0/bin/compass:23:in `
          ' +/Users/jlong/.rvm/gems/ruby-2.0.0-p0/bin/ruby_noexec_wrapper:14:in `eval' +/Users/jlong/.rvm/gems/ruby-2.0.0-p0/bin/ruby_noexec_wrapper:14:in `
          ' +*/ +body:before { + white-space: pre; + font-family: monospace; + content: "Syntax error: Undefined mixin 'keyframes'.\A on line 11 of /Users/jlong/Workspaces/spinners/sass/spinner/plus-loader.scss, in `keyframes'\A from line 11 of /Users/jlong/Workspaces/spinners/sass/spinner/plus-loader.scss"; } diff --git a/public/bower_components/css-spinners/plus.css b/public/bower_components/css-spinners/plus.css new file mode 100644 index 0000000..31d36a6 --- /dev/null +++ b/public/bower_components/css-spinners/plus.css @@ -0,0 +1,671 @@ +@-moz-keyframes plus-loader-top { + 2.5% { + background: #f86; + -moz-transform: rotateY(0deg); + transform: rotateY(0deg); + -moz-animation-timing-function: ease-in; + animation-timing-function: ease-in; + } + 13.75% { + background: #ff430d; + -moz-transform: rotateY(90deg); + transform: rotateY(90deg); + -moz-animation-timing-function: step-start; + animation-timing-function: step-start; + } + 13.76% { + background: #ffae0d; + -moz-transform: rotateY(90deg); + transform: rotateY(90deg); + -moz-animation-timing-function: ease-out; + animation-timing-function: ease-out; + } + 25% { + background: #fc6; + -moz-transform: rotateY(180deg); + transform: rotateY(180deg); + } + 27.5% { + background: #fc6; + -moz-transform: rotateY(180deg); + transform: rotateY(180deg); + -moz-animation-timing-function: ease-in; + animation-timing-function: ease-in; + } + 41.25% { + background: #ffae0d; + -moz-transform: rotateY(90deg); + transform: rotateY(90deg); + -moz-animation-timing-function: step-start; + animation-timing-function: step-start; + } + 41.26% { + background: #2cc642; + -moz-transform: rotateY(90deg); + transform: rotateY(90deg); + -moz-animation-timing-function: ease-out; + animation-timing-function: ease-out; + } + 50% { + background: #6d7; + -moz-transform: rotateY(0deg); + transform: rotateY(0deg); + } + 52.5% { + background: #6d7; + -moz-transform: rotateY(0deg); + transform: rotateY(0deg); + -moz-animation-timing-function: ease-in; + animation-timing-function: ease-in; + } + 63.75% { + background: #2cc642; + -moz-transform: rotateY(90deg); + transform: rotateY(90deg); + -moz-animation-timing-function: step-start; + animation-timing-function: step-start; + } + 63.76% { + background: #1386d2; + -moz-transform: rotateY(90deg); + transform: rotateY(90deg); + -moz-animation-timing-function: ease-out; + animation-timing-function: ease-out; + } + 75% { + background: #4ae; + -moz-transform: rotateY(180deg); + transform: rotateY(180deg); + } + 77.5% { + background: #4ae; + -moz-transform: rotateY(180deg); + transform: rotateY(180deg); + -moz-animation-timing-function: ease-in; + animation-timing-function: ease-in; + } + 91.25% { + background: #1386d2; + -moz-transform: rotateY(90deg); + transform: rotateY(90deg); + -moz-animation-timing-function: step-start; + animation-timing-function: step-start; + } + 91.26% { + background: #ff430d; + -moz-transform: rotateY(90deg); + transform: rotateY(90deg); + -moz-animation-timing-function: ease-in; + animation-timing-function: ease-in; + } + 100% { + background: #f86; + -moz-transform: rotateY(0deg); + transform: rotateY(0deg); + -moz-animation-timing-function: step-start; + animation-timing-function: step-start; + } +} +@-webkit-keyframes plus-loader-top { + 2.5% { + background: #f86; + -webkit-transform: rotateY(0deg); + transform: rotateY(0deg); + -webkit-animation-timing-function: ease-in; + animation-timing-function: ease-in; + } + 13.75% { + background: #ff430d; + -webkit-transform: rotateY(90deg); + transform: rotateY(90deg); + -webkit-animation-timing-function: step-start; + animation-timing-function: step-start; + } + 13.76% { + background: #ffae0d; + -webkit-transform: rotateY(90deg); + transform: rotateY(90deg); + -webkit-animation-timing-function: ease-out; + animation-timing-function: ease-out; + } + 25% { + background: #fc6; + -webkit-transform: rotateY(180deg); + transform: rotateY(180deg); + } + 27.5% { + background: #fc6; + -webkit-transform: rotateY(180deg); + transform: rotateY(180deg); + -webkit-animation-timing-function: ease-in; + animation-timing-function: ease-in; + } + 41.25% { + background: #ffae0d; + -webkit-transform: rotateY(90deg); + transform: rotateY(90deg); + -webkit-animation-timing-function: step-start; + animation-timing-function: step-start; + } + 41.26% { + background: #2cc642; + -webkit-transform: rotateY(90deg); + transform: rotateY(90deg); + -webkit-animation-timing-function: ease-out; + animation-timing-function: ease-out; + } + 50% { + background: #6d7; + -webkit-transform: rotateY(0deg); + transform: rotateY(0deg); + } + 52.5% { + background: #6d7; + -webkit-transform: rotateY(0deg); + transform: rotateY(0deg); + -webkit-animation-timing-function: ease-in; + animation-timing-function: ease-in; + } + 63.75% { + background: #2cc642; + -webkit-transform: rotateY(90deg); + transform: rotateY(90deg); + -webkit-animation-timing-function: step-start; + animation-timing-function: step-start; + } + 63.76% { + background: #1386d2; + -webkit-transform: rotateY(90deg); + transform: rotateY(90deg); + -webkit-animation-timing-function: ease-out; + animation-timing-function: ease-out; + } + 75% { + background: #4ae; + -webkit-transform: rotateY(180deg); + transform: rotateY(180deg); + } + 77.5% { + background: #4ae; + -webkit-transform: rotateY(180deg); + transform: rotateY(180deg); + -webkit-animation-timing-function: ease-in; + animation-timing-function: ease-in; + } + 91.25% { + background: #1386d2; + -webkit-transform: rotateY(90deg); + transform: rotateY(90deg); + -webkit-animation-timing-function: step-start; + animation-timing-function: step-start; + } + 91.26% { + background: #ff430d; + -webkit-transform: rotateY(90deg); + transform: rotateY(90deg); + -webkit-animation-timing-function: ease-in; + animation-timing-function: ease-in; + } + 100% { + background: #f86; + -webkit-transform: rotateY(0deg); + transform: rotateY(0deg); + -webkit-animation-timing-function: step-start; + animation-timing-function: step-start; + } +} +@keyframes plus-loader-top { + 2.5% { + background: #f86; + -moz-transform: rotateY(0deg); + -ms-transform: rotateY(0deg); + -webkit-transform: rotateY(0deg); + transform: rotateY(0deg); + -moz-animation-timing-function: ease-in; + -webkit-animation-timing-function: ease-in; + animation-timing-function: ease-in; + } + 13.75% { + background: #ff430d; + -moz-transform: rotateY(90deg); + -ms-transform: rotateY(90deg); + -webkit-transform: rotateY(90deg); + transform: rotateY(90deg); + -moz-animation-timing-function: step-start; + -webkit-animation-timing-function: step-start; + animation-timing-function: step-start; + } + 13.76% { + background: #ffae0d; + -moz-transform: rotateY(90deg); + -ms-transform: rotateY(90deg); + -webkit-transform: rotateY(90deg); + transform: rotateY(90deg); + -moz-animation-timing-function: ease-out; + -webkit-animation-timing-function: ease-out; + animation-timing-function: ease-out; + } + 25% { + background: #fc6; + -moz-transform: rotateY(180deg); + -ms-transform: rotateY(180deg); + -webkit-transform: rotateY(180deg); + transform: rotateY(180deg); + } + 27.5% { + background: #fc6; + -moz-transform: rotateY(180deg); + -ms-transform: rotateY(180deg); + -webkit-transform: rotateY(180deg); + transform: rotateY(180deg); + -moz-animation-timing-function: ease-in; + -webkit-animation-timing-function: ease-in; + animation-timing-function: ease-in; + } + 41.25% { + background: #ffae0d; + -moz-transform: rotateY(90deg); + -ms-transform: rotateY(90deg); + -webkit-transform: rotateY(90deg); + transform: rotateY(90deg); + -moz-animation-timing-function: step-start; + -webkit-animation-timing-function: step-start; + animation-timing-function: step-start; + } + 41.26% { + background: #2cc642; + -moz-transform: rotateY(90deg); + -ms-transform: rotateY(90deg); + -webkit-transform: rotateY(90deg); + transform: rotateY(90deg); + -moz-animation-timing-function: ease-out; + -webkit-animation-timing-function: ease-out; + animation-timing-function: ease-out; + } + 50% { + background: #6d7; + -moz-transform: rotateY(0deg); + -ms-transform: rotateY(0deg); + -webkit-transform: rotateY(0deg); + transform: rotateY(0deg); + } + 52.5% { + background: #6d7; + -moz-transform: rotateY(0deg); + -ms-transform: rotateY(0deg); + -webkit-transform: rotateY(0deg); + transform: rotateY(0deg); + -moz-animation-timing-function: ease-in; + -webkit-animation-timing-function: ease-in; + animation-timing-function: ease-in; + } + 63.75% { + background: #2cc642; + -moz-transform: rotateY(90deg); + -ms-transform: rotateY(90deg); + -webkit-transform: rotateY(90deg); + transform: rotateY(90deg); + -moz-animation-timing-function: step-start; + -webkit-animation-timing-function: step-start; + animation-timing-function: step-start; + } + 63.76% { + background: #1386d2; + -moz-transform: rotateY(90deg); + -ms-transform: rotateY(90deg); + -webkit-transform: rotateY(90deg); + transform: rotateY(90deg); + -moz-animation-timing-function: ease-out; + -webkit-animation-timing-function: ease-out; + animation-timing-function: ease-out; + } + 75% { + background: #4ae; + -moz-transform: rotateY(180deg); + -ms-transform: rotateY(180deg); + -webkit-transform: rotateY(180deg); + transform: rotateY(180deg); + } + 77.5% { + background: #4ae; + -moz-transform: rotateY(180deg); + -ms-transform: rotateY(180deg); + -webkit-transform: rotateY(180deg); + transform: rotateY(180deg); + -moz-animation-timing-function: ease-in; + -webkit-animation-timing-function: ease-in; + animation-timing-function: ease-in; + } + 91.25% { + background: #1386d2; + -moz-transform: rotateY(90deg); + -ms-transform: rotateY(90deg); + -webkit-transform: rotateY(90deg); + transform: rotateY(90deg); + -moz-animation-timing-function: step-start; + -webkit-animation-timing-function: step-start; + animation-timing-function: step-start; + } + 91.26% { + background: #ff430d; + -moz-transform: rotateY(90deg); + -ms-transform: rotateY(90deg); + -webkit-transform: rotateY(90deg); + transform: rotateY(90deg); + -moz-animation-timing-function: ease-in; + -webkit-animation-timing-function: ease-in; + animation-timing-function: ease-in; + } + 100% { + background: #f86; + -moz-transform: rotateY(0deg); + -ms-transform: rotateY(0deg); + -webkit-transform: rotateY(0deg); + transform: rotateY(0deg); + -moz-animation-timing-function: step-start; + -webkit-animation-timing-function: step-start; + animation-timing-function: step-start; + } +} +@-moz-keyframes plus-loader-bottom { + 0% { + background: #fc6; + -moz-animation-timing-function: step-start; + animation-timing-function: step-start; + } + 50% { + background: #fc6; + -moz-animation-timing-function: step-start; + animation-timing-function: step-start; + } + 75% { + background: #4ae; + -moz-animation-timing-function: step-start; + animation-timing-function: step-start; + } + 100% { + background: #4ae; + -moz-animation-timing-function: step-start; + animation-timing-function: step-start; + } +} +@-webkit-keyframes plus-loader-bottom { + 0% { + background: #fc6; + -webkit-animation-timing-function: step-start; + animation-timing-function: step-start; + } + 50% { + background: #fc6; + -webkit-animation-timing-function: step-start; + animation-timing-function: step-start; + } + 75% { + background: #4ae; + -webkit-animation-timing-function: step-start; + animation-timing-function: step-start; + } + 100% { + background: #4ae; + -webkit-animation-timing-function: step-start; + animation-timing-function: step-start; + } +} +@keyframes plus-loader-bottom { + 0% { + background: #fc6; + -moz-animation-timing-function: step-start; + -webkit-animation-timing-function: step-start; + animation-timing-function: step-start; + } + 50% { + background: #fc6; + -moz-animation-timing-function: step-start; + -webkit-animation-timing-function: step-start; + animation-timing-function: step-start; + } + 75% { + background: #4ae; + -moz-animation-timing-function: step-start; + -webkit-animation-timing-function: step-start; + animation-timing-function: step-start; + } + 100% { + background: #4ae; + -moz-animation-timing-function: step-start; + -webkit-animation-timing-function: step-start; + animation-timing-function: step-start; + } +} +@-moz-keyframes plus-loader-background { + 0% { + background: #f86; + -moz-transform: rotateZ(180deg); + transform: rotateZ(180deg); + } + 25% { + background: #f86; + -moz-transform: rotateZ(180deg); + transform: rotateZ(180deg); + -moz-animation-timing-function: step-start; + animation-timing-function: step-start; + } + 27.5% { + background: #6d7; + -moz-transform: rotateZ(90deg); + transform: rotateZ(90deg); + } + 50% { + background: #6d7; + -moz-transform: rotateZ(90deg); + transform: rotateZ(90deg); + -moz-animation-timing-function: step-start; + animation-timing-function: step-start; + } + 52.5% { + background: #6d7; + -moz-transform: rotateZ(0deg); + transform: rotateZ(0deg); + } + 75% { + background: #6d7; + -moz-transform: rotateZ(0deg); + transform: rotateZ(0deg); + -moz-animation-timing-function: step-start; + animation-timing-function: step-start; + } + 77.5% { + background: #f86; + -moz-transform: rotateZ(270deg); + transform: rotateZ(270deg); + } + 100% { + background: #f86; + -moz-transform: rotateZ(270deg); + transform: rotateZ(270deg); + -moz-animation-timing-function: step-start; + animation-timing-function: step-start; + } +} +@-webkit-keyframes plus-loader-background { + 0% { + background: #f86; + -webkit-transform: rotateZ(180deg); + transform: rotateZ(180deg); + } + 25% { + background: #f86; + -webkit-transform: rotateZ(180deg); + transform: rotateZ(180deg); + -webkit-animation-timing-function: step-start; + animation-timing-function: step-start; + } + 27.5% { + background: #6d7; + -webkit-transform: rotateZ(90deg); + transform: rotateZ(90deg); + } + 50% { + background: #6d7; + -webkit-transform: rotateZ(90deg); + transform: rotateZ(90deg); + -webkit-animation-timing-function: step-start; + animation-timing-function: step-start; + } + 52.5% { + background: #6d7; + -webkit-transform: rotateZ(0deg); + transform: rotateZ(0deg); + } + 75% { + background: #6d7; + -webkit-transform: rotateZ(0deg); + transform: rotateZ(0deg); + -webkit-animation-timing-function: step-start; + animation-timing-function: step-start; + } + 77.5% { + background: #f86; + -webkit-transform: rotateZ(270deg); + transform: rotateZ(270deg); + } + 100% { + background: #f86; + -webkit-transform: rotateZ(270deg); + transform: rotateZ(270deg); + -webkit-animation-timing-function: step-start; + animation-timing-function: step-start; + } +} +@keyframes plus-loader-background { + 0% { + background: #f86; + -moz-transform: rotateZ(180deg); + -ms-transform: rotateZ(180deg); + -webkit-transform: rotateZ(180deg); + transform: rotateZ(180deg); + } + 25% { + background: #f86; + -moz-transform: rotateZ(180deg); + -ms-transform: rotateZ(180deg); + -webkit-transform: rotateZ(180deg); + transform: rotateZ(180deg); + -moz-animation-timing-function: step-start; + -webkit-animation-timing-function: step-start; + animation-timing-function: step-start; + } + 27.5% { + background: #6d7; + -moz-transform: rotateZ(90deg); + -ms-transform: rotateZ(90deg); + -webkit-transform: rotateZ(90deg); + transform: rotateZ(90deg); + } + 50% { + background: #6d7; + -moz-transform: rotateZ(90deg); + -ms-transform: rotateZ(90deg); + -webkit-transform: rotateZ(90deg); + transform: rotateZ(90deg); + -moz-animation-timing-function: step-start; + -webkit-animation-timing-function: step-start; + animation-timing-function: step-start; + } + 52.5% { + background: #6d7; + -moz-transform: rotateZ(0deg); + -ms-transform: rotateZ(0deg); + -webkit-transform: rotateZ(0deg); + transform: rotateZ(0deg); + } + 75% { + background: #6d7; + -moz-transform: rotateZ(0deg); + -ms-transform: rotateZ(0deg); + -webkit-transform: rotateZ(0deg); + transform: rotateZ(0deg); + -moz-animation-timing-function: step-start; + -webkit-animation-timing-function: step-start; + animation-timing-function: step-start; + } + 77.5% { + background: #f86; + -moz-transform: rotateZ(270deg); + -ms-transform: rotateZ(270deg); + -webkit-transform: rotateZ(270deg); + transform: rotateZ(270deg); + } + 100% { + background: #f86; + -moz-transform: rotateZ(270deg); + -ms-transform: rotateZ(270deg); + -webkit-transform: rotateZ(270deg); + transform: rotateZ(270deg); + -moz-animation-timing-function: step-start; + -webkit-animation-timing-function: step-start; + animation-timing-function: step-start; + } +} +/* :not(:required) hides this rule from IE9 and below */ +.plus-loader:not(:required) { + overflow: hidden; + position: relative; + text-indent: -9999px; + display: inline-block; + width: 48px; + height: 48px; + background: #f86; + -moz-border-radius: 24px; + -webkit-border-radius: 24px; + border-radius: 24px; + -moz-transform: rotateZ(90deg); + -ms-transform: rotateZ(90deg); + -webkit-transform: rotateZ(90deg); + transform: rotateZ(90deg); + -moz-transform-origin: 50% 50%; + -ms-transform-origin: 50% 50%; + -webkit-transform-origin: 50% 50%; + transform-origin: 50% 50%; + -moz-animation: plus-loader-background 3s infinite ease-in-out; + -webkit-animation: plus-loader-background 3s infinite ease-in-out; + animation: plus-loader-background 3s infinite ease-in-out; +} +.plus-loader:not(:required)::after { + background: #f86; + -moz-border-radius: 24px 0 0 24px; + -webkit-border-radius: 24px; + border-radius: 24px 0 0 24px; + content: ''; + position: absolute; + right: 50%; + top: 0; + width: 50%; + height: 100%; + -moz-transform-origin: 100% 50%; + -ms-transform-origin: 100% 50%; + -webkit-transform-origin: 100% 50%; + transform-origin: 100% 50%; + -moz-animation: plus-loader-top 3s infinite linear; + -webkit-animation: plus-loader-top 3s infinite linear; + animation: plus-loader-top 3s infinite linear; +} +.plus-loader:not(:required)::before { + background: #fc6; + -moz-border-radius: 24px 0 0 24px; + -webkit-border-radius: 24px; + border-radius: 24px 0 0 24px; + content: ''; + position: absolute; + right: 50%; + top: 0; + width: 50%; + height: 100%; + -moz-transform-origin: 100% 50%; + -ms-transform-origin: 100% 50%; + -webkit-transform-origin: 100% 50%; + transform-origin: 100% 50%; + -moz-animation: plus-loader-bottom 3s infinite linear; + -webkit-animation: plus-loader-bottom 3s infinite linear; + animation: plus-loader-bottom 3s infinite linear; +} diff --git a/public/bower_components/css-spinners/pong.css b/public/bower_components/css-spinners/pong.css new file mode 100644 index 0000000..e329ab4 --- /dev/null +++ b/public/bower_components/css-spinners/pong.css @@ -0,0 +1,274 @@ +@-moz-keyframes pong-loader { + 0% { + left: 5px; + top: 0; + } + 25% { + left: 65px; + top: 20px; + } + 50% { + left: 5px; + } + 62.5% { + top: 50px; + } + 75% { + left: 65px; + top: 70%; + } + 100% { + left: 5px; + top: 0%; + } +} +@-webkit-keyframes pong-loader { + 0% { + left: 5px; + top: 0; + } + 25% { + left: 65px; + top: 20px; + } + 50% { + left: 5px; + } + 62.5% { + top: 50px; + } + 75% { + left: 65px; + top: 70%; + } + 100% { + left: 5px; + top: 0%; + } +} +@keyframes pong-loader { + 0% { + left: 5px; + top: 0; + } + 25% { + left: 65px; + top: 20px; + } + 50% { + left: 5px; + } + 62.5% { + top: 50px; + } + 75% { + left: 65px; + top: 70%; + } + 100% { + left: 5px; + top: 0%; + } +} +@-moz-keyframes pong-loader-paddle-1 { + 0% { + -moz-box-shadow: inset #353c39 0 5px 0 0, inset #353c39 0 -35px 0 0, inset #353c39 -3px 0 0 0, inset #8cdb8b -10px 0 0 0; + box-shadow: inset #353c39 0 5px 0 0, inset #353c39 0 -35px 0 0, inset #353c39 -3px 0 0 0, inset #8cdb8b -10px 0 0 0; + } + 25% { + -moz-box-shadow: inset #353c39 0 15px 0 0, inset #353c39 0 -25px 0 0, inset #353c39 -3px 0 0 0, inset #8cdb8b -10px 0 0 0; + box-shadow: inset #353c39 0 15px 0 0, inset #353c39 0 -25px 0 0, inset #353c39 -3px 0 0 0, inset #8cdb8b -10px 0 0 0; + } + 50% { + -moz-box-shadow: inset #353c39 0 0 0 0, inset #353c39 0 -40px 0 0, inset #353c39 -3px 0 0 0, inset #8cdb8b -10px 0 0 0; + box-shadow: inset #353c39 0 0 0 0, inset #353c39 0 -40px 0 0, inset #353c39 -3px 0 0 0, inset #8cdb8b -10px 0 0 0; + } + 62.5% { + -moz-box-shadow: inset #353c39 0 10px 0 0, inset #353c39 0 -30px 0 0, inset #353c39 -3px 0 0 0, inset #8cdb8b -10px 0 0 0; + box-shadow: inset #353c39 0 10px 0 0, inset #353c39 0 -30px 0 0, inset #353c39 -3px 0 0 0, inset #8cdb8b -10px 0 0 0; + } + 75% { + -moz-box-shadow: inset #353c39 0 40px 0 0, inset #353c39 0 0 0 0, inset #353c39 -3px 0 0 0, inset #8cdb8b -10px 0 0 0; + box-shadow: inset #353c39 0 40px 0 0, inset #353c39 0 0 0 0, inset #353c39 -3px 0 0 0, inset #8cdb8b -10px 0 0 0; + } + 100% { + -moz-box-shadow: inset #353c39 0 5px 0 0, inset #353c39 0 -35px 0 0, inset #353c39 -3px 0 0 0, inset #8cdb8b -10px 0 0 0; + box-shadow: inset #353c39 0 5px 0 0, inset #353c39 0 -35px 0 0, inset #353c39 -3px 0 0 0, inset #8cdb8b -10px 0 0 0; + } +} +@-webkit-keyframes pong-loader-paddle-1 { + 0% { + -webkit-box-shadow: inset #353c39 0 5px 0 0, inset #353c39 0 -35px 0 0, inset #353c39 -3px 0 0 0, inset #8cdb8b -10px 0 0 0; + box-shadow: inset #353c39 0 5px 0 0, inset #353c39 0 -35px 0 0, inset #353c39 -3px 0 0 0, inset #8cdb8b -10px 0 0 0; + } + 25% { + -webkit-box-shadow: inset #353c39 0 15px 0 0, inset #353c39 0 -25px 0 0, inset #353c39 -3px 0 0 0, inset #8cdb8b -10px 0 0 0; + box-shadow: inset #353c39 0 15px 0 0, inset #353c39 0 -25px 0 0, inset #353c39 -3px 0 0 0, inset #8cdb8b -10px 0 0 0; + } + 50% { + -webkit-box-shadow: inset #353c39 0 0 0 0, inset #353c39 0 -40px 0 0, inset #353c39 -3px 0 0 0, inset #8cdb8b -10px 0 0 0; + box-shadow: inset #353c39 0 0 0 0, inset #353c39 0 -40px 0 0, inset #353c39 -3px 0 0 0, inset #8cdb8b -10px 0 0 0; + } + 62.5% { + -webkit-box-shadow: inset #353c39 0 10px 0 0, inset #353c39 0 -30px 0 0, inset #353c39 -3px 0 0 0, inset #8cdb8b -10px 0 0 0; + box-shadow: inset #353c39 0 10px 0 0, inset #353c39 0 -30px 0 0, inset #353c39 -3px 0 0 0, inset #8cdb8b -10px 0 0 0; + } + 75% { + -webkit-box-shadow: inset #353c39 0 40px 0 0, inset #353c39 0 0 0 0, inset #353c39 -3px 0 0 0, inset #8cdb8b -10px 0 0 0; + box-shadow: inset #353c39 0 40px 0 0, inset #353c39 0 0 0 0, inset #353c39 -3px 0 0 0, inset #8cdb8b -10px 0 0 0; + } + 100% { + -webkit-box-shadow: inset #353c39 0 5px 0 0, inset #353c39 0 -35px 0 0, inset #353c39 -3px 0 0 0, inset #8cdb8b -10px 0 0 0; + box-shadow: inset #353c39 0 5px 0 0, inset #353c39 0 -35px 0 0, inset #353c39 -3px 0 0 0, inset #8cdb8b -10px 0 0 0; + } +} +@keyframes pong-loader-paddle-1 { + 0% { + -moz-box-shadow: inset #353c39 0 5px 0 0, inset #353c39 0 -35px 0 0, inset #353c39 -3px 0 0 0, inset #8cdb8b -10px 0 0 0; + -webkit-box-shadow: inset #353c39 0 5px 0 0, inset #353c39 0 -35px 0 0, inset #353c39 -3px 0 0 0, inset #8cdb8b -10px 0 0 0; + box-shadow: inset #353c39 0 5px 0 0, inset #353c39 0 -35px 0 0, inset #353c39 -3px 0 0 0, inset #8cdb8b -10px 0 0 0; + } + 25% { + -moz-box-shadow: inset #353c39 0 15px 0 0, inset #353c39 0 -25px 0 0, inset #353c39 -3px 0 0 0, inset #8cdb8b -10px 0 0 0; + -webkit-box-shadow: inset #353c39 0 15px 0 0, inset #353c39 0 -25px 0 0, inset #353c39 -3px 0 0 0, inset #8cdb8b -10px 0 0 0; + box-shadow: inset #353c39 0 15px 0 0, inset #353c39 0 -25px 0 0, inset #353c39 -3px 0 0 0, inset #8cdb8b -10px 0 0 0; + } + 50% { + -moz-box-shadow: inset #353c39 0 0 0 0, inset #353c39 0 -40px 0 0, inset #353c39 -3px 0 0 0, inset #8cdb8b -10px 0 0 0; + -webkit-box-shadow: inset #353c39 0 0 0 0, inset #353c39 0 -40px 0 0, inset #353c39 -3px 0 0 0, inset #8cdb8b -10px 0 0 0; + box-shadow: inset #353c39 0 0 0 0, inset #353c39 0 -40px 0 0, inset #353c39 -3px 0 0 0, inset #8cdb8b -10px 0 0 0; + } + 62.5% { + -moz-box-shadow: inset #353c39 0 10px 0 0, inset #353c39 0 -30px 0 0, inset #353c39 -3px 0 0 0, inset #8cdb8b -10px 0 0 0; + -webkit-box-shadow: inset #353c39 0 10px 0 0, inset #353c39 0 -30px 0 0, inset #353c39 -3px 0 0 0, inset #8cdb8b -10px 0 0 0; + box-shadow: inset #353c39 0 10px 0 0, inset #353c39 0 -30px 0 0, inset #353c39 -3px 0 0 0, inset #8cdb8b -10px 0 0 0; + } + 75% { + -moz-box-shadow: inset #353c39 0 40px 0 0, inset #353c39 0 0 0 0, inset #353c39 -3px 0 0 0, inset #8cdb8b -10px 0 0 0; + -webkit-box-shadow: inset #353c39 0 40px 0 0, inset #353c39 0 0 0 0, inset #353c39 -3px 0 0 0, inset #8cdb8b -10px 0 0 0; + box-shadow: inset #353c39 0 40px 0 0, inset #353c39 0 0 0 0, inset #353c39 -3px 0 0 0, inset #8cdb8b -10px 0 0 0; + } + 100% { + -moz-box-shadow: inset #353c39 0 5px 0 0, inset #353c39 0 -35px 0 0, inset #353c39 -3px 0 0 0, inset #8cdb8b -10px 0 0 0; + -webkit-box-shadow: inset #353c39 0 5px 0 0, inset #353c39 0 -35px 0 0, inset #353c39 -3px 0 0 0, inset #8cdb8b -10px 0 0 0; + box-shadow: inset #353c39 0 5px 0 0, inset #353c39 0 -35px 0 0, inset #353c39 -3px 0 0 0, inset #8cdb8b -10px 0 0 0; + } +} +@-moz-keyframes pong-loader-paddle-2 { + 0% { + -moz-box-shadow: inset #353c39 0 0 0 0, inset #353c39 0 -40px 0 0, inset #353c39 3px 0 0 0, inset #8cdb8b -10px 0 0 0; + box-shadow: inset #353c39 0 0 0 0, inset #353c39 0 -40px 0 0, inset #353c39 3px 0 0 0, inset #8cdb8b -10px 0 0 0; + } + 50% { + -moz-box-shadow: inset #353c39 0 30px 0 0, inset #353c39 0 -10px 0 0, inset #353c39 3px 0 0 0, inset #8cdb8b -10px 0 0 0; + box-shadow: inset #353c39 0 30px 0 0, inset #353c39 0 -10px 0 0, inset #353c39 3px 0 0 0, inset #8cdb8b -10px 0 0 0; + } + 62.5% { + -moz-box-shadow: inset #353c39 0 40px 0 0, inset #353c39 0 0 0 0, inset #353c39 3px 0 0 0, inset #8cdb8b -10px 0 0 0; + box-shadow: inset #353c39 0 40px 0 0, inset #353c39 0 0 0 0, inset #353c39 3px 0 0 0, inset #8cdb8b -10px 0 0 0; + } + 75% { + -moz-box-shadow: inset #353c39 0 20px 0 0, inset #353c39 0 -20px 0 0, inset #353c39 3px 0 0 0, inset #8cdb8b -10px 0 0 0; + box-shadow: inset #353c39 0 20px 0 0, inset #353c39 0 -20px 0 0, inset #353c39 3px 0 0 0, inset #8cdb8b -10px 0 0 0; + } + 100% { + -moz-box-shadow: inset #353c39 0 0 0 0, inset #353c39 0 -40px 0 0, inset #353c39 3px 0 0 0, inset #8cdb8b -10px 0 0 0; + box-shadow: inset #353c39 0 0 0 0, inset #353c39 0 -40px 0 0, inset #353c39 3px 0 0 0, inset #8cdb8b -10px 0 0 0; + } +} +@-webkit-keyframes pong-loader-paddle-2 { + 0% { + -webkit-box-shadow: inset #353c39 0 0 0 0, inset #353c39 0 -40px 0 0, inset #353c39 3px 0 0 0, inset #8cdb8b -10px 0 0 0; + box-shadow: inset #353c39 0 0 0 0, inset #353c39 0 -40px 0 0, inset #353c39 3px 0 0 0, inset #8cdb8b -10px 0 0 0; + } + 50% { + -webkit-box-shadow: inset #353c39 0 30px 0 0, inset #353c39 0 -10px 0 0, inset #353c39 3px 0 0 0, inset #8cdb8b -10px 0 0 0; + box-shadow: inset #353c39 0 30px 0 0, inset #353c39 0 -10px 0 0, inset #353c39 3px 0 0 0, inset #8cdb8b -10px 0 0 0; + } + 62.5% { + -webkit-box-shadow: inset #353c39 0 40px 0 0, inset #353c39 0 0 0 0, inset #353c39 3px 0 0 0, inset #8cdb8b -10px 0 0 0; + box-shadow: inset #353c39 0 40px 0 0, inset #353c39 0 0 0 0, inset #353c39 3px 0 0 0, inset #8cdb8b -10px 0 0 0; + } + 75% { + -webkit-box-shadow: inset #353c39 0 20px 0 0, inset #353c39 0 -20px 0 0, inset #353c39 3px 0 0 0, inset #8cdb8b -10px 0 0 0; + box-shadow: inset #353c39 0 20px 0 0, inset #353c39 0 -20px 0 0, inset #353c39 3px 0 0 0, inset #8cdb8b -10px 0 0 0; + } + 100% { + -webkit-box-shadow: inset #353c39 0 0 0 0, inset #353c39 0 -40px 0 0, inset #353c39 3px 0 0 0, inset #8cdb8b -10px 0 0 0; + box-shadow: inset #353c39 0 0 0 0, inset #353c39 0 -40px 0 0, inset #353c39 3px 0 0 0, inset #8cdb8b -10px 0 0 0; + } +} +@keyframes pong-loader-paddle-2 { + 0% { + -moz-box-shadow: inset #353c39 0 0 0 0, inset #353c39 0 -40px 0 0, inset #353c39 3px 0 0 0, inset #8cdb8b -10px 0 0 0; + -webkit-box-shadow: inset #353c39 0 0 0 0, inset #353c39 0 -40px 0 0, inset #353c39 3px 0 0 0, inset #8cdb8b -10px 0 0 0; + box-shadow: inset #353c39 0 0 0 0, inset #353c39 0 -40px 0 0, inset #353c39 3px 0 0 0, inset #8cdb8b -10px 0 0 0; + } + 50% { + -moz-box-shadow: inset #353c39 0 30px 0 0, inset #353c39 0 -10px 0 0, inset #353c39 3px 0 0 0, inset #8cdb8b -10px 0 0 0; + -webkit-box-shadow: inset #353c39 0 30px 0 0, inset #353c39 0 -10px 0 0, inset #353c39 3px 0 0 0, inset #8cdb8b -10px 0 0 0; + box-shadow: inset #353c39 0 30px 0 0, inset #353c39 0 -10px 0 0, inset #353c39 3px 0 0 0, inset #8cdb8b -10px 0 0 0; + } + 62.5% { + -moz-box-shadow: inset #353c39 0 40px 0 0, inset #353c39 0 0 0 0, inset #353c39 3px 0 0 0, inset #8cdb8b -10px 0 0 0; + -webkit-box-shadow: inset #353c39 0 40px 0 0, inset #353c39 0 0 0 0, inset #353c39 3px 0 0 0, inset #8cdb8b -10px 0 0 0; + box-shadow: inset #353c39 0 40px 0 0, inset #353c39 0 0 0 0, inset #353c39 3px 0 0 0, inset #8cdb8b -10px 0 0 0; + } + 75% { + -moz-box-shadow: inset #353c39 0 20px 0 0, inset #353c39 0 -20px 0 0, inset #353c39 3px 0 0 0, inset #8cdb8b -10px 0 0 0; + -webkit-box-shadow: inset #353c39 0 20px 0 0, inset #353c39 0 -20px 0 0, inset #353c39 3px 0 0 0, inset #8cdb8b -10px 0 0 0; + box-shadow: inset #353c39 0 20px 0 0, inset #353c39 0 -20px 0 0, inset #353c39 3px 0 0 0, inset #8cdb8b -10px 0 0 0; + } + 100% { + -moz-box-shadow: inset #353c39 0 0 0 0, inset #353c39 0 -40px 0 0, inset #353c39 3px 0 0 0, inset #8cdb8b -10px 0 0 0; + -webkit-box-shadow: inset #353c39 0 0 0 0, inset #353c39 0 -40px 0 0, inset #353c39 3px 0 0 0, inset #8cdb8b -10px 0 0 0; + box-shadow: inset #353c39 0 0 0 0, inset #353c39 0 -40px 0 0, inset #353c39 3px 0 0 0, inset #8cdb8b -10px 0 0 0; + } +} +/* :not(:required) hides this rule from IE9 and below */ +.pong-loader:not(:required) { + width: 80px; + height: 60px; + background: #353c39; + position: relative; + display: inline-block; + overflow: hidden; + text-indent: 100%; + -moz-box-shadow: inset #353c39 0 0 0 0, inset #353c39 0 -40px 0 0, inset #353c39 -3px 0 0 0, inset #8cdb8b -10px 0 0 0; + -webkit-box-shadow: inset #353c39 0 0 0 0, inset #353c39 0 -40px 0 0, inset #353c39 -3px 0 0 0, inset #8cdb8b -10px 0 0 0; + box-shadow: inset #353c39 0 0 0 0, inset #353c39 0 -40px 0 0, inset #353c39 -3px 0 0 0, inset #8cdb8b -10px 0 0 0; + -moz-animation: pong-loader-paddle-1 1500ms infinite linear; + -webkit-animation: pong-loader-paddle-1 1500ms infinite linear; + animation: pong-loader-paddle-1 1500ms infinite linear; +} +.pong-loader:not(:required):before { + -moz-animation: pong-loader-paddle-2 1500ms infinite linear; + -webkit-animation: pong-loader-paddle-2 1500ms infinite linear; + animation: pong-loader-paddle-2 1500ms infinite linear; + position: absolute; + top: 0; + left: 0; + display: block; + content: ""; + width: 10px; + height: 100%; + -moz-box-shadow: inset #353c39 0 0 0 0, inset #353c39 0 -40px 0 0, inset #353c39 -3px 0 0 0, inset #8cdb8b -10px 0 0 0; + -webkit-box-shadow: inset #353c39 0 0 0 0, inset #353c39 0 -40px 0 0, inset #353c39 -3px 0 0 0, inset #8cdb8b -10px 0 0 0; + box-shadow: inset #353c39 0 0 0 0, inset #353c39 0 -40px 0 0, inset #353c39 -3px 0 0 0, inset #8cdb8b -10px 0 0 0; +} +.pong-loader:not(:required):after { + content: ""; + display: block; + -moz-animation: pong-loader 1500ms infinite linear; + -webkit-animation: pong-loader 1500ms infinite linear; + animation: pong-loader 1500ms infinite linear; + -moz-border-radius: 50%; + -webkit-border-radius: 50%; + border-radius: 50%; + position: absolute; + left: 0; + top: 0; + width: 10px; + height: 10px; + background: #8cdb8b; +} diff --git a/public/bower_components/css-spinners/pulse.css b/public/bower_components/css-spinners/pulse.css new file mode 100644 index 0000000..59f19db --- /dev/null +++ b/public/bower_components/css-spinners/pulse.css @@ -0,0 +1,60 @@ +.pulse-loader:not(:required) { + display: inline-block; + width: 50px; + height: 50px; + -moz-animation: pulse-loader 0.7s linear infinite alternate; + -webkit-animation: pulse-loader 0.7s linear infinite alternate; + animation: pulse-loader 0.7s linear infinite alternate; + border: 2px solid #e67e22; + -moz-border-radius: 50%; + -webkit-border-radius: 50%; + border-radius: 50%; + overflow: hidden; + text-indent: 50px; +} + +@-moz-keyframes pulse-loader { + 0% { + -moz-box-shadow: #e67e22 0 0 0px 20px; + box-shadow: #e67e22 0 0 0px 20px; + } + 40% { + -moz-box-shadow: none; + box-shadow: none; + } + 100% { + -moz-box-shadow: #e67e22 0 0 0px 25px inset; + box-shadow: #e67e22 0 0 0px 25px inset; + } +} +@-webkit-keyframes pulse-loader { + 0% { + -webkit-box-shadow: #e67e22 0 0 0px 20px; + box-shadow: #e67e22 0 0 0px 20px; + } + 40% { + -webkit-box-shadow: none; + box-shadow: none; + } + 100% { + -webkit-box-shadow: #e67e22 0 0 0px 25px inset; + box-shadow: #e67e22 0 0 0px 25px inset; + } +} +@keyframes pulse-loader { + 0% { + -moz-box-shadow: #e67e22 0 0 0px 20px; + -webkit-box-shadow: #e67e22 0 0 0px 20px; + box-shadow: #e67e22 0 0 0px 20px; + } + 40% { + -moz-box-shadow: none; + -webkit-box-shadow: none; + box-shadow: none; + } + 100% { + -moz-box-shadow: #e67e22 0 0 0px 25px inset; + -webkit-box-shadow: #e67e22 0 0 0px 25px inset; + box-shadow: #e67e22 0 0 0px 25px inset; + } +} diff --git a/public/bower_components/css-spinners/refreshing.css b/public/bower_components/css-spinners/refreshing.css new file mode 100644 index 0000000..8d1d7b2 --- /dev/null +++ b/public/bower_components/css-spinners/refreshing.css @@ -0,0 +1,64 @@ +@-moz-keyframes refreshing-loader { + 0% { + -moz-transform: rotate(0deg); + transform: rotate(0deg); + } + 100% { + -moz-transform: rotate(360deg); + transform: rotate(360deg); + } +} +@-webkit-keyframes refreshing-loader { + 0% { + -webkit-transform: rotate(0deg); + transform: rotate(0deg); + } + 100% { + -webkit-transform: rotate(360deg); + transform: rotate(360deg); + } +} +@keyframes refreshing-loader { + 0% { + -moz-transform: rotate(0deg); + -ms-transform: rotate(0deg); + -webkit-transform: rotate(0deg); + transform: rotate(0deg); + } + 100% { + -moz-transform: rotate(360deg); + -ms-transform: rotate(360deg); + -webkit-transform: rotate(360deg); + transform: rotate(360deg); + } +} +/* :not(:required) hides this rule from IE9 and below */ +.refreshing-loader:not(:required) { + -moz-animation: refreshing-loader 1000ms infinite linear; + -webkit-animation: refreshing-loader 1000ms infinite linear; + animation: refreshing-loader 1000ms infinite linear; + -moz-border-radius: 2.4em; + -webkit-border-radius: 2.4em; + border-radius: 2.4em; + border: 0.4em solid #9ac; + border-left-color: transparent; + color: transparent; + display: inline-block; + font-size: 10px; + line-height: 1.2; + width: 3em; + height: 3em; + text-indent: 100%; +} +.refreshing-loader:not(:required):after { + display: block; + border: 0.5em solid transparent; + border-top-color: #9ac; + border-left-color: #9ac; + content: ''; + width: 0; + height: 0; + overflow: hidden; + margin-left: -0.2em; + margin-top: 1em; +} diff --git a/public/bower_components/css-spinners/spinner.css b/public/bower_components/css-spinners/spinner.css new file mode 100644 index 0000000..b38912b --- /dev/null +++ b/public/bower_components/css-spinners/spinner.css @@ -0,0 +1,53 @@ +@-moz-keyframes spinner-loader { + 0% { + -moz-transform: rotate(0deg); + transform: rotate(0deg); + } + 100% { + -moz-transform: rotate(360deg); + transform: rotate(360deg); + } +} +@-webkit-keyframes spinner-loader { + 0% { + -webkit-transform: rotate(0deg); + transform: rotate(0deg); + } + 100% { + -webkit-transform: rotate(360deg); + transform: rotate(360deg); + } +} +@keyframes spinner-loader { + 0% { + -moz-transform: rotate(0deg); + -ms-transform: rotate(0deg); + -webkit-transform: rotate(0deg); + transform: rotate(0deg); + } + 100% { + -moz-transform: rotate(360deg); + -ms-transform: rotate(360deg); + -webkit-transform: rotate(360deg); + transform: rotate(360deg); + } +} +/* :not(:required) hides this rule from IE9 and below */ +.spinner-loader:not(:required) { + -moz-animation: spinner-loader 1500ms infinite linear; + -webkit-animation: spinner-loader 1500ms infinite linear; + animation: spinner-loader 1500ms infinite linear; + -moz-border-radius: 0.5em; + -webkit-border-radius: 0.5em; + border-radius: 0.5em; + -moz-box-shadow: rgba(0, 0, 51, 0.3) 1.5em 0 0 0, rgba(0, 0, 51, 0.3) 1.1em 1.1em 0 0, rgba(0, 0, 51, 0.3) 0 1.5em 0 0, rgba(0, 0, 51, 0.3) -1.1em 1.1em 0 0, rgba(0, 0, 51, 0.3) -1.5em 0 0 0, rgba(0, 0, 51, 0.3) -1.1em -1.1em 0 0, rgba(0, 0, 51, 0.3) 0 -1.5em 0 0, rgba(0, 0, 51, 0.3) 1.1em -1.1em 0 0; + -webkit-box-shadow: rgba(0, 0, 51, 0.3) 1.5em 0 0 0, rgba(0, 0, 51, 0.3) 1.1em 1.1em 0 0, rgba(0, 0, 51, 0.3) 0 1.5em 0 0, rgba(0, 0, 51, 0.3) -1.1em 1.1em 0 0, rgba(0, 0, 51, 0.3) -1.5em 0 0 0, rgba(0, 0, 51, 0.3) -1.1em -1.1em 0 0, rgba(0, 0, 51, 0.3) 0 -1.5em 0 0, rgba(0, 0, 51, 0.3) 1.1em -1.1em 0 0; + box-shadow: rgba(0, 0, 51, 0.3) 1.5em 0 0 0, rgba(0, 0, 51, 0.3) 1.1em 1.1em 0 0, rgba(0, 0, 51, 0.3) 0 1.5em 0 0, rgba(0, 0, 51, 0.3) -1.1em 1.1em 0 0, rgba(0, 0, 51, 0.3) -1.5em 0 0 0, rgba(0, 0, 51, 0.3) -1.1em -1.1em 0 0, rgba(0, 0, 51, 0.3) 0 -1.5em 0 0, rgba(0, 0, 51, 0.3) 1.1em -1.1em 0 0; + display: inline-block; + font-size: 10px; + width: 1em; + height: 1em; + margin: 1.5em; + overflow: hidden; + text-indent: 100%; +} diff --git a/public/bower_components/css-spinners/spinners.css b/public/bower_components/css-spinners/spinners.css new file mode 100644 index 0000000..64307ee --- /dev/null +++ b/public/bower_components/css-spinners/spinners.css @@ -0,0 +1,3382 @@ +@-moz-keyframes spinner-loader { + 0% { + -moz-transform: rotate(0deg); + transform: rotate(0deg); + } + 100% { + -moz-transform: rotate(360deg); + transform: rotate(360deg); + } +} +@-webkit-keyframes spinner-loader { + 0% { + -webkit-transform: rotate(0deg); + transform: rotate(0deg); + } + 100% { + -webkit-transform: rotate(360deg); + transform: rotate(360deg); + } +} +@keyframes spinner-loader { + 0% { + -moz-transform: rotate(0deg); + -ms-transform: rotate(0deg); + -webkit-transform: rotate(0deg); + transform: rotate(0deg); + } + 100% { + -moz-transform: rotate(360deg); + -ms-transform: rotate(360deg); + -webkit-transform: rotate(360deg); + transform: rotate(360deg); + } +} +/* :not(:required) hides this rule from IE9 and below */ +.spinner-loader:not(:required) { + -moz-animation: spinner-loader 1500ms infinite linear; + -webkit-animation: spinner-loader 1500ms infinite linear; + animation: spinner-loader 1500ms infinite linear; + -moz-border-radius: 0.5em; + -webkit-border-radius: 0.5em; + border-radius: 0.5em; + -moz-box-shadow: rgba(0, 0, 51, 0.3) 1.5em 0 0 0, rgba(0, 0, 51, 0.3) 1.1em 1.1em 0 0, rgba(0, 0, 51, 0.3) 0 1.5em 0 0, rgba(0, 0, 51, 0.3) -1.1em 1.1em 0 0, rgba(0, 0, 51, 0.3) -1.5em 0 0 0, rgba(0, 0, 51, 0.3) -1.1em -1.1em 0 0, rgba(0, 0, 51, 0.3) 0 -1.5em 0 0, rgba(0, 0, 51, 0.3) 1.1em -1.1em 0 0; + -webkit-box-shadow: rgba(0, 0, 51, 0.3) 1.5em 0 0 0, rgba(0, 0, 51, 0.3) 1.1em 1.1em 0 0, rgba(0, 0, 51, 0.3) 0 1.5em 0 0, rgba(0, 0, 51, 0.3) -1.1em 1.1em 0 0, rgba(0, 0, 51, 0.3) -1.5em 0 0 0, rgba(0, 0, 51, 0.3) -1.1em -1.1em 0 0, rgba(0, 0, 51, 0.3) 0 -1.5em 0 0, rgba(0, 0, 51, 0.3) 1.1em -1.1em 0 0; + box-shadow: rgba(0, 0, 51, 0.3) 1.5em 0 0 0, rgba(0, 0, 51, 0.3) 1.1em 1.1em 0 0, rgba(0, 0, 51, 0.3) 0 1.5em 0 0, rgba(0, 0, 51, 0.3) -1.1em 1.1em 0 0, rgba(0, 0, 51, 0.3) -1.5em 0 0 0, rgba(0, 0, 51, 0.3) -1.1em -1.1em 0 0, rgba(0, 0, 51, 0.3) 0 -1.5em 0 0, rgba(0, 0, 51, 0.3) 1.1em -1.1em 0 0; + display: inline-block; + font-size: 10px; + width: 1em; + height: 1em; + margin: 1.5em; + overflow: hidden; + text-indent: 100%; +} + +@-moz-keyframes refreshing-loader { + 0% { + -moz-transform: rotate(0deg); + transform: rotate(0deg); + } + 100% { + -moz-transform: rotate(360deg); + transform: rotate(360deg); + } +} +@-webkit-keyframes refreshing-loader { + 0% { + -webkit-transform: rotate(0deg); + transform: rotate(0deg); + } + 100% { + -webkit-transform: rotate(360deg); + transform: rotate(360deg); + } +} +@keyframes refreshing-loader { + 0% { + -moz-transform: rotate(0deg); + -ms-transform: rotate(0deg); + -webkit-transform: rotate(0deg); + transform: rotate(0deg); + } + 100% { + -moz-transform: rotate(360deg); + -ms-transform: rotate(360deg); + -webkit-transform: rotate(360deg); + transform: rotate(360deg); + } +} +/* :not(:required) hides this rule from IE9 and below */ +.refreshing-loader:not(:required) { + -moz-animation: refreshing-loader 1000ms infinite linear; + -webkit-animation: refreshing-loader 1000ms infinite linear; + animation: refreshing-loader 1000ms infinite linear; + -moz-border-radius: 2.4em; + -webkit-border-radius: 2.4em; + border-radius: 2.4em; + border: 0.4em solid #9ac; + border-left-color: transparent; + color: transparent; + display: inline-block; + font-size: 10px; + line-height: 1.2; + width: 3em; + height: 3em; + text-indent: 100%; +} +.refreshing-loader:not(:required):after { + display: block; + border: 0.5em solid transparent; + border-top-color: #9ac; + border-left-color: #9ac; + content: ''; + width: 0; + height: 0; + overflow: hidden; + margin-left: -0.2em; + margin-top: 1em; +} + +@-moz-keyframes throbber-loader { + 0% { + background: #dde2e7; + } + 10% { + background: #6b9dc8; + } + 40% { + background: #dde2e7; + } +} +@-webkit-keyframes throbber-loader { + 0% { + background: #dde2e7; + } + 10% { + background: #6b9dc8; + } + 40% { + background: #dde2e7; + } +} +@keyframes throbber-loader { + 0% { + background: #dde2e7; + } + 10% { + background: #6b9dc8; + } + 40% { + background: #dde2e7; + } +} +/* :not(:required) hides these rules from IE9 and below */ +.throbber-loader:not(:required) { + -moz-animation: throbber-loader 2000ms 300ms infinite ease-out; + -webkit-animation: throbber-loader 2000ms 300ms infinite ease-out; + animation: throbber-loader 2000ms 300ms infinite ease-out; + background: #dde2e7; + display: inline-block; + position: relative; + text-indent: -9999px; + width: 0.9em; + height: 1.5em; + margin: 0 1.6em; +} +.throbber-loader:not(:required):before, .throbber-loader:not(:required):after { + background: #dde2e7; + content: '\x200B'; + display: inline-block; + width: 0.9em; + height: 1.5em; + position: absolute; + top: 0; +} +.throbber-loader:not(:required):before { + -moz-animation: throbber-loader 2000ms 150ms infinite ease-out; + -webkit-animation: throbber-loader 2000ms 150ms infinite ease-out; + animation: throbber-loader 2000ms 150ms infinite ease-out; + left: -1.6em; +} +.throbber-loader:not(:required):after { + -moz-animation: throbber-loader 2000ms 450ms infinite ease-out; + -webkit-animation: throbber-loader 2000ms 450ms infinite ease-out; + animation: throbber-loader 2000ms 450ms infinite ease-out; + right: -1.6em; +} + +@-moz-keyframes heartbeat-loader { + 0% { + -moz-transform: rotate(45deg) scale(1); + transform: rotate(45deg) scale(1); + } + 14% { + -moz-transform: rotate(45deg) scale(1.3); + transform: rotate(45deg) scale(1.3); + } + 28% { + -moz-transform: rotate(45deg) scale(1); + transform: rotate(45deg) scale(1); + } + 42% { + -moz-transform: rotate(45deg) scale(1.3); + transform: rotate(45deg) scale(1.3); + } + 70% { + -moz-transform: rotate(45deg) scale(1); + transform: rotate(45deg) scale(1); + } +} +@-webkit-keyframes heartbeat-loader { + 0% { + -webkit-transform: rotate(45deg) scale(1); + transform: rotate(45deg) scale(1); + } + 14% { + -webkit-transform: rotate(45deg) scale(1.3); + transform: rotate(45deg) scale(1.3); + } + 28% { + -webkit-transform: rotate(45deg) scale(1); + transform: rotate(45deg) scale(1); + } + 42% { + -webkit-transform: rotate(45deg) scale(1.3); + transform: rotate(45deg) scale(1.3); + } + 70% { + -webkit-transform: rotate(45deg) scale(1); + transform: rotate(45deg) scale(1); + } +} +@keyframes heartbeat-loader { + 0% { + -moz-transform: rotate(45deg) scale(1); + -ms-transform: rotate(45deg) scale(1); + -webkit-transform: rotate(45deg) scale(1); + transform: rotate(45deg) scale(1); + } + 14% { + -moz-transform: rotate(45deg) scale(1.3); + -ms-transform: rotate(45deg) scale(1.3); + -webkit-transform: rotate(45deg) scale(1.3); + transform: rotate(45deg) scale(1.3); + } + 28% { + -moz-transform: rotate(45deg) scale(1); + -ms-transform: rotate(45deg) scale(1); + -webkit-transform: rotate(45deg) scale(1); + transform: rotate(45deg) scale(1); + } + 42% { + -moz-transform: rotate(45deg) scale(1.3); + -ms-transform: rotate(45deg) scale(1.3); + -webkit-transform: rotate(45deg) scale(1.3); + transform: rotate(45deg) scale(1.3); + } + 70% { + -moz-transform: rotate(45deg) scale(1); + -ms-transform: rotate(45deg) scale(1); + -webkit-transform: rotate(45deg) scale(1); + transform: rotate(45deg) scale(1); + } +} +/* :not(:required) hides this rule from IE9 and below */ +.heartbeat-loader:not(:required) { + -moz-animation: heartbeat-loader 1300ms ease 0s infinite normal; + -webkit-animation: heartbeat-loader 1300ms ease 0s infinite normal; + animation: heartbeat-loader 1300ms ease 0s infinite normal; + display: inline-block; + position: relative; + overflow: hidden; + text-indent: -9999px; + width: 36px; + height: 36px; + -moz-transform: rotate(45deg) scale(1); + -ms-transform: rotate(45deg) scale(1); + -webkit-transform: rotate(45deg) scale(1); + transform: rotate(45deg) scale(1); + -moz-transform-origin: 50% 50%; + -ms-transform-origin: 50% 50%; + -webkit-transform-origin: 50% 50%; + transform-origin: 50% 50%; +} +.heartbeat-loader:not(:required):after, .heartbeat-loader:not(:required):before { + position: absolute; + content: ""; + background: #e87; +} +.heartbeat-loader:not(:required):before { + -moz-border-radius-topleft: 12px; + -webkit-border-top-left-radius: 12px; + border-top-left-radius: 12px; + -moz-border-radius-bottomleft: 12px; + -webkit-border-bottom-left-radius: 12px; + border-bottom-left-radius: 12px; + top: 12px; + left: 0; + width: 36px; + height: 24px; +} +.heartbeat-loader:not(:required):after { + -moz-border-radius-topleft: 12px; + -webkit-border-top-left-radius: 12px; + border-top-left-radius: 12px; + -moz-border-radius-topright: 12px; + -webkit-border-top-right-radius: 12px; + border-top-right-radius: 12px; + top: 0; + left: 12px; + width: 24px; + height: 12px; +} + +@-moz-keyframes gauge-loader { + 0% { + -moz-transform: rotate(-50deg); + transform: rotate(-50deg); + } + 10% { + -moz-transform: rotate(20deg); + transform: rotate(20deg); + } + 20% { + -moz-transform: rotate(60deg); + transform: rotate(60deg); + } + 24% { + -moz-transform: rotate(60deg); + transform: rotate(60deg); + } + 40% { + -moz-transform: rotate(-20deg); + transform: rotate(-20deg); + } + 54% { + -moz-transform: rotate(70deg); + transform: rotate(70deg); + } + 56% { + -moz-transform: rotate(78deg); + transform: rotate(78deg); + } + 58% { + -moz-transform: rotate(73deg); + transform: rotate(73deg); + } + 60% { + -moz-transform: rotate(75deg); + transform: rotate(75deg); + } + 62% { + -moz-transform: rotate(70deg); + transform: rotate(70deg); + } + 70% { + -moz-transform: rotate(-20deg); + transform: rotate(-20deg); + } + 80% { + -moz-transform: rotate(20deg); + transform: rotate(20deg); + } + 83% { + -moz-transform: rotate(25deg); + transform: rotate(25deg); + } + 86% { + -moz-transform: rotate(20deg); + transform: rotate(20deg); + } + 89% { + -moz-transform: rotate(25deg); + transform: rotate(25deg); + } + 100% { + -moz-transform: rotate(-50deg); + transform: rotate(-50deg); + } +} +@-webkit-keyframes gauge-loader { + 0% { + -webkit-transform: rotate(-50deg); + transform: rotate(-50deg); + } + 10% { + -webkit-transform: rotate(20deg); + transform: rotate(20deg); + } + 20% { + -webkit-transform: rotate(60deg); + transform: rotate(60deg); + } + 24% { + -webkit-transform: rotate(60deg); + transform: rotate(60deg); + } + 40% { + -webkit-transform: rotate(-20deg); + transform: rotate(-20deg); + } + 54% { + -webkit-transform: rotate(70deg); + transform: rotate(70deg); + } + 56% { + -webkit-transform: rotate(78deg); + transform: rotate(78deg); + } + 58% { + -webkit-transform: rotate(73deg); + transform: rotate(73deg); + } + 60% { + -webkit-transform: rotate(75deg); + transform: rotate(75deg); + } + 62% { + -webkit-transform: rotate(70deg); + transform: rotate(70deg); + } + 70% { + -webkit-transform: rotate(-20deg); + transform: rotate(-20deg); + } + 80% { + -webkit-transform: rotate(20deg); + transform: rotate(20deg); + } + 83% { + -webkit-transform: rotate(25deg); + transform: rotate(25deg); + } + 86% { + -webkit-transform: rotate(20deg); + transform: rotate(20deg); + } + 89% { + -webkit-transform: rotate(25deg); + transform: rotate(25deg); + } + 100% { + -webkit-transform: rotate(-50deg); + transform: rotate(-50deg); + } +} +@keyframes gauge-loader { + 0% { + -moz-transform: rotate(-50deg); + -ms-transform: rotate(-50deg); + -webkit-transform: rotate(-50deg); + transform: rotate(-50deg); + } + 10% { + -moz-transform: rotate(20deg); + -ms-transform: rotate(20deg); + -webkit-transform: rotate(20deg); + transform: rotate(20deg); + } + 20% { + -moz-transform: rotate(60deg); + -ms-transform: rotate(60deg); + -webkit-transform: rotate(60deg); + transform: rotate(60deg); + } + 24% { + -moz-transform: rotate(60deg); + -ms-transform: rotate(60deg); + -webkit-transform: rotate(60deg); + transform: rotate(60deg); + } + 40% { + -moz-transform: rotate(-20deg); + -ms-transform: rotate(-20deg); + -webkit-transform: rotate(-20deg); + transform: rotate(-20deg); + } + 54% { + -moz-transform: rotate(70deg); + -ms-transform: rotate(70deg); + -webkit-transform: rotate(70deg); + transform: rotate(70deg); + } + 56% { + -moz-transform: rotate(78deg); + -ms-transform: rotate(78deg); + -webkit-transform: rotate(78deg); + transform: rotate(78deg); + } + 58% { + -moz-transform: rotate(73deg); + -ms-transform: rotate(73deg); + -webkit-transform: rotate(73deg); + transform: rotate(73deg); + } + 60% { + -moz-transform: rotate(75deg); + -ms-transform: rotate(75deg); + -webkit-transform: rotate(75deg); + transform: rotate(75deg); + } + 62% { + -moz-transform: rotate(70deg); + -ms-transform: rotate(70deg); + -webkit-transform: rotate(70deg); + transform: rotate(70deg); + } + 70% { + -moz-transform: rotate(-20deg); + -ms-transform: rotate(-20deg); + -webkit-transform: rotate(-20deg); + transform: rotate(-20deg); + } + 80% { + -moz-transform: rotate(20deg); + -ms-transform: rotate(20deg); + -webkit-transform: rotate(20deg); + transform: rotate(20deg); + } + 83% { + -moz-transform: rotate(25deg); + -ms-transform: rotate(25deg); + -webkit-transform: rotate(25deg); + transform: rotate(25deg); + } + 86% { + -moz-transform: rotate(20deg); + -ms-transform: rotate(20deg); + -webkit-transform: rotate(20deg); + transform: rotate(20deg); + } + 89% { + -moz-transform: rotate(25deg); + -ms-transform: rotate(25deg); + -webkit-transform: rotate(25deg); + transform: rotate(25deg); + } + 100% { + -moz-transform: rotate(-50deg); + -ms-transform: rotate(-50deg); + -webkit-transform: rotate(-50deg); + transform: rotate(-50deg); + } +} +/* :not(:required) hides this rule from IE9 and below */ +.gauge-loader:not(:required) { + background: #6ca; + -moz-border-radius-topleft: 32px; + -webkit-border-top-left-radius: 32px; + border-top-left-radius: 32px; + -moz-border-radius-topright: 32px; + -webkit-border-top-right-radius: 32px; + border-top-right-radius: 32px; + display: inline-block; + width: 64px; + height: 32px; + overflow: hidden; + position: relative; + text-indent: -9999px; +} +.gauge-loader:not(:required)::before { + -moz-animation: gauge-loader 4000ms infinite ease; + -webkit-animation: gauge-loader 4000ms infinite ease; + animation: gauge-loader 4000ms infinite ease; + background: white; + -moz-border-radius: 2px; + -webkit-border-radius: 2px; + border-radius: 2px; + content: ''; + position: absolute; + left: 30px; + top: 5.33333px; + width: 4px; + height: 26.66667px; + -moz-transform-origin: 50% 100%; + -ms-transform-origin: 50% 100%; + -webkit-transform-origin: 50% 100%; + transform-origin: 50% 100%; +} +.gauge-loader:not(:required)::after { + content: ''; + background: white; + -moz-border-radius: 8px; + -webkit-border-radius: 8px; + border-radius: 8px; + position: absolute; + left: 25.6px; + top: 25.6px; + width: 12.8px; + height: 12.8px; +} + +@-moz-keyframes timer-loader { + 0% { + -moz-transform: rotate(0deg); + transform: rotate(0deg); + } + 100% { + -moz-transform: rotate(360deg); + transform: rotate(360deg); + } +} +@-webkit-keyframes timer-loader { + 0% { + -webkit-transform: rotate(0deg); + transform: rotate(0deg); + } + 100% { + -webkit-transform: rotate(360deg); + transform: rotate(360deg); + } +} +@keyframes timer-loader { + 0% { + -moz-transform: rotate(0deg); + -ms-transform: rotate(0deg); + -webkit-transform: rotate(0deg); + transform: rotate(0deg); + } + 100% { + -moz-transform: rotate(360deg); + -ms-transform: rotate(360deg); + -webkit-transform: rotate(360deg); + transform: rotate(360deg); + } +} +/* :not(:required) hides this rule from IE9 and below */ +.timer-loader:not(:required) { + border: 6px solid #c8d; + -moz-border-radius: 24px; + -webkit-border-radius: 24px; + border-radius: 24px; + -moz-box-sizing: border-box; + -webkit-box-sizing: border-box; + box-sizing: border-box; + display: inline-block; + overflow: hidden; + position: relative; + text-indent: -9999px; + width: 48px; + height: 48px; +} +.timer-loader:not(:required)::before { + -moz-animation: timer-loader 1250ms infinite linear; + -webkit-animation: timer-loader 1250ms infinite linear; + animation: timer-loader 1250ms infinite linear; + -moz-transform-origin: 3px 3px; + -ms-transform-origin: 3px 3px; + -webkit-transform-origin: 3px 3px; + transform-origin: 3px 3px; + background: #c8d; + -moz-border-radius: 3px; + -webkit-border-radius: 3px; + border-radius: 3px; + content: ''; + display: block; + position: absolute; + width: 6px; + height: 19.2px; + left: 15px; + top: 15px; +} +.timer-loader:not(:required)::after { + -moz-animation: timer-loader 15000ms infinite linear; + -webkit-animation: timer-loader 15000ms infinite linear; + animation: timer-loader 15000ms infinite linear; + -moz-transform-origin: 3px 3px; + -ms-transform-origin: 3px 3px; + -webkit-transform-origin: 3px 3px; + transform-origin: 3px 3px; + background: #c8d; + -moz-border-radius: 3px; + -webkit-border-radius: 3px; + border-radius: 3px; + content: ''; + display: block; + position: absolute; + width: 6px; + height: 16px; + left: 15px; + top: 15px; +} + +@-moz-keyframes three-quarters-loader { + 0% { + -moz-transform: rotate(0deg); + transform: rotate(0deg); + } + 100% { + -moz-transform: rotate(360deg); + transform: rotate(360deg); + } +} +@-webkit-keyframes three-quarters-loader { + 0% { + -webkit-transform: rotate(0deg); + transform: rotate(0deg); + } + 100% { + -webkit-transform: rotate(360deg); + transform: rotate(360deg); + } +} +@keyframes three-quarters-loader { + 0% { + -moz-transform: rotate(0deg); + -ms-transform: rotate(0deg); + -webkit-transform: rotate(0deg); + transform: rotate(0deg); + } + 100% { + -moz-transform: rotate(360deg); + -ms-transform: rotate(360deg); + -webkit-transform: rotate(360deg); + transform: rotate(360deg); + } +} +/* :not(:required) hides this rule from IE9 and below */ +.three-quarters-loader:not(:required) { + -moz-animation: three-quarters-loader 1250ms infinite linear; + -webkit-animation: three-quarters-loader 1250ms infinite linear; + animation: three-quarters-loader 1250ms infinite linear; + border: 8px solid #38e; + border-right-color: transparent; + border-radius: 16px; + box-sizing: border-box; + display: inline-block; + position: relative; + overflow: hidden; + text-indent: -9999px; + width: 32px; + height: 32px; +} + +@-moz-keyframes wobblebar-loader { + 0% { + left: 4px; + } + 3% { + left: 104px; + } + 6% { + left: 4px; + } + 9% { + left: 104px; + } + 12% { + left: 4px; + } + 15% { + left: 104px; + } + 18% { + left: 32px; + } + 27% { + left: 32px; + } + 30% { + left: 104px; + } + 33% { + left: 4px; + } + 36% { + left: 104px; + } + 39% { + left: 4px; + } + 42% { + left: 104px; + } + 45% { + left: 4px; + } + 48% { + left: 104px; + } + 51% { + left: 52px; + } + 63% { + left: 52px; + } + 66% { + left: 4px; + } + 69% { + left: 104px; + } + 72% { + left: 4px; + } + 75% { + left: 104px; + } + 78% { + left: 4px; + } + 81% { + left: 104px; + } + 84% { + left: 72px; + } + 94% { + left: 72px; + } + 97% { + left: 104px; + } +} +@-webkit-keyframes wobblebar-loader { + 0% { + left: 4px; + } + 3% { + left: 104px; + } + 6% { + left: 4px; + } + 9% { + left: 104px; + } + 12% { + left: 4px; + } + 15% { + left: 104px; + } + 18% { + left: 32px; + } + 27% { + left: 32px; + } + 30% { + left: 104px; + } + 33% { + left: 4px; + } + 36% { + left: 104px; + } + 39% { + left: 4px; + } + 42% { + left: 104px; + } + 45% { + left: 4px; + } + 48% { + left: 104px; + } + 51% { + left: 52px; + } + 63% { + left: 52px; + } + 66% { + left: 4px; + } + 69% { + left: 104px; + } + 72% { + left: 4px; + } + 75% { + left: 104px; + } + 78% { + left: 4px; + } + 81% { + left: 104px; + } + 84% { + left: 72px; + } + 94% { + left: 72px; + } + 97% { + left: 104px; + } +} +@keyframes wobblebar-loader { + 0% { + left: 4px; + } + 3% { + left: 104px; + } + 6% { + left: 4px; + } + 9% { + left: 104px; + } + 12% { + left: 4px; + } + 15% { + left: 104px; + } + 18% { + left: 32px; + } + 27% { + left: 32px; + } + 30% { + left: 104px; + } + 33% { + left: 4px; + } + 36% { + left: 104px; + } + 39% { + left: 4px; + } + 42% { + left: 104px; + } + 45% { + left: 4px; + } + 48% { + left: 104px; + } + 51% { + left: 52px; + } + 63% { + left: 52px; + } + 66% { + left: 4px; + } + 69% { + left: 104px; + } + 72% { + left: 4px; + } + 75% { + left: 104px; + } + 78% { + left: 4px; + } + 81% { + left: 104px; + } + 84% { + left: 72px; + } + 94% { + left: 72px; + } + 97% { + left: 104px; + } +} +/* :not(:required) hides this rule from IE9 and below */ +.wobblebar-loader:not(:required) { + background: #a9d; + -moz-border-radius: 10.66667px; + -webkit-border-radius: 10.66667px; + border-radius: 10.66667px; + display: inline-block; + overflow: hidden; + text-indent: -9999px; + width: 128px; + height: 21.33333px; + position: relative; +} +.wobblebar-loader:not(:required)::after { + -moz-animation: wobblebar-loader 15000ms infinite ease; + -webkit-animation: wobblebar-loader 15000ms infinite ease; + animation: wobblebar-loader 15000ms infinite ease; + background: white; + display: block; + -moz-border-radius: 7.11111px; + -webkit-border-radius: 7.11111px; + border-radius: 7.11111px; + content: ''; + position: absolute; + top: 3.55556px; + left: 4px; + width: 21.33333px; + height: 14.22222px; +} + +@-moz-keyframes atebits-loader { + 0% { + -moz-transform: rotate(0deg); + transform: rotate(0deg); + } + 3% { + -moz-transform: rotate(90deg); + transform: rotate(90deg); + } + 10% { + -moz-transform: rotate(90deg); + transform: rotate(90deg); + } + 13% { + -moz-transform: rotate(180deg); + transform: rotate(180deg); + } + 20% { + -moz-transform: rotate(180deg); + transform: rotate(180deg); + } + 23% { + -moz-transform: rotate(90deg); + transform: rotate(90deg); + } + 30% { + -moz-transform: rotate(90deg); + transform: rotate(90deg); + } + 33% { + -moz-transform: rotate(180deg); + transform: rotate(180deg); + } + 40% { + -moz-transform: rotate(180deg); + transform: rotate(180deg); + } + 43% { + -moz-transform: rotate(270deg); + transform: rotate(270deg); + } + 50% { + -moz-transform: rotate(270deg); + transform: rotate(270deg); + } + 53% { + -moz-transform: rotate(180deg); + transform: rotate(180deg); + } + 60% { + -moz-transform: rotate(180deg); + transform: rotate(180deg); + } + 63% { + -moz-transform: rotate(90deg); + transform: rotate(90deg); + } + 70% { + -moz-transform: rotate(90deg); + transform: rotate(90deg); + } + 73% { + -moz-transform: rotate(0deg); + transform: rotate(0deg); + } + 80% { + -moz-transform: rotate(0deg); + transform: rotate(0deg); + } + 83% { + -moz-transform: rotate(-90deg); + transform: rotate(-90deg); + } + 90% { + -moz-transform: rotate(-90deg); + transform: rotate(-90deg); + } + 93% { + -moz-transform: rotate(0deg); + transform: rotate(0deg); + } +} +@-webkit-keyframes atebits-loader { + 0% { + -webkit-transform: rotate(0deg); + transform: rotate(0deg); + } + 3% { + -webkit-transform: rotate(90deg); + transform: rotate(90deg); + } + 10% { + -webkit-transform: rotate(90deg); + transform: rotate(90deg); + } + 13% { + -webkit-transform: rotate(180deg); + transform: rotate(180deg); + } + 20% { + -webkit-transform: rotate(180deg); + transform: rotate(180deg); + } + 23% { + -webkit-transform: rotate(90deg); + transform: rotate(90deg); + } + 30% { + -webkit-transform: rotate(90deg); + transform: rotate(90deg); + } + 33% { + -webkit-transform: rotate(180deg); + transform: rotate(180deg); + } + 40% { + -webkit-transform: rotate(180deg); + transform: rotate(180deg); + } + 43% { + -webkit-transform: rotate(270deg); + transform: rotate(270deg); + } + 50% { + -webkit-transform: rotate(270deg); + transform: rotate(270deg); + } + 53% { + -webkit-transform: rotate(180deg); + transform: rotate(180deg); + } + 60% { + -webkit-transform: rotate(180deg); + transform: rotate(180deg); + } + 63% { + -webkit-transform: rotate(90deg); + transform: rotate(90deg); + } + 70% { + -webkit-transform: rotate(90deg); + transform: rotate(90deg); + } + 73% { + -webkit-transform: rotate(0deg); + transform: rotate(0deg); + } + 80% { + -webkit-transform: rotate(0deg); + transform: rotate(0deg); + } + 83% { + -webkit-transform: rotate(-90deg); + transform: rotate(-90deg); + } + 90% { + -webkit-transform: rotate(-90deg); + transform: rotate(-90deg); + } + 93% { + -webkit-transform: rotate(0deg); + transform: rotate(0deg); + } +} +@keyframes atebits-loader { + 0% { + -moz-transform: rotate(0deg); + -ms-transform: rotate(0deg); + -webkit-transform: rotate(0deg); + transform: rotate(0deg); + } + 3% { + -moz-transform: rotate(90deg); + -ms-transform: rotate(90deg); + -webkit-transform: rotate(90deg); + transform: rotate(90deg); + } + 10% { + -moz-transform: rotate(90deg); + -ms-transform: rotate(90deg); + -webkit-transform: rotate(90deg); + transform: rotate(90deg); + } + 13% { + -moz-transform: rotate(180deg); + -ms-transform: rotate(180deg); + -webkit-transform: rotate(180deg); + transform: rotate(180deg); + } + 20% { + -moz-transform: rotate(180deg); + -ms-transform: rotate(180deg); + -webkit-transform: rotate(180deg); + transform: rotate(180deg); + } + 23% { + -moz-transform: rotate(90deg); + -ms-transform: rotate(90deg); + -webkit-transform: rotate(90deg); + transform: rotate(90deg); + } + 30% { + -moz-transform: rotate(90deg); + -ms-transform: rotate(90deg); + -webkit-transform: rotate(90deg); + transform: rotate(90deg); + } + 33% { + -moz-transform: rotate(180deg); + -ms-transform: rotate(180deg); + -webkit-transform: rotate(180deg); + transform: rotate(180deg); + } + 40% { + -moz-transform: rotate(180deg); + -ms-transform: rotate(180deg); + -webkit-transform: rotate(180deg); + transform: rotate(180deg); + } + 43% { + -moz-transform: rotate(270deg); + -ms-transform: rotate(270deg); + -webkit-transform: rotate(270deg); + transform: rotate(270deg); + } + 50% { + -moz-transform: rotate(270deg); + -ms-transform: rotate(270deg); + -webkit-transform: rotate(270deg); + transform: rotate(270deg); + } + 53% { + -moz-transform: rotate(180deg); + -ms-transform: rotate(180deg); + -webkit-transform: rotate(180deg); + transform: rotate(180deg); + } + 60% { + -moz-transform: rotate(180deg); + -ms-transform: rotate(180deg); + -webkit-transform: rotate(180deg); + transform: rotate(180deg); + } + 63% { + -moz-transform: rotate(90deg); + -ms-transform: rotate(90deg); + -webkit-transform: rotate(90deg); + transform: rotate(90deg); + } + 70% { + -moz-transform: rotate(90deg); + -ms-transform: rotate(90deg); + -webkit-transform: rotate(90deg); + transform: rotate(90deg); + } + 73% { + -moz-transform: rotate(0deg); + -ms-transform: rotate(0deg); + -webkit-transform: rotate(0deg); + transform: rotate(0deg); + } + 80% { + -moz-transform: rotate(0deg); + -ms-transform: rotate(0deg); + -webkit-transform: rotate(0deg); + transform: rotate(0deg); + } + 83% { + -moz-transform: rotate(-90deg); + -ms-transform: rotate(-90deg); + -webkit-transform: rotate(-90deg); + transform: rotate(-90deg); + } + 90% { + -moz-transform: rotate(-90deg); + -ms-transform: rotate(-90deg); + -webkit-transform: rotate(-90deg); + transform: rotate(-90deg); + } + 93% { + -moz-transform: rotate(0deg); + -ms-transform: rotate(0deg); + -webkit-transform: rotate(0deg); + transform: rotate(0deg); + } +} +/* :not(:required) hides this rule from IE9 and below */ +.atebits-loader:not(:required) { + background: rgba(0, 0, 0, 0.5); + display: inline-block; + width: 9px; + height: 9px; + overflow: hidden; + position: relative; + text-indent: -9999px; + -moz-box-shadow: rgba(0, 0, 0, 0.5) -12px -12px 0 0, rgba(0, 0, 0, 0.5) 12px -12px 0 0, rgba(0, 0, 0, 0.5) -12px 0 0 0, rgba(0, 0, 0, 0.5) 12px 0 0 0, rgba(0, 0, 0, 0.5) -12px 12px 0 0, rgba(0, 0, 0, 0.5) 0 12px 0 0, rgba(0, 0, 0, 0.5) 12px 12px 0 0; + -webkit-box-shadow: rgba(0, 0, 0, 0.5) -12px -12px 0 0, rgba(0, 0, 0, 0.5) 12px -12px 0 0, rgba(0, 0, 0, 0.5) -12px 0 0 0, rgba(0, 0, 0, 0.5) 12px 0 0 0, rgba(0, 0, 0, 0.5) -12px 12px 0 0, rgba(0, 0, 0, 0.5) 0 12px 0 0, rgba(0, 0, 0, 0.5) 12px 12px 0 0; + box-shadow: rgba(0, 0, 0, 0.5) -12px -12px 0 0, rgba(0, 0, 0, 0.5) 12px -12px 0 0, rgba(0, 0, 0, 0.5) -12px 0 0 0, rgba(0, 0, 0, 0.5) 12px 0 0 0, rgba(0, 0, 0, 0.5) -12px 12px 0 0, rgba(0, 0, 0, 0.5) 0 12px 0 0, rgba(0, 0, 0, 0.5) 12px 12px 0 0; + -moz-animation: atebits-loader 8s infinite ease-in-out; + -webkit-animation: atebits-loader 8s infinite ease-in-out; + animation: atebits-loader 8s infinite ease-in-out; + -moz-transform-origin: 50% 50%; + -ms-transform-origin: 50% 50%; + -webkit-transform-origin: 50% 50%; + transform-origin: 50% 50%; +} + +@-moz-keyframes whirly-loader { + 0% { + -moz-transform: rotate(0deg); + transform: rotate(0deg); + } + 100% { + -moz-transform: rotate(360deg); + transform: rotate(360deg); + } +} +@-webkit-keyframes whirly-loader { + 0% { + -webkit-transform: rotate(0deg); + transform: rotate(0deg); + } + 100% { + -webkit-transform: rotate(360deg); + transform: rotate(360deg); + } +} +@keyframes whirly-loader { + 0% { + -moz-transform: rotate(0deg); + -ms-transform: rotate(0deg); + -webkit-transform: rotate(0deg); + transform: rotate(0deg); + } + 100% { + -moz-transform: rotate(360deg); + -ms-transform: rotate(360deg); + -webkit-transform: rotate(360deg); + transform: rotate(360deg); + } +} +/* :not(:required) hides this rule from IE9 and below */ +.whirly-loader:not(:required) { + overflow: hidden; + position: relative; + text-indent: -9999px; + display: inline-block; + width: 8px; + height: 8px; + background: transparent; + -moz-border-radius: 100%; + -webkit-border-radius: 100%; + border-radius: 100%; + -moz-box-shadow: #e66 0px 26px 0 6px, #e66 0.90971px 26.05079px 0 5.93333px, #e66 1.82297px 26.06967px 0 5.86667px, #e66 2.73865px 26.05647px 0 5.8px, #e66 3.65561px 26.01104px 0 5.73333px, #e66 4.57274px 25.93327px 0 5.66667px, #e66 5.48887px 25.8231px 0 5.6px, #e66 6.40287px 25.68049px 0 5.53333px, #e66 7.31358px 25.50548px 0 5.46667px, #e66 8.21985px 25.2981px 0 5.4px, #e66 9.12054px 25.05847px 0 5.33333px, #e66 10.01448px 24.78672px 0 5.26667px, #e66 10.90054px 24.48302px 0 5.2px, #e66 11.77757px 24.1476px 0 5.13333px, #e66 12.64443px 23.78072px 0 5.06667px, #e66 13.5px 23.38269px 0 5px, #e66 14.34315px 22.95384px 0 4.93333px, #e66 15.17277px 22.49455px 0 4.86667px, #e66 15.98776px 22.00526px 0 4.8px, #e66 16.78704px 21.48643px 0 4.73333px, #e66 17.56953px 20.93855px 0 4.66667px, #e66 18.33418px 20.36217px 0 4.6px, #e66 19.07995px 19.75787px 0 4.53333px, #e66 19.80582px 19.12626px 0 4.46667px, #e66 20.5108px 18.468px 0 4.4px, #e66 21.1939px 17.78379px 0 4.33333px, #e66 21.85416px 17.07434px 0 4.26667px, #e66 22.49067px 16.34043px 0 4.2px, #e66 23.10251px 15.58284px 0 4.13333px, #e66 23.68881px 14.80241px 0 4.06667px, #e66 24.24871px 14.0px 0 4px, #e66 24.7814px 13.1765px 0 3.93333px, #e66 25.28607px 12.33284px 0 3.86667px, #e66 25.76198px 11.46997px 0 3.8px, #e66 26.2084px 10.58888px 0 3.73333px, #e66 26.62462px 9.69057px 0 3.66667px, #e66 27.01001px 8.77608px 0 3.6px, #e66 27.36392px 7.84648px 0 3.53333px, #e66 27.68577px 6.90284px 0 3.46667px, #e66 27.97502px 5.94627px 0 3.4px, #e66 28.23116px 4.97791px 0 3.33333px, #e66 28.4537px 3.99891px 0 3.26667px, #e66 28.64223px 3.01042px 0 3.2px, #e66 28.79635px 2.01364px 0 3.13333px, #e66 28.91571px 1.00976px 0 3.06667px, #e66 29px 0.0px 0 3px, #e66 29.04896px -1.01441px 0 2.93333px, #e66 29.06237px -2.03224px 0 2.86667px, #e66 29.04004px -3.05223px 0 2.8px, #e66 28.98185px -4.07313px 0 2.73333px, #e66 28.88769px -5.09368px 0 2.66667px, #e66 28.75754px -6.1126px 0 2.6px, #e66 28.59138px -7.12863px 0 2.53333px, #e66 28.38926px -8.14049px 0 2.46667px, #e66 28.15127px -9.1469px 0 2.4px, #e66 27.87755px -10.1466px 0 2.33333px, #e66 27.56827px -11.1383px 0 2.26667px, #e66 27.22365px -12.12075px 0 2.2px, #e66 26.84398px -13.09268px 0 2.13333px, #e66 26.42956px -14.05285px 0 2.06667px, #e66 25.98076px -15.0px 0 2px, #e66 25.49798px -15.93291px 0 1.93333px, #e66 24.98167px -16.85035px 0 1.86667px, #e66 24.43231px -17.75111px 0 1.8px, #e66 23.85046px -18.63402px 0 1.73333px, #e66 23.23668px -19.49789px 0 1.66667px, #e66 22.5916px -20.34157px 0 1.6px, #e66 21.91589px -21.16393px 0 1.53333px, #e66 21.21024px -21.96384px 0 1.46667px, #e66 20.4754px -22.74023px 0 1.4px, #e66 19.71215px -23.49203px 0 1.33333px, #e66 18.92133px -24.2182px 0 1.26667px, #e66 18.10379px -24.91772px 0 1.2px, #e66 17.26042px -25.58963px 0 1.13333px, #e66 16.39217px -26.23295px 0 1.06667px, #e66 15.5px -26.84679px 0 1px, #e66 14.58492px -27.43024px 0 0.93333px, #e66 13.64796px -27.98245px 0 0.86667px, #e66 12.69018px -28.50262px 0 0.8px, #e66 11.7127px -28.98995px 0 0.73333px, #e66 10.71663px -29.4437px 0 0.66667px, #e66 9.70313px -29.86317px 0 0.6px, #e66 8.67339px -30.2477px 0 0.53333px, #e66 7.6286px -30.59666px 0 0.46667px, #e66 6.57001px -30.90946px 0 0.4px, #e66 5.49886px -31.18558px 0 0.33333px, #e66 4.41643px -31.42451px 0 0.26667px, #e66 3.32401px -31.6258px 0 0.2px, #e66 2.22291px -31.78904px 0 0.13333px, #e66 1.11446px -31.91388px 0 0.06667px, #e66 0.0px -32px 0 0px, #e66 -1.11911px -32.04713px 0 -0.06667px, #e66 -2.24151px -32.05506px 0 -0.13333px, #e66 -3.36582px -32.02361px 0 -0.2px, #e66 -4.49065px -31.95265px 0 -0.26667px, #e66 -5.61462px -31.84212px 0 -0.33333px, #e66 -6.73634px -31.69198px 0 -0.4px, #e66 -7.8544px -31.50227px 0 -0.46667px, #e66 -8.9674px -31.27305px 0 -0.53333px, #e66 -10.07395px -31.00444px 0 -0.6px, #e66 -11.17266px -30.69663px 0 -0.66667px, #e66 -12.26212px -30.34982px 0 -0.73333px, #e66 -13.34096px -29.96429px 0 -0.8px, #e66 -14.4078px -29.54036px 0 -0.86667px, #e66 -15.46126px -29.07841px 0 -0.93333px, #e66 -16.5px -28.57884px 0 -1px, #e66 -17.52266px -28.04212px 0 -1.06667px, #e66 -18.52792px -27.46878px 0 -1.13333px, #e66 -19.51447px -26.85936px 0 -1.2px, #e66 -20.48101px -26.21449px 0 -1.26667px, #e66 -21.42625px -25.53481px 0 -1.33333px, #e66 -22.34896px -24.82104px 0 -1.4px, #e66 -23.2479px -24.07391px 0 -1.46667px, #e66 -24.12186px -23.29421px 0 -1.53333px, #e66 -24.96967px -22.48279px 0 -1.6px, #e66 -25.79016px -21.64052px 0 -1.66667px, #e66 -26.58223px -20.76831px 0 -1.73333px, #e66 -27.34477px -19.86714px 0 -1.8px, #e66 -28.07674px -18.938px 0 -1.86667px, #e66 -28.7771px -17.98193px 0 -1.93333px, #e66 -29.44486px -17.0px 0 -2px, #e66 -30.07908px -15.99333px 0 -2.06667px, #e66 -30.67884px -14.96307px 0 -2.13333px, #e66 -31.24325px -13.91039px 0 -2.2px, #e66 -31.7715px -12.83652px 0 -2.26667px, #e66 -32.26278px -11.74269px 0 -2.33333px, #e66 -32.71634px -10.63018px 0 -2.4px, #e66 -33.13149px -9.5003px 0 -2.46667px, #e66 -33.50755px -8.35437px 0 -2.53333px, #e66 -33.84391px -7.19374px 0 -2.6px, #e66 -34.14px -6.0198px 0 -2.66667px, #e66 -34.39531px -4.83395px 0 -2.73333px, #e66 -34.60936px -3.63759px 0 -2.8px, #e66 -34.78173px -2.43218px 0 -2.86667px, #e66 -34.91205px -1.21916px 0 -2.93333px, #e66 -35px 0.0px 0 -3px, #e66 -35.04531px 1.22381px 0 -3.06667px, #e66 -35.04775px 2.45078px 0 -3.13333px, #e66 -35.00717px 3.6794px 0 -3.2px, #e66 -34.92345px 4.90817px 0 -3.26667px, #e66 -34.79654px 6.13557px 0 -3.33333px, #e66 -34.62643px 7.36007px 0 -3.4px, #e66 -34.41316px 8.58016px 0 -3.46667px, #e66 -34.15683px 9.79431px 0 -3.53333px, #e66 -33.85761px 11.001px 0 -3.6px, #e66 -33.5157px 12.19872px 0 -3.66667px, #e66 -33.13137px 13.38594px 0 -3.73333px, #e66 -32.70493px 14.56117px 0 -3.8px, #e66 -32.23675px 15.72291px 0 -3.86667px, #e66 -31.72725px 16.86968px 0 -3.93333px, #e66 -31.17691px 18px 0 -4px, #e66 -30.58627px 19.11242px 0 -4.06667px, #e66 -29.95589px 20.2055px 0 -4.13333px, #e66 -29.28642px 21.27783px 0 -4.2px, #e66 -28.57852px 22.32799px 0 -4.26667px, #e66 -27.83295px 23.35462px 0 -4.33333px, #e66 -27.05047px 24.35635px 0 -4.4px, #e66 -26.23192px 25.33188px 0 -4.46667px, #e66 -25.37819px 26.27988px 0 -4.53333px, #e66 -24.49018px 27.1991px 0 -4.6px, #e66 -23.56888px 28.0883px 0 -4.66667px, #e66 -22.6153px 28.94626px 0 -4.73333px, #e66 -21.6305px 29.77183px 0 -4.8px, #e66 -20.61558px 30.56385px 0 -4.86667px, #e66 -19.57168px 31.32124px 0 -4.93333px, #e66 -18.5px 32.04294px 0 -5px, #e66 -17.40175px 32.72792px 0 -5.06667px, #e66 -16.27818px 33.37522px 0 -5.13333px, #e66 -15.1306px 33.98389px 0 -5.2px, #e66 -13.96034px 34.55305px 0 -5.26667px, #e66 -12.76875px 35.08186px 0 -5.33333px, #e66 -11.55724px 35.56951px 0 -5.4px, #e66 -10.32721px 36.01527px 0 -5.46667px, #e66 -9.08014px 36.41843px 0 -5.53333px, #e66 -7.81748px 36.77835px 0 -5.6px, #e66 -6.54075px 37.09443px 0 -5.66667px, #e66 -5.25147px 37.36612px 0 -5.73333px, #e66 -3.95118px 37.59293px 0 -5.8px, #e66 -2.64145px 37.77443px 0 -5.86667px, #e66 -1.32385px 37.91023px 0 -5.93333px; + -webkit-box-shadow: #e66 0px 26px 0 6px, #e66 0.90971px 26.05079px 0 5.93333px, #e66 1.82297px 26.06967px 0 5.86667px, #e66 2.73865px 26.05647px 0 5.8px, #e66 3.65561px 26.01104px 0 5.73333px, #e66 4.57274px 25.93327px 0 5.66667px, #e66 5.48887px 25.8231px 0 5.6px, #e66 6.40287px 25.68049px 0 5.53333px, #e66 7.31358px 25.50548px 0 5.46667px, #e66 8.21985px 25.2981px 0 5.4px, #e66 9.12054px 25.05847px 0 5.33333px, #e66 10.01448px 24.78672px 0 5.26667px, #e66 10.90054px 24.48302px 0 5.2px, #e66 11.77757px 24.1476px 0 5.13333px, #e66 12.64443px 23.78072px 0 5.06667px, #e66 13.5px 23.38269px 0 5px, #e66 14.34315px 22.95384px 0 4.93333px, #e66 15.17277px 22.49455px 0 4.86667px, #e66 15.98776px 22.00526px 0 4.8px, #e66 16.78704px 21.48643px 0 4.73333px, #e66 17.56953px 20.93855px 0 4.66667px, #e66 18.33418px 20.36217px 0 4.6px, #e66 19.07995px 19.75787px 0 4.53333px, #e66 19.80582px 19.12626px 0 4.46667px, #e66 20.5108px 18.468px 0 4.4px, #e66 21.1939px 17.78379px 0 4.33333px, #e66 21.85416px 17.07434px 0 4.26667px, #e66 22.49067px 16.34043px 0 4.2px, #e66 23.10251px 15.58284px 0 4.13333px, #e66 23.68881px 14.80241px 0 4.06667px, #e66 24.24871px 14.0px 0 4px, #e66 24.7814px 13.1765px 0 3.93333px, #e66 25.28607px 12.33284px 0 3.86667px, #e66 25.76198px 11.46997px 0 3.8px, #e66 26.2084px 10.58888px 0 3.73333px, #e66 26.62462px 9.69057px 0 3.66667px, #e66 27.01001px 8.77608px 0 3.6px, #e66 27.36392px 7.84648px 0 3.53333px, #e66 27.68577px 6.90284px 0 3.46667px, #e66 27.97502px 5.94627px 0 3.4px, #e66 28.23116px 4.97791px 0 3.33333px, #e66 28.4537px 3.99891px 0 3.26667px, #e66 28.64223px 3.01042px 0 3.2px, #e66 28.79635px 2.01364px 0 3.13333px, #e66 28.91571px 1.00976px 0 3.06667px, #e66 29px 0.0px 0 3px, #e66 29.04896px -1.01441px 0 2.93333px, #e66 29.06237px -2.03224px 0 2.86667px, #e66 29.04004px -3.05223px 0 2.8px, #e66 28.98185px -4.07313px 0 2.73333px, #e66 28.88769px -5.09368px 0 2.66667px, #e66 28.75754px -6.1126px 0 2.6px, #e66 28.59138px -7.12863px 0 2.53333px, #e66 28.38926px -8.14049px 0 2.46667px, #e66 28.15127px -9.1469px 0 2.4px, #e66 27.87755px -10.1466px 0 2.33333px, #e66 27.56827px -11.1383px 0 2.26667px, #e66 27.22365px -12.12075px 0 2.2px, #e66 26.84398px -13.09268px 0 2.13333px, #e66 26.42956px -14.05285px 0 2.06667px, #e66 25.98076px -15.0px 0 2px, #e66 25.49798px -15.93291px 0 1.93333px, #e66 24.98167px -16.85035px 0 1.86667px, #e66 24.43231px -17.75111px 0 1.8px, #e66 23.85046px -18.63402px 0 1.73333px, #e66 23.23668px -19.49789px 0 1.66667px, #e66 22.5916px -20.34157px 0 1.6px, #e66 21.91589px -21.16393px 0 1.53333px, #e66 21.21024px -21.96384px 0 1.46667px, #e66 20.4754px -22.74023px 0 1.4px, #e66 19.71215px -23.49203px 0 1.33333px, #e66 18.92133px -24.2182px 0 1.26667px, #e66 18.10379px -24.91772px 0 1.2px, #e66 17.26042px -25.58963px 0 1.13333px, #e66 16.39217px -26.23295px 0 1.06667px, #e66 15.5px -26.84679px 0 1px, #e66 14.58492px -27.43024px 0 0.93333px, #e66 13.64796px -27.98245px 0 0.86667px, #e66 12.69018px -28.50262px 0 0.8px, #e66 11.7127px -28.98995px 0 0.73333px, #e66 10.71663px -29.4437px 0 0.66667px, #e66 9.70313px -29.86317px 0 0.6px, #e66 8.67339px -30.2477px 0 0.53333px, #e66 7.6286px -30.59666px 0 0.46667px, #e66 6.57001px -30.90946px 0 0.4px, #e66 5.49886px -31.18558px 0 0.33333px, #e66 4.41643px -31.42451px 0 0.26667px, #e66 3.32401px -31.6258px 0 0.2px, #e66 2.22291px -31.78904px 0 0.13333px, #e66 1.11446px -31.91388px 0 0.06667px, #e66 0.0px -32px 0 0px, #e66 -1.11911px -32.04713px 0 -0.06667px, #e66 -2.24151px -32.05506px 0 -0.13333px, #e66 -3.36582px -32.02361px 0 -0.2px, #e66 -4.49065px -31.95265px 0 -0.26667px, #e66 -5.61462px -31.84212px 0 -0.33333px, #e66 -6.73634px -31.69198px 0 -0.4px, #e66 -7.8544px -31.50227px 0 -0.46667px, #e66 -8.9674px -31.27305px 0 -0.53333px, #e66 -10.07395px -31.00444px 0 -0.6px, #e66 -11.17266px -30.69663px 0 -0.66667px, #e66 -12.26212px -30.34982px 0 -0.73333px, #e66 -13.34096px -29.96429px 0 -0.8px, #e66 -14.4078px -29.54036px 0 -0.86667px, #e66 -15.46126px -29.07841px 0 -0.93333px, #e66 -16.5px -28.57884px 0 -1px, #e66 -17.52266px -28.04212px 0 -1.06667px, #e66 -18.52792px -27.46878px 0 -1.13333px, #e66 -19.51447px -26.85936px 0 -1.2px, #e66 -20.48101px -26.21449px 0 -1.26667px, #e66 -21.42625px -25.53481px 0 -1.33333px, #e66 -22.34896px -24.82104px 0 -1.4px, #e66 -23.2479px -24.07391px 0 -1.46667px, #e66 -24.12186px -23.29421px 0 -1.53333px, #e66 -24.96967px -22.48279px 0 -1.6px, #e66 -25.79016px -21.64052px 0 -1.66667px, #e66 -26.58223px -20.76831px 0 -1.73333px, #e66 -27.34477px -19.86714px 0 -1.8px, #e66 -28.07674px -18.938px 0 -1.86667px, #e66 -28.7771px -17.98193px 0 -1.93333px, #e66 -29.44486px -17.0px 0 -2px, #e66 -30.07908px -15.99333px 0 -2.06667px, #e66 -30.67884px -14.96307px 0 -2.13333px, #e66 -31.24325px -13.91039px 0 -2.2px, #e66 -31.7715px -12.83652px 0 -2.26667px, #e66 -32.26278px -11.74269px 0 -2.33333px, #e66 -32.71634px -10.63018px 0 -2.4px, #e66 -33.13149px -9.5003px 0 -2.46667px, #e66 -33.50755px -8.35437px 0 -2.53333px, #e66 -33.84391px -7.19374px 0 -2.6px, #e66 -34.14px -6.0198px 0 -2.66667px, #e66 -34.39531px -4.83395px 0 -2.73333px, #e66 -34.60936px -3.63759px 0 -2.8px, #e66 -34.78173px -2.43218px 0 -2.86667px, #e66 -34.91205px -1.21916px 0 -2.93333px, #e66 -35px 0.0px 0 -3px, #e66 -35.04531px 1.22381px 0 -3.06667px, #e66 -35.04775px 2.45078px 0 -3.13333px, #e66 -35.00717px 3.6794px 0 -3.2px, #e66 -34.92345px 4.90817px 0 -3.26667px, #e66 -34.79654px 6.13557px 0 -3.33333px, #e66 -34.62643px 7.36007px 0 -3.4px, #e66 -34.41316px 8.58016px 0 -3.46667px, #e66 -34.15683px 9.79431px 0 -3.53333px, #e66 -33.85761px 11.001px 0 -3.6px, #e66 -33.5157px 12.19872px 0 -3.66667px, #e66 -33.13137px 13.38594px 0 -3.73333px, #e66 -32.70493px 14.56117px 0 -3.8px, #e66 -32.23675px 15.72291px 0 -3.86667px, #e66 -31.72725px 16.86968px 0 -3.93333px, #e66 -31.17691px 18px 0 -4px, #e66 -30.58627px 19.11242px 0 -4.06667px, #e66 -29.95589px 20.2055px 0 -4.13333px, #e66 -29.28642px 21.27783px 0 -4.2px, #e66 -28.57852px 22.32799px 0 -4.26667px, #e66 -27.83295px 23.35462px 0 -4.33333px, #e66 -27.05047px 24.35635px 0 -4.4px, #e66 -26.23192px 25.33188px 0 -4.46667px, #e66 -25.37819px 26.27988px 0 -4.53333px, #e66 -24.49018px 27.1991px 0 -4.6px, #e66 -23.56888px 28.0883px 0 -4.66667px, #e66 -22.6153px 28.94626px 0 -4.73333px, #e66 -21.6305px 29.77183px 0 -4.8px, #e66 -20.61558px 30.56385px 0 -4.86667px, #e66 -19.57168px 31.32124px 0 -4.93333px, #e66 -18.5px 32.04294px 0 -5px, #e66 -17.40175px 32.72792px 0 -5.06667px, #e66 -16.27818px 33.37522px 0 -5.13333px, #e66 -15.1306px 33.98389px 0 -5.2px, #e66 -13.96034px 34.55305px 0 -5.26667px, #e66 -12.76875px 35.08186px 0 -5.33333px, #e66 -11.55724px 35.56951px 0 -5.4px, #e66 -10.32721px 36.01527px 0 -5.46667px, #e66 -9.08014px 36.41843px 0 -5.53333px, #e66 -7.81748px 36.77835px 0 -5.6px, #e66 -6.54075px 37.09443px 0 -5.66667px, #e66 -5.25147px 37.36612px 0 -5.73333px, #e66 -3.95118px 37.59293px 0 -5.8px, #e66 -2.64145px 37.77443px 0 -5.86667px, #e66 -1.32385px 37.91023px 0 -5.93333px; + box-shadow: #e66 0px 26px 0 6px, #e66 0.90971px 26.05079px 0 5.93333px, #e66 1.82297px 26.06967px 0 5.86667px, #e66 2.73865px 26.05647px 0 5.8px, #e66 3.65561px 26.01104px 0 5.73333px, #e66 4.57274px 25.93327px 0 5.66667px, #e66 5.48887px 25.8231px 0 5.6px, #e66 6.40287px 25.68049px 0 5.53333px, #e66 7.31358px 25.50548px 0 5.46667px, #e66 8.21985px 25.2981px 0 5.4px, #e66 9.12054px 25.05847px 0 5.33333px, #e66 10.01448px 24.78672px 0 5.26667px, #e66 10.90054px 24.48302px 0 5.2px, #e66 11.77757px 24.1476px 0 5.13333px, #e66 12.64443px 23.78072px 0 5.06667px, #e66 13.5px 23.38269px 0 5px, #e66 14.34315px 22.95384px 0 4.93333px, #e66 15.17277px 22.49455px 0 4.86667px, #e66 15.98776px 22.00526px 0 4.8px, #e66 16.78704px 21.48643px 0 4.73333px, #e66 17.56953px 20.93855px 0 4.66667px, #e66 18.33418px 20.36217px 0 4.6px, #e66 19.07995px 19.75787px 0 4.53333px, #e66 19.80582px 19.12626px 0 4.46667px, #e66 20.5108px 18.468px 0 4.4px, #e66 21.1939px 17.78379px 0 4.33333px, #e66 21.85416px 17.07434px 0 4.26667px, #e66 22.49067px 16.34043px 0 4.2px, #e66 23.10251px 15.58284px 0 4.13333px, #e66 23.68881px 14.80241px 0 4.06667px, #e66 24.24871px 14.0px 0 4px, #e66 24.7814px 13.1765px 0 3.93333px, #e66 25.28607px 12.33284px 0 3.86667px, #e66 25.76198px 11.46997px 0 3.8px, #e66 26.2084px 10.58888px 0 3.73333px, #e66 26.62462px 9.69057px 0 3.66667px, #e66 27.01001px 8.77608px 0 3.6px, #e66 27.36392px 7.84648px 0 3.53333px, #e66 27.68577px 6.90284px 0 3.46667px, #e66 27.97502px 5.94627px 0 3.4px, #e66 28.23116px 4.97791px 0 3.33333px, #e66 28.4537px 3.99891px 0 3.26667px, #e66 28.64223px 3.01042px 0 3.2px, #e66 28.79635px 2.01364px 0 3.13333px, #e66 28.91571px 1.00976px 0 3.06667px, #e66 29px 0.0px 0 3px, #e66 29.04896px -1.01441px 0 2.93333px, #e66 29.06237px -2.03224px 0 2.86667px, #e66 29.04004px -3.05223px 0 2.8px, #e66 28.98185px -4.07313px 0 2.73333px, #e66 28.88769px -5.09368px 0 2.66667px, #e66 28.75754px -6.1126px 0 2.6px, #e66 28.59138px -7.12863px 0 2.53333px, #e66 28.38926px -8.14049px 0 2.46667px, #e66 28.15127px -9.1469px 0 2.4px, #e66 27.87755px -10.1466px 0 2.33333px, #e66 27.56827px -11.1383px 0 2.26667px, #e66 27.22365px -12.12075px 0 2.2px, #e66 26.84398px -13.09268px 0 2.13333px, #e66 26.42956px -14.05285px 0 2.06667px, #e66 25.98076px -15.0px 0 2px, #e66 25.49798px -15.93291px 0 1.93333px, #e66 24.98167px -16.85035px 0 1.86667px, #e66 24.43231px -17.75111px 0 1.8px, #e66 23.85046px -18.63402px 0 1.73333px, #e66 23.23668px -19.49789px 0 1.66667px, #e66 22.5916px -20.34157px 0 1.6px, #e66 21.91589px -21.16393px 0 1.53333px, #e66 21.21024px -21.96384px 0 1.46667px, #e66 20.4754px -22.74023px 0 1.4px, #e66 19.71215px -23.49203px 0 1.33333px, #e66 18.92133px -24.2182px 0 1.26667px, #e66 18.10379px -24.91772px 0 1.2px, #e66 17.26042px -25.58963px 0 1.13333px, #e66 16.39217px -26.23295px 0 1.06667px, #e66 15.5px -26.84679px 0 1px, #e66 14.58492px -27.43024px 0 0.93333px, #e66 13.64796px -27.98245px 0 0.86667px, #e66 12.69018px -28.50262px 0 0.8px, #e66 11.7127px -28.98995px 0 0.73333px, #e66 10.71663px -29.4437px 0 0.66667px, #e66 9.70313px -29.86317px 0 0.6px, #e66 8.67339px -30.2477px 0 0.53333px, #e66 7.6286px -30.59666px 0 0.46667px, #e66 6.57001px -30.90946px 0 0.4px, #e66 5.49886px -31.18558px 0 0.33333px, #e66 4.41643px -31.42451px 0 0.26667px, #e66 3.32401px -31.6258px 0 0.2px, #e66 2.22291px -31.78904px 0 0.13333px, #e66 1.11446px -31.91388px 0 0.06667px, #e66 0.0px -32px 0 0px, #e66 -1.11911px -32.04713px 0 -0.06667px, #e66 -2.24151px -32.05506px 0 -0.13333px, #e66 -3.36582px -32.02361px 0 -0.2px, #e66 -4.49065px -31.95265px 0 -0.26667px, #e66 -5.61462px -31.84212px 0 -0.33333px, #e66 -6.73634px -31.69198px 0 -0.4px, #e66 -7.8544px -31.50227px 0 -0.46667px, #e66 -8.9674px -31.27305px 0 -0.53333px, #e66 -10.07395px -31.00444px 0 -0.6px, #e66 -11.17266px -30.69663px 0 -0.66667px, #e66 -12.26212px -30.34982px 0 -0.73333px, #e66 -13.34096px -29.96429px 0 -0.8px, #e66 -14.4078px -29.54036px 0 -0.86667px, #e66 -15.46126px -29.07841px 0 -0.93333px, #e66 -16.5px -28.57884px 0 -1px, #e66 -17.52266px -28.04212px 0 -1.06667px, #e66 -18.52792px -27.46878px 0 -1.13333px, #e66 -19.51447px -26.85936px 0 -1.2px, #e66 -20.48101px -26.21449px 0 -1.26667px, #e66 -21.42625px -25.53481px 0 -1.33333px, #e66 -22.34896px -24.82104px 0 -1.4px, #e66 -23.2479px -24.07391px 0 -1.46667px, #e66 -24.12186px -23.29421px 0 -1.53333px, #e66 -24.96967px -22.48279px 0 -1.6px, #e66 -25.79016px -21.64052px 0 -1.66667px, #e66 -26.58223px -20.76831px 0 -1.73333px, #e66 -27.34477px -19.86714px 0 -1.8px, #e66 -28.07674px -18.938px 0 -1.86667px, #e66 -28.7771px -17.98193px 0 -1.93333px, #e66 -29.44486px -17.0px 0 -2px, #e66 -30.07908px -15.99333px 0 -2.06667px, #e66 -30.67884px -14.96307px 0 -2.13333px, #e66 -31.24325px -13.91039px 0 -2.2px, #e66 -31.7715px -12.83652px 0 -2.26667px, #e66 -32.26278px -11.74269px 0 -2.33333px, #e66 -32.71634px -10.63018px 0 -2.4px, #e66 -33.13149px -9.5003px 0 -2.46667px, #e66 -33.50755px -8.35437px 0 -2.53333px, #e66 -33.84391px -7.19374px 0 -2.6px, #e66 -34.14px -6.0198px 0 -2.66667px, #e66 -34.39531px -4.83395px 0 -2.73333px, #e66 -34.60936px -3.63759px 0 -2.8px, #e66 -34.78173px -2.43218px 0 -2.86667px, #e66 -34.91205px -1.21916px 0 -2.93333px, #e66 -35px 0.0px 0 -3px, #e66 -35.04531px 1.22381px 0 -3.06667px, #e66 -35.04775px 2.45078px 0 -3.13333px, #e66 -35.00717px 3.6794px 0 -3.2px, #e66 -34.92345px 4.90817px 0 -3.26667px, #e66 -34.79654px 6.13557px 0 -3.33333px, #e66 -34.62643px 7.36007px 0 -3.4px, #e66 -34.41316px 8.58016px 0 -3.46667px, #e66 -34.15683px 9.79431px 0 -3.53333px, #e66 -33.85761px 11.001px 0 -3.6px, #e66 -33.5157px 12.19872px 0 -3.66667px, #e66 -33.13137px 13.38594px 0 -3.73333px, #e66 -32.70493px 14.56117px 0 -3.8px, #e66 -32.23675px 15.72291px 0 -3.86667px, #e66 -31.72725px 16.86968px 0 -3.93333px, #e66 -31.17691px 18px 0 -4px, #e66 -30.58627px 19.11242px 0 -4.06667px, #e66 -29.95589px 20.2055px 0 -4.13333px, #e66 -29.28642px 21.27783px 0 -4.2px, #e66 -28.57852px 22.32799px 0 -4.26667px, #e66 -27.83295px 23.35462px 0 -4.33333px, #e66 -27.05047px 24.35635px 0 -4.4px, #e66 -26.23192px 25.33188px 0 -4.46667px, #e66 -25.37819px 26.27988px 0 -4.53333px, #e66 -24.49018px 27.1991px 0 -4.6px, #e66 -23.56888px 28.0883px 0 -4.66667px, #e66 -22.6153px 28.94626px 0 -4.73333px, #e66 -21.6305px 29.77183px 0 -4.8px, #e66 -20.61558px 30.56385px 0 -4.86667px, #e66 -19.57168px 31.32124px 0 -4.93333px, #e66 -18.5px 32.04294px 0 -5px, #e66 -17.40175px 32.72792px 0 -5.06667px, #e66 -16.27818px 33.37522px 0 -5.13333px, #e66 -15.1306px 33.98389px 0 -5.2px, #e66 -13.96034px 34.55305px 0 -5.26667px, #e66 -12.76875px 35.08186px 0 -5.33333px, #e66 -11.55724px 35.56951px 0 -5.4px, #e66 -10.32721px 36.01527px 0 -5.46667px, #e66 -9.08014px 36.41843px 0 -5.53333px, #e66 -7.81748px 36.77835px 0 -5.6px, #e66 -6.54075px 37.09443px 0 -5.66667px, #e66 -5.25147px 37.36612px 0 -5.73333px, #e66 -3.95118px 37.59293px 0 -5.8px, #e66 -2.64145px 37.77443px 0 -5.86667px, #e66 -1.32385px 37.91023px 0 -5.93333px; + -moz-animation: whirly-loader 1.25s infinite linear; + -webkit-animation: whirly-loader 1.25s infinite linear; + animation: whirly-loader 1.25s infinite linear; + -moz-transform-origin: 50% 50%; + -ms-transform-origin: 50% 50%; + -webkit-transform-origin: 50% 50%; + transform-origin: 50% 50%; +} + +@-moz-keyframes flower-loader { + 0% { + -moz-transform: rotate(0deg); + transform: rotate(0deg); + -moz-box-shadow: white 0 0 15px 0, #fd8 -12px -12px 0 4px, #fd8 12px -12px 0 4px, #fd8 12px 12px 0 4px, #fd8 -12px 12px 0 4px; + box-shadow: white 0 0 15px 0, #fd8 -12px -12px 0 4px, #fd8 12px -12px 0 4px, #fd8 12px 12px 0 4px, #fd8 -12px 12px 0 4px; + } + 50% { + -moz-transform: rotate(1080deg); + transform: rotate(1080deg); + -moz-box-shadow: white 0 0 15px 0, #fd8 12px 12px 0 4px, #fd8 -12px 12px 0 4px, #fd8 -12px -12px 0 4px, #fd8 12px -12px 0 4px; + box-shadow: white 0 0 15px 0, #fd8 12px 12px 0 4px, #fd8 -12px 12px 0 4px, #fd8 -12px -12px 0 4px, #fd8 12px -12px 0 4px; + } +} +@-webkit-keyframes flower-loader { + 0% { + -webkit-transform: rotate(0deg); + transform: rotate(0deg); + -webkit-box-shadow: white 0 0 15px 0, #fd8 -12px -12px 0 4px, #fd8 12px -12px 0 4px, #fd8 12px 12px 0 4px, #fd8 -12px 12px 0 4px; + box-shadow: white 0 0 15px 0, #fd8 -12px -12px 0 4px, #fd8 12px -12px 0 4px, #fd8 12px 12px 0 4px, #fd8 -12px 12px 0 4px; + } + 50% { + -webkit-transform: rotate(1080deg); + transform: rotate(1080deg); + -webkit-box-shadow: white 0 0 15px 0, #fd8 12px 12px 0 4px, #fd8 -12px 12px 0 4px, #fd8 -12px -12px 0 4px, #fd8 12px -12px 0 4px; + box-shadow: white 0 0 15px 0, #fd8 12px 12px 0 4px, #fd8 -12px 12px 0 4px, #fd8 -12px -12px 0 4px, #fd8 12px -12px 0 4px; + } +} +@keyframes flower-loader { + 0% { + -moz-transform: rotate(0deg); + -ms-transform: rotate(0deg); + -webkit-transform: rotate(0deg); + transform: rotate(0deg); + -moz-box-shadow: white 0 0 15px 0, #fd8 -12px -12px 0 4px, #fd8 12px -12px 0 4px, #fd8 12px 12px 0 4px, #fd8 -12px 12px 0 4px; + -webkit-box-shadow: white 0 0 15px 0, #fd8 -12px -12px 0 4px, #fd8 12px -12px 0 4px, #fd8 12px 12px 0 4px, #fd8 -12px 12px 0 4px; + box-shadow: white 0 0 15px 0, #fd8 -12px -12px 0 4px, #fd8 12px -12px 0 4px, #fd8 12px 12px 0 4px, #fd8 -12px 12px 0 4px; + } + 50% { + -moz-transform: rotate(1080deg); + -ms-transform: rotate(1080deg); + -webkit-transform: rotate(1080deg); + transform: rotate(1080deg); + -moz-box-shadow: white 0 0 15px 0, #fd8 12px 12px 0 4px, #fd8 -12px 12px 0 4px, #fd8 -12px -12px 0 4px, #fd8 12px -12px 0 4px; + -webkit-box-shadow: white 0 0 15px 0, #fd8 12px 12px 0 4px, #fd8 -12px 12px 0 4px, #fd8 -12px -12px 0 4px, #fd8 12px -12px 0 4px; + box-shadow: white 0 0 15px 0, #fd8 12px 12px 0 4px, #fd8 -12px 12px 0 4px, #fd8 -12px -12px 0 4px, #fd8 12px -12px 0 4px; + } +} +/* :not(:required) hides this rule from IE9 and below */ +.flower-loader:not(:required) { + overflow: hidden; + position: relative; + text-indent: -9999px; + display: inline-block; + width: 16px; + height: 16px; + background: #e96; + border-radius: 100%; + -moz-box-shadow: white 0 0 15px 0, #fd8 -12px -12px 0 4px, #fd8 12px -12px 0 4px, #fd8 12px 12px 0 4px, #fd8 -12px 12px 0 4px; + -webkit-box-shadow: white 0 0 15px 0, #fd8 -12px -12px 0 4px, #fd8 12px -12px 0 4px, #fd8 12px 12px 0 4px, #fd8 -12px 12px 0 4px; + box-shadow: white 0 0 15px 0, #fd8 -12px -12px 0 4px, #fd8 12px -12px 0 4px, #fd8 12px 12px 0 4px, #fd8 -12px 12px 0 4px; + -moz-animation: flower-loader 5s infinite ease-in-out; + -webkit-animation: flower-loader 5s infinite ease-in-out; + animation: flower-loader 5s infinite ease-in-out; + -moz-transform-origin: 50% 50%; + -ms-transform-origin: 50% 50%; + -webkit-transform-origin: 50% 50%; + transform-origin: 50% 50%; +} + +@-moz-keyframes dots-loader { + 0% { + -moz-box-shadow: #f86 -14px -14px 0 7px, #fc6 14px -14px 0 7px, #6d7 14px 14px 0 7px, #4ae -14px 14px 0 7px; + box-shadow: #f86 -14px -14px 0 7px, #fc6 14px -14px 0 7px, #6d7 14px 14px 0 7px, #4ae -14px 14px 0 7px; + } + 8.33% { + -moz-box-shadow: #f86 14px -14px 0 7px, #fc6 14px -14px 0 7px, #6d7 14px 14px 0 7px, #4ae -14px 14px 0 7px; + box-shadow: #f86 14px -14px 0 7px, #fc6 14px -14px 0 7px, #6d7 14px 14px 0 7px, #4ae -14px 14px 0 7px; + } + 16.67% { + -moz-box-shadow: #f86 14px 14px 0 7px, #fc6 14px 14px 0 7px, #6d7 14px 14px 0 7px, #4ae -14px 14px 0 7px; + box-shadow: #f86 14px 14px 0 7px, #fc6 14px 14px 0 7px, #6d7 14px 14px 0 7px, #4ae -14px 14px 0 7px; + } + 25% { + -moz-box-shadow: #f86 -14px 14px 0 7px, #fc6 -14px 14px 0 7px, #6d7 -14px 14px 0 7px, #4ae -14px 14px 0 7px; + box-shadow: #f86 -14px 14px 0 7px, #fc6 -14px 14px 0 7px, #6d7 -14px 14px 0 7px, #4ae -14px 14px 0 7px; + } + 33.33% { + -moz-box-shadow: #f86 -14px -14px 0 7px, #fc6 -14px 14px 0 7px, #6d7 -14px -14px 0 7px, #4ae -14px -14px 0 7px; + box-shadow: #f86 -14px -14px 0 7px, #fc6 -14px 14px 0 7px, #6d7 -14px -14px 0 7px, #4ae -14px -14px 0 7px; + } + 41.67% { + -moz-box-shadow: #f86 14px -14px 0 7px, #fc6 -14px 14px 0 7px, #6d7 -14px -14px 0 7px, #4ae 14px -14px 0 7px; + box-shadow: #f86 14px -14px 0 7px, #fc6 -14px 14px 0 7px, #6d7 -14px -14px 0 7px, #4ae 14px -14px 0 7px; + } + 50% { + -moz-box-shadow: #f86 14px 14px 0 7px, #fc6 -14px 14px 0 7px, #6d7 -14px -14px 0 7px, #4ae 14px -14px 0 7px; + box-shadow: #f86 14px 14px 0 7px, #fc6 -14px 14px 0 7px, #6d7 -14px -14px 0 7px, #4ae 14px -14px 0 7px; + } + 58.33% { + -moz-box-shadow: #f86 -14px 14px 0 7px, #fc6 -14px 14px 0 7px, #6d7 -14px -14px 0 7px, #4ae 14px -14px 0 7px; + box-shadow: #f86 -14px 14px 0 7px, #fc6 -14px 14px 0 7px, #6d7 -14px -14px 0 7px, #4ae 14px -14px 0 7px; + } + 66.67% { + -moz-box-shadow: #f86 -14px -14px 0 7px, #fc6 -14px -14px 0 7px, #6d7 -14px -14px 0 7px, #4ae 14px -14px 0 7px; + box-shadow: #f86 -14px -14px 0 7px, #fc6 -14px -14px 0 7px, #6d7 -14px -14px 0 7px, #4ae 14px -14px 0 7px; + } + 75% { + -moz-box-shadow: #f86 14px -14px 0 7px, #fc6 14px -14px 0 7px, #6d7 14px -14px 0 7px, #4ae 14px -14px 0 7px; + box-shadow: #f86 14px -14px 0 7px, #fc6 14px -14px 0 7px, #6d7 14px -14px 0 7px, #4ae 14px -14px 0 7px; + } + 83.33% { + -moz-box-shadow: #f86 14px 14px 0 7px, #fc6 14px -14px 0 7px, #6d7 14px 14px 0 7px, #4ae 14px 14px 0 7px; + box-shadow: #f86 14px 14px 0 7px, #fc6 14px -14px 0 7px, #6d7 14px 14px 0 7px, #4ae 14px 14px 0 7px; + } + 91.67% { + -moz-box-shadow: #f86 -14px 14px 0 7px, #fc6 14px -14px 0 7px, #6d7 14px 14px 0 7px, #4ae -14px 14px 0 7px; + box-shadow: #f86 -14px 14px 0 7px, #fc6 14px -14px 0 7px, #6d7 14px 14px 0 7px, #4ae -14px 14px 0 7px; + } + 100% { + -moz-box-shadow: #f86 -14px -14px 0 7px, #fc6 14px -14px 0 7px, #6d7 14px 14px 0 7px, #4ae -14px 14px 0 7px; + box-shadow: #f86 -14px -14px 0 7px, #fc6 14px -14px 0 7px, #6d7 14px 14px 0 7px, #4ae -14px 14px 0 7px; + } +} +@-webkit-keyframes dots-loader { + 0% { + -webkit-box-shadow: #f86 -14px -14px 0 7px, #fc6 14px -14px 0 7px, #6d7 14px 14px 0 7px, #4ae -14px 14px 0 7px; + box-shadow: #f86 -14px -14px 0 7px, #fc6 14px -14px 0 7px, #6d7 14px 14px 0 7px, #4ae -14px 14px 0 7px; + } + 8.33% { + -webkit-box-shadow: #f86 14px -14px 0 7px, #fc6 14px -14px 0 7px, #6d7 14px 14px 0 7px, #4ae -14px 14px 0 7px; + box-shadow: #f86 14px -14px 0 7px, #fc6 14px -14px 0 7px, #6d7 14px 14px 0 7px, #4ae -14px 14px 0 7px; + } + 16.67% { + -webkit-box-shadow: #f86 14px 14px 0 7px, #fc6 14px 14px 0 7px, #6d7 14px 14px 0 7px, #4ae -14px 14px 0 7px; + box-shadow: #f86 14px 14px 0 7px, #fc6 14px 14px 0 7px, #6d7 14px 14px 0 7px, #4ae -14px 14px 0 7px; + } + 25% { + -webkit-box-shadow: #f86 -14px 14px 0 7px, #fc6 -14px 14px 0 7px, #6d7 -14px 14px 0 7px, #4ae -14px 14px 0 7px; + box-shadow: #f86 -14px 14px 0 7px, #fc6 -14px 14px 0 7px, #6d7 -14px 14px 0 7px, #4ae -14px 14px 0 7px; + } + 33.33% { + -webkit-box-shadow: #f86 -14px -14px 0 7px, #fc6 -14px 14px 0 7px, #6d7 -14px -14px 0 7px, #4ae -14px -14px 0 7px; + box-shadow: #f86 -14px -14px 0 7px, #fc6 -14px 14px 0 7px, #6d7 -14px -14px 0 7px, #4ae -14px -14px 0 7px; + } + 41.67% { + -webkit-box-shadow: #f86 14px -14px 0 7px, #fc6 -14px 14px 0 7px, #6d7 -14px -14px 0 7px, #4ae 14px -14px 0 7px; + box-shadow: #f86 14px -14px 0 7px, #fc6 -14px 14px 0 7px, #6d7 -14px -14px 0 7px, #4ae 14px -14px 0 7px; + } + 50% { + -webkit-box-shadow: #f86 14px 14px 0 7px, #fc6 -14px 14px 0 7px, #6d7 -14px -14px 0 7px, #4ae 14px -14px 0 7px; + box-shadow: #f86 14px 14px 0 7px, #fc6 -14px 14px 0 7px, #6d7 -14px -14px 0 7px, #4ae 14px -14px 0 7px; + } + 58.33% { + -webkit-box-shadow: #f86 -14px 14px 0 7px, #fc6 -14px 14px 0 7px, #6d7 -14px -14px 0 7px, #4ae 14px -14px 0 7px; + box-shadow: #f86 -14px 14px 0 7px, #fc6 -14px 14px 0 7px, #6d7 -14px -14px 0 7px, #4ae 14px -14px 0 7px; + } + 66.67% { + -webkit-box-shadow: #f86 -14px -14px 0 7px, #fc6 -14px -14px 0 7px, #6d7 -14px -14px 0 7px, #4ae 14px -14px 0 7px; + box-shadow: #f86 -14px -14px 0 7px, #fc6 -14px -14px 0 7px, #6d7 -14px -14px 0 7px, #4ae 14px -14px 0 7px; + } + 75% { + -webkit-box-shadow: #f86 14px -14px 0 7px, #fc6 14px -14px 0 7px, #6d7 14px -14px 0 7px, #4ae 14px -14px 0 7px; + box-shadow: #f86 14px -14px 0 7px, #fc6 14px -14px 0 7px, #6d7 14px -14px 0 7px, #4ae 14px -14px 0 7px; + } + 83.33% { + -webkit-box-shadow: #f86 14px 14px 0 7px, #fc6 14px -14px 0 7px, #6d7 14px 14px 0 7px, #4ae 14px 14px 0 7px; + box-shadow: #f86 14px 14px 0 7px, #fc6 14px -14px 0 7px, #6d7 14px 14px 0 7px, #4ae 14px 14px 0 7px; + } + 91.67% { + -webkit-box-shadow: #f86 -14px 14px 0 7px, #fc6 14px -14px 0 7px, #6d7 14px 14px 0 7px, #4ae -14px 14px 0 7px; + box-shadow: #f86 -14px 14px 0 7px, #fc6 14px -14px 0 7px, #6d7 14px 14px 0 7px, #4ae -14px 14px 0 7px; + } + 100% { + -webkit-box-shadow: #f86 -14px -14px 0 7px, #fc6 14px -14px 0 7px, #6d7 14px 14px 0 7px, #4ae -14px 14px 0 7px; + box-shadow: #f86 -14px -14px 0 7px, #fc6 14px -14px 0 7px, #6d7 14px 14px 0 7px, #4ae -14px 14px 0 7px; + } +} +@keyframes dots-loader { + 0% { + -moz-box-shadow: #f86 -14px -14px 0 7px, #fc6 14px -14px 0 7px, #6d7 14px 14px 0 7px, #4ae -14px 14px 0 7px; + -webkit-box-shadow: #f86 -14px -14px 0 7px, #fc6 14px -14px 0 7px, #6d7 14px 14px 0 7px, #4ae -14px 14px 0 7px; + box-shadow: #f86 -14px -14px 0 7px, #fc6 14px -14px 0 7px, #6d7 14px 14px 0 7px, #4ae -14px 14px 0 7px; + } + 8.33% { + -moz-box-shadow: #f86 14px -14px 0 7px, #fc6 14px -14px 0 7px, #6d7 14px 14px 0 7px, #4ae -14px 14px 0 7px; + -webkit-box-shadow: #f86 14px -14px 0 7px, #fc6 14px -14px 0 7px, #6d7 14px 14px 0 7px, #4ae -14px 14px 0 7px; + box-shadow: #f86 14px -14px 0 7px, #fc6 14px -14px 0 7px, #6d7 14px 14px 0 7px, #4ae -14px 14px 0 7px; + } + 16.67% { + -moz-box-shadow: #f86 14px 14px 0 7px, #fc6 14px 14px 0 7px, #6d7 14px 14px 0 7px, #4ae -14px 14px 0 7px; + -webkit-box-shadow: #f86 14px 14px 0 7px, #fc6 14px 14px 0 7px, #6d7 14px 14px 0 7px, #4ae -14px 14px 0 7px; + box-shadow: #f86 14px 14px 0 7px, #fc6 14px 14px 0 7px, #6d7 14px 14px 0 7px, #4ae -14px 14px 0 7px; + } + 25% { + -moz-box-shadow: #f86 -14px 14px 0 7px, #fc6 -14px 14px 0 7px, #6d7 -14px 14px 0 7px, #4ae -14px 14px 0 7px; + -webkit-box-shadow: #f86 -14px 14px 0 7px, #fc6 -14px 14px 0 7px, #6d7 -14px 14px 0 7px, #4ae -14px 14px 0 7px; + box-shadow: #f86 -14px 14px 0 7px, #fc6 -14px 14px 0 7px, #6d7 -14px 14px 0 7px, #4ae -14px 14px 0 7px; + } + 33.33% { + -moz-box-shadow: #f86 -14px -14px 0 7px, #fc6 -14px 14px 0 7px, #6d7 -14px -14px 0 7px, #4ae -14px -14px 0 7px; + -webkit-box-shadow: #f86 -14px -14px 0 7px, #fc6 -14px 14px 0 7px, #6d7 -14px -14px 0 7px, #4ae -14px -14px 0 7px; + box-shadow: #f86 -14px -14px 0 7px, #fc6 -14px 14px 0 7px, #6d7 -14px -14px 0 7px, #4ae -14px -14px 0 7px; + } + 41.67% { + -moz-box-shadow: #f86 14px -14px 0 7px, #fc6 -14px 14px 0 7px, #6d7 -14px -14px 0 7px, #4ae 14px -14px 0 7px; + -webkit-box-shadow: #f86 14px -14px 0 7px, #fc6 -14px 14px 0 7px, #6d7 -14px -14px 0 7px, #4ae 14px -14px 0 7px; + box-shadow: #f86 14px -14px 0 7px, #fc6 -14px 14px 0 7px, #6d7 -14px -14px 0 7px, #4ae 14px -14px 0 7px; + } + 50% { + -moz-box-shadow: #f86 14px 14px 0 7px, #fc6 -14px 14px 0 7px, #6d7 -14px -14px 0 7px, #4ae 14px -14px 0 7px; + -webkit-box-shadow: #f86 14px 14px 0 7px, #fc6 -14px 14px 0 7px, #6d7 -14px -14px 0 7px, #4ae 14px -14px 0 7px; + box-shadow: #f86 14px 14px 0 7px, #fc6 -14px 14px 0 7px, #6d7 -14px -14px 0 7px, #4ae 14px -14px 0 7px; + } + 58.33% { + -moz-box-shadow: #f86 -14px 14px 0 7px, #fc6 -14px 14px 0 7px, #6d7 -14px -14px 0 7px, #4ae 14px -14px 0 7px; + -webkit-box-shadow: #f86 -14px 14px 0 7px, #fc6 -14px 14px 0 7px, #6d7 -14px -14px 0 7px, #4ae 14px -14px 0 7px; + box-shadow: #f86 -14px 14px 0 7px, #fc6 -14px 14px 0 7px, #6d7 -14px -14px 0 7px, #4ae 14px -14px 0 7px; + } + 66.67% { + -moz-box-shadow: #f86 -14px -14px 0 7px, #fc6 -14px -14px 0 7px, #6d7 -14px -14px 0 7px, #4ae 14px -14px 0 7px; + -webkit-box-shadow: #f86 -14px -14px 0 7px, #fc6 -14px -14px 0 7px, #6d7 -14px -14px 0 7px, #4ae 14px -14px 0 7px; + box-shadow: #f86 -14px -14px 0 7px, #fc6 -14px -14px 0 7px, #6d7 -14px -14px 0 7px, #4ae 14px -14px 0 7px; + } + 75% { + -moz-box-shadow: #f86 14px -14px 0 7px, #fc6 14px -14px 0 7px, #6d7 14px -14px 0 7px, #4ae 14px -14px 0 7px; + -webkit-box-shadow: #f86 14px -14px 0 7px, #fc6 14px -14px 0 7px, #6d7 14px -14px 0 7px, #4ae 14px -14px 0 7px; + box-shadow: #f86 14px -14px 0 7px, #fc6 14px -14px 0 7px, #6d7 14px -14px 0 7px, #4ae 14px -14px 0 7px; + } + 83.33% { + -moz-box-shadow: #f86 14px 14px 0 7px, #fc6 14px -14px 0 7px, #6d7 14px 14px 0 7px, #4ae 14px 14px 0 7px; + -webkit-box-shadow: #f86 14px 14px 0 7px, #fc6 14px -14px 0 7px, #6d7 14px 14px 0 7px, #4ae 14px 14px 0 7px; + box-shadow: #f86 14px 14px 0 7px, #fc6 14px -14px 0 7px, #6d7 14px 14px 0 7px, #4ae 14px 14px 0 7px; + } + 91.67% { + -moz-box-shadow: #f86 -14px 14px 0 7px, #fc6 14px -14px 0 7px, #6d7 14px 14px 0 7px, #4ae -14px 14px 0 7px; + -webkit-box-shadow: #f86 -14px 14px 0 7px, #fc6 14px -14px 0 7px, #6d7 14px 14px 0 7px, #4ae -14px 14px 0 7px; + box-shadow: #f86 -14px 14px 0 7px, #fc6 14px -14px 0 7px, #6d7 14px 14px 0 7px, #4ae -14px 14px 0 7px; + } + 100% { + -moz-box-shadow: #f86 -14px -14px 0 7px, #fc6 14px -14px 0 7px, #6d7 14px 14px 0 7px, #4ae -14px 14px 0 7px; + -webkit-box-shadow: #f86 -14px -14px 0 7px, #fc6 14px -14px 0 7px, #6d7 14px 14px 0 7px, #4ae -14px 14px 0 7px; + box-shadow: #f86 -14px -14px 0 7px, #fc6 14px -14px 0 7px, #6d7 14px 14px 0 7px, #4ae -14px 14px 0 7px; + } +} +/* :not(:required) hides this rule from IE9 and below */ +.dots-loader:not(:required) { + overflow: hidden; + position: relative; + text-indent: -9999px; + display: inline-block; + width: 7px; + height: 7px; + background: transparent; + border-radius: 100%; + -moz-box-shadow: #f86 -14px -14px 0 7px, #fc6 14px -14px 0 7px, #6d7 14px 14px 0 7px, #4ae -14px 14px 0 7px; + -webkit-box-shadow: #f86 -14px -14px 0 7px, #fc6 14px -14px 0 7px, #6d7 14px 14px 0 7px, #4ae -14px 14px 0 7px; + box-shadow: #f86 -14px -14px 0 7px, #fc6 14px -14px 0 7px, #6d7 14px 14px 0 7px, #4ae -14px 14px 0 7px; + -moz-animation: dots-loader 5s infinite ease-in-out; + -webkit-animation: dots-loader 5s infinite ease-in-out; + animation: dots-loader 5s infinite ease-in-out; + -moz-transform-origin: 50% 50%; + -ms-transform-origin: 50% 50%; + -webkit-transform-origin: 50% 50%; + transform-origin: 50% 50%; +} + +@-moz-keyframes circles-loader { + 0% { + -moz-transform: rotate(-720deg); + transform: rotate(-720deg); + } + 50% { + -moz-transform: rotate(720deg); + transform: rotate(720deg); + } +} +@-webkit-keyframes circles-loader { + 0% { + -webkit-transform: rotate(-720deg); + transform: rotate(-720deg); + } + 50% { + -webkit-transform: rotate(720deg); + transform: rotate(720deg); + } +} +@keyframes circles-loader { + 0% { + -moz-transform: rotate(-720deg); + -ms-transform: rotate(-720deg); + -webkit-transform: rotate(-720deg); + transform: rotate(-720deg); + } + 50% { + -moz-transform: rotate(720deg); + -ms-transform: rotate(720deg); + -webkit-transform: rotate(720deg); + transform: rotate(720deg); + } +} +/* :not(:required) hides this rule from IE9 and below */ +.circles-loader:not(:required) { + position: relative; + text-indent: -9999px; + display: inline-block; + width: 25px; + height: 25px; + background: rgba(255, 204, 51, 0.9); + border-radius: 100%; + -moz-animation: circles-loader 3s infinite ease-in-out; + -webkit-animation: circles-loader 3s infinite ease-in-out; + animation: circles-loader 3s infinite ease-in-out; + -moz-transform-origin: 50% 100%; + -ms-transform-origin: 50% 100%; + -webkit-transform-origin: 50% 100%; + transform-origin: 50% 100%; +} +.circles-loader:not(:required)::before { + background: rgba(255, 102, 0, 0.6); + border-radius: 100%; + content: ''; + position: absolute; + width: 25px; + height: 25px; + top: 18.75px; + left: -10.82532px; +} +.circles-loader:not(:required)::after { + background: rgba(255, 51, 0, 0.4); + border-radius: 100%; + content: ''; + position: absolute; + width: 25px; + height: 25px; + top: 18.75px; + left: 10.82532px; +} + +@-moz-keyframes plus-loader-top { + 2.5% { + background: #f86; + -moz-transform: rotateY(0deg); + transform: rotateY(0deg); + -moz-animation-timing-function: ease-in; + animation-timing-function: ease-in; + } + 13.75% { + background: #ff430d; + -moz-transform: rotateY(90deg); + transform: rotateY(90deg); + -moz-animation-timing-function: step-start; + animation-timing-function: step-start; + } + 13.76% { + background: #ffae0d; + -moz-transform: rotateY(90deg); + transform: rotateY(90deg); + -moz-animation-timing-function: ease-out; + animation-timing-function: ease-out; + } + 25% { + background: #fc6; + -moz-transform: rotateY(180deg); + transform: rotateY(180deg); + } + 27.5% { + background: #fc6; + -moz-transform: rotateY(180deg); + transform: rotateY(180deg); + -moz-animation-timing-function: ease-in; + animation-timing-function: ease-in; + } + 41.25% { + background: #ffae0d; + -moz-transform: rotateY(90deg); + transform: rotateY(90deg); + -moz-animation-timing-function: step-start; + animation-timing-function: step-start; + } + 41.26% { + background: #2cc642; + -moz-transform: rotateY(90deg); + transform: rotateY(90deg); + -moz-animation-timing-function: ease-out; + animation-timing-function: ease-out; + } + 50% { + background: #6d7; + -moz-transform: rotateY(0deg); + transform: rotateY(0deg); + } + 52.5% { + background: #6d7; + -moz-transform: rotateY(0deg); + transform: rotateY(0deg); + -moz-animation-timing-function: ease-in; + animation-timing-function: ease-in; + } + 63.75% { + background: #2cc642; + -moz-transform: rotateY(90deg); + transform: rotateY(90deg); + -moz-animation-timing-function: step-start; + animation-timing-function: step-start; + } + 63.76% { + background: #1386d2; + -moz-transform: rotateY(90deg); + transform: rotateY(90deg); + -moz-animation-timing-function: ease-out; + animation-timing-function: ease-out; + } + 75% { + background: #4ae; + -moz-transform: rotateY(180deg); + transform: rotateY(180deg); + } + 77.5% { + background: #4ae; + -moz-transform: rotateY(180deg); + transform: rotateY(180deg); + -moz-animation-timing-function: ease-in; + animation-timing-function: ease-in; + } + 91.25% { + background: #1386d2; + -moz-transform: rotateY(90deg); + transform: rotateY(90deg); + -moz-animation-timing-function: step-start; + animation-timing-function: step-start; + } + 91.26% { + background: #ff430d; + -moz-transform: rotateY(90deg); + transform: rotateY(90deg); + -moz-animation-timing-function: ease-in; + animation-timing-function: ease-in; + } + 100% { + background: #f86; + -moz-transform: rotateY(0deg); + transform: rotateY(0deg); + -moz-animation-timing-function: step-start; + animation-timing-function: step-start; + } +} +@-webkit-keyframes plus-loader-top { + 2.5% { + background: #f86; + -webkit-transform: rotateY(0deg); + transform: rotateY(0deg); + -webkit-animation-timing-function: ease-in; + animation-timing-function: ease-in; + } + 13.75% { + background: #ff430d; + -webkit-transform: rotateY(90deg); + transform: rotateY(90deg); + -webkit-animation-timing-function: step-start; + animation-timing-function: step-start; + } + 13.76% { + background: #ffae0d; + -webkit-transform: rotateY(90deg); + transform: rotateY(90deg); + -webkit-animation-timing-function: ease-out; + animation-timing-function: ease-out; + } + 25% { + background: #fc6; + -webkit-transform: rotateY(180deg); + transform: rotateY(180deg); + } + 27.5% { + background: #fc6; + -webkit-transform: rotateY(180deg); + transform: rotateY(180deg); + -webkit-animation-timing-function: ease-in; + animation-timing-function: ease-in; + } + 41.25% { + background: #ffae0d; + -webkit-transform: rotateY(90deg); + transform: rotateY(90deg); + -webkit-animation-timing-function: step-start; + animation-timing-function: step-start; + } + 41.26% { + background: #2cc642; + -webkit-transform: rotateY(90deg); + transform: rotateY(90deg); + -webkit-animation-timing-function: ease-out; + animation-timing-function: ease-out; + } + 50% { + background: #6d7; + -webkit-transform: rotateY(0deg); + transform: rotateY(0deg); + } + 52.5% { + background: #6d7; + -webkit-transform: rotateY(0deg); + transform: rotateY(0deg); + -webkit-animation-timing-function: ease-in; + animation-timing-function: ease-in; + } + 63.75% { + background: #2cc642; + -webkit-transform: rotateY(90deg); + transform: rotateY(90deg); + -webkit-animation-timing-function: step-start; + animation-timing-function: step-start; + } + 63.76% { + background: #1386d2; + -webkit-transform: rotateY(90deg); + transform: rotateY(90deg); + -webkit-animation-timing-function: ease-out; + animation-timing-function: ease-out; + } + 75% { + background: #4ae; + -webkit-transform: rotateY(180deg); + transform: rotateY(180deg); + } + 77.5% { + background: #4ae; + -webkit-transform: rotateY(180deg); + transform: rotateY(180deg); + -webkit-animation-timing-function: ease-in; + animation-timing-function: ease-in; + } + 91.25% { + background: #1386d2; + -webkit-transform: rotateY(90deg); + transform: rotateY(90deg); + -webkit-animation-timing-function: step-start; + animation-timing-function: step-start; + } + 91.26% { + background: #ff430d; + -webkit-transform: rotateY(90deg); + transform: rotateY(90deg); + -webkit-animation-timing-function: ease-in; + animation-timing-function: ease-in; + } + 100% { + background: #f86; + -webkit-transform: rotateY(0deg); + transform: rotateY(0deg); + -webkit-animation-timing-function: step-start; + animation-timing-function: step-start; + } +} +@keyframes plus-loader-top { + 2.5% { + background: #f86; + -moz-transform: rotateY(0deg); + -ms-transform: rotateY(0deg); + -webkit-transform: rotateY(0deg); + transform: rotateY(0deg); + -moz-animation-timing-function: ease-in; + -webkit-animation-timing-function: ease-in; + animation-timing-function: ease-in; + } + 13.75% { + background: #ff430d; + -moz-transform: rotateY(90deg); + -ms-transform: rotateY(90deg); + -webkit-transform: rotateY(90deg); + transform: rotateY(90deg); + -moz-animation-timing-function: step-start; + -webkit-animation-timing-function: step-start; + animation-timing-function: step-start; + } + 13.76% { + background: #ffae0d; + -moz-transform: rotateY(90deg); + -ms-transform: rotateY(90deg); + -webkit-transform: rotateY(90deg); + transform: rotateY(90deg); + -moz-animation-timing-function: ease-out; + -webkit-animation-timing-function: ease-out; + animation-timing-function: ease-out; + } + 25% { + background: #fc6; + -moz-transform: rotateY(180deg); + -ms-transform: rotateY(180deg); + -webkit-transform: rotateY(180deg); + transform: rotateY(180deg); + } + 27.5% { + background: #fc6; + -moz-transform: rotateY(180deg); + -ms-transform: rotateY(180deg); + -webkit-transform: rotateY(180deg); + transform: rotateY(180deg); + -moz-animation-timing-function: ease-in; + -webkit-animation-timing-function: ease-in; + animation-timing-function: ease-in; + } + 41.25% { + background: #ffae0d; + -moz-transform: rotateY(90deg); + -ms-transform: rotateY(90deg); + -webkit-transform: rotateY(90deg); + transform: rotateY(90deg); + -moz-animation-timing-function: step-start; + -webkit-animation-timing-function: step-start; + animation-timing-function: step-start; + } + 41.26% { + background: #2cc642; + -moz-transform: rotateY(90deg); + -ms-transform: rotateY(90deg); + -webkit-transform: rotateY(90deg); + transform: rotateY(90deg); + -moz-animation-timing-function: ease-out; + -webkit-animation-timing-function: ease-out; + animation-timing-function: ease-out; + } + 50% { + background: #6d7; + -moz-transform: rotateY(0deg); + -ms-transform: rotateY(0deg); + -webkit-transform: rotateY(0deg); + transform: rotateY(0deg); + } + 52.5% { + background: #6d7; + -moz-transform: rotateY(0deg); + -ms-transform: rotateY(0deg); + -webkit-transform: rotateY(0deg); + transform: rotateY(0deg); + -moz-animation-timing-function: ease-in; + -webkit-animation-timing-function: ease-in; + animation-timing-function: ease-in; + } + 63.75% { + background: #2cc642; + -moz-transform: rotateY(90deg); + -ms-transform: rotateY(90deg); + -webkit-transform: rotateY(90deg); + transform: rotateY(90deg); + -moz-animation-timing-function: step-start; + -webkit-animation-timing-function: step-start; + animation-timing-function: step-start; + } + 63.76% { + background: #1386d2; + -moz-transform: rotateY(90deg); + -ms-transform: rotateY(90deg); + -webkit-transform: rotateY(90deg); + transform: rotateY(90deg); + -moz-animation-timing-function: ease-out; + -webkit-animation-timing-function: ease-out; + animation-timing-function: ease-out; + } + 75% { + background: #4ae; + -moz-transform: rotateY(180deg); + -ms-transform: rotateY(180deg); + -webkit-transform: rotateY(180deg); + transform: rotateY(180deg); + } + 77.5% { + background: #4ae; + -moz-transform: rotateY(180deg); + -ms-transform: rotateY(180deg); + -webkit-transform: rotateY(180deg); + transform: rotateY(180deg); + -moz-animation-timing-function: ease-in; + -webkit-animation-timing-function: ease-in; + animation-timing-function: ease-in; + } + 91.25% { + background: #1386d2; + -moz-transform: rotateY(90deg); + -ms-transform: rotateY(90deg); + -webkit-transform: rotateY(90deg); + transform: rotateY(90deg); + -moz-animation-timing-function: step-start; + -webkit-animation-timing-function: step-start; + animation-timing-function: step-start; + } + 91.26% { + background: #ff430d; + -moz-transform: rotateY(90deg); + -ms-transform: rotateY(90deg); + -webkit-transform: rotateY(90deg); + transform: rotateY(90deg); + -moz-animation-timing-function: ease-in; + -webkit-animation-timing-function: ease-in; + animation-timing-function: ease-in; + } + 100% { + background: #f86; + -moz-transform: rotateY(0deg); + -ms-transform: rotateY(0deg); + -webkit-transform: rotateY(0deg); + transform: rotateY(0deg); + -moz-animation-timing-function: step-start; + -webkit-animation-timing-function: step-start; + animation-timing-function: step-start; + } +} +@-moz-keyframes plus-loader-bottom { + 0% { + background: #fc6; + -moz-animation-timing-function: step-start; + animation-timing-function: step-start; + } + 50% { + background: #fc6; + -moz-animation-timing-function: step-start; + animation-timing-function: step-start; + } + 75% { + background: #4ae; + -moz-animation-timing-function: step-start; + animation-timing-function: step-start; + } + 100% { + background: #4ae; + -moz-animation-timing-function: step-start; + animation-timing-function: step-start; + } +} +@-webkit-keyframes plus-loader-bottom { + 0% { + background: #fc6; + -webkit-animation-timing-function: step-start; + animation-timing-function: step-start; + } + 50% { + background: #fc6; + -webkit-animation-timing-function: step-start; + animation-timing-function: step-start; + } + 75% { + background: #4ae; + -webkit-animation-timing-function: step-start; + animation-timing-function: step-start; + } + 100% { + background: #4ae; + -webkit-animation-timing-function: step-start; + animation-timing-function: step-start; + } +} +@keyframes plus-loader-bottom { + 0% { + background: #fc6; + -moz-animation-timing-function: step-start; + -webkit-animation-timing-function: step-start; + animation-timing-function: step-start; + } + 50% { + background: #fc6; + -moz-animation-timing-function: step-start; + -webkit-animation-timing-function: step-start; + animation-timing-function: step-start; + } + 75% { + background: #4ae; + -moz-animation-timing-function: step-start; + -webkit-animation-timing-function: step-start; + animation-timing-function: step-start; + } + 100% { + background: #4ae; + -moz-animation-timing-function: step-start; + -webkit-animation-timing-function: step-start; + animation-timing-function: step-start; + } +} +@-moz-keyframes plus-loader-background { + 0% { + background: #f86; + -moz-transform: rotateZ(180deg); + transform: rotateZ(180deg); + } + 25% { + background: #f86; + -moz-transform: rotateZ(180deg); + transform: rotateZ(180deg); + -moz-animation-timing-function: step-start; + animation-timing-function: step-start; + } + 27.5% { + background: #6d7; + -moz-transform: rotateZ(90deg); + transform: rotateZ(90deg); + } + 50% { + background: #6d7; + -moz-transform: rotateZ(90deg); + transform: rotateZ(90deg); + -moz-animation-timing-function: step-start; + animation-timing-function: step-start; + } + 52.5% { + background: #6d7; + -moz-transform: rotateZ(0deg); + transform: rotateZ(0deg); + } + 75% { + background: #6d7; + -moz-transform: rotateZ(0deg); + transform: rotateZ(0deg); + -moz-animation-timing-function: step-start; + animation-timing-function: step-start; + } + 77.5% { + background: #f86; + -moz-transform: rotateZ(270deg); + transform: rotateZ(270deg); + } + 100% { + background: #f86; + -moz-transform: rotateZ(270deg); + transform: rotateZ(270deg); + -moz-animation-timing-function: step-start; + animation-timing-function: step-start; + } +} +@-webkit-keyframes plus-loader-background { + 0% { + background: #f86; + -webkit-transform: rotateZ(180deg); + transform: rotateZ(180deg); + } + 25% { + background: #f86; + -webkit-transform: rotateZ(180deg); + transform: rotateZ(180deg); + -webkit-animation-timing-function: step-start; + animation-timing-function: step-start; + } + 27.5% { + background: #6d7; + -webkit-transform: rotateZ(90deg); + transform: rotateZ(90deg); + } + 50% { + background: #6d7; + -webkit-transform: rotateZ(90deg); + transform: rotateZ(90deg); + -webkit-animation-timing-function: step-start; + animation-timing-function: step-start; + } + 52.5% { + background: #6d7; + -webkit-transform: rotateZ(0deg); + transform: rotateZ(0deg); + } + 75% { + background: #6d7; + -webkit-transform: rotateZ(0deg); + transform: rotateZ(0deg); + -webkit-animation-timing-function: step-start; + animation-timing-function: step-start; + } + 77.5% { + background: #f86; + -webkit-transform: rotateZ(270deg); + transform: rotateZ(270deg); + } + 100% { + background: #f86; + -webkit-transform: rotateZ(270deg); + transform: rotateZ(270deg); + -webkit-animation-timing-function: step-start; + animation-timing-function: step-start; + } +} +@keyframes plus-loader-background { + 0% { + background: #f86; + -moz-transform: rotateZ(180deg); + -ms-transform: rotateZ(180deg); + -webkit-transform: rotateZ(180deg); + transform: rotateZ(180deg); + } + 25% { + background: #f86; + -moz-transform: rotateZ(180deg); + -ms-transform: rotateZ(180deg); + -webkit-transform: rotateZ(180deg); + transform: rotateZ(180deg); + -moz-animation-timing-function: step-start; + -webkit-animation-timing-function: step-start; + animation-timing-function: step-start; + } + 27.5% { + background: #6d7; + -moz-transform: rotateZ(90deg); + -ms-transform: rotateZ(90deg); + -webkit-transform: rotateZ(90deg); + transform: rotateZ(90deg); + } + 50% { + background: #6d7; + -moz-transform: rotateZ(90deg); + -ms-transform: rotateZ(90deg); + -webkit-transform: rotateZ(90deg); + transform: rotateZ(90deg); + -moz-animation-timing-function: step-start; + -webkit-animation-timing-function: step-start; + animation-timing-function: step-start; + } + 52.5% { + background: #6d7; + -moz-transform: rotateZ(0deg); + -ms-transform: rotateZ(0deg); + -webkit-transform: rotateZ(0deg); + transform: rotateZ(0deg); + } + 75% { + background: #6d7; + -moz-transform: rotateZ(0deg); + -ms-transform: rotateZ(0deg); + -webkit-transform: rotateZ(0deg); + transform: rotateZ(0deg); + -moz-animation-timing-function: step-start; + -webkit-animation-timing-function: step-start; + animation-timing-function: step-start; + } + 77.5% { + background: #f86; + -moz-transform: rotateZ(270deg); + -ms-transform: rotateZ(270deg); + -webkit-transform: rotateZ(270deg); + transform: rotateZ(270deg); + } + 100% { + background: #f86; + -moz-transform: rotateZ(270deg); + -ms-transform: rotateZ(270deg); + -webkit-transform: rotateZ(270deg); + transform: rotateZ(270deg); + -moz-animation-timing-function: step-start; + -webkit-animation-timing-function: step-start; + animation-timing-function: step-start; + } +} +/* :not(:required) hides this rule from IE9 and below */ +.plus-loader:not(:required) { + overflow: hidden; + position: relative; + text-indent: -9999px; + display: inline-block; + width: 48px; + height: 48px; + background: #f86; + -moz-border-radius: 24px; + -webkit-border-radius: 24px; + border-radius: 24px; + -moz-transform: rotateZ(90deg); + -ms-transform: rotateZ(90deg); + -webkit-transform: rotateZ(90deg); + transform: rotateZ(90deg); + -moz-transform-origin: 50% 50%; + -ms-transform-origin: 50% 50%; + -webkit-transform-origin: 50% 50%; + transform-origin: 50% 50%; + -moz-animation: plus-loader-background 3s infinite ease-in-out; + -webkit-animation: plus-loader-background 3s infinite ease-in-out; + animation: plus-loader-background 3s infinite ease-in-out; +} +.plus-loader:not(:required)::after { + background: #f86; + -moz-border-radius: 24px 0 0 24px; + -webkit-border-radius: 24px; + border-radius: 24px 0 0 24px; + content: ''; + position: absolute; + right: 50%; + top: 0; + width: 50%; + height: 100%; + -moz-transform-origin: 100% 50%; + -ms-transform-origin: 100% 50%; + -webkit-transform-origin: 100% 50%; + transform-origin: 100% 50%; + -moz-animation: plus-loader-top 3s infinite linear; + -webkit-animation: plus-loader-top 3s infinite linear; + animation: plus-loader-top 3s infinite linear; +} +.plus-loader:not(:required)::before { + background: #fc6; + -moz-border-radius: 24px 0 0 24px; + -webkit-border-radius: 24px; + border-radius: 24px 0 0 24px; + content: ''; + position: absolute; + right: 50%; + top: 0; + width: 50%; + height: 100%; + -moz-transform-origin: 100% 50%; + -ms-transform-origin: 100% 50%; + -webkit-transform-origin: 100% 50%; + transform-origin: 100% 50%; + -moz-animation: plus-loader-bottom 3s infinite linear; + -webkit-animation: plus-loader-bottom 3s infinite linear; + animation: plus-loader-bottom 3s infinite linear; +} + +@-moz-keyframes ball-loader { + 0% { + -moz-transform: translate3d(0, 0, 0) scale3d(1, 1, 1); + transform: translate3d(0, 0, 0) scale3d(1, 1, 1); + -moz-animation-timing-function: ease-in; + animation-timing-function: ease-in; + } + 45% { + -moz-transform: translate3d(0, 150px, -10px) scale3d(1, 0.95, 1); + transform: translate3d(0, 150px, -10px) scale3d(1, 0.95, 1); + -moz-animation-timing-function: ease-in; + animation-timing-function: ease-in; + } + 50% { + -moz-transform: translate3d(0, 150px, -10px) scale3d(1, 0.5, 1); + transform: translate3d(0, 150px, -10px) scale3d(1, 0.5, 1); + -moz-animation-timing-function: linear; + animation-timing-function: linear; + } + 55% { + -moz-transform: translate3d(0, 150px, -10px) scale3d(1, 1.25, 1); + transform: translate3d(0, 150px, -10px) scale3d(1, 1.25, 1); + -moz-animation-timing-function: ease-out; + animation-timing-function: ease-out; + } +} +@-webkit-keyframes ball-loader { + 0% { + -webkit-transform: translate3d(0, 0, 0) scale3d(1, 1, 1); + transform: translate3d(0, 0, 0) scale3d(1, 1, 1); + -webkit-animation-timing-function: ease-in; + animation-timing-function: ease-in; + } + 45% { + -webkit-transform: translate3d(0, 150px, -10px) scale3d(1, 0.95, 1); + transform: translate3d(0, 150px, -10px) scale3d(1, 0.95, 1); + -webkit-animation-timing-function: ease-in; + animation-timing-function: ease-in; + } + 50% { + -webkit-transform: translate3d(0, 150px, -10px) scale3d(1, 0.5, 1); + transform: translate3d(0, 150px, -10px) scale3d(1, 0.5, 1); + -webkit-animation-timing-function: linear; + animation-timing-function: linear; + } + 55% { + -webkit-transform: translate3d(0, 150px, -10px) scale3d(1, 1.25, 1); + transform: translate3d(0, 150px, -10px) scale3d(1, 1.25, 1); + -webkit-animation-timing-function: ease-out; + animation-timing-function: ease-out; + } +} +@keyframes ball-loader { + 0% { + -moz-transform: translate3d(0, 0, 0) scale3d(1, 1, 1); + -ms-transform: translate3d(0, 0, 0) scale3d(1, 1, 1); + -webkit-transform: translate3d(0, 0, 0) scale3d(1, 1, 1); + transform: translate3d(0, 0, 0) scale3d(1, 1, 1); + -moz-animation-timing-function: ease-in; + -webkit-animation-timing-function: ease-in; + animation-timing-function: ease-in; + } + 45% { + -moz-transform: translate3d(0, 150px, -10px) scale3d(1, 0.95, 1); + -ms-transform: translate3d(0, 150px, -10px) scale3d(1, 0.95, 1); + -webkit-transform: translate3d(0, 150px, -10px) scale3d(1, 0.95, 1); + transform: translate3d(0, 150px, -10px) scale3d(1, 0.95, 1); + -moz-animation-timing-function: ease-in; + -webkit-animation-timing-function: ease-in; + animation-timing-function: ease-in; + } + 50% { + -moz-transform: translate3d(0, 150px, -10px) scale3d(1, 0.5, 1); + -ms-transform: translate3d(0, 150px, -10px) scale3d(1, 0.5, 1); + -webkit-transform: translate3d(0, 150px, -10px) scale3d(1, 0.5, 1); + transform: translate3d(0, 150px, -10px) scale3d(1, 0.5, 1); + -moz-animation-timing-function: linear; + -webkit-animation-timing-function: linear; + animation-timing-function: linear; + } + 55% { + -moz-transform: translate3d(0, 150px, -10px) scale3d(1, 1.25, 1); + -ms-transform: translate3d(0, 150px, -10px) scale3d(1, 1.25, 1); + -webkit-transform: translate3d(0, 150px, -10px) scale3d(1, 1.25, 1); + transform: translate3d(0, 150px, -10px) scale3d(1, 1.25, 1); + -moz-animation-timing-function: ease-out; + -webkit-animation-timing-function: ease-out; + animation-timing-function: ease-out; + } +} +@-moz-keyframes ball-loader-highlight { + 0% { + -moz-transform: skew(-20deg, 0) translate3d(0, 2.5px, 1px); + transform: skew(-20deg, 0) translate3d(0, 2.5px, 1px); + -moz-animation-timing-function: ease-in; + animation-timing-function: ease-in; + } + 45% { + -moz-transform: skew(-30deg, 0) translate3d(0, 0, 1px); + transform: skew(-30deg, 0) translate3d(0, 0, 1px); + -moz-animation-timing-function: ease-in; + animation-timing-function: ease-in; + } + 50% { + -moz-transform: skew(-30deg, 0) translate3d(0, 0, 1px); + transform: skew(-30deg, 0) translate3d(0, 0, 1px); + -moz-animation-timing-function: linear; + animation-timing-function: linear; + } + 55% { + -moz-transform: skew(-30deg, 0) translate3d(0, 0, 1px); + transform: skew(-30deg, 0) translate3d(0, 0, 1px); + -moz-animation-timing-function: ease-out; + animation-timing-function: ease-out; + } + 100% { + -moz-transform: skew(-20deg, 0) translate3d(0, 2.5px, 1px); + transform: skew(-20deg, 0) translate3d(0, 2.5px, 1px); + -moz-animation-timing-function: ease-in; + animation-timing-function: ease-in; + } +} +@-webkit-keyframes ball-loader-highlight { + 0% { + -webkit-transform: skew(-20deg, 0) translate3d(0, 2.5px, 1px); + transform: skew(-20deg, 0) translate3d(0, 2.5px, 1px); + -webkit-animation-timing-function: ease-in; + animation-timing-function: ease-in; + } + 45% { + -webkit-transform: skew(-30deg, 0) translate3d(0, 0, 1px); + transform: skew(-30deg, 0) translate3d(0, 0, 1px); + -webkit-animation-timing-function: ease-in; + animation-timing-function: ease-in; + } + 50% { + -webkit-transform: skew(-30deg, 0) translate3d(0, 0, 1px); + transform: skew(-30deg, 0) translate3d(0, 0, 1px); + -webkit-animation-timing-function: linear; + animation-timing-function: linear; + } + 55% { + -webkit-transform: skew(-30deg, 0) translate3d(0, 0, 1px); + transform: skew(-30deg, 0) translate3d(0, 0, 1px); + -webkit-animation-timing-function: ease-out; + animation-timing-function: ease-out; + } + 100% { + -webkit-transform: skew(-20deg, 0) translate3d(0, 2.5px, 1px); + transform: skew(-20deg, 0) translate3d(0, 2.5px, 1px); + -webkit-animation-timing-function: ease-in; + animation-timing-function: ease-in; + } +} +@keyframes ball-loader-highlight { + 0% { + -moz-transform: skew(-20deg, 0) translate3d(0, 2.5px, 1px); + -ms-transform: skew(-20deg, 0) translate3d(0, 2.5px, 1px); + -webkit-transform: skew(-20deg, 0) translate3d(0, 2.5px, 1px); + transform: skew(-20deg, 0) translate3d(0, 2.5px, 1px); + -moz-animation-timing-function: ease-in; + -webkit-animation-timing-function: ease-in; + animation-timing-function: ease-in; + } + 45% { + -moz-transform: skew(-30deg, 0) translate3d(0, 0, 1px); + -ms-transform: skew(-30deg, 0) translate3d(0, 0, 1px); + -webkit-transform: skew(-30deg, 0) translate3d(0, 0, 1px); + transform: skew(-30deg, 0) translate3d(0, 0, 1px); + -moz-animation-timing-function: ease-in; + -webkit-animation-timing-function: ease-in; + animation-timing-function: ease-in; + } + 50% { + -moz-transform: skew(-30deg, 0) translate3d(0, 0, 1px); + -ms-transform: skew(-30deg, 0) translate3d(0, 0, 1px); + -webkit-transform: skew(-30deg, 0) translate3d(0, 0, 1px); + transform: skew(-30deg, 0) translate3d(0, 0, 1px); + -moz-animation-timing-function: linear; + -webkit-animation-timing-function: linear; + animation-timing-function: linear; + } + 55% { + -moz-transform: skew(-30deg, 0) translate3d(0, 0, 1px); + -ms-transform: skew(-30deg, 0) translate3d(0, 0, 1px); + -webkit-transform: skew(-30deg, 0) translate3d(0, 0, 1px); + transform: skew(-30deg, 0) translate3d(0, 0, 1px); + -moz-animation-timing-function: ease-out; + -webkit-animation-timing-function: ease-out; + animation-timing-function: ease-out; + } + 100% { + -moz-transform: skew(-20deg, 0) translate3d(0, 2.5px, 1px); + -ms-transform: skew(-20deg, 0) translate3d(0, 2.5px, 1px); + -webkit-transform: skew(-20deg, 0) translate3d(0, 2.5px, 1px); + transform: skew(-20deg, 0) translate3d(0, 2.5px, 1px); + -moz-animation-timing-function: ease-in; + -webkit-animation-timing-function: ease-in; + animation-timing-function: ease-in; + } +} +@-moz-keyframes ball-loader-shadow { + 0% { + -moz-transform: translate3d(66.66667px, 66.66667px, -1px) scale3d(1.25, 1.25, 1); + transform: translate3d(66.66667px, 66.66667px, -1px) scale3d(1.25, 1.25, 1); + -moz-animation-timing-function: ease-in; + animation-timing-function: ease-in; + } + 45% { + -moz-transform: translate3d(12.5px, -15px, -1px); + transform: translate3d(12.5px, -15px, -1px); + -moz-animation-timing-function: ease-in; + animation-timing-function: ease-in; + } + 50% { + -moz-transform: translate3d(12.5px, -15px, -1px) scale3d(1, 1, 1); + transform: translate3d(12.5px, -15px, -1px) scale3d(1, 1, 1); + -moz-animation-timing-function: linear; + animation-timing-function: linear; + } + 55% { + -moz-transform: translate3d(12.5px, -15px, -1px); + transform: translate3d(12.5px, -15px, -1px); + -moz-animation-timing-function: ease-out; + animation-timing-function: ease-out; + } + 100% { + -moz-transform: translate3d(66.66667px, 66.66667px, -1px) scale3d(1.25, 1.25, 1); + transform: translate3d(66.66667px, 66.66667px, -1px) scale3d(1.25, 1.25, 1); + -moz-animation-timing-function: ease-in; + animation-timing-function: ease-in; + } +} +@-webkit-keyframes ball-loader-shadow { + 0% { + -webkit-transform: translate3d(66.66667px, 66.66667px, -1px) scale3d(1.25, 1.25, 1); + transform: translate3d(66.66667px, 66.66667px, -1px) scale3d(1.25, 1.25, 1); + -webkit-animation-timing-function: ease-in; + animation-timing-function: ease-in; + } + 45% { + -webkit-transform: translate3d(12.5px, -15px, -1px); + transform: translate3d(12.5px, -15px, -1px); + -webkit-animation-timing-function: ease-in; + animation-timing-function: ease-in; + } + 50% { + -webkit-transform: translate3d(12.5px, -15px, -1px) scale3d(1, 1, 1); + transform: translate3d(12.5px, -15px, -1px) scale3d(1, 1, 1); + -webkit-animation-timing-function: linear; + animation-timing-function: linear; + } + 55% { + -webkit-transform: translate3d(12.5px, -15px, -1px); + transform: translate3d(12.5px, -15px, -1px); + -webkit-animation-timing-function: ease-out; + animation-timing-function: ease-out; + } + 100% { + -webkit-transform: translate3d(66.66667px, 66.66667px, -1px) scale3d(1.25, 1.25, 1); + transform: translate3d(66.66667px, 66.66667px, -1px) scale3d(1.25, 1.25, 1); + -webkit-animation-timing-function: ease-in; + animation-timing-function: ease-in; + } +} +@keyframes ball-loader-shadow { + 0% { + -moz-transform: translate3d(66.66667px, 66.66667px, -1px) scale3d(1.25, 1.25, 1); + -ms-transform: translate3d(66.66667px, 66.66667px, -1px) scale3d(1.25, 1.25, 1); + -webkit-transform: translate3d(66.66667px, 66.66667px, -1px) scale3d(1.25, 1.25, 1); + transform: translate3d(66.66667px, 66.66667px, -1px) scale3d(1.25, 1.25, 1); + -moz-animation-timing-function: ease-in; + -webkit-animation-timing-function: ease-in; + animation-timing-function: ease-in; + } + 45% { + -moz-transform: translate3d(12.5px, -15px, -1px); + -ms-transform: translate3d(12.5px, -15px, -1px); + -webkit-transform: translate3d(12.5px, -15px, -1px); + transform: translate3d(12.5px, -15px, -1px); + -moz-animation-timing-function: ease-in; + -webkit-animation-timing-function: ease-in; + animation-timing-function: ease-in; + } + 50% { + -moz-transform: translate3d(12.5px, -15px, -1px) scale3d(1, 1, 1); + -ms-transform: translate3d(12.5px, -15px, -1px) scale3d(1, 1, 1); + -webkit-transform: translate3d(12.5px, -15px, -1px) scale3d(1, 1, 1); + transform: translate3d(12.5px, -15px, -1px) scale3d(1, 1, 1); + -moz-animation-timing-function: linear; + -webkit-animation-timing-function: linear; + animation-timing-function: linear; + } + 55% { + -moz-transform: translate3d(12.5px, -15px, -1px); + -ms-transform: translate3d(12.5px, -15px, -1px); + -webkit-transform: translate3d(12.5px, -15px, -1px); + transform: translate3d(12.5px, -15px, -1px); + -moz-animation-timing-function: ease-out; + -webkit-animation-timing-function: ease-out; + animation-timing-function: ease-out; + } + 100% { + -moz-transform: translate3d(66.66667px, 66.66667px, -1px) scale3d(1.25, 1.25, 1); + -ms-transform: translate3d(66.66667px, 66.66667px, -1px) scale3d(1.25, 1.25, 1); + -webkit-transform: translate3d(66.66667px, 66.66667px, -1px) scale3d(1.25, 1.25, 1); + transform: translate3d(66.66667px, 66.66667px, -1px) scale3d(1.25, 1.25, 1); + -moz-animation-timing-function: ease-in; + -webkit-animation-timing-function: ease-in; + animation-timing-function: ease-in; + } +} +/* :not(:required) hides this rule from IE9 and below */ +.ball-loader:not(:required) { + position: relative; + display: inline-block; + font-size: 0; + letter-spacing: -1px; + border-radius: 100%; + background: #f86; + width: 50px; + height: 50px; + -moz-transform-style: preserve-3d; + -webkit-transform-style: preserve-3d; + transform-style: preserve-3d; + -moz-transform: translate3d(0, 0, 0) scale3d(1, 1, 1); + -ms-transform: translate3d(0, 0, 0) scale3d(1, 1, 1); + -webkit-transform: translate3d(0, 0, 0) scale3d(1, 1, 1); + transform: translate3d(0, 0, 0) scale3d(1, 1, 1); + -moz-transform-origin: 0 100%; + -ms-transform-origin: 0 100%; + -webkit-transform-origin: 0 100%; + transform-origin: 0 100%; + -moz-animation: ball-loader 1500ms infinite linear; + -webkit-animation: ball-loader 1500ms infinite linear; + animation: ball-loader 1500ms infinite linear; +} +.ball-loader:not(:required)::after { + content: ''; + position: absolute; + top: 4.5px; + left: 5.5px; + width: 15px; + height: 15px; + background: #ffb099; + border-radius: 100%; + -moz-transform: skew(-20deg, 0) translate3d(0, 2.5px, 1px); + -ms-transform: skew(-20deg, 0) translate3d(0, 2.5px, 1px); + -webkit-transform: skew(-20deg, 0) translate3d(0, 2.5px, 1px); + transform: skew(-20deg, 0) translate3d(0, 2.5px, 1px); + -moz-animation: ball-loader-highlight 1500ms infinite linear; + -webkit-animation: ball-loader-highlight 1500ms infinite linear; + animation: ball-loader-highlight 1500ms infinite linear; +} +.ball-loader:not(:required)::before { + content: ''; + position: absolute; + top: 50px; + left: 5.5px; + width: 50px; + height: 15px; + background: rgba(0, 0, 0, 0.2); + border-radius: 100%; + -moz-transform: translate3d(66.66667px, 66.66667px, -1px) scale3d(1.25, 1.25, 1); + -ms-transform: translate3d(66.66667px, 66.66667px, -1px) scale3d(1.25, 1.25, 1); + -webkit-transform: translate3d(66.66667px, 66.66667px, -1px) scale3d(1.25, 1.25, 1); + transform: translate3d(66.66667px, 66.66667px, -1px) scale3d(1.25, 1.25, 1); + -moz-animation: ball-loader-shadow 1500ms infinite linear; + -webkit-animation: ball-loader-shadow 1500ms infinite linear; + animation: ball-loader-shadow 1500ms infinite linear; + -webkit-filter: blur(1px); + filter: blur(1px); +} + +@-moz-keyframes hexdots-loader { + 0% { + -moz-box-shadow: #666666 0 -30px 0 7px, #999 0 -30px 0 7px, #999 26px -15px 0 7px, #999 26px 15px 0 7px, #999 0 30px 0 7px, #999 -26px 15px 0 7px, #999 -26px -15px 0 7px; + box-shadow: #666666 0 -30px 0 7px, #999 0 -30px 0 7px, #999 26px -15px 0 7px, #999 26px 15px 0 7px, #999 0 30px 0 7px, #999 -26px 15px 0 7px, #999 -26px -15px 0 7px; + } + 8.33% { + -moz-box-shadow: #666666 26px -15px 0 7px, #999 26px -15px 0 7px, #999 26px -15px 0 7px, #999 26px 15px 0 7px, #999 0 30px 0 7px, #999 -26px 15px 0 7px, #999 -26px -15px 0 7px; + box-shadow: #666666 26px -15px 0 7px, #999 26px -15px 0 7px, #999 26px -15px 0 7px, #999 26px 15px 0 7px, #999 0 30px 0 7px, #999 -26px 15px 0 7px, #999 -26px -15px 0 7px; + } + 16.67% { + -moz-box-shadow: #666666 26px 15px 0 7px, #999 26px 15px 0 7px, #999 26px 15px 0 7px, #999 26px 15px 0 7px, #999 0 30px 0 7px, #999 -26px 15px 0 7px, #999 -26px -15px 0 7px; + box-shadow: #666666 26px 15px 0 7px, #999 26px 15px 0 7px, #999 26px 15px 0 7px, #999 26px 15px 0 7px, #999 0 30px 0 7px, #999 -26px 15px 0 7px, #999 -26px -15px 0 7px; + } + 25% { + -moz-box-shadow: #666666 0 30px 0 7px, #999 0 30px 0 7px, #999 0 30px 0 7px, #999 0 30px 0 7px, #999 0 30px 0 7px, #999 -26px 15px 0 7px, #999 -26px -15px 0 7px; + box-shadow: #666666 0 30px 0 7px, #999 0 30px 0 7px, #999 0 30px 0 7px, #999 0 30px 0 7px, #999 0 30px 0 7px, #999 -26px 15px 0 7px, #999 -26px -15px 0 7px; + } + 33.33% { + -moz-box-shadow: #666666 -26px 15px 0 7px, #999 -26px 15px 0 7px, #999 -26px 15px 0 7px, #999 -26px 15px 0 7px, #999 -26px 15px 0 7px, #999 -26px 15px 0 7px, #999 -26px -15px 0 7px; + box-shadow: #666666 -26px 15px 0 7px, #999 -26px 15px 0 7px, #999 -26px 15px 0 7px, #999 -26px 15px 0 7px, #999 -26px 15px 0 7px, #999 -26px 15px 0 7px, #999 -26px -15px 0 7px; + } + 41.67% { + -moz-box-shadow: #666666 -26px -15px 0 7px, #999 -26px -15px 0 7px, #999 -26px -15px 0 7px, #999 -26px -15px 0 7px, #999 -26px -15px 0 7px, #999 -26px -15px 0 7px, #999 -26px -15px 0 7px; + box-shadow: #666666 -26px -15px 0 7px, #999 -26px -15px 0 7px, #999 -26px -15px 0 7px, #999 -26px -15px 0 7px, #999 -26px -15px 0 7px, #999 -26px -15px 0 7px, #999 -26px -15px 0 7px; + } + 50% { + -moz-box-shadow: #666666 0 -30px 0 7px, #999 0 -30px 0 7px, #999 0 -30px 0 7px, #999 0 -30px 0 7px, #999 0 -30px 0 7px, #999 0 -30px 0 7px, #999 0 -30px 0 7px; + box-shadow: #666666 0 -30px 0 7px, #999 0 -30px 0 7px, #999 0 -30px 0 7px, #999 0 -30px 0 7px, #999 0 -30px 0 7px, #999 0 -30px 0 7px, #999 0 -30px 0 7px; + } + 58.33% { + -moz-box-shadow: #666666 26px -15px 0 7px, #999 0 -30px 0 7px, #999 26px -15px 0 7px, #999 26px -15px 0 7px, #999 26px -15px 0 7px, #999 26px -15px 0 7px, #999 26px -15px 0 7px; + box-shadow: #666666 26px -15px 0 7px, #999 0 -30px 0 7px, #999 26px -15px 0 7px, #999 26px -15px 0 7px, #999 26px -15px 0 7px, #999 26px -15px 0 7px, #999 26px -15px 0 7px; + } + 66.67% { + -moz-box-shadow: #666666 26px 15px 0 7px, #999 0 -30px 0 7px, #999 26px -15px 0 7px, #999 26px 15px 0 7px, #999 26px 15px 0 7px, #999 26px 15px 0 7px, #999 26px 15px 0 7px; + box-shadow: #666666 26px 15px 0 7px, #999 0 -30px 0 7px, #999 26px -15px 0 7px, #999 26px 15px 0 7px, #999 26px 15px 0 7px, #999 26px 15px 0 7px, #999 26px 15px 0 7px; + } + 75% { + -moz-box-shadow: #666666 0 30px 0 7px, #999 0 -30px 0 7px, #999 26px -15px 0 7px, #999 26px 15px 0 7px, #999 0 30px 0 7px, #999 0 30px 0 7px, #999 0 30px 0 7px; + box-shadow: #666666 0 30px 0 7px, #999 0 -30px 0 7px, #999 26px -15px 0 7px, #999 26px 15px 0 7px, #999 0 30px 0 7px, #999 0 30px 0 7px, #999 0 30px 0 7px; + } + 83.33% { + -moz-box-shadow: #666666 -26px 15px 0 7px, #999 0 -30px 0 7px, #999 26px -15px 0 7px, #999 26px 15px 0 7px, #999 0 30px 0 7px, #999 -26px 15px 0 7px, #999 -26px 15px 0 7px; + box-shadow: #666666 -26px 15px 0 7px, #999 0 -30px 0 7px, #999 26px -15px 0 7px, #999 26px 15px 0 7px, #999 0 30px 0 7px, #999 -26px 15px 0 7px, #999 -26px 15px 0 7px; + } + 91.67% { + -moz-box-shadow: #666666 -26px -15px 0 7px, #999 0 -30px 0 7px, #999 26px -15px 0 7px, #999 26px 15px 0 7px, #999 0 30px 0 7px, #999 -26px 15px 0 7px, #999 -26px -15px 0 7px; + box-shadow: #666666 -26px -15px 0 7px, #999 0 -30px 0 7px, #999 26px -15px 0 7px, #999 26px 15px 0 7px, #999 0 30px 0 7px, #999 -26px 15px 0 7px, #999 -26px -15px 0 7px; + } + 100% { + -moz-box-shadow: #666666 0 -30px 0 7px, #999 0 -30px 0 7px, #999 26px -15px 0 7px, #999 26px 15px 0 7px, #999 0 30px 0 7px, #999 -26px 15px 0 7px, #999 -26px -15px 0 7px; + box-shadow: #666666 0 -30px 0 7px, #999 0 -30px 0 7px, #999 26px -15px 0 7px, #999 26px 15px 0 7px, #999 0 30px 0 7px, #999 -26px 15px 0 7px, #999 -26px -15px 0 7px; + } +} +@-webkit-keyframes hexdots-loader { + 0% { + -webkit-box-shadow: #666666 0 -30px 0 7px, #999 0 -30px 0 7px, #999 26px -15px 0 7px, #999 26px 15px 0 7px, #999 0 30px 0 7px, #999 -26px 15px 0 7px, #999 -26px -15px 0 7px; + box-shadow: #666666 0 -30px 0 7px, #999 0 -30px 0 7px, #999 26px -15px 0 7px, #999 26px 15px 0 7px, #999 0 30px 0 7px, #999 -26px 15px 0 7px, #999 -26px -15px 0 7px; + } + 8.33% { + -webkit-box-shadow: #666666 26px -15px 0 7px, #999 26px -15px 0 7px, #999 26px -15px 0 7px, #999 26px 15px 0 7px, #999 0 30px 0 7px, #999 -26px 15px 0 7px, #999 -26px -15px 0 7px; + box-shadow: #666666 26px -15px 0 7px, #999 26px -15px 0 7px, #999 26px -15px 0 7px, #999 26px 15px 0 7px, #999 0 30px 0 7px, #999 -26px 15px 0 7px, #999 -26px -15px 0 7px; + } + 16.67% { + -webkit-box-shadow: #666666 26px 15px 0 7px, #999 26px 15px 0 7px, #999 26px 15px 0 7px, #999 26px 15px 0 7px, #999 0 30px 0 7px, #999 -26px 15px 0 7px, #999 -26px -15px 0 7px; + box-shadow: #666666 26px 15px 0 7px, #999 26px 15px 0 7px, #999 26px 15px 0 7px, #999 26px 15px 0 7px, #999 0 30px 0 7px, #999 -26px 15px 0 7px, #999 -26px -15px 0 7px; + } + 25% { + -webkit-box-shadow: #666666 0 30px 0 7px, #999 0 30px 0 7px, #999 0 30px 0 7px, #999 0 30px 0 7px, #999 0 30px 0 7px, #999 -26px 15px 0 7px, #999 -26px -15px 0 7px; + box-shadow: #666666 0 30px 0 7px, #999 0 30px 0 7px, #999 0 30px 0 7px, #999 0 30px 0 7px, #999 0 30px 0 7px, #999 -26px 15px 0 7px, #999 -26px -15px 0 7px; + } + 33.33% { + -webkit-box-shadow: #666666 -26px 15px 0 7px, #999 -26px 15px 0 7px, #999 -26px 15px 0 7px, #999 -26px 15px 0 7px, #999 -26px 15px 0 7px, #999 -26px 15px 0 7px, #999 -26px -15px 0 7px; + box-shadow: #666666 -26px 15px 0 7px, #999 -26px 15px 0 7px, #999 -26px 15px 0 7px, #999 -26px 15px 0 7px, #999 -26px 15px 0 7px, #999 -26px 15px 0 7px, #999 -26px -15px 0 7px; + } + 41.67% { + -webkit-box-shadow: #666666 -26px -15px 0 7px, #999 -26px -15px 0 7px, #999 -26px -15px 0 7px, #999 -26px -15px 0 7px, #999 -26px -15px 0 7px, #999 -26px -15px 0 7px, #999 -26px -15px 0 7px; + box-shadow: #666666 -26px -15px 0 7px, #999 -26px -15px 0 7px, #999 -26px -15px 0 7px, #999 -26px -15px 0 7px, #999 -26px -15px 0 7px, #999 -26px -15px 0 7px, #999 -26px -15px 0 7px; + } + 50% { + -webkit-box-shadow: #666666 0 -30px 0 7px, #999 0 -30px 0 7px, #999 0 -30px 0 7px, #999 0 -30px 0 7px, #999 0 -30px 0 7px, #999 0 -30px 0 7px, #999 0 -30px 0 7px; + box-shadow: #666666 0 -30px 0 7px, #999 0 -30px 0 7px, #999 0 -30px 0 7px, #999 0 -30px 0 7px, #999 0 -30px 0 7px, #999 0 -30px 0 7px, #999 0 -30px 0 7px; + } + 58.33% { + -webkit-box-shadow: #666666 26px -15px 0 7px, #999 0 -30px 0 7px, #999 26px -15px 0 7px, #999 26px -15px 0 7px, #999 26px -15px 0 7px, #999 26px -15px 0 7px, #999 26px -15px 0 7px; + box-shadow: #666666 26px -15px 0 7px, #999 0 -30px 0 7px, #999 26px -15px 0 7px, #999 26px -15px 0 7px, #999 26px -15px 0 7px, #999 26px -15px 0 7px, #999 26px -15px 0 7px; + } + 66.67% { + -webkit-box-shadow: #666666 26px 15px 0 7px, #999 0 -30px 0 7px, #999 26px -15px 0 7px, #999 26px 15px 0 7px, #999 26px 15px 0 7px, #999 26px 15px 0 7px, #999 26px 15px 0 7px; + box-shadow: #666666 26px 15px 0 7px, #999 0 -30px 0 7px, #999 26px -15px 0 7px, #999 26px 15px 0 7px, #999 26px 15px 0 7px, #999 26px 15px 0 7px, #999 26px 15px 0 7px; + } + 75% { + -webkit-box-shadow: #666666 0 30px 0 7px, #999 0 -30px 0 7px, #999 26px -15px 0 7px, #999 26px 15px 0 7px, #999 0 30px 0 7px, #999 0 30px 0 7px, #999 0 30px 0 7px; + box-shadow: #666666 0 30px 0 7px, #999 0 -30px 0 7px, #999 26px -15px 0 7px, #999 26px 15px 0 7px, #999 0 30px 0 7px, #999 0 30px 0 7px, #999 0 30px 0 7px; + } + 83.33% { + -webkit-box-shadow: #666666 -26px 15px 0 7px, #999 0 -30px 0 7px, #999 26px -15px 0 7px, #999 26px 15px 0 7px, #999 0 30px 0 7px, #999 -26px 15px 0 7px, #999 -26px 15px 0 7px; + box-shadow: #666666 -26px 15px 0 7px, #999 0 -30px 0 7px, #999 26px -15px 0 7px, #999 26px 15px 0 7px, #999 0 30px 0 7px, #999 -26px 15px 0 7px, #999 -26px 15px 0 7px; + } + 91.67% { + -webkit-box-shadow: #666666 -26px -15px 0 7px, #999 0 -30px 0 7px, #999 26px -15px 0 7px, #999 26px 15px 0 7px, #999 0 30px 0 7px, #999 -26px 15px 0 7px, #999 -26px -15px 0 7px; + box-shadow: #666666 -26px -15px 0 7px, #999 0 -30px 0 7px, #999 26px -15px 0 7px, #999 26px 15px 0 7px, #999 0 30px 0 7px, #999 -26px 15px 0 7px, #999 -26px -15px 0 7px; + } + 100% { + -webkit-box-shadow: #666666 0 -30px 0 7px, #999 0 -30px 0 7px, #999 26px -15px 0 7px, #999 26px 15px 0 7px, #999 0 30px 0 7px, #999 -26px 15px 0 7px, #999 -26px -15px 0 7px; + box-shadow: #666666 0 -30px 0 7px, #999 0 -30px 0 7px, #999 26px -15px 0 7px, #999 26px 15px 0 7px, #999 0 30px 0 7px, #999 -26px 15px 0 7px, #999 -26px -15px 0 7px; + } +} +@keyframes hexdots-loader { + 0% { + -moz-box-shadow: #666666 0 -30px 0 7px, #999 0 -30px 0 7px, #999 26px -15px 0 7px, #999 26px 15px 0 7px, #999 0 30px 0 7px, #999 -26px 15px 0 7px, #999 -26px -15px 0 7px; + -webkit-box-shadow: #666666 0 -30px 0 7px, #999 0 -30px 0 7px, #999 26px -15px 0 7px, #999 26px 15px 0 7px, #999 0 30px 0 7px, #999 -26px 15px 0 7px, #999 -26px -15px 0 7px; + box-shadow: #666666 0 -30px 0 7px, #999 0 -30px 0 7px, #999 26px -15px 0 7px, #999 26px 15px 0 7px, #999 0 30px 0 7px, #999 -26px 15px 0 7px, #999 -26px -15px 0 7px; + } + 8.33% { + -moz-box-shadow: #666666 26px -15px 0 7px, #999 26px -15px 0 7px, #999 26px -15px 0 7px, #999 26px 15px 0 7px, #999 0 30px 0 7px, #999 -26px 15px 0 7px, #999 -26px -15px 0 7px; + -webkit-box-shadow: #666666 26px -15px 0 7px, #999 26px -15px 0 7px, #999 26px -15px 0 7px, #999 26px 15px 0 7px, #999 0 30px 0 7px, #999 -26px 15px 0 7px, #999 -26px -15px 0 7px; + box-shadow: #666666 26px -15px 0 7px, #999 26px -15px 0 7px, #999 26px -15px 0 7px, #999 26px 15px 0 7px, #999 0 30px 0 7px, #999 -26px 15px 0 7px, #999 -26px -15px 0 7px; + } + 16.67% { + -moz-box-shadow: #666666 26px 15px 0 7px, #999 26px 15px 0 7px, #999 26px 15px 0 7px, #999 26px 15px 0 7px, #999 0 30px 0 7px, #999 -26px 15px 0 7px, #999 -26px -15px 0 7px; + -webkit-box-shadow: #666666 26px 15px 0 7px, #999 26px 15px 0 7px, #999 26px 15px 0 7px, #999 26px 15px 0 7px, #999 0 30px 0 7px, #999 -26px 15px 0 7px, #999 -26px -15px 0 7px; + box-shadow: #666666 26px 15px 0 7px, #999 26px 15px 0 7px, #999 26px 15px 0 7px, #999 26px 15px 0 7px, #999 0 30px 0 7px, #999 -26px 15px 0 7px, #999 -26px -15px 0 7px; + } + 25% { + -moz-box-shadow: #666666 0 30px 0 7px, #999 0 30px 0 7px, #999 0 30px 0 7px, #999 0 30px 0 7px, #999 0 30px 0 7px, #999 -26px 15px 0 7px, #999 -26px -15px 0 7px; + -webkit-box-shadow: #666666 0 30px 0 7px, #999 0 30px 0 7px, #999 0 30px 0 7px, #999 0 30px 0 7px, #999 0 30px 0 7px, #999 -26px 15px 0 7px, #999 -26px -15px 0 7px; + box-shadow: #666666 0 30px 0 7px, #999 0 30px 0 7px, #999 0 30px 0 7px, #999 0 30px 0 7px, #999 0 30px 0 7px, #999 -26px 15px 0 7px, #999 -26px -15px 0 7px; + } + 33.33% { + -moz-box-shadow: #666666 -26px 15px 0 7px, #999 -26px 15px 0 7px, #999 -26px 15px 0 7px, #999 -26px 15px 0 7px, #999 -26px 15px 0 7px, #999 -26px 15px 0 7px, #999 -26px -15px 0 7px; + -webkit-box-shadow: #666666 -26px 15px 0 7px, #999 -26px 15px 0 7px, #999 -26px 15px 0 7px, #999 -26px 15px 0 7px, #999 -26px 15px 0 7px, #999 -26px 15px 0 7px, #999 -26px -15px 0 7px; + box-shadow: #666666 -26px 15px 0 7px, #999 -26px 15px 0 7px, #999 -26px 15px 0 7px, #999 -26px 15px 0 7px, #999 -26px 15px 0 7px, #999 -26px 15px 0 7px, #999 -26px -15px 0 7px; + } + 41.67% { + -moz-box-shadow: #666666 -26px -15px 0 7px, #999 -26px -15px 0 7px, #999 -26px -15px 0 7px, #999 -26px -15px 0 7px, #999 -26px -15px 0 7px, #999 -26px -15px 0 7px, #999 -26px -15px 0 7px; + -webkit-box-shadow: #666666 -26px -15px 0 7px, #999 -26px -15px 0 7px, #999 -26px -15px 0 7px, #999 -26px -15px 0 7px, #999 -26px -15px 0 7px, #999 -26px -15px 0 7px, #999 -26px -15px 0 7px; + box-shadow: #666666 -26px -15px 0 7px, #999 -26px -15px 0 7px, #999 -26px -15px 0 7px, #999 -26px -15px 0 7px, #999 -26px -15px 0 7px, #999 -26px -15px 0 7px, #999 -26px -15px 0 7px; + } + 50% { + -moz-box-shadow: #666666 0 -30px 0 7px, #999 0 -30px 0 7px, #999 0 -30px 0 7px, #999 0 -30px 0 7px, #999 0 -30px 0 7px, #999 0 -30px 0 7px, #999 0 -30px 0 7px; + -webkit-box-shadow: #666666 0 -30px 0 7px, #999 0 -30px 0 7px, #999 0 -30px 0 7px, #999 0 -30px 0 7px, #999 0 -30px 0 7px, #999 0 -30px 0 7px, #999 0 -30px 0 7px; + box-shadow: #666666 0 -30px 0 7px, #999 0 -30px 0 7px, #999 0 -30px 0 7px, #999 0 -30px 0 7px, #999 0 -30px 0 7px, #999 0 -30px 0 7px, #999 0 -30px 0 7px; + } + 58.33% { + -moz-box-shadow: #666666 26px -15px 0 7px, #999 0 -30px 0 7px, #999 26px -15px 0 7px, #999 26px -15px 0 7px, #999 26px -15px 0 7px, #999 26px -15px 0 7px, #999 26px -15px 0 7px; + -webkit-box-shadow: #666666 26px -15px 0 7px, #999 0 -30px 0 7px, #999 26px -15px 0 7px, #999 26px -15px 0 7px, #999 26px -15px 0 7px, #999 26px -15px 0 7px, #999 26px -15px 0 7px; + box-shadow: #666666 26px -15px 0 7px, #999 0 -30px 0 7px, #999 26px -15px 0 7px, #999 26px -15px 0 7px, #999 26px -15px 0 7px, #999 26px -15px 0 7px, #999 26px -15px 0 7px; + } + 66.67% { + -moz-box-shadow: #666666 26px 15px 0 7px, #999 0 -30px 0 7px, #999 26px -15px 0 7px, #999 26px 15px 0 7px, #999 26px 15px 0 7px, #999 26px 15px 0 7px, #999 26px 15px 0 7px; + -webkit-box-shadow: #666666 26px 15px 0 7px, #999 0 -30px 0 7px, #999 26px -15px 0 7px, #999 26px 15px 0 7px, #999 26px 15px 0 7px, #999 26px 15px 0 7px, #999 26px 15px 0 7px; + box-shadow: #666666 26px 15px 0 7px, #999 0 -30px 0 7px, #999 26px -15px 0 7px, #999 26px 15px 0 7px, #999 26px 15px 0 7px, #999 26px 15px 0 7px, #999 26px 15px 0 7px; + } + 75% { + -moz-box-shadow: #666666 0 30px 0 7px, #999 0 -30px 0 7px, #999 26px -15px 0 7px, #999 26px 15px 0 7px, #999 0 30px 0 7px, #999 0 30px 0 7px, #999 0 30px 0 7px; + -webkit-box-shadow: #666666 0 30px 0 7px, #999 0 -30px 0 7px, #999 26px -15px 0 7px, #999 26px 15px 0 7px, #999 0 30px 0 7px, #999 0 30px 0 7px, #999 0 30px 0 7px; + box-shadow: #666666 0 30px 0 7px, #999 0 -30px 0 7px, #999 26px -15px 0 7px, #999 26px 15px 0 7px, #999 0 30px 0 7px, #999 0 30px 0 7px, #999 0 30px 0 7px; + } + 83.33% { + -moz-box-shadow: #666666 -26px 15px 0 7px, #999 0 -30px 0 7px, #999 26px -15px 0 7px, #999 26px 15px 0 7px, #999 0 30px 0 7px, #999 -26px 15px 0 7px, #999 -26px 15px 0 7px; + -webkit-box-shadow: #666666 -26px 15px 0 7px, #999 0 -30px 0 7px, #999 26px -15px 0 7px, #999 26px 15px 0 7px, #999 0 30px 0 7px, #999 -26px 15px 0 7px, #999 -26px 15px 0 7px; + box-shadow: #666666 -26px 15px 0 7px, #999 0 -30px 0 7px, #999 26px -15px 0 7px, #999 26px 15px 0 7px, #999 0 30px 0 7px, #999 -26px 15px 0 7px, #999 -26px 15px 0 7px; + } + 91.67% { + -moz-box-shadow: #666666 -26px -15px 0 7px, #999 0 -30px 0 7px, #999 26px -15px 0 7px, #999 26px 15px 0 7px, #999 0 30px 0 7px, #999 -26px 15px 0 7px, #999 -26px -15px 0 7px; + -webkit-box-shadow: #666666 -26px -15px 0 7px, #999 0 -30px 0 7px, #999 26px -15px 0 7px, #999 26px 15px 0 7px, #999 0 30px 0 7px, #999 -26px 15px 0 7px, #999 -26px -15px 0 7px; + box-shadow: #666666 -26px -15px 0 7px, #999 0 -30px 0 7px, #999 26px -15px 0 7px, #999 26px 15px 0 7px, #999 0 30px 0 7px, #999 -26px 15px 0 7px, #999 -26px -15px 0 7px; + } + 100% { + -moz-box-shadow: #666666 0 -30px 0 7px, #999 0 -30px 0 7px, #999 26px -15px 0 7px, #999 26px 15px 0 7px, #999 0 30px 0 7px, #999 -26px 15px 0 7px, #999 -26px -15px 0 7px; + -webkit-box-shadow: #666666 0 -30px 0 7px, #999 0 -30px 0 7px, #999 26px -15px 0 7px, #999 26px 15px 0 7px, #999 0 30px 0 7px, #999 -26px 15px 0 7px, #999 -26px -15px 0 7px; + box-shadow: #666666 0 -30px 0 7px, #999 0 -30px 0 7px, #999 26px -15px 0 7px, #999 26px 15px 0 7px, #999 0 30px 0 7px, #999 -26px 15px 0 7px, #999 -26px -15px 0 7px; + } +} +/* :not(:required) hides this rule from IE9 and below */ +.hexdots-loader:not(:required) { + overflow: hidden; + position: relative; + text-indent: -9999px; + display: inline-block; + width: 7px; + height: 7px; + background: transparent; + border-radius: 100%; + -moz-box-shadow: #666666 0 -30px 0 7px, #999 26px -15px 0 7px, #999 26px 15px 0 7px, #999 0 30px 0 7px, #999 0 30px 0 7px, #999 0 30px 0 7px; + -webkit-box-shadow: #666666 0 -30px 0 7px, #999 26px -15px 0 7px, #999 26px 15px 0 7px, #999 0 30px 0 7px, #999 0 30px 0 7px, #999 0 30px 0 7px; + box-shadow: #666666 0 -30px 0 7px, #999 26px -15px 0 7px, #999 26px 15px 0 7px, #999 0 30px 0 7px, #999 0 30px 0 7px, #999 0 30px 0 7px; + -moz-animation: hexdots-loader 5s infinite ease-in-out; + -webkit-animation: hexdots-loader 5s infinite ease-in-out; + animation: hexdots-loader 5s infinite ease-in-out; + -moz-transform-origin: 50% 50%; + -ms-transform-origin: 50% 50%; + -webkit-transform-origin: 50% 50%; + transform-origin: 50% 50%; +} + +/* :not(:required) hides this rule from IE9 and below */ +.inner-circles-loader:not(:required) { + -moz-transform: translate3d(0, 0, 0); + -ms-transform: translate3d(0, 0, 0); + -webkit-transform: translate3d(0, 0, 0); + transform: translate3d(0, 0, 0); + position: relative; + display: inline-block; + width: 50px; + height: 50px; + background: rgba(25, 165, 152, 0.5); + border-radius: 50%; + overflow: hidden; + text-indent: -9999px; + /* Hides inner circles outside base circle at safari */ + -webkit-mask-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAIAAACQd1PeAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAA5JREFUeNpiYGBgAAgwAAAEAAGbA+oJAAAAAElFTkSuQmCC); +} +.inner-circles-loader:not(:required):before, .inner-circles-loader:not(:required):after { + content: ''; + position: absolute; + top: 0; + display: inline-block; + width: 50px; + height: 50px; + border-radius: 50%; +} +.inner-circles-loader:not(:required):before { + -moz-animation: inner-circles-loader 3s infinite; + -webkit-animation: inner-circles-loader 3s infinite; + animation: inner-circles-loader 3s infinite; + -moz-transform-origin: 0 50%; + -ms-transform-origin: 0 50%; + -webkit-transform-origin: 0 50%; + transform-origin: 0 50%; + left: 0; + background: #c7efcf; +} +.inner-circles-loader:not(:required):after { + -moz-animation: inner-circles-loader 3s 0.2s reverse infinite; + -webkit-animation: inner-circles-loader 3s 0.2s reverse infinite; + animation: inner-circles-loader 3s 0.2s reverse infinite; + -moz-transform-origin: 100% 50%; + -ms-transform-origin: 100% 50%; + -webkit-transform-origin: 100% 50%; + transform-origin: 100% 50%; + right: 0; + background: #eef5db; +} + +@-moz-keyframes inner-circles-loader { + 0% { + -moz-transform: rotate(0deg); + transform: rotate(0deg); + } + 50% { + -moz-transform: rotate(360deg); + transform: rotate(360deg); + } + 100% { + -moz-transform: rotate(0deg); + transform: rotate(0deg); + } +} +@-webkit-keyframes inner-circles-loader { + 0% { + -webkit-transform: rotate(0deg); + transform: rotate(0deg); + } + 50% { + -webkit-transform: rotate(360deg); + transform: rotate(360deg); + } + 100% { + -webkit-transform: rotate(0deg); + transform: rotate(0deg); + } +} +@keyframes inner-circles-loader { + 0% { + -moz-transform: rotate(0deg); + -ms-transform: rotate(0deg); + -webkit-transform: rotate(0deg); + transform: rotate(0deg); + } + 50% { + -moz-transform: rotate(360deg); + -ms-transform: rotate(360deg); + -webkit-transform: rotate(360deg); + transform: rotate(360deg); + } + 100% { + -moz-transform: rotate(0deg); + -ms-transform: rotate(0deg); + -webkit-transform: rotate(0deg); + transform: rotate(0deg); + } +} +@-moz-keyframes pong-loader { + 0% { + left: 5px; + top: 0; + } + 25% { + left: 65px; + top: 20px; + } + 50% { + left: 5px; + } + 62.5% { + top: 50px; + } + 75% { + left: 65px; + top: 70%; + } + 100% { + left: 5px; + top: 0%; + } +} +@-webkit-keyframes pong-loader { + 0% { + left: 5px; + top: 0; + } + 25% { + left: 65px; + top: 20px; + } + 50% { + left: 5px; + } + 62.5% { + top: 50px; + } + 75% { + left: 65px; + top: 70%; + } + 100% { + left: 5px; + top: 0%; + } +} +@keyframes pong-loader { + 0% { + left: 5px; + top: 0; + } + 25% { + left: 65px; + top: 20px; + } + 50% { + left: 5px; + } + 62.5% { + top: 50px; + } + 75% { + left: 65px; + top: 70%; + } + 100% { + left: 5px; + top: 0%; + } +} +@-moz-keyframes pong-loader-paddle-1 { + 0% { + -moz-box-shadow: inset #353c39 0 5px 0 0, inset #353c39 0 -35px 0 0, inset #353c39 -3px 0 0 0, inset #8cdb8b -10px 0 0 0; + box-shadow: inset #353c39 0 5px 0 0, inset #353c39 0 -35px 0 0, inset #353c39 -3px 0 0 0, inset #8cdb8b -10px 0 0 0; + } + 25% { + -moz-box-shadow: inset #353c39 0 15px 0 0, inset #353c39 0 -25px 0 0, inset #353c39 -3px 0 0 0, inset #8cdb8b -10px 0 0 0; + box-shadow: inset #353c39 0 15px 0 0, inset #353c39 0 -25px 0 0, inset #353c39 -3px 0 0 0, inset #8cdb8b -10px 0 0 0; + } + 50% { + -moz-box-shadow: inset #353c39 0 0 0 0, inset #353c39 0 -40px 0 0, inset #353c39 -3px 0 0 0, inset #8cdb8b -10px 0 0 0; + box-shadow: inset #353c39 0 0 0 0, inset #353c39 0 -40px 0 0, inset #353c39 -3px 0 0 0, inset #8cdb8b -10px 0 0 0; + } + 62.5% { + -moz-box-shadow: inset #353c39 0 10px 0 0, inset #353c39 0 -30px 0 0, inset #353c39 -3px 0 0 0, inset #8cdb8b -10px 0 0 0; + box-shadow: inset #353c39 0 10px 0 0, inset #353c39 0 -30px 0 0, inset #353c39 -3px 0 0 0, inset #8cdb8b -10px 0 0 0; + } + 75% { + -moz-box-shadow: inset #353c39 0 40px 0 0, inset #353c39 0 0 0 0, inset #353c39 -3px 0 0 0, inset #8cdb8b -10px 0 0 0; + box-shadow: inset #353c39 0 40px 0 0, inset #353c39 0 0 0 0, inset #353c39 -3px 0 0 0, inset #8cdb8b -10px 0 0 0; + } + 100% { + -moz-box-shadow: inset #353c39 0 5px 0 0, inset #353c39 0 -35px 0 0, inset #353c39 -3px 0 0 0, inset #8cdb8b -10px 0 0 0; + box-shadow: inset #353c39 0 5px 0 0, inset #353c39 0 -35px 0 0, inset #353c39 -3px 0 0 0, inset #8cdb8b -10px 0 0 0; + } +} +@-webkit-keyframes pong-loader-paddle-1 { + 0% { + -webkit-box-shadow: inset #353c39 0 5px 0 0, inset #353c39 0 -35px 0 0, inset #353c39 -3px 0 0 0, inset #8cdb8b -10px 0 0 0; + box-shadow: inset #353c39 0 5px 0 0, inset #353c39 0 -35px 0 0, inset #353c39 -3px 0 0 0, inset #8cdb8b -10px 0 0 0; + } + 25% { + -webkit-box-shadow: inset #353c39 0 15px 0 0, inset #353c39 0 -25px 0 0, inset #353c39 -3px 0 0 0, inset #8cdb8b -10px 0 0 0; + box-shadow: inset #353c39 0 15px 0 0, inset #353c39 0 -25px 0 0, inset #353c39 -3px 0 0 0, inset #8cdb8b -10px 0 0 0; + } + 50% { + -webkit-box-shadow: inset #353c39 0 0 0 0, inset #353c39 0 -40px 0 0, inset #353c39 -3px 0 0 0, inset #8cdb8b -10px 0 0 0; + box-shadow: inset #353c39 0 0 0 0, inset #353c39 0 -40px 0 0, inset #353c39 -3px 0 0 0, inset #8cdb8b -10px 0 0 0; + } + 62.5% { + -webkit-box-shadow: inset #353c39 0 10px 0 0, inset #353c39 0 -30px 0 0, inset #353c39 -3px 0 0 0, inset #8cdb8b -10px 0 0 0; + box-shadow: inset #353c39 0 10px 0 0, inset #353c39 0 -30px 0 0, inset #353c39 -3px 0 0 0, inset #8cdb8b -10px 0 0 0; + } + 75% { + -webkit-box-shadow: inset #353c39 0 40px 0 0, inset #353c39 0 0 0 0, inset #353c39 -3px 0 0 0, inset #8cdb8b -10px 0 0 0; + box-shadow: inset #353c39 0 40px 0 0, inset #353c39 0 0 0 0, inset #353c39 -3px 0 0 0, inset #8cdb8b -10px 0 0 0; + } + 100% { + -webkit-box-shadow: inset #353c39 0 5px 0 0, inset #353c39 0 -35px 0 0, inset #353c39 -3px 0 0 0, inset #8cdb8b -10px 0 0 0; + box-shadow: inset #353c39 0 5px 0 0, inset #353c39 0 -35px 0 0, inset #353c39 -3px 0 0 0, inset #8cdb8b -10px 0 0 0; + } +} +@keyframes pong-loader-paddle-1 { + 0% { + -moz-box-shadow: inset #353c39 0 5px 0 0, inset #353c39 0 -35px 0 0, inset #353c39 -3px 0 0 0, inset #8cdb8b -10px 0 0 0; + -webkit-box-shadow: inset #353c39 0 5px 0 0, inset #353c39 0 -35px 0 0, inset #353c39 -3px 0 0 0, inset #8cdb8b -10px 0 0 0; + box-shadow: inset #353c39 0 5px 0 0, inset #353c39 0 -35px 0 0, inset #353c39 -3px 0 0 0, inset #8cdb8b -10px 0 0 0; + } + 25% { + -moz-box-shadow: inset #353c39 0 15px 0 0, inset #353c39 0 -25px 0 0, inset #353c39 -3px 0 0 0, inset #8cdb8b -10px 0 0 0; + -webkit-box-shadow: inset #353c39 0 15px 0 0, inset #353c39 0 -25px 0 0, inset #353c39 -3px 0 0 0, inset #8cdb8b -10px 0 0 0; + box-shadow: inset #353c39 0 15px 0 0, inset #353c39 0 -25px 0 0, inset #353c39 -3px 0 0 0, inset #8cdb8b -10px 0 0 0; + } + 50% { + -moz-box-shadow: inset #353c39 0 0 0 0, inset #353c39 0 -40px 0 0, inset #353c39 -3px 0 0 0, inset #8cdb8b -10px 0 0 0; + -webkit-box-shadow: inset #353c39 0 0 0 0, inset #353c39 0 -40px 0 0, inset #353c39 -3px 0 0 0, inset #8cdb8b -10px 0 0 0; + box-shadow: inset #353c39 0 0 0 0, inset #353c39 0 -40px 0 0, inset #353c39 -3px 0 0 0, inset #8cdb8b -10px 0 0 0; + } + 62.5% { + -moz-box-shadow: inset #353c39 0 10px 0 0, inset #353c39 0 -30px 0 0, inset #353c39 -3px 0 0 0, inset #8cdb8b -10px 0 0 0; + -webkit-box-shadow: inset #353c39 0 10px 0 0, inset #353c39 0 -30px 0 0, inset #353c39 -3px 0 0 0, inset #8cdb8b -10px 0 0 0; + box-shadow: inset #353c39 0 10px 0 0, inset #353c39 0 -30px 0 0, inset #353c39 -3px 0 0 0, inset #8cdb8b -10px 0 0 0; + } + 75% { + -moz-box-shadow: inset #353c39 0 40px 0 0, inset #353c39 0 0 0 0, inset #353c39 -3px 0 0 0, inset #8cdb8b -10px 0 0 0; + -webkit-box-shadow: inset #353c39 0 40px 0 0, inset #353c39 0 0 0 0, inset #353c39 -3px 0 0 0, inset #8cdb8b -10px 0 0 0; + box-shadow: inset #353c39 0 40px 0 0, inset #353c39 0 0 0 0, inset #353c39 -3px 0 0 0, inset #8cdb8b -10px 0 0 0; + } + 100% { + -moz-box-shadow: inset #353c39 0 5px 0 0, inset #353c39 0 -35px 0 0, inset #353c39 -3px 0 0 0, inset #8cdb8b -10px 0 0 0; + -webkit-box-shadow: inset #353c39 0 5px 0 0, inset #353c39 0 -35px 0 0, inset #353c39 -3px 0 0 0, inset #8cdb8b -10px 0 0 0; + box-shadow: inset #353c39 0 5px 0 0, inset #353c39 0 -35px 0 0, inset #353c39 -3px 0 0 0, inset #8cdb8b -10px 0 0 0; + } +} +@-moz-keyframes pong-loader-paddle-2 { + 0% { + -moz-box-shadow: inset #353c39 0 0 0 0, inset #353c39 0 -40px 0 0, inset #353c39 3px 0 0 0, inset #8cdb8b -10px 0 0 0; + box-shadow: inset #353c39 0 0 0 0, inset #353c39 0 -40px 0 0, inset #353c39 3px 0 0 0, inset #8cdb8b -10px 0 0 0; + } + 50% { + -moz-box-shadow: inset #353c39 0 30px 0 0, inset #353c39 0 -10px 0 0, inset #353c39 3px 0 0 0, inset #8cdb8b -10px 0 0 0; + box-shadow: inset #353c39 0 30px 0 0, inset #353c39 0 -10px 0 0, inset #353c39 3px 0 0 0, inset #8cdb8b -10px 0 0 0; + } + 62.5% { + -moz-box-shadow: inset #353c39 0 40px 0 0, inset #353c39 0 0 0 0, inset #353c39 3px 0 0 0, inset #8cdb8b -10px 0 0 0; + box-shadow: inset #353c39 0 40px 0 0, inset #353c39 0 0 0 0, inset #353c39 3px 0 0 0, inset #8cdb8b -10px 0 0 0; + } + 75% { + -moz-box-shadow: inset #353c39 0 20px 0 0, inset #353c39 0 -20px 0 0, inset #353c39 3px 0 0 0, inset #8cdb8b -10px 0 0 0; + box-shadow: inset #353c39 0 20px 0 0, inset #353c39 0 -20px 0 0, inset #353c39 3px 0 0 0, inset #8cdb8b -10px 0 0 0; + } + 100% { + -moz-box-shadow: inset #353c39 0 0 0 0, inset #353c39 0 -40px 0 0, inset #353c39 3px 0 0 0, inset #8cdb8b -10px 0 0 0; + box-shadow: inset #353c39 0 0 0 0, inset #353c39 0 -40px 0 0, inset #353c39 3px 0 0 0, inset #8cdb8b -10px 0 0 0; + } +} +@-webkit-keyframes pong-loader-paddle-2 { + 0% { + -webkit-box-shadow: inset #353c39 0 0 0 0, inset #353c39 0 -40px 0 0, inset #353c39 3px 0 0 0, inset #8cdb8b -10px 0 0 0; + box-shadow: inset #353c39 0 0 0 0, inset #353c39 0 -40px 0 0, inset #353c39 3px 0 0 0, inset #8cdb8b -10px 0 0 0; + } + 50% { + -webkit-box-shadow: inset #353c39 0 30px 0 0, inset #353c39 0 -10px 0 0, inset #353c39 3px 0 0 0, inset #8cdb8b -10px 0 0 0; + box-shadow: inset #353c39 0 30px 0 0, inset #353c39 0 -10px 0 0, inset #353c39 3px 0 0 0, inset #8cdb8b -10px 0 0 0; + } + 62.5% { + -webkit-box-shadow: inset #353c39 0 40px 0 0, inset #353c39 0 0 0 0, inset #353c39 3px 0 0 0, inset #8cdb8b -10px 0 0 0; + box-shadow: inset #353c39 0 40px 0 0, inset #353c39 0 0 0 0, inset #353c39 3px 0 0 0, inset #8cdb8b -10px 0 0 0; + } + 75% { + -webkit-box-shadow: inset #353c39 0 20px 0 0, inset #353c39 0 -20px 0 0, inset #353c39 3px 0 0 0, inset #8cdb8b -10px 0 0 0; + box-shadow: inset #353c39 0 20px 0 0, inset #353c39 0 -20px 0 0, inset #353c39 3px 0 0 0, inset #8cdb8b -10px 0 0 0; + } + 100% { + -webkit-box-shadow: inset #353c39 0 0 0 0, inset #353c39 0 -40px 0 0, inset #353c39 3px 0 0 0, inset #8cdb8b -10px 0 0 0; + box-shadow: inset #353c39 0 0 0 0, inset #353c39 0 -40px 0 0, inset #353c39 3px 0 0 0, inset #8cdb8b -10px 0 0 0; + } +} +@keyframes pong-loader-paddle-2 { + 0% { + -moz-box-shadow: inset #353c39 0 0 0 0, inset #353c39 0 -40px 0 0, inset #353c39 3px 0 0 0, inset #8cdb8b -10px 0 0 0; + -webkit-box-shadow: inset #353c39 0 0 0 0, inset #353c39 0 -40px 0 0, inset #353c39 3px 0 0 0, inset #8cdb8b -10px 0 0 0; + box-shadow: inset #353c39 0 0 0 0, inset #353c39 0 -40px 0 0, inset #353c39 3px 0 0 0, inset #8cdb8b -10px 0 0 0; + } + 50% { + -moz-box-shadow: inset #353c39 0 30px 0 0, inset #353c39 0 -10px 0 0, inset #353c39 3px 0 0 0, inset #8cdb8b -10px 0 0 0; + -webkit-box-shadow: inset #353c39 0 30px 0 0, inset #353c39 0 -10px 0 0, inset #353c39 3px 0 0 0, inset #8cdb8b -10px 0 0 0; + box-shadow: inset #353c39 0 30px 0 0, inset #353c39 0 -10px 0 0, inset #353c39 3px 0 0 0, inset #8cdb8b -10px 0 0 0; + } + 62.5% { + -moz-box-shadow: inset #353c39 0 40px 0 0, inset #353c39 0 0 0 0, inset #353c39 3px 0 0 0, inset #8cdb8b -10px 0 0 0; + -webkit-box-shadow: inset #353c39 0 40px 0 0, inset #353c39 0 0 0 0, inset #353c39 3px 0 0 0, inset #8cdb8b -10px 0 0 0; + box-shadow: inset #353c39 0 40px 0 0, inset #353c39 0 0 0 0, inset #353c39 3px 0 0 0, inset #8cdb8b -10px 0 0 0; + } + 75% { + -moz-box-shadow: inset #353c39 0 20px 0 0, inset #353c39 0 -20px 0 0, inset #353c39 3px 0 0 0, inset #8cdb8b -10px 0 0 0; + -webkit-box-shadow: inset #353c39 0 20px 0 0, inset #353c39 0 -20px 0 0, inset #353c39 3px 0 0 0, inset #8cdb8b -10px 0 0 0; + box-shadow: inset #353c39 0 20px 0 0, inset #353c39 0 -20px 0 0, inset #353c39 3px 0 0 0, inset #8cdb8b -10px 0 0 0; + } + 100% { + -moz-box-shadow: inset #353c39 0 0 0 0, inset #353c39 0 -40px 0 0, inset #353c39 3px 0 0 0, inset #8cdb8b -10px 0 0 0; + -webkit-box-shadow: inset #353c39 0 0 0 0, inset #353c39 0 -40px 0 0, inset #353c39 3px 0 0 0, inset #8cdb8b -10px 0 0 0; + box-shadow: inset #353c39 0 0 0 0, inset #353c39 0 -40px 0 0, inset #353c39 3px 0 0 0, inset #8cdb8b -10px 0 0 0; + } +} +/* :not(:required) hides this rule from IE9 and below */ +.pong-loader:not(:required) { + width: 80px; + height: 60px; + background: #353c39; + position: relative; + display: inline-block; + overflow: hidden; + text-indent: 100%; + -moz-box-shadow: inset #353c39 0 0 0 0, inset #353c39 0 -40px 0 0, inset #353c39 -3px 0 0 0, inset #8cdb8b -10px 0 0 0; + -webkit-box-shadow: inset #353c39 0 0 0 0, inset #353c39 0 -40px 0 0, inset #353c39 -3px 0 0 0, inset #8cdb8b -10px 0 0 0; + box-shadow: inset #353c39 0 0 0 0, inset #353c39 0 -40px 0 0, inset #353c39 -3px 0 0 0, inset #8cdb8b -10px 0 0 0; + -moz-animation: pong-loader-paddle-1 1500ms infinite linear; + -webkit-animation: pong-loader-paddle-1 1500ms infinite linear; + animation: pong-loader-paddle-1 1500ms infinite linear; +} +.pong-loader:not(:required):before { + -moz-animation: pong-loader-paddle-2 1500ms infinite linear; + -webkit-animation: pong-loader-paddle-2 1500ms infinite linear; + animation: pong-loader-paddle-2 1500ms infinite linear; + position: absolute; + top: 0; + left: 0; + display: block; + content: ""; + width: 10px; + height: 100%; + -moz-box-shadow: inset #353c39 0 0 0 0, inset #353c39 0 -40px 0 0, inset #353c39 -3px 0 0 0, inset #8cdb8b -10px 0 0 0; + -webkit-box-shadow: inset #353c39 0 0 0 0, inset #353c39 0 -40px 0 0, inset #353c39 -3px 0 0 0, inset #8cdb8b -10px 0 0 0; + box-shadow: inset #353c39 0 0 0 0, inset #353c39 0 -40px 0 0, inset #353c39 -3px 0 0 0, inset #8cdb8b -10px 0 0 0; +} +.pong-loader:not(:required):after { + content: ""; + display: block; + -moz-animation: pong-loader 1500ms infinite linear; + -webkit-animation: pong-loader 1500ms infinite linear; + animation: pong-loader 1500ms infinite linear; + -moz-border-radius: 50%; + -webkit-border-radius: 50%; + border-radius: 50%; + position: absolute; + left: 0; + top: 0; + width: 10px; + height: 10px; + background: #8cdb8b; +} + +.pulse-loader:not(:required) { + display: inline-block; + width: 50px; + height: 50px; + -moz-animation: pulse-loader 0.7s linear infinite alternate; + -webkit-animation: pulse-loader 0.7s linear infinite alternate; + animation: pulse-loader 0.7s linear infinite alternate; + border: 2px solid #e67e22; + -moz-border-radius: 50%; + -webkit-border-radius: 50%; + border-radius: 50%; + overflow: hidden; + text-indent: 50px; +} + +@-moz-keyframes pulse-loader { + 0% { + -moz-box-shadow: #e67e22 0 0 0px 20px; + box-shadow: #e67e22 0 0 0px 20px; + } + 40% { + -moz-box-shadow: none; + box-shadow: none; + } + 100% { + -moz-box-shadow: #e67e22 0 0 0px 25px inset; + box-shadow: #e67e22 0 0 0px 25px inset; + } +} +@-webkit-keyframes pulse-loader { + 0% { + -webkit-box-shadow: #e67e22 0 0 0px 20px; + box-shadow: #e67e22 0 0 0px 20px; + } + 40% { + -webkit-box-shadow: none; + box-shadow: none; + } + 100% { + -webkit-box-shadow: #e67e22 0 0 0px 25px inset; + box-shadow: #e67e22 0 0 0px 25px inset; + } +} +@keyframes pulse-loader { + 0% { + -moz-box-shadow: #e67e22 0 0 0px 20px; + -webkit-box-shadow: #e67e22 0 0 0px 20px; + box-shadow: #e67e22 0 0 0px 20px; + } + 40% { + -moz-box-shadow: none; + -webkit-box-shadow: none; + box-shadow: none; + } + 100% { + -moz-box-shadow: #e67e22 0 0 0px 25px inset; + -webkit-box-shadow: #e67e22 0 0 0px 25px inset; + box-shadow: #e67e22 0 0 0px 25px inset; + } +} diff --git a/public/bower_components/css-spinners/spinners.scss b/public/bower_components/css-spinners/spinners.scss new file mode 100644 index 0000000..4ae85db --- /dev/null +++ b/public/bower_components/css-spinners/spinners.scss @@ -0,0 +1,19 @@ +@import "spinner/spinner"; +@import "spinner/refreshing"; +@import "spinner/throbber"; +@import "spinner/heartbeat"; +@import "spinner/gauge"; +@import "spinner/timer"; +@import "spinner/three-quarters"; +@import "spinner/wobblebar"; +@import "spinner/atebits"; +@import "spinner/whirly"; +@import "spinner/flower"; +@import "spinner/dots"; +@import "spinner/circles"; +@import "spinner/plus"; +@import "spinner/ball"; +@import "spinner/hexdots"; +@import "spinner/inner-circles"; +@import "spinner/pong"; +@import "spinner/pulse"; diff --git a/public/bower_components/css-spinners/three-quarters.css b/public/bower_components/css-spinners/three-quarters.css new file mode 100644 index 0000000..5e11a1a --- /dev/null +++ b/public/bower_components/css-spinners/three-quarters.css @@ -0,0 +1,50 @@ +@-moz-keyframes three-quarters-loader { + 0% { + -moz-transform: rotate(0deg); + transform: rotate(0deg); + } + 100% { + -moz-transform: rotate(360deg); + transform: rotate(360deg); + } +} +@-webkit-keyframes three-quarters-loader { + 0% { + -webkit-transform: rotate(0deg); + transform: rotate(0deg); + } + 100% { + -webkit-transform: rotate(360deg); + transform: rotate(360deg); + } +} +@keyframes three-quarters-loader { + 0% { + -moz-transform: rotate(0deg); + -ms-transform: rotate(0deg); + -webkit-transform: rotate(0deg); + transform: rotate(0deg); + } + 100% { + -moz-transform: rotate(360deg); + -ms-transform: rotate(360deg); + -webkit-transform: rotate(360deg); + transform: rotate(360deg); + } +} +/* :not(:required) hides this rule from IE9 and below */ +.three-quarters-loader:not(:required) { + -moz-animation: three-quarters-loader 1250ms infinite linear; + -webkit-animation: three-quarters-loader 1250ms infinite linear; + animation: three-quarters-loader 1250ms infinite linear; + border: 8px solid #38e; + border-right-color: transparent; + border-radius: 16px; + box-sizing: border-box; + display: inline-block; + position: relative; + overflow: hidden; + text-indent: -9999px; + width: 32px; + height: 32px; +} diff --git a/public/bower_components/css-spinners/throbber.css b/public/bower_components/css-spinners/throbber.css new file mode 100644 index 0000000..3eaded7 --- /dev/null +++ b/public/bower_components/css-spinners/throbber.css @@ -0,0 +1,67 @@ +@-moz-keyframes throbber-loader { + 0% { + background: #dde2e7; + } + 10% { + background: #6b9dc8; + } + 40% { + background: #dde2e7; + } +} +@-webkit-keyframes throbber-loader { + 0% { + background: #dde2e7; + } + 10% { + background: #6b9dc8; + } + 40% { + background: #dde2e7; + } +} +@keyframes throbber-loader { + 0% { + background: #dde2e7; + } + 10% { + background: #6b9dc8; + } + 40% { + background: #dde2e7; + } +} +/* :not(:required) hides these rules from IE9 and below */ +.throbber-loader:not(:required) { + -moz-animation: throbber-loader 2000ms 300ms infinite ease-out; + -webkit-animation: throbber-loader 2000ms 300ms infinite ease-out; + animation: throbber-loader 2000ms 300ms infinite ease-out; + background: #dde2e7; + display: inline-block; + position: relative; + text-indent: -9999px; + width: 0.9em; + height: 1.5em; + margin: 0 1.6em; +} +.throbber-loader:not(:required):before, .throbber-loader:not(:required):after { + background: #dde2e7; + content: '\x200B'; + display: inline-block; + width: 0.9em; + height: 1.5em; + position: absolute; + top: 0; +} +.throbber-loader:not(:required):before { + -moz-animation: throbber-loader 2000ms 150ms infinite ease-out; + -webkit-animation: throbber-loader 2000ms 150ms infinite ease-out; + animation: throbber-loader 2000ms 150ms infinite ease-out; + left: -1.6em; +} +.throbber-loader:not(:required):after { + -moz-animation: throbber-loader 2000ms 450ms infinite ease-out; + -webkit-animation: throbber-loader 2000ms 450ms infinite ease-out; + animation: throbber-loader 2000ms 450ms infinite ease-out; + right: -1.6em; +} diff --git a/public/bower_components/css-spinners/timer.css b/public/bower_components/css-spinners/timer.css new file mode 100644 index 0000000..b806956 --- /dev/null +++ b/public/bower_components/css-spinners/timer.css @@ -0,0 +1,90 @@ +@-moz-keyframes timer-loader { + 0% { + -moz-transform: rotate(0deg); + transform: rotate(0deg); + } + 100% { + -moz-transform: rotate(360deg); + transform: rotate(360deg); + } +} +@-webkit-keyframes timer-loader { + 0% { + -webkit-transform: rotate(0deg); + transform: rotate(0deg); + } + 100% { + -webkit-transform: rotate(360deg); + transform: rotate(360deg); + } +} +@keyframes timer-loader { + 0% { + -moz-transform: rotate(0deg); + -ms-transform: rotate(0deg); + -webkit-transform: rotate(0deg); + transform: rotate(0deg); + } + 100% { + -moz-transform: rotate(360deg); + -ms-transform: rotate(360deg); + -webkit-transform: rotate(360deg); + transform: rotate(360deg); + } +} +/* :not(:required) hides this rule from IE9 and below */ +.timer-loader:not(:required) { + border: 6px solid #c8d; + -moz-border-radius: 24px; + -webkit-border-radius: 24px; + border-radius: 24px; + -moz-box-sizing: border-box; + -webkit-box-sizing: border-box; + box-sizing: border-box; + display: inline-block; + overflow: hidden; + position: relative; + text-indent: -9999px; + width: 48px; + height: 48px; +} +.timer-loader:not(:required)::before { + -moz-animation: timer-loader 1250ms infinite linear; + -webkit-animation: timer-loader 1250ms infinite linear; + animation: timer-loader 1250ms infinite linear; + -moz-transform-origin: 3px 3px; + -ms-transform-origin: 3px 3px; + -webkit-transform-origin: 3px 3px; + transform-origin: 3px 3px; + background: #c8d; + -moz-border-radius: 3px; + -webkit-border-radius: 3px; + border-radius: 3px; + content: ''; + display: block; + position: absolute; + width: 6px; + height: 19.2px; + left: 15px; + top: 15px; +} +.timer-loader:not(:required)::after { + -moz-animation: timer-loader 15000ms infinite linear; + -webkit-animation: timer-loader 15000ms infinite linear; + animation: timer-loader 15000ms infinite linear; + -moz-transform-origin: 3px 3px; + -ms-transform-origin: 3px 3px; + -webkit-transform-origin: 3px 3px; + transform-origin: 3px 3px; + background: #c8d; + -moz-border-radius: 3px; + -webkit-border-radius: 3px; + border-radius: 3px; + content: ''; + display: block; + position: absolute; + width: 6px; + height: 16px; + left: 15px; + top: 15px; +} diff --git a/public/bower_components/css-spinners/whirly.css b/public/bower_components/css-spinners/whirly.css new file mode 100644 index 0000000..0e1d14e --- /dev/null +++ b/public/bower_components/css-spinners/whirly.css @@ -0,0 +1,57 @@ +@-moz-keyframes whirly-loader { + 0% { + -moz-transform: rotate(0deg); + transform: rotate(0deg); + } + 100% { + -moz-transform: rotate(360deg); + transform: rotate(360deg); + } +} +@-webkit-keyframes whirly-loader { + 0% { + -webkit-transform: rotate(0deg); + transform: rotate(0deg); + } + 100% { + -webkit-transform: rotate(360deg); + transform: rotate(360deg); + } +} +@keyframes whirly-loader { + 0% { + -moz-transform: rotate(0deg); + -ms-transform: rotate(0deg); + -webkit-transform: rotate(0deg); + transform: rotate(0deg); + } + 100% { + -moz-transform: rotate(360deg); + -ms-transform: rotate(360deg); + -webkit-transform: rotate(360deg); + transform: rotate(360deg); + } +} +/* :not(:required) hides this rule from IE9 and below */ +.whirly-loader:not(:required) { + overflow: hidden; + position: relative; + text-indent: -9999px; + display: inline-block; + width: 8px; + height: 8px; + background: transparent; + -moz-border-radius: 100%; + -webkit-border-radius: 100%; + border-radius: 100%; + -moz-box-shadow: #e66 0px 26px 0 6px, #e66 0.90971px 26.05079px 0 5.93333px, #e66 1.82297px 26.06967px 0 5.86667px, #e66 2.73865px 26.05647px 0 5.8px, #e66 3.65561px 26.01104px 0 5.73333px, #e66 4.57274px 25.93327px 0 5.66667px, #e66 5.48887px 25.8231px 0 5.6px, #e66 6.40287px 25.68049px 0 5.53333px, #e66 7.31358px 25.50548px 0 5.46667px, #e66 8.21985px 25.2981px 0 5.4px, #e66 9.12054px 25.05847px 0 5.33333px, #e66 10.01448px 24.78672px 0 5.26667px, #e66 10.90054px 24.48302px 0 5.2px, #e66 11.77757px 24.1476px 0 5.13333px, #e66 12.64443px 23.78072px 0 5.06667px, #e66 13.5px 23.38269px 0 5px, #e66 14.34315px 22.95384px 0 4.93333px, #e66 15.17277px 22.49455px 0 4.86667px, #e66 15.98776px 22.00526px 0 4.8px, #e66 16.78704px 21.48643px 0 4.73333px, #e66 17.56953px 20.93855px 0 4.66667px, #e66 18.33418px 20.36217px 0 4.6px, #e66 19.07995px 19.75787px 0 4.53333px, #e66 19.80582px 19.12626px 0 4.46667px, #e66 20.5108px 18.468px 0 4.4px, #e66 21.1939px 17.78379px 0 4.33333px, #e66 21.85416px 17.07434px 0 4.26667px, #e66 22.49067px 16.34043px 0 4.2px, #e66 23.10251px 15.58284px 0 4.13333px, #e66 23.68881px 14.80241px 0 4.06667px, #e66 24.24871px 14.0px 0 4px, #e66 24.7814px 13.1765px 0 3.93333px, #e66 25.28607px 12.33284px 0 3.86667px, #e66 25.76198px 11.46997px 0 3.8px, #e66 26.2084px 10.58888px 0 3.73333px, #e66 26.62462px 9.69057px 0 3.66667px, #e66 27.01001px 8.77608px 0 3.6px, #e66 27.36392px 7.84648px 0 3.53333px, #e66 27.68577px 6.90284px 0 3.46667px, #e66 27.97502px 5.94627px 0 3.4px, #e66 28.23116px 4.97791px 0 3.33333px, #e66 28.4537px 3.99891px 0 3.26667px, #e66 28.64223px 3.01042px 0 3.2px, #e66 28.79635px 2.01364px 0 3.13333px, #e66 28.91571px 1.00976px 0 3.06667px, #e66 29px 0.0px 0 3px, #e66 29.04896px -1.01441px 0 2.93333px, #e66 29.06237px -2.03224px 0 2.86667px, #e66 29.04004px -3.05223px 0 2.8px, #e66 28.98185px -4.07313px 0 2.73333px, #e66 28.88769px -5.09368px 0 2.66667px, #e66 28.75754px -6.1126px 0 2.6px, #e66 28.59138px -7.12863px 0 2.53333px, #e66 28.38926px -8.14049px 0 2.46667px, #e66 28.15127px -9.1469px 0 2.4px, #e66 27.87755px -10.1466px 0 2.33333px, #e66 27.56827px -11.1383px 0 2.26667px, #e66 27.22365px -12.12075px 0 2.2px, #e66 26.84398px -13.09268px 0 2.13333px, #e66 26.42956px -14.05285px 0 2.06667px, #e66 25.98076px -15.0px 0 2px, #e66 25.49798px -15.93291px 0 1.93333px, #e66 24.98167px -16.85035px 0 1.86667px, #e66 24.43231px -17.75111px 0 1.8px, #e66 23.85046px -18.63402px 0 1.73333px, #e66 23.23668px -19.49789px 0 1.66667px, #e66 22.5916px -20.34157px 0 1.6px, #e66 21.91589px -21.16393px 0 1.53333px, #e66 21.21024px -21.96384px 0 1.46667px, #e66 20.4754px -22.74023px 0 1.4px, #e66 19.71215px -23.49203px 0 1.33333px, #e66 18.92133px -24.2182px 0 1.26667px, #e66 18.10379px -24.91772px 0 1.2px, #e66 17.26042px -25.58963px 0 1.13333px, #e66 16.39217px -26.23295px 0 1.06667px, #e66 15.5px -26.84679px 0 1px, #e66 14.58492px -27.43024px 0 0.93333px, #e66 13.64796px -27.98245px 0 0.86667px, #e66 12.69018px -28.50262px 0 0.8px, #e66 11.7127px -28.98995px 0 0.73333px, #e66 10.71663px -29.4437px 0 0.66667px, #e66 9.70313px -29.86317px 0 0.6px, #e66 8.67339px -30.2477px 0 0.53333px, #e66 7.6286px -30.59666px 0 0.46667px, #e66 6.57001px -30.90946px 0 0.4px, #e66 5.49886px -31.18558px 0 0.33333px, #e66 4.41643px -31.42451px 0 0.26667px, #e66 3.32401px -31.6258px 0 0.2px, #e66 2.22291px -31.78904px 0 0.13333px, #e66 1.11446px -31.91388px 0 0.06667px, #e66 0.0px -32px 0 0px, #e66 -1.11911px -32.04713px 0 -0.06667px, #e66 -2.24151px -32.05506px 0 -0.13333px, #e66 -3.36582px -32.02361px 0 -0.2px, #e66 -4.49065px -31.95265px 0 -0.26667px, #e66 -5.61462px -31.84212px 0 -0.33333px, #e66 -6.73634px -31.69198px 0 -0.4px, #e66 -7.8544px -31.50227px 0 -0.46667px, #e66 -8.9674px -31.27305px 0 -0.53333px, #e66 -10.07395px -31.00444px 0 -0.6px, #e66 -11.17266px -30.69663px 0 -0.66667px, #e66 -12.26212px -30.34982px 0 -0.73333px, #e66 -13.34096px -29.96429px 0 -0.8px, #e66 -14.4078px -29.54036px 0 -0.86667px, #e66 -15.46126px -29.07841px 0 -0.93333px, #e66 -16.5px -28.57884px 0 -1px, #e66 -17.52266px -28.04212px 0 -1.06667px, #e66 -18.52792px -27.46878px 0 -1.13333px, #e66 -19.51447px -26.85936px 0 -1.2px, #e66 -20.48101px -26.21449px 0 -1.26667px, #e66 -21.42625px -25.53481px 0 -1.33333px, #e66 -22.34896px -24.82104px 0 -1.4px, #e66 -23.2479px -24.07391px 0 -1.46667px, #e66 -24.12186px -23.29421px 0 -1.53333px, #e66 -24.96967px -22.48279px 0 -1.6px, #e66 -25.79016px -21.64052px 0 -1.66667px, #e66 -26.58223px -20.76831px 0 -1.73333px, #e66 -27.34477px -19.86714px 0 -1.8px, #e66 -28.07674px -18.938px 0 -1.86667px, #e66 -28.7771px -17.98193px 0 -1.93333px, #e66 -29.44486px -17.0px 0 -2px, #e66 -30.07908px -15.99333px 0 -2.06667px, #e66 -30.67884px -14.96307px 0 -2.13333px, #e66 -31.24325px -13.91039px 0 -2.2px, #e66 -31.7715px -12.83652px 0 -2.26667px, #e66 -32.26278px -11.74269px 0 -2.33333px, #e66 -32.71634px -10.63018px 0 -2.4px, #e66 -33.13149px -9.5003px 0 -2.46667px, #e66 -33.50755px -8.35437px 0 -2.53333px, #e66 -33.84391px -7.19374px 0 -2.6px, #e66 -34.14px -6.0198px 0 -2.66667px, #e66 -34.39531px -4.83395px 0 -2.73333px, #e66 -34.60936px -3.63759px 0 -2.8px, #e66 -34.78173px -2.43218px 0 -2.86667px, #e66 -34.91205px -1.21916px 0 -2.93333px, #e66 -35px 0.0px 0 -3px, #e66 -35.04531px 1.22381px 0 -3.06667px, #e66 -35.04775px 2.45078px 0 -3.13333px, #e66 -35.00717px 3.6794px 0 -3.2px, #e66 -34.92345px 4.90817px 0 -3.26667px, #e66 -34.79654px 6.13557px 0 -3.33333px, #e66 -34.62643px 7.36007px 0 -3.4px, #e66 -34.41316px 8.58016px 0 -3.46667px, #e66 -34.15683px 9.79431px 0 -3.53333px, #e66 -33.85761px 11.001px 0 -3.6px, #e66 -33.5157px 12.19872px 0 -3.66667px, #e66 -33.13137px 13.38594px 0 -3.73333px, #e66 -32.70493px 14.56117px 0 -3.8px, #e66 -32.23675px 15.72291px 0 -3.86667px, #e66 -31.72725px 16.86968px 0 -3.93333px, #e66 -31.17691px 18px 0 -4px, #e66 -30.58627px 19.11242px 0 -4.06667px, #e66 -29.95589px 20.2055px 0 -4.13333px, #e66 -29.28642px 21.27783px 0 -4.2px, #e66 -28.57852px 22.32799px 0 -4.26667px, #e66 -27.83295px 23.35462px 0 -4.33333px, #e66 -27.05047px 24.35635px 0 -4.4px, #e66 -26.23192px 25.33188px 0 -4.46667px, #e66 -25.37819px 26.27988px 0 -4.53333px, #e66 -24.49018px 27.1991px 0 -4.6px, #e66 -23.56888px 28.0883px 0 -4.66667px, #e66 -22.6153px 28.94626px 0 -4.73333px, #e66 -21.6305px 29.77183px 0 -4.8px, #e66 -20.61558px 30.56385px 0 -4.86667px, #e66 -19.57168px 31.32124px 0 -4.93333px, #e66 -18.5px 32.04294px 0 -5px, #e66 -17.40175px 32.72792px 0 -5.06667px, #e66 -16.27818px 33.37522px 0 -5.13333px, #e66 -15.1306px 33.98389px 0 -5.2px, #e66 -13.96034px 34.55305px 0 -5.26667px, #e66 -12.76875px 35.08186px 0 -5.33333px, #e66 -11.55724px 35.56951px 0 -5.4px, #e66 -10.32721px 36.01527px 0 -5.46667px, #e66 -9.08014px 36.41843px 0 -5.53333px, #e66 -7.81748px 36.77835px 0 -5.6px, #e66 -6.54075px 37.09443px 0 -5.66667px, #e66 -5.25147px 37.36612px 0 -5.73333px, #e66 -3.95118px 37.59293px 0 -5.8px, #e66 -2.64145px 37.77443px 0 -5.86667px, #e66 -1.32385px 37.91023px 0 -5.93333px; + -webkit-box-shadow: #e66 0px 26px 0 6px, #e66 0.90971px 26.05079px 0 5.93333px, #e66 1.82297px 26.06967px 0 5.86667px, #e66 2.73865px 26.05647px 0 5.8px, #e66 3.65561px 26.01104px 0 5.73333px, #e66 4.57274px 25.93327px 0 5.66667px, #e66 5.48887px 25.8231px 0 5.6px, #e66 6.40287px 25.68049px 0 5.53333px, #e66 7.31358px 25.50548px 0 5.46667px, #e66 8.21985px 25.2981px 0 5.4px, #e66 9.12054px 25.05847px 0 5.33333px, #e66 10.01448px 24.78672px 0 5.26667px, #e66 10.90054px 24.48302px 0 5.2px, #e66 11.77757px 24.1476px 0 5.13333px, #e66 12.64443px 23.78072px 0 5.06667px, #e66 13.5px 23.38269px 0 5px, #e66 14.34315px 22.95384px 0 4.93333px, #e66 15.17277px 22.49455px 0 4.86667px, #e66 15.98776px 22.00526px 0 4.8px, #e66 16.78704px 21.48643px 0 4.73333px, #e66 17.56953px 20.93855px 0 4.66667px, #e66 18.33418px 20.36217px 0 4.6px, #e66 19.07995px 19.75787px 0 4.53333px, #e66 19.80582px 19.12626px 0 4.46667px, #e66 20.5108px 18.468px 0 4.4px, #e66 21.1939px 17.78379px 0 4.33333px, #e66 21.85416px 17.07434px 0 4.26667px, #e66 22.49067px 16.34043px 0 4.2px, #e66 23.10251px 15.58284px 0 4.13333px, #e66 23.68881px 14.80241px 0 4.06667px, #e66 24.24871px 14.0px 0 4px, #e66 24.7814px 13.1765px 0 3.93333px, #e66 25.28607px 12.33284px 0 3.86667px, #e66 25.76198px 11.46997px 0 3.8px, #e66 26.2084px 10.58888px 0 3.73333px, #e66 26.62462px 9.69057px 0 3.66667px, #e66 27.01001px 8.77608px 0 3.6px, #e66 27.36392px 7.84648px 0 3.53333px, #e66 27.68577px 6.90284px 0 3.46667px, #e66 27.97502px 5.94627px 0 3.4px, #e66 28.23116px 4.97791px 0 3.33333px, #e66 28.4537px 3.99891px 0 3.26667px, #e66 28.64223px 3.01042px 0 3.2px, #e66 28.79635px 2.01364px 0 3.13333px, #e66 28.91571px 1.00976px 0 3.06667px, #e66 29px 0.0px 0 3px, #e66 29.04896px -1.01441px 0 2.93333px, #e66 29.06237px -2.03224px 0 2.86667px, #e66 29.04004px -3.05223px 0 2.8px, #e66 28.98185px -4.07313px 0 2.73333px, #e66 28.88769px -5.09368px 0 2.66667px, #e66 28.75754px -6.1126px 0 2.6px, #e66 28.59138px -7.12863px 0 2.53333px, #e66 28.38926px -8.14049px 0 2.46667px, #e66 28.15127px -9.1469px 0 2.4px, #e66 27.87755px -10.1466px 0 2.33333px, #e66 27.56827px -11.1383px 0 2.26667px, #e66 27.22365px -12.12075px 0 2.2px, #e66 26.84398px -13.09268px 0 2.13333px, #e66 26.42956px -14.05285px 0 2.06667px, #e66 25.98076px -15.0px 0 2px, #e66 25.49798px -15.93291px 0 1.93333px, #e66 24.98167px -16.85035px 0 1.86667px, #e66 24.43231px -17.75111px 0 1.8px, #e66 23.85046px -18.63402px 0 1.73333px, #e66 23.23668px -19.49789px 0 1.66667px, #e66 22.5916px -20.34157px 0 1.6px, #e66 21.91589px -21.16393px 0 1.53333px, #e66 21.21024px -21.96384px 0 1.46667px, #e66 20.4754px -22.74023px 0 1.4px, #e66 19.71215px -23.49203px 0 1.33333px, #e66 18.92133px -24.2182px 0 1.26667px, #e66 18.10379px -24.91772px 0 1.2px, #e66 17.26042px -25.58963px 0 1.13333px, #e66 16.39217px -26.23295px 0 1.06667px, #e66 15.5px -26.84679px 0 1px, #e66 14.58492px -27.43024px 0 0.93333px, #e66 13.64796px -27.98245px 0 0.86667px, #e66 12.69018px -28.50262px 0 0.8px, #e66 11.7127px -28.98995px 0 0.73333px, #e66 10.71663px -29.4437px 0 0.66667px, #e66 9.70313px -29.86317px 0 0.6px, #e66 8.67339px -30.2477px 0 0.53333px, #e66 7.6286px -30.59666px 0 0.46667px, #e66 6.57001px -30.90946px 0 0.4px, #e66 5.49886px -31.18558px 0 0.33333px, #e66 4.41643px -31.42451px 0 0.26667px, #e66 3.32401px -31.6258px 0 0.2px, #e66 2.22291px -31.78904px 0 0.13333px, #e66 1.11446px -31.91388px 0 0.06667px, #e66 0.0px -32px 0 0px, #e66 -1.11911px -32.04713px 0 -0.06667px, #e66 -2.24151px -32.05506px 0 -0.13333px, #e66 -3.36582px -32.02361px 0 -0.2px, #e66 -4.49065px -31.95265px 0 -0.26667px, #e66 -5.61462px -31.84212px 0 -0.33333px, #e66 -6.73634px -31.69198px 0 -0.4px, #e66 -7.8544px -31.50227px 0 -0.46667px, #e66 -8.9674px -31.27305px 0 -0.53333px, #e66 -10.07395px -31.00444px 0 -0.6px, #e66 -11.17266px -30.69663px 0 -0.66667px, #e66 -12.26212px -30.34982px 0 -0.73333px, #e66 -13.34096px -29.96429px 0 -0.8px, #e66 -14.4078px -29.54036px 0 -0.86667px, #e66 -15.46126px -29.07841px 0 -0.93333px, #e66 -16.5px -28.57884px 0 -1px, #e66 -17.52266px -28.04212px 0 -1.06667px, #e66 -18.52792px -27.46878px 0 -1.13333px, #e66 -19.51447px -26.85936px 0 -1.2px, #e66 -20.48101px -26.21449px 0 -1.26667px, #e66 -21.42625px -25.53481px 0 -1.33333px, #e66 -22.34896px -24.82104px 0 -1.4px, #e66 -23.2479px -24.07391px 0 -1.46667px, #e66 -24.12186px -23.29421px 0 -1.53333px, #e66 -24.96967px -22.48279px 0 -1.6px, #e66 -25.79016px -21.64052px 0 -1.66667px, #e66 -26.58223px -20.76831px 0 -1.73333px, #e66 -27.34477px -19.86714px 0 -1.8px, #e66 -28.07674px -18.938px 0 -1.86667px, #e66 -28.7771px -17.98193px 0 -1.93333px, #e66 -29.44486px -17.0px 0 -2px, #e66 -30.07908px -15.99333px 0 -2.06667px, #e66 -30.67884px -14.96307px 0 -2.13333px, #e66 -31.24325px -13.91039px 0 -2.2px, #e66 -31.7715px -12.83652px 0 -2.26667px, #e66 -32.26278px -11.74269px 0 -2.33333px, #e66 -32.71634px -10.63018px 0 -2.4px, #e66 -33.13149px -9.5003px 0 -2.46667px, #e66 -33.50755px -8.35437px 0 -2.53333px, #e66 -33.84391px -7.19374px 0 -2.6px, #e66 -34.14px -6.0198px 0 -2.66667px, #e66 -34.39531px -4.83395px 0 -2.73333px, #e66 -34.60936px -3.63759px 0 -2.8px, #e66 -34.78173px -2.43218px 0 -2.86667px, #e66 -34.91205px -1.21916px 0 -2.93333px, #e66 -35px 0.0px 0 -3px, #e66 -35.04531px 1.22381px 0 -3.06667px, #e66 -35.04775px 2.45078px 0 -3.13333px, #e66 -35.00717px 3.6794px 0 -3.2px, #e66 -34.92345px 4.90817px 0 -3.26667px, #e66 -34.79654px 6.13557px 0 -3.33333px, #e66 -34.62643px 7.36007px 0 -3.4px, #e66 -34.41316px 8.58016px 0 -3.46667px, #e66 -34.15683px 9.79431px 0 -3.53333px, #e66 -33.85761px 11.001px 0 -3.6px, #e66 -33.5157px 12.19872px 0 -3.66667px, #e66 -33.13137px 13.38594px 0 -3.73333px, #e66 -32.70493px 14.56117px 0 -3.8px, #e66 -32.23675px 15.72291px 0 -3.86667px, #e66 -31.72725px 16.86968px 0 -3.93333px, #e66 -31.17691px 18px 0 -4px, #e66 -30.58627px 19.11242px 0 -4.06667px, #e66 -29.95589px 20.2055px 0 -4.13333px, #e66 -29.28642px 21.27783px 0 -4.2px, #e66 -28.57852px 22.32799px 0 -4.26667px, #e66 -27.83295px 23.35462px 0 -4.33333px, #e66 -27.05047px 24.35635px 0 -4.4px, #e66 -26.23192px 25.33188px 0 -4.46667px, #e66 -25.37819px 26.27988px 0 -4.53333px, #e66 -24.49018px 27.1991px 0 -4.6px, #e66 -23.56888px 28.0883px 0 -4.66667px, #e66 -22.6153px 28.94626px 0 -4.73333px, #e66 -21.6305px 29.77183px 0 -4.8px, #e66 -20.61558px 30.56385px 0 -4.86667px, #e66 -19.57168px 31.32124px 0 -4.93333px, #e66 -18.5px 32.04294px 0 -5px, #e66 -17.40175px 32.72792px 0 -5.06667px, #e66 -16.27818px 33.37522px 0 -5.13333px, #e66 -15.1306px 33.98389px 0 -5.2px, #e66 -13.96034px 34.55305px 0 -5.26667px, #e66 -12.76875px 35.08186px 0 -5.33333px, #e66 -11.55724px 35.56951px 0 -5.4px, #e66 -10.32721px 36.01527px 0 -5.46667px, #e66 -9.08014px 36.41843px 0 -5.53333px, #e66 -7.81748px 36.77835px 0 -5.6px, #e66 -6.54075px 37.09443px 0 -5.66667px, #e66 -5.25147px 37.36612px 0 -5.73333px, #e66 -3.95118px 37.59293px 0 -5.8px, #e66 -2.64145px 37.77443px 0 -5.86667px, #e66 -1.32385px 37.91023px 0 -5.93333px; + box-shadow: #e66 0px 26px 0 6px, #e66 0.90971px 26.05079px 0 5.93333px, #e66 1.82297px 26.06967px 0 5.86667px, #e66 2.73865px 26.05647px 0 5.8px, #e66 3.65561px 26.01104px 0 5.73333px, #e66 4.57274px 25.93327px 0 5.66667px, #e66 5.48887px 25.8231px 0 5.6px, #e66 6.40287px 25.68049px 0 5.53333px, #e66 7.31358px 25.50548px 0 5.46667px, #e66 8.21985px 25.2981px 0 5.4px, #e66 9.12054px 25.05847px 0 5.33333px, #e66 10.01448px 24.78672px 0 5.26667px, #e66 10.90054px 24.48302px 0 5.2px, #e66 11.77757px 24.1476px 0 5.13333px, #e66 12.64443px 23.78072px 0 5.06667px, #e66 13.5px 23.38269px 0 5px, #e66 14.34315px 22.95384px 0 4.93333px, #e66 15.17277px 22.49455px 0 4.86667px, #e66 15.98776px 22.00526px 0 4.8px, #e66 16.78704px 21.48643px 0 4.73333px, #e66 17.56953px 20.93855px 0 4.66667px, #e66 18.33418px 20.36217px 0 4.6px, #e66 19.07995px 19.75787px 0 4.53333px, #e66 19.80582px 19.12626px 0 4.46667px, #e66 20.5108px 18.468px 0 4.4px, #e66 21.1939px 17.78379px 0 4.33333px, #e66 21.85416px 17.07434px 0 4.26667px, #e66 22.49067px 16.34043px 0 4.2px, #e66 23.10251px 15.58284px 0 4.13333px, #e66 23.68881px 14.80241px 0 4.06667px, #e66 24.24871px 14.0px 0 4px, #e66 24.7814px 13.1765px 0 3.93333px, #e66 25.28607px 12.33284px 0 3.86667px, #e66 25.76198px 11.46997px 0 3.8px, #e66 26.2084px 10.58888px 0 3.73333px, #e66 26.62462px 9.69057px 0 3.66667px, #e66 27.01001px 8.77608px 0 3.6px, #e66 27.36392px 7.84648px 0 3.53333px, #e66 27.68577px 6.90284px 0 3.46667px, #e66 27.97502px 5.94627px 0 3.4px, #e66 28.23116px 4.97791px 0 3.33333px, #e66 28.4537px 3.99891px 0 3.26667px, #e66 28.64223px 3.01042px 0 3.2px, #e66 28.79635px 2.01364px 0 3.13333px, #e66 28.91571px 1.00976px 0 3.06667px, #e66 29px 0.0px 0 3px, #e66 29.04896px -1.01441px 0 2.93333px, #e66 29.06237px -2.03224px 0 2.86667px, #e66 29.04004px -3.05223px 0 2.8px, #e66 28.98185px -4.07313px 0 2.73333px, #e66 28.88769px -5.09368px 0 2.66667px, #e66 28.75754px -6.1126px 0 2.6px, #e66 28.59138px -7.12863px 0 2.53333px, #e66 28.38926px -8.14049px 0 2.46667px, #e66 28.15127px -9.1469px 0 2.4px, #e66 27.87755px -10.1466px 0 2.33333px, #e66 27.56827px -11.1383px 0 2.26667px, #e66 27.22365px -12.12075px 0 2.2px, #e66 26.84398px -13.09268px 0 2.13333px, #e66 26.42956px -14.05285px 0 2.06667px, #e66 25.98076px -15.0px 0 2px, #e66 25.49798px -15.93291px 0 1.93333px, #e66 24.98167px -16.85035px 0 1.86667px, #e66 24.43231px -17.75111px 0 1.8px, #e66 23.85046px -18.63402px 0 1.73333px, #e66 23.23668px -19.49789px 0 1.66667px, #e66 22.5916px -20.34157px 0 1.6px, #e66 21.91589px -21.16393px 0 1.53333px, #e66 21.21024px -21.96384px 0 1.46667px, #e66 20.4754px -22.74023px 0 1.4px, #e66 19.71215px -23.49203px 0 1.33333px, #e66 18.92133px -24.2182px 0 1.26667px, #e66 18.10379px -24.91772px 0 1.2px, #e66 17.26042px -25.58963px 0 1.13333px, #e66 16.39217px -26.23295px 0 1.06667px, #e66 15.5px -26.84679px 0 1px, #e66 14.58492px -27.43024px 0 0.93333px, #e66 13.64796px -27.98245px 0 0.86667px, #e66 12.69018px -28.50262px 0 0.8px, #e66 11.7127px -28.98995px 0 0.73333px, #e66 10.71663px -29.4437px 0 0.66667px, #e66 9.70313px -29.86317px 0 0.6px, #e66 8.67339px -30.2477px 0 0.53333px, #e66 7.6286px -30.59666px 0 0.46667px, #e66 6.57001px -30.90946px 0 0.4px, #e66 5.49886px -31.18558px 0 0.33333px, #e66 4.41643px -31.42451px 0 0.26667px, #e66 3.32401px -31.6258px 0 0.2px, #e66 2.22291px -31.78904px 0 0.13333px, #e66 1.11446px -31.91388px 0 0.06667px, #e66 0.0px -32px 0 0px, #e66 -1.11911px -32.04713px 0 -0.06667px, #e66 -2.24151px -32.05506px 0 -0.13333px, #e66 -3.36582px -32.02361px 0 -0.2px, #e66 -4.49065px -31.95265px 0 -0.26667px, #e66 -5.61462px -31.84212px 0 -0.33333px, #e66 -6.73634px -31.69198px 0 -0.4px, #e66 -7.8544px -31.50227px 0 -0.46667px, #e66 -8.9674px -31.27305px 0 -0.53333px, #e66 -10.07395px -31.00444px 0 -0.6px, #e66 -11.17266px -30.69663px 0 -0.66667px, #e66 -12.26212px -30.34982px 0 -0.73333px, #e66 -13.34096px -29.96429px 0 -0.8px, #e66 -14.4078px -29.54036px 0 -0.86667px, #e66 -15.46126px -29.07841px 0 -0.93333px, #e66 -16.5px -28.57884px 0 -1px, #e66 -17.52266px -28.04212px 0 -1.06667px, #e66 -18.52792px -27.46878px 0 -1.13333px, #e66 -19.51447px -26.85936px 0 -1.2px, #e66 -20.48101px -26.21449px 0 -1.26667px, #e66 -21.42625px -25.53481px 0 -1.33333px, #e66 -22.34896px -24.82104px 0 -1.4px, #e66 -23.2479px -24.07391px 0 -1.46667px, #e66 -24.12186px -23.29421px 0 -1.53333px, #e66 -24.96967px -22.48279px 0 -1.6px, #e66 -25.79016px -21.64052px 0 -1.66667px, #e66 -26.58223px -20.76831px 0 -1.73333px, #e66 -27.34477px -19.86714px 0 -1.8px, #e66 -28.07674px -18.938px 0 -1.86667px, #e66 -28.7771px -17.98193px 0 -1.93333px, #e66 -29.44486px -17.0px 0 -2px, #e66 -30.07908px -15.99333px 0 -2.06667px, #e66 -30.67884px -14.96307px 0 -2.13333px, #e66 -31.24325px -13.91039px 0 -2.2px, #e66 -31.7715px -12.83652px 0 -2.26667px, #e66 -32.26278px -11.74269px 0 -2.33333px, #e66 -32.71634px -10.63018px 0 -2.4px, #e66 -33.13149px -9.5003px 0 -2.46667px, #e66 -33.50755px -8.35437px 0 -2.53333px, #e66 -33.84391px -7.19374px 0 -2.6px, #e66 -34.14px -6.0198px 0 -2.66667px, #e66 -34.39531px -4.83395px 0 -2.73333px, #e66 -34.60936px -3.63759px 0 -2.8px, #e66 -34.78173px -2.43218px 0 -2.86667px, #e66 -34.91205px -1.21916px 0 -2.93333px, #e66 -35px 0.0px 0 -3px, #e66 -35.04531px 1.22381px 0 -3.06667px, #e66 -35.04775px 2.45078px 0 -3.13333px, #e66 -35.00717px 3.6794px 0 -3.2px, #e66 -34.92345px 4.90817px 0 -3.26667px, #e66 -34.79654px 6.13557px 0 -3.33333px, #e66 -34.62643px 7.36007px 0 -3.4px, #e66 -34.41316px 8.58016px 0 -3.46667px, #e66 -34.15683px 9.79431px 0 -3.53333px, #e66 -33.85761px 11.001px 0 -3.6px, #e66 -33.5157px 12.19872px 0 -3.66667px, #e66 -33.13137px 13.38594px 0 -3.73333px, #e66 -32.70493px 14.56117px 0 -3.8px, #e66 -32.23675px 15.72291px 0 -3.86667px, #e66 -31.72725px 16.86968px 0 -3.93333px, #e66 -31.17691px 18px 0 -4px, #e66 -30.58627px 19.11242px 0 -4.06667px, #e66 -29.95589px 20.2055px 0 -4.13333px, #e66 -29.28642px 21.27783px 0 -4.2px, #e66 -28.57852px 22.32799px 0 -4.26667px, #e66 -27.83295px 23.35462px 0 -4.33333px, #e66 -27.05047px 24.35635px 0 -4.4px, #e66 -26.23192px 25.33188px 0 -4.46667px, #e66 -25.37819px 26.27988px 0 -4.53333px, #e66 -24.49018px 27.1991px 0 -4.6px, #e66 -23.56888px 28.0883px 0 -4.66667px, #e66 -22.6153px 28.94626px 0 -4.73333px, #e66 -21.6305px 29.77183px 0 -4.8px, #e66 -20.61558px 30.56385px 0 -4.86667px, #e66 -19.57168px 31.32124px 0 -4.93333px, #e66 -18.5px 32.04294px 0 -5px, #e66 -17.40175px 32.72792px 0 -5.06667px, #e66 -16.27818px 33.37522px 0 -5.13333px, #e66 -15.1306px 33.98389px 0 -5.2px, #e66 -13.96034px 34.55305px 0 -5.26667px, #e66 -12.76875px 35.08186px 0 -5.33333px, #e66 -11.55724px 35.56951px 0 -5.4px, #e66 -10.32721px 36.01527px 0 -5.46667px, #e66 -9.08014px 36.41843px 0 -5.53333px, #e66 -7.81748px 36.77835px 0 -5.6px, #e66 -6.54075px 37.09443px 0 -5.66667px, #e66 -5.25147px 37.36612px 0 -5.73333px, #e66 -3.95118px 37.59293px 0 -5.8px, #e66 -2.64145px 37.77443px 0 -5.86667px, #e66 -1.32385px 37.91023px 0 -5.93333px; + -moz-animation: whirly-loader 1.25s infinite linear; + -webkit-animation: whirly-loader 1.25s infinite linear; + animation: whirly-loader 1.25s infinite linear; + -moz-transform-origin: 50% 50%; + -ms-transform-origin: 50% 50%; + -webkit-transform-origin: 50% 50%; + transform-origin: 50% 50%; +} diff --git a/public/bower_components/css-spinners/wobblebar.css b/public/bower_components/css-spinners/wobblebar.css new file mode 100644 index 0000000..658f30f --- /dev/null +++ b/public/bower_components/css-spinners/wobblebar.css @@ -0,0 +1,269 @@ +@-moz-keyframes wobblebar-loader { + 0% { + left: 4px; + } + 3% { + left: 104px; + } + 6% { + left: 4px; + } + 9% { + left: 104px; + } + 12% { + left: 4px; + } + 15% { + left: 104px; + } + 18% { + left: 32px; + } + 27% { + left: 32px; + } + 30% { + left: 104px; + } + 33% { + left: 4px; + } + 36% { + left: 104px; + } + 39% { + left: 4px; + } + 42% { + left: 104px; + } + 45% { + left: 4px; + } + 48% { + left: 104px; + } + 51% { + left: 52px; + } + 63% { + left: 52px; + } + 66% { + left: 4px; + } + 69% { + left: 104px; + } + 72% { + left: 4px; + } + 75% { + left: 104px; + } + 78% { + left: 4px; + } + 81% { + left: 104px; + } + 84% { + left: 72px; + } + 94% { + left: 72px; + } + 97% { + left: 104px; + } +} +@-webkit-keyframes wobblebar-loader { + 0% { + left: 4px; + } + 3% { + left: 104px; + } + 6% { + left: 4px; + } + 9% { + left: 104px; + } + 12% { + left: 4px; + } + 15% { + left: 104px; + } + 18% { + left: 32px; + } + 27% { + left: 32px; + } + 30% { + left: 104px; + } + 33% { + left: 4px; + } + 36% { + left: 104px; + } + 39% { + left: 4px; + } + 42% { + left: 104px; + } + 45% { + left: 4px; + } + 48% { + left: 104px; + } + 51% { + left: 52px; + } + 63% { + left: 52px; + } + 66% { + left: 4px; + } + 69% { + left: 104px; + } + 72% { + left: 4px; + } + 75% { + left: 104px; + } + 78% { + left: 4px; + } + 81% { + left: 104px; + } + 84% { + left: 72px; + } + 94% { + left: 72px; + } + 97% { + left: 104px; + } +} +@keyframes wobblebar-loader { + 0% { + left: 4px; + } + 3% { + left: 104px; + } + 6% { + left: 4px; + } + 9% { + left: 104px; + } + 12% { + left: 4px; + } + 15% { + left: 104px; + } + 18% { + left: 32px; + } + 27% { + left: 32px; + } + 30% { + left: 104px; + } + 33% { + left: 4px; + } + 36% { + left: 104px; + } + 39% { + left: 4px; + } + 42% { + left: 104px; + } + 45% { + left: 4px; + } + 48% { + left: 104px; + } + 51% { + left: 52px; + } + 63% { + left: 52px; + } + 66% { + left: 4px; + } + 69% { + left: 104px; + } + 72% { + left: 4px; + } + 75% { + left: 104px; + } + 78% { + left: 4px; + } + 81% { + left: 104px; + } + 84% { + left: 72px; + } + 94% { + left: 72px; + } + 97% { + left: 104px; + } +} +/* :not(:required) hides this rule from IE9 and below */ +.wobblebar-loader:not(:required) { + background: #a9d; + -moz-border-radius: 10.66667px; + -webkit-border-radius: 10.66667px; + border-radius: 10.66667px; + display: inline-block; + overflow: hidden; + text-indent: -9999px; + width: 128px; + height: 21.33333px; + position: relative; +} +.wobblebar-loader:not(:required)::after { + -moz-animation: wobblebar-loader 15000ms infinite ease; + -webkit-animation: wobblebar-loader 15000ms infinite ease; + animation: wobblebar-loader 15000ms infinite ease; + background: white; + display: block; + -moz-border-radius: 7.11111px; + -webkit-border-radius: 7.11111px; + border-radius: 7.11111px; + content: ''; + position: absolute; + top: 3.55556px; + left: 4px; + width: 21.33333px; + height: 14.22222px; +} diff --git a/public/bower_components/es5-shim/es5-shim.js b/public/bower_components/es5-shim/es5-shim.js new file mode 100644 index 0000000..d2c0ad0 --- /dev/null +++ b/public/bower_components/es5-shim/es5-shim.js @@ -0,0 +1,1613 @@ +/*! + * https://github.com/es-shims/es5-shim + * @license es5-shim Copyright 2009-2015 by contributors, MIT License + * see https://github.com/es-shims/es5-shim/blob/master/LICENSE + */ + +// vim: ts=4 sts=4 sw=4 expandtab + +// Add semicolon to prevent IIFE from being passed as argument to concatenated code. +; + +// UMD (Universal Module Definition) +// see https://github.com/umdjs/umd/blob/master/returnExports.js +(function (root, factory) { + 'use strict'; + + /* global define, exports, module */ + if (typeof define === 'function' && define.amd) { + // AMD. Register as an anonymous module. + define(factory); + } else if (typeof exports === 'object') { + // Node. Does not work with strict CommonJS, but + // only CommonJS-like enviroments that support module.exports, + // like Node. + module.exports = factory(); + } else { + // Browser globals (root is window) + root.returnExports = factory(); + } +}(this, function () { + +/** + * Brings an environment as close to ECMAScript 5 compliance + * as is possible with the facilities of erstwhile engines. + * + * Annotated ES5: http://es5.github.com/ (specific links below) + * ES5 Spec: http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-262.pdf + * Required reading: http://javascriptweblog.wordpress.com/2011/12/05/extending-javascript-natives/ + */ + +// Shortcut to an often accessed properties, in order to avoid multiple +// dereference that costs universally. This also holds a reference to known-good +// functions. +var $Array = Array; +var ArrayPrototype = $Array.prototype; +var $Object = Object; +var ObjectPrototype = $Object.prototype; +var FunctionPrototype = Function.prototype; +var $String = String; +var StringPrototype = $String.prototype; +var $Number = Number; +var NumberPrototype = $Number.prototype; +var array_slice = ArrayPrototype.slice; +var array_splice = ArrayPrototype.splice; +var array_push = ArrayPrototype.push; +var array_unshift = ArrayPrototype.unshift; +var array_concat = ArrayPrototype.concat; +var call = FunctionPrototype.call; +var max = Math.max; +var min = Math.min; + +// Having a toString local variable name breaks in Opera so use to_string. +var to_string = ObjectPrototype.toString; + +var hasToStringTag = typeof Symbol === 'function' && typeof Symbol.toStringTag === 'symbol'; +var isCallable; /* inlined from https://npmjs.com/is-callable */ var fnToStr = Function.prototype.toString, tryFunctionObject = function tryFunctionObject(value) { try { fnToStr.call(value); return true; } catch (e) { return false; } }, fnClass = '[object Function]', genClass = '[object GeneratorFunction]'; isCallable = function isCallable(value) { if (typeof value !== 'function') { return false; } if (hasToStringTag) { return tryFunctionObject(value); } var strClass = to_string.call(value); return strClass === fnClass || strClass === genClass; }; +var isRegex; /* inlined from https://npmjs.com/is-regex */ var regexExec = RegExp.prototype.exec, tryRegexExec = function tryRegexExec(value) { try { regexExec.call(value); return true; } catch (e) { return false; } }, regexClass = '[object RegExp]'; isRegex = function isRegex(value) { if (typeof value !== 'object') { return false; } return hasToStringTag ? tryRegexExec(value) : to_string.call(value) === regexClass; }; +var isString; /* inlined from https://npmjs.com/is-string */ var strValue = String.prototype.valueOf, tryStringObject = function tryStringObject(value) { try { strValue.call(value); return true; } catch (e) { return false; } }, stringClass = '[object String]'; isString = function isString(value) { if (typeof value === 'string') { return true; } if (typeof value !== 'object') { return false; } return hasToStringTag ? tryStringObject(value) : to_string.call(value) === stringClass; }; + +/* inlined from http://npmjs.com/define-properties */ +var defineProperties = (function (has) { + var supportsDescriptors = $Object.defineProperty && (function () { + try { + var obj = {}; + $Object.defineProperty(obj, 'x', { enumerable: false, value: obj }); + for (var _ in obj) { return false; } + return obj.x === obj; + } catch (e) { /* this is ES3 */ + return false; + } + }()); + + // Define configurable, writable and non-enumerable props + // if they don't exist. + var defineProperty; + if (supportsDescriptors) { + defineProperty = function (object, name, method, forceAssign) { + if (!forceAssign && (name in object)) { return; } + $Object.defineProperty(object, name, { + configurable: true, + enumerable: false, + writable: true, + value: method + }); + }; + } else { + defineProperty = function (object, name, method, forceAssign) { + if (!forceAssign && (name in object)) { return; } + object[name] = method; + }; + } + return function defineProperties(object, map, forceAssign) { + for (var name in map) { + if (has.call(map, name)) { + defineProperty(object, name, map[name], forceAssign); + } + } + }; +}(ObjectPrototype.hasOwnProperty)); + +// +// Util +// ====== +// + +/* replaceable with https://npmjs.com/package/es-abstract /helpers/isPrimitive */ +var isPrimitive = function isPrimitive(input) { + var type = typeof input; + return input === null || (type !== 'object' && type !== 'function'); +}; + +var isActualNaN = $Number.isNaN || function (x) { return x !== x; }; + +var ES = { + // ES5 9.4 + // http://es5.github.com/#x9.4 + // http://jsperf.com/to-integer + /* replaceable with https://npmjs.com/package/es-abstract ES5.ToInteger */ + ToInteger: function ToInteger(num) { + var n = +num; + if (isActualNaN(n)) { + n = 0; + } else if (n !== 0 && n !== (1 / 0) && n !== -(1 / 0)) { + n = (n > 0 || -1) * Math.floor(Math.abs(n)); + } + return n; + }, + + /* replaceable with https://npmjs.com/package/es-abstract ES5.ToPrimitive */ + ToPrimitive: function ToPrimitive(input) { + var val, valueOf, toStr; + if (isPrimitive(input)) { + return input; + } + valueOf = input.valueOf; + if (isCallable(valueOf)) { + val = valueOf.call(input); + if (isPrimitive(val)) { + return val; + } + } + toStr = input.toString; + if (isCallable(toStr)) { + val = toStr.call(input); + if (isPrimitive(val)) { + return val; + } + } + throw new TypeError(); + }, + + // ES5 9.9 + // http://es5.github.com/#x9.9 + /* replaceable with https://npmjs.com/package/es-abstract ES5.ToObject */ + ToObject: function (o) { + /* jshint eqnull: true */ + if (o == null) { // this matches both null and undefined + throw new TypeError("can't convert " + o + ' to object'); + } + return $Object(o); + }, + + /* replaceable with https://npmjs.com/package/es-abstract ES5.ToUint32 */ + ToUint32: function ToUint32(x) { + return x >>> 0; + } +}; + +// +// Function +// ======== +// + +// ES-5 15.3.4.5 +// http://es5.github.com/#x15.3.4.5 + +var Empty = function Empty() {}; + +defineProperties(FunctionPrototype, { + bind: function bind(that) { // .length is 1 + // 1. Let Target be the this value. + var target = this; + // 2. If IsCallable(Target) is false, throw a TypeError exception. + if (!isCallable(target)) { + throw new TypeError('Function.prototype.bind called on incompatible ' + target); + } + // 3. Let A be a new (possibly empty) internal list of all of the + // argument values provided after thisArg (arg1, arg2 etc), in order. + // XXX slicedArgs will stand in for "A" if used + var args = array_slice.call(arguments, 1); // for normal call + // 4. Let F be a new native ECMAScript object. + // 11. Set the [[Prototype]] internal property of F to the standard + // built-in Function prototype object as specified in 15.3.3.1. + // 12. Set the [[Call]] internal property of F as described in + // 15.3.4.5.1. + // 13. Set the [[Construct]] internal property of F as described in + // 15.3.4.5.2. + // 14. Set the [[HasInstance]] internal property of F as described in + // 15.3.4.5.3. + var bound; + var binder = function () { + + if (this instanceof bound) { + // 15.3.4.5.2 [[Construct]] + // When the [[Construct]] internal method of a function object, + // F that was created using the bind function is called with a + // list of arguments ExtraArgs, the following steps are taken: + // 1. Let target be the value of F's [[TargetFunction]] + // internal property. + // 2. If target has no [[Construct]] internal method, a + // TypeError exception is thrown. + // 3. Let boundArgs be the value of F's [[BoundArgs]] internal + // property. + // 4. Let args be a new list containing the same values as the + // list boundArgs in the same order followed by the same + // values as the list ExtraArgs in the same order. + // 5. Return the result of calling the [[Construct]] internal + // method of target providing args as the arguments. + + var result = target.apply( + this, + array_concat.call(args, array_slice.call(arguments)) + ); + if ($Object(result) === result) { + return result; + } + return this; + + } else { + // 15.3.4.5.1 [[Call]] + // When the [[Call]] internal method of a function object, F, + // which was created using the bind function is called with a + // this value and a list of arguments ExtraArgs, the following + // steps are taken: + // 1. Let boundArgs be the value of F's [[BoundArgs]] internal + // property. + // 2. Let boundThis be the value of F's [[BoundThis]] internal + // property. + // 3. Let target be the value of F's [[TargetFunction]] internal + // property. + // 4. Let args be a new list containing the same values as the + // list boundArgs in the same order followed by the same + // values as the list ExtraArgs in the same order. + // 5. Return the result of calling the [[Call]] internal method + // of target providing boundThis as the this value and + // providing args as the arguments. + + // equiv: target.call(this, ...boundArgs, ...args) + return target.apply( + that, + array_concat.call(args, array_slice.call(arguments)) + ); + + } + + }; + + // 15. If the [[Class]] internal property of Target is "Function", then + // a. Let L be the length property of Target minus the length of A. + // b. Set the length own property of F to either 0 or L, whichever is + // larger. + // 16. Else set the length own property of F to 0. + + var boundLength = max(0, target.length - args.length); + + // 17. Set the attributes of the length own property of F to the values + // specified in 15.3.5.1. + var boundArgs = []; + for (var i = 0; i < boundLength; i++) { + array_push.call(boundArgs, '$' + i); + } + + // XXX Build a dynamic function with desired amount of arguments is the only + // way to set the length property of a function. + // In environments where Content Security Policies enabled (Chrome extensions, + // for ex.) all use of eval or Function costructor throws an exception. + // However in all of these environments Function.prototype.bind exists + // and so this code will never be executed. + bound = Function('binder', 'return function (' + boundArgs.join(',') + '){ return binder.apply(this, arguments); }')(binder); + + if (target.prototype) { + Empty.prototype = target.prototype; + bound.prototype = new Empty(); + // Clean up dangling references. + Empty.prototype = null; + } + + // TODO + // 18. Set the [[Extensible]] internal property of F to true. + + // TODO + // 19. Let thrower be the [[ThrowTypeError]] function Object (13.2.3). + // 20. Call the [[DefineOwnProperty]] internal method of F with + // arguments "caller", PropertyDescriptor {[[Get]]: thrower, [[Set]]: + // thrower, [[Enumerable]]: false, [[Configurable]]: false}, and + // false. + // 21. Call the [[DefineOwnProperty]] internal method of F with + // arguments "arguments", PropertyDescriptor {[[Get]]: thrower, + // [[Set]]: thrower, [[Enumerable]]: false, [[Configurable]]: false}, + // and false. + + // TODO + // NOTE Function objects created using Function.prototype.bind do not + // have a prototype property or the [[Code]], [[FormalParameters]], and + // [[Scope]] internal properties. + // XXX can't delete prototype in pure-js. + + // 22. Return F. + return bound; + } +}); + +// _Please note: Shortcuts are defined after `Function.prototype.bind` as we +// us it in defining shortcuts. +var owns = call.bind(ObjectPrototype.hasOwnProperty); +var toStr = call.bind(ObjectPrototype.toString); +var strSlice = call.bind(StringPrototype.slice); +var strSplit = call.bind(StringPrototype.split); + +// +// Array +// ===== +// + +var isArray = $Array.isArray || function isArray(obj) { + return toStr(obj) === '[object Array]'; +}; + +// ES5 15.4.4.12 +// http://es5.github.com/#x15.4.4.13 +// Return len+argCount. +// [bugfix, ielt8] +// IE < 8 bug: [].unshift(0) === undefined but should be "1" +var hasUnshiftReturnValueBug = [].unshift(0) !== 1; +defineProperties(ArrayPrototype, { + unshift: function () { + array_unshift.apply(this, arguments); + return this.length; + } +}, hasUnshiftReturnValueBug); + +// ES5 15.4.3.2 +// http://es5.github.com/#x15.4.3.2 +// https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/isArray +defineProperties($Array, { isArray: isArray }); + +// The IsCallable() check in the Array functions +// has been replaced with a strict check on the +// internal class of the object to trap cases where +// the provided function was actually a regular +// expression literal, which in V8 and +// JavaScriptCore is a typeof "function". Only in +// V8 are regular expression literals permitted as +// reduce parameters, so it is desirable in the +// general case for the shim to match the more +// strict and common behavior of rejecting regular +// expressions. + +// ES5 15.4.4.18 +// http://es5.github.com/#x15.4.4.18 +// https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/array/forEach + +// Check failure of by-index access of string characters (IE < 9) +// and failure of `0 in boxedString` (Rhino) +var boxedString = $Object('a'); +var splitString = boxedString[0] !== 'a' || !(0 in boxedString); + +var properlyBoxesContext = function properlyBoxed(method) { + // Check node 0.6.21 bug where third parameter is not boxed + var properlyBoxesNonStrict = true; + var properlyBoxesStrict = true; + if (method) { + method.call('foo', function (_, __, context) { + if (typeof context !== 'object') { properlyBoxesNonStrict = false; } + }); + + method.call([1], function () { + 'use strict'; + + properlyBoxesStrict = typeof this === 'string'; + }, 'x'); + } + return !!method && properlyBoxesNonStrict && properlyBoxesStrict; +}; + +defineProperties(ArrayPrototype, { + forEach: function forEach(callbackfn /*, thisArg*/) { + var object = ES.ToObject(this); + var self = splitString && isString(this) ? strSplit(this, '') : object; + var i = -1; + var length = ES.ToUint32(self.length); + var T; + if (arguments.length > 1) { + T = arguments[1]; + } + + // If no callback function or if callback is not a callable function + if (!isCallable(callbackfn)) { + throw new TypeError('Array.prototype.forEach callback must be a function'); + } + + while (++i < length) { + if (i in self) { + // Invoke the callback function with call, passing arguments: + // context, property value, property key, thisArg object + if (typeof T === 'undefined') { + callbackfn(self[i], i, object); + } else { + callbackfn.call(T, self[i], i, object); + } + } + } + } +}, !properlyBoxesContext(ArrayPrototype.forEach)); + +// ES5 15.4.4.19 +// http://es5.github.com/#x15.4.4.19 +// https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/map +defineProperties(ArrayPrototype, { + map: function map(callbackfn/*, thisArg*/) { + var object = ES.ToObject(this); + var self = splitString && isString(this) ? strSplit(this, '') : object; + var length = ES.ToUint32(self.length); + var result = $Array(length); + var T; + if (arguments.length > 1) { + T = arguments[1]; + } + + // If no callback function or if callback is not a callable function + if (!isCallable(callbackfn)) { + throw new TypeError('Array.prototype.map callback must be a function'); + } + + for (var i = 0; i < length; i++) { + if (i in self) { + if (typeof T === 'undefined') { + result[i] = callbackfn(self[i], i, object); + } else { + result[i] = callbackfn.call(T, self[i], i, object); + } + } + } + return result; + } +}, !properlyBoxesContext(ArrayPrototype.map)); + +// ES5 15.4.4.20 +// http://es5.github.com/#x15.4.4.20 +// https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/filter +defineProperties(ArrayPrototype, { + filter: function filter(callbackfn /*, thisArg*/) { + var object = ES.ToObject(this); + var self = splitString && isString(this) ? strSplit(this, '') : object; + var length = ES.ToUint32(self.length); + var result = []; + var value; + var T; + if (arguments.length > 1) { + T = arguments[1]; + } + + // If no callback function or if callback is not a callable function + if (!isCallable(callbackfn)) { + throw new TypeError('Array.prototype.filter callback must be a function'); + } + + for (var i = 0; i < length; i++) { + if (i in self) { + value = self[i]; + if (typeof T === 'undefined' ? callbackfn(value, i, object) : callbackfn.call(T, value, i, object)) { + array_push.call(result, value); + } + } + } + return result; + } +}, !properlyBoxesContext(ArrayPrototype.filter)); + +// ES5 15.4.4.16 +// http://es5.github.com/#x15.4.4.16 +// https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/every +defineProperties(ArrayPrototype, { + every: function every(callbackfn /*, thisArg*/) { + var object = ES.ToObject(this); + var self = splitString && isString(this) ? strSplit(this, '') : object; + var length = ES.ToUint32(self.length); + var T; + if (arguments.length > 1) { + T = arguments[1]; + } + + // If no callback function or if callback is not a callable function + if (!isCallable(callbackfn)) { + throw new TypeError('Array.prototype.every callback must be a function'); + } + + for (var i = 0; i < length; i++) { + if (i in self && !(typeof T === 'undefined' ? callbackfn(self[i], i, object) : callbackfn.call(T, self[i], i, object))) { + return false; + } + } + return true; + } +}, !properlyBoxesContext(ArrayPrototype.every)); + +// ES5 15.4.4.17 +// http://es5.github.com/#x15.4.4.17 +// https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/some +defineProperties(ArrayPrototype, { + some: function some(callbackfn/*, thisArg */) { + var object = ES.ToObject(this); + var self = splitString && isString(this) ? strSplit(this, '') : object; + var length = ES.ToUint32(self.length); + var T; + if (arguments.length > 1) { + T = arguments[1]; + } + + // If no callback function or if callback is not a callable function + if (!isCallable(callbackfn)) { + throw new TypeError('Array.prototype.some callback must be a function'); + } + + for (var i = 0; i < length; i++) { + if (i in self && (typeof T === 'undefined' ? callbackfn(self[i], i, object) : callbackfn.call(T, self[i], i, object))) { + return true; + } + } + return false; + } +}, !properlyBoxesContext(ArrayPrototype.some)); + +// ES5 15.4.4.21 +// http://es5.github.com/#x15.4.4.21 +// https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/reduce +var reduceCoercesToObject = false; +if (ArrayPrototype.reduce) { + reduceCoercesToObject = typeof ArrayPrototype.reduce.call('es5', function (_, __, ___, list) { return list; }) === 'object'; +} +defineProperties(ArrayPrototype, { + reduce: function reduce(callbackfn /*, initialValue*/) { + var object = ES.ToObject(this); + var self = splitString && isString(this) ? strSplit(this, '') : object; + var length = ES.ToUint32(self.length); + + // If no callback function or if callback is not a callable function + if (!isCallable(callbackfn)) { + throw new TypeError('Array.prototype.reduce callback must be a function'); + } + + // no value to return if no initial value and an empty array + if (length === 0 && arguments.length === 1) { + throw new TypeError('reduce of empty array with no initial value'); + } + + var i = 0; + var result; + if (arguments.length >= 2) { + result = arguments[1]; + } else { + do { + if (i in self) { + result = self[i++]; + break; + } + + // if array contains no values, no initial value to return + if (++i >= length) { + throw new TypeError('reduce of empty array with no initial value'); + } + } while (true); + } + + for (; i < length; i++) { + if (i in self) { + result = callbackfn(result, self[i], i, object); + } + } + + return result; + } +}, !reduceCoercesToObject); + +// ES5 15.4.4.22 +// http://es5.github.com/#x15.4.4.22 +// https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/reduceRight +var reduceRightCoercesToObject = false; +if (ArrayPrototype.reduceRight) { + reduceRightCoercesToObject = typeof ArrayPrototype.reduceRight.call('es5', function (_, __, ___, list) { return list; }) === 'object'; +} +defineProperties(ArrayPrototype, { + reduceRight: function reduceRight(callbackfn/*, initial*/) { + var object = ES.ToObject(this); + var self = splitString && isString(this) ? strSplit(this, '') : object; + var length = ES.ToUint32(self.length); + + // If no callback function or if callback is not a callable function + if (!isCallable(callbackfn)) { + throw new TypeError('Array.prototype.reduceRight callback must be a function'); + } + + // no value to return if no initial value, empty array + if (length === 0 && arguments.length === 1) { + throw new TypeError('reduceRight of empty array with no initial value'); + } + + var result; + var i = length - 1; + if (arguments.length >= 2) { + result = arguments[1]; + } else { + do { + if (i in self) { + result = self[i--]; + break; + } + + // if array contains no values, no initial value to return + if (--i < 0) { + throw new TypeError('reduceRight of empty array with no initial value'); + } + } while (true); + } + + if (i < 0) { + return result; + } + + do { + if (i in self) { + result = callbackfn(result, self[i], i, object); + } + } while (i--); + + return result; + } +}, !reduceRightCoercesToObject); + +// ES5 15.4.4.14 +// http://es5.github.com/#x15.4.4.14 +// https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/indexOf +var hasFirefox2IndexOfBug = ArrayPrototype.indexOf && [0, 1].indexOf(1, 2) !== -1; +defineProperties(ArrayPrototype, { + indexOf: function indexOf(searchElement /*, fromIndex */) { + var self = splitString && isString(this) ? strSplit(this, '') : ES.ToObject(this); + var length = ES.ToUint32(self.length); + + if (length === 0) { + return -1; + } + + var i = 0; + if (arguments.length > 1) { + i = ES.ToInteger(arguments[1]); + } + + // handle negative indices + i = i >= 0 ? i : max(0, length + i); + for (; i < length; i++) { + if (i in self && self[i] === searchElement) { + return i; + } + } + return -1; + } +}, hasFirefox2IndexOfBug); + +// ES5 15.4.4.15 +// http://es5.github.com/#x15.4.4.15 +// https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/lastIndexOf +var hasFirefox2LastIndexOfBug = ArrayPrototype.lastIndexOf && [0, 1].lastIndexOf(0, -3) !== -1; +defineProperties(ArrayPrototype, { + lastIndexOf: function lastIndexOf(searchElement /*, fromIndex */) { + var self = splitString && isString(this) ? strSplit(this, '') : ES.ToObject(this); + var length = ES.ToUint32(self.length); + + if (length === 0) { + return -1; + } + var i = length - 1; + if (arguments.length > 1) { + i = min(i, ES.ToInteger(arguments[1])); + } + // handle negative indices + i = i >= 0 ? i : length - Math.abs(i); + for (; i >= 0; i--) { + if (i in self && searchElement === self[i]) { + return i; + } + } + return -1; + } +}, hasFirefox2LastIndexOfBug); + +// ES5 15.4.4.12 +// http://es5.github.com/#x15.4.4.12 +var spliceNoopReturnsEmptyArray = (function () { + var a = [1, 2]; + var result = a.splice(); + return a.length === 2 && isArray(result) && result.length === 0; +}()); +defineProperties(ArrayPrototype, { + // Safari 5.0 bug where .splice() returns undefined + splice: function splice(start, deleteCount) { + if (arguments.length === 0) { + return []; + } else { + return array_splice.apply(this, arguments); + } + } +}, !spliceNoopReturnsEmptyArray); + +var spliceWorksWithEmptyObject = (function () { + var obj = {}; + ArrayPrototype.splice.call(obj, 0, 0, 1); + return obj.length === 1; +}()); +defineProperties(ArrayPrototype, { + splice: function splice(start, deleteCount) { + if (arguments.length === 0) { return []; } + var args = arguments; + this.length = max(ES.ToInteger(this.length), 0); + if (arguments.length > 0 && typeof deleteCount !== 'number') { + args = array_slice.call(arguments); + if (args.length < 2) { + array_push.call(args, this.length - start); + } else { + args[1] = ES.ToInteger(deleteCount); + } + } + return array_splice.apply(this, args); + } +}, !spliceWorksWithEmptyObject); +var spliceWorksWithLargeSparseArrays = (function () { + // Per https://github.com/es-shims/es5-shim/issues/295 + // Safari 7/8 breaks with sparse arrays of size 1e5 or greater + var arr = new $Array(1e5); + // note: the index MUST be 8 or larger or the test will false pass + arr[8] = 'x'; + arr.splice(1, 1); + // note: this test must be defined *after* the indexOf shim + // per https://github.com/es-shims/es5-shim/issues/313 + return arr.indexOf('x') === 7; +}()); +var spliceWorksWithSmallSparseArrays = (function () { + // Per https://github.com/es-shims/es5-shim/issues/295 + // Opera 12.15 breaks on this, no idea why. + var n = 256; + var arr = []; + arr[n] = 'a'; + arr.splice(n + 1, 0, 'b'); + return arr[n] === 'a'; +}()); +defineProperties(ArrayPrototype, { + splice: function splice(start, deleteCount) { + var O = ES.ToObject(this); + var A = []; + var len = ES.ToUint32(O.length); + var relativeStart = ES.ToInteger(start); + var actualStart = relativeStart < 0 ? max((len + relativeStart), 0) : min(relativeStart, len); + var actualDeleteCount = min(max(ES.ToInteger(deleteCount), 0), len - actualStart); + + var k = 0; + var from; + while (k < actualDeleteCount) { + from = $String(actualStart + k); + if (owns(O, from)) { + A[k] = O[from]; + } + k += 1; + } + + var items = array_slice.call(arguments, 2); + var itemCount = items.length; + var to; + if (itemCount < actualDeleteCount) { + k = actualStart; + while (k < (len - actualDeleteCount)) { + from = $String(k + actualDeleteCount); + to = $String(k + itemCount); + if (owns(O, from)) { + O[to] = O[from]; + } else { + delete O[to]; + } + k += 1; + } + k = len; + while (k > (len - actualDeleteCount + itemCount)) { + delete O[k - 1]; + k -= 1; + } + } else if (itemCount > actualDeleteCount) { + k = len - actualDeleteCount; + while (k > actualStart) { + from = $String(k + actualDeleteCount - 1); + to = $String(k + itemCount - 1); + if (owns(O, from)) { + O[to] = O[from]; + } else { + delete O[to]; + } + k -= 1; + } + } + k = actualStart; + for (var i = 0; i < items.length; ++i) { + O[k] = items[i]; + k += 1; + } + O.length = len - actualDeleteCount + itemCount; + + return A; + } +}, !spliceWorksWithLargeSparseArrays || !spliceWorksWithSmallSparseArrays); + +// +// Object +// ====== +// + +// ES5 15.2.3.14 +// http://es5.github.com/#x15.2.3.14 + +// http://whattheheadsaid.com/2010/10/a-safer-object-keys-compatibility-implementation +var hasDontEnumBug = !({ 'toString': null }).propertyIsEnumerable('toString'); +var hasProtoEnumBug = function () {}.propertyIsEnumerable('prototype'); +var hasStringEnumBug = !owns('x', '0'); +var equalsConstructorPrototype = function (o) { + var ctor = o.constructor; + return ctor && ctor.prototype === o; +}; +var blacklistedKeys = { + $window: true, + $console: true, + $parent: true, + $self: true, + $frame: true, + $frames: true, + $frameElement: true, + $webkitIndexedDB: true, + $webkitStorageInfo: true +}; +var hasAutomationEqualityBug = (function () { + /* globals window */ + if (typeof window === 'undefined') { return false; } + for (var k in window) { + try { + if (!blacklistedKeys['$' + k] && owns(window, k) && window[k] !== null && typeof window[k] === 'object') { + equalsConstructorPrototype(window[k]); + } + } catch (e) { + return true; + } + } + return false; +}()); +var equalsConstructorPrototypeIfNotBuggy = function (object) { + if (typeof window === 'undefined' || !hasAutomationEqualityBug) { return equalsConstructorPrototype(object); } + try { + return equalsConstructorPrototype(object); + } catch (e) { + return false; + } +}; +var dontEnums = [ + 'toString', + 'toLocaleString', + 'valueOf', + 'hasOwnProperty', + 'isPrototypeOf', + 'propertyIsEnumerable', + 'constructor' +]; +var dontEnumsLength = dontEnums.length; + +// taken directly from https://github.com/ljharb/is-arguments/blob/master/index.js +// can be replaced with require('is-arguments') if we ever use a build process instead +var isStandardArguments = function isArguments(value) { + return toStr(value) === '[object Arguments]'; +}; +var isLegacyArguments = function isArguments(value) { + return value !== null && + typeof value === 'object' && + typeof value.length === 'number' && + value.length >= 0 && + !isArray(value) && + isCallable(value.callee); +}; +var isArguments = isStandardArguments(arguments) ? isStandardArguments : isLegacyArguments; + +defineProperties($Object, { + keys: function keys(object) { + var isFn = isCallable(object); + var isArgs = isArguments(object); + var isObject = object !== null && typeof object === 'object'; + var isStr = isObject && isString(object); + + if (!isObject && !isFn && !isArgs) { + throw new TypeError('Object.keys called on a non-object'); + } + + var theKeys = []; + var skipProto = hasProtoEnumBug && isFn; + if ((isStr && hasStringEnumBug) || isArgs) { + for (var i = 0; i < object.length; ++i) { + array_push.call(theKeys, $String(i)); + } + } + + if (!isArgs) { + for (var name in object) { + if (!(skipProto && name === 'prototype') && owns(object, name)) { + array_push.call(theKeys, $String(name)); + } + } + } + + if (hasDontEnumBug) { + var skipConstructor = equalsConstructorPrototypeIfNotBuggy(object); + for (var j = 0; j < dontEnumsLength; j++) { + var dontEnum = dontEnums[j]; + if (!(skipConstructor && dontEnum === 'constructor') && owns(object, dontEnum)) { + array_push.call(theKeys, dontEnum); + } + } + } + return theKeys; + } +}); + +var keysWorksWithArguments = $Object.keys && (function () { + // Safari 5.0 bug + return $Object.keys(arguments).length === 2; +}(1, 2)); +var keysHasArgumentsLengthBug = $Object.keys && (function () { + var argKeys = $Object.keys(arguments); + return arguments.length !== 1 || argKeys.length !== 1 || argKeys[0] !== 1; +}(1)); +var originalKeys = $Object.keys; +defineProperties($Object, { + keys: function keys(object) { + if (isArguments(object)) { + return originalKeys(array_slice.call(object)); + } else { + return originalKeys(object); + } + } +}, !keysWorksWithArguments || keysHasArgumentsLengthBug); + +// +// Date +// ==== +// + +// ES5 15.9.5.43 +// http://es5.github.com/#x15.9.5.43 +// This function returns a String value represent the instance in time +// represented by this Date object. The format of the String is the Date Time +// string format defined in 15.9.1.15. All fields are present in the String. +// The time zone is always UTC, denoted by the suffix Z. If the time value of +// this object is not a finite Number a RangeError exception is thrown. +var negativeDate = -62198755200000; +var negativeYearString = '-000001'; +var hasNegativeDateBug = Date.prototype.toISOString && new Date(negativeDate).toISOString().indexOf(negativeYearString) === -1; +var hasSafari51DateBug = Date.prototype.toISOString && new Date(-1).toISOString() !== '1969-12-31T23:59:59.999Z'; + +defineProperties(Date.prototype, { + toISOString: function toISOString() { + var result, length, value, year, month; + if (!isFinite(this)) { + throw new RangeError('Date.prototype.toISOString called on non-finite value.'); + } + + year = this.getUTCFullYear(); + + month = this.getUTCMonth(); + // see https://github.com/es-shims/es5-shim/issues/111 + year += Math.floor(month / 12); + month = (month % 12 + 12) % 12; + + // the date time string format is specified in 15.9.1.15. + result = [month + 1, this.getUTCDate(), this.getUTCHours(), this.getUTCMinutes(), this.getUTCSeconds()]; + year = ( + (year < 0 ? '-' : (year > 9999 ? '+' : '')) + + strSlice('00000' + Math.abs(year), (0 <= year && year <= 9999) ? -4 : -6) + ); + + length = result.length; + while (length--) { + value = result[length]; + // pad months, days, hours, minutes, and seconds to have two + // digits. + if (value < 10) { + result[length] = '0' + value; + } + } + // pad milliseconds to have three digits. + return ( + year + '-' + array_slice.call(result, 0, 2).join('-') + + 'T' + array_slice.call(result, 2).join(':') + '.' + + strSlice('000' + this.getUTCMilliseconds(), -3) + 'Z' + ); + } +}, hasNegativeDateBug || hasSafari51DateBug); + +// ES5 15.9.5.44 +// http://es5.github.com/#x15.9.5.44 +// This function provides a String representation of a Date object for use by +// JSON.stringify (15.12.3). +var dateToJSONIsSupported = (function () { + try { + return Date.prototype.toJSON && + new Date(NaN).toJSON() === null && + new Date(negativeDate).toJSON().indexOf(negativeYearString) !== -1 && + Date.prototype.toJSON.call({ // generic + toISOString: function () { return true; } + }); + } catch (e) { + return false; + } +}()); +if (!dateToJSONIsSupported) { + Date.prototype.toJSON = function toJSON(key) { + // When the toJSON method is called with argument key, the following + // steps are taken: + + // 1. Let O be the result of calling ToObject, giving it the this + // value as its argument. + // 2. Let tv be ES.ToPrimitive(O, hint Number). + var O = $Object(this); + var tv = ES.ToPrimitive(O); + // 3. If tv is a Number and is not finite, return null. + if (typeof tv === 'number' && !isFinite(tv)) { + return null; + } + // 4. Let toISO be the result of calling the [[Get]] internal method of + // O with argument "toISOString". + var toISO = O.toISOString; + // 5. If IsCallable(toISO) is false, throw a TypeError exception. + if (!isCallable(toISO)) { + throw new TypeError('toISOString property is not callable'); + } + // 6. Return the result of calling the [[Call]] internal method of + // toISO with O as the this value and an empty argument list. + return toISO.call(O); + + // NOTE 1 The argument is ignored. + + // NOTE 2 The toJSON function is intentionally generic; it does not + // require that its this value be a Date object. Therefore, it can be + // transferred to other kinds of objects for use as a method. However, + // it does require that any such object have a toISOString method. An + // object is free to use the argument key to filter its + // stringification. + }; +} + +// ES5 15.9.4.2 +// http://es5.github.com/#x15.9.4.2 +// based on work shared by Daniel Friesen (dantman) +// http://gist.github.com/303249 +var supportsExtendedYears = Date.parse('+033658-09-27T01:46:40.000Z') === 1e15; +var acceptsInvalidDates = !isNaN(Date.parse('2012-04-04T24:00:00.500Z')) || !isNaN(Date.parse('2012-11-31T23:59:59.000Z')) || !isNaN(Date.parse('2012-12-31T23:59:60.000Z')); +var doesNotParseY2KNewYear = isNaN(Date.parse('2000-01-01T00:00:00.000Z')); +if (doesNotParseY2KNewYear || acceptsInvalidDates || !supportsExtendedYears) { + // XXX global assignment won't work in embeddings that use + // an alternate object for the context. + /* global Date: true */ + /* eslint-disable no-undef */ + var maxSafeUnsigned32Bit = Math.pow(2, 31) - 1; + var secondsWithinMaxSafeUnsigned32Bit = Math.floor(maxSafeUnsigned32Bit / 1e3); + var hasSafariSignedIntBug = isActualNaN(new Date(1970, 0, 1, 0, 0, 0, maxSafeUnsigned32Bit + 1).getTime()); + Date = (function (NativeDate) { + /* eslint-enable no-undef */ + // Date.length === 7 + var DateShim = function Date(Y, M, D, h, m, s, ms) { + var length = arguments.length; + var date; + if (this instanceof NativeDate) { + var seconds = s; + var millis = ms; + if (hasSafariSignedIntBug && length >= 7 && ms > maxSafeUnsigned32Bit) { + // work around a Safari 8/9 bug where it treats the seconds as signed + var msToShift = Math.floor(ms / maxSafeUnsigned32Bit) * maxSafeUnsigned32Bit; + var sToShift = Math.floor(msToShift / 1e3); + seconds += sToShift; + millis -= sToShift * 1e3; + } + date = length === 1 && $String(Y) === Y ? // isString(Y) + // We explicitly pass it through parse: + new NativeDate(DateShim.parse(Y)) : + // We have to manually make calls depending on argument + // length here + length >= 7 ? new NativeDate(Y, M, D, h, m, seconds, millis) : + length >= 6 ? new NativeDate(Y, M, D, h, m, seconds) : + length >= 5 ? new NativeDate(Y, M, D, h, m) : + length >= 4 ? new NativeDate(Y, M, D, h) : + length >= 3 ? new NativeDate(Y, M, D) : + length >= 2 ? new NativeDate(Y, M) : + length >= 1 ? new NativeDate(Y) : + new NativeDate(); + } else { + date = NativeDate.apply(this, arguments); + } + if (!isPrimitive(date)) { + // Prevent mixups with unfixed Date object + defineProperties(date, { constructor: DateShim }, true); + } + return date; + }; + + // 15.9.1.15 Date Time String Format. + var isoDateExpression = new RegExp('^' + + '(\\d{4}|[+-]\\d{6})' + // four-digit year capture or sign + + // 6-digit extended year + '(?:-(\\d{2})' + // optional month capture + '(?:-(\\d{2})' + // optional day capture + '(?:' + // capture hours:minutes:seconds.milliseconds + 'T(\\d{2})' + // hours capture + ':(\\d{2})' + // minutes capture + '(?:' + // optional :seconds.milliseconds + ':(\\d{2})' + // seconds capture + '(?:(\\.\\d{1,}))?' + // milliseconds capture + ')?' + + '(' + // capture UTC offset component + 'Z|' + // UTC capture + '(?:' + // offset specifier +/-hours:minutes + '([-+])' + // sign capture + '(\\d{2})' + // hours offset capture + ':(\\d{2})' + // minutes offset capture + ')' + + ')?)?)?)?' + + '$'); + + var months = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365]; + + var dayFromMonth = function dayFromMonth(year, month) { + var t = month > 1 ? 1 : 0; + return ( + months[month] + + Math.floor((year - 1969 + t) / 4) - + Math.floor((year - 1901 + t) / 100) + + Math.floor((year - 1601 + t) / 400) + + 365 * (year - 1970) + ); + }; + + var toUTC = function toUTC(t) { + var s = 0; + var ms = t; + if (hasSafariSignedIntBug && ms > maxSafeUnsigned32Bit) { + // work around a Safari 8/9 bug where it treats the seconds as signed + var msToShift = Math.floor(ms / maxSafeUnsigned32Bit) * maxSafeUnsigned32Bit; + var sToShift = Math.floor(msToShift / 1e3); + s += sToShift; + ms -= sToShift * 1e3; + } + return $Number(new NativeDate(1970, 0, 1, 0, 0, s, ms)); + }; + + // Copy any custom methods a 3rd party library may have added + for (var key in NativeDate) { + if (owns(NativeDate, key)) { + DateShim[key] = NativeDate[key]; + } + } + + // Copy "native" methods explicitly; they may be non-enumerable + defineProperties(DateShim, { + now: NativeDate.now, + UTC: NativeDate.UTC + }, true); + DateShim.prototype = NativeDate.prototype; + defineProperties(DateShim.prototype, { + constructor: DateShim + }, true); + + // Upgrade Date.parse to handle simplified ISO 8601 strings + var parseShim = function parse(string) { + var match = isoDateExpression.exec(string); + if (match) { + // parse months, days, hours, minutes, seconds, and milliseconds + // provide default values if necessary + // parse the UTC offset component + var year = $Number(match[1]), + month = $Number(match[2] || 1) - 1, + day = $Number(match[3] || 1) - 1, + hour = $Number(match[4] || 0), + minute = $Number(match[5] || 0), + second = $Number(match[6] || 0), + millisecond = Math.floor($Number(match[7] || 0) * 1000), + // When time zone is missed, local offset should be used + // (ES 5.1 bug) + // see https://bugs.ecmascript.org/show_bug.cgi?id=112 + isLocalTime = Boolean(match[4] && !match[8]), + signOffset = match[9] === '-' ? 1 : -1, + hourOffset = $Number(match[10] || 0), + minuteOffset = $Number(match[11] || 0), + result; + var hasMinutesOrSecondsOrMilliseconds = minute > 0 || second > 0 || millisecond > 0; + if ( + hour < (hasMinutesOrSecondsOrMilliseconds ? 24 : 25) && + minute < 60 && second < 60 && millisecond < 1000 && + month > -1 && month < 12 && hourOffset < 24 && + minuteOffset < 60 && // detect invalid offsets + day > -1 && + day < (dayFromMonth(year, month + 1) - dayFromMonth(year, month)) + ) { + result = ( + (dayFromMonth(year, month) + day) * 24 + + hour + + hourOffset * signOffset + ) * 60; + result = ( + (result + minute + minuteOffset * signOffset) * 60 + + second + ) * 1000 + millisecond; + if (isLocalTime) { + result = toUTC(result); + } + if (-8.64e15 <= result && result <= 8.64e15) { + return result; + } + } + return NaN; + } + return NativeDate.parse.apply(this, arguments); + }; + defineProperties(DateShim, { parse: parseShim }); + + return DateShim; + }(Date)); + /* global Date: false */ +} + +// ES5 15.9.4.4 +// http://es5.github.com/#x15.9.4.4 +if (!Date.now) { + Date.now = function now() { + return new Date().getTime(); + }; +} + +// +// Number +// ====== +// + +// ES5.1 15.7.4.5 +// http://es5.github.com/#x15.7.4.5 +var hasToFixedBugs = NumberPrototype.toFixed && ( + (0.00008).toFixed(3) !== '0.000' || + (0.9).toFixed(0) !== '1' || + (1.255).toFixed(2) !== '1.25' || + (1000000000000000128).toFixed(0) !== '1000000000000000128' +); + +var toFixedHelpers = { + base: 1e7, + size: 6, + data: [0, 0, 0, 0, 0, 0], + multiply: function multiply(n, c) { + var i = -1; + var c2 = c; + while (++i < toFixedHelpers.size) { + c2 += n * toFixedHelpers.data[i]; + toFixedHelpers.data[i] = c2 % toFixedHelpers.base; + c2 = Math.floor(c2 / toFixedHelpers.base); + } + }, + divide: function divide(n) { + var i = toFixedHelpers.size, c = 0; + while (--i >= 0) { + c += toFixedHelpers.data[i]; + toFixedHelpers.data[i] = Math.floor(c / n); + c = (c % n) * toFixedHelpers.base; + } + }, + numToString: function numToString() { + var i = toFixedHelpers.size; + var s = ''; + while (--i >= 0) { + if (s !== '' || i === 0 || toFixedHelpers.data[i] !== 0) { + var t = $String(toFixedHelpers.data[i]); + if (s === '') { + s = t; + } else { + s += strSlice('0000000', 0, 7 - t.length) + t; + } + } + } + return s; + }, + pow: function pow(x, n, acc) { + return (n === 0 ? acc : (n % 2 === 1 ? pow(x, n - 1, acc * x) : pow(x * x, n / 2, acc))); + }, + log: function log(x) { + var n = 0; + var x2 = x; + while (x2 >= 4096) { + n += 12; + x2 /= 4096; + } + while (x2 >= 2) { + n += 1; + x2 /= 2; + } + return n; + } +}; + +defineProperties(NumberPrototype, { + toFixed: function toFixed(fractionDigits) { + var f, x, s, m, e, z, j, k; + + // Test for NaN and round fractionDigits down + f = $Number(fractionDigits); + f = isActualNaN(f) ? 0 : Math.floor(f); + + if (f < 0 || f > 20) { + throw new RangeError('Number.toFixed called with invalid number of decimals'); + } + + x = $Number(this); + + if (isActualNaN(x)) { + return 'NaN'; + } + + // If it is too big or small, return the string value of the number + if (x <= -1e21 || x >= 1e21) { + return $String(x); + } + + s = ''; + + if (x < 0) { + s = '-'; + x = -x; + } + + m = '0'; + + if (x > 1e-21) { + // 1e-21 < x < 1e21 + // -70 < log2(x) < 70 + e = toFixedHelpers.log(x * toFixedHelpers.pow(2, 69, 1)) - 69; + z = (e < 0 ? x * toFixedHelpers.pow(2, -e, 1) : x / toFixedHelpers.pow(2, e, 1)); + z *= 0x10000000000000; // Math.pow(2, 52); + e = 52 - e; + + // -18 < e < 122 + // x = z / 2 ^ e + if (e > 0) { + toFixedHelpers.multiply(0, z); + j = f; + + while (j >= 7) { + toFixedHelpers.multiply(1e7, 0); + j -= 7; + } + + toFixedHelpers.multiply(toFixedHelpers.pow(10, j, 1), 0); + j = e - 1; + + while (j >= 23) { + toFixedHelpers.divide(1 << 23); + j -= 23; + } + + toFixedHelpers.divide(1 << j); + toFixedHelpers.multiply(1, 1); + toFixedHelpers.divide(2); + m = toFixedHelpers.numToString(); + } else { + toFixedHelpers.multiply(0, z); + toFixedHelpers.multiply(1 << (-e), 0); + m = toFixedHelpers.numToString() + strSlice('0.00000000000000000000', 2, 2 + f); + } + } + + if (f > 0) { + k = m.length; + + if (k <= f) { + m = s + strSlice('0.0000000000000000000', 0, f - k + 2) + m; + } else { + m = s + strSlice(m, 0, k - f) + '.' + strSlice(m, k - f); + } + } else { + m = s + m; + } + + return m; + } +}, hasToFixedBugs); + +// +// String +// ====== +// + +// ES5 15.5.4.14 +// http://es5.github.com/#x15.5.4.14 + +// [bugfix, IE lt 9, firefox 4, Konqueror, Opera, obscure browsers] +// Many browsers do not split properly with regular expressions or they +// do not perform the split correctly under obscure conditions. +// See http://blog.stevenlevithan.com/archives/cross-browser-split +// I've tested in many browsers and this seems to cover the deviant ones: +// 'ab'.split(/(?:ab)*/) should be ["", ""], not [""] +// '.'.split(/(.?)(.?)/) should be ["", ".", "", ""], not ["", ""] +// 'tesst'.split(/(s)*/) should be ["t", undefined, "e", "s", "t"], not +// [undefined, "t", undefined, "e", ...] +// ''.split(/.?/) should be [], not [""] +// '.'.split(/()()/) should be ["."], not ["", "", "."] + +if ( + 'ab'.split(/(?:ab)*/).length !== 2 || + '.'.split(/(.?)(.?)/).length !== 4 || + 'tesst'.split(/(s)*/)[1] === 't' || + 'test'.split(/(?:)/, -1).length !== 4 || + ''.split(/.?/).length || + '.'.split(/()()/).length > 1 +) { + (function () { + var compliantExecNpcg = typeof (/()??/).exec('')[1] === 'undefined'; // NPCG: nonparticipating capturing group + var maxSafe32BitInt = Math.pow(2, 32) - 1; + + StringPrototype.split = function (separator, limit) { + var string = this; + if (typeof separator === 'undefined' && limit === 0) { + return []; + } + + // If `separator` is not a regex, use native split + if (!isRegex(separator)) { + return strSplit(this, separator, limit); + } + + var output = []; + var flags = (separator.ignoreCase ? 'i' : '') + + (separator.multiline ? 'm' : '') + + (separator.unicode ? 'u' : '') + // in ES6 + (separator.sticky ? 'y' : ''), // Firefox 3+ and ES6 + lastLastIndex = 0, + // Make `global` and avoid `lastIndex` issues by working with a copy + separator2, match, lastIndex, lastLength; + var separatorCopy = new RegExp(separator.source, flags + 'g'); + string += ''; // Type-convert + if (!compliantExecNpcg) { + // Doesn't need flags gy, but they don't hurt + separator2 = new RegExp('^' + separatorCopy.source + '$(?!\\s)', flags); + } + /* Values for `limit`, per the spec: + * If undefined: 4294967295 // maxSafe32BitInt + * If 0, Infinity, or NaN: 0 + * If positive number: limit = Math.floor(limit); if (limit > 4294967295) limit -= 4294967296; + * If negative number: 4294967296 - Math.floor(Math.abs(limit)) + * If other: Type-convert, then use the above rules + */ + var splitLimit = typeof limit === 'undefined' ? maxSafe32BitInt : ES.ToUint32(limit); + match = separatorCopy.exec(string); + while (match) { + // `separatorCopy.lastIndex` is not reliable cross-browser + lastIndex = match.index + match[0].length; + if (lastIndex > lastLastIndex) { + array_push.call(output, strSlice(string, lastLastIndex, match.index)); + // Fix browsers whose `exec` methods don't consistently return `undefined` for + // nonparticipating capturing groups + if (!compliantExecNpcg && match.length > 1) { + /* eslint-disable no-loop-func */ + match[0].replace(separator2, function () { + for (var i = 1; i < arguments.length - 2; i++) { + if (typeof arguments[i] === 'undefined') { + match[i] = void 0; + } + } + }); + /* eslint-enable no-loop-func */ + } + if (match.length > 1 && match.index < string.length) { + array_push.apply(output, array_slice.call(match, 1)); + } + lastLength = match[0].length; + lastLastIndex = lastIndex; + if (output.length >= splitLimit) { + break; + } + } + if (separatorCopy.lastIndex === match.index) { + separatorCopy.lastIndex++; // Avoid an infinite loop + } + match = separatorCopy.exec(string); + } + if (lastLastIndex === string.length) { + if (lastLength || !separatorCopy.test('')) { + array_push.call(output, ''); + } + } else { + array_push.call(output, strSlice(string, lastLastIndex)); + } + return output.length > splitLimit ? strSlice(output, 0, splitLimit) : output; + }; + }()); + +// [bugfix, chrome] +// If separator is undefined, then the result array contains just one String, +// which is the this value (converted to a String). If limit is not undefined, +// then the output array is truncated so that it contains no more than limit +// elements. +// "0".split(undefined, 0) -> [] +} else if ('0'.split(void 0, 0).length) { + StringPrototype.split = function split(separator, limit) { + if (typeof separator === 'undefined' && limit === 0) { return []; } + return strSplit(this, separator, limit); + }; +} + +var str_replace = StringPrototype.replace; +var replaceReportsGroupsCorrectly = (function () { + var groups = []; + 'x'.replace(/x(.)?/g, function (match, group) { + array_push.call(groups, group); + }); + return groups.length === 1 && typeof groups[0] === 'undefined'; +}()); + +if (!replaceReportsGroupsCorrectly) { + StringPrototype.replace = function replace(searchValue, replaceValue) { + var isFn = isCallable(replaceValue); + var hasCapturingGroups = isRegex(searchValue) && (/\)[*?]/).test(searchValue.source); + if (!isFn || !hasCapturingGroups) { + return str_replace.call(this, searchValue, replaceValue); + } else { + var wrappedReplaceValue = function (match) { + var length = arguments.length; + var originalLastIndex = searchValue.lastIndex; + searchValue.lastIndex = 0; + var args = searchValue.exec(match) || []; + searchValue.lastIndex = originalLastIndex; + array_push.call(args, arguments[length - 2], arguments[length - 1]); + return replaceValue.apply(this, args); + }; + return str_replace.call(this, searchValue, wrappedReplaceValue); + } + }; +} + +// ECMA-262, 3rd B.2.3 +// Not an ECMAScript standard, although ECMAScript 3rd Edition has a +// non-normative section suggesting uniform semantics and it should be +// normalized across all browsers +// [bugfix, IE lt 9] IE < 9 substr() with negative value not working in IE +var string_substr = StringPrototype.substr; +var hasNegativeSubstrBug = ''.substr && '0b'.substr(-1) !== 'b'; +defineProperties(StringPrototype, { + substr: function substr(start, length) { + var normalizedStart = start; + if (start < 0) { + normalizedStart = max(this.length + start, 0); + } + return string_substr.call(this, normalizedStart, length); + } +}, hasNegativeSubstrBug); + +// ES5 15.5.4.20 +// whitespace from: http://es5.github.io/#x15.5.4.20 +var ws = '\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003' + + '\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028' + + '\u2029\uFEFF'; +var zeroWidth = '\u200b'; +var wsRegexChars = '[' + ws + ']'; +var trimBeginRegexp = new RegExp('^' + wsRegexChars + wsRegexChars + '*'); +var trimEndRegexp = new RegExp(wsRegexChars + wsRegexChars + '*$'); +var hasTrimWhitespaceBug = StringPrototype.trim && (ws.trim() || !zeroWidth.trim()); +defineProperties(StringPrototype, { + // http://blog.stevenlevithan.com/archives/faster-trim-javascript + // http://perfectionkills.com/whitespace-deviations/ + trim: function trim() { + if (typeof this === 'undefined' || this === null) { + throw new TypeError("can't convert " + this + ' to object'); + } + return $String(this).replace(trimBeginRegexp, '').replace(trimEndRegexp, ''); + } +}, hasTrimWhitespaceBug); + +// ES-5 15.1.2.2 +if (parseInt(ws + '08') !== 8 || parseInt(ws + '0x16') !== 22) { + /* global parseInt: true */ + parseInt = (function (origParseInt) { + var hexRegex = /^0[xX]/; + return function parseInt(str, radix) { + var string = $String(str).trim(); + var defaultedRadix = $Number(radix) || (hexRegex.test(string) ? 16 : 10); + return origParseInt(string, defaultedRadix); + }; + }(parseInt)); +} + +})); diff --git a/public/bower_components/font-awesome/font-awesome.less b/public/bower_components/font-awesome/font-awesome.less new file mode 100644 index 0000000..e3f89c8 --- /dev/null +++ b/public/bower_components/font-awesome/font-awesome.less @@ -0,0 +1,17 @@ +/*! + * Font Awesome 4.4.0 by @davegandy - http://fontawesome.io - @fontawesome + * License - http://fontawesome.io/license (Font: SIL OFL 1.1, CSS: MIT License) + */ + +@import "variables.less"; +@import "mixins.less"; +@import "path.less"; +@import "core.less"; +@import "larger.less"; +@import "fixed-width.less"; +@import "list.less"; +@import "bordered-pulled.less"; +@import "animated.less"; +@import "rotated-flipped.less"; +@import "stacked.less"; +@import "icons.less"; diff --git a/public/bower_components/font-awesome/font-awesome.scss b/public/bower_components/font-awesome/font-awesome.scss new file mode 100644 index 0000000..ebd9646 --- /dev/null +++ b/public/bower_components/font-awesome/font-awesome.scss @@ -0,0 +1,17 @@ +/*! + * Font Awesome 4.4.0 by @davegandy - http://fontawesome.io - @fontawesome + * License - http://fontawesome.io/license (Font: SIL OFL 1.1, CSS: MIT License) + */ + +@import "variables"; +@import "mixins"; +@import "path"; +@import "core"; +@import "larger"; +@import "fixed-width"; +@import "list"; +@import "bordered-pulled"; +@import "animated"; +@import "rotated-flipped"; +@import "stacked"; +@import "icons"; diff --git a/public/bower_components/highlightjs/default.css b/public/bower_components/highlightjs/default.css new file mode 100644 index 0000000..b0ac8b8 --- /dev/null +++ b/public/bower_components/highlightjs/default.css @@ -0,0 +1,155 @@ +/* + +Original style from softwaremaniacs.org (c) Ivan Sagalaev + +*/ + +.hljs { + display: block; + overflow-x: auto; + padding: 0.5em; + background: #f0f0f0; + -webkit-text-size-adjust: none; +} + +.hljs, +.hljs-subst, +.hljs-tag .hljs-title, +.nginx .hljs-title { + color: black; +} + +.hljs-string, +.hljs-title, +.hljs-constant, +.hljs-parent, +.hljs-tag .hljs-value, +.hljs-rule .hljs-value, +.hljs-preprocessor, +.hljs-pragma, +.hljs-name, +.haml .hljs-symbol, +.ruby .hljs-symbol, +.ruby .hljs-symbol .hljs-string, +.hljs-template_tag, +.django .hljs-variable, +.smalltalk .hljs-class, +.hljs-addition, +.hljs-flow, +.hljs-stream, +.bash .hljs-variable, +.pf .hljs-variable, +.apache .hljs-tag, +.apache .hljs-cbracket, +.tex .hljs-command, +.tex .hljs-special, +.erlang_repl .hljs-function_or_atom, +.asciidoc .hljs-header, +.markdown .hljs-header, +.coffeescript .hljs-attribute, +.tp .hljs-variable { + color: #800; +} + +.smartquote, +.hljs-comment, +.hljs-annotation, +.diff .hljs-header, +.hljs-chunk, +.asciidoc .hljs-blockquote, +.markdown .hljs-blockquote { + color: #888; +} + +.hljs-number, +.hljs-date, +.hljs-regexp, +.hljs-literal, +.hljs-hexcolor, +.smalltalk .hljs-symbol, +.smalltalk .hljs-char, +.go .hljs-constant, +.hljs-change, +.lasso .hljs-variable, +.makefile .hljs-variable, +.asciidoc .hljs-bullet, +.markdown .hljs-bullet, +.asciidoc .hljs-link_url, +.markdown .hljs-link_url { + color: #080; +} + +.hljs-label, +.ruby .hljs-string, +.hljs-decorator, +.hljs-filter .hljs-argument, +.hljs-localvars, +.hljs-array, +.hljs-attr_selector, +.hljs-important, +.hljs-pseudo, +.hljs-pi, +.haml .hljs-bullet, +.hljs-doctype, +.hljs-deletion, +.hljs-envvar, +.hljs-shebang, +.apache .hljs-sqbracket, +.nginx .hljs-built_in, +.tex .hljs-formula, +.erlang_repl .hljs-reserved, +.hljs-prompt, +.asciidoc .hljs-link_label, +.markdown .hljs-link_label, +.vhdl .hljs-attribute, +.clojure .hljs-attribute, +.asciidoc .hljs-attribute, +.lasso .hljs-attribute, +.coffeescript .hljs-property, +.hljs-phony { + color: #88f; +} + +.hljs-keyword, +.hljs-id, +.hljs-title, +.hljs-built_in, +.css .hljs-tag, +.hljs-doctag, +.smalltalk .hljs-class, +.hljs-winutils, +.bash .hljs-variable, +.pf .hljs-variable, +.apache .hljs-tag, +.hljs-type, +.hljs-typename, +.tex .hljs-command, +.asciidoc .hljs-strong, +.markdown .hljs-strong, +.hljs-request, +.hljs-status, +.tp .hljs-data, +.tp .hljs-io { + font-weight: bold; +} + +.asciidoc .hljs-emphasis, +.markdown .hljs-emphasis, +.tp .hljs-units { + font-style: italic; +} + +.nginx .hljs-built_in { + font-weight: normal; +} + +.coffeescript .javascript, +.javascript .xml, +.lasso .markup, +.tex .hljs-formula, +.xml .javascript, +.xml .vbscript, +.xml .css, +.xml .hljs-cdata { + opacity: 0.5; +} diff --git a/public/bower_components/highlightjs/highlight.pack.js b/public/bower_components/highlightjs/highlight.pack.js new file mode 100644 index 0000000..fe3a944 --- /dev/null +++ b/public/bower_components/highlightjs/highlight.pack.js @@ -0,0 +1,13562 @@ +(function(factory) { + + // Setup highlight.js for different environments. First is Node.js or + // CommonJS. + if(typeof exports !== 'undefined') { + factory(exports); + } else { + // Export hljs globally even when using AMD for cases when this script + // is loaded with others that may still expect a global hljs. + window.hljs = factory({}); + + // Finally register the global hljs with AMD. + if(typeof define === 'function' && define.amd) { + define('hljs', [], function() { + return window.hljs; + }); + } + } + +}(function(hljs) { + + /* Utility functions */ + + function escape(value) { + return value.replace(/&/gm, '&').replace(//gm, '>'); + } + + function tag(node) { + return node.nodeName.toLowerCase(); + } + + function testRe(re, lexeme) { + var match = re && re.exec(lexeme); + return match && match.index == 0; + } + + function isNotHighlighted(language) { + return (/^(no-?highlight|plain|text)$/i).test(language); + } + + function blockLanguage(block) { + var i, match, length, + classes = block.className + ' '; + + classes += block.parentNode ? block.parentNode.className : ''; + + // language-* takes precedence over non-prefixed class names + match = (/\blang(?:uage)?-([\w-]+)\b/i).exec(classes); + if (match) { + return getLanguage(match[1]) ? match[1] : 'no-highlight'; + } + + classes = classes.split(/\s+/); + for (i = 0, length = classes.length; i < length; i++) { + if (getLanguage(classes[i]) || isNotHighlighted(classes[i])) { + return classes[i]; + } + } + } + + function inherit(parent, obj) { + var result = {}, key; + for (key in parent) + result[key] = parent[key]; + if (obj) + for (key in obj) + result[key] = obj[key]; + return result; + } + + /* Stream merging */ + + function nodeStream(node) { + var result = []; + (function _nodeStream(node, offset) { + for (var child = node.firstChild; child; child = child.nextSibling) { + if (child.nodeType == 3) + offset += child.nodeValue.length; + else if (child.nodeType == 1) { + result.push({ + event: 'start', + offset: offset, + node: child + }); + offset = _nodeStream(child, offset); + // Prevent void elements from having an end tag that would actually + // double them in the output. There are more void elements in HTML + // but we list only those realistically expected in code display. + if (!tag(child).match(/br|hr|img|input/)) { + result.push({ + event: 'stop', + offset: offset, + node: child + }); + } + } + } + return offset; + })(node, 0); + return result; + } + + function mergeStreams(original, highlighted, value) { + var processed = 0; + var result = ''; + var nodeStack = []; + + function selectStream() { + if (!original.length || !highlighted.length) { + return original.length ? original : highlighted; + } + if (original[0].offset != highlighted[0].offset) { + return (original[0].offset < highlighted[0].offset) ? original : highlighted; + } + + /* + To avoid starting the stream just before it should stop the order is + ensured that original always starts first and closes last: + + if (event1 == 'start' && event2 == 'start') + return original; + if (event1 == 'start' && event2 == 'stop') + return highlighted; + if (event1 == 'stop' && event2 == 'start') + return original; + if (event1 == 'stop' && event2 == 'stop') + return highlighted; + + ... which is collapsed to: + */ + return highlighted[0].event == 'start' ? original : highlighted; + } + + function open(node) { + function attr_str(a) {return ' ' + a.nodeName + '="' + escape(a.value) + '"';} + result += '<' + tag(node) + Array.prototype.map.call(node.attributes, attr_str).join('') + '>'; + } + + function close(node) { + result += ''; + } + + function render(event) { + (event.event == 'start' ? open : close)(event.node); + } + + while (original.length || highlighted.length) { + var stream = selectStream(); + result += escape(value.substr(processed, stream[0].offset - processed)); + processed = stream[0].offset; + if (stream == original) { + /* + On any opening or closing tag of the original markup we first close + the entire highlighted node stack, then render the original tag along + with all the following original tags at the same offset and then + reopen all the tags on the highlighted stack. + */ + nodeStack.reverse().forEach(close); + do { + render(stream.splice(0, 1)[0]); + stream = selectStream(); + } while (stream == original && stream.length && stream[0].offset == processed); + nodeStack.reverse().forEach(open); + } else { + if (stream[0].event == 'start') { + nodeStack.push(stream[0].node); + } else { + nodeStack.pop(); + } + render(stream.splice(0, 1)[0]); + } + } + return result + escape(value.substr(processed)); + } + + /* Initialization */ + + function compileLanguage(language) { + + function reStr(re) { + return (re && re.source) || re; + } + + function langRe(value, global) { + return new RegExp( + reStr(value), + 'm' + (language.case_insensitive ? 'i' : '') + (global ? 'g' : '') + ); + } + + function compileMode(mode, parent) { + if (mode.compiled) + return; + mode.compiled = true; + + mode.keywords = mode.keywords || mode.beginKeywords; + if (mode.keywords) { + var compiled_keywords = {}; + + var flatten = function(className, str) { + if (language.case_insensitive) { + str = str.toLowerCase(); + } + str.split(' ').forEach(function(kw) { + var pair = kw.split('|'); + compiled_keywords[pair[0]] = [className, pair[1] ? Number(pair[1]) : 1]; + }); + }; + + if (typeof mode.keywords == 'string') { // string + flatten('keyword', mode.keywords); + } else { + Object.keys(mode.keywords).forEach(function (className) { + flatten(className, mode.keywords[className]); + }); + } + mode.keywords = compiled_keywords; + } + mode.lexemesRe = langRe(mode.lexemes || /\b\w+\b/, true); + + if (parent) { + if (mode.beginKeywords) { + mode.begin = '\\b(' + mode.beginKeywords.split(' ').join('|') + ')\\b'; + } + if (!mode.begin) + mode.begin = /\B|\b/; + mode.beginRe = langRe(mode.begin); + if (!mode.end && !mode.endsWithParent) + mode.end = /\B|\b/; + if (mode.end) + mode.endRe = langRe(mode.end); + mode.terminator_end = reStr(mode.end) || ''; + if (mode.endsWithParent && parent.terminator_end) + mode.terminator_end += (mode.end ? '|' : '') + parent.terminator_end; + } + if (mode.illegal) + mode.illegalRe = langRe(mode.illegal); + if (mode.relevance === undefined) + mode.relevance = 1; + if (!mode.contains) { + mode.contains = []; + } + var expanded_contains = []; + mode.contains.forEach(function(c) { + if (c.variants) { + c.variants.forEach(function(v) {expanded_contains.push(inherit(c, v));}); + } else { + expanded_contains.push(c == 'self' ? mode : c); + } + }); + mode.contains = expanded_contains; + mode.contains.forEach(function(c) {compileMode(c, mode);}); + + if (mode.starts) { + compileMode(mode.starts, parent); + } + + var terminators = + mode.contains.map(function(c) { + return c.beginKeywords ? '\\.?(' + c.begin + ')\\.?' : c.begin; + }) + .concat([mode.terminator_end, mode.illegal]) + .map(reStr) + .filter(Boolean); + mode.terminators = terminators.length ? langRe(terminators.join('|'), true) : {exec: function(/*s*/) {return null;}}; + } + + compileMode(language); + } + + /* + Core highlighting function. Accepts a language name, or an alias, and a + string with the code to highlight. Returns an object with the following + properties: + + - relevance (int) + - value (an HTML string with highlighting markup) + + */ + function highlight(name, value, ignore_illegals, continuation) { + + function subMode(lexeme, mode) { + for (var i = 0; i < mode.contains.length; i++) { + if (testRe(mode.contains[i].beginRe, lexeme)) { + return mode.contains[i]; + } + } + } + + function endOfMode(mode, lexeme) { + if (testRe(mode.endRe, lexeme)) { + while (mode.endsParent && mode.parent) { + mode = mode.parent; + } + return mode; + } + if (mode.endsWithParent) { + return endOfMode(mode.parent, lexeme); + } + } + + function isIllegal(lexeme, mode) { + return !ignore_illegals && testRe(mode.illegalRe, lexeme); + } + + function keywordMatch(mode, match) { + var match_str = language.case_insensitive ? match[0].toLowerCase() : match[0]; + return mode.keywords.hasOwnProperty(match_str) && mode.keywords[match_str]; + } + + function buildSpan(classname, insideSpan, leaveOpen, noPrefix) { + var classPrefix = noPrefix ? '' : options.classPrefix, + openSpan = ''; + + return openSpan + insideSpan + closeSpan; + } + + function processKeywords() { + if (!top.keywords) + return escape(mode_buffer); + var result = ''; + var last_index = 0; + top.lexemesRe.lastIndex = 0; + var match = top.lexemesRe.exec(mode_buffer); + while (match) { + result += escape(mode_buffer.substr(last_index, match.index - last_index)); + var keyword_match = keywordMatch(top, match); + if (keyword_match) { + relevance += keyword_match[1]; + result += buildSpan(keyword_match[0], escape(match[0])); + } else { + result += escape(match[0]); + } + last_index = top.lexemesRe.lastIndex; + match = top.lexemesRe.exec(mode_buffer); + } + return result + escape(mode_buffer.substr(last_index)); + } + + function processSubLanguage() { + var explicit = typeof top.subLanguage == 'string'; + if (explicit && !languages[top.subLanguage]) { + return escape(mode_buffer); + } + + var result = explicit ? + highlight(top.subLanguage, mode_buffer, true, continuations[top.subLanguage]) : + highlightAuto(mode_buffer, top.subLanguage.length ? top.subLanguage : undefined); + + // Counting embedded language score towards the host language may be disabled + // with zeroing the containing mode relevance. Usecase in point is Markdown that + // allows XML everywhere and makes every XML snippet to have a much larger Markdown + // score. + if (top.relevance > 0) { + relevance += result.relevance; + } + if (explicit) { + continuations[top.subLanguage] = result.top; + } + return buildSpan(result.language, result.value, false, true); + } + + function processBuffer() { + return top.subLanguage !== undefined ? processSubLanguage() : processKeywords(); + } + + function startNewMode(mode, lexeme) { + var markup = mode.className? buildSpan(mode.className, '', true): ''; + if (mode.returnBegin) { + result += markup; + mode_buffer = ''; + } else if (mode.excludeBegin) { + result += escape(lexeme) + markup; + mode_buffer = ''; + } else { + result += markup; + mode_buffer = lexeme; + } + top = Object.create(mode, {parent: {value: top}}); + } + + function processLexeme(buffer, lexeme) { + + mode_buffer += buffer; + if (lexeme === undefined) { + result += processBuffer(); + return 0; + } + + var new_mode = subMode(lexeme, top); + if (new_mode) { + result += processBuffer(); + startNewMode(new_mode, lexeme); + return new_mode.returnBegin ? 0 : lexeme.length; + } + + var end_mode = endOfMode(top, lexeme); + if (end_mode) { + var origin = top; + if (!(origin.returnEnd || origin.excludeEnd)) { + mode_buffer += lexeme; + } + result += processBuffer(); + do { + if (top.className) { + result += ''; + } + relevance += top.relevance; + top = top.parent; + } while (top != end_mode.parent); + if (origin.excludeEnd) { + result += escape(lexeme); + } + mode_buffer = ''; + if (end_mode.starts) { + startNewMode(end_mode.starts, ''); + } + return origin.returnEnd ? 0 : lexeme.length; + } + + if (isIllegal(lexeme, top)) + throw new Error('Illegal lexeme "' + lexeme + '" for mode "' + (top.className || '') + '"'); + + /* + Parser should not reach this point as all types of lexemes should be caught + earlier, but if it does due to some bug make sure it advances at least one + character forward to prevent infinite looping. + */ + mode_buffer += lexeme; + return lexeme.length || 1; + } + + var language = getLanguage(name); + if (!language) { + throw new Error('Unknown language: "' + name + '"'); + } + + compileLanguage(language); + var top = continuation || language; + var continuations = {}; // keep continuations for sub-languages + var result = '', current; + for(current = top; current != language; current = current.parent) { + if (current.className) { + result = buildSpan(current.className, '', true) + result; + } + } + var mode_buffer = ''; + var relevance = 0; + try { + var match, count, index = 0; + while (true) { + top.terminators.lastIndex = index; + match = top.terminators.exec(value); + if (!match) + break; + count = processLexeme(value.substr(index, match.index - index), match[0]); + index = match.index + count; + } + processLexeme(value.substr(index)); + for(current = top; current.parent; current = current.parent) { // close dangling modes + if (current.className) { + result += ''; + } + } + return { + relevance: relevance, + value: result, + language: name, + top: top + }; + } catch (e) { + if (e.message.indexOf('Illegal') != -1) { + return { + relevance: 0, + value: escape(value) + }; + } else { + throw e; + } + } + } + + /* + Highlighting with language detection. Accepts a string with the code to + highlight. Returns an object with the following properties: + + - language (detected language) + - relevance (int) + - value (an HTML string with highlighting markup) + - second_best (object with the same structure for second-best heuristically + detected language, may be absent) + + */ + function highlightAuto(text, languageSubset) { + languageSubset = languageSubset || options.languages || Object.keys(languages); + var result = { + relevance: 0, + value: escape(text) + }; + var second_best = result; + languageSubset.forEach(function(name) { + if (!getLanguage(name)) { + return; + } + var current = highlight(name, text, false); + current.language = name; + if (current.relevance > second_best.relevance) { + second_best = current; + } + if (current.relevance > result.relevance) { + second_best = result; + result = current; + } + }); + if (second_best.language) { + result.second_best = second_best; + } + return result; + } + + /* + Post-processing of the highlighted markup: + + - replace TABs with something more useful + - replace real line-breaks with '
          ' for non-pre containers + + */ + function fixMarkup(value) { + if (options.tabReplace) { + value = value.replace(/^((<[^>]+>|\t)+)/gm, function(match, p1 /*..., offset, s*/) { + return p1.replace(/\t/g, options.tabReplace); + }); + } + if (options.useBR) { + value = value.replace(/\n/g, '
          '); + } + return value; + } + + function buildClassName(prevClassName, currentLang, resultLang) { + var language = currentLang ? aliases[currentLang] : resultLang, + result = [prevClassName.trim()]; + + if (!prevClassName.match(/\bhljs\b/)) { + result.push('hljs'); + } + + if (prevClassName.indexOf(language) === -1) { + result.push(language); + } + + return result.join(' ').trim(); + } + + /* + Applies highlighting to a DOM node containing code. Accepts a DOM node and + two optional parameters for fixMarkup. + */ + function highlightBlock(block) { + var language = blockLanguage(block); + if (isNotHighlighted(language)) + return; + + var node; + if (options.useBR) { + node = document.createElementNS('http://www.w3.org/1999/xhtml', 'div'); + node.innerHTML = block.innerHTML.replace(/\n/g, '').replace(//g, '\n'); + } else { + node = block; + } + var text = node.textContent; + var result = language ? highlight(language, text, true) : highlightAuto(text); + + var originalStream = nodeStream(node); + if (originalStream.length) { + var resultNode = document.createElementNS('http://www.w3.org/1999/xhtml', 'div'); + resultNode.innerHTML = result.value; + result.value = mergeStreams(originalStream, nodeStream(resultNode), text); + } + result.value = fixMarkup(result.value); + + block.innerHTML = result.value; + block.className = buildClassName(block.className, language, result.language); + block.result = { + language: result.language, + re: result.relevance + }; + if (result.second_best) { + block.second_best = { + language: result.second_best.language, + re: result.second_best.relevance + }; + } + } + + var options = { + classPrefix: 'hljs-', + tabReplace: null, + useBR: false, + languages: undefined + }; + + /* + Updates highlight.js global options with values passed in the form of an object + */ + function configure(user_options) { + options = inherit(options, user_options); + } + + /* + Applies highlighting to all
          ..
          blocks on a page. + */ + function initHighlighting() { + if (initHighlighting.called) + return; + initHighlighting.called = true; + + var blocks = document.querySelectorAll('pre code'); + Array.prototype.forEach.call(blocks, highlightBlock); + } + + /* + Attaches highlighting to the page load event. + */ + function initHighlightingOnLoad() { + addEventListener('DOMContentLoaded', initHighlighting, false); + addEventListener('load', initHighlighting, false); + } + + var languages = {}; + var aliases = {}; + + function registerLanguage(name, language) { + var lang = languages[name] = language(hljs); + if (lang.aliases) { + lang.aliases.forEach(function(alias) {aliases[alias] = name;}); + } + } + + function listLanguages() { + return Object.keys(languages); + } + + function getLanguage(name) { + name = (name || '').toLowerCase(); + return languages[name] || languages[aliases[name]]; + } + + /* Interface definition */ + + hljs.highlight = highlight; + hljs.highlightAuto = highlightAuto; + hljs.fixMarkup = fixMarkup; + hljs.highlightBlock = highlightBlock; + hljs.configure = configure; + hljs.initHighlighting = initHighlighting; + hljs.initHighlightingOnLoad = initHighlightingOnLoad; + hljs.registerLanguage = registerLanguage; + hljs.listLanguages = listLanguages; + hljs.getLanguage = getLanguage; + hljs.inherit = inherit; + + // Common regexps + hljs.IDENT_RE = '[a-zA-Z]\\w*'; + hljs.UNDERSCORE_IDENT_RE = '[a-zA-Z_]\\w*'; + hljs.NUMBER_RE = '\\b\\d+(\\.\\d+)?'; + hljs.C_NUMBER_RE = '(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)'; // 0x..., 0..., decimal, float + hljs.BINARY_NUMBER_RE = '\\b(0b[01]+)'; // 0b... + hljs.RE_STARTERS_RE = '!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~'; + + // Common modes + hljs.BACKSLASH_ESCAPE = { + begin: '\\\\[\\s\\S]', relevance: 0 + }; + hljs.APOS_STRING_MODE = { + className: 'string', + begin: '\'', end: '\'', + illegal: '\\n', + contains: [hljs.BACKSLASH_ESCAPE] + }; + hljs.QUOTE_STRING_MODE = { + className: 'string', + begin: '"', end: '"', + illegal: '\\n', + contains: [hljs.BACKSLASH_ESCAPE] + }; + hljs.PHRASAL_WORDS_MODE = { + begin: /\b(a|an|the|are|I|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|like)\b/ + }; + hljs.COMMENT = function (begin, end, inherits) { + var mode = hljs.inherit( + { + className: 'comment', + begin: begin, end: end, + contains: [] + }, + inherits || {} + ); + mode.contains.push(hljs.PHRASAL_WORDS_MODE); + mode.contains.push({ + className: 'doctag', + begin: "(?:TODO|FIXME|NOTE|BUG|XXX):", + relevance: 0 + }); + return mode; + }; + hljs.C_LINE_COMMENT_MODE = hljs.COMMENT('//', '$'); + hljs.C_BLOCK_COMMENT_MODE = hljs.COMMENT('/\\*', '\\*/'); + hljs.HASH_COMMENT_MODE = hljs.COMMENT('#', '$'); + hljs.NUMBER_MODE = { + className: 'number', + begin: hljs.NUMBER_RE, + relevance: 0 + }; + hljs.C_NUMBER_MODE = { + className: 'number', + begin: hljs.C_NUMBER_RE, + relevance: 0 + }; + hljs.BINARY_NUMBER_MODE = { + className: 'number', + begin: hljs.BINARY_NUMBER_RE, + relevance: 0 + }; + hljs.CSS_NUMBER_MODE = { + className: 'number', + begin: hljs.NUMBER_RE + '(' + + '%|em|ex|ch|rem' + + '|vw|vh|vmin|vmax' + + '|cm|mm|in|pt|pc|px' + + '|deg|grad|rad|turn' + + '|s|ms' + + '|Hz|kHz' + + '|dpi|dpcm|dppx' + + ')?', + relevance: 0 + }; + hljs.REGEXP_MODE = { + className: 'regexp', + begin: /\//, end: /\/[gimuy]*/, + illegal: /\n/, + contains: [ + hljs.BACKSLASH_ESCAPE, + { + begin: /\[/, end: /\]/, + relevance: 0, + contains: [hljs.BACKSLASH_ESCAPE] + } + ] + }; + hljs.TITLE_MODE = { + className: 'title', + begin: hljs.IDENT_RE, + relevance: 0 + }; + hljs.UNDERSCORE_TITLE_MODE = { + className: 'title', + begin: hljs.UNDERSCORE_IDENT_RE, + relevance: 0 + }; + +hljs.registerLanguage('1c', function(hljs){ + var IDENT_RE_RU = '[a-zA-Zа-яА-Я][a-zA-Z0-9_а-яА-Я]*'; + var OneS_KEYWORDS = 'возврат дата для если и или иначе иначеесли исключение конецесли ' + + 'конецпопытки конецпроцедуры конецфункции конеццикла константа не перейти перем ' + + 'перечисление по пока попытка прервать продолжить процедура строка тогда фс функция цикл ' + + 'число экспорт'; + var OneS_BUILT_IN = 'ansitooem oemtoansi ввестивидсубконто ввестидату ввестизначение ' + + 'ввестиперечисление ввестипериод ввестиплансчетов ввестистроку ввестичисло вопрос ' + + 'восстановитьзначение врег выбранныйплансчетов вызватьисключение датагод датамесяц ' + + 'датачисло добавитьмесяц завершитьработусистемы заголовоксистемы записьжурналарегистрации ' + + 'запуститьприложение зафиксироватьтранзакцию значениевстроку значениевстрокувнутр ' + + 'значениевфайл значениеизстроки значениеизстрокивнутр значениеизфайла имякомпьютера ' + + 'имяпользователя каталогвременныхфайлов каталогиб каталогпользователя каталогпрограммы ' + + 'кодсимв командасистемы конгода конецпериодаби конецрассчитанногопериодаби ' + + 'конецстандартногоинтервала конквартала конмесяца коннедели лев лог лог10 макс ' + + 'максимальноеколичествосубконто мин монопольныйрежим названиеинтерфейса названиенабораправ ' + + 'назначитьвид назначитьсчет найти найтипомеченныенаудаление найтиссылки началопериодаби ' + + 'началостандартногоинтервала начатьтранзакцию начгода начквартала начмесяца начнедели ' + + 'номерднягода номерднянедели номернеделигода нрег обработкаожидания окр описаниеошибки ' + + 'основнойжурналрасчетов основнойплансчетов основнойязык открытьформу открытьформумодально ' + + 'отменитьтранзакцию очиститьокносообщений периодстр полноеимяпользователя получитьвремята ' + + 'получитьдатута получитьдокументта получитьзначенияотбора получитьпозициюта ' + + 'получитьпустоезначение получитьта прав праводоступа предупреждение префиксавтонумерации ' + + 'пустаястрока пустоезначение рабочаядаттьпустоезначение рабочаядата разделительстраниц ' + + 'разделительстрок разм разобратьпозициюдокумента рассчитатьрегистрына ' + + 'рассчитатьрегистрыпо сигнал симв символтабуляции создатьобъект сокрл сокрлп сокрп ' + + 'сообщить состояние сохранитьзначение сред статусвозврата стрдлина стрзаменить ' + + 'стрколичествострок стрполучитьстроку стрчисловхождений сформироватьпозициюдокумента ' + + 'счетпокоду текущаядата текущеевремя типзначения типзначениястр удалитьобъекты ' + + 'установитьтана установитьтапо фиксшаблон формат цел шаблон'; + var DQUOTE = {className: 'dquote', begin: '""'}; + var STR_START = { + className: 'string', + begin: '"', end: '"|$', + contains: [DQUOTE] + }; + var STR_CONT = { + className: 'string', + begin: '\\|', end: '"|$', + contains: [DQUOTE] + }; + + return { + case_insensitive: true, + lexemes: IDENT_RE_RU, + keywords: {keyword: OneS_KEYWORDS, built_in: OneS_BUILT_IN}, + contains: [ + hljs.C_LINE_COMMENT_MODE, + hljs.NUMBER_MODE, + STR_START, STR_CONT, + { + className: 'function', + begin: '(процедура|функция)', end: '$', + lexemes: IDENT_RE_RU, + keywords: 'процедура функция', + contains: [ + hljs.inherit(hljs.TITLE_MODE, {begin: IDENT_RE_RU}), + { + className: 'tail', + endsWithParent: true, + contains: [ + { + className: 'params', + begin: '\\(', end: '\\)', + lexemes: IDENT_RE_RU, + keywords: 'знач', + contains: [STR_START, STR_CONT] + }, + { + className: 'export', + begin: 'экспорт', endsWithParent: true, + lexemes: IDENT_RE_RU, + keywords: 'экспорт', + contains: [hljs.C_LINE_COMMENT_MODE] + } + ] + }, + hljs.C_LINE_COMMENT_MODE + ] + }, + {className: 'preprocessor', begin: '#', end: '$'}, + {className: 'date', begin: '\'\\d{2}\\.\\d{2}\\.(\\d{2}|\\d{4})\''} + ] + }; +}); + +hljs.registerLanguage('accesslog', function(hljs) { + return { + contains: [ + // IP + { + className: 'number', + begin: '\\b\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}(:\\d{1,5})?\\b' + }, + // Other numbers + { + className: 'number', + begin: '\\b\\d+\\b', + relevance: 0 + }, + // Requests + { + className: 'string', + begin: '"(GET|POST|HEAD|PUT|DELETE|CONNECT|OPTIONS|PATCH|TRACE)', end: '"', + keywords: 'GET POST HEAD PUT DELETE CONNECT OPTIONS PATCH TRACE', + illegal: '\\n', + relevance: 10 + }, + // Dates + { + className: 'string', + begin: /\[/, end: /\]/, + illegal: '\\n' + }, + // Strings + { + className: 'string', + begin: '"', end: '"', + illegal: '\\n' + } + ] + }; +}); + +hljs.registerLanguage('actionscript', function(hljs) { + var IDENT_RE = '[a-zA-Z_$][a-zA-Z0-9_$]*'; + var IDENT_FUNC_RETURN_TYPE_RE = '([*]|[a-zA-Z_$][a-zA-Z0-9_$]*)'; + + var AS3_REST_ARG_MODE = { + className: 'rest_arg', + begin: '[.]{3}', end: IDENT_RE, + relevance: 10 + }; + + return { + aliases: ['as'], + keywords: { + keyword: 'as break case catch class const continue default delete do dynamic each ' + + 'else extends final finally for function get if implements import in include ' + + 'instanceof interface internal is namespace native new override package private ' + + 'protected public return set static super switch this throw try typeof use var void ' + + 'while with', + literal: 'true false null undefined' + }, + contains: [ + hljs.APOS_STRING_MODE, + hljs.QUOTE_STRING_MODE, + hljs.C_LINE_COMMENT_MODE, + hljs.C_BLOCK_COMMENT_MODE, + hljs.C_NUMBER_MODE, + { + className: 'package', + beginKeywords: 'package', end: '{', + contains: [hljs.TITLE_MODE] + }, + { + className: 'class', + beginKeywords: 'class interface', end: '{', excludeEnd: true, + contains: [ + { + beginKeywords: 'extends implements' + }, + hljs.TITLE_MODE + ] + }, + { + className: 'preprocessor', + beginKeywords: 'import include', end: ';' + }, + { + className: 'function', + beginKeywords: 'function', end: '[{;]', excludeEnd: true, + illegal: '\\S', + contains: [ + hljs.TITLE_MODE, + { + className: 'params', + begin: '\\(', end: '\\)', + contains: [ + hljs.APOS_STRING_MODE, + hljs.QUOTE_STRING_MODE, + hljs.C_LINE_COMMENT_MODE, + hljs.C_BLOCK_COMMENT_MODE, + AS3_REST_ARG_MODE + ] + }, + { + className: 'type', + begin: ':', + end: IDENT_FUNC_RETURN_TYPE_RE, + relevance: 10 + } + ] + } + ], + illegal: /#/ + }; +}); + +hljs.registerLanguage('apache', function(hljs) { + var NUMBER = {className: 'number', begin: '[\\$%]\\d+'}; + return { + aliases: ['apacheconf'], + case_insensitive: true, + contains: [ + hljs.HASH_COMMENT_MODE, + {className: 'tag', begin: ''}, + { + className: 'keyword', + begin: /\w+/, + relevance: 0, + // keywords aren’t needed for highlighting per se, they only boost relevance + // for a very generally defined mode (starts with a word, ends with line-end + keywords: { + common: + 'order deny allow setenv rewriterule rewriteengine rewritecond documentroot ' + + 'sethandler errordocument loadmodule options header listen serverroot ' + + 'servername' + }, + starts: { + end: /$/, + relevance: 0, + keywords: { + literal: 'on off all' + }, + contains: [ + { + className: 'sqbracket', + begin: '\\s\\[', end: '\\]$' + }, + { + className: 'cbracket', + begin: '[\\$%]\\{', end: '\\}', + contains: ['self', NUMBER] + }, + NUMBER, + hljs.QUOTE_STRING_MODE + ] + } + } + ], + illegal: /\S/ + }; +}); + +hljs.registerLanguage('applescript', function(hljs) { + var STRING = hljs.inherit(hljs.QUOTE_STRING_MODE, {illegal: ''}); + var PARAMS = { + className: 'params', + begin: '\\(', end: '\\)', + contains: ['self', hljs.C_NUMBER_MODE, STRING] + }; + var COMMENT_MODE_1 = hljs.COMMENT('--', '$'); + var COMMENT_MODE_2 = hljs.COMMENT( + '\\(\\*', + '\\*\\)', + { + contains: ['self', COMMENT_MODE_1] //allow nesting + } + ); + var COMMENTS = [ + COMMENT_MODE_1, + COMMENT_MODE_2, + hljs.HASH_COMMENT_MODE + ]; + + return { + aliases: ['osascript'], + keywords: { + keyword: + 'about above after against and around as at back before beginning ' + + 'behind below beneath beside between but by considering ' + + 'contain contains continue copy div does eighth else end equal ' + + 'equals error every exit fifth first for fourth from front ' + + 'get given global if ignoring in into is it its last local me ' + + 'middle mod my ninth not of on onto or over prop property put ref ' + + 'reference repeat returning script second set seventh since ' + + 'sixth some tell tenth that the|0 then third through thru ' + + 'timeout times to transaction try until where while whose with ' + + 'without', + constant: + 'AppleScript false linefeed return pi quote result space tab true', + type: + 'alias application boolean class constant date file integer list ' + + 'number real record string text', + command: + 'activate beep count delay launch log offset read round ' + + 'run say summarize write', + property: + 'character characters contents day frontmost id item length ' + + 'month name paragraph paragraphs rest reverse running time version ' + + 'weekday word words year' + }, + contains: [ + STRING, + hljs.C_NUMBER_MODE, + { + className: 'type', + begin: '\\bPOSIX file\\b' + }, + { + className: 'command', + begin: + '\\b(clipboard info|the clipboard|info for|list (disks|folder)|' + + 'mount volume|path to|(close|open for) access|(get|set) eof|' + + 'current date|do shell script|get volume settings|random number|' + + 'set volume|system attribute|system info|time to GMT|' + + '(load|run|store) script|scripting components|' + + 'ASCII (character|number)|localized string|' + + 'choose (application|color|file|file name|' + + 'folder|from list|remote application|URL)|' + + 'display (alert|dialog))\\b|^\\s*return\\b' + }, + { + className: 'constant', + begin: + '\\b(text item delimiters|current application|missing value)\\b' + }, + { + className: 'keyword', + begin: + '\\b(apart from|aside from|instead of|out of|greater than|' + + "isn't|(doesn't|does not) (equal|come before|come after|contain)|" + + '(greater|less) than( or equal)?|(starts?|ends|begins?) with|' + + 'contained by|comes (before|after)|a (ref|reference))\\b' + }, + { + className: 'property', + begin: + '\\b(POSIX path|(date|time) string|quoted form)\\b' + }, + { + className: 'function_start', + beginKeywords: 'on', + illegal: '[${=;\\n]', + contains: [hljs.UNDERSCORE_TITLE_MODE, PARAMS] + } + ].concat(COMMENTS), + illegal: '//|->|=>|\\[\\[' + }; +}); + +hljs.registerLanguage('armasm', function(hljs) { + //local labels: %?[FB]?[AT]?\d{1,2}\w+ + return { + case_insensitive: true, + aliases: ['arm'], + lexemes: '\\.?' + hljs.IDENT_RE, + keywords: { + literal: + 'r0 r1 r2 r3 r4 r5 r6 r7 r8 r9 r10 r11 r12 r13 r14 r15 '+ //standard registers + 'pc lr sp ip sl sb fp '+ //typical regs plus backward compatibility + 'a1 a2 a3 a4 v1 v2 v3 v4 v5 v6 v7 v8 f0 f1 f2 f3 f4 f5 f6 f7 '+ //more regs and fp + 'p0 p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 p11 p12 p13 p14 p15 '+ //coprocessor regs + 'c0 c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 '+ //more coproc + 'q0 q1 q2 q3 q4 q5 q6 q7 q8 q9 q10 q11 q12 q13 q14 q15 '+ //advanced SIMD NEON regs + + //program status registers + 'cpsr_c cpsr_x cpsr_s cpsr_f cpsr_cx cpsr_cxs cpsr_xs cpsr_xsf cpsr_sf cpsr_cxsf '+ + 'spsr_c spsr_x spsr_s spsr_f spsr_cx spsr_cxs spsr_xs spsr_xsf spsr_sf spsr_cxsf '+ + + //NEON and VFP registers + 's0 s1 s2 s3 s4 s5 s6 s7 s8 s9 s10 s11 s12 s13 s14 s15 '+ + 's16 s17 s18 s19 s20 s21 s22 s23 s24 s25 s26 s27 s28 s29 s30 s31 '+ + 'd0 d1 d2 d3 d4 d5 d6 d7 d8 d9 d10 d11 d12 d13 d14 d15 '+ + 'd16 d17 d18 d19 d20 d21 d22 d23 d24 d25 d26 d27 d28 d29 d30 d31 ', + preprocessor: + //GNU preprocs + '.2byte .4byte .align .ascii .asciz .balign .byte .code .data .else .end .endif .endm .endr .equ .err .exitm .extern .global .hword .if .ifdef .ifndef .include .irp .long .macro .rept .req .section .set .skip .space .text .word .arm .thumb .code16 .code32 .force_thumb .thumb_func .ltorg '+ + //ARM directives + 'ALIAS ALIGN ARM AREA ASSERT ATTR CN CODE CODE16 CODE32 COMMON CP DATA DCB DCD DCDU DCDO DCFD DCFDU DCI DCQ DCQU DCW DCWU DN ELIF ELSE END ENDFUNC ENDIF ENDP ENTRY EQU EXPORT EXPORTAS EXTERN FIELD FILL FUNCTION GBLA GBLL GBLS GET GLOBAL IF IMPORT INCBIN INCLUDE INFO KEEP LCLA LCLL LCLS LTORG MACRO MAP MEND MEXIT NOFP OPT PRESERVE8 PROC QN READONLY RELOC REQUIRE REQUIRE8 RLIST FN ROUT SETA SETL SETS SN SPACE SUBT THUMB THUMBX TTL WHILE WEND ', + built_in: + '{PC} {VAR} {TRUE} {FALSE} {OPT} {CONFIG} {ENDIAN} {CODESIZE} {CPU} {FPU} {ARCHITECTURE} {PCSTOREOFFSET} {ARMASM_VERSION} {INTER} {ROPI} {RWPI} {SWST} {NOSWST} . @ ' + }, + contains: [ + { + className: 'keyword', + begin: '\\b('+ //mnemonics + 'adc|'+ + '(qd?|sh?|u[qh]?)?add(8|16)?|usada?8|(q|sh?|u[qh]?)?(as|sa)x|'+ + 'and|adrl?|sbc|rs[bc]|asr|b[lx]?|blx|bxj|cbn?z|tb[bh]|bic|'+ + 'bfc|bfi|[su]bfx|bkpt|cdp2?|clz|clrex|cmp|cmn|cpsi[ed]|cps|'+ + 'setend|dbg|dmb|dsb|eor|isb|it[te]{0,3}|lsl|lsr|ror|rrx|'+ + 'ldm(([id][ab])|f[ds])?|ldr((s|ex)?[bhd])?|movt?|mvn|mra|mar|'+ + 'mul|[us]mull|smul[bwt][bt]|smu[as]d|smmul|smmla|'+ + 'mla|umlaal|smlal?([wbt][bt]|d)|mls|smlsl?[ds]|smc|svc|sev|'+ + 'mia([bt]{2}|ph)?|mrr?c2?|mcrr2?|mrs|msr|orr|orn|pkh(tb|bt)|rbit|'+ + 'rev(16|sh)?|sel|[su]sat(16)?|nop|pop|push|rfe([id][ab])?|'+ + 'stm([id][ab])?|str(ex)?[bhd]?|(qd?)?sub|(sh?|q|u[qh]?)?sub(8|16)|'+ + '[su]xt(a?h|a?b(16)?)|srs([id][ab])?|swpb?|swi|smi|tst|teq|'+ + 'wfe|wfi|yield'+ + ')'+ + '(eq|ne|cs|cc|mi|pl|vs|vc|hi|ls|ge|lt|gt|le|al|hs|lo)?'+ //condition codes + '[sptrx]?' , //legal postfixes + end: '\\s' + }, + hljs.COMMENT('[;@]', '$', {relevance: 0}), + hljs.C_BLOCK_COMMENT_MODE, + hljs.QUOTE_STRING_MODE, + { + className: 'string', + begin: '\'', + end: '[^\\\\]\'', + relevance: 0 + }, + { + className: 'title', + begin: '\\|', end: '\\|', + illegal: '\\n', + relevance: 0 + }, + { + className: 'number', + variants: [ + {begin: '[#$=]?0x[0-9a-f]+'}, //hex + {begin: '[#$=]?0b[01]+'}, //bin + {begin: '[#$=]\\d+'}, //literal + {begin: '\\b\\d+'} //bare number + ], + relevance: 0 + }, + { + className: 'label', + variants: [ + {begin: '^[a-z_\\.\\$][a-z0-9_\\.\\$]+'}, //ARM syntax + {begin: '^\\s*[a-z_\\.\\$][a-z0-9_\\.\\$]+:'}, //GNU ARM syntax + {begin: '[=#]\\w+' } //label reference + ], + relevance: 0 + } + ] + }; +}); + +hljs.registerLanguage('xml', function(hljs) { + var XML_IDENT_RE = '[A-Za-z0-9\\._:-]+'; + var PHP = { + begin: /<\?(php)?(?!\w)/, end: /\?>/, + subLanguage: 'php' + }; + var TAG_INTERNALS = { + endsWithParent: true, + illegal: /]+/} + ] + } + ] + } + ] + }; + return { + aliases: ['html', 'xhtml', 'rss', 'atom', 'xsl', 'plist'], + case_insensitive: true, + contains: [ + { + className: 'doctype', + begin: '', + relevance: 10, + contains: [{begin: '\\[', end: '\\]'}] + }, + hljs.COMMENT( + '', + { + relevance: 10 + } + ), + { + className: 'cdata', + begin: '<\\!\\[CDATA\\[', end: '\\]\\]>', + relevance: 10 + }, + { + className: 'tag', + /* + The lookahead pattern (?=...) ensures that 'begin' only matches + '|$)', end: '>', + keywords: {title: 'style'}, + contains: [TAG_INTERNALS], + starts: { + end: '', returnEnd: true, + subLanguage: 'css' + } + }, + { + className: 'tag', + // See the comment in the " ).appendTo( body ); + } + + if(o.opacity) { // opacity option + if (this.helper.css("opacity")) { + this._storedOpacity = this.helper.css("opacity"); + } + this.helper.css("opacity", o.opacity); + } + + if(o.zIndex) { // zIndex option + if (this.helper.css("zIndex")) { + this._storedZIndex = this.helper.css("zIndex"); + } + this.helper.css("zIndex", o.zIndex); + } + + //Prepare scrolling + if(this.scrollParent[0] !== this.document[0] && this.scrollParent[0].tagName !== "HTML") { + this.overflowOffset = this.scrollParent.offset(); + } + + //Call callbacks + this._trigger("start", event, this._uiHash()); + + //Recache the helper size + if(!this._preserveHelperProportions) { + this._cacheHelperProportions(); + } + + + //Post "activate" events to possible containers + if( !noActivation ) { + for ( i = this.containers.length - 1; i >= 0; i-- ) { + this.containers[ i ]._trigger( "activate", event, this._uiHash( this ) ); + } + } + + //Prepare possible droppables + if($.ui.ddmanager) { + $.ui.ddmanager.current = this; + } + + if ($.ui.ddmanager && !o.dropBehaviour) { + $.ui.ddmanager.prepareOffsets(this, event); + } + + this.dragging = true; + + this.helper.addClass("ui-sortable-helper"); + this._mouseDrag(event); //Execute the drag once - this causes the helper not to be visible before getting its correct position + return true; + + }, + + _mouseDrag: function(event) { + var i, item, itemElement, intersection, + o = this.options, + scrolled = false; + + //Compute the helpers position + this.position = this._generatePosition(event); + this.positionAbs = this._convertPositionTo("absolute"); + + if (!this.lastPositionAbs) { + this.lastPositionAbs = this.positionAbs; + } + + //Do scrolling + if(this.options.scroll) { + if(this.scrollParent[0] !== this.document[0] && this.scrollParent[0].tagName !== "HTML") { + + if((this.overflowOffset.top + this.scrollParent[0].offsetHeight) - event.pageY < o.scrollSensitivity) { + this.scrollParent[0].scrollTop = scrolled = this.scrollParent[0].scrollTop + o.scrollSpeed; + } else if(event.pageY - this.overflowOffset.top < o.scrollSensitivity) { + this.scrollParent[0].scrollTop = scrolled = this.scrollParent[0].scrollTop - o.scrollSpeed; + } + + if((this.overflowOffset.left + this.scrollParent[0].offsetWidth) - event.pageX < o.scrollSensitivity) { + this.scrollParent[0].scrollLeft = scrolled = this.scrollParent[0].scrollLeft + o.scrollSpeed; + } else if(event.pageX - this.overflowOffset.left < o.scrollSensitivity) { + this.scrollParent[0].scrollLeft = scrolled = this.scrollParent[0].scrollLeft - o.scrollSpeed; + } + + } else { + + if(event.pageY - this.document.scrollTop() < o.scrollSensitivity) { + scrolled = this.document.scrollTop(this.document.scrollTop() - o.scrollSpeed); + } else if(this.window.height() - (event.pageY - this.document.scrollTop()) < o.scrollSensitivity) { + scrolled = this.document.scrollTop(this.document.scrollTop() + o.scrollSpeed); + } + + if(event.pageX - this.document.scrollLeft() < o.scrollSensitivity) { + scrolled = this.document.scrollLeft(this.document.scrollLeft() - o.scrollSpeed); + } else if(this.window.width() - (event.pageX - this.document.scrollLeft()) < o.scrollSensitivity) { + scrolled = this.document.scrollLeft(this.document.scrollLeft() + o.scrollSpeed); + } + + } + + if(scrolled !== false && $.ui.ddmanager && !o.dropBehaviour) { + $.ui.ddmanager.prepareOffsets(this, event); + } + } + + //Regenerate the absolute position used for position checks + this.positionAbs = this._convertPositionTo("absolute"); + + //Set the helper position + if(!this.options.axis || this.options.axis !== "y") { + this.helper[0].style.left = this.position.left+"px"; + } + if(!this.options.axis || this.options.axis !== "x") { + this.helper[0].style.top = this.position.top+"px"; + } + + //Rearrange + for (i = this.items.length - 1; i >= 0; i--) { + + //Cache variables and intersection, continue if no intersection + item = this.items[i]; + itemElement = item.item[0]; + intersection = this._intersectsWithPointer(item); + if (!intersection) { + continue; + } + + // Only put the placeholder inside the current Container, skip all + // items from other containers. This works because when moving + // an item from one container to another the + // currentContainer is switched before the placeholder is moved. + // + // Without this, moving items in "sub-sortables" can cause + // the placeholder to jitter between the outer and inner container. + if (item.instance !== this.currentContainer) { + continue; + } + + // cannot intersect with itself + // no useless actions that have been done before + // no action if the item moved is the parent of the item checked + if (itemElement !== this.currentItem[0] && + this.placeholder[intersection === 1 ? "next" : "prev"]()[0] !== itemElement && + !$.contains(this.placeholder[0], itemElement) && + (this.options.type === "semi-dynamic" ? !$.contains(this.element[0], itemElement) : true) + ) { + + this.direction = intersection === 1 ? "down" : "up"; + + if (this.options.tolerance === "pointer" || this._intersectsWithSides(item)) { + this._rearrange(event, item); + } else { + break; + } + + this._trigger("change", event, this._uiHash()); + break; + } + } + + //Post events to containers + this._contactContainers(event); + + //Interconnect with droppables + if($.ui.ddmanager) { + $.ui.ddmanager.drag(this, event); + } + + //Call callbacks + this._trigger("sort", event, this._uiHash()); + + this.lastPositionAbs = this.positionAbs; + return false; + + }, + + _mouseStop: function(event, noPropagation) { + + if(!event) { + return; + } + + //If we are using droppables, inform the manager about the drop + if ($.ui.ddmanager && !this.options.dropBehaviour) { + $.ui.ddmanager.drop(this, event); + } + + if(this.options.revert) { + var that = this, + cur = this.placeholder.offset(), + axis = this.options.axis, + animation = {}; + + if ( !axis || axis === "x" ) { + animation.left = cur.left - this.offset.parent.left - this.margins.left + (this.offsetParent[0] === this.document[0].body ? 0 : this.offsetParent[0].scrollLeft); + } + if ( !axis || axis === "y" ) { + animation.top = cur.top - this.offset.parent.top - this.margins.top + (this.offsetParent[0] === this.document[0].body ? 0 : this.offsetParent[0].scrollTop); + } + this.reverting = true; + $(this.helper).animate( animation, parseInt(this.options.revert, 10) || 500, function() { + that._clear(event); + }); + } else { + this._clear(event, noPropagation); + } + + return false; + + }, + + cancel: function() { + + if(this.dragging) { + + this._mouseUp({ target: null }); + + if(this.options.helper === "original") { + this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper"); + } else { + this.currentItem.show(); + } + + //Post deactivating events to containers + for (var i = this.containers.length - 1; i >= 0; i--){ + this.containers[i]._trigger("deactivate", null, this._uiHash(this)); + if(this.containers[i].containerCache.over) { + this.containers[i]._trigger("out", null, this._uiHash(this)); + this.containers[i].containerCache.over = 0; + } + } + + } + + if (this.placeholder) { + //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, it unbinds ALL events from the original node! + if(this.placeholder[0].parentNode) { + this.placeholder[0].parentNode.removeChild(this.placeholder[0]); + } + if(this.options.helper !== "original" && this.helper && this.helper[0].parentNode) { + this.helper.remove(); + } + + $.extend(this, { + helper: null, + dragging: false, + reverting: false, + _noFinalSort: null + }); + + if(this.domPosition.prev) { + $(this.domPosition.prev).after(this.currentItem); + } else { + $(this.domPosition.parent).prepend(this.currentItem); + } + } + + return this; + + }, + + serialize: function(o) { + + var items = this._getItemsAsjQuery(o && o.connected), + str = []; + o = o || {}; + + $(items).each(function() { + var res = ($(o.item || this).attr(o.attribute || "id") || "").match(o.expression || (/(.+)[\-=_](.+)/)); + if (res) { + str.push((o.key || res[1]+"[]")+"="+(o.key && o.expression ? res[1] : res[2])); + } + }); + + if(!str.length && o.key) { + str.push(o.key + "="); + } + + return str.join("&"); + + }, + + toArray: function(o) { + + var items = this._getItemsAsjQuery(o && o.connected), + ret = []; + + o = o || {}; + + items.each(function() { ret.push($(o.item || this).attr(o.attribute || "id") || ""); }); + return ret; + + }, + + /* Be careful with the following core functions */ + _intersectsWith: function(item) { + + var x1 = this.positionAbs.left, + x2 = x1 + this.helperProportions.width, + y1 = this.positionAbs.top, + y2 = y1 + this.helperProportions.height, + l = item.left, + r = l + item.width, + t = item.top, + b = t + item.height, + dyClick = this.offset.click.top, + dxClick = this.offset.click.left, + isOverElementHeight = ( this.options.axis === "x" ) || ( ( y1 + dyClick ) > t && ( y1 + dyClick ) < b ), + isOverElementWidth = ( this.options.axis === "y" ) || ( ( x1 + dxClick ) > l && ( x1 + dxClick ) < r ), + isOverElement = isOverElementHeight && isOverElementWidth; + + if ( this.options.tolerance === "pointer" || + this.options.forcePointerForContainers || + (this.options.tolerance !== "pointer" && this.helperProportions[this.floating ? "width" : "height"] > item[this.floating ? "width" : "height"]) + ) { + return isOverElement; + } else { + + return (l < x1 + (this.helperProportions.width / 2) && // Right Half + x2 - (this.helperProportions.width / 2) < r && // Left Half + t < y1 + (this.helperProportions.height / 2) && // Bottom Half + y2 - (this.helperProportions.height / 2) < b ); // Top Half + + } + }, + + _intersectsWithPointer: function(item) { + + var isOverElementHeight = (this.options.axis === "x") || this._isOverAxis(this.positionAbs.top + this.offset.click.top, item.top, item.height), + isOverElementWidth = (this.options.axis === "y") || this._isOverAxis(this.positionAbs.left + this.offset.click.left, item.left, item.width), + isOverElement = isOverElementHeight && isOverElementWidth, + verticalDirection = this._getDragVerticalDirection(), + horizontalDirection = this._getDragHorizontalDirection(); + + if (!isOverElement) { + return false; + } + + return this.floating ? + ( ((horizontalDirection && horizontalDirection === "right") || verticalDirection === "down") ? 2 : 1 ) + : ( verticalDirection && (verticalDirection === "down" ? 2 : 1) ); + + }, + + _intersectsWithSides: function(item) { + + var isOverBottomHalf = this._isOverAxis(this.positionAbs.top + this.offset.click.top, item.top + (item.height/2), item.height), + isOverRightHalf = this._isOverAxis(this.positionAbs.left + this.offset.click.left, item.left + (item.width/2), item.width), + verticalDirection = this._getDragVerticalDirection(), + horizontalDirection = this._getDragHorizontalDirection(); + + if (this.floating && horizontalDirection) { + return ((horizontalDirection === "right" && isOverRightHalf) || (horizontalDirection === "left" && !isOverRightHalf)); + } else { + return verticalDirection && ((verticalDirection === "down" && isOverBottomHalf) || (verticalDirection === "up" && !isOverBottomHalf)); + } + + }, + + _getDragVerticalDirection: function() { + var delta = this.positionAbs.top - this.lastPositionAbs.top; + return delta !== 0 && (delta > 0 ? "down" : "up"); + }, + + _getDragHorizontalDirection: function() { + var delta = this.positionAbs.left - this.lastPositionAbs.left; + return delta !== 0 && (delta > 0 ? "right" : "left"); + }, + + refresh: function(event) { + this._refreshItems(event); + this._setHandleClassName(); + this.refreshPositions(); + return this; + }, + + _connectWith: function() { + var options = this.options; + return options.connectWith.constructor === String ? [options.connectWith] : options.connectWith; + }, + + _getItemsAsjQuery: function(connected) { + + var i, j, cur, inst, + items = [], + queries = [], + connectWith = this._connectWith(); + + if(connectWith && connected) { + for (i = connectWith.length - 1; i >= 0; i--){ + cur = $(connectWith[i], this.document[0]); + for ( j = cur.length - 1; j >= 0; j--){ + inst = $.data(cur[j], this.widgetFullName); + if(inst && inst !== this && !inst.options.disabled) { + queries.push([$.isFunction(inst.options.items) ? inst.options.items.call(inst.element) : $(inst.options.items, inst.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"), inst]); + } + } + } + } + + queries.push([$.isFunction(this.options.items) ? this.options.items.call(this.element, null, { options: this.options, item: this.currentItem }) : $(this.options.items, this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"), this]); + + function addItems() { + items.push( this ); + } + for (i = queries.length - 1; i >= 0; i--){ + queries[i][0].each( addItems ); + } + + return $(items); + + }, + + _removeCurrentsFromItems: function() { + + var list = this.currentItem.find(":data(" + this.widgetName + "-item)"); + + this.items = $.grep(this.items, function (item) { + for (var j=0; j < list.length; j++) { + if(list[j] === item.item[0]) { + return false; + } + } + return true; + }); + + }, + + _refreshItems: function(event) { + + this.items = []; + this.containers = [this]; + + var i, j, cur, inst, targetData, _queries, item, queriesLength, + items = this.items, + queries = [[$.isFunction(this.options.items) ? this.options.items.call(this.element[0], event, { item: this.currentItem }) : $(this.options.items, this.element), this]], + connectWith = this._connectWith(); + + if(connectWith && this.ready) { //Shouldn't be run the first time through due to massive slow-down + for (i = connectWith.length - 1; i >= 0; i--){ + cur = $(connectWith[i], this.document[0]); + for (j = cur.length - 1; j >= 0; j--){ + inst = $.data(cur[j], this.widgetFullName); + if(inst && inst !== this && !inst.options.disabled) { + queries.push([$.isFunction(inst.options.items) ? inst.options.items.call(inst.element[0], event, { item: this.currentItem }) : $(inst.options.items, inst.element), inst]); + this.containers.push(inst); + } + } + } + } + + for (i = queries.length - 1; i >= 0; i--) { + targetData = queries[i][1]; + _queries = queries[i][0]; + + for (j=0, queriesLength = _queries.length; j < queriesLength; j++) { + item = $(_queries[j]); + + item.data(this.widgetName + "-item", targetData); // Data for target checking (mouse manager) + + items.push({ + item: item, + instance: targetData, + width: 0, height: 0, + left: 0, top: 0 + }); + } + } + + }, + + refreshPositions: function(fast) { + + // Determine whether items are being displayed horizontally + this.floating = this.items.length ? + this.options.axis === "x" || this._isFloating( this.items[ 0 ].item ) : + false; + + //This has to be redone because due to the item being moved out/into the offsetParent, the offsetParent's position will change + if(this.offsetParent && this.helper) { + this.offset.parent = this._getParentOffset(); + } + + var i, item, t, p; + + for (i = this.items.length - 1; i >= 0; i--){ + item = this.items[i]; + + //We ignore calculating positions of all connected containers when we're not over them + if(item.instance !== this.currentContainer && this.currentContainer && item.item[0] !== this.currentItem[0]) { + continue; + } + + t = this.options.toleranceElement ? $(this.options.toleranceElement, item.item) : item.item; + + if (!fast) { + item.width = t.outerWidth(); + item.height = t.outerHeight(); + } + + p = t.offset(); + item.left = p.left; + item.top = p.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--){ + p = this.containers[i].element.offset(); + this.containers[i].containerCache.left = p.left; + this.containers[i].containerCache.top = p.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(that) { + that = that || this; + var className, + o = that.options; + + if(!o.placeholder || o.placeholder.constructor === String) { + className = o.placeholder; + o.placeholder = { + element: function() { + + var nodeName = that.currentItem[0].nodeName.toLowerCase(), + element = $( "<" + nodeName + ">", that.document[0] ) + .addClass(className || that.currentItem[0].className+" ui-sortable-placeholder") + .removeClass("ui-sortable-helper"); + + if ( nodeName === "tbody" ) { + that._createTrPlaceholder( + that.currentItem.find( "tr" ).eq( 0 ), + $( "", that.document[ 0 ] ).appendTo( element ) + ); + } else if ( nodeName === "tr" ) { + that._createTrPlaceholder( that.currentItem, element ); + } else if ( nodeName === "img" ) { + element.attr( "src", that.currentItem.attr( "src" ) ); + } + + if ( !className ) { + element.css( "visibility", "hidden" ); + } + + return element; + }, + update: function(container, p) { + + // 1. If a className is set as 'placeholder option, we don't force sizes - the class is responsible for that + // 2. The option 'forcePlaceholderSize can be enabled to force it even if a class name is specified + if(className && !o.forcePlaceholderSize) { + return; + } + + //If the element doesn't have a actual height by itself (without styles coming from a stylesheet), it receives the inline height from the dragged item + if(!p.height()) { p.height(that.currentItem.innerHeight() - parseInt(that.currentItem.css("paddingTop")||0, 10) - parseInt(that.currentItem.css("paddingBottom")||0, 10)); } + if(!p.width()) { p.width(that.currentItem.innerWidth() - parseInt(that.currentItem.css("paddingLeft")||0, 10) - parseInt(that.currentItem.css("paddingRight")||0, 10)); } + } + }; + } + + //Create the placeholder + that.placeholder = $(o.placeholder.element.call(that.element, that.currentItem)); + + //Append it after the actual current item + that.currentItem.after(that.placeholder); + + //Update the size of the placeholder (TODO: Logic to fuzzy, see line 316/317) + o.placeholder.update(that, that.placeholder); + + }, + + _createTrPlaceholder: function( sourceTr, targetTr ) { + var that = this; + + sourceTr.children().each(function() { + $( " ", that.document[ 0 ] ) + .attr( "colspan", $( this ).attr( "colspan" ) || 1 ) + .appendTo( targetTr ); + }); + }, + + _contactContainers: function(event) { + var i, j, dist, itemWithLeastDistance, posProperty, sizeProperty, cur, nearBottom, floating, axis, + innermostContainer = null, + innermostIndex = null; + + // get innermost container that intersects with item + for (i = this.containers.length - 1; i >= 0; i--) { + + // never consider a container that's located within the item itself + if($.contains(this.currentItem[0], this.containers[i].element[0])) { + continue; + } + + if(this._intersectsWith(this.containers[i].containerCache)) { + + // if we've already found a container and it's more "inner" than this, then continue + if(innermostContainer && $.contains(this.containers[i].element[0], innermostContainer.element[0])) { + continue; + } + + innermostContainer = this.containers[i]; + innermostIndex = i; + + } else { + // container doesn't intersect. trigger "out" event if necessary + if(this.containers[i].containerCache.over) { + this.containers[i]._trigger("out", event, this._uiHash(this)); + this.containers[i].containerCache.over = 0; + } + } + + } + + // if no intersecting containers found, return + if(!innermostContainer) { + return; + } + + // move the item into the container if it's not there already + if(this.containers.length === 1) { + if (!this.containers[innermostIndex].containerCache.over) { + this.containers[innermostIndex]._trigger("over", event, this._uiHash(this)); + this.containers[innermostIndex].containerCache.over = 1; + } + } else { + + //When entering a new container, we will find the item with the least distance and append our item near it + dist = 10000; + itemWithLeastDistance = null; + floating = innermostContainer.floating || this._isFloating(this.currentItem); + posProperty = floating ? "left" : "top"; + sizeProperty = floating ? "width" : "height"; + axis = floating ? "clientX" : "clientY"; + + for (j = this.items.length - 1; j >= 0; j--) { + if(!$.contains(this.containers[innermostIndex].element[0], this.items[j].item[0])) { + continue; + } + if(this.items[j].item[0] === this.currentItem[0]) { + continue; + } + + cur = this.items[j].item.offset()[posProperty]; + nearBottom = false; + if ( event[ axis ] - cur > this.items[ j ][ sizeProperty ] / 2 ) { + nearBottom = true; + } + + if ( Math.abs( event[ axis ] - cur ) < dist ) { + dist = Math.abs( event[ axis ] - cur ); + itemWithLeastDistance = this.items[ j ]; + this.direction = nearBottom ? "up": "down"; + } + } + + //Check if dropOnEmpty is enabled + if(!itemWithLeastDistance && !this.options.dropOnEmpty) { + return; + } + + if(this.currentContainer === this.containers[innermostIndex]) { + if ( !this.currentContainer.containerCache.over ) { + this.containers[ innermostIndex ]._trigger( "over", event, this._uiHash() ); + this.currentContainer.containerCache.over = 1; + } + return; + } + + itemWithLeastDistance ? this._rearrange(event, itemWithLeastDistance, null, true) : this._rearrange(event, null, this.containers[innermostIndex].element, true); + this._trigger("change", event, this._uiHash()); + this.containers[innermostIndex]._trigger("change", event, this._uiHash(this)); + this.currentContainer = this.containers[innermostIndex]; + + //Update the placeholder + this.options.placeholder.update(this.currentContainer, this.placeholder); + + this.containers[innermostIndex]._trigger("over", event, this._uiHash(this)); + this.containers[innermostIndex].containerCache.over = 1; + } + + + }, + + _createHelper: function(event) { + + var o = this.options, + helper = $.isFunction(o.helper) ? $(o.helper.apply(this.element[0], [event, this.currentItem])) : (o.helper === "clone" ? this.currentItem.clone() : this.currentItem); + + //Add the helper to the DOM if that didn't happen already + if(!helper.parents("body").length) { + $(o.appendTo !== "parent" ? o.appendTo : this.currentItem[0].parentNode)[0].appendChild(helper[0]); + } + + if(helper[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") }; + } + + if(!helper[0].style.width || o.forceHelperSize) { + helper.width(this.currentItem.width()); + } + if(!helper[0].style.height || o.forceHelperSize) { + helper.height(this.currentItem.height()); + } + + return helper; + + }, + + _adjustOffsetFromHelper: function(obj) { + if (typeof obj === "string") { + obj = obj.split(" "); + } + if ($.isArray(obj)) { + obj = {left: +obj[0], top: +obj[1] || 0}; + } + if ("left" in obj) { + this.offset.click.left = obj.left + this.margins.left; + } + if ("right" in obj) { + this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left; + } + if ("top" in obj) { + this.offset.click.top = obj.top + this.margins.top; + } + if ("bottom" in obj) { + this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top; + } + }, + + _getParentOffset: function() { + + + //Get the offsetParent and cache its position + this.offsetParent = this.helper.offsetParent(); + var po = this.offsetParent.offset(); + + // This is a special case where we need to modify a offset calculated on start, since the following happened: + // 1. The position of the helper is absolute, so it's position is calculated based on the next positioned parent + // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't the document, which means that + // the scroll is included in the initial calculation of the offset of the parent, and never recalculated upon drag + if(this.cssPosition === "absolute" && this.scrollParent[0] !== this.document[0] && $.contains(this.scrollParent[0], this.offsetParent[0])) { + po.left += this.scrollParent.scrollLeft(); + po.top += this.scrollParent.scrollTop(); + } + + // This needs to be actually done for all browsers, since pageX/pageY includes this information + // with an ugly IE fix + if( this.offsetParent[0] === this.document[0].body || (this.offsetParent[0].tagName && this.offsetParent[0].tagName.toLowerCase() === "html" && $.ui.ie)) { + po = { top: 0, left: 0 }; + } + + return { + top: po.top + (parseInt(this.offsetParent.css("borderTopWidth"),10) || 0), + left: po.left + (parseInt(this.offsetParent.css("borderLeftWidth"),10) || 0) + }; + + }, + + _getRelativeOffset: function() { + + if(this.cssPosition === "relative") { + var p = this.currentItem.position(); + return { + top: p.top - (parseInt(this.helper.css("top"),10) || 0) + this.scrollParent.scrollTop(), + left: p.left - (parseInt(this.helper.css("left"),10) || 0) + this.scrollParent.scrollLeft() + }; + } else { + 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 ce, co, over, + o = this.options; + if(o.containment === "parent") { + o.containment = this.helper[0].parentNode; + } + if(o.containment === "document" || o.containment === "window") { + this.containment = [ + 0 - this.offset.relative.left - this.offset.parent.left, + 0 - this.offset.relative.top - this.offset.parent.top, + o.containment === "document" ? this.document.width() : this.window.width() - this.helperProportions.width - this.margins.left, + (o.containment === "document" ? this.document.width() : this.window.height() || this.document[0].body.parentNode.scrollHeight) - this.helperProportions.height - this.margins.top + ]; + } + + if(!(/^(document|window|parent)$/).test(o.containment)) { + ce = $(o.containment)[0]; + co = $(o.containment).offset(); + over = ($(ce).css("overflow") !== "hidden"); + + this.containment = [ + co.left + (parseInt($(ce).css("borderLeftWidth"),10) || 0) + (parseInt($(ce).css("paddingLeft"),10) || 0) - this.margins.left, + co.top + (parseInt($(ce).css("borderTopWidth"),10) || 0) + (parseInt($(ce).css("paddingTop"),10) || 0) - this.margins.top, + co.left+(over ? Math.max(ce.scrollWidth,ce.offsetWidth) : ce.offsetWidth) - (parseInt($(ce).css("borderLeftWidth"),10) || 0) - (parseInt($(ce).css("paddingRight"),10) || 0) - this.helperProportions.width - this.margins.left, + co.top+(over ? Math.max(ce.scrollHeight,ce.offsetHeight) : ce.offsetHeight) - (parseInt($(ce).css("borderTopWidth"),10) || 0) - (parseInt($(ce).css("paddingBottom"),10) || 0) - this.helperProportions.height - this.margins.top + ]; + } + + }, + + _convertPositionTo: function(d, pos) { + + if(!pos) { + pos = this.position; + } + var mod = d === "absolute" ? 1 : -1, + scroll = this.cssPosition === "absolute" && !(this.scrollParent[0] !== this.document[0] && $.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, + scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName); + + return { + top: ( + pos.top + // The absolute mouse position + this.offset.relative.top * mod + // Only for relative positioned nodes: Relative offset from element to offset parent + this.offset.parent.top * mod - // The offsetParent's offset without borders (offset + border) + ( ( this.cssPosition === "fixed" ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) * mod) + ), + left: ( + pos.left + // The absolute mouse position + this.offset.relative.left * mod + // Only for relative positioned nodes: Relative offset from element to offset parent + this.offset.parent.left * mod - // The offsetParent's offset without borders (offset + border) + ( ( this.cssPosition === "fixed" ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ) * mod) + ) + }; + + }, + + _generatePosition: function(event) { + + var top, left, + o = this.options, + pageX = event.pageX, + pageY = event.pageY, + scroll = this.cssPosition === "absolute" && !(this.scrollParent[0] !== this.document[0] && $.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName); + + // This is another very weird special case that only happens for relative elements: + // 1. If the css position is relative + // 2. and the scroll parent is the document or similar to the offset parent + // we have to refresh the relative offset during the scroll so there are no jumps + if(this.cssPosition === "relative" && !(this.scrollParent[0] !== this.document[0] && this.scrollParent[0] !== this.offsetParent[0])) { + this.offset.relative = this._getRelativeOffset(); + } + + /* + * - Position constraining - + * Constrain the position to a mix of grid, containment. + */ + + if(this.originalPosition) { //If we are not dragging yet, we won't check for options + + if(this.containment) { + if(event.pageX - this.offset.click.left < this.containment[0]) { + pageX = this.containment[0] + this.offset.click.left; + } + if(event.pageY - this.offset.click.top < this.containment[1]) { + pageY = this.containment[1] + this.offset.click.top; + } + if(event.pageX - this.offset.click.left > this.containment[2]) { + pageX = this.containment[2] + this.offset.click.left; + } + if(event.pageY - this.offset.click.top > this.containment[3]) { + pageY = this.containment[3] + this.offset.click.top; + } + } + + if(o.grid) { + top = this.originalPageY + Math.round((pageY - this.originalPageY) / o.grid[1]) * o.grid[1]; + pageY = this.containment ? ( (top - this.offset.click.top >= this.containment[1] && top - this.offset.click.top <= this.containment[3]) ? top : ((top - this.offset.click.top >= this.containment[1]) ? top - o.grid[1] : top + o.grid[1])) : top; + + left = this.originalPageX + Math.round((pageX - this.originalPageX) / o.grid[0]) * o.grid[0]; + pageX = this.containment ? ( (left - this.offset.click.left >= this.containment[0] && left - this.offset.click.left <= this.containment[2]) ? left : ((left - this.offset.click.left >= this.containment[0]) ? left - o.grid[0] : left + o.grid[0])) : left; + } + + } + + return { + top: ( + pageY - // The absolute mouse position + this.offset.click.top - // Click offset (relative to the element) + this.offset.relative.top - // Only for relative positioned nodes: Relative offset from element to offset parent + this.offset.parent.top + // The offsetParent's offset without borders (offset + border) + ( ( this.cssPosition === "fixed" ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) )) + ), + left: ( + pageX - // The absolute mouse position + this.offset.click.left - // Click offset (relative to the element) + this.offset.relative.left - // Only for relative positioned nodes: Relative offset from element to offset parent + this.offset.parent.left + // The offsetParent's offset without borders (offset + border) + ( ( this.cssPosition === "fixed" ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() )) + ) + }; + + }, + + _rearrange: function(event, i, a, hardRefresh) { + + a ? a[0].appendChild(this.placeholder[0]) : i.item[0].parentNode.insertBefore(this.placeholder[0], (this.direction === "down" ? i.item[0] : i.item[0].nextSibling)); + + //Various things done here to improve the performance: + // 1. we create a setTimeout, that calls refreshPositions + // 2. on the instance, we have a counter variable, that get's higher after every append + // 3. on the local scope, we copy the counter variable, and check in the timeout, if it's still the same + // 4. this lets only the last addition to the timeout stack through + this.counter = this.counter ? ++this.counter : 1; + var counter = this.counter; + + this._delay(function() { + if(counter === this.counter) { + this.refreshPositions(!hardRefresh); //Precompute after each DOM insertion, NOT on mousemove + } + }); + + }, + + _clear: function(event, noPropagation) { + + this.reverting = false; + // We delay all events that have to be triggered to after the point where the placeholder has been removed and + // everything else normalized again + var i, + delayedTriggers = []; + + // We first have to update the dom position of the actual currentItem + // Note: don't do it if the current item is already removed (by a user), or it gets reappended (see #4088) + if(!this._noFinalSort && this.currentItem.parent().length) { + this.placeholder.before(this.currentItem); + } + this._noFinalSort = null; + + if(this.helper[0] === this.currentItem[0]) { + for(i in this._storedCSS) { + if(this._storedCSS[i] === "auto" || this._storedCSS[i] === "static") { + this._storedCSS[i] = ""; + } + } + this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper"); + } else { + this.currentItem.show(); + } + + if(this.fromOutside && !noPropagation) { + delayedTriggers.push(function(event) { this._trigger("receive", event, this._uiHash(this.fromOutside)); }); + } + if((this.fromOutside || this.domPosition.prev !== this.currentItem.prev().not(".ui-sortable-helper")[0] || this.domPosition.parent !== this.currentItem.parent()[0]) && !noPropagation) { + delayedTriggers.push(function(event) { this._trigger("update", event, this._uiHash()); }); //Trigger update callback if the DOM position has changed + } + + // Check if the items Container has Changed and trigger appropriate + // events. + if (this !== this.currentContainer) { + if(!noPropagation) { + delayedTriggers.push(function(event) { this._trigger("remove", event, this._uiHash()); }); + delayedTriggers.push((function(c) { return function(event) { c._trigger("receive", event, this._uiHash(this)); }; }).call(this, this.currentContainer)); + delayedTriggers.push((function(c) { return function(event) { c._trigger("update", event, this._uiHash(this)); }; }).call(this, this.currentContainer)); + } + } + + + //Post events to containers + function delayEvent( type, instance, container ) { + return function( event ) { + container._trigger( type, event, instance._uiHash( instance ) ); + }; + } + for (i = this.containers.length - 1; i >= 0; i--){ + if (!noPropagation) { + delayedTriggers.push( delayEvent( "deactivate", this, this.containers[ i ] ) ); + } + if(this.containers[i].containerCache.over) { + delayedTriggers.push( delayEvent( "out", this, this.containers[ i ] ) ); + this.containers[i].containerCache.over = 0; + } + } + + //Do what was originally in plugins + if ( this.storedCursor ) { + this.document.find( "body" ).css( "cursor", this.storedCursor ); + this.storedStylesheet.remove(); + } + if(this._storedOpacity) { + this.helper.css("opacity", this._storedOpacity); + } + if(this._storedZIndex) { + this.helper.css("zIndex", this._storedZIndex === "auto" ? "" : this._storedZIndex); + } + + this.dragging = false; + + if(!noPropagation) { + this._trigger("beforeStop", event, this._uiHash()); + } + + //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, it unbinds ALL events from the original node! + this.placeholder[0].parentNode.removeChild(this.placeholder[0]); + + if ( !this.cancelHelperRemoval ) { + if ( this.helper[ 0 ] !== this.currentItem[ 0 ] ) { + this.helper.remove(); + } + this.helper = null; + } + + if(!noPropagation) { + for (i=0; i < delayedTriggers.length; i++) { + delayedTriggers[i].call(this, event); + } //Trigger all delayed events + this._trigger("stop", event, this._uiHash()); + } + + this.fromOutside = false; + return !this.cancelHelperRemoval; + + }, + + _trigger: function() { + if ($.Widget.prototype._trigger.apply(this, arguments) === false) { + this.cancel(); + } + }, + + _uiHash: function(_inst) { + var inst = _inst || this; + return { + helper: inst.helper, + placeholder: inst.placeholder || $([]), + position: inst.position, + originalPosition: inst.originalPosition, + offset: inst.positionAbs, + item: inst.currentItem, + sender: _inst ? _inst.element : null + }; + } + +}); + + +/*! + * jQuery UI Spinner 1.11.4 + * http://jqueryui.com + * + * Copyright jQuery Foundation and other contributors + * Released under the MIT license. + * http://jquery.org/license + * + * http://api.jqueryui.com/spinner/ + */ + + +function spinner_modifier( fn ) { + return function() { + var previous = this.element.val(); + fn.apply( this, arguments ); + this._refresh(); + if ( previous !== this.element.val() ) { + this._trigger( "change" ); + } + }; +} + +var spinner = $.widget( "ui.spinner", { + version: "1.11.4", + defaultElement: "", + widgetEventPrefix: "spin", + options: { + culture: null, + icons: { + down: "ui-icon-triangle-1-s", + up: "ui-icon-triangle-1-n" + }, + incremental: true, + max: null, + min: null, + numberFormat: null, + page: 10, + step: 1, + + change: null, + spin: null, + start: null, + stop: null + }, + + _create: function() { + // handle string values that need to be parsed + this._setOption( "max", this.options.max ); + this._setOption( "min", this.options.min ); + this._setOption( "step", this.options.step ); + + // Only format if there is a value, prevents the field from being marked + // as invalid in Firefox, see #9573. + if ( this.value() !== "" ) { + // Format the value, but don't constrain. + this._value( this.element.val(), true ); + } + + this._draw(); + this._on( this._events ); + this._refresh(); + + // turning off autocomplete prevents the browser from remembering the + // value when navigating through history, so we re-enable autocomplete + // if the page is unloaded before the widget is destroyed. #7790 + this._on( this.window, { + beforeunload: function() { + this.element.removeAttr( "autocomplete" ); + } + }); + }, + + _getCreateOptions: function() { + var options = {}, + element = this.element; + + $.each( [ "min", "max", "step" ], function( i, option ) { + var value = element.attr( option ); + if ( value !== undefined && value.length ) { + options[ option ] = value; + } + }); + + return options; + }, + + _events: { + keydown: function( event ) { + if ( this._start( event ) && this._keydown( event ) ) { + event.preventDefault(); + } + }, + keyup: "_stop", + focus: function() { + this.previous = this.element.val(); + }, + blur: function( event ) { + if ( this.cancelBlur ) { + delete this.cancelBlur; + return; + } + + this._stop(); + this._refresh(); + if ( this.previous !== this.element.val() ) { + this._trigger( "change", event ); + } + }, + mousewheel: function( event, delta ) { + if ( !delta ) { + return; + } + if ( !this.spinning && !this._start( event ) ) { + return false; + } + + this._spin( (delta > 0 ? 1 : -1) * this.options.step, event ); + clearTimeout( this.mousewheelTimer ); + this.mousewheelTimer = this._delay(function() { + if ( this.spinning ) { + this._stop( event ); + } + }, 100 ); + event.preventDefault(); + }, + "mousedown .ui-spinner-button": function( event ) { + var previous; + + // We never want the buttons to have focus; whenever the user is + // interacting with the spinner, the focus should be on the input. + // If the input is focused then this.previous is properly set from + // when the input first received focus. If the input is not focused + // then we need to set this.previous based on the value before spinning. + previous = this.element[0] === this.document[0].activeElement ? + this.previous : this.element.val(); + function checkFocus() { + var isActive = this.element[0] === this.document[0].activeElement; + if ( !isActive ) { + this.element.focus(); + this.previous = previous; + // support: IE + // IE sets focus asynchronously, so we need to check if focus + // moved off of the input because the user clicked on the button. + this._delay(function() { + this.previous = previous; + }); + } + } + + // ensure focus is on (or stays on) the text field + event.preventDefault(); + checkFocus.call( this ); + + // support: IE + // IE doesn't prevent moving focus even with event.preventDefault() + // so we set a flag to know when we should ignore the blur event + // and check (again) if focus moved off of the input. + this.cancelBlur = true; + this._delay(function() { + delete this.cancelBlur; + checkFocus.call( this ); + }); + + if ( this._start( event ) === false ) { + return; + } + + this._repeat( null, $( event.currentTarget ).hasClass( "ui-spinner-up" ) ? 1 : -1, event ); + }, + "mouseup .ui-spinner-button": "_stop", + "mouseenter .ui-spinner-button": function( event ) { + // button will add ui-state-active if mouse was down while mouseleave and kept down + if ( !$( event.currentTarget ).hasClass( "ui-state-active" ) ) { + return; + } + + if ( this._start( event ) === false ) { + return false; + } + this._repeat( null, $( event.currentTarget ).hasClass( "ui-spinner-up" ) ? 1 : -1, event ); + }, + // TODO: do we really want to consider this a stop? + // shouldn't we just stop the repeater and wait until mouseup before + // we trigger the stop event? + "mouseleave .ui-spinner-button": "_stop" + }, + + _draw: function() { + var uiSpinner = this.uiSpinner = this.element + .addClass( "ui-spinner-input" ) + .attr( "autocomplete", "off" ) + .wrap( this._uiSpinnerHtml() ) + .parent() + // add buttons + .append( this._buttonHtml() ); + + this.element.attr( "role", "spinbutton" ); + + // button bindings + this.buttons = uiSpinner.find( ".ui-spinner-button" ) + .attr( "tabIndex", -1 ) + .button() + .removeClass( "ui-corner-all" ); + + // IE 6 doesn't understand height: 50% for the buttons + // unless the wrapper has an explicit height + if ( this.buttons.height() > Math.ceil( uiSpinner.height() * 0.5 ) && + uiSpinner.height() > 0 ) { + uiSpinner.height( uiSpinner.height() ); + } + + // disable spinner if element was already disabled + if ( this.options.disabled ) { + this.disable(); + } + }, + + _keydown: function( event ) { + var options = this.options, + keyCode = $.ui.keyCode; + + switch ( event.keyCode ) { + case keyCode.UP: + this._repeat( null, 1, event ); + return true; + case keyCode.DOWN: + this._repeat( null, -1, event ); + return true; + case keyCode.PAGE_UP: + this._repeat( null, options.page, event ); + return true; + case keyCode.PAGE_DOWN: + this._repeat( null, -options.page, event ); + return true; + } + + return false; + }, + + _uiSpinnerHtml: function() { + return ""; + }, + + _buttonHtml: function() { + return "" + + "" + + "" + + "" + + "" + + "" + + ""; + }, + + _start: function( event ) { + if ( !this.spinning && this._trigger( "start", event ) === false ) { + return false; + } + + if ( !this.counter ) { + this.counter = 1; + } + this.spinning = true; + return true; + }, + + _repeat: function( i, steps, event ) { + i = i || 500; + + clearTimeout( this.timer ); + this.timer = this._delay(function() { + this._repeat( 40, steps, event ); + }, i ); + + this._spin( steps * this.options.step, event ); + }, + + _spin: function( step, event ) { + var value = this.value() || 0; + + if ( !this.counter ) { + this.counter = 1; + } + + value = this._adjustValue( value + step * this._increment( this.counter ) ); + + if ( !this.spinning || this._trigger( "spin", event, { value: value } ) !== false) { + this._value( value ); + this.counter++; + } + }, + + _increment: function( i ) { + var incremental = this.options.incremental; + + if ( incremental ) { + return $.isFunction( incremental ) ? + incremental( i ) : + Math.floor( i * i * i / 50000 - i * i / 500 + 17 * i / 200 + 1 ); + } + + return 1; + }, + + _precision: function() { + var precision = this._precisionOf( this.options.step ); + if ( this.options.min !== null ) { + precision = Math.max( precision, this._precisionOf( this.options.min ) ); + } + return precision; + }, + + _precisionOf: function( num ) { + var str = num.toString(), + decimal = str.indexOf( "." ); + return decimal === -1 ? 0 : str.length - decimal - 1; + }, + + _adjustValue: function( value ) { + var base, aboveMin, + options = this.options; + + // make sure we're at a valid step + // - find out where we are relative to the base (min or 0) + base = options.min !== null ? options.min : 0; + aboveMin = value - base; + // - round to the nearest step + aboveMin = Math.round(aboveMin / options.step) * options.step; + // - rounding is based on 0, so adjust back to our base + value = base + aboveMin; + + // fix precision from bad JS floating point math + value = parseFloat( value.toFixed( this._precision() ) ); + + // clamp the value + if ( options.max !== null && value > options.max) { + return options.max; + } + if ( options.min !== null && value < options.min ) { + return options.min; + } + + return value; + }, + + _stop: function( event ) { + if ( !this.spinning ) { + return; + } + + clearTimeout( this.timer ); + clearTimeout( this.mousewheelTimer ); + this.counter = 0; + this.spinning = false; + this._trigger( "stop", event ); + }, + + _setOption: function( key, value ) { + if ( key === "culture" || key === "numberFormat" ) { + var prevValue = this._parse( this.element.val() ); + this.options[ key ] = value; + this.element.val( this._format( prevValue ) ); + return; + } + + if ( key === "max" || key === "min" || key === "step" ) { + if ( typeof value === "string" ) { + value = this._parse( value ); + } + } + if ( key === "icons" ) { + this.buttons.first().find( ".ui-icon" ) + .removeClass( this.options.icons.up ) + .addClass( value.up ); + this.buttons.last().find( ".ui-icon" ) + .removeClass( this.options.icons.down ) + .addClass( value.down ); + } + + this._super( key, value ); + + if ( key === "disabled" ) { + this.widget().toggleClass( "ui-state-disabled", !!value ); + this.element.prop( "disabled", !!value ); + this.buttons.button( value ? "disable" : "enable" ); + } + }, + + _setOptions: spinner_modifier(function( options ) { + this._super( options ); + }), + + _parse: function( val ) { + if ( typeof val === "string" && val !== "" ) { + val = window.Globalize && this.options.numberFormat ? + Globalize.parseFloat( val, 10, this.options.culture ) : +val; + } + return val === "" || isNaN( val ) ? null : val; + }, + + _format: function( value ) { + if ( value === "" ) { + return ""; + } + return window.Globalize && this.options.numberFormat ? + Globalize.format( value, this.options.numberFormat, this.options.culture ) : + value; + }, + + _refresh: function() { + this.element.attr({ + "aria-valuemin": this.options.min, + "aria-valuemax": this.options.max, + // TODO: what should we do with values that can't be parsed? + "aria-valuenow": this._parse( this.element.val() ) + }); + }, + + isValid: function() { + var value = this.value(); + + // null is invalid + if ( value === null ) { + return false; + } + + // if value gets adjusted, it's invalid + return value === this._adjustValue( value ); + }, + + // update the value without triggering change + _value: function( value, allowAny ) { + var parsed; + if ( value !== "" ) { + parsed = this._parse( value ); + if ( parsed !== null ) { + if ( !allowAny ) { + parsed = this._adjustValue( parsed ); + } + value = this._format( parsed ); + } + } + this.element.val( value ); + this._refresh(); + }, + + _destroy: function() { + this.element + .removeClass( "ui-spinner-input" ) + .prop( "disabled", false ) + .removeAttr( "autocomplete" ) + .removeAttr( "role" ) + .removeAttr( "aria-valuemin" ) + .removeAttr( "aria-valuemax" ) + .removeAttr( "aria-valuenow" ); + this.uiSpinner.replaceWith( this.element ); + }, + + stepUp: spinner_modifier(function( steps ) { + this._stepUp( steps ); + }), + _stepUp: function( steps ) { + if ( this._start() ) { + this._spin( (steps || 1) * this.options.step ); + this._stop(); + } + }, + + stepDown: spinner_modifier(function( steps ) { + this._stepDown( steps ); + }), + _stepDown: function( steps ) { + if ( this._start() ) { + this._spin( (steps || 1) * -this.options.step ); + this._stop(); + } + }, + + pageUp: spinner_modifier(function( pages ) { + this._stepUp( (pages || 1) * this.options.page ); + }), + + pageDown: spinner_modifier(function( pages ) { + this._stepDown( (pages || 1) * this.options.page ); + }), + + value: function( newVal ) { + if ( !arguments.length ) { + return this._parse( this.element.val() ); + } + spinner_modifier( this._value ).call( this, newVal ); + }, + + widget: function() { + return this.uiSpinner; + } +}); + + +/*! + * jQuery UI Tabs 1.11.4 + * http://jqueryui.com + * + * Copyright jQuery Foundation and other contributors + * Released under the MIT license. + * http://jquery.org/license + * + * http://api.jqueryui.com/tabs/ + */ + + +var tabs = $.widget( "ui.tabs", { + version: "1.11.4", + delay: 300, + options: { + active: null, + collapsible: false, + event: "click", + heightStyle: "content", + hide: null, + show: null, + + // callbacks + activate: null, + beforeActivate: null, + beforeLoad: null, + load: null + }, + + _isLocal: (function() { + var rhash = /#.*$/; + + return function( anchor ) { + var anchorUrl, locationUrl; + + // support: IE7 + // IE7 doesn't normalize the href property when set via script (#9317) + anchor = anchor.cloneNode( false ); + + anchorUrl = anchor.href.replace( rhash, "" ); + locationUrl = location.href.replace( rhash, "" ); + + // decoding may throw an error if the URL isn't UTF-8 (#9518) + try { + anchorUrl = decodeURIComponent( anchorUrl ); + } catch ( error ) {} + try { + locationUrl = decodeURIComponent( locationUrl ); + } catch ( error ) {} + + return anchor.hash.length > 1 && anchorUrl === locationUrl; + }; + })(), + + _create: function() { + var that = this, + options = this.options; + + this.running = false; + + this.element + .addClass( "ui-tabs ui-widget ui-widget-content ui-corner-all" ) + .toggleClass( "ui-tabs-collapsible", options.collapsible ); + + this._processTabs(); + options.active = this._initialActive(); + + // Take disabling tabs via class attribute from HTML + // into account and update option properly. + if ( $.isArray( options.disabled ) ) { + options.disabled = $.unique( options.disabled.concat( + $.map( this.tabs.filter( ".ui-state-disabled" ), function( li ) { + return that.tabs.index( li ); + }) + ) ).sort(); + } + + // check for length avoids error when initializing empty list + if ( this.options.active !== false && this.anchors.length ) { + this.active = this._findActive( options.active ); + } else { + this.active = $(); + } + + this._refresh(); + + if ( this.active.length ) { + this.load( options.active ); + } + }, + + _initialActive: function() { + var active = this.options.active, + collapsible = this.options.collapsible, + locationHash = location.hash.substring( 1 ); + + if ( active === null ) { + // check the fragment identifier in the URL + if ( locationHash ) { + this.tabs.each(function( i, tab ) { + if ( $( tab ).attr( "aria-controls" ) === locationHash ) { + active = i; + return false; + } + }); + } + + // check for a tab marked active via a class + if ( active === null ) { + active = this.tabs.index( this.tabs.filter( ".ui-tabs-active" ) ); + } + + // no active tab, set to false + if ( active === null || active === -1 ) { + active = this.tabs.length ? 0 : false; + } + } + + // handle numbers: negative, out of range + if ( active !== false ) { + active = this.tabs.index( this.tabs.eq( active ) ); + if ( active === -1 ) { + active = collapsible ? false : 0; + } + } + + // don't allow collapsible: false and active: false + if ( !collapsible && active === false && this.anchors.length ) { + active = 0; + } + + return active; + }, + + _getCreateEventData: function() { + return { + tab: this.active, + panel: !this.active.length ? $() : this._getPanelForTab( this.active ) + }; + }, + + _tabKeydown: function( event ) { + var focusedTab = $( this.document[0].activeElement ).closest( "li" ), + selectedIndex = this.tabs.index( focusedTab ), + goingForward = true; + + if ( this._handlePageNav( event ) ) { + return; + } + + switch ( event.keyCode ) { + case $.ui.keyCode.RIGHT: + case $.ui.keyCode.DOWN: + selectedIndex++; + break; + case $.ui.keyCode.UP: + case $.ui.keyCode.LEFT: + goingForward = false; + selectedIndex--; + break; + case $.ui.keyCode.END: + selectedIndex = this.anchors.length - 1; + break; + case $.ui.keyCode.HOME: + selectedIndex = 0; + break; + case $.ui.keyCode.SPACE: + // Activate only, no collapsing + event.preventDefault(); + clearTimeout( this.activating ); + this._activate( selectedIndex ); + return; + case $.ui.keyCode.ENTER: + // Toggle (cancel delayed activation, allow collapsing) + event.preventDefault(); + clearTimeout( this.activating ); + // Determine if we should collapse or activate + this._activate( selectedIndex === this.options.active ? false : selectedIndex ); + return; + default: + return; + } + + // Focus the appropriate tab, based on which key was pressed + event.preventDefault(); + clearTimeout( this.activating ); + selectedIndex = this._focusNextTab( selectedIndex, goingForward ); + + // Navigating with control/command key will prevent automatic activation + if ( !event.ctrlKey && !event.metaKey ) { + + // Update aria-selected immediately so that AT think the tab is already selected. + // Otherwise AT may confuse the user by stating that they need to activate the tab, + // but the tab will already be activated by the time the announcement finishes. + focusedTab.attr( "aria-selected", "false" ); + this.tabs.eq( selectedIndex ).attr( "aria-selected", "true" ); + + this.activating = this._delay(function() { + this.option( "active", selectedIndex ); + }, this.delay ); + } + }, + + _panelKeydown: function( event ) { + if ( this._handlePageNav( event ) ) { + return; + } + + // Ctrl+up moves focus to the current tab + if ( event.ctrlKey && event.keyCode === $.ui.keyCode.UP ) { + event.preventDefault(); + this.active.focus(); + } + }, + + // Alt+page up/down moves focus to the previous/next tab (and activates) + _handlePageNav: function( event ) { + if ( event.altKey && event.keyCode === $.ui.keyCode.PAGE_UP ) { + this._activate( this._focusNextTab( this.options.active - 1, false ) ); + return true; + } + if ( event.altKey && event.keyCode === $.ui.keyCode.PAGE_DOWN ) { + this._activate( this._focusNextTab( this.options.active + 1, true ) ); + return true; + } + }, + + _findNextTab: function( index, goingForward ) { + var lastTabIndex = this.tabs.length - 1; + + function constrain() { + if ( index > lastTabIndex ) { + index = 0; + } + if ( index < 0 ) { + index = lastTabIndex; + } + return index; + } + + while ( $.inArray( constrain(), this.options.disabled ) !== -1 ) { + index = goingForward ? index + 1 : index - 1; + } + + return index; + }, + + _focusNextTab: function( index, goingForward ) { + index = this._findNextTab( index, goingForward ); + this.tabs.eq( index ).focus(); + return index; + }, + + _setOption: function( key, value ) { + if ( key === "active" ) { + // _activate() will handle invalid values and update this.options + this._activate( value ); + return; + } + + if ( key === "disabled" ) { + // don't use the widget factory's disabled handling + this._setupDisabled( value ); + return; + } + + this._super( key, value); + + if ( key === "collapsible" ) { + this.element.toggleClass( "ui-tabs-collapsible", value ); + // Setting collapsible: false while collapsed; open first panel + if ( !value && this.options.active === false ) { + this._activate( 0 ); + } + } + + if ( key === "event" ) { + this._setupEvents( value ); + } + + if ( key === "heightStyle" ) { + this._setupHeightStyle( value ); + } + }, + + _sanitizeSelector: function( hash ) { + return hash ? hash.replace( /[!"$%&'()*+,.\/:;<=>?@\[\]\^`{|}~]/g, "\\$&" ) : ""; + }, + + refresh: function() { + var options = this.options, + lis = this.tablist.children( ":has(a[href])" ); + + // get disabled tabs from class attribute from HTML + // this will get converted to a boolean if needed in _refresh() + options.disabled = $.map( lis.filter( ".ui-state-disabled" ), function( tab ) { + return lis.index( tab ); + }); + + this._processTabs(); + + // was collapsed or no tabs + if ( options.active === false || !this.anchors.length ) { + options.active = false; + this.active = $(); + // was active, but active tab is gone + } else if ( this.active.length && !$.contains( this.tablist[ 0 ], this.active[ 0 ] ) ) { + // all remaining tabs are disabled + if ( this.tabs.length === options.disabled.length ) { + options.active = false; + this.active = $(); + // activate previous tab + } else { + this._activate( this._findNextTab( Math.max( 0, options.active - 1 ), false ) ); + } + // was active, active tab still exists + } else { + // make sure active index is correct + options.active = this.tabs.index( this.active ); + } + + 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" + }); + + // Make sure one tab is in the tab order + if ( !this.active.length ) { + this.tabs.eq( 0 ).attr( "tabIndex", 0 ); + } else { + 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" + }); + } + }, + + _processTabs: function() { + var that = this, + prevTabs = this.tabs, + prevAnchors = this.anchors, + prevPanels = this.panels; + + this.tablist = this._getList() + .addClass( "ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all" ) + .attr( "role", "tablist" ) + + // Prevent users from focusing disabled tabs via click + .delegate( "> li", "mousedown" + this.eventNamespace, function( event ) { + if ( $( this ).is( ".ui-state-disabled" ) ) { + event.preventDefault(); + } + }) + + // support: IE <9 + // Preventing the default action in mousedown doesn't prevent IE + // from focusing the element, so if the anchor gets focused, blur. + // We don't have to worry about focusing the previously focused + // element since clicking on a non-focusable element should focus + // the body anyway. + .delegate( ".ui-tabs-anchor", "focus" + this.eventNamespace, function() { + if ( $( this ).closest( "li" ).is( ".ui-state-disabled" ) ) { + this.blur(); + } + }); + + 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 $( "a", this )[ 0 ]; + }) + .addClass( "ui-tabs-anchor" ) + .attr({ + role: "presentation", + tabIndex: -1 + }); + + this.panels = $(); + + this.anchors.each(function( i, anchor ) { + var selector, panel, panelId, + anchorId = $( anchor ).uniqueId().attr( "id" ), + tab = $( anchor ).closest( "li" ), + originalAriaControls = tab.attr( "aria-controls" ); + + // inline tab + if ( that._isLocal( anchor ) ) { + selector = anchor.hash; + panelId = selector.substring( 1 ); + panel = that.element.find( that._sanitizeSelector( selector ) ); + // remote tab + } else { + // If the tab doesn't already have aria-controls, + // generate an id by using a throw-away element + panelId = tab.attr( "aria-controls" ) || $( {} ).uniqueId()[ 0 ].id; + selector = "#" + panelId; + panel = that.element.find( selector ); + if ( !panel.length ) { + panel = that._createPanel( panelId ); + panel.insertAfter( that.panels[ i - 1 ] || that.tablist ); + } + panel.attr( "aria-live", "polite" ); + } + + if ( panel.length) { + that.panels = that.panels.add( panel ); + } + if ( originalAriaControls ) { + tab.data( "ui-tabs-aria-controls", originalAriaControls ); + } + tab.attr({ + "aria-controls": panelId, + "aria-labelledby": anchorId + }); + panel.attr( "aria-labelledby", anchorId ); + }); + + this.panels + .addClass( "ui-tabs-panel ui-widget-content ui-corner-bottom" ) + .attr( "role", "tabpanel" ); + + // Avoid memory leaks (#10056) + if ( prevTabs ) { + this._off( prevTabs.not( this.tabs ) ); + this._off( prevAnchors.not( this.anchors ) ); + this._off( prevPanels.not( this.panels ) ); + } + }, + + // allow overriding how to find the list for rare usage scenarios (#7715) + _getList: function() { + return this.tablist || this.element.find( "ol,ul" ).eq( 0 ); + }, + + _createPanel: function( id ) { + return $( "
          " ) + .attr( "id", id ) + .addClass( "ui-tabs-panel ui-widget-content ui-corner-bottom" ) + .data( "ui-tabs-destroy", true ); + }, + + _setupDisabled: function( disabled ) { + if ( $.isArray( disabled ) ) { + if ( !disabled.length ) { + disabled = false; + } else if ( disabled.length === this.anchors.length ) { + disabled = true; + } + } + + // disable tabs + for ( var i = 0, li; ( li = this.tabs[ i ] ); i++ ) { + if ( disabled === true || $.inArray( i, disabled ) !== -1 ) { + $( li ) + .addClass( "ui-state-disabled" ) + .attr( "aria-disabled", "true" ); + } else { + $( li ) + .removeClass( "ui-state-disabled" ) + .removeAttr( "aria-disabled" ); + } + } + + this.options.disabled = disabled; + }, + + _setupEvents: function( event ) { + var events = {}; + if ( event ) { + $.each( event.split(" "), function( index, eventName ) { + events[ eventName ] = "_eventHandler"; + }); + } + + this._off( this.anchors.add( this.tabs ).add( this.panels ) ); + // Always prevent the default action, even when disabled + this._on( true, this.anchors, { + click: function( event ) { + event.preventDefault(); + } + }); + this._on( this.anchors, events ); + this._on( this.tabs, { keydown: "_tabKeydown" } ); + this._on( this.panels, { keydown: "_panelKeydown" } ); + + this._focusable( this.tabs ); + this._hoverable( this.tabs ); + }, + + _setupHeightStyle: function( heightStyle ) { + var maxHeight, + parent = this.element.parent(); + + if ( heightStyle === "fill" ) { + maxHeight = parent.height(); + maxHeight -= this.element.outerHeight() - this.element.height(); + + this.element.siblings( ":visible" ).each(function() { + var elem = $( this ), + position = elem.css( "position" ); + + if ( position === "absolute" || position === "fixed" ) { + return; + } + maxHeight -= elem.outerHeight( true ); + }); + + this.element.children().not( this.panels ).each(function() { + maxHeight -= $( this ).outerHeight( true ); + }); + + this.panels.each(function() { + $( this ).height( Math.max( 0, maxHeight - + $( this ).innerHeight() + $( this ).height() ) ); + }) + .css( "overflow", "auto" ); + } else if ( heightStyle === "auto" ) { + maxHeight = 0; + this.panels.each(function() { + maxHeight = Math.max( maxHeight, $( this ).height( "" ).height() ); + }).height( maxHeight ); + } + }, + + _eventHandler: function( event ) { + var options = this.options, + active = this.active, + anchor = $( event.currentTarget ), + tab = anchor.closest( "li" ), + clickedIsActive = tab[ 0 ] === active[ 0 ], + collapsing = clickedIsActive && options.collapsible, + toShow = collapsing ? $() : this._getPanelForTab( tab ), + toHide = !active.length ? $() : this._getPanelForTab( active ), + eventData = { + oldTab: active, + oldPanel: toHide, + newTab: collapsing ? $() : tab, + newPanel: toShow + }; + + event.preventDefault(); + + if ( tab.hasClass( "ui-state-disabled" ) || + // tab is already loading + tab.hasClass( "ui-tabs-loading" ) || + // can't switch durning an animation + this.running || + // click on active header, but not collapsible + ( clickedIsActive && !options.collapsible ) || + // allow canceling activation + ( this._trigger( "beforeActivate", event, eventData ) === false ) ) { + return; + } + + options.active = collapsing ? false : this.tabs.index( tab ); + + this.active = clickedIsActive ? $() : tab; + if ( this.xhr ) { + this.xhr.abort(); + } + + if ( !toHide.length && !toShow.length ) { + $.error( "jQuery UI Tabs: Mismatching fragment identifier." ); + } + + if ( toShow.length ) { + this.load( this.tabs.index( tab ), event ); + } + this._toggle( event, eventData ); + }, + + // handles show/hide for selecting tabs + _toggle: function( event, eventData ) { + var that = this, + toShow = eventData.newPanel, + toHide = eventData.oldPanel; + + this.running = true; + + function complete() { + that.running = false; + that._trigger( "activate", event, eventData ); + } + + function show() { + eventData.newTab.closest( "li" ).addClass( "ui-tabs-active ui-state-active" ); + + if ( toShow.length && that.options.show ) { + that._show( toShow, that.options.show, complete ); + } else { + toShow.show(); + complete(); + } + } + + // start out by hiding, then showing, then completing + if ( toHide.length && this.options.hide ) { + this._hide( toHide, this.options.hide, function() { + eventData.oldTab.closest( "li" ).removeClass( "ui-tabs-active ui-state-active" ); + show(); + }); + } else { + eventData.oldTab.closest( "li" ).removeClass( "ui-tabs-active ui-state-active" ); + toHide.hide(); + show(); + } + + toHide.attr( "aria-hidden", "true" ); + eventData.oldTab.attr({ + "aria-selected": "false", + "aria-expanded": "false" + }); + // If we're switching tabs, remove the old tab from the tab order. + // If we're opening from collapsed state, remove the previous tab from the tab order. + // If we're collapsing, then keep the collapsing tab in the tab order. + if ( toShow.length && toHide.length ) { + eventData.oldTab.attr( "tabIndex", -1 ); + } else if ( toShow.length ) { + this.tabs.filter(function() { + return $( this ).attr( "tabIndex" ) === 0; + }) + .attr( "tabIndex", -1 ); + } + + toShow.attr( "aria-hidden", "false" ); + eventData.newTab.attr({ + "aria-selected": "true", + "aria-expanded": "true", + tabIndex: 0 + }); + }, + + _activate: function( index ) { + var anchor, + active = this._findActive( index ); + + // trying to activate the already active panel + if ( active[ 0 ] === this.active[ 0 ] ) { + return; + } + + // trying to collapse, simulate a click on the current active header + if ( !active.length ) { + active = this.active; + } + + anchor = active.find( ".ui-tabs-anchor" )[ 0 ]; + this._eventHandler({ + target: anchor, + currentTarget: anchor, + preventDefault: $.noop + }); + }, + + _findActive: function( index ) { + return index === false ? $() : this.tabs.eq( index ); + }, + + _getIndex: function( index ) { + // meta-function to give users option to provide a href string instead of a numerical index. + if ( typeof index === "string" ) { + index = this.anchors.index( this.anchors.filter( "[href$='" + index + "']" ) ); + } + + return index; + }, + + _destroy: function() { + if ( 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.tablist.unbind( this.eventNamespace ); + + this.tabs.add( this.panels ).each(function() { + if ( $.data( this, "ui-tabs-destroy" ) ) { + $( this ).remove(); + } else { + $( 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 li = $( this ), + prev = li.data( "ui-tabs-aria-controls" ); + if ( prev ) { + li + .attr( "aria-controls", prev ) + .removeData( "ui-tabs-aria-controls" ); + } else { + li.removeAttr( "aria-controls" ); + } + }); + + this.panels.show(); + + if ( this.options.heightStyle !== "content" ) { + this.panels.css( "height", "" ); + } + }, + + enable: function( index ) { + var disabled = this.options.disabled; + if ( disabled === false ) { + return; + } + + if ( index === undefined ) { + disabled = false; + } else { + index = this._getIndex( index ); + if ( $.isArray( disabled ) ) { + disabled = $.map( disabled, function( num ) { + return num !== index ? num : null; + }); + } else { + disabled = $.map( this.tabs, function( li, num ) { + return num !== index ? num : null; + }); + } + } + this._setupDisabled( disabled ); + }, + + disable: function( index ) { + var disabled = this.options.disabled; + if ( disabled === true ) { + return; + } + + if ( index === undefined ) { + disabled = true; + } else { + index = this._getIndex( index ); + if ( $.inArray( index, disabled ) !== -1 ) { + return; + } + if ( $.isArray( disabled ) ) { + disabled = $.merge( [ index ], disabled ).sort(); + } else { + disabled = [ index ]; + } + } + this._setupDisabled( disabled ); + }, + + load: function( index, event ) { + index = this._getIndex( index ); + var that = this, + tab = this.tabs.eq( index ), + anchor = tab.find( ".ui-tabs-anchor" ), + panel = this._getPanelForTab( tab ), + eventData = { + tab: tab, + panel: panel + }, + complete = function( jqXHR, status ) { + if ( status === "abort" ) { + that.panels.stop( false, true ); + } + + tab.removeClass( "ui-tabs-loading" ); + panel.removeAttr( "aria-busy" ); + + if ( jqXHR === that.xhr ) { + delete that.xhr; + } + }; + + // not remote + if ( this._isLocal( anchor[ 0 ] ) ) { + return; + } + + this.xhr = $.ajax( this._ajaxSettings( anchor, event, eventData ) ); + + // support: jQuery <1.8 + // jQuery <1.8 returns false if the request is canceled in beforeSend, + // but as of 1.8, $.ajax() always returns a jqXHR object. + if ( this.xhr && this.xhr.statusText !== "canceled" ) { + tab.addClass( "ui-tabs-loading" ); + panel.attr( "aria-busy", "true" ); + + this.xhr + .done(function( response, status, jqXHR ) { + // support: jQuery <1.8 + // http://bugs.jquery.com/ticket/11778 + setTimeout(function() { + panel.html( response ); + that._trigger( "load", event, eventData ); + + complete( jqXHR, status ); + }, 1 ); + }) + .fail(function( jqXHR, status ) { + // support: jQuery <1.8 + // http://bugs.jquery.com/ticket/11778 + setTimeout(function() { + complete( jqXHR, status ); + }, 1 ); + }); + } + }, + + _ajaxSettings: function( anchor, event, eventData ) { + var that = this; + return { + url: anchor.attr( "href" ), + beforeSend: function( jqXHR, settings ) { + return that._trigger( "beforeLoad", event, + $.extend( { jqXHR: jqXHR, ajaxSettings: settings }, eventData ) ); + } + }; + }, + + _getPanelForTab: function( tab ) { + var id = $( tab ).attr( "aria-controls" ); + return this.element.find( this._sanitizeSelector( "#" + id ) ); + } +}); + + +/*! + * jQuery UI Tooltip 1.11.4 + * http://jqueryui.com + * + * Copyright jQuery Foundation and other contributors + * Released under the MIT license. + * http://jquery.org/license + * + * http://api.jqueryui.com/tooltip/ + */ + + +var tooltip = $.widget( "ui.tooltip", { + version: "1.11.4", + options: { + content: function() { + // support: IE<9, Opera in jQuery <1.7 + // .text() can't accept undefined, so coerce to a string + var title = $( this ).attr( "title" ) || ""; + // Escape title, since we're going from an attribute to raw HTML + return $( "" ).text( title ).html(); + }, + hide: true, + // Disabled elements have inconsistent behavior across browsers (#8661) + items: "[title]:not([disabled])", + position: { + my: "left top+15", + at: "left bottom", + collision: "flipfit flip" + }, + show: true, + tooltipClass: null, + track: false, + + // callbacks + close: null, + open: null + }, + + _addDescribedBy: function( elem, id ) { + var describedby = (elem.attr( "aria-describedby" ) || "").split( /\s+/ ); + describedby.push( id ); + elem + .data( "ui-tooltip-id", id ) + .attr( "aria-describedby", $.trim( describedby.join( " " ) ) ); + }, + + _removeDescribedBy: function( elem ) { + var id = elem.data( "ui-tooltip-id" ), + describedby = (elem.attr( "aria-describedby" ) || "").split( /\s+/ ), + index = $.inArray( id, describedby ); + + if ( index !== -1 ) { + describedby.splice( index, 1 ); + } + + elem.removeData( "ui-tooltip-id" ); + describedby = $.trim( describedby.join( " " ) ); + if ( describedby ) { + elem.attr( "aria-describedby", describedby ); + } else { + elem.removeAttr( "aria-describedby" ); + } + }, + + _create: function() { + this._on({ + mouseover: "open", + focusin: "open" + }); + + // IDs of generated tooltips, needed for destroy + this.tooltips = {}; + + // IDs of parent tooltips where we removed the title attribute + this.parents = {}; + + if ( this.options.disabled ) { + this._disable(); + } + + // Append the aria-live region so tooltips announce correctly + this.liveRegion = $( "
          " ) + .attr({ + role: "log", + "aria-live": "assertive", + "aria-relevant": "additions" + }) + .addClass( "ui-helper-hidden-accessible" ) + .appendTo( this.document[ 0 ].body ); + }, + + _setOption: function( key, value ) { + var that = this; + + if ( key === "disabled" ) { + this[ value ? "_disable" : "_enable" ](); + this.options[ key ] = value; + // disable element style changes + return; + } + + this._super( key, value ); + + if ( key === "content" ) { + $.each( this.tooltips, function( id, tooltipData ) { + that._updateContent( tooltipData.element ); + }); + } + }, + + _disable: function() { + var that = this; + + // close open tooltips + $.each( this.tooltips, function( id, tooltipData ) { + var event = $.Event( "blur" ); + event.target = event.currentTarget = tooltipData.element[ 0 ]; + that.close( event, true ); + }); + + // remove title attributes to prevent native tooltips + this.element.find( this.options.items ).addBack().each(function() { + var element = $( this ); + if ( element.is( "[title]" ) ) { + element + .data( "ui-tooltip-title", element.attr( "title" ) ) + .removeAttr( "title" ); + } + }); + }, + + _enable: function() { + // restore title attributes + this.element.find( this.options.items ).addBack().each(function() { + var element = $( this ); + if ( element.data( "ui-tooltip-title" ) ) { + element.attr( "title", element.data( "ui-tooltip-title" ) ); + } + }); + }, + + open: function( event ) { + var that = this, + target = $( event ? event.target : this.element ) + // we need closest here due to mouseover bubbling, + // but always pointing at the same event target + .closest( this.options.items ); + + // No element to show a tooltip for or the tooltip is already open + if ( !target.length || target.data( "ui-tooltip-id" ) ) { + return; + } + + if ( target.attr( "title" ) ) { + target.data( "ui-tooltip-title", target.attr( "title" ) ); + } + + target.data( "ui-tooltip-open", true ); + + // kill parent tooltips, custom or native, for hover + if ( event && event.type === "mouseover" ) { + target.parents().each(function() { + var parent = $( this ), + blurEvent; + if ( parent.data( "ui-tooltip-open" ) ) { + blurEvent = $.Event( "blur" ); + blurEvent.target = blurEvent.currentTarget = this; + that.close( blurEvent, true ); + } + if ( parent.attr( "title" ) ) { + parent.uniqueId(); + that.parents[ this.id ] = { + element: this, + title: parent.attr( "title" ) + }; + parent.attr( "title", "" ); + } + }); + } + + this._registerCloseHandlers( event, target ); + this._updateContent( target, event ); + }, + + _updateContent: function( target, event ) { + var content, + contentOption = this.options.content, + that = this, + eventType = event ? event.type : null; + + if ( typeof contentOption === "string" ) { + return this._open( event, target, contentOption ); + } + + content = contentOption.call( target[0], function( response ) { + + // IE may instantly serve a cached response for ajax requests + // delay this call to _open so the other call to _open runs first + that._delay(function() { + + // Ignore async response if tooltip was closed already + if ( !target.data( "ui-tooltip-open" ) ) { + return; + } + + // jQuery creates a special event for focusin when it doesn't + // exist natively. To improve performance, the native event + // object is reused and the type is changed. Therefore, we can't + // rely on the type being correct after the event finished + // bubbling, so we set it back to the previous value. (#8740) + if ( event ) { + event.type = eventType; + } + this._open( event, target, response ); + }); + }); + if ( content ) { + this._open( event, target, content ); + } + }, + + _open: function( event, target, content ) { + var tooltipData, tooltip, delayedShow, a11yContent, + positionOption = $.extend( {}, this.options.position ); + + if ( !content ) { + return; + } + + // Content can be updated multiple times. If the tooltip already + // exists, then just update the content and bail. + tooltipData = this._find( target ); + if ( tooltipData ) { + tooltipData.tooltip.find( ".ui-tooltip-content" ).html( content ); + return; + } + + // if we have a title, clear it to prevent the native tooltip + // we have to check first to avoid defining a title if none exists + // (we don't want to cause an element to start matching [title]) + // + // We use removeAttr only for key events, to allow IE to export the correct + // accessible attributes. For mouse events, set to empty string to avoid + // native tooltip showing up (happens only when removing inside mouseover). + if ( target.is( "[title]" ) ) { + if ( event && event.type === "mouseover" ) { + target.attr( "title", "" ); + } else { + target.removeAttr( "title" ); + } + } + + tooltipData = this._tooltip( target ); + tooltip = tooltipData.tooltip; + this._addDescribedBy( target, tooltip.attr( "id" ) ); + tooltip.find( ".ui-tooltip-content" ).html( content ); + + // Support: Voiceover on OS X, JAWS on IE <= 9 + // JAWS announces deletions even when aria-relevant="additions" + // Voiceover will sometimes re-read the entire log region's contents from the beginning + this.liveRegion.children().hide(); + if ( content.clone ) { + a11yContent = content.clone(); + a11yContent.removeAttr( "id" ).find( "[id]" ).removeAttr( "id" ); + } else { + a11yContent = content; + } + $( "
          " ).html( a11yContent ).appendTo( this.liveRegion ); + + function position( event ) { + positionOption.of = event; + if ( tooltip.is( ":hidden" ) ) { + return; + } + tooltip.position( positionOption ); + } + if ( this.options.track && event && /^mouse/.test( event.type ) ) { + this._on( this.document, { + mousemove: position + }); + // trigger once to override element-relative positioning + position( event ); + } else { + tooltip.position( $.extend({ + of: target + }, this.options.position ) ); + } + + tooltip.hide(); + + this._show( tooltip, this.options.show ); + // Handle tracking tooltips that are shown with a delay (#8644). As soon + // as the tooltip is visible, position the tooltip using the most recent + // event. + if ( this.options.show && this.options.show.delay ) { + delayedShow = this.delayedShow = setInterval(function() { + if ( tooltip.is( ":visible" ) ) { + position( positionOption.of ); + clearInterval( delayedShow ); + } + }, $.fx.interval ); + } + + this._trigger( "open", event, { tooltip: tooltip } ); + }, + + _registerCloseHandlers: function( event, target ) { + var events = { + keyup: function( event ) { + if ( event.keyCode === $.ui.keyCode.ESCAPE ) { + var fakeEvent = $.Event(event); + fakeEvent.currentTarget = target[0]; + this.close( fakeEvent, true ); + } + } + }; + + // Only bind remove handler for delegated targets. Non-delegated + // tooltips will handle this in destroy. + if ( target[ 0 ] !== this.element[ 0 ] ) { + events.remove = function() { + this._removeTooltip( this._find( target ).tooltip ); + }; + } + + if ( !event || event.type === "mouseover" ) { + events.mouseleave = "close"; + } + if ( !event || event.type === "focusin" ) { + events.focusout = "close"; + } + this._on( true, target, events ); + }, + + close: function( event ) { + var tooltip, + that = this, + target = $( event ? event.currentTarget : this.element ), + tooltipData = this._find( target ); + + // The tooltip may already be closed + if ( !tooltipData ) { + + // We set ui-tooltip-open immediately upon open (in open()), but only set the + // additional data once there's actually content to show (in _open()). So even if the + // tooltip doesn't have full data, we always remove ui-tooltip-open in case we're in + // the period between open() and _open(). + target.removeData( "ui-tooltip-open" ); + return; + } + + tooltip = tooltipData.tooltip; + + // disabling closes the tooltip, so we need to track when we're closing + // to avoid an infinite loop in case the tooltip becomes disabled on close + if ( tooltipData.closing ) { + return; + } + + // Clear the interval for delayed tracking tooltips + clearInterval( this.delayedShow ); + + // only set title if we had one before (see comment in _open()) + // If the title attribute has changed since open(), don't restore + if ( target.data( "ui-tooltip-title" ) && !target.attr( "title" ) ) { + target.attr( "title", target.data( "ui-tooltip-title" ) ); + } + + this._removeDescribedBy( target ); + + tooltipData.hiding = true; + tooltip.stop( true ); + this._hide( tooltip, this.options.hide, function() { + that._removeTooltip( $( this ) ); + }); + + target.removeData( "ui-tooltip-open" ); + this._off( target, "mouseleave focusout keyup" ); + + // Remove 'remove' binding only on delegated targets + if ( target[ 0 ] !== this.element[ 0 ] ) { + this._off( target, "remove" ); + } + this._off( this.document, "mousemove" ); + + if ( event && event.type === "mouseleave" ) { + $.each( this.parents, function( id, parent ) { + $( parent.element ).attr( "title", parent.title ); + delete that.parents[ id ]; + }); + } + + tooltipData.closing = true; + this._trigger( "close", event, { tooltip: tooltip } ); + if ( !tooltipData.hiding ) { + tooltipData.closing = false; + } + }, + + _tooltip: function( element ) { + var tooltip = $( "
          " ) + .attr( "role", "tooltip" ) + .addClass( "ui-tooltip ui-widget ui-corner-all ui-widget-content " + + ( this.options.tooltipClass || "" ) ), + id = tooltip.uniqueId().attr( "id" ); + + $( "
          " ) + .addClass( "ui-tooltip-content" ) + .appendTo( tooltip ); + + tooltip.appendTo( this.document[0].body ); + + return this.tooltips[ id ] = { + element: element, + tooltip: tooltip + }; + }, + + _find: function( target ) { + var id = target.data( "ui-tooltip-id" ); + return id ? this.tooltips[ id ] : null; + }, + + _removeTooltip: function( tooltip ) { + tooltip.remove(); + delete this.tooltips[ tooltip.attr( "id" ) ]; + }, + + _destroy: function() { + var that = this; + + // close open tooltips + $.each( this.tooltips, function( id, tooltipData ) { + // Delegate to close method to handle common cleanup + var event = $.Event( "blur" ), + element = tooltipData.element; + event.target = event.currentTarget = element[ 0 ]; + that.close( event, true ); + + // Remove immediately; destroying an open tooltip doesn't use the + // hide animation + $( "#" + id ).remove(); + + // Restore the title + if ( element.data( "ui-tooltip-title" ) ) { + // If the title attribute has changed since open(), don't restore + if ( !element.attr( "title" ) ) { + element.attr( "title", element.data( "ui-tooltip-title" ) ); + } + element.removeData( "ui-tooltip-title" ); + } + }); + this.liveRegion.remove(); + } +}); + + + +})); \ No newline at end of file diff --git a/public/bower_components/jquery-validation/jquery.validate.js b/public/bower_components/jquery-validation/jquery.validate.js new file mode 100644 index 0000000..4e979bc --- /dev/null +++ b/public/bower_components/jquery-validation/jquery.validate.js @@ -0,0 +1,1398 @@ +/*! + * jQuery Validation Plugin v1.14.0 + * + * http://jqueryvalidation.org/ + * + * Copyright (c) 2015 Jörn Zaefferer + * Released under the MIT license + */ +(function( factory ) { + if ( typeof define === "function" && define.amd ) { + define( ["jquery"], factory ); + } else { + factory( jQuery ); + } +}(function( $ ) { + +$.extend($.fn, { + // http://jqueryvalidation.org/validate/ + validate: function( options ) { + + // if nothing is selected, return nothing; can't chain anyway + if ( !this.length ) { + if ( options && options.debug && window.console ) { + console.warn( "Nothing selected, can't validate, returning nothing." ); + } + return; + } + + // check if a validator for this form was already created + var validator = $.data( this[ 0 ], "validator" ); + if ( validator ) { + return validator; + } + + // Add novalidate tag if HTML5. + this.attr( "novalidate", "novalidate" ); + + validator = new $.validator( options, this[ 0 ] ); + $.data( this[ 0 ], "validator", validator ); + + if ( validator.settings.onsubmit ) { + + this.on( "click.validate", ":submit", function( event ) { + if ( validator.settings.submitHandler ) { + validator.submitButton = event.target; + } + + // allow suppressing validation by adding a cancel class to the submit button + if ( $( this ).hasClass( "cancel" ) ) { + validator.cancelSubmit = true; + } + + // allow suppressing validation by adding the html5 formnovalidate attribute to the submit button + if ( $( this ).attr( "formnovalidate" ) !== undefined ) { + validator.cancelSubmit = true; + } + }); + + // validate the form on submit + this.on( "submit.validate", function( event ) { + if ( validator.settings.debug ) { + // prevent form submit to be able to see console output + event.preventDefault(); + } + function handle() { + var hidden, result; + if ( validator.settings.submitHandler ) { + if ( validator.submitButton ) { + // insert a hidden input as a replacement for the missing submit button + hidden = $( "" ) + .attr( "name", validator.submitButton.name ) + .val( $( validator.submitButton ).val() ) + .appendTo( validator.currentForm ); + } + result = validator.settings.submitHandler.call( validator, validator.currentForm, event ); + if ( validator.submitButton ) { + // and clean up afterwards; thanks to no-block-scope, hidden can be referenced + hidden.remove(); + } + if ( result !== undefined ) { + return result; + } + return false; + } + return true; + } + + // prevent submit for invalid forms or custom submit handlers + if ( validator.cancelSubmit ) { + validator.cancelSubmit = false; + return handle(); + } + if ( validator.form() ) { + if ( validator.pendingRequest ) { + validator.formSubmitted = true; + return false; + } + return handle(); + } else { + validator.focusInvalid(); + return false; + } + }); + } + + return validator; + }, + // http://jqueryvalidation.org/valid/ + valid: function() { + var valid, validator, errorList; + + if ( $( this[ 0 ] ).is( "form" ) ) { + valid = this.validate().form(); + } else { + errorList = []; + valid = true; + validator = $( this[ 0 ].form ).validate(); + this.each( function() { + valid = validator.element( this ) && valid; + errorList = errorList.concat( validator.errorList ); + }); + validator.errorList = errorList; + } + return valid; + }, + + // http://jqueryvalidation.org/rules/ + rules: function( command, argument ) { + var element = this[ 0 ], + settings, staticRules, existingRules, data, param, filtered; + + if ( command ) { + settings = $.data( element.form, "validator" ).settings; + staticRules = settings.rules; + existingRules = $.validator.staticRules( element ); + switch ( command ) { + case "add": + $.extend( existingRules, $.validator.normalizeRule( argument ) ); + // remove messages from rules, but allow them to be set separately + delete existingRules.messages; + staticRules[ element.name ] = existingRules; + if ( argument.messages ) { + settings.messages[ element.name ] = $.extend( settings.messages[ element.name ], argument.messages ); + } + break; + case "remove": + if ( !argument ) { + delete staticRules[ element.name ]; + return existingRules; + } + filtered = {}; + $.each( argument.split( /\s/ ), function( index, method ) { + filtered[ method ] = existingRules[ method ]; + delete existingRules[ method ]; + if ( method === "required" ) { + $( element ).removeAttr( "aria-required" ); + } + }); + return filtered; + } + } + + data = $.validator.normalizeRules( + $.extend( + {}, + $.validator.classRules( element ), + $.validator.attributeRules( element ), + $.validator.dataRules( element ), + $.validator.staticRules( element ) + ), element ); + + // make sure required is at front + if ( data.required ) { + param = data.required; + delete data.required; + data = $.extend( { required: param }, data ); + $( element ).attr( "aria-required", "true" ); + } + + // make sure remote is at back + if ( data.remote ) { + param = data.remote; + delete data.remote; + data = $.extend( data, { remote: param }); + } + + return data; + } +}); + +// Custom selectors +$.extend( $.expr[ ":" ], { + // http://jqueryvalidation.org/blank-selector/ + blank: function( a ) { + return !$.trim( "" + $( a ).val() ); + }, + // http://jqueryvalidation.org/filled-selector/ + filled: function( a ) { + return !!$.trim( "" + $( a ).val() ); + }, + // http://jqueryvalidation.org/unchecked-selector/ + unchecked: function( a ) { + return !$( a ).prop( "checked" ); + } +}); + +// constructor for validator +$.validator = function( options, form ) { + this.settings = $.extend( true, {}, $.validator.defaults, options ); + this.currentForm = form; + this.init(); +}; + +// http://jqueryvalidation.org/jQuery.validator.format/ +$.validator.format = function( source, params ) { + if ( arguments.length === 1 ) { + return function() { + var args = $.makeArray( arguments ); + args.unshift( source ); + return $.validator.format.apply( this, args ); + }; + } + if ( arguments.length > 2 && params.constructor !== Array ) { + params = $.makeArray( arguments ).slice( 1 ); + } + if ( params.constructor !== Array ) { + params = [ params ]; + } + $.each( params, function( i, n ) { + source = source.replace( new RegExp( "\\{" + i + "\\}", "g" ), function() { + return n; + }); + }); + return source; +}; + +$.extend( $.validator, { + + defaults: { + messages: {}, + groups: {}, + rules: {}, + errorClass: "error", + validClass: "valid", + errorElement: "label", + focusCleanup: false, + focusInvalid: true, + errorContainer: $( [] ), + errorLabelContainer: $( [] ), + onsubmit: true, + ignore: ":hidden", + ignoreTitle: false, + onfocusin: function( element ) { + this.lastActive = element; + + // Hide error label and remove error class on focus if enabled + if ( this.settings.focusCleanup ) { + if ( this.settings.unhighlight ) { + this.settings.unhighlight.call( this, element, this.settings.errorClass, this.settings.validClass ); + } + this.hideThese( this.errorsFor( element ) ); + } + }, + onfocusout: function( element ) { + if ( !this.checkable( element ) && ( element.name in this.submitted || !this.optional( element ) ) ) { + this.element( element ); + } + }, + onkeyup: function( element, event ) { + // Avoid revalidate the field when pressing one of the following keys + // Shift => 16 + // Ctrl => 17 + // Alt => 18 + // Caps lock => 20 + // End => 35 + // Home => 36 + // Left arrow => 37 + // Up arrow => 38 + // Right arrow => 39 + // Down arrow => 40 + // Insert => 45 + // Num lock => 144 + // AltGr key => 225 + var excludedKeys = [ + 16, 17, 18, 20, 35, 36, 37, + 38, 39, 40, 45, 144, 225 + ]; + + if ( event.which === 9 && this.elementValue( element ) === "" || $.inArray( event.keyCode, excludedKeys ) !== -1 ) { + return; + } else if ( element.name in this.submitted || element === this.lastElement ) { + this.element( element ); + } + }, + onclick: function( element ) { + // click on selects, radiobuttons and checkboxes + if ( element.name in this.submitted ) { + this.element( element ); + + // or option elements, check parent select in that case + } else if ( element.parentNode.name in this.submitted ) { + this.element( element.parentNode ); + } + }, + highlight: function( element, errorClass, validClass ) { + if ( element.type === "radio" ) { + this.findByName( element.name ).addClass( errorClass ).removeClass( validClass ); + } else { + $( element ).addClass( errorClass ).removeClass( validClass ); + } + }, + unhighlight: function( element, errorClass, validClass ) { + if ( element.type === "radio" ) { + this.findByName( element.name ).removeClass( errorClass ).addClass( validClass ); + } else { + $( element ).removeClass( errorClass ).addClass( validClass ); + } + } + }, + + // http://jqueryvalidation.org/jQuery.validator.setDefaults/ + setDefaults: function( settings ) { + $.extend( $.validator.defaults, settings ); + }, + + messages: { + required: "This field is required.", + remote: "Please fix this field.", + email: "Please enter a valid email address.", + url: "Please enter a valid URL.", + date: "Please enter a valid date.", + dateISO: "Please enter a valid date ( ISO ).", + number: "Please enter a valid number.", + digits: "Please enter only digits.", + creditcard: "Please enter a valid credit card number.", + equalTo: "Please enter the same value again.", + maxlength: $.validator.format( "Please enter no more than {0} characters." ), + minlength: $.validator.format( "Please enter at least {0} characters." ), + rangelength: $.validator.format( "Please enter a value between {0} and {1} characters long." ), + range: $.validator.format( "Please enter a value between {0} and {1}." ), + max: $.validator.format( "Please enter a value less than or equal to {0}." ), + min: $.validator.format( "Please enter a value greater than or equal to {0}." ) + }, + + autoCreateRanges: false, + + prototype: { + + init: function() { + this.labelContainer = $( this.settings.errorLabelContainer ); + this.errorContext = this.labelContainer.length && this.labelContainer || $( this.currentForm ); + this.containers = $( this.settings.errorContainer ).add( this.settings.errorLabelContainer ); + this.submitted = {}; + this.valueCache = {}; + this.pendingRequest = 0; + this.pending = {}; + this.invalid = {}; + this.reset(); + + var groups = ( this.groups = {} ), + rules; + $.each( this.settings.groups, function( key, value ) { + if ( typeof value === "string" ) { + value = value.split( /\s/ ); + } + $.each( value, function( index, name ) { + groups[ name ] = key; + }); + }); + rules = this.settings.rules; + $.each( rules, function( key, value ) { + rules[ key ] = $.validator.normalizeRule( value ); + }); + + function delegate( event ) { + var validator = $.data( this.form, "validator" ), + eventType = "on" + event.type.replace( /^validate/, "" ), + settings = validator.settings; + if ( settings[ eventType ] && !$( this ).is( settings.ignore ) ) { + settings[ eventType ].call( validator, this, event ); + } + } + + $( this.currentForm ) + .on( "focusin.validate focusout.validate keyup.validate", + ":text, [type='password'], [type='file'], select, textarea, [type='number'], [type='search'], " + + "[type='tel'], [type='url'], [type='email'], [type='datetime'], [type='date'], [type='month'], " + + "[type='week'], [type='time'], [type='datetime-local'], [type='range'], [type='color'], " + + "[type='radio'], [type='checkbox']", delegate) + // Support: Chrome, oldIE + // "select" is provided as event.target when clicking a option + .on("click.validate", "select, option, [type='radio'], [type='checkbox']", delegate); + + if ( this.settings.invalidHandler ) { + $( this.currentForm ).on( "invalid-form.validate", this.settings.invalidHandler ); + } + + // Add aria-required to any Static/Data/Class required fields before first validation + // Screen readers require this attribute to be present before the initial submission http://www.w3.org/TR/WCAG-TECHS/ARIA2.html + $( this.currentForm ).find( "[required], [data-rule-required], .required" ).attr( "aria-required", "true" ); + }, + + // http://jqueryvalidation.org/Validator.form/ + form: function() { + this.checkForm(); + $.extend( this.submitted, this.errorMap ); + this.invalid = $.extend({}, this.errorMap ); + if ( !this.valid() ) { + $( this.currentForm ).triggerHandler( "invalid-form", [ this ]); + } + this.showErrors(); + return this.valid(); + }, + + checkForm: function() { + this.prepareForm(); + for ( var i = 0, elements = ( this.currentElements = this.elements() ); elements[ i ]; i++ ) { + this.check( elements[ i ] ); + } + return this.valid(); + }, + + // http://jqueryvalidation.org/Validator.element/ + element: function( element ) { + var cleanElement = this.clean( element ), + checkElement = this.validationTargetFor( cleanElement ), + result = true; + + this.lastElement = checkElement; + + if ( checkElement === undefined ) { + delete this.invalid[ cleanElement.name ]; + } else { + this.prepareElement( checkElement ); + this.currentElements = $( checkElement ); + + result = this.check( checkElement ) !== false; + if ( result ) { + delete this.invalid[ checkElement.name ]; + } else { + this.invalid[ checkElement.name ] = true; + } + } + // Add aria-invalid status for screen readers + $( element ).attr( "aria-invalid", !result ); + + if ( !this.numberOfInvalids() ) { + // Hide error containers on last error + this.toHide = this.toHide.add( this.containers ); + } + this.showErrors(); + return result; + }, + + // http://jqueryvalidation.org/Validator.showErrors/ + showErrors: function( errors ) { + if ( errors ) { + // add items to error list and map + $.extend( this.errorMap, errors ); + this.errorList = []; + for ( var name in errors ) { + this.errorList.push({ + message: errors[ name ], + element: this.findByName( name )[ 0 ] + }); + } + // remove items from success list + this.successList = $.grep( this.successList, function( element ) { + return !( element.name in errors ); + }); + } + if ( this.settings.showErrors ) { + this.settings.showErrors.call( this, this.errorMap, this.errorList ); + } else { + this.defaultShowErrors(); + } + }, + + // http://jqueryvalidation.org/Validator.resetForm/ + resetForm: function() { + if ( $.fn.resetForm ) { + $( this.currentForm ).resetForm(); + } + this.submitted = {}; + this.lastElement = null; + this.prepareForm(); + this.hideErrors(); + var i, elements = this.elements() + .removeData( "previousValue" ) + .removeAttr( "aria-invalid" ); + + if ( this.settings.unhighlight ) { + for ( i = 0; elements[ i ]; i++ ) { + this.settings.unhighlight.call( this, elements[ i ], + this.settings.errorClass, "" ); + } + } else { + elements.removeClass( this.settings.errorClass ); + } + }, + + numberOfInvalids: function() { + return this.objectLength( this.invalid ); + }, + + objectLength: function( obj ) { + /* jshint unused: false */ + var count = 0, + i; + for ( i in obj ) { + count++; + } + return count; + }, + + hideErrors: function() { + this.hideThese( this.toHide ); + }, + + hideThese: function( errors ) { + errors.not( this.containers ).text( "" ); + this.addWrapper( errors ).hide(); + }, + + valid: function() { + return this.size() === 0; + }, + + size: function() { + return this.errorList.length; + }, + + focusInvalid: function() { + if ( this.settings.focusInvalid ) { + try { + $( this.findLastActive() || this.errorList.length && this.errorList[ 0 ].element || []) + .filter( ":visible" ) + .focus() + // manually trigger focusin event; without it, focusin handler isn't called, findLastActive won't have anything to find + .trigger( "focusin" ); + } catch ( e ) { + // ignore IE throwing errors when focusing hidden elements + } + } + }, + + findLastActive: function() { + var lastActive = this.lastActive; + return lastActive && $.grep( this.errorList, function( n ) { + return n.element.name === lastActive.name; + }).length === 1 && lastActive; + }, + + elements: function() { + var validator = this, + rulesCache = {}; + + // select all valid inputs inside the form (no submit or reset buttons) + return $( this.currentForm ) + .find( "input, select, textarea" ) + .not( ":submit, :reset, :image, :disabled" ) + .not( this.settings.ignore ) + .filter( function() { + if ( !this.name && validator.settings.debug && window.console ) { + console.error( "%o has no name assigned", this ); + } + + // select only the first element for each name, and only those with rules specified + if ( this.name in rulesCache || !validator.objectLength( $( this ).rules() ) ) { + return false; + } + + rulesCache[ this.name ] = true; + return true; + }); + }, + + clean: function( selector ) { + return $( selector )[ 0 ]; + }, + + errors: function() { + var errorClass = this.settings.errorClass.split( " " ).join( "." ); + return $( this.settings.errorElement + "." + errorClass, this.errorContext ); + }, + + reset: function() { + this.successList = []; + this.errorList = []; + this.errorMap = {}; + this.toShow = $( [] ); + this.toHide = $( [] ); + this.currentElements = $( [] ); + }, + + prepareForm: function() { + this.reset(); + this.toHide = this.errors().add( this.containers ); + }, + + prepareElement: function( element ) { + this.reset(); + this.toHide = this.errorsFor( element ); + }, + + elementValue: function( element ) { + var val, + $element = $( element ), + type = element.type; + + if ( type === "radio" || type === "checkbox" ) { + return this.findByName( element.name ).filter(":checked").val(); + } else if ( type === "number" && typeof element.validity !== "undefined" ) { + return element.validity.badInput ? false : $element.val(); + } + + val = $element.val(); + if ( typeof val === "string" ) { + return val.replace(/\r/g, "" ); + } + return val; + }, + + check: function( element ) { + element = this.validationTargetFor( this.clean( element ) ); + + var rules = $( element ).rules(), + rulesCount = $.map( rules, function( n, i ) { + return i; + }).length, + dependencyMismatch = false, + val = this.elementValue( element ), + result, method, rule; + + for ( method in rules ) { + rule = { method: method, parameters: rules[ method ] }; + try { + + result = $.validator.methods[ method ].call( this, val, element, rule.parameters ); + + // if a method indicates that the field is optional and therefore valid, + // don't mark it as valid when there are no other rules + if ( result === "dependency-mismatch" && rulesCount === 1 ) { + dependencyMismatch = true; + continue; + } + dependencyMismatch = false; + + if ( result === "pending" ) { + this.toHide = this.toHide.not( this.errorsFor( element ) ); + return; + } + + if ( !result ) { + this.formatAndAdd( element, rule ); + return false; + } + } catch ( e ) { + if ( this.settings.debug && window.console ) { + console.log( "Exception occurred when checking element " + element.id + ", check the '" + rule.method + "' method.", e ); + } + if ( e instanceof TypeError ) { + e.message += ". Exception occurred when checking element " + element.id + ", check the '" + rule.method + "' method."; + } + + throw e; + } + } + if ( dependencyMismatch ) { + return; + } + if ( this.objectLength( rules ) ) { + this.successList.push( element ); + } + return true; + }, + + // return the custom message for the given element and validation method + // specified in the element's HTML5 data attribute + // return the generic message if present and no method specific message is present + customDataMessage: function( element, method ) { + return $( element ).data( "msg" + method.charAt( 0 ).toUpperCase() + + method.substring( 1 ).toLowerCase() ) || $( element ).data( "msg" ); + }, + + // return the custom message for the given element name and validation method + customMessage: function( name, method ) { + var m = this.settings.messages[ name ]; + return m && ( m.constructor === String ? m : m[ method ]); + }, + + // return the first defined argument, allowing empty strings + findDefined: function() { + for ( var i = 0; i < arguments.length; i++) { + if ( arguments[ i ] !== undefined ) { + return arguments[ i ]; + } + } + return undefined; + }, + + defaultMessage: function( element, method ) { + return this.findDefined( + this.customMessage( element.name, method ), + this.customDataMessage( element, method ), + // title is never undefined, so handle empty string as undefined + !this.settings.ignoreTitle && element.title || undefined, + $.validator.messages[ method ], + "Warning: No message defined for " + element.name + "" + ); + }, + + formatAndAdd: function( element, rule ) { + var message = this.defaultMessage( element, rule.method ), + theregex = /\$?\{(\d+)\}/g; + if ( typeof message === "function" ) { + message = message.call( this, rule.parameters, element ); + } else if ( theregex.test( message ) ) { + message = $.validator.format( message.replace( theregex, "{$1}" ), rule.parameters ); + } + this.errorList.push({ + message: message, + element: element, + method: rule.method + }); + + this.errorMap[ element.name ] = message; + this.submitted[ element.name ] = message; + }, + + addWrapper: function( toToggle ) { + if ( this.settings.wrapper ) { + toToggle = toToggle.add( toToggle.parent( this.settings.wrapper ) ); + } + return toToggle; + }, + + defaultShowErrors: function() { + var i, elements, error; + for ( i = 0; this.errorList[ i ]; i++ ) { + error = this.errorList[ i ]; + if ( this.settings.highlight ) { + this.settings.highlight.call( this, error.element, this.settings.errorClass, this.settings.validClass ); + } + this.showLabel( error.element, error.message ); + } + if ( this.errorList.length ) { + this.toShow = this.toShow.add( this.containers ); + } + if ( this.settings.success ) { + for ( i = 0; this.successList[ i ]; i++ ) { + this.showLabel( this.successList[ i ] ); + } + } + if ( this.settings.unhighlight ) { + for ( i = 0, elements = this.validElements(); elements[ i ]; i++ ) { + this.settings.unhighlight.call( this, elements[ i ], this.settings.errorClass, this.settings.validClass ); + } + } + this.toHide = this.toHide.not( this.toShow ); + this.hideErrors(); + this.addWrapper( this.toShow ).show(); + }, + + validElements: function() { + return this.currentElements.not( this.invalidElements() ); + }, + + invalidElements: function() { + return $( this.errorList ).map(function() { + return this.element; + }); + }, + + showLabel: function( element, message ) { + var place, group, errorID, + error = this.errorsFor( element ), + elementID = this.idOrName( element ), + describedBy = $( element ).attr( "aria-describedby" ); + if ( error.length ) { + // refresh error/success class + error.removeClass( this.settings.validClass ).addClass( this.settings.errorClass ); + // replace message on existing label + error.html( message ); + } else { + // create error element + error = $( "<" + this.settings.errorElement + ">" ) + .attr( "id", elementID + "-error" ) + .addClass( this.settings.errorClass ) + .html( message || "" ); + + // Maintain reference to the element to be placed into the DOM + place = error; + if ( this.settings.wrapper ) { + // make sure the element is visible, even in IE + // actually showing the wrapped element is handled elsewhere + place = error.hide().show().wrap( "<" + this.settings.wrapper + "/>" ).parent(); + } + if ( this.labelContainer.length ) { + this.labelContainer.append( place ); + } else if ( this.settings.errorPlacement ) { + this.settings.errorPlacement( place, $( element ) ); + } else { + place.insertAfter( element ); + } + + // Link error back to the element + if ( error.is( "label" ) ) { + // If the error is a label, then associate using 'for' + error.attr( "for", elementID ); + } else if ( error.parents( "label[for='" + elementID + "']" ).length === 0 ) { + // If the element is not a child of an associated label, then it's necessary + // to explicitly apply aria-describedby + + errorID = error.attr( "id" ).replace( /(:|\.|\[|\]|\$)/g, "\\$1"); + // Respect existing non-error aria-describedby + if ( !describedBy ) { + describedBy = errorID; + } else if ( !describedBy.match( new RegExp( "\\b" + errorID + "\\b" ) ) ) { + // Add to end of list if not already present + describedBy += " " + errorID; + } + $( element ).attr( "aria-describedby", describedBy ); + + // If this element is grouped, then assign to all elements in the same group + group = this.groups[ element.name ]; + if ( group ) { + $.each( this.groups, function( name, testgroup ) { + if ( testgroup === group ) { + $( "[name='" + name + "']", this.currentForm ) + .attr( "aria-describedby", error.attr( "id" ) ); + } + }); + } + } + } + if ( !message && this.settings.success ) { + error.text( "" ); + if ( typeof this.settings.success === "string" ) { + error.addClass( this.settings.success ); + } else { + this.settings.success( error, element ); + } + } + this.toShow = this.toShow.add( error ); + }, + + errorsFor: function( element ) { + var name = this.idOrName( element ), + describer = $( element ).attr( "aria-describedby" ), + selector = "label[for='" + name + "'], label[for='" + name + "'] *"; + + // aria-describedby should directly reference the error element + if ( describer ) { + selector = selector + ", #" + describer.replace( /\s+/g, ", #" ); + } + return this + .errors() + .filter( selector ); + }, + + idOrName: function( element ) { + return this.groups[ element.name ] || ( this.checkable( element ) ? element.name : element.id || element.name ); + }, + + validationTargetFor: function( element ) { + + // If radio/checkbox, validate first element in group instead + if ( this.checkable( element ) ) { + element = this.findByName( element.name ); + } + + // Always apply ignore filter + return $( element ).not( this.settings.ignore )[ 0 ]; + }, + + checkable: function( element ) { + return ( /radio|checkbox/i ).test( element.type ); + }, + + findByName: function( name ) { + return $( this.currentForm ).find( "[name='" + name + "']" ); + }, + + getLength: function( value, element ) { + switch ( element.nodeName.toLowerCase() ) { + case "select": + return $( "option:selected", element ).length; + case "input": + if ( this.checkable( element ) ) { + return this.findByName( element.name ).filter( ":checked" ).length; + } + } + return value.length; + }, + + depend: function( param, element ) { + return this.dependTypes[typeof param] ? this.dependTypes[typeof param]( param, element ) : true; + }, + + dependTypes: { + "boolean": function( param ) { + return param; + }, + "string": function( param, element ) { + return !!$( param, element.form ).length; + }, + "function": function( param, element ) { + return param( element ); + } + }, + + optional: function( element ) { + var val = this.elementValue( element ); + return !$.validator.methods.required.call( this, val, element ) && "dependency-mismatch"; + }, + + startRequest: function( element ) { + if ( !this.pending[ element.name ] ) { + this.pendingRequest++; + this.pending[ element.name ] = true; + } + }, + + stopRequest: function( element, valid ) { + this.pendingRequest--; + // sometimes synchronization fails, make sure pendingRequest is never < 0 + if ( this.pendingRequest < 0 ) { + this.pendingRequest = 0; + } + delete this.pending[ element.name ]; + if ( valid && this.pendingRequest === 0 && this.formSubmitted && this.form() ) { + $( this.currentForm ).submit(); + this.formSubmitted = false; + } else if (!valid && this.pendingRequest === 0 && this.formSubmitted ) { + $( this.currentForm ).triggerHandler( "invalid-form", [ this ]); + this.formSubmitted = false; + } + }, + + previousValue: function( element ) { + return $.data( element, "previousValue" ) || $.data( element, "previousValue", { + old: null, + valid: true, + message: this.defaultMessage( element, "remote" ) + }); + }, + + // cleans up all forms and elements, removes validator-specific events + destroy: function() { + this.resetForm(); + + $( this.currentForm ) + .off( ".validate" ) + .removeData( "validator" ); + } + + }, + + classRuleSettings: { + required: { required: true }, + email: { email: true }, + url: { url: true }, + date: { date: true }, + dateISO: { dateISO: true }, + number: { number: true }, + digits: { digits: true }, + creditcard: { creditcard: true } + }, + + addClassRules: function( className, rules ) { + if ( className.constructor === String ) { + this.classRuleSettings[ className ] = rules; + } else { + $.extend( this.classRuleSettings, className ); + } + }, + + classRules: function( element ) { + var rules = {}, + classes = $( element ).attr( "class" ); + + if ( classes ) { + $.each( classes.split( " " ), function() { + if ( this in $.validator.classRuleSettings ) { + $.extend( rules, $.validator.classRuleSettings[ this ]); + } + }); + } + return rules; + }, + + normalizeAttributeRule: function( rules, type, method, value ) { + + // convert the value to a number for number inputs, and for text for backwards compability + // allows type="date" and others to be compared as strings + if ( /min|max/.test( method ) && ( type === null || /number|range|text/.test( type ) ) ) { + value = Number( value ); + + // Support Opera Mini, which returns NaN for undefined minlength + if ( isNaN( value ) ) { + value = undefined; + } + } + + if ( value || value === 0 ) { + rules[ method ] = value; + } else if ( type === method && type !== "range" ) { + + // exception: the jquery validate 'range' method + // does not test for the html5 'range' type + rules[ method ] = true; + } + }, + + attributeRules: function( element ) { + var rules = {}, + $element = $( element ), + type = element.getAttribute( "type" ), + method, value; + + for ( method in $.validator.methods ) { + + // support for in both html5 and older browsers + if ( method === "required" ) { + value = element.getAttribute( method ); + + // Some browsers return an empty string for the required attribute + // and non-HTML5 browsers might have required="" markup + if ( value === "" ) { + value = true; + } + + // force non-HTML5 browsers to return bool + value = !!value; + } else { + value = $element.attr( method ); + } + + this.normalizeAttributeRule( rules, type, method, value ); + } + + // maxlength may be returned as -1, 2147483647 ( IE ) and 524288 ( safari ) for text inputs + if ( rules.maxlength && /-1|2147483647|524288/.test( rules.maxlength ) ) { + delete rules.maxlength; + } + + return rules; + }, + + dataRules: function( element ) { + var rules = {}, + $element = $( element ), + type = element.getAttribute( "type" ), + method, value; + + for ( method in $.validator.methods ) { + value = $element.data( "rule" + method.charAt( 0 ).toUpperCase() + method.substring( 1 ).toLowerCase() ); + this.normalizeAttributeRule( rules, type, method, value ); + } + return rules; + }, + + staticRules: function( element ) { + var rules = {}, + validator = $.data( element.form, "validator" ); + + if ( validator.settings.rules ) { + rules = $.validator.normalizeRule( validator.settings.rules[ element.name ] ) || {}; + } + return rules; + }, + + normalizeRules: function( rules, element ) { + // handle dependency check + $.each( rules, function( prop, val ) { + // ignore rule when param is explicitly false, eg. required:false + if ( val === false ) { + delete rules[ prop ]; + return; + } + if ( val.param || val.depends ) { + var keepRule = true; + switch ( typeof val.depends ) { + case "string": + keepRule = !!$( val.depends, element.form ).length; + break; + case "function": + keepRule = val.depends.call( element, element ); + break; + } + if ( keepRule ) { + rules[ prop ] = val.param !== undefined ? val.param : true; + } else { + delete rules[ prop ]; + } + } + }); + + // evaluate parameters + $.each( rules, function( rule, parameter ) { + rules[ rule ] = $.isFunction( parameter ) ? parameter( element ) : parameter; + }); + + // clean number parameters + $.each([ "minlength", "maxlength" ], function() { + if ( rules[ this ] ) { + rules[ this ] = Number( rules[ this ] ); + } + }); + $.each([ "rangelength", "range" ], function() { + var parts; + if ( rules[ this ] ) { + if ( $.isArray( rules[ this ] ) ) { + rules[ this ] = [ Number( rules[ this ][ 0 ]), Number( rules[ this ][ 1 ] ) ]; + } else if ( typeof rules[ this ] === "string" ) { + parts = rules[ this ].replace(/[\[\]]/g, "" ).split( /[\s,]+/ ); + rules[ this ] = [ Number( parts[ 0 ]), Number( parts[ 1 ] ) ]; + } + } + }); + + if ( $.validator.autoCreateRanges ) { + // auto-create ranges + if ( rules.min != null && rules.max != null ) { + rules.range = [ rules.min, rules.max ]; + delete rules.min; + delete rules.max; + } + if ( rules.minlength != null && rules.maxlength != null ) { + rules.rangelength = [ rules.minlength, rules.maxlength ]; + delete rules.minlength; + delete rules.maxlength; + } + } + + return rules; + }, + + // Converts a simple string to a {string: true} rule, e.g., "required" to {required:true} + normalizeRule: function( data ) { + if ( typeof data === "string" ) { + var transformed = {}; + $.each( data.split( /\s/ ), function() { + transformed[ this ] = true; + }); + data = transformed; + } + return data; + }, + + // http://jqueryvalidation.org/jQuery.validator.addMethod/ + addMethod: function( name, method, message ) { + $.validator.methods[ name ] = method; + $.validator.messages[ name ] = message !== undefined ? message : $.validator.messages[ name ]; + if ( method.length < 3 ) { + $.validator.addClassRules( name, $.validator.normalizeRule( name ) ); + } + }, + + methods: { + + // http://jqueryvalidation.org/required-method/ + required: function( value, element, param ) { + // check if dependency is met + if ( !this.depend( param, element ) ) { + return "dependency-mismatch"; + } + if ( element.nodeName.toLowerCase() === "select" ) { + // could be an array for select-multiple or a string, both are fine this way + var val = $( element ).val(); + return val && val.length > 0; + } + if ( this.checkable( element ) ) { + return this.getLength( value, element ) > 0; + } + return value.length > 0; + }, + + // http://jqueryvalidation.org/email-method/ + email: function( value, element ) { + // From https://html.spec.whatwg.org/multipage/forms.html#valid-e-mail-address + // Retrieved 2014-01-14 + // If you have a problem with this implementation, report a bug against the above spec + // Or use custom methods to implement your own email validation + return this.optional( element ) || /^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/.test( value ); + }, + + // http://jqueryvalidation.org/url-method/ + url: function( value, element ) { + + // Copyright (c) 2010-2013 Diego Perini, MIT licensed + // https://gist.github.com/dperini/729294 + // see also https://mathiasbynens.be/demo/url-regex + // modified to allow protocol-relative URLs + return this.optional( element ) || /^(?:(?:(?:https?|ftp):)?\/\/)(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)(?:\.(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)*(?:\.(?:[a-z\u00a1-\uffff]{2,})).?)(?::\d{2,5})?(?:[/?#]\S*)?$/i.test( value ); + }, + + // http://jqueryvalidation.org/date-method/ + date: function( value, element ) { + return this.optional( element ) || !/Invalid|NaN/.test( new Date( value ).toString() ); + }, + + // http://jqueryvalidation.org/dateISO-method/ + dateISO: function( value, element ) { + return this.optional( element ) || /^\d{4}[\/\-](0?[1-9]|1[012])[\/\-](0?[1-9]|[12][0-9]|3[01])$/.test( value ); + }, + + // http://jqueryvalidation.org/number-method/ + number: function( value, element ) { + return this.optional( element ) || /^(?:-?\d+|-?\d{1,3}(?:,\d{3})+)?(?:\.\d+)?$/.test( value ); + }, + + // http://jqueryvalidation.org/digits-method/ + digits: function( value, element ) { + return this.optional( element ) || /^\d+$/.test( value ); + }, + + // http://jqueryvalidation.org/creditcard-method/ + // based on http://en.wikipedia.org/wiki/Luhn_algorithm + creditcard: function( value, element ) { + if ( this.optional( element ) ) { + return "dependency-mismatch"; + } + // accept only spaces, digits and dashes + if ( /[^0-9 \-]+/.test( value ) ) { + return false; + } + var nCheck = 0, + nDigit = 0, + bEven = false, + n, cDigit; + + value = value.replace( /\D/g, "" ); + + // Basing min and max length on + // http://developer.ean.com/general_info/Valid_Credit_Card_Types + if ( value.length < 13 || value.length > 19 ) { + return false; + } + + for ( n = value.length - 1; n >= 0; n--) { + cDigit = value.charAt( n ); + nDigit = parseInt( cDigit, 10 ); + if ( bEven ) { + if ( ( nDigit *= 2 ) > 9 ) { + nDigit -= 9; + } + } + nCheck += nDigit; + bEven = !bEven; + } + + return ( nCheck % 10 ) === 0; + }, + + // http://jqueryvalidation.org/minlength-method/ + minlength: function( value, element, param ) { + var length = $.isArray( value ) ? value.length : this.getLength( value, element ); + return this.optional( element ) || length >= param; + }, + + // http://jqueryvalidation.org/maxlength-method/ + maxlength: function( value, element, param ) { + var length = $.isArray( value ) ? value.length : this.getLength( value, element ); + return this.optional( element ) || length <= param; + }, + + // http://jqueryvalidation.org/rangelength-method/ + rangelength: function( value, element, param ) { + var length = $.isArray( value ) ? value.length : this.getLength( value, element ); + return this.optional( element ) || ( length >= param[ 0 ] && length <= param[ 1 ] ); + }, + + // http://jqueryvalidation.org/min-method/ + min: function( value, element, param ) { + return this.optional( element ) || value >= param; + }, + + // http://jqueryvalidation.org/max-method/ + max: function( value, element, param ) { + return this.optional( element ) || value <= param; + }, + + // http://jqueryvalidation.org/range-method/ + range: function( value, element, param ) { + return this.optional( element ) || ( value >= param[ 0 ] && value <= param[ 1 ] ); + }, + + // http://jqueryvalidation.org/equalTo-method/ + equalTo: function( value, element, param ) { + // bind to the blur event of the target in order to revalidate whenever the target field is updated + // TODO find a way to bind the event just once, avoiding the unbind-rebind overhead + var target = $( param ); + if ( this.settings.onfocusout ) { + target.off( ".validate-equalTo" ).on( "blur.validate-equalTo", function() { + $( element ).valid(); + }); + } + return value === target.val(); + }, + + // http://jqueryvalidation.org/remote-method/ + remote: function( value, element, param ) { + if ( this.optional( element ) ) { + return "dependency-mismatch"; + } + + var previous = this.previousValue( element ), + validator, data; + + if (!this.settings.messages[ element.name ] ) { + this.settings.messages[ element.name ] = {}; + } + previous.originalMessage = this.settings.messages[ element.name ].remote; + this.settings.messages[ element.name ].remote = previous.message; + + param = typeof param === "string" && { url: param } || param; + + if ( previous.old === value ) { + return previous.valid; + } + + previous.old = value; + validator = this; + this.startRequest( element ); + data = {}; + data[ element.name ] = value; + $.ajax( $.extend( true, { + mode: "abort", + port: "validate" + element.name, + dataType: "json", + data: data, + context: validator.currentForm, + success: function( response ) { + var valid = response === true || response === "true", + errors, message, submitted; + + validator.settings.messages[ element.name ].remote = previous.originalMessage; + if ( valid ) { + submitted = validator.formSubmitted; + validator.prepareElement( element ); + validator.formSubmitted = submitted; + validator.successList.push( element ); + delete validator.invalid[ element.name ]; + validator.showErrors(); + } else { + errors = {}; + message = response || validator.defaultMessage( element, "remote" ); + errors[ element.name ] = previous.message = $.isFunction( message ) ? message( value ) : message; + validator.invalid[ element.name ] = true; + validator.showErrors( errors ); + } + previous.valid = valid; + validator.stopRequest( element, valid ); + } + }, param ) ); + return "pending"; + } + } + +}); + +// ajax mode: abort +// usage: $.ajax({ mode: "abort"[, port: "uniqueport"]}); +// if mode:"abort" is used, the previous request on that port (port can be undefined) is aborted via XMLHttpRequest.abort() + +var pendingRequests = {}, + ajax; +// Use a prefilter if available (1.5+) +if ( $.ajaxPrefilter ) { + $.ajaxPrefilter(function( settings, _, xhr ) { + var port = settings.port; + if ( settings.mode === "abort" ) { + if ( pendingRequests[port] ) { + pendingRequests[port].abort(); + } + pendingRequests[port] = xhr; + } + }); +} else { + // Proxy ajax + ajax = $.ajax; + $.ajax = function( settings ) { + var mode = ( "mode" in settings ? settings : $.ajaxSettings ).mode, + port = ( "port" in settings ? settings : $.ajaxSettings ).port; + if ( mode === "abort" ) { + if ( pendingRequests[port] ) { + pendingRequests[port].abort(); + } + pendingRequests[port] = ajax.apply(this, arguments); + return pendingRequests[port]; + } + return ajax.apply(this, arguments); + }; +} + +})); \ No newline at end of file diff --git a/public/bower_components/jquery.actual/jquery.actual.js b/public/bower_components/jquery.actual/jquery.actual.js new file mode 100644 index 0000000..a4455d5 --- /dev/null +++ b/public/bower_components/jquery.actual/jquery.actual.js @@ -0,0 +1,107 @@ +/*! Copyright 2012, Ben Lin (http://dreamerslab.com/) + * Licensed under the MIT License (LICENSE.txt). + * + * Version: 1.0.16 + * + * Requires: jQuery >= 1.2.3 + */ +;( function ( factory ) { +if ( typeof define === 'function' && define.amd ) { + // AMD. Register module depending on jQuery using requirejs define. + define( ['jquery'], factory ); +} else { + // No AMD. + factory( jQuery ); +} +}( function ( $ ){ + $.fn.addBack = $.fn.addBack || $.fn.andSelf; + + $.fn.extend({ + + actual : function ( method, options ){ + // check if the jQuery method exist + if( !this[ method ]){ + throw '$.actual => The jQuery method "' + method + '" you called does not exist'; + } + + var defaults = { + absolute : false, + clone : false, + includeMargin : false, + display : 'block' + }; + + var configs = $.extend( defaults, options ); + + var $target = this.eq( 0 ); + var fix, restore; + + if( configs.clone === true ){ + fix = function (){ + var style = 'position: absolute !important; top: -1000 !important; '; + + // this is useful with css3pie + $target = $target. + clone(). + attr( 'style', style ). + appendTo( 'body' ); + }; + + restore = function (){ + // remove DOM element after getting the width + $target.remove(); + }; + }else{ + var tmp = []; + var style = ''; + var $hidden; + + fix = function (){ + // get all hidden parents + $hidden = $target.parents().addBack().filter( ':hidden' ); + style += 'visibility: hidden !important; display: ' + configs.display + ' !important; '; + + if( configs.absolute === true ) style += 'position: absolute !important; '; + + // save the origin style props + // set the hidden el css to be got the actual value later + $hidden.each( function (){ + // Save original style. If no style was set, attr() returns undefined + var $this = $( this ); + var thisStyle = $this.attr( 'style' ); + + tmp.push( thisStyle ); + // Retain as much of the original style as possible, if there is one + $this.attr( 'style', thisStyle ? thisStyle + ';' + style : style ); + }); + }; + + restore = function (){ + // restore origin style values + $hidden.each( function ( i ){ + var $this = $( this ); + var _tmp = tmp[ i ]; + + if( _tmp === undefined ){ + $this.removeAttr( 'style' ); + }else{ + $this.attr( 'style', _tmp ); + } + }); + }; + } + + fix(); + // get the actual value with user specific methed + // it can be 'width', 'height', 'outerWidth', 'innerWidth'... etc + // configs.includeMargin only works for 'outerWidth' and 'outerHeight' + var actual = /(outer)/.test( method ) ? + $target[ method ]( configs.includeMargin ) : + $target[ method ](); + + restore(); + // IMPORTANT, this plugin only return the value of the first element + return actual; + } + }); +})); diff --git a/public/bower_components/jquery/jquery.js b/public/bower_components/jquery/jquery.js new file mode 100644 index 0000000..eed1777 --- /dev/null +++ b/public/bower_components/jquery/jquery.js @@ -0,0 +1,9210 @@ +/*! + * jQuery JavaScript Library v2.1.4 + * http://jquery.com/ + * + * Includes Sizzle.js + * http://sizzlejs.com/ + * + * Copyright 2005, 2014 jQuery Foundation, Inc. and other contributors + * Released under the MIT license + * http://jquery.org/license + * + * Date: 2015-04-28T16:01Z + */ + +(function( global, factory ) { + + if ( typeof module === "object" && typeof module.exports === "object" ) { + // For CommonJS and CommonJS-like environments where a proper `window` + // is present, execute the factory and get jQuery. + // For environments that do not have a `window` with a `document` + // (such as Node.js), expose a factory as module.exports. + // This accentuates the need for the creation of a real `window`. + // e.g. var jQuery = require("jquery")(window); + // See ticket #14549 for more info. + module.exports = global.document ? + factory( global, true ) : + function( w ) { + if ( !w.document ) { + throw new Error( "jQuery requires a window with a document" ); + } + return factory( w ); + }; + } else { + factory( global ); + } + +// Pass this if window is not defined yet +}(typeof window !== "undefined" ? window : this, function( window, noGlobal ) { + +// Support: Firefox 18+ +// Can't be in strict mode, several libs including ASP.NET trace +// the stack via arguments.caller.callee and Firefox dies if +// you try to trace through "use strict" call chains. (#13335) +// + +var arr = []; + +var slice = arr.slice; + +var concat = arr.concat; + +var push = arr.push; + +var indexOf = arr.indexOf; + +var class2type = {}; + +var toString = class2type.toString; + +var hasOwn = class2type.hasOwnProperty; + +var support = {}; + + + +var + // Use the correct document accordingly with window argument (sandbox) + document = window.document, + + version = "2.1.4", + + // Define a local copy of jQuery + jQuery = function( selector, context ) { + // The jQuery object is actually just the init constructor 'enhanced' + // Need init if jQuery is called (just allow error to be thrown if not included) + return new jQuery.fn.init( selector, context ); + }, + + // Support: Android<4.1 + // Make sure we trim BOM and NBSP + rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, + + // Matches dashed string for camelizing + rmsPrefix = /^-ms-/, + rdashAlpha = /-([\da-z])/gi, + + // Used by jQuery.camelCase as callback to replace() + fcamelCase = function( all, letter ) { + return letter.toUpperCase(); + }; + +jQuery.fn = jQuery.prototype = { + // The current version of jQuery being used + jquery: version, + + constructor: jQuery, + + // Start with an empty selector + selector: "", + + // The default length of a jQuery object is 0 + length: 0, + + toArray: function() { + return slice.call( this ); + }, + + // Get the Nth element in the matched element set OR + // Get the whole matched element set as a clean array + get: function( num ) { + return num != null ? + + // Return just the one element from the set + ( num < 0 ? this[ num + this.length ] : this[ num ] ) : + + // Return all the elements in a clean array + slice.call( this ); + }, + + // Take an array of elements and push it onto the stack + // (returning the new matched element set) + pushStack: function( elems ) { + + // Build a new jQuery matched element set + var ret = jQuery.merge( this.constructor(), elems ); + + // Add the old object onto the stack (as a reference) + ret.prevObject = this; + ret.context = this.context; + + // Return the newly-formed element set + return ret; + }, + + // Execute a callback for every element in the matched set. + // (You can seed the arguments with an array of args, but this is + // only used internally.) + each: function( callback, args ) { + return jQuery.each( this, callback, args ); + }, + + map: function( callback ) { + return this.pushStack( jQuery.map(this, function( elem, i ) { + return callback.call( elem, i, elem ); + })); + }, + + slice: function() { + return this.pushStack( slice.apply( this, arguments ) ); + }, + + first: function() { + return this.eq( 0 ); + }, + + last: function() { + return this.eq( -1 ); + }, + + eq: function( i ) { + var len = this.length, + j = +i + ( i < 0 ? len : 0 ); + return this.pushStack( j >= 0 && j < len ? [ this[j] ] : [] ); + }, + + end: function() { + return this.prevObject || this.constructor(null); + }, + + // For internal use only. + // Behaves like an Array's method, not like a jQuery method. + push: push, + sort: arr.sort, + splice: arr.splice +}; + +jQuery.extend = jQuery.fn.extend = function() { + var options, name, src, copy, copyIsArray, clone, + target = arguments[0] || {}, + i = 1, + length = arguments.length, + deep = false; + + // Handle a deep copy situation + if ( typeof target === "boolean" ) { + deep = target; + + // Skip the boolean and the target + target = arguments[ i ] || {}; + i++; + } + + // Handle case when target is a string or something (possible in deep copy) + if ( typeof target !== "object" && !jQuery.isFunction(target) ) { + target = {}; + } + + // Extend jQuery itself if only one argument is passed + if ( i === length ) { + target = this; + i--; + } + + for ( ; i < length; i++ ) { + // Only deal with non-null/undefined values + if ( (options = arguments[ i ]) != null ) { + // Extend the base object + for ( name in options ) { + src = target[ name ]; + copy = options[ name ]; + + // Prevent never-ending loop + if ( target === copy ) { + continue; + } + + // Recurse if we're merging plain objects or arrays + if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) { + if ( copyIsArray ) { + copyIsArray = false; + clone = src && jQuery.isArray(src) ? src : []; + + } else { + clone = src && jQuery.isPlainObject(src) ? src : {}; + } + + // Never move original objects, clone them + target[ name ] = jQuery.extend( deep, clone, copy ); + + // Don't bring in undefined values + } else if ( copy !== undefined ) { + target[ name ] = copy; + } + } + } + } + + // Return the modified object + return target; +}; + +jQuery.extend({ + // Unique for each copy of jQuery on the page + expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ), + + // Assume jQuery is ready without the ready module + isReady: true, + + error: function( msg ) { + throw new Error( msg ); + }, + + noop: function() {}, + + isFunction: function( obj ) { + return jQuery.type(obj) === "function"; + }, + + isArray: Array.isArray, + + isWindow: function( obj ) { + return obj != null && obj === obj.window; + }, + + isNumeric: function( obj ) { + // parseFloat NaNs numeric-cast false positives (null|true|false|"") + // ...but misinterprets leading-number strings, particularly hex literals ("0x...") + // subtraction forces infinities to NaN + // adding 1 corrects loss of precision from parseFloat (#15100) + return !jQuery.isArray( obj ) && (obj - parseFloat( obj ) + 1) >= 0; + }, + + isPlainObject: function( obj ) { + // Not plain objects: + // - Any object or value whose internal [[Class]] property is not "[object Object]" + // - DOM nodes + // - window + if ( jQuery.type( obj ) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) { + return false; + } + + if ( obj.constructor && + !hasOwn.call( obj.constructor.prototype, "isPrototypeOf" ) ) { + return false; + } + + // If the function hasn't returned already, we're confident that + // |obj| is a plain object, created by {} or constructed with new Object + return true; + }, + + isEmptyObject: function( obj ) { + var name; + for ( name in obj ) { + return false; + } + return true; + }, + + type: function( obj ) { + if ( obj == null ) { + return obj + ""; + } + // Support: Android<4.0, iOS<6 (functionish RegExp) + return typeof obj === "object" || typeof obj === "function" ? + class2type[ toString.call(obj) ] || "object" : + typeof obj; + }, + + // Evaluates a script in a global context + globalEval: function( code ) { + var script, + indirect = eval; + + code = jQuery.trim( code ); + + if ( code ) { + // If the code includes a valid, prologue position + // strict mode pragma, execute code by injecting a + // script tag into the document. + if ( code.indexOf("use strict") === 1 ) { + script = document.createElement("script"); + script.text = code; + document.head.appendChild( script ).parentNode.removeChild( script ); + } else { + // Otherwise, avoid the DOM node creation, insertion + // and removal by using an indirect global eval + indirect( code ); + } + } + }, + + // Convert dashed to camelCase; used by the css and data modules + // Support: IE9-11+ + // Microsoft forgot to hump their vendor prefix (#9572) + camelCase: function( string ) { + return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); + }, + + nodeName: function( elem, name ) { + return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); + }, + + // args is for internal usage only + each: function( obj, callback, args ) { + var value, + i = 0, + length = obj.length, + isArray = isArraylike( obj ); + + if ( args ) { + if ( isArray ) { + for ( ; i < length; i++ ) { + value = callback.apply( obj[ i ], args ); + + if ( value === false ) { + break; + } + } + } else { + for ( i in obj ) { + value = callback.apply( obj[ i ], args ); + + if ( value === false ) { + break; + } + } + } + + // A special, fast, case for the most common use of each + } else { + if ( isArray ) { + for ( ; i < length; i++ ) { + value = callback.call( obj[ i ], i, obj[ i ] ); + + if ( value === false ) { + break; + } + } + } else { + for ( i in obj ) { + value = callback.call( obj[ i ], i, obj[ i ] ); + + if ( value === false ) { + break; + } + } + } + } + + return obj; + }, + + // Support: Android<4.1 + trim: function( text ) { + return text == null ? + "" : + ( text + "" ).replace( rtrim, "" ); + }, + + // results is for internal usage only + makeArray: function( arr, results ) { + var ret = results || []; + + if ( arr != null ) { + if ( isArraylike( Object(arr) ) ) { + jQuery.merge( ret, + typeof arr === "string" ? + [ arr ] : arr + ); + } else { + push.call( ret, arr ); + } + } + + return ret; + }, + + inArray: function( elem, arr, i ) { + return arr == null ? -1 : indexOf.call( arr, elem, i ); + }, + + merge: function( first, second ) { + var len = +second.length, + j = 0, + i = first.length; + + for ( ; j < len; j++ ) { + first[ i++ ] = second[ j ]; + } + + first.length = i; + + return first; + }, + + grep: function( elems, callback, invert ) { + var callbackInverse, + matches = [], + i = 0, + length = elems.length, + callbackExpect = !invert; + + // Go through the array, only saving the items + // that pass the validator function + for ( ; i < length; i++ ) { + callbackInverse = !callback( elems[ i ], i ); + if ( callbackInverse !== callbackExpect ) { + matches.push( elems[ i ] ); + } + } + + return matches; + }, + + // arg is for internal usage only + map: function( elems, callback, arg ) { + var value, + i = 0, + length = elems.length, + isArray = isArraylike( elems ), + ret = []; + + // Go through the array, translating each of the items to their new values + if ( isArray ) { + for ( ; i < length; i++ ) { + value = callback( elems[ i ], i, arg ); + + if ( value != null ) { + ret.push( value ); + } + } + + // Go through every key on the object, + } else { + for ( i in elems ) { + value = callback( elems[ i ], i, arg ); + + if ( value != null ) { + ret.push( value ); + } + } + } + + // Flatten any nested arrays + return concat.apply( [], ret ); + }, + + // A global GUID counter for objects + guid: 1, + + // Bind a function to a context, optionally partially applying any + // arguments. + proxy: function( fn, context ) { + var tmp, args, proxy; + + if ( typeof context === "string" ) { + tmp = fn[ context ]; + context = fn; + fn = tmp; + } + + // Quick check to determine if target is callable, in the spec + // this throws a TypeError, but we will just return undefined. + if ( !jQuery.isFunction( fn ) ) { + return undefined; + } + + // Simulated bind + args = slice.call( arguments, 2 ); + proxy = function() { + return fn.apply( context || this, args.concat( slice.call( arguments ) ) ); + }; + + // Set the guid of unique handler to the same of original handler, so it can be removed + proxy.guid = fn.guid = fn.guid || jQuery.guid++; + + return proxy; + }, + + now: Date.now, + + // jQuery.support is not used in Core but other projects attach their + // properties to it so it needs to exist. + support: support +}); + +// Populate the class2type map +jQuery.each("Boolean Number String Function Array Date RegExp Object Error".split(" "), function(i, name) { + class2type[ "[object " + name + "]" ] = name.toLowerCase(); +}); + +function isArraylike( obj ) { + + // Support: iOS 8.2 (not reproducible in simulator) + // `in` check used to prevent JIT error (gh-2145) + // hasOwn isn't used here due to false negatives + // regarding Nodelist length in IE + var length = "length" in obj && obj.length, + type = jQuery.type( obj ); + + if ( type === "function" || jQuery.isWindow( obj ) ) { + return false; + } + + if ( obj.nodeType === 1 && length ) { + return true; + } + + return type === "array" || length === 0 || + typeof length === "number" && length > 0 && ( length - 1 ) in obj; +} +var Sizzle = +/*! + * Sizzle CSS Selector Engine v2.2.0-pre + * http://sizzlejs.com/ + * + * Copyright 2008, 2014 jQuery Foundation, Inc. and other contributors + * Released under the MIT license + * http://jquery.org/license + * + * Date: 2014-12-16 + */ +(function( window ) { + +var i, + support, + Expr, + getText, + isXML, + tokenize, + compile, + select, + outermostContext, + sortInput, + hasDuplicate, + + // Local document vars + setDocument, + document, + docElem, + documentIsHTML, + rbuggyQSA, + rbuggyMatches, + matches, + contains, + + // Instance-specific data + expando = "sizzle" + 1 * new Date(), + preferredDoc = window.document, + dirruns = 0, + done = 0, + classCache = createCache(), + tokenCache = createCache(), + compilerCache = createCache(), + sortOrder = function( a, b ) { + if ( a === b ) { + hasDuplicate = true; + } + return 0; + }, + + // General-purpose constants + MAX_NEGATIVE = 1 << 31, + + // Instance methods + hasOwn = ({}).hasOwnProperty, + arr = [], + pop = arr.pop, + push_native = arr.push, + push = arr.push, + slice = arr.slice, + // Use a stripped-down indexOf as it's faster than native + // http://jsperf.com/thor-indexof-vs-for/5 + indexOf = function( list, elem ) { + var i = 0, + len = list.length; + for ( ; i < len; i++ ) { + if ( list[i] === elem ) { + return i; + } + } + return -1; + }, + + booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped", + + // Regular expressions + + // Whitespace characters http://www.w3.org/TR/css3-selectors/#whitespace + whitespace = "[\\x20\\t\\r\\n\\f]", + // http://www.w3.org/TR/css3-syntax/#characters + characterEncoding = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+", + + // Loosely modeled on CSS identifier characters + // An unquoted value should be a CSS identifier http://www.w3.org/TR/css3-selectors/#attribute-selectors + // Proper syntax: http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier + identifier = characterEncoding.replace( "w", "w#" ), + + // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors + attributes = "\\[" + whitespace + "*(" + characterEncoding + ")(?:" + whitespace + + // Operator (capture 2) + "*([*^$|!~]?=)" + whitespace + + // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]" + "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace + + "*\\]", + + pseudos = ":(" + characterEncoding + ")(?:\\((" + + // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments: + // 1. quoted (capture 3; capture 4 or capture 5) + "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" + + // 2. simple (capture 6) + "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" + + // 3. anything else (capture 2) + ".*" + + ")\\)|)", + + // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter + rwhitespace = new RegExp( whitespace + "+", "g" ), + rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ), + + rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ), + rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ), + + rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g" ), + + rpseudo = new RegExp( pseudos ), + ridentifier = new RegExp( "^" + identifier + "$" ), + + matchExpr = { + "ID": new RegExp( "^#(" + characterEncoding + ")" ), + "CLASS": new RegExp( "^\\.(" + characterEncoding + ")" ), + "TAG": new RegExp( "^(" + characterEncoding.replace( "w", "w*" ) + ")" ), + "ATTR": new RegExp( "^" + attributes ), + "PSEUDO": new RegExp( "^" + pseudos ), + "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace + + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace + + "*(\\d+)|))" + whitespace + "*\\)|)", "i" ), + "bool": new RegExp( "^(?:" + booleans + ")$", "i" ), + // For use in libraries implementing .is() + // We use this for POS matching in `select` + "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + + whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" ) + }, + + rinputs = /^(?:input|select|textarea|button)$/i, + rheader = /^h\d$/i, + + rnative = /^[^{]+\{\s*\[native \w/, + + // Easily-parseable/retrievable ID or TAG or CLASS selectors + rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, + + rsibling = /[+~]/, + rescape = /'|\\/g, + + // CSS escapes http://www.w3.org/TR/CSS21/syndata.html#escaped-characters + runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ), + funescape = function( _, escaped, escapedWhitespace ) { + var high = "0x" + escaped - 0x10000; + // NaN means non-codepoint + // Support: Firefox<24 + // Workaround erroneous numeric interpretation of +"0x" + return high !== high || escapedWhitespace ? + escaped : + high < 0 ? + // BMP codepoint + String.fromCharCode( high + 0x10000 ) : + // Supplemental Plane codepoint (surrogate pair) + String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 ); + }, + + // Used for iframes + // See setDocument() + // Removing the function wrapper causes a "Permission Denied" + // error in IE + unloadHandler = function() { + setDocument(); + }; + +// Optimize for push.apply( _, NodeList ) +try { + push.apply( + (arr = slice.call( preferredDoc.childNodes )), + preferredDoc.childNodes + ); + // Support: Android<4.0 + // Detect silently failing push.apply + arr[ preferredDoc.childNodes.length ].nodeType; +} catch ( e ) { + push = { apply: arr.length ? + + // Leverage slice if possible + function( target, els ) { + push_native.apply( target, slice.call(els) ); + } : + + // Support: IE<9 + // Otherwise append directly + function( target, els ) { + var j = target.length, + i = 0; + // Can't trust NodeList.length + while ( (target[j++] = els[i++]) ) {} + target.length = j - 1; + } + }; +} + +function Sizzle( selector, context, results, seed ) { + var match, elem, m, nodeType, + // QSA vars + i, groups, old, nid, newContext, newSelector; + + if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) { + setDocument( context ); + } + + context = context || document; + results = results || []; + nodeType = context.nodeType; + + if ( typeof selector !== "string" || !selector || + nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) { + + return results; + } + + if ( !seed && documentIsHTML ) { + + // Try to shortcut find operations when possible (e.g., not under DocumentFragment) + if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) { + // Speed-up: Sizzle("#ID") + if ( (m = match[1]) ) { + if ( nodeType === 9 ) { + elem = context.getElementById( m ); + // Check parentNode to catch when Blackberry 4.6 returns + // nodes that are no longer in the document (jQuery #6963) + if ( elem && elem.parentNode ) { + // Handle the case where IE, Opera, and Webkit return items + // by name instead of ID + if ( elem.id === m ) { + results.push( elem ); + return results; + } + } else { + return results; + } + } else { + // Context is not a document + if ( context.ownerDocument && (elem = context.ownerDocument.getElementById( m )) && + contains( context, elem ) && elem.id === m ) { + results.push( elem ); + return results; + } + } + + // Speed-up: Sizzle("TAG") + } else if ( match[2] ) { + push.apply( results, context.getElementsByTagName( selector ) ); + return results; + + // Speed-up: Sizzle(".CLASS") + } else if ( (m = match[3]) && support.getElementsByClassName ) { + push.apply( results, context.getElementsByClassName( m ) ); + return results; + } + } + + // QSA path + if ( support.qsa && (!rbuggyQSA || !rbuggyQSA.test( selector )) ) { + nid = old = expando; + newContext = context; + newSelector = nodeType !== 1 && selector; + + // qSA works strangely on Element-rooted queries + // We can work around this by specifying an extra ID on the root + // and working up from there (Thanks to Andrew Dupont for the technique) + // IE 8 doesn't work on object elements + if ( nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) { + groups = tokenize( selector ); + + if ( (old = context.getAttribute("id")) ) { + nid = old.replace( rescape, "\\$&" ); + } else { + context.setAttribute( "id", nid ); + } + nid = "[id='" + nid + "'] "; + + i = groups.length; + while ( i-- ) { + groups[i] = nid + toSelector( groups[i] ); + } + newContext = rsibling.test( selector ) && testContext( context.parentNode ) || context; + newSelector = groups.join(","); + } + + if ( newSelector ) { + try { + push.apply( results, + newContext.querySelectorAll( newSelector ) + ); + return results; + } catch(qsaError) { + } finally { + if ( !old ) { + context.removeAttribute("id"); + } + } + } + } + } + + // All others + return select( selector.replace( rtrim, "$1" ), context, results, seed ); +} + +/** + * Create key-value caches of limited size + * @returns {Function(string, Object)} Returns the Object data after storing it on itself with + * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength) + * deleting the oldest entry + */ +function createCache() { + var keys = []; + + function cache( key, value ) { + // Use (key + " ") to avoid collision with native prototype properties (see Issue #157) + if ( keys.push( key + " " ) > Expr.cacheLength ) { + // Only keep the most recent entries + delete cache[ keys.shift() ]; + } + return (cache[ key + " " ] = value); + } + return cache; +} + +/** + * Mark a function for special use by Sizzle + * @param {Function} fn The function to mark + */ +function markFunction( fn ) { + fn[ expando ] = true; + return fn; +} + +/** + * Support testing using an element + * @param {Function} fn Passed the created div and expects a boolean result + */ +function assert( fn ) { + var div = document.createElement("div"); + + try { + return !!fn( div ); + } catch (e) { + return false; + } finally { + // Remove from its parent by default + if ( div.parentNode ) { + div.parentNode.removeChild( div ); + } + // release memory in IE + div = null; + } +} + +/** + * Adds the same handler for all of the specified attrs + * @param {String} attrs Pipe-separated list of attributes + * @param {Function} handler The method that will be applied + */ +function addHandle( attrs, handler ) { + var arr = attrs.split("|"), + i = attrs.length; + + while ( i-- ) { + Expr.attrHandle[ arr[i] ] = handler; + } +} + +/** + * Checks document order of two siblings + * @param {Element} a + * @param {Element} b + * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b + */ +function siblingCheck( a, b ) { + var cur = b && a, + diff = cur && a.nodeType === 1 && b.nodeType === 1 && + ( ~b.sourceIndex || MAX_NEGATIVE ) - + ( ~a.sourceIndex || MAX_NEGATIVE ); + + // Use IE sourceIndex if available on both nodes + if ( diff ) { + return diff; + } + + // Check if b follows a + if ( cur ) { + while ( (cur = cur.nextSibling) ) { + if ( cur === b ) { + return -1; + } + } + } + + return a ? 1 : -1; +} + +/** + * Returns a function to use in pseudos for input types + * @param {String} type + */ +function createInputPseudo( type ) { + return function( elem ) { + var name = elem.nodeName.toLowerCase(); + return name === "input" && elem.type === type; + }; +} + +/** + * Returns a function to use in pseudos for buttons + * @param {String} type + */ +function createButtonPseudo( type ) { + return function( elem ) { + var name = elem.nodeName.toLowerCase(); + return (name === "input" || name === "button") && elem.type === type; + }; +} + +/** + * Returns a function to use in pseudos for positionals + * @param {Function} fn + */ +function createPositionalPseudo( fn ) { + return markFunction(function( argument ) { + argument = +argument; + return markFunction(function( seed, matches ) { + var j, + matchIndexes = fn( [], seed.length, argument ), + i = matchIndexes.length; + + // Match elements found at the specified indexes + while ( i-- ) { + if ( seed[ (j = matchIndexes[i]) ] ) { + seed[j] = !(matches[j] = seed[j]); + } + } + }); + }); +} + +/** + * Checks a node for validity as a Sizzle context + * @param {Element|Object=} context + * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value + */ +function testContext( context ) { + return context && typeof context.getElementsByTagName !== "undefined" && context; +} + +// Expose support vars for convenience +support = Sizzle.support = {}; + +/** + * Detects XML nodes + * @param {Element|Object} elem An element or a document + * @returns {Boolean} True iff elem is a non-HTML XML node + */ +isXML = Sizzle.isXML = function( elem ) { + // documentElement is verified for cases where it doesn't yet exist + // (such as loading iframes in IE - #4833) + var documentElement = elem && (elem.ownerDocument || elem).documentElement; + return documentElement ? documentElement.nodeName !== "HTML" : false; +}; + +/** + * Sets document-related variables once based on the current document + * @param {Element|Object} [doc] An element or document object to use to set the document + * @returns {Object} Returns the current document + */ +setDocument = Sizzle.setDocument = function( node ) { + var hasCompare, parent, + doc = node ? node.ownerDocument || node : preferredDoc; + + // If no document and documentElement is available, return + if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) { + return document; + } + + // Set our document + document = doc; + docElem = doc.documentElement; + parent = doc.defaultView; + + // Support: IE>8 + // If iframe document is assigned to "document" variable and if iframe has been reloaded, + // IE will throw "permission denied" error when accessing "document" variable, see jQuery #13936 + // IE6-8 do not support the defaultView property so parent will be undefined + if ( parent && parent !== parent.top ) { + // IE11 does not have attachEvent, so all must suffer + if ( parent.addEventListener ) { + parent.addEventListener( "unload", unloadHandler, false ); + } else if ( parent.attachEvent ) { + parent.attachEvent( "onunload", unloadHandler ); + } + } + + /* Support tests + ---------------------------------------------------------------------- */ + documentIsHTML = !isXML( doc ); + + /* Attributes + ---------------------------------------------------------------------- */ + + // Support: IE<8 + // Verify that getAttribute really returns attributes and not properties + // (excepting IE8 booleans) + support.attributes = assert(function( div ) { + div.className = "i"; + return !div.getAttribute("className"); + }); + + /* getElement(s)By* + ---------------------------------------------------------------------- */ + + // Check if getElementsByTagName("*") returns only elements + support.getElementsByTagName = assert(function( div ) { + div.appendChild( doc.createComment("") ); + return !div.getElementsByTagName("*").length; + }); + + // Support: IE<9 + support.getElementsByClassName = rnative.test( doc.getElementsByClassName ); + + // Support: IE<10 + // Check if getElementById returns elements by name + // The broken getElementById methods don't pick up programatically-set names, + // so use a roundabout getElementsByName test + support.getById = assert(function( div ) { + docElem.appendChild( div ).id = expando; + return !doc.getElementsByName || !doc.getElementsByName( expando ).length; + }); + + // ID find and filter + if ( support.getById ) { + Expr.find["ID"] = function( id, context ) { + if ( typeof context.getElementById !== "undefined" && documentIsHTML ) { + var m = context.getElementById( id ); + // Check parentNode to catch when Blackberry 4.6 returns + // nodes that are no longer in the document #6963 + return m && m.parentNode ? [ m ] : []; + } + }; + Expr.filter["ID"] = function( id ) { + var attrId = id.replace( runescape, funescape ); + return function( elem ) { + return elem.getAttribute("id") === attrId; + }; + }; + } else { + // Support: IE6/7 + // getElementById is not reliable as a find shortcut + delete Expr.find["ID"]; + + Expr.filter["ID"] = function( id ) { + var attrId = id.replace( runescape, funescape ); + return function( elem ) { + var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id"); + return node && node.value === attrId; + }; + }; + } + + // Tag + Expr.find["TAG"] = support.getElementsByTagName ? + function( tag, context ) { + if ( typeof context.getElementsByTagName !== "undefined" ) { + return context.getElementsByTagName( tag ); + + // DocumentFragment nodes don't have gEBTN + } else if ( support.qsa ) { + return context.querySelectorAll( tag ); + } + } : + + function( tag, context ) { + var elem, + tmp = [], + i = 0, + // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too + results = context.getElementsByTagName( tag ); + + // Filter out possible comments + if ( tag === "*" ) { + while ( (elem = results[i++]) ) { + if ( elem.nodeType === 1 ) { + tmp.push( elem ); + } + } + + return tmp; + } + return results; + }; + + // Class + Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) { + if ( documentIsHTML ) { + return context.getElementsByClassName( className ); + } + }; + + /* QSA/matchesSelector + ---------------------------------------------------------------------- */ + + // QSA and matchesSelector support + + // matchesSelector(:active) reports false when true (IE9/Opera 11.5) + rbuggyMatches = []; + + // qSa(:focus) reports false when true (Chrome 21) + // We allow this because of a bug in IE8/9 that throws an error + // whenever `document.activeElement` is accessed on an iframe + // So, we allow :focus to pass through QSA all the time to avoid the IE error + // See http://bugs.jquery.com/ticket/13378 + rbuggyQSA = []; + + if ( (support.qsa = rnative.test( doc.querySelectorAll )) ) { + // Build QSA regex + // Regex strategy adopted from Diego Perini + assert(function( div ) { + // Select is set to empty string on purpose + // This is to test IE's treatment of not explicitly + // setting a boolean content attribute, + // since its presence should be enough + // http://bugs.jquery.com/ticket/12359 + docElem.appendChild( div ).innerHTML = "" + + ""; + + // Support: IE8, Opera 11-12.16 + // Nothing should be selected when empty strings follow ^= or $= or *= + // The test attribute must be unknown in Opera but "safe" for WinRT + // http://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section + if ( div.querySelectorAll("[msallowcapture^='']").length ) { + rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" ); + } + + // Support: IE8 + // Boolean attributes and "value" are not treated correctly + if ( !div.querySelectorAll("[selected]").length ) { + rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" ); + } + + // Support: Chrome<29, Android<4.2+, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.7+ + if ( !div.querySelectorAll( "[id~=" + expando + "-]" ).length ) { + rbuggyQSA.push("~="); + } + + // Webkit/Opera - :checked should return selected option elements + // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked + // IE8 throws error here and will not see later tests + if ( !div.querySelectorAll(":checked").length ) { + rbuggyQSA.push(":checked"); + } + + // Support: Safari 8+, iOS 8+ + // https://bugs.webkit.org/show_bug.cgi?id=136851 + // In-page `selector#id sibing-combinator selector` fails + if ( !div.querySelectorAll( "a#" + expando + "+*" ).length ) { + rbuggyQSA.push(".#.+[+~]"); + } + }); + + assert(function( div ) { + // Support: Windows 8 Native Apps + // The type and name attributes are restricted during .innerHTML assignment + var input = doc.createElement("input"); + input.setAttribute( "type", "hidden" ); + div.appendChild( input ).setAttribute( "name", "D" ); + + // Support: IE8 + // Enforce case-sensitivity of name attribute + if ( div.querySelectorAll("[name=d]").length ) { + rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" ); + } + + // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled) + // IE8 throws error here and will not see later tests + if ( !div.querySelectorAll(":enabled").length ) { + rbuggyQSA.push( ":enabled", ":disabled" ); + } + + // Opera 10-11 does not throw on post-comma invalid pseudos + div.querySelectorAll("*,:x"); + rbuggyQSA.push(",.*:"); + }); + } + + if ( (support.matchesSelector = rnative.test( (matches = docElem.matches || + docElem.webkitMatchesSelector || + docElem.mozMatchesSelector || + docElem.oMatchesSelector || + docElem.msMatchesSelector) )) ) { + + assert(function( div ) { + // Check to see if it's possible to do matchesSelector + // on a disconnected node (IE 9) + support.disconnectedMatch = matches.call( div, "div" ); + + // This should fail with an exception + // Gecko does not error, returns false instead + matches.call( div, "[s!='']:x" ); + rbuggyMatches.push( "!=", pseudos ); + }); + } + + rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") ); + rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") ); + + /* Contains + ---------------------------------------------------------------------- */ + hasCompare = rnative.test( docElem.compareDocumentPosition ); + + // Element contains another + // Purposefully does not implement inclusive descendent + // As in, an element does not contain itself + contains = hasCompare || rnative.test( docElem.contains ) ? + function( a, b ) { + var adown = a.nodeType === 9 ? a.documentElement : a, + bup = b && b.parentNode; + return a === bup || !!( bup && bup.nodeType === 1 && ( + adown.contains ? + adown.contains( bup ) : + a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16 + )); + } : + function( a, b ) { + if ( b ) { + while ( (b = b.parentNode) ) { + if ( b === a ) { + return true; + } + } + } + return false; + }; + + /* Sorting + ---------------------------------------------------------------------- */ + + // Document order sorting + sortOrder = hasCompare ? + function( a, b ) { + + // Flag for duplicate removal + if ( a === b ) { + hasDuplicate = true; + return 0; + } + + // Sort on method existence if only one input has compareDocumentPosition + var compare = !a.compareDocumentPosition - !b.compareDocumentPosition; + if ( compare ) { + return compare; + } + + // Calculate position if both inputs belong to the same document + compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ? + a.compareDocumentPosition( b ) : + + // Otherwise we know they are disconnected + 1; + + // Disconnected nodes + if ( compare & 1 || + (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) { + + // Choose the first element that is related to our preferred document + if ( a === doc || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) { + return -1; + } + if ( b === doc || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) { + return 1; + } + + // Maintain original order + return sortInput ? + ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) : + 0; + } + + return compare & 4 ? -1 : 1; + } : + function( a, b ) { + // Exit early if the nodes are identical + if ( a === b ) { + hasDuplicate = true; + return 0; + } + + var cur, + i = 0, + aup = a.parentNode, + bup = b.parentNode, + ap = [ a ], + bp = [ b ]; + + // Parentless nodes are either documents or disconnected + if ( !aup || !bup ) { + return a === doc ? -1 : + b === doc ? 1 : + aup ? -1 : + bup ? 1 : + sortInput ? + ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) : + 0; + + // If the nodes are siblings, we can do a quick check + } else if ( aup === bup ) { + return siblingCheck( a, b ); + } + + // Otherwise we need full lists of their ancestors for comparison + cur = a; + while ( (cur = cur.parentNode) ) { + ap.unshift( cur ); + } + cur = b; + while ( (cur = cur.parentNode) ) { + bp.unshift( cur ); + } + + // Walk down the tree looking for a discrepancy + while ( ap[i] === bp[i] ) { + i++; + } + + return i ? + // Do a sibling check if the nodes have a common ancestor + siblingCheck( ap[i], bp[i] ) : + + // Otherwise nodes in our document sort first + ap[i] === preferredDoc ? -1 : + bp[i] === preferredDoc ? 1 : + 0; + }; + + return doc; +}; + +Sizzle.matches = function( expr, elements ) { + return Sizzle( expr, null, null, elements ); +}; + +Sizzle.matchesSelector = function( elem, expr ) { + // Set document vars if needed + if ( ( elem.ownerDocument || elem ) !== document ) { + setDocument( elem ); + } + + // Make sure that attribute selectors are quoted + expr = expr.replace( rattributeQuotes, "='$1']" ); + + if ( support.matchesSelector && documentIsHTML && + ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) && + ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) { + + try { + var ret = matches.call( elem, expr ); + + // IE 9's matchesSelector returns false on disconnected nodes + if ( ret || support.disconnectedMatch || + // As well, disconnected nodes are said to be in a document + // fragment in IE 9 + elem.document && elem.document.nodeType !== 11 ) { + return ret; + } + } catch (e) {} + } + + return Sizzle( expr, document, null, [ elem ] ).length > 0; +}; + +Sizzle.contains = function( context, elem ) { + // Set document vars if needed + if ( ( context.ownerDocument || context ) !== document ) { + setDocument( context ); + } + return contains( context, elem ); +}; + +Sizzle.attr = function( elem, name ) { + // Set document vars if needed + if ( ( elem.ownerDocument || elem ) !== document ) { + setDocument( elem ); + } + + var fn = Expr.attrHandle[ name.toLowerCase() ], + // Don't get fooled by Object.prototype properties (jQuery #13807) + val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ? + fn( elem, name, !documentIsHTML ) : + undefined; + + return val !== undefined ? + val : + support.attributes || !documentIsHTML ? + elem.getAttribute( name ) : + (val = elem.getAttributeNode(name)) && val.specified ? + val.value : + null; +}; + +Sizzle.error = function( msg ) { + throw new Error( "Syntax error, unrecognized expression: " + msg ); +}; + +/** + * Document sorting and removing duplicates + * @param {ArrayLike} results + */ +Sizzle.uniqueSort = function( results ) { + var elem, + duplicates = [], + j = 0, + i = 0; + + // Unless we *know* we can detect duplicates, assume their presence + hasDuplicate = !support.detectDuplicates; + sortInput = !support.sortStable && results.slice( 0 ); + results.sort( sortOrder ); + + if ( hasDuplicate ) { + while ( (elem = results[i++]) ) { + if ( elem === results[ i ] ) { + j = duplicates.push( i ); + } + } + while ( j-- ) { + results.splice( duplicates[ j ], 1 ); + } + } + + // Clear input after sorting to release objects + // See https://github.com/jquery/sizzle/pull/225 + sortInput = null; + + return results; +}; + +/** + * Utility function for retrieving the text value of an array of DOM nodes + * @param {Array|Element} elem + */ +getText = Sizzle.getText = function( elem ) { + var node, + ret = "", + i = 0, + nodeType = elem.nodeType; + + if ( !nodeType ) { + // If no nodeType, this is expected to be an array + while ( (node = elem[i++]) ) { + // Do not traverse comment nodes + ret += getText( node ); + } + } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) { + // Use textContent for elements + // innerText usage removed for consistency of new lines (jQuery #11153) + if ( typeof elem.textContent === "string" ) { + return elem.textContent; + } else { + // Traverse its children + for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { + ret += getText( elem ); + } + } + } else if ( nodeType === 3 || nodeType === 4 ) { + return elem.nodeValue; + } + // Do not include comment or processing instruction nodes + + return ret; +}; + +Expr = Sizzle.selectors = { + + // Can be adjusted by the user + cacheLength: 50, + + createPseudo: markFunction, + + match: matchExpr, + + attrHandle: {}, + + find: {}, + + relative: { + ">": { dir: "parentNode", first: true }, + " ": { dir: "parentNode" }, + "+": { dir: "previousSibling", first: true }, + "~": { dir: "previousSibling" } + }, + + preFilter: { + "ATTR": function( match ) { + match[1] = match[1].replace( runescape, funescape ); + + // Move the given value to match[3] whether quoted or unquoted + match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape ); + + if ( match[2] === "~=" ) { + match[3] = " " + match[3] + " "; + } + + return match.slice( 0, 4 ); + }, + + "CHILD": function( match ) { + /* matches from matchExpr["CHILD"] + 1 type (only|nth|...) + 2 what (child|of-type) + 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...) + 4 xn-component of xn+y argument ([+-]?\d*n|) + 5 sign of xn-component + 6 x of xn-component + 7 sign of y-component + 8 y of y-component + */ + match[1] = match[1].toLowerCase(); + + if ( match[1].slice( 0, 3 ) === "nth" ) { + // nth-* requires argument + if ( !match[3] ) { + Sizzle.error( match[0] ); + } + + // numeric x and y parameters for Expr.filter.CHILD + // remember that false/true cast respectively to 0/1 + match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) ); + match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" ); + + // other types prohibit arguments + } else if ( match[3] ) { + Sizzle.error( match[0] ); + } + + return match; + }, + + "PSEUDO": function( match ) { + var excess, + unquoted = !match[6] && match[2]; + + if ( matchExpr["CHILD"].test( match[0] ) ) { + return null; + } + + // Accept quoted arguments as-is + if ( match[3] ) { + match[2] = match[4] || match[5] || ""; + + // Strip excess characters from unquoted arguments + } else if ( unquoted && rpseudo.test( unquoted ) && + // Get excess from tokenize (recursively) + (excess = tokenize( unquoted, true )) && + // advance to the next closing parenthesis + (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) { + + // excess is a negative index + match[0] = match[0].slice( 0, excess ); + match[2] = unquoted.slice( 0, excess ); + } + + // Return only captures needed by the pseudo filter method (type and argument) + return match.slice( 0, 3 ); + } + }, + + filter: { + + "TAG": function( nodeNameSelector ) { + var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase(); + return nodeNameSelector === "*" ? + function() { return true; } : + function( elem ) { + return elem.nodeName && elem.nodeName.toLowerCase() === nodeName; + }; + }, + + "CLASS": function( className ) { + var pattern = classCache[ className + " " ]; + + return pattern || + (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) && + classCache( className, function( elem ) { + return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" ); + }); + }, + + "ATTR": function( name, operator, check ) { + return function( elem ) { + var result = Sizzle.attr( elem, name ); + + if ( result == null ) { + return operator === "!="; + } + if ( !operator ) { + return true; + } + + result += ""; + + return operator === "=" ? result === check : + operator === "!=" ? result !== check : + operator === "^=" ? check && result.indexOf( check ) === 0 : + operator === "*=" ? check && result.indexOf( check ) > -1 : + operator === "$=" ? check && result.slice( -check.length ) === check : + operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 : + operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" : + false; + }; + }, + + "CHILD": function( type, what, argument, first, last ) { + var simple = type.slice( 0, 3 ) !== "nth", + forward = type.slice( -4 ) !== "last", + ofType = what === "of-type"; + + return first === 1 && last === 0 ? + + // Shortcut for :nth-*(n) + function( elem ) { + return !!elem.parentNode; + } : + + function( elem, context, xml ) { + var cache, outerCache, node, diff, nodeIndex, start, + dir = simple !== forward ? "nextSibling" : "previousSibling", + parent = elem.parentNode, + name = ofType && elem.nodeName.toLowerCase(), + useCache = !xml && !ofType; + + if ( parent ) { + + // :(first|last|only)-(child|of-type) + if ( simple ) { + while ( dir ) { + node = elem; + while ( (node = node[ dir ]) ) { + if ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) { + return false; + } + } + // Reverse direction for :only-* (if we haven't yet done so) + start = dir = type === "only" && !start && "nextSibling"; + } + return true; + } + + start = [ forward ? parent.firstChild : parent.lastChild ]; + + // non-xml :nth-child(...) stores cache data on `parent` + if ( forward && useCache ) { + // Seek `elem` from a previously-cached index + outerCache = parent[ expando ] || (parent[ expando ] = {}); + cache = outerCache[ type ] || []; + nodeIndex = cache[0] === dirruns && cache[1]; + diff = cache[0] === dirruns && cache[2]; + node = nodeIndex && parent.childNodes[ nodeIndex ]; + + while ( (node = ++nodeIndex && node && node[ dir ] || + + // Fallback to seeking `elem` from the start + (diff = nodeIndex = 0) || start.pop()) ) { + + // When found, cache indexes on `parent` and break + if ( node.nodeType === 1 && ++diff && node === elem ) { + outerCache[ type ] = [ dirruns, nodeIndex, diff ]; + break; + } + } + + // Use previously-cached element index if available + } else if ( useCache && (cache = (elem[ expando ] || (elem[ expando ] = {}))[ type ]) && cache[0] === dirruns ) { + diff = cache[1]; + + // xml :nth-child(...) or :nth-last-child(...) or :nth(-last)?-of-type(...) + } else { + // Use the same loop as above to seek `elem` from the start + while ( (node = ++nodeIndex && node && node[ dir ] || + (diff = nodeIndex = 0) || start.pop()) ) { + + if ( ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) && ++diff ) { + // Cache the index of each encountered element + if ( useCache ) { + (node[ expando ] || (node[ expando ] = {}))[ type ] = [ dirruns, diff ]; + } + + if ( node === elem ) { + break; + } + } + } + } + + // Incorporate the offset, then check against cycle size + diff -= last; + return diff === first || ( diff % first === 0 && diff / first >= 0 ); + } + }; + }, + + "PSEUDO": function( pseudo, argument ) { + // pseudo-class names are case-insensitive + // http://www.w3.org/TR/selectors/#pseudo-classes + // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters + // Remember that setFilters inherits from pseudos + var args, + fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] || + Sizzle.error( "unsupported pseudo: " + pseudo ); + + // The user may use createPseudo to indicate that + // arguments are needed to create the filter function + // just as Sizzle does + if ( fn[ expando ] ) { + return fn( argument ); + } + + // But maintain support for old signatures + if ( fn.length > 1 ) { + args = [ pseudo, pseudo, "", argument ]; + return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ? + markFunction(function( seed, matches ) { + var idx, + matched = fn( seed, argument ), + i = matched.length; + while ( i-- ) { + idx = indexOf( seed, matched[i] ); + seed[ idx ] = !( matches[ idx ] = matched[i] ); + } + }) : + function( elem ) { + return fn( elem, 0, args ); + }; + } + + return fn; + } + }, + + pseudos: { + // Potentially complex pseudos + "not": markFunction(function( selector ) { + // Trim the selector passed to compile + // to avoid treating leading and trailing + // spaces as combinators + var input = [], + results = [], + matcher = compile( selector.replace( rtrim, "$1" ) ); + + return matcher[ expando ] ? + markFunction(function( seed, matches, context, xml ) { + var elem, + unmatched = matcher( seed, null, xml, [] ), + i = seed.length; + + // Match elements unmatched by `matcher` + while ( i-- ) { + if ( (elem = unmatched[i]) ) { + seed[i] = !(matches[i] = elem); + } + } + }) : + function( elem, context, xml ) { + input[0] = elem; + matcher( input, null, xml, results ); + // Don't keep the element (issue #299) + input[0] = null; + return !results.pop(); + }; + }), + + "has": markFunction(function( selector ) { + return function( elem ) { + return Sizzle( selector, elem ).length > 0; + }; + }), + + "contains": markFunction(function( text ) { + text = text.replace( runescape, funescape ); + return function( elem ) { + return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1; + }; + }), + + // "Whether an element is represented by a :lang() selector + // is based solely on the element's language value + // being equal to the identifier C, + // or beginning with the identifier C immediately followed by "-". + // The matching of C against the element's language value is performed case-insensitively. + // The identifier C does not have to be a valid language name." + // http://www.w3.org/TR/selectors/#lang-pseudo + "lang": markFunction( function( lang ) { + // lang value must be a valid identifier + if ( !ridentifier.test(lang || "") ) { + Sizzle.error( "unsupported lang: " + lang ); + } + lang = lang.replace( runescape, funescape ).toLowerCase(); + return function( elem ) { + var elemLang; + do { + if ( (elemLang = documentIsHTML ? + elem.lang : + elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) { + + elemLang = elemLang.toLowerCase(); + return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0; + } + } while ( (elem = elem.parentNode) && elem.nodeType === 1 ); + return false; + }; + }), + + // Miscellaneous + "target": function( elem ) { + var hash = window.location && window.location.hash; + return hash && hash.slice( 1 ) === elem.id; + }, + + "root": function( elem ) { + return elem === docElem; + }, + + "focus": function( elem ) { + return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex); + }, + + // Boolean properties + "enabled": function( elem ) { + return elem.disabled === false; + }, + + "disabled": function( elem ) { + return elem.disabled === true; + }, + + "checked": function( elem ) { + // In CSS3, :checked should return both checked and selected elements + // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked + var nodeName = elem.nodeName.toLowerCase(); + return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected); + }, + + "selected": function( elem ) { + // Accessing this property makes selected-by-default + // options in Safari work properly + if ( elem.parentNode ) { + elem.parentNode.selectedIndex; + } + + return elem.selected === true; + }, + + // Contents + "empty": function( elem ) { + // http://www.w3.org/TR/selectors/#empty-pseudo + // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5), + // but not by others (comment: 8; processing instruction: 7; etc.) + // nodeType < 6 works because attributes (2) do not appear as children + for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { + if ( elem.nodeType < 6 ) { + return false; + } + } + return true; + }, + + "parent": function( elem ) { + return !Expr.pseudos["empty"]( elem ); + }, + + // Element/input types + "header": function( elem ) { + return rheader.test( elem.nodeName ); + }, + + "input": function( elem ) { + return rinputs.test( elem.nodeName ); + }, + + "button": function( elem ) { + var name = elem.nodeName.toLowerCase(); + return name === "input" && elem.type === "button" || name === "button"; + }, + + "text": function( elem ) { + var attr; + return elem.nodeName.toLowerCase() === "input" && + elem.type === "text" && + + // Support: IE<8 + // New HTML5 attribute values (e.g., "search") appear with elem.type === "text" + ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" ); + }, + + // Position-in-collection + "first": createPositionalPseudo(function() { + return [ 0 ]; + }), + + "last": createPositionalPseudo(function( matchIndexes, length ) { + return [ length - 1 ]; + }), + + "eq": createPositionalPseudo(function( matchIndexes, length, argument ) { + return [ argument < 0 ? argument + length : argument ]; + }), + + "even": createPositionalPseudo(function( matchIndexes, length ) { + var i = 0; + for ( ; i < length; i += 2 ) { + matchIndexes.push( i ); + } + return matchIndexes; + }), + + "odd": createPositionalPseudo(function( matchIndexes, length ) { + var i = 1; + for ( ; i < length; i += 2 ) { + matchIndexes.push( i ); + } + return matchIndexes; + }), + + "lt": createPositionalPseudo(function( matchIndexes, length, argument ) { + var i = argument < 0 ? argument + length : argument; + for ( ; --i >= 0; ) { + matchIndexes.push( i ); + } + return matchIndexes; + }), + + "gt": createPositionalPseudo(function( matchIndexes, length, argument ) { + var i = argument < 0 ? argument + length : argument; + for ( ; ++i < length; ) { + matchIndexes.push( i ); + } + return matchIndexes; + }) + } +}; + +Expr.pseudos["nth"] = Expr.pseudos["eq"]; + +// Add button/input type pseudos +for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) { + Expr.pseudos[ i ] = createInputPseudo( i ); +} +for ( i in { submit: true, reset: true } ) { + Expr.pseudos[ i ] = createButtonPseudo( i ); +} + +// Easy API for creating new setFilters +function setFilters() {} +setFilters.prototype = Expr.filters = Expr.pseudos; +Expr.setFilters = new setFilters(); + +tokenize = Sizzle.tokenize = function( selector, parseOnly ) { + var matched, match, tokens, type, + soFar, groups, preFilters, + cached = tokenCache[ selector + " " ]; + + if ( cached ) { + return parseOnly ? 0 : cached.slice( 0 ); + } + + soFar = selector; + groups = []; + preFilters = Expr.preFilter; + + while ( soFar ) { + + // Comma and first run + if ( !matched || (match = rcomma.exec( soFar )) ) { + if ( match ) { + // Don't consume trailing commas as valid + soFar = soFar.slice( match[0].length ) || soFar; + } + groups.push( (tokens = []) ); + } + + matched = false; + + // Combinators + if ( (match = rcombinators.exec( soFar )) ) { + matched = match.shift(); + tokens.push({ + value: matched, + // Cast descendant combinators to space + type: match[0].replace( rtrim, " " ) + }); + soFar = soFar.slice( matched.length ); + } + + // Filters + for ( type in Expr.filter ) { + if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] || + (match = preFilters[ type ]( match ))) ) { + matched = match.shift(); + tokens.push({ + value: matched, + type: type, + matches: match + }); + soFar = soFar.slice( matched.length ); + } + } + + if ( !matched ) { + break; + } + } + + // Return the length of the invalid excess + // if we're just parsing + // Otherwise, throw an error or return tokens + return parseOnly ? + soFar.length : + soFar ? + Sizzle.error( selector ) : + // Cache the tokens + tokenCache( selector, groups ).slice( 0 ); +}; + +function toSelector( tokens ) { + var i = 0, + len = tokens.length, + selector = ""; + for ( ; i < len; i++ ) { + selector += tokens[i].value; + } + return selector; +} + +function addCombinator( matcher, combinator, base ) { + var dir = combinator.dir, + checkNonElements = base && dir === "parentNode", + doneName = done++; + + return combinator.first ? + // Check against closest ancestor/preceding element + function( elem, context, xml ) { + while ( (elem = elem[ dir ]) ) { + if ( elem.nodeType === 1 || checkNonElements ) { + return matcher( elem, context, xml ); + } + } + } : + + // Check against all ancestor/preceding elements + function( elem, context, xml ) { + var oldCache, outerCache, + newCache = [ dirruns, doneName ]; + + // We can't set arbitrary data on XML nodes, so they don't benefit from dir caching + if ( xml ) { + while ( (elem = elem[ dir ]) ) { + if ( elem.nodeType === 1 || checkNonElements ) { + if ( matcher( elem, context, xml ) ) { + return true; + } + } + } + } else { + while ( (elem = elem[ dir ]) ) { + if ( elem.nodeType === 1 || checkNonElements ) { + outerCache = elem[ expando ] || (elem[ expando ] = {}); + if ( (oldCache = outerCache[ dir ]) && + oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) { + + // Assign to newCache so results back-propagate to previous elements + return (newCache[ 2 ] = oldCache[ 2 ]); + } else { + // Reuse newcache so results back-propagate to previous elements + outerCache[ dir ] = newCache; + + // A match means we're done; a fail means we have to keep checking + if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) { + return true; + } + } + } + } + } + }; +} + +function elementMatcher( matchers ) { + return matchers.length > 1 ? + function( elem, context, xml ) { + var i = matchers.length; + while ( i-- ) { + if ( !matchers[i]( elem, context, xml ) ) { + return false; + } + } + return true; + } : + matchers[0]; +} + +function multipleContexts( selector, contexts, results ) { + var i = 0, + len = contexts.length; + for ( ; i < len; i++ ) { + Sizzle( selector, contexts[i], results ); + } + return results; +} + +function condense( unmatched, map, filter, context, xml ) { + var elem, + newUnmatched = [], + i = 0, + len = unmatched.length, + mapped = map != null; + + for ( ; i < len; i++ ) { + if ( (elem = unmatched[i]) ) { + if ( !filter || filter( elem, context, xml ) ) { + newUnmatched.push( elem ); + if ( mapped ) { + map.push( i ); + } + } + } + } + + return newUnmatched; +} + +function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) { + if ( postFilter && !postFilter[ expando ] ) { + postFilter = setMatcher( postFilter ); + } + if ( postFinder && !postFinder[ expando ] ) { + postFinder = setMatcher( postFinder, postSelector ); + } + return markFunction(function( seed, results, context, xml ) { + var temp, i, elem, + preMap = [], + postMap = [], + preexisting = results.length, + + // Get initial elements from seed or context + elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ), + + // Prefilter to get matcher input, preserving a map for seed-results synchronization + matcherIn = preFilter && ( seed || !selector ) ? + condense( elems, preMap, preFilter, context, xml ) : + elems, + + matcherOut = matcher ? + // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results, + postFinder || ( seed ? preFilter : preexisting || postFilter ) ? + + // ...intermediate processing is necessary + [] : + + // ...otherwise use results directly + results : + matcherIn; + + // Find primary matches + if ( matcher ) { + matcher( matcherIn, matcherOut, context, xml ); + } + + // Apply postFilter + if ( postFilter ) { + temp = condense( matcherOut, postMap ); + postFilter( temp, [], context, xml ); + + // Un-match failing elements by moving them back to matcherIn + i = temp.length; + while ( i-- ) { + if ( (elem = temp[i]) ) { + matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem); + } + } + } + + if ( seed ) { + if ( postFinder || preFilter ) { + if ( postFinder ) { + // Get the final matcherOut by condensing this intermediate into postFinder contexts + temp = []; + i = matcherOut.length; + while ( i-- ) { + if ( (elem = matcherOut[i]) ) { + // Restore matcherIn since elem is not yet a final match + temp.push( (matcherIn[i] = elem) ); + } + } + postFinder( null, (matcherOut = []), temp, xml ); + } + + // Move matched elements from seed to results to keep them synchronized + i = matcherOut.length; + while ( i-- ) { + if ( (elem = matcherOut[i]) && + (temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) { + + seed[temp] = !(results[temp] = elem); + } + } + } + + // Add elements to results, through postFinder if defined + } else { + matcherOut = condense( + matcherOut === results ? + matcherOut.splice( preexisting, matcherOut.length ) : + matcherOut + ); + if ( postFinder ) { + postFinder( null, results, matcherOut, xml ); + } else { + push.apply( results, matcherOut ); + } + } + }); +} + +function matcherFromTokens( tokens ) { + var checkContext, matcher, j, + len = tokens.length, + leadingRelative = Expr.relative[ tokens[0].type ], + implicitRelative = leadingRelative || Expr.relative[" "], + i = leadingRelative ? 1 : 0, + + // The foundational matcher ensures that elements are reachable from top-level context(s) + matchContext = addCombinator( function( elem ) { + return elem === checkContext; + }, implicitRelative, true ), + matchAnyContext = addCombinator( function( elem ) { + return indexOf( checkContext, elem ) > -1; + }, implicitRelative, true ), + matchers = [ function( elem, context, xml ) { + var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || ( + (checkContext = context).nodeType ? + matchContext( elem, context, xml ) : + matchAnyContext( elem, context, xml ) ); + // Avoid hanging onto element (issue #299) + checkContext = null; + return ret; + } ]; + + for ( ; i < len; i++ ) { + if ( (matcher = Expr.relative[ tokens[i].type ]) ) { + matchers = [ addCombinator(elementMatcher( matchers ), matcher) ]; + } else { + matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches ); + + // Return special upon seeing a positional matcher + if ( matcher[ expando ] ) { + // Find the next relative operator (if any) for proper handling + j = ++i; + for ( ; j < len; j++ ) { + if ( Expr.relative[ tokens[j].type ] ) { + break; + } + } + return setMatcher( + i > 1 && elementMatcher( matchers ), + i > 1 && toSelector( + // If the preceding token was a descendant combinator, insert an implicit any-element `*` + tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" }) + ).replace( rtrim, "$1" ), + matcher, + i < j && matcherFromTokens( tokens.slice( i, j ) ), + j < len && matcherFromTokens( (tokens = tokens.slice( j )) ), + j < len && toSelector( tokens ) + ); + } + matchers.push( matcher ); + } + } + + return elementMatcher( matchers ); +} + +function matcherFromGroupMatchers( elementMatchers, setMatchers ) { + var bySet = setMatchers.length > 0, + byElement = elementMatchers.length > 0, + superMatcher = function( seed, context, xml, results, outermost ) { + var elem, j, matcher, + matchedCount = 0, + i = "0", + unmatched = seed && [], + setMatched = [], + contextBackup = outermostContext, + // We must always have either seed elements or outermost context + elems = seed || byElement && Expr.find["TAG"]( "*", outermost ), + // Use integer dirruns iff this is the outermost matcher + dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1), + len = elems.length; + + if ( outermost ) { + outermostContext = context !== document && context; + } + + // Add elements passing elementMatchers directly to results + // Keep `i` a string if there are no elements so `matchedCount` will be "00" below + // Support: IE<9, Safari + // Tolerate NodeList properties (IE: "length"; Safari: ) matching elements by id + for ( ; i !== len && (elem = elems[i]) != null; i++ ) { + if ( byElement && elem ) { + j = 0; + while ( (matcher = elementMatchers[j++]) ) { + if ( matcher( elem, context, xml ) ) { + results.push( elem ); + break; + } + } + if ( outermost ) { + dirruns = dirrunsUnique; + } + } + + // Track unmatched elements for set filters + if ( bySet ) { + // They will have gone through all possible matchers + if ( (elem = !matcher && elem) ) { + matchedCount--; + } + + // Lengthen the array for every element, matched or not + if ( seed ) { + unmatched.push( elem ); + } + } + } + + // Apply set filters to unmatched elements + matchedCount += i; + if ( bySet && i !== matchedCount ) { + j = 0; + while ( (matcher = setMatchers[j++]) ) { + matcher( unmatched, setMatched, context, xml ); + } + + if ( seed ) { + // Reintegrate element matches to eliminate the need for sorting + if ( matchedCount > 0 ) { + while ( i-- ) { + if ( !(unmatched[i] || setMatched[i]) ) { + setMatched[i] = pop.call( results ); + } + } + } + + // Discard index placeholder values to get only actual matches + setMatched = condense( setMatched ); + } + + // Add matches to results + push.apply( results, setMatched ); + + // Seedless set matches succeeding multiple successful matchers stipulate sorting + if ( outermost && !seed && setMatched.length > 0 && + ( matchedCount + setMatchers.length ) > 1 ) { + + Sizzle.uniqueSort( results ); + } + } + + // Override manipulation of globals by nested matchers + if ( outermost ) { + dirruns = dirrunsUnique; + outermostContext = contextBackup; + } + + return unmatched; + }; + + return bySet ? + markFunction( superMatcher ) : + superMatcher; +} + +compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) { + var i, + setMatchers = [], + elementMatchers = [], + cached = compilerCache[ selector + " " ]; + + if ( !cached ) { + // Generate a function of recursive functions that can be used to check each element + if ( !match ) { + match = tokenize( selector ); + } + i = match.length; + while ( i-- ) { + cached = matcherFromTokens( match[i] ); + if ( cached[ expando ] ) { + setMatchers.push( cached ); + } else { + elementMatchers.push( cached ); + } + } + + // Cache the compiled function + cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) ); + + // Save selector and tokenization + cached.selector = selector; + } + return cached; +}; + +/** + * A low-level selection function that works with Sizzle's compiled + * selector functions + * @param {String|Function} selector A selector or a pre-compiled + * selector function built with Sizzle.compile + * @param {Element} context + * @param {Array} [results] + * @param {Array} [seed] A set of elements to match against + */ +select = Sizzle.select = function( selector, context, results, seed ) { + var i, tokens, token, type, find, + compiled = typeof selector === "function" && selector, + match = !seed && tokenize( (selector = compiled.selector || selector) ); + + results = results || []; + + // Try to minimize operations if there is no seed and only one group + if ( match.length === 1 ) { + + // Take a shortcut and set the context if the root selector is an ID + tokens = match[0] = match[0].slice( 0 ); + if ( tokens.length > 2 && (token = tokens[0]).type === "ID" && + support.getById && context.nodeType === 9 && documentIsHTML && + Expr.relative[ tokens[1].type ] ) { + + context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0]; + if ( !context ) { + return results; + + // Precompiled matchers will still verify ancestry, so step up a level + } else if ( compiled ) { + context = context.parentNode; + } + + selector = selector.slice( tokens.shift().value.length ); + } + + // Fetch a seed set for right-to-left matching + i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length; + while ( i-- ) { + token = tokens[i]; + + // Abort if we hit a combinator + if ( Expr.relative[ (type = token.type) ] ) { + break; + } + if ( (find = Expr.find[ type ]) ) { + // Search, expanding context for leading sibling combinators + if ( (seed = find( + token.matches[0].replace( runescape, funescape ), + rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context + )) ) { + + // If seed is empty or no tokens remain, we can return early + tokens.splice( i, 1 ); + selector = seed.length && toSelector( tokens ); + if ( !selector ) { + push.apply( results, seed ); + return results; + } + + break; + } + } + } + } + + // Compile and execute a filtering function if one is not provided + // Provide `match` to avoid retokenization if we modified the selector above + ( compiled || compile( selector, match ) )( + seed, + context, + !documentIsHTML, + results, + rsibling.test( selector ) && testContext( context.parentNode ) || context + ); + return results; +}; + +// One-time assignments + +// Sort stability +support.sortStable = expando.split("").sort( sortOrder ).join("") === expando; + +// Support: Chrome 14-35+ +// Always assume duplicates if they aren't passed to the comparison function +support.detectDuplicates = !!hasDuplicate; + +// Initialize against the default document +setDocument(); + +// Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27) +// Detached nodes confoundingly follow *each other* +support.sortDetached = assert(function( div1 ) { + // Should return 1, but returns 4 (following) + return div1.compareDocumentPosition( document.createElement("div") ) & 1; +}); + +// Support: IE<8 +// Prevent attribute/property "interpolation" +// http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx +if ( !assert(function( div ) { + div.innerHTML = ""; + return div.firstChild.getAttribute("href") === "#" ; +}) ) { + addHandle( "type|href|height|width", function( elem, name, isXML ) { + if ( !isXML ) { + return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 ); + } + }); +} + +// Support: IE<9 +// Use defaultValue in place of getAttribute("value") +if ( !support.attributes || !assert(function( div ) { + div.innerHTML = ""; + div.firstChild.setAttribute( "value", "" ); + return div.firstChild.getAttribute( "value" ) === ""; +}) ) { + addHandle( "value", function( elem, name, isXML ) { + if ( !isXML && elem.nodeName.toLowerCase() === "input" ) { + return elem.defaultValue; + } + }); +} + +// Support: IE<9 +// Use getAttributeNode to fetch booleans when getAttribute lies +if ( !assert(function( div ) { + return div.getAttribute("disabled") == null; +}) ) { + addHandle( booleans, function( elem, name, isXML ) { + var val; + if ( !isXML ) { + return elem[ name ] === true ? name.toLowerCase() : + (val = elem.getAttributeNode( name )) && val.specified ? + val.value : + null; + } + }); +} + +return Sizzle; + +})( window ); + + + +jQuery.find = Sizzle; +jQuery.expr = Sizzle.selectors; +jQuery.expr[":"] = jQuery.expr.pseudos; +jQuery.unique = Sizzle.uniqueSort; +jQuery.text = Sizzle.getText; +jQuery.isXMLDoc = Sizzle.isXML; +jQuery.contains = Sizzle.contains; + + + +var rneedsContext = jQuery.expr.match.needsContext; + +var rsingleTag = (/^<(\w+)\s*\/?>(?:<\/\1>|)$/); + + + +var risSimple = /^.[^:#\[\.,]*$/; + +// Implement the identical functionality for filter and not +function winnow( elements, qualifier, not ) { + if ( jQuery.isFunction( qualifier ) ) { + return jQuery.grep( elements, function( elem, i ) { + /* jshint -W018 */ + return !!qualifier.call( elem, i, elem ) !== not; + }); + + } + + if ( qualifier.nodeType ) { + return jQuery.grep( elements, function( elem ) { + return ( elem === qualifier ) !== not; + }); + + } + + if ( typeof qualifier === "string" ) { + if ( risSimple.test( qualifier ) ) { + return jQuery.filter( qualifier, elements, not ); + } + + qualifier = jQuery.filter( qualifier, elements ); + } + + return jQuery.grep( elements, function( elem ) { + return ( indexOf.call( qualifier, elem ) >= 0 ) !== not; + }); +} + +jQuery.filter = function( expr, elems, not ) { + var elem = elems[ 0 ]; + + if ( not ) { + expr = ":not(" + expr + ")"; + } + + return elems.length === 1 && elem.nodeType === 1 ? + jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [] : + jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) { + return elem.nodeType === 1; + })); +}; + +jQuery.fn.extend({ + find: function( selector ) { + var i, + len = this.length, + ret = [], + self = this; + + if ( typeof selector !== "string" ) { + return this.pushStack( jQuery( selector ).filter(function() { + for ( i = 0; i < len; i++ ) { + if ( jQuery.contains( self[ i ], this ) ) { + return true; + } + } + }) ); + } + + for ( i = 0; i < len; i++ ) { + jQuery.find( selector, self[ i ], ret ); + } + + // Needed because $( selector, context ) becomes $( context ).find( selector ) + ret = this.pushStack( len > 1 ? jQuery.unique( ret ) : ret ); + ret.selector = this.selector ? this.selector + " " + selector : selector; + return ret; + }, + filter: function( selector ) { + return this.pushStack( winnow(this, selector || [], false) ); + }, + not: function( selector ) { + return this.pushStack( winnow(this, selector || [], true) ); + }, + is: function( selector ) { + return !!winnow( + this, + + // If this is a positional/relative selector, check membership in the returned set + // so $("p:first").is("p:last") won't return true for a doc with two "p". + typeof selector === "string" && rneedsContext.test( selector ) ? + jQuery( selector ) : + selector || [], + false + ).length; + } +}); + + +// Initialize a jQuery object + + +// A central reference to the root jQuery(document) +var rootjQuery, + + // A simple way to check for HTML strings + // Prioritize #id over to avoid XSS via location.hash (#9521) + // Strict HTML recognition (#11290: must start with <) + rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/, + + init = jQuery.fn.init = function( selector, context ) { + var match, elem; + + // HANDLE: $(""), $(null), $(undefined), $(false) + if ( !selector ) { + return this; + } + + // Handle HTML strings + if ( typeof selector === "string" ) { + if ( selector[0] === "<" && selector[ selector.length - 1 ] === ">" && selector.length >= 3 ) { + // Assume that strings that start and end with <> are HTML and skip the regex check + match = [ null, selector, null ]; + + } else { + match = rquickExpr.exec( selector ); + } + + // Match html or make sure no context is specified for #id + if ( match && (match[1] || !context) ) { + + // HANDLE: $(html) -> $(array) + if ( match[1] ) { + context = context instanceof jQuery ? context[0] : context; + + // Option to run scripts is true for back-compat + // Intentionally let the error be thrown if parseHTML is not present + jQuery.merge( this, jQuery.parseHTML( + match[1], + context && context.nodeType ? context.ownerDocument || context : document, + true + ) ); + + // HANDLE: $(html, props) + if ( rsingleTag.test( match[1] ) && jQuery.isPlainObject( context ) ) { + for ( match in context ) { + // Properties of context are called as methods if possible + if ( jQuery.isFunction( this[ match ] ) ) { + this[ match ]( context[ match ] ); + + // ...and otherwise set as attributes + } else { + this.attr( match, context[ match ] ); + } + } + } + + return this; + + // HANDLE: $(#id) + } else { + elem = document.getElementById( match[2] ); + + // Support: Blackberry 4.6 + // gEBID returns nodes no longer in the document (#6963) + if ( elem && elem.parentNode ) { + // Inject the element directly into the jQuery object + this.length = 1; + this[0] = elem; + } + + this.context = document; + this.selector = selector; + return this; + } + + // HANDLE: $(expr, $(...)) + } else if ( !context || context.jquery ) { + return ( context || rootjQuery ).find( selector ); + + // HANDLE: $(expr, context) + // (which is just equivalent to: $(context).find(expr) + } else { + return this.constructor( context ).find( selector ); + } + + // HANDLE: $(DOMElement) + } else if ( selector.nodeType ) { + this.context = this[0] = selector; + this.length = 1; + return this; + + // HANDLE: $(function) + // Shortcut for document ready + } else if ( jQuery.isFunction( selector ) ) { + return typeof rootjQuery.ready !== "undefined" ? + rootjQuery.ready( selector ) : + // Execute immediately if ready is not present + selector( jQuery ); + } + + if ( selector.selector !== undefined ) { + this.selector = selector.selector; + this.context = selector.context; + } + + return jQuery.makeArray( selector, this ); + }; + +// Give the init function the jQuery prototype for later instantiation +init.prototype = jQuery.fn; + +// Initialize central reference +rootjQuery = jQuery( document ); + + +var rparentsprev = /^(?:parents|prev(?:Until|All))/, + // Methods guaranteed to produce a unique set when starting from a unique set + guaranteedUnique = { + children: true, + contents: true, + next: true, + prev: true + }; + +jQuery.extend({ + dir: function( elem, dir, until ) { + var matched = [], + truncate = until !== undefined; + + while ( (elem = elem[ dir ]) && elem.nodeType !== 9 ) { + if ( elem.nodeType === 1 ) { + if ( truncate && jQuery( elem ).is( until ) ) { + break; + } + matched.push( elem ); + } + } + return matched; + }, + + sibling: function( n, elem ) { + var matched = []; + + for ( ; n; n = n.nextSibling ) { + if ( n.nodeType === 1 && n !== elem ) { + matched.push( n ); + } + } + + return matched; + } +}); + +jQuery.fn.extend({ + has: function( target ) { + var targets = jQuery( target, this ), + l = targets.length; + + return this.filter(function() { + var i = 0; + for ( ; i < l; i++ ) { + if ( jQuery.contains( this, targets[i] ) ) { + return true; + } + } + }); + }, + + closest: function( selectors, context ) { + var cur, + i = 0, + l = this.length, + matched = [], + pos = rneedsContext.test( selectors ) || typeof selectors !== "string" ? + jQuery( selectors, context || this.context ) : + 0; + + for ( ; i < l; i++ ) { + for ( cur = this[i]; cur && cur !== context; cur = cur.parentNode ) { + // Always skip document fragments + if ( cur.nodeType < 11 && (pos ? + pos.index(cur) > -1 : + + // Don't pass non-elements to Sizzle + cur.nodeType === 1 && + jQuery.find.matchesSelector(cur, selectors)) ) { + + matched.push( cur ); + break; + } + } + } + + return this.pushStack( matched.length > 1 ? jQuery.unique( matched ) : matched ); + }, + + // Determine the position of an element within the set + index: function( elem ) { + + // No argument, return index in parent + if ( !elem ) { + return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1; + } + + // Index in selector + if ( typeof elem === "string" ) { + return indexOf.call( jQuery( elem ), this[ 0 ] ); + } + + // Locate the position of the desired element + return indexOf.call( this, + + // If it receives a jQuery object, the first element is used + elem.jquery ? elem[ 0 ] : elem + ); + }, + + add: function( selector, context ) { + return this.pushStack( + jQuery.unique( + jQuery.merge( this.get(), jQuery( selector, context ) ) + ) + ); + }, + + addBack: function( selector ) { + return this.add( selector == null ? + this.prevObject : this.prevObject.filter(selector) + ); + } +}); + +function sibling( cur, dir ) { + while ( (cur = cur[dir]) && cur.nodeType !== 1 ) {} + return cur; +} + +jQuery.each({ + parent: function( elem ) { + var parent = elem.parentNode; + return parent && parent.nodeType !== 11 ? parent : null; + }, + parents: function( elem ) { + return jQuery.dir( elem, "parentNode" ); + }, + parentsUntil: function( elem, i, until ) { + return jQuery.dir( elem, "parentNode", until ); + }, + next: function( elem ) { + return sibling( elem, "nextSibling" ); + }, + prev: function( elem ) { + return sibling( elem, "previousSibling" ); + }, + nextAll: function( elem ) { + return jQuery.dir( elem, "nextSibling" ); + }, + prevAll: function( elem ) { + return jQuery.dir( elem, "previousSibling" ); + }, + nextUntil: function( elem, i, until ) { + return jQuery.dir( elem, "nextSibling", until ); + }, + prevUntil: function( elem, i, until ) { + return jQuery.dir( elem, "previousSibling", until ); + }, + siblings: function( elem ) { + return jQuery.sibling( ( elem.parentNode || {} ).firstChild, elem ); + }, + children: function( elem ) { + return jQuery.sibling( elem.firstChild ); + }, + contents: function( elem ) { + return elem.contentDocument || jQuery.merge( [], elem.childNodes ); + } +}, function( name, fn ) { + jQuery.fn[ name ] = function( until, selector ) { + var matched = jQuery.map( this, fn, until ); + + if ( name.slice( -5 ) !== "Until" ) { + selector = until; + } + + if ( selector && typeof selector === "string" ) { + matched = jQuery.filter( selector, matched ); + } + + if ( this.length > 1 ) { + // Remove duplicates + if ( !guaranteedUnique[ name ] ) { + jQuery.unique( matched ); + } + + // Reverse order for parents* and prev-derivatives + if ( rparentsprev.test( name ) ) { + matched.reverse(); + } + } + + return this.pushStack( matched ); + }; +}); +var rnotwhite = (/\S+/g); + + + +// String to Object options format cache +var optionsCache = {}; + +// Convert String-formatted options into Object-formatted ones and store in cache +function createOptions( options ) { + var object = optionsCache[ options ] = {}; + jQuery.each( options.match( rnotwhite ) || [], function( _, flag ) { + object[ flag ] = true; + }); + return object; +} + +/* + * Create a callback list using the following parameters: + * + * options: an optional list of space-separated options that will change how + * the callback list behaves or a more traditional option object + * + * By default a callback list will act like an event callback list and can be + * "fired" multiple times. + * + * Possible options: + * + * once: will ensure the callback list can only be fired once (like a Deferred) + * + * memory: will keep track of previous values and will call any callback added + * after the list has been fired right away with the latest "memorized" + * values (like a Deferred) + * + * unique: will ensure a callback can only be added once (no duplicate in the list) + * + * stopOnFalse: interrupt callings when a callback returns false + * + */ +jQuery.Callbacks = function( options ) { + + // Convert options from String-formatted to Object-formatted if needed + // (we check in cache first) + options = typeof options === "string" ? + ( optionsCache[ options ] || createOptions( options ) ) : + jQuery.extend( {}, options ); + + var // Last fire value (for non-forgettable lists) + memory, + // Flag to know if list was already fired + fired, + // Flag to know if list is currently firing + firing, + // First callback to fire (used internally by add and fireWith) + firingStart, + // End of the loop when firing + firingLength, + // Index of currently firing callback (modified by remove if needed) + firingIndex, + // Actual callback list + list = [], + // Stack of fire calls for repeatable lists + stack = !options.once && [], + // Fire callbacks + fire = function( data ) { + memory = options.memory && data; + fired = true; + firingIndex = firingStart || 0; + firingStart = 0; + firingLength = list.length; + firing = true; + for ( ; list && firingIndex < firingLength; firingIndex++ ) { + if ( list[ firingIndex ].apply( data[ 0 ], data[ 1 ] ) === false && options.stopOnFalse ) { + memory = false; // To prevent further calls using add + break; + } + } + firing = false; + if ( list ) { + if ( stack ) { + if ( stack.length ) { + fire( stack.shift() ); + } + } else if ( memory ) { + list = []; + } else { + self.disable(); + } + } + }, + // Actual Callbacks object + self = { + // Add a callback or a collection of callbacks to the list + add: function() { + if ( list ) { + // First, we save the current length + var start = list.length; + (function add( args ) { + jQuery.each( args, function( _, arg ) { + var type = jQuery.type( arg ); + if ( type === "function" ) { + if ( !options.unique || !self.has( arg ) ) { + list.push( arg ); + } + } else if ( arg && arg.length && type !== "string" ) { + // Inspect recursively + add( arg ); + } + }); + })( arguments ); + // Do we need to add the callbacks to the + // current firing batch? + if ( firing ) { + firingLength = list.length; + // With memory, if we're not firing then + // we should call right away + } else if ( memory ) { + firingStart = start; + fire( memory ); + } + } + return this; + }, + // Remove a callback from the list + remove: function() { + if ( list ) { + jQuery.each( arguments, function( _, arg ) { + var index; + while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) { + list.splice( index, 1 ); + // Handle firing indexes + if ( firing ) { + if ( index <= firingLength ) { + firingLength--; + } + if ( index <= firingIndex ) { + firingIndex--; + } + } + } + }); + } + return this; + }, + // Check if a given callback is in the list. + // If no argument is given, return whether or not list has callbacks attached. + has: function( fn ) { + return fn ? jQuery.inArray( fn, list ) > -1 : !!( list && list.length ); + }, + // Remove all callbacks from the list + empty: function() { + list = []; + firingLength = 0; + return this; + }, + // Have the list do nothing anymore + disable: function() { + list = stack = memory = undefined; + return this; + }, + // Is it disabled? + disabled: function() { + return !list; + }, + // Lock the list in its current state + lock: function() { + stack = undefined; + if ( !memory ) { + self.disable(); + } + return this; + }, + // Is it locked? + locked: function() { + return !stack; + }, + // Call all callbacks with the given context and arguments + fireWith: function( context, args ) { + if ( list && ( !fired || stack ) ) { + args = args || []; + args = [ context, args.slice ? args.slice() : args ]; + if ( firing ) { + stack.push( args ); + } else { + fire( args ); + } + } + return this; + }, + // Call all the callbacks with the given arguments + fire: function() { + self.fireWith( this, arguments ); + return this; + }, + // To know if the callbacks have already been called at least once + fired: function() { + return !!fired; + } + }; + + return self; +}; + + +jQuery.extend({ + + Deferred: function( func ) { + var tuples = [ + // action, add listener, listener list, final state + [ "resolve", "done", jQuery.Callbacks("once memory"), "resolved" ], + [ "reject", "fail", jQuery.Callbacks("once memory"), "rejected" ], + [ "notify", "progress", jQuery.Callbacks("memory") ] + ], + state = "pending", + promise = { + state: function() { + return state; + }, + always: function() { + deferred.done( arguments ).fail( arguments ); + return this; + }, + then: function( /* fnDone, fnFail, fnProgress */ ) { + var fns = arguments; + return jQuery.Deferred(function( newDefer ) { + jQuery.each( tuples, function( i, tuple ) { + var fn = jQuery.isFunction( fns[ i ] ) && fns[ i ]; + // deferred[ done | fail | progress ] for forwarding actions to newDefer + deferred[ tuple[1] ](function() { + var returned = fn && fn.apply( this, arguments ); + if ( returned && jQuery.isFunction( returned.promise ) ) { + returned.promise() + .done( newDefer.resolve ) + .fail( newDefer.reject ) + .progress( newDefer.notify ); + } else { + newDefer[ tuple[ 0 ] + "With" ]( this === promise ? newDefer.promise() : this, fn ? [ returned ] : arguments ); + } + }); + }); + fns = null; + }).promise(); + }, + // Get a promise for this deferred + // If obj is provided, the promise aspect is added to the object + promise: function( obj ) { + return obj != null ? jQuery.extend( obj, promise ) : promise; + } + }, + deferred = {}; + + // Keep pipe for back-compat + promise.pipe = promise.then; + + // Add list-specific methods + jQuery.each( tuples, function( i, tuple ) { + var list = tuple[ 2 ], + stateString = tuple[ 3 ]; + + // promise[ done | fail | progress ] = list.add + promise[ tuple[1] ] = list.add; + + // Handle state + if ( stateString ) { + list.add(function() { + // state = [ resolved | rejected ] + state = stateString; + + // [ reject_list | resolve_list ].disable; progress_list.lock + }, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock ); + } + + // deferred[ resolve | reject | notify ] + deferred[ tuple[0] ] = function() { + deferred[ tuple[0] + "With" ]( this === deferred ? promise : this, arguments ); + return this; + }; + deferred[ tuple[0] + "With" ] = list.fireWith; + }); + + // Make the deferred a promise + promise.promise( deferred ); + + // Call given func if any + if ( func ) { + func.call( deferred, deferred ); + } + + // All done! + return deferred; + }, + + // Deferred helper + when: function( subordinate /* , ..., subordinateN */ ) { + var i = 0, + resolveValues = slice.call( arguments ), + length = resolveValues.length, + + // the count of uncompleted subordinates + remaining = length !== 1 || ( subordinate && jQuery.isFunction( subordinate.promise ) ) ? length : 0, + + // the master Deferred. If resolveValues consist of only a single Deferred, just use that. + deferred = remaining === 1 ? subordinate : jQuery.Deferred(), + + // Update function for both resolve and progress values + updateFunc = function( i, contexts, values ) { + return function( value ) { + contexts[ i ] = this; + values[ i ] = arguments.length > 1 ? slice.call( arguments ) : value; + if ( values === progressValues ) { + deferred.notifyWith( contexts, values ); + } else if ( !( --remaining ) ) { + deferred.resolveWith( contexts, values ); + } + }; + }, + + progressValues, progressContexts, resolveContexts; + + // Add listeners to Deferred subordinates; treat others as resolved + if ( length > 1 ) { + progressValues = new Array( length ); + progressContexts = new Array( length ); + resolveContexts = new Array( length ); + for ( ; i < length; i++ ) { + if ( resolveValues[ i ] && jQuery.isFunction( resolveValues[ i ].promise ) ) { + resolveValues[ i ].promise() + .done( updateFunc( i, resolveContexts, resolveValues ) ) + .fail( deferred.reject ) + .progress( updateFunc( i, progressContexts, progressValues ) ); + } else { + --remaining; + } + } + } + + // If we're not waiting on anything, resolve the master + if ( !remaining ) { + deferred.resolveWith( resolveContexts, resolveValues ); + } + + return deferred.promise(); + } +}); + + +// The deferred used on DOM ready +var readyList; + +jQuery.fn.ready = function( fn ) { + // Add the callback + jQuery.ready.promise().done( fn ); + + return this; +}; + +jQuery.extend({ + // Is the DOM ready to be used? Set to true once it occurs. + isReady: false, + + // A counter to track how many items to wait for before + // the ready event fires. See #6781 + readyWait: 1, + + // Hold (or release) the ready event + holdReady: function( hold ) { + if ( hold ) { + jQuery.readyWait++; + } else { + jQuery.ready( true ); + } + }, + + // Handle when the DOM is ready + ready: function( wait ) { + + // Abort if there are pending holds or we're already ready + if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) { + return; + } + + // Remember that the DOM is ready + jQuery.isReady = true; + + // If a normal DOM Ready event fired, decrement, and wait if need be + if ( wait !== true && --jQuery.readyWait > 0 ) { + return; + } + + // If there are functions bound, to execute + readyList.resolveWith( document, [ jQuery ] ); + + // Trigger any bound ready events + if ( jQuery.fn.triggerHandler ) { + jQuery( document ).triggerHandler( "ready" ); + jQuery( document ).off( "ready" ); + } + } +}); + +/** + * The ready event handler and self cleanup method + */ +function completed() { + document.removeEventListener( "DOMContentLoaded", completed, false ); + window.removeEventListener( "load", completed, false ); + jQuery.ready(); +} + +jQuery.ready.promise = function( obj ) { + if ( !readyList ) { + + readyList = jQuery.Deferred(); + + // Catch cases where $(document).ready() is called after the browser event has already occurred. + // We once tried to use readyState "interactive" here, but it caused issues like the one + // discovered by ChrisS here: http://bugs.jquery.com/ticket/12282#comment:15 + if ( document.readyState === "complete" ) { + // Handle it asynchronously to allow scripts the opportunity to delay ready + setTimeout( jQuery.ready ); + + } else { + + // Use the handy event callback + document.addEventListener( "DOMContentLoaded", completed, false ); + + // A fallback to window.onload, that will always work + window.addEventListener( "load", completed, false ); + } + } + return readyList.promise( obj ); +}; + +// Kick off the DOM ready check even if the user does not +jQuery.ready.promise(); + + + + +// Multifunctional method to get and set values of a collection +// The value/s can optionally be executed if it's a function +var access = jQuery.access = function( elems, fn, key, value, chainable, emptyGet, raw ) { + var i = 0, + len = elems.length, + bulk = key == null; + + // Sets many values + if ( jQuery.type( key ) === "object" ) { + chainable = true; + for ( i in key ) { + jQuery.access( elems, fn, i, key[i], true, emptyGet, raw ); + } + + // Sets one value + } else if ( value !== undefined ) { + chainable = true; + + if ( !jQuery.isFunction( value ) ) { + raw = true; + } + + if ( bulk ) { + // Bulk operations run against the entire set + if ( raw ) { + fn.call( elems, value ); + fn = null; + + // ...except when executing function values + } else { + bulk = fn; + fn = function( elem, key, value ) { + return bulk.call( jQuery( elem ), value ); + }; + } + } + + if ( fn ) { + for ( ; i < len; i++ ) { + fn( elems[i], key, raw ? value : value.call( elems[i], i, fn( elems[i], key ) ) ); + } + } + } + + return chainable ? + elems : + + // Gets + bulk ? + fn.call( elems ) : + len ? fn( elems[0], key ) : emptyGet; +}; + + +/** + * Determines whether an object can have data + */ +jQuery.acceptData = function( owner ) { + // Accepts only: + // - Node + // - Node.ELEMENT_NODE + // - Node.DOCUMENT_NODE + // - Object + // - Any + /* jshint -W018 */ + return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType ); +}; + + +function Data() { + // Support: Android<4, + // Old WebKit does not have Object.preventExtensions/freeze method, + // return new empty object instead with no [[set]] accessor + Object.defineProperty( this.cache = {}, 0, { + get: function() { + return {}; + } + }); + + this.expando = jQuery.expando + Data.uid++; +} + +Data.uid = 1; +Data.accepts = jQuery.acceptData; + +Data.prototype = { + key: function( owner ) { + // We can accept data for non-element nodes in modern browsers, + // but we should not, see #8335. + // Always return the key for a frozen object. + if ( !Data.accepts( owner ) ) { + return 0; + } + + var descriptor = {}, + // Check if the owner object already has a cache key + unlock = owner[ this.expando ]; + + // If not, create one + if ( !unlock ) { + unlock = Data.uid++; + + // Secure it in a non-enumerable, non-writable property + try { + descriptor[ this.expando ] = { value: unlock }; + Object.defineProperties( owner, descriptor ); + + // Support: Android<4 + // Fallback to a less secure definition + } catch ( e ) { + descriptor[ this.expando ] = unlock; + jQuery.extend( owner, descriptor ); + } + } + + // Ensure the cache object + if ( !this.cache[ unlock ] ) { + this.cache[ unlock ] = {}; + } + + return unlock; + }, + set: function( owner, data, value ) { + var prop, + // There may be an unlock assigned to this node, + // if there is no entry for this "owner", create one inline + // and set the unlock as though an owner entry had always existed + unlock = this.key( owner ), + cache = this.cache[ unlock ]; + + // Handle: [ owner, key, value ] args + if ( typeof data === "string" ) { + cache[ data ] = value; + + // Handle: [ owner, { properties } ] args + } else { + // Fresh assignments by object are shallow copied + if ( jQuery.isEmptyObject( cache ) ) { + jQuery.extend( this.cache[ unlock ], data ); + // Otherwise, copy the properties one-by-one to the cache object + } else { + for ( prop in data ) { + cache[ prop ] = data[ prop ]; + } + } + } + return cache; + }, + get: function( owner, key ) { + // Either a valid cache is found, or will be created. + // New caches will be created and the unlock returned, + // allowing direct access to the newly created + // empty data object. A valid owner object must be provided. + var cache = this.cache[ this.key( owner ) ]; + + return key === undefined ? + cache : cache[ key ]; + }, + access: function( owner, key, value ) { + var stored; + // In cases where either: + // + // 1. No key was specified + // 2. A string key was specified, but no value provided + // + // Take the "read" path and allow the get method to determine + // which value to return, respectively either: + // + // 1. The entire cache object + // 2. The data stored at the key + // + if ( key === undefined || + ((key && typeof key === "string") && value === undefined) ) { + + stored = this.get( owner, key ); + + return stored !== undefined ? + stored : this.get( owner, jQuery.camelCase(key) ); + } + + // [*]When the key is not a string, or both a key and value + // are specified, set or extend (existing objects) with either: + // + // 1. An object of properties + // 2. A key and value + // + this.set( owner, key, value ); + + // Since the "set" path can have two possible entry points + // return the expected data based on which path was taken[*] + return value !== undefined ? value : key; + }, + remove: function( owner, key ) { + var i, name, camel, + unlock = this.key( owner ), + cache = this.cache[ unlock ]; + + if ( key === undefined ) { + this.cache[ unlock ] = {}; + + } else { + // Support array or space separated string of keys + if ( jQuery.isArray( key ) ) { + // If "name" is an array of keys... + // When data is initially created, via ("key", "val") signature, + // keys will be converted to camelCase. + // Since there is no way to tell _how_ a key was added, remove + // both plain key and camelCase key. #12786 + // This will only penalize the array argument path. + name = key.concat( key.map( jQuery.camelCase ) ); + } else { + camel = jQuery.camelCase( key ); + // Try the string as a key before any manipulation + if ( key in cache ) { + name = [ key, camel ]; + } else { + // If a key with the spaces exists, use it. + // Otherwise, create an array by matching non-whitespace + name = camel; + name = name in cache ? + [ name ] : ( name.match( rnotwhite ) || [] ); + } + } + + i = name.length; + while ( i-- ) { + delete cache[ name[ i ] ]; + } + } + }, + hasData: function( owner ) { + return !jQuery.isEmptyObject( + this.cache[ owner[ this.expando ] ] || {} + ); + }, + discard: function( owner ) { + if ( owner[ this.expando ] ) { + delete this.cache[ owner[ this.expando ] ]; + } + } +}; +var data_priv = new Data(); + +var data_user = new Data(); + + + +// Implementation Summary +// +// 1. Enforce API surface and semantic compatibility with 1.9.x branch +// 2. Improve the module's maintainability by reducing the storage +// paths to a single mechanism. +// 3. Use the same single mechanism to support "private" and "user" data. +// 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData) +// 5. Avoid exposing implementation details on user objects (eg. expando properties) +// 6. Provide a clear path for implementation upgrade to WeakMap in 2014 + +var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/, + rmultiDash = /([A-Z])/g; + +function dataAttr( elem, key, data ) { + var name; + + // If nothing was found internally, try to fetch any + // data from the HTML5 data-* attribute + if ( data === undefined && elem.nodeType === 1 ) { + name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase(); + data = elem.getAttribute( name ); + + if ( typeof data === "string" ) { + try { + data = data === "true" ? true : + data === "false" ? false : + data === "null" ? null : + // Only convert to a number if it doesn't change the string + +data + "" === data ? +data : + rbrace.test( data ) ? jQuery.parseJSON( data ) : + data; + } catch( e ) {} + + // Make sure we set the data so it isn't changed later + data_user.set( elem, key, data ); + } else { + data = undefined; + } + } + return data; +} + +jQuery.extend({ + hasData: function( elem ) { + return data_user.hasData( elem ) || data_priv.hasData( elem ); + }, + + data: function( elem, name, data ) { + return data_user.access( elem, name, data ); + }, + + removeData: function( elem, name ) { + data_user.remove( elem, name ); + }, + + // TODO: Now that all calls to _data and _removeData have been replaced + // with direct calls to data_priv methods, these can be deprecated. + _data: function( elem, name, data ) { + return data_priv.access( elem, name, data ); + }, + + _removeData: function( elem, name ) { + data_priv.remove( elem, name ); + } +}); + +jQuery.fn.extend({ + data: function( key, value ) { + var i, name, data, + elem = this[ 0 ], + attrs = elem && elem.attributes; + + // Gets all values + if ( key === undefined ) { + if ( this.length ) { + data = data_user.get( elem ); + + if ( elem.nodeType === 1 && !data_priv.get( elem, "hasDataAttrs" ) ) { + i = attrs.length; + while ( i-- ) { + + // Support: IE11+ + // The attrs elements can be null (#14894) + if ( attrs[ i ] ) { + name = attrs[ i ].name; + if ( name.indexOf( "data-" ) === 0 ) { + name = jQuery.camelCase( name.slice(5) ); + dataAttr( elem, name, data[ name ] ); + } + } + } + data_priv.set( elem, "hasDataAttrs", true ); + } + } + + return data; + } + + // Sets multiple values + if ( typeof key === "object" ) { + return this.each(function() { + data_user.set( this, key ); + }); + } + + return access( this, function( value ) { + var data, + camelKey = jQuery.camelCase( key ); + + // The calling jQuery object (element matches) is not empty + // (and therefore has an element appears at this[ 0 ]) and the + // `value` parameter was not undefined. An empty jQuery object + // will result in `undefined` for elem = this[ 0 ] which will + // throw an exception if an attempt to read a data cache is made. + if ( elem && value === undefined ) { + // Attempt to get data from the cache + // with the key as-is + data = data_user.get( elem, key ); + if ( data !== undefined ) { + return data; + } + + // Attempt to get data from the cache + // with the key camelized + data = data_user.get( elem, camelKey ); + if ( data !== undefined ) { + return data; + } + + // Attempt to "discover" the data in + // HTML5 custom data-* attrs + data = dataAttr( elem, camelKey, undefined ); + if ( data !== undefined ) { + return data; + } + + // We tried really hard, but the data doesn't exist. + return; + } + + // Set the data... + this.each(function() { + // First, attempt to store a copy or reference of any + // data that might've been store with a camelCased key. + var data = data_user.get( this, camelKey ); + + // For HTML5 data-* attribute interop, we have to + // store property names with dashes in a camelCase form. + // This might not apply to all properties...* + data_user.set( this, camelKey, value ); + + // *... In the case of properties that might _actually_ + // have dashes, we need to also store a copy of that + // unchanged property. + if ( key.indexOf("-") !== -1 && data !== undefined ) { + data_user.set( this, key, value ); + } + }); + }, null, value, arguments.length > 1, null, true ); + }, + + removeData: function( key ) { + return this.each(function() { + data_user.remove( this, key ); + }); + } +}); + + +jQuery.extend({ + queue: function( elem, type, data ) { + var queue; + + if ( elem ) { + type = ( type || "fx" ) + "queue"; + queue = data_priv.get( elem, type ); + + // Speed up dequeue by getting out quickly if this is just a lookup + if ( data ) { + if ( !queue || jQuery.isArray( data ) ) { + queue = data_priv.access( elem, type, jQuery.makeArray(data) ); + } else { + queue.push( data ); + } + } + return queue || []; + } + }, + + dequeue: function( elem, type ) { + type = type || "fx"; + + var queue = jQuery.queue( elem, type ), + startLength = queue.length, + fn = queue.shift(), + hooks = jQuery._queueHooks( elem, type ), + next = function() { + jQuery.dequeue( elem, type ); + }; + + // If the fx queue is dequeued, always remove the progress sentinel + if ( fn === "inprogress" ) { + fn = queue.shift(); + startLength--; + } + + if ( fn ) { + + // Add a progress sentinel to prevent the fx queue from being + // automatically dequeued + if ( type === "fx" ) { + queue.unshift( "inprogress" ); + } + + // Clear up the last queue stop function + delete hooks.stop; + fn.call( elem, next, hooks ); + } + + if ( !startLength && hooks ) { + hooks.empty.fire(); + } + }, + + // Not public - generate a queueHooks object, or return the current one + _queueHooks: function( elem, type ) { + var key = type + "queueHooks"; + return data_priv.get( elem, key ) || data_priv.access( elem, key, { + empty: jQuery.Callbacks("once memory").add(function() { + data_priv.remove( elem, [ type + "queue", key ] ); + }) + }); + } +}); + +jQuery.fn.extend({ + queue: function( type, data ) { + var setter = 2; + + if ( typeof type !== "string" ) { + data = type; + type = "fx"; + setter--; + } + + if ( arguments.length < setter ) { + return jQuery.queue( this[0], type ); + } + + return data === undefined ? + this : + this.each(function() { + var queue = jQuery.queue( this, type, data ); + + // Ensure a hooks for this queue + jQuery._queueHooks( this, type ); + + if ( type === "fx" && queue[0] !== "inprogress" ) { + jQuery.dequeue( this, type ); + } + }); + }, + dequeue: function( type ) { + return this.each(function() { + jQuery.dequeue( this, type ); + }); + }, + clearQueue: function( type ) { + return this.queue( type || "fx", [] ); + }, + // Get a promise resolved when queues of a certain type + // are emptied (fx is the type by default) + promise: function( type, obj ) { + var tmp, + count = 1, + defer = jQuery.Deferred(), + elements = this, + i = this.length, + resolve = function() { + if ( !( --count ) ) { + defer.resolveWith( elements, [ elements ] ); + } + }; + + if ( typeof type !== "string" ) { + obj = type; + type = undefined; + } + type = type || "fx"; + + while ( i-- ) { + tmp = data_priv.get( elements[ i ], type + "queueHooks" ); + if ( tmp && tmp.empty ) { + count++; + tmp.empty.add( resolve ); + } + } + resolve(); + return defer.promise( obj ); + } +}); +var pnum = (/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/).source; + +var cssExpand = [ "Top", "Right", "Bottom", "Left" ]; + +var isHidden = function( elem, el ) { + // isHidden might be called from jQuery#filter function; + // in that case, element will be second argument + elem = el || elem; + return jQuery.css( elem, "display" ) === "none" || !jQuery.contains( elem.ownerDocument, elem ); + }; + +var rcheckableType = (/^(?:checkbox|radio)$/i); + + + +(function() { + var fragment = document.createDocumentFragment(), + div = fragment.appendChild( document.createElement( "div" ) ), + input = document.createElement( "input" ); + + // Support: Safari<=5.1 + // Check state lost if the name is set (#11217) + // Support: Windows Web Apps (WWA) + // `name` and `type` must use .setAttribute for WWA (#14901) + input.setAttribute( "type", "radio" ); + input.setAttribute( "checked", "checked" ); + input.setAttribute( "name", "t" ); + + div.appendChild( input ); + + // Support: Safari<=5.1, Android<4.2 + // Older WebKit doesn't clone checked state correctly in fragments + support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked; + + // Support: IE<=11+ + // Make sure textarea (and checkbox) defaultValue is properly cloned + div.innerHTML = ""; + support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue; +})(); +var strundefined = typeof undefined; + + + +support.focusinBubbles = "onfocusin" in window; + + +var + rkeyEvent = /^key/, + rmouseEvent = /^(?:mouse|pointer|contextmenu)|click/, + rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, + rtypenamespace = /^([^.]*)(?:\.(.+)|)$/; + +function returnTrue() { + return true; +} + +function returnFalse() { + return false; +} + +function safeActiveElement() { + try { + return document.activeElement; + } catch ( err ) { } +} + +/* + * Helper functions for managing events -- not part of the public interface. + * Props to Dean Edwards' addEvent library for many of the ideas. + */ +jQuery.event = { + + global: {}, + + add: function( elem, types, handler, data, selector ) { + + var handleObjIn, eventHandle, tmp, + events, t, handleObj, + special, handlers, type, namespaces, origType, + elemData = data_priv.get( elem ); + + // Don't attach events to noData or text/comment nodes (but allow plain objects) + if ( !elemData ) { + return; + } + + // Caller can pass in an object of custom data in lieu of the handler + if ( handler.handler ) { + handleObjIn = handler; + handler = handleObjIn.handler; + selector = handleObjIn.selector; + } + + // Make sure that the handler has a unique ID, used to find/remove it later + if ( !handler.guid ) { + handler.guid = jQuery.guid++; + } + + // Init the element's event structure and main handler, if this is the first + if ( !(events = elemData.events) ) { + events = elemData.events = {}; + } + if ( !(eventHandle = elemData.handle) ) { + eventHandle = elemData.handle = function( e ) { + // Discard the second event of a jQuery.event.trigger() and + // when an event is called after a page has unloaded + return typeof jQuery !== strundefined && jQuery.event.triggered !== e.type ? + jQuery.event.dispatch.apply( elem, arguments ) : undefined; + }; + } + + // Handle multiple events separated by a space + types = ( types || "" ).match( rnotwhite ) || [ "" ]; + t = types.length; + while ( t-- ) { + tmp = rtypenamespace.exec( types[t] ) || []; + type = origType = tmp[1]; + namespaces = ( tmp[2] || "" ).split( "." ).sort(); + + // There *must* be a type, no attaching namespace-only handlers + if ( !type ) { + continue; + } + + // If event changes its type, use the special event handlers for the changed type + special = jQuery.event.special[ type ] || {}; + + // If selector defined, determine special event api type, otherwise given type + type = ( selector ? special.delegateType : special.bindType ) || type; + + // Update special based on newly reset type + special = jQuery.event.special[ type ] || {}; + + // handleObj is passed to all event handlers + handleObj = jQuery.extend({ + type: type, + origType: origType, + data: data, + handler: handler, + guid: handler.guid, + selector: selector, + needsContext: selector && jQuery.expr.match.needsContext.test( selector ), + namespace: namespaces.join(".") + }, handleObjIn ); + + // Init the event handler queue if we're the first + if ( !(handlers = events[ type ]) ) { + handlers = events[ type ] = []; + handlers.delegateCount = 0; + + // Only use addEventListener if the special events handler returns false + if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) { + if ( elem.addEventListener ) { + elem.addEventListener( type, eventHandle, false ); + } + } + } + + if ( special.add ) { + special.add.call( elem, handleObj ); + + if ( !handleObj.handler.guid ) { + handleObj.handler.guid = handler.guid; + } + } + + // Add to the element's handler list, delegates in front + if ( selector ) { + handlers.splice( handlers.delegateCount++, 0, handleObj ); + } else { + handlers.push( handleObj ); + } + + // Keep track of which events have ever been used, for event optimization + jQuery.event.global[ type ] = true; + } + + }, + + // Detach an event or set of events from an element + remove: function( elem, types, handler, selector, mappedTypes ) { + + var j, origCount, tmp, + events, t, handleObj, + special, handlers, type, namespaces, origType, + elemData = data_priv.hasData( elem ) && data_priv.get( elem ); + + if ( !elemData || !(events = elemData.events) ) { + return; + } + + // Once for each type.namespace in types; type may be omitted + types = ( types || "" ).match( rnotwhite ) || [ "" ]; + t = types.length; + while ( t-- ) { + tmp = rtypenamespace.exec( types[t] ) || []; + type = origType = tmp[1]; + namespaces = ( tmp[2] || "" ).split( "." ).sort(); + + // Unbind all events (on this namespace, if provided) for the element + if ( !type ) { + for ( type in events ) { + jQuery.event.remove( elem, type + types[ t ], handler, selector, true ); + } + continue; + } + + special = jQuery.event.special[ type ] || {}; + type = ( selector ? special.delegateType : special.bindType ) || type; + handlers = events[ type ] || []; + tmp = tmp[2] && new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" ); + + // Remove matching events + origCount = j = handlers.length; + while ( j-- ) { + handleObj = handlers[ j ]; + + if ( ( mappedTypes || origType === handleObj.origType ) && + ( !handler || handler.guid === handleObj.guid ) && + ( !tmp || tmp.test( handleObj.namespace ) ) && + ( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) { + handlers.splice( j, 1 ); + + if ( handleObj.selector ) { + handlers.delegateCount--; + } + if ( special.remove ) { + special.remove.call( elem, handleObj ); + } + } + } + + // Remove generic event handler if we removed something and no more handlers exist + // (avoids potential for endless recursion during removal of special event handlers) + if ( origCount && !handlers.length ) { + if ( !special.teardown || special.teardown.call( elem, namespaces, elemData.handle ) === false ) { + jQuery.removeEvent( elem, type, elemData.handle ); + } + + delete events[ type ]; + } + } + + // Remove the expando if it's no longer used + if ( jQuery.isEmptyObject( events ) ) { + delete elemData.handle; + data_priv.remove( elem, "events" ); + } + }, + + trigger: function( event, data, elem, onlyHandlers ) { + + var i, cur, tmp, bubbleType, ontype, handle, special, + eventPath = [ elem || document ], + type = hasOwn.call( event, "type" ) ? event.type : event, + namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split(".") : []; + + cur = tmp = elem = elem || document; + + // Don't do events on text and comment nodes + if ( elem.nodeType === 3 || elem.nodeType === 8 ) { + return; + } + + // focus/blur morphs to focusin/out; ensure we're not firing them right now + if ( rfocusMorph.test( type + jQuery.event.triggered ) ) { + return; + } + + if ( type.indexOf(".") >= 0 ) { + // Namespaced trigger; create a regexp to match event type in handle() + namespaces = type.split("."); + type = namespaces.shift(); + namespaces.sort(); + } + ontype = type.indexOf(":") < 0 && "on" + type; + + // Caller can pass in a jQuery.Event object, Object, or just an event type string + event = event[ jQuery.expando ] ? + event : + new jQuery.Event( type, typeof event === "object" && event ); + + // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true) + event.isTrigger = onlyHandlers ? 2 : 3; + event.namespace = namespaces.join("."); + event.namespace_re = event.namespace ? + new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" ) : + null; + + // Clean up the event in case it is being reused + event.result = undefined; + if ( !event.target ) { + event.target = elem; + } + + // Clone any incoming data and prepend the event, creating the handler arg list + data = data == null ? + [ event ] : + jQuery.makeArray( data, [ event ] ); + + // Allow special events to draw outside the lines + special = jQuery.event.special[ type ] || {}; + if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) { + return; + } + + // Determine event propagation path in advance, per W3C events spec (#9951) + // Bubble up to document, then to window; watch for a global ownerDocument var (#9724) + if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) { + + bubbleType = special.delegateType || type; + if ( !rfocusMorph.test( bubbleType + type ) ) { + cur = cur.parentNode; + } + for ( ; cur; cur = cur.parentNode ) { + eventPath.push( cur ); + tmp = cur; + } + + // Only add window if we got to document (e.g., not plain obj or detached DOM) + if ( tmp === (elem.ownerDocument || document) ) { + eventPath.push( tmp.defaultView || tmp.parentWindow || window ); + } + } + + // Fire handlers on the event path + i = 0; + while ( (cur = eventPath[i++]) && !event.isPropagationStopped() ) { + + event.type = i > 1 ? + bubbleType : + special.bindType || type; + + // jQuery handler + handle = ( data_priv.get( cur, "events" ) || {} )[ event.type ] && data_priv.get( cur, "handle" ); + if ( handle ) { + handle.apply( cur, data ); + } + + // Native handler + handle = ontype && cur[ ontype ]; + if ( handle && handle.apply && jQuery.acceptData( cur ) ) { + event.result = handle.apply( cur, data ); + if ( event.result === false ) { + event.preventDefault(); + } + } + } + event.type = type; + + // If nobody prevented the default action, do it now + if ( !onlyHandlers && !event.isDefaultPrevented() ) { + + if ( (!special._default || special._default.apply( eventPath.pop(), data ) === false) && + jQuery.acceptData( elem ) ) { + + // Call a native DOM method on the target with the same name name as the event. + // Don't do default actions on window, that's where global variables be (#6170) + if ( ontype && jQuery.isFunction( elem[ type ] ) && !jQuery.isWindow( elem ) ) { + + // Don't re-trigger an onFOO event when we call its FOO() method + tmp = elem[ ontype ]; + + if ( tmp ) { + elem[ ontype ] = null; + } + + // Prevent re-triggering of the same event, since we already bubbled it above + jQuery.event.triggered = type; + elem[ type ](); + jQuery.event.triggered = undefined; + + if ( tmp ) { + elem[ ontype ] = tmp; + } + } + } + } + + return event.result; + }, + + dispatch: function( event ) { + + // Make a writable jQuery.Event from the native event object + event = jQuery.event.fix( event ); + + var i, j, ret, matched, handleObj, + handlerQueue = [], + args = slice.call( arguments ), + handlers = ( data_priv.get( this, "events" ) || {} )[ event.type ] || [], + special = jQuery.event.special[ event.type ] || {}; + + // Use the fix-ed jQuery.Event rather than the (read-only) native event + args[0] = event; + event.delegateTarget = this; + + // Call the preDispatch hook for the mapped type, and let it bail if desired + if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) { + return; + } + + // Determine handlers + handlerQueue = jQuery.event.handlers.call( this, event, handlers ); + + // Run delegates first; they may want to stop propagation beneath us + i = 0; + while ( (matched = handlerQueue[ i++ ]) && !event.isPropagationStopped() ) { + event.currentTarget = matched.elem; + + j = 0; + while ( (handleObj = matched.handlers[ j++ ]) && !event.isImmediatePropagationStopped() ) { + + // Triggered event must either 1) have no namespace, or 2) have namespace(s) + // a subset or equal to those in the bound event (both can have no namespace). + if ( !event.namespace_re || event.namespace_re.test( handleObj.namespace ) ) { + + event.handleObj = handleObj; + event.data = handleObj.data; + + ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler ) + .apply( matched.elem, args ); + + if ( ret !== undefined ) { + if ( (event.result = ret) === false ) { + event.preventDefault(); + event.stopPropagation(); + } + } + } + } + } + + // Call the postDispatch hook for the mapped type + if ( special.postDispatch ) { + special.postDispatch.call( this, event ); + } + + return event.result; + }, + + handlers: function( event, handlers ) { + var i, matches, sel, handleObj, + handlerQueue = [], + delegateCount = handlers.delegateCount, + cur = event.target; + + // Find delegate handlers + // Black-hole SVG instance trees (#13180) + // Avoid non-left-click bubbling in Firefox (#3861) + if ( delegateCount && cur.nodeType && (!event.button || event.type !== "click") ) { + + for ( ; cur !== this; cur = cur.parentNode || this ) { + + // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764) + if ( cur.disabled !== true || event.type !== "click" ) { + matches = []; + for ( i = 0; i < delegateCount; i++ ) { + handleObj = handlers[ i ]; + + // Don't conflict with Object.prototype properties (#13203) + sel = handleObj.selector + " "; + + if ( matches[ sel ] === undefined ) { + matches[ sel ] = handleObj.needsContext ? + jQuery( sel, this ).index( cur ) >= 0 : + jQuery.find( sel, this, null, [ cur ] ).length; + } + if ( matches[ sel ] ) { + matches.push( handleObj ); + } + } + if ( matches.length ) { + handlerQueue.push({ elem: cur, handlers: matches }); + } + } + } + } + + // Add the remaining (directly-bound) handlers + if ( delegateCount < handlers.length ) { + handlerQueue.push({ elem: this, handlers: handlers.slice( delegateCount ) }); + } + + return handlerQueue; + }, + + // Includes some event props shared by KeyEvent and MouseEvent + props: "altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "), + + fixHooks: {}, + + keyHooks: { + props: "char charCode key keyCode".split(" "), + filter: function( event, original ) { + + // Add which for key events + if ( event.which == null ) { + event.which = original.charCode != null ? original.charCode : original.keyCode; + } + + return event; + } + }, + + mouseHooks: { + props: "button buttons clientX clientY offsetX offsetY pageX pageY screenX screenY toElement".split(" "), + filter: function( event, original ) { + var eventDoc, doc, body, + button = original.button; + + // Calculate pageX/Y if missing and clientX/Y available + if ( event.pageX == null && original.clientX != null ) { + eventDoc = event.target.ownerDocument || document; + doc = eventDoc.documentElement; + body = eventDoc.body; + + event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 ); + event.pageY = original.clientY + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - ( doc && doc.clientTop || body && body.clientTop || 0 ); + } + + // Add which for click: 1 === left; 2 === middle; 3 === right + // Note: button is not normalized, so don't use it + if ( !event.which && button !== undefined ) { + event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) ); + } + + return event; + } + }, + + fix: function( event ) { + if ( event[ jQuery.expando ] ) { + return event; + } + + // Create a writable copy of the event object and normalize some properties + var i, prop, copy, + type = event.type, + originalEvent = event, + fixHook = this.fixHooks[ type ]; + + if ( !fixHook ) { + this.fixHooks[ type ] = fixHook = + rmouseEvent.test( type ) ? this.mouseHooks : + rkeyEvent.test( type ) ? this.keyHooks : + {}; + } + copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props; + + event = new jQuery.Event( originalEvent ); + + i = copy.length; + while ( i-- ) { + prop = copy[ i ]; + event[ prop ] = originalEvent[ prop ]; + } + + // Support: Cordova 2.5 (WebKit) (#13255) + // All events should have a target; Cordova deviceready doesn't + if ( !event.target ) { + event.target = document; + } + + // Support: Safari 6.0+, Chrome<28 + // Target should not be a text node (#504, #13143) + if ( event.target.nodeType === 3 ) { + event.target = event.target.parentNode; + } + + return fixHook.filter ? fixHook.filter( event, originalEvent ) : event; + }, + + special: { + load: { + // Prevent triggered image.load events from bubbling to window.load + noBubble: true + }, + focus: { + // Fire native event if possible so blur/focus sequence is correct + trigger: function() { + if ( this !== safeActiveElement() && this.focus ) { + this.focus(); + return false; + } + }, + delegateType: "focusin" + }, + blur: { + trigger: function() { + if ( this === safeActiveElement() && this.blur ) { + this.blur(); + return false; + } + }, + delegateType: "focusout" + }, + click: { + // For checkbox, fire native event so checked state will be right + trigger: function() { + if ( this.type === "checkbox" && this.click && jQuery.nodeName( this, "input" ) ) { + this.click(); + return false; + } + }, + + // For cross-browser consistency, don't fire native .click() on links + _default: function( event ) { + return jQuery.nodeName( event.target, "a" ); + } + }, + + beforeunload: { + postDispatch: function( event ) { + + // Support: Firefox 20+ + // Firefox doesn't alert if the returnValue field is not set. + if ( event.result !== undefined && event.originalEvent ) { + event.originalEvent.returnValue = event.result; + } + } + } + }, + + simulate: function( type, elem, event, bubble ) { + // Piggyback on a donor event to simulate a different one. + // Fake originalEvent to avoid donor's stopPropagation, but if the + // simulated event prevents default then we do the same on the donor. + var e = jQuery.extend( + new jQuery.Event(), + event, + { + type: type, + isSimulated: true, + originalEvent: {} + } + ); + if ( bubble ) { + jQuery.event.trigger( e, null, elem ); + } else { + jQuery.event.dispatch.call( elem, e ); + } + if ( e.isDefaultPrevented() ) { + event.preventDefault(); + } + } +}; + +jQuery.removeEvent = function( elem, type, handle ) { + if ( elem.removeEventListener ) { + elem.removeEventListener( type, handle, false ); + } +}; + +jQuery.Event = function( src, props ) { + // Allow instantiation without the 'new' keyword + if ( !(this instanceof jQuery.Event) ) { + return new jQuery.Event( src, props ); + } + + // Event object + if ( src && src.type ) { + this.originalEvent = src; + this.type = src.type; + + // Events bubbling up the document may have been marked as prevented + // by a handler lower down the tree; reflect the correct value. + this.isDefaultPrevented = src.defaultPrevented || + src.defaultPrevented === undefined && + // Support: Android<4.0 + src.returnValue === false ? + returnTrue : + returnFalse; + + // Event type + } else { + this.type = src; + } + + // Put explicitly provided properties onto the event object + if ( props ) { + jQuery.extend( this, props ); + } + + // Create a timestamp if incoming event doesn't have one + this.timeStamp = src && src.timeStamp || jQuery.now(); + + // Mark it as fixed + this[ jQuery.expando ] = true; +}; + +// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding +// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html +jQuery.Event.prototype = { + isDefaultPrevented: returnFalse, + isPropagationStopped: returnFalse, + isImmediatePropagationStopped: returnFalse, + + preventDefault: function() { + var e = this.originalEvent; + + this.isDefaultPrevented = returnTrue; + + if ( e && e.preventDefault ) { + e.preventDefault(); + } + }, + stopPropagation: function() { + var e = this.originalEvent; + + this.isPropagationStopped = returnTrue; + + if ( e && e.stopPropagation ) { + e.stopPropagation(); + } + }, + stopImmediatePropagation: function() { + var e = this.originalEvent; + + this.isImmediatePropagationStopped = returnTrue; + + if ( e && e.stopImmediatePropagation ) { + e.stopImmediatePropagation(); + } + + this.stopPropagation(); + } +}; + +// Create mouseenter/leave events using mouseover/out and event-time checks +// Support: Chrome 15+ +jQuery.each({ + mouseenter: "mouseover", + mouseleave: "mouseout", + pointerenter: "pointerover", + pointerleave: "pointerout" +}, function( orig, fix ) { + jQuery.event.special[ orig ] = { + delegateType: fix, + bindType: fix, + + handle: function( event ) { + var ret, + target = this, + related = event.relatedTarget, + handleObj = event.handleObj; + + // For mousenter/leave call the handler if related is outside the target. + // NB: No relatedTarget if the mouse left/entered the browser window + if ( !related || (related !== target && !jQuery.contains( target, related )) ) { + event.type = handleObj.origType; + ret = handleObj.handler.apply( this, arguments ); + event.type = fix; + } + return ret; + } + }; +}); + +// Support: Firefox, Chrome, Safari +// Create "bubbling" focus and blur events +if ( !support.focusinBubbles ) { + jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) { + + // Attach a single capturing handler on the document while someone wants focusin/focusout + var handler = function( event ) { + jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true ); + }; + + jQuery.event.special[ fix ] = { + setup: function() { + var doc = this.ownerDocument || this, + attaches = data_priv.access( doc, fix ); + + if ( !attaches ) { + doc.addEventListener( orig, handler, true ); + } + data_priv.access( doc, fix, ( attaches || 0 ) + 1 ); + }, + teardown: function() { + var doc = this.ownerDocument || this, + attaches = data_priv.access( doc, fix ) - 1; + + if ( !attaches ) { + doc.removeEventListener( orig, handler, true ); + data_priv.remove( doc, fix ); + + } else { + data_priv.access( doc, fix, attaches ); + } + } + }; + }); +} + +jQuery.fn.extend({ + + on: function( types, selector, data, fn, /*INTERNAL*/ one ) { + var origFn, type; + + // Types can be a map of types/handlers + if ( typeof types === "object" ) { + // ( types-Object, selector, data ) + if ( typeof selector !== "string" ) { + // ( types-Object, data ) + data = data || selector; + selector = undefined; + } + for ( type in types ) { + this.on( type, selector, data, types[ type ], one ); + } + return this; + } + + if ( data == null && fn == null ) { + // ( types, fn ) + fn = selector; + data = selector = undefined; + } else if ( fn == null ) { + if ( typeof selector === "string" ) { + // ( types, selector, fn ) + fn = data; + data = undefined; + } else { + // ( types, data, fn ) + fn = data; + data = selector; + selector = undefined; + } + } + if ( fn === false ) { + fn = returnFalse; + } else if ( !fn ) { + return this; + } + + if ( one === 1 ) { + origFn = fn; + fn = function( event ) { + // Can use an empty set, since event contains the info + jQuery().off( event ); + return origFn.apply( this, arguments ); + }; + // Use same guid so caller can remove using origFn + fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ ); + } + return this.each( function() { + jQuery.event.add( this, types, fn, data, selector ); + }); + }, + one: function( types, selector, data, fn ) { + return this.on( types, selector, data, fn, 1 ); + }, + off: function( types, selector, fn ) { + var handleObj, type; + if ( types && types.preventDefault && types.handleObj ) { + // ( event ) dispatched jQuery.Event + handleObj = types.handleObj; + jQuery( types.delegateTarget ).off( + handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType, + handleObj.selector, + handleObj.handler + ); + return this; + } + if ( typeof types === "object" ) { + // ( types-object [, selector] ) + for ( type in types ) { + this.off( type, selector, types[ type ] ); + } + return this; + } + if ( selector === false || typeof selector === "function" ) { + // ( types [, fn] ) + fn = selector; + selector = undefined; + } + if ( fn === false ) { + fn = returnFalse; + } + return this.each(function() { + jQuery.event.remove( this, types, fn, selector ); + }); + }, + + trigger: function( type, data ) { + return this.each(function() { + jQuery.event.trigger( type, data, this ); + }); + }, + triggerHandler: function( type, data ) { + var elem = this[0]; + if ( elem ) { + return jQuery.event.trigger( type, data, elem, true ); + } + } +}); + + +var + rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi, + rtagName = /<([\w:]+)/, + rhtml = /<|&#?\w+;/, + rnoInnerhtml = /<(?:script|style|link)/i, + // checked="checked" or checked + rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, + rscriptType = /^$|\/(?:java|ecma)script/i, + rscriptTypeMasked = /^true\/(.*)/, + rcleanScript = /^\s*\s*$/g, + + // We have to close these tags to support XHTML (#13200) + wrapMap = { + + // Support: IE9 + option: [ 1, "" ], + + thead: [ 1, "", "
          " ], + col: [ 2, "", "
          " ], + tr: [ 2, "", "
          " ], + td: [ 3, "", "
          " ], + + _default: [ 0, "", "" ] + }; + +// Support: IE9 +wrapMap.optgroup = wrapMap.option; + +wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; +wrapMap.th = wrapMap.td; + +// Support: 1.x compatibility +// Manipulating tables requires a tbody +function manipulationTarget( elem, content ) { + return jQuery.nodeName( elem, "table" ) && + jQuery.nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ? + + elem.getElementsByTagName("tbody")[0] || + elem.appendChild( elem.ownerDocument.createElement("tbody") ) : + elem; +} + +// Replace/restore the type attribute of script elements for safe DOM manipulation +function disableScript( elem ) { + elem.type = (elem.getAttribute("type") !== null) + "/" + elem.type; + return elem; +} +function restoreScript( elem ) { + var match = rscriptTypeMasked.exec( elem.type ); + + if ( match ) { + elem.type = match[ 1 ]; + } else { + elem.removeAttribute("type"); + } + + return elem; +} + +// Mark scripts as having already been evaluated +function setGlobalEval( elems, refElements ) { + var i = 0, + l = elems.length; + + for ( ; i < l; i++ ) { + data_priv.set( + elems[ i ], "globalEval", !refElements || data_priv.get( refElements[ i ], "globalEval" ) + ); + } +} + +function cloneCopyEvent( src, dest ) { + var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events; + + if ( dest.nodeType !== 1 ) { + return; + } + + // 1. Copy private data: events, handlers, etc. + if ( data_priv.hasData( src ) ) { + pdataOld = data_priv.access( src ); + pdataCur = data_priv.set( dest, pdataOld ); + events = pdataOld.events; + + if ( events ) { + delete pdataCur.handle; + pdataCur.events = {}; + + for ( type in events ) { + for ( i = 0, l = events[ type ].length; i < l; i++ ) { + jQuery.event.add( dest, type, events[ type ][ i ] ); + } + } + } + } + + // 2. Copy user data + if ( data_user.hasData( src ) ) { + udataOld = data_user.access( src ); + udataCur = jQuery.extend( {}, udataOld ); + + data_user.set( dest, udataCur ); + } +} + +function getAll( context, tag ) { + var ret = context.getElementsByTagName ? context.getElementsByTagName( tag || "*" ) : + context.querySelectorAll ? context.querySelectorAll( tag || "*" ) : + []; + + return tag === undefined || tag && jQuery.nodeName( context, tag ) ? + jQuery.merge( [ context ], ret ) : + ret; +} + +// Fix IE bugs, see support tests +function fixInput( src, dest ) { + var nodeName = dest.nodeName.toLowerCase(); + + // Fails to persist the checked state of a cloned checkbox or radio button. + if ( nodeName === "input" && rcheckableType.test( src.type ) ) { + dest.checked = src.checked; + + // Fails to return the selected option to the default selected state when cloning options + } else if ( nodeName === "input" || nodeName === "textarea" ) { + dest.defaultValue = src.defaultValue; + } +} + +jQuery.extend({ + clone: function( elem, dataAndEvents, deepDataAndEvents ) { + var i, l, srcElements, destElements, + clone = elem.cloneNode( true ), + inPage = jQuery.contains( elem.ownerDocument, elem ); + + // Fix IE cloning issues + if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) && + !jQuery.isXMLDoc( elem ) ) { + + // We eschew Sizzle here for performance reasons: http://jsperf.com/getall-vs-sizzle/2 + destElements = getAll( clone ); + srcElements = getAll( elem ); + + for ( i = 0, l = srcElements.length; i < l; i++ ) { + fixInput( srcElements[ i ], destElements[ i ] ); + } + } + + // Copy the events from the original to the clone + if ( dataAndEvents ) { + if ( deepDataAndEvents ) { + srcElements = srcElements || getAll( elem ); + destElements = destElements || getAll( clone ); + + for ( i = 0, l = srcElements.length; i < l; i++ ) { + cloneCopyEvent( srcElements[ i ], destElements[ i ] ); + } + } else { + cloneCopyEvent( elem, clone ); + } + } + + // Preserve script evaluation history + destElements = getAll( clone, "script" ); + if ( destElements.length > 0 ) { + setGlobalEval( destElements, !inPage && getAll( elem, "script" ) ); + } + + // Return the cloned set + return clone; + }, + + buildFragment: function( elems, context, scripts, selection ) { + var elem, tmp, tag, wrap, contains, j, + fragment = context.createDocumentFragment(), + nodes = [], + i = 0, + l = elems.length; + + for ( ; i < l; i++ ) { + elem = elems[ i ]; + + if ( elem || elem === 0 ) { + + // Add nodes directly + if ( jQuery.type( elem ) === "object" ) { + // Support: QtWebKit, PhantomJS + // push.apply(_, arraylike) throws on ancient WebKit + jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem ); + + // Convert non-html into a text node + } else if ( !rhtml.test( elem ) ) { + nodes.push( context.createTextNode( elem ) ); + + // Convert html into DOM nodes + } else { + tmp = tmp || fragment.appendChild( context.createElement("div") ); + + // Deserialize a standard representation + tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase(); + wrap = wrapMap[ tag ] || wrapMap._default; + tmp.innerHTML = wrap[ 1 ] + elem.replace( rxhtmlTag, "<$1>" ) + wrap[ 2 ]; + + // Descend through wrappers to the right content + j = wrap[ 0 ]; + while ( j-- ) { + tmp = tmp.lastChild; + } + + // Support: QtWebKit, PhantomJS + // push.apply(_, arraylike) throws on ancient WebKit + jQuery.merge( nodes, tmp.childNodes ); + + // Remember the top-level container + tmp = fragment.firstChild; + + // Ensure the created nodes are orphaned (#12392) + tmp.textContent = ""; + } + } + } + + // Remove wrapper from fragment + fragment.textContent = ""; + + i = 0; + while ( (elem = nodes[ i++ ]) ) { + + // #4087 - If origin and destination elements are the same, and this is + // that element, do not do anything + if ( selection && jQuery.inArray( elem, selection ) !== -1 ) { + continue; + } + + contains = jQuery.contains( elem.ownerDocument, elem ); + + // Append to fragment + tmp = getAll( fragment.appendChild( elem ), "script" ); + + // Preserve script evaluation history + if ( contains ) { + setGlobalEval( tmp ); + } + + // Capture executables + if ( scripts ) { + j = 0; + while ( (elem = tmp[ j++ ]) ) { + if ( rscriptType.test( elem.type || "" ) ) { + scripts.push( elem ); + } + } + } + } + + return fragment; + }, + + cleanData: function( elems ) { + var data, elem, type, key, + special = jQuery.event.special, + i = 0; + + for ( ; (elem = elems[ i ]) !== undefined; i++ ) { + if ( jQuery.acceptData( elem ) ) { + key = elem[ data_priv.expando ]; + + if ( key && (data = data_priv.cache[ key ]) ) { + if ( data.events ) { + for ( type in data.events ) { + if ( special[ type ] ) { + jQuery.event.remove( elem, type ); + + // This is a shortcut to avoid jQuery.event.remove's overhead + } else { + jQuery.removeEvent( elem, type, data.handle ); + } + } + } + if ( data_priv.cache[ key ] ) { + // Discard any remaining `private` data + delete data_priv.cache[ key ]; + } + } + } + // Discard any remaining `user` data + delete data_user.cache[ elem[ data_user.expando ] ]; + } + } +}); + +jQuery.fn.extend({ + text: function( value ) { + return access( this, function( value ) { + return value === undefined ? + jQuery.text( this ) : + this.empty().each(function() { + if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { + this.textContent = value; + } + }); + }, null, value, arguments.length ); + }, + + append: function() { + return this.domManip( arguments, function( elem ) { + if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { + var target = manipulationTarget( this, elem ); + target.appendChild( elem ); + } + }); + }, + + prepend: function() { + return this.domManip( arguments, function( elem ) { + if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { + var target = manipulationTarget( this, elem ); + target.insertBefore( elem, target.firstChild ); + } + }); + }, + + before: function() { + return this.domManip( arguments, function( elem ) { + if ( this.parentNode ) { + this.parentNode.insertBefore( elem, this ); + } + }); + }, + + after: function() { + return this.domManip( arguments, function( elem ) { + if ( this.parentNode ) { + this.parentNode.insertBefore( elem, this.nextSibling ); + } + }); + }, + + remove: function( selector, keepData /* Internal Use Only */ ) { + var elem, + elems = selector ? jQuery.filter( selector, this ) : this, + i = 0; + + for ( ; (elem = elems[i]) != null; i++ ) { + if ( !keepData && elem.nodeType === 1 ) { + jQuery.cleanData( getAll( elem ) ); + } + + if ( elem.parentNode ) { + if ( keepData && jQuery.contains( elem.ownerDocument, elem ) ) { + setGlobalEval( getAll( elem, "script" ) ); + } + elem.parentNode.removeChild( elem ); + } + } + + return this; + }, + + empty: function() { + var elem, + i = 0; + + for ( ; (elem = this[i]) != null; i++ ) { + if ( elem.nodeType === 1 ) { + + // Prevent memory leaks + jQuery.cleanData( getAll( elem, false ) ); + + // Remove any remaining nodes + elem.textContent = ""; + } + } + + return this; + }, + + clone: function( dataAndEvents, deepDataAndEvents ) { + dataAndEvents = dataAndEvents == null ? false : dataAndEvents; + deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents; + + return this.map(function() { + return jQuery.clone( this, dataAndEvents, deepDataAndEvents ); + }); + }, + + html: function( value ) { + return access( this, function( value ) { + var elem = this[ 0 ] || {}, + i = 0, + l = this.length; + + if ( value === undefined && elem.nodeType === 1 ) { + return elem.innerHTML; + } + + // See if we can take a shortcut and just use innerHTML + if ( typeof value === "string" && !rnoInnerhtml.test( value ) && + !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) { + + value = value.replace( rxhtmlTag, "<$1>" ); + + try { + for ( ; i < l; i++ ) { + elem = this[ i ] || {}; + + // Remove element nodes and prevent memory leaks + if ( elem.nodeType === 1 ) { + jQuery.cleanData( getAll( elem, false ) ); + elem.innerHTML = value; + } + } + + elem = 0; + + // If using innerHTML throws an exception, use the fallback method + } catch( e ) {} + } + + if ( elem ) { + this.empty().append( value ); + } + }, null, value, arguments.length ); + }, + + replaceWith: function() { + var arg = arguments[ 0 ]; + + // Make the changes, replacing each context element with the new content + this.domManip( arguments, function( elem ) { + arg = this.parentNode; + + jQuery.cleanData( getAll( this ) ); + + if ( arg ) { + arg.replaceChild( elem, this ); + } + }); + + // Force removal if there was no new content (e.g., from empty arguments) + return arg && (arg.length || arg.nodeType) ? this : this.remove(); + }, + + detach: function( selector ) { + return this.remove( selector, true ); + }, + + domManip: function( args, callback ) { + + // Flatten any nested arrays + args = concat.apply( [], args ); + + var fragment, first, scripts, hasScripts, node, doc, + i = 0, + l = this.length, + set = this, + iNoClone = l - 1, + value = args[ 0 ], + isFunction = jQuery.isFunction( value ); + + // We can't cloneNode fragments that contain checked, in WebKit + if ( isFunction || + ( l > 1 && typeof value === "string" && + !support.checkClone && rchecked.test( value ) ) ) { + return this.each(function( index ) { + var self = set.eq( index ); + if ( isFunction ) { + args[ 0 ] = value.call( this, index, self.html() ); + } + self.domManip( args, callback ); + }); + } + + if ( l ) { + fragment = jQuery.buildFragment( args, this[ 0 ].ownerDocument, false, this ); + first = fragment.firstChild; + + if ( fragment.childNodes.length === 1 ) { + fragment = first; + } + + if ( first ) { + scripts = jQuery.map( getAll( fragment, "script" ), disableScript ); + hasScripts = scripts.length; + + // Use the original fragment for the last item instead of the first because it can end up + // being emptied incorrectly in certain situations (#8070). + for ( ; i < l; i++ ) { + node = fragment; + + if ( i !== iNoClone ) { + node = jQuery.clone( node, true, true ); + + // Keep references to cloned scripts for later restoration + if ( hasScripts ) { + // Support: QtWebKit + // jQuery.merge because push.apply(_, arraylike) throws + jQuery.merge( scripts, getAll( node, "script" ) ); + } + } + + callback.call( this[ i ], node, i ); + } + + if ( hasScripts ) { + doc = scripts[ scripts.length - 1 ].ownerDocument; + + // Reenable scripts + jQuery.map( scripts, restoreScript ); + + // Evaluate executable scripts on first document insertion + for ( i = 0; i < hasScripts; i++ ) { + node = scripts[ i ]; + if ( rscriptType.test( node.type || "" ) && + !data_priv.access( node, "globalEval" ) && jQuery.contains( doc, node ) ) { + + if ( node.src ) { + // Optional AJAX dependency, but won't run scripts if not present + if ( jQuery._evalUrl ) { + jQuery._evalUrl( node.src ); + } + } else { + jQuery.globalEval( node.textContent.replace( rcleanScript, "" ) ); + } + } + } + } + } + } + + return this; + } +}); + +jQuery.each({ + appendTo: "append", + prependTo: "prepend", + insertBefore: "before", + insertAfter: "after", + replaceAll: "replaceWith" +}, function( name, original ) { + jQuery.fn[ name ] = function( selector ) { + var elems, + ret = [], + insert = jQuery( selector ), + last = insert.length - 1, + i = 0; + + for ( ; i <= last; i++ ) { + elems = i === last ? this : this.clone( true ); + jQuery( insert[ i ] )[ original ]( elems ); + + // Support: QtWebKit + // .get() because push.apply(_, arraylike) throws + push.apply( ret, elems.get() ); + } + + return this.pushStack( ret ); + }; +}); + + +var iframe, + elemdisplay = {}; + +/** + * Retrieve the actual display of a element + * @param {String} name nodeName of the element + * @param {Object} doc Document object + */ +// Called only from within defaultDisplay +function actualDisplay( name, doc ) { + var style, + elem = jQuery( doc.createElement( name ) ).appendTo( doc.body ), + + // getDefaultComputedStyle might be reliably used only on attached element + display = window.getDefaultComputedStyle && ( style = window.getDefaultComputedStyle( elem[ 0 ] ) ) ? + + // Use of this method is a temporary fix (more like optimization) until something better comes along, + // since it was removed from specification and supported only in FF + style.display : jQuery.css( elem[ 0 ], "display" ); + + // We don't have any data stored on the element, + // so use "detach" method as fast way to get rid of the element + elem.detach(); + + return display; +} + +/** + * Try to determine the default display value of an element + * @param {String} nodeName + */ +function defaultDisplay( nodeName ) { + var doc = document, + display = elemdisplay[ nodeName ]; + + if ( !display ) { + display = actualDisplay( nodeName, doc ); + + // If the simple way fails, read from inside an iframe + if ( display === "none" || !display ) { + + // Use the already-created iframe if possible + iframe = (iframe || jQuery( "' + + '
          ' + + '' + + '' + + '
          ' + + '
          ' + + '
          ' + + '
          ' + + ' ' + + '
          ' + + '
          ' + + '
          ' + + '
          ' + + '
          ' + + ' ' + + '
          ' + + '
          ' + + '
          ' + + '
          ' + + '
          ' + + ' ' + + '
          ' + + '
          ' + + '
          ' + + ' {{pdf.url}}' + + '
          ' + + '
          ' + + '' + + ' ' + + ' ' + + '' + + '
          ' + + '
          ' + + '
          ' + + '
          ' + + ' ' + + '
          ' + + '' + + '
          ' + + '
          ' + + ' ' + + '
          '; + + $templateCache.put(TEMPLATE_URL, template); + + return { + restrict : 'AE', + scope:true, + templateUrl: function (element, attributes) { + return (attributes.emoticonsTemplateUrl || TEMPLATE_URL); + }, + link : function (scope, elements, attributes) { + + var data = scope.$eval(attributes.emoticonsData); + var userOptions = scope.$eval(attributes.emoticonsOptions); + scope.video = {}; + scope.image = {}; + scope.pdf = {}; + scope.audio = {}; + + var options = { + link : true, + linkTarget: '_self', + pdf : { + embed: true + }, + image : { + embed: false + }, + audio : { + embed: true + }, + code : { + highlight : true, + lineNumbers: false + }, + basicVideo: false, + video : { + embed : false, + width : null, + height : null, + ytTheme : 'dark', + details : false, + thumbnailQuality: 'medium', + ytAuthKey : null + } + }; + + function extendDeep(dst) { + angular.forEach(arguments, function (obj) { + if (obj !== dst) { + angular.forEach(obj, function (value, key) { + if (dst[key] && dst[key].constructor && dst[key].constructor === Object) { + extendDeep(dst[key], value); + } + else { + dst[key] = value; + } + }); + } + }); + return dst; + } + + extendDeep(options, userOptions); + + String.prototype.trunc = + function (n, useWordBoundary) { + var toLong = this.length > n, + s_ = toLong ? this.substr(0, n - 1) : this; + s_ = useWordBoundary && toLong ? s_.substr(0, s_.lastIndexOf(' ')) : s_; + return toLong ? s_ + '...' : s_; + }; + + var videoProcess = { + calcDimensions: function (options) { + var dimensions = { + 'width' : null, + 'height': null + }; + dimensions.width = options.video.width; + dimensions.height = options.video.height; + + if (options.video.height && options.video.width) { + return dimensions; + } + else if (options.video.height) { + dimensions.width = ((options.video.height) / 390) * 640; + return dimensions; + } + else if (options.video.width) { + dimensions.height = ((dimensions.width) / 640) * 390; + return dimensions; + } + else { + dimensions.width = 640; + dimensions.height = 390; + return dimensions; + } + }, + + embed: function (data, options) { + + var p = /https?:\/\/(?:[0-9A-Z-]+\.)?(?:youtu\.be\/|youtube\.com(?:\/embed\/|\/v\/|\/watch\?v=|\/ytscreeningroom\?v=|\/feeds\/api\/videos\/|\/user\S*[^\w\-\s]|\S*[^\w\-\s]))([\w\-]{11})[?=&+%\w-]*/gi; + + /** + * Youtube embedding + */ + + if (data.match(p)) { + + var youtubeDimensions = this.calcDimensions(options); + scope.video.id = RegExp.$1; + if (options.video.details) { + $http.get('https://www.googleapis.com/youtube/v3/videos?id=' + RegExp.$1 + '&key=' + options.video.ytAuthKey + '&part=snippet,statistics') + .success(function (d) { + var ytData = d.items[0]; + + scope.video.host = 'youtube'; + scope.video.title = ytData.snippet.title; + scope.video.thumbnail = ytData.snippet.thumbnails.medium.url; + scope.video.description = (ytData.snippet.description.trunc(250, true)).replace(/\n/g, ' ').replace(/ /g, ' '); + scope.video.rawDescription = ytData.snippet.description; + scope.video.views = ytData.statistics.viewCount; + scope.video.likes = ytData.statistics.likeCount; + scope.video.uploader = ytData.snippet.channelTitle; + scope.video.uploaderPage = 'https://www.youtube.com/channel/' + ytData.snippet.channelId; + scope.video.uploadDate = ytData.snippet.publishedAt; + scope.video.url = $sce.trustAsResourceUrl("https://www.youtube.com/watch?v=" + ytData.id); + scope.video.embedSrc = $sce.trustAsResourceUrl('https://www.youtube.com/embed/' + scope.video.id + '?autoplay=1'); + scope.video.width = youtubeDimensions.width; + scope.video.height = youtubeDimensions.height; + + }); + } + else{ + scope.video.width = youtubeDimensions.width; + scope.video.height = youtubeDimensions.height; + scope.video.host = 'youtube'; + scope.video.embedSrc = $sce.trustAsResourceUrl('https://www.youtube.com/embed/' + RegExp.$1 + '?autoplay=0'); + + } + + return data; // show only youtube video if both vimeo and youtube videos are present. + } + + /** + * Vimeo embedding + */ + + var e = /https?:\/\/(?:www\.)?vimeo.com\/(?:channels\/(?:\w+\/)?|groups\/([^\/]*)\/videos\/|album\/(\d+)\/video\/|)(\d+)(?:$|\/|\?)*/gi; + + if (data.match(e)) { + var vimeoDimensions = this.calcDimensions(options); + scope.video.id = RegExp.$3; + if (options.video.details) { + $http.get('https://vimeo.com/api/v2/video/' + RegExp.$3 + '.json') + .success(function (d) { + scope.video.host = 'vimeo'; + scope.video.title = d[0].title; + scope.video.rawDescription = (d[0].description).replace(/\n/g, '
          ').replace(/ /g, '
          '); + scope.video.description = (d[0].description).replace(/((<|<)br\s*\/*(>|>)\r\n)/g, ' ').trunc(250, true); + scope.video.thumbnail = d[0].thumbnail_medium; + scope.video.views = d[0].stats_number_of_plays; + scope.video.likes = d[0].stats_number_of_likes; + scope.video.uploader = d[0].user_name; + scope.video.uploaderPage = d[0].user_url; + scope.video.uploadDate = d[0].uploadDate; + scope.video.url = d[0].url; + scope.video.embedSrc = $sce.trustAsResourceUrl('//player.vimeo.com/video/' + d[0].id + '?title=0&byline=0&portrait=0&autoplay=1'); + scope.video.width = vimeoDimensions.width; + scope.video.height = vimeoDimensions.height; + }); + } + else{ + scope.video.width = vimeoDimensions.width; + scope.video.height = vimeoDimensions.height; + scope.video.host = 'vimeo'; + scope.video.embedSrc=$sce.trustAsResourceUrl('//player.vimeo.com/video/' + RegExp.$3 + '?title=0&byline=0&portrait=0&autoplay=0'); + } + } + + return data; + }, + + embedBasic:function(data){ + var f = /((?:https?):\/\/\S*\.(?:ogv|webm|mp4))/gi; + + if (data.match(f)) { + scope.video.basic = $sce.trustAsResourceUrl(RegExp.$1); + } + + return data; + } + }; + + var audioProcess = { + embed: function (str) { + var a = /((?:https?):\/\/\S*\.(?:wav|mp3|ogg))/gi; + if (str.match(a)) { + scope.audio.url = $sce.trustAsResourceUrl(RegExp.$1); + } + return str; + } + }; + + var imageProcess = { + embed: function (data) { + var i = /((?:https?):\/\/\S*\.(?:gif|jpg|jpeg|tiff|png|svg|webp))/gi; + + if (data.match(i)) { + scope.image.url = RegExp.$1; + + } + + return data; + } + }; + + var codeProcess = { + encodeCode: function (c) { + c = c.replace(/\&/gm, '&'); + c = c.replace(//gm, '>'); + return c; + }, + + getCode: function (text) { + var that = this; + text = text.replace(/(`+)(\s|[a-z]+)\s*([\s\S]*?[^`])\s*\1(?!`)/gm, + function (wholeMatch, m1, m2, m3) { + var c = m3; + c = c.replace(/^([ \t]*)/g, ""); // leading whitespace + c = c.replace(/[ \t]*$/g, ""); // trailing whitespace + c = that.encodeCode(c); + c = c.replace(/:\/\//g, "~P"); // to prevent auto-linking. Not necessary in code + // *blocks*, but in code spans. Will be converted + // back after the auto-linker runs. + + return '
          ' + c + '
          '; + } + ); + return text; + } + }; + + var pdfProcess = { + embed: function (str) { + var p = /((?:https?):\/\/\S*\.(?:pdf|PDF))/gi; + if (str.match(p)) { + scope.pdf.url = $sce.trustAsResourceUrl(RegExp.$1); + + } + + return str; + } + }; + + if (options.code.highlight) { + if (!window.hljs) { + throw 'hlsj (Highlight JS is not defined.'; + } + else { + data = codeProcess.getCode(data); + + /** + * Adding line numbers to code + */ + $timeout(function () { + hljs.initHighlighting(); + if (options.code.lineNumbers) { + angular.element('.ne-code').each(function () { + var i = 1; + var lines = $(this).text().split('\n').length; + var numbering = $('
            ').addClass('pre-numbering'); + angular.element(this) + .addClass('has-numbering') + .parent() + .append(numbering); + for (i; i <= lines; i++) { + numbering.append(angular.element('
          • ').text(i)); + } + }); + } + + }, 0); + + } + } + + var x = ($filter('emoticons')(data, options)).$$unwrapTrustedValue(); + + if (options.video.embed) { + if (!options.video.ytAuthKey) { + throw 'Youtube authentication key is required to get data from youtube.'; + } + else { + x = videoProcess.embed(x, options); + } + + } + + if(options.basicVideo){ + x=videoProcess.embedBasic(x); + } + + if (options.audio.embed) { + x = audioProcess.embed(x); + } + + if (options.image.embed) { + x = imageProcess.embed(x); + } + + if (options.pdf.embed) { + x = pdfProcess.embed(x); + } + + scope.neText = $sce.trustAsHtml(x); + } + }; + }]) + + .directive('neHljs',['$timeout', function ($timeout) { + return { + restrict: 'AE', + link : function (scope, elem) { + $timeout(function () { + elem.find('.ne-code').each(function(){ + hljs.highlightBlock(this); + }); + }, 0); + + } + }; + }]); + +})(); diff --git a/public/bower_components/ng-remote-validate/ngRemoteValidate.js b/public/bower_components/ng-remote-validate/ngRemoteValidate.js new file mode 100644 index 0000000..ddf0983 --- /dev/null +++ b/public/bower_components/ng-remote-validate/ngRemoteValidate.js @@ -0,0 +1,165 @@ +( function( angular ) { + 'use strict'; + if( !angular ) { + throw 'Missing something? Please add angular.js to your project or move this script below the angular.js reference'; + } + + var directiveId = 'ngRemoteValidate', + remoteValidate = function( $http, $timeout, $q ) { + return { + restrict: 'A', + require: [ '^form','ngModel' ], + scope: { + ngRemoteInterceptors: '=?' + }, + link: function( scope, el, attrs, ctrls ) { + var cache = {}, + handleChange, + setValidation, + addToCache, + request, + shouldProcess, + ngForm = ctrls[ 0 ], + ngModel = ctrls[ 1 ], + options = { + ngRemoteThrottle: 400, + ngRemoteMethod: 'POST' + }; + + angular.extend( options, attrs ); + //TODO: Use Cain of Responsibility to reduce complexity. + if( options.ngRemoteValidate.charAt( 0 ) === '[' ) { + options.urls = eval( options.ngRemoteValidate ); + } else if (options.ngRemoteValidate.charAt( 0 ) === '{') { + options.keys = eval( '(' + options.ngRemoteValidate + ')' ); + options.urls = Object.keys( options.keys ); + } else { + options.urls = [ options.ngRemoteValidate ]; + } + + addToCache = function( response ) { + var value = response[ 0 ].data.value; + if ( cache[ value ] ) return cache[ value ]; + cache[ value ] = response; + }; + + shouldProcess = function( value ) { + var otherRulesInValid = false; + for ( var p in ngModel.$error ) { + var checkedKey = !options.hasOwnProperty( 'keys' ) || + !( Object.keys(options.keys ) + .filter( function( k ) { + return options.keys[ k ] === p; + } )[ 0 ] ); + if ( ngModel.$error[ p ] && p != directiveId && checkedKey ) { + otherRulesInValid = true; + break; + } + } + return !( ngModel.$pristine || otherRulesInValid ); + }; + + setValidation = function( response, skipCache ) { + var i = 0, + l = response.length, + useKeys = options.hasOwnProperty( 'keys' ), + isValid = true; + for( ; i < l; i++ ) { + + if( scope.ngRemoteInterceptors && scope.ngRemoteInterceptors.response ) { + response[ i ] = scope.ngRemoteInterceptors.response( response[ i ] ); + } + + if( !response[ i ].data.isValid ) { + isValid = false; + if (!useKeys) { + break; + } + } + + var canSetKey = ( useKeys && + response[ i ].hasOwnProperty( 'config' ) && + options.keys[ response[ i ].config.url ] ); + + if ( canSetKey ) { + var key = options.keys[ response[ i ].config.url ]; + ngModel.$setValidity( key, response[ i ].data.isValid ); + } + } + if( !skipCache ) { + addToCache( response ); + } + ngModel.$setValidity( directiveId, isValid ); + ngModel.$processing = ngModel.$pending = ngForm.$pending = false; + }; + + handleChange = function( value ) { + if( typeof value === 'undefined' || value === '' ) { + ngModel.$setPristine(); + return; + } + + if ( !shouldProcess( value ) ) { + return setValidation( [ { data: { isValid: true, value: value } } ], true ); + } + + if ( cache[ value ] ) { + return setValidation( cache[ value ], true ); + } + + //Set processing now, before the delay. + //Check first to reduce DOM updates + if( !ngModel.$pending ) { + ngModel.$processing = ngModel.$pending = ngForm.$pending = true; + } + + if ( request ) { + $timeout.cancel( request ); + } + + request = $timeout( function( ) { + var calls = [], + i = 0, + l = options.urls.length, + toValidate = { value: value }, + httpOpts = { method: options.ngRemoteMethod }; + + if ( scope[ el[0].name + 'SetArgs' ] ) { + toValidate = scope[el[0].name + 'SetArgs'](value, el, attrs, ngModel); + } + + if(options.ngRemoteMethod == 'POST'){ + httpOpts.data = toValidate; + } else { + httpOpts.params = toValidate; + } + + for( ; i < l; i++ ) { + httpOpts.url = options.urls[ i ]; + + if(scope.ngRemoteInterceptors && scope.ngRemoteInterceptors.request){ + httpOpts = scope.ngRemoteInterceptors.request(httpOpts); + } + + calls.push( $http( httpOpts ) ); + } + + $q.all( calls ).then( setValidation ); + + }, options.ngRemoteThrottle ); + return true; + }; + + //ngModel.$parsers.unshift( handleChange ); + scope.$watch( function( ) { + return ngModel.$viewValue; + }, handleChange ); + } + }; + }; + + angular.module( 'remoteValidation', [] ) + .constant('MODULE_VERSION', '0.6.1') + .directive( directiveId, [ '$http', '$timeout', '$q', remoteValidate ] ); + +})( this.angular ); \ No newline at end of file diff --git a/public/bower_components/ng-scrollbars/scrollbars.min.js b/public/bower_components/ng-scrollbars/scrollbars.min.js new file mode 100644 index 0000000..4d55122 --- /dev/null +++ b/public/bower_components/ng-scrollbars/scrollbars.min.js @@ -0,0 +1 @@ +!function(){"use strict";function a(){this.defaults={scrollButtons:{enable:!1},axis:"yx"},$.mCustomScrollbar.defaults.scrollButtons=this.defaults.scrollButtons,$.mCustomScrollbar.defaults.axis=this.defaults.axis,this.$get=function(){return{defaults:this.defaults}}}function b(a){return{scope:{ngScrollbarsConfig:"&"},link:function(b,c){var d=a.defaults,e=$.mCustomScrollbar.defaults,f=b.ngScrollbarsConfig();f||(f={});for(var g in d)if(d.hasOwnProperty(g))switch(g){case"scrollButtons":f.hasOwnProperty(g)||(e.scrollButtons=d[g]);break;case"axis":f.hasOwnProperty(g)||(e.axis=d[g]);break;default:f.hasOwnProperty(g)||(f[g]=d[g])}c.mCustomScrollbar(f)}}}angular.module("ngScrollbars",[]).provider("ScrollBars",a).directive("ngScrollbars",b),a.$inject=[],b.$inject=["ScrollBars"]}(); \ No newline at end of file diff --git a/public/bower_components/ng-slide-down/ng-slide-down.js b/public/bower_components/ng-slide-down/ng-slide-down.js new file mode 100644 index 0000000..c58710f --- /dev/null +++ b/public/bower_components/ng-slide-down/ng-slide-down.js @@ -0,0 +1,109 @@ +(function () { + 'use strict'; + angular.module('ng-slide-down', []).directive('ngSlideDown', [ + '$timeout', + function ($timeout) { + var getTemplate, link; + getTemplate = function (tElement, tAttrs) { + if (tAttrs.lazyRender !== void 0) { + return '
            '; + } else { + return '
            '; + } + }; + link = function (scope, element, attrs, ctrl, transclude) { + var closePromise, duration, elementScope, emitOnClose, getHeight, hide, lazyRender, onClose, openPromise, show, timingFunction; + duration = attrs.duration || 1; + timingFunction = attrs.timingFunction || 'ease-in-out'; + elementScope = element.scope(); + emitOnClose = attrs.emitOnClose; + onClose = attrs.onClose; + lazyRender = attrs.lazyRender !== void 0; + closePromise = null; + openPromise = null; + getHeight = function (passedScope) { + var c, children, height, _i, _len; + height = 0; + children = element.children(); + for (_i = 0, _len = children.length; _i < _len; _i++) { + c = children[_i]; + height += c.clientHeight; + } + return '' + height + 'px'; + }; + show = function () { + if (closePromise) { + $timeout.cancel(closePromise); + } + if (lazyRender) { + scope.lazyRender = true; + } + return $timeout(function () { + if (openPromise) { + $timeout.cancel(openPromise); + } + element.css({ + overflow: 'hidden', + transitionProperty: 'height', + transitionDuration: '' + duration + 's', + transitionTimingFunction: timingFunction, + height: getHeight() + }); + return openPromise = $timeout(function () { + return element.css({ + overflow: 'visible', + transition: 'none', + height: 'auto' + }); + }, duration * 1000); + }); + }; + hide = function () { + if (openPromise) { + $timeout.cancel(openPromise); + } + element.css({ + overflow: 'hidden', + transitionProperty: 'height', + transitionDuration: '' + duration + 's', + transitionTimingFunction: timingFunction, + height: '0px' + }); + if (emitOnClose || onClose || lazyRender) { + return closePromise = $timeout(function () { + if (emitOnClose) { + scope.$emit(emitOnClose, {}); + } + if (onClose) { + elementScope.$eval(onClose); + } + if (lazyRender) { + return scope.lazyRender = false; + } + }, duration * 1000); + } + }; + return scope.$watch('expanded', function (value, oldValue) { + if (value) { + return $timeout(show); + } else { + if (value != null) { + element.css({ height: getHeight() }); + element[0].clientHeight; + } + return $timeout(hide); + } + }); + }; + return { + restrict: 'A', + scope: { expanded: '=ngSlideDown' }, + transclude: true, + link: link, + template: function (tElement, tAttrs) { + return getTemplate(tElement, tAttrs); + } + }; + } + ]); +}.call(this)); \ No newline at end of file diff --git a/public/bower_components/ngInfiniteScroll/ng-infinite-scroll.js b/public/bower_components/ngInfiniteScroll/ng-infinite-scroll.js new file mode 100644 index 0000000..5d29d59 --- /dev/null +++ b/public/bower_components/ngInfiniteScroll/ng-infinite-scroll.js @@ -0,0 +1,61 @@ +/* ng-infinite-scroll - v1.0.0 - 2013-02-23 */ +var mod; + +mod = angular.module('infinite-scroll', []); + +mod.directive('infiniteScroll', [ + '$rootScope', '$window', '$timeout', function($rootScope, $window, $timeout) { + return { + link: function(scope, elem, attrs) { + var checkWhenEnabled, handler, scrollDistance, scrollEnabled; + $window = angular.element($window); + scrollDistance = 0; + if (attrs.infiniteScrollDistance != null) { + scope.$watch(attrs.infiniteScrollDistance, function(value) { + return scrollDistance = parseInt(value, 10); + }); + } + scrollEnabled = true; + checkWhenEnabled = false; + if (attrs.infiniteScrollDisabled != null) { + scope.$watch(attrs.infiniteScrollDisabled, function(value) { + scrollEnabled = !value; + if (scrollEnabled && checkWhenEnabled) { + checkWhenEnabled = false; + return handler(); + } + }); + } + handler = function() { + var elementBottom, remaining, shouldScroll, windowBottom; + windowBottom = $window.height() + $window.scrollTop(); + elementBottom = elem.offset().top + elem.height(); + remaining = elementBottom - windowBottom; + shouldScroll = remaining <= $window.height() * scrollDistance; + if (shouldScroll && scrollEnabled) { + if ($rootScope.$$phase) { + return scope.$eval(attrs.infiniteScroll); + } else { + return scope.$apply(attrs.infiniteScroll); + } + } else if (shouldScroll) { + return checkWhenEnabled = true; + } + }; + $window.on('scroll', handler); + scope.$on('$destroy', function() { + return $window.off('scroll', handler); + }); + return $timeout((function() { + if (attrs.infiniteScrollImmediateCheck) { + if (scope.$eval(attrs.infiniteScrollImmediateCheck)) { + return handler(); + } + } else { + return handler(); + } + }), 0); + } + }; + } +]); diff --git a/public/bower_components/ngmap/ng-map.js b/public/bower_components/ngmap/ng-map.js new file mode 100644 index 0000000..a975886 --- /dev/null +++ b/public/bower_components/ngmap/ng-map.js @@ -0,0 +1,2776 @@ +angular.module('ngMap', []); + +/** + * @ngdoc service + * @name Attr2Options + * @description + * Converts tag attributes to options used by google api v3 objects, map, marker, polygon, circle, etc. + */ +/* global google */ +(function() { + 'use strict'; + + var SPECIAL_CHARS_REGEXP = /([\:\-\_]+(.))/g; + var MOZ_HACK_REGEXP = /^moz([A-Z])/; + + function camelCase(name) { + return name. + replace(SPECIAL_CHARS_REGEXP, function(_, separator, letter, offset) { + return offset ? letter.toUpperCase() : letter; + }). + replace(MOZ_HACK_REGEXP, 'Moz$1'); + } + + function JSONize(str) { + try { // if parsable already, return as it is + JSON.parse(str); + return str; + } catch(e) { // if not parsable, change little + return str + // wrap keys without quote with valid double quote + .replace(/([\$\w]+)\s*:/g, function(_, $1){return '"'+$1+'":';}) + // replacing single quote wrapped ones to double quote + .replace(/'([^']+)'/g, function(_, $1){return '"'+$1+'"';}); + } + } + + var Attr2Options = function($parse, $timeout, $log, NavigatorGeolocation, GeoCoder) { + + /** + * Returns the attributes of an element as hash + * @memberof Attr2Options + * @param {HTMLElement} el html element + * @returns {Hash} attributes + */ + var orgAttributes = function(el) { + (el.length > 0) && (el = el[0]); + var orgAttributes = {}; + for (var i=0; i + * + * + */ +(function() { + 'use strict'; + angular.module('ngMap').directive('bicyclingLayer', ['Attr2Options', function(Attr2Options) { + var parser = Attr2Options; + + var getLayer = function(options, events) { + var layer = new google.maps.BicyclingLayer(options); + for (var eventName in events) { + google.maps.event.addListener(layer, eventName, events[eventName]); + } + return layer; + }; + + return { + restrict: 'E', + require: '^map', + + link: function(scope, element, attrs, mapController) { + var orgAttrs = parser.orgAttributes(element); + var filtered = parser.filter(attrs); + var options = parser.getOptions(filtered); + var events = parser.getEvents(scope, filtered); + + void 0; + + var layer = getLayer(options, events); + mapController.addObject('bicyclingLayers', layer); + mapController.observeAttrSetObj(orgAttrs, attrs, layer); //observers + element.bind('$destroy', function() { + mapController.deleteObject('bicyclingLayers', layer); + }); + } + }; // return + }]); +})(); + +/** + * @ngdoc directive + * @name cloud-layer + * @param Attr2Options {service} convert html attribute to Gogole map api options + * @description + * Requires: map directive + * Restrict To: Element + * + * @example + * Example: + * + * + * + * + */ +(function() { + 'use strict'; + angular.module('ngMap').directive('cloudLayer', ['Attr2Options', function(Attr2Options) { + var parser = Attr2Options; + + var getLayer = function(options, events) { + var layer = new google.maps.weather.CloudLayer(options); + for (var eventName in events) { + google.maps.event.addListener(layer, eventName, events[eventName]); + } + return layer; + }; + + return { + restrict: 'E', + require: '^map', + + link: function(scope, element, attrs, mapController) { + var orgAttrs = parser.orgAttributes(element); + var filtered = parser.filter(attrs); + var options = parser.getOptions(filtered); + var events = parser.getEvents(scope, filtered); + void 0; + + var layer = getLayer(options, events); + mapController.addObject('cloudLayers', layer); + mapController.observeAttrSetObj(orgAttrs, attrs, layer); //observers + element.bind('$destroy', function() { + mapController.deleteObject('cloudLayers', layer); + }); + } + }; // return + }]); +})(); + +/** + * @ngdoc directive + * @name custom-control + * @param Attr2Options {service} convert html attribute to Gogole map api options + * @param $compile {service} AngularJS $compile service + * @description + * Build custom control and set to the map with position + * + * Requires: map directive + * + * Restrict To: Element + * + * @attr {String} position position of this control + * i.e. TOP_RIGHT + * @attr {Number} index index of the control + * @example + * + * Example: + * + * + *
            + * Home + *
            + *
            + *
            + * + */ +(function() { + 'use strict'; + angular.module('ngMap').directive('customControl', ['Attr2Options', '$compile', function(Attr2Options, $compile) { + 'use strict'; + var parser = Attr2Options; + + return { + restrict: 'E', + require: '^map', + link: function(scope, element, attrs, mapController) { + var orgAttrs = parser.orgAttributes(element); + var filtered = parser.filter(attrs); + var options = parser.getOptions(filtered, scope); + var events = parser.getEvents(scope, filtered); + void 0; + + /** + * build a custom control element + */ + var customControlEl = element[0].parentElement.removeChild(element[0]); + $compile(customControlEl.innerHTML.trim())(scope); + + /** + * set events + */ + for (var eventName in events) { + google.maps.event.addDomListener(customControlEl, eventName, events[eventName]); + } + + mapController.addObject('customControls', customControlEl); + scope.$on('mapInitialized', function(evt, map) { + var position = options.position; + map.controls[google.maps.ControlPosition[position]].push(customControlEl); + }); + + } //link + }; // return + }]);// function +})(); + +/** + * @ngdoc directive + * @memberof ngmap + * @name custom-marker + * @param Attr2Options {service} convert html attribute to Gogole map api options + * @param $timeout {service} AngularJS $timeout + * @description + * Marker with html + * Requires: map directive + * Restrict To: Element + * + * @attr {String} position required, position on map + * @attr {Number} z-index optional + * @attr {Boolean} visible optional + * @example + * + * Example: + * + * + *
            + * Home + *
            + *
            + *
            + * + */ +(function() { + 'use strict'; + var parser, $timeout, $compile; + + var CustomMarker = function(options) { + options = options || {}; + + this.el = document.createElement('div'); + this.el.style.display = 'inline-block'; + this.visible = true; + for (var key in options) { /* jshint ignore:line */ + this[key] = options[key]; + } + }; + + var setCustomMarker = function() { + + CustomMarker.prototype = new google.maps.OverlayView(); + + CustomMarker.prototype.setContent = function(html, scope) { + this.el.innerHTML = html; + this.el.style.position = 'absolute'; + if (scope) { + $compile(angular.element(this.el).contents())(scope); + } + }; + + CustomMarker.prototype.setPosition = function(position) { + position && (this.position = position); /* jshint ignore:line */ + if (this.getProjection() && typeof this.position.lng == 'function') { + var posPixel = this.getProjection().fromLatLngToDivPixel(this.position); + var x = Math.round(posPixel.x - (this.el.offsetWidth/2)); + var y = Math.round(posPixel.y - this.el.offsetHeight - 10); // 10px for anchor + this.el.style.left = x + "px"; + this.el.style.top = y + "px"; + } + }; + + CustomMarker.prototype.setZIndex = function(zIndex) { + zIndex && (this.zIndex = zIndex); /* jshint ignore:line */ + this.el.style.zIndex = this.zIndex; + }; + + CustomMarker.prototype.setVisible = function(visible) { + this.el.style.display = visible ? 'inline-block' : 'none'; + this.visible = visible; + }; + + CustomMarker.prototype.addClass = function(className) { + var classNames = this.el.className.trim().split(' '); + (classNames.indexOf(className) == -1) && classNames.push(className); /* jshint ignore:line */ + this.el.className = classNames.join(' '); + }; + + CustomMarker.prototype.removeClass = function(className) { + var classNames = this.el.className.split(' '); + var index = classNames.indexOf(className); + (index > -1) && classNames.splice(index, 1); /* jshint ignore:line */ + this.el.className = classNames.join(' '); + }; + + CustomMarker.prototype.onAdd = function() { + this.getPanes().overlayMouseTarget.appendChild(this.el); + }; + + CustomMarker.prototype.draw = function() { + this.setPosition(); + this.setZIndex(this.zIndex); + this.setVisible(this.visible); + }; + + CustomMarker.prototype.onRemove = function() { + this.el.parentNode.removeChild(this.el); + this.el = null; + }; + }; + + var linkFunc = function(orgHtml, varsToWatch) { + //console.log('orgHtml', orgHtml, 'varsToWatch', varsToWatch); + + return function(scope, element, attrs, mapController) { + + var orgAttrs = parser.orgAttributes(element); + var filtered = parser.filter(attrs); + var options = parser.getOptions(filtered, scope); + var events = parser.getEvents(scope, filtered); + + /** + * build a custom marker element + */ + var removedEl = element[0].parentElement.removeChild(element[0]); + void 0; + var customMarker = new CustomMarker(options); + + $timeout(function() { //apply contents, class, and location after it is compiled + scope.$watch('[' + varsToWatch.join(',') + ']', function(val) { + customMarker.setContent(orgHtml, scope); + }); + + customMarker.setContent(removedEl.innerHTML, scope); + var classNames = removedEl.firstElementChild.className; + customMarker.addClass('custom-marker'); + customMarker.addClass(classNames); + void 0; + + if (!(options.position instanceof google.maps.LatLng)) { + mapController.getGeoLocation(options.position).then( + function(latlng) { + customMarker.setPosition(latlng); + } + ); + } + }); + + void 0; + for (var eventName in events) { /* jshint ignore:line */ + google.maps.event.addDomListener( + customMarker.el, eventName, events[eventName]); + } + mapController.addObject('customMarkers', customMarker); + + element.bind('$destroy', function() { + //Is it required to remove event listeners when DOM is removed? + mapController.deleteObject('customMarkers', customMarker); + }); + + }; // linkFunc + }; + + var customMarkerDirective = function(Attr2Options, _$timeout_, _$compile_) { + parser = Attr2Options; + $timeout = _$timeout_; + $compile = _$compile_; + setCustomMarker(); + + return { + restrict: 'E', + require: '^map', + compile: function(element) { + var orgHtml = element.html(); + var matches = orgHtml.match(/{{([^}]+)}}/g); + var varsToWatch = []; + (matches || []).forEach(function(match) { //filter out that contains '::', 'this.' + var toWatch = match.replace('{{','').replace('}}',''); + if (match.indexOf('::') == -1 && match.indexOf('this.') == -1 && varsToWatch.indexOf(toWatch) == -1) { + varsToWatch.push(match.replace('{{','').replace('}}','')); + } + }); + + return linkFunc(orgHtml, varsToWatch); + } + }; // return + };// function + customMarkerDirective.$inject = ['Attr2Options', '$timeout', '$compile']; + + angular.module('ngMap').directive('customMarker', customMarkerDirective); +})(); + +/** + * @ngdoc directive + * @name directions + * @description + * Enable directions on map. e.g., origin, destination, draggable, waypoints, etc + * + * Requires: map directive + * + * Restrict To: Element + * + * @attr {String} DirectionsRendererOptions [Any DirectionsRendererOptions](https://developers.google.com/maps/documentation/javascript/reference#DirectionsRendererOptions) + * @attr {String} DirectionsRequestOptions [Any DirectionsRequest options](https://developers.google.com/maps/documentation/javascript/reference#DirectionsRequest) + * @example + * Example: + * + * + * + * + */ +/* global google */ +(function() { + 'use strict'; + + var getDirectionsRenderer = function(options, events) { + if (options.panel) { + options.panel = document.getElementById(options.panel) || document.querySelector(options.panel); + } + var renderer = new google.maps.DirectionsRenderer(options); + for (var eventName in events) { + google.maps.event.addListener(renderer, eventName, events[eventName]); + } + return renderer; + }; + + var directions = function(Attr2Options, $timeout, NavigatorGeolocation) { + var parser = Attr2Options; + var directionsService = new google.maps.DirectionsService(); + + var updateRoute = function(renderer, options) { + /* filter out valid keys only for DirectionsRequest object*/ + var request = options; + request.travelMode = request.travelMode || 'DRIVING'; + var validKeys = [ + 'origin', 'destination', 'travelMode', 'transitOptions', 'unitSystem', + 'durationInTraffic', 'waypoints', 'optimizeWaypoints', + 'provideRouteAlternatives', 'avoidHighways', 'avoidTolls', 'region' + ]; + for(var key in request){ + (validKeys.indexOf(key) === -1) && (delete request[key]); + } + + if(request.waypoints) { + // Check fo valid values + if(request.waypoints == "[]" || request.waypoints == "") delete request.waypoints; + } + + var showDirections = function(request) { + void 0; + directionsService.route(request, function(response, status) { + if (status == google.maps.DirectionsStatus.OK) { + $timeout(function() { + renderer.setDirections(response); + }); + } + }); + }; + + if (request.origin && request.destination) { + if (request.origin == 'current-location') { + NavigatorGeolocation.getCurrentPosition().then(function(ll) { + request.origin = new google.maps.LatLng(ll.coords.latitude, ll.coords.longitude); + showDirections(request); + }); + } else if (request.destination == 'current-location') { + NavigatorGeolocation.getCurrentPosition().then(function(ll) { + request.destination = new google.maps.LatLng(ll.coords.latitude, ll.coords.longitude); + showDirections(request); + }); + } else { + showDirections(request); + } + } + }; + + var linkFunc = function(scope, element, attrs, mapController) { + var orgAttrs = parser.orgAttributes(element); + var filtered = parser.filter(attrs); + var options = parser.getOptions(filtered); + var events = parser.getEvents(scope, filtered); + var attrsToObserve = parser.getAttrsToObserve(orgAttrs); + + var renderer = getDirectionsRenderer(options, events); + mapController.addObject('directionsRenderers', renderer); + + attrsToObserve.forEach(function(attrName) { + (function(attrName) { + attrs.$observe(attrName, function(val) { + if (attrName == 'panel') { + $timeout(function(){ + var panel = document.getElementById(val) || document.querySelector(val); + void 0; + panel && renderer.setPanel(panel); + }); + } else if (options[attrName] !== val) { //apply only if changed + var optionValue = parser.toOptionValue(val, {key: attrName}); + void 0; + options[attrName] = optionValue; + updateRoute(renderer, options); + } + }); + })(attrName); + }); + + scope.$on('mapInitialized', function(event, map) { + updateRoute(renderer, options); + }); + scope.$on('$destroy', function(event, map) { + mapController.deleteObject('directionsRenderers', renderer); + }); + }; + + return { + restrict: 'E', + require: '^map', + link: linkFunc + } + }; // var directions + directions.$inject = ['Attr2Options', '$timeout', 'NavigatorGeolocation']; + + angular.module('ngMap').directive('directions', directions); +})(); + + +/** + * @ngdoc directive + * @name drawing-manager + * @param Attr2Options {service} convert html attribute to Gogole map api options + * @description + * Requires: map directive + * Restrict To: Element + * + * @example + * Example: + * + * + * + * + * + * TODO: Add remove button. + * currently, for out solution, we have the shapes/markers in our own controller, and we use some css classes to change the shape button + * to a remove button (
            X
            ) and have the remove operation in our own controller. + */ +(function() { + 'use strict'; + angular.module('ngMap').directive('drawingManager', ['Attr2Options', function(Attr2Options) { + var parser = Attr2Options; + + return { + restrict: 'E', + require: '^map', + + link: function(scope, element, attrs, mapController) { + var orgAttrs = parser.orgAttributes(element); + var filtered = parser.filter(attrs); + var options = parser.getOptions(filtered); + var controlOptions = parser.getControlOptions(filtered); + var events = parser.getEvents(scope, filtered); + + void 0; + + /** + * set options + */ + var drawingManager = new google.maps.drawing.DrawingManager({ + drawingMode: options.drawingmode, + drawingControl: options.drawingcontrol, + drawingControlOptions: controlOptions.drawingControlOptions, + circleOptions:options.circleoptions, + markerOptions:options.markeroptions, + polygonOptions:options.polygonoptions, + polylineOptions:options.polylineoptions, + rectangleOptions:options.rectangleoptions + }); + + + /** + * set events + */ + var events = parser.getEvents(scope, filtered); + for (var eventName in events) { + google.maps.event.addListener(drawingManager, eventName, events[eventName]); + } + + mapController.addObject('mapDrawingManager', drawingManager); + } + }; // return + }]); +})(); + +/** + * @ngdoc directive + * @name dynamic-maps-engine-layer + * @description + * Requires: map directive + * Restrict To: Element + * + * @example + * Example: + * + * + * + */ +(function() { + 'use strict'; + + angular.module('ngMap').directive('dynamicMapsEngineLayer', ['Attr2Options', function(Attr2Options) { + var parser = Attr2Options; + + var getDynamicMapsEngineLayer = function(options, events) { + var layer = new google.maps.visualization.DynamicMapsEngineLayer(options); + + for (var eventName in events) { + google.maps.event.addListener(layer, eventName, events[eventName]); + } + + return layer; + }; + + + return { + restrict: 'E', + require: '^map', + + link: function(scope, element, attrs, mapController) { + var filtered = parser.filter(attrs); + var options = parser.getOptions(filtered); + var events = parser.getEvents(scope, filtered, events); + void 0; + + var layer = getDynamicMapsEngineLayer(options, events); + mapController.addObject('mapsEngineLayers', layer); + } + }; // return + }]); +})(); + +/** + * @ngdoc directive + * @name fusion-tables-layer + * @description + * Requires: map directive + * Restrict To: Element + * + * @example + * Example: + * + * + * + * + */ +(function() { + 'use strict'; + + angular.module('ngMap').directive('fusionTablesLayer', ['Attr2Options', function(Attr2Options) { + var parser = Attr2Options; + + var getLayer = function(options, events) { + var layer = new google.maps.FusionTablesLayer(options); + + for (var eventName in events) { + google.maps.event.addListener(layer, eventName, events[eventName]); + } + + return layer; + }; + + + return { + restrict: 'E', + require: '^map', + + link: function(scope, element, attrs, mapController) { + var filtered = parser.filter(attrs); + var options = parser.getOptions(filtered); + var events = parser.getEvents(scope, filtered, events); + void 0; + + var layer = getLayer(options, events); + mapController.addObject('fusionTablesLayers', layer); + } + }; // return + }]); +})(); + +/** + * @ngdoc directive + * @name heatmap-layer + * @param Attr2Options {service} convert html attribute to Gogole map api options + * @description + * Requires: map directive + * Restrict To: Element + * + * @example + * Example: + * + * + * + * + */ +(function() { + 'use strict'; + + angular.module('ngMap').directive('heatmapLayer', ['Attr2Options', '$window', function(Attr2Options, $window) { + var parser = Attr2Options; + + return { + restrict: 'E', + require: '^map', + + link: function(scope, element, attrs, mapController) { + var filtered = parser.filter(attrs); + + /** + * set options + */ + var options = parser.getOptions(filtered); + options.data = $window[attrs.data] || scope[attrs.data]; + if (options.data instanceof Array) { + options.data = new google.maps.MVCArray(options.data); + } else { + throw "invalid heatmap data"; + } + var layer = new google.maps.visualization.HeatmapLayer(options); + + /** + * set events + */ + var events = parser.getEvents(scope, filtered); + void 0; + + mapController.addObject('heatmapLayers', layer); + } + }; // return + }]); +})(); + +/** + * @ngdoc directive + * @name info-window + * @param Attr2Options {service} convert html attribute to Gogole map api options + * @param $compile {service} $compile service + * @description + * Defines infoWindow and provides compile method + * + * Requires: map directive + * + * Restrict To: Element + * + * NOTE: this directive should **NOT** be used with `ng-repeat` because InfoWindow itself is a template, + * and must be reused by each marker, thus, should not be redefined by `ng-repeat`. + * + * @attr {Boolean} visible Indicates to show it when map is initialized + * @attr {Boolean} visible-on-marker Indicates to show it on a marker when map is initialized + * @attr {Expression} geo-callback if position is an address, the expression is will be performed when geo-lookup is successful. e.g., geo-callback="showDetail()" + * @attr {String} <InfoWindowOption> Any InfoWindow options, + * https://developers.google.com/maps/documentation/javascript/reference?csw=1#InfoWindowOptions + * @attr {String} <InfoWindowEvent> Any InfoWindow events, https://developers.google.com/maps/documentation/javascript/reference + * @example + * Usage: + * + * + * + * + * Example: + * + * + *
            + * Chicago, IL
            + * LatLng: {{chicago.lat()}}, {{chicago.lng()}},
            + * World Coordinate: {{worldCoordinate.x}}, {{worldCoordinate.y}},
            + * Pixel Coordinate: {{pixelCoordinate.x}}, {{pixelCoordinate.y}},
            + * Tile Coordinate: {{tileCoordinate.x}}, {{tileCoordinate.y}} at Zoom Level {{map.getZoom()}} + *
            + *
            + *
            + */ +/* global google */ +(function() { + 'use strict'; + + var infoWindow = function(Attr2Options, $compile, $timeout, $parse) { + var parser = Attr2Options; + + var getInfoWindow = function(options, events, element) { + var infoWindow; + + /** + * set options + */ + if (options.position && !(options.position instanceof google.maps.LatLng)) { + delete options.position; + } + infoWindow = new google.maps.InfoWindow(options); + + /** + * set events + */ + if (Object.keys(events).length > 0) { + void 0; + } + for (var eventName in events) { + if (eventName) { + google.maps.event.addListener(infoWindow, eventName, events[eventName]); + } + } + + /** + * set template ane template-relate functions + * it must have a container element with ng-non-bindable + */ + var template = element.html().trim(); + if (angular.element(template).length != 1) { + throw "info-window working as a template must have a container"; + } + infoWindow.__template = template.replace(/\s?ng-non-bindable[='"]+/,""); + + infoWindow.__compile = function(scope, anchor) { + anchor && (scope['this'] = anchor); + var el = $compile(infoWindow.__template)(scope); + infoWindow.setContent(el[0]); + scope.$apply(); + }; + + infoWindow.__open = function(map, scope, anchor) { + $timeout(function() { + infoWindow.__compile(scope, anchor); + if (anchor && anchor.getPosition) { + infoWindow.open(map, anchor); + } else if (anchor && anchor instanceof google.maps.LatLng) { + infoWindow.open(map); + infoWindow.setPosition(anchor); + } else { + infoWindow.open(map); + } + }); + }; + + return infoWindow; + }; + + var linkFunc = function(scope, element, attrs, mapController) { + element.css('display','none'); + + var orgAttrs = parser.orgAttributes(element); + var filtered = parser.filter(attrs); + var options = parser.getOptions(filtered, scope); + var events = parser.getEvents(scope, filtered); + void 0; + + var address; + if (options.position && !(options.position instanceof google.maps.LatLng)) { + address = options.position; + } + var infoWindow = getInfoWindow(options, events, element); + if (address) { + mapController.getGeoLocation(address).then(function(latlng) { + infoWindow.setPosition(latlng); + infoWindow.__open(mapController.map, scope, latlng); + var geoCallback = attrs.geoCallback; + geoCallback && $parse(geoCallback)(scope); + }); + } + + mapController.addObject('infoWindows', infoWindow); + mapController.observeAttrSetObj(orgAttrs, attrs, infoWindow); /* observers */ + + scope.$on('mapInitialized', function(evt, map) { + infoWindow.visible && infoWindow.__open(map, scope); + if (infoWindow.visibleOnMarker) { + var markerId = infoWindow.visibleOnMarker; + infoWindow.__open(map, scope, map.markers[markerId]); + } + }); + + /** + * provide showInfoWindow method to scope + */ + + scope.showInfoWindow = function(e, id, marker) { + var infoWindow = mapController.map.infoWindows[id]; + var anchor = marker ? marker : (this.getPosition ? this : null); + infoWindow.__open(mapController.map, scope, anchor); + if(mapController.singleInfoWindow) { + if(mapController.lastInfoWindow) scope.hideInfoWindow(e, mapController.lastInfoWindow); + mapController.lastInfoWindow = id; + } + }; + + /** + * provide hideInfoWindow method to scope + */ + scope.hideInfoWindow = scope.hideInfoWindow || + function(event, id) { + var infoWindow = mapController.map.infoWindows[id]; + infoWindow.close(); + }; + + }; //link + + return { + restrict: 'E', + require: '^map', + link: linkFunc + }; + + }; // infoWindow + infoWindow.$inject = ['Attr2Options', '$compile', '$timeout', '$parse']; + + angular.module('ngMap').directive('infoWindow', infoWindow); +})(); + +/** + * @ngdoc directive + * @name kml-layer + * @param Attr2Options {service} convert html attribute to Gogole map api options + * @description + * renders Kml layer on a map + * Requires: map directive + * Restrict To: Element + * + * @attr {Url} url url of the kml layer + * @attr {KmlLayerOptions} KmlLayerOptions + * (https://developers.google.com/maps/documentation/javascript/reference#KmlLayerOptions) + * @attr {String} <KmlLayerEvent> Any KmlLayer events, https://developers.google.com/maps/documentation/javascript/reference + * @example + * Usage: + * + * + * + * + * Example: + * + * + * + * + */ +(function() { + 'use strict'; + + angular.module('ngMap').directive('kmlLayer', ['Attr2Options', function(Attr2Options) { + var parser = Attr2Options; + + var getKmlLayer = function(options, events) { + var kmlLayer = new google.maps.KmlLayer(options); + for (var eventName in events) { + google.maps.event.addListener(kmlLayer, eventName, events[eventName]); + } + return kmlLayer; + }; + + return { + restrict: 'E', + require: '^map', + + link: function(scope, element, attrs, mapController) { + var orgAttrs = parser.orgAttributes(element); + var filtered = parser.filter(attrs); + var options = parser.getOptions(filtered); + var events = parser.getEvents(scope, filtered); + void 0; + + var kmlLayer = getKmlLayer(options, events); + mapController.addObject('kmlLayers', kmlLayer); + mapController.observeAttrSetObj(orgAttrs, attrs, kmlLayer); //observers + element.bind('$destroy', function() { + mapController.deleteObject('kmlLayers', kmlLayer); + }); + } + }; // return + }]); +})(); + +/** + * @ngdoc directive + * @name map-data + * @param Attr2Options {service} convert html attribute to Gogole map api options + * @description + * set map data + * Requires: map directive + * Restrict To: Element + * + * @wn {String} method-name, run map.data[method-name] with attribute value + * @example + * Example: + * + * + * + * + */ +(function() { + 'use strict'; + + angular.module('ngMap').directive('mapData', ['Attr2Options', function(Attr2Options) { + var parser = Attr2Options; + + return { + restrict: 'E', + require: '^map', + + link: function(scope, element, attrs, mapController) { + var filtered = parser.filter(attrs); + var options = parser.getOptions(filtered); + var events = parser.getEvents(scope, filtered, events); + + void 0; + scope.$on('mapInitialized', function(event, map) { + /** + * options + */ + for (var key in options) { + if (key) { + var val = options[key]; + if (typeof scope[val] === "function") { + map.data[key](scope[val]); + } else { + map.data[key](val); + } + } // if (key) + } + + /** + * events + */ + for (var eventName in events) { + if (events[eventName]) { + map.data.addListener(eventName, events[eventName]); + } + } + }); + } + }; // return + }]); +})(); + +/** + * @ngdoc directive + * @name map-lazy-load + * @param Attr2Options {service} convert html attribute to Gogole map api options + * @description + * Requires: Delay the initialization of map directive until the map is ready to be rendered + * Restrict To: Attribute + * + * @attr {String} map-lazy-load + Maps api script source file location. + * Example: + * 'https://maps.google.com/maps/api/js' + * @attr {String} map-lazy-load-params + Maps api script source file location via angular scope variable. + Also requires the map-lazy-load attribute to be present in the directive. + Example: In your controller, set + $scope.googleMapsURL = 'https://maps.google.com/maps/api/js?v=3.20&client=XXXXXenter-api-key-hereXXXX' + + * @example + * Example: + * + *
            + * + * + * + *
            + * + *
            + * + * + * + *
            + */ +(function() { + 'use strict'; + var $timeout, $compile, src, savedHtml; + + var preLinkFunc = function(scope, element, attrs) { + var mapsUrl = attrs.mapLazyLoadParams || attrs.mapLazyLoad; + + window.lazyLoadCallback = function() { + void 0; + $timeout(function() { /* give some time to load */ + element.html(savedHtml); + $compile(element.contents())(scope); + }, 100); + }; + + if(window.google === undefined || window.google.maps === undefined) { + var scriptEl = document.createElement('script'); + void 0; + scriptEl.src = mapsUrl + (mapsUrl.indexOf('?') > -1 ? '&' : '?') + 'callback=lazyLoadCallback'; + document.body.appendChild(scriptEl); + } else { + element.html(savedHtml); + $compile(element.contents())(scope); + } + }; + + var compileFunc = function(tElement, tAttrs) { + + (!tAttrs.mapLazyLoad) && void 0; + savedHtml = tElement.html(); + src = tAttrs.mapLazyLoad; + + /** + * if already loaded, stop processing it + */ + if (document.querySelector('script[src="'+src+(src.indexOf('?') > -1 ? '&' : '?')+'callback=lazyLoadCallback"]')) { + return false; + } + + tElement.html(''); // will compile again after script is loaded + return { + pre: preLinkFunc + }; + }; + + var mapLazyLoad = function(_$compile_, _$timeout_) { + $compile = _$compile_, $timeout = _$timeout_; + return { + compile: compileFunc + } + }; + mapLazyLoad.$inject = ['$compile','$timeout']; + + angular.module('ngMap').directive('mapLazyLoad', mapLazyLoad); +})(); + +/** + * @ngdoc directive + * @name map-type + * @param Attr2Options {service} convert html attribute to Gogole map api options + * @description + * Requires: map directive + * Restrict To: Element + * + * @example + * Example: + * + * + * + * + */ +(function() { + 'use strict'; + + angular.module('ngMap').directive('mapType', ['Attr2Options', '$window', function(Attr2Options, $window) { + var parser = Attr2Options; + + return { + restrict: 'E', + require: '^map', + + link: function(scope, element, attrs, mapController) { + var mapTypeName = attrs.name, mapTypeObject; + if (!mapTypeName) { + throw "invalid map-type name"; + } + if (attrs.object) { + var __scope = scope[attrs.object] ? scope : $window; + mapTypeObject = __scope[attrs.object]; + if (typeof mapTypeObject == "function") { + mapTypeObject = new mapTypeObject(); + } + } + if (!mapTypeObject) { + throw "invalid map-type object"; + } + + scope.$on('mapInitialized', function(evt, map) { + map.mapTypes.set(mapTypeName, mapTypeObject); + }); + mapController.addObject('mapTypes', mapTypeObject); + } + }; // return + }]); +})(); + +/** + * @ngdoc directive + * @memberof ngMap + * @name map + * @param Attr2Options {service} convert html attribute to Gogole map api options + * @description + * Implementation of {@link MapController} + * Initialize a Google map within a `
            ` tag with given options and register events + * It accepts children directives; marker, shape, or marker-clusterer + * + * It initialize map, children tags, then emits message as soon as the action is done + * The message emitted from this directive is; + * . mapInitialized + * + * Restrict To: + * Element + * + * @attr {Expression} geo-callback if center is an address or current location, the expression is will be executed when geo-lookup is successful. e.g., geo-callback="showMyStoreInfo()" + * @attr {Array} geo-fallback-center + * The center of map incase geolocation failed. i.e. [0,0] + * @attr {Object} geo-location-options + * The navigator geolocation options. i.e. { maximumAge: 3000, timeout: 5000, enableHighAccuracy: true }. If none specified, { timeout: 5000 }. If timeout not specified, timeout: 5000 added + * @attr {Boolean} zoom-to-include-markers + * When true, map boundary will be changed automatially to include all markers when initialized + * @attr {Boolean} default-style + * When false, the default styling, `display:block;height:300px`, will be ignored. + * @attr {String} init-event The name of event to initialize this map. + * If this option is given, the map won't be initialized until the event is received. + * To invoke the event, use $scope.$emit or $scope.$broacast. + * i.e. + * @attr {String} <MapOption> Any Google map options, + * https://developers.google.com/maps/documentation/javascript/reference?csw=1#MapOptions + * @attr {String} <MapEvent> Any Google map events, + * https://rawgit.com/allenhwkim/angularjs-google-maps/master/build/map_events.html + * @attr {Boolean} single-info-window + * When true the map will only display one info window at the time, if not set or false, + * everytime an info window is open it will be displayed with the othe one. + * @example + * Usage: + * + * ... Any children directives + * + * + * Example: + * + * + * + * + * + */ +/* global google */ +(function () { + 'use strict'; + + function getStyle(el, styleProp) { + var y; + if (el.currentStyle) { + y = el.currentStyle[styleProp]; + } else if (window.getComputedStyle) { + y = document.defaultView.getComputedStyle(el, null).getPropertyValue(styleProp); + } + return y; + } + + var mapDirective = function (Attr2Options, $timeout, $parse) { + var parser = Attr2Options; + + /** + * Initialize map and events + * @memberof map + * @param {$scope} scope + * @param {angular.element} element + * @param {Hash} attrs + * @ctrl {MapController} ctrl + */ + var linkFunc = function (scope, element, attrs, ctrl) { + var orgAttrs = parser.orgAttributes(element); + + scope.google = google; //used by $scope.eval in Attr2Options to avoid eval() + + /** + * create a new `div` inside map tag, so that it does not touch map element + * https://stackoverflow.com/questions/20955356 + */ + var el = document.createElement("div"); + el.style.width = "100%"; + el.style.height = "100%"; + element.prepend(el); + + /** + * if style is not given to the map element, set display and height + */ + if (attrs.defaultStyle !== 'false') { + if (getStyle(element[0], 'display') != "block") { + element.css('display', 'block'); + } + if (getStyle(element[0], 'height').match(/^(0|auto)/)) { + element.css('height', '300px'); + } + } + + /** + * disable drag event + */ + element[0].addEventListener('dragstart', function (event) { + event.preventDefault(); + return false; + }); + + /** + * initialize function + */ + var initializeMap = function (mapOptions, mapEvents) { + var map = new google.maps.Map(el, {}); + map.markers = {}; + map.shapes = {}; + + /** + * resize the map to prevent showing partially, in case intialized too early + */ + $timeout(function () { + google.maps.event.trigger(map, "resize"); + }); + + /** + * set options + */ + mapOptions.zoom = mapOptions.zoom || 15; + var center = mapOptions.center; + if (!center) { + mapOptions.center = new google.maps.LatLng(0, 0); + } else if (!(center instanceof google.maps.LatLng)) { + delete mapOptions.center; + ctrl.getGeoLocation(center, options.geoLocationOptions).then(function (latlng) { + map.setCenter(latlng); + var geoCallback = attrs.geoCallback; + geoCallback && $parse(geoCallback)(scope); + }, function (error) { + map.setCenter(options.geoFallbackCenter); + }); + } + map.setOptions(mapOptions); + + ctrl.singleInfoWindow = mapOptions.singleInfoWindow; + + /** + * set events + */ + for (var eventName in mapEvents) { + if (eventName) { + google.maps.event.addListener(map, eventName, mapEvents[eventName]); + } + } + + /** + * set observers + */ + ctrl.observeAttrSetObj(orgAttrs, attrs, map); + + /** + * set controller and set objects + * so that map can be used by other directives; marker or shape + * ctrl._objects are gathered when marker and shape are initialized before map is set + */ + ctrl.map = map; + /* so that map can be used by other directives; marker or shape */ + ctrl.addObjects(ctrl._objects); + + // /* providing method to add a marker used by user scope */ + // map.addMarker = ctrl.addMarker; + + /** + * set map for scope and controller and broadcast map event + * scope.map will be overwritten if user have multiple maps in a scope, + * thus the last map will be set as scope.map. + * however an `mapInitialized` event will be emitted every time. + */ + scope.map = map; + scope.map.scope = scope; + google.maps.event.addListenerOnce(map, "idle", function () { + scope.$emit('mapInitialized', map); + if (attrs.zoomToIncludeMarkers) { + ctrl.zoomToIncludeMarkers(); + if (attrs.zoomToIncludeMarkers == 'auto') { + scope.$on('objectChanged', function (evt, msg) { + msg[0] == 'markers' && ctrl.zoomToIncludeMarkers(); + }); + } + } + }); + }; // function initializeMap() + + /** + * get map options and events + */ + var filtered = parser.filter(attrs); + var options = parser.getOptions(filtered, scope); + var controlOptions = parser.getControlOptions(filtered); + var mapOptions = angular.extend(options, controlOptions); + var mapEvents = parser.getEvents(scope, filtered); + void 0; + + if (attrs.initEvent) { // allows controlled initialization + scope.$on(attrs.initEvent, function () { + !ctrl.map && initializeMap(mapOptions, mapEvents); // init if not done + }); + } else { + initializeMap(mapOptions, mapEvents); + } // if + }; + + return { + restrict: 'AE', + controller: 'MapController', + link: linkFunc + }; + }; + + angular.module('ngMap').directive('map', ['Attr2Options', '$timeout', '$parse', mapDirective]); +})(); + +/* global google */ +(function() { + 'use strict'; + + /** + * @ngdoc controller + * @name MapController + * @param $scope {service} + * @param $q {service} promise Q + * @param NavigatorGeolocation {service} + * @param GeoCoder {service} + * @param Attr2Options {service} convert html attribute to Gogole map api options + * @property {Hash} controls collection of Controls initiated within `map` directive + * @property {Hash} markers collection of Markers initiated within `map` directive + * @property {Hash} shapes collection of shapes initiated within `map` directive + */ + var MapController = function($scope, $q, NavigatorGeolocation, GeoCoder, Attr2Options) { + var parser = Attr2Options; + var _this = this; + + var observeAndSet = function(attrs, attrName, object) { + attrs.$observe(attrName, function(val) { + if (val) { + void 0; + var setMethod = parser.camelCase('set-'+attrName); + var optionValue = parser.toOptionValue(val, {key: attrName}); + void 0; + if (object[setMethod]) { //if set method does exist + /* if an location is being observed */ + if (attrName.match(/center|position/) && + typeof optionValue == 'string') { + _this.getGeoLocation(optionValue).then(function(latlng) { + object[setMethod](latlng); + }); + } else { + object[setMethod](optionValue); + } + } + } + }); + }; + + this.map = null; + this._objects = []; /* temporary collection of map objects */ + + /** + * Add an object to the collection of group + * @memberof MapController + * @function addObject + * @param groupName the name of collection that object belongs to + * @param obj an object to add into a collection, i.e. marker, shape + */ + this.addObject = function(groupName, obj) { + /** + * objects, i.e. markers and shapes, are initialized before map is initialized + * so, we collect those objects, then, we will add to map when map is initialized + * However the case as in ng-repeat, we can directly add to map + */ + if (this.map) { + this.map[groupName] = this.map[groupName] || {}; + var len = Object.keys(this.map[groupName]).length; + this.map[groupName][obj.id || len] = obj; + if (groupName != "infoWindows" && obj.setMap) { //infoWindow.setMap works like infoWindow.open + obj.setMap && obj.setMap(this.map); + } + if (obj.centered && obj.position) { + this.map.setCenter(obj.position); + } + $scope.$emit('objectChanged', [groupName, this.map[groupName]]); + } else { + obj.groupName = groupName; + this._objects.push(obj); + } + }; + + /** + * Delete an object from the collection and remove from map + * @memberof MapController + * @function deleteObject + * @param {Array} objs the collection of objects. i.e., map.markers + * @param {Object} obj the object to be removed. i.e., marker + */ + this.deleteObject = function(groupName, obj) { + /* delete from group */ + if (obj.map) { + var objs = obj.map[groupName]; + for (var name in objs) { + objs[name] === obj && (delete objs[name]); + } + + /* delete from map */ + obj.map && obj.setMap && obj.setMap(null); + $scope.$emit('objectChanged', [groupName, this.map[groupName]]); + } + }; + + /** + * Add collected objects to map + * @memberof MapController + * @function addObjects + * @param {Array} objects the collection of objects. i.e., map.markers + */ + this.addObjects = function(objects) { + for (var i=0; i + * + * + */ +(function() { + 'use strict'; + + angular.module('ngMap').directive('mapsEngineLayer', ['Attr2Options', function(Attr2Options) { + var parser = Attr2Options; + + var getMapsEngineLayer = function(options, events) { + var layer = new google.maps.visualization.MapsEngineLayer(options); + + for (var eventName in events) { + google.maps.event.addListener(layer, eventName, events[eventName]); + } + + return layer; + }; + + + return { + restrict: 'E', + require: '^map', + + link: function(scope, element, attrs, mapController) { + var filtered = parser.filter(attrs); + var options = parser.getOptions(filtered); + var events = parser.getEvents(scope, filtered, events); + void 0; + + var layer = getMapsEngineLayer(options, events); + mapController.addObject('mapsEngineLayers', layer); + } + }; // return + }]); +})(); + +/** + * @ngdoc directive + * @name marker + * @param Attr2Options {service} convert html attribute to Gogole map api options + * @param NavigatorGeolocation It is used to find the current location + * @description + * Draw a Google map marker on a map with given options and register events + * + * Requires: map directive + * + * Restrict To: Element + * + * @attr {String} position address, 'current', or [latitude, longitude] + * example: + * '1600 Pennsylvania Ave, 20500 Washingtion DC', + * 'current position', + * '[40.74, -74.18]' + * @attr {Boolean} centered if set, map will be centered with this marker + * @attr {Expression} geo-callback if position is an address, the expression is will be performed when geo-lookup is successful. e.g., geo-callback="showStoreInfo()" + * @attr {Boolean} no-watcher if true, no attribute observer is added. Useful for many ng-repeat + * @attr {String} <MarkerOption> [Any Marker options](https://developers.google.com/maps/documentation/javascript/reference?csw=1#MarkerOptions) + * @attr {String} <MapEvent> [Any Marker events](https://developers.google.com/maps/documentation/javascript/reference) + * @example + * Usage: + * + * + * + * + * Example: + * + *
            + * + * + * + *
          + * + */ +/* global google */ +(function() { + 'use strict'; + + var getMarker = function(options, events) { + var marker; + + if (!(options.position instanceof google.maps.LatLng)) { + options.position = new google.maps.LatLng(0,0); + } + marker = new google.maps.Marker(options); + + /** + * set events + */ + if (Object.keys(events).length > 0) { + void 0; + } + for (var eventName in events) { + if (eventName) { + google.maps.event.addListener(marker, eventName, events[eventName]); + } + } + + return marker; + }; + + var marker = function(Attr2Options, $parse) { + var parser = Attr2Options; + var linkFunc = function(scope, element, attrs, mapController) { + var orgAttrs = parser.orgAttributes(element); + var filtered = parser.filter(attrs); + var markerOptions = parser.getOptions(filtered, scope); + var markerEvents = parser.getEvents(scope, filtered); + void 0; + + var address; + if (!(markerOptions.position instanceof google.maps.LatLng)) { + address = markerOptions.position; + } + var marker = getMarker(markerOptions, markerEvents); + mapController.addObject('markers', marker); + if (address) { + mapController.getGeoLocation(address).then(function(latlng) { + marker.setPosition(latlng); + markerOptions.centered && marker.map.setCenter(latlng); + var geoCallback = attrs.geoCallback; + geoCallback && $parse(geoCallback)(scope); + }); + } + + /** + * set observers + */ + if (!markerOptions.noWatcher) { + void 0 + mapController.observeAttrSetObj(orgAttrs, attrs, marker); /* observers */ + } + element.bind('$destroy', function() { + mapController.deleteObject('markers', marker); + }); + }; + + return { + restrict: 'E', + require: '^map', + link: linkFunc + }; + }; + + marker.$inject = ['Attr2Options', '$parse']; + angular.module('ngMap').directive('marker', marker); + +})(); + +/** + * @ngdoc directive + * @name overlay-map-type + * @param Attr2Options {service} convert html attribute to Gogole map api options + * @param $window {service} + * @description + * Requires: map directive + * Restrict To: Element + * + * @example + * Example: + * + * + * + * + */ +(function() { + 'use strict'; + + angular.module('ngMap').directive('overlayMapType', ['Attr2Options', '$window', function(Attr2Options, $window) { + var parser = Attr2Options; + + return { + restrict: 'E', + require: '^map', + + link: function(scope, element, attrs, mapController) { + var overlayMapTypeObject; + var initMethod = attrs.initMethod || "insertAt"; + if (attrs.object) { + var __scope = scope[attrs.object] ? scope : $window; + overlayMapTypeObject = __scope[attrs.object]; + if (typeof overlayMapTypeObject == "function") { + overlayMapTypeObject = new overlayMapTypeObject(); + } + } + if (!overlayMapTypeObject) { + throw "invalid map-type object"; + } + + scope.$on('mapInitialized', function(evt, map) { + if (initMethod == "insertAt") { + var index = parseInt(attrs.index, 10); + map.overlayMapTypes.insertAt(index, overlayMapTypeObject); + } else if (initMethod == "push") { + map.overlayMapTypes.push(overlayMapTypeObject); + } + }); + mapController.addObject('overlayMapTypes', overlayMapTypeObject); + } + }; // return + }]); +})(); + +/** + * @ngdoc directive + * @name places-auto-complete + * @param Attr2Options {service} convert html attribute to Gogole map api options + * @description + * Provides address auto complete feature to an input element + * Requires: input tag + * Restrict To: Attribute + * + * @attr {AutoCompleteOptions} [Any AutocompleteOptions](https://developers.google.com/maps/documentation/javascript/3.exp/reference#AutocompleteOptions) + * + * @example + * Example: + * + * + */ +/* global google */ +(function() { + 'use strict'; + + var placesAutoComplete = function(Attr2Options, $timeout) { + var parser = Attr2Options; + + var linkFunc = function(scope, element, attrs, ngModelCtrl) { + if (attrs.placesAutoComplete ==='false') { + return false; + } + var filtered = parser.filter(attrs); + var options = parser.getOptions(filtered); + var events = parser.getEvents(scope, filtered); + void 0; + var autocomplete = new google.maps.places.Autocomplete(element[0], options); + for (var eventName in events) { + google.maps.event.addListener(autocomplete, eventName, events[eventName]); + } + + var updateModel = function() { + $timeout(function(){ + ngModelCtrl && ngModelCtrl.$setViewValue(element.val()); + },100); + } + google.maps.event.addListener(autocomplete, 'place_changed', updateModel); + element[0].addEventListener('change', updateModel); + + attrs.$observe('types', function(val) { + if (val) { + void 0; + var optionValue = parser.toOptionValue(val, {key: 'types'}); + void 0; + autocomplete.setTypes(optionValue); + } + }); + }; + + return { + restrict: 'A', + require: '?ngModel', + link: linkFunc + }; + }; + + placesAutoComplete.$inject = ['Attr2Options', '$timeout']; + angular.module('ngMap').directive('placesAutoComplete', placesAutoComplete); + +})(); + +/** + * @ngdoc directive + * @name shape + * @param Attr2Options {service} convert html attribute to Gogole map api options + * @description + * Initialize a Google map shape in map with given options and register events + * The shapes are: + * . circle + * . polygon + * . polyline + * . rectangle + * . groundOverlay(or image) + * + * Requires: map directive + * + * Restrict To: Element + * + * @attr {Boolean} centered if set, map will be centered with this marker + * @attr {Expression} geo-callback if shape is a circle and the center is an address, the expression is will be performed when geo-lookup is successful. e.g., geo-callback="showDetail()" + * @attr {String} <OPTIONS> + * For circle, [any circle options](https://developers.google.com/maps/documentation/javascript/reference#CircleOptions) + * For polygon, [any polygon options](https://developers.google.com/maps/documentation/javascript/reference#PolygonOptions) + * For polyline, [any polyline options](https://developers.google.com/maps/documentation/javascript/reference#PolylineOptions) + * For rectangle, [any rectangle options](https://developers.google.com/maps/documentation/javascript/reference#RectangleOptions) + * For image, [any groundOverlay options](https://developers.google.com/maps/documentation/javascript/reference#GroundOverlayOptions) + * @attr {String} <MapEvent> [Any Shape events](https://developers.google.com/maps/documentation/javascript/reference) + * @example + * Usage: + * + * + * + * + * Example: + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * For full-working example, please visit + * [shape example](https://rawgit.com/allenhwkim/angularjs-google-maps/master/build/shape.html) + */ +/* global google */ +(function() { + 'use strict'; + + var getShape = function(options, events) { + var shape; + + var shapeName = options.name; + delete options.name; //remove name bcoz it's not for options + void 0; + + /** + * set options + */ + switch(shapeName) { + case "circle": + if (!(options.center instanceof google.maps.LatLng)) { + options.center = new google.maps.LatLng(0,0); + } + shape = new google.maps.Circle(options); + break; + case "polygon": + shape = new google.maps.Polygon(options); + break; + case "polyline": + shape = new google.maps.Polyline(options); + break; + case "rectangle": + shape = new google.maps.Rectangle(options); + break; + case "groundOverlay": + case "image": + var url = options.url; + var opts = {opacity: options.opacity, clickable: options.clickable, id:options.id}; + shape = new google.maps.GroundOverlay(url, options.bounds, opts); + break; + } + + /** + * set events + */ + for (var eventName in events) { + if (events[eventName]) { + google.maps.event.addListener(shape, eventName, events[eventName]); + } + } + return shape; + }; + + var shape = function(Attr2Options, $parse) { + var parser = Attr2Options; + + var linkFunc = function(scope, element, attrs, mapController) { + var orgAttrs = parser.orgAttributes(element); + var filtered = parser.filter(attrs); + var shapeOptions = parser.getOptions(filtered); + var shapeEvents = parser.getEvents(scope, filtered); + + var address, shapeType; + shapeType = shapeOptions.name; + if (!(shapeOptions.center instanceof google.maps.LatLng)) { + address = shapeOptions.center; + } + var shape = getShape(shapeOptions, shapeEvents); + mapController.addObject('shapes', shape); + + if (address && shapeType == 'circle') { + mapController.getGeoLocation(address).then(function(latlng) { + shape.setCenter(latlng); + shape.centered && shape.map.setCenter(latlng); + var geoCallback = attrs.geoCallback; + geoCallback && $parse(geoCallback)(scope); + }); + } + + /** + * set observers + */ + mapController.observeAttrSetObj(orgAttrs, attrs, shape); + element.bind('$destroy', function() { + mapController.deleteObject('shapes', shape); + }); + }; + + return { + restrict: 'E', + require: '^map', + link: linkFunc + }; // return + }; + shape.$inject = ['Attr2Options', '$parse']; + + angular.module('ngMap').directive('shape', shape); + +})(); + +/** + * @ngdoc directive + * @name streetview-panorama + * @param Attr2Options {service} convert html attribute to Gogole map api options + * @description + * Requires: map directive + * Restrict To: Element + * + * @attr container Optional, id or css selector, if given, streetview will be in the given html element + * @attr {String} <StreetViewPanoramaOption> [Any Google StreetViewPanorama options](https://developers.google.com/maps/documentation/javascript/reference?csw=1#StreetViewPanoramaOptions) + * @attr {String} <StreetViewPanoramaEvent> [Any Google StreetViewPanorama events](https://developers.google.com/maps/documentation/javascript/reference#StreetViewPanorama) + * + * @example + * + * + * + * + */ +/* global google */ +(function() { + 'use strict'; + + var streetViewPanorama = function(Attr2Options) { + var parser = Attr2Options; + + var getStreetViewPanorama = function(map, options, events) { + var svp, container; + if (options.container) { + container = document.getElementById(options.container); + container = container || document.querySelector(options.container); + } + if (container) { + svp = new google.maps.StreetViewPanorama(container, options); + } else { + svp = map.getStreetView(); + svp.setOptions(options); + } + + for (var eventName in events) { + eventName && + google.maps.event.addListener(svp, eventName, events[eventName]); + } + return svp; + }; + + var linkFunc = function(scope, element, attrs, mapController) { + var orgAttrs = parser.orgAttributes(element); + var filtered = parser.filter(attrs); + var options = parser.getOptions(filtered); + var controlOptions = parser.getControlOptions(filtered); + var svpOptions = angular.extend(options, controlOptions); + + var svpEvents = parser.getEvents(scope, filtered); + void 0; + + scope.$on('mapInitialized', function(evt, map) { + var svp = getStreetViewPanorama(map, svpOptions, svpEvents); + + map.setStreetView(svp); + (!svp.getPosition()) && svp.setPosition(map.getCenter()); + google.maps.event.addListener(svp, 'position_changed', function() { + if (svp.getPosition() !== map.getCenter()) { + map.setCenter(svp.getPosition()); + } + }); + //needed for geo-callback + var listener = google.maps.event.addListener(map, 'center_changed', function() { + svp.setPosition(map.getCenter()); + google.maps.event.removeListener(listener); + }); + }); + + }; //link + + return { + restrict: 'E', + require: '^map', + link: linkFunc + }; + + }; + streetViewPanorama.$inject = ['Attr2Options']; + + angular.module('ngMap').directive('streetViewPanorama', streetViewPanorama); +})(); + +/** + * @ngdoc directive + * @name traffic-layer + * @param Attr2Options {service} convert html attribute to Gogole map api options + * @description + * Requires: map directive + * Restrict To: Element + * + * @example + * Example: + * + * + * + * + */ +(function() { + 'use strict'; + + angular.module('ngMap').directive('trafficLayer', ['Attr2Options', function(Attr2Options) { + var parser = Attr2Options; + + var getLayer = function(options, events) { + var layer = new google.maps.TrafficLayer(options); + for (var eventName in events) { + google.maps.event.addListener(layer, eventName, events[eventName]); + } + return layer; + }; + + return { + restrict: 'E', + require: '^map', + + link: function(scope, element, attrs, mapController) { + var orgAttrs = parser.orgAttributes(element); + var filtered = parser.filter(attrs); + var options = parser.getOptions(filtered); + var events = parser.getEvents(scope, filtered); + void 0; + + var layer = getLayer(options, events); + mapController.addObject('trafficLayers', layer); + mapController.observeAttrSetObj(orgAttrs, attrs, layer); //observers + element.bind('$destroy', function() { + mapController.deleteObject('trafficLayers', layer); + }); + } + }; // return + }]); +})(); + +/** + * @ngdoc directive + * @name transit-layer + * @param Attr2Options {service} convert html attribute to Gogole map api options + * @description + * Requires: map directive + * Restrict To: Element + * + * @example + * Example: + * + * + * + * + */ +(function() { + 'use strict'; + + angular.module('ngMap').directive('transitLayer', ['Attr2Options', function(Attr2Options) { + var parser = Attr2Options; + + var getLayer = function(options, events) { + var layer = new google.maps.TransitLayer(options); + for (var eventName in events) { + google.maps.event.addListener(layer, eventName, events[eventName]); + } + return layer; + }; + + return { + restrict: 'E', + require: '^map', + + link: function(scope, element, attrs, mapController) { + var orgAttrs = parser.orgAttributes(element); + var filtered = parser.filter(attrs); + var options = parser.getOptions(filtered); + var events = parser.getEvents(scope, filtered); + void 0; + + var layer = getLayer(options, events); + mapController.addObject('transitLayers', layer); + mapController.observeAttrSetObj(orgAttrs, attrs, layer); //observers + element.bind('$destroy', function() { + mapController.deleteObject('transitLayers', layer); + }); + } + }; // return + }]); +})(); + +/** + * @ngdoc directive + * @name weather-layer + * @param Attr2Options {service} convert html attribute to Gogole map api options + * @description + * Requires: map directive + * Restrict To: Element + * + * @example + * Example: + * + * + * + * + */ +(function() { + 'use strict'; + + angular.module('ngMap').directive('weatherLayer', ['Attr2Options', function(Attr2Options) { + var parser = Attr2Options; + + var getLayer = function(options, events) { + var layer = new google.maps.weather.WeatherLayer(options); + for (var eventName in events) { + google.maps.event.addListener(layer, eventName, events[eventName]); + } + return layer; + }; + + return { + restrict: 'E', + require: '^map', + + link: function(scope, element, attrs, mapController) { + var orgAttrs = parser.orgAttributes(element); + var filtered = parser.filter(attrs); + var options = parser.getOptions(filtered); + var events = parser.getEvents(scope, filtered); + + void 0; + + var layer = getLayer(options, events); + mapController.addObject('weatherLayers', layer); + mapController.observeAttrSetObj(orgAttrs, attrs, layer); //observers + element.bind('$destroy', function() { + mapController.deleteObject('weatherLayers', layer); + }); + } + }; // return + }]); +})(); diff --git a/public/bower_components/oclazyload/ocLazyLoad.js b/public/bower_components/oclazyload/ocLazyLoad.js new file mode 100644 index 0000000..a9e57af --- /dev/null +++ b/public/bower_components/oclazyload/ocLazyLoad.js @@ -0,0 +1,1338 @@ +/** + * oclazyload - Load modules on demand (lazy load) with angularJS + * @version v1.0.9 + * @link https://github.com/ocombe/ocLazyLoad + * @license MIT + * @author Olivier Combe + */ +(function (angular, window) { + 'use strict'; + + var regModules = ['ng', 'oc.lazyLoad'], + regInvokes = {}, + regConfigs = [], + modulesToLoad = [], + // modules to load from angular.module or other sources + realModules = [], + // real modules called from angular.module + recordDeclarations = [], + broadcast = angular.noop, + runBlocks = {}, + justLoaded = []; + + var ocLazyLoad = angular.module('oc.lazyLoad', ['ng']); + + ocLazyLoad.provider('$ocLazyLoad', ["$controllerProvider", "$provide", "$compileProvider", "$filterProvider", "$injector", "$animateProvider", function ($controllerProvider, $provide, $compileProvider, $filterProvider, $injector, $animateProvider) { + var modules = {}, + providers = { + $controllerProvider: $controllerProvider, + $compileProvider: $compileProvider, + $filterProvider: $filterProvider, + $provide: $provide, // other things (constant, decorator, provider, factory, service) + $injector: $injector, + $animateProvider: $animateProvider + }, + debug = false, + events = false, + moduleCache = [], + modulePromises = {}; + + moduleCache.push = function (value) { + if (this.indexOf(value) === -1) { + Array.prototype.push.apply(this, arguments); + } + }; + + this.config = function (config) { + // If we want to define modules configs + if (angular.isDefined(config.modules)) { + if (angular.isArray(config.modules)) { + angular.forEach(config.modules, function (moduleConfig) { + modules[moduleConfig.name] = moduleConfig; + }); + } else { + modules[config.modules.name] = config.modules; + } + } + + if (angular.isDefined(config.debug)) { + debug = config.debug; + } + + if (angular.isDefined(config.events)) { + events = config.events; + } + }; + + /** + * Get the list of existing registered modules + * @param element + */ + this._init = function _init(element) { + // this is probably useless now because we override angular.bootstrap + if (modulesToLoad.length === 0) { + var elements = [element], + names = ['ng:app', 'ng-app', 'x-ng-app', 'data-ng-app'], + NG_APP_CLASS_REGEXP = /\sng[:\-]app(:\s*([\w\d_]+);?)?\s/, + append = function append(elm) { + return elm && elements.push(elm); + }; + + angular.forEach(names, function (name) { + names[name] = true; + append(document.getElementById(name)); + name = name.replace(':', '\\:'); + if (typeof element[0] !== 'undefined' && element[0].querySelectorAll) { + angular.forEach(element[0].querySelectorAll('.' + name), append); + angular.forEach(element[0].querySelectorAll('.' + name + '\\:'), append); + angular.forEach(element[0].querySelectorAll('[' + name + ']'), append); + } + }); + + angular.forEach(elements, function (elm) { + if (modulesToLoad.length === 0) { + var className = ' ' + element.className + ' '; + var match = NG_APP_CLASS_REGEXP.exec(className); + if (match) { + modulesToLoad.push((match[2] || '').replace(/\s+/g, ',')); + } else { + angular.forEach(elm.attributes, function (attr) { + if (modulesToLoad.length === 0 && names[attr.name]) { + modulesToLoad.push(attr.value); + } + }); + } + } + }); + } + + if (modulesToLoad.length === 0 && !((window.jasmine || window.mocha) && angular.isDefined(angular.mock))) { + console.error('No module found during bootstrap, unable to init ocLazyLoad. You should always use the ng-app directive or angular.boostrap when you use ocLazyLoad.'); + } + + var addReg = function addReg(moduleName) { + if (regModules.indexOf(moduleName) === -1) { + // register existing modules + regModules.push(moduleName); + var mainModule = angular.module(moduleName); + + // register existing components (directives, services, ...) + _invokeQueue(null, mainModule._invokeQueue, moduleName); + _invokeQueue(null, mainModule._configBlocks, moduleName); // angular 1.3+ + + angular.forEach(mainModule.requires, addReg); + } + }; + + angular.forEach(modulesToLoad, function (moduleName) { + addReg(moduleName); + }); + + modulesToLoad = []; // reset for next bootstrap + recordDeclarations.pop(); // wait for the next lazy load + }; + + /** + * Like JSON.stringify but that doesn't throw on circular references + * @param obj + */ + var stringify = function stringify(obj) { + try { + return JSON.stringify(obj); + } catch (e) { + var cache = []; + return JSON.stringify(obj, function (key, value) { + if (angular.isObject(value) && value !== null) { + if (cache.indexOf(value) !== -1) { + // Circular reference found, discard key + return; + } + // Store value in our collection + cache.push(value); + } + return value; + }); + } + }; + + var hashCode = function hashCode(str) { + var hash = 0, + i, + chr, + len; + if (str.length == 0) { + return hash; + } + for (i = 0, len = str.length; i < len; i++) { + chr = str.charCodeAt(i); + hash = (hash << 5) - hash + chr; + hash |= 0; // Convert to 32bit integer + } + return hash; + }; + + function _register(providers, registerModules, params) { + if (registerModules) { + var k, + moduleName, + moduleFn, + tempRunBlocks = []; + for (k = registerModules.length - 1; k >= 0; k--) { + moduleName = registerModules[k]; + if (!angular.isString(moduleName)) { + moduleName = getModuleName(moduleName); + } + if (!moduleName || justLoaded.indexOf(moduleName) !== -1 || modules[moduleName] && realModules.indexOf(moduleName) === -1) { + continue; + } + // new if not registered + var newModule = regModules.indexOf(moduleName) === -1; + moduleFn = ngModuleFct(moduleName); + if (newModule) { + regModules.push(moduleName); + _register(providers, moduleFn.requires, params); + } + if (moduleFn._runBlocks.length > 0) { + // new run blocks detected! Replace the old ones (if existing) + runBlocks[moduleName] = []; + while (moduleFn._runBlocks.length > 0) { + runBlocks[moduleName].push(moduleFn._runBlocks.shift()); + } + } + if (angular.isDefined(runBlocks[moduleName]) && (newModule || params.rerun)) { + tempRunBlocks = tempRunBlocks.concat(runBlocks[moduleName]); + } + _invokeQueue(providers, moduleFn._invokeQueue, moduleName, params.reconfig); + _invokeQueue(providers, moduleFn._configBlocks, moduleName, params.reconfig); // angular 1.3+ + broadcast(newModule ? 'ocLazyLoad.moduleLoaded' : 'ocLazyLoad.moduleReloaded', moduleName); + registerModules.pop(); + justLoaded.push(moduleName); + } + // execute the run blocks at the end + var instanceInjector = providers.getInstanceInjector(); + angular.forEach(tempRunBlocks, function (fn) { + instanceInjector.invoke(fn); + }); + } + } + + function _registerInvokeList(args, moduleName) { + var invokeList = args[2][0], + type = args[1], + newInvoke = false; + if (angular.isUndefined(regInvokes[moduleName])) { + regInvokes[moduleName] = {}; + } + if (angular.isUndefined(regInvokes[moduleName][type])) { + regInvokes[moduleName][type] = {}; + } + var onInvoke = function onInvoke(invokeName, invoke) { + if (!regInvokes[moduleName][type].hasOwnProperty(invokeName)) { + regInvokes[moduleName][type][invokeName] = []; + } + if (checkHashes(invoke, regInvokes[moduleName][type][invokeName])) { + newInvoke = true; + regInvokes[moduleName][type][invokeName].push(invoke); + broadcast('ocLazyLoad.componentLoaded', [moduleName, type, invokeName]); + } + }; + + function checkHashes(potentialNew, invokes) { + var isNew = true, + newHash; + if (invokes.length) { + newHash = signature(potentialNew); + angular.forEach(invokes, function (invoke) { + isNew = isNew && signature(invoke) !== newHash; + }); + } + return isNew; + } + + function signature(data) { + if (angular.isArray(data)) { + // arrays are objects, we need to test for it first + return hashCode(data.toString()); + } else if (angular.isObject(data)) { + // constants & values for example + return hashCode(stringify(data)); + } else { + if (angular.isDefined(data) && data !== null) { + return hashCode(data.toString()); + } else { + // null & undefined constants + return data; + } + } + } + + if (angular.isString(invokeList)) { + onInvoke(invokeList, args[2][1]); + } else if (angular.isObject(invokeList)) { + angular.forEach(invokeList, function (invoke, key) { + if (angular.isString(invoke)) { + // decorators for example + onInvoke(invoke, invokeList[1]); + } else { + // components registered as object lists {"componentName": function() {}} + onInvoke(key, invoke); + } + }); + } else { + return false; + } + return newInvoke; + } + + function _invokeQueue(providers, queue, moduleName, reconfig) { + if (!queue) { + return; + } + + var i, len, args, provider; + for (i = 0, len = queue.length; i < len; i++) { + args = queue[i]; + if (angular.isArray(args)) { + if (providers !== null) { + if (providers.hasOwnProperty(args[0])) { + provider = providers[args[0]]; + } else { + throw new Error('unsupported provider ' + args[0]); + } + } + var isNew = _registerInvokeList(args, moduleName); + if (args[1] !== 'invoke') { + if (isNew && angular.isDefined(provider)) { + provider[args[1]].apply(provider, args[2]); + } + } else { + // config block + var callInvoke = function callInvoke(fct) { + var invoked = regConfigs.indexOf(moduleName + '-' + fct); + if (invoked === -1 || reconfig) { + if (invoked === -1) { + regConfigs.push(moduleName + '-' + fct); + } + if (angular.isDefined(provider)) { + provider[args[1]].apply(provider, args[2]); + } + } + }; + if (angular.isFunction(args[2][0])) { + callInvoke(args[2][0]); + } else if (angular.isArray(args[2][0])) { + for (var j = 0, jlen = args[2][0].length; j < jlen; j++) { + if (angular.isFunction(args[2][0][j])) { + callInvoke(args[2][0][j]); + } + } + } + } + } + } + } + + function getModuleName(module) { + var moduleName = null; + if (angular.isString(module)) { + moduleName = module; + } else if (angular.isObject(module) && module.hasOwnProperty('name') && angular.isString(module.name)) { + moduleName = module.name; + } + return moduleName; + } + + function moduleExists(moduleName) { + if (!angular.isString(moduleName)) { + return false; + } + try { + return ngModuleFct(moduleName); + } catch (e) { + if (/No module/.test(e) || e.message.indexOf('$injector:nomod') > -1) { + return false; + } + } + } + + this.$get = ["$log", "$rootElement", "$rootScope", "$cacheFactory", "$q", function ($log, $rootElement, $rootScope, $cacheFactory, $q) { + var instanceInjector, + filesCache = $cacheFactory('ocLazyLoad'); + + if (!debug) { + $log = {}; + $log['error'] = angular.noop; + $log['warn'] = angular.noop; + $log['info'] = angular.noop; + } + + // Make this lazy because when $get() is called the instance injector hasn't been assigned to the rootElement yet + providers.getInstanceInjector = function () { + return instanceInjector ? instanceInjector : instanceInjector = $rootElement.data('$injector') || angular.injector(); + }; + + broadcast = function broadcast(eventName, params) { + if (events) { + $rootScope.$broadcast(eventName, params); + } + if (debug) { + $log.info(eventName, params); + } + }; + + function reject(e) { + var deferred = $q.defer(); + $log.error(e.message); + deferred.reject(e); + return deferred.promise; + } + + return { + _broadcast: broadcast, + + _$log: $log, + + /** + * Returns the files cache used by the loaders to store the files currently loading + * @returns {*} + */ + _getFilesCache: function getFilesCache() { + return filesCache; + }, + + /** + * Let the service know that it should monitor angular.module because files are loading + * @param watch boolean + */ + toggleWatch: function toggleWatch(watch) { + if (watch) { + recordDeclarations.push(true); + } else { + recordDeclarations.pop(); + } + }, + + /** + * Let you get a module config object + * @param moduleName String the name of the module + * @returns {*} + */ + getModuleConfig: function getModuleConfig(moduleName) { + if (!angular.isString(moduleName)) { + throw new Error('You need to give the name of the module to get'); + } + if (!modules[moduleName]) { + return null; + } + return angular.copy(modules[moduleName]); + }, + + /** + * Let you define a module config object + * @param moduleConfig Object the module config object + * @returns {*} + */ + setModuleConfig: function setModuleConfig(moduleConfig) { + if (!angular.isObject(moduleConfig)) { + throw new Error('You need to give the module config object to set'); + } + modules[moduleConfig.name] = moduleConfig; + return moduleConfig; + }, + + /** + * Returns the list of loaded modules + * @returns {string[]} + */ + getModules: function getModules() { + return regModules; + }, + + /** + * Let you check if a module has been loaded into Angular or not + * @param modulesNames String/Object a module name, or a list of module names + * @returns {boolean} + */ + isLoaded: function isLoaded(modulesNames) { + var moduleLoaded = function moduleLoaded(module) { + var isLoaded = regModules.indexOf(module) > -1; + if (!isLoaded) { + isLoaded = !!moduleExists(module); + } + return isLoaded; + }; + if (angular.isString(modulesNames)) { + modulesNames = [modulesNames]; + } + if (angular.isArray(modulesNames)) { + var i, len; + for (i = 0, len = modulesNames.length; i < len; i++) { + if (!moduleLoaded(modulesNames[i])) { + return false; + } + } + return true; + } else { + throw new Error('You need to define the module(s) name(s)'); + } + }, + + /** + * Given a module, return its name + * @param module + * @returns {String} + */ + _getModuleName: getModuleName, + + /** + * Returns a module if it exists + * @param moduleName + * @returns {module} + */ + _getModule: function getModule(moduleName) { + try { + return ngModuleFct(moduleName); + } catch (e) { + // this error message really suxx + if (/No module/.test(e) || e.message.indexOf('$injector:nomod') > -1) { + e.message = 'The module "' + stringify(moduleName) + '" that you are trying to load does not exist. ' + e.message; + } + throw e; + } + }, + + /** + * Check if a module exists and returns it if it does + * @param moduleName + * @returns {boolean} + */ + moduleExists: moduleExists, + + /** + * Load the dependencies, and might try to load new files depending on the config + * @param moduleName (String or Array of Strings) + * @param localParams + * @returns {*} + * @private + */ + _loadDependencies: function _loadDependencies(moduleName, localParams) { + var loadedModule, + requires, + diff, + promisesList = [], + self = this; + + moduleName = self._getModuleName(moduleName); + + if (moduleName === null) { + return $q.when(); + } else { + try { + loadedModule = self._getModule(moduleName); + } catch (e) { + return reject(e); + } + // get unloaded requires + requires = self.getRequires(loadedModule); + } + + angular.forEach(requires, function (requireEntry) { + // If no configuration is provided, try and find one from a previous load. + // If there isn't one, bail and let the normal flow run + if (angular.isString(requireEntry)) { + var config = self.getModuleConfig(requireEntry); + if (config === null) { + moduleCache.push(requireEntry); // We don't know about this module, but something else might, so push it anyway. + return; + } + requireEntry = config; + // ignore the name because it's probably not a real module name + config.name = undefined; + } + + // Check if this dependency has been loaded previously + if (self.moduleExists(requireEntry.name)) { + // compare against the already loaded module to see if the new definition adds any new files + diff = requireEntry.files.filter(function (n) { + return self.getModuleConfig(requireEntry.name).files.indexOf(n) < 0; + }); + + // If the module was redefined, advise via the console + if (diff.length !== 0) { + self._$log.warn('Module "', moduleName, '" attempted to redefine configuration for dependency. "', requireEntry.name, '"\n Additional Files Loaded:', diff); + } + + // Push everything to the file loader, it will weed out the duplicates. + if (angular.isDefined(self.filesLoader)) { + // if a files loader is defined + promisesList.push(self.filesLoader(requireEntry, localParams).then(function () { + return self._loadDependencies(requireEntry); + })); + } else { + return reject(new Error('Error: New dependencies need to be loaded from external files (' + requireEntry.files + '), but no loader has been defined.')); + } + return; + } else if (angular.isArray(requireEntry)) { + var files = []; + angular.forEach(requireEntry, function (entry) { + // let's check if the entry is a file name or a config name + var config = self.getModuleConfig(entry); + if (config === null) { + files.push(entry); + } else if (config.files) { + files = files.concat(config.files); + } + }); + if (files.length > 0) { + requireEntry = { + files: files + }; + } + } else if (angular.isObject(requireEntry)) { + if (requireEntry.hasOwnProperty('name') && requireEntry['name']) { + // The dependency doesn't exist in the module cache and is a new configuration, so store and push it. + self.setModuleConfig(requireEntry); + moduleCache.push(requireEntry['name']); + } + } + + // Check if the dependency has any files that need to be loaded. If there are, push a new promise to the promise list. + if (angular.isDefined(requireEntry.files) && requireEntry.files.length !== 0) { + if (angular.isDefined(self.filesLoader)) { + // if a files loader is defined + promisesList.push(self.filesLoader(requireEntry, localParams).then(function () { + return self._loadDependencies(requireEntry); + })); + } else { + return reject(new Error('Error: the module "' + requireEntry.name + '" is defined in external files (' + requireEntry.files + '), but no loader has been defined.')); + } + } + }); + + // Create a wrapper promise to watch the promise list and resolve it once everything is done. + return $q.all(promisesList); + }, + + /** + * Inject new modules into Angular + * @param moduleName + * @param localParams + * @param real + */ + inject: function inject(moduleName) { + var localParams = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; + var real = arguments.length <= 2 || arguments[2] === undefined ? false : arguments[2]; + + var self = this, + deferred = $q.defer(); + if (angular.isDefined(moduleName) && moduleName !== null) { + if (angular.isArray(moduleName)) { + var promisesList = []; + angular.forEach(moduleName, function (module) { + promisesList.push(self.inject(module, localParams, real)); + }); + return $q.all(promisesList); + } else { + self._addToLoadList(self._getModuleName(moduleName), true, real); + } + } + if (modulesToLoad.length > 0) { + var res = modulesToLoad.slice(); // clean copy + var loadNext = function loadNext(moduleName) { + moduleCache.push(moduleName); + modulePromises[moduleName] = deferred.promise; + self._loadDependencies(moduleName, localParams).then(function success() { + try { + justLoaded = []; + _register(providers, moduleCache, localParams); + } catch (e) { + self._$log.error(e.message); + deferred.reject(e); + return; + } + + if (modulesToLoad.length > 0) { + loadNext(modulesToLoad.shift()); // load the next in list + } else { + deferred.resolve(res); // everything has been loaded, resolve + } + }, function error(err) { + deferred.reject(err); + }); + }; + + // load the first in list + loadNext(modulesToLoad.shift()); + } else if (localParams && localParams.name && modulePromises[localParams.name]) { + return modulePromises[localParams.name]; + } else { + deferred.resolve(); + } + return deferred.promise; + }, + + /** + * Get the list of required modules/services/... for this module + * @param module + * @returns {Array} + */ + getRequires: function getRequires(module) { + var requires = []; + angular.forEach(module.requires, function (requireModule) { + if (regModules.indexOf(requireModule) === -1) { + requires.push(requireModule); + } + }); + return requires; + }, + + /** + * Invoke the new modules & component by their providers + * @param providers + * @param queue + * @param moduleName + * @param reconfig + * @private + */ + _invokeQueue: _invokeQueue, + + /** + * Check if a module has been invoked and registers it if not + * @param args + * @param moduleName + * @returns {boolean} is new + */ + _registerInvokeList: _registerInvokeList, + + /** + * Register a new module and loads it, executing the run/config blocks if needed + * @param providers + * @param registerModules + * @param params + * @private + */ + _register: _register, + + /** + * Add a module name to the list of modules that will be loaded in the next inject + * @param name + * @param force + * @private + */ + _addToLoadList: _addToLoadList, + + /** + * Unregister modules (you shouldn't have to use this) + * @param modules + */ + _unregister: function _unregister(modules) { + if (angular.isDefined(modules)) { + if (angular.isArray(modules)) { + angular.forEach(modules, function (module) { + regInvokes[module] = undefined; + }); + } + } + } + }; + }]; + + // Let's get the list of loaded modules & components + this._init(angular.element(window.document)); + }]); + + var bootstrapFct = angular.bootstrap; + angular.bootstrap = function (element, modules, config) { + // we use slice to make a clean copy + angular.forEach(modules.slice(), function (module) { + _addToLoadList(module, true, true); + }); + return bootstrapFct(element, modules, config); + }; + + var _addToLoadList = function _addToLoadList(name, force, real) { + if ((recordDeclarations.length > 0 || force) && angular.isString(name) && modulesToLoad.indexOf(name) === -1) { + modulesToLoad.push(name); + if (real) { + realModules.push(name); + } + } + }; + + var ngModuleFct = angular.module; + angular.module = function (name, requires, configFn) { + _addToLoadList(name, false, true); + return ngModuleFct(name, requires, configFn); + }; + + // CommonJS package manager support: + if (typeof module !== 'undefined' && typeof exports !== 'undefined' && module.exports === exports) { + module.exports = 'oc.lazyLoad'; + } +})(angular, window); +(function (angular) { + 'use strict'; + + angular.module('oc.lazyLoad').directive('ocLazyLoad', ["$ocLazyLoad", "$compile", "$animate", "$parse", "$timeout", function ($ocLazyLoad, $compile, $animate, $parse, $timeout) { + return { + restrict: 'A', + terminal: true, + priority: 1000, + compile: function compile(element, attrs) { + // we store the content and remove it before compilation + var content = element[0].innerHTML; + element.html(''); + + return function ($scope, $element, $attr) { + var model = $parse($attr.ocLazyLoad); + $scope.$watch(function () { + return model($scope) || $attr.ocLazyLoad; // it can be a module name (string), an object, an array, or a scope reference to any of this + }, function (moduleName) { + if (angular.isDefined(moduleName)) { + $ocLazyLoad.load(moduleName).then(function () { + // Attach element contents to DOM and then compile them. + // This prevents an issue where IE invalidates saved element objects (HTMLCollections) + // of the compiled contents when attaching to the parent DOM. + $animate.enter(content, $element); + // get the new content & compile it + $compile($element.contents())($scope); + }); + } + }, true); + }; + } + }; + }]); +})(angular); +(function (angular) { + 'use strict'; + + angular.module('oc.lazyLoad').config(["$provide", function ($provide) { + $provide.decorator('$ocLazyLoad', ["$delegate", "$q", "$window", "$interval", function ($delegate, $q, $window, $interval) { + var uaCssChecked = false, + useCssLoadPatch = false, + anchor = $window.document.getElementsByTagName('head')[0] || $window.document.getElementsByTagName('body')[0]; + + /** + * Load a js/css file + * @param type + * @param path + * @param params + * @returns promise + */ + $delegate.buildElement = function buildElement(type, path, params) { + var deferred = $q.defer(), + el, + loaded, + filesCache = $delegate._getFilesCache(), + cacheBuster = function cacheBuster(url) { + var dc = new Date().getTime(); + if (url.indexOf('?') >= 0) { + if (url.substring(0, url.length - 1) === '&') { + return url + '_dc=' + dc; + } + return url + '&_dc=' + dc; + } else { + return url + '?_dc=' + dc; + } + }; + + // Store the promise early so the file load can be detected by other parallel lazy loads + // (ie: multiple routes on one page) a 'true' value isn't sufficient + // as it causes false positive load results. + if (angular.isUndefined(filesCache.get(path))) { + filesCache.put(path, deferred.promise); + } + + // Switch in case more content types are added later + switch (type) { + case 'css': + el = $window.document.createElement('link'); + el.type = 'text/css'; + el.rel = 'stylesheet'; + el.href = params.cache === false ? cacheBuster(path) : path; + break; + case 'js': + el = $window.document.createElement('script'); + el.src = params.cache === false ? cacheBuster(path) : path; + break; + default: + filesCache.remove(path); + deferred.reject(new Error('Requested type "' + type + '" is not known. Could not inject "' + path + '"')); + break; + } + el.onload = el['onreadystatechange'] = function (e) { + if (el['readyState'] && !/^c|loade/.test(el['readyState']) || loaded) return; + el.onload = el['onreadystatechange'] = null; + loaded = 1; + $delegate._broadcast('ocLazyLoad.fileLoaded', path); + deferred.resolve(); + }; + el.onerror = function () { + filesCache.remove(path); + deferred.reject(new Error('Unable to load ' + path)); + }; + el.async = params.serie ? 0 : 1; + + var insertBeforeElem = anchor.lastChild; + if (params.insertBefore) { + var element = angular.element(angular.isDefined(window.jQuery) ? params.insertBefore : document.querySelector(params.insertBefore)); + if (element && element.length > 0) { + insertBeforeElem = element[0]; + } + } + insertBeforeElem.parentNode.insertBefore(el, insertBeforeElem); + + /* + The event load or readystatechange doesn't fire in: + - iOS < 6 (default mobile browser) + - Android < 4.4 (default mobile browser) + - Safari < 6 (desktop browser) + */ + if (type == 'css') { + if (!uaCssChecked) { + var ua = $window.navigator.userAgent.toLowerCase(); + + // iOS < 6 + if (/iP(hone|od|ad)/.test($window.navigator.platform)) { + var v = $window.navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/); + var iOSVersion = parseFloat([parseInt(v[1], 10), parseInt(v[2], 10), parseInt(v[3] || 0, 10)].join('.')); + useCssLoadPatch = iOSVersion < 6; + } else if (ua.indexOf("android") > -1) { + // Android < 4.4 + var androidVersion = parseFloat(ua.slice(ua.indexOf("android") + 8)); + useCssLoadPatch = androidVersion < 4.4; + } else if (ua.indexOf('safari') > -1) { + var versionMatch = ua.match(/version\/([\.\d]+)/i); + useCssLoadPatch = versionMatch && versionMatch[1] && parseFloat(versionMatch[1]) < 6; + } + } + + if (useCssLoadPatch) { + var tries = 1000; // * 20 = 20000 miliseconds + var interval = $interval(function () { + try { + el.sheet.cssRules; + $interval.cancel(interval); + el.onload(); + } catch (e) { + if (--tries <= 0) { + el.onerror(); + } + } + }, 20); + } + } + + return deferred.promise; + }; + + return $delegate; + }]); + }]); +})(angular); +(function (angular) { + 'use strict'; + + angular.module('oc.lazyLoad').config(["$provide", function ($provide) { + $provide.decorator('$ocLazyLoad', ["$delegate", "$q", function ($delegate, $q) { + /** + * The function that loads new files + * @param config + * @param params + * @returns {*} + */ + $delegate.filesLoader = function filesLoader(config) { + var params = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; + + var cssFiles = [], + templatesFiles = [], + jsFiles = [], + promises = [], + cachePromise = null, + filesCache = $delegate._getFilesCache(); + + $delegate.toggleWatch(true); // start watching angular.module calls + + angular.extend(params, config); + + var pushFile = function pushFile(path) { + var file_type = null, + m; + if (angular.isObject(path)) { + file_type = path.type; + path = path.path; + } + cachePromise = filesCache.get(path); + if (angular.isUndefined(cachePromise) || params.cache === false) { + + // always check for requirejs syntax just in case + if ((m = /^(css|less|html|htm|js)?(?=!)/.exec(path)) !== null) { + // Detect file type using preceding type declaration (ala requireJS) + file_type = m[1]; + path = path.substr(m[1].length + 1, path.length); // Strip the type from the path + } + + if (!file_type) { + if ((m = /[.](css|less|html|htm|js)?((\?|#).*)?$/.exec(path)) !== null) { + // Detect file type via file extension + file_type = m[1]; + } else if (!$delegate.jsLoader.hasOwnProperty('ocLazyLoadLoader') && $delegate.jsLoader.hasOwnProperty('requirejs')) { + // requirejs + file_type = 'js'; + } else { + $delegate._$log.error('File type could not be determined. ' + path); + return; + } + } + + if ((file_type === 'css' || file_type === 'less') && cssFiles.indexOf(path) === -1) { + cssFiles.push(path); + } else if ((file_type === 'html' || file_type === 'htm') && templatesFiles.indexOf(path) === -1) { + templatesFiles.push(path); + } else if (file_type === 'js' || jsFiles.indexOf(path) === -1) { + jsFiles.push(path); + } else { + $delegate._$log.error('File type is not valid. ' + path); + } + } else if (cachePromise) { + promises.push(cachePromise); + } + }; + + if (params.serie) { + pushFile(params.files.shift()); + } else { + angular.forEach(params.files, function (path) { + pushFile(path); + }); + } + + if (cssFiles.length > 0) { + var cssDeferred = $q.defer(); + $delegate.cssLoader(cssFiles, function (err) { + if (angular.isDefined(err) && $delegate.cssLoader.hasOwnProperty('ocLazyLoadLoader')) { + $delegate._$log.error(err); + cssDeferred.reject(err); + } else { + cssDeferred.resolve(); + } + }, params); + promises.push(cssDeferred.promise); + } + + if (templatesFiles.length > 0) { + var templatesDeferred = $q.defer(); + $delegate.templatesLoader(templatesFiles, function (err) { + if (angular.isDefined(err) && $delegate.templatesLoader.hasOwnProperty('ocLazyLoadLoader')) { + $delegate._$log.error(err); + templatesDeferred.reject(err); + } else { + templatesDeferred.resolve(); + } + }, params); + promises.push(templatesDeferred.promise); + } + + if (jsFiles.length > 0) { + var jsDeferred = $q.defer(); + $delegate.jsLoader(jsFiles, function (err) { + if (angular.isDefined(err) && ($delegate.jsLoader.hasOwnProperty("ocLazyLoadLoader") || $delegate.jsLoader.hasOwnProperty("requirejs"))) { + $delegate._$log.error(err); + jsDeferred.reject(err); + } else { + jsDeferred.resolve(); + } + }, params); + promises.push(jsDeferred.promise); + } + + if (promises.length === 0) { + var deferred = $q.defer(), + err = "Error: no file to load has been found, if you're trying to load an existing module you should use the 'inject' method instead of 'load'."; + $delegate._$log.error(err); + deferred.reject(err); + return deferred.promise; + } else if (params.serie && params.files.length > 0) { + return $q.all(promises).then(function () { + return $delegate.filesLoader(config, params); + }); + } else { + return $q.all(promises)['finally'](function (res) { + $delegate.toggleWatch(false); // stop watching angular.module calls + return res; + }); + } + }; + + /** + * Load a module or a list of modules into Angular + * @param module Mixed the name of a predefined module config object, or a module config object, or an array of either + * @param params Object optional parameters + * @returns promise + */ + $delegate.load = function (originalModule) { + var originalParams = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; + + var self = this, + config = null, + deferredList = [], + deferred = $q.defer(), + errText; + + // clean copy + var module = angular.copy(originalModule); + var params = angular.copy(originalParams); + + // If module is an array, break it down + if (angular.isArray(module)) { + // Resubmit each entry as a single module + angular.forEach(module, function (m) { + deferredList.push(self.load(m, params)); + }); + + // Resolve the promise once everything has loaded + $q.all(deferredList).then(function (res) { + deferred.resolve(res); + }, function (err) { + deferred.reject(err); + }); + + return deferred.promise; + } + + // Get or Set a configuration depending on what was passed in + if (angular.isString(module)) { + config = self.getModuleConfig(module); + if (!config) { + config = { + files: [module] + }; + } + } else if (angular.isObject(module)) { + // case {type: 'js', path: lazyLoadUrl + 'testModule.fakejs'} + if (angular.isDefined(module.path) && angular.isDefined(module.type)) { + config = { + files: [module] + }; + } else { + config = self.setModuleConfig(module); + } + } + + if (config === null) { + var moduleName = self._getModuleName(module); + errText = 'Module "' + (moduleName || 'unknown') + '" is not configured, cannot load.'; + $delegate._$log.error(errText); + deferred.reject(new Error(errText)); + return deferred.promise; + } else { + // deprecated + if (angular.isDefined(config.template)) { + if (angular.isUndefined(config.files)) { + config.files = []; + } + if (angular.isString(config.template)) { + config.files.push(config.template); + } else if (angular.isArray(config.template)) { + config.files.concat(config.template); + } + } + } + + var localParams = angular.extend({}, params, config); + + // if someone used an external loader and called the load function with just the module name + if (angular.isUndefined(config.files) && angular.isDefined(config.name) && $delegate.moduleExists(config.name)) { + return $delegate.inject(config.name, localParams, true); + } + + $delegate.filesLoader(config, localParams).then(function () { + $delegate.inject(null, localParams).then(function (res) { + deferred.resolve(res); + }, function (err) { + deferred.reject(err); + }); + }, function (err) { + deferred.reject(err); + }); + + return deferred.promise; + }; + + // return the patched service + return $delegate; + }]); + }]); +})(angular); +(function (angular) { + 'use strict'; + + angular.module('oc.lazyLoad').config(["$provide", function ($provide) { + $provide.decorator('$ocLazyLoad', ["$delegate", "$q", function ($delegate, $q) { + /** + * cssLoader function + * @type Function + * @param paths array list of css files to load + * @param callback to call when everything is loaded. We use a callback and not a promise + * @param params object config parameters + * because the user can overwrite cssLoader and it will probably not use promises :( + */ + $delegate.cssLoader = function (paths, callback, params) { + var promises = []; + angular.forEach(paths, function (path) { + promises.push($delegate.buildElement('css', path, params)); + }); + $q.all(promises).then(function () { + callback(); + }, function (err) { + callback(err); + }); + }; + $delegate.cssLoader.ocLazyLoadLoader = true; + + return $delegate; + }]); + }]); +})(angular); +(function (angular) { + 'use strict'; + + angular.module('oc.lazyLoad').config(["$provide", function ($provide) { + $provide.decorator('$ocLazyLoad', ["$delegate", "$q", function ($delegate, $q) { + /** + * jsLoader function + * @type Function + * @param paths array list of js files to load + * @param callback to call when everything is loaded. We use a callback and not a promise + * @param params object config parameters + * because the user can overwrite jsLoader and it will probably not use promises :( + */ + $delegate.jsLoader = function (paths, callback, params) { + var promises = []; + angular.forEach(paths, function (path) { + promises.push($delegate.buildElement('js', path, params)); + }); + $q.all(promises).then(function () { + callback(); + }, function (err) { + callback(err); + }); + }; + $delegate.jsLoader.ocLazyLoadLoader = true; + + return $delegate; + }]); + }]); +})(angular); +(function (angular) { + 'use strict'; + + angular.module('oc.lazyLoad').config(["$provide", function ($provide) { + $provide.decorator('$ocLazyLoad', ["$delegate", "$templateCache", "$q", "$http", function ($delegate, $templateCache, $q, $http) { + /** + * templatesLoader function + * @type Function + * @param paths array list of css files to load + * @param callback to call when everything is loaded. We use a callback and not a promise + * @param params object config parameters for $http + * because the user can overwrite templatesLoader and it will probably not use promises :( + */ + $delegate.templatesLoader = function (paths, callback, params) { + var promises = [], + filesCache = $delegate._getFilesCache(); + + angular.forEach(paths, function (url) { + var deferred = $q.defer(); + promises.push(deferred.promise); + $http.get(url, params).success(function (data) { + if (angular.isString(data) && data.length > 0) { + angular.forEach(angular.element(data), function (node) { + if (node.nodeName === 'SCRIPT' && node.type === 'text/ng-template') { + $templateCache.put(node.id, node.innerHTML); + } + }); + } + if (angular.isUndefined(filesCache.get(url))) { + filesCache.put(url, true); + } + deferred.resolve(); + }).error(function (err) { + deferred.reject(new Error('Unable to load template file "' + url + '": ' + err)); + }); + }); + return $q.all(promises).then(function () { + callback(); + }, function (err) { + callback(err); + }); + }; + $delegate.templatesLoader.ocLazyLoadLoader = true; + + return $delegate; + }]); + }]); +})(angular); +// Array.indexOf polyfill for IE8 +if (!Array.prototype.indexOf) { + Array.prototype.indexOf = function (searchElement, fromIndex) { + var k; + + // 1. Let O be the result of calling ToObject passing + // the this value as the argument. + if (this == null) { + throw new TypeError('"this" is null or not defined'); + } + + var O = Object(this); + + // 2. Let lenValue be the result of calling the Get + // internal method of O with the argument "length". + // 3. Let len be ToUint32(lenValue). + var len = O.length >>> 0; + + // 4. If len is 0, return -1. + if (len === 0) { + return -1; + } + + // 5. If argument fromIndex was passed let n be + // ToInteger(fromIndex); else let n be 0. + var n = +fromIndex || 0; + + if (Math.abs(n) === Infinity) { + n = 0; + } + + // 6. If n >= len, return -1. + if (n >= len) { + return -1; + } + + // 7. If n >= 0, then Let k be n. + // 8. Else, n<0, Let k be len - abs(n). + // If k is less than 0, then let k be 0. + k = Math.max(n >= 0 ? n : len - Math.abs(n), 0); + + // 9. Repeat, while k < len + while (k < len) { + // a. Let Pk be ToString(k). + // This is implicit for LHS operands of the in operator + // b. Let kPresent be the result of calling the + // HasProperty internal method of O with argument Pk. + // This step can be combined with c + // c. If kPresent is true, then + // i. Let elementK be the result of calling the Get + // internal method of O with the argument ToString(k). + // ii. Let same be the result of applying the + // Strict Equality Comparison Algorithm to + // searchElement and elementK. + // iii. If same is true, return k. + if (k in O && O[k] === searchElement) { + return k; + } + k++; + } + return -1; + }; +} \ No newline at end of file diff --git a/public/bower_components/pdfjs-dist/pdf.js b/public/bower_components/pdfjs-dist/pdf.js new file mode 100644 index 0000000..3822e0c --- /dev/null +++ b/public/bower_components/pdfjs-dist/pdf.js @@ -0,0 +1,8268 @@ +/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */ +/* Copyright 2012 Mozilla Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/*jshint globalstrict: false */ +/* globals PDFJS */ + +// Initializing PDFJS global object (if still undefined) +if (typeof PDFJS === 'undefined') { + (typeof window !== 'undefined' ? window : this).PDFJS = {}; +} + +PDFJS.version = '1.1.551'; +PDFJS.build = '2a5616c'; + +(function pdfjsWrapper() { + // Use strict in our context only - users might not want it + 'use strict'; + + + +var globalScope = (typeof window === 'undefined') ? this : window; + +var isWorker = (typeof window === 'undefined'); + +var FONT_IDENTITY_MATRIX = [0.001, 0, 0, 0.001, 0, 0]; + +var TextRenderingMode = { + FILL: 0, + STROKE: 1, + FILL_STROKE: 2, + INVISIBLE: 3, + FILL_ADD_TO_PATH: 4, + STROKE_ADD_TO_PATH: 5, + FILL_STROKE_ADD_TO_PATH: 6, + ADD_TO_PATH: 7, + FILL_STROKE_MASK: 3, + ADD_TO_PATH_FLAG: 4 +}; + +var ImageKind = { + GRAYSCALE_1BPP: 1, + RGB_24BPP: 2, + RGBA_32BPP: 3 +}; + +var AnnotationType = { + WIDGET: 1, + TEXT: 2, + LINK: 3 +}; + +var AnnotationBorderStyleType = { + SOLID: 1, + DASHED: 2, + BEVELED: 3, + INSET: 4, + UNDERLINE: 5 +}; + +var StreamType = { + UNKNOWN: 0, + FLATE: 1, + LZW: 2, + DCT: 3, + JPX: 4, + JBIG: 5, + A85: 6, + AHX: 7, + CCF: 8, + RL: 9 +}; + +var FontType = { + UNKNOWN: 0, + TYPE1: 1, + TYPE1C: 2, + CIDFONTTYPE0: 3, + CIDFONTTYPE0C: 4, + TRUETYPE: 5, + CIDFONTTYPE2: 6, + TYPE3: 7, + OPENTYPE: 8, + TYPE0: 9, + MMTYPE1: 10 +}; + +// The global PDFJS object exposes the API +// In production, it will be declared outside a global wrapper +// In development, it will be declared here +if (!globalScope.PDFJS) { + globalScope.PDFJS = {}; +} + +globalScope.PDFJS.pdfBug = false; + +PDFJS.VERBOSITY_LEVELS = { + errors: 0, + warnings: 1, + infos: 5 +}; + +// All the possible operations for an operator list. +var OPS = PDFJS.OPS = { + // Intentionally start from 1 so it is easy to spot bad operators that will be + // 0's. + dependency: 1, + setLineWidth: 2, + setLineCap: 3, + setLineJoin: 4, + setMiterLimit: 5, + setDash: 6, + setRenderingIntent: 7, + setFlatness: 8, + setGState: 9, + save: 10, + restore: 11, + transform: 12, + moveTo: 13, + lineTo: 14, + curveTo: 15, + curveTo2: 16, + curveTo3: 17, + closePath: 18, + rectangle: 19, + stroke: 20, + closeStroke: 21, + fill: 22, + eoFill: 23, + fillStroke: 24, + eoFillStroke: 25, + closeFillStroke: 26, + closeEOFillStroke: 27, + endPath: 28, + clip: 29, + eoClip: 30, + beginText: 31, + endText: 32, + setCharSpacing: 33, + setWordSpacing: 34, + setHScale: 35, + setLeading: 36, + setFont: 37, + setTextRenderingMode: 38, + setTextRise: 39, + moveText: 40, + setLeadingMoveText: 41, + setTextMatrix: 42, + nextLine: 43, + showText: 44, + showSpacedText: 45, + nextLineShowText: 46, + nextLineSetSpacingShowText: 47, + setCharWidth: 48, + setCharWidthAndBounds: 49, + setStrokeColorSpace: 50, + setFillColorSpace: 51, + setStrokeColor: 52, + setStrokeColorN: 53, + setFillColor: 54, + setFillColorN: 55, + setStrokeGray: 56, + setFillGray: 57, + setStrokeRGBColor: 58, + setFillRGBColor: 59, + setStrokeCMYKColor: 60, + setFillCMYKColor: 61, + shadingFill: 62, + beginInlineImage: 63, + beginImageData: 64, + endInlineImage: 65, + paintXObject: 66, + markPoint: 67, + markPointProps: 68, + beginMarkedContent: 69, + beginMarkedContentProps: 70, + endMarkedContent: 71, + beginCompat: 72, + endCompat: 73, + paintFormXObjectBegin: 74, + paintFormXObjectEnd: 75, + beginGroup: 76, + endGroup: 77, + beginAnnotations: 78, + endAnnotations: 79, + beginAnnotation: 80, + endAnnotation: 81, + paintJpegXObject: 82, + paintImageMaskXObject: 83, + paintImageMaskXObjectGroup: 84, + paintImageXObject: 85, + paintInlineImageXObject: 86, + paintInlineImageXObjectGroup: 87, + paintImageXObjectRepeat: 88, + paintImageMaskXObjectRepeat: 89, + paintSolidColorImageMask: 90, + constructPath: 91 +}; + +// A notice for devs. These are good for things that are helpful to devs, such +// as warning that Workers were disabled, which is important to devs but not +// end users. +function info(msg) { + if (PDFJS.verbosity >= PDFJS.VERBOSITY_LEVELS.infos) { + console.log('Info: ' + msg); + } +} + +// Non-fatal warnings. +function warn(msg) { + if (PDFJS.verbosity >= PDFJS.VERBOSITY_LEVELS.warnings) { + console.log('Warning: ' + msg); + } +} + +// Deprecated API function -- treated as warnings. +function deprecated(details) { + warn('Deprecated API usage: ' + details); +} + +// Fatal errors that should trigger the fallback UI and halt execution by +// throwing an exception. +function error(msg) { + if (PDFJS.verbosity >= PDFJS.VERBOSITY_LEVELS.errors) { + console.log('Error: ' + msg); + console.log(backtrace()); + } + UnsupportedManager.notify(UNSUPPORTED_FEATURES.unknown); + throw new Error(msg); +} + +function backtrace() { + try { + throw new Error(); + } catch (e) { + return e.stack ? e.stack.split('\n').slice(2).join('\n') : ''; + } +} + +function assert(cond, msg) { + if (!cond) { + error(msg); + } +} + +var UNSUPPORTED_FEATURES = PDFJS.UNSUPPORTED_FEATURES = { + unknown: 'unknown', + forms: 'forms', + javaScript: 'javaScript', + smask: 'smask', + shadingPattern: 'shadingPattern', + font: 'font' +}; + +var UnsupportedManager = PDFJS.UnsupportedManager = + (function UnsupportedManagerClosure() { + var listeners = []; + return { + listen: function (cb) { + listeners.push(cb); + }, + notify: function (featureId) { + warn('Unsupported feature "' + featureId + '"'); + for (var i = 0, ii = listeners.length; i < ii; i++) { + listeners[i](featureId); + } + } + }; +})(); + +// Combines two URLs. The baseUrl shall be absolute URL. If the url is an +// absolute URL, it will be returned as is. +function combineUrl(baseUrl, url) { + if (!url) { + return baseUrl; + } + if (/^[a-z][a-z0-9+\-.]*:/i.test(url)) { + return url; + } + var i; + if (url.charAt(0) === '/') { + // absolute path + i = baseUrl.indexOf('://'); + if (url.charAt(1) === '/') { + ++i; + } else { + i = baseUrl.indexOf('/', i + 3); + } + return baseUrl.substring(0, i) + url; + } else { + // relative path + var pathLength = baseUrl.length; + i = baseUrl.lastIndexOf('#'); + pathLength = i >= 0 ? i : pathLength; + i = baseUrl.lastIndexOf('?', pathLength); + pathLength = i >= 0 ? i : pathLength; + var prefixLength = baseUrl.lastIndexOf('/', pathLength); + return baseUrl.substring(0, prefixLength + 1) + url; + } +} + +// Validates if URL is safe and allowed, e.g. to avoid XSS. +function isValidUrl(url, allowRelative) { + if (!url) { + return false; + } + // RFC 3986 (http://tools.ietf.org/html/rfc3986#section-3.1) + // scheme = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." ) + var protocol = /^[a-z][a-z0-9+\-.]*(?=:)/i.exec(url); + if (!protocol) { + return allowRelative; + } + protocol = protocol[0].toLowerCase(); + switch (protocol) { + case 'http': + case 'https': + case 'ftp': + case 'mailto': + case 'tel': + return true; + default: + return false; + } +} +PDFJS.isValidUrl = isValidUrl; + +function shadow(obj, prop, value) { + Object.defineProperty(obj, prop, { value: value, + enumerable: true, + configurable: true, + writable: false }); + return value; +} +PDFJS.shadow = shadow; + +var LinkTarget = PDFJS.LinkTarget = { + NONE: 0, // Default value. + SELF: 1, + BLANK: 2, + PARENT: 3, + TOP: 4, +}; +var LinkTargetStringMap = [ + '', + '_self', + '_blank', + '_parent', + '_top' +]; + +function isExternalLinkTargetSet() { + if (PDFJS.openExternalLinksInNewWindow) { + warn('PDFJS.openExternalLinksInNewWindow is deprecated, ' + + 'use PDFJS.externalLinkTarget instead.'); + if (PDFJS.externalLinkTarget === LinkTarget.NONE) { + PDFJS.externalLinkTarget = LinkTarget.BLANK; + } + // Reset the deprecated parameter, to suppress further warnings. + PDFJS.openExternalLinksInNewWindow = false; + } + switch (PDFJS.externalLinkTarget) { + case LinkTarget.NONE: + return false; + case LinkTarget.SELF: + case LinkTarget.BLANK: + case LinkTarget.PARENT: + case LinkTarget.TOP: + return true; + } + warn('PDFJS.externalLinkTarget is invalid: ' + PDFJS.externalLinkTarget); + // Reset the external link target, to suppress further warnings. + PDFJS.externalLinkTarget = LinkTarget.NONE; + return false; +} +PDFJS.isExternalLinkTargetSet = isExternalLinkTargetSet; + +var PasswordResponses = PDFJS.PasswordResponses = { + NEED_PASSWORD: 1, + INCORRECT_PASSWORD: 2 +}; + +var PasswordException = (function PasswordExceptionClosure() { + function PasswordException(msg, code) { + this.name = 'PasswordException'; + this.message = msg; + this.code = code; + } + + PasswordException.prototype = new Error(); + PasswordException.constructor = PasswordException; + + return PasswordException; +})(); +PDFJS.PasswordException = PasswordException; + +var UnknownErrorException = (function UnknownErrorExceptionClosure() { + function UnknownErrorException(msg, details) { + this.name = 'UnknownErrorException'; + this.message = msg; + this.details = details; + } + + UnknownErrorException.prototype = new Error(); + UnknownErrorException.constructor = UnknownErrorException; + + return UnknownErrorException; +})(); +PDFJS.UnknownErrorException = UnknownErrorException; + +var InvalidPDFException = (function InvalidPDFExceptionClosure() { + function InvalidPDFException(msg) { + this.name = 'InvalidPDFException'; + this.message = msg; + } + + InvalidPDFException.prototype = new Error(); + InvalidPDFException.constructor = InvalidPDFException; + + return InvalidPDFException; +})(); +PDFJS.InvalidPDFException = InvalidPDFException; + +var MissingPDFException = (function MissingPDFExceptionClosure() { + function MissingPDFException(msg) { + this.name = 'MissingPDFException'; + this.message = msg; + } + + MissingPDFException.prototype = new Error(); + MissingPDFException.constructor = MissingPDFException; + + return MissingPDFException; +})(); +PDFJS.MissingPDFException = MissingPDFException; + +var UnexpectedResponseException = + (function UnexpectedResponseExceptionClosure() { + function UnexpectedResponseException(msg, status) { + this.name = 'UnexpectedResponseException'; + this.message = msg; + this.status = status; + } + + UnexpectedResponseException.prototype = new Error(); + UnexpectedResponseException.constructor = UnexpectedResponseException; + + return UnexpectedResponseException; +})(); +PDFJS.UnexpectedResponseException = UnexpectedResponseException; + +var NotImplementedException = (function NotImplementedExceptionClosure() { + function NotImplementedException(msg) { + this.message = msg; + } + + NotImplementedException.prototype = new Error(); + NotImplementedException.prototype.name = 'NotImplementedException'; + NotImplementedException.constructor = NotImplementedException; + + return NotImplementedException; +})(); + +var MissingDataException = (function MissingDataExceptionClosure() { + function MissingDataException(begin, end) { + this.begin = begin; + this.end = end; + this.message = 'Missing data [' + begin + ', ' + end + ')'; + } + + MissingDataException.prototype = new Error(); + MissingDataException.prototype.name = 'MissingDataException'; + MissingDataException.constructor = MissingDataException; + + return MissingDataException; +})(); + +var XRefParseException = (function XRefParseExceptionClosure() { + function XRefParseException(msg) { + this.message = msg; + } + + XRefParseException.prototype = new Error(); + XRefParseException.prototype.name = 'XRefParseException'; + XRefParseException.constructor = XRefParseException; + + return XRefParseException; +})(); + + +function bytesToString(bytes) { + assert(bytes !== null && typeof bytes === 'object' && + bytes.length !== undefined, 'Invalid argument for bytesToString'); + var length = bytes.length; + var MAX_ARGUMENT_COUNT = 8192; + if (length < MAX_ARGUMENT_COUNT) { + return String.fromCharCode.apply(null, bytes); + } + var strBuf = []; + for (var i = 0; i < length; i += MAX_ARGUMENT_COUNT) { + var chunkEnd = Math.min(i + MAX_ARGUMENT_COUNT, length); + var chunk = bytes.subarray(i, chunkEnd); + strBuf.push(String.fromCharCode.apply(null, chunk)); + } + return strBuf.join(''); +} + +function stringToBytes(str) { + assert(typeof str === 'string', 'Invalid argument for stringToBytes'); + var length = str.length; + var bytes = new Uint8Array(length); + for (var i = 0; i < length; ++i) { + bytes[i] = str.charCodeAt(i) & 0xFF; + } + return bytes; +} + +function string32(value) { + return String.fromCharCode((value >> 24) & 0xff, (value >> 16) & 0xff, + (value >> 8) & 0xff, value & 0xff); +} + +function log2(x) { + var n = 1, i = 0; + while (x > n) { + n <<= 1; + i++; + } + return i; +} + +function readInt8(data, start) { + return (data[start] << 24) >> 24; +} + +function readUint16(data, offset) { + return (data[offset] << 8) | data[offset + 1]; +} + +function readUint32(data, offset) { + return ((data[offset] << 24) | (data[offset + 1] << 16) | + (data[offset + 2] << 8) | data[offset + 3]) >>> 0; +} + +// Lazy test the endianness of the platform +// NOTE: This will be 'true' for simulated TypedArrays +function isLittleEndian() { + var buffer8 = new Uint8Array(2); + buffer8[0] = 1; + var buffer16 = new Uint16Array(buffer8.buffer); + return (buffer16[0] === 1); +} + +Object.defineProperty(PDFJS, 'isLittleEndian', { + configurable: true, + get: function PDFJS_isLittleEndian() { + return shadow(PDFJS, 'isLittleEndian', isLittleEndian()); + } +}); + + // Lazy test if the userAgent support CanvasTypedArrays +function hasCanvasTypedArrays() { + var canvas = document.createElement('canvas'); + canvas.width = canvas.height = 1; + var ctx = canvas.getContext('2d'); + var imageData = ctx.createImageData(1, 1); + return (typeof imageData.data.buffer !== 'undefined'); +} + +Object.defineProperty(PDFJS, 'hasCanvasTypedArrays', { + configurable: true, + get: function PDFJS_hasCanvasTypedArrays() { + return shadow(PDFJS, 'hasCanvasTypedArrays', hasCanvasTypedArrays()); + } +}); + +var Uint32ArrayView = (function Uint32ArrayViewClosure() { + + function Uint32ArrayView(buffer, length) { + this.buffer = buffer; + this.byteLength = buffer.length; + this.length = length === undefined ? (this.byteLength >> 2) : length; + ensureUint32ArrayViewProps(this.length); + } + Uint32ArrayView.prototype = Object.create(null); + + var uint32ArrayViewSetters = 0; + function createUint32ArrayProp(index) { + return { + get: function () { + var buffer = this.buffer, offset = index << 2; + return (buffer[offset] | (buffer[offset + 1] << 8) | + (buffer[offset + 2] << 16) | (buffer[offset + 3] << 24)) >>> 0; + }, + set: function (value) { + var buffer = this.buffer, offset = index << 2; + buffer[offset] = value & 255; + buffer[offset + 1] = (value >> 8) & 255; + buffer[offset + 2] = (value >> 16) & 255; + buffer[offset + 3] = (value >>> 24) & 255; + } + }; + } + + function ensureUint32ArrayViewProps(length) { + while (uint32ArrayViewSetters < length) { + Object.defineProperty(Uint32ArrayView.prototype, + uint32ArrayViewSetters, + createUint32ArrayProp(uint32ArrayViewSetters)); + uint32ArrayViewSetters++; + } + } + + return Uint32ArrayView; +})(); + +var IDENTITY_MATRIX = [1, 0, 0, 1, 0, 0]; + +var Util = PDFJS.Util = (function UtilClosure() { + function Util() {} + + var rgbBuf = ['rgb(', 0, ',', 0, ',', 0, ')']; + + // makeCssRgb() can be called thousands of times. Using |rgbBuf| avoids + // creating many intermediate strings. + Util.makeCssRgb = function Util_makeCssRgb(r, g, b) { + rgbBuf[1] = r; + rgbBuf[3] = g; + rgbBuf[5] = b; + return rgbBuf.join(''); + }; + + // Concatenates two transformation matrices together and returns the result. + Util.transform = function Util_transform(m1, m2) { + return [ + m1[0] * m2[0] + m1[2] * m2[1], + m1[1] * m2[0] + m1[3] * m2[1], + m1[0] * m2[2] + m1[2] * m2[3], + m1[1] * m2[2] + m1[3] * m2[3], + m1[0] * m2[4] + m1[2] * m2[5] + m1[4], + m1[1] * m2[4] + m1[3] * m2[5] + m1[5] + ]; + }; + + // For 2d affine transforms + Util.applyTransform = function Util_applyTransform(p, m) { + var xt = p[0] * m[0] + p[1] * m[2] + m[4]; + var yt = p[0] * m[1] + p[1] * m[3] + m[5]; + return [xt, yt]; + }; + + Util.applyInverseTransform = function Util_applyInverseTransform(p, m) { + var d = m[0] * m[3] - m[1] * m[2]; + var xt = (p[0] * m[3] - p[1] * m[2] + m[2] * m[5] - m[4] * m[3]) / d; + var yt = (-p[0] * m[1] + p[1] * m[0] + m[4] * m[1] - m[5] * m[0]) / d; + return [xt, yt]; + }; + + // Applies the transform to the rectangle and finds the minimum axially + // aligned bounding box. + Util.getAxialAlignedBoundingBox = + function Util_getAxialAlignedBoundingBox(r, m) { + + var p1 = Util.applyTransform(r, m); + var p2 = Util.applyTransform(r.slice(2, 4), m); + var p3 = Util.applyTransform([r[0], r[3]], m); + var p4 = Util.applyTransform([r[2], r[1]], m); + return [ + Math.min(p1[0], p2[0], p3[0], p4[0]), + Math.min(p1[1], p2[1], p3[1], p4[1]), + Math.max(p1[0], p2[0], p3[0], p4[0]), + Math.max(p1[1], p2[1], p3[1], p4[1]) + ]; + }; + + Util.inverseTransform = function Util_inverseTransform(m) { + var d = m[0] * m[3] - m[1] * m[2]; + return [m[3] / d, -m[1] / d, -m[2] / d, m[0] / d, + (m[2] * m[5] - m[4] * m[3]) / d, (m[4] * m[1] - m[5] * m[0]) / d]; + }; + + // Apply a generic 3d matrix M on a 3-vector v: + // | a b c | | X | + // | d e f | x | Y | + // | g h i | | Z | + // M is assumed to be serialized as [a,b,c,d,e,f,g,h,i], + // with v as [X,Y,Z] + Util.apply3dTransform = function Util_apply3dTransform(m, v) { + return [ + m[0] * v[0] + m[1] * v[1] + m[2] * v[2], + m[3] * v[0] + m[4] * v[1] + m[5] * v[2], + m[6] * v[0] + m[7] * v[1] + m[8] * v[2] + ]; + }; + + // This calculation uses Singular Value Decomposition. + // The SVD can be represented with formula A = USV. We are interested in the + // matrix S here because it represents the scale values. + Util.singularValueDecompose2dScale = + function Util_singularValueDecompose2dScale(m) { + + var transpose = [m[0], m[2], m[1], m[3]]; + + // Multiply matrix m with its transpose. + var a = m[0] * transpose[0] + m[1] * transpose[2]; + var b = m[0] * transpose[1] + m[1] * transpose[3]; + var c = m[2] * transpose[0] + m[3] * transpose[2]; + var d = m[2] * transpose[1] + m[3] * transpose[3]; + + // Solve the second degree polynomial to get roots. + var first = (a + d) / 2; + var second = Math.sqrt((a + d) * (a + d) - 4 * (a * d - c * b)) / 2; + var sx = first + second || 1; + var sy = first - second || 1; + + // Scale values are the square roots of the eigenvalues. + return [Math.sqrt(sx), Math.sqrt(sy)]; + }; + + // Normalize rectangle rect=[x1, y1, x2, y2] so that (x1,y1) < (x2,y2) + // For coordinate systems whose origin lies in the bottom-left, this + // means normalization to (BL,TR) ordering. For systems with origin in the + // top-left, this means (TL,BR) ordering. + Util.normalizeRect = function Util_normalizeRect(rect) { + var r = rect.slice(0); // clone rect + if (rect[0] > rect[2]) { + r[0] = rect[2]; + r[2] = rect[0]; + } + if (rect[1] > rect[3]) { + r[1] = rect[3]; + r[3] = rect[1]; + } + return r; + }; + + // Returns a rectangle [x1, y1, x2, y2] corresponding to the + // intersection of rect1 and rect2. If no intersection, returns 'false' + // The rectangle coordinates of rect1, rect2 should be [x1, y1, x2, y2] + Util.intersect = function Util_intersect(rect1, rect2) { + function compare(a, b) { + return a - b; + } + + // Order points along the axes + var orderedX = [rect1[0], rect1[2], rect2[0], rect2[2]].sort(compare), + orderedY = [rect1[1], rect1[3], rect2[1], rect2[3]].sort(compare), + result = []; + + rect1 = Util.normalizeRect(rect1); + rect2 = Util.normalizeRect(rect2); + + // X: first and second points belong to different rectangles? + if ((orderedX[0] === rect1[0] && orderedX[1] === rect2[0]) || + (orderedX[0] === rect2[0] && orderedX[1] === rect1[0])) { + // Intersection must be between second and third points + result[0] = orderedX[1]; + result[2] = orderedX[2]; + } else { + return false; + } + + // Y: first and second points belong to different rectangles? + if ((orderedY[0] === rect1[1] && orderedY[1] === rect2[1]) || + (orderedY[0] === rect2[1] && orderedY[1] === rect1[1])) { + // Intersection must be between second and third points + result[1] = orderedY[1]; + result[3] = orderedY[2]; + } else { + return false; + } + + return result; + }; + + Util.sign = function Util_sign(num) { + return num < 0 ? -1 : 1; + }; + + Util.appendToArray = function Util_appendToArray(arr1, arr2) { + Array.prototype.push.apply(arr1, arr2); + }; + + Util.prependToArray = function Util_prependToArray(arr1, arr2) { + Array.prototype.unshift.apply(arr1, arr2); + }; + + Util.extendObj = function extendObj(obj1, obj2) { + for (var key in obj2) { + obj1[key] = obj2[key]; + } + }; + + Util.getInheritableProperty = function Util_getInheritableProperty(dict, + name) { + while (dict && !dict.has(name)) { + dict = dict.get('Parent'); + } + if (!dict) { + return null; + } + return dict.get(name); + }; + + Util.inherit = function Util_inherit(sub, base, prototype) { + sub.prototype = Object.create(base.prototype); + sub.prototype.constructor = sub; + for (var prop in prototype) { + sub.prototype[prop] = prototype[prop]; + } + }; + + Util.loadScript = function Util_loadScript(src, callback) { + var script = document.createElement('script'); + var loaded = false; + script.setAttribute('src', src); + if (callback) { + script.onload = function() { + if (!loaded) { + callback(); + } + loaded = true; + }; + } + document.getElementsByTagName('head')[0].appendChild(script); + }; + + return Util; +})(); + +/** + * PDF page viewport created based on scale, rotation and offset. + * @class + * @alias PDFJS.PageViewport + */ +var PageViewport = PDFJS.PageViewport = (function PageViewportClosure() { + /** + * @constructor + * @private + * @param viewBox {Array} xMin, yMin, xMax and yMax coordinates. + * @param scale {number} scale of the viewport. + * @param rotation {number} rotations of the viewport in degrees. + * @param offsetX {number} offset X + * @param offsetY {number} offset Y + * @param dontFlip {boolean} if true, axis Y will not be flipped. + */ + function PageViewport(viewBox, scale, rotation, offsetX, offsetY, dontFlip) { + this.viewBox = viewBox; + this.scale = scale; + this.rotation = rotation; + this.offsetX = offsetX; + this.offsetY = offsetY; + + // creating transform to convert pdf coordinate system to the normal + // canvas like coordinates taking in account scale and rotation + var centerX = (viewBox[2] + viewBox[0]) / 2; + var centerY = (viewBox[3] + viewBox[1]) / 2; + var rotateA, rotateB, rotateC, rotateD; + rotation = rotation % 360; + rotation = rotation < 0 ? rotation + 360 : rotation; + switch (rotation) { + case 180: + rotateA = -1; rotateB = 0; rotateC = 0; rotateD = 1; + break; + case 90: + rotateA = 0; rotateB = 1; rotateC = 1; rotateD = 0; + break; + case 270: + rotateA = 0; rotateB = -1; rotateC = -1; rotateD = 0; + break; + //case 0: + default: + rotateA = 1; rotateB = 0; rotateC = 0; rotateD = -1; + break; + } + + if (dontFlip) { + rotateC = -rotateC; rotateD = -rotateD; + } + + var offsetCanvasX, offsetCanvasY; + var width, height; + if (rotateA === 0) { + offsetCanvasX = Math.abs(centerY - viewBox[1]) * scale + offsetX; + offsetCanvasY = Math.abs(centerX - viewBox[0]) * scale + offsetY; + width = Math.abs(viewBox[3] - viewBox[1]) * scale; + height = Math.abs(viewBox[2] - viewBox[0]) * scale; + } else { + offsetCanvasX = Math.abs(centerX - viewBox[0]) * scale + offsetX; + offsetCanvasY = Math.abs(centerY - viewBox[1]) * scale + offsetY; + width = Math.abs(viewBox[2] - viewBox[0]) * scale; + height = Math.abs(viewBox[3] - viewBox[1]) * scale; + } + // creating transform for the following operations: + // translate(-centerX, -centerY), rotate and flip vertically, + // scale, and translate(offsetCanvasX, offsetCanvasY) + this.transform = [ + rotateA * scale, + rotateB * scale, + rotateC * scale, + rotateD * scale, + offsetCanvasX - rotateA * scale * centerX - rotateC * scale * centerY, + offsetCanvasY - rotateB * scale * centerX - rotateD * scale * centerY + ]; + + this.width = width; + this.height = height; + this.fontScale = scale; + } + PageViewport.prototype = /** @lends PDFJS.PageViewport.prototype */ { + /** + * Clones viewport with additional properties. + * @param args {Object} (optional) If specified, may contain the 'scale' or + * 'rotation' properties to override the corresponding properties in + * the cloned viewport. + * @returns {PDFJS.PageViewport} Cloned viewport. + */ + clone: function PageViewPort_clone(args) { + args = args || {}; + var scale = 'scale' in args ? args.scale : this.scale; + var rotation = 'rotation' in args ? args.rotation : this.rotation; + return new PageViewport(this.viewBox.slice(), scale, rotation, + this.offsetX, this.offsetY, args.dontFlip); + }, + /** + * Converts PDF point to the viewport coordinates. For examples, useful for + * converting PDF location into canvas pixel coordinates. + * @param x {number} X coordinate. + * @param y {number} Y coordinate. + * @returns {Object} Object that contains 'x' and 'y' properties of the + * point in the viewport coordinate space. + * @see {@link convertToPdfPoint} + * @see {@link convertToViewportRectangle} + */ + convertToViewportPoint: function PageViewport_convertToViewportPoint(x, y) { + return Util.applyTransform([x, y], this.transform); + }, + /** + * Converts PDF rectangle to the viewport coordinates. + * @param rect {Array} xMin, yMin, xMax and yMax coordinates. + * @returns {Array} Contains corresponding coordinates of the rectangle + * in the viewport coordinate space. + * @see {@link convertToViewportPoint} + */ + convertToViewportRectangle: + function PageViewport_convertToViewportRectangle(rect) { + var tl = Util.applyTransform([rect[0], rect[1]], this.transform); + var br = Util.applyTransform([rect[2], rect[3]], this.transform); + return [tl[0], tl[1], br[0], br[1]]; + }, + /** + * Converts viewport coordinates to the PDF location. For examples, useful + * for converting canvas pixel location into PDF one. + * @param x {number} X coordinate. + * @param y {number} Y coordinate. + * @returns {Object} Object that contains 'x' and 'y' properties of the + * point in the PDF coordinate space. + * @see {@link convertToViewportPoint} + */ + convertToPdfPoint: function PageViewport_convertToPdfPoint(x, y) { + return Util.applyInverseTransform([x, y], this.transform); + } + }; + return PageViewport; +})(); + +var PDFStringTranslateTable = [ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0x2D8, 0x2C7, 0x2C6, 0x2D9, 0x2DD, 0x2DB, 0x2DA, 0x2DC, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x2022, 0x2020, 0x2021, 0x2026, 0x2014, + 0x2013, 0x192, 0x2044, 0x2039, 0x203A, 0x2212, 0x2030, 0x201E, 0x201C, + 0x201D, 0x2018, 0x2019, 0x201A, 0x2122, 0xFB01, 0xFB02, 0x141, 0x152, 0x160, + 0x178, 0x17D, 0x131, 0x142, 0x153, 0x161, 0x17E, 0, 0x20AC +]; + +function stringToPDFString(str) { + var i, n = str.length, strBuf = []; + if (str[0] === '\xFE' && str[1] === '\xFF') { + // UTF16BE BOM + for (i = 2; i < n; i += 2) { + strBuf.push(String.fromCharCode( + (str.charCodeAt(i) << 8) | str.charCodeAt(i + 1))); + } + } else { + for (i = 0; i < n; ++i) { + var code = PDFStringTranslateTable[str.charCodeAt(i)]; + strBuf.push(code ? String.fromCharCode(code) : str.charAt(i)); + } + } + return strBuf.join(''); +} + +function stringToUTF8String(str) { + return decodeURIComponent(escape(str)); +} + +function utf8StringToString(str) { + return unescape(encodeURIComponent(str)); +} + +function isEmptyObj(obj) { + for (var key in obj) { + return false; + } + return true; +} + +function isBool(v) { + return typeof v === 'boolean'; +} + +function isInt(v) { + return typeof v === 'number' && ((v | 0) === v); +} + +function isNum(v) { + return typeof v === 'number'; +} + +function isString(v) { + return typeof v === 'string'; +} + +function isName(v) { + return v instanceof Name; +} + +function isCmd(v, cmd) { + return v instanceof Cmd && (cmd === undefined || v.cmd === cmd); +} + +function isDict(v, type) { + if (!(v instanceof Dict)) { + return false; + } + if (!type) { + return true; + } + var dictType = v.get('Type'); + return isName(dictType) && dictType.name === type; +} + +function isArray(v) { + return v instanceof Array; +} + +function isStream(v) { + return typeof v === 'object' && v !== null && v.getBytes !== undefined; +} + +function isArrayBuffer(v) { + return typeof v === 'object' && v !== null && v.byteLength !== undefined; +} + +function isRef(v) { + return v instanceof Ref; +} + +/** + * Promise Capability object. + * + * @typedef {Object} PromiseCapability + * @property {Promise} promise - A promise object. + * @property {function} resolve - Fullfills the promise. + * @property {function} reject - Rejects the promise. + */ + +/** + * Creates a promise capability object. + * @alias PDFJS.createPromiseCapability + * + * @return {PromiseCapability} A capability object contains: + * - a Promise, resolve and reject methods. + */ +function createPromiseCapability() { + var capability = {}; + capability.promise = new Promise(function (resolve, reject) { + capability.resolve = resolve; + capability.reject = reject; + }); + return capability; +} + +PDFJS.createPromiseCapability = createPromiseCapability; + +/** + * Polyfill for Promises: + * The following promise implementation tries to generally implement the + * Promise/A+ spec. Some notable differences from other promise libaries are: + * - There currently isn't a seperate deferred and promise object. + * - Unhandled rejections eventually show an error if they aren't handled. + * + * Based off of the work in: + * https://bugzilla.mozilla.org/show_bug.cgi?id=810490 + */ +(function PromiseClosure() { + if (globalScope.Promise) { + // Promises existing in the DOM/Worker, checking presence of all/resolve + if (typeof globalScope.Promise.all !== 'function') { + globalScope.Promise.all = function (iterable) { + var count = 0, results = [], resolve, reject; + var promise = new globalScope.Promise(function (resolve_, reject_) { + resolve = resolve_; + reject = reject_; + }); + iterable.forEach(function (p, i) { + count++; + p.then(function (result) { + results[i] = result; + count--; + if (count === 0) { + resolve(results); + } + }, reject); + }); + if (count === 0) { + resolve(results); + } + return promise; + }; + } + if (typeof globalScope.Promise.resolve !== 'function') { + globalScope.Promise.resolve = function (value) { + return new globalScope.Promise(function (resolve) { resolve(value); }); + }; + } + if (typeof globalScope.Promise.reject !== 'function') { + globalScope.Promise.reject = function (reason) { + return new globalScope.Promise(function (resolve, reject) { + reject(reason); + }); + }; + } + if (typeof globalScope.Promise.prototype.catch !== 'function') { + globalScope.Promise.prototype.catch = function (onReject) { + return globalScope.Promise.prototype.then(undefined, onReject); + }; + } + return; + } + var STATUS_PENDING = 0; + var STATUS_RESOLVED = 1; + var STATUS_REJECTED = 2; + + // In an attempt to avoid silent exceptions, unhandled rejections are + // tracked and if they aren't handled in a certain amount of time an + // error is logged. + var REJECTION_TIMEOUT = 500; + + var HandlerManager = { + handlers: [], + running: false, + unhandledRejections: [], + pendingRejectionCheck: false, + + scheduleHandlers: function scheduleHandlers(promise) { + if (promise._status === STATUS_PENDING) { + return; + } + + this.handlers = this.handlers.concat(promise._handlers); + promise._handlers = []; + + if (this.running) { + return; + } + this.running = true; + + setTimeout(this.runHandlers.bind(this), 0); + }, + + runHandlers: function runHandlers() { + var RUN_TIMEOUT = 1; // ms + var timeoutAt = Date.now() + RUN_TIMEOUT; + while (this.handlers.length > 0) { + var handler = this.handlers.shift(); + + var nextStatus = handler.thisPromise._status; + var nextValue = handler.thisPromise._value; + + try { + if (nextStatus === STATUS_RESOLVED) { + if (typeof handler.onResolve === 'function') { + nextValue = handler.onResolve(nextValue); + } + } else if (typeof handler.onReject === 'function') { + nextValue = handler.onReject(nextValue); + nextStatus = STATUS_RESOLVED; + + if (handler.thisPromise._unhandledRejection) { + this.removeUnhandeledRejection(handler.thisPromise); + } + } + } catch (ex) { + nextStatus = STATUS_REJECTED; + nextValue = ex; + } + + handler.nextPromise._updateStatus(nextStatus, nextValue); + if (Date.now() >= timeoutAt) { + break; + } + } + + if (this.handlers.length > 0) { + setTimeout(this.runHandlers.bind(this), 0); + return; + } + + this.running = false; + }, + + addUnhandledRejection: function addUnhandledRejection(promise) { + this.unhandledRejections.push({ + promise: promise, + time: Date.now() + }); + this.scheduleRejectionCheck(); + }, + + removeUnhandeledRejection: function removeUnhandeledRejection(promise) { + promise._unhandledRejection = false; + for (var i = 0; i < this.unhandledRejections.length; i++) { + if (this.unhandledRejections[i].promise === promise) { + this.unhandledRejections.splice(i); + i--; + } + } + }, + + scheduleRejectionCheck: function scheduleRejectionCheck() { + if (this.pendingRejectionCheck) { + return; + } + this.pendingRejectionCheck = true; + setTimeout(function rejectionCheck() { + this.pendingRejectionCheck = false; + var now = Date.now(); + for (var i = 0; i < this.unhandledRejections.length; i++) { + if (now - this.unhandledRejections[i].time > REJECTION_TIMEOUT) { + var unhandled = this.unhandledRejections[i].promise._value; + var msg = 'Unhandled rejection: ' + unhandled; + if (unhandled.stack) { + msg += '\n' + unhandled.stack; + } + warn(msg); + this.unhandledRejections.splice(i); + i--; + } + } + if (this.unhandledRejections.length) { + this.scheduleRejectionCheck(); + } + }.bind(this), REJECTION_TIMEOUT); + } + }; + + function Promise(resolver) { + this._status = STATUS_PENDING; + this._handlers = []; + try { + resolver.call(this, this._resolve.bind(this), this._reject.bind(this)); + } catch (e) { + this._reject(e); + } + } + /** + * Builds a promise that is resolved when all the passed in promises are + * resolved. + * @param {array} array of data and/or promises to wait for. + * @return {Promise} New dependant promise. + */ + Promise.all = function Promise_all(promises) { + var resolveAll, rejectAll; + var deferred = new Promise(function (resolve, reject) { + resolveAll = resolve; + rejectAll = reject; + }); + var unresolved = promises.length; + var results = []; + if (unresolved === 0) { + resolveAll(results); + return deferred; + } + function reject(reason) { + if (deferred._status === STATUS_REJECTED) { + return; + } + results = []; + rejectAll(reason); + } + for (var i = 0, ii = promises.length; i < ii; ++i) { + var promise = promises[i]; + var resolve = (function(i) { + return function(value) { + if (deferred._status === STATUS_REJECTED) { + return; + } + results[i] = value; + unresolved--; + if (unresolved === 0) { + resolveAll(results); + } + }; + })(i); + if (Promise.isPromise(promise)) { + promise.then(resolve, reject); + } else { + resolve(promise); + } + } + return deferred; + }; + + /** + * Checks if the value is likely a promise (has a 'then' function). + * @return {boolean} true if value is thenable + */ + Promise.isPromise = function Promise_isPromise(value) { + return value && typeof value.then === 'function'; + }; + + /** + * Creates resolved promise + * @param value resolve value + * @returns {Promise} + */ + Promise.resolve = function Promise_resolve(value) { + return new Promise(function (resolve) { resolve(value); }); + }; + + /** + * Creates rejected promise + * @param reason rejection value + * @returns {Promise} + */ + Promise.reject = function Promise_reject(reason) { + return new Promise(function (resolve, reject) { reject(reason); }); + }; + + Promise.prototype = { + _status: null, + _value: null, + _handlers: null, + _unhandledRejection: null, + + _updateStatus: function Promise__updateStatus(status, value) { + if (this._status === STATUS_RESOLVED || + this._status === STATUS_REJECTED) { + return; + } + + if (status === STATUS_RESOLVED && + Promise.isPromise(value)) { + value.then(this._updateStatus.bind(this, STATUS_RESOLVED), + this._updateStatus.bind(this, STATUS_REJECTED)); + return; + } + + this._status = status; + this._value = value; + + if (status === STATUS_REJECTED && this._handlers.length === 0) { + this._unhandledRejection = true; + HandlerManager.addUnhandledRejection(this); + } + + HandlerManager.scheduleHandlers(this); + }, + + _resolve: function Promise_resolve(value) { + this._updateStatus(STATUS_RESOLVED, value); + }, + + _reject: function Promise_reject(reason) { + this._updateStatus(STATUS_REJECTED, reason); + }, + + then: function Promise_then(onResolve, onReject) { + var nextPromise = new Promise(function (resolve, reject) { + this.resolve = resolve; + this.reject = reject; + }); + this._handlers.push({ + thisPromise: this, + onResolve: onResolve, + onReject: onReject, + nextPromise: nextPromise + }); + HandlerManager.scheduleHandlers(this); + return nextPromise; + }, + + catch: function Promise_catch(onReject) { + return this.then(undefined, onReject); + } + }; + + globalScope.Promise = Promise; +})(); + +var StatTimer = (function StatTimerClosure() { + function rpad(str, pad, length) { + while (str.length < length) { + str += pad; + } + return str; + } + function StatTimer() { + this.started = {}; + this.times = []; + this.enabled = true; + } + StatTimer.prototype = { + time: function StatTimer_time(name) { + if (!this.enabled) { + return; + } + if (name in this.started) { + warn('Timer is already running for ' + name); + } + this.started[name] = Date.now(); + }, + timeEnd: function StatTimer_timeEnd(name) { + if (!this.enabled) { + return; + } + if (!(name in this.started)) { + warn('Timer has not been started for ' + name); + } + this.times.push({ + 'name': name, + 'start': this.started[name], + 'end': Date.now() + }); + // Remove timer from started so it can be called again. + delete this.started[name]; + }, + toString: function StatTimer_toString() { + var i, ii; + var times = this.times; + var out = ''; + // Find the longest name for padding purposes. + var longest = 0; + for (i = 0, ii = times.length; i < ii; ++i) { + var name = times[i]['name']; + if (name.length > longest) { + longest = name.length; + } + } + for (i = 0, ii = times.length; i < ii; ++i) { + var span = times[i]; + var duration = span.end - span.start; + out += rpad(span['name'], ' ', longest) + ' ' + duration + 'ms\n'; + } + return out; + } + }; + return StatTimer; +})(); + +PDFJS.createBlob = function createBlob(data, contentType) { + if (typeof Blob !== 'undefined') { + return new Blob([data], { type: contentType }); + } + // Blob builder is deprecated in FF14 and removed in FF18. + var bb = new MozBlobBuilder(); + bb.append(data); + return bb.getBlob(contentType); +}; + +PDFJS.createObjectURL = (function createObjectURLClosure() { + // Blob/createObjectURL is not available, falling back to data schema. + var digits = + 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='; + + return function createObjectURL(data, contentType) { + if (!PDFJS.disableCreateObjectURL && + typeof URL !== 'undefined' && URL.createObjectURL) { + var blob = PDFJS.createBlob(data, contentType); + return URL.createObjectURL(blob); + } + + var buffer = 'data:' + contentType + ';base64,'; + for (var i = 0, ii = data.length; i < ii; i += 3) { + var b1 = data[i] & 0xFF; + var b2 = data[i + 1] & 0xFF; + var b3 = data[i + 2] & 0xFF; + var d1 = b1 >> 2, d2 = ((b1 & 3) << 4) | (b2 >> 4); + var d3 = i + 1 < ii ? ((b2 & 0xF) << 2) | (b3 >> 6) : 64; + var d4 = i + 2 < ii ? (b3 & 0x3F) : 64; + buffer += digits[d1] + digits[d2] + digits[d3] + digits[d4]; + } + return buffer; + }; +})(); + +function MessageHandler(name, comObj) { + this.name = name; + this.comObj = comObj; + this.callbackIndex = 1; + this.postMessageTransfers = true; + var callbacksCapabilities = this.callbacksCapabilities = {}; + var ah = this.actionHandler = {}; + + ah['console_log'] = [function ahConsoleLog(data) { + console.log.apply(console, data); + }]; + ah['console_error'] = [function ahConsoleError(data) { + console.error.apply(console, data); + }]; + ah['_unsupported_feature'] = [function ah_unsupportedFeature(data) { + UnsupportedManager.notify(data); + }]; + + comObj.onmessage = function messageHandlerComObjOnMessage(event) { + var data = event.data; + if (data.isReply) { + var callbackId = data.callbackId; + if (data.callbackId in callbacksCapabilities) { + var callback = callbacksCapabilities[callbackId]; + delete callbacksCapabilities[callbackId]; + if ('error' in data) { + callback.reject(data.error); + } else { + callback.resolve(data.data); + } + } else { + error('Cannot resolve callback ' + callbackId); + } + } else if (data.action in ah) { + var action = ah[data.action]; + if (data.callbackId) { + Promise.resolve().then(function () { + return action[0].call(action[1], data.data); + }).then(function (result) { + comObj.postMessage({ + isReply: true, + callbackId: data.callbackId, + data: result + }); + }, function (reason) { + if (reason instanceof Error) { + // Serialize error to avoid "DataCloneError" + reason = reason + ''; + } + comObj.postMessage({ + isReply: true, + callbackId: data.callbackId, + error: reason + }); + }); + } else { + action[0].call(action[1], data.data); + } + } else { + error('Unknown action from worker: ' + data.action); + } + }; +} + +MessageHandler.prototype = { + on: function messageHandlerOn(actionName, handler, scope) { + var ah = this.actionHandler; + if (ah[actionName]) { + error('There is already an actionName called "' + actionName + '"'); + } + ah[actionName] = [handler, scope]; + }, + /** + * Sends a message to the comObj to invoke the action with the supplied data. + * @param {String} actionName Action to call. + * @param {JSON} data JSON data to send. + * @param {Array} [transfers] Optional list of transfers/ArrayBuffers + */ + send: function messageHandlerSend(actionName, data, transfers) { + var message = { + action: actionName, + data: data + }; + this.postMessage(message, transfers); + }, + /** + * Sends a message to the comObj to invoke the action with the supplied data. + * Expects that other side will callback with the response. + * @param {String} actionName Action to call. + * @param {JSON} data JSON data to send. + * @param {Array} [transfers] Optional list of transfers/ArrayBuffers. + * @returns {Promise} Promise to be resolved with response data. + */ + sendWithPromise: + function messageHandlerSendWithPromise(actionName, data, transfers) { + var callbackId = this.callbackIndex++; + var message = { + action: actionName, + data: data, + callbackId: callbackId + }; + var capability = createPromiseCapability(); + this.callbacksCapabilities[callbackId] = capability; + try { + this.postMessage(message, transfers); + } catch (e) { + capability.reject(e); + } + return capability.promise; + }, + /** + * Sends raw message to the comObj. + * @private + * @param message {Object} Raw message. + * @param transfers List of transfers/ArrayBuffers, or undefined. + */ + postMessage: function (message, transfers) { + if (transfers && this.postMessageTransfers) { + this.comObj.postMessage(message, transfers); + } else { + this.comObj.postMessage(message); + } + } +}; + +function loadJpegStream(id, imageUrl, objs) { + var img = new Image(); + img.onload = (function loadJpegStream_onloadClosure() { + objs.resolve(id, img); + }); + img.onerror = (function loadJpegStream_onerrorClosure() { + objs.resolve(id, null); + warn('Error during JPEG image loading'); + }); + img.src = imageUrl; +} + + +/** + * The maximum allowed image size in total pixels e.g. width * height. Images + * above this value will not be drawn. Use -1 for no limit. + * @var {number} + */ +PDFJS.maxImageSize = (PDFJS.maxImageSize === undefined ? + -1 : PDFJS.maxImageSize); + +/** + * The url of where the predefined Adobe CMaps are located. Include trailing + * slash. + * @var {string} + */ +PDFJS.cMapUrl = (PDFJS.cMapUrl === undefined ? null : PDFJS.cMapUrl); + +/** + * Specifies if CMaps are binary packed. + * @var {boolean} + */ +PDFJS.cMapPacked = PDFJS.cMapPacked === undefined ? false : PDFJS.cMapPacked; + +/** + * By default fonts are converted to OpenType fonts and loaded via font face + * rules. If disabled, the font will be rendered using a built in font renderer + * that constructs the glyphs with primitive path commands. + * @var {boolean} + */ +PDFJS.disableFontFace = (PDFJS.disableFontFace === undefined ? + false : PDFJS.disableFontFace); + +/** + * Path for image resources, mainly for annotation icons. Include trailing + * slash. + * @var {string} + */ +PDFJS.imageResourcesPath = (PDFJS.imageResourcesPath === undefined ? + '' : PDFJS.imageResourcesPath); + +/** + * Disable the web worker and run all code on the main thread. This will happen + * automatically if the browser doesn't support workers or sending typed arrays + * to workers. + * @var {boolean} + */ +PDFJS.disableWorker = (PDFJS.disableWorker === undefined ? + false : PDFJS.disableWorker); + +/** + * Path and filename of the worker file. Required when the worker is enabled in + * development mode. If unspecified in the production build, the worker will be + * loaded based on the location of the pdf.js file. + * @var {string} + */ +PDFJS.workerSrc = (PDFJS.workerSrc === undefined ? null : PDFJS.workerSrc); + +/** + * Disable range request loading of PDF files. When enabled and if the server + * supports partial content requests then the PDF will be fetched in chunks. + * Enabled (false) by default. + * @var {boolean} + */ +PDFJS.disableRange = (PDFJS.disableRange === undefined ? + false : PDFJS.disableRange); + +/** + * Disable streaming of PDF file data. By default PDF.js attempts to load PDF + * in chunks. This default behavior can be disabled. + * @var {boolean} + */ +PDFJS.disableStream = (PDFJS.disableStream === undefined ? + false : PDFJS.disableStream); + +/** + * Disable pre-fetching of PDF file data. When range requests are enabled PDF.js + * will automatically keep fetching more data even if it isn't needed to display + * the current page. This default behavior can be disabled. + * + * NOTE: It is also necessary to disable streaming, see above, + * in order for disabling of pre-fetching to work correctly. + * @var {boolean} + */ +PDFJS.disableAutoFetch = (PDFJS.disableAutoFetch === undefined ? + false : PDFJS.disableAutoFetch); + +/** + * Enables special hooks for debugging PDF.js. + * @var {boolean} + */ +PDFJS.pdfBug = (PDFJS.pdfBug === undefined ? false : PDFJS.pdfBug); + +/** + * Enables transfer usage in postMessage for ArrayBuffers. + * @var {boolean} + */ +PDFJS.postMessageTransfers = (PDFJS.postMessageTransfers === undefined ? + true : PDFJS.postMessageTransfers); + +/** + * Disables URL.createObjectURL usage. + * @var {boolean} + */ +PDFJS.disableCreateObjectURL = (PDFJS.disableCreateObjectURL === undefined ? + false : PDFJS.disableCreateObjectURL); + +/** + * Disables WebGL usage. + * @var {boolean} + */ +PDFJS.disableWebGL = (PDFJS.disableWebGL === undefined ? + true : PDFJS.disableWebGL); + +/** + * Disables fullscreen support, and by extension Presentation Mode, + * in browsers which support the fullscreen API. + * @var {boolean} + */ +PDFJS.disableFullscreen = (PDFJS.disableFullscreen === undefined ? + false : PDFJS.disableFullscreen); + +/** + * Enables CSS only zooming. + * @var {boolean} + */ +PDFJS.useOnlyCssZoom = (PDFJS.useOnlyCssZoom === undefined ? + false : PDFJS.useOnlyCssZoom); + +/** + * Controls the logging level. + * The constants from PDFJS.VERBOSITY_LEVELS should be used: + * - errors + * - warnings [default] + * - infos + * @var {number} + */ +PDFJS.verbosity = (PDFJS.verbosity === undefined ? + PDFJS.VERBOSITY_LEVELS.warnings : PDFJS.verbosity); + +/** + * The maximum supported canvas size in total pixels e.g. width * height. + * The default value is 4096 * 4096. Use -1 for no limit. + * @var {number} + */ +PDFJS.maxCanvasPixels = (PDFJS.maxCanvasPixels === undefined ? + 16777216 : PDFJS.maxCanvasPixels); + +/** + * (Deprecated) Opens external links in a new window if enabled. + * The default behavior opens external links in the PDF.js window. + * @var {boolean} + */ +PDFJS.openExternalLinksInNewWindow = ( + PDFJS.openExternalLinksInNewWindow === undefined ? + false : PDFJS.openExternalLinksInNewWindow); + +/** + * Specifies the |target| attribute for external links. + * The constants from PDFJS.LinkTarget should be used: + * - NONE [default] + * - SELF + * - BLANK + * - PARENT + * - TOP + * @var {number} + */ +PDFJS.externalLinkTarget = (PDFJS.externalLinkTarget === undefined ? + PDFJS.LinkTarget.NONE : PDFJS.externalLinkTarget); + +/** + * Determines if we can eval strings as JS. Primarily used to improve + * performance for font rendering. + * @var {boolean} + */ +PDFJS.isEvalSupported = (PDFJS.isEvalSupported === undefined ? + true : PDFJS.isEvalSupported); + +/** + * Document initialization / loading parameters object. + * + * @typedef {Object} DocumentInitParameters + * @property {string} url - The URL of the PDF. + * @property {TypedArray|Array|string} data - Binary PDF data. Use typed arrays + * (Uint8Array) to improve the memory usage. If PDF data is BASE64-encoded, + * use atob() to convert it to a binary string first. + * @property {Object} httpHeaders - Basic authentication headers. + * @property {boolean} withCredentials - Indicates whether or not cross-site + * Access-Control requests should be made using credentials such as cookies + * or authorization headers. The default is false. + * @property {string} password - For decrypting password-protected PDFs. + * @property {TypedArray} initialData - A typed array with the first portion or + * all of the pdf data. Used by the extension since some data is already + * loaded before the switch to range requests. + * @property {number} length - The PDF file length. It's used for progress + * reports and range requests operations. + * @property {PDFDataRangeTransport} range + */ + +/** + * @typedef {Object} PDFDocumentStats + * @property {Array} streamTypes - Used stream types in the document (an item + * is set to true if specific stream ID was used in the document). + * @property {Array} fontTypes - Used font type in the document (an item is set + * to true if specific font ID was used in the document). + */ + +/** + * This is the main entry point for loading a PDF and interacting with it. + * NOTE: If a URL is used to fetch the PDF data a standard XMLHttpRequest(XHR) + * is used, which means it must follow the same origin rules that any XHR does + * e.g. No cross domain requests without CORS. + * + * @param {string|TypedArray|DocumentInitParameters|PDFDataRangeTransport} src + * Can be a url to where a PDF is located, a typed array (Uint8Array) + * already populated with data or parameter object. + * + * @param {PDFDataRangeTransport} pdfDataRangeTransport (deprecated) It is used + * if you want to manually serve range requests for data in the PDF. + * + * @param {function} passwordCallback (deprecated) It is used to request a + * password if wrong or no password was provided. The callback receives two + * parameters: function that needs to be called with new password and reason + * (see {PasswordResponses}). + * + * @param {function} progressCallback (deprecated) It is used to be able to + * monitor the loading progress of the PDF file (necessary to implement e.g. + * a loading bar). The callback receives an {Object} with the properties: + * {number} loaded and {number} total. + * + * @return {PDFDocumentLoadingTask} + */ +PDFJS.getDocument = function getDocument(src, + pdfDataRangeTransport, + passwordCallback, + progressCallback) { + var task = new PDFDocumentLoadingTask(); + + // Support of the obsolete arguments (for compatibility with API v1.0) + if (arguments.length > 1) { + deprecated('getDocument is called with pdfDataRangeTransport, ' + + 'passwordCallback or progressCallback argument'); + } + if (pdfDataRangeTransport) { + if (!(pdfDataRangeTransport instanceof PDFDataRangeTransport)) { + // Not a PDFDataRangeTransport instance, trying to add missing properties. + pdfDataRangeTransport = Object.create(pdfDataRangeTransport); + pdfDataRangeTransport.length = src.length; + pdfDataRangeTransport.initialData = src.initialData; + if (!pdfDataRangeTransport.abort) { + pdfDataRangeTransport.abort = function () {}; + } + } + src = Object.create(src); + src.range = pdfDataRangeTransport; + } + task.onPassword = passwordCallback || null; + task.onProgress = progressCallback || null; + + var workerInitializedCapability, transport; + var source; + if (typeof src === 'string') { + source = { url: src }; + } else if (isArrayBuffer(src)) { + source = { data: src }; + } else if (src instanceof PDFDataRangeTransport) { + source = { range: src }; + } else { + if (typeof src !== 'object') { + error('Invalid parameter in getDocument, need either Uint8Array, ' + + 'string or a parameter object'); + } + if (!src.url && !src.data && !src.range) { + error('Invalid parameter object: need either .data, .range or .url'); + } + + source = src; + } + + var params = {}; + for (var key in source) { + if (key === 'url' && typeof window !== 'undefined') { + // The full path is required in the 'url' field. + params[key] = combineUrl(window.location.href, source[key]); + continue; + } else if (key === 'range') { + continue; + } else if (key === 'data' && !(source[key] instanceof Uint8Array)) { + // Converting string or array-like data to Uint8Array. + var pdfBytes = source[key]; + if (typeof pdfBytes === 'string') { + params[key] = stringToBytes(pdfBytes); + } else if (typeof pdfBytes === 'object' && pdfBytes !== null && + !isNaN(pdfBytes.length)) { + params[key] = new Uint8Array(pdfBytes); + } else if (isArrayBuffer(pdfBytes)) { + params[key] = new Uint8Array(pdfBytes); + } else { + error('Invalid PDF binary data: either typed array, string or ' + + 'array-like object is expected in the data property.'); + } + continue; + } + params[key] = source[key]; + } + + workerInitializedCapability = createPromiseCapability(); + transport = new WorkerTransport(workerInitializedCapability, source.range); + workerInitializedCapability.promise.then(function transportInitialized() { + transport.fetchDocument(task, params); + }); + task._transport = transport; + + return task; +}; + +/** + * PDF document loading operation. + * @class + */ +var PDFDocumentLoadingTask = (function PDFDocumentLoadingTaskClosure() { + /** @constructs PDFDocumentLoadingTask */ + function PDFDocumentLoadingTask() { + this._capability = createPromiseCapability(); + this._transport = null; + + /** + * Callback to request a password if wrong or no password was provided. + * The callback receives two parameters: function that needs to be called + * with new password and reason (see {PasswordResponses}). + */ + this.onPassword = null; + + /** + * Callback to be able to monitor the loading progress of the PDF file + * (necessary to implement e.g. a loading bar). The callback receives + * an {Object} with the properties: {number} loaded and {number} total. + */ + this.onProgress = null; + } + + PDFDocumentLoadingTask.prototype = + /** @lends PDFDocumentLoadingTask.prototype */ { + /** + * @return {Promise} + */ + get promise() { + return this._capability.promise; + }, + + /** + * Aborts all network requests and destroys worker. + * @return {Promise} A promise that is resolved after destruction activity + * is completed. + */ + destroy: function () { + return this._transport.destroy(); + }, + + /** + * Registers callbacks to indicate the document loading completion. + * + * @param {function} onFulfilled The callback for the loading completion. + * @param {function} onRejected The callback for the loading failure. + * @return {Promise} A promise that is resolved after the onFulfilled or + * onRejected callback. + */ + then: function PDFDocumentLoadingTask_then(onFulfilled, onRejected) { + return this.promise.then.apply(this.promise, arguments); + } + }; + + return PDFDocumentLoadingTask; +})(); + +/** + * Abstract class to support range requests file loading. + * @class + */ +var PDFDataRangeTransport = (function pdfDataRangeTransportClosure() { + /** + * @constructs PDFDataRangeTransport + * @param {number} length + * @param {Uint8Array} initialData + */ + function PDFDataRangeTransport(length, initialData) { + this.length = length; + this.initialData = initialData; + + this._rangeListeners = []; + this._progressListeners = []; + this._progressiveReadListeners = []; + this._readyCapability = createPromiseCapability(); + } + PDFDataRangeTransport.prototype = + /** @lends PDFDataRangeTransport.prototype */ { + addRangeListener: + function PDFDataRangeTransport_addRangeListener(listener) { + this._rangeListeners.push(listener); + }, + + addProgressListener: + function PDFDataRangeTransport_addProgressListener(listener) { + this._progressListeners.push(listener); + }, + + addProgressiveReadListener: + function PDFDataRangeTransport_addProgressiveReadListener(listener) { + this._progressiveReadListeners.push(listener); + }, + + onDataRange: function PDFDataRangeTransport_onDataRange(begin, chunk) { + var listeners = this._rangeListeners; + for (var i = 0, n = listeners.length; i < n; ++i) { + listeners[i](begin, chunk); + } + }, + + onDataProgress: function PDFDataRangeTransport_onDataProgress(loaded) { + this._readyCapability.promise.then(function () { + var listeners = this._progressListeners; + for (var i = 0, n = listeners.length; i < n; ++i) { + listeners[i](loaded); + } + }.bind(this)); + }, + + onDataProgressiveRead: + function PDFDataRangeTransport_onDataProgress(chunk) { + this._readyCapability.promise.then(function () { + var listeners = this._progressiveReadListeners; + for (var i = 0, n = listeners.length; i < n; ++i) { + listeners[i](chunk); + } + }.bind(this)); + }, + + transportReady: function PDFDataRangeTransport_transportReady() { + this._readyCapability.resolve(); + }, + + requestDataRange: + function PDFDataRangeTransport_requestDataRange(begin, end) { + throw new Error('Abstract method PDFDataRangeTransport.requestDataRange'); + }, + + abort: function PDFDataRangeTransport_abort() { + } + }; + return PDFDataRangeTransport; +})(); + +PDFJS.PDFDataRangeTransport = PDFDataRangeTransport; + +/** + * Proxy to a PDFDocument in the worker thread. Also, contains commonly used + * properties that can be read synchronously. + * @class + */ +var PDFDocumentProxy = (function PDFDocumentProxyClosure() { + function PDFDocumentProxy(pdfInfo, transport, loadingTask) { + this.pdfInfo = pdfInfo; + this.transport = transport; + this.loadingTask = loadingTask; + } + PDFDocumentProxy.prototype = /** @lends PDFDocumentProxy.prototype */ { + /** + * @return {number} Total number of pages the PDF contains. + */ + get numPages() { + return this.pdfInfo.numPages; + }, + /** + * @return {string} A unique ID to identify a PDF. Not guaranteed to be + * unique. + */ + get fingerprint() { + return this.pdfInfo.fingerprint; + }, + /** + * @param {number} pageNumber The page number to get. The first page is 1. + * @return {Promise} A promise that is resolved with a {@link PDFPageProxy} + * object. + */ + getPage: function PDFDocumentProxy_getPage(pageNumber) { + return this.transport.getPage(pageNumber); + }, + /** + * @param {{num: number, gen: number}} ref The page reference. Must have + * the 'num' and 'gen' properties. + * @return {Promise} A promise that is resolved with the page index that is + * associated with the reference. + */ + getPageIndex: function PDFDocumentProxy_getPageIndex(ref) { + return this.transport.getPageIndex(ref); + }, + /** + * @return {Promise} A promise that is resolved with a lookup table for + * mapping named destinations to reference numbers. + * + * This can be slow for large documents: use getDestination instead + */ + getDestinations: function PDFDocumentProxy_getDestinations() { + return this.transport.getDestinations(); + }, + /** + * @param {string} id The named destination to get. + * @return {Promise} A promise that is resolved with all information + * of the given named destination. + */ + getDestination: function PDFDocumentProxy_getDestination(id) { + return this.transport.getDestination(id); + }, + /** + * @return {Promise} A promise that is resolved with a lookup table for + * mapping named attachments to their content. + */ + getAttachments: function PDFDocumentProxy_getAttachments() { + return this.transport.getAttachments(); + }, + /** + * @return {Promise} A promise that is resolved with an array of all the + * JavaScript strings in the name tree. + */ + getJavaScript: function PDFDocumentProxy_getJavaScript() { + return this.transport.getJavaScript(); + }, + /** + * @return {Promise} A promise that is resolved with an {Array} that is a + * tree outline (if it has one) of the PDF. The tree is in the format of: + * [ + * { + * title: string, + * bold: boolean, + * italic: boolean, + * color: rgb array, + * dest: dest obj, + * items: array of more items like this + * }, + * ... + * ]. + */ + getOutline: function PDFDocumentProxy_getOutline() { + return this.transport.getOutline(); + }, + /** + * @return {Promise} A promise that is resolved with an {Object} that has + * info and metadata properties. Info is an {Object} filled with anything + * available in the information dictionary and similarly metadata is a + * {Metadata} object with information from the metadata section of the PDF. + */ + getMetadata: function PDFDocumentProxy_getMetadata() { + return this.transport.getMetadata(); + }, + /** + * @return {Promise} A promise that is resolved with a TypedArray that has + * the raw data from the PDF. + */ + getData: function PDFDocumentProxy_getData() { + return this.transport.getData(); + }, + /** + * @return {Promise} A promise that is resolved when the document's data + * is loaded. It is resolved with an {Object} that contains the length + * property that indicates size of the PDF data in bytes. + */ + getDownloadInfo: function PDFDocumentProxy_getDownloadInfo() { + return this.transport.downloadInfoCapability.promise; + }, + /** + * @return {Promise} A promise this is resolved with current stats about + * document structures (see {@link PDFDocumentStats}). + */ + getStats: function PDFDocumentProxy_getStats() { + return this.transport.getStats(); + }, + /** + * Cleans up resources allocated by the document, e.g. created @font-face. + */ + cleanup: function PDFDocumentProxy_cleanup() { + this.transport.startCleanup(); + }, + /** + * Destroys current document instance and terminates worker. + */ + destroy: function PDFDocumentProxy_destroy() { + return this.transport.destroy(); + } + }; + return PDFDocumentProxy; +})(); + +/** + * Page text content. + * + * @typedef {Object} TextContent + * @property {array} items - array of {@link TextItem} + * @property {Object} styles - {@link TextStyles} objects, indexed by font + * name. + */ + +/** + * Page text content part. + * + * @typedef {Object} TextItem + * @property {string} str - text content. + * @property {string} dir - text direction: 'ttb', 'ltr' or 'rtl'. + * @property {array} transform - transformation matrix. + * @property {number} width - width in device space. + * @property {number} height - height in device space. + * @property {string} fontName - font name used by pdf.js for converted font. + */ + +/** + * Text style. + * + * @typedef {Object} TextStyle + * @property {number} ascent - font ascent. + * @property {number} descent - font descent. + * @property {boolean} vertical - text is in vertical mode. + * @property {string} fontFamily - possible font family + */ + +/** + * Page render parameters. + * + * @typedef {Object} RenderParameters + * @property {Object} canvasContext - A 2D context of a DOM Canvas object. + * @property {PDFJS.PageViewport} viewport - Rendering viewport obtained by + * calling of PDFPage.getViewport method. + * @property {string} intent - Rendering intent, can be 'display' or 'print' + * (default value is 'display'). + * @property {Object} imageLayer - (optional) An object that has beginLayout, + * endLayout and appendImage functions. + * @property {function} continueCallback - (deprecated) A function that will be + * called each time the rendering is paused. To continue + * rendering call the function that is the first argument + * to the callback. + */ + +/** + * PDF page operator list. + * + * @typedef {Object} PDFOperatorList + * @property {Array} fnArray - Array containing the operator functions. + * @property {Array} argsArray - Array containing the arguments of the + * functions. + */ + +/** + * Proxy to a PDFPage in the worker thread. + * @class + */ +var PDFPageProxy = (function PDFPageProxyClosure() { + function PDFPageProxy(pageIndex, pageInfo, transport) { + this.pageIndex = pageIndex; + this.pageInfo = pageInfo; + this.transport = transport; + this.stats = new StatTimer(); + this.stats.enabled = !!globalScope.PDFJS.enableStats; + this.commonObjs = transport.commonObjs; + this.objs = new PDFObjects(); + this.cleanupAfterRender = false; + this.pendingCleanup = false; + this.intentStates = {}; + this.destroyed = false; + } + PDFPageProxy.prototype = /** @lends PDFPageProxy.prototype */ { + /** + * @return {number} Page number of the page. First page is 1. + */ + get pageNumber() { + return this.pageIndex + 1; + }, + /** + * @return {number} The number of degrees the page is rotated clockwise. + */ + get rotate() { + return this.pageInfo.rotate; + }, + /** + * @return {Object} The reference that points to this page. It has 'num' and + * 'gen' properties. + */ + get ref() { + return this.pageInfo.ref; + }, + /** + * @return {Array} An array of the visible portion of the PDF page in the + * user space units - [x1, y1, x2, y2]. + */ + get view() { + return this.pageInfo.view; + }, + /** + * @param {number} scale The desired scale of the viewport. + * @param {number} rotate Degrees to rotate the viewport. If omitted this + * defaults to the page rotation. + * @return {PDFJS.PageViewport} Contains 'width' and 'height' properties + * along with transforms required for rendering. + */ + getViewport: function PDFPageProxy_getViewport(scale, rotate) { + if (arguments.length < 2) { + rotate = this.rotate; + } + return new PDFJS.PageViewport(this.view, scale, rotate, 0, 0); + }, + /** + * @return {Promise} A promise that is resolved with an {Array} of the + * annotation objects. + */ + getAnnotations: function PDFPageProxy_getAnnotations() { + if (!this.annotationsPromise) { + this.annotationsPromise = this.transport.getAnnotations(this.pageIndex); + } + return this.annotationsPromise; + }, + /** + * Begins the process of rendering a page to the desired context. + * @param {RenderParameters} params Page render parameters. + * @return {RenderTask} An object that contains the promise, which + * is resolved when the page finishes rendering. + */ + render: function PDFPageProxy_render(params) { + var stats = this.stats; + stats.time('Overall'); + + // If there was a pending destroy cancel it so no cleanup happens during + // this call to render. + this.pendingCleanup = false; + + var renderingIntent = (params.intent === 'print' ? 'print' : 'display'); + + if (!this.intentStates[renderingIntent]) { + this.intentStates[renderingIntent] = {}; + } + var intentState = this.intentStates[renderingIntent]; + + // If there's no displayReadyCapability yet, then the operatorList + // was never requested before. Make the request and create the promise. + if (!intentState.displayReadyCapability) { + intentState.receivingOperatorList = true; + intentState.displayReadyCapability = createPromiseCapability(); + intentState.operatorList = { + fnArray: [], + argsArray: [], + lastChunk: false + }; + + this.stats.time('Page Request'); + this.transport.messageHandler.send('RenderPageRequest', { + pageIndex: this.pageNumber - 1, + intent: renderingIntent + }); + } + + var internalRenderTask = new InternalRenderTask(complete, params, + this.objs, + this.commonObjs, + intentState.operatorList, + this.pageNumber); + internalRenderTask.useRequestAnimationFrame = renderingIntent !== 'print'; + if (!intentState.renderTasks) { + intentState.renderTasks = []; + } + intentState.renderTasks.push(internalRenderTask); + var renderTask = internalRenderTask.task; + + // Obsolete parameter support + if (params.continueCallback) { + deprecated('render is used with continueCallback parameter'); + renderTask.onContinue = params.continueCallback; + } + + var self = this; + intentState.displayReadyCapability.promise.then( + function pageDisplayReadyPromise(transparency) { + if (self.pendingCleanup) { + complete(); + return; + } + stats.time('Rendering'); + internalRenderTask.initalizeGraphics(transparency); + internalRenderTask.operatorListChanged(); + }, + function pageDisplayReadPromiseError(reason) { + complete(reason); + } + ); + + function complete(error) { + var i = intentState.renderTasks.indexOf(internalRenderTask); + if (i >= 0) { + intentState.renderTasks.splice(i, 1); + } + + if (self.cleanupAfterRender) { + self.pendingCleanup = true; + } + self._tryCleanup(); + + if (error) { + internalRenderTask.capability.reject(error); + } else { + internalRenderTask.capability.resolve(); + } + stats.timeEnd('Rendering'); + stats.timeEnd('Overall'); + } + + return renderTask; + }, + + /** + * @return {Promise} A promise resolved with an {@link PDFOperatorList} + * object that represents page's operator list. + */ + getOperatorList: function PDFPageProxy_getOperatorList() { + function operatorListChanged() { + if (intentState.operatorList.lastChunk) { + intentState.opListReadCapability.resolve(intentState.operatorList); + } + } + + var renderingIntent = 'oplist'; + if (!this.intentStates[renderingIntent]) { + this.intentStates[renderingIntent] = {}; + } + var intentState = this.intentStates[renderingIntent]; + + if (!intentState.opListReadCapability) { + var opListTask = {}; + opListTask.operatorListChanged = operatorListChanged; + intentState.receivingOperatorList = true; + intentState.opListReadCapability = createPromiseCapability(); + intentState.renderTasks = []; + intentState.renderTasks.push(opListTask); + intentState.operatorList = { + fnArray: [], + argsArray: [], + lastChunk: false + }; + + this.transport.messageHandler.send('RenderPageRequest', { + pageIndex: this.pageIndex, + intent: renderingIntent + }); + } + return intentState.opListReadCapability.promise; + }, + + /** + * @return {Promise} That is resolved a {@link TextContent} + * object that represent the page text content. + */ + getTextContent: function PDFPageProxy_getTextContent() { + return this.transport.messageHandler.sendWithPromise('GetTextContent', { + pageIndex: this.pageNumber - 1 + }); + }, + + /** + * Destroys page object. + */ + _destroy: function PDFPageProxy_destroy() { + this.destroyed = true; + this.transport.pageCache[this.pageIndex] = null; + + var waitOn = []; + Object.keys(this.intentStates).forEach(function(intent) { + var intentState = this.intentStates[intent]; + intentState.renderTasks.forEach(function(renderTask) { + var renderCompleted = renderTask.capability.promise. + catch(function () {}); // ignoring failures + waitOn.push(renderCompleted); + renderTask.cancel(); + }); + }, this); + this.objs.clear(); + this.annotationsPromise = null; + this.pendingCleanup = false; + return Promise.all(waitOn); + }, + + /** + * Cleans up resources allocated by the page. (deprecated) + */ + destroy: function() { + deprecated('page destroy method, use cleanup() instead'); + this.cleanup(); + }, + + /** + * Cleans up resources allocated by the page. + */ + cleanup: function PDFPageProxy_cleanup() { + this.pendingCleanup = true; + this._tryCleanup(); + }, + /** + * For internal use only. Attempts to clean up if rendering is in a state + * where that's possible. + * @ignore + */ + _tryCleanup: function PDFPageProxy_tryCleanup() { + if (!this.pendingCleanup || + Object.keys(this.intentStates).some(function(intent) { + var intentState = this.intentStates[intent]; + return (intentState.renderTasks.length !== 0 || + intentState.receivingOperatorList); + }, this)) { + return; + } + + Object.keys(this.intentStates).forEach(function(intent) { + delete this.intentStates[intent]; + }, this); + this.objs.clear(); + this.annotationsPromise = null; + this.pendingCleanup = false; + }, + /** + * For internal use only. + * @ignore + */ + _startRenderPage: function PDFPageProxy_startRenderPage(transparency, + intent) { + var intentState = this.intentStates[intent]; + // TODO Refactor RenderPageRequest to separate rendering + // and operator list logic + if (intentState.displayReadyCapability) { + intentState.displayReadyCapability.resolve(transparency); + } + }, + /** + * For internal use only. + * @ignore + */ + _renderPageChunk: function PDFPageProxy_renderPageChunk(operatorListChunk, + intent) { + var intentState = this.intentStates[intent]; + var i, ii; + // Add the new chunk to the current operator list. + for (i = 0, ii = operatorListChunk.length; i < ii; i++) { + intentState.operatorList.fnArray.push(operatorListChunk.fnArray[i]); + intentState.operatorList.argsArray.push( + operatorListChunk.argsArray[i]); + } + intentState.operatorList.lastChunk = operatorListChunk.lastChunk; + + // Notify all the rendering tasks there are more operators to be consumed. + for (i = 0; i < intentState.renderTasks.length; i++) { + intentState.renderTasks[i].operatorListChanged(); + } + + if (operatorListChunk.lastChunk) { + intentState.receivingOperatorList = false; + this._tryCleanup(); + } + } + }; + return PDFPageProxy; +})(); + +/** + * For internal use only. + * @ignore + */ +var WorkerTransport = (function WorkerTransportClosure() { + function WorkerTransport(workerInitializedCapability, pdfDataRangeTransport) { + this.pdfDataRangeTransport = pdfDataRangeTransport; + this.workerInitializedCapability = workerInitializedCapability; + this.commonObjs = new PDFObjects(); + + this.loadingTask = null; + this.destroyed = false; + this.destroyCapability = null; + + this.pageCache = []; + this.pagePromises = []; + this.downloadInfoCapability = createPromiseCapability(); + + // If worker support isn't disabled explicit and the browser has worker + // support, create a new web worker and test if it/the browser fullfills + // all requirements to run parts of pdf.js in a web worker. + // Right now, the requirement is, that an Uint8Array is still an Uint8Array + // as it arrives on the worker. Chrome added this with version 15. + if (!globalScope.PDFJS.disableWorker && typeof Worker !== 'undefined') { + var workerSrc = PDFJS.workerSrc; + if (!workerSrc) { + error('No PDFJS.workerSrc specified'); + } + + try { + // Some versions of FF can't create a worker on localhost, see: + // https://bugzilla.mozilla.org/show_bug.cgi?id=683280 + var worker = new Worker(workerSrc); + var messageHandler = new MessageHandler('main', worker); + this.messageHandler = messageHandler; + + messageHandler.on('test', function transportTest(data) { + var supportTypedArray = data && data.supportTypedArray; + if (supportTypedArray) { + this.worker = worker; + if (!data.supportTransfers) { + PDFJS.postMessageTransfers = false; + } + this.setupMessageHandler(messageHandler); + workerInitializedCapability.resolve(); + } else { + this.setupFakeWorker(); + } + }.bind(this)); + + var testObj = new Uint8Array([PDFJS.postMessageTransfers ? 255 : 0]); + // Some versions of Opera throw a DATA_CLONE_ERR on serializing the + // typed array. Also, checking if we can use transfers. + try { + messageHandler.send('test', testObj, [testObj.buffer]); + } catch (ex) { + info('Cannot use postMessage transfers'); + testObj[0] = 0; + messageHandler.send('test', testObj); + } + return; + } catch (e) { + info('The worker has been disabled.'); + } + } + // Either workers are disabled, not supported or have thrown an exception. + // Thus, we fallback to a faked worker. + this.setupFakeWorker(); + } + WorkerTransport.prototype = { + destroy: function WorkerTransport_destroy() { + if (this.destroyCapability) { + return this.destroyCapability.promise; + } + + this.destroyed = true; + this.destroyCapability = createPromiseCapability(); + + var waitOn = []; + // We need to wait for all renderings to be completed, e.g. + // timeout/rAF can take a long time. + this.pageCache.forEach(function (page) { + if (page) { + waitOn.push(page._destroy()); + } + }); + this.pageCache = []; + this.pagePromises = []; + var self = this; + // We also need to wait for the worker to finish its long running tasks. + var terminated = this.messageHandler.sendWithPromise('Terminate', null); + waitOn.push(terminated); + Promise.all(waitOn).then(function () { + FontLoader.clear(); + if (self.worker) { + self.worker.terminate(); + } + if (self.pdfDataRangeTransport) { + self.pdfDataRangeTransport.abort(); + self.pdfDataRangeTransport = null; + } + self.messageHandler = null; + self.destroyCapability.resolve(); + }, this.destroyCapability.reject); + return this.destroyCapability.promise; + }, + + setupFakeWorker: function WorkerTransport_setupFakeWorker() { + globalScope.PDFJS.disableWorker = true; + + if (!PDFJS.fakeWorkerFilesLoadedCapability) { + PDFJS.fakeWorkerFilesLoadedCapability = createPromiseCapability(); + // In the developer build load worker_loader which in turn loads all the + // other files and resolves the promise. In production only the + // pdf.worker.js file is needed. + Util.loadScript(PDFJS.workerSrc, function() { + PDFJS.fakeWorkerFilesLoadedCapability.resolve(); + }); + } + PDFJS.fakeWorkerFilesLoadedCapability.promise.then(function () { + warn('Setting up fake worker.'); + // If we don't use a worker, just post/sendMessage to the main thread. + var fakeWorker = { + postMessage: function WorkerTransport_postMessage(obj) { + fakeWorker.onmessage({data: obj}); + }, + terminate: function WorkerTransport_terminate() {} + }; + + var messageHandler = new MessageHandler('main', fakeWorker); + this.setupMessageHandler(messageHandler); + + // If the main thread is our worker, setup the handling for the messages + // the main thread sends to it self. + PDFJS.WorkerMessageHandler.setup(messageHandler); + + this.workerInitializedCapability.resolve(); + }.bind(this)); + }, + + setupMessageHandler: + function WorkerTransport_setupMessageHandler(messageHandler) { + this.messageHandler = messageHandler; + + function updatePassword(password) { + messageHandler.send('UpdatePassword', password); + } + + var pdfDataRangeTransport = this.pdfDataRangeTransport; + if (pdfDataRangeTransport) { + pdfDataRangeTransport.addRangeListener(function(begin, chunk) { + messageHandler.send('OnDataRange', { + begin: begin, + chunk: chunk + }); + }); + + pdfDataRangeTransport.addProgressListener(function(loaded) { + messageHandler.send('OnDataProgress', { + loaded: loaded + }); + }); + + pdfDataRangeTransport.addProgressiveReadListener(function(chunk) { + messageHandler.send('OnDataRange', { + chunk: chunk + }); + }); + + messageHandler.on('RequestDataRange', + function transportDataRange(data) { + pdfDataRangeTransport.requestDataRange(data.begin, data.end); + }, this); + } + + messageHandler.on('GetDoc', function transportDoc(data) { + var pdfInfo = data.pdfInfo; + this.numPages = data.pdfInfo.numPages; + var loadingTask = this.loadingTask; + var pdfDocument = new PDFDocumentProxy(pdfInfo, this, loadingTask); + this.pdfDocument = pdfDocument; + loadingTask._capability.resolve(pdfDocument); + }, this); + + messageHandler.on('NeedPassword', + function transportNeedPassword(exception) { + var loadingTask = this.loadingTask; + if (loadingTask.onPassword) { + return loadingTask.onPassword(updatePassword, + PasswordResponses.NEED_PASSWORD); + } + loadingTask._capability.reject( + new PasswordException(exception.message, exception.code)); + }, this); + + messageHandler.on('IncorrectPassword', + function transportIncorrectPassword(exception) { + var loadingTask = this.loadingTask; + if (loadingTask.onPassword) { + return loadingTask.onPassword(updatePassword, + PasswordResponses.INCORRECT_PASSWORD); + } + loadingTask._capability.reject( + new PasswordException(exception.message, exception.code)); + }, this); + + messageHandler.on('InvalidPDF', function transportInvalidPDF(exception) { + this.loadingTask._capability.reject( + new InvalidPDFException(exception.message)); + }, this); + + messageHandler.on('MissingPDF', function transportMissingPDF(exception) { + this.loadingTask._capability.reject( + new MissingPDFException(exception.message)); + }, this); + + messageHandler.on('UnexpectedResponse', + function transportUnexpectedResponse(exception) { + this.loadingTask._capability.reject( + new UnexpectedResponseException(exception.message, exception.status)); + }, this); + + messageHandler.on('UnknownError', + function transportUnknownError(exception) { + this.loadingTask._capability.reject( + new UnknownErrorException(exception.message, exception.details)); + }, this); + + messageHandler.on('DataLoaded', function transportPage(data) { + this.downloadInfoCapability.resolve(data); + }, this); + + messageHandler.on('PDFManagerReady', function transportPage(data) { + if (this.pdfDataRangeTransport) { + this.pdfDataRangeTransport.transportReady(); + } + }, this); + + messageHandler.on('StartRenderPage', function transportRender(data) { + var page = this.pageCache[data.pageIndex]; + + page.stats.timeEnd('Page Request'); + page._startRenderPage(data.transparency, data.intent); + }, this); + + messageHandler.on('RenderPageChunk', function transportRender(data) { + var page = this.pageCache[data.pageIndex]; + + page._renderPageChunk(data.operatorList, data.intent); + }, this); + + messageHandler.on('commonobj', function transportObj(data) { + var id = data[0]; + var type = data[1]; + if (this.commonObjs.hasData(id)) { + return; + } + + switch (type) { + case 'Font': + var exportedData = data[2]; + + var font; + if ('error' in exportedData) { + var error = exportedData.error; + warn('Error during font loading: ' + error); + this.commonObjs.resolve(id, error); + break; + } else { + font = new FontFaceObject(exportedData); + } + + FontLoader.bind( + [font], + function fontReady(fontObjs) { + this.commonObjs.resolve(id, font); + }.bind(this) + ); + break; + case 'FontPath': + this.commonObjs.resolve(id, data[2]); + break; + default: + error('Got unknown common object type ' + type); + } + }, this); + + messageHandler.on('obj', function transportObj(data) { + var id = data[0]; + var pageIndex = data[1]; + var type = data[2]; + var pageProxy = this.pageCache[pageIndex]; + var imageData; + if (pageProxy.objs.hasData(id)) { + return; + } + + switch (type) { + case 'JpegStream': + imageData = data[3]; + loadJpegStream(id, imageData, pageProxy.objs); + break; + case 'Image': + imageData = data[3]; + pageProxy.objs.resolve(id, imageData); + + // heuristics that will allow not to store large data + var MAX_IMAGE_SIZE_TO_STORE = 8000000; + if (imageData && 'data' in imageData && + imageData.data.length > MAX_IMAGE_SIZE_TO_STORE) { + pageProxy.cleanupAfterRender = true; + } + break; + default: + error('Got unknown object type ' + type); + } + }, this); + + messageHandler.on('DocProgress', function transportDocProgress(data) { + var loadingTask = this.loadingTask; + if (loadingTask.onProgress) { + loadingTask.onProgress({ + loaded: data.loaded, + total: data.total + }); + } + }, this); + + messageHandler.on('PageError', function transportError(data) { + var page = this.pageCache[data.pageNum - 1]; + var intentState = page.intentStates[data.intent]; + if (intentState.displayReadyCapability) { + intentState.displayReadyCapability.reject(data.error); + } else { + error(data.error); + } + }, this); + + messageHandler.on('JpegDecode', function(data) { + var imageUrl = data[0]; + var components = data[1]; + if (components !== 3 && components !== 1) { + return Promise.reject( + new Error('Only 3 components or 1 component can be returned')); + } + + return new Promise(function (resolve, reject) { + var img = new Image(); + img.onload = function () { + var width = img.width; + var height = img.height; + var size = width * height; + var rgbaLength = size * 4; + var buf = new Uint8Array(size * components); + var tmpCanvas = createScratchCanvas(width, height); + var tmpCtx = tmpCanvas.getContext('2d'); + tmpCtx.drawImage(img, 0, 0); + var data = tmpCtx.getImageData(0, 0, width, height).data; + var i, j; + + if (components === 3) { + for (i = 0, j = 0; i < rgbaLength; i += 4, j += 3) { + buf[j] = data[i]; + buf[j + 1] = data[i + 1]; + buf[j + 2] = data[i + 2]; + } + } else if (components === 1) { + for (i = 0, j = 0; i < rgbaLength; i += 4, j++) { + buf[j] = data[i]; + } + } + resolve({ data: buf, width: width, height: height}); + }; + img.onerror = function () { + reject(new Error('JpegDecode failed to load image')); + }; + img.src = imageUrl; + }); + }); + }, + + fetchDocument: function WorkerTransport_fetchDocument(loadingTask, source) { + if (this.destroyed) { + loadingTask._capability.reject(new Error('Loading aborted')); + this.destroyCapability.resolve(); + return; + } + + this.loadingTask = loadingTask; + + source.disableAutoFetch = PDFJS.disableAutoFetch; + source.disableStream = PDFJS.disableStream; + source.chunkedViewerLoading = !!this.pdfDataRangeTransport; + if (this.pdfDataRangeTransport) { + source.length = this.pdfDataRangeTransport.length; + source.initialData = this.pdfDataRangeTransport.initialData; + } + this.messageHandler.send('GetDocRequest', { + source: source, + disableRange: PDFJS.disableRange, + maxImageSize: PDFJS.maxImageSize, + cMapUrl: PDFJS.cMapUrl, + cMapPacked: PDFJS.cMapPacked, + disableFontFace: PDFJS.disableFontFace, + disableCreateObjectURL: PDFJS.disableCreateObjectURL, + verbosity: PDFJS.verbosity + }); + }, + + getData: function WorkerTransport_getData() { + return this.messageHandler.sendWithPromise('GetData', null); + }, + + getPage: function WorkerTransport_getPage(pageNumber, capability) { + if (pageNumber <= 0 || pageNumber > this.numPages || + (pageNumber|0) !== pageNumber) { + return Promise.reject(new Error('Invalid page request')); + } + + var pageIndex = pageNumber - 1; + if (pageIndex in this.pagePromises) { + return this.pagePromises[pageIndex]; + } + var promise = this.messageHandler.sendWithPromise('GetPage', { + pageIndex: pageIndex + }).then(function (pageInfo) { + if (this.destroyed) { + throw new Error('Transport destroyed'); + } + var page = new PDFPageProxy(pageIndex, pageInfo, this); + this.pageCache[pageIndex] = page; + return page; + }.bind(this)); + this.pagePromises[pageIndex] = promise; + return promise; + }, + + getPageIndex: function WorkerTransport_getPageIndexByRef(ref) { + return this.messageHandler.sendWithPromise('GetPageIndex', { ref: ref }); + }, + + getAnnotations: function WorkerTransport_getAnnotations(pageIndex) { + return this.messageHandler.sendWithPromise('GetAnnotations', + { pageIndex: pageIndex }); + }, + + getDestinations: function WorkerTransport_getDestinations() { + return this.messageHandler.sendWithPromise('GetDestinations', null); + }, + + getDestination: function WorkerTransport_getDestination(id) { + return this.messageHandler.sendWithPromise('GetDestination', { id: id } ); + }, + + getAttachments: function WorkerTransport_getAttachments() { + return this.messageHandler.sendWithPromise('GetAttachments', null); + }, + + getJavaScript: function WorkerTransport_getJavaScript() { + return this.messageHandler.sendWithPromise('GetJavaScript', null); + }, + + getOutline: function WorkerTransport_getOutline() { + return this.messageHandler.sendWithPromise('GetOutline', null); + }, + + getMetadata: function WorkerTransport_getMetadata() { + return this.messageHandler.sendWithPromise('GetMetadata', null). + then(function transportMetadata(results) { + return { + info: results[0], + metadata: (results[1] ? new PDFJS.Metadata(results[1]) : null) + }; + }); + }, + + getStats: function WorkerTransport_getStats() { + return this.messageHandler.sendWithPromise('GetStats', null); + }, + + startCleanup: function WorkerTransport_startCleanup() { + this.messageHandler.sendWithPromise('Cleanup', null). + then(function endCleanup() { + for (var i = 0, ii = this.pageCache.length; i < ii; i++) { + var page = this.pageCache[i]; + if (page) { + page.cleanup(); + } + } + this.commonObjs.clear(); + FontLoader.clear(); + }.bind(this)); + } + }; + return WorkerTransport; + +})(); + +/** + * A PDF document and page is built of many objects. E.g. there are objects + * for fonts, images, rendering code and such. These objects might get processed + * inside of a worker. The `PDFObjects` implements some basic functions to + * manage these objects. + * @ignore + */ +var PDFObjects = (function PDFObjectsClosure() { + function PDFObjects() { + this.objs = {}; + } + + PDFObjects.prototype = { + /** + * Internal function. + * Ensures there is an object defined for `objId`. + */ + ensureObj: function PDFObjects_ensureObj(objId) { + if (this.objs[objId]) { + return this.objs[objId]; + } + + var obj = { + capability: createPromiseCapability(), + data: null, + resolved: false + }; + this.objs[objId] = obj; + + return obj; + }, + + /** + * If called *without* callback, this returns the data of `objId` but the + * object needs to be resolved. If it isn't, this function throws. + * + * If called *with* a callback, the callback is called with the data of the + * object once the object is resolved. That means, if you call this + * function and the object is already resolved, the callback gets called + * right away. + */ + get: function PDFObjects_get(objId, callback) { + // If there is a callback, then the get can be async and the object is + // not required to be resolved right now + if (callback) { + this.ensureObj(objId).capability.promise.then(callback); + return null; + } + + // If there isn't a callback, the user expects to get the resolved data + // directly. + var obj = this.objs[objId]; + + // If there isn't an object yet or the object isn't resolved, then the + // data isn't ready yet! + if (!obj || !obj.resolved) { + error('Requesting object that isn\'t resolved yet ' + objId); + } + + return obj.data; + }, + + /** + * Resolves the object `objId` with optional `data`. + */ + resolve: function PDFObjects_resolve(objId, data) { + var obj = this.ensureObj(objId); + + obj.resolved = true; + obj.data = data; + obj.capability.resolve(data); + }, + + isResolved: function PDFObjects_isResolved(objId) { + var objs = this.objs; + + if (!objs[objId]) { + return false; + } else { + return objs[objId].resolved; + } + }, + + hasData: function PDFObjects_hasData(objId) { + return this.isResolved(objId); + }, + + /** + * Returns the data of `objId` if object exists, null otherwise. + */ + getData: function PDFObjects_getData(objId) { + var objs = this.objs; + if (!objs[objId] || !objs[objId].resolved) { + return null; + } else { + return objs[objId].data; + } + }, + + clear: function PDFObjects_clear() { + this.objs = {}; + } + }; + return PDFObjects; +})(); + +/** + * Allows controlling of the rendering tasks. + * @class + */ +var RenderTask = (function RenderTaskClosure() { + function RenderTask(internalRenderTask) { + this._internalRenderTask = internalRenderTask; + + /** + * Callback for incremental rendering -- a function that will be called + * each time the rendering is paused. To continue rendering call the + * function that is the first argument to the callback. + * @type {function} + */ + this.onContinue = null; + } + + RenderTask.prototype = /** @lends RenderTask.prototype */ { + /** + * Promise for rendering task completion. + * @return {Promise} + */ + get promise() { + return this._internalRenderTask.capability.promise; + }, + + /** + * Cancels the rendering task. If the task is currently rendering it will + * not be cancelled until graphics pauses with a timeout. The promise that + * this object extends will resolved when cancelled. + */ + cancel: function RenderTask_cancel() { + this._internalRenderTask.cancel(); + }, + + /** + * Registers callbacks to indicate the rendering task completion. + * + * @param {function} onFulfilled The callback for the rendering completion. + * @param {function} onRejected The callback for the rendering failure. + * @return {Promise} A promise that is resolved after the onFulfilled or + * onRejected callback. + */ + then: function RenderTask_then(onFulfilled, onRejected) { + return this.promise.then.apply(this.promise, arguments); + } + }; + + return RenderTask; +})(); + +/** + * For internal use only. + * @ignore + */ +var InternalRenderTask = (function InternalRenderTaskClosure() { + + function InternalRenderTask(callback, params, objs, commonObjs, operatorList, + pageNumber) { + this.callback = callback; + this.params = params; + this.objs = objs; + this.commonObjs = commonObjs; + this.operatorListIdx = null; + this.operatorList = operatorList; + this.pageNumber = pageNumber; + this.running = false; + this.graphicsReadyCallback = null; + this.graphicsReady = false; + this.useRequestAnimationFrame = false; + this.cancelled = false; + this.capability = createPromiseCapability(); + this.task = new RenderTask(this); + // caching this-bound methods + this._continueBound = this._continue.bind(this); + this._scheduleNextBound = this._scheduleNext.bind(this); + this._nextBound = this._next.bind(this); + } + + InternalRenderTask.prototype = { + + initalizeGraphics: + function InternalRenderTask_initalizeGraphics(transparency) { + + if (this.cancelled) { + return; + } + if (PDFJS.pdfBug && 'StepperManager' in globalScope && + globalScope.StepperManager.enabled) { + this.stepper = globalScope.StepperManager.create(this.pageNumber - 1); + this.stepper.init(this.operatorList); + this.stepper.nextBreakPoint = this.stepper.getNextBreakPoint(); + } + + var params = this.params; + this.gfx = new CanvasGraphics(params.canvasContext, this.commonObjs, + this.objs, params.imageLayer); + + this.gfx.beginDrawing(params.viewport, transparency); + this.operatorListIdx = 0; + this.graphicsReady = true; + if (this.graphicsReadyCallback) { + this.graphicsReadyCallback(); + } + }, + + cancel: function InternalRenderTask_cancel() { + this.running = false; + this.cancelled = true; + this.callback('cancelled'); + }, + + operatorListChanged: function InternalRenderTask_operatorListChanged() { + if (!this.graphicsReady) { + if (!this.graphicsReadyCallback) { + this.graphicsReadyCallback = this._continueBound; + } + return; + } + + if (this.stepper) { + this.stepper.updateOperatorList(this.operatorList); + } + + if (this.running) { + return; + } + this._continue(); + }, + + _continue: function InternalRenderTask__continue() { + this.running = true; + if (this.cancelled) { + return; + } + if (this.task.onContinue) { + this.task.onContinue.call(this.task, this._scheduleNextBound); + } else { + this._scheduleNext(); + } + }, + + _scheduleNext: function InternalRenderTask__scheduleNext() { + if (this.useRequestAnimationFrame) { + window.requestAnimationFrame(this._nextBound); + } else { + Promise.resolve(undefined).then(this._nextBound); + } + }, + + _next: function InternalRenderTask__next() { + if (this.cancelled) { + return; + } + this.operatorListIdx = this.gfx.executeOperatorList(this.operatorList, + this.operatorListIdx, + this._continueBound, + this.stepper); + if (this.operatorListIdx === this.operatorList.argsArray.length) { + this.running = false; + if (this.operatorList.lastChunk) { + this.gfx.endDrawing(); + this.callback(); + } + } + } + + }; + + return InternalRenderTask; +})(); + + +var Metadata = PDFJS.Metadata = (function MetadataClosure() { + function fixMetadata(meta) { + return meta.replace(/>\\376\\377([^<]+)/g, function(all, codes) { + var bytes = codes.replace(/\\([0-3])([0-7])([0-7])/g, + function(code, d1, d2, d3) { + return String.fromCharCode(d1 * 64 + d2 * 8 + d3 * 1); + }); + var chars = ''; + for (var i = 0; i < bytes.length; i += 2) { + var code = bytes.charCodeAt(i) * 256 + bytes.charCodeAt(i + 1); + chars += code >= 32 && code < 127 && code !== 60 && code !== 62 && + code !== 38 && false ? String.fromCharCode(code) : + '&#x' + (0x10000 + code).toString(16).substring(1) + ';'; + } + return '>' + chars; + }); + } + + function Metadata(meta) { + if (typeof meta === 'string') { + // Ghostscript produces invalid metadata + meta = fixMetadata(meta); + + var parser = new DOMParser(); + meta = parser.parseFromString(meta, 'application/xml'); + } else if (!(meta instanceof Document)) { + error('Metadata: Invalid metadata object'); + } + + this.metaDocument = meta; + this.metadata = {}; + this.parse(); + } + + Metadata.prototype = { + parse: function Metadata_parse() { + var doc = this.metaDocument; + var rdf = doc.documentElement; + + if (rdf.nodeName.toLowerCase() !== 'rdf:rdf') { // Wrapped in + rdf = rdf.firstChild; + while (rdf && rdf.nodeName.toLowerCase() !== 'rdf:rdf') { + rdf = rdf.nextSibling; + } + } + + var nodeName = (rdf) ? rdf.nodeName.toLowerCase() : null; + if (!rdf || nodeName !== 'rdf:rdf' || !rdf.hasChildNodes()) { + return; + } + + var children = rdf.childNodes, desc, entry, name, i, ii, length, iLength; + for (i = 0, length = children.length; i < length; i++) { + desc = children[i]; + if (desc.nodeName.toLowerCase() !== 'rdf:description') { + continue; + } + + for (ii = 0, iLength = desc.childNodes.length; ii < iLength; ii++) { + if (desc.childNodes[ii].nodeName.toLowerCase() !== '#text') { + entry = desc.childNodes[ii]; + name = entry.nodeName.toLowerCase(); + this.metadata[name] = entry.textContent.trim(); + } + } + } + }, + + get: function Metadata_get(name) { + return this.metadata[name] || null; + }, + + has: function Metadata_has(name) { + return typeof this.metadata[name] !== 'undefined'; + } + }; + + return Metadata; +})(); + + +// contexts store most of the state we need natively. +// However, PDF needs a bit more state, which we store here. + +// Minimal font size that would be used during canvas fillText operations. +var MIN_FONT_SIZE = 16; +// Maximum font size that would be used during canvas fillText operations. +var MAX_FONT_SIZE = 100; +var MAX_GROUP_SIZE = 4096; + +// Heuristic value used when enforcing minimum line widths. +var MIN_WIDTH_FACTOR = 0.65; + +var COMPILE_TYPE3_GLYPHS = true; +var MAX_SIZE_TO_COMPILE = 1000; + +var FULL_CHUNK_HEIGHT = 16; + +function createScratchCanvas(width, height) { + var canvas = document.createElement('canvas'); + canvas.width = width; + canvas.height = height; + return canvas; +} + +function addContextCurrentTransform(ctx) { + // If the context doesn't expose a `mozCurrentTransform`, add a JS based one. + if (!ctx.mozCurrentTransform) { + ctx._originalSave = ctx.save; + ctx._originalRestore = ctx.restore; + ctx._originalRotate = ctx.rotate; + ctx._originalScale = ctx.scale; + ctx._originalTranslate = ctx.translate; + ctx._originalTransform = ctx.transform; + ctx._originalSetTransform = ctx.setTransform; + + ctx._transformMatrix = ctx._transformMatrix || [1, 0, 0, 1, 0, 0]; + ctx._transformStack = []; + + Object.defineProperty(ctx, 'mozCurrentTransform', { + get: function getCurrentTransform() { + return this._transformMatrix; + } + }); + + Object.defineProperty(ctx, 'mozCurrentTransformInverse', { + get: function getCurrentTransformInverse() { + // Calculation done using WolframAlpha: + // http://www.wolframalpha.com/input/? + // i=Inverse+{{a%2C+c%2C+e}%2C+{b%2C+d%2C+f}%2C+{0%2C+0%2C+1}} + + var m = this._transformMatrix; + var a = m[0], b = m[1], c = m[2], d = m[3], e = m[4], f = m[5]; + + var ad_bc = a * d - b * c; + var bc_ad = b * c - a * d; + + return [ + d / ad_bc, + b / bc_ad, + c / bc_ad, + a / ad_bc, + (d * e - c * f) / bc_ad, + (b * e - a * f) / ad_bc + ]; + } + }); + + ctx.save = function ctxSave() { + var old = this._transformMatrix; + this._transformStack.push(old); + this._transformMatrix = old.slice(0, 6); + + this._originalSave(); + }; + + ctx.restore = function ctxRestore() { + var prev = this._transformStack.pop(); + if (prev) { + this._transformMatrix = prev; + this._originalRestore(); + } + }; + + ctx.translate = function ctxTranslate(x, y) { + var m = this._transformMatrix; + m[4] = m[0] * x + m[2] * y + m[4]; + m[5] = m[1] * x + m[3] * y + m[5]; + + this._originalTranslate(x, y); + }; + + ctx.scale = function ctxScale(x, y) { + var m = this._transformMatrix; + m[0] = m[0] * x; + m[1] = m[1] * x; + m[2] = m[2] * y; + m[3] = m[3] * y; + + this._originalScale(x, y); + }; + + ctx.transform = function ctxTransform(a, b, c, d, e, f) { + var m = this._transformMatrix; + this._transformMatrix = [ + m[0] * a + m[2] * b, + m[1] * a + m[3] * b, + m[0] * c + m[2] * d, + m[1] * c + m[3] * d, + m[0] * e + m[2] * f + m[4], + m[1] * e + m[3] * f + m[5] + ]; + + ctx._originalTransform(a, b, c, d, e, f); + }; + + ctx.setTransform = function ctxSetTransform(a, b, c, d, e, f) { + this._transformMatrix = [a, b, c, d, e, f]; + + ctx._originalSetTransform(a, b, c, d, e, f); + }; + + ctx.rotate = function ctxRotate(angle) { + var cosValue = Math.cos(angle); + var sinValue = Math.sin(angle); + + var m = this._transformMatrix; + this._transformMatrix = [ + m[0] * cosValue + m[2] * sinValue, + m[1] * cosValue + m[3] * sinValue, + m[0] * (-sinValue) + m[2] * cosValue, + m[1] * (-sinValue) + m[3] * cosValue, + m[4], + m[5] + ]; + + this._originalRotate(angle); + }; + } +} + +var CachedCanvases = (function CachedCanvasesClosure() { + var cache = {}; + return { + getCanvas: function CachedCanvases_getCanvas(id, width, height, + trackTransform) { + var canvasEntry; + if (cache[id] !== undefined) { + canvasEntry = cache[id]; + canvasEntry.canvas.width = width; + canvasEntry.canvas.height = height; + // reset canvas transform for emulated mozCurrentTransform, if needed + canvasEntry.context.setTransform(1, 0, 0, 1, 0, 0); + } else { + var canvas = createScratchCanvas(width, height); + var ctx = canvas.getContext('2d'); + if (trackTransform) { + addContextCurrentTransform(ctx); + } + cache[id] = canvasEntry = {canvas: canvas, context: ctx}; + } + return canvasEntry; + }, + clear: function () { + for (var id in cache) { + var canvasEntry = cache[id]; + // Zeroing the width and height causes Firefox to release graphics + // resources immediately, which can greatly reduce memory consumption. + canvasEntry.canvas.width = 0; + canvasEntry.canvas.height = 0; + delete cache[id]; + } + } + }; +})(); + +function compileType3Glyph(imgData) { + var POINT_TO_PROCESS_LIMIT = 1000; + + var width = imgData.width, height = imgData.height; + var i, j, j0, width1 = width + 1; + var points = new Uint8Array(width1 * (height + 1)); + var POINT_TYPES = + new Uint8Array([0, 2, 4, 0, 1, 0, 5, 4, 8, 10, 0, 8, 0, 2, 1, 0]); + + // decodes bit-packed mask data + var lineSize = (width + 7) & ~7, data0 = imgData.data; + var data = new Uint8Array(lineSize * height), pos = 0, ii; + for (i = 0, ii = data0.length; i < ii; i++) { + var mask = 128, elem = data0[i]; + while (mask > 0) { + data[pos++] = (elem & mask) ? 0 : 255; + mask >>= 1; + } + } + + // finding iteresting points: every point is located between mask pixels, + // so there will be points of the (width + 1)x(height + 1) grid. Every point + // will have flags assigned based on neighboring mask pixels: + // 4 | 8 + // --P-- + // 2 | 1 + // We are interested only in points with the flags: + // - outside corners: 1, 2, 4, 8; + // - inside corners: 7, 11, 13, 14; + // - and, intersections: 5, 10. + var count = 0; + pos = 0; + if (data[pos] !== 0) { + points[0] = 1; + ++count; + } + for (j = 1; j < width; j++) { + if (data[pos] !== data[pos + 1]) { + points[j] = data[pos] ? 2 : 1; + ++count; + } + pos++; + } + if (data[pos] !== 0) { + points[j] = 2; + ++count; + } + for (i = 1; i < height; i++) { + pos = i * lineSize; + j0 = i * width1; + if (data[pos - lineSize] !== data[pos]) { + points[j0] = data[pos] ? 1 : 8; + ++count; + } + // 'sum' is the position of the current pixel configuration in the 'TYPES' + // array (in order 8-1-2-4, so we can use '>>2' to shift the column). + var sum = (data[pos] ? 4 : 0) + (data[pos - lineSize] ? 8 : 0); + for (j = 1; j < width; j++) { + sum = (sum >> 2) + (data[pos + 1] ? 4 : 0) + + (data[pos - lineSize + 1] ? 8 : 0); + if (POINT_TYPES[sum]) { + points[j0 + j] = POINT_TYPES[sum]; + ++count; + } + pos++; + } + if (data[pos - lineSize] !== data[pos]) { + points[j0 + j] = data[pos] ? 2 : 4; + ++count; + } + + if (count > POINT_TO_PROCESS_LIMIT) { + return null; + } + } + + pos = lineSize * (height - 1); + j0 = i * width1; + if (data[pos] !== 0) { + points[j0] = 8; + ++count; + } + for (j = 1; j < width; j++) { + if (data[pos] !== data[pos + 1]) { + points[j0 + j] = data[pos] ? 4 : 8; + ++count; + } + pos++; + } + if (data[pos] !== 0) { + points[j0 + j] = 4; + ++count; + } + if (count > POINT_TO_PROCESS_LIMIT) { + return null; + } + + // building outlines + var steps = new Int32Array([0, width1, -1, 0, -width1, 0, 0, 0, 1]); + var outlines = []; + for (i = 0; count && i <= height; i++) { + var p = i * width1; + var end = p + width; + while (p < end && !points[p]) { + p++; + } + if (p === end) { + continue; + } + var coords = [p % width1, i]; + + var type = points[p], p0 = p, pp; + do { + var step = steps[type]; + do { + p += step; + } while (!points[p]); + + pp = points[p]; + if (pp !== 5 && pp !== 10) { + // set new direction + type = pp; + // delete mark + points[p] = 0; + } else { // type is 5 or 10, ie, a crossing + // set new direction + type = pp & ((0x33 * type) >> 4); + // set new type for "future hit" + points[p] &= (type >> 2 | type << 2); + } + + coords.push(p % width1); + coords.push((p / width1) | 0); + --count; + } while (p0 !== p); + outlines.push(coords); + --i; + } + + var drawOutline = function(c) { + c.save(); + // the path shall be painted in [0..1]x[0..1] space + c.scale(1 / width, -1 / height); + c.translate(0, -height); + c.beginPath(); + for (var i = 0, ii = outlines.length; i < ii; i++) { + var o = outlines[i]; + c.moveTo(o[0], o[1]); + for (var j = 2, jj = o.length; j < jj; j += 2) { + c.lineTo(o[j], o[j+1]); + } + } + c.fill(); + c.beginPath(); + c.restore(); + }; + + return drawOutline; +} + +var CanvasExtraState = (function CanvasExtraStateClosure() { + function CanvasExtraState(old) { + // Are soft masks and alpha values shapes or opacities? + this.alphaIsShape = false; + this.fontSize = 0; + this.fontSizeScale = 1; + this.textMatrix = IDENTITY_MATRIX; + this.textMatrixScale = 1; + this.fontMatrix = FONT_IDENTITY_MATRIX; + this.leading = 0; + // Current point (in user coordinates) + this.x = 0; + this.y = 0; + // Start of text line (in text coordinates) + this.lineX = 0; + this.lineY = 0; + // Character and word spacing + this.charSpacing = 0; + this.wordSpacing = 0; + this.textHScale = 1; + this.textRenderingMode = TextRenderingMode.FILL; + this.textRise = 0; + // Default fore and background colors + this.fillColor = '#000000'; + this.strokeColor = '#000000'; + this.patternFill = false; + // Note: fill alpha applies to all non-stroking operations + this.fillAlpha = 1; + this.strokeAlpha = 1; + this.lineWidth = 1; + this.activeSMask = null; // nonclonable field (see the save method below) + + this.old = old; + } + + CanvasExtraState.prototype = { + clone: function CanvasExtraState_clone() { + return Object.create(this); + }, + setCurrentPoint: function CanvasExtraState_setCurrentPoint(x, y) { + this.x = x; + this.y = y; + } + }; + return CanvasExtraState; +})(); + +var CanvasGraphics = (function CanvasGraphicsClosure() { + // Defines the time the executeOperatorList is going to be executing + // before it stops and shedules a continue of execution. + var EXECUTION_TIME = 15; + // Defines the number of steps before checking the execution time + var EXECUTION_STEPS = 10; + + function CanvasGraphics(canvasCtx, commonObjs, objs, imageLayer) { + this.ctx = canvasCtx; + this.current = new CanvasExtraState(); + this.stateStack = []; + this.pendingClip = null; + this.pendingEOFill = false; + this.res = null; + this.xobjs = null; + this.commonObjs = commonObjs; + this.objs = objs; + this.imageLayer = imageLayer; + this.groupStack = []; + this.processingType3 = null; + // Patterns are painted relative to the initial page/form transform, see pdf + // spec 8.7.2 NOTE 1. + this.baseTransform = null; + this.baseTransformStack = []; + this.groupLevel = 0; + this.smaskStack = []; + this.smaskCounter = 0; + this.tempSMask = null; + if (canvasCtx) { + // NOTE: if mozCurrentTransform is polyfilled, then the current state of + // the transformation must already be set in canvasCtx._transformMatrix. + addContextCurrentTransform(canvasCtx); + } + this.cachedGetSinglePixelWidth = null; + } + + function putBinaryImageData(ctx, imgData) { + if (typeof ImageData !== 'undefined' && imgData instanceof ImageData) { + ctx.putImageData(imgData, 0, 0); + return; + } + + // Put the image data to the canvas in chunks, rather than putting the + // whole image at once. This saves JS memory, because the ImageData object + // is smaller. It also possibly saves C++ memory within the implementation + // of putImageData(). (E.g. in Firefox we make two short-lived copies of + // the data passed to putImageData()). |n| shouldn't be too small, however, + // because too many putImageData() calls will slow things down. + // + // Note: as written, if the last chunk is partial, the putImageData() call + // will (conceptually) put pixels past the bounds of the canvas. But + // that's ok; any such pixels are ignored. + + var height = imgData.height, width = imgData.width; + var partialChunkHeight = height % FULL_CHUNK_HEIGHT; + var fullChunks = (height - partialChunkHeight) / FULL_CHUNK_HEIGHT; + var totalChunks = partialChunkHeight === 0 ? fullChunks : fullChunks + 1; + + var chunkImgData = ctx.createImageData(width, FULL_CHUNK_HEIGHT); + var srcPos = 0, destPos; + var src = imgData.data; + var dest = chunkImgData.data; + var i, j, thisChunkHeight, elemsInThisChunk; + + // There are multiple forms in which the pixel data can be passed, and + // imgData.kind tells us which one this is. + if (imgData.kind === ImageKind.GRAYSCALE_1BPP) { + // Grayscale, 1 bit per pixel (i.e. black-and-white). + var srcLength = src.byteLength; + var dest32 = PDFJS.hasCanvasTypedArrays ? new Uint32Array(dest.buffer) : + new Uint32ArrayView(dest); + var dest32DataLength = dest32.length; + var fullSrcDiff = (width + 7) >> 3; + var white = 0xFFFFFFFF; + var black = (PDFJS.isLittleEndian || !PDFJS.hasCanvasTypedArrays) ? + 0xFF000000 : 0x000000FF; + for (i = 0; i < totalChunks; i++) { + thisChunkHeight = + (i < fullChunks) ? FULL_CHUNK_HEIGHT : partialChunkHeight; + destPos = 0; + for (j = 0; j < thisChunkHeight; j++) { + var srcDiff = srcLength - srcPos; + var k = 0; + var kEnd = (srcDiff > fullSrcDiff) ? width : srcDiff * 8 - 7; + var kEndUnrolled = kEnd & ~7; + var mask = 0; + var srcByte = 0; + for (; k < kEndUnrolled; k += 8) { + srcByte = src[srcPos++]; + dest32[destPos++] = (srcByte & 128) ? white : black; + dest32[destPos++] = (srcByte & 64) ? white : black; + dest32[destPos++] = (srcByte & 32) ? white : black; + dest32[destPos++] = (srcByte & 16) ? white : black; + dest32[destPos++] = (srcByte & 8) ? white : black; + dest32[destPos++] = (srcByte & 4) ? white : black; + dest32[destPos++] = (srcByte & 2) ? white : black; + dest32[destPos++] = (srcByte & 1) ? white : black; + } + for (; k < kEnd; k++) { + if (mask === 0) { + srcByte = src[srcPos++]; + mask = 128; + } + + dest32[destPos++] = (srcByte & mask) ? white : black; + mask >>= 1; + } + } + // We ran out of input. Make all remaining pixels transparent. + while (destPos < dest32DataLength) { + dest32[destPos++] = 0; + } + + ctx.putImageData(chunkImgData, 0, i * FULL_CHUNK_HEIGHT); + } + } else if (imgData.kind === ImageKind.RGBA_32BPP) { + // RGBA, 32-bits per pixel. + + j = 0; + elemsInThisChunk = width * FULL_CHUNK_HEIGHT * 4; + for (i = 0; i < fullChunks; i++) { + dest.set(src.subarray(srcPos, srcPos + elemsInThisChunk)); + srcPos += elemsInThisChunk; + + ctx.putImageData(chunkImgData, 0, j); + j += FULL_CHUNK_HEIGHT; + } + if (i < totalChunks) { + elemsInThisChunk = width * partialChunkHeight * 4; + dest.set(src.subarray(srcPos, srcPos + elemsInThisChunk)); + ctx.putImageData(chunkImgData, 0, j); + } + + } else if (imgData.kind === ImageKind.RGB_24BPP) { + // RGB, 24-bits per pixel. + thisChunkHeight = FULL_CHUNK_HEIGHT; + elemsInThisChunk = width * thisChunkHeight; + for (i = 0; i < totalChunks; i++) { + if (i >= fullChunks) { + thisChunkHeight = partialChunkHeight; + elemsInThisChunk = width * thisChunkHeight; + } + + destPos = 0; + for (j = elemsInThisChunk; j--;) { + dest[destPos++] = src[srcPos++]; + dest[destPos++] = src[srcPos++]; + dest[destPos++] = src[srcPos++]; + dest[destPos++] = 255; + } + ctx.putImageData(chunkImgData, 0, i * FULL_CHUNK_HEIGHT); + } + } else { + error('bad image kind: ' + imgData.kind); + } + } + + function putBinaryImageMask(ctx, imgData) { + var height = imgData.height, width = imgData.width; + var partialChunkHeight = height % FULL_CHUNK_HEIGHT; + var fullChunks = (height - partialChunkHeight) / FULL_CHUNK_HEIGHT; + var totalChunks = partialChunkHeight === 0 ? fullChunks : fullChunks + 1; + + var chunkImgData = ctx.createImageData(width, FULL_CHUNK_HEIGHT); + var srcPos = 0; + var src = imgData.data; + var dest = chunkImgData.data; + + for (var i = 0; i < totalChunks; i++) { + var thisChunkHeight = + (i < fullChunks) ? FULL_CHUNK_HEIGHT : partialChunkHeight; + + // Expand the mask so it can be used by the canvas. Any required + // inversion has already been handled. + var destPos = 3; // alpha component offset + for (var j = 0; j < thisChunkHeight; j++) { + var mask = 0; + for (var k = 0; k < width; k++) { + if (!mask) { + var elem = src[srcPos++]; + mask = 128; + } + dest[destPos] = (elem & mask) ? 0 : 255; + destPos += 4; + mask >>= 1; + } + } + ctx.putImageData(chunkImgData, 0, i * FULL_CHUNK_HEIGHT); + } + } + + function copyCtxState(sourceCtx, destCtx) { + var properties = ['strokeStyle', 'fillStyle', 'fillRule', 'globalAlpha', + 'lineWidth', 'lineCap', 'lineJoin', 'miterLimit', + 'globalCompositeOperation', 'font']; + for (var i = 0, ii = properties.length; i < ii; i++) { + var property = properties[i]; + if (sourceCtx[property] !== undefined) { + destCtx[property] = sourceCtx[property]; + } + } + if (sourceCtx.setLineDash !== undefined) { + destCtx.setLineDash(sourceCtx.getLineDash()); + destCtx.lineDashOffset = sourceCtx.lineDashOffset; + } else if (sourceCtx.mozDashOffset !== undefined) { + destCtx.mozDash = sourceCtx.mozDash; + destCtx.mozDashOffset = sourceCtx.mozDashOffset; + } + } + + function composeSMaskBackdrop(bytes, r0, g0, b0) { + var length = bytes.length; + for (var i = 3; i < length; i += 4) { + var alpha = bytes[i]; + if (alpha === 0) { + bytes[i - 3] = r0; + bytes[i - 2] = g0; + bytes[i - 1] = b0; + } else if (alpha < 255) { + var alpha_ = 255 - alpha; + bytes[i - 3] = (bytes[i - 3] * alpha + r0 * alpha_) >> 8; + bytes[i - 2] = (bytes[i - 2] * alpha + g0 * alpha_) >> 8; + bytes[i - 1] = (bytes[i - 1] * alpha + b0 * alpha_) >> 8; + } + } + } + + function composeSMaskAlpha(maskData, layerData) { + var length = maskData.length; + var scale = 1 / 255; + for (var i = 3; i < length; i += 4) { + var alpha = maskData[i]; + layerData[i] = (layerData[i] * alpha * scale) | 0; + } + } + + function composeSMaskLuminosity(maskData, layerData) { + var length = maskData.length; + for (var i = 3; i < length; i += 4) { + var y = (maskData[i - 3] * 77) + // * 0.3 / 255 * 0x10000 + (maskData[i - 2] * 152) + // * 0.59 .... + (maskData[i - 1] * 28); // * 0.11 .... + layerData[i] = (layerData[i] * y) >> 16; + } + } + + function genericComposeSMask(maskCtx, layerCtx, width, height, + subtype, backdrop) { + var hasBackdrop = !!backdrop; + var r0 = hasBackdrop ? backdrop[0] : 0; + var g0 = hasBackdrop ? backdrop[1] : 0; + var b0 = hasBackdrop ? backdrop[2] : 0; + + var composeFn; + if (subtype === 'Luminosity') { + composeFn = composeSMaskLuminosity; + } else { + composeFn = composeSMaskAlpha; + } + + // processing image in chunks to save memory + var PIXELS_TO_PROCESS = 1048576; + var chunkSize = Math.min(height, Math.ceil(PIXELS_TO_PROCESS / width)); + for (var row = 0; row < height; row += chunkSize) { + var chunkHeight = Math.min(chunkSize, height - row); + var maskData = maskCtx.getImageData(0, row, width, chunkHeight); + var layerData = layerCtx.getImageData(0, row, width, chunkHeight); + + if (hasBackdrop) { + composeSMaskBackdrop(maskData.data, r0, g0, b0); + } + composeFn(maskData.data, layerData.data); + + maskCtx.putImageData(layerData, 0, row); + } + } + + function composeSMask(ctx, smask, layerCtx) { + var mask = smask.canvas; + var maskCtx = smask.context; + + ctx.setTransform(smask.scaleX, 0, 0, smask.scaleY, + smask.offsetX, smask.offsetY); + + var backdrop = smask.backdrop || null; + if (WebGLUtils.isEnabled) { + var composed = WebGLUtils.composeSMask(layerCtx.canvas, mask, + {subtype: smask.subtype, backdrop: backdrop}); + ctx.setTransform(1, 0, 0, 1, 0, 0); + ctx.drawImage(composed, smask.offsetX, smask.offsetY); + return; + } + genericComposeSMask(maskCtx, layerCtx, mask.width, mask.height, + smask.subtype, backdrop); + ctx.drawImage(mask, 0, 0); + } + + var LINE_CAP_STYLES = ['butt', 'round', 'square']; + var LINE_JOIN_STYLES = ['miter', 'round', 'bevel']; + var NORMAL_CLIP = {}; + var EO_CLIP = {}; + + CanvasGraphics.prototype = { + + beginDrawing: function CanvasGraphics_beginDrawing(viewport, transparency) { + // For pdfs that use blend modes we have to clear the canvas else certain + // blend modes can look wrong since we'd be blending with a white + // backdrop. The problem with a transparent backdrop though is we then + // don't get sub pixel anti aliasing on text, so we fill with white if + // we can. + var width = this.ctx.canvas.width; + var height = this.ctx.canvas.height; + if (transparency) { + this.ctx.clearRect(0, 0, width, height); + } else { + this.ctx.mozOpaque = true; + this.ctx.save(); + this.ctx.fillStyle = 'rgb(255, 255, 255)'; + this.ctx.fillRect(0, 0, width, height); + this.ctx.restore(); + } + + var transform = viewport.transform; + + this.ctx.save(); + this.ctx.transform.apply(this.ctx, transform); + + this.baseTransform = this.ctx.mozCurrentTransform.slice(); + + if (this.imageLayer) { + this.imageLayer.beginLayout(); + } + }, + + executeOperatorList: function CanvasGraphics_executeOperatorList( + operatorList, + executionStartIdx, continueCallback, + stepper) { + var argsArray = operatorList.argsArray; + var fnArray = operatorList.fnArray; + var i = executionStartIdx || 0; + var argsArrayLen = argsArray.length; + + // Sometimes the OperatorList to execute is empty. + if (argsArrayLen === i) { + return i; + } + + var chunkOperations = (argsArrayLen - i > EXECUTION_STEPS && + typeof continueCallback === 'function'); + var endTime = chunkOperations ? Date.now() + EXECUTION_TIME : 0; + var steps = 0; + + var commonObjs = this.commonObjs; + var objs = this.objs; + var fnId; + + while (true) { + if (stepper !== undefined && i === stepper.nextBreakPoint) { + stepper.breakIt(i, continueCallback); + return i; + } + + fnId = fnArray[i]; + + if (fnId !== OPS.dependency) { + this[fnId].apply(this, argsArray[i]); + } else { + var deps = argsArray[i]; + for (var n = 0, nn = deps.length; n < nn; n++) { + var depObjId = deps[n]; + var common = depObjId[0] === 'g' && depObjId[1] === '_'; + var objsPool = common ? commonObjs : objs; + + // If the promise isn't resolved yet, add the continueCallback + // to the promise and bail out. + if (!objsPool.isResolved(depObjId)) { + objsPool.get(depObjId, continueCallback); + return i; + } + } + } + + i++; + + // If the entire operatorList was executed, stop as were done. + if (i === argsArrayLen) { + return i; + } + + // If the execution took longer then a certain amount of time and + // `continueCallback` is specified, interrupt the execution. + if (chunkOperations && ++steps > EXECUTION_STEPS) { + if (Date.now() > endTime) { + continueCallback(); + return i; + } + steps = 0; + } + + // If the operatorList isn't executed completely yet OR the execution + // time was short enough, do another execution round. + } + }, + + endDrawing: function CanvasGraphics_endDrawing() { + this.ctx.restore(); + CachedCanvases.clear(); + WebGLUtils.clear(); + + if (this.imageLayer) { + this.imageLayer.endLayout(); + } + }, + + // Graphics state + setLineWidth: function CanvasGraphics_setLineWidth(width) { + this.current.lineWidth = width; + this.ctx.lineWidth = width; + }, + setLineCap: function CanvasGraphics_setLineCap(style) { + this.ctx.lineCap = LINE_CAP_STYLES[style]; + }, + setLineJoin: function CanvasGraphics_setLineJoin(style) { + this.ctx.lineJoin = LINE_JOIN_STYLES[style]; + }, + setMiterLimit: function CanvasGraphics_setMiterLimit(limit) { + this.ctx.miterLimit = limit; + }, + setDash: function CanvasGraphics_setDash(dashArray, dashPhase) { + var ctx = this.ctx; + if (ctx.setLineDash !== undefined) { + ctx.setLineDash(dashArray); + ctx.lineDashOffset = dashPhase; + } else { + ctx.mozDash = dashArray; + ctx.mozDashOffset = dashPhase; + } + }, + setRenderingIntent: function CanvasGraphics_setRenderingIntent(intent) { + // Maybe if we one day fully support color spaces this will be important + // for now we can ignore. + // TODO set rendering intent? + }, + setFlatness: function CanvasGraphics_setFlatness(flatness) { + // There's no way to control this with canvas, but we can safely ignore. + // TODO set flatness? + }, + setGState: function CanvasGraphics_setGState(states) { + for (var i = 0, ii = states.length; i < ii; i++) { + var state = states[i]; + var key = state[0]; + var value = state[1]; + + switch (key) { + case 'LW': + this.setLineWidth(value); + break; + case 'LC': + this.setLineCap(value); + break; + case 'LJ': + this.setLineJoin(value); + break; + case 'ML': + this.setMiterLimit(value); + break; + case 'D': + this.setDash(value[0], value[1]); + break; + case 'RI': + this.setRenderingIntent(value); + break; + case 'FL': + this.setFlatness(value); + break; + case 'Font': + this.setFont(value[0], value[1]); + break; + case 'CA': + this.current.strokeAlpha = state[1]; + break; + case 'ca': + this.current.fillAlpha = state[1]; + this.ctx.globalAlpha = state[1]; + break; + case 'BM': + if (value && value.name && (value.name !== 'Normal')) { + var mode = value.name.replace(/([A-Z])/g, + function(c) { + return '-' + c.toLowerCase(); + } + ).substring(1); + this.ctx.globalCompositeOperation = mode; + if (this.ctx.globalCompositeOperation !== mode) { + warn('globalCompositeOperation "' + mode + + '" is not supported'); + } + } else { + this.ctx.globalCompositeOperation = 'source-over'; + } + break; + case 'SMask': + if (this.current.activeSMask) { + this.endSMaskGroup(); + } + this.current.activeSMask = value ? this.tempSMask : null; + if (this.current.activeSMask) { + this.beginSMaskGroup(); + } + this.tempSMask = null; + break; + } + } + }, + beginSMaskGroup: function CanvasGraphics_beginSMaskGroup() { + + var activeSMask = this.current.activeSMask; + var drawnWidth = activeSMask.canvas.width; + var drawnHeight = activeSMask.canvas.height; + var cacheId = 'smaskGroupAt' + this.groupLevel; + var scratchCanvas = CachedCanvases.getCanvas( + cacheId, drawnWidth, drawnHeight, true); + + var currentCtx = this.ctx; + var currentTransform = currentCtx.mozCurrentTransform; + this.ctx.save(); + + var groupCtx = scratchCanvas.context; + groupCtx.scale(1 / activeSMask.scaleX, 1 / activeSMask.scaleY); + groupCtx.translate(-activeSMask.offsetX, -activeSMask.offsetY); + groupCtx.transform.apply(groupCtx, currentTransform); + + copyCtxState(currentCtx, groupCtx); + this.ctx = groupCtx; + this.setGState([ + ['BM', 'Normal'], + ['ca', 1], + ['CA', 1] + ]); + this.groupStack.push(currentCtx); + this.groupLevel++; + }, + endSMaskGroup: function CanvasGraphics_endSMaskGroup() { + var groupCtx = this.ctx; + this.groupLevel--; + this.ctx = this.groupStack.pop(); + + composeSMask(this.ctx, this.current.activeSMask, groupCtx); + this.ctx.restore(); + }, + save: function CanvasGraphics_save() { + this.ctx.save(); + var old = this.current; + this.stateStack.push(old); + this.current = old.clone(); + this.current.activeSMask = null; + }, + restore: function CanvasGraphics_restore() { + if (this.stateStack.length !== 0) { + if (this.current.activeSMask !== null) { + this.endSMaskGroup(); + } + + this.current = this.stateStack.pop(); + this.ctx.restore(); + + // Ensure that the clipping path is reset (fixes issue6413.pdf). + this.pendingClip = null; + + this.cachedGetSinglePixelWidth = null; + } + }, + transform: function CanvasGraphics_transform(a, b, c, d, e, f) { + this.ctx.transform(a, b, c, d, e, f); + + this.cachedGetSinglePixelWidth = null; + }, + + // Path + constructPath: function CanvasGraphics_constructPath(ops, args) { + var ctx = this.ctx; + var current = this.current; + var x = current.x, y = current.y; + for (var i = 0, j = 0, ii = ops.length; i < ii; i++) { + switch (ops[i] | 0) { + case OPS.rectangle: + x = args[j++]; + y = args[j++]; + var width = args[j++]; + var height = args[j++]; + if (width === 0) { + width = this.getSinglePixelWidth(); + } + if (height === 0) { + height = this.getSinglePixelWidth(); + } + var xw = x + width; + var yh = y + height; + this.ctx.moveTo(x, y); + this.ctx.lineTo(xw, y); + this.ctx.lineTo(xw, yh); + this.ctx.lineTo(x, yh); + this.ctx.lineTo(x, y); + this.ctx.closePath(); + break; + case OPS.moveTo: + x = args[j++]; + y = args[j++]; + ctx.moveTo(x, y); + break; + case OPS.lineTo: + x = args[j++]; + y = args[j++]; + ctx.lineTo(x, y); + break; + case OPS.curveTo: + x = args[j + 4]; + y = args[j + 5]; + ctx.bezierCurveTo(args[j], args[j + 1], args[j + 2], args[j + 3], + x, y); + j += 6; + break; + case OPS.curveTo2: + ctx.bezierCurveTo(x, y, args[j], args[j + 1], + args[j + 2], args[j + 3]); + x = args[j + 2]; + y = args[j + 3]; + j += 4; + break; + case OPS.curveTo3: + x = args[j + 2]; + y = args[j + 3]; + ctx.bezierCurveTo(args[j], args[j + 1], x, y, x, y); + j += 4; + break; + case OPS.closePath: + ctx.closePath(); + break; + } + } + current.setCurrentPoint(x, y); + }, + closePath: function CanvasGraphics_closePath() { + this.ctx.closePath(); + }, + stroke: function CanvasGraphics_stroke(consumePath) { + consumePath = typeof consumePath !== 'undefined' ? consumePath : true; + var ctx = this.ctx; + var strokeColor = this.current.strokeColor; + // Prevent drawing too thin lines by enforcing a minimum line width. + ctx.lineWidth = Math.max(this.getSinglePixelWidth() * MIN_WIDTH_FACTOR, + this.current.lineWidth); + // For stroke we want to temporarily change the global alpha to the + // stroking alpha. + ctx.globalAlpha = this.current.strokeAlpha; + if (strokeColor && strokeColor.hasOwnProperty('type') && + strokeColor.type === 'Pattern') { + // for patterns, we transform to pattern space, calculate + // the pattern, call stroke, and restore to user space + ctx.save(); + ctx.strokeStyle = strokeColor.getPattern(ctx, this); + ctx.stroke(); + ctx.restore(); + } else { + ctx.stroke(); + } + if (consumePath) { + this.consumePath(); + } + // Restore the global alpha to the fill alpha + ctx.globalAlpha = this.current.fillAlpha; + }, + closeStroke: function CanvasGraphics_closeStroke() { + this.closePath(); + this.stroke(); + }, + fill: function CanvasGraphics_fill(consumePath) { + consumePath = typeof consumePath !== 'undefined' ? consumePath : true; + var ctx = this.ctx; + var fillColor = this.current.fillColor; + var isPatternFill = this.current.patternFill; + var needRestore = false; + + if (isPatternFill) { + ctx.save(); + ctx.fillStyle = fillColor.getPattern(ctx, this); + needRestore = true; + } + + if (this.pendingEOFill) { + if (ctx.mozFillRule !== undefined) { + ctx.mozFillRule = 'evenodd'; + ctx.fill(); + ctx.mozFillRule = 'nonzero'; + } else { + ctx.fill('evenodd'); + } + this.pendingEOFill = false; + } else { + ctx.fill(); + } + + if (needRestore) { + ctx.restore(); + } + if (consumePath) { + this.consumePath(); + } + }, + eoFill: function CanvasGraphics_eoFill() { + this.pendingEOFill = true; + this.fill(); + }, + fillStroke: function CanvasGraphics_fillStroke() { + this.fill(false); + this.stroke(false); + + this.consumePath(); + }, + eoFillStroke: function CanvasGraphics_eoFillStroke() { + this.pendingEOFill = true; + this.fillStroke(); + }, + closeFillStroke: function CanvasGraphics_closeFillStroke() { + this.closePath(); + this.fillStroke(); + }, + closeEOFillStroke: function CanvasGraphics_closeEOFillStroke() { + this.pendingEOFill = true; + this.closePath(); + this.fillStroke(); + }, + endPath: function CanvasGraphics_endPath() { + this.consumePath(); + }, + + // Clipping + clip: function CanvasGraphics_clip() { + this.pendingClip = NORMAL_CLIP; + }, + eoClip: function CanvasGraphics_eoClip() { + this.pendingClip = EO_CLIP; + }, + + // Text + beginText: function CanvasGraphics_beginText() { + this.current.textMatrix = IDENTITY_MATRIX; + this.current.textMatrixScale = 1; + this.current.x = this.current.lineX = 0; + this.current.y = this.current.lineY = 0; + }, + endText: function CanvasGraphics_endText() { + var paths = this.pendingTextPaths; + var ctx = this.ctx; + if (paths === undefined) { + ctx.beginPath(); + return; + } + + ctx.save(); + ctx.beginPath(); + for (var i = 0; i < paths.length; i++) { + var path = paths[i]; + ctx.setTransform.apply(ctx, path.transform); + ctx.translate(path.x, path.y); + path.addToPath(ctx, path.fontSize); + } + ctx.restore(); + ctx.clip(); + ctx.beginPath(); + delete this.pendingTextPaths; + }, + setCharSpacing: function CanvasGraphics_setCharSpacing(spacing) { + this.current.charSpacing = spacing; + }, + setWordSpacing: function CanvasGraphics_setWordSpacing(spacing) { + this.current.wordSpacing = spacing; + }, + setHScale: function CanvasGraphics_setHScale(scale) { + this.current.textHScale = scale / 100; + }, + setLeading: function CanvasGraphics_setLeading(leading) { + this.current.leading = -leading; + }, + setFont: function CanvasGraphics_setFont(fontRefName, size) { + var fontObj = this.commonObjs.get(fontRefName); + var current = this.current; + + if (!fontObj) { + error('Can\'t find font for ' + fontRefName); + } + + current.fontMatrix = (fontObj.fontMatrix ? + fontObj.fontMatrix : FONT_IDENTITY_MATRIX); + + // A valid matrix needs all main diagonal elements to be non-zero + // This also ensures we bypass FF bugzilla bug #719844. + if (current.fontMatrix[0] === 0 || + current.fontMatrix[3] === 0) { + warn('Invalid font matrix for font ' + fontRefName); + } + + // The spec for Tf (setFont) says that 'size' specifies the font 'scale', + // and in some docs this can be negative (inverted x-y axes). + if (size < 0) { + size = -size; + current.fontDirection = -1; + } else { + current.fontDirection = 1; + } + + this.current.font = fontObj; + this.current.fontSize = size; + + if (fontObj.isType3Font) { + return; // we don't need ctx.font for Type3 fonts + } + + var name = fontObj.loadedName || 'sans-serif'; + var bold = fontObj.black ? (fontObj.bold ? '900' : 'bold') : + (fontObj.bold ? 'bold' : 'normal'); + + var italic = fontObj.italic ? 'italic' : 'normal'; + var typeface = '"' + name + '", ' + fontObj.fallbackName; + + // Some font backends cannot handle fonts below certain size. + // Keeping the font at minimal size and using the fontSizeScale to change + // the current transformation matrix before the fillText/strokeText. + // See https://bugzilla.mozilla.org/show_bug.cgi?id=726227 + var browserFontSize = size < MIN_FONT_SIZE ? MIN_FONT_SIZE : + size > MAX_FONT_SIZE ? MAX_FONT_SIZE : size; + this.current.fontSizeScale = size / browserFontSize; + + var rule = italic + ' ' + bold + ' ' + browserFontSize + 'px ' + typeface; + this.ctx.font = rule; + }, + setTextRenderingMode: function CanvasGraphics_setTextRenderingMode(mode) { + this.current.textRenderingMode = mode; + }, + setTextRise: function CanvasGraphics_setTextRise(rise) { + this.current.textRise = rise; + }, + moveText: function CanvasGraphics_moveText(x, y) { + this.current.x = this.current.lineX += x; + this.current.y = this.current.lineY += y; + }, + setLeadingMoveText: function CanvasGraphics_setLeadingMoveText(x, y) { + this.setLeading(-y); + this.moveText(x, y); + }, + setTextMatrix: function CanvasGraphics_setTextMatrix(a, b, c, d, e, f) { + this.current.textMatrix = [a, b, c, d, e, f]; + this.current.textMatrixScale = Math.sqrt(a * a + b * b); + + this.current.x = this.current.lineX = 0; + this.current.y = this.current.lineY = 0; + }, + nextLine: function CanvasGraphics_nextLine() { + this.moveText(0, this.current.leading); + }, + + paintChar: function CanvasGraphics_paintChar(character, x, y) { + var ctx = this.ctx; + var current = this.current; + var font = current.font; + var textRenderingMode = current.textRenderingMode; + var fontSize = current.fontSize / current.fontSizeScale; + var fillStrokeMode = textRenderingMode & + TextRenderingMode.FILL_STROKE_MASK; + var isAddToPathSet = !!(textRenderingMode & + TextRenderingMode.ADD_TO_PATH_FLAG); + + var addToPath; + if (font.disableFontFace || isAddToPathSet) { + addToPath = font.getPathGenerator(this.commonObjs, character); + } + + if (font.disableFontFace) { + ctx.save(); + ctx.translate(x, y); + ctx.beginPath(); + addToPath(ctx, fontSize); + if (fillStrokeMode === TextRenderingMode.FILL || + fillStrokeMode === TextRenderingMode.FILL_STROKE) { + ctx.fill(); + } + if (fillStrokeMode === TextRenderingMode.STROKE || + fillStrokeMode === TextRenderingMode.FILL_STROKE) { + ctx.stroke(); + } + ctx.restore(); + } else { + if (fillStrokeMode === TextRenderingMode.FILL || + fillStrokeMode === TextRenderingMode.FILL_STROKE) { + ctx.fillText(character, x, y); + } + if (fillStrokeMode === TextRenderingMode.STROKE || + fillStrokeMode === TextRenderingMode.FILL_STROKE) { + ctx.strokeText(character, x, y); + } + } + + if (isAddToPathSet) { + var paths = this.pendingTextPaths || (this.pendingTextPaths = []); + paths.push({ + transform: ctx.mozCurrentTransform, + x: x, + y: y, + fontSize: fontSize, + addToPath: addToPath + }); + } + }, + + get isFontSubpixelAAEnabled() { + // Checks if anti-aliasing is enabled when scaled text is painted. + // On Windows GDI scaled fonts looks bad. + var ctx = document.createElement('canvas').getContext('2d'); + ctx.scale(1.5, 1); + ctx.fillText('I', 0, 10); + var data = ctx.getImageData(0, 0, 10, 10).data; + var enabled = false; + for (var i = 3; i < data.length; i += 4) { + if (data[i] > 0 && data[i] < 255) { + enabled = true; + break; + } + } + return shadow(this, 'isFontSubpixelAAEnabled', enabled); + }, + + showText: function CanvasGraphics_showText(glyphs) { + var current = this.current; + var font = current.font; + if (font.isType3Font) { + return this.showType3Text(glyphs); + } + + var fontSize = current.fontSize; + if (fontSize === 0) { + return; + } + + var ctx = this.ctx; + var fontSizeScale = current.fontSizeScale; + var charSpacing = current.charSpacing; + var wordSpacing = current.wordSpacing; + var fontDirection = current.fontDirection; + var textHScale = current.textHScale * fontDirection; + var glyphsLength = glyphs.length; + var vertical = font.vertical; + var spacingDir = vertical ? 1 : -1; + var defaultVMetrics = font.defaultVMetrics; + var widthAdvanceScale = fontSize * current.fontMatrix[0]; + + var simpleFillText = + current.textRenderingMode === TextRenderingMode.FILL && + !font.disableFontFace; + + ctx.save(); + ctx.transform.apply(ctx, current.textMatrix); + ctx.translate(current.x, current.y + current.textRise); + + if (fontDirection > 0) { + ctx.scale(textHScale, -1); + } else { + ctx.scale(textHScale, 1); + } + + var lineWidth = current.lineWidth; + var scale = current.textMatrixScale; + if (scale === 0 || lineWidth === 0) { + var fillStrokeMode = current.textRenderingMode & + TextRenderingMode.FILL_STROKE_MASK; + if (fillStrokeMode === TextRenderingMode.STROKE || + fillStrokeMode === TextRenderingMode.FILL_STROKE) { + this.cachedGetSinglePixelWidth = null; + lineWidth = this.getSinglePixelWidth() * MIN_WIDTH_FACTOR; + } + } else { + lineWidth /= scale; + } + + if (fontSizeScale !== 1.0) { + ctx.scale(fontSizeScale, fontSizeScale); + lineWidth /= fontSizeScale; + } + + ctx.lineWidth = lineWidth; + + var x = 0, i; + for (i = 0; i < glyphsLength; ++i) { + var glyph = glyphs[i]; + if (glyph === null) { + // word break + x += fontDirection * wordSpacing; + continue; + } else if (isNum(glyph)) { + x += spacingDir * glyph * fontSize / 1000; + continue; + } + + var restoreNeeded = false; + var character = glyph.fontChar; + var accent = glyph.accent; + var scaledX, scaledY, scaledAccentX, scaledAccentY; + var width = glyph.width; + if (vertical) { + var vmetric, vx, vy; + vmetric = glyph.vmetric || defaultVMetrics; + vx = glyph.vmetric ? vmetric[1] : width * 0.5; + vx = -vx * widthAdvanceScale; + vy = vmetric[2] * widthAdvanceScale; + + width = vmetric ? -vmetric[0] : width; + scaledX = vx / fontSizeScale; + scaledY = (x + vy) / fontSizeScale; + } else { + scaledX = x / fontSizeScale; + scaledY = 0; + } + + if (font.remeasure && width > 0 && this.isFontSubpixelAAEnabled) { + // some standard fonts may not have the exact width, trying to + // rescale per character + var measuredWidth = ctx.measureText(character).width * 1000 / + fontSize * fontSizeScale; + var characterScaleX = width / measuredWidth; + restoreNeeded = true; + ctx.save(); + ctx.scale(characterScaleX, 1); + scaledX /= characterScaleX; + } + + if (simpleFillText && !accent) { + // common case + ctx.fillText(character, scaledX, scaledY); + } else { + this.paintChar(character, scaledX, scaledY); + if (accent) { + scaledAccentX = scaledX + accent.offset.x / fontSizeScale; + scaledAccentY = scaledY - accent.offset.y / fontSizeScale; + this.paintChar(accent.fontChar, scaledAccentX, scaledAccentY); + } + } + + var charWidth = width * widthAdvanceScale + charSpacing * fontDirection; + x += charWidth; + + if (restoreNeeded) { + ctx.restore(); + } + } + if (vertical) { + current.y -= x * textHScale; + } else { + current.x += x * textHScale; + } + ctx.restore(); + }, + + showType3Text: function CanvasGraphics_showType3Text(glyphs) { + // Type3 fonts - each glyph is a "mini-PDF" + var ctx = this.ctx; + var current = this.current; + var font = current.font; + var fontSize = current.fontSize; + var fontDirection = current.fontDirection; + var spacingDir = font.vertical ? 1 : -1; + var charSpacing = current.charSpacing; + var wordSpacing = current.wordSpacing; + var textHScale = current.textHScale * fontDirection; + var fontMatrix = current.fontMatrix || FONT_IDENTITY_MATRIX; + var glyphsLength = glyphs.length; + var isTextInvisible = + current.textRenderingMode === TextRenderingMode.INVISIBLE; + var i, glyph, width, spacingLength; + + if (isTextInvisible || fontSize === 0) { + return; + } + this.cachedGetSinglePixelWidth = null; + + ctx.save(); + ctx.transform.apply(ctx, current.textMatrix); + ctx.translate(current.x, current.y); + + ctx.scale(textHScale, fontDirection); + + for (i = 0; i < glyphsLength; ++i) { + glyph = glyphs[i]; + if (glyph === null) { + // word break + this.ctx.translate(wordSpacing, 0); + current.x += wordSpacing * textHScale; + continue; + } else if (isNum(glyph)) { + spacingLength = spacingDir * glyph * fontSize / 1000; + this.ctx.translate(spacingLength, 0); + current.x += spacingLength * textHScale; + continue; + } + + var operatorList = font.charProcOperatorList[glyph.operatorListId]; + if (!operatorList) { + warn('Type3 character \"' + glyph.operatorListId + + '\" is not available'); + continue; + } + this.processingType3 = glyph; + this.save(); + ctx.scale(fontSize, fontSize); + ctx.transform.apply(ctx, fontMatrix); + this.executeOperatorList(operatorList); + this.restore(); + + var transformed = Util.applyTransform([glyph.width, 0], fontMatrix); + width = transformed[0] * fontSize + charSpacing; + + ctx.translate(width, 0); + current.x += width * textHScale; + } + ctx.restore(); + this.processingType3 = null; + }, + + // Type3 fonts + setCharWidth: function CanvasGraphics_setCharWidth(xWidth, yWidth) { + // We can safely ignore this since the width should be the same + // as the width in the Widths array. + }, + setCharWidthAndBounds: function CanvasGraphics_setCharWidthAndBounds(xWidth, + yWidth, + llx, + lly, + urx, + ury) { + // TODO According to the spec we're also suppose to ignore any operators + // that set color or include images while processing this type3 font. + this.ctx.rect(llx, lly, urx - llx, ury - lly); + this.clip(); + this.endPath(); + }, + + // Color + getColorN_Pattern: function CanvasGraphics_getColorN_Pattern(IR) { + var pattern; + if (IR[0] === 'TilingPattern') { + var color = IR[1]; + var baseTransform = this.baseTransform || + this.ctx.mozCurrentTransform.slice(); + pattern = new TilingPattern(IR, color, this.ctx, this.objs, + this.commonObjs, baseTransform); + } else { + pattern = getShadingPatternFromIR(IR); + } + return pattern; + }, + setStrokeColorN: function CanvasGraphics_setStrokeColorN(/*...*/) { + this.current.strokeColor = this.getColorN_Pattern(arguments); + }, + setFillColorN: function CanvasGraphics_setFillColorN(/*...*/) { + this.current.fillColor = this.getColorN_Pattern(arguments); + this.current.patternFill = true; + }, + setStrokeRGBColor: function CanvasGraphics_setStrokeRGBColor(r, g, b) { + var color = Util.makeCssRgb(r, g, b); + this.ctx.strokeStyle = color; + this.current.strokeColor = color; + }, + setFillRGBColor: function CanvasGraphics_setFillRGBColor(r, g, b) { + var color = Util.makeCssRgb(r, g, b); + this.ctx.fillStyle = color; + this.current.fillColor = color; + this.current.patternFill = false; + }, + + shadingFill: function CanvasGraphics_shadingFill(patternIR) { + var ctx = this.ctx; + + this.save(); + var pattern = getShadingPatternFromIR(patternIR); + ctx.fillStyle = pattern.getPattern(ctx, this, true); + + var inv = ctx.mozCurrentTransformInverse; + if (inv) { + var canvas = ctx.canvas; + var width = canvas.width; + var height = canvas.height; + + var bl = Util.applyTransform([0, 0], inv); + var br = Util.applyTransform([0, height], inv); + var ul = Util.applyTransform([width, 0], inv); + var ur = Util.applyTransform([width, height], inv); + + var x0 = Math.min(bl[0], br[0], ul[0], ur[0]); + var y0 = Math.min(bl[1], br[1], ul[1], ur[1]); + var x1 = Math.max(bl[0], br[0], ul[0], ur[0]); + var y1 = Math.max(bl[1], br[1], ul[1], ur[1]); + + this.ctx.fillRect(x0, y0, x1 - x0, y1 - y0); + } else { + // HACK to draw the gradient onto an infinite rectangle. + // PDF gradients are drawn across the entire image while + // Canvas only allows gradients to be drawn in a rectangle + // The following bug should allow us to remove this. + // https://bugzilla.mozilla.org/show_bug.cgi?id=664884 + + this.ctx.fillRect(-1e10, -1e10, 2e10, 2e10); + } + + this.restore(); + }, + + // Images + beginInlineImage: function CanvasGraphics_beginInlineImage() { + error('Should not call beginInlineImage'); + }, + beginImageData: function CanvasGraphics_beginImageData() { + error('Should not call beginImageData'); + }, + + paintFormXObjectBegin: function CanvasGraphics_paintFormXObjectBegin(matrix, + bbox) { + this.save(); + this.baseTransformStack.push(this.baseTransform); + + if (isArray(matrix) && 6 === matrix.length) { + this.transform.apply(this, matrix); + } + + this.baseTransform = this.ctx.mozCurrentTransform; + + if (isArray(bbox) && 4 === bbox.length) { + var width = bbox[2] - bbox[0]; + var height = bbox[3] - bbox[1]; + this.ctx.rect(bbox[0], bbox[1], width, height); + this.clip(); + this.endPath(); + } + }, + + paintFormXObjectEnd: function CanvasGraphics_paintFormXObjectEnd() { + this.restore(); + this.baseTransform = this.baseTransformStack.pop(); + }, + + beginGroup: function CanvasGraphics_beginGroup(group) { + this.save(); + var currentCtx = this.ctx; + // TODO non-isolated groups - according to Rik at adobe non-isolated + // group results aren't usually that different and they even have tools + // that ignore this setting. Notes from Rik on implmenting: + // - When you encounter an transparency group, create a new canvas with + // the dimensions of the bbox + // - copy the content from the previous canvas to the new canvas + // - draw as usual + // - remove the backdrop alpha: + // alphaNew = 1 - (1 - alpha)/(1 - alphaBackdrop) with 'alpha' the alpha + // value of your transparency group and 'alphaBackdrop' the alpha of the + // backdrop + // - remove background color: + // colorNew = color - alphaNew *colorBackdrop /(1 - alphaNew) + if (!group.isolated) { + info('TODO: Support non-isolated groups.'); + } + + // TODO knockout - supposedly possible with the clever use of compositing + // modes. + if (group.knockout) { + warn('Knockout groups not supported.'); + } + + var currentTransform = currentCtx.mozCurrentTransform; + if (group.matrix) { + currentCtx.transform.apply(currentCtx, group.matrix); + } + assert(group.bbox, 'Bounding box is required.'); + + // Based on the current transform figure out how big the bounding box + // will actually be. + var bounds = Util.getAxialAlignedBoundingBox( + group.bbox, + currentCtx.mozCurrentTransform); + // Clip the bounding box to the current canvas. + var canvasBounds = [0, + 0, + currentCtx.canvas.width, + currentCtx.canvas.height]; + bounds = Util.intersect(bounds, canvasBounds) || [0, 0, 0, 0]; + // Use ceil in case we're between sizes so we don't create canvas that is + // too small and make the canvas at least 1x1 pixels. + var offsetX = Math.floor(bounds[0]); + var offsetY = Math.floor(bounds[1]); + var drawnWidth = Math.max(Math.ceil(bounds[2]) - offsetX, 1); + var drawnHeight = Math.max(Math.ceil(bounds[3]) - offsetY, 1); + var scaleX = 1, scaleY = 1; + if (drawnWidth > MAX_GROUP_SIZE) { + scaleX = drawnWidth / MAX_GROUP_SIZE; + drawnWidth = MAX_GROUP_SIZE; + } + if (drawnHeight > MAX_GROUP_SIZE) { + scaleY = drawnHeight / MAX_GROUP_SIZE; + drawnHeight = MAX_GROUP_SIZE; + } + + var cacheId = 'groupAt' + this.groupLevel; + if (group.smask) { + // Using two cache entries is case if masks are used one after another. + cacheId += '_smask_' + ((this.smaskCounter++) % 2); + } + var scratchCanvas = CachedCanvases.getCanvas( + cacheId, drawnWidth, drawnHeight, true); + var groupCtx = scratchCanvas.context; + + // Since we created a new canvas that is just the size of the bounding box + // we have to translate the group ctx. + groupCtx.scale(1 / scaleX, 1 / scaleY); + groupCtx.translate(-offsetX, -offsetY); + groupCtx.transform.apply(groupCtx, currentTransform); + + if (group.smask) { + // Saving state and cached mask to be used in setGState. + this.smaskStack.push({ + canvas: scratchCanvas.canvas, + context: groupCtx, + offsetX: offsetX, + offsetY: offsetY, + scaleX: scaleX, + scaleY: scaleY, + subtype: group.smask.subtype, + backdrop: group.smask.backdrop + }); + } else { + // Setup the current ctx so when the group is popped we draw it at the + // right location. + currentCtx.setTransform(1, 0, 0, 1, 0, 0); + currentCtx.translate(offsetX, offsetY); + currentCtx.scale(scaleX, scaleY); + } + // The transparency group inherits all off the current graphics state + // except the blend mode, soft mask, and alpha constants. + copyCtxState(currentCtx, groupCtx); + this.ctx = groupCtx; + this.setGState([ + ['BM', 'Normal'], + ['ca', 1], + ['CA', 1] + ]); + this.groupStack.push(currentCtx); + this.groupLevel++; + }, + + endGroup: function CanvasGraphics_endGroup(group) { + this.groupLevel--; + var groupCtx = this.ctx; + this.ctx = this.groupStack.pop(); + // Turn off image smoothing to avoid sub pixel interpolation which can + // look kind of blurry for some pdfs. + if (this.ctx.imageSmoothingEnabled !== undefined) { + this.ctx.imageSmoothingEnabled = false; + } else { + this.ctx.mozImageSmoothingEnabled = false; + } + if (group.smask) { + this.tempSMask = this.smaskStack.pop(); + } else { + this.ctx.drawImage(groupCtx.canvas, 0, 0); + } + this.restore(); + }, + + beginAnnotations: function CanvasGraphics_beginAnnotations() { + this.save(); + this.current = new CanvasExtraState(); + }, + + endAnnotations: function CanvasGraphics_endAnnotations() { + this.restore(); + }, + + beginAnnotation: function CanvasGraphics_beginAnnotation(rect, transform, + matrix) { + this.save(); + + if (isArray(rect) && 4 === rect.length) { + var width = rect[2] - rect[0]; + var height = rect[3] - rect[1]; + this.ctx.rect(rect[0], rect[1], width, height); + this.clip(); + this.endPath(); + } + + this.transform.apply(this, transform); + this.transform.apply(this, matrix); + }, + + endAnnotation: function CanvasGraphics_endAnnotation() { + this.restore(); + }, + + paintJpegXObject: function CanvasGraphics_paintJpegXObject(objId, w, h) { + var domImage = this.objs.get(objId); + if (!domImage) { + warn('Dependent image isn\'t ready yet'); + return; + } + + this.save(); + + var ctx = this.ctx; + // scale the image to the unit square + ctx.scale(1 / w, -1 / h); + + ctx.drawImage(domImage, 0, 0, domImage.width, domImage.height, + 0, -h, w, h); + if (this.imageLayer) { + var currentTransform = ctx.mozCurrentTransformInverse; + var position = this.getCanvasPosition(0, 0); + this.imageLayer.appendImage({ + objId: objId, + left: position[0], + top: position[1], + width: w / currentTransform[0], + height: h / currentTransform[3] + }); + } + this.restore(); + }, + + paintImageMaskXObject: function CanvasGraphics_paintImageMaskXObject(img) { + var ctx = this.ctx; + var width = img.width, height = img.height; + var fillColor = this.current.fillColor; + var isPatternFill = this.current.patternFill; + + var glyph = this.processingType3; + + if (COMPILE_TYPE3_GLYPHS && glyph && glyph.compiled === undefined) { + if (width <= MAX_SIZE_TO_COMPILE && height <= MAX_SIZE_TO_COMPILE) { + glyph.compiled = + compileType3Glyph({data: img.data, width: width, height: height}); + } else { + glyph.compiled = null; + } + } + + if (glyph && glyph.compiled) { + glyph.compiled(ctx); + return; + } + + var maskCanvas = CachedCanvases.getCanvas('maskCanvas', width, height); + var maskCtx = maskCanvas.context; + maskCtx.save(); + + putBinaryImageMask(maskCtx, img); + + maskCtx.globalCompositeOperation = 'source-in'; + + maskCtx.fillStyle = isPatternFill ? + fillColor.getPattern(maskCtx, this) : fillColor; + maskCtx.fillRect(0, 0, width, height); + + maskCtx.restore(); + + this.paintInlineImageXObject(maskCanvas.canvas); + }, + + paintImageMaskXObjectRepeat: + function CanvasGraphics_paintImageMaskXObjectRepeat(imgData, scaleX, + scaleY, positions) { + var width = imgData.width; + var height = imgData.height; + var fillColor = this.current.fillColor; + var isPatternFill = this.current.patternFill; + + var maskCanvas = CachedCanvases.getCanvas('maskCanvas', width, height); + var maskCtx = maskCanvas.context; + maskCtx.save(); + + putBinaryImageMask(maskCtx, imgData); + + maskCtx.globalCompositeOperation = 'source-in'; + + maskCtx.fillStyle = isPatternFill ? + fillColor.getPattern(maskCtx, this) : fillColor; + maskCtx.fillRect(0, 0, width, height); + + maskCtx.restore(); + + var ctx = this.ctx; + for (var i = 0, ii = positions.length; i < ii; i += 2) { + ctx.save(); + ctx.transform(scaleX, 0, 0, scaleY, positions[i], positions[i + 1]); + ctx.scale(1, -1); + ctx.drawImage(maskCanvas.canvas, 0, 0, width, height, + 0, -1, 1, 1); + ctx.restore(); + } + }, + + paintImageMaskXObjectGroup: + function CanvasGraphics_paintImageMaskXObjectGroup(images) { + var ctx = this.ctx; + + var fillColor = this.current.fillColor; + var isPatternFill = this.current.patternFill; + for (var i = 0, ii = images.length; i < ii; i++) { + var image = images[i]; + var width = image.width, height = image.height; + + var maskCanvas = CachedCanvases.getCanvas('maskCanvas', width, height); + var maskCtx = maskCanvas.context; + maskCtx.save(); + + putBinaryImageMask(maskCtx, image); + + maskCtx.globalCompositeOperation = 'source-in'; + + maskCtx.fillStyle = isPatternFill ? + fillColor.getPattern(maskCtx, this) : fillColor; + maskCtx.fillRect(0, 0, width, height); + + maskCtx.restore(); + + ctx.save(); + ctx.transform.apply(ctx, image.transform); + ctx.scale(1, -1); + ctx.drawImage(maskCanvas.canvas, 0, 0, width, height, + 0, -1, 1, 1); + ctx.restore(); + } + }, + + paintImageXObject: function CanvasGraphics_paintImageXObject(objId) { + var imgData = this.objs.get(objId); + if (!imgData) { + warn('Dependent image isn\'t ready yet'); + return; + } + + this.paintInlineImageXObject(imgData); + }, + + paintImageXObjectRepeat: + function CanvasGraphics_paintImageXObjectRepeat(objId, scaleX, scaleY, + positions) { + var imgData = this.objs.get(objId); + if (!imgData) { + warn('Dependent image isn\'t ready yet'); + return; + } + + var width = imgData.width; + var height = imgData.height; + var map = []; + for (var i = 0, ii = positions.length; i < ii; i += 2) { + map.push({transform: [scaleX, 0, 0, scaleY, positions[i], + positions[i + 1]], x: 0, y: 0, w: width, h: height}); + } + this.paintInlineImageXObjectGroup(imgData, map); + }, + + paintInlineImageXObject: + function CanvasGraphics_paintInlineImageXObject(imgData) { + var width = imgData.width; + var height = imgData.height; + var ctx = this.ctx; + + this.save(); + // scale the image to the unit square + ctx.scale(1 / width, -1 / height); + + var currentTransform = ctx.mozCurrentTransformInverse; + var a = currentTransform[0], b = currentTransform[1]; + var widthScale = Math.max(Math.sqrt(a * a + b * b), 1); + var c = currentTransform[2], d = currentTransform[3]; + var heightScale = Math.max(Math.sqrt(c * c + d * d), 1); + + var imgToPaint, tmpCanvas; + // instanceof HTMLElement does not work in jsdom node.js module + if (imgData instanceof HTMLElement || !imgData.data) { + imgToPaint = imgData; + } else { + tmpCanvas = CachedCanvases.getCanvas('inlineImage', width, height); + var tmpCtx = tmpCanvas.context; + putBinaryImageData(tmpCtx, imgData); + imgToPaint = tmpCanvas.canvas; + } + + var paintWidth = width, paintHeight = height; + var tmpCanvasId = 'prescale1'; + // Vertial or horizontal scaling shall not be more than 2 to not loose the + // pixels during drawImage operation, painting on the temporary canvas(es) + // that are twice smaller in size + while ((widthScale > 2 && paintWidth > 1) || + (heightScale > 2 && paintHeight > 1)) { + var newWidth = paintWidth, newHeight = paintHeight; + if (widthScale > 2 && paintWidth > 1) { + newWidth = Math.ceil(paintWidth / 2); + widthScale /= paintWidth / newWidth; + } + if (heightScale > 2 && paintHeight > 1) { + newHeight = Math.ceil(paintHeight / 2); + heightScale /= paintHeight / newHeight; + } + tmpCanvas = CachedCanvases.getCanvas(tmpCanvasId, newWidth, newHeight); + tmpCtx = tmpCanvas.context; + tmpCtx.clearRect(0, 0, newWidth, newHeight); + tmpCtx.drawImage(imgToPaint, 0, 0, paintWidth, paintHeight, + 0, 0, newWidth, newHeight); + imgToPaint = tmpCanvas.canvas; + paintWidth = newWidth; + paintHeight = newHeight; + tmpCanvasId = tmpCanvasId === 'prescale1' ? 'prescale2' : 'prescale1'; + } + ctx.drawImage(imgToPaint, 0, 0, paintWidth, paintHeight, + 0, -height, width, height); + + if (this.imageLayer) { + var position = this.getCanvasPosition(0, -height); + this.imageLayer.appendImage({ + imgData: imgData, + left: position[0], + top: position[1], + width: width / currentTransform[0], + height: height / currentTransform[3] + }); + } + this.restore(); + }, + + paintInlineImageXObjectGroup: + function CanvasGraphics_paintInlineImageXObjectGroup(imgData, map) { + var ctx = this.ctx; + var w = imgData.width; + var h = imgData.height; + + var tmpCanvas = CachedCanvases.getCanvas('inlineImage', w, h); + var tmpCtx = tmpCanvas.context; + putBinaryImageData(tmpCtx, imgData); + + for (var i = 0, ii = map.length; i < ii; i++) { + var entry = map[i]; + ctx.save(); + ctx.transform.apply(ctx, entry.transform); + ctx.scale(1, -1); + ctx.drawImage(tmpCanvas.canvas, entry.x, entry.y, entry.w, entry.h, + 0, -1, 1, 1); + if (this.imageLayer) { + var position = this.getCanvasPosition(entry.x, entry.y); + this.imageLayer.appendImage({ + imgData: imgData, + left: position[0], + top: position[1], + width: w, + height: h + }); + } + ctx.restore(); + } + }, + + paintSolidColorImageMask: + function CanvasGraphics_paintSolidColorImageMask() { + this.ctx.fillRect(0, 0, 1, 1); + }, + + paintXObject: function CanvasGraphics_paintXObject() { + UnsupportedManager.notify(UNSUPPORTED_FEATURES.unknown); + warn('Unsupported \'paintXObject\' command.'); + }, + + // Marked content + + markPoint: function CanvasGraphics_markPoint(tag) { + // TODO Marked content. + }, + markPointProps: function CanvasGraphics_markPointProps(tag, properties) { + // TODO Marked content. + }, + beginMarkedContent: function CanvasGraphics_beginMarkedContent(tag) { + // TODO Marked content. + }, + beginMarkedContentProps: function CanvasGraphics_beginMarkedContentProps( + tag, properties) { + // TODO Marked content. + }, + endMarkedContent: function CanvasGraphics_endMarkedContent() { + // TODO Marked content. + }, + + // Compatibility + + beginCompat: function CanvasGraphics_beginCompat() { + // TODO ignore undefined operators (should we do that anyway?) + }, + endCompat: function CanvasGraphics_endCompat() { + // TODO stop ignoring undefined operators + }, + + // Helper functions + + consumePath: function CanvasGraphics_consumePath() { + var ctx = this.ctx; + if (this.pendingClip) { + if (this.pendingClip === EO_CLIP) { + if (ctx.mozFillRule !== undefined) { + ctx.mozFillRule = 'evenodd'; + ctx.clip(); + ctx.mozFillRule = 'nonzero'; + } else { + ctx.clip('evenodd'); + } + } else { + ctx.clip(); + } + this.pendingClip = null; + } + ctx.beginPath(); + }, + getSinglePixelWidth: function CanvasGraphics_getSinglePixelWidth(scale) { + if (this.cachedGetSinglePixelWidth === null) { + var inverse = this.ctx.mozCurrentTransformInverse; + // max of the current horizontal and vertical scale + this.cachedGetSinglePixelWidth = Math.sqrt(Math.max( + (inverse[0] * inverse[0] + inverse[1] * inverse[1]), + (inverse[2] * inverse[2] + inverse[3] * inverse[3]))); + } + return this.cachedGetSinglePixelWidth; + }, + getCanvasPosition: function CanvasGraphics_getCanvasPosition(x, y) { + var transform = this.ctx.mozCurrentTransform; + return [ + transform[0] * x + transform[2] * y + transform[4], + transform[1] * x + transform[3] * y + transform[5] + ]; + } + }; + + for (var op in OPS) { + CanvasGraphics.prototype[OPS[op]] = CanvasGraphics.prototype[op]; + } + + return CanvasGraphics; +})(); + + +var WebGLUtils = (function WebGLUtilsClosure() { + function loadShader(gl, code, shaderType) { + var shader = gl.createShader(shaderType); + gl.shaderSource(shader, code); + gl.compileShader(shader); + var compiled = gl.getShaderParameter(shader, gl.COMPILE_STATUS); + if (!compiled) { + var errorMsg = gl.getShaderInfoLog(shader); + throw new Error('Error during shader compilation: ' + errorMsg); + } + return shader; + } + function createVertexShader(gl, code) { + return loadShader(gl, code, gl.VERTEX_SHADER); + } + function createFragmentShader(gl, code) { + return loadShader(gl, code, gl.FRAGMENT_SHADER); + } + function createProgram(gl, shaders) { + var program = gl.createProgram(); + for (var i = 0, ii = shaders.length; i < ii; ++i) { + gl.attachShader(program, shaders[i]); + } + gl.linkProgram(program); + var linked = gl.getProgramParameter(program, gl.LINK_STATUS); + if (!linked) { + var errorMsg = gl.getProgramInfoLog(program); + throw new Error('Error during program linking: ' + errorMsg); + } + return program; + } + function createTexture(gl, image, textureId) { + gl.activeTexture(textureId); + var texture = gl.createTexture(); + gl.bindTexture(gl.TEXTURE_2D, texture); + + // Set the parameters so we can render any size image. + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST); + + // Upload the image into the texture. + gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, image); + return texture; + } + + var currentGL, currentCanvas; + function generateGL() { + if (currentGL) { + return; + } + currentCanvas = document.createElement('canvas'); + currentGL = currentCanvas.getContext('webgl', + { premultipliedalpha: false }); + } + + var smaskVertexShaderCode = '\ + attribute vec2 a_position; \ + attribute vec2 a_texCoord; \ + \ + uniform vec2 u_resolution; \ + \ + varying vec2 v_texCoord; \ + \ + void main() { \ + vec2 clipSpace = (a_position / u_resolution) * 2.0 - 1.0; \ + gl_Position = vec4(clipSpace * vec2(1, -1), 0, 1); \ + \ + v_texCoord = a_texCoord; \ + } '; + + var smaskFragmentShaderCode = '\ + precision mediump float; \ + \ + uniform vec4 u_backdrop; \ + uniform int u_subtype; \ + uniform sampler2D u_image; \ + uniform sampler2D u_mask; \ + \ + varying vec2 v_texCoord; \ + \ + void main() { \ + vec4 imageColor = texture2D(u_image, v_texCoord); \ + vec4 maskColor = texture2D(u_mask, v_texCoord); \ + if (u_backdrop.a > 0.0) { \ + maskColor.rgb = maskColor.rgb * maskColor.a + \ + u_backdrop.rgb * (1.0 - maskColor.a); \ + } \ + float lum; \ + if (u_subtype == 0) { \ + lum = maskColor.a; \ + } else { \ + lum = maskColor.r * 0.3 + maskColor.g * 0.59 + \ + maskColor.b * 0.11; \ + } \ + imageColor.a *= lum; \ + imageColor.rgb *= imageColor.a; \ + gl_FragColor = imageColor; \ + } '; + + var smaskCache = null; + + function initSmaskGL() { + var canvas, gl; + + generateGL(); + canvas = currentCanvas; + currentCanvas = null; + gl = currentGL; + currentGL = null; + + // setup a GLSL program + var vertexShader = createVertexShader(gl, smaskVertexShaderCode); + var fragmentShader = createFragmentShader(gl, smaskFragmentShaderCode); + var program = createProgram(gl, [vertexShader, fragmentShader]); + gl.useProgram(program); + + var cache = {}; + cache.gl = gl; + cache.canvas = canvas; + cache.resolutionLocation = gl.getUniformLocation(program, 'u_resolution'); + cache.positionLocation = gl.getAttribLocation(program, 'a_position'); + cache.backdropLocation = gl.getUniformLocation(program, 'u_backdrop'); + cache.subtypeLocation = gl.getUniformLocation(program, 'u_subtype'); + + var texCoordLocation = gl.getAttribLocation(program, 'a_texCoord'); + var texLayerLocation = gl.getUniformLocation(program, 'u_image'); + var texMaskLocation = gl.getUniformLocation(program, 'u_mask'); + + // provide texture coordinates for the rectangle. + var texCoordBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ARRAY_BUFFER, texCoordBuffer); + gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([ + 0.0, 0.0, + 1.0, 0.0, + 0.0, 1.0, + 0.0, 1.0, + 1.0, 0.0, + 1.0, 1.0]), gl.STATIC_DRAW); + gl.enableVertexAttribArray(texCoordLocation); + gl.vertexAttribPointer(texCoordLocation, 2, gl.FLOAT, false, 0, 0); + + gl.uniform1i(texLayerLocation, 0); + gl.uniform1i(texMaskLocation, 1); + + smaskCache = cache; + } + + function composeSMask(layer, mask, properties) { + var width = layer.width, height = layer.height; + + if (!smaskCache) { + initSmaskGL(); + } + var cache = smaskCache,canvas = cache.canvas, gl = cache.gl; + canvas.width = width; + canvas.height = height; + gl.viewport(0, 0, gl.drawingBufferWidth, gl.drawingBufferHeight); + gl.uniform2f(cache.resolutionLocation, width, height); + + if (properties.backdrop) { + gl.uniform4f(cache.resolutionLocation, properties.backdrop[0], + properties.backdrop[1], properties.backdrop[2], 1); + } else { + gl.uniform4f(cache.resolutionLocation, 0, 0, 0, 0); + } + gl.uniform1i(cache.subtypeLocation, + properties.subtype === 'Luminosity' ? 1 : 0); + + // Create a textures + var texture = createTexture(gl, layer, gl.TEXTURE0); + var maskTexture = createTexture(gl, mask, gl.TEXTURE1); + + + // Create a buffer and put a single clipspace rectangle in + // it (2 triangles) + var buffer = gl.createBuffer(); + gl.bindBuffer(gl.ARRAY_BUFFER, buffer); + gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([ + 0, 0, + width, 0, + 0, height, + 0, height, + width, 0, + width, height]), gl.STATIC_DRAW); + gl.enableVertexAttribArray(cache.positionLocation); + gl.vertexAttribPointer(cache.positionLocation, 2, gl.FLOAT, false, 0, 0); + + // draw + gl.clearColor(0, 0, 0, 0); + gl.enable(gl.BLEND); + gl.blendFunc(gl.ONE, gl.ONE_MINUS_SRC_ALPHA); + gl.clear(gl.COLOR_BUFFER_BIT); + + gl.drawArrays(gl.TRIANGLES, 0, 6); + + gl.flush(); + + gl.deleteTexture(texture); + gl.deleteTexture(maskTexture); + gl.deleteBuffer(buffer); + + return canvas; + } + + var figuresVertexShaderCode = '\ + attribute vec2 a_position; \ + attribute vec3 a_color; \ + \ + uniform vec2 u_resolution; \ + uniform vec2 u_scale; \ + uniform vec2 u_offset; \ + \ + varying vec4 v_color; \ + \ + void main() { \ + vec2 position = (a_position + u_offset) * u_scale; \ + vec2 clipSpace = (position / u_resolution) * 2.0 - 1.0; \ + gl_Position = vec4(clipSpace * vec2(1, -1), 0, 1); \ + \ + v_color = vec4(a_color / 255.0, 1.0); \ + } '; + + var figuresFragmentShaderCode = '\ + precision mediump float; \ + \ + varying vec4 v_color; \ + \ + void main() { \ + gl_FragColor = v_color; \ + } '; + + var figuresCache = null; + + function initFiguresGL() { + var canvas, gl; + + generateGL(); + canvas = currentCanvas; + currentCanvas = null; + gl = currentGL; + currentGL = null; + + // setup a GLSL program + var vertexShader = createVertexShader(gl, figuresVertexShaderCode); + var fragmentShader = createFragmentShader(gl, figuresFragmentShaderCode); + var program = createProgram(gl, [vertexShader, fragmentShader]); + gl.useProgram(program); + + var cache = {}; + cache.gl = gl; + cache.canvas = canvas; + cache.resolutionLocation = gl.getUniformLocation(program, 'u_resolution'); + cache.scaleLocation = gl.getUniformLocation(program, 'u_scale'); + cache.offsetLocation = gl.getUniformLocation(program, 'u_offset'); + cache.positionLocation = gl.getAttribLocation(program, 'a_position'); + cache.colorLocation = gl.getAttribLocation(program, 'a_color'); + + figuresCache = cache; + } + + function drawFigures(width, height, backgroundColor, figures, context) { + if (!figuresCache) { + initFiguresGL(); + } + var cache = figuresCache, canvas = cache.canvas, gl = cache.gl; + + canvas.width = width; + canvas.height = height; + gl.viewport(0, 0, gl.drawingBufferWidth, gl.drawingBufferHeight); + gl.uniform2f(cache.resolutionLocation, width, height); + + // count triangle points + var count = 0; + var i, ii, rows; + for (i = 0, ii = figures.length; i < ii; i++) { + switch (figures[i].type) { + case 'lattice': + rows = (figures[i].coords.length / figures[i].verticesPerRow) | 0; + count += (rows - 1) * (figures[i].verticesPerRow - 1) * 6; + break; + case 'triangles': + count += figures[i].coords.length; + break; + } + } + // transfer data + var coords = new Float32Array(count * 2); + var colors = new Uint8Array(count * 3); + var coordsMap = context.coords, colorsMap = context.colors; + var pIndex = 0, cIndex = 0; + for (i = 0, ii = figures.length; i < ii; i++) { + var figure = figures[i], ps = figure.coords, cs = figure.colors; + switch (figure.type) { + case 'lattice': + var cols = figure.verticesPerRow; + rows = (ps.length / cols) | 0; + for (var row = 1; row < rows; row++) { + var offset = row * cols + 1; + for (var col = 1; col < cols; col++, offset++) { + coords[pIndex] = coordsMap[ps[offset - cols - 1]]; + coords[pIndex + 1] = coordsMap[ps[offset - cols - 1] + 1]; + coords[pIndex + 2] = coordsMap[ps[offset - cols]]; + coords[pIndex + 3] = coordsMap[ps[offset - cols] + 1]; + coords[pIndex + 4] = coordsMap[ps[offset - 1]]; + coords[pIndex + 5] = coordsMap[ps[offset - 1] + 1]; + colors[cIndex] = colorsMap[cs[offset - cols - 1]]; + colors[cIndex + 1] = colorsMap[cs[offset - cols - 1] + 1]; + colors[cIndex + 2] = colorsMap[cs[offset - cols - 1] + 2]; + colors[cIndex + 3] = colorsMap[cs[offset - cols]]; + colors[cIndex + 4] = colorsMap[cs[offset - cols] + 1]; + colors[cIndex + 5] = colorsMap[cs[offset - cols] + 2]; + colors[cIndex + 6] = colorsMap[cs[offset - 1]]; + colors[cIndex + 7] = colorsMap[cs[offset - 1] + 1]; + colors[cIndex + 8] = colorsMap[cs[offset - 1] + 2]; + + coords[pIndex + 6] = coords[pIndex + 2]; + coords[pIndex + 7] = coords[pIndex + 3]; + coords[pIndex + 8] = coords[pIndex + 4]; + coords[pIndex + 9] = coords[pIndex + 5]; + coords[pIndex + 10] = coordsMap[ps[offset]]; + coords[pIndex + 11] = coordsMap[ps[offset] + 1]; + colors[cIndex + 9] = colors[cIndex + 3]; + colors[cIndex + 10] = colors[cIndex + 4]; + colors[cIndex + 11] = colors[cIndex + 5]; + colors[cIndex + 12] = colors[cIndex + 6]; + colors[cIndex + 13] = colors[cIndex + 7]; + colors[cIndex + 14] = colors[cIndex + 8]; + colors[cIndex + 15] = colorsMap[cs[offset]]; + colors[cIndex + 16] = colorsMap[cs[offset] + 1]; + colors[cIndex + 17] = colorsMap[cs[offset] + 2]; + pIndex += 12; + cIndex += 18; + } + } + break; + case 'triangles': + for (var j = 0, jj = ps.length; j < jj; j++) { + coords[pIndex] = coordsMap[ps[j]]; + coords[pIndex + 1] = coordsMap[ps[j] + 1]; + colors[cIndex] = colorsMap[cs[j]]; + colors[cIndex + 1] = colorsMap[cs[j] + 1]; + colors[cIndex + 2] = colorsMap[cs[j] + 2]; + pIndex += 2; + cIndex += 3; + } + break; + } + } + + // draw + if (backgroundColor) { + gl.clearColor(backgroundColor[0] / 255, backgroundColor[1] / 255, + backgroundColor[2] / 255, 1.0); + } else { + gl.clearColor(0, 0, 0, 0); + } + gl.clear(gl.COLOR_BUFFER_BIT); + + var coordsBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ARRAY_BUFFER, coordsBuffer); + gl.bufferData(gl.ARRAY_BUFFER, coords, gl.STATIC_DRAW); + gl.enableVertexAttribArray(cache.positionLocation); + gl.vertexAttribPointer(cache.positionLocation, 2, gl.FLOAT, false, 0, 0); + + var colorsBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ARRAY_BUFFER, colorsBuffer); + gl.bufferData(gl.ARRAY_BUFFER, colors, gl.STATIC_DRAW); + gl.enableVertexAttribArray(cache.colorLocation); + gl.vertexAttribPointer(cache.colorLocation, 3, gl.UNSIGNED_BYTE, false, + 0, 0); + + gl.uniform2f(cache.scaleLocation, context.scaleX, context.scaleY); + gl.uniform2f(cache.offsetLocation, context.offsetX, context.offsetY); + + gl.drawArrays(gl.TRIANGLES, 0, count); + + gl.flush(); + + gl.deleteBuffer(coordsBuffer); + gl.deleteBuffer(colorsBuffer); + + return canvas; + } + + function cleanup() { + if (smaskCache && smaskCache.canvas) { + smaskCache.canvas.width = 0; + smaskCache.canvas.height = 0; + } + if (figuresCache && figuresCache.canvas) { + figuresCache.canvas.width = 0; + figuresCache.canvas.height = 0; + } + smaskCache = null; + figuresCache = null; + } + + return { + get isEnabled() { + if (PDFJS.disableWebGL) { + return false; + } + var enabled = false; + try { + generateGL(); + enabled = !!currentGL; + } catch (e) { } + return shadow(this, 'isEnabled', enabled); + }, + composeSMask: composeSMask, + drawFigures: drawFigures, + clear: cleanup + }; +})(); + + +var ShadingIRs = {}; + +ShadingIRs.RadialAxial = { + fromIR: function RadialAxial_fromIR(raw) { + var type = raw[1]; + var colorStops = raw[2]; + var p0 = raw[3]; + var p1 = raw[4]; + var r0 = raw[5]; + var r1 = raw[6]; + return { + type: 'Pattern', + getPattern: function RadialAxial_getPattern(ctx) { + var grad; + if (type === 'axial') { + grad = ctx.createLinearGradient(p0[0], p0[1], p1[0], p1[1]); + } else if (type === 'radial') { + grad = ctx.createRadialGradient(p0[0], p0[1], r0, p1[0], p1[1], r1); + } + + for (var i = 0, ii = colorStops.length; i < ii; ++i) { + var c = colorStops[i]; + grad.addColorStop(c[0], c[1]); + } + return grad; + } + }; + } +}; + +var createMeshCanvas = (function createMeshCanvasClosure() { + function drawTriangle(data, context, p1, p2, p3, c1, c2, c3) { + // Very basic Gouraud-shaded triangle rasterization algorithm. + var coords = context.coords, colors = context.colors; + var bytes = data.data, rowSize = data.width * 4; + var tmp; + if (coords[p1 + 1] > coords[p2 + 1]) { + tmp = p1; p1 = p2; p2 = tmp; tmp = c1; c1 = c2; c2 = tmp; + } + if (coords[p2 + 1] > coords[p3 + 1]) { + tmp = p2; p2 = p3; p3 = tmp; tmp = c2; c2 = c3; c3 = tmp; + } + if (coords[p1 + 1] > coords[p2 + 1]) { + tmp = p1; p1 = p2; p2 = tmp; tmp = c1; c1 = c2; c2 = tmp; + } + var x1 = (coords[p1] + context.offsetX) * context.scaleX; + var y1 = (coords[p1 + 1] + context.offsetY) * context.scaleY; + var x2 = (coords[p2] + context.offsetX) * context.scaleX; + var y2 = (coords[p2 + 1] + context.offsetY) * context.scaleY; + var x3 = (coords[p3] + context.offsetX) * context.scaleX; + var y3 = (coords[p3 + 1] + context.offsetY) * context.scaleY; + if (y1 >= y3) { + return; + } + var c1r = colors[c1], c1g = colors[c1 + 1], c1b = colors[c1 + 2]; + var c2r = colors[c2], c2g = colors[c2 + 1], c2b = colors[c2 + 2]; + var c3r = colors[c3], c3g = colors[c3 + 1], c3b = colors[c3 + 2]; + + var minY = Math.round(y1), maxY = Math.round(y3); + var xa, car, cag, cab; + var xb, cbr, cbg, cbb; + var k; + for (var y = minY; y <= maxY; y++) { + if (y < y2) { + k = y < y1 ? 0 : y1 === y2 ? 1 : (y1 - y) / (y1 - y2); + xa = x1 - (x1 - x2) * k; + car = c1r - (c1r - c2r) * k; + cag = c1g - (c1g - c2g) * k; + cab = c1b - (c1b - c2b) * k; + } else { + k = y > y3 ? 1 : y2 === y3 ? 0 : (y2 - y) / (y2 - y3); + xa = x2 - (x2 - x3) * k; + car = c2r - (c2r - c3r) * k; + cag = c2g - (c2g - c3g) * k; + cab = c2b - (c2b - c3b) * k; + } + k = y < y1 ? 0 : y > y3 ? 1 : (y1 - y) / (y1 - y3); + xb = x1 - (x1 - x3) * k; + cbr = c1r - (c1r - c3r) * k; + cbg = c1g - (c1g - c3g) * k; + cbb = c1b - (c1b - c3b) * k; + var x1_ = Math.round(Math.min(xa, xb)); + var x2_ = Math.round(Math.max(xa, xb)); + var j = rowSize * y + x1_ * 4; + for (var x = x1_; x <= x2_; x++) { + k = (xa - x) / (xa - xb); + k = k < 0 ? 0 : k > 1 ? 1 : k; + bytes[j++] = (car - (car - cbr) * k) | 0; + bytes[j++] = (cag - (cag - cbg) * k) | 0; + bytes[j++] = (cab - (cab - cbb) * k) | 0; + bytes[j++] = 255; + } + } + } + + function drawFigure(data, figure, context) { + var ps = figure.coords; + var cs = figure.colors; + var i, ii; + switch (figure.type) { + case 'lattice': + var verticesPerRow = figure.verticesPerRow; + var rows = Math.floor(ps.length / verticesPerRow) - 1; + var cols = verticesPerRow - 1; + for (i = 0; i < rows; i++) { + var q = i * verticesPerRow; + for (var j = 0; j < cols; j++, q++) { + drawTriangle(data, context, + ps[q], ps[q + 1], ps[q + verticesPerRow], + cs[q], cs[q + 1], cs[q + verticesPerRow]); + drawTriangle(data, context, + ps[q + verticesPerRow + 1], ps[q + 1], ps[q + verticesPerRow], + cs[q + verticesPerRow + 1], cs[q + 1], cs[q + verticesPerRow]); + } + } + break; + case 'triangles': + for (i = 0, ii = ps.length; i < ii; i += 3) { + drawTriangle(data, context, + ps[i], ps[i + 1], ps[i + 2], + cs[i], cs[i + 1], cs[i + 2]); + } + break; + default: + error('illigal figure'); + break; + } + } + + function createMeshCanvas(bounds, combinesScale, coords, colors, figures, + backgroundColor) { + // we will increase scale on some weird factor to let antialiasing take + // care of "rough" edges + var EXPECTED_SCALE = 1.1; + // MAX_PATTERN_SIZE is used to avoid OOM situation. + var MAX_PATTERN_SIZE = 3000; // 10in @ 300dpi shall be enough + + var offsetX = Math.floor(bounds[0]); + var offsetY = Math.floor(bounds[1]); + var boundsWidth = Math.ceil(bounds[2]) - offsetX; + var boundsHeight = Math.ceil(bounds[3]) - offsetY; + + var width = Math.min(Math.ceil(Math.abs(boundsWidth * combinesScale[0] * + EXPECTED_SCALE)), MAX_PATTERN_SIZE); + var height = Math.min(Math.ceil(Math.abs(boundsHeight * combinesScale[1] * + EXPECTED_SCALE)), MAX_PATTERN_SIZE); + var scaleX = boundsWidth / width; + var scaleY = boundsHeight / height; + + var context = { + coords: coords, + colors: colors, + offsetX: -offsetX, + offsetY: -offsetY, + scaleX: 1 / scaleX, + scaleY: 1 / scaleY + }; + + var canvas, tmpCanvas, i, ii; + if (WebGLUtils.isEnabled) { + canvas = WebGLUtils.drawFigures(width, height, backgroundColor, + figures, context); + + // https://bugzilla.mozilla.org/show_bug.cgi?id=972126 + tmpCanvas = CachedCanvases.getCanvas('mesh', width, height, false); + tmpCanvas.context.drawImage(canvas, 0, 0); + canvas = tmpCanvas.canvas; + } else { + tmpCanvas = CachedCanvases.getCanvas('mesh', width, height, false); + var tmpCtx = tmpCanvas.context; + + var data = tmpCtx.createImageData(width, height); + if (backgroundColor) { + var bytes = data.data; + for (i = 0, ii = bytes.length; i < ii; i += 4) { + bytes[i] = backgroundColor[0]; + bytes[i + 1] = backgroundColor[1]; + bytes[i + 2] = backgroundColor[2]; + bytes[i + 3] = 255; + } + } + for (i = 0; i < figures.length; i++) { + drawFigure(data, figures[i], context); + } + tmpCtx.putImageData(data, 0, 0); + canvas = tmpCanvas.canvas; + } + + return {canvas: canvas, offsetX: offsetX, offsetY: offsetY, + scaleX: scaleX, scaleY: scaleY}; + } + return createMeshCanvas; +})(); + +ShadingIRs.Mesh = { + fromIR: function Mesh_fromIR(raw) { + //var type = raw[1]; + var coords = raw[2]; + var colors = raw[3]; + var figures = raw[4]; + var bounds = raw[5]; + var matrix = raw[6]; + //var bbox = raw[7]; + var background = raw[8]; + return { + type: 'Pattern', + getPattern: function Mesh_getPattern(ctx, owner, shadingFill) { + var scale; + if (shadingFill) { + scale = Util.singularValueDecompose2dScale(ctx.mozCurrentTransform); + } else { + // Obtain scale from matrix and current transformation matrix. + scale = Util.singularValueDecompose2dScale(owner.baseTransform); + if (matrix) { + var matrixScale = Util.singularValueDecompose2dScale(matrix); + scale = [scale[0] * matrixScale[0], + scale[1] * matrixScale[1]]; + } + } + + + // Rasterizing on the main thread since sending/queue large canvases + // might cause OOM. + var temporaryPatternCanvas = createMeshCanvas(bounds, scale, coords, + colors, figures, shadingFill ? null : background); + + if (!shadingFill) { + ctx.setTransform.apply(ctx, owner.baseTransform); + if (matrix) { + ctx.transform.apply(ctx, matrix); + } + } + + ctx.translate(temporaryPatternCanvas.offsetX, + temporaryPatternCanvas.offsetY); + ctx.scale(temporaryPatternCanvas.scaleX, + temporaryPatternCanvas.scaleY); + + return ctx.createPattern(temporaryPatternCanvas.canvas, 'no-repeat'); + } + }; + } +}; + +ShadingIRs.Dummy = { + fromIR: function Dummy_fromIR() { + return { + type: 'Pattern', + getPattern: function Dummy_fromIR_getPattern() { + return 'hotpink'; + } + }; + } +}; + +function getShadingPatternFromIR(raw) { + var shadingIR = ShadingIRs[raw[0]]; + if (!shadingIR) { + error('Unknown IR type: ' + raw[0]); + } + return shadingIR.fromIR(raw); +} + +var TilingPattern = (function TilingPatternClosure() { + var PaintType = { + COLORED: 1, + UNCOLORED: 2 + }; + + var MAX_PATTERN_SIZE = 3000; // 10in @ 300dpi shall be enough + + function TilingPattern(IR, color, ctx, objs, commonObjs, baseTransform) { + this.operatorList = IR[2]; + this.matrix = IR[3] || [1, 0, 0, 1, 0, 0]; + this.bbox = IR[4]; + this.xstep = IR[5]; + this.ystep = IR[6]; + this.paintType = IR[7]; + this.tilingType = IR[8]; + this.color = color; + this.objs = objs; + this.commonObjs = commonObjs; + this.baseTransform = baseTransform; + this.type = 'Pattern'; + this.ctx = ctx; + } + + TilingPattern.prototype = { + createPatternCanvas: function TilinPattern_createPatternCanvas(owner) { + var operatorList = this.operatorList; + var bbox = this.bbox; + var xstep = this.xstep; + var ystep = this.ystep; + var paintType = this.paintType; + var tilingType = this.tilingType; + var color = this.color; + var objs = this.objs; + var commonObjs = this.commonObjs; + + info('TilingType: ' + tilingType); + + var x0 = bbox[0], y0 = bbox[1], x1 = bbox[2], y1 = bbox[3]; + + var topLeft = [x0, y0]; + // we want the canvas to be as large as the step size + var botRight = [x0 + xstep, y0 + ystep]; + + var width = botRight[0] - topLeft[0]; + var height = botRight[1] - topLeft[1]; + + // Obtain scale from matrix and current transformation matrix. + var matrixScale = Util.singularValueDecompose2dScale(this.matrix); + var curMatrixScale = Util.singularValueDecompose2dScale( + this.baseTransform); + var combinedScale = [matrixScale[0] * curMatrixScale[0], + matrixScale[1] * curMatrixScale[1]]; + + // MAX_PATTERN_SIZE is used to avoid OOM situation. + // Use width and height values that are as close as possible to the end + // result when the pattern is used. Too low value makes the pattern look + // blurry. Too large value makes it look too crispy. + width = Math.min(Math.ceil(Math.abs(width * combinedScale[0])), + MAX_PATTERN_SIZE); + + height = Math.min(Math.ceil(Math.abs(height * combinedScale[1])), + MAX_PATTERN_SIZE); + + var tmpCanvas = CachedCanvases.getCanvas('pattern', width, height, true); + var tmpCtx = tmpCanvas.context; + var graphics = new CanvasGraphics(tmpCtx, commonObjs, objs); + graphics.groupLevel = owner.groupLevel; + + this.setFillAndStrokeStyleToContext(tmpCtx, paintType, color); + + this.setScale(width, height, xstep, ystep); + this.transformToScale(graphics); + + // transform coordinates to pattern space + var tmpTranslate = [1, 0, 0, 1, -topLeft[0], -topLeft[1]]; + graphics.transform.apply(graphics, tmpTranslate); + + this.clipBbox(graphics, bbox, x0, y0, x1, y1); + + graphics.executeOperatorList(operatorList); + return tmpCanvas.canvas; + }, + + setScale: function TilingPattern_setScale(width, height, xstep, ystep) { + this.scale = [width / xstep, height / ystep]; + }, + + transformToScale: function TilingPattern_transformToScale(graphics) { + var scale = this.scale; + var tmpScale = [scale[0], 0, 0, scale[1], 0, 0]; + graphics.transform.apply(graphics, tmpScale); + }, + + scaleToContext: function TilingPattern_scaleToContext() { + var scale = this.scale; + this.ctx.scale(1 / scale[0], 1 / scale[1]); + }, + + clipBbox: function clipBbox(graphics, bbox, x0, y0, x1, y1) { + if (bbox && isArray(bbox) && bbox.length === 4) { + var bboxWidth = x1 - x0; + var bboxHeight = y1 - y0; + graphics.ctx.rect(x0, y0, bboxWidth, bboxHeight); + graphics.clip(); + graphics.endPath(); + } + }, + + setFillAndStrokeStyleToContext: + function setFillAndStrokeStyleToContext(context, paintType, color) { + switch (paintType) { + case PaintType.COLORED: + var ctx = this.ctx; + context.fillStyle = ctx.fillStyle; + context.strokeStyle = ctx.strokeStyle; + break; + case PaintType.UNCOLORED: + var cssColor = Util.makeCssRgb(color[0], color[1], color[2]); + context.fillStyle = cssColor; + context.strokeStyle = cssColor; + break; + default: + error('Unsupported paint type: ' + paintType); + } + }, + + getPattern: function TilingPattern_getPattern(ctx, owner) { + var temporaryPatternCanvas = this.createPatternCanvas(owner); + + ctx = this.ctx; + ctx.setTransform.apply(ctx, this.baseTransform); + ctx.transform.apply(ctx, this.matrix); + this.scaleToContext(); + + return ctx.createPattern(temporaryPatternCanvas, 'repeat'); + } + }; + + return TilingPattern; +})(); + + +PDFJS.disableFontFace = false; + +var FontLoader = { + insertRule: function fontLoaderInsertRule(rule) { + var styleElement = document.getElementById('PDFJS_FONT_STYLE_TAG'); + if (!styleElement) { + styleElement = document.createElement('style'); + styleElement.id = 'PDFJS_FONT_STYLE_TAG'; + document.documentElement.getElementsByTagName('head')[0].appendChild( + styleElement); + } + + var styleSheet = styleElement.sheet; + styleSheet.insertRule(rule, styleSheet.cssRules.length); + }, + + clear: function fontLoaderClear() { + var styleElement = document.getElementById('PDFJS_FONT_STYLE_TAG'); + if (styleElement) { + styleElement.parentNode.removeChild(styleElement); + } + this.nativeFontFaces.forEach(function(nativeFontFace) { + document.fonts.delete(nativeFontFace); + }); + this.nativeFontFaces.length = 0; + }, + get loadTestFont() { + // This is a CFF font with 1 glyph for '.' that fills its entire width and + // height. + return shadow(this, 'loadTestFont', atob( + 'T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQAFQ' + + 'AABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAAALwA' + + 'AAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgAAAAGbm' + + 'FtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1AAsD6AAA' + + 'AADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD6AAAAAAD6A' + + 'ABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACMAooCvAAAAeAA' + + 'MQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4DIP84AFoDIQAAAA' + + 'AAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAAAAEAAQAAAAEAAAAA' + + 'AAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUAAQAAAAEAAAAAAAYAAQ' + + 'AAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgABAAMAAQQJAAMAAgABAAMA' + + 'AQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABYAAAAAAAAAwAAAAMAAAAcAA' + + 'EAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAAAC7////TAAEAAAAAAAABBgAA' + + 'AQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAA' + + 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' + + 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' + + 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' + + 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAA' + + 'AAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAAAAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgc' + + 'A/gXBIwMAYuL+nz5tQXkD5j3CBLnEQACAQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWF' + + 'hYWFhYWFhYAAABAQAADwACAQEEE/t3Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQA' + + 'AAAAAAABAAAAAMmJbzEAAAAAzgTjFQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAg' + + 'ABAAAAAAAAAAAD6AAAAAAAAA==' + )); + }, + + get isEvalSupported() { + var evalSupport = false; + if (PDFJS.isEvalSupported) { + try { + /* jshint evil: true */ + new Function(''); + evalSupport = true; + } catch (e) {} + } + return shadow(this, 'isEvalSupported', evalSupport); + }, + + loadTestFontId: 0, + + loadingContext: { + requests: [], + nextRequestId: 0 + }, + + isSyncFontLoadingSupported: (function detectSyncFontLoadingSupport() { + if (isWorker) { + return false; + } + + // User agent string sniffing is bad, but there is no reliable way to tell + // if font is fully loaded and ready to be used with canvas. + var userAgent = window.navigator.userAgent; + var m = /Mozilla\/5.0.*?rv:(\d+).*? Gecko/.exec(userAgent); + if (m && m[1] >= 14) { + return true; + } + // TODO other browsers + if (userAgent === 'node') { + return true; + } + return false; + })(), + + nativeFontFaces: [], + + isFontLoadingAPISupported: (!isWorker && typeof document !== 'undefined' && + !!document.fonts), + + addNativeFontFace: function fontLoader_addNativeFontFace(nativeFontFace) { + this.nativeFontFaces.push(nativeFontFace); + document.fonts.add(nativeFontFace); + }, + + bind: function fontLoaderBind(fonts, callback) { + assert(!isWorker, 'bind() shall be called from main thread'); + + var rules = []; + var fontsToLoad = []; + var fontLoadPromises = []; + var getNativeFontPromise = function(nativeFontFace) { + // Return a promise that is always fulfilled, even when the font fails to + // load. + return nativeFontFace.loaded.catch(function(e) { + warn('Failed to load font "' + nativeFontFace.family + '": ' + e); + }); + }; + for (var i = 0, ii = fonts.length; i < ii; i++) { + var font = fonts[i]; + + // Add the font to the DOM only once or skip if the font + // is already loaded. + if (font.attached || font.loading === false) { + continue; + } + font.attached = true; + + if (this.isFontLoadingAPISupported) { + var nativeFontFace = font.createNativeFontFace(); + if (nativeFontFace) { + fontLoadPromises.push(getNativeFontPromise(nativeFontFace)); + } + } else { + var rule = font.bindDOM(); + if (rule) { + rules.push(rule); + fontsToLoad.push(font); + } + } + } + + var request = FontLoader.queueLoadingCallback(callback); + if (this.isFontLoadingAPISupported) { + Promise.all(fontLoadPromises).then(function() { + request.complete(); + }); + } else if (rules.length > 0 && !this.isSyncFontLoadingSupported) { + FontLoader.prepareFontLoadEvent(rules, fontsToLoad, request); + } else { + request.complete(); + } + }, + + queueLoadingCallback: function FontLoader_queueLoadingCallback(callback) { + function LoadLoader_completeRequest() { + assert(!request.end, 'completeRequest() cannot be called twice'); + request.end = Date.now(); + + // sending all completed requests in order how they were queued + while (context.requests.length > 0 && context.requests[0].end) { + var otherRequest = context.requests.shift(); + setTimeout(otherRequest.callback, 0); + } + } + + var context = FontLoader.loadingContext; + var requestId = 'pdfjs-font-loading-' + (context.nextRequestId++); + var request = { + id: requestId, + complete: LoadLoader_completeRequest, + callback: callback, + started: Date.now() + }; + context.requests.push(request); + return request; + }, + + prepareFontLoadEvent: function fontLoaderPrepareFontLoadEvent(rules, + fonts, + request) { + /** Hack begin */ + // There's currently no event when a font has finished downloading so the + // following code is a dirty hack to 'guess' when a font is + // ready. It's assumed fonts are loaded in order, so add a known test + // font after the desired fonts and then test for the loading of that + // test font. + + function int32(data, offset) { + return (data.charCodeAt(offset) << 24) | + (data.charCodeAt(offset + 1) << 16) | + (data.charCodeAt(offset + 2) << 8) | + (data.charCodeAt(offset + 3) & 0xff); + } + + function spliceString(s, offset, remove, insert) { + var chunk1 = s.substr(0, offset); + var chunk2 = s.substr(offset + remove); + return chunk1 + insert + chunk2; + } + + var i, ii; + + var canvas = document.createElement('canvas'); + canvas.width = 1; + canvas.height = 1; + var ctx = canvas.getContext('2d'); + + var called = 0; + function isFontReady(name, callback) { + called++; + // With setTimeout clamping this gives the font ~100ms to load. + if(called > 30) { + warn('Load test font never loaded.'); + callback(); + return; + } + ctx.font = '30px ' + name; + ctx.fillText('.', 0, 20); + var imageData = ctx.getImageData(0, 0, 1, 1); + if (imageData.data[3] > 0) { + callback(); + return; + } + setTimeout(isFontReady.bind(null, name, callback)); + } + + var loadTestFontId = 'lt' + Date.now() + this.loadTestFontId++; + // Chromium seems to cache fonts based on a hash of the actual font data, + // so the font must be modified for each load test else it will appear to + // be loaded already. + // TODO: This could maybe be made faster by avoiding the btoa of the full + // font by splitting it in chunks before hand and padding the font id. + var data = this.loadTestFont; + var COMMENT_OFFSET = 976; // has to be on 4 byte boundary (for checksum) + data = spliceString(data, COMMENT_OFFSET, loadTestFontId.length, + loadTestFontId); + // CFF checksum is important for IE, adjusting it + var CFF_CHECKSUM_OFFSET = 16; + var XXXX_VALUE = 0x58585858; // the "comment" filled with 'X' + var checksum = int32(data, CFF_CHECKSUM_OFFSET); + for (i = 0, ii = loadTestFontId.length - 3; i < ii; i += 4) { + checksum = (checksum - XXXX_VALUE + int32(loadTestFontId, i)) | 0; + } + if (i < loadTestFontId.length) { // align to 4 bytes boundary + checksum = (checksum - XXXX_VALUE + + int32(loadTestFontId + 'XXX', i)) | 0; + } + data = spliceString(data, CFF_CHECKSUM_OFFSET, 4, string32(checksum)); + + var url = 'url(data:font/opentype;base64,' + btoa(data) + ');'; + var rule = '@font-face { font-family:"' + loadTestFontId + '";src:' + + url + '}'; + FontLoader.insertRule(rule); + + var names = []; + for (i = 0, ii = fonts.length; i < ii; i++) { + names.push(fonts[i].loadedName); + } + names.push(loadTestFontId); + + var div = document.createElement('div'); + div.setAttribute('style', + 'visibility: hidden;' + + 'width: 10px; height: 10px;' + + 'position: absolute; top: 0px; left: 0px;'); + for (i = 0, ii = names.length; i < ii; ++i) { + var span = document.createElement('span'); + span.textContent = 'Hi'; + span.style.fontFamily = names[i]; + div.appendChild(span); + } + document.body.appendChild(div); + + isFontReady(loadTestFontId, function() { + document.body.removeChild(div); + request.complete(); + }); + /** Hack end */ + } +}; + +var FontFaceObject = (function FontFaceObjectClosure() { + function FontFaceObject(name, file, properties) { + this.compiledGlyphs = {}; + if (arguments.length === 1) { + // importing translated data + var data = arguments[0]; + for (var i in data) { + this[i] = data[i]; + } + return; + } + } + FontFaceObject.prototype = { + createNativeFontFace: function FontFaceObject_createNativeFontFace() { + if (!this.data) { + return null; + } + + if (PDFJS.disableFontFace) { + this.disableFontFace = true; + return null; + } + + var nativeFontFace = new FontFace(this.loadedName, this.data, {}); + + FontLoader.addNativeFontFace(nativeFontFace); + + if (PDFJS.pdfBug && 'FontInspector' in globalScope && + globalScope['FontInspector'].enabled) { + globalScope['FontInspector'].fontAdded(this); + } + return nativeFontFace; + }, + + bindDOM: function FontFaceObject_bindDOM() { + if (!this.data) { + return null; + } + + if (PDFJS.disableFontFace) { + this.disableFontFace = true; + return null; + } + + var data = bytesToString(new Uint8Array(this.data)); + var fontName = this.loadedName; + + // Add the font-face rule to the document + var url = ('url(data:' + this.mimetype + ';base64,' + + window.btoa(data) + ');'); + var rule = '@font-face { font-family:"' + fontName + '";src:' + url + '}'; + FontLoader.insertRule(rule); + + if (PDFJS.pdfBug && 'FontInspector' in globalScope && + globalScope['FontInspector'].enabled) { + globalScope['FontInspector'].fontAdded(this, url); + } + + return rule; + }, + + getPathGenerator: function FontLoader_getPathGenerator(objs, character) { + if (!(character in this.compiledGlyphs)) { + var cmds = objs.get(this.loadedName + '_path_' + character); + var current, i, len; + + // If we can, compile cmds into JS for MAXIMUM SPEED + if (FontLoader.isEvalSupported) { + var args, js = ''; + for (i = 0, len = cmds.length; i < len; i++) { + current = cmds[i]; + + if (current.args !== undefined) { + args = current.args.join(','); + } else { + args = ''; + } + + js += 'c.' + current.cmd + '(' + args + ');\n'; + } + /* jshint -W054 */ + this.compiledGlyphs[character] = new Function('c', 'size', js); + } else { + // But fall back on using Function.prototype.apply() if we're + // blocked from using eval() for whatever reason (like CSP policies) + this.compiledGlyphs[character] = function(c, size) { + for (i = 0, len = cmds.length; i < len; i++) { + current = cmds[i]; + + if (current.cmd === 'scale') { + current.args = [size, -size]; + } + + c[current.cmd].apply(c, current.args); + } + }; + } + } + return this.compiledGlyphs[character]; + } + }; + return FontFaceObject; +})(); + + +var ANNOT_MIN_SIZE = 10; // px + +var AnnotationUtils = (function AnnotationUtilsClosure() { + // TODO(mack): This dupes some of the logic in CanvasGraphics.setFont() + function setTextStyles(element, item, fontObj) { + + var style = element.style; + style.fontSize = item.fontSize + 'px'; + style.direction = item.fontDirection < 0 ? 'rtl': 'ltr'; + + if (!fontObj) { + return; + } + + style.fontWeight = fontObj.black ? + (fontObj.bold ? 'bolder' : 'bold') : + (fontObj.bold ? 'bold' : 'normal'); + style.fontStyle = fontObj.italic ? 'italic' : 'normal'; + + var fontName = fontObj.loadedName; + var fontFamily = fontName ? '"' + fontName + '", ' : ''; + // Use a reasonable default font if the font doesn't specify a fallback + var fallbackName = fontObj.fallbackName || 'Helvetica, sans-serif'; + style.fontFamily = fontFamily + fallbackName; + } + + function initContainer(item) { + var container = document.createElement('section'); + var cstyle = container.style; + var width = item.rect[2] - item.rect[0]; + var height = item.rect[3] - item.rect[1]; + + // Border + if (item.borderStyle.width > 0) { + // Border width + container.style.borderWidth = item.borderStyle.width + 'px'; + if (item.borderStyle.style !== AnnotationBorderStyleType.UNDERLINE) { + // Underline styles only have a bottom border, so we do not need + // to adjust for all borders. This yields a similar result as + // Adobe Acrobat/Reader. + width = width - 2 * item.borderStyle.width; + height = height - 2 * item.borderStyle.width; + } + + // Horizontal and vertical border radius + var horizontalRadius = item.borderStyle.horizontalCornerRadius; + var verticalRadius = item.borderStyle.verticalCornerRadius; + if (horizontalRadius > 0 || verticalRadius > 0) { + var radius = horizontalRadius + 'px / ' + verticalRadius + 'px'; + CustomStyle.setProp('borderRadius', container, radius); + } + + // Border style + switch (item.borderStyle.style) { + case AnnotationBorderStyleType.SOLID: + container.style.borderStyle = 'solid'; + break; + + case AnnotationBorderStyleType.DASHED: + container.style.borderStyle = 'dashed'; + break; + + case AnnotationBorderStyleType.BEVELED: + warn('Unimplemented border style: beveled'); + break; + + case AnnotationBorderStyleType.INSET: + warn('Unimplemented border style: inset'); + break; + + case AnnotationBorderStyleType.UNDERLINE: + container.style.borderBottomStyle = 'solid'; + break; + + default: + break; + } + + // Border color + if (item.color) { + container.style.borderColor = + Util.makeCssRgb(item.color[0] | 0, + item.color[1] | 0, + item.color[2] | 0); + } else { + // Transparent (invisible) border, so do not draw it at all. + container.style.borderWidth = 0; + } + } + + cstyle.width = width + 'px'; + cstyle.height = height + 'px'; + return container; + } + + function getHtmlElementForTextWidgetAnnotation(item, commonObjs) { + var element = document.createElement('div'); + var width = item.rect[2] - item.rect[0]; + var height = item.rect[3] - item.rect[1]; + element.style.width = width + 'px'; + element.style.height = height + 'px'; + element.style.display = 'table'; + + var content = document.createElement('div'); + content.textContent = item.fieldValue; + var textAlignment = item.textAlignment; + content.style.textAlign = ['left', 'center', 'right'][textAlignment]; + content.style.verticalAlign = 'middle'; + content.style.display = 'table-cell'; + + var fontObj = item.fontRefName ? + commonObjs.getData(item.fontRefName) : null; + setTextStyles(content, item, fontObj); + + element.appendChild(content); + + return element; + } + + function getHtmlElementForTextAnnotation(item) { + var rect = item.rect; + + // sanity check because of OOo-generated PDFs + if ((rect[3] - rect[1]) < ANNOT_MIN_SIZE) { + rect[3] = rect[1] + ANNOT_MIN_SIZE; + } + if ((rect[2] - rect[0]) < ANNOT_MIN_SIZE) { + rect[2] = rect[0] + (rect[3] - rect[1]); // make it square + } + + var container = initContainer(item); + container.className = 'annotText'; + + var image = document.createElement('img'); + image.style.height = container.style.height; + image.style.width = container.style.width; + var iconName = item.name; + image.src = PDFJS.imageResourcesPath + 'annotation-' + + iconName.toLowerCase() + '.svg'; + image.alt = '[{{type}} Annotation]'; + image.dataset.l10nId = 'text_annotation_type'; + image.dataset.l10nArgs = JSON.stringify({type: iconName}); + + var contentWrapper = document.createElement('div'); + contentWrapper.className = 'annotTextContentWrapper'; + contentWrapper.style.left = Math.floor(rect[2] - rect[0] + 5) + 'px'; + contentWrapper.style.top = '-10px'; + + var content = document.createElement('div'); + content.className = 'annotTextContent'; + content.setAttribute('hidden', true); + + var i, ii; + if (item.hasBgColor && item.color) { + var color = item.color; + + // Enlighten the color (70%) + var BACKGROUND_ENLIGHT = 0.7; + var r = BACKGROUND_ENLIGHT * (255 - color[0]) + color[0]; + var g = BACKGROUND_ENLIGHT * (255 - color[1]) + color[1]; + var b = BACKGROUND_ENLIGHT * (255 - color[2]) + color[2]; + content.style.backgroundColor = Util.makeCssRgb(r | 0, g | 0, b | 0); + } + + var title = document.createElement('h1'); + var text = document.createElement('p'); + title.textContent = item.title; + + if (!item.content && !item.title) { + content.setAttribute('hidden', true); + } else { + var e = document.createElement('span'); + var lines = item.content.split(/(?:\r\n?|\n)/); + for (i = 0, ii = lines.length; i < ii; ++i) { + var line = lines[i]; + e.appendChild(document.createTextNode(line)); + if (i < (ii - 1)) { + e.appendChild(document.createElement('br')); + } + } + text.appendChild(e); + + var pinned = false; + + var showAnnotation = function showAnnotation(pin) { + if (pin) { + pinned = true; + } + if (content.hasAttribute('hidden')) { + container.style.zIndex += 1; + content.removeAttribute('hidden'); + } + }; + + var hideAnnotation = function hideAnnotation(unpin) { + if (unpin) { + pinned = false; + } + if (!content.hasAttribute('hidden') && !pinned) { + container.style.zIndex -= 1; + content.setAttribute('hidden', true); + } + }; + + var toggleAnnotation = function toggleAnnotation() { + if (pinned) { + hideAnnotation(true); + } else { + showAnnotation(true); + } + }; + + image.addEventListener('click', function image_clickHandler() { + toggleAnnotation(); + }, false); + image.addEventListener('mouseover', function image_mouseOverHandler() { + showAnnotation(); + }, false); + image.addEventListener('mouseout', function image_mouseOutHandler() { + hideAnnotation(); + }, false); + + content.addEventListener('click', function content_clickHandler() { + hideAnnotation(true); + }, false); + } + + content.appendChild(title); + content.appendChild(text); + contentWrapper.appendChild(content); + container.appendChild(image); + container.appendChild(contentWrapper); + + return container; + } + + function getHtmlElementForLinkAnnotation(item) { + var container = initContainer(item); + container.className = 'annotLink'; + + var link = document.createElement('a'); + link.href = link.title = item.url || ''; + + if (item.url && isExternalLinkTargetSet()) { + link.target = LinkTargetStringMap[PDFJS.externalLinkTarget]; + } + + container.appendChild(link); + + return container; + } + + function getHtmlElement(data, objs) { + switch (data.annotationType) { + case AnnotationType.WIDGET: + return getHtmlElementForTextWidgetAnnotation(data, objs); + case AnnotationType.TEXT: + return getHtmlElementForTextAnnotation(data); + case AnnotationType.LINK: + return getHtmlElementForLinkAnnotation(data); + default: + throw new Error('Unsupported annotationType: ' + data.annotationType); + } + } + + return { + getHtmlElement: getHtmlElement + }; +})(); +PDFJS.AnnotationUtils = AnnotationUtils; + + +var SVG_DEFAULTS = { + fontStyle: 'normal', + fontWeight: 'normal', + fillColor: '#000000' +}; + +var convertImgDataToPng = (function convertImgDataToPngClosure() { + var PNG_HEADER = + new Uint8Array([0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a]); + + var CHUNK_WRAPPER_SIZE = 12; + + var crcTable = new Int32Array(256); + for (var i = 0; i < 256; i++) { + var c = i; + for (var h = 0; h < 8; h++) { + if (c & 1) { + c = 0xedB88320 ^ ((c >> 1) & 0x7fffffff); + } else { + c = (c >> 1) & 0x7fffffff; + } + } + crcTable[i] = c; + } + + function crc32(data, start, end) { + var crc = -1; + for (var i = start; i < end; i++) { + var a = (crc ^ data[i]) & 0xff; + var b = crcTable[a]; + crc = (crc >>> 8) ^ b; + } + return crc ^ -1; + } + + function writePngChunk(type, body, data, offset) { + var p = offset; + var len = body.length; + + data[p] = len >> 24 & 0xff; + data[p + 1] = len >> 16 & 0xff; + data[p + 2] = len >> 8 & 0xff; + data[p + 3] = len & 0xff; + p += 4; + + data[p] = type.charCodeAt(0) & 0xff; + data[p + 1] = type.charCodeAt(1) & 0xff; + data[p + 2] = type.charCodeAt(2) & 0xff; + data[p + 3] = type.charCodeAt(3) & 0xff; + p += 4; + + data.set(body, p); + p += body.length; + + var crc = crc32(data, offset + 4, p); + + data[p] = crc >> 24 & 0xff; + data[p + 1] = crc >> 16 & 0xff; + data[p + 2] = crc >> 8 & 0xff; + data[p + 3] = crc & 0xff; + } + + function adler32(data, start, end) { + var a = 1; + var b = 0; + for (var i = start; i < end; ++i) { + a = (a + (data[i] & 0xff)) % 65521; + b = (b + a) % 65521; + } + return (b << 16) | a; + } + + function encode(imgData, kind) { + var width = imgData.width; + var height = imgData.height; + var bitDepth, colorType, lineSize; + var bytes = imgData.data; + + switch (kind) { + case ImageKind.GRAYSCALE_1BPP: + colorType = 0; + bitDepth = 1; + lineSize = (width + 7) >> 3; + break; + case ImageKind.RGB_24BPP: + colorType = 2; + bitDepth = 8; + lineSize = width * 3; + break; + case ImageKind.RGBA_32BPP: + colorType = 6; + bitDepth = 8; + lineSize = width * 4; + break; + default: + throw new Error('invalid format'); + } + + // prefix every row with predictor 0 + var literals = new Uint8Array((1 + lineSize) * height); + var offsetLiterals = 0, offsetBytes = 0; + var y, i; + for (y = 0; y < height; ++y) { + literals[offsetLiterals++] = 0; // no prediction + literals.set(bytes.subarray(offsetBytes, offsetBytes + lineSize), + offsetLiterals); + offsetBytes += lineSize; + offsetLiterals += lineSize; + } + + if (kind === ImageKind.GRAYSCALE_1BPP) { + // inverting for B/W + offsetLiterals = 0; + for (y = 0; y < height; y++) { + offsetLiterals++; // skipping predictor + for (i = 0; i < lineSize; i++) { + literals[offsetLiterals++] ^= 0xFF; + } + } + } + + var ihdr = new Uint8Array([ + width >> 24 & 0xff, + width >> 16 & 0xff, + width >> 8 & 0xff, + width & 0xff, + height >> 24 & 0xff, + height >> 16 & 0xff, + height >> 8 & 0xff, + height & 0xff, + bitDepth, // bit depth + colorType, // color type + 0x00, // compression method + 0x00, // filter method + 0x00 // interlace method + ]); + + var len = literals.length; + var maxBlockLength = 0xFFFF; + + var deflateBlocks = Math.ceil(len / maxBlockLength); + var idat = new Uint8Array(2 + len + deflateBlocks * 5 + 4); + var pi = 0; + idat[pi++] = 0x78; // compression method and flags + idat[pi++] = 0x9c; // flags + + var pos = 0; + while (len > maxBlockLength) { + // writing non-final DEFLATE blocks type 0 and length of 65535 + idat[pi++] = 0x00; + idat[pi++] = 0xff; + idat[pi++] = 0xff; + idat[pi++] = 0x00; + idat[pi++] = 0x00; + idat.set(literals.subarray(pos, pos + maxBlockLength), pi); + pi += maxBlockLength; + pos += maxBlockLength; + len -= maxBlockLength; + } + + // writing non-final DEFLATE blocks type 0 + idat[pi++] = 0x01; + idat[pi++] = len & 0xff; + idat[pi++] = len >> 8 & 0xff; + idat[pi++] = (~len & 0xffff) & 0xff; + idat[pi++] = (~len & 0xffff) >> 8 & 0xff; + idat.set(literals.subarray(pos), pi); + pi += literals.length - pos; + + var adler = adler32(literals, 0, literals.length); // checksum + idat[pi++] = adler >> 24 & 0xff; + idat[pi++] = adler >> 16 & 0xff; + idat[pi++] = adler >> 8 & 0xff; + idat[pi++] = adler & 0xff; + + // PNG will consists: header, IHDR+data, IDAT+data, and IEND. + var pngLength = PNG_HEADER.length + (CHUNK_WRAPPER_SIZE * 3) + + ihdr.length + idat.length; + var data = new Uint8Array(pngLength); + var offset = 0; + data.set(PNG_HEADER, offset); + offset += PNG_HEADER.length; + writePngChunk('IHDR', ihdr, data, offset); + offset += CHUNK_WRAPPER_SIZE + ihdr.length; + writePngChunk('IDATA', idat, data, offset); + offset += CHUNK_WRAPPER_SIZE + idat.length; + writePngChunk('IEND', new Uint8Array(0), data, offset); + + return PDFJS.createObjectURL(data, 'image/png'); + } + + return function convertImgDataToPng(imgData) { + var kind = (imgData.kind === undefined ? + ImageKind.GRAYSCALE_1BPP : imgData.kind); + return encode(imgData, kind); + }; +})(); + +var SVGExtraState = (function SVGExtraStateClosure() { + function SVGExtraState() { + this.fontSizeScale = 1; + this.fontWeight = SVG_DEFAULTS.fontWeight; + this.fontSize = 0; + + this.textMatrix = IDENTITY_MATRIX; + this.fontMatrix = FONT_IDENTITY_MATRIX; + this.leading = 0; + + // Current point (in user coordinates) + this.x = 0; + this.y = 0; + + // Start of text line (in text coordinates) + this.lineX = 0; + this.lineY = 0; + + // Character and word spacing + this.charSpacing = 0; + this.wordSpacing = 0; + this.textHScale = 1; + this.textRise = 0; + + // Default foreground and background colors + this.fillColor = SVG_DEFAULTS.fillColor; + this.strokeColor = '#000000'; + + this.fillAlpha = 1; + this.strokeAlpha = 1; + this.lineWidth = 1; + this.lineJoin = ''; + this.lineCap = ''; + this.miterLimit = 0; + + this.dashArray = []; + this.dashPhase = 0; + + this.dependencies = []; + + // Clipping + this.clipId = ''; + this.pendingClip = false; + + this.maskId = ''; + } + + SVGExtraState.prototype = { + clone: function SVGExtraState_clone() { + return Object.create(this); + }, + setCurrentPoint: function SVGExtraState_setCurrentPoint(x, y) { + this.x = x; + this.y = y; + } + }; + return SVGExtraState; +})(); + +var SVGGraphics = (function SVGGraphicsClosure() { + function createScratchSVG(width, height) { + var NS = 'http://www.w3.org/2000/svg'; + var svg = document.createElementNS(NS, 'svg:svg'); + svg.setAttributeNS(null, 'version', '1.1'); + svg.setAttributeNS(null, 'width', width + 'px'); + svg.setAttributeNS(null, 'height', height + 'px'); + svg.setAttributeNS(null, 'viewBox', '0 0 ' + width + ' ' + height); + return svg; + } + + function opListToTree(opList) { + var opTree = []; + var tmp = []; + var opListLen = opList.length; + + for (var x = 0; x < opListLen; x++) { + if (opList[x].fn === 'save') { + opTree.push({'fnId': 92, 'fn': 'group', 'items': []}); + tmp.push(opTree); + opTree = opTree[opTree.length - 1].items; + continue; + } + + if(opList[x].fn === 'restore') { + opTree = tmp.pop(); + } else { + opTree.push(opList[x]); + } + } + return opTree; + } + + /** + * Formats float number. + * @param value {number} number to format. + * @returns {string} + */ + function pf(value) { + if (value === (value | 0)) { // integer number + return value.toString(); + } + var s = value.toFixed(10); + var i = s.length - 1; + if (s[i] !== '0') { + return s; + } + // removing trailing zeros + do { + i--; + } while (s[i] === '0'); + return s.substr(0, s[i] === '.' ? i : i + 1); + } + + /** + * Formats transform matrix. The standard rotation, scale and translate + * matrices are replaced by their shorter forms, and for identity matrix + * returns empty string to save the memory. + * @param m {Array} matrix to format. + * @returns {string} + */ + function pm(m) { + if (m[4] === 0 && m[5] === 0) { + if (m[1] === 0 && m[2] === 0) { + if (m[0] === 1 && m[3] === 1) { + return ''; + } + return 'scale(' + pf(m[0]) + ' ' + pf(m[3]) + ')'; + } + if (m[0] === m[3] && m[1] === -m[2]) { + var a = Math.acos(m[0]) * 180 / Math.PI; + return 'rotate(' + pf(a) + ')'; + } + } else { + if (m[0] === 1 && m[1] === 0 && m[2] === 0 && m[3] === 1) { + return 'translate(' + pf(m[4]) + ' ' + pf(m[5]) + ')'; + } + } + return 'matrix(' + pf(m[0]) + ' ' + pf(m[1]) + ' ' + pf(m[2]) + ' ' + + pf(m[3]) + ' ' + pf(m[4]) + ' ' + pf(m[5]) + ')'; + } + + function SVGGraphics(commonObjs, objs) { + this.current = new SVGExtraState(); + this.transformMatrix = IDENTITY_MATRIX; // Graphics state matrix + this.transformStack = []; + this.extraStack = []; + this.commonObjs = commonObjs; + this.objs = objs; + this.pendingEOFill = false; + + this.embedFonts = false; + this.embeddedFonts = {}; + this.cssStyle = null; + } + + var NS = 'http://www.w3.org/2000/svg'; + var XML_NS = 'http://www.w3.org/XML/1998/namespace'; + var XLINK_NS = 'http://www.w3.org/1999/xlink'; + var LINE_CAP_STYLES = ['butt', 'round', 'square']; + var LINE_JOIN_STYLES = ['miter', 'round', 'bevel']; + var clipCount = 0; + var maskCount = 0; + + SVGGraphics.prototype = { + save: function SVGGraphics_save() { + this.transformStack.push(this.transformMatrix); + var old = this.current; + this.extraStack.push(old); + this.current = old.clone(); + }, + + restore: function SVGGraphics_restore() { + this.transformMatrix = this.transformStack.pop(); + this.current = this.extraStack.pop(); + + this.tgrp = document.createElementNS(NS, 'svg:g'); + this.tgrp.setAttributeNS(null, 'transform', pm(this.transformMatrix)); + this.pgrp.appendChild(this.tgrp); + }, + + group: function SVGGraphics_group(items) { + this.save(); + this.executeOpTree(items); + this.restore(); + }, + + loadDependencies: function SVGGraphics_loadDependencies(operatorList) { + var fnArray = operatorList.fnArray; + var fnArrayLen = fnArray.length; + var argsArray = operatorList.argsArray; + + var self = this; + for (var i = 0; i < fnArrayLen; i++) { + if (OPS.dependency === fnArray[i]) { + var deps = argsArray[i]; + for (var n = 0, nn = deps.length; n < nn; n++) { + var obj = deps[n]; + var common = obj.substring(0, 2) === 'g_'; + var promise; + if (common) { + promise = new Promise(function(resolve) { + self.commonObjs.get(obj, resolve); + }); + } else { + promise = new Promise(function(resolve) { + self.objs.get(obj, resolve); + }); + } + this.current.dependencies.push(promise); + } + } + } + return Promise.all(this.current.dependencies); + }, + + transform: function SVGGraphics_transform(a, b, c, d, e, f) { + var transformMatrix = [a, b, c, d, e, f]; + this.transformMatrix = PDFJS.Util.transform(this.transformMatrix, + transformMatrix); + + this.tgrp = document.createElementNS(NS, 'svg:g'); + this.tgrp.setAttributeNS(null, 'transform', pm(this.transformMatrix)); + }, + + getSVG: function SVGGraphics_getSVG(operatorList, viewport) { + this.svg = createScratchSVG(viewport.width, viewport.height); + this.viewport = viewport; + + return this.loadDependencies(operatorList).then(function () { + this.transformMatrix = IDENTITY_MATRIX; + this.pgrp = document.createElementNS(NS, 'svg:g'); // Parent group + this.pgrp.setAttributeNS(null, 'transform', pm(viewport.transform)); + this.tgrp = document.createElementNS(NS, 'svg:g'); // Transform group + this.tgrp.setAttributeNS(null, 'transform', pm(this.transformMatrix)); + this.defs = document.createElementNS(NS, 'svg:defs'); + this.pgrp.appendChild(this.defs); + this.pgrp.appendChild(this.tgrp); + this.svg.appendChild(this.pgrp); + var opTree = this.convertOpList(operatorList); + this.executeOpTree(opTree); + return this.svg; + }.bind(this)); + }, + + convertOpList: function SVGGraphics_convertOpList(operatorList) { + var argsArray = operatorList.argsArray; + var fnArray = operatorList.fnArray; + var fnArrayLen = fnArray.length; + var REVOPS = []; + var opList = []; + + for (var op in OPS) { + REVOPS[OPS[op]] = op; + } + + for (var x = 0; x < fnArrayLen; x++) { + var fnId = fnArray[x]; + opList.push({'fnId' : fnId, 'fn': REVOPS[fnId], 'args': argsArray[x]}); + } + return opListToTree(opList); + }, + + executeOpTree: function SVGGraphics_executeOpTree(opTree) { + var opTreeLen = opTree.length; + for(var x = 0; x < opTreeLen; x++) { + var fn = opTree[x].fn; + var fnId = opTree[x].fnId; + var args = opTree[x].args; + + switch (fnId | 0) { + case OPS.beginText: + this.beginText(); + break; + case OPS.setLeading: + this.setLeading(args); + break; + case OPS.setLeadingMoveText: + this.setLeadingMoveText(args[0], args[1]); + break; + case OPS.setFont: + this.setFont(args); + break; + case OPS.showText: + this.showText(args[0]); + break; + case OPS.showSpacedText: + this.showText(args[0]); + break; + case OPS.endText: + this.endText(); + break; + case OPS.moveText: + this.moveText(args[0], args[1]); + break; + case OPS.setCharSpacing: + this.setCharSpacing(args[0]); + break; + case OPS.setWordSpacing: + this.setWordSpacing(args[0]); + break; + case OPS.setHScale: + this.setHScale(args[0]); + break; + case OPS.setTextMatrix: + this.setTextMatrix(args[0], args[1], args[2], + args[3], args[4], args[5]); + break; + case OPS.setLineWidth: + this.setLineWidth(args[0]); + break; + case OPS.setLineJoin: + this.setLineJoin(args[0]); + break; + case OPS.setLineCap: + this.setLineCap(args[0]); + break; + case OPS.setMiterLimit: + this.setMiterLimit(args[0]); + break; + case OPS.setFillRGBColor: + this.setFillRGBColor(args[0], args[1], args[2]); + break; + case OPS.setStrokeRGBColor: + this.setStrokeRGBColor(args[0], args[1], args[2]); + break; + case OPS.setDash: + this.setDash(args[0], args[1]); + break; + case OPS.setGState: + this.setGState(args[0]); + break; + case OPS.fill: + this.fill(); + break; + case OPS.eoFill: + this.eoFill(); + break; + case OPS.stroke: + this.stroke(); + break; + case OPS.fillStroke: + this.fillStroke(); + break; + case OPS.eoFillStroke: + this.eoFillStroke(); + break; + case OPS.clip: + this.clip('nonzero'); + break; + case OPS.eoClip: + this.clip('evenodd'); + break; + case OPS.paintSolidColorImageMask: + this.paintSolidColorImageMask(); + break; + case OPS.paintJpegXObject: + this.paintJpegXObject(args[0], args[1], args[2]); + break; + case OPS.paintImageXObject: + this.paintImageXObject(args[0]); + break; + case OPS.paintInlineImageXObject: + this.paintInlineImageXObject(args[0]); + break; + case OPS.paintImageMaskXObject: + this.paintImageMaskXObject(args[0]); + break; + case OPS.paintFormXObjectBegin: + this.paintFormXObjectBegin(args[0], args[1]); + break; + case OPS.paintFormXObjectEnd: + this.paintFormXObjectEnd(); + break; + case OPS.closePath: + this.closePath(); + break; + case OPS.closeStroke: + this.closeStroke(); + break; + case OPS.closeFillStroke: + this.closeFillStroke(); + break; + case OPS.nextLine: + this.nextLine(); + break; + case OPS.transform: + this.transform(args[0], args[1], args[2], args[3], + args[4], args[5]); + break; + case OPS.constructPath: + this.constructPath(args[0], args[1]); + break; + case OPS.endPath: + this.endPath(); + break; + case 92: + this.group(opTree[x].items); + break; + default: + warn('Unimplemented method '+ fn); + break; + } + } + }, + + setWordSpacing: function SVGGraphics_setWordSpacing(wordSpacing) { + this.current.wordSpacing = wordSpacing; + }, + + setCharSpacing: function SVGGraphics_setCharSpacing(charSpacing) { + this.current.charSpacing = charSpacing; + }, + + nextLine: function SVGGraphics_nextLine() { + this.moveText(0, this.current.leading); + }, + + setTextMatrix: function SVGGraphics_setTextMatrix(a, b, c, d, e, f) { + var current = this.current; + this.current.textMatrix = this.current.lineMatrix = [a, b, c, d, e, f]; + + this.current.x = this.current.lineX = 0; + this.current.y = this.current.lineY = 0; + + current.xcoords = []; + current.tspan = document.createElementNS(NS, 'svg:tspan'); + current.tspan.setAttributeNS(null, 'font-family', current.fontFamily); + current.tspan.setAttributeNS(null, 'font-size', + pf(current.fontSize) + 'px'); + current.tspan.setAttributeNS(null, 'y', pf(-current.y)); + + current.txtElement = document.createElementNS(NS, 'svg:text'); + current.txtElement.appendChild(current.tspan); + }, + + beginText: function SVGGraphics_beginText() { + this.current.x = this.current.lineX = 0; + this.current.y = this.current.lineY = 0; + this.current.textMatrix = IDENTITY_MATRIX; + this.current.lineMatrix = IDENTITY_MATRIX; + this.current.tspan = document.createElementNS(NS, 'svg:tspan'); + this.current.txtElement = document.createElementNS(NS, 'svg:text'); + this.current.txtgrp = document.createElementNS(NS, 'svg:g'); + this.current.xcoords = []; + }, + + moveText: function SVGGraphics_moveText(x, y) { + var current = this.current; + this.current.x = this.current.lineX += x; + this.current.y = this.current.lineY += y; + + current.xcoords = []; + current.tspan = document.createElementNS(NS, 'svg:tspan'); + current.tspan.setAttributeNS(null, 'font-family', current.fontFamily); + current.tspan.setAttributeNS(null, 'font-size', + pf(current.fontSize) + 'px'); + current.tspan.setAttributeNS(null, 'y', pf(-current.y)); + }, + + showText: function SVGGraphics_showText(glyphs) { + var current = this.current; + var font = current.font; + var fontSize = current.fontSize; + + if (fontSize === 0) { + return; + } + + var charSpacing = current.charSpacing; + var wordSpacing = current.wordSpacing; + var fontDirection = current.fontDirection; + var textHScale = current.textHScale * fontDirection; + var glyphsLength = glyphs.length; + var vertical = font.vertical; + var widthAdvanceScale = fontSize * current.fontMatrix[0]; + + var x = 0, i; + for (i = 0; i < glyphsLength; ++i) { + var glyph = glyphs[i]; + if (glyph === null) { + // word break + x += fontDirection * wordSpacing; + continue; + } else if (isNum(glyph)) { + x += -glyph * fontSize * 0.001; + continue; + } + current.xcoords.push(current.x + x * textHScale); + + var width = glyph.width; + var character = glyph.fontChar; + var charWidth = width * widthAdvanceScale + charSpacing * fontDirection; + x += charWidth; + + current.tspan.textContent += character; + } + if (vertical) { + current.y -= x * textHScale; + } else { + current.x += x * textHScale; + } + + current.tspan.setAttributeNS(null, 'x', + current.xcoords.map(pf).join(' ')); + current.tspan.setAttributeNS(null, 'y', pf(-current.y)); + current.tspan.setAttributeNS(null, 'font-family', current.fontFamily); + current.tspan.setAttributeNS(null, 'font-size', + pf(current.fontSize) + 'px'); + if (current.fontStyle !== SVG_DEFAULTS.fontStyle) { + current.tspan.setAttributeNS(null, 'font-style', current.fontStyle); + } + if (current.fontWeight !== SVG_DEFAULTS.fontWeight) { + current.tspan.setAttributeNS(null, 'font-weight', current.fontWeight); + } + if (current.fillColor !== SVG_DEFAULTS.fillColor) { + current.tspan.setAttributeNS(null, 'fill', current.fillColor); + } + + current.txtElement.setAttributeNS(null, 'transform', + pm(current.textMatrix) + + ' scale(1, -1)' ); + current.txtElement.setAttributeNS(XML_NS, 'xml:space', 'preserve'); + current.txtElement.appendChild(current.tspan); + current.txtgrp.appendChild(current.txtElement); + + this.tgrp.appendChild(current.txtElement); + + }, + + setLeadingMoveText: function SVGGraphics_setLeadingMoveText(x, y) { + this.setLeading(-y); + this.moveText(x, y); + }, + + addFontStyle: function SVGGraphics_addFontStyle(fontObj) { + if (!this.cssStyle) { + this.cssStyle = document.createElementNS(NS, 'svg:style'); + this.cssStyle.setAttributeNS(null, 'type', 'text/css'); + this.defs.appendChild(this.cssStyle); + } + + var url = PDFJS.createObjectURL(fontObj.data, fontObj.mimetype); + this.cssStyle.textContent += + '@font-face { font-family: "' + fontObj.loadedName + '";' + + ' src: url(' + url + '); }\n'; + }, + + setFont: function SVGGraphics_setFont(details) { + var current = this.current; + var fontObj = this.commonObjs.get(details[0]); + var size = details[1]; + this.current.font = fontObj; + + if (this.embedFonts && fontObj.data && + !this.embeddedFonts[fontObj.loadedName]) { + this.addFontStyle(fontObj); + this.embeddedFonts[fontObj.loadedName] = fontObj; + } + + current.fontMatrix = (fontObj.fontMatrix ? + fontObj.fontMatrix : FONT_IDENTITY_MATRIX); + + var bold = fontObj.black ? (fontObj.bold ? 'bolder' : 'bold') : + (fontObj.bold ? 'bold' : 'normal'); + var italic = fontObj.italic ? 'italic' : 'normal'; + + if (size < 0) { + size = -size; + current.fontDirection = -1; + } else { + current.fontDirection = 1; + } + current.fontSize = size; + current.fontFamily = fontObj.loadedName; + current.fontWeight = bold; + current.fontStyle = italic; + + current.tspan = document.createElementNS(NS, 'svg:tspan'); + current.tspan.setAttributeNS(null, 'y', pf(-current.y)); + current.xcoords = []; + }, + + endText: function SVGGraphics_endText() { + if (this.current.pendingClip) { + this.cgrp.appendChild(this.tgrp); + this.pgrp.appendChild(this.cgrp); + } else { + this.pgrp.appendChild(this.tgrp); + } + this.tgrp = document.createElementNS(NS, 'svg:g'); + this.tgrp.setAttributeNS(null, 'transform', pm(this.transformMatrix)); + }, + + // Path properties + setLineWidth: function SVGGraphics_setLineWidth(width) { + this.current.lineWidth = width; + }, + setLineCap: function SVGGraphics_setLineCap(style) { + this.current.lineCap = LINE_CAP_STYLES[style]; + }, + setLineJoin: function SVGGraphics_setLineJoin(style) { + this.current.lineJoin = LINE_JOIN_STYLES[style]; + }, + setMiterLimit: function SVGGraphics_setMiterLimit(limit) { + this.current.miterLimit = limit; + }, + setStrokeRGBColor: function SVGGraphics_setStrokeRGBColor(r, g, b) { + var color = Util.makeCssRgb(r, g, b); + this.current.strokeColor = color; + }, + setFillRGBColor: function SVGGraphics_setFillRGBColor(r, g, b) { + var color = Util.makeCssRgb(r, g, b); + this.current.fillColor = color; + this.current.tspan = document.createElementNS(NS, 'svg:tspan'); + this.current.xcoords = []; + }, + setDash: function SVGGraphics_setDash(dashArray, dashPhase) { + this.current.dashArray = dashArray; + this.current.dashPhase = dashPhase; + }, + + constructPath: function SVGGraphics_constructPath(ops, args) { + var current = this.current; + var x = current.x, y = current.y; + current.path = document.createElementNS(NS, 'svg:path'); + var d = []; + var opLength = ops.length; + + for (var i = 0, j = 0; i < opLength; i++) { + switch (ops[i] | 0) { + case OPS.rectangle: + x = args[j++]; + y = args[j++]; + var width = args[j++]; + var height = args[j++]; + var xw = x + width; + var yh = y + height; + d.push('M', pf(x), pf(y), 'L', pf(xw) , pf(y), 'L', pf(xw), pf(yh), + 'L', pf(x), pf(yh), 'Z'); + break; + case OPS.moveTo: + x = args[j++]; + y = args[j++]; + d.push('M', pf(x), pf(y)); + break; + case OPS.lineTo: + x = args[j++]; + y = args[j++]; + d.push('L', pf(x) , pf(y)); + break; + case OPS.curveTo: + x = args[j + 4]; + y = args[j + 5]; + d.push('C', pf(args[j]), pf(args[j + 1]), pf(args[j + 2]), + pf(args[j + 3]), pf(x), pf(y)); + j += 6; + break; + case OPS.curveTo2: + x = args[j + 2]; + y = args[j + 3]; + d.push('C', pf(x), pf(y), pf(args[j]), pf(args[j + 1]), + pf(args[j + 2]), pf(args[j + 3])); + j += 4; + break; + case OPS.curveTo3: + x = args[j + 2]; + y = args[j + 3]; + d.push('C', pf(args[j]), pf(args[j + 1]), pf(x), pf(y), + pf(x), pf(y)); + j += 4; + break; + case OPS.closePath: + d.push('Z'); + break; + } + } + current.path.setAttributeNS(null, 'd', d.join(' ')); + current.path.setAttributeNS(null, 'stroke-miterlimit', + pf(current.miterLimit)); + current.path.setAttributeNS(null, 'stroke-linecap', current.lineCap); + current.path.setAttributeNS(null, 'stroke-linejoin', current.lineJoin); + current.path.setAttributeNS(null, 'stroke-width', + pf(current.lineWidth) + 'px'); + current.path.setAttributeNS(null, 'stroke-dasharray', + current.dashArray.map(pf).join(' ')); + current.path.setAttributeNS(null, 'stroke-dashoffset', + pf(current.dashPhase) + 'px'); + current.path.setAttributeNS(null, 'fill', 'none'); + + this.tgrp.appendChild(current.path); + if (current.pendingClip) { + this.cgrp.appendChild(this.tgrp); + this.pgrp.appendChild(this.cgrp); + } else { + this.pgrp.appendChild(this.tgrp); + } + // Saving a reference in current.element so that it can be addressed + // in 'fill' and 'stroke' + current.element = current.path; + current.setCurrentPoint(x, y); + }, + + endPath: function SVGGraphics_endPath() { + var current = this.current; + if (current.pendingClip) { + this.cgrp.appendChild(this.tgrp); + this.pgrp.appendChild(this.cgrp); + } else { + this.pgrp.appendChild(this.tgrp); + } + this.tgrp = document.createElementNS(NS, 'svg:g'); + this.tgrp.setAttributeNS(null, 'transform', pm(this.transformMatrix)); + }, + + clip: function SVGGraphics_clip(type) { + var current = this.current; + // Add current path to clipping path + current.clipId = 'clippath' + clipCount; + clipCount++; + this.clippath = document.createElementNS(NS, 'svg:clipPath'); + this.clippath.setAttributeNS(null, 'id', current.clipId); + var clipElement = current.element.cloneNode(); + if (type === 'evenodd') { + clipElement.setAttributeNS(null, 'clip-rule', 'evenodd'); + } else { + clipElement.setAttributeNS(null, 'clip-rule', 'nonzero'); + } + this.clippath.setAttributeNS(null, 'transform', pm(this.transformMatrix)); + this.clippath.appendChild(clipElement); + this.defs.appendChild(this.clippath); + + // Create a new group with that attribute + current.pendingClip = true; + this.cgrp = document.createElementNS(NS, 'svg:g'); + this.cgrp.setAttributeNS(null, 'clip-path', + 'url(#' + current.clipId + ')'); + this.pgrp.appendChild(this.cgrp); + }, + + closePath: function SVGGraphics_closePath() { + var current = this.current; + var d = current.path.getAttributeNS(null, 'd'); + d += 'Z'; + current.path.setAttributeNS(null, 'd', d); + }, + + setLeading: function SVGGraphics_setLeading(leading) { + this.current.leading = -leading; + }, + + setTextRise: function SVGGraphics_setTextRise(textRise) { + this.current.textRise = textRise; + }, + + setHScale: function SVGGraphics_setHScale(scale) { + this.current.textHScale = scale / 100; + }, + + setGState: function SVGGraphics_setGState(states) { + for (var i = 0, ii = states.length; i < ii; i++) { + var state = states[i]; + var key = state[0]; + var value = state[1]; + + switch (key) { + case 'LW': + this.setLineWidth(value); + break; + case 'LC': + this.setLineCap(value); + break; + case 'LJ': + this.setLineJoin(value); + break; + case 'ML': + this.setMiterLimit(value); + break; + case 'D': + this.setDash(value[0], value[1]); + break; + case 'RI': + break; + case 'FL': + break; + case 'Font': + this.setFont(value); + break; + case 'CA': + break; + case 'ca': + break; + case 'BM': + break; + case 'SMask': + break; + } + } + }, + + fill: function SVGGraphics_fill() { + var current = this.current; + current.element.setAttributeNS(null, 'fill', current.fillColor); + }, + + stroke: function SVGGraphics_stroke() { + var current = this.current; + current.element.setAttributeNS(null, 'stroke', current.strokeColor); + current.element.setAttributeNS(null, 'fill', 'none'); + }, + + eoFill: function SVGGraphics_eoFill() { + var current = this.current; + current.element.setAttributeNS(null, 'fill', current.fillColor); + current.element.setAttributeNS(null, 'fill-rule', 'evenodd'); + }, + + fillStroke: function SVGGraphics_fillStroke() { + // Order is important since stroke wants fill to be none. + // First stroke, then if fill needed, it will be overwritten. + this.stroke(); + this.fill(); + }, + + eoFillStroke: function SVGGraphics_eoFillStroke() { + this.current.element.setAttributeNS(null, 'fill-rule', 'evenodd'); + this.fillStroke(); + }, + + closeStroke: function SVGGraphics_closeStroke() { + this.closePath(); + this.stroke(); + }, + + closeFillStroke: function SVGGraphics_closeFillStroke() { + this.closePath(); + this.fillStroke(); + }, + + paintSolidColorImageMask: + function SVGGraphics_paintSolidColorImageMask() { + var current = this.current; + var rect = document.createElementNS(NS, 'svg:rect'); + rect.setAttributeNS(null, 'x', '0'); + rect.setAttributeNS(null, 'y', '0'); + rect.setAttributeNS(null, 'width', '1px'); + rect.setAttributeNS(null, 'height', '1px'); + rect.setAttributeNS(null, 'fill', current.fillColor); + this.tgrp.appendChild(rect); + }, + + paintJpegXObject: function SVGGraphics_paintJpegXObject(objId, w, h) { + var current = this.current; + var imgObj = this.objs.get(objId); + var imgEl = document.createElementNS(NS, 'svg:image'); + imgEl.setAttributeNS(XLINK_NS, 'xlink:href', imgObj.src); + imgEl.setAttributeNS(null, 'width', imgObj.width + 'px'); + imgEl.setAttributeNS(null, 'height', imgObj.height + 'px'); + imgEl.setAttributeNS(null, 'x', '0'); + imgEl.setAttributeNS(null, 'y', pf(-h)); + imgEl.setAttributeNS(null, 'transform', + 'scale(' + pf(1 / w) + ' ' + pf(-1 / h) + ')'); + + this.tgrp.appendChild(imgEl); + if (current.pendingClip) { + this.cgrp.appendChild(this.tgrp); + this.pgrp.appendChild(this.cgrp); + } else { + this.pgrp.appendChild(this.tgrp); + } + }, + + paintImageXObject: function SVGGraphics_paintImageXObject(objId) { + var imgData = this.objs.get(objId); + if (!imgData) { + warn('Dependent image isn\'t ready yet'); + return; + } + this.paintInlineImageXObject(imgData); + }, + + paintInlineImageXObject: + function SVGGraphics_paintInlineImageXObject(imgData, mask) { + var current = this.current; + var width = imgData.width; + var height = imgData.height; + + var imgSrc = convertImgDataToPng(imgData); + var cliprect = document.createElementNS(NS, 'svg:rect'); + cliprect.setAttributeNS(null, 'x', '0'); + cliprect.setAttributeNS(null, 'y', '0'); + cliprect.setAttributeNS(null, 'width', pf(width)); + cliprect.setAttributeNS(null, 'height', pf(height)); + current.element = cliprect; + this.clip('nonzero'); + var imgEl = document.createElementNS(NS, 'svg:image'); + imgEl.setAttributeNS(XLINK_NS, 'xlink:href', imgSrc); + imgEl.setAttributeNS(null, 'x', '0'); + imgEl.setAttributeNS(null, 'y', pf(-height)); + imgEl.setAttributeNS(null, 'width', pf(width) + 'px'); + imgEl.setAttributeNS(null, 'height', pf(height) + 'px'); + imgEl.setAttributeNS(null, 'transform', + 'scale(' + pf(1 / width) + ' ' + + pf(-1 / height) + ')'); + if (mask) { + mask.appendChild(imgEl); + } else { + this.tgrp.appendChild(imgEl); + } + if (current.pendingClip) { + this.cgrp.appendChild(this.tgrp); + this.pgrp.appendChild(this.cgrp); + } else { + this.pgrp.appendChild(this.tgrp); + } + }, + + paintImageMaskXObject: + function SVGGraphics_paintImageMaskXObject(imgData) { + var current = this.current; + var width = imgData.width; + var height = imgData.height; + var fillColor = current.fillColor; + + current.maskId = 'mask' + maskCount++; + var mask = document.createElementNS(NS, 'svg:mask'); + mask.setAttributeNS(null, 'id', current.maskId); + + var rect = document.createElementNS(NS, 'svg:rect'); + rect.setAttributeNS(null, 'x', '0'); + rect.setAttributeNS(null, 'y', '0'); + rect.setAttributeNS(null, 'width', pf(width)); + rect.setAttributeNS(null, 'height', pf(height)); + rect.setAttributeNS(null, 'fill', fillColor); + rect.setAttributeNS(null, 'mask', 'url(#' + current.maskId +')'); + this.defs.appendChild(mask); + this.tgrp.appendChild(rect); + + this.paintInlineImageXObject(imgData, mask); + }, + + paintFormXObjectBegin: + function SVGGraphics_paintFormXObjectBegin(matrix, bbox) { + this.save(); + + if (isArray(matrix) && matrix.length === 6) { + this.transform(matrix[0], matrix[1], matrix[2], + matrix[3], matrix[4], matrix[5]); + } + + if (isArray(bbox) && bbox.length === 4) { + var width = bbox[2] - bbox[0]; + var height = bbox[3] - bbox[1]; + + var cliprect = document.createElementNS(NS, 'svg:rect'); + cliprect.setAttributeNS(null, 'x', bbox[0]); + cliprect.setAttributeNS(null, 'y', bbox[1]); + cliprect.setAttributeNS(null, 'width', pf(width)); + cliprect.setAttributeNS(null, 'height', pf(height)); + this.current.element = cliprect; + this.clip('nonzero'); + this.endPath(); + } + }, + + paintFormXObjectEnd: + function SVGGraphics_paintFormXObjectEnd() { + this.restore(); + } + }; + return SVGGraphics; +})(); + +PDFJS.SVGGraphics = SVGGraphics; + + +}).call((typeof window === 'undefined') ? this : window); + +if (!PDFJS.workerSrc && typeof document !== 'undefined') { + // workerSrc is not set -- using last script url to define default location + PDFJS.workerSrc = (function () { + 'use strict'; + var scriptTagContainer = document.body || + document.getElementsByTagName('head')[0]; + var pdfjsSrc = scriptTagContainer.lastChild.src; + return pdfjsSrc && pdfjsSrc.replace(/\.js$/i, '.worker.js'); + })(); +} + + diff --git a/public/bower_components/pdfjs-dist/pdf.worker.js b/public/bower_components/pdfjs-dist/pdf.worker.js new file mode 100644 index 0000000..c0a087e --- /dev/null +++ b/public/bower_components/pdfjs-dist/pdf.worker.js @@ -0,0 +1,39826 @@ +/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */ +/* Copyright 2012 Mozilla Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/*jshint globalstrict: false */ +/* globals PDFJS */ + +// Initializing PDFJS global object (if still undefined) +if (typeof PDFJS === 'undefined') { + (typeof window !== 'undefined' ? window : this).PDFJS = {}; +} + +PDFJS.version = '1.1.551'; +PDFJS.build = '2a5616c'; + +(function pdfjsWrapper() { + // Use strict in our context only - users might not want it + 'use strict'; + + + +var globalScope = (typeof window === 'undefined') ? this : window; + +var isWorker = (typeof window === 'undefined'); + +var FONT_IDENTITY_MATRIX = [0.001, 0, 0, 0.001, 0, 0]; + +var TextRenderingMode = { + FILL: 0, + STROKE: 1, + FILL_STROKE: 2, + INVISIBLE: 3, + FILL_ADD_TO_PATH: 4, + STROKE_ADD_TO_PATH: 5, + FILL_STROKE_ADD_TO_PATH: 6, + ADD_TO_PATH: 7, + FILL_STROKE_MASK: 3, + ADD_TO_PATH_FLAG: 4 +}; + +var ImageKind = { + GRAYSCALE_1BPP: 1, + RGB_24BPP: 2, + RGBA_32BPP: 3 +}; + +var AnnotationType = { + WIDGET: 1, + TEXT: 2, + LINK: 3 +}; + +var AnnotationBorderStyleType = { + SOLID: 1, + DASHED: 2, + BEVELED: 3, + INSET: 4, + UNDERLINE: 5 +}; + +var StreamType = { + UNKNOWN: 0, + FLATE: 1, + LZW: 2, + DCT: 3, + JPX: 4, + JBIG: 5, + A85: 6, + AHX: 7, + CCF: 8, + RL: 9 +}; + +var FontType = { + UNKNOWN: 0, + TYPE1: 1, + TYPE1C: 2, + CIDFONTTYPE0: 3, + CIDFONTTYPE0C: 4, + TRUETYPE: 5, + CIDFONTTYPE2: 6, + TYPE3: 7, + OPENTYPE: 8, + TYPE0: 9, + MMTYPE1: 10 +}; + +// The global PDFJS object exposes the API +// In production, it will be declared outside a global wrapper +// In development, it will be declared here +if (!globalScope.PDFJS) { + globalScope.PDFJS = {}; +} + +globalScope.PDFJS.pdfBug = false; + +PDFJS.VERBOSITY_LEVELS = { + errors: 0, + warnings: 1, + infos: 5 +}; + +// All the possible operations for an operator list. +var OPS = PDFJS.OPS = { + // Intentionally start from 1 so it is easy to spot bad operators that will be + // 0's. + dependency: 1, + setLineWidth: 2, + setLineCap: 3, + setLineJoin: 4, + setMiterLimit: 5, + setDash: 6, + setRenderingIntent: 7, + setFlatness: 8, + setGState: 9, + save: 10, + restore: 11, + transform: 12, + moveTo: 13, + lineTo: 14, + curveTo: 15, + curveTo2: 16, + curveTo3: 17, + closePath: 18, + rectangle: 19, + stroke: 20, + closeStroke: 21, + fill: 22, + eoFill: 23, + fillStroke: 24, + eoFillStroke: 25, + closeFillStroke: 26, + closeEOFillStroke: 27, + endPath: 28, + clip: 29, + eoClip: 30, + beginText: 31, + endText: 32, + setCharSpacing: 33, + setWordSpacing: 34, + setHScale: 35, + setLeading: 36, + setFont: 37, + setTextRenderingMode: 38, + setTextRise: 39, + moveText: 40, + setLeadingMoveText: 41, + setTextMatrix: 42, + nextLine: 43, + showText: 44, + showSpacedText: 45, + nextLineShowText: 46, + nextLineSetSpacingShowText: 47, + setCharWidth: 48, + setCharWidthAndBounds: 49, + setStrokeColorSpace: 50, + setFillColorSpace: 51, + setStrokeColor: 52, + setStrokeColorN: 53, + setFillColor: 54, + setFillColorN: 55, + setStrokeGray: 56, + setFillGray: 57, + setStrokeRGBColor: 58, + setFillRGBColor: 59, + setStrokeCMYKColor: 60, + setFillCMYKColor: 61, + shadingFill: 62, + beginInlineImage: 63, + beginImageData: 64, + endInlineImage: 65, + paintXObject: 66, + markPoint: 67, + markPointProps: 68, + beginMarkedContent: 69, + beginMarkedContentProps: 70, + endMarkedContent: 71, + beginCompat: 72, + endCompat: 73, + paintFormXObjectBegin: 74, + paintFormXObjectEnd: 75, + beginGroup: 76, + endGroup: 77, + beginAnnotations: 78, + endAnnotations: 79, + beginAnnotation: 80, + endAnnotation: 81, + paintJpegXObject: 82, + paintImageMaskXObject: 83, + paintImageMaskXObjectGroup: 84, + paintImageXObject: 85, + paintInlineImageXObject: 86, + paintInlineImageXObjectGroup: 87, + paintImageXObjectRepeat: 88, + paintImageMaskXObjectRepeat: 89, + paintSolidColorImageMask: 90, + constructPath: 91 +}; + +// A notice for devs. These are good for things that are helpful to devs, such +// as warning that Workers were disabled, which is important to devs but not +// end users. +function info(msg) { + if (PDFJS.verbosity >= PDFJS.VERBOSITY_LEVELS.infos) { + console.log('Info: ' + msg); + } +} + +// Non-fatal warnings. +function warn(msg) { + if (PDFJS.verbosity >= PDFJS.VERBOSITY_LEVELS.warnings) { + console.log('Warning: ' + msg); + } +} + +// Deprecated API function -- treated as warnings. +function deprecated(details) { + warn('Deprecated API usage: ' + details); +} + +// Fatal errors that should trigger the fallback UI and halt execution by +// throwing an exception. +function error(msg) { + if (PDFJS.verbosity >= PDFJS.VERBOSITY_LEVELS.errors) { + console.log('Error: ' + msg); + console.log(backtrace()); + } + UnsupportedManager.notify(UNSUPPORTED_FEATURES.unknown); + throw new Error(msg); +} + +function backtrace() { + try { + throw new Error(); + } catch (e) { + return e.stack ? e.stack.split('\n').slice(2).join('\n') : ''; + } +} + +function assert(cond, msg) { + if (!cond) { + error(msg); + } +} + +var UNSUPPORTED_FEATURES = PDFJS.UNSUPPORTED_FEATURES = { + unknown: 'unknown', + forms: 'forms', + javaScript: 'javaScript', + smask: 'smask', + shadingPattern: 'shadingPattern', + font: 'font' +}; + +var UnsupportedManager = PDFJS.UnsupportedManager = + (function UnsupportedManagerClosure() { + var listeners = []; + return { + listen: function (cb) { + listeners.push(cb); + }, + notify: function (featureId) { + warn('Unsupported feature "' + featureId + '"'); + for (var i = 0, ii = listeners.length; i < ii; i++) { + listeners[i](featureId); + } + } + }; +})(); + +// Combines two URLs. The baseUrl shall be absolute URL. If the url is an +// absolute URL, it will be returned as is. +function combineUrl(baseUrl, url) { + if (!url) { + return baseUrl; + } + if (/^[a-z][a-z0-9+\-.]*:/i.test(url)) { + return url; + } + var i; + if (url.charAt(0) === '/') { + // absolute path + i = baseUrl.indexOf('://'); + if (url.charAt(1) === '/') { + ++i; + } else { + i = baseUrl.indexOf('/', i + 3); + } + return baseUrl.substring(0, i) + url; + } else { + // relative path + var pathLength = baseUrl.length; + i = baseUrl.lastIndexOf('#'); + pathLength = i >= 0 ? i : pathLength; + i = baseUrl.lastIndexOf('?', pathLength); + pathLength = i >= 0 ? i : pathLength; + var prefixLength = baseUrl.lastIndexOf('/', pathLength); + return baseUrl.substring(0, prefixLength + 1) + url; + } +} + +// Validates if URL is safe and allowed, e.g. to avoid XSS. +function isValidUrl(url, allowRelative) { + if (!url) { + return false; + } + // RFC 3986 (http://tools.ietf.org/html/rfc3986#section-3.1) + // scheme = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." ) + var protocol = /^[a-z][a-z0-9+\-.]*(?=:)/i.exec(url); + if (!protocol) { + return allowRelative; + } + protocol = protocol[0].toLowerCase(); + switch (protocol) { + case 'http': + case 'https': + case 'ftp': + case 'mailto': + case 'tel': + return true; + default: + return false; + } +} +PDFJS.isValidUrl = isValidUrl; + +function shadow(obj, prop, value) { + Object.defineProperty(obj, prop, { value: value, + enumerable: true, + configurable: true, + writable: false }); + return value; +} +PDFJS.shadow = shadow; + +var LinkTarget = PDFJS.LinkTarget = { + NONE: 0, // Default value. + SELF: 1, + BLANK: 2, + PARENT: 3, + TOP: 4, +}; +var LinkTargetStringMap = [ + '', + '_self', + '_blank', + '_parent', + '_top' +]; + +function isExternalLinkTargetSet() { + if (PDFJS.openExternalLinksInNewWindow) { + warn('PDFJS.openExternalLinksInNewWindow is deprecated, ' + + 'use PDFJS.externalLinkTarget instead.'); + if (PDFJS.externalLinkTarget === LinkTarget.NONE) { + PDFJS.externalLinkTarget = LinkTarget.BLANK; + } + // Reset the deprecated parameter, to suppress further warnings. + PDFJS.openExternalLinksInNewWindow = false; + } + switch (PDFJS.externalLinkTarget) { + case LinkTarget.NONE: + return false; + case LinkTarget.SELF: + case LinkTarget.BLANK: + case LinkTarget.PARENT: + case LinkTarget.TOP: + return true; + } + warn('PDFJS.externalLinkTarget is invalid: ' + PDFJS.externalLinkTarget); + // Reset the external link target, to suppress further warnings. + PDFJS.externalLinkTarget = LinkTarget.NONE; + return false; +} +PDFJS.isExternalLinkTargetSet = isExternalLinkTargetSet; + +var PasswordResponses = PDFJS.PasswordResponses = { + NEED_PASSWORD: 1, + INCORRECT_PASSWORD: 2 +}; + +var PasswordException = (function PasswordExceptionClosure() { + function PasswordException(msg, code) { + this.name = 'PasswordException'; + this.message = msg; + this.code = code; + } + + PasswordException.prototype = new Error(); + PasswordException.constructor = PasswordException; + + return PasswordException; +})(); +PDFJS.PasswordException = PasswordException; + +var UnknownErrorException = (function UnknownErrorExceptionClosure() { + function UnknownErrorException(msg, details) { + this.name = 'UnknownErrorException'; + this.message = msg; + this.details = details; + } + + UnknownErrorException.prototype = new Error(); + UnknownErrorException.constructor = UnknownErrorException; + + return UnknownErrorException; +})(); +PDFJS.UnknownErrorException = UnknownErrorException; + +var InvalidPDFException = (function InvalidPDFExceptionClosure() { + function InvalidPDFException(msg) { + this.name = 'InvalidPDFException'; + this.message = msg; + } + + InvalidPDFException.prototype = new Error(); + InvalidPDFException.constructor = InvalidPDFException; + + return InvalidPDFException; +})(); +PDFJS.InvalidPDFException = InvalidPDFException; + +var MissingPDFException = (function MissingPDFExceptionClosure() { + function MissingPDFException(msg) { + this.name = 'MissingPDFException'; + this.message = msg; + } + + MissingPDFException.prototype = new Error(); + MissingPDFException.constructor = MissingPDFException; + + return MissingPDFException; +})(); +PDFJS.MissingPDFException = MissingPDFException; + +var UnexpectedResponseException = + (function UnexpectedResponseExceptionClosure() { + function UnexpectedResponseException(msg, status) { + this.name = 'UnexpectedResponseException'; + this.message = msg; + this.status = status; + } + + UnexpectedResponseException.prototype = new Error(); + UnexpectedResponseException.constructor = UnexpectedResponseException; + + return UnexpectedResponseException; +})(); +PDFJS.UnexpectedResponseException = UnexpectedResponseException; + +var NotImplementedException = (function NotImplementedExceptionClosure() { + function NotImplementedException(msg) { + this.message = msg; + } + + NotImplementedException.prototype = new Error(); + NotImplementedException.prototype.name = 'NotImplementedException'; + NotImplementedException.constructor = NotImplementedException; + + return NotImplementedException; +})(); + +var MissingDataException = (function MissingDataExceptionClosure() { + function MissingDataException(begin, end) { + this.begin = begin; + this.end = end; + this.message = 'Missing data [' + begin + ', ' + end + ')'; + } + + MissingDataException.prototype = new Error(); + MissingDataException.prototype.name = 'MissingDataException'; + MissingDataException.constructor = MissingDataException; + + return MissingDataException; +})(); + +var XRefParseException = (function XRefParseExceptionClosure() { + function XRefParseException(msg) { + this.message = msg; + } + + XRefParseException.prototype = new Error(); + XRefParseException.prototype.name = 'XRefParseException'; + XRefParseException.constructor = XRefParseException; + + return XRefParseException; +})(); + + +function bytesToString(bytes) { + assert(bytes !== null && typeof bytes === 'object' && + bytes.length !== undefined, 'Invalid argument for bytesToString'); + var length = bytes.length; + var MAX_ARGUMENT_COUNT = 8192; + if (length < MAX_ARGUMENT_COUNT) { + return String.fromCharCode.apply(null, bytes); + } + var strBuf = []; + for (var i = 0; i < length; i += MAX_ARGUMENT_COUNT) { + var chunkEnd = Math.min(i + MAX_ARGUMENT_COUNT, length); + var chunk = bytes.subarray(i, chunkEnd); + strBuf.push(String.fromCharCode.apply(null, chunk)); + } + return strBuf.join(''); +} + +function stringToBytes(str) { + assert(typeof str === 'string', 'Invalid argument for stringToBytes'); + var length = str.length; + var bytes = new Uint8Array(length); + for (var i = 0; i < length; ++i) { + bytes[i] = str.charCodeAt(i) & 0xFF; + } + return bytes; +} + +function string32(value) { + return String.fromCharCode((value >> 24) & 0xff, (value >> 16) & 0xff, + (value >> 8) & 0xff, value & 0xff); +} + +function log2(x) { + var n = 1, i = 0; + while (x > n) { + n <<= 1; + i++; + } + return i; +} + +function readInt8(data, start) { + return (data[start] << 24) >> 24; +} + +function readUint16(data, offset) { + return (data[offset] << 8) | data[offset + 1]; +} + +function readUint32(data, offset) { + return ((data[offset] << 24) | (data[offset + 1] << 16) | + (data[offset + 2] << 8) | data[offset + 3]) >>> 0; +} + +// Lazy test the endianness of the platform +// NOTE: This will be 'true' for simulated TypedArrays +function isLittleEndian() { + var buffer8 = new Uint8Array(2); + buffer8[0] = 1; + var buffer16 = new Uint16Array(buffer8.buffer); + return (buffer16[0] === 1); +} + +Object.defineProperty(PDFJS, 'isLittleEndian', { + configurable: true, + get: function PDFJS_isLittleEndian() { + return shadow(PDFJS, 'isLittleEndian', isLittleEndian()); + } +}); + + // Lazy test if the userAgent support CanvasTypedArrays +function hasCanvasTypedArrays() { + var canvas = document.createElement('canvas'); + canvas.width = canvas.height = 1; + var ctx = canvas.getContext('2d'); + var imageData = ctx.createImageData(1, 1); + return (typeof imageData.data.buffer !== 'undefined'); +} + +Object.defineProperty(PDFJS, 'hasCanvasTypedArrays', { + configurable: true, + get: function PDFJS_hasCanvasTypedArrays() { + return shadow(PDFJS, 'hasCanvasTypedArrays', hasCanvasTypedArrays()); + } +}); + +var Uint32ArrayView = (function Uint32ArrayViewClosure() { + + function Uint32ArrayView(buffer, length) { + this.buffer = buffer; + this.byteLength = buffer.length; + this.length = length === undefined ? (this.byteLength >> 2) : length; + ensureUint32ArrayViewProps(this.length); + } + Uint32ArrayView.prototype = Object.create(null); + + var uint32ArrayViewSetters = 0; + function createUint32ArrayProp(index) { + return { + get: function () { + var buffer = this.buffer, offset = index << 2; + return (buffer[offset] | (buffer[offset + 1] << 8) | + (buffer[offset + 2] << 16) | (buffer[offset + 3] << 24)) >>> 0; + }, + set: function (value) { + var buffer = this.buffer, offset = index << 2; + buffer[offset] = value & 255; + buffer[offset + 1] = (value >> 8) & 255; + buffer[offset + 2] = (value >> 16) & 255; + buffer[offset + 3] = (value >>> 24) & 255; + } + }; + } + + function ensureUint32ArrayViewProps(length) { + while (uint32ArrayViewSetters < length) { + Object.defineProperty(Uint32ArrayView.prototype, + uint32ArrayViewSetters, + createUint32ArrayProp(uint32ArrayViewSetters)); + uint32ArrayViewSetters++; + } + } + + return Uint32ArrayView; +})(); + +var IDENTITY_MATRIX = [1, 0, 0, 1, 0, 0]; + +var Util = PDFJS.Util = (function UtilClosure() { + function Util() {} + + var rgbBuf = ['rgb(', 0, ',', 0, ',', 0, ')']; + + // makeCssRgb() can be called thousands of times. Using |rgbBuf| avoids + // creating many intermediate strings. + Util.makeCssRgb = function Util_makeCssRgb(r, g, b) { + rgbBuf[1] = r; + rgbBuf[3] = g; + rgbBuf[5] = b; + return rgbBuf.join(''); + }; + + // Concatenates two transformation matrices together and returns the result. + Util.transform = function Util_transform(m1, m2) { + return [ + m1[0] * m2[0] + m1[2] * m2[1], + m1[1] * m2[0] + m1[3] * m2[1], + m1[0] * m2[2] + m1[2] * m2[3], + m1[1] * m2[2] + m1[3] * m2[3], + m1[0] * m2[4] + m1[2] * m2[5] + m1[4], + m1[1] * m2[4] + m1[3] * m2[5] + m1[5] + ]; + }; + + // For 2d affine transforms + Util.applyTransform = function Util_applyTransform(p, m) { + var xt = p[0] * m[0] + p[1] * m[2] + m[4]; + var yt = p[0] * m[1] + p[1] * m[3] + m[5]; + return [xt, yt]; + }; + + Util.applyInverseTransform = function Util_applyInverseTransform(p, m) { + var d = m[0] * m[3] - m[1] * m[2]; + var xt = (p[0] * m[3] - p[1] * m[2] + m[2] * m[5] - m[4] * m[3]) / d; + var yt = (-p[0] * m[1] + p[1] * m[0] + m[4] * m[1] - m[5] * m[0]) / d; + return [xt, yt]; + }; + + // Applies the transform to the rectangle and finds the minimum axially + // aligned bounding box. + Util.getAxialAlignedBoundingBox = + function Util_getAxialAlignedBoundingBox(r, m) { + + var p1 = Util.applyTransform(r, m); + var p2 = Util.applyTransform(r.slice(2, 4), m); + var p3 = Util.applyTransform([r[0], r[3]], m); + var p4 = Util.applyTransform([r[2], r[1]], m); + return [ + Math.min(p1[0], p2[0], p3[0], p4[0]), + Math.min(p1[1], p2[1], p3[1], p4[1]), + Math.max(p1[0], p2[0], p3[0], p4[0]), + Math.max(p1[1], p2[1], p3[1], p4[1]) + ]; + }; + + Util.inverseTransform = function Util_inverseTransform(m) { + var d = m[0] * m[3] - m[1] * m[2]; + return [m[3] / d, -m[1] / d, -m[2] / d, m[0] / d, + (m[2] * m[5] - m[4] * m[3]) / d, (m[4] * m[1] - m[5] * m[0]) / d]; + }; + + // Apply a generic 3d matrix M on a 3-vector v: + // | a b c | | X | + // | d e f | x | Y | + // | g h i | | Z | + // M is assumed to be serialized as [a,b,c,d,e,f,g,h,i], + // with v as [X,Y,Z] + Util.apply3dTransform = function Util_apply3dTransform(m, v) { + return [ + m[0] * v[0] + m[1] * v[1] + m[2] * v[2], + m[3] * v[0] + m[4] * v[1] + m[5] * v[2], + m[6] * v[0] + m[7] * v[1] + m[8] * v[2] + ]; + }; + + // This calculation uses Singular Value Decomposition. + // The SVD can be represented with formula A = USV. We are interested in the + // matrix S here because it represents the scale values. + Util.singularValueDecompose2dScale = + function Util_singularValueDecompose2dScale(m) { + + var transpose = [m[0], m[2], m[1], m[3]]; + + // Multiply matrix m with its transpose. + var a = m[0] * transpose[0] + m[1] * transpose[2]; + var b = m[0] * transpose[1] + m[1] * transpose[3]; + var c = m[2] * transpose[0] + m[3] * transpose[2]; + var d = m[2] * transpose[1] + m[3] * transpose[3]; + + // Solve the second degree polynomial to get roots. + var first = (a + d) / 2; + var second = Math.sqrt((a + d) * (a + d) - 4 * (a * d - c * b)) / 2; + var sx = first + second || 1; + var sy = first - second || 1; + + // Scale values are the square roots of the eigenvalues. + return [Math.sqrt(sx), Math.sqrt(sy)]; + }; + + // Normalize rectangle rect=[x1, y1, x2, y2] so that (x1,y1) < (x2,y2) + // For coordinate systems whose origin lies in the bottom-left, this + // means normalization to (BL,TR) ordering. For systems with origin in the + // top-left, this means (TL,BR) ordering. + Util.normalizeRect = function Util_normalizeRect(rect) { + var r = rect.slice(0); // clone rect + if (rect[0] > rect[2]) { + r[0] = rect[2]; + r[2] = rect[0]; + } + if (rect[1] > rect[3]) { + r[1] = rect[3]; + r[3] = rect[1]; + } + return r; + }; + + // Returns a rectangle [x1, y1, x2, y2] corresponding to the + // intersection of rect1 and rect2. If no intersection, returns 'false' + // The rectangle coordinates of rect1, rect2 should be [x1, y1, x2, y2] + Util.intersect = function Util_intersect(rect1, rect2) { + function compare(a, b) { + return a - b; + } + + // Order points along the axes + var orderedX = [rect1[0], rect1[2], rect2[0], rect2[2]].sort(compare), + orderedY = [rect1[1], rect1[3], rect2[1], rect2[3]].sort(compare), + result = []; + + rect1 = Util.normalizeRect(rect1); + rect2 = Util.normalizeRect(rect2); + + // X: first and second points belong to different rectangles? + if ((orderedX[0] === rect1[0] && orderedX[1] === rect2[0]) || + (orderedX[0] === rect2[0] && orderedX[1] === rect1[0])) { + // Intersection must be between second and third points + result[0] = orderedX[1]; + result[2] = orderedX[2]; + } else { + return false; + } + + // Y: first and second points belong to different rectangles? + if ((orderedY[0] === rect1[1] && orderedY[1] === rect2[1]) || + (orderedY[0] === rect2[1] && orderedY[1] === rect1[1])) { + // Intersection must be between second and third points + result[1] = orderedY[1]; + result[3] = orderedY[2]; + } else { + return false; + } + + return result; + }; + + Util.sign = function Util_sign(num) { + return num < 0 ? -1 : 1; + }; + + Util.appendToArray = function Util_appendToArray(arr1, arr2) { + Array.prototype.push.apply(arr1, arr2); + }; + + Util.prependToArray = function Util_prependToArray(arr1, arr2) { + Array.prototype.unshift.apply(arr1, arr2); + }; + + Util.extendObj = function extendObj(obj1, obj2) { + for (var key in obj2) { + obj1[key] = obj2[key]; + } + }; + + Util.getInheritableProperty = function Util_getInheritableProperty(dict, + name) { + while (dict && !dict.has(name)) { + dict = dict.get('Parent'); + } + if (!dict) { + return null; + } + return dict.get(name); + }; + + Util.inherit = function Util_inherit(sub, base, prototype) { + sub.prototype = Object.create(base.prototype); + sub.prototype.constructor = sub; + for (var prop in prototype) { + sub.prototype[prop] = prototype[prop]; + } + }; + + Util.loadScript = function Util_loadScript(src, callback) { + var script = document.createElement('script'); + var loaded = false; + script.setAttribute('src', src); + if (callback) { + script.onload = function() { + if (!loaded) { + callback(); + } + loaded = true; + }; + } + document.getElementsByTagName('head')[0].appendChild(script); + }; + + return Util; +})(); + +/** + * PDF page viewport created based on scale, rotation and offset. + * @class + * @alias PDFJS.PageViewport + */ +var PageViewport = PDFJS.PageViewport = (function PageViewportClosure() { + /** + * @constructor + * @private + * @param viewBox {Array} xMin, yMin, xMax and yMax coordinates. + * @param scale {number} scale of the viewport. + * @param rotation {number} rotations of the viewport in degrees. + * @param offsetX {number} offset X + * @param offsetY {number} offset Y + * @param dontFlip {boolean} if true, axis Y will not be flipped. + */ + function PageViewport(viewBox, scale, rotation, offsetX, offsetY, dontFlip) { + this.viewBox = viewBox; + this.scale = scale; + this.rotation = rotation; + this.offsetX = offsetX; + this.offsetY = offsetY; + + // creating transform to convert pdf coordinate system to the normal + // canvas like coordinates taking in account scale and rotation + var centerX = (viewBox[2] + viewBox[0]) / 2; + var centerY = (viewBox[3] + viewBox[1]) / 2; + var rotateA, rotateB, rotateC, rotateD; + rotation = rotation % 360; + rotation = rotation < 0 ? rotation + 360 : rotation; + switch (rotation) { + case 180: + rotateA = -1; rotateB = 0; rotateC = 0; rotateD = 1; + break; + case 90: + rotateA = 0; rotateB = 1; rotateC = 1; rotateD = 0; + break; + case 270: + rotateA = 0; rotateB = -1; rotateC = -1; rotateD = 0; + break; + //case 0: + default: + rotateA = 1; rotateB = 0; rotateC = 0; rotateD = -1; + break; + } + + if (dontFlip) { + rotateC = -rotateC; rotateD = -rotateD; + } + + var offsetCanvasX, offsetCanvasY; + var width, height; + if (rotateA === 0) { + offsetCanvasX = Math.abs(centerY - viewBox[1]) * scale + offsetX; + offsetCanvasY = Math.abs(centerX - viewBox[0]) * scale + offsetY; + width = Math.abs(viewBox[3] - viewBox[1]) * scale; + height = Math.abs(viewBox[2] - viewBox[0]) * scale; + } else { + offsetCanvasX = Math.abs(centerX - viewBox[0]) * scale + offsetX; + offsetCanvasY = Math.abs(centerY - viewBox[1]) * scale + offsetY; + width = Math.abs(viewBox[2] - viewBox[0]) * scale; + height = Math.abs(viewBox[3] - viewBox[1]) * scale; + } + // creating transform for the following operations: + // translate(-centerX, -centerY), rotate and flip vertically, + // scale, and translate(offsetCanvasX, offsetCanvasY) + this.transform = [ + rotateA * scale, + rotateB * scale, + rotateC * scale, + rotateD * scale, + offsetCanvasX - rotateA * scale * centerX - rotateC * scale * centerY, + offsetCanvasY - rotateB * scale * centerX - rotateD * scale * centerY + ]; + + this.width = width; + this.height = height; + this.fontScale = scale; + } + PageViewport.prototype = /** @lends PDFJS.PageViewport.prototype */ { + /** + * Clones viewport with additional properties. + * @param args {Object} (optional) If specified, may contain the 'scale' or + * 'rotation' properties to override the corresponding properties in + * the cloned viewport. + * @returns {PDFJS.PageViewport} Cloned viewport. + */ + clone: function PageViewPort_clone(args) { + args = args || {}; + var scale = 'scale' in args ? args.scale : this.scale; + var rotation = 'rotation' in args ? args.rotation : this.rotation; + return new PageViewport(this.viewBox.slice(), scale, rotation, + this.offsetX, this.offsetY, args.dontFlip); + }, + /** + * Converts PDF point to the viewport coordinates. For examples, useful for + * converting PDF location into canvas pixel coordinates. + * @param x {number} X coordinate. + * @param y {number} Y coordinate. + * @returns {Object} Object that contains 'x' and 'y' properties of the + * point in the viewport coordinate space. + * @see {@link convertToPdfPoint} + * @see {@link convertToViewportRectangle} + */ + convertToViewportPoint: function PageViewport_convertToViewportPoint(x, y) { + return Util.applyTransform([x, y], this.transform); + }, + /** + * Converts PDF rectangle to the viewport coordinates. + * @param rect {Array} xMin, yMin, xMax and yMax coordinates. + * @returns {Array} Contains corresponding coordinates of the rectangle + * in the viewport coordinate space. + * @see {@link convertToViewportPoint} + */ + convertToViewportRectangle: + function PageViewport_convertToViewportRectangle(rect) { + var tl = Util.applyTransform([rect[0], rect[1]], this.transform); + var br = Util.applyTransform([rect[2], rect[3]], this.transform); + return [tl[0], tl[1], br[0], br[1]]; + }, + /** + * Converts viewport coordinates to the PDF location. For examples, useful + * for converting canvas pixel location into PDF one. + * @param x {number} X coordinate. + * @param y {number} Y coordinate. + * @returns {Object} Object that contains 'x' and 'y' properties of the + * point in the PDF coordinate space. + * @see {@link convertToViewportPoint} + */ + convertToPdfPoint: function PageViewport_convertToPdfPoint(x, y) { + return Util.applyInverseTransform([x, y], this.transform); + } + }; + return PageViewport; +})(); + +var PDFStringTranslateTable = [ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0x2D8, 0x2C7, 0x2C6, 0x2D9, 0x2DD, 0x2DB, 0x2DA, 0x2DC, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x2022, 0x2020, 0x2021, 0x2026, 0x2014, + 0x2013, 0x192, 0x2044, 0x2039, 0x203A, 0x2212, 0x2030, 0x201E, 0x201C, + 0x201D, 0x2018, 0x2019, 0x201A, 0x2122, 0xFB01, 0xFB02, 0x141, 0x152, 0x160, + 0x178, 0x17D, 0x131, 0x142, 0x153, 0x161, 0x17E, 0, 0x20AC +]; + +function stringToPDFString(str) { + var i, n = str.length, strBuf = []; + if (str[0] === '\xFE' && str[1] === '\xFF') { + // UTF16BE BOM + for (i = 2; i < n; i += 2) { + strBuf.push(String.fromCharCode( + (str.charCodeAt(i) << 8) | str.charCodeAt(i + 1))); + } + } else { + for (i = 0; i < n; ++i) { + var code = PDFStringTranslateTable[str.charCodeAt(i)]; + strBuf.push(code ? String.fromCharCode(code) : str.charAt(i)); + } + } + return strBuf.join(''); +} + +function stringToUTF8String(str) { + return decodeURIComponent(escape(str)); +} + +function utf8StringToString(str) { + return unescape(encodeURIComponent(str)); +} + +function isEmptyObj(obj) { + for (var key in obj) { + return false; + } + return true; +} + +function isBool(v) { + return typeof v === 'boolean'; +} + +function isInt(v) { + return typeof v === 'number' && ((v | 0) === v); +} + +function isNum(v) { + return typeof v === 'number'; +} + +function isString(v) { + return typeof v === 'string'; +} + +function isName(v) { + return v instanceof Name; +} + +function isCmd(v, cmd) { + return v instanceof Cmd && (cmd === undefined || v.cmd === cmd); +} + +function isDict(v, type) { + if (!(v instanceof Dict)) { + return false; + } + if (!type) { + return true; + } + var dictType = v.get('Type'); + return isName(dictType) && dictType.name === type; +} + +function isArray(v) { + return v instanceof Array; +} + +function isStream(v) { + return typeof v === 'object' && v !== null && v.getBytes !== undefined; +} + +function isArrayBuffer(v) { + return typeof v === 'object' && v !== null && v.byteLength !== undefined; +} + +function isRef(v) { + return v instanceof Ref; +} + +/** + * Promise Capability object. + * + * @typedef {Object} PromiseCapability + * @property {Promise} promise - A promise object. + * @property {function} resolve - Fullfills the promise. + * @property {function} reject - Rejects the promise. + */ + +/** + * Creates a promise capability object. + * @alias PDFJS.createPromiseCapability + * + * @return {PromiseCapability} A capability object contains: + * - a Promise, resolve and reject methods. + */ +function createPromiseCapability() { + var capability = {}; + capability.promise = new Promise(function (resolve, reject) { + capability.resolve = resolve; + capability.reject = reject; + }); + return capability; +} + +PDFJS.createPromiseCapability = createPromiseCapability; + +/** + * Polyfill for Promises: + * The following promise implementation tries to generally implement the + * Promise/A+ spec. Some notable differences from other promise libaries are: + * - There currently isn't a seperate deferred and promise object. + * - Unhandled rejections eventually show an error if they aren't handled. + * + * Based off of the work in: + * https://bugzilla.mozilla.org/show_bug.cgi?id=810490 + */ +(function PromiseClosure() { + if (globalScope.Promise) { + // Promises existing in the DOM/Worker, checking presence of all/resolve + if (typeof globalScope.Promise.all !== 'function') { + globalScope.Promise.all = function (iterable) { + var count = 0, results = [], resolve, reject; + var promise = new globalScope.Promise(function (resolve_, reject_) { + resolve = resolve_; + reject = reject_; + }); + iterable.forEach(function (p, i) { + count++; + p.then(function (result) { + results[i] = result; + count--; + if (count === 0) { + resolve(results); + } + }, reject); + }); + if (count === 0) { + resolve(results); + } + return promise; + }; + } + if (typeof globalScope.Promise.resolve !== 'function') { + globalScope.Promise.resolve = function (value) { + return new globalScope.Promise(function (resolve) { resolve(value); }); + }; + } + if (typeof globalScope.Promise.reject !== 'function') { + globalScope.Promise.reject = function (reason) { + return new globalScope.Promise(function (resolve, reject) { + reject(reason); + }); + }; + } + if (typeof globalScope.Promise.prototype.catch !== 'function') { + globalScope.Promise.prototype.catch = function (onReject) { + return globalScope.Promise.prototype.then(undefined, onReject); + }; + } + return; + } + var STATUS_PENDING = 0; + var STATUS_RESOLVED = 1; + var STATUS_REJECTED = 2; + + // In an attempt to avoid silent exceptions, unhandled rejections are + // tracked and if they aren't handled in a certain amount of time an + // error is logged. + var REJECTION_TIMEOUT = 500; + + var HandlerManager = { + handlers: [], + running: false, + unhandledRejections: [], + pendingRejectionCheck: false, + + scheduleHandlers: function scheduleHandlers(promise) { + if (promise._status === STATUS_PENDING) { + return; + } + + this.handlers = this.handlers.concat(promise._handlers); + promise._handlers = []; + + if (this.running) { + return; + } + this.running = true; + + setTimeout(this.runHandlers.bind(this), 0); + }, + + runHandlers: function runHandlers() { + var RUN_TIMEOUT = 1; // ms + var timeoutAt = Date.now() + RUN_TIMEOUT; + while (this.handlers.length > 0) { + var handler = this.handlers.shift(); + + var nextStatus = handler.thisPromise._status; + var nextValue = handler.thisPromise._value; + + try { + if (nextStatus === STATUS_RESOLVED) { + if (typeof handler.onResolve === 'function') { + nextValue = handler.onResolve(nextValue); + } + } else if (typeof handler.onReject === 'function') { + nextValue = handler.onReject(nextValue); + nextStatus = STATUS_RESOLVED; + + if (handler.thisPromise._unhandledRejection) { + this.removeUnhandeledRejection(handler.thisPromise); + } + } + } catch (ex) { + nextStatus = STATUS_REJECTED; + nextValue = ex; + } + + handler.nextPromise._updateStatus(nextStatus, nextValue); + if (Date.now() >= timeoutAt) { + break; + } + } + + if (this.handlers.length > 0) { + setTimeout(this.runHandlers.bind(this), 0); + return; + } + + this.running = false; + }, + + addUnhandledRejection: function addUnhandledRejection(promise) { + this.unhandledRejections.push({ + promise: promise, + time: Date.now() + }); + this.scheduleRejectionCheck(); + }, + + removeUnhandeledRejection: function removeUnhandeledRejection(promise) { + promise._unhandledRejection = false; + for (var i = 0; i < this.unhandledRejections.length; i++) { + if (this.unhandledRejections[i].promise === promise) { + this.unhandledRejections.splice(i); + i--; + } + } + }, + + scheduleRejectionCheck: function scheduleRejectionCheck() { + if (this.pendingRejectionCheck) { + return; + } + this.pendingRejectionCheck = true; + setTimeout(function rejectionCheck() { + this.pendingRejectionCheck = false; + var now = Date.now(); + for (var i = 0; i < this.unhandledRejections.length; i++) { + if (now - this.unhandledRejections[i].time > REJECTION_TIMEOUT) { + var unhandled = this.unhandledRejections[i].promise._value; + var msg = 'Unhandled rejection: ' + unhandled; + if (unhandled.stack) { + msg += '\n' + unhandled.stack; + } + warn(msg); + this.unhandledRejections.splice(i); + i--; + } + } + if (this.unhandledRejections.length) { + this.scheduleRejectionCheck(); + } + }.bind(this), REJECTION_TIMEOUT); + } + }; + + function Promise(resolver) { + this._status = STATUS_PENDING; + this._handlers = []; + try { + resolver.call(this, this._resolve.bind(this), this._reject.bind(this)); + } catch (e) { + this._reject(e); + } + } + /** + * Builds a promise that is resolved when all the passed in promises are + * resolved. + * @param {array} array of data and/or promises to wait for. + * @return {Promise} New dependant promise. + */ + Promise.all = function Promise_all(promises) { + var resolveAll, rejectAll; + var deferred = new Promise(function (resolve, reject) { + resolveAll = resolve; + rejectAll = reject; + }); + var unresolved = promises.length; + var results = []; + if (unresolved === 0) { + resolveAll(results); + return deferred; + } + function reject(reason) { + if (deferred._status === STATUS_REJECTED) { + return; + } + results = []; + rejectAll(reason); + } + for (var i = 0, ii = promises.length; i < ii; ++i) { + var promise = promises[i]; + var resolve = (function(i) { + return function(value) { + if (deferred._status === STATUS_REJECTED) { + return; + } + results[i] = value; + unresolved--; + if (unresolved === 0) { + resolveAll(results); + } + }; + })(i); + if (Promise.isPromise(promise)) { + promise.then(resolve, reject); + } else { + resolve(promise); + } + } + return deferred; + }; + + /** + * Checks if the value is likely a promise (has a 'then' function). + * @return {boolean} true if value is thenable + */ + Promise.isPromise = function Promise_isPromise(value) { + return value && typeof value.then === 'function'; + }; + + /** + * Creates resolved promise + * @param value resolve value + * @returns {Promise} + */ + Promise.resolve = function Promise_resolve(value) { + return new Promise(function (resolve) { resolve(value); }); + }; + + /** + * Creates rejected promise + * @param reason rejection value + * @returns {Promise} + */ + Promise.reject = function Promise_reject(reason) { + return new Promise(function (resolve, reject) { reject(reason); }); + }; + + Promise.prototype = { + _status: null, + _value: null, + _handlers: null, + _unhandledRejection: null, + + _updateStatus: function Promise__updateStatus(status, value) { + if (this._status === STATUS_RESOLVED || + this._status === STATUS_REJECTED) { + return; + } + + if (status === STATUS_RESOLVED && + Promise.isPromise(value)) { + value.then(this._updateStatus.bind(this, STATUS_RESOLVED), + this._updateStatus.bind(this, STATUS_REJECTED)); + return; + } + + this._status = status; + this._value = value; + + if (status === STATUS_REJECTED && this._handlers.length === 0) { + this._unhandledRejection = true; + HandlerManager.addUnhandledRejection(this); + } + + HandlerManager.scheduleHandlers(this); + }, + + _resolve: function Promise_resolve(value) { + this._updateStatus(STATUS_RESOLVED, value); + }, + + _reject: function Promise_reject(reason) { + this._updateStatus(STATUS_REJECTED, reason); + }, + + then: function Promise_then(onResolve, onReject) { + var nextPromise = new Promise(function (resolve, reject) { + this.resolve = resolve; + this.reject = reject; + }); + this._handlers.push({ + thisPromise: this, + onResolve: onResolve, + onReject: onReject, + nextPromise: nextPromise + }); + HandlerManager.scheduleHandlers(this); + return nextPromise; + }, + + catch: function Promise_catch(onReject) { + return this.then(undefined, onReject); + } + }; + + globalScope.Promise = Promise; +})(); + +var StatTimer = (function StatTimerClosure() { + function rpad(str, pad, length) { + while (str.length < length) { + str += pad; + } + return str; + } + function StatTimer() { + this.started = {}; + this.times = []; + this.enabled = true; + } + StatTimer.prototype = { + time: function StatTimer_time(name) { + if (!this.enabled) { + return; + } + if (name in this.started) { + warn('Timer is already running for ' + name); + } + this.started[name] = Date.now(); + }, + timeEnd: function StatTimer_timeEnd(name) { + if (!this.enabled) { + return; + } + if (!(name in this.started)) { + warn('Timer has not been started for ' + name); + } + this.times.push({ + 'name': name, + 'start': this.started[name], + 'end': Date.now() + }); + // Remove timer from started so it can be called again. + delete this.started[name]; + }, + toString: function StatTimer_toString() { + var i, ii; + var times = this.times; + var out = ''; + // Find the longest name for padding purposes. + var longest = 0; + for (i = 0, ii = times.length; i < ii; ++i) { + var name = times[i]['name']; + if (name.length > longest) { + longest = name.length; + } + } + for (i = 0, ii = times.length; i < ii; ++i) { + var span = times[i]; + var duration = span.end - span.start; + out += rpad(span['name'], ' ', longest) + ' ' + duration + 'ms\n'; + } + return out; + } + }; + return StatTimer; +})(); + +PDFJS.createBlob = function createBlob(data, contentType) { + if (typeof Blob !== 'undefined') { + return new Blob([data], { type: contentType }); + } + // Blob builder is deprecated in FF14 and removed in FF18. + var bb = new MozBlobBuilder(); + bb.append(data); + return bb.getBlob(contentType); +}; + +PDFJS.createObjectURL = (function createObjectURLClosure() { + // Blob/createObjectURL is not available, falling back to data schema. + var digits = + 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='; + + return function createObjectURL(data, contentType) { + if (!PDFJS.disableCreateObjectURL && + typeof URL !== 'undefined' && URL.createObjectURL) { + var blob = PDFJS.createBlob(data, contentType); + return URL.createObjectURL(blob); + } + + var buffer = 'data:' + contentType + ';base64,'; + for (var i = 0, ii = data.length; i < ii; i += 3) { + var b1 = data[i] & 0xFF; + var b2 = data[i + 1] & 0xFF; + var b3 = data[i + 2] & 0xFF; + var d1 = b1 >> 2, d2 = ((b1 & 3) << 4) | (b2 >> 4); + var d3 = i + 1 < ii ? ((b2 & 0xF) << 2) | (b3 >> 6) : 64; + var d4 = i + 2 < ii ? (b3 & 0x3F) : 64; + buffer += digits[d1] + digits[d2] + digits[d3] + digits[d4]; + } + return buffer; + }; +})(); + +function MessageHandler(name, comObj) { + this.name = name; + this.comObj = comObj; + this.callbackIndex = 1; + this.postMessageTransfers = true; + var callbacksCapabilities = this.callbacksCapabilities = {}; + var ah = this.actionHandler = {}; + + ah['console_log'] = [function ahConsoleLog(data) { + console.log.apply(console, data); + }]; + ah['console_error'] = [function ahConsoleError(data) { + console.error.apply(console, data); + }]; + ah['_unsupported_feature'] = [function ah_unsupportedFeature(data) { + UnsupportedManager.notify(data); + }]; + + comObj.onmessage = function messageHandlerComObjOnMessage(event) { + var data = event.data; + if (data.isReply) { + var callbackId = data.callbackId; + if (data.callbackId in callbacksCapabilities) { + var callback = callbacksCapabilities[callbackId]; + delete callbacksCapabilities[callbackId]; + if ('error' in data) { + callback.reject(data.error); + } else { + callback.resolve(data.data); + } + } else { + error('Cannot resolve callback ' + callbackId); + } + } else if (data.action in ah) { + var action = ah[data.action]; + if (data.callbackId) { + Promise.resolve().then(function () { + return action[0].call(action[1], data.data); + }).then(function (result) { + comObj.postMessage({ + isReply: true, + callbackId: data.callbackId, + data: result + }); + }, function (reason) { + if (reason instanceof Error) { + // Serialize error to avoid "DataCloneError" + reason = reason + ''; + } + comObj.postMessage({ + isReply: true, + callbackId: data.callbackId, + error: reason + }); + }); + } else { + action[0].call(action[1], data.data); + } + } else { + error('Unknown action from worker: ' + data.action); + } + }; +} + +MessageHandler.prototype = { + on: function messageHandlerOn(actionName, handler, scope) { + var ah = this.actionHandler; + if (ah[actionName]) { + error('There is already an actionName called "' + actionName + '"'); + } + ah[actionName] = [handler, scope]; + }, + /** + * Sends a message to the comObj to invoke the action with the supplied data. + * @param {String} actionName Action to call. + * @param {JSON} data JSON data to send. + * @param {Array} [transfers] Optional list of transfers/ArrayBuffers + */ + send: function messageHandlerSend(actionName, data, transfers) { + var message = { + action: actionName, + data: data + }; + this.postMessage(message, transfers); + }, + /** + * Sends a message to the comObj to invoke the action with the supplied data. + * Expects that other side will callback with the response. + * @param {String} actionName Action to call. + * @param {JSON} data JSON data to send. + * @param {Array} [transfers] Optional list of transfers/ArrayBuffers. + * @returns {Promise} Promise to be resolved with response data. + */ + sendWithPromise: + function messageHandlerSendWithPromise(actionName, data, transfers) { + var callbackId = this.callbackIndex++; + var message = { + action: actionName, + data: data, + callbackId: callbackId + }; + var capability = createPromiseCapability(); + this.callbacksCapabilities[callbackId] = capability; + try { + this.postMessage(message, transfers); + } catch (e) { + capability.reject(e); + } + return capability.promise; + }, + /** + * Sends raw message to the comObj. + * @private + * @param message {Object} Raw message. + * @param transfers List of transfers/ArrayBuffers, or undefined. + */ + postMessage: function (message, transfers) { + if (transfers && this.postMessageTransfers) { + this.comObj.postMessage(message, transfers); + } else { + this.comObj.postMessage(message); + } + } +}; + +function loadJpegStream(id, imageUrl, objs) { + var img = new Image(); + img.onload = (function loadJpegStream_onloadClosure() { + objs.resolve(id, img); + }); + img.onerror = (function loadJpegStream_onerrorClosure() { + objs.resolve(id, null); + warn('Error during JPEG image loading'); + }); + img.src = imageUrl; +} + + + + +var NetworkManager = (function NetworkManagerClosure() { + + var OK_RESPONSE = 200; + var PARTIAL_CONTENT_RESPONSE = 206; + + function NetworkManager(url, args) { + this.url = url; + args = args || {}; + this.isHttp = /^https?:/i.test(url); + this.httpHeaders = (this.isHttp && args.httpHeaders) || {}; + this.withCredentials = args.withCredentials || false; + this.getXhr = args.getXhr || + function NetworkManager_getXhr() { + return new XMLHttpRequest(); + }; + + this.currXhrId = 0; + this.pendingRequests = {}; + this.loadedRequests = {}; + } + + function getArrayBuffer(xhr) { + var data = xhr.response; + if (typeof data !== 'string') { + return data; + } + var length = data.length; + var array = new Uint8Array(length); + for (var i = 0; i < length; i++) { + array[i] = data.charCodeAt(i) & 0xFF; + } + return array.buffer; + } + + var supportsMozChunked = (function supportsMozChunkedClosure() { + try { + var x = new XMLHttpRequest(); + // Firefox 37- required .open() to be called before setting responseType. + // https://bugzilla.mozilla.org/show_bug.cgi?id=707484 + // Even though the URL is not visited, .open() could fail if the URL is + // blocked, e.g. via the connect-src CSP directive or the NoScript addon. + // When this error occurs, this feature detection method will mistakenly + // report that moz-chunked-arraybuffer is not supported in Firefox 37-. + x.open('GET', 'https://example.com'); + x.responseType = 'moz-chunked-arraybuffer'; + return x.responseType === 'moz-chunked-arraybuffer'; + } catch (e) { + return false; + } + })(); + + NetworkManager.prototype = { + requestRange: function NetworkManager_requestRange(begin, end, listeners) { + var args = { + begin: begin, + end: end + }; + for (var prop in listeners) { + args[prop] = listeners[prop]; + } + return this.request(args); + }, + + requestFull: function NetworkManager_requestFull(listeners) { + return this.request(listeners); + }, + + request: function NetworkManager_request(args) { + var xhr = this.getXhr(); + var xhrId = this.currXhrId++; + var pendingRequest = this.pendingRequests[xhrId] = { + xhr: xhr + }; + + xhr.open('GET', this.url); + xhr.withCredentials = this.withCredentials; + for (var property in this.httpHeaders) { + var value = this.httpHeaders[property]; + if (typeof value === 'undefined') { + continue; + } + xhr.setRequestHeader(property, value); + } + if (this.isHttp && 'begin' in args && 'end' in args) { + var rangeStr = args.begin + '-' + (args.end - 1); + xhr.setRequestHeader('Range', 'bytes=' + rangeStr); + pendingRequest.expectedStatus = 206; + } else { + pendingRequest.expectedStatus = 200; + } + + var useMozChunkedLoading = supportsMozChunked && !!args.onProgressiveData; + if (useMozChunkedLoading) { + xhr.responseType = 'moz-chunked-arraybuffer'; + pendingRequest.onProgressiveData = args.onProgressiveData; + pendingRequest.mozChunked = true; + } else { + xhr.responseType = 'arraybuffer'; + } + + if (args.onError) { + xhr.onerror = function(evt) { + args.onError(xhr.status); + }; + } + xhr.onreadystatechange = this.onStateChange.bind(this, xhrId); + xhr.onprogress = this.onProgress.bind(this, xhrId); + + pendingRequest.onHeadersReceived = args.onHeadersReceived; + pendingRequest.onDone = args.onDone; + pendingRequest.onError = args.onError; + pendingRequest.onProgress = args.onProgress; + + xhr.send(null); + + return xhrId; + }, + + onProgress: function NetworkManager_onProgress(xhrId, evt) { + var pendingRequest = this.pendingRequests[xhrId]; + if (!pendingRequest) { + // Maybe abortRequest was called... + return; + } + + if (pendingRequest.mozChunked) { + var chunk = getArrayBuffer(pendingRequest.xhr); + pendingRequest.onProgressiveData(chunk); + } + + var onProgress = pendingRequest.onProgress; + if (onProgress) { + onProgress(evt); + } + }, + + onStateChange: function NetworkManager_onStateChange(xhrId, evt) { + var pendingRequest = this.pendingRequests[xhrId]; + if (!pendingRequest) { + // Maybe abortRequest was called... + return; + } + + var xhr = pendingRequest.xhr; + if (xhr.readyState >= 2 && pendingRequest.onHeadersReceived) { + pendingRequest.onHeadersReceived(); + delete pendingRequest.onHeadersReceived; + } + + if (xhr.readyState !== 4) { + return; + } + + if (!(xhrId in this.pendingRequests)) { + // The XHR request might have been aborted in onHeadersReceived() + // callback, in which case we should abort request + return; + } + + delete this.pendingRequests[xhrId]; + + // success status == 0 can be on ftp, file and other protocols + if (xhr.status === 0 && this.isHttp) { + if (pendingRequest.onError) { + pendingRequest.onError(xhr.status); + } + return; + } + var xhrStatus = xhr.status || OK_RESPONSE; + + // From http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.35.2: + // "A server MAY ignore the Range header". This means it's possible to + // get a 200 rather than a 206 response from a range request. + var ok_response_on_range_request = + xhrStatus === OK_RESPONSE && + pendingRequest.expectedStatus === PARTIAL_CONTENT_RESPONSE; + + if (!ok_response_on_range_request && + xhrStatus !== pendingRequest.expectedStatus) { + if (pendingRequest.onError) { + pendingRequest.onError(xhr.status); + } + return; + } + + this.loadedRequests[xhrId] = true; + + var chunk = getArrayBuffer(xhr); + if (xhrStatus === PARTIAL_CONTENT_RESPONSE) { + var rangeHeader = xhr.getResponseHeader('Content-Range'); + var matches = /bytes (\d+)-(\d+)\/(\d+)/.exec(rangeHeader); + var begin = parseInt(matches[1], 10); + pendingRequest.onDone({ + begin: begin, + chunk: chunk + }); + } else if (pendingRequest.onProgressiveData) { + pendingRequest.onDone(null); + } else { + pendingRequest.onDone({ + begin: 0, + chunk: chunk + }); + } + }, + + hasPendingRequests: function NetworkManager_hasPendingRequests() { + for (var xhrId in this.pendingRequests) { + return true; + } + return false; + }, + + getRequestXhr: function NetworkManager_getXhr(xhrId) { + return this.pendingRequests[xhrId].xhr; + }, + + isStreamingRequest: function NetworkManager_isStreamingRequest(xhrId) { + return !!(this.pendingRequests[xhrId].onProgressiveData); + }, + + isPendingRequest: function NetworkManager_isPendingRequest(xhrId) { + return xhrId in this.pendingRequests; + }, + + isLoadedRequest: function NetworkManager_isLoadedRequest(xhrId) { + return xhrId in this.loadedRequests; + }, + + abortAllRequests: function NetworkManager_abortAllRequests() { + for (var xhrId in this.pendingRequests) { + this.abortRequest(xhrId | 0); + } + }, + + abortRequest: function NetworkManager_abortRequest(xhrId) { + var xhr = this.pendingRequests[xhrId].xhr; + delete this.pendingRequests[xhrId]; + xhr.abort(); + } + }; + + return NetworkManager; +})(); + + +var ChunkedStream = (function ChunkedStreamClosure() { + function ChunkedStream(length, chunkSize, manager) { + this.bytes = new Uint8Array(length); + this.start = 0; + this.pos = 0; + this.end = length; + this.chunkSize = chunkSize; + this.loadedChunks = []; + this.numChunksLoaded = 0; + this.numChunks = Math.ceil(length / chunkSize); + this.manager = manager; + this.progressiveDataLength = 0; + this.lastSuccessfulEnsureByteChunk = -1; // a single-entry cache + } + + // required methods for a stream. if a particular stream does not + // implement these, an error should be thrown + ChunkedStream.prototype = { + + getMissingChunks: function ChunkedStream_getMissingChunks() { + var chunks = []; + for (var chunk = 0, n = this.numChunks; chunk < n; ++chunk) { + if (!this.loadedChunks[chunk]) { + chunks.push(chunk); + } + } + return chunks; + }, + + getBaseStreams: function ChunkedStream_getBaseStreams() { + return [this]; + }, + + allChunksLoaded: function ChunkedStream_allChunksLoaded() { + return this.numChunksLoaded === this.numChunks; + }, + + onReceiveData: function ChunkedStream_onReceiveData(begin, chunk) { + var end = begin + chunk.byteLength; + + assert(begin % this.chunkSize === 0, 'Bad begin offset: ' + begin); + // Using this.length is inaccurate here since this.start can be moved + // See ChunkedStream.moveStart() + var length = this.bytes.length; + assert(end % this.chunkSize === 0 || end === length, + 'Bad end offset: ' + end); + + this.bytes.set(new Uint8Array(chunk), begin); + var chunkSize = this.chunkSize; + var beginChunk = Math.floor(begin / chunkSize); + var endChunk = Math.floor((end - 1) / chunkSize) + 1; + var curChunk; + + for (curChunk = beginChunk; curChunk < endChunk; ++curChunk) { + if (!this.loadedChunks[curChunk]) { + this.loadedChunks[curChunk] = true; + ++this.numChunksLoaded; + } + } + }, + + onReceiveProgressiveData: + function ChunkedStream_onReceiveProgressiveData(data) { + var position = this.progressiveDataLength; + var beginChunk = Math.floor(position / this.chunkSize); + + this.bytes.set(new Uint8Array(data), position); + position += data.byteLength; + this.progressiveDataLength = position; + var endChunk = position >= this.end ? this.numChunks : + Math.floor(position / this.chunkSize); + var curChunk; + for (curChunk = beginChunk; curChunk < endChunk; ++curChunk) { + if (!this.loadedChunks[curChunk]) { + this.loadedChunks[curChunk] = true; + ++this.numChunksLoaded; + } + } + }, + + ensureByte: function ChunkedStream_ensureByte(pos) { + var chunk = Math.floor(pos / this.chunkSize); + if (chunk === this.lastSuccessfulEnsureByteChunk) { + return; + } + + if (!this.loadedChunks[chunk]) { + throw new MissingDataException(pos, pos + 1); + } + this.lastSuccessfulEnsureByteChunk = chunk; + }, + + ensureRange: function ChunkedStream_ensureRange(begin, end) { + if (begin >= end) { + return; + } + + if (end <= this.progressiveDataLength) { + return; + } + + var chunkSize = this.chunkSize; + var beginChunk = Math.floor(begin / chunkSize); + var endChunk = Math.floor((end - 1) / chunkSize) + 1; + for (var chunk = beginChunk; chunk < endChunk; ++chunk) { + if (!this.loadedChunks[chunk]) { + throw new MissingDataException(begin, end); + } + } + }, + + nextEmptyChunk: function ChunkedStream_nextEmptyChunk(beginChunk) { + var chunk, numChunks = this.numChunks; + for (var i = 0; i < numChunks; ++i) { + chunk = (beginChunk + i) % numChunks; // Wrap around to beginning + if (!this.loadedChunks[chunk]) { + return chunk; + } + } + return null; + }, + + hasChunk: function ChunkedStream_hasChunk(chunk) { + return !!this.loadedChunks[chunk]; + }, + + get length() { + return this.end - this.start; + }, + + get isEmpty() { + return this.length === 0; + }, + + getByte: function ChunkedStream_getByte() { + var pos = this.pos; + if (pos >= this.end) { + return -1; + } + this.ensureByte(pos); + return this.bytes[this.pos++]; + }, + + getUint16: function ChunkedStream_getUint16() { + var b0 = this.getByte(); + var b1 = this.getByte(); + if (b0 === -1 || b1 === -1) { + return -1; + } + return (b0 << 8) + b1; + }, + + getInt32: function ChunkedStream_getInt32() { + var b0 = this.getByte(); + var b1 = this.getByte(); + var b2 = this.getByte(); + var b3 = this.getByte(); + return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3; + }, + + // returns subarray of original buffer + // should only be read + getBytes: function ChunkedStream_getBytes(length) { + var bytes = this.bytes; + var pos = this.pos; + var strEnd = this.end; + + if (!length) { + this.ensureRange(pos, strEnd); + return bytes.subarray(pos, strEnd); + } + + var end = pos + length; + if (end > strEnd) { + end = strEnd; + } + this.ensureRange(pos, end); + + this.pos = end; + return bytes.subarray(pos, end); + }, + + peekByte: function ChunkedStream_peekByte() { + var peekedByte = this.getByte(); + this.pos--; + return peekedByte; + }, + + peekBytes: function ChunkedStream_peekBytes(length) { + var bytes = this.getBytes(length); + this.pos -= bytes.length; + return bytes; + }, + + getByteRange: function ChunkedStream_getBytes(begin, end) { + this.ensureRange(begin, end); + return this.bytes.subarray(begin, end); + }, + + skip: function ChunkedStream_skip(n) { + if (!n) { + n = 1; + } + this.pos += n; + }, + + reset: function ChunkedStream_reset() { + this.pos = this.start; + }, + + moveStart: function ChunkedStream_moveStart() { + this.start = this.pos; + }, + + makeSubStream: function ChunkedStream_makeSubStream(start, length, dict) { + this.ensureRange(start, start + length); + + function ChunkedStreamSubstream() {} + ChunkedStreamSubstream.prototype = Object.create(this); + ChunkedStreamSubstream.prototype.getMissingChunks = function() { + var chunkSize = this.chunkSize; + var beginChunk = Math.floor(this.start / chunkSize); + var endChunk = Math.floor((this.end - 1) / chunkSize) + 1; + var missingChunks = []; + for (var chunk = beginChunk; chunk < endChunk; ++chunk) { + if (!this.loadedChunks[chunk]) { + missingChunks.push(chunk); + } + } + return missingChunks; + }; + var subStream = new ChunkedStreamSubstream(); + subStream.pos = subStream.start = start; + subStream.end = start + length || this.end; + subStream.dict = dict; + return subStream; + }, + + isStream: true + }; + + return ChunkedStream; +})(); + +var ChunkedStreamManager = (function ChunkedStreamManagerClosure() { + + function ChunkedStreamManager(length, chunkSize, url, args) { + this.stream = new ChunkedStream(length, chunkSize, this); + this.length = length; + this.chunkSize = chunkSize; + this.url = url; + this.disableAutoFetch = args.disableAutoFetch; + var msgHandler = this.msgHandler = args.msgHandler; + + if (args.chunkedViewerLoading) { + msgHandler.on('OnDataRange', this.onReceiveData.bind(this)); + msgHandler.on('OnDataProgress', this.onProgress.bind(this)); + this.sendRequest = function ChunkedStreamManager_sendRequest(begin, end) { + msgHandler.send('RequestDataRange', { begin: begin, end: end }); + }; + } else { + + var getXhr = function getXhr() { + return new XMLHttpRequest(); + }; + this.networkManager = new NetworkManager(this.url, { + getXhr: getXhr, + httpHeaders: args.httpHeaders, + withCredentials: args.withCredentials + }); + this.sendRequest = function ChunkedStreamManager_sendRequest(begin, end) { + this.networkManager.requestRange(begin, end, { + onDone: this.onReceiveData.bind(this), + onProgress: this.onProgress.bind(this) + }); + }; + } + + this.currRequestId = 0; + + this.chunksNeededByRequest = {}; + this.requestsByChunk = {}; + this.promisesByRequest = {}; + this.progressiveDataLength = 0; + + this._loadedStreamCapability = createPromiseCapability(); + + if (args.initialData) { + this.onReceiveData({chunk: args.initialData}); + } + } + + ChunkedStreamManager.prototype = { + onLoadedStream: function ChunkedStreamManager_getLoadedStream() { + return this._loadedStreamCapability.promise; + }, + + // Get all the chunks that are not yet loaded and groups them into + // contiguous ranges to load in as few requests as possible + requestAllChunks: function ChunkedStreamManager_requestAllChunks() { + var missingChunks = this.stream.getMissingChunks(); + this._requestChunks(missingChunks); + return this._loadedStreamCapability.promise; + }, + + _requestChunks: function ChunkedStreamManager_requestChunks(chunks) { + var requestId = this.currRequestId++; + + var chunksNeeded; + var i, ii; + this.chunksNeededByRequest[requestId] = chunksNeeded = {}; + for (i = 0, ii = chunks.length; i < ii; i++) { + if (!this.stream.hasChunk(chunks[i])) { + chunksNeeded[chunks[i]] = true; + } + } + + if (isEmptyObj(chunksNeeded)) { + return Promise.resolve(); + } + + var capability = createPromiseCapability(); + this.promisesByRequest[requestId] = capability; + + var chunksToRequest = []; + for (var chunk in chunksNeeded) { + chunk = chunk | 0; + if (!(chunk in this.requestsByChunk)) { + this.requestsByChunk[chunk] = []; + chunksToRequest.push(chunk); + } + this.requestsByChunk[chunk].push(requestId); + } + + if (!chunksToRequest.length) { + return capability.promise; + } + + var groupedChunksToRequest = this.groupChunks(chunksToRequest); + + for (i = 0; i < groupedChunksToRequest.length; ++i) { + var groupedChunk = groupedChunksToRequest[i]; + var begin = groupedChunk.beginChunk * this.chunkSize; + var end = Math.min(groupedChunk.endChunk * this.chunkSize, this.length); + this.sendRequest(begin, end); + } + + return capability.promise; + }, + + getStream: function ChunkedStreamManager_getStream() { + return this.stream; + }, + + // Loads any chunks in the requested range that are not yet loaded + requestRange: function ChunkedStreamManager_requestRange(begin, end) { + + end = Math.min(end, this.length); + + var beginChunk = this.getBeginChunk(begin); + var endChunk = this.getEndChunk(end); + + var chunks = []; + for (var chunk = beginChunk; chunk < endChunk; ++chunk) { + chunks.push(chunk); + } + + return this._requestChunks(chunks); + }, + + requestRanges: function ChunkedStreamManager_requestRanges(ranges) { + ranges = ranges || []; + var chunksToRequest = []; + + for (var i = 0; i < ranges.length; i++) { + var beginChunk = this.getBeginChunk(ranges[i].begin); + var endChunk = this.getEndChunk(ranges[i].end); + for (var chunk = beginChunk; chunk < endChunk; ++chunk) { + if (chunksToRequest.indexOf(chunk) < 0) { + chunksToRequest.push(chunk); + } + } + } + + chunksToRequest.sort(function(a, b) { return a - b; }); + return this._requestChunks(chunksToRequest); + }, + + // Groups a sorted array of chunks into as few contiguous larger + // chunks as possible + groupChunks: function ChunkedStreamManager_groupChunks(chunks) { + var groupedChunks = []; + var beginChunk = -1; + var prevChunk = -1; + for (var i = 0; i < chunks.length; ++i) { + var chunk = chunks[i]; + + if (beginChunk < 0) { + beginChunk = chunk; + } + + if (prevChunk >= 0 && prevChunk + 1 !== chunk) { + groupedChunks.push({ beginChunk: beginChunk, + endChunk: prevChunk + 1 }); + beginChunk = chunk; + } + if (i + 1 === chunks.length) { + groupedChunks.push({ beginChunk: beginChunk, + endChunk: chunk + 1 }); + } + + prevChunk = chunk; + } + return groupedChunks; + }, + + onProgress: function ChunkedStreamManager_onProgress(args) { + var bytesLoaded = (this.stream.numChunksLoaded * this.chunkSize + + args.loaded); + this.msgHandler.send('DocProgress', { + loaded: bytesLoaded, + total: this.length + }); + }, + + onReceiveData: function ChunkedStreamManager_onReceiveData(args) { + var chunk = args.chunk; + var isProgressive = args.begin === undefined; + var begin = isProgressive ? this.progressiveDataLength : args.begin; + var end = begin + chunk.byteLength; + + var beginChunk = Math.floor(begin / this.chunkSize); + var endChunk = end < this.length ? Math.floor(end / this.chunkSize) : + Math.ceil(end / this.chunkSize); + + if (isProgressive) { + this.stream.onReceiveProgressiveData(chunk); + this.progressiveDataLength = end; + } else { + this.stream.onReceiveData(begin, chunk); + } + + if (this.stream.allChunksLoaded()) { + this._loadedStreamCapability.resolve(this.stream); + } + + var loadedRequests = []; + var i, requestId; + for (chunk = beginChunk; chunk < endChunk; ++chunk) { + // The server might return more chunks than requested + var requestIds = this.requestsByChunk[chunk] || []; + delete this.requestsByChunk[chunk]; + + for (i = 0; i < requestIds.length; ++i) { + requestId = requestIds[i]; + var chunksNeeded = this.chunksNeededByRequest[requestId]; + if (chunk in chunksNeeded) { + delete chunksNeeded[chunk]; + } + + if (!isEmptyObj(chunksNeeded)) { + continue; + } + + loadedRequests.push(requestId); + } + } + + // If there are no pending requests, automatically fetch the next + // unfetched chunk of the PDF + if (!this.disableAutoFetch && isEmptyObj(this.requestsByChunk)) { + var nextEmptyChunk; + if (this.stream.numChunksLoaded === 1) { + // This is a special optimization so that after fetching the first + // chunk, rather than fetching the second chunk, we fetch the last + // chunk. + var lastChunk = this.stream.numChunks - 1; + if (!this.stream.hasChunk(lastChunk)) { + nextEmptyChunk = lastChunk; + } + } else { + nextEmptyChunk = this.stream.nextEmptyChunk(endChunk); + } + if (isInt(nextEmptyChunk)) { + this._requestChunks([nextEmptyChunk]); + } + } + + for (i = 0; i < loadedRequests.length; ++i) { + requestId = loadedRequests[i]; + var capability = this.promisesByRequest[requestId]; + delete this.promisesByRequest[requestId]; + capability.resolve(); + } + + this.msgHandler.send('DocProgress', { + loaded: this.stream.numChunksLoaded * this.chunkSize, + total: this.length + }); + }, + + onError: function ChunkedStreamManager_onError(err) { + this._loadedStreamCapability.reject(err); + }, + + getBeginChunk: function ChunkedStreamManager_getBeginChunk(begin) { + var chunk = Math.floor(begin / this.chunkSize); + return chunk; + }, + + getEndChunk: function ChunkedStreamManager_getEndChunk(end) { + var chunk = Math.floor((end - 1) / this.chunkSize) + 1; + return chunk; + }, + + abort: function ChunkedStreamManager_abort() { + if (this.networkManager) { + this.networkManager.abortAllRequests(); + } + for(var requestId in this.promisesByRequest) { + var capability = this.promisesByRequest[requestId]; + capability.reject(new Error('Request was aborted')); + } + } + }; + + return ChunkedStreamManager; +})(); + + +// The maximum number of bytes fetched per range request +var RANGE_CHUNK_SIZE = 65536; + +// TODO(mack): Make use of PDFJS.Util.inherit() when it becomes available +var BasePdfManager = (function BasePdfManagerClosure() { + function BasePdfManager() { + throw new Error('Cannot initialize BaseManagerManager'); + } + + BasePdfManager.prototype = { + onLoadedStream: function BasePdfManager_onLoadedStream() { + throw new NotImplementedException(); + }, + + ensureDoc: function BasePdfManager_ensureDoc(prop, args) { + return this.ensure(this.pdfDocument, prop, args); + }, + + ensureXRef: function BasePdfManager_ensureXRef(prop, args) { + return this.ensure(this.pdfDocument.xref, prop, args); + }, + + ensureCatalog: function BasePdfManager_ensureCatalog(prop, args) { + return this.ensure(this.pdfDocument.catalog, prop, args); + }, + + getPage: function BasePdfManager_pagePage(pageIndex) { + return this.pdfDocument.getPage(pageIndex); + }, + + cleanup: function BasePdfManager_cleanup() { + return this.pdfDocument.cleanup(); + }, + + ensure: function BasePdfManager_ensure(obj, prop, args) { + return new NotImplementedException(); + }, + + requestRange: function BasePdfManager_ensure(begin, end) { + return new NotImplementedException(); + }, + + requestLoadedStream: function BasePdfManager_requestLoadedStream() { + return new NotImplementedException(); + }, + + sendProgressiveData: function BasePdfManager_sendProgressiveData(chunk) { + return new NotImplementedException(); + }, + + updatePassword: function BasePdfManager_updatePassword(password) { + this.pdfDocument.xref.password = this.password = password; + if (this._passwordChangedCapability) { + this._passwordChangedCapability.resolve(); + } + }, + + passwordChanged: function BasePdfManager_passwordChanged() { + this._passwordChangedCapability = createPromiseCapability(); + return this._passwordChangedCapability.promise; + }, + + terminate: function BasePdfManager_terminate() { + return new NotImplementedException(); + } + }; + + return BasePdfManager; +})(); + +var LocalPdfManager = (function LocalPdfManagerClosure() { + function LocalPdfManager(data, password) { + var stream = new Stream(data); + this.pdfDocument = new PDFDocument(this, stream, password); + this._loadedStreamCapability = createPromiseCapability(); + this._loadedStreamCapability.resolve(stream); + } + + LocalPdfManager.prototype = Object.create(BasePdfManager.prototype); + LocalPdfManager.prototype.constructor = LocalPdfManager; + + LocalPdfManager.prototype.ensure = + function LocalPdfManager_ensure(obj, prop, args) { + return new Promise(function (resolve, reject) { + try { + var value = obj[prop]; + var result; + if (typeof value === 'function') { + result = value.apply(obj, args); + } else { + result = value; + } + resolve(result); + } catch (e) { + reject(e); + } + }); + }; + + LocalPdfManager.prototype.requestRange = + function LocalPdfManager_requestRange(begin, end) { + return Promise.resolve(); + }; + + LocalPdfManager.prototype.requestLoadedStream = + function LocalPdfManager_requestLoadedStream() { + }; + + LocalPdfManager.prototype.onLoadedStream = + function LocalPdfManager_getLoadedStream() { + return this._loadedStreamCapability.promise; + }; + + LocalPdfManager.prototype.terminate = + function LocalPdfManager_terminate() { + return; + }; + + return LocalPdfManager; +})(); + +var NetworkPdfManager = (function NetworkPdfManagerClosure() { + function NetworkPdfManager(args, msgHandler) { + + this.msgHandler = msgHandler; + + var params = { + msgHandler: msgHandler, + httpHeaders: args.httpHeaders, + withCredentials: args.withCredentials, + chunkedViewerLoading: args.chunkedViewerLoading, + disableAutoFetch: args.disableAutoFetch, + initialData: args.initialData + }; + this.streamManager = new ChunkedStreamManager(args.length, RANGE_CHUNK_SIZE, + args.url, params); + + this.pdfDocument = new PDFDocument(this, this.streamManager.getStream(), + args.password); + } + + NetworkPdfManager.prototype = Object.create(BasePdfManager.prototype); + NetworkPdfManager.prototype.constructor = NetworkPdfManager; + + NetworkPdfManager.prototype.ensure = + function NetworkPdfManager_ensure(obj, prop, args) { + var pdfManager = this; + + return new Promise(function (resolve, reject) { + function ensureHelper() { + try { + var result; + var value = obj[prop]; + if (typeof value === 'function') { + result = value.apply(obj, args); + } else { + result = value; + } + resolve(result); + } catch(e) { + if (!(e instanceof MissingDataException)) { + reject(e); + return; + } + pdfManager.streamManager.requestRange(e.begin, e.end). + then(ensureHelper, reject); + } + } + + ensureHelper(); + }); + }; + + NetworkPdfManager.prototype.requestRange = + function NetworkPdfManager_requestRange(begin, end) { + return this.streamManager.requestRange(begin, end); + }; + + NetworkPdfManager.prototype.requestLoadedStream = + function NetworkPdfManager_requestLoadedStream() { + this.streamManager.requestAllChunks(); + }; + + NetworkPdfManager.prototype.sendProgressiveData = + function NetworkPdfManager_sendProgressiveData(chunk) { + this.streamManager.onReceiveData({ chunk: chunk }); + }; + + NetworkPdfManager.prototype.onLoadedStream = + function NetworkPdfManager_getLoadedStream() { + return this.streamManager.onLoadedStream(); + }; + + NetworkPdfManager.prototype.terminate = + function NetworkPdfManager_terminate() { + this.streamManager.abort(); + }; + + return NetworkPdfManager; +})(); + + +var Page = (function PageClosure() { + + var LETTER_SIZE_MEDIABOX = [0, 0, 612, 792]; + + function Page(pdfManager, xref, pageIndex, pageDict, ref, fontCache) { + this.pdfManager = pdfManager; + this.pageIndex = pageIndex; + this.pageDict = pageDict; + this.xref = xref; + this.ref = ref; + this.fontCache = fontCache; + this.idCounters = { + obj: 0 + }; + this.resourcesPromise = null; + } + + Page.prototype = { + getPageProp: function Page_getPageProp(key) { + return this.pageDict.get(key); + }, + + getInheritedPageProp: function Page_getInheritedPageProp(key) { + var dict = this.pageDict, valueArray = null, loopCount = 0; + var MAX_LOOP_COUNT = 100; + // Always walk up the entire parent chain, to be able to find + // e.g. \Resources placed on multiple levels of the tree. + while (dict) { + var value = dict.get(key); + if (value) { + if (!valueArray) { + valueArray = []; + } + valueArray.push(value); + } + if (++loopCount > MAX_LOOP_COUNT) { + warn('Page_getInheritedPageProp: maximum loop count exceeded.'); + break; + } + dict = dict.get('Parent'); + } + if (!valueArray) { + return Dict.empty; + } + if (valueArray.length === 1 || !isDict(valueArray[0]) || + loopCount > MAX_LOOP_COUNT) { + return valueArray[0]; + } + return Dict.merge(this.xref, valueArray); + }, + + get content() { + return this.getPageProp('Contents'); + }, + + get resources() { + // For robustness: The spec states that a \Resources entry has to be + // present, but can be empty. Some document omit it still, in this case + // we return an empty dictionary. + return shadow(this, 'resources', this.getInheritedPageProp('Resources')); + }, + + get mediaBox() { + var obj = this.getInheritedPageProp('MediaBox'); + // Reset invalid media box to letter size. + if (!isArray(obj) || obj.length !== 4) { + obj = LETTER_SIZE_MEDIABOX; + } + return shadow(this, 'mediaBox', obj); + }, + + get view() { + var mediaBox = this.mediaBox; + var cropBox = this.getInheritedPageProp('CropBox'); + if (!isArray(cropBox) || cropBox.length !== 4) { + return shadow(this, 'view', mediaBox); + } + + // From the spec, 6th ed., p.963: + // "The crop, bleed, trim, and art boxes should not ordinarily + // extend beyond the boundaries of the media box. If they do, they are + // effectively reduced to their intersection with the media box." + cropBox = Util.intersect(cropBox, mediaBox); + if (!cropBox) { + return shadow(this, 'view', mediaBox); + } + return shadow(this, 'view', cropBox); + }, + + get rotate() { + var rotate = this.getInheritedPageProp('Rotate') || 0; + // Normalize rotation so it's a multiple of 90 and between 0 and 270 + if (rotate % 90 !== 0) { + rotate = 0; + } else if (rotate >= 360) { + rotate = rotate % 360; + } else if (rotate < 0) { + // The spec doesn't cover negatives, assume its counterclockwise + // rotation. The following is the other implementation of modulo. + rotate = ((rotate % 360) + 360) % 360; + } + return shadow(this, 'rotate', rotate); + }, + + getContentStream: function Page_getContentStream() { + var content = this.content; + var stream; + if (isArray(content)) { + // fetching items + var xref = this.xref; + var i, n = content.length; + var streams = []; + for (i = 0; i < n; ++i) { + streams.push(xref.fetchIfRef(content[i])); + } + stream = new StreamsSequenceStream(streams); + } else if (isStream(content)) { + stream = content; + } else { + // replacing non-existent page content with empty one + stream = new NullStream(); + } + return stream; + }, + + loadResources: function Page_loadResources(keys) { + if (!this.resourcesPromise) { + // TODO: add async getInheritedPageProp and remove this. + this.resourcesPromise = this.pdfManager.ensure(this, 'resources'); + } + return this.resourcesPromise.then(function resourceSuccess() { + var objectLoader = new ObjectLoader(this.resources.map, + keys, + this.xref); + return objectLoader.load(); + }.bind(this)); + }, + + getOperatorList: function Page_getOperatorList(handler, task, intent) { + var self = this; + + var pdfManager = this.pdfManager; + var contentStreamPromise = pdfManager.ensure(this, 'getContentStream', + []); + var resourcesPromise = this.loadResources([ + 'ExtGState', + 'ColorSpace', + 'Pattern', + 'Shading', + 'XObject', + 'Font' + // ProcSet + // Properties + ]); + + var partialEvaluator = new PartialEvaluator(pdfManager, this.xref, + handler, this.pageIndex, + 'p' + this.pageIndex + '_', + this.idCounters, + this.fontCache); + + var dataPromises = Promise.all([contentStreamPromise, resourcesPromise]); + var pageListPromise = dataPromises.then(function(data) { + var contentStream = data[0]; + var opList = new OperatorList(intent, handler, self.pageIndex); + + handler.send('StartRenderPage', { + transparency: partialEvaluator.hasBlendModes(self.resources), + pageIndex: self.pageIndex, + intent: intent + }); + return partialEvaluator.getOperatorList(contentStream, task, + self.resources, opList).then(function () { + return opList; + }); + }); + + var annotationsPromise = pdfManager.ensure(this, 'annotations'); + return Promise.all([pageListPromise, annotationsPromise]).then( + function(datas) { + var pageOpList = datas[0]; + var annotations = datas[1]; + + if (annotations.length === 0) { + pageOpList.flush(true); + return pageOpList; + } + + var annotationsReadyPromise = Annotation.appendToOperatorList( + annotations, pageOpList, pdfManager, partialEvaluator, task, intent); + return annotationsReadyPromise.then(function () { + pageOpList.flush(true); + return pageOpList; + }); + }); + }, + + extractTextContent: function Page_extractTextContent(task) { + var handler = { + on: function nullHandlerOn() {}, + send: function nullHandlerSend() {} + }; + + var self = this; + + var pdfManager = this.pdfManager; + var contentStreamPromise = pdfManager.ensure(this, 'getContentStream', + []); + + var resourcesPromise = this.loadResources([ + 'ExtGState', + 'XObject', + 'Font' + ]); + + var dataPromises = Promise.all([contentStreamPromise, + resourcesPromise]); + return dataPromises.then(function(data) { + var contentStream = data[0]; + var partialEvaluator = new PartialEvaluator(pdfManager, self.xref, + handler, self.pageIndex, + 'p' + self.pageIndex + '_', + self.idCounters, + self.fontCache); + + return partialEvaluator.getTextContent(contentStream, + task, + self.resources); + }); + }, + + getAnnotationsData: function Page_getAnnotationsData() { + var annotations = this.annotations; + var annotationsData = []; + for (var i = 0, n = annotations.length; i < n; ++i) { + annotationsData.push(annotations[i].data); + } + return annotationsData; + }, + + get annotations() { + var annotations = []; + var annotationRefs = this.getInheritedPageProp('Annots') || []; + var annotationFactory = new AnnotationFactory(); + for (var i = 0, n = annotationRefs.length; i < n; ++i) { + var annotationRef = annotationRefs[i]; + var annotation = annotationFactory.create(this.xref, annotationRef); + if (annotation && + (annotation.isViewable() || annotation.isPrintable())) { + annotations.push(annotation); + } + } + return shadow(this, 'annotations', annotations); + } + }; + + return Page; +})(); + +/** + * The `PDFDocument` holds all the data of the PDF file. Compared to the + * `PDFDoc`, this one doesn't have any job management code. + * Right now there exists one PDFDocument on the main thread + one object + * for each worker. If there is no worker support enabled, there are two + * `PDFDocument` objects on the main thread created. + */ +var PDFDocument = (function PDFDocumentClosure() { + var FINGERPRINT_FIRST_BYTES = 1024; + var EMPTY_FINGERPRINT = '\x00\x00\x00\x00\x00\x00\x00' + + '\x00\x00\x00\x00\x00\x00\x00\x00\x00'; + + function PDFDocument(pdfManager, arg, password) { + if (isStream(arg)) { + init.call(this, pdfManager, arg, password); + } else if (isArrayBuffer(arg)) { + init.call(this, pdfManager, new Stream(arg), password); + } else { + error('PDFDocument: Unknown argument type'); + } + } + + function init(pdfManager, stream, password) { + assert(stream.length > 0, 'stream must have data'); + this.pdfManager = pdfManager; + this.stream = stream; + var xref = new XRef(this.stream, password, pdfManager); + this.xref = xref; + } + + function find(stream, needle, limit, backwards) { + var pos = stream.pos; + var end = stream.end; + var strBuf = []; + if (pos + limit > end) { + limit = end - pos; + } + for (var n = 0; n < limit; ++n) { + strBuf.push(String.fromCharCode(stream.getByte())); + } + var str = strBuf.join(''); + stream.pos = pos; + var index = backwards ? str.lastIndexOf(needle) : str.indexOf(needle); + if (index === -1) { + return false; /* not found */ + } + stream.pos += index; + return true; /* found */ + } + + var DocumentInfoValidators = { + get entries() { + // Lazily build this since all the validation functions below are not + // defined until after this file loads. + return shadow(this, 'entries', { + Title: isString, + Author: isString, + Subject: isString, + Keywords: isString, + Creator: isString, + Producer: isString, + CreationDate: isString, + ModDate: isString, + Trapped: isName + }); + } + }; + + PDFDocument.prototype = { + parse: function PDFDocument_parse(recoveryMode) { + this.setup(recoveryMode); + var version = this.catalog.catDict.get('Version'); + if (isName(version)) { + this.pdfFormatVersion = version.name; + } + try { + // checking if AcroForm is present + this.acroForm = this.catalog.catDict.get('AcroForm'); + if (this.acroForm) { + this.xfa = this.acroForm.get('XFA'); + var fields = this.acroForm.get('Fields'); + if ((!fields || !isArray(fields) || fields.length === 0) && + !this.xfa) { + // no fields and no XFA -- not a form (?) + this.acroForm = null; + } + } + } catch (ex) { + info('Something wrong with AcroForm entry'); + this.acroForm = null; + } + }, + + get linearization() { + var linearization = null; + if (this.stream.length) { + try { + linearization = Linearization.create(this.stream); + } catch (err) { + if (err instanceof MissingDataException) { + throw err; + } + info(err); + } + } + // shadow the prototype getter with a data property + return shadow(this, 'linearization', linearization); + }, + get startXRef() { + var stream = this.stream; + var startXRef = 0; + var linearization = this.linearization; + if (linearization) { + // Find end of first obj. + stream.reset(); + if (find(stream, 'endobj', 1024)) { + startXRef = stream.pos + 6; + } + } else { + // Find startxref by jumping backward from the end of the file. + var step = 1024; + var found = false, pos = stream.end; + while (!found && pos > 0) { + pos -= step - 'startxref'.length; + if (pos < 0) { + pos = 0; + } + stream.pos = pos; + found = find(stream, 'startxref', step, true); + } + if (found) { + stream.skip(9); + var ch; + do { + ch = stream.getByte(); + } while (Lexer.isSpace(ch)); + var str = ''; + while (ch >= 0x20 && ch <= 0x39) { // < '9' + str += String.fromCharCode(ch); + ch = stream.getByte(); + } + startXRef = parseInt(str, 10); + if (isNaN(startXRef)) { + startXRef = 0; + } + } + } + // shadow the prototype getter with a data property + return shadow(this, 'startXRef', startXRef); + }, + get mainXRefEntriesOffset() { + var mainXRefEntriesOffset = 0; + var linearization = this.linearization; + if (linearization) { + mainXRefEntriesOffset = linearization.mainXRefEntriesOffset; + } + // shadow the prototype getter with a data property + return shadow(this, 'mainXRefEntriesOffset', mainXRefEntriesOffset); + }, + // Find the header, remove leading garbage and setup the stream + // starting from the header. + checkHeader: function PDFDocument_checkHeader() { + var stream = this.stream; + stream.reset(); + if (find(stream, '%PDF-', 1024)) { + // Found the header, trim off any garbage before it. + stream.moveStart(); + // Reading file format version + var MAX_VERSION_LENGTH = 12; + var version = '', ch; + while ((ch = stream.getByte()) > 0x20) { // SPACE + if (version.length >= MAX_VERSION_LENGTH) { + break; + } + version += String.fromCharCode(ch); + } + if (!this.pdfFormatVersion) { + // removing "%PDF-"-prefix + this.pdfFormatVersion = version.substring(5); + } + return; + } + // May not be a PDF file, continue anyway. + }, + parseStartXRef: function PDFDocument_parseStartXRef() { + var startXRef = this.startXRef; + this.xref.setStartXRef(startXRef); + }, + setup: function PDFDocument_setup(recoveryMode) { + this.xref.parse(recoveryMode); + this.catalog = new Catalog(this.pdfManager, this.xref); + }, + get numPages() { + var linearization = this.linearization; + var num = linearization ? linearization.numPages : this.catalog.numPages; + // shadow the prototype getter + return shadow(this, 'numPages', num); + }, + get documentInfo() { + var docInfo = { + PDFFormatVersion: this.pdfFormatVersion, + IsAcroFormPresent: !!this.acroForm, + IsXFAPresent: !!this.xfa + }; + var infoDict; + try { + infoDict = this.xref.trailer.get('Info'); + } catch (err) { + info('The document information dictionary is invalid.'); + } + if (infoDict) { + var validEntries = DocumentInfoValidators.entries; + // Only fill the document info with valid entries from the spec. + for (var key in validEntries) { + if (infoDict.has(key)) { + var value = infoDict.get(key); + // Make sure the value conforms to the spec. + if (validEntries[key](value)) { + docInfo[key] = (typeof value !== 'string' ? + value : stringToPDFString(value)); + } else { + info('Bad value in document info for "' + key + '"'); + } + } + } + } + return shadow(this, 'documentInfo', docInfo); + }, + get fingerprint() { + var xref = this.xref, hash, fileID = ''; + var idArray = xref.trailer.get('ID'); + + if (idArray && isArray(idArray) && idArray[0] && isString(idArray[0]) && + idArray[0] !== EMPTY_FINGERPRINT) { + hash = stringToBytes(idArray[0]); + } else { + if (this.stream.ensureRange) { + this.stream.ensureRange(0, + Math.min(FINGERPRINT_FIRST_BYTES, this.stream.end)); + } + hash = calculateMD5(this.stream.bytes.subarray(0, + FINGERPRINT_FIRST_BYTES), 0, FINGERPRINT_FIRST_BYTES); + } + + for (var i = 0, n = hash.length; i < n; i++) { + var hex = hash[i].toString(16); + fileID += hex.length === 1 ? '0' + hex : hex; + } + + return shadow(this, 'fingerprint', fileID); + }, + + getPage: function PDFDocument_getPage(pageIndex) { + return this.catalog.getPage(pageIndex); + }, + + cleanup: function PDFDocument_cleanup() { + return this.catalog.cleanup(); + } + }; + + return PDFDocument; +})(); + + +var Name = (function NameClosure() { + function Name(name) { + this.name = name; + } + + Name.prototype = {}; + + var nameCache = {}; + + Name.get = function Name_get(name) { + var nameValue = nameCache[name]; + return (nameValue ? nameValue : (nameCache[name] = new Name(name))); + }; + + return Name; +})(); + +var Cmd = (function CmdClosure() { + function Cmd(cmd) { + this.cmd = cmd; + } + + Cmd.prototype = {}; + + var cmdCache = {}; + + Cmd.get = function Cmd_get(cmd) { + var cmdValue = cmdCache[cmd]; + return (cmdValue ? cmdValue : (cmdCache[cmd] = new Cmd(cmd))); + }; + + return Cmd; +})(); + +var Dict = (function DictClosure() { + var nonSerializable = function nonSerializableClosure() { + return nonSerializable; // creating closure on some variable + }; + + var GETALL_DICTIONARY_TYPES_WHITELIST = { + 'Background': true, + 'ExtGState': true, + 'Halftone': true, + 'Layout': true, + 'Mask': true, + 'Pagination': true, + 'Printing': true + }; + + function isRecursionAllowedFor(dict) { + if (!isName(dict.Type)) { + return true; + } + var dictType = dict.Type.name; + return GETALL_DICTIONARY_TYPES_WHITELIST[dictType] === true; + } + + // xref is optional + function Dict(xref) { + // Map should only be used internally, use functions below to access. + this.map = Object.create(null); + this.xref = xref; + this.objId = null; + this.__nonSerializable__ = nonSerializable; // disable cloning of the Dict + } + + Dict.prototype = { + assignXref: function Dict_assignXref(newXref) { + this.xref = newXref; + }, + + // automatically dereferences Ref objects + get: function Dict_get(key1, key2, key3) { + var value; + var xref = this.xref; + if (typeof (value = this.map[key1]) !== 'undefined' || key1 in this.map || + typeof key2 === 'undefined') { + return xref ? xref.fetchIfRef(value) : value; + } + if (typeof (value = this.map[key2]) !== 'undefined' || key2 in this.map || + typeof key3 === 'undefined') { + return xref ? xref.fetchIfRef(value) : value; + } + value = this.map[key3] || null; + return xref ? xref.fetchIfRef(value) : value; + }, + + // Same as get(), but returns a promise and uses fetchIfRefAsync(). + getAsync: function Dict_getAsync(key1, key2, key3) { + var value; + var xref = this.xref; + if (typeof (value = this.map[key1]) !== 'undefined' || key1 in this.map || + typeof key2 === 'undefined') { + if (xref) { + return xref.fetchIfRefAsync(value); + } + return Promise.resolve(value); + } + if (typeof (value = this.map[key2]) !== 'undefined' || key2 in this.map || + typeof key3 === 'undefined') { + if (xref) { + return xref.fetchIfRefAsync(value); + } + return Promise.resolve(value); + } + value = this.map[key3] || null; + if (xref) { + return xref.fetchIfRefAsync(value); + } + return Promise.resolve(value); + }, + + // Same as get(), but dereferences all elements if the result is an Array. + getArray: function Dict_getArray(key1, key2, key3) { + var value = this.get(key1, key2, key3); + var xref = this.xref; + if (!isArray(value) || !xref) { + return value; + } + value = value.slice(); // Ensure that we don't modify the Dict data. + for (var i = 0, ii = value.length; i < ii; i++) { + if (!isRef(value[i])) { + continue; + } + value[i] = xref.fetch(value[i]); + } + return value; + }, + + // no dereferencing + getRaw: function Dict_getRaw(key) { + return this.map[key]; + }, + + // creates new map and dereferences all Refs + getAll: function Dict_getAll() { + var all = Object.create(null); + var queue = null; + var key, obj; + for (key in this.map) { + obj = this.get(key); + if (obj instanceof Dict) { + if (isRecursionAllowedFor(obj)) { + (queue || (queue = [])).push({target: all, key: key, obj: obj}); + } else { + all[key] = this.getRaw(key); + } + } else { + all[key] = obj; + } + } + if (!queue) { + return all; + } + + // trying to take cyclic references into the account + var processed = Object.create(null); + while (queue.length > 0) { + var item = queue.shift(); + var itemObj = item.obj; + var objId = itemObj.objId; + if (objId && objId in processed) { + item.target[item.key] = processed[objId]; + continue; + } + var dereferenced = Object.create(null); + for (key in itemObj.map) { + obj = itemObj.get(key); + if (obj instanceof Dict) { + if (isRecursionAllowedFor(obj)) { + queue.push({target: dereferenced, key: key, obj: obj}); + } else { + dereferenced[key] = itemObj.getRaw(key); + } + } else { + dereferenced[key] = obj; + } + } + if (objId) { + processed[objId] = dereferenced; + } + item.target[item.key] = dereferenced; + } + return all; + }, + + getKeys: function Dict_getKeys() { + return Object.keys(this.map); + }, + + set: function Dict_set(key, value) { + this.map[key] = value; + }, + + has: function Dict_has(key) { + return key in this.map; + }, + + forEach: function Dict_forEach(callback) { + for (var key in this.map) { + callback(key, this.get(key)); + } + } + }; + + Dict.empty = new Dict(null); + + Dict.merge = function Dict_merge(xref, dictArray) { + var mergedDict = new Dict(xref); + + for (var i = 0, ii = dictArray.length; i < ii; i++) { + var dict = dictArray[i]; + if (!isDict(dict)) { + continue; + } + for (var keyName in dict.map) { + if (mergedDict.map[keyName]) { + continue; + } + mergedDict.map[keyName] = dict.map[keyName]; + } + } + return mergedDict; + }; + + return Dict; +})(); + +var Ref = (function RefClosure() { + function Ref(num, gen) { + this.num = num; + this.gen = gen; + } + + Ref.prototype = { + toString: function Ref_toString() { + // This function is hot, so we make the string as compact as possible. + // |this.gen| is almost always zero, so we treat that case specially. + var str = this.num + 'R'; + if (this.gen !== 0) { + str += this.gen; + } + return str; + } + }; + + return Ref; +})(); + +// The reference is identified by number and generation. +// This structure stores only one instance of the reference. +var RefSet = (function RefSetClosure() { + function RefSet() { + this.dict = {}; + } + + RefSet.prototype = { + has: function RefSet_has(ref) { + return ref.toString() in this.dict; + }, + + put: function RefSet_put(ref) { + this.dict[ref.toString()] = true; + }, + + remove: function RefSet_remove(ref) { + delete this.dict[ref.toString()]; + } + }; + + return RefSet; +})(); + +var RefSetCache = (function RefSetCacheClosure() { + function RefSetCache() { + this.dict = Object.create(null); + } + + RefSetCache.prototype = { + get: function RefSetCache_get(ref) { + return this.dict[ref.toString()]; + }, + + has: function RefSetCache_has(ref) { + return ref.toString() in this.dict; + }, + + put: function RefSetCache_put(ref, obj) { + this.dict[ref.toString()] = obj; + }, + + putAlias: function RefSetCache_putAlias(ref, aliasRef) { + this.dict[ref.toString()] = this.get(aliasRef); + }, + + forEach: function RefSetCache_forEach(fn, thisArg) { + for (var i in this.dict) { + fn.call(thisArg, this.dict[i]); + } + }, + + clear: function RefSetCache_clear() { + this.dict = Object.create(null); + } + }; + + return RefSetCache; +})(); + +var Catalog = (function CatalogClosure() { + function Catalog(pdfManager, xref) { + this.pdfManager = pdfManager; + this.xref = xref; + this.catDict = xref.getCatalogObj(); + this.fontCache = new RefSetCache(); + assert(isDict(this.catDict), + 'catalog object is not a dictionary'); + + this.pagePromises = []; + } + + Catalog.prototype = { + get metadata() { + var streamRef = this.catDict.getRaw('Metadata'); + if (!isRef(streamRef)) { + return shadow(this, 'metadata', null); + } + + var encryptMetadata = (!this.xref.encrypt ? false : + this.xref.encrypt.encryptMetadata); + + var stream = this.xref.fetch(streamRef, !encryptMetadata); + var metadata; + if (stream && isDict(stream.dict)) { + var type = stream.dict.get('Type'); + var subtype = stream.dict.get('Subtype'); + + if (isName(type) && isName(subtype) && + type.name === 'Metadata' && subtype.name === 'XML') { + // XXX: This should examine the charset the XML document defines, + // however since there are currently no real means to decode + // arbitrary charsets, let's just hope that the author of the PDF + // was reasonable enough to stick with the XML default charset, + // which is UTF-8. + try { + metadata = stringToUTF8String(bytesToString(stream.getBytes())); + } catch (e) { + info('Skipping invalid metadata.'); + } + } + } + + return shadow(this, 'metadata', metadata); + }, + get toplevelPagesDict() { + var pagesObj = this.catDict.get('Pages'); + assert(isDict(pagesObj), 'invalid top-level pages dictionary'); + // shadow the prototype getter + return shadow(this, 'toplevelPagesDict', pagesObj); + }, + get documentOutline() { + var obj = null; + try { + obj = this.readDocumentOutline(); + } catch (ex) { + if (ex instanceof MissingDataException) { + throw ex; + } + warn('Unable to read document outline'); + } + return shadow(this, 'documentOutline', obj); + }, + readDocumentOutline: function Catalog_readDocumentOutline() { + var xref = this.xref; + var obj = this.catDict.get('Outlines'); + var root = { items: [] }; + if (isDict(obj)) { + obj = obj.getRaw('First'); + var processed = new RefSet(); + if (isRef(obj)) { + var queue = [{obj: obj, parent: root}]; + // to avoid recursion keeping track of the items + // in the processed dictionary + processed.put(obj); + while (queue.length > 0) { + var i = queue.shift(); + var outlineDict = xref.fetchIfRef(i.obj); + if (outlineDict === null) { + continue; + } + if (!outlineDict.has('Title')) { + error('Invalid outline item'); + } + var dest = outlineDict.get('A'); + if (dest) { + dest = dest.get('D'); + } else if (outlineDict.has('Dest')) { + dest = outlineDict.getRaw('Dest'); + if (isName(dest)) { + dest = dest.name; + } + } + var title = outlineDict.get('Title'); + var outlineItem = { + dest: dest, + title: stringToPDFString(title), + color: outlineDict.get('C') || [0, 0, 0], + count: outlineDict.get('Count'), + bold: !!(outlineDict.get('F') & 2), + italic: !!(outlineDict.get('F') & 1), + items: [] + }; + i.parent.items.push(outlineItem); + obj = outlineDict.getRaw('First'); + if (isRef(obj) && !processed.has(obj)) { + queue.push({obj: obj, parent: outlineItem}); + processed.put(obj); + } + obj = outlineDict.getRaw('Next'); + if (isRef(obj) && !processed.has(obj)) { + queue.push({obj: obj, parent: i.parent}); + processed.put(obj); + } + } + } + } + return (root.items.length > 0 ? root.items : null); + }, + get numPages() { + var obj = this.toplevelPagesDict.get('Count'); + assert( + isInt(obj), + 'page count in top level pages object is not an integer' + ); + // shadow the prototype getter + return shadow(this, 'num', obj); + }, + get destinations() { + function fetchDestination(dest) { + return isDict(dest) ? dest.get('D') : dest; + } + + var xref = this.xref; + var dests = {}, nameTreeRef, nameDictionaryRef; + var obj = this.catDict.get('Names'); + if (obj && obj.has('Dests')) { + nameTreeRef = obj.getRaw('Dests'); + } else if (this.catDict.has('Dests')) { + nameDictionaryRef = this.catDict.get('Dests'); + } + + if (nameDictionaryRef) { + // reading simple destination dictionary + obj = nameDictionaryRef; + obj.forEach(function catalogForEach(key, value) { + if (!value) { + return; + } + dests[key] = fetchDestination(value); + }); + } + if (nameTreeRef) { + var nameTree = new NameTree(nameTreeRef, xref); + var names = nameTree.getAll(); + for (var name in names) { + if (!names.hasOwnProperty(name)) { + continue; + } + dests[name] = fetchDestination(names[name]); + } + } + return shadow(this, 'destinations', dests); + }, + getDestination: function Catalog_getDestination(destinationId) { + function fetchDestination(dest) { + return isDict(dest) ? dest.get('D') : dest; + } + + var xref = this.xref; + var dest = null, nameTreeRef, nameDictionaryRef; + var obj = this.catDict.get('Names'); + if (obj && obj.has('Dests')) { + nameTreeRef = obj.getRaw('Dests'); + } else if (this.catDict.has('Dests')) { + nameDictionaryRef = this.catDict.get('Dests'); + } + + if (nameDictionaryRef) { // Simple destination dictionary. + var value = nameDictionaryRef.get(destinationId); + if (value) { + dest = fetchDestination(value); + } + } + if (nameTreeRef) { + var nameTree = new NameTree(nameTreeRef, xref); + dest = fetchDestination(nameTree.get(destinationId)); + } + return dest; + }, + get attachments() { + var xref = this.xref; + var attachments = null, nameTreeRef; + var obj = this.catDict.get('Names'); + if (obj) { + nameTreeRef = obj.getRaw('EmbeddedFiles'); + } + + if (nameTreeRef) { + var nameTree = new NameTree(nameTreeRef, xref); + var names = nameTree.getAll(); + for (var name in names) { + if (!names.hasOwnProperty(name)) { + continue; + } + var fs = new FileSpec(names[name], xref); + if (!attachments) { + attachments = {}; + } + attachments[stringToPDFString(name)] = fs.serializable; + } + } + return shadow(this, 'attachments', attachments); + }, + get javaScript() { + var xref = this.xref; + var obj = this.catDict.get('Names'); + + var javaScript = []; + function appendIfJavaScriptDict(jsDict) { + var type = jsDict.get('S'); + if (!isName(type) || type.name !== 'JavaScript') { + return; + } + var js = jsDict.get('JS'); + if (isStream(js)) { + js = bytesToString(js.getBytes()); + } else if (!isString(js)) { + return; + } + javaScript.push(stringToPDFString(js)); + } + if (obj && obj.has('JavaScript')) { + var nameTree = new NameTree(obj.getRaw('JavaScript'), xref); + var names = nameTree.getAll(); + for (var name in names) { + if (!names.hasOwnProperty(name)) { + continue; + } + // We don't really use the JavaScript right now. This code is + // defensive so we don't cause errors on document load. + var jsDict = names[name]; + if (isDict(jsDict)) { + appendIfJavaScriptDict(jsDict); + } + } + } + + // Append OpenAction actions to javaScript array + var openactionDict = this.catDict.get('OpenAction'); + if (isDict(openactionDict, 'Action')) { + var actionType = openactionDict.get('S'); + if (isName(actionType) && actionType.name === 'Named') { + // The named Print action is not a part of the PDF 1.7 specification, + // but is supported by many PDF readers/writers (including Adobe's). + var action = openactionDict.get('N'); + if (isName(action) && action.name === 'Print') { + javaScript.push('print({});'); + } + } else { + appendIfJavaScriptDict(openactionDict); + } + } + + return shadow(this, 'javaScript', javaScript); + }, + + cleanup: function Catalog_cleanup() { + var promises = []; + this.fontCache.forEach(function (promise) { + promises.push(promise); + }); + return Promise.all(promises).then(function (translatedFonts) { + for (var i = 0, ii = translatedFonts.length; i < ii; i++) { + var font = translatedFonts[i].dict; + delete font.translated; + } + this.fontCache.clear(); + }.bind(this)); + }, + + getPage: function Catalog_getPage(pageIndex) { + if (!(pageIndex in this.pagePromises)) { + this.pagePromises[pageIndex] = this.getPageDict(pageIndex).then( + function (a) { + var dict = a[0]; + var ref = a[1]; + return new Page(this.pdfManager, this.xref, pageIndex, dict, ref, + this.fontCache); + }.bind(this) + ); + } + return this.pagePromises[pageIndex]; + }, + + getPageDict: function Catalog_getPageDict(pageIndex) { + var capability = createPromiseCapability(); + var nodesToVisit = [this.catDict.getRaw('Pages')]; + var currentPageIndex = 0; + var xref = this.xref; + var checkAllKids = false; + + function next() { + while (nodesToVisit.length) { + var currentNode = nodesToVisit.pop(); + + if (isRef(currentNode)) { + xref.fetchAsync(currentNode).then(function (obj) { + if (isDict(obj, 'Page') || (isDict(obj) && !obj.has('Kids'))) { + if (pageIndex === currentPageIndex) { + capability.resolve([obj, currentNode]); + } else { + currentPageIndex++; + next(); + } + return; + } + nodesToVisit.push(obj); + next(); + }, capability.reject); + return; + } + + // Must be a child page dictionary. + assert( + isDict(currentNode), + 'page dictionary kid reference points to wrong type of object' + ); + var count = currentNode.get('Count'); + // If the current node doesn't have any children, avoid getting stuck + // in an empty node further down in the tree (see issue5644.pdf). + if (count === 0) { + checkAllKids = true; + } + // Skip nodes where the page can't be. + if (currentPageIndex + count <= pageIndex) { + currentPageIndex += count; + continue; + } + + var kids = currentNode.get('Kids'); + assert(isArray(kids), 'page dictionary kids object is not an array'); + if (!checkAllKids && count === kids.length) { + // Nodes that don't have the page have been skipped and this is the + // bottom of the tree which means the page requested must be a + // descendant of this pages node. Ideally we would just resolve the + // promise with the page ref here, but there is the case where more + // pages nodes could link to single a page (see issue 3666 pdf). To + // handle this push it back on the queue so if it is a pages node it + // will be descended into. + nodesToVisit = [kids[pageIndex - currentPageIndex]]; + currentPageIndex = pageIndex; + continue; + } else { + for (var last = kids.length - 1; last >= 0; last--) { + nodesToVisit.push(kids[last]); + } + } + } + capability.reject('Page index ' + pageIndex + ' not found.'); + } + next(); + return capability.promise; + }, + + getPageIndex: function Catalog_getPageIndex(ref) { + // The page tree nodes have the count of all the leaves below them. To get + // how many pages are before we just have to walk up the tree and keep + // adding the count of siblings to the left of the node. + var xref = this.xref; + function pagesBeforeRef(kidRef) { + var total = 0; + var parentRef; + return xref.fetchAsync(kidRef).then(function (node) { + if (!node) { + return null; + } + parentRef = node.getRaw('Parent'); + return node.getAsync('Parent'); + }).then(function (parent) { + if (!parent) { + return null; + } + return parent.getAsync('Kids'); + }).then(function (kids) { + if (!kids) { + return null; + } + var kidPromises = []; + var found = false; + for (var i = 0; i < kids.length; i++) { + var kid = kids[i]; + assert(isRef(kid), 'kids must be a ref'); + if (kid.num === kidRef.num) { + found = true; + break; + } + kidPromises.push(xref.fetchAsync(kid).then(function (kid) { + if (kid.has('Count')) { + var count = kid.get('Count'); + total += count; + } else { // page leaf node + total++; + } + })); + } + if (!found) { + error('kid ref not found in parents kids'); + } + return Promise.all(kidPromises).then(function () { + return [total, parentRef]; + }); + }); + } + + var total = 0; + function next(ref) { + return pagesBeforeRef(ref).then(function (args) { + if (!args) { + return total; + } + var count = args[0]; + var parentRef = args[1]; + total += count; + return next(parentRef); + }); + } + + return next(ref); + } + }; + + return Catalog; +})(); + +var XRef = (function XRefClosure() { + function XRef(stream, password) { + this.stream = stream; + this.entries = []; + this.xrefstms = {}; + // prepare the XRef cache + this.cache = []; + this.password = password; + this.stats = { + streamTypes: [], + fontTypes: [] + }; + } + + XRef.prototype = { + setStartXRef: function XRef_setStartXRef(startXRef) { + // Store the starting positions of xref tables as we process them + // so we can recover from missing data errors + this.startXRefQueue = [startXRef]; + }, + + parse: function XRef_parse(recoveryMode) { + var trailerDict; + if (!recoveryMode) { + trailerDict = this.readXRef(); + } else { + warn('Indexing all PDF objects'); + trailerDict = this.indexObjects(); + } + trailerDict.assignXref(this); + this.trailer = trailerDict; + var encrypt = trailerDict.get('Encrypt'); + if (encrypt) { + var ids = trailerDict.get('ID'); + var fileId = (ids && ids.length) ? ids[0] : ''; + this.encrypt = new CipherTransformFactory(encrypt, fileId, + this.password); + } + + // get the root dictionary (catalog) object + if (!(this.root = trailerDict.get('Root'))) { + error('Invalid root reference'); + } + }, + + processXRefTable: function XRef_processXRefTable(parser) { + if (!('tableState' in this)) { + // Stores state of the table as we process it so we can resume + // from middle of table in case of missing data error + this.tableState = { + entryNum: 0, + streamPos: parser.lexer.stream.pos, + parserBuf1: parser.buf1, + parserBuf2: parser.buf2 + }; + } + + var obj = this.readXRefTable(parser); + + // Sanity check + if (!isCmd(obj, 'trailer')) { + error('Invalid XRef table: could not find trailer dictionary'); + } + // Read trailer dictionary, e.g. + // trailer + // << /Size 22 + // /Root 20R + // /Info 10R + // /ID [ <81b14aafa313db63dbd6f981e49f94f4> ] + // >> + // The parser goes through the entire stream << ... >> and provides + // a getter interface for the key-value table + var dict = parser.getObj(); + + // The pdflib PDF generator can generate a nested trailer dictionary + if (!isDict(dict) && dict.dict) { + dict = dict.dict; + } + if (!isDict(dict)) { + error('Invalid XRef table: could not parse trailer dictionary'); + } + delete this.tableState; + + return dict; + }, + + readXRefTable: function XRef_readXRefTable(parser) { + // Example of cross-reference table: + // xref + // 0 1 <-- subsection header (first obj #, obj count) + // 0000000000 65535 f <-- actual object (offset, generation #, f/n) + // 23 2 <-- subsection header ... and so on ... + // 0000025518 00002 n + // 0000025635 00000 n + // trailer + // ... + + var stream = parser.lexer.stream; + var tableState = this.tableState; + stream.pos = tableState.streamPos; + parser.buf1 = tableState.parserBuf1; + parser.buf2 = tableState.parserBuf2; + + // Outer loop is over subsection headers + var obj; + + while (true) { + if (!('firstEntryNum' in tableState) || !('entryCount' in tableState)) { + if (isCmd(obj = parser.getObj(), 'trailer')) { + break; + } + tableState.firstEntryNum = obj; + tableState.entryCount = parser.getObj(); + } + + var first = tableState.firstEntryNum; + var count = tableState.entryCount; + if (!isInt(first) || !isInt(count)) { + error('Invalid XRef table: wrong types in subsection header'); + } + // Inner loop is over objects themselves + for (var i = tableState.entryNum; i < count; i++) { + tableState.streamPos = stream.pos; + tableState.entryNum = i; + tableState.parserBuf1 = parser.buf1; + tableState.parserBuf2 = parser.buf2; + + var entry = {}; + entry.offset = parser.getObj(); + entry.gen = parser.getObj(); + var type = parser.getObj(); + + if (isCmd(type, 'f')) { + entry.free = true; + } else if (isCmd(type, 'n')) { + entry.uncompressed = true; + } + + // Validate entry obj + if (!isInt(entry.offset) || !isInt(entry.gen) || + !(entry.free || entry.uncompressed)) { + error('Invalid entry in XRef subsection: ' + first + ', ' + count); + } + + if (!this.entries[i + first]) { + this.entries[i + first] = entry; + } + } + + tableState.entryNum = 0; + tableState.streamPos = stream.pos; + tableState.parserBuf1 = parser.buf1; + tableState.parserBuf2 = parser.buf2; + delete tableState.firstEntryNum; + delete tableState.entryCount; + } + + // Per issue 3248: hp scanners generate bad XRef + if (first === 1 && this.entries[1] && this.entries[1].free) { + // shifting the entries + this.entries.shift(); + } + + // Sanity check: as per spec, first object must be free + if (this.entries[0] && !this.entries[0].free) { + error('Invalid XRef table: unexpected first object'); + } + return obj; + }, + + processXRefStream: function XRef_processXRefStream(stream) { + if (!('streamState' in this)) { + // Stores state of the stream as we process it so we can resume + // from middle of stream in case of missing data error + var streamParameters = stream.dict; + var byteWidths = streamParameters.get('W'); + var range = streamParameters.get('Index'); + if (!range) { + range = [0, streamParameters.get('Size')]; + } + + this.streamState = { + entryRanges: range, + byteWidths: byteWidths, + entryNum: 0, + streamPos: stream.pos + }; + } + this.readXRefStream(stream); + delete this.streamState; + + return stream.dict; + }, + + readXRefStream: function XRef_readXRefStream(stream) { + var i, j; + var streamState = this.streamState; + stream.pos = streamState.streamPos; + + var byteWidths = streamState.byteWidths; + var typeFieldWidth = byteWidths[0]; + var offsetFieldWidth = byteWidths[1]; + var generationFieldWidth = byteWidths[2]; + + var entryRanges = streamState.entryRanges; + while (entryRanges.length > 0) { + var first = entryRanges[0]; + var n = entryRanges[1]; + + if (!isInt(first) || !isInt(n)) { + error('Invalid XRef range fields: ' + first + ', ' + n); + } + if (!isInt(typeFieldWidth) || !isInt(offsetFieldWidth) || + !isInt(generationFieldWidth)) { + error('Invalid XRef entry fields length: ' + first + ', ' + n); + } + for (i = streamState.entryNum; i < n; ++i) { + streamState.entryNum = i; + streamState.streamPos = stream.pos; + + var type = 0, offset = 0, generation = 0; + for (j = 0; j < typeFieldWidth; ++j) { + type = (type << 8) | stream.getByte(); + } + // if type field is absent, its default value is 1 + if (typeFieldWidth === 0) { + type = 1; + } + for (j = 0; j < offsetFieldWidth; ++j) { + offset = (offset << 8) | stream.getByte(); + } + for (j = 0; j < generationFieldWidth; ++j) { + generation = (generation << 8) | stream.getByte(); + } + var entry = {}; + entry.offset = offset; + entry.gen = generation; + switch (type) { + case 0: + entry.free = true; + break; + case 1: + entry.uncompressed = true; + break; + case 2: + break; + default: + error('Invalid XRef entry type: ' + type); + } + if (!this.entries[first + i]) { + this.entries[first + i] = entry; + } + } + + streamState.entryNum = 0; + streamState.streamPos = stream.pos; + entryRanges.splice(0, 2); + } + }, + + indexObjects: function XRef_indexObjects() { + // Simple scan through the PDF content to find objects, + // trailers and XRef streams. + var TAB = 0x9, LF = 0xA, CR = 0xD, SPACE = 0x20; + var PERCENT = 0x25, LT = 0x3C; + + function readToken(data, offset) { + var token = '', ch = data[offset]; + while (ch !== LF && ch !== CR && ch !== LT) { + if (++offset >= data.length) { + break; + } + token += String.fromCharCode(ch); + ch = data[offset]; + } + return token; + } + function skipUntil(data, offset, what) { + var length = what.length, dataLength = data.length; + var skipped = 0; + // finding byte sequence + while (offset < dataLength) { + var i = 0; + while (i < length && data[offset + i] === what[i]) { + ++i; + } + if (i >= length) { + break; // sequence found + } + offset++; + skipped++; + } + return skipped; + } + var objRegExp = /^(\d+)\s+(\d+)\s+obj\b/; + var trailerBytes = new Uint8Array([116, 114, 97, 105, 108, 101, 114]); + var startxrefBytes = new Uint8Array([115, 116, 97, 114, 116, 120, 114, + 101, 102]); + var endobjBytes = new Uint8Array([101, 110, 100, 111, 98, 106]); + var xrefBytes = new Uint8Array([47, 88, 82, 101, 102]); + + // Clear out any existing entries, since they may be bogus. + this.entries.length = 0; + + var stream = this.stream; + stream.pos = 0; + var buffer = stream.getBytes(); + var position = stream.start, length = buffer.length; + var trailers = [], xrefStms = []; + while (position < length) { + var ch = buffer[position]; + if (ch === TAB || ch === LF || ch === CR || ch === SPACE) { + ++position; + continue; + } + if (ch === PERCENT) { // %-comment + do { + ++position; + if (position >= length) { + break; + } + ch = buffer[position]; + } while (ch !== LF && ch !== CR); + continue; + } + var token = readToken(buffer, position); + var m; + if (token.indexOf('xref') === 0 && + (token.length === 4 || /\s/.test(token[4]))) { + position += skipUntil(buffer, position, trailerBytes); + trailers.push(position); + position += skipUntil(buffer, position, startxrefBytes); + } else if ((m = objRegExp.exec(token))) { + if (typeof this.entries[m[1]] === 'undefined') { + this.entries[m[1]] = { + offset: position - stream.start, + gen: m[2] | 0, + uncompressed: true + }; + } + var contentLength = skipUntil(buffer, position, endobjBytes) + 7; + var content = buffer.subarray(position, position + contentLength); + + // checking XRef stream suspect + // (it shall have '/XRef' and next char is not a letter) + var xrefTagOffset = skipUntil(content, 0, xrefBytes); + if (xrefTagOffset < contentLength && + content[xrefTagOffset + 5] < 64) { + xrefStms.push(position - stream.start); + this.xrefstms[position - stream.start] = 1; // Avoid recursion + } + + position += contentLength; + } else if (token.indexOf('trailer') === 0 && + (token.length === 7 || /\s/.test(token[7]))) { + trailers.push(position); + position += skipUntil(buffer, position, startxrefBytes); + } else { + position += token.length + 1; + } + } + // reading XRef streams + var i, ii; + for (i = 0, ii = xrefStms.length; i < ii; ++i) { + this.startXRefQueue.push(xrefStms[i]); + this.readXRef(/* recoveryMode */ true); + } + // finding main trailer + var dict; + for (i = 0, ii = trailers.length; i < ii; ++i) { + stream.pos = trailers[i]; + var parser = new Parser(new Lexer(stream), true, this); + var obj = parser.getObj(); + if (!isCmd(obj, 'trailer')) { + continue; + } + // read the trailer dictionary + if (!isDict(dict = parser.getObj())) { + continue; + } + // taking the first one with 'ID' + if (dict.has('ID')) { + return dict; + } + } + // no tailer with 'ID', taking last one (if exists) + if (dict) { + return dict; + } + // nothing helps + // calling error() would reject worker with an UnknownErrorException. + throw new InvalidPDFException('Invalid PDF structure'); + }, + + readXRef: function XRef_readXRef(recoveryMode) { + var stream = this.stream; + + try { + while (this.startXRefQueue.length) { + var startXRef = this.startXRefQueue[0]; + + stream.pos = startXRef + stream.start; + + var parser = new Parser(new Lexer(stream), true, this); + var obj = parser.getObj(); + var dict; + + // Get dictionary + if (isCmd(obj, 'xref')) { + // Parse end-of-file XRef + dict = this.processXRefTable(parser); + if (!this.topDict) { + this.topDict = dict; + } + + // Recursively get other XRefs 'XRefStm', if any + obj = dict.get('XRefStm'); + if (isInt(obj)) { + var pos = obj; + // ignore previously loaded xref streams + // (possible infinite recursion) + if (!(pos in this.xrefstms)) { + this.xrefstms[pos] = 1; + this.startXRefQueue.push(pos); + } + } + } else if (isInt(obj)) { + // Parse in-stream XRef + if (!isInt(parser.getObj()) || + !isCmd(parser.getObj(), 'obj') || + !isStream(obj = parser.getObj())) { + error('Invalid XRef stream'); + } + dict = this.processXRefStream(obj); + if (!this.topDict) { + this.topDict = dict; + } + if (!dict) { + error('Failed to read XRef stream'); + } + } else { + error('Invalid XRef stream header'); + } + + // Recursively get previous dictionary, if any + obj = dict.get('Prev'); + if (isInt(obj)) { + this.startXRefQueue.push(obj); + } else if (isRef(obj)) { + // The spec says Prev must not be a reference, i.e. "/Prev NNN" + // This is a fallback for non-compliant PDFs, i.e. "/Prev NNN 0 R" + this.startXRefQueue.push(obj.num); + } + + this.startXRefQueue.shift(); + } + + return this.topDict; + } catch (e) { + if (e instanceof MissingDataException) { + throw e; + } + info('(while reading XRef): ' + e); + } + + if (recoveryMode) { + return; + } + throw new XRefParseException(); + }, + + getEntry: function XRef_getEntry(i) { + var xrefEntry = this.entries[i]; + if (xrefEntry && !xrefEntry.free && xrefEntry.offset) { + return xrefEntry; + } + return null; + }, + + fetchIfRef: function XRef_fetchIfRef(obj) { + if (!isRef(obj)) { + return obj; + } + return this.fetch(obj); + }, + + fetch: function XRef_fetch(ref, suppressEncryption) { + assert(isRef(ref), 'ref object is not a reference'); + var num = ref.num; + if (num in this.cache) { + var cacheEntry = this.cache[num]; + return cacheEntry; + } + + var xrefEntry = this.getEntry(num); + + // the referenced entry can be free + if (xrefEntry === null) { + return (this.cache[num] = null); + } + + if (xrefEntry.uncompressed) { + xrefEntry = this.fetchUncompressed(ref, xrefEntry, suppressEncryption); + } else { + xrefEntry = this.fetchCompressed(xrefEntry, suppressEncryption); + } + if (isDict(xrefEntry)){ + xrefEntry.objId = ref.toString(); + } else if (isStream(xrefEntry)) { + xrefEntry.dict.objId = ref.toString(); + } + return xrefEntry; + }, + + fetchUncompressed: function XRef_fetchUncompressed(ref, xrefEntry, + suppressEncryption) { + var gen = ref.gen; + var num = ref.num; + if (xrefEntry.gen !== gen) { + error('inconsistent generation in XRef'); + } + var stream = this.stream.makeSubStream(xrefEntry.offset + + this.stream.start); + var parser = new Parser(new Lexer(stream), true, this); + var obj1 = parser.getObj(); + var obj2 = parser.getObj(); + var obj3 = parser.getObj(); + if (!isInt(obj1) || parseInt(obj1, 10) !== num || + !isInt(obj2) || parseInt(obj2, 10) !== gen || + !isCmd(obj3)) { + error('bad XRef entry'); + } + if (!isCmd(obj3, 'obj')) { + // some bad PDFs use "obj1234" and really mean 1234 + if (obj3.cmd.indexOf('obj') === 0) { + num = parseInt(obj3.cmd.substring(3), 10); + if (!isNaN(num)) { + return num; + } + } + error('bad XRef entry'); + } + if (this.encrypt && !suppressEncryption) { + xrefEntry = parser.getObj(this.encrypt.createCipherTransform(num, gen)); + } else { + xrefEntry = parser.getObj(); + } + if (!isStream(xrefEntry)) { + this.cache[num] = xrefEntry; + } + return xrefEntry; + }, + + fetchCompressed: function XRef_fetchCompressed(xrefEntry, + suppressEncryption) { + var tableOffset = xrefEntry.offset; + var stream = this.fetch(new Ref(tableOffset, 0)); + if (!isStream(stream)) { + error('bad ObjStm stream'); + } + var first = stream.dict.get('First'); + var n = stream.dict.get('N'); + if (!isInt(first) || !isInt(n)) { + error('invalid first and n parameters for ObjStm stream'); + } + var parser = new Parser(new Lexer(stream), false, this); + parser.allowStreams = true; + var i, entries = [], num, nums = []; + // read the object numbers to populate cache + for (i = 0; i < n; ++i) { + num = parser.getObj(); + if (!isInt(num)) { + error('invalid object number in the ObjStm stream: ' + num); + } + nums.push(num); + var offset = parser.getObj(); + if (!isInt(offset)) { + error('invalid object offset in the ObjStm stream: ' + offset); + } + } + // read stream objects for cache + for (i = 0; i < n; ++i) { + entries.push(parser.getObj()); + num = nums[i]; + var entry = this.entries[num]; + if (entry && entry.offset === tableOffset && entry.gen === i) { + this.cache[num] = entries[i]; + } + } + xrefEntry = entries[xrefEntry.gen]; + if (xrefEntry === undefined) { + error('bad XRef entry for compressed object'); + } + return xrefEntry; + }, + + fetchIfRefAsync: function XRef_fetchIfRefAsync(obj) { + if (!isRef(obj)) { + return Promise.resolve(obj); + } + return this.fetchAsync(obj); + }, + + fetchAsync: function XRef_fetchAsync(ref, suppressEncryption) { + var streamManager = this.stream.manager; + var xref = this; + return new Promise(function tryFetch(resolve, reject) { + try { + resolve(xref.fetch(ref, suppressEncryption)); + } catch (e) { + if (e instanceof MissingDataException) { + streamManager.requestRange(e.begin, e.end).then(function () { + tryFetch(resolve, reject); + }, reject); + return; + } + reject(e); + } + }); + }, + + getCatalogObj: function XRef_getCatalogObj() { + return this.root; + } + }; + + return XRef; +})(); + +/** + * A NameTree is like a Dict but has some advantageous properties, see the + * spec (7.9.6) for more details. + * TODO: implement all the Dict functions and make this more efficent. + */ +var NameTree = (function NameTreeClosure() { + function NameTree(root, xref) { + this.root = root; + this.xref = xref; + } + + NameTree.prototype = { + getAll: function NameTree_getAll() { + var dict = {}; + if (!this.root) { + return dict; + } + var xref = this.xref; + // reading name tree + var processed = new RefSet(); + processed.put(this.root); + var queue = [this.root]; + while (queue.length > 0) { + var i, n; + var obj = xref.fetchIfRef(queue.shift()); + if (!isDict(obj)) { + continue; + } + if (obj.has('Kids')) { + var kids = obj.get('Kids'); + for (i = 0, n = kids.length; i < n; i++) { + var kid = kids[i]; + if (processed.has(kid)) { + error('invalid destinations'); + } + queue.push(kid); + processed.put(kid); + } + continue; + } + var names = obj.get('Names'); + if (names) { + for (i = 0, n = names.length; i < n; i += 2) { + dict[xref.fetchIfRef(names[i])] = xref.fetchIfRef(names[i + 1]); + } + } + } + return dict; + }, + + get: function NameTree_get(destinationId) { + if (!this.root) { + return null; + } + + var xref = this.xref; + var kidsOrNames = xref.fetchIfRef(this.root); + var loopCount = 0; + var MAX_NAMES_LEVELS = 10; + var l, r, m; + + // Perform a binary search to quickly find the entry that + // contains the named destination we are looking for. + while (kidsOrNames.has('Kids')) { + loopCount++; + if (loopCount > MAX_NAMES_LEVELS) { + warn('Search depth limit for named destionations has been reached.'); + return null; + } + + var kids = kidsOrNames.get('Kids'); + if (!isArray(kids)) { + return null; + } + + l = 0; + r = kids.length - 1; + while (l <= r) { + m = (l + r) >> 1; + var kid = xref.fetchIfRef(kids[m]); + var limits = kid.get('Limits'); + + if (destinationId < xref.fetchIfRef(limits[0])) { + r = m - 1; + } else if (destinationId > xref.fetchIfRef(limits[1])) { + l = m + 1; + } else { + kidsOrNames = xref.fetchIfRef(kids[m]); + break; + } + } + if (l > r) { + return null; + } + } + + // If we get here, then we have found the right entry. Now + // go through the named destinations in the Named dictionary + // until we find the exact destination we're looking for. + var names = kidsOrNames.get('Names'); + if (isArray(names)) { + // Perform a binary search to reduce the lookup time. + l = 0; + r = names.length - 2; + while (l <= r) { + // Check only even indices (0, 2, 4, ...) because the + // odd indices contain the actual D array. + m = (l + r) & ~1; + if (destinationId < xref.fetchIfRef(names[m])) { + r = m - 2; + } else if (destinationId > xref.fetchIfRef(names[m])) { + l = m + 2; + } else { + return xref.fetchIfRef(names[m + 1]); + } + } + } + return null; + } + }; + return NameTree; +})(); + +/** + * "A PDF file can refer to the contents of another file by using a File + * Specification (PDF 1.1)", see the spec (7.11) for more details. + * NOTE: Only embedded files are supported (as part of the attachments support) + * TODO: support the 'URL' file system (with caching if !/V), portable + * collections attributes and related files (/RF) + */ +var FileSpec = (function FileSpecClosure() { + function FileSpec(root, xref) { + if (!root || !isDict(root)) { + return; + } + this.xref = xref; + this.root = root; + if (root.has('FS')) { + this.fs = root.get('FS'); + } + this.description = root.has('Desc') ? + stringToPDFString(root.get('Desc')) : + ''; + if (root.has('RF')) { + warn('Related file specifications are not supported'); + } + this.contentAvailable = true; + if (!root.has('EF')) { + this.contentAvailable = false; + warn('Non-embedded file specifications are not supported'); + } + } + + function pickPlatformItem(dict) { + // Look for the filename in this order: + // UF, F, Unix, Mac, DOS + if (dict.has('UF')) { + return dict.get('UF'); + } else if (dict.has('F')) { + return dict.get('F'); + } else if (dict.has('Unix')) { + return dict.get('Unix'); + } else if (dict.has('Mac')) { + return dict.get('Mac'); + } else if (dict.has('DOS')) { + return dict.get('DOS'); + } else { + return null; + } + } + + FileSpec.prototype = { + get filename() { + if (!this._filename && this.root) { + var filename = pickPlatformItem(this.root) || 'unnamed'; + this._filename = stringToPDFString(filename). + replace(/\\\\/g, '\\'). + replace(/\\\//g, '/'). + replace(/\\/g, '/'); + } + return this._filename; + }, + get content() { + if (!this.contentAvailable) { + return null; + } + if (!this.contentRef && this.root) { + this.contentRef = pickPlatformItem(this.root.get('EF')); + } + var content = null; + if (this.contentRef) { + var xref = this.xref; + var fileObj = xref.fetchIfRef(this.contentRef); + if (fileObj && isStream(fileObj)) { + content = fileObj.getBytes(); + } else { + warn('Embedded file specification points to non-existing/invalid ' + + 'content'); + } + } else { + warn('Embedded file specification does not have a content'); + } + return content; + }, + get serializable() { + return { + filename: this.filename, + content: this.content + }; + } + }; + return FileSpec; +})(); + +/** + * A helper for loading missing data in object graphs. It traverses the graph + * depth first and queues up any objects that have missing data. Once it has + * has traversed as many objects that are available it attempts to bundle the + * missing data requests and then resume from the nodes that weren't ready. + * + * NOTE: It provides protection from circular references by keeping track of + * of loaded references. However, you must be careful not to load any graphs + * that have references to the catalog or other pages since that will cause the + * entire PDF document object graph to be traversed. + */ +var ObjectLoader = (function() { + function mayHaveChildren(value) { + return isRef(value) || isDict(value) || isArray(value) || isStream(value); + } + + function addChildren(node, nodesToVisit) { + var value; + if (isDict(node) || isStream(node)) { + var map; + if (isDict(node)) { + map = node.map; + } else { + map = node.dict.map; + } + for (var key in map) { + value = map[key]; + if (mayHaveChildren(value)) { + nodesToVisit.push(value); + } + } + } else if (isArray(node)) { + for (var i = 0, ii = node.length; i < ii; i++) { + value = node[i]; + if (mayHaveChildren(value)) { + nodesToVisit.push(value); + } + } + } + } + + function ObjectLoader(obj, keys, xref) { + this.obj = obj; + this.keys = keys; + this.xref = xref; + this.refSet = null; + this.capability = null; + } + + ObjectLoader.prototype = { + load: function ObjectLoader_load() { + var keys = this.keys; + this.capability = createPromiseCapability(); + // Don't walk the graph if all the data is already loaded. + if (!(this.xref.stream instanceof ChunkedStream) || + this.xref.stream.getMissingChunks().length === 0) { + this.capability.resolve(); + return this.capability.promise; + } + + this.refSet = new RefSet(); + // Setup the initial nodes to visit. + var nodesToVisit = []; + for (var i = 0; i < keys.length; i++) { + nodesToVisit.push(this.obj[keys[i]]); + } + + this._walk(nodesToVisit); + return this.capability.promise; + }, + + _walk: function ObjectLoader_walk(nodesToVisit) { + var nodesToRevisit = []; + var pendingRequests = []; + // DFS walk of the object graph. + while (nodesToVisit.length) { + var currentNode = nodesToVisit.pop(); + + // Only references or chunked streams can cause missing data exceptions. + if (isRef(currentNode)) { + // Skip nodes that have already been visited. + if (this.refSet.has(currentNode)) { + continue; + } + try { + var ref = currentNode; + this.refSet.put(ref); + currentNode = this.xref.fetch(currentNode); + } catch (e) { + if (!(e instanceof MissingDataException)) { + throw e; + } + nodesToRevisit.push(currentNode); + pendingRequests.push({ begin: e.begin, end: e.end }); + } + } + if (currentNode && currentNode.getBaseStreams) { + var baseStreams = currentNode.getBaseStreams(); + var foundMissingData = false; + for (var i = 0; i < baseStreams.length; i++) { + var stream = baseStreams[i]; + if (stream.getMissingChunks && stream.getMissingChunks().length) { + foundMissingData = true; + pendingRequests.push({ + begin: stream.start, + end: stream.end + }); + } + } + if (foundMissingData) { + nodesToRevisit.push(currentNode); + } + } + + addChildren(currentNode, nodesToVisit); + } + + if (pendingRequests.length) { + this.xref.stream.manager.requestRanges(pendingRequests).then( + function pendingRequestCallback() { + nodesToVisit = nodesToRevisit; + for (var i = 0; i < nodesToRevisit.length; i++) { + var node = nodesToRevisit[i]; + // Remove any reference nodes from the currrent refset so they + // aren't skipped when we revist them. + if (isRef(node)) { + this.refSet.remove(node); + } + } + this._walk(nodesToVisit); + }.bind(this), this.capability.reject); + return; + } + // Everything is loaded. + this.refSet = null; + this.capability.resolve(); + } + }; + + return ObjectLoader; +})(); + + +var ISOAdobeCharset = [ + '.notdef', 'space', 'exclam', 'quotedbl', 'numbersign', 'dollar', + 'percent', 'ampersand', 'quoteright', 'parenleft', 'parenright', + 'asterisk', 'plus', 'comma', 'hyphen', 'period', 'slash', 'zero', + 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', + 'nine', 'colon', 'semicolon', 'less', 'equal', 'greater', 'question', + 'at', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', + 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', + 'bracketleft', 'backslash', 'bracketright', 'asciicircum', 'underscore', + 'quoteleft', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', + 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', + 'braceleft', 'bar', 'braceright', 'asciitilde', 'exclamdown', 'cent', + 'sterling', 'fraction', 'yen', 'florin', 'section', 'currency', + 'quotesingle', 'quotedblleft', 'guillemotleft', 'guilsinglleft', + 'guilsinglright', 'fi', 'fl', 'endash', 'dagger', 'daggerdbl', + 'periodcentered', 'paragraph', 'bullet', 'quotesinglbase', + 'quotedblbase', 'quotedblright', 'guillemotright', 'ellipsis', + 'perthousand', 'questiondown', 'grave', 'acute', 'circumflex', 'tilde', + 'macron', 'breve', 'dotaccent', 'dieresis', 'ring', 'cedilla', + 'hungarumlaut', 'ogonek', 'caron', 'emdash', 'AE', 'ordfeminine', + 'Lslash', 'Oslash', 'OE', 'ordmasculine', 'ae', 'dotlessi', 'lslash', + 'oslash', 'oe', 'germandbls', 'onesuperior', 'logicalnot', 'mu', + 'trademark', 'Eth', 'onehalf', 'plusminus', 'Thorn', 'onequarter', + 'divide', 'brokenbar', 'degree', 'thorn', 'threequarters', 'twosuperior', + 'registered', 'minus', 'eth', 'multiply', 'threesuperior', 'copyright', + 'Aacute', 'Acircumflex', 'Adieresis', 'Agrave', 'Aring', 'Atilde', + 'Ccedilla', 'Eacute', 'Ecircumflex', 'Edieresis', 'Egrave', 'Iacute', + 'Icircumflex', 'Idieresis', 'Igrave', 'Ntilde', 'Oacute', 'Ocircumflex', + 'Odieresis', 'Ograve', 'Otilde', 'Scaron', 'Uacute', 'Ucircumflex', + 'Udieresis', 'Ugrave', 'Yacute', 'Ydieresis', 'Zcaron', 'aacute', + 'acircumflex', 'adieresis', 'agrave', 'aring', 'atilde', 'ccedilla', + 'eacute', 'ecircumflex', 'edieresis', 'egrave', 'iacute', 'icircumflex', + 'idieresis', 'igrave', 'ntilde', 'oacute', 'ocircumflex', 'odieresis', + 'ograve', 'otilde', 'scaron', 'uacute', 'ucircumflex', 'udieresis', + 'ugrave', 'yacute', 'ydieresis', 'zcaron' +]; + +var ExpertCharset = [ + '.notdef', 'space', 'exclamsmall', 'Hungarumlautsmall', 'dollaroldstyle', + 'dollarsuperior', 'ampersandsmall', 'Acutesmall', 'parenleftsuperior', + 'parenrightsuperior', 'twodotenleader', 'onedotenleader', 'comma', + 'hyphen', 'period', 'fraction', 'zerooldstyle', 'oneoldstyle', + 'twooldstyle', 'threeoldstyle', 'fouroldstyle', 'fiveoldstyle', + 'sixoldstyle', 'sevenoldstyle', 'eightoldstyle', 'nineoldstyle', + 'colon', 'semicolon', 'commasuperior', 'threequartersemdash', + 'periodsuperior', 'questionsmall', 'asuperior', 'bsuperior', + 'centsuperior', 'dsuperior', 'esuperior', 'isuperior', 'lsuperior', + 'msuperior', 'nsuperior', 'osuperior', 'rsuperior', 'ssuperior', + 'tsuperior', 'ff', 'fi', 'fl', 'ffi', 'ffl', 'parenleftinferior', + 'parenrightinferior', 'Circumflexsmall', 'hyphensuperior', 'Gravesmall', + 'Asmall', 'Bsmall', 'Csmall', 'Dsmall', 'Esmall', 'Fsmall', 'Gsmall', + 'Hsmall', 'Ismall', 'Jsmall', 'Ksmall', 'Lsmall', 'Msmall', 'Nsmall', + 'Osmall', 'Psmall', 'Qsmall', 'Rsmall', 'Ssmall', 'Tsmall', 'Usmall', + 'Vsmall', 'Wsmall', 'Xsmall', 'Ysmall', 'Zsmall', 'colonmonetary', + 'onefitted', 'rupiah', 'Tildesmall', 'exclamdownsmall', 'centoldstyle', + 'Lslashsmall', 'Scaronsmall', 'Zcaronsmall', 'Dieresissmall', + 'Brevesmall', 'Caronsmall', 'Dotaccentsmall', 'Macronsmall', + 'figuredash', 'hypheninferior', 'Ogoneksmall', 'Ringsmall', + 'Cedillasmall', 'onequarter', 'onehalf', 'threequarters', + 'questiondownsmall', 'oneeighth', 'threeeighths', 'fiveeighths', + 'seveneighths', 'onethird', 'twothirds', 'zerosuperior', 'onesuperior', + 'twosuperior', 'threesuperior', 'foursuperior', 'fivesuperior', + 'sixsuperior', 'sevensuperior', 'eightsuperior', 'ninesuperior', + 'zeroinferior', 'oneinferior', 'twoinferior', 'threeinferior', + 'fourinferior', 'fiveinferior', 'sixinferior', 'seveninferior', + 'eightinferior', 'nineinferior', 'centinferior', 'dollarinferior', + 'periodinferior', 'commainferior', 'Agravesmall', 'Aacutesmall', + 'Acircumflexsmall', 'Atildesmall', 'Adieresissmall', 'Aringsmall', + 'AEsmall', 'Ccedillasmall', 'Egravesmall', 'Eacutesmall', + 'Ecircumflexsmall', 'Edieresissmall', 'Igravesmall', 'Iacutesmall', + 'Icircumflexsmall', 'Idieresissmall', 'Ethsmall', 'Ntildesmall', + 'Ogravesmall', 'Oacutesmall', 'Ocircumflexsmall', 'Otildesmall', + 'Odieresissmall', 'OEsmall', 'Oslashsmall', 'Ugravesmall', 'Uacutesmall', + 'Ucircumflexsmall', 'Udieresissmall', 'Yacutesmall', 'Thornsmall', + 'Ydieresissmall' +]; + +var ExpertSubsetCharset = [ + '.notdef', 'space', 'dollaroldstyle', 'dollarsuperior', + 'parenleftsuperior', 'parenrightsuperior', 'twodotenleader', + 'onedotenleader', 'comma', 'hyphen', 'period', 'fraction', + 'zerooldstyle', 'oneoldstyle', 'twooldstyle', 'threeoldstyle', + 'fouroldstyle', 'fiveoldstyle', 'sixoldstyle', 'sevenoldstyle', + 'eightoldstyle', 'nineoldstyle', 'colon', 'semicolon', 'commasuperior', + 'threequartersemdash', 'periodsuperior', 'asuperior', 'bsuperior', + 'centsuperior', 'dsuperior', 'esuperior', 'isuperior', 'lsuperior', + 'msuperior', 'nsuperior', 'osuperior', 'rsuperior', 'ssuperior', + 'tsuperior', 'ff', 'fi', 'fl', 'ffi', 'ffl', 'parenleftinferior', + 'parenrightinferior', 'hyphensuperior', 'colonmonetary', 'onefitted', + 'rupiah', 'centoldstyle', 'figuredash', 'hypheninferior', 'onequarter', + 'onehalf', 'threequarters', 'oneeighth', 'threeeighths', 'fiveeighths', + 'seveneighths', 'onethird', 'twothirds', 'zerosuperior', 'onesuperior', + 'twosuperior', 'threesuperior', 'foursuperior', 'fivesuperior', + 'sixsuperior', 'sevensuperior', 'eightsuperior', 'ninesuperior', + 'zeroinferior', 'oneinferior', 'twoinferior', 'threeinferior', + 'fourinferior', 'fiveinferior', 'sixinferior', 'seveninferior', + 'eightinferior', 'nineinferior', 'centinferior', 'dollarinferior', + 'periodinferior', 'commainferior' +]; + + +var DEFAULT_ICON_SIZE = 22; // px + +/** + * @constructor + */ +function AnnotationFactory() {} +AnnotationFactory.prototype = { + /** + * @param {XRef} xref + * @param {Object} ref + * @returns {Annotation} + */ + create: function AnnotationFactory_create(xref, ref) { + var dict = xref.fetchIfRef(ref); + if (!isDict(dict)) { + return; + } + + // Determine the annotation's subtype. + var subtype = dict.get('Subtype'); + subtype = isName(subtype) ? subtype.name : ''; + + // Return the right annotation object based on the subtype and field type. + var parameters = { + dict: dict, + ref: ref + }; + + switch (subtype) { + case 'Link': + return new LinkAnnotation(parameters); + + case 'Text': + return new TextAnnotation(parameters); + + case 'Widget': + var fieldType = Util.getInheritableProperty(dict, 'FT'); + if (isName(fieldType) && fieldType.name === 'Tx') { + return new TextWidgetAnnotation(parameters); + } + return new WidgetAnnotation(parameters); + + default: + warn('Unimplemented annotation type "' + subtype + '", ' + + 'falling back to base annotation'); + return new Annotation(parameters); + } + } +}; + +var Annotation = (function AnnotationClosure() { + // 12.5.5: Algorithm: Appearance streams + function getTransformMatrix(rect, bbox, matrix) { + var bounds = Util.getAxialAlignedBoundingBox(bbox, matrix); + var minX = bounds[0]; + var minY = bounds[1]; + var maxX = bounds[2]; + var maxY = bounds[3]; + + if (minX === maxX || minY === maxY) { + // From real-life file, bbox was [0, 0, 0, 0]. In this case, + // just apply the transform for rect + return [1, 0, 0, 1, rect[0], rect[1]]; + } + + var xRatio = (rect[2] - rect[0]) / (maxX - minX); + var yRatio = (rect[3] - rect[1]) / (maxY - minY); + return [ + xRatio, + 0, + 0, + yRatio, + rect[0] - minX * xRatio, + rect[1] - minY * yRatio + ]; + } + + function getDefaultAppearance(dict) { + var appearanceState = dict.get('AP'); + if (!isDict(appearanceState)) { + return; + } + + var appearance; + var appearances = appearanceState.get('N'); + if (isDict(appearances)) { + var as = dict.get('AS'); + if (as && appearances.has(as.name)) { + appearance = appearances.get(as.name); + } + } else { + appearance = appearances; + } + return appearance; + } + + function Annotation(params) { + var dict = params.dict; + var data = this.data = {}; + + data.subtype = dict.get('Subtype').name; + data.annotationFlags = dict.get('F'); + + this.setRectangle(dict.get('Rect')); + data.rect = this.rectangle; + + this.setColor(dict.get('C')); + data.color = this.color; + + this.borderStyle = data.borderStyle = new AnnotationBorderStyle(); + this.setBorderStyle(dict); + + this.appearance = getDefaultAppearance(dict); + data.hasAppearance = !!this.appearance; + data.id = params.ref.num; + } + + Annotation.prototype = { + /** + * Set the rectangle. + * + * @public + * @memberof Annotation + * @param {Array} rectangle - The rectangle array with exactly four entries + */ + setRectangle: function Annotation_setRectangle(rectangle) { + if (isArray(rectangle) && rectangle.length === 4) { + this.rectangle = Util.normalizeRect(rectangle); + } else { + this.rectangle = [0, 0, 0, 0]; + } + }, + + /** + * Set the color and take care of color space conversion. + * + * @public + * @memberof Annotation + * @param {Array} color - The color array containing either 0 + * (transparent), 1 (grayscale), 3 (RGB) or + * 4 (CMYK) elements + */ + setColor: function Annotation_setColor(color) { + var rgbColor = new Uint8Array(3); // Black in RGB color space (default) + if (!isArray(color)) { + this.color = rgbColor; + return; + } + + switch (color.length) { + case 0: // Transparent, which we indicate with a null value + this.color = null; + break; + + case 1: // Convert grayscale to RGB + ColorSpace.singletons.gray.getRgbItem(color, 0, rgbColor, 0); + this.color = rgbColor; + break; + + case 3: // Convert RGB percentages to RGB + ColorSpace.singletons.rgb.getRgbItem(color, 0, rgbColor, 0); + this.color = rgbColor; + break; + + case 4: // Convert CMYK to RGB + ColorSpace.singletons.cmyk.getRgbItem(color, 0, rgbColor, 0); + this.color = rgbColor; + break; + + default: + this.color = rgbColor; + break; + } + }, + + /** + * Set the border style (as AnnotationBorderStyle object). + * + * @public + * @memberof Annotation + * @param {Dict} borderStyle - The border style dictionary + */ + setBorderStyle: function Annotation_setBorderStyle(borderStyle) { + if (!isDict(borderStyle)) { + return; + } + if (borderStyle.has('BS')) { + var dict = borderStyle.get('BS'); + var dictType; + + if (!dict.has('Type') || (isName(dictType = dict.get('Type')) && + dictType.name === 'Border')) { + this.borderStyle.setWidth(dict.get('W')); + this.borderStyle.setStyle(dict.get('S')); + this.borderStyle.setDashArray(dict.get('D')); + } + } else if (borderStyle.has('Border')) { + var array = borderStyle.get('Border'); + if (isArray(array) && array.length >= 3) { + this.borderStyle.setHorizontalCornerRadius(array[0]); + this.borderStyle.setVerticalCornerRadius(array[1]); + this.borderStyle.setWidth(array[2]); + + if (array.length === 4) { // Dash array available + this.borderStyle.setDashArray(array[3]); + } + } + } else { + // There are no border entries in the dictionary. According to the + // specification, we should draw a solid border of width 1 in that + // case, but Adobe Reader did not implement that part of the + // specification and instead draws no border at all, so we do the same. + // See also https://github.com/mozilla/pdf.js/issues/6179. + this.borderStyle.setWidth(0); + } + }, + + isInvisible: function Annotation_isInvisible() { + var data = this.data; + return !!(data && + data.annotationFlags && // Default: not invisible + data.annotationFlags & 0x1); // Invisible + }, + + isViewable: function Annotation_isViewable() { + var data = this.data; + return !!(!this.isInvisible() && + data && + (!data.annotationFlags || + !(data.annotationFlags & 0x22)) && // Hidden or NoView + data.rect); // rectangle is necessary + }, + + isPrintable: function Annotation_isPrintable() { + var data = this.data; + return !!(!this.isInvisible() && + data && + data.annotationFlags && // Default: not printable + data.annotationFlags & 0x4 && // Print + !(data.annotationFlags & 0x2) && // Hidden + data.rect); // rectangle is necessary + }, + + loadResources: function Annotation_loadResources(keys) { + return new Promise(function (resolve, reject) { + this.appearance.dict.getAsync('Resources').then(function (resources) { + if (!resources) { + resolve(); + return; + } + var objectLoader = new ObjectLoader(resources.map, + keys, + resources.xref); + objectLoader.load().then(function() { + resolve(resources); + }, reject); + }, reject); + }.bind(this)); + }, + + getOperatorList: function Annotation_getOperatorList(evaluator, task) { + + if (!this.appearance) { + return Promise.resolve(new OperatorList()); + } + + var data = this.data; + + var appearanceDict = this.appearance.dict; + var resourcesPromise = this.loadResources([ + 'ExtGState', + 'ColorSpace', + 'Pattern', + 'Shading', + 'XObject', + 'Font' + // ProcSet + // Properties + ]); + var bbox = appearanceDict.get('BBox') || [0, 0, 1, 1]; + var matrix = appearanceDict.get('Matrix') || [1, 0, 0, 1, 0 ,0]; + var transform = getTransformMatrix(data.rect, bbox, matrix); + var self = this; + + return resourcesPromise.then(function(resources) { + var opList = new OperatorList(); + opList.addOp(OPS.beginAnnotation, [data.rect, transform, matrix]); + return evaluator.getOperatorList(self.appearance, task, + resources, opList). + then(function () { + opList.addOp(OPS.endAnnotation, []); + self.appearance.reset(); + return opList; + }); + }); + } + }; + + Annotation.appendToOperatorList = function Annotation_appendToOperatorList( + annotations, opList, pdfManager, partialEvaluator, task, intent) { + + function reject(e) { + annotationsReadyCapability.reject(e); + } + + var annotationsReadyCapability = createPromiseCapability(); + + var annotationPromises = []; + for (var i = 0, n = annotations.length; i < n; ++i) { + if (intent === 'display' && annotations[i].isViewable() || + intent === 'print' && annotations[i].isPrintable()) { + annotationPromises.push( + annotations[i].getOperatorList(partialEvaluator, task)); + } + } + Promise.all(annotationPromises).then(function(datas) { + opList.addOp(OPS.beginAnnotations, []); + for (var i = 0, n = datas.length; i < n; ++i) { + var annotOpList = datas[i]; + opList.addOpList(annotOpList); + } + opList.addOp(OPS.endAnnotations, []); + annotationsReadyCapability.resolve(); + }, reject); + + return annotationsReadyCapability.promise; + }; + + return Annotation; +})(); + +/** + * Contains all data regarding an annotation's border style. + * + * @class + */ +var AnnotationBorderStyle = (function AnnotationBorderStyleClosure() { + /** + * @constructor + * @private + */ + function AnnotationBorderStyle() { + this.width = 1; + this.style = AnnotationBorderStyleType.SOLID; + this.dashArray = [3]; + this.horizontalCornerRadius = 0; + this.verticalCornerRadius = 0; + } + + AnnotationBorderStyle.prototype = { + /** + * Set the width. + * + * @public + * @memberof AnnotationBorderStyle + * @param {integer} width - The width + */ + setWidth: function AnnotationBorderStyle_setWidth(width) { + if (width === (width | 0)) { + this.width = width; + } + }, + + /** + * Set the style. + * + * @public + * @memberof AnnotationBorderStyle + * @param {Object} style - The style object + * @see {@link shared/util.js} + */ + setStyle: function AnnotationBorderStyle_setStyle(style) { + if (!style) { + return; + } + switch (style.name) { + case 'S': + this.style = AnnotationBorderStyleType.SOLID; + break; + + case 'D': + this.style = AnnotationBorderStyleType.DASHED; + break; + + case 'B': + this.style = AnnotationBorderStyleType.BEVELED; + break; + + case 'I': + this.style = AnnotationBorderStyleType.INSET; + break; + + case 'U': + this.style = AnnotationBorderStyleType.UNDERLINE; + break; + + default: + break; + } + }, + + /** + * Set the dash array. + * + * @public + * @memberof AnnotationBorderStyle + * @param {Array} dashArray - The dash array with at least one element + */ + setDashArray: function AnnotationBorderStyle_setDashArray(dashArray) { + // We validate the dash array, but we do not use it because CSS does not + // allow us to change spacing of dashes. For more information, visit + // http://www.w3.org/TR/css3-background/#the-border-style. + if (isArray(dashArray) && dashArray.length > 0) { + // According to the PDF specification: the elements in a dashArray + // shall be numbers that are nonnegative and not all equal to zero. + var isValid = true; + var allZeros = true; + for (var i = 0, len = dashArray.length; i < len; i++) { + var element = dashArray[i]; + var validNumber = (+element >= 0); + if (!validNumber) { + isValid = false; + break; + } else if (element > 0) { + allZeros = false; + } + } + if (isValid && !allZeros) { + this.dashArray = dashArray; + } else { + this.width = 0; // Adobe behavior when the array is invalid. + } + } else if (dashArray) { + this.width = 0; // Adobe behavior when the array is invalid. + } + }, + + /** + * Set the horizontal corner radius (from a Border dictionary). + * + * @public + * @memberof AnnotationBorderStyle + * @param {integer} radius - The horizontal corner radius + */ + setHorizontalCornerRadius: + function AnnotationBorderStyle_setHorizontalCornerRadius(radius) { + if (radius === (radius | 0)) { + this.horizontalCornerRadius = radius; + } + }, + + /** + * Set the vertical corner radius (from a Border dictionary). + * + * @public + * @memberof AnnotationBorderStyle + * @param {integer} radius - The vertical corner radius + */ + setVerticalCornerRadius: + function AnnotationBorderStyle_setVerticalCornerRadius(radius) { + if (radius === (radius | 0)) { + this.verticalCornerRadius = radius; + } + } + }; + + return AnnotationBorderStyle; +})(); + +var WidgetAnnotation = (function WidgetAnnotationClosure() { + + function WidgetAnnotation(params) { + Annotation.call(this, params); + + var dict = params.dict; + var data = this.data; + + data.fieldValue = stringToPDFString( + Util.getInheritableProperty(dict, 'V') || ''); + data.alternativeText = stringToPDFString(dict.get('TU') || ''); + data.defaultAppearance = Util.getInheritableProperty(dict, 'DA') || ''; + var fieldType = Util.getInheritableProperty(dict, 'FT'); + data.fieldType = isName(fieldType) ? fieldType.name : ''; + data.fieldFlags = Util.getInheritableProperty(dict, 'Ff') || 0; + this.fieldResources = Util.getInheritableProperty(dict, 'DR') || Dict.empty; + + // Building the full field name by collecting the field and + // its ancestors 'T' data and joining them using '.'. + var fieldName = []; + var namedItem = dict; + var ref = params.ref; + while (namedItem) { + var parent = namedItem.get('Parent'); + var parentRef = namedItem.getRaw('Parent'); + var name = namedItem.get('T'); + if (name) { + fieldName.unshift(stringToPDFString(name)); + } else if (parent && ref) { + // The field name is absent, that means more than one field + // with the same name may exist. Replacing the empty name + // with the '`' plus index in the parent's 'Kids' array. + // This is not in the PDF spec but necessary to id the + // the input controls. + var kids = parent.get('Kids'); + var j, jj; + for (j = 0, jj = kids.length; j < jj; j++) { + var kidRef = kids[j]; + if (kidRef.num === ref.num && kidRef.gen === ref.gen) { + break; + } + } + fieldName.unshift('`' + j); + } + namedItem = parent; + ref = parentRef; + } + data.fullName = fieldName.join('.'); + } + + var parent = Annotation.prototype; + Util.inherit(WidgetAnnotation, Annotation, { + isViewable: function WidgetAnnotation_isViewable() { + if (this.data.fieldType === 'Sig') { + warn('unimplemented annotation type: Widget signature'); + return false; + } + + return parent.isViewable.call(this); + } + }); + + return WidgetAnnotation; +})(); + +var TextWidgetAnnotation = (function TextWidgetAnnotationClosure() { + function TextWidgetAnnotation(params) { + WidgetAnnotation.call(this, params); + + this.data.textAlignment = Util.getInheritableProperty(params.dict, 'Q'); + this.data.annotationType = AnnotationType.WIDGET; + this.data.hasHtml = !this.data.hasAppearance && !!this.data.fieldValue; + } + + Util.inherit(TextWidgetAnnotation, WidgetAnnotation, { + getOperatorList: function TextWidgetAnnotation_getOperatorList(evaluator, + task) { + if (this.appearance) { + return Annotation.prototype.getOperatorList.call(this, evaluator, task); + } + + var opList = new OperatorList(); + var data = this.data; + + // Even if there is an appearance stream, ignore it. This is the + // behaviour used by Adobe Reader. + if (!data.defaultAppearance) { + return Promise.resolve(opList); + } + + var stream = new Stream(stringToBytes(data.defaultAppearance)); + return evaluator.getOperatorList(stream, task, + this.fieldResources, opList). + then(function () { + return opList; + }); + } + }); + + return TextWidgetAnnotation; +})(); + +var TextAnnotation = (function TextAnnotationClosure() { + function TextAnnotation(params) { + Annotation.call(this, params); + + var dict = params.dict; + var data = this.data; + + var content = dict.get('Contents'); + var title = dict.get('T'); + data.annotationType = AnnotationType.TEXT; + data.content = stringToPDFString(content || ''); + data.title = stringToPDFString(title || ''); + data.hasHtml = true; + + if (data.hasAppearance) { + data.name = 'NoIcon'; + } else { + data.rect[1] = data.rect[3] - DEFAULT_ICON_SIZE; + data.rect[2] = data.rect[0] + DEFAULT_ICON_SIZE; + data.name = dict.has('Name') ? dict.get('Name').name : 'Note'; + } + + if (dict.has('C')) { + data.hasBgColor = true; + } + } + + Util.inherit(TextAnnotation, Annotation, { }); + + return TextAnnotation; +})(); + +var LinkAnnotation = (function LinkAnnotationClosure() { + function LinkAnnotation(params) { + Annotation.call(this, params); + + var dict = params.dict; + var data = this.data; + data.annotationType = AnnotationType.LINK; + data.hasHtml = true; + + var action = dict.get('A'); + if (action && isDict(action)) { + var linkType = action.get('S').name; + if (linkType === 'URI') { + var url = action.get('URI'); + if (isName(url)) { + // Some bad PDFs do not put parentheses around relative URLs. + url = '/' + url.name; + } else if (url) { + url = addDefaultProtocolToUrl(url); + } + // TODO: pdf spec mentions urls can be relative to a Base + // entry in the dictionary. + if (!isValidUrl(url, false)) { + url = ''; + } + // According to ISO 32000-1:2008, section 12.6.4.7, + // URI should to be encoded in 7-bit ASCII. + // Some bad PDFs may have URIs in UTF-8 encoding, see Bugzilla 1122280. + try { + data.url = stringToUTF8String(url); + } catch (e) { + // Fall back to a simple copy. + data.url = url; + } + } else if (linkType === 'GoTo') { + data.dest = action.get('D'); + } else if (linkType === 'GoToR') { + var urlDict = action.get('F'); + if (isDict(urlDict)) { + // We assume that the 'url' is a Filspec dictionary + // and fetch the url without checking any further + url = urlDict.get('F') || ''; + } + + // TODO: pdf reference says that GoToR + // can also have 'NewWindow' attribute + if (!isValidUrl(url, false)) { + url = ''; + } + data.url = url; + data.dest = action.get('D'); + } else if (linkType === 'Named') { + data.action = action.get('N').name; + } else { + warn('unrecognized link type: ' + linkType); + } + } else if (dict.has('Dest')) { + // simple destination link + var dest = dict.get('Dest'); + data.dest = isName(dest) ? dest.name : dest; + } + } + + // Lets URLs beginning with 'www.' default to using the 'http://' protocol. + function addDefaultProtocolToUrl(url) { + if (url && url.indexOf('www.') === 0) { + return ('http://' + url); + } + return url; + } + + Util.inherit(LinkAnnotation, Annotation, { }); + + return LinkAnnotation; +})(); + + +var PDFFunction = (function PDFFunctionClosure() { + var CONSTRUCT_SAMPLED = 0; + var CONSTRUCT_INTERPOLATED = 2; + var CONSTRUCT_STICHED = 3; + var CONSTRUCT_POSTSCRIPT = 4; + + return { + getSampleArray: function PDFFunction_getSampleArray(size, outputSize, bps, + str) { + var i, ii; + var length = 1; + for (i = 0, ii = size.length; i < ii; i++) { + length *= size[i]; + } + length *= outputSize; + + var array = new Array(length); + var codeSize = 0; + var codeBuf = 0; + // 32 is a valid bps so shifting won't work + var sampleMul = 1.0 / (Math.pow(2.0, bps) - 1); + + var strBytes = str.getBytes((length * bps + 7) / 8); + var strIdx = 0; + for (i = 0; i < length; i++) { + while (codeSize < bps) { + codeBuf <<= 8; + codeBuf |= strBytes[strIdx++]; + codeSize += 8; + } + codeSize -= bps; + array[i] = (codeBuf >> codeSize) * sampleMul; + codeBuf &= (1 << codeSize) - 1; + } + return array; + }, + + getIR: function PDFFunction_getIR(xref, fn) { + var dict = fn.dict; + if (!dict) { + dict = fn; + } + + var types = [this.constructSampled, + null, + this.constructInterpolated, + this.constructStiched, + this.constructPostScript]; + + var typeNum = dict.get('FunctionType'); + var typeFn = types[typeNum]; + if (!typeFn) { + error('Unknown type of function'); + } + + return typeFn.call(this, fn, dict, xref); + }, + + fromIR: function PDFFunction_fromIR(IR) { + var type = IR[0]; + switch (type) { + case CONSTRUCT_SAMPLED: + return this.constructSampledFromIR(IR); + case CONSTRUCT_INTERPOLATED: + return this.constructInterpolatedFromIR(IR); + case CONSTRUCT_STICHED: + return this.constructStichedFromIR(IR); + //case CONSTRUCT_POSTSCRIPT: + default: + return this.constructPostScriptFromIR(IR); + } + }, + + parse: function PDFFunction_parse(xref, fn) { + var IR = this.getIR(xref, fn); + return this.fromIR(IR); + }, + + parseArray: function PDFFunction_parseArray(xref, fnObj) { + if (!isArray(fnObj)) { + // not an array -- parsing as regular function + return this.parse(xref, fnObj); + } + + var fnArray = []; + for (var j = 0, jj = fnObj.length; j < jj; j++) { + var obj = xref.fetchIfRef(fnObj[j]); + fnArray.push(PDFFunction.parse(xref, obj)); + } + return function (src, srcOffset, dest, destOffset) { + for (var i = 0, ii = fnArray.length; i < ii; i++) { + fnArray[i](src, srcOffset, dest, destOffset + i); + } + }; + }, + + constructSampled: function PDFFunction_constructSampled(str, dict) { + function toMultiArray(arr) { + var inputLength = arr.length; + var out = []; + var index = 0; + for (var i = 0; i < inputLength; i += 2) { + out[index] = [arr[i], arr[i + 1]]; + ++index; + } + return out; + } + var domain = dict.get('Domain'); + var range = dict.get('Range'); + + if (!domain || !range) { + error('No domain or range'); + } + + var inputSize = domain.length / 2; + var outputSize = range.length / 2; + + domain = toMultiArray(domain); + range = toMultiArray(range); + + var size = dict.get('Size'); + var bps = dict.get('BitsPerSample'); + var order = dict.get('Order') || 1; + if (order !== 1) { + // No description how cubic spline interpolation works in PDF32000:2008 + // As in poppler, ignoring order, linear interpolation may work as good + info('No support for cubic spline interpolation: ' + order); + } + + var encode = dict.get('Encode'); + if (!encode) { + encode = []; + for (var i = 0; i < inputSize; ++i) { + encode.push(0); + encode.push(size[i] - 1); + } + } + encode = toMultiArray(encode); + + var decode = dict.get('Decode'); + if (!decode) { + decode = range; + } else { + decode = toMultiArray(decode); + } + + var samples = this.getSampleArray(size, outputSize, bps, str); + + return [ + CONSTRUCT_SAMPLED, inputSize, domain, encode, decode, samples, size, + outputSize, Math.pow(2, bps) - 1, range + ]; + }, + + constructSampledFromIR: function PDFFunction_constructSampledFromIR(IR) { + // See chapter 3, page 109 of the PDF reference + function interpolate(x, xmin, xmax, ymin, ymax) { + return ymin + ((x - xmin) * ((ymax - ymin) / (xmax - xmin))); + } + + return function constructSampledFromIRResult(src, srcOffset, + dest, destOffset) { + // See chapter 3, page 110 of the PDF reference. + var m = IR[1]; + var domain = IR[2]; + var encode = IR[3]; + var decode = IR[4]; + var samples = IR[5]; + var size = IR[6]; + var n = IR[7]; + //var mask = IR[8]; + var range = IR[9]; + + // Building the cube vertices: its part and sample index + // http://rjwagner49.com/Mathematics/Interpolation.pdf + var cubeVertices = 1 << m; + var cubeN = new Float64Array(cubeVertices); + var cubeVertex = new Uint32Array(cubeVertices); + var i, j; + for (j = 0; j < cubeVertices; j++) { + cubeN[j] = 1; + } + + var k = n, pos = 1; + // Map x_i to y_j for 0 <= i < m using the sampled function. + for (i = 0; i < m; ++i) { + // x_i' = min(max(x_i, Domain_2i), Domain_2i+1) + var domain_2i = domain[i][0]; + var domain_2i_1 = domain[i][1]; + var xi = Math.min(Math.max(src[srcOffset +i], domain_2i), + domain_2i_1); + + // e_i = Interpolate(x_i', Domain_2i, Domain_2i+1, + // Encode_2i, Encode_2i+1) + var e = interpolate(xi, domain_2i, domain_2i_1, + encode[i][0], encode[i][1]); + + // e_i' = min(max(e_i, 0), Size_i - 1) + var size_i = size[i]; + e = Math.min(Math.max(e, 0), size_i - 1); + + // Adjusting the cube: N and vertex sample index + var e0 = e < size_i - 1 ? Math.floor(e) : e - 1; // e1 = e0 + 1; + var n0 = e0 + 1 - e; // (e1 - e) / (e1 - e0); + var n1 = e - e0; // (e - e0) / (e1 - e0); + var offset0 = e0 * k; + var offset1 = offset0 + k; // e1 * k + for (j = 0; j < cubeVertices; j++) { + if (j & pos) { + cubeN[j] *= n1; + cubeVertex[j] += offset1; + } else { + cubeN[j] *= n0; + cubeVertex[j] += offset0; + } + } + + k *= size_i; + pos <<= 1; + } + + for (j = 0; j < n; ++j) { + // Sum all cube vertices' samples portions + var rj = 0; + for (i = 0; i < cubeVertices; i++) { + rj += samples[cubeVertex[i] + j] * cubeN[i]; + } + + // r_j' = Interpolate(r_j, 0, 2^BitsPerSample - 1, + // Decode_2j, Decode_2j+1) + rj = interpolate(rj, 0, 1, decode[j][0], decode[j][1]); + + // y_j = min(max(r_j, range_2j), range_2j+1) + dest[destOffset + j] = Math.min(Math.max(rj, range[j][0]), + range[j][1]); + } + }; + }, + + constructInterpolated: function PDFFunction_constructInterpolated(str, + dict) { + var c0 = dict.get('C0') || [0]; + var c1 = dict.get('C1') || [1]; + var n = dict.get('N'); + + if (!isArray(c0) || !isArray(c1)) { + error('Illegal dictionary for interpolated function'); + } + + var length = c0.length; + var diff = []; + for (var i = 0; i < length; ++i) { + diff.push(c1[i] - c0[i]); + } + + return [CONSTRUCT_INTERPOLATED, c0, diff, n]; + }, + + constructInterpolatedFromIR: + function PDFFunction_constructInterpolatedFromIR(IR) { + var c0 = IR[1]; + var diff = IR[2]; + var n = IR[3]; + + var length = diff.length; + + return function constructInterpolatedFromIRResult(src, srcOffset, + dest, destOffset) { + var x = n === 1 ? src[srcOffset] : Math.pow(src[srcOffset], n); + + for (var j = 0; j < length; ++j) { + dest[destOffset + j] = c0[j] + (x * diff[j]); + } + }; + }, + + constructStiched: function PDFFunction_constructStiched(fn, dict, xref) { + var domain = dict.get('Domain'); + + if (!domain) { + error('No domain'); + } + + var inputSize = domain.length / 2; + if (inputSize !== 1) { + error('Bad domain for stiched function'); + } + + var fnRefs = dict.get('Functions'); + var fns = []; + for (var i = 0, ii = fnRefs.length; i < ii; ++i) { + fns.push(PDFFunction.getIR(xref, xref.fetchIfRef(fnRefs[i]))); + } + + var bounds = dict.get('Bounds'); + var encode = dict.get('Encode'); + + return [CONSTRUCT_STICHED, domain, bounds, encode, fns]; + }, + + constructStichedFromIR: function PDFFunction_constructStichedFromIR(IR) { + var domain = IR[1]; + var bounds = IR[2]; + var encode = IR[3]; + var fnsIR = IR[4]; + var fns = []; + var tmpBuf = new Float32Array(1); + + for (var i = 0, ii = fnsIR.length; i < ii; i++) { + fns.push(PDFFunction.fromIR(fnsIR[i])); + } + + return function constructStichedFromIRResult(src, srcOffset, + dest, destOffset) { + var clip = function constructStichedFromIRClip(v, min, max) { + if (v > max) { + v = max; + } else if (v < min) { + v = min; + } + return v; + }; + + // clip to domain + var v = clip(src[srcOffset], domain[0], domain[1]); + // calulate which bound the value is in + for (var i = 0, ii = bounds.length; i < ii; ++i) { + if (v < bounds[i]) { + break; + } + } + + // encode value into domain of function + var dmin = domain[0]; + if (i > 0) { + dmin = bounds[i - 1]; + } + var dmax = domain[1]; + if (i < bounds.length) { + dmax = bounds[i]; + } + + var rmin = encode[2 * i]; + var rmax = encode[2 * i + 1]; + + // Prevent the value from becoming NaN as a result + // of division by zero (fixes issue6113.pdf). + tmpBuf[0] = dmin === dmax ? rmin : + rmin + (v - dmin) * (rmax - rmin) / (dmax - dmin); + + // call the appropriate function + fns[i](tmpBuf, 0, dest, destOffset); + }; + }, + + constructPostScript: function PDFFunction_constructPostScript(fn, dict, + xref) { + var domain = dict.get('Domain'); + var range = dict.get('Range'); + + if (!domain) { + error('No domain.'); + } + + if (!range) { + error('No range.'); + } + + var lexer = new PostScriptLexer(fn); + var parser = new PostScriptParser(lexer); + var code = parser.parse(); + + return [CONSTRUCT_POSTSCRIPT, domain, range, code]; + }, + + constructPostScriptFromIR: function PDFFunction_constructPostScriptFromIR( + IR) { + var domain = IR[1]; + var range = IR[2]; + var code = IR[3]; + + var compiled = (new PostScriptCompiler()).compile(code, domain, range); + if (compiled) { + // Compiled function consists of simple expressions such as addition, + // subtraction, Math.max, and also contains 'var' and 'return' + // statements. See the generation in the PostScriptCompiler below. + /*jshint -W054 */ + return new Function('src', 'srcOffset', 'dest', 'destOffset', compiled); + } + + info('Unable to compile PS function'); + + var numOutputs = range.length >> 1; + var numInputs = domain.length >> 1; + var evaluator = new PostScriptEvaluator(code); + // Cache the values for a big speed up, the cache size is limited though + // since the number of possible values can be huge from a PS function. + var cache = {}; + // The MAX_CACHE_SIZE is set to ~4x the maximum number of distinct values + // seen in our tests. + var MAX_CACHE_SIZE = 2048 * 4; + var cache_available = MAX_CACHE_SIZE; + var tmpBuf = new Float32Array(numInputs); + + return function constructPostScriptFromIRResult(src, srcOffset, + dest, destOffset) { + var i, value; + var key = ''; + var input = tmpBuf; + for (i = 0; i < numInputs; i++) { + value = src[srcOffset + i]; + input[i] = value; + key += value + '_'; + } + + var cachedValue = cache[key]; + if (cachedValue !== undefined) { + dest.set(cachedValue, destOffset); + return; + } + + var output = new Float32Array(numOutputs); + var stack = evaluator.execute(input); + var stackIndex = stack.length - numOutputs; + for (i = 0; i < numOutputs; i++) { + value = stack[stackIndex + i]; + var bound = range[i * 2]; + if (value < bound) { + value = bound; + } else { + bound = range[i * 2 +1]; + if (value > bound) { + value = bound; + } + } + output[i] = value; + } + if (cache_available > 0) { + cache_available--; + cache[key] = output; + } + dest.set(output, destOffset); + }; + } + }; +})(); + +function isPDFFunction(v) { + var fnDict; + if (typeof v !== 'object') { + return false; + } else if (isDict(v)) { + fnDict = v; + } else if (isStream(v)) { + fnDict = v.dict; + } else { + return false; + } + return fnDict.has('FunctionType'); +} + +var PostScriptStack = (function PostScriptStackClosure() { + var MAX_STACK_SIZE = 100; + function PostScriptStack(initialStack) { + this.stack = !initialStack ? [] : + Array.prototype.slice.call(initialStack, 0); + } + + PostScriptStack.prototype = { + push: function PostScriptStack_push(value) { + if (this.stack.length >= MAX_STACK_SIZE) { + error('PostScript function stack overflow.'); + } + this.stack.push(value); + }, + pop: function PostScriptStack_pop() { + if (this.stack.length <= 0) { + error('PostScript function stack underflow.'); + } + return this.stack.pop(); + }, + copy: function PostScriptStack_copy(n) { + if (this.stack.length + n >= MAX_STACK_SIZE) { + error('PostScript function stack overflow.'); + } + var stack = this.stack; + for (var i = stack.length - n, j = n - 1; j >= 0; j--, i++) { + stack.push(stack[i]); + } + }, + index: function PostScriptStack_index(n) { + this.push(this.stack[this.stack.length - n - 1]); + }, + // rotate the last n stack elements p times + roll: function PostScriptStack_roll(n, p) { + var stack = this.stack; + var l = stack.length - n; + var r = stack.length - 1, c = l + (p - Math.floor(p / n) * n), i, j, t; + for (i = l, j = r; i < j; i++, j--) { + t = stack[i]; stack[i] = stack[j]; stack[j] = t; + } + for (i = l, j = c - 1; i < j; i++, j--) { + t = stack[i]; stack[i] = stack[j]; stack[j] = t; + } + for (i = c, j = r; i < j; i++, j--) { + t = stack[i]; stack[i] = stack[j]; stack[j] = t; + } + } + }; + return PostScriptStack; +})(); +var PostScriptEvaluator = (function PostScriptEvaluatorClosure() { + function PostScriptEvaluator(operators) { + this.operators = operators; + } + PostScriptEvaluator.prototype = { + execute: function PostScriptEvaluator_execute(initialStack) { + var stack = new PostScriptStack(initialStack); + var counter = 0; + var operators = this.operators; + var length = operators.length; + var operator, a, b; + while (counter < length) { + operator = operators[counter++]; + if (typeof operator === 'number') { + // Operator is really an operand and should be pushed to the stack. + stack.push(operator); + continue; + } + switch (operator) { + // non standard ps operators + case 'jz': // jump if false + b = stack.pop(); + a = stack.pop(); + if (!a) { + counter = b; + } + break; + case 'j': // jump + a = stack.pop(); + counter = a; + break; + + // all ps operators in alphabetical order (excluding if/ifelse) + case 'abs': + a = stack.pop(); + stack.push(Math.abs(a)); + break; + case 'add': + b = stack.pop(); + a = stack.pop(); + stack.push(a + b); + break; + case 'and': + b = stack.pop(); + a = stack.pop(); + if (isBool(a) && isBool(b)) { + stack.push(a && b); + } else { + stack.push(a & b); + } + break; + case 'atan': + a = stack.pop(); + stack.push(Math.atan(a)); + break; + case 'bitshift': + b = stack.pop(); + a = stack.pop(); + if (a > 0) { + stack.push(a << b); + } else { + stack.push(a >> b); + } + break; + case 'ceiling': + a = stack.pop(); + stack.push(Math.ceil(a)); + break; + case 'copy': + a = stack.pop(); + stack.copy(a); + break; + case 'cos': + a = stack.pop(); + stack.push(Math.cos(a)); + break; + case 'cvi': + a = stack.pop() | 0; + stack.push(a); + break; + case 'cvr': + // noop + break; + case 'div': + b = stack.pop(); + a = stack.pop(); + stack.push(a / b); + break; + case 'dup': + stack.copy(1); + break; + case 'eq': + b = stack.pop(); + a = stack.pop(); + stack.push(a === b); + break; + case 'exch': + stack.roll(2, 1); + break; + case 'exp': + b = stack.pop(); + a = stack.pop(); + stack.push(Math.pow(a, b)); + break; + case 'false': + stack.push(false); + break; + case 'floor': + a = stack.pop(); + stack.push(Math.floor(a)); + break; + case 'ge': + b = stack.pop(); + a = stack.pop(); + stack.push(a >= b); + break; + case 'gt': + b = stack.pop(); + a = stack.pop(); + stack.push(a > b); + break; + case 'idiv': + b = stack.pop(); + a = stack.pop(); + stack.push((a / b) | 0); + break; + case 'index': + a = stack.pop(); + stack.index(a); + break; + case 'le': + b = stack.pop(); + a = stack.pop(); + stack.push(a <= b); + break; + case 'ln': + a = stack.pop(); + stack.push(Math.log(a)); + break; + case 'log': + a = stack.pop(); + stack.push(Math.log(a) / Math.LN10); + break; + case 'lt': + b = stack.pop(); + a = stack.pop(); + stack.push(a < b); + break; + case 'mod': + b = stack.pop(); + a = stack.pop(); + stack.push(a % b); + break; + case 'mul': + b = stack.pop(); + a = stack.pop(); + stack.push(a * b); + break; + case 'ne': + b = stack.pop(); + a = stack.pop(); + stack.push(a !== b); + break; + case 'neg': + a = stack.pop(); + stack.push(-a); + break; + case 'not': + a = stack.pop(); + if (isBool(a)) { + stack.push(!a); + } else { + stack.push(~a); + } + break; + case 'or': + b = stack.pop(); + a = stack.pop(); + if (isBool(a) && isBool(b)) { + stack.push(a || b); + } else { + stack.push(a | b); + } + break; + case 'pop': + stack.pop(); + break; + case 'roll': + b = stack.pop(); + a = stack.pop(); + stack.roll(a, b); + break; + case 'round': + a = stack.pop(); + stack.push(Math.round(a)); + break; + case 'sin': + a = stack.pop(); + stack.push(Math.sin(a)); + break; + case 'sqrt': + a = stack.pop(); + stack.push(Math.sqrt(a)); + break; + case 'sub': + b = stack.pop(); + a = stack.pop(); + stack.push(a - b); + break; + case 'true': + stack.push(true); + break; + case 'truncate': + a = stack.pop(); + a = a < 0 ? Math.ceil(a) : Math.floor(a); + stack.push(a); + break; + case 'xor': + b = stack.pop(); + a = stack.pop(); + if (isBool(a) && isBool(b)) { + stack.push(a !== b); + } else { + stack.push(a ^ b); + } + break; + default: + error('Unknown operator ' + operator); + break; + } + } + return stack.stack; + } + }; + return PostScriptEvaluator; +})(); + +// Most of the PDFs functions consist of simple operations such as: +// roll, exch, sub, cvr, pop, index, dup, mul, if, gt, add. +// +// We can compile most of such programs, and at the same moment, we can +// optimize some expressions using basic math properties. Keeping track of +// min/max values will allow us to avoid extra Math.min/Math.max calls. +var PostScriptCompiler = (function PostScriptCompilerClosure() { + function AstNode(type) { + this.type = type; + } + AstNode.prototype.visit = function (visitor) { + throw new Error('abstract method'); + }; + + function AstArgument(index, min, max) { + AstNode.call(this, 'args'); + this.index = index; + this.min = min; + this.max = max; + } + AstArgument.prototype = Object.create(AstNode.prototype); + AstArgument.prototype.visit = function (visitor) { + visitor.visitArgument(this); + }; + + function AstLiteral(number) { + AstNode.call(this, 'literal'); + this.number = number; + this.min = number; + this.max = number; + } + AstLiteral.prototype = Object.create(AstNode.prototype); + AstLiteral.prototype.visit = function (visitor) { + visitor.visitLiteral(this); + }; + + function AstBinaryOperation(op, arg1, arg2, min, max) { + AstNode.call(this, 'binary'); + this.op = op; + this.arg1 = arg1; + this.arg2 = arg2; + this.min = min; + this.max = max; + } + AstBinaryOperation.prototype = Object.create(AstNode.prototype); + AstBinaryOperation.prototype.visit = function (visitor) { + visitor.visitBinaryOperation(this); + }; + + function AstMin(arg, max) { + AstNode.call(this, 'max'); + this.arg = arg; + this.min = arg.min; + this.max = max; + } + AstMin.prototype = Object.create(AstNode.prototype); + AstMin.prototype.visit = function (visitor) { + visitor.visitMin(this); + }; + + function AstVariable(index, min, max) { + AstNode.call(this, 'var'); + this.index = index; + this.min = min; + this.max = max; + } + AstVariable.prototype = Object.create(AstNode.prototype); + AstVariable.prototype.visit = function (visitor) { + visitor.visitVariable(this); + }; + + function AstVariableDefinition(variable, arg) { + AstNode.call(this, 'definition'); + this.variable = variable; + this.arg = arg; + } + AstVariableDefinition.prototype = Object.create(AstNode.prototype); + AstVariableDefinition.prototype.visit = function (visitor) { + visitor.visitVariableDefinition(this); + }; + + function ExpressionBuilderVisitor() { + this.parts = []; + } + ExpressionBuilderVisitor.prototype = { + visitArgument: function (arg) { + this.parts.push('Math.max(', arg.min, ', Math.min(', + arg.max, ', src[srcOffset + ', arg.index, ']))'); + }, + visitVariable: function (variable) { + this.parts.push('v', variable.index); + }, + visitLiteral: function (literal) { + this.parts.push(literal.number); + }, + visitBinaryOperation: function (operation) { + this.parts.push('('); + operation.arg1.visit(this); + this.parts.push(' ', operation.op, ' '); + operation.arg2.visit(this); + this.parts.push(')'); + }, + visitVariableDefinition: function (definition) { + this.parts.push('var '); + definition.variable.visit(this); + this.parts.push(' = '); + definition.arg.visit(this); + this.parts.push(';'); + }, + visitMin: function (max) { + this.parts.push('Math.min('); + max.arg.visit(this); + this.parts.push(', ', max.max, ')'); + }, + toString: function () { + return this.parts.join(''); + } + }; + + function buildAddOperation(num1, num2) { + if (num2.type === 'literal' && num2.number === 0) { + // optimization: second operand is 0 + return num1; + } + if (num1.type === 'literal' && num1.number === 0) { + // optimization: first operand is 0 + return num2; + } + if (num2.type === 'literal' && num1.type === 'literal') { + // optimization: operands operand are literals + return new AstLiteral(num1.number + num2.number); + } + return new AstBinaryOperation('+', num1, num2, + num1.min + num2.min, num1.max + num2.max); + } + + function buildMulOperation(num1, num2) { + if (num2.type === 'literal') { + // optimization: second operands is a literal... + if (num2.number === 0) { + return new AstLiteral(0); // and it's 0 + } else if (num2.number === 1) { + return num1; // and it's 1 + } else if (num1.type === 'literal') { + // ... and first operands is a literal too + return new AstLiteral(num1.number * num2.number); + } + } + if (num1.type === 'literal') { + // optimization: first operands is a literal... + if (num1.number === 0) { + return new AstLiteral(0); // and it's 0 + } else if (num1.number === 1) { + return num2; // and it's 1 + } + } + var min = Math.min(num1.min * num2.min, num1.min * num2.max, + num1.max * num2.min, num1.max * num2.max); + var max = Math.max(num1.min * num2.min, num1.min * num2.max, + num1.max * num2.min, num1.max * num2.max); + return new AstBinaryOperation('*', num1, num2, min, max); + } + + function buildSubOperation(num1, num2) { + if (num2.type === 'literal') { + // optimization: second operands is a literal... + if (num2.number === 0) { + return num1; // ... and it's 0 + } else if (num1.type === 'literal') { + // ... and first operands is a literal too + return new AstLiteral(num1.number - num2.number); + } + } + if (num2.type === 'binary' && num2.op === '-' && + num1.type === 'literal' && num1.number === 1 && + num2.arg1.type === 'literal' && num2.arg1.number === 1) { + // optimization for case: 1 - (1 - x) + return num2.arg2; + } + return new AstBinaryOperation('-', num1, num2, + num1.min - num2.max, num1.max - num2.min); + } + + function buildMinOperation(num1, max) { + if (num1.min >= max) { + // optimization: num1 min value is not less than required max + return new AstLiteral(max); // just returning max + } else if (num1.max <= max) { + // optimization: num1 max value is not greater than required max + return num1; // just returning an argument + } + return new AstMin(num1, max); + } + + function PostScriptCompiler() {} + PostScriptCompiler.prototype = { + compile: function PostScriptCompiler_compile(code, domain, range) { + var stack = []; + var i, ii; + var instructions = []; + var inputSize = domain.length >> 1, outputSize = range.length >> 1; + var lastRegister = 0; + var n, j, min, max; + var num1, num2, ast1, ast2, tmpVar, item; + for (i = 0; i < inputSize; i++) { + stack.push(new AstArgument(i, domain[i * 2], domain[i * 2 + 1])); + } + + for (i = 0, ii = code.length; i < ii; i++) { + item = code[i]; + if (typeof item === 'number') { + stack.push(new AstLiteral(item)); + continue; + } + + switch (item) { + case 'add': + if (stack.length < 2) { + return null; + } + num2 = stack.pop(); + num1 = stack.pop(); + stack.push(buildAddOperation(num1, num2)); + break; + case 'cvr': + if (stack.length < 1) { + return null; + } + break; + case 'mul': + if (stack.length < 2) { + return null; + } + num2 = stack.pop(); + num1 = stack.pop(); + stack.push(buildMulOperation(num1, num2)); + break; + case 'sub': + if (stack.length < 2) { + return null; + } + num2 = stack.pop(); + num1 = stack.pop(); + stack.push(buildSubOperation(num1, num2)); + break; + case 'exch': + if (stack.length < 2) { + return null; + } + ast1 = stack.pop(); ast2 = stack.pop(); + stack.push(ast1, ast2); + break; + case 'pop': + if (stack.length < 1) { + return null; + } + stack.pop(); + break; + case 'index': + if (stack.length < 1) { + return null; + } + num1 = stack.pop(); + if (num1.type !== 'literal') { + return null; + } + n = num1.number; + if (n < 0 || (n|0) !== n || stack.length < n) { + return null; + } + ast1 = stack[stack.length - n - 1]; + if (ast1.type === 'literal' || ast1.type === 'var') { + stack.push(ast1); + break; + } + tmpVar = new AstVariable(lastRegister++, ast1.min, ast1.max); + stack[stack.length - n - 1] = tmpVar; + stack.push(tmpVar); + instructions.push(new AstVariableDefinition(tmpVar, ast1)); + break; + case 'dup': + if (stack.length < 1) { + return null; + } + if (typeof code[i + 1] === 'number' && code[i + 2] === 'gt' && + code[i + 3] === i + 7 && code[i + 4] === 'jz' && + code[i + 5] === 'pop' && code[i + 6] === code[i + 1]) { + // special case of the commands sequence for the min operation + num1 = stack.pop(); + stack.push(buildMinOperation(num1, code[i + 1])); + i += 6; + break; + } + ast1 = stack[stack.length - 1]; + if (ast1.type === 'literal' || ast1.type === 'var') { + // we don't have to save into intermediate variable a literal or + // variable. + stack.push(ast1); + break; + } + tmpVar = new AstVariable(lastRegister++, ast1.min, ast1.max); + stack[stack.length - 1] = tmpVar; + stack.push(tmpVar); + instructions.push(new AstVariableDefinition(tmpVar, ast1)); + break; + case 'roll': + if (stack.length < 2) { + return null; + } + num2 = stack.pop(); + num1 = stack.pop(); + if (num2.type !== 'literal' || num1.type !== 'literal') { + // both roll operands must be numbers + return null; + } + j = num2.number; + n = num1.number; + if (n <= 0 || (n|0) !== n || (j|0) !== j || stack.length < n) { + // ... and integers + return null; + } + j = ((j % n) + n) % n; + if (j === 0) { + break; // just skipping -- there are nothing to rotate + } + Array.prototype.push.apply(stack, + stack.splice(stack.length - n, n - j)); + break; + default: + return null; // unsupported operator + } + } + + if (stack.length !== outputSize) { + return null; + } + + var result = []; + instructions.forEach(function (instruction) { + var statementBuilder = new ExpressionBuilderVisitor(); + instruction.visit(statementBuilder); + result.push(statementBuilder.toString()); + }); + stack.forEach(function (expr, i) { + var statementBuilder = new ExpressionBuilderVisitor(); + expr.visit(statementBuilder); + var min = range[i * 2], max = range[i * 2 + 1]; + var out = [statementBuilder.toString()]; + if (min > expr.min) { + out.unshift('Math.max(', min, ', '); + out.push(')'); + } + if (max < expr.max) { + out.unshift('Math.min(', max, ', '); + out.push(')'); + } + out.unshift('dest[destOffset + ', i, '] = '); + out.push(';'); + result.push(out.join('')); + }); + return result.join('\n'); + } + }; + + return PostScriptCompiler; +})(); + + +var ColorSpace = (function ColorSpaceClosure() { + // Constructor should define this.numComps, this.defaultColor, this.name + function ColorSpace() { + error('should not call ColorSpace constructor'); + } + + ColorSpace.prototype = { + /** + * Converts the color value to the RGB color. The color components are + * located in the src array starting from the srcOffset. Returns the array + * of the rgb components, each value ranging from [0,255]. + */ + getRgb: function ColorSpace_getRgb(src, srcOffset) { + var rgb = new Uint8Array(3); + this.getRgbItem(src, srcOffset, rgb, 0); + return rgb; + }, + /** + * Converts the color value to the RGB color, similar to the getRgb method. + * The result placed into the dest array starting from the destOffset. + */ + getRgbItem: function ColorSpace_getRgbItem(src, srcOffset, + dest, destOffset) { + error('Should not call ColorSpace.getRgbItem'); + }, + /** + * Converts the specified number of the color values to the RGB colors. + * The colors are located in the src array starting from the srcOffset. + * The result is placed into the dest array starting from the destOffset. + * The src array items shall be in [0,2^bits) range, the dest array items + * will be in [0,255] range. alpha01 indicates how many alpha components + * there are in the dest array; it will be either 0 (RGB array) or 1 (RGBA + * array). + */ + getRgbBuffer: function ColorSpace_getRgbBuffer(src, srcOffset, count, + dest, destOffset, bits, + alpha01) { + error('Should not call ColorSpace.getRgbBuffer'); + }, + /** + * Determines the number of bytes required to store the result of the + * conversion done by the getRgbBuffer method. As in getRgbBuffer, + * |alpha01| is either 0 (RGB output) or 1 (RGBA output). + */ + getOutputLength: function ColorSpace_getOutputLength(inputLength, + alpha01) { + error('Should not call ColorSpace.getOutputLength'); + }, + /** + * Returns true if source data will be equal the result/output data. + */ + isPassthrough: function ColorSpace_isPassthrough(bits) { + return false; + }, + /** + * Fills in the RGB colors in the destination buffer. alpha01 indicates + * how many alpha components there are in the dest array; it will be either + * 0 (RGB array) or 1 (RGBA array). + */ + fillRgb: function ColorSpace_fillRgb(dest, originalWidth, + originalHeight, width, height, + actualHeight, bpc, comps, alpha01) { + var count = originalWidth * originalHeight; + var rgbBuf = null; + var numComponentColors = 1 << bpc; + var needsResizing = originalHeight !== height || originalWidth !== width; + var i, ii; + + if (this.isPassthrough(bpc)) { + rgbBuf = comps; + } else if (this.numComps === 1 && count > numComponentColors && + this.name !== 'DeviceGray' && this.name !== 'DeviceRGB') { + // Optimization: create a color map when there is just one component and + // we are converting more colors than the size of the color map. We + // don't build the map if the colorspace is gray or rgb since those + // methods are faster than building a map. This mainly offers big speed + // ups for indexed and alternate colorspaces. + // + // TODO it may be worth while to cache the color map. While running + // testing I never hit a cache so I will leave that out for now (perhaps + // we are reparsing colorspaces too much?). + var allColors = bpc <= 8 ? new Uint8Array(numComponentColors) : + new Uint16Array(numComponentColors); + var key; + for (i = 0; i < numComponentColors; i++) { + allColors[i] = i; + } + var colorMap = new Uint8Array(numComponentColors * 3); + this.getRgbBuffer(allColors, 0, numComponentColors, colorMap, 0, bpc, + /* alpha01 = */ 0); + + var destPos, rgbPos; + if (!needsResizing) { + // Fill in the RGB values directly into |dest|. + destPos = 0; + for (i = 0; i < count; ++i) { + key = comps[i] * 3; + dest[destPos++] = colorMap[key]; + dest[destPos++] = colorMap[key + 1]; + dest[destPos++] = colorMap[key + 2]; + destPos += alpha01; + } + } else { + rgbBuf = new Uint8Array(count * 3); + rgbPos = 0; + for (i = 0; i < count; ++i) { + key = comps[i] * 3; + rgbBuf[rgbPos++] = colorMap[key]; + rgbBuf[rgbPos++] = colorMap[key + 1]; + rgbBuf[rgbPos++] = colorMap[key + 2]; + } + } + } else { + if (!needsResizing) { + // Fill in the RGB values directly into |dest|. + this.getRgbBuffer(comps, 0, width * actualHeight, dest, 0, bpc, + alpha01); + } else { + rgbBuf = new Uint8Array(count * 3); + this.getRgbBuffer(comps, 0, count, rgbBuf, 0, bpc, + /* alpha01 = */ 0); + } + } + + if (rgbBuf) { + if (needsResizing) { + PDFImage.resize(rgbBuf, bpc, 3, originalWidth, originalHeight, width, + height, dest, alpha01); + } else { + rgbPos = 0; + destPos = 0; + for (i = 0, ii = width * actualHeight; i < ii; i++) { + dest[destPos++] = rgbBuf[rgbPos++]; + dest[destPos++] = rgbBuf[rgbPos++]; + dest[destPos++] = rgbBuf[rgbPos++]; + destPos += alpha01; + } + } + } + }, + /** + * True if the colorspace has components in the default range of [0, 1]. + * This should be true for all colorspaces except for lab color spaces + * which are [0,100], [-128, 127], [-128, 127]. + */ + usesZeroToOneRange: true + }; + + ColorSpace.parse = function ColorSpace_parse(cs, xref, res) { + var IR = ColorSpace.parseToIR(cs, xref, res); + if (IR instanceof AlternateCS) { + return IR; + } + return ColorSpace.fromIR(IR); + }; + + ColorSpace.fromIR = function ColorSpace_fromIR(IR) { + var name = isArray(IR) ? IR[0] : IR; + var whitePoint, blackPoint, gamma; + + switch (name) { + case 'DeviceGrayCS': + return this.singletons.gray; + case 'DeviceRgbCS': + return this.singletons.rgb; + case 'DeviceCmykCS': + return this.singletons.cmyk; + case 'CalGrayCS': + whitePoint = IR[1].WhitePoint; + blackPoint = IR[1].BlackPoint; + gamma = IR[1].Gamma; + return new CalGrayCS(whitePoint, blackPoint, gamma); + case 'CalRGBCS': + whitePoint = IR[1].WhitePoint; + blackPoint = IR[1].BlackPoint; + gamma = IR[1].Gamma; + var matrix = IR[1].Matrix; + return new CalRGBCS(whitePoint, blackPoint, gamma, matrix); + case 'PatternCS': + var basePatternCS = IR[1]; + if (basePatternCS) { + basePatternCS = ColorSpace.fromIR(basePatternCS); + } + return new PatternCS(basePatternCS); + case 'IndexedCS': + var baseIndexedCS = IR[1]; + var hiVal = IR[2]; + var lookup = IR[3]; + return new IndexedCS(ColorSpace.fromIR(baseIndexedCS), hiVal, lookup); + case 'AlternateCS': + var numComps = IR[1]; + var alt = IR[2]; + var tintFnIR = IR[3]; + + return new AlternateCS(numComps, ColorSpace.fromIR(alt), + PDFFunction.fromIR(tintFnIR)); + case 'LabCS': + whitePoint = IR[1].WhitePoint; + blackPoint = IR[1].BlackPoint; + var range = IR[1].Range; + return new LabCS(whitePoint, blackPoint, range); + default: + error('Unknown name ' + name); + } + return null; + }; + + ColorSpace.parseToIR = function ColorSpace_parseToIR(cs, xref, res) { + if (isName(cs)) { + var colorSpaces = res.get('ColorSpace'); + if (isDict(colorSpaces)) { + var refcs = colorSpaces.get(cs.name); + if (refcs) { + cs = refcs; + } + } + } + + cs = xref.fetchIfRef(cs); + var mode; + + if (isName(cs)) { + mode = cs.name; + this.mode = mode; + + switch (mode) { + case 'DeviceGray': + case 'G': + return 'DeviceGrayCS'; + case 'DeviceRGB': + case 'RGB': + return 'DeviceRgbCS'; + case 'DeviceCMYK': + case 'CMYK': + return 'DeviceCmykCS'; + case 'Pattern': + return ['PatternCS', null]; + default: + error('unrecognized colorspace ' + mode); + } + } else if (isArray(cs)) { + mode = xref.fetchIfRef(cs[0]).name; + this.mode = mode; + var numComps, params, alt; + + switch (mode) { + case 'DeviceGray': + case 'G': + return 'DeviceGrayCS'; + case 'DeviceRGB': + case 'RGB': + return 'DeviceRgbCS'; + case 'DeviceCMYK': + case 'CMYK': + return 'DeviceCmykCS'; + case 'CalGray': + params = xref.fetchIfRef(cs[1]).getAll(); + return ['CalGrayCS', params]; + case 'CalRGB': + params = xref.fetchIfRef(cs[1]).getAll(); + return ['CalRGBCS', params]; + case 'ICCBased': + var stream = xref.fetchIfRef(cs[1]); + var dict = stream.dict; + numComps = dict.get('N'); + alt = dict.get('Alternate'); + if (alt) { + var altIR = ColorSpace.parseToIR(alt, xref, res); + // Parse the /Alternate CS to ensure that the number of components + // are correct, and also (indirectly) that it is not a PatternCS. + var altCS = ColorSpace.fromIR(altIR); + if (altCS.numComps === numComps) { + return altIR; + } + warn('ICCBased color space: Ignoring incorrect /Alternate entry.'); + } + if (numComps === 1) { + return 'DeviceGrayCS'; + } else if (numComps === 3) { + return 'DeviceRgbCS'; + } else if (numComps === 4) { + return 'DeviceCmykCS'; + } + break; + case 'Pattern': + var basePatternCS = cs[1] || null; + if (basePatternCS) { + basePatternCS = ColorSpace.parseToIR(basePatternCS, xref, res); + } + return ['PatternCS', basePatternCS]; + case 'Indexed': + case 'I': + var baseIndexedCS = ColorSpace.parseToIR(cs[1], xref, res); + var hiVal = xref.fetchIfRef(cs[2]) + 1; + var lookup = xref.fetchIfRef(cs[3]); + if (isStream(lookup)) { + lookup = lookup.getBytes(); + } + return ['IndexedCS', baseIndexedCS, hiVal, lookup]; + case 'Separation': + case 'DeviceN': + var name = xref.fetchIfRef(cs[1]); + numComps = 1; + if (isName(name)) { + numComps = 1; + } else if (isArray(name)) { + numComps = name.length; + } + alt = ColorSpace.parseToIR(cs[2], xref, res); + var tintFnIR = PDFFunction.getIR(xref, xref.fetchIfRef(cs[3])); + return ['AlternateCS', numComps, alt, tintFnIR]; + case 'Lab': + params = xref.fetchIfRef(cs[1]).getAll(); + return ['LabCS', params]; + default: + error('unimplemented color space object "' + mode + '"'); + } + } else { + error('unrecognized color space object: "' + cs + '"'); + } + return null; + }; + /** + * Checks if a decode map matches the default decode map for a color space. + * This handles the general decode maps where there are two values per + * component. e.g. [0, 1, 0, 1, 0, 1] for a RGB color. + * This does not handle Lab, Indexed, or Pattern decode maps since they are + * slightly different. + * @param {Array} decode Decode map (usually from an image). + * @param {Number} n Number of components the color space has. + */ + ColorSpace.isDefaultDecode = function ColorSpace_isDefaultDecode(decode, n) { + if (!isArray(decode)) { + return true; + } + + if (n * 2 !== decode.length) { + warn('The decode map is not the correct length'); + return true; + } + for (var i = 0, ii = decode.length; i < ii; i += 2) { + if (decode[i] !== 0 || decode[i + 1] !== 1) { + return false; + } + } + return true; + }; + + ColorSpace.singletons = { + get gray() { + return shadow(this, 'gray', new DeviceGrayCS()); + }, + get rgb() { + return shadow(this, 'rgb', new DeviceRgbCS()); + }, + get cmyk() { + return shadow(this, 'cmyk', new DeviceCmykCS()); + } + }; + + return ColorSpace; +})(); + +/** + * Alternate color space handles both Separation and DeviceN color spaces. A + * Separation color space is actually just a DeviceN with one color component. + * Both color spaces use a tinting function to convert colors to a base color + * space. + */ +var AlternateCS = (function AlternateCSClosure() { + function AlternateCS(numComps, base, tintFn) { + this.name = 'Alternate'; + this.numComps = numComps; + this.defaultColor = new Float32Array(numComps); + for (var i = 0; i < numComps; ++i) { + this.defaultColor[i] = 1; + } + this.base = base; + this.tintFn = tintFn; + this.tmpBuf = new Float32Array(base.numComps); + } + + AlternateCS.prototype = { + getRgb: ColorSpace.prototype.getRgb, + getRgbItem: function AlternateCS_getRgbItem(src, srcOffset, + dest, destOffset) { + var tmpBuf = this.tmpBuf; + this.tintFn(src, srcOffset, tmpBuf, 0); + this.base.getRgbItem(tmpBuf, 0, dest, destOffset); + }, + getRgbBuffer: function AlternateCS_getRgbBuffer(src, srcOffset, count, + dest, destOffset, bits, + alpha01) { + var tintFn = this.tintFn; + var base = this.base; + var scale = 1 / ((1 << bits) - 1); + var baseNumComps = base.numComps; + var usesZeroToOneRange = base.usesZeroToOneRange; + var isPassthrough = (base.isPassthrough(8) || !usesZeroToOneRange) && + alpha01 === 0; + var pos = isPassthrough ? destOffset : 0; + var baseBuf = isPassthrough ? dest : new Uint8Array(baseNumComps * count); + var numComps = this.numComps; + + var scaled = new Float32Array(numComps); + var tinted = new Float32Array(baseNumComps); + var i, j; + if (usesZeroToOneRange) { + for (i = 0; i < count; i++) { + for (j = 0; j < numComps; j++) { + scaled[j] = src[srcOffset++] * scale; + } + tintFn(scaled, 0, tinted, 0); + for (j = 0; j < baseNumComps; j++) { + baseBuf[pos++] = tinted[j] * 255; + } + } + } else { + for (i = 0; i < count; i++) { + for (j = 0; j < numComps; j++) { + scaled[j] = src[srcOffset++] * scale; + } + tintFn(scaled, 0, tinted, 0); + base.getRgbItem(tinted, 0, baseBuf, pos); + pos += baseNumComps; + } + } + if (!isPassthrough) { + base.getRgbBuffer(baseBuf, 0, count, dest, destOffset, 8, alpha01); + } + }, + getOutputLength: function AlternateCS_getOutputLength(inputLength, + alpha01) { + return this.base.getOutputLength(inputLength * + this.base.numComps / this.numComps, + alpha01); + }, + isPassthrough: ColorSpace.prototype.isPassthrough, + fillRgb: ColorSpace.prototype.fillRgb, + isDefaultDecode: function AlternateCS_isDefaultDecode(decodeMap) { + return ColorSpace.isDefaultDecode(decodeMap, this.numComps); + }, + usesZeroToOneRange: true + }; + + return AlternateCS; +})(); + +var PatternCS = (function PatternCSClosure() { + function PatternCS(baseCS) { + this.name = 'Pattern'; + this.base = baseCS; + } + PatternCS.prototype = {}; + + return PatternCS; +})(); + +var IndexedCS = (function IndexedCSClosure() { + function IndexedCS(base, highVal, lookup) { + this.name = 'Indexed'; + this.numComps = 1; + this.defaultColor = new Uint8Array([0]); + this.base = base; + this.highVal = highVal; + + var baseNumComps = base.numComps; + var length = baseNumComps * highVal; + var lookupArray; + + if (isStream(lookup)) { + lookupArray = new Uint8Array(length); + var bytes = lookup.getBytes(length); + lookupArray.set(bytes); + } else if (isString(lookup)) { + lookupArray = new Uint8Array(length); + for (var i = 0; i < length; ++i) { + lookupArray[i] = lookup.charCodeAt(i); + } + } else if (lookup instanceof Uint8Array || lookup instanceof Array) { + lookupArray = lookup; + } else { + error('Unrecognized lookup table: ' + lookup); + } + this.lookup = lookupArray; + } + + IndexedCS.prototype = { + getRgb: ColorSpace.prototype.getRgb, + getRgbItem: function IndexedCS_getRgbItem(src, srcOffset, + dest, destOffset) { + var numComps = this.base.numComps; + var start = src[srcOffset] * numComps; + this.base.getRgbItem(this.lookup, start, dest, destOffset); + }, + getRgbBuffer: function IndexedCS_getRgbBuffer(src, srcOffset, count, + dest, destOffset, bits, + alpha01) { + var base = this.base; + var numComps = base.numComps; + var outputDelta = base.getOutputLength(numComps, alpha01); + var lookup = this.lookup; + + for (var i = 0; i < count; ++i) { + var lookupPos = src[srcOffset++] * numComps; + base.getRgbBuffer(lookup, lookupPos, 1, dest, destOffset, 8, alpha01); + destOffset += outputDelta; + } + }, + getOutputLength: function IndexedCS_getOutputLength(inputLength, alpha01) { + return this.base.getOutputLength(inputLength * this.base.numComps, + alpha01); + }, + isPassthrough: ColorSpace.prototype.isPassthrough, + fillRgb: ColorSpace.prototype.fillRgb, + isDefaultDecode: function IndexedCS_isDefaultDecode(decodeMap) { + // indexed color maps shouldn't be changed + return true; + }, + usesZeroToOneRange: true + }; + return IndexedCS; +})(); + +var DeviceGrayCS = (function DeviceGrayCSClosure() { + function DeviceGrayCS() { + this.name = 'DeviceGray'; + this.numComps = 1; + this.defaultColor = new Float32Array([0]); + } + + DeviceGrayCS.prototype = { + getRgb: ColorSpace.prototype.getRgb, + getRgbItem: function DeviceGrayCS_getRgbItem(src, srcOffset, + dest, destOffset) { + var c = (src[srcOffset] * 255) | 0; + c = c < 0 ? 0 : c > 255 ? 255 : c; + dest[destOffset] = dest[destOffset + 1] = dest[destOffset + 2] = c; + }, + getRgbBuffer: function DeviceGrayCS_getRgbBuffer(src, srcOffset, count, + dest, destOffset, bits, + alpha01) { + var scale = 255 / ((1 << bits) - 1); + var j = srcOffset, q = destOffset; + for (var i = 0; i < count; ++i) { + var c = (scale * src[j++]) | 0; + dest[q++] = c; + dest[q++] = c; + dest[q++] = c; + q += alpha01; + } + }, + getOutputLength: function DeviceGrayCS_getOutputLength(inputLength, + alpha01) { + return inputLength * (3 + alpha01); + }, + isPassthrough: ColorSpace.prototype.isPassthrough, + fillRgb: ColorSpace.prototype.fillRgb, + isDefaultDecode: function DeviceGrayCS_isDefaultDecode(decodeMap) { + return ColorSpace.isDefaultDecode(decodeMap, this.numComps); + }, + usesZeroToOneRange: true + }; + return DeviceGrayCS; +})(); + +var DeviceRgbCS = (function DeviceRgbCSClosure() { + function DeviceRgbCS() { + this.name = 'DeviceRGB'; + this.numComps = 3; + this.defaultColor = new Float32Array([0, 0, 0]); + } + DeviceRgbCS.prototype = { + getRgb: ColorSpace.prototype.getRgb, + getRgbItem: function DeviceRgbCS_getRgbItem(src, srcOffset, + dest, destOffset) { + var r = (src[srcOffset] * 255) | 0; + var g = (src[srcOffset + 1] * 255) | 0; + var b = (src[srcOffset + 2] * 255) | 0; + dest[destOffset] = r < 0 ? 0 : r > 255 ? 255 : r; + dest[destOffset + 1] = g < 0 ? 0 : g > 255 ? 255 : g; + dest[destOffset + 2] = b < 0 ? 0 : b > 255 ? 255 : b; + }, + getRgbBuffer: function DeviceRgbCS_getRgbBuffer(src, srcOffset, count, + dest, destOffset, bits, + alpha01) { + if (bits === 8 && alpha01 === 0) { + dest.set(src.subarray(srcOffset, srcOffset + count * 3), destOffset); + return; + } + var scale = 255 / ((1 << bits) - 1); + var j = srcOffset, q = destOffset; + for (var i = 0; i < count; ++i) { + dest[q++] = (scale * src[j++]) | 0; + dest[q++] = (scale * src[j++]) | 0; + dest[q++] = (scale * src[j++]) | 0; + q += alpha01; + } + }, + getOutputLength: function DeviceRgbCS_getOutputLength(inputLength, + alpha01) { + return (inputLength * (3 + alpha01) / 3) | 0; + }, + isPassthrough: function DeviceRgbCS_isPassthrough(bits) { + return bits === 8; + }, + fillRgb: ColorSpace.prototype.fillRgb, + isDefaultDecode: function DeviceRgbCS_isDefaultDecode(decodeMap) { + return ColorSpace.isDefaultDecode(decodeMap, this.numComps); + }, + usesZeroToOneRange: true + }; + return DeviceRgbCS; +})(); + +var DeviceCmykCS = (function DeviceCmykCSClosure() { + // The coefficients below was found using numerical analysis: the method of + // steepest descent for the sum((f_i - color_value_i)^2) for r/g/b colors, + // where color_value is the tabular value from the table of sampled RGB colors + // from CMYK US Web Coated (SWOP) colorspace, and f_i is the corresponding + // CMYK color conversion using the estimation below: + // f(A, B,.. N) = Acc+Bcm+Ccy+Dck+c+Fmm+Gmy+Hmk+Im+Jyy+Kyk+Ly+Mkk+Nk+255 + function convertToRgb(src, srcOffset, srcScale, dest, destOffset) { + var c = src[srcOffset + 0] * srcScale; + var m = src[srcOffset + 1] * srcScale; + var y = src[srcOffset + 2] * srcScale; + var k = src[srcOffset + 3] * srcScale; + + var r = + (c * (-4.387332384609988 * c + 54.48615194189176 * m + + 18.82290502165302 * y + 212.25662451639585 * k + + -285.2331026137004) + + m * (1.7149763477362134 * m - 5.6096736904047315 * y + + -17.873870861415444 * k - 5.497006427196366) + + y * (-2.5217340131683033 * y - 21.248923337353073 * k + + 17.5119270841813) + + k * (-21.86122147463605 * k - 189.48180835922747) + 255) | 0; + var g = + (c * (8.841041422036149 * c + 60.118027045597366 * m + + 6.871425592049007 * y + 31.159100130055922 * k + + -79.2970844816548) + + m * (-15.310361306967817 * m + 17.575251261109482 * y + + 131.35250912493976 * k - 190.9453302588951) + + y * (4.444339102852739 * y + 9.8632861493405 * k - 24.86741582555878) + + k * (-20.737325471181034 * k - 187.80453709719578) + 255) | 0; + var b = + (c * (0.8842522430003296 * c + 8.078677503112928 * m + + 30.89978309703729 * y - 0.23883238689178934 * k + + -14.183576799673286) + + m * (10.49593273432072 * m + 63.02378494754052 * y + + 50.606957656360734 * k - 112.23884253719248) + + y * (0.03296041114873217 * y + 115.60384449646641 * k + + -193.58209356861505) + + k * (-22.33816807309886 * k - 180.12613974708367) + 255) | 0; + + dest[destOffset] = r > 255 ? 255 : r < 0 ? 0 : r; + dest[destOffset + 1] = g > 255 ? 255 : g < 0 ? 0 : g; + dest[destOffset + 2] = b > 255 ? 255 : b < 0 ? 0 : b; + } + + function DeviceCmykCS() { + this.name = 'DeviceCMYK'; + this.numComps = 4; + this.defaultColor = new Float32Array([0, 0, 0, 1]); + } + DeviceCmykCS.prototype = { + getRgb: ColorSpace.prototype.getRgb, + getRgbItem: function DeviceCmykCS_getRgbItem(src, srcOffset, + dest, destOffset) { + convertToRgb(src, srcOffset, 1, dest, destOffset); + }, + getRgbBuffer: function DeviceCmykCS_getRgbBuffer(src, srcOffset, count, + dest, destOffset, bits, + alpha01) { + var scale = 1 / ((1 << bits) - 1); + for (var i = 0; i < count; i++) { + convertToRgb(src, srcOffset, scale, dest, destOffset); + srcOffset += 4; + destOffset += 3 + alpha01; + } + }, + getOutputLength: function DeviceCmykCS_getOutputLength(inputLength, + alpha01) { + return (inputLength / 4 * (3 + alpha01)) | 0; + }, + isPassthrough: ColorSpace.prototype.isPassthrough, + fillRgb: ColorSpace.prototype.fillRgb, + isDefaultDecode: function DeviceCmykCS_isDefaultDecode(decodeMap) { + return ColorSpace.isDefaultDecode(decodeMap, this.numComps); + }, + usesZeroToOneRange: true + }; + + return DeviceCmykCS; +})(); + +// +// CalGrayCS: Based on "PDF Reference, Sixth Ed", p.245 +// +var CalGrayCS = (function CalGrayCSClosure() { + function CalGrayCS(whitePoint, blackPoint, gamma) { + this.name = 'CalGray'; + this.numComps = 1; + this.defaultColor = new Float32Array([0]); + + if (!whitePoint) { + error('WhitePoint missing - required for color space CalGray'); + } + blackPoint = blackPoint || [0, 0, 0]; + gamma = gamma || 1; + + // Translate arguments to spec variables. + this.XW = whitePoint[0]; + this.YW = whitePoint[1]; + this.ZW = whitePoint[2]; + + this.XB = blackPoint[0]; + this.YB = blackPoint[1]; + this.ZB = blackPoint[2]; + + this.G = gamma; + + // Validate variables as per spec. + if (this.XW < 0 || this.ZW < 0 || this.YW !== 1) { + error('Invalid WhitePoint components for ' + this.name + + ', no fallback available'); + } + + if (this.XB < 0 || this.YB < 0 || this.ZB < 0) { + info('Invalid BlackPoint for ' + this.name + ', falling back to default'); + this.XB = this.YB = this.ZB = 0; + } + + if (this.XB !== 0 || this.YB !== 0 || this.ZB !== 0) { + warn(this.name + ', BlackPoint: XB: ' + this.XB + ', YB: ' + this.YB + + ', ZB: ' + this.ZB + ', only default values are supported.'); + } + + if (this.G < 1) { + info('Invalid Gamma: ' + this.G + ' for ' + this.name + + ', falling back to default'); + this.G = 1; + } + } + + function convertToRgb(cs, src, srcOffset, dest, destOffset, scale) { + // A represents a gray component of a calibrated gray space. + // A <---> AG in the spec + var A = src[srcOffset] * scale; + var AG = Math.pow(A, cs.G); + + // Computes L as per spec. ( = cs.YW * AG ) + // Except if other than default BlackPoint values are used. + var L = cs.YW * AG; + // http://www.poynton.com/notes/colour_and_gamma/ColorFAQ.html, Ch 4. + // Convert values to rgb range [0, 255]. + var val = Math.max(295.8 * Math.pow(L, 0.333333333333333333) - 40.8, 0) | 0; + dest[destOffset] = val; + dest[destOffset + 1] = val; + dest[destOffset + 2] = val; + } + + CalGrayCS.prototype = { + getRgb: ColorSpace.prototype.getRgb, + getRgbItem: function CalGrayCS_getRgbItem(src, srcOffset, + dest, destOffset) { + convertToRgb(this, src, srcOffset, dest, destOffset, 1); + }, + getRgbBuffer: function CalGrayCS_getRgbBuffer(src, srcOffset, count, + dest, destOffset, bits, + alpha01) { + var scale = 1 / ((1 << bits) - 1); + + for (var i = 0; i < count; ++i) { + convertToRgb(this, src, srcOffset, dest, destOffset, scale); + srcOffset += 1; + destOffset += 3 + alpha01; + } + }, + getOutputLength: function CalGrayCS_getOutputLength(inputLength, alpha01) { + return inputLength * (3 + alpha01); + }, + isPassthrough: ColorSpace.prototype.isPassthrough, + fillRgb: ColorSpace.prototype.fillRgb, + isDefaultDecode: function CalGrayCS_isDefaultDecode(decodeMap) { + return ColorSpace.isDefaultDecode(decodeMap, this.numComps); + }, + usesZeroToOneRange: true + }; + return CalGrayCS; +})(); + +// +// CalRGBCS: Based on "PDF Reference, Sixth Ed", p.247 +// +var CalRGBCS = (function CalRGBCSClosure() { + + // See http://www.brucelindbloom.com/index.html?Eqn_ChromAdapt.html for these + // matrices. + var BRADFORD_SCALE_MATRIX = new Float32Array([ + 0.8951, 0.2664, -0.1614, + -0.7502, 1.7135, 0.0367, + 0.0389, -0.0685, 1.0296]); + + var BRADFORD_SCALE_INVERSE_MATRIX = new Float32Array([ + 0.9869929, -0.1470543, 0.1599627, + 0.4323053, 0.5183603, 0.0492912, + -0.0085287, 0.0400428, 0.9684867]); + + // See http://www.brucelindbloom.com/index.html?Eqn_RGB_XYZ_Matrix.html. + var SRGB_D65_XYZ_TO_RGB_MATRIX = new Float32Array([ + 3.2404542, -1.5371385, -0.4985314, + -0.9692660, 1.8760108, 0.0415560, + 0.0556434, -0.2040259, 1.0572252]); + + var FLAT_WHITEPOINT_MATRIX = new Float32Array([1, 1, 1]); + + var tempNormalizeMatrix = new Float32Array(3); + var tempConvertMatrix1 = new Float32Array(3); + var tempConvertMatrix2 = new Float32Array(3); + + var DECODE_L_CONSTANT = Math.pow(((8 + 16) / 116), 3) / 8.0; + + function CalRGBCS(whitePoint, blackPoint, gamma, matrix) { + this.name = 'CalRGB'; + this.numComps = 3; + this.defaultColor = new Float32Array(3); + + if (!whitePoint) { + error('WhitePoint missing - required for color space CalRGB'); + } + blackPoint = blackPoint || new Float32Array(3); + gamma = gamma || new Float32Array([1, 1, 1]); + matrix = matrix || new Float32Array([1, 0, 0, 0, 1, 0, 0, 0, 1]); + + // Translate arguments to spec variables. + var XW = whitePoint[0]; + var YW = whitePoint[1]; + var ZW = whitePoint[2]; + this.whitePoint = whitePoint; + + var XB = blackPoint[0]; + var YB = blackPoint[1]; + var ZB = blackPoint[2]; + this.blackPoint = blackPoint; + + this.GR = gamma[0]; + this.GG = gamma[1]; + this.GB = gamma[2]; + + this.MXA = matrix[0]; + this.MYA = matrix[1]; + this.MZA = matrix[2]; + this.MXB = matrix[3]; + this.MYB = matrix[4]; + this.MZB = matrix[5]; + this.MXC = matrix[6]; + this.MYC = matrix[7]; + this.MZC = matrix[8]; + + // Validate variables as per spec. + if (XW < 0 || ZW < 0 || YW !== 1) { + error('Invalid WhitePoint components for ' + this.name + + ', no fallback available'); + } + + if (XB < 0 || YB < 0 || ZB < 0) { + info('Invalid BlackPoint for ' + this.name + ' [' + XB + ', ' + YB + + ', ' + ZB + '], falling back to default'); + this.blackPoint = new Float32Array(3); + } + + if (this.GR < 0 || this.GG < 0 || this.GB < 0) { + info('Invalid Gamma [' + this.GR + ', ' + this.GG + ', ' + this.GB + + '] for ' + this.name + ', falling back to default'); + this.GR = this.GG = this.GB = 1; + } + + if (this.MXA < 0 || this.MYA < 0 || this.MZA < 0 || + this.MXB < 0 || this.MYB < 0 || this.MZB < 0 || + this.MXC < 0 || this.MYC < 0 || this.MZC < 0) { + info('Invalid Matrix for ' + this.name + ' [' + + this.MXA + ', ' + this.MYA + ', ' + this.MZA + + this.MXB + ', ' + this.MYB + ', ' + this.MZB + + this.MXC + ', ' + this.MYC + ', ' + this.MZC + + '], falling back to default'); + this.MXA = this.MYB = this.MZC = 1; + this.MXB = this.MYA = this.MZA = this.MXC = this.MYC = this.MZB = 0; + } + } + + function matrixProduct(a, b, result) { + result[0] = a[0] * b[0] + a[1] * b[1] + a[2] * b[2]; + result[1] = a[3] * b[0] + a[4] * b[1] + a[5] * b[2]; + result[2] = a[6] * b[0] + a[7] * b[1] + a[8] * b[2]; + } + + function convertToFlat(sourceWhitePoint, LMS, result) { + result[0] = LMS[0] * 1 / sourceWhitePoint[0]; + result[1] = LMS[1] * 1 / sourceWhitePoint[1]; + result[2] = LMS[2] * 1 / sourceWhitePoint[2]; + } + + function convertToD65(sourceWhitePoint, LMS, result) { + var D65X = 0.95047; + var D65Y = 1; + var D65Z = 1.08883; + + result[0] = LMS[0] * D65X / sourceWhitePoint[0]; + result[1] = LMS[1] * D65Y / sourceWhitePoint[1]; + result[2] = LMS[2] * D65Z / sourceWhitePoint[2]; + } + + function sRGBTransferFunction(color) { + // See http://en.wikipedia.org/wiki/SRGB. + if (color <= 0.0031308){ + return adjustToRange(0, 1, 12.92 * color); + } + + return adjustToRange(0, 1, (1 + 0.055) * Math.pow(color, 1 / 2.4) - 0.055); + } + + function adjustToRange(min, max, value) { + return Math.max(min, Math.min(max, value)); + } + + function decodeL(L) { + if (L < 0) { + return -decodeL(-L); + } + + if (L > 8.0) { + return Math.pow(((L + 16) / 116), 3); + } + + return L * DECODE_L_CONSTANT; + } + + function compensateBlackPoint(sourceBlackPoint, XYZ_Flat, result) { + + // In case the blackPoint is already the default blackPoint then there is + // no need to do compensation. + if (sourceBlackPoint[0] === 0 && + sourceBlackPoint[1] === 0 && + sourceBlackPoint[2] === 0) { + result[0] = XYZ_Flat[0]; + result[1] = XYZ_Flat[1]; + result[2] = XYZ_Flat[2]; + return; + } + + // For the blackPoint calculation details, please see + // http://www.adobe.com/content/dam/Adobe/en/devnet/photoshop/sdk/ + // AdobeBPC.pdf. + // The destination blackPoint is the default blackPoint [0, 0, 0]. + var zeroDecodeL = decodeL(0); + + var X_DST = zeroDecodeL; + var X_SRC = decodeL(sourceBlackPoint[0]); + + var Y_DST = zeroDecodeL; + var Y_SRC = decodeL(sourceBlackPoint[1]); + + var Z_DST = zeroDecodeL; + var Z_SRC = decodeL(sourceBlackPoint[2]); + + var X_Scale = (1 - X_DST) / (1 - X_SRC); + var X_Offset = 1 - X_Scale; + + var Y_Scale = (1 - Y_DST) / (1 - Y_SRC); + var Y_Offset = 1 - Y_Scale; + + var Z_Scale = (1 - Z_DST) / (1 - Z_SRC); + var Z_Offset = 1 - Z_Scale; + + result[0] = XYZ_Flat[0] * X_Scale + X_Offset; + result[1] = XYZ_Flat[1] * Y_Scale + Y_Offset; + result[2] = XYZ_Flat[2] * Z_Scale + Z_Offset; + } + + function normalizeWhitePointToFlat(sourceWhitePoint, XYZ_In, result) { + + // In case the whitePoint is already flat then there is no need to do + // normalization. + if (sourceWhitePoint[0] === 1 && sourceWhitePoint[2] === 1) { + result[0] = XYZ_In[0]; + result[1] = XYZ_In[1]; + result[2] = XYZ_In[2]; + return; + } + + var LMS = result; + matrixProduct(BRADFORD_SCALE_MATRIX, XYZ_In, LMS); + + var LMS_Flat = tempNormalizeMatrix; + convertToFlat(sourceWhitePoint, LMS, LMS_Flat); + + matrixProduct(BRADFORD_SCALE_INVERSE_MATRIX, LMS_Flat, result); + } + + function normalizeWhitePointToD65(sourceWhitePoint, XYZ_In, result) { + + var LMS = result; + matrixProduct(BRADFORD_SCALE_MATRIX, XYZ_In, LMS); + + var LMS_D65 = tempNormalizeMatrix; + convertToD65(sourceWhitePoint, LMS, LMS_D65); + + matrixProduct(BRADFORD_SCALE_INVERSE_MATRIX, LMS_D65, result); + } + + function convertToRgb(cs, src, srcOffset, dest, destOffset, scale) { + // A, B and C represent a red, green and blue components of a calibrated + // rgb space. + var A = adjustToRange(0, 1, src[srcOffset] * scale); + var B = adjustToRange(0, 1, src[srcOffset + 1] * scale); + var C = adjustToRange(0, 1, src[srcOffset + 2] * scale); + + // A <---> AGR in the spec + // B <---> BGG in the spec + // C <---> CGB in the spec + var AGR = Math.pow(A, cs.GR); + var BGG = Math.pow(B, cs.GG); + var CGB = Math.pow(C, cs.GB); + + // Computes intermediate variables L, M, N as per spec. + // To decode X, Y, Z values map L, M, N directly to them. + var X = cs.MXA * AGR + cs.MXB * BGG + cs.MXC * CGB; + var Y = cs.MYA * AGR + cs.MYB * BGG + cs.MYC * CGB; + var Z = cs.MZA * AGR + cs.MZB * BGG + cs.MZC * CGB; + + // The following calculations are based on this document: + // http://www.adobe.com/content/dam/Adobe/en/devnet/photoshop/sdk/ + // AdobeBPC.pdf. + var XYZ = tempConvertMatrix1; + XYZ[0] = X; + XYZ[1] = Y; + XYZ[2] = Z; + var XYZ_Flat = tempConvertMatrix2; + + normalizeWhitePointToFlat(cs.whitePoint, XYZ, XYZ_Flat); + + var XYZ_Black = tempConvertMatrix1; + compensateBlackPoint(cs.blackPoint, XYZ_Flat, XYZ_Black); + + var XYZ_D65 = tempConvertMatrix2; + normalizeWhitePointToD65(FLAT_WHITEPOINT_MATRIX, XYZ_Black, XYZ_D65); + + var SRGB = tempConvertMatrix1; + matrixProduct(SRGB_D65_XYZ_TO_RGB_MATRIX, XYZ_D65, SRGB); + + var sR = sRGBTransferFunction(SRGB[0]); + var sG = sRGBTransferFunction(SRGB[1]); + var sB = sRGBTransferFunction(SRGB[2]); + + // Convert the values to rgb range [0, 255]. + dest[destOffset] = Math.round(sR * 255); + dest[destOffset + 1] = Math.round(sG * 255); + dest[destOffset + 2] = Math.round(sB * 255); + } + + CalRGBCS.prototype = { + getRgb: function CalRGBCS_getRgb(src, srcOffset) { + var rgb = new Uint8Array(3); + this.getRgbItem(src, srcOffset, rgb, 0); + return rgb; + }, + getRgbItem: function CalRGBCS_getRgbItem(src, srcOffset, + dest, destOffset) { + convertToRgb(this, src, srcOffset, dest, destOffset, 1); + }, + getRgbBuffer: function CalRGBCS_getRgbBuffer(src, srcOffset, count, + dest, destOffset, bits, + alpha01) { + var scale = 1 / ((1 << bits) - 1); + + for (var i = 0; i < count; ++i) { + convertToRgb(this, src, srcOffset, dest, destOffset, scale); + srcOffset += 3; + destOffset += 3 + alpha01; + } + }, + getOutputLength: function CalRGBCS_getOutputLength(inputLength, alpha01) { + return (inputLength * (3 + alpha01) / 3) | 0; + }, + isPassthrough: ColorSpace.prototype.isPassthrough, + fillRgb: ColorSpace.prototype.fillRgb, + isDefaultDecode: function CalRGBCS_isDefaultDecode(decodeMap) { + return ColorSpace.isDefaultDecode(decodeMap, this.numComps); + }, + usesZeroToOneRange: true + }; + return CalRGBCS; +})(); + +// +// LabCS: Based on "PDF Reference, Sixth Ed", p.250 +// +var LabCS = (function LabCSClosure() { + function LabCS(whitePoint, blackPoint, range) { + this.name = 'Lab'; + this.numComps = 3; + this.defaultColor = new Float32Array([0, 0, 0]); + + if (!whitePoint) { + error('WhitePoint missing - required for color space Lab'); + } + blackPoint = blackPoint || [0, 0, 0]; + range = range || [-100, 100, -100, 100]; + + // Translate args to spec variables + this.XW = whitePoint[0]; + this.YW = whitePoint[1]; + this.ZW = whitePoint[2]; + this.amin = range[0]; + this.amax = range[1]; + this.bmin = range[2]; + this.bmax = range[3]; + + // These are here just for completeness - the spec doesn't offer any + // formulas that use BlackPoint in Lab + this.XB = blackPoint[0]; + this.YB = blackPoint[1]; + this.ZB = blackPoint[2]; + + // Validate vars as per spec + if (this.XW < 0 || this.ZW < 0 || this.YW !== 1) { + error('Invalid WhitePoint components, no fallback available'); + } + + if (this.XB < 0 || this.YB < 0 || this.ZB < 0) { + info('Invalid BlackPoint, falling back to default'); + this.XB = this.YB = this.ZB = 0; + } + + if (this.amin > this.amax || this.bmin > this.bmax) { + info('Invalid Range, falling back to defaults'); + this.amin = -100; + this.amax = 100; + this.bmin = -100; + this.bmax = 100; + } + } + + // Function g(x) from spec + function fn_g(x) { + if (x >= 6 / 29) { + return x * x * x; + } else { + return (108 / 841) * (x - 4 / 29); + } + } + + function decode(value, high1, low2, high2) { + return low2 + (value) * (high2 - low2) / (high1); + } + + // If decoding is needed maxVal should be 2^bits per component - 1. + function convertToRgb(cs, src, srcOffset, maxVal, dest, destOffset) { + // XXX: Lab input is in the range of [0, 100], [amin, amax], [bmin, bmax] + // not the usual [0, 1]. If a command like setFillColor is used the src + // values will already be within the correct range. However, if we are + // converting an image we have to map the values to the correct range given + // above. + // Ls,as,bs <---> L*,a*,b* in the spec + var Ls = src[srcOffset]; + var as = src[srcOffset + 1]; + var bs = src[srcOffset + 2]; + if (maxVal !== false) { + Ls = decode(Ls, maxVal, 0, 100); + as = decode(as, maxVal, cs.amin, cs.amax); + bs = decode(bs, maxVal, cs.bmin, cs.bmax); + } + + // Adjust limits of 'as' and 'bs' + as = as > cs.amax ? cs.amax : as < cs.amin ? cs.amin : as; + bs = bs > cs.bmax ? cs.bmax : bs < cs.bmin ? cs.bmin : bs; + + // Computes intermediate variables X,Y,Z as per spec + var M = (Ls + 16) / 116; + var L = M + (as / 500); + var N = M - (bs / 200); + + var X = cs.XW * fn_g(L); + var Y = cs.YW * fn_g(M); + var Z = cs.ZW * fn_g(N); + + var r, g, b; + // Using different conversions for D50 and D65 white points, + // per http://www.color.org/srgb.pdf + if (cs.ZW < 1) { + // Assuming D50 (X=0.9642, Y=1.00, Z=0.8249) + r = X * 3.1339 + Y * -1.6170 + Z * -0.4906; + g = X * -0.9785 + Y * 1.9160 + Z * 0.0333; + b = X * 0.0720 + Y * -0.2290 + Z * 1.4057; + } else { + // Assuming D65 (X=0.9505, Y=1.00, Z=1.0888) + r = X * 3.2406 + Y * -1.5372 + Z * -0.4986; + g = X * -0.9689 + Y * 1.8758 + Z * 0.0415; + b = X * 0.0557 + Y * -0.2040 + Z * 1.0570; + } + // clamp color values to [0,1] range then convert to [0,255] range. + dest[destOffset] = r <= 0 ? 0 : r >= 1 ? 255 : Math.sqrt(r) * 255 | 0; + dest[destOffset + 1] = g <= 0 ? 0 : g >= 1 ? 255 : Math.sqrt(g) * 255 | 0; + dest[destOffset + 2] = b <= 0 ? 0 : b >= 1 ? 255 : Math.sqrt(b) * 255 | 0; + } + + LabCS.prototype = { + getRgb: ColorSpace.prototype.getRgb, + getRgbItem: function LabCS_getRgbItem(src, srcOffset, dest, destOffset) { + convertToRgb(this, src, srcOffset, false, dest, destOffset); + }, + getRgbBuffer: function LabCS_getRgbBuffer(src, srcOffset, count, + dest, destOffset, bits, + alpha01) { + var maxVal = (1 << bits) - 1; + for (var i = 0; i < count; i++) { + convertToRgb(this, src, srcOffset, maxVal, dest, destOffset); + srcOffset += 3; + destOffset += 3 + alpha01; + } + }, + getOutputLength: function LabCS_getOutputLength(inputLength, alpha01) { + return (inputLength * (3 + alpha01) / 3) | 0; + }, + isPassthrough: ColorSpace.prototype.isPassthrough, + fillRgb: ColorSpace.prototype.fillRgb, + isDefaultDecode: function LabCS_isDefaultDecode(decodeMap) { + // XXX: Decoding is handled with the lab conversion because of the strange + // ranges that are used. + return true; + }, + usesZeroToOneRange: false + }; + return LabCS; +})(); + + +var ARCFourCipher = (function ARCFourCipherClosure() { + function ARCFourCipher(key) { + this.a = 0; + this.b = 0; + var s = new Uint8Array(256); + var i, j = 0, tmp, keyLength = key.length; + for (i = 0; i < 256; ++i) { + s[i] = i; + } + for (i = 0; i < 256; ++i) { + tmp = s[i]; + j = (j + tmp + key[i % keyLength]) & 0xFF; + s[i] = s[j]; + s[j] = tmp; + } + this.s = s; + } + + ARCFourCipher.prototype = { + encryptBlock: function ARCFourCipher_encryptBlock(data) { + var i, n = data.length, tmp, tmp2; + var a = this.a, b = this.b, s = this.s; + var output = new Uint8Array(n); + for (i = 0; i < n; ++i) { + a = (a + 1) & 0xFF; + tmp = s[a]; + b = (b + tmp) & 0xFF; + tmp2 = s[b]; + s[a] = tmp2; + s[b] = tmp; + output[i] = data[i] ^ s[(tmp + tmp2) & 0xFF]; + } + this.a = a; + this.b = b; + return output; + } + }; + ARCFourCipher.prototype.decryptBlock = ARCFourCipher.prototype.encryptBlock; + + return ARCFourCipher; +})(); + +var calculateMD5 = (function calculateMD5Closure() { + var r = new Uint8Array([ + 7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22, + 5, 9, 14, 20, 5, 9, 14, 20, 5, 9, 14, 20, 5, 9, 14, 20, + 4, 11, 16, 23, 4, 11, 16, 23, 4, 11, 16, 23, 4, 11, 16, 23, + 6, 10, 15, 21, 6, 10, 15, 21, 6, 10, 15, 21, 6, 10, 15, 21]); + + var k = new Int32Array([ + -680876936, -389564586, 606105819, -1044525330, -176418897, 1200080426, + -1473231341, -45705983, 1770035416, -1958414417, -42063, -1990404162, + 1804603682, -40341101, -1502002290, 1236535329, -165796510, -1069501632, + 643717713, -373897302, -701558691, 38016083, -660478335, -405537848, + 568446438, -1019803690, -187363961, 1163531501, -1444681467, -51403784, + 1735328473, -1926607734, -378558, -2022574463, 1839030562, -35309556, + -1530992060, 1272893353, -155497632, -1094730640, 681279174, -358537222, + -722521979, 76029189, -640364487, -421815835, 530742520, -995338651, + -198630844, 1126891415, -1416354905, -57434055, 1700485571, -1894986606, + -1051523, -2054922799, 1873313359, -30611744, -1560198380, 1309151649, + -145523070, -1120210379, 718787259, -343485551]); + + function hash(data, offset, length) { + var h0 = 1732584193, h1 = -271733879, h2 = -1732584194, h3 = 271733878; + // pre-processing + var paddedLength = (length + 72) & ~63; // data + 9 extra bytes + var padded = new Uint8Array(paddedLength); + var i, j, n; + for (i = 0; i < length; ++i) { + padded[i] = data[offset++]; + } + padded[i++] = 0x80; + n = paddedLength - 8; + while (i < n) { + padded[i++] = 0; + } + padded[i++] = (length << 3) & 0xFF; + padded[i++] = (length >> 5) & 0xFF; + padded[i++] = (length >> 13) & 0xFF; + padded[i++] = (length >> 21) & 0xFF; + padded[i++] = (length >>> 29) & 0xFF; + padded[i++] = 0; + padded[i++] = 0; + padded[i++] = 0; + var w = new Int32Array(16); + for (i = 0; i < paddedLength;) { + for (j = 0; j < 16; ++j, i += 4) { + w[j] = (padded[i] | (padded[i + 1] << 8) | + (padded[i + 2] << 16) | (padded[i + 3] << 24)); + } + var a = h0, b = h1, c = h2, d = h3, f, g; + for (j = 0; j < 64; ++j) { + if (j < 16) { + f = (b & c) | ((~b) & d); + g = j; + } else if (j < 32) { + f = (d & b) | ((~d) & c); + g = (5 * j + 1) & 15; + } else if (j < 48) { + f = b ^ c ^ d; + g = (3 * j + 5) & 15; + } else { + f = c ^ (b | (~d)); + g = (7 * j) & 15; + } + var tmp = d, rotateArg = (a + f + k[j] + w[g]) | 0, rotate = r[j]; + d = c; + c = b; + b = (b + ((rotateArg << rotate) | (rotateArg >>> (32 - rotate)))) | 0; + a = tmp; + } + h0 = (h0 + a) | 0; + h1 = (h1 + b) | 0; + h2 = (h2 + c) | 0; + h3 = (h3 + d) | 0; + } + return new Uint8Array([ + h0 & 0xFF, (h0 >> 8) & 0xFF, (h0 >> 16) & 0xFF, (h0 >>> 24) & 0xFF, + h1 & 0xFF, (h1 >> 8) & 0xFF, (h1 >> 16) & 0xFF, (h1 >>> 24) & 0xFF, + h2 & 0xFF, (h2 >> 8) & 0xFF, (h2 >> 16) & 0xFF, (h2 >>> 24) & 0xFF, + h3 & 0xFF, (h3 >> 8) & 0xFF, (h3 >> 16) & 0xFF, (h3 >>> 24) & 0xFF + ]); + } + + return hash; +})(); +var Word64 = (function Word64Closure() { + function Word64(highInteger, lowInteger) { + this.high = highInteger | 0; + this.low = lowInteger | 0; + } + Word64.prototype = { + and: function Word64_and(word) { + this.high &= word.high; + this.low &= word.low; + }, + xor: function Word64_xor(word) { + this.high ^= word.high; + this.low ^= word.low; + }, + + or: function Word64_or(word) { + this.high |= word.high; + this.low |= word.low; + }, + + shiftRight: function Word64_shiftRight(places) { + if (places >= 32) { + this.low = (this.high >>> (places - 32)) | 0; + this.high = 0; + } else { + this.low = (this.low >>> places) | (this.high << (32 - places)); + this.high = (this.high >>> places) | 0; + } + }, + + shiftLeft: function Word64_shiftLeft(places) { + if (places >= 32) { + this.high = this.low << (places - 32); + this.low = 0; + } else { + this.high = (this.high << places) | (this.low >>> (32 - places)); + this.low = this.low << places; + } + }, + + rotateRight: function Word64_rotateRight(places) { + var low, high; + if (places & 32) { + high = this.low; + low = this.high; + } else { + low = this.low; + high = this.high; + } + places &= 31; + this.low = (low >>> places) | (high << (32 - places)); + this.high = (high >>> places) | (low << (32 - places)); + }, + + not: function Word64_not() { + this.high = ~this.high; + this.low = ~this.low; + }, + + add: function Word64_add(word) { + var lowAdd = (this.low >>> 0) + (word.low >>> 0); + var highAdd = (this.high >>> 0) + (word.high >>> 0); + if (lowAdd > 0xFFFFFFFF) { + highAdd += 1; + } + this.low = lowAdd | 0; + this.high = highAdd | 0; + }, + + copyTo: function Word64_copyTo(bytes, offset) { + bytes[offset] = (this.high >>> 24) & 0xFF; + bytes[offset + 1] = (this.high >> 16) & 0xFF; + bytes[offset + 2] = (this.high >> 8) & 0xFF; + bytes[offset + 3] = this.high & 0xFF; + bytes[offset + 4] = (this.low >>> 24) & 0xFF; + bytes[offset + 5] = (this.low >> 16) & 0xFF; + bytes[offset + 6] = (this.low >> 8) & 0xFF; + bytes[offset + 7] = this.low & 0xFF; + }, + + assign: function Word64_assign(word) { + this.high = word.high; + this.low = word.low; + } + }; + return Word64; +})(); + +var calculateSHA256 = (function calculateSHA256Closure() { + function rotr(x, n) { + return (x >>> n) | (x << 32 - n); + } + + function ch(x, y, z) { + return (x & y) ^ (~x & z); + } + + function maj(x, y, z) { + return (x & y) ^ (x & z) ^ (y & z); + } + + function sigma(x) { + return rotr(x, 2) ^ rotr(x, 13) ^ rotr(x, 22); + } + + function sigmaPrime(x) { + return rotr(x, 6) ^ rotr(x, 11) ^ rotr(x, 25); + } + + function littleSigma(x) { + return rotr(x, 7) ^ rotr(x, 18) ^ x >>> 3; + } + + function littleSigmaPrime(x) { + return rotr(x, 17) ^ rotr(x, 19) ^ x >>> 10; + } + + var k = [0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, + 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, + 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, + 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, + 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, + 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, + 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, + 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967, + 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, + 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, + 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, + 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, + 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, + 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3, + 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, + 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2]; + + function hash(data, offset, length) { + // initial hash values + var h0 = 0x6a09e667, h1 = 0xbb67ae85, h2 = 0x3c6ef372, + h3 = 0xa54ff53a, h4 = 0x510e527f, h5 = 0x9b05688c, + h6 = 0x1f83d9ab, h7 = 0x5be0cd19; + // pre-processing + var paddedLength = Math.ceil((length + 9) / 64) * 64; + var padded = new Uint8Array(paddedLength); + var i, j, n; + for (i = 0; i < length; ++i) { + padded[i] = data[offset++]; + } + padded[i++] = 0x80; + n = paddedLength - 8; + while (i < n) { + padded[i++] = 0; + } + padded[i++] = 0; + padded[i++] = 0; + padded[i++] = 0; + padded[i++] = (length >>> 29) & 0xFF; + padded[i++] = (length >> 21) & 0xFF; + padded[i++] = (length >> 13) & 0xFF; + padded[i++] = (length >> 5) & 0xFF; + padded[i++] = (length << 3) & 0xFF; + var w = new Uint32Array(64); + // for each 512 bit block + for (i = 0; i < paddedLength;) { + for (j = 0; j < 16; ++j) { + w[j] = (padded[i] << 24 | (padded[i + 1] << 16) | + (padded[i + 2] << 8) | (padded[i + 3])); + i += 4; + } + + for (j = 16; j < 64; ++j) { + w[j] = littleSigmaPrime(w[j - 2]) + w[j - 7] + + littleSigma(w[j - 15]) + w[j - 16] | 0; + } + var a = h0, b = h1, c = h2, d = h3, e = h4, + f = h5, g = h6, h = h7, t1, t2; + for (j = 0; j < 64; ++j) { + t1 = h + sigmaPrime(e) + ch(e, f, g) + k[j] + w[j]; + t2 = sigma(a) + maj(a, b, c); + h = g; + g = f; + f = e; + e = (d + t1) | 0; + d = c; + c = b; + b = a; + a = (t1 + t2) | 0; + } + h0 = (h0 + a) | 0; + h1 = (h1 + b) | 0; + h2 = (h2 + c) | 0; + h3 = (h3 + d) | 0; + h4 = (h4 + e) | 0; + h5 = (h5 + f) | 0; + h6 = (h6 + g) | 0; + h7 = (h7 + h) | 0; + } + return new Uint8Array([ + (h0 >> 24) & 0xFF, (h0 >> 16) & 0xFF, (h0 >> 8) & 0xFF, (h0) & 0xFF, + (h1 >> 24) & 0xFF, (h1 >> 16) & 0xFF, (h1 >> 8) & 0xFF, (h1) & 0xFF, + (h2 >> 24) & 0xFF, (h2 >> 16) & 0xFF, (h2 >> 8) & 0xFF, (h2) & 0xFF, + (h3 >> 24) & 0xFF, (h3 >> 16) & 0xFF, (h3 >> 8) & 0xFF, (h3) & 0xFF, + (h4 >> 24) & 0xFF, (h4 >> 16) & 0xFF, (h4 >> 8) & 0xFF, (h4) & 0xFF, + (h5 >> 24) & 0xFF, (h5 >> 16) & 0xFF, (h5 >> 8) & 0xFF, (h5) & 0xFF, + (h6 >> 24) & 0xFF, (h6 >> 16) & 0xFF, (h6 >> 8) & 0xFF, (h6) & 0xFF, + (h7 >> 24) & 0xFF, (h7 >> 16) & 0xFF, (h7 >> 8) & 0xFF, (h7) & 0xFF + ]); + } + + return hash; +})(); + +var calculateSHA512 = (function calculateSHA512Closure() { + function ch(result, x, y, z, tmp) { + result.assign(x); + result.and(y); + tmp.assign(x); + tmp.not(); + tmp.and(z); + result.xor(tmp); + } + + function maj(result, x, y, z, tmp) { + result.assign(x); + result.and(y); + tmp.assign(x); + tmp.and(z); + result.xor(tmp); + tmp.assign(y); + tmp.and(z); + result.xor(tmp); + } + + function sigma(result, x, tmp) { + result.assign(x); + result.rotateRight(28); + tmp.assign(x); + tmp.rotateRight(34); + result.xor(tmp); + tmp.assign(x); + tmp.rotateRight(39); + result.xor(tmp); + } + + function sigmaPrime(result, x, tmp) { + result.assign(x); + result.rotateRight(14); + tmp.assign(x); + tmp.rotateRight(18); + result.xor(tmp); + tmp.assign(x); + tmp.rotateRight(41); + result.xor(tmp); + } + + function littleSigma(result, x, tmp) { + result.assign(x); + result.rotateRight(1); + tmp.assign(x); + tmp.rotateRight(8); + result.xor(tmp); + tmp.assign(x); + tmp.shiftRight(7); + result.xor(tmp); + } + + function littleSigmaPrime(result, x, tmp) { + result.assign(x); + result.rotateRight(19); + tmp.assign(x); + tmp.rotateRight(61); + result.xor(tmp); + tmp.assign(x); + tmp.shiftRight(6); + result.xor(tmp); + } + + var k = [ + new Word64(0x428a2f98, 0xd728ae22), new Word64(0x71374491, 0x23ef65cd), + new Word64(0xb5c0fbcf, 0xec4d3b2f), new Word64(0xe9b5dba5, 0x8189dbbc), + new Word64(0x3956c25b, 0xf348b538), new Word64(0x59f111f1, 0xb605d019), + new Word64(0x923f82a4, 0xaf194f9b), new Word64(0xab1c5ed5, 0xda6d8118), + new Word64(0xd807aa98, 0xa3030242), new Word64(0x12835b01, 0x45706fbe), + new Word64(0x243185be, 0x4ee4b28c), new Word64(0x550c7dc3, 0xd5ffb4e2), + new Word64(0x72be5d74, 0xf27b896f), new Word64(0x80deb1fe, 0x3b1696b1), + new Word64(0x9bdc06a7, 0x25c71235), new Word64(0xc19bf174, 0xcf692694), + new Word64(0xe49b69c1, 0x9ef14ad2), new Word64(0xefbe4786, 0x384f25e3), + new Word64(0x0fc19dc6, 0x8b8cd5b5), new Word64(0x240ca1cc, 0x77ac9c65), + new Word64(0x2de92c6f, 0x592b0275), new Word64(0x4a7484aa, 0x6ea6e483), + new Word64(0x5cb0a9dc, 0xbd41fbd4), new Word64(0x76f988da, 0x831153b5), + new Word64(0x983e5152, 0xee66dfab), new Word64(0xa831c66d, 0x2db43210), + new Word64(0xb00327c8, 0x98fb213f), new Word64(0xbf597fc7, 0xbeef0ee4), + new Word64(0xc6e00bf3, 0x3da88fc2), new Word64(0xd5a79147, 0x930aa725), + new Word64(0x06ca6351, 0xe003826f), new Word64(0x14292967, 0x0a0e6e70), + new Word64(0x27b70a85, 0x46d22ffc), new Word64(0x2e1b2138, 0x5c26c926), + new Word64(0x4d2c6dfc, 0x5ac42aed), new Word64(0x53380d13, 0x9d95b3df), + new Word64(0x650a7354, 0x8baf63de), new Word64(0x766a0abb, 0x3c77b2a8), + new Word64(0x81c2c92e, 0x47edaee6), new Word64(0x92722c85, 0x1482353b), + new Word64(0xa2bfe8a1, 0x4cf10364), new Word64(0xa81a664b, 0xbc423001), + new Word64(0xc24b8b70, 0xd0f89791), new Word64(0xc76c51a3, 0x0654be30), + new Word64(0xd192e819, 0xd6ef5218), new Word64(0xd6990624, 0x5565a910), + new Word64(0xf40e3585, 0x5771202a), new Word64(0x106aa070, 0x32bbd1b8), + new Word64(0x19a4c116, 0xb8d2d0c8), new Word64(0x1e376c08, 0x5141ab53), + new Word64(0x2748774c, 0xdf8eeb99), new Word64(0x34b0bcb5, 0xe19b48a8), + new Word64(0x391c0cb3, 0xc5c95a63), new Word64(0x4ed8aa4a, 0xe3418acb), + new Word64(0x5b9cca4f, 0x7763e373), new Word64(0x682e6ff3, 0xd6b2b8a3), + new Word64(0x748f82ee, 0x5defb2fc), new Word64(0x78a5636f, 0x43172f60), + new Word64(0x84c87814, 0xa1f0ab72), new Word64(0x8cc70208, 0x1a6439ec), + new Word64(0x90befffa, 0x23631e28), new Word64(0xa4506ceb, 0xde82bde9), + new Word64(0xbef9a3f7, 0xb2c67915), new Word64(0xc67178f2, 0xe372532b), + new Word64(0xca273ece, 0xea26619c), new Word64(0xd186b8c7, 0x21c0c207), + new Word64(0xeada7dd6, 0xcde0eb1e), new Word64(0xf57d4f7f, 0xee6ed178), + new Word64(0x06f067aa, 0x72176fba), new Word64(0x0a637dc5, 0xa2c898a6), + new Word64(0x113f9804, 0xbef90dae), new Word64(0x1b710b35, 0x131c471b), + new Word64(0x28db77f5, 0x23047d84), new Word64(0x32caab7b, 0x40c72493), + new Word64(0x3c9ebe0a, 0x15c9bebc), new Word64(0x431d67c4, 0x9c100d4c), + new Word64(0x4cc5d4be, 0xcb3e42b6), new Word64(0x597f299c, 0xfc657e2a), + new Word64(0x5fcb6fab, 0x3ad6faec), new Word64(0x6c44198c, 0x4a475817)]; + + function hash(data, offset, length, mode384) { + mode384 = !!mode384; + // initial hash values + var h0, h1, h2, h3, h4, h5, h6, h7; + if (!mode384) { + h0 = new Word64(0x6a09e667, 0xf3bcc908); + h1 = new Word64(0xbb67ae85, 0x84caa73b); + h2 = new Word64(0x3c6ef372, 0xfe94f82b); + h3 = new Word64(0xa54ff53a, 0x5f1d36f1); + h4 = new Word64(0x510e527f, 0xade682d1); + h5 = new Word64(0x9b05688c, 0x2b3e6c1f); + h6 = new Word64(0x1f83d9ab, 0xfb41bd6b); + h7 = new Word64(0x5be0cd19, 0x137e2179); + } + else { + // SHA384 is exactly the same + // except with different starting values and a trimmed result + h0 = new Word64(0xcbbb9d5d, 0xc1059ed8); + h1 = new Word64(0x629a292a, 0x367cd507); + h2 = new Word64(0x9159015a, 0x3070dd17); + h3 = new Word64(0x152fecd8, 0xf70e5939); + h4 = new Word64(0x67332667, 0xffc00b31); + h5 = new Word64(0x8eb44a87, 0x68581511); + h6 = new Word64(0xdb0c2e0d, 0x64f98fa7); + h7 = new Word64(0x47b5481d, 0xbefa4fa4); + } + + // pre-processing + var paddedLength = Math.ceil((length + 17) / 128) * 128; + var padded = new Uint8Array(paddedLength); + var i, j, n; + for (i = 0; i < length; ++i) { + padded[i] = data[offset++]; + } + padded[i++] = 0x80; + n = paddedLength - 16; + while (i < n) { + padded[i++] = 0; + } + padded[i++] = 0; + padded[i++] = 0; + padded[i++] = 0; + padded[i++] = 0; + padded[i++] = 0; + padded[i++] = 0; + padded[i++] = 0; + padded[i++] = 0; + padded[i++] = 0; + padded[i++] = 0; + padded[i++] = 0; + padded[i++] = (length >>> 29) & 0xFF; + padded[i++] = (length >> 21) & 0xFF; + padded[i++] = (length >> 13) & 0xFF; + padded[i++] = (length >> 5) & 0xFF; + padded[i++] = (length << 3) & 0xFF; + + var w = new Array(80); + for (i = 0; i < 80; i++) { + w[i] = new Word64(0, 0); + } + var a = new Word64(0, 0), b = new Word64(0, 0), c = new Word64(0, 0); + var d = new Word64(0, 0), e = new Word64(0, 0), f = new Word64(0, 0); + var g = new Word64(0, 0), h = new Word64(0, 0); + var t1 = new Word64(0, 0), t2 = new Word64(0, 0); + var tmp1 = new Word64(0, 0), tmp2 = new Word64(0, 0), tmp3; + + // for each 1024 bit block + for (i = 0; i < paddedLength;) { + for (j = 0; j < 16; ++j) { + w[j].high = (padded[i] << 24) | (padded[i + 1] << 16) | + (padded[i + 2] << 8) | (padded[i + 3]); + w[j].low = (padded[i + 4]) << 24 | (padded[i + 5]) << 16 | + (padded[i + 6]) << 8 | (padded[i + 7]); + i += 8; + } + for (j = 16; j < 80; ++j) { + tmp3 = w[j]; + littleSigmaPrime(tmp3, w[j - 2], tmp2); + tmp3.add(w[j - 7]); + littleSigma(tmp1, w[j - 15], tmp2); + tmp3.add(tmp1); + tmp3.add(w[j - 16]); + } + + a.assign(h0); b.assign(h1); c.assign(h2); d.assign(h3); + e.assign(h4); f.assign(h5); g.assign(h6); h.assign(h7); + for (j = 0; j < 80; ++j) { + t1.assign(h); + sigmaPrime(tmp1, e, tmp2); + t1.add(tmp1); + ch(tmp1, e, f, g, tmp2); + t1.add(tmp1); + t1.add(k[j]); + t1.add(w[j]); + + sigma(t2, a, tmp2); + maj(tmp1, a, b, c, tmp2); + t2.add(tmp1); + + tmp3 = h; + h = g; + g = f; + f = e; + d.add(t1); + e = d; + d = c; + c = b; + b = a; + tmp3.assign(t1); + tmp3.add(t2); + a = tmp3; + } + h0.add(a); + h1.add(b); + h2.add(c); + h3.add(d); + h4.add(e); + h5.add(f); + h6.add(g); + h7.add(h); + } + + var result; + if (!mode384) { + result = new Uint8Array(64); + h0.copyTo(result,0); + h1.copyTo(result,8); + h2.copyTo(result,16); + h3.copyTo(result,24); + h4.copyTo(result,32); + h5.copyTo(result,40); + h6.copyTo(result,48); + h7.copyTo(result,56); + } + else { + result = new Uint8Array(48); + h0.copyTo(result,0); + h1.copyTo(result,8); + h2.copyTo(result,16); + h3.copyTo(result,24); + h4.copyTo(result,32); + h5.copyTo(result,40); + } + return result; + } + + return hash; +})(); +var calculateSHA384 = (function calculateSHA384Closure() { + function hash(data, offset, length) { + return calculateSHA512(data, offset, length, true); + } + + return hash; +})(); +var NullCipher = (function NullCipherClosure() { + function NullCipher() { + } + + NullCipher.prototype = { + decryptBlock: function NullCipher_decryptBlock(data) { + return data; + } + }; + + return NullCipher; +})(); + +var AES128Cipher = (function AES128CipherClosure() { + var rcon = new Uint8Array([ + 0x8d, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, + 0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, + 0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5, 0x91, 0x39, 0x72, 0xe4, 0xd3, 0xbd, + 0x61, 0xc2, 0x9f, 0x25, 0x4a, 0x94, 0x33, 0x66, 0xcc, 0x83, 0x1d, 0x3a, + 0x74, 0xe8, 0xcb, 0x8d, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, + 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, + 0x97, 0x35, 0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5, 0x91, 0x39, 0x72, + 0xe4, 0xd3, 0xbd, 0x61, 0xc2, 0x9f, 0x25, 0x4a, 0x94, 0x33, 0x66, 0xcc, + 0x83, 0x1d, 0x3a, 0x74, 0xe8, 0xcb, 0x8d, 0x01, 0x02, 0x04, 0x08, 0x10, + 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e, + 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5, + 0x91, 0x39, 0x72, 0xe4, 0xd3, 0xbd, 0x61, 0xc2, 0x9f, 0x25, 0x4a, 0x94, + 0x33, 0x66, 0xcc, 0x83, 0x1d, 0x3a, 0x74, 0xe8, 0xcb, 0x8d, 0x01, 0x02, + 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d, + 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3, 0x7d, + 0xfa, 0xef, 0xc5, 0x91, 0x39, 0x72, 0xe4, 0xd3, 0xbd, 0x61, 0xc2, 0x9f, + 0x25, 0x4a, 0x94, 0x33, 0x66, 0xcc, 0x83, 0x1d, 0x3a, 0x74, 0xe8, 0xcb, + 0x8d, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, + 0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, + 0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5, 0x91, 0x39, 0x72, 0xe4, 0xd3, 0xbd, + 0x61, 0xc2, 0x9f, 0x25, 0x4a, 0x94, 0x33, 0x66, 0xcc, 0x83, 0x1d, 0x3a, + 0x74, 0xe8, 0xcb, 0x8d]); + + var s = new Uint8Array([ + 0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, 0x30, 0x01, 0x67, 0x2b, + 0xfe, 0xd7, 0xab, 0x76, 0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0, + 0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0, 0xb7, 0xfd, 0x93, 0x26, + 0x36, 0x3f, 0xf7, 0xcc, 0x34, 0xa5, 0xe5, 0xf1, 0x71, 0xd8, 0x31, 0x15, + 0x04, 0xc7, 0x23, 0xc3, 0x18, 0x96, 0x05, 0x9a, 0x07, 0x12, 0x80, 0xe2, + 0xeb, 0x27, 0xb2, 0x75, 0x09, 0x83, 0x2c, 0x1a, 0x1b, 0x6e, 0x5a, 0xa0, + 0x52, 0x3b, 0xd6, 0xb3, 0x29, 0xe3, 0x2f, 0x84, 0x53, 0xd1, 0x00, 0xed, + 0x20, 0xfc, 0xb1, 0x5b, 0x6a, 0xcb, 0xbe, 0x39, 0x4a, 0x4c, 0x58, 0xcf, + 0xd0, 0xef, 0xaa, 0xfb, 0x43, 0x4d, 0x33, 0x85, 0x45, 0xf9, 0x02, 0x7f, + 0x50, 0x3c, 0x9f, 0xa8, 0x51, 0xa3, 0x40, 0x8f, 0x92, 0x9d, 0x38, 0xf5, + 0xbc, 0xb6, 0xda, 0x21, 0x10, 0xff, 0xf3, 0xd2, 0xcd, 0x0c, 0x13, 0xec, + 0x5f, 0x97, 0x44, 0x17, 0xc4, 0xa7, 0x7e, 0x3d, 0x64, 0x5d, 0x19, 0x73, + 0x60, 0x81, 0x4f, 0xdc, 0x22, 0x2a, 0x90, 0x88, 0x46, 0xee, 0xb8, 0x14, + 0xde, 0x5e, 0x0b, 0xdb, 0xe0, 0x32, 0x3a, 0x0a, 0x49, 0x06, 0x24, 0x5c, + 0xc2, 0xd3, 0xac, 0x62, 0x91, 0x95, 0xe4, 0x79, 0xe7, 0xc8, 0x37, 0x6d, + 0x8d, 0xd5, 0x4e, 0xa9, 0x6c, 0x56, 0xf4, 0xea, 0x65, 0x7a, 0xae, 0x08, + 0xba, 0x78, 0x25, 0x2e, 0x1c, 0xa6, 0xb4, 0xc6, 0xe8, 0xdd, 0x74, 0x1f, + 0x4b, 0xbd, 0x8b, 0x8a, 0x70, 0x3e, 0xb5, 0x66, 0x48, 0x03, 0xf6, 0x0e, + 0x61, 0x35, 0x57, 0xb9, 0x86, 0xc1, 0x1d, 0x9e, 0xe1, 0xf8, 0x98, 0x11, + 0x69, 0xd9, 0x8e, 0x94, 0x9b, 0x1e, 0x87, 0xe9, 0xce, 0x55, 0x28, 0xdf, + 0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68, 0x41, 0x99, 0x2d, 0x0f, + 0xb0, 0x54, 0xbb, 0x16]); + + var inv_s = new Uint8Array([ + 0x52, 0x09, 0x6a, 0xd5, 0x30, 0x36, 0xa5, 0x38, 0xbf, 0x40, 0xa3, 0x9e, + 0x81, 0xf3, 0xd7, 0xfb, 0x7c, 0xe3, 0x39, 0x82, 0x9b, 0x2f, 0xff, 0x87, + 0x34, 0x8e, 0x43, 0x44, 0xc4, 0xde, 0xe9, 0xcb, 0x54, 0x7b, 0x94, 0x32, + 0xa6, 0xc2, 0x23, 0x3d, 0xee, 0x4c, 0x95, 0x0b, 0x42, 0xfa, 0xc3, 0x4e, + 0x08, 0x2e, 0xa1, 0x66, 0x28, 0xd9, 0x24, 0xb2, 0x76, 0x5b, 0xa2, 0x49, + 0x6d, 0x8b, 0xd1, 0x25, 0x72, 0xf8, 0xf6, 0x64, 0x86, 0x68, 0x98, 0x16, + 0xd4, 0xa4, 0x5c, 0xcc, 0x5d, 0x65, 0xb6, 0x92, 0x6c, 0x70, 0x48, 0x50, + 0xfd, 0xed, 0xb9, 0xda, 0x5e, 0x15, 0x46, 0x57, 0xa7, 0x8d, 0x9d, 0x84, + 0x90, 0xd8, 0xab, 0x00, 0x8c, 0xbc, 0xd3, 0x0a, 0xf7, 0xe4, 0x58, 0x05, + 0xb8, 0xb3, 0x45, 0x06, 0xd0, 0x2c, 0x1e, 0x8f, 0xca, 0x3f, 0x0f, 0x02, + 0xc1, 0xaf, 0xbd, 0x03, 0x01, 0x13, 0x8a, 0x6b, 0x3a, 0x91, 0x11, 0x41, + 0x4f, 0x67, 0xdc, 0xea, 0x97, 0xf2, 0xcf, 0xce, 0xf0, 0xb4, 0xe6, 0x73, + 0x96, 0xac, 0x74, 0x22, 0xe7, 0xad, 0x35, 0x85, 0xe2, 0xf9, 0x37, 0xe8, + 0x1c, 0x75, 0xdf, 0x6e, 0x47, 0xf1, 0x1a, 0x71, 0x1d, 0x29, 0xc5, 0x89, + 0x6f, 0xb7, 0x62, 0x0e, 0xaa, 0x18, 0xbe, 0x1b, 0xfc, 0x56, 0x3e, 0x4b, + 0xc6, 0xd2, 0x79, 0x20, 0x9a, 0xdb, 0xc0, 0xfe, 0x78, 0xcd, 0x5a, 0xf4, + 0x1f, 0xdd, 0xa8, 0x33, 0x88, 0x07, 0xc7, 0x31, 0xb1, 0x12, 0x10, 0x59, + 0x27, 0x80, 0xec, 0x5f, 0x60, 0x51, 0x7f, 0xa9, 0x19, 0xb5, 0x4a, 0x0d, + 0x2d, 0xe5, 0x7a, 0x9f, 0x93, 0xc9, 0x9c, 0xef, 0xa0, 0xe0, 0x3b, 0x4d, + 0xae, 0x2a, 0xf5, 0xb0, 0xc8, 0xeb, 0xbb, 0x3c, 0x83, 0x53, 0x99, 0x61, + 0x17, 0x2b, 0x04, 0x7e, 0xba, 0x77, 0xd6, 0x26, 0xe1, 0x69, 0x14, 0x63, + 0x55, 0x21, 0x0c, 0x7d]); + var mixCol = new Uint8Array(256); + for (var i = 0; i < 256; i++) { + if (i < 128) { + mixCol[i] = i << 1; + } else { + mixCol[i] = (i << 1) ^ 0x1b; + } + } + var mix = new Uint32Array([ + 0x00000000, 0x0e090d0b, 0x1c121a16, 0x121b171d, 0x3824342c, 0x362d3927, + 0x24362e3a, 0x2a3f2331, 0x70486858, 0x7e416553, 0x6c5a724e, 0x62537f45, + 0x486c5c74, 0x4665517f, 0x547e4662, 0x5a774b69, 0xe090d0b0, 0xee99ddbb, + 0xfc82caa6, 0xf28bc7ad, 0xd8b4e49c, 0xd6bde997, 0xc4a6fe8a, 0xcaaff381, + 0x90d8b8e8, 0x9ed1b5e3, 0x8ccaa2fe, 0x82c3aff5, 0xa8fc8cc4, 0xa6f581cf, + 0xb4ee96d2, 0xbae79bd9, 0xdb3bbb7b, 0xd532b670, 0xc729a16d, 0xc920ac66, + 0xe31f8f57, 0xed16825c, 0xff0d9541, 0xf104984a, 0xab73d323, 0xa57ade28, + 0xb761c935, 0xb968c43e, 0x9357e70f, 0x9d5eea04, 0x8f45fd19, 0x814cf012, + 0x3bab6bcb, 0x35a266c0, 0x27b971dd, 0x29b07cd6, 0x038f5fe7, 0x0d8652ec, + 0x1f9d45f1, 0x119448fa, 0x4be30393, 0x45ea0e98, 0x57f11985, 0x59f8148e, + 0x73c737bf, 0x7dce3ab4, 0x6fd52da9, 0x61dc20a2, 0xad766df6, 0xa37f60fd, + 0xb16477e0, 0xbf6d7aeb, 0x955259da, 0x9b5b54d1, 0x894043cc, 0x87494ec7, + 0xdd3e05ae, 0xd33708a5, 0xc12c1fb8, 0xcf2512b3, 0xe51a3182, 0xeb133c89, + 0xf9082b94, 0xf701269f, 0x4de6bd46, 0x43efb04d, 0x51f4a750, 0x5ffdaa5b, + 0x75c2896a, 0x7bcb8461, 0x69d0937c, 0x67d99e77, 0x3daed51e, 0x33a7d815, + 0x21bccf08, 0x2fb5c203, 0x058ae132, 0x0b83ec39, 0x1998fb24, 0x1791f62f, + 0x764dd68d, 0x7844db86, 0x6a5fcc9b, 0x6456c190, 0x4e69e2a1, 0x4060efaa, + 0x527bf8b7, 0x5c72f5bc, 0x0605bed5, 0x080cb3de, 0x1a17a4c3, 0x141ea9c8, + 0x3e218af9, 0x302887f2, 0x223390ef, 0x2c3a9de4, 0x96dd063d, 0x98d40b36, + 0x8acf1c2b, 0x84c61120, 0xaef93211, 0xa0f03f1a, 0xb2eb2807, 0xbce2250c, + 0xe6956e65, 0xe89c636e, 0xfa877473, 0xf48e7978, 0xdeb15a49, 0xd0b85742, + 0xc2a3405f, 0xccaa4d54, 0x41ecdaf7, 0x4fe5d7fc, 0x5dfec0e1, 0x53f7cdea, + 0x79c8eedb, 0x77c1e3d0, 0x65daf4cd, 0x6bd3f9c6, 0x31a4b2af, 0x3fadbfa4, + 0x2db6a8b9, 0x23bfa5b2, 0x09808683, 0x07898b88, 0x15929c95, 0x1b9b919e, + 0xa17c0a47, 0xaf75074c, 0xbd6e1051, 0xb3671d5a, 0x99583e6b, 0x97513360, + 0x854a247d, 0x8b432976, 0xd134621f, 0xdf3d6f14, 0xcd267809, 0xc32f7502, + 0xe9105633, 0xe7195b38, 0xf5024c25, 0xfb0b412e, 0x9ad7618c, 0x94de6c87, + 0x86c57b9a, 0x88cc7691, 0xa2f355a0, 0xacfa58ab, 0xbee14fb6, 0xb0e842bd, + 0xea9f09d4, 0xe49604df, 0xf68d13c2, 0xf8841ec9, 0xd2bb3df8, 0xdcb230f3, + 0xcea927ee, 0xc0a02ae5, 0x7a47b13c, 0x744ebc37, 0x6655ab2a, 0x685ca621, + 0x42638510, 0x4c6a881b, 0x5e719f06, 0x5078920d, 0x0a0fd964, 0x0406d46f, + 0x161dc372, 0x1814ce79, 0x322bed48, 0x3c22e043, 0x2e39f75e, 0x2030fa55, + 0xec9ab701, 0xe293ba0a, 0xf088ad17, 0xfe81a01c, 0xd4be832d, 0xdab78e26, + 0xc8ac993b, 0xc6a59430, 0x9cd2df59, 0x92dbd252, 0x80c0c54f, 0x8ec9c844, + 0xa4f6eb75, 0xaaffe67e, 0xb8e4f163, 0xb6edfc68, 0x0c0a67b1, 0x02036aba, + 0x10187da7, 0x1e1170ac, 0x342e539d, 0x3a275e96, 0x283c498b, 0x26354480, + 0x7c420fe9, 0x724b02e2, 0x605015ff, 0x6e5918f4, 0x44663bc5, 0x4a6f36ce, + 0x587421d3, 0x567d2cd8, 0x37a10c7a, 0x39a80171, 0x2bb3166c, 0x25ba1b67, + 0x0f853856, 0x018c355d, 0x13972240, 0x1d9e2f4b, 0x47e96422, 0x49e06929, + 0x5bfb7e34, 0x55f2733f, 0x7fcd500e, 0x71c45d05, 0x63df4a18, 0x6dd64713, + 0xd731dcca, 0xd938d1c1, 0xcb23c6dc, 0xc52acbd7, 0xef15e8e6, 0xe11ce5ed, + 0xf307f2f0, 0xfd0efffb, 0xa779b492, 0xa970b999, 0xbb6bae84, 0xb562a38f, + 0x9f5d80be, 0x91548db5, 0x834f9aa8, 0x8d4697a3]); + + function expandKey128(cipherKey) { + var b = 176, result = new Uint8Array(b); + result.set(cipherKey); + for (var j = 16, i = 1; j < b; ++i) { + // RotWord + var t1 = result[j - 3], t2 = result[j - 2], + t3 = result[j - 1], t4 = result[j - 4]; + // SubWord + t1 = s[t1]; + t2 = s[t2]; + t3 = s[t3]; + t4 = s[t4]; + // Rcon + t1 = t1 ^ rcon[i]; + for (var n = 0; n < 4; ++n) { + result[j] = (t1 ^= result[j - 16]); + j++; + result[j] = (t2 ^= result[j - 16]); + j++; + result[j] = (t3 ^= result[j - 16]); + j++; + result[j] = (t4 ^= result[j - 16]); + j++; + } + } + return result; + } + + function decrypt128(input, key) { + var state = new Uint8Array(16); + state.set(input); + var i, j, k; + var t, u, v; + // AddRoundKey + for (j = 0, k = 160; j < 16; ++j, ++k) { + state[j] ^= key[k]; + } + for (i = 9; i >= 1; --i) { + // InvShiftRows + t = state[13]; + state[13] = state[9]; + state[9] = state[5]; + state[5] = state[1]; + state[1] = t; + t = state[14]; + u = state[10]; + state[14] = state[6]; + state[10] = state[2]; + state[6] = t; + state[2] = u; + t = state[15]; + u = state[11]; + v = state[7]; + state[15] = state[3]; + state[11] = t; + state[7] = u; + state[3] = v; + // InvSubBytes + for (j = 0; j < 16; ++j) { + state[j] = inv_s[state[j]]; + } + // AddRoundKey + for (j = 0, k = i * 16; j < 16; ++j, ++k) { + state[j] ^= key[k]; + } + // InvMixColumns + for (j = 0; j < 16; j += 4) { + var s0 = mix[state[j]], s1 = mix[state[j + 1]], + s2 = mix[state[j + 2]], s3 = mix[state[j + 3]]; + t = (s0 ^ (s1 >>> 8) ^ (s1 << 24) ^ (s2 >>> 16) ^ (s2 << 16) ^ + (s3 >>> 24) ^ (s3 << 8)); + state[j] = (t >>> 24) & 0xFF; + state[j + 1] = (t >> 16) & 0xFF; + state[j + 2] = (t >> 8) & 0xFF; + state[j + 3] = t & 0xFF; + } + } + // InvShiftRows + t = state[13]; + state[13] = state[9]; + state[9] = state[5]; + state[5] = state[1]; + state[1] = t; + t = state[14]; + u = state[10]; + state[14] = state[6]; + state[10] = state[2]; + state[6] = t; + state[2] = u; + t = state[15]; + u = state[11]; + v = state[7]; + state[15] = state[3]; + state[11] = t; + state[7] = u; + state[3] = v; + for (j = 0; j < 16; ++j) { + // InvSubBytes + state[j] = inv_s[state[j]]; + // AddRoundKey + state[j] ^= key[j]; + } + return state; + } + + function encrypt128(input, key) { + var t, u, v, k; + var state = new Uint8Array(16); + state.set(input); + for (j = 0; j < 16; ++j) { + // AddRoundKey + state[j] ^= key[j]; + } + + for (i = 1; i < 10; i++) { + //SubBytes + for (j = 0; j < 16; ++j) { + state[j] = s[state[j]]; + } + //ShiftRows + v = state[1]; + state[1] = state[5]; + state[5] = state[9]; + state[9] = state[13]; + state[13] = v; + v = state[2]; + u = state[6]; + state[2] = state[10]; + state[6] = state[14]; + state[10] = v; + state[14] = u; + v = state[3]; + u = state[7]; + t = state[11]; + state[3] = state[15]; + state[7] = v; + state[11] = u; + state[15] = t; + //MixColumns + for (var j = 0; j < 16; j += 4) { + var s0 = state[j + 0], s1 = state[j + 1]; + var s2 = state[j + 2], s3 = state[j + 3]; + t = s0 ^ s1 ^ s2 ^ s3; + state[j + 0] ^= t ^ mixCol[s0 ^ s1]; + state[j + 1] ^= t ^ mixCol[s1 ^ s2]; + state[j + 2] ^= t ^ mixCol[s2 ^ s3]; + state[j + 3] ^= t ^ mixCol[s3 ^ s0]; + } + //AddRoundKey + for (j = 0, k = i * 16; j < 16; ++j, ++k) { + state[j] ^= key[k]; + } + } + + //SubBytes + for (j = 0; j < 16; ++j) { + state[j] = s[state[j]]; + } + //ShiftRows + v = state[1]; + state[1] = state[5]; + state[5] = state[9]; + state[9] = state[13]; + state[13] = v; + v = state[2]; + u = state[6]; + state[2] = state[10]; + state[6] = state[14]; + state[10] = v; + state[14] = u; + v = state[3]; + u = state[7]; + t = state[11]; + state[3] = state[15]; + state[7] = v; + state[11] = u; + state[15] = t; + //AddRoundKey + for (j = 0, k = 160; j < 16; ++j, ++k) { + state[j] ^= key[k]; + } + return state; + } + + function AES128Cipher(key) { + this.key = expandKey128(key); + this.buffer = new Uint8Array(16); + this.bufferPosition = 0; + } + + function decryptBlock2(data, finalize) { + var i, j, ii, sourceLength = data.length, + buffer = this.buffer, bufferLength = this.bufferPosition, + result = [], iv = this.iv; + for (i = 0; i < sourceLength; ++i) { + buffer[bufferLength] = data[i]; + ++bufferLength; + if (bufferLength < 16) { + continue; + } + // buffer is full, decrypting + var plain = decrypt128(buffer, this.key); + // xor-ing the IV vector to get plain text + for (j = 0; j < 16; ++j) { + plain[j] ^= iv[j]; + } + iv = buffer; + result.push(plain); + buffer = new Uint8Array(16); + bufferLength = 0; + } + // saving incomplete buffer + this.buffer = buffer; + this.bufferLength = bufferLength; + this.iv = iv; + if (result.length === 0) { + return new Uint8Array([]); + } + // combining plain text blocks into one + var outputLength = 16 * result.length; + if (finalize) { + // undo a padding that is described in RFC 2898 + var lastBlock = result[result.length - 1]; + var psLen = lastBlock[15]; + if (psLen <= 16) { + for (i = 15, ii = 16 - psLen; i >= ii; --i) { + if (lastBlock[i] !== psLen) { + // Invalid padding, assume that the block has no padding. + psLen = 0; + break; + } + } + outputLength -= psLen; + result[result.length - 1] = lastBlock.subarray(0, 16 - psLen); + } + } + var output = new Uint8Array(outputLength); + for (i = 0, j = 0, ii = result.length; i < ii; ++i, j += 16) { + output.set(result[i], j); + } + return output; + } + + AES128Cipher.prototype = { + decryptBlock: function AES128Cipher_decryptBlock(data, finalize) { + var i, sourceLength = data.length; + var buffer = this.buffer, bufferLength = this.bufferPosition; + // waiting for IV values -- they are at the start of the stream + for (i = 0; bufferLength < 16 && i < sourceLength; ++i, ++bufferLength) { + buffer[bufferLength] = data[i]; + } + if (bufferLength < 16) { + // need more data + this.bufferLength = bufferLength; + return new Uint8Array([]); + } + this.iv = buffer; + this.buffer = new Uint8Array(16); + this.bufferLength = 0; + // starting decryption + this.decryptBlock = decryptBlock2; + return this.decryptBlock(data.subarray(16), finalize); + }, + encrypt: function AES128Cipher_encrypt(data, iv) { + var i, j, ii, sourceLength = data.length, + buffer = this.buffer, bufferLength = this.bufferPosition, + result = []; + if (!iv) { + iv = new Uint8Array(16); + } + for (i = 0; i < sourceLength; ++i) { + buffer[bufferLength] = data[i]; + ++bufferLength; + if (bufferLength < 16) { + continue; + } + for (j = 0; j < 16; ++j) { + buffer[j] ^= iv[j]; + } + + // buffer is full, encrypting + var cipher = encrypt128(buffer, this.key); + iv = cipher; + result.push(cipher); + buffer = new Uint8Array(16); + bufferLength = 0; + } + // saving incomplete buffer + this.buffer = buffer; + this.bufferLength = bufferLength; + this.iv = iv; + if (result.length === 0) { + return new Uint8Array([]); + } + // combining plain text blocks into one + var outputLength = 16 * result.length; + var output = new Uint8Array(outputLength); + for (i = 0, j = 0, ii = result.length; i < ii; ++i, j += 16) { + output.set(result[i], j); + } + return output; + } + }; + + return AES128Cipher; +})(); + +var AES256Cipher = (function AES256CipherClosure() { + var rcon = new Uint8Array([ + 0x8d, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, + 0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, + 0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5, 0x91, 0x39, 0x72, 0xe4, 0xd3, 0xbd, + 0x61, 0xc2, 0x9f, 0x25, 0x4a, 0x94, 0x33, 0x66, 0xcc, 0x83, 0x1d, 0x3a, + 0x74, 0xe8, 0xcb, 0x8d, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, + 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, + 0x97, 0x35, 0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5, 0x91, 0x39, 0x72, + 0xe4, 0xd3, 0xbd, 0x61, 0xc2, 0x9f, 0x25, 0x4a, 0x94, 0x33, 0x66, 0xcc, + 0x83, 0x1d, 0x3a, 0x74, 0xe8, 0xcb, 0x8d, 0x01, 0x02, 0x04, 0x08, 0x10, + 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e, + 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5, + 0x91, 0x39, 0x72, 0xe4, 0xd3, 0xbd, 0x61, 0xc2, 0x9f, 0x25, 0x4a, 0x94, + 0x33, 0x66, 0xcc, 0x83, 0x1d, 0x3a, 0x74, 0xe8, 0xcb, 0x8d, 0x01, 0x02, + 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d, + 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3, 0x7d, + 0xfa, 0xef, 0xc5, 0x91, 0x39, 0x72, 0xe4, 0xd3, 0xbd, 0x61, 0xc2, 0x9f, + 0x25, 0x4a, 0x94, 0x33, 0x66, 0xcc, 0x83, 0x1d, 0x3a, 0x74, 0xe8, 0xcb, + 0x8d, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, + 0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, + 0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5, 0x91, 0x39, 0x72, 0xe4, 0xd3, 0xbd, + 0x61, 0xc2, 0x9f, 0x25, 0x4a, 0x94, 0x33, 0x66, 0xcc, 0x83, 0x1d, 0x3a, + 0x74, 0xe8, 0xcb, 0x8d]); + + var s = new Uint8Array([ + 0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, 0x30, 0x01, 0x67, 0x2b, + 0xfe, 0xd7, 0xab, 0x76, 0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0, + 0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0, 0xb7, 0xfd, 0x93, 0x26, + 0x36, 0x3f, 0xf7, 0xcc, 0x34, 0xa5, 0xe5, 0xf1, 0x71, 0xd8, 0x31, 0x15, + 0x04, 0xc7, 0x23, 0xc3, 0x18, 0x96, 0x05, 0x9a, 0x07, 0x12, 0x80, 0xe2, + 0xeb, 0x27, 0xb2, 0x75, 0x09, 0x83, 0x2c, 0x1a, 0x1b, 0x6e, 0x5a, 0xa0, + 0x52, 0x3b, 0xd6, 0xb3, 0x29, 0xe3, 0x2f, 0x84, 0x53, 0xd1, 0x00, 0xed, + 0x20, 0xfc, 0xb1, 0x5b, 0x6a, 0xcb, 0xbe, 0x39, 0x4a, 0x4c, 0x58, 0xcf, + 0xd0, 0xef, 0xaa, 0xfb, 0x43, 0x4d, 0x33, 0x85, 0x45, 0xf9, 0x02, 0x7f, + 0x50, 0x3c, 0x9f, 0xa8, 0x51, 0xa3, 0x40, 0x8f, 0x92, 0x9d, 0x38, 0xf5, + 0xbc, 0xb6, 0xda, 0x21, 0x10, 0xff, 0xf3, 0xd2, 0xcd, 0x0c, 0x13, 0xec, + 0x5f, 0x97, 0x44, 0x17, 0xc4, 0xa7, 0x7e, 0x3d, 0x64, 0x5d, 0x19, 0x73, + 0x60, 0x81, 0x4f, 0xdc, 0x22, 0x2a, 0x90, 0x88, 0x46, 0xee, 0xb8, 0x14, + 0xde, 0x5e, 0x0b, 0xdb, 0xe0, 0x32, 0x3a, 0x0a, 0x49, 0x06, 0x24, 0x5c, + 0xc2, 0xd3, 0xac, 0x62, 0x91, 0x95, 0xe4, 0x79, 0xe7, 0xc8, 0x37, 0x6d, + 0x8d, 0xd5, 0x4e, 0xa9, 0x6c, 0x56, 0xf4, 0xea, 0x65, 0x7a, 0xae, 0x08, + 0xba, 0x78, 0x25, 0x2e, 0x1c, 0xa6, 0xb4, 0xc6, 0xe8, 0xdd, 0x74, 0x1f, + 0x4b, 0xbd, 0x8b, 0x8a, 0x70, 0x3e, 0xb5, 0x66, 0x48, 0x03, 0xf6, 0x0e, + 0x61, 0x35, 0x57, 0xb9, 0x86, 0xc1, 0x1d, 0x9e, 0xe1, 0xf8, 0x98, 0x11, + 0x69, 0xd9, 0x8e, 0x94, 0x9b, 0x1e, 0x87, 0xe9, 0xce, 0x55, 0x28, 0xdf, + 0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68, 0x41, 0x99, 0x2d, 0x0f, + 0xb0, 0x54, 0xbb, 0x16]); + + var inv_s = new Uint8Array([ + 0x52, 0x09, 0x6a, 0xd5, 0x30, 0x36, 0xa5, 0x38, 0xbf, 0x40, 0xa3, 0x9e, + 0x81, 0xf3, 0xd7, 0xfb, 0x7c, 0xe3, 0x39, 0x82, 0x9b, 0x2f, 0xff, 0x87, + 0x34, 0x8e, 0x43, 0x44, 0xc4, 0xde, 0xe9, 0xcb, 0x54, 0x7b, 0x94, 0x32, + 0xa6, 0xc2, 0x23, 0x3d, 0xee, 0x4c, 0x95, 0x0b, 0x42, 0xfa, 0xc3, 0x4e, + 0x08, 0x2e, 0xa1, 0x66, 0x28, 0xd9, 0x24, 0xb2, 0x76, 0x5b, 0xa2, 0x49, + 0x6d, 0x8b, 0xd1, 0x25, 0x72, 0xf8, 0xf6, 0x64, 0x86, 0x68, 0x98, 0x16, + 0xd4, 0xa4, 0x5c, 0xcc, 0x5d, 0x65, 0xb6, 0x92, 0x6c, 0x70, 0x48, 0x50, + 0xfd, 0xed, 0xb9, 0xda, 0x5e, 0x15, 0x46, 0x57, 0xa7, 0x8d, 0x9d, 0x84, + 0x90, 0xd8, 0xab, 0x00, 0x8c, 0xbc, 0xd3, 0x0a, 0xf7, 0xe4, 0x58, 0x05, + 0xb8, 0xb3, 0x45, 0x06, 0xd0, 0x2c, 0x1e, 0x8f, 0xca, 0x3f, 0x0f, 0x02, + 0xc1, 0xaf, 0xbd, 0x03, 0x01, 0x13, 0x8a, 0x6b, 0x3a, 0x91, 0x11, 0x41, + 0x4f, 0x67, 0xdc, 0xea, 0x97, 0xf2, 0xcf, 0xce, 0xf0, 0xb4, 0xe6, 0x73, + 0x96, 0xac, 0x74, 0x22, 0xe7, 0xad, 0x35, 0x85, 0xe2, 0xf9, 0x37, 0xe8, + 0x1c, 0x75, 0xdf, 0x6e, 0x47, 0xf1, 0x1a, 0x71, 0x1d, 0x29, 0xc5, 0x89, + 0x6f, 0xb7, 0x62, 0x0e, 0xaa, 0x18, 0xbe, 0x1b, 0xfc, 0x56, 0x3e, 0x4b, + 0xc6, 0xd2, 0x79, 0x20, 0x9a, 0xdb, 0xc0, 0xfe, 0x78, 0xcd, 0x5a, 0xf4, + 0x1f, 0xdd, 0xa8, 0x33, 0x88, 0x07, 0xc7, 0x31, 0xb1, 0x12, 0x10, 0x59, + 0x27, 0x80, 0xec, 0x5f, 0x60, 0x51, 0x7f, 0xa9, 0x19, 0xb5, 0x4a, 0x0d, + 0x2d, 0xe5, 0x7a, 0x9f, 0x93, 0xc9, 0x9c, 0xef, 0xa0, 0xe0, 0x3b, 0x4d, + 0xae, 0x2a, 0xf5, 0xb0, 0xc8, 0xeb, 0xbb, 0x3c, 0x83, 0x53, 0x99, 0x61, + 0x17, 0x2b, 0x04, 0x7e, 0xba, 0x77, 0xd6, 0x26, 0xe1, 0x69, 0x14, 0x63, + 0x55, 0x21, 0x0c, 0x7d]); + + var mixCol = new Uint8Array(256); + for (var i = 0; i < 256; i++) { + if (i < 128) { + mixCol[i] = i << 1; + } else { + mixCol[i] = (i << 1) ^ 0x1b; + } + } + var mix = new Uint32Array([ + 0x00000000, 0x0e090d0b, 0x1c121a16, 0x121b171d, 0x3824342c, 0x362d3927, + 0x24362e3a, 0x2a3f2331, 0x70486858, 0x7e416553, 0x6c5a724e, 0x62537f45, + 0x486c5c74, 0x4665517f, 0x547e4662, 0x5a774b69, 0xe090d0b0, 0xee99ddbb, + 0xfc82caa6, 0xf28bc7ad, 0xd8b4e49c, 0xd6bde997, 0xc4a6fe8a, 0xcaaff381, + 0x90d8b8e8, 0x9ed1b5e3, 0x8ccaa2fe, 0x82c3aff5, 0xa8fc8cc4, 0xa6f581cf, + 0xb4ee96d2, 0xbae79bd9, 0xdb3bbb7b, 0xd532b670, 0xc729a16d, 0xc920ac66, + 0xe31f8f57, 0xed16825c, 0xff0d9541, 0xf104984a, 0xab73d323, 0xa57ade28, + 0xb761c935, 0xb968c43e, 0x9357e70f, 0x9d5eea04, 0x8f45fd19, 0x814cf012, + 0x3bab6bcb, 0x35a266c0, 0x27b971dd, 0x29b07cd6, 0x038f5fe7, 0x0d8652ec, + 0x1f9d45f1, 0x119448fa, 0x4be30393, 0x45ea0e98, 0x57f11985, 0x59f8148e, + 0x73c737bf, 0x7dce3ab4, 0x6fd52da9, 0x61dc20a2, 0xad766df6, 0xa37f60fd, + 0xb16477e0, 0xbf6d7aeb, 0x955259da, 0x9b5b54d1, 0x894043cc, 0x87494ec7, + 0xdd3e05ae, 0xd33708a5, 0xc12c1fb8, 0xcf2512b3, 0xe51a3182, 0xeb133c89, + 0xf9082b94, 0xf701269f, 0x4de6bd46, 0x43efb04d, 0x51f4a750, 0x5ffdaa5b, + 0x75c2896a, 0x7bcb8461, 0x69d0937c, 0x67d99e77, 0x3daed51e, 0x33a7d815, + 0x21bccf08, 0x2fb5c203, 0x058ae132, 0x0b83ec39, 0x1998fb24, 0x1791f62f, + 0x764dd68d, 0x7844db86, 0x6a5fcc9b, 0x6456c190, 0x4e69e2a1, 0x4060efaa, + 0x527bf8b7, 0x5c72f5bc, 0x0605bed5, 0x080cb3de, 0x1a17a4c3, 0x141ea9c8, + 0x3e218af9, 0x302887f2, 0x223390ef, 0x2c3a9de4, 0x96dd063d, 0x98d40b36, + 0x8acf1c2b, 0x84c61120, 0xaef93211, 0xa0f03f1a, 0xb2eb2807, 0xbce2250c, + 0xe6956e65, 0xe89c636e, 0xfa877473, 0xf48e7978, 0xdeb15a49, 0xd0b85742, + 0xc2a3405f, 0xccaa4d54, 0x41ecdaf7, 0x4fe5d7fc, 0x5dfec0e1, 0x53f7cdea, + 0x79c8eedb, 0x77c1e3d0, 0x65daf4cd, 0x6bd3f9c6, 0x31a4b2af, 0x3fadbfa4, + 0x2db6a8b9, 0x23bfa5b2, 0x09808683, 0x07898b88, 0x15929c95, 0x1b9b919e, + 0xa17c0a47, 0xaf75074c, 0xbd6e1051, 0xb3671d5a, 0x99583e6b, 0x97513360, + 0x854a247d, 0x8b432976, 0xd134621f, 0xdf3d6f14, 0xcd267809, 0xc32f7502, + 0xe9105633, 0xe7195b38, 0xf5024c25, 0xfb0b412e, 0x9ad7618c, 0x94de6c87, + 0x86c57b9a, 0x88cc7691, 0xa2f355a0, 0xacfa58ab, 0xbee14fb6, 0xb0e842bd, + 0xea9f09d4, 0xe49604df, 0xf68d13c2, 0xf8841ec9, 0xd2bb3df8, 0xdcb230f3, + 0xcea927ee, 0xc0a02ae5, 0x7a47b13c, 0x744ebc37, 0x6655ab2a, 0x685ca621, + 0x42638510, 0x4c6a881b, 0x5e719f06, 0x5078920d, 0x0a0fd964, 0x0406d46f, + 0x161dc372, 0x1814ce79, 0x322bed48, 0x3c22e043, 0x2e39f75e, 0x2030fa55, + 0xec9ab701, 0xe293ba0a, 0xf088ad17, 0xfe81a01c, 0xd4be832d, 0xdab78e26, + 0xc8ac993b, 0xc6a59430, 0x9cd2df59, 0x92dbd252, 0x80c0c54f, 0x8ec9c844, + 0xa4f6eb75, 0xaaffe67e, 0xb8e4f163, 0xb6edfc68, 0x0c0a67b1, 0x02036aba, + 0x10187da7, 0x1e1170ac, 0x342e539d, 0x3a275e96, 0x283c498b, 0x26354480, + 0x7c420fe9, 0x724b02e2, 0x605015ff, 0x6e5918f4, 0x44663bc5, 0x4a6f36ce, + 0x587421d3, 0x567d2cd8, 0x37a10c7a, 0x39a80171, 0x2bb3166c, 0x25ba1b67, + 0x0f853856, 0x018c355d, 0x13972240, 0x1d9e2f4b, 0x47e96422, 0x49e06929, + 0x5bfb7e34, 0x55f2733f, 0x7fcd500e, 0x71c45d05, 0x63df4a18, 0x6dd64713, + 0xd731dcca, 0xd938d1c1, 0xcb23c6dc, 0xc52acbd7, 0xef15e8e6, 0xe11ce5ed, + 0xf307f2f0, 0xfd0efffb, 0xa779b492, 0xa970b999, 0xbb6bae84, 0xb562a38f, + 0x9f5d80be, 0x91548db5, 0x834f9aa8, 0x8d4697a3]); + + function expandKey256(cipherKey) { + var b = 240, result = new Uint8Array(b); + var r = 1; + + result.set(cipherKey); + for (var j = 32, i = 1; j < b; ++i) { + if (j % 32 === 16) { + t1 = s[t1]; + t2 = s[t2]; + t3 = s[t3]; + t4 = s[t4]; + } else if (j % 32 === 0) { + // RotWord + var t1 = result[j - 3], t2 = result[j - 2], + t3 = result[j - 1], t4 = result[j - 4]; + // SubWord + t1 = s[t1]; + t2 = s[t2]; + t3 = s[t3]; + t4 = s[t4]; + // Rcon + t1 = t1 ^ r; + if ((r <<= 1) >= 256) { + r = (r ^ 0x1b) & 0xFF; + } + } + + for (var n = 0; n < 4; ++n) { + result[j] = (t1 ^= result[j - 32]); + j++; + result[j] = (t2 ^= result[j - 32]); + j++; + result[j] = (t3 ^= result[j - 32]); + j++; + result[j] = (t4 ^= result[j - 32]); + j++; + } + } + return result; + } + + function decrypt256(input, key) { + var state = new Uint8Array(16); + state.set(input); + var i, j, k; + var t, u, v; + // AddRoundKey + for (j = 0, k = 224; j < 16; ++j, ++k) { + state[j] ^= key[k]; + } + for (i = 13; i >= 1; --i) { + // InvShiftRows + t = state[13]; + state[13] = state[9]; + state[9] = state[5]; + state[5] = state[1]; + state[1] = t; + t = state[14]; + u = state[10]; + state[14] = state[6]; + state[10] = state[2]; + state[6] = t; + state[2] = u; + t = state[15]; + u = state[11]; + v = state[7]; + state[15] = state[3]; + state[11] = t; + state[7] = u; + state[3] = v; + // InvSubBytes + for (j = 0; j < 16; ++j) { + state[j] = inv_s[state[j]]; + } + // AddRoundKey + for (j = 0, k = i * 16; j < 16; ++j, ++k) { + state[j] ^= key[k]; + } + // InvMixColumns + for (j = 0; j < 16; j += 4) { + var s0 = mix[state[j]], s1 = mix[state[j + 1]], + s2 = mix[state[j + 2]], s3 = mix[state[j + 3]]; + t = (s0 ^ (s1 >>> 8) ^ (s1 << 24) ^ (s2 >>> 16) ^ (s2 << 16) ^ + (s3 >>> 24) ^ (s3 << 8)); + state[j] = (t >>> 24) & 0xFF; + state[j + 1] = (t >> 16) & 0xFF; + state[j + 2] = (t >> 8) & 0xFF; + state[j + 3] = t & 0xFF; + } + } + // InvShiftRows + t = state[13]; + state[13] = state[9]; + state[9] = state[5]; + state[5] = state[1]; + state[1] = t; + t = state[14]; + u = state[10]; + state[14] = state[6]; + state[10] = state[2]; + state[6] = t; + state[2] = u; + t = state[15]; + u = state[11]; + v = state[7]; + state[15] = state[3]; + state[11] = t; + state[7] = u; + state[3] = v; + for (j = 0; j < 16; ++j) { + // InvSubBytes + state[j] = inv_s[state[j]]; + // AddRoundKey + state[j] ^= key[j]; + } + return state; + } + + function encrypt256(input, key) { + var t, u, v, k; + var state = new Uint8Array(16); + state.set(input); + for (j = 0; j < 16; ++j) { + // AddRoundKey + state[j] ^= key[j]; + } + + for (i = 1; i < 14; i++) { + //SubBytes + for (j = 0; j < 16; ++j) { + state[j] = s[state[j]]; + } + //ShiftRows + v = state[1]; + state[1] = state[5]; + state[5] = state[9]; + state[9] = state[13]; + state[13] = v; + v = state[2]; + u = state[6]; + state[2] = state[10]; + state[6] = state[14]; + state[10] = v; + state[14] = u; + v = state[3]; + u = state[7]; + t = state[11]; + state[3] = state[15]; + state[7] = v; + state[11] = u; + state[15] = t; + //MixColumns + for (var j = 0; j < 16; j += 4) { + var s0 = state[j + 0], s1 = state[j + 1]; + var s2 = state[j + 2], s3 = state[j + 3]; + t = s0 ^ s1 ^ s2 ^ s3; + state[j + 0] ^= t ^ mixCol[s0 ^ s1]; + state[j + 1] ^= t ^ mixCol[s1 ^ s2]; + state[j + 2] ^= t ^ mixCol[s2 ^ s3]; + state[j + 3] ^= t ^ mixCol[s3 ^ s0]; + } + //AddRoundKey + for (j = 0, k = i * 16; j < 16; ++j, ++k) { + state[j] ^= key[k]; + } + } + + //SubBytes + for (j = 0; j < 16; ++j) { + state[j] = s[state[j]]; + } + //ShiftRows + v = state[1]; + state[1] = state[5]; + state[5] = state[9]; + state[9] = state[13]; + state[13] = v; + v = state[2]; + u = state[6]; + state[2] = state[10]; + state[6] = state[14]; + state[10] = v; + state[14] = u; + v = state[3]; + u = state[7]; + t = state[11]; + state[3] = state[15]; + state[7] = v; + state[11] = u; + state[15] = t; + //AddRoundKey + for (j = 0, k = 224; j < 16; ++j, ++k) { + state[j] ^= key[k]; + } + + return state; + + } + + function AES256Cipher(key) { + this.key = expandKey256(key); + this.buffer = new Uint8Array(16); + this.bufferPosition = 0; + } + + function decryptBlock2(data, finalize) { + var i, j, ii, sourceLength = data.length, + buffer = this.buffer, bufferLength = this.bufferPosition, + result = [], iv = this.iv; + + for (i = 0; i < sourceLength; ++i) { + buffer[bufferLength] = data[i]; + ++bufferLength; + if (bufferLength < 16) { + continue; + } + // buffer is full, decrypting + var plain = decrypt256(buffer, this.key); + // xor-ing the IV vector to get plain text + for (j = 0; j < 16; ++j) { + plain[j] ^= iv[j]; + } + iv = buffer; + result.push(plain); + buffer = new Uint8Array(16); + bufferLength = 0; + } + // saving incomplete buffer + this.buffer = buffer; + this.bufferLength = bufferLength; + this.iv = iv; + if (result.length === 0) { + return new Uint8Array([]); + } + // combining plain text blocks into one + var outputLength = 16 * result.length; + if (finalize) { + // undo a padding that is described in RFC 2898 + var lastBlock = result[result.length - 1]; + var psLen = lastBlock[15]; + if (psLen <= 16) { + for (i = 15, ii = 16 - psLen; i >= ii; --i) { + if (lastBlock[i] !== psLen) { + // Invalid padding, assume that the block has no padding. + psLen = 0; + break; + } + } + outputLength -= psLen; + result[result.length - 1] = lastBlock.subarray(0, 16 - psLen); + } + } + var output = new Uint8Array(outputLength); + for (i = 0, j = 0, ii = result.length; i < ii; ++i, j += 16) { + output.set(result[i], j); + } + return output; + + } + + AES256Cipher.prototype = { + decryptBlock: function AES256Cipher_decryptBlock(data, finalize, iv) { + var i, sourceLength = data.length; + var buffer = this.buffer, bufferLength = this.bufferPosition; + // if not supplied an IV wait for IV values + // they are at the start of the stream + if (iv) { + this.iv = iv; + } else { + for (i = 0; bufferLength < 16 && + i < sourceLength; ++i, ++bufferLength) { + buffer[bufferLength] = data[i]; + } + if (bufferLength < 16) { + //need more data + this.bufferLength = bufferLength; + return new Uint8Array([]); + } + this.iv = buffer; + data = data.subarray(16); + } + this.buffer = new Uint8Array(16); + this.bufferLength = 0; + // starting decryption + this.decryptBlock = decryptBlock2; + return this.decryptBlock(data, finalize); + }, + encrypt: function AES256Cipher_encrypt(data, iv) { + var i, j, ii, sourceLength = data.length, + buffer = this.buffer, bufferLength = this.bufferPosition, + result = []; + if (!iv) { + iv = new Uint8Array(16); + } + for (i = 0; i < sourceLength; ++i) { + buffer[bufferLength] = data[i]; + ++bufferLength; + if (bufferLength < 16) { + continue; + } + for (j = 0; j < 16; ++j) { + buffer[j] ^= iv[j]; + } + + // buffer is full, encrypting + var cipher = encrypt256(buffer, this.key); + this.iv = cipher; + result.push(cipher); + buffer = new Uint8Array(16); + bufferLength = 0; + } + // saving incomplete buffer + this.buffer = buffer; + this.bufferLength = bufferLength; + this.iv = iv; + if (result.length === 0) { + return new Uint8Array([]); + } + // combining plain text blocks into one + var outputLength = 16 * result.length; + var output = new Uint8Array(outputLength); + for (i = 0, j = 0, ii = result.length; i < ii; ++i, j += 16) { + output.set(result[i], j); + } + return output; + } + }; + + return AES256Cipher; +})(); + +var PDF17 = (function PDF17Closure() { + + function compareByteArrays(array1, array2) { + if (array1.length !== array2.length) { + return false; + } + for (var i = 0; i < array1.length; i++) { + if (array1[i] !== array2[i]) { + return false; + } + } + return true; + } + + function PDF17() { + } + + PDF17.prototype = { + checkOwnerPassword: function PDF17_checkOwnerPassword(password, + ownerValidationSalt, + userBytes, + ownerPassword) { + var hashData = new Uint8Array(password.length + 56); + hashData.set(password, 0); + hashData.set(ownerValidationSalt, password.length); + hashData.set(userBytes, password.length + ownerValidationSalt.length); + var result = calculateSHA256(hashData, 0, hashData.length); + return compareByteArrays(result, ownerPassword); + }, + checkUserPassword: function PDF17_checkUserPassword(password, + userValidationSalt, + userPassword) { + var hashData = new Uint8Array(password.length + 8); + hashData.set(password, 0); + hashData.set(userValidationSalt, password.length); + var result = calculateSHA256(hashData, 0, hashData.length); + return compareByteArrays(result, userPassword); + }, + getOwnerKey: function PDF17_getOwnerKey(password, ownerKeySalt, userBytes, + ownerEncryption) { + var hashData = new Uint8Array(password.length + 56); + hashData.set(password, 0); + hashData.set(ownerKeySalt, password.length); + hashData.set(userBytes, password.length + ownerKeySalt.length); + var key = calculateSHA256(hashData, 0, hashData.length); + var cipher = new AES256Cipher(key); + return cipher.decryptBlock(ownerEncryption, + false, + new Uint8Array(16)); + + }, + getUserKey: function PDF17_getUserKey(password, userKeySalt, + userEncryption) { + var hashData = new Uint8Array(password.length + 8); + hashData.set(password, 0); + hashData.set(userKeySalt, password.length); + //key is the decryption key for the UE string + var key = calculateSHA256(hashData, 0, hashData.length); + var cipher = new AES256Cipher(key); + return cipher.decryptBlock(userEncryption, + false, + new Uint8Array(16)); + } + }; + return PDF17; +})(); + +var PDF20 = (function PDF20Closure() { + + function concatArrays(array1, array2) { + var t = new Uint8Array(array1.length + array2.length); + t.set(array1, 0); + t.set(array2, array1.length); + return t; + } + + function calculatePDF20Hash(password, input, userBytes) { + //This refers to Algorithm 2.B as defined in ISO 32000-2 + var k = calculateSHA256(input, 0, input.length).subarray(0, 32); + var e = [0]; + var i = 0; + while (i < 64 || e[e.length - 1] > i - 32) { + var arrayLength = password.length + k.length + userBytes.length; + + var k1 = new Uint8Array(arrayLength * 64); + var array = concatArrays(password, k); + array = concatArrays(array, userBytes); + for (var j = 0, pos = 0; j < 64; j++, pos += arrayLength) { + k1.set(array, pos); + } + //AES128 CBC NO PADDING with + //first 16 bytes of k as the key and the second 16 as the iv. + var cipher = new AES128Cipher(k.subarray(0, 16)); + e = cipher.encrypt(k1, k.subarray(16, 32)); + //Now we have to take the first 16 bytes of an unsigned + //big endian integer... and compute the remainder + //modulo 3.... That is a fairly large number and + //JavaScript isn't going to handle that well... + //So we're using a trick that allows us to perform + //modulo math byte by byte + var remainder = 0; + for (var z = 0; z < 16; z++) { + remainder *= (256 % 3); + remainder %= 3; + remainder += ((e[z] >>> 0) % 3); + remainder %= 3; + } + if (remainder === 0) { + k = calculateSHA256(e, 0, e.length); + } + else if (remainder === 1) { + k = calculateSHA384(e, 0, e.length); + } + else if (remainder === 2) { + k = calculateSHA512(e, 0, e.length); + } + i++; + } + return k.subarray(0, 32); + } + + function PDF20() { + } + + function compareByteArrays(array1, array2) { + if (array1.length !== array2.length) { + return false; + } + for (var i = 0; i < array1.length; i++) { + if (array1[i] !== array2[i]) { + return false; + } + } + return true; + } + + PDF20.prototype = { + hash: function PDF20_hash(password, concatBytes, userBytes) { + return calculatePDF20Hash(password, concatBytes, userBytes); + }, + checkOwnerPassword: function PDF20_checkOwnerPassword(password, + ownerValidationSalt, + userBytes, + ownerPassword) { + var hashData = new Uint8Array(password.length + 56); + hashData.set(password, 0); + hashData.set(ownerValidationSalt, password.length); + hashData.set(userBytes, password.length + ownerValidationSalt.length); + var result = calculatePDF20Hash(password, hashData, userBytes); + return compareByteArrays(result, ownerPassword); + }, + checkUserPassword: function PDF20_checkUserPassword(password, + userValidationSalt, + userPassword) { + var hashData = new Uint8Array(password.length + 8); + hashData.set(password, 0); + hashData.set(userValidationSalt, password.length); + var result = calculatePDF20Hash(password, hashData, []); + return compareByteArrays(result, userPassword); + }, + getOwnerKey: function PDF20_getOwnerKey(password, ownerKeySalt, userBytes, + ownerEncryption) { + var hashData = new Uint8Array(password.length + 56); + hashData.set(password, 0); + hashData.set(ownerKeySalt, password.length); + hashData.set(userBytes, password.length + ownerKeySalt.length); + var key = calculatePDF20Hash(password, hashData, userBytes); + var cipher = new AES256Cipher(key); + return cipher.decryptBlock(ownerEncryption, + false, + new Uint8Array(16)); + + }, + getUserKey: function PDF20_getUserKey(password, userKeySalt, + userEncryption) { + var hashData = new Uint8Array(password.length + 8); + hashData.set(password, 0); + hashData.set(userKeySalt, password.length); + //key is the decryption key for the UE string + var key = calculatePDF20Hash(password, hashData, []); + var cipher = new AES256Cipher(key); + return cipher.decryptBlock(userEncryption, + false, + new Uint8Array(16)); + } + }; + return PDF20; +})(); + +var CipherTransform = (function CipherTransformClosure() { + function CipherTransform(stringCipherConstructor, streamCipherConstructor) { + this.stringCipherConstructor = stringCipherConstructor; + this.streamCipherConstructor = streamCipherConstructor; + } + + CipherTransform.prototype = { + createStream: function CipherTransform_createStream(stream, length) { + var cipher = new this.streamCipherConstructor(); + return new DecryptStream(stream, length, + function cipherTransformDecryptStream(data, finalize) { + return cipher.decryptBlock(data, finalize); + } + ); + }, + decryptString: function CipherTransform_decryptString(s) { + var cipher = new this.stringCipherConstructor(); + var data = stringToBytes(s); + data = cipher.decryptBlock(data, true); + return bytesToString(data); + } + }; + return CipherTransform; +})(); + +var CipherTransformFactory = (function CipherTransformFactoryClosure() { + var defaultPasswordBytes = new Uint8Array([ + 0x28, 0xBF, 0x4E, 0x5E, 0x4E, 0x75, 0x8A, 0x41, + 0x64, 0x00, 0x4E, 0x56, 0xFF, 0xFA, 0x01, 0x08, + 0x2E, 0x2E, 0x00, 0xB6, 0xD0, 0x68, 0x3E, 0x80, + 0x2F, 0x0C, 0xA9, 0xFE, 0x64, 0x53, 0x69, 0x7A]); + + function createEncryptionKey20(revision, password, ownerPassword, + ownerValidationSalt, ownerKeySalt, uBytes, + userPassword, userValidationSalt, userKeySalt, + ownerEncryption, userEncryption, perms) { + if (password) { + var passwordLength = Math.min(127, password.length); + password = password.subarray(0, passwordLength); + } else { + password = []; + } + var pdfAlgorithm; + if (revision === 6) { + pdfAlgorithm = new PDF20(); + } else { + pdfAlgorithm = new PDF17(); + } + + if (pdfAlgorithm) { + if (pdfAlgorithm.checkUserPassword(password, userValidationSalt, + userPassword)) { + return pdfAlgorithm.getUserKey(password, userKeySalt, userEncryption); + } else if (password.length && pdfAlgorithm.checkOwnerPassword(password, + ownerValidationSalt, + uBytes, + ownerPassword)) { + return pdfAlgorithm.getOwnerKey(password, ownerKeySalt, uBytes, + ownerEncryption); + } + } + + return null; + } + + function prepareKeyData(fileId, password, ownerPassword, userPassword, + flags, revision, keyLength, encryptMetadata) { + var hashDataSize = 40 + ownerPassword.length + fileId.length; + var hashData = new Uint8Array(hashDataSize), i = 0, j, n; + if (password) { + n = Math.min(32, password.length); + for (; i < n; ++i) { + hashData[i] = password[i]; + } + } + j = 0; + while (i < 32) { + hashData[i++] = defaultPasswordBytes[j++]; + } + // as now the padded password in the hashData[0..i] + for (j = 0, n = ownerPassword.length; j < n; ++j) { + hashData[i++] = ownerPassword[j]; + } + hashData[i++] = flags & 0xFF; + hashData[i++] = (flags >> 8) & 0xFF; + hashData[i++] = (flags >> 16) & 0xFF; + hashData[i++] = (flags >>> 24) & 0xFF; + for (j = 0, n = fileId.length; j < n; ++j) { + hashData[i++] = fileId[j]; + } + if (revision >= 4 && !encryptMetadata) { + hashData[i++] = 0xFF; + hashData[i++] = 0xFF; + hashData[i++] = 0xFF; + hashData[i++] = 0xFF; + } + var hash = calculateMD5(hashData, 0, i); + var keyLengthInBytes = keyLength >> 3; + if (revision >= 3) { + for (j = 0; j < 50; ++j) { + hash = calculateMD5(hash, 0, keyLengthInBytes); + } + } + var encryptionKey = hash.subarray(0, keyLengthInBytes); + var cipher, checkData; + + if (revision >= 3) { + for (i = 0; i < 32; ++i) { + hashData[i] = defaultPasswordBytes[i]; + } + for (j = 0, n = fileId.length; j < n; ++j) { + hashData[i++] = fileId[j]; + } + cipher = new ARCFourCipher(encryptionKey); + checkData = cipher.encryptBlock(calculateMD5(hashData, 0, i)); + n = encryptionKey.length; + var derivedKey = new Uint8Array(n), k; + for (j = 1; j <= 19; ++j) { + for (k = 0; k < n; ++k) { + derivedKey[k] = encryptionKey[k] ^ j; + } + cipher = new ARCFourCipher(derivedKey); + checkData = cipher.encryptBlock(checkData); + } + for (j = 0, n = checkData.length; j < n; ++j) { + if (userPassword[j] !== checkData[j]) { + return null; + } + } + } else { + cipher = new ARCFourCipher(encryptionKey); + checkData = cipher.encryptBlock(defaultPasswordBytes); + for (j = 0, n = checkData.length; j < n; ++j) { + if (userPassword[j] !== checkData[j]) { + return null; + } + } + } + return encryptionKey; + } + + function decodeUserPassword(password, ownerPassword, revision, keyLength) { + var hashData = new Uint8Array(32), i = 0, j, n; + n = Math.min(32, password.length); + for (; i < n; ++i) { + hashData[i] = password[i]; + } + j = 0; + while (i < 32) { + hashData[i++] = defaultPasswordBytes[j++]; + } + var hash = calculateMD5(hashData, 0, i); + var keyLengthInBytes = keyLength >> 3; + if (revision >= 3) { + for (j = 0; j < 50; ++j) { + hash = calculateMD5(hash, 0, hash.length); + } + } + + var cipher, userPassword; + if (revision >= 3) { + userPassword = ownerPassword; + var derivedKey = new Uint8Array(keyLengthInBytes), k; + for (j = 19; j >= 0; j--) { + for (k = 0; k < keyLengthInBytes; ++k) { + derivedKey[k] = hash[k] ^ j; + } + cipher = new ARCFourCipher(derivedKey); + userPassword = cipher.encryptBlock(userPassword); + } + } else { + cipher = new ARCFourCipher(hash.subarray(0, keyLengthInBytes)); + userPassword = cipher.encryptBlock(ownerPassword); + } + return userPassword; + } + + var identityName = Name.get('Identity'); + + function CipherTransformFactory(dict, fileId, password) { + var filter = dict.get('Filter'); + if (!isName(filter) || filter.name !== 'Standard') { + error('unknown encryption method'); + } + this.dict = dict; + var algorithm = dict.get('V'); + if (!isInt(algorithm) || + (algorithm !== 1 && algorithm !== 2 && algorithm !== 4 && + algorithm !== 5)) { + error('unsupported encryption algorithm'); + } + this.algorithm = algorithm; + var keyLength = dict.get('Length') || 40; + if (!isInt(keyLength) || + keyLength < 40 || (keyLength % 8) !== 0) { + error('invalid key length'); + } + + // prepare keys + var ownerPassword = stringToBytes(dict.get('O')).subarray(0, 32); + var userPassword = stringToBytes(dict.get('U')).subarray(0, 32); + var flags = dict.get('P'); + var revision = dict.get('R'); + // meaningful when V is 4 or 5 + var encryptMetadata = ((algorithm === 4 || algorithm === 5) && + dict.get('EncryptMetadata') !== false); + this.encryptMetadata = encryptMetadata; + + var fileIdBytes = stringToBytes(fileId); + var passwordBytes; + if (password) { + if (revision === 6) { + try { + password = utf8StringToString(password); + } catch (ex) { + warn('CipherTransformFactory: ' + + 'Unable to convert UTF8 encoded password.'); + } + } + passwordBytes = stringToBytes(password); + } + + var encryptionKey; + if (algorithm !== 5) { + encryptionKey = prepareKeyData(fileIdBytes, passwordBytes, + ownerPassword, userPassword, flags, + revision, keyLength, encryptMetadata); + } + else { + var ownerValidationSalt = stringToBytes(dict.get('O')).subarray(32, 40); + var ownerKeySalt = stringToBytes(dict.get('O')).subarray(40, 48); + var uBytes = stringToBytes(dict.get('U')).subarray(0, 48); + var userValidationSalt = stringToBytes(dict.get('U')).subarray(32, 40); + var userKeySalt = stringToBytes(dict.get('U')).subarray(40, 48); + var ownerEncryption = stringToBytes(dict.get('OE')); + var userEncryption = stringToBytes(dict.get('UE')); + var perms = stringToBytes(dict.get('Perms')); + encryptionKey = + createEncryptionKey20(revision, passwordBytes, + ownerPassword, ownerValidationSalt, + ownerKeySalt, uBytes, + userPassword, userValidationSalt, + userKeySalt, ownerEncryption, + userEncryption, perms); + } + if (!encryptionKey && !password) { + throw new PasswordException('No password given', + PasswordResponses.NEED_PASSWORD); + } else if (!encryptionKey && password) { + // Attempting use the password as an owner password + var decodedPassword = decodeUserPassword(passwordBytes, ownerPassword, + revision, keyLength); + encryptionKey = prepareKeyData(fileIdBytes, decodedPassword, + ownerPassword, userPassword, flags, + revision, keyLength, encryptMetadata); + } + + if (!encryptionKey) { + throw new PasswordException('Incorrect Password', + PasswordResponses.INCORRECT_PASSWORD); + } + + this.encryptionKey = encryptionKey; + + if (algorithm >= 4) { + this.cf = dict.get('CF'); + this.stmf = dict.get('StmF') || identityName; + this.strf = dict.get('StrF') || identityName; + this.eff = dict.get('EFF') || this.stmf; + } + } + + function buildObjectKey(num, gen, encryptionKey, isAes) { + var key = new Uint8Array(encryptionKey.length + 9), i, n; + for (i = 0, n = encryptionKey.length; i < n; ++i) { + key[i] = encryptionKey[i]; + } + key[i++] = num & 0xFF; + key[i++] = (num >> 8) & 0xFF; + key[i++] = (num >> 16) & 0xFF; + key[i++] = gen & 0xFF; + key[i++] = (gen >> 8) & 0xFF; + if (isAes) { + key[i++] = 0x73; + key[i++] = 0x41; + key[i++] = 0x6C; + key[i++] = 0x54; + } + var hash = calculateMD5(key, 0, i); + return hash.subarray(0, Math.min(encryptionKey.length + 5, 16)); + } + + function buildCipherConstructor(cf, name, num, gen, key) { + var cryptFilter = cf.get(name.name); + var cfm; + if (cryptFilter !== null && cryptFilter !== undefined) { + cfm = cryptFilter.get('CFM'); + } + if (!cfm || cfm.name === 'None') { + return function cipherTransformFactoryBuildCipherConstructorNone() { + return new NullCipher(); + }; + } + if ('V2' === cfm.name) { + return function cipherTransformFactoryBuildCipherConstructorV2() { + return new ARCFourCipher(buildObjectKey(num, gen, key, false)); + }; + } + if ('AESV2' === cfm.name) { + return function cipherTransformFactoryBuildCipherConstructorAESV2() { + return new AES128Cipher(buildObjectKey(num, gen, key, true)); + }; + } + if ('AESV3' === cfm.name) { + return function cipherTransformFactoryBuildCipherConstructorAESV3() { + return new AES256Cipher(key); + }; + } + error('Unknown crypto method'); + } + + CipherTransformFactory.prototype = { + createCipherTransform: + function CipherTransformFactory_createCipherTransform(num, gen) { + if (this.algorithm === 4 || this.algorithm === 5) { + return new CipherTransform( + buildCipherConstructor(this.cf, this.stmf, + num, gen, this.encryptionKey), + buildCipherConstructor(this.cf, this.strf, + num, gen, this.encryptionKey)); + } + // algorithms 1 and 2 + var key = buildObjectKey(num, gen, this.encryptionKey, false); + var cipherConstructor = function buildCipherCipherConstructor() { + return new ARCFourCipher(key); + }; + return new CipherTransform(cipherConstructor, cipherConstructor); + } + }; + + return CipherTransformFactory; +})(); + + +var ShadingType = { + FUNCTION_BASED: 1, + AXIAL: 2, + RADIAL: 3, + FREE_FORM_MESH: 4, + LATTICE_FORM_MESH: 5, + COONS_PATCH_MESH: 6, + TENSOR_PATCH_MESH: 7 +}; + +var Pattern = (function PatternClosure() { + // Constructor should define this.getPattern + function Pattern() { + error('should not call Pattern constructor'); + } + + Pattern.prototype = { + // Input: current Canvas context + // Output: the appropriate fillStyle or strokeStyle + getPattern: function Pattern_getPattern(ctx) { + error('Should not call Pattern.getStyle: ' + ctx); + } + }; + + Pattern.parseShading = function Pattern_parseShading(shading, matrix, xref, + res) { + + var dict = isStream(shading) ? shading.dict : shading; + var type = dict.get('ShadingType'); + + try { + switch (type) { + case ShadingType.AXIAL: + case ShadingType.RADIAL: + // Both radial and axial shadings are handled by RadialAxial shading. + return new Shadings.RadialAxial(dict, matrix, xref, res); + case ShadingType.FREE_FORM_MESH: + case ShadingType.LATTICE_FORM_MESH: + case ShadingType.COONS_PATCH_MESH: + case ShadingType.TENSOR_PATCH_MESH: + return new Shadings.Mesh(shading, matrix, xref, res); + default: + throw new Error('Unsupported ShadingType: ' + type); + } + } catch (ex) { + if (ex instanceof MissingDataException) { + throw ex; + } + UnsupportedManager.notify(UNSUPPORTED_FEATURES.shadingPattern); + warn(ex); + return new Shadings.Dummy(); + } + }; + return Pattern; +})(); + +var Shadings = {}; + +// A small number to offset the first/last color stops so we can insert ones to +// support extend. Number.MIN_VALUE appears to be too small and breaks the +// extend. 1e-7 works in FF but chrome seems to use an even smaller sized number +// internally so we have to go bigger. +Shadings.SMALL_NUMBER = 1e-2; + +// Radial and axial shading have very similar implementations +// If needed, the implementations can be broken into two classes +Shadings.RadialAxial = (function RadialAxialClosure() { + function RadialAxial(dict, matrix, xref, res) { + this.matrix = matrix; + this.coordsArr = dict.get('Coords'); + this.shadingType = dict.get('ShadingType'); + this.type = 'Pattern'; + var cs = dict.get('ColorSpace', 'CS'); + cs = ColorSpace.parse(cs, xref, res); + this.cs = cs; + + var t0 = 0.0, t1 = 1.0; + if (dict.has('Domain')) { + var domainArr = dict.get('Domain'); + t0 = domainArr[0]; + t1 = domainArr[1]; + } + + var extendStart = false, extendEnd = false; + if (dict.has('Extend')) { + var extendArr = dict.get('Extend'); + extendStart = extendArr[0]; + extendEnd = extendArr[1]; + } + + if (this.shadingType === ShadingType.RADIAL && + (!extendStart || !extendEnd)) { + // Radial gradient only currently works if either circle is fully within + // the other circle. + var x1 = this.coordsArr[0]; + var y1 = this.coordsArr[1]; + var r1 = this.coordsArr[2]; + var x2 = this.coordsArr[3]; + var y2 = this.coordsArr[4]; + var r2 = this.coordsArr[5]; + var distance = Math.sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2)); + if (r1 <= r2 + distance && + r2 <= r1 + distance) { + warn('Unsupported radial gradient.'); + } + } + + this.extendStart = extendStart; + this.extendEnd = extendEnd; + + var fnObj = dict.get('Function'); + var fn = PDFFunction.parseArray(xref, fnObj); + + // 10 samples seems good enough for now, but probably won't work + // if there are sharp color changes. Ideally, we would implement + // the spec faithfully and add lossless optimizations. + var diff = t1 - t0; + var step = diff / 10; + + var colorStops = this.colorStops = []; + + // Protect against bad domains so we don't end up in an infinte loop below. + if (t0 >= t1 || step <= 0) { + // Acrobat doesn't seem to handle these cases so we'll ignore for + // now. + info('Bad shading domain.'); + return; + } + + var color = new Float32Array(cs.numComps), ratio = new Float32Array(1); + var rgbColor; + for (var i = t0; i <= t1; i += step) { + ratio[0] = i; + fn(ratio, 0, color, 0); + rgbColor = cs.getRgb(color, 0); + var cssColor = Util.makeCssRgb(rgbColor[0], rgbColor[1], rgbColor[2]); + colorStops.push([(i - t0) / diff, cssColor]); + } + + var background = 'transparent'; + if (dict.has('Background')) { + rgbColor = cs.getRgb(dict.get('Background'), 0); + background = Util.makeCssRgb(rgbColor[0], rgbColor[1], rgbColor[2]); + } + + if (!extendStart) { + // Insert a color stop at the front and offset the first real color stop + // so it doesn't conflict with the one we insert. + colorStops.unshift([0, background]); + colorStops[1][0] += Shadings.SMALL_NUMBER; + } + if (!extendEnd) { + // Same idea as above in extendStart but for the end. + colorStops[colorStops.length - 1][0] -= Shadings.SMALL_NUMBER; + colorStops.push([1, background]); + } + + this.colorStops = colorStops; + } + + RadialAxial.prototype = { + getIR: function RadialAxial_getIR() { + var coordsArr = this.coordsArr; + var shadingType = this.shadingType; + var type, p0, p1, r0, r1; + if (shadingType === ShadingType.AXIAL) { + p0 = [coordsArr[0], coordsArr[1]]; + p1 = [coordsArr[2], coordsArr[3]]; + r0 = null; + r1 = null; + type = 'axial'; + } else if (shadingType === ShadingType.RADIAL) { + p0 = [coordsArr[0], coordsArr[1]]; + p1 = [coordsArr[3], coordsArr[4]]; + r0 = coordsArr[2]; + r1 = coordsArr[5]; + type = 'radial'; + } else { + error('getPattern type unknown: ' + shadingType); + } + + var matrix = this.matrix; + if (matrix) { + p0 = Util.applyTransform(p0, matrix); + p1 = Util.applyTransform(p1, matrix); + } + + return ['RadialAxial', type, this.colorStops, p0, p1, r0, r1]; + } + }; + + return RadialAxial; +})(); + +// All mesh shading. For now, they will be presented as set of the triangles +// to be drawn on the canvas and rgb color for each vertex. +Shadings.Mesh = (function MeshClosure() { + function MeshStreamReader(stream, context) { + this.stream = stream; + this.context = context; + this.buffer = 0; + this.bufferLength = 0; + + var numComps = context.numComps; + this.tmpCompsBuf = new Float32Array(numComps); + var csNumComps = context.colorSpace.numComps; + this.tmpCsCompsBuf = context.colorFn ? new Float32Array(csNumComps) : + this.tmpCompsBuf; + } + MeshStreamReader.prototype = { + get hasData() { + if (this.stream.end) { + return this.stream.pos < this.stream.end; + } + if (this.bufferLength > 0) { + return true; + } + var nextByte = this.stream.getByte(); + if (nextByte < 0) { + return false; + } + this.buffer = nextByte; + this.bufferLength = 8; + return true; + }, + readBits: function MeshStreamReader_readBits(n) { + var buffer = this.buffer; + var bufferLength = this.bufferLength; + if (n === 32) { + if (bufferLength === 0) { + return ((this.stream.getByte() << 24) | + (this.stream.getByte() << 16) | (this.stream.getByte() << 8) | + this.stream.getByte()) >>> 0; + } + buffer = (buffer << 24) | (this.stream.getByte() << 16) | + (this.stream.getByte() << 8) | this.stream.getByte(); + var nextByte = this.stream.getByte(); + this.buffer = nextByte & ((1 << bufferLength) - 1); + return ((buffer << (8 - bufferLength)) | + ((nextByte & 0xFF) >> bufferLength)) >>> 0; + } + if (n === 8 && bufferLength === 0) { + return this.stream.getByte(); + } + while (bufferLength < n) { + buffer = (buffer << 8) | this.stream.getByte(); + bufferLength += 8; + } + bufferLength -= n; + this.bufferLength = bufferLength; + this.buffer = buffer & ((1 << bufferLength) - 1); + return buffer >> bufferLength; + }, + align: function MeshStreamReader_align() { + this.buffer = 0; + this.bufferLength = 0; + }, + readFlag: function MeshStreamReader_readFlag() { + return this.readBits(this.context.bitsPerFlag); + }, + readCoordinate: function MeshStreamReader_readCoordinate() { + var bitsPerCoordinate = this.context.bitsPerCoordinate; + var xi = this.readBits(bitsPerCoordinate); + var yi = this.readBits(bitsPerCoordinate); + var decode = this.context.decode; + var scale = bitsPerCoordinate < 32 ? 1 / ((1 << bitsPerCoordinate) - 1) : + 2.3283064365386963e-10; // 2 ^ -32 + return [ + xi * scale * (decode[1] - decode[0]) + decode[0], + yi * scale * (decode[3] - decode[2]) + decode[2] + ]; + }, + readComponents: function MeshStreamReader_readComponents() { + var numComps = this.context.numComps; + var bitsPerComponent = this.context.bitsPerComponent; + var scale = bitsPerComponent < 32 ? 1 / ((1 << bitsPerComponent) - 1) : + 2.3283064365386963e-10; // 2 ^ -32 + var decode = this.context.decode; + var components = this.tmpCompsBuf; + for (var i = 0, j = 4; i < numComps; i++, j += 2) { + var ci = this.readBits(bitsPerComponent); + components[i] = ci * scale * (decode[j + 1] - decode[j]) + decode[j]; + } + var color = this.tmpCsCompsBuf; + if (this.context.colorFn) { + this.context.colorFn(components, 0, color, 0); + } + return this.context.colorSpace.getRgb(color, 0); + } + }; + + function decodeType4Shading(mesh, reader) { + var coords = mesh.coords; + var colors = mesh.colors; + var operators = []; + var ps = []; // not maintaining cs since that will match ps + var verticesLeft = 0; // assuming we have all data to start a new triangle + while (reader.hasData) { + var f = reader.readFlag(); + var coord = reader.readCoordinate(); + var color = reader.readComponents(); + if (verticesLeft === 0) { // ignoring flags if we started a triangle + assert(0 <= f && f <= 2, 'Unknown type4 flag'); + switch (f) { + case 0: + verticesLeft = 3; + break; + case 1: + ps.push(ps[ps.length - 2], ps[ps.length - 1]); + verticesLeft = 1; + break; + case 2: + ps.push(ps[ps.length - 3], ps[ps.length - 1]); + verticesLeft = 1; + break; + } + operators.push(f); + } + ps.push(coords.length); + coords.push(coord); + colors.push(color); + verticesLeft--; + + reader.align(); + } + mesh.figures.push({ + type: 'triangles', + coords: new Int32Array(ps), + colors: new Int32Array(ps), + }); + } + + function decodeType5Shading(mesh, reader, verticesPerRow) { + var coords = mesh.coords; + var colors = mesh.colors; + var ps = []; // not maintaining cs since that will match ps + while (reader.hasData) { + var coord = reader.readCoordinate(); + var color = reader.readComponents(); + ps.push(coords.length); + coords.push(coord); + colors.push(color); + } + mesh.figures.push({ + type: 'lattice', + coords: new Int32Array(ps), + colors: new Int32Array(ps), + verticesPerRow: verticesPerRow + }); + } + + var MIN_SPLIT_PATCH_CHUNKS_AMOUNT = 3; + var MAX_SPLIT_PATCH_CHUNKS_AMOUNT = 20; + + var TRIANGLE_DENSITY = 20; // count of triangles per entire mesh bounds + + var getB = (function getBClosure() { + function buildB(count) { + var lut = []; + for (var i = 0; i <= count; i++) { + var t = i / count, t_ = 1 - t; + lut.push(new Float32Array([t_ * t_ * t_, 3 * t * t_ * t_, + 3 * t * t * t_, t * t * t])); + } + return lut; + } + var cache = []; + return function getB(count) { + if (!cache[count]) { + cache[count] = buildB(count); + } + return cache[count]; + }; + })(); + + function buildFigureFromPatch(mesh, index) { + var figure = mesh.figures[index]; + assert(figure.type === 'patch', 'Unexpected patch mesh figure'); + + var coords = mesh.coords, colors = mesh.colors; + var pi = figure.coords; + var ci = figure.colors; + + var figureMinX = Math.min(coords[pi[0]][0], coords[pi[3]][0], + coords[pi[12]][0], coords[pi[15]][0]); + var figureMinY = Math.min(coords[pi[0]][1], coords[pi[3]][1], + coords[pi[12]][1], coords[pi[15]][1]); + var figureMaxX = Math.max(coords[pi[0]][0], coords[pi[3]][0], + coords[pi[12]][0], coords[pi[15]][0]); + var figureMaxY = Math.max(coords[pi[0]][1], coords[pi[3]][1], + coords[pi[12]][1], coords[pi[15]][1]); + var splitXBy = Math.ceil((figureMaxX - figureMinX) * TRIANGLE_DENSITY / + (mesh.bounds[2] - mesh.bounds[0])); + splitXBy = Math.max(MIN_SPLIT_PATCH_CHUNKS_AMOUNT, + Math.min(MAX_SPLIT_PATCH_CHUNKS_AMOUNT, splitXBy)); + var splitYBy = Math.ceil((figureMaxY - figureMinY) * TRIANGLE_DENSITY / + (mesh.bounds[3] - mesh.bounds[1])); + splitYBy = Math.max(MIN_SPLIT_PATCH_CHUNKS_AMOUNT, + Math.min(MAX_SPLIT_PATCH_CHUNKS_AMOUNT, splitYBy)); + + var verticesPerRow = splitXBy + 1; + var figureCoords = new Int32Array((splitYBy + 1) * verticesPerRow); + var figureColors = new Int32Array((splitYBy + 1) * verticesPerRow); + var k = 0; + var cl = new Uint8Array(3), cr = new Uint8Array(3); + var c0 = colors[ci[0]], c1 = colors[ci[1]], + c2 = colors[ci[2]], c3 = colors[ci[3]]; + var bRow = getB(splitYBy), bCol = getB(splitXBy); + for (var row = 0; row <= splitYBy; row++) { + cl[0] = ((c0[0] * (splitYBy - row) + c2[0] * row) / splitYBy) | 0; + cl[1] = ((c0[1] * (splitYBy - row) + c2[1] * row) / splitYBy) | 0; + cl[2] = ((c0[2] * (splitYBy - row) + c2[2] * row) / splitYBy) | 0; + + cr[0] = ((c1[0] * (splitYBy - row) + c3[0] * row) / splitYBy) | 0; + cr[1] = ((c1[1] * (splitYBy - row) + c3[1] * row) / splitYBy) | 0; + cr[2] = ((c1[2] * (splitYBy - row) + c3[2] * row) / splitYBy) | 0; + + for (var col = 0; col <= splitXBy; col++, k++) { + if ((row === 0 || row === splitYBy) && + (col === 0 || col === splitXBy)) { + continue; + } + var x = 0, y = 0; + var q = 0; + for (var i = 0; i <= 3; i++) { + for (var j = 0; j <= 3; j++, q++) { + var m = bRow[row][i] * bCol[col][j]; + x += coords[pi[q]][0] * m; + y += coords[pi[q]][1] * m; + } + } + figureCoords[k] = coords.length; + coords.push([x, y]); + figureColors[k] = colors.length; + var newColor = new Uint8Array(3); + newColor[0] = ((cl[0] * (splitXBy - col) + cr[0] * col) / splitXBy) | 0; + newColor[1] = ((cl[1] * (splitXBy - col) + cr[1] * col) / splitXBy) | 0; + newColor[2] = ((cl[2] * (splitXBy - col) + cr[2] * col) / splitXBy) | 0; + colors.push(newColor); + } + } + figureCoords[0] = pi[0]; + figureColors[0] = ci[0]; + figureCoords[splitXBy] = pi[3]; + figureColors[splitXBy] = ci[1]; + figureCoords[verticesPerRow * splitYBy] = pi[12]; + figureColors[verticesPerRow * splitYBy] = ci[2]; + figureCoords[verticesPerRow * splitYBy + splitXBy] = pi[15]; + figureColors[verticesPerRow * splitYBy + splitXBy] = ci[3]; + + mesh.figures[index] = { + type: 'lattice', + coords: figureCoords, + colors: figureColors, + verticesPerRow: verticesPerRow + }; + } + + function decodeType6Shading(mesh, reader) { + // A special case of Type 7. The p11, p12, p21, p22 automatically filled + var coords = mesh.coords; + var colors = mesh.colors; + var ps = new Int32Array(16); // p00, p10, ..., p30, p01, ..., p33 + var cs = new Int32Array(4); // c00, c30, c03, c33 + while (reader.hasData) { + var f = reader.readFlag(); + assert(0 <= f && f <= 3, 'Unknown type6 flag'); + var i, ii; + var pi = coords.length; + for (i = 0, ii = (f !== 0 ? 8 : 12); i < ii; i++) { + coords.push(reader.readCoordinate()); + } + var ci = colors.length; + for (i = 0, ii = (f !== 0 ? 2 : 4); i < ii; i++) { + colors.push(reader.readComponents()); + } + var tmp1, tmp2, tmp3, tmp4; + switch (f) { + case 0: + ps[12] = pi + 3; ps[13] = pi + 4; ps[14] = pi + 5; ps[15] = pi + 6; + ps[ 8] = pi + 2; /* values for 5, 6, 9, 10 are */ ps[11] = pi + 7; + ps[ 4] = pi + 1; /* calculated below */ ps[ 7] = pi + 8; + ps[ 0] = pi; ps[ 1] = pi + 11; ps[ 2] = pi + 10; ps[ 3] = pi + 9; + cs[2] = ci + 1; cs[3] = ci + 2; + cs[0] = ci; cs[1] = ci + 3; + break; + case 1: + tmp1 = ps[12]; tmp2 = ps[13]; tmp3 = ps[14]; tmp4 = ps[15]; + ps[12] = tmp4; ps[13] = pi + 0; ps[14] = pi + 1; ps[15] = pi + 2; + ps[ 8] = tmp3; /* values for 5, 6, 9, 10 are */ ps[11] = pi + 3; + ps[ 4] = tmp2; /* calculated below */ ps[ 7] = pi + 4; + ps[ 0] = tmp1; ps[ 1] = pi + 7; ps[ 2] = pi + 6; ps[ 3] = pi + 5; + tmp1 = cs[2]; tmp2 = cs[3]; + cs[2] = tmp2; cs[3] = ci; + cs[0] = tmp1; cs[1] = ci + 1; + break; + case 2: + tmp1 = ps[15]; + tmp2 = ps[11]; + ps[12] = ps[3]; ps[13] = pi + 0; ps[14] = pi + 1; ps[15] = pi + 2; + ps[ 8] = ps[7]; /* values for 5, 6, 9, 10 are */ ps[11] = pi + 3; + ps[ 4] = tmp2; /* calculated below */ ps[ 7] = pi + 4; + ps[ 0] = tmp1; ps[ 1] = pi + 7; ps[ 2] = pi + 6; ps[ 3] = pi + 5; + tmp1 = cs[3]; + cs[2] = cs[1]; cs[3] = ci; + cs[0] = tmp1; cs[1] = ci + 1; + break; + case 3: + ps[12] = ps[0]; ps[13] = pi + 0; ps[14] = pi + 1; ps[15] = pi + 2; + ps[ 8] = ps[1]; /* values for 5, 6, 9, 10 are */ ps[11] = pi + 3; + ps[ 4] = ps[2]; /* calculated below */ ps[ 7] = pi + 4; + ps[ 0] = ps[3]; ps[ 1] = pi + 7; ps[ 2] = pi + 6; ps[ 3] = pi + 5; + cs[2] = cs[0]; cs[3] = ci; + cs[0] = cs[1]; cs[1] = ci + 1; + break; + } + // set p11, p12, p21, p22 + ps[5] = coords.length; + coords.push([ + (-4 * coords[ps[0]][0] - coords[ps[15]][0] + + 6 * (coords[ps[4]][0] + coords[ps[1]][0]) - + 2 * (coords[ps[12]][0] + coords[ps[3]][0]) + + 3 * (coords[ps[13]][0] + coords[ps[7]][0])) / 9, + (-4 * coords[ps[0]][1] - coords[ps[15]][1] + + 6 * (coords[ps[4]][1] + coords[ps[1]][1]) - + 2 * (coords[ps[12]][1] + coords[ps[3]][1]) + + 3 * (coords[ps[13]][1] + coords[ps[7]][1])) / 9 + ]); + ps[6] = coords.length; + coords.push([ + (-4 * coords[ps[3]][0] - coords[ps[12]][0] + + 6 * (coords[ps[2]][0] + coords[ps[7]][0]) - + 2 * (coords[ps[0]][0] + coords[ps[15]][0]) + + 3 * (coords[ps[4]][0] + coords[ps[14]][0])) / 9, + (-4 * coords[ps[3]][1] - coords[ps[12]][1] + + 6 * (coords[ps[2]][1] + coords[ps[7]][1]) - + 2 * (coords[ps[0]][1] + coords[ps[15]][1]) + + 3 * (coords[ps[4]][1] + coords[ps[14]][1])) / 9 + ]); + ps[9] = coords.length; + coords.push([ + (-4 * coords[ps[12]][0] - coords[ps[3]][0] + + 6 * (coords[ps[8]][0] + coords[ps[13]][0]) - + 2 * (coords[ps[0]][0] + coords[ps[15]][0]) + + 3 * (coords[ps[11]][0] + coords[ps[1]][0])) / 9, + (-4 * coords[ps[12]][1] - coords[ps[3]][1] + + 6 * (coords[ps[8]][1] + coords[ps[13]][1]) - + 2 * (coords[ps[0]][1] + coords[ps[15]][1]) + + 3 * (coords[ps[11]][1] + coords[ps[1]][1])) / 9 + ]); + ps[10] = coords.length; + coords.push([ + (-4 * coords[ps[15]][0] - coords[ps[0]][0] + + 6 * (coords[ps[11]][0] + coords[ps[14]][0]) - + 2 * (coords[ps[12]][0] + coords[ps[3]][0]) + + 3 * (coords[ps[2]][0] + coords[ps[8]][0])) / 9, + (-4 * coords[ps[15]][1] - coords[ps[0]][1] + + 6 * (coords[ps[11]][1] + coords[ps[14]][1]) - + 2 * (coords[ps[12]][1] + coords[ps[3]][1]) + + 3 * (coords[ps[2]][1] + coords[ps[8]][1])) / 9 + ]); + mesh.figures.push({ + type: 'patch', + coords: new Int32Array(ps), // making copies of ps and cs + colors: new Int32Array(cs) + }); + } + } + + function decodeType7Shading(mesh, reader) { + var coords = mesh.coords; + var colors = mesh.colors; + var ps = new Int32Array(16); // p00, p10, ..., p30, p01, ..., p33 + var cs = new Int32Array(4); // c00, c30, c03, c33 + while (reader.hasData) { + var f = reader.readFlag(); + assert(0 <= f && f <= 3, 'Unknown type7 flag'); + var i, ii; + var pi = coords.length; + for (i = 0, ii = (f !== 0 ? 12 : 16); i < ii; i++) { + coords.push(reader.readCoordinate()); + } + var ci = colors.length; + for (i = 0, ii = (f !== 0 ? 2 : 4); i < ii; i++) { + colors.push(reader.readComponents()); + } + var tmp1, tmp2, tmp3, tmp4; + switch (f) { + case 0: + ps[12] = pi + 3; ps[13] = pi + 4; ps[14] = pi + 5; ps[15] = pi + 6; + ps[ 8] = pi + 2; ps[ 9] = pi + 13; ps[10] = pi + 14; ps[11] = pi + 7; + ps[ 4] = pi + 1; ps[ 5] = pi + 12; ps[ 6] = pi + 15; ps[ 7] = pi + 8; + ps[ 0] = pi; ps[ 1] = pi + 11; ps[ 2] = pi + 10; ps[ 3] = pi + 9; + cs[2] = ci + 1; cs[3] = ci + 2; + cs[0] = ci; cs[1] = ci + 3; + break; + case 1: + tmp1 = ps[12]; tmp2 = ps[13]; tmp3 = ps[14]; tmp4 = ps[15]; + ps[12] = tmp4; ps[13] = pi + 0; ps[14] = pi + 1; ps[15] = pi + 2; + ps[ 8] = tmp3; ps[ 9] = pi + 9; ps[10] = pi + 10; ps[11] = pi + 3; + ps[ 4] = tmp2; ps[ 5] = pi + 8; ps[ 6] = pi + 11; ps[ 7] = pi + 4; + ps[ 0] = tmp1; ps[ 1] = pi + 7; ps[ 2] = pi + 6; ps[ 3] = pi + 5; + tmp1 = cs[2]; tmp2 = cs[3]; + cs[2] = tmp2; cs[3] = ci; + cs[0] = tmp1; cs[1] = ci + 1; + break; + case 2: + tmp1 = ps[15]; + tmp2 = ps[11]; + ps[12] = ps[3]; ps[13] = pi + 0; ps[14] = pi + 1; ps[15] = pi + 2; + ps[ 8] = ps[7]; ps[ 9] = pi + 9; ps[10] = pi + 10; ps[11] = pi + 3; + ps[ 4] = tmp2; ps[ 5] = pi + 8; ps[ 6] = pi + 11; ps[ 7] = pi + 4; + ps[ 0] = tmp1; ps[ 1] = pi + 7; ps[ 2] = pi + 6; ps[ 3] = pi + 5; + tmp1 = cs[3]; + cs[2] = cs[1]; cs[3] = ci; + cs[0] = tmp1; cs[1] = ci + 1; + break; + case 3: + ps[12] = ps[0]; ps[13] = pi + 0; ps[14] = pi + 1; ps[15] = pi + 2; + ps[ 8] = ps[1]; ps[ 9] = pi + 9; ps[10] = pi + 10; ps[11] = pi + 3; + ps[ 4] = ps[2]; ps[ 5] = pi + 8; ps[ 6] = pi + 11; ps[ 7] = pi + 4; + ps[ 0] = ps[3]; ps[ 1] = pi + 7; ps[ 2] = pi + 6; ps[ 3] = pi + 5; + cs[2] = cs[0]; cs[3] = ci; + cs[0] = cs[1]; cs[1] = ci + 1; + break; + } + mesh.figures.push({ + type: 'patch', + coords: new Int32Array(ps), // making copies of ps and cs + colors: new Int32Array(cs) + }); + } + } + + function updateBounds(mesh) { + var minX = mesh.coords[0][0], minY = mesh.coords[0][1], + maxX = minX, maxY = minY; + for (var i = 1, ii = mesh.coords.length; i < ii; i++) { + var x = mesh.coords[i][0], y = mesh.coords[i][1]; + minX = minX > x ? x : minX; + minY = minY > y ? y : minY; + maxX = maxX < x ? x : maxX; + maxY = maxY < y ? y : maxY; + } + mesh.bounds = [minX, minY, maxX, maxY]; + } + + function packData(mesh) { + var i, ii, j, jj; + + var coords = mesh.coords; + var coordsPacked = new Float32Array(coords.length * 2); + for (i = 0, j = 0, ii = coords.length; i < ii; i++) { + var xy = coords[i]; + coordsPacked[j++] = xy[0]; + coordsPacked[j++] = xy[1]; + } + mesh.coords = coordsPacked; + + var colors = mesh.colors; + var colorsPacked = new Uint8Array(colors.length * 3); + for (i = 0, j = 0, ii = colors.length; i < ii; i++) { + var c = colors[i]; + colorsPacked[j++] = c[0]; + colorsPacked[j++] = c[1]; + colorsPacked[j++] = c[2]; + } + mesh.colors = colorsPacked; + + var figures = mesh.figures; + for (i = 0, ii = figures.length; i < ii; i++) { + var figure = figures[i], ps = figure.coords, cs = figure.colors; + for (j = 0, jj = ps.length; j < jj; j++) { + ps[j] *= 2; + cs[j] *= 3; + } + } + } + + function Mesh(stream, matrix, xref, res) { + assert(isStream(stream), 'Mesh data is not a stream'); + var dict = stream.dict; + this.matrix = matrix; + this.shadingType = dict.get('ShadingType'); + this.type = 'Pattern'; + this.bbox = dict.get('BBox'); + var cs = dict.get('ColorSpace', 'CS'); + cs = ColorSpace.parse(cs, xref, res); + this.cs = cs; + this.background = dict.has('Background') ? + cs.getRgb(dict.get('Background'), 0) : null; + + var fnObj = dict.get('Function'); + var fn = fnObj ? PDFFunction.parseArray(xref, fnObj) : null; + + this.coords = []; + this.colors = []; + this.figures = []; + + var decodeContext = { + bitsPerCoordinate: dict.get('BitsPerCoordinate'), + bitsPerComponent: dict.get('BitsPerComponent'), + bitsPerFlag: dict.get('BitsPerFlag'), + decode: dict.get('Decode'), + colorFn: fn, + colorSpace: cs, + numComps: fn ? 1 : cs.numComps + }; + var reader = new MeshStreamReader(stream, decodeContext); + + var patchMesh = false; + switch (this.shadingType) { + case ShadingType.FREE_FORM_MESH: + decodeType4Shading(this, reader); + break; + case ShadingType.LATTICE_FORM_MESH: + var verticesPerRow = dict.get('VerticesPerRow') | 0; + assert(verticesPerRow >= 2, 'Invalid VerticesPerRow'); + decodeType5Shading(this, reader, verticesPerRow); + break; + case ShadingType.COONS_PATCH_MESH: + decodeType6Shading(this, reader); + patchMesh = true; + break; + case ShadingType.TENSOR_PATCH_MESH: + decodeType7Shading(this, reader); + patchMesh = true; + break; + default: + error('Unsupported mesh type.'); + break; + } + + if (patchMesh) { + // dirty bounds calculation for determining, how dense shall be triangles + updateBounds(this); + for (var i = 0, ii = this.figures.length; i < ii; i++) { + buildFigureFromPatch(this, i); + } + } + // calculate bounds + updateBounds(this); + + packData(this); + } + + Mesh.prototype = { + getIR: function Mesh_getIR() { + return ['Mesh', this.shadingType, this.coords, this.colors, this.figures, + this.bounds, this.matrix, this.bbox, this.background]; + } + }; + + return Mesh; +})(); + +Shadings.Dummy = (function DummyClosure() { + function Dummy() { + this.type = 'Pattern'; + } + + Dummy.prototype = { + getIR: function Dummy_getIR() { + return ['Dummy']; + } + }; + return Dummy; +})(); + +function getTilingPatternIR(operatorList, dict, args) { + var matrix = dict.get('Matrix'); + var bbox = dict.get('BBox'); + var xstep = dict.get('XStep'); + var ystep = dict.get('YStep'); + var paintType = dict.get('PaintType'); + var tilingType = dict.get('TilingType'); + + return [ + 'TilingPattern', args, operatorList, matrix, bbox, xstep, ystep, + paintType, tilingType + ]; +} + + +var PartialEvaluator = (function PartialEvaluatorClosure() { + function PartialEvaluator(pdfManager, xref, handler, pageIndex, + uniquePrefix, idCounters, fontCache) { + this.pdfManager = pdfManager; + this.xref = xref; + this.handler = handler; + this.pageIndex = pageIndex; + this.uniquePrefix = uniquePrefix; + this.idCounters = idCounters; + this.fontCache = fontCache; + } + + // Trying to minimize Date.now() usage and check every 100 time + var TIME_SLOT_DURATION_MS = 20; + var CHECK_TIME_EVERY = 100; + function TimeSlotManager() { + this.reset(); + } + TimeSlotManager.prototype = { + check: function TimeSlotManager_check() { + if (++this.checked < CHECK_TIME_EVERY) { + return false; + } + this.checked = 0; + return this.endTime <= Date.now(); + }, + reset: function TimeSlotManager_reset() { + this.endTime = Date.now() + TIME_SLOT_DURATION_MS; + this.checked = 0; + } + }; + + var deferred = Promise.resolve(); + + var TILING_PATTERN = 1, SHADING_PATTERN = 2; + + PartialEvaluator.prototype = { + hasBlendModes: function PartialEvaluator_hasBlendModes(resources) { + if (!isDict(resources)) { + return false; + } + + var processed = Object.create(null); + if (resources.objId) { + processed[resources.objId] = true; + } + + var nodes = [resources]; + while (nodes.length) { + var key; + var node = nodes.shift(); + // First check the current resources for blend modes. + var graphicStates = node.get('ExtGState'); + if (isDict(graphicStates)) { + graphicStates = graphicStates.getAll(); + for (key in graphicStates) { + var graphicState = graphicStates[key]; + var bm = graphicState['BM']; + if (isName(bm) && bm.name !== 'Normal') { + return true; + } + } + } + // Descend into the XObjects to look for more resources and blend modes. + var xObjects = node.get('XObject'); + if (!isDict(xObjects)) { + continue; + } + xObjects = xObjects.getAll(); + for (key in xObjects) { + var xObject = xObjects[key]; + if (!isStream(xObject)) { + continue; + } + if (xObject.dict.objId) { + if (processed[xObject.dict.objId]) { + // stream has objId and is processed already + continue; + } + processed[xObject.dict.objId] = true; + } + var xResources = xObject.dict.get('Resources'); + // Checking objId to detect an infinite loop. + if (isDict(xResources) && + (!xResources.objId || !processed[xResources.objId])) { + nodes.push(xResources); + if (xResources.objId) { + processed[xResources.objId] = true; + } + } + } + } + return false; + }, + + buildFormXObject: function PartialEvaluator_buildFormXObject(resources, + xobj, smask, + operatorList, + task, + initialState) { + var matrix = xobj.dict.getArray('Matrix'); + var bbox = xobj.dict.getArray('BBox'); + var group = xobj.dict.get('Group'); + if (group) { + var groupOptions = { + matrix: matrix, + bbox: bbox, + smask: smask, + isolated: false, + knockout: false + }; + + var groupSubtype = group.get('S'); + var colorSpace; + if (isName(groupSubtype) && groupSubtype.name === 'Transparency') { + groupOptions.isolated = (group.get('I') || false); + groupOptions.knockout = (group.get('K') || false); + colorSpace = (group.has('CS') ? + ColorSpace.parse(group.get('CS'), this.xref, resources) : null); + } + + if (smask && smask.backdrop) { + colorSpace = colorSpace || ColorSpace.singletons.rgb; + smask.backdrop = colorSpace.getRgb(smask.backdrop, 0); + } + + operatorList.addOp(OPS.beginGroup, [groupOptions]); + } + + operatorList.addOp(OPS.paintFormXObjectBegin, [matrix, bbox]); + + return this.getOperatorList(xobj, task, + (xobj.dict.get('Resources') || resources), operatorList, initialState). + then(function () { + operatorList.addOp(OPS.paintFormXObjectEnd, []); + + if (group) { + operatorList.addOp(OPS.endGroup, [groupOptions]); + } + }); + }, + + buildPaintImageXObject: + function PartialEvaluator_buildPaintImageXObject(resources, image, + inline, operatorList, + cacheKey, imageCache) { + var self = this; + var dict = image.dict; + var w = dict.get('Width', 'W'); + var h = dict.get('Height', 'H'); + + if (!(w && isNum(w)) || !(h && isNum(h))) { + warn('Image dimensions are missing, or not numbers.'); + return; + } + if (PDFJS.maxImageSize !== -1 && w * h > PDFJS.maxImageSize) { + warn('Image exceeded maximum allowed size and was removed.'); + return; + } + + var imageMask = (dict.get('ImageMask', 'IM') || false); + var imgData, args; + if (imageMask) { + // This depends on a tmpCanvas being filled with the + // current fillStyle, such that processing the pixel + // data can't be done here. Instead of creating a + // complete PDFImage, only read the information needed + // for later. + + var width = dict.get('Width', 'W'); + var height = dict.get('Height', 'H'); + var bitStrideLength = (width + 7) >> 3; + var imgArray = image.getBytes(bitStrideLength * height); + var decode = dict.get('Decode', 'D'); + var inverseDecode = (!!decode && decode[0] > 0); + + imgData = PDFImage.createMask(imgArray, width, height, + image instanceof DecodeStream, + inverseDecode); + imgData.cached = true; + args = [imgData]; + operatorList.addOp(OPS.paintImageMaskXObject, args); + if (cacheKey) { + imageCache[cacheKey] = { + fn: OPS.paintImageMaskXObject, + args: args + }; + } + return; + } + + var softMask = (dict.get('SMask', 'SM') || false); + var mask = (dict.get('Mask') || false); + + var SMALL_IMAGE_DIMENSIONS = 200; + // Inlining small images into the queue as RGB data + if (inline && !softMask && !mask && !(image instanceof JpegStream) && + (w + h) < SMALL_IMAGE_DIMENSIONS) { + var imageObj = new PDFImage(this.xref, resources, image, + inline, null, null); + // We force the use of RGBA_32BPP images here, because we can't handle + // any other kind. + imgData = imageObj.createImageData(/* forceRGBA = */ true); + operatorList.addOp(OPS.paintInlineImageXObject, [imgData]); + return; + } + + // If there is no imageMask, create the PDFImage and a lot + // of image processing can be done here. + var uniquePrefix = (this.uniquePrefix || ''); + var objId = 'img_' + uniquePrefix + (++this.idCounters.obj); + operatorList.addDependency(objId); + args = [objId, w, h]; + + if (!softMask && !mask && image instanceof JpegStream && + image.isNativelySupported(this.xref, resources)) { + // These JPEGs don't need any more processing so we can just send it. + operatorList.addOp(OPS.paintJpegXObject, args); + this.handler.send('obj', + [objId, this.pageIndex, 'JpegStream', image.getIR()]); + return; + } + + PDFImage.buildImage(self.handler, self.xref, resources, image, inline). + then(function(imageObj) { + var imgData = imageObj.createImageData(/* forceRGBA = */ false); + self.handler.send('obj', [objId, self.pageIndex, 'Image', imgData], + [imgData.data.buffer]); + }).then(undefined, function (reason) { + warn('Unable to decode image: ' + reason); + self.handler.send('obj', [objId, self.pageIndex, 'Image', null]); + }); + + operatorList.addOp(OPS.paintImageXObject, args); + if (cacheKey) { + imageCache[cacheKey] = { + fn: OPS.paintImageXObject, + args: args + }; + } + }, + + handleSMask: function PartialEvaluator_handleSmask(smask, resources, + operatorList, task, + stateManager) { + var smaskContent = smask.get('G'); + var smaskOptions = { + subtype: smask.get('S').name, + backdrop: smask.get('BC') + }; + return this.buildFormXObject(resources, smaskContent, smaskOptions, + operatorList, task, stateManager.state.clone()); + }, + + handleTilingType: + function PartialEvaluator_handleTilingType(fn, args, resources, + pattern, patternDict, + operatorList, task) { + // Create an IR of the pattern code. + var tilingOpList = new OperatorList(); + // Merge the available resources, to prevent issues when the patternDict + // is missing some /Resources entries (fixes issue6541.pdf). + var resourcesArray = [patternDict.get('Resources'), resources]; + var patternResources = Dict.merge(this.xref, resourcesArray); + + return this.getOperatorList(pattern, task, patternResources, + tilingOpList).then(function () { + // Add the dependencies to the parent operator list so they are + // resolved before sub operator list is executed synchronously. + operatorList.addDependencies(tilingOpList.dependencies); + operatorList.addOp(fn, getTilingPatternIR({ + fnArray: tilingOpList.fnArray, + argsArray: tilingOpList.argsArray + }, patternDict, args)); + }); + }, + + handleSetFont: + function PartialEvaluator_handleSetFont(resources, fontArgs, fontRef, + operatorList, task, state) { + // TODO(mack): Not needed? + var fontName; + if (fontArgs) { + fontArgs = fontArgs.slice(); + fontName = fontArgs[0].name; + } + + var self = this; + return this.loadFont(fontName, fontRef, this.xref, resources).then( + function (translated) { + if (!translated.font.isType3Font) { + return translated; + } + return translated.loadType3Data(self, resources, operatorList, task). + then(function () { + return translated; + }); + }).then(function (translated) { + state.font = translated.font; + translated.send(self.handler); + return translated.loadedName; + }); + }, + + handleText: function PartialEvaluator_handleText(chars, state) { + var font = state.font; + var glyphs = font.charsToGlyphs(chars); + var isAddToPathSet = !!(state.textRenderingMode & + TextRenderingMode.ADD_TO_PATH_FLAG); + if (font.data && (isAddToPathSet || PDFJS.disableFontFace)) { + var buildPath = function (fontChar) { + if (!font.renderer.hasBuiltPath(fontChar)) { + var path = font.renderer.getPathJs(fontChar); + this.handler.send('commonobj', [ + font.loadedName + '_path_' + fontChar, + 'FontPath', + path + ]); + } + }.bind(this); + + for (var i = 0, ii = glyphs.length; i < ii; i++) { + var glyph = glyphs[i]; + if (glyph === null) { + continue; + } + buildPath(glyph.fontChar); + + // If the glyph has an accent we need to build a path for its + // fontChar too, otherwise CanvasGraphics_paintChar will fail. + var accent = glyph.accent; + if (accent && accent.fontChar) { + buildPath(accent.fontChar); + } + } + } + + return glyphs; + }, + + setGState: function PartialEvaluator_setGState(resources, gState, + operatorList, task, + xref, stateManager) { + // This array holds the converted/processed state data. + var gStateObj = []; + var gStateMap = gState.map; + var self = this; + var promise = Promise.resolve(); + for (var key in gStateMap) { + var value = gStateMap[key]; + switch (key) { + case 'Type': + break; + case 'LW': + case 'LC': + case 'LJ': + case 'ML': + case 'D': + case 'RI': + case 'FL': + case 'CA': + case 'ca': + gStateObj.push([key, value]); + break; + case 'Font': + promise = promise.then(function () { + return self.handleSetFont(resources, null, value[0], operatorList, + task, stateManager.state). + then(function (loadedName) { + operatorList.addDependency(loadedName); + gStateObj.push([key, [loadedName, value[1]]]); + }); + }); + break; + case 'BM': + gStateObj.push([key, value]); + break; + case 'SMask': + if (isName(value) && value.name === 'None') { + gStateObj.push([key, false]); + break; + } + var dict = xref.fetchIfRef(value); + if (isDict(dict)) { + promise = promise.then(function () { + return self.handleSMask(dict, resources, operatorList, + task, stateManager); + }); + gStateObj.push([key, true]); + } else { + warn('Unsupported SMask type'); + } + + break; + // Only generate info log messages for the following since + // they are unlikely to have a big impact on the rendering. + case 'OP': + case 'op': + case 'OPM': + case 'BG': + case 'BG2': + case 'UCR': + case 'UCR2': + case 'TR': + case 'TR2': + case 'HT': + case 'SM': + case 'SA': + case 'AIS': + case 'TK': + // TODO implement these operators. + info('graphic state operator ' + key); + break; + default: + info('Unknown graphic state operator ' + key); + break; + } + } + return promise.then(function () { + if (gStateObj.length >= 0) { + operatorList.addOp(OPS.setGState, [gStateObj]); + } + }); + }, + + loadFont: function PartialEvaluator_loadFont(fontName, font, xref, + resources) { + + function errorFont() { + return Promise.resolve(new TranslatedFont('g_font_error', + new ErrorFont('Font ' + fontName + ' is not available'), font)); + } + var fontRef; + if (font) { // Loading by ref. + assert(isRef(font)); + fontRef = font; + } else { // Loading by name. + var fontRes = resources.get('Font'); + if (fontRes) { + fontRef = fontRes.getRaw(fontName); + } else { + warn('fontRes not available'); + return errorFont(); + } + } + if (!fontRef) { + warn('fontRef not available'); + return errorFont(); + } + + if (this.fontCache.has(fontRef)) { + return this.fontCache.get(fontRef); + } + + font = xref.fetchIfRef(fontRef); + if (!isDict(font)) { + return errorFont(); + } + + // We are holding font.translated references just for fontRef that are not + // dictionaries (Dict). See explanation below. + if (font.translated) { + return font.translated; + } + + var fontCapability = createPromiseCapability(); + + var preEvaluatedFont = this.preEvaluateFont(font, xref); + var descriptor = preEvaluatedFont.descriptor; + var fontID = fontRef.num + '_' + fontRef.gen; + if (isDict(descriptor)) { + if (!descriptor.fontAliases) { + descriptor.fontAliases = Object.create(null); + } + + var fontAliases = descriptor.fontAliases; + var hash = preEvaluatedFont.hash; + if (fontAliases[hash]) { + var aliasFontRef = fontAliases[hash].aliasRef; + if (aliasFontRef && this.fontCache.has(aliasFontRef)) { + this.fontCache.putAlias(fontRef, aliasFontRef); + return this.fontCache.get(fontRef); + } + } + + if (!fontAliases[hash]) { + fontAliases[hash] = { + fontID: Font.getFontID() + }; + } + + fontAliases[hash].aliasRef = fontRef; + fontID = fontAliases[hash].fontID; + } + + // Workaround for bad PDF generators that don't reference fonts + // properly, i.e. by not using an object identifier. + // Check if the fontRef is a Dict (as opposed to a standard object), + // in which case we don't cache the font and instead reference it by + // fontName in font.loadedName below. + var fontRefIsDict = isDict(fontRef); + if (!fontRefIsDict) { + this.fontCache.put(fontRef, fontCapability.promise); + } + + // Keep track of each font we translated so the caller can + // load them asynchronously before calling display on a page. + font.loadedName = 'g_font_' + (fontRefIsDict ? + fontName.replace(/\W/g, '') : fontID); + + font.translated = fontCapability.promise; + + // TODO move promises into translate font + var translatedPromise; + try { + translatedPromise = Promise.resolve( + this.translateFont(preEvaluatedFont, xref)); + } catch (e) { + translatedPromise = Promise.reject(e); + } + + translatedPromise.then(function (translatedFont) { + if (translatedFont.fontType !== undefined) { + var xrefFontStats = xref.stats.fontTypes; + xrefFontStats[translatedFont.fontType] = true; + } + + fontCapability.resolve(new TranslatedFont(font.loadedName, + translatedFont, font)); + }, function (reason) { + // TODO fontCapability.reject? + UnsupportedManager.notify(UNSUPPORTED_FEATURES.font); + + try { + // error, but it's still nice to have font type reported + var descriptor = preEvaluatedFont.descriptor; + var fontFile3 = descriptor && descriptor.get('FontFile3'); + var subtype = fontFile3 && fontFile3.get('Subtype'); + var fontType = getFontType(preEvaluatedFont.type, + subtype && subtype.name); + var xrefFontStats = xref.stats.fontTypes; + xrefFontStats[fontType] = true; + } catch (ex) { } + + fontCapability.resolve(new TranslatedFont(font.loadedName, + new ErrorFont(reason instanceof Error ? reason.message : reason), + font)); + }); + return fontCapability.promise; + }, + + buildPath: function PartialEvaluator_buildPath(operatorList, fn, args) { + var lastIndex = operatorList.length - 1; + if (!args) { + args = []; + } + if (lastIndex < 0 || + operatorList.fnArray[lastIndex] !== OPS.constructPath) { + operatorList.addOp(OPS.constructPath, [[fn], args]); + } else { + var opArgs = operatorList.argsArray[lastIndex]; + opArgs[0].push(fn); + Array.prototype.push.apply(opArgs[1], args); + } + }, + + handleColorN: function PartialEvaluator_handleColorN(operatorList, fn, args, + cs, patterns, resources, task, xref) { + // compile tiling patterns + var patternName = args[args.length - 1]; + // SCN/scn applies patterns along with normal colors + var pattern; + if (isName(patternName) && + (pattern = patterns.get(patternName.name))) { + var dict = (isStream(pattern) ? pattern.dict : pattern); + var typeNum = dict.get('PatternType'); + + if (typeNum === TILING_PATTERN) { + var color = cs.base ? cs.base.getRgb(args, 0) : null; + return this.handleTilingType(fn, color, resources, pattern, + dict, operatorList, task); + } else if (typeNum === SHADING_PATTERN) { + var shading = dict.get('Shading'); + var matrix = dict.get('Matrix'); + pattern = Pattern.parseShading(shading, matrix, xref, resources); + operatorList.addOp(fn, pattern.getIR()); + return Promise.resolve(); + } else { + return Promise.reject('Unknown PatternType: ' + typeNum); + } + } + // TODO shall we fail here? + operatorList.addOp(fn, args); + return Promise.resolve(); + }, + + getOperatorList: function PartialEvaluator_getOperatorList(stream, + task, + resources, + operatorList, + initialState) { + + var self = this; + var xref = this.xref; + var imageCache = {}; + + assert(operatorList); + + resources = (resources || Dict.empty); + var xobjs = (resources.get('XObject') || Dict.empty); + var patterns = (resources.get('Pattern') || Dict.empty); + var stateManager = new StateManager(initialState || new EvalState()); + var preprocessor = new EvaluatorPreprocessor(stream, xref, stateManager); + var timeSlotManager = new TimeSlotManager(); + + return new Promise(function next(resolve, reject) { + task.ensureNotTerminated(); + timeSlotManager.reset(); + var stop, operation = {}, i, ii, cs; + while (!(stop = timeSlotManager.check())) { + // The arguments parsed by read() are used beyond this loop, so we + // cannot reuse the same array on each iteration. Therefore we pass + // in |null| as the initial value (see the comment on + // EvaluatorPreprocessor_read() for why). + operation.args = null; + if (!(preprocessor.read(operation))) { + break; + } + var args = operation.args; + var fn = operation.fn; + + switch (fn | 0) { + case OPS.paintXObject: + if (args[0].code) { + break; + } + // eagerly compile XForm objects + var name = args[0].name; + if (!name) { + warn('XObject must be referred to by name.'); + continue; + } + if (imageCache[name] !== undefined) { + operatorList.addOp(imageCache[name].fn, imageCache[name].args); + args = null; + continue; + } + + var xobj = xobjs.get(name); + if (xobj) { + assert(isStream(xobj), 'XObject should be a stream'); + + var type = xobj.dict.get('Subtype'); + assert(isName(type), + 'XObject should have a Name subtype'); + + if (type.name === 'Form') { + stateManager.save(); + return self.buildFormXObject(resources, xobj, null, + operatorList, task, + stateManager.state.clone()). + then(function () { + stateManager.restore(); + next(resolve, reject); + }, reject); + } else if (type.name === 'Image') { + self.buildPaintImageXObject(resources, xobj, false, + operatorList, name, imageCache); + args = null; + continue; + } else if (type.name === 'PS') { + // PostScript XObjects are unused when viewing documents. + // See section 4.7.1 of Adobe's PDF reference. + info('Ignored XObject subtype PS'); + continue; + } else { + error('Unhandled XObject subtype ' + type.name); + } + } + break; + case OPS.setFont: + var fontSize = args[1]; + // eagerly collect all fonts + return self.handleSetFont(resources, args, null, operatorList, + task, stateManager.state). + then(function (loadedName) { + operatorList.addDependency(loadedName); + operatorList.addOp(OPS.setFont, [loadedName, fontSize]); + next(resolve, reject); + }, reject); + case OPS.endInlineImage: + var cacheKey = args[0].cacheKey; + if (cacheKey) { + var cacheEntry = imageCache[cacheKey]; + if (cacheEntry !== undefined) { + operatorList.addOp(cacheEntry.fn, cacheEntry.args); + args = null; + continue; + } + } + self.buildPaintImageXObject(resources, args[0], true, + operatorList, cacheKey, imageCache); + args = null; + continue; + case OPS.showText: + args[0] = self.handleText(args[0], stateManager.state); + break; + case OPS.showSpacedText: + var arr = args[0]; + var combinedGlyphs = []; + var arrLength = arr.length; + var state = stateManager.state; + for (i = 0; i < arrLength; ++i) { + var arrItem = arr[i]; + if (isString(arrItem)) { + Array.prototype.push.apply(combinedGlyphs, + self.handleText(arrItem, state)); + } else if (isNum(arrItem)) { + combinedGlyphs.push(arrItem); + } + } + args[0] = combinedGlyphs; + fn = OPS.showText; + break; + case OPS.nextLineShowText: + operatorList.addOp(OPS.nextLine); + args[0] = self.handleText(args[0], stateManager.state); + fn = OPS.showText; + break; + case OPS.nextLineSetSpacingShowText: + operatorList.addOp(OPS.nextLine); + operatorList.addOp(OPS.setWordSpacing, [args.shift()]); + operatorList.addOp(OPS.setCharSpacing, [args.shift()]); + args[0] = self.handleText(args[0], stateManager.state); + fn = OPS.showText; + break; + case OPS.setTextRenderingMode: + stateManager.state.textRenderingMode = args[0]; + break; + + case OPS.setFillColorSpace: + stateManager.state.fillColorSpace = + ColorSpace.parse(args[0], xref, resources); + continue; + case OPS.setStrokeColorSpace: + stateManager.state.strokeColorSpace = + ColorSpace.parse(args[0], xref, resources); + continue; + case OPS.setFillColor: + cs = stateManager.state.fillColorSpace; + args = cs.getRgb(args, 0); + fn = OPS.setFillRGBColor; + break; + case OPS.setStrokeColor: + cs = stateManager.state.strokeColorSpace; + args = cs.getRgb(args, 0); + fn = OPS.setStrokeRGBColor; + break; + case OPS.setFillGray: + stateManager.state.fillColorSpace = ColorSpace.singletons.gray; + args = ColorSpace.singletons.gray.getRgb(args, 0); + fn = OPS.setFillRGBColor; + break; + case OPS.setStrokeGray: + stateManager.state.strokeColorSpace = ColorSpace.singletons.gray; + args = ColorSpace.singletons.gray.getRgb(args, 0); + fn = OPS.setStrokeRGBColor; + break; + case OPS.setFillCMYKColor: + stateManager.state.fillColorSpace = ColorSpace.singletons.cmyk; + args = ColorSpace.singletons.cmyk.getRgb(args, 0); + fn = OPS.setFillRGBColor; + break; + case OPS.setStrokeCMYKColor: + stateManager.state.strokeColorSpace = ColorSpace.singletons.cmyk; + args = ColorSpace.singletons.cmyk.getRgb(args, 0); + fn = OPS.setStrokeRGBColor; + break; + case OPS.setFillRGBColor: + stateManager.state.fillColorSpace = ColorSpace.singletons.rgb; + args = ColorSpace.singletons.rgb.getRgb(args, 0); + break; + case OPS.setStrokeRGBColor: + stateManager.state.strokeColorSpace = ColorSpace.singletons.rgb; + args = ColorSpace.singletons.rgb.getRgb(args, 0); + break; + case OPS.setFillColorN: + cs = stateManager.state.fillColorSpace; + if (cs.name === 'Pattern') { + return self.handleColorN(operatorList, OPS.setFillColorN, + args, cs, patterns, resources, task, xref).then(function() { + next(resolve, reject); + }, reject); + } + args = cs.getRgb(args, 0); + fn = OPS.setFillRGBColor; + break; + case OPS.setStrokeColorN: + cs = stateManager.state.strokeColorSpace; + if (cs.name === 'Pattern') { + return self.handleColorN(operatorList, OPS.setStrokeColorN, + args, cs, patterns, resources, task, xref).then(function() { + next(resolve, reject); + }, reject); + } + args = cs.getRgb(args, 0); + fn = OPS.setStrokeRGBColor; + break; + + case OPS.shadingFill: + var shadingRes = resources.get('Shading'); + if (!shadingRes) { + error('No shading resource found'); + } + + var shading = shadingRes.get(args[0].name); + if (!shading) { + error('No shading object found'); + } + + var shadingFill = Pattern.parseShading(shading, null, xref, + resources); + var patternIR = shadingFill.getIR(); + args = [patternIR]; + fn = OPS.shadingFill; + break; + case OPS.setGState: + var dictName = args[0]; + var extGState = resources.get('ExtGState'); + + if (!isDict(extGState) || !extGState.has(dictName.name)) { + break; + } + + var gState = extGState.get(dictName.name); + return self.setGState(resources, gState, operatorList, task, + xref, stateManager).then(function() { + next(resolve, reject); + }, reject); + case OPS.moveTo: + case OPS.lineTo: + case OPS.curveTo: + case OPS.curveTo2: + case OPS.curveTo3: + case OPS.closePath: + self.buildPath(operatorList, fn, args); + continue; + case OPS.rectangle: + self.buildPath(operatorList, fn, args); + continue; + case OPS.markPoint: + case OPS.markPointProps: + case OPS.beginMarkedContent: + case OPS.beginMarkedContentProps: + case OPS.endMarkedContent: + case OPS.beginCompat: + case OPS.endCompat: + // Ignore operators where the corresponding handlers are known to + // be no-op in CanvasGraphics (display/canvas.js). This prevents + // serialization errors and is also a bit more efficient. + // We could also try to serialize all objects in a general way, + // e.g. as done in https://github.com/mozilla/pdf.js/pull/6266, + // but doing so is meaningless without knowing the semantics. + continue; + default: + // Note: Let's hope that the ignored operator does not have any + // non-serializable arguments, otherwise postMessage will throw + // "An object could not be cloned.". + } + operatorList.addOp(fn, args); + } + if (stop) { + deferred.then(function () { + next(resolve, reject); + }, reject); + return; + } + // Some PDFs don't close all restores inside object/form. + // Closing those for them. + for (i = 0, ii = preprocessor.savedStatesDepth; i < ii; i++) { + operatorList.addOp(OPS.restore, []); + } + resolve(); + }); + }, + + getTextContent: function PartialEvaluator_getTextContent(stream, task, + resources, + stateManager) { + + stateManager = (stateManager || new StateManager(new TextState())); + + var textContent = { + items: [], + styles: Object.create(null) + }; + var bidiTexts = textContent.items; + var SPACE_FACTOR = 0.3; + var MULTI_SPACE_FACTOR = 1.5; + + var self = this; + var xref = this.xref; + + resources = (xref.fetchIfRef(resources) || Dict.empty); + + // The xobj is parsed iff it's needed, e.g. if there is a `DO` cmd. + var xobjs = null; + var xobjsCache = {}; + + var preprocessor = new EvaluatorPreprocessor(stream, xref, stateManager); + + var textState; + + function newTextChunk() { + var font = textState.font; + if (!(font.loadedName in textContent.styles)) { + textContent.styles[font.loadedName] = { + fontFamily: font.fallbackName, + ascent: font.ascent, + descent: font.descent, + vertical: font.vertical + }; + } + return { + // |str| is initially an array which we push individual chars to, and + // then runBidi() overwrites it with the final string. + str: [], + dir: null, + width: 0, + height: 0, + transform: null, + fontName: font.loadedName + }; + } + + function runBidi(textChunk) { + var str = textChunk.str.join(''); + var bidiResult = PDFJS.bidi(str, -1, textState.font.vertical); + textChunk.str = bidiResult.str; + textChunk.dir = bidiResult.dir; + return textChunk; + } + + function handleSetFont(fontName, fontRef) { + return self.loadFont(fontName, fontRef, xref, resources). + then(function (translated) { + textState.font = translated.font; + textState.fontMatrix = translated.font.fontMatrix || + FONT_IDENTITY_MATRIX; + }); + } + + function buildTextGeometry(chars, textChunk) { + var font = textState.font; + textChunk = textChunk || newTextChunk(); + if (!textChunk.transform) { + // 9.4.4 Text Space Details + var tsm = [textState.fontSize * textState.textHScale, 0, + 0, textState.fontSize, + 0, textState.textRise]; + + if (font.isType3Font && + textState.fontMatrix !== FONT_IDENTITY_MATRIX && + textState.fontSize === 1) { + var glyphHeight = font.bbox[3] - font.bbox[1]; + if (glyphHeight > 0) { + glyphHeight = glyphHeight * textState.fontMatrix[3]; + tsm[3] *= glyphHeight; + } + } + + var trm = textChunk.transform = Util.transform(textState.ctm, + Util.transform(textState.textMatrix, tsm)); + if (!font.vertical) { + textChunk.height = Math.sqrt(trm[2] * trm[2] + trm[3] * trm[3]); + } else { + textChunk.width = Math.sqrt(trm[0] * trm[0] + trm[1] * trm[1]); + } + } + var width = 0; + var height = 0; + var glyphs = font.charsToGlyphs(chars); + var defaultVMetrics = font.defaultVMetrics; + for (var i = 0; i < glyphs.length; i++) { + var glyph = glyphs[i]; + if (!glyph) { // Previous glyph was a space. + width += textState.wordSpacing * textState.textHScale; + continue; + } + var vMetricX = null; + var vMetricY = null; + var glyphWidth = null; + if (font.vertical) { + if (glyph.vmetric) { + glyphWidth = glyph.vmetric[0]; + vMetricX = glyph.vmetric[1]; + vMetricY = glyph.vmetric[2]; + } else { + glyphWidth = glyph.width; + vMetricX = glyph.width * 0.5; + vMetricY = defaultVMetrics[2]; + } + } else { + glyphWidth = glyph.width; + } + + var glyphUnicode = glyph.unicode; + if (NormalizedUnicodes[glyphUnicode] !== undefined) { + glyphUnicode = NormalizedUnicodes[glyphUnicode]; + } + glyphUnicode = reverseIfRtl(glyphUnicode); + + // The following will calculate the x and y of the individual glyphs. + // if (font.vertical) { + // tsm[4] -= vMetricX * Math.abs(textState.fontSize) * + // textState.fontMatrix[0]; + // tsm[5] -= vMetricY * textState.fontSize * + // textState.fontMatrix[0]; + // } + // var trm = Util.transform(textState.textMatrix, tsm); + // var pt = Util.applyTransform([trm[4], trm[5]], textState.ctm); + // var x = pt[0]; + // var y = pt[1]; + + var charSpacing = 0; + if (textChunk.str.length > 0) { + // Apply char spacing only when there are chars. + // As a result there is only spacing between glyphs. + charSpacing = textState.charSpacing; + } + + var tx = 0; + var ty = 0; + if (!font.vertical) { + var w0 = glyphWidth * textState.fontMatrix[0]; + tx = (w0 * textState.fontSize + charSpacing) * + textState.textHScale; + width += tx; + } else { + var w1 = glyphWidth * textState.fontMatrix[0]; + ty = w1 * textState.fontSize + charSpacing; + height += ty; + } + textState.translateTextMatrix(tx, ty); + + textChunk.str.push(glyphUnicode); + } + + var a = textState.textLineMatrix[0]; + var b = textState.textLineMatrix[1]; + var scaleLineX = Math.sqrt(a * a + b * b); + a = textState.ctm[0]; + b = textState.ctm[1]; + var scaleCtmX = Math.sqrt(a * a + b * b); + if (!font.vertical) { + textChunk.width += width * scaleCtmX * scaleLineX; + } else { + textChunk.height += Math.abs(height * scaleCtmX * scaleLineX); + } + return textChunk; + } + + var timeSlotManager = new TimeSlotManager(); + + return new Promise(function next(resolve, reject) { + task.ensureNotTerminated(); + timeSlotManager.reset(); + var stop, operation = {}, args = []; + while (!(stop = timeSlotManager.check())) { + // The arguments parsed by read() are not used beyond this loop, so + // we can reuse the same array on every iteration, thus avoiding + // unnecessary allocations. + args.length = 0; + operation.args = args; + if (!(preprocessor.read(operation))) { + break; + } + textState = stateManager.state; + var fn = operation.fn; + args = operation.args; + + switch (fn | 0) { + case OPS.setFont: + textState.fontSize = args[1]; + return handleSetFont(args[0].name).then(function() { + next(resolve, reject); + }, reject); + case OPS.setTextRise: + textState.textRise = args[0]; + break; + case OPS.setHScale: + textState.textHScale = args[0] / 100; + break; + case OPS.setLeading: + textState.leading = args[0]; + break; + case OPS.moveText: + textState.translateTextLineMatrix(args[0], args[1]); + textState.textMatrix = textState.textLineMatrix.slice(); + break; + case OPS.setLeadingMoveText: + textState.leading = -args[1]; + textState.translateTextLineMatrix(args[0], args[1]); + textState.textMatrix = textState.textLineMatrix.slice(); + break; + case OPS.nextLine: + textState.carriageReturn(); + break; + case OPS.setTextMatrix: + textState.setTextMatrix(args[0], args[1], args[2], args[3], + args[4], args[5]); + textState.setTextLineMatrix(args[0], args[1], args[2], args[3], + args[4], args[5]); + break; + case OPS.setCharSpacing: + textState.charSpacing = args[0]; + break; + case OPS.setWordSpacing: + textState.wordSpacing = args[0]; + break; + case OPS.beginText: + textState.textMatrix = IDENTITY_MATRIX.slice(); + textState.textLineMatrix = IDENTITY_MATRIX.slice(); + break; + case OPS.showSpacedText: + var items = args[0]; + var textChunk = newTextChunk(); + var offset; + for (var j = 0, jj = items.length; j < jj; j++) { + if (typeof items[j] === 'string') { + buildTextGeometry(items[j], textChunk); + } else { + // PDF Specification 5.3.2 states: + // The number is expressed in thousandths of a unit of text + // space. + // This amount is subtracted from the current horizontal or + // vertical coordinate, depending on the writing mode. + // In the default coordinate system, a positive adjustment + // has the effect of moving the next glyph painted either to + // the left or down by the given amount. + var val = items[j] * textState.fontSize / 1000; + if (textState.font.vertical) { + offset = val * textState.textMatrix[3]; + textState.translateTextMatrix(0, offset); + // Value needs to be added to height to paint down. + textChunk.height += offset; + } else { + offset = val * textState.textHScale * + textState.textMatrix[0]; + textState.translateTextMatrix(offset, 0); + // Value needs to be subtracted from width to paint left. + textChunk.width -= offset; + } + if (items[j] < 0 && textState.font.spaceWidth > 0) { + var fakeSpaces = -items[j] / textState.font.spaceWidth; + if (fakeSpaces > MULTI_SPACE_FACTOR) { + fakeSpaces = Math.round(fakeSpaces); + while (fakeSpaces--) { + textChunk.str.push(' '); + } + } else if (fakeSpaces > SPACE_FACTOR) { + textChunk.str.push(' '); + } + } + } + } + bidiTexts.push(runBidi(textChunk)); + break; + case OPS.showText: + bidiTexts.push(runBidi(buildTextGeometry(args[0]))); + break; + case OPS.nextLineShowText: + textState.carriageReturn(); + bidiTexts.push(runBidi(buildTextGeometry(args[0]))); + break; + case OPS.nextLineSetSpacingShowText: + textState.wordSpacing = args[0]; + textState.charSpacing = args[1]; + textState.carriageReturn(); + bidiTexts.push(runBidi(buildTextGeometry(args[2]))); + break; + case OPS.paintXObject: + if (args[0].code) { + break; + } + + if (!xobjs) { + xobjs = (resources.get('XObject') || Dict.empty); + } + + var name = args[0].name; + if (xobjsCache.key === name) { + if (xobjsCache.texts) { + Util.appendToArray(bidiTexts, xobjsCache.texts.items); + Util.extendObj(textContent.styles, xobjsCache.texts.styles); + } + break; + } + + var xobj = xobjs.get(name); + if (!xobj) { + break; + } + assert(isStream(xobj), 'XObject should be a stream'); + + var type = xobj.dict.get('Subtype'); + assert(isName(type), + 'XObject should have a Name subtype'); + + if ('Form' !== type.name) { + xobjsCache.key = name; + xobjsCache.texts = null; + break; + } + + stateManager.save(); + var matrix = xobj.dict.get('Matrix'); + if (isArray(matrix) && matrix.length === 6) { + stateManager.transform(matrix); + } + + return self.getTextContent(xobj, task, + xobj.dict.get('Resources') || resources, stateManager). + then(function (formTextContent) { + Util.appendToArray(bidiTexts, formTextContent.items); + Util.extendObj(textContent.styles, formTextContent.styles); + stateManager.restore(); + + xobjsCache.key = name; + xobjsCache.texts = formTextContent; + + next(resolve, reject); + }, reject); + case OPS.setGState: + var dictName = args[0]; + var extGState = resources.get('ExtGState'); + + if (!isDict(extGState) || !extGState.has(dictName.name)) { + break; + } + + var gsStateMap = extGState.get(dictName.name); + var gsStateFont = null; + for (var key in gsStateMap) { + if (key === 'Font') { + assert(!gsStateFont); + gsStateFont = gsStateMap[key]; + } + } + if (gsStateFont) { + textState.fontSize = gsStateFont[1]; + return handleSetFont(gsStateFont[0]).then(function() { + next(resolve, reject); + }, reject); + } + break; + } // switch + } // while + if (stop) { + deferred.then(function () { + next(resolve, reject); + }, reject); + return; + } + resolve(textContent); + }); + }, + + extractDataStructures: function + partialEvaluatorExtractDataStructures(dict, baseDict, + xref, properties) { + // 9.10.2 + var toUnicode = (dict.get('ToUnicode') || baseDict.get('ToUnicode')); + if (toUnicode) { + properties.toUnicode = this.readToUnicode(toUnicode); + } + if (properties.composite) { + // CIDSystemInfo helps to match CID to glyphs + var cidSystemInfo = dict.get('CIDSystemInfo'); + if (isDict(cidSystemInfo)) { + properties.cidSystemInfo = { + registry: cidSystemInfo.get('Registry'), + ordering: cidSystemInfo.get('Ordering'), + supplement: cidSystemInfo.get('Supplement') + }; + } + + var cidToGidMap = dict.get('CIDToGIDMap'); + if (isStream(cidToGidMap)) { + properties.cidToGidMap = this.readCidToGidMap(cidToGidMap); + } + } + + // Based on 9.6.6 of the spec the encoding can come from multiple places + // and depends on the font type. The base encoding and differences are + // read here, but the encoding that is actually used is chosen during + // glyph mapping in the font. + // TODO: Loading the built in encoding in the font would allow the + // differences to be merged in here not require us to hold on to it. + var differences = []; + var baseEncodingName = null; + var encoding; + if (dict.has('Encoding')) { + encoding = dict.get('Encoding'); + if (isDict(encoding)) { + baseEncodingName = encoding.get('BaseEncoding'); + baseEncodingName = (isName(baseEncodingName) ? + baseEncodingName.name : null); + // Load the differences between the base and original + if (encoding.has('Differences')) { + var diffEncoding = encoding.get('Differences'); + var index = 0; + for (var j = 0, jj = diffEncoding.length; j < jj; j++) { + var data = diffEncoding[j]; + if (isNum(data)) { + index = data; + } else if (isName(data)) { + differences[index++] = data.name; + } else if (isRef(data)) { + diffEncoding[j--] = xref.fetch(data); + continue; + } else { + error('Invalid entry in \'Differences\' array: ' + data); + } + } + } + } else if (isName(encoding)) { + baseEncodingName = encoding.name; + } else { + error('Encoding is not a Name nor a Dict'); + } + // According to table 114 if the encoding is a named encoding it must be + // one of these predefined encodings. + if ((baseEncodingName !== 'MacRomanEncoding' && + baseEncodingName !== 'MacExpertEncoding' && + baseEncodingName !== 'WinAnsiEncoding')) { + baseEncodingName = null; + } + } + + if (baseEncodingName) { + properties.defaultEncoding = Encodings[baseEncodingName].slice(); + } else { + encoding = (properties.type === 'TrueType' ? + Encodings.WinAnsiEncoding : Encodings.StandardEncoding); + // The Symbolic attribute can be misused for regular fonts + // Heuristic: we have to check if the font is a standard one also + if (!!(properties.flags & FontFlags.Symbolic)) { + encoding = Encodings.MacRomanEncoding; + if (!properties.file) { + if (/Symbol/i.test(properties.name)) { + encoding = Encodings.SymbolSetEncoding; + } else if (/Dingbats/i.test(properties.name)) { + encoding = Encodings.ZapfDingbatsEncoding; + } + } + } + properties.defaultEncoding = encoding; + } + + properties.differences = differences; + properties.baseEncodingName = baseEncodingName; + properties.dict = dict; + }, + + readToUnicode: function PartialEvaluator_readToUnicode(toUnicode) { + var cmap, cmapObj = toUnicode; + if (isName(cmapObj)) { + cmap = CMapFactory.create(cmapObj, + { url: PDFJS.cMapUrl, packed: PDFJS.cMapPacked }, null); + if (cmap instanceof IdentityCMap) { + return new IdentityToUnicodeMap(0, 0xFFFF); + } + return new ToUnicodeMap(cmap.getMap()); + } else if (isStream(cmapObj)) { + cmap = CMapFactory.create(cmapObj, + { url: PDFJS.cMapUrl, packed: PDFJS.cMapPacked }, null); + if (cmap instanceof IdentityCMap) { + return new IdentityToUnicodeMap(0, 0xFFFF); + } + var map = new Array(cmap.length); + // Convert UTF-16BE + // NOTE: cmap can be a sparse array, so use forEach instead of for(;;) + // to iterate over all keys. + cmap.forEach(function(charCode, token) { + var str = []; + for (var k = 0; k < token.length; k += 2) { + var w1 = (token.charCodeAt(k) << 8) | token.charCodeAt(k + 1); + if ((w1 & 0xF800) !== 0xD800) { // w1 < 0xD800 || w1 > 0xDFFF + str.push(w1); + continue; + } + k += 2; + var w2 = (token.charCodeAt(k) << 8) | token.charCodeAt(k + 1); + str.push(((w1 & 0x3ff) << 10) + (w2 & 0x3ff) + 0x10000); + } + map[charCode] = String.fromCharCode.apply(String, str); + }); + return new ToUnicodeMap(map); + } + return null; + }, + + readCidToGidMap: function PartialEvaluator_readCidToGidMap(cidToGidStream) { + // Extract the encoding from the CIDToGIDMap + var glyphsData = cidToGidStream.getBytes(); + + // Set encoding 0 to later verify the font has an encoding + var result = []; + for (var j = 0, jj = glyphsData.length; j < jj; j++) { + var glyphID = (glyphsData[j++] << 8) | glyphsData[j]; + if (glyphID === 0) { + continue; + } + var code = j >> 1; + result[code] = glyphID; + } + return result; + }, + + extractWidths: function PartialEvaluator_extractWidths(dict, xref, + descriptor, + properties) { + var glyphsWidths = []; + var defaultWidth = 0; + var glyphsVMetrics = []; + var defaultVMetrics; + var i, ii, j, jj, start, code, widths; + if (properties.composite) { + defaultWidth = dict.get('DW') || 1000; + + widths = dict.get('W'); + if (widths) { + for (i = 0, ii = widths.length; i < ii; i++) { + start = widths[i++]; + code = xref.fetchIfRef(widths[i]); + if (isArray(code)) { + for (j = 0, jj = code.length; j < jj; j++) { + glyphsWidths[start++] = code[j]; + } + } else { + var width = widths[++i]; + for (j = start; j <= code; j++) { + glyphsWidths[j] = width; + } + } + } + } + + if (properties.vertical) { + var vmetrics = (dict.get('DW2') || [880, -1000]); + defaultVMetrics = [vmetrics[1], defaultWidth * 0.5, vmetrics[0]]; + vmetrics = dict.get('W2'); + if (vmetrics) { + for (i = 0, ii = vmetrics.length; i < ii; i++) { + start = vmetrics[i++]; + code = xref.fetchIfRef(vmetrics[i]); + if (isArray(code)) { + for (j = 0, jj = code.length; j < jj; j++) { + glyphsVMetrics[start++] = [code[j++], code[j++], code[j]]; + } + } else { + var vmetric = [vmetrics[++i], vmetrics[++i], vmetrics[++i]]; + for (j = start; j <= code; j++) { + glyphsVMetrics[j] = vmetric; + } + } + } + } + } + } else { + var firstChar = properties.firstChar; + widths = dict.get('Widths'); + if (widths) { + j = firstChar; + for (i = 0, ii = widths.length; i < ii; i++) { + glyphsWidths[j++] = widths[i]; + } + defaultWidth = (parseFloat(descriptor.get('MissingWidth')) || 0); + } else { + // Trying get the BaseFont metrics (see comment above). + var baseFontName = dict.get('BaseFont'); + if (isName(baseFontName)) { + var metrics = this.getBaseFontMetrics(baseFontName.name); + + glyphsWidths = this.buildCharCodeToWidth(metrics.widths, + properties); + defaultWidth = metrics.defaultWidth; + } + } + } + + // Heuristic: detection of monospace font by checking all non-zero widths + var isMonospace = true; + var firstWidth = defaultWidth; + for (var glyph in glyphsWidths) { + var glyphWidth = glyphsWidths[glyph]; + if (!glyphWidth) { + continue; + } + if (!firstWidth) { + firstWidth = glyphWidth; + continue; + } + if (firstWidth !== glyphWidth) { + isMonospace = false; + break; + } + } + if (isMonospace) { + properties.flags |= FontFlags.FixedPitch; + } + + properties.defaultWidth = defaultWidth; + properties.widths = glyphsWidths; + properties.defaultVMetrics = defaultVMetrics; + properties.vmetrics = glyphsVMetrics; + }, + + isSerifFont: function PartialEvaluator_isSerifFont(baseFontName) { + // Simulating descriptor flags attribute + var fontNameWoStyle = baseFontName.split('-')[0]; + return (fontNameWoStyle in serifFonts) || + (fontNameWoStyle.search(/serif/gi) !== -1); + }, + + getBaseFontMetrics: function PartialEvaluator_getBaseFontMetrics(name) { + var defaultWidth = 0; + var widths = []; + var monospace = false; + var lookupName = (stdFontMap[name] || name); + + if (!(lookupName in Metrics)) { + // Use default fonts for looking up font metrics if the passed + // font is not a base font + if (this.isSerifFont(name)) { + lookupName = 'Times-Roman'; + } else { + lookupName = 'Helvetica'; + } + } + var glyphWidths = Metrics[lookupName]; + + if (isNum(glyphWidths)) { + defaultWidth = glyphWidths; + monospace = true; + } else { + widths = glyphWidths; + } + + return { + defaultWidth: defaultWidth, + monospace: monospace, + widths: widths + }; + }, + + buildCharCodeToWidth: + function PartialEvaluator_bulildCharCodeToWidth(widthsByGlyphName, + properties) { + var widths = Object.create(null); + var differences = properties.differences; + var encoding = properties.defaultEncoding; + for (var charCode = 0; charCode < 256; charCode++) { + if (charCode in differences && + widthsByGlyphName[differences[charCode]]) { + widths[charCode] = widthsByGlyphName[differences[charCode]]; + continue; + } + if (charCode in encoding && widthsByGlyphName[encoding[charCode]]) { + widths[charCode] = widthsByGlyphName[encoding[charCode]]; + continue; + } + } + return widths; + }, + + preEvaluateFont: function PartialEvaluator_preEvaluateFont(dict, xref) { + var baseDict = dict; + var type = dict.get('Subtype'); + assert(isName(type), 'invalid font Subtype'); + + var composite = false; + var uint8array; + if (type.name === 'Type0') { + // If font is a composite + // - get the descendant font + // - set the type according to the descendant font + // - get the FontDescriptor from the descendant font + var df = dict.get('DescendantFonts'); + if (!df) { + error('Descendant fonts are not specified'); + } + dict = (isArray(df) ? xref.fetchIfRef(df[0]) : df); + + type = dict.get('Subtype'); + assert(isName(type), 'invalid font Subtype'); + composite = true; + } + + var descriptor = dict.get('FontDescriptor'); + if (descriptor) { + var hash = new MurmurHash3_64(); + var encoding = baseDict.getRaw('Encoding'); + if (isName(encoding)) { + hash.update(encoding.name); + } else if (isRef(encoding)) { + hash.update(encoding.num + '_' + encoding.gen); + } else if (isDict(encoding)) { + var keys = encoding.getKeys(); + for (var i = 0, ii = keys.length; i < ii; i++) { + var entry = encoding.getRaw(keys[i]); + if (isName(entry)) { + hash.update(entry.name); + } else if (isRef(entry)) { + hash.update(entry.num + '_' + entry.gen); + } else if (isArray(entry)) { // 'Differences' entry. + // Ideally we should check the contents of the array, but to avoid + // parsing it here and then again in |extractDataStructures|, + // we only use the array length for now (fixes bug1157493.pdf). + hash.update(entry.length.toString()); + } + } + } + + var toUnicode = dict.get('ToUnicode') || baseDict.get('ToUnicode'); + if (isStream(toUnicode)) { + var stream = toUnicode.str || toUnicode; + uint8array = stream.buffer ? + new Uint8Array(stream.buffer.buffer, 0, stream.bufferLength) : + new Uint8Array(stream.bytes.buffer, + stream.start, stream.end - stream.start); + hash.update(uint8array); + + } else if (isName(toUnicode)) { + hash.update(toUnicode.name); + } + + var widths = dict.get('Widths') || baseDict.get('Widths'); + if (widths) { + uint8array = new Uint8Array(new Uint32Array(widths).buffer); + hash.update(uint8array); + } + } + + return { + descriptor: descriptor, + dict: dict, + baseDict: baseDict, + composite: composite, + type: type.name, + hash: hash ? hash.hexdigest() : '' + }; + }, + + translateFont: function PartialEvaluator_translateFont(preEvaluatedFont, + xref) { + var baseDict = preEvaluatedFont.baseDict; + var dict = preEvaluatedFont.dict; + var composite = preEvaluatedFont.composite; + var descriptor = preEvaluatedFont.descriptor; + var type = preEvaluatedFont.type; + var maxCharIndex = (composite ? 0xFFFF : 0xFF); + var properties; + + if (!descriptor) { + if (type === 'Type3') { + // FontDescriptor is only required for Type3 fonts when the document + // is a tagged pdf. Create a barbebones one to get by. + descriptor = new Dict(null); + descriptor.set('FontName', Name.get(type)); + descriptor.set('FontBBox', dict.get('FontBBox')); + } else { + // Before PDF 1.5 if the font was one of the base 14 fonts, having a + // FontDescriptor was not required. + // This case is here for compatibility. + var baseFontName = dict.get('BaseFont'); + if (!isName(baseFontName)) { + error('Base font is not specified'); + } + + // Using base font name as a font name. + baseFontName = baseFontName.name.replace(/[,_]/g, '-'); + var metrics = this.getBaseFontMetrics(baseFontName); + + // Simulating descriptor flags attribute + var fontNameWoStyle = baseFontName.split('-')[0]; + var flags = + (this.isSerifFont(fontNameWoStyle) ? FontFlags.Serif : 0) | + (metrics.monospace ? FontFlags.FixedPitch : 0) | + (symbolsFonts[fontNameWoStyle] ? FontFlags.Symbolic : + FontFlags.Nonsymbolic); + + properties = { + type: type, + name: baseFontName, + widths: metrics.widths, + defaultWidth: metrics.defaultWidth, + flags: flags, + firstChar: 0, + lastChar: maxCharIndex + }; + this.extractDataStructures(dict, dict, xref, properties); + properties.widths = this.buildCharCodeToWidth(metrics.widths, + properties); + return new Font(baseFontName, null, properties); + } + } + + // According to the spec if 'FontDescriptor' is declared, 'FirstChar', + // 'LastChar' and 'Widths' should exist too, but some PDF encoders seem + // to ignore this rule when a variant of a standart font is used. + // TODO Fill the width array depending on which of the base font this is + // a variant. + var firstChar = (dict.get('FirstChar') || 0); + var lastChar = (dict.get('LastChar') || maxCharIndex); + + var fontName = descriptor.get('FontName'); + var baseFont = dict.get('BaseFont'); + // Some bad PDFs have a string as the font name. + if (isString(fontName)) { + fontName = Name.get(fontName); + } + if (isString(baseFont)) { + baseFont = Name.get(baseFont); + } + + if (type !== 'Type3') { + var fontNameStr = fontName && fontName.name; + var baseFontStr = baseFont && baseFont.name; + if (fontNameStr !== baseFontStr) { + info('The FontDescriptor\'s FontName is "' + fontNameStr + + '" but should be the same as the Font\'s BaseFont "' + + baseFontStr + '"'); + // Workaround for cases where e.g. fontNameStr = 'Arial' and + // baseFontStr = 'Arial,Bold' (needed when no font file is embedded). + if (fontNameStr && baseFontStr && + baseFontStr.indexOf(fontNameStr) === 0) { + fontName = baseFont; + } + } + } + fontName = (fontName || baseFont); + + assert(isName(fontName), 'invalid font name'); + + var fontFile = descriptor.get('FontFile', 'FontFile2', 'FontFile3'); + if (fontFile) { + if (fontFile.dict) { + var subtype = fontFile.dict.get('Subtype'); + if (subtype) { + subtype = subtype.name; + } + var length1 = fontFile.dict.get('Length1'); + var length2 = fontFile.dict.get('Length2'); + } + } + + properties = { + type: type, + name: fontName.name, + subtype: subtype, + file: fontFile, + length1: length1, + length2: length2, + loadedName: baseDict.loadedName, + composite: composite, + wideChars: composite, + fixedPitch: false, + fontMatrix: (dict.get('FontMatrix') || FONT_IDENTITY_MATRIX), + firstChar: firstChar || 0, + lastChar: (lastChar || maxCharIndex), + bbox: descriptor.get('FontBBox'), + ascent: descriptor.get('Ascent'), + descent: descriptor.get('Descent'), + xHeight: descriptor.get('XHeight'), + capHeight: descriptor.get('CapHeight'), + flags: descriptor.get('Flags'), + italicAngle: descriptor.get('ItalicAngle'), + coded: false + }; + + if (composite) { + var cidEncoding = baseDict.get('Encoding'); + if (isName(cidEncoding)) { + properties.cidEncoding = cidEncoding.name; + } + properties.cMap = CMapFactory.create(cidEncoding, + { url: PDFJS.cMapUrl, packed: PDFJS.cMapPacked }, null); + properties.vertical = properties.cMap.vertical; + } + this.extractDataStructures(dict, baseDict, xref, properties); + this.extractWidths(dict, xref, descriptor, properties); + + if (type === 'Type3') { + properties.isType3Font = true; + } + + return new Font(fontName.name, fontFile, properties); + } + }; + + return PartialEvaluator; +})(); + +var TranslatedFont = (function TranslatedFontClosure() { + function TranslatedFont(loadedName, font, dict) { + this.loadedName = loadedName; + this.font = font; + this.dict = dict; + this.type3Loaded = null; + this.sent = false; + } + TranslatedFont.prototype = { + send: function (handler) { + if (this.sent) { + return; + } + var fontData = this.font.exportData(); + handler.send('commonobj', [ + this.loadedName, + 'Font', + fontData + ]); + this.sent = true; + }, + loadType3Data: function (evaluator, resources, parentOperatorList, task) { + assert(this.font.isType3Font); + + if (this.type3Loaded) { + return this.type3Loaded; + } + + var translatedFont = this.font; + var loadCharProcsPromise = Promise.resolve(); + var charProcs = this.dict.get('CharProcs').getAll(); + var fontResources = this.dict.get('Resources') || resources; + var charProcKeys = Object.keys(charProcs); + var charProcOperatorList = {}; + for (var i = 0, n = charProcKeys.length; i < n; ++i) { + loadCharProcsPromise = loadCharProcsPromise.then(function (key) { + var glyphStream = charProcs[key]; + var operatorList = new OperatorList(); + return evaluator.getOperatorList(glyphStream, task, fontResources, + operatorList).then(function () { + charProcOperatorList[key] = operatorList.getIR(); + + // Add the dependencies to the parent operator list so they are + // resolved before sub operator list is executed synchronously. + parentOperatorList.addDependencies(operatorList.dependencies); + }, function (reason) { + warn('Type3 font resource \"' + key + '\" is not available'); + var operatorList = new OperatorList(); + charProcOperatorList[key] = operatorList.getIR(); + }); + }.bind(this, charProcKeys[i])); + } + this.type3Loaded = loadCharProcsPromise.then(function () { + translatedFont.charProcOperatorList = charProcOperatorList; + }); + return this.type3Loaded; + } + }; + return TranslatedFont; +})(); + +var OperatorList = (function OperatorListClosure() { + var CHUNK_SIZE = 1000; + var CHUNK_SIZE_ABOUT = CHUNK_SIZE - 5; // close to chunk size + + function getTransfers(queue) { + var transfers = []; + var fnArray = queue.fnArray, argsArray = queue.argsArray; + for (var i = 0, ii = queue.length; i < ii; i++) { + switch (fnArray[i]) { + case OPS.paintInlineImageXObject: + case OPS.paintInlineImageXObjectGroup: + case OPS.paintImageMaskXObject: + var arg = argsArray[i][0]; // first param in imgData + if (!arg.cached) { + transfers.push(arg.data.buffer); + } + break; + } + } + return transfers; + } + + function OperatorList(intent, messageHandler, pageIndex) { + this.messageHandler = messageHandler; + this.fnArray = []; + this.argsArray = []; + this.dependencies = {}; + this.pageIndex = pageIndex; + this.intent = intent; + } + + OperatorList.prototype = { + get length() { + return this.argsArray.length; + }, + + addOp: function(fn, args) { + this.fnArray.push(fn); + this.argsArray.push(args); + if (this.messageHandler) { + if (this.fnArray.length >= CHUNK_SIZE) { + this.flush(); + } else if (this.fnArray.length >= CHUNK_SIZE_ABOUT && + (fn === OPS.restore || fn === OPS.endText)) { + // heuristic to flush on boundary of restore or endText + this.flush(); + } + } + }, + + addDependency: function(dependency) { + if (dependency in this.dependencies) { + return; + } + this.dependencies[dependency] = true; + this.addOp(OPS.dependency, [dependency]); + }, + + addDependencies: function(dependencies) { + for (var key in dependencies) { + this.addDependency(key); + } + }, + + addOpList: function(opList) { + Util.extendObj(this.dependencies, opList.dependencies); + for (var i = 0, ii = opList.length; i < ii; i++) { + this.addOp(opList.fnArray[i], opList.argsArray[i]); + } + }, + + getIR: function() { + return { + fnArray: this.fnArray, + argsArray: this.argsArray, + length: this.length + }; + }, + + flush: function(lastChunk) { + if (this.intent !== 'oplist') { + new QueueOptimizer().optimize(this); + } + var transfers = getTransfers(this); + this.messageHandler.send('RenderPageChunk', { + operatorList: { + fnArray: this.fnArray, + argsArray: this.argsArray, + lastChunk: lastChunk, + length: this.length + }, + pageIndex: this.pageIndex, + intent: this.intent + }, transfers); + this.dependencies = {}; + this.fnArray.length = 0; + this.argsArray.length = 0; + } + }; + + return OperatorList; +})(); + +var StateManager = (function StateManagerClosure() { + function StateManager(initialState) { + this.state = initialState; + this.stateStack = []; + } + StateManager.prototype = { + save: function () { + var old = this.state; + this.stateStack.push(this.state); + this.state = old.clone(); + }, + restore: function () { + var prev = this.stateStack.pop(); + if (prev) { + this.state = prev; + } + }, + transform: function (args) { + this.state.ctm = Util.transform(this.state.ctm, args); + } + }; + return StateManager; +})(); + +var TextState = (function TextStateClosure() { + function TextState() { + this.ctm = new Float32Array(IDENTITY_MATRIX); + this.fontSize = 0; + this.font = null; + this.fontMatrix = FONT_IDENTITY_MATRIX; + this.textMatrix = IDENTITY_MATRIX.slice(); + this.textLineMatrix = IDENTITY_MATRIX.slice(); + this.charSpacing = 0; + this.wordSpacing = 0; + this.leading = 0; + this.textHScale = 1; + this.textRise = 0; + } + + TextState.prototype = { + setTextMatrix: function TextState_setTextMatrix(a, b, c, d, e, f) { + var m = this.textMatrix; + m[0] = a; m[1] = b; m[2] = c; m[3] = d; m[4] = e; m[5] = f; + }, + setTextLineMatrix: function TextState_setTextMatrix(a, b, c, d, e, f) { + var m = this.textLineMatrix; + m[0] = a; m[1] = b; m[2] = c; m[3] = d; m[4] = e; m[5] = f; + }, + translateTextMatrix: function TextState_translateTextMatrix(x, y) { + var m = this.textMatrix; + m[4] = m[0] * x + m[2] * y + m[4]; + m[5] = m[1] * x + m[3] * y + m[5]; + }, + translateTextLineMatrix: function TextState_translateTextMatrix(x, y) { + var m = this.textLineMatrix; + m[4] = m[0] * x + m[2] * y + m[4]; + m[5] = m[1] * x + m[3] * y + m[5]; + }, + calcRenderMatrix: function TextState_calcRendeMatrix(ctm) { + // 9.4.4 Text Space Details + var tsm = [this.fontSize * this.textHScale, 0, + 0, this.fontSize, + 0, this.textRise]; + return Util.transform(ctm, Util.transform(this.textMatrix, tsm)); + }, + carriageReturn: function TextState_carriageReturn() { + this.translateTextLineMatrix(0, -this.leading); + this.textMatrix = this.textLineMatrix.slice(); + }, + clone: function TextState_clone() { + var clone = Object.create(this); + clone.textMatrix = this.textMatrix.slice(); + clone.textLineMatrix = this.textLineMatrix.slice(); + clone.fontMatrix = this.fontMatrix.slice(); + return clone; + } + }; + return TextState; +})(); + +var EvalState = (function EvalStateClosure() { + function EvalState() { + this.ctm = new Float32Array(IDENTITY_MATRIX); + this.font = null; + this.textRenderingMode = TextRenderingMode.FILL; + this.fillColorSpace = ColorSpace.singletons.gray; + this.strokeColorSpace = ColorSpace.singletons.gray; + } + EvalState.prototype = { + clone: function CanvasExtraState_clone() { + return Object.create(this); + }, + }; + return EvalState; +})(); + +var EvaluatorPreprocessor = (function EvaluatorPreprocessorClosure() { + // Specifies properties for each command + // + // If variableArgs === true: [0, `numArgs`] expected + // If variableArgs === false: exactly `numArgs` expected + var OP_MAP = { + // Graphic state + w: { id: OPS.setLineWidth, numArgs: 1, variableArgs: false }, + J: { id: OPS.setLineCap, numArgs: 1, variableArgs: false }, + j: { id: OPS.setLineJoin, numArgs: 1, variableArgs: false }, + M: { id: OPS.setMiterLimit, numArgs: 1, variableArgs: false }, + d: { id: OPS.setDash, numArgs: 2, variableArgs: false }, + ri: { id: OPS.setRenderingIntent, numArgs: 1, variableArgs: false }, + i: { id: OPS.setFlatness, numArgs: 1, variableArgs: false }, + gs: { id: OPS.setGState, numArgs: 1, variableArgs: false }, + q: { id: OPS.save, numArgs: 0, variableArgs: false }, + Q: { id: OPS.restore, numArgs: 0, variableArgs: false }, + cm: { id: OPS.transform, numArgs: 6, variableArgs: false }, + + // Path + m: { id: OPS.moveTo, numArgs: 2, variableArgs: false }, + l: { id: OPS.lineTo, numArgs: 2, variableArgs: false }, + c: { id: OPS.curveTo, numArgs: 6, variableArgs: false }, + v: { id: OPS.curveTo2, numArgs: 4, variableArgs: false }, + y: { id: OPS.curveTo3, numArgs: 4, variableArgs: false }, + h: { id: OPS.closePath, numArgs: 0, variableArgs: false }, + re: { id: OPS.rectangle, numArgs: 4, variableArgs: false }, + S: { id: OPS.stroke, numArgs: 0, variableArgs: false }, + s: { id: OPS.closeStroke, numArgs: 0, variableArgs: false }, + f: { id: OPS.fill, numArgs: 0, variableArgs: false }, + F: { id: OPS.fill, numArgs: 0, variableArgs: false }, + 'f*': { id: OPS.eoFill, numArgs: 0, variableArgs: false }, + B: { id: OPS.fillStroke, numArgs: 0, variableArgs: false }, + 'B*': { id: OPS.eoFillStroke, numArgs: 0, variableArgs: false }, + b: { id: OPS.closeFillStroke, numArgs: 0, variableArgs: false }, + 'b*': { id: OPS.closeEOFillStroke, numArgs: 0, variableArgs: false }, + n: { id: OPS.endPath, numArgs: 0, variableArgs: false }, + + // Clipping + W: { id: OPS.clip, numArgs: 0, variableArgs: false }, + 'W*': { id: OPS.eoClip, numArgs: 0, variableArgs: false }, + + // Text + BT: { id: OPS.beginText, numArgs: 0, variableArgs: false }, + ET: { id: OPS.endText, numArgs: 0, variableArgs: false }, + Tc: { id: OPS.setCharSpacing, numArgs: 1, variableArgs: false }, + Tw: { id: OPS.setWordSpacing, numArgs: 1, variableArgs: false }, + Tz: { id: OPS.setHScale, numArgs: 1, variableArgs: false }, + TL: { id: OPS.setLeading, numArgs: 1, variableArgs: false }, + Tf: { id: OPS.setFont, numArgs: 2, variableArgs: false }, + Tr: { id: OPS.setTextRenderingMode, numArgs: 1, variableArgs: false }, + Ts: { id: OPS.setTextRise, numArgs: 1, variableArgs: false }, + Td: { id: OPS.moveText, numArgs: 2, variableArgs: false }, + TD: { id: OPS.setLeadingMoveText, numArgs: 2, variableArgs: false }, + Tm: { id: OPS.setTextMatrix, numArgs: 6, variableArgs: false }, + 'T*': { id: OPS.nextLine, numArgs: 0, variableArgs: false }, + Tj: { id: OPS.showText, numArgs: 1, variableArgs: false }, + TJ: { id: OPS.showSpacedText, numArgs: 1, variableArgs: false }, + '\'': { id: OPS.nextLineShowText, numArgs: 1, variableArgs: false }, + '"': { id: OPS.nextLineSetSpacingShowText, numArgs: 3, + variableArgs: false }, + + // Type3 fonts + d0: { id: OPS.setCharWidth, numArgs: 2, variableArgs: false }, + d1: { id: OPS.setCharWidthAndBounds, numArgs: 6, variableArgs: false }, + + // Color + CS: { id: OPS.setStrokeColorSpace, numArgs: 1, variableArgs: false }, + cs: { id: OPS.setFillColorSpace, numArgs: 1, variableArgs: false }, + SC: { id: OPS.setStrokeColor, numArgs: 4, variableArgs: true }, + SCN: { id: OPS.setStrokeColorN, numArgs: 33, variableArgs: true }, + sc: { id: OPS.setFillColor, numArgs: 4, variableArgs: true }, + scn: { id: OPS.setFillColorN, numArgs: 33, variableArgs: true }, + G: { id: OPS.setStrokeGray, numArgs: 1, variableArgs: false }, + g: { id: OPS.setFillGray, numArgs: 1, variableArgs: false }, + RG: { id: OPS.setStrokeRGBColor, numArgs: 3, variableArgs: false }, + rg: { id: OPS.setFillRGBColor, numArgs: 3, variableArgs: false }, + K: { id: OPS.setStrokeCMYKColor, numArgs: 4, variableArgs: false }, + k: { id: OPS.setFillCMYKColor, numArgs: 4, variableArgs: false }, + + // Shading + sh: { id: OPS.shadingFill, numArgs: 1, variableArgs: false }, + + // Images + BI: { id: OPS.beginInlineImage, numArgs: 0, variableArgs: false }, + ID: { id: OPS.beginImageData, numArgs: 0, variableArgs: false }, + EI: { id: OPS.endInlineImage, numArgs: 1, variableArgs: false }, + + // XObjects + Do: { id: OPS.paintXObject, numArgs: 1, variableArgs: false }, + MP: { id: OPS.markPoint, numArgs: 1, variableArgs: false }, + DP: { id: OPS.markPointProps, numArgs: 2, variableArgs: false }, + BMC: { id: OPS.beginMarkedContent, numArgs: 1, variableArgs: false }, + BDC: { id: OPS.beginMarkedContentProps, numArgs: 2, + variableArgs: false }, + EMC: { id: OPS.endMarkedContent, numArgs: 0, variableArgs: false }, + + // Compatibility + BX: { id: OPS.beginCompat, numArgs: 0, variableArgs: false }, + EX: { id: OPS.endCompat, numArgs: 0, variableArgs: false }, + + // (reserved partial commands for the lexer) + BM: null, + BD: null, + 'true': null, + fa: null, + fal: null, + fals: null, + 'false': null, + nu: null, + nul: null, + 'null': null + }; + + function EvaluatorPreprocessor(stream, xref, stateManager) { + // TODO(mduan): pass array of knownCommands rather than OP_MAP + // dictionary + this.parser = new Parser(new Lexer(stream, OP_MAP), false, xref); + this.stateManager = stateManager; + this.nonProcessedArgs = []; + } + + EvaluatorPreprocessor.prototype = { + get savedStatesDepth() { + return this.stateManager.stateStack.length; + }, + + // |operation| is an object with two fields: + // + // - |fn| is an out param. + // + // - |args| is an inout param. On entry, it should have one of two values. + // + // - An empty array. This indicates that the caller is providing the + // array in which the args will be stored in. The caller should use + // this value if it can reuse a single array for each call to read(). + // + // - |null|. This indicates that the caller needs this function to create + // the array in which any args are stored in. If there are zero args, + // this function will leave |operation.args| as |null| (thus avoiding + // allocations that would occur if we used an empty array to represent + // zero arguments). Otherwise, it will replace |null| with a new array + // containing the arguments. The caller should use this value if it + // cannot reuse an array for each call to read(). + // + // These two modes are present because this function is very hot and so + // avoiding allocations where possible is worthwhile. + // + read: function EvaluatorPreprocessor_read(operation) { + var args = operation.args; + while (true) { + var obj = this.parser.getObj(); + if (isCmd(obj)) { + var cmd = obj.cmd; + // Check that the command is valid + var opSpec = OP_MAP[cmd]; + if (!opSpec) { + warn('Unknown command "' + cmd + '"'); + continue; + } + + var fn = opSpec.id; + var numArgs = opSpec.numArgs; + var argsLength = args !== null ? args.length : 0; + + if (!opSpec.variableArgs) { + // Postscript commands can be nested, e.g. /F2 /GS2 gs 5.711 Tf + if (argsLength !== numArgs) { + var nonProcessedArgs = this.nonProcessedArgs; + while (argsLength > numArgs) { + nonProcessedArgs.push(args.shift()); + argsLength--; + } + while (argsLength < numArgs && nonProcessedArgs.length !== 0) { + if (!args) { + args = []; + } + args.unshift(nonProcessedArgs.pop()); + argsLength++; + } + } + + if (argsLength < numArgs) { + // If we receive too few args, it's not possible to possible + // to execute the command, so skip the command + info('Command ' + fn + ': because expected ' + + numArgs + ' args, but received ' + argsLength + + ' args; skipping'); + args = null; + continue; + } + } else if (argsLength > numArgs) { + info('Command ' + fn + ': expected [0,' + numArgs + + '] args, but received ' + argsLength + ' args'); + } + + // TODO figure out how to type-check vararg functions + this.preprocessCommand(fn, args); + + operation.fn = fn; + operation.args = args; + return true; + } else { + if (isEOF(obj)) { + return false; // no more commands + } + // argument + if (obj !== null) { + if (!args) { + args = []; + } + args.push((obj instanceof Dict ? obj.getAll() : obj)); + assert(args.length <= 33, 'Too many arguments'); + } + } + } + }, + + preprocessCommand: + function EvaluatorPreprocessor_preprocessCommand(fn, args) { + switch (fn | 0) { + case OPS.save: + this.stateManager.save(); + break; + case OPS.restore: + this.stateManager.restore(); + break; + case OPS.transform: + this.stateManager.transform(args); + break; + } + } + }; + return EvaluatorPreprocessor; +})(); + +var QueueOptimizer = (function QueueOptimizerClosure() { + function addState(parentState, pattern, fn) { + var state = parentState; + for (var i = 0, ii = pattern.length - 1; i < ii; i++) { + var item = pattern[i]; + state = (state[item] || (state[item] = [])); + } + state[pattern[pattern.length - 1]] = fn; + } + + function handlePaintSolidColorImageMask(iFirstSave, count, fnArray, + argsArray) { + // Handles special case of mainly LaTeX documents which use image masks to + // draw lines with the current fill style. + // 'count' groups of (save, transform, paintImageMaskXObject, restore)+ + // have been found at iFirstSave. + var iFirstPIMXO = iFirstSave + 2; + for (var i = 0; i < count; i++) { + var arg = argsArray[iFirstPIMXO + 4 * i]; + var imageMask = arg.length === 1 && arg[0]; + if (imageMask && imageMask.width === 1 && imageMask.height === 1 && + (!imageMask.data.length || + (imageMask.data.length === 1 && imageMask.data[0] === 0))) { + fnArray[iFirstPIMXO + 4 * i] = OPS.paintSolidColorImageMask; + continue; + } + break; + } + return count - i; + } + + var InitialState = []; + + // This replaces (save, transform, paintInlineImageXObject, restore)+ + // sequences with one |paintInlineImageXObjectGroup| operation. + addState(InitialState, + [OPS.save, OPS.transform, OPS.paintInlineImageXObject, OPS.restore], + function foundInlineImageGroup(context) { + var MIN_IMAGES_IN_INLINE_IMAGES_BLOCK = 10; + var MAX_IMAGES_IN_INLINE_IMAGES_BLOCK = 200; + var MAX_WIDTH = 1000; + var IMAGE_PADDING = 1; + + var fnArray = context.fnArray, argsArray = context.argsArray; + var curr = context.iCurr; + var iFirstSave = curr - 3; + var iFirstTransform = curr - 2; + var iFirstPIIXO = curr - 1; + + // Look for the quartets. + var i = iFirstSave + 4; + var ii = fnArray.length; + while (i + 3 < ii) { + if (fnArray[i] !== OPS.save || + fnArray[i + 1] !== OPS.transform || + fnArray[i + 2] !== OPS.paintInlineImageXObject || + fnArray[i + 3] !== OPS.restore) { + break; // ops don't match + } + i += 4; + } + + // At this point, i is the index of the first op past the last valid + // quartet. + var count = Math.min((i - iFirstSave) / 4, + MAX_IMAGES_IN_INLINE_IMAGES_BLOCK); + if (count < MIN_IMAGES_IN_INLINE_IMAGES_BLOCK) { + return i; + } + + // assuming that heights of those image is too small (~1 pixel) + // packing as much as possible by lines + var maxX = 0; + var map = [], maxLineHeight = 0; + var currentX = IMAGE_PADDING, currentY = IMAGE_PADDING; + var q; + for (q = 0; q < count; q++) { + var transform = argsArray[iFirstTransform + (q << 2)]; + var img = argsArray[iFirstPIIXO + (q << 2)][0]; + if (currentX + img.width > MAX_WIDTH) { + // starting new line + maxX = Math.max(maxX, currentX); + currentY += maxLineHeight + 2 * IMAGE_PADDING; + currentX = 0; + maxLineHeight = 0; + } + map.push({ + transform: transform, + x: currentX, y: currentY, + w: img.width, h: img.height + }); + currentX += img.width + 2 * IMAGE_PADDING; + maxLineHeight = Math.max(maxLineHeight, img.height); + } + var imgWidth = Math.max(maxX, currentX) + IMAGE_PADDING; + var imgHeight = currentY + maxLineHeight + IMAGE_PADDING; + var imgData = new Uint8Array(imgWidth * imgHeight * 4); + var imgRowSize = imgWidth << 2; + for (q = 0; q < count; q++) { + var data = argsArray[iFirstPIIXO + (q << 2)][0].data; + // Copy image by lines and extends pixels into padding. + var rowSize = map[q].w << 2; + var dataOffset = 0; + var offset = (map[q].x + map[q].y * imgWidth) << 2; + imgData.set(data.subarray(0, rowSize), offset - imgRowSize); + for (var k = 0, kk = map[q].h; k < kk; k++) { + imgData.set(data.subarray(dataOffset, dataOffset + rowSize), offset); + dataOffset += rowSize; + offset += imgRowSize; + } + imgData.set(data.subarray(dataOffset - rowSize, dataOffset), offset); + while (offset >= 0) { + data[offset - 4] = data[offset]; + data[offset - 3] = data[offset + 1]; + data[offset - 2] = data[offset + 2]; + data[offset - 1] = data[offset + 3]; + data[offset + rowSize] = data[offset + rowSize - 4]; + data[offset + rowSize + 1] = data[offset + rowSize - 3]; + data[offset + rowSize + 2] = data[offset + rowSize - 2]; + data[offset + rowSize + 3] = data[offset + rowSize - 1]; + offset -= imgRowSize; + } + } + + // Replace queue items. + fnArray.splice(iFirstSave, count * 4, OPS.paintInlineImageXObjectGroup); + argsArray.splice(iFirstSave, count * 4, + [{ width: imgWidth, height: imgHeight, kind: ImageKind.RGBA_32BPP, + data: imgData }, map]); + + return iFirstSave + 1; + }); + + // This replaces (save, transform, paintImageMaskXObject, restore)+ + // sequences with one |paintImageMaskXObjectGroup| or one + // |paintImageMaskXObjectRepeat| operation. + addState(InitialState, + [OPS.save, OPS.transform, OPS.paintImageMaskXObject, OPS.restore], + function foundImageMaskGroup(context) { + var MIN_IMAGES_IN_MASKS_BLOCK = 10; + var MAX_IMAGES_IN_MASKS_BLOCK = 100; + var MAX_SAME_IMAGES_IN_MASKS_BLOCK = 1000; + + var fnArray = context.fnArray, argsArray = context.argsArray; + var curr = context.iCurr; + var iFirstSave = curr - 3; + var iFirstTransform = curr - 2; + var iFirstPIMXO = curr - 1; + + // Look for the quartets. + var i = iFirstSave + 4; + var ii = fnArray.length; + while (i + 3 < ii) { + if (fnArray[i] !== OPS.save || + fnArray[i + 1] !== OPS.transform || + fnArray[i + 2] !== OPS.paintImageMaskXObject || + fnArray[i + 3] !== OPS.restore) { + break; // ops don't match + } + i += 4; + } + + // At this point, i is the index of the first op past the last valid + // quartet. + var count = (i - iFirstSave) / 4; + count = handlePaintSolidColorImageMask(iFirstSave, count, fnArray, + argsArray); + if (count < MIN_IMAGES_IN_MASKS_BLOCK) { + return i; + } + + var q; + var isSameImage = false; + var iTransform, transformArgs; + var firstPIMXOArg0 = argsArray[iFirstPIMXO][0]; + if (argsArray[iFirstTransform][1] === 0 && + argsArray[iFirstTransform][2] === 0) { + isSameImage = true; + var firstTransformArg0 = argsArray[iFirstTransform][0]; + var firstTransformArg3 = argsArray[iFirstTransform][3]; + iTransform = iFirstTransform + 4; + var iPIMXO = iFirstPIMXO + 4; + for (q = 1; q < count; q++, iTransform += 4, iPIMXO += 4) { + transformArgs = argsArray[iTransform]; + if (argsArray[iPIMXO][0] !== firstPIMXOArg0 || + transformArgs[0] !== firstTransformArg0 || + transformArgs[1] !== 0 || + transformArgs[2] !== 0 || + transformArgs[3] !== firstTransformArg3) { + if (q < MIN_IMAGES_IN_MASKS_BLOCK) { + isSameImage = false; + } else { + count = q; + } + break; // different image or transform + } + } + } + + if (isSameImage) { + count = Math.min(count, MAX_SAME_IMAGES_IN_MASKS_BLOCK); + var positions = new Float32Array(count * 2); + iTransform = iFirstTransform; + for (q = 0; q < count; q++, iTransform += 4) { + transformArgs = argsArray[iTransform]; + positions[(q << 1)] = transformArgs[4]; + positions[(q << 1) + 1] = transformArgs[5]; + } + + // Replace queue items. + fnArray.splice(iFirstSave, count * 4, OPS.paintImageMaskXObjectRepeat); + argsArray.splice(iFirstSave, count * 4, + [firstPIMXOArg0, firstTransformArg0, firstTransformArg3, positions]); + } else { + count = Math.min(count, MAX_IMAGES_IN_MASKS_BLOCK); + var images = []; + for (q = 0; q < count; q++) { + transformArgs = argsArray[iFirstTransform + (q << 2)]; + var maskParams = argsArray[iFirstPIMXO + (q << 2)][0]; + images.push({ data: maskParams.data, width: maskParams.width, + height: maskParams.height, + transform: transformArgs }); + } + + // Replace queue items. + fnArray.splice(iFirstSave, count * 4, OPS.paintImageMaskXObjectGroup); + argsArray.splice(iFirstSave, count * 4, [images]); + } + + return iFirstSave + 1; + }); + + // This replaces (save, transform, paintImageXObject, restore)+ sequences + // with one paintImageXObjectRepeat operation, if the |transform| and + // |paintImageXObjectRepeat| ops are appropriate. + addState(InitialState, + [OPS.save, OPS.transform, OPS.paintImageXObject, OPS.restore], + function (context) { + var MIN_IMAGES_IN_BLOCK = 3; + var MAX_IMAGES_IN_BLOCK = 1000; + + var fnArray = context.fnArray, argsArray = context.argsArray; + var curr = context.iCurr; + var iFirstSave = curr - 3; + var iFirstTransform = curr - 2; + var iFirstPIXO = curr - 1; + var iFirstRestore = curr; + + if (argsArray[iFirstTransform][1] !== 0 || + argsArray[iFirstTransform][2] !== 0) { + return iFirstRestore + 1; // transform has the wrong form + } + + // Look for the quartets. + var firstPIXOArg0 = argsArray[iFirstPIXO][0]; + var firstTransformArg0 = argsArray[iFirstTransform][0]; + var firstTransformArg3 = argsArray[iFirstTransform][3]; + var i = iFirstSave + 4; + var ii = fnArray.length; + while (i + 3 < ii) { + if (fnArray[i] !== OPS.save || + fnArray[i + 1] !== OPS.transform || + fnArray[i + 2] !== OPS.paintImageXObject || + fnArray[i + 3] !== OPS.restore) { + break; // ops don't match + } + if (argsArray[i + 1][0] !== firstTransformArg0 || + argsArray[i + 1][1] !== 0 || + argsArray[i + 1][2] !== 0 || + argsArray[i + 1][3] !== firstTransformArg3) { + break; // transforms don't match + } + if (argsArray[i + 2][0] !== firstPIXOArg0) { + break; // images don't match + } + i += 4; + } + + // At this point, i is the index of the first op past the last valid + // quartet. + var count = Math.min((i - iFirstSave) / 4, MAX_IMAGES_IN_BLOCK); + if (count < MIN_IMAGES_IN_BLOCK) { + return i; + } + + // Extract the (x,y) positions from all of the matching transforms. + var positions = new Float32Array(count * 2); + var iTransform = iFirstTransform; + for (var q = 0; q < count; q++, iTransform += 4) { + var transformArgs = argsArray[iTransform]; + positions[(q << 1)] = transformArgs[4]; + positions[(q << 1) + 1] = transformArgs[5]; + } + + // Replace queue items. + var args = [firstPIXOArg0, firstTransformArg0, firstTransformArg3, + positions]; + fnArray.splice(iFirstSave, count * 4, OPS.paintImageXObjectRepeat); + argsArray.splice(iFirstSave, count * 4, args); + + return iFirstSave + 1; + }); + + // This replaces (beginText, setFont, setTextMatrix, showText, endText)+ + // sequences with (beginText, setFont, (setTextMatrix, showText)+, endText)+ + // sequences, if the font for each one is the same. + addState(InitialState, + [OPS.beginText, OPS.setFont, OPS.setTextMatrix, OPS.showText, OPS.endText], + function (context) { + var MIN_CHARS_IN_BLOCK = 3; + var MAX_CHARS_IN_BLOCK = 1000; + + var fnArray = context.fnArray, argsArray = context.argsArray; + var curr = context.iCurr; + var iFirstBeginText = curr - 4; + var iFirstSetFont = curr - 3; + var iFirstSetTextMatrix = curr - 2; + var iFirstShowText = curr - 1; + var iFirstEndText = curr; + + // Look for the quintets. + var firstSetFontArg0 = argsArray[iFirstSetFont][0]; + var firstSetFontArg1 = argsArray[iFirstSetFont][1]; + var i = iFirstBeginText + 5; + var ii = fnArray.length; + while (i + 4 < ii) { + if (fnArray[i] !== OPS.beginText || + fnArray[i + 1] !== OPS.setFont || + fnArray[i + 2] !== OPS.setTextMatrix || + fnArray[i + 3] !== OPS.showText || + fnArray[i + 4] !== OPS.endText) { + break; // ops don't match + } + if (argsArray[i + 1][0] !== firstSetFontArg0 || + argsArray[i + 1][1] !== firstSetFontArg1) { + break; // fonts don't match + } + i += 5; + } + + // At this point, i is the index of the first op past the last valid + // quintet. + var count = Math.min(((i - iFirstBeginText) / 5), MAX_CHARS_IN_BLOCK); + if (count < MIN_CHARS_IN_BLOCK) { + return i; + } + + // If the preceding quintet is (, setFont, setTextMatrix, + // showText, endText), include that as well. (E.g. might be + // |dependency|.) + var iFirst = iFirstBeginText; + if (iFirstBeginText >= 4 && + fnArray[iFirstBeginText - 4] === fnArray[iFirstSetFont] && + fnArray[iFirstBeginText - 3] === fnArray[iFirstSetTextMatrix] && + fnArray[iFirstBeginText - 2] === fnArray[iFirstShowText] && + fnArray[iFirstBeginText - 1] === fnArray[iFirstEndText] && + argsArray[iFirstBeginText - 4][0] === firstSetFontArg0 && + argsArray[iFirstBeginText - 4][1] === firstSetFontArg1) { + count++; + iFirst -= 5; + } + + // Remove (endText, beginText, setFont) trios. + var iEndText = iFirst + 4; + for (var q = 1; q < count; q++) { + fnArray.splice(iEndText, 3); + argsArray.splice(iEndText, 3); + iEndText += 2; + } + + return iEndText + 1; + }); + + function QueueOptimizer() {} + + QueueOptimizer.prototype = { + optimize: function QueueOptimizer_optimize(queue) { + var fnArray = queue.fnArray, argsArray = queue.argsArray; + var context = { + iCurr: 0, + fnArray: fnArray, + argsArray: argsArray + }; + var state; + var i = 0, ii = fnArray.length; + while (i < ii) { + state = (state || InitialState)[fnArray[i]]; + if (typeof state === 'function') { // we found some handler + context.iCurr = i; + // state() returns the index of the first non-matching op (if we + // didn't match) or the first op past the modified ops (if we did + // match and replace). + i = state(context); + state = undefined; // reset the state machine + ii = context.fnArray.length; + } else { + i++; + } + } + } + }; + return QueueOptimizer; +})(); + + +var BUILT_IN_CMAPS = [ +// << Start unicode maps. +'Adobe-GB1-UCS2', +'Adobe-CNS1-UCS2', +'Adobe-Japan1-UCS2', +'Adobe-Korea1-UCS2', +// >> End unicode maps. +'78-EUC-H', +'78-EUC-V', +'78-H', +'78-RKSJ-H', +'78-RKSJ-V', +'78-V', +'78ms-RKSJ-H', +'78ms-RKSJ-V', +'83pv-RKSJ-H', +'90ms-RKSJ-H', +'90ms-RKSJ-V', +'90msp-RKSJ-H', +'90msp-RKSJ-V', +'90pv-RKSJ-H', +'90pv-RKSJ-V', +'Add-H', +'Add-RKSJ-H', +'Add-RKSJ-V', +'Add-V', +'Adobe-CNS1-0', +'Adobe-CNS1-1', +'Adobe-CNS1-2', +'Adobe-CNS1-3', +'Adobe-CNS1-4', +'Adobe-CNS1-5', +'Adobe-CNS1-6', +'Adobe-GB1-0', +'Adobe-GB1-1', +'Adobe-GB1-2', +'Adobe-GB1-3', +'Adobe-GB1-4', +'Adobe-GB1-5', +'Adobe-Japan1-0', +'Adobe-Japan1-1', +'Adobe-Japan1-2', +'Adobe-Japan1-3', +'Adobe-Japan1-4', +'Adobe-Japan1-5', +'Adobe-Japan1-6', +'Adobe-Korea1-0', +'Adobe-Korea1-1', +'Adobe-Korea1-2', +'B5-H', +'B5-V', +'B5pc-H', +'B5pc-V', +'CNS-EUC-H', +'CNS-EUC-V', +'CNS1-H', +'CNS1-V', +'CNS2-H', +'CNS2-V', +'ETHK-B5-H', +'ETHK-B5-V', +'ETen-B5-H', +'ETen-B5-V', +'ETenms-B5-H', +'ETenms-B5-V', +'EUC-H', +'EUC-V', +'Ext-H', +'Ext-RKSJ-H', +'Ext-RKSJ-V', +'Ext-V', +'GB-EUC-H', +'GB-EUC-V', +'GB-H', +'GB-V', +'GBK-EUC-H', +'GBK-EUC-V', +'GBK2K-H', +'GBK2K-V', +'GBKp-EUC-H', +'GBKp-EUC-V', +'GBT-EUC-H', +'GBT-EUC-V', +'GBT-H', +'GBT-V', +'GBTpc-EUC-H', +'GBTpc-EUC-V', +'GBpc-EUC-H', +'GBpc-EUC-V', +'H', +'HKdla-B5-H', +'HKdla-B5-V', +'HKdlb-B5-H', +'HKdlb-B5-V', +'HKgccs-B5-H', +'HKgccs-B5-V', +'HKm314-B5-H', +'HKm314-B5-V', +'HKm471-B5-H', +'HKm471-B5-V', +'HKscs-B5-H', +'HKscs-B5-V', +'Hankaku', +'Hiragana', +'KSC-EUC-H', +'KSC-EUC-V', +'KSC-H', +'KSC-Johab-H', +'KSC-Johab-V', +'KSC-V', +'KSCms-UHC-H', +'KSCms-UHC-HW-H', +'KSCms-UHC-HW-V', +'KSCms-UHC-V', +'KSCpc-EUC-H', +'KSCpc-EUC-V', +'Katakana', +'NWP-H', +'NWP-V', +'RKSJ-H', +'RKSJ-V', +'Roman', +'UniCNS-UCS2-H', +'UniCNS-UCS2-V', +'UniCNS-UTF16-H', +'UniCNS-UTF16-V', +'UniCNS-UTF32-H', +'UniCNS-UTF32-V', +'UniCNS-UTF8-H', +'UniCNS-UTF8-V', +'UniGB-UCS2-H', +'UniGB-UCS2-V', +'UniGB-UTF16-H', +'UniGB-UTF16-V', +'UniGB-UTF32-H', +'UniGB-UTF32-V', +'UniGB-UTF8-H', +'UniGB-UTF8-V', +'UniJIS-UCS2-H', +'UniJIS-UCS2-HW-H', +'UniJIS-UCS2-HW-V', +'UniJIS-UCS2-V', +'UniJIS-UTF16-H', +'UniJIS-UTF16-V', +'UniJIS-UTF32-H', +'UniJIS-UTF32-V', +'UniJIS-UTF8-H', +'UniJIS-UTF8-V', +'UniJIS2004-UTF16-H', +'UniJIS2004-UTF16-V', +'UniJIS2004-UTF32-H', +'UniJIS2004-UTF32-V', +'UniJIS2004-UTF8-H', +'UniJIS2004-UTF8-V', +'UniJISPro-UCS2-HW-V', +'UniJISPro-UCS2-V', +'UniJISPro-UTF8-V', +'UniJISX0213-UTF32-H', +'UniJISX0213-UTF32-V', +'UniJISX02132004-UTF32-H', +'UniJISX02132004-UTF32-V', +'UniKS-UCS2-H', +'UniKS-UCS2-V', +'UniKS-UTF16-H', +'UniKS-UTF16-V', +'UniKS-UTF32-H', +'UniKS-UTF32-V', +'UniKS-UTF8-H', +'UniKS-UTF8-V', +'V', +'WP-Symbol']; + +// CMap, not to be confused with TrueType's cmap. +var CMap = (function CMapClosure() { + function CMap(builtInCMap) { + // Codespace ranges are stored as follows: + // [[1BytePairs], [2BytePairs], [3BytePairs], [4BytePairs]] + // where nBytePairs are ranges e.g. [low1, high1, low2, high2, ...] + this.codespaceRanges = [[], [], [], []]; + this.numCodespaceRanges = 0; + // Map entries have one of two forms. + // - cid chars are 16-bit unsigned integers, stored as integers. + // - bf chars are variable-length byte sequences, stored as strings, with + // one byte per character. + this._map = []; + this.name = ''; + this.vertical = false; + this.useCMap = null; + this.builtInCMap = builtInCMap; + } + CMap.prototype = { + addCodespaceRange: function(n, low, high) { + this.codespaceRanges[n - 1].push(low, high); + this.numCodespaceRanges++; + }, + + mapCidRange: function(low, high, dstLow) { + while (low <= high) { + this._map[low++] = dstLow++; + } + }, + + mapBfRange: function(low, high, dstLow) { + var lastByte = dstLow.length - 1; + while (low <= high) { + this._map[low++] = dstLow; + // Only the last byte has to be incremented. + dstLow = dstLow.substr(0, lastByte) + + String.fromCharCode(dstLow.charCodeAt(lastByte) + 1); + } + }, + + mapBfRangeToArray: function(low, high, array) { + var i = 0, ii = array.length; + while (low <= high && i < ii) { + this._map[low] = array[i++]; + ++low; + } + }, + + // This is used for both bf and cid chars. + mapOne: function(src, dst) { + this._map[src] = dst; + }, + + lookup: function(code) { + return this._map[code]; + }, + + contains: function(code) { + return this._map[code] !== undefined; + }, + + forEach: function(callback) { + // Most maps have fewer than 65536 entries, and for those we use normal + // array iteration. But really sparse tables are possible -- e.g. with + // indices in the *billions*. For such tables we use for..in, which isn't + // ideal because it stringifies the indices for all present elements, but + // it does avoid iterating over every undefined entry. + var map = this._map; + var length = map.length; + var i; + if (length <= 0x10000) { + for (i = 0; i < length; i++) { + if (map[i] !== undefined) { + callback(i, map[i]); + } + } + } else { + for (i in this._map) { + callback(i, map[i]); + } + } + }, + + charCodeOf: function(value) { + return this._map.indexOf(value); + }, + + getMap: function() { + return this._map; + }, + + readCharCode: function(str, offset, out) { + var c = 0; + var codespaceRanges = this.codespaceRanges; + var codespaceRangesLen = this.codespaceRanges.length; + // 9.7.6.2 CMap Mapping + // The code length is at most 4. + for (var n = 0; n < codespaceRangesLen; n++) { + c = ((c << 8) | str.charCodeAt(offset + n)) >>> 0; + // Check each codespace range to see if it falls within. + var codespaceRange = codespaceRanges[n]; + for (var k = 0, kk = codespaceRange.length; k < kk;) { + var low = codespaceRange[k++]; + var high = codespaceRange[k++]; + if (c >= low && c <= high) { + out.charcode = c; + out.length = n + 1; + return; + } + } + } + out.charcode = 0; + out.length = 1; + }, + + get length() { + return this._map.length; + }, + + get isIdentityCMap() { + if (!(this.name === 'Identity-H' || this.name === 'Identity-V')) { + return false; + } + if (this._map.length !== 0x10000) { + return false; + } + for (var i = 0; i < 0x10000; i++) { + if (this._map[i] !== i) { + return false; + } + } + return true; + } + }; + return CMap; +})(); + +// A special case of CMap, where the _map array implicitly has a length of +// 65536 and each element is equal to its index. +var IdentityCMap = (function IdentityCMapClosure() { + function IdentityCMap(vertical, n) { + CMap.call(this); + this.vertical = vertical; + this.addCodespaceRange(n, 0, 0xffff); + } + Util.inherit(IdentityCMap, CMap, {}); + + IdentityCMap.prototype = { + addCodespaceRange: CMap.prototype.addCodespaceRange, + + mapCidRange: function(low, high, dstLow) { + error('should not call mapCidRange'); + }, + + mapBfRange: function(low, high, dstLow) { + error('should not call mapBfRange'); + }, + + mapBfRangeToArray: function(low, high, array) { + error('should not call mapBfRangeToArray'); + }, + + mapOne: function(src, dst) { + error('should not call mapCidOne'); + }, + + lookup: function(code) { + return (isInt(code) && code <= 0xffff) ? code : undefined; + }, + + contains: function(code) { + return isInt(code) && code <= 0xffff; + }, + + forEach: function(callback) { + for (var i = 0; i <= 0xffff; i++) { + callback(i, i); + } + }, + + charCodeOf: function(value) { + return (isInt(value) && value <= 0xffff) ? value : -1; + }, + + getMap: function() { + // Sometimes identity maps must be instantiated, but it's rare. + var map = new Array(0x10000); + for (var i = 0; i <= 0xffff; i++) { + map[i] = i; + } + return map; + }, + + readCharCode: CMap.prototype.readCharCode, + + get length() { + return 0x10000; + }, + + get isIdentityCMap() { + error('should not access .isIdentityCMap'); + } + }; + + return IdentityCMap; +})(); + +var BinaryCMapReader = (function BinaryCMapReaderClosure() { + function fetchBinaryData(url) { + var nonBinaryRequest = PDFJS.disableWorker; + var request = new XMLHttpRequest(); + request.open('GET', url, false); + if (!nonBinaryRequest) { + try { + request.responseType = 'arraybuffer'; + nonBinaryRequest = request.responseType !== 'arraybuffer'; + } catch (e) { + nonBinaryRequest = true; + } + } + if (nonBinaryRequest && request.overrideMimeType) { + request.overrideMimeType('text/plain; charset=x-user-defined'); + } + request.send(null); + if (nonBinaryRequest ? !request.responseText : !request.response) { + error('Unable to get binary cMap at: ' + url); + } + if (nonBinaryRequest) { + var data = Array.prototype.map.call(request.responseText, function (ch) { + return ch.charCodeAt(0) & 255; + }); + return new Uint8Array(data); + } + return new Uint8Array(request.response); + } + + function hexToInt(a, size) { + var n = 0; + for (var i = 0; i <= size; i++) { + n = (n << 8) | a[i]; + } + return n >>> 0; + } + + function hexToStr(a, size) { + // This code is hot. Special-case some common values to avoid creating an + // object with subarray(). + if (size === 1) { + return String.fromCharCode(a[0], a[1]); + } + if (size === 3) { + return String.fromCharCode(a[0], a[1], a[2], a[3]); + } + return String.fromCharCode.apply(null, a.subarray(0, size + 1)); + } + + function addHex(a, b, size) { + var c = 0; + for (var i = size; i >= 0; i--) { + c += a[i] + b[i]; + a[i] = c & 255; + c >>= 8; + } + } + + function incHex(a, size) { + var c = 1; + for (var i = size; i >= 0 && c > 0; i--) { + c += a[i]; + a[i] = c & 255; + c >>= 8; + } + } + + var MAX_NUM_SIZE = 16; + var MAX_ENCODED_NUM_SIZE = 19; // ceil(MAX_NUM_SIZE * 7 / 8) + + function BinaryCMapStream(data) { + this.buffer = data; + this.pos = 0; + this.end = data.length; + this.tmpBuf = new Uint8Array(MAX_ENCODED_NUM_SIZE); + } + + BinaryCMapStream.prototype = { + readByte: function () { + if (this.pos >= this.end) { + return -1; + } + return this.buffer[this.pos++]; + }, + readNumber: function () { + var n = 0; + var last; + do { + var b = this.readByte(); + if (b < 0) { + error('unexpected EOF in bcmap'); + } + last = !(b & 0x80); + n = (n << 7) | (b & 0x7F); + } while (!last); + return n; + }, + readSigned: function () { + var n = this.readNumber(); + return (n & 1) ? ~(n >>> 1) : n >>> 1; + }, + readHex: function (num, size) { + num.set(this.buffer.subarray(this.pos, + this.pos + size + 1)); + this.pos += size + 1; + }, + readHexNumber: function (num, size) { + var last; + var stack = this.tmpBuf, sp = 0; + do { + var b = this.readByte(); + if (b < 0) { + error('unexpected EOF in bcmap'); + } + last = !(b & 0x80); + stack[sp++] = b & 0x7F; + } while (!last); + var i = size, buffer = 0, bufferSize = 0; + while (i >= 0) { + while (bufferSize < 8 && stack.length > 0) { + buffer = (stack[--sp] << bufferSize) | buffer; + bufferSize += 7; + } + num[i] = buffer & 255; + i--; + buffer >>= 8; + bufferSize -= 8; + } + }, + readHexSigned: function (num, size) { + this.readHexNumber(num, size); + var sign = num[size] & 1 ? 255 : 0; + var c = 0; + for (var i = 0; i <= size; i++) { + c = ((c & 1) << 8) | num[i]; + num[i] = (c >> 1) ^ sign; + } + }, + readString: function () { + var len = this.readNumber(); + var s = ''; + for (var i = 0; i < len; i++) { + s += String.fromCharCode(this.readNumber()); + } + return s; + } + }; + + function processBinaryCMap(url, cMap, extend) { + var data = fetchBinaryData(url); + var stream = new BinaryCMapStream(data); + + var header = stream.readByte(); + cMap.vertical = !!(header & 1); + + var useCMap = null; + var start = new Uint8Array(MAX_NUM_SIZE); + var end = new Uint8Array(MAX_NUM_SIZE); + var char = new Uint8Array(MAX_NUM_SIZE); + var charCode = new Uint8Array(MAX_NUM_SIZE); + var tmp = new Uint8Array(MAX_NUM_SIZE); + var code; + + var b; + while ((b = stream.readByte()) >= 0) { + var type = b >> 5; + if (type === 7) { // metadata, e.g. comment or usecmap + switch (b & 0x1F) { + case 0: + stream.readString(); // skipping comment + break; + case 1: + useCMap = stream.readString(); + break; + } + continue; + } + var sequence = !!(b & 0x10); + var dataSize = b & 15; + + assert(dataSize + 1 <= MAX_NUM_SIZE); + + var ucs2DataSize = 1; + var subitemsCount = stream.readNumber(); + var i; + switch (type) { + case 0: // codespacerange + stream.readHex(start, dataSize); + stream.readHexNumber(end, dataSize); + addHex(end, start, dataSize); + cMap.addCodespaceRange(dataSize + 1, hexToInt(start, dataSize), + hexToInt(end, dataSize)); + for (i = 1; i < subitemsCount; i++) { + incHex(end, dataSize); + stream.readHexNumber(start, dataSize); + addHex(start, end, dataSize); + stream.readHexNumber(end, dataSize); + addHex(end, start, dataSize); + cMap.addCodespaceRange(dataSize + 1, hexToInt(start, dataSize), + hexToInt(end, dataSize)); + } + break; + case 1: // notdefrange + stream.readHex(start, dataSize); + stream.readHexNumber(end, dataSize); + addHex(end, start, dataSize); + code = stream.readNumber(); + // undefined range, skipping + for (i = 1; i < subitemsCount; i++) { + incHex(end, dataSize); + stream.readHexNumber(start, dataSize); + addHex(start, end, dataSize); + stream.readHexNumber(end, dataSize); + addHex(end, start, dataSize); + code = stream.readNumber(); + // nop + } + break; + case 2: // cidchar + stream.readHex(char, dataSize); + code = stream.readNumber(); + cMap.mapOne(hexToInt(char, dataSize), code); + for (i = 1; i < subitemsCount; i++) { + incHex(char, dataSize); + if (!sequence) { + stream.readHexNumber(tmp, dataSize); + addHex(char, tmp, dataSize); + } + code = stream.readSigned() + (code + 1); + cMap.mapOne(hexToInt(char, dataSize), code); + } + break; + case 3: // cidrange + stream.readHex(start, dataSize); + stream.readHexNumber(end, dataSize); + addHex(end, start, dataSize); + code = stream.readNumber(); + cMap.mapCidRange(hexToInt(start, dataSize), hexToInt(end, dataSize), + code); + for (i = 1; i < subitemsCount; i++) { + incHex(end, dataSize); + if (!sequence) { + stream.readHexNumber(start, dataSize); + addHex(start, end, dataSize); + } else { + start.set(end); + } + stream.readHexNumber(end, dataSize); + addHex(end, start, dataSize); + code = stream.readNumber(); + cMap.mapCidRange(hexToInt(start, dataSize), hexToInt(end, dataSize), + code); + } + break; + case 4: // bfchar + stream.readHex(char, ucs2DataSize); + stream.readHex(charCode, dataSize); + cMap.mapOne(hexToInt(char, ucs2DataSize), + hexToStr(charCode, dataSize)); + for (i = 1; i < subitemsCount; i++) { + incHex(char, ucs2DataSize); + if (!sequence) { + stream.readHexNumber(tmp, ucs2DataSize); + addHex(char, tmp, ucs2DataSize); + } + incHex(charCode, dataSize); + stream.readHexSigned(tmp, dataSize); + addHex(charCode, tmp, dataSize); + cMap.mapOne(hexToInt(char, ucs2DataSize), + hexToStr(charCode, dataSize)); + } + break; + case 5: // bfrange + stream.readHex(start, ucs2DataSize); + stream.readHexNumber(end, ucs2DataSize); + addHex(end, start, ucs2DataSize); + stream.readHex(charCode, dataSize); + cMap.mapBfRange(hexToInt(start, ucs2DataSize), + hexToInt(end, ucs2DataSize), + hexToStr(charCode, dataSize)); + for (i = 1; i < subitemsCount; i++) { + incHex(end, ucs2DataSize); + if (!sequence) { + stream.readHexNumber(start, ucs2DataSize); + addHex(start, end, ucs2DataSize); + } else { + start.set(end); + } + stream.readHexNumber(end, ucs2DataSize); + addHex(end, start, ucs2DataSize); + stream.readHex(charCode, dataSize); + cMap.mapBfRange(hexToInt(start, ucs2DataSize), + hexToInt(end, ucs2DataSize), + hexToStr(charCode, dataSize)); + } + break; + default: + error('Unknown type: ' + type); + break; + } + } + + if (useCMap) { + extend(useCMap); + } + return cMap; + } + + function BinaryCMapReader() {} + + BinaryCMapReader.prototype = { + read: processBinaryCMap + }; + + return BinaryCMapReader; +})(); + +var CMapFactory = (function CMapFactoryClosure() { + function strToInt(str) { + var a = 0; + for (var i = 0; i < str.length; i++) { + a = (a << 8) | str.charCodeAt(i); + } + return a >>> 0; + } + + function expectString(obj) { + if (!isString(obj)) { + error('Malformed CMap: expected string.'); + } + } + + function expectInt(obj) { + if (!isInt(obj)) { + error('Malformed CMap: expected int.'); + } + } + + function parseBfChar(cMap, lexer) { + while (true) { + var obj = lexer.getObj(); + if (isEOF(obj)) { + break; + } + if (isCmd(obj, 'endbfchar')) { + return; + } + expectString(obj); + var src = strToInt(obj); + obj = lexer.getObj(); + // TODO are /dstName used? + expectString(obj); + var dst = obj; + cMap.mapOne(src, dst); + } + } + + function parseBfRange(cMap, lexer) { + while (true) { + var obj = lexer.getObj(); + if (isEOF(obj)) { + break; + } + if (isCmd(obj, 'endbfrange')) { + return; + } + expectString(obj); + var low = strToInt(obj); + obj = lexer.getObj(); + expectString(obj); + var high = strToInt(obj); + obj = lexer.getObj(); + if (isInt(obj) || isString(obj)) { + var dstLow = isInt(obj) ? String.fromCharCode(obj) : obj; + cMap.mapBfRange(low, high, dstLow); + } else if (isCmd(obj, '[')) { + obj = lexer.getObj(); + var array = []; + while (!isCmd(obj, ']') && !isEOF(obj)) { + array.push(obj); + obj = lexer.getObj(); + } + cMap.mapBfRangeToArray(low, high, array); + } else { + break; + } + } + error('Invalid bf range.'); + } + + function parseCidChar(cMap, lexer) { + while (true) { + var obj = lexer.getObj(); + if (isEOF(obj)) { + break; + } + if (isCmd(obj, 'endcidchar')) { + return; + } + expectString(obj); + var src = strToInt(obj); + obj = lexer.getObj(); + expectInt(obj); + var dst = obj; + cMap.mapOne(src, dst); + } + } + + function parseCidRange(cMap, lexer) { + while (true) { + var obj = lexer.getObj(); + if (isEOF(obj)) { + break; + } + if (isCmd(obj, 'endcidrange')) { + return; + } + expectString(obj); + var low = strToInt(obj); + obj = lexer.getObj(); + expectString(obj); + var high = strToInt(obj); + obj = lexer.getObj(); + expectInt(obj); + var dstLow = obj; + cMap.mapCidRange(low, high, dstLow); + } + } + + function parseCodespaceRange(cMap, lexer) { + while (true) { + var obj = lexer.getObj(); + if (isEOF(obj)) { + break; + } + if (isCmd(obj, 'endcodespacerange')) { + return; + } + if (!isString(obj)) { + break; + } + var low = strToInt(obj); + obj = lexer.getObj(); + if (!isString(obj)) { + break; + } + var high = strToInt(obj); + cMap.addCodespaceRange(obj.length, low, high); + } + error('Invalid codespace range.'); + } + + function parseWMode(cMap, lexer) { + var obj = lexer.getObj(); + if (isInt(obj)) { + cMap.vertical = !!obj; + } + } + + function parseCMapName(cMap, lexer) { + var obj = lexer.getObj(); + if (isName(obj) && isString(obj.name)) { + cMap.name = obj.name; + } + } + + function parseCMap(cMap, lexer, builtInCMapParams, useCMap) { + var previous; + var embededUseCMap; + objLoop: while (true) { + var obj = lexer.getObj(); + if (isEOF(obj)) { + break; + } else if (isName(obj)) { + if (obj.name === 'WMode') { + parseWMode(cMap, lexer); + } else if (obj.name === 'CMapName') { + parseCMapName(cMap, lexer); + } + previous = obj; + } else if (isCmd(obj)) { + switch (obj.cmd) { + case 'endcmap': + break objLoop; + case 'usecmap': + if (isName(previous)) { + embededUseCMap = previous.name; + } + break; + case 'begincodespacerange': + parseCodespaceRange(cMap, lexer); + break; + case 'beginbfchar': + parseBfChar(cMap, lexer); + break; + case 'begincidchar': + parseCidChar(cMap, lexer); + break; + case 'beginbfrange': + parseBfRange(cMap, lexer); + break; + case 'begincidrange': + parseCidRange(cMap, lexer); + break; + } + } + } + + if (!useCMap && embededUseCMap) { + // Load the usecmap definition from the file only if there wasn't one + // specified. + useCMap = embededUseCMap; + } + if (useCMap) { + extendCMap(cMap, builtInCMapParams, useCMap); + } + } + + function extendCMap(cMap, builtInCMapParams, useCMap) { + cMap.useCMap = createBuiltInCMap(useCMap, builtInCMapParams); + // If there aren't any code space ranges defined clone all the parent ones + // into this cMap. + if (cMap.numCodespaceRanges === 0) { + var useCodespaceRanges = cMap.useCMap.codespaceRanges; + for (var i = 0; i < useCodespaceRanges.length; i++) { + cMap.codespaceRanges[i] = useCodespaceRanges[i].slice(); + } + cMap.numCodespaceRanges = cMap.useCMap.numCodespaceRanges; + } + // Merge the map into the current one, making sure not to override + // any previously defined entries. + cMap.useCMap.forEach(function(key, value) { + if (!cMap.contains(key)) { + cMap.mapOne(key, cMap.useCMap.lookup(key)); + } + }); + } + + function parseBinaryCMap(name, builtInCMapParams) { + var url = builtInCMapParams.url + name + '.bcmap'; + var cMap = new CMap(true); + new BinaryCMapReader().read(url, cMap, function (useCMap) { + extendCMap(cMap, builtInCMapParams, useCMap); + }); + return cMap; + } + + function createBuiltInCMap(name, builtInCMapParams) { + if (name === 'Identity-H') { + return new IdentityCMap(false, 2); + } else if (name === 'Identity-V') { + return new IdentityCMap(true, 2); + } + if (BUILT_IN_CMAPS.indexOf(name) === -1) { + error('Unknown cMap name: ' + name); + } + assert(builtInCMapParams, 'built-in cMap parameters are not provided'); + + if (builtInCMapParams.packed) { + return parseBinaryCMap(name, builtInCMapParams); + } + + var request = new XMLHttpRequest(); + var url = builtInCMapParams.url + name; + request.open('GET', url, false); + request.send(null); + if (!request.responseText) { + error('Unable to get cMap at: ' + url); + } + var cMap = new CMap(true); + var lexer = new Lexer(new StringStream(request.responseText)); + parseCMap(cMap, lexer, builtInCMapParams, null); + return cMap; + } + + return { + create: function (encoding, builtInCMapParams, useCMap) { + if (isName(encoding)) { + return createBuiltInCMap(encoding.name, builtInCMapParams); + } else if (isStream(encoding)) { + var cMap = new CMap(); + var lexer = new Lexer(encoding); + try { + parseCMap(cMap, lexer, builtInCMapParams, useCMap); + } catch (e) { + warn('Invalid CMap data. ' + e); + } + if (cMap.isIdentityCMap) { + return createBuiltInCMap(cMap.name, builtInCMapParams); + } + return cMap; + } + error('Encoding required.'); + } + }; +})(); + + +// Unicode Private Use Area +var PRIVATE_USE_OFFSET_START = 0xE000; +var PRIVATE_USE_OFFSET_END = 0xF8FF; +var SKIP_PRIVATE_USE_RANGE_F000_TO_F01F = false; + +// PDF Glyph Space Units are one Thousandth of a TextSpace Unit +// except for Type 3 fonts +var PDF_GLYPH_SPACE_UNITS = 1000; + +// Hinting is currently disabled due to unknown problems on windows +// in tracemonkey and various other pdfs with type1 fonts. +var HINTING_ENABLED = false; + +// Accented charactars are not displayed properly on windows, using this flag +// to control analysis of seac charstrings. +var SEAC_ANALYSIS_ENABLED = false; + +var FontFlags = { + FixedPitch: 1, + Serif: 2, + Symbolic: 4, + Script: 8, + Nonsymbolic: 32, + Italic: 64, + AllCap: 65536, + SmallCap: 131072, + ForceBold: 262144 +}; + +var Encodings = { + ExpertEncoding: ['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', + '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', + 'space', 'exclamsmall', 'Hungarumlautsmall', '', 'dollaroldstyle', + 'dollarsuperior', 'ampersandsmall', 'Acutesmall', 'parenleftsuperior', + 'parenrightsuperior', 'twodotenleader', 'onedotenleader', 'comma', + 'hyphen', 'period', 'fraction', 'zerooldstyle', 'oneoldstyle', + 'twooldstyle', 'threeoldstyle', 'fouroldstyle', 'fiveoldstyle', + 'sixoldstyle', 'sevenoldstyle', 'eightoldstyle', 'nineoldstyle', 'colon', + 'semicolon', 'commasuperior', 'threequartersemdash', 'periodsuperior', + 'questionsmall', '', 'asuperior', 'bsuperior', 'centsuperior', 'dsuperior', + 'esuperior', '', '', 'isuperior', '', '', 'lsuperior', 'msuperior', + 'nsuperior', 'osuperior', '', '', 'rsuperior', 'ssuperior', 'tsuperior', + '', 'ff', 'fi', 'fl', 'ffi', 'ffl', 'parenleftinferior', '', + 'parenrightinferior', 'Circumflexsmall', 'hyphensuperior', 'Gravesmall', + 'Asmall', 'Bsmall', 'Csmall', 'Dsmall', 'Esmall', 'Fsmall', 'Gsmall', + 'Hsmall', 'Ismall', 'Jsmall', 'Ksmall', 'Lsmall', 'Msmall', 'Nsmall', + 'Osmall', 'Psmall', 'Qsmall', 'Rsmall', 'Ssmall', 'Tsmall', 'Usmall', + 'Vsmall', 'Wsmall', 'Xsmall', 'Ysmall', 'Zsmall', 'colonmonetary', + 'onefitted', 'rupiah', 'Tildesmall', '', '', '', '', '', '', '', '', '', + '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', + '', '', '', '', '', '', 'exclamdownsmall', 'centoldstyle', 'Lslashsmall', + '', '', 'Scaronsmall', 'Zcaronsmall', 'Dieresissmall', 'Brevesmall', + 'Caronsmall', '', 'Dotaccentsmall', '', '', 'Macronsmall', '', '', + 'figuredash', 'hypheninferior', '', '', 'Ogoneksmall', 'Ringsmall', + 'Cedillasmall', '', '', '', 'onequarter', 'onehalf', 'threequarters', + 'questiondownsmall', 'oneeighth', 'threeeighths', 'fiveeighths', + 'seveneighths', 'onethird', 'twothirds', '', '', 'zerosuperior', + 'onesuperior', 'twosuperior', 'threesuperior', 'foursuperior', + 'fivesuperior', 'sixsuperior', 'sevensuperior', 'eightsuperior', + 'ninesuperior', 'zeroinferior', 'oneinferior', 'twoinferior', + 'threeinferior', 'fourinferior', 'fiveinferior', 'sixinferior', + 'seveninferior', 'eightinferior', 'nineinferior', 'centinferior', + 'dollarinferior', 'periodinferior', 'commainferior', 'Agravesmall', + 'Aacutesmall', 'Acircumflexsmall', 'Atildesmall', 'Adieresissmall', + 'Aringsmall', 'AEsmall', 'Ccedillasmall', 'Egravesmall', 'Eacutesmall', + 'Ecircumflexsmall', 'Edieresissmall', 'Igravesmall', 'Iacutesmall', + 'Icircumflexsmall', 'Idieresissmall', 'Ethsmall', 'Ntildesmall', + 'Ogravesmall', 'Oacutesmall', 'Ocircumflexsmall', 'Otildesmall', + 'Odieresissmall', 'OEsmall', 'Oslashsmall', 'Ugravesmall', 'Uacutesmall', + 'Ucircumflexsmall', 'Udieresissmall', 'Yacutesmall', 'Thornsmall', + 'Ydieresissmall'], + MacExpertEncoding: ['', '', '', '', '', '', '', '', '', '', '', '', '', '', + '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', + 'space', 'exclamsmall', 'Hungarumlautsmall', 'centoldstyle', + 'dollaroldstyle', 'dollarsuperior', 'ampersandsmall', 'Acutesmall', + 'parenleftsuperior', 'parenrightsuperior', 'twodotenleader', + 'onedotenleader', 'comma', 'hyphen', 'period', 'fraction', 'zerooldstyle', + 'oneoldstyle', 'twooldstyle', 'threeoldstyle', 'fouroldstyle', + 'fiveoldstyle', 'sixoldstyle', 'sevenoldstyle', 'eightoldstyle', + 'nineoldstyle', 'colon', 'semicolon', '', 'threequartersemdash', '', + 'questionsmall', '', '', '', '', 'Ethsmall', '', '', 'onequarter', + 'onehalf', 'threequarters', 'oneeighth', 'threeeighths', 'fiveeighths', + 'seveneighths', 'onethird', 'twothirds', '', '', '', '', '', '', 'ff', + 'fi', 'fl', 'ffi', 'ffl', 'parenleftinferior', '', 'parenrightinferior', + 'Circumflexsmall', 'hypheninferior', 'Gravesmall', 'Asmall', 'Bsmall', + 'Csmall', 'Dsmall', 'Esmall', 'Fsmall', 'Gsmall', 'Hsmall', 'Ismall', + 'Jsmall', 'Ksmall', 'Lsmall', 'Msmall', 'Nsmall', 'Osmall', 'Psmall', + 'Qsmall', 'Rsmall', 'Ssmall', 'Tsmall', 'Usmall', 'Vsmall', 'Wsmall', + 'Xsmall', 'Ysmall', 'Zsmall', 'colonmonetary', 'onefitted', 'rupiah', + 'Tildesmall', '', '', 'asuperior', 'centsuperior', '', '', '', '', + 'Aacutesmall', 'Agravesmall', 'Acircumflexsmall', 'Adieresissmall', + 'Atildesmall', 'Aringsmall', 'Ccedillasmall', 'Eacutesmall', 'Egravesmall', + 'Ecircumflexsmall', 'Edieresissmall', 'Iacutesmall', 'Igravesmall', + 'Icircumflexsmall', 'Idieresissmall', 'Ntildesmall', 'Oacutesmall', + 'Ogravesmall', 'Ocircumflexsmall', 'Odieresissmall', 'Otildesmall', + 'Uacutesmall', 'Ugravesmall', 'Ucircumflexsmall', 'Udieresissmall', '', + 'eightsuperior', 'fourinferior', 'threeinferior', 'sixinferior', + 'eightinferior', 'seveninferior', 'Scaronsmall', '', 'centinferior', + 'twoinferior', '', 'Dieresissmall', '', 'Caronsmall', 'osuperior', + 'fiveinferior', '', 'commainferior', 'periodinferior', 'Yacutesmall', '', + 'dollarinferior', '', 'Thornsmall', '', 'nineinferior', 'zeroinferior', + 'Zcaronsmall', 'AEsmall', 'Oslashsmall', 'questiondownsmall', + 'oneinferior', 'Lslashsmall', '', '', '', '', '', '', 'Cedillasmall', '', + '', '', '', '', 'OEsmall', 'figuredash', 'hyphensuperior', '', '', '', '', + 'exclamdownsmall', '', 'Ydieresissmall', '', 'onesuperior', 'twosuperior', + 'threesuperior', 'foursuperior', 'fivesuperior', 'sixsuperior', + 'sevensuperior', 'ninesuperior', 'zerosuperior', '', 'esuperior', + 'rsuperior', 'tsuperior', '', '', 'isuperior', 'ssuperior', 'dsuperior', + '', '', '', '', '', 'lsuperior', 'Ogoneksmall', 'Brevesmall', + 'Macronsmall', 'bsuperior', 'nsuperior', 'msuperior', 'commasuperior', + 'periodsuperior', 'Dotaccentsmall', 'Ringsmall'], + MacRomanEncoding: ['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', + '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', + 'space', 'exclam', 'quotedbl', 'numbersign', 'dollar', 'percent', + 'ampersand', 'quotesingle', 'parenleft', 'parenright', 'asterisk', 'plus', + 'comma', 'hyphen', 'period', 'slash', 'zero', 'one', 'two', 'three', + 'four', 'five', 'six', 'seven', 'eight', 'nine', 'colon', 'semicolon', + 'less', 'equal', 'greater', 'question', 'at', 'A', 'B', 'C', 'D', 'E', 'F', + 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', + 'V', 'W', 'X', 'Y', 'Z', 'bracketleft', 'backslash', 'bracketright', + 'asciicircum', 'underscore', 'grave', 'a', 'b', 'c', 'd', 'e', 'f', 'g', + 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', + 'w', 'x', 'y', 'z', 'braceleft', 'bar', 'braceright', 'asciitilde', '', + 'Adieresis', 'Aring', 'Ccedilla', 'Eacute', 'Ntilde', 'Odieresis', + 'Udieresis', 'aacute', 'agrave', 'acircumflex', 'adieresis', 'atilde', + 'aring', 'ccedilla', 'eacute', 'egrave', 'ecircumflex', 'edieresis', + 'iacute', 'igrave', 'icircumflex', 'idieresis', 'ntilde', 'oacute', + 'ograve', 'ocircumflex', 'odieresis', 'otilde', 'uacute', 'ugrave', + 'ucircumflex', 'udieresis', 'dagger', 'degree', 'cent', 'sterling', + 'section', 'bullet', 'paragraph', 'germandbls', 'registered', 'copyright', + 'trademark', 'acute', 'dieresis', 'notequal', 'AE', 'Oslash', 'infinity', + 'plusminus', 'lessequal', 'greaterequal', 'yen', 'mu', 'partialdiff', + 'summation', 'product', 'pi', 'integral', 'ordfeminine', 'ordmasculine', + 'Omega', 'ae', 'oslash', 'questiondown', 'exclamdown', 'logicalnot', + 'radical', 'florin', 'approxequal', 'Delta', 'guillemotleft', + 'guillemotright', 'ellipsis', 'space', 'Agrave', 'Atilde', 'Otilde', 'OE', + 'oe', 'endash', 'emdash', 'quotedblleft', 'quotedblright', 'quoteleft', + 'quoteright', 'divide', 'lozenge', 'ydieresis', 'Ydieresis', 'fraction', + 'currency', 'guilsinglleft', 'guilsinglright', 'fi', 'fl', 'daggerdbl', + 'periodcentered', 'quotesinglbase', 'quotedblbase', 'perthousand', + 'Acircumflex', 'Ecircumflex', 'Aacute', 'Edieresis', 'Egrave', 'Iacute', + 'Icircumflex', 'Idieresis', 'Igrave', 'Oacute', 'Ocircumflex', 'apple', + 'Ograve', 'Uacute', 'Ucircumflex', 'Ugrave', 'dotlessi', 'circumflex', + 'tilde', 'macron', 'breve', 'dotaccent', 'ring', 'cedilla', 'hungarumlaut', + 'ogonek', 'caron'], + StandardEncoding: ['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', + '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', + 'space', 'exclam', 'quotedbl', 'numbersign', 'dollar', 'percent', + 'ampersand', 'quoteright', 'parenleft', 'parenright', 'asterisk', 'plus', + 'comma', 'hyphen', 'period', 'slash', 'zero', 'one', 'two', 'three', + 'four', 'five', 'six', 'seven', 'eight', 'nine', 'colon', 'semicolon', + 'less', 'equal', 'greater', 'question', 'at', 'A', 'B', 'C', 'D', 'E', 'F', + 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', + 'V', 'W', 'X', 'Y', 'Z', 'bracketleft', 'backslash', 'bracketright', + 'asciicircum', 'underscore', 'quoteleft', 'a', 'b', 'c', 'd', 'e', 'f', + 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', + 'v', 'w', 'x', 'y', 'z', 'braceleft', 'bar', 'braceright', 'asciitilde', + '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', + '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', 'exclamdown', + 'cent', 'sterling', 'fraction', 'yen', 'florin', 'section', 'currency', + 'quotesingle', 'quotedblleft', 'guillemotleft', 'guilsinglleft', + 'guilsinglright', 'fi', 'fl', '', 'endash', 'dagger', 'daggerdbl', + 'periodcentered', '', 'paragraph', 'bullet', 'quotesinglbase', + 'quotedblbase', 'quotedblright', 'guillemotright', 'ellipsis', + 'perthousand', '', 'questiondown', '', 'grave', 'acute', 'circumflex', + 'tilde', 'macron', 'breve', 'dotaccent', 'dieresis', '', 'ring', 'cedilla', + '', 'hungarumlaut', 'ogonek', 'caron', 'emdash', '', '', '', '', '', '', + '', '', '', '', '', '', '', '', '', '', 'AE', '', 'ordfeminine', '', '', + '', '', 'Lslash', 'Oslash', 'OE', 'ordmasculine', '', '', '', '', '', 'ae', + '', '', '', 'dotlessi', '', '', 'lslash', 'oslash', 'oe', 'germandbls'], + WinAnsiEncoding: ['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', + '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', + 'space', 'exclam', 'quotedbl', 'numbersign', 'dollar', 'percent', + 'ampersand', 'quotesingle', 'parenleft', 'parenright', 'asterisk', 'plus', + 'comma', 'hyphen', 'period', 'slash', 'zero', 'one', 'two', 'three', + 'four', 'five', 'six', 'seven', 'eight', 'nine', 'colon', 'semicolon', + 'less', 'equal', 'greater', 'question', 'at', 'A', 'B', 'C', 'D', 'E', 'F', + 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', + 'V', 'W', 'X', 'Y', 'Z', 'bracketleft', 'backslash', 'bracketright', + 'asciicircum', 'underscore', 'grave', 'a', 'b', 'c', 'd', 'e', 'f', 'g', + 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', + 'w', 'x', 'y', 'z', 'braceleft', 'bar', 'braceright', 'asciitilde', + 'bullet', 'Euro', 'bullet', 'quotesinglbase', 'florin', 'quotedblbase', + 'ellipsis', 'dagger', 'daggerdbl', 'circumflex', 'perthousand', 'Scaron', + 'guilsinglleft', 'OE', 'bullet', 'Zcaron', 'bullet', 'bullet', 'quoteleft', + 'quoteright', 'quotedblleft', 'quotedblright', 'bullet', 'endash', + 'emdash', 'tilde', 'trademark', 'scaron', 'guilsinglright', 'oe', 'bullet', + 'zcaron', 'Ydieresis', 'space', 'exclamdown', 'cent', 'sterling', + 'currency', 'yen', 'brokenbar', 'section', 'dieresis', 'copyright', + 'ordfeminine', 'guillemotleft', 'logicalnot', 'hyphen', 'registered', + 'macron', 'degree', 'plusminus', 'twosuperior', 'threesuperior', 'acute', + 'mu', 'paragraph', 'periodcentered', 'cedilla', 'onesuperior', + 'ordmasculine', 'guillemotright', 'onequarter', 'onehalf', 'threequarters', + 'questiondown', 'Agrave', 'Aacute', 'Acircumflex', 'Atilde', 'Adieresis', + 'Aring', 'AE', 'Ccedilla', 'Egrave', 'Eacute', 'Ecircumflex', 'Edieresis', + 'Igrave', 'Iacute', 'Icircumflex', 'Idieresis', 'Eth', 'Ntilde', 'Ograve', + 'Oacute', 'Ocircumflex', 'Otilde', 'Odieresis', 'multiply', 'Oslash', + 'Ugrave', 'Uacute', 'Ucircumflex', 'Udieresis', 'Yacute', 'Thorn', + 'germandbls', 'agrave', 'aacute', 'acircumflex', 'atilde', 'adieresis', + 'aring', 'ae', 'ccedilla', 'egrave', 'eacute', 'ecircumflex', 'edieresis', + 'igrave', 'iacute', 'icircumflex', 'idieresis', 'eth', 'ntilde', 'ograve', + 'oacute', 'ocircumflex', 'otilde', 'odieresis', 'divide', 'oslash', + 'ugrave', 'uacute', 'ucircumflex', 'udieresis', 'yacute', 'thorn', + 'ydieresis'], + SymbolSetEncoding: ['', '', '', '', '', '', '', '', '', '', '', '', '', '', + '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', + 'space', 'exclam', 'universal', 'numbersign', 'existential', 'percent', + 'ampersand', 'suchthat', 'parenleft', 'parenright', 'asteriskmath', 'plus', + 'comma', 'minus', 'period', 'slash', 'zero', 'one', 'two', 'three', 'four', + 'five', 'six', 'seven', 'eight', 'nine', 'colon', 'semicolon', 'less', + 'equal', 'greater', 'question', 'congruent', 'Alpha', 'Beta', 'Chi', + 'Delta', 'Epsilon', 'Phi', 'Gamma', 'Eta', 'Iota', 'theta1', 'Kappa', + 'Lambda', 'Mu', 'Nu', 'Omicron', 'Pi', 'Theta', 'Rho', 'Sigma', 'Tau', + 'Upsilon', 'sigma1', 'Omega', 'Xi', 'Psi', 'Zeta', 'bracketleft', + 'therefore', 'bracketright', 'perpendicular', 'underscore', 'radicalex', + 'alpha', 'beta', 'chi', 'delta', 'epsilon', 'phi', 'gamma', 'eta', 'iota', + 'phi1', 'kappa', 'lambda', 'mu', 'nu', 'omicron', 'pi', 'theta', 'rho', + 'sigma', 'tau', 'upsilon', 'omega1', 'omega', 'xi', 'psi', 'zeta', + 'braceleft', 'bar', 'braceright', 'similar', '', '', '', '', '', '', '', + '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', + '', '', '', '', '', '', '', 'Euro', 'Upsilon1', 'minute', 'lessequal', + 'fraction', 'infinity', 'florin', 'club', 'diamond', 'heart', 'spade', + 'arrowboth', 'arrowleft', 'arrowup', 'arrowright', 'arrowdown', 'degree', + 'plusminus', 'second', 'greaterequal', 'multiply', 'proportional', + 'partialdiff', 'bullet', 'divide', 'notequal', 'equivalence', + 'approxequal', 'ellipsis', 'arrowvertex', 'arrowhorizex', 'carriagereturn', + 'aleph', 'Ifraktur', 'Rfraktur', 'weierstrass', 'circlemultiply', + 'circleplus', 'emptyset', 'intersection', 'union', 'propersuperset', + 'reflexsuperset', 'notsubset', 'propersubset', 'reflexsubset', 'element', + 'notelement', 'angle', 'gradient', 'registerserif', 'copyrightserif', + 'trademarkserif', 'product', 'radical', 'dotmath', 'logicalnot', + 'logicaland', 'logicalor', 'arrowdblboth', 'arrowdblleft', 'arrowdblup', + 'arrowdblright', 'arrowdbldown', 'lozenge', 'angleleft', 'registersans', + 'copyrightsans', 'trademarksans', 'summation', 'parenlefttp', + 'parenleftex', 'parenleftbt', 'bracketlefttp', 'bracketleftex', + 'bracketleftbt', 'bracelefttp', 'braceleftmid', 'braceleftbt', 'braceex', + '', 'angleright', 'integral', 'integraltp', 'integralex', 'integralbt', + 'parenrighttp', 'parenrightex', 'parenrightbt', 'bracketrighttp', + 'bracketrightex', 'bracketrightbt', 'bracerighttp', 'bracerightmid', + 'bracerightbt'], + ZapfDingbatsEncoding: ['', '', '', '', '', '', '', '', '', '', '', '', '', '', + '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', + 'space', 'a1', 'a2', 'a202', 'a3', 'a4', 'a5', 'a119', 'a118', 'a117', + 'a11', 'a12', 'a13', 'a14', 'a15', 'a16', 'a105', 'a17', 'a18', 'a19', + 'a20', 'a21', 'a22', 'a23', 'a24', 'a25', 'a26', 'a27', 'a28', 'a6', 'a7', + 'a8', 'a9', 'a10', 'a29', 'a30', 'a31', 'a32', 'a33', 'a34', 'a35', 'a36', + 'a37', 'a38', 'a39', 'a40', 'a41', 'a42', 'a43', 'a44', 'a45', 'a46', + 'a47', 'a48', 'a49', 'a50', 'a51', 'a52', 'a53', 'a54', 'a55', 'a56', + 'a57', 'a58', 'a59', 'a60', 'a61', 'a62', 'a63', 'a64', 'a65', 'a66', + 'a67', 'a68', 'a69', 'a70', 'a71', 'a72', 'a73', 'a74', 'a203', 'a75', + 'a204', 'a76', 'a77', 'a78', 'a79', 'a81', 'a82', 'a83', 'a84', 'a97', + 'a98', 'a99', 'a100', '', 'a89', 'a90', 'a93', 'a94', 'a91', 'a92', 'a205', + 'a85', 'a206', 'a86', 'a87', 'a88', 'a95', 'a96', '', '', '', '', '', '', + '', '', '', '', '', '', '', '', '', '', '', '', '', 'a101', 'a102', 'a103', + 'a104', 'a106', 'a107', 'a108', 'a112', 'a111', 'a110', 'a109', 'a120', + 'a121', 'a122', 'a123', 'a124', 'a125', 'a126', 'a127', 'a128', 'a129', + 'a130', 'a131', 'a132', 'a133', 'a134', 'a135', 'a136', 'a137', 'a138', + 'a139', 'a140', 'a141', 'a142', 'a143', 'a144', 'a145', 'a146', 'a147', + 'a148', 'a149', 'a150', 'a151', 'a152', 'a153', 'a154', 'a155', 'a156', + 'a157', 'a158', 'a159', 'a160', 'a161', 'a163', 'a164', 'a196', 'a165', + 'a192', 'a166', 'a167', 'a168', 'a169', 'a170', 'a171', 'a172', 'a173', + 'a162', 'a174', 'a175', 'a176', 'a177', 'a178', 'a179', 'a193', 'a180', + 'a199', 'a181', 'a200', 'a182', '', 'a201', 'a183', 'a184', 'a197', 'a185', + 'a194', 'a198', 'a186', 'a195', 'a187', 'a188', 'a189', 'a190', 'a191'] +}; + +/** + * Hold a map of decoded fonts and of the standard fourteen Type1 + * fonts and their acronyms. + */ +var stdFontMap = { + 'ArialNarrow': 'Helvetica', + 'ArialNarrow-Bold': 'Helvetica-Bold', + 'ArialNarrow-BoldItalic': 'Helvetica-BoldOblique', + 'ArialNarrow-Italic': 'Helvetica-Oblique', + 'ArialBlack': 'Helvetica', + 'ArialBlack-Bold': 'Helvetica-Bold', + 'ArialBlack-BoldItalic': 'Helvetica-BoldOblique', + 'ArialBlack-Italic': 'Helvetica-Oblique', + 'Arial': 'Helvetica', + 'Arial-Bold': 'Helvetica-Bold', + 'Arial-BoldItalic': 'Helvetica-BoldOblique', + 'Arial-Italic': 'Helvetica-Oblique', + 'Arial-BoldItalicMT': 'Helvetica-BoldOblique', + 'Arial-BoldMT': 'Helvetica-Bold', + 'Arial-ItalicMT': 'Helvetica-Oblique', + 'ArialMT': 'Helvetica', + 'Courier-Bold': 'Courier-Bold', + 'Courier-BoldItalic': 'Courier-BoldOblique', + 'Courier-Italic': 'Courier-Oblique', + 'CourierNew': 'Courier', + 'CourierNew-Bold': 'Courier-Bold', + 'CourierNew-BoldItalic': 'Courier-BoldOblique', + 'CourierNew-Italic': 'Courier-Oblique', + 'CourierNewPS-BoldItalicMT': 'Courier-BoldOblique', + 'CourierNewPS-BoldMT': 'Courier-Bold', + 'CourierNewPS-ItalicMT': 'Courier-Oblique', + 'CourierNewPSMT': 'Courier', + 'Helvetica': 'Helvetica', + 'Helvetica-Bold': 'Helvetica-Bold', + 'Helvetica-BoldItalic': 'Helvetica-BoldOblique', + 'Helvetica-BoldOblique': 'Helvetica-BoldOblique', + 'Helvetica-Italic': 'Helvetica-Oblique', + 'Helvetica-Oblique':'Helvetica-Oblique', + 'Symbol-Bold': 'Symbol', + 'Symbol-BoldItalic': 'Symbol', + 'Symbol-Italic': 'Symbol', + 'TimesNewRoman': 'Times-Roman', + 'TimesNewRoman-Bold': 'Times-Bold', + 'TimesNewRoman-BoldItalic': 'Times-BoldItalic', + 'TimesNewRoman-Italic': 'Times-Italic', + 'TimesNewRomanPS': 'Times-Roman', + 'TimesNewRomanPS-Bold': 'Times-Bold', + 'TimesNewRomanPS-BoldItalic': 'Times-BoldItalic', + 'TimesNewRomanPS-BoldItalicMT': 'Times-BoldItalic', + 'TimesNewRomanPS-BoldMT': 'Times-Bold', + 'TimesNewRomanPS-Italic': 'Times-Italic', + 'TimesNewRomanPS-ItalicMT': 'Times-Italic', + 'TimesNewRomanPSMT': 'Times-Roman', + 'TimesNewRomanPSMT-Bold': 'Times-Bold', + 'TimesNewRomanPSMT-BoldItalic': 'Times-BoldItalic', + 'TimesNewRomanPSMT-Italic': 'Times-Italic' +}; + +/** + * Holds the map of the non-standard fonts that might be included as a standard + * fonts without glyph data. + */ +var nonStdFontMap = { + 'CenturyGothic': 'Helvetica', + 'CenturyGothic-Bold': 'Helvetica-Bold', + 'CenturyGothic-BoldItalic': 'Helvetica-BoldOblique', + 'CenturyGothic-Italic': 'Helvetica-Oblique', + 'ComicSansMS': 'Comic Sans MS', + 'ComicSansMS-Bold': 'Comic Sans MS-Bold', + 'ComicSansMS-BoldItalic': 'Comic Sans MS-BoldItalic', + 'ComicSansMS-Italic': 'Comic Sans MS-Italic', + 'LucidaConsole': 'Courier', + 'LucidaConsole-Bold': 'Courier-Bold', + 'LucidaConsole-BoldItalic': 'Courier-BoldOblique', + 'LucidaConsole-Italic': 'Courier-Oblique', + 'MS-Gothic': 'MS Gothic', + 'MS-Gothic-Bold': 'MS Gothic-Bold', + 'MS-Gothic-BoldItalic': 'MS Gothic-BoldItalic', + 'MS-Gothic-Italic': 'MS Gothic-Italic', + 'MS-Mincho': 'MS Mincho', + 'MS-Mincho-Bold': 'MS Mincho-Bold', + 'MS-Mincho-BoldItalic': 'MS Mincho-BoldItalic', + 'MS-Mincho-Italic': 'MS Mincho-Italic', + 'MS-PGothic': 'MS PGothic', + 'MS-PGothic-Bold': 'MS PGothic-Bold', + 'MS-PGothic-BoldItalic': 'MS PGothic-BoldItalic', + 'MS-PGothic-Italic': 'MS PGothic-Italic', + 'MS-PMincho': 'MS PMincho', + 'MS-PMincho-Bold': 'MS PMincho-Bold', + 'MS-PMincho-BoldItalic': 'MS PMincho-BoldItalic', + 'MS-PMincho-Italic': 'MS PMincho-Italic', + 'Wingdings': 'ZapfDingbats' +}; + +var serifFonts = { + 'Adobe Jenson': true, 'Adobe Text': true, 'Albertus': true, + 'Aldus': true, 'Alexandria': true, 'Algerian': true, + 'American Typewriter': true, 'Antiqua': true, 'Apex': true, + 'Arno': true, 'Aster': true, 'Aurora': true, + 'Baskerville': true, 'Bell': true, 'Bembo': true, + 'Bembo Schoolbook': true, 'Benguiat': true, 'Berkeley Old Style': true, + 'Bernhard Modern': true, 'Berthold City': true, 'Bodoni': true, + 'Bauer Bodoni': true, 'Book Antiqua': true, 'Bookman': true, + 'Bordeaux Roman': true, 'Californian FB': true, 'Calisto': true, + 'Calvert': true, 'Capitals': true, 'Cambria': true, + 'Cartier': true, 'Caslon': true, 'Catull': true, + 'Centaur': true, 'Century Old Style': true, 'Century Schoolbook': true, + 'Chaparral': true, 'Charis SIL': true, 'Cheltenham': true, + 'Cholla Slab': true, 'Clarendon': true, 'Clearface': true, + 'Cochin': true, 'Colonna': true, 'Computer Modern': true, + 'Concrete Roman': true, 'Constantia': true, 'Cooper Black': true, + 'Corona': true, 'Ecotype': true, 'Egyptienne': true, + 'Elephant': true, 'Excelsior': true, 'Fairfield': true, + 'FF Scala': true, 'Folkard': true, 'Footlight': true, + 'FreeSerif': true, 'Friz Quadrata': true, 'Garamond': true, + 'Gentium': true, 'Georgia': true, 'Gloucester': true, + 'Goudy Old Style': true, 'Goudy Schoolbook': true, 'Goudy Pro Font': true, + 'Granjon': true, 'Guardian Egyptian': true, 'Heather': true, + 'Hercules': true, 'High Tower Text': true, 'Hiroshige': true, + 'Hoefler Text': true, 'Humana Serif': true, 'Imprint': true, + 'Ionic No. 5': true, 'Janson': true, 'Joanna': true, + 'Korinna': true, 'Lexicon': true, 'Liberation Serif': true, + 'Linux Libertine': true, 'Literaturnaya': true, 'Lucida': true, + 'Lucida Bright': true, 'Melior': true, 'Memphis': true, + 'Miller': true, 'Minion': true, 'Modern': true, + 'Mona Lisa': true, 'Mrs Eaves': true, 'MS Serif': true, + 'Museo Slab': true, 'New York': true, 'Nimbus Roman': true, + 'NPS Rawlinson Roadway': true, 'Palatino': true, 'Perpetua': true, + 'Plantin': true, 'Plantin Schoolbook': true, 'Playbill': true, + 'Poor Richard': true, 'Rawlinson Roadway': true, 'Renault': true, + 'Requiem': true, 'Rockwell': true, 'Roman': true, + 'Rotis Serif': true, 'Sabon': true, 'Scala': true, + 'Seagull': true, 'Sistina': true, 'Souvenir': true, + 'STIX': true, 'Stone Informal': true, 'Stone Serif': true, + 'Sylfaen': true, 'Times': true, 'Trajan': true, + 'Trinité': true, 'Trump Mediaeval': true, 'Utopia': true, + 'Vale Type': true, 'Bitstream Vera': true, 'Vera Serif': true, + 'Versailles': true, 'Wanted': true, 'Weiss': true, + 'Wide Latin': true, 'Windsor': true, 'XITS': true +}; + +var symbolsFonts = { + 'Dingbats': true, 'Symbol': true, 'ZapfDingbats': true +}; + +// Glyph map for well-known standard fonts. Sometimes Ghostscript uses CID fonts +// but does not embed the CID to GID mapping. The mapping is incomplete for all +// glyphs, but common for some set of the standard fonts. +var GlyphMapForStandardFonts = { + '2': 10, '3': 32, '4': 33, '5': 34, '6': 35, '7': 36, '8': 37, '9': 38, + '10': 39, '11': 40, '12': 41, '13': 42, '14': 43, '15': 44, '16': 45, + '17': 46, '18': 47, '19': 48, '20': 49, '21': 50, '22': 51, '23': 52, + '24': 53, '25': 54, '26': 55, '27': 56, '28': 57, '29': 58, '30': 894, + '31': 60, '32': 61, '33': 62, '34': 63, '35': 64, '36': 65, '37': 66, + '38': 67, '39': 68, '40': 69, '41': 70, '42': 71, '43': 72, '44': 73, + '45': 74, '46': 75, '47': 76, '48': 77, '49': 78, '50': 79, '51': 80, + '52': 81, '53': 82, '54': 83, '55': 84, '56': 85, '57': 86, '58': 87, + '59': 88, '60': 89, '61': 90, '62': 91, '63': 92, '64': 93, '65': 94, + '66': 95, '67': 96, '68': 97, '69': 98, '70': 99, '71': 100, '72': 101, + '73': 102, '74': 103, '75': 104, '76': 105, '77': 106, '78': 107, '79': 108, + '80': 109, '81': 110, '82': 111, '83': 112, '84': 113, '85': 114, '86': 115, + '87': 116, '88': 117, '89': 118, '90': 119, '91': 120, '92': 121, '93': 122, + '94': 123, '95': 124, '96': 125, '97': 126, '98': 196, '99': 197, '100': 199, + '101': 201, '102': 209, '103': 214, '104': 220, '105': 225, '106': 224, + '107': 226, '108': 228, '109': 227, '110': 229, '111': 231, '112': 233, + '113': 232, '114': 234, '115': 235, '116': 237, '117': 236, '118': 238, + '119': 239, '120': 241, '121': 243, '122': 242, '123': 244, '124': 246, + '125': 245, '126': 250, '127': 249, '128': 251, '129': 252, '130': 8224, + '131': 176, '132': 162, '133': 163, '134': 167, '135': 8226, '136': 182, + '137': 223, '138': 174, '139': 169, '140': 8482, '141': 180, '142': 168, + '143': 8800, '144': 198, '145': 216, '146': 8734, '147': 177, '148': 8804, + '149': 8805, '150': 165, '151': 181, '152': 8706, '153': 8721, '154': 8719, + '156': 8747, '157': 170, '158': 186, '159': 8486, '160': 230, '161': 248, + '162': 191, '163': 161, '164': 172, '165': 8730, '166': 402, '167': 8776, + '168': 8710, '169': 171, '170': 187, '171': 8230, '210': 218, '223': 711, + '224': 321, '225': 322, '227': 353, '229': 382, '234': 253, '252': 263, + '253': 268, '254': 269, '258': 258, '260': 260, '261': 261, '265': 280, + '266': 281, '268': 283, '269': 313, '275': 323, '276': 324, '278': 328, + '284': 345, '285': 346, '286': 347, '292': 367, '295': 377, '296': 378, + '298': 380, '305': 963, + '306': 964, '307': 966, '308': 8215, '309': 8252, '310': 8319, '311': 8359, + '312': 8592, '313': 8593, '337': 9552, '493': 1039, '494': 1040, '705': 1524, + '706': 8362, '710': 64288, '711': 64298, '759': 1617, '761': 1776, + '763': 1778, '775': 1652, '777': 1764, '778': 1780, '779': 1781, '780': 1782, + '782': 771, '783': 64726, '786': 8363, '788': 8532, '790': 768, '791': 769, + '792': 768, '795': 803, '797': 64336, '798': 64337, '799': 64342, + '800': 64343, '801': 64344, '802': 64345, '803': 64362, '804': 64363, + '805': 64364, '2424': 7821, '2425': 7822, '2426': 7823, '2427': 7824, + '2428': 7825, '2429': 7826, '2430': 7827, '2433': 7682, '2678': 8045, + '2679': 8046, '2830': 1552, '2838': 686, '2840': 751, '2842': 753, + '2843': 754, '2844': 755, '2846': 757, '2856': 767, '2857': 848, '2858': 849, + '2862': 853, '2863': 854, '2864': 855, '2865': 861, '2866': 862, '2906': 7460, + '2908': 7462, '2909': 7463, '2910': 7464, '2912': 7466, '2913': 7467, + '2914': 7468, '2916': 7470, '2917': 7471, '2918': 7472, '2920': 7474, + '2921': 7475, '2922': 7476, '2924': 7478, '2925': 7479, '2926': 7480, + '2928': 7482, '2929': 7483, '2930': 7484, '2932': 7486, '2933': 7487, + '2934': 7488, '2936': 7490, '2937': 7491, '2938': 7492, '2940': 7494, + '2941': 7495, '2942': 7496, '2944': 7498, '2946': 7500, '2948': 7502, + '2950': 7504, '2951': 7505, '2952': 7506, '2954': 7508, '2955': 7509, + '2956': 7510, '2958': 7512, '2959': 7513, '2960': 7514, '2962': 7516, + '2963': 7517, '2964': 7518, '2966': 7520, '2967': 7521, '2968': 7522, + '2970': 7524, '2971': 7525, '2972': 7526, '2974': 7528, '2975': 7529, + '2976': 7530, '2978': 1537, '2979': 1538, '2980': 1539, '2982': 1549, + '2983': 1551, '2984': 1552, '2986': 1554, '2987': 1555, '2988': 1556, + '2990': 1623, '2991': 1624, '2995': 1775, '2999': 1791, '3002': 64290, + '3003': 64291, '3004': 64292, '3006': 64294, '3007': 64295, '3008': 64296, + '3011': 1900, '3014': 8223, '3015': 8244, '3017': 7532, '3018': 7533, + '3019': 7534, '3075': 7590, '3076': 7591, '3079': 7594, '3080': 7595, + '3083': 7598, '3084': 7599, '3087': 7602, '3088': 7603, '3091': 7606, + '3092': 7607, '3095': 7610, '3096': 7611, '3099': 7614, '3100': 7615, + '3103': 7618, '3104': 7619, '3107': 8337, '3108': 8338, '3116': 1884, + '3119': 1885, '3120': 1885, '3123': 1886, '3124': 1886, '3127': 1887, + '3128': 1887, '3131': 1888, '3132': 1888, '3135': 1889, '3136': 1889, + '3139': 1890, '3140': 1890, '3143': 1891, '3144': 1891, '3147': 1892, + '3148': 1892, '3153': 580, '3154': 581, '3157': 584, '3158': 585, '3161': 588, + '3162': 589, '3165': 891, '3166': 892, '3169': 1274, '3170': 1275, + '3173': 1278, '3174': 1279, '3181': 7622, '3182': 7623, '3282': 11799, + '3316': 578, '3379': 42785, '3393': 1159, '3416': 8377 +}; + +// The glyph map for ArialBlack differs slightly from the glyph map used for +// other well-known standard fonts. Hence we use this (incomplete) CID to GID +// mapping to adjust the glyph map for non-embedded ArialBlack fonts. +var SupplementalGlyphMapForArialBlack = { + '227': 322, '264': 261, '291': 346, +}; + +// Some characters, e.g. copyrightserif, are mapped to the private use area and +// might not be displayed using standard fonts. Mapping/hacking well-known chars +// to the similar equivalents in the normal characters range. +var SpecialPUASymbols = { + '63721': 0x00A9, // copyrightsans (0xF8E9) => copyright + '63193': 0x00A9, // copyrightserif (0xF6D9) => copyright + '63720': 0x00AE, // registersans (0xF8E8) => registered + '63194': 0x00AE, // registerserif (0xF6DA) => registered + '63722': 0x2122, // trademarksans (0xF8EA) => trademark + '63195': 0x2122, // trademarkserif (0xF6DB) => trademark + '63729': 0x23A7, // bracelefttp (0xF8F1) + '63730': 0x23A8, // braceleftmid (0xF8F2) + '63731': 0x23A9, // braceleftbt (0xF8F3) + '63740': 0x23AB, // bracerighttp (0xF8FC) + '63741': 0x23AC, // bracerightmid (0xF8FD) + '63742': 0x23AD, // bracerightbt (0xF8FE) + '63726': 0x23A1, // bracketlefttp (0xF8EE) + '63727': 0x23A2, // bracketleftex (0xF8EF) + '63728': 0x23A3, // bracketleftbt (0xF8F0) + '63737': 0x23A4, // bracketrighttp (0xF8F9) + '63738': 0x23A5, // bracketrightex (0xF8FA) + '63739': 0x23A6, // bracketrightbt (0xF8FB) + '63723': 0x239B, // parenlefttp (0xF8EB) + '63724': 0x239C, // parenleftex (0xF8EC) + '63725': 0x239D, // parenleftbt (0xF8ED) + '63734': 0x239E, // parenrighttp (0xF8F6) + '63735': 0x239F, // parenrightex (0xF8F7) + '63736': 0x23A0, // parenrightbt (0xF8F8) +}; +function mapSpecialUnicodeValues(code) { + if (code >= 0xFFF0 && code <= 0xFFFF) { // Specials unicode block. + return 0; + } else if (code >= 0xF600 && code <= 0xF8FF) { + return (SpecialPUASymbols[code] || code); + } + return code; +} + +var UnicodeRanges = [ + { 'begin': 0x0000, 'end': 0x007F }, // Basic Latin + { 'begin': 0x0080, 'end': 0x00FF }, // Latin-1 Supplement + { 'begin': 0x0100, 'end': 0x017F }, // Latin Extended-A + { 'begin': 0x0180, 'end': 0x024F }, // Latin Extended-B + { 'begin': 0x0250, 'end': 0x02AF }, // IPA Extensions + { 'begin': 0x02B0, 'end': 0x02FF }, // Spacing Modifier Letters + { 'begin': 0x0300, 'end': 0x036F }, // Combining Diacritical Marks + { 'begin': 0x0370, 'end': 0x03FF }, // Greek and Coptic + { 'begin': 0x2C80, 'end': 0x2CFF }, // Coptic + { 'begin': 0x0400, 'end': 0x04FF }, // Cyrillic + { 'begin': 0x0530, 'end': 0x058F }, // Armenian + { 'begin': 0x0590, 'end': 0x05FF }, // Hebrew + { 'begin': 0xA500, 'end': 0xA63F }, // Vai + { 'begin': 0x0600, 'end': 0x06FF }, // Arabic + { 'begin': 0x07C0, 'end': 0x07FF }, // NKo + { 'begin': 0x0900, 'end': 0x097F }, // Devanagari + { 'begin': 0x0980, 'end': 0x09FF }, // Bengali + { 'begin': 0x0A00, 'end': 0x0A7F }, // Gurmukhi + { 'begin': 0x0A80, 'end': 0x0AFF }, // Gujarati + { 'begin': 0x0B00, 'end': 0x0B7F }, // Oriya + { 'begin': 0x0B80, 'end': 0x0BFF }, // Tamil + { 'begin': 0x0C00, 'end': 0x0C7F }, // Telugu + { 'begin': 0x0C80, 'end': 0x0CFF }, // Kannada + { 'begin': 0x0D00, 'end': 0x0D7F }, // Malayalam + { 'begin': 0x0E00, 'end': 0x0E7F }, // Thai + { 'begin': 0x0E80, 'end': 0x0EFF }, // Lao + { 'begin': 0x10A0, 'end': 0x10FF }, // Georgian + { 'begin': 0x1B00, 'end': 0x1B7F }, // Balinese + { 'begin': 0x1100, 'end': 0x11FF }, // Hangul Jamo + { 'begin': 0x1E00, 'end': 0x1EFF }, // Latin Extended Additional + { 'begin': 0x1F00, 'end': 0x1FFF }, // Greek Extended + { 'begin': 0x2000, 'end': 0x206F }, // General Punctuation + { 'begin': 0x2070, 'end': 0x209F }, // Superscripts And Subscripts + { 'begin': 0x20A0, 'end': 0x20CF }, // Currency Symbol + { 'begin': 0x20D0, 'end': 0x20FF }, // Combining Diacritical Marks For Symbols + { 'begin': 0x2100, 'end': 0x214F }, // Letterlike Symbols + { 'begin': 0x2150, 'end': 0x218F }, // Number Forms + { 'begin': 0x2190, 'end': 0x21FF }, // Arrows + { 'begin': 0x2200, 'end': 0x22FF }, // Mathematical Operators + { 'begin': 0x2300, 'end': 0x23FF }, // Miscellaneous Technical + { 'begin': 0x2400, 'end': 0x243F }, // Control Pictures + { 'begin': 0x2440, 'end': 0x245F }, // Optical Character Recognition + { 'begin': 0x2460, 'end': 0x24FF }, // Enclosed Alphanumerics + { 'begin': 0x2500, 'end': 0x257F }, // Box Drawing + { 'begin': 0x2580, 'end': 0x259F }, // Block Elements + { 'begin': 0x25A0, 'end': 0x25FF }, // Geometric Shapes + { 'begin': 0x2600, 'end': 0x26FF }, // Miscellaneous Symbols + { 'begin': 0x2700, 'end': 0x27BF }, // Dingbats + { 'begin': 0x3000, 'end': 0x303F }, // CJK Symbols And Punctuation + { 'begin': 0x3040, 'end': 0x309F }, // Hiragana + { 'begin': 0x30A0, 'end': 0x30FF }, // Katakana + { 'begin': 0x3100, 'end': 0x312F }, // Bopomofo + { 'begin': 0x3130, 'end': 0x318F }, // Hangul Compatibility Jamo + { 'begin': 0xA840, 'end': 0xA87F }, // Phags-pa + { 'begin': 0x3200, 'end': 0x32FF }, // Enclosed CJK Letters And Months + { 'begin': 0x3300, 'end': 0x33FF }, // CJK Compatibility + { 'begin': 0xAC00, 'end': 0xD7AF }, // Hangul Syllables + { 'begin': 0xD800, 'end': 0xDFFF }, // Non-Plane 0 * + { 'begin': 0x10900, 'end': 0x1091F }, // Phoenicia + { 'begin': 0x4E00, 'end': 0x9FFF }, // CJK Unified Ideographs + { 'begin': 0xE000, 'end': 0xF8FF }, // Private Use Area (plane 0) + { 'begin': 0x31C0, 'end': 0x31EF }, // CJK Strokes + { 'begin': 0xFB00, 'end': 0xFB4F }, // Alphabetic Presentation Forms + { 'begin': 0xFB50, 'end': 0xFDFF }, // Arabic Presentation Forms-A + { 'begin': 0xFE20, 'end': 0xFE2F }, // Combining Half Marks + { 'begin': 0xFE10, 'end': 0xFE1F }, // Vertical Forms + { 'begin': 0xFE50, 'end': 0xFE6F }, // Small Form Variants + { 'begin': 0xFE70, 'end': 0xFEFF }, // Arabic Presentation Forms-B + { 'begin': 0xFF00, 'end': 0xFFEF }, // Halfwidth And Fullwidth Forms + { 'begin': 0xFFF0, 'end': 0xFFFF }, // Specials + { 'begin': 0x0F00, 'end': 0x0FFF }, // Tibetan + { 'begin': 0x0700, 'end': 0x074F }, // Syriac + { 'begin': 0x0780, 'end': 0x07BF }, // Thaana + { 'begin': 0x0D80, 'end': 0x0DFF }, // Sinhala + { 'begin': 0x1000, 'end': 0x109F }, // Myanmar + { 'begin': 0x1200, 'end': 0x137F }, // Ethiopic + { 'begin': 0x13A0, 'end': 0x13FF }, // Cherokee + { 'begin': 0x1400, 'end': 0x167F }, // Unified Canadian Aboriginal Syllabics + { 'begin': 0x1680, 'end': 0x169F }, // Ogham + { 'begin': 0x16A0, 'end': 0x16FF }, // Runic + { 'begin': 0x1780, 'end': 0x17FF }, // Khmer + { 'begin': 0x1800, 'end': 0x18AF }, // Mongolian + { 'begin': 0x2800, 'end': 0x28FF }, // Braille Patterns + { 'begin': 0xA000, 'end': 0xA48F }, // Yi Syllables + { 'begin': 0x1700, 'end': 0x171F }, // Tagalog + { 'begin': 0x10300, 'end': 0x1032F }, // Old Italic + { 'begin': 0x10330, 'end': 0x1034F }, // Gothic + { 'begin': 0x10400, 'end': 0x1044F }, // Deseret + { 'begin': 0x1D000, 'end': 0x1D0FF }, // Byzantine Musical Symbols + { 'begin': 0x1D400, 'end': 0x1D7FF }, // Mathematical Alphanumeric Symbols + { 'begin': 0xFF000, 'end': 0xFFFFD }, // Private Use (plane 15) + { 'begin': 0xFE00, 'end': 0xFE0F }, // Variation Selectors + { 'begin': 0xE0000, 'end': 0xE007F }, // Tags + { 'begin': 0x1900, 'end': 0x194F }, // Limbu + { 'begin': 0x1950, 'end': 0x197F }, // Tai Le + { 'begin': 0x1980, 'end': 0x19DF }, // New Tai Lue + { 'begin': 0x1A00, 'end': 0x1A1F }, // Buginese + { 'begin': 0x2C00, 'end': 0x2C5F }, // Glagolitic + { 'begin': 0x2D30, 'end': 0x2D7F }, // Tifinagh + { 'begin': 0x4DC0, 'end': 0x4DFF }, // Yijing Hexagram Symbols + { 'begin': 0xA800, 'end': 0xA82F }, // Syloti Nagri + { 'begin': 0x10000, 'end': 0x1007F }, // Linear B Syllabary + { 'begin': 0x10140, 'end': 0x1018F }, // Ancient Greek Numbers + { 'begin': 0x10380, 'end': 0x1039F }, // Ugaritic + { 'begin': 0x103A0, 'end': 0x103DF }, // Old Persian + { 'begin': 0x10450, 'end': 0x1047F }, // Shavian + { 'begin': 0x10480, 'end': 0x104AF }, // Osmanya + { 'begin': 0x10800, 'end': 0x1083F }, // Cypriot Syllabary + { 'begin': 0x10A00, 'end': 0x10A5F }, // Kharoshthi + { 'begin': 0x1D300, 'end': 0x1D35F }, // Tai Xuan Jing Symbols + { 'begin': 0x12000, 'end': 0x123FF }, // Cuneiform + { 'begin': 0x1D360, 'end': 0x1D37F }, // Counting Rod Numerals + { 'begin': 0x1B80, 'end': 0x1BBF }, // Sundanese + { 'begin': 0x1C00, 'end': 0x1C4F }, // Lepcha + { 'begin': 0x1C50, 'end': 0x1C7F }, // Ol Chiki + { 'begin': 0xA880, 'end': 0xA8DF }, // Saurashtra + { 'begin': 0xA900, 'end': 0xA92F }, // Kayah Li + { 'begin': 0xA930, 'end': 0xA95F }, // Rejang + { 'begin': 0xAA00, 'end': 0xAA5F }, // Cham + { 'begin': 0x10190, 'end': 0x101CF }, // Ancient Symbols + { 'begin': 0x101D0, 'end': 0x101FF }, // Phaistos Disc + { 'begin': 0x102A0, 'end': 0x102DF }, // Carian + { 'begin': 0x1F030, 'end': 0x1F09F } // Domino Tiles +]; + +var MacStandardGlyphOrdering = [ + '.notdef', '.null', 'nonmarkingreturn', 'space', 'exclam', 'quotedbl', + 'numbersign', 'dollar', 'percent', 'ampersand', 'quotesingle', 'parenleft', + 'parenright', 'asterisk', 'plus', 'comma', 'hyphen', 'period', 'slash', + 'zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', + 'nine', 'colon', 'semicolon', 'less', 'equal', 'greater', 'question', 'at', + 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', + 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'bracketleft', + 'backslash', 'bracketright', 'asciicircum', 'underscore', 'grave', 'a', 'b', + 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', + 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'braceleft', 'bar', 'braceright', + 'asciitilde', 'Adieresis', 'Aring', 'Ccedilla', 'Eacute', 'Ntilde', + 'Odieresis', 'Udieresis', 'aacute', 'agrave', 'acircumflex', 'adieresis', + 'atilde', 'aring', 'ccedilla', 'eacute', 'egrave', 'ecircumflex', 'edieresis', + 'iacute', 'igrave', 'icircumflex', 'idieresis', 'ntilde', 'oacute', 'ograve', + 'ocircumflex', 'odieresis', 'otilde', 'uacute', 'ugrave', 'ucircumflex', + 'udieresis', 'dagger', 'degree', 'cent', 'sterling', 'section', 'bullet', + 'paragraph', 'germandbls', 'registered', 'copyright', 'trademark', 'acute', + 'dieresis', 'notequal', 'AE', 'Oslash', 'infinity', 'plusminus', 'lessequal', + 'greaterequal', 'yen', 'mu', 'partialdiff', 'summation', 'product', 'pi', + 'integral', 'ordfeminine', 'ordmasculine', 'Omega', 'ae', 'oslash', + 'questiondown', 'exclamdown', 'logicalnot', 'radical', 'florin', + 'approxequal', 'Delta', 'guillemotleft', 'guillemotright', 'ellipsis', + 'nonbreakingspace', 'Agrave', 'Atilde', 'Otilde', 'OE', 'oe', 'endash', + 'emdash', 'quotedblleft', 'quotedblright', 'quoteleft', 'quoteright', + 'divide', 'lozenge', 'ydieresis', 'Ydieresis', 'fraction', 'currency', + 'guilsinglleft', 'guilsinglright', 'fi', 'fl', 'daggerdbl', 'periodcentered', + 'quotesinglbase', 'quotedblbase', 'perthousand', 'Acircumflex', + 'Ecircumflex', 'Aacute', 'Edieresis', 'Egrave', 'Iacute', 'Icircumflex', + 'Idieresis', 'Igrave', 'Oacute', 'Ocircumflex', 'apple', 'Ograve', 'Uacute', + 'Ucircumflex', 'Ugrave', 'dotlessi', 'circumflex', 'tilde', 'macron', + 'breve', 'dotaccent', 'ring', 'cedilla', 'hungarumlaut', 'ogonek', 'caron', + 'Lslash', 'lslash', 'Scaron', 'scaron', 'Zcaron', 'zcaron', 'brokenbar', + 'Eth', 'eth', 'Yacute', 'yacute', 'Thorn', 'thorn', 'minus', 'multiply', + 'onesuperior', 'twosuperior', 'threesuperior', 'onehalf', 'onequarter', + 'threequarters', 'franc', 'Gbreve', 'gbreve', 'Idotaccent', 'Scedilla', + 'scedilla', 'Cacute', 'cacute', 'Ccaron', 'ccaron', 'dcroat']; + +function getUnicodeRangeFor(value) { + for (var i = 0, ii = UnicodeRanges.length; i < ii; i++) { + var range = UnicodeRanges[i]; + if (value >= range.begin && value < range.end) { + return i; + } + } + return -1; +} + +function isRTLRangeFor(value) { + var range = UnicodeRanges[13]; + if (value >= range.begin && value < range.end) { + return true; + } + range = UnicodeRanges[11]; + if (value >= range.begin && value < range.end) { + return true; + } + return false; +} + +// The normalization table is obtained by filtering the Unicode characters +// database with entries. +var NormalizedUnicodes = { + '\u00A8': '\u0020\u0308', + '\u00AF': '\u0020\u0304', + '\u00B4': '\u0020\u0301', + '\u00B5': '\u03BC', + '\u00B8': '\u0020\u0327', + '\u0132': '\u0049\u004A', + '\u0133': '\u0069\u006A', + '\u013F': '\u004C\u00B7', + '\u0140': '\u006C\u00B7', + '\u0149': '\u02BC\u006E', + '\u017F': '\u0073', + '\u01C4': '\u0044\u017D', + '\u01C5': '\u0044\u017E', + '\u01C6': '\u0064\u017E', + '\u01C7': '\u004C\u004A', + '\u01C8': '\u004C\u006A', + '\u01C9': '\u006C\u006A', + '\u01CA': '\u004E\u004A', + '\u01CB': '\u004E\u006A', + '\u01CC': '\u006E\u006A', + '\u01F1': '\u0044\u005A', + '\u01F2': '\u0044\u007A', + '\u01F3': '\u0064\u007A', + '\u02D8': '\u0020\u0306', + '\u02D9': '\u0020\u0307', + '\u02DA': '\u0020\u030A', + '\u02DB': '\u0020\u0328', + '\u02DC': '\u0020\u0303', + '\u02DD': '\u0020\u030B', + '\u037A': '\u0020\u0345', + '\u0384': '\u0020\u0301', + '\u03D0': '\u03B2', + '\u03D1': '\u03B8', + '\u03D2': '\u03A5', + '\u03D5': '\u03C6', + '\u03D6': '\u03C0', + '\u03F0': '\u03BA', + '\u03F1': '\u03C1', + '\u03F2': '\u03C2', + '\u03F4': '\u0398', + '\u03F5': '\u03B5', + '\u03F9': '\u03A3', + '\u0587': '\u0565\u0582', + '\u0675': '\u0627\u0674', + '\u0676': '\u0648\u0674', + '\u0677': '\u06C7\u0674', + '\u0678': '\u064A\u0674', + '\u0E33': '\u0E4D\u0E32', + '\u0EB3': '\u0ECD\u0EB2', + '\u0EDC': '\u0EAB\u0E99', + '\u0EDD': '\u0EAB\u0EA1', + '\u0F77': '\u0FB2\u0F81', + '\u0F79': '\u0FB3\u0F81', + '\u1E9A': '\u0061\u02BE', + '\u1FBD': '\u0020\u0313', + '\u1FBF': '\u0020\u0313', + '\u1FC0': '\u0020\u0342', + '\u1FFE': '\u0020\u0314', + '\u2002': '\u0020', + '\u2003': '\u0020', + '\u2004': '\u0020', + '\u2005': '\u0020', + '\u2006': '\u0020', + '\u2008': '\u0020', + '\u2009': '\u0020', + '\u200A': '\u0020', + '\u2017': '\u0020\u0333', + '\u2024': '\u002E', + '\u2025': '\u002E\u002E', + '\u2026': '\u002E\u002E\u002E', + '\u2033': '\u2032\u2032', + '\u2034': '\u2032\u2032\u2032', + '\u2036': '\u2035\u2035', + '\u2037': '\u2035\u2035\u2035', + '\u203C': '\u0021\u0021', + '\u203E': '\u0020\u0305', + '\u2047': '\u003F\u003F', + '\u2048': '\u003F\u0021', + '\u2049': '\u0021\u003F', + '\u2057': '\u2032\u2032\u2032\u2032', + '\u205F': '\u0020', + '\u20A8': '\u0052\u0073', + '\u2100': '\u0061\u002F\u0063', + '\u2101': '\u0061\u002F\u0073', + '\u2103': '\u00B0\u0043', + '\u2105': '\u0063\u002F\u006F', + '\u2106': '\u0063\u002F\u0075', + '\u2107': '\u0190', + '\u2109': '\u00B0\u0046', + '\u2116': '\u004E\u006F', + '\u2121': '\u0054\u0045\u004C', + '\u2135': '\u05D0', + '\u2136': '\u05D1', + '\u2137': '\u05D2', + '\u2138': '\u05D3', + '\u213B': '\u0046\u0041\u0058', + '\u2160': '\u0049', + '\u2161': '\u0049\u0049', + '\u2162': '\u0049\u0049\u0049', + '\u2163': '\u0049\u0056', + '\u2164': '\u0056', + '\u2165': '\u0056\u0049', + '\u2166': '\u0056\u0049\u0049', + '\u2167': '\u0056\u0049\u0049\u0049', + '\u2168': '\u0049\u0058', + '\u2169': '\u0058', + '\u216A': '\u0058\u0049', + '\u216B': '\u0058\u0049\u0049', + '\u216C': '\u004C', + '\u216D': '\u0043', + '\u216E': '\u0044', + '\u216F': '\u004D', + '\u2170': '\u0069', + '\u2171': '\u0069\u0069', + '\u2172': '\u0069\u0069\u0069', + '\u2173': '\u0069\u0076', + '\u2174': '\u0076', + '\u2175': '\u0076\u0069', + '\u2176': '\u0076\u0069\u0069', + '\u2177': '\u0076\u0069\u0069\u0069', + '\u2178': '\u0069\u0078', + '\u2179': '\u0078', + '\u217A': '\u0078\u0069', + '\u217B': '\u0078\u0069\u0069', + '\u217C': '\u006C', + '\u217D': '\u0063', + '\u217E': '\u0064', + '\u217F': '\u006D', + '\u222C': '\u222B\u222B', + '\u222D': '\u222B\u222B\u222B', + '\u222F': '\u222E\u222E', + '\u2230': '\u222E\u222E\u222E', + '\u2474': '\u0028\u0031\u0029', + '\u2475': '\u0028\u0032\u0029', + '\u2476': '\u0028\u0033\u0029', + '\u2477': '\u0028\u0034\u0029', + '\u2478': '\u0028\u0035\u0029', + '\u2479': '\u0028\u0036\u0029', + '\u247A': '\u0028\u0037\u0029', + '\u247B': '\u0028\u0038\u0029', + '\u247C': '\u0028\u0039\u0029', + '\u247D': '\u0028\u0031\u0030\u0029', + '\u247E': '\u0028\u0031\u0031\u0029', + '\u247F': '\u0028\u0031\u0032\u0029', + '\u2480': '\u0028\u0031\u0033\u0029', + '\u2481': '\u0028\u0031\u0034\u0029', + '\u2482': '\u0028\u0031\u0035\u0029', + '\u2483': '\u0028\u0031\u0036\u0029', + '\u2484': '\u0028\u0031\u0037\u0029', + '\u2485': '\u0028\u0031\u0038\u0029', + '\u2486': '\u0028\u0031\u0039\u0029', + '\u2487': '\u0028\u0032\u0030\u0029', + '\u2488': '\u0031\u002E', + '\u2489': '\u0032\u002E', + '\u248A': '\u0033\u002E', + '\u248B': '\u0034\u002E', + '\u248C': '\u0035\u002E', + '\u248D': '\u0036\u002E', + '\u248E': '\u0037\u002E', + '\u248F': '\u0038\u002E', + '\u2490': '\u0039\u002E', + '\u2491': '\u0031\u0030\u002E', + '\u2492': '\u0031\u0031\u002E', + '\u2493': '\u0031\u0032\u002E', + '\u2494': '\u0031\u0033\u002E', + '\u2495': '\u0031\u0034\u002E', + '\u2496': '\u0031\u0035\u002E', + '\u2497': '\u0031\u0036\u002E', + '\u2498': '\u0031\u0037\u002E', + '\u2499': '\u0031\u0038\u002E', + '\u249A': '\u0031\u0039\u002E', + '\u249B': '\u0032\u0030\u002E', + '\u249C': '\u0028\u0061\u0029', + '\u249D': '\u0028\u0062\u0029', + '\u249E': '\u0028\u0063\u0029', + '\u249F': '\u0028\u0064\u0029', + '\u24A0': '\u0028\u0065\u0029', + '\u24A1': '\u0028\u0066\u0029', + '\u24A2': '\u0028\u0067\u0029', + '\u24A3': '\u0028\u0068\u0029', + '\u24A4': '\u0028\u0069\u0029', + '\u24A5': '\u0028\u006A\u0029', + '\u24A6': '\u0028\u006B\u0029', + '\u24A7': '\u0028\u006C\u0029', + '\u24A8': '\u0028\u006D\u0029', + '\u24A9': '\u0028\u006E\u0029', + '\u24AA': '\u0028\u006F\u0029', + '\u24AB': '\u0028\u0070\u0029', + '\u24AC': '\u0028\u0071\u0029', + '\u24AD': '\u0028\u0072\u0029', + '\u24AE': '\u0028\u0073\u0029', + '\u24AF': '\u0028\u0074\u0029', + '\u24B0': '\u0028\u0075\u0029', + '\u24B1': '\u0028\u0076\u0029', + '\u24B2': '\u0028\u0077\u0029', + '\u24B3': '\u0028\u0078\u0029', + '\u24B4': '\u0028\u0079\u0029', + '\u24B5': '\u0028\u007A\u0029', + '\u2A0C': '\u222B\u222B\u222B\u222B', + '\u2A74': '\u003A\u003A\u003D', + '\u2A75': '\u003D\u003D', + '\u2A76': '\u003D\u003D\u003D', + '\u2E9F': '\u6BCD', + '\u2EF3': '\u9F9F', + '\u2F00': '\u4E00', + '\u2F01': '\u4E28', + '\u2F02': '\u4E36', + '\u2F03': '\u4E3F', + '\u2F04': '\u4E59', + '\u2F05': '\u4E85', + '\u2F06': '\u4E8C', + '\u2F07': '\u4EA0', + '\u2F08': '\u4EBA', + '\u2F09': '\u513F', + '\u2F0A': '\u5165', + '\u2F0B': '\u516B', + '\u2F0C': '\u5182', + '\u2F0D': '\u5196', + '\u2F0E': '\u51AB', + '\u2F0F': '\u51E0', + '\u2F10': '\u51F5', + '\u2F11': '\u5200', + '\u2F12': '\u529B', + '\u2F13': '\u52F9', + '\u2F14': '\u5315', + '\u2F15': '\u531A', + '\u2F16': '\u5338', + '\u2F17': '\u5341', + '\u2F18': '\u535C', + '\u2F19': '\u5369', + '\u2F1A': '\u5382', + '\u2F1B': '\u53B6', + '\u2F1C': '\u53C8', + '\u2F1D': '\u53E3', + '\u2F1E': '\u56D7', + '\u2F1F': '\u571F', + '\u2F20': '\u58EB', + '\u2F21': '\u5902', + '\u2F22': '\u590A', + '\u2F23': '\u5915', + '\u2F24': '\u5927', + '\u2F25': '\u5973', + '\u2F26': '\u5B50', + '\u2F27': '\u5B80', + '\u2F28': '\u5BF8', + '\u2F29': '\u5C0F', + '\u2F2A': '\u5C22', + '\u2F2B': '\u5C38', + '\u2F2C': '\u5C6E', + '\u2F2D': '\u5C71', + '\u2F2E': '\u5DDB', + '\u2F2F': '\u5DE5', + '\u2F30': '\u5DF1', + '\u2F31': '\u5DFE', + '\u2F32': '\u5E72', + '\u2F33': '\u5E7A', + '\u2F34': '\u5E7F', + '\u2F35': '\u5EF4', + '\u2F36': '\u5EFE', + '\u2F37': '\u5F0B', + '\u2F38': '\u5F13', + '\u2F39': '\u5F50', + '\u2F3A': '\u5F61', + '\u2F3B': '\u5F73', + '\u2F3C': '\u5FC3', + '\u2F3D': '\u6208', + '\u2F3E': '\u6236', + '\u2F3F': '\u624B', + '\u2F40': '\u652F', + '\u2F41': '\u6534', + '\u2F42': '\u6587', + '\u2F43': '\u6597', + '\u2F44': '\u65A4', + '\u2F45': '\u65B9', + '\u2F46': '\u65E0', + '\u2F47': '\u65E5', + '\u2F48': '\u66F0', + '\u2F49': '\u6708', + '\u2F4A': '\u6728', + '\u2F4B': '\u6B20', + '\u2F4C': '\u6B62', + '\u2F4D': '\u6B79', + '\u2F4E': '\u6BB3', + '\u2F4F': '\u6BCB', + '\u2F50': '\u6BD4', + '\u2F51': '\u6BDB', + '\u2F52': '\u6C0F', + '\u2F53': '\u6C14', + '\u2F54': '\u6C34', + '\u2F55': '\u706B', + '\u2F56': '\u722A', + '\u2F57': '\u7236', + '\u2F58': '\u723B', + '\u2F59': '\u723F', + '\u2F5A': '\u7247', + '\u2F5B': '\u7259', + '\u2F5C': '\u725B', + '\u2F5D': '\u72AC', + '\u2F5E': '\u7384', + '\u2F5F': '\u7389', + '\u2F60': '\u74DC', + '\u2F61': '\u74E6', + '\u2F62': '\u7518', + '\u2F63': '\u751F', + '\u2F64': '\u7528', + '\u2F65': '\u7530', + '\u2F66': '\u758B', + '\u2F67': '\u7592', + '\u2F68': '\u7676', + '\u2F69': '\u767D', + '\u2F6A': '\u76AE', + '\u2F6B': '\u76BF', + '\u2F6C': '\u76EE', + '\u2F6D': '\u77DB', + '\u2F6E': '\u77E2', + '\u2F6F': '\u77F3', + '\u2F70': '\u793A', + '\u2F71': '\u79B8', + '\u2F72': '\u79BE', + '\u2F73': '\u7A74', + '\u2F74': '\u7ACB', + '\u2F75': '\u7AF9', + '\u2F76': '\u7C73', + '\u2F77': '\u7CF8', + '\u2F78': '\u7F36', + '\u2F79': '\u7F51', + '\u2F7A': '\u7F8A', + '\u2F7B': '\u7FBD', + '\u2F7C': '\u8001', + '\u2F7D': '\u800C', + '\u2F7E': '\u8012', + '\u2F7F': '\u8033', + '\u2F80': '\u807F', + '\u2F81': '\u8089', + '\u2F82': '\u81E3', + '\u2F83': '\u81EA', + '\u2F84': '\u81F3', + '\u2F85': '\u81FC', + '\u2F86': '\u820C', + '\u2F87': '\u821B', + '\u2F88': '\u821F', + '\u2F89': '\u826E', + '\u2F8A': '\u8272', + '\u2F8B': '\u8278', + '\u2F8C': '\u864D', + '\u2F8D': '\u866B', + '\u2F8E': '\u8840', + '\u2F8F': '\u884C', + '\u2F90': '\u8863', + '\u2F91': '\u897E', + '\u2F92': '\u898B', + '\u2F93': '\u89D2', + '\u2F94': '\u8A00', + '\u2F95': '\u8C37', + '\u2F96': '\u8C46', + '\u2F97': '\u8C55', + '\u2F98': '\u8C78', + '\u2F99': '\u8C9D', + '\u2F9A': '\u8D64', + '\u2F9B': '\u8D70', + '\u2F9C': '\u8DB3', + '\u2F9D': '\u8EAB', + '\u2F9E': '\u8ECA', + '\u2F9F': '\u8F9B', + '\u2FA0': '\u8FB0', + '\u2FA1': '\u8FB5', + '\u2FA2': '\u9091', + '\u2FA3': '\u9149', + '\u2FA4': '\u91C6', + '\u2FA5': '\u91CC', + '\u2FA6': '\u91D1', + '\u2FA7': '\u9577', + '\u2FA8': '\u9580', + '\u2FA9': '\u961C', + '\u2FAA': '\u96B6', + '\u2FAB': '\u96B9', + '\u2FAC': '\u96E8', + '\u2FAD': '\u9751', + '\u2FAE': '\u975E', + '\u2FAF': '\u9762', + '\u2FB0': '\u9769', + '\u2FB1': '\u97CB', + '\u2FB2': '\u97ED', + '\u2FB3': '\u97F3', + '\u2FB4': '\u9801', + '\u2FB5': '\u98A8', + '\u2FB6': '\u98DB', + '\u2FB7': '\u98DF', + '\u2FB8': '\u9996', + '\u2FB9': '\u9999', + '\u2FBA': '\u99AC', + '\u2FBB': '\u9AA8', + '\u2FBC': '\u9AD8', + '\u2FBD': '\u9ADF', + '\u2FBE': '\u9B25', + '\u2FBF': '\u9B2F', + '\u2FC0': '\u9B32', + '\u2FC1': '\u9B3C', + '\u2FC2': '\u9B5A', + '\u2FC3': '\u9CE5', + '\u2FC4': '\u9E75', + '\u2FC5': '\u9E7F', + '\u2FC6': '\u9EA5', + '\u2FC7': '\u9EBB', + '\u2FC8': '\u9EC3', + '\u2FC9': '\u9ECD', + '\u2FCA': '\u9ED1', + '\u2FCB': '\u9EF9', + '\u2FCC': '\u9EFD', + '\u2FCD': '\u9F0E', + '\u2FCE': '\u9F13', + '\u2FCF': '\u9F20', + '\u2FD0': '\u9F3B', + '\u2FD1': '\u9F4A', + '\u2FD2': '\u9F52', + '\u2FD3': '\u9F8D', + '\u2FD4': '\u9F9C', + '\u2FD5': '\u9FA0', + '\u3036': '\u3012', + '\u3038': '\u5341', + '\u3039': '\u5344', + '\u303A': '\u5345', + '\u309B': '\u0020\u3099', + '\u309C': '\u0020\u309A', + '\u3131': '\u1100', + '\u3132': '\u1101', + '\u3133': '\u11AA', + '\u3134': '\u1102', + '\u3135': '\u11AC', + '\u3136': '\u11AD', + '\u3137': '\u1103', + '\u3138': '\u1104', + '\u3139': '\u1105', + '\u313A': '\u11B0', + '\u313B': '\u11B1', + '\u313C': '\u11B2', + '\u313D': '\u11B3', + '\u313E': '\u11B4', + '\u313F': '\u11B5', + '\u3140': '\u111A', + '\u3141': '\u1106', + '\u3142': '\u1107', + '\u3143': '\u1108', + '\u3144': '\u1121', + '\u3145': '\u1109', + '\u3146': '\u110A', + '\u3147': '\u110B', + '\u3148': '\u110C', + '\u3149': '\u110D', + '\u314A': '\u110E', + '\u314B': '\u110F', + '\u314C': '\u1110', + '\u314D': '\u1111', + '\u314E': '\u1112', + '\u314F': '\u1161', + '\u3150': '\u1162', + '\u3151': '\u1163', + '\u3152': '\u1164', + '\u3153': '\u1165', + '\u3154': '\u1166', + '\u3155': '\u1167', + '\u3156': '\u1168', + '\u3157': '\u1169', + '\u3158': '\u116A', + '\u3159': '\u116B', + '\u315A': '\u116C', + '\u315B': '\u116D', + '\u315C': '\u116E', + '\u315D': '\u116F', + '\u315E': '\u1170', + '\u315F': '\u1171', + '\u3160': '\u1172', + '\u3161': '\u1173', + '\u3162': '\u1174', + '\u3163': '\u1175', + '\u3164': '\u1160', + '\u3165': '\u1114', + '\u3166': '\u1115', + '\u3167': '\u11C7', + '\u3168': '\u11C8', + '\u3169': '\u11CC', + '\u316A': '\u11CE', + '\u316B': '\u11D3', + '\u316C': '\u11D7', + '\u316D': '\u11D9', + '\u316E': '\u111C', + '\u316F': '\u11DD', + '\u3170': '\u11DF', + '\u3171': '\u111D', + '\u3172': '\u111E', + '\u3173': '\u1120', + '\u3174': '\u1122', + '\u3175': '\u1123', + '\u3176': '\u1127', + '\u3177': '\u1129', + '\u3178': '\u112B', + '\u3179': '\u112C', + '\u317A': '\u112D', + '\u317B': '\u112E', + '\u317C': '\u112F', + '\u317D': '\u1132', + '\u317E': '\u1136', + '\u317F': '\u1140', + '\u3180': '\u1147', + '\u3181': '\u114C', + '\u3182': '\u11F1', + '\u3183': '\u11F2', + '\u3184': '\u1157', + '\u3185': '\u1158', + '\u3186': '\u1159', + '\u3187': '\u1184', + '\u3188': '\u1185', + '\u3189': '\u1188', + '\u318A': '\u1191', + '\u318B': '\u1192', + '\u318C': '\u1194', + '\u318D': '\u119E', + '\u318E': '\u11A1', + '\u3200': '\u0028\u1100\u0029', + '\u3201': '\u0028\u1102\u0029', + '\u3202': '\u0028\u1103\u0029', + '\u3203': '\u0028\u1105\u0029', + '\u3204': '\u0028\u1106\u0029', + '\u3205': '\u0028\u1107\u0029', + '\u3206': '\u0028\u1109\u0029', + '\u3207': '\u0028\u110B\u0029', + '\u3208': '\u0028\u110C\u0029', + '\u3209': '\u0028\u110E\u0029', + '\u320A': '\u0028\u110F\u0029', + '\u320B': '\u0028\u1110\u0029', + '\u320C': '\u0028\u1111\u0029', + '\u320D': '\u0028\u1112\u0029', + '\u320E': '\u0028\u1100\u1161\u0029', + '\u320F': '\u0028\u1102\u1161\u0029', + '\u3210': '\u0028\u1103\u1161\u0029', + '\u3211': '\u0028\u1105\u1161\u0029', + '\u3212': '\u0028\u1106\u1161\u0029', + '\u3213': '\u0028\u1107\u1161\u0029', + '\u3214': '\u0028\u1109\u1161\u0029', + '\u3215': '\u0028\u110B\u1161\u0029', + '\u3216': '\u0028\u110C\u1161\u0029', + '\u3217': '\u0028\u110E\u1161\u0029', + '\u3218': '\u0028\u110F\u1161\u0029', + '\u3219': '\u0028\u1110\u1161\u0029', + '\u321A': '\u0028\u1111\u1161\u0029', + '\u321B': '\u0028\u1112\u1161\u0029', + '\u321C': '\u0028\u110C\u116E\u0029', + '\u321D': '\u0028\u110B\u1169\u110C\u1165\u11AB\u0029', + '\u321E': '\u0028\u110B\u1169\u1112\u116E\u0029', + '\u3220': '\u0028\u4E00\u0029', + '\u3221': '\u0028\u4E8C\u0029', + '\u3222': '\u0028\u4E09\u0029', + '\u3223': '\u0028\u56DB\u0029', + '\u3224': '\u0028\u4E94\u0029', + '\u3225': '\u0028\u516D\u0029', + '\u3226': '\u0028\u4E03\u0029', + '\u3227': '\u0028\u516B\u0029', + '\u3228': '\u0028\u4E5D\u0029', + '\u3229': '\u0028\u5341\u0029', + '\u322A': '\u0028\u6708\u0029', + '\u322B': '\u0028\u706B\u0029', + '\u322C': '\u0028\u6C34\u0029', + '\u322D': '\u0028\u6728\u0029', + '\u322E': '\u0028\u91D1\u0029', + '\u322F': '\u0028\u571F\u0029', + '\u3230': '\u0028\u65E5\u0029', + '\u3231': '\u0028\u682A\u0029', + '\u3232': '\u0028\u6709\u0029', + '\u3233': '\u0028\u793E\u0029', + '\u3234': '\u0028\u540D\u0029', + '\u3235': '\u0028\u7279\u0029', + '\u3236': '\u0028\u8CA1\u0029', + '\u3237': '\u0028\u795D\u0029', + '\u3238': '\u0028\u52B4\u0029', + '\u3239': '\u0028\u4EE3\u0029', + '\u323A': '\u0028\u547C\u0029', + '\u323B': '\u0028\u5B66\u0029', + '\u323C': '\u0028\u76E3\u0029', + '\u323D': '\u0028\u4F01\u0029', + '\u323E': '\u0028\u8CC7\u0029', + '\u323F': '\u0028\u5354\u0029', + '\u3240': '\u0028\u796D\u0029', + '\u3241': '\u0028\u4F11\u0029', + '\u3242': '\u0028\u81EA\u0029', + '\u3243': '\u0028\u81F3\u0029', + '\u32C0': '\u0031\u6708', + '\u32C1': '\u0032\u6708', + '\u32C2': '\u0033\u6708', + '\u32C3': '\u0034\u6708', + '\u32C4': '\u0035\u6708', + '\u32C5': '\u0036\u6708', + '\u32C6': '\u0037\u6708', + '\u32C7': '\u0038\u6708', + '\u32C8': '\u0039\u6708', + '\u32C9': '\u0031\u0030\u6708', + '\u32CA': '\u0031\u0031\u6708', + '\u32CB': '\u0031\u0032\u6708', + '\u3358': '\u0030\u70B9', + '\u3359': '\u0031\u70B9', + '\u335A': '\u0032\u70B9', + '\u335B': '\u0033\u70B9', + '\u335C': '\u0034\u70B9', + '\u335D': '\u0035\u70B9', + '\u335E': '\u0036\u70B9', + '\u335F': '\u0037\u70B9', + '\u3360': '\u0038\u70B9', + '\u3361': '\u0039\u70B9', + '\u3362': '\u0031\u0030\u70B9', + '\u3363': '\u0031\u0031\u70B9', + '\u3364': '\u0031\u0032\u70B9', + '\u3365': '\u0031\u0033\u70B9', + '\u3366': '\u0031\u0034\u70B9', + '\u3367': '\u0031\u0035\u70B9', + '\u3368': '\u0031\u0036\u70B9', + '\u3369': '\u0031\u0037\u70B9', + '\u336A': '\u0031\u0038\u70B9', + '\u336B': '\u0031\u0039\u70B9', + '\u336C': '\u0032\u0030\u70B9', + '\u336D': '\u0032\u0031\u70B9', + '\u336E': '\u0032\u0032\u70B9', + '\u336F': '\u0032\u0033\u70B9', + '\u3370': '\u0032\u0034\u70B9', + '\u33E0': '\u0031\u65E5', + '\u33E1': '\u0032\u65E5', + '\u33E2': '\u0033\u65E5', + '\u33E3': '\u0034\u65E5', + '\u33E4': '\u0035\u65E5', + '\u33E5': '\u0036\u65E5', + '\u33E6': '\u0037\u65E5', + '\u33E7': '\u0038\u65E5', + '\u33E8': '\u0039\u65E5', + '\u33E9': '\u0031\u0030\u65E5', + '\u33EA': '\u0031\u0031\u65E5', + '\u33EB': '\u0031\u0032\u65E5', + '\u33EC': '\u0031\u0033\u65E5', + '\u33ED': '\u0031\u0034\u65E5', + '\u33EE': '\u0031\u0035\u65E5', + '\u33EF': '\u0031\u0036\u65E5', + '\u33F0': '\u0031\u0037\u65E5', + '\u33F1': '\u0031\u0038\u65E5', + '\u33F2': '\u0031\u0039\u65E5', + '\u33F3': '\u0032\u0030\u65E5', + '\u33F4': '\u0032\u0031\u65E5', + '\u33F5': '\u0032\u0032\u65E5', + '\u33F6': '\u0032\u0033\u65E5', + '\u33F7': '\u0032\u0034\u65E5', + '\u33F8': '\u0032\u0035\u65E5', + '\u33F9': '\u0032\u0036\u65E5', + '\u33FA': '\u0032\u0037\u65E5', + '\u33FB': '\u0032\u0038\u65E5', + '\u33FC': '\u0032\u0039\u65E5', + '\u33FD': '\u0033\u0030\u65E5', + '\u33FE': '\u0033\u0031\u65E5', + '\uFB00': '\u0066\u0066', + '\uFB01': '\u0066\u0069', + '\uFB02': '\u0066\u006C', + '\uFB03': '\u0066\u0066\u0069', + '\uFB04': '\u0066\u0066\u006C', + '\uFB05': '\u017F\u0074', + '\uFB06': '\u0073\u0074', + '\uFB13': '\u0574\u0576', + '\uFB14': '\u0574\u0565', + '\uFB15': '\u0574\u056B', + '\uFB16': '\u057E\u0576', + '\uFB17': '\u0574\u056D', + '\uFB4F': '\u05D0\u05DC', + '\uFB50': '\u0671', + '\uFB51': '\u0671', + '\uFB52': '\u067B', + '\uFB53': '\u067B', + '\uFB54': '\u067B', + '\uFB55': '\u067B', + '\uFB56': '\u067E', + '\uFB57': '\u067E', + '\uFB58': '\u067E', + '\uFB59': '\u067E', + '\uFB5A': '\u0680', + '\uFB5B': '\u0680', + '\uFB5C': '\u0680', + '\uFB5D': '\u0680', + '\uFB5E': '\u067A', + '\uFB5F': '\u067A', + '\uFB60': '\u067A', + '\uFB61': '\u067A', + '\uFB62': '\u067F', + '\uFB63': '\u067F', + '\uFB64': '\u067F', + '\uFB65': '\u067F', + '\uFB66': '\u0679', + '\uFB67': '\u0679', + '\uFB68': '\u0679', + '\uFB69': '\u0679', + '\uFB6A': '\u06A4', + '\uFB6B': '\u06A4', + '\uFB6C': '\u06A4', + '\uFB6D': '\u06A4', + '\uFB6E': '\u06A6', + '\uFB6F': '\u06A6', + '\uFB70': '\u06A6', + '\uFB71': '\u06A6', + '\uFB72': '\u0684', + '\uFB73': '\u0684', + '\uFB74': '\u0684', + '\uFB75': '\u0684', + '\uFB76': '\u0683', + '\uFB77': '\u0683', + '\uFB78': '\u0683', + '\uFB79': '\u0683', + '\uFB7A': '\u0686', + '\uFB7B': '\u0686', + '\uFB7C': '\u0686', + '\uFB7D': '\u0686', + '\uFB7E': '\u0687', + '\uFB7F': '\u0687', + '\uFB80': '\u0687', + '\uFB81': '\u0687', + '\uFB82': '\u068D', + '\uFB83': '\u068D', + '\uFB84': '\u068C', + '\uFB85': '\u068C', + '\uFB86': '\u068E', + '\uFB87': '\u068E', + '\uFB88': '\u0688', + '\uFB89': '\u0688', + '\uFB8A': '\u0698', + '\uFB8B': '\u0698', + '\uFB8C': '\u0691', + '\uFB8D': '\u0691', + '\uFB8E': '\u06A9', + '\uFB8F': '\u06A9', + '\uFB90': '\u06A9', + '\uFB91': '\u06A9', + '\uFB92': '\u06AF', + '\uFB93': '\u06AF', + '\uFB94': '\u06AF', + '\uFB95': '\u06AF', + '\uFB96': '\u06B3', + '\uFB97': '\u06B3', + '\uFB98': '\u06B3', + '\uFB99': '\u06B3', + '\uFB9A': '\u06B1', + '\uFB9B': '\u06B1', + '\uFB9C': '\u06B1', + '\uFB9D': '\u06B1', + '\uFB9E': '\u06BA', + '\uFB9F': '\u06BA', + '\uFBA0': '\u06BB', + '\uFBA1': '\u06BB', + '\uFBA2': '\u06BB', + '\uFBA3': '\u06BB', + '\uFBA4': '\u06C0', + '\uFBA5': '\u06C0', + '\uFBA6': '\u06C1', + '\uFBA7': '\u06C1', + '\uFBA8': '\u06C1', + '\uFBA9': '\u06C1', + '\uFBAA': '\u06BE', + '\uFBAB': '\u06BE', + '\uFBAC': '\u06BE', + '\uFBAD': '\u06BE', + '\uFBAE': '\u06D2', + '\uFBAF': '\u06D2', + '\uFBB0': '\u06D3', + '\uFBB1': '\u06D3', + '\uFBD3': '\u06AD', + '\uFBD4': '\u06AD', + '\uFBD5': '\u06AD', + '\uFBD6': '\u06AD', + '\uFBD7': '\u06C7', + '\uFBD8': '\u06C7', + '\uFBD9': '\u06C6', + '\uFBDA': '\u06C6', + '\uFBDB': '\u06C8', + '\uFBDC': '\u06C8', + '\uFBDD': '\u0677', + '\uFBDE': '\u06CB', + '\uFBDF': '\u06CB', + '\uFBE0': '\u06C5', + '\uFBE1': '\u06C5', + '\uFBE2': '\u06C9', + '\uFBE3': '\u06C9', + '\uFBE4': '\u06D0', + '\uFBE5': '\u06D0', + '\uFBE6': '\u06D0', + '\uFBE7': '\u06D0', + '\uFBE8': '\u0649', + '\uFBE9': '\u0649', + '\uFBEA': '\u0626\u0627', + '\uFBEB': '\u0626\u0627', + '\uFBEC': '\u0626\u06D5', + '\uFBED': '\u0626\u06D5', + '\uFBEE': '\u0626\u0648', + '\uFBEF': '\u0626\u0648', + '\uFBF0': '\u0626\u06C7', + '\uFBF1': '\u0626\u06C7', + '\uFBF2': '\u0626\u06C6', + '\uFBF3': '\u0626\u06C6', + '\uFBF4': '\u0626\u06C8', + '\uFBF5': '\u0626\u06C8', + '\uFBF6': '\u0626\u06D0', + '\uFBF7': '\u0626\u06D0', + '\uFBF8': '\u0626\u06D0', + '\uFBF9': '\u0626\u0649', + '\uFBFA': '\u0626\u0649', + '\uFBFB': '\u0626\u0649', + '\uFBFC': '\u06CC', + '\uFBFD': '\u06CC', + '\uFBFE': '\u06CC', + '\uFBFF': '\u06CC', + '\uFC00': '\u0626\u062C', + '\uFC01': '\u0626\u062D', + '\uFC02': '\u0626\u0645', + '\uFC03': '\u0626\u0649', + '\uFC04': '\u0626\u064A', + '\uFC05': '\u0628\u062C', + '\uFC06': '\u0628\u062D', + '\uFC07': '\u0628\u062E', + '\uFC08': '\u0628\u0645', + '\uFC09': '\u0628\u0649', + '\uFC0A': '\u0628\u064A', + '\uFC0B': '\u062A\u062C', + '\uFC0C': '\u062A\u062D', + '\uFC0D': '\u062A\u062E', + '\uFC0E': '\u062A\u0645', + '\uFC0F': '\u062A\u0649', + '\uFC10': '\u062A\u064A', + '\uFC11': '\u062B\u062C', + '\uFC12': '\u062B\u0645', + '\uFC13': '\u062B\u0649', + '\uFC14': '\u062B\u064A', + '\uFC15': '\u062C\u062D', + '\uFC16': '\u062C\u0645', + '\uFC17': '\u062D\u062C', + '\uFC18': '\u062D\u0645', + '\uFC19': '\u062E\u062C', + '\uFC1A': '\u062E\u062D', + '\uFC1B': '\u062E\u0645', + '\uFC1C': '\u0633\u062C', + '\uFC1D': '\u0633\u062D', + '\uFC1E': '\u0633\u062E', + '\uFC1F': '\u0633\u0645', + '\uFC20': '\u0635\u062D', + '\uFC21': '\u0635\u0645', + '\uFC22': '\u0636\u062C', + '\uFC23': '\u0636\u062D', + '\uFC24': '\u0636\u062E', + '\uFC25': '\u0636\u0645', + '\uFC26': '\u0637\u062D', + '\uFC27': '\u0637\u0645', + '\uFC28': '\u0638\u0645', + '\uFC29': '\u0639\u062C', + '\uFC2A': '\u0639\u0645', + '\uFC2B': '\u063A\u062C', + '\uFC2C': '\u063A\u0645', + '\uFC2D': '\u0641\u062C', + '\uFC2E': '\u0641\u062D', + '\uFC2F': '\u0641\u062E', + '\uFC30': '\u0641\u0645', + '\uFC31': '\u0641\u0649', + '\uFC32': '\u0641\u064A', + '\uFC33': '\u0642\u062D', + '\uFC34': '\u0642\u0645', + '\uFC35': '\u0642\u0649', + '\uFC36': '\u0642\u064A', + '\uFC37': '\u0643\u0627', + '\uFC38': '\u0643\u062C', + '\uFC39': '\u0643\u062D', + '\uFC3A': '\u0643\u062E', + '\uFC3B': '\u0643\u0644', + '\uFC3C': '\u0643\u0645', + '\uFC3D': '\u0643\u0649', + '\uFC3E': '\u0643\u064A', + '\uFC3F': '\u0644\u062C', + '\uFC40': '\u0644\u062D', + '\uFC41': '\u0644\u062E', + '\uFC42': '\u0644\u0645', + '\uFC43': '\u0644\u0649', + '\uFC44': '\u0644\u064A', + '\uFC45': '\u0645\u062C', + '\uFC46': '\u0645\u062D', + '\uFC47': '\u0645\u062E', + '\uFC48': '\u0645\u0645', + '\uFC49': '\u0645\u0649', + '\uFC4A': '\u0645\u064A', + '\uFC4B': '\u0646\u062C', + '\uFC4C': '\u0646\u062D', + '\uFC4D': '\u0646\u062E', + '\uFC4E': '\u0646\u0645', + '\uFC4F': '\u0646\u0649', + '\uFC50': '\u0646\u064A', + '\uFC51': '\u0647\u062C', + '\uFC52': '\u0647\u0645', + '\uFC53': '\u0647\u0649', + '\uFC54': '\u0647\u064A', + '\uFC55': '\u064A\u062C', + '\uFC56': '\u064A\u062D', + '\uFC57': '\u064A\u062E', + '\uFC58': '\u064A\u0645', + '\uFC59': '\u064A\u0649', + '\uFC5A': '\u064A\u064A', + '\uFC5B': '\u0630\u0670', + '\uFC5C': '\u0631\u0670', + '\uFC5D': '\u0649\u0670', + '\uFC5E': '\u0020\u064C\u0651', + '\uFC5F': '\u0020\u064D\u0651', + '\uFC60': '\u0020\u064E\u0651', + '\uFC61': '\u0020\u064F\u0651', + '\uFC62': '\u0020\u0650\u0651', + '\uFC63': '\u0020\u0651\u0670', + '\uFC64': '\u0626\u0631', + '\uFC65': '\u0626\u0632', + '\uFC66': '\u0626\u0645', + '\uFC67': '\u0626\u0646', + '\uFC68': '\u0626\u0649', + '\uFC69': '\u0626\u064A', + '\uFC6A': '\u0628\u0631', + '\uFC6B': '\u0628\u0632', + '\uFC6C': '\u0628\u0645', + '\uFC6D': '\u0628\u0646', + '\uFC6E': '\u0628\u0649', + '\uFC6F': '\u0628\u064A', + '\uFC70': '\u062A\u0631', + '\uFC71': '\u062A\u0632', + '\uFC72': '\u062A\u0645', + '\uFC73': '\u062A\u0646', + '\uFC74': '\u062A\u0649', + '\uFC75': '\u062A\u064A', + '\uFC76': '\u062B\u0631', + '\uFC77': '\u062B\u0632', + '\uFC78': '\u062B\u0645', + '\uFC79': '\u062B\u0646', + '\uFC7A': '\u062B\u0649', + '\uFC7B': '\u062B\u064A', + '\uFC7C': '\u0641\u0649', + '\uFC7D': '\u0641\u064A', + '\uFC7E': '\u0642\u0649', + '\uFC7F': '\u0642\u064A', + '\uFC80': '\u0643\u0627', + '\uFC81': '\u0643\u0644', + '\uFC82': '\u0643\u0645', + '\uFC83': '\u0643\u0649', + '\uFC84': '\u0643\u064A', + '\uFC85': '\u0644\u0645', + '\uFC86': '\u0644\u0649', + '\uFC87': '\u0644\u064A', + '\uFC88': '\u0645\u0627', + '\uFC89': '\u0645\u0645', + '\uFC8A': '\u0646\u0631', + '\uFC8B': '\u0646\u0632', + '\uFC8C': '\u0646\u0645', + '\uFC8D': '\u0646\u0646', + '\uFC8E': '\u0646\u0649', + '\uFC8F': '\u0646\u064A', + '\uFC90': '\u0649\u0670', + '\uFC91': '\u064A\u0631', + '\uFC92': '\u064A\u0632', + '\uFC93': '\u064A\u0645', + '\uFC94': '\u064A\u0646', + '\uFC95': '\u064A\u0649', + '\uFC96': '\u064A\u064A', + '\uFC97': '\u0626\u062C', + '\uFC98': '\u0626\u062D', + '\uFC99': '\u0626\u062E', + '\uFC9A': '\u0626\u0645', + '\uFC9B': '\u0626\u0647', + '\uFC9C': '\u0628\u062C', + '\uFC9D': '\u0628\u062D', + '\uFC9E': '\u0628\u062E', + '\uFC9F': '\u0628\u0645', + '\uFCA0': '\u0628\u0647', + '\uFCA1': '\u062A\u062C', + '\uFCA2': '\u062A\u062D', + '\uFCA3': '\u062A\u062E', + '\uFCA4': '\u062A\u0645', + '\uFCA5': '\u062A\u0647', + '\uFCA6': '\u062B\u0645', + '\uFCA7': '\u062C\u062D', + '\uFCA8': '\u062C\u0645', + '\uFCA9': '\u062D\u062C', + '\uFCAA': '\u062D\u0645', + '\uFCAB': '\u062E\u062C', + '\uFCAC': '\u062E\u0645', + '\uFCAD': '\u0633\u062C', + '\uFCAE': '\u0633\u062D', + '\uFCAF': '\u0633\u062E', + '\uFCB0': '\u0633\u0645', + '\uFCB1': '\u0635\u062D', + '\uFCB2': '\u0635\u062E', + '\uFCB3': '\u0635\u0645', + '\uFCB4': '\u0636\u062C', + '\uFCB5': '\u0636\u062D', + '\uFCB6': '\u0636\u062E', + '\uFCB7': '\u0636\u0645', + '\uFCB8': '\u0637\u062D', + '\uFCB9': '\u0638\u0645', + '\uFCBA': '\u0639\u062C', + '\uFCBB': '\u0639\u0645', + '\uFCBC': '\u063A\u062C', + '\uFCBD': '\u063A\u0645', + '\uFCBE': '\u0641\u062C', + '\uFCBF': '\u0641\u062D', + '\uFCC0': '\u0641\u062E', + '\uFCC1': '\u0641\u0645', + '\uFCC2': '\u0642\u062D', + '\uFCC3': '\u0642\u0645', + '\uFCC4': '\u0643\u062C', + '\uFCC5': '\u0643\u062D', + '\uFCC6': '\u0643\u062E', + '\uFCC7': '\u0643\u0644', + '\uFCC8': '\u0643\u0645', + '\uFCC9': '\u0644\u062C', + '\uFCCA': '\u0644\u062D', + '\uFCCB': '\u0644\u062E', + '\uFCCC': '\u0644\u0645', + '\uFCCD': '\u0644\u0647', + '\uFCCE': '\u0645\u062C', + '\uFCCF': '\u0645\u062D', + '\uFCD0': '\u0645\u062E', + '\uFCD1': '\u0645\u0645', + '\uFCD2': '\u0646\u062C', + '\uFCD3': '\u0646\u062D', + '\uFCD4': '\u0646\u062E', + '\uFCD5': '\u0646\u0645', + '\uFCD6': '\u0646\u0647', + '\uFCD7': '\u0647\u062C', + '\uFCD8': '\u0647\u0645', + '\uFCD9': '\u0647\u0670', + '\uFCDA': '\u064A\u062C', + '\uFCDB': '\u064A\u062D', + '\uFCDC': '\u064A\u062E', + '\uFCDD': '\u064A\u0645', + '\uFCDE': '\u064A\u0647', + '\uFCDF': '\u0626\u0645', + '\uFCE0': '\u0626\u0647', + '\uFCE1': '\u0628\u0645', + '\uFCE2': '\u0628\u0647', + '\uFCE3': '\u062A\u0645', + '\uFCE4': '\u062A\u0647', + '\uFCE5': '\u062B\u0645', + '\uFCE6': '\u062B\u0647', + '\uFCE7': '\u0633\u0645', + '\uFCE8': '\u0633\u0647', + '\uFCE9': '\u0634\u0645', + '\uFCEA': '\u0634\u0647', + '\uFCEB': '\u0643\u0644', + '\uFCEC': '\u0643\u0645', + '\uFCED': '\u0644\u0645', + '\uFCEE': '\u0646\u0645', + '\uFCEF': '\u0646\u0647', + '\uFCF0': '\u064A\u0645', + '\uFCF1': '\u064A\u0647', + '\uFCF2': '\u0640\u064E\u0651', + '\uFCF3': '\u0640\u064F\u0651', + '\uFCF4': '\u0640\u0650\u0651', + '\uFCF5': '\u0637\u0649', + '\uFCF6': '\u0637\u064A', + '\uFCF7': '\u0639\u0649', + '\uFCF8': '\u0639\u064A', + '\uFCF9': '\u063A\u0649', + '\uFCFA': '\u063A\u064A', + '\uFCFB': '\u0633\u0649', + '\uFCFC': '\u0633\u064A', + '\uFCFD': '\u0634\u0649', + '\uFCFE': '\u0634\u064A', + '\uFCFF': '\u062D\u0649', + '\uFD00': '\u062D\u064A', + '\uFD01': '\u062C\u0649', + '\uFD02': '\u062C\u064A', + '\uFD03': '\u062E\u0649', + '\uFD04': '\u062E\u064A', + '\uFD05': '\u0635\u0649', + '\uFD06': '\u0635\u064A', + '\uFD07': '\u0636\u0649', + '\uFD08': '\u0636\u064A', + '\uFD09': '\u0634\u062C', + '\uFD0A': '\u0634\u062D', + '\uFD0B': '\u0634\u062E', + '\uFD0C': '\u0634\u0645', + '\uFD0D': '\u0634\u0631', + '\uFD0E': '\u0633\u0631', + '\uFD0F': '\u0635\u0631', + '\uFD10': '\u0636\u0631', + '\uFD11': '\u0637\u0649', + '\uFD12': '\u0637\u064A', + '\uFD13': '\u0639\u0649', + '\uFD14': '\u0639\u064A', + '\uFD15': '\u063A\u0649', + '\uFD16': '\u063A\u064A', + '\uFD17': '\u0633\u0649', + '\uFD18': '\u0633\u064A', + '\uFD19': '\u0634\u0649', + '\uFD1A': '\u0634\u064A', + '\uFD1B': '\u062D\u0649', + '\uFD1C': '\u062D\u064A', + '\uFD1D': '\u062C\u0649', + '\uFD1E': '\u062C\u064A', + '\uFD1F': '\u062E\u0649', + '\uFD20': '\u062E\u064A', + '\uFD21': '\u0635\u0649', + '\uFD22': '\u0635\u064A', + '\uFD23': '\u0636\u0649', + '\uFD24': '\u0636\u064A', + '\uFD25': '\u0634\u062C', + '\uFD26': '\u0634\u062D', + '\uFD27': '\u0634\u062E', + '\uFD28': '\u0634\u0645', + '\uFD29': '\u0634\u0631', + '\uFD2A': '\u0633\u0631', + '\uFD2B': '\u0635\u0631', + '\uFD2C': '\u0636\u0631', + '\uFD2D': '\u0634\u062C', + '\uFD2E': '\u0634\u062D', + '\uFD2F': '\u0634\u062E', + '\uFD30': '\u0634\u0645', + '\uFD31': '\u0633\u0647', + '\uFD32': '\u0634\u0647', + '\uFD33': '\u0637\u0645', + '\uFD34': '\u0633\u062C', + '\uFD35': '\u0633\u062D', + '\uFD36': '\u0633\u062E', + '\uFD37': '\u0634\u062C', + '\uFD38': '\u0634\u062D', + '\uFD39': '\u0634\u062E', + '\uFD3A': '\u0637\u0645', + '\uFD3B': '\u0638\u0645', + '\uFD3C': '\u0627\u064B', + '\uFD3D': '\u0627\u064B', + '\uFD50': '\u062A\u062C\u0645', + '\uFD51': '\u062A\u062D\u062C', + '\uFD52': '\u062A\u062D\u062C', + '\uFD53': '\u062A\u062D\u0645', + '\uFD54': '\u062A\u062E\u0645', + '\uFD55': '\u062A\u0645\u062C', + '\uFD56': '\u062A\u0645\u062D', + '\uFD57': '\u062A\u0645\u062E', + '\uFD58': '\u062C\u0645\u062D', + '\uFD59': '\u062C\u0645\u062D', + '\uFD5A': '\u062D\u0645\u064A', + '\uFD5B': '\u062D\u0645\u0649', + '\uFD5C': '\u0633\u062D\u062C', + '\uFD5D': '\u0633\u062C\u062D', + '\uFD5E': '\u0633\u062C\u0649', + '\uFD5F': '\u0633\u0645\u062D', + '\uFD60': '\u0633\u0645\u062D', + '\uFD61': '\u0633\u0645\u062C', + '\uFD62': '\u0633\u0645\u0645', + '\uFD63': '\u0633\u0645\u0645', + '\uFD64': '\u0635\u062D\u062D', + '\uFD65': '\u0635\u062D\u062D', + '\uFD66': '\u0635\u0645\u0645', + '\uFD67': '\u0634\u062D\u0645', + '\uFD68': '\u0634\u062D\u0645', + '\uFD69': '\u0634\u062C\u064A', + '\uFD6A': '\u0634\u0645\u062E', + '\uFD6B': '\u0634\u0645\u062E', + '\uFD6C': '\u0634\u0645\u0645', + '\uFD6D': '\u0634\u0645\u0645', + '\uFD6E': '\u0636\u062D\u0649', + '\uFD6F': '\u0636\u062E\u0645', + '\uFD70': '\u0636\u062E\u0645', + '\uFD71': '\u0637\u0645\u062D', + '\uFD72': '\u0637\u0645\u062D', + '\uFD73': '\u0637\u0645\u0645', + '\uFD74': '\u0637\u0645\u064A', + '\uFD75': '\u0639\u062C\u0645', + '\uFD76': '\u0639\u0645\u0645', + '\uFD77': '\u0639\u0645\u0645', + '\uFD78': '\u0639\u0645\u0649', + '\uFD79': '\u063A\u0645\u0645', + '\uFD7A': '\u063A\u0645\u064A', + '\uFD7B': '\u063A\u0645\u0649', + '\uFD7C': '\u0641\u062E\u0645', + '\uFD7D': '\u0641\u062E\u0645', + '\uFD7E': '\u0642\u0645\u062D', + '\uFD7F': '\u0642\u0645\u0645', + '\uFD80': '\u0644\u062D\u0645', + '\uFD81': '\u0644\u062D\u064A', + '\uFD82': '\u0644\u062D\u0649', + '\uFD83': '\u0644\u062C\u062C', + '\uFD84': '\u0644\u062C\u062C', + '\uFD85': '\u0644\u062E\u0645', + '\uFD86': '\u0644\u062E\u0645', + '\uFD87': '\u0644\u0645\u062D', + '\uFD88': '\u0644\u0645\u062D', + '\uFD89': '\u0645\u062D\u062C', + '\uFD8A': '\u0645\u062D\u0645', + '\uFD8B': '\u0645\u062D\u064A', + '\uFD8C': '\u0645\u062C\u062D', + '\uFD8D': '\u0645\u062C\u0645', + '\uFD8E': '\u0645\u062E\u062C', + '\uFD8F': '\u0645\u062E\u0645', + '\uFD92': '\u0645\u062C\u062E', + '\uFD93': '\u0647\u0645\u062C', + '\uFD94': '\u0647\u0645\u0645', + '\uFD95': '\u0646\u062D\u0645', + '\uFD96': '\u0646\u062D\u0649', + '\uFD97': '\u0646\u062C\u0645', + '\uFD98': '\u0646\u062C\u0645', + '\uFD99': '\u0646\u062C\u0649', + '\uFD9A': '\u0646\u0645\u064A', + '\uFD9B': '\u0646\u0645\u0649', + '\uFD9C': '\u064A\u0645\u0645', + '\uFD9D': '\u064A\u0645\u0645', + '\uFD9E': '\u0628\u062E\u064A', + '\uFD9F': '\u062A\u062C\u064A', + '\uFDA0': '\u062A\u062C\u0649', + '\uFDA1': '\u062A\u062E\u064A', + '\uFDA2': '\u062A\u062E\u0649', + '\uFDA3': '\u062A\u0645\u064A', + '\uFDA4': '\u062A\u0645\u0649', + '\uFDA5': '\u062C\u0645\u064A', + '\uFDA6': '\u062C\u062D\u0649', + '\uFDA7': '\u062C\u0645\u0649', + '\uFDA8': '\u0633\u062E\u0649', + '\uFDA9': '\u0635\u062D\u064A', + '\uFDAA': '\u0634\u062D\u064A', + '\uFDAB': '\u0636\u062D\u064A', + '\uFDAC': '\u0644\u062C\u064A', + '\uFDAD': '\u0644\u0645\u064A', + '\uFDAE': '\u064A\u062D\u064A', + '\uFDAF': '\u064A\u062C\u064A', + '\uFDB0': '\u064A\u0645\u064A', + '\uFDB1': '\u0645\u0645\u064A', + '\uFDB2': '\u0642\u0645\u064A', + '\uFDB3': '\u0646\u062D\u064A', + '\uFDB4': '\u0642\u0645\u062D', + '\uFDB5': '\u0644\u062D\u0645', + '\uFDB6': '\u0639\u0645\u064A', + '\uFDB7': '\u0643\u0645\u064A', + '\uFDB8': '\u0646\u062C\u062D', + '\uFDB9': '\u0645\u062E\u064A', + '\uFDBA': '\u0644\u062C\u0645', + '\uFDBB': '\u0643\u0645\u0645', + '\uFDBC': '\u0644\u062C\u0645', + '\uFDBD': '\u0646\u062C\u062D', + '\uFDBE': '\u062C\u062D\u064A', + '\uFDBF': '\u062D\u062C\u064A', + '\uFDC0': '\u0645\u062C\u064A', + '\uFDC1': '\u0641\u0645\u064A', + '\uFDC2': '\u0628\u062D\u064A', + '\uFDC3': '\u0643\u0645\u0645', + '\uFDC4': '\u0639\u062C\u0645', + '\uFDC5': '\u0635\u0645\u0645', + '\uFDC6': '\u0633\u062E\u064A', + '\uFDC7': '\u0646\u062C\u064A', + '\uFE49': '\u203E', + '\uFE4A': '\u203E', + '\uFE4B': '\u203E', + '\uFE4C': '\u203E', + '\uFE4D': '\u005F', + '\uFE4E': '\u005F', + '\uFE4F': '\u005F', + '\uFE80': '\u0621', + '\uFE81': '\u0622', + '\uFE82': '\u0622', + '\uFE83': '\u0623', + '\uFE84': '\u0623', + '\uFE85': '\u0624', + '\uFE86': '\u0624', + '\uFE87': '\u0625', + '\uFE88': '\u0625', + '\uFE89': '\u0626', + '\uFE8A': '\u0626', + '\uFE8B': '\u0626', + '\uFE8C': '\u0626', + '\uFE8D': '\u0627', + '\uFE8E': '\u0627', + '\uFE8F': '\u0628', + '\uFE90': '\u0628', + '\uFE91': '\u0628', + '\uFE92': '\u0628', + '\uFE93': '\u0629', + '\uFE94': '\u0629', + '\uFE95': '\u062A', + '\uFE96': '\u062A', + '\uFE97': '\u062A', + '\uFE98': '\u062A', + '\uFE99': '\u062B', + '\uFE9A': '\u062B', + '\uFE9B': '\u062B', + '\uFE9C': '\u062B', + '\uFE9D': '\u062C', + '\uFE9E': '\u062C', + '\uFE9F': '\u062C', + '\uFEA0': '\u062C', + '\uFEA1': '\u062D', + '\uFEA2': '\u062D', + '\uFEA3': '\u062D', + '\uFEA4': '\u062D', + '\uFEA5': '\u062E', + '\uFEA6': '\u062E', + '\uFEA7': '\u062E', + '\uFEA8': '\u062E', + '\uFEA9': '\u062F', + '\uFEAA': '\u062F', + '\uFEAB': '\u0630', + '\uFEAC': '\u0630', + '\uFEAD': '\u0631', + '\uFEAE': '\u0631', + '\uFEAF': '\u0632', + '\uFEB0': '\u0632', + '\uFEB1': '\u0633', + '\uFEB2': '\u0633', + '\uFEB3': '\u0633', + '\uFEB4': '\u0633', + '\uFEB5': '\u0634', + '\uFEB6': '\u0634', + '\uFEB7': '\u0634', + '\uFEB8': '\u0634', + '\uFEB9': '\u0635', + '\uFEBA': '\u0635', + '\uFEBB': '\u0635', + '\uFEBC': '\u0635', + '\uFEBD': '\u0636', + '\uFEBE': '\u0636', + '\uFEBF': '\u0636', + '\uFEC0': '\u0636', + '\uFEC1': '\u0637', + '\uFEC2': '\u0637', + '\uFEC3': '\u0637', + '\uFEC4': '\u0637', + '\uFEC5': '\u0638', + '\uFEC6': '\u0638', + '\uFEC7': '\u0638', + '\uFEC8': '\u0638', + '\uFEC9': '\u0639', + '\uFECA': '\u0639', + '\uFECB': '\u0639', + '\uFECC': '\u0639', + '\uFECD': '\u063A', + '\uFECE': '\u063A', + '\uFECF': '\u063A', + '\uFED0': '\u063A', + '\uFED1': '\u0641', + '\uFED2': '\u0641', + '\uFED3': '\u0641', + '\uFED4': '\u0641', + '\uFED5': '\u0642', + '\uFED6': '\u0642', + '\uFED7': '\u0642', + '\uFED8': '\u0642', + '\uFED9': '\u0643', + '\uFEDA': '\u0643', + '\uFEDB': '\u0643', + '\uFEDC': '\u0643', + '\uFEDD': '\u0644', + '\uFEDE': '\u0644', + '\uFEDF': '\u0644', + '\uFEE0': '\u0644', + '\uFEE1': '\u0645', + '\uFEE2': '\u0645', + '\uFEE3': '\u0645', + '\uFEE4': '\u0645', + '\uFEE5': '\u0646', + '\uFEE6': '\u0646', + '\uFEE7': '\u0646', + '\uFEE8': '\u0646', + '\uFEE9': '\u0647', + '\uFEEA': '\u0647', + '\uFEEB': '\u0647', + '\uFEEC': '\u0647', + '\uFEED': '\u0648', + '\uFEEE': '\u0648', + '\uFEEF': '\u0649', + '\uFEF0': '\u0649', + '\uFEF1': '\u064A', + '\uFEF2': '\u064A', + '\uFEF3': '\u064A', + '\uFEF4': '\u064A', + '\uFEF5': '\u0644\u0622', + '\uFEF6': '\u0644\u0622', + '\uFEF7': '\u0644\u0623', + '\uFEF8': '\u0644\u0623', + '\uFEF9': '\u0644\u0625', + '\uFEFA': '\u0644\u0625', + '\uFEFB': '\u0644\u0627', + '\uFEFC': '\u0644\u0627' +}; + +function reverseIfRtl(chars) { + var charsLength = chars.length; + //reverse an arabic ligature + if (charsLength <= 1 || !isRTLRangeFor(chars.charCodeAt(0))) { + return chars; + } + var s = ''; + for (var ii = charsLength - 1; ii >= 0; ii--) { + s += chars[ii]; + } + return s; +} + +function adjustWidths(properties) { + if (properties.fontMatrix[0] === FONT_IDENTITY_MATRIX[0]) { + return; + } + // adjusting width to fontMatrix scale + var scale = 0.001 / properties.fontMatrix[0]; + var glyphsWidths = properties.widths; + for (var glyph in glyphsWidths) { + glyphsWidths[glyph] *= scale; + } + properties.defaultWidth *= scale; +} + +function getFontType(type, subtype) { + switch (type) { + case 'Type1': + return subtype === 'Type1C' ? FontType.TYPE1C : FontType.TYPE1; + case 'CIDFontType0': + return subtype === 'CIDFontType0C' ? FontType.CIDFONTTYPE0C : + FontType.CIDFONTTYPE0; + case 'OpenType': + return FontType.OPENTYPE; + case 'TrueType': + return FontType.TRUETYPE; + case 'CIDFontType2': + return FontType.CIDFONTTYPE2; + case 'MMType1': + return FontType.MMTYPE1; + case 'Type0': + return FontType.TYPE0; + default: + return FontType.UNKNOWN; + } +} + +var Glyph = (function GlyphClosure() { + function Glyph(fontChar, unicode, accent, width, vmetric, operatorListId) { + this.fontChar = fontChar; + this.unicode = unicode; + this.accent = accent; + this.width = width; + this.vmetric = vmetric; + this.operatorListId = operatorListId; + } + + Glyph.prototype.matchesForCache = + function(fontChar, unicode, accent, width, vmetric, operatorListId) { + return this.fontChar === fontChar && + this.unicode === unicode && + this.accent === accent && + this.width === width && + this.vmetric === vmetric && + this.operatorListId === operatorListId; + }; + + return Glyph; +})(); + +var ToUnicodeMap = (function ToUnicodeMapClosure() { + function ToUnicodeMap(cmap) { + // The elements of this._map can be integers or strings, depending on how + // |cmap| was created. + this._map = cmap; + } + + ToUnicodeMap.prototype = { + get length() { + return this._map.length; + }, + + forEach: function(callback) { + for (var charCode in this._map) { + callback(charCode, this._map[charCode].charCodeAt(0)); + } + }, + + has: function(i) { + return this._map[i] !== undefined; + }, + + get: function(i) { + return this._map[i]; + }, + + charCodeOf: function(v) { + return this._map.indexOf(v); + } + }; + + return ToUnicodeMap; +})(); + +var IdentityToUnicodeMap = (function IdentityToUnicodeMapClosure() { + function IdentityToUnicodeMap(firstChar, lastChar) { + this.firstChar = firstChar; + this.lastChar = lastChar; + } + + IdentityToUnicodeMap.prototype = { + get length() { + return (this.lastChar + 1) - this.firstChar; + }, + + forEach: function (callback) { + for (var i = this.firstChar, ii = this.lastChar; i <= ii; i++) { + callback(i, i); + } + }, + + has: function (i) { + return this.firstChar <= i && i <= this.lastChar; + }, + + get: function (i) { + if (this.firstChar <= i && i <= this.lastChar) { + return String.fromCharCode(i); + } + return undefined; + }, + + charCodeOf: function (v) { + error('should not call .charCodeOf'); + } + }; + + return IdentityToUnicodeMap; +})(); + +var OpenTypeFileBuilder = (function OpenTypeFileBuilderClosure() { + function writeInt16(dest, offset, num) { + dest[offset] = (num >> 8) & 0xFF; + dest[offset + 1] = num & 0xFF; + } + + function writeInt32(dest, offset, num) { + dest[offset] = (num >> 24) & 0xFF; + dest[offset + 1] = (num >> 16) & 0xFF; + dest[offset + 2] = (num >> 8) & 0xFF; + dest[offset + 3] = num & 0xFF; + } + + function writeData(dest, offset, data) { + var i, ii; + if (data instanceof Uint8Array) { + dest.set(data, offset); + } else if (typeof data === 'string') { + for (i = 0, ii = data.length; i < ii; i++) { + dest[offset++] = data.charCodeAt(i) & 0xFF; + } + } else { + // treating everything else as array + for (i = 0, ii = data.length; i < ii; i++) { + dest[offset++] = data[i] & 0xFF; + } + } + } + + function OpenTypeFileBuilder(sfnt) { + this.sfnt = sfnt; + this.tables = Object.create(null); + } + + OpenTypeFileBuilder.getSearchParams = + function OpenTypeFileBuilder_getSearchParams(entriesCount, entrySize) { + var maxPower2 = 1, log2 = 0; + while ((maxPower2 ^ entriesCount) > maxPower2) { + maxPower2 <<= 1; + log2++; + } + var searchRange = maxPower2 * entrySize; + return { + range: searchRange, + entry: log2, + rangeShift: entrySize * entriesCount - searchRange + }; + }; + + var OTF_HEADER_SIZE = 12; + var OTF_TABLE_ENTRY_SIZE = 16; + + OpenTypeFileBuilder.prototype = { + toArray: function OpenTypeFileBuilder_toArray() { + var sfnt = this.sfnt; + + // Tables needs to be written by ascendant alphabetic order + var tables = this.tables; + var tablesNames = Object.keys(tables); + tablesNames.sort(); + var numTables = tablesNames.length; + + var i, j, jj, table, tableName; + // layout the tables data + var offset = OTF_HEADER_SIZE + numTables * OTF_TABLE_ENTRY_SIZE; + var tableOffsets = [offset]; + for (i = 0; i < numTables; i++) { + table = tables[tablesNames[i]]; + var paddedLength = ((table.length + 3) & ~3) >>> 0; + offset += paddedLength; + tableOffsets.push(offset); + } + + var file = new Uint8Array(offset); + // write the table data first (mostly for checksum) + for (i = 0; i < numTables; i++) { + table = tables[tablesNames[i]]; + writeData(file, tableOffsets[i], table); + } + + // sfnt version (4 bytes) + if (sfnt === 'true') { + // Windows hates the Mac TrueType sfnt version number + sfnt = string32(0x00010000); + } + file[0] = sfnt.charCodeAt(0) & 0xFF; + file[1] = sfnt.charCodeAt(1) & 0xFF; + file[2] = sfnt.charCodeAt(2) & 0xFF; + file[3] = sfnt.charCodeAt(3) & 0xFF; + + // numTables (2 bytes) + writeInt16(file, 4, numTables); + + var searchParams = OpenTypeFileBuilder.getSearchParams(numTables, 16); + + // searchRange (2 bytes) + writeInt16(file, 6, searchParams.range); + // entrySelector (2 bytes) + writeInt16(file, 8, searchParams.entry); + // rangeShift (2 bytes) + writeInt16(file, 10, searchParams.rangeShift); + + offset = OTF_HEADER_SIZE; + // writing table entries + for (i = 0; i < numTables; i++) { + tableName = tablesNames[i]; + file[offset] = tableName.charCodeAt(0) & 0xFF; + file[offset + 1] = tableName.charCodeAt(1) & 0xFF; + file[offset + 2] = tableName.charCodeAt(2) & 0xFF; + file[offset + 3] = tableName.charCodeAt(3) & 0xFF; + + // checksum + var checksum = 0; + for (j = tableOffsets[i], jj = tableOffsets[i + 1]; j < jj; j += 4) { + var quad = (file[j] << 24) + (file[j + 1] << 16) + + (file[j + 2] << 8) + file[j + 3]; + checksum = (checksum + quad) | 0; + } + writeInt32(file, offset + 4, checksum); + + // offset + writeInt32(file, offset + 8, tableOffsets[i]); + // length + writeInt32(file, offset + 12, tables[tableName].length); + + offset += OTF_TABLE_ENTRY_SIZE; + } + return file; + }, + + addTable: function OpenTypeFileBuilder_addTable(tag, data) { + if (tag in this.tables) { + throw new Error('Table ' + tag + ' already exists'); + } + this.tables[tag] = data; + } + }; + + return OpenTypeFileBuilder; +})(); + +// Problematic Unicode characters in the fonts that needs to be moved to avoid +// issues when they are painted on the canvas, e.g. complex-script shaping or +// control/whitespace characters. The ranges are listed in pairs: the first item +// is a code of the first problematic code, the second one is the next +// non-problematic code. The ranges must be in sorted order. +var ProblematicCharRanges = new Int32Array([ + // Control characters. + 0x0000, 0x0020, + 0x007F, 0x00A1, + 0x00AD, 0x00AE, + // Chars that is used in complex-script shaping. + 0x0600, 0x0780, + 0x08A0, 0x10A0, + 0x1780, 0x1800, + // General punctuation chars. + 0x2000, 0x2010, + 0x2011, 0x2012, + 0x2028, 0x2030, + 0x205F, 0x2070, + 0x25CC, 0x25CD, + // Chars that is used in complex-script shaping. + 0xAA60, 0xAA80, + // Specials Unicode block. + 0xFFF0, 0x10000 +]); + +/** + * 'Font' is the class the outside world should use, it encapsulate all the font + * decoding logics whatever type it is (assuming the font type is supported). + * + * For example to read a Type1 font and to attach it to the document: + * var type1Font = new Font("MyFontName", binaryFile, propertiesObject); + * type1Font.bind(); + */ +var Font = (function FontClosure() { + function Font(name, file, properties) { + var charCode, glyphName, fontChar; + + this.name = name; + this.loadedName = properties.loadedName; + this.isType3Font = properties.isType3Font; + this.sizes = []; + + this.glyphCache = {}; + + var names = name.split('+'); + names = names.length > 1 ? names[1] : names[0]; + names = names.split(/[-,_]/g)[0]; + this.isSerifFont = !!(properties.flags & FontFlags.Serif); + this.isSymbolicFont = !!(properties.flags & FontFlags.Symbolic); + this.isMonospace = !!(properties.flags & FontFlags.FixedPitch); + + var type = properties.type; + var subtype = properties.subtype; + this.type = type; + + this.fallbackName = (this.isMonospace ? 'monospace' : + (this.isSerifFont ? 'serif' : 'sans-serif')); + + this.differences = properties.differences; + this.widths = properties.widths; + this.defaultWidth = properties.defaultWidth; + this.composite = properties.composite; + this.wideChars = properties.wideChars; + this.cMap = properties.cMap; + this.ascent = properties.ascent / PDF_GLYPH_SPACE_UNITS; + this.descent = properties.descent / PDF_GLYPH_SPACE_UNITS; + this.fontMatrix = properties.fontMatrix; + this.bbox = properties.bbox; + + this.toUnicode = properties.toUnicode = this.buildToUnicode(properties); + + this.toFontChar = []; + + if (properties.type === 'Type3') { + for (charCode = 0; charCode < 256; charCode++) { + this.toFontChar[charCode] = (this.differences[charCode] || + properties.defaultEncoding[charCode]); + } + this.fontType = FontType.TYPE3; + return; + } + + this.cidEncoding = properties.cidEncoding; + this.vertical = properties.vertical; + if (this.vertical) { + this.vmetrics = properties.vmetrics; + this.defaultVMetrics = properties.defaultVMetrics; + } + + if (!file || file.isEmpty) { + if (file) { + // Some bad PDF generators will include empty font files, + // attempting to recover by assuming that no file exists. + warn('Font file is empty in "' + name + '" (' + this.loadedName + ')'); + } + + this.missingFile = true; + // The file data is not specified. Trying to fix the font name + // to be used with the canvas.font. + var fontName = name.replace(/[,_]/g, '-'); + var isStandardFont = !!stdFontMap[fontName] || + !!(nonStdFontMap[fontName] && stdFontMap[nonStdFontMap[fontName]]); + fontName = stdFontMap[fontName] || nonStdFontMap[fontName] || fontName; + + this.bold = (fontName.search(/bold/gi) !== -1); + this.italic = ((fontName.search(/oblique/gi) !== -1) || + (fontName.search(/italic/gi) !== -1)); + + // Use 'name' instead of 'fontName' here because the original + // name ArialBlack for example will be replaced by Helvetica. + this.black = (name.search(/Black/g) !== -1); + + // if at least one width is present, remeasure all chars when exists + this.remeasure = Object.keys(this.widths).length > 0; + if (isStandardFont && type === 'CIDFontType2' && + properties.cidEncoding.indexOf('Identity-') === 0) { + // Standard fonts might be embedded as CID font without glyph mapping. + // Building one based on GlyphMapForStandardFonts. + var map = []; + for (charCode in GlyphMapForStandardFonts) { + map[+charCode] = GlyphMapForStandardFonts[charCode]; + } + if (/ArialBlack/i.test(name)) { + for (charCode in SupplementalGlyphMapForArialBlack) { + map[+charCode] = SupplementalGlyphMapForArialBlack[charCode]; + } + } + var isIdentityUnicode = this.toUnicode instanceof IdentityToUnicodeMap; + if (!isIdentityUnicode) { + this.toUnicode.forEach(function(charCode, unicodeCharCode) { + map[+charCode] = unicodeCharCode; + }); + } + this.toFontChar = map; + this.toUnicode = new ToUnicodeMap(map); + } else if (/Symbol/i.test(fontName)) { + var symbols = Encodings.SymbolSetEncoding; + for (charCode in symbols) { + fontChar = GlyphsUnicode[symbols[charCode]]; + if (!fontChar) { + continue; + } + this.toFontChar[charCode] = fontChar; + } + for (charCode in properties.differences) { + fontChar = GlyphsUnicode[properties.differences[charCode]]; + if (!fontChar) { + continue; + } + this.toFontChar[charCode] = fontChar; + } + } else if (/Dingbats/i.test(fontName)) { + if (/Wingdings/i.test(name)) { + warn('Wingdings font without embedded font file, ' + + 'falling back to the ZapfDingbats encoding.'); + } + var dingbats = Encodings.ZapfDingbatsEncoding; + for (charCode in dingbats) { + fontChar = DingbatsGlyphsUnicode[dingbats[charCode]]; + if (!fontChar) { + continue; + } + this.toFontChar[charCode] = fontChar; + } + for (charCode in properties.differences) { + fontChar = DingbatsGlyphsUnicode[properties.differences[charCode]]; + if (!fontChar) { + continue; + } + this.toFontChar[charCode] = fontChar; + } + } else if (isStandardFont) { + this.toFontChar = []; + for (charCode in properties.defaultEncoding) { + glyphName = (properties.differences[charCode] || + properties.defaultEncoding[charCode]); + this.toFontChar[charCode] = GlyphsUnicode[glyphName]; + } + } else { + var unicodeCharCode, notCidFont = (type.indexOf('CIDFontType') === -1); + this.toUnicode.forEach(function(charCode, unicodeCharCode) { + if (notCidFont) { + glyphName = (properties.differences[charCode] || + properties.defaultEncoding[charCode]); + unicodeCharCode = (GlyphsUnicode[glyphName] || unicodeCharCode); + } + this.toFontChar[charCode] = unicodeCharCode; + }.bind(this)); + } + this.loadedName = fontName.split('-')[0]; + this.loading = false; + this.fontType = getFontType(type, subtype); + return; + } + + // Some fonts might use wrong font types for Type1C or CIDFontType0C + if (subtype === 'Type1C' && (type !== 'Type1' && type !== 'MMType1')) { + // Some TrueType fonts by mistake claim Type1C + if (isTrueTypeFile(file)) { + subtype = 'TrueType'; + } else { + type = 'Type1'; + } + } + if (subtype === 'CIDFontType0C' && type !== 'CIDFontType0') { + type = 'CIDFontType0'; + } + if (subtype === 'OpenType') { + type = 'OpenType'; + } + // Some CIDFontType0C fonts by mistake claim CIDFontType0. + if (type === 'CIDFontType0') { + subtype = isType1File(file) ? 'CIDFontType0' : 'CIDFontType0C'; + } + + var data; + switch (type) { + case 'MMType1': + info('MMType1 font (' + name + '), falling back to Type1.'); + /* falls through */ + case 'Type1': + case 'CIDFontType0': + this.mimetype = 'font/opentype'; + + var cff = (subtype === 'Type1C' || subtype === 'CIDFontType0C') ? + new CFFFont(file, properties) : new Type1Font(name, file, properties); + + adjustWidths(properties); + + // Wrap the CFF data inside an OTF font file + data = this.convert(name, cff, properties); + break; + + case 'OpenType': + case 'TrueType': + case 'CIDFontType2': + this.mimetype = 'font/opentype'; + + // Repair the TrueType file. It is can be damaged in the point of + // view of the sanitizer + data = this.checkAndRepair(name, file, properties); + if (this.isOpenType) { + type = 'OpenType'; + } + break; + + default: + error('Font ' + type + ' is not supported'); + break; + } + + this.data = data; + this.fontType = getFontType(type, subtype); + + // Transfer some properties again that could change during font conversion + this.fontMatrix = properties.fontMatrix; + this.widths = properties.widths; + this.defaultWidth = properties.defaultWidth; + this.encoding = properties.baseEncoding; + this.seacMap = properties.seacMap; + + this.loading = true; + } + + Font.getFontID = (function () { + var ID = 1; + return function Font_getFontID() { + return String(ID++); + }; + })(); + + function int16(b0, b1) { + return (b0 << 8) + b1; + } + + function int32(b0, b1, b2, b3) { + return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3; + } + + function string16(value) { + return String.fromCharCode((value >> 8) & 0xff, value & 0xff); + } + + function safeString16(value) { + // clamp value to the 16-bit int range + value = (value > 0x7FFF ? 0x7FFF : (value < -0x8000 ? -0x8000 : value)); + return String.fromCharCode((value >> 8) & 0xff, value & 0xff); + } + + function isTrueTypeFile(file) { + var header = file.peekBytes(4); + return readUint32(header, 0) === 0x00010000; + } + + function isType1File(file) { + var header = file.peekBytes(2); + // All Type1 font programs must begin with the comment '%!' (0x25 + 0x21). + if (header[0] === 0x25 && header[1] === 0x21) { + return true; + } + // ... obviously some fonts violate that part of the specification, + // please refer to the comment in |Type1Font| below. + if (header[0] === 0x80 && header[1] === 0x01) { // pfb file header. + return true; + } + return false; + } + + /** + * Helper function for |adjustMapping|. + * @return {boolean} + */ + function isProblematicUnicodeLocation(code) { + // Using binary search to find a range start. + var i = 0, j = ProblematicCharRanges.length - 1; + while (i < j) { + var c = (i + j + 1) >> 1; + if (code < ProblematicCharRanges[c]) { + j = c - 1; + } else { + i = c; + } + } + // Even index means code in problematic range. + return !(i & 1); + } + + /** + * Rebuilds the char code to glyph ID map by trying to replace the char codes + * with their unicode value. It also moves char codes that are in known + * problematic locations. + * @return {Object} Two properties: + * 'toFontChar' - maps original char codes(the value that will be read + * from commands such as show text) to the char codes that will be used in the + * font that we build + * 'charCodeToGlyphId' - maps the new font char codes to glyph ids + */ + function adjustMapping(charCodeToGlyphId, properties) { + var toUnicode = properties.toUnicode; + var isSymbolic = !!(properties.flags & FontFlags.Symbolic); + var isIdentityUnicode = + properties.toUnicode instanceof IdentityToUnicodeMap; + var newMap = Object.create(null); + var toFontChar = []; + var usedFontCharCodes = []; + var nextAvailableFontCharCode = PRIVATE_USE_OFFSET_START; + for (var originalCharCode in charCodeToGlyphId) { + originalCharCode |= 0; + var glyphId = charCodeToGlyphId[originalCharCode]; + var fontCharCode = originalCharCode; + // First try to map the value to a unicode position if a non identity map + // was created. + if (!isIdentityUnicode && toUnicode.has(originalCharCode)) { + var unicode = toUnicode.get(fontCharCode); + // TODO: Try to map ligatures to the correct spot. + if (unicode.length === 1) { + fontCharCode = unicode.charCodeAt(0); + } + } + // Try to move control characters, special characters and already mapped + // characters to the private use area since they will not be drawn by + // canvas if left in their current position. Also, move characters if the + // font was symbolic and there is only an identity unicode map since the + // characters probably aren't in the correct position (fixes an issue + // with firefox and thuluthfont). + if ((usedFontCharCodes[fontCharCode] !== undefined || + isProblematicUnicodeLocation(fontCharCode) || + (isSymbolic && isIdentityUnicode)) && + nextAvailableFontCharCode <= PRIVATE_USE_OFFSET_END) { // Room left. + // Loop to try and find a free spot in the private use area. + do { + fontCharCode = nextAvailableFontCharCode++; + + if (SKIP_PRIVATE_USE_RANGE_F000_TO_F01F && fontCharCode === 0xF000) { + fontCharCode = 0xF020; + nextAvailableFontCharCode = fontCharCode + 1; + } + + } while (usedFontCharCodes[fontCharCode] !== undefined && + nextAvailableFontCharCode <= PRIVATE_USE_OFFSET_END); + } + + newMap[fontCharCode] = glyphId; + toFontChar[originalCharCode] = fontCharCode; + usedFontCharCodes[fontCharCode] = true; + } + return { + toFontChar: toFontChar, + charCodeToGlyphId: newMap, + nextAvailableFontCharCode: nextAvailableFontCharCode + }; + } + + function getRanges(glyphs) { + // Array.sort() sorts by characters, not numerically, so convert to an + // array of characters. + var codes = []; + for (var charCode in glyphs) { + codes.push({ fontCharCode: charCode | 0, glyphId: glyphs[charCode] }); + } + codes.sort(function fontGetRangesSort(a, b) { + return a.fontCharCode - b.fontCharCode; + }); + + // Split the sorted codes into ranges. + var ranges = []; + var length = codes.length; + for (var n = 0; n < length; ) { + var start = codes[n].fontCharCode; + var codeIndices = [codes[n].glyphId]; + ++n; + var end = start; + while (n < length && end + 1 === codes[n].fontCharCode) { + codeIndices.push(codes[n].glyphId); + ++end; + ++n; + if (end === 0xFFFF) { + break; + } + } + ranges.push([start, end, codeIndices]); + } + + return ranges; + } + + function createCmapTable(glyphs) { + var ranges = getRanges(glyphs); + var numTables = ranges[ranges.length - 1][1] > 0xFFFF ? 2 : 1; + var cmap = '\x00\x00' + // version + string16(numTables) + // numTables + '\x00\x03' + // platformID + '\x00\x01' + // encodingID + string32(4 + numTables * 8); // start of the table record + + var i, ii, j, jj; + for (i = ranges.length - 1; i >= 0; --i) { + if (ranges[i][0] <= 0xFFFF) { break; } + } + var bmpLength = i + 1; + + if (ranges[i][0] < 0xFFFF && ranges[i][1] === 0xFFFF) { + ranges[i][1] = 0xFFFE; + } + var trailingRangesCount = ranges[i][1] < 0xFFFF ? 1 : 0; + var segCount = bmpLength + trailingRangesCount; + var searchParams = OpenTypeFileBuilder.getSearchParams(segCount, 2); + + // Fill up the 4 parallel arrays describing the segments. + var startCount = ''; + var endCount = ''; + var idDeltas = ''; + var idRangeOffsets = ''; + var glyphsIds = ''; + var bias = 0; + + var range, start, end, codes; + for (i = 0, ii = bmpLength; i < ii; i++) { + range = ranges[i]; + start = range[0]; + end = range[1]; + startCount += string16(start); + endCount += string16(end); + codes = range[2]; + var contiguous = true; + for (j = 1, jj = codes.length; j < jj; ++j) { + if (codes[j] !== codes[j - 1] + 1) { + contiguous = false; + break; + } + } + if (!contiguous) { + var offset = (segCount - i) * 2 + bias * 2; + bias += (end - start + 1); + + idDeltas += string16(0); + idRangeOffsets += string16(offset); + + for (j = 0, jj = codes.length; j < jj; ++j) { + glyphsIds += string16(codes[j]); + } + } else { + var startCode = codes[0]; + + idDeltas += string16((startCode - start) & 0xFFFF); + idRangeOffsets += string16(0); + } + } + + if (trailingRangesCount > 0) { + endCount += '\xFF\xFF'; + startCount += '\xFF\xFF'; + idDeltas += '\x00\x01'; + idRangeOffsets += '\x00\x00'; + } + + var format314 = '\x00\x00' + // language + string16(2 * segCount) + + string16(searchParams.range) + + string16(searchParams.entry) + + string16(searchParams.rangeShift) + + endCount + '\x00\x00' + startCount + + idDeltas + idRangeOffsets + glyphsIds; + + var format31012 = ''; + var header31012 = ''; + if (numTables > 1) { + cmap += '\x00\x03' + // platformID + '\x00\x0A' + // encodingID + string32(4 + numTables * 8 + + 4 + format314.length); // start of the table record + format31012 = ''; + for (i = 0, ii = ranges.length; i < ii; i++) { + range = ranges[i]; + start = range[0]; + codes = range[2]; + var code = codes[0]; + for (j = 1, jj = codes.length; j < jj; ++j) { + if (codes[j] !== codes[j - 1] + 1) { + end = range[0] + j - 1; + format31012 += string32(start) + // startCharCode + string32(end) + // endCharCode + string32(code); // startGlyphID + start = end + 1; + code = codes[j]; + } + } + format31012 += string32(start) + // startCharCode + string32(range[1]) + // endCharCode + string32(code); // startGlyphID + } + header31012 = '\x00\x0C' + // format + '\x00\x00' + // reserved + string32(format31012.length + 16) + // length + '\x00\x00\x00\x00' + // language + string32(format31012.length / 12); // nGroups + } + + return cmap + '\x00\x04' + // format + string16(format314.length + 4) + // length + format314 + header31012 + format31012; + } + + function validateOS2Table(os2) { + var stream = new Stream(os2.data); + var version = stream.getUint16(); + // TODO verify all OS/2 tables fields, but currently we validate only those + // that give us issues + stream.getBytes(60); // skipping type, misc sizes, panose, unicode ranges + var selection = stream.getUint16(); + if (version < 4 && (selection & 0x0300)) { + return false; + } + var firstChar = stream.getUint16(); + var lastChar = stream.getUint16(); + if (firstChar > lastChar) { + return false; + } + stream.getBytes(6); // skipping sTypoAscender/Descender/LineGap + var usWinAscent = stream.getUint16(); + if (usWinAscent === 0) { // makes font unreadable by windows + return false; + } + + // OS/2 appears to be valid, resetting some fields + os2.data[8] = os2.data[9] = 0; // IE rejects fonts if fsType != 0 + return true; + } + + function createOS2Table(properties, charstrings, override) { + override = override || { + unitsPerEm: 0, + yMax: 0, + yMin: 0, + ascent: 0, + descent: 0 + }; + + var ulUnicodeRange1 = 0; + var ulUnicodeRange2 = 0; + var ulUnicodeRange3 = 0; + var ulUnicodeRange4 = 0; + + var firstCharIndex = null; + var lastCharIndex = 0; + + if (charstrings) { + for (var code in charstrings) { + code |= 0; + if (firstCharIndex > code || !firstCharIndex) { + firstCharIndex = code; + } + if (lastCharIndex < code) { + lastCharIndex = code; + } + + var position = getUnicodeRangeFor(code); + if (position < 32) { + ulUnicodeRange1 |= 1 << position; + } else if (position < 64) { + ulUnicodeRange2 |= 1 << position - 32; + } else if (position < 96) { + ulUnicodeRange3 |= 1 << position - 64; + } else if (position < 123) { + ulUnicodeRange4 |= 1 << position - 96; + } else { + error('Unicode ranges Bits > 123 are reserved for internal usage'); + } + } + } else { + // TODO + firstCharIndex = 0; + lastCharIndex = 255; + } + + var bbox = properties.bbox || [0, 0, 0, 0]; + var unitsPerEm = (override.unitsPerEm || + 1 / (properties.fontMatrix || FONT_IDENTITY_MATRIX)[0]); + + // if the font units differ to the PDF glyph space units + // then scale up the values + var scale = (properties.ascentScaled ? 1.0 : + unitsPerEm / PDF_GLYPH_SPACE_UNITS); + + var typoAscent = (override.ascent || + Math.round(scale * (properties.ascent || bbox[3]))); + var typoDescent = (override.descent || + Math.round(scale * (properties.descent || bbox[1]))); + if (typoDescent > 0 && properties.descent > 0 && bbox[1] < 0) { + typoDescent = -typoDescent; // fixing incorrect descent + } + var winAscent = override.yMax || typoAscent; + var winDescent = -override.yMin || -typoDescent; + + return '\x00\x03' + // version + '\x02\x24' + // xAvgCharWidth + '\x01\xF4' + // usWeightClass + '\x00\x05' + // usWidthClass + '\x00\x00' + // fstype (0 to let the font loads via font-face on IE) + '\x02\x8A' + // ySubscriptXSize + '\x02\xBB' + // ySubscriptYSize + '\x00\x00' + // ySubscriptXOffset + '\x00\x8C' + // ySubscriptYOffset + '\x02\x8A' + // ySuperScriptXSize + '\x02\xBB' + // ySuperScriptYSize + '\x00\x00' + // ySuperScriptXOffset + '\x01\xDF' + // ySuperScriptYOffset + '\x00\x31' + // yStrikeOutSize + '\x01\x02' + // yStrikeOutPosition + '\x00\x00' + // sFamilyClass + '\x00\x00\x06' + + String.fromCharCode(properties.fixedPitch ? 0x09 : 0x00) + + '\x00\x00\x00\x00\x00\x00' + // Panose + string32(ulUnicodeRange1) + // ulUnicodeRange1 (Bits 0-31) + string32(ulUnicodeRange2) + // ulUnicodeRange2 (Bits 32-63) + string32(ulUnicodeRange3) + // ulUnicodeRange3 (Bits 64-95) + string32(ulUnicodeRange4) + // ulUnicodeRange4 (Bits 96-127) + '\x2A\x32\x31\x2A' + // achVendID + string16(properties.italicAngle ? 1 : 0) + // fsSelection + string16(firstCharIndex || + properties.firstChar) + // usFirstCharIndex + string16(lastCharIndex || properties.lastChar) + // usLastCharIndex + string16(typoAscent) + // sTypoAscender + string16(typoDescent) + // sTypoDescender + '\x00\x64' + // sTypoLineGap (7%-10% of the unitsPerEM value) + string16(winAscent) + // usWinAscent + string16(winDescent) + // usWinDescent + '\x00\x00\x00\x00' + // ulCodePageRange1 (Bits 0-31) + '\x00\x00\x00\x00' + // ulCodePageRange2 (Bits 32-63) + string16(properties.xHeight) + // sxHeight + string16(properties.capHeight) + // sCapHeight + string16(0) + // usDefaultChar + string16(firstCharIndex || properties.firstChar) + // usBreakChar + '\x00\x03'; // usMaxContext + } + + function createPostTable(properties) { + var angle = Math.floor(properties.italicAngle * (Math.pow(2, 16))); + return ('\x00\x03\x00\x00' + // Version number + string32(angle) + // italicAngle + '\x00\x00' + // underlinePosition + '\x00\x00' + // underlineThickness + string32(properties.fixedPitch) + // isFixedPitch + '\x00\x00\x00\x00' + // minMemType42 + '\x00\x00\x00\x00' + // maxMemType42 + '\x00\x00\x00\x00' + // minMemType1 + '\x00\x00\x00\x00'); // maxMemType1 + } + + function createNameTable(name, proto) { + if (!proto) { + proto = [[], []]; // no strings and unicode strings + } + + var strings = [ + proto[0][0] || 'Original licence', // 0.Copyright + proto[0][1] || name, // 1.Font family + proto[0][2] || 'Unknown', // 2.Font subfamily (font weight) + proto[0][3] || 'uniqueID', // 3.Unique ID + proto[0][4] || name, // 4.Full font name + proto[0][5] || 'Version 0.11', // 5.Version + proto[0][6] || '', // 6.Postscript name + proto[0][7] || 'Unknown', // 7.Trademark + proto[0][8] || 'Unknown', // 8.Manufacturer + proto[0][9] || 'Unknown' // 9.Designer + ]; + + // Mac want 1-byte per character strings while Windows want + // 2-bytes per character, so duplicate the names table + var stringsUnicode = []; + var i, ii, j, jj, str; + for (i = 0, ii = strings.length; i < ii; i++) { + str = proto[1][i] || strings[i]; + + var strBufUnicode = []; + for (j = 0, jj = str.length; j < jj; j++) { + strBufUnicode.push(string16(str.charCodeAt(j))); + } + stringsUnicode.push(strBufUnicode.join('')); + } + + var names = [strings, stringsUnicode]; + var platforms = ['\x00\x01', '\x00\x03']; + var encodings = ['\x00\x00', '\x00\x01']; + var languages = ['\x00\x00', '\x04\x09']; + + var namesRecordCount = strings.length * platforms.length; + var nameTable = + '\x00\x00' + // format + string16(namesRecordCount) + // Number of names Record + string16(namesRecordCount * 12 + 6); // Storage + + // Build the name records field + var strOffset = 0; + for (i = 0, ii = platforms.length; i < ii; i++) { + var strs = names[i]; + for (j = 0, jj = strs.length; j < jj; j++) { + str = strs[j]; + var nameRecord = + platforms[i] + // platform ID + encodings[i] + // encoding ID + languages[i] + // language ID + string16(j) + // name ID + string16(str.length) + + string16(strOffset); + nameTable += nameRecord; + strOffset += str.length; + } + } + + nameTable += strings.join('') + stringsUnicode.join(''); + return nameTable; + } + + Font.prototype = { + name: null, + font: null, + mimetype: null, + encoding: null, + get renderer() { + var renderer = FontRendererFactory.create(this); + return shadow(this, 'renderer', renderer); + }, + + exportData: function Font_exportData() { + var data = {}; + for (var i in this) { + if (this.hasOwnProperty(i)) { + data[i] = this[i]; + } + } + return data; + }, + + checkAndRepair: function Font_checkAndRepair(name, font, properties) { + function readTableEntry(file) { + var tag = bytesToString(file.getBytes(4)); + + var checksum = file.getInt32(); + var offset = file.getInt32() >>> 0; + var length = file.getInt32() >>> 0; + + // Read the table associated data + var previousPosition = file.pos; + file.pos = file.start ? file.start : 0; + file.skip(offset); + var data = file.getBytes(length); + file.pos = previousPosition; + + if (tag === 'head') { + // clearing checksum adjustment + data[8] = data[9] = data[10] = data[11] = 0; + data[17] |= 0x20; //Set font optimized for cleartype flag + } + + return { + tag: tag, + checksum: checksum, + length: length, + offset: offset, + data: data + }; + } + + function readOpenTypeHeader(ttf) { + return { + version: bytesToString(ttf.getBytes(4)), + numTables: ttf.getUint16(), + searchRange: ttf.getUint16(), + entrySelector: ttf.getUint16(), + rangeShift: ttf.getUint16() + }; + } + + /** + * Read the appropriate subtable from the cmap according to 9.6.6.4 from + * PDF spec + */ + function readCmapTable(cmap, font, isSymbolicFont, hasEncoding) { + var segment; + var start = (font.start ? font.start : 0) + cmap.offset; + font.pos = start; + + var version = font.getUint16(); + var numTables = font.getUint16(); + + var potentialTable; + var canBreak = false; + // There's an order of preference in terms of which cmap subtable to + // use: + // - non-symbolic fonts the preference is a 3,1 table then a 1,0 table + // - symbolic fonts the preference is a 3,0 table then a 1,0 table + // The following takes advantage of the fact that the tables are sorted + // to work. + for (var i = 0; i < numTables; i++) { + var platformId = font.getUint16(); + var encodingId = font.getUint16(); + var offset = font.getInt32() >>> 0; + var useTable = false; + + if (platformId === 0 && encodingId === 0) { + useTable = true; + // Continue the loop since there still may be a higher priority + // table. + } else if (platformId === 1 && encodingId === 0) { + useTable = true; + // Continue the loop since there still may be a higher priority + // table. + } else if (platformId === 3 && encodingId === 1 && + ((!isSymbolicFont && hasEncoding) || !potentialTable)) { + useTable = true; + if (!isSymbolicFont) { + canBreak = true; + } + } else if (isSymbolicFont && platformId === 3 && encodingId === 0) { + useTable = true; + canBreak = true; + } + + if (useTable) { + potentialTable = { + platformId: platformId, + encodingId: encodingId, + offset: offset + }; + } + if (canBreak) { + break; + } + } + + if (potentialTable) { + font.pos = start + potentialTable.offset; + } + if (!potentialTable || font.peekByte() === -1) { + warn('Could not find a preferred cmap table.'); + return { + platformId: -1, + encodingId: -1, + mappings: [], + hasShortCmap: false + }; + } + + var format = font.getUint16(); + var length = font.getUint16(); + var language = font.getUint16(); + + var hasShortCmap = false; + var mappings = []; + var j, glyphId; + + // TODO(mack): refactor this cmap subtable reading logic out + if (format === 0) { + for (j = 0; j < 256; j++) { + var index = font.getByte(); + if (!index) { + continue; + } + mappings.push({ + charCode: j, + glyphId: index + }); + } + hasShortCmap = true; + } else if (format === 4) { + // re-creating the table in format 4 since the encoding + // might be changed + var segCount = (font.getUint16() >> 1); + font.getBytes(6); // skipping range fields + var segIndex, segments = []; + for (segIndex = 0; segIndex < segCount; segIndex++) { + segments.push({ end: font.getUint16() }); + } + font.getUint16(); + for (segIndex = 0; segIndex < segCount; segIndex++) { + segments[segIndex].start = font.getUint16(); + } + + for (segIndex = 0; segIndex < segCount; segIndex++) { + segments[segIndex].delta = font.getUint16(); + } + + var offsetsCount = 0; + for (segIndex = 0; segIndex < segCount; segIndex++) { + segment = segments[segIndex]; + var rangeOffset = font.getUint16(); + if (!rangeOffset) { + segment.offsetIndex = -1; + continue; + } + + var offsetIndex = (rangeOffset >> 1) - (segCount - segIndex); + segment.offsetIndex = offsetIndex; + offsetsCount = Math.max(offsetsCount, offsetIndex + + segment.end - segment.start + 1); + } + + var offsets = []; + for (j = 0; j < offsetsCount; j++) { + offsets.push(font.getUint16()); + } + + for (segIndex = 0; segIndex < segCount; segIndex++) { + segment = segments[segIndex]; + start = segment.start; + var end = segment.end; + var delta = segment.delta; + offsetIndex = segment.offsetIndex; + + for (j = start; j <= end; j++) { + if (j === 0xFFFF) { + continue; + } + + glyphId = (offsetIndex < 0 ? + j : offsets[offsetIndex + j - start]); + glyphId = (glyphId + delta) & 0xFFFF; + if (glyphId === 0) { + continue; + } + mappings.push({ + charCode: j, + glyphId: glyphId + }); + } + } + } else if (format === 6) { + // Format 6 is a 2-bytes dense mapping, which means the font data + // lives glue together even if they are pretty far in the unicode + // table. (This looks weird, so I can have missed something), this + // works on Linux but seems to fails on Mac so let's rewrite the + // cmap table to a 3-1-4 style + var firstCode = font.getUint16(); + var entryCount = font.getUint16(); + + for (j = 0; j < entryCount; j++) { + glyphId = font.getUint16(); + var charCode = firstCode + j; + + mappings.push({ + charCode: charCode, + glyphId: glyphId + }); + } + } else { + warn('cmap table has unsupported format: ' + format); + return { + platformId: -1, + encodingId: -1, + mappings: [], + hasShortCmap: false + }; + } + + // removing duplicate entries + mappings.sort(function (a, b) { + return a.charCode - b.charCode; + }); + for (i = 1; i < mappings.length; i++) { + if (mappings[i - 1].charCode === mappings[i].charCode) { + mappings.splice(i, 1); + i--; + } + } + + return { + platformId: potentialTable.platformId, + encodingId: potentialTable.encodingId, + mappings: mappings, + hasShortCmap: hasShortCmap + }; + } + + function sanitizeMetrics(font, header, metrics, numGlyphs) { + if (!header) { + if (metrics) { + metrics.data = null; + } + return; + } + + font.pos = (font.start ? font.start : 0) + header.offset; + font.pos += header.length - 2; + var numOfMetrics = font.getUint16(); + + if (numOfMetrics > numGlyphs) { + info('The numOfMetrics (' + numOfMetrics + ') should not be ' + + 'greater than the numGlyphs (' + numGlyphs + ')'); + // Reduce numOfMetrics if it is greater than numGlyphs + numOfMetrics = numGlyphs; + header.data[34] = (numOfMetrics & 0xff00) >> 8; + header.data[35] = numOfMetrics & 0x00ff; + } + + var numOfSidebearings = numGlyphs - numOfMetrics; + var numMissing = numOfSidebearings - + ((metrics.length - numOfMetrics * 4) >> 1); + + if (numMissing > 0) { + // For each missing glyph, we set both the width and lsb to 0 (zero). + // Since we need to add two properties for each glyph, this explains + // the use of |numMissing * 2| when initializing the typed array. + var entries = new Uint8Array(metrics.length + numMissing * 2); + entries.set(metrics.data); + metrics.data = entries; + } + } + + function sanitizeGlyph(source, sourceStart, sourceEnd, dest, destStart, + hintsValid) { + if (sourceEnd - sourceStart <= 12) { + // glyph with data less than 12 is invalid one + return 0; + } + var glyf = source.subarray(sourceStart, sourceEnd); + var contoursCount = (glyf[0] << 8) | glyf[1]; + if (contoursCount & 0x8000) { + // complex glyph, writing as is + dest.set(glyf, destStart); + return glyf.length; + } + + var i, j = 10, flagsCount = 0; + for (i = 0; i < contoursCount; i++) { + var endPoint = (glyf[j] << 8) | glyf[j + 1]; + flagsCount = endPoint + 1; + j += 2; + } + // skipping instructions + var instructionsStart = j; + var instructionsLength = (glyf[j] << 8) | glyf[j + 1]; + j += 2 + instructionsLength; + var instructionsEnd = j; + // validating flags + var coordinatesLength = 0; + for (i = 0; i < flagsCount; i++) { + var flag = glyf[j++]; + if (flag & 0xC0) { + // reserved flags must be zero, cleaning up + glyf[j - 1] = flag & 0x3F; + } + var xyLength = ((flag & 2) ? 1 : (flag & 16) ? 0 : 2) + + ((flag & 4) ? 1 : (flag & 32) ? 0 : 2); + coordinatesLength += xyLength; + if (flag & 8) { + var repeat = glyf[j++]; + i += repeat; + coordinatesLength += repeat * xyLength; + } + } + // glyph without coordinates will be rejected + if (coordinatesLength === 0) { + return 0; + } + var glyphDataLength = j + coordinatesLength; + if (glyphDataLength > glyf.length) { + // not enough data for coordinates + return 0; + } + if (!hintsValid && instructionsLength > 0) { + dest.set(glyf.subarray(0, instructionsStart), destStart); + dest.set([0, 0], destStart + instructionsStart); + dest.set(glyf.subarray(instructionsEnd, glyphDataLength), + destStart + instructionsStart + 2); + glyphDataLength -= instructionsLength; + if (glyf.length - glyphDataLength > 3) { + glyphDataLength = (glyphDataLength + 3) & ~3; + } + return glyphDataLength; + } + if (glyf.length - glyphDataLength > 3) { + // truncating and aligning to 4 bytes the long glyph data + glyphDataLength = (glyphDataLength + 3) & ~3; + dest.set(glyf.subarray(0, glyphDataLength), destStart); + return glyphDataLength; + } + // glyph data is fine + dest.set(glyf, destStart); + return glyf.length; + } + + function sanitizeHead(head, numGlyphs, locaLength) { + var data = head.data; + + // Validate version: + // Should always be 0x00010000 + var version = int32(data[0], data[1], data[2], data[3]); + if (version >> 16 !== 1) { + info('Attempting to fix invalid version in head table: ' + version); + data[0] = 0; + data[1] = 1; + data[2] = 0; + data[3] = 0; + } + + var indexToLocFormat = int16(data[50], data[51]); + if (indexToLocFormat < 0 || indexToLocFormat > 1) { + info('Attempting to fix invalid indexToLocFormat in head table: ' + + indexToLocFormat); + + // The value of indexToLocFormat should be 0 if the loca table + // consists of short offsets, and should be 1 if the loca table + // consists of long offsets. + // + // The number of entries in the loca table should be numGlyphs + 1. + // + // Using this information, we can work backwards to deduce if the + // size of each offset in the loca table, and thus figure out the + // appropriate value for indexToLocFormat. + + var numGlyphsPlusOne = numGlyphs + 1; + if (locaLength === numGlyphsPlusOne << 1) { + // 0x0000 indicates the loca table consists of short offsets + data[50] = 0; + data[51] = 0; + } else if (locaLength === numGlyphsPlusOne << 2) { + // 0x0001 indicates the loca table consists of long offsets + data[50] = 0; + data[51] = 1; + } else { + warn('Could not fix indexToLocFormat: ' + indexToLocFormat); + } + } + } + + function sanitizeGlyphLocations(loca, glyf, numGlyphs, + isGlyphLocationsLong, hintsValid, + dupFirstEntry) { + var itemSize, itemDecode, itemEncode; + if (isGlyphLocationsLong) { + itemSize = 4; + itemDecode = function fontItemDecodeLong(data, offset) { + return (data[offset] << 24) | (data[offset + 1] << 16) | + (data[offset + 2] << 8) | data[offset + 3]; + }; + itemEncode = function fontItemEncodeLong(data, offset, value) { + data[offset] = (value >>> 24) & 0xFF; + data[offset + 1] = (value >> 16) & 0xFF; + data[offset + 2] = (value >> 8) & 0xFF; + data[offset + 3] = value & 0xFF; + }; + } else { + itemSize = 2; + itemDecode = function fontItemDecode(data, offset) { + return (data[offset] << 9) | (data[offset + 1] << 1); + }; + itemEncode = function fontItemEncode(data, offset, value) { + data[offset] = (value >> 9) & 0xFF; + data[offset + 1] = (value >> 1) & 0xFF; + }; + } + var locaData = loca.data; + var locaDataSize = itemSize * (1 + numGlyphs); + // is loca.data too short or long? + if (locaData.length !== locaDataSize) { + locaData = new Uint8Array(locaDataSize); + locaData.set(loca.data.subarray(0, locaDataSize)); + loca.data = locaData; + } + // removing the invalid glyphs + var oldGlyfData = glyf.data; + var oldGlyfDataLength = oldGlyfData.length; + var newGlyfData = new Uint8Array(oldGlyfDataLength); + var startOffset = itemDecode(locaData, 0); + var writeOffset = 0; + var missingGlyphData = {}; + itemEncode(locaData, 0, writeOffset); + var i, j; + for (i = 0, j = itemSize; i < numGlyphs; i++, j += itemSize) { + var endOffset = itemDecode(locaData, j); + if (endOffset > oldGlyfDataLength && + ((oldGlyfDataLength + 3) & ~3) === endOffset) { + // Aspose breaks fonts by aligning the glyphs to the qword, but not + // the glyf table size, which makes last glyph out of range. + endOffset = oldGlyfDataLength; + } + if (endOffset > oldGlyfDataLength) { + // glyph end offset points outside glyf data, rejecting the glyph + itemEncode(locaData, j, writeOffset); + startOffset = endOffset; + continue; + } + + if (startOffset === endOffset) { + missingGlyphData[i] = true; + } + + var newLength = sanitizeGlyph(oldGlyfData, startOffset, endOffset, + newGlyfData, writeOffset, hintsValid); + writeOffset += newLength; + itemEncode(locaData, j, writeOffset); + startOffset = endOffset; + } + + if (writeOffset === 0) { + // glyf table cannot be empty -- redoing the glyf and loca tables + // to have single glyph with one point + var simpleGlyph = new Uint8Array( + [0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 49, 0]); + for (i = 0, j = itemSize; i < numGlyphs; i++, j += itemSize) { + itemEncode(locaData, j, simpleGlyph.length); + } + glyf.data = simpleGlyph; + return missingGlyphData; + } + + if (dupFirstEntry) { + var firstEntryLength = itemDecode(locaData, itemSize); + if (newGlyfData.length > firstEntryLength + writeOffset) { + glyf.data = newGlyfData.subarray(0, firstEntryLength + writeOffset); + } else { + glyf.data = new Uint8Array(firstEntryLength + writeOffset); + glyf.data.set(newGlyfData.subarray(0, writeOffset)); + } + glyf.data.set(newGlyfData.subarray(0, firstEntryLength), writeOffset); + itemEncode(loca.data, locaData.length - itemSize, + writeOffset + firstEntryLength); + } else { + glyf.data = newGlyfData.subarray(0, writeOffset); + } + return missingGlyphData; + } + + function readPostScriptTable(post, properties, maxpNumGlyphs) { + var start = (font.start ? font.start : 0) + post.offset; + font.pos = start; + + var length = post.length, end = start + length; + var version = font.getInt32(); + // skip rest to the tables + font.getBytes(28); + + var glyphNames; + var valid = true; + var i; + + switch (version) { + case 0x00010000: + glyphNames = MacStandardGlyphOrdering; + break; + case 0x00020000: + var numGlyphs = font.getUint16(); + if (numGlyphs !== maxpNumGlyphs) { + valid = false; + break; + } + var glyphNameIndexes = []; + for (i = 0; i < numGlyphs; ++i) { + var index = font.getUint16(); + if (index >= 32768) { + valid = false; + break; + } + glyphNameIndexes.push(index); + } + if (!valid) { + break; + } + var customNames = []; + var strBuf = []; + while (font.pos < end) { + var stringLength = font.getByte(); + strBuf.length = stringLength; + for (i = 0; i < stringLength; ++i) { + strBuf[i] = String.fromCharCode(font.getByte()); + } + customNames.push(strBuf.join('')); + } + glyphNames = []; + for (i = 0; i < numGlyphs; ++i) { + var j = glyphNameIndexes[i]; + if (j < 258) { + glyphNames.push(MacStandardGlyphOrdering[j]); + continue; + } + glyphNames.push(customNames[j - 258]); + } + break; + case 0x00030000: + break; + default: + warn('Unknown/unsupported post table version ' + version); + valid = false; + if (properties.defaultEncoding) { + glyphNames = properties.defaultEncoding; + } + break; + } + properties.glyphNames = glyphNames; + return valid; + } + + function readNameTable(nameTable) { + var start = (font.start ? font.start : 0) + nameTable.offset; + font.pos = start; + + var names = [[], []]; + var length = nameTable.length, end = start + length; + var format = font.getUint16(); + var FORMAT_0_HEADER_LENGTH = 6; + if (format !== 0 || length < FORMAT_0_HEADER_LENGTH) { + // unsupported name table format or table "too" small + return names; + } + var numRecords = font.getUint16(); + var stringsStart = font.getUint16(); + var records = []; + var NAME_RECORD_LENGTH = 12; + var i, ii; + + for (i = 0; i < numRecords && + font.pos + NAME_RECORD_LENGTH <= end; i++) { + var r = { + platform: font.getUint16(), + encoding: font.getUint16(), + language: font.getUint16(), + name: font.getUint16(), + length: font.getUint16(), + offset: font.getUint16() + }; + // using only Macintosh and Windows platform/encoding names + if ((r.platform === 1 && r.encoding === 0 && r.language === 0) || + (r.platform === 3 && r.encoding === 1 && r.language === 0x409)) { + records.push(r); + } + } + for (i = 0, ii = records.length; i < ii; i++) { + var record = records[i]; + var pos = start + stringsStart + record.offset; + if (pos + record.length > end) { + continue; // outside of name table, ignoring + } + font.pos = pos; + var nameIndex = record.name; + if (record.encoding) { + // unicode + var str = ''; + for (var j = 0, jj = record.length; j < jj; j += 2) { + str += String.fromCharCode(font.getUint16()); + } + names[1][nameIndex] = str; + } else { + names[0][nameIndex] = bytesToString(font.getBytes(record.length)); + } + } + return names; + } + + var TTOpsStackDeltas = [ + 0, 0, 0, 0, 0, 0, 0, 0, -2, -2, -2, -2, 0, 0, -2, -5, + -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, -1, 0, -1, -1, -1, -1, + 1, -1, -999, 0, 1, 0, -1, -2, 0, -1, -2, -1, -1, 0, -1, -1, + 0, 0, -999, -999, -1, -1, -1, -1, -2, -999, -2, -2, -999, 0, -2, -2, + 0, 0, -2, 0, -2, 0, 0, 0, -2, -1, -1, 1, 1, 0, 0, -1, + -1, -1, -1, -1, -1, -1, 0, 0, -1, 0, -1, -1, 0, -999, -1, -1, + -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + -2, -999, -999, -999, -999, -999, -1, -1, -2, -2, 0, 0, 0, 0, -1, -1, + -999, -2, -2, 0, 0, -1, -2, -2, 0, 0, 0, -1, -1, -1, -2]; + // 0xC0-DF == -1 and 0xE0-FF == -2 + + function sanitizeTTProgram(table, ttContext) { + var data = table.data; + var i = 0, j, n, b, funcId, pc, lastEndf = 0, lastDeff = 0; + var stack = []; + var callstack = []; + var functionsCalled = []; + var tooComplexToFollowFunctions = + ttContext.tooComplexToFollowFunctions; + var inFDEF = false, ifLevel = 0, inELSE = 0; + for (var ii = data.length; i < ii;) { + var op = data[i++]; + // The TrueType instruction set docs can be found at + // https://developer.apple.com/fonts/TTRefMan/RM05/Chap5.html + if (op === 0x40) { // NPUSHB - pushes n bytes + n = data[i++]; + if (inFDEF || inELSE) { + i += n; + } else { + for (j = 0; j < n; j++) { + stack.push(data[i++]); + } + } + } else if (op === 0x41) { // NPUSHW - pushes n words + n = data[i++]; + if (inFDEF || inELSE) { + i += n * 2; + } else { + for (j = 0; j < n; j++) { + b = data[i++]; + stack.push((b << 8) | data[i++]); + } + } + } else if ((op & 0xF8) === 0xB0) { // PUSHB - pushes bytes + n = op - 0xB0 + 1; + if (inFDEF || inELSE) { + i += n; + } else { + for (j = 0; j < n; j++) { + stack.push(data[i++]); + } + } + } else if ((op & 0xF8) === 0xB8) { // PUSHW - pushes words + n = op - 0xB8 + 1; + if (inFDEF || inELSE) { + i += n * 2; + } else { + for (j = 0; j < n; j++) { + b = data[i++]; + stack.push((b << 8) | data[i++]); + } + } + } else if (op === 0x2B && !tooComplexToFollowFunctions) { // CALL + if (!inFDEF && !inELSE) { + // collecting inforamtion about which functions are used + funcId = stack[stack.length - 1]; + ttContext.functionsUsed[funcId] = true; + if (funcId in ttContext.functionsStackDeltas) { + stack.length += ttContext.functionsStackDeltas[funcId]; + } else if (funcId in ttContext.functionsDefined && + functionsCalled.indexOf(funcId) < 0) { + callstack.push({data: data, i: i, stackTop: stack.length - 1}); + functionsCalled.push(funcId); + pc = ttContext.functionsDefined[funcId]; + if (!pc) { + warn('TT: CALL non-existent function'); + ttContext.hintsValid = false; + return; + } + data = pc.data; + i = pc.i; + } + } + } else if (op === 0x2C && !tooComplexToFollowFunctions) { // FDEF + if (inFDEF || inELSE) { + warn('TT: nested FDEFs not allowed'); + tooComplexToFollowFunctions = true; + } + inFDEF = true; + // collecting inforamtion about which functions are defined + lastDeff = i; + funcId = stack.pop(); + ttContext.functionsDefined[funcId] = {data: data, i: i}; + } else if (op === 0x2D) { // ENDF - end of function + if (inFDEF) { + inFDEF = false; + lastEndf = i; + } else { + pc = callstack.pop(); + if (!pc) { + warn('TT: ENDF bad stack'); + ttContext.hintsValid = false; + return; + } + funcId = functionsCalled.pop(); + data = pc.data; + i = pc.i; + ttContext.functionsStackDeltas[funcId] = + stack.length - pc.stackTop; + } + } else if (op === 0x89) { // IDEF - instruction definition + if (inFDEF || inELSE) { + warn('TT: nested IDEFs not allowed'); + tooComplexToFollowFunctions = true; + } + inFDEF = true; + // recording it as a function to track ENDF + lastDeff = i; + } else if (op === 0x58) { // IF + ++ifLevel; + } else if (op === 0x1B) { // ELSE + inELSE = ifLevel; + } else if (op === 0x59) { // EIF + if (inELSE === ifLevel) { + inELSE = 0; + } + --ifLevel; + } else if (op === 0x1C) { // JMPR + if (!inFDEF && !inELSE) { + var offset = stack[stack.length - 1]; + // only jumping forward to prevent infinite loop + if (offset > 0) { + i += offset - 1; + } + } + } + // Adjusting stack not extactly, but just enough to get function id + if (!inFDEF && !inELSE) { + var stackDelta = op <= 0x8E ? TTOpsStackDeltas[op] : + op >= 0xC0 && op <= 0xDF ? -1 : op >= 0xE0 ? -2 : 0; + if (op >= 0x71 && op <= 0x75) { + n = stack.pop(); + if (n === n) { + stackDelta = -n * 2; + } + } + while (stackDelta < 0 && stack.length > 0) { + stack.pop(); + stackDelta++; + } + while (stackDelta > 0) { + stack.push(NaN); // pushing any number into stack + stackDelta--; + } + } + } + ttContext.tooComplexToFollowFunctions = tooComplexToFollowFunctions; + var content = [data]; + if (i > data.length) { + content.push(new Uint8Array(i - data.length)); + } + if (lastDeff > lastEndf) { + warn('TT: complementing a missing function tail'); + // new function definition started, but not finished + // complete function by [CLEAR, ENDF] + content.push(new Uint8Array([0x22, 0x2D])); + } + foldTTTable(table, content); + } + + function checkInvalidFunctions(ttContext, maxFunctionDefs) { + if (ttContext.tooComplexToFollowFunctions) { + return; + } + if (ttContext.functionsDefined.length > maxFunctionDefs) { + warn('TT: more functions defined than expected'); + ttContext.hintsValid = false; + return; + } + for (var j = 0, jj = ttContext.functionsUsed.length; j < jj; j++) { + if (j > maxFunctionDefs) { + warn('TT: invalid function id: ' + j); + ttContext.hintsValid = false; + return; + } + if (ttContext.functionsUsed[j] && !ttContext.functionsDefined[j]) { + warn('TT: undefined function: ' + j); + ttContext.hintsValid = false; + return; + } + } + } + + function foldTTTable(table, content) { + if (content.length > 1) { + // concatenating the content items + var newLength = 0; + var j, jj; + for (j = 0, jj = content.length; j < jj; j++) { + newLength += content[j].length; + } + newLength = (newLength + 3) & ~3; + var result = new Uint8Array(newLength); + var pos = 0; + for (j = 0, jj = content.length; j < jj; j++) { + result.set(content[j], pos); + pos += content[j].length; + } + table.data = result; + table.length = newLength; + } + } + + function sanitizeTTPrograms(fpgm, prep, cvt) { + var ttContext = { + functionsDefined: [], + functionsUsed: [], + functionsStackDeltas: [], + tooComplexToFollowFunctions: false, + hintsValid: true + }; + if (fpgm) { + sanitizeTTProgram(fpgm, ttContext); + } + if (prep) { + sanitizeTTProgram(prep, ttContext); + } + if (fpgm) { + checkInvalidFunctions(ttContext, maxFunctionDefs); + } + if (cvt && (cvt.length & 1)) { + var cvtData = new Uint8Array(cvt.length + 1); + cvtData.set(cvt.data); + cvt.data = cvtData; + } + return ttContext.hintsValid; + } + + // The following steps modify the original font data, making copy + font = new Stream(new Uint8Array(font.getBytes())); + + var VALID_TABLES = ['OS/2', 'cmap', 'head', 'hhea', 'hmtx', 'maxp', + 'name', 'post', 'loca', 'glyf', 'fpgm', 'prep', 'cvt ', 'CFF ']; + + var header = readOpenTypeHeader(font); + var numTables = header.numTables; + var cff, cffFile; + + var tables = { 'OS/2': null, cmap: null, head: null, hhea: null, + hmtx: null, maxp: null, name: null, post: null }; + var table; + for (var i = 0; i < numTables; i++) { + table = readTableEntry(font); + if (VALID_TABLES.indexOf(table.tag) < 0) { + continue; // skipping table if it's not a required or optional table + } + if (table.length === 0) { + continue; // skipping empty tables + } + tables[table.tag] = table; + } + + var isTrueType = !tables['CFF ']; + if (!isTrueType) { + // OpenType font + if ((header.version === 'OTTO' && properties.type !== 'CIDFontType2') || + !tables.head || !tables.hhea || !tables.maxp || !tables.post) { + // no major tables: throwing everything at CFFFont + cffFile = new Stream(tables['CFF '].data); + cff = new CFFFont(cffFile, properties); + + return this.convert(name, cff, properties); + } + + delete tables.glyf; + delete tables.loca; + delete tables.fpgm; + delete tables.prep; + delete tables['cvt ']; + this.isOpenType = true; + } else { + if (!tables.glyf || !tables.loca) { + error('Required "glyf" or "loca" tables are not found'); + } + this.isOpenType = false; + } + + if (!tables.maxp) { + error('Required "maxp" table is not found'); + } + + font.pos = (font.start || 0) + tables.maxp.offset; + var version = font.getInt32(); + var numGlyphs = font.getUint16(); + var maxFunctionDefs = 0; + if (version >= 0x00010000 && tables.maxp.length >= 22) { + // maxZones can be invalid + font.pos += 8; + var maxZones = font.getUint16(); + if (maxZones > 2) { // reset to 2 if font has invalid maxZones + tables.maxp.data[14] = 0; + tables.maxp.data[15] = 2; + } + font.pos += 4; + maxFunctionDefs = font.getUint16(); + } + + var dupFirstEntry = false; + if (properties.type === 'CIDFontType2' && properties.toUnicode && + properties.toUnicode.get(0) > '\u0000') { + // oracle's defect (see 3427), duplicating first entry + dupFirstEntry = true; + numGlyphs++; + tables.maxp.data[4] = numGlyphs >> 8; + tables.maxp.data[5] = numGlyphs & 255; + } + + var hintsValid = sanitizeTTPrograms(tables.fpgm, tables.prep, + tables['cvt '], maxFunctionDefs); + if (!hintsValid) { + delete tables.fpgm; + delete tables.prep; + delete tables['cvt ']; + } + + // Ensure the hmtx table contains the advance width and + // sidebearings information for numGlyphs in the maxp table + sanitizeMetrics(font, tables.hhea, tables.hmtx, numGlyphs); + + if (!tables.head) { + error('Required "head" table is not found'); + } + + sanitizeHead(tables.head, numGlyphs, isTrueType ? tables.loca.length : 0); + + var missingGlyphs = {}; + if (isTrueType) { + var isGlyphLocationsLong = int16(tables.head.data[50], + tables.head.data[51]); + missingGlyphs = sanitizeGlyphLocations(tables.loca, tables.glyf, + numGlyphs, isGlyphLocationsLong, + hintsValid, dupFirstEntry); + } + + if (!tables.hhea) { + error('Required "hhea" table is not found'); + } + + // Sanitizer reduces the glyph advanceWidth to the maxAdvanceWidth + // Sometimes it's 0. That needs to be fixed + if (tables.hhea.data[10] === 0 && tables.hhea.data[11] === 0) { + tables.hhea.data[10] = 0xFF; + tables.hhea.data[11] = 0xFF; + } + + // The 'post' table has glyphs names. + if (tables.post) { + var valid = readPostScriptTable(tables.post, properties, numGlyphs); + if (!valid) { + tables.post = null; + } + } + + var charCodeToGlyphId = [], charCode; + var toUnicode = properties.toUnicode, widths = properties.widths; + var skipToUnicode = (toUnicode instanceof IdentityToUnicodeMap || + toUnicode.length === 0x10000); + + // Helper function to try to skip mapping of empty glyphs. + // Note: In some cases, just relying on the glyph data doesn't work, + // hence we also use a few heuristics to fix various PDF files. + function hasGlyph(glyphId, charCode, widthCode) { + if (!missingGlyphs[glyphId]) { + return true; + } + if (!skipToUnicode && charCode >= 0 && toUnicode.has(charCode)) { + return true; + } + if (widths && widthCode >= 0 && isNum(widths[widthCode])) { + return true; + } + return false; + } + + if (properties.type === 'CIDFontType2') { + var cidToGidMap = properties.cidToGidMap || []; + var isCidToGidMapEmpty = cidToGidMap.length === 0; + + properties.cMap.forEach(function(charCode, cid) { + assert(cid <= 0xffff, 'Max size of CID is 65,535'); + var glyphId = -1; + if (isCidToGidMapEmpty) { + glyphId = charCode; + } else if (cidToGidMap[cid] !== undefined) { + glyphId = cidToGidMap[cid]; + } + + if (glyphId >= 0 && glyphId < numGlyphs && + hasGlyph(glyphId, charCode, cid)) { + charCodeToGlyphId[charCode] = glyphId; + } + }); + if (dupFirstEntry) { + charCodeToGlyphId[0] = numGlyphs - 1; + } + } else { + // Most of the following logic in this code branch is based on the + // 9.6.6.4 of the PDF spec. + var hasEncoding = + properties.differences.length > 0 || !!properties.baseEncodingName; + var cmapTable = + readCmapTable(tables.cmap, font, this.isSymbolicFont, hasEncoding); + var cmapPlatformId = cmapTable.platformId; + var cmapEncodingId = cmapTable.encodingId; + var cmapMappings = cmapTable.mappings; + var cmapMappingsLength = cmapMappings.length; + + // The spec seems to imply that if the font is symbolic the encoding + // should be ignored, this doesn't appear to work for 'preistabelle.pdf' + // where the the font is symbolic and it has an encoding. + if (hasEncoding && + (cmapPlatformId === 3 && cmapEncodingId === 1 || + cmapPlatformId === 1 && cmapEncodingId === 0) || + (cmapPlatformId === -1 && cmapEncodingId === -1 && // Temporary hack + !!Encodings[properties.baseEncodingName])) { // Temporary hack + // When no preferred cmap table was found and |baseEncodingName| is + // one of the predefined encodings, we seem to obtain a better + // |charCodeToGlyphId| map from the code below (fixes bug 1057544). + // TODO: Note that this is a hack which should be removed as soon as + // we have proper support for more exotic cmap tables. + + var baseEncoding = []; + if (properties.baseEncodingName === 'MacRomanEncoding' || + properties.baseEncodingName === 'WinAnsiEncoding') { + baseEncoding = Encodings[properties.baseEncodingName]; + } + for (charCode = 0; charCode < 256; charCode++) { + var glyphName; + if (this.differences && charCode in this.differences) { + glyphName = this.differences[charCode]; + } else if (charCode in baseEncoding && + baseEncoding[charCode] !== '') { + glyphName = baseEncoding[charCode]; + } else { + glyphName = Encodings.StandardEncoding[charCode]; + } + if (!glyphName) { + continue; + } + var unicodeOrCharCode, isUnicode = false; + if (cmapPlatformId === 3 && cmapEncodingId === 1) { + unicodeOrCharCode = GlyphsUnicode[glyphName]; + isUnicode = true; + } else if (cmapPlatformId === 1 && cmapEncodingId === 0) { + // TODO: the encoding needs to be updated with mac os table. + unicodeOrCharCode = Encodings.MacRomanEncoding.indexOf(glyphName); + } + + var found = false; + for (i = 0; i < cmapMappingsLength; ++i) { + if (cmapMappings[i].charCode !== unicodeOrCharCode) { + continue; + } + var code = isUnicode ? charCode : unicodeOrCharCode; + if (hasGlyph(cmapMappings[i].glyphId, code, -1)) { + charCodeToGlyphId[charCode] = cmapMappings[i].glyphId; + found = true; + break; + } + } + if (!found && properties.glyphNames) { + // Try to map using the post table. + var glyphId = properties.glyphNames.indexOf(glyphName); + if (glyphId > 0 && hasGlyph(glyphId, -1, -1)) { + charCodeToGlyphId[charCode] = glyphId; + } else { + charCodeToGlyphId[charCode] = 0; // notdef + } + } + } + } else if (cmapPlatformId === 0 && cmapEncodingId === 0) { + // Default Unicode semantics, use the charcodes as is. + for (i = 0; i < cmapMappingsLength; ++i) { + charCodeToGlyphId[cmapMappings[i].charCode] = + cmapMappings[i].glyphId; + } + } else { + // For (3, 0) cmap tables: + // The charcode key being stored in charCodeToGlyphId is the lower + // byte of the two-byte charcodes of the cmap table since according to + // the spec: 'each byte from the string shall be prepended with the + // high byte of the range [of charcodes in the cmap table], to form + // a two-byte character, which shall be used to select the + // associated glyph description from the subtable'. + // + // For (1, 0) cmap tables: + // 'single bytes from the string shall be used to look up the + // associated glyph descriptions from the subtable'. This means + // charcodes in the cmap will be single bytes, so no-op since + // glyph.charCode & 0xFF === glyph.charCode + for (i = 0; i < cmapMappingsLength; ++i) { + charCode = cmapMappings[i].charCode & 0xFF; + charCodeToGlyphId[charCode] = cmapMappings[i].glyphId; + } + } + } + + if (charCodeToGlyphId.length === 0) { + // defines at least one glyph + charCodeToGlyphId[0] = 0; + } + + // Converting glyphs and ids into font's cmap table + var newMapping = adjustMapping(charCodeToGlyphId, properties); + this.toFontChar = newMapping.toFontChar; + tables.cmap = { + tag: 'cmap', + data: createCmapTable(newMapping.charCodeToGlyphId) + }; + + if (!tables['OS/2'] || !validateOS2Table(tables['OS/2'])) { + // extract some more font properties from the OpenType head and + // hhea tables; yMin and descent value are always negative + var override = { + unitsPerEm: int16(tables.head.data[18], tables.head.data[19]), + yMax: int16(tables.head.data[42], tables.head.data[43]), + yMin: int16(tables.head.data[38], tables.head.data[39]) - 0x10000, + ascent: int16(tables.hhea.data[4], tables.hhea.data[5]), + descent: int16(tables.hhea.data[6], tables.hhea.data[7]) - 0x10000 + }; + + tables['OS/2'] = { + tag: 'OS/2', + data: createOS2Table(properties, newMapping.charCodeToGlyphId, + override) + }; + } + + // Rewrite the 'post' table if needed + if (!tables.post) { + tables.post = { + tag: 'post', + data: createPostTable(properties) + }; + } + + if (!isTrueType) { + try { + // Trying to repair CFF file + cffFile = new Stream(tables['CFF '].data); + var parser = new CFFParser(cffFile, properties); + cff = parser.parse(); + var compiler = new CFFCompiler(cff); + tables['CFF '].data = compiler.compile(); + } catch (e) { + warn('Failed to compile font ' + properties.loadedName); + } + } + + // Re-creating 'name' table + if (!tables.name) { + tables.name = { + tag: 'name', + data: createNameTable(this.name) + }; + } else { + // ... using existing 'name' table as prototype + var namePrototype = readNameTable(tables.name); + tables.name.data = createNameTable(name, namePrototype); + } + + var builder = new OpenTypeFileBuilder(header.version); + for (var tableTag in tables) { + builder.addTable(tableTag, tables[tableTag].data); + } + return builder.toArray(); + }, + + convert: function Font_convert(fontName, font, properties) { + // TODO: Check the charstring widths to determine this. + properties.fixedPitch = false; + + var mapping = font.getGlyphMapping(properties); + var newMapping = adjustMapping(mapping, properties); + this.toFontChar = newMapping.toFontChar; + var numGlyphs = font.numGlyphs; + + function getCharCodes(charCodeToGlyphId, glyphId) { + var charCodes = null; + for (var charCode in charCodeToGlyphId) { + if (glyphId === charCodeToGlyphId[charCode]) { + if (!charCodes) { + charCodes = []; + } + charCodes.push(charCode | 0); + } + } + return charCodes; + } + + function createCharCode(charCodeToGlyphId, glyphId) { + for (var charCode in charCodeToGlyphId) { + if (glyphId === charCodeToGlyphId[charCode]) { + return charCode | 0; + } + } + newMapping.charCodeToGlyphId[newMapping.nextAvailableFontCharCode] = + glyphId; + return newMapping.nextAvailableFontCharCode++; + } + + var seacs = font.seacs; + if (SEAC_ANALYSIS_ENABLED && seacs && seacs.length) { + var matrix = properties.fontMatrix || FONT_IDENTITY_MATRIX; + var charset = font.getCharset(); + var seacMap = Object.create(null); + for (var glyphId in seacs) { + glyphId |= 0; + var seac = seacs[glyphId]; + var baseGlyphName = Encodings.StandardEncoding[seac[2]]; + var accentGlyphName = Encodings.StandardEncoding[seac[3]]; + var baseGlyphId = charset.indexOf(baseGlyphName); + var accentGlyphId = charset.indexOf(accentGlyphName); + if (baseGlyphId < 0 || accentGlyphId < 0) { + continue; + } + var accentOffset = { + x: seac[0] * matrix[0] + seac[1] * matrix[2] + matrix[4], + y: seac[0] * matrix[1] + seac[1] * matrix[3] + matrix[5] + }; + + var charCodes = getCharCodes(mapping, glyphId); + if (!charCodes) { + // There's no point in mapping it if the char code was never mapped + // to begin with. + continue; + } + for (var i = 0, ii = charCodes.length; i < ii; i++) { + var charCode = charCodes[i]; + // Find a fontCharCode that maps to the base and accent glyphs. + // If one doesn't exists, create it. + var charCodeToGlyphId = newMapping.charCodeToGlyphId; + var baseFontCharCode = createCharCode(charCodeToGlyphId, + baseGlyphId); + var accentFontCharCode = createCharCode(charCodeToGlyphId, + accentGlyphId); + seacMap[charCode] = { + baseFontCharCode: baseFontCharCode, + accentFontCharCode: accentFontCharCode, + accentOffset: accentOffset + }; + } + } + properties.seacMap = seacMap; + } + + var unitsPerEm = 1 / (properties.fontMatrix || FONT_IDENTITY_MATRIX)[0]; + + var builder = new OpenTypeFileBuilder('\x4F\x54\x54\x4F'); + // PostScript Font Program + builder.addTable('CFF ', font.data); + // OS/2 and Windows Specific metrics + builder.addTable('OS/2', createOS2Table(properties, + newMapping.charCodeToGlyphId)); + // Character to glyphs mapping + builder.addTable('cmap', createCmapTable(newMapping.charCodeToGlyphId)); + // Font header + builder.addTable('head', + '\x00\x01\x00\x00' + // Version number + '\x00\x00\x10\x00' + // fontRevision + '\x00\x00\x00\x00' + // checksumAdjustement + '\x5F\x0F\x3C\xF5' + // magicNumber + '\x00\x00' + // Flags + safeString16(unitsPerEm) + // unitsPerEM + '\x00\x00\x00\x00\x9e\x0b\x7e\x27' + // creation date + '\x00\x00\x00\x00\x9e\x0b\x7e\x27' + // modifification date + '\x00\x00' + // xMin + safeString16(properties.descent) + // yMin + '\x0F\xFF' + // xMax + safeString16(properties.ascent) + // yMax + string16(properties.italicAngle ? 2 : 0) + // macStyle + '\x00\x11' + // lowestRecPPEM + '\x00\x00' + // fontDirectionHint + '\x00\x00' + // indexToLocFormat + '\x00\x00'); // glyphDataFormat + + // Horizontal header + builder.addTable('hhea', + '\x00\x01\x00\x00' + // Version number + safeString16(properties.ascent) + // Typographic Ascent + safeString16(properties.descent) + // Typographic Descent + '\x00\x00' + // Line Gap + '\xFF\xFF' + // advanceWidthMax + '\x00\x00' + // minLeftSidebearing + '\x00\x00' + // minRightSidebearing + '\x00\x00' + // xMaxExtent + safeString16(properties.capHeight) + // caretSlopeRise + safeString16(Math.tan(properties.italicAngle) * + properties.xHeight) + // caretSlopeRun + '\x00\x00' + // caretOffset + '\x00\x00' + // -reserved- + '\x00\x00' + // -reserved- + '\x00\x00' + // -reserved- + '\x00\x00' + // -reserved- + '\x00\x00' + // metricDataFormat + string16(numGlyphs)); // Number of HMetrics + + // Horizontal metrics + builder.addTable('hmtx', (function fontFieldsHmtx() { + var charstrings = font.charstrings; + var cffWidths = font.cff ? font.cff.widths : null; + var hmtx = '\x00\x00\x00\x00'; // Fake .notdef + for (var i = 1, ii = numGlyphs; i < ii; i++) { + var width = 0; + if (charstrings) { + var charstring = charstrings[i - 1]; + width = 'width' in charstring ? charstring.width : 0; + } else if (cffWidths) { + width = Math.ceil(cffWidths[i] || 0); + } + hmtx += string16(width) + string16(0); + } + return hmtx; + })()); + + // Maximum profile + builder.addTable('maxp', + '\x00\x00\x50\x00' + // Version number + string16(numGlyphs)); // Num of glyphs + + // Naming tables + builder.addTable('name', createNameTable(fontName)); + + // PostScript informations + builder.addTable('post', createPostTable(properties)); + + return builder.toArray(); + }, + + /** + * Builds a char code to unicode map based on section 9.10 of the spec. + * @param {Object} properties Font properties object. + * @return {Object} A ToUnicodeMap object. + */ + buildToUnicode: function Font_buildToUnicode(properties) { + // Section 9.10.2 Mapping Character Codes to Unicode Values + if (properties.toUnicode && properties.toUnicode.length !== 0) { + return properties.toUnicode; + } + // According to the spec if the font is a simple font we should only map + // to unicode if the base encoding is MacRoman, MacExpert, or WinAnsi or + // the differences array only contains adobe standard or symbol set names, + // in pratice it seems better to always try to create a toUnicode + // map based of the default encoding. + var toUnicode, charcode; + if (!properties.composite /* is simple font */) { + toUnicode = []; + var encoding = properties.defaultEncoding.slice(); + var baseEncodingName = properties.baseEncodingName; + // Merge in the differences array. + var differences = properties.differences; + for (charcode in differences) { + encoding[charcode] = differences[charcode]; + } + for (charcode in encoding) { + // a) Map the character code to a character name. + var glyphName = encoding[charcode]; + // b) Look up the character name in the Adobe Glyph List (see the + // Bibliography) to obtain the corresponding Unicode value. + if (glyphName === '') { + continue; + } else if (GlyphsUnicode[glyphName] === undefined) { + // (undocumented) c) Few heuristics to recognize unknown glyphs + // NOTE: Adobe Reader does not do this step, but OSX Preview does + var code = 0; + switch (glyphName[0]) { + case 'G': // Gxx glyph + if (glyphName.length === 3) { + code = parseInt(glyphName.substr(1), 16); + } + break; + case 'g': // g00xx glyph + if (glyphName.length === 5) { + code = parseInt(glyphName.substr(1), 16); + } + break; + case 'C': // Cddd glyph + case 'c': // cddd glyph + if (glyphName.length >= 3) { + code = +glyphName.substr(1); + } + break; + } + if (code) { + // If |baseEncodingName| is one the predefined encodings, + // and |code| equals |charcode|, using the glyph defined in the + // baseEncoding seems to yield a better |toUnicode| mapping + // (fixes issue 5070). + if (baseEncodingName && code === +charcode) { + var baseEncoding = Encodings[baseEncodingName]; + if (baseEncoding && (glyphName = baseEncoding[charcode])) { + toUnicode[charcode] = + String.fromCharCode(GlyphsUnicode[glyphName]); + continue; + } + } + toUnicode[charcode] = String.fromCharCode(code); + } + continue; + } + toUnicode[charcode] = String.fromCharCode(GlyphsUnicode[glyphName]); + } + return new ToUnicodeMap(toUnicode); + } + // If the font is a composite font that uses one of the predefined CMaps + // listed in Table 118 (except Identity–H and Identity–V) or whose + // descendant CIDFont uses the Adobe-GB1, Adobe-CNS1, Adobe-Japan1, or + // Adobe-Korea1 character collection: + if (properties.composite && ( + (properties.cMap.builtInCMap && + !(properties.cMap instanceof IdentityCMap)) || + (properties.cidSystemInfo.registry === 'Adobe' && + (properties.cidSystemInfo.ordering === 'GB1' || + properties.cidSystemInfo.ordering === 'CNS1' || + properties.cidSystemInfo.ordering === 'Japan1' || + properties.cidSystemInfo.ordering === 'Korea1')))) { + // Then: + // a) Map the character code to a character identifier (CID) according + // to the font’s CMap. + // b) Obtain the registry and ordering of the character collection used + // by the font’s CMap (for example, Adobe and Japan1) from its + // CIDSystemInfo dictionary. + var registry = properties.cidSystemInfo.registry; + var ordering = properties.cidSystemInfo.ordering; + // c) Construct a second CMap name by concatenating the registry and + // ordering obtained in step (b) in the format registry–ordering–UCS2 + // (for example, Adobe–Japan1–UCS2). + var ucs2CMapName = new Name(registry + '-' + ordering + '-UCS2'); + // d) Obtain the CMap with the name constructed in step (c) (available + // from the ASN Web site; see the Bibliography). + var ucs2CMap = CMapFactory.create(ucs2CMapName, + { url: PDFJS.cMapUrl, packed: PDFJS.cMapPacked }, null); + var cMap = properties.cMap; + toUnicode = []; + cMap.forEach(function(charcode, cid) { + assert(cid <= 0xffff, 'Max size of CID is 65,535'); + // e) Map the CID obtained in step (a) according to the CMap obtained + // in step (d), producing a Unicode value. + var ucs2 = ucs2CMap.lookup(cid); + if (ucs2) { + toUnicode[charcode] = + String.fromCharCode((ucs2.charCodeAt(0) << 8) + + ucs2.charCodeAt(1)); + } + }); + return new ToUnicodeMap(toUnicode); + } + + // The viewer's choice, just use an identity map. + return new IdentityToUnicodeMap(properties.firstChar, + properties.lastChar); + }, + + get spaceWidth() { + if ('_shadowWidth' in this) { + return this._shadowWidth; + } + + // trying to estimate space character width + var possibleSpaceReplacements = ['space', 'minus', 'one', 'i']; + var width; + for (var i = 0, ii = possibleSpaceReplacements.length; i < ii; i++) { + var glyphName = possibleSpaceReplacements[i]; + // if possible, getting width by glyph name + if (glyphName in this.widths) { + width = this.widths[glyphName]; + break; + } + var glyphUnicode = GlyphsUnicode[glyphName]; + // finding the charcode via unicodeToCID map + var charcode = 0; + if (this.composite) { + if (this.cMap.contains(glyphUnicode)) { + charcode = this.cMap.lookup(glyphUnicode); + } + } + // ... via toUnicode map + if (!charcode && 'toUnicode' in this) { + charcode = this.toUnicode.charCodeOf(glyphUnicode); + } + // setting it to unicode if negative or undefined + if (charcode <= 0) { + charcode = glyphUnicode; + } + // trying to get width via charcode + width = this.widths[charcode]; + if (width) { + break; // the non-zero width found + } + } + width = width || this.defaultWidth; + // Do not shadow the property here. See discussion: + // https://github.com/mozilla/pdf.js/pull/2127#discussion_r1662280 + this._shadowWidth = width; + return width; + }, + + charToGlyph: function Font_charToGlyph(charcode) { + var fontCharCode, width, operatorListId; + + var widthCode = charcode; + if (this.cMap && this.cMap.contains(charcode)) { + widthCode = this.cMap.lookup(charcode); + } + width = this.widths[widthCode]; + width = isNum(width) ? width : this.defaultWidth; + var vmetric = this.vmetrics && this.vmetrics[widthCode]; + + var unicode = this.toUnicode.get(charcode) || charcode; + if (typeof unicode === 'number') { + unicode = String.fromCharCode(unicode); + } + + // First try the toFontChar map, if it's not there then try falling + // back to the char code. + fontCharCode = this.toFontChar[charcode] || charcode; + if (this.missingFile) { + fontCharCode = mapSpecialUnicodeValues(fontCharCode); + } + + if (this.isType3Font) { + // Font char code in this case is actually a glyph name. + operatorListId = fontCharCode; + } + + var accent = null; + if (this.seacMap && this.seacMap[charcode]) { + var seac = this.seacMap[charcode]; + fontCharCode = seac.baseFontCharCode; + accent = { + fontChar: String.fromCharCode(seac.accentFontCharCode), + offset: seac.accentOffset + }; + } + + var fontChar = String.fromCharCode(fontCharCode); + + var glyph = this.glyphCache[charcode]; + if (!glyph || + !glyph.matchesForCache(fontChar, unicode, accent, width, vmetric, + operatorListId)) { + glyph = new Glyph(fontChar, unicode, accent, width, vmetric, + operatorListId); + this.glyphCache[charcode] = glyph; + } + return glyph; + }, + + charsToGlyphs: function Font_charsToGlyphs(chars) { + var charsCache = this.charsCache; + var glyphs, glyph, charcode; + + // if we translated this string before, just grab it from the cache + if (charsCache) { + glyphs = charsCache[chars]; + if (glyphs) { + return glyphs; + } + } + + // lazily create the translation cache + if (!charsCache) { + charsCache = this.charsCache = Object.create(null); + } + + glyphs = []; + var charsCacheKey = chars; + var i = 0, ii; + + if (this.cMap) { + // composite fonts have multi-byte strings convert the string from + // single-byte to multi-byte + var c = {}; + while (i < chars.length) { + this.cMap.readCharCode(chars, i, c); + charcode = c.charcode; + var length = c.length; + i += length; + glyph = this.charToGlyph(charcode); + glyphs.push(glyph); + // placing null after each word break charcode (ASCII SPACE) + // Ignore occurences of 0x20 in multiple-byte codes. + if (length === 1 && chars.charCodeAt(i - 1) === 0x20) { + glyphs.push(null); + } + } + } else { + for (i = 0, ii = chars.length; i < ii; ++i) { + charcode = chars.charCodeAt(i); + glyph = this.charToGlyph(charcode); + glyphs.push(glyph); + if (charcode === 0x20) { + glyphs.push(null); + } + } + } + + // Enter the translated string into the cache + return (charsCache[charsCacheKey] = glyphs); + } + }; + + return Font; +})(); + +var ErrorFont = (function ErrorFontClosure() { + function ErrorFont(error) { + this.error = error; + this.loadedName = 'g_font_error'; + this.loading = false; + } + + ErrorFont.prototype = { + charsToGlyphs: function ErrorFont_charsToGlyphs() { + return []; + }, + exportData: function ErrorFont_exportData() { + return {error: this.error}; + } + }; + + return ErrorFont; +})(); + +/** + * Shared logic for building a char code to glyph id mapping for Type1 and + * simple CFF fonts. See section 9.6.6.2 of the spec. + * @param {Object} properties Font properties object. + * @param {Object} builtInEncoding The encoding contained within the actual font + * data. + * @param {Array} Array of glyph names where the index is the glyph ID. + * @returns {Object} A char code to glyph ID map. + */ +function type1FontGlyphMapping(properties, builtInEncoding, glyphNames) { + var charCodeToGlyphId = Object.create(null); + var glyphId, charCode, baseEncoding; + + if (properties.baseEncodingName) { + // If a valid base encoding name was used, the mapping is initialized with + // that. + baseEncoding = Encodings[properties.baseEncodingName]; + for (charCode = 0; charCode < baseEncoding.length; charCode++) { + glyphId = glyphNames.indexOf(baseEncoding[charCode]); + if (glyphId >= 0) { + charCodeToGlyphId[charCode] = glyphId; + } else { + charCodeToGlyphId[charCode] = 0; // notdef + } + } + } else if (!!(properties.flags & FontFlags.Symbolic)) { + // For a symbolic font the encoding should be the fonts built-in + // encoding. + for (charCode in builtInEncoding) { + charCodeToGlyphId[charCode] = builtInEncoding[charCode]; + } + } else { + // For non-symbolic fonts that don't have a base encoding the standard + // encoding should be used. + baseEncoding = Encodings.StandardEncoding; + for (charCode = 0; charCode < baseEncoding.length; charCode++) { + glyphId = glyphNames.indexOf(baseEncoding[charCode]); + if (glyphId >= 0) { + charCodeToGlyphId[charCode] = glyphId; + } else { + charCodeToGlyphId[charCode] = 0; // notdef + } + } + } + + // Lastly, merge in the differences. + var differences = properties.differences; + if (differences) { + for (charCode in differences) { + var glyphName = differences[charCode]; + glyphId = glyphNames.indexOf(glyphName); + if (glyphId >= 0) { + charCodeToGlyphId[charCode] = glyphId; + } else { + charCodeToGlyphId[charCode] = 0; // notdef + } + } + } + return charCodeToGlyphId; +} + +/* + * CharStrings are encoded following the the CharString Encoding sequence + * describe in Chapter 6 of the "Adobe Type1 Font Format" specification. + * The value in a byte indicates a command, a number, or subsequent bytes + * that are to be interpreted in a special way. + * + * CharString Number Encoding: + * A CharString byte containing the values from 32 through 255 inclusive + * indicate an integer. These values are decoded in four ranges. + * + * 1. A CharString byte containing a value, v, between 32 and 246 inclusive, + * indicate the integer v - 139. Thus, the integer values from -107 through + * 107 inclusive may be encoded in single byte. + * + * 2. A CharString byte containing a value, v, between 247 and 250 inclusive, + * indicates an integer involving the next byte, w, according to the formula: + * [(v - 247) x 256] + w + 108 + * + * 3. A CharString byte containing a value, v, between 251 and 254 inclusive, + * indicates an integer involving the next byte, w, according to the formula: + * -[(v - 251) * 256] - w - 108 + * + * 4. A CharString containing the value 255 indicates that the next 4 bytes + * are a two complement signed integer. The first of these bytes contains the + * highest order bits, the second byte contains the next higher order bits + * and the fourth byte contain the lowest order bits. + * + * + * CharString Command Encoding: + * CharStrings commands are encoded in 1 or 2 bytes. + * + * Single byte commands are encoded in 1 byte that contains a value between + * 0 and 31 inclusive. + * If a command byte contains the value 12, then the value in the next byte + * indicates a command. This "escape" mechanism allows many extra commands + * to be encoded and this encoding technique helps to minimize the length of + * the charStrings. + */ +var Type1CharString = (function Type1CharStringClosure() { + var COMMAND_MAP = { + 'hstem': [1], + 'vstem': [3], + 'vmoveto': [4], + 'rlineto': [5], + 'hlineto': [6], + 'vlineto': [7], + 'rrcurveto': [8], + 'callsubr': [10], + 'flex': [12, 35], + 'drop' : [12, 18], + 'endchar': [14], + 'rmoveto': [21], + 'hmoveto': [22], + 'vhcurveto': [30], + 'hvcurveto': [31] + }; + + function Type1CharString() { + this.width = 0; + this.lsb = 0; + this.flexing = false; + this.output = []; + this.stack = []; + } + + Type1CharString.prototype = { + convert: function Type1CharString_convert(encoded, subrs) { + var count = encoded.length; + var error = false; + var wx, sbx, subrNumber; + for (var i = 0; i < count; i++) { + var value = encoded[i]; + if (value < 32) { + if (value === 12) { + value = (value << 8) + encoded[++i]; + } + switch (value) { + case 1: // hstem + if (!HINTING_ENABLED) { + this.stack = []; + break; + } + error = this.executeCommand(2, COMMAND_MAP.hstem); + break; + case 3: // vstem + if (!HINTING_ENABLED) { + this.stack = []; + break; + } + error = this.executeCommand(2, COMMAND_MAP.vstem); + break; + case 4: // vmoveto + if (this.flexing) { + if (this.stack.length < 1) { + error = true; + break; + } + // Add the dx for flex and but also swap the values so they are + // the right order. + var dy = this.stack.pop(); + this.stack.push(0, dy); + break; + } + error = this.executeCommand(1, COMMAND_MAP.vmoveto); + break; + case 5: // rlineto + error = this.executeCommand(2, COMMAND_MAP.rlineto); + break; + case 6: // hlineto + error = this.executeCommand(1, COMMAND_MAP.hlineto); + break; + case 7: // vlineto + error = this.executeCommand(1, COMMAND_MAP.vlineto); + break; + case 8: // rrcurveto + error = this.executeCommand(6, COMMAND_MAP.rrcurveto); + break; + case 9: // closepath + // closepath is a Type1 command that does not take argument and is + // useless in Type2 and it can simply be ignored. + this.stack = []; + break; + case 10: // callsubr + if (this.stack.length < 1) { + error = true; + break; + } + subrNumber = this.stack.pop(); + error = this.convert(subrs[subrNumber], subrs); + break; + case 11: // return + return error; + case 13: // hsbw + if (this.stack.length < 2) { + error = true; + break; + } + // To convert to type2 we have to move the width value to the + // first part of the charstring and then use hmoveto with lsb. + wx = this.stack.pop(); + sbx = this.stack.pop(); + this.lsb = sbx; + this.width = wx; + this.stack.push(wx, sbx); + error = this.executeCommand(2, COMMAND_MAP.hmoveto); + break; + case 14: // endchar + this.output.push(COMMAND_MAP.endchar[0]); + break; + case 21: // rmoveto + if (this.flexing) { + break; + } + error = this.executeCommand(2, COMMAND_MAP.rmoveto); + break; + case 22: // hmoveto + if (this.flexing) { + // Add the dy for flex. + this.stack.push(0); + break; + } + error = this.executeCommand(1, COMMAND_MAP.hmoveto); + break; + case 30: // vhcurveto + error = this.executeCommand(4, COMMAND_MAP.vhcurveto); + break; + case 31: // hvcurveto + error = this.executeCommand(4, COMMAND_MAP.hvcurveto); + break; + case (12 << 8) + 0: // dotsection + // dotsection is a Type1 command to specify some hinting feature + // for dots that do not take a parameter and it can safely be + // ignored for Type2. + this.stack = []; + break; + case (12 << 8) + 1: // vstem3 + if (!HINTING_ENABLED) { + this.stack = []; + break; + } + // [vh]stem3 are Type1 only and Type2 supports [vh]stem with + // multiple parameters, so instead of returning [vh]stem3 take a + // shortcut and return [vhstem] instead. + error = this.executeCommand(2, COMMAND_MAP.vstem); + break; + case (12 << 8) + 2: // hstem3 + if (!HINTING_ENABLED) { + this.stack = []; + break; + } + // See vstem3. + error = this.executeCommand(2, COMMAND_MAP.hstem); + break; + case (12 << 8) + 6: // seac + // seac is like type 2's special endchar but it doesn't use the + // first argument asb, so remove it. + if (SEAC_ANALYSIS_ENABLED) { + this.seac = this.stack.splice(-4, 4); + error = this.executeCommand(0, COMMAND_MAP.endchar); + } else { + error = this.executeCommand(4, COMMAND_MAP.endchar); + } + break; + case (12 << 8) + 7: // sbw + if (this.stack.length < 4) { + error = true; + break; + } + // To convert to type2 we have to move the width value to the + // first part of the charstring and then use rmoveto with + // (dx, dy). The height argument will not be used for vmtx and + // vhea tables reconstruction -- ignoring it. + var wy = this.stack.pop(); + wx = this.stack.pop(); + var sby = this.stack.pop(); + sbx = this.stack.pop(); + this.lsb = sbx; + this.width = wx; + this.stack.push(wx, sbx, sby); + error = this.executeCommand(3, COMMAND_MAP.rmoveto); + break; + case (12 << 8) + 12: // div + if (this.stack.length < 2) { + error = true; + break; + } + var num2 = this.stack.pop(); + var num1 = this.stack.pop(); + this.stack.push(num1 / num2); + break; + case (12 << 8) + 16: // callothersubr + if (this.stack.length < 2) { + error = true; + break; + } + subrNumber = this.stack.pop(); + var numArgs = this.stack.pop(); + if (subrNumber === 0 && numArgs === 3) { + var flexArgs = this.stack.splice(this.stack.length - 17, 17); + this.stack.push( + flexArgs[2] + flexArgs[0], // bcp1x + rpx + flexArgs[3] + flexArgs[1], // bcp1y + rpy + flexArgs[4], // bcp2x + flexArgs[5], // bcp2y + flexArgs[6], // p2x + flexArgs[7], // p2y + flexArgs[8], // bcp3x + flexArgs[9], // bcp3y + flexArgs[10], // bcp4x + flexArgs[11], // bcp4y + flexArgs[12], // p3x + flexArgs[13], // p3y + flexArgs[14] // flexDepth + // 15 = finalx unused by flex + // 16 = finaly unused by flex + ); + error = this.executeCommand(13, COMMAND_MAP.flex, true); + this.flexing = false; + this.stack.push(flexArgs[15], flexArgs[16]); + } else if (subrNumber === 1 && numArgs === 0) { + this.flexing = true; + } + break; + case (12 << 8) + 17: // pop + // Ignore this since it is only used with othersubr. + break; + case (12 << 8) + 33: // setcurrentpoint + // Ignore for now. + this.stack = []; + break; + default: + warn('Unknown type 1 charstring command of "' + value + '"'); + break; + } + if (error) { + break; + } + continue; + } else if (value <= 246) { + value = value - 139; + } else if (value <= 250) { + value = ((value - 247) * 256) + encoded[++i] + 108; + } else if (value <= 254) { + value = -((value - 251) * 256) - encoded[++i] - 108; + } else { + value = (encoded[++i] & 0xff) << 24 | (encoded[++i] & 0xff) << 16 | + (encoded[++i] & 0xff) << 8 | (encoded[++i] & 0xff) << 0; + } + this.stack.push(value); + } + return error; + }, + + executeCommand: function(howManyArgs, command, keepStack) { + var stackLength = this.stack.length; + if (howManyArgs > stackLength) { + return true; + } + var start = stackLength - howManyArgs; + for (var i = start; i < stackLength; i++) { + var value = this.stack[i]; + if (value === (value | 0)) { // int + this.output.push(28, (value >> 8) & 0xff, value & 0xff); + } else { // fixed point + value = (65536 * value) | 0; + this.output.push(255, + (value >> 24) & 0xFF, + (value >> 16) & 0xFF, + (value >> 8) & 0xFF, + value & 0xFF); + } + } + this.output.push.apply(this.output, command); + if (keepStack) { + this.stack.splice(start, howManyArgs); + } else { + this.stack.length = 0; + } + return false; + } + }; + + return Type1CharString; +})(); + +/* + * Type1Parser encapsulate the needed code for parsing a Type1 font + * program. Some of its logic depends on the Type2 charstrings + * structure. + * Note: this doesn't really parse the font since that would require evaluation + * of PostScript, but it is possible in most cases to extract what we need + * without a full parse. + */ +var Type1Parser = (function Type1ParserClosure() { + /* + * Decrypt a Sequence of Ciphertext Bytes to Produce the Original Sequence + * of Plaintext Bytes. The function took a key as a parameter which can be + * for decrypting the eexec block of for decoding charStrings. + */ + var EEXEC_ENCRYPT_KEY = 55665; + var CHAR_STRS_ENCRYPT_KEY = 4330; + + function isHexDigit(code) { + return code >= 48 && code <= 57 || // '0'-'9' + code >= 65 && code <= 70 || // 'A'-'F' + code >= 97 && code <= 102; // 'a'-'f' + } + + function decrypt(data, key, discardNumber) { + var r = key | 0, c1 = 52845, c2 = 22719; + var count = data.length; + var decrypted = new Uint8Array(count); + for (var i = 0; i < count; i++) { + var value = data[i]; + decrypted[i] = value ^ (r >> 8); + r = ((value + r) * c1 + c2) & ((1 << 16) - 1); + } + return Array.prototype.slice.call(decrypted, discardNumber); + } + + function decryptAscii(data, key, discardNumber) { + var r = key | 0, c1 = 52845, c2 = 22719; + var count = data.length, maybeLength = count >>> 1; + var decrypted = new Uint8Array(maybeLength); + var i, j; + for (i = 0, j = 0; i < count; i++) { + var digit1 = data[i]; + if (!isHexDigit(digit1)) { + continue; + } + i++; + var digit2; + while (i < count && !isHexDigit(digit2 = data[i])) { + i++; + } + if (i < count) { + var value = parseInt(String.fromCharCode(digit1, digit2), 16); + decrypted[j++] = value ^ (r >> 8); + r = ((value + r) * c1 + c2) & ((1 << 16) - 1); + } + } + return Array.prototype.slice.call(decrypted, discardNumber, j); + } + + function isSpecial(c) { + return c === 0x2F || // '/' + c === 0x5B || c === 0x5D || // '[', ']' + c === 0x7B || c === 0x7D || // '{', '}' + c === 0x28 || c === 0x29; // '(', ')' + } + + function Type1Parser(stream, encrypted) { + if (encrypted) { + var data = stream.getBytes(); + var isBinary = !(isHexDigit(data[0]) && isHexDigit(data[1]) && + isHexDigit(data[2]) && isHexDigit(data[3])); + stream = new Stream(isBinary ? decrypt(data, EEXEC_ENCRYPT_KEY, 4) : + decryptAscii(data, EEXEC_ENCRYPT_KEY, 4)); + } + this.stream = stream; + this.nextChar(); + } + + Type1Parser.prototype = { + readNumberArray: function Type1Parser_readNumberArray() { + this.getToken(); // read '[' or '{' (arrays can start with either) + var array = []; + while (true) { + var token = this.getToken(); + if (token === null || token === ']' || token === '}') { + break; + } + array.push(parseFloat(token || 0)); + } + return array; + }, + + readNumber: function Type1Parser_readNumber() { + var token = this.getToken(); + return parseFloat(token || 0); + }, + + readInt: function Type1Parser_readInt() { + // Use '| 0' to prevent setting a double into length such as the double + // does not flow into the loop variable. + var token = this.getToken(); + return parseInt(token || 0, 10) | 0; + }, + + readBoolean: function Type1Parser_readBoolean() { + var token = this.getToken(); + + // Use 1 and 0 since that's what type2 charstrings use. + return token === 'true' ? 1 : 0; + }, + + nextChar : function Type1_nextChar() { + return (this.currentChar = this.stream.getByte()); + }, + + getToken: function Type1Parser_getToken() { + // Eat whitespace and comments. + var comment = false; + var ch = this.currentChar; + while (true) { + if (ch === -1) { + return null; + } + + if (comment) { + if (ch === 0x0A || ch === 0x0D) { + comment = false; + } + } else if (ch === 0x25) { // '%' + comment = true; + } else if (!Lexer.isSpace(ch)) { + break; + } + ch = this.nextChar(); + } + if (isSpecial(ch)) { + this.nextChar(); + return String.fromCharCode(ch); + } + var token = ''; + do { + token += String.fromCharCode(ch); + ch = this.nextChar(); + } while (ch >= 0 && !Lexer.isSpace(ch) && !isSpecial(ch)); + return token; + }, + + /* + * Returns an object containing a Subrs array and a CharStrings + * array extracted from and eexec encrypted block of data + */ + extractFontProgram: function Type1Parser_extractFontProgram() { + var stream = this.stream; + + var subrs = [], charstrings = []; + var program = { + subrs: [], + charstrings: [], + properties: { + 'privateData': { + 'lenIV': 4 + } + } + }; + var token, length, data, lenIV, encoded; + while ((token = this.getToken()) !== null) { + if (token !== '/') { + continue; + } + token = this.getToken(); + switch (token) { + case 'CharStrings': + // The number immediately following CharStrings must be greater or + // equal to the number of CharStrings. + this.getToken(); + this.getToken(); // read in 'dict' + this.getToken(); // read in 'dup' + this.getToken(); // read in 'begin' + while(true) { + token = this.getToken(); + if (token === null || token === 'end') { + break; + } + + if (token !== '/') { + continue; + } + var glyph = this.getToken(); + length = this.readInt(); + this.getToken(); // read in 'RD' or '-|' + data = stream.makeSubStream(stream.pos, length); + lenIV = program.properties.privateData['lenIV']; + encoded = decrypt(data.getBytes(), CHAR_STRS_ENCRYPT_KEY, lenIV); + // Skip past the required space and binary data. + stream.skip(length); + this.nextChar(); + token = this.getToken(); // read in 'ND' or '|-' + if (token === 'noaccess') { + this.getToken(); // read in 'def' + } + charstrings.push({ + glyph: glyph, + encoded: encoded + }); + } + break; + case 'Subrs': + var num = this.readInt(); + this.getToken(); // read in 'array' + while ((token = this.getToken()) === 'dup') { + var index = this.readInt(); + length = this.readInt(); + this.getToken(); // read in 'RD' or '-|' + data = stream.makeSubStream(stream.pos, length); + lenIV = program.properties.privateData['lenIV']; + encoded = decrypt(data.getBytes(), CHAR_STRS_ENCRYPT_KEY, lenIV); + // Skip past the required space and binary data. + stream.skip(length); + this.nextChar(); + token = this.getToken(); // read in 'NP' or '|' + if (token === 'noaccess') { + this.getToken(); // read in 'put' + } + subrs[index] = encoded; + } + break; + case 'BlueValues': + case 'OtherBlues': + case 'FamilyBlues': + case 'FamilyOtherBlues': + var blueArray = this.readNumberArray(); + // *Blue* values may contain invalid data: disables reading of + // those values when hinting is disabled. + if (blueArray.length > 0 && (blueArray.length % 2) === 0 && + HINTING_ENABLED) { + program.properties.privateData[token] = blueArray; + } + break; + case 'StemSnapH': + case 'StemSnapV': + program.properties.privateData[token] = this.readNumberArray(); + break; + case 'StdHW': + case 'StdVW': + program.properties.privateData[token] = + this.readNumberArray()[0]; + break; + case 'BlueShift': + case 'lenIV': + case 'BlueFuzz': + case 'BlueScale': + case 'LanguageGroup': + case 'ExpansionFactor': + program.properties.privateData[token] = this.readNumber(); + break; + case 'ForceBold': + program.properties.privateData[token] = this.readBoolean(); + break; + } + } + + for (var i = 0; i < charstrings.length; i++) { + glyph = charstrings[i].glyph; + encoded = charstrings[i].encoded; + var charString = new Type1CharString(); + var error = charString.convert(encoded, subrs); + var output = charString.output; + if (error) { + // It seems when FreeType encounters an error while evaluating a glyph + // that it completely ignores the glyph so we'll mimic that behaviour + // here and put an endchar to make the validator happy. + output = [14]; + } + program.charstrings.push({ + glyphName: glyph, + charstring: output, + width: charString.width, + lsb: charString.lsb, + seac: charString.seac + }); + } + + return program; + }, + + extractFontHeader: function Type1Parser_extractFontHeader(properties) { + var token; + while ((token = this.getToken()) !== null) { + if (token !== '/') { + continue; + } + token = this.getToken(); + switch (token) { + case 'FontMatrix': + var matrix = this.readNumberArray(); + properties.fontMatrix = matrix; + break; + case 'Encoding': + var encodingArg = this.getToken(); + var encoding; + if (!/^\d+$/.test(encodingArg)) { + // encoding name is specified + encoding = Encodings[encodingArg]; + } else { + encoding = []; + var size = parseInt(encodingArg, 10) | 0; + this.getToken(); // read in 'array' + + for (var j = 0; j < size; j++) { + token = this.getToken(); + // skipping till first dup or def (e.g. ignoring for statement) + while (token !== 'dup' && token !== 'def') { + token = this.getToken(); + if (token === null) { + return; // invalid header + } + } + if (token === 'def') { + break; // read all array data + } + var index = this.readInt(); + this.getToken(); // read in '/' + var glyph = this.getToken(); + encoding[index] = glyph; + this.getToken(); // read the in 'put' + } + } + properties.builtInEncoding = encoding; + break; + case 'FontBBox': + var fontBBox = this.readNumberArray(); + // adjusting ascent/descent + properties.ascent = fontBBox[3]; + properties.descent = fontBBox[1]; + properties.ascentScaled = true; + break; + } + } + } + }; + + return Type1Parser; +})(); + +/** + * The CFF class takes a Type1 file and wrap it into a + * 'Compact Font Format' which itself embed Type2 charstrings. + */ +var CFFStandardStrings = [ + '.notdef', 'space', 'exclam', 'quotedbl', 'numbersign', 'dollar', 'percent', + 'ampersand', 'quoteright', 'parenleft', 'parenright', 'asterisk', 'plus', + 'comma', 'hyphen', 'period', 'slash', 'zero', 'one', 'two', 'three', 'four', + 'five', 'six', 'seven', 'eight', 'nine', 'colon', 'semicolon', 'less', + 'equal', 'greater', 'question', 'at', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', + 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', + 'X', 'Y', 'Z', 'bracketleft', 'backslash', 'bracketright', 'asciicircum', + 'underscore', 'quoteleft', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', + 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', + 'z', 'braceleft', 'bar', 'braceright', 'asciitilde', 'exclamdown', 'cent', + 'sterling', 'fraction', 'yen', 'florin', 'section', 'currency', + 'quotesingle', 'quotedblleft', 'guillemotleft', 'guilsinglleft', + 'guilsinglright', 'fi', 'fl', 'endash', 'dagger', 'daggerdbl', + 'periodcentered', 'paragraph', 'bullet', 'quotesinglbase', 'quotedblbase', + 'quotedblright', 'guillemotright', 'ellipsis', 'perthousand', 'questiondown', + 'grave', 'acute', 'circumflex', 'tilde', 'macron', 'breve', 'dotaccent', + 'dieresis', 'ring', 'cedilla', 'hungarumlaut', 'ogonek', 'caron', 'emdash', + 'AE', 'ordfeminine', 'Lslash', 'Oslash', 'OE', 'ordmasculine', 'ae', + 'dotlessi', 'lslash', 'oslash', 'oe', 'germandbls', 'onesuperior', + 'logicalnot', 'mu', 'trademark', 'Eth', 'onehalf', 'plusminus', 'Thorn', + 'onequarter', 'divide', 'brokenbar', 'degree', 'thorn', 'threequarters', + 'twosuperior', 'registered', 'minus', 'eth', 'multiply', 'threesuperior', + 'copyright', 'Aacute', 'Acircumflex', 'Adieresis', 'Agrave', 'Aring', + 'Atilde', 'Ccedilla', 'Eacute', 'Ecircumflex', 'Edieresis', 'Egrave', + 'Iacute', 'Icircumflex', 'Idieresis', 'Igrave', 'Ntilde', 'Oacute', + 'Ocircumflex', 'Odieresis', 'Ograve', 'Otilde', 'Scaron', 'Uacute', + 'Ucircumflex', 'Udieresis', 'Ugrave', 'Yacute', 'Ydieresis', 'Zcaron', + 'aacute', 'acircumflex', 'adieresis', 'agrave', 'aring', 'atilde', + 'ccedilla', 'eacute', 'ecircumflex', 'edieresis', 'egrave', 'iacute', + 'icircumflex', 'idieresis', 'igrave', 'ntilde', 'oacute', 'ocircumflex', + 'odieresis', 'ograve', 'otilde', 'scaron', 'uacute', 'ucircumflex', + 'udieresis', 'ugrave', 'yacute', 'ydieresis', 'zcaron', 'exclamsmall', + 'Hungarumlautsmall', 'dollaroldstyle', 'dollarsuperior', 'ampersandsmall', + 'Acutesmall', 'parenleftsuperior', 'parenrightsuperior', 'twodotenleader', + 'onedotenleader', 'zerooldstyle', 'oneoldstyle', 'twooldstyle', + 'threeoldstyle', 'fouroldstyle', 'fiveoldstyle', 'sixoldstyle', + 'sevenoldstyle', 'eightoldstyle', 'nineoldstyle', 'commasuperior', + 'threequartersemdash', 'periodsuperior', 'questionsmall', 'asuperior', + 'bsuperior', 'centsuperior', 'dsuperior', 'esuperior', 'isuperior', + 'lsuperior', 'msuperior', 'nsuperior', 'osuperior', 'rsuperior', 'ssuperior', + 'tsuperior', 'ff', 'ffi', 'ffl', 'parenleftinferior', 'parenrightinferior', + 'Circumflexsmall', 'hyphensuperior', 'Gravesmall', 'Asmall', 'Bsmall', + 'Csmall', 'Dsmall', 'Esmall', 'Fsmall', 'Gsmall', 'Hsmall', 'Ismall', + 'Jsmall', 'Ksmall', 'Lsmall', 'Msmall', 'Nsmall', 'Osmall', 'Psmall', + 'Qsmall', 'Rsmall', 'Ssmall', 'Tsmall', 'Usmall', 'Vsmall', 'Wsmall', + 'Xsmall', 'Ysmall', 'Zsmall', 'colonmonetary', 'onefitted', 'rupiah', + 'Tildesmall', 'exclamdownsmall', 'centoldstyle', 'Lslashsmall', + 'Scaronsmall', 'Zcaronsmall', 'Dieresissmall', 'Brevesmall', 'Caronsmall', + 'Dotaccentsmall', 'Macronsmall', 'figuredash', 'hypheninferior', + 'Ogoneksmall', 'Ringsmall', 'Cedillasmall', 'questiondownsmall', 'oneeighth', + 'threeeighths', 'fiveeighths', 'seveneighths', 'onethird', 'twothirds', + 'zerosuperior', 'foursuperior', 'fivesuperior', 'sixsuperior', + 'sevensuperior', 'eightsuperior', 'ninesuperior', 'zeroinferior', + 'oneinferior', 'twoinferior', 'threeinferior', 'fourinferior', + 'fiveinferior', 'sixinferior', 'seveninferior', 'eightinferior', + 'nineinferior', 'centinferior', 'dollarinferior', 'periodinferior', + 'commainferior', 'Agravesmall', 'Aacutesmall', 'Acircumflexsmall', + 'Atildesmall', 'Adieresissmall', 'Aringsmall', 'AEsmall', 'Ccedillasmall', + 'Egravesmall', 'Eacutesmall', 'Ecircumflexsmall', 'Edieresissmall', + 'Igravesmall', 'Iacutesmall', 'Icircumflexsmall', 'Idieresissmall', + 'Ethsmall', 'Ntildesmall', 'Ogravesmall', 'Oacutesmall', 'Ocircumflexsmall', + 'Otildesmall', 'Odieresissmall', 'OEsmall', 'Oslashsmall', 'Ugravesmall', + 'Uacutesmall', 'Ucircumflexsmall', 'Udieresissmall', 'Yacutesmall', + 'Thornsmall', 'Ydieresissmall', '001.000', '001.001', '001.002', '001.003', + 'Black', 'Bold', 'Book', 'Light', 'Medium', 'Regular', 'Roman', 'Semibold' +]; + +// Type1Font is also a CIDFontType0. +var Type1Font = function Type1Font(name, file, properties) { + // Some bad generators embed pfb file as is, we have to strip 6-byte headers. + // Also, length1 and length2 might be off by 6 bytes as well. + // http://www.math.ubc.ca/~cass/piscript/type1.pdf + var PFB_HEADER_SIZE = 6; + var headerBlockLength = properties.length1; + var eexecBlockLength = properties.length2; + var pfbHeader = file.peekBytes(PFB_HEADER_SIZE); + var pfbHeaderPresent = pfbHeader[0] === 0x80 && pfbHeader[1] === 0x01; + if (pfbHeaderPresent) { + file.skip(PFB_HEADER_SIZE); + headerBlockLength = (pfbHeader[5] << 24) | (pfbHeader[4] << 16) | + (pfbHeader[3] << 8) | pfbHeader[2]; + } + + // Get the data block containing glyphs and subrs informations + var headerBlock = new Stream(file.getBytes(headerBlockLength)); + var headerBlockParser = new Type1Parser(headerBlock); + headerBlockParser.extractFontHeader(properties); + + if (pfbHeaderPresent) { + pfbHeader = file.getBytes(PFB_HEADER_SIZE); + eexecBlockLength = (pfbHeader[5] << 24) | (pfbHeader[4] << 16) | + (pfbHeader[3] << 8) | pfbHeader[2]; + } + + // Decrypt the data blocks and retrieve it's content + var eexecBlock = new Stream(file.getBytes(eexecBlockLength)); + var eexecBlockParser = new Type1Parser(eexecBlock, true); + var data = eexecBlockParser.extractFontProgram(); + for (var info in data.properties) { + properties[info] = data.properties[info]; + } + + var charstrings = data.charstrings; + var type2Charstrings = this.getType2Charstrings(charstrings); + var subrs = this.getType2Subrs(data.subrs); + + this.charstrings = charstrings; + this.data = this.wrap(name, type2Charstrings, this.charstrings, + subrs, properties); + this.seacs = this.getSeacs(data.charstrings); +}; + +Type1Font.prototype = { + get numGlyphs() { + return this.charstrings.length + 1; + }, + + getCharset: function Type1Font_getCharset() { + var charset = ['.notdef']; + var charstrings = this.charstrings; + for (var glyphId = 0; glyphId < charstrings.length; glyphId++) { + charset.push(charstrings[glyphId].glyphName); + } + return charset; + }, + + getGlyphMapping: function Type1Font_getGlyphMapping(properties) { + var charstrings = this.charstrings; + var glyphNames = ['.notdef'], glyphId; + for (glyphId = 0; glyphId < charstrings.length; glyphId++) { + glyphNames.push(charstrings[glyphId].glyphName); + } + var encoding = properties.builtInEncoding; + if (encoding) { + var builtInEncoding = {}; + for (var charCode in encoding) { + glyphId = glyphNames.indexOf(encoding[charCode]); + if (glyphId >= 0) { + builtInEncoding[charCode] = glyphId; + } + } + } + + return type1FontGlyphMapping(properties, builtInEncoding, glyphNames); + }, + + getSeacs: function Type1Font_getSeacs(charstrings) { + var i, ii; + var seacMap = []; + for (i = 0, ii = charstrings.length; i < ii; i++) { + var charstring = charstrings[i]; + if (charstring.seac) { + // Offset by 1 for .notdef + seacMap[i + 1] = charstring.seac; + } + } + return seacMap; + }, + + getType2Charstrings: function Type1Font_getType2Charstrings( + type1Charstrings) { + var type2Charstrings = []; + for (var i = 0, ii = type1Charstrings.length; i < ii; i++) { + type2Charstrings.push(type1Charstrings[i].charstring); + } + return type2Charstrings; + }, + + getType2Subrs: function Type1Font_getType2Subrs(type1Subrs) { + var bias = 0; + var count = type1Subrs.length; + if (count < 1133) { + bias = 107; + } else if (count < 33769) { + bias = 1131; + } else { + bias = 32768; + } + + // Add a bunch of empty subrs to deal with the Type2 bias + var type2Subrs = []; + var i; + for (i = 0; i < bias; i++) { + type2Subrs.push([0x0B]); + } + + for (i = 0; i < count; i++) { + type2Subrs.push(type1Subrs[i]); + } + + return type2Subrs; + }, + + wrap: function Type1Font_wrap(name, glyphs, charstrings, subrs, properties) { + var cff = new CFF(); + cff.header = new CFFHeader(1, 0, 4, 4); + + cff.names = [name]; + + var topDict = new CFFTopDict(); + // CFF strings IDs 0...390 are predefined names, so refering + // to entries in our own String INDEX starts at SID 391. + topDict.setByName('version', 391); + topDict.setByName('Notice', 392); + topDict.setByName('FullName', 393); + topDict.setByName('FamilyName', 394); + topDict.setByName('Weight', 395); + topDict.setByName('Encoding', null); // placeholder + topDict.setByName('FontMatrix', properties.fontMatrix); + topDict.setByName('FontBBox', properties.bbox); + topDict.setByName('charset', null); // placeholder + topDict.setByName('CharStrings', null); // placeholder + topDict.setByName('Private', null); // placeholder + cff.topDict = topDict; + + var strings = new CFFStrings(); + strings.add('Version 0.11'); // Version + strings.add('See original notice'); // Notice + strings.add(name); // FullName + strings.add(name); // FamilyName + strings.add('Medium'); // Weight + cff.strings = strings; + + cff.globalSubrIndex = new CFFIndex(); + + var count = glyphs.length; + var charsetArray = [0]; + var i, ii; + for (i = 0; i < count; i++) { + var index = CFFStandardStrings.indexOf(charstrings[i].glyphName); + // TODO: Insert the string and correctly map it. Previously it was + // thought mapping names that aren't in the standard strings to .notdef + // was fine, however in issue818 when mapping them all to .notdef the + // adieresis glyph no longer worked. + if (index === -1) { + index = 0; + } + charsetArray.push((index >> 8) & 0xff, index & 0xff); + } + cff.charset = new CFFCharset(false, 0, [], charsetArray); + + var charStringsIndex = new CFFIndex(); + charStringsIndex.add([0x8B, 0x0E]); // .notdef + for (i = 0; i < count; i++) { + charStringsIndex.add(glyphs[i]); + } + cff.charStrings = charStringsIndex; + + var privateDict = new CFFPrivateDict(); + privateDict.setByName('Subrs', null); // placeholder + var fields = [ + 'BlueValues', + 'OtherBlues', + 'FamilyBlues', + 'FamilyOtherBlues', + 'StemSnapH', + 'StemSnapV', + 'BlueShift', + 'BlueFuzz', + 'BlueScale', + 'LanguageGroup', + 'ExpansionFactor', + 'ForceBold', + 'StdHW', + 'StdVW' + ]; + for (i = 0, ii = fields.length; i < ii; i++) { + var field = fields[i]; + if (!properties.privateData.hasOwnProperty(field)) { + continue; + } + var value = properties.privateData[field]; + if (isArray(value)) { + // All of the private dictionary array data in CFF must be stored as + // "delta-encoded" numbers. + for (var j = value.length - 1; j > 0; j--) { + value[j] -= value[j - 1]; // ... difference from previous value + } + } + privateDict.setByName(field, value); + } + cff.topDict.privateDict = privateDict; + + var subrIndex = new CFFIndex(); + for (i = 0, ii = subrs.length; i < ii; i++) { + subrIndex.add(subrs[i]); + } + privateDict.subrsIndex = subrIndex; + + var compiler = new CFFCompiler(cff); + return compiler.compile(); + } +}; + +var CFFFont = (function CFFFontClosure() { + function CFFFont(file, properties) { + this.properties = properties; + + var parser = new CFFParser(file, properties); + this.cff = parser.parse(); + var compiler = new CFFCompiler(this.cff); + this.seacs = this.cff.seacs; + try { + this.data = compiler.compile(); + } catch (e) { + warn('Failed to compile font ' + properties.loadedName); + // There may have just been an issue with the compiler, set the data + // anyway and hope the font loaded. + this.data = file; + } + } + + CFFFont.prototype = { + get numGlyphs() { + return this.cff.charStrings.count; + }, + getCharset: function CFFFont_getCharset() { + return this.cff.charset.charset; + }, + getGlyphMapping: function CFFFont_getGlyphMapping() { + var cff = this.cff; + var properties = this.properties; + var charsets = cff.charset.charset; + var charCodeToGlyphId; + var glyphId; + + if (properties.composite) { + charCodeToGlyphId = Object.create(null); + if (cff.isCIDFont) { + // If the font is actually a CID font then we should use the charset + // to map CIDs to GIDs. + for (glyphId = 0; glyphId < charsets.length; glyphId++) { + var cid = charsets[glyphId]; + var charCode = properties.cMap.charCodeOf(cid); + charCodeToGlyphId[charCode] = glyphId; + } + } else { + // If it is NOT actually a CID font then CIDs should be mapped + // directly to GIDs. + for (glyphId = 0; glyphId < cff.charStrings.count; glyphId++) { + charCodeToGlyphId[glyphId] = glyphId; + } + } + return charCodeToGlyphId; + } + + var encoding = cff.encoding ? cff.encoding.encoding : null; + charCodeToGlyphId = type1FontGlyphMapping(properties, encoding, charsets); + return charCodeToGlyphId; + } + }; + + return CFFFont; +})(); + +var CFFParser = (function CFFParserClosure() { + var CharstringValidationData = [ + null, + { id: 'hstem', min: 2, stackClearing: true, stem: true }, + null, + { id: 'vstem', min: 2, stackClearing: true, stem: true }, + { id: 'vmoveto', min: 1, stackClearing: true }, + { id: 'rlineto', min: 2, resetStack: true }, + { id: 'hlineto', min: 1, resetStack: true }, + { id: 'vlineto', min: 1, resetStack: true }, + { id: 'rrcurveto', min: 6, resetStack: true }, + null, + { id: 'callsubr', min: 1, undefStack: true }, + { id: 'return', min: 0, undefStack: true }, + null, // 12 + null, + { id: 'endchar', min: 0, stackClearing: true }, + null, + null, + null, + { id: 'hstemhm', min: 2, stackClearing: true, stem: true }, + { id: 'hintmask', min: 0, stackClearing: true }, + { id: 'cntrmask', min: 0, stackClearing: true }, + { id: 'rmoveto', min: 2, stackClearing: true }, + { id: 'hmoveto', min: 1, stackClearing: true }, + { id: 'vstemhm', min: 2, stackClearing: true, stem: true }, + { id: 'rcurveline', min: 8, resetStack: true }, + { id: 'rlinecurve', min: 8, resetStack: true }, + { id: 'vvcurveto', min: 4, resetStack: true }, + { id: 'hhcurveto', min: 4, resetStack: true }, + null, // shortint + { id: 'callgsubr', min: 1, undefStack: true }, + { id: 'vhcurveto', min: 4, resetStack: true }, + { id: 'hvcurveto', min: 4, resetStack: true } + ]; + var CharstringValidationData12 = [ + null, + null, + null, + { id: 'and', min: 2, stackDelta: -1 }, + { id: 'or', min: 2, stackDelta: -1 }, + { id: 'not', min: 1, stackDelta: 0 }, + null, + null, + null, + { id: 'abs', min: 1, stackDelta: 0 }, + { id: 'add', min: 2, stackDelta: -1, + stackFn: function stack_div(stack, index) { + stack[index - 2] = stack[index - 2] + stack[index - 1]; + } + }, + { id: 'sub', min: 2, stackDelta: -1, + stackFn: function stack_div(stack, index) { + stack[index - 2] = stack[index - 2] - stack[index - 1]; + } + }, + { id: 'div', min: 2, stackDelta: -1, + stackFn: function stack_div(stack, index) { + stack[index - 2] = stack[index - 2] / stack[index - 1]; + } + }, + null, + { id: 'neg', min: 1, stackDelta: 0, + stackFn: function stack_div(stack, index) { + stack[index - 1] = -stack[index - 1]; + } + }, + { id: 'eq', min: 2, stackDelta: -1 }, + null, + null, + { id: 'drop', min: 1, stackDelta: -1 }, + null, + { id: 'put', min: 2, stackDelta: -2 }, + { id: 'get', min: 1, stackDelta: 0 }, + { id: 'ifelse', min: 4, stackDelta: -3 }, + { id: 'random', min: 0, stackDelta: 1 }, + { id: 'mul', min: 2, stackDelta: -1, + stackFn: function stack_div(stack, index) { + stack[index - 2] = stack[index - 2] * stack[index - 1]; + } + }, + null, + { id: 'sqrt', min: 1, stackDelta: 0 }, + { id: 'dup', min: 1, stackDelta: 1 }, + { id: 'exch', min: 2, stackDelta: 0 }, + { id: 'index', min: 2, stackDelta: 0 }, + { id: 'roll', min: 3, stackDelta: -2 }, + null, + null, + null, + { id: 'hflex', min: 7, resetStack: true }, + { id: 'flex', min: 13, resetStack: true }, + { id: 'hflex1', min: 9, resetStack: true }, + { id: 'flex1', min: 11, resetStack: true } + ]; + + function CFFParser(file, properties) { + this.bytes = file.getBytes(); + this.properties = properties; + } + CFFParser.prototype = { + parse: function CFFParser_parse() { + var properties = this.properties; + var cff = new CFF(); + this.cff = cff; + + // The first five sections must be in order, all the others are reached + // via offsets contained in one of the below. + var header = this.parseHeader(); + var nameIndex = this.parseIndex(header.endPos); + var topDictIndex = this.parseIndex(nameIndex.endPos); + var stringIndex = this.parseIndex(topDictIndex.endPos); + var globalSubrIndex = this.parseIndex(stringIndex.endPos); + + var topDictParsed = this.parseDict(topDictIndex.obj.get(0)); + var topDict = this.createDict(CFFTopDict, topDictParsed, cff.strings); + + cff.header = header.obj; + cff.names = this.parseNameIndex(nameIndex.obj); + cff.strings = this.parseStringIndex(stringIndex.obj); + cff.topDict = topDict; + cff.globalSubrIndex = globalSubrIndex.obj; + + this.parsePrivateDict(cff.topDict); + + cff.isCIDFont = topDict.hasName('ROS'); + + var charStringOffset = topDict.getByName('CharStrings'); + var charStringsAndSeacs = this.parseCharStrings(charStringOffset); + cff.charStrings = charStringsAndSeacs.charStrings; + cff.seacs = charStringsAndSeacs.seacs; + cff.widths = charStringsAndSeacs.widths; + + var fontMatrix = topDict.getByName('FontMatrix'); + if (fontMatrix) { + properties.fontMatrix = fontMatrix; + } + + var fontBBox = topDict.getByName('FontBBox'); + if (fontBBox) { + // adjusting ascent/descent + properties.ascent = fontBBox[3]; + properties.descent = fontBBox[1]; + properties.ascentScaled = true; + } + + var charset, encoding; + if (cff.isCIDFont) { + var fdArrayIndex = this.parseIndex(topDict.getByName('FDArray')).obj; + for (var i = 0, ii = fdArrayIndex.count; i < ii; ++i) { + var dictRaw = fdArrayIndex.get(i); + var fontDict = this.createDict(CFFTopDict, this.parseDict(dictRaw), + cff.strings); + this.parsePrivateDict(fontDict); + cff.fdArray.push(fontDict); + } + // cid fonts don't have an encoding + encoding = null; + charset = this.parseCharsets(topDict.getByName('charset'), + cff.charStrings.count, cff.strings, true); + cff.fdSelect = this.parseFDSelect(topDict.getByName('FDSelect'), + cff.charStrings.count); + } else { + charset = this.parseCharsets(topDict.getByName('charset'), + cff.charStrings.count, cff.strings, false); + encoding = this.parseEncoding(topDict.getByName('Encoding'), + properties, + cff.strings, charset.charset); + } + cff.charset = charset; + cff.encoding = encoding; + + return cff; + }, + parseHeader: function CFFParser_parseHeader() { + var bytes = this.bytes; + var bytesLength = bytes.length; + var offset = 0; + + // Prevent an infinite loop, by checking that the offset is within the + // bounds of the bytes array. Necessary in empty, or invalid, font files. + while (offset < bytesLength && bytes[offset] !== 1) { + ++offset; + } + if (offset >= bytesLength) { + error('Invalid CFF header'); + } else if (offset !== 0) { + info('cff data is shifted'); + bytes = bytes.subarray(offset); + this.bytes = bytes; + } + var major = bytes[0]; + var minor = bytes[1]; + var hdrSize = bytes[2]; + var offSize = bytes[3]; + var header = new CFFHeader(major, minor, hdrSize, offSize); + return { obj: header, endPos: hdrSize }; + }, + parseDict: function CFFParser_parseDict(dict) { + var pos = 0; + + function parseOperand() { + var value = dict[pos++]; + if (value === 30) { + return parseFloatOperand(pos); + } else if (value === 28) { + value = dict[pos++]; + value = ((value << 24) | (dict[pos++] << 16)) >> 16; + return value; + } else if (value === 29) { + value = dict[pos++]; + value = (value << 8) | dict[pos++]; + value = (value << 8) | dict[pos++]; + value = (value << 8) | dict[pos++]; + return value; + } else if (value >= 32 && value <= 246) { + return value - 139; + } else if (value >= 247 && value <= 250) { + return ((value - 247) * 256) + dict[pos++] + 108; + } else if (value >= 251 && value <= 254) { + return -((value - 251) * 256) - dict[pos++] - 108; + } else { + error('255 is not a valid DICT command'); + } + return -1; + } + + function parseFloatOperand() { + var str = ''; + var eof = 15; + var lookup = ['0', '1', '2', '3', '4', '5', '6', '7', '8', + '9', '.', 'E', 'E-', null, '-']; + var length = dict.length; + while (pos < length) { + var b = dict[pos++]; + var b1 = b >> 4; + var b2 = b & 15; + + if (b1 === eof) { + break; + } + str += lookup[b1]; + + if (b2 === eof) { + break; + } + str += lookup[b2]; + } + return parseFloat(str); + } + + var operands = []; + var entries = []; + + pos = 0; + var end = dict.length; + while (pos < end) { + var b = dict[pos]; + if (b <= 21) { + if (b === 12) { + b = (b << 8) | dict[++pos]; + } + entries.push([b, operands]); + operands = []; + ++pos; + } else { + operands.push(parseOperand()); + } + } + return entries; + }, + parseIndex: function CFFParser_parseIndex(pos) { + var cffIndex = new CFFIndex(); + var bytes = this.bytes; + var count = (bytes[pos++] << 8) | bytes[pos++]; + var offsets = []; + var end = pos; + var i, ii; + + if (count !== 0) { + var offsetSize = bytes[pos++]; + // add 1 for offset to determine size of last object + var startPos = pos + ((count + 1) * offsetSize) - 1; + + for (i = 0, ii = count + 1; i < ii; ++i) { + var offset = 0; + for (var j = 0; j < offsetSize; ++j) { + offset <<= 8; + offset += bytes[pos++]; + } + offsets.push(startPos + offset); + } + end = offsets[count]; + } + for (i = 0, ii = offsets.length - 1; i < ii; ++i) { + var offsetStart = offsets[i]; + var offsetEnd = offsets[i + 1]; + cffIndex.add(bytes.subarray(offsetStart, offsetEnd)); + } + return {obj: cffIndex, endPos: end}; + }, + parseNameIndex: function CFFParser_parseNameIndex(index) { + var names = []; + for (var i = 0, ii = index.count; i < ii; ++i) { + var name = index.get(i); + // OTS doesn't allow names to be over 127 characters. + var length = Math.min(name.length, 127); + var data = []; + // OTS also only permits certain characters in the name. + for (var j = 0; j < length; ++j) { + var c = name[j]; + if (j === 0 && c === 0) { + data[j] = c; + continue; + } + if ((c < 33 || c > 126) || c === 91 /* [ */ || c === 93 /* ] */ || + c === 40 /* ( */ || c === 41 /* ) */ || c === 123 /* { */ || + c === 125 /* } */ || c === 60 /* < */ || c === 62 /* > */ || + c === 47 /* / */ || c === 37 /* % */ || c === 35 /* # */) { + data[j] = 95; + continue; + } + data[j] = c; + } + names.push(bytesToString(data)); + } + return names; + }, + parseStringIndex: function CFFParser_parseStringIndex(index) { + var strings = new CFFStrings(); + for (var i = 0, ii = index.count; i < ii; ++i) { + var data = index.get(i); + strings.add(bytesToString(data)); + } + return strings; + }, + createDict: function CFFParser_createDict(Type, dict, strings) { + var cffDict = new Type(strings); + for (var i = 0, ii = dict.length; i < ii; ++i) { + var pair = dict[i]; + var key = pair[0]; + var value = pair[1]; + cffDict.setByKey(key, value); + } + return cffDict; + }, + parseCharStrings: function CFFParser_parseCharStrings(charStringOffset) { + var charStrings = this.parseIndex(charStringOffset).obj; + var seacs = []; + var widths = []; + var count = charStrings.count; + for (var i = 0; i < count; i++) { + var charstring = charStrings.get(i); + + var stackSize = 0; + var stack = []; + var undefStack = true; + var hints = 0; + var valid = true; + var data = charstring; + var length = data.length; + var firstStackClearing = true; + for (var j = 0; j < length;) { + var value = data[j++]; + var validationCommand = null; + if (value === 12) { + var q = data[j++]; + if (q === 0) { + // The CFF specification state that the 'dotsection' command + // (12, 0) is deprecated and treated as a no-op, but all Type2 + // charstrings processors should support them. Unfortunately + // the font sanitizer don't. As a workaround the sequence (12, 0) + // is replaced by a useless (0, hmoveto). + data[j - 2] = 139; + data[j - 1] = 22; + stackSize = 0; + } else { + validationCommand = CharstringValidationData12[q]; + } + } else if (value === 28) { // number (16 bit) + stack[stackSize] = ((data[j] << 24) | (data[j + 1] << 16)) >> 16; + j += 2; + stackSize++; + } else if (value === 14) { + if (stackSize >= 4) { + stackSize -= 4; + if (SEAC_ANALYSIS_ENABLED) { + seacs[i] = stack.slice(stackSize, stackSize + 4); + valid = false; + } + } + validationCommand = CharstringValidationData[value]; + } else if (value >= 32 && value <= 246) { // number + stack[stackSize] = value - 139; + stackSize++; + } else if (value >= 247 && value <= 254) { // number (+1 bytes) + stack[stackSize] = (value < 251 ? + ((value - 247) << 8) + data[j] + 108 : + -((value - 251) << 8) - data[j] - 108); + j++; + stackSize++; + } else if (value === 255) { // number (32 bit) + stack[stackSize] = ((data[j] << 24) | (data[j + 1] << 16) | + (data[j + 2] << 8) | data[j + 3]) / 65536; + j += 4; + stackSize++; + } else if (value === 19 || value === 20) { + hints += stackSize >> 1; + j += (hints + 7) >> 3; // skipping right amount of hints flag data + stackSize %= 2; + validationCommand = CharstringValidationData[value]; + } else { + validationCommand = CharstringValidationData[value]; + } + if (validationCommand) { + if (validationCommand.stem) { + hints += stackSize >> 1; + } + if ('min' in validationCommand) { + if (!undefStack && stackSize < validationCommand.min) { + warn('Not enough parameters for ' + validationCommand.id + + '; actual: ' + stackSize + + ', expected: ' + validationCommand.min); + valid = false; + break; + } + } + if (firstStackClearing && validationCommand.stackClearing) { + firstStackClearing = false; + // the optional character width can be found before the first + // stack-clearing command arguments + stackSize -= validationCommand.min; + if (stackSize >= 2 && validationCommand.stem) { + // there are even amount of arguments for stem commands + stackSize %= 2; + } else if (stackSize > 1) { + warn('Found too many parameters for stack-clearing command'); + } + if (stackSize > 0 && stack[stackSize - 1] >= 0) { + widths[i] = stack[stackSize - 1]; + } + } + if ('stackDelta' in validationCommand) { + if ('stackFn' in validationCommand) { + validationCommand.stackFn(stack, stackSize); + } + stackSize += validationCommand.stackDelta; + } else if (validationCommand.stackClearing) { + stackSize = 0; + } else if (validationCommand.resetStack) { + stackSize = 0; + undefStack = false; + } else if (validationCommand.undefStack) { + stackSize = 0; + undefStack = true; + firstStackClearing = false; + } + } + } + if (!valid) { + // resetting invalid charstring to single 'endchar' + charStrings.set(i, new Uint8Array([14])); + } + } + return { charStrings: charStrings, seacs: seacs, widths: widths }; + }, + emptyPrivateDictionary: + function CFFParser_emptyPrivateDictionary(parentDict) { + var privateDict = this.createDict(CFFPrivateDict, [], + parentDict.strings); + parentDict.setByKey(18, [0, 0]); + parentDict.privateDict = privateDict; + }, + parsePrivateDict: function CFFParser_parsePrivateDict(parentDict) { + // no private dict, do nothing + if (!parentDict.hasName('Private')) { + this.emptyPrivateDictionary(parentDict); + return; + } + var privateOffset = parentDict.getByName('Private'); + // make sure the params are formatted correctly + if (!isArray(privateOffset) || privateOffset.length !== 2) { + parentDict.removeByName('Private'); + return; + } + var size = privateOffset[0]; + var offset = privateOffset[1]; + // remove empty dicts or ones that refer to invalid location + if (size === 0 || offset >= this.bytes.length) { + this.emptyPrivateDictionary(parentDict); + return; + } + + var privateDictEnd = offset + size; + var dictData = this.bytes.subarray(offset, privateDictEnd); + var dict = this.parseDict(dictData); + var privateDict = this.createDict(CFFPrivateDict, dict, + parentDict.strings); + parentDict.privateDict = privateDict; + + // Parse the Subrs index also since it's relative to the private dict. + if (!privateDict.getByName('Subrs')) { + return; + } + var subrsOffset = privateDict.getByName('Subrs'); + var relativeOffset = offset + subrsOffset; + // Validate the offset. + if (subrsOffset === 0 || relativeOffset >= this.bytes.length) { + this.emptyPrivateDictionary(parentDict); + return; + } + var subrsIndex = this.parseIndex(relativeOffset); + privateDict.subrsIndex = subrsIndex.obj; + }, + parseCharsets: function CFFParser_parseCharsets(pos, length, strings, cid) { + if (pos === 0) { + return new CFFCharset(true, CFFCharsetPredefinedTypes.ISO_ADOBE, + ISOAdobeCharset); + } else if (pos === 1) { + return new CFFCharset(true, CFFCharsetPredefinedTypes.EXPERT, + ExpertCharset); + } else if (pos === 2) { + return new CFFCharset(true, CFFCharsetPredefinedTypes.EXPERT_SUBSET, + ExpertSubsetCharset); + } + + var bytes = this.bytes; + var start = pos; + var format = bytes[pos++]; + var charset = ['.notdef']; + var id, count, i; + + // subtract 1 for the .notdef glyph + length -= 1; + + switch (format) { + case 0: + for (i = 0; i < length; i++) { + id = (bytes[pos++] << 8) | bytes[pos++]; + charset.push(cid ? id : strings.get(id)); + } + break; + case 1: + while (charset.length <= length) { + id = (bytes[pos++] << 8) | bytes[pos++]; + count = bytes[pos++]; + for (i = 0; i <= count; i++) { + charset.push(cid ? id++ : strings.get(id++)); + } + } + break; + case 2: + while (charset.length <= length) { + id = (bytes[pos++] << 8) | bytes[pos++]; + count = (bytes[pos++] << 8) | bytes[pos++]; + for (i = 0; i <= count; i++) { + charset.push(cid ? id++ : strings.get(id++)); + } + } + break; + default: + error('Unknown charset format'); + } + // Raw won't be needed if we actually compile the charset. + var end = pos; + var raw = bytes.subarray(start, end); + + return new CFFCharset(false, format, charset, raw); + }, + parseEncoding: function CFFParser_parseEncoding(pos, + properties, + strings, + charset) { + var encoding = {}; + var bytes = this.bytes; + var predefined = false; + var hasSupplement = false; + var format, i, ii; + var raw = null; + + function readSupplement() { + var supplementsCount = bytes[pos++]; + for (i = 0; i < supplementsCount; i++) { + var code = bytes[pos++]; + var sid = (bytes[pos++] << 8) + (bytes[pos++] & 0xff); + encoding[code] = charset.indexOf(strings.get(sid)); + } + } + + if (pos === 0 || pos === 1) { + predefined = true; + format = pos; + var baseEncoding = pos ? Encodings.ExpertEncoding : + Encodings.StandardEncoding; + for (i = 0, ii = charset.length; i < ii; i++) { + var index = baseEncoding.indexOf(charset[i]); + if (index !== -1) { + encoding[index] = i; + } + } + } else { + var dataStart = pos; + format = bytes[pos++]; + switch (format & 0x7f) { + case 0: + var glyphsCount = bytes[pos++]; + for (i = 1; i <= glyphsCount; i++) { + encoding[bytes[pos++]] = i; + } + break; + + case 1: + var rangesCount = bytes[pos++]; + var gid = 1; + for (i = 0; i < rangesCount; i++) { + var start = bytes[pos++]; + var left = bytes[pos++]; + for (var j = start; j <= start + left; j++) { + encoding[j] = gid++; + } + } + break; + + default: + error('Unknow encoding format: ' + format + ' in CFF'); + break; + } + var dataEnd = pos; + if (format & 0x80) { + // The font sanitizer does not support CFF encoding with a + // supplement, since the encoding is not really used to map + // between gid to glyph, let's overwrite what is declared in + // the top dictionary to let the sanitizer think the font use + // StandardEncoding, that's a lie but that's ok. + bytes[dataStart] &= 0x7f; + readSupplement(); + hasSupplement = true; + } + raw = bytes.subarray(dataStart, dataEnd); + } + format = format & 0x7f; + return new CFFEncoding(predefined, format, encoding, raw); + }, + parseFDSelect: function CFFParser_parseFDSelect(pos, length) { + var start = pos; + var bytes = this.bytes; + var format = bytes[pos++]; + var fdSelect = []; + var i; + + switch (format) { + case 0: + for (i = 0; i < length; ++i) { + var id = bytes[pos++]; + fdSelect.push(id); + } + break; + case 3: + var rangesCount = (bytes[pos++] << 8) | bytes[pos++]; + for (i = 0; i < rangesCount; ++i) { + var first = (bytes[pos++] << 8) | bytes[pos++]; + var fdIndex = bytes[pos++]; + var next = (bytes[pos] << 8) | bytes[pos + 1]; + for (var j = first; j < next; ++j) { + fdSelect.push(fdIndex); + } + } + // Advance past the sentinel(next). + pos += 2; + break; + default: + error('Unknown fdselect format ' + format); + break; + } + var end = pos; + return new CFFFDSelect(fdSelect, bytes.subarray(start, end)); + } + }; + return CFFParser; +})(); + +// Compact Font Format +var CFF = (function CFFClosure() { + function CFF() { + this.header = null; + this.names = []; + this.topDict = null; + this.strings = new CFFStrings(); + this.globalSubrIndex = null; + + // The following could really be per font, but since we only have one font + // store them here. + this.encoding = null; + this.charset = null; + this.charStrings = null; + this.fdArray = []; + this.fdSelect = null; + + this.isCIDFont = false; + } + return CFF; +})(); + +var CFFHeader = (function CFFHeaderClosure() { + function CFFHeader(major, minor, hdrSize, offSize) { + this.major = major; + this.minor = minor; + this.hdrSize = hdrSize; + this.offSize = offSize; + } + return CFFHeader; +})(); + +var CFFStrings = (function CFFStringsClosure() { + function CFFStrings() { + this.strings = []; + } + CFFStrings.prototype = { + get: function CFFStrings_get(index) { + if (index >= 0 && index <= 390) { + return CFFStandardStrings[index]; + } + if (index - 391 <= this.strings.length) { + return this.strings[index - 391]; + } + return CFFStandardStrings[0]; + }, + add: function CFFStrings_add(value) { + this.strings.push(value); + }, + get count() { + return this.strings.length; + } + }; + return CFFStrings; +})(); + +var CFFIndex = (function CFFIndexClosure() { + function CFFIndex() { + this.objects = []; + this.length = 0; + } + CFFIndex.prototype = { + add: function CFFIndex_add(data) { + this.length += data.length; + this.objects.push(data); + }, + set: function CFFIndex_set(index, data) { + this.length += data.length - this.objects[index].length; + this.objects[index] = data; + }, + get: function CFFIndex_get(index) { + return this.objects[index]; + }, + get count() { + return this.objects.length; + } + }; + return CFFIndex; +})(); + +var CFFDict = (function CFFDictClosure() { + function CFFDict(tables, strings) { + this.keyToNameMap = tables.keyToNameMap; + this.nameToKeyMap = tables.nameToKeyMap; + this.defaults = tables.defaults; + this.types = tables.types; + this.opcodes = tables.opcodes; + this.order = tables.order; + this.strings = strings; + this.values = {}; + } + CFFDict.prototype = { + // value should always be an array + setByKey: function CFFDict_setByKey(key, value) { + if (!(key in this.keyToNameMap)) { + return false; + } + // ignore empty values + if (value.length === 0) { + return true; + } + var type = this.types[key]; + // remove the array wrapping these types of values + if (type === 'num' || type === 'sid' || type === 'offset') { + value = value[0]; + } + this.values[key] = value; + return true; + }, + setByName: function CFFDict_setByName(name, value) { + if (!(name in this.nameToKeyMap)) { + error('Invalid dictionary name "' + name + '"'); + } + this.values[this.nameToKeyMap[name]] = value; + }, + hasName: function CFFDict_hasName(name) { + return this.nameToKeyMap[name] in this.values; + }, + getByName: function CFFDict_getByName(name) { + if (!(name in this.nameToKeyMap)) { + error('Invalid dictionary name "' + name + '"'); + } + var key = this.nameToKeyMap[name]; + if (!(key in this.values)) { + return this.defaults[key]; + } + return this.values[key]; + }, + removeByName: function CFFDict_removeByName(name) { + delete this.values[this.nameToKeyMap[name]]; + } + }; + CFFDict.createTables = function CFFDict_createTables(layout) { + var tables = { + keyToNameMap: {}, + nameToKeyMap: {}, + defaults: {}, + types: {}, + opcodes: {}, + order: [] + }; + for (var i = 0, ii = layout.length; i < ii; ++i) { + var entry = layout[i]; + var key = isArray(entry[0]) ? (entry[0][0] << 8) + entry[0][1] : entry[0]; + tables.keyToNameMap[key] = entry[1]; + tables.nameToKeyMap[entry[1]] = key; + tables.types[key] = entry[2]; + tables.defaults[key] = entry[3]; + tables.opcodes[key] = isArray(entry[0]) ? entry[0] : [entry[0]]; + tables.order.push(key); + } + return tables; + }; + return CFFDict; +})(); + +var CFFTopDict = (function CFFTopDictClosure() { + var layout = [ + [[12, 30], 'ROS', ['sid', 'sid', 'num'], null], + [[12, 20], 'SyntheticBase', 'num', null], + [0, 'version', 'sid', null], + [1, 'Notice', 'sid', null], + [[12, 0], 'Copyright', 'sid', null], + [2, 'FullName', 'sid', null], + [3, 'FamilyName', 'sid', null], + [4, 'Weight', 'sid', null], + [[12, 1], 'isFixedPitch', 'num', 0], + [[12, 2], 'ItalicAngle', 'num', 0], + [[12, 3], 'UnderlinePosition', 'num', -100], + [[12, 4], 'UnderlineThickness', 'num', 50], + [[12, 5], 'PaintType', 'num', 0], + [[12, 6], 'CharstringType', 'num', 2], + [[12, 7], 'FontMatrix', ['num', 'num', 'num', 'num', 'num', 'num'], + [0.001, 0, 0, 0.001, 0, 0]], + [13, 'UniqueID', 'num', null], + [5, 'FontBBox', ['num', 'num', 'num', 'num'], [0, 0, 0, 0]], + [[12, 8], 'StrokeWidth', 'num', 0], + [14, 'XUID', 'array', null], + [15, 'charset', 'offset', 0], + [16, 'Encoding', 'offset', 0], + [17, 'CharStrings', 'offset', 0], + [18, 'Private', ['offset', 'offset'], null], + [[12, 21], 'PostScript', 'sid', null], + [[12, 22], 'BaseFontName', 'sid', null], + [[12, 23], 'BaseFontBlend', 'delta', null], + [[12, 31], 'CIDFontVersion', 'num', 0], + [[12, 32], 'CIDFontRevision', 'num', 0], + [[12, 33], 'CIDFontType', 'num', 0], + [[12, 34], 'CIDCount', 'num', 8720], + [[12, 35], 'UIDBase', 'num', null], + // XXX: CID Fonts on DirectWrite 6.1 only seem to work if FDSelect comes + // before FDArray. + [[12, 37], 'FDSelect', 'offset', null], + [[12, 36], 'FDArray', 'offset', null], + [[12, 38], 'FontName', 'sid', null] + ]; + var tables = null; + function CFFTopDict(strings) { + if (tables === null) { + tables = CFFDict.createTables(layout); + } + CFFDict.call(this, tables, strings); + this.privateDict = null; + } + CFFTopDict.prototype = Object.create(CFFDict.prototype); + return CFFTopDict; +})(); + +var CFFPrivateDict = (function CFFPrivateDictClosure() { + var layout = [ + [6, 'BlueValues', 'delta', null], + [7, 'OtherBlues', 'delta', null], + [8, 'FamilyBlues', 'delta', null], + [9, 'FamilyOtherBlues', 'delta', null], + [[12, 9], 'BlueScale', 'num', 0.039625], + [[12, 10], 'BlueShift', 'num', 7], + [[12, 11], 'BlueFuzz', 'num', 1], + [10, 'StdHW', 'num', null], + [11, 'StdVW', 'num', null], + [[12, 12], 'StemSnapH', 'delta', null], + [[12, 13], 'StemSnapV', 'delta', null], + [[12, 14], 'ForceBold', 'num', 0], + [[12, 17], 'LanguageGroup', 'num', 0], + [[12, 18], 'ExpansionFactor', 'num', 0.06], + [[12, 19], 'initialRandomSeed', 'num', 0], + [20, 'defaultWidthX', 'num', 0], + [21, 'nominalWidthX', 'num', 0], + [19, 'Subrs', 'offset', null] + ]; + var tables = null; + function CFFPrivateDict(strings) { + if (tables === null) { + tables = CFFDict.createTables(layout); + } + CFFDict.call(this, tables, strings); + this.subrsIndex = null; + } + CFFPrivateDict.prototype = Object.create(CFFDict.prototype); + return CFFPrivateDict; +})(); + +var CFFCharsetPredefinedTypes = { + ISO_ADOBE: 0, + EXPERT: 1, + EXPERT_SUBSET: 2 +}; +var CFFCharset = (function CFFCharsetClosure() { + function CFFCharset(predefined, format, charset, raw) { + this.predefined = predefined; + this.format = format; + this.charset = charset; + this.raw = raw; + } + return CFFCharset; +})(); + +var CFFEncoding = (function CFFEncodingClosure() { + function CFFEncoding(predefined, format, encoding, raw) { + this.predefined = predefined; + this.format = format; + this.encoding = encoding; + this.raw = raw; + } + return CFFEncoding; +})(); + +var CFFFDSelect = (function CFFFDSelectClosure() { + function CFFFDSelect(fdSelect, raw) { + this.fdSelect = fdSelect; + this.raw = raw; + } + return CFFFDSelect; +})(); + +// Helper class to keep track of where an offset is within the data and helps +// filling in that offset once it's known. +var CFFOffsetTracker = (function CFFOffsetTrackerClosure() { + function CFFOffsetTracker() { + this.offsets = {}; + } + CFFOffsetTracker.prototype = { + isTracking: function CFFOffsetTracker_isTracking(key) { + return key in this.offsets; + }, + track: function CFFOffsetTracker_track(key, location) { + if (key in this.offsets) { + error('Already tracking location of ' + key); + } + this.offsets[key] = location; + }, + offset: function CFFOffsetTracker_offset(value) { + for (var key in this.offsets) { + this.offsets[key] += value; + } + }, + setEntryLocation: function CFFOffsetTracker_setEntryLocation(key, + values, + output) { + if (!(key in this.offsets)) { + error('Not tracking location of ' + key); + } + var data = output.data; + var dataOffset = this.offsets[key]; + var size = 5; + for (var i = 0, ii = values.length; i < ii; ++i) { + var offset0 = i * size + dataOffset; + var offset1 = offset0 + 1; + var offset2 = offset0 + 2; + var offset3 = offset0 + 3; + var offset4 = offset0 + 4; + // It's easy to screw up offsets so perform this sanity check. + if (data[offset0] !== 0x1d || data[offset1] !== 0 || + data[offset2] !== 0 || data[offset3] !== 0 || data[offset4] !== 0) { + error('writing to an offset that is not empty'); + } + var value = values[i]; + data[offset0] = 0x1d; + data[offset1] = (value >> 24) & 0xFF; + data[offset2] = (value >> 16) & 0xFF; + data[offset3] = (value >> 8) & 0xFF; + data[offset4] = value & 0xFF; + } + } + }; + return CFFOffsetTracker; +})(); + +// Takes a CFF and converts it to the binary representation. +var CFFCompiler = (function CFFCompilerClosure() { + function CFFCompiler(cff) { + this.cff = cff; + } + CFFCompiler.prototype = { + compile: function CFFCompiler_compile() { + var cff = this.cff; + var output = { + data: [], + length: 0, + add: function CFFCompiler_add(data) { + this.data = this.data.concat(data); + this.length = this.data.length; + } + }; + + // Compile the five entries that must be in order. + var header = this.compileHeader(cff.header); + output.add(header); + + var nameIndex = this.compileNameIndex(cff.names); + output.add(nameIndex); + + if (cff.isCIDFont) { + // The spec is unclear on how font matrices should relate to each other + // when there is one in the main top dict and the sub top dicts. + // Windows handles this differently than linux and osx so we have to + // normalize to work on all. + // Rules based off of some mailing list discussions: + // - If main font has a matrix and subfont doesn't, use the main matrix. + // - If no main font matrix and there is a subfont matrix, use the + // subfont matrix. + // - If both have matrices, concat together. + // - If neither have matrices, use default. + // To make this work on all platforms we move the top matrix into each + // sub top dict and concat if necessary. + if (cff.topDict.hasName('FontMatrix')) { + var base = cff.topDict.getByName('FontMatrix'); + cff.topDict.removeByName('FontMatrix'); + for (var i = 0, ii = cff.fdArray.length; i < ii; i++) { + var subDict = cff.fdArray[i]; + var matrix = base.slice(0); + if (subDict.hasName('FontMatrix')) { + matrix = Util.transform(matrix, subDict.getByName('FontMatrix')); + } + subDict.setByName('FontMatrix', matrix); + } + } + } + + var compiled = this.compileTopDicts([cff.topDict], + output.length, + cff.isCIDFont); + output.add(compiled.output); + var topDictTracker = compiled.trackers[0]; + + var stringIndex = this.compileStringIndex(cff.strings.strings); + output.add(stringIndex); + + var globalSubrIndex = this.compileIndex(cff.globalSubrIndex); + output.add(globalSubrIndex); + + // Now start on the other entries that have no specfic order. + if (cff.encoding && cff.topDict.hasName('Encoding')) { + if (cff.encoding.predefined) { + topDictTracker.setEntryLocation('Encoding', [cff.encoding.format], + output); + } else { + var encoding = this.compileEncoding(cff.encoding); + topDictTracker.setEntryLocation('Encoding', [output.length], output); + output.add(encoding); + } + } + + if (cff.charset && cff.topDict.hasName('charset')) { + if (cff.charset.predefined) { + topDictTracker.setEntryLocation('charset', [cff.charset.format], + output); + } else { + var charset = this.compileCharset(cff.charset); + topDictTracker.setEntryLocation('charset', [output.length], output); + output.add(charset); + } + } + + var charStrings = this.compileCharStrings(cff.charStrings); + topDictTracker.setEntryLocation('CharStrings', [output.length], output); + output.add(charStrings); + + if (cff.isCIDFont) { + // For some reason FDSelect must be in front of FDArray on windows. OSX + // and linux don't seem to care. + topDictTracker.setEntryLocation('FDSelect', [output.length], output); + var fdSelect = this.compileFDSelect(cff.fdSelect.raw); + output.add(fdSelect); + // It is unclear if the sub font dictionary can have CID related + // dictionary keys, but the sanitizer doesn't like them so remove them. + compiled = this.compileTopDicts(cff.fdArray, output.length, true); + topDictTracker.setEntryLocation('FDArray', [output.length], output); + output.add(compiled.output); + var fontDictTrackers = compiled.trackers; + + this.compilePrivateDicts(cff.fdArray, fontDictTrackers, output); + } + + this.compilePrivateDicts([cff.topDict], [topDictTracker], output); + + // If the font data ends with INDEX whose object data is zero-length, + // the sanitizer will bail out. Add a dummy byte to avoid that. + output.add([0]); + + return output.data; + }, + encodeNumber: function CFFCompiler_encodeNumber(value) { + if (parseFloat(value) === parseInt(value, 10) && !isNaN(value)) { // isInt + return this.encodeInteger(value); + } else { + return this.encodeFloat(value); + } + }, + encodeFloat: function CFFCompiler_encodeFloat(num) { + var value = num.toString(); + + // rounding inaccurate doubles + var m = /\.(\d*?)(?:9{5,20}|0{5,20})\d{0,2}(?:e(.+)|$)/.exec(value); + if (m) { + var epsilon = parseFloat('1e' + ((m[2] ? +m[2] : 0) + m[1].length)); + value = (Math.round(num * epsilon) / epsilon).toString(); + } + + var nibbles = ''; + var i, ii; + for (i = 0, ii = value.length; i < ii; ++i) { + var a = value[i]; + if (a === 'e') { + nibbles += value[++i] === '-' ? 'c' : 'b'; + } else if (a === '.') { + nibbles += 'a'; + } else if (a === '-') { + nibbles += 'e'; + } else { + nibbles += a; + } + } + nibbles += (nibbles.length & 1) ? 'f' : 'ff'; + var out = [30]; + for (i = 0, ii = nibbles.length; i < ii; i += 2) { + out.push(parseInt(nibbles.substr(i, 2), 16)); + } + return out; + }, + encodeInteger: function CFFCompiler_encodeInteger(value) { + var code; + if (value >= -107 && value <= 107) { + code = [value + 139]; + } else if (value >= 108 && value <= 1131) { + value = [value - 108]; + code = [(value >> 8) + 247, value & 0xFF]; + } else if (value >= -1131 && value <= -108) { + value = -value - 108; + code = [(value >> 8) + 251, value & 0xFF]; + } else if (value >= -32768 && value <= 32767) { + code = [0x1c, (value >> 8) & 0xFF, value & 0xFF]; + } else { + code = [0x1d, + (value >> 24) & 0xFF, + (value >> 16) & 0xFF, + (value >> 8) & 0xFF, + value & 0xFF]; + } + return code; + }, + compileHeader: function CFFCompiler_compileHeader(header) { + return [ + header.major, + header.minor, + header.hdrSize, + header.offSize + ]; + }, + compileNameIndex: function CFFCompiler_compileNameIndex(names) { + var nameIndex = new CFFIndex(); + for (var i = 0, ii = names.length; i < ii; ++i) { + nameIndex.add(stringToBytes(names[i])); + } + return this.compileIndex(nameIndex); + }, + compileTopDicts: function CFFCompiler_compileTopDicts(dicts, + length, + removeCidKeys) { + var fontDictTrackers = []; + var fdArrayIndex = new CFFIndex(); + for (var i = 0, ii = dicts.length; i < ii; ++i) { + var fontDict = dicts[i]; + if (removeCidKeys) { + fontDict.removeByName('CIDFontVersion'); + fontDict.removeByName('CIDFontRevision'); + fontDict.removeByName('CIDFontType'); + fontDict.removeByName('CIDCount'); + fontDict.removeByName('UIDBase'); + } + var fontDictTracker = new CFFOffsetTracker(); + var fontDictData = this.compileDict(fontDict, fontDictTracker); + fontDictTrackers.push(fontDictTracker); + fdArrayIndex.add(fontDictData); + fontDictTracker.offset(length); + } + fdArrayIndex = this.compileIndex(fdArrayIndex, fontDictTrackers); + return { + trackers: fontDictTrackers, + output: fdArrayIndex + }; + }, + compilePrivateDicts: function CFFCompiler_compilePrivateDicts(dicts, + trackers, + output) { + for (var i = 0, ii = dicts.length; i < ii; ++i) { + var fontDict = dicts[i]; + assert(fontDict.privateDict && fontDict.hasName('Private'), + 'There must be an private dictionary.'); + var privateDict = fontDict.privateDict; + var privateDictTracker = new CFFOffsetTracker(); + var privateDictData = this.compileDict(privateDict, privateDictTracker); + + var outputLength = output.length; + privateDictTracker.offset(outputLength); + if (!privateDictData.length) { + // The private dictionary was empty, set the output length to zero to + // ensure the offset length isn't out of bounds in the eyes of the + // sanitizer. + outputLength = 0; + } + + trackers[i].setEntryLocation('Private', + [privateDictData.length, outputLength], + output); + output.add(privateDictData); + + if (privateDict.subrsIndex && privateDict.hasName('Subrs')) { + var subrs = this.compileIndex(privateDict.subrsIndex); + privateDictTracker.setEntryLocation('Subrs', [privateDictData.length], + output); + output.add(subrs); + } + } + }, + compileDict: function CFFCompiler_compileDict(dict, offsetTracker) { + var out = []; + // The dictionary keys must be in a certain order. + var order = dict.order; + for (var i = 0; i < order.length; ++i) { + var key = order[i]; + if (!(key in dict.values)) { + continue; + } + var values = dict.values[key]; + var types = dict.types[key]; + if (!isArray(types)) { + types = [types]; + } + if (!isArray(values)) { + values = [values]; + } + + // Remove any empty dict values. + if (values.length === 0) { + continue; + } + + for (var j = 0, jj = types.length; j < jj; ++j) { + var type = types[j]; + var value = values[j]; + switch (type) { + case 'num': + case 'sid': + out = out.concat(this.encodeNumber(value)); + break; + case 'offset': + // For offsets we just insert a 32bit integer so we don't have to + // deal with figuring out the length of the offset when it gets + // replaced later on by the compiler. + var name = dict.keyToNameMap[key]; + // Some offsets have the offset and the length, so just record the + // position of the first one. + if (!offsetTracker.isTracking(name)) { + offsetTracker.track(name, out.length); + } + out = out.concat([0x1d, 0, 0, 0, 0]); + break; + case 'array': + case 'delta': + out = out.concat(this.encodeNumber(value)); + for (var k = 1, kk = values.length; k < kk; ++k) { + out = out.concat(this.encodeNumber(values[k])); + } + break; + default: + error('Unknown data type of ' + type); + break; + } + } + out = out.concat(dict.opcodes[key]); + } + return out; + }, + compileStringIndex: function CFFCompiler_compileStringIndex(strings) { + var stringIndex = new CFFIndex(); + for (var i = 0, ii = strings.length; i < ii; ++i) { + stringIndex.add(stringToBytes(strings[i])); + } + return this.compileIndex(stringIndex); + }, + compileGlobalSubrIndex: function CFFCompiler_compileGlobalSubrIndex() { + var globalSubrIndex = this.cff.globalSubrIndex; + this.out.writeByteArray(this.compileIndex(globalSubrIndex)); + }, + compileCharStrings: function CFFCompiler_compileCharStrings(charStrings) { + return this.compileIndex(charStrings); + }, + compileCharset: function CFFCompiler_compileCharset(charset) { + return this.compileTypedArray(charset.raw); + }, + compileEncoding: function CFFCompiler_compileEncoding(encoding) { + return this.compileTypedArray(encoding.raw); + }, + compileFDSelect: function CFFCompiler_compileFDSelect(fdSelect) { + return this.compileTypedArray(fdSelect); + }, + compileTypedArray: function CFFCompiler_compileTypedArray(data) { + var out = []; + for (var i = 0, ii = data.length; i < ii; ++i) { + out[i] = data[i]; + } + return out; + }, + compileIndex: function CFFCompiler_compileIndex(index, trackers) { + trackers = trackers || []; + var objects = index.objects; + // First 2 bytes contains the number of objects contained into this index + var count = objects.length; + + // If there is no object, just create an index. This technically + // should just be [0, 0] but OTS has an issue with that. + if (count === 0) { + return [0, 0, 0]; + } + + var data = [(count >> 8) & 0xFF, count & 0xff]; + + var lastOffset = 1, i; + for (i = 0; i < count; ++i) { + lastOffset += objects[i].length; + } + + var offsetSize; + if (lastOffset < 0x100) { + offsetSize = 1; + } else if (lastOffset < 0x10000) { + offsetSize = 2; + } else if (lastOffset < 0x1000000) { + offsetSize = 3; + } else { + offsetSize = 4; + } + + // Next byte contains the offset size use to reference object in the file + data.push(offsetSize); + + // Add another offset after this one because we need a new offset + var relativeOffset = 1; + for (i = 0; i < count + 1; i++) { + if (offsetSize === 1) { + data.push(relativeOffset & 0xFF); + } else if (offsetSize === 2) { + data.push((relativeOffset >> 8) & 0xFF, + relativeOffset & 0xFF); + } else if (offsetSize === 3) { + data.push((relativeOffset >> 16) & 0xFF, + (relativeOffset >> 8) & 0xFF, + relativeOffset & 0xFF); + } else { + data.push((relativeOffset >>> 24) & 0xFF, + (relativeOffset >> 16) & 0xFF, + (relativeOffset >> 8) & 0xFF, + relativeOffset & 0xFF); + } + + if (objects[i]) { + relativeOffset += objects[i].length; + } + } + + for (i = 0; i < count; i++) { + // Notify the tracker where the object will be offset in the data. + if (trackers[i]) { + trackers[i].offset(data.length); + } + for (var j = 0, jj = objects[i].length; j < jj; j++) { + data.push(objects[i][j]); + } + } + return data; + } + }; + return CFFCompiler; +})(); + +// Workaround for seac on Windows. +(function checkSeacSupport() { + if (/Windows/.test(navigator.userAgent)) { + SEAC_ANALYSIS_ENABLED = true; + } +})(); + +// Workaround for Private Use Area characters in Chrome on Windows +// http://code.google.com/p/chromium/issues/detail?id=122465 +// https://github.com/mozilla/pdf.js/issues/1689 +(function checkChromeWindows() { + if (/Windows.*Chrome/.test(navigator.userAgent)) { + SKIP_PRIVATE_USE_RANGE_F000_TO_F01F = true; + } +})(); + + +var FontRendererFactory = (function FontRendererFactoryClosure() { + function getLong(data, offset) { + return (data[offset] << 24) | (data[offset + 1] << 16) | + (data[offset + 2] << 8) | data[offset + 3]; + } + + function getUshort(data, offset) { + return (data[offset] << 8) | data[offset + 1]; + } + + function parseCmap(data, start, end) { + var offset = (getUshort(data, start + 2) === 1 ? + getLong(data, start + 8) : getLong(data, start + 16)); + var format = getUshort(data, start + offset); + var length, ranges, p, i; + if (format === 4) { + length = getUshort(data, start + offset + 2); + var segCount = getUshort(data, start + offset + 6) >> 1; + p = start + offset + 14; + ranges = []; + for (i = 0; i < segCount; i++, p += 2) { + ranges[i] = {end: getUshort(data, p)}; + } + p += 2; + for (i = 0; i < segCount; i++, p += 2) { + ranges[i].start = getUshort(data, p); + } + for (i = 0; i < segCount; i++, p += 2) { + ranges[i].idDelta = getUshort(data, p); + } + for (i = 0; i < segCount; i++, p += 2) { + var idOffset = getUshort(data, p); + if (idOffset === 0) { + continue; + } + ranges[i].ids = []; + for (var j = 0, jj = ranges[i].end - ranges[i].start + 1; j < jj; j++) { + ranges[i].ids[j] = getUshort(data, p + idOffset); + idOffset += 2; + } + } + return ranges; + } else if (format === 12) { + length = getLong(data, start + offset + 4); + var groups = getLong(data, start + offset + 12); + p = start + offset + 16; + ranges = []; + for (i = 0; i < groups; i++) { + ranges.push({ + start: getLong(data, p), + end: getLong(data, p + 4), + idDelta: getLong(data, p + 8) - getLong(data, p) + }); + p += 12; + } + return ranges; + } + error('not supported cmap: ' + format); + } + + function parseCff(data, start, end) { + var properties = {}; + var parser = new CFFParser(new Stream(data, start, end - start), + properties); + var cff = parser.parse(); + return { + glyphs: cff.charStrings.objects, + subrs: (cff.topDict.privateDict && cff.topDict.privateDict.subrsIndex && + cff.topDict.privateDict.subrsIndex.objects), + gsubrs: cff.globalSubrIndex && cff.globalSubrIndex.objects + }; + } + + function parseGlyfTable(glyf, loca, isGlyphLocationsLong) { + var itemSize, itemDecode; + if (isGlyphLocationsLong) { + itemSize = 4; + itemDecode = function fontItemDecodeLong(data, offset) { + return (data[offset] << 24) | (data[offset + 1] << 16) | + (data[offset + 2] << 8) | data[offset + 3]; + }; + } else { + itemSize = 2; + itemDecode = function fontItemDecode(data, offset) { + return (data[offset] << 9) | (data[offset + 1] << 1); + }; + } + var glyphs = []; + var startOffset = itemDecode(loca, 0); + for (var j = itemSize; j < loca.length; j += itemSize) { + var endOffset = itemDecode(loca, j); + glyphs.push(glyf.subarray(startOffset, endOffset)); + startOffset = endOffset; + } + return glyphs; + } + + function lookupCmap(ranges, unicode) { + var code = unicode.charCodeAt(0); + var l = 0, r = ranges.length - 1; + while (l < r) { + var c = (l + r + 1) >> 1; + if (code < ranges[c].start) { + r = c - 1; + } else { + l = c; + } + } + if (ranges[l].start <= code && code <= ranges[l].end) { + return (ranges[l].idDelta + (ranges[l].ids ? + ranges[l].ids[code - ranges[l].start] : code)) & 0xFFFF; + } + return 0; + } + + function compileGlyf(code, cmds, font) { + function moveTo(x, y) { + cmds.push({cmd: 'moveTo', args: [x, y]}); + } + function lineTo(x, y) { + cmds.push({cmd: 'lineTo', args: [x, y]}); + } + function quadraticCurveTo(xa, ya, x, y) { + cmds.push({cmd: 'quadraticCurveTo', args: [xa, ya, x, y]}); + } + + var i = 0; + var numberOfContours = ((code[i] << 24) | (code[i + 1] << 16)) >> 16; + var flags; + var x = 0, y = 0; + i += 10; + if (numberOfContours < 0) { + // composite glyph + do { + flags = (code[i] << 8) | code[i + 1]; + var glyphIndex = (code[i + 2] << 8) | code[i + 3]; + i += 4; + var arg1, arg2; + if ((flags & 0x01)) { + arg1 = ((code[i] << 24) | (code[i + 1] << 16)) >> 16; + arg2 = ((code[i + 2] << 24) | (code[i + 3] << 16)) >> 16; + i += 4; + } else { + arg1 = code[i++]; arg2 = code[i++]; + } + if ((flags & 0x02)) { + x = arg1; + y = arg2; + } else { + x = 0; y = 0; // TODO "they are points" ? + } + var scaleX = 1, scaleY = 1, scale01 = 0, scale10 = 0; + if ((flags & 0x08)) { + scaleX = + scaleY = ((code[i] << 24) | (code[i + 1] << 16)) / 1073741824; + i += 2; + } else if ((flags & 0x40)) { + scaleX = ((code[i] << 24) | (code[i + 1] << 16)) / 1073741824; + scaleY = ((code[i + 2] << 24) | (code[i + 3] << 16)) / 1073741824; + i += 4; + } else if ((flags & 0x80)) { + scaleX = ((code[i] << 24) | (code[i + 1] << 16)) / 1073741824; + scale01 = ((code[i + 2] << 24) | (code[i + 3] << 16)) / 1073741824; + scale10 = ((code[i + 4] << 24) | (code[i + 5] << 16)) / 1073741824; + scaleY = ((code[i + 6] << 24) | (code[i + 7] << 16)) / 1073741824; + i += 8; + } + var subglyph = font.glyphs[glyphIndex]; + if (subglyph) { + cmds.push({cmd: 'save'}); + cmds.push({cmd: 'transform', + args: [scaleX, scale01, scale10, scaleY, x, y]}); + compileGlyf(subglyph, cmds, font); + cmds.push({cmd: 'restore'}); + } + } while ((flags & 0x20)); + } else { + // simple glyph + var endPtsOfContours = []; + var j, jj; + for (j = 0; j < numberOfContours; j++) { + endPtsOfContours.push((code[i] << 8) | code[i + 1]); + i += 2; + } + var instructionLength = (code[i] << 8) | code[i + 1]; + i += 2 + instructionLength; // skipping the instructions + var numberOfPoints = endPtsOfContours[endPtsOfContours.length - 1] + 1; + var points = []; + while (points.length < numberOfPoints) { + flags = code[i++]; + var repeat = 1; + if ((flags & 0x08)) { + repeat += code[i++]; + } + while (repeat-- > 0) { + points.push({flags: flags}); + } + } + for (j = 0; j < numberOfPoints; j++) { + switch (points[j].flags & 0x12) { + case 0x00: + x += ((code[i] << 24) | (code[i + 1] << 16)) >> 16; + i += 2; + break; + case 0x02: + x -= code[i++]; + break; + case 0x12: + x += code[i++]; + break; + } + points[j].x = x; + } + for (j = 0; j < numberOfPoints; j++) { + switch (points[j].flags & 0x24) { + case 0x00: + y += ((code[i] << 24) | (code[i + 1] << 16)) >> 16; + i += 2; + break; + case 0x04: + y -= code[i++]; + break; + case 0x24: + y += code[i++]; + break; + } + points[j].y = y; + } + + var startPoint = 0; + for (i = 0; i < numberOfContours; i++) { + var endPoint = endPtsOfContours[i]; + // contours might have implicit points, which is located in the middle + // between two neighboring off-curve points + var contour = points.slice(startPoint, endPoint + 1); + if ((contour[0].flags & 1)) { + contour.push(contour[0]); // using start point at the contour end + } else if ((contour[contour.length - 1].flags & 1)) { + // first is off-curve point, trying to use one from the end + contour.unshift(contour[contour.length - 1]); + } else { + // start and end are off-curve points, creating implicit one + var p = { + flags: 1, + x: (contour[0].x + contour[contour.length - 1].x) / 2, + y: (contour[0].y + contour[contour.length - 1].y) / 2 + }; + contour.unshift(p); + contour.push(p); + } + moveTo(contour[0].x, contour[0].y); + for (j = 1, jj = contour.length; j < jj; j++) { + if ((contour[j].flags & 1)) { + lineTo(contour[j].x, contour[j].y); + } else if ((contour[j + 1].flags & 1)){ + quadraticCurveTo(contour[j].x, contour[j].y, + contour[j + 1].x, contour[j + 1].y); + j++; + } else { + quadraticCurveTo(contour[j].x, contour[j].y, + (contour[j].x + contour[j + 1].x) / 2, + (contour[j].y + contour[j + 1].y) / 2); + } + } + startPoint = endPoint + 1; + } + } + } + + function compileCharString(code, cmds, font) { + var stack = []; + var x = 0, y = 0; + var stems = 0; + + function moveTo(x, y) { + cmds.push({cmd: 'moveTo', args: [x, y]}); + } + function lineTo(x, y) { + cmds.push({cmd: 'lineTo', args: [x, y]}); + } + function bezierCurveTo(x1, y1, x2, y2, x, y) { + cmds.push({cmd: 'bezierCurveTo', args: [x1, y1, x2, y2, x, y]}); + } + + function parse(code) { + var i = 0; + while (i < code.length) { + var stackClean = false; + var v = code[i++]; + var xa, xb, ya, yb, y1, y2, y3, n, subrCode; + switch (v) { + case 1: // hstem + stems += stack.length >> 1; + stackClean = true; + break; + case 3: // vstem + stems += stack.length >> 1; + stackClean = true; + break; + case 4: // vmoveto + y += stack.pop(); + moveTo(x, y); + stackClean = true; + break; + case 5: // rlineto + while (stack.length > 0) { + x += stack.shift(); + y += stack.shift(); + lineTo(x, y); + } + break; + case 6: // hlineto + while (stack.length > 0) { + x += stack.shift(); + lineTo(x, y); + if (stack.length === 0) { + break; + } + y += stack.shift(); + lineTo(x, y); + } + break; + case 7: // vlineto + while (stack.length > 0) { + y += stack.shift(); + lineTo(x, y); + if (stack.length === 0) { + break; + } + x += stack.shift(); + lineTo(x, y); + } + break; + case 8: // rrcurveto + while (stack.length > 0) { + xa = x + stack.shift(); ya = y + stack.shift(); + xb = xa + stack.shift(); yb = ya + stack.shift(); + x = xb + stack.shift(); y = yb + stack.shift(); + bezierCurveTo(xa, ya, xb, yb, x, y); + } + break; + case 10: // callsubr + n = stack.pop() + font.subrsBias; + subrCode = font.subrs[n]; + if (subrCode) { + parse(subrCode); + } + break; + case 11: // return + return; + case 12: + v = code[i++]; + switch (v) { + case 34: // flex + xa = x + stack.shift(); + xb = xa + stack.shift(); y1 = y + stack.shift(); + x = xb + stack.shift(); + bezierCurveTo(xa, y, xb, y1, x, y1); + xa = x + stack.shift(); + xb = xa + stack.shift(); + x = xb + stack.shift(); + bezierCurveTo(xa, y1, xb, y, x, y); + break; + case 35: // flex + xa = x + stack.shift(); ya = y + stack.shift(); + xb = xa + stack.shift(); yb = ya + stack.shift(); + x = xb + stack.shift(); y = yb + stack.shift(); + bezierCurveTo(xa, ya, xb, yb, x, y); + xa = x + stack.shift(); ya = y + stack.shift(); + xb = xa + stack.shift(); yb = ya + stack.shift(); + x = xb + stack.shift(); y = yb + stack.shift(); + bezierCurveTo(xa, ya, xb, yb, x, y); + stack.pop(); // fd + break; + case 36: // hflex1 + xa = x + stack.shift(); y1 = y + stack.shift(); + xb = xa + stack.shift(); y2 = y1 + stack.shift(); + x = xb + stack.shift(); + bezierCurveTo(xa, y1, xb, y2, x, y2); + xa = x + stack.shift(); + xb = xa + stack.shift(); y3 = y2 + stack.shift(); + x = xb + stack.shift(); + bezierCurveTo(xa, y2, xb, y3, x, y); + break; + case 37: // flex1 + var x0 = x, y0 = y; + xa = x + stack.shift(); ya = y + stack.shift(); + xb = xa + stack.shift(); yb = ya + stack.shift(); + x = xb + stack.shift(); y = yb + stack.shift(); + bezierCurveTo(xa, ya, xb, yb, x, y); + xa = x + stack.shift(); ya = y + stack.shift(); + xb = xa + stack.shift(); yb = ya + stack.shift(); + x = xb; y = yb; + if (Math.abs(x - x0) > Math.abs(y - y0)) { + x += stack.shift(); + } else { + y += stack.shift(); + } + bezierCurveTo(xa, ya, xb, yb, x, y); + break; + default: + error('unknown operator: 12 ' + v); + } + break; + case 14: // endchar + if (stack.length >= 4) { + var achar = stack.pop(); + var bchar = stack.pop(); + y = stack.pop(); + x = stack.pop(); + cmds.push({cmd: 'save'}); + cmds.push({cmd: 'translate', args: [x, y]}); + var gid = lookupCmap(font.cmap, String.fromCharCode( + font.glyphNameMap[Encodings.StandardEncoding[achar]])); + compileCharString(font.glyphs[gid], cmds, font); + cmds.push({cmd: 'restore'}); + + gid = lookupCmap(font.cmap, String.fromCharCode( + font.glyphNameMap[Encodings.StandardEncoding[bchar]])); + compileCharString(font.glyphs[gid], cmds, font); + } + return; + case 18: // hstemhm + stems += stack.length >> 1; + stackClean = true; + break; + case 19: // hintmask + stems += stack.length >> 1; + i += (stems + 7) >> 3; + stackClean = true; + break; + case 20: // cntrmask + stems += stack.length >> 1; + i += (stems + 7) >> 3; + stackClean = true; + break; + case 21: // rmoveto + y += stack.pop(); + x += stack.pop(); + moveTo(x, y); + stackClean = true; + break; + case 22: // hmoveto + x += stack.pop(); + moveTo(x, y); + stackClean = true; + break; + case 23: // vstemhm + stems += stack.length >> 1; + stackClean = true; + break; + case 24: // rcurveline + while (stack.length > 2) { + xa = x + stack.shift(); ya = y + stack.shift(); + xb = xa + stack.shift(); yb = ya + stack.shift(); + x = xb + stack.shift(); y = yb + stack.shift(); + bezierCurveTo(xa, ya, xb, yb, x, y); + } + x += stack.shift(); + y += stack.shift(); + lineTo(x, y); + break; + case 25: // rlinecurve + while (stack.length > 6) { + x += stack.shift(); + y += stack.shift(); + lineTo(x, y); + } + xa = x + stack.shift(); ya = y + stack.shift(); + xb = xa + stack.shift(); yb = ya + stack.shift(); + x = xb + stack.shift(); y = yb + stack.shift(); + bezierCurveTo(xa, ya, xb, yb, x, y); + break; + case 26: // vvcurveto + if (stack.length % 2) { + x += stack.shift(); + } + while (stack.length > 0) { + xa = x; ya = y + stack.shift(); + xb = xa + stack.shift(); yb = ya + stack.shift(); + x = xb; y = yb + stack.shift(); + bezierCurveTo(xa, ya, xb, yb, x, y); + } + break; + case 27: // hhcurveto + if (stack.length % 2) { + y += stack.shift(); + } + while (stack.length > 0) { + xa = x + stack.shift(); ya = y; + xb = xa + stack.shift(); yb = ya + stack.shift(); + x = xb + stack.shift(); y = yb; + bezierCurveTo(xa, ya, xb, yb, x, y); + } + break; + case 28: + stack.push(((code[i] << 24) | (code[i + 1] << 16)) >> 16); + i += 2; + break; + case 29: // callgsubr + n = stack.pop() + font.gsubrsBias; + subrCode = font.gsubrs[n]; + if (subrCode) { + parse(subrCode); + } + break; + case 30: // vhcurveto + while (stack.length > 0) { + xa = x; ya = y + stack.shift(); + xb = xa + stack.shift(); yb = ya + stack.shift(); + x = xb + stack.shift(); + y = yb + (stack.length === 1 ? stack.shift() : 0); + bezierCurveTo(xa, ya, xb, yb, x, y); + if (stack.length === 0) { + break; + } + + xa = x + stack.shift(); ya = y; + xb = xa + stack.shift(); yb = ya + stack.shift(); + y = yb + stack.shift(); + x = xb + (stack.length === 1 ? stack.shift() : 0); + bezierCurveTo(xa, ya, xb, yb, x, y); + } + break; + case 31: // hvcurveto + while (stack.length > 0) { + xa = x + stack.shift(); ya = y; + xb = xa + stack.shift(); yb = ya + stack.shift(); + y = yb + stack.shift(); + x = xb + (stack.length === 1 ? stack.shift() : 0); + bezierCurveTo(xa, ya, xb, yb, x, y); + if (stack.length === 0) { + break; + } + + xa = x; ya = y + stack.shift(); + xb = xa + stack.shift(); yb = ya + stack.shift(); + x = xb + stack.shift(); + y = yb + (stack.length === 1 ? stack.shift() : 0); + bezierCurveTo(xa, ya, xb, yb, x, y); + } + break; + default: + if (v < 32) { + error('unknown operator: ' + v); + } + if (v < 247) { + stack.push(v - 139); + } else if (v < 251) { + stack.push((v - 247) * 256 + code[i++] + 108); + } else if (v < 255) { + stack.push(-(v - 251) * 256 - code[i++] - 108); + } else { + stack.push(((code[i] << 24) | (code[i + 1] << 16) | + (code[i + 2] << 8) | code[i + 3]) / 65536); + i += 4; + } + break; + } + if (stackClean) { + stack.length = 0; + } + } + } + parse(code); + } + + var noop = ''; + + function CompiledFont(fontMatrix) { + this.compiledGlyphs = {}; + this.fontMatrix = fontMatrix; + } + CompiledFont.prototype = { + getPathJs: function (unicode) { + var gid = lookupCmap(this.cmap, unicode); + var fn = this.compiledGlyphs[gid]; + if (!fn) { + this.compiledGlyphs[gid] = fn = this.compileGlyph(this.glyphs[gid]); + } + return fn; + }, + + compileGlyph: function (code) { + if (!code || code.length === 0 || code[0] === 14) { + return noop; + } + + var cmds = []; + cmds.push({cmd: 'save'}); + cmds.push({cmd: 'transform', args: this.fontMatrix.slice()}); + cmds.push({cmd: 'scale', args: ['size', '-size']}); + + this.compileGlyphImpl(code, cmds); + + cmds.push({cmd: 'restore'}); + + return cmds; + }, + + compileGlyphImpl: function () { + error('Children classes should implement this.'); + }, + + hasBuiltPath: function (unicode) { + var gid = lookupCmap(this.cmap, unicode); + return gid in this.compiledGlyphs; + } + }; + + function TrueTypeCompiled(glyphs, cmap, fontMatrix) { + fontMatrix = fontMatrix || [0.000488, 0, 0, 0.000488, 0, 0]; + CompiledFont.call(this, fontMatrix); + + this.glyphs = glyphs; + this.cmap = cmap; + + this.compiledGlyphs = []; + } + + Util.inherit(TrueTypeCompiled, CompiledFont, { + compileGlyphImpl: function (code, cmds) { + compileGlyf(code, cmds, this); + } + }); + + function Type2Compiled(cffInfo, cmap, fontMatrix, glyphNameMap) { + fontMatrix = fontMatrix || [0.001, 0, 0, 0.001, 0, 0]; + CompiledFont.call(this, fontMatrix); + this.glyphs = cffInfo.glyphs; + this.gsubrs = cffInfo.gsubrs || []; + this.subrs = cffInfo.subrs || []; + this.cmap = cmap; + this.glyphNameMap = glyphNameMap || GlyphsUnicode; + + this.compiledGlyphs = []; + this.gsubrsBias = (this.gsubrs.length < 1240 ? + 107 : (this.gsubrs.length < 33900 ? 1131 : 32768)); + this.subrsBias = (this.subrs.length < 1240 ? + 107 : (this.subrs.length < 33900 ? 1131 : 32768)); + } + + Util.inherit(Type2Compiled, CompiledFont, { + compileGlyphImpl: function (code, cmds) { + compileCharString(code, cmds, this); + } + }); + + + return { + create: function FontRendererFactory_create(font) { + var data = new Uint8Array(font.data); + var cmap, glyf, loca, cff, indexToLocFormat, unitsPerEm; + var numTables = getUshort(data, 4); + for (var i = 0, p = 12; i < numTables; i++, p += 16) { + var tag = bytesToString(data.subarray(p, p + 4)); + var offset = getLong(data, p + 8); + var length = getLong(data, p + 12); + switch (tag) { + case 'cmap': + cmap = parseCmap(data, offset, offset + length); + break; + case 'glyf': + glyf = data.subarray(offset, offset + length); + break; + case 'loca': + loca = data.subarray(offset, offset + length); + break; + case 'head': + unitsPerEm = getUshort(data, offset + 18); + indexToLocFormat = getUshort(data, offset + 50); + break; + case 'CFF ': + cff = parseCff(data, offset, offset + length); + break; + } + } + + if (glyf) { + var fontMatrix = (!unitsPerEm ? font.fontMatrix : + [1 / unitsPerEm, 0, 0, 1 / unitsPerEm, 0, 0]); + return new TrueTypeCompiled( + parseGlyfTable(glyf, loca, indexToLocFormat), cmap, fontMatrix); + } else { + return new Type2Compiled(cff, cmap, font.fontMatrix, font.glyphNameMap); + } + } + }; +})(); + + +var GlyphsUnicode = { + A: 0x0041, + AE: 0x00C6, + AEacute: 0x01FC, + AEmacron: 0x01E2, + AEsmall: 0xF7E6, + Aacute: 0x00C1, + Aacutesmall: 0xF7E1, + Abreve: 0x0102, + Abreveacute: 0x1EAE, + Abrevecyrillic: 0x04D0, + Abrevedotbelow: 0x1EB6, + Abrevegrave: 0x1EB0, + Abrevehookabove: 0x1EB2, + Abrevetilde: 0x1EB4, + Acaron: 0x01CD, + Acircle: 0x24B6, + Acircumflex: 0x00C2, + Acircumflexacute: 0x1EA4, + Acircumflexdotbelow: 0x1EAC, + Acircumflexgrave: 0x1EA6, + Acircumflexhookabove: 0x1EA8, + Acircumflexsmall: 0xF7E2, + Acircumflextilde: 0x1EAA, + Acute: 0xF6C9, + Acutesmall: 0xF7B4, + Acyrillic: 0x0410, + Adblgrave: 0x0200, + Adieresis: 0x00C4, + Adieresiscyrillic: 0x04D2, + Adieresismacron: 0x01DE, + Adieresissmall: 0xF7E4, + Adotbelow: 0x1EA0, + Adotmacron: 0x01E0, + Agrave: 0x00C0, + Agravesmall: 0xF7E0, + Ahookabove: 0x1EA2, + Aiecyrillic: 0x04D4, + Ainvertedbreve: 0x0202, + Alpha: 0x0391, + Alphatonos: 0x0386, + Amacron: 0x0100, + Amonospace: 0xFF21, + Aogonek: 0x0104, + Aring: 0x00C5, + Aringacute: 0x01FA, + Aringbelow: 0x1E00, + Aringsmall: 0xF7E5, + Asmall: 0xF761, + Atilde: 0x00C3, + Atildesmall: 0xF7E3, + Aybarmenian: 0x0531, + B: 0x0042, + Bcircle: 0x24B7, + Bdotaccent: 0x1E02, + Bdotbelow: 0x1E04, + Becyrillic: 0x0411, + Benarmenian: 0x0532, + Beta: 0x0392, + Bhook: 0x0181, + Blinebelow: 0x1E06, + Bmonospace: 0xFF22, + Brevesmall: 0xF6F4, + Bsmall: 0xF762, + Btopbar: 0x0182, + C: 0x0043, + Caarmenian: 0x053E, + Cacute: 0x0106, + Caron: 0xF6CA, + Caronsmall: 0xF6F5, + Ccaron: 0x010C, + Ccedilla: 0x00C7, + Ccedillaacute: 0x1E08, + Ccedillasmall: 0xF7E7, + Ccircle: 0x24B8, + Ccircumflex: 0x0108, + Cdot: 0x010A, + Cdotaccent: 0x010A, + Cedillasmall: 0xF7B8, + Chaarmenian: 0x0549, + Cheabkhasiancyrillic: 0x04BC, + Checyrillic: 0x0427, + Chedescenderabkhasiancyrillic: 0x04BE, + Chedescendercyrillic: 0x04B6, + Chedieresiscyrillic: 0x04F4, + Cheharmenian: 0x0543, + Chekhakassiancyrillic: 0x04CB, + Cheverticalstrokecyrillic: 0x04B8, + Chi: 0x03A7, + Chook: 0x0187, + Circumflexsmall: 0xF6F6, + Cmonospace: 0xFF23, + Coarmenian: 0x0551, + Csmall: 0xF763, + D: 0x0044, + DZ: 0x01F1, + DZcaron: 0x01C4, + Daarmenian: 0x0534, + Dafrican: 0x0189, + Dcaron: 0x010E, + Dcedilla: 0x1E10, + Dcircle: 0x24B9, + Dcircumflexbelow: 0x1E12, + Dcroat: 0x0110, + Ddotaccent: 0x1E0A, + Ddotbelow: 0x1E0C, + Decyrillic: 0x0414, + Deicoptic: 0x03EE, + Delta: 0x2206, + Deltagreek: 0x0394, + Dhook: 0x018A, + Dieresis: 0xF6CB, + DieresisAcute: 0xF6CC, + DieresisGrave: 0xF6CD, + Dieresissmall: 0xF7A8, + Digammagreek: 0x03DC, + Djecyrillic: 0x0402, + Dlinebelow: 0x1E0E, + Dmonospace: 0xFF24, + Dotaccentsmall: 0xF6F7, + Dslash: 0x0110, + Dsmall: 0xF764, + Dtopbar: 0x018B, + Dz: 0x01F2, + Dzcaron: 0x01C5, + Dzeabkhasiancyrillic: 0x04E0, + Dzecyrillic: 0x0405, + Dzhecyrillic: 0x040F, + E: 0x0045, + Eacute: 0x00C9, + Eacutesmall: 0xF7E9, + Ebreve: 0x0114, + Ecaron: 0x011A, + Ecedillabreve: 0x1E1C, + Echarmenian: 0x0535, + Ecircle: 0x24BA, + Ecircumflex: 0x00CA, + Ecircumflexacute: 0x1EBE, + Ecircumflexbelow: 0x1E18, + Ecircumflexdotbelow: 0x1EC6, + Ecircumflexgrave: 0x1EC0, + Ecircumflexhookabove: 0x1EC2, + Ecircumflexsmall: 0xF7EA, + Ecircumflextilde: 0x1EC4, + Ecyrillic: 0x0404, + Edblgrave: 0x0204, + Edieresis: 0x00CB, + Edieresissmall: 0xF7EB, + Edot: 0x0116, + Edotaccent: 0x0116, + Edotbelow: 0x1EB8, + Efcyrillic: 0x0424, + Egrave: 0x00C8, + Egravesmall: 0xF7E8, + Eharmenian: 0x0537, + Ehookabove: 0x1EBA, + Eightroman: 0x2167, + Einvertedbreve: 0x0206, + Eiotifiedcyrillic: 0x0464, + Elcyrillic: 0x041B, + Elevenroman: 0x216A, + Emacron: 0x0112, + Emacronacute: 0x1E16, + Emacrongrave: 0x1E14, + Emcyrillic: 0x041C, + Emonospace: 0xFF25, + Encyrillic: 0x041D, + Endescendercyrillic: 0x04A2, + Eng: 0x014A, + Enghecyrillic: 0x04A4, + Enhookcyrillic: 0x04C7, + Eogonek: 0x0118, + Eopen: 0x0190, + Epsilon: 0x0395, + Epsilontonos: 0x0388, + Ercyrillic: 0x0420, + Ereversed: 0x018E, + Ereversedcyrillic: 0x042D, + Escyrillic: 0x0421, + Esdescendercyrillic: 0x04AA, + Esh: 0x01A9, + Esmall: 0xF765, + Eta: 0x0397, + Etarmenian: 0x0538, + Etatonos: 0x0389, + Eth: 0x00D0, + Ethsmall: 0xF7F0, + Etilde: 0x1EBC, + Etildebelow: 0x1E1A, + Euro: 0x20AC, + Ezh: 0x01B7, + Ezhcaron: 0x01EE, + Ezhreversed: 0x01B8, + F: 0x0046, + Fcircle: 0x24BB, + Fdotaccent: 0x1E1E, + Feharmenian: 0x0556, + Feicoptic: 0x03E4, + Fhook: 0x0191, + Fitacyrillic: 0x0472, + Fiveroman: 0x2164, + Fmonospace: 0xFF26, + Fourroman: 0x2163, + Fsmall: 0xF766, + G: 0x0047, + GBsquare: 0x3387, + Gacute: 0x01F4, + Gamma: 0x0393, + Gammaafrican: 0x0194, + Gangiacoptic: 0x03EA, + Gbreve: 0x011E, + Gcaron: 0x01E6, + Gcedilla: 0x0122, + Gcircle: 0x24BC, + Gcircumflex: 0x011C, + Gcommaaccent: 0x0122, + Gdot: 0x0120, + Gdotaccent: 0x0120, + Gecyrillic: 0x0413, + Ghadarmenian: 0x0542, + Ghemiddlehookcyrillic: 0x0494, + Ghestrokecyrillic: 0x0492, + Gheupturncyrillic: 0x0490, + Ghook: 0x0193, + Gimarmenian: 0x0533, + Gjecyrillic: 0x0403, + Gmacron: 0x1E20, + Gmonospace: 0xFF27, + Grave: 0xF6CE, + Gravesmall: 0xF760, + Gsmall: 0xF767, + Gsmallhook: 0x029B, + Gstroke: 0x01E4, + H: 0x0048, + H18533: 0x25CF, + H18543: 0x25AA, + H18551: 0x25AB, + H22073: 0x25A1, + HPsquare: 0x33CB, + Haabkhasiancyrillic: 0x04A8, + Hadescendercyrillic: 0x04B2, + Hardsigncyrillic: 0x042A, + Hbar: 0x0126, + Hbrevebelow: 0x1E2A, + Hcedilla: 0x1E28, + Hcircle: 0x24BD, + Hcircumflex: 0x0124, + Hdieresis: 0x1E26, + Hdotaccent: 0x1E22, + Hdotbelow: 0x1E24, + Hmonospace: 0xFF28, + Hoarmenian: 0x0540, + Horicoptic: 0x03E8, + Hsmall: 0xF768, + Hungarumlaut: 0xF6CF, + Hungarumlautsmall: 0xF6F8, + Hzsquare: 0x3390, + I: 0x0049, + IAcyrillic: 0x042F, + IJ: 0x0132, + IUcyrillic: 0x042E, + Iacute: 0x00CD, + Iacutesmall: 0xF7ED, + Ibreve: 0x012C, + Icaron: 0x01CF, + Icircle: 0x24BE, + Icircumflex: 0x00CE, + Icircumflexsmall: 0xF7EE, + Icyrillic: 0x0406, + Idblgrave: 0x0208, + Idieresis: 0x00CF, + Idieresisacute: 0x1E2E, + Idieresiscyrillic: 0x04E4, + Idieresissmall: 0xF7EF, + Idot: 0x0130, + Idotaccent: 0x0130, + Idotbelow: 0x1ECA, + Iebrevecyrillic: 0x04D6, + Iecyrillic: 0x0415, + Ifraktur: 0x2111, + Igrave: 0x00CC, + Igravesmall: 0xF7EC, + Ihookabove: 0x1EC8, + Iicyrillic: 0x0418, + Iinvertedbreve: 0x020A, + Iishortcyrillic: 0x0419, + Imacron: 0x012A, + Imacroncyrillic: 0x04E2, + Imonospace: 0xFF29, + Iniarmenian: 0x053B, + Iocyrillic: 0x0401, + Iogonek: 0x012E, + Iota: 0x0399, + Iotaafrican: 0x0196, + Iotadieresis: 0x03AA, + Iotatonos: 0x038A, + Ismall: 0xF769, + Istroke: 0x0197, + Itilde: 0x0128, + Itildebelow: 0x1E2C, + Izhitsacyrillic: 0x0474, + Izhitsadblgravecyrillic: 0x0476, + J: 0x004A, + Jaarmenian: 0x0541, + Jcircle: 0x24BF, + Jcircumflex: 0x0134, + Jecyrillic: 0x0408, + Jheharmenian: 0x054B, + Jmonospace: 0xFF2A, + Jsmall: 0xF76A, + K: 0x004B, + KBsquare: 0x3385, + KKsquare: 0x33CD, + Kabashkircyrillic: 0x04A0, + Kacute: 0x1E30, + Kacyrillic: 0x041A, + Kadescendercyrillic: 0x049A, + Kahookcyrillic: 0x04C3, + Kappa: 0x039A, + Kastrokecyrillic: 0x049E, + Kaverticalstrokecyrillic: 0x049C, + Kcaron: 0x01E8, + Kcedilla: 0x0136, + Kcircle: 0x24C0, + Kcommaaccent: 0x0136, + Kdotbelow: 0x1E32, + Keharmenian: 0x0554, + Kenarmenian: 0x053F, + Khacyrillic: 0x0425, + Kheicoptic: 0x03E6, + Khook: 0x0198, + Kjecyrillic: 0x040C, + Klinebelow: 0x1E34, + Kmonospace: 0xFF2B, + Koppacyrillic: 0x0480, + Koppagreek: 0x03DE, + Ksicyrillic: 0x046E, + Ksmall: 0xF76B, + L: 0x004C, + LJ: 0x01C7, + LL: 0xF6BF, + Lacute: 0x0139, + Lambda: 0x039B, + Lcaron: 0x013D, + Lcedilla: 0x013B, + Lcircle: 0x24C1, + Lcircumflexbelow: 0x1E3C, + Lcommaaccent: 0x013B, + Ldot: 0x013F, + Ldotaccent: 0x013F, + Ldotbelow: 0x1E36, + Ldotbelowmacron: 0x1E38, + Liwnarmenian: 0x053C, + Lj: 0x01C8, + Ljecyrillic: 0x0409, + Llinebelow: 0x1E3A, + Lmonospace: 0xFF2C, + Lslash: 0x0141, + Lslashsmall: 0xF6F9, + Lsmall: 0xF76C, + M: 0x004D, + MBsquare: 0x3386, + Macron: 0xF6D0, + Macronsmall: 0xF7AF, + Macute: 0x1E3E, + Mcircle: 0x24C2, + Mdotaccent: 0x1E40, + Mdotbelow: 0x1E42, + Menarmenian: 0x0544, + Mmonospace: 0xFF2D, + Msmall: 0xF76D, + Mturned: 0x019C, + Mu: 0x039C, + N: 0x004E, + NJ: 0x01CA, + Nacute: 0x0143, + Ncaron: 0x0147, + Ncedilla: 0x0145, + Ncircle: 0x24C3, + Ncircumflexbelow: 0x1E4A, + Ncommaaccent: 0x0145, + Ndotaccent: 0x1E44, + Ndotbelow: 0x1E46, + Nhookleft: 0x019D, + Nineroman: 0x2168, + Nj: 0x01CB, + Njecyrillic: 0x040A, + Nlinebelow: 0x1E48, + Nmonospace: 0xFF2E, + Nowarmenian: 0x0546, + Nsmall: 0xF76E, + Ntilde: 0x00D1, + Ntildesmall: 0xF7F1, + Nu: 0x039D, + O: 0x004F, + OE: 0x0152, + OEsmall: 0xF6FA, + Oacute: 0x00D3, + Oacutesmall: 0xF7F3, + Obarredcyrillic: 0x04E8, + Obarreddieresiscyrillic: 0x04EA, + Obreve: 0x014E, + Ocaron: 0x01D1, + Ocenteredtilde: 0x019F, + Ocircle: 0x24C4, + Ocircumflex: 0x00D4, + Ocircumflexacute: 0x1ED0, + Ocircumflexdotbelow: 0x1ED8, + Ocircumflexgrave: 0x1ED2, + Ocircumflexhookabove: 0x1ED4, + Ocircumflexsmall: 0xF7F4, + Ocircumflextilde: 0x1ED6, + Ocyrillic: 0x041E, + Odblacute: 0x0150, + Odblgrave: 0x020C, + Odieresis: 0x00D6, + Odieresiscyrillic: 0x04E6, + Odieresissmall: 0xF7F6, + Odotbelow: 0x1ECC, + Ogoneksmall: 0xF6FB, + Ograve: 0x00D2, + Ogravesmall: 0xF7F2, + Oharmenian: 0x0555, + Ohm: 0x2126, + Ohookabove: 0x1ECE, + Ohorn: 0x01A0, + Ohornacute: 0x1EDA, + Ohorndotbelow: 0x1EE2, + Ohorngrave: 0x1EDC, + Ohornhookabove: 0x1EDE, + Ohorntilde: 0x1EE0, + Ohungarumlaut: 0x0150, + Oi: 0x01A2, + Oinvertedbreve: 0x020E, + Omacron: 0x014C, + Omacronacute: 0x1E52, + Omacrongrave: 0x1E50, + Omega: 0x2126, + Omegacyrillic: 0x0460, + Omegagreek: 0x03A9, + Omegaroundcyrillic: 0x047A, + Omegatitlocyrillic: 0x047C, + Omegatonos: 0x038F, + Omicron: 0x039F, + Omicrontonos: 0x038C, + Omonospace: 0xFF2F, + Oneroman: 0x2160, + Oogonek: 0x01EA, + Oogonekmacron: 0x01EC, + Oopen: 0x0186, + Oslash: 0x00D8, + Oslashacute: 0x01FE, + Oslashsmall: 0xF7F8, + Osmall: 0xF76F, + Ostrokeacute: 0x01FE, + Otcyrillic: 0x047E, + Otilde: 0x00D5, + Otildeacute: 0x1E4C, + Otildedieresis: 0x1E4E, + Otildesmall: 0xF7F5, + P: 0x0050, + Pacute: 0x1E54, + Pcircle: 0x24C5, + Pdotaccent: 0x1E56, + Pecyrillic: 0x041F, + Peharmenian: 0x054A, + Pemiddlehookcyrillic: 0x04A6, + Phi: 0x03A6, + Phook: 0x01A4, + Pi: 0x03A0, + Piwrarmenian: 0x0553, + Pmonospace: 0xFF30, + Psi: 0x03A8, + Psicyrillic: 0x0470, + Psmall: 0xF770, + Q: 0x0051, + Qcircle: 0x24C6, + Qmonospace: 0xFF31, + Qsmall: 0xF771, + R: 0x0052, + Raarmenian: 0x054C, + Racute: 0x0154, + Rcaron: 0x0158, + Rcedilla: 0x0156, + Rcircle: 0x24C7, + Rcommaaccent: 0x0156, + Rdblgrave: 0x0210, + Rdotaccent: 0x1E58, + Rdotbelow: 0x1E5A, + Rdotbelowmacron: 0x1E5C, + Reharmenian: 0x0550, + Rfraktur: 0x211C, + Rho: 0x03A1, + Ringsmall: 0xF6FC, + Rinvertedbreve: 0x0212, + Rlinebelow: 0x1E5E, + Rmonospace: 0xFF32, + Rsmall: 0xF772, + Rsmallinverted: 0x0281, + Rsmallinvertedsuperior: 0x02B6, + S: 0x0053, + SF010000: 0x250C, + SF020000: 0x2514, + SF030000: 0x2510, + SF040000: 0x2518, + SF050000: 0x253C, + SF060000: 0x252C, + SF070000: 0x2534, + SF080000: 0x251C, + SF090000: 0x2524, + SF100000: 0x2500, + SF110000: 0x2502, + SF190000: 0x2561, + SF200000: 0x2562, + SF210000: 0x2556, + SF220000: 0x2555, + SF230000: 0x2563, + SF240000: 0x2551, + SF250000: 0x2557, + SF260000: 0x255D, + SF270000: 0x255C, + SF280000: 0x255B, + SF360000: 0x255E, + SF370000: 0x255F, + SF380000: 0x255A, + SF390000: 0x2554, + SF400000: 0x2569, + SF410000: 0x2566, + SF420000: 0x2560, + SF430000: 0x2550, + SF440000: 0x256C, + SF450000: 0x2567, + SF460000: 0x2568, + SF470000: 0x2564, + SF480000: 0x2565, + SF490000: 0x2559, + SF500000: 0x2558, + SF510000: 0x2552, + SF520000: 0x2553, + SF530000: 0x256B, + SF540000: 0x256A, + Sacute: 0x015A, + Sacutedotaccent: 0x1E64, + Sampigreek: 0x03E0, + Scaron: 0x0160, + Scarondotaccent: 0x1E66, + Scaronsmall: 0xF6FD, + Scedilla: 0x015E, + Schwa: 0x018F, + Schwacyrillic: 0x04D8, + Schwadieresiscyrillic: 0x04DA, + Scircle: 0x24C8, + Scircumflex: 0x015C, + Scommaaccent: 0x0218, + Sdotaccent: 0x1E60, + Sdotbelow: 0x1E62, + Sdotbelowdotaccent: 0x1E68, + Seharmenian: 0x054D, + Sevenroman: 0x2166, + Shaarmenian: 0x0547, + Shacyrillic: 0x0428, + Shchacyrillic: 0x0429, + Sheicoptic: 0x03E2, + Shhacyrillic: 0x04BA, + Shimacoptic: 0x03EC, + Sigma: 0x03A3, + Sixroman: 0x2165, + Smonospace: 0xFF33, + Softsigncyrillic: 0x042C, + Ssmall: 0xF773, + Stigmagreek: 0x03DA, + T: 0x0054, + Tau: 0x03A4, + Tbar: 0x0166, + Tcaron: 0x0164, + Tcedilla: 0x0162, + Tcircle: 0x24C9, + Tcircumflexbelow: 0x1E70, + Tcommaaccent: 0x0162, + Tdotaccent: 0x1E6A, + Tdotbelow: 0x1E6C, + Tecyrillic: 0x0422, + Tedescendercyrillic: 0x04AC, + Tenroman: 0x2169, + Tetsecyrillic: 0x04B4, + Theta: 0x0398, + Thook: 0x01AC, + Thorn: 0x00DE, + Thornsmall: 0xF7FE, + Threeroman: 0x2162, + Tildesmall: 0xF6FE, + Tiwnarmenian: 0x054F, + Tlinebelow: 0x1E6E, + Tmonospace: 0xFF34, + Toarmenian: 0x0539, + Tonefive: 0x01BC, + Tonesix: 0x0184, + Tonetwo: 0x01A7, + Tretroflexhook: 0x01AE, + Tsecyrillic: 0x0426, + Tshecyrillic: 0x040B, + Tsmall: 0xF774, + Twelveroman: 0x216B, + Tworoman: 0x2161, + U: 0x0055, + Uacute: 0x00DA, + Uacutesmall: 0xF7FA, + Ubreve: 0x016C, + Ucaron: 0x01D3, + Ucircle: 0x24CA, + Ucircumflex: 0x00DB, + Ucircumflexbelow: 0x1E76, + Ucircumflexsmall: 0xF7FB, + Ucyrillic: 0x0423, + Udblacute: 0x0170, + Udblgrave: 0x0214, + Udieresis: 0x00DC, + Udieresisacute: 0x01D7, + Udieresisbelow: 0x1E72, + Udieresiscaron: 0x01D9, + Udieresiscyrillic: 0x04F0, + Udieresisgrave: 0x01DB, + Udieresismacron: 0x01D5, + Udieresissmall: 0xF7FC, + Udotbelow: 0x1EE4, + Ugrave: 0x00D9, + Ugravesmall: 0xF7F9, + Uhookabove: 0x1EE6, + Uhorn: 0x01AF, + Uhornacute: 0x1EE8, + Uhorndotbelow: 0x1EF0, + Uhorngrave: 0x1EEA, + Uhornhookabove: 0x1EEC, + Uhorntilde: 0x1EEE, + Uhungarumlaut: 0x0170, + Uhungarumlautcyrillic: 0x04F2, + Uinvertedbreve: 0x0216, + Ukcyrillic: 0x0478, + Umacron: 0x016A, + Umacroncyrillic: 0x04EE, + Umacrondieresis: 0x1E7A, + Umonospace: 0xFF35, + Uogonek: 0x0172, + Upsilon: 0x03A5, + Upsilon1: 0x03D2, + Upsilonacutehooksymbolgreek: 0x03D3, + Upsilonafrican: 0x01B1, + Upsilondieresis: 0x03AB, + Upsilondieresishooksymbolgreek: 0x03D4, + Upsilonhooksymbol: 0x03D2, + Upsilontonos: 0x038E, + Uring: 0x016E, + Ushortcyrillic: 0x040E, + Usmall: 0xF775, + Ustraightcyrillic: 0x04AE, + Ustraightstrokecyrillic: 0x04B0, + Utilde: 0x0168, + Utildeacute: 0x1E78, + Utildebelow: 0x1E74, + V: 0x0056, + Vcircle: 0x24CB, + Vdotbelow: 0x1E7E, + Vecyrillic: 0x0412, + Vewarmenian: 0x054E, + Vhook: 0x01B2, + Vmonospace: 0xFF36, + Voarmenian: 0x0548, + Vsmall: 0xF776, + Vtilde: 0x1E7C, + W: 0x0057, + Wacute: 0x1E82, + Wcircle: 0x24CC, + Wcircumflex: 0x0174, + Wdieresis: 0x1E84, + Wdotaccent: 0x1E86, + Wdotbelow: 0x1E88, + Wgrave: 0x1E80, + Wmonospace: 0xFF37, + Wsmall: 0xF777, + X: 0x0058, + Xcircle: 0x24CD, + Xdieresis: 0x1E8C, + Xdotaccent: 0x1E8A, + Xeharmenian: 0x053D, + Xi: 0x039E, + Xmonospace: 0xFF38, + Xsmall: 0xF778, + Y: 0x0059, + Yacute: 0x00DD, + Yacutesmall: 0xF7FD, + Yatcyrillic: 0x0462, + Ycircle: 0x24CE, + Ycircumflex: 0x0176, + Ydieresis: 0x0178, + Ydieresissmall: 0xF7FF, + Ydotaccent: 0x1E8E, + Ydotbelow: 0x1EF4, + Yericyrillic: 0x042B, + Yerudieresiscyrillic: 0x04F8, + Ygrave: 0x1EF2, + Yhook: 0x01B3, + Yhookabove: 0x1EF6, + Yiarmenian: 0x0545, + Yicyrillic: 0x0407, + Yiwnarmenian: 0x0552, + Ymonospace: 0xFF39, + Ysmall: 0xF779, + Ytilde: 0x1EF8, + Yusbigcyrillic: 0x046A, + Yusbigiotifiedcyrillic: 0x046C, + Yuslittlecyrillic: 0x0466, + Yuslittleiotifiedcyrillic: 0x0468, + Z: 0x005A, + Zaarmenian: 0x0536, + Zacute: 0x0179, + Zcaron: 0x017D, + Zcaronsmall: 0xF6FF, + Zcircle: 0x24CF, + Zcircumflex: 0x1E90, + Zdot: 0x017B, + Zdotaccent: 0x017B, + Zdotbelow: 0x1E92, + Zecyrillic: 0x0417, + Zedescendercyrillic: 0x0498, + Zedieresiscyrillic: 0x04DE, + Zeta: 0x0396, + Zhearmenian: 0x053A, + Zhebrevecyrillic: 0x04C1, + Zhecyrillic: 0x0416, + Zhedescendercyrillic: 0x0496, + Zhedieresiscyrillic: 0x04DC, + Zlinebelow: 0x1E94, + Zmonospace: 0xFF3A, + Zsmall: 0xF77A, + Zstroke: 0x01B5, + a: 0x0061, + aabengali: 0x0986, + aacute: 0x00E1, + aadeva: 0x0906, + aagujarati: 0x0A86, + aagurmukhi: 0x0A06, + aamatragurmukhi: 0x0A3E, + aarusquare: 0x3303, + aavowelsignbengali: 0x09BE, + aavowelsigndeva: 0x093E, + aavowelsigngujarati: 0x0ABE, + abbreviationmarkarmenian: 0x055F, + abbreviationsigndeva: 0x0970, + abengali: 0x0985, + abopomofo: 0x311A, + abreve: 0x0103, + abreveacute: 0x1EAF, + abrevecyrillic: 0x04D1, + abrevedotbelow: 0x1EB7, + abrevegrave: 0x1EB1, + abrevehookabove: 0x1EB3, + abrevetilde: 0x1EB5, + acaron: 0x01CE, + acircle: 0x24D0, + acircumflex: 0x00E2, + acircumflexacute: 0x1EA5, + acircumflexdotbelow: 0x1EAD, + acircumflexgrave: 0x1EA7, + acircumflexhookabove: 0x1EA9, + acircumflextilde: 0x1EAB, + acute: 0x00B4, + acutebelowcmb: 0x0317, + acutecmb: 0x0301, + acutecomb: 0x0301, + acutedeva: 0x0954, + acutelowmod: 0x02CF, + acutetonecmb: 0x0341, + acyrillic: 0x0430, + adblgrave: 0x0201, + addakgurmukhi: 0x0A71, + adeva: 0x0905, + adieresis: 0x00E4, + adieresiscyrillic: 0x04D3, + adieresismacron: 0x01DF, + adotbelow: 0x1EA1, + adotmacron: 0x01E1, + ae: 0x00E6, + aeacute: 0x01FD, + aekorean: 0x3150, + aemacron: 0x01E3, + afii00208: 0x2015, + afii08941: 0x20A4, + afii10017: 0x0410, + afii10018: 0x0411, + afii10019: 0x0412, + afii10020: 0x0413, + afii10021: 0x0414, + afii10022: 0x0415, + afii10023: 0x0401, + afii10024: 0x0416, + afii10025: 0x0417, + afii10026: 0x0418, + afii10027: 0x0419, + afii10028: 0x041A, + afii10029: 0x041B, + afii10030: 0x041C, + afii10031: 0x041D, + afii10032: 0x041E, + afii10033: 0x041F, + afii10034: 0x0420, + afii10035: 0x0421, + afii10036: 0x0422, + afii10037: 0x0423, + afii10038: 0x0424, + afii10039: 0x0425, + afii10040: 0x0426, + afii10041: 0x0427, + afii10042: 0x0428, + afii10043: 0x0429, + afii10044: 0x042A, + afii10045: 0x042B, + afii10046: 0x042C, + afii10047: 0x042D, + afii10048: 0x042E, + afii10049: 0x042F, + afii10050: 0x0490, + afii10051: 0x0402, + afii10052: 0x0403, + afii10053: 0x0404, + afii10054: 0x0405, + afii10055: 0x0406, + afii10056: 0x0407, + afii10057: 0x0408, + afii10058: 0x0409, + afii10059: 0x040A, + afii10060: 0x040B, + afii10061: 0x040C, + afii10062: 0x040E, + afii10063: 0xF6C4, + afii10064: 0xF6C5, + afii10065: 0x0430, + afii10066: 0x0431, + afii10067: 0x0432, + afii10068: 0x0433, + afii10069: 0x0434, + afii10070: 0x0435, + afii10071: 0x0451, + afii10072: 0x0436, + afii10073: 0x0437, + afii10074: 0x0438, + afii10075: 0x0439, + afii10076: 0x043A, + afii10077: 0x043B, + afii10078: 0x043C, + afii10079: 0x043D, + afii10080: 0x043E, + afii10081: 0x043F, + afii10082: 0x0440, + afii10083: 0x0441, + afii10084: 0x0442, + afii10085: 0x0443, + afii10086: 0x0444, + afii10087: 0x0445, + afii10088: 0x0446, + afii10089: 0x0447, + afii10090: 0x0448, + afii10091: 0x0449, + afii10092: 0x044A, + afii10093: 0x044B, + afii10094: 0x044C, + afii10095: 0x044D, + afii10096: 0x044E, + afii10097: 0x044F, + afii10098: 0x0491, + afii10099: 0x0452, + afii10100: 0x0453, + afii10101: 0x0454, + afii10102: 0x0455, + afii10103: 0x0456, + afii10104: 0x0457, + afii10105: 0x0458, + afii10106: 0x0459, + afii10107: 0x045A, + afii10108: 0x045B, + afii10109: 0x045C, + afii10110: 0x045E, + afii10145: 0x040F, + afii10146: 0x0462, + afii10147: 0x0472, + afii10148: 0x0474, + afii10192: 0xF6C6, + afii10193: 0x045F, + afii10194: 0x0463, + afii10195: 0x0473, + afii10196: 0x0475, + afii10831: 0xF6C7, + afii10832: 0xF6C8, + afii10846: 0x04D9, + afii299: 0x200E, + afii300: 0x200F, + afii301: 0x200D, + afii57381: 0x066A, + afii57388: 0x060C, + afii57392: 0x0660, + afii57393: 0x0661, + afii57394: 0x0662, + afii57395: 0x0663, + afii57396: 0x0664, + afii57397: 0x0665, + afii57398: 0x0666, + afii57399: 0x0667, + afii57400: 0x0668, + afii57401: 0x0669, + afii57403: 0x061B, + afii57407: 0x061F, + afii57409: 0x0621, + afii57410: 0x0622, + afii57411: 0x0623, + afii57412: 0x0624, + afii57413: 0x0625, + afii57414: 0x0626, + afii57415: 0x0627, + afii57416: 0x0628, + afii57417: 0x0629, + afii57418: 0x062A, + afii57419: 0x062B, + afii57420: 0x062C, + afii57421: 0x062D, + afii57422: 0x062E, + afii57423: 0x062F, + afii57424: 0x0630, + afii57425: 0x0631, + afii57426: 0x0632, + afii57427: 0x0633, + afii57428: 0x0634, + afii57429: 0x0635, + afii57430: 0x0636, + afii57431: 0x0637, + afii57432: 0x0638, + afii57433: 0x0639, + afii57434: 0x063A, + afii57440: 0x0640, + afii57441: 0x0641, + afii57442: 0x0642, + afii57443: 0x0643, + afii57444: 0x0644, + afii57445: 0x0645, + afii57446: 0x0646, + afii57448: 0x0648, + afii57449: 0x0649, + afii57450: 0x064A, + afii57451: 0x064B, + afii57452: 0x064C, + afii57453: 0x064D, + afii57454: 0x064E, + afii57455: 0x064F, + afii57456: 0x0650, + afii57457: 0x0651, + afii57458: 0x0652, + afii57470: 0x0647, + afii57505: 0x06A4, + afii57506: 0x067E, + afii57507: 0x0686, + afii57508: 0x0698, + afii57509: 0x06AF, + afii57511: 0x0679, + afii57512: 0x0688, + afii57513: 0x0691, + afii57514: 0x06BA, + afii57519: 0x06D2, + afii57534: 0x06D5, + afii57636: 0x20AA, + afii57645: 0x05BE, + afii57658: 0x05C3, + afii57664: 0x05D0, + afii57665: 0x05D1, + afii57666: 0x05D2, + afii57667: 0x05D3, + afii57668: 0x05D4, + afii57669: 0x05D5, + afii57670: 0x05D6, + afii57671: 0x05D7, + afii57672: 0x05D8, + afii57673: 0x05D9, + afii57674: 0x05DA, + afii57675: 0x05DB, + afii57676: 0x05DC, + afii57677: 0x05DD, + afii57678: 0x05DE, + afii57679: 0x05DF, + afii57680: 0x05E0, + afii57681: 0x05E1, + afii57682: 0x05E2, + afii57683: 0x05E3, + afii57684: 0x05E4, + afii57685: 0x05E5, + afii57686: 0x05E6, + afii57687: 0x05E7, + afii57688: 0x05E8, + afii57689: 0x05E9, + afii57690: 0x05EA, + afii57694: 0xFB2A, + afii57695: 0xFB2B, + afii57700: 0xFB4B, + afii57705: 0xFB1F, + afii57716: 0x05F0, + afii57717: 0x05F1, + afii57718: 0x05F2, + afii57723: 0xFB35, + afii57793: 0x05B4, + afii57794: 0x05B5, + afii57795: 0x05B6, + afii57796: 0x05BB, + afii57797: 0x05B8, + afii57798: 0x05B7, + afii57799: 0x05B0, + afii57800: 0x05B2, + afii57801: 0x05B1, + afii57802: 0x05B3, + afii57803: 0x05C2, + afii57804: 0x05C1, + afii57806: 0x05B9, + afii57807: 0x05BC, + afii57839: 0x05BD, + afii57841: 0x05BF, + afii57842: 0x05C0, + afii57929: 0x02BC, + afii61248: 0x2105, + afii61289: 0x2113, + afii61352: 0x2116, + afii61573: 0x202C, + afii61574: 0x202D, + afii61575: 0x202E, + afii61664: 0x200C, + afii63167: 0x066D, + afii64937: 0x02BD, + agrave: 0x00E0, + agujarati: 0x0A85, + agurmukhi: 0x0A05, + ahiragana: 0x3042, + ahookabove: 0x1EA3, + aibengali: 0x0990, + aibopomofo: 0x311E, + aideva: 0x0910, + aiecyrillic: 0x04D5, + aigujarati: 0x0A90, + aigurmukhi: 0x0A10, + aimatragurmukhi: 0x0A48, + ainarabic: 0x0639, + ainfinalarabic: 0xFECA, + aininitialarabic: 0xFECB, + ainmedialarabic: 0xFECC, + ainvertedbreve: 0x0203, + aivowelsignbengali: 0x09C8, + aivowelsigndeva: 0x0948, + aivowelsigngujarati: 0x0AC8, + akatakana: 0x30A2, + akatakanahalfwidth: 0xFF71, + akorean: 0x314F, + alef: 0x05D0, + alefarabic: 0x0627, + alefdageshhebrew: 0xFB30, + aleffinalarabic: 0xFE8E, + alefhamzaabovearabic: 0x0623, + alefhamzaabovefinalarabic: 0xFE84, + alefhamzabelowarabic: 0x0625, + alefhamzabelowfinalarabic: 0xFE88, + alefhebrew: 0x05D0, + aleflamedhebrew: 0xFB4F, + alefmaddaabovearabic: 0x0622, + alefmaddaabovefinalarabic: 0xFE82, + alefmaksuraarabic: 0x0649, + alefmaksurafinalarabic: 0xFEF0, + alefmaksurainitialarabic: 0xFEF3, + alefmaksuramedialarabic: 0xFEF4, + alefpatahhebrew: 0xFB2E, + alefqamatshebrew: 0xFB2F, + aleph: 0x2135, + allequal: 0x224C, + alpha: 0x03B1, + alphatonos: 0x03AC, + amacron: 0x0101, + amonospace: 0xFF41, + ampersand: 0x0026, + ampersandmonospace: 0xFF06, + ampersandsmall: 0xF726, + amsquare: 0x33C2, + anbopomofo: 0x3122, + angbopomofo: 0x3124, + angbracketleft: 0x3008, // This glyph is missing from Adobe's original list. + angbracketright: 0x3009, // This glyph is missing from Adobe's original list. + angkhankhuthai: 0x0E5A, + angle: 0x2220, + anglebracketleft: 0x3008, + anglebracketleftvertical: 0xFE3F, + anglebracketright: 0x3009, + anglebracketrightvertical: 0xFE40, + angleleft: 0x2329, + angleright: 0x232A, + angstrom: 0x212B, + anoteleia: 0x0387, + anudattadeva: 0x0952, + anusvarabengali: 0x0982, + anusvaradeva: 0x0902, + anusvaragujarati: 0x0A82, + aogonek: 0x0105, + apaatosquare: 0x3300, + aparen: 0x249C, + apostrophearmenian: 0x055A, + apostrophemod: 0x02BC, + apple: 0xF8FF, + approaches: 0x2250, + approxequal: 0x2248, + approxequalorimage: 0x2252, + approximatelyequal: 0x2245, + araeaekorean: 0x318E, + araeakorean: 0x318D, + arc: 0x2312, + arighthalfring: 0x1E9A, + aring: 0x00E5, + aringacute: 0x01FB, + aringbelow: 0x1E01, + arrowboth: 0x2194, + arrowdashdown: 0x21E3, + arrowdashleft: 0x21E0, + arrowdashright: 0x21E2, + arrowdashup: 0x21E1, + arrowdblboth: 0x21D4, + arrowdbldown: 0x21D3, + arrowdblleft: 0x21D0, + arrowdblright: 0x21D2, + arrowdblup: 0x21D1, + arrowdown: 0x2193, + arrowdownleft: 0x2199, + arrowdownright: 0x2198, + arrowdownwhite: 0x21E9, + arrowheaddownmod: 0x02C5, + arrowheadleftmod: 0x02C2, + arrowheadrightmod: 0x02C3, + arrowheadupmod: 0x02C4, + arrowhorizex: 0xF8E7, + arrowleft: 0x2190, + arrowleftdbl: 0x21D0, + arrowleftdblstroke: 0x21CD, + arrowleftoverright: 0x21C6, + arrowleftwhite: 0x21E6, + arrowright: 0x2192, + arrowrightdblstroke: 0x21CF, + arrowrightheavy: 0x279E, + arrowrightoverleft: 0x21C4, + arrowrightwhite: 0x21E8, + arrowtableft: 0x21E4, + arrowtabright: 0x21E5, + arrowup: 0x2191, + arrowupdn: 0x2195, + arrowupdnbse: 0x21A8, + arrowupdownbase: 0x21A8, + arrowupleft: 0x2196, + arrowupleftofdown: 0x21C5, + arrowupright: 0x2197, + arrowupwhite: 0x21E7, + arrowvertex: 0xF8E6, + asciicircum: 0x005E, + asciicircummonospace: 0xFF3E, + asciitilde: 0x007E, + asciitildemonospace: 0xFF5E, + ascript: 0x0251, + ascriptturned: 0x0252, + asmallhiragana: 0x3041, + asmallkatakana: 0x30A1, + asmallkatakanahalfwidth: 0xFF67, + asterisk: 0x002A, + asteriskaltonearabic: 0x066D, + asteriskarabic: 0x066D, + asteriskmath: 0x2217, + asteriskmonospace: 0xFF0A, + asterisksmall: 0xFE61, + asterism: 0x2042, + asuperior: 0xF6E9, + asymptoticallyequal: 0x2243, + at: 0x0040, + atilde: 0x00E3, + atmonospace: 0xFF20, + atsmall: 0xFE6B, + aturned: 0x0250, + aubengali: 0x0994, + aubopomofo: 0x3120, + audeva: 0x0914, + augujarati: 0x0A94, + augurmukhi: 0x0A14, + aulengthmarkbengali: 0x09D7, + aumatragurmukhi: 0x0A4C, + auvowelsignbengali: 0x09CC, + auvowelsigndeva: 0x094C, + auvowelsigngujarati: 0x0ACC, + avagrahadeva: 0x093D, + aybarmenian: 0x0561, + ayin: 0x05E2, + ayinaltonehebrew: 0xFB20, + ayinhebrew: 0x05E2, + b: 0x0062, + babengali: 0x09AC, + backslash: 0x005C, + backslashmonospace: 0xFF3C, + badeva: 0x092C, + bagujarati: 0x0AAC, + bagurmukhi: 0x0A2C, + bahiragana: 0x3070, + bahtthai: 0x0E3F, + bakatakana: 0x30D0, + bar: 0x007C, + barmonospace: 0xFF5C, + bbopomofo: 0x3105, + bcircle: 0x24D1, + bdotaccent: 0x1E03, + bdotbelow: 0x1E05, + beamedsixteenthnotes: 0x266C, + because: 0x2235, + becyrillic: 0x0431, + beharabic: 0x0628, + behfinalarabic: 0xFE90, + behinitialarabic: 0xFE91, + behiragana: 0x3079, + behmedialarabic: 0xFE92, + behmeeminitialarabic: 0xFC9F, + behmeemisolatedarabic: 0xFC08, + behnoonfinalarabic: 0xFC6D, + bekatakana: 0x30D9, + benarmenian: 0x0562, + bet: 0x05D1, + beta: 0x03B2, + betasymbolgreek: 0x03D0, + betdagesh: 0xFB31, + betdageshhebrew: 0xFB31, + bethebrew: 0x05D1, + betrafehebrew: 0xFB4C, + bhabengali: 0x09AD, + bhadeva: 0x092D, + bhagujarati: 0x0AAD, + bhagurmukhi: 0x0A2D, + bhook: 0x0253, + bihiragana: 0x3073, + bikatakana: 0x30D3, + bilabialclick: 0x0298, + bindigurmukhi: 0x0A02, + birusquare: 0x3331, + blackcircle: 0x25CF, + blackdiamond: 0x25C6, + blackdownpointingtriangle: 0x25BC, + blackleftpointingpointer: 0x25C4, + blackleftpointingtriangle: 0x25C0, + blacklenticularbracketleft: 0x3010, + blacklenticularbracketleftvertical: 0xFE3B, + blacklenticularbracketright: 0x3011, + blacklenticularbracketrightvertical: 0xFE3C, + blacklowerlefttriangle: 0x25E3, + blacklowerrighttriangle: 0x25E2, + blackrectangle: 0x25AC, + blackrightpointingpointer: 0x25BA, + blackrightpointingtriangle: 0x25B6, + blacksmallsquare: 0x25AA, + blacksmilingface: 0x263B, + blacksquare: 0x25A0, + blackstar: 0x2605, + blackupperlefttriangle: 0x25E4, + blackupperrighttriangle: 0x25E5, + blackuppointingsmalltriangle: 0x25B4, + blackuppointingtriangle: 0x25B2, + blank: 0x2423, + blinebelow: 0x1E07, + block: 0x2588, + bmonospace: 0xFF42, + bobaimaithai: 0x0E1A, + bohiragana: 0x307C, + bokatakana: 0x30DC, + bparen: 0x249D, + bqsquare: 0x33C3, + braceex: 0xF8F4, + braceleft: 0x007B, + braceleftbt: 0xF8F3, + braceleftmid: 0xF8F2, + braceleftmonospace: 0xFF5B, + braceleftsmall: 0xFE5B, + bracelefttp: 0xF8F1, + braceleftvertical: 0xFE37, + braceright: 0x007D, + bracerightbt: 0xF8FE, + bracerightmid: 0xF8FD, + bracerightmonospace: 0xFF5D, + bracerightsmall: 0xFE5C, + bracerighttp: 0xF8FC, + bracerightvertical: 0xFE38, + bracketleft: 0x005B, + bracketleftbt: 0xF8F0, + bracketleftex: 0xF8EF, + bracketleftmonospace: 0xFF3B, + bracketlefttp: 0xF8EE, + bracketright: 0x005D, + bracketrightbt: 0xF8FB, + bracketrightex: 0xF8FA, + bracketrightmonospace: 0xFF3D, + bracketrighttp: 0xF8F9, + breve: 0x02D8, + brevebelowcmb: 0x032E, + brevecmb: 0x0306, + breveinvertedbelowcmb: 0x032F, + breveinvertedcmb: 0x0311, + breveinverteddoublecmb: 0x0361, + bridgebelowcmb: 0x032A, + bridgeinvertedbelowcmb: 0x033A, + brokenbar: 0x00A6, + bstroke: 0x0180, + bsuperior: 0xF6EA, + btopbar: 0x0183, + buhiragana: 0x3076, + bukatakana: 0x30D6, + bullet: 0x2022, + bulletinverse: 0x25D8, + bulletoperator: 0x2219, + bullseye: 0x25CE, + c: 0x0063, + caarmenian: 0x056E, + cabengali: 0x099A, + cacute: 0x0107, + cadeva: 0x091A, + cagujarati: 0x0A9A, + cagurmukhi: 0x0A1A, + calsquare: 0x3388, + candrabindubengali: 0x0981, + candrabinducmb: 0x0310, + candrabindudeva: 0x0901, + candrabindugujarati: 0x0A81, + capslock: 0x21EA, + careof: 0x2105, + caron: 0x02C7, + caronbelowcmb: 0x032C, + caroncmb: 0x030C, + carriagereturn: 0x21B5, + cbopomofo: 0x3118, + ccaron: 0x010D, + ccedilla: 0x00E7, + ccedillaacute: 0x1E09, + ccircle: 0x24D2, + ccircumflex: 0x0109, + ccurl: 0x0255, + cdot: 0x010B, + cdotaccent: 0x010B, + cdsquare: 0x33C5, + cedilla: 0x00B8, + cedillacmb: 0x0327, + cent: 0x00A2, + centigrade: 0x2103, + centinferior: 0xF6DF, + centmonospace: 0xFFE0, + centoldstyle: 0xF7A2, + centsuperior: 0xF6E0, + chaarmenian: 0x0579, + chabengali: 0x099B, + chadeva: 0x091B, + chagujarati: 0x0A9B, + chagurmukhi: 0x0A1B, + chbopomofo: 0x3114, + cheabkhasiancyrillic: 0x04BD, + checkmark: 0x2713, + checyrillic: 0x0447, + chedescenderabkhasiancyrillic: 0x04BF, + chedescendercyrillic: 0x04B7, + chedieresiscyrillic: 0x04F5, + cheharmenian: 0x0573, + chekhakassiancyrillic: 0x04CC, + cheverticalstrokecyrillic: 0x04B9, + chi: 0x03C7, + chieuchacirclekorean: 0x3277, + chieuchaparenkorean: 0x3217, + chieuchcirclekorean: 0x3269, + chieuchkorean: 0x314A, + chieuchparenkorean: 0x3209, + chochangthai: 0x0E0A, + chochanthai: 0x0E08, + chochingthai: 0x0E09, + chochoethai: 0x0E0C, + chook: 0x0188, + cieucacirclekorean: 0x3276, + cieucaparenkorean: 0x3216, + cieuccirclekorean: 0x3268, + cieuckorean: 0x3148, + cieucparenkorean: 0x3208, + cieucuparenkorean: 0x321C, + circle: 0x25CB, + circlecopyrt: 0x00A9, // This glyph is missing from Adobe's original list. + circlemultiply: 0x2297, + circleot: 0x2299, + circleplus: 0x2295, + circlepostalmark: 0x3036, + circlewithlefthalfblack: 0x25D0, + circlewithrighthalfblack: 0x25D1, + circumflex: 0x02C6, + circumflexbelowcmb: 0x032D, + circumflexcmb: 0x0302, + clear: 0x2327, + clickalveolar: 0x01C2, + clickdental: 0x01C0, + clicklateral: 0x01C1, + clickretroflex: 0x01C3, + club: 0x2663, + clubsuitblack: 0x2663, + clubsuitwhite: 0x2667, + cmcubedsquare: 0x33A4, + cmonospace: 0xFF43, + cmsquaredsquare: 0x33A0, + coarmenian: 0x0581, + colon: 0x003A, + colonmonetary: 0x20A1, + colonmonospace: 0xFF1A, + colonsign: 0x20A1, + colonsmall: 0xFE55, + colontriangularhalfmod: 0x02D1, + colontriangularmod: 0x02D0, + comma: 0x002C, + commaabovecmb: 0x0313, + commaaboverightcmb: 0x0315, + commaaccent: 0xF6C3, + commaarabic: 0x060C, + commaarmenian: 0x055D, + commainferior: 0xF6E1, + commamonospace: 0xFF0C, + commareversedabovecmb: 0x0314, + commareversedmod: 0x02BD, + commasmall: 0xFE50, + commasuperior: 0xF6E2, + commaturnedabovecmb: 0x0312, + commaturnedmod: 0x02BB, + compass: 0x263C, + congruent: 0x2245, + contourintegral: 0x222E, + control: 0x2303, + controlACK: 0x0006, + controlBEL: 0x0007, + controlBS: 0x0008, + controlCAN: 0x0018, + controlCR: 0x000D, + controlDC1: 0x0011, + controlDC2: 0x0012, + controlDC3: 0x0013, + controlDC4: 0x0014, + controlDEL: 0x007F, + controlDLE: 0x0010, + controlEM: 0x0019, + controlENQ: 0x0005, + controlEOT: 0x0004, + controlESC: 0x001B, + controlETB: 0x0017, + controlETX: 0x0003, + controlFF: 0x000C, + controlFS: 0x001C, + controlGS: 0x001D, + controlHT: 0x0009, + controlLF: 0x000A, + controlNAK: 0x0015, + controlRS: 0x001E, + controlSI: 0x000F, + controlSO: 0x000E, + controlSOT: 0x0002, + controlSTX: 0x0001, + controlSUB: 0x001A, + controlSYN: 0x0016, + controlUS: 0x001F, + controlVT: 0x000B, + copyright: 0x00A9, + copyrightsans: 0xF8E9, + copyrightserif: 0xF6D9, + cornerbracketleft: 0x300C, + cornerbracketlefthalfwidth: 0xFF62, + cornerbracketleftvertical: 0xFE41, + cornerbracketright: 0x300D, + cornerbracketrighthalfwidth: 0xFF63, + cornerbracketrightvertical: 0xFE42, + corporationsquare: 0x337F, + cosquare: 0x33C7, + coverkgsquare: 0x33C6, + cparen: 0x249E, + cruzeiro: 0x20A2, + cstretched: 0x0297, + curlyand: 0x22CF, + curlyor: 0x22CE, + currency: 0x00A4, + cyrBreve: 0xF6D1, + cyrFlex: 0xF6D2, + cyrbreve: 0xF6D4, + cyrflex: 0xF6D5, + d: 0x0064, + daarmenian: 0x0564, + dabengali: 0x09A6, + dadarabic: 0x0636, + dadeva: 0x0926, + dadfinalarabic: 0xFEBE, + dadinitialarabic: 0xFEBF, + dadmedialarabic: 0xFEC0, + dagesh: 0x05BC, + dageshhebrew: 0x05BC, + dagger: 0x2020, + daggerdbl: 0x2021, + dagujarati: 0x0AA6, + dagurmukhi: 0x0A26, + dahiragana: 0x3060, + dakatakana: 0x30C0, + dalarabic: 0x062F, + dalet: 0x05D3, + daletdagesh: 0xFB33, + daletdageshhebrew: 0xFB33, + dalethebrew: 0x05D3, + dalfinalarabic: 0xFEAA, + dammaarabic: 0x064F, + dammalowarabic: 0x064F, + dammatanaltonearabic: 0x064C, + dammatanarabic: 0x064C, + danda: 0x0964, + dargahebrew: 0x05A7, + dargalefthebrew: 0x05A7, + dasiapneumatacyrilliccmb: 0x0485, + dblGrave: 0xF6D3, + dblanglebracketleft: 0x300A, + dblanglebracketleftvertical: 0xFE3D, + dblanglebracketright: 0x300B, + dblanglebracketrightvertical: 0xFE3E, + dblarchinvertedbelowcmb: 0x032B, + dblarrowleft: 0x21D4, + dblarrowright: 0x21D2, + dbldanda: 0x0965, + dblgrave: 0xF6D6, + dblgravecmb: 0x030F, + dblintegral: 0x222C, + dbllowline: 0x2017, + dbllowlinecmb: 0x0333, + dbloverlinecmb: 0x033F, + dblprimemod: 0x02BA, + dblverticalbar: 0x2016, + dblverticallineabovecmb: 0x030E, + dbopomofo: 0x3109, + dbsquare: 0x33C8, + dcaron: 0x010F, + dcedilla: 0x1E11, + dcircle: 0x24D3, + dcircumflexbelow: 0x1E13, + dcroat: 0x0111, + ddabengali: 0x09A1, + ddadeva: 0x0921, + ddagujarati: 0x0AA1, + ddagurmukhi: 0x0A21, + ddalarabic: 0x0688, + ddalfinalarabic: 0xFB89, + dddhadeva: 0x095C, + ddhabengali: 0x09A2, + ddhadeva: 0x0922, + ddhagujarati: 0x0AA2, + ddhagurmukhi: 0x0A22, + ddotaccent: 0x1E0B, + ddotbelow: 0x1E0D, + decimalseparatorarabic: 0x066B, + decimalseparatorpersian: 0x066B, + decyrillic: 0x0434, + degree: 0x00B0, + dehihebrew: 0x05AD, + dehiragana: 0x3067, + deicoptic: 0x03EF, + dekatakana: 0x30C7, + deleteleft: 0x232B, + deleteright: 0x2326, + delta: 0x03B4, + deltaturned: 0x018D, + denominatorminusonenumeratorbengali: 0x09F8, + dezh: 0x02A4, + dhabengali: 0x09A7, + dhadeva: 0x0927, + dhagujarati: 0x0AA7, + dhagurmukhi: 0x0A27, + dhook: 0x0257, + dialytikatonos: 0x0385, + dialytikatonoscmb: 0x0344, + diamond: 0x2666, + diamondsuitwhite: 0x2662, + dieresis: 0x00A8, + dieresisacute: 0xF6D7, + dieresisbelowcmb: 0x0324, + dieresiscmb: 0x0308, + dieresisgrave: 0xF6D8, + dieresistonos: 0x0385, + dihiragana: 0x3062, + dikatakana: 0x30C2, + dittomark: 0x3003, + divide: 0x00F7, + divides: 0x2223, + divisionslash: 0x2215, + djecyrillic: 0x0452, + dkshade: 0x2593, + dlinebelow: 0x1E0F, + dlsquare: 0x3397, + dmacron: 0x0111, + dmonospace: 0xFF44, + dnblock: 0x2584, + dochadathai: 0x0E0E, + dodekthai: 0x0E14, + dohiragana: 0x3069, + dokatakana: 0x30C9, + dollar: 0x0024, + dollarinferior: 0xF6E3, + dollarmonospace: 0xFF04, + dollaroldstyle: 0xF724, + dollarsmall: 0xFE69, + dollarsuperior: 0xF6E4, + dong: 0x20AB, + dorusquare: 0x3326, + dotaccent: 0x02D9, + dotaccentcmb: 0x0307, + dotbelowcmb: 0x0323, + dotbelowcomb: 0x0323, + dotkatakana: 0x30FB, + dotlessi: 0x0131, + dotlessj: 0xF6BE, + dotlessjstrokehook: 0x0284, + dotmath: 0x22C5, + dottedcircle: 0x25CC, + doubleyodpatah: 0xFB1F, + doubleyodpatahhebrew: 0xFB1F, + downtackbelowcmb: 0x031E, + downtackmod: 0x02D5, + dparen: 0x249F, + dsuperior: 0xF6EB, + dtail: 0x0256, + dtopbar: 0x018C, + duhiragana: 0x3065, + dukatakana: 0x30C5, + dz: 0x01F3, + dzaltone: 0x02A3, + dzcaron: 0x01C6, + dzcurl: 0x02A5, + dzeabkhasiancyrillic: 0x04E1, + dzecyrillic: 0x0455, + dzhecyrillic: 0x045F, + e: 0x0065, + eacute: 0x00E9, + earth: 0x2641, + ebengali: 0x098F, + ebopomofo: 0x311C, + ebreve: 0x0115, + ecandradeva: 0x090D, + ecandragujarati: 0x0A8D, + ecandravowelsigndeva: 0x0945, + ecandravowelsigngujarati: 0x0AC5, + ecaron: 0x011B, + ecedillabreve: 0x1E1D, + echarmenian: 0x0565, + echyiwnarmenian: 0x0587, + ecircle: 0x24D4, + ecircumflex: 0x00EA, + ecircumflexacute: 0x1EBF, + ecircumflexbelow: 0x1E19, + ecircumflexdotbelow: 0x1EC7, + ecircumflexgrave: 0x1EC1, + ecircumflexhookabove: 0x1EC3, + ecircumflextilde: 0x1EC5, + ecyrillic: 0x0454, + edblgrave: 0x0205, + edeva: 0x090F, + edieresis: 0x00EB, + edot: 0x0117, + edotaccent: 0x0117, + edotbelow: 0x1EB9, + eegurmukhi: 0x0A0F, + eematragurmukhi: 0x0A47, + efcyrillic: 0x0444, + egrave: 0x00E8, + egujarati: 0x0A8F, + eharmenian: 0x0567, + ehbopomofo: 0x311D, + ehiragana: 0x3048, + ehookabove: 0x1EBB, + eibopomofo: 0x311F, + eight: 0x0038, + eightarabic: 0x0668, + eightbengali: 0x09EE, + eightcircle: 0x2467, + eightcircleinversesansserif: 0x2791, + eightdeva: 0x096E, + eighteencircle: 0x2471, + eighteenparen: 0x2485, + eighteenperiod: 0x2499, + eightgujarati: 0x0AEE, + eightgurmukhi: 0x0A6E, + eighthackarabic: 0x0668, + eighthangzhou: 0x3028, + eighthnotebeamed: 0x266B, + eightideographicparen: 0x3227, + eightinferior: 0x2088, + eightmonospace: 0xFF18, + eightoldstyle: 0xF738, + eightparen: 0x247B, + eightperiod: 0x248F, + eightpersian: 0x06F8, + eightroman: 0x2177, + eightsuperior: 0x2078, + eightthai: 0x0E58, + einvertedbreve: 0x0207, + eiotifiedcyrillic: 0x0465, + ekatakana: 0x30A8, + ekatakanahalfwidth: 0xFF74, + ekonkargurmukhi: 0x0A74, + ekorean: 0x3154, + elcyrillic: 0x043B, + element: 0x2208, + elevencircle: 0x246A, + elevenparen: 0x247E, + elevenperiod: 0x2492, + elevenroman: 0x217A, + ellipsis: 0x2026, + ellipsisvertical: 0x22EE, + emacron: 0x0113, + emacronacute: 0x1E17, + emacrongrave: 0x1E15, + emcyrillic: 0x043C, + emdash: 0x2014, + emdashvertical: 0xFE31, + emonospace: 0xFF45, + emphasismarkarmenian: 0x055B, + emptyset: 0x2205, + enbopomofo: 0x3123, + encyrillic: 0x043D, + endash: 0x2013, + endashvertical: 0xFE32, + endescendercyrillic: 0x04A3, + eng: 0x014B, + engbopomofo: 0x3125, + enghecyrillic: 0x04A5, + enhookcyrillic: 0x04C8, + enspace: 0x2002, + eogonek: 0x0119, + eokorean: 0x3153, + eopen: 0x025B, + eopenclosed: 0x029A, + eopenreversed: 0x025C, + eopenreversedclosed: 0x025E, + eopenreversedhook: 0x025D, + eparen: 0x24A0, + epsilon: 0x03B5, + epsilontonos: 0x03AD, + equal: 0x003D, + equalmonospace: 0xFF1D, + equalsmall: 0xFE66, + equalsuperior: 0x207C, + equivalence: 0x2261, + erbopomofo: 0x3126, + ercyrillic: 0x0440, + ereversed: 0x0258, + ereversedcyrillic: 0x044D, + escyrillic: 0x0441, + esdescendercyrillic: 0x04AB, + esh: 0x0283, + eshcurl: 0x0286, + eshortdeva: 0x090E, + eshortvowelsigndeva: 0x0946, + eshreversedloop: 0x01AA, + eshsquatreversed: 0x0285, + esmallhiragana: 0x3047, + esmallkatakana: 0x30A7, + esmallkatakanahalfwidth: 0xFF6A, + estimated: 0x212E, + esuperior: 0xF6EC, + eta: 0x03B7, + etarmenian: 0x0568, + etatonos: 0x03AE, + eth: 0x00F0, + etilde: 0x1EBD, + etildebelow: 0x1E1B, + etnahtafoukhhebrew: 0x0591, + etnahtafoukhlefthebrew: 0x0591, + etnahtahebrew: 0x0591, + etnahtalefthebrew: 0x0591, + eturned: 0x01DD, + eukorean: 0x3161, + euro: 0x20AC, + evowelsignbengali: 0x09C7, + evowelsigndeva: 0x0947, + evowelsigngujarati: 0x0AC7, + exclam: 0x0021, + exclamarmenian: 0x055C, + exclamdbl: 0x203C, + exclamdown: 0x00A1, + exclamdownsmall: 0xF7A1, + exclammonospace: 0xFF01, + exclamsmall: 0xF721, + existential: 0x2203, + ezh: 0x0292, + ezhcaron: 0x01EF, + ezhcurl: 0x0293, + ezhreversed: 0x01B9, + ezhtail: 0x01BA, + f: 0x0066, + fadeva: 0x095E, + fagurmukhi: 0x0A5E, + fahrenheit: 0x2109, + fathaarabic: 0x064E, + fathalowarabic: 0x064E, + fathatanarabic: 0x064B, + fbopomofo: 0x3108, + fcircle: 0x24D5, + fdotaccent: 0x1E1F, + feharabic: 0x0641, + feharmenian: 0x0586, + fehfinalarabic: 0xFED2, + fehinitialarabic: 0xFED3, + fehmedialarabic: 0xFED4, + feicoptic: 0x03E5, + female: 0x2640, + ff: 0xFB00, + ffi: 0xFB03, + ffl: 0xFB04, + fi: 0xFB01, + fifteencircle: 0x246E, + fifteenparen: 0x2482, + fifteenperiod: 0x2496, + figuredash: 0x2012, + filledbox: 0x25A0, + filledrect: 0x25AC, + finalkaf: 0x05DA, + finalkafdagesh: 0xFB3A, + finalkafdageshhebrew: 0xFB3A, + finalkafhebrew: 0x05DA, + finalmem: 0x05DD, + finalmemhebrew: 0x05DD, + finalnun: 0x05DF, + finalnunhebrew: 0x05DF, + finalpe: 0x05E3, + finalpehebrew: 0x05E3, + finaltsadi: 0x05E5, + finaltsadihebrew: 0x05E5, + firsttonechinese: 0x02C9, + fisheye: 0x25C9, + fitacyrillic: 0x0473, + five: 0x0035, + fivearabic: 0x0665, + fivebengali: 0x09EB, + fivecircle: 0x2464, + fivecircleinversesansserif: 0x278E, + fivedeva: 0x096B, + fiveeighths: 0x215D, + fivegujarati: 0x0AEB, + fivegurmukhi: 0x0A6B, + fivehackarabic: 0x0665, + fivehangzhou: 0x3025, + fiveideographicparen: 0x3224, + fiveinferior: 0x2085, + fivemonospace: 0xFF15, + fiveoldstyle: 0xF735, + fiveparen: 0x2478, + fiveperiod: 0x248C, + fivepersian: 0x06F5, + fiveroman: 0x2174, + fivesuperior: 0x2075, + fivethai: 0x0E55, + fl: 0xFB02, + florin: 0x0192, + fmonospace: 0xFF46, + fmsquare: 0x3399, + fofanthai: 0x0E1F, + fofathai: 0x0E1D, + fongmanthai: 0x0E4F, + forall: 0x2200, + four: 0x0034, + fourarabic: 0x0664, + fourbengali: 0x09EA, + fourcircle: 0x2463, + fourcircleinversesansserif: 0x278D, + fourdeva: 0x096A, + fourgujarati: 0x0AEA, + fourgurmukhi: 0x0A6A, + fourhackarabic: 0x0664, + fourhangzhou: 0x3024, + fourideographicparen: 0x3223, + fourinferior: 0x2084, + fourmonospace: 0xFF14, + fournumeratorbengali: 0x09F7, + fouroldstyle: 0xF734, + fourparen: 0x2477, + fourperiod: 0x248B, + fourpersian: 0x06F4, + fourroman: 0x2173, + foursuperior: 0x2074, + fourteencircle: 0x246D, + fourteenparen: 0x2481, + fourteenperiod: 0x2495, + fourthai: 0x0E54, + fourthtonechinese: 0x02CB, + fparen: 0x24A1, + fraction: 0x2044, + franc: 0x20A3, + g: 0x0067, + gabengali: 0x0997, + gacute: 0x01F5, + gadeva: 0x0917, + gafarabic: 0x06AF, + gaffinalarabic: 0xFB93, + gafinitialarabic: 0xFB94, + gafmedialarabic: 0xFB95, + gagujarati: 0x0A97, + gagurmukhi: 0x0A17, + gahiragana: 0x304C, + gakatakana: 0x30AC, + gamma: 0x03B3, + gammalatinsmall: 0x0263, + gammasuperior: 0x02E0, + gangiacoptic: 0x03EB, + gbopomofo: 0x310D, + gbreve: 0x011F, + gcaron: 0x01E7, + gcedilla: 0x0123, + gcircle: 0x24D6, + gcircumflex: 0x011D, + gcommaaccent: 0x0123, + gdot: 0x0121, + gdotaccent: 0x0121, + gecyrillic: 0x0433, + gehiragana: 0x3052, + gekatakana: 0x30B2, + geometricallyequal: 0x2251, + gereshaccenthebrew: 0x059C, + gereshhebrew: 0x05F3, + gereshmuqdamhebrew: 0x059D, + germandbls: 0x00DF, + gershayimaccenthebrew: 0x059E, + gershayimhebrew: 0x05F4, + getamark: 0x3013, + ghabengali: 0x0998, + ghadarmenian: 0x0572, + ghadeva: 0x0918, + ghagujarati: 0x0A98, + ghagurmukhi: 0x0A18, + ghainarabic: 0x063A, + ghainfinalarabic: 0xFECE, + ghaininitialarabic: 0xFECF, + ghainmedialarabic: 0xFED0, + ghemiddlehookcyrillic: 0x0495, + ghestrokecyrillic: 0x0493, + gheupturncyrillic: 0x0491, + ghhadeva: 0x095A, + ghhagurmukhi: 0x0A5A, + ghook: 0x0260, + ghzsquare: 0x3393, + gihiragana: 0x304E, + gikatakana: 0x30AE, + gimarmenian: 0x0563, + gimel: 0x05D2, + gimeldagesh: 0xFB32, + gimeldageshhebrew: 0xFB32, + gimelhebrew: 0x05D2, + gjecyrillic: 0x0453, + glottalinvertedstroke: 0x01BE, + glottalstop: 0x0294, + glottalstopinverted: 0x0296, + glottalstopmod: 0x02C0, + glottalstopreversed: 0x0295, + glottalstopreversedmod: 0x02C1, + glottalstopreversedsuperior: 0x02E4, + glottalstopstroke: 0x02A1, + glottalstopstrokereversed: 0x02A2, + gmacron: 0x1E21, + gmonospace: 0xFF47, + gohiragana: 0x3054, + gokatakana: 0x30B4, + gparen: 0x24A2, + gpasquare: 0x33AC, + gradient: 0x2207, + grave: 0x0060, + gravebelowcmb: 0x0316, + gravecmb: 0x0300, + gravecomb: 0x0300, + gravedeva: 0x0953, + gravelowmod: 0x02CE, + gravemonospace: 0xFF40, + gravetonecmb: 0x0340, + greater: 0x003E, + greaterequal: 0x2265, + greaterequalorless: 0x22DB, + greatermonospace: 0xFF1E, + greaterorequivalent: 0x2273, + greaterorless: 0x2277, + greateroverequal: 0x2267, + greatersmall: 0xFE65, + gscript: 0x0261, + gstroke: 0x01E5, + guhiragana: 0x3050, + guillemotleft: 0x00AB, + guillemotright: 0x00BB, + guilsinglleft: 0x2039, + guilsinglright: 0x203A, + gukatakana: 0x30B0, + guramusquare: 0x3318, + gysquare: 0x33C9, + h: 0x0068, + haabkhasiancyrillic: 0x04A9, + haaltonearabic: 0x06C1, + habengali: 0x09B9, + hadescendercyrillic: 0x04B3, + hadeva: 0x0939, + hagujarati: 0x0AB9, + hagurmukhi: 0x0A39, + haharabic: 0x062D, + hahfinalarabic: 0xFEA2, + hahinitialarabic: 0xFEA3, + hahiragana: 0x306F, + hahmedialarabic: 0xFEA4, + haitusquare: 0x332A, + hakatakana: 0x30CF, + hakatakanahalfwidth: 0xFF8A, + halantgurmukhi: 0x0A4D, + hamzaarabic: 0x0621, + hamzalowarabic: 0x0621, + hangulfiller: 0x3164, + hardsigncyrillic: 0x044A, + harpoonleftbarbup: 0x21BC, + harpoonrightbarbup: 0x21C0, + hasquare: 0x33CA, + hatafpatah: 0x05B2, + hatafpatah16: 0x05B2, + hatafpatah23: 0x05B2, + hatafpatah2f: 0x05B2, + hatafpatahhebrew: 0x05B2, + hatafpatahnarrowhebrew: 0x05B2, + hatafpatahquarterhebrew: 0x05B2, + hatafpatahwidehebrew: 0x05B2, + hatafqamats: 0x05B3, + hatafqamats1b: 0x05B3, + hatafqamats28: 0x05B3, + hatafqamats34: 0x05B3, + hatafqamatshebrew: 0x05B3, + hatafqamatsnarrowhebrew: 0x05B3, + hatafqamatsquarterhebrew: 0x05B3, + hatafqamatswidehebrew: 0x05B3, + hatafsegol: 0x05B1, + hatafsegol17: 0x05B1, + hatafsegol24: 0x05B1, + hatafsegol30: 0x05B1, + hatafsegolhebrew: 0x05B1, + hatafsegolnarrowhebrew: 0x05B1, + hatafsegolquarterhebrew: 0x05B1, + hatafsegolwidehebrew: 0x05B1, + hbar: 0x0127, + hbopomofo: 0x310F, + hbrevebelow: 0x1E2B, + hcedilla: 0x1E29, + hcircle: 0x24D7, + hcircumflex: 0x0125, + hdieresis: 0x1E27, + hdotaccent: 0x1E23, + hdotbelow: 0x1E25, + he: 0x05D4, + heart: 0x2665, + heartsuitblack: 0x2665, + heartsuitwhite: 0x2661, + hedagesh: 0xFB34, + hedageshhebrew: 0xFB34, + hehaltonearabic: 0x06C1, + heharabic: 0x0647, + hehebrew: 0x05D4, + hehfinalaltonearabic: 0xFBA7, + hehfinalalttwoarabic: 0xFEEA, + hehfinalarabic: 0xFEEA, + hehhamzaabovefinalarabic: 0xFBA5, + hehhamzaaboveisolatedarabic: 0xFBA4, + hehinitialaltonearabic: 0xFBA8, + hehinitialarabic: 0xFEEB, + hehiragana: 0x3078, + hehmedialaltonearabic: 0xFBA9, + hehmedialarabic: 0xFEEC, + heiseierasquare: 0x337B, + hekatakana: 0x30D8, + hekatakanahalfwidth: 0xFF8D, + hekutaarusquare: 0x3336, + henghook: 0x0267, + herutusquare: 0x3339, + het: 0x05D7, + hethebrew: 0x05D7, + hhook: 0x0266, + hhooksuperior: 0x02B1, + hieuhacirclekorean: 0x327B, + hieuhaparenkorean: 0x321B, + hieuhcirclekorean: 0x326D, + hieuhkorean: 0x314E, + hieuhparenkorean: 0x320D, + hihiragana: 0x3072, + hikatakana: 0x30D2, + hikatakanahalfwidth: 0xFF8B, + hiriq: 0x05B4, + hiriq14: 0x05B4, + hiriq21: 0x05B4, + hiriq2d: 0x05B4, + hiriqhebrew: 0x05B4, + hiriqnarrowhebrew: 0x05B4, + hiriqquarterhebrew: 0x05B4, + hiriqwidehebrew: 0x05B4, + hlinebelow: 0x1E96, + hmonospace: 0xFF48, + hoarmenian: 0x0570, + hohipthai: 0x0E2B, + hohiragana: 0x307B, + hokatakana: 0x30DB, + hokatakanahalfwidth: 0xFF8E, + holam: 0x05B9, + holam19: 0x05B9, + holam26: 0x05B9, + holam32: 0x05B9, + holamhebrew: 0x05B9, + holamnarrowhebrew: 0x05B9, + holamquarterhebrew: 0x05B9, + holamwidehebrew: 0x05B9, + honokhukthai: 0x0E2E, + hookabovecomb: 0x0309, + hookcmb: 0x0309, + hookpalatalizedbelowcmb: 0x0321, + hookretroflexbelowcmb: 0x0322, + hoonsquare: 0x3342, + horicoptic: 0x03E9, + horizontalbar: 0x2015, + horncmb: 0x031B, + hotsprings: 0x2668, + house: 0x2302, + hparen: 0x24A3, + hsuperior: 0x02B0, + hturned: 0x0265, + huhiragana: 0x3075, + huiitosquare: 0x3333, + hukatakana: 0x30D5, + hukatakanahalfwidth: 0xFF8C, + hungarumlaut: 0x02DD, + hungarumlautcmb: 0x030B, + hv: 0x0195, + hyphen: 0x002D, + hypheninferior: 0xF6E5, + hyphenmonospace: 0xFF0D, + hyphensmall: 0xFE63, + hyphensuperior: 0xF6E6, + hyphentwo: 0x2010, + i: 0x0069, + iacute: 0x00ED, + iacyrillic: 0x044F, + ibengali: 0x0987, + ibopomofo: 0x3127, + ibreve: 0x012D, + icaron: 0x01D0, + icircle: 0x24D8, + icircumflex: 0x00EE, + icyrillic: 0x0456, + idblgrave: 0x0209, + ideographearthcircle: 0x328F, + ideographfirecircle: 0x328B, + ideographicallianceparen: 0x323F, + ideographiccallparen: 0x323A, + ideographiccentrecircle: 0x32A5, + ideographicclose: 0x3006, + ideographiccomma: 0x3001, + ideographiccommaleft: 0xFF64, + ideographiccongratulationparen: 0x3237, + ideographiccorrectcircle: 0x32A3, + ideographicearthparen: 0x322F, + ideographicenterpriseparen: 0x323D, + ideographicexcellentcircle: 0x329D, + ideographicfestivalparen: 0x3240, + ideographicfinancialcircle: 0x3296, + ideographicfinancialparen: 0x3236, + ideographicfireparen: 0x322B, + ideographichaveparen: 0x3232, + ideographichighcircle: 0x32A4, + ideographiciterationmark: 0x3005, + ideographiclaborcircle: 0x3298, + ideographiclaborparen: 0x3238, + ideographicleftcircle: 0x32A7, + ideographiclowcircle: 0x32A6, + ideographicmedicinecircle: 0x32A9, + ideographicmetalparen: 0x322E, + ideographicmoonparen: 0x322A, + ideographicnameparen: 0x3234, + ideographicperiod: 0x3002, + ideographicprintcircle: 0x329E, + ideographicreachparen: 0x3243, + ideographicrepresentparen: 0x3239, + ideographicresourceparen: 0x323E, + ideographicrightcircle: 0x32A8, + ideographicsecretcircle: 0x3299, + ideographicselfparen: 0x3242, + ideographicsocietyparen: 0x3233, + ideographicspace: 0x3000, + ideographicspecialparen: 0x3235, + ideographicstockparen: 0x3231, + ideographicstudyparen: 0x323B, + ideographicsunparen: 0x3230, + ideographicsuperviseparen: 0x323C, + ideographicwaterparen: 0x322C, + ideographicwoodparen: 0x322D, + ideographiczero: 0x3007, + ideographmetalcircle: 0x328E, + ideographmooncircle: 0x328A, + ideographnamecircle: 0x3294, + ideographsuncircle: 0x3290, + ideographwatercircle: 0x328C, + ideographwoodcircle: 0x328D, + ideva: 0x0907, + idieresis: 0x00EF, + idieresisacute: 0x1E2F, + idieresiscyrillic: 0x04E5, + idotbelow: 0x1ECB, + iebrevecyrillic: 0x04D7, + iecyrillic: 0x0435, + ieungacirclekorean: 0x3275, + ieungaparenkorean: 0x3215, + ieungcirclekorean: 0x3267, + ieungkorean: 0x3147, + ieungparenkorean: 0x3207, + igrave: 0x00EC, + igujarati: 0x0A87, + igurmukhi: 0x0A07, + ihiragana: 0x3044, + ihookabove: 0x1EC9, + iibengali: 0x0988, + iicyrillic: 0x0438, + iideva: 0x0908, + iigujarati: 0x0A88, + iigurmukhi: 0x0A08, + iimatragurmukhi: 0x0A40, + iinvertedbreve: 0x020B, + iishortcyrillic: 0x0439, + iivowelsignbengali: 0x09C0, + iivowelsigndeva: 0x0940, + iivowelsigngujarati: 0x0AC0, + ij: 0x0133, + ikatakana: 0x30A4, + ikatakanahalfwidth: 0xFF72, + ikorean: 0x3163, + ilde: 0x02DC, + iluyhebrew: 0x05AC, + imacron: 0x012B, + imacroncyrillic: 0x04E3, + imageorapproximatelyequal: 0x2253, + imatragurmukhi: 0x0A3F, + imonospace: 0xFF49, + increment: 0x2206, + infinity: 0x221E, + iniarmenian: 0x056B, + integral: 0x222B, + integralbottom: 0x2321, + integralbt: 0x2321, + integralex: 0xF8F5, + integraltop: 0x2320, + integraltp: 0x2320, + intersection: 0x2229, + intisquare: 0x3305, + invbullet: 0x25D8, + invcircle: 0x25D9, + invsmileface: 0x263B, + iocyrillic: 0x0451, + iogonek: 0x012F, + iota: 0x03B9, + iotadieresis: 0x03CA, + iotadieresistonos: 0x0390, + iotalatin: 0x0269, + iotatonos: 0x03AF, + iparen: 0x24A4, + irigurmukhi: 0x0A72, + ismallhiragana: 0x3043, + ismallkatakana: 0x30A3, + ismallkatakanahalfwidth: 0xFF68, + issharbengali: 0x09FA, + istroke: 0x0268, + isuperior: 0xF6ED, + iterationhiragana: 0x309D, + iterationkatakana: 0x30FD, + itilde: 0x0129, + itildebelow: 0x1E2D, + iubopomofo: 0x3129, + iucyrillic: 0x044E, + ivowelsignbengali: 0x09BF, + ivowelsigndeva: 0x093F, + ivowelsigngujarati: 0x0ABF, + izhitsacyrillic: 0x0475, + izhitsadblgravecyrillic: 0x0477, + j: 0x006A, + jaarmenian: 0x0571, + jabengali: 0x099C, + jadeva: 0x091C, + jagujarati: 0x0A9C, + jagurmukhi: 0x0A1C, + jbopomofo: 0x3110, + jcaron: 0x01F0, + jcircle: 0x24D9, + jcircumflex: 0x0135, + jcrossedtail: 0x029D, + jdotlessstroke: 0x025F, + jecyrillic: 0x0458, + jeemarabic: 0x062C, + jeemfinalarabic: 0xFE9E, + jeeminitialarabic: 0xFE9F, + jeemmedialarabic: 0xFEA0, + jeharabic: 0x0698, + jehfinalarabic: 0xFB8B, + jhabengali: 0x099D, + jhadeva: 0x091D, + jhagujarati: 0x0A9D, + jhagurmukhi: 0x0A1D, + jheharmenian: 0x057B, + jis: 0x3004, + jmonospace: 0xFF4A, + jparen: 0x24A5, + jsuperior: 0x02B2, + k: 0x006B, + kabashkircyrillic: 0x04A1, + kabengali: 0x0995, + kacute: 0x1E31, + kacyrillic: 0x043A, + kadescendercyrillic: 0x049B, + kadeva: 0x0915, + kaf: 0x05DB, + kafarabic: 0x0643, + kafdagesh: 0xFB3B, + kafdageshhebrew: 0xFB3B, + kaffinalarabic: 0xFEDA, + kafhebrew: 0x05DB, + kafinitialarabic: 0xFEDB, + kafmedialarabic: 0xFEDC, + kafrafehebrew: 0xFB4D, + kagujarati: 0x0A95, + kagurmukhi: 0x0A15, + kahiragana: 0x304B, + kahookcyrillic: 0x04C4, + kakatakana: 0x30AB, + kakatakanahalfwidth: 0xFF76, + kappa: 0x03BA, + kappasymbolgreek: 0x03F0, + kapyeounmieumkorean: 0x3171, + kapyeounphieuphkorean: 0x3184, + kapyeounpieupkorean: 0x3178, + kapyeounssangpieupkorean: 0x3179, + karoriisquare: 0x330D, + kashidaautoarabic: 0x0640, + kashidaautonosidebearingarabic: 0x0640, + kasmallkatakana: 0x30F5, + kasquare: 0x3384, + kasraarabic: 0x0650, + kasratanarabic: 0x064D, + kastrokecyrillic: 0x049F, + katahiraprolongmarkhalfwidth: 0xFF70, + kaverticalstrokecyrillic: 0x049D, + kbopomofo: 0x310E, + kcalsquare: 0x3389, + kcaron: 0x01E9, + kcedilla: 0x0137, + kcircle: 0x24DA, + kcommaaccent: 0x0137, + kdotbelow: 0x1E33, + keharmenian: 0x0584, + kehiragana: 0x3051, + kekatakana: 0x30B1, + kekatakanahalfwidth: 0xFF79, + kenarmenian: 0x056F, + kesmallkatakana: 0x30F6, + kgreenlandic: 0x0138, + khabengali: 0x0996, + khacyrillic: 0x0445, + khadeva: 0x0916, + khagujarati: 0x0A96, + khagurmukhi: 0x0A16, + khaharabic: 0x062E, + khahfinalarabic: 0xFEA6, + khahinitialarabic: 0xFEA7, + khahmedialarabic: 0xFEA8, + kheicoptic: 0x03E7, + khhadeva: 0x0959, + khhagurmukhi: 0x0A59, + khieukhacirclekorean: 0x3278, + khieukhaparenkorean: 0x3218, + khieukhcirclekorean: 0x326A, + khieukhkorean: 0x314B, + khieukhparenkorean: 0x320A, + khokhaithai: 0x0E02, + khokhonthai: 0x0E05, + khokhuatthai: 0x0E03, + khokhwaithai: 0x0E04, + khomutthai: 0x0E5B, + khook: 0x0199, + khorakhangthai: 0x0E06, + khzsquare: 0x3391, + kihiragana: 0x304D, + kikatakana: 0x30AD, + kikatakanahalfwidth: 0xFF77, + kiroguramusquare: 0x3315, + kiromeetorusquare: 0x3316, + kirosquare: 0x3314, + kiyeokacirclekorean: 0x326E, + kiyeokaparenkorean: 0x320E, + kiyeokcirclekorean: 0x3260, + kiyeokkorean: 0x3131, + kiyeokparenkorean: 0x3200, + kiyeoksioskorean: 0x3133, + kjecyrillic: 0x045C, + klinebelow: 0x1E35, + klsquare: 0x3398, + kmcubedsquare: 0x33A6, + kmonospace: 0xFF4B, + kmsquaredsquare: 0x33A2, + kohiragana: 0x3053, + kohmsquare: 0x33C0, + kokaithai: 0x0E01, + kokatakana: 0x30B3, + kokatakanahalfwidth: 0xFF7A, + kooposquare: 0x331E, + koppacyrillic: 0x0481, + koreanstandardsymbol: 0x327F, + koroniscmb: 0x0343, + kparen: 0x24A6, + kpasquare: 0x33AA, + ksicyrillic: 0x046F, + ktsquare: 0x33CF, + kturned: 0x029E, + kuhiragana: 0x304F, + kukatakana: 0x30AF, + kukatakanahalfwidth: 0xFF78, + kvsquare: 0x33B8, + kwsquare: 0x33BE, + l: 0x006C, + labengali: 0x09B2, + lacute: 0x013A, + ladeva: 0x0932, + lagujarati: 0x0AB2, + lagurmukhi: 0x0A32, + lakkhangyaothai: 0x0E45, + lamaleffinalarabic: 0xFEFC, + lamalefhamzaabovefinalarabic: 0xFEF8, + lamalefhamzaaboveisolatedarabic: 0xFEF7, + lamalefhamzabelowfinalarabic: 0xFEFA, + lamalefhamzabelowisolatedarabic: 0xFEF9, + lamalefisolatedarabic: 0xFEFB, + lamalefmaddaabovefinalarabic: 0xFEF6, + lamalefmaddaaboveisolatedarabic: 0xFEF5, + lamarabic: 0x0644, + lambda: 0x03BB, + lambdastroke: 0x019B, + lamed: 0x05DC, + lameddagesh: 0xFB3C, + lameddageshhebrew: 0xFB3C, + lamedhebrew: 0x05DC, + lamfinalarabic: 0xFEDE, + lamhahinitialarabic: 0xFCCA, + laminitialarabic: 0xFEDF, + lamjeeminitialarabic: 0xFCC9, + lamkhahinitialarabic: 0xFCCB, + lamlamhehisolatedarabic: 0xFDF2, + lammedialarabic: 0xFEE0, + lammeemhahinitialarabic: 0xFD88, + lammeeminitialarabic: 0xFCCC, + largecircle: 0x25EF, + lbar: 0x019A, + lbelt: 0x026C, + lbopomofo: 0x310C, + lcaron: 0x013E, + lcedilla: 0x013C, + lcircle: 0x24DB, + lcircumflexbelow: 0x1E3D, + lcommaaccent: 0x013C, + ldot: 0x0140, + ldotaccent: 0x0140, + ldotbelow: 0x1E37, + ldotbelowmacron: 0x1E39, + leftangleabovecmb: 0x031A, + lefttackbelowcmb: 0x0318, + less: 0x003C, + lessequal: 0x2264, + lessequalorgreater: 0x22DA, + lessmonospace: 0xFF1C, + lessorequivalent: 0x2272, + lessorgreater: 0x2276, + lessoverequal: 0x2266, + lesssmall: 0xFE64, + lezh: 0x026E, + lfblock: 0x258C, + lhookretroflex: 0x026D, + lira: 0x20A4, + liwnarmenian: 0x056C, + lj: 0x01C9, + ljecyrillic: 0x0459, + ll: 0xF6C0, + lladeva: 0x0933, + llagujarati: 0x0AB3, + llinebelow: 0x1E3B, + llladeva: 0x0934, + llvocalicbengali: 0x09E1, + llvocalicdeva: 0x0961, + llvocalicvowelsignbengali: 0x09E3, + llvocalicvowelsigndeva: 0x0963, + lmiddletilde: 0x026B, + lmonospace: 0xFF4C, + lmsquare: 0x33D0, + lochulathai: 0x0E2C, + logicaland: 0x2227, + logicalnot: 0x00AC, + logicalnotreversed: 0x2310, + logicalor: 0x2228, + lolingthai: 0x0E25, + longs: 0x017F, + lowlinecenterline: 0xFE4E, + lowlinecmb: 0x0332, + lowlinedashed: 0xFE4D, + lozenge: 0x25CA, + lparen: 0x24A7, + lslash: 0x0142, + lsquare: 0x2113, + lsuperior: 0xF6EE, + ltshade: 0x2591, + luthai: 0x0E26, + lvocalicbengali: 0x098C, + lvocalicdeva: 0x090C, + lvocalicvowelsignbengali: 0x09E2, + lvocalicvowelsigndeva: 0x0962, + lxsquare: 0x33D3, + m: 0x006D, + mabengali: 0x09AE, + macron: 0x00AF, + macronbelowcmb: 0x0331, + macroncmb: 0x0304, + macronlowmod: 0x02CD, + macronmonospace: 0xFFE3, + macute: 0x1E3F, + madeva: 0x092E, + magujarati: 0x0AAE, + magurmukhi: 0x0A2E, + mahapakhhebrew: 0x05A4, + mahapakhlefthebrew: 0x05A4, + mahiragana: 0x307E, + maichattawalowleftthai: 0xF895, + maichattawalowrightthai: 0xF894, + maichattawathai: 0x0E4B, + maichattawaupperleftthai: 0xF893, + maieklowleftthai: 0xF88C, + maieklowrightthai: 0xF88B, + maiekthai: 0x0E48, + maiekupperleftthai: 0xF88A, + maihanakatleftthai: 0xF884, + maihanakatthai: 0x0E31, + maitaikhuleftthai: 0xF889, + maitaikhuthai: 0x0E47, + maitholowleftthai: 0xF88F, + maitholowrightthai: 0xF88E, + maithothai: 0x0E49, + maithoupperleftthai: 0xF88D, + maitrilowleftthai: 0xF892, + maitrilowrightthai: 0xF891, + maitrithai: 0x0E4A, + maitriupperleftthai: 0xF890, + maiyamokthai: 0x0E46, + makatakana: 0x30DE, + makatakanahalfwidth: 0xFF8F, + male: 0x2642, + mansyonsquare: 0x3347, + maqafhebrew: 0x05BE, + mars: 0x2642, + masoracirclehebrew: 0x05AF, + masquare: 0x3383, + mbopomofo: 0x3107, + mbsquare: 0x33D4, + mcircle: 0x24DC, + mcubedsquare: 0x33A5, + mdotaccent: 0x1E41, + mdotbelow: 0x1E43, + meemarabic: 0x0645, + meemfinalarabic: 0xFEE2, + meeminitialarabic: 0xFEE3, + meemmedialarabic: 0xFEE4, + meemmeeminitialarabic: 0xFCD1, + meemmeemisolatedarabic: 0xFC48, + meetorusquare: 0x334D, + mehiragana: 0x3081, + meizierasquare: 0x337E, + mekatakana: 0x30E1, + mekatakanahalfwidth: 0xFF92, + mem: 0x05DE, + memdagesh: 0xFB3E, + memdageshhebrew: 0xFB3E, + memhebrew: 0x05DE, + menarmenian: 0x0574, + merkhahebrew: 0x05A5, + merkhakefulahebrew: 0x05A6, + merkhakefulalefthebrew: 0x05A6, + merkhalefthebrew: 0x05A5, + mhook: 0x0271, + mhzsquare: 0x3392, + middledotkatakanahalfwidth: 0xFF65, + middot: 0x00B7, + mieumacirclekorean: 0x3272, + mieumaparenkorean: 0x3212, + mieumcirclekorean: 0x3264, + mieumkorean: 0x3141, + mieumpansioskorean: 0x3170, + mieumparenkorean: 0x3204, + mieumpieupkorean: 0x316E, + mieumsioskorean: 0x316F, + mihiragana: 0x307F, + mikatakana: 0x30DF, + mikatakanahalfwidth: 0xFF90, + minus: 0x2212, + minusbelowcmb: 0x0320, + minuscircle: 0x2296, + minusmod: 0x02D7, + minusplus: 0x2213, + minute: 0x2032, + miribaarusquare: 0x334A, + mirisquare: 0x3349, + mlonglegturned: 0x0270, + mlsquare: 0x3396, + mmcubedsquare: 0x33A3, + mmonospace: 0xFF4D, + mmsquaredsquare: 0x339F, + mohiragana: 0x3082, + mohmsquare: 0x33C1, + mokatakana: 0x30E2, + mokatakanahalfwidth: 0xFF93, + molsquare: 0x33D6, + momathai: 0x0E21, + moverssquare: 0x33A7, + moverssquaredsquare: 0x33A8, + mparen: 0x24A8, + mpasquare: 0x33AB, + mssquare: 0x33B3, + msuperior: 0xF6EF, + mturned: 0x026F, + mu: 0x00B5, + mu1: 0x00B5, + muasquare: 0x3382, + muchgreater: 0x226B, + muchless: 0x226A, + mufsquare: 0x338C, + mugreek: 0x03BC, + mugsquare: 0x338D, + muhiragana: 0x3080, + mukatakana: 0x30E0, + mukatakanahalfwidth: 0xFF91, + mulsquare: 0x3395, + multiply: 0x00D7, + mumsquare: 0x339B, + munahhebrew: 0x05A3, + munahlefthebrew: 0x05A3, + musicalnote: 0x266A, + musicalnotedbl: 0x266B, + musicflatsign: 0x266D, + musicsharpsign: 0x266F, + mussquare: 0x33B2, + muvsquare: 0x33B6, + muwsquare: 0x33BC, + mvmegasquare: 0x33B9, + mvsquare: 0x33B7, + mwmegasquare: 0x33BF, + mwsquare: 0x33BD, + n: 0x006E, + nabengali: 0x09A8, + nabla: 0x2207, + nacute: 0x0144, + nadeva: 0x0928, + nagujarati: 0x0AA8, + nagurmukhi: 0x0A28, + nahiragana: 0x306A, + nakatakana: 0x30CA, + nakatakanahalfwidth: 0xFF85, + napostrophe: 0x0149, + nasquare: 0x3381, + nbopomofo: 0x310B, + nbspace: 0x00A0, + ncaron: 0x0148, + ncedilla: 0x0146, + ncircle: 0x24DD, + ncircumflexbelow: 0x1E4B, + ncommaaccent: 0x0146, + ndotaccent: 0x1E45, + ndotbelow: 0x1E47, + nehiragana: 0x306D, + nekatakana: 0x30CD, + nekatakanahalfwidth: 0xFF88, + newsheqelsign: 0x20AA, + nfsquare: 0x338B, + ngabengali: 0x0999, + ngadeva: 0x0919, + ngagujarati: 0x0A99, + ngagurmukhi: 0x0A19, + ngonguthai: 0x0E07, + nhiragana: 0x3093, + nhookleft: 0x0272, + nhookretroflex: 0x0273, + nieunacirclekorean: 0x326F, + nieunaparenkorean: 0x320F, + nieuncieuckorean: 0x3135, + nieuncirclekorean: 0x3261, + nieunhieuhkorean: 0x3136, + nieunkorean: 0x3134, + nieunpansioskorean: 0x3168, + nieunparenkorean: 0x3201, + nieunsioskorean: 0x3167, + nieuntikeutkorean: 0x3166, + nihiragana: 0x306B, + nikatakana: 0x30CB, + nikatakanahalfwidth: 0xFF86, + nikhahitleftthai: 0xF899, + nikhahitthai: 0x0E4D, + nine: 0x0039, + ninearabic: 0x0669, + ninebengali: 0x09EF, + ninecircle: 0x2468, + ninecircleinversesansserif: 0x2792, + ninedeva: 0x096F, + ninegujarati: 0x0AEF, + ninegurmukhi: 0x0A6F, + ninehackarabic: 0x0669, + ninehangzhou: 0x3029, + nineideographicparen: 0x3228, + nineinferior: 0x2089, + ninemonospace: 0xFF19, + nineoldstyle: 0xF739, + nineparen: 0x247C, + nineperiod: 0x2490, + ninepersian: 0x06F9, + nineroman: 0x2178, + ninesuperior: 0x2079, + nineteencircle: 0x2472, + nineteenparen: 0x2486, + nineteenperiod: 0x249A, + ninethai: 0x0E59, + nj: 0x01CC, + njecyrillic: 0x045A, + nkatakana: 0x30F3, + nkatakanahalfwidth: 0xFF9D, + nlegrightlong: 0x019E, + nlinebelow: 0x1E49, + nmonospace: 0xFF4E, + nmsquare: 0x339A, + nnabengali: 0x09A3, + nnadeva: 0x0923, + nnagujarati: 0x0AA3, + nnagurmukhi: 0x0A23, + nnnadeva: 0x0929, + nohiragana: 0x306E, + nokatakana: 0x30CE, + nokatakanahalfwidth: 0xFF89, + nonbreakingspace: 0x00A0, + nonenthai: 0x0E13, + nonuthai: 0x0E19, + noonarabic: 0x0646, + noonfinalarabic: 0xFEE6, + noonghunnaarabic: 0x06BA, + noonghunnafinalarabic: 0xFB9F, + nooninitialarabic: 0xFEE7, + noonjeeminitialarabic: 0xFCD2, + noonjeemisolatedarabic: 0xFC4B, + noonmedialarabic: 0xFEE8, + noonmeeminitialarabic: 0xFCD5, + noonmeemisolatedarabic: 0xFC4E, + noonnoonfinalarabic: 0xFC8D, + notcontains: 0x220C, + notelement: 0x2209, + notelementof: 0x2209, + notequal: 0x2260, + notgreater: 0x226F, + notgreaternorequal: 0x2271, + notgreaternorless: 0x2279, + notidentical: 0x2262, + notless: 0x226E, + notlessnorequal: 0x2270, + notparallel: 0x2226, + notprecedes: 0x2280, + notsubset: 0x2284, + notsucceeds: 0x2281, + notsuperset: 0x2285, + nowarmenian: 0x0576, + nparen: 0x24A9, + nssquare: 0x33B1, + nsuperior: 0x207F, + ntilde: 0x00F1, + nu: 0x03BD, + nuhiragana: 0x306C, + nukatakana: 0x30CC, + nukatakanahalfwidth: 0xFF87, + nuktabengali: 0x09BC, + nuktadeva: 0x093C, + nuktagujarati: 0x0ABC, + nuktagurmukhi: 0x0A3C, + numbersign: 0x0023, + numbersignmonospace: 0xFF03, + numbersignsmall: 0xFE5F, + numeralsigngreek: 0x0374, + numeralsignlowergreek: 0x0375, + numero: 0x2116, + nun: 0x05E0, + nundagesh: 0xFB40, + nundageshhebrew: 0xFB40, + nunhebrew: 0x05E0, + nvsquare: 0x33B5, + nwsquare: 0x33BB, + nyabengali: 0x099E, + nyadeva: 0x091E, + nyagujarati: 0x0A9E, + nyagurmukhi: 0x0A1E, + o: 0x006F, + oacute: 0x00F3, + oangthai: 0x0E2D, + obarred: 0x0275, + obarredcyrillic: 0x04E9, + obarreddieresiscyrillic: 0x04EB, + obengali: 0x0993, + obopomofo: 0x311B, + obreve: 0x014F, + ocandradeva: 0x0911, + ocandragujarati: 0x0A91, + ocandravowelsigndeva: 0x0949, + ocandravowelsigngujarati: 0x0AC9, + ocaron: 0x01D2, + ocircle: 0x24DE, + ocircumflex: 0x00F4, + ocircumflexacute: 0x1ED1, + ocircumflexdotbelow: 0x1ED9, + ocircumflexgrave: 0x1ED3, + ocircumflexhookabove: 0x1ED5, + ocircumflextilde: 0x1ED7, + ocyrillic: 0x043E, + odblacute: 0x0151, + odblgrave: 0x020D, + odeva: 0x0913, + odieresis: 0x00F6, + odieresiscyrillic: 0x04E7, + odotbelow: 0x1ECD, + oe: 0x0153, + oekorean: 0x315A, + ogonek: 0x02DB, + ogonekcmb: 0x0328, + ograve: 0x00F2, + ogujarati: 0x0A93, + oharmenian: 0x0585, + ohiragana: 0x304A, + ohookabove: 0x1ECF, + ohorn: 0x01A1, + ohornacute: 0x1EDB, + ohorndotbelow: 0x1EE3, + ohorngrave: 0x1EDD, + ohornhookabove: 0x1EDF, + ohorntilde: 0x1EE1, + ohungarumlaut: 0x0151, + oi: 0x01A3, + oinvertedbreve: 0x020F, + okatakana: 0x30AA, + okatakanahalfwidth: 0xFF75, + okorean: 0x3157, + olehebrew: 0x05AB, + omacron: 0x014D, + omacronacute: 0x1E53, + omacrongrave: 0x1E51, + omdeva: 0x0950, + omega: 0x03C9, + omega1: 0x03D6, + omegacyrillic: 0x0461, + omegalatinclosed: 0x0277, + omegaroundcyrillic: 0x047B, + omegatitlocyrillic: 0x047D, + omegatonos: 0x03CE, + omgujarati: 0x0AD0, + omicron: 0x03BF, + omicrontonos: 0x03CC, + omonospace: 0xFF4F, + one: 0x0031, + onearabic: 0x0661, + onebengali: 0x09E7, + onecircle: 0x2460, + onecircleinversesansserif: 0x278A, + onedeva: 0x0967, + onedotenleader: 0x2024, + oneeighth: 0x215B, + onefitted: 0xF6DC, + onegujarati: 0x0AE7, + onegurmukhi: 0x0A67, + onehackarabic: 0x0661, + onehalf: 0x00BD, + onehangzhou: 0x3021, + oneideographicparen: 0x3220, + oneinferior: 0x2081, + onemonospace: 0xFF11, + onenumeratorbengali: 0x09F4, + oneoldstyle: 0xF731, + oneparen: 0x2474, + oneperiod: 0x2488, + onepersian: 0x06F1, + onequarter: 0x00BC, + oneroman: 0x2170, + onesuperior: 0x00B9, + onethai: 0x0E51, + onethird: 0x2153, + oogonek: 0x01EB, + oogonekmacron: 0x01ED, + oogurmukhi: 0x0A13, + oomatragurmukhi: 0x0A4B, + oopen: 0x0254, + oparen: 0x24AA, + openbullet: 0x25E6, + option: 0x2325, + ordfeminine: 0x00AA, + ordmasculine: 0x00BA, + orthogonal: 0x221F, + oshortdeva: 0x0912, + oshortvowelsigndeva: 0x094A, + oslash: 0x00F8, + oslashacute: 0x01FF, + osmallhiragana: 0x3049, + osmallkatakana: 0x30A9, + osmallkatakanahalfwidth: 0xFF6B, + ostrokeacute: 0x01FF, + osuperior: 0xF6F0, + otcyrillic: 0x047F, + otilde: 0x00F5, + otildeacute: 0x1E4D, + otildedieresis: 0x1E4F, + oubopomofo: 0x3121, + overline: 0x203E, + overlinecenterline: 0xFE4A, + overlinecmb: 0x0305, + overlinedashed: 0xFE49, + overlinedblwavy: 0xFE4C, + overlinewavy: 0xFE4B, + overscore: 0x00AF, + ovowelsignbengali: 0x09CB, + ovowelsigndeva: 0x094B, + ovowelsigngujarati: 0x0ACB, + p: 0x0070, + paampssquare: 0x3380, + paasentosquare: 0x332B, + pabengali: 0x09AA, + pacute: 0x1E55, + padeva: 0x092A, + pagedown: 0x21DF, + pageup: 0x21DE, + pagujarati: 0x0AAA, + pagurmukhi: 0x0A2A, + pahiragana: 0x3071, + paiyannoithai: 0x0E2F, + pakatakana: 0x30D1, + palatalizationcyrilliccmb: 0x0484, + palochkacyrillic: 0x04C0, + pansioskorean: 0x317F, + paragraph: 0x00B6, + parallel: 0x2225, + parenleft: 0x0028, + parenleftaltonearabic: 0xFD3E, + parenleftbt: 0xF8ED, + parenleftex: 0xF8EC, + parenleftinferior: 0x208D, + parenleftmonospace: 0xFF08, + parenleftsmall: 0xFE59, + parenleftsuperior: 0x207D, + parenlefttp: 0xF8EB, + parenleftvertical: 0xFE35, + parenright: 0x0029, + parenrightaltonearabic: 0xFD3F, + parenrightbt: 0xF8F8, + parenrightex: 0xF8F7, + parenrightinferior: 0x208E, + parenrightmonospace: 0xFF09, + parenrightsmall: 0xFE5A, + parenrightsuperior: 0x207E, + parenrighttp: 0xF8F6, + parenrightvertical: 0xFE36, + partialdiff: 0x2202, + paseqhebrew: 0x05C0, + pashtahebrew: 0x0599, + pasquare: 0x33A9, + patah: 0x05B7, + patah11: 0x05B7, + patah1d: 0x05B7, + patah2a: 0x05B7, + patahhebrew: 0x05B7, + patahnarrowhebrew: 0x05B7, + patahquarterhebrew: 0x05B7, + patahwidehebrew: 0x05B7, + pazerhebrew: 0x05A1, + pbopomofo: 0x3106, + pcircle: 0x24DF, + pdotaccent: 0x1E57, + pe: 0x05E4, + pecyrillic: 0x043F, + pedagesh: 0xFB44, + pedageshhebrew: 0xFB44, + peezisquare: 0x333B, + pefinaldageshhebrew: 0xFB43, + peharabic: 0x067E, + peharmenian: 0x057A, + pehebrew: 0x05E4, + pehfinalarabic: 0xFB57, + pehinitialarabic: 0xFB58, + pehiragana: 0x307A, + pehmedialarabic: 0xFB59, + pekatakana: 0x30DA, + pemiddlehookcyrillic: 0x04A7, + perafehebrew: 0xFB4E, + percent: 0x0025, + percentarabic: 0x066A, + percentmonospace: 0xFF05, + percentsmall: 0xFE6A, + period: 0x002E, + periodarmenian: 0x0589, + periodcentered: 0x00B7, + periodhalfwidth: 0xFF61, + periodinferior: 0xF6E7, + periodmonospace: 0xFF0E, + periodsmall: 0xFE52, + periodsuperior: 0xF6E8, + perispomenigreekcmb: 0x0342, + perpendicular: 0x22A5, + perthousand: 0x2030, + peseta: 0x20A7, + pfsquare: 0x338A, + phabengali: 0x09AB, + phadeva: 0x092B, + phagujarati: 0x0AAB, + phagurmukhi: 0x0A2B, + phi: 0x03C6, + phi1: 0x03D5, + phieuphacirclekorean: 0x327A, + phieuphaparenkorean: 0x321A, + phieuphcirclekorean: 0x326C, + phieuphkorean: 0x314D, + phieuphparenkorean: 0x320C, + philatin: 0x0278, + phinthuthai: 0x0E3A, + phisymbolgreek: 0x03D5, + phook: 0x01A5, + phophanthai: 0x0E1E, + phophungthai: 0x0E1C, + phosamphaothai: 0x0E20, + pi: 0x03C0, + pieupacirclekorean: 0x3273, + pieupaparenkorean: 0x3213, + pieupcieuckorean: 0x3176, + pieupcirclekorean: 0x3265, + pieupkiyeokkorean: 0x3172, + pieupkorean: 0x3142, + pieupparenkorean: 0x3205, + pieupsioskiyeokkorean: 0x3174, + pieupsioskorean: 0x3144, + pieupsiostikeutkorean: 0x3175, + pieupthieuthkorean: 0x3177, + pieuptikeutkorean: 0x3173, + pihiragana: 0x3074, + pikatakana: 0x30D4, + pisymbolgreek: 0x03D6, + piwrarmenian: 0x0583, + plus: 0x002B, + plusbelowcmb: 0x031F, + pluscircle: 0x2295, + plusminus: 0x00B1, + plusmod: 0x02D6, + plusmonospace: 0xFF0B, + plussmall: 0xFE62, + plussuperior: 0x207A, + pmonospace: 0xFF50, + pmsquare: 0x33D8, + pohiragana: 0x307D, + pointingindexdownwhite: 0x261F, + pointingindexleftwhite: 0x261C, + pointingindexrightwhite: 0x261E, + pointingindexupwhite: 0x261D, + pokatakana: 0x30DD, + poplathai: 0x0E1B, + postalmark: 0x3012, + postalmarkface: 0x3020, + pparen: 0x24AB, + precedes: 0x227A, + prescription: 0x211E, + primemod: 0x02B9, + primereversed: 0x2035, + product: 0x220F, + projective: 0x2305, + prolongedkana: 0x30FC, + propellor: 0x2318, + propersubset: 0x2282, + propersuperset: 0x2283, + proportion: 0x2237, + proportional: 0x221D, + psi: 0x03C8, + psicyrillic: 0x0471, + psilipneumatacyrilliccmb: 0x0486, + pssquare: 0x33B0, + puhiragana: 0x3077, + pukatakana: 0x30D7, + pvsquare: 0x33B4, + pwsquare: 0x33BA, + q: 0x0071, + qadeva: 0x0958, + qadmahebrew: 0x05A8, + qafarabic: 0x0642, + qaffinalarabic: 0xFED6, + qafinitialarabic: 0xFED7, + qafmedialarabic: 0xFED8, + qamats: 0x05B8, + qamats10: 0x05B8, + qamats1a: 0x05B8, + qamats1c: 0x05B8, + qamats27: 0x05B8, + qamats29: 0x05B8, + qamats33: 0x05B8, + qamatsde: 0x05B8, + qamatshebrew: 0x05B8, + qamatsnarrowhebrew: 0x05B8, + qamatsqatanhebrew: 0x05B8, + qamatsqatannarrowhebrew: 0x05B8, + qamatsqatanquarterhebrew: 0x05B8, + qamatsqatanwidehebrew: 0x05B8, + qamatsquarterhebrew: 0x05B8, + qamatswidehebrew: 0x05B8, + qarneyparahebrew: 0x059F, + qbopomofo: 0x3111, + qcircle: 0x24E0, + qhook: 0x02A0, + qmonospace: 0xFF51, + qof: 0x05E7, + qofdagesh: 0xFB47, + qofdageshhebrew: 0xFB47, + qofhebrew: 0x05E7, + qparen: 0x24AC, + quarternote: 0x2669, + qubuts: 0x05BB, + qubuts18: 0x05BB, + qubuts25: 0x05BB, + qubuts31: 0x05BB, + qubutshebrew: 0x05BB, + qubutsnarrowhebrew: 0x05BB, + qubutsquarterhebrew: 0x05BB, + qubutswidehebrew: 0x05BB, + question: 0x003F, + questionarabic: 0x061F, + questionarmenian: 0x055E, + questiondown: 0x00BF, + questiondownsmall: 0xF7BF, + questiongreek: 0x037E, + questionmonospace: 0xFF1F, + questionsmall: 0xF73F, + quotedbl: 0x0022, + quotedblbase: 0x201E, + quotedblleft: 0x201C, + quotedblmonospace: 0xFF02, + quotedblprime: 0x301E, + quotedblprimereversed: 0x301D, + quotedblright: 0x201D, + quoteleft: 0x2018, + quoteleftreversed: 0x201B, + quotereversed: 0x201B, + quoteright: 0x2019, + quoterightn: 0x0149, + quotesinglbase: 0x201A, + quotesingle: 0x0027, + quotesinglemonospace: 0xFF07, + r: 0x0072, + raarmenian: 0x057C, + rabengali: 0x09B0, + racute: 0x0155, + radeva: 0x0930, + radical: 0x221A, + radicalex: 0xF8E5, + radoverssquare: 0x33AE, + radoverssquaredsquare: 0x33AF, + radsquare: 0x33AD, + rafe: 0x05BF, + rafehebrew: 0x05BF, + ragujarati: 0x0AB0, + ragurmukhi: 0x0A30, + rahiragana: 0x3089, + rakatakana: 0x30E9, + rakatakanahalfwidth: 0xFF97, + ralowerdiagonalbengali: 0x09F1, + ramiddlediagonalbengali: 0x09F0, + ramshorn: 0x0264, + ratio: 0x2236, + rbopomofo: 0x3116, + rcaron: 0x0159, + rcedilla: 0x0157, + rcircle: 0x24E1, + rcommaaccent: 0x0157, + rdblgrave: 0x0211, + rdotaccent: 0x1E59, + rdotbelow: 0x1E5B, + rdotbelowmacron: 0x1E5D, + referencemark: 0x203B, + reflexsubset: 0x2286, + reflexsuperset: 0x2287, + registered: 0x00AE, + registersans: 0xF8E8, + registerserif: 0xF6DA, + reharabic: 0x0631, + reharmenian: 0x0580, + rehfinalarabic: 0xFEAE, + rehiragana: 0x308C, + rekatakana: 0x30EC, + rekatakanahalfwidth: 0xFF9A, + resh: 0x05E8, + reshdageshhebrew: 0xFB48, + reshhebrew: 0x05E8, + reversedtilde: 0x223D, + reviahebrew: 0x0597, + reviamugrashhebrew: 0x0597, + revlogicalnot: 0x2310, + rfishhook: 0x027E, + rfishhookreversed: 0x027F, + rhabengali: 0x09DD, + rhadeva: 0x095D, + rho: 0x03C1, + rhook: 0x027D, + rhookturned: 0x027B, + rhookturnedsuperior: 0x02B5, + rhosymbolgreek: 0x03F1, + rhotichookmod: 0x02DE, + rieulacirclekorean: 0x3271, + rieulaparenkorean: 0x3211, + rieulcirclekorean: 0x3263, + rieulhieuhkorean: 0x3140, + rieulkiyeokkorean: 0x313A, + rieulkiyeoksioskorean: 0x3169, + rieulkorean: 0x3139, + rieulmieumkorean: 0x313B, + rieulpansioskorean: 0x316C, + rieulparenkorean: 0x3203, + rieulphieuphkorean: 0x313F, + rieulpieupkorean: 0x313C, + rieulpieupsioskorean: 0x316B, + rieulsioskorean: 0x313D, + rieulthieuthkorean: 0x313E, + rieultikeutkorean: 0x316A, + rieulyeorinhieuhkorean: 0x316D, + rightangle: 0x221F, + righttackbelowcmb: 0x0319, + righttriangle: 0x22BF, + rihiragana: 0x308A, + rikatakana: 0x30EA, + rikatakanahalfwidth: 0xFF98, + ring: 0x02DA, + ringbelowcmb: 0x0325, + ringcmb: 0x030A, + ringhalfleft: 0x02BF, + ringhalfleftarmenian: 0x0559, + ringhalfleftbelowcmb: 0x031C, + ringhalfleftcentered: 0x02D3, + ringhalfright: 0x02BE, + ringhalfrightbelowcmb: 0x0339, + ringhalfrightcentered: 0x02D2, + rinvertedbreve: 0x0213, + rittorusquare: 0x3351, + rlinebelow: 0x1E5F, + rlongleg: 0x027C, + rlonglegturned: 0x027A, + rmonospace: 0xFF52, + rohiragana: 0x308D, + rokatakana: 0x30ED, + rokatakanahalfwidth: 0xFF9B, + roruathai: 0x0E23, + rparen: 0x24AD, + rrabengali: 0x09DC, + rradeva: 0x0931, + rragurmukhi: 0x0A5C, + rreharabic: 0x0691, + rrehfinalarabic: 0xFB8D, + rrvocalicbengali: 0x09E0, + rrvocalicdeva: 0x0960, + rrvocalicgujarati: 0x0AE0, + rrvocalicvowelsignbengali: 0x09C4, + rrvocalicvowelsigndeva: 0x0944, + rrvocalicvowelsigngujarati: 0x0AC4, + rsuperior: 0xF6F1, + rtblock: 0x2590, + rturned: 0x0279, + rturnedsuperior: 0x02B4, + ruhiragana: 0x308B, + rukatakana: 0x30EB, + rukatakanahalfwidth: 0xFF99, + rupeemarkbengali: 0x09F2, + rupeesignbengali: 0x09F3, + rupiah: 0xF6DD, + ruthai: 0x0E24, + rvocalicbengali: 0x098B, + rvocalicdeva: 0x090B, + rvocalicgujarati: 0x0A8B, + rvocalicvowelsignbengali: 0x09C3, + rvocalicvowelsigndeva: 0x0943, + rvocalicvowelsigngujarati: 0x0AC3, + s: 0x0073, + sabengali: 0x09B8, + sacute: 0x015B, + sacutedotaccent: 0x1E65, + sadarabic: 0x0635, + sadeva: 0x0938, + sadfinalarabic: 0xFEBA, + sadinitialarabic: 0xFEBB, + sadmedialarabic: 0xFEBC, + sagujarati: 0x0AB8, + sagurmukhi: 0x0A38, + sahiragana: 0x3055, + sakatakana: 0x30B5, + sakatakanahalfwidth: 0xFF7B, + sallallahoualayhewasallamarabic: 0xFDFA, + samekh: 0x05E1, + samekhdagesh: 0xFB41, + samekhdageshhebrew: 0xFB41, + samekhhebrew: 0x05E1, + saraaathai: 0x0E32, + saraaethai: 0x0E41, + saraaimaimalaithai: 0x0E44, + saraaimaimuanthai: 0x0E43, + saraamthai: 0x0E33, + saraathai: 0x0E30, + saraethai: 0x0E40, + saraiileftthai: 0xF886, + saraiithai: 0x0E35, + saraileftthai: 0xF885, + saraithai: 0x0E34, + saraothai: 0x0E42, + saraueeleftthai: 0xF888, + saraueethai: 0x0E37, + saraueleftthai: 0xF887, + sarauethai: 0x0E36, + sarauthai: 0x0E38, + sarauuthai: 0x0E39, + sbopomofo: 0x3119, + scaron: 0x0161, + scarondotaccent: 0x1E67, + scedilla: 0x015F, + schwa: 0x0259, + schwacyrillic: 0x04D9, + schwadieresiscyrillic: 0x04DB, + schwahook: 0x025A, + scircle: 0x24E2, + scircumflex: 0x015D, + scommaaccent: 0x0219, + sdotaccent: 0x1E61, + sdotbelow: 0x1E63, + sdotbelowdotaccent: 0x1E69, + seagullbelowcmb: 0x033C, + second: 0x2033, + secondtonechinese: 0x02CA, + section: 0x00A7, + seenarabic: 0x0633, + seenfinalarabic: 0xFEB2, + seeninitialarabic: 0xFEB3, + seenmedialarabic: 0xFEB4, + segol: 0x05B6, + segol13: 0x05B6, + segol1f: 0x05B6, + segol2c: 0x05B6, + segolhebrew: 0x05B6, + segolnarrowhebrew: 0x05B6, + segolquarterhebrew: 0x05B6, + segoltahebrew: 0x0592, + segolwidehebrew: 0x05B6, + seharmenian: 0x057D, + sehiragana: 0x305B, + sekatakana: 0x30BB, + sekatakanahalfwidth: 0xFF7E, + semicolon: 0x003B, + semicolonarabic: 0x061B, + semicolonmonospace: 0xFF1B, + semicolonsmall: 0xFE54, + semivoicedmarkkana: 0x309C, + semivoicedmarkkanahalfwidth: 0xFF9F, + sentisquare: 0x3322, + sentosquare: 0x3323, + seven: 0x0037, + sevenarabic: 0x0667, + sevenbengali: 0x09ED, + sevencircle: 0x2466, + sevencircleinversesansserif: 0x2790, + sevendeva: 0x096D, + seveneighths: 0x215E, + sevengujarati: 0x0AED, + sevengurmukhi: 0x0A6D, + sevenhackarabic: 0x0667, + sevenhangzhou: 0x3027, + sevenideographicparen: 0x3226, + seveninferior: 0x2087, + sevenmonospace: 0xFF17, + sevenoldstyle: 0xF737, + sevenparen: 0x247A, + sevenperiod: 0x248E, + sevenpersian: 0x06F7, + sevenroman: 0x2176, + sevensuperior: 0x2077, + seventeencircle: 0x2470, + seventeenparen: 0x2484, + seventeenperiod: 0x2498, + seventhai: 0x0E57, + sfthyphen: 0x00AD, + shaarmenian: 0x0577, + shabengali: 0x09B6, + shacyrillic: 0x0448, + shaddaarabic: 0x0651, + shaddadammaarabic: 0xFC61, + shaddadammatanarabic: 0xFC5E, + shaddafathaarabic: 0xFC60, + shaddakasraarabic: 0xFC62, + shaddakasratanarabic: 0xFC5F, + shade: 0x2592, + shadedark: 0x2593, + shadelight: 0x2591, + shademedium: 0x2592, + shadeva: 0x0936, + shagujarati: 0x0AB6, + shagurmukhi: 0x0A36, + shalshelethebrew: 0x0593, + shbopomofo: 0x3115, + shchacyrillic: 0x0449, + sheenarabic: 0x0634, + sheenfinalarabic: 0xFEB6, + sheeninitialarabic: 0xFEB7, + sheenmedialarabic: 0xFEB8, + sheicoptic: 0x03E3, + sheqel: 0x20AA, + sheqelhebrew: 0x20AA, + sheva: 0x05B0, + sheva115: 0x05B0, + sheva15: 0x05B0, + sheva22: 0x05B0, + sheva2e: 0x05B0, + shevahebrew: 0x05B0, + shevanarrowhebrew: 0x05B0, + shevaquarterhebrew: 0x05B0, + shevawidehebrew: 0x05B0, + shhacyrillic: 0x04BB, + shimacoptic: 0x03ED, + shin: 0x05E9, + shindagesh: 0xFB49, + shindageshhebrew: 0xFB49, + shindageshshindot: 0xFB2C, + shindageshshindothebrew: 0xFB2C, + shindageshsindot: 0xFB2D, + shindageshsindothebrew: 0xFB2D, + shindothebrew: 0x05C1, + shinhebrew: 0x05E9, + shinshindot: 0xFB2A, + shinshindothebrew: 0xFB2A, + shinsindot: 0xFB2B, + shinsindothebrew: 0xFB2B, + shook: 0x0282, + sigma: 0x03C3, + sigma1: 0x03C2, + sigmafinal: 0x03C2, + sigmalunatesymbolgreek: 0x03F2, + sihiragana: 0x3057, + sikatakana: 0x30B7, + sikatakanahalfwidth: 0xFF7C, + siluqhebrew: 0x05BD, + siluqlefthebrew: 0x05BD, + similar: 0x223C, + sindothebrew: 0x05C2, + siosacirclekorean: 0x3274, + siosaparenkorean: 0x3214, + sioscieuckorean: 0x317E, + sioscirclekorean: 0x3266, + sioskiyeokkorean: 0x317A, + sioskorean: 0x3145, + siosnieunkorean: 0x317B, + siosparenkorean: 0x3206, + siospieupkorean: 0x317D, + siostikeutkorean: 0x317C, + six: 0x0036, + sixarabic: 0x0666, + sixbengali: 0x09EC, + sixcircle: 0x2465, + sixcircleinversesansserif: 0x278F, + sixdeva: 0x096C, + sixgujarati: 0x0AEC, + sixgurmukhi: 0x0A6C, + sixhackarabic: 0x0666, + sixhangzhou: 0x3026, + sixideographicparen: 0x3225, + sixinferior: 0x2086, + sixmonospace: 0xFF16, + sixoldstyle: 0xF736, + sixparen: 0x2479, + sixperiod: 0x248D, + sixpersian: 0x06F6, + sixroman: 0x2175, + sixsuperior: 0x2076, + sixteencircle: 0x246F, + sixteencurrencydenominatorbengali: 0x09F9, + sixteenparen: 0x2483, + sixteenperiod: 0x2497, + sixthai: 0x0E56, + slash: 0x002F, + slashmonospace: 0xFF0F, + slong: 0x017F, + slongdotaccent: 0x1E9B, + smileface: 0x263A, + smonospace: 0xFF53, + sofpasuqhebrew: 0x05C3, + softhyphen: 0x00AD, + softsigncyrillic: 0x044C, + sohiragana: 0x305D, + sokatakana: 0x30BD, + sokatakanahalfwidth: 0xFF7F, + soliduslongoverlaycmb: 0x0338, + solidusshortoverlaycmb: 0x0337, + sorusithai: 0x0E29, + sosalathai: 0x0E28, + sosothai: 0x0E0B, + sosuathai: 0x0E2A, + space: 0x0020, + spacehackarabic: 0x0020, + spade: 0x2660, + spadesuitblack: 0x2660, + spadesuitwhite: 0x2664, + sparen: 0x24AE, + squarebelowcmb: 0x033B, + squarecc: 0x33C4, + squarecm: 0x339D, + squarediagonalcrosshatchfill: 0x25A9, + squarehorizontalfill: 0x25A4, + squarekg: 0x338F, + squarekm: 0x339E, + squarekmcapital: 0x33CE, + squareln: 0x33D1, + squarelog: 0x33D2, + squaremg: 0x338E, + squaremil: 0x33D5, + squaremm: 0x339C, + squaremsquared: 0x33A1, + squareorthogonalcrosshatchfill: 0x25A6, + squareupperlefttolowerrightfill: 0x25A7, + squareupperrighttolowerleftfill: 0x25A8, + squareverticalfill: 0x25A5, + squarewhitewithsmallblack: 0x25A3, + srsquare: 0x33DB, + ssabengali: 0x09B7, + ssadeva: 0x0937, + ssagujarati: 0x0AB7, + ssangcieuckorean: 0x3149, + ssanghieuhkorean: 0x3185, + ssangieungkorean: 0x3180, + ssangkiyeokkorean: 0x3132, + ssangnieunkorean: 0x3165, + ssangpieupkorean: 0x3143, + ssangsioskorean: 0x3146, + ssangtikeutkorean: 0x3138, + ssuperior: 0xF6F2, + sterling: 0x00A3, + sterlingmonospace: 0xFFE1, + strokelongoverlaycmb: 0x0336, + strokeshortoverlaycmb: 0x0335, + subset: 0x2282, + subsetnotequal: 0x228A, + subsetorequal: 0x2286, + succeeds: 0x227B, + suchthat: 0x220B, + suhiragana: 0x3059, + sukatakana: 0x30B9, + sukatakanahalfwidth: 0xFF7D, + sukunarabic: 0x0652, + summation: 0x2211, + sun: 0x263C, + superset: 0x2283, + supersetnotequal: 0x228B, + supersetorequal: 0x2287, + svsquare: 0x33DC, + syouwaerasquare: 0x337C, + t: 0x0074, + tabengali: 0x09A4, + tackdown: 0x22A4, + tackleft: 0x22A3, + tadeva: 0x0924, + tagujarati: 0x0AA4, + tagurmukhi: 0x0A24, + taharabic: 0x0637, + tahfinalarabic: 0xFEC2, + tahinitialarabic: 0xFEC3, + tahiragana: 0x305F, + tahmedialarabic: 0xFEC4, + taisyouerasquare: 0x337D, + takatakana: 0x30BF, + takatakanahalfwidth: 0xFF80, + tatweelarabic: 0x0640, + tau: 0x03C4, + tav: 0x05EA, + tavdages: 0xFB4A, + tavdagesh: 0xFB4A, + tavdageshhebrew: 0xFB4A, + tavhebrew: 0x05EA, + tbar: 0x0167, + tbopomofo: 0x310A, + tcaron: 0x0165, + tccurl: 0x02A8, + tcedilla: 0x0163, + tcheharabic: 0x0686, + tchehfinalarabic: 0xFB7B, + tchehinitialarabic: 0xFB7C, + tchehmedialarabic: 0xFB7D, + tcircle: 0x24E3, + tcircumflexbelow: 0x1E71, + tcommaaccent: 0x0163, + tdieresis: 0x1E97, + tdotaccent: 0x1E6B, + tdotbelow: 0x1E6D, + tecyrillic: 0x0442, + tedescendercyrillic: 0x04AD, + teharabic: 0x062A, + tehfinalarabic: 0xFE96, + tehhahinitialarabic: 0xFCA2, + tehhahisolatedarabic: 0xFC0C, + tehinitialarabic: 0xFE97, + tehiragana: 0x3066, + tehjeeminitialarabic: 0xFCA1, + tehjeemisolatedarabic: 0xFC0B, + tehmarbutaarabic: 0x0629, + tehmarbutafinalarabic: 0xFE94, + tehmedialarabic: 0xFE98, + tehmeeminitialarabic: 0xFCA4, + tehmeemisolatedarabic: 0xFC0E, + tehnoonfinalarabic: 0xFC73, + tekatakana: 0x30C6, + tekatakanahalfwidth: 0xFF83, + telephone: 0x2121, + telephoneblack: 0x260E, + telishagedolahebrew: 0x05A0, + telishaqetanahebrew: 0x05A9, + tencircle: 0x2469, + tenideographicparen: 0x3229, + tenparen: 0x247D, + tenperiod: 0x2491, + tenroman: 0x2179, + tesh: 0x02A7, + tet: 0x05D8, + tetdagesh: 0xFB38, + tetdageshhebrew: 0xFB38, + tethebrew: 0x05D8, + tetsecyrillic: 0x04B5, + tevirhebrew: 0x059B, + tevirlefthebrew: 0x059B, + thabengali: 0x09A5, + thadeva: 0x0925, + thagujarati: 0x0AA5, + thagurmukhi: 0x0A25, + thalarabic: 0x0630, + thalfinalarabic: 0xFEAC, + thanthakhatlowleftthai: 0xF898, + thanthakhatlowrightthai: 0xF897, + thanthakhatthai: 0x0E4C, + thanthakhatupperleftthai: 0xF896, + theharabic: 0x062B, + thehfinalarabic: 0xFE9A, + thehinitialarabic: 0xFE9B, + thehmedialarabic: 0xFE9C, + thereexists: 0x2203, + therefore: 0x2234, + theta: 0x03B8, + theta1: 0x03D1, + thetasymbolgreek: 0x03D1, + thieuthacirclekorean: 0x3279, + thieuthaparenkorean: 0x3219, + thieuthcirclekorean: 0x326B, + thieuthkorean: 0x314C, + thieuthparenkorean: 0x320B, + thirteencircle: 0x246C, + thirteenparen: 0x2480, + thirteenperiod: 0x2494, + thonangmonthothai: 0x0E11, + thook: 0x01AD, + thophuthaothai: 0x0E12, + thorn: 0x00FE, + thothahanthai: 0x0E17, + thothanthai: 0x0E10, + thothongthai: 0x0E18, + thothungthai: 0x0E16, + thousandcyrillic: 0x0482, + thousandsseparatorarabic: 0x066C, + thousandsseparatorpersian: 0x066C, + three: 0x0033, + threearabic: 0x0663, + threebengali: 0x09E9, + threecircle: 0x2462, + threecircleinversesansserif: 0x278C, + threedeva: 0x0969, + threeeighths: 0x215C, + threegujarati: 0x0AE9, + threegurmukhi: 0x0A69, + threehackarabic: 0x0663, + threehangzhou: 0x3023, + threeideographicparen: 0x3222, + threeinferior: 0x2083, + threemonospace: 0xFF13, + threenumeratorbengali: 0x09F6, + threeoldstyle: 0xF733, + threeparen: 0x2476, + threeperiod: 0x248A, + threepersian: 0x06F3, + threequarters: 0x00BE, + threequartersemdash: 0xF6DE, + threeroman: 0x2172, + threesuperior: 0x00B3, + threethai: 0x0E53, + thzsquare: 0x3394, + tihiragana: 0x3061, + tikatakana: 0x30C1, + tikatakanahalfwidth: 0xFF81, + tikeutacirclekorean: 0x3270, + tikeutaparenkorean: 0x3210, + tikeutcirclekorean: 0x3262, + tikeutkorean: 0x3137, + tikeutparenkorean: 0x3202, + tilde: 0x02DC, + tildebelowcmb: 0x0330, + tildecmb: 0x0303, + tildecomb: 0x0303, + tildedoublecmb: 0x0360, + tildeoperator: 0x223C, + tildeoverlaycmb: 0x0334, + tildeverticalcmb: 0x033E, + timescircle: 0x2297, + tipehahebrew: 0x0596, + tipehalefthebrew: 0x0596, + tippigurmukhi: 0x0A70, + titlocyrilliccmb: 0x0483, + tiwnarmenian: 0x057F, + tlinebelow: 0x1E6F, + tmonospace: 0xFF54, + toarmenian: 0x0569, + tohiragana: 0x3068, + tokatakana: 0x30C8, + tokatakanahalfwidth: 0xFF84, + tonebarextrahighmod: 0x02E5, + tonebarextralowmod: 0x02E9, + tonebarhighmod: 0x02E6, + tonebarlowmod: 0x02E8, + tonebarmidmod: 0x02E7, + tonefive: 0x01BD, + tonesix: 0x0185, + tonetwo: 0x01A8, + tonos: 0x0384, + tonsquare: 0x3327, + topatakthai: 0x0E0F, + tortoiseshellbracketleft: 0x3014, + tortoiseshellbracketleftsmall: 0xFE5D, + tortoiseshellbracketleftvertical: 0xFE39, + tortoiseshellbracketright: 0x3015, + tortoiseshellbracketrightsmall: 0xFE5E, + tortoiseshellbracketrightvertical: 0xFE3A, + totaothai: 0x0E15, + tpalatalhook: 0x01AB, + tparen: 0x24AF, + trademark: 0x2122, + trademarksans: 0xF8EA, + trademarkserif: 0xF6DB, + tretroflexhook: 0x0288, + triagdn: 0x25BC, + triaglf: 0x25C4, + triagrt: 0x25BA, + triagup: 0x25B2, + ts: 0x02A6, + tsadi: 0x05E6, + tsadidagesh: 0xFB46, + tsadidageshhebrew: 0xFB46, + tsadihebrew: 0x05E6, + tsecyrillic: 0x0446, + tsere: 0x05B5, + tsere12: 0x05B5, + tsere1e: 0x05B5, + tsere2b: 0x05B5, + tserehebrew: 0x05B5, + tserenarrowhebrew: 0x05B5, + tserequarterhebrew: 0x05B5, + tserewidehebrew: 0x05B5, + tshecyrillic: 0x045B, + tsuperior: 0xF6F3, + ttabengali: 0x099F, + ttadeva: 0x091F, + ttagujarati: 0x0A9F, + ttagurmukhi: 0x0A1F, + tteharabic: 0x0679, + ttehfinalarabic: 0xFB67, + ttehinitialarabic: 0xFB68, + ttehmedialarabic: 0xFB69, + tthabengali: 0x09A0, + tthadeva: 0x0920, + tthagujarati: 0x0AA0, + tthagurmukhi: 0x0A20, + tturned: 0x0287, + tuhiragana: 0x3064, + tukatakana: 0x30C4, + tukatakanahalfwidth: 0xFF82, + tusmallhiragana: 0x3063, + tusmallkatakana: 0x30C3, + tusmallkatakanahalfwidth: 0xFF6F, + twelvecircle: 0x246B, + twelveparen: 0x247F, + twelveperiod: 0x2493, + twelveroman: 0x217B, + twentycircle: 0x2473, + twentyhangzhou: 0x5344, + twentyparen: 0x2487, + twentyperiod: 0x249B, + two: 0x0032, + twoarabic: 0x0662, + twobengali: 0x09E8, + twocircle: 0x2461, + twocircleinversesansserif: 0x278B, + twodeva: 0x0968, + twodotenleader: 0x2025, + twodotleader: 0x2025, + twodotleadervertical: 0xFE30, + twogujarati: 0x0AE8, + twogurmukhi: 0x0A68, + twohackarabic: 0x0662, + twohangzhou: 0x3022, + twoideographicparen: 0x3221, + twoinferior: 0x2082, + twomonospace: 0xFF12, + twonumeratorbengali: 0x09F5, + twooldstyle: 0xF732, + twoparen: 0x2475, + twoperiod: 0x2489, + twopersian: 0x06F2, + tworoman: 0x2171, + twostroke: 0x01BB, + twosuperior: 0x00B2, + twothai: 0x0E52, + twothirds: 0x2154, + u: 0x0075, + uacute: 0x00FA, + ubar: 0x0289, + ubengali: 0x0989, + ubopomofo: 0x3128, + ubreve: 0x016D, + ucaron: 0x01D4, + ucircle: 0x24E4, + ucircumflex: 0x00FB, + ucircumflexbelow: 0x1E77, + ucyrillic: 0x0443, + udattadeva: 0x0951, + udblacute: 0x0171, + udblgrave: 0x0215, + udeva: 0x0909, + udieresis: 0x00FC, + udieresisacute: 0x01D8, + udieresisbelow: 0x1E73, + udieresiscaron: 0x01DA, + udieresiscyrillic: 0x04F1, + udieresisgrave: 0x01DC, + udieresismacron: 0x01D6, + udotbelow: 0x1EE5, + ugrave: 0x00F9, + ugujarati: 0x0A89, + ugurmukhi: 0x0A09, + uhiragana: 0x3046, + uhookabove: 0x1EE7, + uhorn: 0x01B0, + uhornacute: 0x1EE9, + uhorndotbelow: 0x1EF1, + uhorngrave: 0x1EEB, + uhornhookabove: 0x1EED, + uhorntilde: 0x1EEF, + uhungarumlaut: 0x0171, + uhungarumlautcyrillic: 0x04F3, + uinvertedbreve: 0x0217, + ukatakana: 0x30A6, + ukatakanahalfwidth: 0xFF73, + ukcyrillic: 0x0479, + ukorean: 0x315C, + umacron: 0x016B, + umacroncyrillic: 0x04EF, + umacrondieresis: 0x1E7B, + umatragurmukhi: 0x0A41, + umonospace: 0xFF55, + underscore: 0x005F, + underscoredbl: 0x2017, + underscoremonospace: 0xFF3F, + underscorevertical: 0xFE33, + underscorewavy: 0xFE4F, + union: 0x222A, + universal: 0x2200, + uogonek: 0x0173, + uparen: 0x24B0, + upblock: 0x2580, + upperdothebrew: 0x05C4, + upsilon: 0x03C5, + upsilondieresis: 0x03CB, + upsilondieresistonos: 0x03B0, + upsilonlatin: 0x028A, + upsilontonos: 0x03CD, + uptackbelowcmb: 0x031D, + uptackmod: 0x02D4, + uragurmukhi: 0x0A73, + uring: 0x016F, + ushortcyrillic: 0x045E, + usmallhiragana: 0x3045, + usmallkatakana: 0x30A5, + usmallkatakanahalfwidth: 0xFF69, + ustraightcyrillic: 0x04AF, + ustraightstrokecyrillic: 0x04B1, + utilde: 0x0169, + utildeacute: 0x1E79, + utildebelow: 0x1E75, + uubengali: 0x098A, + uudeva: 0x090A, + uugujarati: 0x0A8A, + uugurmukhi: 0x0A0A, + uumatragurmukhi: 0x0A42, + uuvowelsignbengali: 0x09C2, + uuvowelsigndeva: 0x0942, + uuvowelsigngujarati: 0x0AC2, + uvowelsignbengali: 0x09C1, + uvowelsigndeva: 0x0941, + uvowelsigngujarati: 0x0AC1, + v: 0x0076, + vadeva: 0x0935, + vagujarati: 0x0AB5, + vagurmukhi: 0x0A35, + vakatakana: 0x30F7, + vav: 0x05D5, + vavdagesh: 0xFB35, + vavdagesh65: 0xFB35, + vavdageshhebrew: 0xFB35, + vavhebrew: 0x05D5, + vavholam: 0xFB4B, + vavholamhebrew: 0xFB4B, + vavvavhebrew: 0x05F0, + vavyodhebrew: 0x05F1, + vcircle: 0x24E5, + vdotbelow: 0x1E7F, + vecyrillic: 0x0432, + veharabic: 0x06A4, + vehfinalarabic: 0xFB6B, + vehinitialarabic: 0xFB6C, + vehmedialarabic: 0xFB6D, + vekatakana: 0x30F9, + venus: 0x2640, + verticalbar: 0x007C, + verticallineabovecmb: 0x030D, + verticallinebelowcmb: 0x0329, + verticallinelowmod: 0x02CC, + verticallinemod: 0x02C8, + vewarmenian: 0x057E, + vhook: 0x028B, + vikatakana: 0x30F8, + viramabengali: 0x09CD, + viramadeva: 0x094D, + viramagujarati: 0x0ACD, + visargabengali: 0x0983, + visargadeva: 0x0903, + visargagujarati: 0x0A83, + vmonospace: 0xFF56, + voarmenian: 0x0578, + voicediterationhiragana: 0x309E, + voicediterationkatakana: 0x30FE, + voicedmarkkana: 0x309B, + voicedmarkkanahalfwidth: 0xFF9E, + vokatakana: 0x30FA, + vparen: 0x24B1, + vtilde: 0x1E7D, + vturned: 0x028C, + vuhiragana: 0x3094, + vukatakana: 0x30F4, + w: 0x0077, + wacute: 0x1E83, + waekorean: 0x3159, + wahiragana: 0x308F, + wakatakana: 0x30EF, + wakatakanahalfwidth: 0xFF9C, + wakorean: 0x3158, + wasmallhiragana: 0x308E, + wasmallkatakana: 0x30EE, + wattosquare: 0x3357, + wavedash: 0x301C, + wavyunderscorevertical: 0xFE34, + wawarabic: 0x0648, + wawfinalarabic: 0xFEEE, + wawhamzaabovearabic: 0x0624, + wawhamzaabovefinalarabic: 0xFE86, + wbsquare: 0x33DD, + wcircle: 0x24E6, + wcircumflex: 0x0175, + wdieresis: 0x1E85, + wdotaccent: 0x1E87, + wdotbelow: 0x1E89, + wehiragana: 0x3091, + weierstrass: 0x2118, + wekatakana: 0x30F1, + wekorean: 0x315E, + weokorean: 0x315D, + wgrave: 0x1E81, + whitebullet: 0x25E6, + whitecircle: 0x25CB, + whitecircleinverse: 0x25D9, + whitecornerbracketleft: 0x300E, + whitecornerbracketleftvertical: 0xFE43, + whitecornerbracketright: 0x300F, + whitecornerbracketrightvertical: 0xFE44, + whitediamond: 0x25C7, + whitediamondcontainingblacksmalldiamond: 0x25C8, + whitedownpointingsmalltriangle: 0x25BF, + whitedownpointingtriangle: 0x25BD, + whiteleftpointingsmalltriangle: 0x25C3, + whiteleftpointingtriangle: 0x25C1, + whitelenticularbracketleft: 0x3016, + whitelenticularbracketright: 0x3017, + whiterightpointingsmalltriangle: 0x25B9, + whiterightpointingtriangle: 0x25B7, + whitesmallsquare: 0x25AB, + whitesmilingface: 0x263A, + whitesquare: 0x25A1, + whitestar: 0x2606, + whitetelephone: 0x260F, + whitetortoiseshellbracketleft: 0x3018, + whitetortoiseshellbracketright: 0x3019, + whiteuppointingsmalltriangle: 0x25B5, + whiteuppointingtriangle: 0x25B3, + wihiragana: 0x3090, + wikatakana: 0x30F0, + wikorean: 0x315F, + wmonospace: 0xFF57, + wohiragana: 0x3092, + wokatakana: 0x30F2, + wokatakanahalfwidth: 0xFF66, + won: 0x20A9, + wonmonospace: 0xFFE6, + wowaenthai: 0x0E27, + wparen: 0x24B2, + wring: 0x1E98, + wsuperior: 0x02B7, + wturned: 0x028D, + wynn: 0x01BF, + x: 0x0078, + xabovecmb: 0x033D, + xbopomofo: 0x3112, + xcircle: 0x24E7, + xdieresis: 0x1E8D, + xdotaccent: 0x1E8B, + xeharmenian: 0x056D, + xi: 0x03BE, + xmonospace: 0xFF58, + xparen: 0x24B3, + xsuperior: 0x02E3, + y: 0x0079, + yaadosquare: 0x334E, + yabengali: 0x09AF, + yacute: 0x00FD, + yadeva: 0x092F, + yaekorean: 0x3152, + yagujarati: 0x0AAF, + yagurmukhi: 0x0A2F, + yahiragana: 0x3084, + yakatakana: 0x30E4, + yakatakanahalfwidth: 0xFF94, + yakorean: 0x3151, + yamakkanthai: 0x0E4E, + yasmallhiragana: 0x3083, + yasmallkatakana: 0x30E3, + yasmallkatakanahalfwidth: 0xFF6C, + yatcyrillic: 0x0463, + ycircle: 0x24E8, + ycircumflex: 0x0177, + ydieresis: 0x00FF, + ydotaccent: 0x1E8F, + ydotbelow: 0x1EF5, + yeharabic: 0x064A, + yehbarreearabic: 0x06D2, + yehbarreefinalarabic: 0xFBAF, + yehfinalarabic: 0xFEF2, + yehhamzaabovearabic: 0x0626, + yehhamzaabovefinalarabic: 0xFE8A, + yehhamzaaboveinitialarabic: 0xFE8B, + yehhamzaabovemedialarabic: 0xFE8C, + yehinitialarabic: 0xFEF3, + yehmedialarabic: 0xFEF4, + yehmeeminitialarabic: 0xFCDD, + yehmeemisolatedarabic: 0xFC58, + yehnoonfinalarabic: 0xFC94, + yehthreedotsbelowarabic: 0x06D1, + yekorean: 0x3156, + yen: 0x00A5, + yenmonospace: 0xFFE5, + yeokorean: 0x3155, + yeorinhieuhkorean: 0x3186, + yerahbenyomohebrew: 0x05AA, + yerahbenyomolefthebrew: 0x05AA, + yericyrillic: 0x044B, + yerudieresiscyrillic: 0x04F9, + yesieungkorean: 0x3181, + yesieungpansioskorean: 0x3183, + yesieungsioskorean: 0x3182, + yetivhebrew: 0x059A, + ygrave: 0x1EF3, + yhook: 0x01B4, + yhookabove: 0x1EF7, + yiarmenian: 0x0575, + yicyrillic: 0x0457, + yikorean: 0x3162, + yinyang: 0x262F, + yiwnarmenian: 0x0582, + ymonospace: 0xFF59, + yod: 0x05D9, + yoddagesh: 0xFB39, + yoddageshhebrew: 0xFB39, + yodhebrew: 0x05D9, + yodyodhebrew: 0x05F2, + yodyodpatahhebrew: 0xFB1F, + yohiragana: 0x3088, + yoikorean: 0x3189, + yokatakana: 0x30E8, + yokatakanahalfwidth: 0xFF96, + yokorean: 0x315B, + yosmallhiragana: 0x3087, + yosmallkatakana: 0x30E7, + yosmallkatakanahalfwidth: 0xFF6E, + yotgreek: 0x03F3, + yoyaekorean: 0x3188, + yoyakorean: 0x3187, + yoyakthai: 0x0E22, + yoyingthai: 0x0E0D, + yparen: 0x24B4, + ypogegrammeni: 0x037A, + ypogegrammenigreekcmb: 0x0345, + yr: 0x01A6, + yring: 0x1E99, + ysuperior: 0x02B8, + ytilde: 0x1EF9, + yturned: 0x028E, + yuhiragana: 0x3086, + yuikorean: 0x318C, + yukatakana: 0x30E6, + yukatakanahalfwidth: 0xFF95, + yukorean: 0x3160, + yusbigcyrillic: 0x046B, + yusbigiotifiedcyrillic: 0x046D, + yuslittlecyrillic: 0x0467, + yuslittleiotifiedcyrillic: 0x0469, + yusmallhiragana: 0x3085, + yusmallkatakana: 0x30E5, + yusmallkatakanahalfwidth: 0xFF6D, + yuyekorean: 0x318B, + yuyeokorean: 0x318A, + yyabengali: 0x09DF, + yyadeva: 0x095F, + z: 0x007A, + zaarmenian: 0x0566, + zacute: 0x017A, + zadeva: 0x095B, + zagurmukhi: 0x0A5B, + zaharabic: 0x0638, + zahfinalarabic: 0xFEC6, + zahinitialarabic: 0xFEC7, + zahiragana: 0x3056, + zahmedialarabic: 0xFEC8, + zainarabic: 0x0632, + zainfinalarabic: 0xFEB0, + zakatakana: 0x30B6, + zaqefgadolhebrew: 0x0595, + zaqefqatanhebrew: 0x0594, + zarqahebrew: 0x0598, + zayin: 0x05D6, + zayindagesh: 0xFB36, + zayindageshhebrew: 0xFB36, + zayinhebrew: 0x05D6, + zbopomofo: 0x3117, + zcaron: 0x017E, + zcircle: 0x24E9, + zcircumflex: 0x1E91, + zcurl: 0x0291, + zdot: 0x017C, + zdotaccent: 0x017C, + zdotbelow: 0x1E93, + zecyrillic: 0x0437, + zedescendercyrillic: 0x0499, + zedieresiscyrillic: 0x04DF, + zehiragana: 0x305C, + zekatakana: 0x30BC, + zero: 0x0030, + zeroarabic: 0x0660, + zerobengali: 0x09E6, + zerodeva: 0x0966, + zerogujarati: 0x0AE6, + zerogurmukhi: 0x0A66, + zerohackarabic: 0x0660, + zeroinferior: 0x2080, + zeromonospace: 0xFF10, + zerooldstyle: 0xF730, + zeropersian: 0x06F0, + zerosuperior: 0x2070, + zerothai: 0x0E50, + zerowidthjoiner: 0xFEFF, + zerowidthnonjoiner: 0x200C, + zerowidthspace: 0x200B, + zeta: 0x03B6, + zhbopomofo: 0x3113, + zhearmenian: 0x056A, + zhebrevecyrillic: 0x04C2, + zhecyrillic: 0x0436, + zhedescendercyrillic: 0x0497, + zhedieresiscyrillic: 0x04DD, + zihiragana: 0x3058, + zikatakana: 0x30B8, + zinorhebrew: 0x05AE, + zlinebelow: 0x1E95, + zmonospace: 0xFF5A, + zohiragana: 0x305E, + zokatakana: 0x30BE, + zparen: 0x24B5, + zretroflexhook: 0x0290, + zstroke: 0x01B6, + zuhiragana: 0x305A, + zukatakana: 0x30BA, + '.notdef': 0x0000 +}; + +var DingbatsGlyphsUnicode = { + space: 0x0020, + a1: 0x2701, + a2: 0x2702, + a202: 0x2703, + a3: 0x2704, + a4: 0x260E, + a5: 0x2706, + a119: 0x2707, + a118: 0x2708, + a117: 0x2709, + a11: 0x261B, + a12: 0x261E, + a13: 0x270C, + a14: 0x270D, + a15: 0x270E, + a16: 0x270F, + a105: 0x2710, + a17: 0x2711, + a18: 0x2712, + a19: 0x2713, + a20: 0x2714, + a21: 0x2715, + a22: 0x2716, + a23: 0x2717, + a24: 0x2718, + a25: 0x2719, + a26: 0x271A, + a27: 0x271B, + a28: 0x271C, + a6: 0x271D, + a7: 0x271E, + a8: 0x271F, + a9: 0x2720, + a10: 0x2721, + a29: 0x2722, + a30: 0x2723, + a31: 0x2724, + a32: 0x2725, + a33: 0x2726, + a34: 0x2727, + a35: 0x2605, + a36: 0x2729, + a37: 0x272A, + a38: 0x272B, + a39: 0x272C, + a40: 0x272D, + a41: 0x272E, + a42: 0x272F, + a43: 0x2730, + a44: 0x2731, + a45: 0x2732, + a46: 0x2733, + a47: 0x2734, + a48: 0x2735, + a49: 0x2736, + a50: 0x2737, + a51: 0x2738, + a52: 0x2739, + a53: 0x273A, + a54: 0x273B, + a55: 0x273C, + a56: 0x273D, + a57: 0x273E, + a58: 0x273F, + a59: 0x2740, + a60: 0x2741, + a61: 0x2742, + a62: 0x2743, + a63: 0x2744, + a64: 0x2745, + a65: 0x2746, + a66: 0x2747, + a67: 0x2748, + a68: 0x2749, + a69: 0x274A, + a70: 0x274B, + a71: 0x25CF, + a72: 0x274D, + a73: 0x25A0, + a74: 0x274F, + a203: 0x2750, + a75: 0x2751, + a204: 0x2752, + a76: 0x25B2, + a77: 0x25BC, + a78: 0x25C6, + a79: 0x2756, + a81: 0x25D7, + a82: 0x2758, + a83: 0x2759, + a84: 0x275A, + a97: 0x275B, + a98: 0x275C, + a99: 0x275D, + a100: 0x275E, + a101: 0x2761, + a102: 0x2762, + a103: 0x2763, + a104: 0x2764, + a106: 0x2765, + a107: 0x2766, + a108: 0x2767, + a112: 0x2663, + a111: 0x2666, + a110: 0x2665, + a109: 0x2660, + a120: 0x2460, + a121: 0x2461, + a122: 0x2462, + a123: 0x2463, + a124: 0x2464, + a125: 0x2465, + a126: 0x2466, + a127: 0x2467, + a128: 0x2468, + a129: 0x2469, + a130: 0x2776, + a131: 0x2777, + a132: 0x2778, + a133: 0x2779, + a134: 0x277A, + a135: 0x277B, + a136: 0x277C, + a137: 0x277D, + a138: 0x277E, + a139: 0x277F, + a140: 0x2780, + a141: 0x2781, + a142: 0x2782, + a143: 0x2783, + a144: 0x2784, + a145: 0x2785, + a146: 0x2786, + a147: 0x2787, + a148: 0x2788, + a149: 0x2789, + a150: 0x278A, + a151: 0x278B, + a152: 0x278C, + a153: 0x278D, + a154: 0x278E, + a155: 0x278F, + a156: 0x2790, + a157: 0x2791, + a158: 0x2792, + a159: 0x2793, + a160: 0x2794, + a161: 0x2192, + a163: 0x2194, + a164: 0x2195, + a196: 0x2798, + a165: 0x2799, + a192: 0x279A, + a166: 0x279B, + a167: 0x279C, + a168: 0x279D, + a169: 0x279E, + a170: 0x279F, + a171: 0x27A0, + a172: 0x27A1, + a173: 0x27A2, + a162: 0x27A3, + a174: 0x27A4, + a175: 0x27A5, + a176: 0x27A6, + a177: 0x27A7, + a178: 0x27A8, + a179: 0x27A9, + a193: 0x27AA, + a180: 0x27AB, + a199: 0x27AC, + a181: 0x27AD, + a200: 0x27AE, + a182: 0x27AF, + a201: 0x27B1, + a183: 0x27B2, + a184: 0x27B3, + a197: 0x27B4, + a185: 0x27B5, + a194: 0x27B6, + a198: 0x27B7, + a186: 0x27B8, + a195: 0x27B9, + a187: 0x27BA, + a188: 0x27BB, + a189: 0x27BC, + a190: 0x27BD, + a191: 0x27BE, + a89: 0x2768, // 0xF8D7 + a90: 0x2769, // 0xF8D8 + a93: 0x276A, // 0xF8D9 + a94: 0x276B, // 0xF8DA + a91: 0x276C, // 0xF8DB + a92: 0x276D, // 0xF8DC + a205: 0x276E, // 0xF8DD + a85: 0x276F, // 0xF8DE + a206: 0x2770, // 0xF8DF + a86: 0x2771, // 0xF8E0 + a87: 0x2772, // 0xF8E1 + a88: 0x2773, // 0xF8E2 + a95: 0x2774, // 0xF8E3 + a96: 0x2775, // 0xF8E4 + '.notdef': 0x0000 +}; + + +var PDFImage = (function PDFImageClosure() { + /** + * Decode the image in the main thread if it supported. Resovles the promise + * when the image data is ready. + */ + function handleImageData(handler, xref, res, image) { + if (image instanceof JpegStream && image.isNativelyDecodable(xref, res)) { + // For natively supported jpegs send them to the main thread for decoding. + var dict = image.dict; + var colorSpace = dict.get('ColorSpace', 'CS'); + colorSpace = ColorSpace.parse(colorSpace, xref, res); + var numComps = colorSpace.numComps; + var decodePromise = handler.sendWithPromise('JpegDecode', + [image.getIR(), numComps]); + return decodePromise.then(function (message) { + var data = message.data; + return new Stream(data, 0, data.length, image.dict); + }); + } else { + return Promise.resolve(image); + } + } + + /** + * Decode and clamp a value. The formula is different from the spec because we + * don't decode to float range [0,1], we decode it in the [0,max] range. + */ + function decodeAndClamp(value, addend, coefficient, max) { + value = addend + value * coefficient; + // Clamp the value to the range + return (value < 0 ? 0 : (value > max ? max : value)); + } + + function PDFImage(xref, res, image, inline, smask, mask, isMask) { + this.image = image; + var dict = image.dict; + if (dict.has('Filter')) { + var filter = dict.get('Filter').name; + if (filter === 'JPXDecode') { + var jpxImage = new JpxImage(); + jpxImage.parseImageProperties(image.stream); + image.stream.reset(); + image.bitsPerComponent = jpxImage.bitsPerComponent; + image.numComps = jpxImage.componentsCount; + } else if (filter === 'JBIG2Decode') { + image.bitsPerComponent = 1; + image.numComps = 1; + } + } + // TODO cache rendered images? + + this.width = dict.get('Width', 'W'); + this.height = dict.get('Height', 'H'); + + if (this.width < 1 || this.height < 1) { + error('Invalid image width: ' + this.width + ' or height: ' + + this.height); + } + + this.interpolate = dict.get('Interpolate', 'I') || false; + this.imageMask = dict.get('ImageMask', 'IM') || false; + this.matte = dict.get('Matte') || false; + + var bitsPerComponent = image.bitsPerComponent; + if (!bitsPerComponent) { + bitsPerComponent = dict.get('BitsPerComponent', 'BPC'); + if (!bitsPerComponent) { + if (this.imageMask) { + bitsPerComponent = 1; + } else { + error('Bits per component missing in image: ' + this.imageMask); + } + } + } + this.bpc = bitsPerComponent; + + if (!this.imageMask) { + var colorSpace = dict.get('ColorSpace', 'CS'); + if (!colorSpace) { + info('JPX images (which do not require color spaces)'); + switch (image.numComps) { + case 1: + colorSpace = Name.get('DeviceGray'); + break; + case 3: + colorSpace = Name.get('DeviceRGB'); + break; + case 4: + colorSpace = Name.get('DeviceCMYK'); + break; + default: + error('JPX images with ' + this.numComps + + ' color components not supported.'); + } + } + this.colorSpace = ColorSpace.parse(colorSpace, xref, res); + this.numComps = this.colorSpace.numComps; + } + + this.decode = dict.get('Decode', 'D'); + this.needsDecode = false; + if (this.decode && + ((this.colorSpace && !this.colorSpace.isDefaultDecode(this.decode)) || + (isMask && !ColorSpace.isDefaultDecode(this.decode, 1)))) { + this.needsDecode = true; + // Do some preprocessing to avoid more math. + var max = (1 << bitsPerComponent) - 1; + this.decodeCoefficients = []; + this.decodeAddends = []; + for (var i = 0, j = 0; i < this.decode.length; i += 2, ++j) { + var dmin = this.decode[i]; + var dmax = this.decode[i + 1]; + this.decodeCoefficients[j] = dmax - dmin; + this.decodeAddends[j] = max * dmin; + } + } + + if (smask) { + this.smask = new PDFImage(xref, res, smask, false); + } else if (mask) { + if (isStream(mask)) { + this.mask = new PDFImage(xref, res, mask, false, null, null, true); + } else { + // Color key mask (just an array). + this.mask = mask; + } + } + } + /** + * Handles processing of image data and returns the Promise that is resolved + * with a PDFImage when the image is ready to be used. + */ + PDFImage.buildImage = function PDFImage_buildImage(handler, xref, + res, image, inline) { + var imagePromise = handleImageData(handler, xref, res, image); + var smaskPromise; + var maskPromise; + + var smask = image.dict.get('SMask'); + var mask = image.dict.get('Mask'); + + if (smask) { + smaskPromise = handleImageData(handler, xref, res, smask); + maskPromise = Promise.resolve(null); + } else { + smaskPromise = Promise.resolve(null); + if (mask) { + if (isStream(mask)) { + maskPromise = handleImageData(handler, xref, res, mask); + } else if (isArray(mask)) { + maskPromise = Promise.resolve(mask); + } else { + warn('Unsupported mask format.'); + maskPromise = Promise.resolve(null); + } + } else { + maskPromise = Promise.resolve(null); + } + } + return Promise.all([imagePromise, smaskPromise, maskPromise]).then( + function(results) { + var imageData = results[0]; + var smaskData = results[1]; + var maskData = results[2]; + return new PDFImage(xref, res, imageData, inline, smaskData, maskData); + }); + }; + + /** + * Resize an image using the nearest neighbor algorithm. Currently only + * supports one and three component images. + * @param {TypedArray} pixels The original image with one component. + * @param {Number} bpc Number of bits per component. + * @param {Number} components Number of color components, 1 or 3 is supported. + * @param {Number} w1 Original width. + * @param {Number} h1 Original height. + * @param {Number} w2 New width. + * @param {Number} h2 New height. + * @param {TypedArray} dest (Optional) The destination buffer. + * @param {Number} alpha01 (Optional) Size reserved for the alpha channel. + * @return {TypedArray} Resized image data. + */ + PDFImage.resize = function PDFImage_resize(pixels, bpc, components, + w1, h1, w2, h2, dest, alpha01) { + + if (components !== 1 && components !== 3) { + error('Unsupported component count for resizing.'); + } + + var length = w2 * h2 * components; + var temp = dest ? dest : (bpc <= 8 ? new Uint8Array(length) : + (bpc <= 16 ? new Uint16Array(length) : new Uint32Array(length))); + var xRatio = w1 / w2; + var yRatio = h1 / h2; + var i, j, py, newIndex = 0, oldIndex; + var xScaled = new Uint16Array(w2); + var w1Scanline = w1 * components; + if (alpha01 !== 1) { + alpha01 = 0; + } + + for (j = 0; j < w2; j++) { + xScaled[j] = Math.floor(j * xRatio) * components; + } + + if (components === 1) { + for (i = 0; i < h2; i++) { + py = Math.floor(i * yRatio) * w1Scanline; + for (j = 0; j < w2; j++) { + oldIndex = py + xScaled[j]; + temp[newIndex++] = pixels[oldIndex]; + } + } + } else if (components === 3) { + for (i = 0; i < h2; i++) { + py = Math.floor(i * yRatio) * w1Scanline; + for (j = 0; j < w2; j++) { + oldIndex = py + xScaled[j]; + temp[newIndex++] = pixels[oldIndex++]; + temp[newIndex++] = pixels[oldIndex++]; + temp[newIndex++] = pixels[oldIndex++]; + newIndex += alpha01; + } + } + } + return temp; + }; + + PDFImage.createMask = + function PDFImage_createMask(imgArray, width, height, + imageIsFromDecodeStream, inverseDecode) { + + // |imgArray| might not contain full data for every pixel of the mask, so + // we need to distinguish between |computedLength| and |actualLength|. + // In particular, if inverseDecode is true, then the array we return must + // have a length of |computedLength|. + + var computedLength = ((width + 7) >> 3) * height; + var actualLength = imgArray.byteLength; + var haveFullData = computedLength === actualLength; + var data, i; + + if (imageIsFromDecodeStream && (!inverseDecode || haveFullData)) { + // imgArray came from a DecodeStream and its data is in an appropriate + // form, so we can just transfer it. + data = imgArray; + } else if (!inverseDecode) { + data = new Uint8Array(actualLength); + data.set(imgArray); + } else { + data = new Uint8Array(computedLength); + data.set(imgArray); + for (i = actualLength; i < computedLength; i++) { + data[i] = 0xff; + } + } + + // If necessary, invert the original mask data (but not any extra we might + // have added above). It's safe to modify the array -- whether it's the + // original or a copy, we're about to transfer it anyway, so nothing else + // in this thread can be relying on its contents. + if (inverseDecode) { + for (i = 0; i < actualLength; i++) { + data[i] = ~data[i]; + } + } + + return {data: data, width: width, height: height}; + }; + + PDFImage.prototype = { + get drawWidth() { + return Math.max(this.width, + this.smask && this.smask.width || 0, + this.mask && this.mask.width || 0); + }, + + get drawHeight() { + return Math.max(this.height, + this.smask && this.smask.height || 0, + this.mask && this.mask.height || 0); + }, + + decodeBuffer: function PDFImage_decodeBuffer(buffer) { + var bpc = this.bpc; + var numComps = this.numComps; + + var decodeAddends = this.decodeAddends; + var decodeCoefficients = this.decodeCoefficients; + var max = (1 << bpc) - 1; + var i, ii; + + if (bpc === 1) { + // If the buffer needed decode that means it just needs to be inverted. + for (i = 0, ii = buffer.length; i < ii; i++) { + buffer[i] = +!(buffer[i]); + } + return; + } + var index = 0; + for (i = 0, ii = this.width * this.height; i < ii; i++) { + for (var j = 0; j < numComps; j++) { + buffer[index] = decodeAndClamp(buffer[index], decodeAddends[j], + decodeCoefficients[j], max); + index++; + } + } + }, + + getComponents: function PDFImage_getComponents(buffer) { + var bpc = this.bpc; + + // This image doesn't require any extra work. + if (bpc === 8) { + return buffer; + } + + var width = this.width; + var height = this.height; + var numComps = this.numComps; + + var length = width * height * numComps; + var bufferPos = 0; + var output = (bpc <= 8 ? new Uint8Array(length) : + (bpc <= 16 ? new Uint16Array(length) : new Uint32Array(length))); + var rowComps = width * numComps; + + var max = (1 << bpc) - 1; + var i = 0, ii, buf; + + if (bpc === 1) { + // Optimization for reading 1 bpc images. + var mask, loop1End, loop2End; + for (var j = 0; j < height; j++) { + loop1End = i + (rowComps & ~7); + loop2End = i + rowComps; + + // unroll loop for all full bytes + while (i < loop1End) { + buf = buffer[bufferPos++]; + output[i] = (buf >> 7) & 1; + output[i + 1] = (buf >> 6) & 1; + output[i + 2] = (buf >> 5) & 1; + output[i + 3] = (buf >> 4) & 1; + output[i + 4] = (buf >> 3) & 1; + output[i + 5] = (buf >> 2) & 1; + output[i + 6] = (buf >> 1) & 1; + output[i + 7] = buf & 1; + i += 8; + } + + // handle remaing bits + if (i < loop2End) { + buf = buffer[bufferPos++]; + mask = 128; + while (i < loop2End) { + output[i++] = +!!(buf & mask); + mask >>= 1; + } + } + } + } else { + // The general case that handles all other bpc values. + var bits = 0; + buf = 0; + for (i = 0, ii = length; i < ii; ++i) { + if (i % rowComps === 0) { + buf = 0; + bits = 0; + } + + while (bits < bpc) { + buf = (buf << 8) | buffer[bufferPos++]; + bits += 8; + } + + var remainingBits = bits - bpc; + var value = buf >> remainingBits; + output[i] = (value < 0 ? 0 : (value > max ? max : value)); + buf = buf & ((1 << remainingBits) - 1); + bits = remainingBits; + } + } + return output; + }, + + fillOpacity: function PDFImage_fillOpacity(rgbaBuf, width, height, + actualHeight, image) { + var smask = this.smask; + var mask = this.mask; + var alphaBuf, sw, sh, i, ii, j; + + if (smask) { + sw = smask.width; + sh = smask.height; + alphaBuf = new Uint8Array(sw * sh); + smask.fillGrayBuffer(alphaBuf); + if (sw !== width || sh !== height) { + alphaBuf = PDFImage.resize(alphaBuf, smask.bpc, 1, sw, sh, width, + height); + } + } else if (mask) { + if (mask instanceof PDFImage) { + sw = mask.width; + sh = mask.height; + alphaBuf = new Uint8Array(sw * sh); + mask.numComps = 1; + mask.fillGrayBuffer(alphaBuf); + + // Need to invert values in rgbaBuf + for (i = 0, ii = sw * sh; i < ii; ++i) { + alphaBuf[i] = 255 - alphaBuf[i]; + } + + if (sw !== width || sh !== height) { + alphaBuf = PDFImage.resize(alphaBuf, mask.bpc, 1, sw, sh, width, + height); + } + } else if (isArray(mask)) { + // Color key mask: if any of the compontents are outside the range + // then they should be painted. + alphaBuf = new Uint8Array(width * height); + var numComps = this.numComps; + for (i = 0, ii = width * height; i < ii; ++i) { + var opacity = 0; + var imageOffset = i * numComps; + for (j = 0; j < numComps; ++j) { + var color = image[imageOffset + j]; + var maskOffset = j * 2; + if (color < mask[maskOffset] || color > mask[maskOffset + 1]) { + opacity = 255; + break; + } + } + alphaBuf[i] = opacity; + } + } else { + error('Unknown mask format.'); + } + } + + if (alphaBuf) { + for (i = 0, j = 3, ii = width * actualHeight; i < ii; ++i, j += 4) { + rgbaBuf[j] = alphaBuf[i]; + } + } else { + // No mask. + for (i = 0, j = 3, ii = width * actualHeight; i < ii; ++i, j += 4) { + rgbaBuf[j] = 255; + } + } + }, + + undoPreblend: function PDFImage_undoPreblend(buffer, width, height) { + var matte = this.smask && this.smask.matte; + if (!matte) { + return; + } + var matteRgb = this.colorSpace.getRgb(matte, 0); + var matteR = matteRgb[0]; + var matteG = matteRgb[1]; + var matteB = matteRgb[2]; + var length = width * height * 4; + var r, g, b; + for (var i = 0; i < length; i += 4) { + var alpha = buffer[i + 3]; + if (alpha === 0) { + // according formula we have to get Infinity in all components + // making it white (typical paper color) should be okay + buffer[i] = 255; + buffer[i + 1] = 255; + buffer[i + 2] = 255; + continue; + } + var k = 255 / alpha; + r = (buffer[i] - matteR) * k + matteR; + g = (buffer[i + 1] - matteG) * k + matteG; + b = (buffer[i + 2] - matteB) * k + matteB; + buffer[i] = r <= 0 ? 0 : r >= 255 ? 255 : r | 0; + buffer[i + 1] = g <= 0 ? 0 : g >= 255 ? 255 : g | 0; + buffer[i + 2] = b <= 0 ? 0 : b >= 255 ? 255 : b | 0; + } + }, + + createImageData: function PDFImage_createImageData(forceRGBA) { + var drawWidth = this.drawWidth; + var drawHeight = this.drawHeight; + var imgData = { // other fields are filled in below + width: drawWidth, + height: drawHeight + }; + + var numComps = this.numComps; + var originalWidth = this.width; + var originalHeight = this.height; + var bpc = this.bpc; + + // Rows start at byte boundary. + var rowBytes = (originalWidth * numComps * bpc + 7) >> 3; + var imgArray; + + if (!forceRGBA) { + // If it is a 1-bit-per-pixel grayscale (i.e. black-and-white) image + // without any complications, we pass a same-sized copy to the main + // thread rather than expanding by 32x to RGBA form. This saves *lots* + // of memory for many scanned documents. It's also much faster. + // + // Similarly, if it is a 24-bit-per pixel RGB image without any + // complications, we avoid expanding by 1.333x to RGBA form. + var kind; + if (this.colorSpace.name === 'DeviceGray' && bpc === 1) { + kind = ImageKind.GRAYSCALE_1BPP; + } else if (this.colorSpace.name === 'DeviceRGB' && bpc === 8 && + !this.needsDecode) { + kind = ImageKind.RGB_24BPP; + } + if (kind && !this.smask && !this.mask && + drawWidth === originalWidth && drawHeight === originalHeight) { + imgData.kind = kind; + + imgArray = this.getImageBytes(originalHeight * rowBytes); + // If imgArray came from a DecodeStream, we're safe to transfer it + // (and thus neuter it) because it will constitute the entire + // DecodeStream's data. But if it came from a Stream, we need to + // copy it because it'll only be a portion of the Stream's data, and + // the rest will be read later on. + if (this.image instanceof DecodeStream) { + imgData.data = imgArray; + } else { + var newArray = new Uint8Array(imgArray.length); + newArray.set(imgArray); + imgData.data = newArray; + } + if (this.needsDecode) { + // Invert the buffer (which must be grayscale if we reached here). + assert(kind === ImageKind.GRAYSCALE_1BPP); + var buffer = imgData.data; + for (var i = 0, ii = buffer.length; i < ii; i++) { + buffer[i] ^= 0xff; + } + } + return imgData; + } + if (this.image instanceof JpegStream && !this.smask && !this.mask && + (this.colorSpace.name === 'DeviceGray' || + this.colorSpace.name === 'DeviceRGB' || + this.colorSpace.name === 'DeviceCMYK')) { + imgData.kind = ImageKind.RGB_24BPP; + imgData.data = this.getImageBytes(originalHeight * rowBytes, + drawWidth, drawHeight, true); + return imgData; + } + } + + imgArray = this.getImageBytes(originalHeight * rowBytes); + // imgArray can be incomplete (e.g. after CCITT fax encoding). + var actualHeight = 0 | (imgArray.length / rowBytes * + drawHeight / originalHeight); + + var comps = this.getComponents(imgArray); + + // If opacity data is present, use RGBA_32BPP form. Otherwise, use the + // more compact RGB_24BPP form if allowable. + var alpha01, maybeUndoPreblend; + if (!forceRGBA && !this.smask && !this.mask) { + imgData.kind = ImageKind.RGB_24BPP; + imgData.data = new Uint8Array(drawWidth * drawHeight * 3); + alpha01 = 0; + maybeUndoPreblend = false; + } else { + imgData.kind = ImageKind.RGBA_32BPP; + imgData.data = new Uint8Array(drawWidth * drawHeight * 4); + alpha01 = 1; + maybeUndoPreblend = true; + + // Color key masking (opacity) must be performed before decoding. + this.fillOpacity(imgData.data, drawWidth, drawHeight, actualHeight, + comps); + } + + if (this.needsDecode) { + this.decodeBuffer(comps); + } + this.colorSpace.fillRgb(imgData.data, originalWidth, originalHeight, + drawWidth, drawHeight, actualHeight, bpc, comps, + alpha01); + if (maybeUndoPreblend) { + this.undoPreblend(imgData.data, drawWidth, actualHeight); + } + + return imgData; + }, + + fillGrayBuffer: function PDFImage_fillGrayBuffer(buffer) { + var numComps = this.numComps; + if (numComps !== 1) { + error('Reading gray scale from a color image: ' + numComps); + } + + var width = this.width; + var height = this.height; + var bpc = this.bpc; + + // rows start at byte boundary + var rowBytes = (width * numComps * bpc + 7) >> 3; + var imgArray = this.getImageBytes(height * rowBytes); + + var comps = this.getComponents(imgArray); + var i, length; + + if (bpc === 1) { + // inline decoding (= inversion) for 1 bpc images + length = width * height; + if (this.needsDecode) { + // invert and scale to {0, 255} + for (i = 0; i < length; ++i) { + buffer[i] = (comps[i] - 1) & 255; + } + } else { + // scale to {0, 255} + for (i = 0; i < length; ++i) { + buffer[i] = (-comps[i]) & 255; + } + } + return; + } + + if (this.needsDecode) { + this.decodeBuffer(comps); + } + length = width * height; + // we aren't using a colorspace so we need to scale the value + var scale = 255 / ((1 << bpc) - 1); + for (i = 0; i < length; ++i) { + buffer[i] = (scale * comps[i]) | 0; + } + }, + + getImageBytes: function PDFImage_getImageBytes(length, + drawWidth, drawHeight, + forceRGB) { + this.image.reset(); + this.image.drawWidth = drawWidth || this.width; + this.image.drawHeight = drawHeight || this.height; + this.image.forceRGB = !!forceRGB; + return this.image.getBytes(length); + } + }; + return PDFImage; +})(); + + +// The Metrics object contains glyph widths (in glyph space units). +// As per PDF spec, for most fonts (Type 3 being an exception) a glyph +// space unit corresponds to 1/1000th of text space unit. +var Metrics = { + 'Courier': 600, + 'Courier-Bold': 600, + 'Courier-BoldOblique': 600, + 'Courier-Oblique': 600, + 'Helvetica' : { + 'space': 278, + 'exclam': 278, + 'quotedbl': 355, + 'numbersign': 556, + 'dollar': 556, + 'percent': 889, + 'ampersand': 667, + 'quoteright': 222, + 'parenleft': 333, + 'parenright': 333, + 'asterisk': 389, + 'plus': 584, + 'comma': 278, + 'hyphen': 333, + 'period': 278, + 'slash': 278, + 'zero': 556, + 'one': 556, + 'two': 556, + 'three': 556, + 'four': 556, + 'five': 556, + 'six': 556, + 'seven': 556, + 'eight': 556, + 'nine': 556, + 'colon': 278, + 'semicolon': 278, + 'less': 584, + 'equal': 584, + 'greater': 584, + 'question': 556, + 'at': 1015, + 'A': 667, + 'B': 667, + 'C': 722, + 'D': 722, + 'E': 667, + 'F': 611, + 'G': 778, + 'H': 722, + 'I': 278, + 'J': 500, + 'K': 667, + 'L': 556, + 'M': 833, + 'N': 722, + 'O': 778, + 'P': 667, + 'Q': 778, + 'R': 722, + 'S': 667, + 'T': 611, + 'U': 722, + 'V': 667, + 'W': 944, + 'X': 667, + 'Y': 667, + 'Z': 611, + 'bracketleft': 278, + 'backslash': 278, + 'bracketright': 278, + 'asciicircum': 469, + 'underscore': 556, + 'quoteleft': 222, + 'a': 556, + 'b': 556, + 'c': 500, + 'd': 556, + 'e': 556, + 'f': 278, + 'g': 556, + 'h': 556, + 'i': 222, + 'j': 222, + 'k': 500, + 'l': 222, + 'm': 833, + 'n': 556, + 'o': 556, + 'p': 556, + 'q': 556, + 'r': 333, + 's': 500, + 't': 278, + 'u': 556, + 'v': 500, + 'w': 722, + 'x': 500, + 'y': 500, + 'z': 500, + 'braceleft': 334, + 'bar': 260, + 'braceright': 334, + 'asciitilde': 584, + 'exclamdown': 333, + 'cent': 556, + 'sterling': 556, + 'fraction': 167, + 'yen': 556, + 'florin': 556, + 'section': 556, + 'currency': 556, + 'quotesingle': 191, + 'quotedblleft': 333, + 'guillemotleft': 556, + 'guilsinglleft': 333, + 'guilsinglright': 333, + 'fi': 500, + 'fl': 500, + 'endash': 556, + 'dagger': 556, + 'daggerdbl': 556, + 'periodcentered': 278, + 'paragraph': 537, + 'bullet': 350, + 'quotesinglbase': 222, + 'quotedblbase': 333, + 'quotedblright': 333, + 'guillemotright': 556, + 'ellipsis': 1000, + 'perthousand': 1000, + 'questiondown': 611, + 'grave': 333, + 'acute': 333, + 'circumflex': 333, + 'tilde': 333, + 'macron': 333, + 'breve': 333, + 'dotaccent': 333, + 'dieresis': 333, + 'ring': 333, + 'cedilla': 333, + 'hungarumlaut': 333, + 'ogonek': 333, + 'caron': 333, + 'emdash': 1000, + 'AE': 1000, + 'ordfeminine': 370, + 'Lslash': 556, + 'Oslash': 778, + 'OE': 1000, + 'ordmasculine': 365, + 'ae': 889, + 'dotlessi': 278, + 'lslash': 222, + 'oslash': 611, + 'oe': 944, + 'germandbls': 611, + 'Idieresis': 278, + 'eacute': 556, + 'abreve': 556, + 'uhungarumlaut': 556, + 'ecaron': 556, + 'Ydieresis': 667, + 'divide': 584, + 'Yacute': 667, + 'Acircumflex': 667, + 'aacute': 556, + 'Ucircumflex': 722, + 'yacute': 500, + 'scommaaccent': 500, + 'ecircumflex': 556, + 'Uring': 722, + 'Udieresis': 722, + 'aogonek': 556, + 'Uacute': 722, + 'uogonek': 556, + 'Edieresis': 667, + 'Dcroat': 722, + 'commaaccent': 250, + 'copyright': 737, + 'Emacron': 667, + 'ccaron': 500, + 'aring': 556, + 'Ncommaaccent': 722, + 'lacute': 222, + 'agrave': 556, + 'Tcommaaccent': 611, + 'Cacute': 722, + 'atilde': 556, + 'Edotaccent': 667, + 'scaron': 500, + 'scedilla': 500, + 'iacute': 278, + 'lozenge': 471, + 'Rcaron': 722, + 'Gcommaaccent': 778, + 'ucircumflex': 556, + 'acircumflex': 556, + 'Amacron': 667, + 'rcaron': 333, + 'ccedilla': 500, + 'Zdotaccent': 611, + 'Thorn': 667, + 'Omacron': 778, + 'Racute': 722, + 'Sacute': 667, + 'dcaron': 643, + 'Umacron': 722, + 'uring': 556, + 'threesuperior': 333, + 'Ograve': 778, + 'Agrave': 667, + 'Abreve': 667, + 'multiply': 584, + 'uacute': 556, + 'Tcaron': 611, + 'partialdiff': 476, + 'ydieresis': 500, + 'Nacute': 722, + 'icircumflex': 278, + 'Ecircumflex': 667, + 'adieresis': 556, + 'edieresis': 556, + 'cacute': 500, + 'nacute': 556, + 'umacron': 556, + 'Ncaron': 722, + 'Iacute': 278, + 'plusminus': 584, + 'brokenbar': 260, + 'registered': 737, + 'Gbreve': 778, + 'Idotaccent': 278, + 'summation': 600, + 'Egrave': 667, + 'racute': 333, + 'omacron': 556, + 'Zacute': 611, + 'Zcaron': 611, + 'greaterequal': 549, + 'Eth': 722, + 'Ccedilla': 722, + 'lcommaaccent': 222, + 'tcaron': 317, + 'eogonek': 556, + 'Uogonek': 722, + 'Aacute': 667, + 'Adieresis': 667, + 'egrave': 556, + 'zacute': 500, + 'iogonek': 222, + 'Oacute': 778, + 'oacute': 556, + 'amacron': 556, + 'sacute': 500, + 'idieresis': 278, + 'Ocircumflex': 778, + 'Ugrave': 722, + 'Delta': 612, + 'thorn': 556, + 'twosuperior': 333, + 'Odieresis': 778, + 'mu': 556, + 'igrave': 278, + 'ohungarumlaut': 556, + 'Eogonek': 667, + 'dcroat': 556, + 'threequarters': 834, + 'Scedilla': 667, + 'lcaron': 299, + 'Kcommaaccent': 667, + 'Lacute': 556, + 'trademark': 1000, + 'edotaccent': 556, + 'Igrave': 278, + 'Imacron': 278, + 'Lcaron': 556, + 'onehalf': 834, + 'lessequal': 549, + 'ocircumflex': 556, + 'ntilde': 556, + 'Uhungarumlaut': 722, + 'Eacute': 667, + 'emacron': 556, + 'gbreve': 556, + 'onequarter': 834, + 'Scaron': 667, + 'Scommaaccent': 667, + 'Ohungarumlaut': 778, + 'degree': 400, + 'ograve': 556, + 'Ccaron': 722, + 'ugrave': 556, + 'radical': 453, + 'Dcaron': 722, + 'rcommaaccent': 333, + 'Ntilde': 722, + 'otilde': 556, + 'Rcommaaccent': 722, + 'Lcommaaccent': 556, + 'Atilde': 667, + 'Aogonek': 667, + 'Aring': 667, + 'Otilde': 778, + 'zdotaccent': 500, + 'Ecaron': 667, + 'Iogonek': 278, + 'kcommaaccent': 500, + 'minus': 584, + 'Icircumflex': 278, + 'ncaron': 556, + 'tcommaaccent': 278, + 'logicalnot': 584, + 'odieresis': 556, + 'udieresis': 556, + 'notequal': 549, + 'gcommaaccent': 556, + 'eth': 556, + 'zcaron': 500, + 'ncommaaccent': 556, + 'onesuperior': 333, + 'imacron': 278, + 'Euro': 556 + }, + 'Helvetica-Bold': { + 'space': 278, + 'exclam': 333, + 'quotedbl': 474, + 'numbersign': 556, + 'dollar': 556, + 'percent': 889, + 'ampersand': 722, + 'quoteright': 278, + 'parenleft': 333, + 'parenright': 333, + 'asterisk': 389, + 'plus': 584, + 'comma': 278, + 'hyphen': 333, + 'period': 278, + 'slash': 278, + 'zero': 556, + 'one': 556, + 'two': 556, + 'three': 556, + 'four': 556, + 'five': 556, + 'six': 556, + 'seven': 556, + 'eight': 556, + 'nine': 556, + 'colon': 333, + 'semicolon': 333, + 'less': 584, + 'equal': 584, + 'greater': 584, + 'question': 611, + 'at': 975, + 'A': 722, + 'B': 722, + 'C': 722, + 'D': 722, + 'E': 667, + 'F': 611, + 'G': 778, + 'H': 722, + 'I': 278, + 'J': 556, + 'K': 722, + 'L': 611, + 'M': 833, + 'N': 722, + 'O': 778, + 'P': 667, + 'Q': 778, + 'R': 722, + 'S': 667, + 'T': 611, + 'U': 722, + 'V': 667, + 'W': 944, + 'X': 667, + 'Y': 667, + 'Z': 611, + 'bracketleft': 333, + 'backslash': 278, + 'bracketright': 333, + 'asciicircum': 584, + 'underscore': 556, + 'quoteleft': 278, + 'a': 556, + 'b': 611, + 'c': 556, + 'd': 611, + 'e': 556, + 'f': 333, + 'g': 611, + 'h': 611, + 'i': 278, + 'j': 278, + 'k': 556, + 'l': 278, + 'm': 889, + 'n': 611, + 'o': 611, + 'p': 611, + 'q': 611, + 'r': 389, + 's': 556, + 't': 333, + 'u': 611, + 'v': 556, + 'w': 778, + 'x': 556, + 'y': 556, + 'z': 500, + 'braceleft': 389, + 'bar': 280, + 'braceright': 389, + 'asciitilde': 584, + 'exclamdown': 333, + 'cent': 556, + 'sterling': 556, + 'fraction': 167, + 'yen': 556, + 'florin': 556, + 'section': 556, + 'currency': 556, + 'quotesingle': 238, + 'quotedblleft': 500, + 'guillemotleft': 556, + 'guilsinglleft': 333, + 'guilsinglright': 333, + 'fi': 611, + 'fl': 611, + 'endash': 556, + 'dagger': 556, + 'daggerdbl': 556, + 'periodcentered': 278, + 'paragraph': 556, + 'bullet': 350, + 'quotesinglbase': 278, + 'quotedblbase': 500, + 'quotedblright': 500, + 'guillemotright': 556, + 'ellipsis': 1000, + 'perthousand': 1000, + 'questiondown': 611, + 'grave': 333, + 'acute': 333, + 'circumflex': 333, + 'tilde': 333, + 'macron': 333, + 'breve': 333, + 'dotaccent': 333, + 'dieresis': 333, + 'ring': 333, + 'cedilla': 333, + 'hungarumlaut': 333, + 'ogonek': 333, + 'caron': 333, + 'emdash': 1000, + 'AE': 1000, + 'ordfeminine': 370, + 'Lslash': 611, + 'Oslash': 778, + 'OE': 1000, + 'ordmasculine': 365, + 'ae': 889, + 'dotlessi': 278, + 'lslash': 278, + 'oslash': 611, + 'oe': 944, + 'germandbls': 611, + 'Idieresis': 278, + 'eacute': 556, + 'abreve': 556, + 'uhungarumlaut': 611, + 'ecaron': 556, + 'Ydieresis': 667, + 'divide': 584, + 'Yacute': 667, + 'Acircumflex': 722, + 'aacute': 556, + 'Ucircumflex': 722, + 'yacute': 556, + 'scommaaccent': 556, + 'ecircumflex': 556, + 'Uring': 722, + 'Udieresis': 722, + 'aogonek': 556, + 'Uacute': 722, + 'uogonek': 611, + 'Edieresis': 667, + 'Dcroat': 722, + 'commaaccent': 250, + 'copyright': 737, + 'Emacron': 667, + 'ccaron': 556, + 'aring': 556, + 'Ncommaaccent': 722, + 'lacute': 278, + 'agrave': 556, + 'Tcommaaccent': 611, + 'Cacute': 722, + 'atilde': 556, + 'Edotaccent': 667, + 'scaron': 556, + 'scedilla': 556, + 'iacute': 278, + 'lozenge': 494, + 'Rcaron': 722, + 'Gcommaaccent': 778, + 'ucircumflex': 611, + 'acircumflex': 556, + 'Amacron': 722, + 'rcaron': 389, + 'ccedilla': 556, + 'Zdotaccent': 611, + 'Thorn': 667, + 'Omacron': 778, + 'Racute': 722, + 'Sacute': 667, + 'dcaron': 743, + 'Umacron': 722, + 'uring': 611, + 'threesuperior': 333, + 'Ograve': 778, + 'Agrave': 722, + 'Abreve': 722, + 'multiply': 584, + 'uacute': 611, + 'Tcaron': 611, + 'partialdiff': 494, + 'ydieresis': 556, + 'Nacute': 722, + 'icircumflex': 278, + 'Ecircumflex': 667, + 'adieresis': 556, + 'edieresis': 556, + 'cacute': 556, + 'nacute': 611, + 'umacron': 611, + 'Ncaron': 722, + 'Iacute': 278, + 'plusminus': 584, + 'brokenbar': 280, + 'registered': 737, + 'Gbreve': 778, + 'Idotaccent': 278, + 'summation': 600, + 'Egrave': 667, + 'racute': 389, + 'omacron': 611, + 'Zacute': 611, + 'Zcaron': 611, + 'greaterequal': 549, + 'Eth': 722, + 'Ccedilla': 722, + 'lcommaaccent': 278, + 'tcaron': 389, + 'eogonek': 556, + 'Uogonek': 722, + 'Aacute': 722, + 'Adieresis': 722, + 'egrave': 556, + 'zacute': 500, + 'iogonek': 278, + 'Oacute': 778, + 'oacute': 611, + 'amacron': 556, + 'sacute': 556, + 'idieresis': 278, + 'Ocircumflex': 778, + 'Ugrave': 722, + 'Delta': 612, + 'thorn': 611, + 'twosuperior': 333, + 'Odieresis': 778, + 'mu': 611, + 'igrave': 278, + 'ohungarumlaut': 611, + 'Eogonek': 667, + 'dcroat': 611, + 'threequarters': 834, + 'Scedilla': 667, + 'lcaron': 400, + 'Kcommaaccent': 722, + 'Lacute': 611, + 'trademark': 1000, + 'edotaccent': 556, + 'Igrave': 278, + 'Imacron': 278, + 'Lcaron': 611, + 'onehalf': 834, + 'lessequal': 549, + 'ocircumflex': 611, + 'ntilde': 611, + 'Uhungarumlaut': 722, + 'Eacute': 667, + 'emacron': 556, + 'gbreve': 611, + 'onequarter': 834, + 'Scaron': 667, + 'Scommaaccent': 667, + 'Ohungarumlaut': 778, + 'degree': 400, + 'ograve': 611, + 'Ccaron': 722, + 'ugrave': 611, + 'radical': 549, + 'Dcaron': 722, + 'rcommaaccent': 389, + 'Ntilde': 722, + 'otilde': 611, + 'Rcommaaccent': 722, + 'Lcommaaccent': 611, + 'Atilde': 722, + 'Aogonek': 722, + 'Aring': 722, + 'Otilde': 778, + 'zdotaccent': 500, + 'Ecaron': 667, + 'Iogonek': 278, + 'kcommaaccent': 556, + 'minus': 584, + 'Icircumflex': 278, + 'ncaron': 611, + 'tcommaaccent': 333, + 'logicalnot': 584, + 'odieresis': 611, + 'udieresis': 611, + 'notequal': 549, + 'gcommaaccent': 611, + 'eth': 611, + 'zcaron': 500, + 'ncommaaccent': 611, + 'onesuperior': 333, + 'imacron': 278, + 'Euro': 556 + }, + 'Helvetica-BoldOblique': { + 'space': 278, + 'exclam': 333, + 'quotedbl': 474, + 'numbersign': 556, + 'dollar': 556, + 'percent': 889, + 'ampersand': 722, + 'quoteright': 278, + 'parenleft': 333, + 'parenright': 333, + 'asterisk': 389, + 'plus': 584, + 'comma': 278, + 'hyphen': 333, + 'period': 278, + 'slash': 278, + 'zero': 556, + 'one': 556, + 'two': 556, + 'three': 556, + 'four': 556, + 'five': 556, + 'six': 556, + 'seven': 556, + 'eight': 556, + 'nine': 556, + 'colon': 333, + 'semicolon': 333, + 'less': 584, + 'equal': 584, + 'greater': 584, + 'question': 611, + 'at': 975, + 'A': 722, + 'B': 722, + 'C': 722, + 'D': 722, + 'E': 667, + 'F': 611, + 'G': 778, + 'H': 722, + 'I': 278, + 'J': 556, + 'K': 722, + 'L': 611, + 'M': 833, + 'N': 722, + 'O': 778, + 'P': 667, + 'Q': 778, + 'R': 722, + 'S': 667, + 'T': 611, + 'U': 722, + 'V': 667, + 'W': 944, + 'X': 667, + 'Y': 667, + 'Z': 611, + 'bracketleft': 333, + 'backslash': 278, + 'bracketright': 333, + 'asciicircum': 584, + 'underscore': 556, + 'quoteleft': 278, + 'a': 556, + 'b': 611, + 'c': 556, + 'd': 611, + 'e': 556, + 'f': 333, + 'g': 611, + 'h': 611, + 'i': 278, + 'j': 278, + 'k': 556, + 'l': 278, + 'm': 889, + 'n': 611, + 'o': 611, + 'p': 611, + 'q': 611, + 'r': 389, + 's': 556, + 't': 333, + 'u': 611, + 'v': 556, + 'w': 778, + 'x': 556, + 'y': 556, + 'z': 500, + 'braceleft': 389, + 'bar': 280, + 'braceright': 389, + 'asciitilde': 584, + 'exclamdown': 333, + 'cent': 556, + 'sterling': 556, + 'fraction': 167, + 'yen': 556, + 'florin': 556, + 'section': 556, + 'currency': 556, + 'quotesingle': 238, + 'quotedblleft': 500, + 'guillemotleft': 556, + 'guilsinglleft': 333, + 'guilsinglright': 333, + 'fi': 611, + 'fl': 611, + 'endash': 556, + 'dagger': 556, + 'daggerdbl': 556, + 'periodcentered': 278, + 'paragraph': 556, + 'bullet': 350, + 'quotesinglbase': 278, + 'quotedblbase': 500, + 'quotedblright': 500, + 'guillemotright': 556, + 'ellipsis': 1000, + 'perthousand': 1000, + 'questiondown': 611, + 'grave': 333, + 'acute': 333, + 'circumflex': 333, + 'tilde': 333, + 'macron': 333, + 'breve': 333, + 'dotaccent': 333, + 'dieresis': 333, + 'ring': 333, + 'cedilla': 333, + 'hungarumlaut': 333, + 'ogonek': 333, + 'caron': 333, + 'emdash': 1000, + 'AE': 1000, + 'ordfeminine': 370, + 'Lslash': 611, + 'Oslash': 778, + 'OE': 1000, + 'ordmasculine': 365, + 'ae': 889, + 'dotlessi': 278, + 'lslash': 278, + 'oslash': 611, + 'oe': 944, + 'germandbls': 611, + 'Idieresis': 278, + 'eacute': 556, + 'abreve': 556, + 'uhungarumlaut': 611, + 'ecaron': 556, + 'Ydieresis': 667, + 'divide': 584, + 'Yacute': 667, + 'Acircumflex': 722, + 'aacute': 556, + 'Ucircumflex': 722, + 'yacute': 556, + 'scommaaccent': 556, + 'ecircumflex': 556, + 'Uring': 722, + 'Udieresis': 722, + 'aogonek': 556, + 'Uacute': 722, + 'uogonek': 611, + 'Edieresis': 667, + 'Dcroat': 722, + 'commaaccent': 250, + 'copyright': 737, + 'Emacron': 667, + 'ccaron': 556, + 'aring': 556, + 'Ncommaaccent': 722, + 'lacute': 278, + 'agrave': 556, + 'Tcommaaccent': 611, + 'Cacute': 722, + 'atilde': 556, + 'Edotaccent': 667, + 'scaron': 556, + 'scedilla': 556, + 'iacute': 278, + 'lozenge': 494, + 'Rcaron': 722, + 'Gcommaaccent': 778, + 'ucircumflex': 611, + 'acircumflex': 556, + 'Amacron': 722, + 'rcaron': 389, + 'ccedilla': 556, + 'Zdotaccent': 611, + 'Thorn': 667, + 'Omacron': 778, + 'Racute': 722, + 'Sacute': 667, + 'dcaron': 743, + 'Umacron': 722, + 'uring': 611, + 'threesuperior': 333, + 'Ograve': 778, + 'Agrave': 722, + 'Abreve': 722, + 'multiply': 584, + 'uacute': 611, + 'Tcaron': 611, + 'partialdiff': 494, + 'ydieresis': 556, + 'Nacute': 722, + 'icircumflex': 278, + 'Ecircumflex': 667, + 'adieresis': 556, + 'edieresis': 556, + 'cacute': 556, + 'nacute': 611, + 'umacron': 611, + 'Ncaron': 722, + 'Iacute': 278, + 'plusminus': 584, + 'brokenbar': 280, + 'registered': 737, + 'Gbreve': 778, + 'Idotaccent': 278, + 'summation': 600, + 'Egrave': 667, + 'racute': 389, + 'omacron': 611, + 'Zacute': 611, + 'Zcaron': 611, + 'greaterequal': 549, + 'Eth': 722, + 'Ccedilla': 722, + 'lcommaaccent': 278, + 'tcaron': 389, + 'eogonek': 556, + 'Uogonek': 722, + 'Aacute': 722, + 'Adieresis': 722, + 'egrave': 556, + 'zacute': 500, + 'iogonek': 278, + 'Oacute': 778, + 'oacute': 611, + 'amacron': 556, + 'sacute': 556, + 'idieresis': 278, + 'Ocircumflex': 778, + 'Ugrave': 722, + 'Delta': 612, + 'thorn': 611, + 'twosuperior': 333, + 'Odieresis': 778, + 'mu': 611, + 'igrave': 278, + 'ohungarumlaut': 611, + 'Eogonek': 667, + 'dcroat': 611, + 'threequarters': 834, + 'Scedilla': 667, + 'lcaron': 400, + 'Kcommaaccent': 722, + 'Lacute': 611, + 'trademark': 1000, + 'edotaccent': 556, + 'Igrave': 278, + 'Imacron': 278, + 'Lcaron': 611, + 'onehalf': 834, + 'lessequal': 549, + 'ocircumflex': 611, + 'ntilde': 611, + 'Uhungarumlaut': 722, + 'Eacute': 667, + 'emacron': 556, + 'gbreve': 611, + 'onequarter': 834, + 'Scaron': 667, + 'Scommaaccent': 667, + 'Ohungarumlaut': 778, + 'degree': 400, + 'ograve': 611, + 'Ccaron': 722, + 'ugrave': 611, + 'radical': 549, + 'Dcaron': 722, + 'rcommaaccent': 389, + 'Ntilde': 722, + 'otilde': 611, + 'Rcommaaccent': 722, + 'Lcommaaccent': 611, + 'Atilde': 722, + 'Aogonek': 722, + 'Aring': 722, + 'Otilde': 778, + 'zdotaccent': 500, + 'Ecaron': 667, + 'Iogonek': 278, + 'kcommaaccent': 556, + 'minus': 584, + 'Icircumflex': 278, + 'ncaron': 611, + 'tcommaaccent': 333, + 'logicalnot': 584, + 'odieresis': 611, + 'udieresis': 611, + 'notequal': 549, + 'gcommaaccent': 611, + 'eth': 611, + 'zcaron': 500, + 'ncommaaccent': 611, + 'onesuperior': 333, + 'imacron': 278, + 'Euro': 556 + }, + 'Helvetica-Oblique' : { + 'space': 278, + 'exclam': 278, + 'quotedbl': 355, + 'numbersign': 556, + 'dollar': 556, + 'percent': 889, + 'ampersand': 667, + 'quoteright': 222, + 'parenleft': 333, + 'parenright': 333, + 'asterisk': 389, + 'plus': 584, + 'comma': 278, + 'hyphen': 333, + 'period': 278, + 'slash': 278, + 'zero': 556, + 'one': 556, + 'two': 556, + 'three': 556, + 'four': 556, + 'five': 556, + 'six': 556, + 'seven': 556, + 'eight': 556, + 'nine': 556, + 'colon': 278, + 'semicolon': 278, + 'less': 584, + 'equal': 584, + 'greater': 584, + 'question': 556, + 'at': 1015, + 'A': 667, + 'B': 667, + 'C': 722, + 'D': 722, + 'E': 667, + 'F': 611, + 'G': 778, + 'H': 722, + 'I': 278, + 'J': 500, + 'K': 667, + 'L': 556, + 'M': 833, + 'N': 722, + 'O': 778, + 'P': 667, + 'Q': 778, + 'R': 722, + 'S': 667, + 'T': 611, + 'U': 722, + 'V': 667, + 'W': 944, + 'X': 667, + 'Y': 667, + 'Z': 611, + 'bracketleft': 278, + 'backslash': 278, + 'bracketright': 278, + 'asciicircum': 469, + 'underscore': 556, + 'quoteleft': 222, + 'a': 556, + 'b': 556, + 'c': 500, + 'd': 556, + 'e': 556, + 'f': 278, + 'g': 556, + 'h': 556, + 'i': 222, + 'j': 222, + 'k': 500, + 'l': 222, + 'm': 833, + 'n': 556, + 'o': 556, + 'p': 556, + 'q': 556, + 'r': 333, + 's': 500, + 't': 278, + 'u': 556, + 'v': 500, + 'w': 722, + 'x': 500, + 'y': 500, + 'z': 500, + 'braceleft': 334, + 'bar': 260, + 'braceright': 334, + 'asciitilde': 584, + 'exclamdown': 333, + 'cent': 556, + 'sterling': 556, + 'fraction': 167, + 'yen': 556, + 'florin': 556, + 'section': 556, + 'currency': 556, + 'quotesingle': 191, + 'quotedblleft': 333, + 'guillemotleft': 556, + 'guilsinglleft': 333, + 'guilsinglright': 333, + 'fi': 500, + 'fl': 500, + 'endash': 556, + 'dagger': 556, + 'daggerdbl': 556, + 'periodcentered': 278, + 'paragraph': 537, + 'bullet': 350, + 'quotesinglbase': 222, + 'quotedblbase': 333, + 'quotedblright': 333, + 'guillemotright': 556, + 'ellipsis': 1000, + 'perthousand': 1000, + 'questiondown': 611, + 'grave': 333, + 'acute': 333, + 'circumflex': 333, + 'tilde': 333, + 'macron': 333, + 'breve': 333, + 'dotaccent': 333, + 'dieresis': 333, + 'ring': 333, + 'cedilla': 333, + 'hungarumlaut': 333, + 'ogonek': 333, + 'caron': 333, + 'emdash': 1000, + 'AE': 1000, + 'ordfeminine': 370, + 'Lslash': 556, + 'Oslash': 778, + 'OE': 1000, + 'ordmasculine': 365, + 'ae': 889, + 'dotlessi': 278, + 'lslash': 222, + 'oslash': 611, + 'oe': 944, + 'germandbls': 611, + 'Idieresis': 278, + 'eacute': 556, + 'abreve': 556, + 'uhungarumlaut': 556, + 'ecaron': 556, + 'Ydieresis': 667, + 'divide': 584, + 'Yacute': 667, + 'Acircumflex': 667, + 'aacute': 556, + 'Ucircumflex': 722, + 'yacute': 500, + 'scommaaccent': 500, + 'ecircumflex': 556, + 'Uring': 722, + 'Udieresis': 722, + 'aogonek': 556, + 'Uacute': 722, + 'uogonek': 556, + 'Edieresis': 667, + 'Dcroat': 722, + 'commaaccent': 250, + 'copyright': 737, + 'Emacron': 667, + 'ccaron': 500, + 'aring': 556, + 'Ncommaaccent': 722, + 'lacute': 222, + 'agrave': 556, + 'Tcommaaccent': 611, + 'Cacute': 722, + 'atilde': 556, + 'Edotaccent': 667, + 'scaron': 500, + 'scedilla': 500, + 'iacute': 278, + 'lozenge': 471, + 'Rcaron': 722, + 'Gcommaaccent': 778, + 'ucircumflex': 556, + 'acircumflex': 556, + 'Amacron': 667, + 'rcaron': 333, + 'ccedilla': 500, + 'Zdotaccent': 611, + 'Thorn': 667, + 'Omacron': 778, + 'Racute': 722, + 'Sacute': 667, + 'dcaron': 643, + 'Umacron': 722, + 'uring': 556, + 'threesuperior': 333, + 'Ograve': 778, + 'Agrave': 667, + 'Abreve': 667, + 'multiply': 584, + 'uacute': 556, + 'Tcaron': 611, + 'partialdiff': 476, + 'ydieresis': 500, + 'Nacute': 722, + 'icircumflex': 278, + 'Ecircumflex': 667, + 'adieresis': 556, + 'edieresis': 556, + 'cacute': 500, + 'nacute': 556, + 'umacron': 556, + 'Ncaron': 722, + 'Iacute': 278, + 'plusminus': 584, + 'brokenbar': 260, + 'registered': 737, + 'Gbreve': 778, + 'Idotaccent': 278, + 'summation': 600, + 'Egrave': 667, + 'racute': 333, + 'omacron': 556, + 'Zacute': 611, + 'Zcaron': 611, + 'greaterequal': 549, + 'Eth': 722, + 'Ccedilla': 722, + 'lcommaaccent': 222, + 'tcaron': 317, + 'eogonek': 556, + 'Uogonek': 722, + 'Aacute': 667, + 'Adieresis': 667, + 'egrave': 556, + 'zacute': 500, + 'iogonek': 222, + 'Oacute': 778, + 'oacute': 556, + 'amacron': 556, + 'sacute': 500, + 'idieresis': 278, + 'Ocircumflex': 778, + 'Ugrave': 722, + 'Delta': 612, + 'thorn': 556, + 'twosuperior': 333, + 'Odieresis': 778, + 'mu': 556, + 'igrave': 278, + 'ohungarumlaut': 556, + 'Eogonek': 667, + 'dcroat': 556, + 'threequarters': 834, + 'Scedilla': 667, + 'lcaron': 299, + 'Kcommaaccent': 667, + 'Lacute': 556, + 'trademark': 1000, + 'edotaccent': 556, + 'Igrave': 278, + 'Imacron': 278, + 'Lcaron': 556, + 'onehalf': 834, + 'lessequal': 549, + 'ocircumflex': 556, + 'ntilde': 556, + 'Uhungarumlaut': 722, + 'Eacute': 667, + 'emacron': 556, + 'gbreve': 556, + 'onequarter': 834, + 'Scaron': 667, + 'Scommaaccent': 667, + 'Ohungarumlaut': 778, + 'degree': 400, + 'ograve': 556, + 'Ccaron': 722, + 'ugrave': 556, + 'radical': 453, + 'Dcaron': 722, + 'rcommaaccent': 333, + 'Ntilde': 722, + 'otilde': 556, + 'Rcommaaccent': 722, + 'Lcommaaccent': 556, + 'Atilde': 667, + 'Aogonek': 667, + 'Aring': 667, + 'Otilde': 778, + 'zdotaccent': 500, + 'Ecaron': 667, + 'Iogonek': 278, + 'kcommaaccent': 500, + 'minus': 584, + 'Icircumflex': 278, + 'ncaron': 556, + 'tcommaaccent': 278, + 'logicalnot': 584, + 'odieresis': 556, + 'udieresis': 556, + 'notequal': 549, + 'gcommaaccent': 556, + 'eth': 556, + 'zcaron': 500, + 'ncommaaccent': 556, + 'onesuperior': 333, + 'imacron': 278, + 'Euro': 556 + }, + 'Symbol': { + 'space': 250, + 'exclam': 333, + 'universal': 713, + 'numbersign': 500, + 'existential': 549, + 'percent': 833, + 'ampersand': 778, + 'suchthat': 439, + 'parenleft': 333, + 'parenright': 333, + 'asteriskmath': 500, + 'plus': 549, + 'comma': 250, + 'minus': 549, + 'period': 250, + 'slash': 278, + 'zero': 500, + 'one': 500, + 'two': 500, + 'three': 500, + 'four': 500, + 'five': 500, + 'six': 500, + 'seven': 500, + 'eight': 500, + 'nine': 500, + 'colon': 278, + 'semicolon': 278, + 'less': 549, + 'equal': 549, + 'greater': 549, + 'question': 444, + 'congruent': 549, + 'Alpha': 722, + 'Beta': 667, + 'Chi': 722, + 'Delta': 612, + 'Epsilon': 611, + 'Phi': 763, + 'Gamma': 603, + 'Eta': 722, + 'Iota': 333, + 'theta1': 631, + 'Kappa': 722, + 'Lambda': 686, + 'Mu': 889, + 'Nu': 722, + 'Omicron': 722, + 'Pi': 768, + 'Theta': 741, + 'Rho': 556, + 'Sigma': 592, + 'Tau': 611, + 'Upsilon': 690, + 'sigma1': 439, + 'Omega': 768, + 'Xi': 645, + 'Psi': 795, + 'Zeta': 611, + 'bracketleft': 333, + 'therefore': 863, + 'bracketright': 333, + 'perpendicular': 658, + 'underscore': 500, + 'radicalex': 500, + 'alpha': 631, + 'beta': 549, + 'chi': 549, + 'delta': 494, + 'epsilon': 439, + 'phi': 521, + 'gamma': 411, + 'eta': 603, + 'iota': 329, + 'phi1': 603, + 'kappa': 549, + 'lambda': 549, + 'mu': 576, + 'nu': 521, + 'omicron': 549, + 'pi': 549, + 'theta': 521, + 'rho': 549, + 'sigma': 603, + 'tau': 439, + 'upsilon': 576, + 'omega1': 713, + 'omega': 686, + 'xi': 493, + 'psi': 686, + 'zeta': 494, + 'braceleft': 480, + 'bar': 200, + 'braceright': 480, + 'similar': 549, + 'Euro': 750, + 'Upsilon1': 620, + 'minute': 247, + 'lessequal': 549, + 'fraction': 167, + 'infinity': 713, + 'florin': 500, + 'club': 753, + 'diamond': 753, + 'heart': 753, + 'spade': 753, + 'arrowboth': 1042, + 'arrowleft': 987, + 'arrowup': 603, + 'arrowright': 987, + 'arrowdown': 603, + 'degree': 400, + 'plusminus': 549, + 'second': 411, + 'greaterequal': 549, + 'multiply': 549, + 'proportional': 713, + 'partialdiff': 494, + 'bullet': 460, + 'divide': 549, + 'notequal': 549, + 'equivalence': 549, + 'approxequal': 549, + 'ellipsis': 1000, + 'arrowvertex': 603, + 'arrowhorizex': 1000, + 'carriagereturn': 658, + 'aleph': 823, + 'Ifraktur': 686, + 'Rfraktur': 795, + 'weierstrass': 987, + 'circlemultiply': 768, + 'circleplus': 768, + 'emptyset': 823, + 'intersection': 768, + 'union': 768, + 'propersuperset': 713, + 'reflexsuperset': 713, + 'notsubset': 713, + 'propersubset': 713, + 'reflexsubset': 713, + 'element': 713, + 'notelement': 713, + 'angle': 768, + 'gradient': 713, + 'registerserif': 790, + 'copyrightserif': 790, + 'trademarkserif': 890, + 'product': 823, + 'radical': 549, + 'dotmath': 250, + 'logicalnot': 713, + 'logicaland': 603, + 'logicalor': 603, + 'arrowdblboth': 1042, + 'arrowdblleft': 987, + 'arrowdblup': 603, + 'arrowdblright': 987, + 'arrowdbldown': 603, + 'lozenge': 494, + 'angleleft': 329, + 'registersans': 790, + 'copyrightsans': 790, + 'trademarksans': 786, + 'summation': 713, + 'parenlefttp': 384, + 'parenleftex': 384, + 'parenleftbt': 384, + 'bracketlefttp': 384, + 'bracketleftex': 384, + 'bracketleftbt': 384, + 'bracelefttp': 494, + 'braceleftmid': 494, + 'braceleftbt': 494, + 'braceex': 494, + 'angleright': 329, + 'integral': 274, + 'integraltp': 686, + 'integralex': 686, + 'integralbt': 686, + 'parenrighttp': 384, + 'parenrightex': 384, + 'parenrightbt': 384, + 'bracketrighttp': 384, + 'bracketrightex': 384, + 'bracketrightbt': 384, + 'bracerighttp': 494, + 'bracerightmid': 494, + 'bracerightbt': 494, + 'apple': 790 + }, + 'Times-Roman': { + 'space': 250, + 'exclam': 333, + 'quotedbl': 408, + 'numbersign': 500, + 'dollar': 500, + 'percent': 833, + 'ampersand': 778, + 'quoteright': 333, + 'parenleft': 333, + 'parenright': 333, + 'asterisk': 500, + 'plus': 564, + 'comma': 250, + 'hyphen': 333, + 'period': 250, + 'slash': 278, + 'zero': 500, + 'one': 500, + 'two': 500, + 'three': 500, + 'four': 500, + 'five': 500, + 'six': 500, + 'seven': 500, + 'eight': 500, + 'nine': 500, + 'colon': 278, + 'semicolon': 278, + 'less': 564, + 'equal': 564, + 'greater': 564, + 'question': 444, + 'at': 921, + 'A': 722, + 'B': 667, + 'C': 667, + 'D': 722, + 'E': 611, + 'F': 556, + 'G': 722, + 'H': 722, + 'I': 333, + 'J': 389, + 'K': 722, + 'L': 611, + 'M': 889, + 'N': 722, + 'O': 722, + 'P': 556, + 'Q': 722, + 'R': 667, + 'S': 556, + 'T': 611, + 'U': 722, + 'V': 722, + 'W': 944, + 'X': 722, + 'Y': 722, + 'Z': 611, + 'bracketleft': 333, + 'backslash': 278, + 'bracketright': 333, + 'asciicircum': 469, + 'underscore': 500, + 'quoteleft': 333, + 'a': 444, + 'b': 500, + 'c': 444, + 'd': 500, + 'e': 444, + 'f': 333, + 'g': 500, + 'h': 500, + 'i': 278, + 'j': 278, + 'k': 500, + 'l': 278, + 'm': 778, + 'n': 500, + 'o': 500, + 'p': 500, + 'q': 500, + 'r': 333, + 's': 389, + 't': 278, + 'u': 500, + 'v': 500, + 'w': 722, + 'x': 500, + 'y': 500, + 'z': 444, + 'braceleft': 480, + 'bar': 200, + 'braceright': 480, + 'asciitilde': 541, + 'exclamdown': 333, + 'cent': 500, + 'sterling': 500, + 'fraction': 167, + 'yen': 500, + 'florin': 500, + 'section': 500, + 'currency': 500, + 'quotesingle': 180, + 'quotedblleft': 444, + 'guillemotleft': 500, + 'guilsinglleft': 333, + 'guilsinglright': 333, + 'fi': 556, + 'fl': 556, + 'endash': 500, + 'dagger': 500, + 'daggerdbl': 500, + 'periodcentered': 250, + 'paragraph': 453, + 'bullet': 350, + 'quotesinglbase': 333, + 'quotedblbase': 444, + 'quotedblright': 444, + 'guillemotright': 500, + 'ellipsis': 1000, + 'perthousand': 1000, + 'questiondown': 444, + 'grave': 333, + 'acute': 333, + 'circumflex': 333, + 'tilde': 333, + 'macron': 333, + 'breve': 333, + 'dotaccent': 333, + 'dieresis': 333, + 'ring': 333, + 'cedilla': 333, + 'hungarumlaut': 333, + 'ogonek': 333, + 'caron': 333, + 'emdash': 1000, + 'AE': 889, + 'ordfeminine': 276, + 'Lslash': 611, + 'Oslash': 722, + 'OE': 889, + 'ordmasculine': 310, + 'ae': 667, + 'dotlessi': 278, + 'lslash': 278, + 'oslash': 500, + 'oe': 722, + 'germandbls': 500, + 'Idieresis': 333, + 'eacute': 444, + 'abreve': 444, + 'uhungarumlaut': 500, + 'ecaron': 444, + 'Ydieresis': 722, + 'divide': 564, + 'Yacute': 722, + 'Acircumflex': 722, + 'aacute': 444, + 'Ucircumflex': 722, + 'yacute': 500, + 'scommaaccent': 389, + 'ecircumflex': 444, + 'Uring': 722, + 'Udieresis': 722, + 'aogonek': 444, + 'Uacute': 722, + 'uogonek': 500, + 'Edieresis': 611, + 'Dcroat': 722, + 'commaaccent': 250, + 'copyright': 760, + 'Emacron': 611, + 'ccaron': 444, + 'aring': 444, + 'Ncommaaccent': 722, + 'lacute': 278, + 'agrave': 444, + 'Tcommaaccent': 611, + 'Cacute': 667, + 'atilde': 444, + 'Edotaccent': 611, + 'scaron': 389, + 'scedilla': 389, + 'iacute': 278, + 'lozenge': 471, + 'Rcaron': 667, + 'Gcommaaccent': 722, + 'ucircumflex': 500, + 'acircumflex': 444, + 'Amacron': 722, + 'rcaron': 333, + 'ccedilla': 444, + 'Zdotaccent': 611, + 'Thorn': 556, + 'Omacron': 722, + 'Racute': 667, + 'Sacute': 556, + 'dcaron': 588, + 'Umacron': 722, + 'uring': 500, + 'threesuperior': 300, + 'Ograve': 722, + 'Agrave': 722, + 'Abreve': 722, + 'multiply': 564, + 'uacute': 500, + 'Tcaron': 611, + 'partialdiff': 476, + 'ydieresis': 500, + 'Nacute': 722, + 'icircumflex': 278, + 'Ecircumflex': 611, + 'adieresis': 444, + 'edieresis': 444, + 'cacute': 444, + 'nacute': 500, + 'umacron': 500, + 'Ncaron': 722, + 'Iacute': 333, + 'plusminus': 564, + 'brokenbar': 200, + 'registered': 760, + 'Gbreve': 722, + 'Idotaccent': 333, + 'summation': 600, + 'Egrave': 611, + 'racute': 333, + 'omacron': 500, + 'Zacute': 611, + 'Zcaron': 611, + 'greaterequal': 549, + 'Eth': 722, + 'Ccedilla': 667, + 'lcommaaccent': 278, + 'tcaron': 326, + 'eogonek': 444, + 'Uogonek': 722, + 'Aacute': 722, + 'Adieresis': 722, + 'egrave': 444, + 'zacute': 444, + 'iogonek': 278, + 'Oacute': 722, + 'oacute': 500, + 'amacron': 444, + 'sacute': 389, + 'idieresis': 278, + 'Ocircumflex': 722, + 'Ugrave': 722, + 'Delta': 612, + 'thorn': 500, + 'twosuperior': 300, + 'Odieresis': 722, + 'mu': 500, + 'igrave': 278, + 'ohungarumlaut': 500, + 'Eogonek': 611, + 'dcroat': 500, + 'threequarters': 750, + 'Scedilla': 556, + 'lcaron': 344, + 'Kcommaaccent': 722, + 'Lacute': 611, + 'trademark': 980, + 'edotaccent': 444, + 'Igrave': 333, + 'Imacron': 333, + 'Lcaron': 611, + 'onehalf': 750, + 'lessequal': 549, + 'ocircumflex': 500, + 'ntilde': 500, + 'Uhungarumlaut': 722, + 'Eacute': 611, + 'emacron': 444, + 'gbreve': 500, + 'onequarter': 750, + 'Scaron': 556, + 'Scommaaccent': 556, + 'Ohungarumlaut': 722, + 'degree': 400, + 'ograve': 500, + 'Ccaron': 667, + 'ugrave': 500, + 'radical': 453, + 'Dcaron': 722, + 'rcommaaccent': 333, + 'Ntilde': 722, + 'otilde': 500, + 'Rcommaaccent': 667, + 'Lcommaaccent': 611, + 'Atilde': 722, + 'Aogonek': 722, + 'Aring': 722, + 'Otilde': 722, + 'zdotaccent': 444, + 'Ecaron': 611, + 'Iogonek': 333, + 'kcommaaccent': 500, + 'minus': 564, + 'Icircumflex': 333, + 'ncaron': 500, + 'tcommaaccent': 278, + 'logicalnot': 564, + 'odieresis': 500, + 'udieresis': 500, + 'notequal': 549, + 'gcommaaccent': 500, + 'eth': 500, + 'zcaron': 444, + 'ncommaaccent': 500, + 'onesuperior': 300, + 'imacron': 278, + 'Euro': 500 + }, + 'Times-Bold': { + 'space': 250, + 'exclam': 333, + 'quotedbl': 555, + 'numbersign': 500, + 'dollar': 500, + 'percent': 1000, + 'ampersand': 833, + 'quoteright': 333, + 'parenleft': 333, + 'parenright': 333, + 'asterisk': 500, + 'plus': 570, + 'comma': 250, + 'hyphen': 333, + 'period': 250, + 'slash': 278, + 'zero': 500, + 'one': 500, + 'two': 500, + 'three': 500, + 'four': 500, + 'five': 500, + 'six': 500, + 'seven': 500, + 'eight': 500, + 'nine': 500, + 'colon': 333, + 'semicolon': 333, + 'less': 570, + 'equal': 570, + 'greater': 570, + 'question': 500, + 'at': 930, + 'A': 722, + 'B': 667, + 'C': 722, + 'D': 722, + 'E': 667, + 'F': 611, + 'G': 778, + 'H': 778, + 'I': 389, + 'J': 500, + 'K': 778, + 'L': 667, + 'M': 944, + 'N': 722, + 'O': 778, + 'P': 611, + 'Q': 778, + 'R': 722, + 'S': 556, + 'T': 667, + 'U': 722, + 'V': 722, + 'W': 1000, + 'X': 722, + 'Y': 722, + 'Z': 667, + 'bracketleft': 333, + 'backslash': 278, + 'bracketright': 333, + 'asciicircum': 581, + 'underscore': 500, + 'quoteleft': 333, + 'a': 500, + 'b': 556, + 'c': 444, + 'd': 556, + 'e': 444, + 'f': 333, + 'g': 500, + 'h': 556, + 'i': 278, + 'j': 333, + 'k': 556, + 'l': 278, + 'm': 833, + 'n': 556, + 'o': 500, + 'p': 556, + 'q': 556, + 'r': 444, + 's': 389, + 't': 333, + 'u': 556, + 'v': 500, + 'w': 722, + 'x': 500, + 'y': 500, + 'z': 444, + 'braceleft': 394, + 'bar': 220, + 'braceright': 394, + 'asciitilde': 520, + 'exclamdown': 333, + 'cent': 500, + 'sterling': 500, + 'fraction': 167, + 'yen': 500, + 'florin': 500, + 'section': 500, + 'currency': 500, + 'quotesingle': 278, + 'quotedblleft': 500, + 'guillemotleft': 500, + 'guilsinglleft': 333, + 'guilsinglright': 333, + 'fi': 556, + 'fl': 556, + 'endash': 500, + 'dagger': 500, + 'daggerdbl': 500, + 'periodcentered': 250, + 'paragraph': 540, + 'bullet': 350, + 'quotesinglbase': 333, + 'quotedblbase': 500, + 'quotedblright': 500, + 'guillemotright': 500, + 'ellipsis': 1000, + 'perthousand': 1000, + 'questiondown': 500, + 'grave': 333, + 'acute': 333, + 'circumflex': 333, + 'tilde': 333, + 'macron': 333, + 'breve': 333, + 'dotaccent': 333, + 'dieresis': 333, + 'ring': 333, + 'cedilla': 333, + 'hungarumlaut': 333, + 'ogonek': 333, + 'caron': 333, + 'emdash': 1000, + 'AE': 1000, + 'ordfeminine': 300, + 'Lslash': 667, + 'Oslash': 778, + 'OE': 1000, + 'ordmasculine': 330, + 'ae': 722, + 'dotlessi': 278, + 'lslash': 278, + 'oslash': 500, + 'oe': 722, + 'germandbls': 556, + 'Idieresis': 389, + 'eacute': 444, + 'abreve': 500, + 'uhungarumlaut': 556, + 'ecaron': 444, + 'Ydieresis': 722, + 'divide': 570, + 'Yacute': 722, + 'Acircumflex': 722, + 'aacute': 500, + 'Ucircumflex': 722, + 'yacute': 500, + 'scommaaccent': 389, + 'ecircumflex': 444, + 'Uring': 722, + 'Udieresis': 722, + 'aogonek': 500, + 'Uacute': 722, + 'uogonek': 556, + 'Edieresis': 667, + 'Dcroat': 722, + 'commaaccent': 250, + 'copyright': 747, + 'Emacron': 667, + 'ccaron': 444, + 'aring': 500, + 'Ncommaaccent': 722, + 'lacute': 278, + 'agrave': 500, + 'Tcommaaccent': 667, + 'Cacute': 722, + 'atilde': 500, + 'Edotaccent': 667, + 'scaron': 389, + 'scedilla': 389, + 'iacute': 278, + 'lozenge': 494, + 'Rcaron': 722, + 'Gcommaaccent': 778, + 'ucircumflex': 556, + 'acircumflex': 500, + 'Amacron': 722, + 'rcaron': 444, + 'ccedilla': 444, + 'Zdotaccent': 667, + 'Thorn': 611, + 'Omacron': 778, + 'Racute': 722, + 'Sacute': 556, + 'dcaron': 672, + 'Umacron': 722, + 'uring': 556, + 'threesuperior': 300, + 'Ograve': 778, + 'Agrave': 722, + 'Abreve': 722, + 'multiply': 570, + 'uacute': 556, + 'Tcaron': 667, + 'partialdiff': 494, + 'ydieresis': 500, + 'Nacute': 722, + 'icircumflex': 278, + 'Ecircumflex': 667, + 'adieresis': 500, + 'edieresis': 444, + 'cacute': 444, + 'nacute': 556, + 'umacron': 556, + 'Ncaron': 722, + 'Iacute': 389, + 'plusminus': 570, + 'brokenbar': 220, + 'registered': 747, + 'Gbreve': 778, + 'Idotaccent': 389, + 'summation': 600, + 'Egrave': 667, + 'racute': 444, + 'omacron': 500, + 'Zacute': 667, + 'Zcaron': 667, + 'greaterequal': 549, + 'Eth': 722, + 'Ccedilla': 722, + 'lcommaaccent': 278, + 'tcaron': 416, + 'eogonek': 444, + 'Uogonek': 722, + 'Aacute': 722, + 'Adieresis': 722, + 'egrave': 444, + 'zacute': 444, + 'iogonek': 278, + 'Oacute': 778, + 'oacute': 500, + 'amacron': 500, + 'sacute': 389, + 'idieresis': 278, + 'Ocircumflex': 778, + 'Ugrave': 722, + 'Delta': 612, + 'thorn': 556, + 'twosuperior': 300, + 'Odieresis': 778, + 'mu': 556, + 'igrave': 278, + 'ohungarumlaut': 500, + 'Eogonek': 667, + 'dcroat': 556, + 'threequarters': 750, + 'Scedilla': 556, + 'lcaron': 394, + 'Kcommaaccent': 778, + 'Lacute': 667, + 'trademark': 1000, + 'edotaccent': 444, + 'Igrave': 389, + 'Imacron': 389, + 'Lcaron': 667, + 'onehalf': 750, + 'lessequal': 549, + 'ocircumflex': 500, + 'ntilde': 556, + 'Uhungarumlaut': 722, + 'Eacute': 667, + 'emacron': 444, + 'gbreve': 500, + 'onequarter': 750, + 'Scaron': 556, + 'Scommaaccent': 556, + 'Ohungarumlaut': 778, + 'degree': 400, + 'ograve': 500, + 'Ccaron': 722, + 'ugrave': 556, + 'radical': 549, + 'Dcaron': 722, + 'rcommaaccent': 444, + 'Ntilde': 722, + 'otilde': 500, + 'Rcommaaccent': 722, + 'Lcommaaccent': 667, + 'Atilde': 722, + 'Aogonek': 722, + 'Aring': 722, + 'Otilde': 778, + 'zdotaccent': 444, + 'Ecaron': 667, + 'Iogonek': 389, + 'kcommaaccent': 556, + 'minus': 570, + 'Icircumflex': 389, + 'ncaron': 556, + 'tcommaaccent': 333, + 'logicalnot': 570, + 'odieresis': 500, + 'udieresis': 556, + 'notequal': 549, + 'gcommaaccent': 500, + 'eth': 500, + 'zcaron': 444, + 'ncommaaccent': 556, + 'onesuperior': 300, + 'imacron': 278, + 'Euro': 500 + }, + 'Times-BoldItalic': { + 'space': 250, + 'exclam': 389, + 'quotedbl': 555, + 'numbersign': 500, + 'dollar': 500, + 'percent': 833, + 'ampersand': 778, + 'quoteright': 333, + 'parenleft': 333, + 'parenright': 333, + 'asterisk': 500, + 'plus': 570, + 'comma': 250, + 'hyphen': 333, + 'period': 250, + 'slash': 278, + 'zero': 500, + 'one': 500, + 'two': 500, + 'three': 500, + 'four': 500, + 'five': 500, + 'six': 500, + 'seven': 500, + 'eight': 500, + 'nine': 500, + 'colon': 333, + 'semicolon': 333, + 'less': 570, + 'equal': 570, + 'greater': 570, + 'question': 500, + 'at': 832, + 'A': 667, + 'B': 667, + 'C': 667, + 'D': 722, + 'E': 667, + 'F': 667, + 'G': 722, + 'H': 778, + 'I': 389, + 'J': 500, + 'K': 667, + 'L': 611, + 'M': 889, + 'N': 722, + 'O': 722, + 'P': 611, + 'Q': 722, + 'R': 667, + 'S': 556, + 'T': 611, + 'U': 722, + 'V': 667, + 'W': 889, + 'X': 667, + 'Y': 611, + 'Z': 611, + 'bracketleft': 333, + 'backslash': 278, + 'bracketright': 333, + 'asciicircum': 570, + 'underscore': 500, + 'quoteleft': 333, + 'a': 500, + 'b': 500, + 'c': 444, + 'd': 500, + 'e': 444, + 'f': 333, + 'g': 500, + 'h': 556, + 'i': 278, + 'j': 278, + 'k': 500, + 'l': 278, + 'm': 778, + 'n': 556, + 'o': 500, + 'p': 500, + 'q': 500, + 'r': 389, + 's': 389, + 't': 278, + 'u': 556, + 'v': 444, + 'w': 667, + 'x': 500, + 'y': 444, + 'z': 389, + 'braceleft': 348, + 'bar': 220, + 'braceright': 348, + 'asciitilde': 570, + 'exclamdown': 389, + 'cent': 500, + 'sterling': 500, + 'fraction': 167, + 'yen': 500, + 'florin': 500, + 'section': 500, + 'currency': 500, + 'quotesingle': 278, + 'quotedblleft': 500, + 'guillemotleft': 500, + 'guilsinglleft': 333, + 'guilsinglright': 333, + 'fi': 556, + 'fl': 556, + 'endash': 500, + 'dagger': 500, + 'daggerdbl': 500, + 'periodcentered': 250, + 'paragraph': 500, + 'bullet': 350, + 'quotesinglbase': 333, + 'quotedblbase': 500, + 'quotedblright': 500, + 'guillemotright': 500, + 'ellipsis': 1000, + 'perthousand': 1000, + 'questiondown': 500, + 'grave': 333, + 'acute': 333, + 'circumflex': 333, + 'tilde': 333, + 'macron': 333, + 'breve': 333, + 'dotaccent': 333, + 'dieresis': 333, + 'ring': 333, + 'cedilla': 333, + 'hungarumlaut': 333, + 'ogonek': 333, + 'caron': 333, + 'emdash': 1000, + 'AE': 944, + 'ordfeminine': 266, + 'Lslash': 611, + 'Oslash': 722, + 'OE': 944, + 'ordmasculine': 300, + 'ae': 722, + 'dotlessi': 278, + 'lslash': 278, + 'oslash': 500, + 'oe': 722, + 'germandbls': 500, + 'Idieresis': 389, + 'eacute': 444, + 'abreve': 500, + 'uhungarumlaut': 556, + 'ecaron': 444, + 'Ydieresis': 611, + 'divide': 570, + 'Yacute': 611, + 'Acircumflex': 667, + 'aacute': 500, + 'Ucircumflex': 722, + 'yacute': 444, + 'scommaaccent': 389, + 'ecircumflex': 444, + 'Uring': 722, + 'Udieresis': 722, + 'aogonek': 500, + 'Uacute': 722, + 'uogonek': 556, + 'Edieresis': 667, + 'Dcroat': 722, + 'commaaccent': 250, + 'copyright': 747, + 'Emacron': 667, + 'ccaron': 444, + 'aring': 500, + 'Ncommaaccent': 722, + 'lacute': 278, + 'agrave': 500, + 'Tcommaaccent': 611, + 'Cacute': 667, + 'atilde': 500, + 'Edotaccent': 667, + 'scaron': 389, + 'scedilla': 389, + 'iacute': 278, + 'lozenge': 494, + 'Rcaron': 667, + 'Gcommaaccent': 722, + 'ucircumflex': 556, + 'acircumflex': 500, + 'Amacron': 667, + 'rcaron': 389, + 'ccedilla': 444, + 'Zdotaccent': 611, + 'Thorn': 611, + 'Omacron': 722, + 'Racute': 667, + 'Sacute': 556, + 'dcaron': 608, + 'Umacron': 722, + 'uring': 556, + 'threesuperior': 300, + 'Ograve': 722, + 'Agrave': 667, + 'Abreve': 667, + 'multiply': 570, + 'uacute': 556, + 'Tcaron': 611, + 'partialdiff': 494, + 'ydieresis': 444, + 'Nacute': 722, + 'icircumflex': 278, + 'Ecircumflex': 667, + 'adieresis': 500, + 'edieresis': 444, + 'cacute': 444, + 'nacute': 556, + 'umacron': 556, + 'Ncaron': 722, + 'Iacute': 389, + 'plusminus': 570, + 'brokenbar': 220, + 'registered': 747, + 'Gbreve': 722, + 'Idotaccent': 389, + 'summation': 600, + 'Egrave': 667, + 'racute': 389, + 'omacron': 500, + 'Zacute': 611, + 'Zcaron': 611, + 'greaterequal': 549, + 'Eth': 722, + 'Ccedilla': 667, + 'lcommaaccent': 278, + 'tcaron': 366, + 'eogonek': 444, + 'Uogonek': 722, + 'Aacute': 667, + 'Adieresis': 667, + 'egrave': 444, + 'zacute': 389, + 'iogonek': 278, + 'Oacute': 722, + 'oacute': 500, + 'amacron': 500, + 'sacute': 389, + 'idieresis': 278, + 'Ocircumflex': 722, + 'Ugrave': 722, + 'Delta': 612, + 'thorn': 500, + 'twosuperior': 300, + 'Odieresis': 722, + 'mu': 576, + 'igrave': 278, + 'ohungarumlaut': 500, + 'Eogonek': 667, + 'dcroat': 500, + 'threequarters': 750, + 'Scedilla': 556, + 'lcaron': 382, + 'Kcommaaccent': 667, + 'Lacute': 611, + 'trademark': 1000, + 'edotaccent': 444, + 'Igrave': 389, + 'Imacron': 389, + 'Lcaron': 611, + 'onehalf': 750, + 'lessequal': 549, + 'ocircumflex': 500, + 'ntilde': 556, + 'Uhungarumlaut': 722, + 'Eacute': 667, + 'emacron': 444, + 'gbreve': 500, + 'onequarter': 750, + 'Scaron': 556, + 'Scommaaccent': 556, + 'Ohungarumlaut': 722, + 'degree': 400, + 'ograve': 500, + 'Ccaron': 667, + 'ugrave': 556, + 'radical': 549, + 'Dcaron': 722, + 'rcommaaccent': 389, + 'Ntilde': 722, + 'otilde': 500, + 'Rcommaaccent': 667, + 'Lcommaaccent': 611, + 'Atilde': 667, + 'Aogonek': 667, + 'Aring': 667, + 'Otilde': 722, + 'zdotaccent': 389, + 'Ecaron': 667, + 'Iogonek': 389, + 'kcommaaccent': 500, + 'minus': 606, + 'Icircumflex': 389, + 'ncaron': 556, + 'tcommaaccent': 278, + 'logicalnot': 606, + 'odieresis': 500, + 'udieresis': 556, + 'notequal': 549, + 'gcommaaccent': 500, + 'eth': 500, + 'zcaron': 389, + 'ncommaaccent': 556, + 'onesuperior': 300, + 'imacron': 278, + 'Euro': 500 + }, + 'Times-Italic': { + 'space': 250, + 'exclam': 333, + 'quotedbl': 420, + 'numbersign': 500, + 'dollar': 500, + 'percent': 833, + 'ampersand': 778, + 'quoteright': 333, + 'parenleft': 333, + 'parenright': 333, + 'asterisk': 500, + 'plus': 675, + 'comma': 250, + 'hyphen': 333, + 'period': 250, + 'slash': 278, + 'zero': 500, + 'one': 500, + 'two': 500, + 'three': 500, + 'four': 500, + 'five': 500, + 'six': 500, + 'seven': 500, + 'eight': 500, + 'nine': 500, + 'colon': 333, + 'semicolon': 333, + 'less': 675, + 'equal': 675, + 'greater': 675, + 'question': 500, + 'at': 920, + 'A': 611, + 'B': 611, + 'C': 667, + 'D': 722, + 'E': 611, + 'F': 611, + 'G': 722, + 'H': 722, + 'I': 333, + 'J': 444, + 'K': 667, + 'L': 556, + 'M': 833, + 'N': 667, + 'O': 722, + 'P': 611, + 'Q': 722, + 'R': 611, + 'S': 500, + 'T': 556, + 'U': 722, + 'V': 611, + 'W': 833, + 'X': 611, + 'Y': 556, + 'Z': 556, + 'bracketleft': 389, + 'backslash': 278, + 'bracketright': 389, + 'asciicircum': 422, + 'underscore': 500, + 'quoteleft': 333, + 'a': 500, + 'b': 500, + 'c': 444, + 'd': 500, + 'e': 444, + 'f': 278, + 'g': 500, + 'h': 500, + 'i': 278, + 'j': 278, + 'k': 444, + 'l': 278, + 'm': 722, + 'n': 500, + 'o': 500, + 'p': 500, + 'q': 500, + 'r': 389, + 's': 389, + 't': 278, + 'u': 500, + 'v': 444, + 'w': 667, + 'x': 444, + 'y': 444, + 'z': 389, + 'braceleft': 400, + 'bar': 275, + 'braceright': 400, + 'asciitilde': 541, + 'exclamdown': 389, + 'cent': 500, + 'sterling': 500, + 'fraction': 167, + 'yen': 500, + 'florin': 500, + 'section': 500, + 'currency': 500, + 'quotesingle': 214, + 'quotedblleft': 556, + 'guillemotleft': 500, + 'guilsinglleft': 333, + 'guilsinglright': 333, + 'fi': 500, + 'fl': 500, + 'endash': 500, + 'dagger': 500, + 'daggerdbl': 500, + 'periodcentered': 250, + 'paragraph': 523, + 'bullet': 350, + 'quotesinglbase': 333, + 'quotedblbase': 556, + 'quotedblright': 556, + 'guillemotright': 500, + 'ellipsis': 889, + 'perthousand': 1000, + 'questiondown': 500, + 'grave': 333, + 'acute': 333, + 'circumflex': 333, + 'tilde': 333, + 'macron': 333, + 'breve': 333, + 'dotaccent': 333, + 'dieresis': 333, + 'ring': 333, + 'cedilla': 333, + 'hungarumlaut': 333, + 'ogonek': 333, + 'caron': 333, + 'emdash': 889, + 'AE': 889, + 'ordfeminine': 276, + 'Lslash': 556, + 'Oslash': 722, + 'OE': 944, + 'ordmasculine': 310, + 'ae': 667, + 'dotlessi': 278, + 'lslash': 278, + 'oslash': 500, + 'oe': 667, + 'germandbls': 500, + 'Idieresis': 333, + 'eacute': 444, + 'abreve': 500, + 'uhungarumlaut': 500, + 'ecaron': 444, + 'Ydieresis': 556, + 'divide': 675, + 'Yacute': 556, + 'Acircumflex': 611, + 'aacute': 500, + 'Ucircumflex': 722, + 'yacute': 444, + 'scommaaccent': 389, + 'ecircumflex': 444, + 'Uring': 722, + 'Udieresis': 722, + 'aogonek': 500, + 'Uacute': 722, + 'uogonek': 500, + 'Edieresis': 611, + 'Dcroat': 722, + 'commaaccent': 250, + 'copyright': 760, + 'Emacron': 611, + 'ccaron': 444, + 'aring': 500, + 'Ncommaaccent': 667, + 'lacute': 278, + 'agrave': 500, + 'Tcommaaccent': 556, + 'Cacute': 667, + 'atilde': 500, + 'Edotaccent': 611, + 'scaron': 389, + 'scedilla': 389, + 'iacute': 278, + 'lozenge': 471, + 'Rcaron': 611, + 'Gcommaaccent': 722, + 'ucircumflex': 500, + 'acircumflex': 500, + 'Amacron': 611, + 'rcaron': 389, + 'ccedilla': 444, + 'Zdotaccent': 556, + 'Thorn': 611, + 'Omacron': 722, + 'Racute': 611, + 'Sacute': 500, + 'dcaron': 544, + 'Umacron': 722, + 'uring': 500, + 'threesuperior': 300, + 'Ograve': 722, + 'Agrave': 611, + 'Abreve': 611, + 'multiply': 675, + 'uacute': 500, + 'Tcaron': 556, + 'partialdiff': 476, + 'ydieresis': 444, + 'Nacute': 667, + 'icircumflex': 278, + 'Ecircumflex': 611, + 'adieresis': 500, + 'edieresis': 444, + 'cacute': 444, + 'nacute': 500, + 'umacron': 500, + 'Ncaron': 667, + 'Iacute': 333, + 'plusminus': 675, + 'brokenbar': 275, + 'registered': 760, + 'Gbreve': 722, + 'Idotaccent': 333, + 'summation': 600, + 'Egrave': 611, + 'racute': 389, + 'omacron': 500, + 'Zacute': 556, + 'Zcaron': 556, + 'greaterequal': 549, + 'Eth': 722, + 'Ccedilla': 667, + 'lcommaaccent': 278, + 'tcaron': 300, + 'eogonek': 444, + 'Uogonek': 722, + 'Aacute': 611, + 'Adieresis': 611, + 'egrave': 444, + 'zacute': 389, + 'iogonek': 278, + 'Oacute': 722, + 'oacute': 500, + 'amacron': 500, + 'sacute': 389, + 'idieresis': 278, + 'Ocircumflex': 722, + 'Ugrave': 722, + 'Delta': 612, + 'thorn': 500, + 'twosuperior': 300, + 'Odieresis': 722, + 'mu': 500, + 'igrave': 278, + 'ohungarumlaut': 500, + 'Eogonek': 611, + 'dcroat': 500, + 'threequarters': 750, + 'Scedilla': 500, + 'lcaron': 300, + 'Kcommaaccent': 667, + 'Lacute': 556, + 'trademark': 980, + 'edotaccent': 444, + 'Igrave': 333, + 'Imacron': 333, + 'Lcaron': 611, + 'onehalf': 750, + 'lessequal': 549, + 'ocircumflex': 500, + 'ntilde': 500, + 'Uhungarumlaut': 722, + 'Eacute': 611, + 'emacron': 444, + 'gbreve': 500, + 'onequarter': 750, + 'Scaron': 500, + 'Scommaaccent': 500, + 'Ohungarumlaut': 722, + 'degree': 400, + 'ograve': 500, + 'Ccaron': 667, + 'ugrave': 500, + 'radical': 453, + 'Dcaron': 722, + 'rcommaaccent': 389, + 'Ntilde': 667, + 'otilde': 500, + 'Rcommaaccent': 611, + 'Lcommaaccent': 556, + 'Atilde': 611, + 'Aogonek': 611, + 'Aring': 611, + 'Otilde': 722, + 'zdotaccent': 389, + 'Ecaron': 611, + 'Iogonek': 333, + 'kcommaaccent': 444, + 'minus': 675, + 'Icircumflex': 333, + 'ncaron': 500, + 'tcommaaccent': 278, + 'logicalnot': 675, + 'odieresis': 500, + 'udieresis': 500, + 'notequal': 549, + 'gcommaaccent': 500, + 'eth': 500, + 'zcaron': 389, + 'ncommaaccent': 500, + 'onesuperior': 300, + 'imacron': 278, + 'Euro': 500 + }, + 'ZapfDingbats': { + 'space': 278, + 'a1': 974, + 'a2': 961, + 'a202': 974, + 'a3': 980, + 'a4': 719, + 'a5': 789, + 'a119': 790, + 'a118': 791, + 'a117': 690, + 'a11': 960, + 'a12': 939, + 'a13': 549, + 'a14': 855, + 'a15': 911, + 'a16': 933, + 'a105': 911, + 'a17': 945, + 'a18': 974, + 'a19': 755, + 'a20': 846, + 'a21': 762, + 'a22': 761, + 'a23': 571, + 'a24': 677, + 'a25': 763, + 'a26': 760, + 'a27': 759, + 'a28': 754, + 'a6': 494, + 'a7': 552, + 'a8': 537, + 'a9': 577, + 'a10': 692, + 'a29': 786, + 'a30': 788, + 'a31': 788, + 'a32': 790, + 'a33': 793, + 'a34': 794, + 'a35': 816, + 'a36': 823, + 'a37': 789, + 'a38': 841, + 'a39': 823, + 'a40': 833, + 'a41': 816, + 'a42': 831, + 'a43': 923, + 'a44': 744, + 'a45': 723, + 'a46': 749, + 'a47': 790, + 'a48': 792, + 'a49': 695, + 'a50': 776, + 'a51': 768, + 'a52': 792, + 'a53': 759, + 'a54': 707, + 'a55': 708, + 'a56': 682, + 'a57': 701, + 'a58': 826, + 'a59': 815, + 'a60': 789, + 'a61': 789, + 'a62': 707, + 'a63': 687, + 'a64': 696, + 'a65': 689, + 'a66': 786, + 'a67': 787, + 'a68': 713, + 'a69': 791, + 'a70': 785, + 'a71': 791, + 'a72': 873, + 'a73': 761, + 'a74': 762, + 'a203': 762, + 'a75': 759, + 'a204': 759, + 'a76': 892, + 'a77': 892, + 'a78': 788, + 'a79': 784, + 'a81': 438, + 'a82': 138, + 'a83': 277, + 'a84': 415, + 'a97': 392, + 'a98': 392, + 'a99': 668, + 'a100': 668, + 'a89': 390, + 'a90': 390, + 'a93': 317, + 'a94': 317, + 'a91': 276, + 'a92': 276, + 'a205': 509, + 'a85': 509, + 'a206': 410, + 'a86': 410, + 'a87': 234, + 'a88': 234, + 'a95': 334, + 'a96': 334, + 'a101': 732, + 'a102': 544, + 'a103': 544, + 'a104': 910, + 'a106': 667, + 'a107': 760, + 'a108': 760, + 'a112': 776, + 'a111': 595, + 'a110': 694, + 'a109': 626, + 'a120': 788, + 'a121': 788, + 'a122': 788, + 'a123': 788, + 'a124': 788, + 'a125': 788, + 'a126': 788, + 'a127': 788, + 'a128': 788, + 'a129': 788, + 'a130': 788, + 'a131': 788, + 'a132': 788, + 'a133': 788, + 'a134': 788, + 'a135': 788, + 'a136': 788, + 'a137': 788, + 'a138': 788, + 'a139': 788, + 'a140': 788, + 'a141': 788, + 'a142': 788, + 'a143': 788, + 'a144': 788, + 'a145': 788, + 'a146': 788, + 'a147': 788, + 'a148': 788, + 'a149': 788, + 'a150': 788, + 'a151': 788, + 'a152': 788, + 'a153': 788, + 'a154': 788, + 'a155': 788, + 'a156': 788, + 'a157': 788, + 'a158': 788, + 'a159': 788, + 'a160': 894, + 'a161': 838, + 'a163': 1016, + 'a164': 458, + 'a196': 748, + 'a165': 924, + 'a192': 748, + 'a166': 918, + 'a167': 927, + 'a168': 928, + 'a169': 928, + 'a170': 834, + 'a171': 873, + 'a172': 828, + 'a173': 924, + 'a162': 924, + 'a174': 917, + 'a175': 930, + 'a176': 931, + 'a177': 463, + 'a178': 883, + 'a179': 836, + 'a193': 836, + 'a180': 867, + 'a199': 867, + 'a181': 696, + 'a200': 696, + 'a182': 874, + 'a201': 874, + 'a183': 760, + 'a184': 946, + 'a197': 771, + 'a185': 865, + 'a194': 771, + 'a198': 888, + 'a186': 967, + 'a195': 888, + 'a187': 831, + 'a188': 873, + 'a189': 927, + 'a190': 970, + 'a191': 918 + } +}; + + +var EOF = {}; + +function isEOF(v) { + return (v === EOF); +} + +var MAX_LENGTH_TO_CACHE = 1000; + +var Parser = (function ParserClosure() { + function Parser(lexer, allowStreams, xref) { + this.lexer = lexer; + this.allowStreams = allowStreams; + this.xref = xref; + this.imageCache = {}; + this.refill(); + } + + Parser.prototype = { + refill: function Parser_refill() { + this.buf1 = this.lexer.getObj(); + this.buf2 = this.lexer.getObj(); + }, + shift: function Parser_shift() { + if (isCmd(this.buf2, 'ID')) { + this.buf1 = this.buf2; + this.buf2 = null; + } else { + this.buf1 = this.buf2; + this.buf2 = this.lexer.getObj(); + } + }, + tryShift: function Parser_tryShift() { + try { + this.shift(); + return true; + } catch (e) { + if (e instanceof MissingDataException) { + throw e; + } + // Upon failure, the caller should reset this.lexer.pos to a known good + // state and call this.shift() twice to reset the buffers. + return false; + } + }, + getObj: function Parser_getObj(cipherTransform) { + var buf1 = this.buf1; + this.shift(); + + if (buf1 instanceof Cmd) { + switch (buf1.cmd) { + case 'BI': // inline image + return this.makeInlineImage(cipherTransform); + case '[': // array + var array = []; + while (!isCmd(this.buf1, ']') && !isEOF(this.buf1)) { + array.push(this.getObj(cipherTransform)); + } + if (isEOF(this.buf1)) { + error('End of file inside array'); + } + this.shift(); + return array; + case '<<': // dictionary or stream + var dict = new Dict(this.xref); + while (!isCmd(this.buf1, '>>') && !isEOF(this.buf1)) { + if (!isName(this.buf1)) { + info('Malformed dictionary: key must be a name object'); + this.shift(); + continue; + } + + var key = this.buf1.name; + this.shift(); + if (isEOF(this.buf1)) { + break; + } + dict.set(key, this.getObj(cipherTransform)); + } + if (isEOF(this.buf1)) { + error('End of file inside dictionary'); + } + + // Stream objects are not allowed inside content streams or + // object streams. + if (isCmd(this.buf2, 'stream')) { + return (this.allowStreams ? + this.makeStream(dict, cipherTransform) : dict); + } + this.shift(); + return dict; + default: // simple object + return buf1; + } + } + + if (isInt(buf1)) { // indirect reference or integer + var num = buf1; + if (isInt(this.buf1) && isCmd(this.buf2, 'R')) { + var ref = new Ref(num, this.buf1); + this.shift(); + this.shift(); + return ref; + } + return num; + } + + if (isString(buf1)) { // string + var str = buf1; + if (cipherTransform) { + str = cipherTransform.decryptString(str); + } + return str; + } + + // simple object + return buf1; + }, + /** + * Find the end of the stream by searching for the /EI\s/. + * @returns {number} The inline stream length. + */ + findDefaultInlineStreamEnd: + function Parser_findDefaultInlineStreamEnd(stream) { + var E = 0x45, I = 0x49, SPACE = 0x20, LF = 0xA, CR = 0xD; + var startPos = stream.pos, state = 0, ch, i, n, followingBytes; + while ((ch = stream.getByte()) !== -1) { + if (state === 0) { + state = (ch === E) ? 1 : 0; + } else if (state === 1) { + state = (ch === I) ? 2 : 0; + } else { + assert(state === 2); + if (ch === SPACE || ch === LF || ch === CR) { + // Let's check the next five bytes are ASCII... just be sure. + n = 5; + followingBytes = stream.peekBytes(n); + for (i = 0; i < n; i++) { + ch = followingBytes[i]; + if (ch !== LF && ch !== CR && (ch < SPACE || ch > 0x7F)) { + // Not a LF, CR, SPACE or any visible ASCII character, i.e. + // it's binary stuff. Resetting the state. + state = 0; + break; + } + } + if (state === 2) { + break; // Finished! + } + } else { + state = 0; + } + } + } + return ((stream.pos - 4) - startPos); + }, + /** + * Find the EOI (end-of-image) marker 0xFFD9 of the stream. + * @returns {number} The inline stream length. + */ + findDCTDecodeInlineStreamEnd: + function Parser_findDCTDecodeInlineStreamEnd(stream) { + var startPos = stream.pos, foundEOI = false, b, markerLength, length; + while ((b = stream.getByte()) !== -1) { + if (b !== 0xFF) { // Not a valid marker. + continue; + } + switch (stream.getByte()) { + case 0x00: // Byte stuffing. + // 0xFF00 appears to be a very common byte sequence in JPEG images. + break; + + case 0xFF: // Fill byte. + // Avoid skipping a valid marker, resetting the stream position. + stream.skip(-1); + break; + + case 0xD9: // EOI + foundEOI = true; + break; + + case 0xC0: // SOF0 + case 0xC1: // SOF1 + case 0xC2: // SOF2 + case 0xC3: // SOF3 + + case 0xC5: // SOF5 + case 0xC6: // SOF6 + case 0xC7: // SOF7 + + case 0xC9: // SOF9 + case 0xCA: // SOF10 + case 0xCB: // SOF11 + + case 0xCD: // SOF13 + case 0xCE: // SOF14 + case 0xCF: // SOF15 + + case 0xC4: // DHT + case 0xCC: // DAC + + case 0xDA: // SOS + case 0xDB: // DQT + case 0xDC: // DNL + case 0xDD: // DRI + case 0xDE: // DHP + case 0xDF: // EXP + + case 0xE0: // APP0 + case 0xE1: // APP1 + case 0xE2: // APP2 + case 0xE3: // APP3 + case 0xE4: // APP4 + case 0xE5: // APP5 + case 0xE6: // APP6 + case 0xE7: // APP7 + case 0xE8: // APP8 + case 0xE9: // APP9 + case 0xEA: // APP10 + case 0xEB: // APP11 + case 0xEC: // APP12 + case 0xED: // APP13 + case 0xEE: // APP14 + case 0xEF: // APP15 + + case 0xFE: // COM + // The marker should be followed by the length of the segment. + markerLength = stream.getUint16(); + if (markerLength > 2) { + // |markerLength| contains the byte length of the marker segment, + // including its own length (2 bytes) and excluding the marker. + stream.skip(markerLength - 2); // Jump to the next marker. + } else { + // The marker length is invalid, resetting the stream position. + stream.skip(-2); + } + break; + } + if (foundEOI) { + break; + } + } + length = stream.pos - startPos; + if (b === -1) { + warn('Inline DCTDecode image stream: ' + + 'EOI marker not found, searching for /EI/ instead.'); + stream.skip(-length); // Reset the stream position. + return this.findDefaultInlineStreamEnd(stream); + } + this.inlineStreamSkipEI(stream); + return length; + }, + /** + * Find the EOD (end-of-data) marker '~>' (i.e. TILDE + GT) of the stream. + * @returns {number} The inline stream length. + */ + findASCII85DecodeInlineStreamEnd: + function Parser_findASCII85DecodeInlineStreamEnd(stream) { + var TILDE = 0x7E, GT = 0x3E; + var startPos = stream.pos, ch, length; + while ((ch = stream.getByte()) !== -1) { + if (ch === TILDE && stream.peekByte() === GT) { + stream.skip(); + break; + } + } + length = stream.pos - startPos; + if (ch === -1) { + warn('Inline ASCII85Decode image stream: ' + + 'EOD marker not found, searching for /EI/ instead.'); + stream.skip(-length); // Reset the stream position. + return this.findDefaultInlineStreamEnd(stream); + } + this.inlineStreamSkipEI(stream); + return length; + }, + /** + * Find the EOD (end-of-data) marker '>' (i.e. GT) of the stream. + * @returns {number} The inline stream length. + */ + findASCIIHexDecodeInlineStreamEnd: + function Parser_findASCIIHexDecodeInlineStreamEnd(stream) { + var GT = 0x3E; + var startPos = stream.pos, ch, length; + while ((ch = stream.getByte()) !== -1) { + if (ch === GT) { + break; + } + } + length = stream.pos - startPos; + if (ch === -1) { + warn('Inline ASCIIHexDecode image stream: ' + + 'EOD marker not found, searching for /EI/ instead.'); + stream.skip(-length); // Reset the stream position. + return this.findDefaultInlineStreamEnd(stream); + } + this.inlineStreamSkipEI(stream); + return length; + }, + /** + * Skip over the /EI/ for streams where we search for an EOD marker. + */ + inlineStreamSkipEI: function Parser_inlineStreamSkipEI(stream) { + var E = 0x45, I = 0x49; + var state = 0, ch; + while ((ch = stream.getByte()) !== -1) { + if (state === 0) { + state = (ch === E) ? 1 : 0; + } else if (state === 1) { + state = (ch === I) ? 2 : 0; + } else if (state === 2) { + break; + } + } + }, + makeInlineImage: function Parser_makeInlineImage(cipherTransform) { + var lexer = this.lexer; + var stream = lexer.stream; + + // Parse dictionary. + var dict = new Dict(this.xref); + while (!isCmd(this.buf1, 'ID') && !isEOF(this.buf1)) { + if (!isName(this.buf1)) { + error('Dictionary key must be a name object'); + } + var key = this.buf1.name; + this.shift(); + if (isEOF(this.buf1)) { + break; + } + dict.set(key, this.getObj(cipherTransform)); + } + + // Extract the name of the first (i.e. the current) image filter. + var filter = dict.get('Filter', 'F'), filterName; + if (isName(filter)) { + filterName = filter.name; + } else if (isArray(filter) && isName(filter[0])) { + filterName = filter[0].name; + } + + // Parse image stream. + var startPos = stream.pos, length, i, ii; + if (filterName === 'DCTDecode' || filterName === 'DCT') { + length = this.findDCTDecodeInlineStreamEnd(stream); + } else if (filterName === 'ASCII85Decide' || filterName === 'A85') { + length = this.findASCII85DecodeInlineStreamEnd(stream); + } else if (filterName === 'ASCIIHexDecode' || filterName === 'AHx') { + length = this.findASCIIHexDecodeInlineStreamEnd(stream); + } else { + length = this.findDefaultInlineStreamEnd(stream); + } + var imageStream = stream.makeSubStream(startPos, length, dict); + + // Cache all images below the MAX_LENGTH_TO_CACHE threshold by their + // adler32 checksum. + var adler32; + if (length < MAX_LENGTH_TO_CACHE) { + var imageBytes = imageStream.getBytes(); + imageStream.reset(); + + var a = 1; + var b = 0; + for (i = 0, ii = imageBytes.length; i < ii; ++i) { + // No modulo required in the loop if imageBytes.length < 5552. + a += imageBytes[i] & 0xff; + b += a; + } + adler32 = ((b % 65521) << 16) | (a % 65521); + + if (this.imageCache.adler32 === adler32) { + this.buf2 = Cmd.get('EI'); + this.shift(); + + this.imageCache[adler32].reset(); + return this.imageCache[adler32]; + } + } + + if (cipherTransform) { + imageStream = cipherTransform.createStream(imageStream, length); + } + + imageStream = this.filter(imageStream, dict, length); + imageStream.dict = dict; + if (adler32 !== undefined) { + imageStream.cacheKey = 'inline_' + length + '_' + adler32; + this.imageCache[adler32] = imageStream; + } + + this.buf2 = Cmd.get('EI'); + this.shift(); + + return imageStream; + }, + makeStream: function Parser_makeStream(dict, cipherTransform) { + var lexer = this.lexer; + var stream = lexer.stream; + + // get stream start position + lexer.skipToNextLine(); + var pos = stream.pos - 1; + + // get length + var length = dict.get('Length'); + if (!isInt(length)) { + info('Bad ' + length + ' attribute in stream'); + length = 0; + } + + // skip over the stream data + stream.pos = pos + length; + lexer.nextChar(); + + // Shift '>>' and check whether the new object marks the end of the stream + if (this.tryShift() && isCmd(this.buf2, 'endstream')) { + this.shift(); // 'stream' + } else { + // bad stream length, scanning for endstream + stream.pos = pos; + var SCAN_BLOCK_SIZE = 2048; + var ENDSTREAM_SIGNATURE_LENGTH = 9; + var ENDSTREAM_SIGNATURE = [0x65, 0x6E, 0x64, 0x73, 0x74, 0x72, 0x65, + 0x61, 0x6D]; + var skipped = 0, found = false, i, j; + while (stream.pos < stream.end) { + var scanBytes = stream.peekBytes(SCAN_BLOCK_SIZE); + var scanLength = scanBytes.length - ENDSTREAM_SIGNATURE_LENGTH; + if (scanLength <= 0) { + break; + } + found = false; + for (i = 0, j = 0; i < scanLength; i++) { + var b = scanBytes[i]; + if (b !== ENDSTREAM_SIGNATURE[j]) { + i -= j; + j = 0; + } else { + j++; + if (j >= ENDSTREAM_SIGNATURE_LENGTH) { + i++; + found = true; + break; + } + } + } + if (found) { + skipped += i - ENDSTREAM_SIGNATURE_LENGTH; + stream.pos += i - ENDSTREAM_SIGNATURE_LENGTH; + break; + } + skipped += scanLength; + stream.pos += scanLength; + } + if (!found) { + error('Missing endstream'); + } + length = skipped; + + lexer.nextChar(); + this.shift(); + this.shift(); + } + this.shift(); // 'endstream' + + stream = stream.makeSubStream(pos, length, dict); + if (cipherTransform) { + stream = cipherTransform.createStream(stream, length); + } + stream = this.filter(stream, dict, length); + stream.dict = dict; + return stream; + }, + filter: function Parser_filter(stream, dict, length) { + var filter = dict.get('Filter', 'F'); + var params = dict.get('DecodeParms', 'DP'); + if (isName(filter)) { + return this.makeFilter(stream, filter.name, length, params); + } + + var maybeLength = length; + if (isArray(filter)) { + var filterArray = filter; + var paramsArray = params; + for (var i = 0, ii = filterArray.length; i < ii; ++i) { + filter = filterArray[i]; + if (!isName(filter)) { + error('Bad filter name: ' + filter); + } + + params = null; + if (isArray(paramsArray) && (i in paramsArray)) { + params = paramsArray[i]; + } + stream = this.makeFilter(stream, filter.name, maybeLength, params); + // after the first stream the length variable is invalid + maybeLength = null; + } + } + return stream; + }, + makeFilter: function Parser_makeFilter(stream, name, maybeLength, params) { + if (stream.dict.get('Length') === 0 && !maybeLength) { + warn('Empty "' + name + '" stream.'); + return new NullStream(stream); + } + try { + if (params && this.xref) { + params = this.xref.fetchIfRef(params); + } + var xrefStreamStats = this.xref.stats.streamTypes; + if (name === 'FlateDecode' || name === 'Fl') { + xrefStreamStats[StreamType.FLATE] = true; + if (params) { + return new PredictorStream(new FlateStream(stream, maybeLength), + maybeLength, params); + } + return new FlateStream(stream, maybeLength); + } + if (name === 'LZWDecode' || name === 'LZW') { + xrefStreamStats[StreamType.LZW] = true; + var earlyChange = 1; + if (params) { + if (params.has('EarlyChange')) { + earlyChange = params.get('EarlyChange'); + } + return new PredictorStream( + new LZWStream(stream, maybeLength, earlyChange), + maybeLength, params); + } + return new LZWStream(stream, maybeLength, earlyChange); + } + if (name === 'DCTDecode' || name === 'DCT') { + xrefStreamStats[StreamType.DCT] = true; + return new JpegStream(stream, maybeLength, stream.dict, this.xref); + } + if (name === 'JPXDecode' || name === 'JPX') { + xrefStreamStats[StreamType.JPX] = true; + return new JpxStream(stream, maybeLength, stream.dict); + } + if (name === 'ASCII85Decode' || name === 'A85') { + xrefStreamStats[StreamType.A85] = true; + return new Ascii85Stream(stream, maybeLength); + } + if (name === 'ASCIIHexDecode' || name === 'AHx') { + xrefStreamStats[StreamType.AHX] = true; + return new AsciiHexStream(stream, maybeLength); + } + if (name === 'CCITTFaxDecode' || name === 'CCF') { + xrefStreamStats[StreamType.CCF] = true; + return new CCITTFaxStream(stream, maybeLength, params); + } + if (name === 'RunLengthDecode' || name === 'RL') { + xrefStreamStats[StreamType.RL] = true; + return new RunLengthStream(stream, maybeLength); + } + if (name === 'JBIG2Decode') { + xrefStreamStats[StreamType.JBIG] = true; + return new Jbig2Stream(stream, maybeLength, stream.dict); + } + warn('filter "' + name + '" not supported yet'); + return stream; + } catch (ex) { + if (ex instanceof MissingDataException) { + throw ex; + } + warn('Invalid stream: \"' + ex + '\"'); + return new NullStream(stream); + } + } + }; + + return Parser; +})(); + +var Lexer = (function LexerClosure() { + function Lexer(stream, knownCommands) { + this.stream = stream; + this.nextChar(); + + // While lexing, we build up many strings one char at a time. Using += for + // this can result in lots of garbage strings. It's better to build an + // array of single-char strings and then join() them together at the end. + // And reusing a single array (i.e. |this.strBuf|) over and over for this + // purpose uses less memory than using a new array for each string. + this.strBuf = []; + + // The PDFs might have "glued" commands with other commands, operands or + // literals, e.g. "q1". The knownCommands is a dictionary of the valid + // commands and their prefixes. The prefixes are built the following way: + // if there a command that is a prefix of the other valid command or + // literal (e.g. 'f' and 'false') the following prefixes must be included, + // 'fa', 'fal', 'fals'. The prefixes are not needed, if the command has no + // other commands or literals as a prefix. The knowCommands is optional. + this.knownCommands = knownCommands; + } + + Lexer.isSpace = function Lexer_isSpace(ch) { + // Space is one of the following characters: SPACE, TAB, CR or LF. + return (ch === 0x20 || ch === 0x09 || ch === 0x0D || ch === 0x0A); + }; + + // A '1' in this array means the character is white space. A '1' or + // '2' means the character ends a name or command. + var specialChars = [ + 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, // 0x + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x + 1, 0, 0, 0, 0, 2, 0, 0, 2, 2, 0, 0, 0, 0, 0, 2, // 2x + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 2, 0, // 3x + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 4x + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 2, 0, 0, // 5x + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 6x + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 2, 0, 0, // 7x + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 8x + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 9x + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // ax + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // bx + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // cx + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // dx + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // ex + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 // fx + ]; + + function toHexDigit(ch) { + if (ch >= 0x30 && ch <= 0x39) { // '0'-'9' + return ch & 0x0F; + } + if ((ch >= 0x41 && ch <= 0x46) || (ch >= 0x61 && ch <= 0x66)) { + // 'A'-'F', 'a'-'f' + return (ch & 0x0F) + 9; + } + return -1; + } + + Lexer.prototype = { + nextChar: function Lexer_nextChar() { + return (this.currentChar = this.stream.getByte()); + }, + peekChar: function Lexer_peekChar() { + return this.stream.peekByte(); + }, + getNumber: function Lexer_getNumber() { + var ch = this.currentChar; + var eNotation = false; + var divideBy = 0; // different from 0 if it's a floating point value + var sign = 1; + + if (ch === 0x2D) { // '-' + sign = -1; + ch = this.nextChar(); + + if (ch === 0x2D) { // '-' + // Ignore double negative (this is consistent with Adobe Reader). + ch = this.nextChar(); + } + } else if (ch === 0x2B) { // '+' + ch = this.nextChar(); + } + if (ch === 0x2E) { // '.' + divideBy = 10; + ch = this.nextChar(); + } + if (ch < 0x30 || ch > 0x39) { // '0' - '9' + error('Invalid number: ' + String.fromCharCode(ch)); + return 0; + } + + var baseValue = ch - 0x30; // '0' + var powerValue = 0; + var powerValueSign = 1; + + while ((ch = this.nextChar()) >= 0) { + if (0x30 <= ch && ch <= 0x39) { // '0' - '9' + var currentDigit = ch - 0x30; // '0' + if (eNotation) { // We are after an 'e' or 'E' + powerValue = powerValue * 10 + currentDigit; + } else { + if (divideBy !== 0) { // We are after a point + divideBy *= 10; + } + baseValue = baseValue * 10 + currentDigit; + } + } else if (ch === 0x2E) { // '.' + if (divideBy === 0) { + divideBy = 1; + } else { + // A number can have only one '.' + break; + } + } else if (ch === 0x2D) { // '-' + // ignore minus signs in the middle of numbers to match + // Adobe's behavior + warn('Badly formated number'); + } else if (ch === 0x45 || ch === 0x65) { // 'E', 'e' + // 'E' can be either a scientific notation or the beginning of a new + // operator + ch = this.peekChar(); + if (ch === 0x2B || ch === 0x2D) { // '+', '-' + powerValueSign = (ch === 0x2D) ? -1 : 1; + this.nextChar(); // Consume the sign character + } else if (ch < 0x30 || ch > 0x39) { // '0' - '9' + // The 'E' must be the beginning of a new operator + break; + } + eNotation = true; + } else { + // the last character doesn't belong to us + break; + } + } + + if (divideBy !== 0) { + baseValue /= divideBy; + } + if (eNotation) { + baseValue *= Math.pow(10, powerValueSign * powerValue); + } + return sign * baseValue; + }, + getString: function Lexer_getString() { + var numParen = 1; + var done = false; + var strBuf = this.strBuf; + strBuf.length = 0; + + var ch = this.nextChar(); + while (true) { + var charBuffered = false; + switch (ch | 0) { + case -1: + warn('Unterminated string'); + done = true; + break; + case 0x28: // '(' + ++numParen; + strBuf.push('('); + break; + case 0x29: // ')' + if (--numParen === 0) { + this.nextChar(); // consume strings ')' + done = true; + } else { + strBuf.push(')'); + } + break; + case 0x5C: // '\\' + ch = this.nextChar(); + switch (ch) { + case -1: + warn('Unterminated string'); + done = true; + break; + case 0x6E: // 'n' + strBuf.push('\n'); + break; + case 0x72: // 'r' + strBuf.push('\r'); + break; + case 0x74: // 't' + strBuf.push('\t'); + break; + case 0x62: // 'b' + strBuf.push('\b'); + break; + case 0x66: // 'f' + strBuf.push('\f'); + break; + case 0x5C: // '\' + case 0x28: // '(' + case 0x29: // ')' + strBuf.push(String.fromCharCode(ch)); + break; + case 0x30: case 0x31: case 0x32: case 0x33: // '0'-'3' + case 0x34: case 0x35: case 0x36: case 0x37: // '4'-'7' + var x = ch & 0x0F; + ch = this.nextChar(); + charBuffered = true; + if (ch >= 0x30 && ch <= 0x37) { // '0'-'7' + x = (x << 3) + (ch & 0x0F); + ch = this.nextChar(); + if (ch >= 0x30 && ch <= 0x37) { // '0'-'7' + charBuffered = false; + x = (x << 3) + (ch & 0x0F); + } + } + strBuf.push(String.fromCharCode(x)); + break; + case 0x0D: // CR + if (this.peekChar() === 0x0A) { // LF + this.nextChar(); + } + break; + case 0x0A: // LF + break; + default: + strBuf.push(String.fromCharCode(ch)); + break; + } + break; + default: + strBuf.push(String.fromCharCode(ch)); + break; + } + if (done) { + break; + } + if (!charBuffered) { + ch = this.nextChar(); + } + } + return strBuf.join(''); + }, + getName: function Lexer_getName() { + var ch; + var strBuf = this.strBuf; + strBuf.length = 0; + while ((ch = this.nextChar()) >= 0 && !specialChars[ch]) { + if (ch === 0x23) { // '#' + ch = this.nextChar(); + var x = toHexDigit(ch); + if (x !== -1) { + var x2 = toHexDigit(this.nextChar()); + if (x2 === -1) { + error('Illegal digit in hex char in name: ' + x2); + } + strBuf.push(String.fromCharCode((x << 4) | x2)); + } else { + strBuf.push('#', String.fromCharCode(ch)); + } + } else { + strBuf.push(String.fromCharCode(ch)); + } + } + if (strBuf.length > 127) { + warn('name token is longer than allowed by the spec: ' + strBuf.length); + } + return Name.get(strBuf.join('')); + }, + getHexString: function Lexer_getHexString() { + var strBuf = this.strBuf; + strBuf.length = 0; + var ch = this.currentChar; + var isFirstHex = true; + var firstDigit; + var secondDigit; + while (true) { + if (ch < 0) { + warn('Unterminated hex string'); + break; + } else if (ch === 0x3E) { // '>' + this.nextChar(); + break; + } else if (specialChars[ch] === 1) { + ch = this.nextChar(); + continue; + } else { + if (isFirstHex) { + firstDigit = toHexDigit(ch); + if (firstDigit === -1) { + warn('Ignoring invalid character "' + ch + '" in hex string'); + ch = this.nextChar(); + continue; + } + } else { + secondDigit = toHexDigit(ch); + if (secondDigit === -1) { + warn('Ignoring invalid character "' + ch + '" in hex string'); + ch = this.nextChar(); + continue; + } + strBuf.push(String.fromCharCode((firstDigit << 4) | secondDigit)); + } + isFirstHex = !isFirstHex; + ch = this.nextChar(); + } + } + return strBuf.join(''); + }, + getObj: function Lexer_getObj() { + // skip whitespace and comments + var comment = false; + var ch = this.currentChar; + while (true) { + if (ch < 0) { + return EOF; + } + if (comment) { + if (ch === 0x0A || ch === 0x0D) { // LF, CR + comment = false; + } + } else if (ch === 0x25) { // '%' + comment = true; + } else if (specialChars[ch] !== 1) { + break; + } + ch = this.nextChar(); + } + + // start reading token + switch (ch | 0) { + case 0x30: case 0x31: case 0x32: case 0x33: case 0x34: // '0'-'4' + case 0x35: case 0x36: case 0x37: case 0x38: case 0x39: // '5'-'9' + case 0x2B: case 0x2D: case 0x2E: // '+', '-', '.' + return this.getNumber(); + case 0x28: // '(' + return this.getString(); + case 0x2F: // '/' + return this.getName(); + // array punctuation + case 0x5B: // '[' + this.nextChar(); + return Cmd.get('['); + case 0x5D: // ']' + this.nextChar(); + return Cmd.get(']'); + // hex string or dict punctuation + case 0x3C: // '<' + ch = this.nextChar(); + if (ch === 0x3C) { + // dict punctuation + this.nextChar(); + return Cmd.get('<<'); + } + return this.getHexString(); + // dict punctuation + case 0x3E: // '>' + ch = this.nextChar(); + if (ch === 0x3E) { + this.nextChar(); + return Cmd.get('>>'); + } + return Cmd.get('>'); + case 0x7B: // '{' + this.nextChar(); + return Cmd.get('{'); + case 0x7D: // '}' + this.nextChar(); + return Cmd.get('}'); + case 0x29: // ')' + error('Illegal character: ' + ch); + break; + } + + // command + var str = String.fromCharCode(ch); + var knownCommands = this.knownCommands; + var knownCommandFound = knownCommands && knownCommands[str] !== undefined; + while ((ch = this.nextChar()) >= 0 && !specialChars[ch]) { + // stop if known command is found and next character does not make + // the str a command + var possibleCommand = str + String.fromCharCode(ch); + if (knownCommandFound && knownCommands[possibleCommand] === undefined) { + break; + } + if (str.length === 128) { + error('Command token too long: ' + str.length); + } + str = possibleCommand; + knownCommandFound = knownCommands && knownCommands[str] !== undefined; + } + if (str === 'true') { + return true; + } + if (str === 'false') { + return false; + } + if (str === 'null') { + return null; + } + return Cmd.get(str); + }, + skipToNextLine: function Lexer_skipToNextLine() { + var ch = this.currentChar; + while (ch >= 0) { + if (ch === 0x0D) { // CR + ch = this.nextChar(); + if (ch === 0x0A) { // LF + this.nextChar(); + } + break; + } else if (ch === 0x0A) { // LF + this.nextChar(); + break; + } + ch = this.nextChar(); + } + } + }; + + return Lexer; +})(); + +var Linearization = { + create: function LinearizationCreate(stream) { + function getInt(name, allowZeroValue) { + var obj = linDict.get(name); + if (isInt(obj) && (allowZeroValue ? obj >= 0 : obj > 0)) { + return obj; + } + throw new Error('The "' + name + '" parameter in the linearization ' + + 'dictionary is invalid.'); + } + function getHints() { + var hints = linDict.get('H'), hintsLength, item; + if (isArray(hints) && + ((hintsLength = hints.length) === 2 || hintsLength === 4)) { + for (var index = 0; index < hintsLength; index++) { + if (!(isInt(item = hints[index]) && item > 0)) { + throw new Error('Hint (' + index + + ') in the linearization dictionary is invalid.'); + } + } + return hints; + } + throw new Error('Hint array in the linearization dictionary is invalid.'); + } + var parser = new Parser(new Lexer(stream), false, null); + var obj1 = parser.getObj(); + var obj2 = parser.getObj(); + var obj3 = parser.getObj(); + var linDict = parser.getObj(); + var obj, length; + if (!(isInt(obj1) && isInt(obj2) && isCmd(obj3, 'obj') && isDict(linDict) && + isNum(obj = linDict.get('Linearized')) && obj > 0)) { + return null; // No valid linearization dictionary found. + } else if ((length = getInt('L')) !== stream.length) { + throw new Error('The "L" parameter in the linearization dictionary ' + + 'does not equal the stream length.'); + } + return { + length: length, + hints: getHints(), + objectNumberFirst: getInt('O'), + endFirst: getInt('E'), + numPages: getInt('N'), + mainXRefEntriesOffset: getInt('T'), + pageFirst: (linDict.has('P') ? getInt('P', true) : 0) + }; + } +}; + + +var PostScriptParser = (function PostScriptParserClosure() { + function PostScriptParser(lexer) { + this.lexer = lexer; + this.operators = []; + this.token = null; + this.prev = null; + } + PostScriptParser.prototype = { + nextToken: function PostScriptParser_nextToken() { + this.prev = this.token; + this.token = this.lexer.getToken(); + }, + accept: function PostScriptParser_accept(type) { + if (this.token.type === type) { + this.nextToken(); + return true; + } + return false; + }, + expect: function PostScriptParser_expect(type) { + if (this.accept(type)) { + return true; + } + error('Unexpected symbol: found ' + this.token.type + ' expected ' + + type + '.'); + }, + parse: function PostScriptParser_parse() { + this.nextToken(); + this.expect(PostScriptTokenTypes.LBRACE); + this.parseBlock(); + this.expect(PostScriptTokenTypes.RBRACE); + return this.operators; + }, + parseBlock: function PostScriptParser_parseBlock() { + while (true) { + if (this.accept(PostScriptTokenTypes.NUMBER)) { + this.operators.push(this.prev.value); + } else if (this.accept(PostScriptTokenTypes.OPERATOR)) { + this.operators.push(this.prev.value); + } else if (this.accept(PostScriptTokenTypes.LBRACE)) { + this.parseCondition(); + } else { + return; + } + } + }, + parseCondition: function PostScriptParser_parseCondition() { + // Add two place holders that will be updated later + var conditionLocation = this.operators.length; + this.operators.push(null, null); + + this.parseBlock(); + this.expect(PostScriptTokenTypes.RBRACE); + if (this.accept(PostScriptTokenTypes.IF)) { + // The true block is right after the 'if' so it just falls through on + // true else it jumps and skips the true block. + this.operators[conditionLocation] = this.operators.length; + this.operators[conditionLocation + 1] = 'jz'; + } else if (this.accept(PostScriptTokenTypes.LBRACE)) { + var jumpLocation = this.operators.length; + this.operators.push(null, null); + var endOfTrue = this.operators.length; + this.parseBlock(); + this.expect(PostScriptTokenTypes.RBRACE); + this.expect(PostScriptTokenTypes.IFELSE); + // The jump is added at the end of the true block to skip the false + // block. + this.operators[jumpLocation] = this.operators.length; + this.operators[jumpLocation + 1] = 'j'; + + this.operators[conditionLocation] = endOfTrue; + this.operators[conditionLocation + 1] = 'jz'; + } else { + error('PS Function: error parsing conditional.'); + } + } + }; + return PostScriptParser; +})(); + +var PostScriptTokenTypes = { + LBRACE: 0, + RBRACE: 1, + NUMBER: 2, + OPERATOR: 3, + IF: 4, + IFELSE: 5 +}; + +var PostScriptToken = (function PostScriptTokenClosure() { + function PostScriptToken(type, value) { + this.type = type; + this.value = value; + } + + var opCache = {}; + + PostScriptToken.getOperator = function PostScriptToken_getOperator(op) { + var opValue = opCache[op]; + if (opValue) { + return opValue; + } + return opCache[op] = new PostScriptToken(PostScriptTokenTypes.OPERATOR, op); + }; + + PostScriptToken.LBRACE = new PostScriptToken(PostScriptTokenTypes.LBRACE, + '{'); + PostScriptToken.RBRACE = new PostScriptToken(PostScriptTokenTypes.RBRACE, + '}'); + PostScriptToken.IF = new PostScriptToken(PostScriptTokenTypes.IF, 'IF'); + PostScriptToken.IFELSE = new PostScriptToken(PostScriptTokenTypes.IFELSE, + 'IFELSE'); + return PostScriptToken; +})(); + +var PostScriptLexer = (function PostScriptLexerClosure() { + function PostScriptLexer(stream) { + this.stream = stream; + this.nextChar(); + + this.strBuf = []; + } + PostScriptLexer.prototype = { + nextChar: function PostScriptLexer_nextChar() { + return (this.currentChar = this.stream.getByte()); + }, + getToken: function PostScriptLexer_getToken() { + var comment = false; + var ch = this.currentChar; + + // skip comments + while (true) { + if (ch < 0) { + return EOF; + } + + if (comment) { + if (ch === 0x0A || ch === 0x0D) { + comment = false; + } + } else if (ch === 0x25) { // '%' + comment = true; + } else if (!Lexer.isSpace(ch)) { + break; + } + ch = this.nextChar(); + } + switch (ch | 0) { + case 0x30: case 0x31: case 0x32: case 0x33: case 0x34: // '0'-'4' + case 0x35: case 0x36: case 0x37: case 0x38: case 0x39: // '5'-'9' + case 0x2B: case 0x2D: case 0x2E: // '+', '-', '.' + return new PostScriptToken(PostScriptTokenTypes.NUMBER, + this.getNumber()); + case 0x7B: // '{' + this.nextChar(); + return PostScriptToken.LBRACE; + case 0x7D: // '}' + this.nextChar(); + return PostScriptToken.RBRACE; + } + // operator + var strBuf = this.strBuf; + strBuf.length = 0; + strBuf[0] = String.fromCharCode(ch); + + while ((ch = this.nextChar()) >= 0 && // and 'A'-'Z', 'a'-'z' + ((ch >= 0x41 && ch <= 0x5A) || (ch >= 0x61 && ch <= 0x7A))) { + strBuf.push(String.fromCharCode(ch)); + } + var str = strBuf.join(''); + switch (str.toLowerCase()) { + case 'if': + return PostScriptToken.IF; + case 'ifelse': + return PostScriptToken.IFELSE; + default: + return PostScriptToken.getOperator(str); + } + }, + getNumber: function PostScriptLexer_getNumber() { + var ch = this.currentChar; + var strBuf = this.strBuf; + strBuf.length = 0; + strBuf[0] = String.fromCharCode(ch); + + while ((ch = this.nextChar()) >= 0) { + if ((ch >= 0x30 && ch <= 0x39) || // '0'-'9' + ch === 0x2D || ch === 0x2E) { // '-', '.' + strBuf.push(String.fromCharCode(ch)); + } else { + break; + } + } + var value = parseFloat(strBuf.join('')); + if (isNaN(value)) { + error('Invalid floating point number: ' + value); + } + return value; + } + }; + return PostScriptLexer; +})(); + + +var Stream = (function StreamClosure() { + function Stream(arrayBuffer, start, length, dict) { + this.bytes = (arrayBuffer instanceof Uint8Array ? + arrayBuffer : new Uint8Array(arrayBuffer)); + this.start = start || 0; + this.pos = this.start; + this.end = (start + length) || this.bytes.length; + this.dict = dict; + } + + // required methods for a stream. if a particular stream does not + // implement these, an error should be thrown + Stream.prototype = { + get length() { + return this.end - this.start; + }, + get isEmpty() { + return this.length === 0; + }, + getByte: function Stream_getByte() { + if (this.pos >= this.end) { + return -1; + } + return this.bytes[this.pos++]; + }, + getUint16: function Stream_getUint16() { + var b0 = this.getByte(); + var b1 = this.getByte(); + if (b0 === -1 || b1 === -1) { + return -1; + } + return (b0 << 8) + b1; + }, + getInt32: function Stream_getInt32() { + var b0 = this.getByte(); + var b1 = this.getByte(); + var b2 = this.getByte(); + var b3 = this.getByte(); + return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3; + }, + // returns subarray of original buffer + // should only be read + getBytes: function Stream_getBytes(length) { + var bytes = this.bytes; + var pos = this.pos; + var strEnd = this.end; + + if (!length) { + return bytes.subarray(pos, strEnd); + } + var end = pos + length; + if (end > strEnd) { + end = strEnd; + } + this.pos = end; + return bytes.subarray(pos, end); + }, + peekByte: function Stream_peekByte() { + var peekedByte = this.getByte(); + this.pos--; + return peekedByte; + }, + peekBytes: function Stream_peekBytes(length) { + var bytes = this.getBytes(length); + this.pos -= bytes.length; + return bytes; + }, + skip: function Stream_skip(n) { + if (!n) { + n = 1; + } + this.pos += n; + }, + reset: function Stream_reset() { + this.pos = this.start; + }, + moveStart: function Stream_moveStart() { + this.start = this.pos; + }, + makeSubStream: function Stream_makeSubStream(start, length, dict) { + return new Stream(this.bytes.buffer, start, length, dict); + }, + isStream: true + }; + + return Stream; +})(); + +var StringStream = (function StringStreamClosure() { + function StringStream(str) { + var length = str.length; + var bytes = new Uint8Array(length); + for (var n = 0; n < length; ++n) { + bytes[n] = str.charCodeAt(n); + } + Stream.call(this, bytes); + } + + StringStream.prototype = Stream.prototype; + + return StringStream; +})(); + +// super class for the decoding streams +var DecodeStream = (function DecodeStreamClosure() { + // Lots of DecodeStreams are created whose buffers are never used. For these + // we share a single empty buffer. This is (a) space-efficient and (b) avoids + // having special cases that would be required if we used |null| for an empty + // buffer. + var emptyBuffer = new Uint8Array(0); + + function DecodeStream(maybeMinBufferLength) { + this.pos = 0; + this.bufferLength = 0; + this.eof = false; + this.buffer = emptyBuffer; + this.minBufferLength = 512; + if (maybeMinBufferLength) { + // Compute the first power of two that is as big as maybeMinBufferLength. + while (this.minBufferLength < maybeMinBufferLength) { + this.minBufferLength *= 2; + } + } + } + + DecodeStream.prototype = { + get isEmpty() { + while (!this.eof && this.bufferLength === 0) { + this.readBlock(); + } + return this.bufferLength === 0; + }, + ensureBuffer: function DecodeStream_ensureBuffer(requested) { + var buffer = this.buffer; + if (requested <= buffer.byteLength) { + return buffer; + } + var size = this.minBufferLength; + while (size < requested) { + size *= 2; + } + var buffer2 = new Uint8Array(size); + buffer2.set(buffer); + return (this.buffer = buffer2); + }, + getByte: function DecodeStream_getByte() { + var pos = this.pos; + while (this.bufferLength <= pos) { + if (this.eof) { + return -1; + } + this.readBlock(); + } + return this.buffer[this.pos++]; + }, + getUint16: function DecodeStream_getUint16() { + var b0 = this.getByte(); + var b1 = this.getByte(); + if (b0 === -1 || b1 === -1) { + return -1; + } + return (b0 << 8) + b1; + }, + getInt32: function DecodeStream_getInt32() { + var b0 = this.getByte(); + var b1 = this.getByte(); + var b2 = this.getByte(); + var b3 = this.getByte(); + return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3; + }, + getBytes: function DecodeStream_getBytes(length) { + var end, pos = this.pos; + + if (length) { + this.ensureBuffer(pos + length); + end = pos + length; + + while (!this.eof && this.bufferLength < end) { + this.readBlock(); + } + var bufEnd = this.bufferLength; + if (end > bufEnd) { + end = bufEnd; + } + } else { + while (!this.eof) { + this.readBlock(); + } + end = this.bufferLength; + } + + this.pos = end; + return this.buffer.subarray(pos, end); + }, + peekByte: function DecodeStream_peekByte() { + var peekedByte = this.getByte(); + this.pos--; + return peekedByte; + }, + peekBytes: function DecodeStream_peekBytes(length) { + var bytes = this.getBytes(length); + this.pos -= bytes.length; + return bytes; + }, + makeSubStream: function DecodeStream_makeSubStream(start, length, dict) { + var end = start + length; + while (this.bufferLength <= end && !this.eof) { + this.readBlock(); + } + return new Stream(this.buffer, start, length, dict); + }, + skip: function DecodeStream_skip(n) { + if (!n) { + n = 1; + } + this.pos += n; + }, + reset: function DecodeStream_reset() { + this.pos = 0; + }, + getBaseStreams: function DecodeStream_getBaseStreams() { + if (this.str && this.str.getBaseStreams) { + return this.str.getBaseStreams(); + } + return []; + } + }; + + return DecodeStream; +})(); + +var StreamsSequenceStream = (function StreamsSequenceStreamClosure() { + function StreamsSequenceStream(streams) { + this.streams = streams; + DecodeStream.call(this, /* maybeLength = */ null); + } + + StreamsSequenceStream.prototype = Object.create(DecodeStream.prototype); + + StreamsSequenceStream.prototype.readBlock = + function streamSequenceStreamReadBlock() { + + var streams = this.streams; + if (streams.length === 0) { + this.eof = true; + return; + } + var stream = streams.shift(); + var chunk = stream.getBytes(); + var bufferLength = this.bufferLength; + var newLength = bufferLength + chunk.length; + var buffer = this.ensureBuffer(newLength); + buffer.set(chunk, bufferLength); + this.bufferLength = newLength; + }; + + StreamsSequenceStream.prototype.getBaseStreams = + function StreamsSequenceStream_getBaseStreams() { + + var baseStreams = []; + for (var i = 0, ii = this.streams.length; i < ii; i++) { + var stream = this.streams[i]; + if (stream.getBaseStreams) { + Util.appendToArray(baseStreams, stream.getBaseStreams()); + } + } + return baseStreams; + }; + + return StreamsSequenceStream; +})(); + +var FlateStream = (function FlateStreamClosure() { + var codeLenCodeMap = new Int32Array([ + 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15 + ]); + + var lengthDecode = new Int32Array([ + 0x00003, 0x00004, 0x00005, 0x00006, 0x00007, 0x00008, 0x00009, 0x0000a, + 0x1000b, 0x1000d, 0x1000f, 0x10011, 0x20013, 0x20017, 0x2001b, 0x2001f, + 0x30023, 0x3002b, 0x30033, 0x3003b, 0x40043, 0x40053, 0x40063, 0x40073, + 0x50083, 0x500a3, 0x500c3, 0x500e3, 0x00102, 0x00102, 0x00102 + ]); + + var distDecode = new Int32Array([ + 0x00001, 0x00002, 0x00003, 0x00004, 0x10005, 0x10007, 0x20009, 0x2000d, + 0x30011, 0x30019, 0x40021, 0x40031, 0x50041, 0x50061, 0x60081, 0x600c1, + 0x70101, 0x70181, 0x80201, 0x80301, 0x90401, 0x90601, 0xa0801, 0xa0c01, + 0xb1001, 0xb1801, 0xc2001, 0xc3001, 0xd4001, 0xd6001 + ]); + + var fixedLitCodeTab = [new Int32Array([ + 0x70100, 0x80050, 0x80010, 0x80118, 0x70110, 0x80070, 0x80030, 0x900c0, + 0x70108, 0x80060, 0x80020, 0x900a0, 0x80000, 0x80080, 0x80040, 0x900e0, + 0x70104, 0x80058, 0x80018, 0x90090, 0x70114, 0x80078, 0x80038, 0x900d0, + 0x7010c, 0x80068, 0x80028, 0x900b0, 0x80008, 0x80088, 0x80048, 0x900f0, + 0x70102, 0x80054, 0x80014, 0x8011c, 0x70112, 0x80074, 0x80034, 0x900c8, + 0x7010a, 0x80064, 0x80024, 0x900a8, 0x80004, 0x80084, 0x80044, 0x900e8, + 0x70106, 0x8005c, 0x8001c, 0x90098, 0x70116, 0x8007c, 0x8003c, 0x900d8, + 0x7010e, 0x8006c, 0x8002c, 0x900b8, 0x8000c, 0x8008c, 0x8004c, 0x900f8, + 0x70101, 0x80052, 0x80012, 0x8011a, 0x70111, 0x80072, 0x80032, 0x900c4, + 0x70109, 0x80062, 0x80022, 0x900a4, 0x80002, 0x80082, 0x80042, 0x900e4, + 0x70105, 0x8005a, 0x8001a, 0x90094, 0x70115, 0x8007a, 0x8003a, 0x900d4, + 0x7010d, 0x8006a, 0x8002a, 0x900b4, 0x8000a, 0x8008a, 0x8004a, 0x900f4, + 0x70103, 0x80056, 0x80016, 0x8011e, 0x70113, 0x80076, 0x80036, 0x900cc, + 0x7010b, 0x80066, 0x80026, 0x900ac, 0x80006, 0x80086, 0x80046, 0x900ec, + 0x70107, 0x8005e, 0x8001e, 0x9009c, 0x70117, 0x8007e, 0x8003e, 0x900dc, + 0x7010f, 0x8006e, 0x8002e, 0x900bc, 0x8000e, 0x8008e, 0x8004e, 0x900fc, + 0x70100, 0x80051, 0x80011, 0x80119, 0x70110, 0x80071, 0x80031, 0x900c2, + 0x70108, 0x80061, 0x80021, 0x900a2, 0x80001, 0x80081, 0x80041, 0x900e2, + 0x70104, 0x80059, 0x80019, 0x90092, 0x70114, 0x80079, 0x80039, 0x900d2, + 0x7010c, 0x80069, 0x80029, 0x900b2, 0x80009, 0x80089, 0x80049, 0x900f2, + 0x70102, 0x80055, 0x80015, 0x8011d, 0x70112, 0x80075, 0x80035, 0x900ca, + 0x7010a, 0x80065, 0x80025, 0x900aa, 0x80005, 0x80085, 0x80045, 0x900ea, + 0x70106, 0x8005d, 0x8001d, 0x9009a, 0x70116, 0x8007d, 0x8003d, 0x900da, + 0x7010e, 0x8006d, 0x8002d, 0x900ba, 0x8000d, 0x8008d, 0x8004d, 0x900fa, + 0x70101, 0x80053, 0x80013, 0x8011b, 0x70111, 0x80073, 0x80033, 0x900c6, + 0x70109, 0x80063, 0x80023, 0x900a6, 0x80003, 0x80083, 0x80043, 0x900e6, + 0x70105, 0x8005b, 0x8001b, 0x90096, 0x70115, 0x8007b, 0x8003b, 0x900d6, + 0x7010d, 0x8006b, 0x8002b, 0x900b6, 0x8000b, 0x8008b, 0x8004b, 0x900f6, + 0x70103, 0x80057, 0x80017, 0x8011f, 0x70113, 0x80077, 0x80037, 0x900ce, + 0x7010b, 0x80067, 0x80027, 0x900ae, 0x80007, 0x80087, 0x80047, 0x900ee, + 0x70107, 0x8005f, 0x8001f, 0x9009e, 0x70117, 0x8007f, 0x8003f, 0x900de, + 0x7010f, 0x8006f, 0x8002f, 0x900be, 0x8000f, 0x8008f, 0x8004f, 0x900fe, + 0x70100, 0x80050, 0x80010, 0x80118, 0x70110, 0x80070, 0x80030, 0x900c1, + 0x70108, 0x80060, 0x80020, 0x900a1, 0x80000, 0x80080, 0x80040, 0x900e1, + 0x70104, 0x80058, 0x80018, 0x90091, 0x70114, 0x80078, 0x80038, 0x900d1, + 0x7010c, 0x80068, 0x80028, 0x900b1, 0x80008, 0x80088, 0x80048, 0x900f1, + 0x70102, 0x80054, 0x80014, 0x8011c, 0x70112, 0x80074, 0x80034, 0x900c9, + 0x7010a, 0x80064, 0x80024, 0x900a9, 0x80004, 0x80084, 0x80044, 0x900e9, + 0x70106, 0x8005c, 0x8001c, 0x90099, 0x70116, 0x8007c, 0x8003c, 0x900d9, + 0x7010e, 0x8006c, 0x8002c, 0x900b9, 0x8000c, 0x8008c, 0x8004c, 0x900f9, + 0x70101, 0x80052, 0x80012, 0x8011a, 0x70111, 0x80072, 0x80032, 0x900c5, + 0x70109, 0x80062, 0x80022, 0x900a5, 0x80002, 0x80082, 0x80042, 0x900e5, + 0x70105, 0x8005a, 0x8001a, 0x90095, 0x70115, 0x8007a, 0x8003a, 0x900d5, + 0x7010d, 0x8006a, 0x8002a, 0x900b5, 0x8000a, 0x8008a, 0x8004a, 0x900f5, + 0x70103, 0x80056, 0x80016, 0x8011e, 0x70113, 0x80076, 0x80036, 0x900cd, + 0x7010b, 0x80066, 0x80026, 0x900ad, 0x80006, 0x80086, 0x80046, 0x900ed, + 0x70107, 0x8005e, 0x8001e, 0x9009d, 0x70117, 0x8007e, 0x8003e, 0x900dd, + 0x7010f, 0x8006e, 0x8002e, 0x900bd, 0x8000e, 0x8008e, 0x8004e, 0x900fd, + 0x70100, 0x80051, 0x80011, 0x80119, 0x70110, 0x80071, 0x80031, 0x900c3, + 0x70108, 0x80061, 0x80021, 0x900a3, 0x80001, 0x80081, 0x80041, 0x900e3, + 0x70104, 0x80059, 0x80019, 0x90093, 0x70114, 0x80079, 0x80039, 0x900d3, + 0x7010c, 0x80069, 0x80029, 0x900b3, 0x80009, 0x80089, 0x80049, 0x900f3, + 0x70102, 0x80055, 0x80015, 0x8011d, 0x70112, 0x80075, 0x80035, 0x900cb, + 0x7010a, 0x80065, 0x80025, 0x900ab, 0x80005, 0x80085, 0x80045, 0x900eb, + 0x70106, 0x8005d, 0x8001d, 0x9009b, 0x70116, 0x8007d, 0x8003d, 0x900db, + 0x7010e, 0x8006d, 0x8002d, 0x900bb, 0x8000d, 0x8008d, 0x8004d, 0x900fb, + 0x70101, 0x80053, 0x80013, 0x8011b, 0x70111, 0x80073, 0x80033, 0x900c7, + 0x70109, 0x80063, 0x80023, 0x900a7, 0x80003, 0x80083, 0x80043, 0x900e7, + 0x70105, 0x8005b, 0x8001b, 0x90097, 0x70115, 0x8007b, 0x8003b, 0x900d7, + 0x7010d, 0x8006b, 0x8002b, 0x900b7, 0x8000b, 0x8008b, 0x8004b, 0x900f7, + 0x70103, 0x80057, 0x80017, 0x8011f, 0x70113, 0x80077, 0x80037, 0x900cf, + 0x7010b, 0x80067, 0x80027, 0x900af, 0x80007, 0x80087, 0x80047, 0x900ef, + 0x70107, 0x8005f, 0x8001f, 0x9009f, 0x70117, 0x8007f, 0x8003f, 0x900df, + 0x7010f, 0x8006f, 0x8002f, 0x900bf, 0x8000f, 0x8008f, 0x8004f, 0x900ff + ]), 9]; + + var fixedDistCodeTab = [new Int32Array([ + 0x50000, 0x50010, 0x50008, 0x50018, 0x50004, 0x50014, 0x5000c, 0x5001c, + 0x50002, 0x50012, 0x5000a, 0x5001a, 0x50006, 0x50016, 0x5000e, 0x00000, + 0x50001, 0x50011, 0x50009, 0x50019, 0x50005, 0x50015, 0x5000d, 0x5001d, + 0x50003, 0x50013, 0x5000b, 0x5001b, 0x50007, 0x50017, 0x5000f, 0x00000 + ]), 5]; + + function FlateStream(str, maybeLength) { + this.str = str; + this.dict = str.dict; + + var cmf = str.getByte(); + var flg = str.getByte(); + if (cmf === -1 || flg === -1) { + error('Invalid header in flate stream: ' + cmf + ', ' + flg); + } + if ((cmf & 0x0f) !== 0x08) { + error('Unknown compression method in flate stream: ' + cmf + ', ' + flg); + } + if ((((cmf << 8) + flg) % 31) !== 0) { + error('Bad FCHECK in flate stream: ' + cmf + ', ' + flg); + } + if (flg & 0x20) { + error('FDICT bit set in flate stream: ' + cmf + ', ' + flg); + } + + this.codeSize = 0; + this.codeBuf = 0; + + DecodeStream.call(this, maybeLength); + } + + FlateStream.prototype = Object.create(DecodeStream.prototype); + + FlateStream.prototype.getBits = function FlateStream_getBits(bits) { + var str = this.str; + var codeSize = this.codeSize; + var codeBuf = this.codeBuf; + + var b; + while (codeSize < bits) { + if ((b = str.getByte()) === -1) { + error('Bad encoding in flate stream'); + } + codeBuf |= b << codeSize; + codeSize += 8; + } + b = codeBuf & ((1 << bits) - 1); + this.codeBuf = codeBuf >> bits; + this.codeSize = codeSize -= bits; + + return b; + }; + + FlateStream.prototype.getCode = function FlateStream_getCode(table) { + var str = this.str; + var codes = table[0]; + var maxLen = table[1]; + var codeSize = this.codeSize; + var codeBuf = this.codeBuf; + + var b; + while (codeSize < maxLen) { + if ((b = str.getByte()) === -1) { + // premature end of stream. code might however still be valid. + // codeSize < codeLen check below guards against incomplete codeVal. + break; + } + codeBuf |= (b << codeSize); + codeSize += 8; + } + var code = codes[codeBuf & ((1 << maxLen) - 1)]; + var codeLen = code >> 16; + var codeVal = code & 0xffff; + if (codeLen < 1 || codeSize < codeLen) { + error('Bad encoding in flate stream'); + } + this.codeBuf = (codeBuf >> codeLen); + this.codeSize = (codeSize - codeLen); + return codeVal; + }; + + FlateStream.prototype.generateHuffmanTable = + function flateStreamGenerateHuffmanTable(lengths) { + var n = lengths.length; + + // find max code length + var maxLen = 0; + var i; + for (i = 0; i < n; ++i) { + if (lengths[i] > maxLen) { + maxLen = lengths[i]; + } + } + + // build the table + var size = 1 << maxLen; + var codes = new Int32Array(size); + for (var len = 1, code = 0, skip = 2; + len <= maxLen; + ++len, code <<= 1, skip <<= 1) { + for (var val = 0; val < n; ++val) { + if (lengths[val] === len) { + // bit-reverse the code + var code2 = 0; + var t = code; + for (i = 0; i < len; ++i) { + code2 = (code2 << 1) | (t & 1); + t >>= 1; + } + + // fill the table entries + for (i = code2; i < size; i += skip) { + codes[i] = (len << 16) | val; + } + ++code; + } + } + } + + return [codes, maxLen]; + }; + + FlateStream.prototype.readBlock = function FlateStream_readBlock() { + var buffer, len; + var str = this.str; + // read block header + var hdr = this.getBits(3); + if (hdr & 1) { + this.eof = true; + } + hdr >>= 1; + + if (hdr === 0) { // uncompressed block + var b; + + if ((b = str.getByte()) === -1) { + error('Bad block header in flate stream'); + } + var blockLen = b; + if ((b = str.getByte()) === -1) { + error('Bad block header in flate stream'); + } + blockLen |= (b << 8); + if ((b = str.getByte()) === -1) { + error('Bad block header in flate stream'); + } + var check = b; + if ((b = str.getByte()) === -1) { + error('Bad block header in flate stream'); + } + check |= (b << 8); + if (check !== (~blockLen & 0xffff) && + (blockLen !== 0 || check !== 0)) { + // Ignoring error for bad "empty" block (see issue 1277) + error('Bad uncompressed block length in flate stream'); + } + + this.codeBuf = 0; + this.codeSize = 0; + + var bufferLength = this.bufferLength; + buffer = this.ensureBuffer(bufferLength + blockLen); + var end = bufferLength + blockLen; + this.bufferLength = end; + if (blockLen === 0) { + if (str.peekByte() === -1) { + this.eof = true; + } + } else { + for (var n = bufferLength; n < end; ++n) { + if ((b = str.getByte()) === -1) { + this.eof = true; + break; + } + buffer[n] = b; + } + } + return; + } + + var litCodeTable; + var distCodeTable; + if (hdr === 1) { // compressed block, fixed codes + litCodeTable = fixedLitCodeTab; + distCodeTable = fixedDistCodeTab; + } else if (hdr === 2) { // compressed block, dynamic codes + var numLitCodes = this.getBits(5) + 257; + var numDistCodes = this.getBits(5) + 1; + var numCodeLenCodes = this.getBits(4) + 4; + + // build the code lengths code table + var codeLenCodeLengths = new Uint8Array(codeLenCodeMap.length); + + var i; + for (i = 0; i < numCodeLenCodes; ++i) { + codeLenCodeLengths[codeLenCodeMap[i]] = this.getBits(3); + } + var codeLenCodeTab = this.generateHuffmanTable(codeLenCodeLengths); + + // build the literal and distance code tables + len = 0; + i = 0; + var codes = numLitCodes + numDistCodes; + var codeLengths = new Uint8Array(codes); + var bitsLength, bitsOffset, what; + while (i < codes) { + var code = this.getCode(codeLenCodeTab); + if (code === 16) { + bitsLength = 2; bitsOffset = 3; what = len; + } else if (code === 17) { + bitsLength = 3; bitsOffset = 3; what = (len = 0); + } else if (code === 18) { + bitsLength = 7; bitsOffset = 11; what = (len = 0); + } else { + codeLengths[i++] = len = code; + continue; + } + + var repeatLength = this.getBits(bitsLength) + bitsOffset; + while (repeatLength-- > 0) { + codeLengths[i++] = what; + } + } + + litCodeTable = + this.generateHuffmanTable(codeLengths.subarray(0, numLitCodes)); + distCodeTable = + this.generateHuffmanTable(codeLengths.subarray(numLitCodes, codes)); + } else { + error('Unknown block type in flate stream'); + } + + buffer = this.buffer; + var limit = buffer ? buffer.length : 0; + var pos = this.bufferLength; + while (true) { + var code1 = this.getCode(litCodeTable); + if (code1 < 256) { + if (pos + 1 >= limit) { + buffer = this.ensureBuffer(pos + 1); + limit = buffer.length; + } + buffer[pos++] = code1; + continue; + } + if (code1 === 256) { + this.bufferLength = pos; + return; + } + code1 -= 257; + code1 = lengthDecode[code1]; + var code2 = code1 >> 16; + if (code2 > 0) { + code2 = this.getBits(code2); + } + len = (code1 & 0xffff) + code2; + code1 = this.getCode(distCodeTable); + code1 = distDecode[code1]; + code2 = code1 >> 16; + if (code2 > 0) { + code2 = this.getBits(code2); + } + var dist = (code1 & 0xffff) + code2; + if (pos + len >= limit) { + buffer = this.ensureBuffer(pos + len); + limit = buffer.length; + } + for (var k = 0; k < len; ++k, ++pos) { + buffer[pos] = buffer[pos - dist]; + } + } + }; + + return FlateStream; +})(); + +var PredictorStream = (function PredictorStreamClosure() { + function PredictorStream(str, maybeLength, params) { + var predictor = this.predictor = params.get('Predictor') || 1; + + if (predictor <= 1) { + return str; // no prediction + } + if (predictor !== 2 && (predictor < 10 || predictor > 15)) { + error('Unsupported predictor: ' + predictor); + } + + if (predictor === 2) { + this.readBlock = this.readBlockTiff; + } else { + this.readBlock = this.readBlockPng; + } + + this.str = str; + this.dict = str.dict; + + var colors = this.colors = params.get('Colors') || 1; + var bits = this.bits = params.get('BitsPerComponent') || 8; + var columns = this.columns = params.get('Columns') || 1; + + this.pixBytes = (colors * bits + 7) >> 3; + this.rowBytes = (columns * colors * bits + 7) >> 3; + + DecodeStream.call(this, maybeLength); + return this; + } + + PredictorStream.prototype = Object.create(DecodeStream.prototype); + + PredictorStream.prototype.readBlockTiff = + function predictorStreamReadBlockTiff() { + var rowBytes = this.rowBytes; + + var bufferLength = this.bufferLength; + var buffer = this.ensureBuffer(bufferLength + rowBytes); + + var bits = this.bits; + var colors = this.colors; + + var rawBytes = this.str.getBytes(rowBytes); + this.eof = !rawBytes.length; + if (this.eof) { + return; + } + + var inbuf = 0, outbuf = 0; + var inbits = 0, outbits = 0; + var pos = bufferLength; + var i; + + if (bits === 1) { + for (i = 0; i < rowBytes; ++i) { + var c = rawBytes[i]; + inbuf = (inbuf << 8) | c; + // bitwise addition is exclusive or + // first shift inbuf and then add + buffer[pos++] = (c ^ (inbuf >> colors)) & 0xFF; + // truncate inbuf (assumes colors < 16) + inbuf &= 0xFFFF; + } + } else if (bits === 8) { + for (i = 0; i < colors; ++i) { + buffer[pos++] = rawBytes[i]; + } + for (; i < rowBytes; ++i) { + buffer[pos] = buffer[pos - colors] + rawBytes[i]; + pos++; + } + } else { + var compArray = new Uint8Array(colors + 1); + var bitMask = (1 << bits) - 1; + var j = 0, k = bufferLength; + var columns = this.columns; + for (i = 0; i < columns; ++i) { + for (var kk = 0; kk < colors; ++kk) { + if (inbits < bits) { + inbuf = (inbuf << 8) | (rawBytes[j++] & 0xFF); + inbits += 8; + } + compArray[kk] = (compArray[kk] + + (inbuf >> (inbits - bits))) & bitMask; + inbits -= bits; + outbuf = (outbuf << bits) | compArray[kk]; + outbits += bits; + if (outbits >= 8) { + buffer[k++] = (outbuf >> (outbits - 8)) & 0xFF; + outbits -= 8; + } + } + } + if (outbits > 0) { + buffer[k++] = (outbuf << (8 - outbits)) + + (inbuf & ((1 << (8 - outbits)) - 1)); + } + } + this.bufferLength += rowBytes; + }; + + PredictorStream.prototype.readBlockPng = + function predictorStreamReadBlockPng() { + + var rowBytes = this.rowBytes; + var pixBytes = this.pixBytes; + + var predictor = this.str.getByte(); + var rawBytes = this.str.getBytes(rowBytes); + this.eof = !rawBytes.length; + if (this.eof) { + return; + } + + var bufferLength = this.bufferLength; + var buffer = this.ensureBuffer(bufferLength + rowBytes); + + var prevRow = buffer.subarray(bufferLength - rowBytes, bufferLength); + if (prevRow.length === 0) { + prevRow = new Uint8Array(rowBytes); + } + + var i, j = bufferLength, up, c; + switch (predictor) { + case 0: + for (i = 0; i < rowBytes; ++i) { + buffer[j++] = rawBytes[i]; + } + break; + case 1: + for (i = 0; i < pixBytes; ++i) { + buffer[j++] = rawBytes[i]; + } + for (; i < rowBytes; ++i) { + buffer[j] = (buffer[j - pixBytes] + rawBytes[i]) & 0xFF; + j++; + } + break; + case 2: + for (i = 0; i < rowBytes; ++i) { + buffer[j++] = (prevRow[i] + rawBytes[i]) & 0xFF; + } + break; + case 3: + for (i = 0; i < pixBytes; ++i) { + buffer[j++] = (prevRow[i] >> 1) + rawBytes[i]; + } + for (; i < rowBytes; ++i) { + buffer[j] = (((prevRow[i] + buffer[j - pixBytes]) >> 1) + + rawBytes[i]) & 0xFF; + j++; + } + break; + case 4: + // we need to save the up left pixels values. the simplest way + // is to create a new buffer + for (i = 0; i < pixBytes; ++i) { + up = prevRow[i]; + c = rawBytes[i]; + buffer[j++] = up + c; + } + for (; i < rowBytes; ++i) { + up = prevRow[i]; + var upLeft = prevRow[i - pixBytes]; + var left = buffer[j - pixBytes]; + var p = left + up - upLeft; + + var pa = p - left; + if (pa < 0) { + pa = -pa; + } + var pb = p - up; + if (pb < 0) { + pb = -pb; + } + var pc = p - upLeft; + if (pc < 0) { + pc = -pc; + } + + c = rawBytes[i]; + if (pa <= pb && pa <= pc) { + buffer[j++] = left + c; + } else if (pb <= pc) { + buffer[j++] = up + c; + } else { + buffer[j++] = upLeft + c; + } + } + break; + default: + error('Unsupported predictor: ' + predictor); + } + this.bufferLength += rowBytes; + }; + + return PredictorStream; +})(); + +/** + * Depending on the type of JPEG a JpegStream is handled in different ways. For + * JPEG's that are supported natively such as DeviceGray and DeviceRGB the image + * data is stored and then loaded by the browser. For unsupported JPEG's we use + * a library to decode these images and the stream behaves like all the other + * DecodeStreams. + */ +var JpegStream = (function JpegStreamClosure() { + function JpegStream(stream, maybeLength, dict, xref) { + // Some images may contain 'junk' before the SOI (start-of-image) marker. + // Note: this seems to mainly affect inline images. + var ch; + while ((ch = stream.getByte()) !== -1) { + if (ch === 0xFF) { // Find the first byte of the SOI marker (0xFFD8). + stream.skip(-1); // Reset the stream position to the SOI. + break; + } + } + this.stream = stream; + this.maybeLength = maybeLength; + this.dict = dict; + + DecodeStream.call(this, maybeLength); + } + + JpegStream.prototype = Object.create(DecodeStream.prototype); + + Object.defineProperty(JpegStream.prototype, 'bytes', { + get: function JpegStream_bytes() { + // If this.maybeLength is null, we'll get the entire stream. + return shadow(this, 'bytes', this.stream.getBytes(this.maybeLength)); + }, + configurable: true + }); + + JpegStream.prototype.ensureBuffer = function JpegStream_ensureBuffer(req) { + if (this.bufferLength) { + return; + } + try { + var jpegImage = new JpegImage(); + + // checking if values needs to be transformed before conversion + if (this.forceRGB && this.dict && isArray(this.dict.get('Decode'))) { + var decodeArr = this.dict.get('Decode'); + var bitsPerComponent = this.dict.get('BitsPerComponent') || 8; + var decodeArrLength = decodeArr.length; + var transform = new Int32Array(decodeArrLength); + var transformNeeded = false; + var maxValue = (1 << bitsPerComponent) - 1; + for (var i = 0; i < decodeArrLength; i += 2) { + transform[i] = ((decodeArr[i + 1] - decodeArr[i]) * 256) | 0; + transform[i + 1] = (decodeArr[i] * maxValue) | 0; + if (transform[i] !== 256 || transform[i + 1] !== 0) { + transformNeeded = true; + } + } + if (transformNeeded) { + jpegImage.decodeTransform = transform; + } + } + + jpegImage.parse(this.bytes); + var data = jpegImage.getData(this.drawWidth, this.drawHeight, + this.forceRGB); + this.buffer = data; + this.bufferLength = data.length; + this.eof = true; + } catch (e) { + error('JPEG error: ' + e); + } + }; + + JpegStream.prototype.getBytes = function JpegStream_getBytes(length) { + this.ensureBuffer(); + return this.buffer; + }; + + JpegStream.prototype.getIR = function JpegStream_getIR() { + return PDFJS.createObjectURL(this.bytes, 'image/jpeg'); + }; + /** + * Checks if the image can be decoded and displayed by the browser without any + * further processing such as color space conversions. + */ + JpegStream.prototype.isNativelySupported = + function JpegStream_isNativelySupported(xref, res) { + var cs = ColorSpace.parse(this.dict.get('ColorSpace', 'CS'), xref, res); + return (cs.name === 'DeviceGray' || cs.name === 'DeviceRGB') && + cs.isDefaultDecode(this.dict.get('Decode', 'D')); + }; + /** + * Checks if the image can be decoded by the browser. + */ + JpegStream.prototype.isNativelyDecodable = + function JpegStream_isNativelyDecodable(xref, res) { + var cs = ColorSpace.parse(this.dict.get('ColorSpace', 'CS'), xref, res); + return (cs.numComps === 1 || cs.numComps === 3) && + cs.isDefaultDecode(this.dict.get('Decode', 'D')); + }; + + return JpegStream; +})(); + +/** + * For JPEG 2000's we use a library to decode these images and + * the stream behaves like all the other DecodeStreams. + */ +var JpxStream = (function JpxStreamClosure() { + function JpxStream(stream, maybeLength, dict) { + this.stream = stream; + this.maybeLength = maybeLength; + this.dict = dict; + + DecodeStream.call(this, maybeLength); + } + + JpxStream.prototype = Object.create(DecodeStream.prototype); + + Object.defineProperty(JpxStream.prototype, 'bytes', { + get: function JpxStream_bytes() { + // If this.maybeLength is null, we'll get the entire stream. + return shadow(this, 'bytes', this.stream.getBytes(this.maybeLength)); + }, + configurable: true + }); + + JpxStream.prototype.ensureBuffer = function JpxStream_ensureBuffer(req) { + if (this.bufferLength) { + return; + } + + var jpxImage = new JpxImage(); + jpxImage.parse(this.bytes); + + var width = jpxImage.width; + var height = jpxImage.height; + var componentsCount = jpxImage.componentsCount; + var tileCount = jpxImage.tiles.length; + if (tileCount === 1) { + this.buffer = jpxImage.tiles[0].items; + } else { + var data = new Uint8Array(width * height * componentsCount); + + for (var k = 0; k < tileCount; k++) { + var tileComponents = jpxImage.tiles[k]; + var tileWidth = tileComponents.width; + var tileHeight = tileComponents.height; + var tileLeft = tileComponents.left; + var tileTop = tileComponents.top; + + var src = tileComponents.items; + var srcPosition = 0; + var dataPosition = (width * tileTop + tileLeft) * componentsCount; + var imgRowSize = width * componentsCount; + var tileRowSize = tileWidth * componentsCount; + + for (var j = 0; j < tileHeight; j++) { + var rowBytes = src.subarray(srcPosition, srcPosition + tileRowSize); + data.set(rowBytes, dataPosition); + srcPosition += tileRowSize; + dataPosition += imgRowSize; + } + } + this.buffer = data; + } + this.bufferLength = this.buffer.length; + this.eof = true; + }; + + return JpxStream; +})(); + +/** + * For JBIG2's we use a library to decode these images and + * the stream behaves like all the other DecodeStreams. + */ +var Jbig2Stream = (function Jbig2StreamClosure() { + function Jbig2Stream(stream, maybeLength, dict) { + this.stream = stream; + this.maybeLength = maybeLength; + this.dict = dict; + + DecodeStream.call(this, maybeLength); + } + + Jbig2Stream.prototype = Object.create(DecodeStream.prototype); + + Object.defineProperty(Jbig2Stream.prototype, 'bytes', { + get: function Jbig2Stream_bytes() { + // If this.maybeLength is null, we'll get the entire stream. + return shadow(this, 'bytes', this.stream.getBytes(this.maybeLength)); + }, + configurable: true + }); + + Jbig2Stream.prototype.ensureBuffer = function Jbig2Stream_ensureBuffer(req) { + if (this.bufferLength) { + return; + } + + var jbig2Image = new Jbig2Image(); + + var chunks = [], xref = this.dict.xref; + var decodeParams = xref.fetchIfRef(this.dict.get('DecodeParms')); + + // According to the PDF specification, DecodeParms can be either + // a dictionary, or an array whose elements are dictionaries. + if (isArray(decodeParams)) { + if (decodeParams.length > 1) { + warn('JBIG2 - \'DecodeParms\' array with multiple elements ' + + 'not supported.'); + } + decodeParams = xref.fetchIfRef(decodeParams[0]); + } + if (decodeParams && decodeParams.has('JBIG2Globals')) { + var globalsStream = decodeParams.get('JBIG2Globals'); + var globals = globalsStream.getBytes(); + chunks.push({data: globals, start: 0, end: globals.length}); + } + chunks.push({data: this.bytes, start: 0, end: this.bytes.length}); + var data = jbig2Image.parseChunks(chunks); + var dataLength = data.length; + + // JBIG2 had black as 1 and white as 0, inverting the colors + for (var i = 0; i < dataLength; i++) { + data[i] ^= 0xFF; + } + + this.buffer = data; + this.bufferLength = dataLength; + this.eof = true; + }; + + return Jbig2Stream; +})(); + +var DecryptStream = (function DecryptStreamClosure() { + function DecryptStream(str, maybeLength, decrypt) { + this.str = str; + this.dict = str.dict; + this.decrypt = decrypt; + this.nextChunk = null; + this.initialized = false; + + DecodeStream.call(this, maybeLength); + } + + var chunkSize = 512; + + DecryptStream.prototype = Object.create(DecodeStream.prototype); + + DecryptStream.prototype.readBlock = function DecryptStream_readBlock() { + var chunk; + if (this.initialized) { + chunk = this.nextChunk; + } else { + chunk = this.str.getBytes(chunkSize); + this.initialized = true; + } + if (!chunk || chunk.length === 0) { + this.eof = true; + return; + } + this.nextChunk = this.str.getBytes(chunkSize); + var hasMoreData = this.nextChunk && this.nextChunk.length > 0; + + var decrypt = this.decrypt; + chunk = decrypt(chunk, !hasMoreData); + + var bufferLength = this.bufferLength; + var i, n = chunk.length; + var buffer = this.ensureBuffer(bufferLength + n); + for (i = 0; i < n; i++) { + buffer[bufferLength++] = chunk[i]; + } + this.bufferLength = bufferLength; + }; + + return DecryptStream; +})(); + +var Ascii85Stream = (function Ascii85StreamClosure() { + function Ascii85Stream(str, maybeLength) { + this.str = str; + this.dict = str.dict; + this.input = new Uint8Array(5); + + // Most streams increase in size when decoded, but Ascii85 streams + // typically shrink by ~20%. + if (maybeLength) { + maybeLength = 0.8 * maybeLength; + } + DecodeStream.call(this, maybeLength); + } + + Ascii85Stream.prototype = Object.create(DecodeStream.prototype); + + Ascii85Stream.prototype.readBlock = function Ascii85Stream_readBlock() { + var TILDA_CHAR = 0x7E; // '~' + var Z_LOWER_CHAR = 0x7A; // 'z' + var EOF = -1; + + var str = this.str; + + var c = str.getByte(); + while (Lexer.isSpace(c)) { + c = str.getByte(); + } + + if (c === EOF || c === TILDA_CHAR) { + this.eof = true; + return; + } + + var bufferLength = this.bufferLength, buffer; + var i; + + // special code for z + if (c === Z_LOWER_CHAR) { + buffer = this.ensureBuffer(bufferLength + 4); + for (i = 0; i < 4; ++i) { + buffer[bufferLength + i] = 0; + } + this.bufferLength += 4; + } else { + var input = this.input; + input[0] = c; + for (i = 1; i < 5; ++i) { + c = str.getByte(); + while (Lexer.isSpace(c)) { + c = str.getByte(); + } + + input[i] = c; + + if (c === EOF || c === TILDA_CHAR) { + break; + } + } + buffer = this.ensureBuffer(bufferLength + i - 1); + this.bufferLength += i - 1; + + // partial ending; + if (i < 5) { + for (; i < 5; ++i) { + input[i] = 0x21 + 84; + } + this.eof = true; + } + var t = 0; + for (i = 0; i < 5; ++i) { + t = t * 85 + (input[i] - 0x21); + } + + for (i = 3; i >= 0; --i) { + buffer[bufferLength + i] = t & 0xFF; + t >>= 8; + } + } + }; + + return Ascii85Stream; +})(); + +var AsciiHexStream = (function AsciiHexStreamClosure() { + function AsciiHexStream(str, maybeLength) { + this.str = str; + this.dict = str.dict; + + this.firstDigit = -1; + + // Most streams increase in size when decoded, but AsciiHex streams shrink + // by 50%. + if (maybeLength) { + maybeLength = 0.5 * maybeLength; + } + DecodeStream.call(this, maybeLength); + } + + AsciiHexStream.prototype = Object.create(DecodeStream.prototype); + + AsciiHexStream.prototype.readBlock = function AsciiHexStream_readBlock() { + var UPSTREAM_BLOCK_SIZE = 8000; + var bytes = this.str.getBytes(UPSTREAM_BLOCK_SIZE); + if (!bytes.length) { + this.eof = true; + return; + } + + var maxDecodeLength = (bytes.length + 1) >> 1; + var buffer = this.ensureBuffer(this.bufferLength + maxDecodeLength); + var bufferLength = this.bufferLength; + + var firstDigit = this.firstDigit; + for (var i = 0, ii = bytes.length; i < ii; i++) { + var ch = bytes[i], digit; + if (ch >= 0x30 && ch <= 0x39) { // '0'-'9' + digit = ch & 0x0F; + } else if ((ch >= 0x41 && ch <= 0x46) || (ch >= 0x61 && ch <= 0x66)) { + // 'A'-'Z', 'a'-'z' + digit = (ch & 0x0F) + 9; + } else if (ch === 0x3E) { // '>' + this.eof = true; + break; + } else { // probably whitespace + continue; // ignoring + } + if (firstDigit < 0) { + firstDigit = digit; + } else { + buffer[bufferLength++] = (firstDigit << 4) | digit; + firstDigit = -1; + } + } + if (firstDigit >= 0 && this.eof) { + // incomplete byte + buffer[bufferLength++] = (firstDigit << 4); + firstDigit = -1; + } + this.firstDigit = firstDigit; + this.bufferLength = bufferLength; + }; + + return AsciiHexStream; +})(); + +var RunLengthStream = (function RunLengthStreamClosure() { + function RunLengthStream(str, maybeLength) { + this.str = str; + this.dict = str.dict; + + DecodeStream.call(this, maybeLength); + } + + RunLengthStream.prototype = Object.create(DecodeStream.prototype); + + RunLengthStream.prototype.readBlock = function RunLengthStream_readBlock() { + // The repeatHeader has following format. The first byte defines type of run + // and amount of bytes to repeat/copy: n = 0 through 127 - copy next n bytes + // (in addition to the second byte from the header), n = 129 through 255 - + // duplicate the second byte from the header (257 - n) times, n = 128 - end. + var repeatHeader = this.str.getBytes(2); + if (!repeatHeader || repeatHeader.length < 2 || repeatHeader[0] === 128) { + this.eof = true; + return; + } + + var buffer; + var bufferLength = this.bufferLength; + var n = repeatHeader[0]; + if (n < 128) { + // copy n bytes + buffer = this.ensureBuffer(bufferLength + n + 1); + buffer[bufferLength++] = repeatHeader[1]; + if (n > 0) { + var source = this.str.getBytes(n); + buffer.set(source, bufferLength); + bufferLength += n; + } + } else { + n = 257 - n; + var b = repeatHeader[1]; + buffer = this.ensureBuffer(bufferLength + n + 1); + for (var i = 0; i < n; i++) { + buffer[bufferLength++] = b; + } + } + this.bufferLength = bufferLength; + }; + + return RunLengthStream; +})(); + +var CCITTFaxStream = (function CCITTFaxStreamClosure() { + + var ccittEOL = -2; + var twoDimPass = 0; + var twoDimHoriz = 1; + var twoDimVert0 = 2; + var twoDimVertR1 = 3; + var twoDimVertL1 = 4; + var twoDimVertR2 = 5; + var twoDimVertL2 = 6; + var twoDimVertR3 = 7; + var twoDimVertL3 = 8; + + var twoDimTable = [ + [-1, -1], [-1, -1], // 000000x + [7, twoDimVertL3], // 0000010 + [7, twoDimVertR3], // 0000011 + [6, twoDimVertL2], [6, twoDimVertL2], // 000010x + [6, twoDimVertR2], [6, twoDimVertR2], // 000011x + [4, twoDimPass], [4, twoDimPass], // 0001xxx + [4, twoDimPass], [4, twoDimPass], + [4, twoDimPass], [4, twoDimPass], + [4, twoDimPass], [4, twoDimPass], + [3, twoDimHoriz], [3, twoDimHoriz], // 001xxxx + [3, twoDimHoriz], [3, twoDimHoriz], + [3, twoDimHoriz], [3, twoDimHoriz], + [3, twoDimHoriz], [3, twoDimHoriz], + [3, twoDimHoriz], [3, twoDimHoriz], + [3, twoDimHoriz], [3, twoDimHoriz], + [3, twoDimHoriz], [3, twoDimHoriz], + [3, twoDimHoriz], [3, twoDimHoriz], + [3, twoDimVertL1], [3, twoDimVertL1], // 010xxxx + [3, twoDimVertL1], [3, twoDimVertL1], + [3, twoDimVertL1], [3, twoDimVertL1], + [3, twoDimVertL1], [3, twoDimVertL1], + [3, twoDimVertL1], [3, twoDimVertL1], + [3, twoDimVertL1], [3, twoDimVertL1], + [3, twoDimVertL1], [3, twoDimVertL1], + [3, twoDimVertL1], [3, twoDimVertL1], + [3, twoDimVertR1], [3, twoDimVertR1], // 011xxxx + [3, twoDimVertR1], [3, twoDimVertR1], + [3, twoDimVertR1], [3, twoDimVertR1], + [3, twoDimVertR1], [3, twoDimVertR1], + [3, twoDimVertR1], [3, twoDimVertR1], + [3, twoDimVertR1], [3, twoDimVertR1], + [3, twoDimVertR1], [3, twoDimVertR1], + [3, twoDimVertR1], [3, twoDimVertR1], + [1, twoDimVert0], [1, twoDimVert0], // 1xxxxxx + [1, twoDimVert0], [1, twoDimVert0], + [1, twoDimVert0], [1, twoDimVert0], + [1, twoDimVert0], [1, twoDimVert0], + [1, twoDimVert0], [1, twoDimVert0], + [1, twoDimVert0], [1, twoDimVert0], + [1, twoDimVert0], [1, twoDimVert0], + [1, twoDimVert0], [1, twoDimVert0], + [1, twoDimVert0], [1, twoDimVert0], + [1, twoDimVert0], [1, twoDimVert0], + [1, twoDimVert0], [1, twoDimVert0], + [1, twoDimVert0], [1, twoDimVert0], + [1, twoDimVert0], [1, twoDimVert0], + [1, twoDimVert0], [1, twoDimVert0], + [1, twoDimVert0], [1, twoDimVert0], + [1, twoDimVert0], [1, twoDimVert0], + [1, twoDimVert0], [1, twoDimVert0], + [1, twoDimVert0], [1, twoDimVert0], + [1, twoDimVert0], [1, twoDimVert0], + [1, twoDimVert0], [1, twoDimVert0], + [1, twoDimVert0], [1, twoDimVert0], + [1, twoDimVert0], [1, twoDimVert0], + [1, twoDimVert0], [1, twoDimVert0], + [1, twoDimVert0], [1, twoDimVert0], + [1, twoDimVert0], [1, twoDimVert0], + [1, twoDimVert0], [1, twoDimVert0], + [1, twoDimVert0], [1, twoDimVert0], + [1, twoDimVert0], [1, twoDimVert0], + [1, twoDimVert0], [1, twoDimVert0], + [1, twoDimVert0], [1, twoDimVert0], + [1, twoDimVert0], [1, twoDimVert0], + [1, twoDimVert0], [1, twoDimVert0] + ]; + + var whiteTable1 = [ + [-1, -1], // 00000 + [12, ccittEOL], // 00001 + [-1, -1], [-1, -1], // 0001x + [-1, -1], [-1, -1], [-1, -1], [-1, -1], // 001xx + [-1, -1], [-1, -1], [-1, -1], [-1, -1], // 010xx + [-1, -1], [-1, -1], [-1, -1], [-1, -1], // 011xx + [11, 1792], [11, 1792], // 1000x + [12, 1984], // 10010 + [12, 2048], // 10011 + [12, 2112], // 10100 + [12, 2176], // 10101 + [12, 2240], // 10110 + [12, 2304], // 10111 + [11, 1856], [11, 1856], // 1100x + [11, 1920], [11, 1920], // 1101x + [12, 2368], // 11100 + [12, 2432], // 11101 + [12, 2496], // 11110 + [12, 2560] // 11111 + ]; + + var whiteTable2 = [ + [-1, -1], [-1, -1], [-1, -1], [-1, -1], // 0000000xx + [8, 29], [8, 29], // 00000010x + [8, 30], [8, 30], // 00000011x + [8, 45], [8, 45], // 00000100x + [8, 46], [8, 46], // 00000101x + [7, 22], [7, 22], [7, 22], [7, 22], // 0000011xx + [7, 23], [7, 23], [7, 23], [7, 23], // 0000100xx + [8, 47], [8, 47], // 00001010x + [8, 48], [8, 48], // 00001011x + [6, 13], [6, 13], [6, 13], [6, 13], // 000011xxx + [6, 13], [6, 13], [6, 13], [6, 13], + [7, 20], [7, 20], [7, 20], [7, 20], // 0001000xx + [8, 33], [8, 33], // 00010010x + [8, 34], [8, 34], // 00010011x + [8, 35], [8, 35], // 00010100x + [8, 36], [8, 36], // 00010101x + [8, 37], [8, 37], // 00010110x + [8, 38], [8, 38], // 00010111x + [7, 19], [7, 19], [7, 19], [7, 19], // 0001100xx + [8, 31], [8, 31], // 00011010x + [8, 32], [8, 32], // 00011011x + [6, 1], [6, 1], [6, 1], [6, 1], // 000111xxx + [6, 1], [6, 1], [6, 1], [6, 1], + [6, 12], [6, 12], [6, 12], [6, 12], // 001000xxx + [6, 12], [6, 12], [6, 12], [6, 12], + [8, 53], [8, 53], // 00100100x + [8, 54], [8, 54], // 00100101x + [7, 26], [7, 26], [7, 26], [7, 26], // 0010011xx + [8, 39], [8, 39], // 00101000x + [8, 40], [8, 40], // 00101001x + [8, 41], [8, 41], // 00101010x + [8, 42], [8, 42], // 00101011x + [8, 43], [8, 43], // 00101100x + [8, 44], [8, 44], // 00101101x + [7, 21], [7, 21], [7, 21], [7, 21], // 0010111xx + [7, 28], [7, 28], [7, 28], [7, 28], // 0011000xx + [8, 61], [8, 61], // 00110010x + [8, 62], [8, 62], // 00110011x + [8, 63], [8, 63], // 00110100x + [8, 0], [8, 0], // 00110101x + [8, 320], [8, 320], // 00110110x + [8, 384], [8, 384], // 00110111x + [5, 10], [5, 10], [5, 10], [5, 10], // 00111xxxx + [5, 10], [5, 10], [5, 10], [5, 10], + [5, 10], [5, 10], [5, 10], [5, 10], + [5, 10], [5, 10], [5, 10], [5, 10], + [5, 11], [5, 11], [5, 11], [5, 11], // 01000xxxx + [5, 11], [5, 11], [5, 11], [5, 11], + [5, 11], [5, 11], [5, 11], [5, 11], + [5, 11], [5, 11], [5, 11], [5, 11], + [7, 27], [7, 27], [7, 27], [7, 27], // 0100100xx + [8, 59], [8, 59], // 01001010x + [8, 60], [8, 60], // 01001011x + [9, 1472], // 010011000 + [9, 1536], // 010011001 + [9, 1600], // 010011010 + [9, 1728], // 010011011 + [7, 18], [7, 18], [7, 18], [7, 18], // 0100111xx + [7, 24], [7, 24], [7, 24], [7, 24], // 0101000xx + [8, 49], [8, 49], // 01010010x + [8, 50], [8, 50], // 01010011x + [8, 51], [8, 51], // 01010100x + [8, 52], [8, 52], // 01010101x + [7, 25], [7, 25], [7, 25], [7, 25], // 0101011xx + [8, 55], [8, 55], // 01011000x + [8, 56], [8, 56], // 01011001x + [8, 57], [8, 57], // 01011010x + [8, 58], [8, 58], // 01011011x + [6, 192], [6, 192], [6, 192], [6, 192], // 010111xxx + [6, 192], [6, 192], [6, 192], [6, 192], + [6, 1664], [6, 1664], [6, 1664], [6, 1664], // 011000xxx + [6, 1664], [6, 1664], [6, 1664], [6, 1664], + [8, 448], [8, 448], // 01100100x + [8, 512], [8, 512], // 01100101x + [9, 704], // 011001100 + [9, 768], // 011001101 + [8, 640], [8, 640], // 01100111x + [8, 576], [8, 576], // 01101000x + [9, 832], // 011010010 + [9, 896], // 011010011 + [9, 960], // 011010100 + [9, 1024], // 011010101 + [9, 1088], // 011010110 + [9, 1152], // 011010111 + [9, 1216], // 011011000 + [9, 1280], // 011011001 + [9, 1344], // 011011010 + [9, 1408], // 011011011 + [7, 256], [7, 256], [7, 256], [7, 256], // 0110111xx + [4, 2], [4, 2], [4, 2], [4, 2], // 0111xxxxx + [4, 2], [4, 2], [4, 2], [4, 2], + [4, 2], [4, 2], [4, 2], [4, 2], + [4, 2], [4, 2], [4, 2], [4, 2], + [4, 2], [4, 2], [4, 2], [4, 2], + [4, 2], [4, 2], [4, 2], [4, 2], + [4, 2], [4, 2], [4, 2], [4, 2], + [4, 2], [4, 2], [4, 2], [4, 2], + [4, 3], [4, 3], [4, 3], [4, 3], // 1000xxxxx + [4, 3], [4, 3], [4, 3], [4, 3], + [4, 3], [4, 3], [4, 3], [4, 3], + [4, 3], [4, 3], [4, 3], [4, 3], + [4, 3], [4, 3], [4, 3], [4, 3], + [4, 3], [4, 3], [4, 3], [4, 3], + [4, 3], [4, 3], [4, 3], [4, 3], + [4, 3], [4, 3], [4, 3], [4, 3], + [5, 128], [5, 128], [5, 128], [5, 128], // 10010xxxx + [5, 128], [5, 128], [5, 128], [5, 128], + [5, 128], [5, 128], [5, 128], [5, 128], + [5, 128], [5, 128], [5, 128], [5, 128], + [5, 8], [5, 8], [5, 8], [5, 8], // 10011xxxx + [5, 8], [5, 8], [5, 8], [5, 8], + [5, 8], [5, 8], [5, 8], [5, 8], + [5, 8], [5, 8], [5, 8], [5, 8], + [5, 9], [5, 9], [5, 9], [5, 9], // 10100xxxx + [5, 9], [5, 9], [5, 9], [5, 9], + [5, 9], [5, 9], [5, 9], [5, 9], + [5, 9], [5, 9], [5, 9], [5, 9], + [6, 16], [6, 16], [6, 16], [6, 16], // 101010xxx + [6, 16], [6, 16], [6, 16], [6, 16], + [6, 17], [6, 17], [6, 17], [6, 17], // 101011xxx + [6, 17], [6, 17], [6, 17], [6, 17], + [4, 4], [4, 4], [4, 4], [4, 4], // 1011xxxxx + [4, 4], [4, 4], [4, 4], [4, 4], + [4, 4], [4, 4], [4, 4], [4, 4], + [4, 4], [4, 4], [4, 4], [4, 4], + [4, 4], [4, 4], [4, 4], [4, 4], + [4, 4], [4, 4], [4, 4], [4, 4], + [4, 4], [4, 4], [4, 4], [4, 4], + [4, 4], [4, 4], [4, 4], [4, 4], + [4, 5], [4, 5], [4, 5], [4, 5], // 1100xxxxx + [4, 5], [4, 5], [4, 5], [4, 5], + [4, 5], [4, 5], [4, 5], [4, 5], + [4, 5], [4, 5], [4, 5], [4, 5], + [4, 5], [4, 5], [4, 5], [4, 5], + [4, 5], [4, 5], [4, 5], [4, 5], + [4, 5], [4, 5], [4, 5], [4, 5], + [4, 5], [4, 5], [4, 5], [4, 5], + [6, 14], [6, 14], [6, 14], [6, 14], // 110100xxx + [6, 14], [6, 14], [6, 14], [6, 14], + [6, 15], [6, 15], [6, 15], [6, 15], // 110101xxx + [6, 15], [6, 15], [6, 15], [6, 15], + [5, 64], [5, 64], [5, 64], [5, 64], // 11011xxxx + [5, 64], [5, 64], [5, 64], [5, 64], + [5, 64], [5, 64], [5, 64], [5, 64], + [5, 64], [5, 64], [5, 64], [5, 64], + [4, 6], [4, 6], [4, 6], [4, 6], // 1110xxxxx + [4, 6], [4, 6], [4, 6], [4, 6], + [4, 6], [4, 6], [4, 6], [4, 6], + [4, 6], [4, 6], [4, 6], [4, 6], + [4, 6], [4, 6], [4, 6], [4, 6], + [4, 6], [4, 6], [4, 6], [4, 6], + [4, 6], [4, 6], [4, 6], [4, 6], + [4, 6], [4, 6], [4, 6], [4, 6], + [4, 7], [4, 7], [4, 7], [4, 7], // 1111xxxxx + [4, 7], [4, 7], [4, 7], [4, 7], + [4, 7], [4, 7], [4, 7], [4, 7], + [4, 7], [4, 7], [4, 7], [4, 7], + [4, 7], [4, 7], [4, 7], [4, 7], + [4, 7], [4, 7], [4, 7], [4, 7], + [4, 7], [4, 7], [4, 7], [4, 7], + [4, 7], [4, 7], [4, 7], [4, 7] + ]; + + var blackTable1 = [ + [-1, -1], [-1, -1], // 000000000000x + [12, ccittEOL], [12, ccittEOL], // 000000000001x + [-1, -1], [-1, -1], [-1, -1], [-1, -1], // 00000000001xx + [-1, -1], [-1, -1], [-1, -1], [-1, -1], // 00000000010xx + [-1, -1], [-1, -1], [-1, -1], [-1, -1], // 00000000011xx + [-1, -1], [-1, -1], [-1, -1], [-1, -1], // 00000000100xx + [-1, -1], [-1, -1], [-1, -1], [-1, -1], // 00000000101xx + [-1, -1], [-1, -1], [-1, -1], [-1, -1], // 00000000110xx + [-1, -1], [-1, -1], [-1, -1], [-1, -1], // 00000000111xx + [11, 1792], [11, 1792], [11, 1792], [11, 1792], // 00000001000xx + [12, 1984], [12, 1984], // 000000010010x + [12, 2048], [12, 2048], // 000000010011x + [12, 2112], [12, 2112], // 000000010100x + [12, 2176], [12, 2176], // 000000010101x + [12, 2240], [12, 2240], // 000000010110x + [12, 2304], [12, 2304], // 000000010111x + [11, 1856], [11, 1856], [11, 1856], [11, 1856], // 00000001100xx + [11, 1920], [11, 1920], [11, 1920], [11, 1920], // 00000001101xx + [12, 2368], [12, 2368], // 000000011100x + [12, 2432], [12, 2432], // 000000011101x + [12, 2496], [12, 2496], // 000000011110x + [12, 2560], [12, 2560], // 000000011111x + [10, 18], [10, 18], [10, 18], [10, 18], // 0000001000xxx + [10, 18], [10, 18], [10, 18], [10, 18], + [12, 52], [12, 52], // 000000100100x + [13, 640], // 0000001001010 + [13, 704], // 0000001001011 + [13, 768], // 0000001001100 + [13, 832], // 0000001001101 + [12, 55], [12, 55], // 000000100111x + [12, 56], [12, 56], // 000000101000x + [13, 1280], // 0000001010010 + [13, 1344], // 0000001010011 + [13, 1408], // 0000001010100 + [13, 1472], // 0000001010101 + [12, 59], [12, 59], // 000000101011x + [12, 60], [12, 60], // 000000101100x + [13, 1536], // 0000001011010 + [13, 1600], // 0000001011011 + [11, 24], [11, 24], [11, 24], [11, 24], // 00000010111xx + [11, 25], [11, 25], [11, 25], [11, 25], // 00000011000xx + [13, 1664], // 0000001100100 + [13, 1728], // 0000001100101 + [12, 320], [12, 320], // 000000110011x + [12, 384], [12, 384], // 000000110100x + [12, 448], [12, 448], // 000000110101x + [13, 512], // 0000001101100 + [13, 576], // 0000001101101 + [12, 53], [12, 53], // 000000110111x + [12, 54], [12, 54], // 000000111000x + [13, 896], // 0000001110010 + [13, 960], // 0000001110011 + [13, 1024], // 0000001110100 + [13, 1088], // 0000001110101 + [13, 1152], // 0000001110110 + [13, 1216], // 0000001110111 + [10, 64], [10, 64], [10, 64], [10, 64], // 0000001111xxx + [10, 64], [10, 64], [10, 64], [10, 64] + ]; + + var blackTable2 = [ + [8, 13], [8, 13], [8, 13], [8, 13], // 00000100xxxx + [8, 13], [8, 13], [8, 13], [8, 13], + [8, 13], [8, 13], [8, 13], [8, 13], + [8, 13], [8, 13], [8, 13], [8, 13], + [11, 23], [11, 23], // 00000101000x + [12, 50], // 000001010010 + [12, 51], // 000001010011 + [12, 44], // 000001010100 + [12, 45], // 000001010101 + [12, 46], // 000001010110 + [12, 47], // 000001010111 + [12, 57], // 000001011000 + [12, 58], // 000001011001 + [12, 61], // 000001011010 + [12, 256], // 000001011011 + [10, 16], [10, 16], [10, 16], [10, 16], // 0000010111xx + [10, 17], [10, 17], [10, 17], [10, 17], // 0000011000xx + [12, 48], // 000001100100 + [12, 49], // 000001100101 + [12, 62], // 000001100110 + [12, 63], // 000001100111 + [12, 30], // 000001101000 + [12, 31], // 000001101001 + [12, 32], // 000001101010 + [12, 33], // 000001101011 + [12, 40], // 000001101100 + [12, 41], // 000001101101 + [11, 22], [11, 22], // 00000110111x + [8, 14], [8, 14], [8, 14], [8, 14], // 00000111xxxx + [8, 14], [8, 14], [8, 14], [8, 14], + [8, 14], [8, 14], [8, 14], [8, 14], + [8, 14], [8, 14], [8, 14], [8, 14], + [7, 10], [7, 10], [7, 10], [7, 10], // 0000100xxxxx + [7, 10], [7, 10], [7, 10], [7, 10], + [7, 10], [7, 10], [7, 10], [7, 10], + [7, 10], [7, 10], [7, 10], [7, 10], + [7, 10], [7, 10], [7, 10], [7, 10], + [7, 10], [7, 10], [7, 10], [7, 10], + [7, 10], [7, 10], [7, 10], [7, 10], + [7, 10], [7, 10], [7, 10], [7, 10], + [7, 11], [7, 11], [7, 11], [7, 11], // 0000101xxxxx + [7, 11], [7, 11], [7, 11], [7, 11], + [7, 11], [7, 11], [7, 11], [7, 11], + [7, 11], [7, 11], [7, 11], [7, 11], + [7, 11], [7, 11], [7, 11], [7, 11], + [7, 11], [7, 11], [7, 11], [7, 11], + [7, 11], [7, 11], [7, 11], [7, 11], + [7, 11], [7, 11], [7, 11], [7, 11], + [9, 15], [9, 15], [9, 15], [9, 15], // 000011000xxx + [9, 15], [9, 15], [9, 15], [9, 15], + [12, 128], // 000011001000 + [12, 192], // 000011001001 + [12, 26], // 000011001010 + [12, 27], // 000011001011 + [12, 28], // 000011001100 + [12, 29], // 000011001101 + [11, 19], [11, 19], // 00001100111x + [11, 20], [11, 20], // 00001101000x + [12, 34], // 000011010010 + [12, 35], // 000011010011 + [12, 36], // 000011010100 + [12, 37], // 000011010101 + [12, 38], // 000011010110 + [12, 39], // 000011010111 + [11, 21], [11, 21], // 00001101100x + [12, 42], // 000011011010 + [12, 43], // 000011011011 + [10, 0], [10, 0], [10, 0], [10, 0], // 0000110111xx + [7, 12], [7, 12], [7, 12], [7, 12], // 0000111xxxxx + [7, 12], [7, 12], [7, 12], [7, 12], + [7, 12], [7, 12], [7, 12], [7, 12], + [7, 12], [7, 12], [7, 12], [7, 12], + [7, 12], [7, 12], [7, 12], [7, 12], + [7, 12], [7, 12], [7, 12], [7, 12], + [7, 12], [7, 12], [7, 12], [7, 12], + [7, 12], [7, 12], [7, 12], [7, 12] + ]; + + var blackTable3 = [ + [-1, -1], [-1, -1], [-1, -1], [-1, -1], // 0000xx + [6, 9], // 000100 + [6, 8], // 000101 + [5, 7], [5, 7], // 00011x + [4, 6], [4, 6], [4, 6], [4, 6], // 0010xx + [4, 5], [4, 5], [4, 5], [4, 5], // 0011xx + [3, 1], [3, 1], [3, 1], [3, 1], // 010xxx + [3, 1], [3, 1], [3, 1], [3, 1], + [3, 4], [3, 4], [3, 4], [3, 4], // 011xxx + [3, 4], [3, 4], [3, 4], [3, 4], + [2, 3], [2, 3], [2, 3], [2, 3], // 10xxxx + [2, 3], [2, 3], [2, 3], [2, 3], + [2, 3], [2, 3], [2, 3], [2, 3], + [2, 3], [2, 3], [2, 3], [2, 3], + [2, 2], [2, 2], [2, 2], [2, 2], // 11xxxx + [2, 2], [2, 2], [2, 2], [2, 2], + [2, 2], [2, 2], [2, 2], [2, 2], + [2, 2], [2, 2], [2, 2], [2, 2] + ]; + + function CCITTFaxStream(str, maybeLength, params) { + this.str = str; + this.dict = str.dict; + + params = params || Dict.empty; + + this.encoding = params.get('K') || 0; + this.eoline = params.get('EndOfLine') || false; + this.byteAlign = params.get('EncodedByteAlign') || false; + this.columns = params.get('Columns') || 1728; + this.rows = params.get('Rows') || 0; + var eoblock = params.get('EndOfBlock'); + if (eoblock === null || eoblock === undefined) { + eoblock = true; + } + this.eoblock = eoblock; + this.black = params.get('BlackIs1') || false; + + this.codingLine = new Uint32Array(this.columns + 1); + this.refLine = new Uint32Array(this.columns + 2); + + this.codingLine[0] = this.columns; + this.codingPos = 0; + + this.row = 0; + this.nextLine2D = this.encoding < 0; + this.inputBits = 0; + this.inputBuf = 0; + this.outputBits = 0; + + var code1; + while ((code1 = this.lookBits(12)) === 0) { + this.eatBits(1); + } + if (code1 === 1) { + this.eatBits(12); + } + if (this.encoding > 0) { + this.nextLine2D = !this.lookBits(1); + this.eatBits(1); + } + + DecodeStream.call(this, maybeLength); + } + + CCITTFaxStream.prototype = Object.create(DecodeStream.prototype); + + CCITTFaxStream.prototype.readBlock = function CCITTFaxStream_readBlock() { + while (!this.eof) { + var c = this.lookChar(); + this.ensureBuffer(this.bufferLength + 1); + this.buffer[this.bufferLength++] = c; + } + }; + + CCITTFaxStream.prototype.addPixels = + function ccittFaxStreamAddPixels(a1, blackPixels) { + var codingLine = this.codingLine; + var codingPos = this.codingPos; + + if (a1 > codingLine[codingPos]) { + if (a1 > this.columns) { + info('row is wrong length'); + this.err = true; + a1 = this.columns; + } + if ((codingPos & 1) ^ blackPixels) { + ++codingPos; + } + + codingLine[codingPos] = a1; + } + this.codingPos = codingPos; + }; + + CCITTFaxStream.prototype.addPixelsNeg = + function ccittFaxStreamAddPixelsNeg(a1, blackPixels) { + var codingLine = this.codingLine; + var codingPos = this.codingPos; + + if (a1 > codingLine[codingPos]) { + if (a1 > this.columns) { + info('row is wrong length'); + this.err = true; + a1 = this.columns; + } + if ((codingPos & 1) ^ blackPixels) { + ++codingPos; + } + + codingLine[codingPos] = a1; + } else if (a1 < codingLine[codingPos]) { + if (a1 < 0) { + info('invalid code'); + this.err = true; + a1 = 0; + } + while (codingPos > 0 && a1 < codingLine[codingPos - 1]) { + --codingPos; + } + codingLine[codingPos] = a1; + } + + this.codingPos = codingPos; + }; + + CCITTFaxStream.prototype.lookChar = function CCITTFaxStream_lookChar() { + var refLine = this.refLine; + var codingLine = this.codingLine; + var columns = this.columns; + + var refPos, blackPixels, bits, i; + + if (this.outputBits === 0) { + if (this.eof) { + return null; + } + this.err = false; + + var code1, code2, code3; + if (this.nextLine2D) { + for (i = 0; codingLine[i] < columns; ++i) { + refLine[i] = codingLine[i]; + } + refLine[i++] = columns; + refLine[i] = columns; + codingLine[0] = 0; + this.codingPos = 0; + refPos = 0; + blackPixels = 0; + + while (codingLine[this.codingPos] < columns) { + code1 = this.getTwoDimCode(); + switch (code1) { + case twoDimPass: + this.addPixels(refLine[refPos + 1], blackPixels); + if (refLine[refPos + 1] < columns) { + refPos += 2; + } + break; + case twoDimHoriz: + code1 = code2 = 0; + if (blackPixels) { + do { + code1 += (code3 = this.getBlackCode()); + } while (code3 >= 64); + do { + code2 += (code3 = this.getWhiteCode()); + } while (code3 >= 64); + } else { + do { + code1 += (code3 = this.getWhiteCode()); + } while (code3 >= 64); + do { + code2 += (code3 = this.getBlackCode()); + } while (code3 >= 64); + } + this.addPixels(codingLine[this.codingPos] + + code1, blackPixels); + if (codingLine[this.codingPos] < columns) { + this.addPixels(codingLine[this.codingPos] + code2, + blackPixels ^ 1); + } + while (refLine[refPos] <= codingLine[this.codingPos] && + refLine[refPos] < columns) { + refPos += 2; + } + break; + case twoDimVertR3: + this.addPixels(refLine[refPos] + 3, blackPixels); + blackPixels ^= 1; + if (codingLine[this.codingPos] < columns) { + ++refPos; + while (refLine[refPos] <= codingLine[this.codingPos] && + refLine[refPos] < columns) { + refPos += 2; + } + } + break; + case twoDimVertR2: + this.addPixels(refLine[refPos] + 2, blackPixels); + blackPixels ^= 1; + if (codingLine[this.codingPos] < columns) { + ++refPos; + while (refLine[refPos] <= codingLine[this.codingPos] && + refLine[refPos] < columns) { + refPos += 2; + } + } + break; + case twoDimVertR1: + this.addPixels(refLine[refPos] + 1, blackPixels); + blackPixels ^= 1; + if (codingLine[this.codingPos] < columns) { + ++refPos; + while (refLine[refPos] <= codingLine[this.codingPos] && + refLine[refPos] < columns) { + refPos += 2; + } + } + break; + case twoDimVert0: + this.addPixels(refLine[refPos], blackPixels); + blackPixels ^= 1; + if (codingLine[this.codingPos] < columns) { + ++refPos; + while (refLine[refPos] <= codingLine[this.codingPos] && + refLine[refPos] < columns) { + refPos += 2; + } + } + break; + case twoDimVertL3: + this.addPixelsNeg(refLine[refPos] - 3, blackPixels); + blackPixels ^= 1; + if (codingLine[this.codingPos] < columns) { + if (refPos > 0) { + --refPos; + } else { + ++refPos; + } + while (refLine[refPos] <= codingLine[this.codingPos] && + refLine[refPos] < columns) { + refPos += 2; + } + } + break; + case twoDimVertL2: + this.addPixelsNeg(refLine[refPos] - 2, blackPixels); + blackPixels ^= 1; + if (codingLine[this.codingPos] < columns) { + if (refPos > 0) { + --refPos; + } else { + ++refPos; + } + while (refLine[refPos] <= codingLine[this.codingPos] && + refLine[refPos] < columns) { + refPos += 2; + } + } + break; + case twoDimVertL1: + this.addPixelsNeg(refLine[refPos] - 1, blackPixels); + blackPixels ^= 1; + if (codingLine[this.codingPos] < columns) { + if (refPos > 0) { + --refPos; + } else { + ++refPos; + } + while (refLine[refPos] <= codingLine[this.codingPos] && + refLine[refPos] < columns) { + refPos += 2; + } + } + break; + case EOF: + this.addPixels(columns, 0); + this.eof = true; + break; + default: + info('bad 2d code'); + this.addPixels(columns, 0); + this.err = true; + } + } + } else { + codingLine[0] = 0; + this.codingPos = 0; + blackPixels = 0; + while (codingLine[this.codingPos] < columns) { + code1 = 0; + if (blackPixels) { + do { + code1 += (code3 = this.getBlackCode()); + } while (code3 >= 64); + } else { + do { + code1 += (code3 = this.getWhiteCode()); + } while (code3 >= 64); + } + this.addPixels(codingLine[this.codingPos] + code1, blackPixels); + blackPixels ^= 1; + } + } + + var gotEOL = false; + + if (this.byteAlign) { + this.inputBits &= ~7; + } + + if (!this.eoblock && this.row === this.rows - 1) { + this.eof = true; + } else { + code1 = this.lookBits(12); + if (this.eoline) { + while (code1 !== EOF && code1 !== 1) { + this.eatBits(1); + code1 = this.lookBits(12); + } + } else { + while (code1 === 0) { + this.eatBits(1); + code1 = this.lookBits(12); + } + } + if (code1 === 1) { + this.eatBits(12); + gotEOL = true; + } else if (code1 === EOF) { + this.eof = true; + } + } + + if (!this.eof && this.encoding > 0) { + this.nextLine2D = !this.lookBits(1); + this.eatBits(1); + } + + if (this.eoblock && gotEOL && this.byteAlign) { + code1 = this.lookBits(12); + if (code1 === 1) { + this.eatBits(12); + if (this.encoding > 0) { + this.lookBits(1); + this.eatBits(1); + } + if (this.encoding >= 0) { + for (i = 0; i < 4; ++i) { + code1 = this.lookBits(12); + if (code1 !== 1) { + info('bad rtc code: ' + code1); + } + this.eatBits(12); + if (this.encoding > 0) { + this.lookBits(1); + this.eatBits(1); + } + } + } + this.eof = true; + } + } else if (this.err && this.eoline) { + while (true) { + code1 = this.lookBits(13); + if (code1 === EOF) { + this.eof = true; + return null; + } + if ((code1 >> 1) === 1) { + break; + } + this.eatBits(1); + } + this.eatBits(12); + if (this.encoding > 0) { + this.eatBits(1); + this.nextLine2D = !(code1 & 1); + } + } + + if (codingLine[0] > 0) { + this.outputBits = codingLine[this.codingPos = 0]; + } else { + this.outputBits = codingLine[this.codingPos = 1]; + } + this.row++; + } + + var c; + if (this.outputBits >= 8) { + c = (this.codingPos & 1) ? 0 : 0xFF; + this.outputBits -= 8; + if (this.outputBits === 0 && codingLine[this.codingPos] < columns) { + this.codingPos++; + this.outputBits = (codingLine[this.codingPos] - + codingLine[this.codingPos - 1]); + } + } else { + bits = 8; + c = 0; + do { + if (this.outputBits > bits) { + c <<= bits; + if (!(this.codingPos & 1)) { + c |= 0xFF >> (8 - bits); + } + this.outputBits -= bits; + bits = 0; + } else { + c <<= this.outputBits; + if (!(this.codingPos & 1)) { + c |= 0xFF >> (8 - this.outputBits); + } + bits -= this.outputBits; + this.outputBits = 0; + if (codingLine[this.codingPos] < columns) { + this.codingPos++; + this.outputBits = (codingLine[this.codingPos] - + codingLine[this.codingPos - 1]); + } else if (bits > 0) { + c <<= bits; + bits = 0; + } + } + } while (bits); + } + if (this.black) { + c ^= 0xFF; + } + return c; + }; + + // This functions returns the code found from the table. + // The start and end parameters set the boundaries for searching the table. + // The limit parameter is optional. Function returns an array with three + // values. The first array element indicates whether a valid code is being + // returned. The second array element is the actual code. The third array + // element indicates whether EOF was reached. + CCITTFaxStream.prototype.findTableCode = + function ccittFaxStreamFindTableCode(start, end, table, limit) { + + var limitValue = limit || 0; + for (var i = start; i <= end; ++i) { + var code = this.lookBits(i); + if (code === EOF) { + return [true, 1, false]; + } + if (i < end) { + code <<= end - i; + } + if (!limitValue || code >= limitValue) { + var p = table[code - limitValue]; + if (p[0] === i) { + this.eatBits(i); + return [true, p[1], true]; + } + } + } + return [false, 0, false]; + }; + + CCITTFaxStream.prototype.getTwoDimCode = + function ccittFaxStreamGetTwoDimCode() { + + var code = 0; + var p; + if (this.eoblock) { + code = this.lookBits(7); + p = twoDimTable[code]; + if (p && p[0] > 0) { + this.eatBits(p[0]); + return p[1]; + } + } else { + var result = this.findTableCode(1, 7, twoDimTable); + if (result[0] && result[2]) { + return result[1]; + } + } + info('Bad two dim code'); + return EOF; + }; + + CCITTFaxStream.prototype.getWhiteCode = + function ccittFaxStreamGetWhiteCode() { + + var code = 0; + var p; + if (this.eoblock) { + code = this.lookBits(12); + if (code === EOF) { + return 1; + } + + if ((code >> 5) === 0) { + p = whiteTable1[code]; + } else { + p = whiteTable2[code >> 3]; + } + + if (p[0] > 0) { + this.eatBits(p[0]); + return p[1]; + } + } else { + var result = this.findTableCode(1, 9, whiteTable2); + if (result[0]) { + return result[1]; + } + + result = this.findTableCode(11, 12, whiteTable1); + if (result[0]) { + return result[1]; + } + } + info('bad white code'); + this.eatBits(1); + return 1; + }; + + CCITTFaxStream.prototype.getBlackCode = + function ccittFaxStreamGetBlackCode() { + + var code, p; + if (this.eoblock) { + code = this.lookBits(13); + if (code === EOF) { + return 1; + } + if ((code >> 7) === 0) { + p = blackTable1[code]; + } else if ((code >> 9) === 0 && (code >> 7) !== 0) { + p = blackTable2[(code >> 1) - 64]; + } else { + p = blackTable3[code >> 7]; + } + + if (p[0] > 0) { + this.eatBits(p[0]); + return p[1]; + } + } else { + var result = this.findTableCode(2, 6, blackTable3); + if (result[0]) { + return result[1]; + } + + result = this.findTableCode(7, 12, blackTable2, 64); + if (result[0]) { + return result[1]; + } + + result = this.findTableCode(10, 13, blackTable1); + if (result[0]) { + return result[1]; + } + } + info('bad black code'); + this.eatBits(1); + return 1; + }; + + CCITTFaxStream.prototype.lookBits = function CCITTFaxStream_lookBits(n) { + var c; + while (this.inputBits < n) { + if ((c = this.str.getByte()) === -1) { + if (this.inputBits === 0) { + return EOF; + } + return ((this.inputBuf << (n - this.inputBits)) & + (0xFFFF >> (16 - n))); + } + this.inputBuf = (this.inputBuf << 8) + c; + this.inputBits += 8; + } + return (this.inputBuf >> (this.inputBits - n)) & (0xFFFF >> (16 - n)); + }; + + CCITTFaxStream.prototype.eatBits = function CCITTFaxStream_eatBits(n) { + if ((this.inputBits -= n) < 0) { + this.inputBits = 0; + } + }; + + return CCITTFaxStream; +})(); + +var LZWStream = (function LZWStreamClosure() { + function LZWStream(str, maybeLength, earlyChange) { + this.str = str; + this.dict = str.dict; + this.cachedData = 0; + this.bitsCached = 0; + + var maxLzwDictionarySize = 4096; + var lzwState = { + earlyChange: earlyChange, + codeLength: 9, + nextCode: 258, + dictionaryValues: new Uint8Array(maxLzwDictionarySize), + dictionaryLengths: new Uint16Array(maxLzwDictionarySize), + dictionaryPrevCodes: new Uint16Array(maxLzwDictionarySize), + currentSequence: new Uint8Array(maxLzwDictionarySize), + currentSequenceLength: 0 + }; + for (var i = 0; i < 256; ++i) { + lzwState.dictionaryValues[i] = i; + lzwState.dictionaryLengths[i] = 1; + } + this.lzwState = lzwState; + + DecodeStream.call(this, maybeLength); + } + + LZWStream.prototype = Object.create(DecodeStream.prototype); + + LZWStream.prototype.readBits = function LZWStream_readBits(n) { + var bitsCached = this.bitsCached; + var cachedData = this.cachedData; + while (bitsCached < n) { + var c = this.str.getByte(); + if (c === -1) { + this.eof = true; + return null; + } + cachedData = (cachedData << 8) | c; + bitsCached += 8; + } + this.bitsCached = (bitsCached -= n); + this.cachedData = cachedData; + this.lastCode = null; + return (cachedData >>> bitsCached) & ((1 << n) - 1); + }; + + LZWStream.prototype.readBlock = function LZWStream_readBlock() { + var blockSize = 512; + var estimatedDecodedSize = blockSize * 2, decodedSizeDelta = blockSize; + var i, j, q; + + var lzwState = this.lzwState; + if (!lzwState) { + return; // eof was found + } + + var earlyChange = lzwState.earlyChange; + var nextCode = lzwState.nextCode; + var dictionaryValues = lzwState.dictionaryValues; + var dictionaryLengths = lzwState.dictionaryLengths; + var dictionaryPrevCodes = lzwState.dictionaryPrevCodes; + var codeLength = lzwState.codeLength; + var prevCode = lzwState.prevCode; + var currentSequence = lzwState.currentSequence; + var currentSequenceLength = lzwState.currentSequenceLength; + + var decodedLength = 0; + var currentBufferLength = this.bufferLength; + var buffer = this.ensureBuffer(this.bufferLength + estimatedDecodedSize); + + for (i = 0; i < blockSize; i++) { + var code = this.readBits(codeLength); + var hasPrev = currentSequenceLength > 0; + if (code < 256) { + currentSequence[0] = code; + currentSequenceLength = 1; + } else if (code >= 258) { + if (code < nextCode) { + currentSequenceLength = dictionaryLengths[code]; + for (j = currentSequenceLength - 1, q = code; j >= 0; j--) { + currentSequence[j] = dictionaryValues[q]; + q = dictionaryPrevCodes[q]; + } + } else { + currentSequence[currentSequenceLength++] = currentSequence[0]; + } + } else if (code === 256) { + codeLength = 9; + nextCode = 258; + currentSequenceLength = 0; + continue; + } else { + this.eof = true; + delete this.lzwState; + break; + } + + if (hasPrev) { + dictionaryPrevCodes[nextCode] = prevCode; + dictionaryLengths[nextCode] = dictionaryLengths[prevCode] + 1; + dictionaryValues[nextCode] = currentSequence[0]; + nextCode++; + codeLength = (nextCode + earlyChange) & (nextCode + earlyChange - 1) ? + codeLength : Math.min(Math.log(nextCode + earlyChange) / + 0.6931471805599453 + 1, 12) | 0; + } + prevCode = code; + + decodedLength += currentSequenceLength; + if (estimatedDecodedSize < decodedLength) { + do { + estimatedDecodedSize += decodedSizeDelta; + } while (estimatedDecodedSize < decodedLength); + buffer = this.ensureBuffer(this.bufferLength + estimatedDecodedSize); + } + for (j = 0; j < currentSequenceLength; j++) { + buffer[currentBufferLength++] = currentSequence[j]; + } + } + lzwState.nextCode = nextCode; + lzwState.codeLength = codeLength; + lzwState.prevCode = prevCode; + lzwState.currentSequenceLength = currentSequenceLength; + + this.bufferLength = currentBufferLength; + }; + + return LZWStream; +})(); + +var NullStream = (function NullStreamClosure() { + function NullStream() { + Stream.call(this, new Uint8Array(0)); + } + + NullStream.prototype = Stream.prototype; + + return NullStream; +})(); + + +var WorkerTask = (function WorkerTaskClosure() { + function WorkerTask(name) { + this.name = name; + this.terminated = false; + this._capability = createPromiseCapability(); + } + + WorkerTask.prototype = { + get finished() { + return this._capability.promise; + }, + + finish: function () { + this._capability.resolve(); + }, + + terminate: function () { + this.terminated = true; + }, + + ensureNotTerminated: function () { + if (this.terminated) { + throw new Error('Worker task was terminated'); + } + } + }; + + return WorkerTask; +})(); + +var WorkerMessageHandler = PDFJS.WorkerMessageHandler = { + setup: function wphSetup(handler) { + var pdfManager; + var terminated = false; + var cancelXHRs = null; + var WorkerTasks = []; + + function ensureNotTerminated() { + if (terminated) { + throw new Error('Worker was terminated'); + } + } + + function startWorkerTask(task) { + WorkerTasks.push(task); + } + + function finishWorkerTask(task) { + task.finish(); + var i = WorkerTasks.indexOf(task); + WorkerTasks.splice(i, 1); + } + + function loadDocument(recoveryMode) { + var loadDocumentCapability = createPromiseCapability(); + + var parseSuccess = function parseSuccess() { + var numPagesPromise = pdfManager.ensureDoc('numPages'); + var fingerprintPromise = pdfManager.ensureDoc('fingerprint'); + var encryptedPromise = pdfManager.ensureXRef('encrypt'); + Promise.all([numPagesPromise, fingerprintPromise, + encryptedPromise]).then(function onDocReady(results) { + var doc = { + numPages: results[0], + fingerprint: results[1], + encrypted: !!results[2], + }; + loadDocumentCapability.resolve(doc); + }, + parseFailure); + }; + + var parseFailure = function parseFailure(e) { + loadDocumentCapability.reject(e); + }; + + pdfManager.ensureDoc('checkHeader', []).then(function() { + pdfManager.ensureDoc('parseStartXRef', []).then(function() { + pdfManager.ensureDoc('parse', [recoveryMode]).then( + parseSuccess, parseFailure); + }, parseFailure); + }, parseFailure); + + return loadDocumentCapability.promise; + } + + function getPdfManager(data) { + var pdfManagerCapability = createPromiseCapability(); + var pdfManager; + + var source = data.source; + var disableRange = data.disableRange; + if (source.data) { + try { + pdfManager = new LocalPdfManager(source.data, source.password); + pdfManagerCapability.resolve(pdfManager); + } catch (ex) { + pdfManagerCapability.reject(ex); + } + return pdfManagerCapability.promise; + } else if (source.chunkedViewerLoading) { + try { + pdfManager = new NetworkPdfManager(source, handler); + pdfManagerCapability.resolve(pdfManager); + } catch (ex) { + pdfManagerCapability.reject(ex); + } + return pdfManagerCapability.promise; + } + + var networkManager = new NetworkManager(source.url, { + httpHeaders: source.httpHeaders, + withCredentials: source.withCredentials + }); + var cachedChunks = []; + var fullRequestXhrId = networkManager.requestFull({ + onHeadersReceived: function onHeadersReceived() { + if (disableRange) { + return; + } + + var fullRequestXhr = networkManager.getRequestXhr(fullRequestXhrId); + if (fullRequestXhr.getResponseHeader('Accept-Ranges') !== 'bytes') { + return; + } + + var contentEncoding = + fullRequestXhr.getResponseHeader('Content-Encoding') || 'identity'; + if (contentEncoding !== 'identity') { + return; + } + + var length = fullRequestXhr.getResponseHeader('Content-Length'); + length = parseInt(length, 10); + if (!isInt(length)) { + return; + } + source.length = length; + if (length <= 2 * RANGE_CHUNK_SIZE) { + // The file size is smaller than the size of two chunks, so it does + // not make any sense to abort the request and retry with a range + // request. + return; + } + + if (networkManager.isStreamingRequest(fullRequestXhrId)) { + // We can continue fetching when progressive loading is enabled, + // and we don't need the autoFetch feature. + source.disableAutoFetch = true; + } else { + // NOTE: by cancelling the full request, and then issuing range + // requests, there will be an issue for sites where you can only + // request the pdf once. However, if this is the case, then the + // server should not be returning that it can support range + // requests. + networkManager.abortRequest(fullRequestXhrId); + } + + try { + pdfManager = new NetworkPdfManager(source, handler); + pdfManagerCapability.resolve(pdfManager); + } catch (ex) { + pdfManagerCapability.reject(ex); + } + cancelXHRs = null; + }, + + onProgressiveData: source.disableStream ? null : + function onProgressiveData(chunk) { + if (!pdfManager) { + cachedChunks.push(chunk); + return; + } + pdfManager.sendProgressiveData(chunk); + }, + + onDone: function onDone(args) { + if (pdfManager) { + return; // already processed + } + + var pdfFile; + if (args === null) { + // TODO add some streaming manager, e.g. for unknown length files. + // The data was returned in the onProgressiveData, combining... + var pdfFileLength = 0, pos = 0; + cachedChunks.forEach(function (chunk) { + pdfFileLength += chunk.byteLength; + }); + if (source.length && pdfFileLength !== source.length) { + warn('reported HTTP length is different from actual'); + } + var pdfFileArray = new Uint8Array(pdfFileLength); + cachedChunks.forEach(function (chunk) { + pdfFileArray.set(new Uint8Array(chunk), pos); + pos += chunk.byteLength; + }); + pdfFile = pdfFileArray.buffer; + } else { + pdfFile = args.chunk; + } + + // the data is array, instantiating directly from it + try { + pdfManager = new LocalPdfManager(pdfFile, source.password); + pdfManagerCapability.resolve(pdfManager); + } catch (ex) { + pdfManagerCapability.reject(ex); + } + cancelXHRs = null; + }, + + onError: function onError(status) { + var exception; + if (status === 404) { + exception = new MissingPDFException('Missing PDF "' + + source.url + '".'); + handler.send('MissingPDF', exception); + } else { + exception = new UnexpectedResponseException( + 'Unexpected server response (' + status + + ') while retrieving PDF "' + source.url + '".', status); + handler.send('UnexpectedResponse', exception); + } + cancelXHRs = null; + }, + + onProgress: function onProgress(evt) { + handler.send('DocProgress', { + loaded: evt.loaded, + total: evt.lengthComputable ? evt.total : source.length + }); + } + }); + + cancelXHRs = function () { + networkManager.abortRequest(fullRequestXhrId); + }; + + return pdfManagerCapability.promise; + } + + handler.on('test', function wphSetupTest(data) { + // check if Uint8Array can be sent to worker + if (!(data instanceof Uint8Array)) { + handler.send('test', false); + return; + } + // making sure postMessage transfers are working + var supportTransfers = data[0] === 255; + handler.postMessageTransfers = supportTransfers; + // check if the response property is supported by xhr + var xhr = new XMLHttpRequest(); + var responseExists = 'response' in xhr; + // check if the property is actually implemented + try { + var dummy = xhr.responseType; + } catch (e) { + responseExists = false; + } + if (!responseExists) { + handler.send('test', false); + return; + } + handler.send('test', { + supportTypedArray: true, + supportTransfers: supportTransfers + }); + }); + + handler.on('GetDocRequest', function wphSetupDoc(data) { + var onSuccess = function(doc) { + ensureNotTerminated(); + handler.send('GetDoc', { pdfInfo: doc }); + }; + + var onFailure = function(e) { + if (e instanceof PasswordException) { + if (e.code === PasswordResponses.NEED_PASSWORD) { + handler.send('NeedPassword', e); + } else if (e.code === PasswordResponses.INCORRECT_PASSWORD) { + handler.send('IncorrectPassword', e); + } + } else if (e instanceof InvalidPDFException) { + handler.send('InvalidPDF', e); + } else if (e instanceof MissingPDFException) { + handler.send('MissingPDF', e); + } else if (e instanceof UnexpectedResponseException) { + handler.send('UnexpectedResponse', e); + } else { + handler.send('UnknownError', + new UnknownErrorException(e.message, e.toString())); + } + }; + + ensureNotTerminated(); + + PDFJS.maxImageSize = data.maxImageSize === undefined ? + -1 : data.maxImageSize; + PDFJS.disableFontFace = data.disableFontFace; + PDFJS.disableCreateObjectURL = data.disableCreateObjectURL; + PDFJS.verbosity = data.verbosity; + PDFJS.cMapUrl = data.cMapUrl === undefined ? + null : data.cMapUrl; + PDFJS.cMapPacked = data.cMapPacked === true; + + getPdfManager(data).then(function (newPdfManager) { + if (terminated) { + // We were in a process of setting up the manager, but it got + // terminated in the middle. + newPdfManager.terminate(); + throw new Error('Worker was terminated'); + } + + pdfManager = newPdfManager; + + handler.send('PDFManagerReady', null); + pdfManager.onLoadedStream().then(function(stream) { + handler.send('DataLoaded', { length: stream.bytes.byteLength }); + }); + }).then(function pdfManagerReady() { + ensureNotTerminated(); + + loadDocument(false).then(onSuccess, function loadFailure(ex) { + ensureNotTerminated(); + + // Try again with recoveryMode == true + if (!(ex instanceof XRefParseException)) { + if (ex instanceof PasswordException) { + // after password exception prepare to receive a new password + // to repeat loading + pdfManager.passwordChanged().then(pdfManagerReady); + } + + onFailure(ex); + return; + } + + pdfManager.requestLoadedStream(); + pdfManager.onLoadedStream().then(function() { + ensureNotTerminated(); + + loadDocument(true).then(onSuccess, onFailure); + }); + }, onFailure); + }, onFailure); + }); + + handler.on('GetPage', function wphSetupGetPage(data) { + return pdfManager.getPage(data.pageIndex).then(function(page) { + var rotatePromise = pdfManager.ensure(page, 'rotate'); + var refPromise = pdfManager.ensure(page, 'ref'); + var viewPromise = pdfManager.ensure(page, 'view'); + + return Promise.all([rotatePromise, refPromise, viewPromise]).then( + function(results) { + return { + rotate: results[0], + ref: results[1], + view: results[2] + }; + }); + }); + }); + + handler.on('GetPageIndex', function wphSetupGetPageIndex(data) { + var ref = new Ref(data.ref.num, data.ref.gen); + var catalog = pdfManager.pdfDocument.catalog; + return catalog.getPageIndex(ref); + }); + + handler.on('GetDestinations', + function wphSetupGetDestinations(data) { + return pdfManager.ensureCatalog('destinations'); + } + ); + + handler.on('GetDestination', + function wphSetupGetDestination(data) { + return pdfManager.ensureCatalog('getDestination', [ data.id ]); + } + ); + + handler.on('GetAttachments', + function wphSetupGetAttachments(data) { + return pdfManager.ensureCatalog('attachments'); + } + ); + + handler.on('GetJavaScript', + function wphSetupGetJavaScript(data) { + return pdfManager.ensureCatalog('javaScript'); + } + ); + + handler.on('GetOutline', + function wphSetupGetOutline(data) { + return pdfManager.ensureCatalog('documentOutline'); + } + ); + + handler.on('GetMetadata', + function wphSetupGetMetadata(data) { + return Promise.all([pdfManager.ensureDoc('documentInfo'), + pdfManager.ensureCatalog('metadata')]); + } + ); + + handler.on('GetData', function wphSetupGetData(data) { + pdfManager.requestLoadedStream(); + return pdfManager.onLoadedStream().then(function(stream) { + return stream.bytes; + }); + }); + + handler.on('GetStats', + function wphSetupGetStats(data) { + return pdfManager.pdfDocument.xref.stats; + } + ); + + handler.on('UpdatePassword', function wphSetupUpdatePassword(data) { + pdfManager.updatePassword(data); + }); + + handler.on('GetAnnotations', function wphSetupGetAnnotations(data) { + return pdfManager.getPage(data.pageIndex).then(function(page) { + return pdfManager.ensure(page, 'getAnnotationsData', []); + }); + }); + + handler.on('RenderPageRequest', function wphSetupRenderPage(data) { + var pageIndex = data.pageIndex; + pdfManager.getPage(pageIndex).then(function(page) { + var task = new WorkerTask('RenderPageRequest: page ' + pageIndex); + startWorkerTask(task); + + var pageNum = pageIndex + 1; + var start = Date.now(); + // Pre compile the pdf page and fetch the fonts/images. + page.getOperatorList(handler, task, data.intent).then( + function(operatorList) { + finishWorkerTask(task); + + info('page=' + pageNum + ' - getOperatorList: time=' + + (Date.now() - start) + 'ms, len=' + operatorList.fnArray.length); + }, function(e) { + finishWorkerTask(task); + if (task.terminated) { + return; // ignoring errors from the terminated thread + } + + var minimumStackMessage = + 'worker.js: while trying to getPage() and getOperatorList()'; + + var wrappedException; + + // Turn the error into an obj that can be serialized + if (typeof e === 'string') { + wrappedException = { + message: e, + stack: minimumStackMessage + }; + } else if (typeof e === 'object') { + wrappedException = { + message: e.message || e.toString(), + stack: e.stack || minimumStackMessage + }; + } else { + wrappedException = { + message: 'Unknown exception type: ' + (typeof e), + stack: minimumStackMessage + }; + } + + handler.send('PageError', { + pageNum: pageNum, + error: wrappedException, + intent: data.intent + }); + }); + }); + }, this); + + handler.on('GetTextContent', function wphExtractText(data) { + var pageIndex = data.pageIndex; + return pdfManager.getPage(pageIndex).then(function(page) { + var task = new WorkerTask('GetTextContent: page ' + pageIndex); + startWorkerTask(task); + var pageNum = pageIndex + 1; + var start = Date.now(); + return page.extractTextContent(task).then(function(textContent) { + finishWorkerTask(task); + info('text indexing: page=' + pageNum + ' - time=' + + (Date.now() - start) + 'ms'); + return textContent; + }, function (reason) { + finishWorkerTask(task); + if (task.terminated) { + return; // ignoring errors from the terminated thread + } + throw reason; + }); + }); + }); + + handler.on('Cleanup', function wphCleanup(data) { + return pdfManager.cleanup(); + }); + + handler.on('Terminate', function wphTerminate(data) { + terminated = true; + if (pdfManager) { + pdfManager.terminate(); + pdfManager = null; + } + if (cancelXHRs) { + cancelXHRs(); + } + + var waitOn = []; + WorkerTasks.forEach(function (task) { + waitOn.push(task.finished); + task.terminate(); + }); + + return Promise.all(waitOn).then(function () {}); + }); + } +}; + +var consoleTimer = {}; + +var workerConsole = { + log: function log() { + var args = Array.prototype.slice.call(arguments); + globalScope.postMessage({ + action: 'console_log', + data: args + }); + }, + + error: function error() { + var args = Array.prototype.slice.call(arguments); + globalScope.postMessage({ + action: 'console_error', + data: args + }); + throw 'pdf.js execution error'; + }, + + time: function time(name) { + consoleTimer[name] = Date.now(); + }, + + timeEnd: function timeEnd(name) { + var time = consoleTimer[name]; + if (!time) { + error('Unknown timer name ' + name); + } + this.log('Timer:', name, Date.now() - time); + } +}; + + +// Worker thread? +if (typeof window === 'undefined') { + if (!('console' in globalScope)) { + globalScope.console = workerConsole; + } + + // Listen for unsupported features so we can pass them on to the main thread. + PDFJS.UnsupportedManager.listen(function (msg) { + globalScope.postMessage({ + action: '_unsupported_feature', + data: msg + }); + }); + + var handler = new MessageHandler('worker_processor', this); + WorkerMessageHandler.setup(handler); +} + + +/* This class implements the QM Coder decoding as defined in + * JPEG 2000 Part I Final Committee Draft Version 1.0 + * Annex C.3 Arithmetic decoding procedure + * available at http://www.jpeg.org/public/fcd15444-1.pdf + * + * The arithmetic decoder is used in conjunction with context models to decode + * JPEG2000 and JBIG2 streams. + */ +var ArithmeticDecoder = (function ArithmeticDecoderClosure() { + // Table C-2 + var QeTable = [ + {qe: 0x5601, nmps: 1, nlps: 1, switchFlag: 1}, + {qe: 0x3401, nmps: 2, nlps: 6, switchFlag: 0}, + {qe: 0x1801, nmps: 3, nlps: 9, switchFlag: 0}, + {qe: 0x0AC1, nmps: 4, nlps: 12, switchFlag: 0}, + {qe: 0x0521, nmps: 5, nlps: 29, switchFlag: 0}, + {qe: 0x0221, nmps: 38, nlps: 33, switchFlag: 0}, + {qe: 0x5601, nmps: 7, nlps: 6, switchFlag: 1}, + {qe: 0x5401, nmps: 8, nlps: 14, switchFlag: 0}, + {qe: 0x4801, nmps: 9, nlps: 14, switchFlag: 0}, + {qe: 0x3801, nmps: 10, nlps: 14, switchFlag: 0}, + {qe: 0x3001, nmps: 11, nlps: 17, switchFlag: 0}, + {qe: 0x2401, nmps: 12, nlps: 18, switchFlag: 0}, + {qe: 0x1C01, nmps: 13, nlps: 20, switchFlag: 0}, + {qe: 0x1601, nmps: 29, nlps: 21, switchFlag: 0}, + {qe: 0x5601, nmps: 15, nlps: 14, switchFlag: 1}, + {qe: 0x5401, nmps: 16, nlps: 14, switchFlag: 0}, + {qe: 0x5101, nmps: 17, nlps: 15, switchFlag: 0}, + {qe: 0x4801, nmps: 18, nlps: 16, switchFlag: 0}, + {qe: 0x3801, nmps: 19, nlps: 17, switchFlag: 0}, + {qe: 0x3401, nmps: 20, nlps: 18, switchFlag: 0}, + {qe: 0x3001, nmps: 21, nlps: 19, switchFlag: 0}, + {qe: 0x2801, nmps: 22, nlps: 19, switchFlag: 0}, + {qe: 0x2401, nmps: 23, nlps: 20, switchFlag: 0}, + {qe: 0x2201, nmps: 24, nlps: 21, switchFlag: 0}, + {qe: 0x1C01, nmps: 25, nlps: 22, switchFlag: 0}, + {qe: 0x1801, nmps: 26, nlps: 23, switchFlag: 0}, + {qe: 0x1601, nmps: 27, nlps: 24, switchFlag: 0}, + {qe: 0x1401, nmps: 28, nlps: 25, switchFlag: 0}, + {qe: 0x1201, nmps: 29, nlps: 26, switchFlag: 0}, + {qe: 0x1101, nmps: 30, nlps: 27, switchFlag: 0}, + {qe: 0x0AC1, nmps: 31, nlps: 28, switchFlag: 0}, + {qe: 0x09C1, nmps: 32, nlps: 29, switchFlag: 0}, + {qe: 0x08A1, nmps: 33, nlps: 30, switchFlag: 0}, + {qe: 0x0521, nmps: 34, nlps: 31, switchFlag: 0}, + {qe: 0x0441, nmps: 35, nlps: 32, switchFlag: 0}, + {qe: 0x02A1, nmps: 36, nlps: 33, switchFlag: 0}, + {qe: 0x0221, nmps: 37, nlps: 34, switchFlag: 0}, + {qe: 0x0141, nmps: 38, nlps: 35, switchFlag: 0}, + {qe: 0x0111, nmps: 39, nlps: 36, switchFlag: 0}, + {qe: 0x0085, nmps: 40, nlps: 37, switchFlag: 0}, + {qe: 0x0049, nmps: 41, nlps: 38, switchFlag: 0}, + {qe: 0x0025, nmps: 42, nlps: 39, switchFlag: 0}, + {qe: 0x0015, nmps: 43, nlps: 40, switchFlag: 0}, + {qe: 0x0009, nmps: 44, nlps: 41, switchFlag: 0}, + {qe: 0x0005, nmps: 45, nlps: 42, switchFlag: 0}, + {qe: 0x0001, nmps: 45, nlps: 43, switchFlag: 0}, + {qe: 0x5601, nmps: 46, nlps: 46, switchFlag: 0} + ]; + + // C.3.5 Initialisation of the decoder (INITDEC) + function ArithmeticDecoder(data, start, end) { + this.data = data; + this.bp = start; + this.dataEnd = end; + + this.chigh = data[start]; + this.clow = 0; + + this.byteIn(); + + this.chigh = ((this.chigh << 7) & 0xFFFF) | ((this.clow >> 9) & 0x7F); + this.clow = (this.clow << 7) & 0xFFFF; + this.ct -= 7; + this.a = 0x8000; + } + + ArithmeticDecoder.prototype = { + // C.3.4 Compressed data input (BYTEIN) + byteIn: function ArithmeticDecoder_byteIn() { + var data = this.data; + var bp = this.bp; + if (data[bp] === 0xFF) { + var b1 = data[bp + 1]; + if (b1 > 0x8F) { + this.clow += 0xFF00; + this.ct = 8; + } else { + bp++; + this.clow += (data[bp] << 9); + this.ct = 7; + this.bp = bp; + } + } else { + bp++; + this.clow += bp < this.dataEnd ? (data[bp] << 8) : 0xFF00; + this.ct = 8; + this.bp = bp; + } + if (this.clow > 0xFFFF) { + this.chigh += (this.clow >> 16); + this.clow &= 0xFFFF; + } + }, + // C.3.2 Decoding a decision (DECODE) + readBit: function ArithmeticDecoder_readBit(contexts, pos) { + // contexts are packed into 1 byte: + // highest 7 bits carry cx.index, lowest bit carries cx.mps + var cx_index = contexts[pos] >> 1, cx_mps = contexts[pos] & 1; + var qeTableIcx = QeTable[cx_index]; + var qeIcx = qeTableIcx.qe; + var d; + var a = this.a - qeIcx; + + if (this.chigh < qeIcx) { + // exchangeLps + if (a < qeIcx) { + a = qeIcx; + d = cx_mps; + cx_index = qeTableIcx.nmps; + } else { + a = qeIcx; + d = 1 ^ cx_mps; + if (qeTableIcx.switchFlag === 1) { + cx_mps = d; + } + cx_index = qeTableIcx.nlps; + } + } else { + this.chigh -= qeIcx; + if ((a & 0x8000) !== 0) { + this.a = a; + return cx_mps; + } + // exchangeMps + if (a < qeIcx) { + d = 1 ^ cx_mps; + if (qeTableIcx.switchFlag === 1) { + cx_mps = d; + } + cx_index = qeTableIcx.nlps; + } else { + d = cx_mps; + cx_index = qeTableIcx.nmps; + } + } + // C.3.3 renormD; + do { + if (this.ct === 0) { + this.byteIn(); + } + + a <<= 1; + this.chigh = ((this.chigh << 1) & 0xFFFF) | ((this.clow >> 15) & 1); + this.clow = (this.clow << 1) & 0xFFFF; + this.ct--; + } while ((a & 0x8000) === 0); + this.a = a; + + contexts[pos] = cx_index << 1 | cx_mps; + return d; + } + }; + + return ArithmeticDecoder; +})(); + + +var JpegImage = (function jpegImage() { + var dctZigZag = new Uint8Array([ + 0, + 1, 8, + 16, 9, 2, + 3, 10, 17, 24, + 32, 25, 18, 11, 4, + 5, 12, 19, 26, 33, 40, + 48, 41, 34, 27, 20, 13, 6, + 7, 14, 21, 28, 35, 42, 49, 56, + 57, 50, 43, 36, 29, 22, 15, + 23, 30, 37, 44, 51, 58, + 59, 52, 45, 38, 31, + 39, 46, 53, 60, + 61, 54, 47, + 55, 62, + 63 + ]); + + var dctCos1 = 4017; // cos(pi/16) + var dctSin1 = 799; // sin(pi/16) + var dctCos3 = 3406; // cos(3*pi/16) + var dctSin3 = 2276; // sin(3*pi/16) + var dctCos6 = 1567; // cos(6*pi/16) + var dctSin6 = 3784; // sin(6*pi/16) + var dctSqrt2 = 5793; // sqrt(2) + var dctSqrt1d2 = 2896; // sqrt(2) / 2 + + function constructor() { + } + + function buildHuffmanTable(codeLengths, values) { + var k = 0, code = [], i, j, length = 16; + while (length > 0 && !codeLengths[length - 1]) { + length--; + } + code.push({children: [], index: 0}); + var p = code[0], q; + for (i = 0; i < length; i++) { + for (j = 0; j < codeLengths[i]; j++) { + p = code.pop(); + p.children[p.index] = values[k]; + while (p.index > 0) { + p = code.pop(); + } + p.index++; + code.push(p); + while (code.length <= i) { + code.push(q = {children: [], index: 0}); + p.children[p.index] = q.children; + p = q; + } + k++; + } + if (i + 1 < length) { + // p here points to last code + code.push(q = {children: [], index: 0}); + p.children[p.index] = q.children; + p = q; + } + } + return code[0].children; + } + + function getBlockBufferOffset(component, row, col) { + return 64 * ((component.blocksPerLine + 1) * row + col); + } + + function decodeScan(data, offset, frame, components, resetInterval, + spectralStart, spectralEnd, successivePrev, successive) { + var precision = frame.precision; + var samplesPerLine = frame.samplesPerLine; + var scanLines = frame.scanLines; + var mcusPerLine = frame.mcusPerLine; + var progressive = frame.progressive; + var maxH = frame.maxH, maxV = frame.maxV; + + var startOffset = offset, bitsData = 0, bitsCount = 0; + + function readBit() { + if (bitsCount > 0) { + bitsCount--; + return (bitsData >> bitsCount) & 1; + } + bitsData = data[offset++]; + if (bitsData === 0xFF) { + var nextByte = data[offset++]; + if (nextByte) { + throw 'unexpected marker: ' + + ((bitsData << 8) | nextByte).toString(16); + } + // unstuff 0 + } + bitsCount = 7; + return bitsData >>> 7; + } + + function decodeHuffman(tree) { + var node = tree; + while (true) { + node = node[readBit()]; + if (typeof node === 'number') { + return node; + } + if (typeof node !== 'object') { + throw 'invalid huffman sequence'; + } + } + } + + function receive(length) { + var n = 0; + while (length > 0) { + n = (n << 1) | readBit(); + length--; + } + return n; + } + + function receiveAndExtend(length) { + if (length === 1) { + return readBit() === 1 ? 1 : -1; + } + var n = receive(length); + if (n >= 1 << (length - 1)) { + return n; + } + return n + (-1 << length) + 1; + } + + function decodeBaseline(component, offset) { + var t = decodeHuffman(component.huffmanTableDC); + var diff = t === 0 ? 0 : receiveAndExtend(t); + component.blockData[offset] = (component.pred += diff); + var k = 1; + while (k < 64) { + var rs = decodeHuffman(component.huffmanTableAC); + var s = rs & 15, r = rs >> 4; + if (s === 0) { + if (r < 15) { + break; + } + k += 16; + continue; + } + k += r; + var z = dctZigZag[k]; + component.blockData[offset + z] = receiveAndExtend(s); + k++; + } + } + + function decodeDCFirst(component, offset) { + var t = decodeHuffman(component.huffmanTableDC); + var diff = t === 0 ? 0 : (receiveAndExtend(t) << successive); + component.blockData[offset] = (component.pred += diff); + } + + function decodeDCSuccessive(component, offset) { + component.blockData[offset] |= readBit() << successive; + } + + var eobrun = 0; + function decodeACFirst(component, offset) { + if (eobrun > 0) { + eobrun--; + return; + } + var k = spectralStart, e = spectralEnd; + while (k <= e) { + var rs = decodeHuffman(component.huffmanTableAC); + var s = rs & 15, r = rs >> 4; + if (s === 0) { + if (r < 15) { + eobrun = receive(r) + (1 << r) - 1; + break; + } + k += 16; + continue; + } + k += r; + var z = dctZigZag[k]; + component.blockData[offset + z] = + receiveAndExtend(s) * (1 << successive); + k++; + } + } + + var successiveACState = 0, successiveACNextValue; + function decodeACSuccessive(component, offset) { + var k = spectralStart; + var e = spectralEnd; + var r = 0; + var s; + var rs; + while (k <= e) { + var z = dctZigZag[k]; + switch (successiveACState) { + case 0: // initial state + rs = decodeHuffman(component.huffmanTableAC); + s = rs & 15; + r = rs >> 4; + if (s === 0) { + if (r < 15) { + eobrun = receive(r) + (1 << r); + successiveACState = 4; + } else { + r = 16; + successiveACState = 1; + } + } else { + if (s !== 1) { + throw 'invalid ACn encoding'; + } + successiveACNextValue = receiveAndExtend(s); + successiveACState = r ? 2 : 3; + } + continue; + case 1: // skipping r zero items + case 2: + if (component.blockData[offset + z]) { + component.blockData[offset + z] += (readBit() << successive); + } else { + r--; + if (r === 0) { + successiveACState = successiveACState === 2 ? 3 : 0; + } + } + break; + case 3: // set value for a zero item + if (component.blockData[offset + z]) { + component.blockData[offset + z] += (readBit() << successive); + } else { + component.blockData[offset + z] = + successiveACNextValue << successive; + successiveACState = 0; + } + break; + case 4: // eob + if (component.blockData[offset + z]) { + component.blockData[offset + z] += (readBit() << successive); + } + break; + } + k++; + } + if (successiveACState === 4) { + eobrun--; + if (eobrun === 0) { + successiveACState = 0; + } + } + } + + function decodeMcu(component, decode, mcu, row, col) { + var mcuRow = (mcu / mcusPerLine) | 0; + var mcuCol = mcu % mcusPerLine; + var blockRow = mcuRow * component.v + row; + var blockCol = mcuCol * component.h + col; + var offset = getBlockBufferOffset(component, blockRow, blockCol); + decode(component, offset); + } + + function decodeBlock(component, decode, mcu) { + var blockRow = (mcu / component.blocksPerLine) | 0; + var blockCol = mcu % component.blocksPerLine; + var offset = getBlockBufferOffset(component, blockRow, blockCol); + decode(component, offset); + } + + var componentsLength = components.length; + var component, i, j, k, n; + var decodeFn; + if (progressive) { + if (spectralStart === 0) { + decodeFn = successivePrev === 0 ? decodeDCFirst : decodeDCSuccessive; + } else { + decodeFn = successivePrev === 0 ? decodeACFirst : decodeACSuccessive; + } + } else { + decodeFn = decodeBaseline; + } + + var mcu = 0, marker; + var mcuExpected; + if (componentsLength === 1) { + mcuExpected = components[0].blocksPerLine * components[0].blocksPerColumn; + } else { + mcuExpected = mcusPerLine * frame.mcusPerColumn; + } + if (!resetInterval) { + resetInterval = mcuExpected; + } + + var h, v; + while (mcu < mcuExpected) { + // reset interval stuff + for (i = 0; i < componentsLength; i++) { + components[i].pred = 0; + } + eobrun = 0; + + if (componentsLength === 1) { + component = components[0]; + for (n = 0; n < resetInterval; n++) { + decodeBlock(component, decodeFn, mcu); + mcu++; + } + } else { + for (n = 0; n < resetInterval; n++) { + for (i = 0; i < componentsLength; i++) { + component = components[i]; + h = component.h; + v = component.v; + for (j = 0; j < v; j++) { + for (k = 0; k < h; k++) { + decodeMcu(component, decodeFn, mcu, j, k); + } + } + } + mcu++; + } + } + + // find marker + bitsCount = 0; + marker = (data[offset] << 8) | data[offset + 1]; + if (marker <= 0xFF00) { + throw 'marker was not found'; + } + + if (marker >= 0xFFD0 && marker <= 0xFFD7) { // RSTx + offset += 2; + } else { + break; + } + } + + return offset - startOffset; + } + + // A port of poppler's IDCT method which in turn is taken from: + // Christoph Loeffler, Adriaan Ligtenberg, George S. Moschytz, + // 'Practical Fast 1-D DCT Algorithms with 11 Multiplications', + // IEEE Intl. Conf. on Acoustics, Speech & Signal Processing, 1989, + // 988-991. + function quantizeAndInverse(component, blockBufferOffset, p) { + var qt = component.quantizationTable, blockData = component.blockData; + var v0, v1, v2, v3, v4, v5, v6, v7; + var p0, p1, p2, p3, p4, p5, p6, p7; + var t; + + // inverse DCT on rows + for (var row = 0; row < 64; row += 8) { + // gather block data + p0 = blockData[blockBufferOffset + row]; + p1 = blockData[blockBufferOffset + row + 1]; + p2 = blockData[blockBufferOffset + row + 2]; + p3 = blockData[blockBufferOffset + row + 3]; + p4 = blockData[blockBufferOffset + row + 4]; + p5 = blockData[blockBufferOffset + row + 5]; + p6 = blockData[blockBufferOffset + row + 6]; + p7 = blockData[blockBufferOffset + row + 7]; + + // dequant p0 + p0 *= qt[row]; + + // check for all-zero AC coefficients + if ((p1 | p2 | p3 | p4 | p5 | p6 | p7) === 0) { + t = (dctSqrt2 * p0 + 512) >> 10; + p[row] = t; + p[row + 1] = t; + p[row + 2] = t; + p[row + 3] = t; + p[row + 4] = t; + p[row + 5] = t; + p[row + 6] = t; + p[row + 7] = t; + continue; + } + // dequant p1 ... p7 + p1 *= qt[row + 1]; + p2 *= qt[row + 2]; + p3 *= qt[row + 3]; + p4 *= qt[row + 4]; + p5 *= qt[row + 5]; + p6 *= qt[row + 6]; + p7 *= qt[row + 7]; + + // stage 4 + v0 = (dctSqrt2 * p0 + 128) >> 8; + v1 = (dctSqrt2 * p4 + 128) >> 8; + v2 = p2; + v3 = p6; + v4 = (dctSqrt1d2 * (p1 - p7) + 128) >> 8; + v7 = (dctSqrt1d2 * (p1 + p7) + 128) >> 8; + v5 = p3 << 4; + v6 = p5 << 4; + + // stage 3 + v0 = (v0 + v1 + 1) >> 1; + v1 = v0 - v1; + t = (v2 * dctSin6 + v3 * dctCos6 + 128) >> 8; + v2 = (v2 * dctCos6 - v3 * dctSin6 + 128) >> 8; + v3 = t; + v4 = (v4 + v6 + 1) >> 1; + v6 = v4 - v6; + v7 = (v7 + v5 + 1) >> 1; + v5 = v7 - v5; + + // stage 2 + v0 = (v0 + v3 + 1) >> 1; + v3 = v0 - v3; + v1 = (v1 + v2 + 1) >> 1; + v2 = v1 - v2; + t = (v4 * dctSin3 + v7 * dctCos3 + 2048) >> 12; + v4 = (v4 * dctCos3 - v7 * dctSin3 + 2048) >> 12; + v7 = t; + t = (v5 * dctSin1 + v6 * dctCos1 + 2048) >> 12; + v5 = (v5 * dctCos1 - v6 * dctSin1 + 2048) >> 12; + v6 = t; + + // stage 1 + p[row] = v0 + v7; + p[row + 7] = v0 - v7; + p[row + 1] = v1 + v6; + p[row + 6] = v1 - v6; + p[row + 2] = v2 + v5; + p[row + 5] = v2 - v5; + p[row + 3] = v3 + v4; + p[row + 4] = v3 - v4; + } + + // inverse DCT on columns + for (var col = 0; col < 8; ++col) { + p0 = p[col]; + p1 = p[col + 8]; + p2 = p[col + 16]; + p3 = p[col + 24]; + p4 = p[col + 32]; + p5 = p[col + 40]; + p6 = p[col + 48]; + p7 = p[col + 56]; + + // check for all-zero AC coefficients + if ((p1 | p2 | p3 | p4 | p5 | p6 | p7) === 0) { + t = (dctSqrt2 * p0 + 8192) >> 14; + // convert to 8 bit + t = (t < -2040) ? 0 : (t >= 2024) ? 255 : (t + 2056) >> 4; + blockData[blockBufferOffset + col] = t; + blockData[blockBufferOffset + col + 8] = t; + blockData[blockBufferOffset + col + 16] = t; + blockData[blockBufferOffset + col + 24] = t; + blockData[blockBufferOffset + col + 32] = t; + blockData[blockBufferOffset + col + 40] = t; + blockData[blockBufferOffset + col + 48] = t; + blockData[blockBufferOffset + col + 56] = t; + continue; + } + + // stage 4 + v0 = (dctSqrt2 * p0 + 2048) >> 12; + v1 = (dctSqrt2 * p4 + 2048) >> 12; + v2 = p2; + v3 = p6; + v4 = (dctSqrt1d2 * (p1 - p7) + 2048) >> 12; + v7 = (dctSqrt1d2 * (p1 + p7) + 2048) >> 12; + v5 = p3; + v6 = p5; + + // stage 3 + // Shift v0 by 128.5 << 5 here, so we don't need to shift p0...p7 when + // converting to UInt8 range later. + v0 = ((v0 + v1 + 1) >> 1) + 4112; + v1 = v0 - v1; + t = (v2 * dctSin6 + v3 * dctCos6 + 2048) >> 12; + v2 = (v2 * dctCos6 - v3 * dctSin6 + 2048) >> 12; + v3 = t; + v4 = (v4 + v6 + 1) >> 1; + v6 = v4 - v6; + v7 = (v7 + v5 + 1) >> 1; + v5 = v7 - v5; + + // stage 2 + v0 = (v0 + v3 + 1) >> 1; + v3 = v0 - v3; + v1 = (v1 + v2 + 1) >> 1; + v2 = v1 - v2; + t = (v4 * dctSin3 + v7 * dctCos3 + 2048) >> 12; + v4 = (v4 * dctCos3 - v7 * dctSin3 + 2048) >> 12; + v7 = t; + t = (v5 * dctSin1 + v6 * dctCos1 + 2048) >> 12; + v5 = (v5 * dctCos1 - v6 * dctSin1 + 2048) >> 12; + v6 = t; + + // stage 1 + p0 = v0 + v7; + p7 = v0 - v7; + p1 = v1 + v6; + p6 = v1 - v6; + p2 = v2 + v5; + p5 = v2 - v5; + p3 = v3 + v4; + p4 = v3 - v4; + + // convert to 8-bit integers + p0 = (p0 < 16) ? 0 : (p0 >= 4080) ? 255 : p0 >> 4; + p1 = (p1 < 16) ? 0 : (p1 >= 4080) ? 255 : p1 >> 4; + p2 = (p2 < 16) ? 0 : (p2 >= 4080) ? 255 : p2 >> 4; + p3 = (p3 < 16) ? 0 : (p3 >= 4080) ? 255 : p3 >> 4; + p4 = (p4 < 16) ? 0 : (p4 >= 4080) ? 255 : p4 >> 4; + p5 = (p5 < 16) ? 0 : (p5 >= 4080) ? 255 : p5 >> 4; + p6 = (p6 < 16) ? 0 : (p6 >= 4080) ? 255 : p6 >> 4; + p7 = (p7 < 16) ? 0 : (p7 >= 4080) ? 255 : p7 >> 4; + + // store block data + blockData[blockBufferOffset + col] = p0; + blockData[blockBufferOffset + col + 8] = p1; + blockData[blockBufferOffset + col + 16] = p2; + blockData[blockBufferOffset + col + 24] = p3; + blockData[blockBufferOffset + col + 32] = p4; + blockData[blockBufferOffset + col + 40] = p5; + blockData[blockBufferOffset + col + 48] = p6; + blockData[blockBufferOffset + col + 56] = p7; + } + } + + function buildComponentData(frame, component) { + var blocksPerLine = component.blocksPerLine; + var blocksPerColumn = component.blocksPerColumn; + var computationBuffer = new Int16Array(64); + + for (var blockRow = 0; blockRow < blocksPerColumn; blockRow++) { + for (var blockCol = 0; blockCol < blocksPerLine; blockCol++) { + var offset = getBlockBufferOffset(component, blockRow, blockCol); + quantizeAndInverse(component, offset, computationBuffer); + } + } + return component.blockData; + } + + function clamp0to255(a) { + return a <= 0 ? 0 : a >= 255 ? 255 : a; + } + + constructor.prototype = { + parse: function parse(data) { + + function readUint16() { + var value = (data[offset] << 8) | data[offset + 1]; + offset += 2; + return value; + } + + function readDataBlock() { + var length = readUint16(); + var array = data.subarray(offset, offset + length - 2); + offset += array.length; + return array; + } + + function prepareComponents(frame) { + var mcusPerLine = Math.ceil(frame.samplesPerLine / 8 / frame.maxH); + var mcusPerColumn = Math.ceil(frame.scanLines / 8 / frame.maxV); + for (var i = 0; i < frame.components.length; i++) { + component = frame.components[i]; + var blocksPerLine = Math.ceil(Math.ceil(frame.samplesPerLine / 8) * + component.h / frame.maxH); + var blocksPerColumn = Math.ceil(Math.ceil(frame.scanLines / 8) * + component.v / frame.maxV); + var blocksPerLineForMcu = mcusPerLine * component.h; + var blocksPerColumnForMcu = mcusPerColumn * component.v; + + var blocksBufferSize = 64 * blocksPerColumnForMcu * + (blocksPerLineForMcu + 1); + component.blockData = new Int16Array(blocksBufferSize); + component.blocksPerLine = blocksPerLine; + component.blocksPerColumn = blocksPerColumn; + } + frame.mcusPerLine = mcusPerLine; + frame.mcusPerColumn = mcusPerColumn; + } + + var offset = 0, length = data.length; + var jfif = null; + var adobe = null; + var pixels = null; + var frame, resetInterval; + var quantizationTables = []; + var huffmanTablesAC = [], huffmanTablesDC = []; + var fileMarker = readUint16(); + if (fileMarker !== 0xFFD8) { // SOI (Start of Image) + throw 'SOI not found'; + } + + fileMarker = readUint16(); + while (fileMarker !== 0xFFD9) { // EOI (End of image) + var i, j, l; + switch(fileMarker) { + case 0xFFE0: // APP0 (Application Specific) + case 0xFFE1: // APP1 + case 0xFFE2: // APP2 + case 0xFFE3: // APP3 + case 0xFFE4: // APP4 + case 0xFFE5: // APP5 + case 0xFFE6: // APP6 + case 0xFFE7: // APP7 + case 0xFFE8: // APP8 + case 0xFFE9: // APP9 + case 0xFFEA: // APP10 + case 0xFFEB: // APP11 + case 0xFFEC: // APP12 + case 0xFFED: // APP13 + case 0xFFEE: // APP14 + case 0xFFEF: // APP15 + case 0xFFFE: // COM (Comment) + var appData = readDataBlock(); + + if (fileMarker === 0xFFE0) { + if (appData[0] === 0x4A && appData[1] === 0x46 && + appData[2] === 0x49 && appData[3] === 0x46 && + appData[4] === 0) { // 'JFIF\x00' + jfif = { + version: { major: appData[5], minor: appData[6] }, + densityUnits: appData[7], + xDensity: (appData[8] << 8) | appData[9], + yDensity: (appData[10] << 8) | appData[11], + thumbWidth: appData[12], + thumbHeight: appData[13], + thumbData: appData.subarray(14, 14 + + 3 * appData[12] * appData[13]) + }; + } + } + // TODO APP1 - Exif + if (fileMarker === 0xFFEE) { + if (appData[0] === 0x41 && appData[1] === 0x64 && + appData[2] === 0x6F && appData[3] === 0x62 && + appData[4] === 0x65) { // 'Adobe' + adobe = { + version: (appData[5] << 8) | appData[6], + flags0: (appData[7] << 8) | appData[8], + flags1: (appData[9] << 8) | appData[10], + transformCode: appData[11] + }; + } + } + break; + + case 0xFFDB: // DQT (Define Quantization Tables) + var quantizationTablesLength = readUint16(); + var quantizationTablesEnd = quantizationTablesLength + offset - 2; + var z; + while (offset < quantizationTablesEnd) { + var quantizationTableSpec = data[offset++]; + var tableData = new Uint16Array(64); + if ((quantizationTableSpec >> 4) === 0) { // 8 bit values + for (j = 0; j < 64; j++) { + z = dctZigZag[j]; + tableData[z] = data[offset++]; + } + } else if ((quantizationTableSpec >> 4) === 1) { //16 bit + for (j = 0; j < 64; j++) { + z = dctZigZag[j]; + tableData[z] = readUint16(); + } + } else { + throw 'DQT: invalid table spec'; + } + quantizationTables[quantizationTableSpec & 15] = tableData; + } + break; + + case 0xFFC0: // SOF0 (Start of Frame, Baseline DCT) + case 0xFFC1: // SOF1 (Start of Frame, Extended DCT) + case 0xFFC2: // SOF2 (Start of Frame, Progressive DCT) + if (frame) { + throw 'Only single frame JPEGs supported'; + } + readUint16(); // skip data length + frame = {}; + frame.extended = (fileMarker === 0xFFC1); + frame.progressive = (fileMarker === 0xFFC2); + frame.precision = data[offset++]; + frame.scanLines = readUint16(); + frame.samplesPerLine = readUint16(); + frame.components = []; + frame.componentIds = {}; + var componentsCount = data[offset++], componentId; + var maxH = 0, maxV = 0; + for (i = 0; i < componentsCount; i++) { + componentId = data[offset]; + var h = data[offset + 1] >> 4; + var v = data[offset + 1] & 15; + if (maxH < h) { + maxH = h; + } + if (maxV < v) { + maxV = v; + } + var qId = data[offset + 2]; + l = frame.components.push({ + h: h, + v: v, + quantizationTable: quantizationTables[qId] + }); + frame.componentIds[componentId] = l - 1; + offset += 3; + } + frame.maxH = maxH; + frame.maxV = maxV; + prepareComponents(frame); + break; + + case 0xFFC4: // DHT (Define Huffman Tables) + var huffmanLength = readUint16(); + for (i = 2; i < huffmanLength;) { + var huffmanTableSpec = data[offset++]; + var codeLengths = new Uint8Array(16); + var codeLengthSum = 0; + for (j = 0; j < 16; j++, offset++) { + codeLengthSum += (codeLengths[j] = data[offset]); + } + var huffmanValues = new Uint8Array(codeLengthSum); + for (j = 0; j < codeLengthSum; j++, offset++) { + huffmanValues[j] = data[offset]; + } + i += 17 + codeLengthSum; + + ((huffmanTableSpec >> 4) === 0 ? + huffmanTablesDC : huffmanTablesAC)[huffmanTableSpec & 15] = + buildHuffmanTable(codeLengths, huffmanValues); + } + break; + + case 0xFFDD: // DRI (Define Restart Interval) + readUint16(); // skip data length + resetInterval = readUint16(); + break; + + case 0xFFDA: // SOS (Start of Scan) + var scanLength = readUint16(); + var selectorsCount = data[offset++]; + var components = [], component; + for (i = 0; i < selectorsCount; i++) { + var componentIndex = frame.componentIds[data[offset++]]; + component = frame.components[componentIndex]; + var tableSpec = data[offset++]; + component.huffmanTableDC = huffmanTablesDC[tableSpec >> 4]; + component.huffmanTableAC = huffmanTablesAC[tableSpec & 15]; + components.push(component); + } + var spectralStart = data[offset++]; + var spectralEnd = data[offset++]; + var successiveApproximation = data[offset++]; + var processed = decodeScan(data, offset, + frame, components, resetInterval, + spectralStart, spectralEnd, + successiveApproximation >> 4, successiveApproximation & 15); + offset += processed; + break; + + case 0xFFFF: // Fill bytes + if (data[offset] !== 0xFF) { // Avoid skipping a valid marker. + offset--; + } + break; + + default: + if (data[offset - 3] === 0xFF && + data[offset - 2] >= 0xC0 && data[offset - 2] <= 0xFE) { + // could be incorrect encoding -- last 0xFF byte of the previous + // block was eaten by the encoder + offset -= 3; + break; + } + throw 'unknown JPEG marker ' + fileMarker.toString(16); + } + fileMarker = readUint16(); + } + + this.width = frame.samplesPerLine; + this.height = frame.scanLines; + this.jfif = jfif; + this.adobe = adobe; + this.components = []; + for (i = 0; i < frame.components.length; i++) { + component = frame.components[i]; + this.components.push({ + output: buildComponentData(frame, component), + scaleX: component.h / frame.maxH, + scaleY: component.v / frame.maxV, + blocksPerLine: component.blocksPerLine, + blocksPerColumn: component.blocksPerColumn + }); + } + this.numComponents = this.components.length; + }, + + _getLinearizedBlockData: function getLinearizedBlockData(width, height) { + var scaleX = this.width / width, scaleY = this.height / height; + + var component, componentScaleX, componentScaleY, blocksPerScanline; + var x, y, i, j, k; + var index; + var offset = 0; + var output; + var numComponents = this.components.length; + var dataLength = width * height * numComponents; + var data = new Uint8Array(dataLength); + var xScaleBlockOffset = new Uint32Array(width); + var mask3LSB = 0xfffffff8; // used to clear the 3 LSBs + + for (i = 0; i < numComponents; i++) { + component = this.components[i]; + componentScaleX = component.scaleX * scaleX; + componentScaleY = component.scaleY * scaleY; + offset = i; + output = component.output; + blocksPerScanline = (component.blocksPerLine + 1) << 3; + // precalculate the xScaleBlockOffset + for (x = 0; x < width; x++) { + j = 0 | (x * componentScaleX); + xScaleBlockOffset[x] = ((j & mask3LSB) << 3) | (j & 7); + } + // linearize the blocks of the component + for (y = 0; y < height; y++) { + j = 0 | (y * componentScaleY); + index = blocksPerScanline * (j & mask3LSB) | ((j & 7) << 3); + for (x = 0; x < width; x++) { + data[offset] = output[index + xScaleBlockOffset[x]]; + offset += numComponents; + } + } + } + + // decodeTransform contains pairs of multiplier (-256..256) and additive + var transform = this.decodeTransform; + if (transform) { + for (i = 0; i < dataLength;) { + for (j = 0, k = 0; j < numComponents; j++, i++, k += 2) { + data[i] = ((data[i] * transform[k]) >> 8) + transform[k + 1]; + } + } + } + return data; + }, + + _isColorConversionNeeded: function isColorConversionNeeded() { + if (this.adobe && this.adobe.transformCode) { + // The adobe transform marker overrides any previous setting + return true; + } else if (this.numComponents === 3) { + return true; + } else { + return false; + } + }, + + _convertYccToRgb: function convertYccToRgb(data) { + var Y, Cb, Cr; + for (var i = 0, length = data.length; i < length; i += 3) { + Y = data[i ]; + Cb = data[i + 1]; + Cr = data[i + 2]; + data[i ] = clamp0to255(Y - 179.456 + 1.402 * Cr); + data[i + 1] = clamp0to255(Y + 135.459 - 0.344 * Cb - 0.714 * Cr); + data[i + 2] = clamp0to255(Y - 226.816 + 1.772 * Cb); + } + return data; + }, + + _convertYcckToRgb: function convertYcckToRgb(data) { + var Y, Cb, Cr, k; + var offset = 0; + for (var i = 0, length = data.length; i < length; i += 4) { + Y = data[i]; + Cb = data[i + 1]; + Cr = data[i + 2]; + k = data[i + 3]; + + var r = -122.67195406894 + + Cb * (-6.60635669420364e-5 * Cb + 0.000437130475926232 * Cr - + 5.4080610064599e-5 * Y + 0.00048449797120281 * k - + 0.154362151871126) + + Cr * (-0.000957964378445773 * Cr + 0.000817076911346625 * Y - + 0.00477271405408747 * k + 1.53380253221734) + + Y * (0.000961250184130688 * Y - 0.00266257332283933 * k + + 0.48357088451265) + + k * (-0.000336197177618394 * k + 0.484791561490776); + + var g = 107.268039397724 + + Cb * (2.19927104525741e-5 * Cb - 0.000640992018297945 * Cr + + 0.000659397001245577 * Y + 0.000426105652938837 * k - + 0.176491792462875) + + Cr * (-0.000778269941513683 * Cr + 0.00130872261408275 * Y + + 0.000770482631801132 * k - 0.151051492775562) + + Y * (0.00126935368114843 * Y - 0.00265090189010898 * k + + 0.25802910206845) + + k * (-0.000318913117588328 * k - 0.213742400323665); + + var b = -20.810012546947 + + Cb * (-0.000570115196973677 * Cb - 2.63409051004589e-5 * Cr + + 0.0020741088115012 * Y - 0.00288260236853442 * k + + 0.814272968359295) + + Cr * (-1.53496057440975e-5 * Cr - 0.000132689043961446 * Y + + 0.000560833691242812 * k - 0.195152027534049) + + Y * (0.00174418132927582 * Y - 0.00255243321439347 * k + + 0.116935020465145) + + k * (-0.000343531996510555 * k + 0.24165260232407); + + data[offset++] = clamp0to255(r); + data[offset++] = clamp0to255(g); + data[offset++] = clamp0to255(b); + } + return data; + }, + + _convertYcckToCmyk: function convertYcckToCmyk(data) { + var Y, Cb, Cr; + for (var i = 0, length = data.length; i < length; i += 4) { + Y = data[i]; + Cb = data[i + 1]; + Cr = data[i + 2]; + data[i ] = clamp0to255(434.456 - Y - 1.402 * Cr); + data[i + 1] = clamp0to255(119.541 - Y + 0.344 * Cb + 0.714 * Cr); + data[i + 2] = clamp0to255(481.816 - Y - 1.772 * Cb); + // K in data[i + 3] is unchanged + } + return data; + }, + + _convertCmykToRgb: function convertCmykToRgb(data) { + var c, m, y, k; + var offset = 0; + var min = -255 * 255 * 255; + var scale = 1 / 255 / 255; + for (var i = 0, length = data.length; i < length; i += 4) { + c = data[i]; + m = data[i + 1]; + y = data[i + 2]; + k = data[i + 3]; + + var r = + c * (-4.387332384609988 * c + 54.48615194189176 * m + + 18.82290502165302 * y + 212.25662451639585 * k - + 72734.4411664936) + + m * (1.7149763477362134 * m - 5.6096736904047315 * y - + 17.873870861415444 * k - 1401.7366389350734) + + y * (-2.5217340131683033 * y - 21.248923337353073 * k + + 4465.541406466231) - + k * (21.86122147463605 * k + 48317.86113160301); + var g = + c * (8.841041422036149 * c + 60.118027045597366 * m + + 6.871425592049007 * y + 31.159100130055922 * k - + 20220.756542821975) + + m * (-15.310361306967817 * m + 17.575251261109482 * y + + 131.35250912493976 * k - 48691.05921601825) + + y * (4.444339102852739 * y + 9.8632861493405 * k - + 6341.191035517494) - + k * (20.737325471181034 * k + 47890.15695978492); + var b = + c * (0.8842522430003296 * c + 8.078677503112928 * m + + 30.89978309703729 * y - 0.23883238689178934 * k - + 3616.812083916688) + + m * (10.49593273432072 * m + 63.02378494754052 * y + + 50.606957656360734 * k - 28620.90484698408) + + y * (0.03296041114873217 * y + 115.60384449646641 * k - + 49363.43385999684) - + k * (22.33816807309886 * k + 45932.16563550634); + + data[offset++] = r >= 0 ? 255 : r <= min ? 0 : 255 + r * scale | 0; + data[offset++] = g >= 0 ? 255 : g <= min ? 0 : 255 + g * scale | 0; + data[offset++] = b >= 0 ? 255 : b <= min ? 0 : 255 + b * scale | 0; + } + return data; + }, + + getData: function getData(width, height, forceRGBoutput) { + if (this.numComponents > 4) { + throw 'Unsupported color mode'; + } + // type of data: Uint8Array(width * height * numComponents) + var data = this._getLinearizedBlockData(width, height); + + if (this.numComponents === 3) { + return this._convertYccToRgb(data); + } else if (this.numComponents === 4) { + if (this._isColorConversionNeeded()) { + if (forceRGBoutput) { + return this._convertYcckToRgb(data); + } else { + return this._convertYcckToCmyk(data); + } + } else if (forceRGBoutput) { + return this._convertCmykToRgb(data); + } + } + return data; + } + }; + + return constructor; +})(); + + +var JpxImage = (function JpxImageClosure() { + // Table E.1 + var SubbandsGainLog2 = { + 'LL': 0, + 'LH': 1, + 'HL': 1, + 'HH': 2 + }; + function JpxImage() { + this.failOnCorruptedImage = false; + } + JpxImage.prototype = { + parse: function JpxImage_parse(data) { + + var head = readUint16(data, 0); + // No box header, immediate start of codestream (SOC) + if (head === 0xFF4F) { + this.parseCodestream(data, 0, data.length); + return; + } + + var position = 0, length = data.length; + while (position < length) { + var headerSize = 8; + var lbox = readUint32(data, position); + var tbox = readUint32(data, position + 4); + position += headerSize; + if (lbox === 1) { + // XLBox: read UInt64 according to spec. + // JavaScript's int precision of 53 bit should be sufficient here. + lbox = readUint32(data, position) * 4294967296 + + readUint32(data, position + 4); + position += 8; + headerSize += 8; + } + if (lbox === 0) { + lbox = length - position + headerSize; + } + if (lbox < headerSize) { + throw new Error('JPX Error: Invalid box field size'); + } + var dataLength = lbox - headerSize; + var jumpDataLength = true; + switch (tbox) { + case 0x6A703268: // 'jp2h' + jumpDataLength = false; // parsing child boxes + break; + case 0x636F6C72: // 'colr' + // Colorspaces are not used, the CS from the PDF is used. + var method = data[position]; + var precedence = data[position + 1]; + var approximation = data[position + 2]; + if (method === 1) { + // enumerated colorspace + var colorspace = readUint32(data, position + 3); + switch (colorspace) { + case 16: // this indicates a sRGB colorspace + case 17: // this indicates a grayscale colorspace + case 18: // this indicates a YUV colorspace + break; + default: + warn('Unknown colorspace ' + colorspace); + break; + } + } else if (method === 2) { + info('ICC profile not supported'); + } + break; + case 0x6A703263: // 'jp2c' + this.parseCodestream(data, position, position + dataLength); + break; + case 0x6A502020: // 'jP\024\024' + if (0x0d0a870a !== readUint32(data, position)) { + warn('Invalid JP2 signature'); + } + break; + // The following header types are valid but currently not used: + case 0x6A501A1A: // 'jP\032\032' + case 0x66747970: // 'ftyp' + case 0x72726571: // 'rreq' + case 0x72657320: // 'res ' + case 0x69686472: // 'ihdr' + break; + default: + var headerType = String.fromCharCode((tbox >> 24) & 0xFF, + (tbox >> 16) & 0xFF, + (tbox >> 8) & 0xFF, + tbox & 0xFF); + warn('Unsupported header type ' + tbox + ' (' + headerType + ')'); + break; + } + if (jumpDataLength) { + position += dataLength; + } + } + }, + parseImageProperties: function JpxImage_parseImageProperties(stream) { + var newByte = stream.getByte(); + while (newByte >= 0) { + var oldByte = newByte; + newByte = stream.getByte(); + var code = (oldByte << 8) | newByte; + // Image and tile size (SIZ) + if (code === 0xFF51) { + stream.skip(4); + var Xsiz = stream.getInt32() >>> 0; // Byte 4 + var Ysiz = stream.getInt32() >>> 0; // Byte 8 + var XOsiz = stream.getInt32() >>> 0; // Byte 12 + var YOsiz = stream.getInt32() >>> 0; // Byte 16 + stream.skip(16); + var Csiz = stream.getUint16(); // Byte 36 + this.width = Xsiz - XOsiz; + this.height = Ysiz - YOsiz; + this.componentsCount = Csiz; + // Results are always returned as Uint8Arrays + this.bitsPerComponent = 8; + return; + } + } + throw new Error('JPX Error: No size marker found in JPX stream'); + }, + parseCodestream: function JpxImage_parseCodestream(data, start, end) { + var context = {}; + try { + var doNotRecover = false; + var position = start; + while (position + 1 < end) { + var code = readUint16(data, position); + position += 2; + + var length = 0, j, sqcd, spqcds, spqcdSize, scalarExpounded, tile; + switch (code) { + case 0xFF4F: // Start of codestream (SOC) + context.mainHeader = true; + break; + case 0xFFD9: // End of codestream (EOC) + break; + case 0xFF51: // Image and tile size (SIZ) + length = readUint16(data, position); + var siz = {}; + siz.Xsiz = readUint32(data, position + 4); + siz.Ysiz = readUint32(data, position + 8); + siz.XOsiz = readUint32(data, position + 12); + siz.YOsiz = readUint32(data, position + 16); + siz.XTsiz = readUint32(data, position + 20); + siz.YTsiz = readUint32(data, position + 24); + siz.XTOsiz = readUint32(data, position + 28); + siz.YTOsiz = readUint32(data, position + 32); + var componentsCount = readUint16(data, position + 36); + siz.Csiz = componentsCount; + var components = []; + j = position + 38; + for (var i = 0; i < componentsCount; i++) { + var component = { + precision: (data[j] & 0x7F) + 1, + isSigned: !!(data[j] & 0x80), + XRsiz: data[j + 1], + YRsiz: data[j + 1] + }; + calculateComponentDimensions(component, siz); + components.push(component); + } + context.SIZ = siz; + context.components = components; + calculateTileGrids(context, components); + context.QCC = []; + context.COC = []; + break; + case 0xFF5C: // Quantization default (QCD) + length = readUint16(data, position); + var qcd = {}; + j = position + 2; + sqcd = data[j++]; + switch (sqcd & 0x1F) { + case 0: + spqcdSize = 8; + scalarExpounded = true; + break; + case 1: + spqcdSize = 16; + scalarExpounded = false; + break; + case 2: + spqcdSize = 16; + scalarExpounded = true; + break; + default: + throw new Error('JPX Error: Invalid SQcd value ' + sqcd); + } + qcd.noQuantization = (spqcdSize === 8); + qcd.scalarExpounded = scalarExpounded; + qcd.guardBits = sqcd >> 5; + spqcds = []; + while (j < length + position) { + var spqcd = {}; + if (spqcdSize === 8) { + spqcd.epsilon = data[j++] >> 3; + spqcd.mu = 0; + } else { + spqcd.epsilon = data[j] >> 3; + spqcd.mu = ((data[j] & 0x7) << 8) | data[j + 1]; + j += 2; + } + spqcds.push(spqcd); + } + qcd.SPqcds = spqcds; + if (context.mainHeader) { + context.QCD = qcd; + } else { + context.currentTile.QCD = qcd; + context.currentTile.QCC = []; + } + break; + case 0xFF5D: // Quantization component (QCC) + length = readUint16(data, position); + var qcc = {}; + j = position + 2; + var cqcc; + if (context.SIZ.Csiz < 257) { + cqcc = data[j++]; + } else { + cqcc = readUint16(data, j); + j += 2; + } + sqcd = data[j++]; + switch (sqcd & 0x1F) { + case 0: + spqcdSize = 8; + scalarExpounded = true; + break; + case 1: + spqcdSize = 16; + scalarExpounded = false; + break; + case 2: + spqcdSize = 16; + scalarExpounded = true; + break; + default: + throw new Error('JPX Error: Invalid SQcd value ' + sqcd); + } + qcc.noQuantization = (spqcdSize === 8); + qcc.scalarExpounded = scalarExpounded; + qcc.guardBits = sqcd >> 5; + spqcds = []; + while (j < (length + position)) { + spqcd = {}; + if (spqcdSize === 8) { + spqcd.epsilon = data[j++] >> 3; + spqcd.mu = 0; + } else { + spqcd.epsilon = data[j] >> 3; + spqcd.mu = ((data[j] & 0x7) << 8) | data[j + 1]; + j += 2; + } + spqcds.push(spqcd); + } + qcc.SPqcds = spqcds; + if (context.mainHeader) { + context.QCC[cqcc] = qcc; + } else { + context.currentTile.QCC[cqcc] = qcc; + } + break; + case 0xFF52: // Coding style default (COD) + length = readUint16(data, position); + var cod = {}; + j = position + 2; + var scod = data[j++]; + cod.entropyCoderWithCustomPrecincts = !!(scod & 1); + cod.sopMarkerUsed = !!(scod & 2); + cod.ephMarkerUsed = !!(scod & 4); + cod.progressionOrder = data[j++]; + cod.layersCount = readUint16(data, j); + j += 2; + cod.multipleComponentTransform = data[j++]; + + cod.decompositionLevelsCount = data[j++]; + cod.xcb = (data[j++] & 0xF) + 2; + cod.ycb = (data[j++] & 0xF) + 2; + var blockStyle = data[j++]; + cod.selectiveArithmeticCodingBypass = !!(blockStyle & 1); + cod.resetContextProbabilities = !!(blockStyle & 2); + cod.terminationOnEachCodingPass = !!(blockStyle & 4); + cod.verticalyStripe = !!(blockStyle & 8); + cod.predictableTermination = !!(blockStyle & 16); + cod.segmentationSymbolUsed = !!(blockStyle & 32); + cod.reversibleTransformation = data[j++]; + if (cod.entropyCoderWithCustomPrecincts) { + var precinctsSizes = []; + while (j < length + position) { + var precinctsSize = data[j++]; + precinctsSizes.push({ + PPx: precinctsSize & 0xF, + PPy: precinctsSize >> 4 + }); + } + cod.precinctsSizes = precinctsSizes; + } + var unsupported = []; + if (cod.selectiveArithmeticCodingBypass) { + unsupported.push('selectiveArithmeticCodingBypass'); + } + if (cod.resetContextProbabilities) { + unsupported.push('resetContextProbabilities'); + } + if (cod.terminationOnEachCodingPass) { + unsupported.push('terminationOnEachCodingPass'); + } + if (cod.verticalyStripe) { + unsupported.push('verticalyStripe'); + } + if (cod.predictableTermination) { + unsupported.push('predictableTermination'); + } + if (unsupported.length > 0) { + doNotRecover = true; + throw new Error('JPX Error: Unsupported COD options (' + + unsupported.join(', ') + ')'); + } + if (context.mainHeader) { + context.COD = cod; + } else { + context.currentTile.COD = cod; + context.currentTile.COC = []; + } + break; + case 0xFF90: // Start of tile-part (SOT) + length = readUint16(data, position); + tile = {}; + tile.index = readUint16(data, position + 2); + tile.length = readUint32(data, position + 4); + tile.dataEnd = tile.length + position - 2; + tile.partIndex = data[position + 8]; + tile.partsCount = data[position + 9]; + + context.mainHeader = false; + if (tile.partIndex === 0) { + // reset component specific settings + tile.COD = context.COD; + tile.COC = context.COC.slice(0); // clone of the global COC + tile.QCD = context.QCD; + tile.QCC = context.QCC.slice(0); // clone of the global COC + } + context.currentTile = tile; + break; + case 0xFF93: // Start of data (SOD) + tile = context.currentTile; + if (tile.partIndex === 0) { + initializeTile(context, tile.index); + buildPackets(context); + } + + // moving to the end of the data + length = tile.dataEnd - position; + parseTilePackets(context, data, position, length); + break; + case 0xFF55: // Tile-part lengths, main header (TLM) + case 0xFF57: // Packet length, main header (PLM) + case 0xFF58: // Packet length, tile-part header (PLT) + case 0xFF64: // Comment (COM) + length = readUint16(data, position); + // skipping content + break; + case 0xFF53: // Coding style component (COC) + throw new Error('JPX Error: Codestream code 0xFF53 (COC) is ' + + 'not implemented'); + default: + throw new Error('JPX Error: Unknown codestream code: ' + + code.toString(16)); + } + position += length; + } + } catch (e) { + if (doNotRecover || this.failOnCorruptedImage) { + throw e; + } else { + warn('Trying to recover from ' + e.message); + } + } + this.tiles = transformComponents(context); + this.width = context.SIZ.Xsiz - context.SIZ.XOsiz; + this.height = context.SIZ.Ysiz - context.SIZ.YOsiz; + this.componentsCount = context.SIZ.Csiz; + } + }; + function calculateComponentDimensions(component, siz) { + // Section B.2 Component mapping + component.x0 = Math.ceil(siz.XOsiz / component.XRsiz); + component.x1 = Math.ceil(siz.Xsiz / component.XRsiz); + component.y0 = Math.ceil(siz.YOsiz / component.YRsiz); + component.y1 = Math.ceil(siz.Ysiz / component.YRsiz); + component.width = component.x1 - component.x0; + component.height = component.y1 - component.y0; + } + function calculateTileGrids(context, components) { + var siz = context.SIZ; + // Section B.3 Division into tile and tile-components + var tile, tiles = []; + var numXtiles = Math.ceil((siz.Xsiz - siz.XTOsiz) / siz.XTsiz); + var numYtiles = Math.ceil((siz.Ysiz - siz.YTOsiz) / siz.YTsiz); + for (var q = 0; q < numYtiles; q++) { + for (var p = 0; p < numXtiles; p++) { + tile = {}; + tile.tx0 = Math.max(siz.XTOsiz + p * siz.XTsiz, siz.XOsiz); + tile.ty0 = Math.max(siz.YTOsiz + q * siz.YTsiz, siz.YOsiz); + tile.tx1 = Math.min(siz.XTOsiz + (p + 1) * siz.XTsiz, siz.Xsiz); + tile.ty1 = Math.min(siz.YTOsiz + (q + 1) * siz.YTsiz, siz.Ysiz); + tile.width = tile.tx1 - tile.tx0; + tile.height = tile.ty1 - tile.ty0; + tile.components = []; + tiles.push(tile); + } + } + context.tiles = tiles; + + var componentsCount = siz.Csiz; + for (var i = 0, ii = componentsCount; i < ii; i++) { + var component = components[i]; + for (var j = 0, jj = tiles.length; j < jj; j++) { + var tileComponent = {}; + tile = tiles[j]; + tileComponent.tcx0 = Math.ceil(tile.tx0 / component.XRsiz); + tileComponent.tcy0 = Math.ceil(tile.ty0 / component.YRsiz); + tileComponent.tcx1 = Math.ceil(tile.tx1 / component.XRsiz); + tileComponent.tcy1 = Math.ceil(tile.ty1 / component.YRsiz); + tileComponent.width = tileComponent.tcx1 - tileComponent.tcx0; + tileComponent.height = tileComponent.tcy1 - tileComponent.tcy0; + tile.components[i] = tileComponent; + } + } + } + function getBlocksDimensions(context, component, r) { + var codOrCoc = component.codingStyleParameters; + var result = {}; + if (!codOrCoc.entropyCoderWithCustomPrecincts) { + result.PPx = 15; + result.PPy = 15; + } else { + result.PPx = codOrCoc.precinctsSizes[r].PPx; + result.PPy = codOrCoc.precinctsSizes[r].PPy; + } + // calculate codeblock size as described in section B.7 + result.xcb_ = (r > 0 ? Math.min(codOrCoc.xcb, result.PPx - 1) : + Math.min(codOrCoc.xcb, result.PPx)); + result.ycb_ = (r > 0 ? Math.min(codOrCoc.ycb, result.PPy - 1) : + Math.min(codOrCoc.ycb, result.PPy)); + return result; + } + function buildPrecincts(context, resolution, dimensions) { + // Section B.6 Division resolution to precincts + var precinctWidth = 1 << dimensions.PPx; + var precinctHeight = 1 << dimensions.PPy; + // Jasper introduces codeblock groups for mapping each subband codeblocks + // to precincts. Precinct partition divides a resolution according to width + // and height parameters. The subband that belongs to the resolution level + // has a different size than the level, unless it is the zero resolution. + + // From Jasper documentation: jpeg2000.pdf, section K: Tier-2 coding: + // The precinct partitioning for a particular subband is derived from a + // partitioning of its parent LL band (i.e., the LL band at the next higher + // resolution level)... The LL band associated with each resolution level is + // divided into precincts... Each of the resulting precinct regions is then + // mapped into its child subbands (if any) at the next lower resolution + // level. This is accomplished by using the coordinate transformation + // (u, v) = (ceil(x/2), ceil(y/2)) where (x, y) and (u, v) are the + // coordinates of a point in the LL band and child subband, respectively. + var isZeroRes = resolution.resLevel === 0; + var precinctWidthInSubband = 1 << (dimensions.PPx + (isZeroRes ? 0 : -1)); + var precinctHeightInSubband = 1 << (dimensions.PPy + (isZeroRes ? 0 : -1)); + var numprecinctswide = (resolution.trx1 > resolution.trx0 ? + Math.ceil(resolution.trx1 / precinctWidth) - + Math.floor(resolution.trx0 / precinctWidth) : 0); + var numprecinctshigh = (resolution.try1 > resolution.try0 ? + Math.ceil(resolution.try1 / precinctHeight) - + Math.floor(resolution.try0 / precinctHeight) : 0); + var numprecincts = numprecinctswide * numprecinctshigh; + + resolution.precinctParameters = { + precinctWidth: precinctWidth, + precinctHeight: precinctHeight, + numprecinctswide: numprecinctswide, + numprecinctshigh: numprecinctshigh, + numprecincts: numprecincts, + precinctWidthInSubband: precinctWidthInSubband, + precinctHeightInSubband: precinctHeightInSubband + }; + } + function buildCodeblocks(context, subband, dimensions) { + // Section B.7 Division sub-band into code-blocks + var xcb_ = dimensions.xcb_; + var ycb_ = dimensions.ycb_; + var codeblockWidth = 1 << xcb_; + var codeblockHeight = 1 << ycb_; + var cbx0 = subband.tbx0 >> xcb_; + var cby0 = subband.tby0 >> ycb_; + var cbx1 = (subband.tbx1 + codeblockWidth - 1) >> xcb_; + var cby1 = (subband.tby1 + codeblockHeight - 1) >> ycb_; + var precinctParameters = subband.resolution.precinctParameters; + var codeblocks = []; + var precincts = []; + var i, j, codeblock, precinctNumber; + for (j = cby0; j < cby1; j++) { + for (i = cbx0; i < cbx1; i++) { + codeblock = { + cbx: i, + cby: j, + tbx0: codeblockWidth * i, + tby0: codeblockHeight * j, + tbx1: codeblockWidth * (i + 1), + tby1: codeblockHeight * (j + 1) + }; + + codeblock.tbx0_ = Math.max(subband.tbx0, codeblock.tbx0); + codeblock.tby0_ = Math.max(subband.tby0, codeblock.tby0); + codeblock.tbx1_ = Math.min(subband.tbx1, codeblock.tbx1); + codeblock.tby1_ = Math.min(subband.tby1, codeblock.tby1); + + // Calculate precinct number for this codeblock, codeblock position + // should be relative to its subband, use actual dimension and position + // See comment about codeblock group width and height + var pi = Math.floor((codeblock.tbx0_ - subband.tbx0) / + precinctParameters.precinctWidthInSubband); + var pj = Math.floor((codeblock.tby0_ - subband.tby0) / + precinctParameters.precinctHeightInSubband); + precinctNumber = pi + (pj * precinctParameters.numprecinctswide); + + codeblock.precinctNumber = precinctNumber; + codeblock.subbandType = subband.type; + codeblock.Lblock = 3; + + if (codeblock.tbx1_ <= codeblock.tbx0_ || + codeblock.tby1_ <= codeblock.tby0_) { + continue; + } + codeblocks.push(codeblock); + // building precinct for the sub-band + var precinct = precincts[precinctNumber]; + if (precinct !== undefined) { + if (i < precinct.cbxMin) { + precinct.cbxMin = i; + } else if (i > precinct.cbxMax) { + precinct.cbxMax = i; + } + if (j < precinct.cbyMin) { + precinct.cbxMin = j; + } else if (j > precinct.cbyMax) { + precinct.cbyMax = j; + } + } else { + precincts[precinctNumber] = precinct = { + cbxMin: i, + cbyMin: j, + cbxMax: i, + cbyMax: j + }; + } + codeblock.precinct = precinct; + } + } + subband.codeblockParameters = { + codeblockWidth: xcb_, + codeblockHeight: ycb_, + numcodeblockwide: cbx1 - cbx0 + 1, + numcodeblockhigh: cby1 - cby0 + 1 + }; + subband.codeblocks = codeblocks; + subband.precincts = precincts; + } + function createPacket(resolution, precinctNumber, layerNumber) { + var precinctCodeblocks = []; + // Section B.10.8 Order of info in packet + var subbands = resolution.subbands; + // sub-bands already ordered in 'LL', 'HL', 'LH', and 'HH' sequence + for (var i = 0, ii = subbands.length; i < ii; i++) { + var subband = subbands[i]; + var codeblocks = subband.codeblocks; + for (var j = 0, jj = codeblocks.length; j < jj; j++) { + var codeblock = codeblocks[j]; + if (codeblock.precinctNumber !== precinctNumber) { + continue; + } + precinctCodeblocks.push(codeblock); + } + } + return { + layerNumber: layerNumber, + codeblocks: precinctCodeblocks + }; + } + function LayerResolutionComponentPositionIterator(context) { + var siz = context.SIZ; + var tileIndex = context.currentTile.index; + var tile = context.tiles[tileIndex]; + var layersCount = tile.codingStyleDefaultParameters.layersCount; + var componentsCount = siz.Csiz; + var maxDecompositionLevelsCount = 0; + for (var q = 0; q < componentsCount; q++) { + maxDecompositionLevelsCount = Math.max(maxDecompositionLevelsCount, + tile.components[q].codingStyleParameters.decompositionLevelsCount); + } + + var l = 0, r = 0, i = 0, k = 0; + + this.nextPacket = function JpxImage_nextPacket() { + // Section B.12.1.1 Layer-resolution-component-position + for (; l < layersCount; l++) { + for (; r <= maxDecompositionLevelsCount; r++) { + for (; i < componentsCount; i++) { + var component = tile.components[i]; + if (r > component.codingStyleParameters.decompositionLevelsCount) { + continue; + } + + var resolution = component.resolutions[r]; + var numprecincts = resolution.precinctParameters.numprecincts; + for (; k < numprecincts;) { + var packet = createPacket(resolution, k, l); + k++; + return packet; + } + k = 0; + } + i = 0; + } + r = 0; + } + throw new Error('JPX Error: Out of packets'); + }; + } + function ResolutionLayerComponentPositionIterator(context) { + var siz = context.SIZ; + var tileIndex = context.currentTile.index; + var tile = context.tiles[tileIndex]; + var layersCount = tile.codingStyleDefaultParameters.layersCount; + var componentsCount = siz.Csiz; + var maxDecompositionLevelsCount = 0; + for (var q = 0; q < componentsCount; q++) { + maxDecompositionLevelsCount = Math.max(maxDecompositionLevelsCount, + tile.components[q].codingStyleParameters.decompositionLevelsCount); + } + + var r = 0, l = 0, i = 0, k = 0; + + this.nextPacket = function JpxImage_nextPacket() { + // Section B.12.1.2 Resolution-layer-component-position + for (; r <= maxDecompositionLevelsCount; r++) { + for (; l < layersCount; l++) { + for (; i < componentsCount; i++) { + var component = tile.components[i]; + if (r > component.codingStyleParameters.decompositionLevelsCount) { + continue; + } + + var resolution = component.resolutions[r]; + var numprecincts = resolution.precinctParameters.numprecincts; + for (; k < numprecincts;) { + var packet = createPacket(resolution, k, l); + k++; + return packet; + } + k = 0; + } + i = 0; + } + l = 0; + } + throw new Error('JPX Error: Out of packets'); + }; + } + function ResolutionPositionComponentLayerIterator(context) { + var siz = context.SIZ; + var tileIndex = context.currentTile.index; + var tile = context.tiles[tileIndex]; + var layersCount = tile.codingStyleDefaultParameters.layersCount; + var componentsCount = siz.Csiz; + var l, r, c, p; + var maxDecompositionLevelsCount = 0; + for (c = 0; c < componentsCount; c++) { + var component = tile.components[c]; + maxDecompositionLevelsCount = Math.max(maxDecompositionLevelsCount, + component.codingStyleParameters.decompositionLevelsCount); + } + var maxNumPrecinctsInLevel = new Int32Array( + maxDecompositionLevelsCount + 1); + for (r = 0; r <= maxDecompositionLevelsCount; ++r) { + var maxNumPrecincts = 0; + for (c = 0; c < componentsCount; ++c) { + var resolutions = tile.components[c].resolutions; + if (r < resolutions.length) { + maxNumPrecincts = Math.max(maxNumPrecincts, + resolutions[r].precinctParameters.numprecincts); + } + } + maxNumPrecinctsInLevel[r] = maxNumPrecincts; + } + l = 0; + r = 0; + c = 0; + p = 0; + + this.nextPacket = function JpxImage_nextPacket() { + // Section B.12.1.3 Resolution-position-component-layer + for (; r <= maxDecompositionLevelsCount; r++) { + for (; p < maxNumPrecinctsInLevel[r]; p++) { + for (; c < componentsCount; c++) { + var component = tile.components[c]; + if (r > component.codingStyleParameters.decompositionLevelsCount) { + continue; + } + var resolution = component.resolutions[r]; + var numprecincts = resolution.precinctParameters.numprecincts; + if (p >= numprecincts) { + continue; + } + for (; l < layersCount;) { + var packet = createPacket(resolution, p, l); + l++; + return packet; + } + l = 0; + } + c = 0; + } + p = 0; + } + throw new Error('JPX Error: Out of packets'); + }; + } + function PositionComponentResolutionLayerIterator(context) { + var siz = context.SIZ; + var tileIndex = context.currentTile.index; + var tile = context.tiles[tileIndex]; + var layersCount = tile.codingStyleDefaultParameters.layersCount; + var componentsCount = siz.Csiz; + var precinctsSizes = getPrecinctSizesInImageScale(tile); + var precinctsIterationSizes = precinctsSizes; + var l = 0, r = 0, c = 0, px = 0, py = 0; + + this.nextPacket = function JpxImage_nextPacket() { + // Section B.12.1.4 Position-component-resolution-layer + for (; py < precinctsIterationSizes.maxNumHigh; py++) { + for (; px < precinctsIterationSizes.maxNumWide; px++) { + for (; c < componentsCount; c++) { + var component = tile.components[c]; + var decompositionLevelsCount = + component.codingStyleParameters.decompositionLevelsCount; + for (; r <= decompositionLevelsCount; r++) { + var resolution = component.resolutions[r]; + var sizeInImageScale = + precinctsSizes.components[c].resolutions[r]; + var k = getPrecinctIndexIfExist( + px, + py, + sizeInImageScale, + precinctsIterationSizes, + resolution); + if (k === null) { + continue; + } + for (; l < layersCount;) { + var packet = createPacket(resolution, k, l); + l++; + return packet; + } + l = 0; + } + r = 0; + } + c = 0; + } + px = 0; + } + throw new Error('JPX Error: Out of packets'); + }; + } + function ComponentPositionResolutionLayerIterator(context) { + var siz = context.SIZ; + var tileIndex = context.currentTile.index; + var tile = context.tiles[tileIndex]; + var layersCount = tile.codingStyleDefaultParameters.layersCount; + var componentsCount = siz.Csiz; + var precinctsSizes = getPrecinctSizesInImageScale(tile); + var l = 0, r = 0, c = 0, px = 0, py = 0; + + this.nextPacket = function JpxImage_nextPacket() { + // Section B.12.1.5 Component-position-resolution-layer + for (; c < componentsCount; ++c) { + var component = tile.components[c]; + var precinctsIterationSizes = precinctsSizes.components[c]; + var decompositionLevelsCount = + component.codingStyleParameters.decompositionLevelsCount; + for (; py < precinctsIterationSizes.maxNumHigh; py++) { + for (; px < precinctsIterationSizes.maxNumWide; px++) { + for (; r <= decompositionLevelsCount; r++) { + var resolution = component.resolutions[r]; + var sizeInImageScale = precinctsIterationSizes.resolutions[r]; + var k = getPrecinctIndexIfExist( + px, + py, + sizeInImageScale, + precinctsIterationSizes, + resolution); + if (k === null) { + continue; + } + for (; l < layersCount;) { + var packet = createPacket(resolution, k, l); + l++; + return packet; + } + l = 0; + } + r = 0; + } + px = 0; + } + py = 0; + } + throw new Error('JPX Error: Out of packets'); + }; + } + function getPrecinctIndexIfExist( + pxIndex, pyIndex, sizeInImageScale, precinctIterationSizes, resolution) { + var posX = pxIndex * precinctIterationSizes.minWidth; + var posY = pyIndex * precinctIterationSizes.minHeight; + if (posX % sizeInImageScale.width !== 0 || + posY % sizeInImageScale.height !== 0) { + return null; + } + var startPrecinctRowIndex = + (posY / sizeInImageScale.width) * + resolution.precinctParameters.numprecinctswide; + return (posX / sizeInImageScale.height) + startPrecinctRowIndex; + } + function getPrecinctSizesInImageScale(tile) { + var componentsCount = tile.components.length; + var minWidth = Number.MAX_VALUE; + var minHeight = Number.MAX_VALUE; + var maxNumWide = 0; + var maxNumHigh = 0; + var sizePerComponent = new Array(componentsCount); + for (var c = 0; c < componentsCount; c++) { + var component = tile.components[c]; + var decompositionLevelsCount = + component.codingStyleParameters.decompositionLevelsCount; + var sizePerResolution = new Array(decompositionLevelsCount + 1); + var minWidthCurrentComponent = Number.MAX_VALUE; + var minHeightCurrentComponent = Number.MAX_VALUE; + var maxNumWideCurrentComponent = 0; + var maxNumHighCurrentComponent = 0; + var scale = 1; + for (var r = decompositionLevelsCount; r >= 0; --r) { + var resolution = component.resolutions[r]; + var widthCurrentResolution = + scale * resolution.precinctParameters.precinctWidth; + var heightCurrentResolution = + scale * resolution.precinctParameters.precinctHeight; + minWidthCurrentComponent = Math.min( + minWidthCurrentComponent, + widthCurrentResolution); + minHeightCurrentComponent = Math.min( + minHeightCurrentComponent, + heightCurrentResolution); + maxNumWideCurrentComponent = Math.max(maxNumWideCurrentComponent, + resolution.precinctParameters.numprecinctswide); + maxNumHighCurrentComponent = Math.max(maxNumHighCurrentComponent, + resolution.precinctParameters.numprecinctshigh); + sizePerResolution[r] = { + width: widthCurrentResolution, + height: heightCurrentResolution + }; + scale <<= 1; + } + minWidth = Math.min(minWidth, minWidthCurrentComponent); + minHeight = Math.min(minHeight, minHeightCurrentComponent); + maxNumWide = Math.max(maxNumWide, maxNumWideCurrentComponent); + maxNumHigh = Math.max(maxNumHigh, maxNumHighCurrentComponent); + sizePerComponent[c] = { + resolutions: sizePerResolution, + minWidth: minWidthCurrentComponent, + minHeight: minHeightCurrentComponent, + maxNumWide: maxNumWideCurrentComponent, + maxNumHigh: maxNumHighCurrentComponent + }; + } + return { + components: sizePerComponent, + minWidth: minWidth, + minHeight: minHeight, + maxNumWide: maxNumWide, + maxNumHigh: maxNumHigh + }; + } + function buildPackets(context) { + var siz = context.SIZ; + var tileIndex = context.currentTile.index; + var tile = context.tiles[tileIndex]; + var componentsCount = siz.Csiz; + // Creating resolutions and sub-bands for each component + for (var c = 0; c < componentsCount; c++) { + var component = tile.components[c]; + var decompositionLevelsCount = + component.codingStyleParameters.decompositionLevelsCount; + // Section B.5 Resolution levels and sub-bands + var resolutions = []; + var subbands = []; + for (var r = 0; r <= decompositionLevelsCount; r++) { + var blocksDimensions = getBlocksDimensions(context, component, r); + var resolution = {}; + var scale = 1 << (decompositionLevelsCount - r); + resolution.trx0 = Math.ceil(component.tcx0 / scale); + resolution.try0 = Math.ceil(component.tcy0 / scale); + resolution.trx1 = Math.ceil(component.tcx1 / scale); + resolution.try1 = Math.ceil(component.tcy1 / scale); + resolution.resLevel = r; + buildPrecincts(context, resolution, blocksDimensions); + resolutions.push(resolution); + + var subband; + if (r === 0) { + // one sub-band (LL) with last decomposition + subband = {}; + subband.type = 'LL'; + subband.tbx0 = Math.ceil(component.tcx0 / scale); + subband.tby0 = Math.ceil(component.tcy0 / scale); + subband.tbx1 = Math.ceil(component.tcx1 / scale); + subband.tby1 = Math.ceil(component.tcy1 / scale); + subband.resolution = resolution; + buildCodeblocks(context, subband, blocksDimensions); + subbands.push(subband); + resolution.subbands = [subband]; + } else { + var bscale = 1 << (decompositionLevelsCount - r + 1); + var resolutionSubbands = []; + // three sub-bands (HL, LH and HH) with rest of decompositions + subband = {}; + subband.type = 'HL'; + subband.tbx0 = Math.ceil(component.tcx0 / bscale - 0.5); + subband.tby0 = Math.ceil(component.tcy0 / bscale); + subband.tbx1 = Math.ceil(component.tcx1 / bscale - 0.5); + subband.tby1 = Math.ceil(component.tcy1 / bscale); + subband.resolution = resolution; + buildCodeblocks(context, subband, blocksDimensions); + subbands.push(subband); + resolutionSubbands.push(subband); + + subband = {}; + subband.type = 'LH'; + subband.tbx0 = Math.ceil(component.tcx0 / bscale); + subband.tby0 = Math.ceil(component.tcy0 / bscale - 0.5); + subband.tbx1 = Math.ceil(component.tcx1 / bscale); + subband.tby1 = Math.ceil(component.tcy1 / bscale - 0.5); + subband.resolution = resolution; + buildCodeblocks(context, subband, blocksDimensions); + subbands.push(subband); + resolutionSubbands.push(subband); + + subband = {}; + subband.type = 'HH'; + subband.tbx0 = Math.ceil(component.tcx0 / bscale - 0.5); + subband.tby0 = Math.ceil(component.tcy0 / bscale - 0.5); + subband.tbx1 = Math.ceil(component.tcx1 / bscale - 0.5); + subband.tby1 = Math.ceil(component.tcy1 / bscale - 0.5); + subband.resolution = resolution; + buildCodeblocks(context, subband, blocksDimensions); + subbands.push(subband); + resolutionSubbands.push(subband); + + resolution.subbands = resolutionSubbands; + } + } + component.resolutions = resolutions; + component.subbands = subbands; + } + // Generate the packets sequence + var progressionOrder = tile.codingStyleDefaultParameters.progressionOrder; + switch (progressionOrder) { + case 0: + tile.packetsIterator = + new LayerResolutionComponentPositionIterator(context); + break; + case 1: + tile.packetsIterator = + new ResolutionLayerComponentPositionIterator(context); + break; + case 2: + tile.packetsIterator = + new ResolutionPositionComponentLayerIterator(context); + break; + case 3: + tile.packetsIterator = + new PositionComponentResolutionLayerIterator(context); + break; + case 4: + tile.packetsIterator = + new ComponentPositionResolutionLayerIterator(context); + break; + default: + throw new Error('JPX Error: Unsupported progression order ' + + progressionOrder); + } + } + function parseTilePackets(context, data, offset, dataLength) { + var position = 0; + var buffer, bufferSize = 0, skipNextBit = false; + function readBits(count) { + while (bufferSize < count) { + var b = data[offset + position]; + position++; + if (skipNextBit) { + buffer = (buffer << 7) | b; + bufferSize += 7; + skipNextBit = false; + } else { + buffer = (buffer << 8) | b; + bufferSize += 8; + } + if (b === 0xFF) { + skipNextBit = true; + } + } + bufferSize -= count; + return (buffer >>> bufferSize) & ((1 << count) - 1); + } + function skipMarkerIfEqual(value) { + if (data[offset + position - 1] === 0xFF && + data[offset + position] === value) { + skipBytes(1); + return true; + } else if (data[offset + position] === 0xFF && + data[offset + position + 1] === value) { + skipBytes(2); + return true; + } + return false; + } + function skipBytes(count) { + position += count; + } + function alignToByte() { + bufferSize = 0; + if (skipNextBit) { + position++; + skipNextBit = false; + } + } + function readCodingpasses() { + if (readBits(1) === 0) { + return 1; + } + if (readBits(1) === 0) { + return 2; + } + var value = readBits(2); + if (value < 3) { + return value + 3; + } + value = readBits(5); + if (value < 31) { + return value + 6; + } + value = readBits(7); + return value + 37; + } + var tileIndex = context.currentTile.index; + var tile = context.tiles[tileIndex]; + var sopMarkerUsed = context.COD.sopMarkerUsed; + var ephMarkerUsed = context.COD.ephMarkerUsed; + var packetsIterator = tile.packetsIterator; + while (position < dataLength) { + alignToByte(); + if (sopMarkerUsed && skipMarkerIfEqual(0x91)) { + // Skip also marker segment length and packet sequence ID + skipBytes(4); + } + var packet = packetsIterator.nextPacket(); + if (!readBits(1)) { + continue; + } + var layerNumber = packet.layerNumber; + var queue = [], codeblock; + for (var i = 0, ii = packet.codeblocks.length; i < ii; i++) { + codeblock = packet.codeblocks[i]; + var precinct = codeblock.precinct; + var codeblockColumn = codeblock.cbx - precinct.cbxMin; + var codeblockRow = codeblock.cby - precinct.cbyMin; + var codeblockIncluded = false; + var firstTimeInclusion = false; + var valueReady; + if (codeblock['included'] !== undefined) { + codeblockIncluded = !!readBits(1); + } else { + // reading inclusion tree + precinct = codeblock.precinct; + var inclusionTree, zeroBitPlanesTree; + if (precinct['inclusionTree'] !== undefined) { + inclusionTree = precinct.inclusionTree; + } else { + // building inclusion and zero bit-planes trees + var width = precinct.cbxMax - precinct.cbxMin + 1; + var height = precinct.cbyMax - precinct.cbyMin + 1; + inclusionTree = new InclusionTree(width, height, layerNumber); + zeroBitPlanesTree = new TagTree(width, height); + precinct.inclusionTree = inclusionTree; + precinct.zeroBitPlanesTree = zeroBitPlanesTree; + } + + if (inclusionTree.reset(codeblockColumn, codeblockRow, layerNumber)) { + while (true) { + if (readBits(1)) { + valueReady = !inclusionTree.nextLevel(); + if (valueReady) { + codeblock.included = true; + codeblockIncluded = firstTimeInclusion = true; + break; + } + } else { + inclusionTree.incrementValue(layerNumber); + break; + } + } + } + } + if (!codeblockIncluded) { + continue; + } + if (firstTimeInclusion) { + zeroBitPlanesTree = precinct.zeroBitPlanesTree; + zeroBitPlanesTree.reset(codeblockColumn, codeblockRow); + while (true) { + if (readBits(1)) { + valueReady = !zeroBitPlanesTree.nextLevel(); + if (valueReady) { + break; + } + } else { + zeroBitPlanesTree.incrementValue(); + } + } + codeblock.zeroBitPlanes = zeroBitPlanesTree.value; + } + var codingpasses = readCodingpasses(); + while (readBits(1)) { + codeblock.Lblock++; + } + var codingpassesLog2 = log2(codingpasses); + // rounding down log2 + var bits = ((codingpasses < (1 << codingpassesLog2)) ? + codingpassesLog2 - 1 : codingpassesLog2) + codeblock.Lblock; + var codedDataLength = readBits(bits); + queue.push({ + codeblock: codeblock, + codingpasses: codingpasses, + dataLength: codedDataLength + }); + } + alignToByte(); + if (ephMarkerUsed) { + skipMarkerIfEqual(0x92); + } + while (queue.length > 0) { + var packetItem = queue.shift(); + codeblock = packetItem.codeblock; + if (codeblock['data'] === undefined) { + codeblock.data = []; + } + codeblock.data.push({ + data: data, + start: offset + position, + end: offset + position + packetItem.dataLength, + codingpasses: packetItem.codingpasses + }); + position += packetItem.dataLength; + } + } + return position; + } + function copyCoefficients(coefficients, levelWidth, levelHeight, subband, + delta, mb, reversible, segmentationSymbolUsed) { + var x0 = subband.tbx0; + var y0 = subband.tby0; + var width = subband.tbx1 - subband.tbx0; + var codeblocks = subband.codeblocks; + var right = subband.type.charAt(0) === 'H' ? 1 : 0; + var bottom = subband.type.charAt(1) === 'H' ? levelWidth : 0; + + for (var i = 0, ii = codeblocks.length; i < ii; ++i) { + var codeblock = codeblocks[i]; + var blockWidth = codeblock.tbx1_ - codeblock.tbx0_; + var blockHeight = codeblock.tby1_ - codeblock.tby0_; + if (blockWidth === 0 || blockHeight === 0) { + continue; + } + if (codeblock['data'] === undefined) { + continue; + } + + var bitModel, currentCodingpassType; + bitModel = new BitModel(blockWidth, blockHeight, codeblock.subbandType, + codeblock.zeroBitPlanes, mb); + currentCodingpassType = 2; // first bit plane starts from cleanup + + // collect data + var data = codeblock.data, totalLength = 0, codingpasses = 0; + var j, jj, dataItem; + for (j = 0, jj = data.length; j < jj; j++) { + dataItem = data[j]; + totalLength += dataItem.end - dataItem.start; + codingpasses += dataItem.codingpasses; + } + var encodedData = new Uint8Array(totalLength); + var position = 0; + for (j = 0, jj = data.length; j < jj; j++) { + dataItem = data[j]; + var chunk = dataItem.data.subarray(dataItem.start, dataItem.end); + encodedData.set(chunk, position); + position += chunk.length; + } + // decoding the item + var decoder = new ArithmeticDecoder(encodedData, 0, totalLength); + bitModel.setDecoder(decoder); + + for (j = 0; j < codingpasses; j++) { + switch (currentCodingpassType) { + case 0: + bitModel.runSignificancePropogationPass(); + break; + case 1: + bitModel.runMagnitudeRefinementPass(); + break; + case 2: + bitModel.runCleanupPass(); + if (segmentationSymbolUsed) { + bitModel.checkSegmentationSymbol(); + } + break; + } + currentCodingpassType = (currentCodingpassType + 1) % 3; + } + + var offset = (codeblock.tbx0_ - x0) + (codeblock.tby0_ - y0) * width; + var sign = bitModel.coefficentsSign; + var magnitude = bitModel.coefficentsMagnitude; + var bitsDecoded = bitModel.bitsDecoded; + var magnitudeCorrection = reversible ? 0 : 0.5; + var k, n, nb; + position = 0; + // Do the interleaving of Section F.3.3 here, so we do not need + // to copy later. LL level is not interleaved, just copied. + var interleave = (subband.type !== 'LL'); + for (j = 0; j < blockHeight; j++) { + var row = (offset / width) | 0; // row in the non-interleaved subband + var levelOffset = 2 * row * (levelWidth - width) + right + bottom; + for (k = 0; k < blockWidth; k++) { + n = magnitude[position]; + if (n !== 0) { + n = (n + magnitudeCorrection) * delta; + if (sign[position] !== 0) { + n = -n; + } + nb = bitsDecoded[position]; + var pos = interleave ? (levelOffset + (offset << 1)) : offset; + if (reversible && (nb >= mb)) { + coefficients[pos] = n; + } else { + coefficients[pos] = n * (1 << (mb - nb)); + } + } + offset++; + position++; + } + offset += width - blockWidth; + } + } + } + function transformTile(context, tile, c) { + var component = tile.components[c]; + var codingStyleParameters = component.codingStyleParameters; + var quantizationParameters = component.quantizationParameters; + var decompositionLevelsCount = + codingStyleParameters.decompositionLevelsCount; + var spqcds = quantizationParameters.SPqcds; + var scalarExpounded = quantizationParameters.scalarExpounded; + var guardBits = quantizationParameters.guardBits; + var segmentationSymbolUsed = codingStyleParameters.segmentationSymbolUsed; + var precision = context.components[c].precision; + + var reversible = codingStyleParameters.reversibleTransformation; + var transform = (reversible ? new ReversibleTransform() : + new IrreversibleTransform()); + + var subbandCoefficients = []; + var b = 0; + for (var i = 0; i <= decompositionLevelsCount; i++) { + var resolution = component.resolutions[i]; + + var width = resolution.trx1 - resolution.trx0; + var height = resolution.try1 - resolution.try0; + // Allocate space for the whole sublevel. + var coefficients = new Float32Array(width * height); + + for (var j = 0, jj = resolution.subbands.length; j < jj; j++) { + var mu, epsilon; + if (!scalarExpounded) { + // formula E-5 + mu = spqcds[0].mu; + epsilon = spqcds[0].epsilon + (i > 0 ? 1 - i : 0); + } else { + mu = spqcds[b].mu; + epsilon = spqcds[b].epsilon; + b++; + } + + var subband = resolution.subbands[j]; + var gainLog2 = SubbandsGainLog2[subband.type]; + + // calulate quantization coefficient (Section E.1.1.1) + var delta = (reversible ? 1 : + Math.pow(2, precision + gainLog2 - epsilon) * (1 + mu / 2048)); + var mb = (guardBits + epsilon - 1); + + // In the first resolution level, copyCoefficients will fill the + // whole array with coefficients. In the succeding passes, + // copyCoefficients will consecutively fill in the values that belong + // to the interleaved positions of the HL, LH, and HH coefficients. + // The LL coefficients will then be interleaved in Transform.iterate(). + copyCoefficients(coefficients, width, height, subband, delta, mb, + reversible, segmentationSymbolUsed); + } + subbandCoefficients.push({ + width: width, + height: height, + items: coefficients + }); + } + + var result = transform.calculate(subbandCoefficients, + component.tcx0, component.tcy0); + return { + left: component.tcx0, + top: component.tcy0, + width: result.width, + height: result.height, + items: result.items + }; + } + function transformComponents(context) { + var siz = context.SIZ; + var components = context.components; + var componentsCount = siz.Csiz; + var resultImages = []; + for (var i = 0, ii = context.tiles.length; i < ii; i++) { + var tile = context.tiles[i]; + var transformedTiles = []; + var c; + for (c = 0; c < componentsCount; c++) { + transformedTiles[c] = transformTile(context, tile, c); + } + var tile0 = transformedTiles[0]; + var out = new Uint8Array(tile0.items.length * componentsCount); + var result = { + left: tile0.left, + top: tile0.top, + width: tile0.width, + height: tile0.height, + items: out + }; + + // Section G.2.2 Inverse multi component transform + var shift, offset, max, min, maxK; + var pos = 0, j, jj, y0, y1, y2, r, g, b, k, val; + if (tile.codingStyleDefaultParameters.multipleComponentTransform) { + var fourComponents = componentsCount === 4; + var y0items = transformedTiles[0].items; + var y1items = transformedTiles[1].items; + var y2items = transformedTiles[2].items; + var y3items = fourComponents ? transformedTiles[3].items : null; + + // HACK: The multiple component transform formulas below assume that + // all components have the same precision. With this in mind, we + // compute shift and offset only once. + shift = components[0].precision - 8; + offset = (128 << shift) + 0.5; + max = 255 * (1 << shift); + maxK = max * 0.5; + min = -maxK; + + var component0 = tile.components[0]; + var alpha01 = componentsCount - 3; + jj = y0items.length; + if (!component0.codingStyleParameters.reversibleTransformation) { + // inverse irreversible multiple component transform + for (j = 0; j < jj; j++, pos += alpha01) { + y0 = y0items[j] + offset; + y1 = y1items[j]; + y2 = y2items[j]; + r = y0 + 1.402 * y2; + g = y0 - 0.34413 * y1 - 0.71414 * y2; + b = y0 + 1.772 * y1; + out[pos++] = r <= 0 ? 0 : r >= max ? 255 : r >> shift; + out[pos++] = g <= 0 ? 0 : g >= max ? 255 : g >> shift; + out[pos++] = b <= 0 ? 0 : b >= max ? 255 : b >> shift; + } + } else { + // inverse reversible multiple component transform + for (j = 0; j < jj; j++, pos += alpha01) { + y0 = y0items[j] + offset; + y1 = y1items[j]; + y2 = y2items[j]; + g = y0 - ((y2 + y1) >> 2); + r = g + y2; + b = g + y1; + out[pos++] = r <= 0 ? 0 : r >= max ? 255 : r >> shift; + out[pos++] = g <= 0 ? 0 : g >= max ? 255 : g >> shift; + out[pos++] = b <= 0 ? 0 : b >= max ? 255 : b >> shift; + } + } + if (fourComponents) { + for (j = 0, pos = 3; j < jj; j++, pos += 4) { + k = y3items[j]; + out[pos] = k <= min ? 0 : k >= maxK ? 255 : (k + offset) >> shift; + } + } + } else { // no multi-component transform + for (c = 0; c < componentsCount; c++) { + var items = transformedTiles[c].items; + shift = components[c].precision - 8; + offset = (128 << shift) + 0.5; + max = (127.5 * (1 << shift)); + min = -max; + for (pos = c, j = 0, jj = items.length; j < jj; j++) { + val = items[j]; + out[pos] = val <= min ? 0 : + val >= max ? 255 : (val + offset) >> shift; + pos += componentsCount; + } + } + } + resultImages.push(result); + } + return resultImages; + } + function initializeTile(context, tileIndex) { + var siz = context.SIZ; + var componentsCount = siz.Csiz; + var tile = context.tiles[tileIndex]; + for (var c = 0; c < componentsCount; c++) { + var component = tile.components[c]; + var qcdOrQcc = (context.currentTile.QCC[c] !== undefined ? + context.currentTile.QCC[c] : context.currentTile.QCD); + component.quantizationParameters = qcdOrQcc; + var codOrCoc = (context.currentTile.COC[c] !== undefined ? + context.currentTile.COC[c] : context.currentTile.COD); + component.codingStyleParameters = codOrCoc; + } + tile.codingStyleDefaultParameters = context.currentTile.COD; + } + + // Section B.10.2 Tag trees + var TagTree = (function TagTreeClosure() { + function TagTree(width, height) { + var levelsLength = log2(Math.max(width, height)) + 1; + this.levels = []; + for (var i = 0; i < levelsLength; i++) { + var level = { + width: width, + height: height, + items: [] + }; + this.levels.push(level); + width = Math.ceil(width / 2); + height = Math.ceil(height / 2); + } + } + TagTree.prototype = { + reset: function TagTree_reset(i, j) { + var currentLevel = 0, value = 0, level; + while (currentLevel < this.levels.length) { + level = this.levels[currentLevel]; + var index = i + j * level.width; + if (level.items[index] !== undefined) { + value = level.items[index]; + break; + } + level.index = index; + i >>= 1; + j >>= 1; + currentLevel++; + } + currentLevel--; + level = this.levels[currentLevel]; + level.items[level.index] = value; + this.currentLevel = currentLevel; + delete this.value; + }, + incrementValue: function TagTree_incrementValue() { + var level = this.levels[this.currentLevel]; + level.items[level.index]++; + }, + nextLevel: function TagTree_nextLevel() { + var currentLevel = this.currentLevel; + var level = this.levels[currentLevel]; + var value = level.items[level.index]; + currentLevel--; + if (currentLevel < 0) { + this.value = value; + return false; + } + + this.currentLevel = currentLevel; + level = this.levels[currentLevel]; + level.items[level.index] = value; + return true; + } + }; + return TagTree; + })(); + + var InclusionTree = (function InclusionTreeClosure() { + function InclusionTree(width, height, defaultValue) { + var levelsLength = log2(Math.max(width, height)) + 1; + this.levels = []; + for (var i = 0; i < levelsLength; i++) { + var items = new Uint8Array(width * height); + for (var j = 0, jj = items.length; j < jj; j++) { + items[j] = defaultValue; + } + + var level = { + width: width, + height: height, + items: items + }; + this.levels.push(level); + + width = Math.ceil(width / 2); + height = Math.ceil(height / 2); + } + } + InclusionTree.prototype = { + reset: function InclusionTree_reset(i, j, stopValue) { + var currentLevel = 0; + while (currentLevel < this.levels.length) { + var level = this.levels[currentLevel]; + var index = i + j * level.width; + level.index = index; + var value = level.items[index]; + + if (value === 0xFF) { + break; + } + + if (value > stopValue) { + this.currentLevel = currentLevel; + // already know about this one, propagating the value to top levels + this.propagateValues(); + return false; + } + + i >>= 1; + j >>= 1; + currentLevel++; + } + this.currentLevel = currentLevel - 1; + return true; + }, + incrementValue: function InclusionTree_incrementValue(stopValue) { + var level = this.levels[this.currentLevel]; + level.items[level.index] = stopValue + 1; + this.propagateValues(); + }, + propagateValues: function InclusionTree_propagateValues() { + var levelIndex = this.currentLevel; + var level = this.levels[levelIndex]; + var currentValue = level.items[level.index]; + while (--levelIndex >= 0) { + level = this.levels[levelIndex]; + level.items[level.index] = currentValue; + } + }, + nextLevel: function InclusionTree_nextLevel() { + var currentLevel = this.currentLevel; + var level = this.levels[currentLevel]; + var value = level.items[level.index]; + level.items[level.index] = 0xFF; + currentLevel--; + if (currentLevel < 0) { + return false; + } + + this.currentLevel = currentLevel; + level = this.levels[currentLevel]; + level.items[level.index] = value; + return true; + } + }; + return InclusionTree; + })(); + + // Section D. Coefficient bit modeling + var BitModel = (function BitModelClosure() { + var UNIFORM_CONTEXT = 17; + var RUNLENGTH_CONTEXT = 18; + // Table D-1 + // The index is binary presentation: 0dddvvhh, ddd - sum of Di (0..4), + // vv - sum of Vi (0..2), and hh - sum of Hi (0..2) + var LLAndLHContextsLabel = new Uint8Array([ + 0, 5, 8, 0, 3, 7, 8, 0, 4, 7, 8, 0, 0, 0, 0, 0, 1, 6, 8, 0, 3, 7, 8, 0, 4, + 7, 8, 0, 0, 0, 0, 0, 2, 6, 8, 0, 3, 7, 8, 0, 4, 7, 8, 0, 0, 0, 0, 0, 2, 6, + 8, 0, 3, 7, 8, 0, 4, 7, 8, 0, 0, 0, 0, 0, 2, 6, 8, 0, 3, 7, 8, 0, 4, 7, 8 + ]); + var HLContextLabel = new Uint8Array([ + 0, 3, 4, 0, 5, 7, 7, 0, 8, 8, 8, 0, 0, 0, 0, 0, 1, 3, 4, 0, 6, 7, 7, 0, 8, + 8, 8, 0, 0, 0, 0, 0, 2, 3, 4, 0, 6, 7, 7, 0, 8, 8, 8, 0, 0, 0, 0, 0, 2, 3, + 4, 0, 6, 7, 7, 0, 8, 8, 8, 0, 0, 0, 0, 0, 2, 3, 4, 0, 6, 7, 7, 0, 8, 8, 8 + ]); + var HHContextLabel = new Uint8Array([ + 0, 1, 2, 0, 1, 2, 2, 0, 2, 2, 2, 0, 0, 0, 0, 0, 3, 4, 5, 0, 4, 5, 5, 0, 5, + 5, 5, 0, 0, 0, 0, 0, 6, 7, 7, 0, 7, 7, 7, 0, 7, 7, 7, 0, 0, 0, 0, 0, 8, 8, + 8, 0, 8, 8, 8, 0, 8, 8, 8, 0, 0, 0, 0, 0, 8, 8, 8, 0, 8, 8, 8, 0, 8, 8, 8 + ]); + + function BitModel(width, height, subband, zeroBitPlanes, mb) { + this.width = width; + this.height = height; + + this.contextLabelTable = (subband === 'HH' ? HHContextLabel : + (subband === 'HL' ? HLContextLabel : LLAndLHContextsLabel)); + + var coefficientCount = width * height; + + // coefficients outside the encoding region treated as insignificant + // add border state cells for significanceState + this.neighborsSignificance = new Uint8Array(coefficientCount); + this.coefficentsSign = new Uint8Array(coefficientCount); + this.coefficentsMagnitude = mb > 14 ? new Uint32Array(coefficientCount) : + mb > 6 ? new Uint16Array(coefficientCount) : + new Uint8Array(coefficientCount); + this.processingFlags = new Uint8Array(coefficientCount); + + var bitsDecoded = new Uint8Array(coefficientCount); + if (zeroBitPlanes !== 0) { + for (var i = 0; i < coefficientCount; i++) { + bitsDecoded[i] = zeroBitPlanes; + } + } + this.bitsDecoded = bitsDecoded; + + this.reset(); + } + + BitModel.prototype = { + setDecoder: function BitModel_setDecoder(decoder) { + this.decoder = decoder; + }, + reset: function BitModel_reset() { + // We have 17 contexts that are accessed via context labels, + // plus the uniform and runlength context. + this.contexts = new Int8Array(19); + + // Contexts are packed into 1 byte: + // highest 7 bits carry the index, lowest bit carries mps + this.contexts[0] = (4 << 1) | 0; + this.contexts[UNIFORM_CONTEXT] = (46 << 1) | 0; + this.contexts[RUNLENGTH_CONTEXT] = (3 << 1) | 0; + }, + setNeighborsSignificance: + function BitModel_setNeighborsSignificance(row, column, index) { + var neighborsSignificance = this.neighborsSignificance; + var width = this.width, height = this.height; + var left = (column > 0); + var right = (column + 1 < width); + var i; + + if (row > 0) { + i = index - width; + if (left) { + neighborsSignificance[i - 1] += 0x10; + } + if (right) { + neighborsSignificance[i + 1] += 0x10; + } + neighborsSignificance[i] += 0x04; + } + + if (row + 1 < height) { + i = index + width; + if (left) { + neighborsSignificance[i - 1] += 0x10; + } + if (right) { + neighborsSignificance[i + 1] += 0x10; + } + neighborsSignificance[i] += 0x04; + } + + if (left) { + neighborsSignificance[index - 1] += 0x01; + } + if (right) { + neighborsSignificance[index + 1] += 0x01; + } + neighborsSignificance[index] |= 0x80; + }, + runSignificancePropogationPass: + function BitModel_runSignificancePropogationPass() { + var decoder = this.decoder; + var width = this.width, height = this.height; + var coefficentsMagnitude = this.coefficentsMagnitude; + var coefficentsSign = this.coefficentsSign; + var neighborsSignificance = this.neighborsSignificance; + var processingFlags = this.processingFlags; + var contexts = this.contexts; + var labels = this.contextLabelTable; + var bitsDecoded = this.bitsDecoded; + var processedInverseMask = ~1; + var processedMask = 1; + var firstMagnitudeBitMask = 2; + + for (var i0 = 0; i0 < height; i0 += 4) { + for (var j = 0; j < width; j++) { + var index = i0 * width + j; + for (var i1 = 0; i1 < 4; i1++, index += width) { + var i = i0 + i1; + if (i >= height) { + break; + } + // clear processed flag first + processingFlags[index] &= processedInverseMask; + + if (coefficentsMagnitude[index] || + !neighborsSignificance[index]) { + continue; + } + + var contextLabel = labels[neighborsSignificance[index]]; + var decision = decoder.readBit(contexts, contextLabel); + if (decision) { + var sign = this.decodeSignBit(i, j, index); + coefficentsSign[index] = sign; + coefficentsMagnitude[index] = 1; + this.setNeighborsSignificance(i, j, index); + processingFlags[index] |= firstMagnitudeBitMask; + } + bitsDecoded[index]++; + processingFlags[index] |= processedMask; + } + } + } + }, + decodeSignBit: function BitModel_decodeSignBit(row, column, index) { + var width = this.width, height = this.height; + var coefficentsMagnitude = this.coefficentsMagnitude; + var coefficentsSign = this.coefficentsSign; + var contribution, sign0, sign1, significance1; + var contextLabel, decoded; + + // calculate horizontal contribution + significance1 = (column > 0 && coefficentsMagnitude[index - 1] !== 0); + if (column + 1 < width && coefficentsMagnitude[index + 1] !== 0) { + sign1 = coefficentsSign[index + 1]; + if (significance1) { + sign0 = coefficentsSign[index - 1]; + contribution = 1 - sign1 - sign0; + } else { + contribution = 1 - sign1 - sign1; + } + } else if (significance1) { + sign0 = coefficentsSign[index - 1]; + contribution = 1 - sign0 - sign0; + } else { + contribution = 0; + } + var horizontalContribution = 3 * contribution; + + // calculate vertical contribution and combine with the horizontal + significance1 = (row > 0 && coefficentsMagnitude[index - width] !== 0); + if (row + 1 < height && coefficentsMagnitude[index + width] !== 0) { + sign1 = coefficentsSign[index + width]; + if (significance1) { + sign0 = coefficentsSign[index - width]; + contribution = 1 - sign1 - sign0 + horizontalContribution; + } else { + contribution = 1 - sign1 - sign1 + horizontalContribution; + } + } else if (significance1) { + sign0 = coefficentsSign[index - width]; + contribution = 1 - sign0 - sign0 + horizontalContribution; + } else { + contribution = horizontalContribution; + } + + if (contribution >= 0) { + contextLabel = 9 + contribution; + decoded = this.decoder.readBit(this.contexts, contextLabel); + } else { + contextLabel = 9 - contribution; + decoded = this.decoder.readBit(this.contexts, contextLabel) ^ 1; + } + return decoded; + }, + runMagnitudeRefinementPass: + function BitModel_runMagnitudeRefinementPass() { + var decoder = this.decoder; + var width = this.width, height = this.height; + var coefficentsMagnitude = this.coefficentsMagnitude; + var neighborsSignificance = this.neighborsSignificance; + var contexts = this.contexts; + var bitsDecoded = this.bitsDecoded; + var processingFlags = this.processingFlags; + var processedMask = 1; + var firstMagnitudeBitMask = 2; + var length = width * height; + var width4 = width * 4; + + for (var index0 = 0, indexNext; index0 < length; index0 = indexNext) { + indexNext = Math.min(length, index0 + width4); + for (var j = 0; j < width; j++) { + for (var index = index0 + j; index < indexNext; index += width) { + + // significant but not those that have just become + if (!coefficentsMagnitude[index] || + (processingFlags[index] & processedMask) !== 0) { + continue; + } + + var contextLabel = 16; + if ((processingFlags[index] & firstMagnitudeBitMask) !== 0) { + processingFlags[index] ^= firstMagnitudeBitMask; + // first refinement + var significance = neighborsSignificance[index] & 127; + contextLabel = significance === 0 ? 15 : 14; + } + + var bit = decoder.readBit(contexts, contextLabel); + coefficentsMagnitude[index] = + (coefficentsMagnitude[index] << 1) | bit; + bitsDecoded[index]++; + processingFlags[index] |= processedMask; + } + } + } + }, + runCleanupPass: function BitModel_runCleanupPass() { + var decoder = this.decoder; + var width = this.width, height = this.height; + var neighborsSignificance = this.neighborsSignificance; + var coefficentsMagnitude = this.coefficentsMagnitude; + var coefficentsSign = this.coefficentsSign; + var contexts = this.contexts; + var labels = this.contextLabelTable; + var bitsDecoded = this.bitsDecoded; + var processingFlags = this.processingFlags; + var processedMask = 1; + var firstMagnitudeBitMask = 2; + var oneRowDown = width; + var twoRowsDown = width * 2; + var threeRowsDown = width * 3; + var iNext; + for (var i0 = 0; i0 < height; i0 = iNext) { + iNext = Math.min(i0 + 4, height); + var indexBase = i0 * width; + var checkAllEmpty = i0 + 3 < height; + for (var j = 0; j < width; j++) { + var index0 = indexBase + j; + // using the property: labels[neighborsSignificance[index]] === 0 + // when neighborsSignificance[index] === 0 + var allEmpty = (checkAllEmpty && + processingFlags[index0] === 0 && + processingFlags[index0 + oneRowDown] === 0 && + processingFlags[index0 + twoRowsDown] === 0 && + processingFlags[index0 + threeRowsDown] === 0 && + neighborsSignificance[index0] === 0 && + neighborsSignificance[index0 + oneRowDown] === 0 && + neighborsSignificance[index0 + twoRowsDown] === 0 && + neighborsSignificance[index0 + threeRowsDown] === 0); + var i1 = 0, index = index0; + var i = i0, sign; + if (allEmpty) { + var hasSignificantCoefficent = + decoder.readBit(contexts, RUNLENGTH_CONTEXT); + if (!hasSignificantCoefficent) { + bitsDecoded[index0]++; + bitsDecoded[index0 + oneRowDown]++; + bitsDecoded[index0 + twoRowsDown]++; + bitsDecoded[index0 + threeRowsDown]++; + continue; // next column + } + i1 = (decoder.readBit(contexts, UNIFORM_CONTEXT) << 1) | + decoder.readBit(contexts, UNIFORM_CONTEXT); + if (i1 !== 0) { + i = i0 + i1; + index += i1 * width; + } + + sign = this.decodeSignBit(i, j, index); + coefficentsSign[index] = sign; + coefficentsMagnitude[index] = 1; + this.setNeighborsSignificance(i, j, index); + processingFlags[index] |= firstMagnitudeBitMask; + + index = index0; + for (var i2 = i0; i2 <= i; i2++, index += width) { + bitsDecoded[index]++; + } + + i1++; + } + for (i = i0 + i1; i < iNext; i++, index += width) { + if (coefficentsMagnitude[index] || + (processingFlags[index] & processedMask) !== 0) { + continue; + } + + var contextLabel = labels[neighborsSignificance[index]]; + var decision = decoder.readBit(contexts, contextLabel); + if (decision === 1) { + sign = this.decodeSignBit(i, j, index); + coefficentsSign[index] = sign; + coefficentsMagnitude[index] = 1; + this.setNeighborsSignificance(i, j, index); + processingFlags[index] |= firstMagnitudeBitMask; + } + bitsDecoded[index]++; + } + } + } + }, + checkSegmentationSymbol: function BitModel_checkSegmentationSymbol() { + var decoder = this.decoder; + var contexts = this.contexts; + var symbol = (decoder.readBit(contexts, UNIFORM_CONTEXT) << 3) | + (decoder.readBit(contexts, UNIFORM_CONTEXT) << 2) | + (decoder.readBit(contexts, UNIFORM_CONTEXT) << 1) | + decoder.readBit(contexts, UNIFORM_CONTEXT); + if (symbol !== 0xA) { + throw new Error('JPX Error: Invalid segmentation symbol'); + } + } + }; + + return BitModel; + })(); + + // Section F, Discrete wavelet transformation + var Transform = (function TransformClosure() { + function Transform() {} + + Transform.prototype.calculate = + function transformCalculate(subbands, u0, v0) { + var ll = subbands[0]; + for (var i = 1, ii = subbands.length; i < ii; i++) { + ll = this.iterate(ll, subbands[i], u0, v0); + } + return ll; + }; + Transform.prototype.extend = function extend(buffer, offset, size) { + // Section F.3.7 extending... using max extension of 4 + var i1 = offset - 1, j1 = offset + 1; + var i2 = offset + size - 2, j2 = offset + size; + buffer[i1--] = buffer[j1++]; + buffer[j2++] = buffer[i2--]; + buffer[i1--] = buffer[j1++]; + buffer[j2++] = buffer[i2--]; + buffer[i1--] = buffer[j1++]; + buffer[j2++] = buffer[i2--]; + buffer[i1] = buffer[j1]; + buffer[j2] = buffer[i2]; + }; + Transform.prototype.iterate = function Transform_iterate(ll, hl_lh_hh, + u0, v0) { + var llWidth = ll.width, llHeight = ll.height, llItems = ll.items; + var width = hl_lh_hh.width; + var height = hl_lh_hh.height; + var items = hl_lh_hh.items; + var i, j, k, l, u, v; + + // Interleave LL according to Section F.3.3 + for (k = 0, i = 0; i < llHeight; i++) { + l = i * 2 * width; + for (j = 0; j < llWidth; j++, k++, l += 2) { + items[l] = llItems[k]; + } + } + // The LL band is not needed anymore. + llItems = ll.items = null; + + var bufferPadding = 4; + var rowBuffer = new Float32Array(width + 2 * bufferPadding); + + // Section F.3.4 HOR_SR + if (width === 1) { + // if width = 1, when u0 even keep items as is, when odd divide by 2 + if ((u0 & 1) !== 0) { + for (v = 0, k = 0; v < height; v++, k += width) { + items[k] *= 0.5; + } + } + } else { + for (v = 0, k = 0; v < height; v++, k += width) { + rowBuffer.set(items.subarray(k, k + width), bufferPadding); + + this.extend(rowBuffer, bufferPadding, width); + this.filter(rowBuffer, bufferPadding, width); + + items.set( + rowBuffer.subarray(bufferPadding, bufferPadding + width), + k); + } + } + + // Accesses to the items array can take long, because it may not fit into + // CPU cache and has to be fetched from main memory. Since subsequent + // accesses to the items array are not local when reading columns, we + // have a cache miss every time. To reduce cache misses, get up to + // 'numBuffers' items at a time and store them into the individual + // buffers. The colBuffers should be small enough to fit into CPU cache. + var numBuffers = 16; + var colBuffers = []; + for (i = 0; i < numBuffers; i++) { + colBuffers.push(new Float32Array(height + 2 * bufferPadding)); + } + var b, currentBuffer = 0; + ll = bufferPadding + height; + + // Section F.3.5 VER_SR + if (height === 1) { + // if height = 1, when v0 even keep items as is, when odd divide by 2 + if ((v0 & 1) !== 0) { + for (u = 0; u < width; u++) { + items[u] *= 0.5; + } + } + } else { + for (u = 0; u < width; u++) { + // if we ran out of buffers, copy several image columns at once + if (currentBuffer === 0) { + numBuffers = Math.min(width - u, numBuffers); + for (k = u, l = bufferPadding; l < ll; k += width, l++) { + for (b = 0; b < numBuffers; b++) { + colBuffers[b][l] = items[k + b]; + } + } + currentBuffer = numBuffers; + } + + currentBuffer--; + var buffer = colBuffers[currentBuffer]; + this.extend(buffer, bufferPadding, height); + this.filter(buffer, bufferPadding, height); + + // If this is last buffer in this group of buffers, flush all buffers. + if (currentBuffer === 0) { + k = u - numBuffers + 1; + for (l = bufferPadding; l < ll; k += width, l++) { + for (b = 0; b < numBuffers; b++) { + items[k + b] = colBuffers[b][l]; + } + } + } + } + } + + return { + width: width, + height: height, + items: items + }; + }; + return Transform; + })(); + + // Section 3.8.2 Irreversible 9-7 filter + var IrreversibleTransform = (function IrreversibleTransformClosure() { + function IrreversibleTransform() { + Transform.call(this); + } + + IrreversibleTransform.prototype = Object.create(Transform.prototype); + IrreversibleTransform.prototype.filter = + function irreversibleTransformFilter(x, offset, length) { + var len = length >> 1; + offset = offset | 0; + var j, n, current, next; + + var alpha = -1.586134342059924; + var beta = -0.052980118572961; + var gamma = 0.882911075530934; + var delta = 0.443506852043971; + var K = 1.230174104914001; + var K_ = 1 / K; + + // step 1 is combined with step 3 + + // step 2 + j = offset - 3; + for (n = len + 4; n--; j += 2) { + x[j] *= K_; + } + + // step 1 & 3 + j = offset - 2; + current = delta * x[j -1]; + for (n = len + 3; n--; j += 2) { + next = delta * x[j + 1]; + x[j] = K * x[j] - current - next; + if (n--) { + j += 2; + current = delta * x[j + 1]; + x[j] = K * x[j] - current - next; + } else { + break; + } + } + + // step 4 + j = offset - 1; + current = gamma * x[j - 1]; + for (n = len + 2; n--; j += 2) { + next = gamma * x[j + 1]; + x[j] -= current + next; + if (n--) { + j += 2; + current = gamma * x[j + 1]; + x[j] -= current + next; + } else { + break; + } + } + + // step 5 + j = offset; + current = beta * x[j - 1]; + for (n = len + 1; n--; j += 2) { + next = beta * x[j + 1]; + x[j] -= current + next; + if (n--) { + j += 2; + current = beta * x[j + 1]; + x[j] -= current + next; + } else { + break; + } + } + + // step 6 + if (len !== 0) { + j = offset + 1; + current = alpha * x[j - 1]; + for (n = len; n--; j += 2) { + next = alpha * x[j + 1]; + x[j] -= current + next; + if (n--) { + j += 2; + current = alpha * x[j + 1]; + x[j] -= current + next; + } else { + break; + } + } + } + }; + + return IrreversibleTransform; + })(); + + // Section 3.8.1 Reversible 5-3 filter + var ReversibleTransform = (function ReversibleTransformClosure() { + function ReversibleTransform() { + Transform.call(this); + } + + ReversibleTransform.prototype = Object.create(Transform.prototype); + ReversibleTransform.prototype.filter = + function reversibleTransformFilter(x, offset, length) { + var len = length >> 1; + offset = offset | 0; + var j, n; + + for (j = offset, n = len + 1; n--; j += 2) { + x[j] -= (x[j - 1] + x[j + 1] + 2) >> 2; + } + + for (j = offset + 1, n = len; n--; j += 2) { + x[j] += (x[j - 1] + x[j + 1]) >> 1; + } + }; + + return ReversibleTransform; + })(); + + return JpxImage; +})(); + + +var Jbig2Image = (function Jbig2ImageClosure() { + // Utility data structures + function ContextCache() {} + + ContextCache.prototype = { + getContexts: function(id) { + if (id in this) { + return this[id]; + } + return (this[id] = new Int8Array(1 << 16)); + } + }; + + function DecodingContext(data, start, end) { + this.data = data; + this.start = start; + this.end = end; + } + + DecodingContext.prototype = { + get decoder() { + var decoder = new ArithmeticDecoder(this.data, this.start, this.end); + return shadow(this, 'decoder', decoder); + }, + get contextCache() { + var cache = new ContextCache(); + return shadow(this, 'contextCache', cache); + } + }; + + // Annex A. Arithmetic Integer Decoding Procedure + // A.2 Procedure for decoding values + function decodeInteger(contextCache, procedure, decoder) { + var contexts = contextCache.getContexts(procedure); + var prev = 1; + + function readBits(length) { + var v = 0; + for (var i = 0; i < length; i++) { + var bit = decoder.readBit(contexts, prev); + prev = (prev < 256 ? (prev << 1) | bit : + (((prev << 1) | bit) & 511) | 256); + v = (v << 1) | bit; + } + return v >>> 0; + } + + var sign = readBits(1); + var value = readBits(1) ? + (readBits(1) ? + (readBits(1) ? + (readBits(1) ? + (readBits(1) ? + (readBits(32) + 4436) : + readBits(12) + 340) : + readBits(8) + 84) : + readBits(6) + 20) : + readBits(4) + 4) : + readBits(2); + return (sign === 0 ? value : (value > 0 ? -value : null)); + } + + // A.3 The IAID decoding procedure + function decodeIAID(contextCache, decoder, codeLength) { + var contexts = contextCache.getContexts('IAID'); + + var prev = 1; + for (var i = 0; i < codeLength; i++) { + var bit = decoder.readBit(contexts, prev); + prev = (prev << 1) | bit; + } + if (codeLength < 31) { + return prev & ((1 << codeLength) - 1); + } + return prev & 0x7FFFFFFF; + } + + // 7.3 Segment types + var SegmentTypes = [ + 'SymbolDictionary', null, null, null, 'IntermediateTextRegion', null, + 'ImmediateTextRegion', 'ImmediateLosslessTextRegion', null, null, null, + null, null, null, null, null, 'patternDictionary', null, null, null, + 'IntermediateHalftoneRegion', null, 'ImmediateHalftoneRegion', + 'ImmediateLosslessHalftoneRegion', null, null, null, null, null, null, null, + null, null, null, null, null, 'IntermediateGenericRegion', null, + 'ImmediateGenericRegion', 'ImmediateLosslessGenericRegion', + 'IntermediateGenericRefinementRegion', null, + 'ImmediateGenericRefinementRegion', + 'ImmediateLosslessGenericRefinementRegion', null, null, null, null, + 'PageInformation', 'EndOfPage', 'EndOfStripe', 'EndOfFile', 'Profiles', + 'Tables', null, null, null, null, null, null, null, null, + 'Extension' + ]; + + var CodingTemplates = [ + [{x: -1, y: -2}, {x: 0, y: -2}, {x: 1, y: -2}, {x: -2, y: -1}, + {x: -1, y: -1}, {x: 0, y: -1}, {x: 1, y: -1}, {x: 2, y: -1}, + {x: -4, y: 0}, {x: -3, y: 0}, {x: -2, y: 0}, {x: -1, y: 0}], + [{x: -1, y: -2}, {x: 0, y: -2}, {x: 1, y: -2}, {x: 2, y: -2}, + {x: -2, y: -1}, {x: -1, y: -1}, {x: 0, y: -1}, {x: 1, y: -1}, + {x: 2, y: -1}, {x: -3, y: 0}, {x: -2, y: 0}, {x: -1, y: 0}], + [{x: -1, y: -2}, {x: 0, y: -2}, {x: 1, y: -2}, {x: -2, y: -1}, + {x: -1, y: -1}, {x: 0, y: -1}, {x: 1, y: -1}, {x: -2, y: 0}, + {x: -1, y: 0}], + [{x: -3, y: -1}, {x: -2, y: -1}, {x: -1, y: -1}, {x: 0, y: -1}, + {x: 1, y: -1}, {x: -4, y: 0}, {x: -3, y: 0}, {x: -2, y: 0}, {x: -1, y: 0}] + ]; + + var RefinementTemplates = [ + { + coding: [{x: 0, y: -1}, {x: 1, y: -1}, {x: -1, y: 0}], + reference: [{x: 0, y: -1}, {x: 1, y: -1}, {x: -1, y: 0}, {x: 0, y: 0}, + {x: 1, y: 0}, {x: -1, y: 1}, {x: 0, y: 1}, {x: 1, y: 1}] + }, + { + coding: [{x: -1, y: -1}, {x: 0, y: -1}, {x: 1, y: -1}, {x: -1, y: 0}], + reference: [{x: 0, y: -1}, {x: -1, y: 0}, {x: 0, y: 0}, {x: 1, y: 0}, + {x: 0, y: 1}, {x: 1, y: 1}] + } + ]; + + // See 6.2.5.7 Decoding the bitmap. + var ReusedContexts = [ + 0x9B25, // 10011 0110010 0101 + 0x0795, // 0011 110010 101 + 0x00E5, // 001 11001 01 + 0x0195 // 011001 0101 + ]; + + var RefinementReusedContexts = [ + 0x0020, // '000' + '0' (coding) + '00010000' + '0' (reference) + 0x0008 // '0000' + '001000' + ]; + + function decodeBitmapTemplate0(width, height, decodingContext) { + var decoder = decodingContext.decoder; + var contexts = decodingContext.contextCache.getContexts('GB'); + var contextLabel, i, j, pixel, row, row1, row2, bitmap = []; + + // ...ooooo.... + // ..ooooooo... Context template for current pixel (X) + // .ooooX...... (concatenate values of 'o'-pixels to get contextLabel) + var OLD_PIXEL_MASK = 0x7BF7; // 01111 0111111 0111 + + for (i = 0; i < height; i++) { + row = bitmap[i] = new Uint8Array(width); + row1 = (i < 1) ? row : bitmap[i - 1]; + row2 = (i < 2) ? row : bitmap[i - 2]; + + // At the beginning of each row: + // Fill contextLabel with pixels that are above/right of (X) + contextLabel = (row2[0] << 13) | (row2[1] << 12) | (row2[2] << 11) | + (row1[0] << 7) | (row1[1] << 6) | (row1[2] << 5) | + (row1[3] << 4); + + for (j = 0; j < width; j++) { + row[j] = pixel = decoder.readBit(contexts, contextLabel); + + // At each pixel: Clear contextLabel pixels that are shifted + // out of the context, then add new ones. + contextLabel = ((contextLabel & OLD_PIXEL_MASK) << 1) | + (j + 3 < width ? row2[j + 3] << 11 : 0) | + (j + 4 < width ? row1[j + 4] << 4 : 0) | pixel; + } + } + + return bitmap; + } + + // 6.2 Generic Region Decoding Procedure + function decodeBitmap(mmr, width, height, templateIndex, prediction, skip, at, + decodingContext) { + if (mmr) { + error('JBIG2 error: MMR encoding is not supported'); + } + + // Use optimized version for the most common case + if (templateIndex === 0 && !skip && !prediction && at.length === 4 && + at[0].x === 3 && at[0].y === -1 && at[1].x === -3 && at[1].y === -1 && + at[2].x === 2 && at[2].y === -2 && at[3].x === -2 && at[3].y === -2) { + return decodeBitmapTemplate0(width, height, decodingContext); + } + + var useskip = !!skip; + var template = CodingTemplates[templateIndex].concat(at); + + // Sorting is non-standard, and it is not required. But sorting increases + // the number of template bits that can be reused from the previous + // contextLabel in the main loop. + template.sort(function (a, b) { + return (a.y - b.y) || (a.x - b.x); + }); + + var templateLength = template.length; + var templateX = new Int8Array(templateLength); + var templateY = new Int8Array(templateLength); + var changingTemplateEntries = []; + var reuseMask = 0, minX = 0, maxX = 0, minY = 0; + var c, k; + + for (k = 0; k < templateLength; k++) { + templateX[k] = template[k].x; + templateY[k] = template[k].y; + minX = Math.min(minX, template[k].x); + maxX = Math.max(maxX, template[k].x); + minY = Math.min(minY, template[k].y); + // Check if the template pixel appears in two consecutive context labels, + // so it can be reused. Otherwise, we add it to the list of changing + // template entries. + if (k < templateLength - 1 && + template[k].y === template[k + 1].y && + template[k].x === template[k + 1].x - 1) { + reuseMask |= 1 << (templateLength - 1 - k); + } else { + changingTemplateEntries.push(k); + } + } + var changingEntriesLength = changingTemplateEntries.length; + + var changingTemplateX = new Int8Array(changingEntriesLength); + var changingTemplateY = new Int8Array(changingEntriesLength); + var changingTemplateBit = new Uint16Array(changingEntriesLength); + for (c = 0; c < changingEntriesLength; c++) { + k = changingTemplateEntries[c]; + changingTemplateX[c] = template[k].x; + changingTemplateY[c] = template[k].y; + changingTemplateBit[c] = 1 << (templateLength - 1 - k); + } + + // Get the safe bounding box edges from the width, height, minX, maxX, minY + var sbb_left = -minX; + var sbb_top = -minY; + var sbb_right = width - maxX; + + var pseudoPixelContext = ReusedContexts[templateIndex]; + var row = new Uint8Array(width); + var bitmap = []; + + var decoder = decodingContext.decoder; + var contexts = decodingContext.contextCache.getContexts('GB'); + + var ltp = 0, j, i0, j0, contextLabel = 0, bit, shift; + for (var i = 0; i < height; i++) { + if (prediction) { + var sltp = decoder.readBit(contexts, pseudoPixelContext); + ltp ^= sltp; + if (ltp) { + bitmap.push(row); // duplicate previous row + continue; + } + } + row = new Uint8Array(row); + bitmap.push(row); + for (j = 0; j < width; j++) { + if (useskip && skip[i][j]) { + row[j] = 0; + continue; + } + // Are we in the middle of a scanline, so we can reuse contextLabel + // bits? + if (j >= sbb_left && j < sbb_right && i >= sbb_top) { + // If yes, we can just shift the bits that are reusable and only + // fetch the remaining ones. + contextLabel = (contextLabel << 1) & reuseMask; + for (k = 0; k < changingEntriesLength; k++) { + i0 = i + changingTemplateY[k]; + j0 = j + changingTemplateX[k]; + bit = bitmap[i0][j0]; + if (bit) { + bit = changingTemplateBit[k]; + contextLabel |= bit; + } + } + } else { + // compute the contextLabel from scratch + contextLabel = 0; + shift = templateLength - 1; + for (k = 0; k < templateLength; k++, shift--) { + j0 = j + templateX[k]; + if (j0 >= 0 && j0 < width) { + i0 = i + templateY[k]; + if (i0 >= 0) { + bit = bitmap[i0][j0]; + if (bit) { + contextLabel |= bit << shift; + } + } + } + } + } + var pixel = decoder.readBit(contexts, contextLabel); + row[j] = pixel; + } + } + return bitmap; + } + + // 6.3.2 Generic Refinement Region Decoding Procedure + function decodeRefinement(width, height, templateIndex, referenceBitmap, + offsetX, offsetY, prediction, at, + decodingContext) { + var codingTemplate = RefinementTemplates[templateIndex].coding; + if (templateIndex === 0) { + codingTemplate = codingTemplate.concat([at[0]]); + } + var codingTemplateLength = codingTemplate.length; + var codingTemplateX = new Int32Array(codingTemplateLength); + var codingTemplateY = new Int32Array(codingTemplateLength); + var k; + for (k = 0; k < codingTemplateLength; k++) { + codingTemplateX[k] = codingTemplate[k].x; + codingTemplateY[k] = codingTemplate[k].y; + } + + var referenceTemplate = RefinementTemplates[templateIndex].reference; + if (templateIndex === 0) { + referenceTemplate = referenceTemplate.concat([at[1]]); + } + var referenceTemplateLength = referenceTemplate.length; + var referenceTemplateX = new Int32Array(referenceTemplateLength); + var referenceTemplateY = new Int32Array(referenceTemplateLength); + for (k = 0; k < referenceTemplateLength; k++) { + referenceTemplateX[k] = referenceTemplate[k].x; + referenceTemplateY[k] = referenceTemplate[k].y; + } + var referenceWidth = referenceBitmap[0].length; + var referenceHeight = referenceBitmap.length; + + var pseudoPixelContext = RefinementReusedContexts[templateIndex]; + var bitmap = []; + + var decoder = decodingContext.decoder; + var contexts = decodingContext.contextCache.getContexts('GR'); + + var ltp = 0; + for (var i = 0; i < height; i++) { + if (prediction) { + var sltp = decoder.readBit(contexts, pseudoPixelContext); + ltp ^= sltp; + if (ltp) { + error('JBIG2 error: prediction is not supported'); + } + } + var row = new Uint8Array(width); + bitmap.push(row); + for (var j = 0; j < width; j++) { + var i0, j0; + var contextLabel = 0; + for (k = 0; k < codingTemplateLength; k++) { + i0 = i + codingTemplateY[k]; + j0 = j + codingTemplateX[k]; + if (i0 < 0 || j0 < 0 || j0 >= width) { + contextLabel <<= 1; // out of bound pixel + } else { + contextLabel = (contextLabel << 1) | bitmap[i0][j0]; + } + } + for (k = 0; k < referenceTemplateLength; k++) { + i0 = i + referenceTemplateY[k] + offsetY; + j0 = j + referenceTemplateX[k] + offsetX; + if (i0 < 0 || i0 >= referenceHeight || j0 < 0 || + j0 >= referenceWidth) { + contextLabel <<= 1; // out of bound pixel + } else { + contextLabel = (contextLabel << 1) | referenceBitmap[i0][j0]; + } + } + var pixel = decoder.readBit(contexts, contextLabel); + row[j] = pixel; + } + } + + return bitmap; + } + + // 6.5.5 Decoding the symbol dictionary + function decodeSymbolDictionary(huffman, refinement, symbols, + numberOfNewSymbols, numberOfExportedSymbols, + huffmanTables, templateIndex, at, + refinementTemplateIndex, refinementAt, + decodingContext) { + if (huffman) { + error('JBIG2 error: huffman is not supported'); + } + + var newSymbols = []; + var currentHeight = 0; + var symbolCodeLength = log2(symbols.length + numberOfNewSymbols); + + var decoder = decodingContext.decoder; + var contextCache = decodingContext.contextCache; + + while (newSymbols.length < numberOfNewSymbols) { + var deltaHeight = decodeInteger(contextCache, 'IADH', decoder); // 6.5.6 + currentHeight += deltaHeight; + var currentWidth = 0; + var totalWidth = 0; + while (true) { + var deltaWidth = decodeInteger(contextCache, 'IADW', decoder); // 6.5.7 + if (deltaWidth === null) { + break; // OOB + } + currentWidth += deltaWidth; + totalWidth += currentWidth; + var bitmap; + if (refinement) { + // 6.5.8.2 Refinement/aggregate-coded symbol bitmap + var numberOfInstances = decodeInteger(contextCache, 'IAAI', decoder); + if (numberOfInstances > 1) { + bitmap = decodeTextRegion(huffman, refinement, + currentWidth, currentHeight, 0, + numberOfInstances, 1, //strip size + symbols.concat(newSymbols), + symbolCodeLength, + 0, //transposed + 0, //ds offset + 1, //top left 7.4.3.1.1 + 0, //OR operator + huffmanTables, + refinementTemplateIndex, refinementAt, + decodingContext); + } else { + var symbolId = decodeIAID(contextCache, decoder, symbolCodeLength); + var rdx = decodeInteger(contextCache, 'IARDX', decoder); // 6.4.11.3 + var rdy = decodeInteger(contextCache, 'IARDY', decoder); // 6.4.11.4 + var symbol = (symbolId < symbols.length ? symbols[symbolId] : + newSymbols[symbolId - symbols.length]); + bitmap = decodeRefinement(currentWidth, currentHeight, + refinementTemplateIndex, symbol, rdx, rdy, false, refinementAt, + decodingContext); + } + } else { + // 6.5.8.1 Direct-coded symbol bitmap + bitmap = decodeBitmap(false, currentWidth, currentHeight, + templateIndex, false, null, at, decodingContext); + } + newSymbols.push(bitmap); + } + } + // 6.5.10 Exported symbols + var exportedSymbols = []; + var flags = [], currentFlag = false; + var totalSymbolsLength = symbols.length + numberOfNewSymbols; + while (flags.length < totalSymbolsLength) { + var runLength = decodeInteger(contextCache, 'IAEX', decoder); + while (runLength--) { + flags.push(currentFlag); + } + currentFlag = !currentFlag; + } + for (var i = 0, ii = symbols.length; i < ii; i++) { + if (flags[i]) { + exportedSymbols.push(symbols[i]); + } + } + for (var j = 0; j < numberOfNewSymbols; i++, j++) { + if (flags[i]) { + exportedSymbols.push(newSymbols[j]); + } + } + return exportedSymbols; + } + + function decodeTextRegion(huffman, refinement, width, height, + defaultPixelValue, numberOfSymbolInstances, + stripSize, inputSymbols, symbolCodeLength, + transposed, dsOffset, referenceCorner, + combinationOperator, huffmanTables, + refinementTemplateIndex, refinementAt, + decodingContext) { + if (huffman) { + error('JBIG2 error: huffman is not supported'); + } + + // Prepare bitmap + var bitmap = []; + var i, row; + for (i = 0; i < height; i++) { + row = new Uint8Array(width); + if (defaultPixelValue) { + for (var j = 0; j < width; j++) { + row[j] = defaultPixelValue; + } + } + bitmap.push(row); + } + + var decoder = decodingContext.decoder; + var contextCache = decodingContext.contextCache; + var stripT = -decodeInteger(contextCache, 'IADT', decoder); // 6.4.6 + var firstS = 0; + i = 0; + while (i < numberOfSymbolInstances) { + var deltaT = decodeInteger(contextCache, 'IADT', decoder); // 6.4.6 + stripT += deltaT; + + var deltaFirstS = decodeInteger(contextCache, 'IAFS', decoder); // 6.4.7 + firstS += deltaFirstS; + var currentS = firstS; + do { + var currentT = (stripSize === 1 ? 0 : + decodeInteger(contextCache, 'IAIT', decoder)); // 6.4.9 + var t = stripSize * stripT + currentT; + var symbolId = decodeIAID(contextCache, decoder, symbolCodeLength); + var applyRefinement = (refinement && + decodeInteger(contextCache, 'IARI', decoder)); + var symbolBitmap = inputSymbols[symbolId]; + var symbolWidth = symbolBitmap[0].length; + var symbolHeight = symbolBitmap.length; + if (applyRefinement) { + var rdw = decodeInteger(contextCache, 'IARDW', decoder); // 6.4.11.1 + var rdh = decodeInteger(contextCache, 'IARDH', decoder); // 6.4.11.2 + var rdx = decodeInteger(contextCache, 'IARDX', decoder); // 6.4.11.3 + var rdy = decodeInteger(contextCache, 'IARDY', decoder); // 6.4.11.4 + symbolWidth += rdw; + symbolHeight += rdh; + symbolBitmap = decodeRefinement(symbolWidth, symbolHeight, + refinementTemplateIndex, symbolBitmap, (rdw >> 1) + rdx, + (rdh >> 1) + rdy, false, refinementAt, + decodingContext); + } + var offsetT = t - ((referenceCorner & 1) ? 0 : symbolHeight); + var offsetS = currentS - ((referenceCorner & 2) ? symbolWidth : 0); + var s2, t2, symbolRow; + if (transposed) { + // Place Symbol Bitmap from T1,S1 + for (s2 = 0; s2 < symbolHeight; s2++) { + row = bitmap[offsetS + s2]; + if (!row) { + continue; + } + symbolRow = symbolBitmap[s2]; + // To ignore Parts of Symbol bitmap which goes + // outside bitmap region + var maxWidth = Math.min(width - offsetT, symbolWidth); + switch (combinationOperator) { + case 0: // OR + for (t2 = 0; t2 < maxWidth; t2++) { + row[offsetT + t2] |= symbolRow[t2]; + } + break; + case 2: // XOR + for (t2 = 0; t2 < maxWidth; t2++) { + row[offsetT + t2] ^= symbolRow[t2]; + } + break; + default: + error('JBIG2 error: operator ' + combinationOperator + + ' is not supported'); + } + } + currentS += symbolHeight - 1; + } else { + for (t2 = 0; t2 < symbolHeight; t2++) { + row = bitmap[offsetT + t2]; + if (!row) { + continue; + } + symbolRow = symbolBitmap[t2]; + switch (combinationOperator) { + case 0: // OR + for (s2 = 0; s2 < symbolWidth; s2++) { + row[offsetS + s2] |= symbolRow[s2]; + } + break; + case 2: // XOR + for (s2 = 0; s2 < symbolWidth; s2++) { + row[offsetS + s2] ^= symbolRow[s2]; + } + break; + default: + error('JBIG2 error: operator ' + combinationOperator + + ' is not supported'); + } + } + currentS += symbolWidth - 1; + } + i++; + var deltaS = decodeInteger(contextCache, 'IADS', decoder); // 6.4.8 + if (deltaS === null) { + break; // OOB + } + currentS += deltaS + dsOffset; + } while (true); + } + return bitmap; + } + + function readSegmentHeader(data, start) { + var segmentHeader = {}; + segmentHeader.number = readUint32(data, start); + var flags = data[start + 4]; + var segmentType = flags & 0x3F; + if (!SegmentTypes[segmentType]) { + error('JBIG2 error: invalid segment type: ' + segmentType); + } + segmentHeader.type = segmentType; + segmentHeader.typeName = SegmentTypes[segmentType]; + segmentHeader.deferredNonRetain = !!(flags & 0x80); + + var pageAssociationFieldSize = !!(flags & 0x40); + var referredFlags = data[start + 5]; + var referredToCount = (referredFlags >> 5) & 7; + var retainBits = [referredFlags & 31]; + var position = start + 6; + if (referredFlags === 7) { + referredToCount = readUint32(data, position - 1) & 0x1FFFFFFF; + position += 3; + var bytes = (referredToCount + 7) >> 3; + retainBits[0] = data[position++]; + while (--bytes > 0) { + retainBits.push(data[position++]); + } + } else if (referredFlags === 5 || referredFlags === 6) { + error('JBIG2 error: invalid referred-to flags'); + } + + segmentHeader.retainBits = retainBits; + var referredToSegmentNumberSize = (segmentHeader.number <= 256 ? 1 : + (segmentHeader.number <= 65536 ? 2 : 4)); + var referredTo = []; + var i, ii; + for (i = 0; i < referredToCount; i++) { + var number = (referredToSegmentNumberSize === 1 ? data[position] : + (referredToSegmentNumberSize === 2 ? readUint16(data, position) : + readUint32(data, position))); + referredTo.push(number); + position += referredToSegmentNumberSize; + } + segmentHeader.referredTo = referredTo; + if (!pageAssociationFieldSize) { + segmentHeader.pageAssociation = data[position++]; + } else { + segmentHeader.pageAssociation = readUint32(data, position); + position += 4; + } + segmentHeader.length = readUint32(data, position); + position += 4; + + if (segmentHeader.length === 0xFFFFFFFF) { + // 7.2.7 Segment data length, unknown segment length + if (segmentType === 38) { // ImmediateGenericRegion + var genericRegionInfo = readRegionSegmentInformation(data, position); + var genericRegionSegmentFlags = data[position + + RegionSegmentInformationFieldLength]; + var genericRegionMmr = !!(genericRegionSegmentFlags & 1); + // searching for the segment end + var searchPatternLength = 6; + var searchPattern = new Uint8Array(searchPatternLength); + if (!genericRegionMmr) { + searchPattern[0] = 0xFF; + searchPattern[1] = 0xAC; + } + searchPattern[2] = (genericRegionInfo.height >>> 24) & 0xFF; + searchPattern[3] = (genericRegionInfo.height >> 16) & 0xFF; + searchPattern[4] = (genericRegionInfo.height >> 8) & 0xFF; + searchPattern[5] = genericRegionInfo.height & 0xFF; + for (i = position, ii = data.length; i < ii; i++) { + var j = 0; + while (j < searchPatternLength && searchPattern[j] === data[i + j]) { + j++; + } + if (j === searchPatternLength) { + segmentHeader.length = i + searchPatternLength; + break; + } + } + if (segmentHeader.length === 0xFFFFFFFF) { + error('JBIG2 error: segment end was not found'); + } + } else { + error('JBIG2 error: invalid unknown segment length'); + } + } + segmentHeader.headerEnd = position; + return segmentHeader; + } + + function readSegments(header, data, start, end) { + var segments = []; + var position = start; + while (position < end) { + var segmentHeader = readSegmentHeader(data, position); + position = segmentHeader.headerEnd; + var segment = { + header: segmentHeader, + data: data + }; + if (!header.randomAccess) { + segment.start = position; + position += segmentHeader.length; + segment.end = position; + } + segments.push(segment); + if (segmentHeader.type === 51) { + break; // end of file is found + } + } + if (header.randomAccess) { + for (var i = 0, ii = segments.length; i < ii; i++) { + segments[i].start = position; + position += segments[i].header.length; + segments[i].end = position; + } + } + return segments; + } + + // 7.4.1 Region segment information field + function readRegionSegmentInformation(data, start) { + return { + width: readUint32(data, start), + height: readUint32(data, start + 4), + x: readUint32(data, start + 8), + y: readUint32(data, start + 12), + combinationOperator: data[start + 16] & 7 + }; + } + var RegionSegmentInformationFieldLength = 17; + + function processSegment(segment, visitor) { + var header = segment.header; + + var data = segment.data, position = segment.start, end = segment.end; + var args, at, i, atLength; + switch (header.type) { + case 0: // SymbolDictionary + // 7.4.2 Symbol dictionary segment syntax + var dictionary = {}; + var dictionaryFlags = readUint16(data, position); // 7.4.2.1.1 + dictionary.huffman = !!(dictionaryFlags & 1); + dictionary.refinement = !!(dictionaryFlags & 2); + dictionary.huffmanDHSelector = (dictionaryFlags >> 2) & 3; + dictionary.huffmanDWSelector = (dictionaryFlags >> 4) & 3; + dictionary.bitmapSizeSelector = (dictionaryFlags >> 6) & 1; + dictionary.aggregationInstancesSelector = (dictionaryFlags >> 7) & 1; + dictionary.bitmapCodingContextUsed = !!(dictionaryFlags & 256); + dictionary.bitmapCodingContextRetained = !!(dictionaryFlags & 512); + dictionary.template = (dictionaryFlags >> 10) & 3; + dictionary.refinementTemplate = (dictionaryFlags >> 12) & 1; + position += 2; + if (!dictionary.huffman) { + atLength = dictionary.template === 0 ? 4 : 1; + at = []; + for (i = 0; i < atLength; i++) { + at.push({ + x: readInt8(data, position), + y: readInt8(data, position + 1) + }); + position += 2; + } + dictionary.at = at; + } + if (dictionary.refinement && !dictionary.refinementTemplate) { + at = []; + for (i = 0; i < 2; i++) { + at.push({ + x: readInt8(data, position), + y: readInt8(data, position + 1) + }); + position += 2; + } + dictionary.refinementAt = at; + } + dictionary.numberOfExportedSymbols = readUint32(data, position); + position += 4; + dictionary.numberOfNewSymbols = readUint32(data, position); + position += 4; + args = [dictionary, header.number, header.referredTo, + data, position, end]; + break; + case 6: // ImmediateTextRegion + case 7: // ImmediateLosslessTextRegion + var textRegion = {}; + textRegion.info = readRegionSegmentInformation(data, position); + position += RegionSegmentInformationFieldLength; + var textRegionSegmentFlags = readUint16(data, position); + position += 2; + textRegion.huffman = !!(textRegionSegmentFlags & 1); + textRegion.refinement = !!(textRegionSegmentFlags & 2); + textRegion.stripSize = 1 << ((textRegionSegmentFlags >> 2) & 3); + textRegion.referenceCorner = (textRegionSegmentFlags >> 4) & 3; + textRegion.transposed = !!(textRegionSegmentFlags & 64); + textRegion.combinationOperator = (textRegionSegmentFlags >> 7) & 3; + textRegion.defaultPixelValue = (textRegionSegmentFlags >> 9) & 1; + textRegion.dsOffset = (textRegionSegmentFlags << 17) >> 27; + textRegion.refinementTemplate = (textRegionSegmentFlags >> 15) & 1; + if (textRegion.huffman) { + var textRegionHuffmanFlags = readUint16(data, position); + position += 2; + textRegion.huffmanFS = (textRegionHuffmanFlags) & 3; + textRegion.huffmanDS = (textRegionHuffmanFlags >> 2) & 3; + textRegion.huffmanDT = (textRegionHuffmanFlags >> 4) & 3; + textRegion.huffmanRefinementDW = (textRegionHuffmanFlags >> 6) & 3; + textRegion.huffmanRefinementDH = (textRegionHuffmanFlags >> 8) & 3; + textRegion.huffmanRefinementDX = (textRegionHuffmanFlags >> 10) & 3; + textRegion.huffmanRefinementDY = (textRegionHuffmanFlags >> 12) & 3; + textRegion.huffmanRefinementSizeSelector = + !!(textRegionHuffmanFlags & 14); + } + if (textRegion.refinement && !textRegion.refinementTemplate) { + at = []; + for (i = 0; i < 2; i++) { + at.push({ + x: readInt8(data, position), + y: readInt8(data, position + 1) + }); + position += 2; + } + textRegion.refinementAt = at; + } + textRegion.numberOfSymbolInstances = readUint32(data, position); + position += 4; + // TODO 7.4.3.1.7 Symbol ID Huffman table decoding + if (textRegion.huffman) { + error('JBIG2 error: huffman is not supported'); + } + args = [textRegion, header.referredTo, data, position, end]; + break; + case 38: // ImmediateGenericRegion + case 39: // ImmediateLosslessGenericRegion + var genericRegion = {}; + genericRegion.info = readRegionSegmentInformation(data, position); + position += RegionSegmentInformationFieldLength; + var genericRegionSegmentFlags = data[position++]; + genericRegion.mmr = !!(genericRegionSegmentFlags & 1); + genericRegion.template = (genericRegionSegmentFlags >> 1) & 3; + genericRegion.prediction = !!(genericRegionSegmentFlags & 8); + if (!genericRegion.mmr) { + atLength = genericRegion.template === 0 ? 4 : 1; + at = []; + for (i = 0; i < atLength; i++) { + at.push({ + x: readInt8(data, position), + y: readInt8(data, position + 1) + }); + position += 2; + } + genericRegion.at = at; + } + args = [genericRegion, data, position, end]; + break; + case 48: // PageInformation + var pageInfo = { + width: readUint32(data, position), + height: readUint32(data, position + 4), + resolutionX: readUint32(data, position + 8), + resolutionY: readUint32(data, position + 12) + }; + if (pageInfo.height === 0xFFFFFFFF) { + delete pageInfo.height; + } + var pageSegmentFlags = data[position + 16]; + var pageStripingInformatiom = readUint16(data, position + 17); + pageInfo.lossless = !!(pageSegmentFlags & 1); + pageInfo.refinement = !!(pageSegmentFlags & 2); + pageInfo.defaultPixelValue = (pageSegmentFlags >> 2) & 1; + pageInfo.combinationOperator = (pageSegmentFlags >> 3) & 3; + pageInfo.requiresBuffer = !!(pageSegmentFlags & 32); + pageInfo.combinationOperatorOverride = !!(pageSegmentFlags & 64); + args = [pageInfo]; + break; + case 49: // EndOfPage + break; + case 50: // EndOfStripe + break; + case 51: // EndOfFile + break; + case 62: // 7.4.15 defines 2 extension types which + // are comments and can be ignored. + break; + default: + error('JBIG2 error: segment type ' + header.typeName + '(' + + header.type + ') is not implemented'); + } + var callbackName = 'on' + header.typeName; + if (callbackName in visitor) { + visitor[callbackName].apply(visitor, args); + } + } + + function processSegments(segments, visitor) { + for (var i = 0, ii = segments.length; i < ii; i++) { + processSegment(segments[i], visitor); + } + } + + function parseJbig2(data, start, end) { + var position = start; + if (data[position] !== 0x97 || data[position + 1] !== 0x4A || + data[position + 2] !== 0x42 || data[position + 3] !== 0x32 || + data[position + 4] !== 0x0D || data[position + 5] !== 0x0A || + data[position + 6] !== 0x1A || data[position + 7] !== 0x0A) { + error('JBIG2 error: invalid header'); + } + var header = {}; + position += 8; + var flags = data[position++]; + header.randomAccess = !(flags & 1); + if (!(flags & 2)) { + header.numberOfPages = readUint32(data, position); + position += 4; + } + var segments = readSegments(header, data, position, end); + error('Not implemented'); + // processSegments(segments, new SimpleSegmentVisitor()); + } + + function parseJbig2Chunks(chunks) { + var visitor = new SimpleSegmentVisitor(); + for (var i = 0, ii = chunks.length; i < ii; i++) { + var chunk = chunks[i]; + var segments = readSegments({}, chunk.data, chunk.start, chunk.end); + processSegments(segments, visitor); + } + return visitor.buffer; + } + + function SimpleSegmentVisitor() {} + + SimpleSegmentVisitor.prototype = { + onPageInformation: function SimpleSegmentVisitor_onPageInformation(info) { + this.currentPageInfo = info; + var rowSize = (info.width + 7) >> 3; + var buffer = new Uint8Array(rowSize * info.height); + // The contents of ArrayBuffers are initialized to 0. + // Fill the buffer with 0xFF only if info.defaultPixelValue is set + if (info.defaultPixelValue) { + for (var i = 0, ii = buffer.length; i < ii; i++) { + buffer[i] = 0xFF; + } + } + this.buffer = buffer; + }, + drawBitmap: function SimpleSegmentVisitor_drawBitmap(regionInfo, bitmap) { + var pageInfo = this.currentPageInfo; + var width = regionInfo.width, height = regionInfo.height; + var rowSize = (pageInfo.width + 7) >> 3; + var combinationOperator = pageInfo.combinationOperatorOverride ? + regionInfo.combinationOperator : pageInfo.combinationOperator; + var buffer = this.buffer; + var mask0 = 128 >> (regionInfo.x & 7); + var offset0 = regionInfo.y * rowSize + (regionInfo.x >> 3); + var i, j, mask, offset; + switch (combinationOperator) { + case 0: // OR + for (i = 0; i < height; i++) { + mask = mask0; + offset = offset0; + for (j = 0; j < width; j++) { + if (bitmap[i][j]) { + buffer[offset] |= mask; + } + mask >>= 1; + if (!mask) { + mask = 128; + offset++; + } + } + offset0 += rowSize; + } + break; + case 2: // XOR + for (i = 0; i < height; i++) { + mask = mask0; + offset = offset0; + for (j = 0; j < width; j++) { + if (bitmap[i][j]) { + buffer[offset] ^= mask; + } + mask >>= 1; + if (!mask) { + mask = 128; + offset++; + } + } + offset0 += rowSize; + } + break; + default: + error('JBIG2 error: operator ' + combinationOperator + + ' is not supported'); + } + }, + onImmediateGenericRegion: + function SimpleSegmentVisitor_onImmediateGenericRegion(region, data, + start, end) { + var regionInfo = region.info; + var decodingContext = new DecodingContext(data, start, end); + var bitmap = decodeBitmap(region.mmr, regionInfo.width, regionInfo.height, + region.template, region.prediction, null, + region.at, decodingContext); + this.drawBitmap(regionInfo, bitmap); + }, + onImmediateLosslessGenericRegion: + function SimpleSegmentVisitor_onImmediateLosslessGenericRegion() { + this.onImmediateGenericRegion.apply(this, arguments); + }, + onSymbolDictionary: + function SimpleSegmentVisitor_onSymbolDictionary(dictionary, + currentSegment, + referredSegments, + data, start, end) { + var huffmanTables; + if (dictionary.huffman) { + error('JBIG2 error: huffman is not supported'); + } + + // Combines exported symbols from all referred segments + var symbols = this.symbols; + if (!symbols) { + this.symbols = symbols = {}; + } + + var inputSymbols = []; + for (var i = 0, ii = referredSegments.length; i < ii; i++) { + inputSymbols = inputSymbols.concat(symbols[referredSegments[i]]); + } + + var decodingContext = new DecodingContext(data, start, end); + symbols[currentSegment] = decodeSymbolDictionary(dictionary.huffman, + dictionary.refinement, inputSymbols, dictionary.numberOfNewSymbols, + dictionary.numberOfExportedSymbols, huffmanTables, + dictionary.template, dictionary.at, + dictionary.refinementTemplate, dictionary.refinementAt, + decodingContext); + }, + onImmediateTextRegion: + function SimpleSegmentVisitor_onImmediateTextRegion(region, + referredSegments, + data, start, end) { + var regionInfo = region.info; + var huffmanTables; + + // Combines exported symbols from all referred segments + var symbols = this.symbols; + var inputSymbols = []; + for (var i = 0, ii = referredSegments.length; i < ii; i++) { + inputSymbols = inputSymbols.concat(symbols[referredSegments[i]]); + } + var symbolCodeLength = log2(inputSymbols.length); + + var decodingContext = new DecodingContext(data, start, end); + var bitmap = decodeTextRegion(region.huffman, region.refinement, + regionInfo.width, regionInfo.height, region.defaultPixelValue, + region.numberOfSymbolInstances, region.stripSize, inputSymbols, + symbolCodeLength, region.transposed, region.dsOffset, + region.referenceCorner, region.combinationOperator, huffmanTables, + region.refinementTemplate, region.refinementAt, decodingContext); + this.drawBitmap(regionInfo, bitmap); + }, + onImmediateLosslessTextRegion: + function SimpleSegmentVisitor_onImmediateLosslessTextRegion() { + this.onImmediateTextRegion.apply(this, arguments); + } + }; + + function Jbig2Image() {} + + Jbig2Image.prototype = { + parseChunks: function Jbig2Image_parseChunks(chunks) { + return parseJbig2Chunks(chunks); + } + }; + + return Jbig2Image; +})(); + + +var bidi = PDFJS.bidi = (function bidiClosure() { + // Character types for symbols from 0000 to 00FF. + var baseTypes = [ + 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'S', 'B', 'S', 'WS', + 'B', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', + 'BN', 'BN', 'B', 'B', 'B', 'S', 'WS', 'ON', 'ON', 'ET', 'ET', 'ET', 'ON', + 'ON', 'ON', 'ON', 'ON', 'ON', 'CS', 'ON', 'CS', 'ON', 'EN', 'EN', 'EN', + 'EN', 'EN', 'EN', 'EN', 'EN', 'EN', 'EN', 'ON', 'ON', 'ON', 'ON', 'ON', + 'ON', 'ON', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', + 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'ON', 'ON', + 'ON', 'ON', 'ON', 'ON', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', + 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', + 'L', 'ON', 'ON', 'ON', 'ON', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'B', 'BN', + 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', + 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', + 'BN', 'CS', 'ON', 'ET', 'ET', 'ET', 'ET', 'ON', 'ON', 'ON', 'ON', 'L', 'ON', + 'ON', 'ON', 'ON', 'ON', 'ET', 'ET', 'EN', 'EN', 'ON', 'L', 'ON', 'ON', 'ON', + 'EN', 'L', 'ON', 'ON', 'ON', 'ON', 'ON', 'L', 'L', 'L', 'L', 'L', 'L', 'L', + 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', + 'L', 'ON', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', + 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', + 'L', 'L', 'L', 'ON', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L' + ]; + + // Character types for symbols from 0600 to 06FF + var arabicTypes = [ + 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', + 'CS', 'AL', 'ON', 'ON', 'NSM', 'NSM', 'NSM', 'NSM', 'NSM', 'NSM', 'AL', + 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', + 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', + 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', + 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', + 'AL', 'AL', 'AL', 'AL', 'NSM', 'NSM', 'NSM', 'NSM', 'NSM', 'NSM', 'NSM', + 'NSM', 'NSM', 'NSM', 'NSM', 'NSM', 'NSM', 'NSM', 'AL', 'AL', 'AL', 'AL', + 'AL', 'AL', 'AL', 'AN', 'AN', 'AN', 'AN', 'AN', 'AN', 'AN', 'AN', 'AN', + 'AN', 'ET', 'AN', 'AN', 'AL', 'AL', 'AL', 'NSM', 'AL', 'AL', 'AL', 'AL', + 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', + 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', + 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', + 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', + 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', + 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', + 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', + 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', + 'AL', 'NSM', 'NSM', 'NSM', 'NSM', 'NSM', 'NSM', 'NSM', 'NSM', 'NSM', 'NSM', + 'NSM', 'NSM', 'NSM', 'NSM', 'NSM', 'NSM', 'NSM', 'NSM', 'NSM', 'ON', 'NSM', + 'NSM', 'NSM', 'NSM', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', + 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL' + ]; + + function isOdd(i) { + return (i & 1) !== 0; + } + + function isEven(i) { + return (i & 1) === 0; + } + + function findUnequal(arr, start, value) { + for (var j = start, jj = arr.length; j < jj; ++j) { + if (arr[j] !== value) { + return j; + } + } + return j; + } + + function setValues(arr, start, end, value) { + for (var j = start; j < end; ++j) { + arr[j] = value; + } + } + + function reverseValues(arr, start, end) { + for (var i = start, j = end - 1; i < j; ++i, --j) { + var temp = arr[i]; + arr[i] = arr[j]; + arr[j] = temp; + } + } + + function createBidiText(str, isLTR, vertical) { + return { + str: str, + dir: (vertical ? 'ttb' : (isLTR ? 'ltr' : 'rtl')) + }; + } + + // These are used in bidi(), which is called frequently. We re-use them on + // each call to avoid unnecessary allocations. + var chars = []; + var types = []; + + function bidi(str, startLevel, vertical) { + var isLTR = true; + var strLength = str.length; + if (strLength === 0 || vertical) { + return createBidiText(str, isLTR, vertical); + } + + // Get types and fill arrays + chars.length = strLength; + types.length = strLength; + var numBidi = 0; + + var i, ii; + for (i = 0; i < strLength; ++i) { + chars[i] = str.charAt(i); + + var charCode = str.charCodeAt(i); + var charType = 'L'; + if (charCode <= 0x00ff) { + charType = baseTypes[charCode]; + } else if (0x0590 <= charCode && charCode <= 0x05f4) { + charType = 'R'; + } else if (0x0600 <= charCode && charCode <= 0x06ff) { + charType = arabicTypes[charCode & 0xff]; + } else if (0x0700 <= charCode && charCode <= 0x08AC) { + charType = 'AL'; + } + if (charType === 'R' || charType === 'AL' || charType === 'AN') { + numBidi++; + } + types[i] = charType; + } + + // Detect the bidi method + // - If there are no rtl characters then no bidi needed + // - If less than 30% chars are rtl then string is primarily ltr + // - If more than 30% chars are rtl then string is primarily rtl + if (numBidi === 0) { + isLTR = true; + return createBidiText(str, isLTR); + } + + if (startLevel === -1) { + if ((strLength / numBidi) < 0.3) { + isLTR = true; + startLevel = 0; + } else { + isLTR = false; + startLevel = 1; + } + } + + var levels = []; + for (i = 0; i < strLength; ++i) { + levels[i] = startLevel; + } + + /* + X1-X10: skip most of this, since we are NOT doing the embeddings. + */ + var e = (isOdd(startLevel) ? 'R' : 'L'); + var sor = e; + var eor = sor; + + /* + W1. Examine each non-spacing mark (NSM) in the level run, and change the + type of the NSM to the type of the previous character. If the NSM is at the + start of the level run, it will get the type of sor. + */ + var lastType = sor; + for (i = 0; i < strLength; ++i) { + if (types[i] === 'NSM') { + types[i] = lastType; + } else { + lastType = types[i]; + } + } + + /* + W2. Search backwards from each instance of a European number until the + first strong type (R, L, AL, or sor) is found. If an AL is found, change + the type of the European number to Arabic number. + */ + lastType = sor; + var t; + for (i = 0; i < strLength; ++i) { + t = types[i]; + if (t === 'EN') { + types[i] = (lastType === 'AL') ? 'AN' : 'EN'; + } else if (t === 'R' || t === 'L' || t === 'AL') { + lastType = t; + } + } + + /* + W3. Change all ALs to R. + */ + for (i = 0; i < strLength; ++i) { + t = types[i]; + if (t === 'AL') { + types[i] = 'R'; + } + } + + /* + W4. A single European separator between two European numbers changes to a + European number. A single common separator between two numbers of the same + type changes to that type: + */ + for (i = 1; i < strLength - 1; ++i) { + if (types[i] === 'ES' && types[i - 1] === 'EN' && types[i + 1] === 'EN') { + types[i] = 'EN'; + } + if (types[i] === 'CS' && + (types[i - 1] === 'EN' || types[i - 1] === 'AN') && + types[i + 1] === types[i - 1]) { + types[i] = types[i - 1]; + } + } + + /* + W5. A sequence of European terminators adjacent to European numbers changes + to all European numbers: + */ + for (i = 0; i < strLength; ++i) { + if (types[i] === 'EN') { + // do before + var j; + for (j = i - 1; j >= 0; --j) { + if (types[j] !== 'ET') { + break; + } + types[j] = 'EN'; + } + // do after + for (j = i + 1; j < strLength; --j) { + if (types[j] !== 'ET') { + break; + } + types[j] = 'EN'; + } + } + } + + /* + W6. Otherwise, separators and terminators change to Other Neutral: + */ + for (i = 0; i < strLength; ++i) { + t = types[i]; + if (t === 'WS' || t === 'ES' || t === 'ET' || t === 'CS') { + types[i] = 'ON'; + } + } + + /* + W7. Search backwards from each instance of a European number until the + first strong type (R, L, or sor) is found. If an L is found, then change + the type of the European number to L. + */ + lastType = sor; + for (i = 0; i < strLength; ++i) { + t = types[i]; + if (t === 'EN') { + types[i] = ((lastType === 'L') ? 'L' : 'EN'); + } else if (t === 'R' || t === 'L') { + lastType = t; + } + } + + /* + N1. A sequence of neutrals takes the direction of the surrounding strong + text if the text on both sides has the same direction. European and Arabic + numbers are treated as though they were R. Start-of-level-run (sor) and + end-of-level-run (eor) are used at level run boundaries. + */ + for (i = 0; i < strLength; ++i) { + if (types[i] === 'ON') { + var end = findUnequal(types, i + 1, 'ON'); + var before = sor; + if (i > 0) { + before = types[i - 1]; + } + + var after = eor; + if (end + 1 < strLength) { + after = types[end + 1]; + } + if (before !== 'L') { + before = 'R'; + } + if (after !== 'L') { + after = 'R'; + } + if (before === after) { + setValues(types, i, end, before); + } + i = end - 1; // reset to end (-1 so next iteration is ok) + } + } + + /* + N2. Any remaining neutrals take the embedding direction. + */ + for (i = 0; i < strLength; ++i) { + if (types[i] === 'ON') { + types[i] = e; + } + } + + /* + I1. For all characters with an even (left-to-right) embedding direction, + those of type R go up one level and those of type AN or EN go up two + levels. + I2. For all characters with an odd (right-to-left) embedding direction, + those of type L, EN or AN go up one level. + */ + for (i = 0; i < strLength; ++i) { + t = types[i]; + if (isEven(levels[i])) { + if (t === 'R') { + levels[i] += 1; + } else if (t === 'AN' || t === 'EN') { + levels[i] += 2; + } + } else { // isOdd + if (t === 'L' || t === 'AN' || t === 'EN') { + levels[i] += 1; + } + } + } + + /* + L1. On each line, reset the embedding level of the following characters to + the paragraph embedding level: + + segment separators, + paragraph separators, + any sequence of whitespace characters preceding a segment separator or + paragraph separator, and any sequence of white space characters at the end + of the line. + */ + + // don't bother as text is only single line + + /* + L2. From the highest level found in the text to the lowest odd level on + each line, reverse any contiguous sequence of characters that are at that + level or higher. + */ + + // find highest level & lowest odd level + var highestLevel = -1; + var lowestOddLevel = 99; + var level; + for (i = 0, ii = levels.length; i < ii; ++i) { + level = levels[i]; + if (highestLevel < level) { + highestLevel = level; + } + if (lowestOddLevel > level && isOdd(level)) { + lowestOddLevel = level; + } + } + + // now reverse between those limits + for (level = highestLevel; level >= lowestOddLevel; --level) { + // find segments to reverse + var start = -1; + for (i = 0, ii = levels.length; i < ii; ++i) { + if (levels[i] < level) { + if (start >= 0) { + reverseValues(chars, start, i); + start = -1; + } + } else if (start < 0) { + start = i; + } + } + if (start >= 0) { + reverseValues(chars, start, levels.length); + } + } + + /* + L3. Combining marks applied to a right-to-left base character will at this + point precede their base character. If the rendering engine expects them to + follow the base characters in the final display process, then the ordering + of the marks and the base character must be reversed. + */ + + // don't bother for now + + /* + L4. A character that possesses the mirrored property as specified by + Section 4.7, Mirrored, must be depicted by a mirrored glyph if the resolved + directionality of that character is R. + */ + + // don't mirror as characters are already mirrored in the pdf + + // Finally, return string + for (i = 0, ii = chars.length; i < ii; ++i) { + var ch = chars[i]; + if (ch === '<' || ch === '>') { + chars[i] = ''; + } + } + return createBidiText(chars.join(''), isLTR); + } + + return bidi; +})(); + + +var MurmurHash3_64 = (function MurmurHash3_64Closure (seed) { + // Workaround for missing math precison in JS. + var MASK_HIGH = 0xffff0000; + var MASK_LOW = 0xffff; + + function MurmurHash3_64 (seed) { + var SEED = 0xc3d2e1f0; + this.h1 = seed ? seed & 0xffffffff : SEED; + this.h2 = seed ? seed & 0xffffffff : SEED; + } + + var alwaysUseUint32ArrayView = false; + // old webkits have issues with non-aligned arrays + try { + new Uint32Array(new Uint8Array(5).buffer, 0, 1); + } catch (e) { + alwaysUseUint32ArrayView = true; + } + + MurmurHash3_64.prototype = { + update: function MurmurHash3_64_update(input) { + var useUint32ArrayView = alwaysUseUint32ArrayView; + var i; + if (typeof input === 'string') { + var data = new Uint8Array(input.length * 2); + var length = 0; + for (i = 0; i < input.length; i++) { + var code = input.charCodeAt(i); + if (code <= 0xff) { + data[length++] = code; + } + else { + data[length++] = code >>> 8; + data[length++] = code & 0xff; + } + } + } else if (input instanceof Uint8Array) { + data = input; + length = data.length; + } else if (typeof input === 'object' && ('length' in input)) { + // processing regular arrays as well, e.g. for IE9 + data = input; + length = data.length; + useUint32ArrayView = true; + } else { + throw new Error('Wrong data format in MurmurHash3_64_update. ' + + 'Input must be a string or array.'); + } + + var blockCounts = length >> 2; + var tailLength = length - blockCounts * 4; + // we don't care about endianness here + var dataUint32 = useUint32ArrayView ? + new Uint32ArrayView(data, blockCounts) : + new Uint32Array(data.buffer, 0, blockCounts); + var k1 = 0; + var k2 = 0; + var h1 = this.h1; + var h2 = this.h2; + var C1 = 0xcc9e2d51; + var C2 = 0x1b873593; + var C1_LOW = C1 & MASK_LOW; + var C2_LOW = C2 & MASK_LOW; + + for (i = 0; i < blockCounts; i++) { + if (i & 1) { + k1 = dataUint32[i]; + k1 = (k1 * C1 & MASK_HIGH) | (k1 * C1_LOW & MASK_LOW); + k1 = k1 << 15 | k1 >>> 17; + k1 = (k1 * C2 & MASK_HIGH) | (k1 * C2_LOW & MASK_LOW); + h1 ^= k1; + h1 = h1 << 13 | h1 >>> 19; + h1 = h1 * 5 + 0xe6546b64; + } else { + k2 = dataUint32[i]; + k2 = (k2 * C1 & MASK_HIGH) | (k2 * C1_LOW & MASK_LOW); + k2 = k2 << 15 | k2 >>> 17; + k2 = (k2 * C2 & MASK_HIGH) | (k2 * C2_LOW & MASK_LOW); + h2 ^= k2; + h2 = h2 << 13 | h2 >>> 19; + h2 = h2 * 5 + 0xe6546b64; + } + } + + k1 = 0; + + switch (tailLength) { + case 3: + k1 ^= data[blockCounts * 4 + 2] << 16; + /* falls through */ + case 2: + k1 ^= data[blockCounts * 4 + 1] << 8; + /* falls through */ + case 1: + k1 ^= data[blockCounts * 4]; + /* falls through */ + k1 = (k1 * C1 & MASK_HIGH) | (k1 * C1_LOW & MASK_LOW); + k1 = k1 << 15 | k1 >>> 17; + k1 = (k1 * C2 & MASK_HIGH) | (k1 * C2_LOW & MASK_LOW); + if (blockCounts & 1) { + h1 ^= k1; + } else { + h2 ^= k1; + } + } + + this.h1 = h1; + this.h2 = h2; + return this; + }, + + hexdigest: function MurmurHash3_64_hexdigest () { + var h1 = this.h1; + var h2 = this.h2; + + h1 ^= h2 >>> 1; + h1 = (h1 * 0xed558ccd & MASK_HIGH) | (h1 * 0x8ccd & MASK_LOW); + h2 = (h2 * 0xff51afd7 & MASK_HIGH) | + (((h2 << 16 | h1 >>> 16) * 0xafd7ed55 & MASK_HIGH) >>> 16); + h1 ^= h2 >>> 1; + h1 = (h1 * 0x1a85ec53 & MASK_HIGH) | (h1 * 0xec53 & MASK_LOW); + h2 = (h2 * 0xc4ceb9fe & MASK_HIGH) | + (((h2 << 16 | h1 >>> 16) * 0xb9fe1a85 & MASK_HIGH) >>> 16); + h1 ^= h2 >>> 1; + + for (var i = 0, arr = [h1, h2], str = ''; i < arr.length; i++) { + var hex = (arr[i] >>> 0).toString(16); + while (hex.length < 8) { + hex = '0' + hex; + } + str += hex; + } + + return str; + } + }; + + return MurmurHash3_64; +})(); + + +}).call((typeof window === 'undefined') ? this : window); + +if (!PDFJS.workerSrc && typeof document !== 'undefined') { + // workerSrc is not set -- using last script url to define default location + PDFJS.workerSrc = (function () { + 'use strict'; + var scriptTagContainer = document.body || + document.getElementsByTagName('head')[0]; + var pdfjsSrc = scriptTagContainer.lastChild.src; + return pdfjsSrc && pdfjsSrc.replace(/\.js$/i, '.worker.js'); + })(); +} + + diff --git a/public/bower_components/rangy/rangy-classapplier.js b/public/bower_components/rangy/rangy-classapplier.js new file mode 100644 index 0000000..a7bafb7 --- /dev/null +++ b/public/bower_components/rangy/rangy-classapplier.js @@ -0,0 +1,1103 @@ +/** + * Class Applier module for Rangy. + * Adds, removes and toggles classes on Ranges and Selections + * + * Part of Rangy, a cross-browser JavaScript range and selection library + * https://github.com/timdown/rangy + * + * Depends on Rangy core. + * + * Copyright 2015, Tim Down + * Licensed under the MIT license. + * Version: 1.3.0 + * Build date: 10 May 2015 + */ +(function(factory, root) { + if (typeof define == "function" && define.amd) { + // AMD. Register as an anonymous module with a dependency on Rangy. + define(["./rangy-core"], factory); + } else if (typeof module != "undefined" && typeof exports == "object") { + // Node/CommonJS style + module.exports = factory( require("rangy") ); + } else { + // No AMD or CommonJS support so we use the rangy property of root (probably the global variable) + factory(root.rangy); + } +})(function(rangy) { + rangy.createModule("ClassApplier", ["WrappedSelection"], function(api, module) { + var dom = api.dom; + var DomPosition = dom.DomPosition; + var contains = dom.arrayContains; + var util = api.util; + var forEach = util.forEach; + + + var defaultTagName = "span"; + var createElementNSSupported = util.isHostMethod(document, "createElementNS"); + + function each(obj, func) { + for (var i in obj) { + if (obj.hasOwnProperty(i)) { + if (func(i, obj[i]) === false) { + return false; + } + } + } + return true; + } + + function trim(str) { + return str.replace(/^\s\s*/, "").replace(/\s\s*$/, ""); + } + + function classNameContainsClass(fullClassName, className) { + return !!fullClassName && new RegExp("(?:^|\\s)" + className + "(?:\\s|$)").test(fullClassName); + } + + // Inefficient, inelegant nonsense for IE's svg element, which has no classList and non-HTML className implementation + function hasClass(el, className) { + if (typeof el.classList == "object") { + return el.classList.contains(className); + } else { + var classNameSupported = (typeof el.className == "string"); + var elClass = classNameSupported ? el.className : el.getAttribute("class"); + return classNameContainsClass(elClass, className); + } + } + + function addClass(el, className) { + if (typeof el.classList == "object") { + el.classList.add(className); + } else { + var classNameSupported = (typeof el.className == "string"); + var elClass = classNameSupported ? el.className : el.getAttribute("class"); + if (elClass) { + if (!classNameContainsClass(elClass, className)) { + elClass += " " + className; + } + } else { + elClass = className; + } + if (classNameSupported) { + el.className = elClass; + } else { + el.setAttribute("class", elClass); + } + } + } + + var removeClass = (function() { + function replacer(matched, whiteSpaceBefore, whiteSpaceAfter) { + return (whiteSpaceBefore && whiteSpaceAfter) ? " " : ""; + } + + return function(el, className) { + if (typeof el.classList == "object") { + el.classList.remove(className); + } else { + var classNameSupported = (typeof el.className == "string"); + var elClass = classNameSupported ? el.className : el.getAttribute("class"); + elClass = elClass.replace(new RegExp("(^|\\s)" + className + "(\\s|$)"), replacer); + if (classNameSupported) { + el.className = elClass; + } else { + el.setAttribute("class", elClass); + } + } + }; + })(); + + function getClass(el) { + var classNameSupported = (typeof el.className == "string"); + return classNameSupported ? el.className : el.getAttribute("class"); + } + + function sortClassName(className) { + return className && className.split(/\s+/).sort().join(" "); + } + + function getSortedClassName(el) { + return sortClassName( getClass(el) ); + } + + function haveSameClasses(el1, el2) { + return getSortedClassName(el1) == getSortedClassName(el2); + } + + function hasAllClasses(el, className) { + var classes = className.split(/\s+/); + for (var i = 0, len = classes.length; i < len; ++i) { + if (!hasClass(el, trim(classes[i]))) { + return false; + } + } + return true; + } + + function canTextBeStyled(textNode) { + var parent = textNode.parentNode; + return (parent && parent.nodeType == 1 && !/^(textarea|style|script|select|iframe)$/i.test(parent.nodeName)); + } + + function movePosition(position, oldParent, oldIndex, newParent, newIndex) { + var posNode = position.node, posOffset = position.offset; + var newNode = posNode, newOffset = posOffset; + + if (posNode == newParent && posOffset > newIndex) { + ++newOffset; + } + + if (posNode == oldParent && (posOffset == oldIndex || posOffset == oldIndex + 1)) { + newNode = newParent; + newOffset += newIndex - oldIndex; + } + + if (posNode == oldParent && posOffset > oldIndex + 1) { + --newOffset; + } + + position.node = newNode; + position.offset = newOffset; + } + + function movePositionWhenRemovingNode(position, parentNode, index) { + if (position.node == parentNode && position.offset > index) { + --position.offset; + } + } + + function movePreservingPositions(node, newParent, newIndex, positionsToPreserve) { + // For convenience, allow newIndex to be -1 to mean "insert at the end". + if (newIndex == -1) { + newIndex = newParent.childNodes.length; + } + + var oldParent = node.parentNode; + var oldIndex = dom.getNodeIndex(node); + + forEach(positionsToPreserve, function(position) { + movePosition(position, oldParent, oldIndex, newParent, newIndex); + }); + + // Now actually move the node. + if (newParent.childNodes.length == newIndex) { + newParent.appendChild(node); + } else { + newParent.insertBefore(node, newParent.childNodes[newIndex]); + } + } + + function removePreservingPositions(node, positionsToPreserve) { + + var oldParent = node.parentNode; + var oldIndex = dom.getNodeIndex(node); + + forEach(positionsToPreserve, function(position) { + movePositionWhenRemovingNode(position, oldParent, oldIndex); + }); + + dom.removeNode(node); + } + + function moveChildrenPreservingPositions(node, newParent, newIndex, removeNode, positionsToPreserve) { + var child, children = []; + while ( (child = node.firstChild) ) { + movePreservingPositions(child, newParent, newIndex++, positionsToPreserve); + children.push(child); + } + if (removeNode) { + removePreservingPositions(node, positionsToPreserve); + } + return children; + } + + function replaceWithOwnChildrenPreservingPositions(element, positionsToPreserve) { + return moveChildrenPreservingPositions(element, element.parentNode, dom.getNodeIndex(element), true, positionsToPreserve); + } + + function rangeSelectsAnyText(range, textNode) { + var textNodeRange = range.cloneRange(); + textNodeRange.selectNodeContents(textNode); + + var intersectionRange = textNodeRange.intersection(range); + var text = intersectionRange ? intersectionRange.toString() : ""; + + return text != ""; + } + + function getEffectiveTextNodes(range) { + var nodes = range.getNodes([3]); + + // Optimization as per issue 145 + + // Remove non-intersecting text nodes from the start of the range + var start = 0, node; + while ( (node = nodes[start]) && !rangeSelectsAnyText(range, node) ) { + ++start; + } + + // Remove non-intersecting text nodes from the start of the range + var end = nodes.length - 1; + while ( (node = nodes[end]) && !rangeSelectsAnyText(range, node) ) { + --end; + } + + return nodes.slice(start, end + 1); + } + + function elementsHaveSameNonClassAttributes(el1, el2) { + if (el1.attributes.length != el2.attributes.length) return false; + for (var i = 0, len = el1.attributes.length, attr1, attr2, name; i < len; ++i) { + attr1 = el1.attributes[i]; + name = attr1.name; + if (name != "class") { + attr2 = el2.attributes.getNamedItem(name); + if ( (attr1 === null) != (attr2 === null) ) return false; + if (attr1.specified != attr2.specified) return false; + if (attr1.specified && attr1.nodeValue !== attr2.nodeValue) return false; + } + } + return true; + } + + function elementHasNonClassAttributes(el, exceptions) { + for (var i = 0, len = el.attributes.length, attrName; i < len; ++i) { + attrName = el.attributes[i].name; + if ( !(exceptions && contains(exceptions, attrName)) && el.attributes[i].specified && attrName != "class") { + return true; + } + } + return false; + } + + var getComputedStyleProperty = dom.getComputedStyleProperty; + var isEditableElement = (function() { + var testEl = document.createElement("div"); + return typeof testEl.isContentEditable == "boolean" ? + function (node) { + return node && node.nodeType == 1 && node.isContentEditable; + } : + function (node) { + if (!node || node.nodeType != 1 || node.contentEditable == "false") { + return false; + } + return node.contentEditable == "true" || isEditableElement(node.parentNode); + }; + })(); + + function isEditingHost(node) { + var parent; + return node && node.nodeType == 1 && + (( (parent = node.parentNode) && parent.nodeType == 9 && parent.designMode == "on") || + (isEditableElement(node) && !isEditableElement(node.parentNode))); + } + + function isEditable(node) { + return (isEditableElement(node) || (node.nodeType != 1 && isEditableElement(node.parentNode))) && !isEditingHost(node); + } + + var inlineDisplayRegex = /^inline(-block|-table)?$/i; + + function isNonInlineElement(node) { + return node && node.nodeType == 1 && !inlineDisplayRegex.test(getComputedStyleProperty(node, "display")); + } + + // White space characters as defined by HTML 4 (http://www.w3.org/TR/html401/struct/text.html) + var htmlNonWhiteSpaceRegex = /[^\r\n\t\f \u200B]/; + + function isUnrenderedWhiteSpaceNode(node) { + if (node.data.length == 0) { + return true; + } + if (htmlNonWhiteSpaceRegex.test(node.data)) { + return false; + } + var cssWhiteSpace = getComputedStyleProperty(node.parentNode, "whiteSpace"); + switch (cssWhiteSpace) { + case "pre": + case "pre-wrap": + case "-moz-pre-wrap": + return false; + case "pre-line": + if (/[\r\n]/.test(node.data)) { + return false; + } + } + + // We now have a whitespace-only text node that may be rendered depending on its context. If it is adjacent to a + // non-inline element, it will not be rendered. This seems to be a good enough definition. + return isNonInlineElement(node.previousSibling) || isNonInlineElement(node.nextSibling); + } + + function getRangeBoundaries(ranges) { + var positions = [], i, range; + for (i = 0; range = ranges[i++]; ) { + positions.push( + new DomPosition(range.startContainer, range.startOffset), + new DomPosition(range.endContainer, range.endOffset) + ); + } + return positions; + } + + function updateRangesFromBoundaries(ranges, positions) { + for (var i = 0, range, start, end, len = ranges.length; i < len; ++i) { + range = ranges[i]; + start = positions[i * 2]; + end = positions[i * 2 + 1]; + range.setStartAndEnd(start.node, start.offset, end.node, end.offset); + } + } + + function isSplitPoint(node, offset) { + if (dom.isCharacterDataNode(node)) { + if (offset == 0) { + return !!node.previousSibling; + } else if (offset == node.length) { + return !!node.nextSibling; + } else { + return true; + } + } + + return offset > 0 && offset < node.childNodes.length; + } + + function splitNodeAt(node, descendantNode, descendantOffset, positionsToPreserve) { + var newNode, parentNode; + var splitAtStart = (descendantOffset == 0); + + if (dom.isAncestorOf(descendantNode, node)) { + return node; + } + + if (dom.isCharacterDataNode(descendantNode)) { + var descendantIndex = dom.getNodeIndex(descendantNode); + if (descendantOffset == 0) { + descendantOffset = descendantIndex; + } else if (descendantOffset == descendantNode.length) { + descendantOffset = descendantIndex + 1; + } else { + throw module.createError("splitNodeAt() should not be called with offset in the middle of a data node (" + + descendantOffset + " in " + descendantNode.data); + } + descendantNode = descendantNode.parentNode; + } + + if (isSplitPoint(descendantNode, descendantOffset)) { + // descendantNode is now guaranteed not to be a text or other character node + newNode = descendantNode.cloneNode(false); + parentNode = descendantNode.parentNode; + if (newNode.id) { + newNode.removeAttribute("id"); + } + var child, newChildIndex = 0; + + while ( (child = descendantNode.childNodes[descendantOffset]) ) { + movePreservingPositions(child, newNode, newChildIndex++, positionsToPreserve); + } + movePreservingPositions(newNode, parentNode, dom.getNodeIndex(descendantNode) + 1, positionsToPreserve); + return (descendantNode == node) ? newNode : splitNodeAt(node, parentNode, dom.getNodeIndex(newNode), positionsToPreserve); + } else if (node != descendantNode) { + newNode = descendantNode.parentNode; + + // Work out a new split point in the parent node + var newNodeIndex = dom.getNodeIndex(descendantNode); + + if (!splitAtStart) { + newNodeIndex++; + } + return splitNodeAt(node, newNode, newNodeIndex, positionsToPreserve); + } + return node; + } + + function areElementsMergeable(el1, el2) { + return el1.namespaceURI == el2.namespaceURI && + el1.tagName.toLowerCase() == el2.tagName.toLowerCase() && + haveSameClasses(el1, el2) && + elementsHaveSameNonClassAttributes(el1, el2) && + getComputedStyleProperty(el1, "display") == "inline" && + getComputedStyleProperty(el2, "display") == "inline"; + } + + function createAdjacentMergeableTextNodeGetter(forward) { + var siblingPropName = forward ? "nextSibling" : "previousSibling"; + + return function(textNode, checkParentElement) { + var el = textNode.parentNode; + var adjacentNode = textNode[siblingPropName]; + if (adjacentNode) { + // Can merge if the node's previous/next sibling is a text node + if (adjacentNode && adjacentNode.nodeType == 3) { + return adjacentNode; + } + } else if (checkParentElement) { + // Compare text node parent element with its sibling + adjacentNode = el[siblingPropName]; + if (adjacentNode && adjacentNode.nodeType == 1 && areElementsMergeable(el, adjacentNode)) { + var adjacentNodeChild = adjacentNode[forward ? "firstChild" : "lastChild"]; + if (adjacentNodeChild && adjacentNodeChild.nodeType == 3) { + return adjacentNodeChild; + } + } + } + return null; + }; + } + + var getPreviousMergeableTextNode = createAdjacentMergeableTextNodeGetter(false), + getNextMergeableTextNode = createAdjacentMergeableTextNodeGetter(true); + + + function Merge(firstNode) { + this.isElementMerge = (firstNode.nodeType == 1); + this.textNodes = []; + var firstTextNode = this.isElementMerge ? firstNode.lastChild : firstNode; + if (firstTextNode) { + this.textNodes[0] = firstTextNode; + } + } + + Merge.prototype = { + doMerge: function(positionsToPreserve) { + var textNodes = this.textNodes; + var firstTextNode = textNodes[0]; + if (textNodes.length > 1) { + var firstTextNodeIndex = dom.getNodeIndex(firstTextNode); + var textParts = [], combinedTextLength = 0, textNode, parent; + forEach(textNodes, function(textNode, i) { + parent = textNode.parentNode; + if (i > 0) { + parent.removeChild(textNode); + if (!parent.hasChildNodes()) { + dom.removeNode(parent); + } + if (positionsToPreserve) { + forEach(positionsToPreserve, function(position) { + // Handle case where position is inside the text node being merged into a preceding node + if (position.node == textNode) { + position.node = firstTextNode; + position.offset += combinedTextLength; + } + // Handle case where both text nodes precede the position within the same parent node + if (position.node == parent && position.offset > firstTextNodeIndex) { + --position.offset; + if (position.offset == firstTextNodeIndex + 1 && i < len - 1) { + position.node = firstTextNode; + position.offset = combinedTextLength; + } + } + }); + } + } + textParts[i] = textNode.data; + combinedTextLength += textNode.data.length; + }); + firstTextNode.data = textParts.join(""); + } + return firstTextNode.data; + }, + + getLength: function() { + var i = this.textNodes.length, len = 0; + while (i--) { + len += this.textNodes[i].length; + } + return len; + }, + + toString: function() { + var textParts = []; + forEach(this.textNodes, function(textNode, i) { + textParts[i] = "'" + textNode.data + "'"; + }); + return "[Merge(" + textParts.join(",") + ")]"; + } + }; + + var optionProperties = ["elementTagName", "ignoreWhiteSpace", "applyToEditableOnly", "useExistingElements", + "removeEmptyElements", "onElementCreate"]; + + // TODO: Populate this with every attribute name that corresponds to a property with a different name. Really?? + var attrNamesForProperties = {}; + + function ClassApplier(className, options, tagNames) { + var normalize, i, len, propName, applier = this; + applier.cssClass = applier.className = className; // cssClass property is for backward compatibility + + var elementPropertiesFromOptions = null, elementAttributes = {}; + + // Initialize from options object + if (typeof options == "object" && options !== null) { + if (typeof options.elementTagName !== "undefined") { + options.elementTagName = options.elementTagName.toLowerCase(); + } + tagNames = options.tagNames; + elementPropertiesFromOptions = options.elementProperties; + elementAttributes = options.elementAttributes; + + for (i = 0; propName = optionProperties[i++]; ) { + if (options.hasOwnProperty(propName)) { + applier[propName] = options[propName]; + } + } + normalize = options.normalize; + } else { + normalize = options; + } + + // Backward compatibility: the second parameter can also be a Boolean indicating to normalize after unapplying + applier.normalize = (typeof normalize == "undefined") ? true : normalize; + + // Initialize element properties and attribute exceptions + applier.attrExceptions = []; + var el = document.createElement(applier.elementTagName); + applier.elementProperties = applier.copyPropertiesToElement(elementPropertiesFromOptions, el, true); + each(elementAttributes, function(attrName, attrValue) { + applier.attrExceptions.push(attrName); + // Ensure each attribute value is a string + elementAttributes[attrName] = "" + attrValue; + }); + applier.elementAttributes = elementAttributes; + + applier.elementSortedClassName = applier.elementProperties.hasOwnProperty("className") ? + sortClassName(applier.elementProperties.className + " " + className) : className; + + // Initialize tag names + applier.applyToAnyTagName = false; + var type = typeof tagNames; + if (type == "string") { + if (tagNames == "*") { + applier.applyToAnyTagName = true; + } else { + applier.tagNames = trim(tagNames.toLowerCase()).split(/\s*,\s*/); + } + } else if (type == "object" && typeof tagNames.length == "number") { + applier.tagNames = []; + for (i = 0, len = tagNames.length; i < len; ++i) { + if (tagNames[i] == "*") { + applier.applyToAnyTagName = true; + } else { + applier.tagNames.push(tagNames[i].toLowerCase()); + } + } + } else { + applier.tagNames = [applier.elementTagName]; + } + } + + ClassApplier.prototype = { + elementTagName: defaultTagName, + elementProperties: {}, + elementAttributes: {}, + ignoreWhiteSpace: true, + applyToEditableOnly: false, + useExistingElements: true, + removeEmptyElements: true, + onElementCreate: null, + + copyPropertiesToElement: function(props, el, createCopy) { + var s, elStyle, elProps = {}, elPropsStyle, propValue, elPropValue, attrName; + + for (var p in props) { + if (props.hasOwnProperty(p)) { + propValue = props[p]; + elPropValue = el[p]; + + // Special case for class. The copied properties object has the applier's class as well as its own + // to simplify checks when removing styling elements + if (p == "className") { + addClass(el, propValue); + addClass(el, this.className); + el[p] = sortClassName(el[p]); + if (createCopy) { + elProps[p] = propValue; + } + } + + // Special case for style + else if (p == "style") { + elStyle = elPropValue; + if (createCopy) { + elProps[p] = elPropsStyle = {}; + } + for (s in props[p]) { + if (props[p].hasOwnProperty(s)) { + elStyle[s] = propValue[s]; + if (createCopy) { + elPropsStyle[s] = elStyle[s]; + } + } + } + this.attrExceptions.push(p); + } else { + el[p] = propValue; + // Copy the property back from the dummy element so that later comparisons to check whether + // elements may be removed are checking against the right value. For example, the href property + // of an element returns a fully qualified URL even if it was previously assigned a relative + // URL. + if (createCopy) { + elProps[p] = el[p]; + + // Not all properties map to identically-named attributes + attrName = attrNamesForProperties.hasOwnProperty(p) ? attrNamesForProperties[p] : p; + this.attrExceptions.push(attrName); + } + } + } + } + + return createCopy ? elProps : ""; + }, + + copyAttributesToElement: function(attrs, el) { + for (var attrName in attrs) { + if (attrs.hasOwnProperty(attrName) && !/^class(?:Name)?$/i.test(attrName)) { + el.setAttribute(attrName, attrs[attrName]); + } + } + }, + + appliesToElement: function(el) { + return contains(this.tagNames, el.tagName.toLowerCase()); + }, + + getEmptyElements: function(range) { + var applier = this; + return range.getNodes([1], function(el) { + return applier.appliesToElement(el) && !el.hasChildNodes(); + }); + }, + + hasClass: function(node) { + return node.nodeType == 1 && + (this.applyToAnyTagName || this.appliesToElement(node)) && + hasClass(node, this.className); + }, + + getSelfOrAncestorWithClass: function(node) { + while (node) { + if (this.hasClass(node)) { + return node; + } + node = node.parentNode; + } + return null; + }, + + isModifiable: function(node) { + return !this.applyToEditableOnly || isEditable(node); + }, + + // White space adjacent to an unwrappable node can be ignored for wrapping + isIgnorableWhiteSpaceNode: function(node) { + return this.ignoreWhiteSpace && node && node.nodeType == 3 && isUnrenderedWhiteSpaceNode(node); + }, + + // Normalizes nodes after applying a class to a Range. + postApply: function(textNodes, range, positionsToPreserve, isUndo) { + var firstNode = textNodes[0], lastNode = textNodes[textNodes.length - 1]; + + var merges = [], currentMerge; + + var rangeStartNode = firstNode, rangeEndNode = lastNode; + var rangeStartOffset = 0, rangeEndOffset = lastNode.length; + + var textNode, precedingTextNode; + + // Check for every required merge and create a Merge object for each + forEach(textNodes, function(textNode) { + precedingTextNode = getPreviousMergeableTextNode(textNode, !isUndo); + if (precedingTextNode) { + if (!currentMerge) { + currentMerge = new Merge(precedingTextNode); + merges.push(currentMerge); + } + currentMerge.textNodes.push(textNode); + if (textNode === firstNode) { + rangeStartNode = currentMerge.textNodes[0]; + rangeStartOffset = rangeStartNode.length; + } + if (textNode === lastNode) { + rangeEndNode = currentMerge.textNodes[0]; + rangeEndOffset = currentMerge.getLength(); + } + } else { + currentMerge = null; + } + }); + + // Test whether the first node after the range needs merging + var nextTextNode = getNextMergeableTextNode(lastNode, !isUndo); + + if (nextTextNode) { + if (!currentMerge) { + currentMerge = new Merge(lastNode); + merges.push(currentMerge); + } + currentMerge.textNodes.push(nextTextNode); + } + + // Apply the merges + if (merges.length) { + for (i = 0, len = merges.length; i < len; ++i) { + merges[i].doMerge(positionsToPreserve); + } + + // Set the range boundaries + range.setStartAndEnd(rangeStartNode, rangeStartOffset, rangeEndNode, rangeEndOffset); + } + }, + + createContainer: function(parentNode) { + var doc = dom.getDocument(parentNode); + var namespace; + var el = createElementNSSupported && !dom.isHtmlNamespace(parentNode) && (namespace = parentNode.namespaceURI) ? + doc.createElementNS(parentNode.namespaceURI, this.elementTagName) : + doc.createElement(this.elementTagName); + + this.copyPropertiesToElement(this.elementProperties, el, false); + this.copyAttributesToElement(this.elementAttributes, el); + addClass(el, this.className); + if (this.onElementCreate) { + this.onElementCreate(el, this); + } + return el; + }, + + elementHasProperties: function(el, props) { + var applier = this; + return each(props, function(p, propValue) { + if (p == "className") { + // For checking whether we should reuse an existing element, we just want to check that the element + // has all the classes specified in the className property. When deciding whether the element is + // removable when unapplying a class, there is separate special handling to check whether the + // element has extra classes so the same simple check will do. + return hasAllClasses(el, propValue); + } else if (typeof propValue == "object") { + if (!applier.elementHasProperties(el[p], propValue)) { + return false; + } + } else if (el[p] !== propValue) { + return false; + } + }); + }, + + elementHasAttributes: function(el, attrs) { + return each(attrs, function(name, value) { + if (el.getAttribute(name) !== value) { + return false; + } + }); + }, + + applyToTextNode: function(textNode, positionsToPreserve) { + + // Check whether the text node can be styled. Text within a + + +
          +

          Not found :(

          +

          Sorry, but the page you were trying to view does not exist.

          +

          It looks like this was the result of either:

          +
            +
          • a mistyped address
          • +
          • an out-of-date link
          • +
          + + +
          + + -- 1.7.1