tui_editor-rails 1.0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +8 -0
- data/.ruby-version +1 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +20 -0
- data/README.md +69 -0
- data/Rakefile +2 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/example/.gitignore +30 -0
- data/example/.ruby-version +1 -0
- data/example/Gemfile +64 -0
- data/example/Gemfile.lock +224 -0
- data/example/README.md +67 -0
- data/example/Rakefile +6 -0
- data/example/app/assets/config/manifest.js +3 -0
- data/example/app/assets/images/.keep +0 -0
- data/example/app/assets/images/screen_capture.png +0 -0
- data/example/app/assets/javascripts/application.js +23 -0
- data/example/app/assets/javascripts/cable.js +13 -0
- data/example/app/assets/javascripts/channels/.keep +0 -0
- data/example/app/assets/javascripts/home.coffee +3 -0
- data/example/app/assets/javascripts/posts.coffee +3 -0
- data/example/app/assets/stylesheets/application.scss +4 -0
- data/example/app/assets/stylesheets/home.scss +3 -0
- data/example/app/assets/stylesheets/posts.scss +3 -0
- data/example/app/assets/stylesheets/scaffolds.scss +84 -0
- data/example/app/channels/application_cable/channel.rb +4 -0
- data/example/app/channels/application_cable/connection.rb +4 -0
- data/example/app/controllers/application_controller.rb +2 -0
- data/example/app/controllers/concerns/.keep +0 -0
- data/example/app/controllers/home_controller.rb +4 -0
- data/example/app/controllers/posts_controller.rb +74 -0
- data/example/app/helpers/application_helper.rb +2 -0
- data/example/app/helpers/home_helper.rb +2 -0
- data/example/app/helpers/posts_helper.rb +2 -0
- data/example/app/jobs/application_job.rb +2 -0
- data/example/app/mailers/application_mailer.rb +4 -0
- data/example/app/models/application_record.rb +3 -0
- data/example/app/models/concerns/.keep +0 -0
- data/example/app/models/post.rb +2 -0
- data/example/app/views/home/index.html.erb +11 -0
- data/example/app/views/layouts/application.html.erb +14 -0
- data/example/app/views/layouts/mailer.html.erb +13 -0
- data/example/app/views/layouts/mailer.text.erb +1 -0
- data/example/app/views/posts/_form.html.erb +27 -0
- data/example/app/views/posts/_post.json.jbuilder +2 -0
- data/example/app/views/posts/edit.html.erb +6 -0
- data/example/app/views/posts/index.html.erb +29 -0
- data/example/app/views/posts/index.json.jbuilder +1 -0
- data/example/app/views/posts/new.html.erb +5 -0
- data/example/app/views/posts/show.html.erb +14 -0
- data/example/app/views/posts/show.json.jbuilder +1 -0
- data/example/bin/bundle +3 -0
- data/example/bin/rails +9 -0
- data/example/bin/rake +9 -0
- data/example/bin/setup +36 -0
- data/example/bin/spring +17 -0
- data/example/bin/update +31 -0
- data/example/bin/yarn +11 -0
- data/example/config.ru +5 -0
- data/example/config/application.rb +19 -0
- data/example/config/boot.rb +4 -0
- data/example/config/cable.yml +10 -0
- data/example/config/credentials.yml.enc +1 -0
- data/example/config/database.yml +25 -0
- data/example/config/environment.rb +5 -0
- data/example/config/environments/development.rb +61 -0
- data/example/config/environments/production.rb +94 -0
- data/example/config/environments/test.rb +46 -0
- data/example/config/initializers/application_controller_renderer.rb +8 -0
- data/example/config/initializers/assets.rb +14 -0
- data/example/config/initializers/backtrace_silencers.rb +7 -0
- data/example/config/initializers/content_security_policy.rb +22 -0
- data/example/config/initializers/cookies_serializer.rb +5 -0
- data/example/config/initializers/filter_parameter_logging.rb +4 -0
- data/example/config/initializers/inflections.rb +16 -0
- data/example/config/initializers/mime_types.rb +4 -0
- data/example/config/initializers/wrap_parameters.rb +14 -0
- data/example/config/locales/en.yml +33 -0
- data/example/config/puma.rb +34 -0
- data/example/config/routes.rb +6 -0
- data/example/config/spring.rb +6 -0
- data/example/config/storage.yml +35 -0
- data/example/db/migrate/20180208210404_create_posts.rb +10 -0
- data/example/db/schema.rb +22 -0
- data/example/db/seeds.rb +7 -0
- data/example/lib/assets/.keep +0 -0
- data/example/lib/tasks/.keep +0 -0
- data/example/log/.keep +0 -0
- data/example/package.json +5 -0
- data/example/public/404.html +67 -0
- data/example/public/422.html +67 -0
- data/example/public/500.html +66 -0
- data/example/public/apple-touch-icon-precomposed.png +0 -0
- data/example/public/apple-touch-icon.png +0 -0
- data/example/public/favicon.ico +0 -0
- data/example/public/robots.txt +1 -0
- data/example/test/application_system_test_case.rb +5 -0
- data/example/test/controllers/.keep +0 -0
- data/example/test/controllers/home_controller_test.rb +9 -0
- data/example/test/controllers/posts_controller_test.rb +48 -0
- data/example/test/fixtures/.keep +0 -0
- data/example/test/fixtures/files/.keep +0 -0
- data/example/test/fixtures/posts.yml +9 -0
- data/example/test/helpers/.keep +0 -0
- data/example/test/integration/.keep +0 -0
- data/example/test/mailers/.keep +0 -0
- data/example/test/models/.keep +0 -0
- data/example/test/models/post_test.rb +7 -0
- data/example/test/system/.keep +0 -0
- data/example/test/system/posts_test.rb +45 -0
- data/example/test/test_helper.rb +10 -0
- data/example/tmp/.keep +0 -0
- data/example/vendor/.keep +0 -0
- data/lib/tui_editor/rails.rb +8 -0
- data/lib/tui_editor/rails/version.rb +5 -0
- data/tui_editor-rails.gemspec +34 -0
- data/vendor/assets/components/codemirror/.bower.json +31 -0
- data/vendor/assets/components/codemirror/AUTHORS +714 -0
- data/vendor/assets/components/codemirror/CHANGELOG.md +1316 -0
- data/vendor/assets/components/codemirror/CONTRIBUTING.md +92 -0
- data/vendor/assets/components/codemirror/LICENSE +21 -0
- data/vendor/assets/components/codemirror/README.md +35 -0
- data/vendor/assets/components/codemirror/addon/comment/comment.js +209 -0
- data/vendor/assets/components/codemirror/addon/comment/continuecomment.js +78 -0
- data/vendor/assets/components/codemirror/addon/dialog/dialog.css +32 -0
- data/vendor/assets/components/codemirror/addon/dialog/dialog.js +157 -0
- data/vendor/assets/components/codemirror/addon/display/autorefresh.js +47 -0
- data/vendor/assets/components/codemirror/addon/display/fullscreen.css +6 -0
- data/vendor/assets/components/codemirror/addon/display/fullscreen.js +41 -0
- data/vendor/assets/components/codemirror/addon/display/panel.js +123 -0
- data/vendor/assets/components/codemirror/addon/display/placeholder.js +63 -0
- data/vendor/assets/components/codemirror/addon/display/rulers.js +51 -0
- data/vendor/assets/components/codemirror/addon/edit/closebrackets.js +194 -0
- data/vendor/assets/components/codemirror/addon/edit/closetag.js +175 -0
- data/vendor/assets/components/codemirror/addon/edit/continuelist.js +89 -0
- data/vendor/assets/components/codemirror/addon/edit/matchbrackets.js +145 -0
- data/vendor/assets/components/codemirror/addon/edit/matchtags.js +66 -0
- data/vendor/assets/components/codemirror/addon/edit/trailingspace.js +27 -0
- data/vendor/assets/components/codemirror/addon/fold/brace-fold.js +105 -0
- data/vendor/assets/components/codemirror/addon/fold/comment-fold.js +59 -0
- data/vendor/assets/components/codemirror/addon/fold/foldcode.js +152 -0
- data/vendor/assets/components/codemirror/addon/fold/foldgutter.css +20 -0
- data/vendor/assets/components/codemirror/addon/fold/foldgutter.js +146 -0
- data/vendor/assets/components/codemirror/addon/fold/indent-fold.js +48 -0
- data/vendor/assets/components/codemirror/addon/fold/markdown-fold.js +49 -0
- data/vendor/assets/components/codemirror/addon/fold/xml-fold.js +182 -0
- data/vendor/assets/components/codemirror/addon/hint/anyword-hint.js +41 -0
- data/vendor/assets/components/codemirror/addon/hint/css-hint.js +60 -0
- data/vendor/assets/components/codemirror/addon/hint/html-hint.js +348 -0
- data/vendor/assets/components/codemirror/addon/hint/javascript-hint.js +155 -0
- data/vendor/assets/components/codemirror/addon/hint/show-hint.css +36 -0
- data/vendor/assets/components/codemirror/addon/hint/show-hint.js +432 -0
- data/vendor/assets/components/codemirror/addon/hint/sql-hint.js +286 -0
- data/vendor/assets/components/codemirror/addon/hint/xml-hint.js +110 -0
- data/vendor/assets/components/codemirror/addon/lint/coffeescript-lint.js +47 -0
- data/vendor/assets/components/codemirror/addon/lint/css-lint.js +40 -0
- data/vendor/assets/components/codemirror/addon/lint/html-lint.js +53 -0
- data/vendor/assets/components/codemirror/addon/lint/javascript-lint.js +63 -0
- data/vendor/assets/components/codemirror/addon/lint/json-lint.js +37 -0
- data/vendor/assets/components/codemirror/addon/lint/lint.css +73 -0
- data/vendor/assets/components/codemirror/addon/lint/lint.js +252 -0
- data/vendor/assets/components/codemirror/addon/lint/yaml-lint.js +41 -0
- data/vendor/assets/components/codemirror/addon/merge/merge.css +113 -0
- data/vendor/assets/components/codemirror/addon/merge/merge.js +1001 -0
- data/vendor/assets/components/codemirror/addon/mode/loadmode.js +64 -0
- data/vendor/assets/components/codemirror/addon/mode/multiplex.js +123 -0
- data/vendor/assets/components/codemirror/addon/mode/multiplex_test.js +33 -0
- data/vendor/assets/components/codemirror/addon/mode/overlay.js +90 -0
- data/vendor/assets/components/codemirror/addon/mode/simple.js +216 -0
- data/vendor/assets/components/codemirror/addon/runmode/colorize.js +40 -0
- data/vendor/assets/components/codemirror/addon/runmode/runmode-standalone.js +158 -0
- data/vendor/assets/components/codemirror/addon/runmode/runmode.js +72 -0
- data/vendor/assets/components/codemirror/addon/runmode/runmode.node.js +197 -0
- data/vendor/assets/components/codemirror/addon/scroll/annotatescrollbar.js +122 -0
- data/vendor/assets/components/codemirror/addon/scroll/scrollpastend.js +48 -0
- data/vendor/assets/components/codemirror/addon/scroll/simplescrollbars.css +66 -0
- data/vendor/assets/components/codemirror/addon/scroll/simplescrollbars.js +152 -0
- data/vendor/assets/components/codemirror/addon/search/jump-to-line.js +49 -0
- data/vendor/assets/components/codemirror/addon/search/match-highlighter.js +165 -0
- data/vendor/assets/components/codemirror/addon/search/matchesonscrollbar.css +8 -0
- data/vendor/assets/components/codemirror/addon/search/matchesonscrollbar.js +97 -0
- data/vendor/assets/components/codemirror/addon/search/search.js +252 -0
- data/vendor/assets/components/codemirror/addon/search/searchcursor.js +289 -0
- data/vendor/assets/components/codemirror/addon/selection/active-line.js +72 -0
- data/vendor/assets/components/codemirror/addon/selection/mark-selection.js +119 -0
- data/vendor/assets/components/codemirror/addon/selection/selection-pointer.js +98 -0
- data/vendor/assets/components/codemirror/addon/tern/tern.css +87 -0
- data/vendor/assets/components/codemirror/addon/tern/tern.js +718 -0
- data/vendor/assets/components/codemirror/addon/tern/worker.js +44 -0
- data/vendor/assets/components/codemirror/addon/wrap/hardwrap.js +144 -0
- data/vendor/assets/components/codemirror/bower.json +17 -0
- data/vendor/assets/components/codemirror/component-tools/bower.json +17 -0
- data/vendor/assets/components/codemirror/component-tools/build.sh +31 -0
- data/vendor/assets/components/codemirror/component-tools/update.py +38 -0
- data/vendor/assets/components/codemirror/keymap/emacs.js +416 -0
- data/vendor/assets/components/codemirror/keymap/sublime.js +685 -0
- data/vendor/assets/components/codemirror/keymap/vim.js +5219 -0
- data/vendor/assets/components/codemirror/lib/codemirror.css +346 -0
- data/vendor/assets/components/codemirror/lib/codemirror.js +9669 -0
- data/vendor/assets/components/codemirror/mode/apl/apl.js +174 -0
- data/vendor/assets/components/codemirror/mode/asciiarmor/asciiarmor.js +74 -0
- data/vendor/assets/components/codemirror/mode/asn.1/asn.1.js +204 -0
- data/vendor/assets/components/codemirror/mode/asterisk/asterisk.js +196 -0
- data/vendor/assets/components/codemirror/mode/brainfuck/brainfuck.js +85 -0
- data/vendor/assets/components/codemirror/mode/clike/clike.js +817 -0
- data/vendor/assets/components/codemirror/mode/clojure/clojure.js +306 -0
- data/vendor/assets/components/codemirror/mode/cmake/cmake.js +97 -0
- data/vendor/assets/components/codemirror/mode/cobol/cobol.js +255 -0
- data/vendor/assets/components/codemirror/mode/coffeescript/coffeescript.js +359 -0
- data/vendor/assets/components/codemirror/mode/commonlisp/commonlisp.js +124 -0
- data/vendor/assets/components/codemirror/mode/crystal/crystal.js +433 -0
- data/vendor/assets/components/codemirror/mode/css/css.js +832 -0
- data/vendor/assets/components/codemirror/mode/cypher/cypher.js +150 -0
- data/vendor/assets/components/codemirror/mode/d/d.js +218 -0
- data/vendor/assets/components/codemirror/mode/dart/dart.js +157 -0
- data/vendor/assets/components/codemirror/mode/diff/diff.js +47 -0
- data/vendor/assets/components/codemirror/mode/django/django.js +356 -0
- data/vendor/assets/components/codemirror/mode/dockerfile/dockerfile.js +79 -0
- data/vendor/assets/components/codemirror/mode/dtd/dtd.js +142 -0
- data/vendor/assets/components/codemirror/mode/dylan/dylan.js +352 -0
- data/vendor/assets/components/codemirror/mode/ebnf/ebnf.js +195 -0
- data/vendor/assets/components/codemirror/mode/ecl/ecl.js +206 -0
- data/vendor/assets/components/codemirror/mode/eiffel/eiffel.js +160 -0
- data/vendor/assets/components/codemirror/mode/elm/elm.js +205 -0
- data/vendor/assets/components/codemirror/mode/erlang/erlang.js +619 -0
- data/vendor/assets/components/codemirror/mode/factor/factor.js +85 -0
- data/vendor/assets/components/codemirror/mode/fcl/fcl.js +173 -0
- data/vendor/assets/components/codemirror/mode/forth/forth.js +180 -0
- data/vendor/assets/components/codemirror/mode/fortran/fortran.js +188 -0
- data/vendor/assets/components/codemirror/mode/gas/gas.js +345 -0
- data/vendor/assets/components/codemirror/mode/gfm/gfm.js +129 -0
- data/vendor/assets/components/codemirror/mode/gherkin/gherkin.js +178 -0
- data/vendor/assets/components/codemirror/mode/go/go.js +187 -0
- data/vendor/assets/components/codemirror/mode/groovy/groovy.js +230 -0
- data/vendor/assets/components/codemirror/mode/haml/haml.js +161 -0
- data/vendor/assets/components/codemirror/mode/handlebars/handlebars.js +62 -0
- data/vendor/assets/components/codemirror/mode/haskell-literate/haskell-literate.js +43 -0
- data/vendor/assets/components/codemirror/mode/haskell/haskell.js +267 -0
- data/vendor/assets/components/codemirror/mode/haxe/haxe.js +515 -0
- data/vendor/assets/components/codemirror/mode/htmlembedded/htmlembedded.js +37 -0
- data/vendor/assets/components/codemirror/mode/htmlmixed/htmlmixed.js +152 -0
- data/vendor/assets/components/codemirror/mode/http/http.js +113 -0
- data/vendor/assets/components/codemirror/mode/idl/idl.js +290 -0
- data/vendor/assets/components/codemirror/mode/javascript/javascript.js +865 -0
- data/vendor/assets/components/codemirror/mode/jinja2/jinja2.js +142 -0
- data/vendor/assets/components/codemirror/mode/jsx/jsx.js +148 -0
- data/vendor/assets/components/codemirror/mode/julia/julia.js +418 -0
- data/vendor/assets/components/codemirror/mode/livescript/livescript.js +280 -0
- data/vendor/assets/components/codemirror/mode/lua/lua.js +159 -0
- data/vendor/assets/components/codemirror/mode/markdown/markdown.js +872 -0
- data/vendor/assets/components/codemirror/mode/mathematica/mathematica.js +176 -0
- data/vendor/assets/components/codemirror/mode/mbox/mbox.js +129 -0
- data/vendor/assets/components/codemirror/mode/meta.js +217 -0
- data/vendor/assets/components/codemirror/mode/mirc/mirc.js +193 -0
- data/vendor/assets/components/codemirror/mode/mllike/mllike.js +356 -0
- data/vendor/assets/components/codemirror/mode/modelica/modelica.js +245 -0
- data/vendor/assets/components/codemirror/mode/mscgen/mscgen.js +175 -0
- data/vendor/assets/components/codemirror/mode/mumps/mumps.js +148 -0
- data/vendor/assets/components/codemirror/mode/nginx/nginx.js +178 -0
- data/vendor/assets/components/codemirror/mode/nsis/nsis.js +95 -0
- data/vendor/assets/components/codemirror/mode/ntriples/ntriples.js +195 -0
- data/vendor/assets/components/codemirror/mode/octave/octave.js +139 -0
- data/vendor/assets/components/codemirror/mode/oz/oz.js +252 -0
- data/vendor/assets/components/codemirror/mode/pascal/pascal.js +109 -0
- data/vendor/assets/components/codemirror/mode/pegjs/pegjs.js +114 -0
- data/vendor/assets/components/codemirror/mode/perl/perl.js +837 -0
- data/vendor/assets/components/codemirror/mode/php/php.js +234 -0
- data/vendor/assets/components/codemirror/mode/pig/pig.js +178 -0
- data/vendor/assets/components/codemirror/mode/powershell/powershell.js +398 -0
- data/vendor/assets/components/codemirror/mode/properties/properties.js +78 -0
- data/vendor/assets/components/codemirror/mode/protobuf/protobuf.js +69 -0
- data/vendor/assets/components/codemirror/mode/pug/pug.js +591 -0
- data/vendor/assets/components/codemirror/mode/puppet/puppet.js +220 -0
- data/vendor/assets/components/codemirror/mode/python/python.js +334 -0
- data/vendor/assets/components/codemirror/mode/q/q.js +139 -0
- data/vendor/assets/components/codemirror/mode/r/r.js +183 -0
- data/vendor/assets/components/codemirror/mode/rpm/rpm.js +109 -0
- data/vendor/assets/components/codemirror/mode/rst/rst.js +557 -0
- data/vendor/assets/components/codemirror/mode/ruby/ruby.js +296 -0
- data/vendor/assets/components/codemirror/mode/rust/rust.js +72 -0
- data/vendor/assets/components/codemirror/mode/sas/sas.js +303 -0
- data/vendor/assets/components/codemirror/mode/sass/sass.js +454 -0
- data/vendor/assets/components/codemirror/mode/scheme/scheme.js +249 -0
- data/vendor/assets/components/codemirror/mode/shell/shell.js +151 -0
- data/vendor/assets/components/codemirror/mode/sieve/sieve.js +193 -0
- data/vendor/assets/components/codemirror/mode/slim/slim.js +575 -0
- data/vendor/assets/components/codemirror/mode/smalltalk/smalltalk.js +168 -0
- data/vendor/assets/components/codemirror/mode/smarty/smarty.js +225 -0
- data/vendor/assets/components/codemirror/mode/solr/solr.js +104 -0
- data/vendor/assets/components/codemirror/mode/soy/soy.js +354 -0
- data/vendor/assets/components/codemirror/mode/sparql/sparql.js +180 -0
- data/vendor/assets/components/codemirror/mode/spreadsheet/spreadsheet.js +112 -0
- data/vendor/assets/components/codemirror/mode/sql/sql.js +488 -0
- data/vendor/assets/components/codemirror/mode/stex/stex.js +251 -0
- data/vendor/assets/components/codemirror/mode/stylus/stylus.js +771 -0
- data/vendor/assets/components/codemirror/mode/swift/swift.js +219 -0
- data/vendor/assets/components/codemirror/mode/tcl/tcl.js +139 -0
- data/vendor/assets/components/codemirror/mode/textile/textile.js +469 -0
- data/vendor/assets/components/codemirror/mode/tiddlywiki/tiddlywiki.css +14 -0
- data/vendor/assets/components/codemirror/mode/tiddlywiki/tiddlywiki.js +308 -0
- data/vendor/assets/components/codemirror/mode/tiki/tiki.css +26 -0
- data/vendor/assets/components/codemirror/mode/tiki/tiki.js +312 -0
- data/vendor/assets/components/codemirror/mode/toml/toml.js +88 -0
- data/vendor/assets/components/codemirror/mode/tornado/tornado.js +68 -0
- data/vendor/assets/components/codemirror/mode/troff/troff.js +84 -0
- data/vendor/assets/components/codemirror/mode/ttcn-cfg/ttcn-cfg.js +214 -0
- data/vendor/assets/components/codemirror/mode/ttcn/ttcn.js +283 -0
- data/vendor/assets/components/codemirror/mode/turtle/turtle.js +162 -0
- data/vendor/assets/components/codemirror/mode/twig/twig.js +141 -0
- data/vendor/assets/components/codemirror/mode/vb/vb.js +275 -0
- data/vendor/assets/components/codemirror/mode/vbscript/vbscript.js +350 -0
- data/vendor/assets/components/codemirror/mode/velocity/velocity.js +201 -0
- data/vendor/assets/components/codemirror/mode/verilog/verilog.js +675 -0
- data/vendor/assets/components/codemirror/mode/vhdl/vhdl.js +189 -0
- data/vendor/assets/components/codemirror/mode/vue/vue.js +77 -0
- data/vendor/assets/components/codemirror/mode/webidl/webidl.js +195 -0
- data/vendor/assets/components/codemirror/mode/xml/xml.js +401 -0
- data/vendor/assets/components/codemirror/mode/xquery/xquery.js +448 -0
- data/vendor/assets/components/codemirror/mode/yacas/yacas.js +204 -0
- data/vendor/assets/components/codemirror/mode/yaml-frontmatter/yaml-frontmatter.js +68 -0
- data/vendor/assets/components/codemirror/mode/yaml/yaml.js +118 -0
- data/vendor/assets/components/codemirror/mode/z80/z80.js +116 -0
- data/vendor/assets/components/codemirror/rollup.config.js +18 -0
- data/vendor/assets/components/codemirror/src/codemirror.js +3 -0
- data/vendor/assets/components/codemirror/src/display/Display.js +106 -0
- data/vendor/assets/components/codemirror/src/display/focus.js +47 -0
- data/vendor/assets/components/codemirror/src/display/gutters.js +34 -0
- data/vendor/assets/components/codemirror/src/display/highlight_worker.js +55 -0
- data/vendor/assets/components/codemirror/src/display/line_numbers.js +48 -0
- data/vendor/assets/components/codemirror/src/display/mode_state.js +22 -0
- data/vendor/assets/components/codemirror/src/display/operations.js +205 -0
- data/vendor/assets/components/codemirror/src/display/scroll_events.js +115 -0
- data/vendor/assets/components/codemirror/src/display/scrollbars.js +192 -0
- data/vendor/assets/components/codemirror/src/display/scrolling.js +184 -0
- data/vendor/assets/components/codemirror/src/display/selection.js +158 -0
- data/vendor/assets/components/codemirror/src/display/update_display.js +260 -0
- data/vendor/assets/components/codemirror/src/display/update_line.js +188 -0
- data/vendor/assets/components/codemirror/src/display/update_lines.js +64 -0
- data/vendor/assets/components/codemirror/src/display/view_tracking.js +153 -0
- data/vendor/assets/components/codemirror/src/edit/CodeMirror.js +214 -0
- data/vendor/assets/components/codemirror/src/edit/commands.js +178 -0
- data/vendor/assets/components/codemirror/src/edit/deleteNearSelection.js +30 -0
- data/vendor/assets/components/codemirror/src/edit/drop_events.js +119 -0
- data/vendor/assets/components/codemirror/src/edit/fromTextArea.js +61 -0
- data/vendor/assets/components/codemirror/src/edit/global_events.js +44 -0
- data/vendor/assets/components/codemirror/src/edit/key_events.js +159 -0
- data/vendor/assets/components/codemirror/src/edit/legacy.js +62 -0
- data/vendor/assets/components/codemirror/src/edit/main.js +69 -0
- data/vendor/assets/components/codemirror/src/edit/methods.js +539 -0
- data/vendor/assets/components/codemirror/src/edit/mouse_events.js +407 -0
- data/vendor/assets/components/codemirror/src/edit/options.js +191 -0
- data/vendor/assets/components/codemirror/src/edit/utils.js +7 -0
- data/vendor/assets/components/codemirror/src/input/ContentEditableInput.js +517 -0
- data/vendor/assets/components/codemirror/src/input/TextareaInput.js +350 -0
- data/vendor/assets/components/codemirror/src/input/indent.js +71 -0
- data/vendor/assets/components/codemirror/src/input/input.js +135 -0
- data/vendor/assets/components/codemirror/src/input/keymap.js +148 -0
- data/vendor/assets/components/codemirror/src/input/keynames.js +17 -0
- data/vendor/assets/components/codemirror/src/input/movement.js +110 -0
- data/vendor/assets/components/codemirror/src/line/highlight.js +284 -0
- data/vendor/assets/components/codemirror/src/line/line_data.js +337 -0
- data/vendor/assets/components/codemirror/src/line/pos.js +40 -0
- data/vendor/assets/components/codemirror/src/line/saw_special_spans.js +10 -0
- data/vendor/assets/components/codemirror/src/line/spans.js +372 -0
- data/vendor/assets/components/codemirror/src/line/utils_line.js +85 -0
- data/vendor/assets/components/codemirror/src/measurement/position_measurement.js +700 -0
- data/vendor/assets/components/codemirror/src/measurement/widgets.js +26 -0
- data/vendor/assets/components/codemirror/src/model/Doc.js +432 -0
- data/vendor/assets/components/codemirror/src/model/change_measurement.js +61 -0
- data/vendor/assets/components/codemirror/src/model/changes.js +330 -0
- data/vendor/assets/components/codemirror/src/model/chunk.js +167 -0
- data/vendor/assets/components/codemirror/src/model/document_data.js +111 -0
- data/vendor/assets/components/codemirror/src/model/history.js +228 -0
- data/vendor/assets/components/codemirror/src/model/line_widget.js +78 -0
- data/vendor/assets/components/codemirror/src/model/mark_text.js +292 -0
- data/vendor/assets/components/codemirror/src/model/selection.js +82 -0
- data/vendor/assets/components/codemirror/src/model/selection_updates.js +208 -0
- data/vendor/assets/components/codemirror/src/modes.js +96 -0
- data/vendor/assets/components/codemirror/src/util/StringStream.js +90 -0
- data/vendor/assets/components/codemirror/src/util/bidi.js +214 -0
- data/vendor/assets/components/codemirror/src/util/browser.js +33 -0
- data/vendor/assets/components/codemirror/src/util/dom.js +97 -0
- data/vendor/assets/components/codemirror/src/util/event.js +103 -0
- data/vendor/assets/components/codemirror/src/util/feature_detection.js +84 -0
- data/vendor/assets/components/codemirror/src/util/misc.js +150 -0
- data/vendor/assets/components/codemirror/src/util/operation_group.js +72 -0
- data/vendor/assets/components/codemirror/theme/3024-day.css +41 -0
- data/vendor/assets/components/codemirror/theme/3024-night.css +39 -0
- data/vendor/assets/components/codemirror/theme/abcdef.css +32 -0
- data/vendor/assets/components/codemirror/theme/ambiance-mobile.css +5 -0
- data/vendor/assets/components/codemirror/theme/ambiance.css +74 -0
- data/vendor/assets/components/codemirror/theme/base16-dark.css +38 -0
- data/vendor/assets/components/codemirror/theme/base16-light.css +38 -0
- data/vendor/assets/components/codemirror/theme/bespin.css +34 -0
- data/vendor/assets/components/codemirror/theme/blackboard.css +32 -0
- data/vendor/assets/components/codemirror/theme/cobalt.css +25 -0
- data/vendor/assets/components/codemirror/theme/colorforth.css +33 -0
- data/vendor/assets/components/codemirror/theme/dracula.css +40 -0
- data/vendor/assets/components/codemirror/theme/duotone-dark.css +35 -0
- data/vendor/assets/components/codemirror/theme/duotone-light.css +36 -0
- data/vendor/assets/components/codemirror/theme/eclipse.css +23 -0
- data/vendor/assets/components/codemirror/theme/elegant.css +13 -0
- data/vendor/assets/components/codemirror/theme/erlang-dark.css +34 -0
- data/vendor/assets/components/codemirror/theme/hopscotch.css +34 -0
- data/vendor/assets/components/codemirror/theme/icecoder.css +43 -0
- data/vendor/assets/components/codemirror/theme/isotope.css +34 -0
- data/vendor/assets/components/codemirror/theme/lesser-dark.css +47 -0
- data/vendor/assets/components/codemirror/theme/liquibyte.css +95 -0
- data/vendor/assets/components/codemirror/theme/material.css +53 -0
- data/vendor/assets/components/codemirror/theme/mbo.css +37 -0
- data/vendor/assets/components/codemirror/theme/mdn-like.css +46 -0
- data/vendor/assets/components/codemirror/theme/midnight.css +43 -0
- data/vendor/assets/components/codemirror/theme/monokai.css +36 -0
- data/vendor/assets/components/codemirror/theme/neat.css +12 -0
- data/vendor/assets/components/codemirror/theme/neo.css +43 -0
- data/vendor/assets/components/codemirror/theme/night.css +27 -0
- data/vendor/assets/components/codemirror/theme/oceanic-next.css +44 -0
- data/vendor/assets/components/codemirror/theme/panda-syntax.css +85 -0
- data/vendor/assets/components/codemirror/theme/paraiso-dark.css +38 -0
- data/vendor/assets/components/codemirror/theme/paraiso-light.css +38 -0
- data/vendor/assets/components/codemirror/theme/pastel-on-dark.css +52 -0
- data/vendor/assets/components/codemirror/theme/railscasts.css +34 -0
- data/vendor/assets/components/codemirror/theme/rubyblue.css +25 -0
- data/vendor/assets/components/codemirror/theme/seti.css +44 -0
- data/vendor/assets/components/codemirror/theme/shadowfox.css +52 -0
- data/vendor/assets/components/codemirror/theme/solarized.css +168 -0
- data/vendor/assets/components/codemirror/theme/the-matrix.css +30 -0
- data/vendor/assets/components/codemirror/theme/tomorrow-night-bright.css +35 -0
- data/vendor/assets/components/codemirror/theme/tomorrow-night-eighties.css +38 -0
- data/vendor/assets/components/codemirror/theme/ttcn.css +64 -0
- data/vendor/assets/components/codemirror/theme/twilight.css +32 -0
- data/vendor/assets/components/codemirror/theme/vibrant-ink.css +34 -0
- data/vendor/assets/components/codemirror/theme/xq-dark.css +53 -0
- data/vendor/assets/components/codemirror/theme/xq-light.css +43 -0
- data/vendor/assets/components/codemirror/theme/yeti.css +44 -0
- data/vendor/assets/components/codemirror/theme/zenburn.css +37 -0
- data/vendor/assets/components/eve/.bower.json +12 -0
- data/vendor/assets/components/eve/LICENSE +202 -0
- data/vendor/assets/components/eve/README.md +7 -0
- data/vendor/assets/components/eve/component.json +13 -0
- data/vendor/assets/components/eve/e.html +66 -0
- data/vendor/assets/components/eve/eve.js +371 -0
- data/vendor/assets/components/eve/package.json +18 -0
- data/vendor/assets/components/highlightjs/.bower.json +24 -0
- data/vendor/assets/components/highlightjs/LICENSE +24 -0
- data/vendor/assets/components/highlightjs/Makefile +21 -0
- data/vendor/assets/components/highlightjs/README.md +12 -0
- data/vendor/assets/components/highlightjs/bower.json +14 -0
- data/vendor/assets/components/highlightjs/component.json +12 -0
- data/vendor/assets/components/highlightjs/composer.json +26 -0
- data/vendor/assets/components/highlightjs/highlight.pack.js +16645 -0
- data/vendor/assets/components/highlightjs/highlight.pack.min.js +15 -0
- data/vendor/assets/components/highlightjs/package.json +8 -0
- data/vendor/assets/components/highlightjs/styles/agate.css +108 -0
- data/vendor/assets/components/highlightjs/styles/androidstudio.css +66 -0
- data/vendor/assets/components/highlightjs/styles/arduino-light.css +88 -0
- data/vendor/assets/components/highlightjs/styles/arta.css +73 -0
- data/vendor/assets/components/highlightjs/styles/ascetic.css +45 -0
- data/vendor/assets/components/highlightjs/styles/atelier-cave-dark.css +83 -0
- data/vendor/assets/components/highlightjs/styles/atelier-cave-light.css +85 -0
- data/vendor/assets/components/highlightjs/styles/atelier-cave.dark.css +113 -0
- data/vendor/assets/components/highlightjs/styles/atelier-cave.light.css +113 -0
- data/vendor/assets/components/highlightjs/styles/atelier-dune-dark.css +69 -0
- data/vendor/assets/components/highlightjs/styles/atelier-dune-light.css +69 -0
- data/vendor/assets/components/highlightjs/styles/atelier-dune.dark.css +94 -0
- data/vendor/assets/components/highlightjs/styles/atelier-dune.light.css +94 -0
- data/vendor/assets/components/highlightjs/styles/atelier-estuary-dark.css +84 -0
- data/vendor/assets/components/highlightjs/styles/atelier-estuary-light.css +84 -0
- data/vendor/assets/components/highlightjs/styles/atelier-estuary.dark.css +113 -0
- data/vendor/assets/components/highlightjs/styles/atelier-estuary.light.css +113 -0
- data/vendor/assets/components/highlightjs/styles/atelier-forest-dark.css +69 -0
- data/vendor/assets/components/highlightjs/styles/atelier-forest-light.css +69 -0
- data/vendor/assets/components/highlightjs/styles/atelier-forest.dark.css +94 -0
- data/vendor/assets/components/highlightjs/styles/atelier-forest.light.css +94 -0
- data/vendor/assets/components/highlightjs/styles/atelier-heath-dark.css +69 -0
- data/vendor/assets/components/highlightjs/styles/atelier-heath-light.css +69 -0
- data/vendor/assets/components/highlightjs/styles/atelier-heath.dark.css +94 -0
- data/vendor/assets/components/highlightjs/styles/atelier-heath.light.css +94 -0
- data/vendor/assets/components/highlightjs/styles/atelier-lakeside-dark.css +69 -0
- data/vendor/assets/components/highlightjs/styles/atelier-lakeside-light.css +69 -0
- data/vendor/assets/components/highlightjs/styles/atelier-lakeside.dark.css +94 -0
- data/vendor/assets/components/highlightjs/styles/atelier-lakeside.light.css +94 -0
- data/vendor/assets/components/highlightjs/styles/atelier-plateau-dark.css +84 -0
- data/vendor/assets/components/highlightjs/styles/atelier-plateau-light.css +84 -0
- data/vendor/assets/components/highlightjs/styles/atelier-plateau.dark.css +113 -0
- data/vendor/assets/components/highlightjs/styles/atelier-plateau.light.css +113 -0
- data/vendor/assets/components/highlightjs/styles/atelier-savanna-dark.css +84 -0
- data/vendor/assets/components/highlightjs/styles/atelier-savanna-light.css +84 -0
- data/vendor/assets/components/highlightjs/styles/atelier-savanna.dark.css +113 -0
- data/vendor/assets/components/highlightjs/styles/atelier-savanna.light.css +113 -0
- data/vendor/assets/components/highlightjs/styles/atelier-seaside-dark.css +69 -0
- data/vendor/assets/components/highlightjs/styles/atelier-seaside-light.css +69 -0
- data/vendor/assets/components/highlightjs/styles/atelier-seaside.dark.css +94 -0
- data/vendor/assets/components/highlightjs/styles/atelier-seaside.light.css +94 -0
- data/vendor/assets/components/highlightjs/styles/atelier-sulphurpool-dark.css +69 -0
- data/vendor/assets/components/highlightjs/styles/atelier-sulphurpool-light.css +69 -0
- data/vendor/assets/components/highlightjs/styles/atelier-sulphurpool.dark.css +94 -0
- data/vendor/assets/components/highlightjs/styles/atelier-sulphurpool.light.css +94 -0
- data/vendor/assets/components/highlightjs/styles/atom-one-dark.css +96 -0
- data/vendor/assets/components/highlightjs/styles/atom-one-light.css +96 -0
- data/vendor/assets/components/highlightjs/styles/brown-paper.css +64 -0
- data/vendor/assets/components/highlightjs/styles/brown-papersq.png +0 -0
- data/vendor/assets/components/highlightjs/styles/brown_paper.css +103 -0
- data/vendor/assets/components/highlightjs/styles/brown_papersq.png +0 -0
- data/vendor/assets/components/highlightjs/styles/codepen-embed.css +60 -0
- data/vendor/assets/components/highlightjs/styles/color-brewer.css +71 -0
- data/vendor/assets/components/highlightjs/styles/darcula.css +77 -0
- data/vendor/assets/components/highlightjs/styles/dark.css +63 -0
- data/vendor/assets/components/highlightjs/styles/darkula.css +6 -0
- data/vendor/assets/components/highlightjs/styles/default.css +99 -0
- data/vendor/assets/components/highlightjs/styles/docco.css +97 -0
- data/vendor/assets/components/highlightjs/styles/dracula.css +76 -0
- data/vendor/assets/components/highlightjs/styles/far.css +71 -0
- data/vendor/assets/components/highlightjs/styles/foundation.css +88 -0
- data/vendor/assets/components/highlightjs/styles/github-gist.css +71 -0
- data/vendor/assets/components/highlightjs/styles/github.css +99 -0
- data/vendor/assets/components/highlightjs/styles/googlecode.css +89 -0
- data/vendor/assets/components/highlightjs/styles/grayscale.css +101 -0
- data/vendor/assets/components/highlightjs/styles/gruvbox-dark.css +108 -0
- data/vendor/assets/components/highlightjs/styles/gruvbox-light.css +108 -0
- data/vendor/assets/components/highlightjs/styles/hopscotch.css +83 -0
- data/vendor/assets/components/highlightjs/styles/hybrid.css +102 -0
- data/vendor/assets/components/highlightjs/styles/idea.css +97 -0
- data/vendor/assets/components/highlightjs/styles/ir-black.css +73 -0
- data/vendor/assets/components/highlightjs/styles/ir_black.css +106 -0
- data/vendor/assets/components/highlightjs/styles/kimbie.dark.css +74 -0
- data/vendor/assets/components/highlightjs/styles/kimbie.light.css +74 -0
- data/vendor/assets/components/highlightjs/styles/magula.css +70 -0
- data/vendor/assets/components/highlightjs/styles/mono-blue.css +59 -0
- data/vendor/assets/components/highlightjs/styles/monokai-sublime.css +83 -0
- data/vendor/assets/components/highlightjs/styles/monokai.css +70 -0
- data/vendor/assets/components/highlightjs/styles/monokai_sublime.css +154 -0
- data/vendor/assets/components/highlightjs/styles/obsidian.css +88 -0
- data/vendor/assets/components/highlightjs/styles/ocean.css +74 -0
- data/vendor/assets/components/highlightjs/styles/paraiso-dark.css +72 -0
- data/vendor/assets/components/highlightjs/styles/paraiso-light.css +72 -0
- data/vendor/assets/components/highlightjs/styles/paraiso.dark.css +96 -0
- data/vendor/assets/components/highlightjs/styles/paraiso.light.css +96 -0
- data/vendor/assets/components/highlightjs/styles/pojoaque.css +83 -0
- data/vendor/assets/components/highlightjs/styles/pojoaque.jpg +0 -0
- data/vendor/assets/components/highlightjs/styles/purebasic.css +96 -0
- data/vendor/assets/components/highlightjs/styles/qtcreator_dark.css +83 -0
- data/vendor/assets/components/highlightjs/styles/qtcreator_light.css +83 -0
- data/vendor/assets/components/highlightjs/styles/railscasts.css +106 -0
- data/vendor/assets/components/highlightjs/styles/rainbow.css +85 -0
- data/vendor/assets/components/highlightjs/styles/routeros.css +108 -0
- data/vendor/assets/components/highlightjs/styles/school-book.css +72 -0
- data/vendor/assets/components/highlightjs/styles/school-book.png +0 -0
- data/vendor/assets/components/highlightjs/styles/school_book.css +111 -0
- data/vendor/assets/components/highlightjs/styles/school_book.png +0 -0
- data/vendor/assets/components/highlightjs/styles/solarized-dark.css +84 -0
- data/vendor/assets/components/highlightjs/styles/solarized-light.css +84 -0
- data/vendor/assets/components/highlightjs/styles/solarized_dark.css +107 -0
- data/vendor/assets/components/highlightjs/styles/solarized_light.css +107 -0
- data/vendor/assets/components/highlightjs/styles/sunburst.css +102 -0
- data/vendor/assets/components/highlightjs/styles/tomorrow-night-blue.css +75 -0
- data/vendor/assets/components/highlightjs/styles/tomorrow-night-bright.css +74 -0
- data/vendor/assets/components/highlightjs/styles/tomorrow-night-eighties.css +74 -0
- data/vendor/assets/components/highlightjs/styles/tomorrow-night.css +75 -0
- data/vendor/assets/components/highlightjs/styles/tomorrow.css +72 -0
- data/vendor/assets/components/highlightjs/styles/vs.css +68 -0
- data/vendor/assets/components/highlightjs/styles/vs2015.css +115 -0
- data/vendor/assets/components/highlightjs/styles/xcode.css +93 -0
- data/vendor/assets/components/highlightjs/styles/xt256.css +92 -0
- data/vendor/assets/components/highlightjs/styles/zenburn.css +80 -0
- data/vendor/assets/components/jquery/.bower.json +25 -0
- data/vendor/assets/components/jquery/AUTHORS.txt +313 -0
- data/vendor/assets/components/jquery/LICENSE.txt +36 -0
- data/vendor/assets/components/jquery/README.md +67 -0
- data/vendor/assets/components/jquery/bower.json +14 -0
- data/vendor/assets/components/jquery/dist/core.js +399 -0
- data/vendor/assets/components/jquery/dist/jquery.js +10364 -0
- data/vendor/assets/components/jquery/dist/jquery.min.js +2 -0
- data/vendor/assets/components/jquery/dist/jquery.min.map +1 -0
- data/vendor/assets/components/jquery/dist/jquery.slim.js +8269 -0
- data/vendor/assets/components/jquery/dist/jquery.slim.min.js +2 -0
- data/vendor/assets/components/jquery/dist/jquery.slim.min.map +1 -0
- data/vendor/assets/components/jquery/external/sizzle/LICENSE.txt +36 -0
- data/vendor/assets/components/jquery/external/sizzle/dist/sizzle.js +2272 -0
- data/vendor/assets/components/jquery/external/sizzle/dist/sizzle.min.js +3 -0
- data/vendor/assets/components/jquery/external/sizzle/dist/sizzle.min.map +1 -0
- data/vendor/assets/components/jquery/src/.eslintrc.json +5 -0
- data/vendor/assets/components/jquery/src/ajax.js +856 -0
- data/vendor/assets/components/jquery/src/ajax/jsonp.js +103 -0
- data/vendor/assets/components/jquery/src/ajax/load.js +77 -0
- data/vendor/assets/components/jquery/src/ajax/parseXML.js +30 -0
- data/vendor/assets/components/jquery/src/ajax/script.js +77 -0
- data/vendor/assets/components/jquery/src/ajax/var/location.js +5 -0
- data/vendor/assets/components/jquery/src/ajax/var/nonce.js +5 -0
- data/vendor/assets/components/jquery/src/ajax/var/rquery.js +5 -0
- data/vendor/assets/components/jquery/src/ajax/xhr.js +170 -0
- data/vendor/assets/components/jquery/src/attributes.js +13 -0
- data/vendor/assets/components/jquery/src/attributes/attr.js +141 -0
- data/vendor/assets/components/jquery/src/attributes/classes.js +186 -0
- data/vendor/assets/components/jquery/src/attributes/prop.js +143 -0
- data/vendor/assets/components/jquery/src/attributes/support.js +33 -0
- data/vendor/assets/components/jquery/src/attributes/val.js +191 -0
- data/vendor/assets/components/jquery/src/callbacks.js +236 -0
- data/vendor/assets/components/jquery/src/core.js +399 -0
- data/vendor/assets/components/jquery/src/core/DOMEval.js +30 -0
- data/vendor/assets/components/jquery/src/core/access.js +72 -0
- data/vendor/assets/components/jquery/src/core/camelCase.js +23 -0
- data/vendor/assets/components/jquery/src/core/init.js +129 -0
- data/vendor/assets/components/jquery/src/core/nodeName.js +13 -0
- data/vendor/assets/components/jquery/src/core/parseHTML.js +65 -0
- data/vendor/assets/components/jquery/src/core/ready-no-deferred.js +97 -0
- data/vendor/assets/components/jquery/src/core/ready.js +86 -0
- data/vendor/assets/components/jquery/src/core/readyException.js +13 -0
- data/vendor/assets/components/jquery/src/core/stripAndCollapse.js +14 -0
- data/vendor/assets/components/jquery/src/core/support.js +20 -0
- data/vendor/assets/components/jquery/src/core/toType.js +20 -0
- data/vendor/assets/components/jquery/src/core/var/rsingleTag.js +6 -0
- data/vendor/assets/components/jquery/src/css.js +481 -0
- data/vendor/assets/components/jquery/src/css/addGetHookIf.js +26 -0
- data/vendor/assets/components/jquery/src/css/adjustCSS.js +73 -0
- data/vendor/assets/components/jquery/src/css/curCSS.js +65 -0
- data/vendor/assets/components/jquery/src/css/hiddenVisibleSelectors.js +15 -0
- data/vendor/assets/components/jquery/src/css/showHide.js +105 -0
- data/vendor/assets/components/jquery/src/css/support.js +102 -0
- data/vendor/assets/components/jquery/src/css/var/cssExpand.js +5 -0
- data/vendor/assets/components/jquery/src/css/var/getStyles.js +17 -0
- data/vendor/assets/components/jquery/src/css/var/isHiddenWithinTree.js +34 -0
- data/vendor/assets/components/jquery/src/css/var/rboxStyle.js +7 -0
- data/vendor/assets/components/jquery/src/css/var/rnumnonpx.js +7 -0
- data/vendor/assets/components/jquery/src/css/var/swap.js +26 -0
- data/vendor/assets/components/jquery/src/data.js +180 -0
- data/vendor/assets/components/jquery/src/data/Data.js +162 -0
- data/vendor/assets/components/jquery/src/data/var/acceptData.js +19 -0
- data/vendor/assets/components/jquery/src/data/var/dataPriv.js +7 -0
- data/vendor/assets/components/jquery/src/data/var/dataUser.js +7 -0
- data/vendor/assets/components/jquery/src/deferred.js +399 -0
- data/vendor/assets/components/jquery/src/deferred/exceptionHook.js +21 -0
- data/vendor/assets/components/jquery/src/deprecated.js +98 -0
- data/vendor/assets/components/jquery/src/dimensions.js +57 -0
- data/vendor/assets/components/jquery/src/effects.js +702 -0
- data/vendor/assets/components/jquery/src/effects/Tween.js +123 -0
- data/vendor/assets/components/jquery/src/effects/animatedSelector.js +15 -0
- data/vendor/assets/components/jquery/src/event.js +748 -0
- data/vendor/assets/components/jquery/src/event/ajax.js +22 -0
- data/vendor/assets/components/jquery/src/event/alias.js +29 -0
- data/vendor/assets/components/jquery/src/event/focusin.js +55 -0
- data/vendor/assets/components/jquery/src/event/support.js +11 -0
- data/vendor/assets/components/jquery/src/event/trigger.js +199 -0
- data/vendor/assets/components/jquery/src/exports/amd.js +26 -0
- data/vendor/assets/components/jquery/src/exports/global.js +34 -0
- data/vendor/assets/components/jquery/src/jquery.js +40 -0
- data/vendor/assets/components/jquery/src/manipulation.js +486 -0
- data/vendor/assets/components/jquery/src/manipulation/_evalUrl.js +23 -0
- data/vendor/assets/components/jquery/src/manipulation/buildFragment.js +105 -0
- data/vendor/assets/components/jquery/src/manipulation/getAll.js +32 -0
- data/vendor/assets/components/jquery/src/manipulation/setGlobalEval.js +22 -0
- data/vendor/assets/components/jquery/src/manipulation/support.js +35 -0
- data/vendor/assets/components/jquery/src/manipulation/var/rcheckableType.js +5 -0
- data/vendor/assets/components/jquery/src/manipulation/var/rscriptType.js +5 -0
- data/vendor/assets/components/jquery/src/manipulation/var/rtagName.js +5 -0
- data/vendor/assets/components/jquery/src/manipulation/wrapMap.js +29 -0
- data/vendor/assets/components/jquery/src/offset.js +233 -0
- data/vendor/assets/components/jquery/src/queue.js +145 -0
- data/vendor/assets/components/jquery/src/queue/delay.js +24 -0
- data/vendor/assets/components/jquery/src/selector-native.js +237 -0
- data/vendor/assets/components/jquery/src/selector-sizzle.js +19 -0
- data/vendor/assets/components/jquery/src/selector.js +3 -0
- data/vendor/assets/components/jquery/src/serialize.js +132 -0
- data/vendor/assets/components/jquery/src/traversing.js +191 -0
- data/vendor/assets/components/jquery/src/traversing/findFilter.js +97 -0
- data/vendor/assets/components/jquery/src/traversing/var/dir.js +22 -0
- data/vendor/assets/components/jquery/src/traversing/var/rneedsContext.js +8 -0
- data/vendor/assets/components/jquery/src/traversing/var/siblings.js +17 -0
- data/vendor/assets/components/jquery/src/var/ObjectFunctionString.js +7 -0
- data/vendor/assets/components/jquery/src/var/arr.js +5 -0
- data/vendor/assets/components/jquery/src/var/class2type.js +6 -0
- data/vendor/assets/components/jquery/src/var/concat.js +7 -0
- data/vendor/assets/components/jquery/src/var/document.js +5 -0
- data/vendor/assets/components/jquery/src/var/documentElement.js +7 -0
- data/vendor/assets/components/jquery/src/var/fnToString.js +7 -0
- data/vendor/assets/components/jquery/src/var/getProto.js +5 -0
- data/vendor/assets/components/jquery/src/var/hasOwn.js +7 -0
- data/vendor/assets/components/jquery/src/var/indexOf.js +7 -0
- data/vendor/assets/components/jquery/src/var/isFunction.js +13 -0
- data/vendor/assets/components/jquery/src/var/isWindow.js +8 -0
- data/vendor/assets/components/jquery/src/var/pnum.js +5 -0
- data/vendor/assets/components/jquery/src/var/push.js +7 -0
- data/vendor/assets/components/jquery/src/var/rcssNum.js +9 -0
- data/vendor/assets/components/jquery/src/var/rnothtmlwhite.js +8 -0
- data/vendor/assets/components/jquery/src/var/slice.js +7 -0
- data/vendor/assets/components/jquery/src/var/support.js +6 -0
- data/vendor/assets/components/jquery/src/var/toString.js +7 -0
- data/vendor/assets/components/jquery/src/wrap.js +78 -0
- data/vendor/assets/components/markdown-it/.bower.json +38 -0
- data/vendor/assets/components/markdown-it/CHANGELOG.md +442 -0
- data/vendor/assets/components/markdown-it/CONTRIBUTING.md +15 -0
- data/vendor/assets/components/markdown-it/LICENSE +22 -0
- data/vendor/assets/components/markdown-it/Procfile +1 -0
- data/vendor/assets/components/markdown-it/README.md +294 -0
- data/vendor/assets/components/markdown-it/bin/markdown-it.js +113 -0
- data/vendor/assets/components/markdown-it/bower.json +28 -0
- data/vendor/assets/components/markdown-it/dist/markdown-it.js +7963 -0
- data/vendor/assets/components/markdown-it/dist/markdown-it.min.js +1 -0
- data/vendor/assets/components/markdown-it/package.json +64 -0
- data/vendor/assets/components/plantuml-encoder/.bower.json +29 -0
- data/vendor/assets/components/plantuml-encoder/LICENSE +19 -0
- data/vendor/assets/components/plantuml-encoder/README.md +38 -0
- data/vendor/assets/components/plantuml-encoder/bower.json +20 -0
- data/vendor/assets/components/plantuml-encoder/dist/plantuml-encoder.js +3994 -0
- data/vendor/assets/components/plantuml-encoder/dist/plantuml-encoder.min.js +1 -0
- data/vendor/assets/components/plantuml-encoder/package.json +33 -0
- data/vendor/assets/components/raphael/.bower.json +45 -0
- data/vendor/assets/components/raphael/bower.json +31 -0
- data/vendor/assets/components/raphael/dev/banner.txt +8 -0
- data/vendor/assets/components/raphael/dev/raphael.amd.js +14 -0
- data/vendor/assets/components/raphael/dev/raphael.core.js +5413 -0
- data/vendor/assets/components/raphael/dev/raphael.svg.js +1428 -0
- data/vendor/assets/components/raphael/dev/raphael.vml.js +1010 -0
- data/vendor/assets/components/raphael/dev/test/svg/dom.js +295 -0
- data/vendor/assets/components/raphael/dev/test/vml/dom.js +5 -0
- data/vendor/assets/components/raphael/license.txt +21 -0
- data/vendor/assets/components/raphael/raphael.js +8330 -0
- data/vendor/assets/components/raphael/raphael.min.js +3 -0
- data/vendor/assets/components/raphael/raphael.no-deps.js +7959 -0
- data/vendor/assets/components/raphael/raphael.no-deps.min.js +3 -0
- data/vendor/assets/components/raphael/webpack.config.js +62 -0
- data/vendor/assets/components/squire-rte/.bower.json +34 -0
- data/vendor/assets/components/squire-rte/Demo.html +143 -0
- data/vendor/assets/components/squire-rte/LICENSE +21 -0
- data/vendor/assets/components/squire-rte/Makefile +22 -0
- data/vendor/assets/components/squire-rte/README.md +473 -0
- data/vendor/assets/components/squire-rte/bower.json +24 -0
- data/vendor/assets/components/squire-rte/build/document.html +54 -0
- data/vendor/assets/components/squire-rte/build/squire-raw.js +4722 -0
- data/vendor/assets/components/squire-rte/build/squire.js +2 -0
- data/vendor/assets/components/squire-rte/package.json +31 -0
- data/vendor/assets/components/squire-rte/source/Clean.js +358 -0
- data/vendor/assets/components/squire-rte/source/Clipboard.js +331 -0
- data/vendor/assets/components/squire-rte/source/Constants.js +60 -0
- data/vendor/assets/components/squire-rte/source/Editor.js +2201 -0
- data/vendor/assets/components/squire-rte/source/KeyHandlers.js +502 -0
- data/vendor/assets/components/squire-rte/source/Node.js +553 -0
- data/vendor/assets/components/squire-rte/source/Range.js +540 -0
- data/vendor/assets/components/squire-rte/source/TreeWalker.js +118 -0
- data/vendor/assets/components/squire-rte/source/document.html +54 -0
- data/vendor/assets/components/squire-rte/source/exports.js +42 -0
- data/vendor/assets/components/squire-rte/source/intro.js +6 -0
- data/vendor/assets/components/squire-rte/source/outro.js +22 -0
- data/vendor/assets/components/to-mark/.bower.json +35 -0
- data/vendor/assets/components/to-mark/bower.json +22 -0
- data/vendor/assets/components/to-mark/demo/demo.html +24 -0
- data/vendor/assets/components/to-mark/demo/demo2.html +94 -0
- data/vendor/assets/components/to-mark/dist/to-mark.js +1283 -0
- data/vendor/assets/components/to-mark/dist/to-mark.min.js +1 -0
- data/vendor/assets/components/to-mark/gulpfile.js +112 -0
- data/vendor/assets/components/to-mark/karma.conf.js +260 -0
- data/vendor/assets/components/to-mark/package-lock.json +13061 -0
- data/vendor/assets/components/to-mark/package.json +53 -0
- data/vendor/assets/components/tui-chart/.bower.json +44 -0
- data/vendor/assets/components/tui-chart/CODE_OF_CONDUCT.md +73 -0
- data/vendor/assets/components/tui-chart/CONTRIBUTING.md +91 -0
- data/vendor/assets/components/tui-chart/LICENSE +21 -0
- data/vendor/assets/components/tui-chart/README.md +142 -0
- data/vendor/assets/components/tui-chart/bower.json +33 -0
- data/vendor/assets/components/tui-chart/dist/maps/china.js +10 -0
- data/vendor/assets/components/tui-chart/dist/maps/japan.js +10 -0
- data/vendor/assets/components/tui-chart/dist/maps/singapore.js +10 -0
- data/vendor/assets/components/tui-chart/dist/maps/south-korea.js +10 -0
- data/vendor/assets/components/tui-chart/dist/maps/taiwan.js +10 -0
- data/vendor/assets/components/tui-chart/dist/maps/thailand.js +10 -0
- data/vendor/assets/components/tui-chart/dist/maps/usa.js +10 -0
- data/vendor/assets/components/tui-chart/dist/maps/world.js +11 -0
- data/vendor/assets/components/tui-chart/dist/tui-chart.css +704 -0
- data/vendor/assets/components/tui-chart/dist/tui-chart.js +40567 -0
- data/vendor/assets/components/tui-chart/dist/tui-chart.min.css +10 -0
- data/vendor/assets/components/tui-chart/dist/tui-chart.min.js +20 -0
- data/vendor/assets/components/tui-chart/docs/COMMIT_MESSAGE_CONVENTION.md +49 -0
- data/vendor/assets/components/tui-chart/docs/ISSUE_TEMPLATE.md +24 -0
- data/vendor/assets/components/tui-chart/docs/PULL_REQUEST_TEMPLATE.md +42 -0
- data/vendor/assets/components/tui-chart/docs/README.md +11 -0
- data/vendor/assets/components/tui-chart/docs/wiki/README.md +27 -0
- data/vendor/assets/components/tui-chart/docs/wiki/_Sidebar.md +31 -0
- data/vendor/assets/components/tui-chart/docs/wiki/chart-export-menu.md +66 -0
- data/vendor/assets/components/tui-chart/docs/wiki/chart-type-radial.md +121 -0
- data/vendor/assets/components/tui-chart/docs/wiki/chart-types-bar,column.md +312 -0
- data/vendor/assets/components/tui-chart/docs/wiki/chart-types-bubble.md +63 -0
- data/vendor/assets/components/tui-chart/docs/wiki/chart-types-column-line-combo.md +104 -0
- data/vendor/assets/components/tui-chart/docs/wiki/chart-types-heatmap.md +39 -0
- data/vendor/assets/components/tui-chart/docs/wiki/chart-types-line,area.md +333 -0
- data/vendor/assets/components/tui-chart/docs/wiki/chart-types-line-area-combo.md +78 -0
- data/vendor/assets/components/tui-chart/docs/wiki/chart-types-line-scatter-combo.md +101 -0
- data/vendor/assets/components/tui-chart/docs/wiki/chart-types-map.md +153 -0
- data/vendor/assets/components/tui-chart/docs/wiki/chart-types-pie-donut-combo.md +98 -0
- data/vendor/assets/components/tui-chart/docs/wiki/chart-types-pie.md +186 -0
- data/vendor/assets/components/tui-chart/docs/wiki/chart-types-scatter.md +58 -0
- data/vendor/assets/components/tui-chart/docs/wiki/chart-types-treemap.md +158 -0
- data/vendor/assets/components/tui-chart/docs/wiki/code-table-of-china-map.md +38 -0
- data/vendor/assets/components/tui-chart/docs/wiki/code-table-of-japan-map.md +51 -0
- data/vendor/assets/components/tui-chart/docs/wiki/code-table-of-singapore-map.md +9 -0
- data/vendor/assets/components/tui-chart/docs/wiki/code-table-of-south-korea-map.md +21 -0
- data/vendor/assets/components/tui-chart/docs/wiki/code-table-of-taiwan-map.md +26 -0
- data/vendor/assets/components/tui-chart/docs/wiki/code-table-of-thailand-map.md +82 -0
- data/vendor/assets/components/tui-chart/docs/wiki/code-table-of-usa-map.md +55 -0
- data/vendor/assets/components/tui-chart/docs/wiki/code-table-of-world-map.md +180 -0
- data/vendor/assets/components/tui-chart/docs/wiki/features-axes.md +209 -0
- data/vendor/assets/components/tui-chart/docs/wiki/features-chart.md +157 -0
- data/vendor/assets/components/tui-chart/docs/wiki/features-circle-legend.md +20 -0
- data/vendor/assets/components/tui-chart/docs/wiki/features-legend.md +89 -0
- data/vendor/assets/components/tui-chart/docs/wiki/features-plot.md +141 -0
- data/vendor/assets/components/tui-chart/docs/wiki/features-series.md +240 -0
- data/vendor/assets/components/tui-chart/docs/wiki/features-tooltip.md +223 -0
- data/vendor/assets/components/tui-chart/docs/wiki/getting-started.md +74 -0
- data/vendor/assets/components/tui-chart/docs/wiki/import-chart-data-from-existing-table-element.md +150 -0
- data/vendor/assets/components/tui-chart/docs/wiki/table-of-supported-options.md +344 -0
- data/vendor/assets/components/tui-chart/docs/wiki/theme.md +338 -0
- data/vendor/assets/components/tui-chart/package-lock.json +8881 -0
- data/vendor/assets/components/tui-code-snippet/.bower.json +31 -0
- data/vendor/assets/components/tui-code-snippet/LICENSE +21 -0
- data/vendor/assets/components/tui-code-snippet/README.md +109 -0
- data/vendor/assets/components/tui-code-snippet/bower.json +20 -0
- data/vendor/assets/components/tui-code-snippet/demo/postBridge/README.md +26 -0
- data/vendor/assets/components/tui-code-snippet/demo/postBridge/public/popup.html +27 -0
- data/vendor/assets/components/tui-code-snippet/demo/postBridge/public/postBridge.html +31 -0
- data/vendor/assets/components/tui-code-snippet/demo/postBridge/server.js +28 -0
- data/vendor/assets/components/tui-code-snippet/dist/tui-code-snippet.js +4228 -0
- data/vendor/assets/components/tui-code-snippet/dist/tui-code-snippet.min.js +7 -0
- data/vendor/assets/components/tui-code-snippet/package-lock.json +6038 -0
- data/vendor/assets/components/tui-color-picker/.bower.json +37 -0
- data/vendor/assets/components/tui-color-picker/ISSUE_TEMPLATE.md +26 -0
- data/vendor/assets/components/tui-color-picker/LICENSE +34 -0
- data/vendor/assets/components/tui-color-picker/README.md +69 -0
- data/vendor/assets/components/tui-color-picker/bower.json +26 -0
- data/vendor/assets/components/tui-color-picker/dist/tui-color-picker.css +148 -0
- data/vendor/assets/components/tui-color-picker/dist/tui-color-picker.js +3146 -0
- data/vendor/assets/components/tui-color-picker/dist/tui-color-picker.min.css +7 -0
- data/vendor/assets/components/tui-color-picker/dist/tui-color-picker.min.js +9 -0
- data/vendor/assets/components/tui-color-picker/package-lock.json +8440 -0
- data/vendor/assets/components/tui-editor/.bower.json +71 -0
- data/vendor/assets/components/tui-editor/CODE_OF_CONDUCT.md +73 -0
- data/vendor/assets/components/tui-editor/CONTRIBUTING.md +92 -0
- data/vendor/assets/components/tui-editor/LICENSE +21 -0
- data/vendor/assets/components/tui-editor/README.md +204 -0
- data/vendor/assets/components/tui-editor/bower.json +59 -0
- data/vendor/assets/components/tui-editor/dist/tui-editor-Editor-all.js +36850 -0
- data/vendor/assets/components/tui-editor/dist/tui-editor-Editor-all.min.js +13 -0
- data/vendor/assets/components/tui-editor/dist/tui-editor-Editor.js +24646 -0
- data/vendor/assets/components/tui-editor/dist/tui-editor-Editor.min.js +7 -0
- data/vendor/assets/components/tui-editor/dist/tui-editor-Viewer-all.js +14768 -0
- data/vendor/assets/components/tui-editor/dist/tui-editor-Viewer-all.min.js +13 -0
- data/vendor/assets/components/tui-editor/dist/tui-editor-Viewer.js +3686 -0
- data/vendor/assets/components/tui-editor/dist/tui-editor-Viewer.min.js +7 -0
- data/vendor/assets/components/tui-editor/dist/tui-editor-contents.css +239 -0
- data/vendor/assets/components/tui-editor/dist/tui-editor-contents.min.css +1 -0
- data/vendor/assets/components/tui-editor/dist/tui-editor-extChart.js +7040 -0
- data/vendor/assets/components/tui-editor/dist/tui-editor-extChart.min.js +13 -0
- data/vendor/assets/components/tui-editor/dist/tui-editor-extColorSyntax.js +472 -0
- data/vendor/assets/components/tui-editor/dist/tui-editor-extColorSyntax.min.js +7 -0
- data/vendor/assets/components/tui-editor/dist/tui-editor-extScrollSync.js +1241 -0
- data/vendor/assets/components/tui-editor/dist/tui-editor-extScrollSync.min.js +7 -0
- data/vendor/assets/components/tui-editor/dist/tui-editor-extTable.js +3930 -0
- data/vendor/assets/components/tui-editor/dist/tui-editor-extTable.min.js +7 -0
- data/vendor/assets/components/tui-editor/dist/tui-editor-extUML.js +212 -0
- data/vendor/assets/components/tui-editor/dist/tui-editor-extUML.min.js +7 -0
- data/vendor/assets/components/tui-editor/dist/tui-editor.css +1166 -0
- data/vendor/assets/components/tui-editor/dist/tui-editor.min.css +1 -0
- data/vendor/assets/components/tui-editor/docs/COMMIT_MESSAGE_CONVENTION.md +49 -0
- data/vendor/assets/components/tui-editor/docs/PULL_REQUEST_TEMPLATE.md +41 -0
- data/vendor/assets/components/tui-editor/docs/README.md +13 -0
- data/vendor/assets/components/tui-editor/docs/getting-started-with-bower.md +93 -0
- data/vendor/assets/components/tui-editor/docs/getting-started.md +76 -0
- data/vendor/assets/components/tui-editor/docs/using-extensions.md +91 -0
- data/vendor/assets/components/tui-editor/docs/writing-your-own-extension.md +167 -0
- data/vendor/assets/components/tui-editor/examples/example00-demo.html +85 -0
- data/vendor/assets/components/tui-editor/examples/example01-basic.html +37 -0
- data/vendor/assets/components/tui-editor/examples/example02-viewer-basic.html +68 -0
- data/vendor/assets/components/tui-editor/examples/example03-jquery.html +36 -0
- data/vendor/assets/components/tui-editor/examples/example04-viewer-jquery.html +67 -0
- data/vendor/assets/components/tui-editor/examples/example05-scrollsync.html +77 -0
- data/vendor/assets/components/tui-editor/examples/example06-colorsyntax.html +44 -0
- data/vendor/assets/components/tui-editor/examples/example07-table.html +48 -0
- data/vendor/assets/components/tui-editor/examples/example08-uml.html +69 -0
- data/vendor/assets/components/tui-editor/examples/example09-multiple-extensions.html +85 -0
- data/vendor/assets/components/tui-editor/examples/example10-viewer-multiple-extensions.html +86 -0
- data/vendor/assets/components/tui-editor/examples/example11-chart.html +60 -0
- data/vendor/assets/components/tui-editor/examples/example12-writing-extension.html +66 -0
- data/vendor/assets/components/tui-editor/examples/examples.json +41 -0
- data/vendor/assets/components/tui-editor/examples/explain.css +7 -0
- data/vendor/assets/components/tui-editor/package-lock.json +13289 -0
- data/vendor/assets/components/tui-editor/package.json +90 -0
- metadata +956 -0
@@ -0,0 +1 @@
|
|
1
|
+
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).markdownit=e()}}(function(){return function e(r,t,n){function s(i,a){if(!t[i]){if(!r[i]){var c="function"==typeof require&&require;if(!a&&c)return c(i,!0);if(o)return o(i,!0);var l=new Error("Cannot find module '"+i+"'");throw l.code="MODULE_NOT_FOUND",l}var u=t[i]={exports:{}};r[i][0].call(u.exports,function(e){var t=r[i][1][e];return s(t||e)},u,u.exports,e,r,t,n)}return t[i].exports}for(var o="function"==typeof require&&require,i=0;i<n.length;i++)s(n[i]);return s}({1:[function(e,r,t){"use strict";r.exports=e("entities/maps/entities.json")},{"entities/maps/entities.json":52}],2:[function(e,r,t){"use strict";r.exports=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","meta","nav","noframes","ol","optgroup","option","p","param","section","source","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"]},{}],3:[function(e,r,t){"use strict";var n="<[A-Za-z][A-Za-z0-9\\-]*(?:\\s+[a-zA-Z_:][a-zA-Z0-9:._-]*(?:\\s*=\\s*(?:[^\"'=<>`\\x00-\\x20]+|'[^']*'|\"[^\"]*\"))?)*\\s*\\/?>",s="<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>",o=new RegExp("^(?:"+n+"|"+s+"|\x3c!----\x3e|\x3c!--(?:-?[^>-])(?:-?[^-])*--\x3e|<[?].*?[?]>|<![A-Z]+\\s+[^>]*>|<!\\[CDATA\\[[\\s\\S]*?\\]\\]>)"),i=new RegExp("^(?:"+n+"|"+s+")");r.exports.HTML_TAG_RE=o,r.exports.HTML_OPEN_CLOSE_TAG_RE=i},{}],4:[function(e,r,t){"use strict";function n(e){return Object.prototype.toString.call(e)}function s(e,r){return l.call(e,r)}function o(e){return!(e>=55296&&e<=57343)&&(!(e>=64976&&e<=65007)&&(65535!=(65535&e)&&65534!=(65535&e)&&(!(e>=0&&e<=8)&&(11!==e&&(!(e>=14&&e<=31)&&(!(e>=127&&e<=159)&&!(e>1114111)))))))}function i(e){if(e>65535){var r=55296+((e-=65536)>>10),t=56320+(1023&e);return String.fromCharCode(r,t)}return String.fromCharCode(e)}function a(e,r){var t=0;return s(d,r)?d[r]:35===r.charCodeAt(0)&&f.test(r)&&(t="x"===r[1].toLowerCase()?parseInt(r.slice(2),16):parseInt(r.slice(1),10),o(t))?i(t):e}function c(e){return g[e]}var l=Object.prototype.hasOwnProperty,u=/\\([!"#$%&'()*+,\-.\/:;<=>?@[\\\]^_`{|}~])/g,p=/&([a-z#][a-z0-9]{1,31});/gi,h=new RegExp(u.source+"|"+p.source,"gi"),f=/^#((?:x[a-f0-9]{1,8}|[0-9]{1,8}))/i,d=e("./entities"),m=/[&<>"]/,_=/[&<>"]/g,g={"&":"&","<":"<",">":">",'"':"""},b=/[.?*+^$[\]\\(){}|-]/g,k=e("uc.micro/categories/P/regex");t.lib={},t.lib.mdurl=e("mdurl"),t.lib.ucmicro=e("uc.micro"),t.assign=function(e){return Array.prototype.slice.call(arguments,1).forEach(function(r){if(r){if("object"!=typeof r)throw new TypeError(r+"must be object");Object.keys(r).forEach(function(t){e[t]=r[t]})}}),e},t.isString=function(e){return"[object String]"===n(e)},t.has=s,t.unescapeMd=function(e){return e.indexOf("\\")<0?e:e.replace(u,"$1")},t.unescapeAll=function(e){return e.indexOf("\\")<0&&e.indexOf("&")<0?e:e.replace(h,function(e,r,t){return r||a(e,t)})},t.isValidEntityCode=o,t.fromCodePoint=i,t.escapeHtml=function(e){return m.test(e)?e.replace(_,c):e},t.arrayReplaceAt=function(e,r,t){return[].concat(e.slice(0,r),t,e.slice(r+1))},t.isSpace=function(e){switch(e){case 9:case 32:return!0}return!1},t.isWhiteSpace=function(e){if(e>=8192&&e<=8202)return!0;switch(e){case 9:case 10:case 11:case 12:case 13:case 32:case 160:case 5760:case 8239:case 8287:case 12288:return!0}return!1},t.isMdAsciiPunct=function(e){switch(e){case 33:case 34:case 35:case 36:case 37:case 38:case 39:case 40:case 41:case 42:case 43:case 44:case 45:case 46:case 47:case 58:case 59:case 60:case 61:case 62:case 63:case 64:case 91:case 92:case 93:case 94:case 95:case 96:case 123:case 124:case 125:case 126:return!0;default:return!1}},t.isPunctChar=function(e){return k.test(e)},t.escapeRE=function(e){return e.replace(b,"\\$&")},t.normalizeReference=function(e){return e.trim().replace(/\s+/g," ").toUpperCase()}},{"./entities":1,mdurl:58,"uc.micro":65,"uc.micro/categories/P/regex":63}],5:[function(e,r,t){"use strict";t.parseLinkLabel=e("./parse_link_label"),t.parseLinkDestination=e("./parse_link_destination"),t.parseLinkTitle=e("./parse_link_title")},{"./parse_link_destination":6,"./parse_link_label":7,"./parse_link_title":8}],6:[function(e,r,t){"use strict";var n=e("../common/utils").isSpace,s=e("../common/utils").unescapeAll;r.exports=function(e,r,t){var o,i,a=r,c={ok:!1,pos:0,lines:0,str:""};if(60===e.charCodeAt(r)){for(r++;r<t;){if(10===(o=e.charCodeAt(r))||n(o))return c;if(62===o)return c.pos=r+1,c.str=s(e.slice(a+1,r)),c.ok=!0,c;92===o&&r+1<t?r+=2:r++}return c}for(i=0;r<t&&32!==(o=e.charCodeAt(r))&&!(o<32||127===o);)if(92===o&&r+1<t)r+=2;else{if(40===o&&i++,41===o){if(0===i)break;i--}r++}return a===r?c:0!==i?c:(c.str=s(e.slice(a,r)),c.lines=0,c.pos=r,c.ok=!0,c)}},{"../common/utils":4}],7:[function(e,r,t){"use strict";r.exports=function(e,r,t){var n,s,o,i,a=-1,c=e.posMax,l=e.pos;for(e.pos=r+1,n=1;e.pos<c;){if(93===(o=e.src.charCodeAt(e.pos))&&0==--n){s=!0;break}if(i=e.pos,e.md.inline.skipToken(e),91===o)if(i===e.pos-1)n++;else if(t)return e.pos=l,-1}return s&&(a=e.pos),e.pos=l,a}},{}],8:[function(e,r,t){"use strict";var n=e("../common/utils").unescapeAll;r.exports=function(e,r,t){var s,o,i=0,a=r,c={ok:!1,pos:0,lines:0,str:""};if(r>=t)return c;if(34!==(o=e.charCodeAt(r))&&39!==o&&40!==o)return c;for(r++,40===o&&(o=41);r<t;){if((s=e.charCodeAt(r))===o)return c.pos=r+1,c.lines=i,c.str=n(e.slice(a+1,r)),c.ok=!0,c;10===s?i++:92===s&&r+1<t&&(r++,10===e.charCodeAt(r)&&i++),r++}return c}},{"../common/utils":4}],9:[function(e,r,t){"use strict";function n(e){var r=e.trim().toLowerCase();return!g.test(r)||!!b.test(r)}function s(e){var r=d.parse(e,!0);if(r.hostname&&(!r.protocol||k.indexOf(r.protocol)>=0))try{r.hostname=m.toASCII(r.hostname)}catch(e){}return d.encode(d.format(r))}function o(e){var r=d.parse(e,!0);if(r.hostname&&(!r.protocol||k.indexOf(r.protocol)>=0))try{r.hostname=m.toUnicode(r.hostname)}catch(e){}return d.decode(d.format(r))}function i(e,r){if(!(this instanceof i))return new i(e,r);r||a.isString(e)||(r=e||{},e="default"),this.inline=new h,this.block=new p,this.core=new u,this.renderer=new l,this.linkify=new f,this.validateLink=n,this.normalizeLink=s,this.normalizeLinkText=o,this.utils=a,this.helpers=a.assign({},c),this.options={},this.configure(e),r&&this.set(r)}var a=e("./common/utils"),c=e("./helpers"),l=e("./renderer"),u=e("./parser_core"),p=e("./parser_block"),h=e("./parser_inline"),f=e("linkify-it"),d=e("mdurl"),m=e("punycode"),_={default:e("./presets/default"),zero:e("./presets/zero"),commonmark:e("./presets/commonmark")},g=/^(vbscript|javascript|file|data):/,b=/^data:image\/(gif|png|jpeg|webp);/,k=["http:","https:","mailto:"];i.prototype.set=function(e){return a.assign(this.options,e),this},i.prototype.configure=function(e){var r,t=this;if(a.isString(e)&&(r=e,!(e=_[r])))throw new Error('Wrong `markdown-it` preset "'+r+'", check name');if(!e)throw new Error("Wrong `markdown-it` preset, can't be empty");return e.options&&t.set(e.options),e.components&&Object.keys(e.components).forEach(function(r){e.components[r].rules&&t[r].ruler.enableOnly(e.components[r].rules),e.components[r].rules2&&t[r].ruler2.enableOnly(e.components[r].rules2)}),this},i.prototype.enable=function(e,r){var t=[];Array.isArray(e)||(e=[e]),["core","block","inline"].forEach(function(r){t=t.concat(this[r].ruler.enable(e,!0))},this),t=t.concat(this.inline.ruler2.enable(e,!0));var n=e.filter(function(e){return t.indexOf(e)<0});if(n.length&&!r)throw new Error("MarkdownIt. Failed to enable unknown rule(s): "+n);return this},i.prototype.disable=function(e,r){var t=[];Array.isArray(e)||(e=[e]),["core","block","inline"].forEach(function(r){t=t.concat(this[r].ruler.disable(e,!0))},this),t=t.concat(this.inline.ruler2.disable(e,!0));var n=e.filter(function(e){return t.indexOf(e)<0});if(n.length&&!r)throw new Error("MarkdownIt. Failed to disable unknown rule(s): "+n);return this},i.prototype.use=function(e){var r=[this].concat(Array.prototype.slice.call(arguments,1));return e.apply(e,r),this},i.prototype.parse=function(e,r){if("string"!=typeof e)throw new Error("Input data should be a String");var t=new this.core.State(e,this,r);return this.core.process(t),t.tokens},i.prototype.render=function(e,r){return r=r||{},this.renderer.render(this.parse(e,r),this.options,r)},i.prototype.parseInline=function(e,r){var t=new this.core.State(e,this,r);return t.inlineMode=!0,this.core.process(t),t.tokens},i.prototype.renderInline=function(e,r){return r=r||{},this.renderer.render(this.parseInline(e,r),this.options,r)},r.exports=i},{"./common/utils":4,"./helpers":5,"./parser_block":10,"./parser_core":11,"./parser_inline":12,"./presets/commonmark":13,"./presets/default":14,"./presets/zero":15,"./renderer":16,"linkify-it":53,mdurl:58,punycode:60}],10:[function(e,r,t){"use strict";function n(){this.ruler=new s;for(var e=0;e<o.length;e++)this.ruler.push(o[e][0],o[e][1],{alt:(o[e][2]||[]).slice()})}var s=e("./ruler"),o=[["table",e("./rules_block/table"),["paragraph","reference"]],["code",e("./rules_block/code")],["fence",e("./rules_block/fence"),["paragraph","reference","blockquote","list"]],["blockquote",e("./rules_block/blockquote"),["paragraph","reference","blockquote","list"]],["hr",e("./rules_block/hr"),["paragraph","reference","blockquote","list"]],["list",e("./rules_block/list"),["paragraph","reference","blockquote"]],["reference",e("./rules_block/reference")],["heading",e("./rules_block/heading"),["paragraph","reference","blockquote"]],["lheading",e("./rules_block/lheading")],["html_block",e("./rules_block/html_block"),["paragraph","reference","blockquote"]],["paragraph",e("./rules_block/paragraph")]];n.prototype.tokenize=function(e,r,t){for(var n,s=this.ruler.getRules(""),o=s.length,i=r,a=!1,c=e.md.options.maxNesting;i<t&&(e.line=i=e.skipEmptyLines(i),!(i>=t))&&!(e.sCount[i]<e.blkIndent);){if(e.level>=c){e.line=t;break}for(n=0;n<o&&!s[n](e,i,t,!1);n++);e.tight=!a,e.isEmpty(e.line-1)&&(a=!0),(i=e.line)<t&&e.isEmpty(i)&&(a=!0,i++,e.line=i)}},n.prototype.parse=function(e,r,t,n){var s;e&&(s=new this.State(e,r,t,n),this.tokenize(s,s.line,s.lineMax))},n.prototype.State=e("./rules_block/state_block"),r.exports=n},{"./ruler":17,"./rules_block/blockquote":18,"./rules_block/code":19,"./rules_block/fence":20,"./rules_block/heading":21,"./rules_block/hr":22,"./rules_block/html_block":23,"./rules_block/lheading":24,"./rules_block/list":25,"./rules_block/paragraph":26,"./rules_block/reference":27,"./rules_block/state_block":28,"./rules_block/table":29}],11:[function(e,r,t){"use strict";function n(){this.ruler=new s;for(var e=0;e<o.length;e++)this.ruler.push(o[e][0],o[e][1])}var s=e("./ruler"),o=[["normalize",e("./rules_core/normalize")],["block",e("./rules_core/block")],["inline",e("./rules_core/inline")],["linkify",e("./rules_core/linkify")],["replacements",e("./rules_core/replacements")],["smartquotes",e("./rules_core/smartquotes")]];n.prototype.process=function(e){var r,t,n;for(r=0,t=(n=this.ruler.getRules("")).length;r<t;r++)n[r](e)},n.prototype.State=e("./rules_core/state_core"),r.exports=n},{"./ruler":17,"./rules_core/block":30,"./rules_core/inline":31,"./rules_core/linkify":32,"./rules_core/normalize":33,"./rules_core/replacements":34,"./rules_core/smartquotes":35,"./rules_core/state_core":36}],12:[function(e,r,t){"use strict";function n(){var e;for(this.ruler=new s,e=0;e<o.length;e++)this.ruler.push(o[e][0],o[e][1]);for(this.ruler2=new s,e=0;e<i.length;e++)this.ruler2.push(i[e][0],i[e][1])}var s=e("./ruler"),o=[["text",e("./rules_inline/text")],["newline",e("./rules_inline/newline")],["escape",e("./rules_inline/escape")],["backticks",e("./rules_inline/backticks")],["strikethrough",e("./rules_inline/strikethrough").tokenize],["emphasis",e("./rules_inline/emphasis").tokenize],["link",e("./rules_inline/link")],["image",e("./rules_inline/image")],["autolink",e("./rules_inline/autolink")],["html_inline",e("./rules_inline/html_inline")],["entity",e("./rules_inline/entity")]],i=[["balance_pairs",e("./rules_inline/balance_pairs")],["strikethrough",e("./rules_inline/strikethrough").postProcess],["emphasis",e("./rules_inline/emphasis").postProcess],["text_collapse",e("./rules_inline/text_collapse")]];n.prototype.skipToken=function(e){var r,t,n=e.pos,s=this.ruler.getRules(""),o=s.length,i=e.md.options.maxNesting,a=e.cache;if(void 0===a[n]){if(e.level<i)for(t=0;t<o&&(e.level++,r=s[t](e,!0),e.level--,!r);t++);else e.pos=e.posMax;r||e.pos++,a[n]=e.pos}else e.pos=a[n]},n.prototype.tokenize=function(e){for(var r,t,n=this.ruler.getRules(""),s=n.length,o=e.posMax,i=e.md.options.maxNesting;e.pos<o;){if(e.level<i)for(t=0;t<s&&!(r=n[t](e,!1));t++);if(r){if(e.pos>=o)break}else e.pending+=e.src[e.pos++]}e.pending&&e.pushPending()},n.prototype.parse=function(e,r,t,n){var s,o,i,a=new this.State(e,r,t,n);for(this.tokenize(a),i=(o=this.ruler2.getRules("")).length,s=0;s<i;s++)o[s](a)},n.prototype.State=e("./rules_inline/state_inline"),r.exports=n},{"./ruler":17,"./rules_inline/autolink":37,"./rules_inline/backticks":38,"./rules_inline/balance_pairs":39,"./rules_inline/emphasis":40,"./rules_inline/entity":41,"./rules_inline/escape":42,"./rules_inline/html_inline":43,"./rules_inline/image":44,"./rules_inline/link":45,"./rules_inline/newline":46,"./rules_inline/state_inline":47,"./rules_inline/strikethrough":48,"./rules_inline/text":49,"./rules_inline/text_collapse":50}],13:[function(e,r,t){"use strict";r.exports={options:{html:!0,xhtmlOut:!0,breaks:!1,langPrefix:"language-",linkify:!1,typographer:!1,quotes:"\u201c\u201d\u2018\u2019",highlight:null,maxNesting:20},components:{core:{rules:["normalize","block","inline"]},block:{rules:["blockquote","code","fence","heading","hr","html_block","lheading","list","reference","paragraph"]},inline:{rules:["autolink","backticks","emphasis","entity","escape","html_inline","image","link","newline","text"],rules2:["balance_pairs","emphasis","text_collapse"]}}}},{}],14:[function(e,r,t){"use strict";r.exports={options:{html:!1,xhtmlOut:!1,breaks:!1,langPrefix:"language-",linkify:!1,typographer:!1,quotes:"\u201c\u201d\u2018\u2019",highlight:null,maxNesting:100},components:{core:{},block:{},inline:{}}}},{}],15:[function(e,r,t){"use strict";r.exports={options:{html:!1,xhtmlOut:!1,breaks:!1,langPrefix:"language-",linkify:!1,typographer:!1,quotes:"\u201c\u201d\u2018\u2019",highlight:null,maxNesting:20},components:{core:{rules:["normalize","block","inline"]},block:{rules:["paragraph"]},inline:{rules:["text"],rules2:["balance_pairs","text_collapse"]}}}},{}],16:[function(e,r,t){"use strict";function n(){this.rules=s({},a)}var s=e("./common/utils").assign,o=e("./common/utils").unescapeAll,i=e("./common/utils").escapeHtml,a={};a.code_inline=function(e,r,t,n,s){var o=e[r];return"<code"+s.renderAttrs(o)+">"+i(e[r].content)+"</code>"},a.code_block=function(e,r,t,n,s){var o=e[r];return"<pre"+s.renderAttrs(o)+"><code>"+i(e[r].content)+"</code></pre>\n"},a.fence=function(e,r,t,n,s){var a,c,l,u,p=e[r],h=p.info?o(p.info).trim():"",f="";return h&&(f=h.split(/\s+/g)[0]),0===(a=t.highlight?t.highlight(p.content,f)||i(p.content):i(p.content)).indexOf("<pre")?a+"\n":h?(c=p.attrIndex("class"),l=p.attrs?p.attrs.slice():[],c<0?l.push(["class",t.langPrefix+f]):l[c][1]+=" "+t.langPrefix+f,u={attrs:l},"<pre><code"+s.renderAttrs(u)+">"+a+"</code></pre>\n"):"<pre><code"+s.renderAttrs(p)+">"+a+"</code></pre>\n"},a.image=function(e,r,t,n,s){var o=e[r];return o.attrs[o.attrIndex("alt")][1]=s.renderInlineAsText(o.children,t,n),s.renderToken(e,r,t)},a.hardbreak=function(e,r,t){return t.xhtmlOut?"<br />\n":"<br>\n"},a.softbreak=function(e,r,t){return t.breaks?t.xhtmlOut?"<br />\n":"<br>\n":"\n"},a.text=function(e,r){return i(e[r].content)},a.html_block=function(e,r){return e[r].content},a.html_inline=function(e,r){return e[r].content},n.prototype.renderAttrs=function(e){var r,t,n;if(!e.attrs)return"";for(n="",r=0,t=e.attrs.length;r<t;r++)n+=" "+i(e.attrs[r][0])+'="'+i(e.attrs[r][1])+'"';return n},n.prototype.renderToken=function(e,r,t){var n,s="",o=!1,i=e[r];return i.hidden?"":(i.block&&-1!==i.nesting&&r&&e[r-1].hidden&&(s+="\n"),s+=(-1===i.nesting?"</":"<")+i.tag,s+=this.renderAttrs(i),0===i.nesting&&t.xhtmlOut&&(s+=" /"),i.block&&(o=!0,1===i.nesting&&r+1<e.length&&("inline"===(n=e[r+1]).type||n.hidden?o=!1:-1===n.nesting&&n.tag===i.tag&&(o=!1))),s+=o?">\n":">")},n.prototype.renderInline=function(e,r,t){for(var n,s="",o=this.rules,i=0,a=e.length;i<a;i++)void 0!==o[n=e[i].type]?s+=o[n](e,i,r,t,this):s+=this.renderToken(e,i,r);return s},n.prototype.renderInlineAsText=function(e,r,t){for(var n="",s=0,o=e.length;s<o;s++)"text"===e[s].type?n+=e[s].content:"image"===e[s].type&&(n+=this.renderInlineAsText(e[s].children,r,t));return n},n.prototype.render=function(e,r,t){var n,s,o,i="",a=this.rules;for(n=0,s=e.length;n<s;n++)"inline"===(o=e[n].type)?i+=this.renderInline(e[n].children,r,t):void 0!==a[o]?i+=a[e[n].type](e,n,r,t,this):i+=this.renderToken(e,n,r,t);return i},r.exports=n},{"./common/utils":4}],17:[function(e,r,t){"use strict";function n(){this.__rules__=[],this.__cache__=null}n.prototype.__find__=function(e){for(var r=0;r<this.__rules__.length;r++)if(this.__rules__[r].name===e)return r;return-1},n.prototype.__compile__=function(){var e=this,r=[""];e.__rules__.forEach(function(e){e.enabled&&e.alt.forEach(function(e){r.indexOf(e)<0&&r.push(e)})}),e.__cache__={},r.forEach(function(r){e.__cache__[r]=[],e.__rules__.forEach(function(t){t.enabled&&(r&&t.alt.indexOf(r)<0||e.__cache__[r].push(t.fn))})})},n.prototype.at=function(e,r,t){var n=this.__find__(e),s=t||{};if(-1===n)throw new Error("Parser rule not found: "+e);this.__rules__[n].fn=r,this.__rules__[n].alt=s.alt||[],this.__cache__=null},n.prototype.before=function(e,r,t,n){var s=this.__find__(e),o=n||{};if(-1===s)throw new Error("Parser rule not found: "+e);this.__rules__.splice(s,0,{name:r,enabled:!0,fn:t,alt:o.alt||[]}),this.__cache__=null},n.prototype.after=function(e,r,t,n){var s=this.__find__(e),o=n||{};if(-1===s)throw new Error("Parser rule not found: "+e);this.__rules__.splice(s+1,0,{name:r,enabled:!0,fn:t,alt:o.alt||[]}),this.__cache__=null},n.prototype.push=function(e,r,t){var n=t||{};this.__rules__.push({name:e,enabled:!0,fn:r,alt:n.alt||[]}),this.__cache__=null},n.prototype.enable=function(e,r){Array.isArray(e)||(e=[e]);var t=[];return e.forEach(function(e){var n=this.__find__(e);if(n<0){if(r)return;throw new Error("Rules manager: invalid rule name "+e)}this.__rules__[n].enabled=!0,t.push(e)},this),this.__cache__=null,t},n.prototype.enableOnly=function(e,r){Array.isArray(e)||(e=[e]),this.__rules__.forEach(function(e){e.enabled=!1}),this.enable(e,r)},n.prototype.disable=function(e,r){Array.isArray(e)||(e=[e]);var t=[];return e.forEach(function(e){var n=this.__find__(e);if(n<0){if(r)return;throw new Error("Rules manager: invalid rule name "+e)}this.__rules__[n].enabled=!1,t.push(e)},this),this.__cache__=null,t},n.prototype.getRules=function(e){return null===this.__cache__&&this.__compile__(),this.__cache__[e]||[]},r.exports=n},{}],18:[function(e,r,t){"use strict";var n=e("../common/utils").isSpace;r.exports=function(e,r,t,s){var o,i,a,c,l,u,p,h,f,d,m,_,g,b,k,v,x,y,C,A,w=e.lineMax,D=e.bMarks[r]+e.tShift[r],q=e.eMarks[r];if(e.sCount[r]-e.blkIndent>=4)return!1;if(62!==e.src.charCodeAt(D++))return!1;if(s)return!0;for(c=f=e.sCount[r]+D-(e.bMarks[r]+e.tShift[r]),32===e.src.charCodeAt(D)?(D++,c++,f++,o=!1,v=!0):9===e.src.charCodeAt(D)?(v=!0,(e.bsCount[r]+f)%4==3?(D++,c++,f++,o=!1):o=!0):v=!1,d=[e.bMarks[r]],e.bMarks[r]=D;D<q&&(i=e.src.charCodeAt(D),n(i));)9===i?f+=4-(f+e.bsCount[r]+(o?1:0))%4:f++,D++;for(m=[e.bsCount[r]],e.bsCount[r]=e.sCount[r]+1+(v?1:0),u=D>=q,b=[e.sCount[r]],e.sCount[r]=f-c,k=[e.tShift[r]],e.tShift[r]=D-e.bMarks[r],y=e.md.block.ruler.getRules("blockquote"),g=e.parentType,e.parentType="blockquote",A=!1,h=r+1;h<t&&(e.sCount[h]<e.blkIndent&&(A=!0),D=e.bMarks[h]+e.tShift[h],q=e.eMarks[h],!(D>=q));h++)if(62!==e.src.charCodeAt(D++)||A){if(u)break;for(x=!1,a=0,l=y.length;a<l;a++)if(y[a](e,h,t,!0)){x=!0;break}if(x){e.lineMax=h,0!==e.blkIndent&&(d.push(e.bMarks[h]),m.push(e.bsCount[h]),k.push(e.tShift[h]),b.push(e.sCount[h]),e.sCount[h]-=e.blkIndent);break}d.push(e.bMarks[h]),m.push(e.bsCount[h]),k.push(e.tShift[h]),b.push(e.sCount[h]),e.sCount[h]=-1}else{for(c=f=e.sCount[h]+D-(e.bMarks[h]+e.tShift[h]),32===e.src.charCodeAt(D)?(D++,c++,f++,o=!1,v=!0):9===e.src.charCodeAt(D)?(v=!0,(e.bsCount[h]+f)%4==3?(D++,c++,f++,o=!1):o=!0):v=!1,d.push(e.bMarks[h]),e.bMarks[h]=D;D<q&&(i=e.src.charCodeAt(D),n(i));)9===i?f+=4-(f+e.bsCount[h]+(o?1:0))%4:f++,D++;u=D>=q,m.push(e.bsCount[h]),e.bsCount[h]=e.sCount[h]+1+(v?1:0),b.push(e.sCount[h]),e.sCount[h]=f-c,k.push(e.tShift[h]),e.tShift[h]=D-e.bMarks[h]}for(_=e.blkIndent,e.blkIndent=0,(C=e.push("blockquote_open","blockquote",1)).markup=">",C.map=p=[r,0],e.md.block.tokenize(e,r,h),(C=e.push("blockquote_close","blockquote",-1)).markup=">",e.lineMax=w,e.parentType=g,p[1]=e.line,a=0;a<k.length;a++)e.bMarks[a+r]=d[a],e.tShift[a+r]=k[a],e.sCount[a+r]=b[a],e.bsCount[a+r]=m[a];return e.blkIndent=_,!0}},{"../common/utils":4}],19:[function(e,r,t){"use strict";r.exports=function(e,r,t){var n,s,o;if(e.sCount[r]-e.blkIndent<4)return!1;for(s=n=r+1;n<t;)if(e.isEmpty(n))n++;else{if(!(e.sCount[n]-e.blkIndent>=4))break;s=++n}return e.line=s,o=e.push("code_block","code",0),o.content=e.getLines(r,s,4+e.blkIndent,!0),o.map=[r,e.line],!0}},{}],20:[function(e,r,t){"use strict";r.exports=function(e,r,t,n){var s,o,i,a,c,l,u,p=!1,h=e.bMarks[r]+e.tShift[r],f=e.eMarks[r];if(e.sCount[r]-e.blkIndent>=4)return!1;if(h+3>f)return!1;if(126!==(s=e.src.charCodeAt(h))&&96!==s)return!1;if(c=h,h=e.skipChars(h,s),(o=h-c)<3)return!1;if(u=e.src.slice(c,h),(i=e.src.slice(h,f)).indexOf(String.fromCharCode(s))>=0)return!1;if(n)return!0;for(a=r;!(++a>=t)&&(h=c=e.bMarks[a]+e.tShift[a],f=e.eMarks[a],!(h<f&&e.sCount[a]<e.blkIndent));)if(e.src.charCodeAt(h)===s&&!(e.sCount[a]-e.blkIndent>=4||(h=e.skipChars(h,s))-c<o||(h=e.skipSpaces(h))<f)){p=!0;break}return o=e.sCount[r],e.line=a+(p?1:0),l=e.push("fence","code",0),l.info=i,l.content=e.getLines(r+1,a,o,!0),l.markup=u,l.map=[r,e.line],!0}},{}],21:[function(e,r,t){"use strict";var n=e("../common/utils").isSpace;r.exports=function(e,r,t,s){var o,i,a,c,l=e.bMarks[r]+e.tShift[r],u=e.eMarks[r];if(e.sCount[r]-e.blkIndent>=4)return!1;if(35!==(o=e.src.charCodeAt(l))||l>=u)return!1;for(i=1,o=e.src.charCodeAt(++l);35===o&&l<u&&i<=6;)i++,o=e.src.charCodeAt(++l);return!(i>6||l<u&&!n(o))&&(!!s||(u=e.skipSpacesBack(u,l),(a=e.skipCharsBack(u,35,l))>l&&n(e.src.charCodeAt(a-1))&&(u=a),e.line=r+1,c=e.push("heading_open","h"+String(i),1),c.markup="########".slice(0,i),c.map=[r,e.line],c=e.push("inline","",0),c.content=e.src.slice(l,u).trim(),c.map=[r,e.line],c.children=[],c=e.push("heading_close","h"+String(i),-1),c.markup="########".slice(0,i),!0))}},{"../common/utils":4}],22:[function(e,r,t){"use strict";var n=e("../common/utils").isSpace;r.exports=function(e,r,t,s){var o,i,a,c,l=e.bMarks[r]+e.tShift[r],u=e.eMarks[r];if(e.sCount[r]-e.blkIndent>=4)return!1;if(42!==(o=e.src.charCodeAt(l++))&&45!==o&&95!==o)return!1;for(i=1;l<u;){if((a=e.src.charCodeAt(l++))!==o&&!n(a))return!1;a===o&&i++}return!(i<3)&&(!!s||(e.line=r+1,c=e.push("hr","hr",0),c.map=[r,e.line],c.markup=Array(i+1).join(String.fromCharCode(o)),!0))}},{"../common/utils":4}],23:[function(e,r,t){"use strict";var n=e("../common/html_blocks"),s=e("../common/html_re").HTML_OPEN_CLOSE_TAG_RE,o=[[/^<(script|pre|style)(?=(\s|>|$))/i,/<\/(script|pre|style)>/i,!0],[/^<!--/,/-->/,!0],[/^<\?/,/\?>/,!0],[/^<![A-Z]/,/>/,!0],[/^<!\[CDATA\[/,/\]\]>/,!0],[new RegExp("^</?("+n.join("|")+")(?=(\\s|/?>|$))","i"),/^$/,!0],[new RegExp(s.source+"\\s*$"),/^$/,!1]];r.exports=function(e,r,t,n){var s,i,a,c,l=e.bMarks[r]+e.tShift[r],u=e.eMarks[r];if(e.sCount[r]-e.blkIndent>=4)return!1;if(!e.md.options.html)return!1;if(60!==e.src.charCodeAt(l))return!1;for(c=e.src.slice(l,u),s=0;s<o.length&&!o[s][0].test(c);s++);if(s===o.length)return!1;if(n)return o[s][2];if(i=r+1,!o[s][1].test(c))for(;i<t&&!(e.sCount[i]<e.blkIndent);i++)if(l=e.bMarks[i]+e.tShift[i],u=e.eMarks[i],c=e.src.slice(l,u),o[s][1].test(c)){0!==c.length&&i++;break}return e.line=i,a=e.push("html_block","",0),a.map=[r,i],a.content=e.getLines(r,i,e.blkIndent,!0),!0}},{"../common/html_blocks":2,"../common/html_re":3}],24:[function(e,r,t){"use strict";r.exports=function(e,r,t){var n,s,o,i,a,c,l,u,p,h,f=r+1,d=e.md.block.ruler.getRules("paragraph");if(e.sCount[r]-e.blkIndent>=4)return!1;for(h=e.parentType,e.parentType="paragraph";f<t&&!e.isEmpty(f);f++)if(!(e.sCount[f]-e.blkIndent>3)){if(e.sCount[f]>=e.blkIndent&&(c=e.bMarks[f]+e.tShift[f],l=e.eMarks[f],c<l&&(45===(p=e.src.charCodeAt(c))||61===p)&&(c=e.skipChars(c,p),(c=e.skipSpaces(c))>=l))){u=61===p?1:2;break}if(!(e.sCount[f]<0)){for(s=!1,o=0,i=d.length;o<i;o++)if(d[o](e,f,t,!0)){s=!0;break}if(s)break}}return!!u&&(n=e.getLines(r,f,e.blkIndent,!1).trim(),e.line=f+1,a=e.push("heading_open","h"+String(u),1),a.markup=String.fromCharCode(p),a.map=[r,e.line],a=e.push("inline","",0),a.content=n,a.map=[r,e.line-1],a.children=[],a=e.push("heading_close","h"+String(u),-1),a.markup=String.fromCharCode(p),e.parentType=h,!0)}},{}],25:[function(e,r,t){"use strict";function n(e,r){var t,n,s,o;return n=e.bMarks[r]+e.tShift[r],s=e.eMarks[r],42!==(t=e.src.charCodeAt(n++))&&45!==t&&43!==t?-1:n<s&&(o=e.src.charCodeAt(n),!i(o))?-1:n}function s(e,r){var t,n=e.bMarks[r]+e.tShift[r],s=n,o=e.eMarks[r];if(s+1>=o)return-1;if((t=e.src.charCodeAt(s++))<48||t>57)return-1;for(;;){if(s>=o)return-1;if(!((t=e.src.charCodeAt(s++))>=48&&t<=57)){if(41===t||46===t)break;return-1}if(s-n>=10)return-1}return s<o&&(t=e.src.charCodeAt(s),!i(t))?-1:s}function o(e,r){var t,n,s=e.level+2;for(t=r+2,n=e.tokens.length-2;t<n;t++)e.tokens[t].level===s&&"paragraph_open"===e.tokens[t].type&&(e.tokens[t+2].hidden=!0,e.tokens[t].hidden=!0,t+=2)}var i=e("../common/utils").isSpace;r.exports=function(e,r,t,i){var a,c,l,u,p,h,f,d,m,_,g,b,k,v,x,y,C,A,w,D,q,E,S,F,L,z,T,I,R=!1,M=!0;if(e.sCount[r]-e.blkIndent>=4)return!1;if(i&&"paragraph"===e.parentType&&e.tShift[r]>=e.blkIndent&&(R=!0),(S=s(e,r))>=0){if(f=!0,L=e.bMarks[r]+e.tShift[r],k=Number(e.src.substr(L,S-L-1)),R&&1!==k)return!1}else{if(!((S=n(e,r))>=0))return!1;f=!1}if(R&&e.skipSpaces(S)>=e.eMarks[r])return!1;if(b=e.src.charCodeAt(S-1),i)return!0;for(g=e.tokens.length,f?(I=e.push("ordered_list_open","ol",1),1!==k&&(I.attrs=[["start",k]])):I=e.push("bullet_list_open","ul",1),I.map=_=[r,0],I.markup=String.fromCharCode(b),x=r,F=!1,T=e.md.block.ruler.getRules("list"),w=e.parentType,e.parentType="list";x<t;){for(E=S,v=e.eMarks[x],h=y=e.sCount[x]+S-(e.bMarks[r]+e.tShift[r]);E<v;){if(9===(a=e.src.charCodeAt(E)))y+=4-(y+e.bsCount[x])%4;else{if(32!==a)break;y++}E++}if(c=E,(p=c>=v?1:y-h)>4&&(p=1),u=h+p,I=e.push("list_item_open","li",1),I.markup=String.fromCharCode(b),I.map=d=[r,0],C=e.blkIndent,q=e.tight,D=e.tShift[r],A=e.sCount[r],e.blkIndent=u,e.tight=!0,e.tShift[r]=c-e.bMarks[r],e.sCount[r]=y,c>=v&&e.isEmpty(r+1)?e.line=Math.min(e.line+2,t):e.md.block.tokenize(e,r,t,!0),e.tight&&!F||(M=!1),F=e.line-r>1&&e.isEmpty(e.line-1),e.blkIndent=C,e.tShift[r]=D,e.sCount[r]=A,e.tight=q,I=e.push("list_item_close","li",-1),I.markup=String.fromCharCode(b),x=r=e.line,d[1]=x,c=e.bMarks[r],x>=t)break;if(e.sCount[x]<e.blkIndent)break;for(z=!1,l=0,m=T.length;l<m;l++)if(T[l](e,x,t,!0)){z=!0;break}if(z)break;if(f){if((S=s(e,x))<0)break}else if((S=n(e,x))<0)break;if(b!==e.src.charCodeAt(S-1))break}return I=f?e.push("ordered_list_close","ol",-1):e.push("bullet_list_close","ul",-1),I.markup=String.fromCharCode(b),_[1]=x,e.line=x,e.parentType=w,M&&o(e,g),!0}},{"../common/utils":4}],26:[function(e,r,t){"use strict";r.exports=function(e,r){var t,n,s,o,i,a,c=r+1,l=e.md.block.ruler.getRules("paragraph"),u=e.lineMax;for(a=e.parentType,e.parentType="paragraph";c<u&&!e.isEmpty(c);c++)if(!(e.sCount[c]-e.blkIndent>3||e.sCount[c]<0)){for(n=!1,s=0,o=l.length;s<o;s++)if(l[s](e,c,u,!0)){n=!0;break}if(n)break}return t=e.getLines(r,c,e.blkIndent,!1).trim(),e.line=c,i=e.push("paragraph_open","p",1),i.map=[r,e.line],i=e.push("inline","",0),i.content=t,i.map=[r,e.line],i.children=[],i=e.push("paragraph_close","p",-1),e.parentType=a,!0}},{}],27:[function(e,r,t){"use strict";var n=e("../common/utils").normalizeReference,s=e("../common/utils").isSpace;r.exports=function(e,r,t,o){var i,a,c,l,u,p,h,f,d,m,_,g,b,k,v,x,y=0,C=e.bMarks[r]+e.tShift[r],A=e.eMarks[r],w=r+1;if(e.sCount[r]-e.blkIndent>=4)return!1;if(91!==e.src.charCodeAt(C))return!1;for(;++C<A;)if(93===e.src.charCodeAt(C)&&92!==e.src.charCodeAt(C-1)){if(C+1===A)return!1;if(58!==e.src.charCodeAt(C+1))return!1;break}for(l=e.lineMax,v=e.md.block.ruler.getRules("reference"),m=e.parentType,e.parentType="reference";w<l&&!e.isEmpty(w);w++)if(!(e.sCount[w]-e.blkIndent>3||e.sCount[w]<0)){for(k=!1,p=0,h=v.length;p<h;p++)if(v[p](e,w,l,!0)){k=!0;break}if(k)break}for(A=(b=e.getLines(r,w,e.blkIndent,!1).trim()).length,C=1;C<A;C++){if(91===(i=b.charCodeAt(C)))return!1;if(93===i){d=C;break}10===i?y++:92===i&&++C<A&&10===b.charCodeAt(C)&&y++}if(d<0||58!==b.charCodeAt(d+1))return!1;for(C=d+2;C<A;C++)if(10===(i=b.charCodeAt(C)))y++;else if(!s(i))break;if(!(_=e.md.helpers.parseLinkDestination(b,C,A)).ok)return!1;if(u=e.md.normalizeLink(_.str),!e.md.validateLink(u))return!1;for(a=C=_.pos,c=y+=_.lines,g=C;C<A;C++)if(10===(i=b.charCodeAt(C)))y++;else if(!s(i))break;for(_=e.md.helpers.parseLinkTitle(b,C,A),C<A&&g!==C&&_.ok?(x=_.str,C=_.pos,y+=_.lines):(x="",C=a,y=c);C<A&&(i=b.charCodeAt(C),s(i));)C++;if(C<A&&10!==b.charCodeAt(C)&&x)for(x="",C=a,y=c;C<A&&(i=b.charCodeAt(C),s(i));)C++;return!(C<A&&10!==b.charCodeAt(C))&&(!!(f=n(b.slice(1,d)))&&(!!o||(void 0===e.env.references&&(e.env.references={}),void 0===e.env.references[f]&&(e.env.references[f]={title:x,href:u}),e.parentType=m,e.line=r+y+1,!0)))}},{"../common/utils":4}],28:[function(e,r,t){"use strict";function n(e,r,t,n){var s,i,a,c,l,u,p,h;for(this.src=e,this.md=r,this.env=t,this.tokens=n,this.bMarks=[],this.eMarks=[],this.tShift=[],this.sCount=[],this.bsCount=[],this.blkIndent=0,this.line=0,this.lineMax=0,this.tight=!1,this.ddIndent=-1,this.parentType="root",this.level=0,this.result="",h=!1,a=c=u=p=0,l=(i=this.src).length;c<l;c++){if(s=i.charCodeAt(c),!h){if(o(s)){u++,9===s?p+=4-p%4:p++;continue}h=!0}10!==s&&c!==l-1||(10!==s&&c++,this.bMarks.push(a),this.eMarks.push(c),this.tShift.push(u),this.sCount.push(p),this.bsCount.push(0),h=!1,u=0,p=0,a=c+1)}this.bMarks.push(i.length),this.eMarks.push(i.length),this.tShift.push(0),this.sCount.push(0),this.bsCount.push(0),this.lineMax=this.bMarks.length-1}var s=e("../token"),o=e("../common/utils").isSpace;n.prototype.push=function(e,r,t){var n=new s(e,r,t);return n.block=!0,t<0&&this.level--,n.level=this.level,t>0&&this.level++,this.tokens.push(n),n},n.prototype.isEmpty=function(e){return this.bMarks[e]+this.tShift[e]>=this.eMarks[e]},n.prototype.skipEmptyLines=function(e){for(var r=this.lineMax;e<r&&!(this.bMarks[e]+this.tShift[e]<this.eMarks[e]);e++);return e},n.prototype.skipSpaces=function(e){for(var r,t=this.src.length;e<t&&(r=this.src.charCodeAt(e),o(r));e++);return e},n.prototype.skipSpacesBack=function(e,r){if(e<=r)return e;for(;e>r;)if(!o(this.src.charCodeAt(--e)))return e+1;return e},n.prototype.skipChars=function(e,r){for(var t=this.src.length;e<t&&this.src.charCodeAt(e)===r;e++);return e},n.prototype.skipCharsBack=function(e,r,t){if(e<=t)return e;for(;e>t;)if(r!==this.src.charCodeAt(--e))return e+1;return e},n.prototype.getLines=function(e,r,t,n){var s,i,a,c,l,u,p,h=e;if(e>=r)return"";for(u=new Array(r-e),s=0;h<r;h++,s++){for(i=0,p=c=this.bMarks[h],l=h+1<r||n?this.eMarks[h]+1:this.eMarks[h];c<l&&i<t;){if(a=this.src.charCodeAt(c),o(a))9===a?i+=4-(i+this.bsCount[h])%4:i++;else{if(!(c-p<this.tShift[h]))break;i++}c++}u[s]=i>t?new Array(i-t+1).join(" ")+this.src.slice(c,l):this.src.slice(c,l)}return u.join("")},n.prototype.Token=s,r.exports=n},{"../common/utils":4,"../token":51}],29:[function(e,r,t){"use strict";function n(e,r){var t=e.bMarks[r]+e.blkIndent,n=e.eMarks[r];return e.src.substr(t,n-t)}function s(e){var r,t=[],n=0,s=e.length,o=0,i=0,a=!1,c=0;for(r=e.charCodeAt(n);n<s;)96===r?a?(a=!1,c=n):o%2==0&&(a=!0,c=n):124!==r||o%2!=0||a||(t.push(e.substring(i,n)),i=n+1),92===r?o++:o=0,++n===s&&a&&(a=!1,n=c+1),r=e.charCodeAt(n);return t.push(e.substring(i)),t}var o=e("../common/utils").isSpace;r.exports=function(e,r,t,i){var a,c,l,u,p,h,f,d,m,_,g,b;if(r+2>t)return!1;if(p=r+1,e.sCount[p]<e.blkIndent)return!1;if(e.sCount[p]-e.blkIndent>=4)return!1;if((l=e.bMarks[p]+e.tShift[p])>=e.eMarks[p])return!1;if(124!==(a=e.src.charCodeAt(l++))&&45!==a&&58!==a)return!1;for(;l<e.eMarks[p];){if(124!==(a=e.src.charCodeAt(l))&&45!==a&&58!==a&&!o(a))return!1;l++}for(h=(c=n(e,r+1)).split("|"),m=[],u=0;u<h.length;u++){if(!(_=h[u].trim())){if(0===u||u===h.length-1)continue;return!1}if(!/^:?-+:?$/.test(_))return!1;58===_.charCodeAt(_.length-1)?m.push(58===_.charCodeAt(0)?"center":"right"):58===_.charCodeAt(0)?m.push("left"):m.push("")}if(-1===(c=n(e,r).trim()).indexOf("|"))return!1;if(e.sCount[r]-e.blkIndent>=4)return!1;if(h=s(c.replace(/^\||\|$/g,"")),(f=h.length)>m.length)return!1;if(i)return!0;for((d=e.push("table_open","table",1)).map=g=[r,0],(d=e.push("thead_open","thead",1)).map=[r,r+1],(d=e.push("tr_open","tr",1)).map=[r,r+1],u=0;u<h.length;u++)(d=e.push("th_open","th",1)).map=[r,r+1],m[u]&&(d.attrs=[["style","text-align:"+m[u]]]),(d=e.push("inline","",0)).content=h[u].trim(),d.map=[r,r+1],d.children=[],d=e.push("th_close","th",-1);for(d=e.push("tr_close","tr",-1),d=e.push("thead_close","thead",-1),(d=e.push("tbody_open","tbody",1)).map=b=[r+2,0],p=r+2;p<t&&!(e.sCount[p]<e.blkIndent)&&-1!==(c=n(e,p).trim()).indexOf("|")&&!(e.sCount[p]-e.blkIndent>=4);p++){for(h=s(c.replace(/^\||\|$/g,"")),d=e.push("tr_open","tr",1),u=0;u<f;u++)d=e.push("td_open","td",1),m[u]&&(d.attrs=[["style","text-align:"+m[u]]]),(d=e.push("inline","",0)).content=h[u]?h[u].trim():"",d.children=[],d=e.push("td_close","td",-1);d=e.push("tr_close","tr",-1)}return d=e.push("tbody_close","tbody",-1),d=e.push("table_close","table",-1),g[1]=b[1]=p,e.line=p,!0}},{"../common/utils":4}],30:[function(e,r,t){"use strict";r.exports=function(e){var r;e.inlineMode?((r=new e.Token("inline","",0)).content=e.src,r.map=[0,1],r.children=[],e.tokens.push(r)):e.md.block.parse(e.src,e.md,e.env,e.tokens)}},{}],31:[function(e,r,t){"use strict";r.exports=function(e){var r,t,n,s=e.tokens;for(t=0,n=s.length;t<n;t++)"inline"===(r=s[t]).type&&e.md.inline.parse(r.content,e.md,e.env,r.children)}},{}],32:[function(e,r,t){"use strict";function n(e){return/^<a[>\s]/i.test(e)}function s(e){return/^<\/a\s*>/i.test(e)}var o=e("../common/utils").arrayReplaceAt;r.exports=function(e){var r,t,i,a,c,l,u,p,h,f,d,m,_,g,b,k,v,x=e.tokens;if(e.md.options.linkify)for(t=0,i=x.length;t<i;t++)if("inline"===x[t].type&&e.md.linkify.pretest(x[t].content))for(_=0,r=(a=x[t].children).length-1;r>=0;r--)if("link_close"!==(l=a[r]).type){if("html_inline"===l.type&&(n(l.content)&&_>0&&_--,s(l.content)&&_++),!(_>0)&&"text"===l.type&&e.md.linkify.test(l.content)){for(h=l.content,v=e.md.linkify.match(h),u=[],m=l.level,d=0,p=0;p<v.length;p++)g=v[p].url,b=e.md.normalizeLink(g),e.md.validateLink(b)&&(k=v[p].text,k=v[p].schema?"mailto:"!==v[p].schema||/^mailto:/i.test(k)?e.md.normalizeLinkText(k):e.md.normalizeLinkText("mailto:"+k).replace(/^mailto:/,""):e.md.normalizeLinkText("http://"+k).replace(/^http:\/\//,""),(f=v[p].index)>d&&((c=new e.Token("text","",0)).content=h.slice(d,f),c.level=m,u.push(c)),(c=new e.Token("link_open","a",1)).attrs=[["href",b]],c.level=m++,c.markup="linkify",c.info="auto",u.push(c),(c=new e.Token("text","",0)).content=k,c.level=m,u.push(c),(c=new e.Token("link_close","a",-1)).level=--m,c.markup="linkify",c.info="auto",u.push(c),d=v[p].lastIndex);d<h.length&&((c=new e.Token("text","",0)).content=h.slice(d),c.level=m,u.push(c)),x[t].children=a=o(a,r,u)}}else for(r--;a[r].level!==l.level&&"link_open"!==a[r].type;)r--}},{"../common/utils":4}],33:[function(e,r,t){"use strict";var n=/\r[\n\u0085]?|[\u2424\u2028\u0085]/g,s=/\u0000/g;r.exports=function(e){var r;r=(r=e.src.replace(n,"\n")).replace(s,"\ufffd"),e.src=r}},{}],34:[function(e,r,t){"use strict";function n(e,r){return l[r.toLowerCase()]}function s(e){var r,t,s=0;for(r=e.length-1;r>=0;r--)"text"!==(t=e[r]).type||s||(t.content=t.content.replace(c,n)),"link_open"===t.type&&"auto"===t.info&&s--,"link_close"===t.type&&"auto"===t.info&&s++}function o(e){var r,t,n=0;for(r=e.length-1;r>=0;r--)"text"!==(t=e[r]).type||n||i.test(t.content)&&(t.content=t.content.replace(/\+-/g,"\xb1").replace(/\.{2,}/g,"\u2026").replace(/([?!])\u2026/g,"$1..").replace(/([?!]){4,}/g,"$1$1$1").replace(/,{2,}/g,",").replace(/(^|[^-])---([^-]|$)/gm,"$1\u2014$2").replace(/(^|\s)--(\s|$)/gm,"$1\u2013$2").replace(/(^|[^-\s])--([^-\s]|$)/gm,"$1\u2013$2")),"link_open"===t.type&&"auto"===t.info&&n--,"link_close"===t.type&&"auto"===t.info&&n++}var i=/\+-|\.\.|\?\?\?\?|!!!!|,,|--/,a=/\((c|tm|r|p)\)/i,c=/\((c|tm|r|p)\)/gi,l={c:"\xa9",r:"\xae",p:"\xa7",tm:"\u2122"};r.exports=function(e){var r;if(e.md.options.typographer)for(r=e.tokens.length-1;r>=0;r--)"inline"===e.tokens[r].type&&(a.test(e.tokens[r].content)&&s(e.tokens[r].children),i.test(e.tokens[r].content)&&o(e.tokens[r].children))}},{}],35:[function(e,r,t){"use strict";function n(e,r,t){return e.substr(0,r)+t+e.substr(r+1)}function s(e,r){var t,s,c,p,h,f,d,m,_,g,b,k,v,x,y,C,A,w,D,q,E;for(D=[],t=0;t<e.length;t++){for(s=e[t],d=e[t].level,A=D.length-1;A>=0&&!(D[A].level<=d);A--);if(D.length=A+1,"text"===s.type){h=0,f=(c=s.content).length;e:for(;h<f&&(l.lastIndex=h,p=l.exec(c));){if(y=C=!0,h=p.index+1,w="'"===p[0],_=32,p.index-1>=0)_=c.charCodeAt(p.index-1);else for(A=t-1;A>=0;A--)if("text"===e[A].type){_=e[A].content.charCodeAt(e[A].content.length-1);break}if(g=32,h<f)g=c.charCodeAt(h);else for(A=t+1;A<e.length;A++)if("text"===e[A].type){g=e[A].content.charCodeAt(0);break}if(b=a(_)||i(String.fromCharCode(_)),k=a(g)||i(String.fromCharCode(g)),v=o(_),(x=o(g))?y=!1:k&&(v||b||(y=!1)),v?C=!1:b&&(x||k||(C=!1)),34===g&&'"'===p[0]&&_>=48&&_<=57&&(C=y=!1),y&&C&&(y=!1,C=k),y||C){if(C)for(A=D.length-1;A>=0&&(m=D[A],!(D[A].level<d));A--)if(m.single===w&&D[A].level===d){m=D[A],w?(q=r.md.options.quotes[2],E=r.md.options.quotes[3]):(q=r.md.options.quotes[0],E=r.md.options.quotes[1]),s.content=n(s.content,p.index,E),e[m.token].content=n(e[m.token].content,m.pos,q),h+=E.length-1,m.token===t&&(h+=q.length-1),f=(c=s.content).length,D.length=A;continue e}y?D.push({token:t,pos:p.index,single:w,level:d}):C&&w&&(s.content=n(s.content,p.index,u))}else w&&(s.content=n(s.content,p.index,u))}}}}var o=e("../common/utils").isWhiteSpace,i=e("../common/utils").isPunctChar,a=e("../common/utils").isMdAsciiPunct,c=/['"]/,l=/['"]/g,u="\u2019";r.exports=function(e){var r;if(e.md.options.typographer)for(r=e.tokens.length-1;r>=0;r--)"inline"===e.tokens[r].type&&c.test(e.tokens[r].content)&&s(e.tokens[r].children,e)}},{"../common/utils":4}],36:[function(e,r,t){"use strict";function n(e,r,t){this.src=e,this.env=t,this.tokens=[],this.inlineMode=!1,this.md=r}var s=e("../token");n.prototype.Token=s,r.exports=n},{"../token":51}],37:[function(e,r,t){"use strict";var n=/^<([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])?)*)>/,s=/^<([a-zA-Z][a-zA-Z0-9+.\-]{1,31}):([^<>\x00-\x20]*)>/;r.exports=function(e,r){var t,o,i,a,c,l,u=e.pos;return 60===e.src.charCodeAt(u)&&!((t=e.src.slice(u)).indexOf(">")<0||(s.test(t)?(o=t.match(s),a=o[0].slice(1,-1),c=e.md.normalizeLink(a),!e.md.validateLink(c)||(r||((l=e.push("link_open","a",1)).attrs=[["href",c]],l.markup="autolink",l.info="auto",(l=e.push("text","",0)).content=e.md.normalizeLinkText(a),(l=e.push("link_close","a",-1)).markup="autolink",l.info="auto"),e.pos+=o[0].length,0)):!n.test(t)||(i=t.match(n),a=i[0].slice(1,-1),c=e.md.normalizeLink("mailto:"+a),!e.md.validateLink(c)||(r||((l=e.push("link_open","a",1)).attrs=[["href",c]],l.markup="autolink",l.info="auto",(l=e.push("text","",0)).content=e.md.normalizeLinkText(a),(l=e.push("link_close","a",-1)).markup="autolink",l.info="auto"),e.pos+=i[0].length,0))))}},{}],38:[function(e,r,t){"use strict";r.exports=function(e,r){var t,n,s,o,i,a,c=e.pos;if(96!==e.src.charCodeAt(c))return!1;for(t=c,c++,n=e.posMax;c<n&&96===e.src.charCodeAt(c);)c++;for(s=e.src.slice(t,c),o=i=c;-1!==(o=e.src.indexOf("`",i));){for(i=o+1;i<n&&96===e.src.charCodeAt(i);)i++;if(i-o===s.length)return r||((a=e.push("code_inline","code",0)).markup=s,a.content=e.src.slice(c,o).replace(/[ \n]+/g," ").trim()),e.pos=i,!0}return r||(e.pending+=s),e.pos+=s.length,!0}},{}],39:[function(e,r,t){"use strict";r.exports=function(e){var r,t,n,s,o=e.delimiters,i=e.delimiters.length;for(r=0;r<i;r++)if((n=o[r]).close)for(t=r-n.jump-1;t>=0;){if((s=o[t]).open&&s.marker===n.marker&&s.end<0&&s.level===n.level&&!((s.close||n.open)&&void 0!==s.length&&void 0!==n.length&&(s.length+n.length)%3==0)){n.jump=r-t,n.open=!1,s.end=r,s.jump=0;break}t-=s.jump+1}}},{}],40:[function(e,r,t){"use strict";r.exports.tokenize=function(e,r){var t,n,s=e.pos,o=e.src.charCodeAt(s);if(r)return!1;if(95!==o&&42!==o)return!1;for(n=e.scanDelims(e.pos,42===o),t=0;t<n.length;t++)e.push("text","",0).content=String.fromCharCode(o),e.delimiters.push({marker:o,length:n.length,jump:t,token:e.tokens.length-1,level:e.level,end:-1,open:n.can_open,close:n.can_close});return e.pos+=n.length,!0},r.exports.postProcess=function(e){var r,t,n,s,o,i,a=e.delimiters;for(r=e.delimiters.length-1;r>=0;r--)95!==(t=a[r]).marker&&42!==t.marker||-1!==t.end&&(n=a[t.end],i=r>0&&a[r-1].end===t.end+1&&a[r-1].token===t.token-1&&a[t.end+1].token===n.token+1&&a[r-1].marker===t.marker,o=String.fromCharCode(t.marker),(s=e.tokens[t.token]).type=i?"strong_open":"em_open",s.tag=i?"strong":"em",s.nesting=1,s.markup=i?o+o:o,s.content="",(s=e.tokens[n.token]).type=i?"strong_close":"em_close",s.tag=i?"strong":"em",s.nesting=-1,s.markup=i?o+o:o,s.content="",i&&(e.tokens[a[r-1].token].content="",e.tokens[a[t.end+1].token].content="",r--))}},{}],41:[function(e,r,t){"use strict";var n=e("../common/entities"),s=e("../common/utils").has,o=e("../common/utils").isValidEntityCode,i=e("../common/utils").fromCodePoint,a=/^&#((?:x[a-f0-9]{1,8}|[0-9]{1,8}));/i,c=/^&([a-z][a-z0-9]{1,31});/i;r.exports=function(e,r){var t,l,u=e.pos,p=e.posMax;if(38!==e.src.charCodeAt(u))return!1;if(u+1<p)if(35===e.src.charCodeAt(u+1)){if(l=e.src.slice(u).match(a))return r||(t="x"===l[1][0].toLowerCase()?parseInt(l[1].slice(1),16):parseInt(l[1],10),e.pending+=i(o(t)?t:65533)),e.pos+=l[0].length,!0}else if((l=e.src.slice(u).match(c))&&s(n,l[1]))return r||(e.pending+=n[l[1]]),e.pos+=l[0].length,!0;return r||(e.pending+="&"),e.pos++,!0}},{"../common/entities":1,"../common/utils":4}],42:[function(e,r,t){"use strict";for(var n=e("../common/utils").isSpace,s=[],o=0;o<256;o++)s.push(0);"\\!\"#$%&'()*+,./:;<=>?@[]^_`{|}~-".split("").forEach(function(e){s[e.charCodeAt(0)]=1}),r.exports=function(e,r){var t,o=e.pos,i=e.posMax;if(92!==e.src.charCodeAt(o))return!1;if(++o<i){if((t=e.src.charCodeAt(o))<256&&0!==s[t])return r||(e.pending+=e.src[o]),e.pos+=2,!0;if(10===t){for(r||e.push("hardbreak","br",0),o++;o<i&&(t=e.src.charCodeAt(o),n(t));)o++;return e.pos=o,!0}}return r||(e.pending+="\\"),e.pos++,!0}},{"../common/utils":4}],43:[function(e,r,t){"use strict";function n(e){var r=32|e;return r>=97&&r<=122}var s=e("../common/html_re").HTML_TAG_RE;r.exports=function(e,r){var t,o,i,a=e.pos;return!!e.md.options.html&&(i=e.posMax,!(60!==e.src.charCodeAt(a)||a+2>=i)&&(!(33!==(t=e.src.charCodeAt(a+1))&&63!==t&&47!==t&&!n(t))&&(!!(o=e.src.slice(a).match(s))&&(r||(e.push("html_inline","",0).content=e.src.slice(a,a+o[0].length)),e.pos+=o[0].length,!0))))}},{"../common/html_re":3}],44:[function(e,r,t){"use strict";var n=e("../common/utils").normalizeReference,s=e("../common/utils").isSpace;r.exports=function(e,r){var t,o,i,a,c,l,u,p,h,f,d,m,_,g="",b=e.pos,k=e.posMax;if(33!==e.src.charCodeAt(e.pos))return!1;if(91!==e.src.charCodeAt(e.pos+1))return!1;if(l=e.pos+2,(c=e.md.helpers.parseLinkLabel(e,e.pos+1,!1))<0)return!1;if((u=c+1)<k&&40===e.src.charCodeAt(u)){for(u++;u<k&&(o=e.src.charCodeAt(u),s(o)||10===o);u++);if(u>=k)return!1;for(_=u,(h=e.md.helpers.parseLinkDestination(e.src,u,e.posMax)).ok&&(g=e.md.normalizeLink(h.str),e.md.validateLink(g)?u=h.pos:g=""),_=u;u<k&&(o=e.src.charCodeAt(u),s(o)||10===o);u++);if(h=e.md.helpers.parseLinkTitle(e.src,u,e.posMax),u<k&&_!==u&&h.ok)for(f=h.str,u=h.pos;u<k&&(o=e.src.charCodeAt(u),s(o)||10===o);u++);else f="";if(u>=k||41!==e.src.charCodeAt(u))return e.pos=b,!1;u++}else{if(void 0===e.env.references)return!1;if(u<k&&91===e.src.charCodeAt(u)?(_=u+1,(u=e.md.helpers.parseLinkLabel(e,u))>=0?a=e.src.slice(_,u++):u=c+1):u=c+1,a||(a=e.src.slice(l,c)),!(p=e.env.references[n(a)]))return e.pos=b,!1;g=p.href,f=p.title}return r||(i=e.src.slice(l,c),e.md.inline.parse(i,e.md,e.env,m=[]),(d=e.push("image","img",0)).attrs=t=[["src",g],["alt",""]],d.children=m,d.content=i,f&&t.push(["title",f])),e.pos=u,e.posMax=k,!0}},{"../common/utils":4}],45:[function(e,r,t){"use strict";var n=e("../common/utils").normalizeReference,s=e("../common/utils").isSpace;r.exports=function(e,r){var t,o,i,a,c,l,u,p,h,f="",d=e.pos,m=e.posMax,_=e.pos,g=!0;if(91!==e.src.charCodeAt(e.pos))return!1;if(c=e.pos+1,(a=e.md.helpers.parseLinkLabel(e,e.pos,!0))<0)return!1;if((l=a+1)<m&&40===e.src.charCodeAt(l)){for(g=!1,l++;l<m&&(o=e.src.charCodeAt(l),s(o)||10===o);l++);if(l>=m)return!1;for(_=l,(u=e.md.helpers.parseLinkDestination(e.src,l,e.posMax)).ok&&(f=e.md.normalizeLink(u.str),e.md.validateLink(f)?l=u.pos:f=""),_=l;l<m&&(o=e.src.charCodeAt(l),s(o)||10===o);l++);if(u=e.md.helpers.parseLinkTitle(e.src,l,e.posMax),l<m&&_!==l&&u.ok)for(h=u.str,l=u.pos;l<m&&(o=e.src.charCodeAt(l),s(o)||10===o);l++);else h="";(l>=m||41!==e.src.charCodeAt(l))&&(g=!0),l++}if(g){if(void 0===e.env.references)return!1;if(l<m&&91===e.src.charCodeAt(l)?(_=l+1,(l=e.md.helpers.parseLinkLabel(e,l))>=0?i=e.src.slice(_,l++):l=a+1):l=a+1,i||(i=e.src.slice(c,a)),!(p=e.env.references[n(i)]))return e.pos=d,!1;f=p.href,h=p.title}return r||(e.pos=c,e.posMax=a,e.push("link_open","a",1).attrs=t=[["href",f]],h&&t.push(["title",h]),e.md.inline.tokenize(e),e.push("link_close","a",-1)),e.pos=l,e.posMax=m,!0}},{"../common/utils":4}],46:[function(e,r,t){"use strict";var n=e("../common/utils").isSpace;r.exports=function(e,r){var t,s,o=e.pos;if(10!==e.src.charCodeAt(o))return!1;for(t=e.pending.length-1,s=e.posMax,r||(t>=0&&32===e.pending.charCodeAt(t)?t>=1&&32===e.pending.charCodeAt(t-1)?(e.pending=e.pending.replace(/ +$/,""),e.push("hardbreak","br",0)):(e.pending=e.pending.slice(0,-1),e.push("softbreak","br",0)):e.push("softbreak","br",0)),o++;o<s&&n(e.src.charCodeAt(o));)o++;return e.pos=o,!0}},{"../common/utils":4}],47:[function(e,r,t){"use strict";function n(e,r,t,n){this.src=e,this.env=t,this.md=r,this.tokens=n,this.pos=0,this.posMax=this.src.length,this.level=0,this.pending="",this.pendingLevel=0,this.cache={},this.delimiters=[]}var s=e("../token"),o=e("../common/utils").isWhiteSpace,i=e("../common/utils").isPunctChar,a=e("../common/utils").isMdAsciiPunct;n.prototype.pushPending=function(){var e=new s("text","",0);return e.content=this.pending,e.level=this.pendingLevel,this.tokens.push(e),this.pending="",e},n.prototype.push=function(e,r,t){this.pending&&this.pushPending();var n=new s(e,r,t);return t<0&&this.level--,n.level=this.level,t>0&&this.level++,this.pendingLevel=this.level,this.tokens.push(n),n},n.prototype.scanDelims=function(e,r){var t,n,s,c,l,u,p,h,f,d=e,m=!0,_=!0,g=this.posMax,b=this.src.charCodeAt(e);for(t=e>0?this.src.charCodeAt(e-1):32;d<g&&this.src.charCodeAt(d)===b;)d++;return s=d-e,n=d<g?this.src.charCodeAt(d):32,p=a(t)||i(String.fromCharCode(t)),f=a(n)||i(String.fromCharCode(n)),u=o(t),(h=o(n))?m=!1:f&&(u||p||(m=!1)),u?_=!1:p&&(h||f||(_=!1)),r?(c=m,l=_):(c=m&&(!_||p),l=_&&(!m||f)),{can_open:c,can_close:l,length:s}},n.prototype.Token=s,r.exports=n},{"../common/utils":4,"../token":51}],48:[function(e,r,t){"use strict";r.exports.tokenize=function(e,r){var t,n,s,o,i=e.pos,a=e.src.charCodeAt(i);if(r)return!1;if(126!==a)return!1;if(n=e.scanDelims(e.pos,!0),s=n.length,o=String.fromCharCode(a),s<2)return!1;for(s%2&&(e.push("text","",0).content=o,s--),t=0;t<s;t+=2)e.push("text","",0).content=o+o,e.delimiters.push({marker:a,jump:t,token:e.tokens.length-1,level:e.level,end:-1,open:n.can_open,close:n.can_close});return e.pos+=n.length,!0},r.exports.postProcess=function(e){var r,t,n,s,o,i=[],a=e.delimiters,c=e.delimiters.length;for(r=0;r<c;r++)126===(n=a[r]).marker&&-1!==n.end&&(s=a[n.end],(o=e.tokens[n.token]).type="s_open",o.tag="s",o.nesting=1,o.markup="~~",o.content="",(o=e.tokens[s.token]).type="s_close",o.tag="s",o.nesting=-1,o.markup="~~",o.content="","text"===e.tokens[s.token-1].type&&"~"===e.tokens[s.token-1].content&&i.push(s.token-1));for(;i.length;){for(t=(r=i.pop())+1;t<e.tokens.length&&"s_close"===e.tokens[t].type;)t++;r!==--t&&(o=e.tokens[t],e.tokens[t]=e.tokens[r],e.tokens[r]=o)}}},{}],49:[function(e,r,t){"use strict";function n(e){switch(e){case 10:case 33:case 35:case 36:case 37:case 38:case 42:case 43:case 45:case 58:case 60:case 61:case 62:case 64:case 91:case 92:case 93:case 94:case 95:case 96:case 123:case 125:case 126:return!0;default:return!1}}r.exports=function(e,r){for(var t=e.pos;t<e.posMax&&!n(e.src.charCodeAt(t));)t++;return t!==e.pos&&(r||(e.pending+=e.src.slice(e.pos,t)),e.pos=t,!0)}},{}],50:[function(e,r,t){"use strict";r.exports=function(e){var r,t,n=0,s=e.tokens,o=e.tokens.length;for(r=t=0;r<o;r++)n+=s[r].nesting,s[r].level=n,"text"===s[r].type&&r+1<o&&"text"===s[r+1].type?s[r+1].content=s[r].content+s[r+1].content:(r!==t&&(s[t]=s[r]),t++);r!==t&&(s.length=t)}},{}],51:[function(e,r,t){"use strict";function n(e,r,t){this.type=e,this.tag=r,this.attrs=null,this.map=null,this.nesting=t,this.level=0,this.children=null,this.content="",this.markup="",this.info="",this.meta=null,this.block=!1,this.hidden=!1}n.prototype.attrIndex=function(e){var r,t,n;if(!this.attrs)return-1;for(t=0,n=(r=this.attrs).length;t<n;t++)if(r[t][0]===e)return t;return-1},n.prototype.attrPush=function(e){this.attrs?this.attrs.push(e):this.attrs=[e]},n.prototype.attrSet=function(e,r){var t=this.attrIndex(e),n=[e,r];t<0?this.attrPush(n):this.attrs[t]=n},n.prototype.attrGet=function(e){var r=this.attrIndex(e),t=null;return r>=0&&(t=this.attrs[r][1]),t},n.prototype.attrJoin=function(e,r){var t=this.attrIndex(e);t<0?this.attrPush([e,r]):this.attrs[t][1]=this.attrs[t][1]+" "+r},r.exports=n},{}],52:[function(e,r,t){r.exports={Aacute:"\xc1",aacute:"\xe1",Abreve:"\u0102",abreve:"\u0103",ac:"\u223e",acd:"\u223f",acE:"\u223e\u0333",Acirc:"\xc2",acirc:"\xe2",acute:"\xb4",Acy:"\u0410",acy:"\u0430",AElig:"\xc6",aelig:"\xe6",af:"\u2061",Afr:"\ud835\udd04",afr:"\ud835\udd1e",Agrave:"\xc0",agrave:"\xe0",alefsym:"\u2135",aleph:"\u2135",Alpha:"\u0391",alpha:"\u03b1",Amacr:"\u0100",amacr:"\u0101",amalg:"\u2a3f",amp:"&",AMP:"&",andand:"\u2a55",And:"\u2a53",and:"\u2227",andd:"\u2a5c",andslope:"\u2a58",andv:"\u2a5a",ang:"\u2220",ange:"\u29a4",angle:"\u2220",angmsdaa:"\u29a8",angmsdab:"\u29a9",angmsdac:"\u29aa",angmsdad:"\u29ab",angmsdae:"\u29ac",angmsdaf:"\u29ad",angmsdag:"\u29ae",angmsdah:"\u29af",angmsd:"\u2221",angrt:"\u221f",angrtvb:"\u22be",angrtvbd:"\u299d",angsph:"\u2222",angst:"\xc5",angzarr:"\u237c",Aogon:"\u0104",aogon:"\u0105",Aopf:"\ud835\udd38",aopf:"\ud835\udd52",apacir:"\u2a6f",ap:"\u2248",apE:"\u2a70",ape:"\u224a",apid:"\u224b",apos:"'",ApplyFunction:"\u2061",approx:"\u2248",approxeq:"\u224a",Aring:"\xc5",aring:"\xe5",Ascr:"\ud835\udc9c",ascr:"\ud835\udcb6",Assign:"\u2254",ast:"*",asymp:"\u2248",asympeq:"\u224d",Atilde:"\xc3",atilde:"\xe3",Auml:"\xc4",auml:"\xe4",awconint:"\u2233",awint:"\u2a11",backcong:"\u224c",backepsilon:"\u03f6",backprime:"\u2035",backsim:"\u223d",backsimeq:"\u22cd",Backslash:"\u2216",Barv:"\u2ae7",barvee:"\u22bd",barwed:"\u2305",Barwed:"\u2306",barwedge:"\u2305",bbrk:"\u23b5",bbrktbrk:"\u23b6",bcong:"\u224c",Bcy:"\u0411",bcy:"\u0431",bdquo:"\u201e",becaus:"\u2235",because:"\u2235",Because:"\u2235",bemptyv:"\u29b0",bepsi:"\u03f6",bernou:"\u212c",Bernoullis:"\u212c",Beta:"\u0392",beta:"\u03b2",beth:"\u2136",between:"\u226c",Bfr:"\ud835\udd05",bfr:"\ud835\udd1f",bigcap:"\u22c2",bigcirc:"\u25ef",bigcup:"\u22c3",bigodot:"\u2a00",bigoplus:"\u2a01",bigotimes:"\u2a02",bigsqcup:"\u2a06",bigstar:"\u2605",bigtriangledown:"\u25bd",bigtriangleup:"\u25b3",biguplus:"\u2a04",bigvee:"\u22c1",bigwedge:"\u22c0",bkarow:"\u290d",blacklozenge:"\u29eb",blacksquare:"\u25aa",blacktriangle:"\u25b4",blacktriangledown:"\u25be",blacktriangleleft:"\u25c2",blacktriangleright:"\u25b8",blank:"\u2423",blk12:"\u2592",blk14:"\u2591",blk34:"\u2593",block:"\u2588",bne:"=\u20e5",bnequiv:"\u2261\u20e5",bNot:"\u2aed",bnot:"\u2310",Bopf:"\ud835\udd39",bopf:"\ud835\udd53",bot:"\u22a5",bottom:"\u22a5",bowtie:"\u22c8",boxbox:"\u29c9",boxdl:"\u2510",boxdL:"\u2555",boxDl:"\u2556",boxDL:"\u2557",boxdr:"\u250c",boxdR:"\u2552",boxDr:"\u2553",boxDR:"\u2554",boxh:"\u2500",boxH:"\u2550",boxhd:"\u252c",boxHd:"\u2564",boxhD:"\u2565",boxHD:"\u2566",boxhu:"\u2534",boxHu:"\u2567",boxhU:"\u2568",boxHU:"\u2569",boxminus:"\u229f",boxplus:"\u229e",boxtimes:"\u22a0",boxul:"\u2518",boxuL:"\u255b",boxUl:"\u255c",boxUL:"\u255d",boxur:"\u2514",boxuR:"\u2558",boxUr:"\u2559",boxUR:"\u255a",boxv:"\u2502",boxV:"\u2551",boxvh:"\u253c",boxvH:"\u256a",boxVh:"\u256b",boxVH:"\u256c",boxvl:"\u2524",boxvL:"\u2561",boxVl:"\u2562",boxVL:"\u2563",boxvr:"\u251c",boxvR:"\u255e",boxVr:"\u255f",boxVR:"\u2560",bprime:"\u2035",breve:"\u02d8",Breve:"\u02d8",brvbar:"\xa6",bscr:"\ud835\udcb7",Bscr:"\u212c",bsemi:"\u204f",bsim:"\u223d",bsime:"\u22cd",bsolb:"\u29c5",bsol:"\\",bsolhsub:"\u27c8",bull:"\u2022",bullet:"\u2022",bump:"\u224e",bumpE:"\u2aae",bumpe:"\u224f",Bumpeq:"\u224e",bumpeq:"\u224f",Cacute:"\u0106",cacute:"\u0107",capand:"\u2a44",capbrcup:"\u2a49",capcap:"\u2a4b",cap:"\u2229",Cap:"\u22d2",capcup:"\u2a47",capdot:"\u2a40",CapitalDifferentialD:"\u2145",caps:"\u2229\ufe00",caret:"\u2041",caron:"\u02c7",Cayleys:"\u212d",ccaps:"\u2a4d",Ccaron:"\u010c",ccaron:"\u010d",Ccedil:"\xc7",ccedil:"\xe7",Ccirc:"\u0108",ccirc:"\u0109",Cconint:"\u2230",ccups:"\u2a4c",ccupssm:"\u2a50",Cdot:"\u010a",cdot:"\u010b",cedil:"\xb8",Cedilla:"\xb8",cemptyv:"\u29b2",cent:"\xa2",centerdot:"\xb7",CenterDot:"\xb7",cfr:"\ud835\udd20",Cfr:"\u212d",CHcy:"\u0427",chcy:"\u0447",check:"\u2713",checkmark:"\u2713",Chi:"\u03a7",chi:"\u03c7",circ:"\u02c6",circeq:"\u2257",circlearrowleft:"\u21ba",circlearrowright:"\u21bb",circledast:"\u229b",circledcirc:"\u229a",circleddash:"\u229d",CircleDot:"\u2299",circledR:"\xae",circledS:"\u24c8",CircleMinus:"\u2296",CirclePlus:"\u2295",CircleTimes:"\u2297",cir:"\u25cb",cirE:"\u29c3",cire:"\u2257",cirfnint:"\u2a10",cirmid:"\u2aef",cirscir:"\u29c2",ClockwiseContourIntegral:"\u2232",CloseCurlyDoubleQuote:"\u201d",CloseCurlyQuote:"\u2019",clubs:"\u2663",clubsuit:"\u2663",colon:":",Colon:"\u2237",Colone:"\u2a74",colone:"\u2254",coloneq:"\u2254",comma:",",commat:"@",comp:"\u2201",compfn:"\u2218",complement:"\u2201",complexes:"\u2102",cong:"\u2245",congdot:"\u2a6d",Congruent:"\u2261",conint:"\u222e",Conint:"\u222f",ContourIntegral:"\u222e",copf:"\ud835\udd54",Copf:"\u2102",coprod:"\u2210",Coproduct:"\u2210",copy:"\xa9",COPY:"\xa9",copysr:"\u2117",CounterClockwiseContourIntegral:"\u2233",crarr:"\u21b5",cross:"\u2717",Cross:"\u2a2f",Cscr:"\ud835\udc9e",cscr:"\ud835\udcb8",csub:"\u2acf",csube:"\u2ad1",csup:"\u2ad0",csupe:"\u2ad2",ctdot:"\u22ef",cudarrl:"\u2938",cudarrr:"\u2935",cuepr:"\u22de",cuesc:"\u22df",cularr:"\u21b6",cularrp:"\u293d",cupbrcap:"\u2a48",cupcap:"\u2a46",CupCap:"\u224d",cup:"\u222a",Cup:"\u22d3",cupcup:"\u2a4a",cupdot:"\u228d",cupor:"\u2a45",cups:"\u222a\ufe00",curarr:"\u21b7",curarrm:"\u293c",curlyeqprec:"\u22de",curlyeqsucc:"\u22df",curlyvee:"\u22ce",curlywedge:"\u22cf",curren:"\xa4",curvearrowleft:"\u21b6",curvearrowright:"\u21b7",cuvee:"\u22ce",cuwed:"\u22cf",cwconint:"\u2232",cwint:"\u2231",cylcty:"\u232d",dagger:"\u2020",Dagger:"\u2021",daleth:"\u2138",darr:"\u2193",Darr:"\u21a1",dArr:"\u21d3",dash:"\u2010",Dashv:"\u2ae4",dashv:"\u22a3",dbkarow:"\u290f",dblac:"\u02dd",Dcaron:"\u010e",dcaron:"\u010f",Dcy:"\u0414",dcy:"\u0434",ddagger:"\u2021",ddarr:"\u21ca",DD:"\u2145",dd:"\u2146",DDotrahd:"\u2911",ddotseq:"\u2a77",deg:"\xb0",Del:"\u2207",Delta:"\u0394",delta:"\u03b4",demptyv:"\u29b1",dfisht:"\u297f",Dfr:"\ud835\udd07",dfr:"\ud835\udd21",dHar:"\u2965",dharl:"\u21c3",dharr:"\u21c2",DiacriticalAcute:"\xb4",DiacriticalDot:"\u02d9",DiacriticalDoubleAcute:"\u02dd",DiacriticalGrave:"`",DiacriticalTilde:"\u02dc",diam:"\u22c4",diamond:"\u22c4",Diamond:"\u22c4",diamondsuit:"\u2666",diams:"\u2666",die:"\xa8",DifferentialD:"\u2146",digamma:"\u03dd",disin:"\u22f2",div:"\xf7",divide:"\xf7",divideontimes:"\u22c7",divonx:"\u22c7",DJcy:"\u0402",djcy:"\u0452",dlcorn:"\u231e",dlcrop:"\u230d",dollar:"$",Dopf:"\ud835\udd3b",dopf:"\ud835\udd55",Dot:"\xa8",dot:"\u02d9",DotDot:"\u20dc",doteq:"\u2250",doteqdot:"\u2251",DotEqual:"\u2250",dotminus:"\u2238",dotplus:"\u2214",dotsquare:"\u22a1",doublebarwedge:"\u2306",DoubleContourIntegral:"\u222f",DoubleDot:"\xa8",DoubleDownArrow:"\u21d3",DoubleLeftArrow:"\u21d0",DoubleLeftRightArrow:"\u21d4",DoubleLeftTee:"\u2ae4",DoubleLongLeftArrow:"\u27f8",DoubleLongLeftRightArrow:"\u27fa",DoubleLongRightArrow:"\u27f9",DoubleRightArrow:"\u21d2",DoubleRightTee:"\u22a8",DoubleUpArrow:"\u21d1",DoubleUpDownArrow:"\u21d5",DoubleVerticalBar:"\u2225",DownArrowBar:"\u2913",downarrow:"\u2193",DownArrow:"\u2193",Downarrow:"\u21d3",DownArrowUpArrow:"\u21f5",DownBreve:"\u0311",downdownarrows:"\u21ca",downharpoonleft:"\u21c3",downharpoonright:"\u21c2",DownLeftRightVector:"\u2950",DownLeftTeeVector:"\u295e",DownLeftVectorBar:"\u2956",DownLeftVector:"\u21bd",DownRightTeeVector:"\u295f",DownRightVectorBar:"\u2957",DownRightVector:"\u21c1",DownTeeArrow:"\u21a7",DownTee:"\u22a4",drbkarow:"\u2910",drcorn:"\u231f",drcrop:"\u230c",Dscr:"\ud835\udc9f",dscr:"\ud835\udcb9",DScy:"\u0405",dscy:"\u0455",dsol:"\u29f6",Dstrok:"\u0110",dstrok:"\u0111",dtdot:"\u22f1",dtri:"\u25bf",dtrif:"\u25be",duarr:"\u21f5",duhar:"\u296f",dwangle:"\u29a6",DZcy:"\u040f",dzcy:"\u045f",dzigrarr:"\u27ff",Eacute:"\xc9",eacute:"\xe9",easter:"\u2a6e",Ecaron:"\u011a",ecaron:"\u011b",Ecirc:"\xca",ecirc:"\xea",ecir:"\u2256",ecolon:"\u2255",Ecy:"\u042d",ecy:"\u044d",eDDot:"\u2a77",Edot:"\u0116",edot:"\u0117",eDot:"\u2251",ee:"\u2147",efDot:"\u2252",Efr:"\ud835\udd08",efr:"\ud835\udd22",eg:"\u2a9a",Egrave:"\xc8",egrave:"\xe8",egs:"\u2a96",egsdot:"\u2a98",el:"\u2a99",Element:"\u2208",elinters:"\u23e7",ell:"\u2113",els:"\u2a95",elsdot:"\u2a97",Emacr:"\u0112",emacr:"\u0113",empty:"\u2205",emptyset:"\u2205",EmptySmallSquare:"\u25fb",emptyv:"\u2205",EmptyVerySmallSquare:"\u25ab",emsp13:"\u2004",emsp14:"\u2005",emsp:"\u2003",ENG:"\u014a",eng:"\u014b",ensp:"\u2002",Eogon:"\u0118",eogon:"\u0119",Eopf:"\ud835\udd3c",eopf:"\ud835\udd56",epar:"\u22d5",eparsl:"\u29e3",eplus:"\u2a71",epsi:"\u03b5",Epsilon:"\u0395",epsilon:"\u03b5",epsiv:"\u03f5",eqcirc:"\u2256",eqcolon:"\u2255",eqsim:"\u2242",eqslantgtr:"\u2a96",eqslantless:"\u2a95",Equal:"\u2a75",equals:"=",EqualTilde:"\u2242",equest:"\u225f",Equilibrium:"\u21cc",equiv:"\u2261",equivDD:"\u2a78",eqvparsl:"\u29e5",erarr:"\u2971",erDot:"\u2253",escr:"\u212f",Escr:"\u2130",esdot:"\u2250",Esim:"\u2a73",esim:"\u2242",Eta:"\u0397",eta:"\u03b7",ETH:"\xd0",eth:"\xf0",Euml:"\xcb",euml:"\xeb",euro:"\u20ac",excl:"!",exist:"\u2203",Exists:"\u2203",expectation:"\u2130",exponentiale:"\u2147",ExponentialE:"\u2147",fallingdotseq:"\u2252",Fcy:"\u0424",fcy:"\u0444",female:"\u2640",ffilig:"\ufb03",fflig:"\ufb00",ffllig:"\ufb04",Ffr:"\ud835\udd09",ffr:"\ud835\udd23",filig:"\ufb01",FilledSmallSquare:"\u25fc",FilledVerySmallSquare:"\u25aa",fjlig:"fj",flat:"\u266d",fllig:"\ufb02",fltns:"\u25b1",fnof:"\u0192",Fopf:"\ud835\udd3d",fopf:"\ud835\udd57",forall:"\u2200",ForAll:"\u2200",fork:"\u22d4",forkv:"\u2ad9",Fouriertrf:"\u2131",fpartint:"\u2a0d",frac12:"\xbd",frac13:"\u2153",frac14:"\xbc",frac15:"\u2155",frac16:"\u2159",frac18:"\u215b",frac23:"\u2154",frac25:"\u2156",frac34:"\xbe",frac35:"\u2157",frac38:"\u215c",frac45:"\u2158",frac56:"\u215a",frac58:"\u215d",frac78:"\u215e",frasl:"\u2044",frown:"\u2322",fscr:"\ud835\udcbb",Fscr:"\u2131",gacute:"\u01f5",Gamma:"\u0393",gamma:"\u03b3",Gammad:"\u03dc",gammad:"\u03dd",gap:"\u2a86",Gbreve:"\u011e",gbreve:"\u011f",Gcedil:"\u0122",Gcirc:"\u011c",gcirc:"\u011d",Gcy:"\u0413",gcy:"\u0433",Gdot:"\u0120",gdot:"\u0121",ge:"\u2265",gE:"\u2267",gEl:"\u2a8c",gel:"\u22db",geq:"\u2265",geqq:"\u2267",geqslant:"\u2a7e",gescc:"\u2aa9",ges:"\u2a7e",gesdot:"\u2a80",gesdoto:"\u2a82",gesdotol:"\u2a84",gesl:"\u22db\ufe00",gesles:"\u2a94",Gfr:"\ud835\udd0a",gfr:"\ud835\udd24",gg:"\u226b",Gg:"\u22d9",ggg:"\u22d9",gimel:"\u2137",GJcy:"\u0403",gjcy:"\u0453",gla:"\u2aa5",gl:"\u2277",glE:"\u2a92",glj:"\u2aa4",gnap:"\u2a8a",gnapprox:"\u2a8a",gne:"\u2a88",gnE:"\u2269",gneq:"\u2a88",gneqq:"\u2269",gnsim:"\u22e7",Gopf:"\ud835\udd3e",gopf:"\ud835\udd58",grave:"`",GreaterEqual:"\u2265",GreaterEqualLess:"\u22db",GreaterFullEqual:"\u2267",GreaterGreater:"\u2aa2",GreaterLess:"\u2277",GreaterSlantEqual:"\u2a7e",GreaterTilde:"\u2273",Gscr:"\ud835\udca2",gscr:"\u210a",gsim:"\u2273",gsime:"\u2a8e",gsiml:"\u2a90",gtcc:"\u2aa7",gtcir:"\u2a7a",gt:">",GT:">",Gt:"\u226b",gtdot:"\u22d7",gtlPar:"\u2995",gtquest:"\u2a7c",gtrapprox:"\u2a86",gtrarr:"\u2978",gtrdot:"\u22d7",gtreqless:"\u22db",gtreqqless:"\u2a8c",gtrless:"\u2277",gtrsim:"\u2273",gvertneqq:"\u2269\ufe00",gvnE:"\u2269\ufe00",Hacek:"\u02c7",hairsp:"\u200a",half:"\xbd",hamilt:"\u210b",HARDcy:"\u042a",hardcy:"\u044a",harrcir:"\u2948",harr:"\u2194",hArr:"\u21d4",harrw:"\u21ad",Hat:"^",hbar:"\u210f",Hcirc:"\u0124",hcirc:"\u0125",hearts:"\u2665",heartsuit:"\u2665",hellip:"\u2026",hercon:"\u22b9",hfr:"\ud835\udd25",Hfr:"\u210c",HilbertSpace:"\u210b",hksearow:"\u2925",hkswarow:"\u2926",hoarr:"\u21ff",homtht:"\u223b",hookleftarrow:"\u21a9",hookrightarrow:"\u21aa",hopf:"\ud835\udd59",Hopf:"\u210d",horbar:"\u2015",HorizontalLine:"\u2500",hscr:"\ud835\udcbd",Hscr:"\u210b",hslash:"\u210f",Hstrok:"\u0126",hstrok:"\u0127",HumpDownHump:"\u224e",HumpEqual:"\u224f",hybull:"\u2043",hyphen:"\u2010",Iacute:"\xcd",iacute:"\xed",ic:"\u2063",Icirc:"\xce",icirc:"\xee",Icy:"\u0418",icy:"\u0438",Idot:"\u0130",IEcy:"\u0415",iecy:"\u0435",iexcl:"\xa1",iff:"\u21d4",ifr:"\ud835\udd26",Ifr:"\u2111",Igrave:"\xcc",igrave:"\xec",ii:"\u2148",iiiint:"\u2a0c",iiint:"\u222d",iinfin:"\u29dc",iiota:"\u2129",IJlig:"\u0132",ijlig:"\u0133",Imacr:"\u012a",imacr:"\u012b",image:"\u2111",ImaginaryI:"\u2148",imagline:"\u2110",imagpart:"\u2111",imath:"\u0131",Im:"\u2111",imof:"\u22b7",imped:"\u01b5",Implies:"\u21d2",incare:"\u2105",in:"\u2208",infin:"\u221e",infintie:"\u29dd",inodot:"\u0131",intcal:"\u22ba",int:"\u222b",Int:"\u222c",integers:"\u2124",Integral:"\u222b",intercal:"\u22ba",Intersection:"\u22c2",intlarhk:"\u2a17",intprod:"\u2a3c",InvisibleComma:"\u2063",InvisibleTimes:"\u2062",IOcy:"\u0401",iocy:"\u0451",Iogon:"\u012e",iogon:"\u012f",Iopf:"\ud835\udd40",iopf:"\ud835\udd5a",Iota:"\u0399",iota:"\u03b9",iprod:"\u2a3c",iquest:"\xbf",iscr:"\ud835\udcbe",Iscr:"\u2110",isin:"\u2208",isindot:"\u22f5",isinE:"\u22f9",isins:"\u22f4",isinsv:"\u22f3",isinv:"\u2208",it:"\u2062",Itilde:"\u0128",itilde:"\u0129",Iukcy:"\u0406",iukcy:"\u0456",Iuml:"\xcf",iuml:"\xef",Jcirc:"\u0134",jcirc:"\u0135",Jcy:"\u0419",jcy:"\u0439",Jfr:"\ud835\udd0d",jfr:"\ud835\udd27",jmath:"\u0237",Jopf:"\ud835\udd41",jopf:"\ud835\udd5b",Jscr:"\ud835\udca5",jscr:"\ud835\udcbf",Jsercy:"\u0408",jsercy:"\u0458",Jukcy:"\u0404",jukcy:"\u0454",Kappa:"\u039a",kappa:"\u03ba",kappav:"\u03f0",Kcedil:"\u0136",kcedil:"\u0137",Kcy:"\u041a",kcy:"\u043a",Kfr:"\ud835\udd0e",kfr:"\ud835\udd28",kgreen:"\u0138",KHcy:"\u0425",khcy:"\u0445",KJcy:"\u040c",kjcy:"\u045c",Kopf:"\ud835\udd42",kopf:"\ud835\udd5c",Kscr:"\ud835\udca6",kscr:"\ud835\udcc0",lAarr:"\u21da",Lacute:"\u0139",lacute:"\u013a",laemptyv:"\u29b4",lagran:"\u2112",Lambda:"\u039b",lambda:"\u03bb",lang:"\u27e8",Lang:"\u27ea",langd:"\u2991",langle:"\u27e8",lap:"\u2a85",Laplacetrf:"\u2112",laquo:"\xab",larrb:"\u21e4",larrbfs:"\u291f",larr:"\u2190",Larr:"\u219e",lArr:"\u21d0",larrfs:"\u291d",larrhk:"\u21a9",larrlp:"\u21ab",larrpl:"\u2939",larrsim:"\u2973",larrtl:"\u21a2",latail:"\u2919",lAtail:"\u291b",lat:"\u2aab",late:"\u2aad",lates:"\u2aad\ufe00",lbarr:"\u290c",lBarr:"\u290e",lbbrk:"\u2772",lbrace:"{",lbrack:"[",lbrke:"\u298b",lbrksld:"\u298f",lbrkslu:"\u298d",Lcaron:"\u013d",lcaron:"\u013e",Lcedil:"\u013b",lcedil:"\u013c",lceil:"\u2308",lcub:"{",Lcy:"\u041b",lcy:"\u043b",ldca:"\u2936",ldquo:"\u201c",ldquor:"\u201e",ldrdhar:"\u2967",ldrushar:"\u294b",ldsh:"\u21b2",le:"\u2264",lE:"\u2266",LeftAngleBracket:"\u27e8",LeftArrowBar:"\u21e4",leftarrow:"\u2190",LeftArrow:"\u2190",Leftarrow:"\u21d0",LeftArrowRightArrow:"\u21c6",leftarrowtail:"\u21a2",LeftCeiling:"\u2308",LeftDoubleBracket:"\u27e6",LeftDownTeeVector:"\u2961",LeftDownVectorBar:"\u2959",LeftDownVector:"\u21c3",LeftFloor:"\u230a",leftharpoondown:"\u21bd",leftharpoonup:"\u21bc",leftleftarrows:"\u21c7",leftrightarrow:"\u2194",LeftRightArrow:"\u2194",Leftrightarrow:"\u21d4",leftrightarrows:"\u21c6",leftrightharpoons:"\u21cb",leftrightsquigarrow:"\u21ad",LeftRightVector:"\u294e",LeftTeeArrow:"\u21a4",LeftTee:"\u22a3",LeftTeeVector:"\u295a",leftthreetimes:"\u22cb",LeftTriangleBar:"\u29cf",LeftTriangle:"\u22b2",LeftTriangleEqual:"\u22b4",LeftUpDownVector:"\u2951",LeftUpTeeVector:"\u2960",LeftUpVectorBar:"\u2958",LeftUpVector:"\u21bf",LeftVectorBar:"\u2952",LeftVector:"\u21bc",lEg:"\u2a8b",leg:"\u22da",leq:"\u2264",leqq:"\u2266",leqslant:"\u2a7d",lescc:"\u2aa8",les:"\u2a7d",lesdot:"\u2a7f",lesdoto:"\u2a81",lesdotor:"\u2a83",lesg:"\u22da\ufe00",lesges:"\u2a93",lessapprox:"\u2a85",lessdot:"\u22d6",lesseqgtr:"\u22da",lesseqqgtr:"\u2a8b",LessEqualGreater:"\u22da",LessFullEqual:"\u2266",LessGreater:"\u2276",lessgtr:"\u2276",LessLess:"\u2aa1",lesssim:"\u2272",LessSlantEqual:"\u2a7d",LessTilde:"\u2272",lfisht:"\u297c",lfloor:"\u230a",Lfr:"\ud835\udd0f",lfr:"\ud835\udd29",lg:"\u2276",lgE:"\u2a91",lHar:"\u2962",lhard:"\u21bd",lharu:"\u21bc",lharul:"\u296a",lhblk:"\u2584",LJcy:"\u0409",ljcy:"\u0459",llarr:"\u21c7",ll:"\u226a",Ll:"\u22d8",llcorner:"\u231e",Lleftarrow:"\u21da",llhard:"\u296b",lltri:"\u25fa",Lmidot:"\u013f",lmidot:"\u0140",lmoustache:"\u23b0",lmoust:"\u23b0",lnap:"\u2a89",lnapprox:"\u2a89",lne:"\u2a87",lnE:"\u2268",lneq:"\u2a87",lneqq:"\u2268",lnsim:"\u22e6",loang:"\u27ec",loarr:"\u21fd",lobrk:"\u27e6",longleftarrow:"\u27f5",LongLeftArrow:"\u27f5",Longleftarrow:"\u27f8",longleftrightarrow:"\u27f7",LongLeftRightArrow:"\u27f7",Longleftrightarrow:"\u27fa",longmapsto:"\u27fc",longrightarrow:"\u27f6",LongRightArrow:"\u27f6",Longrightarrow:"\u27f9",looparrowleft:"\u21ab",looparrowright:"\u21ac",lopar:"\u2985",Lopf:"\ud835\udd43",lopf:"\ud835\udd5d",loplus:"\u2a2d",lotimes:"\u2a34",lowast:"\u2217",lowbar:"_",LowerLeftArrow:"\u2199",LowerRightArrow:"\u2198",loz:"\u25ca",lozenge:"\u25ca",lozf:"\u29eb",lpar:"(",lparlt:"\u2993",lrarr:"\u21c6",lrcorner:"\u231f",lrhar:"\u21cb",lrhard:"\u296d",lrm:"\u200e",lrtri:"\u22bf",lsaquo:"\u2039",lscr:"\ud835\udcc1",Lscr:"\u2112",lsh:"\u21b0",Lsh:"\u21b0",lsim:"\u2272",lsime:"\u2a8d",lsimg:"\u2a8f",lsqb:"[",lsquo:"\u2018",lsquor:"\u201a",Lstrok:"\u0141",lstrok:"\u0142",ltcc:"\u2aa6",ltcir:"\u2a79",lt:"<",LT:"<",Lt:"\u226a",ltdot:"\u22d6",lthree:"\u22cb",ltimes:"\u22c9",ltlarr:"\u2976",ltquest:"\u2a7b",ltri:"\u25c3",ltrie:"\u22b4",ltrif:"\u25c2",ltrPar:"\u2996",lurdshar:"\u294a",luruhar:"\u2966",lvertneqq:"\u2268\ufe00",lvnE:"\u2268\ufe00",macr:"\xaf",male:"\u2642",malt:"\u2720",maltese:"\u2720",Map:"\u2905",map:"\u21a6",mapsto:"\u21a6",mapstodown:"\u21a7",mapstoleft:"\u21a4",mapstoup:"\u21a5",marker:"\u25ae",mcomma:"\u2a29",Mcy:"\u041c",mcy:"\u043c",mdash:"\u2014",mDDot:"\u223a",measuredangle:"\u2221",MediumSpace:"\u205f",Mellintrf:"\u2133",Mfr:"\ud835\udd10",mfr:"\ud835\udd2a",mho:"\u2127",micro:"\xb5",midast:"*",midcir:"\u2af0",mid:"\u2223",middot:"\xb7",minusb:"\u229f",minus:"\u2212",minusd:"\u2238",minusdu:"\u2a2a",MinusPlus:"\u2213",mlcp:"\u2adb",mldr:"\u2026",mnplus:"\u2213",models:"\u22a7",Mopf:"\ud835\udd44",mopf:"\ud835\udd5e",mp:"\u2213",mscr:"\ud835\udcc2",Mscr:"\u2133",mstpos:"\u223e",Mu:"\u039c",mu:"\u03bc",multimap:"\u22b8",mumap:"\u22b8",nabla:"\u2207",Nacute:"\u0143",nacute:"\u0144",nang:"\u2220\u20d2",nap:"\u2249",napE:"\u2a70\u0338",napid:"\u224b\u0338",napos:"\u0149",napprox:"\u2249",natural:"\u266e",naturals:"\u2115",natur:"\u266e",nbsp:"\xa0",nbump:"\u224e\u0338",nbumpe:"\u224f\u0338",ncap:"\u2a43",Ncaron:"\u0147",ncaron:"\u0148",Ncedil:"\u0145",ncedil:"\u0146",ncong:"\u2247",ncongdot:"\u2a6d\u0338",ncup:"\u2a42",Ncy:"\u041d",ncy:"\u043d",ndash:"\u2013",nearhk:"\u2924",nearr:"\u2197",neArr:"\u21d7",nearrow:"\u2197",ne:"\u2260",nedot:"\u2250\u0338",NegativeMediumSpace:"\u200b",NegativeThickSpace:"\u200b",NegativeThinSpace:"\u200b",NegativeVeryThinSpace:"\u200b",nequiv:"\u2262",nesear:"\u2928",nesim:"\u2242\u0338",NestedGreaterGreater:"\u226b",NestedLessLess:"\u226a",NewLine:"\n",nexist:"\u2204",nexists:"\u2204",Nfr:"\ud835\udd11",nfr:"\ud835\udd2b",ngE:"\u2267\u0338",nge:"\u2271",ngeq:"\u2271",ngeqq:"\u2267\u0338",ngeqslant:"\u2a7e\u0338",nges:"\u2a7e\u0338",nGg:"\u22d9\u0338",ngsim:"\u2275",nGt:"\u226b\u20d2",ngt:"\u226f",ngtr:"\u226f",nGtv:"\u226b\u0338",nharr:"\u21ae",nhArr:"\u21ce",nhpar:"\u2af2",ni:"\u220b",nis:"\u22fc",nisd:"\u22fa",niv:"\u220b",NJcy:"\u040a",njcy:"\u045a",nlarr:"\u219a",nlArr:"\u21cd",nldr:"\u2025",nlE:"\u2266\u0338",nle:"\u2270",nleftarrow:"\u219a",nLeftarrow:"\u21cd",nleftrightarrow:"\u21ae",nLeftrightarrow:"\u21ce",nleq:"\u2270",nleqq:"\u2266\u0338",nleqslant:"\u2a7d\u0338",nles:"\u2a7d\u0338",nless:"\u226e",nLl:"\u22d8\u0338",nlsim:"\u2274",nLt:"\u226a\u20d2",nlt:"\u226e",nltri:"\u22ea",nltrie:"\u22ec",nLtv:"\u226a\u0338",nmid:"\u2224",NoBreak:"\u2060",NonBreakingSpace:"\xa0",nopf:"\ud835\udd5f",Nopf:"\u2115",Not:"\u2aec",not:"\xac",NotCongruent:"\u2262",NotCupCap:"\u226d",NotDoubleVerticalBar:"\u2226",NotElement:"\u2209",NotEqual:"\u2260",NotEqualTilde:"\u2242\u0338",NotExists:"\u2204",NotGreater:"\u226f",NotGreaterEqual:"\u2271",NotGreaterFullEqual:"\u2267\u0338",NotGreaterGreater:"\u226b\u0338",NotGreaterLess:"\u2279",NotGreaterSlantEqual:"\u2a7e\u0338",NotGreaterTilde:"\u2275",NotHumpDownHump:"\u224e\u0338",NotHumpEqual:"\u224f\u0338",notin:"\u2209",notindot:"\u22f5\u0338",notinE:"\u22f9\u0338",notinva:"\u2209",notinvb:"\u22f7",notinvc:"\u22f6",NotLeftTriangleBar:"\u29cf\u0338",NotLeftTriangle:"\u22ea",NotLeftTriangleEqual:"\u22ec",NotLess:"\u226e",NotLessEqual:"\u2270",NotLessGreater:"\u2278",NotLessLess:"\u226a\u0338",NotLessSlantEqual:"\u2a7d\u0338",NotLessTilde:"\u2274",NotNestedGreaterGreater:"\u2aa2\u0338",NotNestedLessLess:"\u2aa1\u0338",notni:"\u220c",notniva:"\u220c",notnivb:"\u22fe",notnivc:"\u22fd",NotPrecedes:"\u2280",NotPrecedesEqual:"\u2aaf\u0338",NotPrecedesSlantEqual:"\u22e0",NotReverseElement:"\u220c",NotRightTriangleBar:"\u29d0\u0338",NotRightTriangle:"\u22eb",NotRightTriangleEqual:"\u22ed",NotSquareSubset:"\u228f\u0338",NotSquareSubsetEqual:"\u22e2",NotSquareSuperset:"\u2290\u0338",NotSquareSupersetEqual:"\u22e3",NotSubset:"\u2282\u20d2",NotSubsetEqual:"\u2288",NotSucceeds:"\u2281",NotSucceedsEqual:"\u2ab0\u0338",NotSucceedsSlantEqual:"\u22e1",NotSucceedsTilde:"\u227f\u0338",NotSuperset:"\u2283\u20d2",NotSupersetEqual:"\u2289",NotTilde:"\u2241",NotTildeEqual:"\u2244",NotTildeFullEqual:"\u2247",NotTildeTilde:"\u2249",NotVerticalBar:"\u2224",nparallel:"\u2226",npar:"\u2226",nparsl:"\u2afd\u20e5",npart:"\u2202\u0338",npolint:"\u2a14",npr:"\u2280",nprcue:"\u22e0",nprec:"\u2280",npreceq:"\u2aaf\u0338",npre:"\u2aaf\u0338",nrarrc:"\u2933\u0338",nrarr:"\u219b",nrArr:"\u21cf",nrarrw:"\u219d\u0338",nrightarrow:"\u219b",nRightarrow:"\u21cf",nrtri:"\u22eb",nrtrie:"\u22ed",nsc:"\u2281",nsccue:"\u22e1",nsce:"\u2ab0\u0338",Nscr:"\ud835\udca9",nscr:"\ud835\udcc3",nshortmid:"\u2224",nshortparallel:"\u2226",nsim:"\u2241",nsime:"\u2244",nsimeq:"\u2244",nsmid:"\u2224",nspar:"\u2226",nsqsube:"\u22e2",nsqsupe:"\u22e3",nsub:"\u2284",nsubE:"\u2ac5\u0338",nsube:"\u2288",nsubset:"\u2282\u20d2",nsubseteq:"\u2288",nsubseteqq:"\u2ac5\u0338",nsucc:"\u2281",nsucceq:"\u2ab0\u0338",nsup:"\u2285",nsupE:"\u2ac6\u0338",nsupe:"\u2289",nsupset:"\u2283\u20d2",nsupseteq:"\u2289",nsupseteqq:"\u2ac6\u0338",ntgl:"\u2279",Ntilde:"\xd1",ntilde:"\xf1",ntlg:"\u2278",ntriangleleft:"\u22ea",ntrianglelefteq:"\u22ec",ntriangleright:"\u22eb",ntrianglerighteq:"\u22ed",Nu:"\u039d",nu:"\u03bd",num:"#",numero:"\u2116",numsp:"\u2007",nvap:"\u224d\u20d2",nvdash:"\u22ac",nvDash:"\u22ad",nVdash:"\u22ae",nVDash:"\u22af",nvge:"\u2265\u20d2",nvgt:">\u20d2",nvHarr:"\u2904",nvinfin:"\u29de",nvlArr:"\u2902",nvle:"\u2264\u20d2",nvlt:"<\u20d2",nvltrie:"\u22b4\u20d2",nvrArr:"\u2903",nvrtrie:"\u22b5\u20d2",nvsim:"\u223c\u20d2",nwarhk:"\u2923",nwarr:"\u2196",nwArr:"\u21d6",nwarrow:"\u2196",nwnear:"\u2927",Oacute:"\xd3",oacute:"\xf3",oast:"\u229b",Ocirc:"\xd4",ocirc:"\xf4",ocir:"\u229a",Ocy:"\u041e",ocy:"\u043e",odash:"\u229d",Odblac:"\u0150",odblac:"\u0151",odiv:"\u2a38",odot:"\u2299",odsold:"\u29bc",OElig:"\u0152",oelig:"\u0153",ofcir:"\u29bf",Ofr:"\ud835\udd12",ofr:"\ud835\udd2c",ogon:"\u02db",Ograve:"\xd2",ograve:"\xf2",ogt:"\u29c1",ohbar:"\u29b5",ohm:"\u03a9",oint:"\u222e",olarr:"\u21ba",olcir:"\u29be",olcross:"\u29bb",oline:"\u203e",olt:"\u29c0",Omacr:"\u014c",omacr:"\u014d",Omega:"\u03a9",omega:"\u03c9",Omicron:"\u039f",omicron:"\u03bf",omid:"\u29b6",ominus:"\u2296",Oopf:"\ud835\udd46",oopf:"\ud835\udd60",opar:"\u29b7",OpenCurlyDoubleQuote:"\u201c",OpenCurlyQuote:"\u2018",operp:"\u29b9",oplus:"\u2295",orarr:"\u21bb",Or:"\u2a54",or:"\u2228",ord:"\u2a5d",order:"\u2134",orderof:"\u2134",ordf:"\xaa",ordm:"\xba",origof:"\u22b6",oror:"\u2a56",orslope:"\u2a57",orv:"\u2a5b",oS:"\u24c8",Oscr:"\ud835\udcaa",oscr:"\u2134",Oslash:"\xd8",oslash:"\xf8",osol:"\u2298",Otilde:"\xd5",otilde:"\xf5",otimesas:"\u2a36",Otimes:"\u2a37",otimes:"\u2297",Ouml:"\xd6",ouml:"\xf6",ovbar:"\u233d",OverBar:"\u203e",OverBrace:"\u23de",OverBracket:"\u23b4",OverParenthesis:"\u23dc",para:"\xb6",parallel:"\u2225",par:"\u2225",parsim:"\u2af3",parsl:"\u2afd",part:"\u2202",PartialD:"\u2202",Pcy:"\u041f",pcy:"\u043f",percnt:"%",period:".",permil:"\u2030",perp:"\u22a5",pertenk:"\u2031",Pfr:"\ud835\udd13",pfr:"\ud835\udd2d",Phi:"\u03a6",phi:"\u03c6",phiv:"\u03d5",phmmat:"\u2133",phone:"\u260e",Pi:"\u03a0",pi:"\u03c0",pitchfork:"\u22d4",piv:"\u03d6",planck:"\u210f",planckh:"\u210e",plankv:"\u210f",plusacir:"\u2a23",plusb:"\u229e",pluscir:"\u2a22",plus:"+",plusdo:"\u2214",plusdu:"\u2a25",pluse:"\u2a72",PlusMinus:"\xb1",plusmn:"\xb1",plussim:"\u2a26",plustwo:"\u2a27",pm:"\xb1",Poincareplane:"\u210c",pointint:"\u2a15",popf:"\ud835\udd61",Popf:"\u2119",pound:"\xa3",prap:"\u2ab7",Pr:"\u2abb",pr:"\u227a",prcue:"\u227c",precapprox:"\u2ab7",prec:"\u227a",preccurlyeq:"\u227c",Precedes:"\u227a",PrecedesEqual:"\u2aaf",PrecedesSlantEqual:"\u227c",PrecedesTilde:"\u227e",preceq:"\u2aaf",precnapprox:"\u2ab9",precneqq:"\u2ab5",precnsim:"\u22e8",pre:"\u2aaf",prE:"\u2ab3",precsim:"\u227e",prime:"\u2032",Prime:"\u2033",primes:"\u2119",prnap:"\u2ab9",prnE:"\u2ab5",prnsim:"\u22e8",prod:"\u220f",Product:"\u220f",profalar:"\u232e",profline:"\u2312",profsurf:"\u2313",prop:"\u221d",Proportional:"\u221d",Proportion:"\u2237",propto:"\u221d",prsim:"\u227e",prurel:"\u22b0",Pscr:"\ud835\udcab",pscr:"\ud835\udcc5",Psi:"\u03a8",psi:"\u03c8",puncsp:"\u2008",Qfr:"\ud835\udd14",qfr:"\ud835\udd2e",qint:"\u2a0c",qopf:"\ud835\udd62",Qopf:"\u211a",qprime:"\u2057",Qscr:"\ud835\udcac",qscr:"\ud835\udcc6",quaternions:"\u210d",quatint:"\u2a16",quest:"?",questeq:"\u225f",quot:'"',QUOT:'"',rAarr:"\u21db",race:"\u223d\u0331",Racute:"\u0154",racute:"\u0155",radic:"\u221a",raemptyv:"\u29b3",rang:"\u27e9",Rang:"\u27eb",rangd:"\u2992",range:"\u29a5",rangle:"\u27e9",raquo:"\xbb",rarrap:"\u2975",rarrb:"\u21e5",rarrbfs:"\u2920",rarrc:"\u2933",rarr:"\u2192",Rarr:"\u21a0",rArr:"\u21d2",rarrfs:"\u291e",rarrhk:"\u21aa",rarrlp:"\u21ac",rarrpl:"\u2945",rarrsim:"\u2974",Rarrtl:"\u2916",rarrtl:"\u21a3",rarrw:"\u219d",ratail:"\u291a",rAtail:"\u291c",ratio:"\u2236",rationals:"\u211a",rbarr:"\u290d",rBarr:"\u290f",RBarr:"\u2910",rbbrk:"\u2773",rbrace:"}",rbrack:"]",rbrke:"\u298c",rbrksld:"\u298e",rbrkslu:"\u2990",Rcaron:"\u0158",rcaron:"\u0159",Rcedil:"\u0156",rcedil:"\u0157",rceil:"\u2309",rcub:"}",Rcy:"\u0420",rcy:"\u0440",rdca:"\u2937",rdldhar:"\u2969",rdquo:"\u201d",rdquor:"\u201d",rdsh:"\u21b3",real:"\u211c",realine:"\u211b",realpart:"\u211c",reals:"\u211d",Re:"\u211c",rect:"\u25ad",reg:"\xae",REG:"\xae",ReverseElement:"\u220b",ReverseEquilibrium:"\u21cb",ReverseUpEquilibrium:"\u296f",rfisht:"\u297d",rfloor:"\u230b",rfr:"\ud835\udd2f",Rfr:"\u211c",rHar:"\u2964",rhard:"\u21c1",rharu:"\u21c0",rharul:"\u296c",Rho:"\u03a1",rho:"\u03c1",rhov:"\u03f1",RightAngleBracket:"\u27e9",RightArrowBar:"\u21e5",rightarrow:"\u2192",RightArrow:"\u2192",Rightarrow:"\u21d2",RightArrowLeftArrow:"\u21c4",rightarrowtail:"\u21a3",RightCeiling:"\u2309",RightDoubleBracket:"\u27e7",RightDownTeeVector:"\u295d",RightDownVectorBar:"\u2955",RightDownVector:"\u21c2",RightFloor:"\u230b",rightharpoondown:"\u21c1",rightharpoonup:"\u21c0",rightleftarrows:"\u21c4",rightleftharpoons:"\u21cc",rightrightarrows:"\u21c9",rightsquigarrow:"\u219d",RightTeeArrow:"\u21a6",RightTee:"\u22a2",RightTeeVector:"\u295b",rightthreetimes:"\u22cc",RightTriangleBar:"\u29d0",RightTriangle:"\u22b3",RightTriangleEqual:"\u22b5",RightUpDownVector:"\u294f",RightUpTeeVector:"\u295c",RightUpVectorBar:"\u2954",RightUpVector:"\u21be",RightVectorBar:"\u2953",RightVector:"\u21c0",ring:"\u02da",risingdotseq:"\u2253",rlarr:"\u21c4",rlhar:"\u21cc",rlm:"\u200f",rmoustache:"\u23b1",rmoust:"\u23b1",rnmid:"\u2aee",roang:"\u27ed",roarr:"\u21fe",robrk:"\u27e7",ropar:"\u2986",ropf:"\ud835\udd63",Ropf:"\u211d",roplus:"\u2a2e",rotimes:"\u2a35",RoundImplies:"\u2970",rpar:")",rpargt:"\u2994",rppolint:"\u2a12",rrarr:"\u21c9",Rrightarrow:"\u21db",rsaquo:"\u203a",rscr:"\ud835\udcc7",Rscr:"\u211b",rsh:"\u21b1",Rsh:"\u21b1",rsqb:"]",rsquo:"\u2019",rsquor:"\u2019",rthree:"\u22cc",rtimes:"\u22ca",rtri:"\u25b9",rtrie:"\u22b5",rtrif:"\u25b8",rtriltri:"\u29ce",RuleDelayed:"\u29f4",ruluhar:"\u2968",rx:"\u211e",Sacute:"\u015a",sacute:"\u015b",sbquo:"\u201a",scap:"\u2ab8",Scaron:"\u0160",scaron:"\u0161",Sc:"\u2abc",sc:"\u227b",sccue:"\u227d",sce:"\u2ab0",scE:"\u2ab4",Scedil:"\u015e",scedil:"\u015f",Scirc:"\u015c",scirc:"\u015d",scnap:"\u2aba",scnE:"\u2ab6",scnsim:"\u22e9",scpolint:"\u2a13",scsim:"\u227f",Scy:"\u0421",scy:"\u0441",sdotb:"\u22a1",sdot:"\u22c5",sdote:"\u2a66",searhk:"\u2925",searr:"\u2198",seArr:"\u21d8",searrow:"\u2198",sect:"\xa7",semi:";",seswar:"\u2929",setminus:"\u2216",setmn:"\u2216",sext:"\u2736",Sfr:"\ud835\udd16",sfr:"\ud835\udd30",sfrown:"\u2322",sharp:"\u266f",SHCHcy:"\u0429",shchcy:"\u0449",SHcy:"\u0428",shcy:"\u0448",ShortDownArrow:"\u2193",ShortLeftArrow:"\u2190",shortmid:"\u2223",shortparallel:"\u2225",ShortRightArrow:"\u2192",ShortUpArrow:"\u2191",shy:"\xad",Sigma:"\u03a3",sigma:"\u03c3",sigmaf:"\u03c2",sigmav:"\u03c2",sim:"\u223c",simdot:"\u2a6a",sime:"\u2243",simeq:"\u2243",simg:"\u2a9e",simgE:"\u2aa0",siml:"\u2a9d",simlE:"\u2a9f",simne:"\u2246",simplus:"\u2a24",simrarr:"\u2972",slarr:"\u2190",SmallCircle:"\u2218",smallsetminus:"\u2216",smashp:"\u2a33",smeparsl:"\u29e4",smid:"\u2223",smile:"\u2323",smt:"\u2aaa",smte:"\u2aac",smtes:"\u2aac\ufe00",SOFTcy:"\u042c",softcy:"\u044c",solbar:"\u233f",solb:"\u29c4",sol:"/",Sopf:"\ud835\udd4a",sopf:"\ud835\udd64",spades:"\u2660",spadesuit:"\u2660",spar:"\u2225",sqcap:"\u2293",sqcaps:"\u2293\ufe00",sqcup:"\u2294",sqcups:"\u2294\ufe00",Sqrt:"\u221a",sqsub:"\u228f",sqsube:"\u2291",sqsubset:"\u228f",sqsubseteq:"\u2291",sqsup:"\u2290",sqsupe:"\u2292",sqsupset:"\u2290",sqsupseteq:"\u2292",square:"\u25a1",Square:"\u25a1",SquareIntersection:"\u2293",SquareSubset:"\u228f",SquareSubsetEqual:"\u2291",SquareSuperset:"\u2290",SquareSupersetEqual:"\u2292",SquareUnion:"\u2294",squarf:"\u25aa",squ:"\u25a1",squf:"\u25aa",srarr:"\u2192",Sscr:"\ud835\udcae",sscr:"\ud835\udcc8",ssetmn:"\u2216",ssmile:"\u2323",sstarf:"\u22c6",Star:"\u22c6",star:"\u2606",starf:"\u2605",straightepsilon:"\u03f5",straightphi:"\u03d5",strns:"\xaf",sub:"\u2282",Sub:"\u22d0",subdot:"\u2abd",subE:"\u2ac5",sube:"\u2286",subedot:"\u2ac3",submult:"\u2ac1",subnE:"\u2acb",subne:"\u228a",subplus:"\u2abf",subrarr:"\u2979",subset:"\u2282",Subset:"\u22d0",subseteq:"\u2286",subseteqq:"\u2ac5",SubsetEqual:"\u2286",subsetneq:"\u228a",subsetneqq:"\u2acb",subsim:"\u2ac7",subsub:"\u2ad5",subsup:"\u2ad3",succapprox:"\u2ab8",succ:"\u227b",succcurlyeq:"\u227d",Succeeds:"\u227b",SucceedsEqual:"\u2ab0",SucceedsSlantEqual:"\u227d",SucceedsTilde:"\u227f",succeq:"\u2ab0",succnapprox:"\u2aba",succneqq:"\u2ab6",succnsim:"\u22e9",succsim:"\u227f",SuchThat:"\u220b",sum:"\u2211",Sum:"\u2211",sung:"\u266a",sup1:"\xb9",sup2:"\xb2",sup3:"\xb3",sup:"\u2283",Sup:"\u22d1",supdot:"\u2abe",supdsub:"\u2ad8",supE:"\u2ac6",supe:"\u2287",supedot:"\u2ac4",Superset:"\u2283",SupersetEqual:"\u2287",suphsol:"\u27c9",suphsub:"\u2ad7",suplarr:"\u297b",supmult:"\u2ac2",supnE:"\u2acc",supne:"\u228b",supplus:"\u2ac0",supset:"\u2283",Supset:"\u22d1",supseteq:"\u2287",supseteqq:"\u2ac6",supsetneq:"\u228b",supsetneqq:"\u2acc",supsim:"\u2ac8",supsub:"\u2ad4",supsup:"\u2ad6",swarhk:"\u2926",swarr:"\u2199",swArr:"\u21d9",swarrow:"\u2199",swnwar:"\u292a",szlig:"\xdf",Tab:"\t",target:"\u2316",Tau:"\u03a4",tau:"\u03c4",tbrk:"\u23b4",Tcaron:"\u0164",tcaron:"\u0165",Tcedil:"\u0162",tcedil:"\u0163",Tcy:"\u0422",tcy:"\u0442",tdot:"\u20db",telrec:"\u2315",Tfr:"\ud835\udd17",tfr:"\ud835\udd31",there4:"\u2234",therefore:"\u2234",Therefore:"\u2234",Theta:"\u0398",theta:"\u03b8",thetasym:"\u03d1",thetav:"\u03d1",thickapprox:"\u2248",thicksim:"\u223c",ThickSpace:"\u205f\u200a",ThinSpace:"\u2009",thinsp:"\u2009",thkap:"\u2248",thksim:"\u223c",THORN:"\xde",thorn:"\xfe",tilde:"\u02dc",Tilde:"\u223c",TildeEqual:"\u2243",TildeFullEqual:"\u2245",TildeTilde:"\u2248",timesbar:"\u2a31",timesb:"\u22a0",times:"\xd7",timesd:"\u2a30",tint:"\u222d",toea:"\u2928",topbot:"\u2336",topcir:"\u2af1",top:"\u22a4",Topf:"\ud835\udd4b",topf:"\ud835\udd65",topfork:"\u2ada",tosa:"\u2929",tprime:"\u2034",trade:"\u2122",TRADE:"\u2122",triangle:"\u25b5",triangledown:"\u25bf",triangleleft:"\u25c3",trianglelefteq:"\u22b4",triangleq:"\u225c",triangleright:"\u25b9",trianglerighteq:"\u22b5",tridot:"\u25ec",trie:"\u225c",triminus:"\u2a3a",TripleDot:"\u20db",triplus:"\u2a39",trisb:"\u29cd",tritime:"\u2a3b",trpezium:"\u23e2",Tscr:"\ud835\udcaf",tscr:"\ud835\udcc9",TScy:"\u0426",tscy:"\u0446",TSHcy:"\u040b",tshcy:"\u045b",Tstrok:"\u0166",tstrok:"\u0167",twixt:"\u226c",twoheadleftarrow:"\u219e",twoheadrightarrow:"\u21a0",Uacute:"\xda",uacute:"\xfa",uarr:"\u2191",Uarr:"\u219f",uArr:"\u21d1",Uarrocir:"\u2949",Ubrcy:"\u040e",ubrcy:"\u045e",Ubreve:"\u016c",ubreve:"\u016d",Ucirc:"\xdb",ucirc:"\xfb",Ucy:"\u0423",ucy:"\u0443",udarr:"\u21c5",Udblac:"\u0170",udblac:"\u0171",udhar:"\u296e",ufisht:"\u297e",Ufr:"\ud835\udd18",ufr:"\ud835\udd32",Ugrave:"\xd9",ugrave:"\xf9",uHar:"\u2963",uharl:"\u21bf",uharr:"\u21be",uhblk:"\u2580",ulcorn:"\u231c",ulcorner:"\u231c",ulcrop:"\u230f",ultri:"\u25f8",Umacr:"\u016a",umacr:"\u016b",uml:"\xa8",UnderBar:"_",UnderBrace:"\u23df",UnderBracket:"\u23b5",UnderParenthesis:"\u23dd",Union:"\u22c3",UnionPlus:"\u228e",Uogon:"\u0172",uogon:"\u0173",Uopf:"\ud835\udd4c",uopf:"\ud835\udd66",UpArrowBar:"\u2912",uparrow:"\u2191",UpArrow:"\u2191",Uparrow:"\u21d1",UpArrowDownArrow:"\u21c5",updownarrow:"\u2195",UpDownArrow:"\u2195",Updownarrow:"\u21d5",UpEquilibrium:"\u296e",upharpoonleft:"\u21bf",upharpoonright:"\u21be",uplus:"\u228e",UpperLeftArrow:"\u2196",UpperRightArrow:"\u2197",upsi:"\u03c5",Upsi:"\u03d2",upsih:"\u03d2",Upsilon:"\u03a5",upsilon:"\u03c5",UpTeeArrow:"\u21a5",UpTee:"\u22a5",upuparrows:"\u21c8",urcorn:"\u231d",urcorner:"\u231d",urcrop:"\u230e",Uring:"\u016e",uring:"\u016f",urtri:"\u25f9",Uscr:"\ud835\udcb0",uscr:"\ud835\udcca",utdot:"\u22f0",Utilde:"\u0168",utilde:"\u0169",utri:"\u25b5",utrif:"\u25b4",uuarr:"\u21c8",Uuml:"\xdc",uuml:"\xfc",uwangle:"\u29a7",vangrt:"\u299c",varepsilon:"\u03f5",varkappa:"\u03f0",varnothing:"\u2205",varphi:"\u03d5",varpi:"\u03d6",varpropto:"\u221d",varr:"\u2195",vArr:"\u21d5",varrho:"\u03f1",varsigma:"\u03c2",varsubsetneq:"\u228a\ufe00",varsubsetneqq:"\u2acb\ufe00",varsupsetneq:"\u228b\ufe00",varsupsetneqq:"\u2acc\ufe00",vartheta:"\u03d1",vartriangleleft:"\u22b2",vartriangleright:"\u22b3",vBar:"\u2ae8",Vbar:"\u2aeb",vBarv:"\u2ae9",Vcy:"\u0412",vcy:"\u0432",vdash:"\u22a2",vDash:"\u22a8",Vdash:"\u22a9",VDash:"\u22ab",Vdashl:"\u2ae6",veebar:"\u22bb",vee:"\u2228",Vee:"\u22c1",veeeq:"\u225a",vellip:"\u22ee",verbar:"|",Verbar:"\u2016",vert:"|",Vert:"\u2016",VerticalBar:"\u2223",VerticalLine:"|",VerticalSeparator:"\u2758",VerticalTilde:"\u2240",VeryThinSpace:"\u200a",Vfr:"\ud835\udd19",vfr:"\ud835\udd33",vltri:"\u22b2",vnsub:"\u2282\u20d2",vnsup:"\u2283\u20d2",Vopf:"\ud835\udd4d",vopf:"\ud835\udd67",vprop:"\u221d",vrtri:"\u22b3",Vscr:"\ud835\udcb1",vscr:"\ud835\udccb",vsubnE:"\u2acb\ufe00",vsubne:"\u228a\ufe00",vsupnE:"\u2acc\ufe00",vsupne:"\u228b\ufe00",Vvdash:"\u22aa",vzigzag:"\u299a",Wcirc:"\u0174",wcirc:"\u0175",wedbar:"\u2a5f",wedge:"\u2227",Wedge:"\u22c0",wedgeq:"\u2259",weierp:"\u2118",Wfr:"\ud835\udd1a",wfr:"\ud835\udd34",Wopf:"\ud835\udd4e",wopf:"\ud835\udd68",wp:"\u2118",wr:"\u2240",wreath:"\u2240",Wscr:"\ud835\udcb2",wscr:"\ud835\udccc",xcap:"\u22c2",xcirc:"\u25ef",xcup:"\u22c3",xdtri:"\u25bd",Xfr:"\ud835\udd1b",xfr:"\ud835\udd35",xharr:"\u27f7",xhArr:"\u27fa",Xi:"\u039e",xi:"\u03be",xlarr:"\u27f5",xlArr:"\u27f8",xmap:"\u27fc",xnis:"\u22fb",xodot:"\u2a00",Xopf:"\ud835\udd4f",xopf:"\ud835\udd69",xoplus:"\u2a01",xotime:"\u2a02",xrarr:"\u27f6",xrArr:"\u27f9",Xscr:"\ud835\udcb3",xscr:"\ud835\udccd",xsqcup:"\u2a06",xuplus:"\u2a04",xutri:"\u25b3",xvee:"\u22c1",xwedge:"\u22c0",Yacute:"\xdd",yacute:"\xfd",YAcy:"\u042f",yacy:"\u044f",Ycirc:"\u0176",ycirc:"\u0177",Ycy:"\u042b",ycy:"\u044b",yen:"\xa5",Yfr:"\ud835\udd1c",yfr:"\ud835\udd36",YIcy:"\u0407",yicy:"\u0457",Yopf:"\ud835\udd50",yopf:"\ud835\udd6a",Yscr:"\ud835\udcb4",yscr:"\ud835\udcce",YUcy:"\u042e",yucy:"\u044e",yuml:"\xff",Yuml:"\u0178",Zacute:"\u0179",zacute:"\u017a",Zcaron:"\u017d",zcaron:"\u017e",Zcy:"\u0417",zcy:"\u0437",Zdot:"\u017b",zdot:"\u017c",zeetrf:"\u2128",ZeroWidthSpace:"\u200b",Zeta:"\u0396",zeta:"\u03b6",zfr:"\ud835\udd37",Zfr:"\u2128",ZHcy:"\u0416",zhcy:"\u0436",zigrarr:"\u21dd",zopf:"\ud835\udd6b",Zopf:"\u2124",Zscr:"\ud835\udcb5",zscr:"\ud835\udccf",zwj:"\u200d",zwnj:"\u200c"}},{}],53:[function(e,r,t){"use strict";function n(e){return Array.prototype.slice.call(arguments,1).forEach(function(r){r&&Object.keys(r).forEach(function(t){e[t]=r[t]})}),e}function s(e){return Object.prototype.toString.call(e)}function o(e){return"[object String]"===s(e)}function i(e){return"[object Object]"===s(e)}function a(e){return"[object RegExp]"===s(e)}function c(e){return"[object Function]"===s(e)}function l(e){return e.replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function u(e){return Object.keys(e||{}).reduce(function(e,r){return e||b.hasOwnProperty(r)},!1)}function p(e){e.__index__=-1,e.__text_cache__=""}function h(e){return function(r,t){var n=r.slice(t);return e.test(n)?n.match(e)[0].length:0}}function f(){return function(e,r){r.normalize(e)}}function d(r){function t(e){return e.replace("%TLDS%",s.src_tlds)}function n(e,r){throw new Error('(LinkifyIt) Invalid schema "'+e+'": '+r)}var s=r.re=e("./lib/re")(r.__opts__),u=r.__tlds__.slice();r.onCompile(),r.__tlds_replaced__||u.push(v),u.push(s.src_xn),s.src_tlds=u.join("|"),s.email_fuzzy=RegExp(t(s.tpl_email_fuzzy),"i"),s.link_fuzzy=RegExp(t(s.tpl_link_fuzzy),"i"),s.link_no_ip_fuzzy=RegExp(t(s.tpl_link_no_ip_fuzzy),"i"),s.host_fuzzy_test=RegExp(t(s.tpl_host_fuzzy_test),"i");var d=[];r.__compiled__={},Object.keys(r.__schemas__).forEach(function(e){var t=r.__schemas__[e];if(null!==t){var s={validate:null,link:null};if(r.__compiled__[e]=s,i(t))return a(t.validate)?s.validate=h(t.validate):c(t.validate)?s.validate=t.validate:n(e,t),void(c(t.normalize)?s.normalize=t.normalize:t.normalize?n(e,t):s.normalize=f());o(t)?d.push(e):n(e,t)}}),d.forEach(function(e){r.__compiled__[r.__schemas__[e]]&&(r.__compiled__[e].validate=r.__compiled__[r.__schemas__[e]].validate,r.__compiled__[e].normalize=r.__compiled__[r.__schemas__[e]].normalize)}),r.__compiled__[""]={validate:null,normalize:f()};var m=Object.keys(r.__compiled__).filter(function(e){return e.length>0&&r.__compiled__[e]}).map(l).join("|");r.re.schema_test=RegExp("(^|(?!_)(?:[><\uff5c]|"+s.src_ZPCc+"))("+m+")","i"),r.re.schema_search=RegExp("(^|(?!_)(?:[><\uff5c]|"+s.src_ZPCc+"))("+m+")","ig"),r.re.pretest=RegExp("("+r.re.schema_test.source+")|("+r.re.host_fuzzy_test.source+")|@","i"),p(r)}function m(e,r){var t=e.__index__,n=e.__last_index__,s=e.__text_cache__.slice(t,n);this.schema=e.__schema__.toLowerCase(),this.index=t+r,this.lastIndex=n+r,this.raw=s,this.text=s,this.url=s}function _(e,r){var t=new m(e,r);return e.__compiled__[t.schema].normalize(t,e),t}function g(e,r){if(!(this instanceof g))return new g(e,r);r||u(e)&&(r=e,e={}),this.__opts__=n({},b,r),this.__index__=-1,this.__last_index__=-1,this.__schema__="",this.__text_cache__="",this.__schemas__=n({},k,e),this.__compiled__={},this.__tlds__=x,this.__tlds_replaced__=!1,this.re={},d(this)}var b={fuzzyLink:!0,fuzzyEmail:!0,fuzzyIP:!1},k={"http:":{validate:function(e,r,t){var n=e.slice(r);return t.re.http||(t.re.http=new RegExp("^\\/\\/"+t.re.src_auth+t.re.src_host_port_strict+t.re.src_path,"i")),t.re.http.test(n)?n.match(t.re.http)[0].length:0}},"https:":"http:","ftp:":"http:","//":{validate:function(e,r,t){var n=e.slice(r);return t.re.no_http||(t.re.no_http=new RegExp("^"+t.re.src_auth+"(?:localhost|(?:(?:"+t.re.src_domain+")\\.)+"+t.re.src_domain_root+")"+t.re.src_port+t.re.src_host_terminator+t.re.src_path,"i")),t.re.no_http.test(n)?r>=3&&":"===e[r-3]?0:r>=3&&"/"===e[r-3]?0:n.match(t.re.no_http)[0].length:0}},"mailto:":{validate:function(e,r,t){var n=e.slice(r);return t.re.mailto||(t.re.mailto=new RegExp("^"+t.re.src_email_name+"@"+t.re.src_host_strict,"i")),t.re.mailto.test(n)?n.match(t.re.mailto)[0].length:0}}},v="a[cdefgilmnoqrstuwxz]|b[abdefghijmnorstvwyz]|c[acdfghiklmnoruvwxyz]|d[ejkmoz]|e[cegrstu]|f[ijkmor]|g[abdefghilmnpqrstuwy]|h[kmnrtu]|i[delmnoqrst]|j[emop]|k[eghimnprwyz]|l[abcikrstuvy]|m[acdeghklmnopqrstuvwxyz]|n[acefgilopruz]|om|p[aefghklmnrstwy]|qa|r[eosuw]|s[abcdeghijklmnortuvxyz]|t[cdfghjklmnortvwz]|u[agksyz]|v[aceginu]|w[fs]|y[et]|z[amw]",x="biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|\u0440\u0444".split("|");g.prototype.add=function(e,r){return this.__schemas__[e]=r,d(this),this},g.prototype.set=function(e){return this.__opts__=n(this.__opts__,e),this},g.prototype.test=function(e){if(this.__text_cache__=e,this.__index__=-1,!e.length)return!1;var r,t,n,s,o,i,a,c;if(this.re.schema_test.test(e))for((a=this.re.schema_search).lastIndex=0;null!==(r=a.exec(e));)if(s=this.testSchemaAt(e,r[2],a.lastIndex)){this.__schema__=r[2],this.__index__=r.index+r[1].length,this.__last_index__=r.index+r[0].length+s;break}return this.__opts__.fuzzyLink&&this.__compiled__["http:"]&&(c=e.search(this.re.host_fuzzy_test))>=0&&(this.__index__<0||c<this.__index__)&&null!==(t=e.match(this.__opts__.fuzzyIP?this.re.link_fuzzy:this.re.link_no_ip_fuzzy))&&(o=t.index+t[1].length,(this.__index__<0||o<this.__index__)&&(this.__schema__="",this.__index__=o,this.__last_index__=t.index+t[0].length)),this.__opts__.fuzzyEmail&&this.__compiled__["mailto:"]&&e.indexOf("@")>=0&&null!==(n=e.match(this.re.email_fuzzy))&&(o=n.index+n[1].length,i=n.index+n[0].length,(this.__index__<0||o<this.__index__||o===this.__index__&&i>this.__last_index__)&&(this.__schema__="mailto:",this.__index__=o,this.__last_index__=i)),this.__index__>=0},g.prototype.pretest=function(e){return this.re.pretest.test(e)},g.prototype.testSchemaAt=function(e,r,t){return this.__compiled__[r.toLowerCase()]?this.__compiled__[r.toLowerCase()].validate(e,t,this):0},g.prototype.match=function(e){var r=0,t=[];this.__index__>=0&&this.__text_cache__===e&&(t.push(_(this,r)),r=this.__last_index__);for(var n=r?e.slice(r):e;this.test(n);)t.push(_(this,r)),n=n.slice(this.__last_index__),r+=this.__last_index__;return t.length?t:null},g.prototype.tlds=function(e,r){return e=Array.isArray(e)?e:[e],r?(this.__tlds__=this.__tlds__.concat(e).sort().filter(function(e,r,t){return e!==t[r-1]}).reverse(),d(this),this):(this.__tlds__=e.slice(),this.__tlds_replaced__=!0,d(this),this)},g.prototype.normalize=function(e){e.schema||(e.url="http://"+e.url),"mailto:"!==e.schema||/^mailto:/i.test(e.url)||(e.url="mailto:"+e.url)},g.prototype.onCompile=function(){},r.exports=g},{"./lib/re":54}],54:[function(e,r,t){"use strict";r.exports=function(r){var t={};t.src_Any=e("uc.micro/properties/Any/regex").source,t.src_Cc=e("uc.micro/categories/Cc/regex").source,t.src_Z=e("uc.micro/categories/Z/regex").source,t.src_P=e("uc.micro/categories/P/regex").source,t.src_ZPCc=[t.src_Z,t.src_P,t.src_Cc].join("|"),t.src_ZCc=[t.src_Z,t.src_Cc].join("|");return t.src_pseudo_letter="(?:(?![><\uff5c]|"+t.src_ZPCc+")"+t.src_Any+")",t.src_ip4="(?:(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)",t.src_auth="(?:(?:(?!"+t.src_ZCc+"|[@/\\[\\]()]).)+@)?",t.src_port="(?::(?:6(?:[0-4]\\d{3}|5(?:[0-4]\\d{2}|5(?:[0-2]\\d|3[0-5])))|[1-5]?\\d{1,4}))?",t.src_host_terminator="(?=$|[><\uff5c]|"+t.src_ZPCc+")(?!-|_|:\\d|\\.-|\\.(?!$|"+t.src_ZPCc+"))",t.src_path="(?:[/?#](?:(?!"+t.src_ZCc+"|[><\uff5c]|[()[\\]{}.,\"'?!\\-]).|\\[(?:(?!"+t.src_ZCc+"|\\]).)*\\]|\\((?:(?!"+t.src_ZCc+"|[)]).)*\\)|\\{(?:(?!"+t.src_ZCc+'|[}]).)*\\}|\\"(?:(?!'+t.src_ZCc+'|["]).)+\\"|\\\'(?:(?!'+t.src_ZCc+"|[']).)+\\'|\\'(?="+t.src_pseudo_letter+"|[-]).|\\.{2,3}[a-zA-Z0-9%/]|\\.(?!"+t.src_ZCc+"|[.]).|"+(r&&r["---"]?"\\-(?!--(?:[^-]|$))(?:-*)|":"\\-+|")+"\\,(?!"+t.src_ZCc+").|\\!(?!"+t.src_ZCc+"|[!]).|\\?(?!"+t.src_ZCc+"|[?]).)+|\\/)?",t.src_email_name='[\\-;:&=\\+\\$,\\"\\.a-zA-Z0-9_]+',t.src_xn="xn--[a-z0-9\\-]{1,59}",t.src_domain_root="(?:"+t.src_xn+"|"+t.src_pseudo_letter+"{1,63})",t.src_domain="(?:"+t.src_xn+"|(?:"+t.src_pseudo_letter+")|(?:"+t.src_pseudo_letter+"(?:-(?!-)|"+t.src_pseudo_letter+"){0,61}"+t.src_pseudo_letter+"))",t.src_host="(?:(?:(?:(?:"+t.src_domain+")\\.)*"+t.src_domain+"))",t.tpl_host_fuzzy="(?:"+t.src_ip4+"|(?:(?:(?:"+t.src_domain+")\\.)+(?:%TLDS%)))",t.tpl_host_no_ip_fuzzy="(?:(?:(?:"+t.src_domain+")\\.)+(?:%TLDS%))",t.src_host_strict=t.src_host+t.src_host_terminator,t.tpl_host_fuzzy_strict=t.tpl_host_fuzzy+t.src_host_terminator,t.src_host_port_strict=t.src_host+t.src_port+t.src_host_terminator,t.tpl_host_port_fuzzy_strict=t.tpl_host_fuzzy+t.src_port+t.src_host_terminator,t.tpl_host_port_no_ip_fuzzy_strict=t.tpl_host_no_ip_fuzzy+t.src_port+t.src_host_terminator,t.tpl_host_fuzzy_test="localhost|www\\.|\\.\\d{1,3}\\.|(?:\\.(?:%TLDS%)(?:"+t.src_ZPCc+"|>|$))",t.tpl_email_fuzzy="(^|[><\uff5c]|\\(|"+t.src_ZCc+")("+t.src_email_name+"@"+t.tpl_host_fuzzy_strict+")",t.tpl_link_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`|\uff5c]|"+t.src_ZPCc+"))((?![$+<=>^`|\uff5c])"+t.tpl_host_port_fuzzy_strict+t.src_path+")",t.tpl_link_no_ip_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`|\uff5c]|"+t.src_ZPCc+"))((?![$+<=>^`|\uff5c])"+t.tpl_host_port_no_ip_fuzzy_strict+t.src_path+")",t}},{"uc.micro/categories/Cc/regex":61,"uc.micro/categories/P/regex":63,"uc.micro/categories/Z/regex":64,"uc.micro/properties/Any/regex":66}],55:[function(e,r,t){"use strict";function n(e){var r,t,n=o[e];if(n)return n;for(n=o[e]=[],r=0;r<128;r++)t=String.fromCharCode(r),n.push(t);for(r=0;r<e.length;r++)n[t=e.charCodeAt(r)]="%"+("0"+t.toString(16).toUpperCase()).slice(-2);return n}function s(e,r){var t;return"string"!=typeof r&&(r=s.defaultChars),t=n(r),e.replace(/(%[a-f0-9]{2})+/gi,function(e){var r,n,s,o,i,a,c,l="";for(r=0,n=e.length;r<n;r+=3)(s=parseInt(e.slice(r+1,r+3),16))<128?l+=t[s]:192==(224&s)&&r+3<n&&128==(192&(o=parseInt(e.slice(r+4,r+6),16)))?(l+=(c=s<<6&1984|63&o)<128?"\ufffd\ufffd":String.fromCharCode(c),r+=3):224==(240&s)&&r+6<n&&(o=parseInt(e.slice(r+4,r+6),16),i=parseInt(e.slice(r+7,r+9),16),128==(192&o)&&128==(192&i))?(l+=(c=s<<12&61440|o<<6&4032|63&i)<2048||c>=55296&&c<=57343?"\ufffd\ufffd\ufffd":String.fromCharCode(c),r+=6):240==(248&s)&&r+9<n&&(o=parseInt(e.slice(r+4,r+6),16),i=parseInt(e.slice(r+7,r+9),16),a=parseInt(e.slice(r+10,r+12),16),128==(192&o)&&128==(192&i)&&128==(192&a))?((c=s<<18&1835008|o<<12&258048|i<<6&4032|63&a)<65536||c>1114111?l+="\ufffd\ufffd\ufffd\ufffd":(c-=65536,l+=String.fromCharCode(55296+(c>>10),56320+(1023&c))),r+=9):l+="\ufffd";return l})}var o={};s.defaultChars=";/?:@&=+$,#",s.componentChars="",r.exports=s},{}],56:[function(e,r,t){"use strict";function n(e){var r,t,n=o[e];if(n)return n;for(n=o[e]=[],r=0;r<128;r++)t=String.fromCharCode(r),/^[0-9a-z]$/i.test(t)?n.push(t):n.push("%"+("0"+r.toString(16).toUpperCase()).slice(-2));for(r=0;r<e.length;r++)n[e.charCodeAt(r)]=e[r];return n}function s(e,r,t){var o,i,a,c,l,u="";for("string"!=typeof r&&(t=r,r=s.defaultChars),void 0===t&&(t=!0),l=n(r),o=0,i=e.length;o<i;o++)if(a=e.charCodeAt(o),t&&37===a&&o+2<i&&/^[0-9a-f]{2}$/i.test(e.slice(o+1,o+3)))u+=e.slice(o,o+3),o+=2;else if(a<128)u+=l[a];else if(a>=55296&&a<=57343){if(a>=55296&&a<=56319&&o+1<i&&(c=e.charCodeAt(o+1))>=56320&&c<=57343){u+=encodeURIComponent(e[o]+e[o+1]),o++;continue}u+="%EF%BF%BD"}else u+=encodeURIComponent(e[o]);return u}var o={};s.defaultChars=";/?:@&=+$,-_.!~*'()#",s.componentChars="-_.!~*'()",r.exports=s},{}],57:[function(e,r,t){"use strict";r.exports=function(e){var r="";return r+=e.protocol||"",r+=e.slashes?"//":"",r+=e.auth?e.auth+"@":"",e.hostname&&-1!==e.hostname.indexOf(":")?r+="["+e.hostname+"]":r+=e.hostname||"",r+=e.port?":"+e.port:"",r+=e.pathname||"",r+=e.search||"",r+=e.hash||""}},{}],58:[function(e,r,t){"use strict";r.exports.encode=e("./encode"),r.exports.decode=e("./decode"),r.exports.format=e("./format"),r.exports.parse=e("./parse")},{"./decode":55,"./encode":56,"./format":57,"./parse":59}],59:[function(e,r,t){"use strict";function n(){this.protocol=null,this.slashes=null,this.auth=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.pathname=null}var s=/^([a-z0-9.+-]+:)/i,o=/:[0-9]*$/,i=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,a=["<",">",'"',"`"," ","\r","\n","\t"],c=["{","}","|","\\","^","`"].concat(a),l=["'"].concat(c),u=["%","/","?",";","#"].concat(l),p=["/","?","#"],h=/^[+a-z0-9A-Z_-]{0,63}$/,f=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,d={javascript:!0,"javascript:":!0},m={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0};n.prototype.parse=function(e,r){var t,n,o,a,c,l=e;if(l=l.trim(),!r&&1===e.split("#").length){var _=i.exec(l);if(_)return this.pathname=_[1],_[2]&&(this.search=_[2]),this}var g=s.exec(l);if(g&&(o=(g=g[0]).toLowerCase(),this.protocol=g,l=l.substr(g.length)),(r||g||l.match(/^\/\/[^@\/]+@[^@\/]+/))&&(!(c="//"===l.substr(0,2))||g&&d[g]||(l=l.substr(2),this.slashes=!0)),!d[g]&&(c||g&&!m[g])){var b=-1;for(t=0;t<p.length;t++)-1!==(a=l.indexOf(p[t]))&&(-1===b||a<b)&&(b=a);var k,v;for(-1!==(v=-1===b?l.lastIndexOf("@"):l.lastIndexOf("@",b))&&(k=l.slice(0,v),l=l.slice(v+1),this.auth=k),b=-1,t=0;t<u.length;t++)-1!==(a=l.indexOf(u[t]))&&(-1===b||a<b)&&(b=a);-1===b&&(b=l.length),":"===l[b-1]&&b--;var x=l.slice(0,b);l=l.slice(b),this.parseHost(x),this.hostname=this.hostname||"";var y="["===this.hostname[0]&&"]"===this.hostname[this.hostname.length-1];if(!y){var C=this.hostname.split(/\./);for(t=0,n=C.length;t<n;t++){var A=C[t];if(A&&!A.match(h)){for(var w="",D=0,q=A.length;D<q;D++)A.charCodeAt(D)>127?w+="x":w+=A[D];if(!w.match(h)){var E=C.slice(0,t),S=C.slice(t+1),F=A.match(f);F&&(E.push(F[1]),S.unshift(F[2])),S.length&&(l=S.join(".")+l),this.hostname=E.join(".");break}}}}this.hostname.length>255&&(this.hostname=""),y&&(this.hostname=this.hostname.substr(1,this.hostname.length-2))}var L=l.indexOf("#");-1!==L&&(this.hash=l.substr(L),l=l.slice(0,L));var z=l.indexOf("?");return-1!==z&&(this.search=l.substr(z),l=l.slice(0,z)),l&&(this.pathname=l),m[o]&&this.hostname&&!this.pathname&&(this.pathname=""),this},n.prototype.parseHost=function(e){var r=o.exec(e);r&&(":"!==(r=r[0])&&(this.port=r.substr(1)),e=e.substr(0,e.length-r.length)),e&&(this.hostname=e)},r.exports=function(e,r){if(e&&e instanceof n)return e;var t=new n;return t.parse(e,r),t}},{}],60:[function(e,r,t){(function(e){!function(n){function s(e){throw new RangeError(L[e])}function o(e,r){for(var t=e.length,n=[];t--;)n[t]=r(e[t]);return n}function i(e,r){var t=e.split("@"),n="";return t.length>1&&(n=t[0]+"@",e=t[1]),n+o((e=e.replace(F,".")).split("."),r).join(".")}function a(e){for(var r,t,n=[],s=0,o=e.length;s<o;)(r=e.charCodeAt(s++))>=55296&&r<=56319&&s<o?56320==(64512&(t=e.charCodeAt(s++)))?n.push(((1023&r)<<10)+(1023&t)+65536):(n.push(r),s--):n.push(r);return n}function c(e){return o(e,function(e){var r="";return e>65535&&(r+=I((e-=65536)>>>10&1023|55296),e=56320|1023&e),r+=I(e)}).join("")}function l(e){return e-48<10?e-22:e-65<26?e-65:e-97<26?e-97:v}function u(e,r){return e+22+75*(e<26)-((0!=r)<<5)}function p(e,r,t){var n=0;for(e=t?T(e/A):e>>1,e+=T(e/r);e>z*y>>1;n+=v)e=T(e/z);return T(n+(z+1)*e/(e+C))}function h(e){var r,t,n,o,i,a,u,h,f,d,m=[],_=e.length,g=0,b=D,C=w;for((t=e.lastIndexOf(q))<0&&(t=0),n=0;n<t;++n)e.charCodeAt(n)>=128&&s("not-basic"),m.push(e.charCodeAt(n));for(o=t>0?t+1:0;o<_;){for(i=g,a=1,u=v;o>=_&&s("invalid-input"),((h=l(e.charCodeAt(o++)))>=v||h>T((k-g)/a))&&s("overflow"),g+=h*a,f=u<=C?x:u>=C+y?y:u-C,!(h<f);u+=v)a>T(k/(d=v-f))&&s("overflow"),a*=d;C=p(g-i,r=m.length+1,0==i),T(g/r)>k-b&&s("overflow"),b+=T(g/r),g%=r,m.splice(g++,0,b)}return c(m)}function f(e){var r,t,n,o,i,c,l,h,f,d,m,_,g,b,C,A=[];for(_=(e=a(e)).length,r=D,t=0,i=w,c=0;c<_;++c)(m=e[c])<128&&A.push(I(m));for(n=o=A.length,o&&A.push(q);n<_;){for(l=k,c=0;c<_;++c)(m=e[c])>=r&&m<l&&(l=m);for(l-r>T((k-t)/(g=n+1))&&s("overflow"),t+=(l-r)*g,r=l,c=0;c<_;++c)if((m=e[c])<r&&++t>k&&s("overflow"),m==r){for(h=t,f=v;d=f<=i?x:f>=i+y?y:f-i,!(h<d);f+=v)C=h-d,b=v-d,A.push(I(u(d+C%b,0))),h=T(C/b);A.push(I(u(h,0))),i=p(t,g,n==o),t=0,++n}++t,++r}return A.join("")}var d="object"==typeof t&&t&&!t.nodeType&&t,m="object"==typeof r&&r&&!r.nodeType&&r,_="object"==typeof e&&e;_.global!==_&&_.window!==_&&_.self!==_||(n=_);var g,b,k=2147483647,v=36,x=1,y=26,C=38,A=700,w=72,D=128,q="-",E=/^xn--/,S=/[^\x20-\x7E]/,F=/[\x2E\u3002\uFF0E\uFF61]/g,L={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},z=v-x,T=Math.floor,I=String.fromCharCode;if(g={version:"1.4.1",ucs2:{decode:a,encode:c},decode:h,encode:f,toASCII:function(e){return i(e,function(e){return S.test(e)?"xn--"+f(e):e})},toUnicode:function(e){return i(e,function(e){return E.test(e)?h(e.slice(4).toLowerCase()):e})}},d&&m)if(r.exports==d)m.exports=g;else for(b in g)g.hasOwnProperty(b)&&(d[b]=g[b]);else n.punycode=g}(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],61:[function(e,r,t){r.exports=/[\0-\x1F\x7F-\x9F]/},{}],62:[function(e,r,t){r.exports=/[\xAD\u0600-\u0605\u061C\u06DD\u070F\u08E2\u180E\u200B-\u200F\u202A-\u202E\u2060-\u2064\u2066-\u206F\uFEFF\uFFF9-\uFFFB]|\uD804\uDCBD|\uD82F[\uDCA0-\uDCA3]|\uD834[\uDD73-\uDD7A]|\uDB40[\uDC01\uDC20-\uDC7F]/},{}],63:[function(e,r,t){r.exports=/[!-#%-\*,-/:;\?@\[-\]_\{\}\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E44\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDC4B-\uDC4F\uDC5B\uDC5D\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDE60-\uDE6C\uDF3C-\uDF3E]|\uD807[\uDC41-\uDC45\uDC70\uDC71]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]|\uD83A[\uDD5E\uDD5F]/},{}],64:[function(e,r,t){r.exports=/[ \xA0\u1680\u2000-\u200A\u202F\u205F\u3000]/},{}],65:[function(e,r,t){"use strict";t.Any=e("./properties/Any/regex"),t.Cc=e("./categories/Cc/regex"),t.Cf=e("./categories/Cf/regex"),t.P=e("./categories/P/regex"),t.Z=e("./categories/Z/regex")},{"./categories/Cc/regex":61,"./categories/Cf/regex":62,"./categories/P/regex":63,"./categories/Z/regex":64,"./properties/Any/regex":66}],66:[function(e,r,t){r.exports=/[\0-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/},{}],67:[function(e,r,t){"use strict";r.exports=e("./lib/")},{"./lib/":9}]},{},[67])(67)});
|
@@ -0,0 +1,64 @@
|
|
1
|
+
{
|
2
|
+
"name": "markdown-it",
|
3
|
+
"version": "8.4.0",
|
4
|
+
"description": "Markdown-it - modern pluggable markdown parser.",
|
5
|
+
"keywords": [
|
6
|
+
"markdown",
|
7
|
+
"parser",
|
8
|
+
"commonmark",
|
9
|
+
"markdown-it",
|
10
|
+
"markdown-it-plugin"
|
11
|
+
],
|
12
|
+
"repository": "markdown-it/markdown-it",
|
13
|
+
"license": "MIT",
|
14
|
+
"main": "index.js",
|
15
|
+
"bin": {
|
16
|
+
"markdown-it": "bin/markdown-it.js"
|
17
|
+
},
|
18
|
+
"scripts": {
|
19
|
+
"test": "make test",
|
20
|
+
"heroku-postbuild": "npm install express"
|
21
|
+
},
|
22
|
+
"files": [
|
23
|
+
"index.js",
|
24
|
+
"bin/",
|
25
|
+
"lib/",
|
26
|
+
"dist/"
|
27
|
+
],
|
28
|
+
"dependencies": {
|
29
|
+
"argparse": "^1.0.7",
|
30
|
+
"entities": "~1.1.1",
|
31
|
+
"linkify-it": "^2.0.0",
|
32
|
+
"mdurl": "^1.0.1",
|
33
|
+
"uc.micro": "^1.0.3"
|
34
|
+
},
|
35
|
+
"devDependencies": {
|
36
|
+
"ansi": "^0.3.0",
|
37
|
+
"autoprefixer-stylus": "^0.11.0",
|
38
|
+
"benchmark": "~2.1.0",
|
39
|
+
"browserify": "*",
|
40
|
+
"chai": "^3.4.1",
|
41
|
+
"coveralls": "~2.11.9",
|
42
|
+
"eslint": "^3.5.0",
|
43
|
+
"express": "^4.14.0",
|
44
|
+
"highlight.js": "^9.2.0",
|
45
|
+
"istanbul": "^0.4.5",
|
46
|
+
"jade": "~1.11.0",
|
47
|
+
"markdown-it-abbr": "^1.0.4",
|
48
|
+
"markdown-it-container": "^2.0.0",
|
49
|
+
"markdown-it-deflist": "^2.0.0",
|
50
|
+
"markdown-it-emoji": "^1.1.1",
|
51
|
+
"markdown-it-footnote": "^3.0.1",
|
52
|
+
"markdown-it-for-inline": "~0.1.0",
|
53
|
+
"markdown-it-ins": "^2.0.0",
|
54
|
+
"markdown-it-mark": "^2.0.0",
|
55
|
+
"markdown-it-sub": "^1.0.0",
|
56
|
+
"markdown-it-sup": "^1.0.0",
|
57
|
+
"markdown-it-testgen": "~0.1.3",
|
58
|
+
"mocha": "*",
|
59
|
+
"ndoc": "^5.0.0",
|
60
|
+
"stylus": "~0.54.2",
|
61
|
+
"supertest": "^3.0.0",
|
62
|
+
"uglify-js": "^3.0.18"
|
63
|
+
}
|
64
|
+
}
|
@@ -0,0 +1,29 @@
|
|
1
|
+
{
|
2
|
+
"name": "plantuml-encoder",
|
3
|
+
"main": "dist/plantuml-encoder.js",
|
4
|
+
"version": "1.2.5",
|
5
|
+
"homepage": "https://github.com/markushedvall/plantuml-encoder",
|
6
|
+
"authors": [
|
7
|
+
"Markus Hedvall <mackanhedvall@gmail.com>"
|
8
|
+
],
|
9
|
+
"description": "PlantUML encoder, works in browser & node.js",
|
10
|
+
"license": "MIT",
|
11
|
+
"ignore": [
|
12
|
+
"**/.*",
|
13
|
+
"node_modules",
|
14
|
+
"bower_components",
|
15
|
+
"test",
|
16
|
+
"tests",
|
17
|
+
"lib",
|
18
|
+
"index.js"
|
19
|
+
],
|
20
|
+
"_release": "1.2.5",
|
21
|
+
"_resolution": {
|
22
|
+
"type": "version",
|
23
|
+
"tag": "v1.2.5",
|
24
|
+
"commit": "1c9d04c3764b18150de6e1f864c470beeb40140e"
|
25
|
+
},
|
26
|
+
"_source": "https://github.com/markushedvall/plantuml-encoder.git",
|
27
|
+
"_target": "^1.2.5",
|
28
|
+
"_originalSource": "plantuml-encoder"
|
29
|
+
}
|
@@ -0,0 +1,19 @@
|
|
1
|
+
Copyright (C) 2015 by Markus Hedvall
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
of this software and associated documentation files (the "Software"), to deal
|
5
|
+
in the Software without restriction, including without limitation the rights
|
6
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
copies of the Software, and to permit persons to whom the Software is
|
8
|
+
furnished to do so, subject to the following conditions:
|
9
|
+
|
10
|
+
The above copyright notice and this permission notice shall be included in
|
11
|
+
all copies or substantial portions of the Software.
|
12
|
+
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
+
THE SOFTWARE.
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# plantuml-encoder
|
2
|
+
PlantUML encoder for browsers and Node.js.
|
3
|
+
|
4
|
+
[![npm Version](https://img.shields.io/npm/v/plantuml-encoder.svg)](https://www.npmjs.com/package/plantuml-encoder) [![build-status](https://travis-ci.org/markushedvall/plantuml-encoder.svg?branch=master)](https://travis-ci.org/markushedvall/plantuml-encoder) [![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat)](https://github.com/feross/standard)
|
5
|
+
|
6
|
+
Encoded PlantUML can be used to create PlantUML URL links.
|
7
|
+
|
8
|
+
# Install
|
9
|
+
|
10
|
+
Node.js:
|
11
|
+
|
12
|
+
```
|
13
|
+
npm install plantuml-encoder
|
14
|
+
```
|
15
|
+
|
16
|
+
browser:
|
17
|
+
|
18
|
+
```
|
19
|
+
bower install plantuml-encoder
|
20
|
+
```
|
21
|
+
|
22
|
+
# Example
|
23
|
+
|
24
|
+
```javascript
|
25
|
+
var plantumlEncoder = require('plantuml-encoder')
|
26
|
+
|
27
|
+
var encoded = plantumlEncoder.encode('A -> B: Hello')
|
28
|
+
console.log(encoded) // SrJGjLDmibBmICt9oGS0
|
29
|
+
|
30
|
+
var url = 'http://www.plantuml.com/plantuml/img/' + encoded
|
31
|
+
```
|
32
|
+
|
33
|
+
The URL can then be used to display the diagram:
|
34
|
+
|
35
|
+
![alt tag](http://www.plantuml.com/plantuml/img/SrJGjLDmibBmICt9oGS0)
|
36
|
+
|
37
|
+
# License
|
38
|
+
MIT
|
@@ -0,0 +1,20 @@
|
|
1
|
+
{
|
2
|
+
"name": "plantuml-encoder",
|
3
|
+
"main": "dist/plantuml-encoder.js",
|
4
|
+
"version": "1.2.4",
|
5
|
+
"homepage": "https://github.com/markushedvall/plantuml-encoder",
|
6
|
+
"authors": [
|
7
|
+
"Markus Hedvall <mackanhedvall@gmail.com>"
|
8
|
+
],
|
9
|
+
"description": "PlantUML encoder, works in browser & node.js",
|
10
|
+
"license": "MIT",
|
11
|
+
"ignore": [
|
12
|
+
"**/.*",
|
13
|
+
"node_modules",
|
14
|
+
"bower_components",
|
15
|
+
"test",
|
16
|
+
"tests",
|
17
|
+
"lib",
|
18
|
+
"index.js"
|
19
|
+
]
|
20
|
+
}
|
@@ -0,0 +1,3994 @@
|
|
1
|
+
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.plantumlEncoder = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
|
2
|
+
module.exports = require('./lib/plantuml-encoder')
|
3
|
+
|
4
|
+
},{"./lib/plantuml-encoder":3}],2:[function(require,module,exports){
|
5
|
+
'use strict'
|
6
|
+
|
7
|
+
// Encode code taken from the PlantUML website:
|
8
|
+
// http://plantuml.sourceforge.net/codejavascript2.html
|
9
|
+
|
10
|
+
// It is described as being "a transformation close to base64"
|
11
|
+
// The code has been slightly modified to pass linters
|
12
|
+
|
13
|
+
function encode6bit (b) {
|
14
|
+
if (b < 10) {
|
15
|
+
return String.fromCharCode(48 + b)
|
16
|
+
}
|
17
|
+
b -= 10
|
18
|
+
if (b < 26) {
|
19
|
+
return String.fromCharCode(65 + b)
|
20
|
+
}
|
21
|
+
b -= 26
|
22
|
+
if (b < 26) {
|
23
|
+
return String.fromCharCode(97 + b)
|
24
|
+
}
|
25
|
+
b -= 26
|
26
|
+
if (b === 0) {
|
27
|
+
return '-'
|
28
|
+
}
|
29
|
+
if (b === 1) {
|
30
|
+
return '_'
|
31
|
+
}
|
32
|
+
return '?'
|
33
|
+
}
|
34
|
+
|
35
|
+
function append3bytes (b1, b2, b3) {
|
36
|
+
var c1 = b1 >> 2
|
37
|
+
var c2 = ((b1 & 0x3) << 4) | (b2 >> 4)
|
38
|
+
var c3 = ((b2 & 0xF) << 2) | (b3 >> 6)
|
39
|
+
var c4 = b3 & 0x3F
|
40
|
+
var r = ''
|
41
|
+
r += encode6bit(c1 & 0x3F)
|
42
|
+
r += encode6bit(c2 & 0x3F)
|
43
|
+
r += encode6bit(c3 & 0x3F)
|
44
|
+
r += encode6bit(c4 & 0x3F)
|
45
|
+
return r
|
46
|
+
}
|
47
|
+
|
48
|
+
module.exports.encode = function (data) {
|
49
|
+
var r = ''
|
50
|
+
for (var i = 0; i < data.length; i += 3) {
|
51
|
+
if (i + 2 === data.length) {
|
52
|
+
r += append3bytes(data.charCodeAt(i), data.charCodeAt(i + 1), 0)
|
53
|
+
} else if (i + 1 === data.length) {
|
54
|
+
r += append3bytes(data.charCodeAt(i), 0, 0)
|
55
|
+
} else {
|
56
|
+
r += append3bytes(data.charCodeAt(i),
|
57
|
+
data.charCodeAt(i + 1),
|
58
|
+
data.charCodeAt(i + 2))
|
59
|
+
}
|
60
|
+
}
|
61
|
+
return r
|
62
|
+
}
|
63
|
+
|
64
|
+
},{}],3:[function(require,module,exports){
|
65
|
+
'use strict'
|
66
|
+
|
67
|
+
var utf8bytes = require('utf8-bytes')
|
68
|
+
var pakoDeflate = require('pako/lib/deflate.js')
|
69
|
+
var encode64 = require('./encode64')
|
70
|
+
|
71
|
+
// 1. Encode in UTF-8
|
72
|
+
// 2. Compress using Deflate algorithm
|
73
|
+
// 3. Reencode using a transformation close to base64
|
74
|
+
|
75
|
+
module.exports.encode = function (text) {
|
76
|
+
var data = utf8bytes(text)
|
77
|
+
var deflated = pakoDeflate.deflate(data, { level: 9, to: 'string', raw: true })
|
78
|
+
return encode64.encode(deflated)
|
79
|
+
}
|
80
|
+
|
81
|
+
},{"./encode64":2,"pako/lib/deflate.js":4,"utf8-bytes":13}],4:[function(require,module,exports){
|
82
|
+
'use strict';
|
83
|
+
|
84
|
+
|
85
|
+
var zlib_deflate = require('./zlib/deflate');
|
86
|
+
var utils = require('./utils/common');
|
87
|
+
var strings = require('./utils/strings');
|
88
|
+
var msg = require('./zlib/messages');
|
89
|
+
var ZStream = require('./zlib/zstream');
|
90
|
+
|
91
|
+
var toString = Object.prototype.toString;
|
92
|
+
|
93
|
+
/* Public constants ==========================================================*/
|
94
|
+
/* ===========================================================================*/
|
95
|
+
|
96
|
+
var Z_NO_FLUSH = 0;
|
97
|
+
var Z_FINISH = 4;
|
98
|
+
|
99
|
+
var Z_OK = 0;
|
100
|
+
var Z_STREAM_END = 1;
|
101
|
+
var Z_SYNC_FLUSH = 2;
|
102
|
+
|
103
|
+
var Z_DEFAULT_COMPRESSION = -1;
|
104
|
+
|
105
|
+
var Z_DEFAULT_STRATEGY = 0;
|
106
|
+
|
107
|
+
var Z_DEFLATED = 8;
|
108
|
+
|
109
|
+
/* ===========================================================================*/
|
110
|
+
|
111
|
+
|
112
|
+
/**
|
113
|
+
* class Deflate
|
114
|
+
*
|
115
|
+
* Generic JS-style wrapper for zlib calls. If you don't need
|
116
|
+
* streaming behaviour - use more simple functions: [[deflate]],
|
117
|
+
* [[deflateRaw]] and [[gzip]].
|
118
|
+
**/
|
119
|
+
|
120
|
+
/* internal
|
121
|
+
* Deflate.chunks -> Array
|
122
|
+
*
|
123
|
+
* Chunks of output data, if [[Deflate#onData]] not overriden.
|
124
|
+
**/
|
125
|
+
|
126
|
+
/**
|
127
|
+
* Deflate.result -> Uint8Array|Array
|
128
|
+
*
|
129
|
+
* Compressed result, generated by default [[Deflate#onData]]
|
130
|
+
* and [[Deflate#onEnd]] handlers. Filled after you push last chunk
|
131
|
+
* (call [[Deflate#push]] with `Z_FINISH` / `true` param) or if you
|
132
|
+
* push a chunk with explicit flush (call [[Deflate#push]] with
|
133
|
+
* `Z_SYNC_FLUSH` param).
|
134
|
+
**/
|
135
|
+
|
136
|
+
/**
|
137
|
+
* Deflate.err -> Number
|
138
|
+
*
|
139
|
+
* Error code after deflate finished. 0 (Z_OK) on success.
|
140
|
+
* You will not need it in real life, because deflate errors
|
141
|
+
* are possible only on wrong options or bad `onData` / `onEnd`
|
142
|
+
* custom handlers.
|
143
|
+
**/
|
144
|
+
|
145
|
+
/**
|
146
|
+
* Deflate.msg -> String
|
147
|
+
*
|
148
|
+
* Error message, if [[Deflate.err]] != 0
|
149
|
+
**/
|
150
|
+
|
151
|
+
|
152
|
+
/**
|
153
|
+
* new Deflate(options)
|
154
|
+
* - options (Object): zlib deflate options.
|
155
|
+
*
|
156
|
+
* Creates new deflator instance with specified params. Throws exception
|
157
|
+
* on bad params. Supported options:
|
158
|
+
*
|
159
|
+
* - `level`
|
160
|
+
* - `windowBits`
|
161
|
+
* - `memLevel`
|
162
|
+
* - `strategy`
|
163
|
+
* - `dictionary`
|
164
|
+
*
|
165
|
+
* [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced)
|
166
|
+
* for more information on these.
|
167
|
+
*
|
168
|
+
* Additional options, for internal needs:
|
169
|
+
*
|
170
|
+
* - `chunkSize` - size of generated data chunks (16K by default)
|
171
|
+
* - `raw` (Boolean) - do raw deflate
|
172
|
+
* - `gzip` (Boolean) - create gzip wrapper
|
173
|
+
* - `to` (String) - if equal to 'string', then result will be "binary string"
|
174
|
+
* (each char code [0..255])
|
175
|
+
* - `header` (Object) - custom header for gzip
|
176
|
+
* - `text` (Boolean) - true if compressed data believed to be text
|
177
|
+
* - `time` (Number) - modification time, unix timestamp
|
178
|
+
* - `os` (Number) - operation system code
|
179
|
+
* - `extra` (Array) - array of bytes with extra data (max 65536)
|
180
|
+
* - `name` (String) - file name (binary string)
|
181
|
+
* - `comment` (String) - comment (binary string)
|
182
|
+
* - `hcrc` (Boolean) - true if header crc should be added
|
183
|
+
*
|
184
|
+
* ##### Example:
|
185
|
+
*
|
186
|
+
* ```javascript
|
187
|
+
* var pako = require('pako')
|
188
|
+
* , chunk1 = Uint8Array([1,2,3,4,5,6,7,8,9])
|
189
|
+
* , chunk2 = Uint8Array([10,11,12,13,14,15,16,17,18,19]);
|
190
|
+
*
|
191
|
+
* var deflate = new pako.Deflate({ level: 3});
|
192
|
+
*
|
193
|
+
* deflate.push(chunk1, false);
|
194
|
+
* deflate.push(chunk2, true); // true -> last chunk
|
195
|
+
*
|
196
|
+
* if (deflate.err) { throw new Error(deflate.err); }
|
197
|
+
*
|
198
|
+
* console.log(deflate.result);
|
199
|
+
* ```
|
200
|
+
**/
|
201
|
+
function Deflate(options) {
|
202
|
+
if (!(this instanceof Deflate)) return new Deflate(options);
|
203
|
+
|
204
|
+
this.options = utils.assign({
|
205
|
+
level: Z_DEFAULT_COMPRESSION,
|
206
|
+
method: Z_DEFLATED,
|
207
|
+
chunkSize: 16384,
|
208
|
+
windowBits: 15,
|
209
|
+
memLevel: 8,
|
210
|
+
strategy: Z_DEFAULT_STRATEGY,
|
211
|
+
to: ''
|
212
|
+
}, options || {});
|
213
|
+
|
214
|
+
var opt = this.options;
|
215
|
+
|
216
|
+
if (opt.raw && (opt.windowBits > 0)) {
|
217
|
+
opt.windowBits = -opt.windowBits;
|
218
|
+
}
|
219
|
+
|
220
|
+
else if (opt.gzip && (opt.windowBits > 0) && (opt.windowBits < 16)) {
|
221
|
+
opt.windowBits += 16;
|
222
|
+
}
|
223
|
+
|
224
|
+
this.err = 0; // error code, if happens (0 = Z_OK)
|
225
|
+
this.msg = ''; // error message
|
226
|
+
this.ended = false; // used to avoid multiple onEnd() calls
|
227
|
+
this.chunks = []; // chunks of compressed data
|
228
|
+
|
229
|
+
this.strm = new ZStream();
|
230
|
+
this.strm.avail_out = 0;
|
231
|
+
|
232
|
+
var status = zlib_deflate.deflateInit2(
|
233
|
+
this.strm,
|
234
|
+
opt.level,
|
235
|
+
opt.method,
|
236
|
+
opt.windowBits,
|
237
|
+
opt.memLevel,
|
238
|
+
opt.strategy
|
239
|
+
);
|
240
|
+
|
241
|
+
if (status !== Z_OK) {
|
242
|
+
throw new Error(msg[status]);
|
243
|
+
}
|
244
|
+
|
245
|
+
if (opt.header) {
|
246
|
+
zlib_deflate.deflateSetHeader(this.strm, opt.header);
|
247
|
+
}
|
248
|
+
|
249
|
+
if (opt.dictionary) {
|
250
|
+
var dict;
|
251
|
+
// Convert data if needed
|
252
|
+
if (typeof opt.dictionary === 'string') {
|
253
|
+
// If we need to compress text, change encoding to utf8.
|
254
|
+
dict = strings.string2buf(opt.dictionary);
|
255
|
+
} else if (toString.call(opt.dictionary) === '[object ArrayBuffer]') {
|
256
|
+
dict = new Uint8Array(opt.dictionary);
|
257
|
+
} else {
|
258
|
+
dict = opt.dictionary;
|
259
|
+
}
|
260
|
+
|
261
|
+
status = zlib_deflate.deflateSetDictionary(this.strm, dict);
|
262
|
+
|
263
|
+
if (status !== Z_OK) {
|
264
|
+
throw new Error(msg[status]);
|
265
|
+
}
|
266
|
+
|
267
|
+
this._dict_set = true;
|
268
|
+
}
|
269
|
+
}
|
270
|
+
|
271
|
+
/**
|
272
|
+
* Deflate#push(data[, mode]) -> Boolean
|
273
|
+
* - data (Uint8Array|Array|ArrayBuffer|String): input data. Strings will be
|
274
|
+
* converted to utf8 byte sequence.
|
275
|
+
* - mode (Number|Boolean): 0..6 for corresponding Z_NO_FLUSH..Z_TREE modes.
|
276
|
+
* See constants. Skipped or `false` means Z_NO_FLUSH, `true` meansh Z_FINISH.
|
277
|
+
*
|
278
|
+
* Sends input data to deflate pipe, generating [[Deflate#onData]] calls with
|
279
|
+
* new compressed chunks. Returns `true` on success. The last data block must have
|
280
|
+
* mode Z_FINISH (or `true`). That will flush internal pending buffers and call
|
281
|
+
* [[Deflate#onEnd]]. For interim explicit flushes (without ending the stream) you
|
282
|
+
* can use mode Z_SYNC_FLUSH, keeping the compression context.
|
283
|
+
*
|
284
|
+
* On fail call [[Deflate#onEnd]] with error code and return false.
|
285
|
+
*
|
286
|
+
* We strongly recommend to use `Uint8Array` on input for best speed (output
|
287
|
+
* array format is detected automatically). Also, don't skip last param and always
|
288
|
+
* use the same type in your code (boolean or number). That will improve JS speed.
|
289
|
+
*
|
290
|
+
* For regular `Array`-s make sure all elements are [0..255].
|
291
|
+
*
|
292
|
+
* ##### Example
|
293
|
+
*
|
294
|
+
* ```javascript
|
295
|
+
* push(chunk, false); // push one of data chunks
|
296
|
+
* ...
|
297
|
+
* push(chunk, true); // push last chunk
|
298
|
+
* ```
|
299
|
+
**/
|
300
|
+
Deflate.prototype.push = function (data, mode) {
|
301
|
+
var strm = this.strm;
|
302
|
+
var chunkSize = this.options.chunkSize;
|
303
|
+
var status, _mode;
|
304
|
+
|
305
|
+
if (this.ended) { return false; }
|
306
|
+
|
307
|
+
_mode = (mode === ~~mode) ? mode : ((mode === true) ? Z_FINISH : Z_NO_FLUSH);
|
308
|
+
|
309
|
+
// Convert data if needed
|
310
|
+
if (typeof data === 'string') {
|
311
|
+
// If we need to compress text, change encoding to utf8.
|
312
|
+
strm.input = strings.string2buf(data);
|
313
|
+
} else if (toString.call(data) === '[object ArrayBuffer]') {
|
314
|
+
strm.input = new Uint8Array(data);
|
315
|
+
} else {
|
316
|
+
strm.input = data;
|
317
|
+
}
|
318
|
+
|
319
|
+
strm.next_in = 0;
|
320
|
+
strm.avail_in = strm.input.length;
|
321
|
+
|
322
|
+
do {
|
323
|
+
if (strm.avail_out === 0) {
|
324
|
+
strm.output = new utils.Buf8(chunkSize);
|
325
|
+
strm.next_out = 0;
|
326
|
+
strm.avail_out = chunkSize;
|
327
|
+
}
|
328
|
+
status = zlib_deflate.deflate(strm, _mode); /* no bad return value */
|
329
|
+
|
330
|
+
if (status !== Z_STREAM_END && status !== Z_OK) {
|
331
|
+
this.onEnd(status);
|
332
|
+
this.ended = true;
|
333
|
+
return false;
|
334
|
+
}
|
335
|
+
if (strm.avail_out === 0 || (strm.avail_in === 0 && (_mode === Z_FINISH || _mode === Z_SYNC_FLUSH))) {
|
336
|
+
if (this.options.to === 'string') {
|
337
|
+
this.onData(strings.buf2binstring(utils.shrinkBuf(strm.output, strm.next_out)));
|
338
|
+
} else {
|
339
|
+
this.onData(utils.shrinkBuf(strm.output, strm.next_out));
|
340
|
+
}
|
341
|
+
}
|
342
|
+
} while ((strm.avail_in > 0 || strm.avail_out === 0) && status !== Z_STREAM_END);
|
343
|
+
|
344
|
+
// Finalize on the last chunk.
|
345
|
+
if (_mode === Z_FINISH) {
|
346
|
+
status = zlib_deflate.deflateEnd(this.strm);
|
347
|
+
this.onEnd(status);
|
348
|
+
this.ended = true;
|
349
|
+
return status === Z_OK;
|
350
|
+
}
|
351
|
+
|
352
|
+
// callback interim results if Z_SYNC_FLUSH.
|
353
|
+
if (_mode === Z_SYNC_FLUSH) {
|
354
|
+
this.onEnd(Z_OK);
|
355
|
+
strm.avail_out = 0;
|
356
|
+
return true;
|
357
|
+
}
|
358
|
+
|
359
|
+
return true;
|
360
|
+
};
|
361
|
+
|
362
|
+
|
363
|
+
/**
|
364
|
+
* Deflate#onData(chunk) -> Void
|
365
|
+
* - chunk (Uint8Array|Array|String): ouput data. Type of array depends
|
366
|
+
* on js engine support. When string output requested, each chunk
|
367
|
+
* will be string.
|
368
|
+
*
|
369
|
+
* By default, stores data blocks in `chunks[]` property and glue
|
370
|
+
* those in `onEnd`. Override this handler, if you need another behaviour.
|
371
|
+
**/
|
372
|
+
Deflate.prototype.onData = function (chunk) {
|
373
|
+
this.chunks.push(chunk);
|
374
|
+
};
|
375
|
+
|
376
|
+
|
377
|
+
/**
|
378
|
+
* Deflate#onEnd(status) -> Void
|
379
|
+
* - status (Number): deflate status. 0 (Z_OK) on success,
|
380
|
+
* other if not.
|
381
|
+
*
|
382
|
+
* Called once after you tell deflate that the input stream is
|
383
|
+
* complete (Z_FINISH) or should be flushed (Z_SYNC_FLUSH)
|
384
|
+
* or if an error happened. By default - join collected chunks,
|
385
|
+
* free memory and fill `results` / `err` properties.
|
386
|
+
**/
|
387
|
+
Deflate.prototype.onEnd = function (status) {
|
388
|
+
// On success - join
|
389
|
+
if (status === Z_OK) {
|
390
|
+
if (this.options.to === 'string') {
|
391
|
+
this.result = this.chunks.join('');
|
392
|
+
} else {
|
393
|
+
this.result = utils.flattenChunks(this.chunks);
|
394
|
+
}
|
395
|
+
}
|
396
|
+
this.chunks = [];
|
397
|
+
this.err = status;
|
398
|
+
this.msg = this.strm.msg;
|
399
|
+
};
|
400
|
+
|
401
|
+
|
402
|
+
/**
|
403
|
+
* deflate(data[, options]) -> Uint8Array|Array|String
|
404
|
+
* - data (Uint8Array|Array|String): input data to compress.
|
405
|
+
* - options (Object): zlib deflate options.
|
406
|
+
*
|
407
|
+
* Compress `data` with deflate algorithm and `options`.
|
408
|
+
*
|
409
|
+
* Supported options are:
|
410
|
+
*
|
411
|
+
* - level
|
412
|
+
* - windowBits
|
413
|
+
* - memLevel
|
414
|
+
* - strategy
|
415
|
+
* - dictionary
|
416
|
+
*
|
417
|
+
* [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced)
|
418
|
+
* for more information on these.
|
419
|
+
*
|
420
|
+
* Sugar (options):
|
421
|
+
*
|
422
|
+
* - `raw` (Boolean) - say that we work with raw stream, if you don't wish to specify
|
423
|
+
* negative windowBits implicitly.
|
424
|
+
* - `to` (String) - if equal to 'string', then result will be "binary string"
|
425
|
+
* (each char code [0..255])
|
426
|
+
*
|
427
|
+
* ##### Example:
|
428
|
+
*
|
429
|
+
* ```javascript
|
430
|
+
* var pako = require('pako')
|
431
|
+
* , data = Uint8Array([1,2,3,4,5,6,7,8,9]);
|
432
|
+
*
|
433
|
+
* console.log(pako.deflate(data));
|
434
|
+
* ```
|
435
|
+
**/
|
436
|
+
function deflate(input, options) {
|
437
|
+
var deflator = new Deflate(options);
|
438
|
+
|
439
|
+
deflator.push(input, true);
|
440
|
+
|
441
|
+
// That will never happens, if you don't cheat with options :)
|
442
|
+
if (deflator.err) { throw deflator.msg; }
|
443
|
+
|
444
|
+
return deflator.result;
|
445
|
+
}
|
446
|
+
|
447
|
+
|
448
|
+
/**
|
449
|
+
* deflateRaw(data[, options]) -> Uint8Array|Array|String
|
450
|
+
* - data (Uint8Array|Array|String): input data to compress.
|
451
|
+
* - options (Object): zlib deflate options.
|
452
|
+
*
|
453
|
+
* The same as [[deflate]], but creates raw data, without wrapper
|
454
|
+
* (header and adler32 crc).
|
455
|
+
**/
|
456
|
+
function deflateRaw(input, options) {
|
457
|
+
options = options || {};
|
458
|
+
options.raw = true;
|
459
|
+
return deflate(input, options);
|
460
|
+
}
|
461
|
+
|
462
|
+
|
463
|
+
/**
|
464
|
+
* gzip(data[, options]) -> Uint8Array|Array|String
|
465
|
+
* - data (Uint8Array|Array|String): input data to compress.
|
466
|
+
* - options (Object): zlib deflate options.
|
467
|
+
*
|
468
|
+
* The same as [[deflate]], but create gzip wrapper instead of
|
469
|
+
* deflate one.
|
470
|
+
**/
|
471
|
+
function gzip(input, options) {
|
472
|
+
options = options || {};
|
473
|
+
options.gzip = true;
|
474
|
+
return deflate(input, options);
|
475
|
+
}
|
476
|
+
|
477
|
+
|
478
|
+
exports.Deflate = Deflate;
|
479
|
+
exports.deflate = deflate;
|
480
|
+
exports.deflateRaw = deflateRaw;
|
481
|
+
exports.gzip = gzip;
|
482
|
+
|
483
|
+
},{"./utils/common":5,"./utils/strings":6,"./zlib/deflate":9,"./zlib/messages":10,"./zlib/zstream":12}],5:[function(require,module,exports){
|
484
|
+
'use strict';
|
485
|
+
|
486
|
+
|
487
|
+
var TYPED_OK = (typeof Uint8Array !== 'undefined') &&
|
488
|
+
(typeof Uint16Array !== 'undefined') &&
|
489
|
+
(typeof Int32Array !== 'undefined');
|
490
|
+
|
491
|
+
|
492
|
+
exports.assign = function (obj /*from1, from2, from3, ...*/) {
|
493
|
+
var sources = Array.prototype.slice.call(arguments, 1);
|
494
|
+
while (sources.length) {
|
495
|
+
var source = sources.shift();
|
496
|
+
if (!source) { continue; }
|
497
|
+
|
498
|
+
if (typeof source !== 'object') {
|
499
|
+
throw new TypeError(source + 'must be non-object');
|
500
|
+
}
|
501
|
+
|
502
|
+
for (var p in source) {
|
503
|
+
if (source.hasOwnProperty(p)) {
|
504
|
+
obj[p] = source[p];
|
505
|
+
}
|
506
|
+
}
|
507
|
+
}
|
508
|
+
|
509
|
+
return obj;
|
510
|
+
};
|
511
|
+
|
512
|
+
|
513
|
+
// reduce buffer size, avoiding mem copy
|
514
|
+
exports.shrinkBuf = function (buf, size) {
|
515
|
+
if (buf.length === size) { return buf; }
|
516
|
+
if (buf.subarray) { return buf.subarray(0, size); }
|
517
|
+
buf.length = size;
|
518
|
+
return buf;
|
519
|
+
};
|
520
|
+
|
521
|
+
|
522
|
+
var fnTyped = {
|
523
|
+
arraySet: function (dest, src, src_offs, len, dest_offs) {
|
524
|
+
if (src.subarray && dest.subarray) {
|
525
|
+
dest.set(src.subarray(src_offs, src_offs + len), dest_offs);
|
526
|
+
return;
|
527
|
+
}
|
528
|
+
// Fallback to ordinary array
|
529
|
+
for (var i = 0; i < len; i++) {
|
530
|
+
dest[dest_offs + i] = src[src_offs + i];
|
531
|
+
}
|
532
|
+
},
|
533
|
+
// Join array of chunks to single array.
|
534
|
+
flattenChunks: function (chunks) {
|
535
|
+
var i, l, len, pos, chunk, result;
|
536
|
+
|
537
|
+
// calculate data length
|
538
|
+
len = 0;
|
539
|
+
for (i = 0, l = chunks.length; i < l; i++) {
|
540
|
+
len += chunks[i].length;
|
541
|
+
}
|
542
|
+
|
543
|
+
// join chunks
|
544
|
+
result = new Uint8Array(len);
|
545
|
+
pos = 0;
|
546
|
+
for (i = 0, l = chunks.length; i < l; i++) {
|
547
|
+
chunk = chunks[i];
|
548
|
+
result.set(chunk, pos);
|
549
|
+
pos += chunk.length;
|
550
|
+
}
|
551
|
+
|
552
|
+
return result;
|
553
|
+
}
|
554
|
+
};
|
555
|
+
|
556
|
+
var fnUntyped = {
|
557
|
+
arraySet: function (dest, src, src_offs, len, dest_offs) {
|
558
|
+
for (var i = 0; i < len; i++) {
|
559
|
+
dest[dest_offs + i] = src[src_offs + i];
|
560
|
+
}
|
561
|
+
},
|
562
|
+
// Join array of chunks to single array.
|
563
|
+
flattenChunks: function (chunks) {
|
564
|
+
return [].concat.apply([], chunks);
|
565
|
+
}
|
566
|
+
};
|
567
|
+
|
568
|
+
|
569
|
+
// Enable/Disable typed arrays use, for testing
|
570
|
+
//
|
571
|
+
exports.setTyped = function (on) {
|
572
|
+
if (on) {
|
573
|
+
exports.Buf8 = Uint8Array;
|
574
|
+
exports.Buf16 = Uint16Array;
|
575
|
+
exports.Buf32 = Int32Array;
|
576
|
+
exports.assign(exports, fnTyped);
|
577
|
+
} else {
|
578
|
+
exports.Buf8 = Array;
|
579
|
+
exports.Buf16 = Array;
|
580
|
+
exports.Buf32 = Array;
|
581
|
+
exports.assign(exports, fnUntyped);
|
582
|
+
}
|
583
|
+
};
|
584
|
+
|
585
|
+
exports.setTyped(TYPED_OK);
|
586
|
+
|
587
|
+
},{}],6:[function(require,module,exports){
|
588
|
+
// String encode/decode helpers
|
589
|
+
'use strict';
|
590
|
+
|
591
|
+
|
592
|
+
var utils = require('./common');
|
593
|
+
|
594
|
+
|
595
|
+
// Quick check if we can use fast array to bin string conversion
|
596
|
+
//
|
597
|
+
// - apply(Array) can fail on Android 2.2
|
598
|
+
// - apply(Uint8Array) can fail on iOS 5.1 Safary
|
599
|
+
//
|
600
|
+
var STR_APPLY_OK = true;
|
601
|
+
var STR_APPLY_UIA_OK = true;
|
602
|
+
|
603
|
+
try { String.fromCharCode.apply(null, [ 0 ]); } catch (__) { STR_APPLY_OK = false; }
|
604
|
+
try { String.fromCharCode.apply(null, new Uint8Array(1)); } catch (__) { STR_APPLY_UIA_OK = false; }
|
605
|
+
|
606
|
+
|
607
|
+
// Table with utf8 lengths (calculated by first byte of sequence)
|
608
|
+
// Note, that 5 & 6-byte values and some 4-byte values can not be represented in JS,
|
609
|
+
// because max possible codepoint is 0x10ffff
|
610
|
+
var _utf8len = new utils.Buf8(256);
|
611
|
+
for (var q = 0; q < 256; q++) {
|
612
|
+
_utf8len[q] = (q >= 252 ? 6 : q >= 248 ? 5 : q >= 240 ? 4 : q >= 224 ? 3 : q >= 192 ? 2 : 1);
|
613
|
+
}
|
614
|
+
_utf8len[254] = _utf8len[254] = 1; // Invalid sequence start
|
615
|
+
|
616
|
+
|
617
|
+
// convert string to array (typed, when possible)
|
618
|
+
exports.string2buf = function (str) {
|
619
|
+
var buf, c, c2, m_pos, i, str_len = str.length, buf_len = 0;
|
620
|
+
|
621
|
+
// count binary size
|
622
|
+
for (m_pos = 0; m_pos < str_len; m_pos++) {
|
623
|
+
c = str.charCodeAt(m_pos);
|
624
|
+
if ((c & 0xfc00) === 0xd800 && (m_pos + 1 < str_len)) {
|
625
|
+
c2 = str.charCodeAt(m_pos + 1);
|
626
|
+
if ((c2 & 0xfc00) === 0xdc00) {
|
627
|
+
c = 0x10000 + ((c - 0xd800) << 10) + (c2 - 0xdc00);
|
628
|
+
m_pos++;
|
629
|
+
}
|
630
|
+
}
|
631
|
+
buf_len += c < 0x80 ? 1 : c < 0x800 ? 2 : c < 0x10000 ? 3 : 4;
|
632
|
+
}
|
633
|
+
|
634
|
+
// allocate buffer
|
635
|
+
buf = new utils.Buf8(buf_len);
|
636
|
+
|
637
|
+
// convert
|
638
|
+
for (i = 0, m_pos = 0; i < buf_len; m_pos++) {
|
639
|
+
c = str.charCodeAt(m_pos);
|
640
|
+
if ((c & 0xfc00) === 0xd800 && (m_pos + 1 < str_len)) {
|
641
|
+
c2 = str.charCodeAt(m_pos + 1);
|
642
|
+
if ((c2 & 0xfc00) === 0xdc00) {
|
643
|
+
c = 0x10000 + ((c - 0xd800) << 10) + (c2 - 0xdc00);
|
644
|
+
m_pos++;
|
645
|
+
}
|
646
|
+
}
|
647
|
+
if (c < 0x80) {
|
648
|
+
/* one byte */
|
649
|
+
buf[i++] = c;
|
650
|
+
} else if (c < 0x800) {
|
651
|
+
/* two bytes */
|
652
|
+
buf[i++] = 0xC0 | (c >>> 6);
|
653
|
+
buf[i++] = 0x80 | (c & 0x3f);
|
654
|
+
} else if (c < 0x10000) {
|
655
|
+
/* three bytes */
|
656
|
+
buf[i++] = 0xE0 | (c >>> 12);
|
657
|
+
buf[i++] = 0x80 | (c >>> 6 & 0x3f);
|
658
|
+
buf[i++] = 0x80 | (c & 0x3f);
|
659
|
+
} else {
|
660
|
+
/* four bytes */
|
661
|
+
buf[i++] = 0xf0 | (c >>> 18);
|
662
|
+
buf[i++] = 0x80 | (c >>> 12 & 0x3f);
|
663
|
+
buf[i++] = 0x80 | (c >>> 6 & 0x3f);
|
664
|
+
buf[i++] = 0x80 | (c & 0x3f);
|
665
|
+
}
|
666
|
+
}
|
667
|
+
|
668
|
+
return buf;
|
669
|
+
};
|
670
|
+
|
671
|
+
// Helper (used in 2 places)
|
672
|
+
function buf2binstring(buf, len) {
|
673
|
+
// use fallback for big arrays to avoid stack overflow
|
674
|
+
if (len < 65537) {
|
675
|
+
if ((buf.subarray && STR_APPLY_UIA_OK) || (!buf.subarray && STR_APPLY_OK)) {
|
676
|
+
return String.fromCharCode.apply(null, utils.shrinkBuf(buf, len));
|
677
|
+
}
|
678
|
+
}
|
679
|
+
|
680
|
+
var result = '';
|
681
|
+
for (var i = 0; i < len; i++) {
|
682
|
+
result += String.fromCharCode(buf[i]);
|
683
|
+
}
|
684
|
+
return result;
|
685
|
+
}
|
686
|
+
|
687
|
+
|
688
|
+
// Convert byte array to binary string
|
689
|
+
exports.buf2binstring = function (buf) {
|
690
|
+
return buf2binstring(buf, buf.length);
|
691
|
+
};
|
692
|
+
|
693
|
+
|
694
|
+
// Convert binary string (typed, when possible)
|
695
|
+
exports.binstring2buf = function (str) {
|
696
|
+
var buf = new utils.Buf8(str.length);
|
697
|
+
for (var i = 0, len = buf.length; i < len; i++) {
|
698
|
+
buf[i] = str.charCodeAt(i);
|
699
|
+
}
|
700
|
+
return buf;
|
701
|
+
};
|
702
|
+
|
703
|
+
|
704
|
+
// convert array to string
|
705
|
+
exports.buf2string = function (buf, max) {
|
706
|
+
var i, out, c, c_len;
|
707
|
+
var len = max || buf.length;
|
708
|
+
|
709
|
+
// Reserve max possible length (2 words per char)
|
710
|
+
// NB: by unknown reasons, Array is significantly faster for
|
711
|
+
// String.fromCharCode.apply than Uint16Array.
|
712
|
+
var utf16buf = new Array(len * 2);
|
713
|
+
|
714
|
+
for (out = 0, i = 0; i < len;) {
|
715
|
+
c = buf[i++];
|
716
|
+
// quick process ascii
|
717
|
+
if (c < 0x80) { utf16buf[out++] = c; continue; }
|
718
|
+
|
719
|
+
c_len = _utf8len[c];
|
720
|
+
// skip 5 & 6 byte codes
|
721
|
+
if (c_len > 4) { utf16buf[out++] = 0xfffd; i += c_len - 1; continue; }
|
722
|
+
|
723
|
+
// apply mask on first byte
|
724
|
+
c &= c_len === 2 ? 0x1f : c_len === 3 ? 0x0f : 0x07;
|
725
|
+
// join the rest
|
726
|
+
while (c_len > 1 && i < len) {
|
727
|
+
c = (c << 6) | (buf[i++] & 0x3f);
|
728
|
+
c_len--;
|
729
|
+
}
|
730
|
+
|
731
|
+
// terminated by end of string?
|
732
|
+
if (c_len > 1) { utf16buf[out++] = 0xfffd; continue; }
|
733
|
+
|
734
|
+
if (c < 0x10000) {
|
735
|
+
utf16buf[out++] = c;
|
736
|
+
} else {
|
737
|
+
c -= 0x10000;
|
738
|
+
utf16buf[out++] = 0xd800 | ((c >> 10) & 0x3ff);
|
739
|
+
utf16buf[out++] = 0xdc00 | (c & 0x3ff);
|
740
|
+
}
|
741
|
+
}
|
742
|
+
|
743
|
+
return buf2binstring(utf16buf, out);
|
744
|
+
};
|
745
|
+
|
746
|
+
|
747
|
+
// Calculate max possible position in utf8 buffer,
|
748
|
+
// that will not break sequence. If that's not possible
|
749
|
+
// - (very small limits) return max size as is.
|
750
|
+
//
|
751
|
+
// buf[] - utf8 bytes array
|
752
|
+
// max - length limit (mandatory);
|
753
|
+
exports.utf8border = function (buf, max) {
|
754
|
+
var pos;
|
755
|
+
|
756
|
+
max = max || buf.length;
|
757
|
+
if (max > buf.length) { max = buf.length; }
|
758
|
+
|
759
|
+
// go back from last position, until start of sequence found
|
760
|
+
pos = max - 1;
|
761
|
+
while (pos >= 0 && (buf[pos] & 0xC0) === 0x80) { pos--; }
|
762
|
+
|
763
|
+
// Fuckup - very small and broken sequence,
|
764
|
+
// return max, because we should return something anyway.
|
765
|
+
if (pos < 0) { return max; }
|
766
|
+
|
767
|
+
// If we came to start of buffer - that means vuffer is too small,
|
768
|
+
// return max too.
|
769
|
+
if (pos === 0) { return max; }
|
770
|
+
|
771
|
+
return (pos + _utf8len[buf[pos]] > max) ? pos : max;
|
772
|
+
};
|
773
|
+
|
774
|
+
},{"./common":5}],7:[function(require,module,exports){
|
775
|
+
'use strict';
|
776
|
+
|
777
|
+
// Note: adler32 takes 12% for level 0 and 2% for level 6.
|
778
|
+
// It doesn't worth to make additional optimizationa as in original.
|
779
|
+
// Small size is preferable.
|
780
|
+
|
781
|
+
function adler32(adler, buf, len, pos) {
|
782
|
+
var s1 = (adler & 0xffff) |0,
|
783
|
+
s2 = ((adler >>> 16) & 0xffff) |0,
|
784
|
+
n = 0;
|
785
|
+
|
786
|
+
while (len !== 0) {
|
787
|
+
// Set limit ~ twice less than 5552, to keep
|
788
|
+
// s2 in 31-bits, because we force signed ints.
|
789
|
+
// in other case %= will fail.
|
790
|
+
n = len > 2000 ? 2000 : len;
|
791
|
+
len -= n;
|
792
|
+
|
793
|
+
do {
|
794
|
+
s1 = (s1 + buf[pos++]) |0;
|
795
|
+
s2 = (s2 + s1) |0;
|
796
|
+
} while (--n);
|
797
|
+
|
798
|
+
s1 %= 65521;
|
799
|
+
s2 %= 65521;
|
800
|
+
}
|
801
|
+
|
802
|
+
return (s1 | (s2 << 16)) |0;
|
803
|
+
}
|
804
|
+
|
805
|
+
|
806
|
+
module.exports = adler32;
|
807
|
+
|
808
|
+
},{}],8:[function(require,module,exports){
|
809
|
+
'use strict';
|
810
|
+
|
811
|
+
// Note: we can't get significant speed boost here.
|
812
|
+
// So write code to minimize size - no pregenerated tables
|
813
|
+
// and array tools dependencies.
|
814
|
+
|
815
|
+
|
816
|
+
// Use ordinary array, since untyped makes no boost here
|
817
|
+
function makeTable() {
|
818
|
+
var c, table = [];
|
819
|
+
|
820
|
+
for (var n = 0; n < 256; n++) {
|
821
|
+
c = n;
|
822
|
+
for (var k = 0; k < 8; k++) {
|
823
|
+
c = ((c & 1) ? (0xEDB88320 ^ (c >>> 1)) : (c >>> 1));
|
824
|
+
}
|
825
|
+
table[n] = c;
|
826
|
+
}
|
827
|
+
|
828
|
+
return table;
|
829
|
+
}
|
830
|
+
|
831
|
+
// Create table on load. Just 255 signed longs. Not a problem.
|
832
|
+
var crcTable = makeTable();
|
833
|
+
|
834
|
+
|
835
|
+
function crc32(crc, buf, len, pos) {
|
836
|
+
var t = crcTable,
|
837
|
+
end = pos + len;
|
838
|
+
|
839
|
+
crc ^= -1;
|
840
|
+
|
841
|
+
for (var i = pos; i < end; i++) {
|
842
|
+
crc = (crc >>> 8) ^ t[(crc ^ buf[i]) & 0xFF];
|
843
|
+
}
|
844
|
+
|
845
|
+
return (crc ^ (-1)); // >>> 0;
|
846
|
+
}
|
847
|
+
|
848
|
+
|
849
|
+
module.exports = crc32;
|
850
|
+
|
851
|
+
},{}],9:[function(require,module,exports){
|
852
|
+
'use strict';
|
853
|
+
|
854
|
+
var utils = require('../utils/common');
|
855
|
+
var trees = require('./trees');
|
856
|
+
var adler32 = require('./adler32');
|
857
|
+
var crc32 = require('./crc32');
|
858
|
+
var msg = require('./messages');
|
859
|
+
|
860
|
+
/* Public constants ==========================================================*/
|
861
|
+
/* ===========================================================================*/
|
862
|
+
|
863
|
+
|
864
|
+
/* Allowed flush values; see deflate() and inflate() below for details */
|
865
|
+
var Z_NO_FLUSH = 0;
|
866
|
+
var Z_PARTIAL_FLUSH = 1;
|
867
|
+
//var Z_SYNC_FLUSH = 2;
|
868
|
+
var Z_FULL_FLUSH = 3;
|
869
|
+
var Z_FINISH = 4;
|
870
|
+
var Z_BLOCK = 5;
|
871
|
+
//var Z_TREES = 6;
|
872
|
+
|
873
|
+
|
874
|
+
/* Return codes for the compression/decompression functions. Negative values
|
875
|
+
* are errors, positive values are used for special but normal events.
|
876
|
+
*/
|
877
|
+
var Z_OK = 0;
|
878
|
+
var Z_STREAM_END = 1;
|
879
|
+
//var Z_NEED_DICT = 2;
|
880
|
+
//var Z_ERRNO = -1;
|
881
|
+
var Z_STREAM_ERROR = -2;
|
882
|
+
var Z_DATA_ERROR = -3;
|
883
|
+
//var Z_MEM_ERROR = -4;
|
884
|
+
var Z_BUF_ERROR = -5;
|
885
|
+
//var Z_VERSION_ERROR = -6;
|
886
|
+
|
887
|
+
|
888
|
+
/* compression levels */
|
889
|
+
//var Z_NO_COMPRESSION = 0;
|
890
|
+
//var Z_BEST_SPEED = 1;
|
891
|
+
//var Z_BEST_COMPRESSION = 9;
|
892
|
+
var Z_DEFAULT_COMPRESSION = -1;
|
893
|
+
|
894
|
+
|
895
|
+
var Z_FILTERED = 1;
|
896
|
+
var Z_HUFFMAN_ONLY = 2;
|
897
|
+
var Z_RLE = 3;
|
898
|
+
var Z_FIXED = 4;
|
899
|
+
var Z_DEFAULT_STRATEGY = 0;
|
900
|
+
|
901
|
+
/* Possible values of the data_type field (though see inflate()) */
|
902
|
+
//var Z_BINARY = 0;
|
903
|
+
//var Z_TEXT = 1;
|
904
|
+
//var Z_ASCII = 1; // = Z_TEXT
|
905
|
+
var Z_UNKNOWN = 2;
|
906
|
+
|
907
|
+
|
908
|
+
/* The deflate compression method */
|
909
|
+
var Z_DEFLATED = 8;
|
910
|
+
|
911
|
+
/*============================================================================*/
|
912
|
+
|
913
|
+
|
914
|
+
var MAX_MEM_LEVEL = 9;
|
915
|
+
/* Maximum value for memLevel in deflateInit2 */
|
916
|
+
var MAX_WBITS = 15;
|
917
|
+
/* 32K LZ77 window */
|
918
|
+
var DEF_MEM_LEVEL = 8;
|
919
|
+
|
920
|
+
|
921
|
+
var LENGTH_CODES = 29;
|
922
|
+
/* number of length codes, not counting the special END_BLOCK code */
|
923
|
+
var LITERALS = 256;
|
924
|
+
/* number of literal bytes 0..255 */
|
925
|
+
var L_CODES = LITERALS + 1 + LENGTH_CODES;
|
926
|
+
/* number of Literal or Length codes, including the END_BLOCK code */
|
927
|
+
var D_CODES = 30;
|
928
|
+
/* number of distance codes */
|
929
|
+
var BL_CODES = 19;
|
930
|
+
/* number of codes used to transfer the bit lengths */
|
931
|
+
var HEAP_SIZE = 2 * L_CODES + 1;
|
932
|
+
/* maximum heap size */
|
933
|
+
var MAX_BITS = 15;
|
934
|
+
/* All codes must not exceed MAX_BITS bits */
|
935
|
+
|
936
|
+
var MIN_MATCH = 3;
|
937
|
+
var MAX_MATCH = 258;
|
938
|
+
var MIN_LOOKAHEAD = (MAX_MATCH + MIN_MATCH + 1);
|
939
|
+
|
940
|
+
var PRESET_DICT = 0x20;
|
941
|
+
|
942
|
+
var INIT_STATE = 42;
|
943
|
+
var EXTRA_STATE = 69;
|
944
|
+
var NAME_STATE = 73;
|
945
|
+
var COMMENT_STATE = 91;
|
946
|
+
var HCRC_STATE = 103;
|
947
|
+
var BUSY_STATE = 113;
|
948
|
+
var FINISH_STATE = 666;
|
949
|
+
|
950
|
+
var BS_NEED_MORE = 1; /* block not completed, need more input or more output */
|
951
|
+
var BS_BLOCK_DONE = 2; /* block flush performed */
|
952
|
+
var BS_FINISH_STARTED = 3; /* finish started, need only more output at next deflate */
|
953
|
+
var BS_FINISH_DONE = 4; /* finish done, accept no more input or output */
|
954
|
+
|
955
|
+
var OS_CODE = 0x03; // Unix :) . Don't detect, use this default.
|
956
|
+
|
957
|
+
function err(strm, errorCode) {
|
958
|
+
strm.msg = msg[errorCode];
|
959
|
+
return errorCode;
|
960
|
+
}
|
961
|
+
|
962
|
+
function rank(f) {
|
963
|
+
return ((f) << 1) - ((f) > 4 ? 9 : 0);
|
964
|
+
}
|
965
|
+
|
966
|
+
function zero(buf) { var len = buf.length; while (--len >= 0) { buf[len] = 0; } }
|
967
|
+
|
968
|
+
|
969
|
+
/* =========================================================================
|
970
|
+
* Flush as much pending output as possible. All deflate() output goes
|
971
|
+
* through this function so some applications may wish to modify it
|
972
|
+
* to avoid allocating a large strm->output buffer and copying into it.
|
973
|
+
* (See also read_buf()).
|
974
|
+
*/
|
975
|
+
function flush_pending(strm) {
|
976
|
+
var s = strm.state;
|
977
|
+
|
978
|
+
//_tr_flush_bits(s);
|
979
|
+
var len = s.pending;
|
980
|
+
if (len > strm.avail_out) {
|
981
|
+
len = strm.avail_out;
|
982
|
+
}
|
983
|
+
if (len === 0) { return; }
|
984
|
+
|
985
|
+
utils.arraySet(strm.output, s.pending_buf, s.pending_out, len, strm.next_out);
|
986
|
+
strm.next_out += len;
|
987
|
+
s.pending_out += len;
|
988
|
+
strm.total_out += len;
|
989
|
+
strm.avail_out -= len;
|
990
|
+
s.pending -= len;
|
991
|
+
if (s.pending === 0) {
|
992
|
+
s.pending_out = 0;
|
993
|
+
}
|
994
|
+
}
|
995
|
+
|
996
|
+
|
997
|
+
function flush_block_only(s, last) {
|
998
|
+
trees._tr_flush_block(s, (s.block_start >= 0 ? s.block_start : -1), s.strstart - s.block_start, last);
|
999
|
+
s.block_start = s.strstart;
|
1000
|
+
flush_pending(s.strm);
|
1001
|
+
}
|
1002
|
+
|
1003
|
+
|
1004
|
+
function put_byte(s, b) {
|
1005
|
+
s.pending_buf[s.pending++] = b;
|
1006
|
+
}
|
1007
|
+
|
1008
|
+
|
1009
|
+
/* =========================================================================
|
1010
|
+
* Put a short in the pending buffer. The 16-bit value is put in MSB order.
|
1011
|
+
* IN assertion: the stream state is correct and there is enough room in
|
1012
|
+
* pending_buf.
|
1013
|
+
*/
|
1014
|
+
function putShortMSB(s, b) {
|
1015
|
+
// put_byte(s, (Byte)(b >> 8));
|
1016
|
+
// put_byte(s, (Byte)(b & 0xff));
|
1017
|
+
s.pending_buf[s.pending++] = (b >>> 8) & 0xff;
|
1018
|
+
s.pending_buf[s.pending++] = b & 0xff;
|
1019
|
+
}
|
1020
|
+
|
1021
|
+
|
1022
|
+
/* ===========================================================================
|
1023
|
+
* Read a new buffer from the current input stream, update the adler32
|
1024
|
+
* and total number of bytes read. All deflate() input goes through
|
1025
|
+
* this function so some applications may wish to modify it to avoid
|
1026
|
+
* allocating a large strm->input buffer and copying from it.
|
1027
|
+
* (See also flush_pending()).
|
1028
|
+
*/
|
1029
|
+
function read_buf(strm, buf, start, size) {
|
1030
|
+
var len = strm.avail_in;
|
1031
|
+
|
1032
|
+
if (len > size) { len = size; }
|
1033
|
+
if (len === 0) { return 0; }
|
1034
|
+
|
1035
|
+
strm.avail_in -= len;
|
1036
|
+
|
1037
|
+
// zmemcpy(buf, strm->next_in, len);
|
1038
|
+
utils.arraySet(buf, strm.input, strm.next_in, len, start);
|
1039
|
+
if (strm.state.wrap === 1) {
|
1040
|
+
strm.adler = adler32(strm.adler, buf, len, start);
|
1041
|
+
}
|
1042
|
+
|
1043
|
+
else if (strm.state.wrap === 2) {
|
1044
|
+
strm.adler = crc32(strm.adler, buf, len, start);
|
1045
|
+
}
|
1046
|
+
|
1047
|
+
strm.next_in += len;
|
1048
|
+
strm.total_in += len;
|
1049
|
+
|
1050
|
+
return len;
|
1051
|
+
}
|
1052
|
+
|
1053
|
+
|
1054
|
+
/* ===========================================================================
|
1055
|
+
* Set match_start to the longest match starting at the given string and
|
1056
|
+
* return its length. Matches shorter or equal to prev_length are discarded,
|
1057
|
+
* in which case the result is equal to prev_length and match_start is
|
1058
|
+
* garbage.
|
1059
|
+
* IN assertions: cur_match is the head of the hash chain for the current
|
1060
|
+
* string (strstart) and its distance is <= MAX_DIST, and prev_length >= 1
|
1061
|
+
* OUT assertion: the match length is not greater than s->lookahead.
|
1062
|
+
*/
|
1063
|
+
function longest_match(s, cur_match) {
|
1064
|
+
var chain_length = s.max_chain_length; /* max hash chain length */
|
1065
|
+
var scan = s.strstart; /* current string */
|
1066
|
+
var match; /* matched string */
|
1067
|
+
var len; /* length of current match */
|
1068
|
+
var best_len = s.prev_length; /* best match length so far */
|
1069
|
+
var nice_match = s.nice_match; /* stop if match long enough */
|
1070
|
+
var limit = (s.strstart > (s.w_size - MIN_LOOKAHEAD)) ?
|
1071
|
+
s.strstart - (s.w_size - MIN_LOOKAHEAD) : 0/*NIL*/;
|
1072
|
+
|
1073
|
+
var _win = s.window; // shortcut
|
1074
|
+
|
1075
|
+
var wmask = s.w_mask;
|
1076
|
+
var prev = s.prev;
|
1077
|
+
|
1078
|
+
/* Stop when cur_match becomes <= limit. To simplify the code,
|
1079
|
+
* we prevent matches with the string of window index 0.
|
1080
|
+
*/
|
1081
|
+
|
1082
|
+
var strend = s.strstart + MAX_MATCH;
|
1083
|
+
var scan_end1 = _win[scan + best_len - 1];
|
1084
|
+
var scan_end = _win[scan + best_len];
|
1085
|
+
|
1086
|
+
/* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16.
|
1087
|
+
* It is easy to get rid of this optimization if necessary.
|
1088
|
+
*/
|
1089
|
+
// Assert(s->hash_bits >= 8 && MAX_MATCH == 258, "Code too clever");
|
1090
|
+
|
1091
|
+
/* Do not waste too much time if we already have a good match: */
|
1092
|
+
if (s.prev_length >= s.good_match) {
|
1093
|
+
chain_length >>= 2;
|
1094
|
+
}
|
1095
|
+
/* Do not look for matches beyond the end of the input. This is necessary
|
1096
|
+
* to make deflate deterministic.
|
1097
|
+
*/
|
1098
|
+
if (nice_match > s.lookahead) { nice_match = s.lookahead; }
|
1099
|
+
|
1100
|
+
// Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, "need lookahead");
|
1101
|
+
|
1102
|
+
do {
|
1103
|
+
// Assert(cur_match < s->strstart, "no future");
|
1104
|
+
match = cur_match;
|
1105
|
+
|
1106
|
+
/* Skip to next match if the match length cannot increase
|
1107
|
+
* or if the match length is less than 2. Note that the checks below
|
1108
|
+
* for insufficient lookahead only occur occasionally for performance
|
1109
|
+
* reasons. Therefore uninitialized memory will be accessed, and
|
1110
|
+
* conditional jumps will be made that depend on those values.
|
1111
|
+
* However the length of the match is limited to the lookahead, so
|
1112
|
+
* the output of deflate is not affected by the uninitialized values.
|
1113
|
+
*/
|
1114
|
+
|
1115
|
+
if (_win[match + best_len] !== scan_end ||
|
1116
|
+
_win[match + best_len - 1] !== scan_end1 ||
|
1117
|
+
_win[match] !== _win[scan] ||
|
1118
|
+
_win[++match] !== _win[scan + 1]) {
|
1119
|
+
continue;
|
1120
|
+
}
|
1121
|
+
|
1122
|
+
/* The check at best_len-1 can be removed because it will be made
|
1123
|
+
* again later. (This heuristic is not always a win.)
|
1124
|
+
* It is not necessary to compare scan[2] and match[2] since they
|
1125
|
+
* are always equal when the other bytes match, given that
|
1126
|
+
* the hash keys are equal and that HASH_BITS >= 8.
|
1127
|
+
*/
|
1128
|
+
scan += 2;
|
1129
|
+
match++;
|
1130
|
+
// Assert(*scan == *match, "match[2]?");
|
1131
|
+
|
1132
|
+
/* We check for insufficient lookahead only every 8th comparison;
|
1133
|
+
* the 256th check will be made at strstart+258.
|
1134
|
+
*/
|
1135
|
+
do {
|
1136
|
+
/*jshint noempty:false*/
|
1137
|
+
} while (_win[++scan] === _win[++match] && _win[++scan] === _win[++match] &&
|
1138
|
+
_win[++scan] === _win[++match] && _win[++scan] === _win[++match] &&
|
1139
|
+
_win[++scan] === _win[++match] && _win[++scan] === _win[++match] &&
|
1140
|
+
_win[++scan] === _win[++match] && _win[++scan] === _win[++match] &&
|
1141
|
+
scan < strend);
|
1142
|
+
|
1143
|
+
// Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan");
|
1144
|
+
|
1145
|
+
len = MAX_MATCH - (strend - scan);
|
1146
|
+
scan = strend - MAX_MATCH;
|
1147
|
+
|
1148
|
+
if (len > best_len) {
|
1149
|
+
s.match_start = cur_match;
|
1150
|
+
best_len = len;
|
1151
|
+
if (len >= nice_match) {
|
1152
|
+
break;
|
1153
|
+
}
|
1154
|
+
scan_end1 = _win[scan + best_len - 1];
|
1155
|
+
scan_end = _win[scan + best_len];
|
1156
|
+
}
|
1157
|
+
} while ((cur_match = prev[cur_match & wmask]) > limit && --chain_length !== 0);
|
1158
|
+
|
1159
|
+
if (best_len <= s.lookahead) {
|
1160
|
+
return best_len;
|
1161
|
+
}
|
1162
|
+
return s.lookahead;
|
1163
|
+
}
|
1164
|
+
|
1165
|
+
|
1166
|
+
/* ===========================================================================
|
1167
|
+
* Fill the window when the lookahead becomes insufficient.
|
1168
|
+
* Updates strstart and lookahead.
|
1169
|
+
*
|
1170
|
+
* IN assertion: lookahead < MIN_LOOKAHEAD
|
1171
|
+
* OUT assertions: strstart <= window_size-MIN_LOOKAHEAD
|
1172
|
+
* At least one byte has been read, or avail_in == 0; reads are
|
1173
|
+
* performed for at least two bytes (required for the zip translate_eol
|
1174
|
+
* option -- not supported here).
|
1175
|
+
*/
|
1176
|
+
function fill_window(s) {
|
1177
|
+
var _w_size = s.w_size;
|
1178
|
+
var p, n, m, more, str;
|
1179
|
+
|
1180
|
+
//Assert(s->lookahead < MIN_LOOKAHEAD, "already enough lookahead");
|
1181
|
+
|
1182
|
+
do {
|
1183
|
+
more = s.window_size - s.lookahead - s.strstart;
|
1184
|
+
|
1185
|
+
// JS ints have 32 bit, block below not needed
|
1186
|
+
/* Deal with !@#$% 64K limit: */
|
1187
|
+
//if (sizeof(int) <= 2) {
|
1188
|
+
// if (more == 0 && s->strstart == 0 && s->lookahead == 0) {
|
1189
|
+
// more = wsize;
|
1190
|
+
//
|
1191
|
+
// } else if (more == (unsigned)(-1)) {
|
1192
|
+
// /* Very unlikely, but possible on 16 bit machine if
|
1193
|
+
// * strstart == 0 && lookahead == 1 (input done a byte at time)
|
1194
|
+
// */
|
1195
|
+
// more--;
|
1196
|
+
// }
|
1197
|
+
//}
|
1198
|
+
|
1199
|
+
|
1200
|
+
/* If the window is almost full and there is insufficient lookahead,
|
1201
|
+
* move the upper half to the lower one to make room in the upper half.
|
1202
|
+
*/
|
1203
|
+
if (s.strstart >= _w_size + (_w_size - MIN_LOOKAHEAD)) {
|
1204
|
+
|
1205
|
+
utils.arraySet(s.window, s.window, _w_size, _w_size, 0);
|
1206
|
+
s.match_start -= _w_size;
|
1207
|
+
s.strstart -= _w_size;
|
1208
|
+
/* we now have strstart >= MAX_DIST */
|
1209
|
+
s.block_start -= _w_size;
|
1210
|
+
|
1211
|
+
/* Slide the hash table (could be avoided with 32 bit values
|
1212
|
+
at the expense of memory usage). We slide even when level == 0
|
1213
|
+
to keep the hash table consistent if we switch back to level > 0
|
1214
|
+
later. (Using level 0 permanently is not an optimal usage of
|
1215
|
+
zlib, so we don't care about this pathological case.)
|
1216
|
+
*/
|
1217
|
+
|
1218
|
+
n = s.hash_size;
|
1219
|
+
p = n;
|
1220
|
+
do {
|
1221
|
+
m = s.head[--p];
|
1222
|
+
s.head[p] = (m >= _w_size ? m - _w_size : 0);
|
1223
|
+
} while (--n);
|
1224
|
+
|
1225
|
+
n = _w_size;
|
1226
|
+
p = n;
|
1227
|
+
do {
|
1228
|
+
m = s.prev[--p];
|
1229
|
+
s.prev[p] = (m >= _w_size ? m - _w_size : 0);
|
1230
|
+
/* If n is not on any hash chain, prev[n] is garbage but
|
1231
|
+
* its value will never be used.
|
1232
|
+
*/
|
1233
|
+
} while (--n);
|
1234
|
+
|
1235
|
+
more += _w_size;
|
1236
|
+
}
|
1237
|
+
if (s.strm.avail_in === 0) {
|
1238
|
+
break;
|
1239
|
+
}
|
1240
|
+
|
1241
|
+
/* If there was no sliding:
|
1242
|
+
* strstart <= WSIZE+MAX_DIST-1 && lookahead <= MIN_LOOKAHEAD - 1 &&
|
1243
|
+
* more == window_size - lookahead - strstart
|
1244
|
+
* => more >= window_size - (MIN_LOOKAHEAD-1 + WSIZE + MAX_DIST-1)
|
1245
|
+
* => more >= window_size - 2*WSIZE + 2
|
1246
|
+
* In the BIG_MEM or MMAP case (not yet supported),
|
1247
|
+
* window_size == input_size + MIN_LOOKAHEAD &&
|
1248
|
+
* strstart + s->lookahead <= input_size => more >= MIN_LOOKAHEAD.
|
1249
|
+
* Otherwise, window_size == 2*WSIZE so more >= 2.
|
1250
|
+
* If there was sliding, more >= WSIZE. So in all cases, more >= 2.
|
1251
|
+
*/
|
1252
|
+
//Assert(more >= 2, "more < 2");
|
1253
|
+
n = read_buf(s.strm, s.window, s.strstart + s.lookahead, more);
|
1254
|
+
s.lookahead += n;
|
1255
|
+
|
1256
|
+
/* Initialize the hash value now that we have some input: */
|
1257
|
+
if (s.lookahead + s.insert >= MIN_MATCH) {
|
1258
|
+
str = s.strstart - s.insert;
|
1259
|
+
s.ins_h = s.window[str];
|
1260
|
+
|
1261
|
+
/* UPDATE_HASH(s, s->ins_h, s->window[str + 1]); */
|
1262
|
+
s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[str + 1]) & s.hash_mask;
|
1263
|
+
//#if MIN_MATCH != 3
|
1264
|
+
// Call update_hash() MIN_MATCH-3 more times
|
1265
|
+
//#endif
|
1266
|
+
while (s.insert) {
|
1267
|
+
/* UPDATE_HASH(s, s->ins_h, s->window[str + MIN_MATCH-1]); */
|
1268
|
+
s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[str + MIN_MATCH - 1]) & s.hash_mask;
|
1269
|
+
|
1270
|
+
s.prev[str & s.w_mask] = s.head[s.ins_h];
|
1271
|
+
s.head[s.ins_h] = str;
|
1272
|
+
str++;
|
1273
|
+
s.insert--;
|
1274
|
+
if (s.lookahead + s.insert < MIN_MATCH) {
|
1275
|
+
break;
|
1276
|
+
}
|
1277
|
+
}
|
1278
|
+
}
|
1279
|
+
/* If the whole input has less than MIN_MATCH bytes, ins_h is garbage,
|
1280
|
+
* but this is not important since only literal bytes will be emitted.
|
1281
|
+
*/
|
1282
|
+
|
1283
|
+
} while (s.lookahead < MIN_LOOKAHEAD && s.strm.avail_in !== 0);
|
1284
|
+
|
1285
|
+
/* If the WIN_INIT bytes after the end of the current data have never been
|
1286
|
+
* written, then zero those bytes in order to avoid memory check reports of
|
1287
|
+
* the use of uninitialized (or uninitialised as Julian writes) bytes by
|
1288
|
+
* the longest match routines. Update the high water mark for the next
|
1289
|
+
* time through here. WIN_INIT is set to MAX_MATCH since the longest match
|
1290
|
+
* routines allow scanning to strstart + MAX_MATCH, ignoring lookahead.
|
1291
|
+
*/
|
1292
|
+
// if (s.high_water < s.window_size) {
|
1293
|
+
// var curr = s.strstart + s.lookahead;
|
1294
|
+
// var init = 0;
|
1295
|
+
//
|
1296
|
+
// if (s.high_water < curr) {
|
1297
|
+
// /* Previous high water mark below current data -- zero WIN_INIT
|
1298
|
+
// * bytes or up to end of window, whichever is less.
|
1299
|
+
// */
|
1300
|
+
// init = s.window_size - curr;
|
1301
|
+
// if (init > WIN_INIT)
|
1302
|
+
// init = WIN_INIT;
|
1303
|
+
// zmemzero(s->window + curr, (unsigned)init);
|
1304
|
+
// s->high_water = curr + init;
|
1305
|
+
// }
|
1306
|
+
// else if (s->high_water < (ulg)curr + WIN_INIT) {
|
1307
|
+
// /* High water mark at or above current data, but below current data
|
1308
|
+
// * plus WIN_INIT -- zero out to current data plus WIN_INIT, or up
|
1309
|
+
// * to end of window, whichever is less.
|
1310
|
+
// */
|
1311
|
+
// init = (ulg)curr + WIN_INIT - s->high_water;
|
1312
|
+
// if (init > s->window_size - s->high_water)
|
1313
|
+
// init = s->window_size - s->high_water;
|
1314
|
+
// zmemzero(s->window + s->high_water, (unsigned)init);
|
1315
|
+
// s->high_water += init;
|
1316
|
+
// }
|
1317
|
+
// }
|
1318
|
+
//
|
1319
|
+
// Assert((ulg)s->strstart <= s->window_size - MIN_LOOKAHEAD,
|
1320
|
+
// "not enough room for search");
|
1321
|
+
}
|
1322
|
+
|
1323
|
+
/* ===========================================================================
|
1324
|
+
* Copy without compression as much as possible from the input stream, return
|
1325
|
+
* the current block state.
|
1326
|
+
* This function does not insert new strings in the dictionary since
|
1327
|
+
* uncompressible data is probably not useful. This function is used
|
1328
|
+
* only for the level=0 compression option.
|
1329
|
+
* NOTE: this function should be optimized to avoid extra copying from
|
1330
|
+
* window to pending_buf.
|
1331
|
+
*/
|
1332
|
+
function deflate_stored(s, flush) {
|
1333
|
+
/* Stored blocks are limited to 0xffff bytes, pending_buf is limited
|
1334
|
+
* to pending_buf_size, and each stored block has a 5 byte header:
|
1335
|
+
*/
|
1336
|
+
var max_block_size = 0xffff;
|
1337
|
+
|
1338
|
+
if (max_block_size > s.pending_buf_size - 5) {
|
1339
|
+
max_block_size = s.pending_buf_size - 5;
|
1340
|
+
}
|
1341
|
+
|
1342
|
+
/* Copy as much as possible from input to output: */
|
1343
|
+
for (;;) {
|
1344
|
+
/* Fill the window as much as possible: */
|
1345
|
+
if (s.lookahead <= 1) {
|
1346
|
+
|
1347
|
+
//Assert(s->strstart < s->w_size+MAX_DIST(s) ||
|
1348
|
+
// s->block_start >= (long)s->w_size, "slide too late");
|
1349
|
+
// if (!(s.strstart < s.w_size + (s.w_size - MIN_LOOKAHEAD) ||
|
1350
|
+
// s.block_start >= s.w_size)) {
|
1351
|
+
// throw new Error("slide too late");
|
1352
|
+
// }
|
1353
|
+
|
1354
|
+
fill_window(s);
|
1355
|
+
if (s.lookahead === 0 && flush === Z_NO_FLUSH) {
|
1356
|
+
return BS_NEED_MORE;
|
1357
|
+
}
|
1358
|
+
|
1359
|
+
if (s.lookahead === 0) {
|
1360
|
+
break;
|
1361
|
+
}
|
1362
|
+
/* flush the current block */
|
1363
|
+
}
|
1364
|
+
//Assert(s->block_start >= 0L, "block gone");
|
1365
|
+
// if (s.block_start < 0) throw new Error("block gone");
|
1366
|
+
|
1367
|
+
s.strstart += s.lookahead;
|
1368
|
+
s.lookahead = 0;
|
1369
|
+
|
1370
|
+
/* Emit a stored block if pending_buf will be full: */
|
1371
|
+
var max_start = s.block_start + max_block_size;
|
1372
|
+
|
1373
|
+
if (s.strstart === 0 || s.strstart >= max_start) {
|
1374
|
+
/* strstart == 0 is possible when wraparound on 16-bit machine */
|
1375
|
+
s.lookahead = s.strstart - max_start;
|
1376
|
+
s.strstart = max_start;
|
1377
|
+
/*** FLUSH_BLOCK(s, 0); ***/
|
1378
|
+
flush_block_only(s, false);
|
1379
|
+
if (s.strm.avail_out === 0) {
|
1380
|
+
return BS_NEED_MORE;
|
1381
|
+
}
|
1382
|
+
/***/
|
1383
|
+
|
1384
|
+
|
1385
|
+
}
|
1386
|
+
/* Flush if we may have to slide, otherwise block_start may become
|
1387
|
+
* negative and the data will be gone:
|
1388
|
+
*/
|
1389
|
+
if (s.strstart - s.block_start >= (s.w_size - MIN_LOOKAHEAD)) {
|
1390
|
+
/*** FLUSH_BLOCK(s, 0); ***/
|
1391
|
+
flush_block_only(s, false);
|
1392
|
+
if (s.strm.avail_out === 0) {
|
1393
|
+
return BS_NEED_MORE;
|
1394
|
+
}
|
1395
|
+
/***/
|
1396
|
+
}
|
1397
|
+
}
|
1398
|
+
|
1399
|
+
s.insert = 0;
|
1400
|
+
|
1401
|
+
if (flush === Z_FINISH) {
|
1402
|
+
/*** FLUSH_BLOCK(s, 1); ***/
|
1403
|
+
flush_block_only(s, true);
|
1404
|
+
if (s.strm.avail_out === 0) {
|
1405
|
+
return BS_FINISH_STARTED;
|
1406
|
+
}
|
1407
|
+
/***/
|
1408
|
+
return BS_FINISH_DONE;
|
1409
|
+
}
|
1410
|
+
|
1411
|
+
if (s.strstart > s.block_start) {
|
1412
|
+
/*** FLUSH_BLOCK(s, 0); ***/
|
1413
|
+
flush_block_only(s, false);
|
1414
|
+
if (s.strm.avail_out === 0) {
|
1415
|
+
return BS_NEED_MORE;
|
1416
|
+
}
|
1417
|
+
/***/
|
1418
|
+
}
|
1419
|
+
|
1420
|
+
return BS_NEED_MORE;
|
1421
|
+
}
|
1422
|
+
|
1423
|
+
/* ===========================================================================
|
1424
|
+
* Compress as much as possible from the input stream, return the current
|
1425
|
+
* block state.
|
1426
|
+
* This function does not perform lazy evaluation of matches and inserts
|
1427
|
+
* new strings in the dictionary only for unmatched strings or for short
|
1428
|
+
* matches. It is used only for the fast compression options.
|
1429
|
+
*/
|
1430
|
+
function deflate_fast(s, flush) {
|
1431
|
+
var hash_head; /* head of the hash chain */
|
1432
|
+
var bflush; /* set if current block must be flushed */
|
1433
|
+
|
1434
|
+
for (;;) {
|
1435
|
+
/* Make sure that we always have enough lookahead, except
|
1436
|
+
* at the end of the input file. We need MAX_MATCH bytes
|
1437
|
+
* for the next match, plus MIN_MATCH bytes to insert the
|
1438
|
+
* string following the next match.
|
1439
|
+
*/
|
1440
|
+
if (s.lookahead < MIN_LOOKAHEAD) {
|
1441
|
+
fill_window(s);
|
1442
|
+
if (s.lookahead < MIN_LOOKAHEAD && flush === Z_NO_FLUSH) {
|
1443
|
+
return BS_NEED_MORE;
|
1444
|
+
}
|
1445
|
+
if (s.lookahead === 0) {
|
1446
|
+
break; /* flush the current block */
|
1447
|
+
}
|
1448
|
+
}
|
1449
|
+
|
1450
|
+
/* Insert the string window[strstart .. strstart+2] in the
|
1451
|
+
* dictionary, and set hash_head to the head of the hash chain:
|
1452
|
+
*/
|
1453
|
+
hash_head = 0/*NIL*/;
|
1454
|
+
if (s.lookahead >= MIN_MATCH) {
|
1455
|
+
/*** INSERT_STRING(s, s.strstart, hash_head); ***/
|
1456
|
+
s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask;
|
1457
|
+
hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];
|
1458
|
+
s.head[s.ins_h] = s.strstart;
|
1459
|
+
/***/
|
1460
|
+
}
|
1461
|
+
|
1462
|
+
/* Find the longest match, discarding those <= prev_length.
|
1463
|
+
* At this point we have always match_length < MIN_MATCH
|
1464
|
+
*/
|
1465
|
+
if (hash_head !== 0/*NIL*/ && ((s.strstart - hash_head) <= (s.w_size - MIN_LOOKAHEAD))) {
|
1466
|
+
/* To simplify the code, we prevent matches with the string
|
1467
|
+
* of window index 0 (in particular we have to avoid a match
|
1468
|
+
* of the string with itself at the start of the input file).
|
1469
|
+
*/
|
1470
|
+
s.match_length = longest_match(s, hash_head);
|
1471
|
+
/* longest_match() sets match_start */
|
1472
|
+
}
|
1473
|
+
if (s.match_length >= MIN_MATCH) {
|
1474
|
+
// check_match(s, s.strstart, s.match_start, s.match_length); // for debug only
|
1475
|
+
|
1476
|
+
/*** _tr_tally_dist(s, s.strstart - s.match_start,
|
1477
|
+
s.match_length - MIN_MATCH, bflush); ***/
|
1478
|
+
bflush = trees._tr_tally(s, s.strstart - s.match_start, s.match_length - MIN_MATCH);
|
1479
|
+
|
1480
|
+
s.lookahead -= s.match_length;
|
1481
|
+
|
1482
|
+
/* Insert new strings in the hash table only if the match length
|
1483
|
+
* is not too large. This saves time but degrades compression.
|
1484
|
+
*/
|
1485
|
+
if (s.match_length <= s.max_lazy_match/*max_insert_length*/ && s.lookahead >= MIN_MATCH) {
|
1486
|
+
s.match_length--; /* string at strstart already in table */
|
1487
|
+
do {
|
1488
|
+
s.strstart++;
|
1489
|
+
/*** INSERT_STRING(s, s.strstart, hash_head); ***/
|
1490
|
+
s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask;
|
1491
|
+
hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];
|
1492
|
+
s.head[s.ins_h] = s.strstart;
|
1493
|
+
/***/
|
1494
|
+
/* strstart never exceeds WSIZE-MAX_MATCH, so there are
|
1495
|
+
* always MIN_MATCH bytes ahead.
|
1496
|
+
*/
|
1497
|
+
} while (--s.match_length !== 0);
|
1498
|
+
s.strstart++;
|
1499
|
+
} else
|
1500
|
+
{
|
1501
|
+
s.strstart += s.match_length;
|
1502
|
+
s.match_length = 0;
|
1503
|
+
s.ins_h = s.window[s.strstart];
|
1504
|
+
/* UPDATE_HASH(s, s.ins_h, s.window[s.strstart+1]); */
|
1505
|
+
s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + 1]) & s.hash_mask;
|
1506
|
+
|
1507
|
+
//#if MIN_MATCH != 3
|
1508
|
+
// Call UPDATE_HASH() MIN_MATCH-3 more times
|
1509
|
+
//#endif
|
1510
|
+
/* If lookahead < MIN_MATCH, ins_h is garbage, but it does not
|
1511
|
+
* matter since it will be recomputed at next deflate call.
|
1512
|
+
*/
|
1513
|
+
}
|
1514
|
+
} else {
|
1515
|
+
/* No match, output a literal byte */
|
1516
|
+
//Tracevv((stderr,"%c", s.window[s.strstart]));
|
1517
|
+
/*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/
|
1518
|
+
bflush = trees._tr_tally(s, 0, s.window[s.strstart]);
|
1519
|
+
|
1520
|
+
s.lookahead--;
|
1521
|
+
s.strstart++;
|
1522
|
+
}
|
1523
|
+
if (bflush) {
|
1524
|
+
/*** FLUSH_BLOCK(s, 0); ***/
|
1525
|
+
flush_block_only(s, false);
|
1526
|
+
if (s.strm.avail_out === 0) {
|
1527
|
+
return BS_NEED_MORE;
|
1528
|
+
}
|
1529
|
+
/***/
|
1530
|
+
}
|
1531
|
+
}
|
1532
|
+
s.insert = ((s.strstart < (MIN_MATCH - 1)) ? s.strstart : MIN_MATCH - 1);
|
1533
|
+
if (flush === Z_FINISH) {
|
1534
|
+
/*** FLUSH_BLOCK(s, 1); ***/
|
1535
|
+
flush_block_only(s, true);
|
1536
|
+
if (s.strm.avail_out === 0) {
|
1537
|
+
return BS_FINISH_STARTED;
|
1538
|
+
}
|
1539
|
+
/***/
|
1540
|
+
return BS_FINISH_DONE;
|
1541
|
+
}
|
1542
|
+
if (s.last_lit) {
|
1543
|
+
/*** FLUSH_BLOCK(s, 0); ***/
|
1544
|
+
flush_block_only(s, false);
|
1545
|
+
if (s.strm.avail_out === 0) {
|
1546
|
+
return BS_NEED_MORE;
|
1547
|
+
}
|
1548
|
+
/***/
|
1549
|
+
}
|
1550
|
+
return BS_BLOCK_DONE;
|
1551
|
+
}
|
1552
|
+
|
1553
|
+
/* ===========================================================================
|
1554
|
+
* Same as above, but achieves better compression. We use a lazy
|
1555
|
+
* evaluation for matches: a match is finally adopted only if there is
|
1556
|
+
* no better match at the next window position.
|
1557
|
+
*/
|
1558
|
+
function deflate_slow(s, flush) {
|
1559
|
+
var hash_head; /* head of hash chain */
|
1560
|
+
var bflush; /* set if current block must be flushed */
|
1561
|
+
|
1562
|
+
var max_insert;
|
1563
|
+
|
1564
|
+
/* Process the input block. */
|
1565
|
+
for (;;) {
|
1566
|
+
/* Make sure that we always have enough lookahead, except
|
1567
|
+
* at the end of the input file. We need MAX_MATCH bytes
|
1568
|
+
* for the next match, plus MIN_MATCH bytes to insert the
|
1569
|
+
* string following the next match.
|
1570
|
+
*/
|
1571
|
+
if (s.lookahead < MIN_LOOKAHEAD) {
|
1572
|
+
fill_window(s);
|
1573
|
+
if (s.lookahead < MIN_LOOKAHEAD && flush === Z_NO_FLUSH) {
|
1574
|
+
return BS_NEED_MORE;
|
1575
|
+
}
|
1576
|
+
if (s.lookahead === 0) { break; } /* flush the current block */
|
1577
|
+
}
|
1578
|
+
|
1579
|
+
/* Insert the string window[strstart .. strstart+2] in the
|
1580
|
+
* dictionary, and set hash_head to the head of the hash chain:
|
1581
|
+
*/
|
1582
|
+
hash_head = 0/*NIL*/;
|
1583
|
+
if (s.lookahead >= MIN_MATCH) {
|
1584
|
+
/*** INSERT_STRING(s, s.strstart, hash_head); ***/
|
1585
|
+
s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask;
|
1586
|
+
hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];
|
1587
|
+
s.head[s.ins_h] = s.strstart;
|
1588
|
+
/***/
|
1589
|
+
}
|
1590
|
+
|
1591
|
+
/* Find the longest match, discarding those <= prev_length.
|
1592
|
+
*/
|
1593
|
+
s.prev_length = s.match_length;
|
1594
|
+
s.prev_match = s.match_start;
|
1595
|
+
s.match_length = MIN_MATCH - 1;
|
1596
|
+
|
1597
|
+
if (hash_head !== 0/*NIL*/ && s.prev_length < s.max_lazy_match &&
|
1598
|
+
s.strstart - hash_head <= (s.w_size - MIN_LOOKAHEAD)/*MAX_DIST(s)*/) {
|
1599
|
+
/* To simplify the code, we prevent matches with the string
|
1600
|
+
* of window index 0 (in particular we have to avoid a match
|
1601
|
+
* of the string with itself at the start of the input file).
|
1602
|
+
*/
|
1603
|
+
s.match_length = longest_match(s, hash_head);
|
1604
|
+
/* longest_match() sets match_start */
|
1605
|
+
|
1606
|
+
if (s.match_length <= 5 &&
|
1607
|
+
(s.strategy === Z_FILTERED || (s.match_length === MIN_MATCH && s.strstart - s.match_start > 4096/*TOO_FAR*/))) {
|
1608
|
+
|
1609
|
+
/* If prev_match is also MIN_MATCH, match_start is garbage
|
1610
|
+
* but we will ignore the current match anyway.
|
1611
|
+
*/
|
1612
|
+
s.match_length = MIN_MATCH - 1;
|
1613
|
+
}
|
1614
|
+
}
|
1615
|
+
/* If there was a match at the previous step and the current
|
1616
|
+
* match is not better, output the previous match:
|
1617
|
+
*/
|
1618
|
+
if (s.prev_length >= MIN_MATCH && s.match_length <= s.prev_length) {
|
1619
|
+
max_insert = s.strstart + s.lookahead - MIN_MATCH;
|
1620
|
+
/* Do not insert strings in hash table beyond this. */
|
1621
|
+
|
1622
|
+
//check_match(s, s.strstart-1, s.prev_match, s.prev_length);
|
1623
|
+
|
1624
|
+
/***_tr_tally_dist(s, s.strstart - 1 - s.prev_match,
|
1625
|
+
s.prev_length - MIN_MATCH, bflush);***/
|
1626
|
+
bflush = trees._tr_tally(s, s.strstart - 1 - s.prev_match, s.prev_length - MIN_MATCH);
|
1627
|
+
/* Insert in hash table all strings up to the end of the match.
|
1628
|
+
* strstart-1 and strstart are already inserted. If there is not
|
1629
|
+
* enough lookahead, the last two strings are not inserted in
|
1630
|
+
* the hash table.
|
1631
|
+
*/
|
1632
|
+
s.lookahead -= s.prev_length - 1;
|
1633
|
+
s.prev_length -= 2;
|
1634
|
+
do {
|
1635
|
+
if (++s.strstart <= max_insert) {
|
1636
|
+
/*** INSERT_STRING(s, s.strstart, hash_head); ***/
|
1637
|
+
s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask;
|
1638
|
+
hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];
|
1639
|
+
s.head[s.ins_h] = s.strstart;
|
1640
|
+
/***/
|
1641
|
+
}
|
1642
|
+
} while (--s.prev_length !== 0);
|
1643
|
+
s.match_available = 0;
|
1644
|
+
s.match_length = MIN_MATCH - 1;
|
1645
|
+
s.strstart++;
|
1646
|
+
|
1647
|
+
if (bflush) {
|
1648
|
+
/*** FLUSH_BLOCK(s, 0); ***/
|
1649
|
+
flush_block_only(s, false);
|
1650
|
+
if (s.strm.avail_out === 0) {
|
1651
|
+
return BS_NEED_MORE;
|
1652
|
+
}
|
1653
|
+
/***/
|
1654
|
+
}
|
1655
|
+
|
1656
|
+
} else if (s.match_available) {
|
1657
|
+
/* If there was no match at the previous position, output a
|
1658
|
+
* single literal. If there was a match but the current match
|
1659
|
+
* is longer, truncate the previous match to a single literal.
|
1660
|
+
*/
|
1661
|
+
//Tracevv((stderr,"%c", s->window[s->strstart-1]));
|
1662
|
+
/*** _tr_tally_lit(s, s.window[s.strstart-1], bflush); ***/
|
1663
|
+
bflush = trees._tr_tally(s, 0, s.window[s.strstart - 1]);
|
1664
|
+
|
1665
|
+
if (bflush) {
|
1666
|
+
/*** FLUSH_BLOCK_ONLY(s, 0) ***/
|
1667
|
+
flush_block_only(s, false);
|
1668
|
+
/***/
|
1669
|
+
}
|
1670
|
+
s.strstart++;
|
1671
|
+
s.lookahead--;
|
1672
|
+
if (s.strm.avail_out === 0) {
|
1673
|
+
return BS_NEED_MORE;
|
1674
|
+
}
|
1675
|
+
} else {
|
1676
|
+
/* There is no previous match to compare with, wait for
|
1677
|
+
* the next step to decide.
|
1678
|
+
*/
|
1679
|
+
s.match_available = 1;
|
1680
|
+
s.strstart++;
|
1681
|
+
s.lookahead--;
|
1682
|
+
}
|
1683
|
+
}
|
1684
|
+
//Assert (flush != Z_NO_FLUSH, "no flush?");
|
1685
|
+
if (s.match_available) {
|
1686
|
+
//Tracevv((stderr,"%c", s->window[s->strstart-1]));
|
1687
|
+
/*** _tr_tally_lit(s, s.window[s.strstart-1], bflush); ***/
|
1688
|
+
bflush = trees._tr_tally(s, 0, s.window[s.strstart - 1]);
|
1689
|
+
|
1690
|
+
s.match_available = 0;
|
1691
|
+
}
|
1692
|
+
s.insert = s.strstart < MIN_MATCH - 1 ? s.strstart : MIN_MATCH - 1;
|
1693
|
+
if (flush === Z_FINISH) {
|
1694
|
+
/*** FLUSH_BLOCK(s, 1); ***/
|
1695
|
+
flush_block_only(s, true);
|
1696
|
+
if (s.strm.avail_out === 0) {
|
1697
|
+
return BS_FINISH_STARTED;
|
1698
|
+
}
|
1699
|
+
/***/
|
1700
|
+
return BS_FINISH_DONE;
|
1701
|
+
}
|
1702
|
+
if (s.last_lit) {
|
1703
|
+
/*** FLUSH_BLOCK(s, 0); ***/
|
1704
|
+
flush_block_only(s, false);
|
1705
|
+
if (s.strm.avail_out === 0) {
|
1706
|
+
return BS_NEED_MORE;
|
1707
|
+
}
|
1708
|
+
/***/
|
1709
|
+
}
|
1710
|
+
|
1711
|
+
return BS_BLOCK_DONE;
|
1712
|
+
}
|
1713
|
+
|
1714
|
+
|
1715
|
+
/* ===========================================================================
|
1716
|
+
* For Z_RLE, simply look for runs of bytes, generate matches only of distance
|
1717
|
+
* one. Do not maintain a hash table. (It will be regenerated if this run of
|
1718
|
+
* deflate switches away from Z_RLE.)
|
1719
|
+
*/
|
1720
|
+
function deflate_rle(s, flush) {
|
1721
|
+
var bflush; /* set if current block must be flushed */
|
1722
|
+
var prev; /* byte at distance one to match */
|
1723
|
+
var scan, strend; /* scan goes up to strend for length of run */
|
1724
|
+
|
1725
|
+
var _win = s.window;
|
1726
|
+
|
1727
|
+
for (;;) {
|
1728
|
+
/* Make sure that we always have enough lookahead, except
|
1729
|
+
* at the end of the input file. We need MAX_MATCH bytes
|
1730
|
+
* for the longest run, plus one for the unrolled loop.
|
1731
|
+
*/
|
1732
|
+
if (s.lookahead <= MAX_MATCH) {
|
1733
|
+
fill_window(s);
|
1734
|
+
if (s.lookahead <= MAX_MATCH && flush === Z_NO_FLUSH) {
|
1735
|
+
return BS_NEED_MORE;
|
1736
|
+
}
|
1737
|
+
if (s.lookahead === 0) { break; } /* flush the current block */
|
1738
|
+
}
|
1739
|
+
|
1740
|
+
/* See how many times the previous byte repeats */
|
1741
|
+
s.match_length = 0;
|
1742
|
+
if (s.lookahead >= MIN_MATCH && s.strstart > 0) {
|
1743
|
+
scan = s.strstart - 1;
|
1744
|
+
prev = _win[scan];
|
1745
|
+
if (prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan]) {
|
1746
|
+
strend = s.strstart + MAX_MATCH;
|
1747
|
+
do {
|
1748
|
+
/*jshint noempty:false*/
|
1749
|
+
} while (prev === _win[++scan] && prev === _win[++scan] &&
|
1750
|
+
prev === _win[++scan] && prev === _win[++scan] &&
|
1751
|
+
prev === _win[++scan] && prev === _win[++scan] &&
|
1752
|
+
prev === _win[++scan] && prev === _win[++scan] &&
|
1753
|
+
scan < strend);
|
1754
|
+
s.match_length = MAX_MATCH - (strend - scan);
|
1755
|
+
if (s.match_length > s.lookahead) {
|
1756
|
+
s.match_length = s.lookahead;
|
1757
|
+
}
|
1758
|
+
}
|
1759
|
+
//Assert(scan <= s->window+(uInt)(s->window_size-1), "wild scan");
|
1760
|
+
}
|
1761
|
+
|
1762
|
+
/* Emit match if have run of MIN_MATCH or longer, else emit literal */
|
1763
|
+
if (s.match_length >= MIN_MATCH) {
|
1764
|
+
//check_match(s, s.strstart, s.strstart - 1, s.match_length);
|
1765
|
+
|
1766
|
+
/*** _tr_tally_dist(s, 1, s.match_length - MIN_MATCH, bflush); ***/
|
1767
|
+
bflush = trees._tr_tally(s, 1, s.match_length - MIN_MATCH);
|
1768
|
+
|
1769
|
+
s.lookahead -= s.match_length;
|
1770
|
+
s.strstart += s.match_length;
|
1771
|
+
s.match_length = 0;
|
1772
|
+
} else {
|
1773
|
+
/* No match, output a literal byte */
|
1774
|
+
//Tracevv((stderr,"%c", s->window[s->strstart]));
|
1775
|
+
/*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/
|
1776
|
+
bflush = trees._tr_tally(s, 0, s.window[s.strstart]);
|
1777
|
+
|
1778
|
+
s.lookahead--;
|
1779
|
+
s.strstart++;
|
1780
|
+
}
|
1781
|
+
if (bflush) {
|
1782
|
+
/*** FLUSH_BLOCK(s, 0); ***/
|
1783
|
+
flush_block_only(s, false);
|
1784
|
+
if (s.strm.avail_out === 0) {
|
1785
|
+
return BS_NEED_MORE;
|
1786
|
+
}
|
1787
|
+
/***/
|
1788
|
+
}
|
1789
|
+
}
|
1790
|
+
s.insert = 0;
|
1791
|
+
if (flush === Z_FINISH) {
|
1792
|
+
/*** FLUSH_BLOCK(s, 1); ***/
|
1793
|
+
flush_block_only(s, true);
|
1794
|
+
if (s.strm.avail_out === 0) {
|
1795
|
+
return BS_FINISH_STARTED;
|
1796
|
+
}
|
1797
|
+
/***/
|
1798
|
+
return BS_FINISH_DONE;
|
1799
|
+
}
|
1800
|
+
if (s.last_lit) {
|
1801
|
+
/*** FLUSH_BLOCK(s, 0); ***/
|
1802
|
+
flush_block_only(s, false);
|
1803
|
+
if (s.strm.avail_out === 0) {
|
1804
|
+
return BS_NEED_MORE;
|
1805
|
+
}
|
1806
|
+
/***/
|
1807
|
+
}
|
1808
|
+
return BS_BLOCK_DONE;
|
1809
|
+
}
|
1810
|
+
|
1811
|
+
/* ===========================================================================
|
1812
|
+
* For Z_HUFFMAN_ONLY, do not look for matches. Do not maintain a hash table.
|
1813
|
+
* (It will be regenerated if this run of deflate switches away from Huffman.)
|
1814
|
+
*/
|
1815
|
+
function deflate_huff(s, flush) {
|
1816
|
+
var bflush; /* set if current block must be flushed */
|
1817
|
+
|
1818
|
+
for (;;) {
|
1819
|
+
/* Make sure that we have a literal to write. */
|
1820
|
+
if (s.lookahead === 0) {
|
1821
|
+
fill_window(s);
|
1822
|
+
if (s.lookahead === 0) {
|
1823
|
+
if (flush === Z_NO_FLUSH) {
|
1824
|
+
return BS_NEED_MORE;
|
1825
|
+
}
|
1826
|
+
break; /* flush the current block */
|
1827
|
+
}
|
1828
|
+
}
|
1829
|
+
|
1830
|
+
/* Output a literal byte */
|
1831
|
+
s.match_length = 0;
|
1832
|
+
//Tracevv((stderr,"%c", s->window[s->strstart]));
|
1833
|
+
/*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/
|
1834
|
+
bflush = trees._tr_tally(s, 0, s.window[s.strstart]);
|
1835
|
+
s.lookahead--;
|
1836
|
+
s.strstart++;
|
1837
|
+
if (bflush) {
|
1838
|
+
/*** FLUSH_BLOCK(s, 0); ***/
|
1839
|
+
flush_block_only(s, false);
|
1840
|
+
if (s.strm.avail_out === 0) {
|
1841
|
+
return BS_NEED_MORE;
|
1842
|
+
}
|
1843
|
+
/***/
|
1844
|
+
}
|
1845
|
+
}
|
1846
|
+
s.insert = 0;
|
1847
|
+
if (flush === Z_FINISH) {
|
1848
|
+
/*** FLUSH_BLOCK(s, 1); ***/
|
1849
|
+
flush_block_only(s, true);
|
1850
|
+
if (s.strm.avail_out === 0) {
|
1851
|
+
return BS_FINISH_STARTED;
|
1852
|
+
}
|
1853
|
+
/***/
|
1854
|
+
return BS_FINISH_DONE;
|
1855
|
+
}
|
1856
|
+
if (s.last_lit) {
|
1857
|
+
/*** FLUSH_BLOCK(s, 0); ***/
|
1858
|
+
flush_block_only(s, false);
|
1859
|
+
if (s.strm.avail_out === 0) {
|
1860
|
+
return BS_NEED_MORE;
|
1861
|
+
}
|
1862
|
+
/***/
|
1863
|
+
}
|
1864
|
+
return BS_BLOCK_DONE;
|
1865
|
+
}
|
1866
|
+
|
1867
|
+
/* Values for max_lazy_match, good_match and max_chain_length, depending on
|
1868
|
+
* the desired pack level (0..9). The values given below have been tuned to
|
1869
|
+
* exclude worst case performance for pathological files. Better values may be
|
1870
|
+
* found for specific files.
|
1871
|
+
*/
|
1872
|
+
function Config(good_length, max_lazy, nice_length, max_chain, func) {
|
1873
|
+
this.good_length = good_length;
|
1874
|
+
this.max_lazy = max_lazy;
|
1875
|
+
this.nice_length = nice_length;
|
1876
|
+
this.max_chain = max_chain;
|
1877
|
+
this.func = func;
|
1878
|
+
}
|
1879
|
+
|
1880
|
+
var configuration_table;
|
1881
|
+
|
1882
|
+
configuration_table = [
|
1883
|
+
/* good lazy nice chain */
|
1884
|
+
new Config(0, 0, 0, 0, deflate_stored), /* 0 store only */
|
1885
|
+
new Config(4, 4, 8, 4, deflate_fast), /* 1 max speed, no lazy matches */
|
1886
|
+
new Config(4, 5, 16, 8, deflate_fast), /* 2 */
|
1887
|
+
new Config(4, 6, 32, 32, deflate_fast), /* 3 */
|
1888
|
+
|
1889
|
+
new Config(4, 4, 16, 16, deflate_slow), /* 4 lazy matches */
|
1890
|
+
new Config(8, 16, 32, 32, deflate_slow), /* 5 */
|
1891
|
+
new Config(8, 16, 128, 128, deflate_slow), /* 6 */
|
1892
|
+
new Config(8, 32, 128, 256, deflate_slow), /* 7 */
|
1893
|
+
new Config(32, 128, 258, 1024, deflate_slow), /* 8 */
|
1894
|
+
new Config(32, 258, 258, 4096, deflate_slow) /* 9 max compression */
|
1895
|
+
];
|
1896
|
+
|
1897
|
+
|
1898
|
+
/* ===========================================================================
|
1899
|
+
* Initialize the "longest match" routines for a new zlib stream
|
1900
|
+
*/
|
1901
|
+
function lm_init(s) {
|
1902
|
+
s.window_size = 2 * s.w_size;
|
1903
|
+
|
1904
|
+
/*** CLEAR_HASH(s); ***/
|
1905
|
+
zero(s.head); // Fill with NIL (= 0);
|
1906
|
+
|
1907
|
+
/* Set the default configuration parameters:
|
1908
|
+
*/
|
1909
|
+
s.max_lazy_match = configuration_table[s.level].max_lazy;
|
1910
|
+
s.good_match = configuration_table[s.level].good_length;
|
1911
|
+
s.nice_match = configuration_table[s.level].nice_length;
|
1912
|
+
s.max_chain_length = configuration_table[s.level].max_chain;
|
1913
|
+
|
1914
|
+
s.strstart = 0;
|
1915
|
+
s.block_start = 0;
|
1916
|
+
s.lookahead = 0;
|
1917
|
+
s.insert = 0;
|
1918
|
+
s.match_length = s.prev_length = MIN_MATCH - 1;
|
1919
|
+
s.match_available = 0;
|
1920
|
+
s.ins_h = 0;
|
1921
|
+
}
|
1922
|
+
|
1923
|
+
|
1924
|
+
function DeflateState() {
|
1925
|
+
this.strm = null; /* pointer back to this zlib stream */
|
1926
|
+
this.status = 0; /* as the name implies */
|
1927
|
+
this.pending_buf = null; /* output still pending */
|
1928
|
+
this.pending_buf_size = 0; /* size of pending_buf */
|
1929
|
+
this.pending_out = 0; /* next pending byte to output to the stream */
|
1930
|
+
this.pending = 0; /* nb of bytes in the pending buffer */
|
1931
|
+
this.wrap = 0; /* bit 0 true for zlib, bit 1 true for gzip */
|
1932
|
+
this.gzhead = null; /* gzip header information to write */
|
1933
|
+
this.gzindex = 0; /* where in extra, name, or comment */
|
1934
|
+
this.method = Z_DEFLATED; /* can only be DEFLATED */
|
1935
|
+
this.last_flush = -1; /* value of flush param for previous deflate call */
|
1936
|
+
|
1937
|
+
this.w_size = 0; /* LZ77 window size (32K by default) */
|
1938
|
+
this.w_bits = 0; /* log2(w_size) (8..16) */
|
1939
|
+
this.w_mask = 0; /* w_size - 1 */
|
1940
|
+
|
1941
|
+
this.window = null;
|
1942
|
+
/* Sliding window. Input bytes are read into the second half of the window,
|
1943
|
+
* and move to the first half later to keep a dictionary of at least wSize
|
1944
|
+
* bytes. With this organization, matches are limited to a distance of
|
1945
|
+
* wSize-MAX_MATCH bytes, but this ensures that IO is always
|
1946
|
+
* performed with a length multiple of the block size.
|
1947
|
+
*/
|
1948
|
+
|
1949
|
+
this.window_size = 0;
|
1950
|
+
/* Actual size of window: 2*wSize, except when the user input buffer
|
1951
|
+
* is directly used as sliding window.
|
1952
|
+
*/
|
1953
|
+
|
1954
|
+
this.prev = null;
|
1955
|
+
/* Link to older string with same hash index. To limit the size of this
|
1956
|
+
* array to 64K, this link is maintained only for the last 32K strings.
|
1957
|
+
* An index in this array is thus a window index modulo 32K.
|
1958
|
+
*/
|
1959
|
+
|
1960
|
+
this.head = null; /* Heads of the hash chains or NIL. */
|
1961
|
+
|
1962
|
+
this.ins_h = 0; /* hash index of string to be inserted */
|
1963
|
+
this.hash_size = 0; /* number of elements in hash table */
|
1964
|
+
this.hash_bits = 0; /* log2(hash_size) */
|
1965
|
+
this.hash_mask = 0; /* hash_size-1 */
|
1966
|
+
|
1967
|
+
this.hash_shift = 0;
|
1968
|
+
/* Number of bits by which ins_h must be shifted at each input
|
1969
|
+
* step. It must be such that after MIN_MATCH steps, the oldest
|
1970
|
+
* byte no longer takes part in the hash key, that is:
|
1971
|
+
* hash_shift * MIN_MATCH >= hash_bits
|
1972
|
+
*/
|
1973
|
+
|
1974
|
+
this.block_start = 0;
|
1975
|
+
/* Window position at the beginning of the current output block. Gets
|
1976
|
+
* negative when the window is moved backwards.
|
1977
|
+
*/
|
1978
|
+
|
1979
|
+
this.match_length = 0; /* length of best match */
|
1980
|
+
this.prev_match = 0; /* previous match */
|
1981
|
+
this.match_available = 0; /* set if previous match exists */
|
1982
|
+
this.strstart = 0; /* start of string to insert */
|
1983
|
+
this.match_start = 0; /* start of matching string */
|
1984
|
+
this.lookahead = 0; /* number of valid bytes ahead in window */
|
1985
|
+
|
1986
|
+
this.prev_length = 0;
|
1987
|
+
/* Length of the best match at previous step. Matches not greater than this
|
1988
|
+
* are discarded. This is used in the lazy match evaluation.
|
1989
|
+
*/
|
1990
|
+
|
1991
|
+
this.max_chain_length = 0;
|
1992
|
+
/* To speed up deflation, hash chains are never searched beyond this
|
1993
|
+
* length. A higher limit improves compression ratio but degrades the
|
1994
|
+
* speed.
|
1995
|
+
*/
|
1996
|
+
|
1997
|
+
this.max_lazy_match = 0;
|
1998
|
+
/* Attempt to find a better match only when the current match is strictly
|
1999
|
+
* smaller than this value. This mechanism is used only for compression
|
2000
|
+
* levels >= 4.
|
2001
|
+
*/
|
2002
|
+
// That's alias to max_lazy_match, don't use directly
|
2003
|
+
//this.max_insert_length = 0;
|
2004
|
+
/* Insert new strings in the hash table only if the match length is not
|
2005
|
+
* greater than this length. This saves time but degrades compression.
|
2006
|
+
* max_insert_length is used only for compression levels <= 3.
|
2007
|
+
*/
|
2008
|
+
|
2009
|
+
this.level = 0; /* compression level (1..9) */
|
2010
|
+
this.strategy = 0; /* favor or force Huffman coding*/
|
2011
|
+
|
2012
|
+
this.good_match = 0;
|
2013
|
+
/* Use a faster search when the previous match is longer than this */
|
2014
|
+
|
2015
|
+
this.nice_match = 0; /* Stop searching when current match exceeds this */
|
2016
|
+
|
2017
|
+
/* used by trees.c: */
|
2018
|
+
|
2019
|
+
/* Didn't use ct_data typedef below to suppress compiler warning */
|
2020
|
+
|
2021
|
+
// struct ct_data_s dyn_ltree[HEAP_SIZE]; /* literal and length tree */
|
2022
|
+
// struct ct_data_s dyn_dtree[2*D_CODES+1]; /* distance tree */
|
2023
|
+
// struct ct_data_s bl_tree[2*BL_CODES+1]; /* Huffman tree for bit lengths */
|
2024
|
+
|
2025
|
+
// Use flat array of DOUBLE size, with interleaved fata,
|
2026
|
+
// because JS does not support effective
|
2027
|
+
this.dyn_ltree = new utils.Buf16(HEAP_SIZE * 2);
|
2028
|
+
this.dyn_dtree = new utils.Buf16((2 * D_CODES + 1) * 2);
|
2029
|
+
this.bl_tree = new utils.Buf16((2 * BL_CODES + 1) * 2);
|
2030
|
+
zero(this.dyn_ltree);
|
2031
|
+
zero(this.dyn_dtree);
|
2032
|
+
zero(this.bl_tree);
|
2033
|
+
|
2034
|
+
this.l_desc = null; /* desc. for literal tree */
|
2035
|
+
this.d_desc = null; /* desc. for distance tree */
|
2036
|
+
this.bl_desc = null; /* desc. for bit length tree */
|
2037
|
+
|
2038
|
+
//ush bl_count[MAX_BITS+1];
|
2039
|
+
this.bl_count = new utils.Buf16(MAX_BITS + 1);
|
2040
|
+
/* number of codes at each bit length for an optimal tree */
|
2041
|
+
|
2042
|
+
//int heap[2*L_CODES+1]; /* heap used to build the Huffman trees */
|
2043
|
+
this.heap = new utils.Buf16(2 * L_CODES + 1); /* heap used to build the Huffman trees */
|
2044
|
+
zero(this.heap);
|
2045
|
+
|
2046
|
+
this.heap_len = 0; /* number of elements in the heap */
|
2047
|
+
this.heap_max = 0; /* element of largest frequency */
|
2048
|
+
/* The sons of heap[n] are heap[2*n] and heap[2*n+1]. heap[0] is not used.
|
2049
|
+
* The same heap array is used to build all trees.
|
2050
|
+
*/
|
2051
|
+
|
2052
|
+
this.depth = new utils.Buf16(2 * L_CODES + 1); //uch depth[2*L_CODES+1];
|
2053
|
+
zero(this.depth);
|
2054
|
+
/* Depth of each subtree used as tie breaker for trees of equal frequency
|
2055
|
+
*/
|
2056
|
+
|
2057
|
+
this.l_buf = 0; /* buffer index for literals or lengths */
|
2058
|
+
|
2059
|
+
this.lit_bufsize = 0;
|
2060
|
+
/* Size of match buffer for literals/lengths. There are 4 reasons for
|
2061
|
+
* limiting lit_bufsize to 64K:
|
2062
|
+
* - frequencies can be kept in 16 bit counters
|
2063
|
+
* - if compression is not successful for the first block, all input
|
2064
|
+
* data is still in the window so we can still emit a stored block even
|
2065
|
+
* when input comes from standard input. (This can also be done for
|
2066
|
+
* all blocks if lit_bufsize is not greater than 32K.)
|
2067
|
+
* - if compression is not successful for a file smaller than 64K, we can
|
2068
|
+
* even emit a stored file instead of a stored block (saving 5 bytes).
|
2069
|
+
* This is applicable only for zip (not gzip or zlib).
|
2070
|
+
* - creating new Huffman trees less frequently may not provide fast
|
2071
|
+
* adaptation to changes in the input data statistics. (Take for
|
2072
|
+
* example a binary file with poorly compressible code followed by
|
2073
|
+
* a highly compressible string table.) Smaller buffer sizes give
|
2074
|
+
* fast adaptation but have of course the overhead of transmitting
|
2075
|
+
* trees more frequently.
|
2076
|
+
* - I can't count above 4
|
2077
|
+
*/
|
2078
|
+
|
2079
|
+
this.last_lit = 0; /* running index in l_buf */
|
2080
|
+
|
2081
|
+
this.d_buf = 0;
|
2082
|
+
/* Buffer index for distances. To simplify the code, d_buf and l_buf have
|
2083
|
+
* the same number of elements. To use different lengths, an extra flag
|
2084
|
+
* array would be necessary.
|
2085
|
+
*/
|
2086
|
+
|
2087
|
+
this.opt_len = 0; /* bit length of current block with optimal trees */
|
2088
|
+
this.static_len = 0; /* bit length of current block with static trees */
|
2089
|
+
this.matches = 0; /* number of string matches in current block */
|
2090
|
+
this.insert = 0; /* bytes at end of window left to insert */
|
2091
|
+
|
2092
|
+
|
2093
|
+
this.bi_buf = 0;
|
2094
|
+
/* Output buffer. bits are inserted starting at the bottom (least
|
2095
|
+
* significant bits).
|
2096
|
+
*/
|
2097
|
+
this.bi_valid = 0;
|
2098
|
+
/* Number of valid bits in bi_buf. All bits above the last valid bit
|
2099
|
+
* are always zero.
|
2100
|
+
*/
|
2101
|
+
|
2102
|
+
// Used for window memory init. We safely ignore it for JS. That makes
|
2103
|
+
// sense only for pointers and memory check tools.
|
2104
|
+
//this.high_water = 0;
|
2105
|
+
/* High water mark offset in window for initialized bytes -- bytes above
|
2106
|
+
* this are set to zero in order to avoid memory check warnings when
|
2107
|
+
* longest match routines access bytes past the input. This is then
|
2108
|
+
* updated to the new high water mark.
|
2109
|
+
*/
|
2110
|
+
}
|
2111
|
+
|
2112
|
+
|
2113
|
+
function deflateResetKeep(strm) {
|
2114
|
+
var s;
|
2115
|
+
|
2116
|
+
if (!strm || !strm.state) {
|
2117
|
+
return err(strm, Z_STREAM_ERROR);
|
2118
|
+
}
|
2119
|
+
|
2120
|
+
strm.total_in = strm.total_out = 0;
|
2121
|
+
strm.data_type = Z_UNKNOWN;
|
2122
|
+
|
2123
|
+
s = strm.state;
|
2124
|
+
s.pending = 0;
|
2125
|
+
s.pending_out = 0;
|
2126
|
+
|
2127
|
+
if (s.wrap < 0) {
|
2128
|
+
s.wrap = -s.wrap;
|
2129
|
+
/* was made negative by deflate(..., Z_FINISH); */
|
2130
|
+
}
|
2131
|
+
s.status = (s.wrap ? INIT_STATE : BUSY_STATE);
|
2132
|
+
strm.adler = (s.wrap === 2) ?
|
2133
|
+
0 // crc32(0, Z_NULL, 0)
|
2134
|
+
:
|
2135
|
+
1; // adler32(0, Z_NULL, 0)
|
2136
|
+
s.last_flush = Z_NO_FLUSH;
|
2137
|
+
trees._tr_init(s);
|
2138
|
+
return Z_OK;
|
2139
|
+
}
|
2140
|
+
|
2141
|
+
|
2142
|
+
function deflateReset(strm) {
|
2143
|
+
var ret = deflateResetKeep(strm);
|
2144
|
+
if (ret === Z_OK) {
|
2145
|
+
lm_init(strm.state);
|
2146
|
+
}
|
2147
|
+
return ret;
|
2148
|
+
}
|
2149
|
+
|
2150
|
+
|
2151
|
+
function deflateSetHeader(strm, head) {
|
2152
|
+
if (!strm || !strm.state) { return Z_STREAM_ERROR; }
|
2153
|
+
if (strm.state.wrap !== 2) { return Z_STREAM_ERROR; }
|
2154
|
+
strm.state.gzhead = head;
|
2155
|
+
return Z_OK;
|
2156
|
+
}
|
2157
|
+
|
2158
|
+
|
2159
|
+
function deflateInit2(strm, level, method, windowBits, memLevel, strategy) {
|
2160
|
+
if (!strm) { // === Z_NULL
|
2161
|
+
return Z_STREAM_ERROR;
|
2162
|
+
}
|
2163
|
+
var wrap = 1;
|
2164
|
+
|
2165
|
+
if (level === Z_DEFAULT_COMPRESSION) {
|
2166
|
+
level = 6;
|
2167
|
+
}
|
2168
|
+
|
2169
|
+
if (windowBits < 0) { /* suppress zlib wrapper */
|
2170
|
+
wrap = 0;
|
2171
|
+
windowBits = -windowBits;
|
2172
|
+
}
|
2173
|
+
|
2174
|
+
else if (windowBits > 15) {
|
2175
|
+
wrap = 2; /* write gzip wrapper instead */
|
2176
|
+
windowBits -= 16;
|
2177
|
+
}
|
2178
|
+
|
2179
|
+
|
2180
|
+
if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method !== Z_DEFLATED ||
|
2181
|
+
windowBits < 8 || windowBits > 15 || level < 0 || level > 9 ||
|
2182
|
+
strategy < 0 || strategy > Z_FIXED) {
|
2183
|
+
return err(strm, Z_STREAM_ERROR);
|
2184
|
+
}
|
2185
|
+
|
2186
|
+
|
2187
|
+
if (windowBits === 8) {
|
2188
|
+
windowBits = 9;
|
2189
|
+
}
|
2190
|
+
/* until 256-byte window bug fixed */
|
2191
|
+
|
2192
|
+
var s = new DeflateState();
|
2193
|
+
|
2194
|
+
strm.state = s;
|
2195
|
+
s.strm = strm;
|
2196
|
+
|
2197
|
+
s.wrap = wrap;
|
2198
|
+
s.gzhead = null;
|
2199
|
+
s.w_bits = windowBits;
|
2200
|
+
s.w_size = 1 << s.w_bits;
|
2201
|
+
s.w_mask = s.w_size - 1;
|
2202
|
+
|
2203
|
+
s.hash_bits = memLevel + 7;
|
2204
|
+
s.hash_size = 1 << s.hash_bits;
|
2205
|
+
s.hash_mask = s.hash_size - 1;
|
2206
|
+
s.hash_shift = ~~((s.hash_bits + MIN_MATCH - 1) / MIN_MATCH);
|
2207
|
+
|
2208
|
+
s.window = new utils.Buf8(s.w_size * 2);
|
2209
|
+
s.head = new utils.Buf16(s.hash_size);
|
2210
|
+
s.prev = new utils.Buf16(s.w_size);
|
2211
|
+
|
2212
|
+
// Don't need mem init magic for JS.
|
2213
|
+
//s.high_water = 0; /* nothing written to s->window yet */
|
2214
|
+
|
2215
|
+
s.lit_bufsize = 1 << (memLevel + 6); /* 16K elements by default */
|
2216
|
+
|
2217
|
+
s.pending_buf_size = s.lit_bufsize * 4;
|
2218
|
+
|
2219
|
+
//overlay = (ushf *) ZALLOC(strm, s->lit_bufsize, sizeof(ush)+2);
|
2220
|
+
//s->pending_buf = (uchf *) overlay;
|
2221
|
+
s.pending_buf = new utils.Buf8(s.pending_buf_size);
|
2222
|
+
|
2223
|
+
// It is offset from `s.pending_buf` (size is `s.lit_bufsize * 2`)
|
2224
|
+
//s->d_buf = overlay + s->lit_bufsize/sizeof(ush);
|
2225
|
+
s.d_buf = 1 * s.lit_bufsize;
|
2226
|
+
|
2227
|
+
//s->l_buf = s->pending_buf + (1+sizeof(ush))*s->lit_bufsize;
|
2228
|
+
s.l_buf = (1 + 2) * s.lit_bufsize;
|
2229
|
+
|
2230
|
+
s.level = level;
|
2231
|
+
s.strategy = strategy;
|
2232
|
+
s.method = method;
|
2233
|
+
|
2234
|
+
return deflateReset(strm);
|
2235
|
+
}
|
2236
|
+
|
2237
|
+
function deflateInit(strm, level) {
|
2238
|
+
return deflateInit2(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY);
|
2239
|
+
}
|
2240
|
+
|
2241
|
+
|
2242
|
+
function deflate(strm, flush) {
|
2243
|
+
var old_flush, s;
|
2244
|
+
var beg, val; // for gzip header write only
|
2245
|
+
|
2246
|
+
if (!strm || !strm.state ||
|
2247
|
+
flush > Z_BLOCK || flush < 0) {
|
2248
|
+
return strm ? err(strm, Z_STREAM_ERROR) : Z_STREAM_ERROR;
|
2249
|
+
}
|
2250
|
+
|
2251
|
+
s = strm.state;
|
2252
|
+
|
2253
|
+
if (!strm.output ||
|
2254
|
+
(!strm.input && strm.avail_in !== 0) ||
|
2255
|
+
(s.status === FINISH_STATE && flush !== Z_FINISH)) {
|
2256
|
+
return err(strm, (strm.avail_out === 0) ? Z_BUF_ERROR : Z_STREAM_ERROR);
|
2257
|
+
}
|
2258
|
+
|
2259
|
+
s.strm = strm; /* just in case */
|
2260
|
+
old_flush = s.last_flush;
|
2261
|
+
s.last_flush = flush;
|
2262
|
+
|
2263
|
+
/* Write the header */
|
2264
|
+
if (s.status === INIT_STATE) {
|
2265
|
+
|
2266
|
+
if (s.wrap === 2) { // GZIP header
|
2267
|
+
strm.adler = 0; //crc32(0L, Z_NULL, 0);
|
2268
|
+
put_byte(s, 31);
|
2269
|
+
put_byte(s, 139);
|
2270
|
+
put_byte(s, 8);
|
2271
|
+
if (!s.gzhead) { // s->gzhead == Z_NULL
|
2272
|
+
put_byte(s, 0);
|
2273
|
+
put_byte(s, 0);
|
2274
|
+
put_byte(s, 0);
|
2275
|
+
put_byte(s, 0);
|
2276
|
+
put_byte(s, 0);
|
2277
|
+
put_byte(s, s.level === 9 ? 2 :
|
2278
|
+
(s.strategy >= Z_HUFFMAN_ONLY || s.level < 2 ?
|
2279
|
+
4 : 0));
|
2280
|
+
put_byte(s, OS_CODE);
|
2281
|
+
s.status = BUSY_STATE;
|
2282
|
+
}
|
2283
|
+
else {
|
2284
|
+
put_byte(s, (s.gzhead.text ? 1 : 0) +
|
2285
|
+
(s.gzhead.hcrc ? 2 : 0) +
|
2286
|
+
(!s.gzhead.extra ? 0 : 4) +
|
2287
|
+
(!s.gzhead.name ? 0 : 8) +
|
2288
|
+
(!s.gzhead.comment ? 0 : 16)
|
2289
|
+
);
|
2290
|
+
put_byte(s, s.gzhead.time & 0xff);
|
2291
|
+
put_byte(s, (s.gzhead.time >> 8) & 0xff);
|
2292
|
+
put_byte(s, (s.gzhead.time >> 16) & 0xff);
|
2293
|
+
put_byte(s, (s.gzhead.time >> 24) & 0xff);
|
2294
|
+
put_byte(s, s.level === 9 ? 2 :
|
2295
|
+
(s.strategy >= Z_HUFFMAN_ONLY || s.level < 2 ?
|
2296
|
+
4 : 0));
|
2297
|
+
put_byte(s, s.gzhead.os & 0xff);
|
2298
|
+
if (s.gzhead.extra && s.gzhead.extra.length) {
|
2299
|
+
put_byte(s, s.gzhead.extra.length & 0xff);
|
2300
|
+
put_byte(s, (s.gzhead.extra.length >> 8) & 0xff);
|
2301
|
+
}
|
2302
|
+
if (s.gzhead.hcrc) {
|
2303
|
+
strm.adler = crc32(strm.adler, s.pending_buf, s.pending, 0);
|
2304
|
+
}
|
2305
|
+
s.gzindex = 0;
|
2306
|
+
s.status = EXTRA_STATE;
|
2307
|
+
}
|
2308
|
+
}
|
2309
|
+
else // DEFLATE header
|
2310
|
+
{
|
2311
|
+
var header = (Z_DEFLATED + ((s.w_bits - 8) << 4)) << 8;
|
2312
|
+
var level_flags = -1;
|
2313
|
+
|
2314
|
+
if (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2) {
|
2315
|
+
level_flags = 0;
|
2316
|
+
} else if (s.level < 6) {
|
2317
|
+
level_flags = 1;
|
2318
|
+
} else if (s.level === 6) {
|
2319
|
+
level_flags = 2;
|
2320
|
+
} else {
|
2321
|
+
level_flags = 3;
|
2322
|
+
}
|
2323
|
+
header |= (level_flags << 6);
|
2324
|
+
if (s.strstart !== 0) { header |= PRESET_DICT; }
|
2325
|
+
header += 31 - (header % 31);
|
2326
|
+
|
2327
|
+
s.status = BUSY_STATE;
|
2328
|
+
putShortMSB(s, header);
|
2329
|
+
|
2330
|
+
/* Save the adler32 of the preset dictionary: */
|
2331
|
+
if (s.strstart !== 0) {
|
2332
|
+
putShortMSB(s, strm.adler >>> 16);
|
2333
|
+
putShortMSB(s, strm.adler & 0xffff);
|
2334
|
+
}
|
2335
|
+
strm.adler = 1; // adler32(0L, Z_NULL, 0);
|
2336
|
+
}
|
2337
|
+
}
|
2338
|
+
|
2339
|
+
//#ifdef GZIP
|
2340
|
+
if (s.status === EXTRA_STATE) {
|
2341
|
+
if (s.gzhead.extra/* != Z_NULL*/) {
|
2342
|
+
beg = s.pending; /* start of bytes to update crc */
|
2343
|
+
|
2344
|
+
while (s.gzindex < (s.gzhead.extra.length & 0xffff)) {
|
2345
|
+
if (s.pending === s.pending_buf_size) {
|
2346
|
+
if (s.gzhead.hcrc && s.pending > beg) {
|
2347
|
+
strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);
|
2348
|
+
}
|
2349
|
+
flush_pending(strm);
|
2350
|
+
beg = s.pending;
|
2351
|
+
if (s.pending === s.pending_buf_size) {
|
2352
|
+
break;
|
2353
|
+
}
|
2354
|
+
}
|
2355
|
+
put_byte(s, s.gzhead.extra[s.gzindex] & 0xff);
|
2356
|
+
s.gzindex++;
|
2357
|
+
}
|
2358
|
+
if (s.gzhead.hcrc && s.pending > beg) {
|
2359
|
+
strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);
|
2360
|
+
}
|
2361
|
+
if (s.gzindex === s.gzhead.extra.length) {
|
2362
|
+
s.gzindex = 0;
|
2363
|
+
s.status = NAME_STATE;
|
2364
|
+
}
|
2365
|
+
}
|
2366
|
+
else {
|
2367
|
+
s.status = NAME_STATE;
|
2368
|
+
}
|
2369
|
+
}
|
2370
|
+
if (s.status === NAME_STATE) {
|
2371
|
+
if (s.gzhead.name/* != Z_NULL*/) {
|
2372
|
+
beg = s.pending; /* start of bytes to update crc */
|
2373
|
+
//int val;
|
2374
|
+
|
2375
|
+
do {
|
2376
|
+
if (s.pending === s.pending_buf_size) {
|
2377
|
+
if (s.gzhead.hcrc && s.pending > beg) {
|
2378
|
+
strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);
|
2379
|
+
}
|
2380
|
+
flush_pending(strm);
|
2381
|
+
beg = s.pending;
|
2382
|
+
if (s.pending === s.pending_buf_size) {
|
2383
|
+
val = 1;
|
2384
|
+
break;
|
2385
|
+
}
|
2386
|
+
}
|
2387
|
+
// JS specific: little magic to add zero terminator to end of string
|
2388
|
+
if (s.gzindex < s.gzhead.name.length) {
|
2389
|
+
val = s.gzhead.name.charCodeAt(s.gzindex++) & 0xff;
|
2390
|
+
} else {
|
2391
|
+
val = 0;
|
2392
|
+
}
|
2393
|
+
put_byte(s, val);
|
2394
|
+
} while (val !== 0);
|
2395
|
+
|
2396
|
+
if (s.gzhead.hcrc && s.pending > beg) {
|
2397
|
+
strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);
|
2398
|
+
}
|
2399
|
+
if (val === 0) {
|
2400
|
+
s.gzindex = 0;
|
2401
|
+
s.status = COMMENT_STATE;
|
2402
|
+
}
|
2403
|
+
}
|
2404
|
+
else {
|
2405
|
+
s.status = COMMENT_STATE;
|
2406
|
+
}
|
2407
|
+
}
|
2408
|
+
if (s.status === COMMENT_STATE) {
|
2409
|
+
if (s.gzhead.comment/* != Z_NULL*/) {
|
2410
|
+
beg = s.pending; /* start of bytes to update crc */
|
2411
|
+
//int val;
|
2412
|
+
|
2413
|
+
do {
|
2414
|
+
if (s.pending === s.pending_buf_size) {
|
2415
|
+
if (s.gzhead.hcrc && s.pending > beg) {
|
2416
|
+
strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);
|
2417
|
+
}
|
2418
|
+
flush_pending(strm);
|
2419
|
+
beg = s.pending;
|
2420
|
+
if (s.pending === s.pending_buf_size) {
|
2421
|
+
val = 1;
|
2422
|
+
break;
|
2423
|
+
}
|
2424
|
+
}
|
2425
|
+
// JS specific: little magic to add zero terminator to end of string
|
2426
|
+
if (s.gzindex < s.gzhead.comment.length) {
|
2427
|
+
val = s.gzhead.comment.charCodeAt(s.gzindex++) & 0xff;
|
2428
|
+
} else {
|
2429
|
+
val = 0;
|
2430
|
+
}
|
2431
|
+
put_byte(s, val);
|
2432
|
+
} while (val !== 0);
|
2433
|
+
|
2434
|
+
if (s.gzhead.hcrc && s.pending > beg) {
|
2435
|
+
strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);
|
2436
|
+
}
|
2437
|
+
if (val === 0) {
|
2438
|
+
s.status = HCRC_STATE;
|
2439
|
+
}
|
2440
|
+
}
|
2441
|
+
else {
|
2442
|
+
s.status = HCRC_STATE;
|
2443
|
+
}
|
2444
|
+
}
|
2445
|
+
if (s.status === HCRC_STATE) {
|
2446
|
+
if (s.gzhead.hcrc) {
|
2447
|
+
if (s.pending + 2 > s.pending_buf_size) {
|
2448
|
+
flush_pending(strm);
|
2449
|
+
}
|
2450
|
+
if (s.pending + 2 <= s.pending_buf_size) {
|
2451
|
+
put_byte(s, strm.adler & 0xff);
|
2452
|
+
put_byte(s, (strm.adler >> 8) & 0xff);
|
2453
|
+
strm.adler = 0; //crc32(0L, Z_NULL, 0);
|
2454
|
+
s.status = BUSY_STATE;
|
2455
|
+
}
|
2456
|
+
}
|
2457
|
+
else {
|
2458
|
+
s.status = BUSY_STATE;
|
2459
|
+
}
|
2460
|
+
}
|
2461
|
+
//#endif
|
2462
|
+
|
2463
|
+
/* Flush as much pending output as possible */
|
2464
|
+
if (s.pending !== 0) {
|
2465
|
+
flush_pending(strm);
|
2466
|
+
if (strm.avail_out === 0) {
|
2467
|
+
/* Since avail_out is 0, deflate will be called again with
|
2468
|
+
* more output space, but possibly with both pending and
|
2469
|
+
* avail_in equal to zero. There won't be anything to do,
|
2470
|
+
* but this is not an error situation so make sure we
|
2471
|
+
* return OK instead of BUF_ERROR at next call of deflate:
|
2472
|
+
*/
|
2473
|
+
s.last_flush = -1;
|
2474
|
+
return Z_OK;
|
2475
|
+
}
|
2476
|
+
|
2477
|
+
/* Make sure there is something to do and avoid duplicate consecutive
|
2478
|
+
* flushes. For repeated and useless calls with Z_FINISH, we keep
|
2479
|
+
* returning Z_STREAM_END instead of Z_BUF_ERROR.
|
2480
|
+
*/
|
2481
|
+
} else if (strm.avail_in === 0 && rank(flush) <= rank(old_flush) &&
|
2482
|
+
flush !== Z_FINISH) {
|
2483
|
+
return err(strm, Z_BUF_ERROR);
|
2484
|
+
}
|
2485
|
+
|
2486
|
+
/* User must not provide more input after the first FINISH: */
|
2487
|
+
if (s.status === FINISH_STATE && strm.avail_in !== 0) {
|
2488
|
+
return err(strm, Z_BUF_ERROR);
|
2489
|
+
}
|
2490
|
+
|
2491
|
+
/* Start a new block or continue the current one.
|
2492
|
+
*/
|
2493
|
+
if (strm.avail_in !== 0 || s.lookahead !== 0 ||
|
2494
|
+
(flush !== Z_NO_FLUSH && s.status !== FINISH_STATE)) {
|
2495
|
+
var bstate = (s.strategy === Z_HUFFMAN_ONLY) ? deflate_huff(s, flush) :
|
2496
|
+
(s.strategy === Z_RLE ? deflate_rle(s, flush) :
|
2497
|
+
configuration_table[s.level].func(s, flush));
|
2498
|
+
|
2499
|
+
if (bstate === BS_FINISH_STARTED || bstate === BS_FINISH_DONE) {
|
2500
|
+
s.status = FINISH_STATE;
|
2501
|
+
}
|
2502
|
+
if (bstate === BS_NEED_MORE || bstate === BS_FINISH_STARTED) {
|
2503
|
+
if (strm.avail_out === 0) {
|
2504
|
+
s.last_flush = -1;
|
2505
|
+
/* avoid BUF_ERROR next call, see above */
|
2506
|
+
}
|
2507
|
+
return Z_OK;
|
2508
|
+
/* If flush != Z_NO_FLUSH && avail_out == 0, the next call
|
2509
|
+
* of deflate should use the same flush parameter to make sure
|
2510
|
+
* that the flush is complete. So we don't have to output an
|
2511
|
+
* empty block here, this will be done at next call. This also
|
2512
|
+
* ensures that for a very small output buffer, we emit at most
|
2513
|
+
* one empty block.
|
2514
|
+
*/
|
2515
|
+
}
|
2516
|
+
if (bstate === BS_BLOCK_DONE) {
|
2517
|
+
if (flush === Z_PARTIAL_FLUSH) {
|
2518
|
+
trees._tr_align(s);
|
2519
|
+
}
|
2520
|
+
else if (flush !== Z_BLOCK) { /* FULL_FLUSH or SYNC_FLUSH */
|
2521
|
+
|
2522
|
+
trees._tr_stored_block(s, 0, 0, false);
|
2523
|
+
/* For a full flush, this empty block will be recognized
|
2524
|
+
* as a special marker by inflate_sync().
|
2525
|
+
*/
|
2526
|
+
if (flush === Z_FULL_FLUSH) {
|
2527
|
+
/*** CLEAR_HASH(s); ***/ /* forget history */
|
2528
|
+
zero(s.head); // Fill with NIL (= 0);
|
2529
|
+
|
2530
|
+
if (s.lookahead === 0) {
|
2531
|
+
s.strstart = 0;
|
2532
|
+
s.block_start = 0;
|
2533
|
+
s.insert = 0;
|
2534
|
+
}
|
2535
|
+
}
|
2536
|
+
}
|
2537
|
+
flush_pending(strm);
|
2538
|
+
if (strm.avail_out === 0) {
|
2539
|
+
s.last_flush = -1; /* avoid BUF_ERROR at next call, see above */
|
2540
|
+
return Z_OK;
|
2541
|
+
}
|
2542
|
+
}
|
2543
|
+
}
|
2544
|
+
//Assert(strm->avail_out > 0, "bug2");
|
2545
|
+
//if (strm.avail_out <= 0) { throw new Error("bug2");}
|
2546
|
+
|
2547
|
+
if (flush !== Z_FINISH) { return Z_OK; }
|
2548
|
+
if (s.wrap <= 0) { return Z_STREAM_END; }
|
2549
|
+
|
2550
|
+
/* Write the trailer */
|
2551
|
+
if (s.wrap === 2) {
|
2552
|
+
put_byte(s, strm.adler & 0xff);
|
2553
|
+
put_byte(s, (strm.adler >> 8) & 0xff);
|
2554
|
+
put_byte(s, (strm.adler >> 16) & 0xff);
|
2555
|
+
put_byte(s, (strm.adler >> 24) & 0xff);
|
2556
|
+
put_byte(s, strm.total_in & 0xff);
|
2557
|
+
put_byte(s, (strm.total_in >> 8) & 0xff);
|
2558
|
+
put_byte(s, (strm.total_in >> 16) & 0xff);
|
2559
|
+
put_byte(s, (strm.total_in >> 24) & 0xff);
|
2560
|
+
}
|
2561
|
+
else
|
2562
|
+
{
|
2563
|
+
putShortMSB(s, strm.adler >>> 16);
|
2564
|
+
putShortMSB(s, strm.adler & 0xffff);
|
2565
|
+
}
|
2566
|
+
|
2567
|
+
flush_pending(strm);
|
2568
|
+
/* If avail_out is zero, the application will call deflate again
|
2569
|
+
* to flush the rest.
|
2570
|
+
*/
|
2571
|
+
if (s.wrap > 0) { s.wrap = -s.wrap; }
|
2572
|
+
/* write the trailer only once! */
|
2573
|
+
return s.pending !== 0 ? Z_OK : Z_STREAM_END;
|
2574
|
+
}
|
2575
|
+
|
2576
|
+
function deflateEnd(strm) {
|
2577
|
+
var status;
|
2578
|
+
|
2579
|
+
if (!strm/*== Z_NULL*/ || !strm.state/*== Z_NULL*/) {
|
2580
|
+
return Z_STREAM_ERROR;
|
2581
|
+
}
|
2582
|
+
|
2583
|
+
status = strm.state.status;
|
2584
|
+
if (status !== INIT_STATE &&
|
2585
|
+
status !== EXTRA_STATE &&
|
2586
|
+
status !== NAME_STATE &&
|
2587
|
+
status !== COMMENT_STATE &&
|
2588
|
+
status !== HCRC_STATE &&
|
2589
|
+
status !== BUSY_STATE &&
|
2590
|
+
status !== FINISH_STATE
|
2591
|
+
) {
|
2592
|
+
return err(strm, Z_STREAM_ERROR);
|
2593
|
+
}
|
2594
|
+
|
2595
|
+
strm.state = null;
|
2596
|
+
|
2597
|
+
return status === BUSY_STATE ? err(strm, Z_DATA_ERROR) : Z_OK;
|
2598
|
+
}
|
2599
|
+
|
2600
|
+
|
2601
|
+
/* =========================================================================
|
2602
|
+
* Initializes the compression dictionary from the given byte
|
2603
|
+
* sequence without producing any compressed output.
|
2604
|
+
*/
|
2605
|
+
function deflateSetDictionary(strm, dictionary) {
|
2606
|
+
var dictLength = dictionary.length;
|
2607
|
+
|
2608
|
+
var s;
|
2609
|
+
var str, n;
|
2610
|
+
var wrap;
|
2611
|
+
var avail;
|
2612
|
+
var next;
|
2613
|
+
var input;
|
2614
|
+
var tmpDict;
|
2615
|
+
|
2616
|
+
if (!strm/*== Z_NULL*/ || !strm.state/*== Z_NULL*/) {
|
2617
|
+
return Z_STREAM_ERROR;
|
2618
|
+
}
|
2619
|
+
|
2620
|
+
s = strm.state;
|
2621
|
+
wrap = s.wrap;
|
2622
|
+
|
2623
|
+
if (wrap === 2 || (wrap === 1 && s.status !== INIT_STATE) || s.lookahead) {
|
2624
|
+
return Z_STREAM_ERROR;
|
2625
|
+
}
|
2626
|
+
|
2627
|
+
/* when using zlib wrappers, compute Adler-32 for provided dictionary */
|
2628
|
+
if (wrap === 1) {
|
2629
|
+
/* adler32(strm->adler, dictionary, dictLength); */
|
2630
|
+
strm.adler = adler32(strm.adler, dictionary, dictLength, 0);
|
2631
|
+
}
|
2632
|
+
|
2633
|
+
s.wrap = 0; /* avoid computing Adler-32 in read_buf */
|
2634
|
+
|
2635
|
+
/* if dictionary would fill window, just replace the history */
|
2636
|
+
if (dictLength >= s.w_size) {
|
2637
|
+
if (wrap === 0) { /* already empty otherwise */
|
2638
|
+
/*** CLEAR_HASH(s); ***/
|
2639
|
+
zero(s.head); // Fill with NIL (= 0);
|
2640
|
+
s.strstart = 0;
|
2641
|
+
s.block_start = 0;
|
2642
|
+
s.insert = 0;
|
2643
|
+
}
|
2644
|
+
/* use the tail */
|
2645
|
+
// dictionary = dictionary.slice(dictLength - s.w_size);
|
2646
|
+
tmpDict = new utils.Buf8(s.w_size);
|
2647
|
+
utils.arraySet(tmpDict, dictionary, dictLength - s.w_size, s.w_size, 0);
|
2648
|
+
dictionary = tmpDict;
|
2649
|
+
dictLength = s.w_size;
|
2650
|
+
}
|
2651
|
+
/* insert dictionary into window and hash */
|
2652
|
+
avail = strm.avail_in;
|
2653
|
+
next = strm.next_in;
|
2654
|
+
input = strm.input;
|
2655
|
+
strm.avail_in = dictLength;
|
2656
|
+
strm.next_in = 0;
|
2657
|
+
strm.input = dictionary;
|
2658
|
+
fill_window(s);
|
2659
|
+
while (s.lookahead >= MIN_MATCH) {
|
2660
|
+
str = s.strstart;
|
2661
|
+
n = s.lookahead - (MIN_MATCH - 1);
|
2662
|
+
do {
|
2663
|
+
/* UPDATE_HASH(s, s->ins_h, s->window[str + MIN_MATCH-1]); */
|
2664
|
+
s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[str + MIN_MATCH - 1]) & s.hash_mask;
|
2665
|
+
|
2666
|
+
s.prev[str & s.w_mask] = s.head[s.ins_h];
|
2667
|
+
|
2668
|
+
s.head[s.ins_h] = str;
|
2669
|
+
str++;
|
2670
|
+
} while (--n);
|
2671
|
+
s.strstart = str;
|
2672
|
+
s.lookahead = MIN_MATCH - 1;
|
2673
|
+
fill_window(s);
|
2674
|
+
}
|
2675
|
+
s.strstart += s.lookahead;
|
2676
|
+
s.block_start = s.strstart;
|
2677
|
+
s.insert = s.lookahead;
|
2678
|
+
s.lookahead = 0;
|
2679
|
+
s.match_length = s.prev_length = MIN_MATCH - 1;
|
2680
|
+
s.match_available = 0;
|
2681
|
+
strm.next_in = next;
|
2682
|
+
strm.input = input;
|
2683
|
+
strm.avail_in = avail;
|
2684
|
+
s.wrap = wrap;
|
2685
|
+
return Z_OK;
|
2686
|
+
}
|
2687
|
+
|
2688
|
+
|
2689
|
+
exports.deflateInit = deflateInit;
|
2690
|
+
exports.deflateInit2 = deflateInit2;
|
2691
|
+
exports.deflateReset = deflateReset;
|
2692
|
+
exports.deflateResetKeep = deflateResetKeep;
|
2693
|
+
exports.deflateSetHeader = deflateSetHeader;
|
2694
|
+
exports.deflate = deflate;
|
2695
|
+
exports.deflateEnd = deflateEnd;
|
2696
|
+
exports.deflateSetDictionary = deflateSetDictionary;
|
2697
|
+
exports.deflateInfo = 'pako deflate (from Nodeca project)';
|
2698
|
+
|
2699
|
+
/* Not implemented
|
2700
|
+
exports.deflateBound = deflateBound;
|
2701
|
+
exports.deflateCopy = deflateCopy;
|
2702
|
+
exports.deflateParams = deflateParams;
|
2703
|
+
exports.deflatePending = deflatePending;
|
2704
|
+
exports.deflatePrime = deflatePrime;
|
2705
|
+
exports.deflateTune = deflateTune;
|
2706
|
+
*/
|
2707
|
+
|
2708
|
+
},{"../utils/common":5,"./adler32":7,"./crc32":8,"./messages":10,"./trees":11}],10:[function(require,module,exports){
|
2709
|
+
'use strict';
|
2710
|
+
|
2711
|
+
module.exports = {
|
2712
|
+
2: 'need dictionary', /* Z_NEED_DICT 2 */
|
2713
|
+
1: 'stream end', /* Z_STREAM_END 1 */
|
2714
|
+
0: '', /* Z_OK 0 */
|
2715
|
+
'-1': 'file error', /* Z_ERRNO (-1) */
|
2716
|
+
'-2': 'stream error', /* Z_STREAM_ERROR (-2) */
|
2717
|
+
'-3': 'data error', /* Z_DATA_ERROR (-3) */
|
2718
|
+
'-4': 'insufficient memory', /* Z_MEM_ERROR (-4) */
|
2719
|
+
'-5': 'buffer error', /* Z_BUF_ERROR (-5) */
|
2720
|
+
'-6': 'incompatible version' /* Z_VERSION_ERROR (-6) */
|
2721
|
+
};
|
2722
|
+
|
2723
|
+
},{}],11:[function(require,module,exports){
|
2724
|
+
'use strict';
|
2725
|
+
|
2726
|
+
|
2727
|
+
var utils = require('../utils/common');
|
2728
|
+
|
2729
|
+
/* Public constants ==========================================================*/
|
2730
|
+
/* ===========================================================================*/
|
2731
|
+
|
2732
|
+
|
2733
|
+
//var Z_FILTERED = 1;
|
2734
|
+
//var Z_HUFFMAN_ONLY = 2;
|
2735
|
+
//var Z_RLE = 3;
|
2736
|
+
var Z_FIXED = 4;
|
2737
|
+
//var Z_DEFAULT_STRATEGY = 0;
|
2738
|
+
|
2739
|
+
/* Possible values of the data_type field (though see inflate()) */
|
2740
|
+
var Z_BINARY = 0;
|
2741
|
+
var Z_TEXT = 1;
|
2742
|
+
//var Z_ASCII = 1; // = Z_TEXT
|
2743
|
+
var Z_UNKNOWN = 2;
|
2744
|
+
|
2745
|
+
/*============================================================================*/
|
2746
|
+
|
2747
|
+
|
2748
|
+
function zero(buf) { var len = buf.length; while (--len >= 0) { buf[len] = 0; } }
|
2749
|
+
|
2750
|
+
// From zutil.h
|
2751
|
+
|
2752
|
+
var STORED_BLOCK = 0;
|
2753
|
+
var STATIC_TREES = 1;
|
2754
|
+
var DYN_TREES = 2;
|
2755
|
+
/* The three kinds of block type */
|
2756
|
+
|
2757
|
+
var MIN_MATCH = 3;
|
2758
|
+
var MAX_MATCH = 258;
|
2759
|
+
/* The minimum and maximum match lengths */
|
2760
|
+
|
2761
|
+
// From deflate.h
|
2762
|
+
/* ===========================================================================
|
2763
|
+
* Internal compression state.
|
2764
|
+
*/
|
2765
|
+
|
2766
|
+
var LENGTH_CODES = 29;
|
2767
|
+
/* number of length codes, not counting the special END_BLOCK code */
|
2768
|
+
|
2769
|
+
var LITERALS = 256;
|
2770
|
+
/* number of literal bytes 0..255 */
|
2771
|
+
|
2772
|
+
var L_CODES = LITERALS + 1 + LENGTH_CODES;
|
2773
|
+
/* number of Literal or Length codes, including the END_BLOCK code */
|
2774
|
+
|
2775
|
+
var D_CODES = 30;
|
2776
|
+
/* number of distance codes */
|
2777
|
+
|
2778
|
+
var BL_CODES = 19;
|
2779
|
+
/* number of codes used to transfer the bit lengths */
|
2780
|
+
|
2781
|
+
var HEAP_SIZE = 2 * L_CODES + 1;
|
2782
|
+
/* maximum heap size */
|
2783
|
+
|
2784
|
+
var MAX_BITS = 15;
|
2785
|
+
/* All codes must not exceed MAX_BITS bits */
|
2786
|
+
|
2787
|
+
var Buf_size = 16;
|
2788
|
+
/* size of bit buffer in bi_buf */
|
2789
|
+
|
2790
|
+
|
2791
|
+
/* ===========================================================================
|
2792
|
+
* Constants
|
2793
|
+
*/
|
2794
|
+
|
2795
|
+
var MAX_BL_BITS = 7;
|
2796
|
+
/* Bit length codes must not exceed MAX_BL_BITS bits */
|
2797
|
+
|
2798
|
+
var END_BLOCK = 256;
|
2799
|
+
/* end of block literal code */
|
2800
|
+
|
2801
|
+
var REP_3_6 = 16;
|
2802
|
+
/* repeat previous bit length 3-6 times (2 bits of repeat count) */
|
2803
|
+
|
2804
|
+
var REPZ_3_10 = 17;
|
2805
|
+
/* repeat a zero length 3-10 times (3 bits of repeat count) */
|
2806
|
+
|
2807
|
+
var REPZ_11_138 = 18;
|
2808
|
+
/* repeat a zero length 11-138 times (7 bits of repeat count) */
|
2809
|
+
|
2810
|
+
/* eslint-disable comma-spacing,array-bracket-spacing */
|
2811
|
+
var extra_lbits = /* extra bits for each length code */
|
2812
|
+
[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0];
|
2813
|
+
|
2814
|
+
var extra_dbits = /* extra bits for each distance code */
|
2815
|
+
[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13];
|
2816
|
+
|
2817
|
+
var extra_blbits = /* extra bits for each bit length code */
|
2818
|
+
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7];
|
2819
|
+
|
2820
|
+
var bl_order =
|
2821
|
+
[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];
|
2822
|
+
/* eslint-enable comma-spacing,array-bracket-spacing */
|
2823
|
+
|
2824
|
+
/* The lengths of the bit length codes are sent in order of decreasing
|
2825
|
+
* probability, to avoid transmitting the lengths for unused bit length codes.
|
2826
|
+
*/
|
2827
|
+
|
2828
|
+
/* ===========================================================================
|
2829
|
+
* Local data. These are initialized only once.
|
2830
|
+
*/
|
2831
|
+
|
2832
|
+
// We pre-fill arrays with 0 to avoid uninitialized gaps
|
2833
|
+
|
2834
|
+
var DIST_CODE_LEN = 512; /* see definition of array dist_code below */
|
2835
|
+
|
2836
|
+
// !!!! Use flat array insdead of structure, Freq = i*2, Len = i*2+1
|
2837
|
+
var static_ltree = new Array((L_CODES + 2) * 2);
|
2838
|
+
zero(static_ltree);
|
2839
|
+
/* The static literal tree. Since the bit lengths are imposed, there is no
|
2840
|
+
* need for the L_CODES extra codes used during heap construction. However
|
2841
|
+
* The codes 286 and 287 are needed to build a canonical tree (see _tr_init
|
2842
|
+
* below).
|
2843
|
+
*/
|
2844
|
+
|
2845
|
+
var static_dtree = new Array(D_CODES * 2);
|
2846
|
+
zero(static_dtree);
|
2847
|
+
/* The static distance tree. (Actually a trivial tree since all codes use
|
2848
|
+
* 5 bits.)
|
2849
|
+
*/
|
2850
|
+
|
2851
|
+
var _dist_code = new Array(DIST_CODE_LEN);
|
2852
|
+
zero(_dist_code);
|
2853
|
+
/* Distance codes. The first 256 values correspond to the distances
|
2854
|
+
* 3 .. 258, the last 256 values correspond to the top 8 bits of
|
2855
|
+
* the 15 bit distances.
|
2856
|
+
*/
|
2857
|
+
|
2858
|
+
var _length_code = new Array(MAX_MATCH - MIN_MATCH + 1);
|
2859
|
+
zero(_length_code);
|
2860
|
+
/* length code for each normalized match length (0 == MIN_MATCH) */
|
2861
|
+
|
2862
|
+
var base_length = new Array(LENGTH_CODES);
|
2863
|
+
zero(base_length);
|
2864
|
+
/* First normalized length for each code (0 = MIN_MATCH) */
|
2865
|
+
|
2866
|
+
var base_dist = new Array(D_CODES);
|
2867
|
+
zero(base_dist);
|
2868
|
+
/* First normalized distance for each code (0 = distance of 1) */
|
2869
|
+
|
2870
|
+
|
2871
|
+
function StaticTreeDesc(static_tree, extra_bits, extra_base, elems, max_length) {
|
2872
|
+
|
2873
|
+
this.static_tree = static_tree; /* static tree or NULL */
|
2874
|
+
this.extra_bits = extra_bits; /* extra bits for each code or NULL */
|
2875
|
+
this.extra_base = extra_base; /* base index for extra_bits */
|
2876
|
+
this.elems = elems; /* max number of elements in the tree */
|
2877
|
+
this.max_length = max_length; /* max bit length for the codes */
|
2878
|
+
|
2879
|
+
// show if `static_tree` has data or dummy - needed for monomorphic objects
|
2880
|
+
this.has_stree = static_tree && static_tree.length;
|
2881
|
+
}
|
2882
|
+
|
2883
|
+
|
2884
|
+
var static_l_desc;
|
2885
|
+
var static_d_desc;
|
2886
|
+
var static_bl_desc;
|
2887
|
+
|
2888
|
+
|
2889
|
+
function TreeDesc(dyn_tree, stat_desc) {
|
2890
|
+
this.dyn_tree = dyn_tree; /* the dynamic tree */
|
2891
|
+
this.max_code = 0; /* largest code with non zero frequency */
|
2892
|
+
this.stat_desc = stat_desc; /* the corresponding static tree */
|
2893
|
+
}
|
2894
|
+
|
2895
|
+
|
2896
|
+
|
2897
|
+
function d_code(dist) {
|
2898
|
+
return dist < 256 ? _dist_code[dist] : _dist_code[256 + (dist >>> 7)];
|
2899
|
+
}
|
2900
|
+
|
2901
|
+
|
2902
|
+
/* ===========================================================================
|
2903
|
+
* Output a short LSB first on the stream.
|
2904
|
+
* IN assertion: there is enough room in pendingBuf.
|
2905
|
+
*/
|
2906
|
+
function put_short(s, w) {
|
2907
|
+
// put_byte(s, (uch)((w) & 0xff));
|
2908
|
+
// put_byte(s, (uch)((ush)(w) >> 8));
|
2909
|
+
s.pending_buf[s.pending++] = (w) & 0xff;
|
2910
|
+
s.pending_buf[s.pending++] = (w >>> 8) & 0xff;
|
2911
|
+
}
|
2912
|
+
|
2913
|
+
|
2914
|
+
/* ===========================================================================
|
2915
|
+
* Send a value on a given number of bits.
|
2916
|
+
* IN assertion: length <= 16 and value fits in length bits.
|
2917
|
+
*/
|
2918
|
+
function send_bits(s, value, length) {
|
2919
|
+
if (s.bi_valid > (Buf_size - length)) {
|
2920
|
+
s.bi_buf |= (value << s.bi_valid) & 0xffff;
|
2921
|
+
put_short(s, s.bi_buf);
|
2922
|
+
s.bi_buf = value >> (Buf_size - s.bi_valid);
|
2923
|
+
s.bi_valid += length - Buf_size;
|
2924
|
+
} else {
|
2925
|
+
s.bi_buf |= (value << s.bi_valid) & 0xffff;
|
2926
|
+
s.bi_valid += length;
|
2927
|
+
}
|
2928
|
+
}
|
2929
|
+
|
2930
|
+
|
2931
|
+
function send_code(s, c, tree) {
|
2932
|
+
send_bits(s, tree[c * 2]/*.Code*/, tree[c * 2 + 1]/*.Len*/);
|
2933
|
+
}
|
2934
|
+
|
2935
|
+
|
2936
|
+
/* ===========================================================================
|
2937
|
+
* Reverse the first len bits of a code, using straightforward code (a faster
|
2938
|
+
* method would use a table)
|
2939
|
+
* IN assertion: 1 <= len <= 15
|
2940
|
+
*/
|
2941
|
+
function bi_reverse(code, len) {
|
2942
|
+
var res = 0;
|
2943
|
+
do {
|
2944
|
+
res |= code & 1;
|
2945
|
+
code >>>= 1;
|
2946
|
+
res <<= 1;
|
2947
|
+
} while (--len > 0);
|
2948
|
+
return res >>> 1;
|
2949
|
+
}
|
2950
|
+
|
2951
|
+
|
2952
|
+
/* ===========================================================================
|
2953
|
+
* Flush the bit buffer, keeping at most 7 bits in it.
|
2954
|
+
*/
|
2955
|
+
function bi_flush(s) {
|
2956
|
+
if (s.bi_valid === 16) {
|
2957
|
+
put_short(s, s.bi_buf);
|
2958
|
+
s.bi_buf = 0;
|
2959
|
+
s.bi_valid = 0;
|
2960
|
+
|
2961
|
+
} else if (s.bi_valid >= 8) {
|
2962
|
+
s.pending_buf[s.pending++] = s.bi_buf & 0xff;
|
2963
|
+
s.bi_buf >>= 8;
|
2964
|
+
s.bi_valid -= 8;
|
2965
|
+
}
|
2966
|
+
}
|
2967
|
+
|
2968
|
+
|
2969
|
+
/* ===========================================================================
|
2970
|
+
* Compute the optimal bit lengths for a tree and update the total bit length
|
2971
|
+
* for the current block.
|
2972
|
+
* IN assertion: the fields freq and dad are set, heap[heap_max] and
|
2973
|
+
* above are the tree nodes sorted by increasing frequency.
|
2974
|
+
* OUT assertions: the field len is set to the optimal bit length, the
|
2975
|
+
* array bl_count contains the frequencies for each bit length.
|
2976
|
+
* The length opt_len is updated; static_len is also updated if stree is
|
2977
|
+
* not null.
|
2978
|
+
*/
|
2979
|
+
function gen_bitlen(s, desc)
|
2980
|
+
// deflate_state *s;
|
2981
|
+
// tree_desc *desc; /* the tree descriptor */
|
2982
|
+
{
|
2983
|
+
var tree = desc.dyn_tree;
|
2984
|
+
var max_code = desc.max_code;
|
2985
|
+
var stree = desc.stat_desc.static_tree;
|
2986
|
+
var has_stree = desc.stat_desc.has_stree;
|
2987
|
+
var extra = desc.stat_desc.extra_bits;
|
2988
|
+
var base = desc.stat_desc.extra_base;
|
2989
|
+
var max_length = desc.stat_desc.max_length;
|
2990
|
+
var h; /* heap index */
|
2991
|
+
var n, m; /* iterate over the tree elements */
|
2992
|
+
var bits; /* bit length */
|
2993
|
+
var xbits; /* extra bits */
|
2994
|
+
var f; /* frequency */
|
2995
|
+
var overflow = 0; /* number of elements with bit length too large */
|
2996
|
+
|
2997
|
+
for (bits = 0; bits <= MAX_BITS; bits++) {
|
2998
|
+
s.bl_count[bits] = 0;
|
2999
|
+
}
|
3000
|
+
|
3001
|
+
/* In a first pass, compute the optimal bit lengths (which may
|
3002
|
+
* overflow in the case of the bit length tree).
|
3003
|
+
*/
|
3004
|
+
tree[s.heap[s.heap_max] * 2 + 1]/*.Len*/ = 0; /* root of the heap */
|
3005
|
+
|
3006
|
+
for (h = s.heap_max + 1; h < HEAP_SIZE; h++) {
|
3007
|
+
n = s.heap[h];
|
3008
|
+
bits = tree[tree[n * 2 + 1]/*.Dad*/ * 2 + 1]/*.Len*/ + 1;
|
3009
|
+
if (bits > max_length) {
|
3010
|
+
bits = max_length;
|
3011
|
+
overflow++;
|
3012
|
+
}
|
3013
|
+
tree[n * 2 + 1]/*.Len*/ = bits;
|
3014
|
+
/* We overwrite tree[n].Dad which is no longer needed */
|
3015
|
+
|
3016
|
+
if (n > max_code) { continue; } /* not a leaf node */
|
3017
|
+
|
3018
|
+
s.bl_count[bits]++;
|
3019
|
+
xbits = 0;
|
3020
|
+
if (n >= base) {
|
3021
|
+
xbits = extra[n - base];
|
3022
|
+
}
|
3023
|
+
f = tree[n * 2]/*.Freq*/;
|
3024
|
+
s.opt_len += f * (bits + xbits);
|
3025
|
+
if (has_stree) {
|
3026
|
+
s.static_len += f * (stree[n * 2 + 1]/*.Len*/ + xbits);
|
3027
|
+
}
|
3028
|
+
}
|
3029
|
+
if (overflow === 0) { return; }
|
3030
|
+
|
3031
|
+
// Trace((stderr,"\nbit length overflow\n"));
|
3032
|
+
/* This happens for example on obj2 and pic of the Calgary corpus */
|
3033
|
+
|
3034
|
+
/* Find the first bit length which could increase: */
|
3035
|
+
do {
|
3036
|
+
bits = max_length - 1;
|
3037
|
+
while (s.bl_count[bits] === 0) { bits--; }
|
3038
|
+
s.bl_count[bits]--; /* move one leaf down the tree */
|
3039
|
+
s.bl_count[bits + 1] += 2; /* move one overflow item as its brother */
|
3040
|
+
s.bl_count[max_length]--;
|
3041
|
+
/* The brother of the overflow item also moves one step up,
|
3042
|
+
* but this does not affect bl_count[max_length]
|
3043
|
+
*/
|
3044
|
+
overflow -= 2;
|
3045
|
+
} while (overflow > 0);
|
3046
|
+
|
3047
|
+
/* Now recompute all bit lengths, scanning in increasing frequency.
|
3048
|
+
* h is still equal to HEAP_SIZE. (It is simpler to reconstruct all
|
3049
|
+
* lengths instead of fixing only the wrong ones. This idea is taken
|
3050
|
+
* from 'ar' written by Haruhiko Okumura.)
|
3051
|
+
*/
|
3052
|
+
for (bits = max_length; bits !== 0; bits--) {
|
3053
|
+
n = s.bl_count[bits];
|
3054
|
+
while (n !== 0) {
|
3055
|
+
m = s.heap[--h];
|
3056
|
+
if (m > max_code) { continue; }
|
3057
|
+
if (tree[m * 2 + 1]/*.Len*/ !== bits) {
|
3058
|
+
// Trace((stderr,"code %d bits %d->%d\n", m, tree[m].Len, bits));
|
3059
|
+
s.opt_len += (bits - tree[m * 2 + 1]/*.Len*/) * tree[m * 2]/*.Freq*/;
|
3060
|
+
tree[m * 2 + 1]/*.Len*/ = bits;
|
3061
|
+
}
|
3062
|
+
n--;
|
3063
|
+
}
|
3064
|
+
}
|
3065
|
+
}
|
3066
|
+
|
3067
|
+
|
3068
|
+
/* ===========================================================================
|
3069
|
+
* Generate the codes for a given tree and bit counts (which need not be
|
3070
|
+
* optimal).
|
3071
|
+
* IN assertion: the array bl_count contains the bit length statistics for
|
3072
|
+
* the given tree and the field len is set for all tree elements.
|
3073
|
+
* OUT assertion: the field code is set for all tree elements of non
|
3074
|
+
* zero code length.
|
3075
|
+
*/
|
3076
|
+
function gen_codes(tree, max_code, bl_count)
|
3077
|
+
// ct_data *tree; /* the tree to decorate */
|
3078
|
+
// int max_code; /* largest code with non zero frequency */
|
3079
|
+
// ushf *bl_count; /* number of codes at each bit length */
|
3080
|
+
{
|
3081
|
+
var next_code = new Array(MAX_BITS + 1); /* next code value for each bit length */
|
3082
|
+
var code = 0; /* running code value */
|
3083
|
+
var bits; /* bit index */
|
3084
|
+
var n; /* code index */
|
3085
|
+
|
3086
|
+
/* The distribution counts are first used to generate the code values
|
3087
|
+
* without bit reversal.
|
3088
|
+
*/
|
3089
|
+
for (bits = 1; bits <= MAX_BITS; bits++) {
|
3090
|
+
next_code[bits] = code = (code + bl_count[bits - 1]) << 1;
|
3091
|
+
}
|
3092
|
+
/* Check that the bit counts in bl_count are consistent. The last code
|
3093
|
+
* must be all ones.
|
3094
|
+
*/
|
3095
|
+
//Assert (code + bl_count[MAX_BITS]-1 == (1<<MAX_BITS)-1,
|
3096
|
+
// "inconsistent bit counts");
|
3097
|
+
//Tracev((stderr,"\ngen_codes: max_code %d ", max_code));
|
3098
|
+
|
3099
|
+
for (n = 0; n <= max_code; n++) {
|
3100
|
+
var len = tree[n * 2 + 1]/*.Len*/;
|
3101
|
+
if (len === 0) { continue; }
|
3102
|
+
/* Now reverse the bits */
|
3103
|
+
tree[n * 2]/*.Code*/ = bi_reverse(next_code[len]++, len);
|
3104
|
+
|
3105
|
+
//Tracecv(tree != static_ltree, (stderr,"\nn %3d %c l %2d c %4x (%x) ",
|
3106
|
+
// n, (isgraph(n) ? n : ' '), len, tree[n].Code, next_code[len]-1));
|
3107
|
+
}
|
3108
|
+
}
|
3109
|
+
|
3110
|
+
|
3111
|
+
/* ===========================================================================
|
3112
|
+
* Initialize the various 'constant' tables.
|
3113
|
+
*/
|
3114
|
+
function tr_static_init() {
|
3115
|
+
var n; /* iterates over tree elements */
|
3116
|
+
var bits; /* bit counter */
|
3117
|
+
var length; /* length value */
|
3118
|
+
var code; /* code value */
|
3119
|
+
var dist; /* distance index */
|
3120
|
+
var bl_count = new Array(MAX_BITS + 1);
|
3121
|
+
/* number of codes at each bit length for an optimal tree */
|
3122
|
+
|
3123
|
+
// do check in _tr_init()
|
3124
|
+
//if (static_init_done) return;
|
3125
|
+
|
3126
|
+
/* For some embedded targets, global variables are not initialized: */
|
3127
|
+
/*#ifdef NO_INIT_GLOBAL_POINTERS
|
3128
|
+
static_l_desc.static_tree = static_ltree;
|
3129
|
+
static_l_desc.extra_bits = extra_lbits;
|
3130
|
+
static_d_desc.static_tree = static_dtree;
|
3131
|
+
static_d_desc.extra_bits = extra_dbits;
|
3132
|
+
static_bl_desc.extra_bits = extra_blbits;
|
3133
|
+
#endif*/
|
3134
|
+
|
3135
|
+
/* Initialize the mapping length (0..255) -> length code (0..28) */
|
3136
|
+
length = 0;
|
3137
|
+
for (code = 0; code < LENGTH_CODES - 1; code++) {
|
3138
|
+
base_length[code] = length;
|
3139
|
+
for (n = 0; n < (1 << extra_lbits[code]); n++) {
|
3140
|
+
_length_code[length++] = code;
|
3141
|
+
}
|
3142
|
+
}
|
3143
|
+
//Assert (length == 256, "tr_static_init: length != 256");
|
3144
|
+
/* Note that the length 255 (match length 258) can be represented
|
3145
|
+
* in two different ways: code 284 + 5 bits or code 285, so we
|
3146
|
+
* overwrite length_code[255] to use the best encoding:
|
3147
|
+
*/
|
3148
|
+
_length_code[length - 1] = code;
|
3149
|
+
|
3150
|
+
/* Initialize the mapping dist (0..32K) -> dist code (0..29) */
|
3151
|
+
dist = 0;
|
3152
|
+
for (code = 0; code < 16; code++) {
|
3153
|
+
base_dist[code] = dist;
|
3154
|
+
for (n = 0; n < (1 << extra_dbits[code]); n++) {
|
3155
|
+
_dist_code[dist++] = code;
|
3156
|
+
}
|
3157
|
+
}
|
3158
|
+
//Assert (dist == 256, "tr_static_init: dist != 256");
|
3159
|
+
dist >>= 7; /* from now on, all distances are divided by 128 */
|
3160
|
+
for (; code < D_CODES; code++) {
|
3161
|
+
base_dist[code] = dist << 7;
|
3162
|
+
for (n = 0; n < (1 << (extra_dbits[code] - 7)); n++) {
|
3163
|
+
_dist_code[256 + dist++] = code;
|
3164
|
+
}
|
3165
|
+
}
|
3166
|
+
//Assert (dist == 256, "tr_static_init: 256+dist != 512");
|
3167
|
+
|
3168
|
+
/* Construct the codes of the static literal tree */
|
3169
|
+
for (bits = 0; bits <= MAX_BITS; bits++) {
|
3170
|
+
bl_count[bits] = 0;
|
3171
|
+
}
|
3172
|
+
|
3173
|
+
n = 0;
|
3174
|
+
while (n <= 143) {
|
3175
|
+
static_ltree[n * 2 + 1]/*.Len*/ = 8;
|
3176
|
+
n++;
|
3177
|
+
bl_count[8]++;
|
3178
|
+
}
|
3179
|
+
while (n <= 255) {
|
3180
|
+
static_ltree[n * 2 + 1]/*.Len*/ = 9;
|
3181
|
+
n++;
|
3182
|
+
bl_count[9]++;
|
3183
|
+
}
|
3184
|
+
while (n <= 279) {
|
3185
|
+
static_ltree[n * 2 + 1]/*.Len*/ = 7;
|
3186
|
+
n++;
|
3187
|
+
bl_count[7]++;
|
3188
|
+
}
|
3189
|
+
while (n <= 287) {
|
3190
|
+
static_ltree[n * 2 + 1]/*.Len*/ = 8;
|
3191
|
+
n++;
|
3192
|
+
bl_count[8]++;
|
3193
|
+
}
|
3194
|
+
/* Codes 286 and 287 do not exist, but we must include them in the
|
3195
|
+
* tree construction to get a canonical Huffman tree (longest code
|
3196
|
+
* all ones)
|
3197
|
+
*/
|
3198
|
+
gen_codes(static_ltree, L_CODES + 1, bl_count);
|
3199
|
+
|
3200
|
+
/* The static distance tree is trivial: */
|
3201
|
+
for (n = 0; n < D_CODES; n++) {
|
3202
|
+
static_dtree[n * 2 + 1]/*.Len*/ = 5;
|
3203
|
+
static_dtree[n * 2]/*.Code*/ = bi_reverse(n, 5);
|
3204
|
+
}
|
3205
|
+
|
3206
|
+
// Now data ready and we can init static trees
|
3207
|
+
static_l_desc = new StaticTreeDesc(static_ltree, extra_lbits, LITERALS + 1, L_CODES, MAX_BITS);
|
3208
|
+
static_d_desc = new StaticTreeDesc(static_dtree, extra_dbits, 0, D_CODES, MAX_BITS);
|
3209
|
+
static_bl_desc = new StaticTreeDesc(new Array(0), extra_blbits, 0, BL_CODES, MAX_BL_BITS);
|
3210
|
+
|
3211
|
+
//static_init_done = true;
|
3212
|
+
}
|
3213
|
+
|
3214
|
+
|
3215
|
+
/* ===========================================================================
|
3216
|
+
* Initialize a new block.
|
3217
|
+
*/
|
3218
|
+
function init_block(s) {
|
3219
|
+
var n; /* iterates over tree elements */
|
3220
|
+
|
3221
|
+
/* Initialize the trees. */
|
3222
|
+
for (n = 0; n < L_CODES; n++) { s.dyn_ltree[n * 2]/*.Freq*/ = 0; }
|
3223
|
+
for (n = 0; n < D_CODES; n++) { s.dyn_dtree[n * 2]/*.Freq*/ = 0; }
|
3224
|
+
for (n = 0; n < BL_CODES; n++) { s.bl_tree[n * 2]/*.Freq*/ = 0; }
|
3225
|
+
|
3226
|
+
s.dyn_ltree[END_BLOCK * 2]/*.Freq*/ = 1;
|
3227
|
+
s.opt_len = s.static_len = 0;
|
3228
|
+
s.last_lit = s.matches = 0;
|
3229
|
+
}
|
3230
|
+
|
3231
|
+
|
3232
|
+
/* ===========================================================================
|
3233
|
+
* Flush the bit buffer and align the output on a byte boundary
|
3234
|
+
*/
|
3235
|
+
function bi_windup(s)
|
3236
|
+
{
|
3237
|
+
if (s.bi_valid > 8) {
|
3238
|
+
put_short(s, s.bi_buf);
|
3239
|
+
} else if (s.bi_valid > 0) {
|
3240
|
+
//put_byte(s, (Byte)s->bi_buf);
|
3241
|
+
s.pending_buf[s.pending++] = s.bi_buf;
|
3242
|
+
}
|
3243
|
+
s.bi_buf = 0;
|
3244
|
+
s.bi_valid = 0;
|
3245
|
+
}
|
3246
|
+
|
3247
|
+
/* ===========================================================================
|
3248
|
+
* Copy a stored block, storing first the length and its
|
3249
|
+
* one's complement if requested.
|
3250
|
+
*/
|
3251
|
+
function copy_block(s, buf, len, header)
|
3252
|
+
//DeflateState *s;
|
3253
|
+
//charf *buf; /* the input data */
|
3254
|
+
//unsigned len; /* its length */
|
3255
|
+
//int header; /* true if block header must be written */
|
3256
|
+
{
|
3257
|
+
bi_windup(s); /* align on byte boundary */
|
3258
|
+
|
3259
|
+
if (header) {
|
3260
|
+
put_short(s, len);
|
3261
|
+
put_short(s, ~len);
|
3262
|
+
}
|
3263
|
+
// while (len--) {
|
3264
|
+
// put_byte(s, *buf++);
|
3265
|
+
// }
|
3266
|
+
utils.arraySet(s.pending_buf, s.window, buf, len, s.pending);
|
3267
|
+
s.pending += len;
|
3268
|
+
}
|
3269
|
+
|
3270
|
+
/* ===========================================================================
|
3271
|
+
* Compares to subtrees, using the tree depth as tie breaker when
|
3272
|
+
* the subtrees have equal frequency. This minimizes the worst case length.
|
3273
|
+
*/
|
3274
|
+
function smaller(tree, n, m, depth) {
|
3275
|
+
var _n2 = n * 2;
|
3276
|
+
var _m2 = m * 2;
|
3277
|
+
return (tree[_n2]/*.Freq*/ < tree[_m2]/*.Freq*/ ||
|
3278
|
+
(tree[_n2]/*.Freq*/ === tree[_m2]/*.Freq*/ && depth[n] <= depth[m]));
|
3279
|
+
}
|
3280
|
+
|
3281
|
+
/* ===========================================================================
|
3282
|
+
* Restore the heap property by moving down the tree starting at node k,
|
3283
|
+
* exchanging a node with the smallest of its two sons if necessary, stopping
|
3284
|
+
* when the heap property is re-established (each father smaller than its
|
3285
|
+
* two sons).
|
3286
|
+
*/
|
3287
|
+
function pqdownheap(s, tree, k)
|
3288
|
+
// deflate_state *s;
|
3289
|
+
// ct_data *tree; /* the tree to restore */
|
3290
|
+
// int k; /* node to move down */
|
3291
|
+
{
|
3292
|
+
var v = s.heap[k];
|
3293
|
+
var j = k << 1; /* left son of k */
|
3294
|
+
while (j <= s.heap_len) {
|
3295
|
+
/* Set j to the smallest of the two sons: */
|
3296
|
+
if (j < s.heap_len &&
|
3297
|
+
smaller(tree, s.heap[j + 1], s.heap[j], s.depth)) {
|
3298
|
+
j++;
|
3299
|
+
}
|
3300
|
+
/* Exit if v is smaller than both sons */
|
3301
|
+
if (smaller(tree, v, s.heap[j], s.depth)) { break; }
|
3302
|
+
|
3303
|
+
/* Exchange v with the smallest son */
|
3304
|
+
s.heap[k] = s.heap[j];
|
3305
|
+
k = j;
|
3306
|
+
|
3307
|
+
/* And continue down the tree, setting j to the left son of k */
|
3308
|
+
j <<= 1;
|
3309
|
+
}
|
3310
|
+
s.heap[k] = v;
|
3311
|
+
}
|
3312
|
+
|
3313
|
+
|
3314
|
+
// inlined manually
|
3315
|
+
// var SMALLEST = 1;
|
3316
|
+
|
3317
|
+
/* ===========================================================================
|
3318
|
+
* Send the block data compressed using the given Huffman trees
|
3319
|
+
*/
|
3320
|
+
function compress_block(s, ltree, dtree)
|
3321
|
+
// deflate_state *s;
|
3322
|
+
// const ct_data *ltree; /* literal tree */
|
3323
|
+
// const ct_data *dtree; /* distance tree */
|
3324
|
+
{
|
3325
|
+
var dist; /* distance of matched string */
|
3326
|
+
var lc; /* match length or unmatched char (if dist == 0) */
|
3327
|
+
var lx = 0; /* running index in l_buf */
|
3328
|
+
var code; /* the code to send */
|
3329
|
+
var extra; /* number of extra bits to send */
|
3330
|
+
|
3331
|
+
if (s.last_lit !== 0) {
|
3332
|
+
do {
|
3333
|
+
dist = (s.pending_buf[s.d_buf + lx * 2] << 8) | (s.pending_buf[s.d_buf + lx * 2 + 1]);
|
3334
|
+
lc = s.pending_buf[s.l_buf + lx];
|
3335
|
+
lx++;
|
3336
|
+
|
3337
|
+
if (dist === 0) {
|
3338
|
+
send_code(s, lc, ltree); /* send a literal byte */
|
3339
|
+
//Tracecv(isgraph(lc), (stderr," '%c' ", lc));
|
3340
|
+
} else {
|
3341
|
+
/* Here, lc is the match length - MIN_MATCH */
|
3342
|
+
code = _length_code[lc];
|
3343
|
+
send_code(s, code + LITERALS + 1, ltree); /* send the length code */
|
3344
|
+
extra = extra_lbits[code];
|
3345
|
+
if (extra !== 0) {
|
3346
|
+
lc -= base_length[code];
|
3347
|
+
send_bits(s, lc, extra); /* send the extra length bits */
|
3348
|
+
}
|
3349
|
+
dist--; /* dist is now the match distance - 1 */
|
3350
|
+
code = d_code(dist);
|
3351
|
+
//Assert (code < D_CODES, "bad d_code");
|
3352
|
+
|
3353
|
+
send_code(s, code, dtree); /* send the distance code */
|
3354
|
+
extra = extra_dbits[code];
|
3355
|
+
if (extra !== 0) {
|
3356
|
+
dist -= base_dist[code];
|
3357
|
+
send_bits(s, dist, extra); /* send the extra distance bits */
|
3358
|
+
}
|
3359
|
+
} /* literal or match pair ? */
|
3360
|
+
|
3361
|
+
/* Check that the overlay between pending_buf and d_buf+l_buf is ok: */
|
3362
|
+
//Assert((uInt)(s->pending) < s->lit_bufsize + 2*lx,
|
3363
|
+
// "pendingBuf overflow");
|
3364
|
+
|
3365
|
+
} while (lx < s.last_lit);
|
3366
|
+
}
|
3367
|
+
|
3368
|
+
send_code(s, END_BLOCK, ltree);
|
3369
|
+
}
|
3370
|
+
|
3371
|
+
|
3372
|
+
/* ===========================================================================
|
3373
|
+
* Construct one Huffman tree and assigns the code bit strings and lengths.
|
3374
|
+
* Update the total bit length for the current block.
|
3375
|
+
* IN assertion: the field freq is set for all tree elements.
|
3376
|
+
* OUT assertions: the fields len and code are set to the optimal bit length
|
3377
|
+
* and corresponding code. The length opt_len is updated; static_len is
|
3378
|
+
* also updated if stree is not null. The field max_code is set.
|
3379
|
+
*/
|
3380
|
+
function build_tree(s, desc)
|
3381
|
+
// deflate_state *s;
|
3382
|
+
// tree_desc *desc; /* the tree descriptor */
|
3383
|
+
{
|
3384
|
+
var tree = desc.dyn_tree;
|
3385
|
+
var stree = desc.stat_desc.static_tree;
|
3386
|
+
var has_stree = desc.stat_desc.has_stree;
|
3387
|
+
var elems = desc.stat_desc.elems;
|
3388
|
+
var n, m; /* iterate over heap elements */
|
3389
|
+
var max_code = -1; /* largest code with non zero frequency */
|
3390
|
+
var node; /* new node being created */
|
3391
|
+
|
3392
|
+
/* Construct the initial heap, with least frequent element in
|
3393
|
+
* heap[SMALLEST]. The sons of heap[n] are heap[2*n] and heap[2*n+1].
|
3394
|
+
* heap[0] is not used.
|
3395
|
+
*/
|
3396
|
+
s.heap_len = 0;
|
3397
|
+
s.heap_max = HEAP_SIZE;
|
3398
|
+
|
3399
|
+
for (n = 0; n < elems; n++) {
|
3400
|
+
if (tree[n * 2]/*.Freq*/ !== 0) {
|
3401
|
+
s.heap[++s.heap_len] = max_code = n;
|
3402
|
+
s.depth[n] = 0;
|
3403
|
+
|
3404
|
+
} else {
|
3405
|
+
tree[n * 2 + 1]/*.Len*/ = 0;
|
3406
|
+
}
|
3407
|
+
}
|
3408
|
+
|
3409
|
+
/* The pkzip format requires that at least one distance code exists,
|
3410
|
+
* and that at least one bit should be sent even if there is only one
|
3411
|
+
* possible code. So to avoid special checks later on we force at least
|
3412
|
+
* two codes of non zero frequency.
|
3413
|
+
*/
|
3414
|
+
while (s.heap_len < 2) {
|
3415
|
+
node = s.heap[++s.heap_len] = (max_code < 2 ? ++max_code : 0);
|
3416
|
+
tree[node * 2]/*.Freq*/ = 1;
|
3417
|
+
s.depth[node] = 0;
|
3418
|
+
s.opt_len--;
|
3419
|
+
|
3420
|
+
if (has_stree) {
|
3421
|
+
s.static_len -= stree[node * 2 + 1]/*.Len*/;
|
3422
|
+
}
|
3423
|
+
/* node is 0 or 1 so it does not have extra bits */
|
3424
|
+
}
|
3425
|
+
desc.max_code = max_code;
|
3426
|
+
|
3427
|
+
/* The elements heap[heap_len/2+1 .. heap_len] are leaves of the tree,
|
3428
|
+
* establish sub-heaps of increasing lengths:
|
3429
|
+
*/
|
3430
|
+
for (n = (s.heap_len >> 1/*int /2*/); n >= 1; n--) { pqdownheap(s, tree, n); }
|
3431
|
+
|
3432
|
+
/* Construct the Huffman tree by repeatedly combining the least two
|
3433
|
+
* frequent nodes.
|
3434
|
+
*/
|
3435
|
+
node = elems; /* next internal node of the tree */
|
3436
|
+
do {
|
3437
|
+
//pqremove(s, tree, n); /* n = node of least frequency */
|
3438
|
+
/*** pqremove ***/
|
3439
|
+
n = s.heap[1/*SMALLEST*/];
|
3440
|
+
s.heap[1/*SMALLEST*/] = s.heap[s.heap_len--];
|
3441
|
+
pqdownheap(s, tree, 1/*SMALLEST*/);
|
3442
|
+
/***/
|
3443
|
+
|
3444
|
+
m = s.heap[1/*SMALLEST*/]; /* m = node of next least frequency */
|
3445
|
+
|
3446
|
+
s.heap[--s.heap_max] = n; /* keep the nodes sorted by frequency */
|
3447
|
+
s.heap[--s.heap_max] = m;
|
3448
|
+
|
3449
|
+
/* Create a new node father of n and m */
|
3450
|
+
tree[node * 2]/*.Freq*/ = tree[n * 2]/*.Freq*/ + tree[m * 2]/*.Freq*/;
|
3451
|
+
s.depth[node] = (s.depth[n] >= s.depth[m] ? s.depth[n] : s.depth[m]) + 1;
|
3452
|
+
tree[n * 2 + 1]/*.Dad*/ = tree[m * 2 + 1]/*.Dad*/ = node;
|
3453
|
+
|
3454
|
+
/* and insert the new node in the heap */
|
3455
|
+
s.heap[1/*SMALLEST*/] = node++;
|
3456
|
+
pqdownheap(s, tree, 1/*SMALLEST*/);
|
3457
|
+
|
3458
|
+
} while (s.heap_len >= 2);
|
3459
|
+
|
3460
|
+
s.heap[--s.heap_max] = s.heap[1/*SMALLEST*/];
|
3461
|
+
|
3462
|
+
/* At this point, the fields freq and dad are set. We can now
|
3463
|
+
* generate the bit lengths.
|
3464
|
+
*/
|
3465
|
+
gen_bitlen(s, desc);
|
3466
|
+
|
3467
|
+
/* The field len is now set, we can generate the bit codes */
|
3468
|
+
gen_codes(tree, max_code, s.bl_count);
|
3469
|
+
}
|
3470
|
+
|
3471
|
+
|
3472
|
+
/* ===========================================================================
|
3473
|
+
* Scan a literal or distance tree to determine the frequencies of the codes
|
3474
|
+
* in the bit length tree.
|
3475
|
+
*/
|
3476
|
+
function scan_tree(s, tree, max_code)
|
3477
|
+
// deflate_state *s;
|
3478
|
+
// ct_data *tree; /* the tree to be scanned */
|
3479
|
+
// int max_code; /* and its largest code of non zero frequency */
|
3480
|
+
{
|
3481
|
+
var n; /* iterates over all tree elements */
|
3482
|
+
var prevlen = -1; /* last emitted length */
|
3483
|
+
var curlen; /* length of current code */
|
3484
|
+
|
3485
|
+
var nextlen = tree[0 * 2 + 1]/*.Len*/; /* length of next code */
|
3486
|
+
|
3487
|
+
var count = 0; /* repeat count of the current code */
|
3488
|
+
var max_count = 7; /* max repeat count */
|
3489
|
+
var min_count = 4; /* min repeat count */
|
3490
|
+
|
3491
|
+
if (nextlen === 0) {
|
3492
|
+
max_count = 138;
|
3493
|
+
min_count = 3;
|
3494
|
+
}
|
3495
|
+
tree[(max_code + 1) * 2 + 1]/*.Len*/ = 0xffff; /* guard */
|
3496
|
+
|
3497
|
+
for (n = 0; n <= max_code; n++) {
|
3498
|
+
curlen = nextlen;
|
3499
|
+
nextlen = tree[(n + 1) * 2 + 1]/*.Len*/;
|
3500
|
+
|
3501
|
+
if (++count < max_count && curlen === nextlen) {
|
3502
|
+
continue;
|
3503
|
+
|
3504
|
+
} else if (count < min_count) {
|
3505
|
+
s.bl_tree[curlen * 2]/*.Freq*/ += count;
|
3506
|
+
|
3507
|
+
} else if (curlen !== 0) {
|
3508
|
+
|
3509
|
+
if (curlen !== prevlen) { s.bl_tree[curlen * 2]/*.Freq*/++; }
|
3510
|
+
s.bl_tree[REP_3_6 * 2]/*.Freq*/++;
|
3511
|
+
|
3512
|
+
} else if (count <= 10) {
|
3513
|
+
s.bl_tree[REPZ_3_10 * 2]/*.Freq*/++;
|
3514
|
+
|
3515
|
+
} else {
|
3516
|
+
s.bl_tree[REPZ_11_138 * 2]/*.Freq*/++;
|
3517
|
+
}
|
3518
|
+
|
3519
|
+
count = 0;
|
3520
|
+
prevlen = curlen;
|
3521
|
+
|
3522
|
+
if (nextlen === 0) {
|
3523
|
+
max_count = 138;
|
3524
|
+
min_count = 3;
|
3525
|
+
|
3526
|
+
} else if (curlen === nextlen) {
|
3527
|
+
max_count = 6;
|
3528
|
+
min_count = 3;
|
3529
|
+
|
3530
|
+
} else {
|
3531
|
+
max_count = 7;
|
3532
|
+
min_count = 4;
|
3533
|
+
}
|
3534
|
+
}
|
3535
|
+
}
|
3536
|
+
|
3537
|
+
|
3538
|
+
/* ===========================================================================
|
3539
|
+
* Send a literal or distance tree in compressed form, using the codes in
|
3540
|
+
* bl_tree.
|
3541
|
+
*/
|
3542
|
+
function send_tree(s, tree, max_code)
|
3543
|
+
// deflate_state *s;
|
3544
|
+
// ct_data *tree; /* the tree to be scanned */
|
3545
|
+
// int max_code; /* and its largest code of non zero frequency */
|
3546
|
+
{
|
3547
|
+
var n; /* iterates over all tree elements */
|
3548
|
+
var prevlen = -1; /* last emitted length */
|
3549
|
+
var curlen; /* length of current code */
|
3550
|
+
|
3551
|
+
var nextlen = tree[0 * 2 + 1]/*.Len*/; /* length of next code */
|
3552
|
+
|
3553
|
+
var count = 0; /* repeat count of the current code */
|
3554
|
+
var max_count = 7; /* max repeat count */
|
3555
|
+
var min_count = 4; /* min repeat count */
|
3556
|
+
|
3557
|
+
/* tree[max_code+1].Len = -1; */ /* guard already set */
|
3558
|
+
if (nextlen === 0) {
|
3559
|
+
max_count = 138;
|
3560
|
+
min_count = 3;
|
3561
|
+
}
|
3562
|
+
|
3563
|
+
for (n = 0; n <= max_code; n++) {
|
3564
|
+
curlen = nextlen;
|
3565
|
+
nextlen = tree[(n + 1) * 2 + 1]/*.Len*/;
|
3566
|
+
|
3567
|
+
if (++count < max_count && curlen === nextlen) {
|
3568
|
+
continue;
|
3569
|
+
|
3570
|
+
} else if (count < min_count) {
|
3571
|
+
do { send_code(s, curlen, s.bl_tree); } while (--count !== 0);
|
3572
|
+
|
3573
|
+
} else if (curlen !== 0) {
|
3574
|
+
if (curlen !== prevlen) {
|
3575
|
+
send_code(s, curlen, s.bl_tree);
|
3576
|
+
count--;
|
3577
|
+
}
|
3578
|
+
//Assert(count >= 3 && count <= 6, " 3_6?");
|
3579
|
+
send_code(s, REP_3_6, s.bl_tree);
|
3580
|
+
send_bits(s, count - 3, 2);
|
3581
|
+
|
3582
|
+
} else if (count <= 10) {
|
3583
|
+
send_code(s, REPZ_3_10, s.bl_tree);
|
3584
|
+
send_bits(s, count - 3, 3);
|
3585
|
+
|
3586
|
+
} else {
|
3587
|
+
send_code(s, REPZ_11_138, s.bl_tree);
|
3588
|
+
send_bits(s, count - 11, 7);
|
3589
|
+
}
|
3590
|
+
|
3591
|
+
count = 0;
|
3592
|
+
prevlen = curlen;
|
3593
|
+
if (nextlen === 0) {
|
3594
|
+
max_count = 138;
|
3595
|
+
min_count = 3;
|
3596
|
+
|
3597
|
+
} else if (curlen === nextlen) {
|
3598
|
+
max_count = 6;
|
3599
|
+
min_count = 3;
|
3600
|
+
|
3601
|
+
} else {
|
3602
|
+
max_count = 7;
|
3603
|
+
min_count = 4;
|
3604
|
+
}
|
3605
|
+
}
|
3606
|
+
}
|
3607
|
+
|
3608
|
+
|
3609
|
+
/* ===========================================================================
|
3610
|
+
* Construct the Huffman tree for the bit lengths and return the index in
|
3611
|
+
* bl_order of the last bit length code to send.
|
3612
|
+
*/
|
3613
|
+
function build_bl_tree(s) {
|
3614
|
+
var max_blindex; /* index of last bit length code of non zero freq */
|
3615
|
+
|
3616
|
+
/* Determine the bit length frequencies for literal and distance trees */
|
3617
|
+
scan_tree(s, s.dyn_ltree, s.l_desc.max_code);
|
3618
|
+
scan_tree(s, s.dyn_dtree, s.d_desc.max_code);
|
3619
|
+
|
3620
|
+
/* Build the bit length tree: */
|
3621
|
+
build_tree(s, s.bl_desc);
|
3622
|
+
/* opt_len now includes the length of the tree representations, except
|
3623
|
+
* the lengths of the bit lengths codes and the 5+5+4 bits for the counts.
|
3624
|
+
*/
|
3625
|
+
|
3626
|
+
/* Determine the number of bit length codes to send. The pkzip format
|
3627
|
+
* requires that at least 4 bit length codes be sent. (appnote.txt says
|
3628
|
+
* 3 but the actual value used is 4.)
|
3629
|
+
*/
|
3630
|
+
for (max_blindex = BL_CODES - 1; max_blindex >= 3; max_blindex--) {
|
3631
|
+
if (s.bl_tree[bl_order[max_blindex] * 2 + 1]/*.Len*/ !== 0) {
|
3632
|
+
break;
|
3633
|
+
}
|
3634
|
+
}
|
3635
|
+
/* Update opt_len to include the bit length tree and counts */
|
3636
|
+
s.opt_len += 3 * (max_blindex + 1) + 5 + 5 + 4;
|
3637
|
+
//Tracev((stderr, "\ndyn trees: dyn %ld, stat %ld",
|
3638
|
+
// s->opt_len, s->static_len));
|
3639
|
+
|
3640
|
+
return max_blindex;
|
3641
|
+
}
|
3642
|
+
|
3643
|
+
|
3644
|
+
/* ===========================================================================
|
3645
|
+
* Send the header for a block using dynamic Huffman trees: the counts, the
|
3646
|
+
* lengths of the bit length codes, the literal tree and the distance tree.
|
3647
|
+
* IN assertion: lcodes >= 257, dcodes >= 1, blcodes >= 4.
|
3648
|
+
*/
|
3649
|
+
function send_all_trees(s, lcodes, dcodes, blcodes)
|
3650
|
+
// deflate_state *s;
|
3651
|
+
// int lcodes, dcodes, blcodes; /* number of codes for each tree */
|
3652
|
+
{
|
3653
|
+
var rank; /* index in bl_order */
|
3654
|
+
|
3655
|
+
//Assert (lcodes >= 257 && dcodes >= 1 && blcodes >= 4, "not enough codes");
|
3656
|
+
//Assert (lcodes <= L_CODES && dcodes <= D_CODES && blcodes <= BL_CODES,
|
3657
|
+
// "too many codes");
|
3658
|
+
//Tracev((stderr, "\nbl counts: "));
|
3659
|
+
send_bits(s, lcodes - 257, 5); /* not +255 as stated in appnote.txt */
|
3660
|
+
send_bits(s, dcodes - 1, 5);
|
3661
|
+
send_bits(s, blcodes - 4, 4); /* not -3 as stated in appnote.txt */
|
3662
|
+
for (rank = 0; rank < blcodes; rank++) {
|
3663
|
+
//Tracev((stderr, "\nbl code %2d ", bl_order[rank]));
|
3664
|
+
send_bits(s, s.bl_tree[bl_order[rank] * 2 + 1]/*.Len*/, 3);
|
3665
|
+
}
|
3666
|
+
//Tracev((stderr, "\nbl tree: sent %ld", s->bits_sent));
|
3667
|
+
|
3668
|
+
send_tree(s, s.dyn_ltree, lcodes - 1); /* literal tree */
|
3669
|
+
//Tracev((stderr, "\nlit tree: sent %ld", s->bits_sent));
|
3670
|
+
|
3671
|
+
send_tree(s, s.dyn_dtree, dcodes - 1); /* distance tree */
|
3672
|
+
//Tracev((stderr, "\ndist tree: sent %ld", s->bits_sent));
|
3673
|
+
}
|
3674
|
+
|
3675
|
+
|
3676
|
+
/* ===========================================================================
|
3677
|
+
* Check if the data type is TEXT or BINARY, using the following algorithm:
|
3678
|
+
* - TEXT if the two conditions below are satisfied:
|
3679
|
+
* a) There are no non-portable control characters belonging to the
|
3680
|
+
* "black list" (0..6, 14..25, 28..31).
|
3681
|
+
* b) There is at least one printable character belonging to the
|
3682
|
+
* "white list" (9 {TAB}, 10 {LF}, 13 {CR}, 32..255).
|
3683
|
+
* - BINARY otherwise.
|
3684
|
+
* - The following partially-portable control characters form a
|
3685
|
+
* "gray list" that is ignored in this detection algorithm:
|
3686
|
+
* (7 {BEL}, 8 {BS}, 11 {VT}, 12 {FF}, 26 {SUB}, 27 {ESC}).
|
3687
|
+
* IN assertion: the fields Freq of dyn_ltree are set.
|
3688
|
+
*/
|
3689
|
+
function detect_data_type(s) {
|
3690
|
+
/* black_mask is the bit mask of black-listed bytes
|
3691
|
+
* set bits 0..6, 14..25, and 28..31
|
3692
|
+
* 0xf3ffc07f = binary 11110011111111111100000001111111
|
3693
|
+
*/
|
3694
|
+
var black_mask = 0xf3ffc07f;
|
3695
|
+
var n;
|
3696
|
+
|
3697
|
+
/* Check for non-textual ("black-listed") bytes. */
|
3698
|
+
for (n = 0; n <= 31; n++, black_mask >>>= 1) {
|
3699
|
+
if ((black_mask & 1) && (s.dyn_ltree[n * 2]/*.Freq*/ !== 0)) {
|
3700
|
+
return Z_BINARY;
|
3701
|
+
}
|
3702
|
+
}
|
3703
|
+
|
3704
|
+
/* Check for textual ("white-listed") bytes. */
|
3705
|
+
if (s.dyn_ltree[9 * 2]/*.Freq*/ !== 0 || s.dyn_ltree[10 * 2]/*.Freq*/ !== 0 ||
|
3706
|
+
s.dyn_ltree[13 * 2]/*.Freq*/ !== 0) {
|
3707
|
+
return Z_TEXT;
|
3708
|
+
}
|
3709
|
+
for (n = 32; n < LITERALS; n++) {
|
3710
|
+
if (s.dyn_ltree[n * 2]/*.Freq*/ !== 0) {
|
3711
|
+
return Z_TEXT;
|
3712
|
+
}
|
3713
|
+
}
|
3714
|
+
|
3715
|
+
/* There are no "black-listed" or "white-listed" bytes:
|
3716
|
+
* this stream either is empty or has tolerated ("gray-listed") bytes only.
|
3717
|
+
*/
|
3718
|
+
return Z_BINARY;
|
3719
|
+
}
|
3720
|
+
|
3721
|
+
|
3722
|
+
var static_init_done = false;
|
3723
|
+
|
3724
|
+
/* ===========================================================================
|
3725
|
+
* Initialize the tree data structures for a new zlib stream.
|
3726
|
+
*/
|
3727
|
+
function _tr_init(s)
|
3728
|
+
{
|
3729
|
+
|
3730
|
+
if (!static_init_done) {
|
3731
|
+
tr_static_init();
|
3732
|
+
static_init_done = true;
|
3733
|
+
}
|
3734
|
+
|
3735
|
+
s.l_desc = new TreeDesc(s.dyn_ltree, static_l_desc);
|
3736
|
+
s.d_desc = new TreeDesc(s.dyn_dtree, static_d_desc);
|
3737
|
+
s.bl_desc = new TreeDesc(s.bl_tree, static_bl_desc);
|
3738
|
+
|
3739
|
+
s.bi_buf = 0;
|
3740
|
+
s.bi_valid = 0;
|
3741
|
+
|
3742
|
+
/* Initialize the first block of the first file: */
|
3743
|
+
init_block(s);
|
3744
|
+
}
|
3745
|
+
|
3746
|
+
|
3747
|
+
/* ===========================================================================
|
3748
|
+
* Send a stored block
|
3749
|
+
*/
|
3750
|
+
function _tr_stored_block(s, buf, stored_len, last)
|
3751
|
+
//DeflateState *s;
|
3752
|
+
//charf *buf; /* input block */
|
3753
|
+
//ulg stored_len; /* length of input block */
|
3754
|
+
//int last; /* one if this is the last block for a file */
|
3755
|
+
{
|
3756
|
+
send_bits(s, (STORED_BLOCK << 1) + (last ? 1 : 0), 3); /* send block type */
|
3757
|
+
copy_block(s, buf, stored_len, true); /* with header */
|
3758
|
+
}
|
3759
|
+
|
3760
|
+
|
3761
|
+
/* ===========================================================================
|
3762
|
+
* Send one empty static block to give enough lookahead for inflate.
|
3763
|
+
* This takes 10 bits, of which 7 may remain in the bit buffer.
|
3764
|
+
*/
|
3765
|
+
function _tr_align(s) {
|
3766
|
+
send_bits(s, STATIC_TREES << 1, 3);
|
3767
|
+
send_code(s, END_BLOCK, static_ltree);
|
3768
|
+
bi_flush(s);
|
3769
|
+
}
|
3770
|
+
|
3771
|
+
|
3772
|
+
/* ===========================================================================
|
3773
|
+
* Determine the best encoding for the current block: dynamic trees, static
|
3774
|
+
* trees or store, and output the encoded block to the zip file.
|
3775
|
+
*/
|
3776
|
+
function _tr_flush_block(s, buf, stored_len, last)
|
3777
|
+
//DeflateState *s;
|
3778
|
+
//charf *buf; /* input block, or NULL if too old */
|
3779
|
+
//ulg stored_len; /* length of input block */
|
3780
|
+
//int last; /* one if this is the last block for a file */
|
3781
|
+
{
|
3782
|
+
var opt_lenb, static_lenb; /* opt_len and static_len in bytes */
|
3783
|
+
var max_blindex = 0; /* index of last bit length code of non zero freq */
|
3784
|
+
|
3785
|
+
/* Build the Huffman trees unless a stored block is forced */
|
3786
|
+
if (s.level > 0) {
|
3787
|
+
|
3788
|
+
/* Check if the file is binary or text */
|
3789
|
+
if (s.strm.data_type === Z_UNKNOWN) {
|
3790
|
+
s.strm.data_type = detect_data_type(s);
|
3791
|
+
}
|
3792
|
+
|
3793
|
+
/* Construct the literal and distance trees */
|
3794
|
+
build_tree(s, s.l_desc);
|
3795
|
+
// Tracev((stderr, "\nlit data: dyn %ld, stat %ld", s->opt_len,
|
3796
|
+
// s->static_len));
|
3797
|
+
|
3798
|
+
build_tree(s, s.d_desc);
|
3799
|
+
// Tracev((stderr, "\ndist data: dyn %ld, stat %ld", s->opt_len,
|
3800
|
+
// s->static_len));
|
3801
|
+
/* At this point, opt_len and static_len are the total bit lengths of
|
3802
|
+
* the compressed block data, excluding the tree representations.
|
3803
|
+
*/
|
3804
|
+
|
3805
|
+
/* Build the bit length tree for the above two trees, and get the index
|
3806
|
+
* in bl_order of the last bit length code to send.
|
3807
|
+
*/
|
3808
|
+
max_blindex = build_bl_tree(s);
|
3809
|
+
|
3810
|
+
/* Determine the best encoding. Compute the block lengths in bytes. */
|
3811
|
+
opt_lenb = (s.opt_len + 3 + 7) >>> 3;
|
3812
|
+
static_lenb = (s.static_len + 3 + 7) >>> 3;
|
3813
|
+
|
3814
|
+
// Tracev((stderr, "\nopt %lu(%lu) stat %lu(%lu) stored %lu lit %u ",
|
3815
|
+
// opt_lenb, s->opt_len, static_lenb, s->static_len, stored_len,
|
3816
|
+
// s->last_lit));
|
3817
|
+
|
3818
|
+
if (static_lenb <= opt_lenb) { opt_lenb = static_lenb; }
|
3819
|
+
|
3820
|
+
} else {
|
3821
|
+
// Assert(buf != (char*)0, "lost buf");
|
3822
|
+
opt_lenb = static_lenb = stored_len + 5; /* force a stored block */
|
3823
|
+
}
|
3824
|
+
|
3825
|
+
if ((stored_len + 4 <= opt_lenb) && (buf !== -1)) {
|
3826
|
+
/* 4: two words for the lengths */
|
3827
|
+
|
3828
|
+
/* The test buf != NULL is only necessary if LIT_BUFSIZE > WSIZE.
|
3829
|
+
* Otherwise we can't have processed more than WSIZE input bytes since
|
3830
|
+
* the last block flush, because compression would have been
|
3831
|
+
* successful. If LIT_BUFSIZE <= WSIZE, it is never too late to
|
3832
|
+
* transform a block into a stored block.
|
3833
|
+
*/
|
3834
|
+
_tr_stored_block(s, buf, stored_len, last);
|
3835
|
+
|
3836
|
+
} else if (s.strategy === Z_FIXED || static_lenb === opt_lenb) {
|
3837
|
+
|
3838
|
+
send_bits(s, (STATIC_TREES << 1) + (last ? 1 : 0), 3);
|
3839
|
+
compress_block(s, static_ltree, static_dtree);
|
3840
|
+
|
3841
|
+
} else {
|
3842
|
+
send_bits(s, (DYN_TREES << 1) + (last ? 1 : 0), 3);
|
3843
|
+
send_all_trees(s, s.l_desc.max_code + 1, s.d_desc.max_code + 1, max_blindex + 1);
|
3844
|
+
compress_block(s, s.dyn_ltree, s.dyn_dtree);
|
3845
|
+
}
|
3846
|
+
// Assert (s->compressed_len == s->bits_sent, "bad compressed size");
|
3847
|
+
/* The above check is made mod 2^32, for files larger than 512 MB
|
3848
|
+
* and uLong implemented on 32 bits.
|
3849
|
+
*/
|
3850
|
+
init_block(s);
|
3851
|
+
|
3852
|
+
if (last) {
|
3853
|
+
bi_windup(s);
|
3854
|
+
}
|
3855
|
+
// Tracev((stderr,"\ncomprlen %lu(%lu) ", s->compressed_len>>3,
|
3856
|
+
// s->compressed_len-7*last));
|
3857
|
+
}
|
3858
|
+
|
3859
|
+
/* ===========================================================================
|
3860
|
+
* Save the match info and tally the frequency counts. Return true if
|
3861
|
+
* the current block must be flushed.
|
3862
|
+
*/
|
3863
|
+
function _tr_tally(s, dist, lc)
|
3864
|
+
// deflate_state *s;
|
3865
|
+
// unsigned dist; /* distance of matched string */
|
3866
|
+
// unsigned lc; /* match length-MIN_MATCH or unmatched char (if dist==0) */
|
3867
|
+
{
|
3868
|
+
//var out_length, in_length, dcode;
|
3869
|
+
|
3870
|
+
s.pending_buf[s.d_buf + s.last_lit * 2] = (dist >>> 8) & 0xff;
|
3871
|
+
s.pending_buf[s.d_buf + s.last_lit * 2 + 1] = dist & 0xff;
|
3872
|
+
|
3873
|
+
s.pending_buf[s.l_buf + s.last_lit] = lc & 0xff;
|
3874
|
+
s.last_lit++;
|
3875
|
+
|
3876
|
+
if (dist === 0) {
|
3877
|
+
/* lc is the unmatched char */
|
3878
|
+
s.dyn_ltree[lc * 2]/*.Freq*/++;
|
3879
|
+
} else {
|
3880
|
+
s.matches++;
|
3881
|
+
/* Here, lc is the match length - MIN_MATCH */
|
3882
|
+
dist--; /* dist = match distance - 1 */
|
3883
|
+
//Assert((ush)dist < (ush)MAX_DIST(s) &&
|
3884
|
+
// (ush)lc <= (ush)(MAX_MATCH-MIN_MATCH) &&
|
3885
|
+
// (ush)d_code(dist) < (ush)D_CODES, "_tr_tally: bad match");
|
3886
|
+
|
3887
|
+
s.dyn_ltree[(_length_code[lc] + LITERALS + 1) * 2]/*.Freq*/++;
|
3888
|
+
s.dyn_dtree[d_code(dist) * 2]/*.Freq*/++;
|
3889
|
+
}
|
3890
|
+
|
3891
|
+
// (!) This block is disabled in zlib defailts,
|
3892
|
+
// don't enable it for binary compatibility
|
3893
|
+
|
3894
|
+
//#ifdef TRUNCATE_BLOCK
|
3895
|
+
// /* Try to guess if it is profitable to stop the current block here */
|
3896
|
+
// if ((s.last_lit & 0x1fff) === 0 && s.level > 2) {
|
3897
|
+
// /* Compute an upper bound for the compressed length */
|
3898
|
+
// out_length = s.last_lit*8;
|
3899
|
+
// in_length = s.strstart - s.block_start;
|
3900
|
+
//
|
3901
|
+
// for (dcode = 0; dcode < D_CODES; dcode++) {
|
3902
|
+
// out_length += s.dyn_dtree[dcode*2]/*.Freq*/ * (5 + extra_dbits[dcode]);
|
3903
|
+
// }
|
3904
|
+
// out_length >>>= 3;
|
3905
|
+
// //Tracev((stderr,"\nlast_lit %u, in %ld, out ~%ld(%ld%%) ",
|
3906
|
+
// // s->last_lit, in_length, out_length,
|
3907
|
+
// // 100L - out_length*100L/in_length));
|
3908
|
+
// if (s.matches < (s.last_lit>>1)/*int /2*/ && out_length < (in_length>>1)/*int /2*/) {
|
3909
|
+
// return true;
|
3910
|
+
// }
|
3911
|
+
// }
|
3912
|
+
//#endif
|
3913
|
+
|
3914
|
+
return (s.last_lit === s.lit_bufsize - 1);
|
3915
|
+
/* We avoid equality with lit_bufsize because of wraparound at 64K
|
3916
|
+
* on 16 bit machines and because stored blocks are restricted to
|
3917
|
+
* 64K-1 bytes.
|
3918
|
+
*/
|
3919
|
+
}
|
3920
|
+
|
3921
|
+
exports._tr_init = _tr_init;
|
3922
|
+
exports._tr_stored_block = _tr_stored_block;
|
3923
|
+
exports._tr_flush_block = _tr_flush_block;
|
3924
|
+
exports._tr_tally = _tr_tally;
|
3925
|
+
exports._tr_align = _tr_align;
|
3926
|
+
|
3927
|
+
},{"../utils/common":5}],12:[function(require,module,exports){
|
3928
|
+
'use strict';
|
3929
|
+
|
3930
|
+
|
3931
|
+
function ZStream() {
|
3932
|
+
/* next input byte */
|
3933
|
+
this.input = null; // JS specific, because we have no pointers
|
3934
|
+
this.next_in = 0;
|
3935
|
+
/* number of bytes available at input */
|
3936
|
+
this.avail_in = 0;
|
3937
|
+
/* total number of input bytes read so far */
|
3938
|
+
this.total_in = 0;
|
3939
|
+
/* next output byte should be put there */
|
3940
|
+
this.output = null; // JS specific, because we have no pointers
|
3941
|
+
this.next_out = 0;
|
3942
|
+
/* remaining free space at output */
|
3943
|
+
this.avail_out = 0;
|
3944
|
+
/* total number of bytes output so far */
|
3945
|
+
this.total_out = 0;
|
3946
|
+
/* last error message, NULL if no error */
|
3947
|
+
this.msg = ''/*Z_NULL*/;
|
3948
|
+
/* not visible by applications */
|
3949
|
+
this.state = null;
|
3950
|
+
/* best guess about the data type: binary or text */
|
3951
|
+
this.data_type = 2/*Z_UNKNOWN*/;
|
3952
|
+
/* adler32 value of the uncompressed data */
|
3953
|
+
this.adler = 0;
|
3954
|
+
}
|
3955
|
+
|
3956
|
+
module.exports = ZStream;
|
3957
|
+
|
3958
|
+
},{}],13:[function(require,module,exports){
|
3959
|
+
module.exports = function (str) {
|
3960
|
+
var bytes = [];
|
3961
|
+
for (var i = 0; i < str.length; i++) {
|
3962
|
+
var c = str.charCodeAt(i);
|
3963
|
+
if (c >= 0xd800 && c <= 0xdbff && i + 1 < str.length) {
|
3964
|
+
var cn = str.charCodeAt(i + 1);
|
3965
|
+
if (cn >= 0xdc00 && cn <= 0xdfff) {
|
3966
|
+
var pt = (c - 0xd800) * 0x400 + cn - 0xdc00 + 0x10000;
|
3967
|
+
|
3968
|
+
bytes.push(
|
3969
|
+
0xf0 + Math.floor(pt / 64 / 64 / 64),
|
3970
|
+
0x80 + Math.floor(pt / 64 / 64) % 64,
|
3971
|
+
0x80 + Math.floor(pt / 64) % 64,
|
3972
|
+
0x80 + pt % 64
|
3973
|
+
);
|
3974
|
+
i += 1;
|
3975
|
+
continue;
|
3976
|
+
}
|
3977
|
+
}
|
3978
|
+
if (c >= 2048) {
|
3979
|
+
bytes.push(
|
3980
|
+
0xe0 + Math.floor(c / 64 / 64),
|
3981
|
+
0x80 + Math.floor(c / 64) % 64,
|
3982
|
+
0x80 + c % 64
|
3983
|
+
);
|
3984
|
+
}
|
3985
|
+
else if (c >= 128) {
|
3986
|
+
bytes.push(0xc0 + Math.floor(c / 64), 0x80 + c % 64);
|
3987
|
+
}
|
3988
|
+
else bytes.push(c);
|
3989
|
+
}
|
3990
|
+
return bytes;
|
3991
|
+
};
|
3992
|
+
|
3993
|
+
},{}]},{},[1])(1)
|
3994
|
+
});
|